aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/ppc
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'arch/ppc')
-rw-r--r--arch/ppc/4xx_io/Makefile6
-rw-r--r--arch/ppc/4xx_io/serial_sicc.c2012
-rw-r--r--arch/ppc/8260_io/Kconfig65
-rw-r--r--arch/ppc/8260_io/Makefile6
-rw-r--r--arch/ppc/8260_io/enet.c867
-rw-r--r--arch/ppc/8260_io/fcc_enet.c2395
-rw-r--r--arch/ppc/8xx_io/Kconfig138
-rw-r--r--arch/ppc/8xx_io/Makefile10
-rw-r--r--arch/ppc/8xx_io/commproc.c464
-rw-r--r--arch/ppc/8xx_io/cs4218.h167
-rw-r--r--arch/ppc/8xx_io/cs4218_tdm.c2836
-rw-r--r--arch/ppc/8xx_io/enet.c971
-rw-r--r--arch/ppc/8xx_io/fec.c1973
-rw-r--r--arch/ppc/8xx_io/micropatch.c744
-rw-r--r--arch/ppc/Kconfig1317
-rw-r--r--arch/ppc/Kconfig.debug72
-rw-r--r--arch/ppc/Makefile138
-rw-r--r--arch/ppc/amiga/Makefile8
-rw-r--r--arch/ppc/amiga/amiga_ksyms.c1
-rw-r--r--arch/ppc/amiga/amiints.c323
-rw-r--r--arch/ppc/amiga/amisound.c1
-rw-r--r--arch/ppc/amiga/bootinfo.c80
-rw-r--r--arch/ppc/amiga/chipram.c1
-rw-r--r--arch/ppc/amiga/cia.c178
-rw-r--r--arch/ppc/amiga/config.c962
-rw-r--r--arch/ppc/amiga/ints.c160
-rw-r--r--arch/ppc/amiga/pcmcia.c1
-rw-r--r--arch/ppc/amiga/time.c58
-rw-r--r--arch/ppc/boot/Makefile34
-rw-r--r--arch/ppc/boot/common/Makefile13
-rw-r--r--arch/ppc/boot/common/bootinfo.c70
-rw-r--r--arch/ppc/boot/common/crt0.S81
-rw-r--r--arch/ppc/boot/common/misc-common.c553
-rw-r--r--arch/ppc/boot/common/ns16550.c99
-rw-r--r--arch/ppc/boot/common/serial_stub.c23
-rw-r--r--arch/ppc/boot/common/string.S150
-rw-r--r--arch/ppc/boot/common/util.S293
-rw-r--r--arch/ppc/boot/images/Makefile27
-rw-r--r--arch/ppc/boot/include/cpc700.h26
-rw-r--r--arch/ppc/boot/include/iso_font.h257
-rw-r--r--arch/ppc/boot/include/mpc10x.h65
-rw-r--r--arch/ppc/boot/include/mpsc_defs.h146
-rw-r--r--arch/ppc/boot/include/nonstdio.h34
-rw-r--r--arch/ppc/boot/include/of1275.h39
-rw-r--r--arch/ppc/boot/include/rs6000.h243
-rw-r--r--arch/ppc/boot/include/serial.h46
-rw-r--r--arch/ppc/boot/ld.script88
-rw-r--r--arch/ppc/boot/lib/Makefile23
-rw-r--r--arch/ppc/boot/lib/div64.S58
-rw-r--r--arch/ppc/boot/lib/kbd.c248
-rw-r--r--arch/ppc/boot/lib/vreset.c805
-rw-r--r--arch/ppc/boot/of1275/Makefile6
-rw-r--r--arch/ppc/boot/of1275/claim.c34
-rw-r--r--arch/ppc/boot/of1275/enter.c22
-rw-r--r--arch/ppc/boot/of1275/exit.c24
-rw-r--r--arch/ppc/boot/of1275/finddevice.c31
-rw-r--r--arch/ppc/boot/of1275/getprop.c37
-rw-r--r--arch/ppc/boot/of1275/map.c48
-rw-r--r--arch/ppc/boot/of1275/ofinit.c27
-rw-r--r--arch/ppc/boot/of1275/ofstdio.c32
-rw-r--r--arch/ppc/boot/of1275/read.c35
-rw-r--r--arch/ppc/boot/of1275/release.c30
-rw-r--r--arch/ppc/boot/of1275/write.c35
-rw-r--r--arch/ppc/boot/openfirmware/Makefile188
-rw-r--r--arch/ppc/boot/openfirmware/chrpmain.c101
-rw-r--r--arch/ppc/boot/openfirmware/coffmain.c101
-rw-r--r--arch/ppc/boot/openfirmware/common.c162
-rw-r--r--arch/ppc/boot/openfirmware/dummy.c4
-rw-r--r--arch/ppc/boot/openfirmware/misc.S67
-rw-r--r--arch/ppc/boot/openfirmware/newworldmain.c94
-rw-r--r--arch/ppc/boot/openfirmware/start.c172
-rw-r--r--arch/ppc/boot/simple/Makefile252
-rw-r--r--arch/ppc/boot/simple/chrpmap.c12
-rw-r--r--arch/ppc/boot/simple/clear.S19
-rw-r--r--arch/ppc/boot/simple/cpc700_memory.c36
-rw-r--r--arch/ppc/boot/simple/dummy.c4
-rw-r--r--arch/ppc/boot/simple/embed_config.c981
-rw-r--r--arch/ppc/boot/simple/head.S142
-rw-r--r--arch/ppc/boot/simple/iic.c214
-rw-r--r--arch/ppc/boot/simple/m8260_tty.c325
-rw-r--r--arch/ppc/boot/simple/m8xx_tty.c290
-rw-r--r--arch/ppc/boot/simple/misc-chestnut.c35
-rw-r--r--arch/ppc/boot/simple/misc-cpci690.c27
-rw-r--r--arch/ppc/boot/simple/misc-embedded.c275
-rw-r--r--arch/ppc/boot/simple/misc-ev64260.c57
-rw-r--r--arch/ppc/boot/simple/misc-katana.c37
-rw-r--r--arch/ppc/boot/simple/misc-mv64x60.c61
-rw-r--r--arch/ppc/boot/simple/misc-prep.c212
-rw-r--r--arch/ppc/boot/simple/misc-radstone_ppc7d.c26
-rw-r--r--arch/ppc/boot/simple/misc-spruce.c274
-rw-r--r--arch/ppc/boot/simple/misc.c284
-rw-r--r--arch/ppc/boot/simple/mpc10x_memory.c111
-rw-r--r--arch/ppc/boot/simple/mpc52xx_tty.c140
-rw-r--r--arch/ppc/boot/simple/mv64x60_tty.c360
-rw-r--r--arch/ppc/boot/simple/openbios.c37
-rw-r--r--arch/ppc/boot/simple/pci.c274
-rw-r--r--arch/ppc/boot/simple/pibs.c103
-rw-r--r--arch/ppc/boot/simple/prepmap.c12
-rw-r--r--arch/ppc/boot/simple/qspan_pci.c269
-rw-r--r--arch/ppc/boot/simple/relocate.S216
-rw-r--r--arch/ppc/boot/simple/rw4/ppc_40x.h664
-rw-r--r--arch/ppc/boot/simple/rw4/rw4_init.S78
-rw-r--r--arch/ppc/boot/simple/rw4/rw4_init_brd.S1125
-rw-r--r--arch/ppc/boot/simple/rw4/stb.h239
-rw-r--r--arch/ppc/boot/utils/addRamDisk.c203
-rw-r--r--arch/ppc/boot/utils/addSystemMap.c186
-rw-r--r--arch/ppc/boot/utils/addnote.c175
-rw-r--r--arch/ppc/boot/utils/elf.pl33
-rw-r--r--arch/ppc/boot/utils/hack-coff.c84
-rw-r--r--arch/ppc/boot/utils/mkbugboot.c187
-rw-r--r--arch/ppc/boot/utils/mknote.c44
-rw-r--r--arch/ppc/boot/utils/mkprep.c293
-rw-r--r--arch/ppc/boot/utils/mktree.c152
-rw-r--r--arch/ppc/configs/FADS_defconfig520
-rw-r--r--arch/ppc/configs/IVMS8_defconfig548
-rw-r--r--arch/ppc/configs/SM850_defconfig522
-rw-r--r--arch/ppc/configs/SPD823TS_defconfig520
-rw-r--r--arch/ppc/configs/TQM823L_defconfig521
-rw-r--r--arch/ppc/configs/TQM8260_defconfig499
-rw-r--r--arch/ppc/configs/TQM850L_defconfig521
-rw-r--r--arch/ppc/configs/TQM860L_defconfig549
-rw-r--r--arch/ppc/configs/adir_defconfig805
-rw-r--r--arch/ppc/configs/ads8272_defconfig582
-rw-r--r--arch/ppc/configs/apus_defconfig920
-rw-r--r--arch/ppc/configs/ash_defconfig666
-rw-r--r--arch/ppc/configs/beech_defconfig615
-rw-r--r--arch/ppc/configs/bseip_defconfig517
-rw-r--r--arch/ppc/configs/bubinga_defconfig592
-rw-r--r--arch/ppc/configs/cedar_defconfig534
-rw-r--r--arch/ppc/configs/chestnut_defconfig794
-rw-r--r--arch/ppc/configs/common_defconfig1421
-rw-r--r--arch/ppc/configs/cpci405_defconfig631
-rw-r--r--arch/ppc/configs/cpci690_defconfig686
-rw-r--r--arch/ppc/configs/ebony_defconfig585
-rw-r--r--arch/ppc/configs/ep405_defconfig572
-rw-r--r--arch/ppc/configs/est8260_defconfig491
-rw-r--r--arch/ppc/configs/ev64260_defconfig759
-rw-r--r--arch/ppc/configs/gemini_defconfig618
-rw-r--r--arch/ppc/configs/hdpu_defconfig890
-rw-r--r--arch/ppc/configs/ibmchrp_defconfig875
-rw-r--r--arch/ppc/configs/k2_defconfig680
-rw-r--r--arch/ppc/configs/katana_defconfig861
-rw-r--r--arch/ppc/configs/lite5200_defconfig436
-rw-r--r--arch/ppc/configs/lopec_defconfig814
-rw-r--r--arch/ppc/configs/luan_defconfig668
-rw-r--r--arch/ppc/configs/mbx_defconfig512
-rw-r--r--arch/ppc/configs/mcpn765_defconfig579
-rw-r--r--arch/ppc/configs/menf1_defconfig621
-rw-r--r--arch/ppc/configs/mpc834x_sys_defconfig644
-rw-r--r--arch/ppc/configs/mpc8540_ads_defconfig707
-rw-r--r--arch/ppc/configs/mpc8555_cds_defconfig718
-rw-r--r--arch/ppc/configs/mpc8560_ads_defconfig719
-rw-r--r--arch/ppc/configs/mvme5100_defconfig746
-rw-r--r--arch/ppc/configs/oak_defconfig485
-rw-r--r--arch/ppc/configs/ocotea_defconfig599
-rw-r--r--arch/ppc/configs/pcore_defconfig716
-rw-r--r--arch/ppc/configs/pmac_defconfig1523
-rw-r--r--arch/ppc/configs/power3_defconfig1034
-rw-r--r--arch/ppc/configs/pplus_defconfig720
-rw-r--r--arch/ppc/configs/prpmc750_defconfig594
-rw-r--r--arch/ppc/configs/prpmc800_defconfig656
-rw-r--r--arch/ppc/configs/radstone_ppc7d_defconfig956
-rw-r--r--arch/ppc/configs/rainier_defconfig599
-rw-r--r--arch/ppc/configs/redwood5_defconfig557
-rw-r--r--arch/ppc/configs/redwood6_defconfig535
-rw-r--r--arch/ppc/configs/redwood_defconfig540
-rw-r--r--arch/ppc/configs/rpx8260_defconfig555
-rw-r--r--arch/ppc/configs/rpxcllf_defconfig582
-rw-r--r--arch/ppc/configs/rpxlite_defconfig581
-rw-r--r--arch/ppc/configs/sandpoint_defconfig737
-rw-r--r--arch/ppc/configs/spruce_defconfig577
-rw-r--r--arch/ppc/configs/stx_gp3_defconfig972
-rw-r--r--arch/ppc/configs/sycamore_defconfig664
-rw-r--r--arch/ppc/configs/walnut_defconfig578
-rw-r--r--arch/ppc/kernel/Makefile33
-rw-r--r--arch/ppc/kernel/align.c398
-rw-r--r--arch/ppc/kernel/asm-offsets.c146
-rw-r--r--arch/ppc/kernel/bitops.c126
-rw-r--r--arch/ppc/kernel/cpu_setup_6xx.S440
-rw-r--r--arch/ppc/kernel/cpu_setup_power4.S201
-rw-r--r--arch/ppc/kernel/cputable.c922
-rw-r--r--arch/ppc/kernel/dma-mapping.c447
-rw-r--r--arch/ppc/kernel/entry.S969
-rw-r--r--arch/ppc/kernel/find_name.c48
-rw-r--r--arch/ppc/kernel/head.S1710
-rw-r--r--arch/ppc/kernel/head_44x.S753
-rw-r--r--arch/ppc/kernel/head_4xx.S1010
-rw-r--r--arch/ppc/kernel/head_8xx.S862
-rw-r--r--arch/ppc/kernel/head_booke.h340
-rw-r--r--arch/ppc/kernel/head_fsl_booke.S952
-rw-r--r--arch/ppc/kernel/idle.c100
-rw-r--r--arch/ppc/kernel/idle_6xx.S233
-rw-r--r--arch/ppc/kernel/idle_power4.S91
-rw-r--r--arch/ppc/kernel/irq.c164
-rw-r--r--arch/ppc/kernel/l2cr.S442
-rw-r--r--arch/ppc/kernel/misc.S1453
-rw-r--r--arch/ppc/kernel/module.c320
-rw-r--r--arch/ppc/kernel/pci.c1849
-rw-r--r--arch/ppc/kernel/perfmon.c93
-rw-r--r--arch/ppc/kernel/perfmon_fsl_booke.c222
-rw-r--r--arch/ppc/kernel/ppc-stub.c867
-rw-r--r--arch/ppc/kernel/ppc_htab.c467
-rw-r--r--arch/ppc/kernel/ppc_ksyms.c350
-rw-r--r--arch/ppc/kernel/process.c781
-rw-r--r--arch/ppc/kernel/ptrace.c474
-rw-r--r--arch/ppc/kernel/semaphore.c131
-rw-r--r--arch/ppc/kernel/setup.c778
-rw-r--r--arch/ppc/kernel/signal.c775
-rw-r--r--arch/ppc/kernel/smp-tbsync.c181
-rw-r--r--arch/ppc/kernel/smp.c399
-rw-r--r--arch/ppc/kernel/softemu8xx.c147
-rw-r--r--arch/ppc/kernel/swsusp.S349
-rw-r--r--arch/ppc/kernel/syscalls.c272
-rw-r--r--arch/ppc/kernel/temp.c272
-rw-r--r--arch/ppc/kernel/time.c447
-rw-r--r--arch/ppc/kernel/traps.c886
-rw-r--r--arch/ppc/kernel/vecemu.c345
-rw-r--r--arch/ppc/kernel/vector.S217
-rw-r--r--arch/ppc/kernel/vmlinux.lds.S192
-rw-r--r--arch/ppc/lib/Makefile9
-rw-r--r--arch/ppc/lib/checksum.S225
-rw-r--r--arch/ppc/lib/dec_and_lock.c46
-rw-r--r--arch/ppc/lib/div64.S58
-rw-r--r--arch/ppc/lib/locks.c190
-rw-r--r--arch/ppc/lib/rheap.c693
-rw-r--r--arch/ppc/lib/strcase.c23
-rw-r--r--arch/ppc/lib/string.S716
-rw-r--r--arch/ppc/math-emu/Makefile13
-rw-r--r--arch/ppc/math-emu/double.h129
-rw-r--r--arch/ppc/math-emu/fabs.c18
-rw-r--r--arch/ppc/math-emu/fadd.c38
-rw-r--r--arch/ppc/math-emu/fadds.c39
-rw-r--r--arch/ppc/math-emu/fcmpo.c46
-rw-r--r--arch/ppc/math-emu/fcmpu.c42
-rw-r--r--arch/ppc/math-emu/fctiw.c25
-rw-r--r--arch/ppc/math-emu/fctiwz.c32
-rw-r--r--arch/ppc/math-emu/fdiv.c53
-rw-r--r--arch/ppc/math-emu/fdivs.c55
-rw-r--r--arch/ppc/math-emu/fmadd.c48
-rw-r--r--arch/ppc/math-emu/fmadds.c49
-rw-r--r--arch/ppc/math-emu/fmr.c18
-rw-r--r--arch/ppc/math-emu/fmsub.c51
-rw-r--r--arch/ppc/math-emu/fmsubs.c52
-rw-r--r--arch/ppc/math-emu/fmul.c42
-rw-r--r--arch/ppc/math-emu/fmuls.c43
-rw-r--r--arch/ppc/math-emu/fnabs.c18
-rw-r--r--arch/ppc/math-emu/fneg.c18
-rw-r--r--arch/ppc/math-emu/fnmadd.c51
-rw-r--r--arch/ppc/math-emu/fnmadds.c52
-rw-r--r--arch/ppc/math-emu/fnmsub.c54
-rw-r--r--arch/ppc/math-emu/fnmsubs.c55
-rw-r--r--arch/ppc/math-emu/fres.c12
-rw-r--r--arch/ppc/math-emu/frsp.c25
-rw-r--r--arch/ppc/math-emu/frsqrte.c12
-rw-r--r--arch/ppc/math-emu/fsel.c38
-rw-r--r--arch/ppc/math-emu/fsqrt.c37
-rw-r--r--arch/ppc/math-emu/fsqrts.c38
-rw-r--r--arch/ppc/math-emu/fsub.c41
-rw-r--r--arch/ppc/math-emu/fsubs.c42
-rw-r--r--arch/ppc/math-emu/lfd.c19
-rw-r--r--arch/ppc/math-emu/lfs.c37
-rw-r--r--arch/ppc/math-emu/math.c485
-rw-r--r--arch/ppc/math-emu/mcrfs.c31
-rw-r--r--arch/ppc/math-emu/mffs.c17
-rw-r--r--arch/ppc/math-emu/mtfsb0.c18
-rw-r--r--arch/ppc/math-emu/mtfsb1.c18
-rw-r--r--arch/ppc/math-emu/mtfsf.c45
-rw-r--r--arch/ppc/math-emu/mtfsfi.c23
-rw-r--r--arch/ppc/math-emu/op-1.h245
-rw-r--r--arch/ppc/math-emu/op-2.h433
-rw-r--r--arch/ppc/math-emu/op-4.h297
-rw-r--r--arch/ppc/math-emu/op-common.h688
-rw-r--r--arch/ppc/math-emu/sfp-machine.h377
-rw-r--r--arch/ppc/math-emu/single.h66
-rw-r--r--arch/ppc/math-emu/soft-fp.h104
-rw-r--r--arch/ppc/math-emu/stfd.c20
-rw-r--r--arch/ppc/math-emu/stfiwx.c16
-rw-r--r--arch/ppc/math-emu/stfs.c41
-rw-r--r--arch/ppc/math-emu/types.c51
-rw-r--r--arch/ppc/math-emu/udivmodti4.c191
-rw-r--r--arch/ppc/mm/44x_mmu.c121
-rw-r--r--arch/ppc/mm/4xx_mmu.c142
-rw-r--r--arch/ppc/mm/Makefile11
-rw-r--r--arch/ppc/mm/fault.c440
-rw-r--r--arch/ppc/mm/fsl_booke_mmu.c236
-rw-r--r--arch/ppc/mm/hashtable.S642
-rw-r--r--arch/ppc/mm/init.c667
-rw-r--r--arch/ppc/mm/mem_pieces.c163
-rw-r--r--arch/ppc/mm/mem_pieces.h48
-rw-r--r--arch/ppc/mm/mmu_context.c86
-rw-r--r--arch/ppc/mm/mmu_decl.h83
-rw-r--r--arch/ppc/mm/pgtable.c471
-rw-r--r--arch/ppc/mm/ppc_mmu.c296
-rw-r--r--arch/ppc/mm/tlb.c183
-rw-r--r--arch/ppc/oprofile/Kconfig23
-rw-r--r--arch/ppc/oprofile/Makefile14
-rw-r--r--arch/ppc/oprofile/common.c161
-rw-r--r--arch/ppc/oprofile/op_impl.h45
-rw-r--r--arch/ppc/oprofile/op_model_fsl_booke.c184
-rw-r--r--arch/ppc/platforms/4xx/Kconfig247
-rw-r--r--arch/ppc/platforms/4xx/Makefile27
-rw-r--r--arch/ppc/platforms/4xx/ash.c250
-rw-r--r--arch/ppc/platforms/4xx/ash.h83
-rw-r--r--arch/ppc/platforms/4xx/bubinga.c263
-rw-r--r--arch/ppc/platforms/4xx/bubinga.h69
-rw-r--r--arch/ppc/platforms/4xx/cpci405.c84
-rw-r--r--arch/ppc/platforms/4xx/cpci405.h37
-rw-r--r--arch/ppc/platforms/4xx/ebony.c356
-rw-r--r--arch/ppc/platforms/4xx/ebony.h91
-rw-r--r--arch/ppc/platforms/4xx/ep405.c197
-rw-r--r--arch/ppc/platforms/4xx/ep405.h54
-rw-r--r--arch/ppc/platforms/4xx/ibm405ep.c143
-rw-r--r--arch/ppc/platforms/4xx/ibm405ep.h148
-rw-r--r--arch/ppc/platforms/4xx/ibm405gp.c120
-rw-r--r--arch/ppc/platforms/4xx/ibm405gp.h151
-rw-r--r--arch/ppc/platforms/4xx/ibm405gpr.c117
-rw-r--r--arch/ppc/platforms/4xx/ibm405gpr.h151
-rw-r--r--arch/ppc/platforms/4xx/ibm440gp.c164
-rw-r--r--arch/ppc/platforms/4xx/ibm440gp.h66
-rw-r--r--arch/ppc/platforms/4xx/ibm440gx.c234
-rw-r--r--arch/ppc/platforms/4xx/ibm440gx.h74
-rw-r--r--arch/ppc/platforms/4xx/ibm440sp.c131
-rw-r--r--arch/ppc/platforms/4xx/ibm440sp.h64
-rw-r--r--arch/ppc/platforms/4xx/ibmnp405h.c172
-rw-r--r--arch/ppc/platforms/4xx/ibmnp405h.h157
-rw-r--r--arch/ppc/platforms/4xx/ibmstb4.c83
-rw-r--r--arch/ppc/platforms/4xx/ibmstb4.h238
-rw-r--r--arch/ppc/platforms/4xx/ibmstbx25.c68
-rw-r--r--arch/ppc/platforms/4xx/ibmstbx25.h261
-rw-r--r--arch/ppc/platforms/4xx/luan.c387
-rw-r--r--arch/ppc/platforms/4xx/luan.h80
-rw-r--r--arch/ppc/platforms/4xx/oak.c255
-rw-r--r--arch/ppc/platforms/4xx/oak.h96
-rw-r--r--arch/ppc/platforms/4xx/oak_setup.h50
-rw-r--r--arch/ppc/platforms/4xx/ocotea.c367
-rw-r--r--arch/ppc/platforms/4xx/ocotea.h88
-rw-r--r--arch/ppc/platforms/4xx/redwood5.c110
-rw-r--r--arch/ppc/platforms/4xx/redwood5.h54
-rw-r--r--arch/ppc/platforms/4xx/redwood6.c159
-rw-r--r--arch/ppc/platforms/4xx/redwood6.h55
-rw-r--r--arch/ppc/platforms/4xx/sycamore.c278
-rw-r--r--arch/ppc/platforms/4xx/sycamore.h67
-rw-r--r--arch/ppc/platforms/4xx/virtex-ii_pro.c60
-rw-r--r--arch/ppc/platforms/4xx/virtex-ii_pro.h99
-rw-r--r--arch/ppc/platforms/4xx/walnut.c249
-rw-r--r--arch/ppc/platforms/4xx/walnut.h72
-rw-r--r--arch/ppc/platforms/4xx/xilinx_ml300.c146
-rw-r--r--arch/ppc/platforms/4xx/xilinx_ml300.h47
-rw-r--r--arch/ppc/platforms/4xx/xparameters/xparameters_ml300.h310
-rw-r--r--arch/ppc/platforms/83xx/Makefile4
-rw-r--r--arch/ppc/platforms/83xx/mpc834x_sys.c289
-rw-r--r--arch/ppc/platforms/83xx/mpc834x_sys.h51
-rw-r--r--arch/ppc/platforms/85xx/Kconfig76
-rw-r--r--arch/ppc/platforms/85xx/Makefile8
-rw-r--r--arch/ppc/platforms/85xx/mpc8540_ads.c218
-rw-r--r--arch/ppc/platforms/85xx/mpc8540_ads.h25
-rw-r--r--arch/ppc/platforms/85xx/mpc8555_cds.h26
-rw-r--r--arch/ppc/platforms/85xx/mpc8560_ads.c210
-rw-r--r--arch/ppc/platforms/85xx/mpc8560_ads.h27
-rw-r--r--arch/ppc/platforms/85xx/mpc85xx_ads_common.c225
-rw-r--r--arch/ppc/platforms/85xx/mpc85xx_ads_common.h50
-rw-r--r--arch/ppc/platforms/85xx/mpc85xx_cds_common.c467
-rw-r--r--arch/ppc/platforms/85xx/mpc85xx_cds_common.h80
-rw-r--r--arch/ppc/platforms/85xx/sbc8560.c227
-rw-r--r--arch/ppc/platforms/85xx/sbc8560.h49
-rw-r--r--arch/ppc/platforms/85xx/sbc85xx.c203
-rw-r--r--arch/ppc/platforms/85xx/sbc85xx.h55
-rw-r--r--arch/ppc/platforms/85xx/stx_gp3.c355
-rw-r--r--arch/ppc/platforms/85xx/stx_gp3.h74
-rw-r--r--arch/ppc/platforms/Makefile53
-rw-r--r--arch/ppc/platforms/adir.h95
-rw-r--r--arch/ppc/platforms/adir_pci.c247
-rw-r--r--arch/ppc/platforms/adir_pic.c130
-rw-r--r--arch/ppc/platforms/adir_setup.c210
-rw-r--r--arch/ppc/platforms/apus_pci.c208
-rw-r--r--arch/ppc/platforms/apus_pci.h34
-rw-r--r--arch/ppc/platforms/apus_setup.c815
-rw-r--r--arch/ppc/platforms/bseip.h38
-rw-r--r--arch/ppc/platforms/ccm.h28
-rw-r--r--arch/ppc/platforms/chestnut.c580
-rw-r--r--arch/ppc/platforms/chestnut.h129
-rw-r--r--arch/ppc/platforms/chrp_pci.c309
-rw-r--r--arch/ppc/platforms/chrp_pegasos_eth.c101
-rw-r--r--arch/ppc/platforms/chrp_setup.c615
-rw-r--r--arch/ppc/platforms/chrp_smp.c98
-rw-r--r--arch/ppc/platforms/chrp_time.c194
-rw-r--r--arch/ppc/platforms/cpci690.c491
-rw-r--r--arch/ppc/platforms/cpci690.h78
-rw-r--r--arch/ppc/platforms/est8260.h35
-rw-r--r--arch/ppc/platforms/ev64260.c651
-rw-r--r--arch/ppc/platforms/ev64260.h128
-rw-r--r--arch/ppc/platforms/fads.h57
-rw-r--r--arch/ppc/platforms/gemini.h168
-rw-r--r--arch/ppc/platforms/gemini_pci.c41
-rw-r--r--arch/ppc/platforms/gemini_prom.S93
-rw-r--r--arch/ppc/platforms/gemini_serial.h41
-rw-r--r--arch/ppc/platforms/gemini_setup.c584
-rw-r--r--arch/ppc/platforms/hdpu.c1062
-rw-r--r--arch/ppc/platforms/hdpu.h82
-rw-r--r--arch/ppc/platforms/hermes.h27
-rw-r--r--arch/ppc/platforms/ip860.h36
-rw-r--r--arch/ppc/platforms/ivms8.h56
-rw-r--r--arch/ppc/platforms/k2.c613
-rw-r--r--arch/ppc/platforms/k2.h82
-rw-r--r--arch/ppc/platforms/katana.c795
-rw-r--r--arch/ppc/platforms/katana.h255
-rw-r--r--arch/ppc/platforms/lantec.h21
-rw-r--r--arch/ppc/platforms/lite5200.c236
-rw-r--r--arch/ppc/platforms/lite5200.h23
-rw-r--r--arch/ppc/platforms/lopec.c411
-rw-r--r--arch/ppc/platforms/lopec.h39
-rw-r--r--arch/ppc/platforms/lwmon.h60
-rw-r--r--arch/ppc/platforms/mbx.h117
-rw-r--r--arch/ppc/platforms/mcpn765.c527
-rw-r--r--arch/ppc/platforms/mcpn765.h122
-rw-r--r--arch/ppc/platforms/mpc5200.c53
-rw-r--r--arch/ppc/platforms/mvme5100.c349
-rw-r--r--arch/ppc/platforms/mvme5100.h91
-rw-r--r--arch/ppc/platforms/pal4.h42
-rw-r--r--arch/ppc/platforms/pal4_pci.c77
-rw-r--r--arch/ppc/platforms/pal4_serial.h39
-rw-r--r--arch/ppc/platforms/pal4_setup.c175
-rw-r--r--arch/ppc/platforms/pcore.c352
-rw-r--r--arch/ppc/platforms/pcore.h39
-rw-r--r--arch/ppc/platforms/pcu_e.h28
-rw-r--r--arch/ppc/platforms/pmac_backlight.c202
-rw-r--r--arch/ppc/platforms/pmac_cache.S325
-rw-r--r--arch/ppc/platforms/pmac_cpufreq.c571
-rw-r--r--arch/ppc/platforms/pmac_feature.c2972
-rw-r--r--arch/ppc/platforms/pmac_low_i2c.c513
-rw-r--r--arch/ppc/platforms/pmac_nvram.c584
-rw-r--r--arch/ppc/platforms/pmac_pci.c1125
-rw-r--r--arch/ppc/platforms/pmac_pic.c689
-rw-r--r--arch/ppc/platforms/pmac_pic.h11
-rw-r--r--arch/ppc/platforms/pmac_setup.c745
-rw-r--r--arch/ppc/platforms/pmac_sleep.S390
-rw-r--r--arch/ppc/platforms/pmac_smp.c640
-rw-r--r--arch/ppc/platforms/pmac_time.c292
-rw-r--r--arch/ppc/platforms/powerpmc250.c383
-rw-r--r--arch/ppc/platforms/powerpmc250.h52
-rw-r--r--arch/ppc/platforms/pplus.c917
-rw-r--r--arch/ppc/platforms/pplus.h67
-rw-r--r--arch/ppc/platforms/pq2ads.c26
-rw-r--r--arch/ppc/platforms/pq2ads.h96
-rw-r--r--arch/ppc/platforms/prep_pci.c1336
-rw-r--r--arch/ppc/platforms/prep_setup.c1181
-rw-r--r--arch/ppc/platforms/prpmc750.c364
-rw-r--r--arch/ppc/platforms/prpmc750.h95
-rw-r--r--arch/ppc/platforms/prpmc800.c477
-rw-r--r--arch/ppc/platforms/prpmc800.h82
-rw-r--r--arch/ppc/platforms/radstone_ppc7d.c1452
-rw-r--r--arch/ppc/platforms/radstone_ppc7d.h434
-rw-r--r--arch/ppc/platforms/residual.c1034
-rw-r--r--arch/ppc/platforms/rpx8260.h81
-rw-r--r--arch/ppc/platforms/rpxclassic.h119
-rw-r--r--arch/ppc/platforms/rpxhiox.h41
-rw-r--r--arch/ppc/platforms/rpxlite.h96
-rw-r--r--arch/ppc/platforms/sandpoint.c742
-rw-r--r--arch/ppc/platforms/sandpoint.h80
-rw-r--r--arch/ppc/platforms/sbc82xx.c259
-rw-r--r--arch/ppc/platforms/sbc82xx.h36
-rw-r--r--arch/ppc/platforms/sbs8260.h28
-rw-r--r--arch/ppc/platforms/spd8xx.h92
-rw-r--r--arch/ppc/platforms/spruce.c325
-rw-r--r--arch/ppc/platforms/spruce.h71
-rw-r--r--arch/ppc/platforms/tqm8260.h23
-rw-r--r--arch/ppc/platforms/tqm8260_setup.c44
-rw-r--r--arch/ppc/platforms/tqm8xx.h179
-rw-r--r--arch/ppc/syslib/Makefile115
-rw-r--r--arch/ppc/syslib/btext.c861
-rw-r--r--arch/ppc/syslib/cpc700.h98
-rw-r--r--arch/ppc/syslib/cpc700_pic.c187
-rw-r--r--arch/ppc/syslib/cpc710.h83
-rw-r--r--arch/ppc/syslib/cpm2_common.c198
-rw-r--r--arch/ppc/syslib/cpm2_pic.c172
-rw-r--r--arch/ppc/syslib/cpm2_pic.h8
-rw-r--r--arch/ppc/syslib/dcr.S41
-rw-r--r--arch/ppc/syslib/gen550.h16
-rw-r--r--arch/ppc/syslib/gen550_dbg.c182
-rw-r--r--arch/ppc/syslib/gen550_kgdb.c86
-rw-r--r--arch/ppc/syslib/gt64260_pic.c328
-rw-r--r--arch/ppc/syslib/harrier.c302
-rw-r--r--arch/ppc/syslib/hawk_common.c319
-rw-r--r--arch/ppc/syslib/i8259.c211
-rw-r--r--arch/ppc/syslib/ibm440gp_common.c76
-rw-r--r--arch/ppc/syslib/ibm440gp_common.h35
-rw-r--r--arch/ppc/syslib/ibm440gx_common.c270
-rw-r--r--arch/ppc/syslib/ibm440gx_common.h57
-rw-r--r--arch/ppc/syslib/ibm440sp_common.c71
-rw-r--r--arch/ppc/syslib/ibm440sp_common.h25
-rw-r--r--arch/ppc/syslib/ibm44x_common.c193
-rw-r--r--arch/ppc/syslib/ibm44x_common.h42
-rw-r--r--arch/ppc/syslib/ibm_ocp.c9
-rw-r--r--arch/ppc/syslib/indirect_pci.c135
-rw-r--r--arch/ppc/syslib/ipic.c646
-rw-r--r--arch/ppc/syslib/ipic.h49
-rw-r--r--arch/ppc/syslib/m8260_pci.c194
-rw-r--r--arch/ppc/syslib/m8260_pci.h76
-rw-r--r--arch/ppc/syslib/m8260_pci_erratum9.c473
-rw-r--r--arch/ppc/syslib/m8260_setup.c264
-rw-r--r--arch/ppc/syslib/m8xx_setup.c433
-rw-r--r--arch/ppc/syslib/m8xx_wdt.c99
-rw-r--r--arch/ppc/syslib/m8xx_wdt.h16
-rw-r--r--arch/ppc/syslib/mpc10x_common.c510
-rw-r--r--arch/ppc/syslib/mpc52xx_devices.c318
-rw-r--r--arch/ppc/syslib/mpc52xx_pci.c235
-rw-r--r--arch/ppc/syslib/mpc52xx_pci.h139
-rw-r--r--arch/ppc/syslib/mpc52xx_pic.c257
-rw-r--r--arch/ppc/syslib/mpc52xx_setup.c230
-rw-r--r--arch/ppc/syslib/mpc52xx_sys.c38
-rw-r--r--arch/ppc/syslib/mpc83xx_devices.c237
-rw-r--r--arch/ppc/syslib/mpc83xx_sys.c100
-rw-r--r--arch/ppc/syslib/mpc85xx_devices.c552
-rw-r--r--arch/ppc/syslib/mpc85xx_sys.c118
-rw-r--r--arch/ppc/syslib/mv64360_pic.c426
-rw-r--r--arch/ppc/syslib/mv64x60.c2392
-rw-r--r--arch/ppc/syslib/mv64x60_dbg.c123
-rw-r--r--arch/ppc/syslib/mv64x60_win.c1168
-rw-r--r--arch/ppc/syslib/ocp.c485
-rw-r--r--arch/ppc/syslib/of_device.c273
-rw-r--r--arch/ppc/syslib/open_pic.c1083
-rw-r--r--arch/ppc/syslib/open_pic2.c716
-rw-r--r--arch/ppc/syslib/open_pic_defs.h292
-rw-r--r--arch/ppc/syslib/pci_auto.c517
-rw-r--r--arch/ppc/syslib/ppc403_pic.c127
-rw-r--r--arch/ppc/syslib/ppc405_pci.c177
-rw-r--r--arch/ppc/syslib/ppc4xx_dma.c708
-rw-r--r--arch/ppc/syslib/ppc4xx_kgdb.c124
-rw-r--r--arch/ppc/syslib/ppc4xx_pic.c244
-rw-r--r--arch/ppc/syslib/ppc4xx_pm.c47
-rw-r--r--arch/ppc/syslib/ppc4xx_setup.c321
-rw-r--r--arch/ppc/syslib/ppc4xx_sgdma.c467
-rw-r--r--arch/ppc/syslib/ppc83xx_setup.c138
-rw-r--r--arch/ppc/syslib/ppc83xx_setup.h53
-rw-r--r--arch/ppc/syslib/ppc85xx_common.c33
-rw-r--r--arch/ppc/syslib/ppc85xx_common.h25
-rw-r--r--arch/ppc/syslib/ppc85xx_setup.c354
-rw-r--r--arch/ppc/syslib/ppc85xx_setup.h59
-rw-r--r--arch/ppc/syslib/ppc8xx_pic.c130
-rw-r--r--arch/ppc/syslib/ppc8xx_pic.h21
-rw-r--r--arch/ppc/syslib/ppc_sys.c103
-rw-r--r--arch/ppc/syslib/prep_nvram.c141
-rw-r--r--arch/ppc/syslib/prom.c1447
-rw-r--r--arch/ppc/syslib/prom_init.c1002
-rw-r--r--arch/ppc/syslib/qspan_pci.c381
-rw-r--r--arch/ppc/syslib/todc_time.c513
-rw-r--r--arch/ppc/syslib/xilinx_pic.c157
-rw-r--r--arch/ppc/xmon/Makefile8
-rw-r--r--arch/ppc/xmon/adb.c212
-rw-r--r--arch/ppc/xmon/ansidecl.h141
-rw-r--r--arch/ppc/xmon/nonstdio.h22
-rw-r--r--arch/ppc/xmon/ppc-dis.c190
-rw-r--r--arch/ppc/xmon/ppc-opc.c2721
-rw-r--r--arch/ppc/xmon/ppc.h240
-rw-r--r--arch/ppc/xmon/privinst.h91
-rw-r--r--arch/ppc/xmon/setjmp.c29
-rw-r--r--arch/ppc/xmon/start.c646
-rw-r--r--arch/ppc/xmon/start_8xx.c287
-rw-r--r--arch/ppc/xmon/subr_prf.c55
-rw-r--r--arch/ppc/xmon/xmon.c2008
560 files changed, 174909 insertions, 0 deletions
diff --git a/arch/ppc/4xx_io/Makefile b/arch/ppc/4xx_io/Makefile
new file mode 100644
index 000000000000..6a8cd575f382
--- /dev/null
+++ b/arch/ppc/4xx_io/Makefile
@@ -0,0 +1,6 @@
1#
2# Makefile for the linux MPC4xx ppc-specific parts
3#
4
5
6obj-$(CONFIG_SERIAL_SICC) += serial_sicc.o
diff --git a/arch/ppc/4xx_io/serial_sicc.c b/arch/ppc/4xx_io/serial_sicc.c
new file mode 100644
index 000000000000..e95c48d57571
--- /dev/null
+++ b/arch/ppc/4xx_io/serial_sicc.c
@@ -0,0 +1,2012 @@
1/*
2 * arch/ppc/4xx_io/serial_sicc.c
3 *
4 * Driver for IBM STB3xxx SICC serial port
5 *
6 * Based on drivers/char/serial_amba.c, by ARM Ltd.
7 *
8 * Copyright 2001 IBM Crop.
9 * Author: IBM China Research Lab
10 * Yudong Yang <yangyud@cn.ibm.com>
11 * Yi Ge <geyi@cn.ibm.com>
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 *
27 *
28 * This is a driver for SICC serial port on IBM Redwood 4 evaluation board.
29 * The driver support both as a console device and normal serial device and
30 * is compatible with normal ttyS* devices.
31 */
32
33#include <linux/config.h>
34#include <linux/module.h>
35#include <linux/kernel.h>
36#include <linux/errno.h>
37#include <linux/signal.h>
38#include <linux/sched.h>
39#include <linux/interrupt.h>
40#include <linux/tty.h>
41#include <linux/tty_flip.h>
42#include <linux/major.h>
43#include <linux/string.h>
44#include <linux/fcntl.h>
45#include <linux/ptrace.h>
46#include <linux/ioport.h>
47#include <linux/mm.h>
48#include <linux/slab.h>
49#include <linux/init.h>
50#include <linux/circ_buf.h>
51#include <linux/serial.h>
52#include <linux/console.h>
53#include <linux/sysrq.h>
54#include <linux/bitops.h>
55
56#include <asm/system.h>
57#include <asm/io.h>
58#include <asm/irq.h>
59#include <asm/uaccess.h>
60#include <asm/serial.h>
61
62
63#include <linux/serialP.h>
64
65
66/* -----------------------------------------------------------------------------
67 * From STB03xxx SICC UART Specification
68 * -----------------------------------------------------------------------------
69 * UART Register Offsets.
70 */
71
72#define BL_SICC_LSR 0x0000000 /* line status register read/clear */
73#define BL_SICC_LSRS 0x0000001 /* set line status register read/set */
74#define BL_SICC_HSR 0x0000002 /* handshake status register r/clear */
75#define BL_SICC_HSRS 0x0000003 /* set handshake status register r/set */
76#define BL_SICC_BRDH 0x0000004 /* baudrate divisor high reg r/w */
77#define BL_SICC_BRDL 0x0000005 /* baudrate divisor low reg r/w */
78#define BL_SICC_LCR 0x0000006 /* control register r/w */
79#define BL_SICC_RCR 0x0000007 /* receiver command register r/w */
80#define BL_SICC_TxCR 0x0000008 /* transmitter command register r/w */
81#define BL_SICC_RBR 0x0000009 /* receive buffer r */
82#define BL_SICC_TBR 0x0000009 /* transmit buffer w */
83#define BL_SICC_CTL2 0x000000A /* added for Vesta */
84#define BL_SICC_IrCR 0x000000B /* added for Vesta IR */
85
86/* masks and definitions for serial port control register */
87
88#define _LCR_LM_MASK 0xc0 /* loop back modes */
89#define _LCR_DTR_MASK 0x20 /* data terminal ready 0-inactive */
90#define _LCR_RTS_MASK 0x10 /* request to send 0-inactive */
91#define _LCR_DB_MASK 0x08 /* data bits mask */
92#define _LCR_PE_MASK 0x04 /* parity enable */
93#define _LCR_PTY_MASK 0x02 /* parity */
94#define _LCR_SB_MASK 0x01 /* stop bit mask */
95
96#define _LCR_LM_NORM 0x00 /* normal operation */
97#define _LCR_LM_LOOP 0x40 /* internal loopback mode */
98#define _LCR_LM_ECHO 0x80 /* automatic echo mode */
99#define _LCR_LM_RES 0xc0 /* reserved */
100
101#define _LCR_DTR_ACTIVE _LCR_DTR_MASK /* DTR is active */
102#define _LCR_RTS_ACTIVE _LCR_RTS_MASK /* RTS is active */
103#define _LCR_DB_8_BITS _LCR_DB_MASK /* 8 data bits */
104#define _LCR_DB_7_BITS 0x00 /* 7 data bits */
105#define _LCR_PE_ENABLE _LCR_PE_MASK /* parity enabled */
106#define _LCR_PE_DISABLE 0x00 /* parity disabled */
107#define _LCR_PTY_EVEN 0x00 /* even parity */
108#define _LCR_PTY_ODD _LCR_PTY_MASK /* odd parity */
109#define _LCR_SB_1_BIT 0x00 /* one stop bit */
110#define _LCR_SB_2_BIT _LCR_SB_MASK /* two stop bit */
111
112/* serial port handshake register */
113
114#define _HSR_DIS_MASK 0x80 /* DSR input inactive error mask */
115#define _HSR_CS_MASK 0x40 /* CTS input inactive error mask */
116#define _HSR_DIS_ACT 0x00 /* dsr input is active */
117#define _HSR_DIS_INACT _HSR_DIS_MASK /* dsr input is inactive */
118#define _HSR_CS_ACT 0x00 /* cts input is active */
119#define _HSR_CS_INACT _HSR_CS_MASK /* cts input is active */
120
121/* serial port line status register */
122
123#define _LSR_RBR_MASK 0x80 /* receive buffer ready mask */
124#define _LSR_FE_MASK 0x40 /* framing error */
125#define _LSR_OE_MASK 0x20 /* overrun error */
126#define _LSR_PE_MASK 0x10 /* parity error */
127#define _LSR_LB_MASK 0x08 /* line break */
128#define _LSR_TBR_MASK 0x04 /* transmit buffer ready */
129#define _LSR_TSR_MASK 0x02 /* transmit shift register ready */
130
131#define _LSR_RBR_FULL _LSR_RBR_MASK /* receive buffer is full */
132#define _LSR_FE_ERROR _LSR_FE_MASK /* framing error detected */
133#define _LSR_OE_ERROR _LSR_OE_MASK /* overrun error detected */
134#define _LSR_PE_ERROR _LSR_PE_MASK /* parity error detected */
135#define _LSR_LB_BREAK _LSR_LB_MASK /* line break detected */
136#define _LSR_TBR_EMPTY _LSR_TBR_MASK /* transmit buffer is ready */
137#define _LSR_TSR_EMPTY _LSR_TSR_MASK /* transmit shift register is empty */
138#define _LSR_TX_ALL 0x06 /* all physical transmit is done */
139
140#define _LSR_RX_ERR (_LSR_LB_BREAK | _LSR_FE_MASK | _LSR_OE_MASK | \
141 _LSR_PE_MASK )
142
143/* serial port receiver command register */
144
145#define _RCR_ER_MASK 0x80 /* enable receiver mask */
146#define _RCR_DME_MASK 0x60 /* dma mode */
147#define _RCR_EIE_MASK 0x10 /* error interrupt enable mask */
148#define _RCR_PME_MASK 0x08 /* pause mode mask */
149
150#define _RCR_ER_ENABLE _RCR_ER_MASK /* receiver enabled */
151#define _RCR_DME_DISABLE 0x00 /* dma disabled */
152#define _RCR_DME_RXRDY 0x20 /* dma disabled, RxRDY interrupt enabled*/
153#define _RCR_DME_ENABLE2 0x40 /* dma enabled,receiver src channel 2 */
154#define _RCR_DME_ENABLE3 0x60 /* dma enabled,receiver src channel 3 */
155#define _RCR_PME_HARD _RCR_PME_MASK /* RTS controlled by hardware */
156#define _RCR_PME_SOFT 0x00 /* RTS controlled by software */
157
158/* serial port transmit command register */
159
160#define _TxCR_ET_MASK 0x80 /* transmiter enable mask */
161#define _TxCR_DME_MASK 0x60 /* dma mode mask */
162#define _TxCR_TIE_MASK 0x10 /* empty interrupt enable mask */
163#define _TxCR_EIE_MASK 0x08 /* error interrupt enable mask */
164#define _TxCR_SPE_MASK 0x04 /* stop/pause mask */
165#define _TxCR_TB_MASK 0x02 /* transmit break mask */
166
167#define _TxCR_ET_ENABLE _TxCR_ET_MASK /* transmiter enabled */
168#define _TxCR_DME_DISABLE 0x00 /* transmiter disabled, TBR intr disabled */
169#define _TxCR_DME_TBR 0x20 /* transmiter disabled, TBR intr enabled */
170#define _TxCR_DME_CHAN_2 0x40 /* dma enabled, destination chann 2 */
171#define _TxCR_DME_CHAN_3 0x60 /* dma enabled, destination chann 3 */
172
173/* serial ctl reg 2 - added for Vesta */
174
175#define _CTL2_EXTERN 0x80 /* */
176#define _CTL2_USEFIFO 0x40 /* */
177#define _CTL2_RESETRF 0x08 /* */
178#define _CTL2_RESETTF 0x04 /* */
179
180
181
182#define SERIAL_SICC_NAME "ttySICC"
183#define SERIAL_SICC_MAJOR 150
184#define SERIAL_SICC_MINOR 1
185#define SERIAL_SICC_NR 1
186
187#ifndef TRUE
188#define TRUE 1
189#endif
190#ifndef FALSE
191#define FALSE 0
192#endif
193
194/*
195 * Things needed by tty driver
196 */
197static struct tty_driver *siccnormal_driver;
198
199#if defined(CONFIG_SERIAL_SICC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
200#define SUPPORT_SYSRQ
201#endif
202
203/*
204 * Things needed internally to this driver
205 */
206
207/*
208 * tmp_buf is used as a temporary buffer by serial_write. We need to
209 * lock it in case the copy_from_user blocks while swapping in a page,
210 * and some other program tries to do a serial write at the same time.
211 * Since the lock will only come under contention when the system is
212 * swapping and available memory is low, it makes sense to share one
213 * buffer across all the serial ports, since it significantly saves
214 * memory if large numbers of serial ports are open.
215 */
216static u_char *tmp_buf;
217static DECLARE_MUTEX(tmp_buf_sem);
218
219#define HIGH_BITS_OFFSET ((sizeof(long)-sizeof(int))*8)
220
221/* number of characters left in xmit buffer before we ask for more */
222#define WAKEUP_CHARS 256
223#define SICC_ISR_PASS_LIMIT 256
224
225#define EVT_WRITE_WAKEUP 0
226
227struct SICC_icount {
228 __u32 cts;
229 __u32 dsr;
230 __u32 rng;
231 __u32 dcd;
232 __u32 rx;
233 __u32 tx;
234 __u32 frame;
235 __u32 overrun;
236 __u32 parity;
237 __u32 brk;
238 __u32 buf_overrun;
239};
240
241/*
242 * Static information about the port
243 */
244struct SICC_port {
245 unsigned int uart_base;
246 unsigned int uart_base_phys;
247 unsigned int irqrx;
248 unsigned int irqtx;
249 unsigned int uartclk;
250 unsigned int fifosize;
251 unsigned int tiocm_support;
252 void (*set_mctrl)(struct SICC_port *, u_int mctrl);
253};
254
255/*
256 * This is the state information which is persistent across opens
257 */
258struct SICC_state {
259 struct SICC_icount icount;
260 unsigned int line;
261 unsigned int close_delay;
262 unsigned int closing_wait;
263 unsigned int custom_divisor;
264 unsigned int flags;
265 int count;
266 struct SICC_info *info;
267 spinlock_t sicc_lock;
268};
269
270#define SICC_XMIT_SIZE 1024
271/*
272 * This is the state information which is only valid when the port is open.
273 */
274struct SICC_info {
275 struct SICC_port *port;
276 struct SICC_state *state;
277 struct tty_struct *tty;
278 unsigned char x_char;
279 unsigned char old_status;
280 unsigned char read_status_mask;
281 unsigned char ignore_status_mask;
282 struct circ_buf xmit;
283 unsigned int flags;
284#ifdef SUPPORT_SYSRQ
285 unsigned long sysrq;
286#endif
287
288 unsigned int event;
289 unsigned int timeout;
290 unsigned int lcr_h;
291 unsigned int mctrl;
292 int blocked_open;
293
294 struct tasklet_struct tlet;
295
296 wait_queue_head_t open_wait;
297 wait_queue_head_t close_wait;
298 wait_queue_head_t delta_msr_wait;
299};
300
301#ifdef CONFIG_SERIAL_SICC_CONSOLE
302static struct console siccuart_cons;
303#endif
304static void siccuart_change_speed(struct SICC_info *info, struct termios *old_termios);
305static void siccuart_wait_until_sent(struct tty_struct *tty, int timeout);
306
307
308
309static void powerpcMtcic_cr(unsigned long value)
310{
311 mtdcr(DCRN_CICCR, value);
312}
313
314static unsigned long powerpcMfcic_cr(void)
315{
316 return mfdcr(DCRN_CICCR);
317}
318
319static unsigned long powerpcMfclkgpcr(void)
320{
321 return mfdcr(DCRN_SCCR);
322}
323
324static void sicc_set_mctrl_null(struct SICC_port *port, u_int mctrl)
325{
326}
327
328static struct SICC_port sicc_ports[SERIAL_SICC_NR] = {
329 {
330 .uart_base = 0,
331 .uart_base_phys = SICC0_IO_BASE,
332 .irqrx = SICC0_INTRX,
333 .irqtx = SICC0_INTTX,
334// .uartclk = 0,
335 .fifosize = 1,
336 .set_mctrl = sicc_set_mctrl_null,
337 }
338};
339
340static struct SICC_state sicc_state[SERIAL_SICC_NR];
341
342static void siccuart_enable_rx_interrupt(struct SICC_info *info)
343{
344 unsigned char cr;
345
346 cr = readb(info->port->uart_base+BL_SICC_RCR);
347 cr &= ~_RCR_DME_MASK;
348 cr |= _RCR_DME_RXRDY;
349 writeb(cr, info->port->uart_base+BL_SICC_RCR);
350}
351
352static void siccuart_disable_rx_interrupt(struct SICC_info *info)
353{
354 unsigned char cr;
355
356 cr = readb(info->port->uart_base+BL_SICC_RCR);
357 cr &= ~_RCR_DME_MASK;
358 cr |= _RCR_DME_DISABLE;
359 writeb(cr, info->port->uart_base+BL_SICC_RCR);
360}
361
362
363static void siccuart_enable_tx_interrupt(struct SICC_info *info)
364{
365 unsigned char cr;
366
367 cr = readb(info->port->uart_base+BL_SICC_TxCR);
368 cr &= ~_TxCR_DME_MASK;
369 cr |= _TxCR_DME_TBR;
370 writeb(cr, info->port->uart_base+BL_SICC_TxCR);
371}
372
373static void siccuart_disable_tx_interrupt(struct SICC_info *info)
374{
375 unsigned char cr;
376
377 cr = readb(info->port->uart_base+BL_SICC_TxCR);
378 cr &= ~_TxCR_DME_MASK;
379 cr |= _TxCR_DME_DISABLE;
380 writeb(cr, info->port->uart_base+BL_SICC_TxCR);
381}
382
383
384static void siccuart_stop(struct tty_struct *tty)
385{
386 struct SICC_info *info = tty->driver_data;
387 unsigned long flags;
388
389 /* disable interrupts while stopping serial port interrupts */
390 spin_lock_irqsave(&info->state->sicc_lock,flags);
391 siccuart_disable_tx_interrupt(info);
392 spin_unlock_irqrestore(&info->state->sicc_lock,flags);
393}
394
395static void siccuart_start(struct tty_struct *tty)
396{
397 struct SICC_info *info = tty->driver_data;
398 unsigned long flags;
399
400 /* disable interrupts while starting serial port interrupts */
401 spin_lock_irqsave(&info->state->sicc_lock,flags);
402 if (info->xmit.head != info->xmit.tail
403 && info->xmit.buf)
404 siccuart_enable_tx_interrupt(info);
405 spin_unlock_irqrestore(&info->state->sicc_lock,flags);
406}
407
408
409/*
410 * This routine is used by the interrupt handler to schedule
411 * processing in the software interrupt portion of the driver.
412 */
413static void siccuart_event(struct SICC_info *info, int event)
414{
415 info->event |= 1 << event;
416 tasklet_schedule(&info->tlet);
417}
418
419static void
420siccuart_rx_chars(struct SICC_info *info, struct pt_regs *regs)
421{
422 struct tty_struct *tty = info->tty;
423 unsigned int status, ch, rsr, flg, ignored = 0;
424 struct SICC_icount *icount = &info->state->icount;
425 struct SICC_port *port = info->port;
426
427 status = readb(port->uart_base+BL_SICC_LSR );
428 while (status & _LSR_RBR_FULL) {
429 ch = readb(port->uart_base+BL_SICC_RBR);
430
431 if (tty->flip.count >= TTY_FLIPBUF_SIZE)
432 goto ignore_char;
433 icount->rx++;
434
435 flg = TTY_NORMAL;
436
437 /*
438 * Note that the error handling code is
439 * out of the main execution path
440 */
441 rsr = readb(port->uart_base+BL_SICC_LSR);
442 if (rsr & _LSR_RX_ERR)
443 goto handle_error;
444#ifdef SUPPORT_SYSRQ
445 if (info->sysrq) {
446 if (ch && time_before(jiffies, info->sysrq)) {
447 handle_sysrq(ch, regs, NULL);
448 info->sysrq = 0;
449 goto ignore_char;
450 }
451 info->sysrq = 0;
452 }
453#endif
454 error_return:
455 *tty->flip.flag_buf_ptr++ = flg;
456 *tty->flip.char_buf_ptr++ = ch;
457 tty->flip.count++;
458 ignore_char:
459 status = readb(port->uart_base+BL_SICC_LSR );
460 }
461out:
462 tty_flip_buffer_push(tty);
463 return;
464
465handle_error:
466 if (rsr & _LSR_LB_BREAK) {
467 rsr &= ~(_LSR_FE_MASK | _LSR_PE_MASK);
468 icount->brk++;
469
470#ifdef SUPPORT_SYSRQ
471 if (info->state->line == siccuart_cons.index) {
472 if (!info->sysrq) {
473 info->sysrq = jiffies + HZ*5;
474 goto ignore_char;
475 }
476 }
477#endif
478 } else if (rsr & _LSR_PE_MASK)
479 icount->parity++;
480 else if (rsr & _LSR_FE_MASK)
481 icount->frame++;
482 if (rsr & _LSR_OE_MASK)
483 icount->overrun++;
484
485 if (rsr & info->ignore_status_mask) {
486 if (++ignored > 100)
487 goto out;
488 goto ignore_char;
489 }
490 rsr &= info->read_status_mask;
491
492 if (rsr & _LSR_LB_BREAK)
493 flg = TTY_BREAK;
494 else if (rsr & _LSR_PE_MASK)
495 flg = TTY_PARITY;
496 else if (rsr & _LSR_FE_MASK)
497 flg = TTY_FRAME;
498
499 if (rsr & _LSR_OE_MASK) {
500 /*
501 * CHECK: does overrun affect the current character?
502 * ASSUMPTION: it does not.
503 */
504 *tty->flip.flag_buf_ptr++ = flg;
505 *tty->flip.char_buf_ptr++ = ch;
506 tty->flip.count++;
507 if (tty->flip.count >= TTY_FLIPBUF_SIZE)
508 goto ignore_char;
509 ch = 0;
510 flg = TTY_OVERRUN;
511 }
512#ifdef SUPPORT_SYSRQ
513 info->sysrq = 0;
514#endif
515 goto error_return;
516}
517
518static void siccuart_tx_chars(struct SICC_info *info)
519{
520 struct SICC_port *port = info->port;
521 int count;
522 unsigned char status;
523
524
525 if (info->x_char) {
526 writeb(info->x_char, port->uart_base+ BL_SICC_TBR);
527 info->state->icount.tx++;
528 info->x_char = 0;
529 return;
530 }
531 if (info->xmit.head == info->xmit.tail
532 || info->tty->stopped
533 || info->tty->hw_stopped) {
534 siccuart_disable_tx_interrupt(info);
535 writeb(status&(~_LSR_RBR_MASK),port->uart_base+BL_SICC_LSR);
536 return;
537 }
538
539 count = port->fifosize;
540 do {
541 writeb(info->xmit.buf[info->xmit.tail], port->uart_base+ BL_SICC_TBR);
542 info->xmit.tail = (info->xmit.tail + 1) & (SICC_XMIT_SIZE - 1);
543 info->state->icount.tx++;
544 if (info->xmit.head == info->xmit.tail)
545 break;
546 } while (--count > 0);
547
548 if (CIRC_CNT(info->xmit.head,
549 info->xmit.tail,
550 SICC_XMIT_SIZE) < WAKEUP_CHARS)
551 siccuart_event(info, EVT_WRITE_WAKEUP);
552
553 if (info->xmit.head == info->xmit.tail) {
554 siccuart_disable_tx_interrupt(info);
555 }
556}
557
558
559static irqreturn_t siccuart_int_rx(int irq, void *dev_id, struct pt_regs *regs)
560{
561 struct SICC_info *info = dev_id;
562 siccuart_rx_chars(info, regs);
563 return IRQ_HANDLED;
564}
565
566
567static irqreturn_t siccuart_int_tx(int irq, void *dev_id, struct pt_regs *regs)
568{
569 struct SICC_info *info = dev_id;
570 siccuart_tx_chars(info);
571 return IRQ_HANDLED;
572}
573
574static void siccuart_tasklet_action(unsigned long data)
575{
576 struct SICC_info *info = (struct SICC_info *)data;
577 struct tty_struct *tty;
578
579 tty = info->tty;
580 if (!tty || !test_and_clear_bit(EVT_WRITE_WAKEUP, &info->event))
581 return;
582
583 if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
584 tty->ldisc.write_wakeup)
585 (tty->ldisc.write_wakeup)(tty);
586 wake_up_interruptible(&tty->write_wait);
587}
588
589static int siccuart_startup(struct SICC_info *info)
590{
591 unsigned long flags;
592 unsigned long page;
593 int retval = 0;
594
595 if (info->flags & ASYNC_INITIALIZED) {
596 return 0;
597 }
598
599 page = get_zeroed_page(GFP_KERNEL);
600 if (!page)
601 return -ENOMEM;
602
603 if (info->port->uart_base == 0)
604 info->port->uart_base = (int)ioremap(info->port->uart_base_phys, PAGE_SIZE);
605 if (info->port->uart_base == 0) {
606 free_page(page);
607 return -ENOMEM;
608 }
609
610 /* lock access to info while doing setup */
611 spin_lock_irqsave(&info->state->sicc_lock,flags);
612
613 if (info->xmit.buf)
614 free_page(page);
615 else
616 info->xmit.buf = (unsigned char *) page;
617
618
619 info->mctrl = 0;
620 if (info->tty->termios->c_cflag & CBAUD)
621 info->mctrl = TIOCM_RTS | TIOCM_DTR;
622 info->port->set_mctrl(info->port, info->mctrl);
623
624 /*
625 * initialise the old status of the modem signals
626 */
627 info->old_status = 0; // UART_GET_FR(info->port) & AMBA_UARTFR_MODEM_ANY;
628
629
630 if (info->tty)
631 clear_bit(TTY_IO_ERROR, &info->tty->flags);
632 info->xmit.head = info->xmit.tail = 0;
633
634 /*
635 * Set up the tty->alt_speed kludge
636 */
637 if (info->tty) {
638 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
639 info->tty->alt_speed = 57600;
640 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
641 info->tty->alt_speed = 115200;
642 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)
643 info->tty->alt_speed = 230400;
644 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)
645 info->tty->alt_speed = 460800;
646 }
647
648
649 writeb( 0x00, info->port->uart_base + BL_SICC_IrCR ); // disable IrDA
650
651
652 /*
653 * and set the speed of the serial port
654 */
655 siccuart_change_speed(info, 0);
656
657 // enable rx/tx ports
658 writeb(_RCR_ER_ENABLE /*| _RCR_PME_HARD*/, info->port->uart_base + BL_SICC_RCR);
659 writeb(_TxCR_ET_ENABLE , info->port->uart_base + BL_SICC_TxCR);
660
661 readb(info->port->uart_base + BL_SICC_RBR); // clear rx port
662
663 writeb(0xf8, info->port->uart_base + BL_SICC_LSR); /* reset bits 0-4 of LSR */
664
665 /*
666 * Finally, enable interrupts
667 */
668
669 /*
670 * Allocate the IRQ
671 */
672 retval = request_irq(info->port->irqrx, siccuart_int_rx, 0, "SICC rx", info);
673 if (retval) {
674 if (capable(CAP_SYS_ADMIN)) {
675 if (info->tty)
676 set_bit(TTY_IO_ERROR, &info->tty->flags);
677 retval = 0;
678 }
679 goto errout;
680 }
681 retval = request_irq(info->port->irqtx, siccuart_int_tx, 0, "SICC tx", info);
682 if (retval) {
683 if (capable(CAP_SYS_ADMIN)) {
684 if (info->tty)
685 set_bit(TTY_IO_ERROR, &info->tty->flags);
686 retval = 0;
687 }
688 free_irq(info->port->irqrx, info);
689 goto errout;
690 }
691
692 siccuart_enable_rx_interrupt(info);
693
694 info->flags |= ASYNC_INITIALIZED;
695 spin_unlock_irqrestore(&info->state->sicc_lock,flags);
696 return 0;
697
698
699errout:
700 spin_unlock_irqrestore(&info->state->sicc_lock,flags);
701 return retval;
702}
703
704/*
705 * This routine will shutdown a serial port; interrupts are disabled, and
706 * DTR is dropped if the hangup on close termio flag is on.
707 */
708static void siccuart_shutdown(struct SICC_info *info)
709{
710 unsigned long flags;
711
712 if (!(info->flags & ASYNC_INITIALIZED))
713 return;
714
715 /* lock while shutting down port */
716 spin_lock_irqsave(&info->state->sicc_lock,flags); /* Disable interrupts */
717
718 /*
719 * clear delta_msr_wait queue to avoid mem leaks: we may free the irq
720 * here so the queue might never be woken up
721 */
722 wake_up_interruptible(&info->delta_msr_wait);
723
724 /*
725 * disable all interrupts, disable the port
726 */
727 siccuart_disable_rx_interrupt(info);
728 siccuart_disable_tx_interrupt(info);
729
730 /*
731 * Free the IRQ
732 */
733 free_irq(info->port->irqtx, info);
734 free_irq(info->port->irqrx, info);
735
736 if (info->xmit.buf) {
737 unsigned long pg = (unsigned long) info->xmit.buf;
738 info->xmit.buf = NULL;
739 free_page(pg);
740 }
741
742
743 if (!info->tty || (info->tty->termios->c_cflag & HUPCL))
744 info->mctrl &= ~(TIOCM_DTR|TIOCM_RTS);
745 info->port->set_mctrl(info->port, info->mctrl);
746
747 /* kill off our tasklet */
748 tasklet_kill(&info->tlet);
749 if (info->tty)
750 set_bit(TTY_IO_ERROR, &info->tty->flags);
751
752 info->flags &= ~ASYNC_INITIALIZED;
753
754 spin_unlock_irqrestore(&info->state->sicc_lock,flags);
755}
756
757
758static void siccuart_change_speed(struct SICC_info *info, struct termios *old_termios)
759{
760 unsigned int lcr_h, baud, quot, cflag, old_rcr, old_tcr, bits;
761 unsigned long flags;
762
763 if (!info->tty || !info->tty->termios)
764 return;
765
766 cflag = info->tty->termios->c_cflag;
767
768 pr_debug("siccuart_set_cflag(0x%x) called\n", cflag);
769 /* byte size and parity */
770 switch (cflag & CSIZE) {
771 case CS7: lcr_h = _LCR_PE_DISABLE | _LCR_DB_7_BITS | _LCR_SB_1_BIT; bits = 9; break;
772 default: lcr_h = _LCR_PE_DISABLE | _LCR_DB_8_BITS | _LCR_SB_1_BIT; bits = 10; break; // CS8
773 }
774 if (cflag & CSTOPB) {
775 lcr_h |= _LCR_SB_2_BIT;
776 bits ++;
777 }
778 if (cflag & PARENB) {
779 lcr_h |= _LCR_PE_ENABLE;
780 bits++;
781 if (!(cflag & PARODD))
782 lcr_h |= _LCR_PTY_ODD;
783 else
784 lcr_h |= _LCR_PTY_EVEN;
785 }
786
787 do {
788 /* Determine divisor based on baud rate */
789 baud = tty_get_baud_rate(info->tty);
790 if (!baud)
791 baud = 9600;
792
793
794 {
795 // here is ppc403SetBaud(com_port, baud);
796 unsigned long divisor, clockSource, temp;
797
798 /* Ensure CICCR[7] is 0 to select Internal Baud Clock */
799 powerpcMtcic_cr((unsigned long)(powerpcMfcic_cr() & 0xFEFFFFFF));
800
801 /* Determine Internal Baud Clock Frequency */
802 /* powerpcMfclkgpcr() reads DCR 0x120 - the*/
803 /* SCCR (Serial Clock Control Register) on Vesta */
804 temp = powerpcMfclkgpcr();
805
806 if(temp & 0x00000080) {
807 clockSource = 324000000;
808 }
809 else {
810 clockSource = 216000000;
811 }
812 clockSource = clockSource/(unsigned long)((temp&0x00FC0000)>>18);
813 divisor = clockSource/(16*baud) - 1;
814 /* divisor has only 12 bits of resolution */
815 if(divisor>0x00000FFF){
816 divisor=0x00000FFF;
817 }
818
819 quot = divisor;
820 }
821
822 if (baud == 38400 &&
823 ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST))
824 quot = info->state->custom_divisor;
825
826 if (!quot && old_termios) {
827 info->tty->termios->c_cflag &= ~CBAUD;
828 info->tty->termios->c_cflag |= (old_termios->c_cflag & CBAUD);
829 old_termios = NULL;
830 }
831 } while (quot == 0 && old_termios);
832
833 /* As a last resort, if the quotient is zero, default to 9600 bps */
834 if (!quot)
835 quot = (info->port->uartclk / (16 * 9600)) - 1;
836
837 info->timeout = info->port->fifosize * HZ * bits / baud;
838 info->timeout += HZ/50; /* Add .02 seconds of slop */
839
840 if (cflag & CRTSCTS)
841 info->flags |= ASYNC_CTS_FLOW;
842 else
843 info->flags &= ~ASYNC_CTS_FLOW;
844 if (cflag & CLOCAL)
845 info->flags &= ~ASYNC_CHECK_CD;
846 else
847 info->flags |= ASYNC_CHECK_CD;
848
849 /*
850 * Set up parity check flag
851 */
852#define RELEVENT_IFLAG(iflag) ((iflag) & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK))
853
854 info->read_status_mask = _LSR_OE_MASK;
855 if (I_INPCK(info->tty))
856 info->read_status_mask |= _LSR_FE_MASK | _LSR_PE_MASK;
857 if (I_BRKINT(info->tty) || I_PARMRK(info->tty))
858 info->read_status_mask |= _LSR_LB_MASK;
859
860 /*
861 * Characters to ignore
862 */
863 info->ignore_status_mask = 0;
864 if (I_IGNPAR(info->tty))
865 info->ignore_status_mask |= _LSR_FE_MASK | _LSR_PE_MASK;
866 if (I_IGNBRK(info->tty)) {
867 info->ignore_status_mask |= _LSR_LB_MASK;
868 /*
869 * If we're ignoring parity and break indicators,
870 * ignore overruns to (for real raw support).
871 */
872 if (I_IGNPAR(info->tty))
873 info->ignore_status_mask |= _LSR_OE_MASK;
874 }
875
876 /* disable interrupts while reading and clearing registers */
877 spin_lock_irqsave(&info->state->sicc_lock,flags);
878
879 old_rcr = readb(info->port->uart_base + BL_SICC_RCR);
880 old_tcr = readb(info->port->uart_base + BL_SICC_TxCR);
881
882
883 writeb(0, info->port->uart_base + BL_SICC_RCR);
884 writeb(0, info->port->uart_base + BL_SICC_TxCR);
885
886 /*RLBtrace (&ppc403Chan0, 0x2000000c, 0, 0);*/
887
888
889 spin_unlock_irqrestore(&info->state->sicc_lock,flags);
890
891
892 /* Set baud rate */
893 writeb((quot & 0x00000F00)>>8, info->port->uart_base + BL_SICC_BRDH );
894 writeb( quot & 0x00000FF, info->port->uart_base + BL_SICC_BRDL );
895
896 /* Set CTL2 reg to use external clock (ExtClk) and enable FIFOs. */
897 /* For now, do NOT use FIFOs since 403 UART did not have this */
898 /* capability and this driver was inherited from 403UART. */
899 writeb(_CTL2_EXTERN, info->port->uart_base + BL_SICC_CTL2);
900
901 writeb(lcr_h, info->port->uart_base + BL_SICC_LCR);
902
903 writeb(old_rcr, info->port->uart_base + BL_SICC_RCR); // restore rcr
904 writeb(old_tcr, info->port->uart_base + BL_SICC_TxCR); // restore txcr
905
906}
907
908
909static void siccuart_put_char(struct tty_struct *tty, u_char ch)
910{
911 struct SICC_info *info = tty->driver_data;
912 unsigned long flags;
913
914 if (!tty || !info->xmit.buf)
915 return;
916
917 /* lock info->xmit while adding character to tx buffer */
918 spin_lock_irqsave(&info->state->sicc_lock,flags);
919 if (CIRC_SPACE(info->xmit.head, info->xmit.tail, SICC_XMIT_SIZE) != 0) {
920 info->xmit.buf[info->xmit.head] = ch;
921 info->xmit.head = (info->xmit.head + 1) & (SICC_XMIT_SIZE - 1);
922 }
923 spin_unlock_irqrestore(&info->state->sicc_lock,flags);
924}
925
926static void siccuart_flush_chars(struct tty_struct *tty)
927{
928 struct SICC_info *info = tty->driver_data;
929 unsigned long flags;
930
931 if (info->xmit.head == info->xmit.tail
932 || tty->stopped
933 || tty->hw_stopped
934 || !info->xmit.buf)
935 return;
936
937 /* disable interrupts while transmitting characters */
938 spin_lock_irqsave(&info->state->sicc_lock,flags);
939 siccuart_enable_tx_interrupt(info);
940 spin_unlock_irqrestore(&info->state->sicc_lock,flags);
941}
942
943static int siccuart_write(struct tty_struct *tty,
944 const u_char * buf, int count)
945{
946 struct SICC_info *info = tty->driver_data;
947 unsigned long flags;
948 int c, ret = 0;
949
950 if (!tty || !info->xmit.buf || !tmp_buf)
951 return 0;
952
953 /* lock info->xmit while removing characters from buffer */
954 spin_lock_irqsave(&info->state->sicc_lock,flags);
955 while (1) {
956 c = CIRC_SPACE_TO_END(info->xmit.head,
957 info->xmit.tail,
958 SICC_XMIT_SIZE);
959 if (count < c)
960 c = count;
961 if (c <= 0)
962 break;
963 memcpy(info->xmit.buf + info->xmit.head, buf, c);
964 info->xmit.head = (info->xmit.head + c) &
965 (SICC_XMIT_SIZE - 1);
966 buf += c;
967 count -= c;
968 ret += c;
969 }
970 if (info->xmit.head != info->xmit.tail
971 && !tty->stopped
972 && !tty->hw_stopped)
973 siccuart_enable_tx_interrupt(info);
974 spin_unlock_irqrestore(&info->state->sicc_lock,flags);
975 return ret;
976}
977
978static int siccuart_write_room(struct tty_struct *tty)
979{
980 struct SICC_info *info = tty->driver_data;
981
982 return CIRC_SPACE(info->xmit.head, info->xmit.tail, SICC_XMIT_SIZE);
983}
984
985static int siccuart_chars_in_buffer(struct tty_struct *tty)
986{
987 struct SICC_info *info = tty->driver_data;
988
989 return CIRC_CNT(info->xmit.head, info->xmit.tail, SICC_XMIT_SIZE);
990}
991
992static void siccuart_flush_buffer(struct tty_struct *tty)
993{
994 struct SICC_info *info = tty->driver_data;
995 unsigned long flags;
996
997 pr_debug("siccuart_flush_buffer(%d) called\n", tty->index);
998 /* lock info->xmit while zeroing buffer counts */
999 spin_lock_irqsave(&info->state->sicc_lock,flags);
1000 info->xmit.head = info->xmit.tail = 0;
1001 spin_unlock_irqrestore(&info->state->sicc_lock,flags);
1002 wake_up_interruptible(&tty->write_wait);
1003 if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
1004 tty->ldisc.write_wakeup)
1005 (tty->ldisc.write_wakeup)(tty);
1006}
1007
1008/*
1009 * This function is used to send a high-priority XON/XOFF character to
1010 * the device
1011 */
1012static void siccuart_send_xchar(struct tty_struct *tty, char ch)
1013{
1014 struct SICC_info *info = tty->driver_data;
1015
1016 info->x_char = ch;
1017 if (ch)
1018 siccuart_enable_tx_interrupt(info);
1019}
1020
1021static void siccuart_throttle(struct tty_struct *tty)
1022{
1023 struct SICC_info *info = tty->driver_data;
1024 unsigned long flags;
1025
1026 if (I_IXOFF(tty))
1027 siccuart_send_xchar(tty, STOP_CHAR(tty));
1028
1029 if (tty->termios->c_cflag & CRTSCTS) {
1030 /* disable interrupts while setting modem control lines */
1031 spin_lock_irqsave(&info->state->sicc_lock,flags);
1032 info->mctrl &= ~TIOCM_RTS;
1033 info->port->set_mctrl(info->port, info->mctrl);
1034 spin_unlock_irqrestore(&info->state->sicc_lock,flags);
1035 }
1036}
1037
1038static void siccuart_unthrottle(struct tty_struct *tty)
1039{
1040 struct SICC_info *info = (struct SICC_info *) tty->driver_data;
1041 unsigned long flags;
1042
1043 if (I_IXOFF(tty)) {
1044 if (info->x_char)
1045 info->x_char = 0;
1046 else
1047 siccuart_send_xchar(tty, START_CHAR(tty));
1048 }
1049
1050 if (tty->termios->c_cflag & CRTSCTS) {
1051 /* disable interrupts while setting modem control lines */
1052 spin_lock_irqsave(&info->state->sicc_lock,flags);
1053 info->mctrl |= TIOCM_RTS;
1054 info->port->set_mctrl(info->port, info->mctrl);
1055 spin_unlock_irqrestore(&info->state->sicc_lock,flags);
1056 }
1057}
1058
1059static int get_serial_info(struct SICC_info *info, struct serial_struct *retinfo)
1060{
1061 struct SICC_state *state = info->state;
1062 struct SICC_port *port = info->port;
1063 struct serial_struct tmp;
1064
1065 memset(&tmp, 0, sizeof(tmp));
1066 tmp.type = 0;
1067 tmp.line = state->line;
1068 tmp.port = port->uart_base;
1069 if (HIGH_BITS_OFFSET)
1070 tmp.port_high = port->uart_base >> HIGH_BITS_OFFSET;
1071 tmp.irq = port->irqrx;
1072 tmp.flags = 0;
1073 tmp.xmit_fifo_size = port->fifosize;
1074 tmp.baud_base = port->uartclk / 16;
1075 tmp.close_delay = state->close_delay;
1076 tmp.closing_wait = state->closing_wait;
1077 tmp.custom_divisor = state->custom_divisor;
1078
1079 if (copy_to_user(retinfo, &tmp, sizeof(*retinfo)))
1080 return -EFAULT;
1081 return 0;
1082}
1083
1084static int set_serial_info(struct SICC_info *info,
1085 struct serial_struct *newinfo)
1086{
1087 struct serial_struct new_serial;
1088 struct SICC_state *state, old_state;
1089 struct SICC_port *port;
1090 unsigned long new_port;
1091 unsigned int i, change_irq, change_port;
1092 int retval = 0;
1093
1094 if (copy_from_user(&new_serial, newinfo, sizeof(new_serial)))
1095 return -EFAULT;
1096
1097 state = info->state;
1098 old_state = *state;
1099 port = info->port;
1100
1101 new_port = new_serial.port;
1102 if (HIGH_BITS_OFFSET)
1103 new_port += (unsigned long) new_serial.port_high << HIGH_BITS_OFFSET;
1104
1105 change_irq = new_serial.irq != port->irqrx;
1106 change_port = new_port != port->uart_base;
1107
1108 if (!capable(CAP_SYS_ADMIN)) {
1109 if (change_irq || change_port ||
1110 (new_serial.baud_base != port->uartclk / 16) ||
1111 (new_serial.close_delay != state->close_delay) ||
1112 (new_serial.xmit_fifo_size != port->fifosize) ||
1113 ((new_serial.flags & ~ASYNC_USR_MASK) !=
1114 (state->flags & ~ASYNC_USR_MASK)))
1115 return -EPERM;
1116 state->flags = ((state->flags & ~ASYNC_USR_MASK) |
1117 (new_serial.flags & ASYNC_USR_MASK));
1118 info->flags = ((info->flags & ~ASYNC_USR_MASK) |
1119 (new_serial.flags & ASYNC_USR_MASK));
1120 state->custom_divisor = new_serial.custom_divisor;
1121 goto check_and_exit;
1122 }
1123
1124 if ((new_serial.irq >= NR_IRQS) || (new_serial.irq < 0) ||
1125 (new_serial.baud_base < 9600))
1126 return -EINVAL;
1127
1128 if (new_serial.type && change_port) {
1129 for (i = 0; i < SERIAL_SICC_NR; i++)
1130 if ((port != sicc_ports + i) &&
1131 sicc_ports[i].uart_base != new_port)
1132 return -EADDRINUSE;
1133 }
1134
1135 if ((change_port || change_irq) && (state->count > 1))
1136 return -EBUSY;
1137
1138 /*
1139 * OK, past this point, all the error checking has been done.
1140 * At this point, we start making changes.....
1141 */
1142 port->uartclk = new_serial.baud_base * 16;
1143 state->flags = ((state->flags & ~ASYNC_FLAGS) |
1144 (new_serial.flags & ASYNC_FLAGS));
1145 info->flags = ((state->flags & ~ASYNC_INTERNAL_FLAGS) |
1146 (info->flags & ASYNC_INTERNAL_FLAGS));
1147 state->custom_divisor = new_serial.custom_divisor;
1148 state->close_delay = new_serial.close_delay * HZ / 100;
1149 state->closing_wait = new_serial.closing_wait * HZ / 100;
1150 info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
1151 port->fifosize = new_serial.xmit_fifo_size;
1152
1153 if (change_port || change_irq) {
1154 /*
1155 * We need to shutdown the serial port at the old
1156 * port/irq combination.
1157 */
1158 siccuart_shutdown(info);
1159 port->irqrx = new_serial.irq;
1160 port->uart_base = new_port;
1161 }
1162
1163check_and_exit:
1164 if (!port->uart_base)
1165 return 0;
1166 if (info->flags & ASYNC_INITIALIZED) {
1167 if ((old_state.flags & ASYNC_SPD_MASK) !=
1168 (state->flags & ASYNC_SPD_MASK) ||
1169 (old_state.custom_divisor != state->custom_divisor)) {
1170 if ((state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
1171 info->tty->alt_speed = 57600;
1172 if ((state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
1173 info->tty->alt_speed = 115200;
1174 if ((state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)
1175 info->tty->alt_speed = 230400;
1176 if ((state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)
1177 info->tty->alt_speed = 460800;
1178 siccuart_change_speed(info, NULL);
1179 }
1180 } else
1181 retval = siccuart_startup(info);
1182 return retval;
1183}
1184
1185
1186/*
1187 * get_lsr_info - get line status register info
1188 */
1189static int get_lsr_info(struct SICC_info *info, unsigned int *value)
1190{
1191 unsigned int result, status;
1192 unsigned long flags;
1193
1194 /* disable interrupts while reading status from port */
1195 spin_lock_irqsave(&info->state->sicc_lock,flags);
1196 status = readb(info->port->uart_base + BL_SICC_LSR);
1197 spin_unlock_irqrestore(&info->state->sicc_lock,flags);
1198 result = status & _LSR_TSR_EMPTY ? TIOCSER_TEMT : 0;
1199
1200 /*
1201 * If we're about to load something into the transmit
1202 * register, we'll pretend the transmitter isn't empty to
1203 * avoid a race condition (depending on when the transmit
1204 * interrupt happens).
1205 */
1206 if (info->x_char ||
1207 ((CIRC_CNT(info->xmit.head, info->xmit.tail,
1208 SICC_XMIT_SIZE) > 0) &&
1209 !info->tty->stopped && !info->tty->hw_stopped))
1210 result &= TIOCSER_TEMT;
1211
1212 return put_user(result, value);
1213}
1214
1215static int get_modem_info(struct SICC_info *info, unsigned int *value)
1216{
1217 unsigned int result = info->mctrl;
1218
1219 return put_user(result, value);
1220}
1221
1222static int set_modem_info(struct SICC_info *info, unsigned int cmd,
1223 unsigned int *value)
1224{
1225 unsigned int arg, old;
1226 unsigned long flags;
1227
1228 if (get_user(arg, value))
1229 return -EFAULT;
1230
1231 old = info->mctrl;
1232 switch (cmd) {
1233 case TIOCMBIS:
1234 info->mctrl |= arg;
1235 break;
1236
1237 case TIOCMBIC:
1238 info->mctrl &= ~arg;
1239 break;
1240
1241 case TIOCMSET:
1242 info->mctrl = arg;
1243 break;
1244
1245 default:
1246 return -EINVAL;
1247 }
1248 /* disable interrupts while setting modem control lines */
1249 spin_lock_irqsave(&info->state->sicc_lock,flags);
1250 if (old != info->mctrl)
1251 info->port->set_mctrl(info->port, info->mctrl);
1252 spin_unlock_irqrestore(&info->state->sicc_lock,flags);
1253 return 0;
1254}
1255
1256static void siccuart_break_ctl(struct tty_struct *tty, int break_state)
1257{
1258 struct SICC_info *info = tty->driver_data;
1259 unsigned long flags;
1260 unsigned int lcr_h;
1261
1262
1263 /* disable interrupts while setting break state */
1264 spin_lock_irqsave(&info->state->sicc_lock,flags);
1265 lcr_h = readb(info->port + BL_SICC_LSR);
1266 if (break_state == -1)
1267 lcr_h |= _LSR_LB_MASK;
1268 else
1269 lcr_h &= ~_LSR_LB_MASK;
1270 writeb(lcr_h, info->port + BL_SICC_LSRS);
1271 spin_unlock_irqrestore(&info->state->sicc_lock,flags);
1272}
1273
1274static int siccuart_ioctl(struct tty_struct *tty, struct file *file,
1275 unsigned int cmd, unsigned long arg)
1276{
1277 struct SICC_info *info = tty->driver_data;
1278 struct SICC_icount cnow;
1279 struct serial_icounter_struct icount;
1280 unsigned long flags;
1281
1282 if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) &&
1283 (cmd != TIOCSERCONFIG) && (cmd != TIOCSERGSTRUCT) &&
1284 (cmd != TIOCMIWAIT) && (cmd != TIOCGICOUNT)) {
1285 if (tty->flags & (1 << TTY_IO_ERROR))
1286 return -EIO;
1287 }
1288
1289 switch (cmd) {
1290 case TIOCMGET:
1291 return get_modem_info(info, (unsigned int *)arg);
1292 case TIOCMBIS:
1293 case TIOCMBIC:
1294 case TIOCMSET:
1295 return set_modem_info(info, cmd, (unsigned int *)arg);
1296 case TIOCGSERIAL:
1297 return get_serial_info(info,
1298 (struct serial_struct *)arg);
1299 case TIOCSSERIAL:
1300 return set_serial_info(info,
1301 (struct serial_struct *)arg);
1302 case TIOCSERGETLSR: /* Get line status register */
1303 return get_lsr_info(info, (unsigned int *)arg);
1304 /*
1305 * Wait for any of the 4 modem inputs (DCD,RI,DSR,CTS) to change
1306 * - mask passed in arg for lines of interest
1307 * (use |'ed TIOCM_RNG/DSR/CD/CTS for masking)
1308 * Caller should use TIOCGICOUNT to see which one it was
1309 */
1310 case TIOCMIWAIT:
1311 return 0;
1312 /*
1313 * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
1314 * Return: write counters to the user passed counter struct
1315 * NB: both 1->0 and 0->1 transitions are counted except for
1316 * RI where only 0->1 is counted.
1317 */
1318 case TIOCGICOUNT:
1319 /* disable interrupts while getting interrupt count */
1320 spin_lock_irqsave(&info->state->sicc_lock,flags);
1321 cnow = info->state->icount;
1322 spin_unlock_irqrestore(&info->state->sicc_lock,flags);
1323 icount.cts = cnow.cts;
1324 icount.dsr = cnow.dsr;
1325 icount.rng = cnow.rng;
1326 icount.dcd = cnow.dcd;
1327 icount.rx = cnow.rx;
1328 icount.tx = cnow.tx;
1329 icount.frame = cnow.frame;
1330 icount.overrun = cnow.overrun;
1331 icount.parity = cnow.parity;
1332 icount.brk = cnow.brk;
1333 icount.buf_overrun = cnow.buf_overrun;
1334
1335 return copy_to_user((void *)arg, &icount, sizeof(icount))
1336 ? -EFAULT : 0;
1337
1338 default:
1339 return -ENOIOCTLCMD;
1340 }
1341 return 0;
1342}
1343
1344static void siccuart_set_termios(struct tty_struct *tty, struct termios *old_termios)
1345{
1346 struct SICC_info *info = tty->driver_data;
1347 unsigned long flags;
1348 unsigned int cflag = tty->termios->c_cflag;
1349
1350 if ((cflag ^ old_termios->c_cflag) == 0 &&
1351 RELEVENT_IFLAG(tty->termios->c_iflag ^ old_termios->c_iflag) == 0)
1352 return;
1353
1354 siccuart_change_speed(info, old_termios);
1355
1356 /* Handle transition to B0 status */
1357 if ((old_termios->c_cflag & CBAUD) &&
1358 !(cflag & CBAUD)) {
1359 /* disable interrupts while setting break state */
1360 spin_lock_irqsave(&info->state->sicc_lock,flags);
1361 info->mctrl &= ~(TIOCM_RTS | TIOCM_DTR);
1362 info->port->set_mctrl(info->port, info->mctrl);
1363 spin_unlock_irqrestore(&info->state->sicc_lock,flags);
1364 }
1365
1366 /* Handle transition away from B0 status */
1367 if (!(old_termios->c_cflag & CBAUD) &&
1368 (cflag & CBAUD)) {
1369 /* disable interrupts while setting break state */
1370 spin_lock_irqsave(&info->state->sicc_lock,flags);
1371 info->mctrl |= TIOCM_DTR;
1372 if (!(cflag & CRTSCTS) ||
1373 !test_bit(TTY_THROTTLED, &tty->flags))
1374 info->mctrl |= TIOCM_RTS;
1375 info->port->set_mctrl(info->port, info->mctrl);
1376 spin_unlock_irqrestore(&info->state->sicc_lock,flags);
1377 }
1378
1379 /* Handle turning off CRTSCTS */
1380 if ((old_termios->c_cflag & CRTSCTS) &&
1381 !(cflag & CRTSCTS)) {
1382 tty->hw_stopped = 0;
1383 siccuart_start(tty);
1384 }
1385
1386#if 0
1387 /*
1388 * No need to wake up processes in open wait, since they
1389 * sample the CLOCAL flag once, and don't recheck it.
1390 * XXX It's not clear whether the current behavior is correct
1391 * or not. Hence, this may change.....
1392 */
1393 if (!(old_termios->c_cflag & CLOCAL) &&
1394 (tty->termios->c_cflag & CLOCAL))
1395 wake_up_interruptible(&info->open_wait);
1396#endif
1397}
1398
1399static void siccuart_close(struct tty_struct *tty, struct file *filp)
1400{
1401 struct SICC_info *info = tty->driver_data;
1402 struct SICC_state *state;
1403 unsigned long flags;
1404
1405 if (!info)
1406 return;
1407
1408 state = info->state;
1409
1410 //pr_debug("siccuart_close() called\n");
1411
1412 /* lock tty->driver_data while closing port */
1413 spin_lock_irqsave(&info->state->sicc_lock,flags);
1414
1415 if (tty_hung_up_p(filp)) {
1416 goto quick_close;
1417 }
1418
1419 if ((tty->count == 1) && (state->count != 1)) {
1420 /*
1421 * Uh, oh. tty->count is 1, which means that the tty
1422 * structure will be freed. state->count should always
1423 * be one in these conditions. If it's greater than
1424 * one, we've got real problems, since it means the
1425 * serial port won't be shutdown.
1426 */
1427 printk("siccuart_close: bad serial port count; tty->count is 1, state->count is %d\n", state->count);
1428 state->count = 1;
1429 }
1430 if (--state->count < 0) {
1431 printk("rs_close: bad serial port count for %s: %d\n", tty->name, state->count);
1432 state->count = 0;
1433 }
1434 if (state->count) {
1435 goto quick_close;
1436 }
1437 info->flags |= ASYNC_CLOSING;
1438 spin_unlock_irqrestore(&info->state->sicc_lock,flags);
1439 /*
1440 * Now we wait for the transmit buffer to clear; and we notify
1441 * the line discipline to only process XON/XOFF characters.
1442 */
1443 tty->closing = 1;
1444 if (info->state->closing_wait != ASYNC_CLOSING_WAIT_NONE)
1445 tty_wait_until_sent(tty, info->state->closing_wait);
1446 /*
1447 * At this point, we stop accepting input. To do this, we
1448 * disable the receive line status interrupts.
1449 */
1450 if (info->flags & ASYNC_INITIALIZED) {
1451 siccuart_disable_rx_interrupt(info);
1452 /*
1453 * Before we drop DTR, make sure the UART transmitter
1454 * has completely drained; this is especially
1455 * important if there is a transmit FIFO!
1456 */
1457 siccuart_wait_until_sent(tty, info->timeout);
1458 }
1459 siccuart_shutdown(info);
1460 if (tty->driver->flush_buffer)
1461 tty->driver->flush_buffer(tty);
1462 if (tty->ldisc.flush_buffer)
1463 tty->ldisc.flush_buffer(tty);
1464 tty->closing = 0;
1465 info->event = 0;
1466 info->tty = NULL;
1467 if (info->blocked_open) {
1468 if (info->state->close_delay) {
1469 set_current_state(TASK_INTERRUPTIBLE);
1470 schedule_timeout(info->state->close_delay);
1471 }
1472 wake_up_interruptible(&info->open_wait);
1473 }
1474 info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
1475 wake_up_interruptible(&info->close_wait);
1476 return;
1477
1478quick_close:
1479 spin_unlock_irqrestore(&info->state->sicc_lock,flags);
1480 return;
1481}
1482
1483static void siccuart_wait_until_sent(struct tty_struct *tty, int timeout)
1484{
1485 struct SICC_info *info = (struct SICC_info *) tty->driver_data;
1486 unsigned long char_time, expire;
1487
1488 if (info->port->fifosize == 0)
1489 return;
1490
1491 /*
1492 * Set the check interval to be 1/5 of the estimated time to
1493 * send a single character, and make it at least 1. The check
1494 * interval should also be less than the timeout.
1495 *
1496 * Note: we have to use pretty tight timings here to satisfy
1497 * the NIST-PCTS.
1498 */
1499 char_time = (info->timeout - HZ/50) / info->port->fifosize;
1500 char_time = char_time / 5;
1501 if (char_time == 0)
1502 char_time = 1;
1503
1504 // Crazy!! sometimes the input arg 'timeout' can be negtive numbers :-(
1505 if (timeout >= 0 && timeout < char_time)
1506 char_time = timeout;
1507 /*
1508 * If the transmitter hasn't cleared in twice the approximate
1509 * amount of time to send the entire FIFO, it probably won't
1510 * ever clear. This assumes the UART isn't doing flow
1511 * control, which is currently the case. Hence, if it ever
1512 * takes longer than info->timeout, this is probably due to a
1513 * UART bug of some kind. So, we clamp the timeout parameter at
1514 * 2*info->timeout.
1515 */
1516 if (!timeout || timeout > 2 * info->timeout)
1517 timeout = 2 * info->timeout;
1518
1519 expire = jiffies + timeout;
1520 pr_debug("siccuart_wait_until_sent(%d), jiff=%lu, expire=%lu char_time=%lu...\n",
1521 tty->index, jiffies,
1522 expire, char_time);
1523 while ((readb(info->port->uart_base + BL_SICC_LSR) & _LSR_TX_ALL) != _LSR_TX_ALL) {
1524 set_current_state(TASK_INTERRUPTIBLE);
1525 schedule_timeout(char_time);
1526 if (signal_pending(current))
1527 break;
1528 if (timeout && time_after(jiffies, expire))
1529 break;
1530 }
1531 set_current_state(TASK_RUNNING);
1532}
1533
1534static void siccuart_hangup(struct tty_struct *tty)
1535{
1536 struct SICC_info *info = tty->driver_data;
1537 struct SICC_state *state = info->state;
1538
1539 siccuart_flush_buffer(tty);
1540 if (info->flags & ASYNC_CLOSING)
1541 return;
1542 siccuart_shutdown(info);
1543 info->event = 0;
1544 state->count = 0;
1545 info->flags &= ~ASYNC_NORMAL_ACTIVE;
1546 info->tty = NULL;
1547 wake_up_interruptible(&info->open_wait);
1548}
1549
1550static int block_til_ready(struct tty_struct *tty, struct file *filp,
1551 struct SICC_info *info)
1552{
1553 DECLARE_WAITQUEUE(wait, current);
1554 struct SICC_state *state = info->state;
1555 unsigned long flags;
1556 int do_clocal = 0, extra_count = 0, retval;
1557
1558 /*
1559 * If the device is in the middle of being closed, then block
1560 * until it's done, and then try again.
1561 */
1562 if (tty_hung_up_p(filp) ||
1563 (info->flags & ASYNC_CLOSING)) {
1564 if (info->flags & ASYNC_CLOSING)
1565 interruptible_sleep_on(&info->close_wait);
1566 return (info->flags & ASYNC_HUP_NOTIFY) ?
1567 -EAGAIN : -ERESTARTSYS;
1568 }
1569
1570 /*
1571 * If non-blocking mode is set, or the port is not enabled,
1572 * then make the check up front and then exit.
1573 */
1574 if ((filp->f_flags & O_NONBLOCK) ||
1575 (tty->flags & (1 << TTY_IO_ERROR))) {
1576 info->flags |= ASYNC_NORMAL_ACTIVE;
1577 return 0;
1578 }
1579
1580 if (tty->termios->c_cflag & CLOCAL)
1581 do_clocal = 1;
1582
1583 /*
1584 * Block waiting for the carrier detect and the line to become
1585 * free (i.e., not in use by the callout). While we are in
1586 * this loop, state->count is dropped by one, so that
1587 * rs_close() knows when to free things. We restore it upon
1588 * exit, either normal or abnormal.
1589 */
1590 retval = 0;
1591 add_wait_queue(&info->open_wait, &wait);
1592 /* lock while decrementing state->count */
1593 spin_lock_irqsave(&info->state->sicc_lock,flags);
1594 if (!tty_hung_up_p(filp)) {
1595 extra_count = 1;
1596 state->count--;
1597 }
1598 spin_unlock_irqrestore(&info->state->sicc_lock,flags);
1599 info->blocked_open++;
1600 while (1) {
1601 /* disable interrupts while setting modem control lines */
1602 spin_lock_irqsave(&info->state->sicc_lock,flags);
1603 if (tty->termios->c_cflag & CBAUD) {
1604 info->mctrl = TIOCM_DTR | TIOCM_RTS;
1605 info->port->set_mctrl(info->port, info->mctrl);
1606 }
1607 spin_unlock_irqrestore(&info->state->sicc_lock,flags);
1608 set_current_state(TASK_INTERRUPTIBLE);
1609 if (tty_hung_up_p(filp) ||
1610 !(info->flags & ASYNC_INITIALIZED)) {
1611 if (info->flags & ASYNC_HUP_NOTIFY)
1612 retval = -EAGAIN;
1613 else
1614 retval = -ERESTARTSYS;
1615 break;
1616 }
1617 if (!(info->flags & ASYNC_CLOSING) &&
1618 (do_clocal /*|| (UART_GET_FR(info->port) & SICC_UARTFR_DCD)*/))
1619 break;
1620 if (signal_pending(current)) {
1621 retval = -ERESTARTSYS;
1622 break;
1623 }
1624 schedule();
1625 }
1626 set_current_state(TASK_RUNNING);
1627 remove_wait_queue(&info->open_wait, &wait);
1628 if (extra_count)
1629 state->count++;
1630 info->blocked_open--;
1631 if (retval)
1632 return retval;
1633 info->flags |= ASYNC_NORMAL_ACTIVE;
1634 return 0;
1635}
1636
1637static struct SICC_info *siccuart_get(int line)
1638{
1639 struct SICC_info *info;
1640 struct SICC_state *state = sicc_state + line;
1641
1642 state->count++;
1643 if (state->info)
1644 return state->info;
1645 info = kmalloc(sizeof(struct SICC_info), GFP_KERNEL);
1646 if (info) {
1647 memset(info, 0, sizeof(struct SICC_info));
1648 init_waitqueue_head(&info->open_wait);
1649 init_waitqueue_head(&info->close_wait);
1650 init_waitqueue_head(&info->delta_msr_wait);
1651 info->flags = state->flags;
1652 info->state = state;
1653 info->port = sicc_ports + line;
1654 tasklet_init(&info->tlet, siccuart_tasklet_action,
1655 (unsigned long)info);
1656 }
1657 if (state->info) {
1658 kfree(info);
1659 return state->info;
1660 }
1661 state->info = info;
1662 return info;
1663}
1664
1665static int siccuart_open(struct tty_struct *tty, struct file *filp)
1666{
1667 struct SICC_info *info;
1668 int retval, line = tty->index;
1669
1670
1671 // is this a line that we've got?
1672 if (line >= SERIAL_SICC_NR) {
1673 return -ENODEV;
1674 }
1675
1676 info = siccuart_get(line);
1677 if (!info)
1678 return -ENOMEM;
1679
1680 tty->driver_data = info;
1681 info->tty = tty;
1682 info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
1683
1684 /*
1685 * Make sure we have the temporary buffer allocated
1686 */
1687 if (!tmp_buf) {
1688 unsigned long page = get_zeroed_page(GFP_KERNEL);
1689 if (tmp_buf)
1690 free_page(page);
1691 else if (!page) {
1692 return -ENOMEM;
1693 }
1694 tmp_buf = (u_char *)page;
1695 }
1696
1697 /*
1698 * If the port is in the middle of closing, bail out now.
1699 */
1700 if (tty_hung_up_p(filp) ||
1701 (info->flags & ASYNC_CLOSING)) {
1702 if (info->flags & ASYNC_CLOSING)
1703 interruptible_sleep_on(&info->close_wait);
1704 return -EAGAIN;
1705 }
1706
1707 /*
1708 * Start up the serial port
1709 */
1710 retval = siccuart_startup(info);
1711 if (retval) {
1712 return retval;
1713 }
1714
1715 retval = block_til_ready(tty, filp, info);
1716 if (retval) {
1717 return retval;
1718 }
1719
1720#ifdef CONFIG_SERIAL_SICC_CONSOLE
1721 if (siccuart_cons.cflag && siccuart_cons.index == line) {
1722 tty->termios->c_cflag = siccuart_cons.cflag;
1723 siccuart_cons.cflag = 0;
1724 siccuart_change_speed(info, NULL);
1725 }
1726#endif
1727 return 0;
1728}
1729
1730static struct tty_operations sicc_ops = {
1731 .open = siccuart_open,
1732 .close = siccuart_close,
1733 .write = siccuart_write,
1734 .put_char = siccuart_put_char,
1735 .flush_chars = siccuart_flush_chars,
1736 .write_room = siccuart_write_room,
1737 .chars_in_buffer = siccuart_chars_in_buffer,
1738 .flush_buffer = siccuart_flush_buffer,
1739 .ioctl = siccuart_ioctl,
1740 .throttle = siccuart_throttle,
1741 .unthrottle = siccuart_unthrottle,
1742 .send_xchar = siccuart_send_xchar,
1743 .set_termios = siccuart_set_termios,
1744 .stop = siccuart_stop,
1745 .start = siccuart_start,
1746 .hangup = siccuart_hangup,
1747 .break_ctl = siccuart_break_ctl,
1748 .wait_until_sent = siccuart_wait_until_sent,
1749};
1750
1751int __init siccuart_init(void)
1752{
1753 int i;
1754 siccnormal_driver = alloc_tty_driver(SERIAL_SICC_NR);
1755 if (!siccnormal_driver)
1756 return -ENOMEM;
1757 printk("IBM Vesta SICC serial port driver V 0.1 by Yudong Yang and Yi Ge / IBM CRL .\n");
1758 siccnormal_driver->driver_name = "serial_sicc";
1759 siccnormal_driver->owner = THIS_MODULE;
1760 siccnormal_driver->name = SERIAL_SICC_NAME;
1761 siccnormal_driver->major = SERIAL_SICC_MAJOR;
1762 siccnormal_driver->minor_start = SERIAL_SICC_MINOR;
1763 siccnormal_driver->type = TTY_DRIVER_TYPE_SERIAL;
1764 siccnormal_driver->subtype = SERIAL_TYPE_NORMAL;
1765 siccnormal_driver->init_termios = tty_std_termios;
1766 siccnormal_driver->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL;
1767 siccnormal_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS;
1768 tty_set_operations(siccnormal_driver, &sicc_ops);
1769
1770 if (tty_register_driver(siccnormal_driver))
1771 panic("Couldn't register SICC serial driver\n");
1772
1773 for (i = 0; i < SERIAL_SICC_NR; i++) {
1774 struct SICC_state *state = sicc_state + i;
1775 state->line = i;
1776 state->close_delay = 5 * HZ / 10;
1777 state->closing_wait = 30 * HZ;
1778 spin_lock_init(&state->sicc_lock);
1779 }
1780
1781
1782 return 0;
1783}
1784
1785__initcall(siccuart_init);
1786
1787#ifdef CONFIG_SERIAL_SICC_CONSOLE
1788/************** console driver *****************/
1789
1790/*
1791 * This code is currently never used; console->read is never called.
1792 * Therefore, although we have an implementation, we don't use it.
1793 * FIXME: the "const char *s" should be fixed to "char *s" some day.
1794 * (when the definition in include/linux/console.h is also fixed)
1795 */
1796#ifdef used_and_not_const_char_pointer
1797static int siccuart_console_read(struct console *co, const char *s, u_int count)
1798{
1799 struct SICC_port *port = &sicc_ports[co->index];
1800 unsigned int status;
1801 char *w;
1802 int c;
1803
1804 pr_debug("siccuart_console_read() called\n");
1805
1806 c = 0;
1807 w = s;
1808 while (c < count) {
1809 if(readb(port->uart_base + BL_SICC_LSR) & _LSR_RBR_FULL) {
1810 *w++ = readb(port->uart_base + BL_SICC_RBR);
1811 c++;
1812 } else {
1813 // nothing more to get, return
1814 return c;
1815 }
1816 }
1817 // return the count
1818 return c;
1819}
1820#endif
1821
1822/*
1823 * Print a string to the serial port trying not to disturb
1824 * any possible real use of the port...
1825 *
1826 * The console_lock must be held when we get here.
1827 */
1828static void siccuart_console_write(struct console *co, const char *s, u_int count)
1829{
1830 struct SICC_port *port = &sicc_ports[co->index];
1831 unsigned int old_cr;
1832 int i;
1833
1834 /*
1835 * First save the CR then disable the interrupts
1836 */
1837 old_cr = readb(port->uart_base + BL_SICC_TxCR);
1838 writeb(old_cr & ~_TxCR_DME_MASK, port->uart_base + BL_SICC_TxCR);
1839
1840 /*
1841 * Now, do each character
1842 */
1843 for (i = 0; i < count; i++) {
1844 while ((readb(port->uart_base + BL_SICC_LSR)&_LSR_TX_ALL) != _LSR_TX_ALL);
1845 writeb(s[i], port->uart_base + BL_SICC_TBR);
1846 if (s[i] == '\n') {
1847 while ((readb(port->uart_base + BL_SICC_LSR)&_LSR_TX_ALL) != _LSR_TX_ALL);
1848 writeb('\r', port->uart_base + BL_SICC_TBR);
1849 }
1850 }
1851
1852 /*
1853 * Finally, wait for transmitter to become empty
1854 * and restore the TCR
1855 */
1856 while ((readb(port->uart_base + BL_SICC_LSR)&_LSR_TX_ALL) != _LSR_TX_ALL);
1857 writeb(old_cr, port->uart_base + BL_SICC_TxCR);
1858}
1859
1860/*
1861 * Receive character from the serial port
1862 */
1863static int siccuart_console_wait_key(struct console *co)
1864{
1865 struct SICC_port *port = &sicc_ports[co->index];
1866 int c;
1867
1868 while(!(readb(port->uart_base + BL_SICC_LSR) & _LSR_RBR_FULL));
1869 c = readb(port->uart_base + BL_SICC_RBR);
1870 return c;
1871}
1872
1873static struct tty_driver *siccuart_console_device(struct console *c, int *index)
1874{
1875 *index = c->index;
1876 return siccnormal_driver;
1877}
1878
1879static int __init siccuart_console_setup(struct console *co, char *options)
1880{
1881 struct SICC_port *port;
1882 int baud = 9600;
1883 int bits = 8;
1884 int parity = 'n';
1885 u_int cflag = CREAD | HUPCL | CLOCAL;
1886 u_int lcr_h, quot;
1887
1888
1889 if (co->index >= SERIAL_SICC_NR)
1890 co->index = 0;
1891
1892 port = &sicc_ports[co->index];
1893
1894 if (port->uart_base == 0)
1895 port->uart_base = (int)ioremap(port->uart_base_phys, PAGE_SIZE);
1896
1897 if (options) {
1898 char *s = options;
1899 baud = simple_strtoul(s, NULL, 10);
1900 while (*s >= '0' && *s <= '9')
1901 s++;
1902 if (*s) parity = *s++;
1903 if (*s) bits = *s - '0';
1904 }
1905
1906 /*
1907 * Now construct a cflag setting.
1908 */
1909 switch (baud) {
1910 case 1200: cflag |= B1200; break;
1911 case 2400: cflag |= B2400; break;
1912 case 4800: cflag |= B4800; break;
1913 default: cflag |= B9600; baud = 9600; break;
1914 case 19200: cflag |= B19200; break;
1915 case 38400: cflag |= B38400; break;
1916 case 57600: cflag |= B57600; break;
1917 case 115200: cflag |= B115200; break;
1918 }
1919 switch (bits) {
1920 case 7: cflag |= CS7; lcr_h = _LCR_PE_DISABLE | _LCR_DB_7_BITS | _LCR_SB_1_BIT; break;
1921 default: cflag |= CS8; lcr_h = _LCR_PE_DISABLE | _LCR_DB_8_BITS | _LCR_SB_1_BIT; break;
1922 }
1923 switch (parity) {
1924 case 'o':
1925 case 'O': cflag |= PARODD; lcr_h |= _LCR_PTY_ODD; break;
1926 case 'e':
1927 case 'E': cflag |= PARENB; lcr_h |= _LCR_PE_ENABLE | _LCR_PTY_ODD; break;
1928 }
1929
1930 co->cflag = cflag;
1931
1932
1933 {
1934 // a copy of is inserted here ppc403SetBaud(com_port, (int)9600);
1935 unsigned long divisor, clockSource, temp;
1936 unsigned int rate = baud;
1937
1938 /* Ensure CICCR[7] is 0 to select Internal Baud Clock */
1939 powerpcMtcic_cr((unsigned long)(powerpcMfcic_cr() & 0xFEFFFFFF));
1940
1941 /* Determine Internal Baud Clock Frequency */
1942 /* powerpcMfclkgpcr() reads DCR 0x120 - the*/
1943 /* SCCR (Serial Clock Control Register) on Vesta */
1944 temp = powerpcMfclkgpcr();
1945
1946 if(temp & 0x00000080) {
1947 clockSource = 324000000;
1948 }
1949 else {
1950 clockSource = 216000000;
1951 }
1952 clockSource = clockSource/(unsigned long)((temp&0x00FC0000)>>18);
1953 divisor = clockSource/(16*rate) - 1;
1954 /* divisor has only 12 bits of resolution */
1955 if(divisor>0x00000FFF){
1956 divisor=0x00000FFF;
1957 }
1958
1959 quot = divisor;
1960 }
1961
1962 writeb((quot & 0x00000F00)>>8, port->uart_base + BL_SICC_BRDH );
1963 writeb( quot & 0x00000FF, port->uart_base + BL_SICC_BRDL );
1964
1965 /* Set CTL2 reg to use external clock (ExtClk) and enable FIFOs. */
1966 /* For now, do NOT use FIFOs since 403 UART did not have this */
1967 /* capability and this driver was inherited from 403UART. */
1968 writeb(_CTL2_EXTERN, port->uart_base + BL_SICC_CTL2);
1969
1970 writeb(lcr_h, port->uart_base + BL_SICC_LCR);
1971 writeb(_RCR_ER_ENABLE | _RCR_PME_HARD, port->uart_base + BL_SICC_RCR);
1972 writeb( _TxCR_ET_ENABLE , port->uart_base + BL_SICC_TxCR);
1973
1974 // writeb(, info->port->uart_base + BL_SICC_RCR );
1975 /*
1976 * Transmitter Command Register: Transmitter enabled & DMA + TBR interrupt
1977 * + Transmitter Empty interrupt + Transmitter error interrupt disabled &
1978 * Stop mode when CTS active enabled & Transmit Break + Pattern Generation
1979 * mode disabled.
1980 */
1981
1982 writeb( 0x00, port->uart_base + BL_SICC_IrCR ); // disable IrDA
1983
1984 readb(port->uart_base + BL_SICC_RBR);
1985
1986 writeb(0xf8, port->uart_base + BL_SICC_LSR); /* reset bits 0-4 of LSR */
1987
1988 /* we will enable the port as we need it */
1989
1990 return 0;
1991}
1992
1993static struct console siccuart_cons =
1994{
1995 .name = SERIAL_SICC_NAME,
1996 .write = siccuart_console_write,
1997#ifdef used_and_not_const_char_pointer
1998 .read = siccuart_console_read,
1999#endif
2000 .device = siccuart_console_device,
2001 .wait_key = siccuart_console_wait_key,
2002 .setup = siccuart_console_setup,
2003 .flags = CON_PRINTBUFFER,
2004 .index = -1,
2005};
2006
2007void __init sicc_console_init(void)
2008{
2009 register_console(&siccuart_cons);
2010}
2011
2012#endif /* CONFIG_SERIAL_SICC_CONSOLE */
diff --git a/arch/ppc/8260_io/Kconfig b/arch/ppc/8260_io/Kconfig
new file mode 100644
index 000000000000..ea9651e2dd6a
--- /dev/null
+++ b/arch/ppc/8260_io/Kconfig
@@ -0,0 +1,65 @@
1#
2# CPM2 Communication options
3#
4
5menu "CPM2 Options"
6 depends on CPM2
7
8config SCC_ENET
9 bool "CPM SCC Ethernet"
10 depends on NET_ETHERNET
11
12#
13# CONFIG_FEC_ENET is only used to get netdevices to call our init
14# function. Any combination of FCC1,2,3 are supported.
15#
16config FEC_ENET
17 bool "FCC Ethernet"
18 depends on NET_ETHERNET
19
20config FCC1_ENET
21 bool "Ethernet on FCC1"
22 depends on FEC_ENET
23 help
24 Use CPM2 fast Ethernet controller 1 to drive Ethernet (default).
25
26config FCC2_ENET
27 bool "Ethernet on FCC2"
28 depends on FEC_ENET
29 help
30 Use CPM2 fast Ethernet controller 2 to drive Ethernet.
31
32config FCC3_ENET
33 bool "Ethernet on FCC3"
34 depends on FEC_ENET
35 help
36 Use CPM2 fast Ethernet controller 3 to drive Ethernet.
37
38config USE_MDIO
39 bool "Use MDIO for PHY configuration"
40 depends on FEC_ENET
41
42choice
43 prompt "Type of PHY"
44 depends on 8260 && USE_MDIO
45 default FCC_GENERIC_PHY
46
47config FCC_LXT970
48 bool "LXT970"
49
50config FCC_LXT971
51 bool "LXT971"
52
53config FCC_QS6612
54 bool "QS6612"
55
56config FCC_DM9131
57 bool "DM9131"
58
59config FCC_DM9161
60 bool "DM9161"
61
62config FCC_GENERIC_PHY
63 bool "Generic"
64endchoice
65endmenu
diff --git a/arch/ppc/8260_io/Makefile b/arch/ppc/8260_io/Makefile
new file mode 100644
index 000000000000..971f292c5d48
--- /dev/null
+++ b/arch/ppc/8260_io/Makefile
@@ -0,0 +1,6 @@
1#
2# Makefile for the linux ppc-specific parts of comm processor (v2)
3#
4
5obj-$(CONFIG_FEC_ENET) += fcc_enet.o
6obj-$(CONFIG_SCC_ENET) += enet.o
diff --git a/arch/ppc/8260_io/enet.c b/arch/ppc/8260_io/enet.c
new file mode 100644
index 000000000000..ac6d55fe2235
--- /dev/null
+++ b/arch/ppc/8260_io/enet.c
@@ -0,0 +1,867 @@
1/*
2 * Ethernet driver for Motorola MPC8260.
3 * Copyright (c) 1999 Dan Malek (dmalek@jlc.net)
4 * Copyright (c) 2000 MontaVista Software Inc. (source@mvista.com)
5 * 2.3.99 Updates
6 *
7 * I copied this from the 8xx CPM Ethernet driver, so follow the
8 * credits back through that.
9 *
10 * This version of the driver is somewhat selectable for the different
11 * processor/board combinations. It works for the boards I know about
12 * now, and should be easily modified to include others. Some of the
13 * configuration information is contained in <asm/commproc.h> and the
14 * remainder is here.
15 *
16 * Buffer descriptors are kept in the CPM dual port RAM, and the frame
17 * buffers are in the host memory.
18 *
19 * Right now, I am very watseful with the buffers. I allocate memory
20 * pages and then divide them into 2K frame buffers. This way I know I
21 * have buffers large enough to hold one frame within one buffer descriptor.
22 * Once I get this working, I will use 64 or 128 byte CPM buffers, which
23 * will be much more memory efficient and will easily handle lots of
24 * small packets.
25 *
26 */
27#include <linux/kernel.h>
28#include <linux/sched.h>
29#include <linux/string.h>
30#include <linux/ptrace.h>
31#include <linux/errno.h>
32#include <linux/ioport.h>
33#include <linux/slab.h>
34#include <linux/interrupt.h>
35#include <linux/pci.h>
36#include <linux/init.h>
37#include <linux/delay.h>
38#include <linux/netdevice.h>
39#include <linux/etherdevice.h>
40#include <linux/skbuff.h>
41#include <linux/spinlock.h>
42#include <linux/bitops.h>
43
44#include <asm/immap_cpm2.h>
45#include <asm/pgtable.h>
46#include <asm/mpc8260.h>
47#include <asm/uaccess.h>
48#include <asm/cpm2.h>
49#include <asm/irq.h>
50
51/*
52 * Theory of Operation
53 *
54 * The MPC8260 CPM performs the Ethernet processing on an SCC. It can use
55 * an aribtrary number of buffers on byte boundaries, but must have at
56 * least two receive buffers to prevent constant overrun conditions.
57 *
58 * The buffer descriptors are allocated from the CPM dual port memory
59 * with the data buffers allocated from host memory, just like all other
60 * serial communication protocols. The host memory buffers are allocated
61 * from the free page pool, and then divided into smaller receive and
62 * transmit buffers. The size of the buffers should be a power of two,
63 * since that nicely divides the page. This creates a ring buffer
64 * structure similar to the LANCE and other controllers.
65 *
66 * Like the LANCE driver:
67 * The driver runs as two independent, single-threaded flows of control. One
68 * is the send-packet routine, which enforces single-threaded use by the
69 * cep->tx_busy flag. The other thread is the interrupt handler, which is
70 * single threaded by the hardware and other software.
71 */
72
73/* The transmitter timeout
74 */
75#define TX_TIMEOUT (2*HZ)
76
77/* The number of Tx and Rx buffers. These are allocated from the page
78 * pool. The code may assume these are power of two, so it is best
79 * to keep them that size.
80 * We don't need to allocate pages for the transmitter. We just use
81 * the skbuffer directly.
82 */
83#define CPM_ENET_RX_PAGES 4
84#define CPM_ENET_RX_FRSIZE 2048
85#define CPM_ENET_RX_FRPPG (PAGE_SIZE / CPM_ENET_RX_FRSIZE)
86#define RX_RING_SIZE (CPM_ENET_RX_FRPPG * CPM_ENET_RX_PAGES)
87#define TX_RING_SIZE 8 /* Must be power of two */
88#define TX_RING_MOD_MASK 7 /* for this to work */
89
90/* The CPM stores dest/src/type, data, and checksum for receive packets.
91 */
92#define PKT_MAXBUF_SIZE 1518
93#define PKT_MINBUF_SIZE 64
94#define PKT_MAXBLR_SIZE 1520
95
96/* The CPM buffer descriptors track the ring buffers. The rx_bd_base and
97 * tx_bd_base always point to the base of the buffer descriptors. The
98 * cur_rx and cur_tx point to the currently available buffer.
99 * The dirty_tx tracks the current buffer that is being sent by the
100 * controller. The cur_tx and dirty_tx are equal under both completely
101 * empty and completely full conditions. The empty/ready indicator in
102 * the buffer descriptor determines the actual condition.
103 */
104struct scc_enet_private {
105 /* The saved address of a sent-in-place packet/buffer, for skfree(). */
106 struct sk_buff* tx_skbuff[TX_RING_SIZE];
107 ushort skb_cur;
108 ushort skb_dirty;
109
110 /* CPM dual port RAM relative addresses.
111 */
112 cbd_t *rx_bd_base; /* Address of Rx and Tx buffers. */
113 cbd_t *tx_bd_base;
114 cbd_t *cur_rx, *cur_tx; /* The next free ring entry */
115 cbd_t *dirty_tx; /* The ring entries to be free()ed. */
116 scc_t *sccp;
117 struct net_device_stats stats;
118 uint tx_full;
119 spinlock_t lock;
120};
121
122static int scc_enet_open(struct net_device *dev);
123static int scc_enet_start_xmit(struct sk_buff *skb, struct net_device *dev);
124static int scc_enet_rx(struct net_device *dev);
125static irqreturn_t scc_enet_interrupt(int irq, void *dev_id, struct pt_regs *);
126static int scc_enet_close(struct net_device *dev);
127static struct net_device_stats *scc_enet_get_stats(struct net_device *dev);
128static void set_multicast_list(struct net_device *dev);
129
130/* These will be configurable for the SCC choice.
131*/
132#define CPM_ENET_BLOCK CPM_CR_SCC1_SBLOCK
133#define CPM_ENET_PAGE CPM_CR_SCC1_PAGE
134#define PROFF_ENET PROFF_SCC1
135#define SCC_ENET 0
136#define SIU_INT_ENET SIU_INT_SCC1
137
138/* These are both board and SCC dependent....
139*/
140#define PD_ENET_RXD ((uint)0x00000001)
141#define PD_ENET_TXD ((uint)0x00000002)
142#define PD_ENET_TENA ((uint)0x00000004)
143#define PC_ENET_RENA ((uint)0x00020000)
144#define PC_ENET_CLSN ((uint)0x00000004)
145#define PC_ENET_TXCLK ((uint)0x00000800)
146#define PC_ENET_RXCLK ((uint)0x00000400)
147#define CMX_CLK_ROUTE ((uint)0x25000000)
148#define CMX_CLK_MASK ((uint)0xff000000)
149
150/* Specific to a board.
151*/
152#define PC_EST8260_ENET_LOOPBACK ((uint)0x80000000)
153#define PC_EST8260_ENET_SQE ((uint)0x40000000)
154#define PC_EST8260_ENET_NOTFD ((uint)0x20000000)
155
156static int
157scc_enet_open(struct net_device *dev)
158{
159
160 /* I should reset the ring buffers here, but I don't yet know
161 * a simple way to do that.
162 */
163 netif_start_queue(dev);
164 return 0; /* Always succeed */
165}
166
167static int
168scc_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
169{
170 struct scc_enet_private *cep = (struct scc_enet_private *)dev->priv;
171 volatile cbd_t *bdp;
172
173
174 /* Fill in a Tx ring entry */
175 bdp = cep->cur_tx;
176
177#ifndef final_version
178 if (bdp->cbd_sc & BD_ENET_TX_READY) {
179 /* Ooops. All transmit buffers are full. Bail out.
180 * This should not happen, since cep->tx_full should be set.
181 */
182 printk("%s: tx queue full!.\n", dev->name);
183 return 1;
184 }
185#endif
186
187 /* Clear all of the status flags.
188 */
189 bdp->cbd_sc &= ~BD_ENET_TX_STATS;
190
191 /* If the frame is short, tell CPM to pad it.
192 */
193 if (skb->len <= ETH_ZLEN)
194 bdp->cbd_sc |= BD_ENET_TX_PAD;
195 else
196 bdp->cbd_sc &= ~BD_ENET_TX_PAD;
197
198 /* Set buffer length and buffer pointer.
199 */
200 bdp->cbd_datlen = skb->len;
201 bdp->cbd_bufaddr = __pa(skb->data);
202
203 /* Save skb pointer.
204 */
205 cep->tx_skbuff[cep->skb_cur] = skb;
206
207 cep->stats.tx_bytes += skb->len;
208 cep->skb_cur = (cep->skb_cur+1) & TX_RING_MOD_MASK;
209
210 spin_lock_irq(&cep->lock);
211
212 /* Send it on its way. Tell CPM its ready, interrupt when done,
213 * its the last BD of the frame, and to put the CRC on the end.
214 */
215 bdp->cbd_sc |= (BD_ENET_TX_READY | BD_ENET_TX_INTR | BD_ENET_TX_LAST | BD_ENET_TX_TC);
216
217 dev->trans_start = jiffies;
218
219 /* If this was the last BD in the ring, start at the beginning again.
220 */
221 if (bdp->cbd_sc & BD_ENET_TX_WRAP)
222 bdp = cep->tx_bd_base;
223 else
224 bdp++;
225
226 if (bdp->cbd_sc & BD_ENET_TX_READY) {
227 netif_stop_queue(dev);
228 cep->tx_full = 1;
229 }
230
231 cep->cur_tx = (cbd_t *)bdp;
232
233 spin_unlock_irq(&cep->lock);
234
235 return 0;
236}
237
238static void
239scc_enet_timeout(struct net_device *dev)
240{
241 struct scc_enet_private *cep = (struct scc_enet_private *)dev->priv;
242
243 printk("%s: transmit timed out.\n", dev->name);
244 cep->stats.tx_errors++;
245#ifndef final_version
246 {
247 int i;
248 cbd_t *bdp;
249 printk(" Ring data dump: cur_tx %p%s cur_rx %p.\n",
250 cep->cur_tx, cep->tx_full ? " (full)" : "",
251 cep->cur_rx);
252 bdp = cep->tx_bd_base;
253 printk(" Tx @base %p :\n", bdp);
254 for (i = 0 ; i < TX_RING_SIZE; i++, bdp++)
255 printk("%04x %04x %08x\n",
256 bdp->cbd_sc,
257 bdp->cbd_datlen,
258 bdp->cbd_bufaddr);
259 bdp = cep->rx_bd_base;
260 printk(" Rx @base %p :\n", bdp);
261 for (i = 0 ; i < RX_RING_SIZE; i++, bdp++)
262 printk("%04x %04x %08x\n",
263 bdp->cbd_sc,
264 bdp->cbd_datlen,
265 bdp->cbd_bufaddr);
266 }
267#endif
268 if (!cep->tx_full)
269 netif_wake_queue(dev);
270}
271
272/* The interrupt handler.
273 * This is called from the CPM handler, not the MPC core interrupt.
274 */
275static irqreturn_t
276scc_enet_interrupt(int irq, void * dev_id, struct pt_regs * regs)
277{
278 struct net_device *dev = dev_id;
279 volatile struct scc_enet_private *cep;
280 volatile cbd_t *bdp;
281 ushort int_events;
282 int must_restart;
283
284 cep = (struct scc_enet_private *)dev->priv;
285
286 /* Get the interrupt events that caused us to be here.
287 */
288 int_events = cep->sccp->scc_scce;
289 cep->sccp->scc_scce = int_events;
290 must_restart = 0;
291
292 /* Handle receive event in its own function.
293 */
294 if (int_events & SCCE_ENET_RXF)
295 scc_enet_rx(dev_id);
296
297 /* Check for a transmit error. The manual is a little unclear
298 * about this, so the debug code until I get it figured out. It
299 * appears that if TXE is set, then TXB is not set. However,
300 * if carrier sense is lost during frame transmission, the TXE
301 * bit is set, "and continues the buffer transmission normally."
302 * I don't know if "normally" implies TXB is set when the buffer
303 * descriptor is closed.....trial and error :-).
304 */
305
306 /* Transmit OK, or non-fatal error. Update the buffer descriptors.
307 */
308 if (int_events & (SCCE_ENET_TXE | SCCE_ENET_TXB)) {
309 spin_lock(&cep->lock);
310 bdp = cep->dirty_tx;
311 while ((bdp->cbd_sc&BD_ENET_TX_READY)==0) {
312 if ((bdp==cep->cur_tx) && (cep->tx_full == 0))
313 break;
314
315 if (bdp->cbd_sc & BD_ENET_TX_HB) /* No heartbeat */
316 cep->stats.tx_heartbeat_errors++;
317 if (bdp->cbd_sc & BD_ENET_TX_LC) /* Late collision */
318 cep->stats.tx_window_errors++;
319 if (bdp->cbd_sc & BD_ENET_TX_RL) /* Retrans limit */
320 cep->stats.tx_aborted_errors++;
321 if (bdp->cbd_sc & BD_ENET_TX_UN) /* Underrun */
322 cep->stats.tx_fifo_errors++;
323 if (bdp->cbd_sc & BD_ENET_TX_CSL) /* Carrier lost */
324 cep->stats.tx_carrier_errors++;
325
326
327 /* No heartbeat or Lost carrier are not really bad errors.
328 * The others require a restart transmit command.
329 */
330 if (bdp->cbd_sc &
331 (BD_ENET_TX_LC | BD_ENET_TX_RL | BD_ENET_TX_UN)) {
332 must_restart = 1;
333 cep->stats.tx_errors++;
334 }
335
336 cep->stats.tx_packets++;
337
338 /* Deferred means some collisions occurred during transmit,
339 * but we eventually sent the packet OK.
340 */
341 if (bdp->cbd_sc & BD_ENET_TX_DEF)
342 cep->stats.collisions++;
343
344 /* Free the sk buffer associated with this last transmit.
345 */
346 dev_kfree_skb_irq(cep->tx_skbuff[cep->skb_dirty]);
347 cep->skb_dirty = (cep->skb_dirty + 1) & TX_RING_MOD_MASK;
348
349 /* Update pointer to next buffer descriptor to be transmitted.
350 */
351 if (bdp->cbd_sc & BD_ENET_TX_WRAP)
352 bdp = cep->tx_bd_base;
353 else
354 bdp++;
355
356 /* I don't know if we can be held off from processing these
357 * interrupts for more than one frame time. I really hope
358 * not. In such a case, we would now want to check the
359 * currently available BD (cur_tx) and determine if any
360 * buffers between the dirty_tx and cur_tx have also been
361 * sent. We would want to process anything in between that
362 * does not have BD_ENET_TX_READY set.
363 */
364
365 /* Since we have freed up a buffer, the ring is no longer
366 * full.
367 */
368 if (cep->tx_full) {
369 cep->tx_full = 0;
370 if (netif_queue_stopped(dev)) {
371 netif_wake_queue(dev);
372 }
373 }
374
375 cep->dirty_tx = (cbd_t *)bdp;
376 }
377
378 if (must_restart) {
379 volatile cpm_cpm2_t *cp;
380
381 /* Some transmit errors cause the transmitter to shut
382 * down. We now issue a restart transmit. Since the
383 * errors close the BD and update the pointers, the restart
384 * _should_ pick up without having to reset any of our
385 * pointers either.
386 */
387
388 cp = cpmp;
389 cp->cp_cpcr =
390 mk_cr_cmd(CPM_ENET_PAGE, CPM_ENET_BLOCK, 0,
391 CPM_CR_RESTART_TX) | CPM_CR_FLG;
392 while (cp->cp_cpcr & CPM_CR_FLG);
393 }
394 spin_unlock(&cep->lock);
395 }
396
397 /* Check for receive busy, i.e. packets coming but no place to
398 * put them. This "can't happen" because the receive interrupt
399 * is tossing previous frames.
400 */
401 if (int_events & SCCE_ENET_BSY) {
402 cep->stats.rx_dropped++;
403 printk("SCC ENET: BSY can't happen.\n");
404 }
405
406 return IRQ_HANDLED;
407}
408
409/* During a receive, the cur_rx points to the current incoming buffer.
410 * When we update through the ring, if the next incoming buffer has
411 * not been given to the system, we just set the empty indicator,
412 * effectively tossing the packet.
413 */
414static int
415scc_enet_rx(struct net_device *dev)
416{
417 struct scc_enet_private *cep;
418 volatile cbd_t *bdp;
419 struct sk_buff *skb;
420 ushort pkt_len;
421
422 cep = (struct scc_enet_private *)dev->priv;
423
424 /* First, grab all of the stats for the incoming packet.
425 * These get messed up if we get called due to a busy condition.
426 */
427 bdp = cep->cur_rx;
428
429for (;;) {
430 if (bdp->cbd_sc & BD_ENET_RX_EMPTY)
431 break;
432
433#ifndef final_version
434 /* Since we have allocated space to hold a complete frame, both
435 * the first and last indicators should be set.
436 */
437 if ((bdp->cbd_sc & (BD_ENET_RX_FIRST | BD_ENET_RX_LAST)) !=
438 (BD_ENET_RX_FIRST | BD_ENET_RX_LAST))
439 printk("CPM ENET: rcv is not first+last\n");
440#endif
441
442 /* Frame too long or too short.
443 */
444 if (bdp->cbd_sc & (BD_ENET_RX_LG | BD_ENET_RX_SH))
445 cep->stats.rx_length_errors++;
446 if (bdp->cbd_sc & BD_ENET_RX_NO) /* Frame alignment */
447 cep->stats.rx_frame_errors++;
448 if (bdp->cbd_sc & BD_ENET_RX_CR) /* CRC Error */
449 cep->stats.rx_crc_errors++;
450 if (bdp->cbd_sc & BD_ENET_RX_OV) /* FIFO overrun */
451 cep->stats.rx_crc_errors++;
452
453 /* Report late collisions as a frame error.
454 * On this error, the BD is closed, but we don't know what we
455 * have in the buffer. So, just drop this frame on the floor.
456 */
457 if (bdp->cbd_sc & BD_ENET_RX_CL) {
458 cep->stats.rx_frame_errors++;
459 }
460 else {
461
462 /* Process the incoming frame.
463 */
464 cep->stats.rx_packets++;
465 pkt_len = bdp->cbd_datlen;
466 cep->stats.rx_bytes += pkt_len;
467
468 /* This does 16 byte alignment, much more than we need.
469 * The packet length includes FCS, but we don't want to
470 * include that when passing upstream as it messes up
471 * bridging applications.
472 */
473 skb = dev_alloc_skb(pkt_len-4);
474
475 if (skb == NULL) {
476 printk("%s: Memory squeeze, dropping packet.\n", dev->name);
477 cep->stats.rx_dropped++;
478 }
479 else {
480 skb->dev = dev;
481 skb_put(skb,pkt_len-4); /* Make room */
482 eth_copy_and_sum(skb,
483 (unsigned char *)__va(bdp->cbd_bufaddr),
484 pkt_len-4, 0);
485 skb->protocol=eth_type_trans(skb,dev);
486 netif_rx(skb);
487 }
488 }
489
490 /* Clear the status flags for this buffer.
491 */
492 bdp->cbd_sc &= ~BD_ENET_RX_STATS;
493
494 /* Mark the buffer empty.
495 */
496 bdp->cbd_sc |= BD_ENET_RX_EMPTY;
497
498 /* Update BD pointer to next entry.
499 */
500 if (bdp->cbd_sc & BD_ENET_RX_WRAP)
501 bdp = cep->rx_bd_base;
502 else
503 bdp++;
504
505 }
506 cep->cur_rx = (cbd_t *)bdp;
507
508 return 0;
509}
510
511static int
512scc_enet_close(struct net_device *dev)
513{
514 /* Don't know what to do yet.
515 */
516 netif_stop_queue(dev);
517
518 return 0;
519}
520
521static struct net_device_stats *scc_enet_get_stats(struct net_device *dev)
522{
523 struct scc_enet_private *cep = (struct scc_enet_private *)dev->priv;
524
525 return &cep->stats;
526}
527
528/* Set or clear the multicast filter for this adaptor.
529 * Skeleton taken from sunlance driver.
530 * The CPM Ethernet implementation allows Multicast as well as individual
531 * MAC address filtering. Some of the drivers check to make sure it is
532 * a group multicast address, and discard those that are not. I guess I
533 * will do the same for now, but just remove the test if you want
534 * individual filtering as well (do the upper net layers want or support
535 * this kind of feature?).
536 */
537
538static void set_multicast_list(struct net_device *dev)
539{
540 struct scc_enet_private *cep;
541 struct dev_mc_list *dmi;
542 u_char *mcptr, *tdptr;
543 volatile scc_enet_t *ep;
544 int i, j;
545 cep = (struct scc_enet_private *)dev->priv;
546
547 /* Get pointer to SCC area in parameter RAM.
548 */
549 ep = (scc_enet_t *)dev->base_addr;
550
551 if (dev->flags&IFF_PROMISC) {
552
553 /* Log any net taps. */
554 printk("%s: Promiscuous mode enabled.\n", dev->name);
555 cep->sccp->scc_psmr |= SCC_PSMR_PRO;
556 } else {
557
558 cep->sccp->scc_psmr &= ~SCC_PSMR_PRO;
559
560 if (dev->flags & IFF_ALLMULTI) {
561 /* Catch all multicast addresses, so set the
562 * filter to all 1's.
563 */
564 ep->sen_gaddr1 = 0xffff;
565 ep->sen_gaddr2 = 0xffff;
566 ep->sen_gaddr3 = 0xffff;
567 ep->sen_gaddr4 = 0xffff;
568 }
569 else {
570 /* Clear filter and add the addresses in the list.
571 */
572 ep->sen_gaddr1 = 0;
573 ep->sen_gaddr2 = 0;
574 ep->sen_gaddr3 = 0;
575 ep->sen_gaddr4 = 0;
576
577 dmi = dev->mc_list;
578
579 for (i=0; i<dev->mc_count; i++) {
580
581 /* Only support group multicast for now.
582 */
583 if (!(dmi->dmi_addr[0] & 1))
584 continue;
585
586 /* The address in dmi_addr is LSB first,
587 * and taddr is MSB first. We have to
588 * copy bytes MSB first from dmi_addr.
589 */
590 mcptr = (u_char *)dmi->dmi_addr + 5;
591 tdptr = (u_char *)&ep->sen_taddrh;
592 for (j=0; j<6; j++)
593 *tdptr++ = *mcptr--;
594
595 /* Ask CPM to run CRC and set bit in
596 * filter mask.
597 */
598 cpmp->cp_cpcr = mk_cr_cmd(CPM_ENET_PAGE,
599 CPM_ENET_BLOCK, 0,
600 CPM_CR_SET_GADDR) | CPM_CR_FLG;
601 /* this delay is necessary here -- Cort */
602 udelay(10);
603 while (cpmp->cp_cpcr & CPM_CR_FLG);
604 }
605 }
606 }
607}
608
609/* Initialize the CPM Ethernet on SCC.
610 */
611static int __init scc_enet_init(void)
612{
613 struct net_device *dev;
614 struct scc_enet_private *cep;
615 int i, j, err;
616 uint dp_offset;
617 unsigned char *eap;
618 unsigned long mem_addr;
619 bd_t *bd;
620 volatile cbd_t *bdp;
621 volatile cpm_cpm2_t *cp;
622 volatile scc_t *sccp;
623 volatile scc_enet_t *ep;
624 volatile cpm2_map_t *immap;
625 volatile iop_cpm2_t *io;
626
627 cp = cpmp; /* Get pointer to Communication Processor */
628
629 immap = (cpm2_map_t *)CPM_MAP_ADDR; /* and to internal registers */
630 io = &immap->im_ioport;
631
632 bd = (bd_t *)__res;
633
634 /* Create an Ethernet device instance.
635 */
636 dev = alloc_etherdev(sizeof(*cep));
637 if (!dev)
638 return -ENOMEM;
639
640 cep = dev->priv;
641 spin_lock_init(&cep->lock);
642
643 /* Get pointer to SCC area in parameter RAM.
644 */
645 ep = (scc_enet_t *)(&immap->im_dprambase[PROFF_ENET]);
646
647 /* And another to the SCC register area.
648 */
649 sccp = (volatile scc_t *)(&immap->im_scc[SCC_ENET]);
650 cep->sccp = (scc_t *)sccp; /* Keep the pointer handy */
651
652 /* Disable receive and transmit in case someone left it running.
653 */
654 sccp->scc_gsmrl &= ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT);
655
656 /* Configure port C and D pins for SCC Ethernet. This
657 * won't work for all SCC possibilities....it will be
658 * board/port specific.
659 */
660 io->iop_pparc |=
661 (PC_ENET_RENA | PC_ENET_CLSN | PC_ENET_TXCLK | PC_ENET_RXCLK);
662 io->iop_pdirc &=
663 ~(PC_ENET_RENA | PC_ENET_CLSN | PC_ENET_TXCLK | PC_ENET_RXCLK);
664 io->iop_psorc &=
665 ~(PC_ENET_RENA | PC_ENET_TXCLK | PC_ENET_RXCLK);
666 io->iop_psorc |= PC_ENET_CLSN;
667
668 io->iop_ppard |= (PD_ENET_RXD | PD_ENET_TXD | PD_ENET_TENA);
669 io->iop_pdird |= (PD_ENET_TXD | PD_ENET_TENA);
670 io->iop_pdird &= ~PD_ENET_RXD;
671 io->iop_psord |= PD_ENET_TXD;
672 io->iop_psord &= ~(PD_ENET_RXD | PD_ENET_TENA);
673
674 /* Configure Serial Interface clock routing.
675 * First, clear all SCC bits to zero, then set the ones we want.
676 */
677 immap->im_cpmux.cmx_scr &= ~CMX_CLK_MASK;
678 immap->im_cpmux.cmx_scr |= CMX_CLK_ROUTE;
679
680 /* Allocate space for the buffer descriptors in the DP ram.
681 * These are relative offsets in the DP ram address space.
682 * Initialize base addresses for the buffer descriptors.
683 */
684 dp_offset = cpm_dpalloc(sizeof(cbd_t) * RX_RING_SIZE, 8);
685 ep->sen_genscc.scc_rbase = dp_offset;
686 cep->rx_bd_base = (cbd_t *)cpm_dpram_addr(dp_offset);
687
688 dp_offset = cpm_dpalloc(sizeof(cbd_t) * TX_RING_SIZE, 8);
689 ep->sen_genscc.scc_tbase = dp_offset;
690 cep->tx_bd_base = (cbd_t *)cpm_dpram_addr(dp_offset);
691
692 cep->dirty_tx = cep->cur_tx = cep->tx_bd_base;
693 cep->cur_rx = cep->rx_bd_base;
694
695 ep->sen_genscc.scc_rfcr = CPMFCR_GBL | CPMFCR_EB;
696 ep->sen_genscc.scc_tfcr = CPMFCR_GBL | CPMFCR_EB;
697
698 /* Set maximum bytes per receive buffer.
699 * This appears to be an Ethernet frame size, not the buffer
700 * fragment size. It must be a multiple of four.
701 */
702 ep->sen_genscc.scc_mrblr = PKT_MAXBLR_SIZE;
703
704 /* Set CRC preset and mask.
705 */
706 ep->sen_cpres = 0xffffffff;
707 ep->sen_cmask = 0xdebb20e3;
708
709 ep->sen_crcec = 0; /* CRC Error counter */
710 ep->sen_alec = 0; /* alignment error counter */
711 ep->sen_disfc = 0; /* discard frame counter */
712
713 ep->sen_pads = 0x8888; /* Tx short frame pad character */
714 ep->sen_retlim = 15; /* Retry limit threshold */
715
716 ep->sen_maxflr = PKT_MAXBUF_SIZE; /* maximum frame length register */
717 ep->sen_minflr = PKT_MINBUF_SIZE; /* minimum frame length register */
718
719 ep->sen_maxd1 = PKT_MAXBLR_SIZE; /* maximum DMA1 length */
720 ep->sen_maxd2 = PKT_MAXBLR_SIZE; /* maximum DMA2 length */
721
722 /* Clear hash tables.
723 */
724 ep->sen_gaddr1 = 0;
725 ep->sen_gaddr2 = 0;
726 ep->sen_gaddr3 = 0;
727 ep->sen_gaddr4 = 0;
728 ep->sen_iaddr1 = 0;
729 ep->sen_iaddr2 = 0;
730 ep->sen_iaddr3 = 0;
731 ep->sen_iaddr4 = 0;
732
733 /* Set Ethernet station address.
734 *
735 * This is supplied in the board information structure, so we
736 * copy that into the controller.
737 */
738 eap = (unsigned char *)&(ep->sen_paddrh);
739 for (i=5; i>=0; i--)
740 *eap++ = dev->dev_addr[i] = bd->bi_enetaddr[i];
741
742 ep->sen_pper = 0; /* 'cause the book says so */
743 ep->sen_taddrl = 0; /* temp address (LSB) */
744 ep->sen_taddrm = 0;
745 ep->sen_taddrh = 0; /* temp address (MSB) */
746
747 /* Now allocate the host memory pages and initialize the
748 * buffer descriptors.
749 */
750 bdp = cep->tx_bd_base;
751 for (i=0; i<TX_RING_SIZE; i++) {
752
753 /* Initialize the BD for every fragment in the page.
754 */
755 bdp->cbd_sc = 0;
756 bdp->cbd_bufaddr = 0;
757 bdp++;
758 }
759
760 /* Set the last buffer to wrap.
761 */
762 bdp--;
763 bdp->cbd_sc |= BD_SC_WRAP;
764
765 bdp = cep->rx_bd_base;
766 for (i=0; i<CPM_ENET_RX_PAGES; i++) {
767
768 /* Allocate a page.
769 */
770 mem_addr = __get_free_page(GFP_KERNEL);
771 /* BUG: no check for failure */
772
773 /* Initialize the BD for every fragment in the page.
774 */
775 for (j=0; j<CPM_ENET_RX_FRPPG; j++) {
776 bdp->cbd_sc = BD_ENET_RX_EMPTY | BD_ENET_RX_INTR;
777 bdp->cbd_bufaddr = __pa(mem_addr);
778 mem_addr += CPM_ENET_RX_FRSIZE;
779 bdp++;
780 }
781 }
782
783 /* Set the last buffer to wrap.
784 */
785 bdp--;
786 bdp->cbd_sc |= BD_SC_WRAP;
787
788 /* Let's re-initialize the channel now. We have to do it later
789 * than the manual describes because we have just now finished
790 * the BD initialization.
791 */
792 cpmp->cp_cpcr = mk_cr_cmd(CPM_ENET_PAGE, CPM_ENET_BLOCK, 0,
793 CPM_CR_INIT_TRX) | CPM_CR_FLG;
794 while (cp->cp_cpcr & CPM_CR_FLG);
795
796 cep->skb_cur = cep->skb_dirty = 0;
797
798 sccp->scc_scce = 0xffff; /* Clear any pending events */
799
800 /* Enable interrupts for transmit error, complete frame
801 * received, and any transmit buffer we have also set the
802 * interrupt flag.
803 */
804 sccp->scc_sccm = (SCCE_ENET_TXE | SCCE_ENET_RXF | SCCE_ENET_TXB);
805
806 /* Install our interrupt handler.
807 */
808 request_irq(SIU_INT_ENET, scc_enet_interrupt, 0, "enet", dev);
809 /* BUG: no check for failure */
810
811 /* Set GSMR_H to enable all normal operating modes.
812 * Set GSMR_L to enable Ethernet to MC68160.
813 */
814 sccp->scc_gsmrh = 0;
815 sccp->scc_gsmrl = (SCC_GSMRL_TCI | SCC_GSMRL_TPL_48 | SCC_GSMRL_TPP_10 | SCC_GSMRL_MODE_ENET);
816
817 /* Set sync/delimiters.
818 */
819 sccp->scc_dsr = 0xd555;
820
821 /* Set processing mode. Use Ethernet CRC, catch broadcast, and
822 * start frame search 22 bit times after RENA.
823 */
824 sccp->scc_psmr = (SCC_PSMR_ENCRC | SCC_PSMR_NIB22);
825
826 /* It is now OK to enable the Ethernet transmitter.
827 * Unfortunately, there are board implementation differences here.
828 */
829 io->iop_pparc &= ~(PC_EST8260_ENET_LOOPBACK |
830 PC_EST8260_ENET_SQE | PC_EST8260_ENET_NOTFD);
831 io->iop_psorc &= ~(PC_EST8260_ENET_LOOPBACK |
832 PC_EST8260_ENET_SQE | PC_EST8260_ENET_NOTFD);
833 io->iop_pdirc |= (PC_EST8260_ENET_LOOPBACK |
834 PC_EST8260_ENET_SQE | PC_EST8260_ENET_NOTFD);
835 io->iop_pdatc &= ~(PC_EST8260_ENET_LOOPBACK | PC_EST8260_ENET_SQE);
836 io->iop_pdatc |= PC_EST8260_ENET_NOTFD;
837
838 dev->base_addr = (unsigned long)ep;
839
840 /* The CPM Ethernet specific entries in the device structure. */
841 dev->open = scc_enet_open;
842 dev->hard_start_xmit = scc_enet_start_xmit;
843 dev->tx_timeout = scc_enet_timeout;
844 dev->watchdog_timeo = TX_TIMEOUT;
845 dev->stop = scc_enet_close;
846 dev->get_stats = scc_enet_get_stats;
847 dev->set_multicast_list = set_multicast_list;
848
849 /* And last, enable the transmit and receive processing.
850 */
851 sccp->scc_gsmrl |= (SCC_GSMRL_ENR | SCC_GSMRL_ENT);
852
853 err = register_netdev(dev);
854 if (err) {
855 free_netdev(dev);
856 return err;
857 }
858
859 printk("%s: SCC ENET Version 0.1, ", dev->name);
860 for (i=0; i<5; i++)
861 printk("%02x:", dev->dev_addr[i]);
862 printk("%02x\n", dev->dev_addr[5]);
863
864 return 0;
865}
866
867module_init(scc_enet_init);
diff --git a/arch/ppc/8260_io/fcc_enet.c b/arch/ppc/8260_io/fcc_enet.c
new file mode 100644
index 000000000000..2086c6ad1147
--- /dev/null
+++ b/arch/ppc/8260_io/fcc_enet.c
@@ -0,0 +1,2395 @@
1/*
2 * Fast Ethernet Controller (FCC) driver for Motorola MPC8260.
3 * Copyright (c) 2000 MontaVista Software, Inc. Dan Malek (dmalek@jlc.net)
4 *
5 * This version of the driver is a combination of the 8xx fec and
6 * 8260 SCC Ethernet drivers. This version has some additional
7 * configuration options, which should probably be moved out of
8 * here. This driver currently works for the EST SBC8260,
9 * SBS Diablo/BCM, Embedded Planet RPX6, TQM8260, and others.
10 *
11 * Right now, I am very watseful with the buffers. I allocate memory
12 * pages and then divide them into 2K frame buffers. This way I know I
13 * have buffers large enough to hold one frame within one buffer descriptor.
14 * Once I get this working, I will use 64 or 128 byte CPM buffers, which
15 * will be much more memory efficient and will easily handle lots of
16 * small packets. Since this is a cache coherent processor and CPM,
17 * I could also preallocate SKB's and use them directly on the interface.
18 *
19 * 2004-12 Leo Li (leoli@freescale.com)
20 * - Rework the FCC clock configuration part, make it easier to configure.
21 *
22 */
23
24#include <linux/config.h>
25#include <linux/kernel.h>
26#include <linux/sched.h>
27#include <linux/string.h>
28#include <linux/ptrace.h>
29#include <linux/errno.h>
30#include <linux/ioport.h>
31#include <linux/slab.h>
32#include <linux/interrupt.h>
33#include <linux/pci.h>
34#include <linux/init.h>
35#include <linux/delay.h>
36#include <linux/netdevice.h>
37#include <linux/etherdevice.h>
38#include <linux/skbuff.h>
39#include <linux/spinlock.h>
40#include <linux/mii.h>
41#include <linux/workqueue.h>
42#include <linux/bitops.h>
43
44#include <asm/immap_cpm2.h>
45#include <asm/pgtable.h>
46#include <asm/mpc8260.h>
47#include <asm/irq.h>
48#include <asm/uaccess.h>
49#include <asm/signal.h>
50
51/* We can't use the PHY interrupt if we aren't using MDIO. */
52#if !defined(CONFIG_USE_MDIO)
53#undef PHY_INTERRUPT
54#endif
55
56/* If we have a PHY interrupt, we will advertise both full-duplex and half-
57 * duplex capabilities. If we don't have a PHY interrupt, then we will only
58 * advertise half-duplex capabilities.
59 */
60#define MII_ADVERTISE_HALF (ADVERTISE_100HALF | ADVERTISE_10HALF | \
61 ADVERTISE_CSMA)
62#define MII_ADVERTISE_ALL (ADVERTISE_100FULL | ADVERTISE_10FULL | \
63 MII_ADVERTISE_HALF)
64#ifdef PHY_INTERRUPT
65#define MII_ADVERTISE_DEFAULT MII_ADVERTISE_ALL
66#else
67#define MII_ADVERTISE_DEFAULT MII_ADVERTISE_HALF
68#endif
69#include <asm/cpm2.h>
70
71/* The transmitter timeout
72 */
73#define TX_TIMEOUT (2*HZ)
74
75#ifdef CONFIG_USE_MDIO
76/* Forward declarations of some structures to support different PHYs */
77
78typedef struct {
79 uint mii_data;
80 void (*funct)(uint mii_reg, struct net_device *dev);
81} phy_cmd_t;
82
83typedef struct {
84 uint id;
85 char *name;
86
87 const phy_cmd_t *config;
88 const phy_cmd_t *startup;
89 const phy_cmd_t *ack_int;
90 const phy_cmd_t *shutdown;
91} phy_info_t;
92
93/* values for phy_status */
94
95#define PHY_CONF_ANE 0x0001 /* 1 auto-negotiation enabled */
96#define PHY_CONF_LOOP 0x0002 /* 1 loopback mode enabled */
97#define PHY_CONF_SPMASK 0x00f0 /* mask for speed */
98#define PHY_CONF_10HDX 0x0010 /* 10 Mbit half duplex supported */
99#define PHY_CONF_10FDX 0x0020 /* 10 Mbit full duplex supported */
100#define PHY_CONF_100HDX 0x0040 /* 100 Mbit half duplex supported */
101#define PHY_CONF_100FDX 0x0080 /* 100 Mbit full duplex supported */
102
103#define PHY_STAT_LINK 0x0100 /* 1 up - 0 down */
104#define PHY_STAT_FAULT 0x0200 /* 1 remote fault */
105#define PHY_STAT_ANC 0x0400 /* 1 auto-negotiation complete */
106#define PHY_STAT_SPMASK 0xf000 /* mask for speed */
107#define PHY_STAT_10HDX 0x1000 /* 10 Mbit half duplex selected */
108#define PHY_STAT_10FDX 0x2000 /* 10 Mbit full duplex selected */
109#define PHY_STAT_100HDX 0x4000 /* 100 Mbit half duplex selected */
110#define PHY_STAT_100FDX 0x8000 /* 100 Mbit full duplex selected */
111#endif /* CONFIG_USE_MDIO */
112
113/* The number of Tx and Rx buffers. These are allocated from the page
114 * pool. The code may assume these are power of two, so it is best
115 * to keep them that size.
116 * We don't need to allocate pages for the transmitter. We just use
117 * the skbuffer directly.
118 */
119#define FCC_ENET_RX_PAGES 16
120#define FCC_ENET_RX_FRSIZE 2048
121#define FCC_ENET_RX_FRPPG (PAGE_SIZE / FCC_ENET_RX_FRSIZE)
122#define RX_RING_SIZE (FCC_ENET_RX_FRPPG * FCC_ENET_RX_PAGES)
123#define TX_RING_SIZE 16 /* Must be power of two */
124#define TX_RING_MOD_MASK 15 /* for this to work */
125
126/* The FCC stores dest/src/type, data, and checksum for receive packets.
127 * size includes support for VLAN
128 */
129#define PKT_MAXBUF_SIZE 1522
130#define PKT_MINBUF_SIZE 64
131
132/* Maximum input DMA size. Must be a should(?) be a multiple of 4.
133 * size includes support for VLAN
134 */
135#define PKT_MAXDMA_SIZE 1524
136
137/* Maximum input buffer size. Must be a multiple of 32.
138*/
139#define PKT_MAXBLR_SIZE 1536
140
141static int fcc_enet_open(struct net_device *dev);
142static int fcc_enet_start_xmit(struct sk_buff *skb, struct net_device *dev);
143static int fcc_enet_rx(struct net_device *dev);
144static irqreturn_t fcc_enet_interrupt(int irq, void *dev_id, struct pt_regs *);
145static int fcc_enet_close(struct net_device *dev);
146static struct net_device_stats *fcc_enet_get_stats(struct net_device *dev);
147/* static void set_multicast_list(struct net_device *dev); */
148static void fcc_restart(struct net_device *dev, int duplex);
149static void fcc_stop(struct net_device *dev);
150static int fcc_enet_set_mac_address(struct net_device *dev, void *addr);
151
152/* These will be configurable for the FCC choice.
153 * Multiple ports can be configured. There is little choice among the
154 * I/O pins to the PHY, except the clocks. We will need some board
155 * dependent clock selection.
156 * Why in the hell did I put these inside #ifdef's? I dunno, maybe to
157 * help show what pins are used for each device.
158 */
159
160/* Since the CLK setting changes greatly from board to board, I changed
161 * it to a easy way. You just need to specify which CLK number to use.
162 * Note that only limited choices can be make on each port.
163 */
164
165/* FCC1 Clock Source Configuration. There are board specific.
166 Can only choose from CLK9-12 */
167#ifdef CONFIG_SBC82xx
168#define F1_RXCLK 9
169#define F1_TXCLK 10
170#elif defined(CONFIG_ADS8272)
171#define F1_RXCLK 11
172#define F1_TXCLK 10
173#else
174#define F1_RXCLK 12
175#define F1_TXCLK 11
176#endif
177
178/* FCC2 Clock Source Configuration. There are board specific.
179 Can only choose from CLK13-16 */
180#ifdef CONFIG_ADS8272
181#define F2_RXCLK 15
182#define F2_TXCLK 16
183#else
184#define F2_RXCLK 13
185#define F2_TXCLK 14
186#endif
187
188/* FCC3 Clock Source Configuration. There are board specific.
189 Can only choose from CLK13-16 */
190#define F3_RXCLK 15
191#define F3_TXCLK 16
192
193/* Automatically generates register configurations */
194#define PC_CLK(x) ((uint)(1<<(x-1))) /* FCC CLK I/O ports */
195
196#define CMXFCR_RF1CS(x) ((uint)((x-5)<<27)) /* FCC1 Receive Clock Source */
197#define CMXFCR_TF1CS(x) ((uint)((x-5)<<24)) /* FCC1 Transmit Clock Source */
198#define CMXFCR_RF2CS(x) ((uint)((x-9)<<19)) /* FCC2 Receive Clock Source */
199#define CMXFCR_TF2CS(x) ((uint)((x-9)<<16)) /* FCC2 Transmit Clock Source */
200#define CMXFCR_RF3CS(x) ((uint)((x-9)<<11)) /* FCC3 Receive Clock Source */
201#define CMXFCR_TF3CS(x) ((uint)((x-9)<<8)) /* FCC3 Transmit Clock Source */
202
203#define PC_F1RXCLK PC_CLK(F1_RXCLK)
204#define PC_F1TXCLK PC_CLK(F1_TXCLK)
205#define CMX1_CLK_ROUTE (CMXFCR_RF1CS(F1_RXCLK) | CMXFCR_TF1CS(F1_TXCLK))
206#define CMX1_CLK_MASK ((uint)0xff000000)
207
208#define PC_F2RXCLK PC_CLK(F2_RXCLK)
209#define PC_F2TXCLK PC_CLK(F2_TXCLK)
210#define CMX2_CLK_ROUTE (CMXFCR_RF2CS(F2_RXCLK) | CMXFCR_TF2CS(F2_TXCLK))
211#define CMX2_CLK_MASK ((uint)0x00ff0000)
212
213#define PC_F3RXCLK PC_CLK(F3_RXCLK)
214#define PC_F3TXCLK PC_CLK(F3_TXCLK)
215#define CMX3_CLK_ROUTE (CMXFCR_RF3CS(F3_RXCLK) | CMXFCR_TF3CS(F3_TXCLK))
216#define CMX3_CLK_MASK ((uint)0x0000ff00)
217
218
219/* I/O Pin assignment for FCC1. I don't yet know the best way to do this,
220 * but there is little variation among the choices.
221 */
222#define PA1_COL ((uint)0x00000001)
223#define PA1_CRS ((uint)0x00000002)
224#define PA1_TXER ((uint)0x00000004)
225#define PA1_TXEN ((uint)0x00000008)
226#define PA1_RXDV ((uint)0x00000010)
227#define PA1_RXER ((uint)0x00000020)
228#define PA1_TXDAT ((uint)0x00003c00)
229#define PA1_RXDAT ((uint)0x0003c000)
230#define PA1_PSORA_BOUT (PA1_RXDAT | PA1_TXDAT)
231#define PA1_PSORA_BIN (PA1_COL | PA1_CRS | PA1_TXER | PA1_TXEN | \
232 PA1_RXDV | PA1_RXER)
233#define PA1_DIRA_BOUT (PA1_RXDAT | PA1_CRS | PA1_COL | PA1_RXER | PA1_RXDV)
234#define PA1_DIRA_BIN (PA1_TXDAT | PA1_TXEN | PA1_TXER)
235
236
237/* I/O Pin assignment for FCC2. I don't yet know the best way to do this,
238 * but there is little variation among the choices.
239 */
240#define PB2_TXER ((uint)0x00000001)
241#define PB2_RXDV ((uint)0x00000002)
242#define PB2_TXEN ((uint)0x00000004)
243#define PB2_RXER ((uint)0x00000008)
244#define PB2_COL ((uint)0x00000010)
245#define PB2_CRS ((uint)0x00000020)
246#define PB2_TXDAT ((uint)0x000003c0)
247#define PB2_RXDAT ((uint)0x00003c00)
248#define PB2_PSORB_BOUT (PB2_RXDAT | PB2_TXDAT | PB2_CRS | PB2_COL | \
249 PB2_RXER | PB2_RXDV | PB2_TXER)
250#define PB2_PSORB_BIN (PB2_TXEN)
251#define PB2_DIRB_BOUT (PB2_RXDAT | PB2_CRS | PB2_COL | PB2_RXER | PB2_RXDV)
252#define PB2_DIRB_BIN (PB2_TXDAT | PB2_TXEN | PB2_TXER)
253
254
255/* I/O Pin assignment for FCC3. I don't yet know the best way to do this,
256 * but there is little variation among the choices.
257 */
258#define PB3_RXDV ((uint)0x00004000)
259#define PB3_RXER ((uint)0x00008000)
260#define PB3_TXER ((uint)0x00010000)
261#define PB3_TXEN ((uint)0x00020000)
262#define PB3_COL ((uint)0x00040000)
263#define PB3_CRS ((uint)0x00080000)
264#ifndef CONFIG_RPX8260
265#define PB3_TXDAT ((uint)0x0f000000)
266#define PC3_TXDAT ((uint)0x00000000)
267#else
268#define PB3_TXDAT ((uint)0x0f000000)
269#define PC3_TXDAT 0
270#endif
271#define PB3_RXDAT ((uint)0x00f00000)
272#define PB3_PSORB_BOUT (PB3_RXDAT | PB3_TXDAT | PB3_CRS | PB3_COL | \
273 PB3_RXER | PB3_RXDV | PB3_TXER | PB3_TXEN)
274#define PB3_PSORB_BIN (0)
275#define PB3_DIRB_BOUT (PB3_RXDAT | PB3_CRS | PB3_COL | PB3_RXER | PB3_RXDV)
276#define PB3_DIRB_BIN (PB3_TXDAT | PB3_TXEN | PB3_TXER)
277
278#define PC3_PSORC_BOUT (PC3_TXDAT)
279#define PC3_PSORC_BIN (0)
280#define PC3_DIRC_BOUT (0)
281#define PC3_DIRC_BIN (PC3_TXDAT)
282
283
284/* MII status/control serial interface.
285*/
286#if defined(CONFIG_RPX8260)
287/* The EP8260 doesn't use Port C for MDIO */
288#define PC_MDIO ((uint)0x00000000)
289#define PC_MDCK ((uint)0x00000000)
290#elif defined(CONFIG_TQM8260)
291/* TQM8260 has MDIO and MDCK on PC30 and PC31 respectively */
292#define PC_MDIO ((uint)0x00000002)
293#define PC_MDCK ((uint)0x00000001)
294#elif defined(CONFIG_ADS8272)
295#define PC_MDIO ((uint)0x00002000)
296#define PC_MDCK ((uint)0x00001000)
297#elif defined(CONFIG_EST8260) || defined(CONFIG_ADS8260) || defined(CONFIG_PQ2FADS)
298#define PC_MDIO ((uint)0x00400000)
299#define PC_MDCK ((uint)0x00200000)
300#else
301#define PC_MDIO ((uint)0x00000004)
302#define PC_MDCK ((uint)0x00000020)
303#endif
304
305#if defined(CONFIG_USE_MDIO) && (!defined(PC_MDIO) || !defined(PC_MDCK))
306#error "Must define PC_MDIO and PC_MDCK if using MDIO"
307#endif
308
309/* PHY addresses */
310/* default to dynamic config of phy addresses */
311#define FCC1_PHY_ADDR 0
312#ifdef CONFIG_PQ2FADS
313#define FCC2_PHY_ADDR 0
314#else
315#define FCC2_PHY_ADDR 2
316#endif
317#define FCC3_PHY_ADDR 3
318
319/* A table of information for supporting FCCs. This does two things.
320 * First, we know how many FCCs we have and they are always externally
321 * numbered from zero. Second, it holds control register and I/O
322 * information that could be different among board designs.
323 */
324typedef struct fcc_info {
325 uint fc_fccnum;
326 uint fc_phyaddr;
327 uint fc_cpmblock;
328 uint fc_cpmpage;
329 uint fc_proff;
330 uint fc_interrupt;
331 uint fc_trxclocks;
332 uint fc_clockroute;
333 uint fc_clockmask;
334 uint fc_mdio;
335 uint fc_mdck;
336} fcc_info_t;
337
338static fcc_info_t fcc_ports[] = {
339#ifdef CONFIG_FCC1_ENET
340 { 0, FCC1_PHY_ADDR, CPM_CR_FCC1_SBLOCK, CPM_CR_FCC1_PAGE, PROFF_FCC1, SIU_INT_FCC1,
341 (PC_F1RXCLK | PC_F1TXCLK), CMX1_CLK_ROUTE, CMX1_CLK_MASK,
342 PC_MDIO, PC_MDCK },
343#endif
344#ifdef CONFIG_FCC2_ENET
345 { 1, FCC2_PHY_ADDR, CPM_CR_FCC2_SBLOCK, CPM_CR_FCC2_PAGE, PROFF_FCC2, SIU_INT_FCC2,
346 (PC_F2RXCLK | PC_F2TXCLK), CMX2_CLK_ROUTE, CMX2_CLK_MASK,
347 PC_MDIO, PC_MDCK },
348#endif
349#ifdef CONFIG_FCC3_ENET
350 { 2, FCC3_PHY_ADDR, CPM_CR_FCC3_SBLOCK, CPM_CR_FCC3_PAGE, PROFF_FCC3, SIU_INT_FCC3,
351 (PC_F3RXCLK | PC_F3TXCLK), CMX3_CLK_ROUTE, CMX3_CLK_MASK,
352 PC_MDIO, PC_MDCK },
353#endif
354};
355
356/* The FCC buffer descriptors track the ring buffers. The rx_bd_base and
357 * tx_bd_base always point to the base of the buffer descriptors. The
358 * cur_rx and cur_tx point to the currently available buffer.
359 * The dirty_tx tracks the current buffer that is being sent by the
360 * controller. The cur_tx and dirty_tx are equal under both completely
361 * empty and completely full conditions. The empty/ready indicator in
362 * the buffer descriptor determines the actual condition.
363 */
364struct fcc_enet_private {
365 /* The saved address of a sent-in-place packet/buffer, for skfree(). */
366 struct sk_buff* tx_skbuff[TX_RING_SIZE];
367 ushort skb_cur;
368 ushort skb_dirty;
369
370 /* CPM dual port RAM relative addresses.
371 */
372 cbd_t *rx_bd_base; /* Address of Rx and Tx buffers. */
373 cbd_t *tx_bd_base;
374 cbd_t *cur_rx, *cur_tx; /* The next free ring entry */
375 cbd_t *dirty_tx; /* The ring entries to be free()ed. */
376 volatile fcc_t *fccp;
377 volatile fcc_enet_t *ep;
378 struct net_device_stats stats;
379 uint tx_free;
380 spinlock_t lock;
381
382#ifdef CONFIG_USE_MDIO
383 uint phy_id;
384 uint phy_id_done;
385 uint phy_status;
386 phy_info_t *phy;
387 struct work_struct phy_relink;
388 struct work_struct phy_display_config;
389
390 uint sequence_done;
391
392 uint phy_addr;
393#endif /* CONFIG_USE_MDIO */
394
395 int link;
396 int old_link;
397 int full_duplex;
398
399 fcc_info_t *fip;
400};
401
402static void init_fcc_shutdown(fcc_info_t *fip, struct fcc_enet_private *cep,
403 volatile cpm2_map_t *immap);
404static void init_fcc_startup(fcc_info_t *fip, struct net_device *dev);
405static void init_fcc_ioports(fcc_info_t *fip, volatile iop_cpm2_t *io,
406 volatile cpm2_map_t *immap);
407static void init_fcc_param(fcc_info_t *fip, struct net_device *dev,
408 volatile cpm2_map_t *immap);
409
410#ifdef CONFIG_USE_MDIO
411static int mii_queue(struct net_device *dev, int request, void (*func)(uint, struct net_device *));
412static uint mii_send_receive(fcc_info_t *fip, uint cmd);
413static void mii_do_cmd(struct net_device *dev, const phy_cmd_t *c);
414
415/* Make MII read/write commands for the FCC.
416*/
417#define mk_mii_read(REG) (0x60020000 | (((REG) & 0x1f) << 18))
418#define mk_mii_write(REG, VAL) (0x50020000 | (((REG) & 0x1f) << 18) | \
419 ((VAL) & 0xffff))
420#define mk_mii_end 0
421#endif /* CONFIG_USE_MDIO */
422
423
424static int
425fcc_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
426{
427 struct fcc_enet_private *cep = (struct fcc_enet_private *)dev->priv;
428 volatile cbd_t *bdp;
429
430 /* Fill in a Tx ring entry */
431 bdp = cep->cur_tx;
432
433#ifndef final_version
434 if (!cep->tx_free || (bdp->cbd_sc & BD_ENET_TX_READY)) {
435 /* Ooops. All transmit buffers are full. Bail out.
436 * This should not happen, since the tx queue should be stopped.
437 */
438 printk("%s: tx queue full!.\n", dev->name);
439 return 1;
440 }
441#endif
442
443 /* Clear all of the status flags. */
444 bdp->cbd_sc &= ~BD_ENET_TX_STATS;
445
446 /* If the frame is short, tell CPM to pad it. */
447 if (skb->len <= ETH_ZLEN)
448 bdp->cbd_sc |= BD_ENET_TX_PAD;
449 else
450 bdp->cbd_sc &= ~BD_ENET_TX_PAD;
451
452 /* Set buffer length and buffer pointer. */
453 bdp->cbd_datlen = skb->len;
454 bdp->cbd_bufaddr = __pa(skb->data);
455
456 spin_lock_irq(&cep->lock);
457
458 /* Save skb pointer. */
459 cep->tx_skbuff[cep->skb_cur] = skb;
460
461 cep->stats.tx_bytes += skb->len;
462 cep->skb_cur = (cep->skb_cur+1) & TX_RING_MOD_MASK;
463
464 /* Send it on its way. Tell CPM its ready, interrupt when done,
465 * its the last BD of the frame, and to put the CRC on the end.
466 */
467 bdp->cbd_sc |= (BD_ENET_TX_READY | BD_ENET_TX_INTR | BD_ENET_TX_LAST | BD_ENET_TX_TC);
468
469#if 0
470 /* Errata says don't do this. */
471 cep->fccp->fcc_ftodr = 0x8000;
472#endif
473 dev->trans_start = jiffies;
474
475 /* If this was the last BD in the ring, start at the beginning again. */
476 if (bdp->cbd_sc & BD_ENET_TX_WRAP)
477 bdp = cep->tx_bd_base;
478 else
479 bdp++;
480
481 if (!--cep->tx_free)
482 netif_stop_queue(dev);
483
484 cep->cur_tx = (cbd_t *)bdp;
485
486 spin_unlock_irq(&cep->lock);
487
488 return 0;
489}
490
491
492static void
493fcc_enet_timeout(struct net_device *dev)
494{
495 struct fcc_enet_private *cep = (struct fcc_enet_private *)dev->priv;
496
497 printk("%s: transmit timed out.\n", dev->name);
498 cep->stats.tx_errors++;
499#ifndef final_version
500 {
501 int i;
502 cbd_t *bdp;
503 printk(" Ring data dump: cur_tx %p tx_free %d cur_rx %p.\n",
504 cep->cur_tx, cep->tx_free,
505 cep->cur_rx);
506 bdp = cep->tx_bd_base;
507 printk(" Tx @base %p :\n", bdp);
508 for (i = 0 ; i < TX_RING_SIZE; i++, bdp++)
509 printk("%04x %04x %08x\n",
510 bdp->cbd_sc,
511 bdp->cbd_datlen,
512 bdp->cbd_bufaddr);
513 bdp = cep->rx_bd_base;
514 printk(" Rx @base %p :\n", bdp);
515 for (i = 0 ; i < RX_RING_SIZE; i++, bdp++)
516 printk("%04x %04x %08x\n",
517 bdp->cbd_sc,
518 bdp->cbd_datlen,
519 bdp->cbd_bufaddr);
520 }
521#endif
522 if (cep->tx_free)
523 netif_wake_queue(dev);
524}
525
526/* The interrupt handler. */
527static irqreturn_t
528fcc_enet_interrupt(int irq, void * dev_id, struct pt_regs * regs)
529{
530 struct net_device *dev = dev_id;
531 volatile struct fcc_enet_private *cep;
532 volatile cbd_t *bdp;
533 ushort int_events;
534 int must_restart;
535
536 cep = (struct fcc_enet_private *)dev->priv;
537
538 /* Get the interrupt events that caused us to be here.
539 */
540 int_events = cep->fccp->fcc_fcce;
541 cep->fccp->fcc_fcce = (int_events & cep->fccp->fcc_fccm);
542 must_restart = 0;
543
544#ifdef PHY_INTERRUPT
545 /* We have to be careful here to make sure that we aren't
546 * interrupted by a PHY interrupt.
547 */
548 disable_irq_nosync(PHY_INTERRUPT);
549#endif
550
551 /* Handle receive event in its own function.
552 */
553 if (int_events & FCC_ENET_RXF)
554 fcc_enet_rx(dev_id);
555
556 /* Check for a transmit error. The manual is a little unclear
557 * about this, so the debug code until I get it figured out. It
558 * appears that if TXE is set, then TXB is not set. However,
559 * if carrier sense is lost during frame transmission, the TXE
560 * bit is set, "and continues the buffer transmission normally."
561 * I don't know if "normally" implies TXB is set when the buffer
562 * descriptor is closed.....trial and error :-).
563 */
564
565 /* Transmit OK, or non-fatal error. Update the buffer descriptors.
566 */
567 if (int_events & (FCC_ENET_TXE | FCC_ENET_TXB)) {
568 spin_lock(&cep->lock);
569 bdp = cep->dirty_tx;
570 while ((bdp->cbd_sc&BD_ENET_TX_READY)==0) {
571 if (cep->tx_free == TX_RING_SIZE)
572 break;
573
574 if (bdp->cbd_sc & BD_ENET_TX_HB) /* No heartbeat */
575 cep->stats.tx_heartbeat_errors++;
576 if (bdp->cbd_sc & BD_ENET_TX_LC) /* Late collision */
577 cep->stats.tx_window_errors++;
578 if (bdp->cbd_sc & BD_ENET_TX_RL) /* Retrans limit */
579 cep->stats.tx_aborted_errors++;
580 if (bdp->cbd_sc & BD_ENET_TX_UN) /* Underrun */
581 cep->stats.tx_fifo_errors++;
582 if (bdp->cbd_sc & BD_ENET_TX_CSL) /* Carrier lost */
583 cep->stats.tx_carrier_errors++;
584
585
586 /* No heartbeat or Lost carrier are not really bad errors.
587 * The others require a restart transmit command.
588 */
589 if (bdp->cbd_sc &
590 (BD_ENET_TX_LC | BD_ENET_TX_RL | BD_ENET_TX_UN)) {
591 must_restart = 1;
592 cep->stats.tx_errors++;
593 }
594
595 cep->stats.tx_packets++;
596
597 /* Deferred means some collisions occurred during transmit,
598 * but we eventually sent the packet OK.
599 */
600 if (bdp->cbd_sc & BD_ENET_TX_DEF)
601 cep->stats.collisions++;
602
603 /* Free the sk buffer associated with this last transmit. */
604 dev_kfree_skb_irq(cep->tx_skbuff[cep->skb_dirty]);
605 cep->tx_skbuff[cep->skb_dirty] = NULL;
606 cep->skb_dirty = (cep->skb_dirty + 1) & TX_RING_MOD_MASK;
607
608 /* Update pointer to next buffer descriptor to be transmitted. */
609 if (bdp->cbd_sc & BD_ENET_TX_WRAP)
610 bdp = cep->tx_bd_base;
611 else
612 bdp++;
613
614 /* I don't know if we can be held off from processing these
615 * interrupts for more than one frame time. I really hope
616 * not. In such a case, we would now want to check the
617 * currently available BD (cur_tx) and determine if any
618 * buffers between the dirty_tx and cur_tx have also been
619 * sent. We would want to process anything in between that
620 * does not have BD_ENET_TX_READY set.
621 */
622
623 /* Since we have freed up a buffer, the ring is no longer
624 * full.
625 */
626 if (!cep->tx_free++) {
627 if (netif_queue_stopped(dev)) {
628 netif_wake_queue(dev);
629 }
630 }
631
632 cep->dirty_tx = (cbd_t *)bdp;
633 }
634
635 if (must_restart) {
636 volatile cpm_cpm2_t *cp;
637
638 /* Some transmit errors cause the transmitter to shut
639 * down. We now issue a restart transmit. Since the
640 * errors close the BD and update the pointers, the restart
641 * _should_ pick up without having to reset any of our
642 * pointers either. Also, To workaround 8260 device erratum
643 * CPM37, we must disable and then re-enable the transmitter
644 * following a Late Collision, Underrun, or Retry Limit error.
645 */
646 cep->fccp->fcc_gfmr &= ~FCC_GFMR_ENT;
647 udelay(10); /* wait a few microseconds just on principle */
648 cep->fccp->fcc_gfmr |= FCC_GFMR_ENT;
649
650 cp = cpmp;
651 cp->cp_cpcr =
652 mk_cr_cmd(cep->fip->fc_cpmpage, cep->fip->fc_cpmblock,
653 0x0c, CPM_CR_RESTART_TX) | CPM_CR_FLG;
654 while (cp->cp_cpcr & CPM_CR_FLG);
655 }
656 spin_unlock(&cep->lock);
657 }
658
659 /* Check for receive busy, i.e. packets coming but no place to
660 * put them.
661 */
662 if (int_events & FCC_ENET_BSY) {
663 cep->fccp->fcc_fcce = FCC_ENET_BSY;
664 cep->stats.rx_dropped++;
665 }
666
667#ifdef PHY_INTERRUPT
668 enable_irq(PHY_INTERRUPT);
669#endif
670 return IRQ_HANDLED;
671}
672
673/* During a receive, the cur_rx points to the current incoming buffer.
674 * When we update through the ring, if the next incoming buffer has
675 * not been given to the system, we just set the empty indicator,
676 * effectively tossing the packet.
677 */
678static int
679fcc_enet_rx(struct net_device *dev)
680{
681 struct fcc_enet_private *cep;
682 volatile cbd_t *bdp;
683 struct sk_buff *skb;
684 ushort pkt_len;
685
686 cep = (struct fcc_enet_private *)dev->priv;
687
688 /* First, grab all of the stats for the incoming packet.
689 * These get messed up if we get called due to a busy condition.
690 */
691 bdp = cep->cur_rx;
692
693for (;;) {
694 if (bdp->cbd_sc & BD_ENET_RX_EMPTY)
695 break;
696
697#ifndef final_version
698 /* Since we have allocated space to hold a complete frame, both
699 * the first and last indicators should be set.
700 */
701 if ((bdp->cbd_sc & (BD_ENET_RX_FIRST | BD_ENET_RX_LAST)) !=
702 (BD_ENET_RX_FIRST | BD_ENET_RX_LAST))
703 printk("CPM ENET: rcv is not first+last\n");
704#endif
705
706 /* Frame too long or too short. */
707 if (bdp->cbd_sc & (BD_ENET_RX_LG | BD_ENET_RX_SH))
708 cep->stats.rx_length_errors++;
709 if (bdp->cbd_sc & BD_ENET_RX_NO) /* Frame alignment */
710 cep->stats.rx_frame_errors++;
711 if (bdp->cbd_sc & BD_ENET_RX_CR) /* CRC Error */
712 cep->stats.rx_crc_errors++;
713 if (bdp->cbd_sc & BD_ENET_RX_OV) /* FIFO overrun */
714 cep->stats.rx_crc_errors++;
715 if (bdp->cbd_sc & BD_ENET_RX_CL) /* Late Collision */
716 cep->stats.rx_frame_errors++;
717
718 if (!(bdp->cbd_sc &
719 (BD_ENET_RX_LG | BD_ENET_RX_SH | BD_ENET_RX_NO | BD_ENET_RX_CR
720 | BD_ENET_RX_OV | BD_ENET_RX_CL)))
721 {
722 /* Process the incoming frame. */
723 cep->stats.rx_packets++;
724
725 /* Remove the FCS from the packet length. */
726 pkt_len = bdp->cbd_datlen - 4;
727 cep->stats.rx_bytes += pkt_len;
728
729 /* This does 16 byte alignment, much more than we need. */
730 skb = dev_alloc_skb(pkt_len);
731
732 if (skb == NULL) {
733 printk("%s: Memory squeeze, dropping packet.\n", dev->name);
734 cep->stats.rx_dropped++;
735 }
736 else {
737 skb->dev = dev;
738 skb_put(skb,pkt_len); /* Make room */
739 eth_copy_and_sum(skb,
740 (unsigned char *)__va(bdp->cbd_bufaddr),
741 pkt_len, 0);
742 skb->protocol=eth_type_trans(skb,dev);
743 netif_rx(skb);
744 }
745 }
746
747 /* Clear the status flags for this buffer. */
748 bdp->cbd_sc &= ~BD_ENET_RX_STATS;
749
750 /* Mark the buffer empty. */
751 bdp->cbd_sc |= BD_ENET_RX_EMPTY;
752
753 /* Update BD pointer to next entry. */
754 if (bdp->cbd_sc & BD_ENET_RX_WRAP)
755 bdp = cep->rx_bd_base;
756 else
757 bdp++;
758
759 }
760 cep->cur_rx = (cbd_t *)bdp;
761
762 return 0;
763}
764
765static int
766fcc_enet_close(struct net_device *dev)
767{
768#ifdef CONFIG_USE_MDIO
769 struct fcc_enet_private *fep = dev->priv;
770#endif
771
772 netif_stop_queue(dev);
773 fcc_stop(dev);
774#ifdef CONFIG_USE_MDIO
775 if (fep->phy)
776 mii_do_cmd(dev, fep->phy->shutdown);
777#endif
778
779 return 0;
780}
781
782static struct net_device_stats *fcc_enet_get_stats(struct net_device *dev)
783{
784 struct fcc_enet_private *cep = (struct fcc_enet_private *)dev->priv;
785
786 return &cep->stats;
787}
788
789#ifdef CONFIG_USE_MDIO
790
791/* NOTE: Most of the following comes from the FEC driver for 860. The
792 * overall structure of MII code has been retained (as it's proved stable
793 * and well-tested), but actual transfer requests are processed "at once"
794 * instead of being queued (there's no interrupt-driven MII transfer
795 * mechanism, one has to toggle the data/clock bits manually).
796 */
797static int
798mii_queue(struct net_device *dev, int regval, void (*func)(uint, struct net_device *))
799{
800 struct fcc_enet_private *fep;
801 int retval, tmp;
802
803 /* Add PHY address to register command. */
804 fep = dev->priv;
805 regval |= fep->phy_addr << 23;
806
807 retval = 0;
808
809 tmp = mii_send_receive(fep->fip, regval);
810 if (func)
811 func(tmp, dev);
812
813 return retval;
814}
815
816static void mii_do_cmd(struct net_device *dev, const phy_cmd_t *c)
817{
818 int k;
819
820 if(!c)
821 return;
822
823 for(k = 0; (c+k)->mii_data != mk_mii_end; k++)
824 mii_queue(dev, (c+k)->mii_data, (c+k)->funct);
825}
826
827static void mii_parse_sr(uint mii_reg, struct net_device *dev)
828{
829 volatile struct fcc_enet_private *fep = dev->priv;
830 uint s = fep->phy_status;
831
832 s &= ~(PHY_STAT_LINK | PHY_STAT_FAULT | PHY_STAT_ANC);
833
834 if (mii_reg & BMSR_LSTATUS)
835 s |= PHY_STAT_LINK;
836 if (mii_reg & BMSR_RFAULT)
837 s |= PHY_STAT_FAULT;
838 if (mii_reg & BMSR_ANEGCOMPLETE)
839 s |= PHY_STAT_ANC;
840
841 fep->phy_status = s;
842}
843
844static void mii_parse_cr(uint mii_reg, struct net_device *dev)
845{
846 volatile struct fcc_enet_private *fep = dev->priv;
847 uint s = fep->phy_status;
848
849 s &= ~(PHY_CONF_ANE | PHY_CONF_LOOP);
850
851 if (mii_reg & BMCR_ANENABLE)
852 s |= PHY_CONF_ANE;
853 if (mii_reg & BMCR_LOOPBACK)
854 s |= PHY_CONF_LOOP;
855
856 fep->phy_status = s;
857}
858
859static void mii_parse_anar(uint mii_reg, struct net_device *dev)
860{
861 volatile struct fcc_enet_private *fep = dev->priv;
862 uint s = fep->phy_status;
863
864 s &= ~(PHY_CONF_SPMASK);
865
866 if (mii_reg & ADVERTISE_10HALF)
867 s |= PHY_CONF_10HDX;
868 if (mii_reg & ADVERTISE_10FULL)
869 s |= PHY_CONF_10FDX;
870 if (mii_reg & ADVERTISE_100HALF)
871 s |= PHY_CONF_100HDX;
872 if (mii_reg & ADVERTISE_100FULL)
873 s |= PHY_CONF_100FDX;
874
875 fep->phy_status = s;
876}
877
878/* ------------------------------------------------------------------------- */
879/* Generic PHY support. Should work for all PHYs, but does not support link
880 * change interrupts.
881 */
882#ifdef CONFIG_FCC_GENERIC_PHY
883
884static phy_info_t phy_info_generic = {
885 0x00000000, /* 0-->match any PHY */
886 "GENERIC",
887
888 (const phy_cmd_t []) { /* config */
889 /* advertise only half-duplex capabilities */
890 { mk_mii_write(MII_ADVERTISE, MII_ADVERTISE_HALF),
891 mii_parse_anar },
892
893 /* enable auto-negotiation */
894 { mk_mii_write(MII_BMCR, BMCR_ANENABLE), mii_parse_cr },
895 { mk_mii_end, }
896 },
897 (const phy_cmd_t []) { /* startup */
898 /* restart auto-negotiation */
899 { mk_mii_write(MII_BMCR, BMCR_ANENABLE | BMCR_ANRESTART),
900 NULL },
901 { mk_mii_end, }
902 },
903 (const phy_cmd_t []) { /* ack_int */
904 /* We don't actually use the ack_int table with a generic
905 * PHY, but putting a reference to mii_parse_sr here keeps
906 * us from getting a compiler warning about unused static
907 * functions in the case where we only compile in generic
908 * PHY support.
909 */
910 { mk_mii_read(MII_BMSR), mii_parse_sr },
911 { mk_mii_end, }
912 },
913 (const phy_cmd_t []) { /* shutdown */
914 { mk_mii_end, }
915 },
916};
917#endif /* ifdef CONFIG_FCC_GENERIC_PHY */
918
919/* ------------------------------------------------------------------------- */
920/* The Level one LXT970 is used by many boards */
921
922#ifdef CONFIG_FCC_LXT970
923
924#define MII_LXT970_MIRROR 16 /* Mirror register */
925#define MII_LXT970_IER 17 /* Interrupt Enable Register */
926#define MII_LXT970_ISR 18 /* Interrupt Status Register */
927#define MII_LXT970_CONFIG 19 /* Configuration Register */
928#define MII_LXT970_CSR 20 /* Chip Status Register */
929
930static void mii_parse_lxt970_csr(uint mii_reg, struct net_device *dev)
931{
932 volatile struct fcc_enet_private *fep = dev->priv;
933 uint s = fep->phy_status;
934
935 s &= ~(PHY_STAT_SPMASK);
936
937 if (mii_reg & 0x0800) {
938 if (mii_reg & 0x1000)
939 s |= PHY_STAT_100FDX;
940 else
941 s |= PHY_STAT_100HDX;
942 } else {
943 if (mii_reg & 0x1000)
944 s |= PHY_STAT_10FDX;
945 else
946 s |= PHY_STAT_10HDX;
947 }
948
949 fep->phy_status = s;
950}
951
952static phy_info_t phy_info_lxt970 = {
953 0x07810000,
954 "LXT970",
955
956 (const phy_cmd_t []) { /* config */
957#if 0
958// { mk_mii_write(MII_ADVERTISE, 0x0021), NULL },
959
960 /* Set default operation of 100-TX....for some reason
961 * some of these bits are set on power up, which is wrong.
962 */
963 { mk_mii_write(MII_LXT970_CONFIG, 0), NULL },
964#endif
965 { mk_mii_read(MII_BMCR), mii_parse_cr },
966 { mk_mii_read(MII_ADVERTISE), mii_parse_anar },
967 { mk_mii_end, }
968 },
969 (const phy_cmd_t []) { /* startup - enable interrupts */
970 { mk_mii_write(MII_LXT970_IER, 0x0002), NULL },
971 { mk_mii_write(MII_BMCR, 0x1200), NULL }, /* autonegotiate */
972 { mk_mii_end, }
973 },
974 (const phy_cmd_t []) { /* ack_int */
975 /* read SR and ISR to acknowledge */
976
977 { mk_mii_read(MII_BMSR), mii_parse_sr },
978 { mk_mii_read(MII_LXT970_ISR), NULL },
979
980 /* find out the current status */
981
982 { mk_mii_read(MII_LXT970_CSR), mii_parse_lxt970_csr },
983 { mk_mii_end, }
984 },
985 (const phy_cmd_t []) { /* shutdown - disable interrupts */
986 { mk_mii_write(MII_LXT970_IER, 0x0000), NULL },
987 { mk_mii_end, }
988 },
989};
990
991#endif /* CONFIG_FEC_LXT970 */
992
993/* ------------------------------------------------------------------------- */
994/* The Level one LXT971 is used on some of my custom boards */
995
996#ifdef CONFIG_FCC_LXT971
997
998/* register definitions for the 971 */
999
1000#define MII_LXT971_PCR 16 /* Port Control Register */
1001#define MII_LXT971_SR2 17 /* Status Register 2 */
1002#define MII_LXT971_IER 18 /* Interrupt Enable Register */
1003#define MII_LXT971_ISR 19 /* Interrupt Status Register */
1004#define MII_LXT971_LCR 20 /* LED Control Register */
1005#define MII_LXT971_TCR 30 /* Transmit Control Register */
1006
1007/*
1008 * I had some nice ideas of running the MDIO faster...
1009 * The 971 should support 8MHz and I tried it, but things acted really
1010 * weird, so 2.5 MHz ought to be enough for anyone...
1011 */
1012
1013static void mii_parse_lxt971_sr2(uint mii_reg, struct net_device *dev)
1014{
1015 volatile struct fcc_enet_private *fep = dev->priv;
1016 uint s = fep->phy_status;
1017
1018 s &= ~(PHY_STAT_SPMASK);
1019
1020 if (mii_reg & 0x4000) {
1021 if (mii_reg & 0x0200)
1022 s |= PHY_STAT_100FDX;
1023 else
1024 s |= PHY_STAT_100HDX;
1025 } else {
1026 if (mii_reg & 0x0200)
1027 s |= PHY_STAT_10FDX;
1028 else
1029 s |= PHY_STAT_10HDX;
1030 }
1031 if (mii_reg & 0x0008)
1032 s |= PHY_STAT_FAULT;
1033
1034 fep->phy_status = s;
1035}
1036
1037static phy_info_t phy_info_lxt971 = {
1038 0x0001378e,
1039 "LXT971",
1040
1041 (const phy_cmd_t []) { /* config */
1042 /* configure link capabilities to advertise */
1043 { mk_mii_write(MII_ADVERTISE, MII_ADVERTISE_DEFAULT),
1044 mii_parse_anar },
1045
1046 /* enable auto-negotiation */
1047 { mk_mii_write(MII_BMCR, BMCR_ANENABLE), mii_parse_cr },
1048 { mk_mii_end, }
1049 },
1050 (const phy_cmd_t []) { /* startup - enable interrupts */
1051 { mk_mii_write(MII_LXT971_IER, 0x00f2), NULL },
1052
1053 /* restart auto-negotiation */
1054 { mk_mii_write(MII_BMCR, BMCR_ANENABLE | BMCR_ANRESTART),
1055 NULL },
1056 { mk_mii_end, }
1057 },
1058 (const phy_cmd_t []) { /* ack_int */
1059 /* find out the current status */
1060 { mk_mii_read(MII_BMSR), NULL },
1061 { mk_mii_read(MII_BMSR), mii_parse_sr },
1062 { mk_mii_read(MII_LXT971_SR2), mii_parse_lxt971_sr2 },
1063
1064 /* we only need to read ISR to acknowledge */
1065 { mk_mii_read(MII_LXT971_ISR), NULL },
1066 { mk_mii_end, }
1067 },
1068 (const phy_cmd_t []) { /* shutdown - disable interrupts */
1069 { mk_mii_write(MII_LXT971_IER, 0x0000), NULL },
1070 { mk_mii_end, }
1071 },
1072};
1073
1074#endif /* CONFIG_FCC_LXT971 */
1075
1076/* ------------------------------------------------------------------------- */
1077/* The Quality Semiconductor QS6612 is used on the RPX CLLF */
1078
1079#ifdef CONFIG_FCC_QS6612
1080
1081/* register definitions */
1082
1083#define MII_QS6612_MCR 17 /* Mode Control Register */
1084#define MII_QS6612_FTR 27 /* Factory Test Register */
1085#define MII_QS6612_MCO 28 /* Misc. Control Register */
1086#define MII_QS6612_ISR 29 /* Interrupt Source Register */
1087#define MII_QS6612_IMR 30 /* Interrupt Mask Register */
1088#define MII_QS6612_PCR 31 /* 100BaseTx PHY Control Reg. */
1089
1090static void mii_parse_qs6612_pcr(uint mii_reg, struct net_device *dev)
1091{
1092 volatile struct fcc_enet_private *fep = dev->priv;
1093 uint s = fep->phy_status;
1094
1095 s &= ~(PHY_STAT_SPMASK);
1096
1097 switch((mii_reg >> 2) & 7) {
1098 case 1: s |= PHY_STAT_10HDX; break;
1099 case 2: s |= PHY_STAT_100HDX; break;
1100 case 5: s |= PHY_STAT_10FDX; break;
1101 case 6: s |= PHY_STAT_100FDX; break;
1102 }
1103
1104 fep->phy_status = s;
1105}
1106
1107static phy_info_t phy_info_qs6612 = {
1108 0x00181440,
1109 "QS6612",
1110
1111 (const phy_cmd_t []) { /* config */
1112// { mk_mii_write(MII_ADVERTISE, 0x061), NULL }, /* 10 Mbps */
1113
1114 /* The PHY powers up isolated on the RPX,
1115 * so send a command to allow operation.
1116 */
1117
1118 { mk_mii_write(MII_QS6612_PCR, 0x0dc0), NULL },
1119
1120 /* parse cr and anar to get some info */
1121
1122 { mk_mii_read(MII_BMCR), mii_parse_cr },
1123 { mk_mii_read(MII_ADVERTISE), mii_parse_anar },
1124 { mk_mii_end, }
1125 },
1126 (const phy_cmd_t []) { /* startup - enable interrupts */
1127 { mk_mii_write(MII_QS6612_IMR, 0x003a), NULL },
1128 { mk_mii_write(MII_BMCR, 0x1200), NULL }, /* autonegotiate */
1129 { mk_mii_end, }
1130 },
1131 (const phy_cmd_t []) { /* ack_int */
1132
1133 /* we need to read ISR, SR and ANER to acknowledge */
1134
1135 { mk_mii_read(MII_QS6612_ISR), NULL },
1136 { mk_mii_read(MII_BMSR), mii_parse_sr },
1137 { mk_mii_read(MII_EXPANSION), NULL },
1138
1139 /* read pcr to get info */
1140
1141 { mk_mii_read(MII_QS6612_PCR), mii_parse_qs6612_pcr },
1142 { mk_mii_end, }
1143 },
1144 (const phy_cmd_t []) { /* shutdown - disable interrupts */
1145 { mk_mii_write(MII_QS6612_IMR, 0x0000), NULL },
1146 { mk_mii_end, }
1147 },
1148};
1149
1150
1151#endif /* CONFIG_FEC_QS6612 */
1152
1153
1154/* ------------------------------------------------------------------------- */
1155/* The Davicom DM9131 is used on the HYMOD board */
1156
1157#ifdef CONFIG_FCC_DM9131
1158
1159/* register definitions */
1160
1161#define MII_DM9131_ACR 16 /* Aux. Config Register */
1162#define MII_DM9131_ACSR 17 /* Aux. Config/Status Register */
1163#define MII_DM9131_10TCSR 18 /* 10BaseT Config/Status Reg. */
1164#define MII_DM9131_INTR 21 /* Interrupt Register */
1165#define MII_DM9131_RECR 22 /* Receive Error Counter Reg. */
1166#define MII_DM9131_DISCR 23 /* Disconnect Counter Register */
1167
1168static void mii_parse_dm9131_acsr(uint mii_reg, struct net_device *dev)
1169{
1170 volatile struct fcc_enet_private *fep = dev->priv;
1171 uint s = fep->phy_status;
1172
1173 s &= ~(PHY_STAT_SPMASK);
1174
1175 switch ((mii_reg >> 12) & 0xf) {
1176 case 1: s |= PHY_STAT_10HDX; break;
1177 case 2: s |= PHY_STAT_10FDX; break;
1178 case 4: s |= PHY_STAT_100HDX; break;
1179 case 8: s |= PHY_STAT_100FDX; break;
1180 }
1181
1182 fep->phy_status = s;
1183}
1184
1185static phy_info_t phy_info_dm9131 = {
1186 0x00181b80,
1187 "DM9131",
1188
1189 (const phy_cmd_t []) { /* config */
1190 /* parse cr and anar to get some info */
1191 { mk_mii_read(MII_BMCR), mii_parse_cr },
1192 { mk_mii_read(MII_ADVERTISE), mii_parse_anar },
1193 { mk_mii_end, }
1194 },
1195 (const phy_cmd_t []) { /* startup - enable interrupts */
1196 { mk_mii_write(MII_DM9131_INTR, 0x0002), NULL },
1197 { mk_mii_write(MII_BMCR, 0x1200), NULL }, /* autonegotiate */
1198 { mk_mii_end, }
1199 },
1200 (const phy_cmd_t []) { /* ack_int */
1201
1202 /* we need to read INTR, SR and ANER to acknowledge */
1203
1204 { mk_mii_read(MII_DM9131_INTR), NULL },
1205 { mk_mii_read(MII_BMSR), mii_parse_sr },
1206 { mk_mii_read(MII_EXPANSION), NULL },
1207
1208 /* read acsr to get info */
1209
1210 { mk_mii_read(MII_DM9131_ACSR), mii_parse_dm9131_acsr },
1211 { mk_mii_end, }
1212 },
1213 (const phy_cmd_t []) { /* shutdown - disable interrupts */
1214 { mk_mii_write(MII_DM9131_INTR, 0x0f00), NULL },
1215 { mk_mii_end, }
1216 },
1217};
1218
1219
1220#endif /* CONFIG_FEC_DM9131 */
1221#ifdef CONFIG_FCC_DM9161
1222/* ------------------------------------------------------------------------- */
1223/* DM9161 Control register values */
1224#define MIIM_DM9161_CR_STOP 0x0400
1225#define MIIM_DM9161_CR_RSTAN 0x1200
1226
1227#define MIIM_DM9161_SCR 0x10
1228#define MIIM_DM9161_SCR_INIT 0x0610
1229
1230/* DM9161 Specified Configuration and Status Register */
1231#define MIIM_DM9161_SCSR 0x11
1232#define MIIM_DM9161_SCSR_100F 0x8000
1233#define MIIM_DM9161_SCSR_100H 0x4000
1234#define MIIM_DM9161_SCSR_10F 0x2000
1235#define MIIM_DM9161_SCSR_10H 0x1000
1236/* DM9161 10BT register */
1237#define MIIM_DM9161_10BTCSR 0x12
1238#define MIIM_DM9161_10BTCSR_INIT 0x7800
1239/* DM9161 Interrupt Register */
1240#define MIIM_DM9161_INTR 0x15
1241#define MIIM_DM9161_INTR_PEND 0x8000
1242#define MIIM_DM9161_INTR_DPLX_MASK 0x0800
1243#define MIIM_DM9161_INTR_SPD_MASK 0x0400
1244#define MIIM_DM9161_INTR_LINK_MASK 0x0200
1245#define MIIM_DM9161_INTR_MASK 0x0100
1246#define MIIM_DM9161_INTR_DPLX_CHANGE 0x0010
1247#define MIIM_DM9161_INTR_SPD_CHANGE 0x0008
1248#define MIIM_DM9161_INTR_LINK_CHANGE 0x0004
1249#define MIIM_DM9161_INTR_INIT 0x0000
1250#define MIIM_DM9161_INTR_STOP \
1251(MIIM_DM9161_INTR_DPLX_MASK | MIIM_DM9161_INTR_SPD_MASK \
1252 | MIIM_DM9161_INTR_LINK_MASK | MIIM_DM9161_INTR_MASK)
1253
1254static void mii_parse_dm9161_sr(uint mii_reg, struct net_device * dev)
1255{
1256 volatile struct fcc_enet_private *fep = dev->priv;
1257 uint regstat, timeout=0xffff;
1258
1259 while(!(mii_reg & 0x0020) && timeout--)
1260 {
1261 regstat=mk_mii_read(MII_BMSR);
1262 regstat |= fep->phy_addr <<23;
1263 mii_reg = mii_send_receive(fep->fip,regstat);
1264 }
1265
1266 mii_parse_sr(mii_reg, dev);
1267}
1268
1269static void mii_parse_dm9161_scsr(uint mii_reg, struct net_device * dev)
1270{
1271 volatile struct fcc_enet_private *fep = dev->priv;
1272 uint s = fep->phy_status;
1273
1274 s &= ~(PHY_STAT_SPMASK);
1275 switch((mii_reg >>12) & 0xf) {
1276 case 1:
1277 {
1278 s |= PHY_STAT_10HDX;
1279 printk("10BaseT Half Duplex\n");
1280 break;
1281 }
1282 case 2:
1283 {
1284 s |= PHY_STAT_10FDX;
1285 printk("10BaseT Full Duplex\n");
1286 break;
1287 }
1288 case 4:
1289 {
1290 s |= PHY_STAT_100HDX;
1291 printk("100BaseT Half Duplex\n");
1292 break;
1293 }
1294 case 8:
1295 {
1296 s |= PHY_STAT_100FDX;
1297 printk("100BaseT Full Duplex\n");
1298 break;
1299 }
1300 }
1301
1302 fep->phy_status = s;
1303
1304}
1305
1306static void mii_dm9161_wait(uint mii_reg, struct net_device *dev)
1307{
1308 int timeout = HZ;
1309
1310 /* Davicom takes a bit to come up after a reset,
1311 * so wait here for a bit */
1312 set_current_state(TASK_UNINTERRUPTIBLE);
1313 schedule_timeout(timeout);
1314}
1315
1316static phy_info_t phy_info_dm9161 = {
1317 0x00181b88,
1318 "Davicom DM9161E",
1319 (const phy_cmd_t[]) { /* config */
1320 { mk_mii_write(MII_BMCR, MIIM_DM9161_CR_STOP), NULL},
1321 /* Do not bypass the scrambler/descrambler */
1322 { mk_mii_write(MIIM_DM9161_SCR, MIIM_DM9161_SCR_INIT), NULL},
1323 /* Configure 10BTCSR register */
1324 { mk_mii_write(MIIM_DM9161_10BTCSR, MIIM_DM9161_10BTCSR_INIT),NULL},
1325 /* Configure some basic stuff */
1326 { mk_mii_write(MII_BMCR, 0x1000), NULL},
1327 { mk_mii_read(MII_BMCR), mii_parse_cr },
1328 { mk_mii_read(MII_ADVERTISE), mii_parse_anar },
1329 { mk_mii_end,}
1330 },
1331 (const phy_cmd_t[]) { /* startup */
1332 /* Restart Auto Negotiation */
1333 { mk_mii_write(MII_BMCR, MIIM_DM9161_CR_RSTAN), NULL},
1334 /* Status is read once to clear old link state */
1335 { mk_mii_read(MII_BMSR), mii_dm9161_wait},
1336 /* Auto-negotiate */
1337 { mk_mii_read(MII_BMSR), mii_parse_dm9161_sr},
1338 /* Read the status */
1339 { mk_mii_read(MIIM_DM9161_SCSR), mii_parse_dm9161_scsr},
1340 /* Clear any pending interrupts */
1341 { mk_mii_read(MIIM_DM9161_INTR), NULL},
1342 /* Enable Interrupts */
1343 { mk_mii_write(MIIM_DM9161_INTR, MIIM_DM9161_INTR_INIT), NULL},
1344 { mk_mii_end,}
1345 },
1346 (const phy_cmd_t[]) { /* ack_int */
1347 { mk_mii_read(MIIM_DM9161_INTR), NULL},
1348#if 0
1349 { mk_mii_read(MII_BMSR), NULL},
1350 { mk_mii_read(MII_BMSR), mii_parse_dm9161_sr},
1351 { mk_mii_read(MIIM_DM9161_SCSR), mii_parse_dm9161_scsr},
1352#endif
1353 { mk_mii_end,}
1354 },
1355 (const phy_cmd_t[]) { /* shutdown */
1356 { mk_mii_read(MIIM_DM9161_INTR),NULL},
1357 { mk_mii_write(MIIM_DM9161_INTR, MIIM_DM9161_INTR_STOP), NULL},
1358 { mk_mii_end,}
1359 },
1360};
1361#endif /* CONFIG_FCC_DM9161 */
1362
1363static phy_info_t *phy_info[] = {
1364
1365#ifdef CONFIG_FCC_LXT970
1366 &phy_info_lxt970,
1367#endif /* CONFIG_FEC_LXT970 */
1368
1369#ifdef CONFIG_FCC_LXT971
1370 &phy_info_lxt971,
1371#endif /* CONFIG_FEC_LXT971 */
1372
1373#ifdef CONFIG_FCC_QS6612
1374 &phy_info_qs6612,
1375#endif /* CONFIG_FEC_QS6612 */
1376
1377#ifdef CONFIG_FCC_DM9131
1378 &phy_info_dm9131,
1379#endif /* CONFIG_FEC_DM9131 */
1380
1381#ifdef CONFIG_FCC_DM9161
1382 &phy_info_dm9161,
1383#endif /* CONFIG_FCC_DM9161 */
1384
1385#ifdef CONFIG_FCC_GENERIC_PHY
1386 /* Generic PHY support. This must be the last PHY in the table.
1387 * It will be used to support any PHY that doesn't match a previous
1388 * entry in the table.
1389 */
1390 &phy_info_generic,
1391#endif /* CONFIG_FCC_GENERIC_PHY */
1392
1393 NULL
1394};
1395
1396static void mii_display_status(void *data)
1397{
1398 struct net_device *dev = data;
1399 volatile struct fcc_enet_private *fep = dev->priv;
1400 uint s = fep->phy_status;
1401
1402 if (!fep->link && !fep->old_link) {
1403 /* Link is still down - don't print anything */
1404 return;
1405 }
1406
1407 printk("%s: status: ", dev->name);
1408
1409 if (!fep->link) {
1410 printk("link down");
1411 } else {
1412 printk("link up");
1413
1414 switch(s & PHY_STAT_SPMASK) {
1415 case PHY_STAT_100FDX: printk(", 100 Mbps Full Duplex"); break;
1416 case PHY_STAT_100HDX: printk(", 100 Mbps Half Duplex"); break;
1417 case PHY_STAT_10FDX: printk(", 10 Mbps Full Duplex"); break;
1418 case PHY_STAT_10HDX: printk(", 10 Mbps Half Duplex"); break;
1419 default:
1420 printk(", Unknown speed/duplex");
1421 }
1422
1423 if (s & PHY_STAT_ANC)
1424 printk(", auto-negotiation complete");
1425 }
1426
1427 if (s & PHY_STAT_FAULT)
1428 printk(", remote fault");
1429
1430 printk(".\n");
1431}
1432
1433static void mii_display_config(void *data)
1434{
1435 struct net_device *dev = data;
1436 volatile struct fcc_enet_private *fep = dev->priv;
1437 uint s = fep->phy_status;
1438
1439 printk("%s: config: auto-negotiation ", dev->name);
1440
1441 if (s & PHY_CONF_ANE)
1442 printk("on");
1443 else
1444 printk("off");
1445
1446 if (s & PHY_CONF_100FDX)
1447 printk(", 100FDX");
1448 if (s & PHY_CONF_100HDX)
1449 printk(", 100HDX");
1450 if (s & PHY_CONF_10FDX)
1451 printk(", 10FDX");
1452 if (s & PHY_CONF_10HDX)
1453 printk(", 10HDX");
1454 if (!(s & PHY_CONF_SPMASK))
1455 printk(", No speed/duplex selected?");
1456
1457 if (s & PHY_CONF_LOOP)
1458 printk(", loopback enabled");
1459
1460 printk(".\n");
1461
1462 fep->sequence_done = 1;
1463}
1464
1465static void mii_relink(struct net_device *dev)
1466{
1467 struct fcc_enet_private *fep = dev->priv;
1468 int duplex = 0;
1469
1470 fep->old_link = fep->link;
1471 fep->link = (fep->phy_status & PHY_STAT_LINK) ? 1 : 0;
1472
1473#ifdef MDIO_DEBUG
1474 printk(" mii_relink: link=%d\n", fep->link);
1475#endif
1476
1477 if (fep->link) {
1478 if (fep->phy_status
1479 & (PHY_STAT_100FDX | PHY_STAT_10FDX))
1480 duplex = 1;
1481 fcc_restart(dev, duplex);
1482#ifdef MDIO_DEBUG
1483 printk(" mii_relink: duplex=%d\n", duplex);
1484#endif
1485 }
1486}
1487
1488static void mii_queue_relink(uint mii_reg, struct net_device *dev)
1489{
1490 struct fcc_enet_private *fep = dev->priv;
1491
1492 mii_relink(dev);
1493
1494 schedule_work(&fep->phy_relink);
1495}
1496
1497static void mii_queue_config(uint mii_reg, struct net_device *dev)
1498{
1499 struct fcc_enet_private *fep = dev->priv;
1500
1501 schedule_work(&fep->phy_display_config);
1502}
1503
1504phy_cmd_t phy_cmd_relink[] = { { mk_mii_read(MII_BMCR), mii_queue_relink },
1505 { mk_mii_end, } };
1506phy_cmd_t phy_cmd_config[] = { { mk_mii_read(MII_BMCR), mii_queue_config },
1507 { mk_mii_end, } };
1508
1509
1510/* Read remainder of PHY ID.
1511*/
1512static void
1513mii_discover_phy3(uint mii_reg, struct net_device *dev)
1514{
1515 struct fcc_enet_private *fep;
1516 int i;
1517
1518 fep = dev->priv;
1519 printk("mii_reg: %08x\n", mii_reg);
1520 fep->phy_id |= (mii_reg & 0xffff);
1521
1522 for(i = 0; phy_info[i]; i++)
1523 if((phy_info[i]->id == (fep->phy_id >> 4)) || !phy_info[i]->id)
1524 break;
1525
1526 if(!phy_info[i])
1527 panic("%s: PHY id 0x%08x is not supported!\n",
1528 dev->name, fep->phy_id);
1529
1530 fep->phy = phy_info[i];
1531 fep->phy_id_done = 1;
1532
1533 printk("%s: Phy @ 0x%x, type %s (0x%08x)\n",
1534 dev->name, fep->phy_addr, fep->phy->name, fep->phy_id);
1535}
1536
1537/* Scan all of the MII PHY addresses looking for someone to respond
1538 * with a valid ID. This usually happens quickly.
1539 */
1540static void
1541mii_discover_phy(uint mii_reg, struct net_device *dev)
1542{
1543 struct fcc_enet_private *fep;
1544 uint phytype;
1545
1546 fep = dev->priv;
1547
1548 if ((phytype = (mii_reg & 0xffff)) != 0xffff) {
1549
1550 /* Got first part of ID, now get remainder. */
1551 fep->phy_id = phytype << 16;
1552 mii_queue(dev, mk_mii_read(MII_PHYSID2), mii_discover_phy3);
1553 } else {
1554 fep->phy_addr++;
1555 if (fep->phy_addr < 32) {
1556 mii_queue(dev, mk_mii_read(MII_PHYSID1),
1557 mii_discover_phy);
1558 } else {
1559 printk("fec: No PHY device found.\n");
1560 }
1561 }
1562}
1563#endif /* CONFIG_USE_MDIO */
1564
1565#ifdef PHY_INTERRUPT
1566/* This interrupt occurs when the PHY detects a link change. */
1567static irqreturn_t
1568mii_link_interrupt(int irq, void * dev_id, struct pt_regs * regs)
1569{
1570 struct net_device *dev = dev_id;
1571 struct fcc_enet_private *fep = dev->priv;
1572 fcc_info_t *fip = fep->fip;
1573
1574 if (fep->phy) {
1575 /* We don't want to be interrupted by an FCC
1576 * interrupt here.
1577 */
1578 disable_irq_nosync(fip->fc_interrupt);
1579
1580 mii_do_cmd(dev, fep->phy->ack_int);
1581 /* restart and display status */
1582 mii_do_cmd(dev, phy_cmd_relink);
1583
1584 enable_irq(fip->fc_interrupt);
1585 }
1586 return IRQ_HANDLED;
1587}
1588#endif /* ifdef PHY_INTERRUPT */
1589
1590#if 0 /* This should be fixed someday */
1591/* Set or clear the multicast filter for this adaptor.
1592 * Skeleton taken from sunlance driver.
1593 * The CPM Ethernet implementation allows Multicast as well as individual
1594 * MAC address filtering. Some of the drivers check to make sure it is
1595 * a group multicast address, and discard those that are not. I guess I
1596 * will do the same for now, but just remove the test if you want
1597 * individual filtering as well (do the upper net layers want or support
1598 * this kind of feature?).
1599 */
1600static void
1601set_multicast_list(struct net_device *dev)
1602{
1603 struct fcc_enet_private *cep;
1604 struct dev_mc_list *dmi;
1605 u_char *mcptr, *tdptr;
1606 volatile fcc_enet_t *ep;
1607 int i, j;
1608
1609 cep = (struct fcc_enet_private *)dev->priv;
1610
1611return;
1612 /* Get pointer to FCC area in parameter RAM.
1613 */
1614 ep = (fcc_enet_t *)dev->base_addr;
1615
1616 if (dev->flags&IFF_PROMISC) {
1617
1618 /* Log any net taps. */
1619 printk("%s: Promiscuous mode enabled.\n", dev->name);
1620 cep->fccp->fcc_fpsmr |= FCC_PSMR_PRO;
1621 } else {
1622
1623 cep->fccp->fcc_fpsmr &= ~FCC_PSMR_PRO;
1624
1625 if (dev->flags & IFF_ALLMULTI) {
1626 /* Catch all multicast addresses, so set the
1627 * filter to all 1's.
1628 */
1629 ep->fen_gaddrh = 0xffffffff;
1630 ep->fen_gaddrl = 0xffffffff;
1631 }
1632 else {
1633 /* Clear filter and add the addresses in the list.
1634 */
1635 ep->fen_gaddrh = 0;
1636 ep->fen_gaddrl = 0;
1637
1638 dmi = dev->mc_list;
1639
1640 for (i=0; i<dev->mc_count; i++, dmi = dmi->next) {
1641
1642 /* Only support group multicast for now.
1643 */
1644 if (!(dmi->dmi_addr[0] & 1))
1645 continue;
1646
1647 /* The address in dmi_addr is LSB first,
1648 * and taddr is MSB first. We have to
1649 * copy bytes MSB first from dmi_addr.
1650 */
1651 mcptr = (u_char *)dmi->dmi_addr + 5;
1652 tdptr = (u_char *)&ep->fen_taddrh;
1653 for (j=0; j<6; j++)
1654 *tdptr++ = *mcptr--;
1655
1656 /* Ask CPM to run CRC and set bit in
1657 * filter mask.
1658 */
1659 cpmp->cp_cpcr = mk_cr_cmd(cep->fip->fc_cpmpage,
1660 cep->fip->fc_cpmblock, 0x0c,
1661 CPM_CR_SET_GADDR) | CPM_CR_FLG;
1662 udelay(10);
1663 while (cpmp->cp_cpcr & CPM_CR_FLG);
1664 }
1665 }
1666 }
1667}
1668#endif /* if 0 */
1669
1670
1671/* Set the individual MAC address.
1672 */
1673int fcc_enet_set_mac_address(struct net_device *dev, void *p)
1674{
1675 struct sockaddr *addr= (struct sockaddr *) p;
1676 struct fcc_enet_private *cep;
1677 volatile fcc_enet_t *ep;
1678 unsigned char *eap;
1679 int i;
1680
1681 cep = (struct fcc_enet_private *)(dev->priv);
1682 ep = cep->ep;
1683
1684 if (netif_running(dev))
1685 return -EBUSY;
1686
1687 memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
1688
1689 eap = (unsigned char *) &(ep->fen_paddrh);
1690 for (i=5; i>=0; i--)
1691 *eap++ = addr->sa_data[i];
1692
1693 return 0;
1694}
1695
1696
1697/* Initialize the CPM Ethernet on FCC.
1698 */
1699static int __init fec_enet_init(void)
1700{
1701 struct net_device *dev;
1702 struct fcc_enet_private *cep;
1703 fcc_info_t *fip;
1704 int i, np, err;
1705 volatile cpm2_map_t *immap;
1706 volatile iop_cpm2_t *io;
1707
1708 immap = (cpm2_map_t *)CPM_MAP_ADDR; /* and to internal registers */
1709 io = &immap->im_ioport;
1710
1711 np = sizeof(fcc_ports) / sizeof(fcc_info_t);
1712 fip = fcc_ports;
1713
1714 while (np-- > 0) {
1715 /* Create an Ethernet device instance.
1716 */
1717 dev = alloc_etherdev(sizeof(*cep));
1718 if (!dev)
1719 return -ENOMEM;
1720
1721 cep = dev->priv;
1722 spin_lock_init(&cep->lock);
1723 cep->fip = fip;
1724
1725 init_fcc_shutdown(fip, cep, immap);
1726 init_fcc_ioports(fip, io, immap);
1727 init_fcc_param(fip, dev, immap);
1728
1729 dev->base_addr = (unsigned long)(cep->ep);
1730
1731 /* The CPM Ethernet specific entries in the device
1732 * structure.
1733 */
1734 dev->open = fcc_enet_open;
1735 dev->hard_start_xmit = fcc_enet_start_xmit;
1736 dev->tx_timeout = fcc_enet_timeout;
1737 dev->watchdog_timeo = TX_TIMEOUT;
1738 dev->stop = fcc_enet_close;
1739 dev->get_stats = fcc_enet_get_stats;
1740 /* dev->set_multicast_list = set_multicast_list; */
1741 dev->set_mac_address = fcc_enet_set_mac_address;
1742
1743 init_fcc_startup(fip, dev);
1744
1745 err = register_netdev(dev);
1746 if (err) {
1747 free_netdev(dev);
1748 return err;
1749 }
1750
1751 printk("%s: FCC ENET Version 0.3, ", dev->name);
1752 for (i=0; i<5; i++)
1753 printk("%02x:", dev->dev_addr[i]);
1754 printk("%02x\n", dev->dev_addr[5]);
1755
1756#ifdef CONFIG_USE_MDIO
1757 /* Queue up command to detect the PHY and initialize the
1758 * remainder of the interface.
1759 */
1760 cep->phy_id_done = 0;
1761 cep->phy_addr = fip->fc_phyaddr;
1762 mii_queue(dev, mk_mii_read(MII_PHYSID1), mii_discover_phy);
1763 INIT_WORK(&cep->phy_relink, mii_display_status, dev);
1764 INIT_WORK(&cep->phy_display_config, mii_display_config, dev);
1765#endif /* CONFIG_USE_MDIO */
1766
1767 fip++;
1768 }
1769
1770 return 0;
1771}
1772module_init(fec_enet_init);
1773
1774/* Make sure the device is shut down during initialization.
1775*/
1776static void __init
1777init_fcc_shutdown(fcc_info_t *fip, struct fcc_enet_private *cep,
1778 volatile cpm2_map_t *immap)
1779{
1780 volatile fcc_enet_t *ep;
1781 volatile fcc_t *fccp;
1782
1783 /* Get pointer to FCC area in parameter RAM.
1784 */
1785 ep = (fcc_enet_t *)(&immap->im_dprambase[fip->fc_proff]);
1786
1787 /* And another to the FCC register area.
1788 */
1789 fccp = (volatile fcc_t *)(&immap->im_fcc[fip->fc_fccnum]);
1790 cep->fccp = fccp; /* Keep the pointers handy */
1791 cep->ep = ep;
1792
1793 /* Disable receive and transmit in case someone left it running.
1794 */
1795 fccp->fcc_gfmr &= ~(FCC_GFMR_ENR | FCC_GFMR_ENT);
1796}
1797
1798/* Initialize the I/O pins for the FCC Ethernet.
1799*/
1800static void __init
1801init_fcc_ioports(fcc_info_t *fip, volatile iop_cpm2_t *io,
1802 volatile cpm2_map_t *immap)
1803{
1804
1805 /* FCC1 pins are on port A/C. FCC2/3 are port B/C.
1806 */
1807 if (fip->fc_proff == PROFF_FCC1) {
1808 /* Configure port A and C pins for FCC1 Ethernet.
1809 */
1810 io->iop_pdira &= ~PA1_DIRA_BOUT;
1811 io->iop_pdira |= PA1_DIRA_BIN;
1812 io->iop_psora &= ~PA1_PSORA_BOUT;
1813 io->iop_psora |= PA1_PSORA_BIN;
1814 io->iop_ppara |= (PA1_DIRA_BOUT | PA1_DIRA_BIN);
1815 }
1816 if (fip->fc_proff == PROFF_FCC2) {
1817 /* Configure port B and C pins for FCC Ethernet.
1818 */
1819 io->iop_pdirb &= ~PB2_DIRB_BOUT;
1820 io->iop_pdirb |= PB2_DIRB_BIN;
1821 io->iop_psorb &= ~PB2_PSORB_BOUT;
1822 io->iop_psorb |= PB2_PSORB_BIN;
1823 io->iop_pparb |= (PB2_DIRB_BOUT | PB2_DIRB_BIN);
1824 }
1825 if (fip->fc_proff == PROFF_FCC3) {
1826 /* Configure port B and C pins for FCC Ethernet.
1827 */
1828 io->iop_pdirb &= ~PB3_DIRB_BOUT;
1829 io->iop_pdirb |= PB3_DIRB_BIN;
1830 io->iop_psorb &= ~PB3_PSORB_BOUT;
1831 io->iop_psorb |= PB3_PSORB_BIN;
1832 io->iop_pparb |= (PB3_DIRB_BOUT | PB3_DIRB_BIN);
1833
1834 io->iop_pdirc &= ~PC3_DIRC_BOUT;
1835 io->iop_pdirc |= PC3_DIRC_BIN;
1836 io->iop_psorc &= ~PC3_PSORC_BOUT;
1837 io->iop_psorc |= PC3_PSORC_BIN;
1838 io->iop_pparc |= (PC3_DIRC_BOUT | PC3_DIRC_BIN);
1839
1840 }
1841
1842 /* Port C has clocks......
1843 */
1844 io->iop_psorc &= ~(fip->fc_trxclocks);
1845 io->iop_pdirc &= ~(fip->fc_trxclocks);
1846 io->iop_pparc |= fip->fc_trxclocks;
1847
1848#ifdef CONFIG_USE_MDIO
1849 /* ....and the MII serial clock/data.
1850 */
1851 io->iop_pdatc |= (fip->fc_mdio | fip->fc_mdck);
1852 io->iop_podrc &= ~(fip->fc_mdio | fip->fc_mdck);
1853 io->iop_pdirc |= (fip->fc_mdio | fip->fc_mdck);
1854 io->iop_pparc &= ~(fip->fc_mdio | fip->fc_mdck);
1855#endif /* CONFIG_USE_MDIO */
1856
1857 /* Configure Serial Interface clock routing.
1858 * First, clear all FCC bits to zero,
1859 * then set the ones we want.
1860 */
1861 immap->im_cpmux.cmx_fcr &= ~(fip->fc_clockmask);
1862 immap->im_cpmux.cmx_fcr |= fip->fc_clockroute;
1863}
1864
1865static void __init
1866init_fcc_param(fcc_info_t *fip, struct net_device *dev,
1867 volatile cpm2_map_t *immap)
1868{
1869 unsigned char *eap;
1870 unsigned long mem_addr;
1871 bd_t *bd;
1872 int i, j;
1873 struct fcc_enet_private *cep;
1874 volatile fcc_enet_t *ep;
1875 volatile cbd_t *bdp;
1876 volatile cpm_cpm2_t *cp;
1877
1878 cep = (struct fcc_enet_private *)(dev->priv);
1879 ep = cep->ep;
1880 cp = cpmp;
1881
1882 bd = (bd_t *)__res;
1883
1884 /* Zero the whole thing.....I must have missed some individually.
1885 * It works when I do this.
1886 */
1887 memset((char *)ep, 0, sizeof(fcc_enet_t));
1888
1889 /* Allocate space for the buffer descriptors from regular memory.
1890 * Initialize base addresses for the buffer descriptors.
1891 */
1892 cep->rx_bd_base = (cbd_t *)kmalloc(sizeof(cbd_t) * RX_RING_SIZE,
1893 GFP_KERNEL | GFP_DMA);
1894 ep->fen_genfcc.fcc_rbase = __pa(cep->rx_bd_base);
1895 cep->tx_bd_base = (cbd_t *)kmalloc(sizeof(cbd_t) * TX_RING_SIZE,
1896 GFP_KERNEL | GFP_DMA);
1897 ep->fen_genfcc.fcc_tbase = __pa(cep->tx_bd_base);
1898
1899 cep->dirty_tx = cep->cur_tx = cep->tx_bd_base;
1900 cep->cur_rx = cep->rx_bd_base;
1901
1902 ep->fen_genfcc.fcc_rstate = (CPMFCR_GBL | CPMFCR_EB) << 24;
1903 ep->fen_genfcc.fcc_tstate = (CPMFCR_GBL | CPMFCR_EB) << 24;
1904
1905 /* Set maximum bytes per receive buffer.
1906 * It must be a multiple of 32.
1907 */
1908 ep->fen_genfcc.fcc_mrblr = PKT_MAXBLR_SIZE;
1909
1910 /* Allocate space in the reserved FCC area of DPRAM for the
1911 * internal buffers. No one uses this space (yet), so we
1912 * can do this. Later, we will add resource management for
1913 * this area.
1914 */
1915 mem_addr = CPM_FCC_SPECIAL_BASE + (fip->fc_fccnum * 128);
1916 ep->fen_genfcc.fcc_riptr = mem_addr;
1917 ep->fen_genfcc.fcc_tiptr = mem_addr+32;
1918 ep->fen_padptr = mem_addr+64;
1919 memset((char *)(&(immap->im_dprambase[(mem_addr+64)])), 0x88, 32);
1920
1921 ep->fen_genfcc.fcc_rbptr = 0;
1922 ep->fen_genfcc.fcc_tbptr = 0;
1923 ep->fen_genfcc.fcc_rcrc = 0;
1924 ep->fen_genfcc.fcc_tcrc = 0;
1925 ep->fen_genfcc.fcc_res1 = 0;
1926 ep->fen_genfcc.fcc_res2 = 0;
1927
1928 ep->fen_camptr = 0; /* CAM isn't used in this driver */
1929
1930 /* Set CRC preset and mask.
1931 */
1932 ep->fen_cmask = 0xdebb20e3;
1933 ep->fen_cpres = 0xffffffff;
1934
1935 ep->fen_crcec = 0; /* CRC Error counter */
1936 ep->fen_alec = 0; /* alignment error counter */
1937 ep->fen_disfc = 0; /* discard frame counter */
1938 ep->fen_retlim = 15; /* Retry limit threshold */
1939 ep->fen_pper = 0; /* Normal persistence */
1940
1941 /* Clear hash filter tables.
1942 */
1943 ep->fen_gaddrh = 0;
1944 ep->fen_gaddrl = 0;
1945 ep->fen_iaddrh = 0;
1946 ep->fen_iaddrl = 0;
1947
1948 /* Clear the Out-of-sequence TxBD.
1949 */
1950 ep->fen_tfcstat = 0;
1951 ep->fen_tfclen = 0;
1952 ep->fen_tfcptr = 0;
1953
1954 ep->fen_mflr = PKT_MAXBUF_SIZE; /* maximum frame length register */
1955 ep->fen_minflr = PKT_MINBUF_SIZE; /* minimum frame length register */
1956
1957 /* Set Ethernet station address.
1958 *
1959 * This is supplied in the board information structure, so we
1960 * copy that into the controller.
1961 * So, far we have only been given one Ethernet address. We make
1962 * it unique by setting a few bits in the upper byte of the
1963 * non-static part of the address.
1964 */
1965 eap = (unsigned char *)&(ep->fen_paddrh);
1966 for (i=5; i>=0; i--) {
1967
1968/*
1969 * The EP8260 only uses FCC3, so we can safely give it the real
1970 * MAC address.
1971 */
1972#ifdef CONFIG_SBC82xx
1973 if (i == 5) {
1974 /* bd->bi_enetaddr holds the SCC0 address; the FCC
1975 devices count up from there */
1976 dev->dev_addr[i] = bd->bi_enetaddr[i] & ~3;
1977 dev->dev_addr[i] += 1 + fip->fc_fccnum;
1978 *eap++ = dev->dev_addr[i];
1979 }
1980#else
1981#ifndef CONFIG_RPX8260
1982 if (i == 3) {
1983 dev->dev_addr[i] = bd->bi_enetaddr[i];
1984 dev->dev_addr[i] |= (1 << (7 - fip->fc_fccnum));
1985 *eap++ = dev->dev_addr[i];
1986 } else
1987#endif
1988 {
1989 *eap++ = dev->dev_addr[i] = bd->bi_enetaddr[i];
1990 }
1991#endif
1992 }
1993
1994 ep->fen_taddrh = 0;
1995 ep->fen_taddrm = 0;
1996 ep->fen_taddrl = 0;
1997
1998 ep->fen_maxd1 = PKT_MAXDMA_SIZE; /* maximum DMA1 length */
1999 ep->fen_maxd2 = PKT_MAXDMA_SIZE; /* maximum DMA2 length */
2000
2001 /* Clear stat counters, in case we ever enable RMON.
2002 */
2003 ep->fen_octc = 0;
2004 ep->fen_colc = 0;
2005 ep->fen_broc = 0;
2006 ep->fen_mulc = 0;
2007 ep->fen_uspc = 0;
2008 ep->fen_frgc = 0;
2009 ep->fen_ospc = 0;
2010 ep->fen_jbrc = 0;
2011 ep->fen_p64c = 0;
2012 ep->fen_p65c = 0;
2013 ep->fen_p128c = 0;
2014 ep->fen_p256c = 0;
2015 ep->fen_p512c = 0;
2016 ep->fen_p1024c = 0;
2017
2018 ep->fen_rfthr = 0; /* Suggested by manual */
2019 ep->fen_rfcnt = 0;
2020 ep->fen_cftype = 0;
2021
2022 /* Now allocate the host memory pages and initialize the
2023 * buffer descriptors.
2024 */
2025 bdp = cep->tx_bd_base;
2026 for (i=0; i<TX_RING_SIZE; i++) {
2027
2028 /* Initialize the BD for every fragment in the page.
2029 */
2030 bdp->cbd_sc = 0;
2031 bdp->cbd_datlen = 0;
2032 bdp->cbd_bufaddr = 0;
2033 bdp++;
2034 }
2035
2036 /* Set the last buffer to wrap.
2037 */
2038 bdp--;
2039 bdp->cbd_sc |= BD_SC_WRAP;
2040
2041 bdp = cep->rx_bd_base;
2042 for (i=0; i<FCC_ENET_RX_PAGES; i++) {
2043
2044 /* Allocate a page.
2045 */
2046 mem_addr = __get_free_page(GFP_KERNEL);
2047
2048 /* Initialize the BD for every fragment in the page.
2049 */
2050 for (j=0; j<FCC_ENET_RX_FRPPG; j++) {
2051 bdp->cbd_sc = BD_ENET_RX_EMPTY | BD_ENET_RX_INTR;
2052 bdp->cbd_datlen = 0;
2053 bdp->cbd_bufaddr = __pa(mem_addr);
2054 mem_addr += FCC_ENET_RX_FRSIZE;
2055 bdp++;
2056 }
2057 }
2058
2059 /* Set the last buffer to wrap.
2060 */
2061 bdp--;
2062 bdp->cbd_sc |= BD_SC_WRAP;
2063
2064 /* Let's re-initialize the channel now. We have to do it later
2065 * than the manual describes because we have just now finished
2066 * the BD initialization.
2067 */
2068 cp->cp_cpcr = mk_cr_cmd(fip->fc_cpmpage, fip->fc_cpmblock, 0x0c,
2069 CPM_CR_INIT_TRX) | CPM_CR_FLG;
2070 while (cp->cp_cpcr & CPM_CR_FLG);
2071
2072 cep->skb_cur = cep->skb_dirty = 0;
2073}
2074
2075/* Let 'er rip.
2076*/
2077static void __init
2078init_fcc_startup(fcc_info_t *fip, struct net_device *dev)
2079{
2080 volatile fcc_t *fccp;
2081 struct fcc_enet_private *cep;
2082
2083 cep = (struct fcc_enet_private *)(dev->priv);
2084 fccp = cep->fccp;
2085
2086#ifdef CONFIG_RPX8260
2087#ifdef PHY_INTERRUPT
2088 /* Route PHY interrupt to IRQ. The following code only works for
2089 * IRQ1 - IRQ7. It does not work for Port C interrupts.
2090 */
2091 *((volatile u_char *) (RPX_CSR_ADDR + 13)) &= ~BCSR13_FETH_IRQMASK;
2092 *((volatile u_char *) (RPX_CSR_ADDR + 13)) |=
2093 ((PHY_INTERRUPT - SIU_INT_IRQ1 + 1) << 4);
2094#endif
2095 /* Initialize MDIO pins. */
2096 *((volatile u_char *) (RPX_CSR_ADDR + 4)) &= ~BCSR4_MII_MDC;
2097 *((volatile u_char *) (RPX_CSR_ADDR + 4)) |=
2098 BCSR4_MII_READ | BCSR4_MII_MDIO;
2099 /* Enable external LXT971 PHY. */
2100 *((volatile u_char *) (RPX_CSR_ADDR + 4)) |= BCSR4_EN_PHY;
2101 udelay(1000);
2102 *((volatile u_char *) (RPX_CSR_ADDR+ 4)) |= BCSR4_EN_MII;
2103 udelay(1000);
2104#endif /* ifdef CONFIG_RPX8260 */
2105
2106 fccp->fcc_fcce = 0xffff; /* Clear any pending events */
2107
2108 /* Leave FCC interrupts masked for now. Will be unmasked by
2109 * fcc_restart().
2110 */
2111 fccp->fcc_fccm = 0;
2112
2113 /* Install our interrupt handler.
2114 */
2115 if (request_irq(fip->fc_interrupt, fcc_enet_interrupt, 0, "fenet",
2116 dev) < 0)
2117 printk("Can't get FCC IRQ %d\n", fip->fc_interrupt);
2118
2119#ifdef PHY_INTERRUPT
2120#ifdef CONFIG_ADS8272
2121 if (request_irq(PHY_INTERRUPT, mii_link_interrupt, SA_SHIRQ,
2122 "mii", dev) < 0)
2123 printk(KERN_CRIT "Can't get MII IRQ %d\n", PHY_INTERRUPT);
2124#else
2125 /* Make IRQn edge triggered. This does not work if PHY_INTERRUPT is
2126 * on Port C.
2127 */
2128 ((volatile cpm2_map_t *) CPM_MAP_ADDR)->im_intctl.ic_siexr |=
2129 (1 << (14 - (PHY_INTERRUPT - SIU_INT_IRQ1)));
2130
2131 if (request_irq(PHY_INTERRUPT, mii_link_interrupt, 0,
2132 "mii", dev) < 0)
2133 printk(KERN_CRIT "Can't get MII IRQ %d\n", PHY_INTERRUPT);
2134#endif
2135#endif /* PHY_INTERRUPT */
2136
2137 /* Set GFMR to enable Ethernet operating mode.
2138 */
2139 fccp->fcc_gfmr = (FCC_GFMR_TCI | FCC_GFMR_MODE_ENET);
2140
2141 /* Set sync/delimiters.
2142 */
2143 fccp->fcc_fdsr = 0xd555;
2144
2145 /* Set protocol specific processing mode for Ethernet.
2146 * This has to be adjusted for Full Duplex operation after we can
2147 * determine how to detect that.
2148 */
2149 fccp->fcc_fpsmr = FCC_PSMR_ENCRC;
2150
2151#ifdef CONFIG_PQ2ADS
2152 /* Enable the PHY. */
2153 *(volatile uint *)(BCSR_ADDR + 4) &= ~BCSR1_FETHIEN;
2154 *(volatile uint *)(BCSR_ADDR + 4) |= BCSR1_FETH_RST;
2155#endif
2156#if defined(CONFIG_PQ2ADS) || defined(CONFIG_PQ2FADS)
2157 /* Enable the 2nd PHY. */
2158 *(volatile uint *)(BCSR_ADDR + 12) &= ~BCSR3_FETHIEN2;
2159 *(volatile uint *)(BCSR_ADDR + 12) |= BCSR3_FETH2_RST;
2160#endif
2161
2162#if defined(CONFIG_USE_MDIO) || defined(CONFIG_TQM8260)
2163 /* start in full duplex mode, and negotiate speed
2164 */
2165 fcc_restart (dev, 1);
2166#else
2167 /* start in half duplex mode
2168 */
2169 fcc_restart (dev, 0);
2170#endif
2171}
2172
2173#ifdef CONFIG_USE_MDIO
2174/* MII command/status interface.
2175 * I'm not going to describe all of the details. You can find the
2176 * protocol definition in many other places, including the data sheet
2177 * of most PHY parts.
2178 * I wonder what "they" were thinking (maybe weren't) when they leave
2179 * the I2C in the CPM but I have to toggle these bits......
2180 */
2181#ifdef CONFIG_RPX8260
2182 /* The EP8260 has the MDIO pins in a BCSR instead of on Port C
2183 * like most other boards.
2184 */
2185#define MDIO_ADDR ((volatile u_char *)(RPX_CSR_ADDR + 4))
2186#define MAKE_MDIO_OUTPUT *MDIO_ADDR &= ~BCSR4_MII_READ
2187#define MAKE_MDIO_INPUT *MDIO_ADDR |= BCSR4_MII_READ | BCSR4_MII_MDIO
2188#define OUT_MDIO(bit) \
2189 if (bit) \
2190 *MDIO_ADDR |= BCSR4_MII_MDIO; \
2191 else \
2192 *MDIO_ADDR &= ~BCSR4_MII_MDIO;
2193#define IN_MDIO (*MDIO_ADDR & BCSR4_MII_MDIO)
2194#define OUT_MDC(bit) \
2195 if (bit) \
2196 *MDIO_ADDR |= BCSR4_MII_MDC; \
2197 else \
2198 *MDIO_ADDR &= ~BCSR4_MII_MDC;
2199#else /* ifdef CONFIG_RPX8260 */
2200 /* This is for the usual case where the MDIO pins are on Port C.
2201 */
2202#define MDIO_ADDR (((volatile cpm2_map_t *)CPM_MAP_ADDR)->im_ioport)
2203#define MAKE_MDIO_OUTPUT MDIO_ADDR.iop_pdirc |= fip->fc_mdio
2204#define MAKE_MDIO_INPUT MDIO_ADDR.iop_pdirc &= ~fip->fc_mdio
2205#define OUT_MDIO(bit) \
2206 if (bit) \
2207 MDIO_ADDR.iop_pdatc |= fip->fc_mdio; \
2208 else \
2209 MDIO_ADDR.iop_pdatc &= ~fip->fc_mdio;
2210#define IN_MDIO ((MDIO_ADDR.iop_pdatc) & fip->fc_mdio)
2211#define OUT_MDC(bit) \
2212 if (bit) \
2213 MDIO_ADDR.iop_pdatc |= fip->fc_mdck; \
2214 else \
2215 MDIO_ADDR.iop_pdatc &= ~fip->fc_mdck;
2216#endif /* ifdef CONFIG_RPX8260 */
2217
2218static uint
2219mii_send_receive(fcc_info_t *fip, uint cmd)
2220{
2221 uint retval;
2222 int read_op, i, off;
2223 const int us = 1;
2224
2225 read_op = ((cmd & 0xf0000000) == 0x60000000);
2226
2227 /* Write preamble
2228 */
2229 OUT_MDIO(1);
2230 MAKE_MDIO_OUTPUT;
2231 OUT_MDIO(1);
2232 for (i = 0; i < 32; i++)
2233 {
2234 udelay(us);
2235 OUT_MDC(1);
2236 udelay(us);
2237 OUT_MDC(0);
2238 }
2239
2240 /* Write data
2241 */
2242 for (i = 0, off = 31; i < (read_op ? 14 : 32); i++, --off)
2243 {
2244 OUT_MDIO((cmd >> off) & 0x00000001);
2245 udelay(us);
2246 OUT_MDC(1);
2247 udelay(us);
2248 OUT_MDC(0);
2249 }
2250
2251 retval = cmd;
2252
2253 if (read_op)
2254 {
2255 retval >>= 16;
2256
2257 MAKE_MDIO_INPUT;
2258 udelay(us);
2259 OUT_MDC(1);
2260 udelay(us);
2261 OUT_MDC(0);
2262
2263 for (i = 0; i < 16; i++)
2264 {
2265 udelay(us);
2266 OUT_MDC(1);
2267 udelay(us);
2268 retval <<= 1;
2269 if (IN_MDIO)
2270 retval++;
2271 OUT_MDC(0);
2272 }
2273 }
2274
2275 MAKE_MDIO_INPUT;
2276 udelay(us);
2277 OUT_MDC(1);
2278 udelay(us);
2279 OUT_MDC(0);
2280
2281 return retval;
2282}
2283#endif /* CONFIG_USE_MDIO */
2284
2285static void
2286fcc_stop(struct net_device *dev)
2287{
2288 struct fcc_enet_private *fep= (struct fcc_enet_private *)(dev->priv);
2289 volatile fcc_t *fccp = fep->fccp;
2290 fcc_info_t *fip = fep->fip;
2291 volatile fcc_enet_t *ep = fep->ep;
2292 volatile cpm_cpm2_t *cp = cpmp;
2293 volatile cbd_t *bdp;
2294 int i;
2295
2296 if ((fccp->fcc_gfmr & (FCC_GFMR_ENR | FCC_GFMR_ENT)) == 0)
2297 return; /* already down */
2298
2299 fccp->fcc_fccm = 0;
2300
2301 /* issue the graceful stop tx command */
2302 while (cp->cp_cpcr & CPM_CR_FLG);
2303 cp->cp_cpcr = mk_cr_cmd(fip->fc_cpmpage, fip->fc_cpmblock,
2304 0x0c, CPM_CR_GRA_STOP_TX) | CPM_CR_FLG;
2305 while (cp->cp_cpcr & CPM_CR_FLG);
2306
2307 /* Disable transmit/receive */
2308 fccp->fcc_gfmr &= ~(FCC_GFMR_ENR | FCC_GFMR_ENT);
2309
2310 /* issue the restart tx command */
2311 fccp->fcc_fcce = FCC_ENET_GRA;
2312 while (cp->cp_cpcr & CPM_CR_FLG);
2313 cp->cp_cpcr = mk_cr_cmd(fip->fc_cpmpage, fip->fc_cpmblock,
2314 0x0c, CPM_CR_RESTART_TX) | CPM_CR_FLG;
2315 while (cp->cp_cpcr & CPM_CR_FLG);
2316
2317 /* free tx buffers */
2318 fep->skb_cur = fep->skb_dirty = 0;
2319 for (i=0; i<=TX_RING_MOD_MASK; i++) {
2320 if (fep->tx_skbuff[i] != NULL) {
2321 dev_kfree_skb(fep->tx_skbuff[i]);
2322 fep->tx_skbuff[i] = NULL;
2323 }
2324 }
2325 fep->dirty_tx = fep->cur_tx = fep->tx_bd_base;
2326 fep->tx_free = TX_RING_SIZE;
2327 ep->fen_genfcc.fcc_tbptr = ep->fen_genfcc.fcc_tbase;
2328
2329 /* Initialize the tx buffer descriptors. */
2330 bdp = fep->tx_bd_base;
2331 for (i=0; i<TX_RING_SIZE; i++) {
2332 bdp->cbd_sc = 0;
2333 bdp->cbd_datlen = 0;
2334 bdp->cbd_bufaddr = 0;
2335 bdp++;
2336 }
2337 /* Set the last buffer to wrap. */
2338 bdp--;
2339 bdp->cbd_sc |= BD_SC_WRAP;
2340}
2341
2342static void
2343fcc_restart(struct net_device *dev, int duplex)
2344{
2345 struct fcc_enet_private *fep = (struct fcc_enet_private *)(dev->priv);
2346 volatile fcc_t *fccp = fep->fccp;
2347
2348 /* stop any transmissions in progress */
2349 fcc_stop(dev);
2350
2351 if (duplex)
2352 fccp->fcc_fpsmr |= FCC_PSMR_FDE | FCC_PSMR_LPB;
2353 else
2354 fccp->fcc_fpsmr &= ~(FCC_PSMR_FDE | FCC_PSMR_LPB);
2355
2356 /* Enable interrupts for transmit error, complete frame
2357 * received, and any transmit buffer we have also set the
2358 * interrupt flag.
2359 */
2360 fccp->fcc_fccm = (FCC_ENET_TXE | FCC_ENET_RXF | FCC_ENET_TXB);
2361
2362 /* Enable transmit/receive */
2363 fccp->fcc_gfmr |= FCC_GFMR_ENR | FCC_GFMR_ENT;
2364}
2365
2366static int
2367fcc_enet_open(struct net_device *dev)
2368{
2369 struct fcc_enet_private *fep = dev->priv;
2370
2371#ifdef CONFIG_USE_MDIO
2372 fep->sequence_done = 0;
2373 fep->link = 0;
2374
2375 if (fep->phy) {
2376 fcc_restart(dev, 0); /* always start in half-duplex */
2377 mii_do_cmd(dev, fep->phy->ack_int);
2378 mii_do_cmd(dev, fep->phy->config);
2379 mii_do_cmd(dev, phy_cmd_config); /* display configuration */
2380 while(!fep->sequence_done)
2381 schedule();
2382
2383 mii_do_cmd(dev, fep->phy->startup);
2384 netif_start_queue(dev);
2385 return 0; /* Success */
2386 }
2387 return -ENODEV; /* No PHY we understand */
2388#else
2389 fep->link = 1;
2390 fcc_restart(dev, 0); /* always start in half-duplex */
2391 netif_start_queue(dev);
2392 return 0; /* Always succeed */
2393#endif /* CONFIG_USE_MDIO */
2394}
2395
diff --git a/arch/ppc/8xx_io/Kconfig b/arch/ppc/8xx_io/Kconfig
new file mode 100644
index 000000000000..9e2227ec3b34
--- /dev/null
+++ b/arch/ppc/8xx_io/Kconfig
@@ -0,0 +1,138 @@
1#
2# MPC8xx Communication options
3#
4
5menu "MPC8xx CPM Options"
6 depends on 8xx
7
8config SCC_ENET
9 bool "CPM SCC Ethernet"
10 depends on NET_ETHERNET
11 help
12 Enable Ethernet support via the Motorola MPC8xx serial
13 communications controller.
14
15choice
16 prompt "SCC used for Ethernet"
17 depends on SCC_ENET
18 default SCC1_ENET
19
20config SCC1_ENET
21 bool "SCC1"
22 help
23 Use MPC8xx serial communications controller 1 to drive Ethernet
24 (default).
25
26config SCC2_ENET
27 bool "SCC2"
28 help
29 Use MPC8xx serial communications controller 2 to drive Ethernet.
30
31config SCC3_ENET
32 bool "SCC3"
33 help
34 Use MPC8xx serial communications controller 3 to drive Ethernet.
35
36endchoice
37
38config FEC_ENET
39 bool "860T FEC Ethernet"
40 depends on NET_ETHERNET
41 help
42 Enable Ethernet support via the Fast Ethernet Controller (FCC) on
43 the Motorola MPC8260.
44
45config USE_MDIO
46 bool "Use MDIO for PHY configuration"
47 depends on FEC_ENET
48 help
49 On some boards the hardware configuration of the ethernet PHY can be
50 used without any software interaction over the MDIO interface, so
51 all MII code can be omitted. Say N here if unsure or if you don't
52 need link status reports.
53
54config FEC_AM79C874
55 bool "Support AMD79C874 PHY"
56 depends on USE_MDIO
57
58config FEC_LXT970
59 bool "Support LXT970 PHY"
60 depends on USE_MDIO
61
62config FEC_LXT971
63 bool "Support LXT971 PHY"
64 depends on USE_MDIO
65
66config FEC_QS6612
67 bool "Support QS6612 PHY"
68 depends on USE_MDIO
69
70config ENET_BIG_BUFFERS
71 bool "Use Big CPM Ethernet Buffers"
72 depends on NET_ETHERNET
73 help
74 Allocate large buffers for MPC8xx Etherenet. Increases throughput
75 and decreases the likelihood of dropped packets, but costs memory.
76
77config HTDMSOUND
78 bool "Embedded Planet HIOX Audio"
79 depends on SOUND=y
80
81# This doesn't really belong here, but it is convenient to ask
82# 8xx specific questions.
83comment "Generic MPC8xx Options"
84
85config 8xx_COPYBACK
86 bool "Copy-Back Data Cache (else Writethrough)"
87 help
88 Saying Y here will cause the cache on an MPC8xx processor to be used
89 in Copy-Back mode. If you say N here, it is used in Writethrough
90 mode.
91
92 If in doubt, say Y here.
93
94config 8xx_CPU6
95 bool "CPU6 Silicon Errata (860 Pre Rev. C)"
96 help
97 MPC860 CPUs, prior to Rev C have some bugs in the silicon, which
98 require workarounds for Linux (and most other OSes to work). If you
99 get a BUG() very early in boot, this might fix the problem. For
100 more details read the document entitled "MPC860 Family Device Errata
101 Reference" on Motorola's website. This option also incurs a
102 performance hit.
103
104 If in doubt, say N here.
105
106choice
107 prompt "Microcode patch selection"
108 default NO_UCODE_PATCH
109 help
110 Help not implemented yet, coming soon.
111
112config NO_UCODE_PATCH
113 bool "None"
114
115config USB_SOF_UCODE_PATCH
116 bool "USB SOF patch"
117 help
118 Help not implemented yet, coming soon.
119
120config I2C_SPI_UCODE_PATCH
121 bool "I2C/SPI relocation patch"
122 help
123 Help not implemented yet, coming soon.
124
125config I2C_SPI_SMC1_UCODE_PATCH
126 bool "I2C/SPI/SMC1 relocation patch"
127 help
128 Help not implemented yet, coming soon.
129
130endchoice
131
132config UCODE_PATCH
133 bool
134 default y
135 depends on !NO_UCODE_PATCH
136
137endmenu
138
diff --git a/arch/ppc/8xx_io/Makefile b/arch/ppc/8xx_io/Makefile
new file mode 100644
index 000000000000..d8760181fe99
--- /dev/null
+++ b/arch/ppc/8xx_io/Makefile
@@ -0,0 +1,10 @@
1#
2# Makefile for the linux MPC8xx ppc-specific parts of comm processor
3#
4
5obj-y := commproc.o
6
7obj-$(CONFIG_FEC_ENET) += fec.o
8obj-$(CONFIG_SCC_ENET) += enet.o
9obj-$(CONFIG_UCODE_PATCH) += micropatch.o
10obj-$(CONFIG_HTDMSOUND) += cs4218_tdm.o
diff --git a/arch/ppc/8xx_io/commproc.c b/arch/ppc/8xx_io/commproc.c
new file mode 100644
index 000000000000..0cc2e7a9cb11
--- /dev/null
+++ b/arch/ppc/8xx_io/commproc.c
@@ -0,0 +1,464 @@
1/*
2 * General Purpose functions for the global management of the
3 * Communication Processor Module.
4 * Copyright (c) 1997 Dan Malek (dmalek@jlc.net)
5 *
6 * In addition to the individual control of the communication
7 * channels, there are a few functions that globally affect the
8 * communication processor.
9 *
10 * Buffer descriptors must be allocated from the dual ported memory
11 * space. The allocator for that is here. When the communication
12 * process is reset, we reclaim the memory available. There is
13 * currently no deallocator for this memory.
14 * The amount of space available is platform dependent. On the
15 * MBX, the EPPC software loads additional microcode into the
16 * communication processor, and uses some of the DP ram for this
17 * purpose. Current, the first 512 bytes and the last 256 bytes of
18 * memory are used. Right now I am conservative and only use the
19 * memory that can never be used for microcode. If there are
20 * applications that require more DP ram, we can expand the boundaries
21 * but then we have to be careful of any downloaded microcode.
22 */
23#include <linux/errno.h>
24#include <linux/sched.h>
25#include <linux/kernel.h>
26#include <linux/dma-mapping.h>
27#include <linux/param.h>
28#include <linux/string.h>
29#include <linux/mm.h>
30#include <linux/interrupt.h>
31#include <linux/irq.h>
32#include <linux/module.h>
33#include <asm/mpc8xx.h>
34#include <asm/page.h>
35#include <asm/pgtable.h>
36#include <asm/8xx_immap.h>
37#include <asm/commproc.h>
38#include <asm/io.h>
39#include <asm/tlbflush.h>
40#include <asm/rheap.h>
41
42extern int get_pteptr(struct mm_struct *mm, unsigned long addr, pte_t **ptep);
43
44static void m8xx_cpm_dpinit(void);
45static uint host_buffer; /* One page of host buffer */
46static uint host_end; /* end + 1 */
47cpm8xx_t *cpmp; /* Pointer to comm processor space */
48
49/* CPM interrupt vector functions.
50*/
51struct cpm_action {
52 void (*handler)(void *, struct pt_regs * regs);
53 void *dev_id;
54};
55static struct cpm_action cpm_vecs[CPMVEC_NR];
56static irqreturn_t cpm_interrupt(int irq, void * dev, struct pt_regs * regs);
57static irqreturn_t cpm_error_interrupt(int irq, void *dev, struct pt_regs * regs);
58static void alloc_host_memory(void);
59/* Define a table of names to identify CPM interrupt handlers in
60 * /proc/interrupts.
61 */
62const char *cpm_int_name[] =
63 { "error", "PC4", "PC5", "SMC2",
64 "SMC1", "SPI", "PC6", "Timer 4",
65 "", "PC7", "PC8", "PC9",
66 "Timer 3", "", "PC10", "PC11",
67 "I2C", "RISC Timer", "Timer 2", "",
68 "IDMA2", "IDMA1", "SDMA error", "PC12",
69 "PC13", "Timer 1", "PC14", "SCC4",
70 "SCC3", "SCC2", "SCC1", "PC15"
71 };
72
73static void
74cpm_mask_irq(unsigned int irq)
75{
76 int cpm_vec = irq - CPM_IRQ_OFFSET;
77
78 ((immap_t *)IMAP_ADDR)->im_cpic.cpic_cimr &= ~(1 << cpm_vec);
79}
80
81static void
82cpm_unmask_irq(unsigned int irq)
83{
84 int cpm_vec = irq - CPM_IRQ_OFFSET;
85
86 ((immap_t *)IMAP_ADDR)->im_cpic.cpic_cimr |= (1 << cpm_vec);
87}
88
89static void
90cpm_ack(unsigned int irq)
91{
92 /* We do not need to do anything here. */
93}
94
95static void
96cpm_eoi(unsigned int irq)
97{
98 int cpm_vec = irq - CPM_IRQ_OFFSET;
99
100 ((immap_t *)IMAP_ADDR)->im_cpic.cpic_cisr = (1 << cpm_vec);
101}
102
103struct hw_interrupt_type cpm_pic = {
104 .typename = " CPM ",
105 .enable = cpm_unmask_irq,
106 .disable = cpm_mask_irq,
107 .ack = cpm_ack,
108 .end = cpm_eoi,
109};
110
111extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr);
112
113void
114m8xx_cpm_reset(uint bootpage)
115{
116 volatile immap_t *imp;
117 volatile cpm8xx_t *commproc;
118 pte_t *pte;
119
120 imp = (immap_t *)IMAP_ADDR;
121 commproc = (cpm8xx_t *)&imp->im_cpm;
122
123#ifdef CONFIG_UCODE_PATCH
124 /* Perform a reset.
125 */
126 commproc->cp_cpcr = (CPM_CR_RST | CPM_CR_FLG);
127
128 /* Wait for it.
129 */
130 while (commproc->cp_cpcr & CPM_CR_FLG);
131
132 cpm_load_patch(imp);
133#endif
134
135 /* Set SDMA Bus Request priority 5.
136 * On 860T, this also enables FEC priority 6. I am not sure
137 * this is what we realy want for some applications, but the
138 * manual recommends it.
139 * Bit 25, FAM can also be set to use FEC aggressive mode (860T).
140 */
141 imp->im_siu_conf.sc_sdcr = 1;
142
143 /* Reclaim the DP memory for our use. */
144 m8xx_cpm_dpinit();
145
146 /* get the PTE for the bootpage */
147 if (!get_pteptr(&init_mm, bootpage, &pte))
148 panic("get_pteptr failed\n");
149
150 /* and make it uncachable */
151 pte_val(*pte) |= _PAGE_NO_CACHE;
152 _tlbie(bootpage);
153
154 host_buffer = bootpage;
155 host_end = host_buffer + PAGE_SIZE;
156
157 /* Tell everyone where the comm processor resides.
158 */
159 cpmp = (cpm8xx_t *)commproc;
160}
161
162/* We used to do this earlier, but have to postpone as long as possible
163 * to ensure the kernel VM is now running.
164 */
165static void
166alloc_host_memory(void)
167{
168 dma_addr_t physaddr;
169
170 /* Set the host page for allocation.
171 */
172 host_buffer = (uint)dma_alloc_coherent(NULL, PAGE_SIZE, &physaddr,
173 GFP_KERNEL);
174 host_end = host_buffer + PAGE_SIZE;
175}
176
177/* This is called during init_IRQ. We used to do it above, but this
178 * was too early since init_IRQ was not yet called.
179 */
180static struct irqaction cpm_error_irqaction = {
181 .handler = cpm_error_interrupt,
182 .mask = CPU_MASK_NONE,
183};
184static struct irqaction cpm_interrupt_irqaction = {
185 .handler = cpm_interrupt,
186 .mask = CPU_MASK_NONE,
187 .name = "CPM cascade",
188};
189
190void
191cpm_interrupt_init(void)
192{
193 int i;
194
195 /* Initialize the CPM interrupt controller.
196 */
197 ((immap_t *)IMAP_ADDR)->im_cpic.cpic_cicr =
198 (CICR_SCD_SCC4 | CICR_SCC_SCC3 | CICR_SCB_SCC2 | CICR_SCA_SCC1) |
199 ((CPM_INTERRUPT/2) << 13) | CICR_HP_MASK;
200 ((immap_t *)IMAP_ADDR)->im_cpic.cpic_cimr = 0;
201
202 /* install the CPM interrupt controller routines for the CPM
203 * interrupt vectors
204 */
205 for ( i = CPM_IRQ_OFFSET ; i < CPM_IRQ_OFFSET + NR_CPM_INTS ; i++ )
206 irq_desc[i].handler = &cpm_pic;
207
208 /* Set our interrupt handler with the core CPU. */
209 if (setup_irq(CPM_INTERRUPT, &cpm_interrupt_irqaction))
210 panic("Could not allocate CPM IRQ!");
211
212 /* Install our own error handler. */
213 cpm_error_irqaction.name = cpm_int_name[CPMVEC_ERROR];
214 if (setup_irq(CPM_IRQ_OFFSET + CPMVEC_ERROR, &cpm_error_irqaction))
215 panic("Could not allocate CPM error IRQ!");
216
217 ((immap_t *)IMAP_ADDR)->im_cpic.cpic_cicr |= CICR_IEN;
218}
219
220/*
221 * Get the CPM interrupt vector.
222 */
223int
224cpm_get_irq(struct pt_regs *regs)
225{
226 int cpm_vec;
227
228 /* Get the vector by setting the ACK bit and then reading
229 * the register.
230 */
231 ((volatile immap_t *)IMAP_ADDR)->im_cpic.cpic_civr = 1;
232 cpm_vec = ((volatile immap_t *)IMAP_ADDR)->im_cpic.cpic_civr;
233 cpm_vec >>= 11;
234
235 return cpm_vec;
236}
237
238/* CPM interrupt controller cascade interrupt.
239*/
240static irqreturn_t
241cpm_interrupt(int irq, void * dev, struct pt_regs * regs)
242{
243 /* This interrupt handler never actually gets called. It is
244 * installed only to unmask the CPM cascade interrupt in the SIU
245 * and to make the CPM cascade interrupt visible in /proc/interrupts.
246 */
247 return IRQ_HANDLED;
248}
249
250/* The CPM can generate the error interrupt when there is a race condition
251 * between generating and masking interrupts. All we have to do is ACK it
252 * and return. This is a no-op function so we don't need any special
253 * tests in the interrupt handler.
254 */
255static irqreturn_t
256cpm_error_interrupt(int irq, void *dev, struct pt_regs *regs)
257{
258 return IRQ_HANDLED;
259}
260
261/* A helper function to translate the handler prototype required by
262 * request_irq() to the handler prototype required by cpm_install_handler().
263 */
264static irqreturn_t
265cpm_handler_helper(int irq, void *dev_id, struct pt_regs *regs)
266{
267 int cpm_vec = irq - CPM_IRQ_OFFSET;
268
269 (*cpm_vecs[cpm_vec].handler)(dev_id, regs);
270
271 return IRQ_HANDLED;
272}
273
274/* Install a CPM interrupt handler.
275 * This routine accepts a CPM interrupt vector in the range 0 to 31.
276 * This routine is retained for backward compatibility. Rather than using
277 * this routine to install a CPM interrupt handler, you can now use
278 * request_irq() with an IRQ in the range CPM_IRQ_OFFSET to
279 * CPM_IRQ_OFFSET + NR_CPM_INTS - 1 (16 to 47).
280 *
281 * Notice that the prototype of the interrupt handler function must be
282 * different depending on whether you install the handler with
283 * request_irq() or cpm_install_handler().
284 */
285void
286cpm_install_handler(int cpm_vec, void (*handler)(void *, struct pt_regs *regs),
287 void *dev_id)
288{
289 int err;
290
291 /* If null handler, assume we are trying to free the IRQ.
292 */
293 if (!handler) {
294 free_irq(CPM_IRQ_OFFSET + cpm_vec, dev_id);
295 return;
296 }
297
298 if (cpm_vecs[cpm_vec].handler != 0)
299 printk(KERN_INFO "CPM interrupt %x replacing %x\n",
300 (uint)handler, (uint)cpm_vecs[cpm_vec].handler);
301 cpm_vecs[cpm_vec].handler = handler;
302 cpm_vecs[cpm_vec].dev_id = dev_id;
303
304 if ((err = request_irq(CPM_IRQ_OFFSET + cpm_vec, cpm_handler_helper,
305 0, cpm_int_name[cpm_vec], dev_id)))
306 printk(KERN_ERR "request_irq() returned %d for CPM vector %d\n",
307 err, cpm_vec);
308}
309
310/* Free a CPM interrupt handler.
311 * This routine accepts a CPM interrupt vector in the range 0 to 31.
312 * This routine is retained for backward compatibility.
313 */
314void
315cpm_free_handler(int cpm_vec)
316{
317 request_irq(CPM_IRQ_OFFSET + cpm_vec, NULL, 0, 0,
318 cpm_vecs[cpm_vec].dev_id);
319
320 cpm_vecs[cpm_vec].handler = NULL;
321 cpm_vecs[cpm_vec].dev_id = NULL;
322}
323
324/* We also own one page of host buffer space for the allocation of
325 * UART "fifos" and the like.
326 */
327uint
328m8xx_cpm_hostalloc(uint size)
329{
330 uint retloc;
331
332 if (host_buffer == 0)
333 alloc_host_memory();
334
335 if ((host_buffer + size) >= host_end)
336 return(0);
337
338 retloc = host_buffer;
339 host_buffer += size;
340
341 return(retloc);
342}
343
344/* Set a baud rate generator. This needs lots of work. There are
345 * four BRGs, any of which can be wired to any channel.
346 * The internal baud rate clock is the system clock divided by 16.
347 * This assumes the baudrate is 16x oversampled by the uart.
348 */
349#define BRG_INT_CLK (((bd_t *)__res)->bi_intfreq)
350#define BRG_UART_CLK (BRG_INT_CLK/16)
351#define BRG_UART_CLK_DIV16 (BRG_UART_CLK/16)
352
353void
354cpm_setbrg(uint brg, uint rate)
355{
356 volatile uint *bp;
357
358 /* This is good enough to get SMCs running.....
359 */
360 bp = (uint *)&cpmp->cp_brgc1;
361 bp += brg;
362 /* The BRG has a 12-bit counter. For really slow baud rates (or
363 * really fast processors), we may have to further divide by 16.
364 */
365 if (((BRG_UART_CLK / rate) - 1) < 4096)
366 *bp = (((BRG_UART_CLK / rate) - 1) << 1) | CPM_BRG_EN;
367 else
368 *bp = (((BRG_UART_CLK_DIV16 / rate) - 1) << 1) |
369 CPM_BRG_EN | CPM_BRG_DIV16;
370}
371
372/*
373 * dpalloc / dpfree bits.
374 */
375static spinlock_t cpm_dpmem_lock;
376/*
377 * 16 blocks should be enough to satisfy all requests
378 * until the memory subsystem goes up...
379 */
380static rh_block_t cpm_boot_dpmem_rh_block[16];
381static rh_info_t cpm_dpmem_info;
382
383#define CPM_DPMEM_ALIGNMENT 8
384
385void m8xx_cpm_dpinit(void)
386{
387 cpm8xx_t *cp = &((immap_t *)IMAP_ADDR)->im_cpm;
388
389 spin_lock_init(&cpm_dpmem_lock);
390
391 /* Initialize the info header */
392 rh_init(&cpm_dpmem_info, CPM_DPMEM_ALIGNMENT,
393 sizeof(cpm_boot_dpmem_rh_block) /
394 sizeof(cpm_boot_dpmem_rh_block[0]),
395 cpm_boot_dpmem_rh_block);
396
397 /*
398 * Attach the usable dpmem area.
399 * XXX: This is actually crap. CPM_DATAONLY_BASE and
400 * CPM_DATAONLY_SIZE are a subset of the available dparm. It varies
401 * with the processor and the microcode patches applied / activated.
402 * But the following should be at least safe.
403 */
404 rh_attach_region(&cpm_dpmem_info, (void *)CPM_DATAONLY_BASE, CPM_DATAONLY_SIZE);
405}
406
407/*
408 * Allocate the requested size worth of DP memory.
409 * This function used to return an index into the DPRAM area.
410 * Now it returns the actuall physical address of that area.
411 * use m8xx_cpm_dpram_offset() to get the index
412 */
413uint cpm_dpalloc(uint size, uint align)
414{
415 void *start;
416 unsigned long flags;
417
418 spin_lock_irqsave(&cpm_dpmem_lock, flags);
419 cpm_dpmem_info.alignment = align;
420 start = rh_alloc(&cpm_dpmem_info, size, "commproc");
421 spin_unlock_irqrestore(&cpm_dpmem_lock, flags);
422
423 return (uint)start;
424}
425EXPORT_SYMBOL(cpm_dpalloc);
426
427int cpm_dpfree(uint offset)
428{
429 int ret;
430 unsigned long flags;
431
432 spin_lock_irqsave(&cpm_dpmem_lock, flags);
433 ret = rh_free(&cpm_dpmem_info, (void *)offset);
434 spin_unlock_irqrestore(&cpm_dpmem_lock, flags);
435
436 return ret;
437}
438EXPORT_SYMBOL(cpm_dpfree);
439
440uint cpm_dpalloc_fixed(uint offset, uint size, uint align)
441{
442 void *start;
443 unsigned long flags;
444
445 spin_lock_irqsave(&cpm_dpmem_lock, flags);
446 cpm_dpmem_info.alignment = align;
447 start = rh_alloc_fixed(&cpm_dpmem_info, (void *)offset, size, "commproc");
448 spin_unlock_irqrestore(&cpm_dpmem_lock, flags);
449
450 return (uint)start;
451}
452EXPORT_SYMBOL(cpm_dpalloc_fixed);
453
454void cpm_dpdump(void)
455{
456 rh_dump(&cpm_dpmem_info);
457}
458EXPORT_SYMBOL(cpm_dpdump);
459
460void *cpm_dpram_addr(uint offset)
461{
462 return ((immap_t *)IMAP_ADDR)->im_cpm.cp_dpmem + offset;
463}
464EXPORT_SYMBOL(cpm_dpram_addr);
diff --git a/arch/ppc/8xx_io/cs4218.h b/arch/ppc/8xx_io/cs4218.h
new file mode 100644
index 000000000000..a3c38c5a5db2
--- /dev/null
+++ b/arch/ppc/8xx_io/cs4218.h
@@ -0,0 +1,167 @@
1#ifndef _cs4218_h_
2/*
3 * Hacked version of linux/drivers/sound/dmasound/dmasound.h
4 *
5 *
6 * Minor numbers for the sound driver.
7 *
8 * Unfortunately Creative called the codec chip of SB as a DSP. For this
9 * reason the /dev/dsp is reserved for digitized audio use. There is a
10 * device for true DSP processors but it will be called something else.
11 * In v3.0 it's /dev/sndproc but this could be a temporary solution.
12 */
13#define _cs4218_h_
14
15#include <linux/types.h>
16#include <linux/config.h>
17
18#define SND_NDEVS 256 /* Number of supported devices */
19#define SND_DEV_CTL 0 /* Control port /dev/mixer */
20#define SND_DEV_SEQ 1 /* Sequencer output /dev/sequencer (FM
21 synthesizer and MIDI output) */
22#define SND_DEV_MIDIN 2 /* Raw midi access */
23#define SND_DEV_DSP 3 /* Digitized voice /dev/dsp */
24#define SND_DEV_AUDIO 4 /* Sparc compatible /dev/audio */
25#define SND_DEV_DSP16 5 /* Like /dev/dsp but 16 bits/sample */
26#define SND_DEV_STATUS 6 /* /dev/sndstat */
27/* #7 not in use now. Was in 2.4. Free for use after v3.0. */
28#define SND_DEV_SEQ2 8 /* /dev/sequencer, level 2 interface */
29#define SND_DEV_SNDPROC 9 /* /dev/sndproc for programmable devices */
30#define SND_DEV_PSS SND_DEV_SNDPROC
31
32/* switch on various prinks */
33#define DEBUG_DMASOUND 1
34
35#define MAX_AUDIO_DEV 5
36#define MAX_MIXER_DEV 4
37#define MAX_SYNTH_DEV 3
38#define MAX_MIDI_DEV 6
39#define MAX_TIMER_DEV 3
40
41#define MAX_CATCH_RADIUS 10
42
43#define le2be16(x) (((x)<<8 & 0xff00) | ((x)>>8 & 0x00ff))
44#define le2be16dbl(x) (((x)<<8 & 0xff00ff00) | ((x)>>8 & 0x00ff00ff))
45
46#define IOCTL_IN(arg, ret) \
47 do { int error = get_user(ret, (int *)(arg)); \
48 if (error) return error; \
49 } while (0)
50#define IOCTL_OUT(arg, ret) ioctl_return((int *)(arg), ret)
51
52static inline int ioctl_return(int *addr, int value)
53{
54 return value < 0 ? value : put_user(value, addr);
55}
56
57#define HAS_RECORD
58
59 /*
60 * Initialization
61 */
62
63/* description of the set-up applies to either hard or soft settings */
64
65typedef struct {
66 int format; /* AFMT_* */
67 int stereo; /* 0 = mono, 1 = stereo */
68 int size; /* 8/16 bit*/
69 int speed; /* speed */
70} SETTINGS;
71
72 /*
73 * Machine definitions
74 */
75
76typedef struct {
77 const char *name;
78 const char *name2;
79 void (*open)(void);
80 void (*release)(void);
81 void *(*dma_alloc)(unsigned int, int);
82 void (*dma_free)(void *, unsigned int);
83 int (*irqinit)(void);
84#ifdef MODULE
85 void (*irqcleanup)(void);
86#endif
87 void (*init)(void);
88 void (*silence)(void);
89 int (*setFormat)(int);
90 int (*setVolume)(int);
91 int (*setBass)(int);
92 int (*setTreble)(int);
93 int (*setGain)(int);
94 void (*play)(void);
95 void (*record)(void); /* optional */
96 void (*mixer_init)(void); /* optional */
97 int (*mixer_ioctl)(u_int, u_long); /* optional */
98 int (*write_sq_setup)(void); /* optional */
99 int (*read_sq_setup)(void); /* optional */
100 int (*sq_open)(mode_t); /* optional */
101 int (*state_info)(char *, size_t); /* optional */
102 void (*abort_read)(void); /* optional */
103 int min_dsp_speed;
104 int max_dsp_speed;
105 int version ;
106 int hardware_afmts ; /* OSS says we only return h'ware info */
107 /* when queried via SNDCTL_DSP_GETFMTS */
108 int capabilities ; /* low-level reply to SNDCTL_DSP_GETCAPS */
109 SETTINGS default_hard ; /* open() or init() should set something valid */
110 SETTINGS default_soft ; /* you can make it look like old OSS, if you want to */
111} MACHINE;
112
113 /*
114 * Low level stuff
115 */
116
117typedef struct {
118 ssize_t (*ct_ulaw)(const u_char *, size_t, u_char *, ssize_t *, ssize_t);
119 ssize_t (*ct_alaw)(const u_char *, size_t, u_char *, ssize_t *, ssize_t);
120 ssize_t (*ct_s8)(const u_char *, size_t, u_char *, ssize_t *, ssize_t);
121 ssize_t (*ct_u8)(const u_char *, size_t, u_char *, ssize_t *, ssize_t);
122 ssize_t (*ct_s16be)(const u_char *, size_t, u_char *, ssize_t *, ssize_t);
123 ssize_t (*ct_u16be)(const u_char *, size_t, u_char *, ssize_t *, ssize_t);
124 ssize_t (*ct_s16le)(const u_char *, size_t, u_char *, ssize_t *, ssize_t);
125 ssize_t (*ct_u16le)(const u_char *, size_t, u_char *, ssize_t *, ssize_t);
126} TRANS;
127
128
129 /*
130 * Sound queue stuff, the heart of the driver
131 */
132
133struct sound_queue {
134 /* buffers allocated for this queue */
135 int numBufs; /* real limits on what the user can have */
136 int bufSize; /* in bytes */
137 char **buffers;
138
139 /* current parameters */
140 int locked ; /* params cannot be modified when != 0 */
141 int user_frags ; /* user requests this many */
142 int user_frag_size ; /* of this size */
143 int max_count; /* actual # fragments <= numBufs */
144 int block_size; /* internal block size in bytes */
145 int max_active; /* in-use fragments <= max_count */
146
147 /* it shouldn't be necessary to declare any of these volatile */
148 int front, rear, count;
149 int rear_size;
150 /*
151 * The use of the playing field depends on the hardware
152 *
153 * Atari, PMac: The number of frames that are loaded/playing
154 *
155 * Amiga: Bit 0 is set: a frame is loaded
156 * Bit 1 is set: a frame is playing
157 */
158 int active;
159 wait_queue_head_t action_queue, open_queue, sync_queue;
160 int open_mode;
161 int busy, syncing, xruns, died;
162};
163
164#define SLEEP(queue) interruptible_sleep_on_timeout(&queue, HZ)
165#define WAKE_UP(queue) (wake_up_interruptible(&queue))
166
167#endif /* _cs4218_h_ */
diff --git a/arch/ppc/8xx_io/cs4218_tdm.c b/arch/ppc/8xx_io/cs4218_tdm.c
new file mode 100644
index 000000000000..89fe0ceeaa40
--- /dev/null
+++ b/arch/ppc/8xx_io/cs4218_tdm.c
@@ -0,0 +1,2836 @@
1
2/* This is a modified version of linux/drivers/sound/dmasound.c to
3 * support the CS4218 codec on the 8xx TDM port. Thanks to everyone
4 * that contributed to the dmasound software (which includes me :-).
5 *
6 * The CS4218 is configured in Mode 4, sub-mode 0. This provides
7 * left/right data only on the TDM port, as a 32-bit word, per frame
8 * pulse. The control of the CS4218 is provided by some other means,
9 * like the SPI port.
10 * Dan Malek (dmalek@jlc.net)
11 */
12
13#include <linux/module.h>
14#include <linux/sched.h>
15#include <linux/timer.h>
16#include <linux/major.h>
17#include <linux/config.h>
18#include <linux/fcntl.h>
19#include <linux/errno.h>
20#include <linux/mm.h>
21#include <linux/slab.h>
22#include <linux/sound.h>
23#include <linux/init.h>
24#include <linux/delay.h>
25
26#include <asm/system.h>
27#include <asm/irq.h>
28#include <asm/pgtable.h>
29#include <asm/uaccess.h>
30#include <asm/io.h>
31
32/* Should probably do something different with this path name.....
33 * Actually, I should just stop using it...
34 */
35#include "cs4218.h"
36#include <linux/soundcard.h>
37
38#include <asm/mpc8xx.h>
39#include <asm/8xx_immap.h>
40#include <asm/commproc.h>
41
42#define DMASND_CS4218 5
43
44#define MAX_CATCH_RADIUS 10
45#define MIN_BUFFERS 4
46#define MIN_BUFSIZE 4
47#define MAX_BUFSIZE 128
48
49#define HAS_8BIT_TABLES
50
51static int sq_unit = -1;
52static int mixer_unit = -1;
53static int state_unit = -1;
54static int irq_installed = 0;
55static char **sound_buffers = NULL;
56static char **sound_read_buffers = NULL;
57
58static DEFINE_SPINLOCK(cs4218_lock);
59
60/* Local copies of things we put in the control register. Output
61 * volume, like most codecs is really attenuation.
62 */
63static int cs4218_rate_index;
64
65/*
66 * Stuff for outputting a beep. The values range from -327 to +327
67 * so we can multiply by an amplitude in the range 0..100 to get a
68 * signed short value to put in the output buffer.
69 */
70static short beep_wform[256] = {
71 0, 40, 79, 117, 153, 187, 218, 245,
72 269, 288, 304, 316, 323, 327, 327, 324,
73 318, 310, 299, 288, 275, 262, 249, 236,
74 224, 213, 204, 196, 190, 186, 183, 182,
75 182, 183, 186, 189, 192, 196, 200, 203,
76 206, 208, 209, 209, 209, 207, 204, 201,
77 197, 193, 188, 183, 179, 174, 170, 166,
78 163, 161, 160, 159, 159, 160, 161, 162,
79 164, 166, 168, 169, 171, 171, 171, 170,
80 169, 167, 163, 159, 155, 150, 144, 139,
81 133, 128, 122, 117, 113, 110, 107, 105,
82 103, 103, 103, 103, 104, 104, 105, 105,
83 105, 103, 101, 97, 92, 86, 78, 68,
84 58, 45, 32, 18, 3, -11, -26, -41,
85 -55, -68, -79, -88, -95, -100, -102, -102,
86 -99, -93, -85, -75, -62, -48, -33, -16,
87 0, 16, 33, 48, 62, 75, 85, 93,
88 99, 102, 102, 100, 95, 88, 79, 68,
89 55, 41, 26, 11, -3, -18, -32, -45,
90 -58, -68, -78, -86, -92, -97, -101, -103,
91 -105, -105, -105, -104, -104, -103, -103, -103,
92 -103, -105, -107, -110, -113, -117, -122, -128,
93 -133, -139, -144, -150, -155, -159, -163, -167,
94 -169, -170, -171, -171, -171, -169, -168, -166,
95 -164, -162, -161, -160, -159, -159, -160, -161,
96 -163, -166, -170, -174, -179, -183, -188, -193,
97 -197, -201, -204, -207, -209, -209, -209, -208,
98 -206, -203, -200, -196, -192, -189, -186, -183,
99 -182, -182, -183, -186, -190, -196, -204, -213,
100 -224, -236, -249, -262, -275, -288, -299, -310,
101 -318, -324, -327, -327, -323, -316, -304, -288,
102 -269, -245, -218, -187, -153, -117, -79, -40,
103};
104
105#define BEEP_SPEED 5 /* 22050 Hz sample rate */
106#define BEEP_BUFLEN 512
107#define BEEP_VOLUME 15 /* 0 - 100 */
108
109static int beep_volume = BEEP_VOLUME;
110static int beep_playing = 0;
111static int beep_state = 0;
112static short *beep_buf;
113static void (*orig_mksound)(unsigned int, unsigned int);
114
115/* This is found someplace else......I guess in the keyboard driver
116 * we don't include.
117 */
118static void (*kd_mksound)(unsigned int, unsigned int);
119
120static int catchRadius = 0;
121static int numBufs = 4, bufSize = 32;
122static int numReadBufs = 4, readbufSize = 32;
123
124
125/* TDM/Serial transmit and receive buffer descriptors.
126*/
127static volatile cbd_t *rx_base, *rx_cur, *tx_base, *tx_cur;
128
129MODULE_PARM(catchRadius, "i");
130MODULE_PARM(numBufs, "i");
131MODULE_PARM(bufSize, "i");
132MODULE_PARM(numreadBufs, "i");
133MODULE_PARM(readbufSize, "i");
134
135#define arraysize(x) (sizeof(x)/sizeof(*(x)))
136#define le2be16(x) (((x)<<8 & 0xff00) | ((x)>>8 & 0x00ff))
137#define le2be16dbl(x) (((x)<<8 & 0xff00ff00) | ((x)>>8 & 0x00ff00ff))
138
139#define IOCTL_IN(arg, ret) \
140 do { int error = get_user(ret, (int *)(arg)); \
141 if (error) return error; \
142 } while (0)
143#define IOCTL_OUT(arg, ret) ioctl_return((int *)(arg), ret)
144
145/* CS4218 serial port control in mode 4.
146*/
147#define CS_INTMASK ((uint)0x40000000)
148#define CS_DO1 ((uint)0x20000000)
149#define CS_LATTEN ((uint)0x1f000000)
150#define CS_RATTEN ((uint)0x00f80000)
151#define CS_MUTE ((uint)0x00040000)
152#define CS_ISL ((uint)0x00020000)
153#define CS_ISR ((uint)0x00010000)
154#define CS_LGAIN ((uint)0x0000f000)
155#define CS_RGAIN ((uint)0x00000f00)
156
157#define CS_LATTEN_SET(X) (((X) & 0x1f) << 24)
158#define CS_RATTEN_SET(X) (((X) & 0x1f) << 19)
159#define CS_LGAIN_SET(X) (((X) & 0x0f) << 12)
160#define CS_RGAIN_SET(X) (((X) & 0x0f) << 8)
161
162#define CS_LATTEN_GET(X) (((X) >> 24) & 0x1f)
163#define CS_RATTEN_GET(X) (((X) >> 19) & 0x1f)
164#define CS_LGAIN_GET(X) (((X) >> 12) & 0x0f)
165#define CS_RGAIN_GET(X) (((X) >> 8) & 0x0f)
166
167/* The control register is effectively write only. We have to keep a copy
168 * of what we write.
169 */
170static uint cs4218_control;
171
172/* A place to store expanding information.
173*/
174static int expand_bal;
175static int expand_data;
176
177/* Since I can't make the microcode patch work for the SPI, I just
178 * clock the bits using software.
179 */
180static void sw_spi_init(void);
181static void sw_spi_io(u_char *obuf, u_char *ibuf, uint bcnt);
182static uint cs4218_ctl_write(uint ctlreg);
183
184/*** Some low level helpers **************************************************/
185
186/* 16 bit mu-law */
187
188static short ulaw2dma16[] = {
189 -32124, -31100, -30076, -29052, -28028, -27004, -25980, -24956,
190 -23932, -22908, -21884, -20860, -19836, -18812, -17788, -16764,
191 -15996, -15484, -14972, -14460, -13948, -13436, -12924, -12412,
192 -11900, -11388, -10876, -10364, -9852, -9340, -8828, -8316,
193 -7932, -7676, -7420, -7164, -6908, -6652, -6396, -6140,
194 -5884, -5628, -5372, -5116, -4860, -4604, -4348, -4092,
195 -3900, -3772, -3644, -3516, -3388, -3260, -3132, -3004,
196 -2876, -2748, -2620, -2492, -2364, -2236, -2108, -1980,
197 -1884, -1820, -1756, -1692, -1628, -1564, -1500, -1436,
198 -1372, -1308, -1244, -1180, -1116, -1052, -988, -924,
199 -876, -844, -812, -780, -748, -716, -684, -652,
200 -620, -588, -556, -524, -492, -460, -428, -396,
201 -372, -356, -340, -324, -308, -292, -276, -260,
202 -244, -228, -212, -196, -180, -164, -148, -132,
203 -120, -112, -104, -96, -88, -80, -72, -64,
204 -56, -48, -40, -32, -24, -16, -8, 0,
205 32124, 31100, 30076, 29052, 28028, 27004, 25980, 24956,
206 23932, 22908, 21884, 20860, 19836, 18812, 17788, 16764,
207 15996, 15484, 14972, 14460, 13948, 13436, 12924, 12412,
208 11900, 11388, 10876, 10364, 9852, 9340, 8828, 8316,
209 7932, 7676, 7420, 7164, 6908, 6652, 6396, 6140,
210 5884, 5628, 5372, 5116, 4860, 4604, 4348, 4092,
211 3900, 3772, 3644, 3516, 3388, 3260, 3132, 3004,
212 2876, 2748, 2620, 2492, 2364, 2236, 2108, 1980,
213 1884, 1820, 1756, 1692, 1628, 1564, 1500, 1436,
214 1372, 1308, 1244, 1180, 1116, 1052, 988, 924,
215 876, 844, 812, 780, 748, 716, 684, 652,
216 620, 588, 556, 524, 492, 460, 428, 396,
217 372, 356, 340, 324, 308, 292, 276, 260,
218 244, 228, 212, 196, 180, 164, 148, 132,
219 120, 112, 104, 96, 88, 80, 72, 64,
220 56, 48, 40, 32, 24, 16, 8, 0,
221};
222
223/* 16 bit A-law */
224
225static short alaw2dma16[] = {
226 -5504, -5248, -6016, -5760, -4480, -4224, -4992, -4736,
227 -7552, -7296, -8064, -7808, -6528, -6272, -7040, -6784,
228 -2752, -2624, -3008, -2880, -2240, -2112, -2496, -2368,
229 -3776, -3648, -4032, -3904, -3264, -3136, -3520, -3392,
230 -22016, -20992, -24064, -23040, -17920, -16896, -19968, -18944,
231 -30208, -29184, -32256, -31232, -26112, -25088, -28160, -27136,
232 -11008, -10496, -12032, -11520, -8960, -8448, -9984, -9472,
233 -15104, -14592, -16128, -15616, -13056, -12544, -14080, -13568,
234 -344, -328, -376, -360, -280, -264, -312, -296,
235 -472, -456, -504, -488, -408, -392, -440, -424,
236 -88, -72, -120, -104, -24, -8, -56, -40,
237 -216, -200, -248, -232, -152, -136, -184, -168,
238 -1376, -1312, -1504, -1440, -1120, -1056, -1248, -1184,
239 -1888, -1824, -2016, -1952, -1632, -1568, -1760, -1696,
240 -688, -656, -752, -720, -560, -528, -624, -592,
241 -944, -912, -1008, -976, -816, -784, -880, -848,
242 5504, 5248, 6016, 5760, 4480, 4224, 4992, 4736,
243 7552, 7296, 8064, 7808, 6528, 6272, 7040, 6784,
244 2752, 2624, 3008, 2880, 2240, 2112, 2496, 2368,
245 3776, 3648, 4032, 3904, 3264, 3136, 3520, 3392,
246 22016, 20992, 24064, 23040, 17920, 16896, 19968, 18944,
247 30208, 29184, 32256, 31232, 26112, 25088, 28160, 27136,
248 11008, 10496, 12032, 11520, 8960, 8448, 9984, 9472,
249 15104, 14592, 16128, 15616, 13056, 12544, 14080, 13568,
250 344, 328, 376, 360, 280, 264, 312, 296,
251 472, 456, 504, 488, 408, 392, 440, 424,
252 88, 72, 120, 104, 24, 8, 56, 40,
253 216, 200, 248, 232, 152, 136, 184, 168,
254 1376, 1312, 1504, 1440, 1120, 1056, 1248, 1184,
255 1888, 1824, 2016, 1952, 1632, 1568, 1760, 1696,
256 688, 656, 752, 720, 560, 528, 624, 592,
257 944, 912, 1008, 976, 816, 784, 880, 848,
258};
259
260
261/*** Translations ************************************************************/
262
263
264static ssize_t cs4218_ct_law(const u_char *userPtr, size_t userCount,
265 u_char frame[], ssize_t *frameUsed,
266 ssize_t frameLeft);
267static ssize_t cs4218_ct_s8(const u_char *userPtr, size_t userCount,
268 u_char frame[], ssize_t *frameUsed,
269 ssize_t frameLeft);
270static ssize_t cs4218_ct_u8(const u_char *userPtr, size_t userCount,
271 u_char frame[], ssize_t *frameUsed,
272 ssize_t frameLeft);
273static ssize_t cs4218_ct_s16(const u_char *userPtr, size_t userCount,
274 u_char frame[], ssize_t *frameUsed,
275 ssize_t frameLeft);
276static ssize_t cs4218_ct_u16(const u_char *userPtr, size_t userCount,
277 u_char frame[], ssize_t *frameUsed,
278 ssize_t frameLeft);
279static ssize_t cs4218_ctx_law(const u_char *userPtr, size_t userCount,
280 u_char frame[], ssize_t *frameUsed,
281 ssize_t frameLeft);
282static ssize_t cs4218_ctx_s8(const u_char *userPtr, size_t userCount,
283 u_char frame[], ssize_t *frameUsed,
284 ssize_t frameLeft);
285static ssize_t cs4218_ctx_u8(const u_char *userPtr, size_t userCount,
286 u_char frame[], ssize_t *frameUsed,
287 ssize_t frameLeft);
288static ssize_t cs4218_ctx_s16(const u_char *userPtr, size_t userCount,
289 u_char frame[], ssize_t *frameUsed,
290 ssize_t frameLeft);
291static ssize_t cs4218_ctx_u16(const u_char *userPtr, size_t userCount,
292 u_char frame[], ssize_t *frameUsed,
293 ssize_t frameLeft);
294static ssize_t cs4218_ct_s16_read(const u_char *userPtr, size_t userCount,
295 u_char frame[], ssize_t *frameUsed,
296 ssize_t frameLeft);
297static ssize_t cs4218_ct_u16_read(const u_char *userPtr, size_t userCount,
298 u_char frame[], ssize_t *frameUsed,
299 ssize_t frameLeft);
300
301
302/*** Low level stuff *********************************************************/
303
304struct cs_sound_settings {
305 MACHINE mach; /* machine dependent things */
306 SETTINGS hard; /* hardware settings */
307 SETTINGS soft; /* software settings */
308 SETTINGS dsp; /* /dev/dsp default settings */
309 TRANS *trans_write; /* supported translations for playback */
310 TRANS *trans_read; /* supported translations for record */
311 int volume_left; /* volume (range is machine dependent) */
312 int volume_right;
313 int bass; /* tone (range is machine dependent) */
314 int treble;
315 int gain;
316 int minDev; /* minor device number currently open */
317};
318
319static struct cs_sound_settings sound;
320
321static void *CS_Alloc(unsigned int size, int flags);
322static void CS_Free(void *ptr, unsigned int size);
323static int CS_IrqInit(void);
324#ifdef MODULE
325static void CS_IrqCleanup(void);
326#endif /* MODULE */
327static void CS_Silence(void);
328static void CS_Init(void);
329static void CS_Play(void);
330static void CS_Record(void);
331static int CS_SetFormat(int format);
332static int CS_SetVolume(int volume);
333static void cs4218_tdm_tx_intr(void *devid);
334static void cs4218_tdm_rx_intr(void *devid);
335static void cs4218_intr(void *devid, struct pt_regs *regs);
336static int cs_get_volume(uint reg);
337static int cs_volume_setter(int volume, int mute);
338static int cs_get_gain(uint reg);
339static int cs_set_gain(int gain);
340static void cs_mksound(unsigned int hz, unsigned int ticks);
341static void cs_nosound(unsigned long xx);
342
343/*** Mid level stuff *********************************************************/
344
345
346static void sound_silence(void);
347static void sound_init(void);
348static int sound_set_format(int format);
349static int sound_set_speed(int speed);
350static int sound_set_stereo(int stereo);
351static int sound_set_volume(int volume);
352
353static ssize_t sound_copy_translate(const u_char *userPtr,
354 size_t userCount,
355 u_char frame[], ssize_t *frameUsed,
356 ssize_t frameLeft);
357static ssize_t sound_copy_translate_read(const u_char *userPtr,
358 size_t userCount,
359 u_char frame[], ssize_t *frameUsed,
360 ssize_t frameLeft);
361
362
363/*
364 * /dev/mixer abstraction
365 */
366
367struct sound_mixer {
368 int busy;
369 int modify_counter;
370};
371
372static struct sound_mixer mixer;
373
374static struct sound_queue sq;
375static struct sound_queue read_sq;
376
377#define sq_block_address(i) (sq.buffers[i])
378#define SIGNAL_RECEIVED (signal_pending(current))
379#define NON_BLOCKING(open_mode) (open_mode & O_NONBLOCK)
380#define ONE_SECOND HZ /* in jiffies (100ths of a second) */
381#define NO_TIME_LIMIT 0xffffffff
382
383/*
384 * /dev/sndstat
385 */
386
387struct sound_state {
388 int busy;
389 char buf[512];
390 int len, ptr;
391};
392
393static struct sound_state state;
394
395/*** Common stuff ********************************************************/
396
397static long long sound_lseek(struct file *file, long long offset, int orig);
398
399/*** Config & Setup **********************************************************/
400
401void dmasound_setup(char *str, int *ints);
402
403/*** Translations ************************************************************/
404
405
406/* ++TeSche: radically changed for new expanding purposes...
407 *
408 * These two routines now deal with copying/expanding/translating the samples
409 * from user space into our buffer at the right frequency. They take care about
410 * how much data there's actually to read, how much buffer space there is and
411 * to convert samples into the right frequency/encoding. They will only work on
412 * complete samples so it may happen they leave some bytes in the input stream
413 * if the user didn't write a multiple of the current sample size. They both
414 * return the number of bytes they've used from both streams so you may detect
415 * such a situation. Luckily all programs should be able to cope with that.
416 *
417 * I think I've optimized anything as far as one can do in plain C, all
418 * variables should fit in registers and the loops are really short. There's
419 * one loop for every possible situation. Writing a more generalized and thus
420 * parameterized loop would only produce slower code. Feel free to optimize
421 * this in assembler if you like. :)
422 *
423 * I think these routines belong here because they're not yet really hardware
424 * independent, especially the fact that the Falcon can play 16bit samples
425 * only in stereo is hardcoded in both of them!
426 *
427 * ++geert: split in even more functions (one per format)
428 */
429
430static ssize_t cs4218_ct_law(const u_char *userPtr, size_t userCount,
431 u_char frame[], ssize_t *frameUsed,
432 ssize_t frameLeft)
433{
434 short *table = sound.soft.format == AFMT_MU_LAW ? ulaw2dma16: alaw2dma16;
435 ssize_t count, used;
436 short *p = (short *) &frame[*frameUsed];
437 int val, stereo = sound.soft.stereo;
438
439 frameLeft >>= 2;
440 if (stereo)
441 userCount >>= 1;
442 used = count = min(userCount, frameLeft);
443 while (count > 0) {
444 u_char data;
445 if (get_user(data, userPtr++))
446 return -EFAULT;
447 val = table[data];
448 *p++ = val;
449 if (stereo) {
450 if (get_user(data, userPtr++))
451 return -EFAULT;
452 val = table[data];
453 }
454 *p++ = val;
455 count--;
456 }
457 *frameUsed += used * 4;
458 return stereo? used * 2: used;
459}
460
461
462static ssize_t cs4218_ct_s8(const u_char *userPtr, size_t userCount,
463 u_char frame[], ssize_t *frameUsed,
464 ssize_t frameLeft)
465{
466 ssize_t count, used;
467 short *p = (short *) &frame[*frameUsed];
468 int val, stereo = sound.soft.stereo;
469
470 frameLeft >>= 2;
471 if (stereo)
472 userCount >>= 1;
473 used = count = min(userCount, frameLeft);
474 while (count > 0) {
475 u_char data;
476 if (get_user(data, userPtr++))
477 return -EFAULT;
478 val = data << 8;
479 *p++ = val;
480 if (stereo) {
481 if (get_user(data, userPtr++))
482 return -EFAULT;
483 val = data << 8;
484 }
485 *p++ = val;
486 count--;
487 }
488 *frameUsed += used * 4;
489 return stereo? used * 2: used;
490}
491
492
493static ssize_t cs4218_ct_u8(const u_char *userPtr, size_t userCount,
494 u_char frame[], ssize_t *frameUsed,
495 ssize_t frameLeft)
496{
497 ssize_t count, used;
498 short *p = (short *) &frame[*frameUsed];
499 int val, stereo = sound.soft.stereo;
500
501 frameLeft >>= 2;
502 if (stereo)
503 userCount >>= 1;
504 used = count = min(userCount, frameLeft);
505 while (count > 0) {
506 u_char data;
507 if (get_user(data, userPtr++))
508 return -EFAULT;
509 val = (data ^ 0x80) << 8;
510 *p++ = val;
511 if (stereo) {
512 if (get_user(data, userPtr++))
513 return -EFAULT;
514 val = (data ^ 0x80) << 8;
515 }
516 *p++ = val;
517 count--;
518 }
519 *frameUsed += used * 4;
520 return stereo? used * 2: used;
521}
522
523
524/* This is the default format of the codec. Signed, 16-bit stereo
525 * generated by an application shouldn't have to be copied at all.
526 * We should just get the phsical address of the buffers and update
527 * the TDM BDs directly.
528 */
529static ssize_t cs4218_ct_s16(const u_char *userPtr, size_t userCount,
530 u_char frame[], ssize_t *frameUsed,
531 ssize_t frameLeft)
532{
533 ssize_t count, used;
534 int stereo = sound.soft.stereo;
535 short *fp = (short *) &frame[*frameUsed];
536
537 frameLeft >>= 2;
538 userCount >>= (stereo? 2: 1);
539 used = count = min(userCount, frameLeft);
540 if (!stereo) {
541 short *up = (short *) userPtr;
542 while (count > 0) {
543 short data;
544 if (get_user(data, up++))
545 return -EFAULT;
546 *fp++ = data;
547 *fp++ = data;
548 count--;
549 }
550 } else {
551 if (copy_from_user(fp, userPtr, count * 4))
552 return -EFAULT;
553 }
554 *frameUsed += used * 4;
555 return stereo? used * 4: used * 2;
556}
557
558static ssize_t cs4218_ct_u16(const u_char *userPtr, size_t userCount,
559 u_char frame[], ssize_t *frameUsed,
560 ssize_t frameLeft)
561{
562 ssize_t count, used;
563 int mask = (sound.soft.format == AFMT_U16_LE? 0x0080: 0x8000);
564 int stereo = sound.soft.stereo;
565 short *fp = (short *) &frame[*frameUsed];
566 short *up = (short *) userPtr;
567
568 frameLeft >>= 2;
569 userCount >>= (stereo? 2: 1);
570 used = count = min(userCount, frameLeft);
571 while (count > 0) {
572 int data;
573 if (get_user(data, up++))
574 return -EFAULT;
575 data ^= mask;
576 *fp++ = data;
577 if (stereo) {
578 if (get_user(data, up++))
579 return -EFAULT;
580 data ^= mask;
581 }
582 *fp++ = data;
583 count--;
584 }
585 *frameUsed += used * 4;
586 return stereo? used * 4: used * 2;
587}
588
589
590static ssize_t cs4218_ctx_law(const u_char *userPtr, size_t userCount,
591 u_char frame[], ssize_t *frameUsed,
592 ssize_t frameLeft)
593{
594 unsigned short *table = (unsigned short *)
595 (sound.soft.format == AFMT_MU_LAW ? ulaw2dma16: alaw2dma16);
596 unsigned int data = expand_data;
597 unsigned int *p = (unsigned int *) &frame[*frameUsed];
598 int bal = expand_bal;
599 int hSpeed = sound.hard.speed, sSpeed = sound.soft.speed;
600 int utotal, ftotal;
601 int stereo = sound.soft.stereo;
602
603 frameLeft >>= 2;
604 if (stereo)
605 userCount >>= 1;
606 ftotal = frameLeft;
607 utotal = userCount;
608 while (frameLeft) {
609 u_char c;
610 if (bal < 0) {
611 if (userCount == 0)
612 break;
613 if (get_user(c, userPtr++))
614 return -EFAULT;
615 data = table[c];
616 if (stereo) {
617 if (get_user(c, userPtr++))
618 return -EFAULT;
619 data = (data << 16) + table[c];
620 } else
621 data = (data << 16) + data;
622 userCount--;
623 bal += hSpeed;
624 }
625 *p++ = data;
626 frameLeft--;
627 bal -= sSpeed;
628 }
629 expand_bal = bal;
630 expand_data = data;
631 *frameUsed += (ftotal - frameLeft) * 4;
632 utotal -= userCount;
633 return stereo? utotal * 2: utotal;
634}
635
636
637static ssize_t cs4218_ctx_s8(const u_char *userPtr, size_t userCount,
638 u_char frame[], ssize_t *frameUsed,
639 ssize_t frameLeft)
640{
641 unsigned int *p = (unsigned int *) &frame[*frameUsed];
642 unsigned int data = expand_data;
643 int bal = expand_bal;
644 int hSpeed = sound.hard.speed, sSpeed = sound.soft.speed;
645 int stereo = sound.soft.stereo;
646 int utotal, ftotal;
647
648 frameLeft >>= 2;
649 if (stereo)
650 userCount >>= 1;
651 ftotal = frameLeft;
652 utotal = userCount;
653 while (frameLeft) {
654 u_char c;
655 if (bal < 0) {
656 if (userCount == 0)
657 break;
658 if (get_user(c, userPtr++))
659 return -EFAULT;
660 data = c << 8;
661 if (stereo) {
662 if (get_user(c, userPtr++))
663 return -EFAULT;
664 data = (data << 16) + (c << 8);
665 } else
666 data = (data << 16) + data;
667 userCount--;
668 bal += hSpeed;
669 }
670 *p++ = data;
671 frameLeft--;
672 bal -= sSpeed;
673 }
674 expand_bal = bal;
675 expand_data = data;
676 *frameUsed += (ftotal - frameLeft) * 4;
677 utotal -= userCount;
678 return stereo? utotal * 2: utotal;
679}
680
681
682static ssize_t cs4218_ctx_u8(const u_char *userPtr, size_t userCount,
683 u_char frame[], ssize_t *frameUsed,
684 ssize_t frameLeft)
685{
686 unsigned int *p = (unsigned int *) &frame[*frameUsed];
687 unsigned int data = expand_data;
688 int bal = expand_bal;
689 int hSpeed = sound.hard.speed, sSpeed = sound.soft.speed;
690 int stereo = sound.soft.stereo;
691 int utotal, ftotal;
692
693 frameLeft >>= 2;
694 if (stereo)
695 userCount >>= 1;
696 ftotal = frameLeft;
697 utotal = userCount;
698 while (frameLeft) {
699 u_char c;
700 if (bal < 0) {
701 if (userCount == 0)
702 break;
703 if (get_user(c, userPtr++))
704 return -EFAULT;
705 data = (c ^ 0x80) << 8;
706 if (stereo) {
707 if (get_user(c, userPtr++))
708 return -EFAULT;
709 data = (data << 16) + ((c ^ 0x80) << 8);
710 } else
711 data = (data << 16) + data;
712 userCount--;
713 bal += hSpeed;
714 }
715 *p++ = data;
716 frameLeft--;
717 bal -= sSpeed;
718 }
719 expand_bal = bal;
720 expand_data = data;
721 *frameUsed += (ftotal - frameLeft) * 4;
722 utotal -= userCount;
723 return stereo? utotal * 2: utotal;
724}
725
726
727static ssize_t cs4218_ctx_s16(const u_char *userPtr, size_t userCount,
728 u_char frame[], ssize_t *frameUsed,
729 ssize_t frameLeft)
730{
731 unsigned int *p = (unsigned int *) &frame[*frameUsed];
732 unsigned int data = expand_data;
733 unsigned short *up = (unsigned short *) userPtr;
734 int bal = expand_bal;
735 int hSpeed = sound.hard.speed, sSpeed = sound.soft.speed;
736 int stereo = sound.soft.stereo;
737 int utotal, ftotal;
738
739 frameLeft >>= 2;
740 userCount >>= (stereo? 2: 1);
741 ftotal = frameLeft;
742 utotal = userCount;
743 while (frameLeft) {
744 unsigned short c;
745 if (bal < 0) {
746 if (userCount == 0)
747 break;
748 if (get_user(data, up++))
749 return -EFAULT;
750 if (stereo) {
751 if (get_user(c, up++))
752 return -EFAULT;
753 data = (data << 16) + c;
754 } else
755 data = (data << 16) + data;
756 userCount--;
757 bal += hSpeed;
758 }
759 *p++ = data;
760 frameLeft--;
761 bal -= sSpeed;
762 }
763 expand_bal = bal;
764 expand_data = data;
765 *frameUsed += (ftotal - frameLeft) * 4;
766 utotal -= userCount;
767 return stereo? utotal * 4: utotal * 2;
768}
769
770
771static ssize_t cs4218_ctx_u16(const u_char *userPtr, size_t userCount,
772 u_char frame[], ssize_t *frameUsed,
773 ssize_t frameLeft)
774{
775 int mask = (sound.soft.format == AFMT_U16_LE? 0x0080: 0x8000);
776 unsigned int *p = (unsigned int *) &frame[*frameUsed];
777 unsigned int data = expand_data;
778 unsigned short *up = (unsigned short *) userPtr;
779 int bal = expand_bal;
780 int hSpeed = sound.hard.speed, sSpeed = sound.soft.speed;
781 int stereo = sound.soft.stereo;
782 int utotal, ftotal;
783
784 frameLeft >>= 2;
785 userCount >>= (stereo? 2: 1);
786 ftotal = frameLeft;
787 utotal = userCount;
788 while (frameLeft) {
789 unsigned short c;
790 if (bal < 0) {
791 if (userCount == 0)
792 break;
793 if (get_user(data, up++))
794 return -EFAULT;
795 data ^= mask;
796 if (stereo) {
797 if (get_user(c, up++))
798 return -EFAULT;
799 data = (data << 16) + (c ^ mask);
800 } else
801 data = (data << 16) + data;
802 userCount--;
803 bal += hSpeed;
804 }
805 *p++ = data;
806 frameLeft--;
807 bal -= sSpeed;
808 }
809 expand_bal = bal;
810 expand_data = data;
811 *frameUsed += (ftotal - frameLeft) * 4;
812 utotal -= userCount;
813 return stereo? utotal * 4: utotal * 2;
814}
815
816static ssize_t cs4218_ct_s8_read(const u_char *userPtr, size_t userCount,
817 u_char frame[], ssize_t *frameUsed,
818 ssize_t frameLeft)
819{
820 ssize_t count, used;
821 short *p = (short *) &frame[*frameUsed];
822 int val, stereo = sound.soft.stereo;
823
824 frameLeft >>= 2;
825 if (stereo)
826 userCount >>= 1;
827 used = count = min(userCount, frameLeft);
828 while (count > 0) {
829 u_char data;
830
831 val = *p++;
832 data = val >> 8;
833 if (put_user(data, (u_char *)userPtr++))
834 return -EFAULT;
835 if (stereo) {
836 val = *p;
837 data = val >> 8;
838 if (put_user(data, (u_char *)userPtr++))
839 return -EFAULT;
840 }
841 p++;
842 count--;
843 }
844 *frameUsed += used * 4;
845 return stereo? used * 2: used;
846}
847
848
849static ssize_t cs4218_ct_u8_read(const u_char *userPtr, size_t userCount,
850 u_char frame[], ssize_t *frameUsed,
851 ssize_t frameLeft)
852{
853 ssize_t count, used;
854 short *p = (short *) &frame[*frameUsed];
855 int val, stereo = sound.soft.stereo;
856
857 frameLeft >>= 2;
858 if (stereo)
859 userCount >>= 1;
860 used = count = min(userCount, frameLeft);
861 while (count > 0) {
862 u_char data;
863
864 val = *p++;
865 data = (val >> 8) ^ 0x80;
866 if (put_user(data, (u_char *)userPtr++))
867 return -EFAULT;
868 if (stereo) {
869 val = *p;
870 data = (val >> 8) ^ 0x80;
871 if (put_user(data, (u_char *)userPtr++))
872 return -EFAULT;
873 }
874 p++;
875 count--;
876 }
877 *frameUsed += used * 4;
878 return stereo? used * 2: used;
879}
880
881
882static ssize_t cs4218_ct_s16_read(const u_char *userPtr, size_t userCount,
883 u_char frame[], ssize_t *frameUsed,
884 ssize_t frameLeft)
885{
886 ssize_t count, used;
887 int stereo = sound.soft.stereo;
888 short *fp = (short *) &frame[*frameUsed];
889
890 frameLeft >>= 2;
891 userCount >>= (stereo? 2: 1);
892 used = count = min(userCount, frameLeft);
893 if (!stereo) {
894 short *up = (short *) userPtr;
895 while (count > 0) {
896 short data;
897 data = *fp;
898 if (put_user(data, up++))
899 return -EFAULT;
900 fp+=2;
901 count--;
902 }
903 } else {
904 if (copy_to_user((u_char *)userPtr, fp, count * 4))
905 return -EFAULT;
906 }
907 *frameUsed += used * 4;
908 return stereo? used * 4: used * 2;
909}
910
911static ssize_t cs4218_ct_u16_read(const u_char *userPtr, size_t userCount,
912 u_char frame[], ssize_t *frameUsed,
913 ssize_t frameLeft)
914{
915 ssize_t count, used;
916 int mask = (sound.soft.format == AFMT_U16_LE? 0x0080: 0x8000);
917 int stereo = sound.soft.stereo;
918 short *fp = (short *) &frame[*frameUsed];
919 short *up = (short *) userPtr;
920
921 frameLeft >>= 2;
922 userCount >>= (stereo? 2: 1);
923 used = count = min(userCount, frameLeft);
924 while (count > 0) {
925 int data;
926
927 data = *fp++;
928 data ^= mask;
929 if (put_user(data, up++))
930 return -EFAULT;
931 if (stereo) {
932 data = *fp;
933 data ^= mask;
934 if (put_user(data, up++))
935 return -EFAULT;
936 }
937 fp++;
938 count--;
939 }
940 *frameUsed += used * 4;
941 return stereo? used * 4: used * 2;
942}
943
944static TRANS transCSNormal = {
945 cs4218_ct_law, cs4218_ct_law, cs4218_ct_s8, cs4218_ct_u8,
946 cs4218_ct_s16, cs4218_ct_u16, cs4218_ct_s16, cs4218_ct_u16
947};
948
949static TRANS transCSExpand = {
950 cs4218_ctx_law, cs4218_ctx_law, cs4218_ctx_s8, cs4218_ctx_u8,
951 cs4218_ctx_s16, cs4218_ctx_u16, cs4218_ctx_s16, cs4218_ctx_u16
952};
953
954static TRANS transCSNormalRead = {
955 NULL, NULL, cs4218_ct_s8_read, cs4218_ct_u8_read,
956 cs4218_ct_s16_read, cs4218_ct_u16_read,
957 cs4218_ct_s16_read, cs4218_ct_u16_read
958};
959
960/*** Low level stuff *********************************************************/
961
962static void *CS_Alloc(unsigned int size, int flags)
963{
964 int order;
965
966 size >>= 13;
967 for (order=0; order < 5; order++) {
968 if (size == 0)
969 break;
970 size >>= 1;
971 }
972 return (void *)__get_free_pages(flags, order);
973}
974
975static void CS_Free(void *ptr, unsigned int size)
976{
977 int order;
978
979 size >>= 13;
980 for (order=0; order < 5; order++) {
981 if (size == 0)
982 break;
983 size >>= 1;
984 }
985 free_pages((ulong)ptr, order);
986}
987
988static int __init CS_IrqInit(void)
989{
990 cpm_install_handler(CPMVEC_SMC2, cs4218_intr, NULL);
991 return 1;
992}
993
994#ifdef MODULE
995static void CS_IrqCleanup(void)
996{
997 volatile smc_t *sp;
998 volatile cpm8xx_t *cp;
999
1000 /* First disable transmitter and receiver.
1001 */
1002 sp = &cpmp->cp_smc[1];
1003 sp->smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN);
1004
1005 /* And now shut down the SMC.
1006 */
1007 cp = cpmp; /* Get pointer to Communication Processor */
1008 cp->cp_cpcr = mk_cr_cmd(CPM_CR_CH_SMC2,
1009 CPM_CR_STOP_TX) | CPM_CR_FLG;
1010 while (cp->cp_cpcr & CPM_CR_FLG);
1011
1012 /* Release the interrupt handler.
1013 */
1014 cpm_free_handler(CPMVEC_SMC2);
1015
1016 if (beep_buf)
1017 kfree(beep_buf);
1018 kd_mksound = orig_mksound;
1019}
1020#endif /* MODULE */
1021
1022static void CS_Silence(void)
1023{
1024 volatile smc_t *sp;
1025
1026 /* Disable transmitter.
1027 */
1028 sp = &cpmp->cp_smc[1];
1029 sp->smc_smcmr &= ~SMCMR_TEN;
1030}
1031
1032/* Frequencies depend upon external oscillator. There are two
1033 * choices, 12.288 and 11.2896 MHz. The RPCG audio supports both through
1034 * and external control register selection bit.
1035 */
1036static int cs4218_freqs[] = {
1037 /* 12.288 11.2896 */
1038 48000, 44100,
1039 32000, 29400,
1040 24000, 22050,
1041 19200, 17640,
1042 16000, 14700,
1043 12000, 11025,
1044 9600, 8820,
1045 8000, 7350
1046};
1047
1048static void CS_Init(void)
1049{
1050 int i, tolerance;
1051
1052 switch (sound.soft.format) {
1053 case AFMT_S16_LE:
1054 case AFMT_U16_LE:
1055 sound.hard.format = AFMT_S16_LE;
1056 break;
1057 default:
1058 sound.hard.format = AFMT_S16_BE;
1059 break;
1060 }
1061 sound.hard.stereo = 1;
1062 sound.hard.size = 16;
1063
1064 /*
1065 * If we have a sample rate which is within catchRadius percent
1066 * of the requested value, we don't have to expand the samples.
1067 * Otherwise choose the next higher rate.
1068 */
1069 i = (sizeof(cs4218_freqs) / sizeof(int));
1070 do {
1071 tolerance = catchRadius * cs4218_freqs[--i] / 100;
1072 } while (sound.soft.speed > cs4218_freqs[i] + tolerance && i > 0);
1073 if (sound.soft.speed >= cs4218_freqs[i] - tolerance)
1074 sound.trans_write = &transCSNormal;
1075 else
1076 sound.trans_write = &transCSExpand;
1077 sound.trans_read = &transCSNormalRead;
1078 sound.hard.speed = cs4218_freqs[i];
1079 cs4218_rate_index = i;
1080
1081 /* The CS4218 has seven selectable clock dividers for the sample
1082 * clock. The HIOX then provides one of two external rates.
1083 * An even numbered frequency table index uses the high external
1084 * clock rate.
1085 */
1086 *(uint *)HIOX_CSR4_ADDR &= ~(HIOX_CSR4_AUDCLKHI | HIOX_CSR4_AUDCLKSEL);
1087 if ((i & 1) == 0)
1088 *(uint *)HIOX_CSR4_ADDR |= HIOX_CSR4_AUDCLKHI;
1089 i >>= 1;
1090 *(uint *)HIOX_CSR4_ADDR |= (i & HIOX_CSR4_AUDCLKSEL);
1091
1092 expand_bal = -sound.soft.speed;
1093}
1094
1095static int CS_SetFormat(int format)
1096{
1097 int size;
1098
1099 switch (format) {
1100 case AFMT_QUERY:
1101 return sound.soft.format;
1102 case AFMT_MU_LAW:
1103 case AFMT_A_LAW:
1104 case AFMT_U8:
1105 case AFMT_S8:
1106 size = 8;
1107 break;
1108 case AFMT_S16_BE:
1109 case AFMT_U16_BE:
1110 case AFMT_S16_LE:
1111 case AFMT_U16_LE:
1112 size = 16;
1113 break;
1114 default: /* :-) */
1115 printk(KERN_ERR "dmasound: unknown format 0x%x, using AFMT_U8\n",
1116 format);
1117 size = 8;
1118 format = AFMT_U8;
1119 }
1120
1121 sound.soft.format = format;
1122 sound.soft.size = size;
1123 if (sound.minDev == SND_DEV_DSP) {
1124 sound.dsp.format = format;
1125 sound.dsp.size = size;
1126 }
1127
1128 CS_Init();
1129
1130 return format;
1131}
1132
1133/* Volume is the amount of attenuation we tell the codec to impose
1134 * on the outputs. There are 32 levels, with 0 the "loudest".
1135 */
1136#define CS_VOLUME_TO_MASK(x) (31 - ((((x) - 1) * 31) / 99))
1137#define CS_MASK_TO_VOLUME(y) (100 - ((y) * 99 / 31))
1138
1139static int cs_get_volume(uint reg)
1140{
1141 int volume;
1142
1143 volume = CS_MASK_TO_VOLUME(CS_LATTEN_GET(reg));
1144 volume |= CS_MASK_TO_VOLUME(CS_RATTEN_GET(reg)) << 8;
1145 return volume;
1146}
1147
1148static int cs_volume_setter(int volume, int mute)
1149{
1150 uint tempctl;
1151
1152 if (mute && volume == 0) {
1153 tempctl = cs4218_control | CS_MUTE;
1154 } else {
1155 tempctl = cs4218_control & ~CS_MUTE;
1156 tempctl = tempctl & ~(CS_LATTEN | CS_RATTEN);
1157 tempctl |= CS_LATTEN_SET(CS_VOLUME_TO_MASK(volume & 0xff));
1158 tempctl |= CS_RATTEN_SET(CS_VOLUME_TO_MASK((volume >> 8) & 0xff));
1159 volume = cs_get_volume(tempctl);
1160 }
1161 if (tempctl != cs4218_control) {
1162 cs4218_ctl_write(tempctl);
1163 }
1164 return volume;
1165}
1166
1167
1168/* Gain has 16 steps from 0 to 15. These are in 1.5dB increments from
1169 * 0 (no gain) to 22.5 dB.
1170 */
1171#define CS_RECLEVEL_TO_GAIN(v) \
1172 ((v) < 0 ? 0 : (v) > 100 ? 15 : (v) * 3 / 20)
1173#define CS_GAIN_TO_RECLEVEL(v) (((v) * 20 + 2) / 3)
1174
1175static int cs_get_gain(uint reg)
1176{
1177 int gain;
1178
1179 gain = CS_GAIN_TO_RECLEVEL(CS_LGAIN_GET(reg));
1180 gain |= CS_GAIN_TO_RECLEVEL(CS_RGAIN_GET(reg)) << 8;
1181 return gain;
1182}
1183
1184static int cs_set_gain(int gain)
1185{
1186 uint tempctl;
1187
1188 tempctl = cs4218_control & ~(CS_LGAIN | CS_RGAIN);
1189 tempctl |= CS_LGAIN_SET(CS_RECLEVEL_TO_GAIN(gain & 0xff));
1190 tempctl |= CS_RGAIN_SET(CS_RECLEVEL_TO_GAIN((gain >> 8) & 0xff));
1191 gain = cs_get_gain(tempctl);
1192
1193 if (tempctl != cs4218_control) {
1194 cs4218_ctl_write(tempctl);
1195 }
1196 return gain;
1197}
1198
1199static int CS_SetVolume(int volume)
1200{
1201 return cs_volume_setter(volume, CS_MUTE);
1202}
1203
1204static void CS_Play(void)
1205{
1206 int i, count;
1207 unsigned long flags;
1208 volatile cbd_t *bdp;
1209 volatile cpm8xx_t *cp;
1210
1211 /* Protect buffer */
1212 spin_lock_irqsave(&cs4218_lock, flags);
1213#if 0
1214 if (awacs_beep_state) {
1215 /* sound takes precedence over beeps */
1216 out_le32(&awacs_txdma->control, (RUN|PAUSE|FLUSH|WAKE) << 16);
1217 out_le32(&awacs->control,
1218 (in_le32(&awacs->control) & ~0x1f00)
1219 | (awacs_rate_index << 8));
1220 out_le32(&awacs->byteswap, sound.hard.format != AFMT_S16_BE);
1221 out_le32(&awacs_txdma->cmdptr, virt_to_bus(&(awacs_tx_cmds[(sq.front+sq.active) % sq.max_count])));
1222
1223 beep_playing = 0;
1224 awacs_beep_state = 0;
1225 }
1226#endif
1227 i = sq.front + sq.active;
1228 if (i >= sq.max_count)
1229 i -= sq.max_count;
1230 while (sq.active < 2 && sq.active < sq.count) {
1231 count = (sq.count == sq.active + 1)?sq.rear_size:sq.block_size;
1232 if (count < sq.block_size && !sq.syncing)
1233 /* last block not yet filled, and we're not syncing. */
1234 break;
1235
1236 bdp = &tx_base[i];
1237 bdp->cbd_datlen = count;
1238
1239 flush_dcache_range((ulong)sound_buffers[i],
1240 (ulong)(sound_buffers[i] + count));
1241
1242 if (++i >= sq.max_count)
1243 i = 0;
1244
1245 if (sq.active == 0) {
1246 /* The SMC does not load its fifo until the first
1247 * TDM frame pulse, so the transmit data gets shifted
1248 * by one word. To compensate for this, we incorrectly
1249 * transmit the first buffer and shorten it by one
1250 * word. Subsequent buffers are then aligned properly.
1251 */
1252 bdp->cbd_datlen -= 2;
1253
1254 /* Start up the SMC Transmitter.
1255 */
1256 cp = cpmp;
1257 cp->cp_smc[1].smc_smcmr |= SMCMR_TEN;
1258 cp->cp_cpcr = mk_cr_cmd(CPM_CR_CH_SMC2,
1259 CPM_CR_RESTART_TX) | CPM_CR_FLG;
1260 while (cp->cp_cpcr & CPM_CR_FLG);
1261 }
1262
1263 /* Buffer is ready now.
1264 */
1265 bdp->cbd_sc |= BD_SC_READY;
1266
1267 ++sq.active;
1268 }
1269 spin_unlock_irqrestore(&cs4218_lock, flags);
1270}
1271
1272
1273static void CS_Record(void)
1274{
1275 unsigned long flags;
1276 volatile smc_t *sp;
1277
1278 if (read_sq.active)
1279 return;
1280
1281 /* Protect buffer */
1282 spin_lock_irqsave(&cs4218_lock, flags);
1283
1284 /* This is all we have to do......Just start it up.
1285 */
1286 sp = &cpmp->cp_smc[1];
1287 sp->smc_smcmr |= SMCMR_REN;
1288
1289 read_sq.active = 1;
1290
1291 spin_unlock_irqrestore(&cs4218_lock, flags);
1292}
1293
1294
1295static void
1296cs4218_tdm_tx_intr(void *devid)
1297{
1298 int i = sq.front;
1299 volatile cbd_t *bdp;
1300
1301 while (sq.active > 0) {
1302 bdp = &tx_base[i];
1303 if (bdp->cbd_sc & BD_SC_READY)
1304 break; /* this frame is still going */
1305 --sq.count;
1306 --sq.active;
1307 if (++i >= sq.max_count)
1308 i = 0;
1309 }
1310 if (i != sq.front)
1311 WAKE_UP(sq.action_queue);
1312 sq.front = i;
1313
1314 CS_Play();
1315
1316 if (!sq.active)
1317 WAKE_UP(sq.sync_queue);
1318}
1319
1320
1321static void
1322cs4218_tdm_rx_intr(void *devid)
1323{
1324
1325 /* We want to blow 'em off when shutting down.
1326 */
1327 if (read_sq.active == 0)
1328 return;
1329
1330 /* Check multiple buffers in case we were held off from
1331 * interrupt processing for a long time. Geeze, I really hope
1332 * this doesn't happen.
1333 */
1334 while ((rx_base[read_sq.rear].cbd_sc & BD_SC_EMPTY) == 0) {
1335
1336 /* Invalidate the data cache range for this buffer.
1337 */
1338 invalidate_dcache_range(
1339 (uint)(sound_read_buffers[read_sq.rear]),
1340 (uint)(sound_read_buffers[read_sq.rear] + read_sq.block_size));
1341
1342 /* Make buffer available again and move on.
1343 */
1344 rx_base[read_sq.rear].cbd_sc |= BD_SC_EMPTY;
1345 read_sq.rear++;
1346
1347 /* Wrap the buffer ring.
1348 */
1349 if (read_sq.rear >= read_sq.max_active)
1350 read_sq.rear = 0;
1351
1352 /* If we have caught up to the front buffer, bump it.
1353 * This will cause weird (but not fatal) results if the
1354 * read loop is currently using this buffer. The user is
1355 * behind in this case anyway, so weird things are going
1356 * to happen.
1357 */
1358 if (read_sq.rear == read_sq.front) {
1359 read_sq.front++;
1360 if (read_sq.front >= read_sq.max_active)
1361 read_sq.front = 0;
1362 }
1363 }
1364
1365 WAKE_UP(read_sq.action_queue);
1366}
1367
1368static void cs_nosound(unsigned long xx)
1369{
1370 unsigned long flags;
1371
1372 /* not sure if this is needed, since hardware command is #if 0'd */
1373 spin_lock_irqsave(&cs4218_lock, flags);
1374 if (beep_playing) {
1375#if 0
1376 st_le16(&beep_dbdma_cmd->command, DBDMA_STOP);
1377#endif
1378 beep_playing = 0;
1379 }
1380 spin_unlock_irqrestore(&cs4218_lock, flags);
1381}
1382
1383static struct timer_list beep_timer = TIMER_INITIALIZER(cs_nosound, 0, 0);
1384};
1385
1386static void cs_mksound(unsigned int hz, unsigned int ticks)
1387{
1388 unsigned long flags;
1389 int beep_speed = BEEP_SPEED;
1390 int srate = cs4218_freqs[beep_speed];
1391 int period, ncycles, nsamples;
1392 int i, j, f;
1393 short *p;
1394 static int beep_hz_cache;
1395 static int beep_nsamples_cache;
1396 static int beep_volume_cache;
1397
1398 if (hz <= srate / BEEP_BUFLEN || hz > srate / 2) {
1399#if 1
1400 /* this is a hack for broken X server code */
1401 hz = 750;
1402 ticks = 12;
1403#else
1404 /* cancel beep currently playing */
1405 awacs_nosound(0);
1406 return;
1407#endif
1408 }
1409 /* lock while modifying beep_timer */
1410 spin_lock_irqsave(&cs4218_lock, flags);
1411 del_timer(&beep_timer);
1412 if (ticks) {
1413 beep_timer.expires = jiffies + ticks;
1414 add_timer(&beep_timer);
1415 }
1416 if (beep_playing || sq.active || beep_buf == NULL) {
1417 spin_unlock_irqrestore(&cs4218_lock, flags);
1418 return; /* too hard, sorry :-( */
1419 }
1420 beep_playing = 1;
1421#if 0
1422 st_le16(&beep_dbdma_cmd->command, OUTPUT_MORE + BR_ALWAYS);
1423#endif
1424 spin_unlock_irqrestore(&cs4218_lock, flags);
1425
1426 if (hz == beep_hz_cache && beep_volume == beep_volume_cache) {
1427 nsamples = beep_nsamples_cache;
1428 } else {
1429 period = srate * 256 / hz; /* fixed point */
1430 ncycles = BEEP_BUFLEN * 256 / period;
1431 nsamples = (period * ncycles) >> 8;
1432 f = ncycles * 65536 / nsamples;
1433 j = 0;
1434 p = beep_buf;
1435 for (i = 0; i < nsamples; ++i, p += 2) {
1436 p[0] = p[1] = beep_wform[j >> 8] * beep_volume;
1437 j = (j + f) & 0xffff;
1438 }
1439 beep_hz_cache = hz;
1440 beep_volume_cache = beep_volume;
1441 beep_nsamples_cache = nsamples;
1442 }
1443
1444#if 0
1445 st_le16(&beep_dbdma_cmd->req_count, nsamples*4);
1446 st_le16(&beep_dbdma_cmd->xfer_status, 0);
1447 st_le32(&beep_dbdma_cmd->cmd_dep, virt_to_bus(beep_dbdma_cmd));
1448 st_le32(&beep_dbdma_cmd->phy_addr, virt_to_bus(beep_buf));
1449 awacs_beep_state = 1;
1450
1451 spin_lock_irqsave(&cs4218_lock, flags);
1452 if (beep_playing) { /* i.e. haven't been terminated already */
1453 out_le32(&awacs_txdma->control, (RUN|WAKE|FLUSH|PAUSE) << 16);
1454 out_le32(&awacs->control,
1455 (in_le32(&awacs->control) & ~0x1f00)
1456 | (beep_speed << 8));
1457 out_le32(&awacs->byteswap, 0);
1458 out_le32(&awacs_txdma->cmdptr, virt_to_bus(beep_dbdma_cmd));
1459 out_le32(&awacs_txdma->control, RUN | (RUN << 16));
1460 }
1461 spin_unlock_irqrestore(&cs4218_lock, flags);
1462#endif
1463}
1464
1465static MACHINE mach_cs4218 = {
1466 .owner = THIS_MODULE,
1467 .name = "HIOX CS4218",
1468 .name2 = "Built-in Sound",
1469 .dma_alloc = CS_Alloc,
1470 .dma_free = CS_Free,
1471 .irqinit = CS_IrqInit,
1472#ifdef MODULE
1473 .irqcleanup = CS_IrqCleanup,
1474#endif /* MODULE */
1475 .init = CS_Init,
1476 .silence = CS_Silence,
1477 .setFormat = CS_SetFormat,
1478 .setVolume = CS_SetVolume,
1479 .play = CS_Play
1480};
1481
1482
1483/*** Mid level stuff *********************************************************/
1484
1485
1486static void sound_silence(void)
1487{
1488 /* update hardware settings one more */
1489 (*sound.mach.init)();
1490
1491 (*sound.mach.silence)();
1492}
1493
1494
1495static void sound_init(void)
1496{
1497 (*sound.mach.init)();
1498}
1499
1500
1501static int sound_set_format(int format)
1502{
1503 return(*sound.mach.setFormat)(format);
1504}
1505
1506
1507static int sound_set_speed(int speed)
1508{
1509 if (speed < 0)
1510 return(sound.soft.speed);
1511
1512 sound.soft.speed = speed;
1513 (*sound.mach.init)();
1514 if (sound.minDev == SND_DEV_DSP)
1515 sound.dsp.speed = sound.soft.speed;
1516
1517 return(sound.soft.speed);
1518}
1519
1520
1521static int sound_set_stereo(int stereo)
1522{
1523 if (stereo < 0)
1524 return(sound.soft.stereo);
1525
1526 stereo = !!stereo; /* should be 0 or 1 now */
1527
1528 sound.soft.stereo = stereo;
1529 if (sound.minDev == SND_DEV_DSP)
1530 sound.dsp.stereo = stereo;
1531 (*sound.mach.init)();
1532
1533 return(stereo);
1534}
1535
1536
1537static int sound_set_volume(int volume)
1538{
1539 return(*sound.mach.setVolume)(volume);
1540}
1541
1542static ssize_t sound_copy_translate(const u_char *userPtr,
1543 size_t userCount,
1544 u_char frame[], ssize_t *frameUsed,
1545 ssize_t frameLeft)
1546{
1547 ssize_t (*ct_func)(const u_char *, size_t, u_char *, ssize_t *, ssize_t) = NULL;
1548
1549 switch (sound.soft.format) {
1550 case AFMT_MU_LAW:
1551 ct_func = sound.trans_write->ct_ulaw;
1552 break;
1553 case AFMT_A_LAW:
1554 ct_func = sound.trans_write->ct_alaw;
1555 break;
1556 case AFMT_S8:
1557 ct_func = sound.trans_write->ct_s8;
1558 break;
1559 case AFMT_U8:
1560 ct_func = sound.trans_write->ct_u8;
1561 break;
1562 case AFMT_S16_BE:
1563 ct_func = sound.trans_write->ct_s16be;
1564 break;
1565 case AFMT_U16_BE:
1566 ct_func = sound.trans_write->ct_u16be;
1567 break;
1568 case AFMT_S16_LE:
1569 ct_func = sound.trans_write->ct_s16le;
1570 break;
1571 case AFMT_U16_LE:
1572 ct_func = sound.trans_write->ct_u16le;
1573 break;
1574 }
1575 if (ct_func)
1576 return ct_func(userPtr, userCount, frame, frameUsed, frameLeft);
1577 else
1578 return 0;
1579}
1580
1581static ssize_t sound_copy_translate_read(const u_char *userPtr,
1582 size_t userCount,
1583 u_char frame[], ssize_t *frameUsed,
1584 ssize_t frameLeft)
1585{
1586 ssize_t (*ct_func)(const u_char *, size_t, u_char *, ssize_t *, ssize_t) = NULL;
1587
1588 switch (sound.soft.format) {
1589 case AFMT_MU_LAW:
1590 ct_func = sound.trans_read->ct_ulaw;
1591 break;
1592 case AFMT_A_LAW:
1593 ct_func = sound.trans_read->ct_alaw;
1594 break;
1595 case AFMT_S8:
1596 ct_func = sound.trans_read->ct_s8;
1597 break;
1598 case AFMT_U8:
1599 ct_func = sound.trans_read->ct_u8;
1600 break;
1601 case AFMT_S16_BE:
1602 ct_func = sound.trans_read->ct_s16be;
1603 break;
1604 case AFMT_U16_BE:
1605 ct_func = sound.trans_read->ct_u16be;
1606 break;
1607 case AFMT_S16_LE:
1608 ct_func = sound.trans_read->ct_s16le;
1609 break;
1610 case AFMT_U16_LE:
1611 ct_func = sound.trans_read->ct_u16le;
1612 break;
1613 }
1614 if (ct_func)
1615 return ct_func(userPtr, userCount, frame, frameUsed, frameLeft);
1616 else
1617 return 0;
1618}
1619
1620
1621/*
1622 * /dev/mixer abstraction
1623 */
1624
1625static int mixer_open(struct inode *inode, struct file *file)
1626{
1627 mixer.busy = 1;
1628 return nonseekable_open(inode, file);
1629}
1630
1631
1632static int mixer_release(struct inode *inode, struct file *file)
1633{
1634 mixer.busy = 0;
1635 return 0;
1636}
1637
1638
1639static int mixer_ioctl(struct inode *inode, struct file *file, u_int cmd,
1640 u_long arg)
1641{
1642 int data;
1643 uint tmpcs;
1644
1645 if (_SIOC_DIR(cmd) & _SIOC_WRITE)
1646 mixer.modify_counter++;
1647 if (cmd == OSS_GETVERSION)
1648 return IOCTL_OUT(arg, SOUND_VERSION);
1649 switch (cmd) {
1650 case SOUND_MIXER_INFO: {
1651 mixer_info info;
1652 strlcpy(info.id, "CS4218_TDM", sizeof(info.id));
1653 strlcpy(info.name, "CS4218_TDM", sizeof(info.name));
1654 info.name[sizeof(info.name)-1] = 0;
1655 info.modify_counter = mixer.modify_counter;
1656 if (copy_to_user((int *)arg, &info, sizeof(info)))
1657 return -EFAULT;
1658 return 0;
1659 }
1660 case SOUND_MIXER_READ_DEVMASK:
1661 data = SOUND_MASK_VOLUME | SOUND_MASK_LINE
1662 | SOUND_MASK_MIC | SOUND_MASK_RECLEV
1663 | SOUND_MASK_ALTPCM;
1664 return IOCTL_OUT(arg, data);
1665 case SOUND_MIXER_READ_RECMASK:
1666 data = SOUND_MASK_LINE | SOUND_MASK_MIC;
1667 return IOCTL_OUT(arg, data);
1668 case SOUND_MIXER_READ_RECSRC:
1669 if (cs4218_control & CS_DO1)
1670 data = SOUND_MASK_LINE;
1671 else
1672 data = SOUND_MASK_MIC;
1673 return IOCTL_OUT(arg, data);
1674 case SOUND_MIXER_WRITE_RECSRC:
1675 IOCTL_IN(arg, data);
1676 data &= (SOUND_MASK_LINE | SOUND_MASK_MIC);
1677 if (data & SOUND_MASK_LINE)
1678 tmpcs = cs4218_control |
1679 (CS_ISL | CS_ISR | CS_DO1);
1680 if (data & SOUND_MASK_MIC)
1681 tmpcs = cs4218_control &
1682 ~(CS_ISL | CS_ISR | CS_DO1);
1683 if (tmpcs != cs4218_control)
1684 cs4218_ctl_write(tmpcs);
1685 return IOCTL_OUT(arg, data);
1686 case SOUND_MIXER_READ_STEREODEVS:
1687 data = SOUND_MASK_VOLUME | SOUND_MASK_RECLEV;
1688 return IOCTL_OUT(arg, data);
1689 case SOUND_MIXER_READ_CAPS:
1690 return IOCTL_OUT(arg, 0);
1691 case SOUND_MIXER_READ_VOLUME:
1692 data = (cs4218_control & CS_MUTE)? 0:
1693 cs_get_volume(cs4218_control);
1694 return IOCTL_OUT(arg, data);
1695 case SOUND_MIXER_WRITE_VOLUME:
1696 IOCTL_IN(arg, data);
1697 return IOCTL_OUT(arg, sound_set_volume(data));
1698 case SOUND_MIXER_WRITE_ALTPCM: /* really bell volume */
1699 IOCTL_IN(arg, data);
1700 beep_volume = data & 0xff;
1701 /* fall through */
1702 case SOUND_MIXER_READ_ALTPCM:
1703 return IOCTL_OUT(arg, beep_volume);
1704 case SOUND_MIXER_WRITE_RECLEV:
1705 IOCTL_IN(arg, data);
1706 data = cs_set_gain(data);
1707 return IOCTL_OUT(arg, data);
1708 case SOUND_MIXER_READ_RECLEV:
1709 data = cs_get_gain(cs4218_control);
1710 return IOCTL_OUT(arg, data);
1711 }
1712
1713 return -EINVAL;
1714}
1715
1716
1717static struct file_operations mixer_fops =
1718{
1719 .owner = THIS_MODULE,
1720 .llseek = sound_lseek,
1721 .ioctl = mixer_ioctl,
1722 .open = mixer_open,
1723 .release = mixer_release,
1724};
1725
1726
1727static void __init mixer_init(void)
1728{
1729 mixer_unit = register_sound_mixer(&mixer_fops, -1);
1730 if (mixer_unit < 0)
1731 return;
1732
1733 mixer.busy = 0;
1734 sound.treble = 0;
1735 sound.bass = 0;
1736
1737 /* Set Line input, no gain, no attenuation.
1738 */
1739 cs4218_control = CS_ISL | CS_ISR | CS_DO1;
1740 cs4218_control |= CS_LGAIN_SET(0) | CS_RGAIN_SET(0);
1741 cs4218_control |= CS_LATTEN_SET(0) | CS_RATTEN_SET(0);
1742 cs4218_ctl_write(cs4218_control);
1743}
1744
1745
1746/*
1747 * Sound queue stuff, the heart of the driver
1748 */
1749
1750
1751static int sq_allocate_buffers(void)
1752{
1753 int i;
1754
1755 if (sound_buffers)
1756 return 0;
1757 sound_buffers = kmalloc (numBufs * sizeof(char *), GFP_KERNEL);
1758 if (!sound_buffers)
1759 return -ENOMEM;
1760 for (i = 0; i < numBufs; i++) {
1761 sound_buffers[i] = sound.mach.dma_alloc (bufSize << 10, GFP_KERNEL);
1762 if (!sound_buffers[i]) {
1763 while (i--)
1764 sound.mach.dma_free (sound_buffers[i], bufSize << 10);
1765 kfree (sound_buffers);
1766 sound_buffers = 0;
1767 return -ENOMEM;
1768 }
1769 }
1770 return 0;
1771}
1772
1773
1774static void sq_release_buffers(void)
1775{
1776 int i;
1777
1778 if (sound_buffers) {
1779 for (i = 0; i < numBufs; i++)
1780 sound.mach.dma_free (sound_buffers[i], bufSize << 10);
1781 kfree (sound_buffers);
1782 sound_buffers = 0;
1783 }
1784}
1785
1786
1787static int sq_allocate_read_buffers(void)
1788{
1789 int i;
1790
1791 if (sound_read_buffers)
1792 return 0;
1793 sound_read_buffers = kmalloc(numReadBufs * sizeof(char *), GFP_KERNEL);
1794 if (!sound_read_buffers)
1795 return -ENOMEM;
1796 for (i = 0; i < numBufs; i++) {
1797 sound_read_buffers[i] = sound.mach.dma_alloc (readbufSize<<10,
1798 GFP_KERNEL);
1799 if (!sound_read_buffers[i]) {
1800 while (i--)
1801 sound.mach.dma_free (sound_read_buffers[i],
1802 readbufSize << 10);
1803 kfree (sound_read_buffers);
1804 sound_read_buffers = 0;
1805 return -ENOMEM;
1806 }
1807 }
1808 return 0;
1809}
1810
1811static void sq_release_read_buffers(void)
1812{
1813 int i;
1814
1815 if (sound_read_buffers) {
1816 cpmp->cp_smc[1].smc_smcmr &= ~SMCMR_REN;
1817 for (i = 0; i < numReadBufs; i++)
1818 sound.mach.dma_free (sound_read_buffers[i],
1819 bufSize << 10);
1820 kfree (sound_read_buffers);
1821 sound_read_buffers = 0;
1822 }
1823}
1824
1825
1826static void sq_setup(int numBufs, int bufSize, char **write_buffers)
1827{
1828 int i;
1829 volatile cbd_t *bdp;
1830 volatile cpm8xx_t *cp;
1831 volatile smc_t *sp;
1832
1833 /* Make sure the SMC transmit is shut down.
1834 */
1835 cp = cpmp;
1836 sp = &cpmp->cp_smc[1];
1837 sp->smc_smcmr &= ~SMCMR_TEN;
1838
1839 sq.max_count = numBufs;
1840 sq.max_active = numBufs;
1841 sq.block_size = bufSize;
1842 sq.buffers = write_buffers;
1843
1844 sq.front = sq.count = 0;
1845 sq.rear = -1;
1846 sq.syncing = 0;
1847 sq.active = 0;
1848
1849 bdp = tx_base;
1850 for (i=0; i<numBufs; i++) {
1851 bdp->cbd_bufaddr = virt_to_bus(write_buffers[i]);
1852 bdp++;
1853 }
1854
1855 /* This causes the SMC to sync up with the first buffer again.
1856 */
1857 cp->cp_cpcr = mk_cr_cmd(CPM_CR_CH_SMC2, CPM_CR_INIT_TX) | CPM_CR_FLG;
1858 while (cp->cp_cpcr & CPM_CR_FLG);
1859}
1860
1861static void read_sq_setup(int numBufs, int bufSize, char **read_buffers)
1862{
1863 int i;
1864 volatile cbd_t *bdp;
1865 volatile cpm8xx_t *cp;
1866 volatile smc_t *sp;
1867
1868 /* Make sure the SMC receive is shut down.
1869 */
1870 cp = cpmp;
1871 sp = &cpmp->cp_smc[1];
1872 sp->smc_smcmr &= ~SMCMR_REN;
1873
1874 read_sq.max_count = numBufs;
1875 read_sq.max_active = numBufs;
1876 read_sq.block_size = bufSize;
1877 read_sq.buffers = read_buffers;
1878
1879 read_sq.front = read_sq.count = 0;
1880 read_sq.rear = 0;
1881 read_sq.rear_size = 0;
1882 read_sq.syncing = 0;
1883 read_sq.active = 0;
1884
1885 bdp = rx_base;
1886 for (i=0; i<numReadBufs; i++) {
1887 bdp->cbd_bufaddr = virt_to_bus(read_buffers[i]);
1888 bdp->cbd_datlen = read_sq.block_size;
1889 bdp++;
1890 }
1891
1892 /* This causes the SMC to sync up with the first buffer again.
1893 */
1894 cp->cp_cpcr = mk_cr_cmd(CPM_CR_CH_SMC2, CPM_CR_INIT_RX) | CPM_CR_FLG;
1895 while (cp->cp_cpcr & CPM_CR_FLG);
1896}
1897
1898
1899static void sq_play(void)
1900{
1901 (*sound.mach.play)();
1902}
1903
1904
1905/* ++TeSche: radically changed this one too */
1906
1907static ssize_t sq_write(struct file *file, const char *src, size_t uLeft,
1908 loff_t *ppos)
1909{
1910 ssize_t uWritten = 0;
1911 u_char *dest;
1912 ssize_t uUsed, bUsed, bLeft;
1913
1914 /* ++TeSche: Is something like this necessary?
1915 * Hey, that's an honest question! Or does any other part of the
1916 * filesystem already checks this situation? I really don't know.
1917 */
1918 if (uLeft == 0)
1919 return 0;
1920
1921 /* The interrupt doesn't start to play the last, incomplete frame.
1922 * Thus we can append to it without disabling the interrupts! (Note
1923 * also that sq.rear isn't affected by the interrupt.)
1924 */
1925
1926 if (sq.count > 0 && (bLeft = sq.block_size-sq.rear_size) > 0) {
1927 dest = sq_block_address(sq.rear);
1928 bUsed = sq.rear_size;
1929 uUsed = sound_copy_translate(src, uLeft, dest, &bUsed, bLeft);
1930 if (uUsed <= 0)
1931 return uUsed;
1932 src += uUsed;
1933 uWritten += uUsed;
1934 uLeft -= uUsed;
1935 sq.rear_size = bUsed;
1936 }
1937
1938 do {
1939 while (sq.count == sq.max_active) {
1940 sq_play();
1941 if (NON_BLOCKING(sq.open_mode))
1942 return uWritten > 0 ? uWritten : -EAGAIN;
1943 SLEEP(sq.action_queue);
1944 if (SIGNAL_RECEIVED)
1945 return uWritten > 0 ? uWritten : -EINTR;
1946 }
1947
1948 /* Here, we can avoid disabling the interrupt by first
1949 * copying and translating the data, and then updating
1950 * the sq variables. Until this is done, the interrupt
1951 * won't see the new frame and we can work on it
1952 * undisturbed.
1953 */
1954
1955 dest = sq_block_address((sq.rear+1) % sq.max_count);
1956 bUsed = 0;
1957 bLeft = sq.block_size;
1958 uUsed = sound_copy_translate(src, uLeft, dest, &bUsed, bLeft);
1959 if (uUsed <= 0)
1960 break;
1961 src += uUsed;
1962 uWritten += uUsed;
1963 uLeft -= uUsed;
1964 if (bUsed) {
1965 sq.rear = (sq.rear+1) % sq.max_count;
1966 sq.rear_size = bUsed;
1967 sq.count++;
1968 }
1969 } while (bUsed); /* uUsed may have been 0 */
1970
1971 sq_play();
1972
1973 return uUsed < 0? uUsed: uWritten;
1974}
1975
1976
1977/***********/
1978
1979/* Here is how the values are used for reading.
1980 * The value 'active' simply indicates the DMA is running. This is
1981 * done so the driver semantics are DMA starts when the first read is
1982 * posted. The value 'front' indicates the buffer we should next
1983 * send to the user. The value 'rear' indicates the buffer the DMA is
1984 * currently filling. When 'front' == 'rear' the buffer "ring" is
1985 * empty (we always have an empty available). The 'rear_size' is used
1986 * to track partial offsets into the current buffer. Right now, I just keep
1987 * The DMA running. If the reader can't keep up, the interrupt tosses
1988 * the oldest buffer. We could also shut down the DMA in this case.
1989 */
1990static ssize_t sq_read(struct file *file, char *dst, size_t uLeft,
1991 loff_t *ppos)
1992{
1993
1994 ssize_t uRead, bLeft, bUsed, uUsed;
1995
1996 if (uLeft == 0)
1997 return 0;
1998
1999 if (!read_sq.active)
2000 CS_Record(); /* Kick off the record process. */
2001
2002 uRead = 0;
2003
2004 /* Move what the user requests, depending upon other options.
2005 */
2006 while (uLeft > 0) {
2007
2008 /* When front == rear, the DMA is not done yet.
2009 */
2010 while (read_sq.front == read_sq.rear) {
2011 if (NON_BLOCKING(read_sq.open_mode)) {
2012 return uRead > 0 ? uRead : -EAGAIN;
2013 }
2014 SLEEP(read_sq.action_queue);
2015 if (SIGNAL_RECEIVED)
2016 return uRead > 0 ? uRead : -EINTR;
2017 }
2018
2019 /* The amount we move is either what is left in the
2020 * current buffer or what the user wants.
2021 */
2022 bLeft = read_sq.block_size - read_sq.rear_size;
2023 bUsed = read_sq.rear_size;
2024 uUsed = sound_copy_translate_read(dst, uLeft,
2025 read_sq.buffers[read_sq.front], &bUsed, bLeft);
2026 if (uUsed <= 0)
2027 return uUsed;
2028 dst += uUsed;
2029 uRead += uUsed;
2030 uLeft -= uUsed;
2031 read_sq.rear_size += bUsed;
2032 if (read_sq.rear_size >= read_sq.block_size) {
2033 read_sq.rear_size = 0;
2034 read_sq.front++;
2035 if (read_sq.front >= read_sq.max_active)
2036 read_sq.front = 0;
2037 }
2038 }
2039 return uRead;
2040}
2041
2042static int sq_open(struct inode *inode, struct file *file)
2043{
2044 int rc = 0;
2045
2046 if (file->f_mode & FMODE_WRITE) {
2047 if (sq.busy) {
2048 rc = -EBUSY;
2049 if (NON_BLOCKING(file->f_flags))
2050 goto err_out;
2051 rc = -EINTR;
2052 while (sq.busy) {
2053 SLEEP(sq.open_queue);
2054 if (SIGNAL_RECEIVED)
2055 goto err_out;
2056 }
2057 }
2058 sq.busy = 1; /* Let's play spot-the-race-condition */
2059
2060 if (sq_allocate_buffers()) goto err_out_nobusy;
2061
2062 sq_setup(numBufs, bufSize<<10,sound_buffers);
2063 sq.open_mode = file->f_mode;
2064 }
2065
2066
2067 if (file->f_mode & FMODE_READ) {
2068 if (read_sq.busy) {
2069 rc = -EBUSY;
2070 if (NON_BLOCKING(file->f_flags))
2071 goto err_out;
2072 rc = -EINTR;
2073 while (read_sq.busy) {
2074 SLEEP(read_sq.open_queue);
2075 if (SIGNAL_RECEIVED)
2076 goto err_out;
2077 }
2078 rc = 0;
2079 }
2080 read_sq.busy = 1;
2081 if (sq_allocate_read_buffers()) goto err_out_nobusy;
2082
2083 read_sq_setup(numReadBufs,readbufSize<<10, sound_read_buffers);
2084 read_sq.open_mode = file->f_mode;
2085 }
2086
2087 /* Start up the 4218 by:
2088 * Reset.
2089 * Enable, unreset.
2090 */
2091 *((volatile uint *)HIOX_CSR4_ADDR) &= ~HIOX_CSR4_RSTAUDIO;
2092 eieio();
2093 *((volatile uint *)HIOX_CSR4_ADDR) |= HIOX_CSR4_ENAUDIO;
2094 mdelay(50);
2095 *((volatile uint *)HIOX_CSR4_ADDR) |= HIOX_CSR4_RSTAUDIO;
2096
2097 /* We need to send the current control word in case someone
2098 * opened /dev/mixer and changed things while we were shut
2099 * down. Chances are good the initialization that follows
2100 * would have done this, but it is still possible it wouldn't.
2101 */
2102 cs4218_ctl_write(cs4218_control);
2103
2104 sound.minDev = iminor(inode) & 0x0f;
2105 sound.soft = sound.dsp;
2106 sound.hard = sound.dsp;
2107 sound_init();
2108 if ((iminor(inode) & 0x0f) == SND_DEV_AUDIO) {
2109 sound_set_speed(8000);
2110 sound_set_stereo(0);
2111 sound_set_format(AFMT_MU_LAW);
2112 }
2113
2114 return nonseekable_open(inode, file);
2115
2116err_out_nobusy:
2117 if (file->f_mode & FMODE_WRITE) {
2118 sq.busy = 0;
2119 WAKE_UP(sq.open_queue);
2120 }
2121 if (file->f_mode & FMODE_READ) {
2122 read_sq.busy = 0;
2123 WAKE_UP(read_sq.open_queue);
2124 }
2125err_out:
2126 return rc;
2127}
2128
2129
2130static void sq_reset(void)
2131{
2132 sound_silence();
2133 sq.active = 0;
2134 sq.count = 0;
2135 sq.front = (sq.rear+1) % sq.max_count;
2136#if 0
2137 init_tdm_buffers();
2138#endif
2139}
2140
2141
2142static int sq_fsync(struct file *filp, struct dentry *dentry)
2143{
2144 int rc = 0;
2145
2146 sq.syncing = 1;
2147 sq_play(); /* there may be an incomplete frame waiting */
2148
2149 while (sq.active) {
2150 SLEEP(sq.sync_queue);
2151 if (SIGNAL_RECEIVED) {
2152 /* While waiting for audio output to drain, an
2153 * interrupt occurred. Stop audio output immediately
2154 * and clear the queue. */
2155 sq_reset();
2156 rc = -EINTR;
2157 break;
2158 }
2159 }
2160
2161 sq.syncing = 0;
2162 return rc;
2163}
2164
2165static int sq_release(struct inode *inode, struct file *file)
2166{
2167 int rc = 0;
2168
2169 if (sq.busy)
2170 rc = sq_fsync(file, file->f_dentry);
2171 sound.soft = sound.dsp;
2172 sound.hard = sound.dsp;
2173 sound_silence();
2174
2175 sq_release_read_buffers();
2176 sq_release_buffers();
2177
2178 if (file->f_mode & FMODE_READ) {
2179 read_sq.busy = 0;
2180 WAKE_UP(read_sq.open_queue);
2181 }
2182
2183 if (file->f_mode & FMODE_WRITE) {
2184 sq.busy = 0;
2185 WAKE_UP(sq.open_queue);
2186 }
2187
2188 /* Shut down the SMC.
2189 */
2190 cpmp->cp_smc[1].smc_smcmr &= ~(SMCMR_TEN | SMCMR_REN);
2191
2192 /* Shut down the codec.
2193 */
2194 *((volatile uint *)HIOX_CSR4_ADDR) |= HIOX_CSR4_RSTAUDIO;
2195 eieio();
2196 *((volatile uint *)HIOX_CSR4_ADDR) &= ~HIOX_CSR4_ENAUDIO;
2197
2198 /* Wake up a process waiting for the queue being released.
2199 * Note: There may be several processes waiting for a call
2200 * to open() returning. */
2201
2202 return rc;
2203}
2204
2205
2206static int sq_ioctl(struct inode *inode, struct file *file, u_int cmd,
2207 u_long arg)
2208{
2209 u_long fmt;
2210 int data;
2211#if 0
2212 int size, nbufs;
2213#else
2214 int size;
2215#endif
2216
2217 switch (cmd) {
2218 case SNDCTL_DSP_RESET:
2219 sq_reset();
2220 return 0;
2221 case SNDCTL_DSP_POST:
2222 case SNDCTL_DSP_SYNC:
2223 return sq_fsync(file, file->f_dentry);
2224
2225 /* ++TeSche: before changing any of these it's
2226 * probably wise to wait until sound playing has
2227 * settled down. */
2228 case SNDCTL_DSP_SPEED:
2229 sq_fsync(file, file->f_dentry);
2230 IOCTL_IN(arg, data);
2231 return IOCTL_OUT(arg, sound_set_speed(data));
2232 case SNDCTL_DSP_STEREO:
2233 sq_fsync(file, file->f_dentry);
2234 IOCTL_IN(arg, data);
2235 return IOCTL_OUT(arg, sound_set_stereo(data));
2236 case SOUND_PCM_WRITE_CHANNELS:
2237 sq_fsync(file, file->f_dentry);
2238 IOCTL_IN(arg, data);
2239 return IOCTL_OUT(arg, sound_set_stereo(data-1)+1);
2240 case SNDCTL_DSP_SETFMT:
2241 sq_fsync(file, file->f_dentry);
2242 IOCTL_IN(arg, data);
2243 return IOCTL_OUT(arg, sound_set_format(data));
2244 case SNDCTL_DSP_GETFMTS:
2245 fmt = 0;
2246 if (sound.trans_write) {
2247 if (sound.trans_write->ct_ulaw)
2248 fmt |= AFMT_MU_LAW;
2249 if (sound.trans_write->ct_alaw)
2250 fmt |= AFMT_A_LAW;
2251 if (sound.trans_write->ct_s8)
2252 fmt |= AFMT_S8;
2253 if (sound.trans_write->ct_u8)
2254 fmt |= AFMT_U8;
2255 if (sound.trans_write->ct_s16be)
2256 fmt |= AFMT_S16_BE;
2257 if (sound.trans_write->ct_u16be)
2258 fmt |= AFMT_U16_BE;
2259 if (sound.trans_write->ct_s16le)
2260 fmt |= AFMT_S16_LE;
2261 if (sound.trans_write->ct_u16le)
2262 fmt |= AFMT_U16_LE;
2263 }
2264 return IOCTL_OUT(arg, fmt);
2265 case SNDCTL_DSP_GETBLKSIZE:
2266 size = sq.block_size
2267 * sound.soft.size * (sound.soft.stereo + 1)
2268 / (sound.hard.size * (sound.hard.stereo + 1));
2269 return IOCTL_OUT(arg, size);
2270 case SNDCTL_DSP_SUBDIVIDE:
2271 break;
2272#if 0 /* Sorry can't do this at the moment. The CPM allocated buffers
2273 * long ago that can't be changed.
2274 */
2275 case SNDCTL_DSP_SETFRAGMENT:
2276 if (sq.count || sq.active || sq.syncing)
2277 return -EINVAL;
2278 IOCTL_IN(arg, size);
2279 nbufs = size >> 16;
2280 if (nbufs < 2 || nbufs > numBufs)
2281 nbufs = numBufs;
2282 size &= 0xffff;
2283 if (size >= 8 && size <= 30) {
2284 size = 1 << size;
2285 size *= sound.hard.size * (sound.hard.stereo + 1);
2286 size /= sound.soft.size * (sound.soft.stereo + 1);
2287 if (size > (bufSize << 10))
2288 size = bufSize << 10;
2289 } else
2290 size = bufSize << 10;
2291 sq_setup(numBufs, size, sound_buffers);
2292 sq.max_active = nbufs;
2293 return 0;
2294#endif
2295
2296 default:
2297 return mixer_ioctl(inode, file, cmd, arg);
2298 }
2299 return -EINVAL;
2300}
2301
2302
2303
2304static struct file_operations sq_fops =
2305{
2306 .owner = THIS_MODULE,
2307 .llseek = sound_lseek,
2308 .read = sq_read, /* sq_read */
2309 .write = sq_write,
2310 .ioctl = sq_ioctl,
2311 .open = sq_open,
2312 .release = sq_release,
2313};
2314
2315
2316static void __init sq_init(void)
2317{
2318 sq_unit = register_sound_dsp(&sq_fops, -1);
2319 if (sq_unit < 0)
2320 return;
2321
2322 init_waitqueue_head(&sq.action_queue);
2323 init_waitqueue_head(&sq.open_queue);
2324 init_waitqueue_head(&sq.sync_queue);
2325 init_waitqueue_head(&read_sq.action_queue);
2326 init_waitqueue_head(&read_sq.open_queue);
2327 init_waitqueue_head(&read_sq.sync_queue);
2328
2329 sq.busy = 0;
2330 read_sq.busy = 0;
2331
2332 /* whatever you like as startup mode for /dev/dsp,
2333 * (/dev/audio hasn't got a startup mode). note that
2334 * once changed a new open() will *not* restore these!
2335 */
2336 sound.dsp.format = AFMT_S16_BE;
2337 sound.dsp.stereo = 1;
2338 sound.dsp.size = 16;
2339
2340 /* set minimum rate possible without expanding */
2341 sound.dsp.speed = 8000;
2342
2343 /* before the first open to /dev/dsp this wouldn't be set */
2344 sound.soft = sound.dsp;
2345 sound.hard = sound.dsp;
2346
2347 sound_silence();
2348}
2349
2350/*
2351 * /dev/sndstat
2352 */
2353
2354
2355/* state.buf should not overflow! */
2356
2357static int state_open(struct inode *inode, struct file *file)
2358{
2359 char *buffer = state.buf, *mach = "", cs4218_buf[50];
2360 int len = 0;
2361
2362 if (state.busy)
2363 return -EBUSY;
2364
2365 state.ptr = 0;
2366 state.busy = 1;
2367
2368 sprintf(cs4218_buf, "Crystal CS4218 on TDM, ");
2369 mach = cs4218_buf;
2370
2371 len += sprintf(buffer+len, "%sDMA sound driver:\n", mach);
2372
2373 len += sprintf(buffer+len, "\tsound.format = 0x%x", sound.soft.format);
2374 switch (sound.soft.format) {
2375 case AFMT_MU_LAW:
2376 len += sprintf(buffer+len, " (mu-law)");
2377 break;
2378 case AFMT_A_LAW:
2379 len += sprintf(buffer+len, " (A-law)");
2380 break;
2381 case AFMT_U8:
2382 len += sprintf(buffer+len, " (unsigned 8 bit)");
2383 break;
2384 case AFMT_S8:
2385 len += sprintf(buffer+len, " (signed 8 bit)");
2386 break;
2387 case AFMT_S16_BE:
2388 len += sprintf(buffer+len, " (signed 16 bit big)");
2389 break;
2390 case AFMT_U16_BE:
2391 len += sprintf(buffer+len, " (unsigned 16 bit big)");
2392 break;
2393 case AFMT_S16_LE:
2394 len += sprintf(buffer+len, " (signed 16 bit little)");
2395 break;
2396 case AFMT_U16_LE:
2397 len += sprintf(buffer+len, " (unsigned 16 bit little)");
2398 break;
2399 }
2400 len += sprintf(buffer+len, "\n");
2401 len += sprintf(buffer+len, "\tsound.speed = %dHz (phys. %dHz)\n",
2402 sound.soft.speed, sound.hard.speed);
2403 len += sprintf(buffer+len, "\tsound.stereo = 0x%x (%s)\n",
2404 sound.soft.stereo, sound.soft.stereo ? "stereo" : "mono");
2405 len += sprintf(buffer+len, "\tsq.block_size = %d sq.max_count = %d"
2406 " sq.max_active = %d\n",
2407 sq.block_size, sq.max_count, sq.max_active);
2408 len += sprintf(buffer+len, "\tsq.count = %d sq.rear_size = %d\n", sq.count,
2409 sq.rear_size);
2410 len += sprintf(buffer+len, "\tsq.active = %d sq.syncing = %d\n",
2411 sq.active, sq.syncing);
2412 state.len = len;
2413 return nonseekable_open(inode, file);
2414}
2415
2416
2417static int state_release(struct inode *inode, struct file *file)
2418{
2419 state.busy = 0;
2420 return 0;
2421}
2422
2423
2424static ssize_t state_read(struct file *file, char *buf, size_t count,
2425 loff_t *ppos)
2426{
2427 int n = state.len - state.ptr;
2428 if (n > count)
2429 n = count;
2430 if (n <= 0)
2431 return 0;
2432 if (copy_to_user(buf, &state.buf[state.ptr], n))
2433 return -EFAULT;
2434 state.ptr += n;
2435 return n;
2436}
2437
2438
2439static struct file_operations state_fops =
2440{
2441 .owner = THIS_MODULE,
2442 .llseek = sound_lseek,
2443 .read = state_read,
2444 .open = state_open,
2445 .release = state_release,
2446};
2447
2448
2449static void __init state_init(void)
2450{
2451 state_unit = register_sound_special(&state_fops, SND_DEV_STATUS);
2452 if (state_unit < 0)
2453 return;
2454 state.busy = 0;
2455}
2456
2457
2458/*** Common stuff ********************************************************/
2459
2460static long long sound_lseek(struct file *file, long long offset, int orig)
2461{
2462 return -ESPIPE;
2463}
2464
2465
2466/*** Config & Setup **********************************************************/
2467
2468
2469int __init tdm8xx_sound_init(void)
2470{
2471 int i, has_sound;
2472 uint dp_offset;
2473 volatile uint *sirp;
2474 volatile cbd_t *bdp;
2475 volatile cpm8xx_t *cp;
2476 volatile smc_t *sp;
2477 volatile smc_uart_t *up;
2478 volatile immap_t *immap;
2479
2480 has_sound = 0;
2481
2482 /* Program the SI/TSA to use TDMa, connected to SMC2, for 4 bytes.
2483 */
2484 cp = cpmp; /* Get pointer to Communication Processor */
2485 immap = (immap_t *)IMAP_ADDR; /* and to internal registers */
2486
2487 /* Set all TDMa control bits to zero. This enables most features
2488 * we want.
2489 */
2490 cp->cp_simode &= ~0x00000fff;
2491
2492 /* Enable common receive/transmit clock pins, use IDL format.
2493 * Sync on falling edge, transmit rising clock, receive falling
2494 * clock, delay 1 bit on both Tx and Rx. Common Tx/Rx clocks and
2495 * sync.
2496 * Connect SMC2 to TSA.
2497 */
2498 cp->cp_simode |= 0x80000141;
2499
2500 /* Configure port A pins for TDMa operation.
2501 * The RPX-Lite (MPC850/823) loses SMC2 when TDM is used.
2502 */
2503 immap->im_ioport.iop_papar |= 0x01c0; /* Enable TDMa functions */
2504 immap->im_ioport.iop_padir |= 0x00c0; /* Enable TDMa Tx/Rx */
2505 immap->im_ioport.iop_padir &= ~0x0100; /* Enable L1RCLKa */
2506
2507 immap->im_ioport.iop_pcpar |= 0x0800; /* Enable L1RSYNCa */
2508 immap->im_ioport.iop_pcdir &= ~0x0800;
2509
2510 /* Initialize the SI TDM routing table. We use TDMa only.
2511 * The receive table and transmit table each have only one
2512 * entry, to capture/send four bytes after each frame pulse.
2513 * The 16-bit ram entry is 0000 0001 1000 1111. (SMC2)
2514 */
2515 cp->cp_sigmr = 0;
2516 sirp = (uint *)cp->cp_siram;
2517
2518 *sirp = 0x018f0000; /* Receive entry */
2519 sirp += 64;
2520 *sirp = 0x018f0000; /* Tramsmit entry */
2521
2522 /* Enable single TDMa routing.
2523 */
2524 cp->cp_sigmr = 0x04;
2525
2526 /* Initialize the SMC for transparent operation.
2527 */
2528 sp = &cpmp->cp_smc[1];
2529 up = (smc_uart_t *)&cp->cp_dparam[PROFF_SMC2];
2530
2531 /* We need to allocate a transmit and receive buffer
2532 * descriptors from dual port ram.
2533 */
2534 dp_addr = cpm_dpalloc(sizeof(cbd_t) * numReadBufs, 8);
2535
2536 /* Set the physical address of the host memory
2537 * buffers in the buffer descriptors, and the
2538 * virtual address for us to work with.
2539 */
2540 bdp = (cbd_t *)&cp->cp_dpmem[dp_addr];
2541 up->smc_rbase = dp_offset;
2542 rx_cur = rx_base = (cbd_t *)bdp;
2543
2544 for (i=0; i<(numReadBufs-1); i++) {
2545 bdp->cbd_bufaddr = 0;
2546 bdp->cbd_datlen = 0;
2547 bdp->cbd_sc = BD_SC_EMPTY | BD_SC_INTRPT;
2548 bdp++;
2549 }
2550 bdp->cbd_bufaddr = 0;
2551 bdp->cbd_datlen = 0;
2552 bdp->cbd_sc = BD_SC_WRAP | BD_SC_EMPTY | BD_SC_INTRPT;
2553
2554 /* Now, do the same for the transmit buffers.
2555 */
2556 dp_offset = cpm_dpalloc(sizeof(cbd_t) * numBufs, 8);
2557
2558 bdp = (cbd_t *)&cp->cp_dpmem[dp_addr];
2559 up->smc_tbase = dp_offset;
2560 tx_cur = tx_base = (cbd_t *)bdp;
2561
2562 for (i=0; i<(numBufs-1); i++) {
2563 bdp->cbd_bufaddr = 0;
2564 bdp->cbd_datlen = 0;
2565 bdp->cbd_sc = BD_SC_INTRPT;
2566 bdp++;
2567 }
2568 bdp->cbd_bufaddr = 0;
2569 bdp->cbd_datlen = 0;
2570 bdp->cbd_sc = (BD_SC_WRAP | BD_SC_INTRPT);
2571
2572 /* Set transparent SMC mode.
2573 * A few things are specific to our application. The codec interface
2574 * is MSB first, hence the REVD selection. The CD/CTS pulse are
2575 * used by the TSA to indicate the frame start to the SMC.
2576 */
2577 up->smc_rfcr = SCC_EB;
2578 up->smc_tfcr = SCC_EB;
2579 up->smc_mrblr = readbufSize * 1024;
2580
2581 /* Set 16-bit reversed data, transparent mode.
2582 */
2583 sp->smc_smcmr = smcr_mk_clen(15) |
2584 SMCMR_SM_TRANS | SMCMR_REVD | SMCMR_BS;
2585
2586 /* Enable and clear events.
2587 * Because of FIFO delays, all we need is the receive interrupt
2588 * and we can process both the current receive and current
2589 * transmit interrupt within a few microseconds of the transmit.
2590 */
2591 sp->smc_smce = 0xff;
2592 sp->smc_smcm = SMCM_TXE | SMCM_TX | SMCM_RX;
2593
2594 /* Send the CPM an initialize command.
2595 */
2596 cp->cp_cpcr = mk_cr_cmd(CPM_CR_CH_SMC2,
2597 CPM_CR_INIT_TRX) | CPM_CR_FLG;
2598 while (cp->cp_cpcr & CPM_CR_FLG);
2599
2600 sound.mach = mach_cs4218;
2601 has_sound = 1;
2602
2603 /* Initialize beep stuff */
2604 orig_mksound = kd_mksound;
2605 kd_mksound = cs_mksound;
2606 beep_buf = (short *) kmalloc(BEEP_BUFLEN * 4, GFP_KERNEL);
2607 if (beep_buf == NULL)
2608 printk(KERN_WARNING "dmasound: no memory for "
2609 "beep buffer\n");
2610
2611 if (!has_sound)
2612 return -ENODEV;
2613
2614 /* Initialize the software SPI.
2615 */
2616 sw_spi_init();
2617
2618 /* Set up sound queue, /dev/audio and /dev/dsp. */
2619
2620 /* Set default settings. */
2621 sq_init();
2622
2623 /* Set up /dev/sndstat. */
2624 state_init();
2625
2626 /* Set up /dev/mixer. */
2627 mixer_init();
2628
2629 if (!sound.mach.irqinit()) {
2630 printk(KERN_ERR "DMA sound driver: Interrupt initialization failed\n");
2631 return -ENODEV;
2632 }
2633#ifdef MODULE
2634 irq_installed = 1;
2635#endif
2636
2637 printk(KERN_INFO "DMA sound driver installed, using %d buffers of %dk.\n",
2638 numBufs, bufSize);
2639
2640 return 0;
2641}
2642
2643/* Due to FIFOs and bit delays, the transmit interrupt occurs a few
2644 * microseconds ahead of the receive interrupt.
2645 * When we get an interrupt, we service the transmit first, then
2646 * check for a receive to prevent the overhead of returning through
2647 * the interrupt handler only to get back here right away during
2648 * full duplex operation.
2649 */
2650static void
2651cs4218_intr(void *dev_id, struct pt_regs *regs)
2652{
2653 volatile smc_t *sp;
2654 volatile cpm8xx_t *cp;
2655
2656 sp = &cpmp->cp_smc[1];
2657
2658 if (sp->smc_smce & SCCM_TX) {
2659 sp->smc_smce = SCCM_TX;
2660 cs4218_tdm_tx_intr((void *)sp);
2661 }
2662
2663 if (sp->smc_smce & SCCM_RX) {
2664 sp->smc_smce = SCCM_RX;
2665 cs4218_tdm_rx_intr((void *)sp);
2666 }
2667
2668 if (sp->smc_smce & SCCM_TXE) {
2669 /* Transmit underrun. This happens with the application
2670 * didn't keep up sending buffers. We tell the SMC to
2671 * restart, which will cause it to poll the current (next)
2672 * BD. If the user supplied data since this occurred,
2673 * we just start running again. If they didn't, the SMC
2674 * will poll the descriptor until data is placed there.
2675 */
2676 sp->smc_smce = SCCM_TXE;
2677 cp = cpmp; /* Get pointer to Communication Processor */
2678 cp->cp_cpcr = mk_cr_cmd(CPM_CR_CH_SMC2,
2679 CPM_CR_RESTART_TX) | CPM_CR_FLG;
2680 while (cp->cp_cpcr & CPM_CR_FLG);
2681 }
2682}
2683
2684
2685#define MAXARGS 8 /* Should be sufficient for now */
2686
2687void __init dmasound_setup(char *str, int *ints)
2688{
2689 /* check the bootstrap parameter for "dmasound=" */
2690
2691 switch (ints[0]) {
2692 case 3:
2693 if ((ints[3] < 0) || (ints[3] > MAX_CATCH_RADIUS))
2694 printk("dmasound_setup: invalid catch radius, using default = %d\n", catchRadius);
2695 else
2696 catchRadius = ints[3];
2697 /* fall through */
2698 case 2:
2699 if (ints[1] < MIN_BUFFERS)
2700 printk("dmasound_setup: invalid number of buffers, using default = %d\n", numBufs);
2701 else
2702 numBufs = ints[1];
2703 if (ints[2] < MIN_BUFSIZE || ints[2] > MAX_BUFSIZE)
2704 printk("dmasound_setup: invalid buffer size, using default = %d\n", bufSize);
2705 else
2706 bufSize = ints[2];
2707 break;
2708 case 0:
2709 break;
2710 default:
2711 printk("dmasound_setup: invalid number of arguments\n");
2712 }
2713}
2714
2715/* Software SPI functions.
2716 * These are on Port B.
2717 */
2718#define PB_SPICLK ((uint)0x00000002)
2719#define PB_SPIMOSI ((uint)0x00000004)
2720#define PB_SPIMISO ((uint)0x00000008)
2721
2722static
2723void sw_spi_init(void)
2724{
2725 volatile cpm8xx_t *cp;
2726 volatile uint *hcsr4;
2727
2728 hcsr4 = (volatile uint *)HIOX_CSR4_ADDR;
2729 cp = cpmp; /* Get pointer to Communication Processor */
2730
2731 *hcsr4 &= ~HIOX_CSR4_AUDSPISEL; /* Disable SPI select */
2732
2733 /* Make these Port B signals general purpose I/O.
2734 * First, make sure the clock is low.
2735 */
2736 cp->cp_pbdat &= ~PB_SPICLK;
2737 cp->cp_pbpar &= ~(PB_SPICLK | PB_SPIMOSI | PB_SPIMISO);
2738
2739 /* Clock and Master Output are outputs.
2740 */
2741 cp->cp_pbdir |= (PB_SPICLK | PB_SPIMOSI);
2742
2743 /* Master Input.
2744 */
2745 cp->cp_pbdir &= ~PB_SPIMISO;
2746
2747}
2748
2749/* Write the CS4218 control word out the SPI port. While the
2750 * the control word is going out, the status word is arriving.
2751 */
2752static
2753uint cs4218_ctl_write(uint ctlreg)
2754{
2755 uint status;
2756
2757 sw_spi_io((u_char *)&ctlreg, (u_char *)&status, 4);
2758
2759 /* Shadow the control register.....I guess we could do
2760 * the same for the status, but for now we just return it
2761 * and let the caller decide.
2762 */
2763 cs4218_control = ctlreg;
2764 return status;
2765}
2766
2767static
2768void sw_spi_io(u_char *obuf, u_char *ibuf, uint bcnt)
2769{
2770 int bits, i;
2771 u_char outbyte, inbyte;
2772 volatile cpm8xx_t *cp;
2773 volatile uint *hcsr4;
2774
2775 hcsr4 = (volatile uint *)HIOX_CSR4_ADDR;
2776 cp = cpmp; /* Get pointer to Communication Processor */
2777
2778 /* The timing on the bus is pretty slow. Code inefficiency
2779 * and eieio() is our friend here :-).
2780 */
2781 cp->cp_pbdat &= ~PB_SPICLK;
2782 *hcsr4 |= HIOX_CSR4_AUDSPISEL; /* Enable SPI select */
2783 eieio();
2784
2785 /* Clock in/out the bytes. Data is valid on the falling edge
2786 * of the clock. Data is MSB first.
2787 */
2788 for (i=0; i<bcnt; i++) {
2789 outbyte = *obuf++;
2790 inbyte = 0;
2791 for (bits=0; bits<8; bits++) {
2792 eieio();
2793 cp->cp_pbdat |= PB_SPICLK;
2794 eieio();
2795 if (outbyte & 0x80)
2796 cp->cp_pbdat |= PB_SPIMOSI;
2797 else
2798 cp->cp_pbdat &= ~PB_SPIMOSI;
2799 eieio();
2800 cp->cp_pbdat &= ~PB_SPICLK;
2801 eieio();
2802 outbyte <<= 1;
2803 inbyte <<= 1;
2804 if (cp->cp_pbdat & PB_SPIMISO)
2805 inbyte |= 1;
2806 }
2807 *ibuf++ = inbyte;
2808 }
2809
2810 *hcsr4 &= ~HIOX_CSR4_AUDSPISEL; /* Disable SPI select */
2811 eieio();
2812}
2813
2814void cleanup_module(void)
2815{
2816 if (irq_installed) {
2817 sound_silence();
2818#ifdef MODULE
2819 sound.mach.irqcleanup();
2820#endif
2821 }
2822
2823 sq_release_read_buffers();
2824 sq_release_buffers();
2825
2826 if (mixer_unit >= 0)
2827 unregister_sound_mixer(mixer_unit);
2828 if (state_unit >= 0)
2829 unregister_sound_special(state_unit);
2830 if (sq_unit >= 0)
2831 unregister_sound_dsp(sq_unit);
2832}
2833
2834module_init(tdm8xx_sound_init);
2835module_exit(cleanup_module);
2836
diff --git a/arch/ppc/8xx_io/enet.c b/arch/ppc/8xx_io/enet.c
new file mode 100644
index 000000000000..4ea7158e5062
--- /dev/null
+++ b/arch/ppc/8xx_io/enet.c
@@ -0,0 +1,971 @@
1/*
2 * Ethernet driver for Motorola MPC8xx.
3 * Copyright (c) 1997 Dan Malek (dmalek@jlc.net)
4 *
5 * I copied the basic skeleton from the lance driver, because I did not
6 * know how to write the Linux driver, but I did know how the LANCE worked.
7 *
8 * This version of the driver is somewhat selectable for the different
9 * processor/board combinations. It works for the boards I know about
10 * now, and should be easily modified to include others. Some of the
11 * configuration information is contained in <asm/commproc.h> and the
12 * remainder is here.
13 *
14 * Buffer descriptors are kept in the CPM dual port RAM, and the frame
15 * buffers are in the host memory.
16 *
17 * Right now, I am very watseful with the buffers. I allocate memory
18 * pages and then divide them into 2K frame buffers. This way I know I
19 * have buffers large enough to hold one frame within one buffer descriptor.
20 * Once I get this working, I will use 64 or 128 byte CPM buffers, which
21 * will be much more memory efficient and will easily handle lots of
22 * small packets.
23 *
24 */
25#include <linux/config.h>
26#include <linux/kernel.h>
27#include <linux/sched.h>
28#include <linux/string.h>
29#include <linux/ptrace.h>
30#include <linux/errno.h>
31#include <linux/ioport.h>
32#include <linux/slab.h>
33#include <linux/interrupt.h>
34#include <linux/pci.h>
35#include <linux/init.h>
36#include <linux/delay.h>
37#include <linux/netdevice.h>
38#include <linux/etherdevice.h>
39#include <linux/skbuff.h>
40#include <linux/spinlock.h>
41#include <linux/dma-mapping.h>
42#include <linux/bitops.h>
43
44#include <asm/8xx_immap.h>
45#include <asm/pgtable.h>
46#include <asm/mpc8xx.h>
47#include <asm/uaccess.h>
48#include <asm/commproc.h>
49
50/*
51 * Theory of Operation
52 *
53 * The MPC8xx CPM performs the Ethernet processing on SCC1. It can use
54 * an aribtrary number of buffers on byte boundaries, but must have at
55 * least two receive buffers to prevent constant overrun conditions.
56 *
57 * The buffer descriptors are allocated from the CPM dual port memory
58 * with the data buffers allocated from host memory, just like all other
59 * serial communication protocols. The host memory buffers are allocated
60 * from the free page pool, and then divided into smaller receive and
61 * transmit buffers. The size of the buffers should be a power of two,
62 * since that nicely divides the page. This creates a ring buffer
63 * structure similar to the LANCE and other controllers.
64 *
65 * Like the LANCE driver:
66 * The driver runs as two independent, single-threaded flows of control. One
67 * is the send-packet routine, which enforces single-threaded use by the
68 * cep->tx_busy flag. The other thread is the interrupt handler, which is
69 * single threaded by the hardware and other software.
70 *
71 * The send packet thread has partial control over the Tx ring and the
72 * 'cep->tx_busy' flag. It sets the tx_busy flag whenever it's queuing a Tx
73 * packet. If the next queue slot is empty, it clears the tx_busy flag when
74 * finished otherwise it sets the 'lp->tx_full' flag.
75 *
76 * The MBX has a control register external to the MPC8xx that has some
77 * control of the Ethernet interface. Information is in the manual for
78 * your board.
79 *
80 * The RPX boards have an external control/status register. Consult the
81 * programming documents for details unique to your board.
82 *
83 * For the TQM8xx(L) modules, there is no control register interface.
84 * All functions are directly controlled using I/O pins. See <asm/commproc.h>.
85 */
86
87/* The transmitter timeout
88 */
89#define TX_TIMEOUT (2*HZ)
90
91/* The number of Tx and Rx buffers. These are allocated from the page
92 * pool. The code may assume these are power of two, so it is best
93 * to keep them that size.
94 * We don't need to allocate pages for the transmitter. We just use
95 * the skbuffer directly.
96 */
97#ifdef CONFIG_ENET_BIG_BUFFERS
98#define CPM_ENET_RX_PAGES 32
99#define CPM_ENET_RX_FRSIZE 2048
100#define CPM_ENET_RX_FRPPG (PAGE_SIZE / CPM_ENET_RX_FRSIZE)
101#define RX_RING_SIZE (CPM_ENET_RX_FRPPG * CPM_ENET_RX_PAGES)
102#define TX_RING_SIZE 64 /* Must be power of two */
103#define TX_RING_MOD_MASK 63 /* for this to work */
104#else
105#define CPM_ENET_RX_PAGES 4
106#define CPM_ENET_RX_FRSIZE 2048
107#define CPM_ENET_RX_FRPPG (PAGE_SIZE / CPM_ENET_RX_FRSIZE)
108#define RX_RING_SIZE (CPM_ENET_RX_FRPPG * CPM_ENET_RX_PAGES)
109#define TX_RING_SIZE 8 /* Must be power of two */
110#define TX_RING_MOD_MASK 7 /* for this to work */
111#endif
112
113/* The CPM stores dest/src/type, data, and checksum for receive packets.
114 */
115#define PKT_MAXBUF_SIZE 1518
116#define PKT_MINBUF_SIZE 64
117#define PKT_MAXBLR_SIZE 1520
118
119/* The CPM buffer descriptors track the ring buffers. The rx_bd_base and
120 * tx_bd_base always point to the base of the buffer descriptors. The
121 * cur_rx and cur_tx point to the currently available buffer.
122 * The dirty_tx tracks the current buffer that is being sent by the
123 * controller. The cur_tx and dirty_tx are equal under both completely
124 * empty and completely full conditions. The empty/ready indicator in
125 * the buffer descriptor determines the actual condition.
126 */
127struct scc_enet_private {
128 /* The saved address of a sent-in-place packet/buffer, for skfree(). */
129 struct sk_buff* tx_skbuff[TX_RING_SIZE];
130 ushort skb_cur;
131 ushort skb_dirty;
132
133 /* CPM dual port RAM relative addresses.
134 */
135 cbd_t *rx_bd_base; /* Address of Rx and Tx buffers. */
136 cbd_t *tx_bd_base;
137 cbd_t *cur_rx, *cur_tx; /* The next free ring entry */
138 cbd_t *dirty_tx; /* The ring entries to be free()ed. */
139 scc_t *sccp;
140
141 /* Virtual addresses for the receive buffers because we can't
142 * do a __va() on them anymore.
143 */
144 unsigned char *rx_vaddr[RX_RING_SIZE];
145 struct net_device_stats stats;
146 uint tx_full;
147 spinlock_t lock;
148};
149
150static int scc_enet_open(struct net_device *dev);
151static int scc_enet_start_xmit(struct sk_buff *skb, struct net_device *dev);
152static int scc_enet_rx(struct net_device *dev);
153static void scc_enet_interrupt(void *dev_id, struct pt_regs *regs);
154static int scc_enet_close(struct net_device *dev);
155static struct net_device_stats *scc_enet_get_stats(struct net_device *dev);
156static void set_multicast_list(struct net_device *dev);
157
158/* Get this from various configuration locations (depends on board).
159*/
160/*static ushort my_enet_addr[] = { 0x0800, 0x3e26, 0x1559 };*/
161
162/* Typically, 860(T) boards use SCC1 for Ethernet, and other 8xx boards
163 * use SCC2. Some even may use SCC3.
164 * This is easily extended if necessary.
165 */
166#if defined(CONFIG_SCC3_ENET)
167#define CPM_CR_ENET CPM_CR_CH_SCC3
168#define PROFF_ENET PROFF_SCC3
169#define SCC_ENET 2 /* Index, not number! */
170#define CPMVEC_ENET CPMVEC_SCC3
171#elif defined(CONFIG_SCC2_ENET)
172#define CPM_CR_ENET CPM_CR_CH_SCC2
173#define PROFF_ENET PROFF_SCC2
174#define SCC_ENET 1 /* Index, not number! */
175#define CPMVEC_ENET CPMVEC_SCC2
176#elif defined(CONFIG_SCC1_ENET)
177#define CPM_CR_ENET CPM_CR_CH_SCC1
178#define PROFF_ENET PROFF_SCC1
179#define SCC_ENET 0 /* Index, not number! */
180#define CPMVEC_ENET CPMVEC_SCC1
181#else
182#error CONFIG_SCCx_ENET not defined
183#endif
184
185static int
186scc_enet_open(struct net_device *dev)
187{
188
189 /* I should reset the ring buffers here, but I don't yet know
190 * a simple way to do that.
191 */
192
193 netif_start_queue(dev);
194 return 0; /* Always succeed */
195}
196
197static int
198scc_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
199{
200 struct scc_enet_private *cep = (struct scc_enet_private *)dev->priv;
201 volatile cbd_t *bdp;
202
203 /* Fill in a Tx ring entry */
204 bdp = cep->cur_tx;
205
206#ifndef final_version
207 if (bdp->cbd_sc & BD_ENET_TX_READY) {
208 /* Ooops. All transmit buffers are full. Bail out.
209 * This should not happen, since cep->tx_busy should be set.
210 */
211 printk("%s: tx queue full!.\n", dev->name);
212 return 1;
213 }
214#endif
215
216 /* Clear all of the status flags.
217 */
218 bdp->cbd_sc &= ~BD_ENET_TX_STATS;
219
220 /* If the frame is short, tell CPM to pad it.
221 */
222 if (skb->len <= ETH_ZLEN)
223 bdp->cbd_sc |= BD_ENET_TX_PAD;
224 else
225 bdp->cbd_sc &= ~BD_ENET_TX_PAD;
226
227 /* Set buffer length and buffer pointer.
228 */
229 bdp->cbd_datlen = skb->len;
230 bdp->cbd_bufaddr = __pa(skb->data);
231
232 /* Save skb pointer.
233 */
234 cep->tx_skbuff[cep->skb_cur] = skb;
235
236 cep->stats.tx_bytes += skb->len;
237 cep->skb_cur = (cep->skb_cur+1) & TX_RING_MOD_MASK;
238
239 /* Push the data cache so the CPM does not get stale memory
240 * data.
241 */
242 flush_dcache_range((unsigned long)(skb->data),
243 (unsigned long)(skb->data + skb->len));
244
245 spin_lock_irq(&cep->lock);
246
247 /* Send it on its way. Tell CPM its ready, interrupt when done,
248 * its the last BD of the frame, and to put the CRC on the end.
249 */
250 bdp->cbd_sc |= (BD_ENET_TX_READY | BD_ENET_TX_INTR | BD_ENET_TX_LAST | BD_ENET_TX_TC);
251
252 dev->trans_start = jiffies;
253
254 /* If this was the last BD in the ring, start at the beginning again.
255 */
256 if (bdp->cbd_sc & BD_ENET_TX_WRAP)
257 bdp = cep->tx_bd_base;
258 else
259 bdp++;
260
261 if (bdp->cbd_sc & BD_ENET_TX_READY) {
262 netif_stop_queue(dev);
263 cep->tx_full = 1;
264 }
265
266 cep->cur_tx = (cbd_t *)bdp;
267
268 spin_unlock_irq(&cep->lock);
269
270 return 0;
271}
272
273static void
274scc_enet_timeout(struct net_device *dev)
275{
276 struct scc_enet_private *cep = (struct scc_enet_private *)dev->priv;
277
278 printk("%s: transmit timed out.\n", dev->name);
279 cep->stats.tx_errors++;
280#ifndef final_version
281 {
282 int i;
283 cbd_t *bdp;
284 printk(" Ring data dump: cur_tx %p%s cur_rx %p.\n",
285 cep->cur_tx, cep->tx_full ? " (full)" : "",
286 cep->cur_rx);
287 bdp = cep->tx_bd_base;
288 for (i = 0 ; i < TX_RING_SIZE; i++, bdp++)
289 printk("%04x %04x %08x\n",
290 bdp->cbd_sc,
291 bdp->cbd_datlen,
292 bdp->cbd_bufaddr);
293 bdp = cep->rx_bd_base;
294 for (i = 0 ; i < RX_RING_SIZE; i++, bdp++)
295 printk("%04x %04x %08x\n",
296 bdp->cbd_sc,
297 bdp->cbd_datlen,
298 bdp->cbd_bufaddr);
299 }
300#endif
301 if (!cep->tx_full)
302 netif_wake_queue(dev);
303}
304
305/* The interrupt handler.
306 * This is called from the CPM handler, not the MPC core interrupt.
307 */
308static void
309scc_enet_interrupt(void *dev_id, struct pt_regs *regs)
310{
311 struct net_device *dev = dev_id;
312 volatile struct scc_enet_private *cep;
313 volatile cbd_t *bdp;
314 ushort int_events;
315 int must_restart;
316
317 cep = (struct scc_enet_private *)dev->priv;
318
319 /* Get the interrupt events that caused us to be here.
320 */
321 int_events = cep->sccp->scc_scce;
322 cep->sccp->scc_scce = int_events;
323 must_restart = 0;
324
325 /* Handle receive event in its own function.
326 */
327 if (int_events & SCCE_ENET_RXF)
328 scc_enet_rx(dev_id);
329
330 /* Check for a transmit error. The manual is a little unclear
331 * about this, so the debug code until I get it figured out. It
332 * appears that if TXE is set, then TXB is not set. However,
333 * if carrier sense is lost during frame transmission, the TXE
334 * bit is set, "and continues the buffer transmission normally."
335 * I don't know if "normally" implies TXB is set when the buffer
336 * descriptor is closed.....trial and error :-).
337 */
338
339 /* Transmit OK, or non-fatal error. Update the buffer descriptors.
340 */
341 if (int_events & (SCCE_ENET_TXE | SCCE_ENET_TXB)) {
342 spin_lock(&cep->lock);
343 bdp = cep->dirty_tx;
344 while ((bdp->cbd_sc&BD_ENET_TX_READY)==0) {
345 if ((bdp==cep->cur_tx) && (cep->tx_full == 0))
346 break;
347
348 if (bdp->cbd_sc & BD_ENET_TX_HB) /* No heartbeat */
349 cep->stats.tx_heartbeat_errors++;
350 if (bdp->cbd_sc & BD_ENET_TX_LC) /* Late collision */
351 cep->stats.tx_window_errors++;
352 if (bdp->cbd_sc & BD_ENET_TX_RL) /* Retrans limit */
353 cep->stats.tx_aborted_errors++;
354 if (bdp->cbd_sc & BD_ENET_TX_UN) /* Underrun */
355 cep->stats.tx_fifo_errors++;
356 if (bdp->cbd_sc & BD_ENET_TX_CSL) /* Carrier lost */
357 cep->stats.tx_carrier_errors++;
358
359
360 /* No heartbeat or Lost carrier are not really bad errors.
361 * The others require a restart transmit command.
362 */
363 if (bdp->cbd_sc &
364 (BD_ENET_TX_LC | BD_ENET_TX_RL | BD_ENET_TX_UN)) {
365 must_restart = 1;
366 cep->stats.tx_errors++;
367 }
368
369 cep->stats.tx_packets++;
370
371 /* Deferred means some collisions occurred during transmit,
372 * but we eventually sent the packet OK.
373 */
374 if (bdp->cbd_sc & BD_ENET_TX_DEF)
375 cep->stats.collisions++;
376
377 /* Free the sk buffer associated with this last transmit.
378 */
379 dev_kfree_skb_irq(cep->tx_skbuff[cep->skb_dirty]);
380 cep->skb_dirty = (cep->skb_dirty + 1) & TX_RING_MOD_MASK;
381
382 /* Update pointer to next buffer descriptor to be transmitted.
383 */
384 if (bdp->cbd_sc & BD_ENET_TX_WRAP)
385 bdp = cep->tx_bd_base;
386 else
387 bdp++;
388
389 /* I don't know if we can be held off from processing these
390 * interrupts for more than one frame time. I really hope
391 * not. In such a case, we would now want to check the
392 * currently available BD (cur_tx) and determine if any
393 * buffers between the dirty_tx and cur_tx have also been
394 * sent. We would want to process anything in between that
395 * does not have BD_ENET_TX_READY set.
396 */
397
398 /* Since we have freed up a buffer, the ring is no longer
399 * full.
400 */
401 if (cep->tx_full) {
402 cep->tx_full = 0;
403 if (netif_queue_stopped(dev))
404 netif_wake_queue(dev);
405 }
406
407 cep->dirty_tx = (cbd_t *)bdp;
408 }
409
410 if (must_restart) {
411 volatile cpm8xx_t *cp;
412
413 /* Some transmit errors cause the transmitter to shut
414 * down. We now issue a restart transmit. Since the
415 * errors close the BD and update the pointers, the restart
416 * _should_ pick up without having to reset any of our
417 * pointers either.
418 */
419 cp = cpmp;
420 cp->cp_cpcr =
421 mk_cr_cmd(CPM_CR_ENET, CPM_CR_RESTART_TX) | CPM_CR_FLG;
422 while (cp->cp_cpcr & CPM_CR_FLG);
423 }
424 spin_unlock(&cep->lock);
425 }
426
427 /* Check for receive busy, i.e. packets coming but no place to
428 * put them. This "can't happen" because the receive interrupt
429 * is tossing previous frames.
430 */
431 if (int_events & SCCE_ENET_BSY) {
432 cep->stats.rx_dropped++;
433 printk("CPM ENET: BSY can't happen.\n");
434 }
435
436 return;
437}
438
439/* During a receive, the cur_rx points to the current incoming buffer.
440 * When we update through the ring, if the next incoming buffer has
441 * not been given to the system, we just set the empty indicator,
442 * effectively tossing the packet.
443 */
444static int
445scc_enet_rx(struct net_device *dev)
446{
447 struct scc_enet_private *cep;
448 volatile cbd_t *bdp;
449 struct sk_buff *skb;
450 ushort pkt_len;
451
452 cep = (struct scc_enet_private *)dev->priv;
453
454 /* First, grab all of the stats for the incoming packet.
455 * These get messed up if we get called due to a busy condition.
456 */
457 bdp = cep->cur_rx;
458
459for (;;) {
460 if (bdp->cbd_sc & BD_ENET_RX_EMPTY)
461 break;
462
463#ifndef final_version
464 /* Since we have allocated space to hold a complete frame, both
465 * the first and last indicators should be set.
466 */
467 if ((bdp->cbd_sc & (BD_ENET_RX_FIRST | BD_ENET_RX_LAST)) !=
468 (BD_ENET_RX_FIRST | BD_ENET_RX_LAST))
469 printk("CPM ENET: rcv is not first+last\n");
470#endif
471
472 /* Frame too long or too short.
473 */
474 if (bdp->cbd_sc & (BD_ENET_RX_LG | BD_ENET_RX_SH))
475 cep->stats.rx_length_errors++;
476 if (bdp->cbd_sc & BD_ENET_RX_NO) /* Frame alignment */
477 cep->stats.rx_frame_errors++;
478 if (bdp->cbd_sc & BD_ENET_RX_CR) /* CRC Error */
479 cep->stats.rx_crc_errors++;
480 if (bdp->cbd_sc & BD_ENET_RX_OV) /* FIFO overrun */
481 cep->stats.rx_crc_errors++;
482
483 /* Report late collisions as a frame error.
484 * On this error, the BD is closed, but we don't know what we
485 * have in the buffer. So, just drop this frame on the floor.
486 */
487 if (bdp->cbd_sc & BD_ENET_RX_CL) {
488 cep->stats.rx_frame_errors++;
489 }
490 else {
491
492 /* Process the incoming frame.
493 */
494 cep->stats.rx_packets++;
495 pkt_len = bdp->cbd_datlen;
496 cep->stats.rx_bytes += pkt_len;
497
498 /* This does 16 byte alignment, much more than we need.
499 * The packet length includes FCS, but we don't want to
500 * include that when passing upstream as it messes up
501 * bridging applications.
502 */
503 skb = dev_alloc_skb(pkt_len-4);
504
505 if (skb == NULL) {
506 printk("%s: Memory squeeze, dropping packet.\n", dev->name);
507 cep->stats.rx_dropped++;
508 }
509 else {
510 skb->dev = dev;
511 skb_put(skb,pkt_len-4); /* Make room */
512 eth_copy_and_sum(skb,
513 cep->rx_vaddr[bdp - cep->rx_bd_base],
514 pkt_len-4, 0);
515 skb->protocol=eth_type_trans(skb,dev);
516 netif_rx(skb);
517 }
518 }
519
520 /* Clear the status flags for this buffer.
521 */
522 bdp->cbd_sc &= ~BD_ENET_RX_STATS;
523
524 /* Mark the buffer empty.
525 */
526 bdp->cbd_sc |= BD_ENET_RX_EMPTY;
527
528 /* Update BD pointer to next entry.
529 */
530 if (bdp->cbd_sc & BD_ENET_RX_WRAP)
531 bdp = cep->rx_bd_base;
532 else
533 bdp++;
534
535 }
536 cep->cur_rx = (cbd_t *)bdp;
537
538 return 0;
539}
540
541static int
542scc_enet_close(struct net_device *dev)
543{
544 /* Don't know what to do yet.
545 */
546 netif_stop_queue(dev);
547
548 return 0;
549}
550
551static struct net_device_stats *scc_enet_get_stats(struct net_device *dev)
552{
553 struct scc_enet_private *cep = (struct scc_enet_private *)dev->priv;
554
555 return &cep->stats;
556}
557
558/* Set or clear the multicast filter for this adaptor.
559 * Skeleton taken from sunlance driver.
560 * The CPM Ethernet implementation allows Multicast as well as individual
561 * MAC address filtering. Some of the drivers check to make sure it is
562 * a group multicast address, and discard those that are not. I guess I
563 * will do the same for now, but just remove the test if you want
564 * individual filtering as well (do the upper net layers want or support
565 * this kind of feature?).
566 */
567
568static void set_multicast_list(struct net_device *dev)
569{
570 struct scc_enet_private *cep;
571 struct dev_mc_list *dmi;
572 u_char *mcptr, *tdptr;
573 volatile scc_enet_t *ep;
574 int i, j;
575 cep = (struct scc_enet_private *)dev->priv;
576
577 /* Get pointer to SCC area in parameter RAM.
578 */
579 ep = (scc_enet_t *)dev->base_addr;
580
581 if (dev->flags&IFF_PROMISC) {
582
583 /* Log any net taps. */
584 printk("%s: Promiscuous mode enabled.\n", dev->name);
585 cep->sccp->scc_psmr |= SCC_PSMR_PRO;
586 } else {
587
588 cep->sccp->scc_psmr &= ~SCC_PSMR_PRO;
589
590 if (dev->flags & IFF_ALLMULTI) {
591 /* Catch all multicast addresses, so set the
592 * filter to all 1's.
593 */
594 ep->sen_gaddr1 = 0xffff;
595 ep->sen_gaddr2 = 0xffff;
596 ep->sen_gaddr3 = 0xffff;
597 ep->sen_gaddr4 = 0xffff;
598 }
599 else {
600 /* Clear filter and add the addresses in the list.
601 */
602 ep->sen_gaddr1 = 0;
603 ep->sen_gaddr2 = 0;
604 ep->sen_gaddr3 = 0;
605 ep->sen_gaddr4 = 0;
606
607 dmi = dev->mc_list;
608
609 for (i=0; i<dev->mc_count; i++) {
610
611 /* Only support group multicast for now.
612 */
613 if (!(dmi->dmi_addr[0] & 1))
614 continue;
615
616 /* The address in dmi_addr is LSB first,
617 * and taddr is MSB first. We have to
618 * copy bytes MSB first from dmi_addr.
619 */
620 mcptr = (u_char *)dmi->dmi_addr + 5;
621 tdptr = (u_char *)&ep->sen_taddrh;
622 for (j=0; j<6; j++)
623 *tdptr++ = *mcptr--;
624
625 /* Ask CPM to run CRC and set bit in
626 * filter mask.
627 */
628 cpmp->cp_cpcr = mk_cr_cmd(CPM_CR_ENET, CPM_CR_SET_GADDR) | CPM_CR_FLG;
629 /* this delay is necessary here -- Cort */
630 udelay(10);
631 while (cpmp->cp_cpcr & CPM_CR_FLG);
632 }
633 }
634 }
635}
636
637/* Initialize the CPM Ethernet on SCC. If EPPC-Bug loaded us, or performed
638 * some other network I/O, a whole bunch of this has already been set up.
639 * It is no big deal if we do it again, we just have to disable the
640 * transmit and receive to make sure we don't catch the CPM with some
641 * inconsistent control information.
642 */
643static int __init scc_enet_init(void)
644{
645 struct net_device *dev;
646 struct scc_enet_private *cep;
647 int i, j, k, err;
648 uint dp_offset;
649 unsigned char *eap, *ba;
650 dma_addr_t mem_addr;
651 bd_t *bd;
652 volatile cbd_t *bdp;
653 volatile cpm8xx_t *cp;
654 volatile scc_t *sccp;
655 volatile scc_enet_t *ep;
656 volatile immap_t *immap;
657
658 cp = cpmp; /* Get pointer to Communication Processor */
659
660 immap = (immap_t *)(mfspr(SPRN_IMMR) & 0xFFFF0000); /* and to internal registers */
661
662 bd = (bd_t *)__res;
663
664 dev = alloc_etherdev(sizeof(*cep));
665 if (!dev)
666 return -ENOMEM;
667
668 cep = dev->priv;
669 spin_lock_init(&cep->lock);
670
671 /* Get pointer to SCC area in parameter RAM.
672 */
673 ep = (scc_enet_t *)(&cp->cp_dparam[PROFF_ENET]);
674
675 /* And another to the SCC register area.
676 */
677 sccp = (volatile scc_t *)(&cp->cp_scc[SCC_ENET]);
678 cep->sccp = (scc_t *)sccp; /* Keep the pointer handy */
679
680 /* Disable receive and transmit in case EPPC-Bug started it.
681 */
682 sccp->scc_gsmrl &= ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT);
683
684 /* Cookbook style from the MPC860 manual.....
685 * Not all of this is necessary if EPPC-Bug has initialized
686 * the network.
687 * So far we are lucky, all board configurations use the same
688 * pins, or at least the same I/O Port for these functions.....
689 * It can't last though......
690 */
691
692#if (defined(PA_ENET_RXD) && defined(PA_ENET_TXD))
693 /* Configure port A pins for Txd and Rxd.
694 */
695 immap->im_ioport.iop_papar |= (PA_ENET_RXD | PA_ENET_TXD);
696 immap->im_ioport.iop_padir &= ~(PA_ENET_RXD | PA_ENET_TXD);
697 immap->im_ioport.iop_paodr &= ~PA_ENET_TXD;
698#elif (defined(PB_ENET_RXD) && defined(PB_ENET_TXD))
699 /* Configure port B pins for Txd and Rxd.
700 */
701 immap->im_cpm.cp_pbpar |= (PB_ENET_RXD | PB_ENET_TXD);
702 immap->im_cpm.cp_pbdir &= ~(PB_ENET_RXD | PB_ENET_TXD);
703 immap->im_cpm.cp_pbodr &= ~PB_ENET_TXD;
704#else
705#error Exactly ONE pair of PA_ENET_[RT]XD, PB_ENET_[RT]XD must be defined
706#endif
707
708#if defined(PC_ENET_LBK)
709 /* Configure port C pins to disable External Loopback
710 */
711 immap->im_ioport.iop_pcpar &= ~PC_ENET_LBK;
712 immap->im_ioport.iop_pcdir |= PC_ENET_LBK;
713 immap->im_ioport.iop_pcso &= ~PC_ENET_LBK;
714 immap->im_ioport.iop_pcdat &= ~PC_ENET_LBK; /* Disable Loopback */
715#endif /* PC_ENET_LBK */
716
717 /* Configure port C pins to enable CLSN and RENA.
718 */
719 immap->im_ioport.iop_pcpar &= ~(PC_ENET_CLSN | PC_ENET_RENA);
720 immap->im_ioport.iop_pcdir &= ~(PC_ENET_CLSN | PC_ENET_RENA);
721 immap->im_ioport.iop_pcso |= (PC_ENET_CLSN | PC_ENET_RENA);
722
723 /* Configure port A for TCLK and RCLK.
724 */
725 immap->im_ioport.iop_papar |= (PA_ENET_TCLK | PA_ENET_RCLK);
726 immap->im_ioport.iop_padir &= ~(PA_ENET_TCLK | PA_ENET_RCLK);
727
728 /* Configure Serial Interface clock routing.
729 * First, clear all SCC bits to zero, then set the ones we want.
730 */
731 cp->cp_sicr &= ~SICR_ENET_MASK;
732 cp->cp_sicr |= SICR_ENET_CLKRT;
733
734 /* Manual says set SDDR, but I can't find anything with that
735 * name. I think it is a misprint, and should be SDCR. This
736 * has already been set by the communication processor initialization.
737 */
738
739 /* Allocate space for the buffer descriptors in the DP ram.
740 * These are relative offsets in the DP ram address space.
741 * Initialize base addresses for the buffer descriptors.
742 */
743 dp_offset = cpm_dpalloc(sizeof(cbd_t) * RX_RING_SIZE, 8);
744 ep->sen_genscc.scc_rbase = dp_offset;
745 cep->rx_bd_base = cpm_dpram_addr(dp_offset);
746
747 dp_offset = cpm_dpalloc(sizeof(cbd_t) * TX_RING_SIZE, 8);
748 ep->sen_genscc.scc_tbase = dp_offset;
749 cep->tx_bd_base = cpm_dpram_addr(dp_offset);
750
751 cep->dirty_tx = cep->cur_tx = cep->tx_bd_base;
752 cep->cur_rx = cep->rx_bd_base;
753
754 /* Issue init Rx BD command for SCC.
755 * Manual says to perform an Init Rx parameters here. We have
756 * to perform both Rx and Tx because the SCC may have been
757 * already running.
758 * In addition, we have to do it later because we don't yet have
759 * all of the BD control/status set properly.
760 cp->cp_cpcr = mk_cr_cmd(CPM_CR_ENET, CPM_CR_INIT_RX) | CPM_CR_FLG;
761 while (cp->cp_cpcr & CPM_CR_FLG);
762 */
763
764 /* Initialize function code registers for big-endian.
765 */
766 ep->sen_genscc.scc_rfcr = SCC_EB;
767 ep->sen_genscc.scc_tfcr = SCC_EB;
768
769 /* Set maximum bytes per receive buffer.
770 * This appears to be an Ethernet frame size, not the buffer
771 * fragment size. It must be a multiple of four.
772 */
773 ep->sen_genscc.scc_mrblr = PKT_MAXBLR_SIZE;
774
775 /* Set CRC preset and mask.
776 */
777 ep->sen_cpres = 0xffffffff;
778 ep->sen_cmask = 0xdebb20e3;
779
780 ep->sen_crcec = 0; /* CRC Error counter */
781 ep->sen_alec = 0; /* alignment error counter */
782 ep->sen_disfc = 0; /* discard frame counter */
783
784 ep->sen_pads = 0x8888; /* Tx short frame pad character */
785 ep->sen_retlim = 15; /* Retry limit threshold */
786
787 ep->sen_maxflr = PKT_MAXBUF_SIZE; /* maximum frame length register */
788 ep->sen_minflr = PKT_MINBUF_SIZE; /* minimum frame length register */
789
790 ep->sen_maxd1 = PKT_MAXBLR_SIZE; /* maximum DMA1 length */
791 ep->sen_maxd2 = PKT_MAXBLR_SIZE; /* maximum DMA2 length */
792
793 /* Clear hash tables.
794 */
795 ep->sen_gaddr1 = 0;
796 ep->sen_gaddr2 = 0;
797 ep->sen_gaddr3 = 0;
798 ep->sen_gaddr4 = 0;
799 ep->sen_iaddr1 = 0;
800 ep->sen_iaddr2 = 0;
801 ep->sen_iaddr3 = 0;
802 ep->sen_iaddr4 = 0;
803
804 /* Set Ethernet station address.
805 */
806 eap = (unsigned char *)&(ep->sen_paddrh);
807 for (i=5; i>=0; i--)
808 *eap++ = dev->dev_addr[i] = bd->bi_enetaddr[i];
809
810 ep->sen_pper = 0; /* 'cause the book says so */
811 ep->sen_taddrl = 0; /* temp address (LSB) */
812 ep->sen_taddrm = 0;
813 ep->sen_taddrh = 0; /* temp address (MSB) */
814
815 /* Now allocate the host memory pages and initialize the
816 * buffer descriptors.
817 */
818 bdp = cep->tx_bd_base;
819 for (i=0; i<TX_RING_SIZE; i++) {
820
821 /* Initialize the BD for every fragment in the page.
822 */
823 bdp->cbd_sc = 0;
824 bdp->cbd_bufaddr = 0;
825 bdp++;
826 }
827
828 /* Set the last buffer to wrap.
829 */
830 bdp--;
831 bdp->cbd_sc |= BD_SC_WRAP;
832
833 bdp = cep->rx_bd_base;
834 k = 0;
835 for (i=0; i<CPM_ENET_RX_PAGES; i++) {
836
837 /* Allocate a page.
838 */
839 ba = (unsigned char *)dma_alloc_coherent(NULL, PAGE_SIZE,
840 &mem_addr, GFP_KERNEL);
841 /* BUG: no check for failure */
842
843 /* Initialize the BD for every fragment in the page.
844 */
845 for (j=0; j<CPM_ENET_RX_FRPPG; j++) {
846 bdp->cbd_sc = BD_ENET_RX_EMPTY | BD_ENET_RX_INTR;
847 bdp->cbd_bufaddr = mem_addr;
848 cep->rx_vaddr[k++] = ba;
849 mem_addr += CPM_ENET_RX_FRSIZE;
850 ba += CPM_ENET_RX_FRSIZE;
851 bdp++;
852 }
853 }
854
855 /* Set the last buffer to wrap.
856 */
857 bdp--;
858 bdp->cbd_sc |= BD_SC_WRAP;
859
860 /* Let's re-initialize the channel now. We have to do it later
861 * than the manual describes because we have just now finished
862 * the BD initialization.
863 */
864 cp->cp_cpcr = mk_cr_cmd(CPM_CR_ENET, CPM_CR_INIT_TRX) | CPM_CR_FLG;
865 while (cp->cp_cpcr & CPM_CR_FLG);
866
867 cep->skb_cur = cep->skb_dirty = 0;
868
869 sccp->scc_scce = 0xffff; /* Clear any pending events */
870
871 /* Enable interrupts for transmit error, complete frame
872 * received, and any transmit buffer we have also set the
873 * interrupt flag.
874 */
875 sccp->scc_sccm = (SCCE_ENET_TXE | SCCE_ENET_RXF | SCCE_ENET_TXB);
876
877 /* Install our interrupt handler.
878 */
879 cpm_install_handler(CPMVEC_ENET, scc_enet_interrupt, dev);
880
881 /* Set GSMR_H to enable all normal operating modes.
882 * Set GSMR_L to enable Ethernet to MC68160.
883 */
884 sccp->scc_gsmrh = 0;
885 sccp->scc_gsmrl = (SCC_GSMRL_TCI | SCC_GSMRL_TPL_48 | SCC_GSMRL_TPP_10 | SCC_GSMRL_MODE_ENET);
886
887 /* Set sync/delimiters.
888 */
889 sccp->scc_dsr = 0xd555;
890
891 /* Set processing mode. Use Ethernet CRC, catch broadcast, and
892 * start frame search 22 bit times after RENA.
893 */
894 sccp->scc_psmr = (SCC_PSMR_ENCRC | SCC_PSMR_NIB22);
895
896 /* It is now OK to enable the Ethernet transmitter.
897 * Unfortunately, there are board implementation differences here.
898 */
899#if (!defined (PB_ENET_TENA) && defined (PC_ENET_TENA))
900 immap->im_ioport.iop_pcpar |= PC_ENET_TENA;
901 immap->im_ioport.iop_pcdir &= ~PC_ENET_TENA;
902#elif ( defined (PB_ENET_TENA) && !defined (PC_ENET_TENA))
903 cp->cp_pbpar |= PB_ENET_TENA;
904 cp->cp_pbdir |= PB_ENET_TENA;
905#else
906#error Configuration Error: define exactly ONE of PB_ENET_TENA, PC_ENET_TENA
907#endif
908
909#if defined(CONFIG_RPXLITE) || defined(CONFIG_RPXCLASSIC)
910 /* And while we are here, set the configuration to enable ethernet.
911 */
912 *((volatile uint *)RPX_CSR_ADDR) &= ~BCSR0_ETHLPBK;
913 *((volatile uint *)RPX_CSR_ADDR) |=
914 (BCSR0_ETHEN | BCSR0_COLTESTDIS | BCSR0_FULLDPLXDIS);
915#endif
916
917#ifdef CONFIG_BSEIP
918 /* BSE uses port B and C for PHY control.
919 */
920 cp->cp_pbpar &= ~(PB_BSE_POWERUP | PB_BSE_FDXDIS);
921 cp->cp_pbdir |= (PB_BSE_POWERUP | PB_BSE_FDXDIS);
922 cp->cp_pbdat |= (PB_BSE_POWERUP | PB_BSE_FDXDIS);
923
924 immap->im_ioport.iop_pcpar &= ~PC_BSE_LOOPBACK;
925 immap->im_ioport.iop_pcdir |= PC_BSE_LOOPBACK;
926 immap->im_ioport.iop_pcso &= ~PC_BSE_LOOPBACK;
927 immap->im_ioport.iop_pcdat &= ~PC_BSE_LOOPBACK;
928#endif
929
930#ifdef CONFIG_FADS
931 cp->cp_pbpar |= PB_ENET_TENA;
932 cp->cp_pbdir |= PB_ENET_TENA;
933
934 /* Enable the EEST PHY.
935 */
936 *((volatile uint *)BCSR1) &= ~BCSR1_ETHEN;
937#endif
938
939 dev->base_addr = (unsigned long)ep;
940#if 0
941 dev->name = "CPM_ENET";
942#endif
943
944 /* The CPM Ethernet specific entries in the device structure. */
945 dev->open = scc_enet_open;
946 dev->hard_start_xmit = scc_enet_start_xmit;
947 dev->tx_timeout = scc_enet_timeout;
948 dev->watchdog_timeo = TX_TIMEOUT;
949 dev->stop = scc_enet_close;
950 dev->get_stats = scc_enet_get_stats;
951 dev->set_multicast_list = set_multicast_list;
952
953 err = register_netdev(dev);
954 if (err) {
955 free_netdev(dev);
956 return err;
957 }
958
959 /* And last, enable the transmit and receive processing.
960 */
961 sccp->scc_gsmrl |= (SCC_GSMRL_ENR | SCC_GSMRL_ENT);
962
963 printk("%s: CPM ENET Version 0.2 on SCC%d, ", dev->name, SCC_ENET+1);
964 for (i=0; i<5; i++)
965 printk("%02x:", dev->dev_addr[i]);
966 printk("%02x\n", dev->dev_addr[5]);
967
968 return 0;
969}
970
971module_init(scc_enet_init);
diff --git a/arch/ppc/8xx_io/fec.c b/arch/ppc/8xx_io/fec.c
new file mode 100644
index 000000000000..0730392dcc20
--- /dev/null
+++ b/arch/ppc/8xx_io/fec.c
@@ -0,0 +1,1973 @@
1/*
2 * Fast Ethernet Controller (FEC) driver for Motorola MPC8xx.
3 * Copyright (c) 1997 Dan Malek (dmalek@jlc.net)
4 *
5 * This version of the driver is specific to the FADS implementation,
6 * since the board contains control registers external to the processor
7 * for the control of the LevelOne LXT970 transceiver. The MPC860T manual
8 * describes connections using the internal parallel port I/O, which
9 * is basically all of Port D.
10 *
11 * Includes support for the following PHYs: QS6612, LXT970, LXT971/2.
12 *
13 * Right now, I am very wasteful with the buffers. I allocate memory
14 * pages and then divide them into 2K frame buffers. This way I know I
15 * have buffers large enough to hold one frame within one buffer descriptor.
16 * Once I get this working, I will use 64 or 128 byte CPM buffers, which
17 * will be much more memory efficient and will easily handle lots of
18 * small packets.
19 *
20 * Much better multiple PHY support by Magnus Damm.
21 * Copyright (c) 2000 Ericsson Radio Systems AB.
22 *
23 * Make use of MII for PHY control configurable.
24 * Some fixes.
25 * Copyright (c) 2000-2002 Wolfgang Denk, DENX Software Engineering.
26 *
27 * Support for AMD AM79C874 added.
28 * Thomas Lange, thomas@corelatus.com
29 */
30
31#include <linux/config.h>
32#include <linux/kernel.h>
33#include <linux/sched.h>
34#include <linux/string.h>
35#include <linux/ptrace.h>
36#include <linux/errno.h>
37#include <linux/ioport.h>
38#include <linux/slab.h>
39#include <linux/interrupt.h>
40#include <linux/pci.h>
41#include <linux/init.h>
42#include <linux/delay.h>
43#include <linux/netdevice.h>
44#include <linux/etherdevice.h>
45#include <linux/skbuff.h>
46#include <linux/spinlock.h>
47#include <linux/bitops.h>
48#ifdef CONFIG_FEC_PACKETHOOK
49#include <linux/pkthook.h>
50#endif
51
52#include <asm/8xx_immap.h>
53#include <asm/pgtable.h>
54#include <asm/mpc8xx.h>
55#include <asm/irq.h>
56#include <asm/uaccess.h>
57#include <asm/commproc.h>
58
59#ifdef CONFIG_USE_MDIO
60/* Forward declarations of some structures to support different PHYs
61*/
62
63typedef struct {
64 uint mii_data;
65 void (*funct)(uint mii_reg, struct net_device *dev);
66} phy_cmd_t;
67
68typedef struct {
69 uint id;
70 char *name;
71
72 const phy_cmd_t *config;
73 const phy_cmd_t *startup;
74 const phy_cmd_t *ack_int;
75 const phy_cmd_t *shutdown;
76} phy_info_t;
77#endif /* CONFIG_USE_MDIO */
78
79/* The number of Tx and Rx buffers. These are allocated from the page
80 * pool. The code may assume these are power of two, so it is best
81 * to keep them that size.
82 * We don't need to allocate pages for the transmitter. We just use
83 * the skbuffer directly.
84 */
85#ifdef CONFIG_ENET_BIG_BUFFERS
86#define FEC_ENET_RX_PAGES 16
87#define FEC_ENET_RX_FRSIZE 2048
88#define FEC_ENET_RX_FRPPG (PAGE_SIZE / FEC_ENET_RX_FRSIZE)
89#define RX_RING_SIZE (FEC_ENET_RX_FRPPG * FEC_ENET_RX_PAGES)
90#define TX_RING_SIZE 16 /* Must be power of two */
91#define TX_RING_MOD_MASK 15 /* for this to work */
92#else
93#define FEC_ENET_RX_PAGES 4
94#define FEC_ENET_RX_FRSIZE 2048
95#define FEC_ENET_RX_FRPPG (PAGE_SIZE / FEC_ENET_RX_FRSIZE)
96#define RX_RING_SIZE (FEC_ENET_RX_FRPPG * FEC_ENET_RX_PAGES)
97#define TX_RING_SIZE 8 /* Must be power of two */
98#define TX_RING_MOD_MASK 7 /* for this to work */
99#endif
100
101/* Interrupt events/masks.
102*/
103#define FEC_ENET_HBERR ((uint)0x80000000) /* Heartbeat error */
104#define FEC_ENET_BABR ((uint)0x40000000) /* Babbling receiver */
105#define FEC_ENET_BABT ((uint)0x20000000) /* Babbling transmitter */
106#define FEC_ENET_GRA ((uint)0x10000000) /* Graceful stop complete */
107#define FEC_ENET_TXF ((uint)0x08000000) /* Full frame transmitted */
108#define FEC_ENET_TXB ((uint)0x04000000) /* A buffer was transmitted */
109#define FEC_ENET_RXF ((uint)0x02000000) /* Full frame received */
110#define FEC_ENET_RXB ((uint)0x01000000) /* A buffer was received */
111#define FEC_ENET_MII ((uint)0x00800000) /* MII interrupt */
112#define FEC_ENET_EBERR ((uint)0x00400000) /* SDMA bus error */
113
114/*
115*/
116#define FEC_ECNTRL_PINMUX 0x00000004
117#define FEC_ECNTRL_ETHER_EN 0x00000002
118#define FEC_ECNTRL_RESET 0x00000001
119
120#define FEC_RCNTRL_BC_REJ 0x00000010
121#define FEC_RCNTRL_PROM 0x00000008
122#define FEC_RCNTRL_MII_MODE 0x00000004
123#define FEC_RCNTRL_DRT 0x00000002
124#define FEC_RCNTRL_LOOP 0x00000001
125
126#define FEC_TCNTRL_FDEN 0x00000004
127#define FEC_TCNTRL_HBC 0x00000002
128#define FEC_TCNTRL_GTS 0x00000001
129
130/* Delay to wait for FEC reset command to complete (in us)
131*/
132#define FEC_RESET_DELAY 50
133
134/* The FEC stores dest/src/type, data, and checksum for receive packets.
135 */
136#define PKT_MAXBUF_SIZE 1518
137#define PKT_MINBUF_SIZE 64
138#define PKT_MAXBLR_SIZE 1520
139
140/* The FEC buffer descriptors track the ring buffers. The rx_bd_base and
141 * tx_bd_base always point to the base of the buffer descriptors. The
142 * cur_rx and cur_tx point to the currently available buffer.
143 * The dirty_tx tracks the current buffer that is being sent by the
144 * controller. The cur_tx and dirty_tx are equal under both completely
145 * empty and completely full conditions. The empty/ready indicator in
146 * the buffer descriptor determines the actual condition.
147 */
148struct fec_enet_private {
149 /* The saved address of a sent-in-place packet/buffer, for skfree(). */
150 struct sk_buff* tx_skbuff[TX_RING_SIZE];
151 ushort skb_cur;
152 ushort skb_dirty;
153
154 /* CPM dual port RAM relative addresses.
155 */
156 cbd_t *rx_bd_base; /* Address of Rx and Tx buffers. */
157 cbd_t *tx_bd_base;
158 cbd_t *cur_rx, *cur_tx; /* The next free ring entry */
159 cbd_t *dirty_tx; /* The ring entries to be free()ed. */
160
161 /* Virtual addresses for the receive buffers because we can't
162 * do a __va() on them anymore.
163 */
164 unsigned char *rx_vaddr[RX_RING_SIZE];
165
166 struct net_device_stats stats;
167 uint tx_full;
168 spinlock_t lock;
169
170#ifdef CONFIG_USE_MDIO
171 uint phy_id;
172 uint phy_id_done;
173 uint phy_status;
174 uint phy_speed;
175 phy_info_t *phy;
176 struct tq_struct phy_task;
177
178 uint sequence_done;
179
180 uint phy_addr;
181#endif /* CONFIG_USE_MDIO */
182
183 int link;
184 int old_link;
185 int full_duplex;
186
187#ifdef CONFIG_FEC_PACKETHOOK
188 unsigned long ph_lock;
189 fec_ph_func *ph_rxhandler;
190 fec_ph_func *ph_txhandler;
191 __u16 ph_proto;
192 volatile __u32 *ph_regaddr;
193 void *ph_priv;
194#endif
195};
196
197static int fec_enet_open(struct net_device *dev);
198static int fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev);
199#ifdef CONFIG_USE_MDIO
200static void fec_enet_mii(struct net_device *dev);
201#endif /* CONFIG_USE_MDIO */
202static void fec_enet_interrupt(int irq, void * dev_id, struct pt_regs * regs);
203#ifdef CONFIG_FEC_PACKETHOOK
204static void fec_enet_tx(struct net_device *dev, __u32 regval);
205static void fec_enet_rx(struct net_device *dev, __u32 regval);
206#else
207static void fec_enet_tx(struct net_device *dev);
208static void fec_enet_rx(struct net_device *dev);
209#endif
210static int fec_enet_close(struct net_device *dev);
211static struct net_device_stats *fec_enet_get_stats(struct net_device *dev);
212static void set_multicast_list(struct net_device *dev);
213static void fec_restart(struct net_device *dev, int duplex);
214static void fec_stop(struct net_device *dev);
215static ushort my_enet_addr[3];
216
217#ifdef CONFIG_USE_MDIO
218/* MII processing. We keep this as simple as possible. Requests are
219 * placed on the list (if there is room). When the request is finished
220 * by the MII, an optional function may be called.
221 */
222typedef struct mii_list {
223 uint mii_regval;
224 void (*mii_func)(uint val, struct net_device *dev);
225 struct mii_list *mii_next;
226} mii_list_t;
227
228#define NMII 20
229mii_list_t mii_cmds[NMII];
230mii_list_t *mii_free;
231mii_list_t *mii_head;
232mii_list_t *mii_tail;
233
234static int mii_queue(struct net_device *dev, int request,
235 void (*func)(uint, struct net_device *));
236
237/* Make MII read/write commands for the FEC.
238*/
239#define mk_mii_read(REG) (0x60020000 | ((REG & 0x1f) << 18))
240#define mk_mii_write(REG, VAL) (0x50020000 | ((REG & 0x1f) << 18) | \
241 (VAL & 0xffff))
242#define mk_mii_end 0
243#endif /* CONFIG_USE_MDIO */
244
245/* Transmitter timeout.
246*/
247#define TX_TIMEOUT (2*HZ)
248
249#ifdef CONFIG_USE_MDIO
250/* Register definitions for the PHY.
251*/
252
253#define MII_REG_CR 0 /* Control Register */
254#define MII_REG_SR 1 /* Status Register */
255#define MII_REG_PHYIR1 2 /* PHY Identification Register 1 */
256#define MII_REG_PHYIR2 3 /* PHY Identification Register 2 */
257#define MII_REG_ANAR 4 /* A-N Advertisement Register */
258#define MII_REG_ANLPAR 5 /* A-N Link Partner Ability Register */
259#define MII_REG_ANER 6 /* A-N Expansion Register */
260#define MII_REG_ANNPTR 7 /* A-N Next Page Transmit Register */
261#define MII_REG_ANLPRNPR 8 /* A-N Link Partner Received Next Page Reg. */
262
263/* values for phy_status */
264
265#define PHY_CONF_ANE 0x0001 /* 1 auto-negotiation enabled */
266#define PHY_CONF_LOOP 0x0002 /* 1 loopback mode enabled */
267#define PHY_CONF_SPMASK 0x00f0 /* mask for speed */
268#define PHY_CONF_10HDX 0x0010 /* 10 Mbit half duplex supported */
269#define PHY_CONF_10FDX 0x0020 /* 10 Mbit full duplex supported */
270#define PHY_CONF_100HDX 0x0040 /* 100 Mbit half duplex supported */
271#define PHY_CONF_100FDX 0x0080 /* 100 Mbit full duplex supported */
272
273#define PHY_STAT_LINK 0x0100 /* 1 up - 0 down */
274#define PHY_STAT_FAULT 0x0200 /* 1 remote fault */
275#define PHY_STAT_ANC 0x0400 /* 1 auto-negotiation complete */
276#define PHY_STAT_SPMASK 0xf000 /* mask for speed */
277#define PHY_STAT_10HDX 0x1000 /* 10 Mbit half duplex selected */
278#define PHY_STAT_10FDX 0x2000 /* 10 Mbit full duplex selected */
279#define PHY_STAT_100HDX 0x4000 /* 100 Mbit half duplex selected */
280#define PHY_STAT_100FDX 0x8000 /* 100 Mbit full duplex selected */
281#endif /* CONFIG_USE_MDIO */
282
283#ifdef CONFIG_FEC_PACKETHOOK
284int
285fec_register_ph(struct net_device *dev, fec_ph_func *rxfun, fec_ph_func *txfun,
286 __u16 proto, volatile __u32 *regaddr, void *priv)
287{
288 struct fec_enet_private *fep;
289 int retval = 0;
290
291 fep = dev->priv;
292
293 if (test_and_set_bit(0, (void*)&fep->ph_lock) != 0) {
294 /* Someone is messing with the packet hook */
295 return -EAGAIN;
296 }
297 if (fep->ph_rxhandler != NULL || fep->ph_txhandler != NULL) {
298 retval = -EBUSY;
299 goto out;
300 }
301 fep->ph_rxhandler = rxfun;
302 fep->ph_txhandler = txfun;
303 fep->ph_proto = proto;
304 fep->ph_regaddr = regaddr;
305 fep->ph_priv = priv;
306
307 out:
308 fep->ph_lock = 0;
309
310 return retval;
311}
312
313
314int
315fec_unregister_ph(struct net_device *dev)
316{
317 struct fec_enet_private *fep;
318 int retval = 0;
319
320 fep = dev->priv;
321
322 if (test_and_set_bit(0, (void*)&fep->ph_lock) != 0) {
323 /* Someone is messing with the packet hook */
324 return -EAGAIN;
325 }
326
327 fep->ph_rxhandler = fep->ph_txhandler = NULL;
328 fep->ph_proto = 0;
329 fep->ph_regaddr = NULL;
330 fep->ph_priv = NULL;
331
332 fep->ph_lock = 0;
333
334 return retval;
335}
336
337EXPORT_SYMBOL(fec_register_ph);
338EXPORT_SYMBOL(fec_unregister_ph);
339
340#endif /* CONFIG_FEC_PACKETHOOK */
341
342static int
343fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
344{
345 struct fec_enet_private *fep;
346 volatile fec_t *fecp;
347 volatile cbd_t *bdp;
348
349 fep = dev->priv;
350 fecp = (volatile fec_t*)dev->base_addr;
351
352 if (!fep->link) {
353 /* Link is down or autonegotiation is in progress. */
354 return 1;
355 }
356
357 /* Fill in a Tx ring entry */
358 bdp = fep->cur_tx;
359
360#ifndef final_version
361 if (bdp->cbd_sc & BD_ENET_TX_READY) {
362 /* Ooops. All transmit buffers are full. Bail out.
363 * This should not happen, since dev->tbusy should be set.
364 */
365 printk("%s: tx queue full!.\n", dev->name);
366 return 1;
367 }
368#endif
369
370 /* Clear all of the status flags.
371 */
372 bdp->cbd_sc &= ~BD_ENET_TX_STATS;
373
374 /* Set buffer length and buffer pointer.
375 */
376 bdp->cbd_bufaddr = __pa(skb->data);
377 bdp->cbd_datlen = skb->len;
378
379 /* Save skb pointer.
380 */
381 fep->tx_skbuff[fep->skb_cur] = skb;
382
383 fep->stats.tx_bytes += skb->len;
384 fep->skb_cur = (fep->skb_cur+1) & TX_RING_MOD_MASK;
385
386 /* Push the data cache so the CPM does not get stale memory
387 * data.
388 */
389 flush_dcache_range((unsigned long)skb->data,
390 (unsigned long)skb->data + skb->len);
391
392 /* disable interrupts while triggering transmit */
393 spin_lock_irq(&fep->lock);
394
395 /* Send it on its way. Tell FEC its ready, interrupt when done,
396 * its the last BD of the frame, and to put the CRC on the end.
397 */
398
399 bdp->cbd_sc |= (BD_ENET_TX_READY | BD_ENET_TX_INTR
400 | BD_ENET_TX_LAST | BD_ENET_TX_TC);
401
402 dev->trans_start = jiffies;
403
404 /* Trigger transmission start */
405 fecp->fec_x_des_active = 0x01000000;
406
407 /* If this was the last BD in the ring, start at the beginning again.
408 */
409 if (bdp->cbd_sc & BD_ENET_TX_WRAP) {
410 bdp = fep->tx_bd_base;
411 } else {
412 bdp++;
413 }
414
415 if (bdp->cbd_sc & BD_ENET_TX_READY) {
416 netif_stop_queue(dev);
417 fep->tx_full = 1;
418 }
419
420 fep->cur_tx = (cbd_t *)bdp;
421
422 spin_unlock_irq(&fep->lock);
423
424 return 0;
425}
426
427static void
428fec_timeout(struct net_device *dev)
429{
430 struct fec_enet_private *fep = dev->priv;
431
432 printk("%s: transmit timed out.\n", dev->name);
433 fep->stats.tx_errors++;
434#ifndef final_version
435 {
436 int i;
437 cbd_t *bdp;
438
439 printk("Ring data dump: cur_tx %lx%s, dirty_tx %lx cur_rx: %lx\n",
440 (unsigned long)fep->cur_tx, fep->tx_full ? " (full)" : "",
441 (unsigned long)fep->dirty_tx,
442 (unsigned long)fep->cur_rx);
443
444 bdp = fep->tx_bd_base;
445 printk(" tx: %u buffers\n", TX_RING_SIZE);
446 for (i = 0 ; i < TX_RING_SIZE; i++) {
447 printk(" %08x: %04x %04x %08x\n",
448 (uint) bdp,
449 bdp->cbd_sc,
450 bdp->cbd_datlen,
451 bdp->cbd_bufaddr);
452 bdp++;
453 }
454
455 bdp = fep->rx_bd_base;
456 printk(" rx: %lu buffers\n", RX_RING_SIZE);
457 for (i = 0 ; i < RX_RING_SIZE; i++) {
458 printk(" %08x: %04x %04x %08x\n",
459 (uint) bdp,
460 bdp->cbd_sc,
461 bdp->cbd_datlen,
462 bdp->cbd_bufaddr);
463 bdp++;
464 }
465 }
466#endif
467 if (!fep->tx_full)
468 netif_wake_queue(dev);
469}
470
471/* The interrupt handler.
472 * This is called from the MPC core interrupt.
473 */
474static void
475fec_enet_interrupt(int irq, void * dev_id, struct pt_regs * regs)
476{
477 struct net_device *dev = dev_id;
478 volatile fec_t *fecp;
479 uint int_events;
480#ifdef CONFIG_FEC_PACKETHOOK
481 struct fec_enet_private *fep = dev->priv;
482 __u32 regval;
483
484 if (fep->ph_regaddr) regval = *fep->ph_regaddr;
485#endif
486 fecp = (volatile fec_t*)dev->base_addr;
487
488 /* Get the interrupt events that caused us to be here.
489 */
490 while ((int_events = fecp->fec_ievent) != 0) {
491 fecp->fec_ievent = int_events;
492 if ((int_events & (FEC_ENET_HBERR | FEC_ENET_BABR |
493 FEC_ENET_BABT | FEC_ENET_EBERR)) != 0) {
494 printk("FEC ERROR %x\n", int_events);
495 }
496
497 /* Handle receive event in its own function.
498 */
499 if (int_events & FEC_ENET_RXF) {
500#ifdef CONFIG_FEC_PACKETHOOK
501 fec_enet_rx(dev, regval);
502#else
503 fec_enet_rx(dev);
504#endif
505 }
506
507 /* Transmit OK, or non-fatal error. Update the buffer
508 descriptors. FEC handles all errors, we just discover
509 them as part of the transmit process.
510 */
511 if (int_events & FEC_ENET_TXF) {
512#ifdef CONFIG_FEC_PACKETHOOK
513 fec_enet_tx(dev, regval);
514#else
515 fec_enet_tx(dev);
516#endif
517 }
518
519 if (int_events & FEC_ENET_MII) {
520#ifdef CONFIG_USE_MDIO
521 fec_enet_mii(dev);
522#else
523printk("%s[%d] %s: unexpected FEC_ENET_MII event\n", __FILE__,__LINE__,__FUNCTION__);
524#endif /* CONFIG_USE_MDIO */
525 }
526
527 }
528}
529
530
531static void
532#ifdef CONFIG_FEC_PACKETHOOK
533fec_enet_tx(struct net_device *dev, __u32 regval)
534#else
535fec_enet_tx(struct net_device *dev)
536#endif
537{
538 struct fec_enet_private *fep;
539 volatile cbd_t *bdp;
540 struct sk_buff *skb;
541
542 fep = dev->priv;
543 /* lock while transmitting */
544 spin_lock(&fep->lock);
545 bdp = fep->dirty_tx;
546
547 while ((bdp->cbd_sc&BD_ENET_TX_READY) == 0) {
548 if (bdp == fep->cur_tx && fep->tx_full == 0) break;
549
550 skb = fep->tx_skbuff[fep->skb_dirty];
551 /* Check for errors. */
552 if (bdp->cbd_sc & (BD_ENET_TX_HB | BD_ENET_TX_LC |
553 BD_ENET_TX_RL | BD_ENET_TX_UN |
554 BD_ENET_TX_CSL)) {
555 fep->stats.tx_errors++;
556 if (bdp->cbd_sc & BD_ENET_TX_HB) /* No heartbeat */
557 fep->stats.tx_heartbeat_errors++;
558 if (bdp->cbd_sc & BD_ENET_TX_LC) /* Late collision */
559 fep->stats.tx_window_errors++;
560 if (bdp->cbd_sc & BD_ENET_TX_RL) /* Retrans limit */
561 fep->stats.tx_aborted_errors++;
562 if (bdp->cbd_sc & BD_ENET_TX_UN) /* Underrun */
563 fep->stats.tx_fifo_errors++;
564 if (bdp->cbd_sc & BD_ENET_TX_CSL) /* Carrier lost */
565 fep->stats.tx_carrier_errors++;
566 } else {
567#ifdef CONFIG_FEC_PACKETHOOK
568 /* Packet hook ... */
569 if (fep->ph_txhandler &&
570 ((struct ethhdr *)skb->data)->h_proto
571 == fep->ph_proto) {
572 fep->ph_txhandler((__u8*)skb->data, skb->len,
573 regval, fep->ph_priv);
574 }
575#endif
576 fep->stats.tx_packets++;
577 }
578
579#ifndef final_version
580 if (bdp->cbd_sc & BD_ENET_TX_READY)
581 printk("HEY! Enet xmit interrupt and TX_READY.\n");
582#endif
583 /* Deferred means some collisions occurred during transmit,
584 * but we eventually sent the packet OK.
585 */
586 if (bdp->cbd_sc & BD_ENET_TX_DEF)
587 fep->stats.collisions++;
588
589 /* Free the sk buffer associated with this last transmit.
590 */
591#if 0
592printk("TXI: %x %x %x\n", bdp, skb, fep->skb_dirty);
593#endif
594 dev_kfree_skb_irq (skb/*, FREE_WRITE*/);
595 fep->tx_skbuff[fep->skb_dirty] = NULL;
596 fep->skb_dirty = (fep->skb_dirty + 1) & TX_RING_MOD_MASK;
597
598 /* Update pointer to next buffer descriptor to be transmitted.
599 */
600 if (bdp->cbd_sc & BD_ENET_TX_WRAP)
601 bdp = fep->tx_bd_base;
602 else
603 bdp++;
604
605 /* Since we have freed up a buffer, the ring is no longer
606 * full.
607 */
608 if (fep->tx_full) {
609 fep->tx_full = 0;
610 if (netif_queue_stopped(dev))
611 netif_wake_queue(dev);
612 }
613#ifdef CONFIG_FEC_PACKETHOOK
614 /* Re-read register. Not exactly guaranteed to be correct,
615 but... */
616 if (fep->ph_regaddr) regval = *fep->ph_regaddr;
617#endif
618 }
619 fep->dirty_tx = (cbd_t *)bdp;
620 spin_unlock(&fep->lock);
621}
622
623
624/* During a receive, the cur_rx points to the current incoming buffer.
625 * When we update through the ring, if the next incoming buffer has
626 * not been given to the system, we just set the empty indicator,
627 * effectively tossing the packet.
628 */
629static void
630#ifdef CONFIG_FEC_PACKETHOOK
631fec_enet_rx(struct net_device *dev, __u32 regval)
632#else
633fec_enet_rx(struct net_device *dev)
634#endif
635{
636 struct fec_enet_private *fep;
637 volatile fec_t *fecp;
638 volatile cbd_t *bdp;
639 struct sk_buff *skb;
640 ushort pkt_len;
641 __u8 *data;
642
643 fep = dev->priv;
644 fecp = (volatile fec_t*)dev->base_addr;
645
646 /* First, grab all of the stats for the incoming packet.
647 * These get messed up if we get called due to a busy condition.
648 */
649 bdp = fep->cur_rx;
650
651while (!(bdp->cbd_sc & BD_ENET_RX_EMPTY)) {
652
653#ifndef final_version
654 /* Since we have allocated space to hold a complete frame,
655 * the last indicator should be set.
656 */
657 if ((bdp->cbd_sc & BD_ENET_RX_LAST) == 0)
658 printk("FEC ENET: rcv is not +last\n");
659#endif
660
661 /* Check for errors. */
662 if (bdp->cbd_sc & (BD_ENET_RX_LG | BD_ENET_RX_SH | BD_ENET_RX_NO |
663 BD_ENET_RX_CR | BD_ENET_RX_OV)) {
664 fep->stats.rx_errors++;
665 if (bdp->cbd_sc & (BD_ENET_RX_LG | BD_ENET_RX_SH)) {
666 /* Frame too long or too short. */
667 fep->stats.rx_length_errors++;
668 }
669 if (bdp->cbd_sc & BD_ENET_RX_NO) /* Frame alignment */
670 fep->stats.rx_frame_errors++;
671 if (bdp->cbd_sc & BD_ENET_RX_CR) /* CRC Error */
672 fep->stats.rx_crc_errors++;
673 if (bdp->cbd_sc & BD_ENET_RX_OV) /* FIFO overrun */
674 fep->stats.rx_crc_errors++;
675 }
676
677 /* Report late collisions as a frame error.
678 * On this error, the BD is closed, but we don't know what we
679 * have in the buffer. So, just drop this frame on the floor.
680 */
681 if (bdp->cbd_sc & BD_ENET_RX_CL) {
682 fep->stats.rx_errors++;
683 fep->stats.rx_frame_errors++;
684 goto rx_processing_done;
685 }
686
687 /* Process the incoming frame.
688 */
689 fep->stats.rx_packets++;
690 pkt_len = bdp->cbd_datlen;
691 fep->stats.rx_bytes += pkt_len;
692 data = fep->rx_vaddr[bdp - fep->rx_bd_base];
693
694#ifdef CONFIG_FEC_PACKETHOOK
695 /* Packet hook ... */
696 if (fep->ph_rxhandler) {
697 if (((struct ethhdr *)data)->h_proto == fep->ph_proto) {
698 switch (fep->ph_rxhandler(data, pkt_len, regval,
699 fep->ph_priv)) {
700 case 1:
701 goto rx_processing_done;
702 break;
703 case 0:
704 break;
705 default:
706 fep->stats.rx_errors++;
707 goto rx_processing_done;
708 }
709 }
710 }
711
712 /* If it wasn't filtered - copy it to an sk buffer. */
713#endif
714
715 /* This does 16 byte alignment, exactly what we need.
716 * The packet length includes FCS, but we don't want to
717 * include that when passing upstream as it messes up
718 * bridging applications.
719 */
720 skb = dev_alloc_skb(pkt_len-4);
721
722 if (skb == NULL) {
723 printk("%s: Memory squeeze, dropping packet.\n", dev->name);
724 fep->stats.rx_dropped++;
725 } else {
726 skb->dev = dev;
727 skb_put(skb,pkt_len-4); /* Make room */
728 eth_copy_and_sum(skb, data, pkt_len-4, 0);
729 skb->protocol=eth_type_trans(skb,dev);
730 netif_rx(skb);
731 }
732 rx_processing_done:
733
734 /* Clear the status flags for this buffer.
735 */
736 bdp->cbd_sc &= ~BD_ENET_RX_STATS;
737
738 /* Mark the buffer empty.
739 */
740 bdp->cbd_sc |= BD_ENET_RX_EMPTY;
741
742 /* Update BD pointer to next entry.
743 */
744 if (bdp->cbd_sc & BD_ENET_RX_WRAP)
745 bdp = fep->rx_bd_base;
746 else
747 bdp++;
748
749#if 1
750 /* Doing this here will keep the FEC running while we process
751 * incoming frames. On a heavily loaded network, we should be
752 * able to keep up at the expense of system resources.
753 */
754 fecp->fec_r_des_active = 0x01000000;
755#endif
756#ifdef CONFIG_FEC_PACKETHOOK
757 /* Re-read register. Not exactly guaranteed to be correct,
758 but... */
759 if (fep->ph_regaddr) regval = *fep->ph_regaddr;
760#endif
761 } /* while (!(bdp->cbd_sc & BD_ENET_RX_EMPTY)) */
762 fep->cur_rx = (cbd_t *)bdp;
763
764#if 0
765 /* Doing this here will allow us to process all frames in the
766 * ring before the FEC is allowed to put more there. On a heavily
767 * loaded network, some frames may be lost. Unfortunately, this
768 * increases the interrupt overhead since we can potentially work
769 * our way back to the interrupt return only to come right back
770 * here.
771 */
772 fecp->fec_r_des_active = 0x01000000;
773#endif
774}
775
776
777#ifdef CONFIG_USE_MDIO
778static void
779fec_enet_mii(struct net_device *dev)
780{
781 struct fec_enet_private *fep;
782 volatile fec_t *ep;
783 mii_list_t *mip;
784 uint mii_reg;
785
786 fep = (struct fec_enet_private *)dev->priv;
787 ep = &(((immap_t *)IMAP_ADDR)->im_cpm.cp_fec);
788 mii_reg = ep->fec_mii_data;
789
790 if ((mip = mii_head) == NULL) {
791 printk("MII and no head!\n");
792 return;
793 }
794
795 if (mip->mii_func != NULL)
796 (*(mip->mii_func))(mii_reg, dev);
797
798 mii_head = mip->mii_next;
799 mip->mii_next = mii_free;
800 mii_free = mip;
801
802 if ((mip = mii_head) != NULL) {
803 ep->fec_mii_data = mip->mii_regval;
804
805 }
806}
807
808static int
809mii_queue(struct net_device *dev, int regval, void (*func)(uint, struct net_device *))
810{
811 struct fec_enet_private *fep;
812 unsigned long flags;
813 mii_list_t *mip;
814 int retval;
815
816 /* Add PHY address to register command.
817 */
818 fep = dev->priv;
819 regval |= fep->phy_addr << 23;
820
821 retval = 0;
822
823 /* lock while modifying mii_list */
824 spin_lock_irqsave(&fep->lock, flags);
825
826 if ((mip = mii_free) != NULL) {
827 mii_free = mip->mii_next;
828 mip->mii_regval = regval;
829 mip->mii_func = func;
830 mip->mii_next = NULL;
831 if (mii_head) {
832 mii_tail->mii_next = mip;
833 mii_tail = mip;
834 } else {
835 mii_head = mii_tail = mip;
836 (&(((immap_t *)IMAP_ADDR)->im_cpm.cp_fec))->fec_mii_data = regval;
837 }
838 } else {
839 retval = 1;
840 }
841
842 spin_unlock_irqrestore(&fep->lock, flags);
843
844 return(retval);
845}
846
847static void mii_do_cmd(struct net_device *dev, const phy_cmd_t *c)
848{
849 int k;
850
851 if(!c)
852 return;
853
854 for(k = 0; (c+k)->mii_data != mk_mii_end; k++)
855 mii_queue(dev, (c+k)->mii_data, (c+k)->funct);
856}
857
858static void mii_parse_sr(uint mii_reg, struct net_device *dev)
859{
860 struct fec_enet_private *fep = dev->priv;
861 volatile uint *s = &(fep->phy_status);
862
863 *s &= ~(PHY_STAT_LINK | PHY_STAT_FAULT | PHY_STAT_ANC);
864
865 if (mii_reg & 0x0004)
866 *s |= PHY_STAT_LINK;
867 if (mii_reg & 0x0010)
868 *s |= PHY_STAT_FAULT;
869 if (mii_reg & 0x0020)
870 *s |= PHY_STAT_ANC;
871
872 fep->link = (*s & PHY_STAT_LINK) ? 1 : 0;
873}
874
875static void mii_parse_cr(uint mii_reg, struct net_device *dev)
876{
877 struct fec_enet_private *fep = dev->priv;
878 volatile uint *s = &(fep->phy_status);
879
880 *s &= ~(PHY_CONF_ANE | PHY_CONF_LOOP);
881
882 if (mii_reg & 0x1000)
883 *s |= PHY_CONF_ANE;
884 if (mii_reg & 0x4000)
885 *s |= PHY_CONF_LOOP;
886}
887
888static void mii_parse_anar(uint mii_reg, struct net_device *dev)
889{
890 struct fec_enet_private *fep = dev->priv;
891 volatile uint *s = &(fep->phy_status);
892
893 *s &= ~(PHY_CONF_SPMASK);
894
895 if (mii_reg & 0x0020)
896 *s |= PHY_CONF_10HDX;
897 if (mii_reg & 0x0040)
898 *s |= PHY_CONF_10FDX;
899 if (mii_reg & 0x0080)
900 *s |= PHY_CONF_100HDX;
901 if (mii_reg & 0x00100)
902 *s |= PHY_CONF_100FDX;
903}
904#if 0
905static void mii_disp_reg(uint mii_reg, struct net_device *dev)
906{
907 printk("reg %u = 0x%04x\n", (mii_reg >> 18) & 0x1f, mii_reg & 0xffff);
908}
909#endif
910
911/* ------------------------------------------------------------------------- */
912/* The Level one LXT970 is used by many boards */
913
914#ifdef CONFIG_FEC_LXT970
915
916#define MII_LXT970_MIRROR 16 /* Mirror register */
917#define MII_LXT970_IER 17 /* Interrupt Enable Register */
918#define MII_LXT970_ISR 18 /* Interrupt Status Register */
919#define MII_LXT970_CONFIG 19 /* Configuration Register */
920#define MII_LXT970_CSR 20 /* Chip Status Register */
921
922static void mii_parse_lxt970_csr(uint mii_reg, struct net_device *dev)
923{
924 struct fec_enet_private *fep = dev->priv;
925 volatile uint *s = &(fep->phy_status);
926
927 *s &= ~(PHY_STAT_SPMASK);
928
929 if (mii_reg & 0x0800) {
930 if (mii_reg & 0x1000)
931 *s |= PHY_STAT_100FDX;
932 else
933 *s |= PHY_STAT_100HDX;
934 }
935 else {
936 if (mii_reg & 0x1000)
937 *s |= PHY_STAT_10FDX;
938 else
939 *s |= PHY_STAT_10HDX;
940 }
941}
942
943static phy_info_t phy_info_lxt970 = {
944 0x07810000,
945 "LXT970",
946
947 (const phy_cmd_t []) { /* config */
948#if 0
949// { mk_mii_write(MII_REG_ANAR, 0x0021), NULL },
950
951 /* Set default operation of 100-TX....for some reason
952 * some of these bits are set on power up, which is wrong.
953 */
954 { mk_mii_write(MII_LXT970_CONFIG, 0), NULL },
955#endif
956 { mk_mii_read(MII_REG_CR), mii_parse_cr },
957 { mk_mii_read(MII_REG_ANAR), mii_parse_anar },
958 { mk_mii_end, }
959 },
960 (const phy_cmd_t []) { /* startup - enable interrupts */
961 { mk_mii_write(MII_LXT970_IER, 0x0002), NULL },
962 { mk_mii_write(MII_REG_CR, 0x1200), NULL }, /* autonegotiate */
963 { mk_mii_end, }
964 },
965 (const phy_cmd_t []) { /* ack_int */
966 /* read SR and ISR to acknowledge */
967
968 { mk_mii_read(MII_REG_SR), mii_parse_sr },
969 { mk_mii_read(MII_LXT970_ISR), NULL },
970
971 /* find out the current status */
972
973 { mk_mii_read(MII_LXT970_CSR), mii_parse_lxt970_csr },
974 { mk_mii_end, }
975 },
976 (const phy_cmd_t []) { /* shutdown - disable interrupts */
977 { mk_mii_write(MII_LXT970_IER, 0x0000), NULL },
978 { mk_mii_end, }
979 },
980};
981
982#endif /* CONFIG_FEC_LXT970 */
983
984/* ------------------------------------------------------------------------- */
985/* The Level one LXT971 is used on some of my custom boards */
986
987#ifdef CONFIG_FEC_LXT971
988
989/* register definitions for the 971 */
990
991#define MII_LXT971_PCR 16 /* Port Control Register */
992#define MII_LXT971_SR2 17 /* Status Register 2 */
993#define MII_LXT971_IER 18 /* Interrupt Enable Register */
994#define MII_LXT971_ISR 19 /* Interrupt Status Register */
995#define MII_LXT971_LCR 20 /* LED Control Register */
996#define MII_LXT971_TCR 30 /* Transmit Control Register */
997
998/*
999 * I had some nice ideas of running the MDIO faster...
1000 * The 971 should support 8MHz and I tried it, but things acted really
1001 * weird, so 2.5 MHz ought to be enough for anyone...
1002 */
1003
1004static void mii_parse_lxt971_sr2(uint mii_reg, struct net_device *dev)
1005{
1006 struct fec_enet_private *fep = dev->priv;
1007 volatile uint *s = &(fep->phy_status);
1008
1009 *s &= ~(PHY_STAT_SPMASK);
1010
1011 if (mii_reg & 0x4000) {
1012 if (mii_reg & 0x0200)
1013 *s |= PHY_STAT_100FDX;
1014 else
1015 *s |= PHY_STAT_100HDX;
1016 }
1017 else {
1018 if (mii_reg & 0x0200)
1019 *s |= PHY_STAT_10FDX;
1020 else
1021 *s |= PHY_STAT_10HDX;
1022 }
1023 if (mii_reg & 0x0008)
1024 *s |= PHY_STAT_FAULT;
1025}
1026
1027static phy_info_t phy_info_lxt971 = {
1028 0x0001378e,
1029 "LXT971",
1030
1031 (const phy_cmd_t []) { /* config */
1032// { mk_mii_write(MII_REG_ANAR, 0x021), NULL }, /* 10 Mbps, HD */
1033 { mk_mii_read(MII_REG_CR), mii_parse_cr },
1034 { mk_mii_read(MII_REG_ANAR), mii_parse_anar },
1035 { mk_mii_end, }
1036 },
1037 (const phy_cmd_t []) { /* startup - enable interrupts */
1038 { mk_mii_write(MII_LXT971_IER, 0x00f2), NULL },
1039 { mk_mii_write(MII_REG_CR, 0x1200), NULL }, /* autonegotiate */
1040
1041 /* Somehow does the 971 tell me that the link is down
1042 * the first read after power-up.
1043 * read here to get a valid value in ack_int */
1044
1045 { mk_mii_read(MII_REG_SR), mii_parse_sr },
1046 { mk_mii_end, }
1047 },
1048 (const phy_cmd_t []) { /* ack_int */
1049 /* find out the current status */
1050
1051 { mk_mii_read(MII_REG_SR), mii_parse_sr },
1052 { mk_mii_read(MII_LXT971_SR2), mii_parse_lxt971_sr2 },
1053
1054 /* we only need to read ISR to acknowledge */
1055
1056 { mk_mii_read(MII_LXT971_ISR), NULL },
1057 { mk_mii_end, }
1058 },
1059 (const phy_cmd_t []) { /* shutdown - disable interrupts */
1060 { mk_mii_write(MII_LXT971_IER, 0x0000), NULL },
1061 { mk_mii_end, }
1062 },
1063};
1064
1065#endif /* CONFIG_FEC_LXT970 */
1066
1067
1068/* ------------------------------------------------------------------------- */
1069/* The Quality Semiconductor QS6612 is used on the RPX CLLF */
1070
1071#ifdef CONFIG_FEC_QS6612
1072
1073/* register definitions */
1074
1075#define MII_QS6612_MCR 17 /* Mode Control Register */
1076#define MII_QS6612_FTR 27 /* Factory Test Register */
1077#define MII_QS6612_MCO 28 /* Misc. Control Register */
1078#define MII_QS6612_ISR 29 /* Interrupt Source Register */
1079#define MII_QS6612_IMR 30 /* Interrupt Mask Register */
1080#define MII_QS6612_PCR 31 /* 100BaseTx PHY Control Reg. */
1081
1082static void mii_parse_qs6612_pcr(uint mii_reg, struct net_device *dev)
1083{
1084 struct fec_enet_private *fep = dev->priv;
1085 volatile uint *s = &(fep->phy_status);
1086
1087 *s &= ~(PHY_STAT_SPMASK);
1088
1089 switch((mii_reg >> 2) & 7) {
1090 case 1: *s |= PHY_STAT_10HDX; break;
1091 case 2: *s |= PHY_STAT_100HDX; break;
1092 case 5: *s |= PHY_STAT_10FDX; break;
1093 case 6: *s |= PHY_STAT_100FDX; break;
1094 }
1095}
1096
1097static phy_info_t phy_info_qs6612 = {
1098 0x00181440,
1099 "QS6612",
1100
1101 (const phy_cmd_t []) { /* config */
1102// { mk_mii_write(MII_REG_ANAR, 0x061), NULL }, /* 10 Mbps */
1103
1104 /* The PHY powers up isolated on the RPX,
1105 * so send a command to allow operation.
1106 */
1107
1108 { mk_mii_write(MII_QS6612_PCR, 0x0dc0), NULL },
1109
1110 /* parse cr and anar to get some info */
1111
1112 { mk_mii_read(MII_REG_CR), mii_parse_cr },
1113 { mk_mii_read(MII_REG_ANAR), mii_parse_anar },
1114 { mk_mii_end, }
1115 },
1116 (const phy_cmd_t []) { /* startup - enable interrupts */
1117 { mk_mii_write(MII_QS6612_IMR, 0x003a), NULL },
1118 { mk_mii_write(MII_REG_CR, 0x1200), NULL }, /* autonegotiate */
1119 { mk_mii_end, }
1120 },
1121 (const phy_cmd_t []) { /* ack_int */
1122
1123 /* we need to read ISR, SR and ANER to acknowledge */
1124
1125 { mk_mii_read(MII_QS6612_ISR), NULL },
1126 { mk_mii_read(MII_REG_SR), mii_parse_sr },
1127 { mk_mii_read(MII_REG_ANER), NULL },
1128
1129 /* read pcr to get info */
1130
1131 { mk_mii_read(MII_QS6612_PCR), mii_parse_qs6612_pcr },
1132 { mk_mii_end, }
1133 },
1134 (const phy_cmd_t []) { /* shutdown - disable interrupts */
1135 { mk_mii_write(MII_QS6612_IMR, 0x0000), NULL },
1136 { mk_mii_end, }
1137 },
1138};
1139
1140#endif /* CONFIG_FEC_QS6612 */
1141
1142/* ------------------------------------------------------------------------- */
1143/* The Advanced Micro Devices AM79C874 is used on the ICU862 */
1144
1145#ifdef CONFIG_FEC_AM79C874
1146
1147/* register definitions for the 79C874 */
1148
1149#define MII_AM79C874_MFR 16 /* Miscellaneous Features Register */
1150#define MII_AM79C874_ICSR 17 /* Interrupt Control/Status Register */
1151#define MII_AM79C874_DR 18 /* Diagnostic Register */
1152#define MII_AM79C874_PMLR 19 /* Power Management & Loopback Register */
1153#define MII_AM79C874_MCR 21 /* Mode Control Register */
1154#define MII_AM79C874_DC 23 /* Disconnect Counter */
1155#define MII_AM79C874_REC 24 /* Receiver Error Counter */
1156
1157static void mii_parse_amd79c874_dr(uint mii_reg, struct net_device *dev, uint data)
1158{
1159 volatile struct fec_enet_private *fep = dev->priv;
1160 uint s = fep->phy_status;
1161
1162 s &= ~(PHY_STAT_SPMASK);
1163
1164 /* Register 18: Bit 10 is data rate, 11 is Duplex */
1165 switch ((mii_reg >> 10) & 3) {
1166 case 0: s |= PHY_STAT_10HDX; break;
1167 case 1: s |= PHY_STAT_100HDX; break;
1168 case 2: s |= PHY_STAT_10FDX; break;
1169 case 3: s |= PHY_STAT_100FDX; break;
1170 }
1171
1172 fep->phy_status = s;
1173}
1174
1175static phy_info_t phy_info_amd79c874 = {
1176 0x00022561,
1177 "AM79C874",
1178
1179 (const phy_cmd_t []) { /* config */
1180// { mk_mii_write(MII_REG_ANAR, 0x021), NULL }, /* 10 Mbps, HD */
1181 { mk_mii_read(MII_REG_CR), mii_parse_cr },
1182 { mk_mii_read(MII_REG_ANAR), mii_parse_anar },
1183 { mk_mii_end, }
1184 },
1185 (const phy_cmd_t []) { /* startup - enable interrupts */
1186 { mk_mii_write(MII_AM79C874_ICSR, 0xff00), NULL },
1187 { mk_mii_write(MII_REG_CR, 0x1200), NULL }, /* autonegotiate */
1188 { mk_mii_end, }
1189 },
1190 (const phy_cmd_t []) { /* ack_int */
1191 /* find out the current status */
1192
1193 { mk_mii_read(MII_REG_SR), mii_parse_sr },
1194 { mk_mii_read(MII_AM79C874_DR), mii_parse_amd79c874_dr },
1195
1196 /* we only need to read ICSR to acknowledge */
1197
1198 { mk_mii_read(MII_AM79C874_ICSR), NULL },
1199 { mk_mii_end, }
1200 },
1201 (const phy_cmd_t []) { /* shutdown - disable interrupts */
1202 { mk_mii_write(MII_AM79C874_ICSR, 0x0000), NULL },
1203 { mk_mii_end, }
1204 },
1205};
1206
1207#endif /* CONFIG_FEC_AM79C874 */
1208
1209static phy_info_t *phy_info[] = {
1210
1211#ifdef CONFIG_FEC_LXT970
1212 &phy_info_lxt970,
1213#endif /* CONFIG_FEC_LXT970 */
1214
1215#ifdef CONFIG_FEC_LXT971
1216 &phy_info_lxt971,
1217#endif /* CONFIG_FEC_LXT971 */
1218
1219#ifdef CONFIG_FEC_QS6612
1220 &phy_info_qs6612,
1221#endif /* CONFIG_FEC_QS6612 */
1222
1223#ifdef CONFIG_FEC_AM79C874
1224 &phy_info_amd79c874,
1225#endif /* CONFIG_FEC_AM79C874 */
1226
1227 NULL
1228};
1229
1230static void mii_display_status(struct net_device *dev)
1231{
1232 struct fec_enet_private *fep = dev->priv;
1233 volatile uint *s = &(fep->phy_status);
1234
1235 if (!fep->link && !fep->old_link) {
1236 /* Link is still down - don't print anything */
1237 return;
1238 }
1239
1240 printk("%s: status: ", dev->name);
1241
1242 if (!fep->link) {
1243 printk("link down");
1244 } else {
1245 printk("link up");
1246
1247 switch(*s & PHY_STAT_SPMASK) {
1248 case PHY_STAT_100FDX: printk(", 100 Mbps Full Duplex"); break;
1249 case PHY_STAT_100HDX: printk(", 100 Mbps Half Duplex"); break;
1250 case PHY_STAT_10FDX: printk(", 10 Mbps Full Duplex"); break;
1251 case PHY_STAT_10HDX: printk(", 10 Mbps Half Duplex"); break;
1252 default:
1253 printk(", Unknown speed/duplex");
1254 }
1255
1256 if (*s & PHY_STAT_ANC)
1257 printk(", auto-negotiation complete");
1258 }
1259
1260 if (*s & PHY_STAT_FAULT)
1261 printk(", remote fault");
1262
1263 printk(".\n");
1264}
1265
1266static void mii_display_config(struct net_device *dev)
1267{
1268 struct fec_enet_private *fep = dev->priv;
1269 volatile uint *s = &(fep->phy_status);
1270
1271 printk("%s: config: auto-negotiation ", dev->name);
1272
1273 if (*s & PHY_CONF_ANE)
1274 printk("on");
1275 else
1276 printk("off");
1277
1278 if (*s & PHY_CONF_100FDX)
1279 printk(", 100FDX");
1280 if (*s & PHY_CONF_100HDX)
1281 printk(", 100HDX");
1282 if (*s & PHY_CONF_10FDX)
1283 printk(", 10FDX");
1284 if (*s & PHY_CONF_10HDX)
1285 printk(", 10HDX");
1286 if (!(*s & PHY_CONF_SPMASK))
1287 printk(", No speed/duplex selected?");
1288
1289 if (*s & PHY_CONF_LOOP)
1290 printk(", loopback enabled");
1291
1292 printk(".\n");
1293
1294 fep->sequence_done = 1;
1295}
1296
1297static void mii_relink(struct net_device *dev)
1298{
1299 struct fec_enet_private *fep = dev->priv;
1300 int duplex;
1301
1302 fep->link = (fep->phy_status & PHY_STAT_LINK) ? 1 : 0;
1303 mii_display_status(dev);
1304 fep->old_link = fep->link;
1305
1306 if (fep->link) {
1307 duplex = 0;
1308 if (fep->phy_status
1309 & (PHY_STAT_100FDX | PHY_STAT_10FDX))
1310 duplex = 1;
1311 fec_restart(dev, duplex);
1312 }
1313 else
1314 fec_stop(dev);
1315
1316#if 0
1317 enable_irq(fep->mii_irq);
1318#endif
1319
1320}
1321
1322static void mii_queue_relink(uint mii_reg, struct net_device *dev)
1323{
1324 struct fec_enet_private *fep = dev->priv;
1325
1326 fep->phy_task.routine = (void *)mii_relink;
1327 fep->phy_task.data = dev;
1328 schedule_task(&fep->phy_task);
1329}
1330
1331static void mii_queue_config(uint mii_reg, struct net_device *dev)
1332{
1333 struct fec_enet_private *fep = dev->priv;
1334
1335 fep->phy_task.routine = (void *)mii_display_config;
1336 fep->phy_task.data = dev;
1337 schedule_task(&fep->phy_task);
1338}
1339
1340
1341
1342phy_cmd_t phy_cmd_relink[] = { { mk_mii_read(MII_REG_CR), mii_queue_relink },
1343 { mk_mii_end, } };
1344phy_cmd_t phy_cmd_config[] = { { mk_mii_read(MII_REG_CR), mii_queue_config },
1345 { mk_mii_end, } };
1346
1347
1348
1349/* Read remainder of PHY ID.
1350*/
1351static void
1352mii_discover_phy3(uint mii_reg, struct net_device *dev)
1353{
1354 struct fec_enet_private *fep;
1355 int i;
1356
1357 fep = dev->priv;
1358 fep->phy_id |= (mii_reg & 0xffff);
1359
1360 for(i = 0; phy_info[i]; i++)
1361 if(phy_info[i]->id == (fep->phy_id >> 4))
1362 break;
1363
1364 if(!phy_info[i])
1365 panic("%s: PHY id 0x%08x is not supported!\n",
1366 dev->name, fep->phy_id);
1367
1368 fep->phy = phy_info[i];
1369 fep->phy_id_done = 1;
1370
1371 printk("%s: Phy @ 0x%x, type %s (0x%08x)\n",
1372 dev->name, fep->phy_addr, fep->phy->name, fep->phy_id);
1373}
1374
1375/* Scan all of the MII PHY addresses looking for someone to respond
1376 * with a valid ID. This usually happens quickly.
1377 */
1378static void
1379mii_discover_phy(uint mii_reg, struct net_device *dev)
1380{
1381 struct fec_enet_private *fep;
1382 uint phytype;
1383
1384 fep = dev->priv;
1385
1386 if ((phytype = (mii_reg & 0xffff)) != 0xffff) {
1387
1388 /* Got first part of ID, now get remainder.
1389 */
1390 fep->phy_id = phytype << 16;
1391 mii_queue(dev, mk_mii_read(MII_REG_PHYIR2), mii_discover_phy3);
1392 } else {
1393 fep->phy_addr++;
1394 if (fep->phy_addr < 32) {
1395 mii_queue(dev, mk_mii_read(MII_REG_PHYIR1),
1396 mii_discover_phy);
1397 } else {
1398 printk("fec: No PHY device found.\n");
1399 }
1400 }
1401}
1402#endif /* CONFIG_USE_MDIO */
1403
1404/* This interrupt occurs when the PHY detects a link change.
1405*/
1406static void
1407#ifdef CONFIG_RPXCLASSIC
1408mii_link_interrupt(void *dev_id)
1409#else
1410mii_link_interrupt(int irq, void * dev_id, struct pt_regs * regs)
1411#endif
1412{
1413#ifdef CONFIG_USE_MDIO
1414 struct net_device *dev = dev_id;
1415 struct fec_enet_private *fep = dev->priv;
1416 volatile immap_t *immap = (immap_t *)IMAP_ADDR;
1417 volatile fec_t *fecp = &(immap->im_cpm.cp_fec);
1418 unsigned int ecntrl = fecp->fec_ecntrl;
1419
1420 /* We need the FEC enabled to access the MII
1421 */
1422 if ((ecntrl & FEC_ECNTRL_ETHER_EN) == 0) {
1423 fecp->fec_ecntrl |= FEC_ECNTRL_ETHER_EN;
1424 }
1425#endif /* CONFIG_USE_MDIO */
1426
1427#if 0
1428 disable_irq(fep->mii_irq); /* disable now, enable later */
1429#endif
1430
1431
1432#ifdef CONFIG_USE_MDIO
1433 mii_do_cmd(dev, fep->phy->ack_int);
1434 mii_do_cmd(dev, phy_cmd_relink); /* restart and display status */
1435
1436 if ((ecntrl & FEC_ECNTRL_ETHER_EN) == 0) {
1437 fecp->fec_ecntrl = ecntrl; /* restore old settings */
1438 }
1439#else
1440printk("%s[%d] %s: unexpected Link interrupt\n", __FILE__,__LINE__,__FUNCTION__);
1441#endif /* CONFIG_USE_MDIO */
1442
1443}
1444
1445static int
1446fec_enet_open(struct net_device *dev)
1447{
1448 struct fec_enet_private *fep = dev->priv;
1449
1450 /* I should reset the ring buffers here, but I don't yet know
1451 * a simple way to do that.
1452 */
1453
1454#ifdef CONFIG_USE_MDIO
1455 fep->sequence_done = 0;
1456 fep->link = 0;
1457
1458 if (fep->phy) {
1459 mii_do_cmd(dev, fep->phy->ack_int);
1460 mii_do_cmd(dev, fep->phy->config);
1461 mii_do_cmd(dev, phy_cmd_config); /* display configuration */
1462 while(!fep->sequence_done)
1463 schedule();
1464
1465 mii_do_cmd(dev, fep->phy->startup);
1466 netif_start_queue(dev);
1467 return 0; /* Success */
1468 }
1469 return -ENODEV; /* No PHY we understand */
1470#else
1471 fep->link = 1;
1472 netif_start_queue(dev);
1473 return 0; /* Success */
1474#endif /* CONFIG_USE_MDIO */
1475
1476}
1477
1478static int
1479fec_enet_close(struct net_device *dev)
1480{
1481 /* Don't know what to do yet.
1482 */
1483 netif_stop_queue(dev);
1484 fec_stop(dev);
1485
1486 return 0;
1487}
1488
1489static struct net_device_stats *fec_enet_get_stats(struct net_device *dev)
1490{
1491 struct fec_enet_private *fep = (struct fec_enet_private *)dev->priv;
1492
1493 return &fep->stats;
1494}
1495
1496/* Set or clear the multicast filter for this adaptor.
1497 * Skeleton taken from sunlance driver.
1498 * The CPM Ethernet implementation allows Multicast as well as individual
1499 * MAC address filtering. Some of the drivers check to make sure it is
1500 * a group multicast address, and discard those that are not. I guess I
1501 * will do the same for now, but just remove the test if you want
1502 * individual filtering as well (do the upper net layers want or support
1503 * this kind of feature?).
1504 */
1505
1506static void set_multicast_list(struct net_device *dev)
1507{
1508 struct fec_enet_private *fep;
1509 volatile fec_t *ep;
1510
1511 fep = (struct fec_enet_private *)dev->priv;
1512 ep = &(((immap_t *)IMAP_ADDR)->im_cpm.cp_fec);
1513
1514 if (dev->flags&IFF_PROMISC) {
1515
1516 /* Log any net taps. */
1517 printk("%s: Promiscuous mode enabled.\n", dev->name);
1518 ep->fec_r_cntrl |= FEC_RCNTRL_PROM;
1519 } else {
1520
1521 ep->fec_r_cntrl &= ~FEC_RCNTRL_PROM;
1522
1523 if (dev->flags & IFF_ALLMULTI) {
1524 /* Catch all multicast addresses, so set the
1525 * filter to all 1's.
1526 */
1527 ep->fec_hash_table_high = 0xffffffff;
1528 ep->fec_hash_table_low = 0xffffffff;
1529 }
1530#if 0
1531 else {
1532 /* Clear filter and add the addresses in the list.
1533 */
1534 ep->sen_gaddr1 = 0;
1535 ep->sen_gaddr2 = 0;
1536 ep->sen_gaddr3 = 0;
1537 ep->sen_gaddr4 = 0;
1538
1539 dmi = dev->mc_list;
1540
1541 for (i=0; i<dev->mc_count; i++) {
1542
1543 /* Only support group multicast for now.
1544 */
1545 if (!(dmi->dmi_addr[0] & 1))
1546 continue;
1547
1548 /* The address in dmi_addr is LSB first,
1549 * and taddr is MSB first. We have to
1550 * copy bytes MSB first from dmi_addr.
1551 */
1552 mcptr = (u_char *)dmi->dmi_addr + 5;
1553 tdptr = (u_char *)&ep->sen_taddrh;
1554 for (j=0; j<6; j++)
1555 *tdptr++ = *mcptr--;
1556
1557 /* Ask CPM to run CRC and set bit in
1558 * filter mask.
1559 */
1560 cpmp->cp_cpcr = mk_cr_cmd(CPM_CR_CH_SCC1, CPM_CR_SET_GADDR) | CPM_CR_FLG;
1561 /* this delay is necessary here -- Cort */
1562 udelay(10);
1563 while (cpmp->cp_cpcr & CPM_CR_FLG);
1564 }
1565 }
1566#endif
1567 }
1568}
1569
1570/* Initialize the FEC Ethernet on 860T.
1571 */
1572static int __init fec_enet_init(void)
1573{
1574 struct net_device *dev;
1575 struct fec_enet_private *fep;
1576 int i, j, k, err;
1577 unsigned char *eap, *iap, *ba;
1578 unsigned long mem_addr;
1579 volatile cbd_t *bdp;
1580 cbd_t *cbd_base;
1581 volatile immap_t *immap;
1582 volatile fec_t *fecp;
1583 bd_t *bd;
1584#ifdef CONFIG_SCC_ENET
1585 unsigned char tmpaddr[6];
1586#endif
1587
1588 immap = (immap_t *)IMAP_ADDR; /* pointer to internal registers */
1589
1590 bd = (bd_t *)__res;
1591
1592 dev = alloc_etherdev(sizeof(*fep));
1593 if (!dev)
1594 return -ENOMEM;
1595
1596 fep = dev->priv;
1597
1598 fecp = &(immap->im_cpm.cp_fec);
1599
1600 /* Whack a reset. We should wait for this.
1601 */
1602 fecp->fec_ecntrl = FEC_ECNTRL_PINMUX | FEC_ECNTRL_RESET;
1603 for (i = 0;
1604 (fecp->fec_ecntrl & FEC_ECNTRL_RESET) && (i < FEC_RESET_DELAY);
1605 ++i) {
1606 udelay(1);
1607 }
1608 if (i == FEC_RESET_DELAY) {
1609 printk ("FEC Reset timeout!\n");
1610 }
1611
1612 /* Set the Ethernet address. If using multiple Enets on the 8xx,
1613 * this needs some work to get unique addresses.
1614 */
1615 eap = (unsigned char *)my_enet_addr;
1616 iap = bd->bi_enetaddr;
1617
1618#ifdef CONFIG_SCC_ENET
1619 /*
1620 * If a board has Ethernet configured both on a SCC and the
1621 * FEC, it needs (at least) 2 MAC addresses (we know that Sun
1622 * disagrees, but anyway). For the FEC port, we create
1623 * another address by setting one of the address bits above
1624 * something that would have (up to now) been allocated.
1625 */
1626 for (i=0; i<6; i++)
1627 tmpaddr[i] = *iap++;
1628 tmpaddr[3] |= 0x80;
1629 iap = tmpaddr;
1630#endif
1631
1632 for (i=0; i<6; i++) {
1633 dev->dev_addr[i] = *eap++ = *iap++;
1634 }
1635
1636 /* Allocate memory for buffer descriptors.
1637 */
1638 if (((RX_RING_SIZE + TX_RING_SIZE) * sizeof(cbd_t)) > PAGE_SIZE) {
1639 printk("FEC init error. Need more space.\n");
1640 printk("FEC initialization failed.\n");
1641 return 1;
1642 }
1643 cbd_base = (cbd_t *)consistent_alloc(GFP_KERNEL, PAGE_SIZE, &mem_addr);
1644
1645 /* Set receive and transmit descriptor base.
1646 */
1647 fep->rx_bd_base = cbd_base;
1648 fep->tx_bd_base = cbd_base + RX_RING_SIZE;
1649
1650 fep->skb_cur = fep->skb_dirty = 0;
1651
1652 /* Initialize the receive buffer descriptors.
1653 */
1654 bdp = fep->rx_bd_base;
1655 k = 0;
1656 for (i=0; i<FEC_ENET_RX_PAGES; i++) {
1657
1658 /* Allocate a page.
1659 */
1660 ba = (unsigned char *)consistent_alloc(GFP_KERNEL, PAGE_SIZE, &mem_addr);
1661 /* BUG: no check for failure */
1662
1663 /* Initialize the BD for every fragment in the page.
1664 */
1665 for (j=0; j<FEC_ENET_RX_FRPPG; j++) {
1666 bdp->cbd_sc = BD_ENET_RX_EMPTY;
1667 bdp->cbd_bufaddr = mem_addr;
1668 fep->rx_vaddr[k++] = ba;
1669 mem_addr += FEC_ENET_RX_FRSIZE;
1670 ba += FEC_ENET_RX_FRSIZE;
1671 bdp++;
1672 }
1673 }
1674
1675 /* Set the last buffer to wrap.
1676 */
1677 bdp--;
1678 bdp->cbd_sc |= BD_SC_WRAP;
1679
1680#ifdef CONFIG_FEC_PACKETHOOK
1681 fep->ph_lock = 0;
1682 fep->ph_rxhandler = fep->ph_txhandler = NULL;
1683 fep->ph_proto = 0;
1684 fep->ph_regaddr = NULL;
1685 fep->ph_priv = NULL;
1686#endif
1687
1688 /* Install our interrupt handler.
1689 */
1690 if (request_irq(FEC_INTERRUPT, fec_enet_interrupt, 0, "fec", dev) != 0)
1691 panic("Could not allocate FEC IRQ!");
1692
1693#ifdef CONFIG_RPXCLASSIC
1694 /* Make Port C, bit 15 an input that causes interrupts.
1695 */
1696 immap->im_ioport.iop_pcpar &= ~0x0001;
1697 immap->im_ioport.iop_pcdir &= ~0x0001;
1698 immap->im_ioport.iop_pcso &= ~0x0001;
1699 immap->im_ioport.iop_pcint |= 0x0001;
1700 cpm_install_handler(CPMVEC_PIO_PC15, mii_link_interrupt, dev);
1701
1702 /* Make LEDS reflect Link status.
1703 */
1704 *((uint *) RPX_CSR_ADDR) &= ~BCSR2_FETHLEDMODE;
1705#endif
1706
1707#ifdef PHY_INTERRUPT
1708 ((immap_t *)IMAP_ADDR)->im_siu_conf.sc_siel |=
1709 (0x80000000 >> PHY_INTERRUPT);
1710
1711 if (request_irq(PHY_INTERRUPT, mii_link_interrupt, 0, "mii", dev) != 0)
1712 panic("Could not allocate MII IRQ!");
1713#endif
1714
1715 dev->base_addr = (unsigned long)fecp;
1716
1717 /* The FEC Ethernet specific entries in the device structure. */
1718 dev->open = fec_enet_open;
1719 dev->hard_start_xmit = fec_enet_start_xmit;
1720 dev->tx_timeout = fec_timeout;
1721 dev->watchdog_timeo = TX_TIMEOUT;
1722 dev->stop = fec_enet_close;
1723 dev->get_stats = fec_enet_get_stats;
1724 dev->set_multicast_list = set_multicast_list;
1725
1726#ifdef CONFIG_USE_MDIO
1727 for (i=0; i<NMII-1; i++)
1728 mii_cmds[i].mii_next = &mii_cmds[i+1];
1729 mii_free = mii_cmds;
1730#endif /* CONFIG_USE_MDIO */
1731
1732 /* Configure all of port D for MII.
1733 */
1734 immap->im_ioport.iop_pdpar = 0x1fff;
1735
1736 /* Bits moved from Rev. D onward.
1737 */
1738 if ((mfspr(SPRN_IMMR) & 0xffff) < 0x0501)
1739 immap->im_ioport.iop_pddir = 0x1c58; /* Pre rev. D */
1740 else
1741 immap->im_ioport.iop_pddir = 0x1fff; /* Rev. D and later */
1742
1743#ifdef CONFIG_USE_MDIO
1744 /* Set MII speed to 2.5 MHz
1745 */
1746 fecp->fec_mii_speed = fep->phy_speed =
1747 (( (bd->bi_intfreq + 500000) / 2500000 / 2 ) & 0x3F ) << 1;
1748#else
1749 fecp->fec_mii_speed = 0; /* turn off MDIO */
1750#endif /* CONFIG_USE_MDIO */
1751
1752 err = register_netdev(dev);
1753 if (err) {
1754 free_netdev(dev);
1755 return err;
1756 }
1757
1758 printk ("%s: FEC ENET Version 0.2, FEC irq %d"
1759#ifdef PHY_INTERRUPT
1760 ", MII irq %d"
1761#endif
1762 ", addr ",
1763 dev->name, FEC_INTERRUPT
1764#ifdef PHY_INTERRUPT
1765 , PHY_INTERRUPT
1766#endif
1767 );
1768 for (i=0; i<6; i++)
1769 printk("%02x%c", dev->dev_addr[i], (i==5) ? '\n' : ':');
1770
1771#ifdef CONFIG_USE_MDIO /* start in full duplex mode, and negotiate speed */
1772 fec_restart (dev, 1);
1773#else /* always use half duplex mode only */
1774 fec_restart (dev, 0);
1775#endif
1776
1777#ifdef CONFIG_USE_MDIO
1778 /* Queue up command to detect the PHY and initialize the
1779 * remainder of the interface.
1780 */
1781 fep->phy_id_done = 0;
1782 fep->phy_addr = 0;
1783 mii_queue(dev, mk_mii_read(MII_REG_PHYIR1), mii_discover_phy);
1784#endif /* CONFIG_USE_MDIO */
1785
1786 return 0;
1787}
1788module_init(fec_enet_init);
1789
1790/* This function is called to start or restart the FEC during a link
1791 * change. This only happens when switching between half and full
1792 * duplex.
1793 */
1794static void
1795fec_restart(struct net_device *dev, int duplex)
1796{
1797 struct fec_enet_private *fep;
1798 int i;
1799 volatile cbd_t *bdp;
1800 volatile immap_t *immap;
1801 volatile fec_t *fecp;
1802
1803 immap = (immap_t *)IMAP_ADDR; /* pointer to internal registers */
1804
1805 fecp = &(immap->im_cpm.cp_fec);
1806
1807 fep = dev->priv;
1808
1809 /* Whack a reset. We should wait for this.
1810 */
1811 fecp->fec_ecntrl = FEC_ECNTRL_PINMUX | FEC_ECNTRL_RESET;
1812 for (i = 0;
1813 (fecp->fec_ecntrl & FEC_ECNTRL_RESET) && (i < FEC_RESET_DELAY);
1814 ++i) {
1815 udelay(1);
1816 }
1817 if (i == FEC_RESET_DELAY) {
1818 printk ("FEC Reset timeout!\n");
1819 }
1820
1821 /* Set station address.
1822 */
1823 fecp->fec_addr_low = (my_enet_addr[0] << 16) | my_enet_addr[1];
1824 fecp->fec_addr_high = my_enet_addr[2];
1825
1826 /* Reset all multicast.
1827 */
1828 fecp->fec_hash_table_high = 0;
1829 fecp->fec_hash_table_low = 0;
1830
1831 /* Set maximum receive buffer size.
1832 */
1833 fecp->fec_r_buff_size = PKT_MAXBLR_SIZE;
1834 fecp->fec_r_hash = PKT_MAXBUF_SIZE;
1835
1836 /* Set receive and transmit descriptor base.
1837 */
1838 fecp->fec_r_des_start = iopa((uint)(fep->rx_bd_base));
1839 fecp->fec_x_des_start = iopa((uint)(fep->tx_bd_base));
1840
1841 fep->dirty_tx = fep->cur_tx = fep->tx_bd_base;
1842 fep->cur_rx = fep->rx_bd_base;
1843
1844 /* Reset SKB transmit buffers.
1845 */
1846 fep->skb_cur = fep->skb_dirty = 0;
1847 for (i=0; i<=TX_RING_MOD_MASK; i++) {
1848 if (fep->tx_skbuff[i] != NULL) {
1849 dev_kfree_skb(fep->tx_skbuff[i]);
1850 fep->tx_skbuff[i] = NULL;
1851 }
1852 }
1853
1854 /* Initialize the receive buffer descriptors.
1855 */
1856 bdp = fep->rx_bd_base;
1857 for (i=0; i<RX_RING_SIZE; i++) {
1858
1859 /* Initialize the BD for every fragment in the page.
1860 */
1861 bdp->cbd_sc = BD_ENET_RX_EMPTY;
1862 bdp++;
1863 }
1864
1865 /* Set the last buffer to wrap.
1866 */
1867 bdp--;
1868 bdp->cbd_sc |= BD_SC_WRAP;
1869
1870 /* ...and the same for transmmit.
1871 */
1872 bdp = fep->tx_bd_base;
1873 for (i=0; i<TX_RING_SIZE; i++) {
1874
1875 /* Initialize the BD for every fragment in the page.
1876 */
1877 bdp->cbd_sc = 0;
1878 bdp->cbd_bufaddr = 0;
1879 bdp++;
1880 }
1881
1882 /* Set the last buffer to wrap.
1883 */
1884 bdp--;
1885 bdp->cbd_sc |= BD_SC_WRAP;
1886
1887 /* Enable MII mode.
1888 */
1889 if (duplex) {
1890 fecp->fec_r_cntrl = FEC_RCNTRL_MII_MODE; /* MII enable */
1891 fecp->fec_x_cntrl = FEC_TCNTRL_FDEN; /* FD enable */
1892 }
1893 else {
1894 fecp->fec_r_cntrl = FEC_RCNTRL_MII_MODE | FEC_RCNTRL_DRT;
1895 fecp->fec_x_cntrl = 0;
1896 }
1897 fep->full_duplex = duplex;
1898
1899 /* Enable big endian and don't care about SDMA FC.
1900 */
1901 fecp->fec_fun_code = 0x78000000;
1902
1903#ifdef CONFIG_USE_MDIO
1904 /* Set MII speed.
1905 */
1906 fecp->fec_mii_speed = fep->phy_speed;
1907#endif /* CONFIG_USE_MDIO */
1908
1909 /* Clear any outstanding interrupt.
1910 */
1911 fecp->fec_ievent = 0xffc0;
1912
1913 fecp->fec_ivec = (FEC_INTERRUPT/2) << 29;
1914
1915 /* Enable interrupts we wish to service.
1916 */
1917 fecp->fec_imask = ( FEC_ENET_TXF | FEC_ENET_TXB |
1918 FEC_ENET_RXF | FEC_ENET_RXB | FEC_ENET_MII );
1919
1920 /* And last, enable the transmit and receive processing.
1921 */
1922 fecp->fec_ecntrl = FEC_ECNTRL_PINMUX | FEC_ECNTRL_ETHER_EN;
1923 fecp->fec_r_des_active = 0x01000000;
1924}
1925
1926static void
1927fec_stop(struct net_device *dev)
1928{
1929 volatile immap_t *immap;
1930 volatile fec_t *fecp;
1931 struct fec_enet_private *fep;
1932 int i;
1933
1934 immap = (immap_t *)IMAP_ADDR; /* pointer to internal registers */
1935
1936 fecp = &(immap->im_cpm.cp_fec);
1937
1938 if ((fecp->fec_ecntrl & FEC_ECNTRL_ETHER_EN) == 0)
1939 return; /* already down */
1940
1941 fep = dev->priv;
1942
1943
1944 fecp->fec_x_cntrl = 0x01; /* Graceful transmit stop */
1945
1946 for (i = 0;
1947 ((fecp->fec_ievent & 0x10000000) == 0) && (i < FEC_RESET_DELAY);
1948 ++i) {
1949 udelay(1);
1950 }
1951 if (i == FEC_RESET_DELAY) {
1952 printk ("FEC timeout on graceful transmit stop\n");
1953 }
1954
1955 /* Clear outstanding MII command interrupts.
1956 */
1957 fecp->fec_ievent = FEC_ENET_MII;
1958
1959 /* Enable MII command finished interrupt
1960 */
1961 fecp->fec_ivec = (FEC_INTERRUPT/2) << 29;
1962 fecp->fec_imask = FEC_ENET_MII;
1963
1964#ifdef CONFIG_USE_MDIO
1965 /* Set MII speed.
1966 */
1967 fecp->fec_mii_speed = fep->phy_speed;
1968#endif /* CONFIG_USE_MDIO */
1969
1970 /* Disable FEC
1971 */
1972 fecp->fec_ecntrl &= ~(FEC_ECNTRL_ETHER_EN);
1973}
diff --git a/arch/ppc/8xx_io/micropatch.c b/arch/ppc/8xx_io/micropatch.c
new file mode 100644
index 000000000000..312af0776c31
--- /dev/null
+++ b/arch/ppc/8xx_io/micropatch.c
@@ -0,0 +1,744 @@
1
2/* Microcode patches for the CPM as supplied by Motorola.
3 * This is the one for IIC/SPI. There is a newer one that
4 * also relocates SMC2, but this would require additional changes
5 * to uart.c, so I am holding off on that for a moment.
6 */
7#include <linux/config.h>
8#include <linux/errno.h>
9#include <linux/sched.h>
10#include <linux/kernel.h>
11#include <linux/param.h>
12#include <linux/string.h>
13#include <linux/mm.h>
14#include <linux/interrupt.h>
15#include <asm/irq.h>
16#include <asm/mpc8xx.h>
17#include <asm/page.h>
18#include <asm/pgtable.h>
19#include <asm/8xx_immap.h>
20#include <asm/commproc.h>
21
22/*
23 * I2C/SPI relocation patch arrays.
24 */
25
26#ifdef CONFIG_I2C_SPI_UCODE_PATCH
27
28uint patch_2000[] = {
29 0x7FFFEFD9,
30 0x3FFD0000,
31 0x7FFB49F7,
32 0x7FF90000,
33 0x5FEFADF7,
34 0x5F89ADF7,
35 0x5FEFAFF7,
36 0x5F89AFF7,
37 0x3A9CFBC8,
38 0xE7C0EDF0,
39 0x77C1E1BB,
40 0xF4DC7F1D,
41 0xABAD932F,
42 0x4E08FDCF,
43 0x6E0FAFF8,
44 0x7CCF76CF,
45 0xFD1FF9CF,
46 0xABF88DC6,
47 0xAB5679F7,
48 0xB0937383,
49 0xDFCE79F7,
50 0xB091E6BB,
51 0xE5BBE74F,
52 0xB3FA6F0F,
53 0x6FFB76CE,
54 0xEE0DF9CF,
55 0x2BFBEFEF,
56 0xCFEEF9CF,
57 0x76CEAD24,
58 0x90B2DF9A,
59 0x7FDDD0BF,
60 0x4BF847FD,
61 0x7CCF76CE,
62 0xCFEF7E1F,
63 0x7F1D7DFD,
64 0xF0B6EF71,
65 0x7FC177C1,
66 0xFBC86079,
67 0xE722FBC8,
68 0x5FFFDFFF,
69 0x5FB2FFFB,
70 0xFBC8F3C8,
71 0x94A67F01,
72 0x7F1D5F39,
73 0xAFE85F5E,
74 0xFFDFDF96,
75 0xCB9FAF7D,
76 0x5FC1AFED,
77 0x8C1C5FC1,
78 0xAFDD5FC3,
79 0xDF9A7EFD,
80 0xB0B25FB2,
81 0xFFFEABAD,
82 0x5FB2FFFE,
83 0x5FCE600B,
84 0xE6BB600B,
85 0x5FCEDFC6,
86 0x27FBEFDF,
87 0x5FC8CFDE,
88 0x3A9CE7C0,
89 0xEDF0F3C8,
90 0x7F0154CD,
91 0x7F1D2D3D,
92 0x363A7570,
93 0x7E0AF1CE,
94 0x37EF2E68,
95 0x7FEE10EC,
96 0xADF8EFDE,
97 0xCFEAE52F,
98 0x7D0FE12B,
99 0xF1CE5F65,
100 0x7E0A4DF8,
101 0xCFEA5F72,
102 0x7D0BEFEE,
103 0xCFEA5F74,
104 0xE522EFDE,
105 0x5F74CFDA,
106 0x0B627385,
107 0xDF627E0A,
108 0x30D8145B,
109 0xBFFFF3C8,
110 0x5FFFDFFF,
111 0xA7F85F5E,
112 0xBFFE7F7D,
113 0x10D31450,
114 0x5F36BFFF,
115 0xAF785F5E,
116 0xBFFDA7F8,
117 0x5F36BFFE,
118 0x77FD30C0,
119 0x4E08FDCF,
120 0xE5FF6E0F,
121 0xAFF87E1F,
122 0x7E0FFD1F,
123 0xF1CF5F1B,
124 0xABF80D5E,
125 0x5F5EFFEF,
126 0x79F730A2,
127 0xAFDD5F34,
128 0x47F85F34,
129 0xAFED7FDD,
130 0x50B24978,
131 0x47FD7F1D,
132 0x7DFD70AD,
133 0xEF717EC1,
134 0x6BA47F01,
135 0x2D267EFD,
136 0x30DE5F5E,
137 0xFFFD5F5E,
138 0xFFEF5F5E,
139 0xFFDF0CA0,
140 0xAFED0A9E,
141 0xAFDD0C3A,
142 0x5F3AAFBD,
143 0x7FBDB082,
144 0x5F8247F8
145};
146
147uint patch_2f00[] = {
148 0x3E303430,
149 0x34343737,
150 0xABF7BF9B,
151 0x994B4FBD,
152 0xBD599493,
153 0x349FFF37,
154 0xFB9B177D,
155 0xD9936956,
156 0xBBFDD697,
157 0xBDD2FD11,
158 0x31DB9BB3,
159 0x63139637,
160 0x93733693,
161 0x193137F7,
162 0x331737AF,
163 0x7BB9B999,
164 0xBB197957,
165 0x7FDFD3D5,
166 0x73B773F7,
167 0x37933B99,
168 0x1D115316,
169 0x99315315,
170 0x31694BF4,
171 0xFBDBD359,
172 0x31497353,
173 0x76956D69,
174 0x7B9D9693,
175 0x13131979,
176 0x79376935
177};
178#endif
179
180/*
181 * I2C/SPI/SMC1 relocation patch arrays.
182 */
183
184#ifdef CONFIG_I2C_SPI_SMC1_UCODE_PATCH
185
186uint patch_2000[] = {
187 0x3fff0000,
188 0x3ffd0000,
189 0x3ffb0000,
190 0x3ff90000,
191 0x5f13eff8,
192 0x5eb5eff8,
193 0x5f88adf7,
194 0x5fefadf7,
195 0x3a9cfbc8,
196 0x77cae1bb,
197 0xf4de7fad,
198 0xabae9330,
199 0x4e08fdcf,
200 0x6e0faff8,
201 0x7ccf76cf,
202 0xfdaff9cf,
203 0xabf88dc8,
204 0xab5879f7,
205 0xb0925d8d,
206 0xdfd079f7,
207 0xb090e6bb,
208 0xe5bbe74f,
209 0x9e046f0f,
210 0x6ffb76ce,
211 0xee0cf9cf,
212 0x2bfbefef,
213 0xcfeef9cf,
214 0x76cead23,
215 0x90b3df99,
216 0x7fddd0c1,
217 0x4bf847fd,
218 0x7ccf76ce,
219 0xcfef77ca,
220 0x7eaf7fad,
221 0x7dfdf0b7,
222 0xef7a7fca,
223 0x77cafbc8,
224 0x6079e722,
225 0xfbc85fff,
226 0xdfff5fb3,
227 0xfffbfbc8,
228 0xf3c894a5,
229 0xe7c9edf9,
230 0x7f9a7fad,
231 0x5f36afe8,
232 0x5f5bffdf,
233 0xdf95cb9e,
234 0xaf7d5fc3,
235 0xafed8c1b,
236 0x5fc3afdd,
237 0x5fc5df99,
238 0x7efdb0b3,
239 0x5fb3fffe,
240 0xabae5fb3,
241 0xfffe5fd0,
242 0x600be6bb,
243 0x600b5fd0,
244 0xdfc827fb,
245 0xefdf5fca,
246 0xcfde3a9c,
247 0xe7c9edf9,
248 0xf3c87f9e,
249 0x54ca7fed,
250 0x2d3a3637,
251 0x756f7e9a,
252 0xf1ce37ef,
253 0x2e677fee,
254 0x10ebadf8,
255 0xefdecfea,
256 0xe52f7d9f,
257 0xe12bf1ce,
258 0x5f647e9a,
259 0x4df8cfea,
260 0x5f717d9b,
261 0xefeecfea,
262 0x5f73e522,
263 0xefde5f73,
264 0xcfda0b61,
265 0x5d8fdf61,
266 0xe7c9edf9,
267 0x7e9a30d5,
268 0x1458bfff,
269 0xf3c85fff,
270 0xdfffa7f8,
271 0x5f5bbffe,
272 0x7f7d10d0,
273 0x144d5f33,
274 0xbfffaf78,
275 0x5f5bbffd,
276 0xa7f85f33,
277 0xbffe77fd,
278 0x30bd4e08,
279 0xfdcfe5ff,
280 0x6e0faff8,
281 0x7eef7e9f,
282 0xfdeff1cf,
283 0x5f17abf8,
284 0x0d5b5f5b,
285 0xffef79f7,
286 0x309eafdd,
287 0x5f3147f8,
288 0x5f31afed,
289 0x7fdd50af,
290 0x497847fd,
291 0x7f9e7fed,
292 0x7dfd70a9,
293 0xef7e7ece,
294 0x6ba07f9e,
295 0x2d227efd,
296 0x30db5f5b,
297 0xfffd5f5b,
298 0xffef5f5b,
299 0xffdf0c9c,
300 0xafed0a9a,
301 0xafdd0c37,
302 0x5f37afbd,
303 0x7fbdb081,
304 0x5f8147f8,
305 0x3a11e710,
306 0xedf0ccdd,
307 0xf3186d0a,
308 0x7f0e5f06,
309 0x7fedbb38,
310 0x3afe7468,
311 0x7fedf4fc,
312 0x8ffbb951,
313 0xb85f77fd,
314 0xb0df5ddd,
315 0xdefe7fed,
316 0x90e1e74d,
317 0x6f0dcbf7,
318 0xe7decfed,
319 0xcb74cfed,
320 0xcfeddf6d,
321 0x91714f74,
322 0x5dd2deef,
323 0x9e04e7df,
324 0xefbb6ffb,
325 0xe7ef7f0e,
326 0x9e097fed,
327 0xebdbeffa,
328 0xeb54affb,
329 0x7fea90d7,
330 0x7e0cf0c3,
331 0xbffff318,
332 0x5fffdfff,
333 0xac59efea,
334 0x7fce1ee5,
335 0xe2ff5ee1,
336 0xaffbe2ff,
337 0x5ee3affb,
338 0xf9cc7d0f,
339 0xaef8770f,
340 0x7d0fb0c6,
341 0xeffbbfff,
342 0xcfef5ede,
343 0x7d0fbfff,
344 0x5ede4cf8,
345 0x7fddd0bf,
346 0x49f847fd,
347 0x7efdf0bb,
348 0x7fedfffd,
349 0x7dfdf0b7,
350 0xef7e7e1e,
351 0x5ede7f0e,
352 0x3a11e710,
353 0xedf0ccab,
354 0xfb18ad2e,
355 0x1ea9bbb8,
356 0x74283b7e,
357 0x73c2e4bb,
358 0x2ada4fb8,
359 0xdc21e4bb,
360 0xb2a1ffbf,
361 0x5e2c43f8,
362 0xfc87e1bb,
363 0xe74ffd91,
364 0x6f0f4fe8,
365 0xc7ba32e2,
366 0xf396efeb,
367 0x600b4f78,
368 0xe5bb760b,
369 0x53acaef8,
370 0x4ef88b0e,
371 0xcfef9e09,
372 0xabf8751f,
373 0xefef5bac,
374 0x741f4fe8,
375 0x751e760d,
376 0x7fdbf081,
377 0x741cafce,
378 0xefcc7fce,
379 0x751e70ac,
380 0x741ce7bb,
381 0x3372cfed,
382 0xafdbefeb,
383 0xe5bb760b,
384 0x53f2aef8,
385 0xafe8e7eb,
386 0x4bf8771e,
387 0x7e247fed,
388 0x4fcbe2cc,
389 0x7fbc30a9,
390 0x7b0f7a0f,
391 0x34d577fd,
392 0x308b5db7,
393 0xde553e5f,
394 0xaf78741f,
395 0x741f30f0,
396 0xcfef5e2c,
397 0x741f3eac,
398 0xafb8771e,
399 0x5e677fed,
400 0x0bd3e2cc,
401 0x741ccfec,
402 0xe5ca53cd,
403 0x6fcb4f74,
404 0x5dadde4b,
405 0x2ab63d38,
406 0x4bb3de30,
407 0x751f741c,
408 0x6c42effa,
409 0xefea7fce,
410 0x6ffc30be,
411 0xefec3fca,
412 0x30b3de2e,
413 0xadf85d9e,
414 0xaf7daefd,
415 0x5d9ede2e,
416 0x5d9eafdd,
417 0x761f10ac,
418 0x1da07efd,
419 0x30adfffe,
420 0x4908fb18,
421 0x5fffdfff,
422 0xafbb709b,
423 0x4ef85e67,
424 0xadf814ad,
425 0x7a0f70ad,
426 0xcfef50ad,
427 0x7a0fde30,
428 0x5da0afed,
429 0x3c12780f,
430 0xefef780f,
431 0xefef790f,
432 0xa7f85e0f,
433 0xffef790f,
434 0xefef790f,
435 0x14adde2e,
436 0x5d9eadfd,
437 0x5e2dfffb,
438 0xe79addfd,
439 0xeff96079,
440 0x607ae79a,
441 0xddfceff9,
442 0x60795dff,
443 0x607acfef,
444 0xefefefdf,
445 0xefbfef7f,
446 0xeeffedff,
447 0xebffe7ff,
448 0xafefafdf,
449 0xafbfaf7f,
450 0xaeffadff,
451 0xabffa7ff,
452 0x6fef6fdf,
453 0x6fbf6f7f,
454 0x6eff6dff,
455 0x6bff67ff,
456 0x2fef2fdf,
457 0x2fbf2f7f,
458 0x2eff2dff,
459 0x2bff27ff,
460 0x4e08fd1f,
461 0xe5ff6e0f,
462 0xaff87eef,
463 0x7e0ffdef,
464 0xf11f6079,
465 0xabf8f542,
466 0x7e0af11c,
467 0x37cfae3a,
468 0x7fec90be,
469 0xadf8efdc,
470 0xcfeae52f,
471 0x7d0fe12b,
472 0xf11c6079,
473 0x7e0a4df8,
474 0xcfea5dc4,
475 0x7d0befec,
476 0xcfea5dc6,
477 0xe522efdc,
478 0x5dc6cfda,
479 0x4e08fd1f,
480 0x6e0faff8,
481 0x7c1f761f,
482 0xfdeff91f,
483 0x6079abf8,
484 0x761cee24,
485 0xf91f2bfb,
486 0xefefcfec,
487 0xf91f6079,
488 0x761c27fb,
489 0xefdf5da7,
490 0xcfdc7fdd,
491 0xd09c4bf8,
492 0x47fd7c1f,
493 0x761ccfcf,
494 0x7eef7fed,
495 0x7dfdf093,
496 0xef7e7f1e,
497 0x771efb18,
498 0x6079e722,
499 0xe6bbe5bb,
500 0xae0ae5bb,
501 0x600bae85,
502 0xe2bbe2bb,
503 0xe2bbe2bb,
504 0xaf02e2bb,
505 0xe2bb2ff9,
506 0x6079e2bb
507};
508
509uint patch_2f00[] = {
510 0x30303030,
511 0x3e3e3434,
512 0xabbf9b99,
513 0x4b4fbdbd,
514 0x59949334,
515 0x9fff37fb,
516 0x9b177dd9,
517 0x936956bb,
518 0xfbdd697b,
519 0xdd2fd113,
520 0x1db9f7bb,
521 0x36313963,
522 0x79373369,
523 0x3193137f,
524 0x7331737a,
525 0xf7bb9b99,
526 0x9bb19795,
527 0x77fdfd3d,
528 0x573b773f,
529 0x737933f7,
530 0xb991d115,
531 0x31699315,
532 0x31531694,
533 0xbf4fbdbd,
534 0x35931497,
535 0x35376956,
536 0xbd697b9d,
537 0x96931313,
538 0x19797937,
539 0x6935af78,
540 0xb9b3baa3,
541 0xb8788683,
542 0x368f78f7,
543 0x87778733,
544 0x3ffffb3b,
545 0x8e8f78b8,
546 0x1d118e13,
547 0xf3ff3f8b,
548 0x6bd8e173,
549 0xd1366856,
550 0x68d1687b,
551 0x3daf78b8,
552 0x3a3a3f87,
553 0x8f81378f,
554 0xf876f887,
555 0x77fd8778,
556 0x737de8d6,
557 0xbbf8bfff,
558 0xd8df87f7,
559 0xfd876f7b,
560 0x8bfff8bd,
561 0x8683387d,
562 0xb873d87b,
563 0x3b8fd7f8,
564 0xf7338883,
565 0xbb8ee1f8,
566 0xef837377,
567 0x3337b836,
568 0x817d11f8,
569 0x7378b878,
570 0xd3368b7d,
571 0xed731b7d,
572 0x833731f3,
573 0xf22f3f23
574};
575
576uint patch_2e00[] = {
577 0x27eeeeee,
578 0xeeeeeeee,
579 0xeeeeeeee,
580 0xeeeeeeee,
581 0xee4bf4fb,
582 0xdbd259bb,
583 0x1979577f,
584 0xdfd2d573,
585 0xb773f737,
586 0x4b4fbdbd,
587 0x25b9b177,
588 0xd2d17376,
589 0x956bbfdd,
590 0x697bdd2f,
591 0xff9f79ff,
592 0xff9ff22f
593};
594#endif
595
596/*
597 * USB SOF patch arrays.
598 */
599
600#ifdef CONFIG_USB_SOF_UCODE_PATCH
601
602uint patch_2000[] = {
603 0x7fff0000,
604 0x7ffd0000,
605 0x7ffb0000,
606 0x49f7ba5b,
607 0xba383ffb,
608 0xf9b8b46d,
609 0xe5ab4e07,
610 0xaf77bffe,
611 0x3f7bbf79,
612 0xba5bba38,
613 0xe7676076,
614 0x60750000
615};
616
617uint patch_2f00[] = {
618 0x3030304c,
619 0xcab9e441,
620 0xa1aaf220
621};
622#endif
623
624void
625cpm_load_patch(volatile immap_t *immr)
626{
627 volatile uint *dp; /* Dual-ported RAM. */
628 volatile cpm8xx_t *commproc;
629 volatile iic_t *iip;
630 volatile spi_t *spp;
631 volatile smc_uart_t *smp;
632 int i;
633
634 commproc = (cpm8xx_t *)&immr->im_cpm;
635
636#ifdef CONFIG_USB_SOF_UCODE_PATCH
637 commproc->cp_rccr = 0;
638
639 dp = (uint *)(commproc->cp_dpmem);
640 for (i=0; i<(sizeof(patch_2000)/4); i++)
641 *dp++ = patch_2000[i];
642
643 dp = (uint *)&(commproc->cp_dpmem[0x0f00]);
644 for (i=0; i<(sizeof(patch_2f00)/4); i++)
645 *dp++ = patch_2f00[i];
646
647 commproc->cp_rccr = 0x0009;
648
649 printk("USB SOF microcode patch installed\n");
650#endif /* CONFIG_USB_SOF_UCODE_PATCH */
651
652#if defined(CONFIG_I2C_SPI_UCODE_PATCH) || \
653 defined(CONFIG_I2C_SPI_SMC1_UCODE_PATCH)
654
655 commproc->cp_rccr = 0;
656
657 dp = (uint *)(commproc->cp_dpmem);
658 for (i=0; i<(sizeof(patch_2000)/4); i++)
659 *dp++ = patch_2000[i];
660
661 dp = (uint *)&(commproc->cp_dpmem[0x0f00]);
662 for (i=0; i<(sizeof(patch_2f00)/4); i++)
663 *dp++ = patch_2f00[i];
664
665 iip = (iic_t *)&commproc->cp_dparam[PROFF_IIC];
666# define RPBASE 0x0500
667 iip->iic_rpbase = RPBASE;
668
669 /* Put SPI above the IIC, also 32-byte aligned.
670 */
671 i = (RPBASE + sizeof(iic_t) + 31) & ~31;
672 spp = (spi_t *)&commproc->cp_dparam[PROFF_SPI];
673 spp->spi_rpbase = i;
674
675# if defined(CONFIG_I2C_SPI_UCODE_PATCH)
676 commproc->cp_cpmcr1 = 0x802a;
677 commproc->cp_cpmcr2 = 0x8028;
678 commproc->cp_cpmcr3 = 0x802e;
679 commproc->cp_cpmcr4 = 0x802c;
680 commproc->cp_rccr = 1;
681
682 printk("I2C/SPI microcode patch installed.\n");
683# endif /* CONFIG_I2C_SPI_UCODE_PATCH */
684
685# if defined(CONFIG_I2C_SPI_SMC1_UCODE_PATCH)
686
687 dp = (uint *)&(commproc->cp_dpmem[0x0e00]);
688 for (i=0; i<(sizeof(patch_2e00)/4); i++)
689 *dp++ = patch_2e00[i];
690
691 commproc->cp_cpmcr1 = 0x8080;
692 commproc->cp_cpmcr2 = 0x808a;
693 commproc->cp_cpmcr3 = 0x8028;
694 commproc->cp_cpmcr4 = 0x802a;
695 commproc->cp_rccr = 3;
696
697 smp = (smc_uart_t *)&commproc->cp_dparam[PROFF_SMC1];
698 smp->smc_rpbase = 0x1FC0;
699
700 printk("I2C/SPI/SMC1 microcode patch installed.\n");
701# endif /* CONFIG_I2C_SPI_SMC1_UCODE_PATCH) */
702
703#endif /* some variation of the I2C/SPI patch was selected */
704}
705
706/*
707 * Take this entire routine out, since no one calls it and its
708 * logic is suspect.
709 */
710
711#if 0
712void
713verify_patch(volatile immap_t *immr)
714{
715 volatile uint *dp;
716 volatile cpm8xx_t *commproc;
717 int i;
718
719 commproc = (cpm8xx_t *)&immr->im_cpm;
720
721 printk("cp_rccr %x\n", commproc->cp_rccr);
722 commproc->cp_rccr = 0;
723
724 dp = (uint *)(commproc->cp_dpmem);
725 for (i=0; i<(sizeof(patch_2000)/4); i++)
726 if (*dp++ != patch_2000[i]) {
727 printk("patch_2000 bad at %d\n", i);
728 dp--;
729 printk("found 0x%X, wanted 0x%X\n", *dp, patch_2000[i]);
730 break;
731 }
732
733 dp = (uint *)&(commproc->cp_dpmem[0x0f00]);
734 for (i=0; i<(sizeof(patch_2f00)/4); i++)
735 if (*dp++ != patch_2f00[i]) {
736 printk("patch_2f00 bad at %d\n", i);
737 dp--;
738 printk("found 0x%X, wanted 0x%X\n", *dp, patch_2f00[i]);
739 break;
740 }
741
742 commproc->cp_rccr = 0x0009;
743}
744#endif
diff --git a/arch/ppc/Kconfig b/arch/ppc/Kconfig
new file mode 100644
index 000000000000..813c6c9a6d99
--- /dev/null
+++ b/arch/ppc/Kconfig
@@ -0,0 +1,1317 @@
1# For a description of the syntax of this configuration file,
2# see Documentation/kbuild/kconfig-language.txt.
3#
4
5mainmenu "Linux/PowerPC Kernel Configuration"
6
7config MMU
8 bool
9 default y
10
11config UID16
12 bool
13
14config GENERIC_HARDIRQS
15 bool
16 default y
17
18config RWSEM_GENERIC_SPINLOCK
19 bool
20
21config RWSEM_XCHGADD_ALGORITHM
22 bool
23 default y
24
25config GENERIC_CALIBRATE_DELAY
26 bool
27 default y
28
29config HAVE_DEC_LOCK
30 bool
31 default y
32
33config PPC
34 bool
35 default y
36
37config PPC32
38 bool
39 default y
40
41# All PPCs use generic nvram driver through ppc_md
42config GENERIC_NVRAM
43 bool
44 default y
45
46source "init/Kconfig"
47
48menu "Processor"
49
50choice
51 prompt "Processor Type"
52 default 6xx
53
54config 6xx
55 bool "6xx/7xx/74xx/52xx/82xx/83xx"
56 help
57 There are four types of PowerPC chips supported. The more common
58 types (601, 603, 604, 740, 750, 7400), the Motorola embedded
59 versions (821, 823, 850, 855, 860, 52xx, 82xx, 83xx), the IBM embedded
60 versions (403 and 405) and the high end 64 bit Power processors
61 (POWER 3, POWER4, and IBM 970 also known as G5)
62 Unless you are building a kernel for one of the embedded processor
63 systems, 64 bit IBM RS/6000 or an Apple G5, choose 6xx.
64 Note that the kernel runs in 32-bit mode even on 64-bit chips.
65 Also note that because the 52xx, 82xx, & 83xx family has a 603e core,
66 specific support for that chipset is asked later on.
67
68config 40x
69 bool "40x"
70
71config 44x
72 bool "44x"
73
74config POWER3
75 bool "POWER3"
76
77config POWER4
78 bool "POWER4 and 970 (G5)"
79
80config 8xx
81 depends on BROKEN
82 bool "8xx"
83
84config E500
85 bool "e500"
86
87endchoice
88
89config BOOKE
90 bool
91 depends on E500
92 default y
93
94config FSL_BOOKE
95 bool
96 depends on E500
97 default y
98
99config PTE_64BIT
100 bool
101 depends on 44x
102 default y
103
104config PHYS_64BIT
105 bool
106 depends on 44x
107 default y
108
109config ALTIVEC
110 bool "AltiVec Support"
111 depends on 6xx || POWER4
112 depends on !8260 && !83xx
113 ---help---
114 This option enables kernel support for the Altivec extensions to the
115 PowerPC processor. The kernel currently supports saving and restoring
116 altivec registers, and turning on the 'altivec enable' bit so user
117 processes can execute altivec instructions.
118
119 This option is only usefully if you have a processor that supports
120 altivec (G4, otherwise known as 74xx series), but does not have
121 any affect on a non-altivec cpu (it does, however add code to the
122 kernel).
123
124 If in doubt, say Y here.
125
126config SPE
127 bool "SPE Support"
128 depends on E500
129 ---help---
130 This option enables kernel support for the Signal Processing
131 Extensions (SPE) to the PowerPC processor. The kernel currently
132 supports saving and restoring SPE registers, and turning on the
133 'spe enable' bit so user processes can execute SPE instructions.
134
135 This option is only usefully if you have a processor that supports
136 SPE (e500, otherwise known as 85xx series), but does not have any
137 affect on a non-spe cpu (it does, however add code to the kernel).
138
139 If in doubt, say Y here.
140
141config TAU
142 bool "Thermal Management Support"
143 depends on 6xx && !8260 && !83xx
144 help
145 G3 and G4 processors have an on-chip temperature sensor called the
146 'Thermal Assist Unit (TAU)', which, in theory, can measure the on-die
147 temperature within 2-4 degrees Celsius. This option shows the current
148 on-die temperature in /proc/cpuinfo if the cpu supports it.
149
150 Unfortunately, on some chip revisions, this sensor is very inaccurate
151 and in some cases, does not work at all, so don't assume the cpu
152 temp is actually what /proc/cpuinfo says it is.
153
154config TAU_INT
155 bool "Interrupt driven TAU driver (DANGEROUS)"
156 depends on TAU
157 ---help---
158 The TAU supports an interrupt driven mode which causes an interrupt
159 whenever the temperature goes out of range. This is the fastest way
160 to get notified the temp has exceeded a range. With this option off,
161 a timer is used to re-check the temperature periodically.
162
163 However, on some cpus it appears that the TAU interrupt hardware
164 is buggy and can cause a situation which would lead unexplained hard
165 lockups.
166
167 Unless you are extending the TAU driver, or enjoy kernel/hardware
168 debugging, leave this option off.
169
170config TAU_AVERAGE
171 bool "Average high and low temp"
172 depends on TAU
173 ---help---
174 The TAU hardware can compare the temperature to an upper and lower
175 bound. The default behavior is to show both the upper and lower
176 bound in /proc/cpuinfo. If the range is large, the temperature is
177 either changing a lot, or the TAU hardware is broken (likely on some
178 G4's). If the range is small (around 4 degrees), the temperature is
179 relatively stable. If you say Y here, a single temperature value,
180 halfway between the upper and lower bounds, will be reported in
181 /proc/cpuinfo.
182
183 If in doubt, say N here.
184
185config MATH_EMULATION
186 bool "Math emulation"
187 depends on 4xx || 8xx || E500
188 ---help---
189 Some PowerPC chips designed for embedded applications do not have
190 a floating-point unit and therefore do not implement the
191 floating-point instructions in the PowerPC instruction set. If you
192 say Y here, the kernel will include code to emulate a floating-point
193 unit, which will allow programs that use floating-point
194 instructions to run.
195
196 If you have an Apple machine or an IBM RS/6000 or pSeries machine,
197 or any machine with a 6xx, 7xx or 7xxx series processor, say N
198 here. Saying Y here will not hurt performance (on any machine) but
199 will increase the size of the kernel.
200
201source "drivers/cpufreq/Kconfig"
202
203config CPU_FREQ_PMAC
204 bool "Support for Apple PowerBooks"
205 depends on CPU_FREQ && ADB_PMU
206 select CPU_FREQ_TABLE
207 help
208 This adds support for frequency switching on Apple PowerBooks,
209 this currently includes some models of iBook & Titanium
210 PowerBook.
211
212config PPC601_SYNC_FIX
213 bool "Workarounds for PPC601 bugs"
214 depends on 6xx && (PPC_PREP || PPC_PMAC)
215 help
216 Some versions of the PPC601 (the first PowerPC chip) have bugs which
217 mean that extra synchronization instructions are required near
218 certain instructions, typically those that make major changes to the
219 CPU state. These extra instructions reduce performance slightly.
220 If you say N here, these extra instructions will not be included,
221 resulting in a kernel which will run faster but may not run at all
222 on some systems with the PPC601 chip.
223
224 If in doubt, say Y here.
225
226source arch/ppc/platforms/4xx/Kconfig
227source arch/ppc/platforms/85xx/Kconfig
228
229config PPC64BRIDGE
230 bool
231 depends on POWER3 || POWER4
232 default y
233
234config PPC_STD_MMU
235 bool
236 depends on 6xx || POWER3 || POWER4
237 default y
238
239config NOT_COHERENT_CACHE
240 bool
241 depends on 4xx || 8xx
242 default y
243
244endmenu
245
246menu "Platform options"
247
248choice
249 prompt "8xx Machine Type"
250 depends on 8xx
251 default RPXLITE
252
253config RPXLITE
254 bool "RPX-Lite"
255 ---help---
256 Single-board computers based around the PowerPC MPC8xx chips and
257 intended for embedded applications. The following types are
258 supported:
259
260 RPX-Lite:
261 Embedded Planet RPX Lite. PC104 form-factor SBC based on the MPC823.
262
263 RPX-Classic:
264 Embedded Planet RPX Classic Low-fat. Credit-card-size SBC based on
265 the MPC 860
266
267 BSE-IP:
268 Bright Star Engineering ip-Engine.
269
270 TQM823L:
271 TQM850L:
272 TQM855L:
273 TQM860L:
274 MPC8xx based family of mini modules, half credit card size,
275 up to 64 MB of RAM, 8 MB Flash, (Fast) Ethernet, 2 x serial ports,
276 2 x CAN bus interface, ...
277 Manufacturer: TQ Components, www.tq-group.de
278 Date of Release: October (?) 1999
279 End of Life: not yet :-)
280 URL:
281 - module: <http://www.denx.de/PDF/TQM8xxLHWM201.pdf>
282 - starter kit: <http://www.denx.de/PDF/STK8xxLHWM201.pdf>
283 - images: <http://www.denx.de/embedded-ppc-en.html>
284
285 FPS850L:
286 FingerPrint Sensor System (based on TQM850L)
287 Manufacturer: IKENDI AG, <http://www.ikendi.com/>
288 Date of Release: November 1999
289 End of life: end 2000 ?
290 URL: see TQM850L
291
292 SPD823TS:
293 MPC823 based board used in the "Tele Server" product
294 Manufacturer: Speech Design, <http://www.speech-design.de/>
295 Date of Release: Mid 2000 (?)
296 End of life: -
297 URL: <http://www.speech-design.de/>
298 select "English", then "Teleteam Solutions", then "TeleServer"
299
300 IVMS8:
301 MPC860 based board used in the "Integrated Voice Mail System",
302 Small Version (8 voice channels)
303 Manufacturer: Speech Design, <http://www.speech-design.de/>
304 Date of Release: December 2000 (?)
305 End of life: -
306 URL: <http://www.speech-design.de/>
307
308 IVML24:
309 MPC860 based board used in the "Integrated Voice Mail System",
310 Large Version (24 voice channels)
311 Manufacturer: Speech Design, <http://www.speech-design.de/>
312 Date of Release: March 2001 (?)
313 End of life: -
314 URL: <http://www.speech-design.de/>
315
316 SM850:
317 Service Module (based on TQM850L)
318 Manufacturer: Dependable Computer Systems, <http://www.decomsys.com/>
319 Date of Release: end 2000 (?)
320 End of life: mid 2001 (?)
321 URL: <http://www.tz-mikroelektronik.de/ServiceModule/index.html>
322
323 HERMES:
324 Hermes-Pro ISDN/LAN router with integrated 8 x hub
325 Manufacturer: Multidata Gesellschaft fur Datentechnik und Informatik
326 <http://www.multidata.de/>
327 Date of Release: 2000 (?)
328 End of life: -
329 URL: <http://www.multidata.de/english/products/hpro.htm>
330
331 IP860:
332 VMEBus IP (Industry Pack) carrier board with MPC860
333 Manufacturer: MicroSys GmbH, <http://www.microsys.de/>
334 Date of Release: ?
335 End of life: -
336 URL: <http://www.microsys.de/html/ip860.html>
337
338 PCU_E:
339 PCU = Peripheral Controller Unit, Extended
340 Manufacturer: Siemens AG, ICN (Information and Communication Networks)
341 <http://www.siemens.de/page/1,3771,224315-1-999_2_226207-0,00.html>
342 Date of Release: April 2001
343 End of life: August 2001
344 URL: n. a.
345
346config RPXCLASSIC
347 bool "RPX-Classic"
348 help
349 The RPX-Classic is a single-board computer based on the Motorola
350 MPC860. It features 16MB of DRAM and a variable amount of flash,
351 I2C EEPROM, thermal monitoring, a PCMCIA slot, a DIP switch and two
352 LEDs. Variants with Ethernet ports exist. Say Y here to support it
353 directly.
354
355config BSEIP
356 bool "BSE-IP"
357 help
358 Say Y here to support the Bright Star Engineering ipEngine SBC.
359 This is a credit-card-sized device featuring a MPC823 processor,
360 26MB DRAM, 4MB flash, Ethernet, a 16K-gate FPGA, USB, an LCD/video
361 controller, and two RS232 ports.
362
363config FADS
364 bool "FADS"
365
366config TQM823L
367 bool "TQM823L"
368 help
369 Say Y here to support the TQM823L, one of an MPC8xx-based family of
370 mini SBCs (half credit-card size) from TQ Components first released
371 in late 1999. Technical references are at
372 <http://www.denx.de/PDF/TQM8xxLHWM201.pdf>, and
373 <http://www.denx.de/PDF/STK8xxLHWM201.pdf>, and an image at
374 <http://www.denx.de/embedded-ppc-en.html>.
375
376config TQM850L
377 bool "TQM850L"
378 help
379 Say Y here to support the TQM850L, one of an MPC8xx-based family of
380 mini SBCs (half credit-card size) from TQ Components first released
381 in late 1999. Technical references are at
382 <http://www.denx.de/PDF/TQM8xxLHWM201.pdf>, and
383 <http://www.denx.de/PDF/STK8xxLHWM201.pdf>, and an image at
384 <http://www.denx.de/embedded-ppc-en.html>.
385
386config TQM855L
387 bool "TQM855L"
388 help
389 Say Y here to support the TQM855L, one of an MPC8xx-based family of
390 mini SBCs (half credit-card size) from TQ Components first released
391 in late 1999. Technical references are at
392 <http://www.denx.de/PDF/TQM8xxLHWM201.pdf>, and
393 <http://www.denx.de/PDF/STK8xxLHWM201.pdf>, and an image at
394 <http://www.denx.de/embedded-ppc-en.html>.
395
396config TQM860L
397 bool "TQM860L"
398 help
399 Say Y here to support the TQM860L, one of an MPC8xx-based family of
400 mini SBCs (half credit-card size) from TQ Components first released
401 in late 1999. Technical references are at
402 <http://www.denx.de/PDF/TQM8xxLHWM201.pdf>, and
403 <http://www.denx.de/PDF/STK8xxLHWM201.pdf>, and an image at
404 <http://www.denx.de/embedded-ppc-en.html>.
405
406config FPS850L
407 bool "FPS850L"
408
409config SPD823TS
410 bool "SPD823TS"
411 help
412 Say Y here to support the Speech Design 823 Tele-Server from Speech
413 Design, released in 2000. The manufacturer's website is at
414 <http://www.speech-design.de/>.
415
416config IVMS8
417 bool "IVMS8"
418 help
419 Say Y here to support the Integrated Voice-Mail Small 8-channel SBC
420 from Speech Design, released March 2001. The manufacturer's website
421 is at <http://www.speech-design.de/>.
422
423config IVML24
424 bool "IVML24"
425 help
426 Say Y here to support the Integrated Voice-Mail Large 24-channel SBC
427 from Speech Design, released March 2001. The manufacturer's website
428 is at <http://www.speech-design.de/>.
429
430config SM850
431 bool "SM850"
432 help
433 Say Y here to support the Service Module 850 from Dependable
434 Computer Systems, an SBC based on the TQM850L module by TQ
435 Components. This board is no longer in production. The
436 manufacturer's website is at <http://www.decomsys.com/>.
437
438config HERMES_PRO
439 bool "HERMES"
440
441config IP860
442 bool "IP860"
443
444config LWMON
445 bool "LWMON"
446
447config PCU_E
448 bool "PCU_E"
449
450config CCM
451 bool "CCM"
452
453config LANTEC
454 bool "LANTEC"
455
456config MBX
457 bool "MBX"
458 help
459 MBX is a line of Motorola single-board computer based around the
460 MPC821 and MPC860 processors, and intended for embedded-controller
461 applications. Say Y here to support these boards directly.
462
463config WINCEPT
464 bool "WinCept"
465 help
466 The Wincept 100/110 is a Motorola single-board computer based on the
467 MPC821 PowerPC, introduced in 1998 and designed to be used in
468 thin-client machines. Say Y to support it directly.
469
470endchoice
471
472choice
473 prompt "Machine Type"
474 depends on 6xx || POWER3 || POWER4
475 default PPC_MULTIPLATFORM
476 ---help---
477 Linux currently supports several different kinds of PowerPC-based
478 machines: Apple Power Macintoshes and clones (such as the Motorola
479 Starmax series), PReP (PowerPC Reference Platform) machines (such
480 as the Motorola PowerStacks, Motorola cPCI/VME embedded systems,
481 and some IBM RS/6000 systems), CHRP (Common Hardware Reference
482 Platform) machines (including all of the recent IBM RS/6000 and
483 pSeries machines), and several embedded PowerPC systems containing
484 4xx, 6xx, 7xx, 8xx, 74xx, and 82xx processors. Currently, the
485 default option is to build a kernel which works on the first three.
486
487 Select CHRP/PowerMac/PReP if configuring for an IBM RS/6000 or
488 pSeries machine, a Power Macintosh (including iMacs, iBooks and
489 Powerbooks), or a PReP machine.
490
491 Select Gemini if configuring for a Synergy Microsystems' Gemini
492 series Single Board Computer. More information is available at:
493 <http://www.synergymicro.com/PressRel/97_10_15.html>.
494
495 Select APUS if configuring for a PowerUP Amiga. More information is
496 available at: <http://linux-apus.sourceforge.net/>.
497
498config PPC_MULTIPLATFORM
499 bool "CHRP/PowerMac/PReP"
500
501config APUS
502 bool "Amiga-APUS"
503 help
504 Select APUS if configuring for a PowerUP Amiga.
505 More information is available at:
506 <http://linux-apus.sourceforge.net/>.
507
508config KATANA
509 bool "Artesyn-Katana"
510 help
511 Select KATANA if configuring an Artesyn KATANA 750i or 3750
512 cPCI board.
513
514config WILLOW
515 bool "Cogent-Willow"
516
517config CPCI690
518 bool "Force-CPCI690"
519 help
520 Select CPCI690 if configuring a Force CPCI690 cPCI board.
521
522config PCORE
523 bool "Force-PowerCore"
524
525config POWERPMC250
526 bool "Force-PowerPMC250"
527
528config CHESTNUT
529 bool "IBM 750FX Eval board or 750GX Eval board"
530 help
531 Select CHESTNUT if configuring an IBM 750FX Eval Board or a
532 IBM 750GX Eval board.
533
534config SPRUCE
535 bool "IBM-Spruce"
536
537config HDPU
538 bool "Sky-HDPU"
539 help
540 Select HDPU if configuring a Sky Computers Compute Blade.
541
542config HDPU_FEATURES
543 depends HDPU
544 tristate "HDPU-Features"
545 help
546 Select to enable HDPU enhanced features.
547
548config EV64260
549 bool "Marvell-EV64260BP"
550 help
551 Select EV64260 if configuring a Marvell (formerly Galileo)
552 EV64260BP Evaluation platform.
553
554config LOPEC
555 bool "Motorola-LoPEC"
556
557config MCPN765
558 bool "Motorola-MCPN765"
559
560config MVME5100
561 bool "Motorola-MVME5100"
562
563config PPLUS
564 bool "Motorola-PowerPlus"
565
566config PRPMC750
567 bool "Motorola-PrPMC750"
568
569config PRPMC800
570 bool "Motorola-PrPMC800"
571
572config SANDPOINT
573 bool "Motorola-Sandpoint"
574 help
575 Select SANDPOINT if configuring for a Motorola Sandpoint X3
576 (any flavor).
577
578config RADSTONE_PPC7D
579 bool "Radstone Technology PPC7D board"
580
581config ADIR
582 bool "SBS-Adirondack"
583
584config K2
585 bool "SBS-K2"
586
587config PAL4
588 bool "SBS-Palomar4"
589
590config GEMINI
591 bool "Synergy-Gemini"
592 help
593 Select Gemini if configuring for a Synergy Microsystems' Gemini
594 series Single Board Computer. More information is available at:
595 <http://www.synergymicro.com/PressRel/97_10_15.html>.
596
597config EST8260
598 bool "EST8260"
599 ---help---
600 The EST8260 is a single-board computer manufactured by Wind River
601 Systems, Inc. (formerly Embedded Support Tools Corp.) and based on
602 the MPC8260. Wind River Systems has a website at
603 <http://www.windriver.com/>, but the EST8260 cannot be found on it
604 and has probably been discontinued or rebadged.
605
606config SBC82xx
607 bool "SBC82xx"
608 ---help---
609 SBC PowerQUICC II, single-board computer with MPC82xx CPU
610 Manufacturer: Wind River Systems, Inc.
611 Date of Release: May 2003
612 End of Life: -
613 URL: <http://www.windriver.com/>
614
615config SBS8260
616 bool "SBS8260"
617
618config RPX8260
619 bool "RPXSUPER"
620
621config TQM8260
622 bool "TQM8260"
623 ---help---
624 MPC8260 based module, little larger than credit card,
625 up to 128 MB global + 64 MB local RAM, 32 MB Flash,
626 32 kB EEPROM, 256 kB L@ Cache, 10baseT + 100baseT Ethernet,
627 2 x serial ports, ...
628 Manufacturer: TQ Components, www.tq-group.de
629 Date of Release: June 2001
630 End of Life: not yet :-)
631 URL: <http://www.denx.de/PDF/TQM82xx_SPEC_Rev005.pdf>
632
633config ADS8272
634 bool "ADS8272"
635
636config PQ2FADS
637 bool "Freescale-PQ2FADS"
638 help
639 Select PQ2FADS if you wish to configure for a Freescale
640 PQ2FADS board (-VR or -ZU).
641
642config LITE5200
643 bool "Freescale LITE5200 / (IceCube)"
644 select PPC_MPC52xx
645 help
646 Support for the LITE5200 dev board for the MPC5200 from Freescale.
647 This is for the LITE5200 version 2.0 board. Don't know if it changes
648 much but it's only been tested on this board version. I think this
649 board is also known as IceCube.
650
651config MPC834x_SYS
652 bool "Freescale MPC834x SYS"
653 help
654 This option enables support for the MPC 834x SYS evaluation board.
655
656endchoice
657
658config PQ2ADS
659 bool
660 depends on ADS8272
661 default y
662
663config TQM8xxL
664 bool
665 depends on 8xx && (TQM823L || TQM850L || FPS850L || TQM855L || TQM860L || SM850)
666 default y
667
668config EMBEDDEDBOOT
669 bool
670 depends on 8xx || 8260
671 default y
672
673config PPC_MPC52xx
674 bool
675
676config 8260
677 bool "CPM2 Support" if WILLOW
678 depends on 6xx
679 default y if TQM8260 || RPX8260 || EST8260 || SBS8260 || SBC82xx || PQ2FADS
680 help
681 The MPC8260 is a typical embedded CPU made by Motorola. Selecting
682 this option means that you wish to build a kernel for a machine with
683 an 8260 class CPU.
684
685config 8272
686 bool
687 depends on 6xx
688 default y if ADS8272
689 select 8260
690 help
691 The MPC8272 CPM has a different internal dpram setup than other CPM2
692 devices
693
694config 83xx
695 bool
696 default y if MPC834x_SYS
697
698config MPC834x
699 bool
700 default y if MPC834x_SYS
701
702config CPM2
703 bool
704 depends on 8260 || MPC8560 || MPC8555
705 default y
706 help
707 The CPM2 (Communications Processor Module) is a coprocessor on
708 embedded CPUs made by Motorola. Selecting this option means that
709 you wish to build a kernel for a machine with a CPM2 coprocessor
710 on it (826x, 827x, 8560).
711
712config PPC_CHRP
713 bool
714 depends on PPC_MULTIPLATFORM
715 default y
716
717config PPC_PMAC
718 bool
719 depends on PPC_MULTIPLATFORM
720 default y
721
722config PPC_PMAC64
723 bool
724 depends on PPC_PMAC && POWER4
725 default y
726
727config PPC_PREP
728 bool
729 depends on PPC_MULTIPLATFORM
730 default y
731
732config PPC_OF
733 bool
734 depends on PPC_PMAC || PPC_CHRP
735 default y
736
737config PPC_GEN550
738 bool
739 depends on SANDPOINT || MCPN765 || SPRUCE || PPLUS || PCORE || \
740 PRPMC750 || K2 || PRPMC800 || LOPEC || \
741 (EV64260 && !SERIAL_MPSC) || CHESTNUT || RADSTONE_PPC7D || \
742 83xx
743 default y
744
745config FORCE
746 bool
747 depends on 6xx && (PCORE || POWERPMC250)
748 default y
749
750config GT64260
751 bool
752 depends on EV64260 || CPCI690
753 default y
754
755config MV64360 # Really MV64360 & MV64460
756 bool
757 depends on CHESTNUT || KATANA || RADSTONE_PPC7D || HDPU
758 default y
759
760config MV64X60
761 bool
762 depends on (GT64260 || MV64360)
763 default y
764
765menu "Set bridge options"
766 depends on MV64X60
767
768config NOT_COHERENT_CACHE
769 bool "Turn off Cache Coherency"
770 default n
771 help
772 Some 64x60 bridges lock up when trying to enforce cache coherency.
773 When this option is selected, cache coherency will be turned off.
774 Note that this can cause other problems (e.g., stale data being
775 speculatively loaded via a cached mapping). Use at your own risk.
776
777config MV64X60_BASE
778 hex "Set bridge base used by firmware"
779 default "0xf1000000"
780 help
781 A firmware can leave the base address of the bridge's registers at
782 a non-standard location. If so, set this value to reflect the
783 address of that non-standard location.
784
785config MV64X60_NEW_BASE
786 hex "Set bridge base used by kernel"
787 default "0xf1000000"
788 help
789 If the current base address of the bridge's registers is not where
790 you want it, set this value to the address that you want it moved to.
791
792endmenu
793
794config NONMONARCH_SUPPORT
795 bool "Enable Non-Monarch Support"
796 depends on PRPMC800
797
798config HARRIER
799 bool
800 depends on PRPMC800
801 default y
802
803config EPIC_SERIAL_MODE
804 bool
805 depends on 6xx && (LOPEC || SANDPOINT)
806 default y
807
808config MPC10X_BRIDGE
809 bool
810 depends on PCORE || POWERPMC250 || LOPEC || SANDPOINT
811 default y
812
813config FSL_OCP
814 bool
815 depends on MPC10X_BRIDGE
816 default y
817
818config MPC10X_OPENPIC
819 bool
820 depends on POWERPMC250 || LOPEC || SANDPOINT
821 default y
822
823config MPC10X_STORE_GATHERING
824 bool "Enable MPC10x store gathering"
825 depends on MPC10X_BRIDGE
826
827config CPC710_DATA_GATHERING
828 bool "Enable CPC710 data gathering"
829 depends on K2
830
831config HARRIER_STORE_GATHERING
832 bool "Enable Harrier store gathering"
833 depends on HARRIER
834
835config MVME5100_IPMC761_PRESENT
836 bool "MVME5100 configured with an IPMC761"
837 depends on MVME5100
838
839config SPRUCE_BAUD_33M
840 bool "Spruce baud clock support"
841 depends on SPRUCE
842
843config PC_KEYBOARD
844 bool "PC PS/2 style Keyboard"
845 depends on 4xx || CPM2
846
847config PPCBUG_NVRAM
848 bool "Enable reading PPCBUG NVRAM during boot" if PPLUS || LOPEC
849 default y if PPC_PREP
850
851config SMP
852 bool "Symmetric multi-processing support"
853 ---help---
854 This enables support for systems with more than one CPU. If you have
855 a system with only one CPU, say N. If you have a system with more
856 than one CPU, say Y. Note that the kernel does not currently
857 support SMP machines with 603/603e/603ev or PPC750 ("G3") processors
858 since they have inadequate hardware support for multiprocessor
859 operation.
860
861 If you say N here, the kernel will run on single and multiprocessor
862 machines, but will use only one CPU of a multiprocessor machine. If
863 you say Y here, the kernel will run on single-processor machines.
864 On a single-processor machine, the kernel will run faster if you say
865 N here.
866
867 If you don't know what to do here, say N.
868
869config IRQ_ALL_CPUS
870 bool "Distribute interrupts on all CPUs by default"
871 depends on SMP
872 help
873 This option gives the kernel permission to distribute IRQs across
874 multiple CPUs. Saying N here will route all IRQs to the first
875 CPU. Generally saying Y is safe, although some problems have been
876 reported with SMP Power Macintoshes with this option enabled.
877
878config NR_CPUS
879 int "Maximum number of CPUs (2-32)"
880 range 2 32
881 depends on SMP
882 default "4"
883
884config PREEMPT
885 bool "Preemptible Kernel"
886 help
887 This option reduces the latency of the kernel when reacting to
888 real-time or interactive events by allowing a low priority process to
889 be preempted even if it is in kernel mode executing a system call.
890
891 Say Y here if you are building a kernel for a desktop, embedded
892 or real-time system. Say N if you are unsure.
893
894config HIGHMEM
895 bool "High memory support"
896
897source "fs/Kconfig.binfmt"
898
899config PROC_DEVICETREE
900 bool "Support for Open Firmware device tree in /proc"
901 depends on PPC_OF && PROC_FS
902 help
903 This option adds a device-tree directory under /proc which contains
904 an image of the device tree that the kernel copies from Open
905 Firmware. If unsure, say Y here.
906
907config PREP_RESIDUAL
908 bool "Support for PReP Residual Data"
909 depends on PPC_PREP
910 help
911 Some PReP systems have residual data passed to the kernel by the
912 firmware. This allows detection of memory size, devices present and
913 other useful pieces of information. Sometimes this information is
914 not present or incorrect, in which case it could lead to the machine
915 behaving incorrectly. If this happens, either disable PREP_RESIDUAL
916 or pass the 'noresidual' option to the kernel.
917
918 If you are running a PReP system, say Y here, otherwise say N.
919
920config PROC_PREPRESIDUAL
921 bool "Support for reading of PReP Residual Data in /proc"
922 depends on PREP_RESIDUAL && PROC_FS
923 help
924 Enabling this option will create a /proc/residual file which allows
925 you to get at the residual data on PReP systems. You will need a tool
926 (lsresidual) to parse it. If you aren't on a PReP system, you don't
927 want this.
928
929config CMDLINE_BOOL
930 bool "Default bootloader kernel arguments"
931
932config CMDLINE
933 string "Initial kernel command string"
934 depends on CMDLINE_BOOL
935 default "console=ttyS0,9600 console=tty0 root=/dev/sda2"
936 help
937 On some platforms, there is currently no way for the boot loader to
938 pass arguments to the kernel. For these platforms, you can supply
939 some command-line options at build time by entering them here. In
940 most cases you will need to specify the root device here.
941
942config AMIGA
943 bool
944 depends on APUS
945 default y
946 help
947 This option enables support for the Amiga series of computers.
948
949config ZORRO
950 bool
951 depends on APUS
952 default y
953 help
954 This enables support for the Zorro bus in the Amiga. If you have
955 expansion cards in your Amiga that conform to the Amiga
956 AutoConfig(tm) specification, say Y, otherwise N. Note that even
957 expansion cards that do not fit in the Zorro slots but fit in e.g.
958 the CPU slot may fall in this category, so you have to say Y to let
959 Linux use these.
960
961config ABSTRACT_CONSOLE
962 bool
963 depends on APUS
964 default y
965
966config APUS_FAST_EXCEPT
967 bool
968 depends on APUS
969 default y
970
971config AMIGA_PCMCIA
972 bool "Amiga 1200/600 PCMCIA support"
973 depends on APUS && EXPERIMENTAL
974 help
975 Include support in the kernel for pcmcia on Amiga 1200 and Amiga
976 600. If you intend to use pcmcia cards say Y; otherwise say N.
977
978config AMIGA_BUILTIN_SERIAL
979 tristate "Amiga builtin serial support"
980 depends on APUS
981 help
982 If you want to use your Amiga's built-in serial port in Linux,
983 answer Y.
984
985 To compile this driver as a module, choose M here.
986
987config GVPIOEXT
988 tristate "GVP IO-Extender support"
989 depends on APUS
990 help
991 If you want to use a GVP IO-Extender serial card in Linux, say Y.
992 Otherwise, say N.
993
994config GVPIOEXT_LP
995 tristate "GVP IO-Extender parallel printer support"
996 depends on GVPIOEXT
997 help
998 Say Y to enable driving a printer from the parallel port on your
999 GVP IO-Extender card, N otherwise.
1000
1001config GVPIOEXT_PLIP
1002 tristate "GVP IO-Extender PLIP support"
1003 depends on GVPIOEXT
1004 help
1005 Say Y to enable doing IP over the parallel port on your GVP
1006 IO-Extender card, N otherwise.
1007
1008config MULTIFACE_III_TTY
1009 tristate "Multiface Card III serial support"
1010 depends on APUS
1011 help
1012 If you want to use a Multiface III card's serial port in Linux,
1013 answer Y.
1014
1015 To compile this driver as a module, choose M here.
1016
1017config A2232
1018 tristate "Commodore A2232 serial support (EXPERIMENTAL)"
1019 depends on EXPERIMENTAL && APUS
1020 ---help---
1021 This option supports the 2232 7-port serial card shipped with the
1022 Amiga 2000 and other Zorro-bus machines, dating from 1989. At
1023 a max of 19,200 bps, the ports are served by a 6551 ACIA UART chip
1024 each, plus a 8520 CIA, and a master 6502 CPU and buffer as well. The
1025 ports were connected with 8 pin DIN connectors on the card bracket,
1026 for which 8 pin to DB25 adapters were supplied. The card also had
1027 jumpers internally to toggle various pinning configurations.
1028
1029 This driver can be built as a module; but then "generic_serial"
1030 will also be built as a module. This has to be loaded before
1031 "ser_a2232". If you want to do this, answer M here.
1032
1033config WHIPPET_SERIAL
1034 tristate "Hisoft Whippet PCMCIA serial support"
1035 depends on AMIGA_PCMCIA
1036 help
1037 HiSoft has a web page at <http://www.hisoft.co.uk/>, but there
1038 is no listing for the Whippet in their Amiga section.
1039
1040config APNE
1041 tristate "PCMCIA NE2000 support"
1042 depends on AMIGA_PCMCIA
1043 help
1044 If you have a PCMCIA NE2000 compatible adapter, say Y. Otherwise,
1045 say N.
1046
1047 To compile this driver as a module, choose M here: the
1048 module will be called apne.
1049
1050config SERIAL_CONSOLE
1051 bool "Support for serial port console"
1052 depends on APUS && (AMIGA_BUILTIN_SERIAL=y || GVPIOEXT=y || MULTIFACE_III_TTY=y)
1053
1054config HEARTBEAT
1055 bool "Use power LED as a heartbeat"
1056 depends on APUS
1057 help
1058 Use the power-on LED on your machine as a load meter. The exact
1059 behavior is platform-dependent, but normally the flash frequency is
1060 a hyperbolic function of the 5-minute load average.
1061
1062config PROC_HARDWARE
1063 bool "/proc/hardware support"
1064 depends on APUS
1065
1066source "drivers/zorro/Kconfig"
1067
1068source kernel/power/Kconfig
1069
1070endmenu
1071
1072menu "Bus options"
1073
1074config ISA
1075 bool "Support for ISA-bus hardware"
1076 depends on PPC_PREP || PPC_CHRP
1077 help
1078 Find out whether you have ISA slots on your motherboard. ISA is the
1079 name of a bus system, i.e. the way the CPU talks to the other stuff
1080 inside your box. If you have an Apple machine, say N here; if you
1081 have an IBM RS/6000 or pSeries machine or a PReP machine, say Y. If
1082 you have an embedded board, consult your board documentation.
1083
1084config GENERIC_ISA_DMA
1085 bool
1086 depends on POWER3 || POWER4 || 6xx && !CPM2
1087 default y
1088
1089config EISA
1090 bool
1091 help
1092 The Extended Industry Standard Architecture (EISA) bus is a bus
1093 architecture used on some older intel-based PCs.
1094
1095config SBUS
1096 bool
1097
1098# Yes MCA RS/6000s exist but Linux-PPC does not currently support any
1099config MCA
1100 bool
1101
1102config PCI
1103 bool "PCI support" if 40x || CPM2 || 83xx || 85xx || PPC_MPC52xx
1104 default y if !40x && !CPM2 && !8xx && !APUS && !83xx && !85xx
1105 default PCI_PERMEDIA if !4xx && !CPM2 && !8xx && APUS
1106 default PCI_QSPAN if !4xx && !CPM2 && 8xx
1107 help
1108 Find out whether your system includes a PCI bus. PCI is the name of
1109 a bus system, i.e. the way the CPU talks to the other stuff inside
1110 your box. If you say Y here, the kernel will include drivers and
1111 infrastructure code to support PCI bus devices.
1112
1113config PCI_DOMAINS
1114 bool
1115 default PCI
1116
1117config PCI_QSPAN
1118 bool "QSpan PCI"
1119 depends on !4xx && !CPM2 && 8xx
1120 help
1121 Say Y here if you have a system based on a Motorola 8xx-series
1122 embedded processor with a QSPAN PCI interface, otherwise say N.
1123
1124config PCI_8260
1125 bool
1126 depends on PCI && 8260 && !8272
1127 default y
1128
1129config 8260_PCI9
1130 bool " Enable workaround for MPC826x erratum PCI 9"
1131 depends on PCI_8260
1132 default y
1133
1134choice
1135 prompt " IDMA channel for PCI 9 workaround"
1136 depends on 8260_PCI9
1137
1138config 8260_PCI9_IDMA1
1139 bool "IDMA1"
1140
1141config 8260_PCI9_IDMA2
1142 bool "IDMA2"
1143
1144config 8260_PCI9_IDMA3
1145 bool "IDMA3"
1146
1147config 8260_PCI9_IDMA4
1148 bool "IDMA4"
1149
1150endchoice
1151
1152config PCI_PERMEDIA
1153 bool "PCI for Permedia2"
1154 depends on !4xx && !8xx && APUS
1155
1156source "drivers/pci/Kconfig"
1157
1158source "drivers/pcmcia/Kconfig"
1159
1160endmenu
1161
1162menu "Advanced setup"
1163
1164config ADVANCED_OPTIONS
1165 bool "Prompt for advanced kernel configuration options"
1166 help
1167 This option will enable prompting for a variety of advanced kernel
1168 configuration options. These options can cause the kernel to not
1169 work if they are set incorrectly, but can be used to optimize certain
1170 aspects of kernel memory management.
1171
1172 Unless you know what you are doing, say N here.
1173
1174comment "Default settings for advanced configuration options are used"
1175 depends on !ADVANCED_OPTIONS
1176
1177config HIGHMEM_START_BOOL
1178 bool "Set high memory pool address"
1179 depends on ADVANCED_OPTIONS && HIGHMEM
1180 help
1181 This option allows you to set the base address of the kernel virtual
1182 area used to map high memory pages. This can be useful in
1183 optimizing the layout of kernel virtual memory.
1184
1185 Say N here unless you know what you are doing.
1186
1187config HIGHMEM_START
1188 hex "Virtual start address of high memory pool" if HIGHMEM_START_BOOL
1189 default "0xfe000000"
1190
1191config LOWMEM_SIZE_BOOL
1192 bool "Set maximum low memory"
1193 depends on ADVANCED_OPTIONS
1194 help
1195 This option allows you to set the maximum amount of memory which
1196 will be used as "low memory", that is, memory which the kernel can
1197 access directly, without having to set up a kernel virtual mapping.
1198 This can be useful in optimizing the layout of kernel virtual
1199 memory.
1200
1201 Say N here unless you know what you are doing.
1202
1203config LOWMEM_SIZE
1204 hex "Maximum low memory size (in bytes)" if LOWMEM_SIZE_BOOL
1205 default "0x30000000"
1206
1207config KERNEL_START_BOOL
1208 bool "Set custom kernel base address"
1209 depends on ADVANCED_OPTIONS
1210 help
1211 This option allows you to set the kernel virtual address at which
1212 the kernel will map low memory (the kernel image will be linked at
1213 this address). This can be useful in optimizing the virtual memory
1214 layout of the system.
1215
1216 Say N here unless you know what you are doing.
1217
1218config KERNEL_START
1219 hex "Virtual address of kernel base" if KERNEL_START_BOOL
1220 default "0xc0000000"
1221
1222config TASK_SIZE_BOOL
1223 bool "Set custom user task size"
1224 depends on ADVANCED_OPTIONS
1225 help
1226 This option allows you to set the amount of virtual address space
1227 allocated to user tasks. This can be useful in optimizing the
1228 virtual memory layout of the system.
1229
1230 Say N here unless you know what you are doing.
1231
1232config TASK_SIZE
1233 hex "Size of user task space" if TASK_SIZE_BOOL
1234 default "0x80000000"
1235
1236config CONSISTENT_START_BOOL
1237 bool "Set custom consistent memory pool address"
1238 depends on ADVANCED_OPTIONS && NOT_COHERENT_CACHE
1239 help
1240 This option allows you to set the base virtual address
1241 of the the consistent memory pool. This pool of virtual
1242 memory is used to make consistent memory allocations.
1243
1244config CONSISTENT_START
1245 hex "Base virtual address of consistent memory pool" if CONSISTENT_START_BOOL
1246 default "0xff100000" if NOT_COHERENT_CACHE
1247
1248config CONSISTENT_SIZE_BOOL
1249 bool "Set custom consistent memory pool size"
1250 depends on ADVANCED_OPTIONS && NOT_COHERENT_CACHE
1251 help
1252 This option allows you to set the size of the the
1253 consistent memory pool. This pool of virtual memory
1254 is used to make consistent memory allocations.
1255
1256config CONSISTENT_SIZE
1257 hex "Size of consistent memory pool" if CONSISTENT_SIZE_BOOL
1258 default "0x00200000" if NOT_COHERENT_CACHE
1259
1260config BOOT_LOAD_BOOL
1261 bool "Set the boot link/load address"
1262 depends on ADVANCED_OPTIONS && !PPC_MULTIPLATFORM
1263 help
1264 This option allows you to set the initial load address of the zImage
1265 or zImage.initrd file. This can be useful if you are on a board
1266 which has a small amount of memory.
1267
1268 Say N here unless you know what you are doing.
1269
1270config BOOT_LOAD
1271 hex "Link/load address for booting" if BOOT_LOAD_BOOL
1272 default "0x00400000" if 40x || 8xx || 8260
1273 default "0x01000000" if 44x
1274 default "0x00800000"
1275
1276config PIN_TLB
1277 bool "Pinned Kernel TLBs (860 ONLY)"
1278 depends on ADVANCED_OPTIONS && 8xx
1279endmenu
1280
1281source "drivers/Kconfig"
1282
1283source "fs/Kconfig"
1284
1285source "arch/ppc/8xx_io/Kconfig"
1286
1287source "arch/ppc/8260_io/Kconfig"
1288
1289
1290menu "IBM 40x options"
1291 depends on 40x
1292
1293config SERIAL_SICC
1294 bool "SICC Serial port"
1295 depends on STB03xxx
1296
1297config UART1_DFLT_CONSOLE
1298 bool
1299 depends on SERIAL_SICC && UART0_TTYS1
1300 default y
1301
1302config SERIAL_SICC_CONSOLE
1303 bool
1304 depends on SERIAL_SICC && UART0_TTYS1
1305 default y
1306
1307endmenu
1308
1309source "lib/Kconfig"
1310
1311source "arch/ppc/oprofile/Kconfig"
1312
1313source "arch/ppc/Kconfig.debug"
1314
1315source "security/Kconfig"
1316
1317source "crypto/Kconfig"
diff --git a/arch/ppc/Kconfig.debug b/arch/ppc/Kconfig.debug
new file mode 100644
index 000000000000..d2e1eea8e8e4
--- /dev/null
+++ b/arch/ppc/Kconfig.debug
@@ -0,0 +1,72 @@
1menu "Kernel hacking"
2
3source "lib/Kconfig.debug"
4
5config KGDB
6 bool "Include kgdb kernel debugger"
7 depends on DEBUG_KERNEL && (BROKEN || PPC_GEN550 || 4xx)
8 select DEBUG_INFO
9 help
10 Include in-kernel hooks for kgdb, the Linux kernel source level
11 debugger. See <http://kgdb.sourceforge.net/> for more information.
12 Unless you are intending to debug the kernel, say N here.
13
14choice
15 prompt "Serial Port"
16 depends on KGDB
17 default KGDB_TTYS1
18
19config KGDB_TTYS0
20 bool "ttyS0"
21
22config KGDB_TTYS1
23 bool "ttyS1"
24
25config KGDB_TTYS2
26 bool "ttyS2"
27
28config KGDB_TTYS3
29 bool "ttyS3"
30
31endchoice
32
33config KGDB_CONSOLE
34 bool "Enable serial console thru kgdb port"
35 depends on KGDB && 8xx || CPM2
36 help
37 If you enable this, all serial console messages will be sent
38 over the gdb stub.
39 If unsure, say N.
40
41config XMON
42 bool "Include xmon kernel debugger"
43 depends on DEBUG_KERNEL
44 help
45 Include in-kernel hooks for the xmon kernel monitor/debugger.
46 Unless you are intending to debug the kernel, say N here.
47
48config BDI_SWITCH
49 bool "Include BDI-2000 user context switcher"
50 depends on DEBUG_KERNEL
51 help
52 Include in-kernel support for the Abatron BDI2000 debugger.
53 Unless you are intending to debug the kernel with one of these
54 machines, say N here.
55
56config BOOTX_TEXT
57 bool "Support for early boot text console (BootX or OpenFirmware only)"
58 depends PPC_OF
59 help
60 Say Y here to see progress messages from the boot firmware in text
61 mode. Requires either BootX or Open Firmware.
62
63config SERIAL_TEXT_DEBUG
64 bool "Support for early boot texts over serial port"
65 depends on 4xx || GT64260 || LOPEC || PPLUS || PRPMC800 || PPC_GEN550 || PPC_MPC52xx
66
67config PPC_OCP
68 bool
69 depends on IBM_OCP || FSL_OCP || XILINX_OCP
70 default y
71
72endmenu
diff --git a/arch/ppc/Makefile b/arch/ppc/Makefile
new file mode 100644
index 000000000000..73cbdda5b597
--- /dev/null
+++ b/arch/ppc/Makefile
@@ -0,0 +1,138 @@
1# This file is included by the global makefile so that you can add your own
2# architecture-specific flags and dependencies.
3#
4# This file is subject to the terms and conditions of the GNU General Public
5# License. See the file "COPYING" in the main directory of this archive
6# for more details.
7#
8# Copyright (C) 1994 by Linus Torvalds
9# Changes for PPC by Gary Thomas
10# Rewritten by Cort Dougan and Paul Mackerras
11#
12
13# This must match PAGE_OFFSET in include/asm-ppc/page.h.
14KERNELLOAD := $(CONFIG_KERNEL_START)
15
16HAS_BIARCH := $(call cc-option-yn, -m32)
17ifeq ($(HAS_BIARCH),y)
18AS := $(AS) -a32
19LD := $(LD) -m elf32ppc
20CC := $(CC) -m32
21endif
22
23LDFLAGS_vmlinux := -Ttext $(KERNELLOAD) -Bstatic
24CPPFLAGS += -Iarch/$(ARCH)
25AFLAGS += -Iarch/$(ARCH)
26CFLAGS += -Iarch/$(ARCH) -msoft-float -pipe \
27 -ffixed-r2 -mmultiple
28CPP = $(CC) -E $(CFLAGS)
29
30CHECKFLAGS += -D__powerpc__
31
32ifndef CONFIG_E500
33CFLAGS += -mstring
34endif
35
36cpu-as-$(CONFIG_PPC64BRIDGE) += -Wa,-mppc64bridge
37cpu-as-$(CONFIG_4xx) += -Wa,-m405
38cpu-as-$(CONFIG_6xx) += -Wa,-maltivec
39cpu-as-$(CONFIG_POWER4) += -Wa,-maltivec
40cpu-as-$(CONFIG_E500) += -Wa,-me500
41
42AFLAGS += $(cpu-as-y)
43CFLAGS += $(cpu-as-y)
44
45# Default to the common case.
46KBUILD_DEFCONFIG := common_defconfig
47
48head-y := arch/ppc/kernel/head.o
49head-$(CONFIG_8xx) := arch/ppc/kernel/head_8xx.o
50head-$(CONFIG_4xx) := arch/ppc/kernel/head_4xx.o
51head-$(CONFIG_44x) := arch/ppc/kernel/head_44x.o
52head-$(CONFIG_FSL_BOOKE) := arch/ppc/kernel/head_fsl_booke.o
53
54head-$(CONFIG_6xx) += arch/ppc/kernel/idle_6xx.o
55head-$(CONFIG_POWER4) += arch/ppc/kernel/idle_power4.o
56
57core-y += arch/ppc/kernel/ arch/ppc/platforms/ \
58 arch/ppc/mm/ arch/ppc/lib/ arch/ppc/syslib/
59core-$(CONFIG_4xx) += arch/ppc/platforms/4xx/
60core-$(CONFIG_83xx) += arch/ppc/platforms/83xx/
61core-$(CONFIG_85xx) += arch/ppc/platforms/85xx/
62core-$(CONFIG_MATH_EMULATION) += arch/ppc/math-emu/
63core-$(CONFIG_XMON) += arch/ppc/xmon/
64core-$(CONFIG_APUS) += arch/ppc/amiga/
65drivers-$(CONFIG_8xx) += arch/ppc/8xx_io/
66drivers-$(CONFIG_4xx) += arch/ppc/4xx_io/
67drivers-$(CONFIG_CPM2) += arch/ppc/8260_io/
68
69drivers-$(CONFIG_OPROFILE) += arch/ppc/oprofile/
70
71BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd vmlinux.sm
72
73.PHONY: $(BOOT_TARGETS)
74
75all: uImage zImage
76
77CPPFLAGS_vmlinux.lds := -Upowerpc
78
79# All the instructions talk about "make bzImage".
80bzImage: zImage
81
82boot := arch/$(ARCH)/boot
83
84$(BOOT_TARGETS): vmlinux
85 $(Q)$(MAKE) $(build)=$(boot) $@
86
87uImage: vmlinux
88 $(Q)$(MAKE) $(build)=$(boot)/images $(boot)/images/$@
89
90define archhelp
91 @echo '* zImage - Compressed kernel image (arch/$(ARCH)/boot/images/zImage.*)'
92 @echo ' uImage - Create a bootable image for U-Boot / PPCBoot'
93 @echo ' install - Install kernel using'
94 @echo ' (your) ~/bin/installkernel or'
95 @echo ' (distribution) /sbin/installkernel or'
96 @echo ' install to $$(INSTALL_PATH) and run lilo'
97 @echo ' *_defconfig - Select default config from arch/$(ARCH)/ppc/configs'
98endef
99
100archclean:
101 $(Q)$(MAKE) $(clean)=arch/ppc/boot
102
103prepare: include/asm-$(ARCH)/offsets.h checkbin
104
105arch/$(ARCH)/kernel/asm-offsets.s: include/asm include/linux/version.h \
106 include/config/MARKER
107
108include/asm-$(ARCH)/offsets.h: arch/$(ARCH)/kernel/asm-offsets.s
109 $(call filechk,gen-asm-offsets)
110
111# Use the file '.tmp_gas_check' for binutils tests, as gas won't output
112# to stdout and these checks are run even on install targets.
113TOUT := .tmp_gas_check
114# Ensure this is binutils 2.12.1 (or 2.12.90.0.7) or later for altivec
115# instructions.
116# gcc-3.4 and binutils-2.14 are a fatal combination.
117GCC_VERSION := $(call cc-version)
118
119checkbin:
120 @if test "$(GCC_VERSION)" = "0304" ; then \
121 if ! /bin/echo mftb 5 | $(AS) -v -mppc -many -o $(TOUT) >/dev/null 2>&1 ; then \
122 echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build '; \
123 echo 'correctly with gcc-3.4 and your version of binutils.'; \
124 echo '*** Please upgrade your binutils or downgrade your gcc'; \
125 false; \
126 fi ; \
127 fi
128 @if ! /bin/echo dssall | $(AS) -many -o $(TOUT) >/dev/null 2>&1 ; then \
129 echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build ' ; \
130 echo 'correctly with old versions of binutils.' ; \
131 echo '*** Please upgrade your binutils to 2.12.1 or newer' ; \
132 false ; \
133 fi
134
135CLEAN_FILES += include/asm-$(ARCH)/offsets.h \
136 arch/$(ARCH)/kernel/asm-offsets.s \
137 $(TOUT)
138
diff --git a/arch/ppc/amiga/Makefile b/arch/ppc/amiga/Makefile
new file mode 100644
index 000000000000..59fec0a3ac8e
--- /dev/null
+++ b/arch/ppc/amiga/Makefile
@@ -0,0 +1,8 @@
1#
2# Makefile for Linux arch/m68k/amiga source directory
3#
4
5obj-y := config.o amiints.o cia.o time.o bootinfo.o amisound.o \
6 chipram.o amiga_ksyms.o
7
8obj-$(CONFIG_AMIGA_PCMCIA) += pcmcia.o
diff --git a/arch/ppc/amiga/amiga_ksyms.c b/arch/ppc/amiga/amiga_ksyms.c
new file mode 100644
index 000000000000..ec74e5b7a1ce
--- /dev/null
+++ b/arch/ppc/amiga/amiga_ksyms.c
@@ -0,0 +1 @@
#include "../../m68k/amiga/amiga_ksyms.c"
diff --git a/arch/ppc/amiga/amiints.c b/arch/ppc/amiga/amiints.c
new file mode 100644
index 000000000000..91195e2ce38d
--- /dev/null
+++ b/arch/ppc/amiga/amiints.c
@@ -0,0 +1,323 @@
1/*
2 * arch/ppc/amiga/amiints.c -- Amiga Linux interrupt handling code
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file COPYING in the main directory of this archive
6 * for more details.
7 *
8 * 11/07/96: rewritten interrupt handling, irq lists are exists now only for
9 * this sources where it makes sense (VERTB/PORTS/EXTER) and you must
10 * be careful that dev_id for this sources is unique since this the
11 * only possibility to distinguish between different handlers for
12 * free_irq. irq lists also have different irq flags:
13 * - IRQ_FLG_FAST: handler is inserted at top of list (after other
14 * fast handlers)
15 * - IRQ_FLG_SLOW: handler is inserted at bottom of list and before
16 * they're executed irq level is set to the previous
17 * one, but handlers don't need to be reentrant, if
18 * reentrance occurred, slow handlers will be just
19 * called again.
20 * The whole interrupt handling for CIAs is moved to cia.c
21 * /Roman Zippel
22 *
23 * 07/08/99: rewamp of the interrupt handling - we now have two types of
24 * interrupts, normal and fast handlers, fast handlers being
25 * marked with SA_INTERRUPT and runs with all other interrupts
26 * disabled. Normal interrupts disable their own source but
27 * run with all other interrupt sources enabled.
28 * PORTS and EXTER interrupts are always shared even if the
29 * drivers do not explicitly mark this when calling
30 * request_irq which they really should do.
31 * This is similar to the way interrupts are handled on all
32 * other architectures and makes a ton of sense besides
33 * having the advantage of making it easier to share
34 * drivers.
35 * /Jes
36 */
37
38#include <linux/config.h>
39#include <linux/types.h>
40#include <linux/kernel.h>
41#include <linux/sched.h>
42#include <linux/interrupt.h>
43#include <linux/irq.h>
44#include <linux/kernel_stat.h>
45#include <linux/init.h>
46
47#include <asm/system.h>
48#include <asm/irq.h>
49#include <asm/traps.h>
50#include <asm/amigahw.h>
51#include <asm/amigaints.h>
52#include <asm/amipcmcia.h>
53
54#ifdef CONFIG_APUS
55#include <asm/amigappc.h>
56#endif
57
58extern void cia_init_IRQ(struct ciabase *base);
59
60unsigned short ami_intena_vals[AMI_STD_IRQS] = {
61 IF_VERTB, IF_COPER, IF_AUD0, IF_AUD1, IF_AUD2, IF_AUD3, IF_BLIT,
62 IF_DSKSYN, IF_DSKBLK, IF_RBF, IF_TBE, IF_SOFT, IF_PORTS, IF_EXTER
63};
64static const unsigned char ami_servers[AMI_STD_IRQS] = {
65 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1
66};
67
68static short ami_ablecount[AMI_IRQS];
69
70static void ami_badint(int irq, void *dev_id, struct pt_regs *fp)
71{
72/* num_spurious += 1;*/
73}
74
75/*
76 * void amiga_init_IRQ(void)
77 *
78 * Parameters: None
79 *
80 * Returns: Nothing
81 *
82 * This function should be called during kernel startup to initialize
83 * the amiga IRQ handling routines.
84 */
85
86__init
87void amiga_init_IRQ(void)
88{
89 int i;
90
91 for (i = 0; i < AMI_IRQS; i++)
92 ami_ablecount[i] = 0;
93
94 /* turn off PCMCIA interrupts */
95 if (AMIGAHW_PRESENT(PCMCIA))
96 gayle.inten = GAYLE_IRQ_IDE;
97
98 /* turn off all interrupts... */
99 custom.intena = 0x7fff;
100 custom.intreq = 0x7fff;
101
102#ifdef CONFIG_APUS
103 /* Clear any inter-CPU interrupt requests. Circumvents bug in
104 Blizzard IPL emulation HW (or so it appears). */
105 APUS_WRITE(APUS_INT_LVL, INTLVL_SETRESET | INTLVL_MASK);
106
107 /* Init IPL emulation. */
108 APUS_WRITE(APUS_REG_INT, REGINT_INTMASTER | REGINT_ENABLEIPL);
109 APUS_WRITE(APUS_IPL_EMU, IPLEMU_DISABLEINT);
110 APUS_WRITE(APUS_IPL_EMU, IPLEMU_SETRESET | IPLEMU_IPLMASK);
111#endif
112 /* ... and enable the master interrupt bit */
113 custom.intena = IF_SETCLR | IF_INTEN;
114
115 cia_init_IRQ(&ciaa_base);
116 cia_init_IRQ(&ciab_base);
117}
118
119/*
120 * Enable/disable a particular machine specific interrupt source.
121 * Note that this may affect other interrupts in case of a shared interrupt.
122 * This function should only be called for a _very_ short time to change some
123 * internal data, that may not be changed by the interrupt at the same time.
124 * ami_(enable|disable)_irq calls may also be nested.
125 */
126
127void amiga_enable_irq(unsigned int irq)
128{
129 if (irq >= AMI_IRQS) {
130 printk("%s: Unknown IRQ %d\n", __FUNCTION__, irq);
131 return;
132 }
133
134 ami_ablecount[irq]--;
135 if (ami_ablecount[irq]<0)
136 ami_ablecount[irq]=0;
137 else if (ami_ablecount[irq])
138 return;
139
140 /* No action for auto-vector interrupts */
141 if (irq >= IRQ_AMIGA_AUTO){
142 printk("%s: Trying to enable auto-vector IRQ %i\n",
143 __FUNCTION__, irq - IRQ_AMIGA_AUTO);
144 return;
145 }
146
147 if (irq >= IRQ_AMIGA_CIAA) {
148 cia_set_irq(irq, 0);
149 cia_able_irq(irq, 1);
150 return;
151 }
152
153 /* enable the interrupt */
154 custom.intena = IF_SETCLR | ami_intena_vals[irq];
155}
156
157void amiga_disable_irq(unsigned int irq)
158{
159 if (irq >= AMI_IRQS) {
160 printk("%s: Unknown IRQ %d\n", __FUNCTION__, irq);
161 return;
162 }
163
164 if (ami_ablecount[irq]++)
165 return;
166
167 /* No action for auto-vector interrupts */
168 if (irq >= IRQ_AMIGA_AUTO) {
169 printk("%s: Trying to disable auto-vector IRQ %i\n",
170 __FUNCTION__, irq - IRQ_AMIGA_AUTO);
171 return;
172 }
173
174 if (irq >= IRQ_AMIGA_CIAA) {
175 cia_able_irq(irq, 0);
176 return;
177 }
178
179 /* disable the interrupt */
180 custom.intena = ami_intena_vals[irq];
181}
182
183inline void amiga_do_irq(int irq, struct pt_regs *fp)
184{
185 irq_desc_t *desc = irq_desc + irq;
186 struct irqaction *action = desc->action;
187
188 kstat_cpu(0).irqs[irq]++;
189 action->handler(irq, action->dev_id, fp);
190}
191
192void amiga_do_irq_list(int irq, struct pt_regs *fp)
193{
194 irq_desc_t *desc = irq_desc + irq;
195 struct irqaction *action;
196
197 kstat_cpu(0).irqs[irq]++;
198
199 custom.intreq = ami_intena_vals[irq];
200
201 for (action = desc->action; action; action = action->next)
202 action->handler(irq, action->dev_id, fp);
203}
204
205/*
206 * The builtin Amiga hardware interrupt handlers.
207 */
208
209static void ami_int1(int irq, void *dev_id, struct pt_regs *fp)
210{
211 unsigned short ints = custom.intreqr & custom.intenar;
212
213 /* if serial transmit buffer empty, interrupt */
214 if (ints & IF_TBE) {
215 custom.intreq = IF_TBE;
216 amiga_do_irq(IRQ_AMIGA_TBE, fp);
217 }
218
219 /* if floppy disk transfer complete, interrupt */
220 if (ints & IF_DSKBLK) {
221 custom.intreq = IF_DSKBLK;
222 amiga_do_irq(IRQ_AMIGA_DSKBLK, fp);
223 }
224
225 /* if software interrupt set, interrupt */
226 if (ints & IF_SOFT) {
227 custom.intreq = IF_SOFT;
228 amiga_do_irq(IRQ_AMIGA_SOFT, fp);
229 }
230}
231
232static void ami_int3(int irq, void *dev_id, struct pt_regs *fp)
233{
234 unsigned short ints = custom.intreqr & custom.intenar;
235
236 /* if a blitter interrupt */
237 if (ints & IF_BLIT) {
238 custom.intreq = IF_BLIT;
239 amiga_do_irq(IRQ_AMIGA_BLIT, fp);
240 }
241
242 /* if a copper interrupt */
243 if (ints & IF_COPER) {
244 custom.intreq = IF_COPER;
245 amiga_do_irq(IRQ_AMIGA_COPPER, fp);
246 }
247
248 /* if a vertical blank interrupt */
249 if (ints & IF_VERTB)
250 amiga_do_irq_list(IRQ_AMIGA_VERTB, fp);
251}
252
253static void ami_int4(int irq, void *dev_id, struct pt_regs *fp)
254{
255 unsigned short ints = custom.intreqr & custom.intenar;
256
257 /* if audio 0 interrupt */
258 if (ints & IF_AUD0) {
259 custom.intreq = IF_AUD0;
260 amiga_do_irq(IRQ_AMIGA_AUD0, fp);
261 }
262
263 /* if audio 1 interrupt */
264 if (ints & IF_AUD1) {
265 custom.intreq = IF_AUD1;
266 amiga_do_irq(IRQ_AMIGA_AUD1, fp);
267 }
268
269 /* if audio 2 interrupt */
270 if (ints & IF_AUD2) {
271 custom.intreq = IF_AUD2;
272 amiga_do_irq(IRQ_AMIGA_AUD2, fp);
273 }
274
275 /* if audio 3 interrupt */
276 if (ints & IF_AUD3) {
277 custom.intreq = IF_AUD3;
278 amiga_do_irq(IRQ_AMIGA_AUD3, fp);
279 }
280}
281
282static void ami_int5(int irq, void *dev_id, struct pt_regs *fp)
283{
284 unsigned short ints = custom.intreqr & custom.intenar;
285
286 /* if serial receive buffer full interrupt */
287 if (ints & IF_RBF) {
288 /* acknowledge of IF_RBF must be done by the serial interrupt */
289 amiga_do_irq(IRQ_AMIGA_RBF, fp);
290 }
291
292 /* if a disk sync interrupt */
293 if (ints & IF_DSKSYN) {
294 custom.intreq = IF_DSKSYN;
295 amiga_do_irq(IRQ_AMIGA_DSKSYN, fp);
296 }
297}
298
299static void ami_int7(int irq, void *dev_id, struct pt_regs *fp)
300{
301 panic ("level 7 interrupt received\n");
302}
303
304#ifdef CONFIG_APUS
305/* The PPC irq handling links all handlers requested on the same vector
306 and executes them in a loop. Having ami_badint at the end of the chain
307 is a bad idea. */
308struct irqaction amiga_sys_irqaction[AUTO_IRQS] = {
309 { .handler = ami_badint, .name = "spurious int" },
310 { .handler = ami_int1, .name = "int1 handler" },
311 { 0, /* CIAA */ },
312 { .handler = ami_int3, .name = "int3 handler" },
313 { .handler = ami_int4, .name = "int4 handler" },
314 { .handler = ami_int5, .name = "int5 handler" },
315 { 0, /* CIAB */ },
316 { .handler = ami_int7, .name = "int7 handler" },
317};
318#else
319void (*amiga_default_handler[SYS_IRQS])(int, void *, struct pt_regs *) = {
320 ami_badint, ami_int1, ami_badint, ami_int3,
321 ami_int4, ami_int5, ami_badint, ami_int7
322};
323#endif
diff --git a/arch/ppc/amiga/amisound.c b/arch/ppc/amiga/amisound.c
new file mode 100644
index 000000000000..2b86cbef79f6
--- /dev/null
+++ b/arch/ppc/amiga/amisound.c
@@ -0,0 +1 @@
#include "../../m68k/amiga/amisound.c"
diff --git a/arch/ppc/amiga/bootinfo.c b/arch/ppc/amiga/bootinfo.c
new file mode 100644
index 000000000000..e2e965661d03
--- /dev/null
+++ b/arch/ppc/amiga/bootinfo.c
@@ -0,0 +1,80 @@
1/*
2 * arch/ppc/amiga/bootinfo.c
3 *
4 * Extracted from arch/m68k/kernel/setup.c.
5 * Should be properly generalized and put somewhere else.
6 * Jesper
7 */
8
9#include <linux/types.h>
10#include <linux/kernel.h>
11#include <linux/string.h>
12#include <linux/init.h>
13
14#include <asm/setup.h>
15#include <asm/bootinfo.h>
16
17extern char cmd_line[CL_SIZE];
18
19extern int num_memory;
20extern int m68k_realnum_memory;
21extern struct mem_info memory[NUM_MEMINFO];
22extern struct mem_info m68k_memory[NUM_MEMINFO];
23extern struct mem_info ramdisk;
24
25extern int amiga_parse_bootinfo(const struct bi_record *);
26extern int atari_parse_bootinfo(const struct bi_record *);
27extern int mac_parse_bootinfo(const struct bi_record *);
28
29void __init parse_bootinfo(const struct bi_record *record)
30{
31 while (record->tag != BI_LAST) {
32 int unknown = 0;
33 const u_long *data = record->data;
34 switch (record->tag) {
35 case BI_MACHTYPE:
36 case BI_CPUTYPE:
37 case BI_FPUTYPE:
38 case BI_MMUTYPE:
39 /* Already set up by head.S */
40 break;
41
42 case BI_MEMCHUNK:
43 if (num_memory < NUM_MEMINFO) {
44 memory[num_memory].addr = data[0];
45 memory[num_memory].size = data[1];
46 num_memory++;
47
48 /* FIXME: duplicate for m68k drivers. */
49 m68k_memory[m68k_realnum_memory].addr = data[0];
50 m68k_memory[m68k_realnum_memory].size = data[1];
51 m68k_realnum_memory++;
52 } else
53 printk("parse_bootinfo: too many memory chunks\n");
54 break;
55
56 case BI_RAMDISK:
57 ramdisk.addr = data[0];
58 ramdisk.size = data[1];
59 break;
60
61 case BI_COMMAND_LINE:
62 strlcpy(cmd_line, (const char *)data, sizeof(cmd_line));
63 break;
64
65 default:
66 if (MACH_IS_AMIGA)
67 unknown = amiga_parse_bootinfo(record);
68 else if (MACH_IS_ATARI)
69 unknown = atari_parse_bootinfo(record);
70 else if (MACH_IS_MAC)
71 unknown = mac_parse_bootinfo(record);
72 else
73 unknown = 1;
74 }
75 if (unknown)
76 printk("parse_bootinfo: unknown tag 0x%04x ignored\n",
77 record->tag);
78 record = (struct bi_record *)((u_long)record+record->size);
79 }
80}
diff --git a/arch/ppc/amiga/chipram.c b/arch/ppc/amiga/chipram.c
new file mode 100644
index 000000000000..e6ab3c6b223c
--- /dev/null
+++ b/arch/ppc/amiga/chipram.c
@@ -0,0 +1 @@
#include "../../m68k/amiga/chipram.c"
diff --git a/arch/ppc/amiga/cia.c b/arch/ppc/amiga/cia.c
new file mode 100644
index 000000000000..ad961465b6cb
--- /dev/null
+++ b/arch/ppc/amiga/cia.c
@@ -0,0 +1,178 @@
1/*
2 * arch/ppc/amiga/cia.c - CIA support
3 *
4 * Copyright (C) 1996 Roman Zippel
5 *
6 * The concept of some functions bases on the original Amiga OS function
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file COPYING in the main directory of this archive
10 * for more details.
11 */
12
13#include <linux/types.h>
14#include <linux/kernel.h>
15#include <linux/sched.h>
16#include <linux/interrupt.h>
17#include <linux/irq.h>
18#include <linux/kernel_stat.h>
19#include <linux/init.h>
20
21#include <asm/irq.h>
22#include <asm/amigahw.h>
23#include <asm/amigaints.h>
24
25struct ciabase {
26 volatile struct CIA *cia;
27 u_char icr_mask, icr_data;
28 u_short int_mask;
29 int handler_irq, cia_irq, server_irq;
30 char *name;
31} ciaa_base = {
32 &ciaa, 0, 0, IF_PORTS,
33 IRQ_AMIGA_AUTO_2, IRQ_AMIGA_CIAA,
34 IRQ_AMIGA_PORTS,
35 "CIAA handler"
36}, ciab_base = {
37 &ciab, 0, 0, IF_EXTER,
38 IRQ_AMIGA_AUTO_6, IRQ_AMIGA_CIAB,
39 IRQ_AMIGA_EXTER,
40 "CIAB handler"
41};
42
43#define CIA_SET_BASE_ADJUST_IRQ(base, irq) \
44do { \
45 if (irq >= IRQ_AMIGA_CIAB) { \
46 base = &ciab_base; \
47 irq -= IRQ_AMIGA_CIAB; \
48 } else { \
49 base = &ciaa_base; \
50 irq -= IRQ_AMIGA_CIAA; \
51 } \
52} while (0)
53
54/*
55 * Cause or clear CIA interrupts, return old interrupt status.
56 */
57
58static unsigned char cia_set_irq_private(struct ciabase *base,
59 unsigned char mask)
60{
61 u_char old;
62
63 old = (base->icr_data |= base->cia->icr);
64 if (mask & CIA_ICR_SETCLR)
65 base->icr_data |= mask;
66 else
67 base->icr_data &= ~mask;
68 if (base->icr_data & base->icr_mask)
69 custom.intreq = IF_SETCLR | base->int_mask;
70 return old & base->icr_mask;
71}
72
73unsigned char cia_set_irq(unsigned int irq, int set)
74{
75 struct ciabase *base;
76 unsigned char mask;
77
78 if (irq >= IRQ_AMIGA_CIAB)
79 mask = (1 << (irq - IRQ_AMIGA_CIAB));
80 else
81 mask = (1 << (irq - IRQ_AMIGA_CIAA));
82 mask |= (set) ? CIA_ICR_SETCLR : 0;
83
84 CIA_SET_BASE_ADJUST_IRQ(base, irq);
85
86 return cia_set_irq_private(base, mask);
87}
88
89unsigned char cia_get_irq_mask(unsigned int irq)
90{
91 struct ciabase *base;
92
93 CIA_SET_BASE_ADJUST_IRQ(base, irq);
94
95 return base->cia->icr;
96}
97
98/*
99 * Enable or disable CIA interrupts, return old interrupt mask.
100 */
101
102static unsigned char cia_able_irq_private(struct ciabase *base,
103 unsigned char mask)
104{
105 u_char old;
106
107 old = base->icr_mask;
108 base->icr_data |= base->cia->icr;
109 base->cia->icr = mask;
110 if (mask & CIA_ICR_SETCLR)
111 base->icr_mask |= mask;
112 else
113 base->icr_mask &= ~mask;
114 base->icr_mask &= CIA_ICR_ALL;
115
116 if (base->icr_data & base->icr_mask)
117 custom.intreq = IF_SETCLR | base->int_mask;
118 return old;
119}
120
121unsigned char cia_able_irq(unsigned int irq, int enable)
122{
123 struct ciabase *base;
124 unsigned char mask;
125
126 if (irq >= IRQ_AMIGA_CIAB)
127 mask = (1 << (irq - IRQ_AMIGA_CIAB));
128 else
129 mask = (1 << (irq - IRQ_AMIGA_CIAA));
130 mask |= (enable) ? CIA_ICR_SETCLR : 0;
131
132 CIA_SET_BASE_ADJUST_IRQ(base, irq);
133
134 return cia_able_irq_private(base, mask);
135}
136
137static void cia_handler(int irq, void *dev_id, struct pt_regs *fp)
138{
139 struct ciabase *base = (struct ciabase *)dev_id;
140 irq_desc_t *desc;
141 struct irqaction *action;
142 int i;
143 unsigned char ints;
144
145 irq = base->cia_irq;
146 desc = irq_desc + irq;
147 ints = cia_set_irq_private(base, CIA_ICR_ALL);
148 custom.intreq = base->int_mask;
149 for (i = 0; i < CIA_IRQS; i++, irq++) {
150 if (ints & 1) {
151 kstat_cpu(0).irqs[irq]++;
152 action = desc->action;
153 action->handler(irq, action->dev_id, fp);
154 }
155 ints >>= 1;
156 desc++;
157 }
158 amiga_do_irq_list(base->server_irq, fp);
159}
160
161void __init cia_init_IRQ(struct ciabase *base)
162{
163 extern struct irqaction amiga_sys_irqaction[AUTO_IRQS];
164 struct irqaction *action;
165
166 /* clear any pending interrupt and turn off all interrupts */
167 cia_set_irq_private(base, CIA_ICR_ALL);
168 cia_able_irq_private(base, CIA_ICR_ALL);
169
170 /* install CIA handler */
171 action = &amiga_sys_irqaction[base->handler_irq-IRQ_AMIGA_AUTO];
172 action->handler = cia_handler;
173 action->dev_id = base;
174 action->name = base->name;
175 setup_irq(base->handler_irq, &amiga_sys_irqaction[base->handler_irq-IRQ_AMIGA_AUTO]);
176
177 custom.intena = IF_SETCLR | base->int_mask;
178}
diff --git a/arch/ppc/amiga/config.c b/arch/ppc/amiga/config.c
new file mode 100644
index 000000000000..af881d7454dd
--- /dev/null
+++ b/arch/ppc/amiga/config.c
@@ -0,0 +1,962 @@
1#define m68k_debug_device debug_device
2
3/*
4 * arch/ppc/amiga/config.c
5 *
6 * Copyright (C) 1993 Hamish Macdonald
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file COPYING in the main directory of this archive
10 * for more details.
11 */
12
13/*
14 * Miscellaneous Amiga stuff
15 */
16
17#include <linux/config.h>
18#include <linux/types.h>
19#include <linux/kernel.h>
20#include <linux/mm.h>
21#include <linux/kd.h>
22#include <linux/tty.h>
23#include <linux/console.h>
24#include <linux/init.h>
25#ifdef CONFIG_ZORRO
26#include <linux/zorro.h>
27#endif
28
29#include <asm/bootinfo.h>
30#include <asm/setup.h>
31#include <asm/system.h>
32#include <asm/pgtable.h>
33#include <asm/amigahw.h>
34#include <asm/amigaints.h>
35#include <asm/irq.h>
36#include <asm/machdep.h>
37#include <asm/io.h>
38
39unsigned long powerup_PCI_present;
40unsigned long powerup_BPPCPLUS_present;
41unsigned long amiga_model;
42unsigned long amiga_eclock;
43unsigned long amiga_masterclock;
44unsigned long amiga_colorclock;
45unsigned long amiga_chipset;
46unsigned char amiga_vblank;
47unsigned char amiga_psfreq;
48struct amiga_hw_present amiga_hw_present;
49
50static char s_a500[] __initdata = "A500";
51static char s_a500p[] __initdata = "A500+";
52static char s_a600[] __initdata = "A600";
53static char s_a1000[] __initdata = "A1000";
54static char s_a1200[] __initdata = "A1200";
55static char s_a2000[] __initdata = "A2000";
56static char s_a2500[] __initdata = "A2500";
57static char s_a3000[] __initdata = "A3000";
58static char s_a3000t[] __initdata = "A3000T";
59static char s_a3000p[] __initdata = "A3000+";
60static char s_a4000[] __initdata = "A4000";
61static char s_a4000t[] __initdata = "A4000T";
62static char s_cdtv[] __initdata = "CDTV";
63static char s_cd32[] __initdata = "CD32";
64static char s_draco[] __initdata = "Draco";
65static char *amiga_models[] __initdata = {
66 s_a500, s_a500p, s_a600, s_a1000, s_a1200, s_a2000, s_a2500, s_a3000,
67 s_a3000t, s_a3000p, s_a4000, s_a4000t, s_cdtv, s_cd32, s_draco,
68};
69
70static char amiga_model_name[13] = "Amiga ";
71
72extern char m68k_debug_device[];
73
74static void amiga_sched_init(irqreturn_t (*handler)(int, void *, struct pt_regs *));
75/* amiga specific irq functions */
76extern void amiga_init_IRQ (void);
77extern void (*amiga_default_handler[]) (int, void *, struct pt_regs *);
78extern int amiga_request_irq (unsigned int irq,
79 void (*handler)(int, void *, struct pt_regs *),
80 unsigned long flags, const char *devname,
81 void *dev_id);
82extern void amiga_free_irq (unsigned int irq, void *dev_id);
83extern void amiga_enable_irq (unsigned int);
84extern void amiga_disable_irq (unsigned int);
85static void amiga_get_model(char *model);
86static int amiga_get_hardware_list(char *buffer);
87/* amiga specific timer functions */
88static unsigned long amiga_gettimeoffset (void);
89static void a3000_gettod (int *, int *, int *, int *, int *, int *);
90static void a2000_gettod (int *, int *, int *, int *, int *, int *);
91static int amiga_hwclk (int, struct hwclk_time *);
92static int amiga_set_clock_mmss (unsigned long);
93#ifdef CONFIG_AMIGA_FLOPPY
94extern void amiga_floppy_setup(char *, int *);
95#endif
96static void amiga_reset (void);
97extern void amiga_init_sound(void);
98static void amiga_savekmsg_init(void);
99static void amiga_mem_console_write(struct console *co, const char *b,
100 unsigned int count);
101void amiga_serial_console_write(struct console *co, const char *s,
102 unsigned int count);
103static void amiga_debug_init(void);
104#ifdef CONFIG_HEARTBEAT
105static void amiga_heartbeat(int on);
106#endif
107
108static struct console amiga_console_driver = {
109 .name = "debug",
110 .flags = CON_PRINTBUFFER,
111 .index = -1,
112};
113
114
115 /*
116 * Motherboard Resources present in all Amiga models
117 */
118
119static struct {
120 struct resource _ciab, _ciaa, _custom, _kickstart;
121} mb_resources = {
122// { "Ranger Memory", 0x00c00000, 0x00c7ffff },
123 ._ciab = { "CIA B", 0x00bfd000, 0x00bfdfff },
124 ._ciaa = { "CIA A", 0x00bfe000, 0x00bfefff },
125 ._custom = { "Custom I/O", 0x00dff000, 0x00dfffff },
126 ._kickstart = { "Kickstart ROM", 0x00f80000, 0x00ffffff }
127};
128
129static struct resource rtc_resource = {
130 NULL, 0x00dc0000, 0x00dcffff
131};
132
133static struct resource ram_resource[NUM_MEMINFO];
134
135
136 /*
137 * Parse an Amiga-specific record in the bootinfo
138 */
139
140int amiga_parse_bootinfo(const struct bi_record *record)
141{
142 int unknown = 0;
143 const unsigned long *data = record->data;
144
145 switch (record->tag) {
146 case BI_AMIGA_MODEL:
147 {
148 unsigned long d = *data;
149
150 powerup_PCI_present = d & 0x100;
151 amiga_model = d & 0xff;
152 }
153 break;
154
155 case BI_AMIGA_ECLOCK:
156 amiga_eclock = *data;
157 break;
158
159 case BI_AMIGA_CHIPSET:
160 amiga_chipset = *data;
161 break;
162
163 case BI_AMIGA_CHIP_SIZE:
164 amiga_chip_size = *(const int *)data;
165 break;
166
167 case BI_AMIGA_VBLANK:
168 amiga_vblank = *(const unsigned char *)data;
169 break;
170
171 case BI_AMIGA_PSFREQ:
172 amiga_psfreq = *(const unsigned char *)data;
173 break;
174
175 case BI_AMIGA_AUTOCON:
176#ifdef CONFIG_ZORRO
177 if (zorro_num_autocon < ZORRO_NUM_AUTO) {
178 const struct ConfigDev *cd = (struct ConfigDev *)data;
179 struct zorro_dev *dev = &zorro_autocon[zorro_num_autocon++];
180 dev->rom = cd->cd_Rom;
181 dev->slotaddr = cd->cd_SlotAddr;
182 dev->slotsize = cd->cd_SlotSize;
183 dev->resource.start = (unsigned long)cd->cd_BoardAddr;
184 dev->resource.end = dev->resource.start+cd->cd_BoardSize-1;
185 } else
186 printk("amiga_parse_bootinfo: too many AutoConfig devices\n");
187#endif /* CONFIG_ZORRO */
188 break;
189
190 case BI_AMIGA_SERPER:
191 /* serial port period: ignored here */
192 break;
193
194 case BI_AMIGA_PUP_BRIDGE:
195 powerup_PCI_present = *(const unsigned short *)data;
196 break;
197
198 case BI_AMIGA_BPPC_SCSI:
199 powerup_BPPCPLUS_present = *(const unsigned short *)data;
200 break;
201
202 default:
203 unknown = 1;
204 }
205 return(unknown);
206}
207
208 /*
209 * Identify builtin hardware
210 */
211
212static void __init amiga_identify(void)
213{
214 /* Fill in some default values, if necessary */
215 if (amiga_eclock == 0)
216 amiga_eclock = 709379;
217
218 memset(&amiga_hw_present, 0, sizeof(amiga_hw_present));
219
220 printk("Amiga hardware found: ");
221 if (amiga_model >= AMI_500 && amiga_model <= AMI_DRACO) {
222 printk("[%s] ", amiga_models[amiga_model-AMI_500]);
223 strcat(amiga_model_name, amiga_models[amiga_model-AMI_500]);
224 }
225
226 switch(amiga_model) {
227 case AMI_UNKNOWN:
228 goto Generic;
229
230 case AMI_600:
231 case AMI_1200:
232 AMIGAHW_SET(A1200_IDE);
233 AMIGAHW_SET(PCMCIA);
234 case AMI_500:
235 case AMI_500PLUS:
236 case AMI_1000:
237 case AMI_2000:
238 case AMI_2500:
239 AMIGAHW_SET(A2000_CLK); /* Is this correct for all models? */
240 goto Generic;
241
242 case AMI_3000:
243 case AMI_3000T:
244 AMIGAHW_SET(AMBER_FF);
245 AMIGAHW_SET(MAGIC_REKICK);
246 /* fall through */
247 case AMI_3000PLUS:
248 AMIGAHW_SET(A3000_SCSI);
249 AMIGAHW_SET(A3000_CLK);
250 AMIGAHW_SET(ZORRO3);
251 goto Generic;
252
253 case AMI_4000T:
254 AMIGAHW_SET(A4000_SCSI);
255 /* fall through */
256 case AMI_4000:
257 AMIGAHW_SET(A4000_IDE);
258 AMIGAHW_SET(A3000_CLK);
259 AMIGAHW_SET(ZORRO3);
260 goto Generic;
261
262 case AMI_CDTV:
263 case AMI_CD32:
264 AMIGAHW_SET(CD_ROM);
265 AMIGAHW_SET(A2000_CLK); /* Is this correct? */
266 goto Generic;
267
268 Generic:
269 AMIGAHW_SET(AMI_VIDEO);
270 AMIGAHW_SET(AMI_BLITTER);
271 AMIGAHW_SET(AMI_AUDIO);
272 AMIGAHW_SET(AMI_FLOPPY);
273 AMIGAHW_SET(AMI_KEYBOARD);
274 AMIGAHW_SET(AMI_MOUSE);
275 AMIGAHW_SET(AMI_SERIAL);
276 AMIGAHW_SET(AMI_PARALLEL);
277 AMIGAHW_SET(CHIP_RAM);
278 AMIGAHW_SET(PAULA);
279
280 switch(amiga_chipset) {
281 case CS_OCS:
282 case CS_ECS:
283 case CS_AGA:
284 switch (custom.deniseid & 0xf) {
285 case 0x0c:
286 AMIGAHW_SET(DENISE_HR);
287 break;
288 case 0x08:
289 AMIGAHW_SET(LISA);
290 break;
291 }
292 break;
293 default:
294 AMIGAHW_SET(DENISE);
295 break;
296 }
297 switch ((custom.vposr>>8) & 0x7f) {
298 case 0x00:
299 AMIGAHW_SET(AGNUS_PAL);
300 break;
301 case 0x10:
302 AMIGAHW_SET(AGNUS_NTSC);
303 break;
304 case 0x20:
305 case 0x21:
306 AMIGAHW_SET(AGNUS_HR_PAL);
307 break;
308 case 0x30:
309 case 0x31:
310 AMIGAHW_SET(AGNUS_HR_NTSC);
311 break;
312 case 0x22:
313 case 0x23:
314 AMIGAHW_SET(ALICE_PAL);
315 break;
316 case 0x32:
317 case 0x33:
318 AMIGAHW_SET(ALICE_NTSC);
319 break;
320 }
321 AMIGAHW_SET(ZORRO);
322 break;
323
324 case AMI_DRACO:
325 panic("No support for Draco yet");
326
327 default:
328 panic("Unknown Amiga Model");
329 }
330
331#define AMIGAHW_ANNOUNCE(name, str) \
332 if (AMIGAHW_PRESENT(name)) \
333 printk(str)
334
335 AMIGAHW_ANNOUNCE(AMI_VIDEO, "VIDEO ");
336 AMIGAHW_ANNOUNCE(AMI_BLITTER, "BLITTER ");
337 AMIGAHW_ANNOUNCE(AMBER_FF, "AMBER_FF ");
338 AMIGAHW_ANNOUNCE(AMI_AUDIO, "AUDIO ");
339 AMIGAHW_ANNOUNCE(AMI_FLOPPY, "FLOPPY ");
340 AMIGAHW_ANNOUNCE(A3000_SCSI, "A3000_SCSI ");
341 AMIGAHW_ANNOUNCE(A4000_SCSI, "A4000_SCSI ");
342 AMIGAHW_ANNOUNCE(A1200_IDE, "A1200_IDE ");
343 AMIGAHW_ANNOUNCE(A4000_IDE, "A4000_IDE ");
344 AMIGAHW_ANNOUNCE(CD_ROM, "CD_ROM ");
345 AMIGAHW_ANNOUNCE(AMI_KEYBOARD, "KEYBOARD ");
346 AMIGAHW_ANNOUNCE(AMI_MOUSE, "MOUSE ");
347 AMIGAHW_ANNOUNCE(AMI_SERIAL, "SERIAL ");
348 AMIGAHW_ANNOUNCE(AMI_PARALLEL, "PARALLEL ");
349 AMIGAHW_ANNOUNCE(A2000_CLK, "A2000_CLK ");
350 AMIGAHW_ANNOUNCE(A3000_CLK, "A3000_CLK ");
351 AMIGAHW_ANNOUNCE(CHIP_RAM, "CHIP_RAM ");
352 AMIGAHW_ANNOUNCE(PAULA, "PAULA ");
353 AMIGAHW_ANNOUNCE(DENISE, "DENISE ");
354 AMIGAHW_ANNOUNCE(DENISE_HR, "DENISE_HR ");
355 AMIGAHW_ANNOUNCE(LISA, "LISA ");
356 AMIGAHW_ANNOUNCE(AGNUS_PAL, "AGNUS_PAL ");
357 AMIGAHW_ANNOUNCE(AGNUS_NTSC, "AGNUS_NTSC ");
358 AMIGAHW_ANNOUNCE(AGNUS_HR_PAL, "AGNUS_HR_PAL ");
359 AMIGAHW_ANNOUNCE(AGNUS_HR_NTSC, "AGNUS_HR_NTSC ");
360 AMIGAHW_ANNOUNCE(ALICE_PAL, "ALICE_PAL ");
361 AMIGAHW_ANNOUNCE(ALICE_NTSC, "ALICE_NTSC ");
362 AMIGAHW_ANNOUNCE(MAGIC_REKICK, "MAGIC_REKICK ");
363 AMIGAHW_ANNOUNCE(PCMCIA, "PCMCIA ");
364 if (AMIGAHW_PRESENT(ZORRO))
365 printk("ZORRO%s ", AMIGAHW_PRESENT(ZORRO3) ? "3" : "");
366 printk("\n");
367
368#undef AMIGAHW_ANNOUNCE
369}
370
371 /*
372 * Setup the Amiga configuration info
373 */
374
375void __init config_amiga(void)
376{
377 int i;
378
379 amiga_debug_init();
380 amiga_identify();
381
382 /* Some APUS boxes may have PCI memory, but ... */
383 iomem_resource.name = "Memory";
384 for (i = 0; i < 4; i++)
385 request_resource(&iomem_resource, &((struct resource *)&mb_resources)[i]);
386
387 mach_sched_init = amiga_sched_init;
388 mach_init_IRQ = amiga_init_IRQ;
389#ifndef CONFIG_APUS
390 mach_default_handler = &amiga_default_handler;
391 mach_request_irq = amiga_request_irq;
392 mach_free_irq = amiga_free_irq;
393 enable_irq = amiga_enable_irq;
394 disable_irq = amiga_disable_irq;
395#endif
396 mach_get_model = amiga_get_model;
397 mach_get_hardware_list = amiga_get_hardware_list;
398 mach_gettimeoffset = amiga_gettimeoffset;
399 if (AMIGAHW_PRESENT(A3000_CLK)){
400 mach_gettod = a3000_gettod;
401 rtc_resource.name = "A3000 RTC";
402 request_resource(&iomem_resource, &rtc_resource);
403 }
404 else{ /* if (AMIGAHW_PRESENT(A2000_CLK)) */
405 mach_gettod = a2000_gettod;
406 rtc_resource.name = "A2000 RTC";
407 request_resource(&iomem_resource, &rtc_resource);
408 }
409
410 mach_max_dma_address = 0xffffffff; /*
411 * default MAX_DMA=0xffffffff
412 * on all machines. If we don't
413 * do so, the SCSI code will not
414 * be able to allocate any mem
415 * for transfers, unless we are
416 * dealing with a Z2 mem only
417 * system. /Jes
418 */
419
420 mach_hwclk = amiga_hwclk;
421 mach_set_clock_mmss = amiga_set_clock_mmss;
422#ifdef CONFIG_AMIGA_FLOPPY
423 mach_floppy_setup = amiga_floppy_setup;
424#endif
425 mach_reset = amiga_reset;
426#ifdef CONFIG_HEARTBEAT
427 mach_heartbeat = amiga_heartbeat;
428#endif
429
430 /* Fill in the clock values (based on the 700 kHz E-Clock) */
431 amiga_masterclock = 40*amiga_eclock; /* 28 MHz */
432 amiga_colorclock = 5*amiga_eclock; /* 3.5 MHz */
433
434 /* clear all DMA bits */
435 custom.dmacon = DMAF_ALL;
436 /* ensure that the DMA master bit is set */
437 custom.dmacon = DMAF_SETCLR | DMAF_MASTER;
438
439 /* request all RAM */
440 for (i = 0; i < m68k_num_memory; i++) {
441 ram_resource[i].name =
442 (m68k_memory[i].addr >= 0x01000000) ? "32-bit Fast RAM" :
443 (m68k_memory[i].addr < 0x00c00000) ? "16-bit Fast RAM" :
444 "16-bit Slow RAM";
445 ram_resource[i].start = m68k_memory[i].addr;
446 ram_resource[i].end = m68k_memory[i].addr+m68k_memory[i].size-1;
447 request_resource(&iomem_resource, &ram_resource[i]);
448 }
449
450 /* initialize chipram allocator */
451 amiga_chip_init ();
452
453 /* debugging using chipram */
454 if (!strcmp( m68k_debug_device, "mem" )){
455 if (!AMIGAHW_PRESENT(CHIP_RAM))
456 printk("Warning: no chipram present for debugging\n");
457 else {
458 amiga_savekmsg_init();
459 amiga_console_driver.write = amiga_mem_console_write;
460 register_console(&amiga_console_driver);
461 }
462 }
463
464 /* our beloved beeper */
465 if (AMIGAHW_PRESENT(AMI_AUDIO))
466 amiga_init_sound();
467
468 /*
469 * if it is an A3000, set the magic bit that forces
470 * a hard rekick
471 */
472 if (AMIGAHW_PRESENT(MAGIC_REKICK))
473 *(unsigned char *)ZTWO_VADDR(0xde0002) |= 0x80;
474}
475
476static unsigned short jiffy_ticks;
477
478static void __init amiga_sched_init(irqreturn_t (*timer_routine)(int, void *,
479 struct pt_regs *))
480{
481 static struct resource sched_res = {
482 "timer", 0x00bfd400, 0x00bfd5ff,
483 };
484 jiffy_ticks = (amiga_eclock+HZ/2)/HZ;
485
486 if (request_resource(&mb_resources._ciab, &sched_res))
487 printk("Cannot allocate ciab.ta{lo,hi}\n");
488 ciab.cra &= 0xC0; /* turn off timer A, continuous mode, from Eclk */
489 ciab.talo = jiffy_ticks % 256;
490 ciab.tahi = jiffy_ticks / 256;
491
492 /* install interrupt service routine for CIAB Timer A
493 *
494 * Please don't change this to use ciaa, as it interferes with the
495 * SCSI code. We'll have to take a look at this later
496 */
497 request_irq(IRQ_AMIGA_CIAB_TA, timer_routine, 0, "timer", NULL);
498 /* start timer */
499 ciab.cra |= 0x11;
500}
501
502#define TICK_SIZE 10000
503
504extern unsigned char cia_get_irq_mask(unsigned int irq);
505
506/* This is always executed with interrupts disabled. */
507static unsigned long amiga_gettimeoffset (void)
508{
509 unsigned short hi, lo, hi2;
510 unsigned long ticks, offset = 0;
511
512 /* read CIA B timer A current value */
513 hi = ciab.tahi;
514 lo = ciab.talo;
515 hi2 = ciab.tahi;
516
517 if (hi != hi2) {
518 lo = ciab.talo;
519 hi = hi2;
520 }
521
522 ticks = hi << 8 | lo;
523
524 if (ticks > jiffy_ticks / 2)
525 /* check for pending interrupt */
526 if (cia_get_irq_mask(IRQ_AMIGA_CIAB) & CIA_ICR_TA)
527 offset = 10000;
528
529 ticks = jiffy_ticks - ticks;
530 ticks = (10000 * ticks) / jiffy_ticks;
531
532 return ticks + offset;
533}
534
535static void a3000_gettod (int *yearp, int *monp, int *dayp,
536 int *hourp, int *minp, int *secp)
537{
538 volatile struct tod3000 *tod = TOD_3000;
539
540 tod->cntrl1 = TOD3000_CNTRL1_HOLD;
541
542 *secp = tod->second1 * 10 + tod->second2;
543 *minp = tod->minute1 * 10 + tod->minute2;
544 *hourp = tod->hour1 * 10 + tod->hour2;
545 *dayp = tod->day1 * 10 + tod->day2;
546 *monp = tod->month1 * 10 + tod->month2;
547 *yearp = tod->year1 * 10 + tod->year2;
548
549 tod->cntrl1 = TOD3000_CNTRL1_FREE;
550}
551
552static void a2000_gettod (int *yearp, int *monp, int *dayp,
553 int *hourp, int *minp, int *secp)
554{
555 volatile struct tod2000 *tod = TOD_2000;
556
557 tod->cntrl1 = TOD2000_CNTRL1_HOLD;
558
559 while (tod->cntrl1 & TOD2000_CNTRL1_BUSY)
560 ;
561
562 *secp = tod->second1 * 10 + tod->second2;
563 *minp = tod->minute1 * 10 + tod->minute2;
564 *hourp = (tod->hour1 & 3) * 10 + tod->hour2;
565 *dayp = tod->day1 * 10 + tod->day2;
566 *monp = tod->month1 * 10 + tod->month2;
567 *yearp = tod->year1 * 10 + tod->year2;
568
569 if (!(tod->cntrl3 & TOD2000_CNTRL3_24HMODE)){
570 if (!(tod->hour1 & TOD2000_HOUR1_PM) && *hourp == 12)
571 *hourp = 0;
572 else if ((tod->hour1 & TOD2000_HOUR1_PM) && *hourp != 12)
573 *hourp += 12;
574 }
575
576 tod->cntrl1 &= ~TOD2000_CNTRL1_HOLD;
577}
578
579static int amiga_hwclk(int op, struct hwclk_time *t)
580{
581 if (AMIGAHW_PRESENT(A3000_CLK)) {
582 volatile struct tod3000 *tod = TOD_3000;
583
584 tod->cntrl1 = TOD3000_CNTRL1_HOLD;
585
586 if (!op) { /* read */
587 t->sec = tod->second1 * 10 + tod->second2;
588 t->min = tod->minute1 * 10 + tod->minute2;
589 t->hour = tod->hour1 * 10 + tod->hour2;
590 t->day = tod->day1 * 10 + tod->day2;
591 t->wday = tod->weekday;
592 t->mon = tod->month1 * 10 + tod->month2 - 1;
593 t->year = tod->year1 * 10 + tod->year2;
594 if (t->year <= 69)
595 t->year += 100;
596 } else {
597 tod->second1 = t->sec / 10;
598 tod->second2 = t->sec % 10;
599 tod->minute1 = t->min / 10;
600 tod->minute2 = t->min % 10;
601 tod->hour1 = t->hour / 10;
602 tod->hour2 = t->hour % 10;
603 tod->day1 = t->day / 10;
604 tod->day2 = t->day % 10;
605 if (t->wday != -1)
606 tod->weekday = t->wday;
607 tod->month1 = (t->mon + 1) / 10;
608 tod->month2 = (t->mon + 1) % 10;
609 if (t->year >= 100)
610 t->year -= 100;
611 tod->year1 = t->year / 10;
612 tod->year2 = t->year % 10;
613 }
614
615 tod->cntrl1 = TOD3000_CNTRL1_FREE;
616 } else /* if (AMIGAHW_PRESENT(A2000_CLK)) */ {
617 volatile struct tod2000 *tod = TOD_2000;
618
619 tod->cntrl1 = TOD2000_CNTRL1_HOLD;
620
621 while (tod->cntrl1 & TOD2000_CNTRL1_BUSY)
622 ;
623
624 if (!op) { /* read */
625 t->sec = tod->second1 * 10 + tod->second2;
626 t->min = tod->minute1 * 10 + tod->minute2;
627 t->hour = (tod->hour1 & 3) * 10 + tod->hour2;
628 t->day = tod->day1 * 10 + tod->day2;
629 t->wday = tod->weekday;
630 t->mon = tod->month1 * 10 + tod->month2 - 1;
631 t->year = tod->year1 * 10 + tod->year2;
632 if (t->year <= 69)
633 t->year += 100;
634
635 if (!(tod->cntrl3 & TOD2000_CNTRL3_24HMODE)){
636 if (!(tod->hour1 & TOD2000_HOUR1_PM) && t->hour == 12)
637 t->hour = 0;
638 else if ((tod->hour1 & TOD2000_HOUR1_PM) && t->hour != 12)
639 t->hour += 12;
640 }
641 } else {
642 tod->second1 = t->sec / 10;
643 tod->second2 = t->sec % 10;
644 tod->minute1 = t->min / 10;
645 tod->minute2 = t->min % 10;
646 if (tod->cntrl3 & TOD2000_CNTRL3_24HMODE)
647 tod->hour1 = t->hour / 10;
648 else if (t->hour >= 12)
649 tod->hour1 = TOD2000_HOUR1_PM +
650 (t->hour - 12) / 10;
651 else
652 tod->hour1 = t->hour / 10;
653 tod->hour2 = t->hour % 10;
654 tod->day1 = t->day / 10;
655 tod->day2 = t->day % 10;
656 if (t->wday != -1)
657 tod->weekday = t->wday;
658 tod->month1 = (t->mon + 1) / 10;
659 tod->month2 = (t->mon + 1) % 10;
660 if (t->year >= 100)
661 t->year -= 100;
662 tod->year1 = t->year / 10;
663 tod->year2 = t->year % 10;
664 }
665
666 tod->cntrl1 &= ~TOD2000_CNTRL1_HOLD;
667 }
668
669 return 0;
670}
671
672static int amiga_set_clock_mmss (unsigned long nowtime)
673{
674 short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60;
675
676 if (AMIGAHW_PRESENT(A3000_CLK)) {
677 volatile struct tod3000 *tod = TOD_3000;
678
679 tod->cntrl1 = TOD3000_CNTRL1_HOLD;
680
681 tod->second1 = real_seconds / 10;
682 tod->second2 = real_seconds % 10;
683 tod->minute1 = real_minutes / 10;
684 tod->minute2 = real_minutes % 10;
685
686 tod->cntrl1 = TOD3000_CNTRL1_FREE;
687 } else /* if (AMIGAHW_PRESENT(A2000_CLK)) */ {
688 volatile struct tod2000 *tod = TOD_2000;
689
690 tod->cntrl1 = TOD2000_CNTRL1_HOLD;
691
692 while (tod->cntrl1 & TOD2000_CNTRL1_BUSY)
693 ;
694
695 tod->second1 = real_seconds / 10;
696 tod->second2 = real_seconds % 10;
697 tod->minute1 = real_minutes / 10;
698 tod->minute2 = real_minutes % 10;
699
700 tod->cntrl1 &= ~TOD2000_CNTRL1_HOLD;
701 }
702
703 return 0;
704}
705
706static NORET_TYPE void amiga_reset( void )
707 ATTRIB_NORET;
708
709static void amiga_reset (void)
710{
711 for (;;);
712}
713
714
715 /*
716 * Debugging
717 */
718
719#define SAVEKMSG_MAXMEM 128*1024
720
721#define SAVEKMSG_MAGIC1 0x53415645 /* 'SAVE' */
722#define SAVEKMSG_MAGIC2 0x4B4D5347 /* 'KMSG' */
723
724struct savekmsg {
725 unsigned long magic1; /* SAVEKMSG_MAGIC1 */
726 unsigned long magic2; /* SAVEKMSG_MAGIC2 */
727 unsigned long magicptr; /* address of magic1 */
728 unsigned long size;
729 char data[0];
730};
731
732static struct savekmsg *savekmsg = NULL;
733
734static void amiga_mem_console_write(struct console *co, const char *s,
735 unsigned int count)
736{
737 if (savekmsg->size+count <= SAVEKMSG_MAXMEM-sizeof(struct savekmsg)) {
738 memcpy(savekmsg->data+savekmsg->size, s, count);
739 savekmsg->size += count;
740 }
741}
742
743static void amiga_savekmsg_init(void)
744{
745 static struct resource debug_res = { "Debug" };
746
747 savekmsg = amiga_chip_alloc_res(SAVEKMSG_MAXMEM, &debug_res);
748 savekmsg->magic1 = SAVEKMSG_MAGIC1;
749 savekmsg->magic2 = SAVEKMSG_MAGIC2;
750 savekmsg->magicptr = virt_to_phys(savekmsg);
751 savekmsg->size = 0;
752}
753
754static void amiga_serial_putc(char c)
755{
756 custom.serdat = (unsigned char)c | 0x100;
757 mb();
758 while (!(custom.serdatr & 0x2000))
759 ;
760}
761
762void amiga_serial_console_write(struct console *co, const char *s,
763 unsigned int count)
764{
765#if 0 /* def CONFIG_KGDB */
766 /* FIXME:APUS GDB doesn't seem to like O-packages before it is
767 properly connected with the target. */
768 __gdb_output_string (s, count);
769#else
770 while (count--) {
771 if (*s == '\n')
772 amiga_serial_putc('\r');
773 amiga_serial_putc(*s++);
774 }
775#endif
776}
777
778#ifdef CONFIG_SERIAL_CONSOLE
779void amiga_serial_puts(const char *s)
780{
781 amiga_serial_console_write(NULL, s, strlen(s));
782}
783
784int amiga_serial_console_wait_key(struct console *co)
785{
786 int ch;
787
788 while (!(custom.intreqr & IF_RBF))
789 barrier();
790 ch = custom.serdatr & 0xff;
791 /* clear the interrupt, so that another character can be read */
792 custom.intreq = IF_RBF;
793 return ch;
794}
795
796void amiga_serial_gets(struct console *co, char *s, int len)
797{
798 int ch, cnt = 0;
799
800 while (1) {
801 ch = amiga_serial_console_wait_key(co);
802
803 /* Check for backspace. */
804 if (ch == 8 || ch == 127) {
805 if (cnt == 0) {
806 amiga_serial_putc('\007');
807 continue;
808 }
809 cnt--;
810 amiga_serial_puts("\010 \010");
811 continue;
812 }
813
814 /* Check for enter. */
815 if (ch == 10 || ch == 13)
816 break;
817
818 /* See if line is too long. */
819 if (cnt >= len + 1) {
820 amiga_serial_putc(7);
821 cnt--;
822 continue;
823 }
824
825 /* Store and echo character. */
826 s[cnt++] = ch;
827 amiga_serial_putc(ch);
828 }
829 /* Print enter. */
830 amiga_serial_puts("\r\n");
831 s[cnt] = 0;
832}
833#endif
834
835static void __init amiga_debug_init(void)
836{
837 if (!strcmp( m68k_debug_device, "ser" )) {
838 /* no initialization required (?) */
839 amiga_console_driver.write = amiga_serial_console_write;
840 register_console(&amiga_console_driver);
841 }
842}
843
844#ifdef CONFIG_HEARTBEAT
845static void amiga_heartbeat(int on)
846{
847 if (on)
848 ciaa.pra &= ~2;
849 else
850 ciaa.pra |= 2;
851}
852#endif
853
854 /*
855 * Amiga specific parts of /proc
856 */
857
858static void amiga_get_model(char *model)
859{
860 strcpy(model, amiga_model_name);
861}
862
863
864static int amiga_get_hardware_list(char *buffer)
865{
866 int len = 0;
867
868 if (AMIGAHW_PRESENT(CHIP_RAM))
869 len += sprintf(buffer+len, "Chip RAM:\t%ldK\n", amiga_chip_size>>10);
870 len += sprintf(buffer+len, "PS Freq:\t%dHz\nEClock Freq:\t%ldHz\n",
871 amiga_psfreq, amiga_eclock);
872 if (AMIGAHW_PRESENT(AMI_VIDEO)) {
873 char *type;
874 switch(amiga_chipset) {
875 case CS_OCS:
876 type = "OCS";
877 break;
878 case CS_ECS:
879 type = "ECS";
880 break;
881 case CS_AGA:
882 type = "AGA";
883 break;
884 default:
885 type = "Old or Unknown";
886 break;
887 }
888 len += sprintf(buffer+len, "Graphics:\t%s\n", type);
889 }
890
891#define AMIGAHW_ANNOUNCE(name, str) \
892 if (AMIGAHW_PRESENT(name)) \
893 len += sprintf (buffer+len, "\t%s\n", str)
894
895 len += sprintf (buffer + len, "Detected hardware:\n");
896
897 AMIGAHW_ANNOUNCE(AMI_VIDEO, "Amiga Video");
898 AMIGAHW_ANNOUNCE(AMI_BLITTER, "Blitter");
899 AMIGAHW_ANNOUNCE(AMBER_FF, "Amber Flicker Fixer");
900 AMIGAHW_ANNOUNCE(AMI_AUDIO, "Amiga Audio");
901 AMIGAHW_ANNOUNCE(AMI_FLOPPY, "Floppy Controller");
902 AMIGAHW_ANNOUNCE(A3000_SCSI, "SCSI Controller WD33C93 (A3000 style)");
903 AMIGAHW_ANNOUNCE(A4000_SCSI, "SCSI Controller NCR53C710 (A4000T style)");
904 AMIGAHW_ANNOUNCE(A1200_IDE, "IDE Interface (A1200 style)");
905 AMIGAHW_ANNOUNCE(A4000_IDE, "IDE Interface (A4000 style)");
906 AMIGAHW_ANNOUNCE(CD_ROM, "Internal CD ROM drive");
907 AMIGAHW_ANNOUNCE(AMI_KEYBOARD, "Keyboard");
908 AMIGAHW_ANNOUNCE(AMI_MOUSE, "Mouse Port");
909 AMIGAHW_ANNOUNCE(AMI_SERIAL, "Serial Port");
910 AMIGAHW_ANNOUNCE(AMI_PARALLEL, "Parallel Port");
911 AMIGAHW_ANNOUNCE(A2000_CLK, "Hardware Clock (A2000 style)");
912 AMIGAHW_ANNOUNCE(A3000_CLK, "Hardware Clock (A3000 style)");
913 AMIGAHW_ANNOUNCE(CHIP_RAM, "Chip RAM");
914 AMIGAHW_ANNOUNCE(PAULA, "Paula 8364");
915 AMIGAHW_ANNOUNCE(DENISE, "Denise 8362");
916 AMIGAHW_ANNOUNCE(DENISE_HR, "Denise 8373");
917 AMIGAHW_ANNOUNCE(LISA, "Lisa 8375");
918 AMIGAHW_ANNOUNCE(AGNUS_PAL, "Normal/Fat PAL Agnus 8367/8371");
919 AMIGAHW_ANNOUNCE(AGNUS_NTSC, "Normal/Fat NTSC Agnus 8361/8370");
920 AMIGAHW_ANNOUNCE(AGNUS_HR_PAL, "Fat Hires PAL Agnus 8372");
921 AMIGAHW_ANNOUNCE(AGNUS_HR_NTSC, "Fat Hires NTSC Agnus 8372");
922 AMIGAHW_ANNOUNCE(ALICE_PAL, "PAL Alice 8374");
923 AMIGAHW_ANNOUNCE(ALICE_NTSC, "NTSC Alice 8374");
924 AMIGAHW_ANNOUNCE(MAGIC_REKICK, "Magic Hard Rekick");
925 AMIGAHW_ANNOUNCE(PCMCIA, "PCMCIA Slot");
926 if (AMIGAHW_PRESENT(ZORRO))
927 len += sprintf(buffer+len, "\tZorro II%s AutoConfig: %d Expansion "
928 "Device%s\n",
929 AMIGAHW_PRESENT(ZORRO3) ? "I" : "",
930 zorro_num_autocon, zorro_num_autocon == 1 ? "" : "s");
931
932#undef AMIGAHW_ANNOUNCE
933
934 return(len);
935}
936
937#ifdef CONFIG_APUS
938int get_hardware_list(char *buffer)
939{
940 extern int get_cpuinfo(char *buffer);
941 int len = 0;
942 char model[80];
943 u_long mem;
944 int i;
945
946 if (mach_get_model)
947 mach_get_model(model);
948 else
949 strcpy(model, "Unknown PowerPC");
950
951 len += sprintf(buffer+len, "Model:\t\t%s\n", model);
952 len += get_cpuinfo(buffer+len);
953 for (mem = 0, i = 0; i < m68k_realnum_memory; i++)
954 mem += m68k_memory[i].size;
955 len += sprintf(buffer+len, "System Memory:\t%ldK\n", mem>>10);
956
957 if (mach_get_hardware_list)
958 len += mach_get_hardware_list(buffer+len);
959
960 return(len);
961}
962#endif
diff --git a/arch/ppc/amiga/ints.c b/arch/ppc/amiga/ints.c
new file mode 100644
index 000000000000..5d318e498f06
--- /dev/null
+++ b/arch/ppc/amiga/ints.c
@@ -0,0 +1,160 @@
1/*
2 * arch/ppc/amiga/ints.c
3 *
4 * Linux/m68k general interrupt handling code from arch/m68k/kernel/ints.c
5 * Needed to drive the m68k emulating IRQ hardware on the PowerUp boards.
6 */
7
8#include <linux/types.h>
9#include <linux/sched.h>
10#include <linux/kernel_stat.h>
11#include <linux/errno.h>
12#include <linux/init.h>
13#include <linux/seq_file.h>
14
15#include <asm/setup.h>
16#include <asm/system.h>
17#include <asm/irq.h>
18#include <asm/traps.h>
19#include <asm/page.h>
20#include <asm/machdep.h>
21
22/* table for system interrupt handlers */
23static irq_handler_t irq_list[SYS_IRQS];
24
25static const char *default_names[SYS_IRQS] = {
26 "spurious int", "int1 handler", "int2 handler", "int3 handler",
27 "int4 handler", "int5 handler", "int6 handler", "int7 handler"
28};
29
30/* The number of spurious interrupts */
31volatile unsigned int num_spurious;
32
33#define NUM_IRQ_NODES 100
34static irq_node_t nodes[NUM_IRQ_NODES];
35
36
37/*
38 * void init_IRQ(void)
39 *
40 * Parameters: None
41 *
42 * Returns: Nothing
43 *
44 * This function should be called during kernel startup to initialize
45 * the IRQ handling routines.
46 */
47
48__init
49void m68k_init_IRQ(void)
50{
51 int i;
52
53 for (i = 0; i < SYS_IRQS; i++) {
54 if (mach_default_handler)
55 irq_list[i].handler = (*mach_default_handler)[i];
56 irq_list[i].flags = 0;
57 irq_list[i].dev_id = NULL;
58 irq_list[i].devname = default_names[i];
59 }
60
61 for (i = 0; i < NUM_IRQ_NODES; i++)
62 nodes[i].handler = NULL;
63
64 mach_init_IRQ ();
65}
66
67irq_node_t *new_irq_node(void)
68{
69 irq_node_t *node;
70 short i;
71
72 for (node = nodes, i = NUM_IRQ_NODES-1; i >= 0; node++, i--)
73 if (!node->handler)
74 return node;
75
76 printk ("new_irq_node: out of nodes\n");
77 return NULL;
78}
79
80int sys_request_irq(unsigned int irq,
81 void (*handler)(int, void *, struct pt_regs *),
82 unsigned long flags, const char *devname, void *dev_id)
83{
84 if (irq < IRQ1 || irq > IRQ7) {
85 printk("%s: Incorrect IRQ %d from %s\n",
86 __FUNCTION__, irq, devname);
87 return -ENXIO;
88 }
89
90#if 0
91 if (!(irq_list[irq].flags & IRQ_FLG_STD)) {
92 if (irq_list[irq].flags & IRQ_FLG_LOCK) {
93 printk("%s: IRQ %d from %s is not replaceable\n",
94 __FUNCTION__, irq, irq_list[irq].devname);
95 return -EBUSY;
96 }
97 if (!(flags & IRQ_FLG_REPLACE)) {
98 printk("%s: %s can't replace IRQ %d from %s\n",
99 __FUNCTION__, devname, irq, irq_list[irq].devname);
100 return -EBUSY;
101 }
102 }
103#endif
104
105 irq_list[irq].handler = handler;
106 irq_list[irq].flags = flags;
107 irq_list[irq].dev_id = dev_id;
108 irq_list[irq].devname = devname;
109 return 0;
110}
111
112void sys_free_irq(unsigned int irq, void *dev_id)
113{
114 if (irq < IRQ1 || irq > IRQ7) {
115 printk("%s: Incorrect IRQ %d\n", __FUNCTION__, irq);
116 return;
117 }
118
119 if (irq_list[irq].dev_id != dev_id)
120 printk("%s: Removing probably wrong IRQ %d from %s\n",
121 __FUNCTION__, irq, irq_list[irq].devname);
122
123 irq_list[irq].handler = (*mach_default_handler)[irq];
124 irq_list[irq].flags = 0;
125 irq_list[irq].dev_id = NULL;
126 irq_list[irq].devname = default_names[irq];
127}
128
129asmlinkage void process_int(unsigned long vec, struct pt_regs *fp)
130{
131 if (vec >= VEC_INT1 && vec <= VEC_INT7 && !MACH_IS_BVME6000) {
132 vec -= VEC_SPUR;
133 kstat_cpu(0).irqs[vec]++;
134 irq_list[vec].handler(vec, irq_list[vec].dev_id, fp);
135 } else {
136 if (mach_process_int)
137 mach_process_int(vec, fp);
138 else
139 panic("Can't process interrupt vector %ld\n", vec);
140 return;
141 }
142}
143
144int m68k_get_irq_list(struct seq_file *p, void *v)
145{
146 int i;
147
148 /* autovector interrupts */
149 if (mach_default_handler) {
150 for (i = 0; i < SYS_IRQS; i++) {
151 seq_printf(p, "auto %2d: %10u ", i,
152 i ? kstat_cpu(0).irqs[i] : num_spurious);
153 seq_puts(p, " ");
154 seq_printf(p, "%s\n", irq_list[i].devname);
155 }
156 }
157
158 mach_get_irq_list(p, v);
159 return 0;
160}
diff --git a/arch/ppc/amiga/pcmcia.c b/arch/ppc/amiga/pcmcia.c
new file mode 100644
index 000000000000..5d29dc65093c
--- /dev/null
+++ b/arch/ppc/amiga/pcmcia.c
@@ -0,0 +1 @@
#include "../../m68k/amiga/pcmcia.c"
diff --git a/arch/ppc/amiga/time.c b/arch/ppc/amiga/time.c
new file mode 100644
index 000000000000..0073527a7036
--- /dev/null
+++ b/arch/ppc/amiga/time.c
@@ -0,0 +1,58 @@
1#include <linux/config.h> /* CONFIG_HEARTBEAT */
2#include <linux/errno.h>
3#include <linux/sched.h>
4#include <linux/kernel.h>
5#include <linux/param.h>
6#include <linux/string.h>
7#include <linux/mm.h>
8
9#include <asm/machdep.h>
10#include <asm/io.h>
11
12#include <linux/timex.h>
13
14unsigned long m68k_get_rtc_time(void)
15{
16 unsigned int year, mon, day, hour, min, sec;
17
18 extern void arch_gettod(int *year, int *mon, int *day, int *hour,
19 int *min, int *sec);
20
21 arch_gettod (&year, &mon, &day, &hour, &min, &sec);
22
23 if ((year += 1900) < 1970)
24 year += 100;
25
26 return mktime(year, mon, day, hour, min, sec);
27}
28
29int m68k_set_rtc_time(unsigned long nowtime)
30{
31 if (mach_set_clock_mmss)
32 return mach_set_clock_mmss (nowtime);
33 return -1;
34}
35
36void apus_heartbeat (void)
37{
38#ifdef CONFIG_HEARTBEAT
39 static unsigned cnt = 0, period = 0, dist = 0;
40
41 if (cnt == 0 || cnt == dist)
42 mach_heartbeat( 1 );
43 else if (cnt == 7 || cnt == dist+7)
44 mach_heartbeat( 0 );
45
46 if (++cnt > period) {
47 cnt = 0;
48 /* The hyperbolic function below modifies the heartbeat period
49 * length in dependency of the current (5min) load. It goes
50 * through the points f(0)=126, f(1)=86, f(5)=51,
51 * f(inf)->30. */
52 period = ((672<<FSHIFT)/(5*avenrun[0]+(7<<FSHIFT))) + 30;
53 dist = period / 4;
54 }
55#endif
56 /* should be made smarter */
57 ppc_md.heartbeat_count = 1;
58}
diff --git a/arch/ppc/boot/Makefile b/arch/ppc/boot/Makefile
new file mode 100644
index 000000000000..995f89bb049c
--- /dev/null
+++ b/arch/ppc/boot/Makefile
@@ -0,0 +1,34 @@
1#
2# arch/ppc/boot/Makefile
3#
4# This file is subject to the terms and conditions of the GNU General Public
5# License. See the file "COPYING" in the main directory of this archive
6# for more details.
7#
8# Copyright (C) 1994 by Linus Torvalds
9# Adapted for PowerPC by Gary Thomas
10# modified by Cort (cort@cs.nmt.edu)
11#
12
13CFLAGS += -fno-builtin -D__BOOTER__ -Iarch/$(ARCH)/boot/include
14HOSTCFLAGS += -Iarch/$(ARCH)/boot/include
15
16BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd
17
18bootdir-y := simple
19bootdir-$(CONFIG_PPC_OF) += openfirmware
20subdir-y := lib common images
21subdir-$(CONFIG_PPC_OF) += of1275
22
23# for cleaning
24subdir- += simple openfirmware
25
26hostprogs-y := $(addprefix utils/, addnote mknote hack-coff mkprep mkbugboot mktree)
27
28.PHONY: $(BOOT_TARGETS) $(bootdir-y)
29
30$(BOOT_TARGETS): $(bootdir-y)
31
32$(bootdir-y): $(addprefix $(obj)/,$(subdir-y)) \
33 $(addprefix $(obj)/,$(hostprogs-y))
34 $(Q)$(MAKE) $(build)=$(obj)/$@ $(MAKECMDGOALS)
diff --git a/arch/ppc/boot/common/Makefile b/arch/ppc/boot/common/Makefile
new file mode 100644
index 000000000000..f88d647d5dd4
--- /dev/null
+++ b/arch/ppc/boot/common/Makefile
@@ -0,0 +1,13 @@
1#
2# arch/ppc/boot/common/Makefile
3#
4# This file is subject to the terms and conditions of the GNU General Public
5# License. See the file "COPYING" in the main directory of this archive
6# for more details.
7#
8# Tom Rini January 2001
9#
10
11lib-y := string.o util.o misc-common.o \
12 serial_stub.o bootinfo.o
13lib-$(CONFIG_SERIAL_8250_CONSOLE) += ns16550.o
diff --git a/arch/ppc/boot/common/bootinfo.c b/arch/ppc/boot/common/bootinfo.c
new file mode 100644
index 000000000000..9c6e528940e9
--- /dev/null
+++ b/arch/ppc/boot/common/bootinfo.c
@@ -0,0 +1,70 @@
1/*
2 * arch/ppc/common/bootinfo.c
3 *
4 * General bootinfo record utilities
5 * Author: Randy Vinson <rvinson@mvista.com>
6 *
7 * 2002 (c) MontaVista Software, Inc. This file is licensed under the terms
8 * of the GNU General Public License version 2. This program is licensed
9 * "as is" without any warranty of any kind, whether express or implied.
10 */
11
12#include <linux/types.h>
13#include <linux/string.h>
14#include <asm/bootinfo.h>
15
16#include "nonstdio.h"
17
18static struct bi_record * birec = NULL;
19
20static struct bi_record *
21__bootinfo_build(struct bi_record *rec, unsigned long tag, unsigned long size,
22 void *data)
23{
24 /* set the tag */
25 rec->tag = tag;
26
27 /* if the caller has any data, copy it */
28 if (size)
29 memcpy(rec->data, (char *)data, size);
30
31 /* set the record size */
32 rec->size = sizeof(struct bi_record) + size;
33
34 /* advance to the next available space */
35 rec = (struct bi_record *)((unsigned long)rec + rec->size);
36
37 return rec;
38}
39
40void
41bootinfo_init(struct bi_record *rec)
42{
43
44 /* save start of birec area */
45 birec = rec;
46
47 /* create an empty list */
48 rec = __bootinfo_build(rec, BI_FIRST, 0, NULL);
49 (void) __bootinfo_build(rec, BI_LAST, 0, NULL);
50
51}
52
53void
54bootinfo_append(unsigned long tag, unsigned long size, void * data)
55{
56
57 struct bi_record *rec = birec;
58
59 /* paranoia */
60 if ((rec == NULL) || (rec->tag != BI_FIRST))
61 return;
62
63 /* find the last entry in the list */
64 while (rec->tag != BI_LAST)
65 rec = (struct bi_record *)((ulong)rec + rec->size);
66
67 /* overlay BI_LAST record with new one and tag on a new BI_LAST */
68 rec = __bootinfo_build(rec, tag, size, data);
69 (void) __bootinfo_build(rec, BI_LAST, 0, NULL);
70}
diff --git a/arch/ppc/boot/common/crt0.S b/arch/ppc/boot/common/crt0.S
new file mode 100644
index 000000000000..4d31b824bbd1
--- /dev/null
+++ b/arch/ppc/boot/common/crt0.S
@@ -0,0 +1,81 @@
1/* Copyright (c) 1997 Paul Mackerras <paulus@cs.anu.edu.au>
2 * Initial Power Macintosh COFF version.
3 * Copyright (c) 1999 Grant Erickson <grant@lcse.umn.edu>
4 * Modifications for IBM PowerPC 400-class processor evaluation
5 * boards.
6 *
7 * Module name: crt0.S
8 *
9 * Description:
10 * Boot loader execution entry point. Clears out .bss section as per
11 * ANSI C requirements. Invalidates and flushes the caches over the
12 * range covered by the boot loader's .text section. Sets up a stack
13 * below the .text section entry point.
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version
18 * 2 of the License, or (at your option) any later version.
19 */
20
21#include <linux/config.h>
22#include <asm/ppc_asm.h>
23
24 .text
25
26 .globl _start
27_start:
28#ifdef XCOFF
29 .long __start,0,0
30
31 .globl __start
32__start:
33#endif
34
35 ## Flush and invalidate the caches for the range in memory covering
36 ## the .text section of the boot loader
37
38 lis r9,_start@h # r9 = &_start
39 lis r8,_etext@ha #
40 addi r8,r8,_etext@l # r8 = &_etext
413: dcbf r0,r9 # Flush the data cache
42 icbi r0,r9 # Invalidate the instruction cache
43 addi r9,r9,0x10 # Increment by one cache line
44 cmplw cr0,r9,r8 # Are we at the end yet?
45 blt 3b # No, keep flushing and invalidating
46 sync # sync ; isync after flushing the icache
47 isync
48
49 ## Clear out the BSS as per ANSI C requirements
50
51 lis r7,_end@ha
52 addi r7,r7,_end@l # r7 = &_end
53 lis r8,__bss_start@ha #
54 addi r8,r8,__bss_start@l # r8 = &_bss_start
55
56 ## Determine how large an area, in number of words, to clear
57
58 subf r7,r8,r7 # r7 = &_end - &_bss_start + 1
59 addi r7,r7,3 # r7 += 3
60 srwi. r7,r7,2 # r7 = size in words.
61 beq 2f # If the size is zero, do not bother
62 addi r8,r8,-4 # r8 -= 4
63 mtctr r7 # SPRN_CTR = number of words to clear
64 li r0,0 # r0 = 0
651: stwu r0,4(r8) # Clear out a word
66 bdnz 1b # If we are not done yet, keep clearing
672:
68
69#ifdef CONFIG_40x
70 ## Set up the stack
71
72 lis r9,_start@h # r9 = &_start (text section entry)
73 ori r9,r9,_start@l
74 subi r1,r9,64 # Start the stack 64 bytes below _start
75 clrrwi r1,r1,4 # Make sure it is aligned on 16 bytes.
76 li r0,0
77 stwu r0,-16(r1)
78 mtlr r9
79#endif
80
81 b start # All done, start the real work.
diff --git a/arch/ppc/boot/common/misc-common.c b/arch/ppc/boot/common/misc-common.c
new file mode 100644
index 000000000000..e79e6b3f276e
--- /dev/null
+++ b/arch/ppc/boot/common/misc-common.c
@@ -0,0 +1,553 @@
1/*
2 * arch/ppc/boot/common/misc-common.c
3 *
4 * Misc. bootloader code (almost) all platforms can use
5 *
6 * Author: Johnnie Peters <jpeters@mvista.com>
7 * Editor: Tom Rini <trini@mvista.com>
8 *
9 * Derived from arch/ppc/boot/prep/misc.c
10 *
11 * 2000-2001 (c) MontaVista, Software, Inc. This file is licensed under
12 * the terms of the GNU General Public License version 2. This program
13 * is licensed "as is" without any warranty of any kind, whether express
14 * or implied.
15 */
16
17#include <stdarg.h> /* for va_ bits */
18#include <linux/config.h>
19#include <linux/string.h>
20#include <linux/zlib.h>
21#include "nonstdio.h"
22
23/* If we're on a PReP, assume we have a keyboard controller
24 * Also note, if we're not PReP, we assume you are a serial
25 * console - Tom */
26#if defined(CONFIG_PPC_PREP) && defined(CONFIG_VGA_CONSOLE)
27extern void cursor(int x, int y);
28extern void scroll(void);
29extern char *vidmem;
30extern int lines, cols;
31extern int orig_x, orig_y;
32extern int keyb_present;
33extern int CRT_tstc(void);
34extern int CRT_getc(void);
35#else
36int cursor(int x, int y) {return 0;}
37void scroll(void) {}
38char vidmem[1];
39#define lines 0
40#define cols 0
41int orig_x = 0;
42int orig_y = 0;
43#define keyb_present 0
44int CRT_tstc(void) {return 0;}
45int CRT_getc(void) {return 0;}
46#endif
47
48extern char *avail_ram;
49extern char *end_avail;
50extern char _end[];
51
52void puts(const char *);
53void putc(const char c);
54void puthex(unsigned long val);
55void gunzip(void *, int, unsigned char *, int *);
56static int _cvt(unsigned long val, char *buf, long radix, char *digits);
57
58void _vprintk(void(*putc)(const char), const char *fmt0, va_list ap);
59unsigned char *ISA_io = NULL;
60
61#if defined(CONFIG_SERIAL_CPM_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) \
62 || defined(CONFIG_SERIAL_MPC52xx_CONSOLE) \
63 || defined(CONFIG_SERIAL_MPSC_CONSOLE)
64extern unsigned long com_port;
65
66extern int serial_tstc(unsigned long com_port);
67extern unsigned char serial_getc(unsigned long com_port);
68extern void serial_putc(unsigned long com_port, unsigned char c);
69#endif
70
71void pause(void)
72{
73 puts("pause\n");
74}
75
76void exit(void)
77{
78 puts("exit\n");
79 while(1);
80}
81
82int tstc(void)
83{
84#if defined(CONFIG_SERIAL_CPM_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) \
85 || defined(CONFIG_SERIAL_MPC52xx_CONSOLE) \
86 || defined(CONFIG_SERIAL_MPSC_CONSOLE)
87 if(keyb_present)
88 return (CRT_tstc() || serial_tstc(com_port));
89 else
90 return (serial_tstc(com_port));
91#else
92 return CRT_tstc();
93#endif
94}
95
96int getc(void)
97{
98 while (1) {
99#if defined(CONFIG_SERIAL_CPM_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) \
100 || defined(CONFIG_SERIAL_MPC52xx_CONSOLE) \
101 || defined(CONFIG_SERIAL_MPSC_CONSOLE)
102 if (serial_tstc(com_port))
103 return (serial_getc(com_port));
104#endif /* serial console */
105 if (keyb_present)
106 if(CRT_tstc())
107 return (CRT_getc());
108 }
109}
110
111void
112putc(const char c)
113{
114 int x,y;
115
116#if defined(CONFIG_SERIAL_CPM_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) \
117 || defined(CONFIG_SERIAL_MPC52xx_CONSOLE) \
118 || defined(CONFIG_SERIAL_MPSC_CONSOLE)
119 serial_putc(com_port, c);
120 if ( c == '\n' )
121 serial_putc(com_port, '\r');
122#endif /* serial console */
123
124 x = orig_x;
125 y = orig_y;
126
127 if ( c == '\n' ) {
128 x = 0;
129 if ( ++y >= lines ) {
130 scroll();
131 y--;
132 }
133 } else if (c == '\r') {
134 x = 0;
135 } else if (c == '\b') {
136 if (x > 0) {
137 x--;
138 }
139 } else {
140 vidmem [ ( x + cols * y ) * 2 ] = c;
141 if ( ++x >= cols ) {
142 x = 0;
143 if ( ++y >= lines ) {
144 scroll();
145 y--;
146 }
147 }
148 }
149
150 cursor(x, y);
151
152 orig_x = x;
153 orig_y = y;
154}
155
156void puts(const char *s)
157{
158 int x,y;
159 char c;
160
161 x = orig_x;
162 y = orig_y;
163
164 while ( ( c = *s++ ) != '\0' ) {
165#if defined(CONFIG_SERIAL_CPM_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) \
166 || defined(CONFIG_SERIAL_MPC52xx_CONSOLE) \
167 || defined(CONFIG_SERIAL_MPSC_CONSOLE)
168 serial_putc(com_port, c);
169 if ( c == '\n' ) serial_putc(com_port, '\r');
170#endif /* serial console */
171
172 if ( c == '\n' ) {
173 x = 0;
174 if ( ++y >= lines ) {
175 scroll();
176 y--;
177 }
178 } else if (c == '\b') {
179 if (x > 0) {
180 x--;
181 }
182 } else {
183 vidmem [ ( x + cols * y ) * 2 ] = c;
184 if ( ++x >= cols ) {
185 x = 0;
186 if ( ++y >= lines ) {
187 scroll();
188 y--;
189 }
190 }
191 }
192 }
193
194 cursor(x, y);
195
196 orig_x = x;
197 orig_y = y;
198}
199
200void error(char *x)
201{
202 puts("\n\n");
203 puts(x);
204 puts("\n\n -- System halted");
205
206 while(1); /* Halt */
207}
208
209static void *zalloc(unsigned size)
210{
211 void *p = avail_ram;
212
213 size = (size + 7) & -8;
214 avail_ram += size;
215 if (avail_ram > end_avail) {
216 puts("oops... out of memory\n");
217 pause();
218 }
219 return p;
220}
221
222#define HEAD_CRC 2
223#define EXTRA_FIELD 4
224#define ORIG_NAME 8
225#define COMMENT 0x10
226#define RESERVED 0xe0
227
228void gunzip(void *dst, int dstlen, unsigned char *src, int *lenp)
229{
230 z_stream s;
231 int r, i, flags;
232
233 /* skip header */
234 i = 10;
235 flags = src[3];
236 if (src[2] != Z_DEFLATED || (flags & RESERVED) != 0) {
237 puts("bad gzipped data\n");
238 exit();
239 }
240 if ((flags & EXTRA_FIELD) != 0)
241 i = 12 + src[10] + (src[11] << 8);
242 if ((flags & ORIG_NAME) != 0)
243 while (src[i++] != 0)
244 ;
245 if ((flags & COMMENT) != 0)
246 while (src[i++] != 0)
247 ;
248 if ((flags & HEAD_CRC) != 0)
249 i += 2;
250 if (i >= *lenp) {
251 puts("gunzip: ran out of data in header\n");
252 exit();
253 }
254
255 /* Initialize ourself. */
256 s.workspace = zalloc(zlib_inflate_workspacesize());
257 r = zlib_inflateInit2(&s, -MAX_WBITS);
258 if (r != Z_OK) {
259 puts("zlib_inflateInit2 returned "); puthex(r); puts("\n");
260 exit();
261 }
262 s.next_in = src + i;
263 s.avail_in = *lenp - i;
264 s.next_out = dst;
265 s.avail_out = dstlen;
266 r = zlib_inflate(&s, Z_FINISH);
267 if (r != Z_OK && r != Z_STREAM_END) {
268 puts("inflate returned "); puthex(r); puts("\n");
269 exit();
270 }
271 *lenp = s.next_out - (unsigned char *) dst;
272 zlib_inflateEnd(&s);
273}
274
275void
276puthex(unsigned long val)
277{
278
279 unsigned char buf[10];
280 int i;
281 for (i = 7; i >= 0; i--)
282 {
283 buf[i] = "0123456789ABCDEF"[val & 0x0F];
284 val >>= 4;
285 }
286 buf[8] = '\0';
287 puts(buf);
288}
289
290#define FALSE 0
291#define TRUE 1
292
293void
294_printk(char const *fmt, ...)
295{
296 va_list ap;
297
298 va_start(ap, fmt);
299 _vprintk(putc, fmt, ap);
300 va_end(ap);
301 return;
302}
303
304#define is_digit(c) ((c >= '0') && (c <= '9'))
305
306void
307_vprintk(void(*putc)(const char), const char *fmt0, va_list ap)
308{
309 char c, sign, *cp = 0;
310 int left_prec, right_prec, zero_fill, length = 0, pad, pad_on_right;
311 char buf[32];
312 long val;
313 while ((c = *fmt0++))
314 {
315 if (c == '%')
316 {
317 c = *fmt0++;
318 left_prec = right_prec = pad_on_right = 0;
319 if (c == '-')
320 {
321 c = *fmt0++;
322 pad_on_right++;
323 }
324 if (c == '0')
325 {
326 zero_fill = TRUE;
327 c = *fmt0++;
328 } else
329 {
330 zero_fill = FALSE;
331 }
332 while (is_digit(c))
333 {
334 left_prec = (left_prec * 10) + (c - '0');
335 c = *fmt0++;
336 }
337 if (c == '.')
338 {
339 c = *fmt0++;
340 zero_fill++;
341 while (is_digit(c))
342 {
343 right_prec = (right_prec * 10) + (c - '0');
344 c = *fmt0++;
345 }
346 } else
347 {
348 right_prec = left_prec;
349 }
350 sign = '\0';
351 switch (c)
352 {
353 case 'd':
354 case 'x':
355 case 'X':
356 val = va_arg(ap, long);
357 switch (c)
358 {
359 case 'd':
360 if (val < 0)
361 {
362 sign = '-';
363 val = -val;
364 }
365 length = _cvt(val, buf, 10, "0123456789");
366 break;
367 case 'x':
368 length = _cvt(val, buf, 16, "0123456789abcdef");
369 break;
370 case 'X':
371 length = _cvt(val, buf, 16, "0123456789ABCDEF");
372 break;
373 }
374 cp = buf;
375 break;
376 case 's':
377 cp = va_arg(ap, char *);
378 length = strlen(cp);
379 break;
380 case 'c':
381 c = va_arg(ap, long /*char*/);
382 (*putc)(c);
383 continue;
384 default:
385 (*putc)('?');
386 }
387 pad = left_prec - length;
388 if (sign != '\0')
389 {
390 pad--;
391 }
392 if (zero_fill)
393 {
394 c = '0';
395 if (sign != '\0')
396 {
397 (*putc)(sign);
398 sign = '\0';
399 }
400 } else
401 {
402 c = ' ';
403 }
404 if (!pad_on_right)
405 {
406 while (pad-- > 0)
407 {
408 (*putc)(c);
409 }
410 }
411 if (sign != '\0')
412 {
413 (*putc)(sign);
414 }
415 while (length-- > 0)
416 {
417 (*putc)(c = *cp++);
418 if (c == '\n')
419 {
420 (*putc)('\r');
421 }
422 }
423 if (pad_on_right)
424 {
425 while (pad-- > 0)
426 {
427 (*putc)(c);
428 }
429 }
430 } else
431 {
432 (*putc)(c);
433 if (c == '\n')
434 {
435 (*putc)('\r');
436 }
437 }
438 }
439}
440
441int
442_cvt(unsigned long val, char *buf, long radix, char *digits)
443{
444 char temp[80];
445 char *cp = temp;
446 int length = 0;
447 if (val == 0)
448 { /* Special case */
449 *cp++ = '0';
450 } else
451 while (val)
452 {
453 *cp++ = digits[val % radix];
454 val /= radix;
455 }
456 while (cp != temp)
457 {
458 *buf++ = *--cp;
459 length++;
460 }
461 *buf = '\0';
462 return (length);
463}
464
465void
466_dump_buf_with_offset(unsigned char *p, int s, unsigned char *base)
467{
468 int i, c;
469 if ((unsigned int)s > (unsigned int)p)
470 {
471 s = (unsigned int)s - (unsigned int)p;
472 }
473 while (s > 0)
474 {
475 if (base)
476 {
477 _printk("%06X: ", (int)p - (int)base);
478 } else
479 {
480 _printk("%06X: ", p);
481 }
482 for (i = 0; i < 16; i++)
483 {
484 if (i < s)
485 {
486 _printk("%02X", p[i] & 0xFF);
487 } else
488 {
489 _printk(" ");
490 }
491 if ((i % 2) == 1) _printk(" ");
492 if ((i % 8) == 7) _printk(" ");
493 }
494 _printk(" |");
495 for (i = 0; i < 16; i++)
496 {
497 if (i < s)
498 {
499 c = p[i] & 0xFF;
500 if ((c < 0x20) || (c >= 0x7F)) c = '.';
501 } else
502 {
503 c = ' ';
504 }
505 _printk("%c", c);
506 }
507 _printk("|\n");
508 s -= 16;
509 p += 16;
510 }
511}
512
513void
514_dump_buf(unsigned char *p, int s)
515{
516 _printk("\n");
517 _dump_buf_with_offset(p, s, 0);
518}
519
520/* Very simple inb/outb routines. We declare ISA_io to be 0 above, and
521 * then modify it on platforms which need to. We do it like this
522 * because on some platforms we give inb/outb an exact location, and
523 * on others it's an offset from a given location. -- Tom
524 */
525
526void ISA_init(unsigned long base)
527{
528 ISA_io = (unsigned char *)base;
529}
530
531void
532outb(int port, unsigned char val)
533{
534 /* Ensure I/O operations complete */
535 __asm__ volatile("eieio");
536 ISA_io[port] = val;
537}
538
539unsigned char
540inb(int port)
541{
542 /* Ensure I/O operations complete */
543 __asm__ volatile("eieio");
544 return (ISA_io[port]);
545}
546
547/*
548 * Local variables:
549 * c-indent-level: 8
550 * c-basic-offset: 8
551 * tab-width: 8
552 * End:
553 */
diff --git a/arch/ppc/boot/common/ns16550.c b/arch/ppc/boot/common/ns16550.c
new file mode 100644
index 000000000000..9017c547a6f6
--- /dev/null
+++ b/arch/ppc/boot/common/ns16550.c
@@ -0,0 +1,99 @@
1/*
2 * COM1 NS16550 support
3 */
4
5#include <linux/config.h>
6#include <linux/types.h>
7#include <linux/serial.h>
8#include <linux/serial_reg.h>
9#include <asm/serial.h>
10
11#include "nonstdio.h"
12#include "serial.h"
13
14#define SERIAL_BAUD 9600
15
16extern unsigned long ISA_io;
17
18static struct serial_state rs_table[RS_TABLE_SIZE] = {
19 SERIAL_PORT_DFNS /* Defined in <asm/serial.h> */
20};
21
22static int shift;
23
24unsigned long serial_init(int chan, void *ignored)
25{
26 unsigned long com_port;
27 unsigned char lcr, dlm;
28
29 /* We need to find out which type io we're expecting. If it's
30 * 'SERIAL_IO_PORT', we get an offset from the isa_io_base.
31 * If it's 'SERIAL_IO_MEM', we can the exact location. -- Tom */
32 switch (rs_table[chan].io_type) {
33 case SERIAL_IO_PORT:
34 com_port = rs_table[chan].port;
35 break;
36 case SERIAL_IO_MEM:
37 com_port = (unsigned long)rs_table[chan].iomem_base;
38 break;
39 default:
40 /* We can't deal with it. */
41 return -1;
42 }
43
44 /* How far apart the registers are. */
45 shift = rs_table[chan].iomem_reg_shift;
46
47 /* save the LCR */
48 lcr = inb(com_port + (UART_LCR << shift));
49 /* Access baud rate */
50 outb(com_port + (UART_LCR << shift), 0x80);
51 dlm = inb(com_port + (UART_DLM << shift));
52 /*
53 * Test if serial port is unconfigured.
54 * We assume that no-one uses less than 110 baud or
55 * less than 7 bits per character these days.
56 * -- paulus.
57 */
58
59 if ((dlm <= 4) && (lcr & 2))
60 /* port is configured, put the old LCR back */
61 outb(com_port + (UART_LCR << shift), lcr);
62 else {
63 /* Input clock. */
64 outb(com_port + (UART_DLL << shift),
65 (BASE_BAUD / SERIAL_BAUD) & 0xFF);
66 outb(com_port + (UART_DLM << shift),
67 (BASE_BAUD / SERIAL_BAUD) >> 8);
68 /* 8 data, 1 stop, no parity */
69 outb(com_port + (UART_LCR << shift), 0x03);
70 /* RTS/DTR */
71 outb(com_port + (UART_MCR << shift), 0x03);
72 }
73 /* Clear & enable FIFOs */
74 outb(com_port + (UART_FCR << shift), 0x07);
75
76 return (com_port);
77}
78
79void
80serial_putc(unsigned long com_port, unsigned char c)
81{
82 while ((inb(com_port + (UART_LSR << shift)) & UART_LSR_THRE) == 0)
83 ;
84 outb(com_port, c);
85}
86
87unsigned char
88serial_getc(unsigned long com_port)
89{
90 while ((inb(com_port + (UART_LSR << shift)) & UART_LSR_DR) == 0)
91 ;
92 return inb(com_port);
93}
94
95int
96serial_tstc(unsigned long com_port)
97{
98 return ((inb(com_port + (UART_LSR << shift)) & UART_LSR_DR) != 0);
99}
diff --git a/arch/ppc/boot/common/serial_stub.c b/arch/ppc/boot/common/serial_stub.c
new file mode 100644
index 000000000000..03dfaa01fa63
--- /dev/null
+++ b/arch/ppc/boot/common/serial_stub.c
@@ -0,0 +1,23 @@
1/*
2 * arch/ppc/boot/common/serial_stub.c
3 *
4 * This is a few stub routines to make the boot code cleaner looking when
5 * there is no serial port support doesn't need to be closed, for example.
6 *
7 * Author: Tom Rini <trini@mvista.com>
8 *
9 * 2003 (c) MontaVista, Software, Inc. This file is licensed under the terms
10 * of the GNU General Public License version 2. This program is licensed "as
11 * is" without any warranty of any kind, whether express or implied.
12 */
13
14unsigned long __attribute__ ((weak))
15serial_init(int chan, void *ignored)
16{
17 return 0;
18}
19
20void __attribute__ ((weak))
21serial_close(unsigned long com_port)
22{
23}
diff --git a/arch/ppc/boot/common/string.S b/arch/ppc/boot/common/string.S
new file mode 100644
index 000000000000..8016e43c4771
--- /dev/null
+++ b/arch/ppc/boot/common/string.S
@@ -0,0 +1,150 @@
1/*
2 * String handling functions for PowerPC.
3 *
4 * Copyright (C) 1996 Paul Mackerras.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11#define r0 0
12#define r3 3
13#define r4 4
14#define r5 5
15#define r6 6
16#define r7 7
17#define r8 8
18
19 .globl strlen
20strlen:
21 addi r4,r3,-1
221: lbzu r0,1(r4)
23 cmpwi 0,r0,0
24 bne 1b
25 subf r3,r3,r4
26 blr
27
28 .globl memset
29memset:
30 rlwimi r4,r4,8,16,23
31 rlwimi r4,r4,16,0,15
32 addi r6,r3,-4
33 cmplwi 0,r5,4
34 blt 7f
35 stwu r4,4(r6)
36 beqlr
37 andi. r0,r6,3
38 add r5,r0,r5
39 subf r6,r0,r6
40 rlwinm r0,r5,32-2,2,31
41 mtctr r0
42 bdz 6f
431: stwu r4,4(r6)
44 bdnz 1b
456: andi. r5,r5,3
467: cmpwi 0,r5,0
47 beqlr
48 mtctr r5
49 addi r6,r6,3
508: stbu r4,1(r6)
51 bdnz 8b
52 blr
53
54 .globl memmove
55memmove:
56 cmplw 0,r3,r4
57 bgt backwards_memcpy
58 /* fall through */
59
60 .globl memcpy
61memcpy:
62 rlwinm. r7,r5,32-3,3,31 /* r0 = r5 >> 3 */
63 addi r6,r3,-4
64 addi r4,r4,-4
65 beq 2f /* if less than 8 bytes to do */
66 andi. r0,r6,3 /* get dest word aligned */
67 mtctr r7
68 bne 5f
691: lwz r7,4(r4)
70 lwzu r8,8(r4)
71 stw r7,4(r6)
72 stwu r8,8(r6)
73 bdnz 1b
74 andi. r5,r5,7
752: cmplwi 0,r5,4
76 blt 3f
77 lwzu r0,4(r4)
78 addi r5,r5,-4
79 stwu r0,4(r6)
803: cmpwi 0,r5,0
81 beqlr
82 mtctr r5
83 addi r4,r4,3
84 addi r6,r6,3
854: lbzu r0,1(r4)
86 stbu r0,1(r6)
87 bdnz 4b
88 blr
895: subfic r0,r0,4
90 mtctr r0
916: lbz r7,4(r4)
92 addi r4,r4,1
93 stb r7,4(r6)
94 addi r6,r6,1
95 bdnz 6b
96 subf r5,r0,r5
97 rlwinm. r7,r5,32-3,3,31
98 beq 2b
99 mtctr r7
100 b 1b
101
102 .globl backwards_memcpy
103backwards_memcpy:
104 rlwinm. r7,r5,32-3,3,31 /* r0 = r5 >> 3 */
105 add r6,r3,r5
106 add r4,r4,r5
107 beq 2f
108 andi. r0,r6,3
109 mtctr r7
110 bne 5f
1111: lwz r7,-4(r4)
112 lwzu r8,-8(r4)
113 stw r7,-4(r6)
114 stwu r8,-8(r6)
115 bdnz 1b
116 andi. r5,r5,7
1172: cmplwi 0,r5,4
118 blt 3f
119 lwzu r0,-4(r4)
120 subi r5,r5,4
121 stwu r0,-4(r6)
1223: cmpwi 0,r5,0
123 beqlr
124 mtctr r5
1254: lbzu r0,-1(r4)
126 stbu r0,-1(r6)
127 bdnz 4b
128 blr
1295: mtctr r0
1306: lbzu r7,-1(r4)
131 stbu r7,-1(r6)
132 bdnz 6b
133 subf r5,r0,r5
134 rlwinm. r7,r5,32-3,3,31
135 beq 2b
136 mtctr r7
137 b 1b
138
139 .globl memcmp
140memcmp:
141 cmpwi 0,r5,0
142 blelr
143 mtctr r5
144 addi r6,r3,-1
145 addi r4,r4,-1
1461: lbzu r3,1(r6)
147 lbzu r0,1(r4)
148 subf. r3,r0,r3
149 bdnzt 2,1b
150 blr
diff --git a/arch/ppc/boot/common/util.S b/arch/ppc/boot/common/util.S
new file mode 100644
index 000000000000..47e641455bc5
--- /dev/null
+++ b/arch/ppc/boot/common/util.S
@@ -0,0 +1,293 @@
1/*
2 * arch/ppc/boot/common/util.S
3 *
4 * Useful bootup functions, which are more easily done in asm than C.
5 *
6 * NOTE: Be very very careful about the registers you use here.
7 * We don't follow any ABI calling convention among the
8 * assembler functions that call each other, especially early
9 * in the initialization. Please preserve at least r3 and r4
10 * for these early functions, as they often contain information
11 * passed from boot roms into the C decompress function.
12 *
13 * Author: Tom Rini
14 * trini@mvista.com
15 * Derived from arch/ppc/boot/prep/head.S (Cort Dougan, many others).
16 *
17 * 2001-2004 (c) MontaVista, Software, Inc. This file is licensed under
18 * the terms of the GNU General Public License version 2. This program
19 * is licensed "as is" without any warranty of any kind, whether express
20 * or implied.
21 */
22
23#include <asm/processor.h>
24#include <asm/cache.h>
25#include <asm/ppc_asm.h>
26
27
28 .text
29
30#ifdef CONFIG_6xx
31 .globl disable_6xx_mmu
32disable_6xx_mmu:
33 /* Establish default MSR value, exception prefix 0xFFF.
34 * If necessary, this function must fix up the LR if we
35 * return to a different address space once the MMU is
36 * disabled.
37 */
38 li r8,MSR_IP|MSR_FP
39 mtmsr r8
40 isync
41
42 /* Test for a 601 */
43 mfpvr r10
44 srwi r10,r10,16
45 cmpwi 0,r10,1 /* 601 ? */
46 beq .clearbats_601
47
48 /* Clear BATs */
49 li r8,0
50 mtspr SPRN_DBAT0U,r8
51 mtspr SPRN_DBAT0L,r8
52 mtspr SPRN_DBAT1U,r8
53 mtspr SPRN_DBAT1L,r8
54 mtspr SPRN_DBAT2U,r8
55 mtspr SPRN_DBAT2L,r8
56 mtspr SPRN_DBAT3U,r8
57 mtspr SPRN_DBAT3L,r8
58.clearbats_601:
59 mtspr SPRN_IBAT0U,r8
60 mtspr SPRN_IBAT0L,r8
61 mtspr SPRN_IBAT1U,r8
62 mtspr SPRN_IBAT1L,r8
63 mtspr SPRN_IBAT2U,r8
64 mtspr SPRN_IBAT2L,r8
65 mtspr SPRN_IBAT3U,r8
66 mtspr SPRN_IBAT3L,r8
67 isync
68 sync
69 sync
70
71 /* Set segment registers */
72 li r8,16 /* load up segment register values */
73 mtctr r8 /* for context 0 */
74 lis r8,0x2000 /* Ku = 1, VSID = 0 */
75 li r10,0
763: mtsrin r8,r10
77 addi r8,r8,0x111 /* increment VSID */
78 addis r10,r10,0x1000 /* address of next segment */
79 bdnz 3b
80 blr
81
82 .globl disable_6xx_l1cache
83disable_6xx_l1cache:
84 /* Enable, invalidate and then disable the L1 icache/dcache. */
85 li r8,0
86 ori r8,r8,(HID0_ICE|HID0_DCE|HID0_ICFI|HID0_DCI)
87 mfspr r11,SPRN_HID0
88 or r11,r11,r8
89 andc r10,r11,r8
90 isync
91 mtspr SPRN_HID0,r8
92 sync
93 isync
94 mtspr SPRN_HID0,r10
95 sync
96 isync
97 blr
98#endif
99
100 .globl _setup_L2CR
101_setup_L2CR:
102/*
103 * We should be skipping this section on CPUs where this results in an
104 * illegal instruction. If not, please send trini@kernel.crashing.org
105 * the PVR of your CPU.
106 */
107 /* Invalidate/disable L2 cache */
108 sync
109 isync
110 mfspr r8,SPRN_L2CR
111 rlwinm r8,r8,0,1,31
112 oris r8,r8,L2CR_L2I@h
113 sync
114 isync
115 mtspr SPRN_L2CR,r8
116 sync
117 isync
118
119 /* Wait for the invalidation to complete */
120 mfspr r8,SPRN_PVR
121 srwi r8,r8,16
122 cmplwi cr0,r8,0x8000 /* 7450 */
123 cmplwi cr1,r8,0x8001 /* 7455 */
124 cmplwi cr2,r8,0x8002 /* 7457 */
125 cror 4*cr0+eq,4*cr0+eq,4*cr1+eq /* Now test if any are true. */
126 cror 4*cr0+eq,4*cr0+eq,4*cr2+eq
127 bne 2f
128
1291: mfspr r8,SPRN_L2CR /* On 745x, poll L2I bit (bit 10) */
130 rlwinm. r9,r8,0,10,10
131 bne 1b
132 b 3f
133
1342: mfspr r8,SPRN_L2CR /* On 75x & 74[01]0, poll L2IP bit (bit 31) */
135 rlwinm. r9,r8,0,31,31
136 bne 2b
137
1383: rlwinm r8,r8,0,11,9 /* Turn off L2I bit */
139 sync
140 isync
141 mtspr SPRN_L2CR,r8
142 sync
143 isync
144 blr
145
146 .globl _setup_L3CR
147_setup_L3CR:
148 /* Invalidate/disable L3 cache */
149 sync
150 isync
151 mfspr r8,SPRN_L3CR
152 rlwinm r8,r8,0,1,31
153 ori r8,r8,L3CR_L3I@l
154 sync
155 isync
156 mtspr SPRN_L3CR,r8
157 sync
158 isync
159
160 /* Wait for the invalidation to complete */
1611: mfspr r8,SPRN_L3CR
162 rlwinm. r9,r8,0,21,21
163 bne 1b
164
165 rlwinm r8,r8,0,22,20 /* Turn off L3I bit */
166 sync
167 isync
168 mtspr SPRN_L3CR,r8
169 sync
170 isync
171 blr
172
173
174/* udelay (on non-601 processors) needs to know the period of the
175 * timebase in nanoseconds. This used to be hardcoded to be 60ns
176 * (period of 66MHz/4). Now a variable is used that is initialized to
177 * 60 for backward compatibility, but it can be overridden as necessary
178 * with code something like this:
179 * extern unsigned long timebase_period_ns;
180 * timebase_period_ns = 1000000000 / bd->bi_tbfreq;
181 */
182 .data
183 .globl timebase_period_ns
184timebase_period_ns:
185 .long 60
186
187 .text
188/*
189 * Delay for a number of microseconds
190 */
191 .globl udelay
192udelay:
193 mfspr r4,SPRN_PVR
194 srwi r4,r4,16
195 cmpwi 0,r4,1 /* 601 ? */
196 bne .udelay_not_601
19700: li r0,86 /* Instructions / microsecond? */
198 mtctr r0
19910: addi r0,r0,0 /* NOP */
200 bdnz 10b
201 subic. r3,r3,1
202 bne 00b
203 blr
204
205.udelay_not_601:
206 mulli r4,r3,1000 /* nanoseconds */
207 /* Change r4 to be the number of ticks using:
208 * (nanoseconds + (timebase_period_ns - 1 )) / timebase_period_ns
209 * timebase_period_ns defaults to 60 (16.6MHz) */
210 lis r5,timebase_period_ns@ha
211 lwz r5,timebase_period_ns@l(r5)
212 add r4,r4,r5
213 addi r4,r4,-1
214 divw r4,r4,r5 /* BUS ticks */
2151: mftbu r5
216 mftb r6
217 mftbu r7
218 cmpw 0,r5,r7
219 bne 1b /* Get [synced] base time */
220 addc r9,r6,r4 /* Compute end time */
221 addze r8,r5
2222: mftbu r5
223 cmpw 0,r5,r8
224 blt 2b
225 bgt 3f
226 mftb r6
227 cmpw 0,r6,r9
228 blt 2b
2293: blr
230
231 .section ".relocate_code","xa"
232/*
233 * Flush and enable instruction cache
234 * First, flush the data cache in case it was enabled and may be
235 * holding instructions for copy back.
236 */
237_GLOBAL(flush_instruction_cache)
238 mflr r6
239 bl flush_data_cache
240
241#ifdef CONFIG_8xx
242 lis r3, IDC_INVALL@h
243 mtspr SPRN_IC_CST, r3
244 lis r3, IDC_ENABLE@h
245 mtspr SPRN_IC_CST, r3
246 lis r3, IDC_DISABLE@h
247 mtspr SPRN_DC_CST, r3
248#elif CONFIG_4xx
249 lis r3,start@h # r9 = &_start
250 lis r4,_etext@ha
251 addi r4,r4,_etext@l # r8 = &_etext
2521: dcbf r0,r3 # Flush the data cache
253 icbi r0,r3 # Invalidate the instruction cache
254 addi r3,r3,0x10 # Increment by one cache line
255 cmplwi cr0,r3,r4 # Are we at the end yet?
256 blt 1b # No, keep flushing and invalidating
257#else
258 /* Enable, invalidate and then disable the L1 icache/dcache. */
259 li r3,0
260 ori r3,r3,(HID0_ICE|HID0_DCE|HID0_ICFI|HID0_DCI)
261 mfspr r4,SPRN_HID0
262 or r5,r4,r3
263 isync
264 mtspr SPRN_HID0,r5
265 sync
266 isync
267 ori r5,r4,HID0_ICE /* Enable cache */
268 mtspr SPRN_HID0,r5
269 sync
270 isync
271#endif
272 mtlr r6
273 blr
274
275#define NUM_CACHE_LINES 128*8
276#define cache_flush_buffer 0x1000
277
278/*
279 * Flush data cache
280 * Do this by just reading lots of stuff into the cache.
281 */
282_GLOBAL(flush_data_cache)
283 lis r3,cache_flush_buffer@h
284 ori r3,r3,cache_flush_buffer@l
285 li r4,NUM_CACHE_LINES
286 mtctr r4
28700: lwz r4,0(r3)
288 addi r3,r3,L1_CACHE_BYTES /* Next line, please */
289 bdnz 00b
29010: blr
291
292 .previous
293
diff --git a/arch/ppc/boot/images/Makefile b/arch/ppc/boot/images/Makefile
new file mode 100644
index 000000000000..774de8e23871
--- /dev/null
+++ b/arch/ppc/boot/images/Makefile
@@ -0,0 +1,27 @@
1#
2# This dir holds all of the images for PPC machines.
3# Tom Rini January 2001
4
5MKIMAGE := $(srctree)/scripts/mkuboot.sh
6
7extra-y := vmlinux.bin vmlinux.gz
8
9OBJCOPYFLAGS_vmlinux.bin := -O binary
10$(obj)/vmlinux.bin: vmlinux FORCE
11 $(call if_changed,objcopy)
12
13$(obj)/vmlinux.gz: $(obj)/vmlinux.bin FORCE
14 $(call if_changed,gzip)
15
16quiet_cmd_uimage = UIMAGE $@
17 cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A ppc -O linux -T kernel \
18 -C gzip -a 00000000 -e 00000000 -n 'Linux-$(KERNELRELEASE)' \
19 -d $< $@
20
21targets += uImage
22$(obj)/uImage: $(obj)/vmlinux.gz
23 $(call if_changed,uimage)
24 @echo ' Image $@ is ready'
25
26# Files generated that shall be removed upon make clean
27clean-files := sImage vmapus vmlinux* miboot* zImage* uImage
diff --git a/arch/ppc/boot/include/cpc700.h b/arch/ppc/boot/include/cpc700.h
new file mode 100644
index 000000000000..28cfcde44909
--- /dev/null
+++ b/arch/ppc/boot/include/cpc700.h
@@ -0,0 +1,26 @@
1
2#ifndef __PPC_BOOT_CPC700_H
3#define __PPC_BOOT_CPC700_H
4
5#define CPC700_MEM_CFGADDR 0xff500008
6#define CPC700_MEM_CFGDATA 0xff50000c
7
8#define CPC700_MB0SA 0x38
9#define CPC700_MB0EA 0x58
10#define CPC700_MB1SA 0x3c
11#define CPC700_MB1EA 0x5c
12#define CPC700_MB2SA 0x40
13#define CPC700_MB2EA 0x60
14#define CPC700_MB3SA 0x44
15#define CPC700_MB3EA 0x64
16#define CPC700_MB4SA 0x48
17#define CPC700_MB4EA 0x68
18
19static inline long
20cpc700_read_memreg(int reg)
21{
22 out_be32((volatile unsigned int *) CPC700_MEM_CFGADDR, reg);
23 return in_be32((volatile unsigned int *) CPC700_MEM_CFGDATA);
24}
25
26#endif
diff --git a/arch/ppc/boot/include/iso_font.h b/arch/ppc/boot/include/iso_font.h
new file mode 100644
index 000000000000..bff050e002b7
--- /dev/null
+++ b/arch/ppc/boot/include/iso_font.h
@@ -0,0 +1,257 @@
1static const unsigned char font[] = {
2/* 0x00 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
3/* 0x01 */ 0x00,0x00,0x7E,0x81,0xA5,0x81,0x81,0xBD,0x99,0x81,0x81,0x7E,0x00,0x00,0x00,0x00,
4/* 0x02 */ 0x00,0x00,0x7E,0xFF,0xDB,0xFF,0xFF,0xC3,0xC3,0xE7,0xFF,0x7E,0x00,0x00,0x00,0x00,
5/* 0x03 */ 0x00,0x00,0x00,0x00,0x6C,0xFE,0xFE,0xFE,0xFE,0x7C,0x38,0x10,0x00,0x00,0x00,0x00,
6/* 0x04 */ 0x00,0x00,0x00,0x00,0x10,0x38,0x7C,0xFE,0x7C,0x38,0x10,0x00,0x00,0x00,0x00,0x00,
7/* 0x05 */ 0x00,0x00,0x00,0x18,0x3C,0x3C,0xE7,0xE7,0xE7,0x18,0x18,0x3C,0x00,0x00,0x00,0x00,
8/* 0x06 */ 0x00,0x00,0x00,0x18,0x3C,0x7E,0xFF,0xFF,0x7E,0x18,0x18,0x3C,0x00,0x00,0x00,0x00,
9/* 0x07 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x3C,0x3C,0x18,0x00,0x00,0x00,0x00,0x00,0x00,
10/* 0x08 */ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xE7,0xC3,0xC3,0xE7,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
11/* 0x09 */ 0x00,0x00,0x00,0x00,0x00,0x3C,0x66,0x42,0x42,0x66,0x3C,0x00,0x00,0x00,0x00,0x00,
12/* 0x0A */ 0xFF,0xFF,0xFF,0xFF,0xFF,0xC3,0x99,0xBD,0xBD,0x99,0xC3,0xFF,0xFF,0xFF,0xFF,0xFF,
13/* 0x0B */ 0x00,0x00,0x3E,0x0E,0x1A,0x32,0x78,0xCC,0xCC,0xCC,0xCC,0x78,0x00,0x00,0x00,0x00,
14/* 0x0C */ 0x00,0x00,0x3C,0x66,0x66,0x66,0x66,0x3C,0x18,0x7E,0x18,0x18,0x00,0x00,0x00,0x00,
15/* 0x0D */ 0x00,0x00,0x30,0x38,0x3C,0x36,0x33,0x30,0x30,0x70,0xF0,0xE0,0x00,0x00,0x00,0x00,
16/* 0x0E */ 0x00,0x00,0x7F,0x63,0x7F,0x63,0x63,0x63,0x63,0x67,0xE7,0xE6,0xC0,0x00,0x00,0x00,
17/* 0x0F */ 0x00,0x00,0x00,0x18,0x18,0xDB,0x3C,0xE7,0x3C,0xDB,0x18,0x18,0x00,0x00,0x00,0x00,
18/* 0x10 */ 0x00,0x80,0xC0,0xE0,0xF0,0xF8,0xFE,0xF8,0xF0,0xE0,0xC0,0x80,0x00,0x00,0x00,0x00,
19/* 0x11 */ 0x00,0x02,0x06,0x0E,0x1E,0x3E,0xFE,0x3E,0x1E,0x0E,0x06,0x02,0x00,0x00,0x00,0x00,
20/* 0x12 */ 0x00,0x00,0x18,0x3C,0x7E,0x18,0x18,0x18,0x7E,0x3C,0x18,0x00,0x00,0x00,0x00,0x00,
21/* 0x13 */ 0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x66,0x66,0x00,0x00,0x00,0x00,
22/* 0x14 */ 0x00,0x00,0x7F,0xDB,0xDB,0xDB,0x7B,0x1B,0x1B,0x1B,0x1B,0x1B,0x00,0x00,0x00,0x00,
23/* 0x15 */ 0x00,0x7C,0xC6,0x60,0x38,0x6C,0xC6,0xC6,0x6C,0x38,0x0C,0xC6,0x7C,0x00,0x00,0x00,
24/* 0x16 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xFE,0xFE,0xFE,0x00,0x00,0x00,0x00,
25/* 0x17 */ 0x00,0x00,0x18,0x3C,0x7E,0x18,0x18,0x18,0x7E,0x3C,0x18,0x7E,0x00,0x00,0x00,0x00,
26/* 0x18 */ 0x00,0x00,0x18,0x3C,0x7E,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,
27/* 0x19 */ 0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x7E,0x3C,0x18,0x00,0x00,0x00,0x00,
28/* 0x1A */ 0x00,0x00,0x00,0x00,0x00,0x18,0x0C,0xFE,0x0C,0x18,0x00,0x00,0x00,0x00,0x00,0x00,
29/* 0x1B */ 0x00,0x00,0x00,0x00,0x00,0x30,0x60,0xFE,0x60,0x30,0x00,0x00,0x00,0x00,0x00,0x00,
30/* 0x1C */ 0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0xC0,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,
31/* 0x1D */ 0x00,0x00,0x00,0x00,0x00,0x28,0x6C,0xFE,0x6C,0x28,0x00,0x00,0x00,0x00,0x00,0x00,
32/* 0x1E */ 0x00,0x00,0x00,0x00,0x10,0x38,0x38,0x7C,0x7C,0xFE,0xFE,0x00,0x00,0x00,0x00,0x00,
33/* 0x1F */ 0x00,0x00,0x00,0x00,0xFE,0xFE,0x7C,0x7C,0x38,0x38,0x10,0x00,0x00,0x00,0x00,0x00,
34/* 0x20 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
35/* 0x21 */ 0x00,0x00,0x18,0x3C,0x3C,0x3C,0x18,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00,
36/* 0x22 */ 0x00,0x66,0x66,0x66,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
37/* 0x23 */ 0x00,0x00,0x00,0x6C,0x6C,0xFE,0x6C,0x6C,0x6C,0xFE,0x6C,0x6C,0x00,0x00,0x00,0x00,
38/* 0x24 */ 0x18,0x18,0x7C,0xC6,0xC2,0xC0,0x7C,0x06,0x06,0x86,0xC6,0x7C,0x18,0x18,0x00,0x00,
39/* 0x25 */ 0x00,0x00,0x00,0x00,0xC2,0xC6,0x0C,0x18,0x30,0x60,0xC6,0x86,0x00,0x00,0x00,0x00,
40/* 0x26 */ 0x00,0x00,0x38,0x6C,0x6C,0x38,0x76,0xDC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00,
41/* 0x27 */ 0x00,0x30,0x30,0x30,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
42/* 0x28 */ 0x00,0x00,0x0C,0x18,0x30,0x30,0x30,0x30,0x30,0x30,0x18,0x0C,0x00,0x00,0x00,0x00,
43/* 0x29 */ 0x00,0x00,0x30,0x18,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x18,0x30,0x00,0x00,0x00,0x00,
44/* 0x2A */ 0x00,0x00,0x00,0x00,0x00,0x66,0x3C,0xFF,0x3C,0x66,0x00,0x00,0x00,0x00,0x00,0x00,
45/* 0x2B */ 0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x7E,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,
46/* 0x2C */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x18,0x30,0x00,0x00,0x00,
47/* 0x2D */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
48/* 0x2E */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,
49/* 0x2F */ 0x00,0x00,0x00,0x00,0x02,0x06,0x0C,0x18,0x30,0x60,0xC0,0x80,0x00,0x00,0x00,0x00,
50/* 0x30 */ 0x00,0x00,0x38,0x6C,0xC6,0xC6,0xD6,0xD6,0xC6,0xC6,0x6C,0x38,0x00,0x00,0x00,0x00,
51/* 0x31 */ 0x00,0x00,0x18,0x38,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0x7E,0x00,0x00,0x00,0x00,
52/* 0x32 */ 0x00,0x00,0x7C,0xC6,0x06,0x0C,0x18,0x30,0x60,0xC0,0xC6,0xFE,0x00,0x00,0x00,0x00,
53/* 0x33 */ 0x00,0x00,0x7C,0xC6,0x06,0x06,0x3C,0x06,0x06,0x06,0xC6,0x7C,0x00,0x00,0x00,0x00,
54/* 0x34 */ 0x00,0x00,0x0C,0x1C,0x3C,0x6C,0xCC,0xFE,0x0C,0x0C,0x0C,0x1E,0x00,0x00,0x00,0x00,
55/* 0x35 */ 0x00,0x00,0xFE,0xC0,0xC0,0xC0,0xFC,0x06,0x06,0x06,0xC6,0x7C,0x00,0x00,0x00,0x00,
56/* 0x36 */ 0x00,0x00,0x38,0x60,0xC0,0xC0,0xFC,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00,
57/* 0x37 */ 0x00,0x00,0xFE,0xC6,0x06,0x06,0x0C,0x18,0x30,0x30,0x30,0x30,0x00,0x00,0x00,0x00,
58/* 0x38 */ 0x00,0x00,0x7C,0xC6,0xC6,0xC6,0x7C,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00,
59/* 0x39 */ 0x00,0x00,0x7C,0xC6,0xC6,0xC6,0x7E,0x06,0x06,0x06,0x0C,0x78,0x00,0x00,0x00,0x00,
60/* 0x3A */ 0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,
61/* 0x3B */ 0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x18,0x18,0x30,0x00,0x00,0x00,0x00,
62/* 0x3C */ 0x00,0x00,0x00,0x06,0x0C,0x18,0x30,0x60,0x30,0x18,0x0C,0x06,0x00,0x00,0x00,0x00,
63/* 0x3D */ 0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
64/* 0x3E */ 0x00,0x00,0x00,0x60,0x30,0x18,0x0C,0x06,0x0C,0x18,0x30,0x60,0x00,0x00,0x00,0x00,
65/* 0x3F */ 0x00,0x00,0x7C,0xC6,0xC6,0x0C,0x18,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00,
66/* 0x40 */ 0x00,0x00,0x00,0x7C,0xC6,0xC6,0xDE,0xDE,0xDE,0xDC,0xC0,0x7C,0x00,0x00,0x00,0x00,
67/* 0x41 */ 0x00,0x00,0x10,0x38,0x6C,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00,
68/* 0x42 */ 0x00,0x00,0xFC,0x66,0x66,0x66,0x7C,0x66,0x66,0x66,0x66,0xFC,0x00,0x00,0x00,0x00,
69/* 0x43 */ 0x00,0x00,0x3C,0x66,0xC2,0xC0,0xC0,0xC0,0xC0,0xC2,0x66,0x3C,0x00,0x00,0x00,0x00,
70/* 0x44 */ 0x00,0x00,0xF8,0x6C,0x66,0x66,0x66,0x66,0x66,0x66,0x6C,0xF8,0x00,0x00,0x00,0x00,
71/* 0x45 */ 0x00,0x00,0xFE,0x66,0x62,0x68,0x78,0x68,0x60,0x62,0x66,0xFE,0x00,0x00,0x00,0x00,
72/* 0x46 */ 0x00,0x00,0xFE,0x66,0x62,0x68,0x78,0x68,0x60,0x60,0x60,0xF0,0x00,0x00,0x00,0x00,
73/* 0x47 */ 0x00,0x00,0x3C,0x66,0xC2,0xC0,0xC0,0xDE,0xC6,0xC6,0x66,0x3A,0x00,0x00,0x00,0x00,
74/* 0x48 */ 0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00,
75/* 0x49 */ 0x00,0x00,0x3C,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00,
76/* 0x4A */ 0x00,0x00,0x1E,0x0C,0x0C,0x0C,0x0C,0x0C,0xCC,0xCC,0xCC,0x78,0x00,0x00,0x00,0x00,
77/* 0x4B */ 0x00,0x00,0xE6,0x66,0x66,0x6C,0x78,0x78,0x6C,0x66,0x66,0xE6,0x00,0x00,0x00,0x00,
78/* 0x4C */ 0x00,0x00,0xF0,0x60,0x60,0x60,0x60,0x60,0x60,0x62,0x66,0xFE,0x00,0x00,0x00,0x00,
79/* 0x4D */ 0x00,0x00,0xC6,0xEE,0xFE,0xFE,0xD6,0xC6,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00,
80/* 0x4E */ 0x00,0x00,0xC6,0xE6,0xF6,0xFE,0xDE,0xCE,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00,
81/* 0x4F */ 0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00,
82/* 0x50 */ 0x00,0x00,0xFC,0x66,0x66,0x66,0x7C,0x60,0x60,0x60,0x60,0xF0,0x00,0x00,0x00,0x00,
83/* 0x51 */ 0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xD6,0xDE,0x7C,0x0C,0x0E,0x00,0x00,
84/* 0x52 */ 0x00,0x00,0xFC,0x66,0x66,0x66,0x7C,0x6C,0x66,0x66,0x66,0xE6,0x00,0x00,0x00,0x00,
85/* 0x53 */ 0x00,0x00,0x7C,0xC6,0xC6,0x60,0x38,0x0C,0x06,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00,
86/* 0x54 */ 0x00,0x00,0x7E,0x7E,0x5A,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00,
87/* 0x55 */ 0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00,
88/* 0x56 */ 0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x6C,0x38,0x10,0x00,0x00,0x00,0x00,
89/* 0x57 */ 0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xD6,0xD6,0xD6,0xFE,0xEE,0x6C,0x00,0x00,0x00,0x00,
90/* 0x58 */ 0x00,0x00,0xC6,0xC6,0x6C,0x7C,0x38,0x38,0x7C,0x6C,0xC6,0xC6,0x00,0x00,0x00,0x00,
91/* 0x59 */ 0x00,0x00,0x66,0x66,0x66,0x66,0x3C,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00,
92/* 0x5A */ 0x00,0x00,0xFE,0xC6,0x86,0x0C,0x18,0x30,0x60,0xC2,0xC6,0xFE,0x00,0x00,0x00,0x00,
93/* 0x5B */ 0x00,0x00,0x3C,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x3C,0x00,0x00,0x00,0x00,
94/* 0x5C */ 0x00,0x00,0x00,0x80,0xC0,0xE0,0x70,0x38,0x1C,0x0E,0x06,0x02,0x00,0x00,0x00,0x00,
95/* 0x5D */ 0x00,0x00,0x3C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x3C,0x00,0x00,0x00,0x00,
96/* 0x5E */ 0x10,0x38,0x6C,0xC6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
97/* 0x5F */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,
98/* 0x60 */ 0x30,0x30,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
99/* 0x61 */ 0x00,0x00,0x00,0x00,0x00,0x78,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00,
100/* 0x62 */ 0x00,0x00,0xE0,0x60,0x60,0x78,0x6C,0x66,0x66,0x66,0x66,0x7C,0x00,0x00,0x00,0x00,
101/* 0x63 */ 0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0xC0,0xC0,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00,
102/* 0x64 */ 0x00,0x00,0x1C,0x0C,0x0C,0x3C,0x6C,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00,
103/* 0x65 */ 0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0xFE,0xC0,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00,
104/* 0x66 */ 0x00,0x00,0x38,0x6C,0x64,0x60,0xF0,0x60,0x60,0x60,0x60,0xF0,0x00,0x00,0x00,0x00,
105/* 0x67 */ 0x00,0x00,0x00,0x00,0x00,0x3E,0x66,0x66,0x66,0x66,0x66,0x3E,0x06,0x66,0x3C,0x00,
106/* 0x68 */ 0x00,0x00,0xE0,0x60,0x60,0x6C,0x76,0x66,0x66,0x66,0x66,0xE6,0x00,0x00,0x00,0x00,
107/* 0x69 */ 0x00,0x00,0x18,0x18,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00,
108/* 0x6A */ 0x00,0x00,0x06,0x06,0x00,0x0E,0x06,0x06,0x06,0x06,0x06,0x06,0x66,0x66,0x3C,0x00,
109/* 0x6B */ 0x00,0x00,0xE0,0x60,0x60,0x66,0x6C,0x78,0x78,0x6C,0x66,0xE6,0x00,0x00,0x00,0x00,
110/* 0x6C */ 0x00,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00,
111/* 0x6D */ 0x00,0x00,0x00,0x00,0x00,0x6C,0xFE,0xD6,0xD6,0xD6,0xC6,0xC6,0x00,0x00,0x00,0x00,
112/* 0x6E */ 0x00,0x00,0x00,0x00,0x00,0xDC,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00,
113/* 0x6F */ 0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00,
114/* 0x70 */ 0x00,0x00,0x00,0x00,0x00,0xFC,0x66,0x66,0x66,0x66,0x66,0x7C,0x60,0x60,0xF0,0x00,
115/* 0x71 */ 0x00,0x00,0x00,0x00,0x00,0x7E,0xCC,0xCC,0xCC,0xCC,0xCC,0x7C,0x0C,0x0C,0x1E,0x00,
116/* 0x72 */ 0x00,0x00,0x00,0x00,0x00,0xDC,0x76,0x66,0x60,0x60,0x60,0xF0,0x00,0x00,0x00,0x00,
117/* 0x73 */ 0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0x60,0x38,0x0C,0xC6,0x7C,0x00,0x00,0x00,0x00,
118/* 0x74 */ 0x00,0x00,0x10,0x30,0x30,0xFC,0x30,0x30,0x30,0x30,0x36,0x1C,0x00,0x00,0x00,0x00,
119/* 0x75 */ 0x00,0x00,0x00,0x00,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00,
120/* 0x76 */ 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x3C,0x18,0x00,0x00,0x00,0x00,
121/* 0x77 */ 0x00,0x00,0x00,0x00,0x00,0xC6,0xC6,0xD6,0xD6,0xD6,0xFE,0x6C,0x00,0x00,0x00,0x00,
122/* 0x78 */ 0x00,0x00,0x00,0x00,0x00,0xC6,0x6C,0x38,0x38,0x38,0x6C,0xC6,0x00,0x00,0x00,0x00,
123/* 0x79 */ 0x00,0x00,0x00,0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7E,0x06,0x0C,0xF8,0x00,
124/* 0x7A */ 0x00,0x00,0x00,0x00,0x00,0xFE,0xCC,0x18,0x30,0x60,0xC6,0xFE,0x00,0x00,0x00,0x00,
125/* 0x7B */ 0x00,0x00,0x0E,0x18,0x18,0x18,0x70,0x18,0x18,0x18,0x18,0x0E,0x00,0x00,0x00,0x00,
126/* 0x7C */ 0x00,0x00,0x18,0x18,0x18,0x18,0x00,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,
127/* 0x7D */ 0x00,0x00,0x70,0x18,0x18,0x18,0x0E,0x18,0x18,0x18,0x18,0x70,0x00,0x00,0x00,0x00,
128/* 0x7E */ 0x00,0x00,0x76,0xDC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
129/* 0x7F */ 0x00,0x00,0x00,0x00,0x10,0x38,0x6C,0xC6,0xC6,0xC6,0xFE,0x00,0x00,0x00,0x00,0x00,
130/* 0x80 */ 0x00,0x00,0x3C,0x66,0xC2,0xC0,0xC0,0xC0,0xC2,0x66,0x3C,0x0C,0x06,0x7C,0x00,0x00,
131/* 0x81 */ 0x00,0x00,0xCC,0x00,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00,
132/* 0x82 */ 0x00,0x0C,0x18,0x30,0x00,0x7C,0xC6,0xC6,0xFE,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00,
133/* 0x83 */ 0x00,0x10,0x38,0x6C,0x00,0x78,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00,
134/* 0x84 */ 0x00,0x00,0xCC,0x00,0x00,0x78,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00,
135/* 0x85 */ 0x00,0x60,0x30,0x18,0x00,0x78,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00,
136/* 0x86 */ 0x00,0x38,0x6C,0x38,0x00,0x78,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00,
137/* 0x87 */ 0x00,0x00,0x00,0x00,0x3C,0x66,0x60,0x60,0x66,0x3C,0x0C,0x06,0x3C,0x00,0x00,0x00,
138/* 0x88 */ 0x00,0x10,0x38,0x6C,0x00,0x7C,0xC6,0xC6,0xFE,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00,
139/* 0x89 */ 0x00,0x00,0xC6,0x00,0x00,0x7C,0xC6,0xC6,0xFE,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00,
140/* 0x8A */ 0x00,0x60,0x30,0x18,0x00,0x7C,0xC6,0xC6,0xFE,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00,
141/* 0x8B */ 0x00,0x00,0x66,0x00,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00,
142/* 0x8C */ 0x00,0x18,0x3C,0x66,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00,
143/* 0x8D */ 0x00,0x60,0x30,0x18,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00,
144/* 0x8E */ 0x00,0xC6,0x00,0x10,0x38,0x6C,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00,
145/* 0x8F */ 0x38,0x6C,0x38,0x00,0x38,0x6C,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00,
146/* 0x90 */ 0x18,0x30,0x60,0x00,0xFE,0x66,0x60,0x7C,0x60,0x60,0x66,0xFE,0x00,0x00,0x00,0x00,
147/* 0x91 */ 0x00,0x00,0x00,0x00,0x00,0xCC,0x76,0x36,0x7E,0xD8,0xD8,0x6E,0x00,0x00,0x00,0x00,
148/* 0x92 */ 0x00,0x00,0x3E,0x6C,0xCC,0xCC,0xFE,0xCC,0xCC,0xCC,0xCC,0xCE,0x00,0x00,0x00,0x00,
149/* 0x93 */ 0x00,0x10,0x38,0x6C,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00,
150/* 0x94 */ 0x00,0x00,0xC6,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00,
151/* 0x95 */ 0x00,0x60,0x30,0x18,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00,
152/* 0x96 */ 0x00,0x30,0x78,0xCC,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00,
153/* 0x97 */ 0x00,0x60,0x30,0x18,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00,
154/* 0x98 */ 0x00,0x00,0xC6,0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7E,0x06,0x0C,0x78,0x00,
155/* 0x99 */ 0x00,0xC6,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00,
156/* 0x9A */ 0x00,0xC6,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00,
157/* 0x9B */ 0x00,0x18,0x18,0x3C,0x66,0x60,0x60,0x60,0x66,0x3C,0x18,0x18,0x00,0x00,0x00,0x00,
158/* 0x9C */ 0x00,0x38,0x6C,0x64,0x60,0xF8,0x60,0x60,0x60,0x60,0xE6,0xFC,0x00,0x00,0x00,0x00,
159/* 0x9D */ 0x00,0x00,0x66,0x66,0x3C,0x18,0x7E,0x18,0x7E,0x18,0x18,0x18,0x00,0x00,0x00,0x00,
160/* 0x9E */ 0x00,0xF8,0xCC,0xCC,0xF8,0xC4,0xCC,0xDE,0xCC,0xCC,0xCC,0xC6,0x00,0x00,0x00,0x00,
161/* 0x9F */ 0x00,0x0E,0x1B,0x18,0x18,0x18,0x7E,0x18,0x18,0x18,0x18,0x18,0xD8,0x70,0x00,0x00,
162/* 0xA0 */ 0x00,0x18,0x30,0x60,0x00,0x78,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00,
163/* 0xA1 */ 0x00,0x0C,0x18,0x30,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00,
164/* 0xA2 */ 0x00,0x18,0x30,0x60,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00,
165/* 0xA3 */ 0x00,0x18,0x30,0x60,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00,
166/* 0xA4 */ 0x00,0x00,0x76,0xDC,0x00,0xDC,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00,
167/* 0xA5 */ 0x76,0xDC,0x00,0xC6,0xE6,0xF6,0xFE,0xDE,0xCE,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00,
168/* 0xA6 */ 0x00,0x3C,0x6C,0x6C,0x3E,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
169/* 0xA7 */ 0x00,0x38,0x6C,0x6C,0x38,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
170/* 0xA8 */ 0x00,0x00,0x30,0x30,0x00,0x30,0x30,0x60,0xC0,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00,
171/* 0xA9 */ 0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xC0,0xC0,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,
172/* 0xAA */ 0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x06,0x06,0x06,0x06,0x00,0x00,0x00,0x00,0x00,
173/* 0xAB */ 0x00,0xC0,0xC0,0xC2,0xC6,0xCC,0x18,0x30,0x60,0xDC,0x86,0x0C,0x18,0x3E,0x00,0x00,
174/* 0xAC */ 0x00,0xC0,0xC0,0xC2,0xC6,0xCC,0x18,0x30,0x66,0xCE,0x9E,0x3E,0x06,0x06,0x00,0x00,
175/* 0xAD */ 0x00,0x00,0x18,0x18,0x00,0x18,0x18,0x18,0x3C,0x3C,0x3C,0x18,0x00,0x00,0x00,0x00,
176/* 0xAE */ 0x00,0x00,0x00,0x00,0x00,0x36,0x6C,0xD8,0x6C,0x36,0x00,0x00,0x00,0x00,0x00,0x00,
177/* 0xAF */ 0x00,0x00,0x00,0x00,0x00,0xD8,0x6C,0x36,0x6C,0xD8,0x00,0x00,0x00,0x00,0x00,0x00,
178/* 0xB0 */ 0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,
179/* 0xB1 */ 0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,
180/* 0xB2 */ 0xDD,0x77,0xDD,0x77,0xDD,0x77,0xDD,0x77,0xDD,0x77,0xDD,0x77,0xDD,0x77,0xDD,0x77,
181/* 0xB3 */ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
182/* 0xB4 */ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
183/* 0xB5 */ 0x18,0x18,0x18,0x18,0x18,0xF8,0x18,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
184/* 0xB6 */ 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xF6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
185/* 0xB7 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
186/* 0xB8 */ 0x00,0x00,0x00,0x00,0x00,0xF8,0x18,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
187/* 0xB9 */ 0x36,0x36,0x36,0x36,0x36,0xF6,0x06,0xF6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
188/* 0xBA */ 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
189/* 0xBB */ 0x00,0x00,0x00,0x00,0x00,0xFE,0x06,0xF6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
190/* 0xBC */ 0x36,0x36,0x36,0x36,0x36,0xF6,0x06,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
191/* 0xBD */ 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
192/* 0xBE */ 0x18,0x18,0x18,0x18,0x18,0xF8,0x18,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
193/* 0xBF */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
194/* 0xC0 */ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
195/* 0xC1 */ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
196/* 0xC2 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
197/* 0xC3 */ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
198/* 0xC4 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
199/* 0xC5 */ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
200/* 0xC6 */ 0x18,0x18,0x18,0x18,0x18,0x1F,0x18,0x1F,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
201/* 0xC7 */ 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
202/* 0xC8 */ 0x36,0x36,0x36,0x36,0x36,0x37,0x30,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
203/* 0xC9 */ 0x00,0x00,0x00,0x00,0x00,0x3F,0x30,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
204/* 0xCA */ 0x36,0x36,0x36,0x36,0x36,0xF7,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
205/* 0xCB */ 0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0xF7,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
206/* 0xCC */ 0x36,0x36,0x36,0x36,0x36,0x37,0x30,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
207/* 0xCD */ 0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
208/* 0xCE */ 0x36,0x36,0x36,0x36,0x36,0xF7,0x00,0xF7,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
209/* 0xCF */ 0x18,0x18,0x18,0x18,0x18,0xFF,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
210/* 0xD0 */ 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
211/* 0xD1 */ 0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
212/* 0xD2 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
213/* 0xD3 */ 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
214/* 0xD4 */ 0x18,0x18,0x18,0x18,0x18,0x1F,0x18,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
215/* 0xD5 */ 0x00,0x00,0x00,0x00,0x00,0x1F,0x18,0x1F,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
216/* 0xD6 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
217/* 0xD7 */ 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xFF,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
218/* 0xD8 */ 0x18,0x18,0x18,0x18,0x18,0xFF,0x18,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
219/* 0xD9 */ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
220/* 0xDA */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
221/* 0xDB */ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
222/* 0xDC */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
223/* 0xDD */ 0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,
224/* 0xDE */ 0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,
225/* 0xDF */ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
226/* 0xE0 */ 0x00,0x00,0x00,0x00,0x00,0x76,0xDC,0xD8,0xD8,0xD8,0xDC,0x76,0x00,0x00,0x00,0x00,
227/* 0xE1 */ 0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xFC,0xC6,0xC6,0xC6,0xC6,0xDC,0xC0,0xC0,0x00,0x00,
228/* 0xE2 */ 0x00,0x00,0xFE,0xC6,0xC6,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x00,0x00,0x00,0x00,
229/* 0xE3 */ 0x00,0x00,0x00,0x00,0x00,0xFE,0x6C,0x6C,0x6C,0x6C,0x6C,0x6C,0x00,0x00,0x00,0x00,
230/* 0xE4 */ 0x00,0x00,0xFE,0xC6,0x60,0x30,0x18,0x18,0x30,0x60,0xC6,0xFE,0x00,0x00,0x00,0x00,
231/* 0xE5 */ 0x00,0x00,0x00,0x00,0x00,0x7E,0xD8,0xD8,0xD8,0xD8,0xD8,0x70,0x00,0x00,0x00,0x00,
232/* 0xE6 */ 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x7C,0x60,0xC0,0x00,0x00,0x00,
233/* 0xE7 */ 0x00,0x00,0x00,0x00,0x00,0x76,0xDC,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,
234/* 0xE8 */ 0x00,0x00,0x7E,0x18,0x3C,0x66,0x66,0x66,0x66,0x3C,0x18,0x7E,0x00,0x00,0x00,0x00,
235/* 0xE9 */ 0x00,0x00,0x38,0x6C,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0x6C,0x38,0x00,0x00,0x00,0x00,
236/* 0xEA */ 0x00,0x00,0x38,0x6C,0xC6,0xC6,0xC6,0x6C,0x6C,0x6C,0x6C,0xEE,0x00,0x00,0x00,0x00,
237/* 0xEB */ 0x00,0x00,0x1E,0x30,0x18,0x0C,0x3E,0x66,0x66,0x66,0x66,0x3C,0x00,0x00,0x00,0x00,
238/* 0xEC */ 0x00,0x00,0x00,0x00,0x00,0x7E,0xDB,0xDB,0xDB,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,
239/* 0xED */ 0x00,0x00,0x00,0x03,0x06,0x7E,0xDB,0xDB,0xF3,0x7E,0x60,0xC0,0x00,0x00,0x00,0x00,
240/* 0xEE */ 0x00,0x00,0x1C,0x30,0x60,0x60,0x7C,0x60,0x60,0x60,0x30,0x1C,0x00,0x00,0x00,0x00,
241/* 0xEF */ 0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00,
242/* 0xF0 */ 0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0xFE,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,
243/* 0xF1 */ 0x00,0x00,0x00,0x00,0x18,0x18,0x7E,0x18,0x18,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,
244/* 0xF2 */ 0x00,0x00,0x00,0x30,0x18,0x0C,0x06,0x0C,0x18,0x30,0x00,0x7E,0x00,0x00,0x00,0x00,
245/* 0xF3 */ 0x00,0x00,0x00,0x0C,0x18,0x30,0x60,0x30,0x18,0x0C,0x00,0x7E,0x00,0x00,0x00,0x00,
246/* 0xF4 */ 0x00,0x0E,0x1B,0x1B,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
247/* 0xF5 */ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xD8,0xD8,0xD8,0x70,0x00,0x00,0x00,0x00,
248/* 0xF6 */ 0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x7E,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,
249/* 0xF7 */ 0x00,0x00,0x00,0x00,0x00,0x76,0xDC,0x00,0x76,0xDC,0x00,0x00,0x00,0x00,0x00,0x00,
250/* 0xF8 */ 0x00,0x38,0x6C,0x6C,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
251/* 0xF9 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
252/* 0xFA */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
253/* 0xFB */ 0x00,0x0F,0x0C,0x0C,0x0C,0x0C,0x0C,0xEC,0x6C,0x6C,0x3C,0x1C,0x00,0x00,0x00,0x00,
254/* 0xFC */ 0x00,0xD8,0x6C,0x6C,0x6C,0x6C,0x6C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
255/* 0xFD */ 0x00,0x70,0xD8,0x30,0x60,0xC8,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
256/* 0xFE */ 0x00,0x00,0x00,0x00,0x7C,0x7C,0x7C,0x7C,0x7C,0x7C,0x7C,0x00,0x00,0x00,0x00,0x00,
257};
diff --git a/arch/ppc/boot/include/mpc10x.h b/arch/ppc/boot/include/mpc10x.h
new file mode 100644
index 000000000000..6cd40ecabc74
--- /dev/null
+++ b/arch/ppc/boot/include/mpc10x.h
@@ -0,0 +1,65 @@
1/*
2 * arch/ppc/boot/include/mpc10.h
3 *
4 * Common defines for the Motorola SPS MPC106/8240/107 Host bridge/Mem
5 * ctrl/EPIC/etc.
6 *
7 * Author: Tom Rini <trini@mvista.com>
8 *
9 * This is a heavily stripped down version of:
10 * include/asm-ppc/mpc10x.h
11 *
12 * Author: Mark A. Greer
13 * mgreer@mvista.com
14 *
15 * 2001-2002 (c) MontaVista, Software, Inc. This file is licensed under
16 * the terms of the GNU General Public License version 2. This program
17 * is licensed "as is" without any warranty of any kind, whether express
18 * or implied.
19 */
20#ifndef __BOOT_MPC10X_H__
21#define __BOOT_MPC10X_H__
22
23/*
24 * The values here don't completely map everything but should work in most
25 * cases.
26 *
27 * MAP A (PReP Map)
28 * Processor: 0x80000000 - 0x807fffff -> PCI I/O: 0x00000000 - 0x007fffff
29 * Processor: 0xc0000000 - 0xdfffffff -> PCI MEM: 0x00000000 - 0x1fffffff
30 * PCI MEM: 0x80000000 -> Processor System Memory: 0x00000000
31 * EUMB mapped to: ioremap_base - 0x00100000 (ioremap_base - 1 MB)
32 *
33 * MAP B (CHRP Map)
34 * Processor: 0xfe000000 - 0xfebfffff -> PCI I/O: 0x00000000 - 0x00bfffff
35 * Processor: 0x80000000 - 0xbfffffff -> PCI MEM: 0x80000000 - 0xbfffffff
36 * PCI MEM: 0x00000000 -> Processor System Memory: 0x00000000
37 * EUMB mapped to: ioremap_base - 0x00100000 (ioremap_base - 1 MB)
38 */
39
40/* Define the type of map to use */
41#define MPC10X_MEM_MAP_A 1
42#define MPC10X_MEM_MAP_B 2
43
44/* Map A (PReP Map) Defines */
45#define MPC10X_MAPA_CNFG_ADDR 0x80000cf8
46#define MPC10X_MAPA_CNFG_DATA 0x80000cfc
47
48/* Map B (CHRP Map) Defines */
49#define MPC10X_MAPB_CNFG_ADDR 0xfec00000
50#define MPC10X_MAPB_CNFG_DATA 0xfee00000
51
52/* Define offsets for the memory controller registers in the config space */
53#define MPC10X_MCTLR_MEM_START_1 0x80 /* Banks 0-3 */
54#define MPC10X_MCTLR_MEM_START_2 0x84 /* Banks 4-7 */
55#define MPC10X_MCTLR_EXT_MEM_START_1 0x88 /* Banks 0-3 */
56#define MPC10X_MCTLR_EXT_MEM_START_2 0x8c /* Banks 4-7 */
57
58#define MPC10X_MCTLR_MEM_END_1 0x90 /* Banks 0-3 */
59#define MPC10X_MCTLR_MEM_END_2 0x94 /* Banks 4-7 */
60#define MPC10X_MCTLR_EXT_MEM_END_1 0x98 /* Banks 0-3 */
61#define MPC10X_MCTLR_EXT_MEM_END_2 0x9c /* Banks 4-7 */
62
63#define MPC10X_MCTLR_MEM_BANK_ENABLES 0xa0
64
65#endif /* __BOOT_MPC10X_H__ */
diff --git a/arch/ppc/boot/include/mpsc_defs.h b/arch/ppc/boot/include/mpsc_defs.h
new file mode 100644
index 000000000000..2ce7bbba7277
--- /dev/null
+++ b/arch/ppc/boot/include/mpsc_defs.h
@@ -0,0 +1,146 @@
1/*
2 * drivers/serial/mpsc/mpsc_defs.h
3 *
4 * Register definitions for the Marvell Multi-Protocol Serial Controller (MPSC),
5 * Serial DMA Controller (SDMA), and Baud Rate Generator (BRG).
6 *
7 * Author: Mark A. Greer <mgreer@mvista.com>
8 *
9 * 2004 (c) MontaVista, Software, Inc. This file is licensed under
10 * the terms of the GNU General Public License version 2. This program
11 * is licensed "as is" without any warranty of any kind, whether express
12 * or implied.
13 */
14#ifndef _PPC_BOOT_MPSC_DEFS_H__
15#define _PPC_BOOT_MPSC_DEFS_H__
16
17#define MPSC_NUM_CTLRS 2
18
19/*
20 *****************************************************************************
21 *
22 * Multi-Protocol Serial Controller Interface Registers
23 *
24 *****************************************************************************
25 */
26
27/* Main Configuratino Register Offsets */
28#define MPSC_MMCRL 0x0000
29#define MPSC_MMCRH 0x0004
30#define MPSC_MPCR 0x0008
31#define MPSC_CHR_1 0x000c
32#define MPSC_CHR_2 0x0010
33#define MPSC_CHR_3 0x0014
34#define MPSC_CHR_4 0x0018
35#define MPSC_CHR_5 0x001c
36#define MPSC_CHR_6 0x0020
37#define MPSC_CHR_7 0x0024
38#define MPSC_CHR_8 0x0028
39#define MPSC_CHR_9 0x002c
40#define MPSC_CHR_10 0x0030
41#define MPSC_CHR_11 0x0034
42
43#define MPSC_MPCR_CL_5 0
44#define MPSC_MPCR_CL_6 1
45#define MPSC_MPCR_CL_7 2
46#define MPSC_MPCR_CL_8 3
47#define MPSC_MPCR_SBL_1 0
48#define MPSC_MPCR_SBL_2 3
49
50#define MPSC_CHR_2_TEV (1<<1)
51#define MPSC_CHR_2_TA (1<<7)
52#define MPSC_CHR_2_TTCS (1<<9)
53#define MPSC_CHR_2_REV (1<<17)
54#define MPSC_CHR_2_RA (1<<23)
55#define MPSC_CHR_2_CRD (1<<25)
56#define MPSC_CHR_2_EH (1<<31)
57#define MPSC_CHR_2_PAR_ODD 0
58#define MPSC_CHR_2_PAR_SPACE 1
59#define MPSC_CHR_2_PAR_EVEN 2
60#define MPSC_CHR_2_PAR_MARK 3
61
62/* MPSC Signal Routing */
63#define MPSC_MRR 0x0000
64#define MPSC_RCRR 0x0004
65#define MPSC_TCRR 0x0008
66
67/*
68 *****************************************************************************
69 *
70 * Serial DMA Controller Interface Registers
71 *
72 *****************************************************************************
73 */
74
75#define SDMA_SDC 0x0000
76#define SDMA_SDCM 0x0008
77#define SDMA_RX_DESC 0x0800
78#define SDMA_RX_BUF_PTR 0x0808
79#define SDMA_SCRDP 0x0810
80#define SDMA_TX_DESC 0x0c00
81#define SDMA_SCTDP 0x0c10
82#define SDMA_SFTDP 0x0c14
83
84#define SDMA_DESC_CMDSTAT_PE (1<<0)
85#define SDMA_DESC_CMDSTAT_CDL (1<<1)
86#define SDMA_DESC_CMDSTAT_FR (1<<3)
87#define SDMA_DESC_CMDSTAT_OR (1<<6)
88#define SDMA_DESC_CMDSTAT_BR (1<<9)
89#define SDMA_DESC_CMDSTAT_MI (1<<10)
90#define SDMA_DESC_CMDSTAT_A (1<<11)
91#define SDMA_DESC_CMDSTAT_AM (1<<12)
92#define SDMA_DESC_CMDSTAT_CT (1<<13)
93#define SDMA_DESC_CMDSTAT_C (1<<14)
94#define SDMA_DESC_CMDSTAT_ES (1<<15)
95#define SDMA_DESC_CMDSTAT_L (1<<16)
96#define SDMA_DESC_CMDSTAT_F (1<<17)
97#define SDMA_DESC_CMDSTAT_P (1<<18)
98#define SDMA_DESC_CMDSTAT_EI (1<<23)
99#define SDMA_DESC_CMDSTAT_O (1<<31)
100
101#define SDMA_DESC_DFLT (SDMA_DESC_CMDSTAT_O | \
102 SDMA_DESC_CMDSTAT_EI)
103
104#define SDMA_SDC_RFT (1<<0)
105#define SDMA_SDC_SFM (1<<1)
106#define SDMA_SDC_BLMR (1<<6)
107#define SDMA_SDC_BLMT (1<<7)
108#define SDMA_SDC_POVR (1<<8)
109#define SDMA_SDC_RIFB (1<<9)
110
111#define SDMA_SDCM_ERD (1<<7)
112#define SDMA_SDCM_AR (1<<15)
113#define SDMA_SDCM_STD (1<<16)
114#define SDMA_SDCM_TXD (1<<23)
115#define SDMA_SDCM_AT (1<<31)
116
117#define SDMA_0_CAUSE_RXBUF (1<<0)
118#define SDMA_0_CAUSE_RXERR (1<<1)
119#define SDMA_0_CAUSE_TXBUF (1<<2)
120#define SDMA_0_CAUSE_TXEND (1<<3)
121#define SDMA_1_CAUSE_RXBUF (1<<8)
122#define SDMA_1_CAUSE_RXERR (1<<9)
123#define SDMA_1_CAUSE_TXBUF (1<<10)
124#define SDMA_1_CAUSE_TXEND (1<<11)
125
126#define SDMA_CAUSE_RX_MASK (SDMA_0_CAUSE_RXBUF | SDMA_0_CAUSE_RXERR | \
127 SDMA_1_CAUSE_RXBUF | SDMA_1_CAUSE_RXERR)
128#define SDMA_CAUSE_TX_MASK (SDMA_0_CAUSE_TXBUF | SDMA_0_CAUSE_TXEND | \
129 SDMA_1_CAUSE_TXBUF | SDMA_1_CAUSE_TXEND)
130
131/* SDMA Interrupt registers */
132#define SDMA_INTR_CAUSE 0x0000
133#define SDMA_INTR_MASK 0x0080
134
135/*
136 *****************************************************************************
137 *
138 * Baud Rate Generator Interface Registers
139 *
140 *****************************************************************************
141 */
142
143#define BRG_BCR 0x0000
144#define BRG_BTR 0x0004
145
146#endif /*_PPC_BOOT_MPSC_DEFS_H__ */
diff --git a/arch/ppc/boot/include/nonstdio.h b/arch/ppc/boot/include/nonstdio.h
new file mode 100644
index 000000000000..f2b5526faef3
--- /dev/null
+++ b/arch/ppc/boot/include/nonstdio.h
@@ -0,0 +1,34 @@
1/*
2 * Copyright (C) Paul Mackerras 1997.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 *
9 * This is sort of a catchall for I/O related functions. Stuff that
10 * wouldn't be in 'stdio.h' normally is here, and it's 'nonstdio.h'
11 * for a reason. -- Tom
12 */
13typedef int FILE;
14extern FILE *stdin, *stdout;
15#define NULL ((void *)0)
16#define EOF (-1)
17#define fopen(n, m) NULL
18#define fflush(f) 0
19#define fclose(f) 0
20#define perror(s) printf("%s: no files!\n", (s))
21
22extern int getc(void);
23extern int printf(const char *format, ...);
24extern int sprintf(char *str, const char *format, ...);
25extern int tstc(void);
26extern void exit(void);
27extern void outb(int port, unsigned char val);
28extern void putc(const char c);
29extern void puthex(unsigned long val);
30extern void puts(const char *);
31extern void udelay(long delay);
32extern unsigned char inb(int port);
33extern void board_isa_init(void);
34extern void ISA_init(unsigned long base);
diff --git a/arch/ppc/boot/include/of1275.h b/arch/ppc/boot/include/of1275.h
new file mode 100644
index 000000000000..69173df76db0
--- /dev/null
+++ b/arch/ppc/boot/include/of1275.h
@@ -0,0 +1,39 @@
1/*
2 * Copyright (C) Paul Mackerras 1997.
3 * Copyright (C) Leigh Brown 2002.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10
11typedef void *prom_handle;
12typedef void *ihandle;
13typedef void *phandle;
14typedef int (*prom_entry)(void *);
15
16#define OF_INVALID_HANDLE ((prom_handle)-1UL)
17
18extern prom_entry of_prom_entry;
19
20/* function declarations */
21
22void * claim(unsigned int virt, unsigned int size, unsigned int align);
23int map(unsigned int phys, unsigned int virt, unsigned int size);
24void enter(void);
25void exit(void);
26phandle finddevice(const char *name);
27int getprop(phandle node, const char *name, void *buf, int buflen);
28void ofinit(prom_entry entry);
29int ofstdio(ihandle *stdin, ihandle *stdout, ihandle *stderr);
30int read(ihandle instance, void *buf, int buflen);
31void release(void *virt, unsigned int size);
32int write(ihandle instance, void *buf, int buflen);
33
34/* inlines */
35
36extern inline void pause(void)
37{
38 enter();
39}
diff --git a/arch/ppc/boot/include/rs6000.h b/arch/ppc/boot/include/rs6000.h
new file mode 100644
index 000000000000..433f45084e41
--- /dev/null
+++ b/arch/ppc/boot/include/rs6000.h
@@ -0,0 +1,243 @@
1/* IBM RS/6000 "XCOFF" file definitions for BFD.
2 Copyright (C) 1990, 1991 Free Software Foundation, Inc.
3 FIXME: Can someone provide a transliteration of this name into ASCII?
4 Using the following chars caused a compiler warning on HIUX (so I replaced
5 them with octal escapes), and isn't useful without an understanding of what
6 character set it is.
7 Written by Mimi Ph\373\364ng-Th\345o V\365 of IBM
8 and John Gilmore of Cygnus Support. */
9
10/********************** FILE HEADER **********************/
11
12struct external_filehdr {
13 char f_magic[2]; /* magic number */
14 char f_nscns[2]; /* number of sections */
15 char f_timdat[4]; /* time & date stamp */
16 char f_symptr[4]; /* file pointer to symtab */
17 char f_nsyms[4]; /* number of symtab entries */
18 char f_opthdr[2]; /* sizeof(optional hdr) */
19 char f_flags[2]; /* flags */
20};
21
22 /* IBM RS/6000 */
23#define U802WRMAGIC 0730 /* writeable text segments **chh** */
24#define U802ROMAGIC 0735 /* readonly sharable text segments */
25#define U802TOCMAGIC 0737 /* readonly text segments and TOC */
26
27#define BADMAG(x) \
28 ((x).f_magic != U802ROMAGIC && (x).f_magic != U802WRMAGIC && \
29 (x).f_magic != U802TOCMAGIC)
30
31#define FILHDR struct external_filehdr
32#define FILHSZ 20
33
34
35/********************** AOUT "OPTIONAL HEADER" **********************/
36
37
38typedef struct
39{
40 unsigned char magic[2]; /* type of file */
41 unsigned char vstamp[2]; /* version stamp */
42 unsigned char tsize[4]; /* text size in bytes, padded to FW bdry */
43 unsigned char dsize[4]; /* initialized data " " */
44 unsigned char bsize[4]; /* uninitialized data " " */
45 unsigned char entry[4]; /* entry pt. */
46 unsigned char text_start[4]; /* base of text used for this file */
47 unsigned char data_start[4]; /* base of data used for this file */
48 unsigned char o_toc[4]; /* address of TOC */
49 unsigned char o_snentry[2]; /* section number of entry point */
50 unsigned char o_sntext[2]; /* section number of .text section */
51 unsigned char o_sndata[2]; /* section number of .data section */
52 unsigned char o_sntoc[2]; /* section number of TOC */
53 unsigned char o_snloader[2]; /* section number of .loader section */
54 unsigned char o_snbss[2]; /* section number of .bss section */
55 unsigned char o_algntext[2]; /* .text alignment */
56 unsigned char o_algndata[2]; /* .data alignment */
57 unsigned char o_modtype[2]; /* module type (??) */
58 unsigned char o_cputype[2]; /* cpu type */
59 unsigned char o_maxstack[4]; /* max stack size (??) */
60 unsigned char o_maxdata[4]; /* max data size (??) */
61 unsigned char o_resv2[12]; /* reserved */
62}
63AOUTHDR;
64
65#define AOUTSZ 72
66#define SMALL_AOUTSZ (28)
67#define AOUTHDRSZ 72
68
69#define RS6K_AOUTHDR_OMAGIC 0x0107 /* old: text & data writeable */
70#define RS6K_AOUTHDR_NMAGIC 0x0108 /* new: text r/o, data r/w */
71#define RS6K_AOUTHDR_ZMAGIC 0x010B /* paged: text r/o, both page-aligned */
72
73
74/********************** SECTION HEADER **********************/
75
76
77struct external_scnhdr {
78 char s_name[8]; /* section name */
79 char s_paddr[4]; /* physical address, aliased s_nlib */
80 char s_vaddr[4]; /* virtual address */
81 char s_size[4]; /* section size */
82 char s_scnptr[4]; /* file ptr to raw data for section */
83 char s_relptr[4]; /* file ptr to relocation */
84 char s_lnnoptr[4]; /* file ptr to line numbers */
85 char s_nreloc[2]; /* number of relocation entries */
86 char s_nlnno[2]; /* number of line number entries*/
87 char s_flags[4]; /* flags */
88};
89
90/*
91 * names of "special" sections
92 */
93#define _TEXT ".text"
94#define _DATA ".data"
95#define _BSS ".bss"
96#define _PAD ".pad"
97#define _LOADER ".loader"
98
99#define SCNHDR struct external_scnhdr
100#define SCNHSZ 40
101
102/* XCOFF uses a special .loader section with type STYP_LOADER. */
103#define STYP_LOADER 0x1000
104
105/* XCOFF uses a special .debug section with type STYP_DEBUG. */
106#define STYP_DEBUG 0x2000
107
108/* XCOFF handles line number or relocation overflow by creating
109 another section header with STYP_OVRFLO set. */
110#define STYP_OVRFLO 0x8000
111
112/********************** LINE NUMBERS **********************/
113
114/* 1 line number entry for every "breakpointable" source line in a section.
115 * Line numbers are grouped on a per function basis; first entry in a function
116 * grouping will have l_lnno = 0 and in place of physical address will be the
117 * symbol table index of the function name.
118 */
119struct external_lineno {
120 union {
121 char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/
122 char l_paddr[4]; /* (physical) address of line number */
123 } l_addr;
124 char l_lnno[2]; /* line number */
125};
126
127
128#define LINENO struct external_lineno
129#define LINESZ 6
130
131
132/********************** SYMBOLS **********************/
133
134#define E_SYMNMLEN 8 /* # characters in a symbol name */
135#define E_FILNMLEN 14 /* # characters in a file name */
136#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */
137
138struct external_syment
139{
140 union {
141 char e_name[E_SYMNMLEN];
142 struct {
143 char e_zeroes[4];
144 char e_offset[4];
145 } e;
146 } e;
147 char e_value[4];
148 char e_scnum[2];
149 char e_type[2];
150 char e_sclass[1];
151 char e_numaux[1];
152};
153
154
155
156#define N_BTMASK (017)
157#define N_TMASK (060)
158#define N_BTSHFT (4)
159#define N_TSHIFT (2)
160
161
162union external_auxent {
163 struct {
164 char x_tagndx[4]; /* str, un, or enum tag indx */
165 union {
166 struct {
167 char x_lnno[2]; /* declaration line number */
168 char x_size[2]; /* str/union/array size */
169 } x_lnsz;
170 char x_fsize[4]; /* size of function */
171 } x_misc;
172 union {
173 struct { /* if ISFCN, tag, or .bb */
174 char x_lnnoptr[4]; /* ptr to fcn line # */
175 char x_endndx[4]; /* entry ndx past block end */
176 } x_fcn;
177 struct { /* if ISARY, up to 4 dimen. */
178 char x_dimen[E_DIMNUM][2];
179 } x_ary;
180 } x_fcnary;
181 char x_tvndx[2]; /* tv index */
182 } x_sym;
183
184 union {
185 char x_fname[E_FILNMLEN];
186 struct {
187 char x_zeroes[4];
188 char x_offset[4];
189 } x_n;
190 } x_file;
191
192 struct {
193 char x_scnlen[4]; /* section length */
194 char x_nreloc[2]; /* # relocation entries */
195 char x_nlinno[2]; /* # line numbers */
196 } x_scn;
197
198 struct {
199 char x_tvfill[4]; /* tv fill value */
200 char x_tvlen[2]; /* length of .tv */
201 char x_tvran[2][2]; /* tv range */
202 } x_tv; /* info about .tv section (in auxent of symbol .tv)) */
203
204 struct {
205 unsigned char x_scnlen[4];
206 unsigned char x_parmhash[4];
207 unsigned char x_snhash[2];
208 unsigned char x_smtyp[1];
209 unsigned char x_smclas[1];
210 unsigned char x_stab[4];
211 unsigned char x_snstab[2];
212 } x_csect;
213
214};
215
216#define SYMENT struct external_syment
217#define SYMESZ 18
218#define AUXENT union external_auxent
219#define AUXESZ 18
220#define DBXMASK 0x80 /* for dbx storage mask */
221#define SYMNAME_IN_DEBUG(symptr) ((symptr)->n_sclass & DBXMASK)
222
223
224
225/********************** RELOCATION DIRECTIVES **********************/
226
227
228struct external_reloc {
229 char r_vaddr[4];
230 char r_symndx[4];
231 char r_size[1];
232 char r_type[1];
233};
234
235
236#define RELOC struct external_reloc
237#define RELSZ 10
238
239#define DEFAULT_DATA_SECTION_ALIGNMENT 4
240#define DEFAULT_BSS_SECTION_ALIGNMENT 4
241#define DEFAULT_TEXT_SECTION_ALIGNMENT 4
242/* For new sections we havn't heard of before */
243#define DEFAULT_SECTION_ALIGNMENT 4
diff --git a/arch/ppc/boot/include/serial.h b/arch/ppc/boot/include/serial.h
new file mode 100644
index 000000000000..d710eabb4256
--- /dev/null
+++ b/arch/ppc/boot/include/serial.h
@@ -0,0 +1,46 @@
1/*
2 * A really private header file for the (dumb) serial driver in arch/ppc/boot
3 *
4 * Shamelessly taken from include/linux/serialP.h:
5 *
6 * Copyright (C) 1997 by Theodore Ts'o.
7 *
8 * Redistribution of this file is permitted under the terms of the GNU
9 * Public License (GPL)
10 */
11
12#ifndef _PPC_BOOT_SERIALP_H
13#define _PPC_BOOT_SERIALP_H
14
15/*
16 * This is our internal structure for each serial port's state.
17 *
18 * Many fields are paralleled by the structure used by the serial_struct
19 * structure.
20 *
21 * Given that this is how SERIAL_PORT_DFNS are done, and that we need
22 * to use a few of their fields, we need to have our own copy of it.
23 */
24struct serial_state {
25 int magic;
26 int baud_base;
27 unsigned long port;
28 int irq;
29 int flags;
30 int hub6;
31 int type;
32 int line;
33 int revision; /* Chip revision (950) */
34 int xmit_fifo_size;
35 int custom_divisor;
36 int count;
37 u8 *iomem_base;
38 u16 iomem_reg_shift;
39 unsigned short close_delay;
40 unsigned short closing_wait; /* time to wait before closing */
41 unsigned long icount;
42 int io_type;
43 void *info;
44 void *dev;
45};
46#endif /* _PPC_BOOT_SERIAL_H */
diff --git a/arch/ppc/boot/ld.script b/arch/ppc/boot/ld.script
new file mode 100644
index 000000000000..6ee602d8b6a0
--- /dev/null
+++ b/arch/ppc/boot/ld.script
@@ -0,0 +1,88 @@
1OUTPUT_ARCH(powerpc)
2SECTIONS
3{
4 /* Read-only sections, merged into text segment: */
5 . = + SIZEOF_HEADERS;
6 .interp : { *(.interp) }
7 .hash : { *(.hash) }
8 .dynsym : { *(.dynsym) }
9 .dynstr : { *(.dynstr) }
10 .rel.text : { *(.rel.text) }
11 .rela.text : { *(.rela.text) }
12 .rel.data : { *(.rel.data) }
13 .rela.data : { *(.rela.data) }
14 .rel.rodata : { *(.rel.rodata) }
15 .rela.rodata : { *(.rela.rodata) }
16 .rel.got : { *(.rel.got) }
17 .rela.got : { *(.rela.got) }
18 .rel.ctors : { *(.rel.ctors) }
19 .rela.ctors : { *(.rela.ctors) }
20 .rel.dtors : { *(.rel.dtors) }
21 .rela.dtors : { *(.rela.dtors) }
22 .rel.bss : { *(.rel.bss) }
23 .rela.bss : { *(.rela.bss) }
24 .rel.plt : { *(.rel.plt) }
25 .rela.plt : { *(.rela.plt) }
26 .plt : { *(.plt) }
27 .text :
28 {
29 *(.text)
30 *(.fixup)
31 __relocate_start = .;
32 *(.relocate_code)
33 __relocate_end = .;
34 }
35 _etext = .;
36 PROVIDE (etext = .);
37
38 /* Read-write section, merged into data segment: */
39 . = ALIGN(4096);
40 .data :
41 {
42 *(.data)
43 *(.data1)
44 *(.data.boot)
45 *(.sdata)
46 *(.sdata2)
47 *(.got.plt) *(.got)
48 *(.dynamic)
49 *(.rodata)
50 *(.rodata.*)
51 *(.rodata1)
52 *(.got1)
53 __image_begin = .;
54 *(.image)
55 __image_end = .;
56 . = ALIGN(4096);
57 __ramdisk_begin = .;
58 *(.ramdisk)
59 __ramdisk_end = .;
60 . = ALIGN(4096);
61 __sysmap_begin = .;
62 *(.sysmap)
63 __sysmap_end = .;
64 CONSTRUCTORS
65 }
66 _edata = .;
67 PROVIDE (edata = .);
68
69 . = ALIGN(4096);
70 __bss_start = .;
71 .bss :
72 {
73 *(.sbss) *(.scommon)
74 *(.dynbss)
75 *(.bss)
76 *(COMMON)
77 }
78 _end = . ;
79 PROVIDE (end = .);
80
81 /DISCARD/ : {
82 *(__ksymtab)
83 *(__ksymtab_strings)
84 *(__bug_table)
85 *(__kcrctab)
86 }
87
88}
diff --git a/arch/ppc/boot/lib/Makefile b/arch/ppc/boot/lib/Makefile
new file mode 100644
index 000000000000..d4077e69086f
--- /dev/null
+++ b/arch/ppc/boot/lib/Makefile
@@ -0,0 +1,23 @@
1#
2# Makefile for some libs needed by zImage.
3#
4
5CFLAGS_kbd.o := -Idrivers/char
6CFLAGS_vreset.o := -I$(srctree)/arch/ppc/boot/include
7
8zlib := infblock.c infcodes.c inffast.c inflate.c inftrees.c infutil.c
9
10lib-y += $(zlib:.c=.o) div64.o
11lib-$(CONFIG_VGA_CONSOLE) += vreset.o kbd.o
12
13
14# zlib files needs header from their original place
15EXTRA_CFLAGS += -Ilib/zlib_inflate
16
17quiet_cmd_copy_zlib = COPY $@
18 cmd_copy_zlib = cat $< > $@
19
20$(addprefix $(obj)/,$(zlib)): $(obj)/%: $(srctree)/lib/zlib_inflate/%
21 $(call cmd,copy_zlib)
22
23clean-files := $(zlib)
diff --git a/arch/ppc/boot/lib/div64.S b/arch/ppc/boot/lib/div64.S
new file mode 100644
index 000000000000..3527569e9926
--- /dev/null
+++ b/arch/ppc/boot/lib/div64.S
@@ -0,0 +1,58 @@
1/*
2 * Divide a 64-bit unsigned number by a 32-bit unsigned number.
3 * This routine assumes that the top 32 bits of the dividend are
4 * non-zero to start with.
5 * On entry, r3 points to the dividend, which get overwritten with
6 * the 64-bit quotient, and r4 contains the divisor.
7 * On exit, r3 contains the remainder.
8 *
9 * Copyright (C) 2002 Paul Mackerras, IBM Corp.
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version
14 * 2 of the License, or (at your option) any later version.
15 */
16#include <asm/ppc_asm.h>
17#include <asm/processor.h>
18
19_GLOBAL(__div64_32)
20 lwz r5,0(r3) # get the dividend into r5/r6
21 lwz r6,4(r3)
22 cmplw r5,r4
23 li r7,0
24 li r8,0
25 blt 1f
26 divwu r7,r5,r4 # if dividend.hi >= divisor,
27 mullw r0,r7,r4 # quotient.hi = dividend.hi / divisor
28 subf. r5,r0,r5 # dividend.hi %= divisor
29 beq 3f
301: mr r11,r5 # here dividend.hi != 0
31 andis. r0,r5,0xc000
32 bne 2f
33 cntlzw r0,r5 # we are shifting the dividend right
34 li r10,-1 # to make it < 2^32, and shifting
35 srw r10,r10,r0 # the divisor right the same amount,
36 add r9,r4,r10 # rounding up (so the estimate cannot
37 andc r11,r6,r10 # ever be too large, only too small)
38 andc r9,r9,r10
39 or r11,r5,r11
40 rotlw r9,r9,r0
41 rotlw r11,r11,r0
42 divwu r11,r11,r9 # then we divide the shifted quantities
432: mullw r10,r11,r4 # to get an estimate of the quotient,
44 mulhwu r9,r11,r4 # multiply the estimate by the divisor,
45 subfc r6,r10,r6 # take the product from the divisor,
46 add r8,r8,r11 # and add the estimate to the accumulated
47 subfe. r5,r9,r5 # quotient
48 bne 1b
493: cmplw r6,r4
50 blt 4f
51 divwu r0,r6,r4 # perform the remaining 32-bit division
52 mullw r10,r0,r4 # and get the remainder
53 add r8,r8,r0
54 subf r6,r10,r6
554: stw r7,0(r3) # return the quotient in *r3
56 stw r8,4(r3)
57 mr r3,r6 # return the remainder in r3
58 blr
diff --git a/arch/ppc/boot/lib/kbd.c b/arch/ppc/boot/lib/kbd.c
new file mode 100644
index 000000000000..3931727434de
--- /dev/null
+++ b/arch/ppc/boot/lib/kbd.c
@@ -0,0 +1,248 @@
1#include <linux/keyboard.h>
2
3#include "defkeymap.c" /* yeah I know it's bad -- Cort */
4
5
6unsigned char shfts, ctls, alts, caps;
7
8#define KBDATAP 0x60 /* kbd data port */
9#define KBSTATUSPORT 0x61 /* kbd status */
10#define KBSTATP 0x64 /* kbd status port */
11#define KBINRDY 0x01
12#define KBOUTRDY 0x02
13
14extern unsigned char inb(int port);
15extern void outb(int port, char val);
16extern void puts(const char *);
17extern void puthex(unsigned long val);
18extern void udelay(long x);
19
20static int kbd(int noblock)
21{
22 unsigned char dt, brk, val;
23 unsigned code;
24loop:
25 if (noblock) {
26 if ((inb(KBSTATP) & KBINRDY) == 0)
27 return (-1);
28 } else while((inb(KBSTATP) & KBINRDY) == 0) ;
29
30 dt = inb(KBDATAP);
31
32 brk = dt & 0x80; /* brk == 1 on key release */
33 dt = dt & 0x7f; /* keycode */
34
35 if (shfts)
36 code = shift_map[dt];
37 else if (ctls)
38 code = ctrl_map[dt];
39 else
40 code = plain_map[dt];
41
42 val = KVAL(code);
43 switch (KTYP(code) & 0x0f) {
44 case KT_LATIN:
45 if (brk)
46 break;
47 if (alts)
48 val |= 0x80;
49 if (val == 0x7f) /* map delete to backspace */
50 val = '\b';
51 return val;
52
53 case KT_LETTER:
54 if (brk)
55 break;
56 if (caps)
57 val -= 'a'-'A';
58 return val;
59
60 case KT_SPEC:
61 if (brk)
62 break;
63 if (val == KVAL(K_CAPS))
64 caps = !caps;
65 else if (val == KVAL(K_ENTER)) {
66enter: /* Wait for key up */
67 while (1) {
68 while((inb(KBSTATP) & KBINRDY) == 0) ;
69 dt = inb(KBDATAP);
70 if (dt & 0x80) /* key up */ break;
71 }
72 return 10;
73 }
74 break;
75
76 case KT_PAD:
77 if (brk)
78 break;
79 if (val < 10)
80 return val;
81 if (val == KVAL(K_PENTER))
82 goto enter;
83 break;
84
85 case KT_SHIFT:
86 switch (val) {
87 case KG_SHIFT:
88 case KG_SHIFTL:
89 case KG_SHIFTR:
90 shfts = brk ? 0 : 1;
91 break;
92 case KG_ALT:
93 case KG_ALTGR:
94 alts = brk ? 0 : 1;
95 break;
96 case KG_CTRL:
97 case KG_CTRLL:
98 case KG_CTRLR:
99 ctls = brk ? 0 : 1;
100 break;
101 }
102 break;
103
104 case KT_LOCK:
105 switch (val) {
106 case KG_SHIFT:
107 case KG_SHIFTL:
108 case KG_SHIFTR:
109 if (brk)
110 shfts = !shfts;
111 break;
112 case KG_ALT:
113 case KG_ALTGR:
114 if (brk)
115 alts = !alts;
116 break;
117 case KG_CTRL:
118 case KG_CTRLL:
119 case KG_CTRLR:
120 if (brk)
121 ctls = !ctls;
122 break;
123 }
124 break;
125 }
126 if (brk) return (-1); /* Ignore initial 'key up' codes */
127 goto loop;
128}
129
130static int __kbdreset(void)
131{
132 unsigned char c;
133 int i, t;
134
135 /* flush input queue */
136 t = 2000;
137 while ((inb(KBSTATP) & KBINRDY))
138 {
139 (void)inb(KBDATAP);
140 if (--t == 0)
141 return 1;
142 }
143 /* Send self-test */
144 t = 20000;
145 while (inb(KBSTATP) & KBOUTRDY)
146 if (--t == 0)
147 return 2;
148 outb(KBSTATP,0xAA);
149 t = 200000;
150 while ((inb(KBSTATP) & KBINRDY) == 0) /* wait input ready */
151 if (--t == 0)
152 return 3;
153 if ((c = inb(KBDATAP)) != 0x55)
154 {
155 puts("Keyboard self test failed - result:");
156 puthex(c);
157 puts("\n");
158 }
159 /* Enable interrupts and keyboard controller */
160 t = 20000;
161 while (inb(KBSTATP) & KBOUTRDY)
162 if (--t == 0) return 4;
163 outb(KBSTATP,0x60);
164 t = 20000;
165 while (inb(KBSTATP) & KBOUTRDY)
166 if (--t == 0) return 5;
167 outb(KBDATAP,0x45);
168 for (i = 0; i < 10000; i++) udelay(1);
169
170 t = 20000;
171 while (inb(KBSTATP) & KBOUTRDY)
172 if (--t == 0) return 6;
173 outb(KBSTATP,0x20);
174 t = 200000;
175 while ((inb(KBSTATP) & KBINRDY) == 0) /* wait input ready */
176 if (--t == 0) return 7;
177 if (! (inb(KBDATAP) & 0x40)) {
178 /*
179 * Quote from PS/2 System Reference Manual:
180 *
181 * "Address hex 0060 and address hex 0064 should be
182 * written only when the input-buffer-full bit and
183 * output-buffer-full bit in the Controller Status
184 * register are set 0." (KBINRDY and KBOUTRDY)
185 */
186 t = 200000;
187 while (inb(KBSTATP) & (KBINRDY | KBOUTRDY))
188 if (--t == 0) return 8;
189 outb(KBDATAP,0xF0);
190 t = 200000;
191 while (inb(KBSTATP) & (KBINRDY | KBOUTRDY))
192 if (--t == 0) return 9;
193 outb(KBDATAP,0x01);
194 }
195 t = 20000;
196 while (inb(KBSTATP) & KBOUTRDY)
197 if (--t == 0) return 10;
198 outb(KBSTATP,0xAE);
199 return 0;
200}
201
202static void kbdreset(void)
203{
204 int ret = __kbdreset();
205
206 if (ret) {
207 puts("__kbdreset failed: ");
208 puthex(ret);
209 puts("\n");
210 }
211}
212
213/* We have to actually read the keyboard when CRT_tstc is called,
214 * since the pending data might be a key release code, and therefore
215 * not valid data. In this case, kbd() will return -1, even though there's
216 * data to be read. Of course, we might actually read a valid key press,
217 * in which case it gets queued into key_pending for use by CRT_getc.
218 */
219
220static int kbd_reset = 0;
221
222static int key_pending = -1;
223
224int CRT_getc(void)
225{
226 int c;
227 if (!kbd_reset) {kbdreset(); kbd_reset++; }
228
229 if (key_pending != -1) {
230 c = key_pending;
231 key_pending = -1;
232 return c;
233 } else {
234 while ((c = kbd(0)) == 0) ;
235 return c;
236 }
237}
238
239int CRT_tstc(void)
240{
241 if (!kbd_reset) {kbdreset(); kbd_reset++; }
242
243 while (key_pending == -1 && ((inb(KBSTATP) & KBINRDY) != 0)) {
244 key_pending = kbd(1);
245 }
246
247 return (key_pending != -1);
248}
diff --git a/arch/ppc/boot/lib/vreset.c b/arch/ppc/boot/lib/vreset.c
new file mode 100644
index 000000000000..463ba001fb9b
--- /dev/null
+++ b/arch/ppc/boot/lib/vreset.c
@@ -0,0 +1,805 @@
1/*
2 * vreset.c
3 *
4 * Initialize the VGA control registers to 80x25 text mode.
5 *
6 * Adapted from a program by:
7 * Steve Sellgren
8 * San Francisco Indigo Company
9 * sfindigo!sellgren@uunet.uu.net
10 *
11 * Original concept by:
12 * Gary Thomas <gdt@linuxppc.org>
13 * Adapted for Moto boxes by:
14 * Pat Kane & Mark Scott, 1996
15 * Adapted for IBM portables by:
16 * Takeshi Ishimoto
17 * Multi-console support:
18 * Terje Malmedal <terje.malmedal@usit.uio.no>
19 */
20
21#include "iso_font.h"
22#include "nonstdio.h"
23
24extern char *vidmem;
25extern int lines, cols;
26struct VaRegs;
27
28/*
29 * VGA Register
30 */
31struct VgaRegs
32{
33 unsigned short io_port;
34 unsigned char io_index;
35 unsigned char io_value;
36};
37
38void unlockVideo(int slot);
39void setTextRegs(struct VgaRegs *svp);
40void setTextCLUT(int shift);
41void clearVideoMemory(void);
42void loadFont(unsigned char *ISA_mem);
43
44static void mdelay(int ms)
45{
46 for (; ms > 0; --ms)
47 udelay(1000);
48}
49
50/*
51 * Default console text mode registers used to reset
52 * graphics adapter.
53 */
54#define NREGS 54
55#define ENDMK 0xFFFF /* End marker */
56
57#define S3Vendor 0x5333
58#define CirrusVendor 0x1013
59#define DiamondVendor 0x100E
60#define MatroxVendor 0x102B
61#define ParadiseVendor 0x101C
62
63struct VgaRegs GenVgaTextRegs[NREGS+1] = {
64 /* port index value */
65 /* SR Regs */
66 { 0x3c4, 0x1, 0x0 },
67 { 0x3c4, 0x2, 0x3 },
68 { 0x3c4, 0x3, 0x0 },
69 { 0x3c4, 0x4, 0x2 },
70 /* CR Regs */
71 { 0x3d4, 0x0, 0x5f },
72 { 0x3d4, 0x1, 0x4f },
73 { 0x3d4, 0x2, 0x50 },
74 { 0x3d4, 0x3, 0x82 },
75 { 0x3d4, 0x4, 0x55 },
76 { 0x3d4, 0x5, 0x81 },
77 { 0x3d4, 0x6, 0xbf },
78 { 0x3d4, 0x7, 0x1f },
79 { 0x3d4, 0x8, 0x00 },
80 { 0x3d4, 0x9, 0x4f },
81 { 0x3d4, 0xa, 0x0d },
82 { 0x3d4, 0xb, 0x0e },
83 { 0x3d4, 0xc, 0x00 },
84 { 0x3d4, 0xd, 0x00 },
85 { 0x3d4, 0xe, 0x00 },
86 { 0x3d4, 0xf, 0x00 },
87 { 0x3d4, 0x10, 0x9c },
88 { 0x3d4, 0x11, 0x8e },
89 { 0x3d4, 0x12, 0x8f },
90 { 0x3d4, 0x13, 0x28 },
91 { 0x3d4, 0x14, 0x1f },
92 { 0x3d4, 0x15, 0x96 },
93 { 0x3d4, 0x16, 0xb9 },
94 { 0x3d4, 0x17, 0xa3 },
95 /* GR Regs */
96 { 0x3ce, 0x0, 0x0 },
97 { 0x3ce, 0x1, 0x0 },
98 { 0x3ce, 0x2, 0x0 },
99 { 0x3ce, 0x3, 0x0 },
100 { 0x3ce, 0x4, 0x0 },
101 { 0x3ce, 0x5, 0x10 },
102 { 0x3ce, 0x6, 0xe },
103 { 0x3ce, 0x7, 0x0 },
104 { 0x3ce, 0x8, 0xff },
105 { ENDMK }
106};
107
108struct RGBColors
109{
110 unsigned char r, g, b;
111};
112
113/*
114 * Default console text mode color table.
115 * These values were obtained by booting Linux with
116 * text mode firmware & then dumping the registers.
117 */
118struct RGBColors TextCLUT[256] =
119{
120 /* red green blue */
121 { 0x0, 0x0, 0x0 },
122 { 0x0, 0x0, 0x2a },
123 { 0x0, 0x2a, 0x0 },
124 { 0x0, 0x2a, 0x2a },
125 { 0x2a, 0x0, 0x0 },
126 { 0x2a, 0x0, 0x2a },
127 { 0x2a, 0x2a, 0x0 },
128 { 0x2a, 0x2a, 0x2a },
129 { 0x0, 0x0, 0x15 },
130 { 0x0, 0x0, 0x3f },
131 { 0x0, 0x2a, 0x15 },
132 { 0x0, 0x2a, 0x3f },
133 { 0x2a, 0x0, 0x15 },
134 { 0x2a, 0x0, 0x3f },
135 { 0x2a, 0x2a, 0x15 },
136 { 0x2a, 0x2a, 0x3f },
137 { 0x0, 0x15, 0x0 },
138 { 0x0, 0x15, 0x2a },
139 { 0x0, 0x3f, 0x0 },
140 { 0x0, 0x3f, 0x2a },
141 { 0x2a, 0x15, 0x0 },
142 { 0x2a, 0x15, 0x2a },
143 { 0x2a, 0x3f, 0x0 },
144 { 0x2a, 0x3f, 0x2a },
145 { 0x0, 0x15, 0x15 },
146 { 0x0, 0x15, 0x3f },
147 { 0x0, 0x3f, 0x15 },
148 { 0x0, 0x3f, 0x3f },
149 { 0x2a, 0x15, 0x15 },
150 { 0x2a, 0x15, 0x3f },
151 { 0x2a, 0x3f, 0x15 },
152 { 0x2a, 0x3f, 0x3f },
153 { 0x15, 0x0, 0x0 },
154 { 0x15, 0x0, 0x2a },
155 { 0x15, 0x2a, 0x0 },
156 { 0x15, 0x2a, 0x2a },
157 { 0x3f, 0x0, 0x0 },
158 { 0x3f, 0x0, 0x2a },
159 { 0x3f, 0x2a, 0x0 },
160 { 0x3f, 0x2a, 0x2a },
161 { 0x15, 0x0, 0x15 },
162 { 0x15, 0x0, 0x3f },
163 { 0x15, 0x2a, 0x15 },
164 { 0x15, 0x2a, 0x3f },
165 { 0x3f, 0x0, 0x15 },
166 { 0x3f, 0x0, 0x3f },
167 { 0x3f, 0x2a, 0x15 },
168 { 0x3f, 0x2a, 0x3f },
169 { 0x15, 0x15, 0x0 },
170 { 0x15, 0x15, 0x2a },
171 { 0x15, 0x3f, 0x0 },
172 { 0x15, 0x3f, 0x2a },
173 { 0x3f, 0x15, 0x0 },
174 { 0x3f, 0x15, 0x2a },
175 { 0x3f, 0x3f, 0x0 },
176 { 0x3f, 0x3f, 0x2a },
177 { 0x15, 0x15, 0x15 },
178 { 0x15, 0x15, 0x3f },
179 { 0x15, 0x3f, 0x15 },
180 { 0x15, 0x3f, 0x3f },
181 { 0x3f, 0x15, 0x15 },
182 { 0x3f, 0x15, 0x3f },
183 { 0x3f, 0x3f, 0x15 },
184 { 0x3f, 0x3f, 0x3f },
185 { 0x39, 0xc, 0x5 },
186 { 0x15, 0x2c, 0xf },
187 { 0x26, 0x10, 0x3d },
188 { 0x29, 0x29, 0x38 },
189 { 0x4, 0x1a, 0xe },
190 { 0x2, 0x1e, 0x3a },
191 { 0x3c, 0x25, 0x33 },
192 { 0x3c, 0xc, 0x2c },
193 { 0x3f, 0x3, 0x2b },
194 { 0x1c, 0x9, 0x13 },
195 { 0x25, 0x2a, 0x35 },
196 { 0x1e, 0xa, 0x38 },
197 { 0x24, 0x8, 0x3 },
198 { 0x3, 0xe, 0x36 },
199 { 0xc, 0x6, 0x2a },
200 { 0x26, 0x3, 0x32 },
201 { 0x5, 0x2f, 0x33 },
202 { 0x3c, 0x35, 0x2f },
203 { 0x2d, 0x26, 0x3e },
204 { 0xd, 0xa, 0x10 },
205 { 0x25, 0x3c, 0x11 },
206 { 0xd, 0x4, 0x2e },
207 { 0x5, 0x19, 0x3e },
208 { 0xc, 0x13, 0x34 },
209 { 0x2b, 0x6, 0x24 },
210 { 0x4, 0x3, 0xd },
211 { 0x2f, 0x3c, 0xc },
212 { 0x2a, 0x37, 0x1f },
213 { 0xf, 0x12, 0x38 },
214 { 0x38, 0xe, 0x2a },
215 { 0x12, 0x2f, 0x19 },
216 { 0x29, 0x2e, 0x31 },
217 { 0x25, 0x13, 0x3e },
218 { 0x33, 0x3e, 0x33 },
219 { 0x1d, 0x2c, 0x25 },
220 { 0x15, 0x15, 0x5 },
221 { 0x32, 0x25, 0x39 },
222 { 0x1a, 0x7, 0x1f },
223 { 0x13, 0xe, 0x1d },
224 { 0x36, 0x17, 0x34 },
225 { 0xf, 0x15, 0x23 },
226 { 0x2, 0x35, 0xd },
227 { 0x15, 0x3f, 0xc },
228 { 0x14, 0x2f, 0xf },
229 { 0x19, 0x21, 0x3e },
230 { 0x27, 0x11, 0x2f },
231 { 0x38, 0x3f, 0x3c },
232 { 0x36, 0x2d, 0x15 },
233 { 0x16, 0x17, 0x2 },
234 { 0x1, 0xa, 0x3d },
235 { 0x1b, 0x11, 0x3f },
236 { 0x21, 0x3c, 0xd },
237 { 0x1a, 0x39, 0x3d },
238 { 0x8, 0xe, 0xe },
239 { 0x22, 0x21, 0x23 },
240 { 0x1e, 0x30, 0x5 },
241 { 0x1f, 0x22, 0x3d },
242 { 0x1e, 0x2f, 0xa },
243 { 0x0, 0x1c, 0xe },
244 { 0x0, 0x1c, 0x15 },
245 { 0x0, 0x1c, 0x1c },
246 { 0x0, 0x15, 0x1c },
247 { 0x0, 0xe, 0x1c },
248 { 0x0, 0x7, 0x1c },
249 { 0xe, 0xe, 0x1c },
250 { 0x11, 0xe, 0x1c },
251 { 0x15, 0xe, 0x1c },
252 { 0x18, 0xe, 0x1c },
253 { 0x1c, 0xe, 0x1c },
254 { 0x1c, 0xe, 0x18 },
255 { 0x1c, 0xe, 0x15 },
256 { 0x1c, 0xe, 0x11 },
257 { 0x1c, 0xe, 0xe },
258 { 0x1c, 0x11, 0xe },
259 { 0x1c, 0x15, 0xe },
260 { 0x1c, 0x18, 0xe },
261 { 0x1c, 0x1c, 0xe },
262 { 0x18, 0x1c, 0xe },
263 { 0x15, 0x1c, 0xe },
264 { 0x11, 0x1c, 0xe },
265 { 0xe, 0x1c, 0xe },
266 { 0xe, 0x1c, 0x11 },
267 { 0xe, 0x1c, 0x15 },
268 { 0xe, 0x1c, 0x18 },
269 { 0xe, 0x1c, 0x1c },
270 { 0xe, 0x18, 0x1c },
271 { 0xe, 0x15, 0x1c },
272 { 0xe, 0x11, 0x1c },
273 { 0x14, 0x14, 0x1c },
274 { 0x16, 0x14, 0x1c },
275 { 0x18, 0x14, 0x1c },
276 { 0x1a, 0x14, 0x1c },
277 { 0x1c, 0x14, 0x1c },
278 { 0x1c, 0x14, 0x1a },
279 { 0x1c, 0x14, 0x18 },
280 { 0x1c, 0x14, 0x16 },
281 { 0x1c, 0x14, 0x14 },
282 { 0x1c, 0x16, 0x14 },
283 { 0x1c, 0x18, 0x14 },
284 { 0x1c, 0x1a, 0x14 },
285 { 0x1c, 0x1c, 0x14 },
286 { 0x1a, 0x1c, 0x14 },
287 { 0x18, 0x1c, 0x14 },
288 { 0x16, 0x1c, 0x14 },
289 { 0x14, 0x1c, 0x14 },
290 { 0x14, 0x1c, 0x16 },
291 { 0x14, 0x1c, 0x18 },
292 { 0x14, 0x1c, 0x1a },
293 { 0x14, 0x1c, 0x1c },
294 { 0x14, 0x1a, 0x1c },
295 { 0x14, 0x18, 0x1c },
296 { 0x14, 0x16, 0x1c },
297 { 0x0, 0x0, 0x10 },
298 { 0x4, 0x0, 0x10 },
299 { 0x8, 0x0, 0x10 },
300 { 0xc, 0x0, 0x10 },
301 { 0x10, 0x0, 0x10 },
302 { 0x10, 0x0, 0xc },
303 { 0x10, 0x0, 0x8 },
304 { 0x10, 0x0, 0x4 },
305 { 0x10, 0x0, 0x0 },
306 { 0x10, 0x4, 0x0 },
307 { 0x10, 0x8, 0x0 },
308 { 0x10, 0xc, 0x0 },
309 { 0x10, 0x10, 0x0 },
310 { 0xc, 0x10, 0x0 },
311 { 0x8, 0x10, 0x0 },
312 { 0x4, 0x10, 0x0 },
313 { 0x0, 0x10, 0x0 },
314 { 0x0, 0x10, 0x4 },
315 { 0x0, 0x10, 0x8 },
316 { 0x0, 0x10, 0xc },
317 { 0x0, 0x10, 0x10 },
318 { 0x0, 0xc, 0x10 },
319 { 0x0, 0x8, 0x10 },
320 { 0x0, 0x4, 0x10 },
321 { 0x8, 0x8, 0x10 },
322 { 0xa, 0x8, 0x10 },
323 { 0xc, 0x8, 0x10 },
324 { 0xe, 0x8, 0x10 },
325 { 0x10, 0x8, 0x10 },
326 { 0x10, 0x8, 0xe },
327 { 0x10, 0x8, 0xc },
328 { 0x10, 0x8, 0xa },
329 { 0x10, 0x8, 0x8 },
330 { 0x10, 0xa, 0x8 },
331 { 0x10, 0xc, 0x8 },
332 { 0x10, 0xe, 0x8 },
333 { 0x10, 0x10, 0x8 },
334 { 0xe, 0x10, 0x8 },
335 { 0xc, 0x10, 0x8 },
336 { 0xa, 0x10, 0x8 },
337 { 0x8, 0x10, 0x8 },
338 { 0x8, 0x10, 0xa },
339 { 0x8, 0x10, 0xc },
340 { 0x8, 0x10, 0xe },
341 { 0x8, 0x10, 0x10 },
342 { 0x8, 0xe, 0x10 },
343 { 0x8, 0xc, 0x10 },
344 { 0x8, 0xa, 0x10 },
345 { 0xb, 0xb, 0x10 },
346 { 0xc, 0xb, 0x10 },
347 { 0xd, 0xb, 0x10 },
348 { 0xf, 0xb, 0x10 },
349 { 0x10, 0xb, 0x10 },
350 { 0x10, 0xb, 0xf },
351 { 0x10, 0xb, 0xd },
352 { 0x10, 0xb, 0xc },
353 { 0x10, 0xb, 0xb },
354 { 0x10, 0xc, 0xb },
355 { 0x10, 0xd, 0xb },
356 { 0x10, 0xf, 0xb },
357 { 0x10, 0x10, 0xb },
358 { 0xf, 0x10, 0xb },
359 { 0xd, 0x10, 0xb },
360 { 0xc, 0x10, 0xb },
361 { 0xb, 0x10, 0xb },
362 { 0xb, 0x10, 0xc },
363 { 0xb, 0x10, 0xd },
364 { 0xb, 0x10, 0xf },
365 { 0xb, 0x10, 0x10 },
366 { 0xb, 0xf, 0x10 },
367 { 0xb, 0xd, 0x10 },
368 { 0xb, 0xc, 0x10 },
369 { 0x0, 0x0, 0x0 },
370 { 0x0, 0x0, 0x0 },
371 { 0x0, 0x0, 0x0 },
372 { 0x0, 0x0, 0x0 },
373 { 0x0, 0x0, 0x0 },
374 { 0x0, 0x0, 0x0 },
375 { 0x0, 0x0, 0x0 }
376};
377
378unsigned char AC[21] = {
379 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07,
380 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
381 0x0C, 0x00, 0x0F, 0x08, 0x00};
382
383static int scanPCI(int start_slt);
384static int PCIVendor(int);
385#ifdef DEBUG
386static void printslots(void);
387#endif
388extern void puthex(unsigned long);
389extern void puts(const char *);
390static void unlockS3(void);
391
392static inline void
393outw(int port, unsigned short val)
394{
395 outb(port, val >> 8);
396 outb(port+1, val);
397}
398
399int
400vga_init(unsigned char *ISA_mem)
401{
402 int slot;
403 struct VgaRegs *VgaTextRegs;
404
405 /* See if VGA already in TEXT mode - exit if so! */
406 outb(0x3CE, 0x06);
407 if ((inb(0x3CF) & 0x01) == 0){
408 puts("VGA already in text mode\n");
409 return 0;
410 }
411
412 /* If no VGA responding in text mode, then we have some work to do...
413 */
414 slot = -1;
415 while((slot = scanPCI(slot)) > -1) { /* find video card in use */
416 unlockVideo(slot); /* enable I/O to card */
417 VgaTextRegs = GenVgaTextRegs;
418
419 switch (PCIVendor(slot)) {
420 default:
421 break;
422 case(S3Vendor):
423 unlockS3();
424 break;
425
426 case(CirrusVendor):
427 outw(0x3C4, 0x0612); /* unlock ext regs */
428 outw(0x3C4, 0x0700); /* reset ext sequence mode */
429 break;
430
431 case(ParadiseVendor): /* IBM Portable 850 */
432 outw(0x3ce, 0x0f05); /* unlock pardise registers */
433 outw(0x3c4, 0x0648);
434 outw(0x3d4, 0x2985);
435 outw(0x3d4, 0x34a6);
436 outb(0x3ce, 0x0b); /* disable linear addressing */
437 outb(0x3cf, inb(0x3cf) & ~0x30);
438 outw(0x3c4, 0x1400);
439 outb(0x3ce, 0x0e); /* disable 256 color mode */
440 outb(0x3cf, inb(0x3cf) & ~0x01);
441 outb(0xd00, 0xff); /* enable auto-centering */
442 if (!(inb(0xd01) & 0x03)) {
443 outb(0x3d4, 0x33);
444 outb(0x3d5, inb(0x3d5) & ~0x90);
445 outb(0x3d4, 0x32);
446 outb(0x3d5, inb(0x3d5) | 0x04);
447 outw(0x3d4, 0x0250);
448 outw(0x3d4, 0x07ba);
449 outw(0x3d4, 0x0900);
450 outw(0x3d4, 0x15e7);
451 outw(0x3d4, 0x2a95);
452 }
453 outw(0x3d4, 0x34a0);
454 break;
455
456 #if 0 /* Untested - probably doesn't work */
457 case(MatroxVendor):
458 case(DiamondVendor):
459 puts("VGA Chip Vendor ID: ");
460 puthex(PCIVendor(slot));
461 puts("\n");
462 mdelay(1000);
463 #endif
464 };
465
466 outw(0x3C4, 0x0120); /* disable video */
467 setTextRegs(VgaTextRegs); /* initial register setup */
468 setTextCLUT(0); /* load color lookup table */
469 loadFont(ISA_mem); /* load font */
470 setTextRegs(VgaTextRegs); /* reload registers */
471 outw(0x3C4, 0x0100); /* re-enable video */
472 clearVideoMemory();
473
474 if (PCIVendor(slot) == S3Vendor) {
475 outb(0x3c2, 0x63); /* MISC */
476 } /* endif */
477
478 #ifdef DEBUG
479 printslots();
480 mdelay(5000);
481 #endif
482
483 mdelay(1000); /* give time for the video monitor to come up */
484 }
485 return (1); /* 'CRT' I/O supported */
486}
487
488/*
489 * Write to VGA Attribute registers.
490 */
491void
492writeAttr(unsigned char index, unsigned char data, unsigned char videoOn)
493{
494 unsigned char v;
495 v = inb(0x3da); /* reset attr. address toggle */
496 if (videoOn)
497 outb(0x3c0, (index & 0x1F) | 0x20);
498 else
499 outb(0x3c0, (index & 0x1F));
500 outb(0x3c0, data);
501}
502
503void
504setTextRegs(struct VgaRegs *svp)
505{
506 int i;
507
508 /*
509 * saved settings
510 */
511 while( svp->io_port != ENDMK ) {
512 outb(svp->io_port, svp->io_index);
513 outb(svp->io_port+1, svp->io_value);
514 svp++;
515 }
516
517 outb(0x3c2, 0x67); /* MISC */
518 outb(0x3c6, 0xff); /* MASK */
519
520 for ( i = 0; i < 0x10; i++)
521 writeAttr(i, AC[i], 0); /* pallete */
522 writeAttr(0x10, 0x0c, 0); /* text mode */
523 writeAttr(0x11, 0x00, 0); /* overscan color (border) */
524 writeAttr(0x12, 0x0f, 0); /* plane enable */
525 writeAttr(0x13, 0x08, 0); /* pixel panning */
526 writeAttr(0x14, 0x00, 1); /* color select; video on */
527}
528
529void
530setTextCLUT(int shift)
531{
532 int i;
533
534 outb(0x3C6, 0xFF);
535 i = inb(0x3C7);
536 outb(0x3C8, 0);
537 i = inb(0x3C7);
538
539 for ( i = 0; i < 256; i++) {
540 outb(0x3C9, TextCLUT[i].r << shift);
541 outb(0x3C9, TextCLUT[i].g << shift);
542 outb(0x3C9, TextCLUT[i].b << shift);
543 }
544}
545
546void
547loadFont(unsigned char *ISA_mem)
548{
549 int i, j;
550 unsigned char *font_page = (unsigned char *) &ISA_mem[0xA0000];
551
552 outb(0x3C2, 0x67);
553 /*
554 * Load font
555 */
556 i = inb(0x3DA); /* Reset Attr toggle */
557
558 outb(0x3C0,0x30);
559 outb(0x3C0, 0x01); /* graphics mode */
560
561 outw(0x3C4, 0x0001); /* reset sequencer */
562 outw(0x3C4, 0x0204); /* write to plane 2 */
563 outw(0x3C4, 0x0406); /* enable plane graphics */
564 outw(0x3C4, 0x0003); /* reset sequencer */
565 outw(0x3CE, 0x0402); /* read plane 2 */
566 outw(0x3CE, 0x0500); /* write mode 0, read mode 0 */
567 outw(0x3CE, 0x0605); /* set graphics mode */
568
569 for (i = 0; i < sizeof(font); i += 16) {
570 for (j = 0; j < 16; j++) {
571 __asm__ volatile("eieio");
572 font_page[(2*i)+j] = font[i+j];
573 }
574 }
575}
576
577static void
578unlockS3(void)
579{
580 int s3_device_id;
581 outw(0x3d4, 0x3848);
582 outw(0x3d4, 0x39a5);
583 outb(0x3d4, 0x2d);
584 s3_device_id = inb(0x3d5) << 8;
585 outb(0x3d4, 0x2e);
586 s3_device_id |= inb(0x3d5);
587
588 if (s3_device_id != 0x8812) {
589 /* From the S3 manual */
590 outb(0x46E8, 0x10); /* Put into setup mode */
591 outb(0x3C3, 0x10);
592 outb(0x102, 0x01); /* Enable registers */
593 outb(0x46E8, 0x08); /* Enable video */
594 outb(0x3C3, 0x08);
595 outb(0x4AE8, 0x00);
596
597#if 0
598 outb(0x42E8, 0x80); /* Reset graphics engine? */
599#endif
600
601 outb(0x3D4, 0x38); /* Unlock all registers */
602 outb(0x3D5, 0x48);
603 outb(0x3D4, 0x39);
604 outb(0x3D5, 0xA5);
605 outb(0x3D4, 0x40);
606 outb(0x3D5, inb(0x3D5)|0x01);
607 outb(0x3D4, 0x33);
608 outb(0x3D5, inb(0x3D5)&~0x52);
609 outb(0x3D4, 0x35);
610 outb(0x3D5, inb(0x3D5)&~0x30);
611 outb(0x3D4, 0x3A);
612 outb(0x3D5, 0x00);
613 outb(0x3D4, 0x53);
614 outb(0x3D5, 0x00);
615 outb(0x3D4, 0x31);
616 outb(0x3D5, inb(0x3D5)&~0x4B);
617 outb(0x3D4, 0x58);
618
619 outb(0x3D5, 0);
620
621 outb(0x3D4, 0x54);
622 outb(0x3D5, 0x38);
623 outb(0x3D4, 0x60);
624 outb(0x3D5, 0x07);
625 outb(0x3D4, 0x61);
626 outb(0x3D5, 0x80);
627 outb(0x3D4, 0x62);
628 outb(0x3D5, 0xA1);
629 outb(0x3D4, 0x69); /* High order bits for cursor address */
630 outb(0x3D5, 0);
631
632 outb(0x3D4, 0x32);
633 outb(0x3D5, inb(0x3D5)&~0x10);
634 } else {
635 outw(0x3c4, 0x0806); /* IBM Portable 860 */
636 outw(0x3c4, 0x1041);
637 outw(0x3c4, 0x1128);
638 outw(0x3d4, 0x4000);
639 outw(0x3d4, 0x3100);
640 outw(0x3d4, 0x3a05);
641 outw(0x3d4, 0x6688);
642 outw(0x3d4, 0x5800); /* disable linear addressing */
643 outw(0x3d4, 0x4500); /* disable H/W cursor */
644 outw(0x3c4, 0x5410); /* enable auto-centering */
645 outw(0x3c4, 0x561f);
646 outw(0x3c4, 0x1b80); /* lock DCLK selection */
647 outw(0x3d4, 0x3900); /* lock S3 registers */
648 outw(0x3d4, 0x3800);
649 } /* endif */
650}
651
652/*
653 * cursor() sets an offset (0-1999) into the 80x25 text area.
654 */
655void
656cursor(int x, int y)
657{
658 int pos = (y*cols)+x;
659 outb(0x3D4, 14);
660 outb(0x3D5, pos >> 8);
661 outb(0x3D4, 15);
662 outb(0x3D5, pos);
663}
664
665void
666clearVideoMemory(void)
667{
668 int i, j;
669 for (i = 0; i < lines; i++) {
670 for (j = 0; j < cols; j++) {
671 vidmem[((i*cols)+j)*2] = 0x20; /* fill with space character */
672 vidmem[((i*cols)+j)*2+1] = 0x07; /* set bg & fg attributes */
673 }
674 }
675}
676
677/* ============ */
678
679
680#define NSLOTS 8
681#define NPCIREGS 5
682
683
684/*
685 should use devfunc number/indirect method to be totally safe on
686 all machines, this works for now on 3 slot Moto boxes
687*/
688
689struct PCI_ConfigInfo {
690 unsigned long * config_addr;
691 unsigned long regs[NPCIREGS];
692} PCI_slots [NSLOTS] = {
693
694 { (unsigned long *)0x80808000, {0xDEADBEEF,} }, /* onboard */
695 { (unsigned long *)0x80800800, {0xDEADBEEF,} }, /* onboard */
696 { (unsigned long *)0x80801000, {0xDEADBEEF,} }, /* onboard */
697 { (unsigned long *)0x80802000, {0xDEADBEEF,} }, /* onboard */
698 { (unsigned long *)0x80804000, {0xDEADBEEF,} }, /* onboard */
699 { (unsigned long *)0x80810000, {0xDEADBEEF,} }, /* slot A/1 */
700 { (unsigned long *)0x80820000, {0xDEADBEEF,} }, /* slot B/2 */
701 { (unsigned long *)0x80840000, {0xDEADBEEF,} } /* slot C/3 */
702};
703
704
705
706/*
707 * The following code modifies the PCI Command register
708 * to enable memory and I/O accesses.
709 */
710void
711unlockVideo(int slot)
712{
713 volatile unsigned char * ppci;
714
715 ppci = (unsigned char * )PCI_slots[slot].config_addr;
716 ppci[4] = 0x0003; /* enable memory and I/O accesses */
717 ppci[0x10] = 0x00000; /* turn off memory mapping */
718 ppci[0x11] = 0x00000; /* mem_base = 0 */
719 ppci[0x12] = 0x00000;
720 ppci[0x13] = 0x00000;
721 __asm__ volatile("eieio");
722
723 outb(0x3d4, 0x11);
724 outb(0x3d5, 0x0e); /* unlock CR0-CR7 */
725}
726
727long
728SwapBytes(long lv) /* turn little endian into big indian long */
729{
730 long t;
731 t = (lv&0x000000FF) << 24;
732 t |= (lv&0x0000FF00) << 8;
733 t |= (lv&0x00FF0000) >> 8;
734 t |= (lv&0xFF000000) >> 24;
735 return(t);
736}
737
738
739#define DEVID 0
740#define CMD 1
741#define CLASS 2
742#define MEMBASE 4
743
744int
745scanPCI(int start_slt)
746{
747 int slt, r;
748 struct PCI_ConfigInfo *pslot;
749 int theSlot = -1;
750 int highVgaSlot = 0;
751
752 for ( slt = start_slt + 1; slt < NSLOTS; slt++) {
753 pslot = &PCI_slots[slt];
754 for ( r = 0; r < NPCIREGS; r++) {
755 pslot->regs[r] = SwapBytes ( pslot->config_addr[r] );
756 }
757 /* card in slot ? */
758 if ( pslot->regs[DEVID] != 0xFFFFFFFF ) {
759 /* VGA ? */
760 if ( ((pslot->regs[CLASS] & 0xFFFFFF00) == 0x03000000) ||
761 ((pslot->regs[CLASS] & 0xFFFFFF00) == 0x00010000)) {
762 highVgaSlot = slt;
763 /* did firmware enable it ? */
764 if ( (pslot->regs[CMD] & 0x03) ) {
765 theSlot = slt;
766 break;
767 }
768 }
769 }
770 }
771
772 return ( theSlot );
773}
774
775/* return Vendor ID of card in the slot */
776static
777int PCIVendor(int slotnum) {
778 struct PCI_ConfigInfo *pslot;
779
780 pslot = &PCI_slots[slotnum];
781
782return (pslot->regs[DEVID] & 0xFFFF);
783}
784
785#ifdef DEBUG
786static
787void printslots(void)
788{
789 int i;
790#if 0
791 struct PCI_ConfigInfo *pslot;
792#endif
793 for(i=0; i < NSLOTS; i++) {
794#if 0
795 pslot = &PCI_slots[i];
796 printf("Slot: %d, Addr: %x, Vendor: %08x, Class: %08x\n",
797 i, pslot->config_addr, pslot->regs[0], pslot->regs[2]);
798#else
799 puts("PCI Slot number: "); puthex(i);
800 puts(" Vendor ID: ");
801 puthex(PCIVendor(i)); puts("\n");
802#endif
803 }
804}
805#endif /* DEBUG */
diff --git a/arch/ppc/boot/of1275/Makefile b/arch/ppc/boot/of1275/Makefile
new file mode 100644
index 000000000000..02e6f235d7cb
--- /dev/null
+++ b/arch/ppc/boot/of1275/Makefile
@@ -0,0 +1,6 @@
1#
2# Makefile of1275 stuff
3#
4
5lib-y := claim.o enter.o exit.o finddevice.o getprop.o ofinit.o \
6 ofstdio.o read.o release.o write.o map.o
diff --git a/arch/ppc/boot/of1275/claim.c b/arch/ppc/boot/of1275/claim.c
new file mode 100644
index 000000000000..e060292ae2a7
--- /dev/null
+++ b/arch/ppc/boot/of1275/claim.c
@@ -0,0 +1,34 @@
1/*
2 * Copyright (C) Paul Mackerras 1997.
3 * Copyright (C) Leigh Brown 2002.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10
11#include "of1275.h"
12
13void *
14claim(unsigned int virt, unsigned int size, unsigned int align)
15{
16 struct prom_args {
17 char *service;
18 int nargs;
19 int nret;
20 unsigned int virt;
21 unsigned int size;
22 unsigned int align;
23 void *ret;
24 } args;
25
26 args.service = "claim";
27 args.nargs = 3;
28 args.nret = 1;
29 args.virt = virt;
30 args.size = size;
31 args.align = align;
32 (*of_prom_entry)(&args);
33 return args.ret;
34}
diff --git a/arch/ppc/boot/of1275/enter.c b/arch/ppc/boot/of1275/enter.c
new file mode 100644
index 000000000000..abe87a8fe2db
--- /dev/null
+++ b/arch/ppc/boot/of1275/enter.c
@@ -0,0 +1,22 @@
1/*
2 * Copyright (C) Paul Mackerras 1997.
3 * Copyright (C) Leigh Brown 2002.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10
11#include "of1275.h"
12
13void
14enter(void)
15{
16 struct prom_args {
17 char *service;
18 } args;
19
20 args.service = "enter";
21 (*of_prom_entry)(&args);
22}
diff --git a/arch/ppc/boot/of1275/exit.c b/arch/ppc/boot/of1275/exit.c
new file mode 100644
index 000000000000..b9f89b6a8b45
--- /dev/null
+++ b/arch/ppc/boot/of1275/exit.c
@@ -0,0 +1,24 @@
1/*
2 * Copyright (C) Paul Mackerras 1997.
3 * Copyright (C) Leigh Brown 2002.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10
11#include "of1275.h"
12
13void
14exit(void)
15{
16 struct prom_args {
17 char *service;
18 } args;
19
20 for (;;) {
21 args.service = "exit";
22 (*of_prom_entry)(&args);
23 }
24}
diff --git a/arch/ppc/boot/of1275/finddevice.c b/arch/ppc/boot/of1275/finddevice.c
new file mode 100644
index 000000000000..2c0f7cbb793e
--- /dev/null
+++ b/arch/ppc/boot/of1275/finddevice.c
@@ -0,0 +1,31 @@
1/*
2 * Copyright (C) Paul Mackerras 1997.
3 * Copyright (C) Leigh Brown 2002.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10
11#include "of1275.h"
12
13phandle
14finddevice(const char *name)
15{
16 struct prom_args {
17 char *service;
18 int nargs;
19 int nret;
20 const char *devspec;
21 phandle device;
22 } args;
23
24 args.service = "finddevice";
25 args.nargs = 1;
26 args.nret = 1;
27 args.devspec = name;
28 args.device = OF_INVALID_HANDLE;
29 (*of_prom_entry)(&args);
30 return args.device;
31}
diff --git a/arch/ppc/boot/of1275/getprop.c b/arch/ppc/boot/of1275/getprop.c
new file mode 100644
index 000000000000..0cf75f035e4e
--- /dev/null
+++ b/arch/ppc/boot/of1275/getprop.c
@@ -0,0 +1,37 @@
1/*
2 * Copyright (C) Paul Mackerras 1997.
3 * Copyright (C) Leigh Brown 2002.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10
11#include "of1275.h"
12
13int
14getprop(phandle node, const char *name, void *buf, int buflen)
15{
16 struct prom_args {
17 char *service;
18 int nargs;
19 int nret;
20 phandle node;
21 const char *name;
22 void *buf;
23 int buflen;
24 int size;
25 } args;
26
27 args.service = "getprop";
28 args.nargs = 4;
29 args.nret = 1;
30 args.node = node;
31 args.name = name;
32 args.buf = buf;
33 args.buflen = buflen;
34 args.size = -1;
35 (*of_prom_entry)(&args);
36 return args.size;
37}
diff --git a/arch/ppc/boot/of1275/map.c b/arch/ppc/boot/of1275/map.c
new file mode 100644
index 000000000000..443256c6f6d6
--- /dev/null
+++ b/arch/ppc/boot/of1275/map.c
@@ -0,0 +1,48 @@
1/*
2 * Copyright (C) Paul Mackerras 1997.
3 * Copyright (C) Leigh Brown 2002.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10
11#include "of1275.h"
12#include "nonstdio.h"
13
14extern ihandle of_prom_mmu;
15
16int
17map(unsigned int phys, unsigned int virt, unsigned int size)
18{
19 struct prom_args {
20 char *service;
21 int nargs;
22 int nret;
23 char *method;
24 ihandle mmu_ihandle;
25 int misc;
26 unsigned int size;
27 unsigned int virt;
28 unsigned int phys;
29 int ret0;
30 } args;
31
32 if (of_prom_mmu == 0) {
33 printf("map() called, no MMU found\n");
34 return -1;
35 }
36 args.service = "call-method";
37 args.nargs = 6;
38 args.nret = 1;
39 args.method = "map";
40 args.mmu_ihandle = of_prom_mmu;
41 args.misc = 0;
42 args.phys = phys;
43 args.virt = virt;
44 args.size = size;
45 (*of_prom_entry)(&args);
46
47 return (int)args.ret0;
48}
diff --git a/arch/ppc/boot/of1275/ofinit.c b/arch/ppc/boot/of1275/ofinit.c
new file mode 100644
index 000000000000..0ee8af7639e9
--- /dev/null
+++ b/arch/ppc/boot/of1275/ofinit.c
@@ -0,0 +1,27 @@
1/*
2 * Copyright (C) Paul Mackerras 1997.
3 * Copyright (C) Leigh Brown 2002.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10
11#include "of1275.h"
12
13prom_entry of_prom_entry;
14ihandle of_prom_mmu;
15
16void
17ofinit(prom_entry prom_ptr)
18{
19 phandle chosen;
20
21 of_prom_entry = prom_ptr;
22
23 if ((chosen = finddevice("/chosen")) == OF_INVALID_HANDLE)
24 return;
25 if (getprop(chosen, "mmu", &of_prom_mmu, sizeof(ihandle)) != 4)
26 return;
27}
diff --git a/arch/ppc/boot/of1275/ofstdio.c b/arch/ppc/boot/of1275/ofstdio.c
new file mode 100644
index 000000000000..10abbe32b31f
--- /dev/null
+++ b/arch/ppc/boot/of1275/ofstdio.c
@@ -0,0 +1,32 @@
1/*
2 * Copyright (C) Paul Mackerras 1997.
3 * Copyright (C) Leigh Brown 2002.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10
11#include "of1275.h"
12
13int
14ofstdio(ihandle *stdin, ihandle *stdout, ihandle *stderr)
15{
16 ihandle in, out;
17 phandle chosen;
18
19 if ((chosen = finddevice("/chosen")) == OF_INVALID_HANDLE)
20 goto err;
21 if (getprop(chosen, "stdout", &out, sizeof(out)) != 4)
22 goto err;
23 if (getprop(chosen, "stdin", &in, sizeof(in)) != 4)
24 goto err;
25
26 *stdin = in;
27 *stdout = out;
28 *stderr = out;
29 return 0;
30err:
31 return -1;
32}
diff --git a/arch/ppc/boot/of1275/read.c b/arch/ppc/boot/of1275/read.c
new file mode 100644
index 000000000000..122813649fce
--- /dev/null
+++ b/arch/ppc/boot/of1275/read.c
@@ -0,0 +1,35 @@
1/*
2 * Copyright (C) Paul Mackerras 1997.
3 * Copyright (C) Leigh Brown 2002.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10
11#include "of1275.h"
12
13int
14read(ihandle instance, void *buf, int buflen)
15{
16 struct prom_args {
17 char *service;
18 int nargs;
19 int nret;
20 ihandle instance;
21 void *buf;
22 int buflen;
23 int actual;
24 } args;
25
26 args.service = "read";
27 args.nargs = 3;
28 args.nret = 1;
29 args.instance = instance;
30 args.buf = buf;
31 args.buflen = buflen;
32 args.actual = -1;
33 (*of_prom_entry)(&args);
34 return args.actual;
35}
diff --git a/arch/ppc/boot/of1275/release.c b/arch/ppc/boot/of1275/release.c
new file mode 100644
index 000000000000..28032d37145d
--- /dev/null
+++ b/arch/ppc/boot/of1275/release.c
@@ -0,0 +1,30 @@
1/*
2 * Copyright (C) Paul Mackerras 1997.
3 * Copyright (C) Leigh Brown 2002.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10
11#include "of1275.h"
12
13void
14release(void *virt, unsigned int size)
15{
16 struct prom_args {
17 char *service;
18 int nargs;
19 int nret;
20 void *virt;
21 unsigned int size;
22 } args;
23
24 args.service = "release";
25 args.nargs = 2;
26 args.nret = 0;
27 args.virt = virt;
28 args.size = size;
29 (*of_prom_entry)(&args);
30}
diff --git a/arch/ppc/boot/of1275/write.c b/arch/ppc/boot/of1275/write.c
new file mode 100644
index 000000000000..7361b9b2fca5
--- /dev/null
+++ b/arch/ppc/boot/of1275/write.c
@@ -0,0 +1,35 @@
1/*
2 * Copyright (C) Paul Mackerras 1997.
3 * Copyright (C) Leigh Brown 2002.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10
11#include "of1275.h"
12
13int
14write(ihandle instance, void *buf, int buflen)
15{
16 struct prom_args {
17 char *service;
18 int nargs;
19 int nret;
20 ihandle instance;
21 void *buf;
22 int buflen;
23 int actual;
24 } args;
25
26 args.service = "write";
27 args.nargs = 3;
28 args.nret = 1;
29 args.instance = instance;
30 args.buf = buf;
31 args.buflen = buflen;
32 args.actual = -1;
33 (*of_prom_entry)(&args);
34 return args.actual;
35}
diff --git a/arch/ppc/boot/openfirmware/Makefile b/arch/ppc/boot/openfirmware/Makefile
new file mode 100644
index 000000000000..4eacbd8c772a
--- /dev/null
+++ b/arch/ppc/boot/openfirmware/Makefile
@@ -0,0 +1,188 @@
1# Makefile for making bootable images on various OpenFirmware machines.
2#
3# Paul Mackerras January 1997
4# XCOFF bootable images for PowerMacs
5# Geert Uytterhoeven September 1997
6# ELF bootable iamges for CHRP machines.
7# Tom Rini January 2001
8# Cleaned up, moved into arch/ppc/boot/pmac
9# Tom Rini July/August 2002
10# Merged 'chrp' and 'pmac' into 'openfirmware', and cleaned up the
11# rules.
12
13zImage.initrd znetboot.initrd: del-ramdisk-sec := -R .ramdisk
14zImage.initrd znetboot.initrd: initrd := .initrd
15
16
17boot := arch/ppc/boot
18common := $(boot)/common
19utils := $(boot)/utils
20bootlib := $(boot)/lib
21of1275 := $(boot)/of1275
22images := $(boot)/images
23
24OBJCOPY_ARGS := -O aixcoff-rs6000 -R .stab -R .stabstr -R .comment
25COFF_LD_ARGS := -T $(srctree)/$(boot)/ld.script -e _start -Ttext 0x00500000 \
26 -Bstatic
27CHRP_LD_ARGS := -T $(srctree)/$(boot)/ld.script -e _start -Ttext 0x00800000
28NEWWORLD_LD_ARGS:= -T $(srctree)/$(boot)/ld.script -e _start -Ttext 0x01000000
29
30COMMONOBJS := start.o misc.o common.o
31COFFOBJS := coffcrt0.o $(COMMONOBJS) coffmain.o
32CHRPOBJS := crt0.o $(COMMONOBJS) chrpmain.o
33NEWWORLDOBJS := crt0.o $(COMMONOBJS) newworldmain.o
34
35targets := $(COFFOBJS) $(CHRPOBJS) $(NEWWORLDOBJS) dummy.o
36COFFOBJS := $(addprefix $(obj)/, $(COFFOBJS))
37CHRPOBJS := $(addprefix $(obj)/, $(CHRPOBJS))
38NEWWORLDOBJS := $(addprefix $(obj)/, $(NEWWORLDOBJS))
39
40LIBS := lib/lib.a $(bootlib)/lib.a $(of1275)/lib.a $(common)/lib.a
41
42HACKCOFF := $(utils)/hack-coff
43
44ifdef CONFIG_SMP
45END := .smp
46endif
47ifdef CONFIG_PPC64BRIDGE
48END += .64
49endif
50
51
52$(images)/ramdisk.image.gz:
53 @echo ' MISSING $@'
54 @echo ' RAM disk image must be provided separately'
55 @/bin/false
56
57objcpxmon-$(CONFIG_XMON) := --add-section=.sysmap=System.map \
58 --set-section-flags=.sysmap=contents,alloc,load,readonly,data
59quiet_cmd_genimage = GEN $@
60 cmd_genimage = $(OBJCOPY) -R .comment \
61 --add-section=.image=$(images)/vmlinux.gz \
62 --set-section-flags=.image=contents,alloc,load,readonly,data \
63 $(objcpxmon-y) $< $@
64
65targets += image.o
66$(obj)/image.o: $(obj)/dummy.o $(images)/vmlinux.gz FORCE
67 $(call if_changed,genimage)
68
69# Place the ramdisk in the initrd image.
70quiet_cmd_genimage-initrd = GEN $@
71 cmd_genimage-initrd = $(OBJCOPY) $< $@ \
72 --add-section=.ramdisk=$(images)/ramdisk.image.gz \
73 --set-section-flags=.ramdisk=contents,alloc,load,readonly,data
74targets += image.initrd.o
75$(obj)/image.initrd.o: $(obj)/image.o $(images)/ramdisk.image.gz FORCE
76 $(call if_changed,genimage-initrd)
77
78# Create the note section for New-World PowerMacs.
79quiet_cmd_mknote = MKNOTE $@
80 cmd_mknote = $(utils)/mknote > $@
81targets += note
82$(obj)/note: $(utils)/mknote FORCE
83 $(call if_changed,mknote)
84
85
86$(obj)/coffcrt0.o: EXTRA_AFLAGS := -traditional -DXCOFF
87$(obj)/crt0.o: EXTRA_AFLAGS := -traditional
88targets += coffcrt0.o crt0.o
89$(obj)/coffcrt0.o $(obj)/crt0.o: $(common)/crt0.S FORCE
90 $(call if_changed_dep,as_o_S)
91
92quiet_cmd_gencoffb = COFF $@
93 cmd_gencoffb = $(LD) -o $@ $(COFF_LD_ARGS) $(COFFOBJS) $< $(LIBS) && \
94 $(OBJCOPY) $@ $@ -R .comment $(del-ramdisk-sec)
95targets += coffboot
96$(obj)/coffboot: $(obj)/image.o $(COFFOBJS) $(LIBS) $(srctree)/$(boot)/ld.script FORCE
97 $(call if_changed,gencoffb)
98targets += coffboot.initrd
99$(obj)/coffboot.initrd: $(obj)/image.initrd.o $(COFFOBJS) $(LIBS) \
100 $(srctree)/$(boot)/ld.script FORCE
101 $(call if_changed,gencoffb)
102
103
104quiet_cmd_gen-coff = COFF $@
105 cmd_gen-coff = $(OBJCOPY) $(OBJCOPY_ARGS) $< $@ && \
106 $(HACKCOFF) $@ && \
107 ln -sf $(notdir $@) $(images)/zImage$(initrd).pmac
108
109$(images)/vmlinux.coff: $(obj)/coffboot
110 $(call cmd,gen-coff)
111
112$(images)/vmlinux.initrd.coff: $(obj)/coffboot.initrd
113 $(call cmd,gen-coff)
114
115quiet_cmd_gen-elf-pmac = ELF $@
116 cmd_gen-elf-pmac = $(LD) $(NEWWORLD_LD_ARGS) -o $@ \
117 $(NEWWORLDOBJS) $(LIBS) $< && \
118 $(OBJCOPY) $@ $@ --add-section=.note=$(obj)/note \
119 -R .comment $(del-ramdisk-sec)
120
121$(images)/vmlinux.elf-pmac: $(obj)/image.o $(NEWWORLDOBJS) $(LIBS) \
122 $(obj)/note $(srctree)/$(boot)/ld.script
123 $(call cmd,gen-elf-pmac)
124$(images)/vmlinux.initrd.elf-pmac: $(obj)/image.initrd.o $(NEWWORLDOBJS) \
125 $(LIBS) $(obj)/note \
126 $(srctree)/$(boot)/ld.script
127 $(call cmd,gen-elf-pmac)
128
129quiet_cmd_gen-chrp = CHRP $@
130 cmd_gen-chrp = $(LD) $(CHRP_LD_ARGS) -o $@ $(CHRPOBJS) $< $(LIBS) && \
131 $(OBJCOPY) $@ $@ -R .comment $(del-ramdisk-sec)
132
133$(images)/zImage.chrp: $(obj)/image.o $(CHRPOBJS) $(LIBS) \
134 $(srctree)/$(boot)/ld.script
135 $(call cmd,gen-chrp)
136$(images)/zImage.initrd.chrp: $(obj)/image.initrd.o $(CHRPOBJS) $(LIBS) \
137 $(srctree)/$(boot)/ld.script
138 $(call cmd,gen-chrp)
139
140quiet_cmd_addnote = ADDNOTE $@
141 cmd_addnote = cat $< > $@ && $(utils)/addnote $@
142$(images)/zImage.chrp-rs6k $(images)/zImage.initrd.chrp-rs6k: \
143 %-rs6k: %
144 $(call cmd,addnote)
145
146quiet_cmd_gen-miboot = GEN $@
147 cmd_gen-miboot = $(OBJCOPY) $(OBJCOPY_ARGS) \
148 --add-section=$1=$(word 2, $^) $< $@
149$(images)/miboot.image: $(obj)/dummy.o $(images)/vmlinux.gz
150 $(call cmd,gen-miboot,image)
151
152$(images)/miboot.initrd.image: $(images)/miboot.image $(images)/ramdisk.image.gz
153 $(call cmd,gen-miboot,initrd)
154
155# The targets used on the make command-line
156
157.PHONY: zImage zImage.initrd
158zImage: $(images)/vmlinux.coff \
159 $(images)/vmlinux.elf-pmac \
160 $(images)/zImage.chrp \
161 $(images)/zImage.chrp-rs6k \
162 $(images)/miboot.image
163 @echo ' kernel: $@ is ready ($<)'
164zImage.initrd: $(images)/vmlinux.initrd.coff \
165 $(images)/vmlinux.initrd.elf-pmac \
166 $(images)/zImage.initrd.chrp \
167 $(images)/zImage.initrd.chrp-rs6k \
168 $(images)/miboot.initrd.image
169 @echo ' kernel: $@ is ready ($<)'
170
171TFTPIMAGE := /tftpboot/zImage
172
173.PHONY: znetboot znetboot.initrd
174znetboot: $(images)/vmlinux.coff \
175 $(images)/vmlinux.elf-pmac \
176 $(images)/zImage.chrp
177 cp $(images)/vmlinux.coff $(TFTPIMAGE).pmac$(END)
178 cp $(images)/vmlinux.elf-pmac $(TFTPIMAGE).pmac$(END).elf
179 cp $(images)/zImage.chrp $(TFTPIMAGE).chrp$(END)
180 @echo ' kernel: $@ is ready ($<)'
181znetboot.initrd:$(images)/vmlinux.initrd.coff \
182 $(images)/vmlinux.initrd.elf-pmac \
183 $(images)/zImage.initrd.chrp
184 cp $(images)/vmlinux.initrd.coff $(TFTPIMAGE).pmac$(END)
185 cp $(images)/vmlinux.initrd.elf-pmac $(TFTPIMAGE).pmac$(END).elf
186 cp $(images)/zImage.initrd.chrp $(TFTPIMAGE).chrp$(END)
187 @echo ' kernel: $@ is ready ($<)'
188
diff --git a/arch/ppc/boot/openfirmware/chrpmain.c b/arch/ppc/boot/openfirmware/chrpmain.c
new file mode 100644
index 000000000000..6fb4f738728c
--- /dev/null
+++ b/arch/ppc/boot/openfirmware/chrpmain.c
@@ -0,0 +1,101 @@
1/*
2 * Copyright (C) Paul Mackerras 1997.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9#include <linux/string.h>
10#include "nonstdio.h"
11#include "of1275.h"
12#include <asm/processor.h>
13#include <asm/page.h>
14
15/* Passed from the linker */
16extern char __image_begin, __image_end;
17extern char __ramdisk_begin, __ramdisk_end;
18extern char _start, _end;
19
20extern unsigned int heap_max;
21extern void flush_cache(void *, unsigned long);
22extern void gunzip(void *, int, unsigned char *, int *);
23extern void make_bi_recs(unsigned long addr, char *name, unsigned int mach,
24 unsigned int progend);
25
26char *avail_ram;
27char *begin_avail, *end_avail;
28char *avail_high;
29
30#define RAM_START 0x00000000
31#define RAM_END (64<<20)
32
33#define BOOT_START ((unsigned long)_start)
34#define BOOT_END ((unsigned long)(_end + 0xFFF) & ~0xFFF)
35
36#define RAM_FREE ((unsigned long)(_end+0x1000)&~0xFFF)
37#define PROG_START 0x00010000
38#define PROG_SIZE 0x007f0000 /* 8MB */
39
40#define SCRATCH_SIZE (128 << 10)
41
42static char scratch[SCRATCH_SIZE]; /* 1MB of scratch space for gunzip */
43
44typedef void (*kernel_start_t)(int, int, void *, unsigned int, unsigned int);
45
46void
47boot(int a1, int a2, void *prom)
48{
49 unsigned sa, len;
50 void *dst;
51 unsigned char *im;
52 unsigned int initrd_size, initrd_start;
53
54 printf("chrpboot starting: loaded at 0x%p\n\r", &_start);
55
56 initrd_size = &__ramdisk_end - &__ramdisk_begin;
57 if (initrd_size) {
58 initrd_start = (RAM_END - initrd_size) & ~0xFFF;
59 a1 = initrd_start;
60 a2 = initrd_size;
61 claim(initrd_start, RAM_END - initrd_start, 0);
62 printf("initial ramdisk moving 0x%x <- 0x%p (%x bytes)\n\r",
63 initrd_start, &__ramdisk_begin, initrd_size);
64 memcpy((char *)initrd_start, &__ramdisk_begin, initrd_size);
65 } else {
66 initrd_start = 0;
67 initrd_size = 0;
68 a2 = 0xdeadbeef;
69 }
70
71 im = &__image_begin;
72 len = &__image_end - &__image_begin;
73 /* claim 4MB starting at PROG_START */
74 claim(PROG_START, PROG_SIZE - PROG_START, 0);
75 dst = (void *) PROG_START;
76 if (im[0] == 0x1f && im[1] == 0x8b) {
77 avail_ram = scratch;
78 begin_avail = avail_high = avail_ram;
79 end_avail = scratch + sizeof(scratch);
80 printf("gunzipping (0x%p <- 0x%p:0x%p)...", dst, im, im+len);
81 gunzip(dst, 0x400000, im, &len);
82 printf("done %u bytes\n\r", len);
83 printf("%u bytes of heap consumed, max in use %u\n\r",
84 avail_high - begin_avail, heap_max);
85 } else {
86 memmove(dst, im, len);
87 }
88
89 flush_cache(dst, len);
90 make_bi_recs(((unsigned long) dst + len), "chrpboot", _MACH_chrp,
91 (PROG_START + PROG_SIZE));
92
93 sa = PROG_START;
94 printf("start address = 0x%x\n\r", sa);
95
96 (*(kernel_start_t)sa)(a1, a2, prom, initrd_start, initrd_size);
97
98 printf("returned?\n\r");
99
100 pause();
101}
diff --git a/arch/ppc/boot/openfirmware/coffmain.c b/arch/ppc/boot/openfirmware/coffmain.c
new file mode 100644
index 000000000000..04ba9d57e110
--- /dev/null
+++ b/arch/ppc/boot/openfirmware/coffmain.c
@@ -0,0 +1,101 @@
1/*
2 * Copyright (C) Paul Mackerras 1997.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9#include <linux/string.h>
10#include <asm/processor.h>
11#include <asm/page.h>
12
13#include "nonstdio.h"
14#include "of1275.h"
15
16/* Passed from the linker */
17extern char __image_begin, __image_end;
18extern char __ramdisk_begin[], __ramdisk_end;
19extern char _start, _end;
20
21extern char image_data[], initrd_data[];
22extern int initrd_len, image_len;
23extern unsigned int heap_max;
24extern void flush_cache(void *start, unsigned int len);
25extern void gunzip(void *, int, unsigned char *, int *);
26extern void make_bi_recs(unsigned long addr, char *name, unsigned int mach,
27 unsigned int progend);
28extern void setup_bats(unsigned long start);
29
30char *avail_ram;
31char *begin_avail, *end_avail;
32char *avail_high;
33
34#define SCRATCH_SIZE (128 << 10)
35
36static char heap[SCRATCH_SIZE];
37
38static unsigned long ram_start = 0;
39static unsigned long ram_end = 0x1000000;
40
41static unsigned long prog_start = 0x900000;
42static unsigned long prog_size = 0x700000;
43
44typedef void (*kernel_start_t)(int, int, void *);
45
46void boot(int a1, int a2, void *prom)
47{
48 unsigned sa, len;
49 void *dst;
50 unsigned char *im;
51 unsigned initrd_start, initrd_size;
52
53 printf("coffboot starting: loaded at 0x%p\n", &_start);
54 setup_bats(ram_start);
55
56 initrd_size = (char *)(&__ramdisk_end) - (char *)(&__ramdisk_begin);
57 if (initrd_size) {
58 initrd_start = (ram_end - initrd_size) & ~0xFFF;
59 a1 = initrd_start;
60 a2 = initrd_size;
61 claim(initrd_start, ram_end - initrd_start, 0);
62 printf("initial ramdisk moving 0x%x <- 0x%p (%x bytes)\n\r",
63 initrd_start, (char *)(&__ramdisk_begin), initrd_size);
64 memcpy((char *)initrd_start, (char *)(&__ramdisk_begin), initrd_size);
65 prog_size = initrd_start - prog_start;
66 } else
67 a2 = 0xdeadbeef;
68
69 im = (char *)(&__image_begin);
70 len = (char *)(&__image_end) - (char *)(&__image_begin);
71 /* claim 4MB starting at PROG_START */
72 claim(prog_start, prog_size, 0);
73 map(prog_start, prog_start, prog_size);
74 dst = (void *) prog_start;
75 if (im[0] == 0x1f && im[1] == 0x8b) {
76 /* set up scratch space */
77 begin_avail = avail_high = avail_ram = heap;
78 end_avail = heap + sizeof(heap);
79 printf("heap at 0x%p\n", avail_ram);
80 printf("gunzipping (0x%p <- 0x%p:0x%p)...", dst, im, im+len);
81 gunzip(dst, prog_size, im, &len);
82 printf("done %u bytes\n", len);
83 printf("%u bytes of heap consumed, max in use %u\n",
84 avail_high - begin_avail, heap_max);
85 } else {
86 memmove(dst, im, len);
87 }
88
89 flush_cache(dst, len);
90 make_bi_recs(((unsigned long) dst + len), "coffboot", _MACH_Pmac,
91 (prog_start + prog_size));
92
93 sa = (unsigned long)prog_start;
94 printf("start address = 0x%x\n", sa);
95
96 (*(kernel_start_t)sa)(a1, a2, prom);
97
98 printf("returned?\n");
99
100 pause();
101}
diff --git a/arch/ppc/boot/openfirmware/common.c b/arch/ppc/boot/openfirmware/common.c
new file mode 100644
index 000000000000..9e6952781f1f
--- /dev/null
+++ b/arch/ppc/boot/openfirmware/common.c
@@ -0,0 +1,162 @@
1/*
2 * Copyright (C) Paul Mackerras 1997.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9
10#include "nonstdio.h"
11#include "of1275.h"
12#include <linux/string.h>
13#include <linux/zlib.h>
14#include <asm/bootinfo.h>
15#include <asm/page.h>
16
17/* Information from the linker */
18extern char __sysmap_begin, __sysmap_end;
19
20extern int strcmp(const char *s1, const char *s2);
21extern char *avail_ram, *avail_high;
22extern char *end_avail;
23
24unsigned int heap_use, heap_max;
25
26struct memchunk {
27 unsigned int size;
28 struct memchunk *next;
29};
30
31static struct memchunk *freechunks;
32
33static void *zalloc(unsigned size)
34{
35 void *p;
36 struct memchunk **mpp, *mp;
37
38 size = (size + 7) & -8;
39 heap_use += size;
40 if (heap_use > heap_max)
41 heap_max = heap_use;
42 for (mpp = &freechunks; (mp = *mpp) != 0; mpp = &mp->next) {
43 if (mp->size == size) {
44 *mpp = mp->next;
45 return mp;
46 }
47 }
48 p = avail_ram;
49 avail_ram += size;
50 if (avail_ram > avail_high)
51 avail_high = avail_ram;
52 if (avail_ram > end_avail) {
53 printf("oops... out of memory\n\r");
54 pause();
55 }
56 return p;
57}
58
59#define HEAD_CRC 2
60#define EXTRA_FIELD 4
61#define ORIG_NAME 8
62#define COMMENT 0x10
63#define RESERVED 0xe0
64
65void gunzip(void *dst, int dstlen, unsigned char *src, int *lenp)
66{
67 z_stream s;
68 int r, i, flags;
69
70 /* skip header */
71 i = 10;
72 flags = src[3];
73 if (src[2] != Z_DEFLATED || (flags & RESERVED) != 0) {
74 printf("bad gzipped data\n\r");
75 exit();
76 }
77 if ((flags & EXTRA_FIELD) != 0)
78 i = 12 + src[10] + (src[11] << 8);
79 if ((flags & ORIG_NAME) != 0)
80 while (src[i++] != 0)
81 ;
82 if ((flags & COMMENT) != 0)
83 while (src[i++] != 0)
84 ;
85 if ((flags & HEAD_CRC) != 0)
86 i += 2;
87 if (i >= *lenp) {
88 printf("gunzip: ran out of data in header\n\r");
89 exit();
90 }
91
92 /* Initialize ourself. */
93 s.workspace = zalloc(zlib_inflate_workspacesize());
94 r = zlib_inflateInit2(&s, -MAX_WBITS);
95 if (r != Z_OK) {
96 printf("zlib_inflateInit2 returned %d\n\r", r);
97 exit();
98 }
99 s.next_in = src + i;
100 s.avail_in = *lenp - i;
101 s.next_out = dst;
102 s.avail_out = dstlen;
103 r = zlib_inflate(&s, Z_FINISH);
104 if (r != Z_OK && r != Z_STREAM_END) {
105 printf("inflate returned %d msg: %s\n\r", r, s.msg);
106 exit();
107 }
108 *lenp = s.next_out - (unsigned char *) dst;
109 zlib_inflateEnd(&s);
110}
111
112/* Make a bi_rec in OF. We need to be passed a name for BI_BOOTLOADER_ID,
113 * a machine type for BI_MACHTYPE, and the location where the end of the
114 * bootloader is (PROG_START + PROG_SIZE)
115 */
116void make_bi_recs(unsigned long addr, char *name, unsigned int mach,
117 unsigned long progend)
118{
119 unsigned long sysmap_size;
120 struct bi_record *rec;
121
122 /* Figure out the size of a possible System.map we're going to
123 * pass along.
124 * */
125 sysmap_size = (unsigned long)(&__sysmap_end) -
126 (unsigned long)(&__sysmap_begin);
127
128 /* leave a 1MB gap then align to the next 1MB boundary */
129 addr = _ALIGN(addr+ (1<<20) - 1, (1<<20));
130 /* oldworld machine seem very unhappy about this. -- Tom */
131 if (addr >= progend)
132 claim(addr, 0x1000, 0);
133
134 rec = (struct bi_record *)addr;
135 rec->tag = BI_FIRST;
136 rec->size = sizeof(struct bi_record);
137 rec = (struct bi_record *)((unsigned long)rec + rec->size);
138
139 rec->tag = BI_BOOTLOADER_ID;
140 sprintf( (char *)rec->data, name);
141 rec->size = sizeof(struct bi_record) + strlen(name) + 1;
142 rec = (struct bi_record *)((unsigned long)rec + rec->size);
143
144 rec->tag = BI_MACHTYPE;
145 rec->data[0] = mach;
146 rec->data[1] = 1;
147 rec->size = sizeof(struct bi_record) + 2 * sizeof(unsigned long);
148 rec = (struct bi_record *)((unsigned long)rec + rec->size);
149
150 if (sysmap_size) {
151 rec->tag = BI_SYSMAP;
152 rec->data[0] = (unsigned long)(&__sysmap_begin);
153 rec->data[1] = sysmap_size;
154 rec->size = sizeof(struct bi_record) + 2 *
155 sizeof(unsigned long);
156 rec = (struct bi_record *)((unsigned long)rec + rec->size);
157 }
158
159 rec->tag = BI_LAST;
160 rec->size = sizeof(struct bi_record);
161 rec = (struct bi_record *)((unsigned long)rec + rec->size);
162}
diff --git a/arch/ppc/boot/openfirmware/dummy.c b/arch/ppc/boot/openfirmware/dummy.c
new file mode 100644
index 000000000000..31dbf45bf99c
--- /dev/null
+++ b/arch/ppc/boot/openfirmware/dummy.c
@@ -0,0 +1,4 @@
1int main(void)
2{
3 return 0;
4}
diff --git a/arch/ppc/boot/openfirmware/misc.S b/arch/ppc/boot/openfirmware/misc.S
new file mode 100644
index 000000000000..ab9e897cadd0
--- /dev/null
+++ b/arch/ppc/boot/openfirmware/misc.S
@@ -0,0 +1,67 @@
1/*
2 * Copyright (C) Paul Mackerras 1997.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9 .text
10
11/*
12 * Use the BAT2 & 3 registers to map the 1st 16MB of RAM to
13 * the address given as the 1st argument.
14 */
15 .globl setup_bats
16setup_bats:
17 mfpvr 5
18 rlwinm 5,5,16,16,31 /* r3 = 1 for 601, 4 for 604 */
19 cmpwi 0,5,1
20 li 0,0
21 bne 4f
22 mtibatl 3,0 /* invalidate BAT first */
23 ori 3,3,4 /* set up BAT registers for 601 */
24 li 4,0x7f
25 mtibatu 2,3
26 mtibatl 2,4
27 oris 3,3,0x80
28 oris 4,4,0x80
29 mtibatu 3,3
30 mtibatl 3,4
31 b 5f
324: mtdbatu 3,0 /* invalidate BATs first */
33 mtibatu 3,0
34 ori 3,3,0xff /* set up BAT registers for 604 */
35 li 4,2
36 mtdbatl 2,4
37 mtdbatu 2,3
38 mtibatl 2,4
39 mtibatu 2,3
40 oris 3,3,0x80
41 oris 4,4,0x80
42 mtdbatl 3,4
43 mtdbatu 3,3
44 mtibatl 3,4
45 mtibatu 3,3
465: sync
47 isync
48 blr
49
50/*
51 * Flush the dcache and invalidate the icache for a range of addresses.
52 *
53 * flush_cache(addr, len)
54 */
55 .global flush_cache
56flush_cache:
57 addi 4,4,0x1f /* len = (len + 0x1f) / 0x20 */
58 rlwinm. 4,4,27,5,31
59 mtctr 4
60 beqlr
611: dcbf 0,3
62 icbi 0,3
63 addi 3,3,0x20
64 bdnz 1b
65 sync
66 isync
67 blr
diff --git a/arch/ppc/boot/openfirmware/newworldmain.c b/arch/ppc/boot/openfirmware/newworldmain.c
new file mode 100644
index 000000000000..fa8a8f9313f9
--- /dev/null
+++ b/arch/ppc/boot/openfirmware/newworldmain.c
@@ -0,0 +1,94 @@
1/*
2 * Copyright (C) Paul Mackerras 1997.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9#include <linux/string.h>
10#include "nonstdio.h"
11#include "of1275.h"
12#include <asm/processor.h>
13#include <asm/page.h>
14
15/* Passed from the linker */
16extern char __image_begin, __image_end;
17extern char __ramdisk_begin[], __ramdisk_end;
18extern char _start, _end;
19
20extern unsigned int heap_max;
21extern void flush_cache(void *start, unsigned int len);
22extern void gunzip(void *, int, unsigned char *, int *);
23extern void make_bi_recs(unsigned long addr, char *name, unsigned int mach,
24 unsigned int progend);
25
26char *avail_ram;
27char *begin_avail, *end_avail;
28char *avail_high;
29
30
31#define RAM_END (16 << 20)
32
33#define PROG_START 0x00010000
34#define PROG_SIZE 0x007f0000
35
36#define SCRATCH_SIZE (128 << 10)
37
38typedef void (*kernel_start_t)(int, int, void *);
39
40void boot(int a1, int a2, void *prom)
41{
42 unsigned sa, len;
43 void *dst;
44 unsigned char *im;
45 unsigned initrd_start, initrd_size;
46
47 printf("chrpboot starting: loaded at 0x%p\n", &_start);
48
49 initrd_size = (char *)(&__ramdisk_end) - (char *)(&__ramdisk_begin);
50 if (initrd_size) {
51 initrd_start = (RAM_END - initrd_size) & ~0xFFF;
52 a1 = initrd_start;
53 a2 = initrd_size;
54 claim(initrd_start, RAM_END - initrd_start, 0);
55 printf("initial ramdisk moving 0x%x <- 0x%p (%x bytes)\n\r",
56 initrd_start, (char *)(&__ramdisk_begin), initrd_size);
57 memcpy((char *)initrd_start, (char *)(&__ramdisk_begin), initrd_size);
58 } else
59 a2 = 0xdeadbeef;
60
61 im = (char *)(&__image_begin);
62 len = (char *)(&__image_end) - (char *)(&__image_begin);
63 /* claim 3MB starting at PROG_START */
64 claim(PROG_START, PROG_SIZE, 0);
65 dst = (void *) PROG_START;
66 if (im[0] == 0x1f && im[1] == 0x8b) {
67 /* claim some memory for scratch space */
68 avail_ram = (char *) claim(0, SCRATCH_SIZE, 0x10);
69 begin_avail = avail_high = avail_ram;
70 end_avail = avail_ram + SCRATCH_SIZE;
71 printf("heap at 0x%p\n", avail_ram);
72 printf("gunzipping (0x%p <- 0x%p:0x%p)...", dst, im, im+len);
73 gunzip(dst, PROG_SIZE, im, &len);
74 printf("done %u bytes\n", len);
75 printf("%u bytes of heap consumed, max in use %u\n",
76 avail_high - begin_avail, heap_max);
77 release(begin_avail, SCRATCH_SIZE);
78 } else {
79 memmove(dst, im, len);
80 }
81
82 flush_cache(dst, len);
83 make_bi_recs(((unsigned long) dst + len), "chrpboot", _MACH_Pmac,
84 (PROG_START + PROG_SIZE));
85
86 sa = (unsigned long)PROG_START;
87 printf("start address = 0x%x\n", sa);
88
89 (*(kernel_start_t)sa)(a1, a2, prom);
90
91 printf("returned?\n");
92
93 pause();
94}
diff --git a/arch/ppc/boot/openfirmware/start.c b/arch/ppc/boot/openfirmware/start.c
new file mode 100644
index 000000000000..1617a26956bf
--- /dev/null
+++ b/arch/ppc/boot/openfirmware/start.c
@@ -0,0 +1,172 @@
1/*
2 * Copyright (C) Paul Mackerras 1997.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9#include <stdarg.h>
10#include "of1275.h"
11
12extern int strlen(const char *s);
13extern void boot(int a1, int a2, void *prom);
14
15phandle stdin;
16phandle stdout;
17phandle stderr;
18
19void printk(char *fmt, ...);
20
21void
22start(int a1, int a2, void *promptr)
23{
24 ofinit(promptr);
25 if (ofstdio(&stdin, &stdout, &stderr))
26 exit();
27
28 boot(a1, a2, promptr);
29 for (;;)
30 exit();
31}
32
33int writestring(void *f, char *ptr, int nb)
34{
35 int w = 0, i;
36 char *ret = "\r";
37
38 for (i = 0; i < nb; ++i) {
39 if (ptr[i] == '\n') {
40 if (i > w) {
41 write(f, ptr + w, i - w);
42 w = i;
43 }
44 write(f, ret, 1);
45 }
46 }
47 if (w < nb)
48 write(f, ptr + w, nb - w);
49 return nb;
50}
51
52int
53putc(int c, void *f)
54{
55 char ch = c;
56
57 return writestring(f, &ch, 1) == 1? c: -1;
58}
59
60int
61putchar(int c)
62{
63 return putc(c, stdout);
64}
65
66int
67fputs(char *str, void *f)
68{
69 int n = strlen(str);
70
71 return writestring(f, str, n) == n? 0: -1;
72}
73
74int
75readchar(void)
76{
77 char ch;
78
79 for (;;) {
80 switch (read(stdin, &ch, 1)) {
81 case 1:
82 return ch;
83 case -1:
84 printk("read(stdin) returned -1\n");
85 return -1;
86 }
87 }
88}
89
90static char line[256];
91static char *lineptr;
92static int lineleft;
93
94int
95getchar(void)
96{
97 int c;
98
99 if (lineleft == 0) {
100 lineptr = line;
101 for (;;) {
102 c = readchar();
103 if (c == -1 || c == 4)
104 break;
105 if (c == '\r' || c == '\n') {
106 *lineptr++ = '\n';
107 putchar('\n');
108 break;
109 }
110 switch (c) {
111 case 0177:
112 case '\b':
113 if (lineptr > line) {
114 putchar('\b');
115 putchar(' ');
116 putchar('\b');
117 --lineptr;
118 }
119 break;
120 case 'U' & 0x1F:
121 while (lineptr > line) {
122 putchar('\b');
123 putchar(' ');
124 putchar('\b');
125 --lineptr;
126 }
127 break;
128 default:
129 if (lineptr >= &line[sizeof(line) - 1])
130 putchar('\a');
131 else {
132 putchar(c);
133 *lineptr++ = c;
134 }
135 }
136 }
137 lineleft = lineptr - line;
138 lineptr = line;
139 }
140 if (lineleft == 0)
141 return -1;
142 --lineleft;
143 return *lineptr++;
144}
145
146extern int vsprintf(char *buf, const char *fmt, va_list args);
147static char sprint_buf[1024];
148
149void
150printk(char *fmt, ...)
151{
152 va_list args;
153 int n;
154
155 va_start(args, fmt);
156 n = vsprintf(sprint_buf, fmt, args);
157 va_end(args);
158 writestring(stdout, sprint_buf, n);
159}
160
161int
162printf(char *fmt, ...)
163{
164 va_list args;
165 int n;
166
167 va_start(args, fmt);
168 n = vsprintf(sprint_buf, fmt, args);
169 va_end(args);
170 writestring(stdout, sprint_buf, n);
171 return n;
172}
diff --git a/arch/ppc/boot/simple/Makefile b/arch/ppc/boot/simple/Makefile
new file mode 100644
index 000000000000..d8d801fcee10
--- /dev/null
+++ b/arch/ppc/boot/simple/Makefile
@@ -0,0 +1,252 @@
1# This is far from simple, but I couldn't think of a good name. This is
2# for making the 'zImage' or 'zImage.initrd' on a number of targets.
3#
4# Author: Tom Rini <trini@mvista.com>
5#
6# Notes:
7# (1) For machines that do not want to use the ELF image directly (including
8# stripping just the ELF header off), they must set the variables
9# zimage-$(CONFIG_MACHINE) and zimagerd-$(CONFIG_MACHINE) to the target
10# that produces the desired image and they must set end-$(CONFIG_MACHINE)
11# to what will be suffixed to the image filename.
12# (2) Regardless of (1), to have the resulting image be something other
13# than 'zImage.elf', set end-$(CONFIG_MACHINE) to be the suffix used for
14# the zImage, znetboot, and znetbootrd targets.
15# (3) For machine targets which use the mktree program, you can optionally
16# set entrypoint-$(CONFIG_MACHINE) to the location which the image should be
17# loaded at. The optimal setting for entrypoint-$(CONFIG_MACHINE) is the link
18# address.
19# (4) It is advisable to pass in the memory size using BI_MEMSIZE and
20# get_mem_size(), which is memory controller dependent. Add in the correct
21# XXX_memory.o file for this to work, as well as editing the
22# misc-$(CONFIG_MACHINE) variable.
23
24boot := arch/ppc/boot
25common := $(boot)/common
26utils := $(boot)/utils
27bootlib := $(boot)/lib
28images := $(boot)/images
29of1275 := $(boot)/of1275
30tftpboot := /tftpboot
31
32# Normally, we use the 'misc.c' file for decompress_kernel and
33# whatnot. Sometimes we need to override this however.
34misc-y := misc.o
35
36# Normally, we have our images end in .elf, but something we want to
37# change this.
38end-y := elf
39
40# Additionally, we normally don't need to mess with the L2 / L3 caches
41# if present on 'classic' PPC.
42cacheflag-y := -DCLEAR_CACHES=""
43# This file will flush / disable the L2, and L3 if present.
44clear_L2_L3 := $(srctree)/$(boot)/simple/clear.S
45
46#
47# See arch/ppc/kconfig and arch/ppc/platforms/Kconfig
48# for definition of what platform each config option refer to.
49#----------------------------------------------------------------------------
50 zimage-$(CONFIG_CPCI690) := zImage-STRIPELF
51zimageinitrd-$(CONFIG_CPCI690) := zImage.initrd-STRIPELF
52 extra.o-$(CONFIG_CPCI690) := misc-cpci690.o
53 end-$(CONFIG_CPCI690) := cpci690
54 cacheflag-$(CONFIG_CPCI690) := -include $(clear_L2_L3)
55
56 zimage-$(CONFIG_IBM_OPENBIOS) := zImage-TREE
57zimageinitrd-$(CONFIG_IBM_OPENBIOS) := zImage.initrd-TREE
58 end-$(CONFIG_IBM_OPENBIOS) := treeboot
59 misc-$(CONFIG_IBM_OPENBIOS) := misc-embedded.o
60
61 end-$(CONFIG_EMBEDDEDBOOT) := embedded
62 misc-$(CONFIG_EMBEDDEDBOOT) := misc-embedded.o
63
64 zimage-$(CONFIG_EBONY) := zImage-TREE
65zimageinitrd-$(CONFIG_EBONY) := zImage.initrd-TREE
66 end-$(CONFIG_EBONY) := ebony
67 entrypoint-$(CONFIG_EBONY) := 0x01000000
68 extra.o-$(CONFIG_EBONY) := openbios.o
69
70 zimage-$(CONFIG_LUAN) := zImage-TREE
71zimageinitrd-$(CONFIG_LUAN) := zImage.initrd-TREE
72 end-$(CONFIG_LUAN) := luan
73 entrypoint-$(CONFIG_LUAN) := 0x01000000
74 extra.o-$(CONFIG_LUAN) := pibs.o
75
76 zimage-$(CONFIG_OCOTEA) := zImage-TREE
77zimageinitrd-$(CONFIG_OCOTEA) := zImage.initrd-TREE
78 end-$(CONFIG_OCOTEA) := ocotea
79 entrypoint-$(CONFIG_OCOTEA) := 0x01000000
80 extra.o-$(CONFIG_OCOTEA) := pibs.o
81
82 extra.o-$(CONFIG_EV64260) := misc-ev64260.o
83 end-$(CONFIG_EV64260) := ev64260
84 cacheflag-$(CONFIG_EV64260) := -include $(clear_L2_L3)
85
86 extra.o-$(CONFIG_CHESTNUT) := misc-chestnut.o
87 end-$(CONFIG_CHESTNUT) := chestnut
88
89 zimage-$(CONFIG_GEMINI) := zImage-STRIPELF
90zimageinitrd-$(CONFIG_GEMINI) := zImage.initrd-STRIPELF
91 end-$(CONFIG_GEMINI) := gemini
92
93 extra.o-$(CONFIG_K2) := prepmap.o
94 end-$(CONFIG_K2) := k2
95 cacheflag-$(CONFIG_K2) := -include $(clear_L2_L3)
96
97 extra.o-$(CONFIG_KATANA) := misc-katana.o
98 end-$(CONFIG_KATANA) := katana
99 cacheflag-$(CONFIG_KATANA) := -include $(clear_L2_L3)
100
101 extra.o-$(CONFIG_RADSTONE_PPC7D) := misc-radstone_ppc7d.o
102 end-$(CONFIG_RADSTONE_PPC7D) := radstone_ppc7d
103 cacheflag-$(CONFIG_RADSTONE_PPC7D) := -include $(clear_L2_L3)
104
105# kconfig 'feature', only one of these will ever be 'y' at a time.
106# The rest will be unset.
107motorola := $(CONFIG_MCPN765)$(CONFIG_MVME5100)$(CONFIG_PRPMC750) \
108$(CONFIG_PRPMC800)$(CONFIG_LOPEC)$(CONFIG_PPLUS)
109motorola := $(strip $(motorola))
110pcore := $(CONFIG_PCORE)$(CONFIG_POWERPMC250)
111
112 zimage-$(motorola) := zImage-PPLUS
113zimageinitrd-$(motorola) := zImage.initrd-PPLUS
114 end-$(motorola) := pplus
115
116# Overrides previous assingment
117 extra.o-$(CONFIG_PPLUS) := prepmap.o
118 extra.o-$(CONFIG_LOPEC) := mpc10x_memory.o
119
120 zimage-$(pcore) := zImage-STRIPELF
121zimageinitrd-$(pcore) := zImage.initrd-STRIPELF
122 extra.o-$(pcore) := chrpmap.o
123 end-$(pcore) := pcore
124 cacheflag-$(pcore) := -include $(clear_L2_L3)
125
126 zimage-$(CONFIG_PPC_PREP) := zImage-PPLUS
127zimageinitrd-$(CONFIG_PPC_PREP) := zImage.initrd-PPLUS
128 extra.o-$(CONFIG_PPC_PREP) := prepmap.o
129 misc-$(CONFIG_PPC_PREP) += misc-prep.o mpc10x_memory.o
130 end-$(CONFIG_PPC_PREP) := prep
131
132 end-$(CONFIG_SANDPOINT) := sandpoint
133 cacheflag-$(CONFIG_SANDPOINT) := -include $(clear_L2_L3)
134
135 zimage-$(CONFIG_SPRUCE) := zImage-TREE
136zimageinitrd-$(CONFIG_SPRUCE) := zImage.initrd-TREE
137 end-$(CONFIG_SPRUCE) := spruce
138 entrypoint-$(CONFIG_SPRUCE) := 0x00800000
139 misc-$(CONFIG_SPRUCE) += misc-spruce.o
140
141 zimage-$(CONFIG_LITE5200) := zImage-STRIPELF
142zimageinitrd-$(CONFIG_LITE5200) := zImage.initrd-STRIPELF
143 end-$(CONFIG_LITE5200) := lite5200
144 cacheflag-$(CONFIG_LITE5200) := -include $(clear_L2_L3)
145
146
147# SMP images should have a '.smp' suffix.
148 end-$(CONFIG_SMP) := $(end-y).smp
149
150# This is a treeboot that needs init functions until the
151# boot rom is sorted out (i.e. this is short lived)
152extra-aflags-$(CONFIG_REDWOOD_4) := -Wa,-m405
153extra.o-$(CONFIG_REDWOOD_4) := rw4/rw4_init.o rw4/rw4_init_brd.o
154EXTRA_AFLAGS := $(extra-aflags-y)
155# head.o needs to get the cacheflags defined.
156AFLAGS_head.o += $(cacheflag-y)
157
158# Linker args. This specifies where the image will be run at.
159LD_ARGS := -T $(srctree)/$(boot)/ld.script \
160 -Ttext $(CONFIG_BOOT_LOAD) -Bstatic
161OBJCOPY_ARGS := -O elf32-powerpc
162
163# head.o and relocate.o must be at the start.
164boot-y := head.o relocate.o $(extra.o-y) $(misc-y)
165boot-$(CONFIG_40x) += embed_config.o
166boot-$(CONFIG_8xx) += embed_config.o
167boot-$(CONFIG_8260) += embed_config.o
168boot-$(CONFIG_BSEIP) += iic.o
169boot-$(CONFIG_MBX) += iic.o pci.o qspan_pci.o
170boot-$(CONFIG_MV64X60) += misc-mv64x60.o
171boot-$(CONFIG_RPXCLASSIC) += iic.o pci.o qspan_pci.o
172boot-$(CONFIG_RPXLITE) += iic.o
173# Different boards need different serial implementations.
174ifeq ($(CONFIG_SERIAL_CPM_CONSOLE),y)
175boot-$(CONFIG_8xx) += m8xx_tty.o
176boot-$(CONFIG_8260) += m8260_tty.o
177endif
178boot-$(CONFIG_SERIAL_MPC52xx_CONSOLE) += mpc52xx_tty.o
179boot-$(CONFIG_SERIAL_MPSC_CONSOLE) += mv64x60_tty.o
180
181LIBS := $(common)/lib.a $(bootlib)/lib.a
182ifeq ($(CONFIG_PPC_PREP),y)
183LIBS += $(of1275)/lib.a
184endif
185
186OBJS := $(addprefix $(obj)/,$(boot-y))
187
188# Tools
189MKBUGBOOT := $(utils)/mkbugboot
190MKPREP := $(utils)/mkprep
191MKTREE := $(utils)/mktree
192
193targets := dummy.o
194
195$(obj)/zvmlinux: $(OBJS) $(LIBS) $(srctree)/$(boot)/ld.script \
196 $(images)/vmlinux.gz $(obj)/dummy.o
197 $(OBJCOPY) $(OBJCOPY_ARGS) \
198 --add-section=.image=$(images)/vmlinux.gz \
199 --set-section-flags=.image=contents,alloc,load,readonly,data \
200 $(obj)/dummy.o $(obj)/image.o
201 $(LD) $(LD_ARGS) -o $@ $(OBJS) $(obj)/image.o $(LIBS)
202 $(OBJCOPY) $(OBJCOPY_ARGS) $@ $@ -R .comment -R .stab \
203 -R .stabstr -R .ramdisk -R .sysmap
204
205$(obj)/zvmlinux.initrd: $(OBJS) $(LIBS) $(srctree)/$(boot)/ld.script \
206 $(images)/vmlinux.gz $(obj)/dummy.o
207 $(OBJCOPY) $(OBJCOPY_ARGS) \
208 --add-section=.ramdisk=$(images)/ramdisk.image.gz \
209 --set-section-flags=.ramdisk=contents,alloc,load,readonly,data \
210 --add-section=.image=$(images)/vmlinux.gz \
211 --set-section-flags=.image=contents,alloc,load,readonly,data \
212 $(obj)/dummy.o $(obj)/image.o
213 $(LD) $(LD_ARGS) -o $@ $(OBJS) $(obj)/image.o $(LIBS)
214 $(OBJCOPY) $(OBJCOPY_ARGS) $@ $@ -R .comment -R .stab \
215 -R .stabstr -R .sysmap
216
217# Sort-of dummy rules, that let us format the image we want.
218zImage: $(images)/$(zimage-y) $(obj)/zvmlinux
219 cp -f $(obj)/zvmlinux $(images)/zImage.elf
220 rm -f $(obj)/zvmlinux
221
222zImage.initrd: $(images)/$(zimageinitrd-y) $(obj)/zvmlinux.initrd
223 cp -f $(obj)/zvmlinux.initrd $(images)/zImage.initrd.elf
224 rm -f $(obj)/zvmlinux.initrd
225
226znetboot: zImage
227 cp $(images)/zImage.$(end-y) $(tftpboot)/zImage.$(end-y)
228
229znetboot.initrd: zImage.initrd
230 cp $(images)/zImage.initrd.$(end-y) $(tftpboot)/zImage.initrd.$(end-y)
231
232$(images)/zImage-STRIPELF: $(obj)/zvmlinux
233 dd if=$(obj)/zvmlinux of=$(images)/zImage.$(end-y) skip=64 bs=1k
234
235$(images)/zImage.initrd-STRIPELF: $(obj)/zvmlinux.initrd
236 dd if=$(obj)/zvmlinux.initrd of=$(images)/zImage.initrd.$(end-y) \
237 skip=64 bs=1k
238
239$(images)/zImage-TREE: $(obj)/zvmlinux $(MKTREE)
240 $(MKTREE) $(obj)/zvmlinux $(images)/zImage.$(end-y) $(ENTRYPOINT)
241
242$(images)/zImage.initrd-TREE: $(obj)/zvmlinux.initrd $(MKTREE)
243 $(MKTREE) $(obj)/zvmlinux.initrd $(images)/zImage.initrd.$(end-y) \
244 $(ENTRYPOINT)
245
246$(images)/zImage-PPLUS: $(obj)/zvmlinux $(MKPREP) $(MKBUGBOOT)
247 $(MKPREP) -pbp $(obj)/zvmlinux $(images)/zImage.$(end-y)
248 $(MKBUGBOOT) $(obj)/zvmlinux $(images)/zImage.bugboot
249
250$(images)/zImage.initrd-PPLUS: $(obj)/zvmlinux.initrd $(MKPREP) $(MKBUGBOOT)
251 $(MKPREP) -pbp $(obj)/zvmlinux.initrd $(images)/zImage.initrd.$(end-y)
252 $(MKBUGBOOT) $(obj)/zvmlinux.initrd $(images)/zImage.initrd.bugboot
diff --git a/arch/ppc/boot/simple/chrpmap.c b/arch/ppc/boot/simple/chrpmap.c
new file mode 100644
index 000000000000..14d9e05d98bb
--- /dev/null
+++ b/arch/ppc/boot/simple/chrpmap.c
@@ -0,0 +1,12 @@
1/*
2 * 2004 (C) IBM. This file is licensed under the terms of the GNU General
3 * Public License version 2. This program is licensed "as is" without any
4 * warranty of any kind, whether express or implied.
5 */
6
7#include <nonstdio.h>
8
9void board_isa_init(void)
10{
11 ISA_init(0xFE000000);
12}
diff --git a/arch/ppc/boot/simple/clear.S b/arch/ppc/boot/simple/clear.S
new file mode 100644
index 000000000000..95c5647a0f51
--- /dev/null
+++ b/arch/ppc/boot/simple/clear.S
@@ -0,0 +1,19 @@
1/*
2 * Code to call _setup_L2CR to flus, invalidate and disable the L2,
3 * and if present, do the same to the L3.
4 */
5
6#define CLEAR_CACHES \
7 bl _setup_L2CR; \
8 \
9 /* If 745x, turn off L3CR as well */ \
10 mfspr r8,SPRN_PVR; \
11 srwi r8,r8,16; \
12 \
13 cmpli cr0,r8,0x8000; /* 7450 */ \
14 cmpli cr1,r8,0x8001; /* 7455 */ \
15 cmpli cr2,r8,0x8002; /* 7457 */ \
16 /* Now test if any are true. */ \
17 cror 4*cr0+eq,4*cr0+eq,4*cr1+eq; \
18 cror 4*cr0+eq,4*cr0+eq,4*cr2+eq; \
19 beql _setup_L3CR
diff --git a/arch/ppc/boot/simple/cpc700_memory.c b/arch/ppc/boot/simple/cpc700_memory.c
new file mode 100644
index 000000000000..8c75cf6c2383
--- /dev/null
+++ b/arch/ppc/boot/simple/cpc700_memory.c
@@ -0,0 +1,36 @@
1/*
2 * arch/ppc/boot/common/cpc700_memory.c
3 *
4 * Find memory based upon settings in the CPC700 bridge
5 *
6 * Author: Dan Cox
7 *
8 * 2001-2002 (c) MontaVista, Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
11 * or implied.
12 */
13
14#include <asm/types.h>
15#include <asm/io.h>
16#include "cpc700.h"
17
18unsigned long
19cpc700_get_mem_size(void)
20{
21 int i;
22 unsigned long len, amt;
23
24 /* Start at MB1EA, since MB0EA will most likely be the ending address
25 for ROM space. */
26 for(len = 0, i = CPC700_MB1EA; i <= CPC700_MB4EA; i+=4) {
27 amt = cpc700_read_memreg(i);
28 if (amt == 0)
29 break;
30 len = amt;
31 }
32
33 return len;
34}
35
36
diff --git a/arch/ppc/boot/simple/dummy.c b/arch/ppc/boot/simple/dummy.c
new file mode 100644
index 000000000000..31dbf45bf99c
--- /dev/null
+++ b/arch/ppc/boot/simple/dummy.c
@@ -0,0 +1,4 @@
1int main(void)
2{
3 return 0;
4}
diff --git a/arch/ppc/boot/simple/embed_config.c b/arch/ppc/boot/simple/embed_config.c
new file mode 100644
index 000000000000..c342b47e763e
--- /dev/null
+++ b/arch/ppc/boot/simple/embed_config.c
@@ -0,0 +1,981 @@
1/* Board specific functions for those embedded 8xx boards that do
2 * not have boot monitor support for board information.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 */
9
10#include <linux/types.h>
11#include <linux/config.h>
12#include <linux/string.h>
13#include <asm/reg.h>
14#ifdef CONFIG_8xx
15#include <asm/mpc8xx.h>
16#endif
17#ifdef CONFIG_8260
18#include <asm/mpc8260.h>
19#include <asm/immap_cpm2.h>
20#endif
21#ifdef CONFIG_40x
22#include <asm/io.h>
23#endif
24extern unsigned long timebase_period_ns;
25
26/* For those boards that don't provide one.
27*/
28#if !defined(CONFIG_MBX)
29static bd_t bdinfo;
30#endif
31
32/* IIC functions.
33 * These are just the basic master read/write operations so we can
34 * examine serial EEPROM.
35 */
36extern void iic_read(uint devaddr, u_char *buf, uint offset, uint count);
37
38/* Supply a default Ethernet address for those eval boards that don't
39 * ship with one. This is an address from the MBX board I have, so
40 * it is unlikely you will find it on your network.
41 */
42static ushort def_enet_addr[] = { 0x0800, 0x3e26, 0x1559 };
43
44#if defined(CONFIG_MBX)
45
46/* The MBX hands us a pretty much ready to go board descriptor. This
47 * is where the idea started in the first place.
48 */
49void
50embed_config(bd_t **bdp)
51{
52 u_char *mp;
53 u_char eebuf[128];
54 int i = 8;
55 bd_t *bd;
56
57 bd = *bdp;
58
59 /* Read the first 128 bytes of the EEPROM. There is more,
60 * but this is all we need.
61 */
62 iic_read(0xa4, eebuf, 0, 128);
63
64 /* All we are looking for is the Ethernet MAC address. The
65 * first 8 bytes are 'MOTOROLA', so check for part of that.
66 * Next, the VPD describes a MAC 'packet' as being of type 08
67 * and size 06. So we look for that and the MAC must follow.
68 * If there are more than one, we still only care about the first.
69 * If it's there, assume we have a valid MAC address. If not,
70 * grab our default one.
71 */
72 if ((*(uint *)eebuf) == 0x4d4f544f) {
73 while (i < 127 && !(eebuf[i] == 0x08 && eebuf[i + 1] == 0x06))
74 i += eebuf[i + 1] + 2; /* skip this packet */
75
76 if (i == 127) /* Couldn't find. */
77 mp = (u_char *)def_enet_addr;
78 else
79 mp = &eebuf[i + 2];
80 }
81 else
82 mp = (u_char *)def_enet_addr;
83
84 for (i=0; i<6; i++)
85 bd->bi_enetaddr[i] = *mp++;
86
87 /* The boot rom passes these to us in MHz. Linux now expects
88 * them to be in Hz.
89 */
90 bd->bi_intfreq *= 1000000;
91 bd->bi_busfreq *= 1000000;
92
93 /* Stuff a baud rate here as well.
94 */
95 bd->bi_baudrate = 9600;
96}
97#endif /* CONFIG_MBX */
98
99#if defined(CONFIG_RPXLITE) || defined(CONFIG_RPXCLASSIC) || \
100 defined(CONFIG_RPX8260) || defined(CONFIG_EP405)
101/* Helper functions for Embedded Planet boards.
102*/
103/* Because I didn't find anything that would do this.......
104*/
105u_char
106aschex_to_byte(u_char *cp)
107{
108 u_char byte, c;
109
110 c = *cp++;
111
112 if ((c >= 'A') && (c <= 'F')) {
113 c -= 'A';
114 c += 10;
115 } else if ((c >= 'a') && (c <= 'f')) {
116 c -= 'a';
117 c += 10;
118 } else
119 c -= '0';
120
121 byte = c * 16;
122
123 c = *cp;
124
125 if ((c >= 'A') && (c <= 'F')) {
126 c -= 'A';
127 c += 10;
128 } else if ((c >= 'a') && (c <= 'f')) {
129 c -= 'a';
130 c += 10;
131 } else
132 c -= '0';
133
134 byte += c;
135
136 return(byte);
137}
138
139static void
140rpx_eth(bd_t *bd, u_char *cp)
141{
142 int i;
143
144 for (i=0; i<6; i++) {
145 bd->bi_enetaddr[i] = aschex_to_byte(cp);
146 cp += 2;
147 }
148}
149
150#ifdef CONFIG_RPX8260
151static uint
152rpx_baseten(u_char *cp)
153{
154 uint retval;
155
156 retval = 0;
157
158 while (*cp != '\n') {
159 retval *= 10;
160 retval += (*cp) - '0';
161 cp++;
162 }
163 return(retval);
164}
165#endif
166
167#if defined(CONFIG_RPXLITE) || defined(CONFIG_RPXCLASSIC)
168static void
169rpx_brate(bd_t *bd, u_char *cp)
170{
171 uint rate;
172
173 rate = 0;
174
175 while (*cp != '\n') {
176 rate *= 10;
177 rate += (*cp) - '0';
178 cp++;
179 }
180
181 bd->bi_baudrate = rate * 100;
182}
183
184static void
185rpx_cpuspeed(bd_t *bd, u_char *cp)
186{
187 uint num, den;
188
189 num = den = 0;
190
191 while (*cp != '\n') {
192 num *= 10;
193 num += (*cp) - '0';
194 cp++;
195 if (*cp == '/') {
196 cp++;
197 den = (*cp) - '0';
198 break;
199 }
200 }
201
202 /* I don't know why the RPX just can't state the actual
203 * CPU speed.....
204 */
205 if (den) {
206 num /= den;
207 num *= den;
208 }
209 bd->bi_intfreq = bd->bi_busfreq = num * 1000000;
210
211 /* The 8xx can only run a maximum 50 MHz bus speed (until
212 * Motorola changes this :-). Greater than 50 MHz parts
213 * run internal/2 for bus speed.
214 */
215 if (num > 50)
216 bd->bi_busfreq /= 2;
217}
218#endif
219
220#if defined(CONFIG_RPXLITE) || defined(CONFIG_RPXCLASSIC) || defined(CONFIG_EP405)
221static void
222rpx_memsize(bd_t *bd, u_char *cp)
223{
224 uint size;
225
226 size = 0;
227
228 while (*cp != '\n') {
229 size *= 10;
230 size += (*cp) - '0';
231 cp++;
232 }
233
234 bd->bi_memsize = size * 1024 * 1024;
235}
236#endif /* LITE || CLASSIC || EP405 */
237#if defined(CONFIG_EP405)
238static void
239rpx_nvramsize(bd_t *bd, u_char *cp)
240{
241 uint size;
242
243 size = 0;
244
245 while (*cp != '\n') {
246 size *= 10;
247 size += (*cp) - '0';
248 cp++;
249 }
250
251 bd->bi_nvramsize = size * 1024;
252}
253#endif /* CONFIG_EP405 */
254
255#endif /* Embedded Planet boards */
256
257#if defined(CONFIG_RPXLITE) || defined(CONFIG_RPXCLASSIC)
258
259/* Read the EEPROM on the RPX-Lite board.
260*/
261void
262embed_config(bd_t **bdp)
263{
264 u_char eebuf[256], *cp;
265 bd_t *bd;
266
267 /* Read the first 256 bytes of the EEPROM. I think this
268 * is really all there is, and I hope if it gets bigger the
269 * info we want is still up front.
270 */
271 bd = &bdinfo;
272 *bdp = bd;
273
274#if 1
275 iic_read(0xa8, eebuf, 0, 128);
276 iic_read(0xa8, &eebuf[128], 128, 128);
277
278 /* We look for two things, the Ethernet address and the
279 * serial baud rate. The records are separated by
280 * newlines.
281 */
282 cp = eebuf;
283 for (;;) {
284 if (*cp == 'E') {
285 cp++;
286 if (*cp == 'A') {
287 cp += 2;
288 rpx_eth(bd, cp);
289 }
290 }
291 if (*cp == 'S') {
292 cp++;
293 if (*cp == 'B') {
294 cp += 2;
295 rpx_brate(bd, cp);
296 }
297 }
298 if (*cp == 'D') {
299 cp++;
300 if (*cp == '1') {
301 cp += 2;
302 rpx_memsize(bd, cp);
303 }
304 }
305 if (*cp == 'H') {
306 cp++;
307 if (*cp == 'Z') {
308 cp += 2;
309 rpx_cpuspeed(bd, cp);
310 }
311 }
312
313 /* Scan to the end of the record.
314 */
315 while ((*cp != '\n') && (*cp != 0xff))
316 cp++;
317
318 /* If the next character is a 0 or ff, we are done.
319 */
320 cp++;
321 if ((*cp == 0) || (*cp == 0xff))
322 break;
323 }
324 bd->bi_memstart = 0;
325#else
326 /* For boards without initialized EEPROM.
327 */
328 bd->bi_memstart = 0;
329 bd->bi_memsize = (8 * 1024 * 1024);
330 bd->bi_intfreq = 48000000;
331 bd->bi_busfreq = 48000000;
332 bd->bi_baudrate = 9600;
333#endif
334}
335#endif /* RPXLITE || RPXCLASSIC */
336
337#ifdef CONFIG_BSEIP
338/* Build a board information structure for the BSE ip-Engine.
339 * There is more to come since we will add some environment
340 * variables and a function to read them.
341 */
342void
343embed_config(bd_t **bdp)
344{
345 u_char *cp;
346 int i;
347 bd_t *bd;
348
349 bd = &bdinfo;
350 *bdp = bd;
351
352 /* Baud rate and processor speed will eventually come
353 * from the environment variables.
354 */
355 bd->bi_baudrate = 9600;
356
357 /* Get the Ethernet station address from the Flash ROM.
358 */
359 cp = (u_char *)0xfe003ffa;
360 for (i=0; i<6; i++) {
361 bd->bi_enetaddr[i] = *cp++;
362 }
363
364 /* The rest of this should come from the environment as well.
365 */
366 bd->bi_memstart = 0;
367 bd->bi_memsize = (16 * 1024 * 1024);
368 bd->bi_intfreq = 48000000;
369 bd->bi_busfreq = 48000000;
370}
371#endif /* BSEIP */
372
373#ifdef CONFIG_FADS
374/* Build a board information structure for the FADS.
375 */
376void
377embed_config(bd_t **bdp)
378{
379 u_char *cp;
380 int i;
381 bd_t *bd;
382
383 bd = &bdinfo;
384 *bdp = bd;
385
386 /* Just fill in some known values.
387 */
388 bd->bi_baudrate = 9600;
389
390 /* Use default enet.
391 */
392 cp = (u_char *)def_enet_addr;
393 for (i=0; i<6; i++) {
394 bd->bi_enetaddr[i] = *cp++;
395 }
396
397 bd->bi_memstart = 0;
398 bd->bi_memsize = (8 * 1024 * 1024);
399 bd->bi_intfreq = 40000000;
400 bd->bi_busfreq = 40000000;
401}
402#endif /* FADS */
403
404#ifdef CONFIG_8260
405/* Compute 8260 clock values if the rom doesn't provide them.
406 */
407static unsigned char bus2core_8260[] = {
408/* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
409 3, 2, 2, 2, 4, 4, 5, 9, 6, 11, 8, 10, 3, 12, 7, 2,
410 6, 5, 13, 2, 14, 4, 15, 2, 3, 11, 8, 10, 16, 12, 7, 2,
411};
412
413static void
414clk_8260(bd_t *bd)
415{
416 uint scmr, vco_out, clkin;
417 uint plldf, pllmf, corecnf;
418 volatile cpm2_map_t *ip;
419
420 ip = (cpm2_map_t *)CPM_MAP_ADDR;
421 scmr = ip->im_clkrst.car_scmr;
422
423 /* The clkin is always bus frequency.
424 */
425 clkin = bd->bi_busfreq;
426
427 /* Collect the bits from the scmr.
428 */
429 plldf = (scmr >> 12) & 1;
430 pllmf = scmr & 0xfff;
431 corecnf = (scmr >> 24) &0x1f;
432
433 /* This is arithmetic from the 8260 manual.
434 */
435 vco_out = clkin / (plldf + 1);
436 vco_out *= 2 * (pllmf + 1);
437 bd->bi_vco = vco_out; /* Save for later */
438
439 bd->bi_cpmfreq = vco_out / 2; /* CPM Freq, in MHz */
440 bd->bi_intfreq = bd->bi_busfreq * bus2core_8260[corecnf] / 2;
441
442 /* Set Baud rate divisor. The power up default is divide by 16,
443 * but we set it again here in case it was changed.
444 */
445 ip->im_clkrst.car_sccr = 1; /* DIV 16 BRG */
446 bd->bi_brgfreq = vco_out / 16;
447}
448
449static unsigned char bus2core_8280[] = {
450/* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
451 3, 2, 2, 2, 4, 4, 5, 9, 6, 11, 8, 10, 3, 12, 7, 2,
452 6, 5, 13, 2, 14, 2, 15, 2, 3, 2, 2, 2, 16, 2, 2, 2,
453};
454
455static void
456clk_8280(bd_t *bd)
457{
458 uint scmr, main_clk, clkin;
459 uint pllmf, corecnf;
460 volatile cpm2_map_t *ip;
461
462 ip = (cpm2_map_t *)CPM_MAP_ADDR;
463 scmr = ip->im_clkrst.car_scmr;
464
465 /* The clkin is always bus frequency.
466 */
467 clkin = bd->bi_busfreq;
468
469 /* Collect the bits from the scmr.
470 */
471 pllmf = scmr & 0xf;
472 corecnf = (scmr >> 24) & 0x1f;
473
474 /* This is arithmetic from the 8280 manual.
475 */
476 main_clk = clkin * (pllmf + 1);
477
478 bd->bi_cpmfreq = main_clk / 2; /* CPM Freq, in MHz */
479 bd->bi_intfreq = bd->bi_busfreq * bus2core_8280[corecnf] / 2;
480
481 /* Set Baud rate divisor. The power up default is divide by 16,
482 * but we set it again here in case it was changed.
483 */
484 ip->im_clkrst.car_sccr = (ip->im_clkrst.car_sccr & 0x3) | 0x1;
485 bd->bi_brgfreq = main_clk / 16;
486}
487#endif
488
489#ifdef CONFIG_SBC82xx
490void
491embed_config(bd_t **bdp)
492{
493 u_char *cp;
494 int i;
495 bd_t *bd;
496 unsigned long pvr;
497
498 bd = *bdp;
499
500 bd = &bdinfo;
501 *bdp = bd;
502 bd->bi_baudrate = 9600;
503 bd->bi_memsize = 256 * 1024 * 1024; /* just a guess */
504
505 cp = (void*)SBC82xx_MACADDR_NVRAM_SCC1;
506 memcpy(bd->bi_enetaddr, cp, 6);
507
508 /* can busfreq be calculated? */
509 pvr = mfspr(SPRN_PVR);
510 if ((pvr & 0xffff0000) == 0x80820000) {
511 bd->bi_busfreq = 100000000;
512 clk_8280(bd);
513 } else {
514 bd->bi_busfreq = 66000000;
515 clk_8260(bd);
516 }
517
518}
519#endif /* SBC82xx */
520
521#if defined(CONFIG_EST8260) || defined(CONFIG_TQM8260)
522void
523embed_config(bd_t **bdp)
524{
525 u_char *cp;
526 int i;
527 bd_t *bd;
528
529 bd = *bdp;
530#if 0
531 /* This is actually provided by my boot rom. I have it
532 * here for those people that may load the kernel with
533 * a JTAG/COP tool and not the rom monitor.
534 */
535 bd->bi_baudrate = 115200;
536 bd->bi_intfreq = 200000000;
537 bd->bi_busfreq = 66666666;
538 bd->bi_cpmfreq = 66666666;
539 bd->bi_brgfreq = 33333333;
540 bd->bi_memsize = 16 * 1024 * 1024;
541#else
542 /* The boot rom passes these to us in MHz. Linux now expects
543 * them to be in Hz.
544 */
545 bd->bi_intfreq *= 1000000;
546 bd->bi_busfreq *= 1000000;
547 bd->bi_cpmfreq *= 1000000;
548 bd->bi_brgfreq *= 1000000;
549#endif
550
551 cp = (u_char *)def_enet_addr;
552 for (i=0; i<6; i++) {
553 bd->bi_enetaddr[i] = *cp++;
554 }
555}
556#endif /* EST8260 */
557
558#ifdef CONFIG_SBS8260
559void
560embed_config(bd_t **bdp)
561{
562 u_char *cp;
563 int i;
564 bd_t *bd;
565
566 /* This should provided by the boot rom.
567 */
568 bd = &bdinfo;
569 *bdp = bd;
570 bd->bi_baudrate = 9600;
571 bd->bi_memsize = 64 * 1024 * 1024;
572
573 /* Set all of the clocks. We have to know the speed of the
574 * external clock. The development board had 66 MHz.
575 */
576 bd->bi_busfreq = 66666666;
577 clk_8260(bd);
578
579 /* I don't know how to compute this yet.
580 */
581 bd->bi_intfreq = 133000000;
582
583
584 cp = (u_char *)def_enet_addr;
585 for (i=0; i<6; i++) {
586 bd->bi_enetaddr[i] = *cp++;
587 }
588}
589#endif /* SBS8260 */
590
591#ifdef CONFIG_RPX8260
592void
593embed_config(bd_t **bdp)
594{
595 u_char *cp, *keyvals;
596 int i;
597 bd_t *bd;
598
599 keyvals = (u_char *)*bdp;
600
601 bd = &bdinfo;
602 *bdp = bd;
603
604 /* This is almost identical to the RPX-Lite/Classic functions
605 * on the 8xx boards. It would be nice to have a key lookup
606 * function in a string, but the format of all of the fields
607 * is slightly different.
608 */
609 cp = keyvals;
610 for (;;) {
611 if (*cp == 'E') {
612 cp++;
613 if (*cp == 'A') {
614 cp += 2;
615 rpx_eth(bd, cp);
616 }
617 }
618 if (*cp == 'S') {
619 cp++;
620 if (*cp == 'B') {
621 cp += 2;
622 bd->bi_baudrate = rpx_baseten(cp);
623 }
624 }
625 if (*cp == 'D') {
626 cp++;
627 if (*cp == '1') {
628 cp += 2;
629 bd->bi_memsize = rpx_baseten(cp) * 1024 * 1024;
630 }
631 }
632 if (*cp == 'X') {
633 cp++;
634 if (*cp == 'T') {
635 cp += 2;
636 bd->bi_busfreq = rpx_baseten(cp);
637 }
638 }
639 if (*cp == 'N') {
640 cp++;
641 if (*cp == 'V') {
642 cp += 2;
643 bd->bi_nvsize = rpx_baseten(cp) * 1024 * 1024;
644 }
645 }
646
647 /* Scan to the end of the record.
648 */
649 while ((*cp != '\n') && (*cp != 0xff))
650 cp++;
651
652 /* If the next character is a 0 or ff, we are done.
653 */
654 cp++;
655 if ((*cp == 0) || (*cp == 0xff))
656 break;
657 }
658 bd->bi_memstart = 0;
659
660 /* The memory size includes both the 60x and local bus DRAM.
661 * I don't want to use the local bus DRAM for real memory,
662 * so subtract it out. It would be nice if they were separate
663 * keys.
664 */
665 bd->bi_memsize -= 32 * 1024 * 1024;
666
667 /* Set all of the clocks. We have to know the speed of the
668 * external clock.
669 */
670 clk_8260(bd);
671
672 /* I don't know how to compute this yet.
673 */
674 bd->bi_intfreq = 200000000;
675}
676#endif /* RPX6 for testing */
677
678#ifdef CONFIG_ADS8260
679void
680embed_config(bd_t **bdp)
681{
682 u_char *cp;
683 int i;
684 bd_t *bd;
685
686 /* This should provided by the boot rom.
687 */
688 bd = &bdinfo;
689 *bdp = bd;
690 bd->bi_baudrate = 9600;
691 bd->bi_memsize = 16 * 1024 * 1024;
692
693 /* Set all of the clocks. We have to know the speed of the
694 * external clock. The development board had 66 MHz.
695 */
696 bd->bi_busfreq = 66666666;
697 clk_8260(bd);
698
699 /* I don't know how to compute this yet.
700 */
701 bd->bi_intfreq = 200000000;
702
703
704 cp = (u_char *)def_enet_addr;
705 for (i=0; i<6; i++) {
706 bd->bi_enetaddr[i] = *cp++;
707 }
708}
709#endif /* ADS8260 */
710
711#ifdef CONFIG_WILLOW
712void
713embed_config(bd_t **bdp)
714{
715 u_char *cp;
716 int i;
717 bd_t *bd;
718
719 /* Willow has Open Firmware....I should learn how to get this
720 * information from it.
721 */
722 bd = &bdinfo;
723 *bdp = bd;
724 bd->bi_baudrate = 9600;
725 bd->bi_memsize = 32 * 1024 * 1024;
726
727 /* Set all of the clocks. We have to know the speed of the
728 * external clock. The development board had 66 MHz.
729 */
730 bd->bi_busfreq = 66666666;
731 clk_8260(bd);
732
733 /* I don't know how to compute this yet.
734 */
735 bd->bi_intfreq = 200000000;
736
737
738 cp = (u_char *)def_enet_addr;
739 for (i=0; i<6; i++) {
740 bd->bi_enetaddr[i] = *cp++;
741 }
742}
743#endif /* WILLOW */
744
745#ifdef CONFIG_XILINX_ML300
746void
747embed_config(bd_t ** bdp)
748{
749 static const unsigned long line_size = 32;
750 static const unsigned long congruence_classes = 256;
751 unsigned long addr;
752 unsigned long dccr;
753 bd_t *bd;
754
755 /*
756 * Invalidate the data cache if the data cache is turned off.
757 * - The 405 core does not invalidate the data cache on power-up
758 * or reset but does turn off the data cache. We cannot assume
759 * that the cache contents are valid.
760 * - If the data cache is turned on this must have been done by
761 * a bootloader and we assume that the cache contents are
762 * valid.
763 */
764 __asm__("mfdccr %0": "=r" (dccr));
765 if (dccr == 0) {
766 for (addr = 0;
767 addr < (congruence_classes * line_size);
768 addr += line_size) {
769 __asm__("dccci 0,%0": :"b"(addr));
770 }
771 }
772
773 bd = &bdinfo;
774 *bdp = bd;
775 bd->bi_memsize = XPAR_DDR_0_SIZE;
776 bd->bi_intfreq = XPAR_CORE_CLOCK_FREQ_HZ;
777 bd->bi_busfreq = XPAR_PLB_CLOCK_FREQ_HZ;
778 bd->bi_pci_busfreq = XPAR_PCI_0_CLOCK_FREQ_HZ;
779 timebase_period_ns = 1000000000 / bd->bi_tbfreq;
780 /* see bi_tbfreq definition in arch/ppc/platforms/4xx/xilinx_ml300.h */
781}
782#endif /* CONFIG_XILINX_ML300 */
783
784#ifdef CONFIG_IBM_OPENBIOS
785/* This could possibly work for all treeboot roms.
786*/
787#if defined(CONFIG_ASH) || defined(CONFIG_BEECH) || defined(CONFIG_BUBINGA)
788#define BOARD_INFO_VECTOR 0xFFF80B50 /* openbios 1.19 moved this vector down - armin */
789#else
790#define BOARD_INFO_VECTOR 0xFFFE0B50
791#endif
792
793#ifdef CONFIG_BEECH
794static void
795get_board_info(bd_t **bdp)
796{
797 typedef void (*PFV)(bd_t *bd);
798 ((PFV)(*(unsigned long *)BOARD_INFO_VECTOR))(*bdp);
799 return;
800}
801
802void
803embed_config(bd_t **bdp)
804{
805 *bdp = &bdinfo;
806 get_board_info(bdp);
807}
808#else /* !CONFIG_BEECH */
809void
810embed_config(bd_t **bdp)
811{
812 u_char *cp;
813 int i;
814 bd_t *bd, *treeboot_bd;
815 bd_t *(*get_board_info)(void) =
816 (bd_t *(*)(void))(*(unsigned long *)BOARD_INFO_VECTOR);
817#if !defined(CONFIG_STB03xxx)
818
819 /* shut down the Ethernet controller that the boot rom
820 * sometimes leaves running.
821 */
822 mtdcr(DCRN_MALCR(DCRN_MAL_BASE), MALCR_MMSR); /* 1st reset MAL */
823 while (mfdcr(DCRN_MALCR(DCRN_MAL_BASE)) & MALCR_MMSR) {}; /* wait for the reset */
824 out_be32((volatile u32*)EMAC0_BASE,0x20000000); /* then reset EMAC */
825#endif
826
827 bd = &bdinfo;
828 *bdp = bd;
829 if ((treeboot_bd = get_board_info()) != NULL) {
830 memcpy(bd, treeboot_bd, sizeof(bd_t));
831 }
832 else {
833 /* Hmmm...better try to stuff some defaults.
834 */
835 bd->bi_memsize = 16 * 1024 * 1024;
836 cp = (u_char *)def_enet_addr;
837 for (i=0; i<6; i++) {
838 /* I should probably put different ones here,
839 * hopefully only one is used.
840 */
841 bd->BD_EMAC_ADDR(0,i) = *cp;
842
843#ifdef CONFIG_PCI
844 bd->bi_pci_enetaddr[i] = *cp++;
845#endif
846 }
847 bd->bi_tbfreq = 200 * 1000 * 1000;
848 bd->bi_intfreq = 200000000;
849 bd->bi_busfreq = 100000000;
850#ifdef CONFIG_PCI
851 bd->bi_pci_busfreq = 66666666;
852#endif
853 }
854 /* Yeah, this look weird, but on Redwood 4 they are
855 * different object in the structure. Sincr Redwwood 5
856 * and Redwood 6 use OpenBIOS, it requires a special value.
857 */
858#if defined(CONFIG_REDWOOD_5) || defined (CONFIG_REDWOOD_6)
859 bd->bi_tbfreq = 27 * 1000 * 1000;
860#endif
861 timebase_period_ns = 1000000000 / bd->bi_tbfreq;
862}
863#endif /* CONFIG_BEECH */
864#endif /* CONFIG_IBM_OPENBIOS */
865
866#ifdef CONFIG_EP405
867#include <linux/serial_reg.h>
868
869void
870embed_config(bd_t **bdp)
871{
872 u32 chcr0;
873 u_char *cp;
874 bd_t *bd;
875
876 /* Different versions of the PlanetCore firmware vary in how
877 they set up the serial port - in particular whether they
878 use the internal or external serial clock for UART0. Make
879 sure the UART is in a known state. */
880 /* FIXME: We should use the board's 11.0592MHz external serial
881 clock - it will be more accurate for serial rates. For
882 now, however the baud rates in ep405.h are for the internal
883 clock. */
884 chcr0 = mfdcr(DCRN_CHCR0);
885 if ( (chcr0 & 0x1fff) != 0x103e ) {
886 mtdcr(DCRN_CHCR0, (chcr0 & 0xffffe000) | 0x103e);
887 /* The following tricks serial_init() into resetting the baud rate */
888 writeb(0, UART0_IO_BASE + UART_LCR);
889 }
890
891 /* We haven't seen actual problems with the EP405 leaving the
892 * EMAC running (as we have on Walnut). But the registers
893 * suggest it may not be left completely quiescent. Reset it
894 * just to be sure. */
895 mtdcr(DCRN_MALCR(DCRN_MAL_BASE), MALCR_MMSR); /* 1st reset MAL */
896 while (mfdcr(DCRN_MALCR(DCRN_MAL_BASE)) & MALCR_MMSR) {}; /* wait for the reset */
897 out_be32((unsigned *)EMAC0_BASE,0x20000000); /* then reset EMAC */
898
899 bd = &bdinfo;
900 *bdp = bd;
901#if 1
902 cp = (u_char *)0xF0000EE0;
903 for (;;) {
904 if (*cp == 'E') {
905 cp++;
906 if (*cp == 'A') {
907 cp += 2;
908 rpx_eth(bd, cp);
909 }
910 }
911
912 if (*cp == 'D') {
913 cp++;
914 if (*cp == '1') {
915 cp += 2;
916 rpx_memsize(bd, cp);
917 }
918 }
919
920 if (*cp == 'N') {
921 cp++;
922 if (*cp == 'V') {
923 cp += 2;
924 rpx_nvramsize(bd, cp);
925 }
926 }
927 while ((*cp != '\n') && (*cp != 0xff))
928 cp++;
929
930 cp++;
931 if ((*cp == 0) || (*cp == 0xff))
932 break;
933 }
934 bd->bi_intfreq = 200000000;
935 bd->bi_busfreq = 100000000;
936 bd->bi_pci_busfreq= 33000000 ;
937#else
938
939 bd->bi_memsize = 64000000;
940 bd->bi_intfreq = 200000000;
941 bd->bi_busfreq = 100000000;
942 bd->bi_pci_busfreq= 33000000 ;
943#endif
944}
945#endif
946
947#ifdef CONFIG_RAINIER
948/* Rainier uses vxworks bootrom */
949void
950embed_config(bd_t **bdp)
951{
952 u_char *cp;
953 int i;
954 bd_t *bd;
955
956 bd = &bdinfo;
957 *bdp = bd;
958
959 for(i=0;i<8192;i+=32) {
960 __asm__("dccci 0,%0" :: "r" (i));
961 }
962 __asm__("iccci 0,0");
963 __asm__("sync;isync");
964
965 /* init ram for parity */
966 memset(0, 0,0x400000); /* Lo memory */
967
968
969 bd->bi_memsize = (32 * 1024 * 1024) ;
970 bd->bi_intfreq = 133000000; //the internal clock is 133 MHz
971 bd->bi_busfreq = 100000000;
972 bd->bi_pci_busfreq= 33000000;
973
974 cp = (u_char *)def_enet_addr;
975 for (i=0; i<6; i++) {
976 bd->bi_enetaddr[i] = *cp++;
977 }
978
979}
980#endif
981
diff --git a/arch/ppc/boot/simple/head.S b/arch/ppc/boot/simple/head.S
new file mode 100644
index 000000000000..524053202bb4
--- /dev/null
+++ b/arch/ppc/boot/simple/head.S
@@ -0,0 +1,142 @@
1/*
2 * arch/ppc/boot/simple/head.S
3 *
4 * Initial board bringup code for many different boards.
5 *
6 * Author: Tom Rini
7 * trini@mvista.com
8 * Derived from arch/ppc/boot/prep/head.S (Cort Dougan, many others).
9 *
10 * 2001-2004 (c) MontaVista, Software, Inc. This file is licensed under
11 * the terms of the GNU General Public License version 2. This program
12 * is licensed "as is" without any warranty of any kind, whether express
13 * or implied.
14 */
15
16#include <linux/config.h>
17#include <asm/reg.h>
18#include <asm/cache.h>
19#include <asm/ppc_asm.h>
20
21 .text
22
23/*
24 * Begin at some arbitrary location in RAM or Flash
25 * Initialize core registers
26 * Configure memory controller (Not executing from RAM)
27 * Move the boot code to the link address (8M)
28 * Setup C stack
29 * Initialize UART
30 * Decompress the kernel to 0x0
31 * Jump to the kernel entry
32 *
33 */
34
35 .globl start
36start:
37 bl start_
38#ifdef CONFIG_IBM_OPENBIOS
39 /* The IBM "Tree" bootrom knows that the address of the bootrom
40 * read only structure is 4 bytes after _start.
41 */
42 .long 0x62726f6d # structure ID - "brom"
43 .long 0x5f726f00 # - "_ro\0"
44 .long 1 # structure version
45 .long bootrom_cmdline # address of *bootrom_cmdline
46#endif
47
48start_:
49#ifdef CONFIG_FORCE
50 /* We have some really bad firmware. We must disable the L1
51 * icache/dcache now or the board won't boot.
52 */
53 li r4,0x0000
54 isync
55 mtspr SPRN_HID0,r4
56 sync
57 isync
58#endif
59
60#if defined(CONFIG_MBX) || defined(CONFIG_RPX8260) || defined(CONFIG_PPC_PREP)
61 mr r29,r3 /* On the MBX860, r3 is the board info pointer.
62 * On the RPXSUPER, r3 points to the NVRAM
63 * configuration keys.
64 * On PReP, r3 is the pointer to the residual data.
65 */
66#endif
67
68 mflr r3 /* Save our actual starting address. */
69
70 /* The following functions we call must not modify r3 or r4.....
71 */
72#ifdef CONFIG_6xx
73 /* On PReP we must look at the OpenFirmware pointer and sanity
74 * test it. On other platforms, we disable the MMU right now
75 * and other bits.
76 */
77#ifdef CONFIG_PPC_PREP
78/*
79 * Save the OF pointer to r25, but only if the entry point is in a sane
80 * location; if not we store 0. If there is no entry point, or it is
81 * invalid, we establish the default MSR value immediately. Otherwise,
82 * we defer doing that, to allow OF functions to be called, until we
83 * begin uncompressing the kernel.
84 */
85 lis r8,0x0fff /* r8 = 0x0fffffff */
86 ori r8,r8,0xffff
87
88 subc r8,r8,r5 /* r8 = (r5 <= r8) ? ~0 : 0 */
89 subfe r8,r8,r8
90 nand r8,r8,r8
91
92 and. r5,r5,r8 /* r5 will be cleared if (r5 > r8) */
93 bne+ haveOF
94
95 li r8,MSR_IP|MSR_FP /* Not OF: set MSR immediately */
96 mtmsr r8
97 isync
98haveOF:
99 mr r25,r5
100#else
101 bl disable_6xx_mmu
102#endif
103 bl disable_6xx_l1cache
104
105 CLEAR_CACHES
106#endif
107
108#ifdef CONFIG_8xx
109 mfmsr r8 /* Turn off interrupts */
110 li r9,0
111 ori r9,r9,MSR_EE
112 andc r8,r8,r9
113 mtmsr r8
114
115 /* We do this because some boot roms don't initialize the
116 * processor correctly. Don't do this if you want to debug
117 * using a BDM device.
118 */
119 li r4,0 /* Zero DER to prevent FRZ */
120 mtspr SPRN_DER,r4
121#endif
122
123#ifdef CONFIG_REDWOOD_4
124 /* All of this Redwood 4 stuff will soon disappear when the
125 * boot rom is straightened out.
126 */
127 mr r29, r3 /* Easier than changing the other code */
128 bl HdwInit
129 mr r3, r29
130#endif
131
132#if defined(CONFIG_MBX) || defined(CONFIG_RPX8260) || defined(CONFIG_PPC_PREP)
133 mr r4,r29 /* put the board info pointer where the relocate
134 * routine will find it
135 */
136#endif
137
138 /* Get the load address.
139 */
140 subi r3, r3, 4 /* Get the actual IP, not NIP */
141 b relocate
142
diff --git a/arch/ppc/boot/simple/iic.c b/arch/ppc/boot/simple/iic.c
new file mode 100644
index 000000000000..e4efd838bfaa
--- /dev/null
+++ b/arch/ppc/boot/simple/iic.c
@@ -0,0 +1,214 @@
1/* Minimal support functions to read configuration from IIC EEPROMS
2 * on MPC8xx boards. Originally written for RPGC RPX-Lite.
3 * Dan Malek (dmalek@jlc.net).
4 */
5#include <linux/types.h>
6#include <asm/uaccess.h>
7#include <asm/mpc8xx.h>
8#include <asm/commproc.h>
9
10
11/* IIC functions.
12 * These are just the basic master read/write operations so we can
13 * examine serial EEPROM.
14 */
15void iic_read(uint devaddr, u_char *buf, uint offset, uint count);
16
17static int iic_init_done;
18
19static void
20iic_init(void)
21{
22 volatile iic_t *iip;
23 volatile i2c8xx_t *i2c;
24 volatile cpm8xx_t *cp;
25 volatile immap_t *immap;
26 uint dpaddr;
27
28 immap = (immap_t *)IMAP_ADDR;
29 cp = (cpm8xx_t *)&(immap->im_cpm);
30
31 /* Reset the CPM. This is necessary on the 860 processors
32 * that may have started the SCC1 ethernet without relocating
33 * the IIC.
34 * This also stops the Ethernet in case we were loaded by a
35 * BOOTP rom monitor.
36 */
37 cp->cp_cpcr = (CPM_CR_RST | CPM_CR_FLG);
38
39 /* Wait for it.
40 */
41 while (cp->cp_cpcr & (CPM_CR_RST | CPM_CR_FLG));
42
43 /* Remove any microcode patches. We will install our own
44 * later.
45 */
46 cp->cp_cpmcr1 = 0;
47 cp->cp_cpmcr2 = 0;
48 cp->cp_cpmcr3 = 0;
49 cp->cp_cpmcr4 = 0;
50 cp->cp_rccr = 0;
51
52 iip = (iic_t *)&cp->cp_dparam[PROFF_IIC];
53 i2c = (i2c8xx_t *)&(immap->im_i2c);
54
55 /* Initialize Port B IIC pins.
56 */
57 cp->cp_pbpar |= 0x00000030;
58 cp->cp_pbdir |= 0x00000030;
59 cp->cp_pbodr |= 0x00000030;
60
61 /* Initialize the parameter ram.
62 */
63
64 /* Allocate space for a two transmit and one receive buffer
65 * descriptor in the DP ram.
66 * For now, this address seems OK, but it may have to
67 * change with newer versions of the firmware.
68 */
69 dpaddr = 0x0840;
70
71 /* Set up the IIC parameters in the parameter ram.
72 */
73 iip->iic_tbase = dpaddr;
74 iip->iic_rbase = dpaddr + (2 * sizeof(cbd_t));
75
76 iip->iic_tfcr = SMC_EB;
77 iip->iic_rfcr = SMC_EB;
78
79 /* This should really be done by the reader/writer.
80 */
81 iip->iic_mrblr = 128;
82
83 /* Initialize Tx/Rx parameters.
84 */
85 cp->cp_cpcr = mk_cr_cmd(CPM_CR_CH_I2C, CPM_CR_INIT_TRX) | CPM_CR_FLG;
86 while (cp->cp_cpcr & CPM_CR_FLG);
87
88 /* Select an arbitrary address. Just make sure it is unique.
89 */
90 i2c->i2c_i2add = 0x34;
91
92 /* Make clock run maximum slow.
93 */
94 i2c->i2c_i2brg = 7;
95
96 /* Disable interrupts.
97 */
98 i2c->i2c_i2cmr = 0;
99 i2c->i2c_i2cer = 0xff;
100
101 /* Enable SDMA.
102 */
103 immap->im_siu_conf.sc_sdcr = 1;
104
105 iic_init_done = 1;
106}
107
108/* Read from IIC.
109 * Caller provides device address, memory buffer, and byte count.
110 */
111static u_char iitemp[32];
112
113void
114iic_read(uint devaddr, u_char *buf, uint offset, uint count)
115{
116 volatile iic_t *iip;
117 volatile i2c8xx_t *i2c;
118 volatile cbd_t *tbdf, *rbdf;
119 volatile cpm8xx_t *cp;
120 volatile immap_t *immap;
121 u_char *tb;
122 uint temp;
123
124 /* If the interface has not been initialized, do that now.
125 */
126 if (!iic_init_done)
127 iic_init();
128
129 immap = (immap_t *)IMAP_ADDR;
130 cp = (cpm8xx_t *)&(immap->im_cpm);
131
132 iip = (iic_t *)&cp->cp_dparam[PROFF_IIC];
133 i2c = (i2c8xx_t *)&(immap->im_i2c);
134
135 tbdf = (cbd_t *)&cp->cp_dpmem[iip->iic_tbase];
136 rbdf = (cbd_t *)&cp->cp_dpmem[iip->iic_rbase];
137
138 /* Send a "dummy write" operation. This is a write request with
139 * only the offset sent, followed by another start condition.
140 * This will ensure we start reading from the first location
141 * of the EEPROM.
142 */
143 tb = iitemp;
144 tb = (u_char *)(((uint)tb + 15) & ~15);
145 tbdf->cbd_bufaddr = (int)tb;
146 *tb = devaddr & 0xfe; /* Device address */
147 *(tb+1) = offset; /* Offset */
148 tbdf->cbd_datlen = 2; /* Length */
149 tbdf->cbd_sc =
150 BD_SC_READY | BD_SC_LAST | BD_SC_WRAP | BD_IIC_START;
151
152 i2c->i2c_i2mod = 1; /* Enable */
153 i2c->i2c_i2cer = 0xff;
154 i2c->i2c_i2com = 0x81; /* Start master */
155
156 /* Wait for IIC transfer.
157 */
158#if 0
159 while ((i2c->i2c_i2cer & 3) == 0);
160
161 if (tbdf->cbd_sc & BD_SC_READY)
162 printf("IIC ra complete but tbuf ready\n");
163#else
164 temp = 10000000;
165 while ((tbdf->cbd_sc & BD_SC_READY) && (temp != 0))
166 temp--;
167#if 0
168 /* We can't do this...there is no serial port yet!
169 */
170 if (temp == 0) {
171 printf("Timeout reading EEPROM\n");
172 return;
173 }
174#endif
175#endif
176
177 /* Chip errata, clear enable.
178 */
179 i2c->i2c_i2mod = 0;
180
181 /* To read, we need an empty buffer of the proper length.
182 * All that is used is the first byte for address, the remainder
183 * is just used for timing (and doesn't really have to exist).
184 */
185 tbdf->cbd_bufaddr = (int)tb;
186 *tb = devaddr | 1; /* Device address */
187 rbdf->cbd_bufaddr = (uint)buf; /* Desination buffer */
188 tbdf->cbd_datlen = rbdf->cbd_datlen = count + 1; /* Length */
189 tbdf->cbd_sc = BD_SC_READY | BD_SC_LAST | BD_SC_WRAP | BD_IIC_START;
190 rbdf->cbd_sc = BD_SC_EMPTY | BD_SC_WRAP;
191
192 /* Chip bug, set enable here.
193 */
194 i2c->i2c_i2mod = 1; /* Enable */
195 i2c->i2c_i2cer = 0xff;
196 i2c->i2c_i2com = 0x81; /* Start master */
197
198 /* Wait for IIC transfer.
199 */
200#if 0
201 while ((i2c->i2c_i2cer & 1) == 0);
202
203 if (rbdf->cbd_sc & BD_SC_EMPTY)
204 printf("IIC read complete but rbuf empty\n");
205#else
206 temp = 10000000;
207 while ((tbdf->cbd_sc & BD_SC_READY) && (temp != 0))
208 temp--;
209#endif
210
211 /* Chip errata, clear enable.
212 */
213 i2c->i2c_i2mod = 0;
214}
diff --git a/arch/ppc/boot/simple/m8260_tty.c b/arch/ppc/boot/simple/m8260_tty.c
new file mode 100644
index 000000000000..d770947e9b8f
--- /dev/null
+++ b/arch/ppc/boot/simple/m8260_tty.c
@@ -0,0 +1,325 @@
1/* Minimal serial functions needed to send messages out the serial
2 * port on SMC1.
3 */
4#include <linux/types.h>
5#include <asm/mpc8260.h>
6#include <asm/cpm2.h>
7#include <asm/immap_cpm2.h>
8
9uint no_print;
10extern char *params[];
11extern int nparams;
12static u_char cons_hold[128], *sgptr;
13static int cons_hold_cnt;
14
15/* If defined, enables serial console. The value (1 through 4)
16 * should designate which SCC is used, but this isn't complete. Only
17 * SCC1 is known to work at this time.
18 * We're only linked if SERIAL_CPM_CONSOLE=y, so we only need to test
19 * SERIAL_CPM_SCC1.
20 */
21#ifdef CONFIG_SERIAL_CPM_SCC1
22#define SCC_CONSOLE 1
23#endif
24
25unsigned long
26serial_init(int ignored, bd_t *bd)
27{
28#ifdef SCC_CONSOLE
29 volatile scc_t *sccp;
30 volatile scc_uart_t *sup;
31#else
32 volatile smc_t *sp;
33 volatile smc_uart_t *up;
34#endif
35 volatile cbd_t *tbdf, *rbdf;
36 volatile cpm2_map_t *ip;
37 volatile iop_cpm2_t *io;
38 volatile cpm_cpm2_t *cp;
39 uint dpaddr, memaddr;
40
41 ip = (cpm2_map_t *)CPM_MAP_ADDR;
42 cp = &ip->im_cpm;
43 io = &ip->im_ioport;
44
45 /* Perform a reset.
46 */
47 cp->cp_cpcr = (CPM_CR_RST | CPM_CR_FLG);
48
49 /* Wait for it.
50 */
51 while (cp->cp_cpcr & CPM_CR_FLG);
52
53#ifdef CONFIG_ADS8260
54 /* Enable the RS-232 transceivers.
55 */
56 *(volatile uint *)(BCSR_ADDR + 4) &=
57 ~(BCSR1_RS232_EN1 | BCSR1_RS232_EN2);
58#endif
59
60#ifdef SCC_CONSOLE
61 sccp = (scc_t *)&(ip->im_scc[SCC_CONSOLE-1]);
62 sup = (scc_uart_t *)&ip->im_dprambase[PROFF_SCC1 + ((SCC_CONSOLE-1) << 8)];
63 sccp->scc_sccm &= ~(UART_SCCM_TX | UART_SCCM_RX);
64 sccp->scc_gsmrl &= ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT);
65
66 /* Use Port D for SCC1 instead of other functions.
67 */
68 io->iop_ppard |= 0x00000003;
69 io->iop_psord &= ~0x00000001; /* Rx */
70 io->iop_psord |= 0x00000002; /* Tx */
71 io->iop_pdird &= ~0x00000001; /* Rx */
72 io->iop_pdird |= 0x00000002; /* Tx */
73
74#else
75 sp = (smc_t*)&(ip->im_smc[0]);
76 *(ushort *)(&ip->im_dprambase[PROFF_SMC1_BASE]) = PROFF_SMC1;
77 up = (smc_uart_t *)&ip->im_dprambase[PROFF_SMC1];
78
79 /* Disable transmitter/receiver.
80 */
81 sp->smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN);
82
83 /* Use Port D for SMC1 instead of other functions.
84 */
85 io->iop_ppard |= 0x00c00000;
86 io->iop_pdird |= 0x00400000;
87 io->iop_pdird &= ~0x00800000;
88 io->iop_psord &= ~0x00c00000;
89#endif
90
91 /* Allocate space for two buffer descriptors in the DP ram.
92 * For now, this address seems OK, but it may have to
93 * change with newer versions of the firmware.
94 */
95 dpaddr = 0x0800;
96
97 /* Grab a few bytes from the top of memory.
98 */
99 memaddr = (bd->bi_memsize - 256) & ~15;
100
101 /* Set the physical address of the host memory buffers in
102 * the buffer descriptors.
103 */
104 rbdf = (cbd_t *)&ip->im_dprambase[dpaddr];
105 rbdf->cbd_bufaddr = memaddr;
106 rbdf->cbd_sc = 0;
107 tbdf = rbdf + 1;
108 tbdf->cbd_bufaddr = memaddr+128;
109 tbdf->cbd_sc = 0;
110
111 /* Set up the uart parameters in the parameter ram.
112 */
113#ifdef SCC_CONSOLE
114 sup->scc_genscc.scc_rbase = dpaddr;
115 sup->scc_genscc.scc_tbase = dpaddr + sizeof(cbd_t);
116
117 /* Set up the uart parameters in the
118 * parameter ram.
119 */
120 sup->scc_genscc.scc_rfcr = CPMFCR_GBL | CPMFCR_EB;
121 sup->scc_genscc.scc_tfcr = CPMFCR_GBL | CPMFCR_EB;
122
123 sup->scc_genscc.scc_mrblr = 128;
124 sup->scc_maxidl = 8;
125 sup->scc_brkcr = 1;
126 sup->scc_parec = 0;
127 sup->scc_frmec = 0;
128 sup->scc_nosec = 0;
129 sup->scc_brkec = 0;
130 sup->scc_uaddr1 = 0;
131 sup->scc_uaddr2 = 0;
132 sup->scc_toseq = 0;
133 sup->scc_char1 = 0x8000;
134 sup->scc_char2 = 0x8000;
135 sup->scc_char3 = 0x8000;
136 sup->scc_char4 = 0x8000;
137 sup->scc_char5 = 0x8000;
138 sup->scc_char6 = 0x8000;
139 sup->scc_char7 = 0x8000;
140 sup->scc_char8 = 0x8000;
141 sup->scc_rccm = 0xc0ff;
142
143 /* Send the CPM an initialize command.
144 */
145 cp->cp_cpcr = mk_cr_cmd(CPM_CR_SCC1_PAGE, CPM_CR_SCC1_SBLOCK, 0,
146 CPM_CR_INIT_TRX) | CPM_CR_FLG;
147 while (cp->cp_cpcr & CPM_CR_FLG);
148
149 /* Set UART mode, 8 bit, no parity, one stop.
150 * Enable receive and transmit.
151 */
152 sccp->scc_gsmrh = 0;
153 sccp->scc_gsmrl =
154 (SCC_GSMRL_MODE_UART | SCC_GSMRL_TDCR_16 | SCC_GSMRL_RDCR_16);
155
156 /* Disable all interrupts and clear all pending
157 * events.
158 */
159 sccp->scc_sccm = 0;
160 sccp->scc_scce = 0xffff;
161 sccp->scc_dsr = 0x7e7e;
162 sccp->scc_psmr = 0x3000;
163
164 /* Wire BRG1 to SCC1. The console driver will take care of
165 * others.
166 */
167 ip->im_cpmux.cmx_scr = 0;
168#else
169 up->smc_rbase = dpaddr;
170 up->smc_tbase = dpaddr+sizeof(cbd_t);
171 up->smc_rfcr = CPMFCR_EB;
172 up->smc_tfcr = CPMFCR_EB;
173 up->smc_brklen = 0;
174 up->smc_brkec = 0;
175 up->smc_brkcr = 0;
176 up->smc_mrblr = 128;
177 up->smc_maxidl = 8;
178
179 /* Set UART mode, 8 bit, no parity, one stop.
180 * Enable receive and transmit.
181 */
182 sp->smc_smcmr = smcr_mk_clen(9) | SMCMR_SM_UART;
183
184 /* Mask all interrupts and remove anything pending.
185 */
186 sp->smc_smcm = 0;
187 sp->smc_smce = 0xff;
188
189 /* Set up the baud rate generator.
190 */
191 ip->im_cpmux.cmx_smr = 0;
192#endif
193
194 /* The baud rate divisor needs to be coordinated with clk_8260().
195 */
196 ip->im_brgc1 =
197 (((bd->bi_brgfreq/16) / bd->bi_baudrate) << 1) |
198 CPM_BRG_EN;
199
200 /* Make the first buffer the only buffer.
201 */
202 tbdf->cbd_sc |= BD_SC_WRAP;
203 rbdf->cbd_sc |= BD_SC_EMPTY | BD_SC_WRAP;
204
205 /* Initialize Tx/Rx parameters.
206 */
207#ifdef SCC_CONSOLE
208 sccp->scc_gsmrl |= (SCC_GSMRL_ENR | SCC_GSMRL_ENT);
209#else
210 cp->cp_cpcr = mk_cr_cmd(CPM_CR_SMC1_PAGE, CPM_CR_SMC1_SBLOCK, 0, CPM_CR_INIT_TRX) | CPM_CR_FLG;
211 while (cp->cp_cpcr & CPM_CR_FLG);
212
213 /* Enable transmitter/receiver.
214 */
215 sp->smc_smcmr |= SMCMR_REN | SMCMR_TEN;
216#endif
217
218 /* This is ignored.
219 */
220 return 0;
221}
222
223int
224serial_readbuf(u_char *cbuf)
225{
226 volatile cbd_t *rbdf;
227 volatile char *buf;
228#ifdef SCC_CONSOLE
229 volatile scc_uart_t *sup;
230#else
231 volatile smc_uart_t *up;
232#endif
233 volatile cpm2_map_t *ip;
234 int i, nc;
235
236 ip = (cpm2_map_t *)CPM_MAP_ADDR;
237
238#ifdef SCC_CONSOLE
239 sup = (scc_uart_t *)&ip->im_dprambase[PROFF_SCC1 + ((SCC_CONSOLE-1) << 8)];
240 rbdf = (cbd_t *)&ip->im_dprambase[sup->scc_genscc.scc_rbase];
241#else
242 up = (smc_uart_t *)&(ip->im_dprambase[PROFF_SMC1]);
243 rbdf = (cbd_t *)&ip->im_dprambase[up->smc_rbase];
244#endif
245
246 /* Wait for character to show up.
247 */
248 buf = (char *)rbdf->cbd_bufaddr;
249 while (rbdf->cbd_sc & BD_SC_EMPTY);
250 nc = rbdf->cbd_datlen;
251 for (i=0; i<nc; i++)
252 *cbuf++ = *buf++;
253 rbdf->cbd_sc |= BD_SC_EMPTY;
254
255 return(nc);
256}
257
258void
259serial_putc(void *ignored, const char c)
260{
261 volatile cbd_t *tbdf;
262 volatile char *buf;
263#ifdef SCC_CONSOLE
264 volatile scc_uart_t *sup;
265#else
266 volatile smc_uart_t *up;
267#endif
268 volatile cpm2_map_t *ip;
269
270 ip = (cpm2_map_t *)CPM_MAP_ADDR;
271#ifdef SCC_CONSOLE
272 sup = (scc_uart_t *)&ip->im_dprambase[PROFF_SCC1 + ((SCC_CONSOLE-1) << 8)];
273 tbdf = (cbd_t *)&ip->im_dprambase[sup->scc_genscc.scc_tbase];
274#else
275 up = (smc_uart_t *)&(ip->im_dprambase[PROFF_SMC1]);
276 tbdf = (cbd_t *)&ip->im_dprambase[up->smc_tbase];
277#endif
278
279 /* Wait for last character to go.
280 */
281 buf = (char *)tbdf->cbd_bufaddr;
282 while (tbdf->cbd_sc & BD_SC_READY);
283
284 *buf = c;
285 tbdf->cbd_datlen = 1;
286 tbdf->cbd_sc |= BD_SC_READY;
287}
288
289char
290serial_getc(void *ignored)
291{
292 char c;
293
294 if (cons_hold_cnt <= 0) {
295 cons_hold_cnt = serial_readbuf(cons_hold);
296 sgptr = cons_hold;
297 }
298 c = *sgptr++;
299 cons_hold_cnt--;
300
301 return(c);
302}
303
304int
305serial_tstc(void *ignored)
306{
307 volatile cbd_t *rbdf;
308#ifdef SCC_CONSOLE
309 volatile scc_uart_t *sup;
310#else
311 volatile smc_uart_t *up;
312#endif
313 volatile cpm2_map_t *ip;
314
315 ip = (cpm2_map_t *)CPM_MAP_ADDR;
316#ifdef SCC_CONSOLE
317 sup = (scc_uart_t *)&ip->im_dprambase[PROFF_SCC1 + ((SCC_CONSOLE-1) << 8)];
318 rbdf = (cbd_t *)&ip->im_dprambase[sup->scc_genscc.scc_rbase];
319#else
320 up = (smc_uart_t *)&(ip->im_dprambase[PROFF_SMC1]);
321 rbdf = (cbd_t *)&ip->im_dprambase[up->smc_rbase];
322#endif
323
324 return(!(rbdf->cbd_sc & BD_SC_EMPTY));
325}
diff --git a/arch/ppc/boot/simple/m8xx_tty.c b/arch/ppc/boot/simple/m8xx_tty.c
new file mode 100644
index 000000000000..1d2778e248c6
--- /dev/null
+++ b/arch/ppc/boot/simple/m8xx_tty.c
@@ -0,0 +1,290 @@
1/* Minimal serial functions needed to send messages out the serial
2 * port on the MBX console.
3 *
4 * The MBX uxes SMC1 for the serial port. We reset the port and use
5 * only the first BD that EPPC-Bug set up as a character FIFO.
6 *
7 * Later versions (at least 1.4, maybe earlier) of the MBX EPPC-Bug
8 * use COM1 instead of SMC1 as the console port. This kinda sucks
9 * for the rest of the kernel, so here we force the use of SMC1 again.
10 */
11#include <linux/config.h>
12#include <linux/types.h>
13#include <asm/uaccess.h>
14#include <asm/mpc8xx.h>
15#include <asm/commproc.h>
16
17#ifdef CONFIG_MBX
18#define MBX_CSR1 ((volatile u_char *)0xfa100000)
19#define CSR1_COMEN (u_char)0x02
20#endif
21
22#ifdef TQM_SMC2_CONSOLE
23#define PROFF_CONS PROFF_SMC2
24#define CPM_CR_CH_CONS CPM_CR_CH_SMC2
25#define SMC_INDEX 1
26static volatile iop8xx_t *iopp = (iop8xx_t *)&(((immap_t *)IMAP_ADDR)->im_ioport);
27#else
28#define PROFF_CONS PROFF_SMC1
29#define CPM_CR_CH_CONS CPM_CR_CH_SMC1
30#define SMC_INDEX 0
31#endif
32
33static cpm8xx_t *cpmp = (cpm8xx_t *)&(((immap_t *)IMAP_ADDR)->im_cpm);
34
35unsigned long
36serial_init(int ignored, bd_t *bd)
37{
38 volatile smc_t *sp;
39 volatile smc_uart_t *up;
40 volatile cbd_t *tbdf, *rbdf;
41 volatile cpm8xx_t *cp;
42 uint dpaddr, memaddr;
43#ifndef CONFIG_MBX
44 uint ui;
45#endif
46
47 cp = cpmp;
48 sp = (smc_t*)&(cp->cp_smc[SMC_INDEX]);
49 up = (smc_uart_t *)&cp->cp_dparam[PROFF_CONS];
50
51 /* Disable transmitter/receiver.
52 */
53 sp->smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN);
54
55#ifdef CONFIG_FADS
56 /* Enable SMC1/2 transceivers.
57 */
58 *((volatile uint *)BCSR1) &= ~(BCSR1_RS232EN_1|BCSR1_RS232EN_2);
59#endif
60
61#ifndef CONFIG_MBX
62 {
63 /* Initialize SMCx and use it for the console port.
64 */
65
66 /* Enable SDMA.
67 */
68 ((immap_t *)IMAP_ADDR)->im_siu_conf.sc_sdcr = 1;
69
70#ifdef TQM_SMC2_CONSOLE
71 /* Use Port A for SMC2 instead of other functions.
72 */
73 iopp->iop_papar |= 0x00c0;
74 iopp->iop_padir &= ~0x00c0;
75 iopp->iop_paodr &= ~0x00c0;
76#else
77 /* Use Port B for SMCs instead of other functions.
78 */
79 cp->cp_pbpar |= 0x00000cc0;
80 cp->cp_pbdir &= ~0x00000cc0;
81 cp->cp_pbodr &= ~0x00000cc0;
82#endif
83
84 /* Allocate space for two buffer descriptors in the DP ram.
85 * For now, this address seems OK, but it may have to
86 * change with newer versions of the firmware.
87 */
88 dpaddr = 0x0800;
89
90 /* Grab a few bytes from the top of memory for SMC FIFOs.
91 */
92 memaddr = (bd->bi_memsize - 32) & ~15;
93
94 /* Set the physical address of the host memory buffers in
95 * the buffer descriptors.
96 */
97 rbdf = (cbd_t *)&cp->cp_dpmem[dpaddr];
98 rbdf->cbd_bufaddr = memaddr;
99 rbdf->cbd_sc = 0;
100 tbdf = rbdf + 1;
101 tbdf->cbd_bufaddr = memaddr+4;
102 tbdf->cbd_sc = 0;
103
104 /* Set up the uart parameters in the parameter ram.
105 */
106 up->smc_rbase = dpaddr;
107 up->smc_tbase = dpaddr+sizeof(cbd_t);
108 up->smc_rfcr = SMC_EB;
109 up->smc_tfcr = SMC_EB;
110
111 /* Set UART mode, 8 bit, no parity, one stop.
112 * Enable receive and transmit.
113 */
114 sp->smc_smcmr = smcr_mk_clen(9) | SMCMR_SM_UART;
115
116 /* Mask all interrupts and remove anything pending.
117 */
118 sp->smc_smcm = 0;
119 sp->smc_smce = 0xff;
120
121 /* Set up the baud rate generator.
122 * See 8xx_io/commproc.c for details.
123 * This wires BRG1 to SMC1 and BRG2 to SMC2;
124 */
125 cp->cp_simode = 0x10000000;
126 ui = bd->bi_intfreq / 16 / bd->bi_baudrate;
127#ifdef TQM_SMC2_CONSOLE
128 cp->cp_brgc2 =
129#else
130 cp->cp_brgc1 =
131#endif
132 ((ui - 1) < 4096)
133 ? (((ui - 1) << 1) | CPM_BRG_EN)
134 : ((((ui / 16) - 1) << 1) | CPM_BRG_EN | CPM_BRG_DIV16);
135
136#else /* CONFIG_MBX */
137 if (*MBX_CSR1 & CSR1_COMEN) {
138 /* COM1 is enabled. Initialize SMC1 and use it for
139 * the console port.
140 */
141
142 /* Enable SDMA.
143 */
144 ((immap_t *)IMAP_ADDR)->im_siu_conf.sc_sdcr = 1;
145
146 /* Use Port B for SMCs instead of other functions.
147 */
148 cp->cp_pbpar |= 0x00000cc0;
149 cp->cp_pbdir &= ~0x00000cc0;
150 cp->cp_pbodr &= ~0x00000cc0;
151
152 /* Allocate space for two buffer descriptors in the DP ram.
153 * For now, this address seems OK, but it may have to
154 * change with newer versions of the firmware.
155 */
156 dpaddr = 0x0800;
157
158 /* Grab a few bytes from the top of memory. EPPC-Bug isn't
159 * running any more, so we can do this.
160 */
161 memaddr = (bd->bi_memsize - 32) & ~15;
162
163 /* Set the physical address of the host memory buffers in
164 * the buffer descriptors.
165 */
166 rbdf = (cbd_t *)&cp->cp_dpmem[dpaddr];
167 rbdf->cbd_bufaddr = memaddr;
168 rbdf->cbd_sc = 0;
169 tbdf = rbdf + 1;
170 tbdf->cbd_bufaddr = memaddr+4;
171 tbdf->cbd_sc = 0;
172
173 /* Set up the uart parameters in the parameter ram.
174 */
175 up->smc_rbase = dpaddr;
176 up->smc_tbase = dpaddr+sizeof(cbd_t);
177 up->smc_rfcr = SMC_EB;
178 up->smc_tfcr = SMC_EB;
179
180 /* Set UART mode, 8 bit, no parity, one stop.
181 * Enable receive and transmit.
182 */
183 sp->smc_smcmr = smcr_mk_clen(9) | SMCMR_SM_UART;
184
185 /* Mask all interrupts and remove anything pending.
186 */
187 sp->smc_smcm = 0;
188 sp->smc_smce = 0xff;
189
190 /* Set up the baud rate generator.
191 * See 8xx_io/commproc.c for details.
192 */
193 cp->cp_simode = 0x10000000;
194 cp->cp_brgc1 =
195 (((bd->bi_intfreq/16) / 9600) << 1) | CPM_BRG_EN;
196
197 /* Enable SMC1 for console output.
198 */
199 *MBX_CSR1 &= ~CSR1_COMEN;
200 }
201 else {
202#endif /* ndef CONFIG_MBX */
203 /* SMCx is used as console port.
204 */
205 tbdf = (cbd_t *)&cp->cp_dpmem[up->smc_tbase];
206 rbdf = (cbd_t *)&cp->cp_dpmem[up->smc_rbase];
207
208 /* Issue a stop transmit, and wait for it.
209 */
210 cp->cp_cpcr = mk_cr_cmd(CPM_CR_CH_CONS,
211 CPM_CR_STOP_TX) | CPM_CR_FLG;
212 while (cp->cp_cpcr & CPM_CR_FLG);
213 }
214
215 /* Make the first buffer the only buffer.
216 */
217 tbdf->cbd_sc |= BD_SC_WRAP;
218 rbdf->cbd_sc |= BD_SC_EMPTY | BD_SC_WRAP;
219
220 /* Single character receive.
221 */
222 up->smc_mrblr = 1;
223 up->smc_maxidl = 0;
224
225 /* Initialize Tx/Rx parameters.
226 */
227 cp->cp_cpcr = mk_cr_cmd(CPM_CR_CH_CONS, CPM_CR_INIT_TRX) | CPM_CR_FLG;
228 while (cp->cp_cpcr & CPM_CR_FLG);
229
230 /* Enable transmitter/receiver.
231 */
232 sp->smc_smcmr |= SMCMR_REN | SMCMR_TEN;
233
234 /* This is ignored.
235 */
236 return 0;
237}
238
239void
240serial_putc(void *ignored, const char c)
241{
242 volatile cbd_t *tbdf;
243 volatile char *buf;
244 volatile smc_uart_t *up;
245
246 up = (smc_uart_t *)&cpmp->cp_dparam[PROFF_CONS];
247 tbdf = (cbd_t *)&cpmp->cp_dpmem[up->smc_tbase];
248
249 /* Wait for last character to go.
250 */
251 buf = (char *)tbdf->cbd_bufaddr;
252 while (tbdf->cbd_sc & BD_SC_READY);
253
254 *buf = c;
255 tbdf->cbd_datlen = 1;
256 tbdf->cbd_sc |= BD_SC_READY;
257}
258
259char
260serial_getc(void *ignored)
261{
262 volatile cbd_t *rbdf;
263 volatile char *buf;
264 volatile smc_uart_t *up;
265 char c;
266
267 up = (smc_uart_t *)&cpmp->cp_dparam[PROFF_CONS];
268 rbdf = (cbd_t *)&cpmp->cp_dpmem[up->smc_rbase];
269
270 /* Wait for character to show up.
271 */
272 buf = (char *)rbdf->cbd_bufaddr;
273 while (rbdf->cbd_sc & BD_SC_EMPTY);
274 c = *buf;
275 rbdf->cbd_sc |= BD_SC_EMPTY;
276
277 return(c);
278}
279
280int
281serial_tstc(void *ignored)
282{
283 volatile cbd_t *rbdf;
284 volatile smc_uart_t *up;
285
286 up = (smc_uart_t *)&cpmp->cp_dparam[PROFF_CONS];
287 rbdf = (cbd_t *)&cpmp->cp_dpmem[up->smc_rbase];
288
289 return(!(rbdf->cbd_sc & BD_SC_EMPTY));
290}
diff --git a/arch/ppc/boot/simple/misc-chestnut.c b/arch/ppc/boot/simple/misc-chestnut.c
new file mode 100644
index 000000000000..0dce7f3557e4
--- /dev/null
+++ b/arch/ppc/boot/simple/misc-chestnut.c
@@ -0,0 +1,35 @@
1/*
2 * arch/ppc/boot/simple/misc-chestnut.c
3 *
4 * Setup for the IBM Chestnut (ibm-750fxgx_eval)
5 *
6 * Author: Mark A. Greer <mgreer@mvista.com>
7 *
8 * 2005 (c) MontaVista Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
11 * or implied.
12 */
13
14#include <linux/config.h>
15#include <linux/types.h>
16#include <asm/io.h>
17#include <asm/mv64x60_defs.h>
18#include <platforms/chestnut.h>
19
20/* Not in the kernel so won't include kernel.h to get its 'max' definition */
21#define max(a,b) (((a) > (b)) ? (a) : (b))
22
23void
24mv64x60_board_init(void __iomem *old_base, void __iomem *new_base)
25{
26#ifdef CONFIG_SERIAL_8250_CONSOLE
27 /*
28 * Change device bus 2 window so that bootoader can do I/O thru
29 * 8250/16550 UART that's mapped in that window.
30 */
31 out_le32(new_base + MV64x60_CPU2DEV_2_BASE, CHESTNUT_UART_BASE >> 16);
32 out_le32(new_base + MV64x60_CPU2DEV_2_SIZE, CHESTNUT_UART_SIZE >> 16);
33 __asm__ __volatile__("sync");
34#endif
35}
diff --git a/arch/ppc/boot/simple/misc-cpci690.c b/arch/ppc/boot/simple/misc-cpci690.c
new file mode 100644
index 000000000000..ef08e86c9b25
--- /dev/null
+++ b/arch/ppc/boot/simple/misc-cpci690.c
@@ -0,0 +1,27 @@
1/*
2 * arch/ppc/boot/simple/misc-cpci690.c
3 *
4 * Add birec data for Force CPCI690 board.
5 *
6 * Author: Mark A. Greer <source@mvista.com>
7 *
8 * 2003 (c) MontaVista Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
11 * or implied.
12 */
13
14#include <linux/types.h>
15#include <platforms/cpci690.h>
16
17extern u32 mv64x60_console_baud;
18extern u32 mv64x60_mpsc_clk_src;
19extern u32 mv64x60_mpsc_clk_freq;
20
21void
22mv64x60_board_init(void __iomem *old_base, void __iomem *new_base)
23{
24 mv64x60_console_baud = CPCI690_MPSC_BAUD;
25 mv64x60_mpsc_clk_src = CPCI690_MPSC_CLK_SRC;
26 mv64x60_mpsc_clk_freq = CPCI690_BUS_FREQ;
27}
diff --git a/arch/ppc/boot/simple/misc-embedded.c b/arch/ppc/boot/simple/misc-embedded.c
new file mode 100644
index 000000000000..3865f3f8dcd1
--- /dev/null
+++ b/arch/ppc/boot/simple/misc-embedded.c
@@ -0,0 +1,275 @@
1/*
2 * Originally adapted by Gary Thomas. Much additional work by
3 * Cort Dougan <cort@fsmlabs.com>. On top of that still more work by
4 * Dan Malek <dmalek@jlc.net>.
5 *
6 * Currently maintained by: Tom Rini <trini@kernel.crashing.org>
7 */
8
9#include <linux/config.h>
10#include <linux/types.h>
11#include <linux/string.h>
12#include <asm/bootinfo.h>
13#include <asm/mmu.h>
14#include <asm/page.h>
15#include <asm/residual.h>
16#if defined(CONFIG_4xx)
17#include <asm/ibm4xx.h>
18#elif defined(CONFIG_8xx)
19#include <asm/mpc8xx.h>
20#elif defined(CONFIG_8260)
21#include <asm/mpc8260.h>
22#endif
23
24#include "nonstdio.h"
25
26/* The linker tells us where the image is. */
27extern char __image_begin, __image_end;
28extern char __ramdisk_begin, __ramdisk_end;
29extern char _end[];
30
31/* Because of the limited amount of memory on embedded, it presents
32 * loading problems. The biggest is that we load this boot program
33 * into a relatively low memory address, and the Linux kernel Bss often
34 * extends into this space when it get loaded. When the kernel starts
35 * and zeros the BSS space, it also writes over the information we
36 * save here and pass to the kernel (usually board info).
37 * On these boards, we grab some known memory holes to hold this information.
38 */
39char cmd_buf[256];
40char *cmd_line = cmd_buf;
41char *avail_ram;
42char *end_avail;
43char *zimage_start;
44
45/* This is for 4xx treeboot. It provides a place for the bootrom
46 * give us a pointer to a rom environment command line.
47 */
48char *bootrom_cmdline = "";
49
50/* This is the default cmdline that will be given to the user at boot time..
51 * If none was specified at compile time, we'll give it one that should work.
52 * -- Tom */
53#ifdef CONFIG_CMDLINE_BOOL
54char compiled_string[] = CONFIG_CMDLINE;
55#endif
56char ramroot_string[] = "root=/dev/ram";
57char netroot_string[] = "root=/dev/nfs rw ip=on";
58
59/* Serial port to use. */
60unsigned long com_port;
61
62/* We need to make sure that this is before the images to ensure
63 * that it's in a mapped location. - Tom */
64bd_t hold_resid_buf __attribute__ ((__section__ (".data.boot")));
65bd_t *hold_residual = &hold_resid_buf;
66
67extern unsigned long serial_init(int chan, bd_t *bp);
68extern void serial_close(unsigned long com_port);
69extern unsigned long start;
70extern void flush_instruction_cache(void);
71extern void gunzip(void *, int, unsigned char *, int *);
72extern void embed_config(bd_t **bp);
73
74/* Weak function for boards which don't need to build the
75 * board info struct because they are using PPCBoot/U-Boot.
76 */
77void __attribute__ ((weak))
78embed_config(bd_t **bdp)
79{
80}
81
82unsigned long
83load_kernel(unsigned long load_addr, int num_words, unsigned long cksum, bd_t *bp)
84{
85 char *cp, ch;
86 int timer = 0, zimage_size;
87 unsigned long initrd_size;
88
89 /* First, capture the embedded board information. Then
90 * initialize the serial console port.
91 */
92 embed_config(&bp);
93#if defined(CONFIG_SERIAL_CPM_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE)
94 com_port = serial_init(0, bp);
95#endif
96
97 /* Grab some space for the command line and board info. Since
98 * we no longer use the ELF header, but it was loaded, grab
99 * that space.
100 */
101#ifdef CONFIG_MBX
102 /* Because of the way the MBX loads the ELF image, we can't
103 * tell where we started. We read a magic variable from the NVRAM
104 * that gives us the intermediate buffer load address.
105 */
106 load_addr = *(uint *)0xfa000020;
107 load_addr += 0x10000; /* Skip ELF header */
108#endif
109 /* copy board data */
110 if (bp)
111 memcpy(hold_residual,bp,sizeof(bd_t));
112
113 /* Set end of memory available to us. It is always the highest
114 * memory address provided by the board information.
115 */
116 end_avail = (char *)(bp->bi_memsize);
117
118 puts("\nloaded at: "); puthex(load_addr);
119 puts(" "); puthex((unsigned long)(load_addr + (4*num_words))); puts("\n");
120 if ( (unsigned long)load_addr != (unsigned long)&start ) {
121 puts("relocated to: "); puthex((unsigned long)&start);
122 puts(" ");
123 puthex((unsigned long)((unsigned long)&start + (4*num_words)));
124 puts("\n");
125 }
126
127 if ( bp ) {
128 puts("board data at: "); puthex((unsigned long)bp);
129 puts(" ");
130 puthex((unsigned long)((unsigned long)bp + sizeof(bd_t)));
131 puts("\nrelocated to: ");
132 puthex((unsigned long)hold_residual);
133 puts(" ");
134 puthex((unsigned long)((unsigned long)hold_residual + sizeof(bd_t)));
135 puts("\n");
136 }
137
138 /*
139 * We link ourself to an arbitrary low address. When we run, we
140 * relocate outself to that address. __image_being points to
141 * the part of the image where the zImage is. -- Tom
142 */
143 zimage_start = (char *)(unsigned long)(&__image_begin);
144 zimage_size = (unsigned long)(&__image_end) -
145 (unsigned long)(&__image_begin);
146
147 initrd_size = (unsigned long)(&__ramdisk_end) -
148 (unsigned long)(&__ramdisk_begin);
149
150 /*
151 * The zImage and initrd will be between start and _end, so they've
152 * already been moved once. We're good to go now. -- Tom
153 */
154 puts("zimage at: "); puthex((unsigned long)zimage_start);
155 puts(" "); puthex((unsigned long)(zimage_size+zimage_start));
156 puts("\n");
157
158 if ( initrd_size ) {
159 puts("initrd at: ");
160 puthex((unsigned long)(&__ramdisk_begin));
161 puts(" "); puthex((unsigned long)(&__ramdisk_end));puts("\n");
162 }
163
164 /*
165 * setup avail_ram - this is the first part of ram usable
166 * by the uncompress code. Anything after this program in RAM
167 * is now fair game. -- Tom
168 */
169 avail_ram = (char *)PAGE_ALIGN((unsigned long)_end);
170
171 puts("avail ram: "); puthex((unsigned long)avail_ram); puts(" ");
172 puthex((unsigned long)end_avail); puts("\n");
173 puts("\nLinux/PPC load: ");
174 cp = cmd_line;
175 /* This is where we try and pick the right command line for booting.
176 * If we were given one at compile time, use it. It Is Right.
177 * If we weren't, see if we have a ramdisk. If so, thats root.
178 * When in doubt, give them the netroot (root=/dev/nfs rw) -- Tom
179 */
180#ifdef CONFIG_CMDLINE_BOOL
181 memcpy (cmd_line, compiled_string, sizeof(compiled_string));
182#else
183 if ( initrd_size )
184 memcpy (cmd_line, ramroot_string, sizeof(ramroot_string));
185 else
186 memcpy (cmd_line, netroot_string, sizeof(netroot_string));
187#endif
188 while ( *cp )
189 putc(*cp++);
190 while (timer++ < 5*1000) {
191 if (tstc()) {
192 while ((ch = getc()) != '\n' && ch != '\r') {
193 if (ch == '\b' || ch == '\177') {
194 if (cp != cmd_line) {
195 cp--;
196 puts("\b \b");
197 }
198 } else if (ch == '\030' /* ^x */
199 || ch == '\025') { /* ^u */
200 while (cp != cmd_line) {
201 cp--;
202 puts("\b \b");
203 }
204 } else {
205 *cp++ = ch;
206 putc(ch);
207 }
208 }
209 break; /* Exit 'timer' loop */
210 }
211 udelay(1000); /* 1 msec */
212 }
213 *cp = 0;
214 puts("\nUncompressing Linux...");
215
216 gunzip(0, 0x400000, zimage_start, &zimage_size);
217 flush_instruction_cache();
218 puts("done.\n");
219 {
220 struct bi_record *rec;
221 unsigned long initrd_loc = 0;
222 unsigned long rec_loc = _ALIGN((unsigned long)(zimage_size) +
223 (1 << 20) - 1, (1 << 20));
224 rec = (struct bi_record *)rec_loc;
225
226 /* We need to make sure that the initrd and bi_recs do not
227 * overlap. */
228 if ( initrd_size ) {
229 initrd_loc = (unsigned long)(&__ramdisk_begin);
230 /* If the bi_recs are in the middle of the current
231 * initrd, move the initrd to the next MB
232 * boundary. */
233 if ((rec_loc > initrd_loc) &&
234 ((initrd_loc + initrd_size)
235 > rec_loc)) {
236 initrd_loc = _ALIGN((unsigned long)(zimage_size)
237 + (2 << 20) - 1, (2 << 20));
238 memmove((void *)initrd_loc, &__ramdisk_begin,
239 initrd_size);
240 puts("initrd moved: "); puthex(initrd_loc);
241 puts(" "); puthex(initrd_loc + initrd_size);
242 puts("\n");
243 }
244 }
245
246 rec->tag = BI_FIRST;
247 rec->size = sizeof(struct bi_record);
248 rec = (struct bi_record *)((unsigned long)rec + rec->size);
249
250 rec->tag = BI_CMD_LINE;
251 memcpy( (char *)rec->data, cmd_line, strlen(cmd_line)+1);
252 rec->size = sizeof(struct bi_record) + strlen(cmd_line) + 1;
253 rec = (struct bi_record *)((unsigned long)rec + rec->size);
254
255 if ( initrd_size ) {
256 rec->tag = BI_INITRD;
257 rec->data[0] = initrd_loc;
258 rec->data[1] = initrd_size;
259 rec->size = sizeof(struct bi_record) + 2 *
260 sizeof(unsigned long);
261 rec = (struct bi_record *)((unsigned long)rec +
262 rec->size);
263 }
264
265 rec->tag = BI_LAST;
266 rec->size = sizeof(struct bi_record);
267 rec = (struct bi_record *)((unsigned long)rec + rec->size);
268 }
269 puts("Now booting the kernel\n");
270#if defined(CONFIG_SERIAL_CPM_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE)
271 serial_close(com_port);
272#endif
273
274 return (unsigned long)hold_residual;
275}
diff --git a/arch/ppc/boot/simple/misc-ev64260.c b/arch/ppc/boot/simple/misc-ev64260.c
new file mode 100644
index 000000000000..52ece6937a7a
--- /dev/null
+++ b/arch/ppc/boot/simple/misc-ev64260.c
@@ -0,0 +1,57 @@
1/*
2 * arch/ppc/boot/simple/misc-ev64260.c
3 *
4 * Host bridge init code for the Marvell/Galileo EV-64260-BP evaluation board
5 * with a GT64260 onboard.
6 *
7 * Author: Mark A. Greer <mgreer@mvista.com>
8 *
9 * 2001 (c) MontaVista Software, Inc. This file is licensed under
10 * the terms of the GNU General Public License version 2. This program
11 * is licensed "as is" without any warranty of any kind, whether express
12 * or implied.
13 */
14
15#include <linux/config.h>
16#include <linux/types.h>
17#include <asm/reg.h>
18#include <asm/io.h>
19#include <asm/mv64x60_defs.h>
20#include <platforms/ev64260.h>
21
22#ifdef CONFIG_SERIAL_MPSC_CONSOLE
23extern u32 mv64x60_console_baud;
24extern u32 mv64x60_mpsc_clk_src;
25extern u32 mv64x60_mpsc_clk_freq;
26#endif
27
28void
29mv64x60_board_init(void __iomem *old_base, void __iomem *new_base)
30{
31 u32 p, v;
32
33 /* DINK doesn't enable 745x timebase, so enable here (Adrian Cox) */
34 p = mfspr(SPRN_PVR);
35 p >>= 16;
36
37 /* Reasonable SWAG at a 745x PVR value */
38 if (((p & 0xfff0) == 0x8000) && (p != 0x800c)) {
39 v = mfspr(SPRN_HID0);
40 v |= HID0_TBEN;
41 mtspr(SPRN_HID0, v);
42 }
43
44#ifdef CONFIG_SERIAL_8250_CONSOLE
45 /*
46 * Change device bus 2 window so that bootoader can do I/O thru
47 * 8250/16550 UART that's mapped in that window.
48 */
49 out_le32(new_base + MV64x60_CPU2DEV_2_BASE, EV64260_UART_BASE >> 20);
50 out_le32(new_base + MV64x60_CPU2DEV_2_SIZE, EV64260_UART_END >> 20);
51 __asm__ __volatile__("sync");
52#elif defined(CONFIG_SERIAL_MPSC_CONSOLE)
53 mv64x60_console_baud = EV64260_DEFAULT_BAUD;
54 mv64x60_mpsc_clk_src = EV64260_MPSC_CLK_SRC;
55 mv64x60_mpsc_clk_freq = EV64260_MPSC_CLK_FREQ;
56#endif
57}
diff --git a/arch/ppc/boot/simple/misc-katana.c b/arch/ppc/boot/simple/misc-katana.c
new file mode 100644
index 000000000000..b6e1bb833157
--- /dev/null
+++ b/arch/ppc/boot/simple/misc-katana.c
@@ -0,0 +1,37 @@
1/*
2 * arch/ppc/boot/simple/misc-katana.c
3 *
4 * Set up MPSC values to bootwrapper can prompt user.
5 *
6 * Author: Mark A. Greer <source@mvista.com>
7 *
8 * 2004 (c) MontaVista Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
11 * or implied.
12 */
13
14#include <linux/config.h>
15#include <linux/types.h>
16#include <asm/io.h>
17#include <asm/mv64x60_defs.h>
18#include <platforms/katana.h>
19
20extern u32 mv64x60_console_baud;
21extern u32 mv64x60_mpsc_clk_src;
22extern u32 mv64x60_mpsc_clk_freq;
23
24/* Not in the kernel so won't include kernel.h to get its 'min' definition */
25#ifndef min
26#define min(a,b) (((a) < (b)) ? (a) : (b))
27#endif
28
29void
30mv64x60_board_init(void __iomem *old_base, void __iomem *new_base)
31{
32 mv64x60_console_baud = KATANA_DEFAULT_BAUD;
33 mv64x60_mpsc_clk_src = KATANA_MPSC_CLK_SRC;
34 mv64x60_mpsc_clk_freq =
35 min(katana_bus_freq((void __iomem *)KATANA_CPLD_BASE),
36 MV64x60_TCLK_FREQ_MAX);
37}
diff --git a/arch/ppc/boot/simple/misc-mv64x60.c b/arch/ppc/boot/simple/misc-mv64x60.c
new file mode 100644
index 000000000000..7e88fc6d207d
--- /dev/null
+++ b/arch/ppc/boot/simple/misc-mv64x60.c
@@ -0,0 +1,61 @@
1/*
2 * arch/ppc/boot/simple/misc-mv64x60.c
3 *
4 * Relocate bridge's register base and call board specific routine.
5 *
6 * Author: Mark A. Greer <source@mvista.com>
7 *
8 * 2005 (c) MontaVista Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
11 * or implied.
12 */
13
14#include <linux/config.h>
15#include <linux/types.h>
16#include <asm/io.h>
17#include <asm/mv64x60_defs.h>
18
19extern struct bi_record *decompress_kernel(unsigned long load_addr,
20 int num_words, unsigned long cksum);
21
22void
23mv64x60_move_base(void __iomem *old_base, void __iomem *new_base)
24{
25 u32 bits, mask, b;
26
27 if (old_base != new_base) {
28#ifdef CONFIG_GT64260
29 bits = 12;
30 mask = 0x07000000;
31#else /* Must be mv64[34]60 */
32 bits = 16;
33 mask = 0x03000000;
34#endif
35 b = in_le32(old_base + MV64x60_INTERNAL_SPACE_DECODE);
36 b &= mask;
37 b |= ((u32)new_base >> (32 - bits));
38 out_le32(old_base + MV64x60_INTERNAL_SPACE_DECODE, b);
39
40 __asm__ __volatile__("sync");
41
42 /* Wait for change to happen (in accordance with the manual) */
43 while (in_le32(new_base + MV64x60_INTERNAL_SPACE_DECODE) != b);
44 }
45}
46
47void __attribute__ ((weak))
48mv64x60_board_init(void __iomem *old_base, void __iomem *new_base)
49{
50}
51
52void *
53load_kernel(unsigned long load_addr, int num_words, unsigned long cksum,
54 void *ign1, void *ign2)
55{
56 mv64x60_move_base((void __iomem *)CONFIG_MV64X60_BASE,
57 (void __iomem *)CONFIG_MV64X60_NEW_BASE);
58 mv64x60_board_init((void __iomem *)CONFIG_MV64X60_BASE,
59 (void __iomem *)CONFIG_MV64X60_NEW_BASE);
60 return decompress_kernel(load_addr, num_words, cksum);
61}
diff --git a/arch/ppc/boot/simple/misc-prep.c b/arch/ppc/boot/simple/misc-prep.c
new file mode 100644
index 000000000000..75380ac41669
--- /dev/null
+++ b/arch/ppc/boot/simple/misc-prep.c
@@ -0,0 +1,212 @@
1/*
2 * arch/ppc/boot/simple/misc-prep.c
3 *
4 * Maintainer: Tom Rini <trini@kernel.crashing.org>
5 *
6 * In the past: Gary Thomas, Cort Dougan <cort@cs.nmt.edu>
7 */
8
9#include <linux/config.h>
10#include <linux/pci_ids.h>
11#include <linux/types.h>
12#include <asm/residual.h>
13#include <asm/string.h>
14#include <asm/byteorder.h>
15#include "mpc10x.h"
16#include "of1275.h"
17#include "nonstdio.h"
18
19extern int keyb_present; /* keyboard controller is present by default */
20RESIDUAL hold_resid_buf;
21RESIDUAL *hold_residual = &hold_resid_buf;
22static void *OFW_interface; /* Pointer to OF, if available. */
23
24#ifdef CONFIG_VGA_CONSOLE
25char *vidmem = (char *)0xC00B8000;
26int lines = 25, cols = 80;
27int orig_x, orig_y = 24;
28#endif /* CONFIG_VGA_CONSOLE */
29
30extern int CRT_tstc(void);
31extern int vga_init(unsigned char *ISA_mem);
32extern void gunzip(void *, int, unsigned char *, int *);
33extern unsigned long serial_init(int chan, void *ignored);
34extern void serial_fixups(void);
35extern struct bi_record *decompress_kernel(unsigned long load_addr,
36 int num_words, unsigned long cksum);
37extern void disable_6xx_mmu(void);
38extern unsigned long mpc10x_get_mem_size(void);
39
40static void
41writel(unsigned int val, unsigned int address)
42{
43 /* Ensure I/O operations complete */
44 __asm__ volatile("eieio");
45 *(unsigned int *)address = cpu_to_le32(val);
46}
47
48#define PCI_CFG_ADDR(dev,off) ((0x80<<24) | (dev<<8) | (off&0xfc))
49#define PCI_CFG_DATA(off) (MPC10X_MAPA_CNFG_DATA+(off&3))
50
51static void
52pci_read_config_32(unsigned char devfn,
53 unsigned char offset,
54 unsigned int *val)
55{
56 /* Ensure I/O operations complete */
57 __asm__ volatile("eieio");
58 *(unsigned int *)PCI_CFG_ADDR(devfn,offset) =
59 cpu_to_le32(MPC10X_MAPA_CNFG_ADDR);
60 /* Ensure I/O operations complete */
61 __asm__ volatile("eieio");
62 *val = le32_to_cpu(*(unsigned int *)PCI_CFG_DATA(offset));
63 return;
64}
65
66#ifdef CONFIG_VGA_CONSOLE
67void
68scroll(void)
69{
70 int i;
71
72 memcpy ( vidmem, vidmem + cols * 2, ( lines - 1 ) * cols * 2 );
73 for ( i = ( lines - 1 ) * cols * 2; i < lines * cols * 2; i += 2 )
74 vidmem[i] = ' ';
75}
76#endif /* CONFIG_VGA_CONSOLE */
77
78unsigned long
79load_kernel(unsigned long load_addr, int num_words, unsigned long cksum,
80 RESIDUAL *residual, void *OFW)
81{
82 int start_multi = 0;
83 unsigned int pci_viddid, pci_did, tulip_pci_base, tulip_base;
84
85 /* If we have Open Firmware, initialise it immediately */
86 if (OFW) {
87 OFW_interface = OFW;
88 ofinit(OFW_interface);
89 }
90
91 board_isa_init();
92#if defined(CONFIG_VGA_CONSOLE)
93 vga_init((unsigned char *)0xC0000000);
94#endif /* CONFIG_VGA_CONSOLE */
95
96 if (residual) {
97 /* Is this Motorola PPCBug? */
98 if ((1 & residual->VitalProductData.FirmwareSupports) &&
99 (1 == residual->VitalProductData.FirmwareSupplier)) {
100 unsigned char base_mod;
101 unsigned char board_type = inb(0x801) & 0xF0;
102
103 /*
104 * Reset the onboard 21x4x Ethernet
105 * Motorola Ethernet is at IDSEL 14 (devfn 0x70)
106 */
107 pci_read_config_32(0x70, 0x00, &pci_viddid);
108 pci_did = (pci_viddid & 0xffff0000) >> 16;
109 /* Be sure we've really found a 21x4x chip */
110 if (((pci_viddid & 0xffff) == PCI_VENDOR_ID_DEC) &&
111 ((pci_did == PCI_DEVICE_ID_DEC_TULIP_FAST) ||
112 (pci_did == PCI_DEVICE_ID_DEC_TULIP) ||
113 (pci_did == PCI_DEVICE_ID_DEC_TULIP_PLUS) ||
114 (pci_did == PCI_DEVICE_ID_DEC_21142))) {
115 pci_read_config_32(0x70,
116 0x10,
117 &tulip_pci_base);
118 /* Get the physical base address */
119 tulip_base =
120 (tulip_pci_base & ~0x03UL) + 0x80000000;
121 /* Strobe the 21x4x reset bit in CSR0 */
122 writel(0x1, tulip_base);
123 }
124
125 /* If this is genesis 2 board then check for no
126 * keyboard controller and more than one processor.
127 */
128 if (board_type == 0xe0) {
129 base_mod = inb(0x803);
130 /* if a MVME2300/2400 or a Sitka then no keyboard */
131 if((base_mod == 0xFA) || (base_mod == 0xF9) ||
132 (base_mod == 0xE1)) {
133 keyb_present = 0; /* no keyboard */
134 }
135 }
136 /* If this is a multiprocessor system then
137 * park the other processor so that the
138 * kernel knows where to find them.
139 */
140 if (residual->MaxNumCpus > 1)
141 start_multi = 1;
142 }
143 memcpy(hold_residual,residual,sizeof(RESIDUAL));
144 }
145
146 /* Call decompress_kernel */
147 decompress_kernel(load_addr, num_words, cksum);
148
149 if (start_multi) {
150 residual->VitalProductData.SmpIar = (unsigned long)0xc0;
151 residual->Cpus[1].CpuState = CPU_GOOD;
152 hold_residual->VitalProductData.Reserved5 = 0xdeadbeef;
153 }
154
155 /* Now go and clear out the BATs and ensure that our MSR is
156 * correct .*/
157 disable_6xx_mmu();
158
159 /* Make r3 be a pointer to the residual data. */
160 return (unsigned long)hold_residual;
161}
162
163unsigned long
164get_mem_size(void)
165{
166 unsigned int pci_viddid, pci_did;
167
168 /* First, figure out what kind of host bridge we are on. If it's
169 * an MPC10x, we can ask it directly how much memory it has.
170 * Otherwise, see if the residual data has anything. This isn't
171 * the best way, but it can be the only way. If there's nothing,
172 * assume 32MB. -- Tom.
173 */
174 /* See what our host bridge is. */
175 pci_read_config_32(0x00, 0x00, &pci_viddid);
176 pci_did = (pci_viddid & 0xffff0000) >> 16;
177 /* See if we are on an MPC10x. */
178 if (((pci_viddid & 0xffff) == PCI_VENDOR_ID_MOTOROLA)
179 && ((pci_did == PCI_DEVICE_ID_MOTOROLA_MPC105)
180 || (pci_did == PCI_DEVICE_ID_MOTOROLA_MPC106)
181 || (pci_did == PCI_DEVICE_ID_MOTOROLA_MPC107)))
182 return mpc10x_get_mem_size();
183 /* If it's not, see if we have anything in the residual data. */
184 else if (hold_residual && hold_residual->TotalMemory)
185 return hold_residual->TotalMemory;
186 else if (OFW_interface) {
187 /*
188 * This is a 'best guess' check. We want to make sure
189 * we don't try this on a PReP box without OF
190 * -- Cort
191 */
192 while (OFW_interface)
193 {
194 phandle dev_handle;
195 int mem_info[2];
196
197 /* get handle to memory description */
198 if (!(dev_handle = finddevice("/memory@0")))
199 break;
200
201 /* get the info */
202 if (getprop(dev_handle, "reg", mem_info,
203 sizeof(mem_info)) != 8)
204 break;
205
206 return mem_info[1];
207 }
208 }
209
210 /* Fall back to hard-coding 32MB. */
211 return 32*1024*1024;
212}
diff --git a/arch/ppc/boot/simple/misc-radstone_ppc7d.c b/arch/ppc/boot/simple/misc-radstone_ppc7d.c
new file mode 100644
index 000000000000..569e0d4feeaf
--- /dev/null
+++ b/arch/ppc/boot/simple/misc-radstone_ppc7d.c
@@ -0,0 +1,26 @@
1/*
2 * arch/ppc/boot/simple/misc-radstone_ppc7d.c
3 *
4 * Misc data for Radstone PPC7D board.
5 *
6 * Author: James Chapman <jchapman@katalix.com>
7 */
8
9#include <linux/types.h>
10#include <platforms/radstone_ppc7d.h>
11
12#if defined(CONFIG_SERIAL_MPSC_CONSOLE)
13extern u32 mv64x60_console_baud;
14extern u32 mv64x60_mpsc_clk_src;
15extern u32 mv64x60_mpsc_clk_freq;
16#endif
17
18void
19mv64x60_board_init(void __iomem *old_base, void __iomem *new_base)
20{
21#if defined(CONFIG_SERIAL_MPSC_CONSOLE)
22 mv64x60_console_baud = PPC7D_DEFAULT_BAUD;
23 mv64x60_mpsc_clk_src = PPC7D_MPSC_CLK_SRC;
24 mv64x60_mpsc_clk_freq = PPC7D_MPSC_CLK_FREQ;
25#endif
26}
diff --git a/arch/ppc/boot/simple/misc-spruce.c b/arch/ppc/boot/simple/misc-spruce.c
new file mode 100644
index 000000000000..d012c39278fd
--- /dev/null
+++ b/arch/ppc/boot/simple/misc-spruce.c
@@ -0,0 +1,274 @@
1/*
2 * arch/ppc/boot/spruce/misc.c
3 *
4 * Misc. bootloader code for IBM Spruce reference platform
5 *
6 * Authors: Johnnie Peters <jpeters@mvista.com>
7 * Matt Porter <mporter@mvista.com>
8 *
9 * Derived from arch/ppc/boot/prep/misc.c
10 *
11 * 2000-2001 (c) MontaVista, Software, Inc. This file is licensed under
12 * the terms of the GNU General Public License version 2. This program
13 * is licensed "as is" without any warranty of any kind, whether express
14 * or implied.
15 */
16
17#include <linux/types.h>
18#include <linux/config.h>
19#include <linux/pci.h>
20
21#include <asm/bootinfo.h>
22
23extern unsigned long decompress_kernel(unsigned long load_addr, int num_words,
24 unsigned long cksum);
25
26/* Define some important locations of the Spruce. */
27#define SPRUCE_PCI_CONFIG_ADDR 0xfec00000
28#define SPRUCE_PCI_CONFIG_DATA 0xfec00004
29
30/* PCI configuration space access routines. */
31unsigned int *pci_config_address = (unsigned int *)SPRUCE_PCI_CONFIG_ADDR;
32unsigned char *pci_config_data = (unsigned char *)SPRUCE_PCI_CONFIG_DATA;
33
34void cpc700_pcibios_read_config_byte(unsigned char bus, unsigned char dev_fn,
35 unsigned char offset, unsigned char *val)
36{
37 out_le32(pci_config_address,
38 (((bus & 0xff)<<16) | (dev_fn<<8) | (offset&0xfc) | 0x80000000));
39
40 *val= (in_le32((unsigned *)pci_config_data) >> (8 * (offset & 3))) & 0xff;
41}
42
43void cpc700_pcibios_write_config_byte(unsigned char bus, unsigned char dev_fn,
44 unsigned char offset, unsigned char val)
45{
46 out_le32(pci_config_address,
47 (((bus & 0xff)<<16) | (dev_fn<<8) | (offset&0xfc) | 0x80000000));
48
49 out_8(pci_config_data + (offset&3), val);
50}
51
52void cpc700_pcibios_read_config_word(unsigned char bus, unsigned char dev_fn,
53 unsigned char offset, unsigned short *val)
54{
55 out_le32(pci_config_address,
56 (((bus & 0xff)<<16) | (dev_fn<<8) | (offset&0xfc) | 0x80000000));
57
58 *val= in_le16((unsigned short *)(pci_config_data + (offset&3)));
59}
60
61void cpc700_pcibios_write_config_word(unsigned char bus, unsigned char dev_fn,
62 unsigned char offset, unsigned short val)
63{
64 out_le32(pci_config_address,
65 (((bus & 0xff)<<16) | (dev_fn<<8) | (offset&0xfc) | 0x80000000));
66
67 out_le16((unsigned short *)(pci_config_data + (offset&3)), val);
68}
69
70void cpc700_pcibios_read_config_dword(unsigned char bus, unsigned char dev_fn,
71 unsigned char offset, unsigned int *val)
72{
73 out_le32(pci_config_address,
74 (((bus & 0xff)<<16) | (dev_fn<<8) | (offset&0xfc) | 0x80000000));
75
76 *val= in_le32((unsigned *)pci_config_data);
77}
78
79void cpc700_pcibios_write_config_dword(unsigned char bus, unsigned char dev_fn,
80 unsigned char offset, unsigned int val)
81{
82 out_le32(pci_config_address,
83 (((bus & 0xff)<<16) | (dev_fn<<8) | (offset&0xfc) | 0x80000000));
84
85 out_le32((unsigned *)pci_config_data, val);
86}
87
88#define PCNET32_WIO_RDP 0x10
89#define PCNET32_WIO_RAP 0x12
90#define PCNET32_WIO_RESET 0x14
91
92#define PCNET32_DWIO_RDP 0x10
93#define PCNET32_DWIO_RAP 0x14
94#define PCNET32_DWIO_RESET 0x18
95
96/* Processor interface config register access */
97#define PIFCFGADDR 0xff500000
98#define PIFCFGDATA 0xff500004
99
100#define PLBMIFOPT 0x18 /* PLB Master Interface Options */
101
102#define MEM_MBEN 0x24
103#define MEM_TYPE 0x28
104#define MEM_B1SA 0x3c
105#define MEM_B1EA 0x5c
106#define MEM_B2SA 0x40
107#define MEM_B2EA 0x60
108
109unsigned long
110get_mem_size(void)
111{
112 int loop;
113 unsigned long mem_size = 0;
114 unsigned long mem_mben;
115 unsigned long mem_type;
116 unsigned long mem_start;
117 unsigned long mem_end;
118 volatile int *mem_addr = (int *)0xff500008;
119 volatile int *mem_data = (int *)0xff50000c;
120
121 /* Get the size of memory from the memory controller. */
122 *mem_addr = MEM_MBEN;
123 asm("sync");
124 mem_mben = *mem_data;
125 asm("sync");
126 for(loop = 0; loop < 1000; loop++);
127
128 *mem_addr = MEM_TYPE;
129 asm("sync");
130 mem_type = *mem_data;
131 asm("sync");
132 for(loop = 0; loop < 1000; loop++);
133
134 *mem_addr = MEM_TYPE;
135 /* Confirm bank 1 has DRAM memory */
136 if ((mem_mben & 0x40000000) &&
137 ((mem_type & 0x30000000) == 0x10000000)) {
138 *mem_addr = MEM_B1SA;
139 asm("sync");
140 mem_start = *mem_data;
141 asm("sync");
142 for(loop = 0; loop < 1000; loop++);
143
144 *mem_addr = MEM_B1EA;
145 asm("sync");
146 mem_end = *mem_data;
147 asm("sync");
148 for(loop = 0; loop < 1000; loop++);
149
150 mem_size = mem_end - mem_start + 0x100000;
151 }
152
153 /* Confirm bank 2 has DRAM memory */
154 if ((mem_mben & 0x20000000) &&
155 ((mem_type & 0xc000000) == 0x4000000)) {
156 *mem_addr = MEM_B2SA;
157 asm("sync");
158 mem_start = *mem_data;
159 asm("sync");
160 for(loop = 0; loop < 1000; loop++);
161
162 *mem_addr = MEM_B2EA;
163 asm("sync");
164 mem_end = *mem_data;
165 asm("sync");
166 for(loop = 0; loop < 1000; loop++);
167
168 mem_size += mem_end - mem_start + 0x100000;
169 }
170 return mem_size;
171}
172
173unsigned long
174load_kernel(unsigned long load_addr, int num_words, unsigned long cksum,
175 void *ign1, void *ign2)
176{
177 int csr0;
178 int csr_id;
179 int pci_devfn;
180 int found_multi = 0;
181 unsigned short vendor;
182 unsigned short device;
183 unsigned short command;
184 unsigned char header_type;
185 unsigned int bar0;
186 volatile int *pif_addr = (int *)0xff500000;
187 volatile int *pif_data = (int *)0xff500004;
188
189 /*
190 * Gah, these firmware guys need to learn that hardware
191 * byte swapping is evil! Disable all hardware byte
192 * swapping so it doesn't hurt anyone.
193 */
194 *pif_addr = PLBMIFOPT;
195 asm("sync");
196 *pif_data = 0x00000000;
197 asm("sync");
198
199 /* Search out and turn off the PcNet ethernet boot device. */
200 for (pci_devfn = 1; pci_devfn < 0xff; pci_devfn++) {
201 if (PCI_FUNC(pci_devfn) && !found_multi)
202 continue;
203
204 cpc700_pcibios_read_config_byte(0, pci_devfn,
205 PCI_HEADER_TYPE, &header_type);
206
207 if (!PCI_FUNC(pci_devfn))
208 found_multi = header_type & 0x80;
209
210 cpc700_pcibios_read_config_word(0, pci_devfn, PCI_VENDOR_ID,
211 &vendor);
212
213 if (vendor != 0xffff) {
214 cpc700_pcibios_read_config_word(0, pci_devfn,
215 PCI_DEVICE_ID, &device);
216
217 /* If this PCI device is the Lance PCNet board then turn it off */
218 if ((vendor == PCI_VENDOR_ID_AMD) &&
219 (device == PCI_DEVICE_ID_AMD_LANCE)) {
220
221 /* Turn on I/O Space on the board. */
222 cpc700_pcibios_read_config_word(0, pci_devfn,
223 PCI_COMMAND, &command);
224 command |= 0x1;
225 cpc700_pcibios_write_config_word(0, pci_devfn,
226 PCI_COMMAND, command);
227
228 /* Get the I/O space address */
229 cpc700_pcibios_read_config_dword(0, pci_devfn,
230 PCI_BASE_ADDRESS_0, &bar0);
231 bar0 &= 0xfffffffe;
232
233 /* Reset the PCNet Board */
234 inl (bar0+PCNET32_DWIO_RESET);
235 inw (bar0+PCNET32_WIO_RESET);
236
237 /* First do a work oriented read of csr0. If the value is
238 * 4 then this is the correct mode to access the board.
239 * If not try a double word ortiented read.
240 */
241 outw(0, bar0 + PCNET32_WIO_RAP);
242 csr0 = inw(bar0 + PCNET32_WIO_RDP);
243
244 if (csr0 == 4) {
245 /* Check the Chip id register */
246 outw(88, bar0 + PCNET32_WIO_RAP);
247 csr_id = inw(bar0 + PCNET32_WIO_RDP);
248
249 if (csr_id) {
250 /* This is the valid mode - set the stop bit */
251 outw(0, bar0 + PCNET32_WIO_RAP);
252 outw(csr0, bar0 + PCNET32_WIO_RDP);
253 }
254 } else {
255 outl(0, bar0 + PCNET32_DWIO_RAP);
256 csr0 = inl(bar0 + PCNET32_DWIO_RDP);
257 if (csr0 == 4) {
258 /* Check the Chip id register */
259 outl(88, bar0 + PCNET32_WIO_RAP);
260 csr_id = inl(bar0 + PCNET32_WIO_RDP);
261
262 if (csr_id) {
263 /* This is the valid mode - set the stop bit*/
264 outl(0, bar0 + PCNET32_WIO_RAP);
265 outl(csr0, bar0 + PCNET32_WIO_RDP);
266 }
267 }
268 }
269 }
270 }
271 }
272
273 return decompress_kernel(load_addr, num_words, cksum);
274}
diff --git a/arch/ppc/boot/simple/misc.c b/arch/ppc/boot/simple/misc.c
new file mode 100644
index 000000000000..ab0f9902cb67
--- /dev/null
+++ b/arch/ppc/boot/simple/misc.c
@@ -0,0 +1,284 @@
1/*
2 * arch/ppc/simple/misc.c
3 *
4 * Misc. bootloader code for many machines. This assumes you have are using
5 * a 6xx/7xx/74xx CPU in your machine. This assumes the chunk of memory
6 * below 8MB is free. Finally, it assumes you have a NS16550-style uart for
7 * your serial console. If a machine meets these requirements, it can quite
8 * likely use this code during boot.
9 *
10 * Author: Matt Porter <mporter@mvista.com>
11 * Derived from arch/ppc/boot/prep/misc.c
12 *
13 * 2001 (c) MontaVista, Software, Inc. This file is licensed under
14 * the terms of the GNU General Public License version 2. This program
15 * is licensed "as is" without any warranty of any kind, whether express
16 * or implied.
17 */
18
19#include <linux/types.h>
20#include <linux/config.h>
21#include <linux/string.h>
22
23#include <asm/page.h>
24#include <asm/mmu.h>
25#include <asm/bootinfo.h>
26#ifdef CONFIG_44x
27#include <asm/ibm4xx.h>
28#endif
29#include <asm/reg.h>
30
31#include "nonstdio.h"
32
33/* Default cmdline */
34#ifdef CONFIG_CMDLINE
35#define CMDLINE CONFIG_CMDLINE
36#else
37#define CMDLINE ""
38#endif
39
40/* Keyboard (and VGA console)? */
41#ifdef CONFIG_VGA_CONSOLE
42#define HAS_KEYB 1
43#else
44#define HAS_KEYB 0
45#endif
46
47/* Will / Can the user give input?
48 * Val Henson has requested that Gemini doesn't wait for the
49 * user to edit the cmdline or not.
50 */
51#if (defined(CONFIG_SERIAL_8250_CONSOLE) \
52 || defined(CONFIG_VGA_CONSOLE) \
53 || defined(CONFIG_SERIAL_MPC52xx_CONSOLE) \
54 || defined(CONFIG_SERIAL_MPSC_CONSOLE)) \
55 && !defined(CONFIG_GEMINI)
56#define INTERACTIVE_CONSOLE 1
57#endif
58
59char *avail_ram;
60char *end_avail;
61char *zimage_start;
62char cmd_preset[] = CMDLINE;
63char cmd_buf[256];
64char *cmd_line = cmd_buf;
65int keyb_present = HAS_KEYB;
66int zimage_size;
67
68unsigned long com_port;
69unsigned long initrd_size = 0;
70
71/* The linker tells us various locations in the image */
72extern char __image_begin, __image_end;
73extern char __ramdisk_begin, __ramdisk_end;
74extern char _end[];
75/* Original location */
76extern unsigned long start;
77
78extern int CRT_tstc(void);
79extern unsigned long serial_init(int chan, void *ignored);
80extern void serial_close(unsigned long com_port);
81extern void gunzip(void *, int, unsigned char *, int *);
82extern void serial_fixups(void);
83
84/* Allow get_mem_size to be hooked into. This is the default. */
85unsigned long __attribute__ ((weak))
86get_mem_size(void)
87{
88 return 0;
89}
90
91struct bi_record *
92decompress_kernel(unsigned long load_addr, int num_words, unsigned long cksum)
93{
94#ifdef INTERACTIVE_CONSOLE
95 int timer = 0;
96 char ch;
97#endif
98 char *cp;
99 struct bi_record *rec;
100 unsigned long initrd_loc = 0, TotalMemory = 0;
101
102#if defined(CONFIG_SERIAL_8250_CONSOLE) || defined(CONFIG_SERIAL_MPSC_CONSOLE)
103 com_port = serial_init(0, NULL);
104#endif
105
106#if defined(CONFIG_44x) && defined(PPC44x_EMAC0_MR0)
107 /* Reset MAL */
108 mtdcr(DCRN_MALCR(DCRN_MAL_BASE), MALCR_MMSR);
109 /* Wait for reset */
110 while (mfdcr(DCRN_MALCR(DCRN_MAL_BASE)) & MALCR_MMSR) {};
111 /* Reset EMAC */
112 *(volatile unsigned long *)PPC44x_EMAC0_MR0 = 0x20000000;
113 __asm__ __volatile__("eieio");
114#endif
115
116 /*
117 * Call get_mem_size(), which is memory controller dependent,
118 * and we must have the correct file linked in here.
119 */
120 TotalMemory = get_mem_size();
121
122 /* assume the chunk below 8M is free */
123 end_avail = (char *)0x00800000;
124
125 /*
126 * Reveal where we were loaded at and where we
127 * were relocated to.
128 */
129 puts("loaded at: "); puthex(load_addr);
130 puts(" "); puthex((unsigned long)(load_addr + (4*num_words)));
131 puts("\n");
132 if ( (unsigned long)load_addr != (unsigned long)&start )
133 {
134 puts("relocated to: "); puthex((unsigned long)&start);
135 puts(" ");
136 puthex((unsigned long)((unsigned long)&start + (4*num_words)));
137 puts("\n");
138 }
139
140 /*
141 * We link ourself to 0x00800000. When we run, we relocate
142 * ourselves there. So we just need __image_begin for the
143 * start. -- Tom
144 */
145 zimage_start = (char *)(unsigned long)(&__image_begin);
146 zimage_size = (unsigned long)(&__image_end) -
147 (unsigned long)(&__image_begin);
148
149 initrd_size = (unsigned long)(&__ramdisk_end) -
150 (unsigned long)(&__ramdisk_begin);
151
152 /*
153 * The zImage and initrd will be between start and _end, so they've
154 * already been moved once. We're good to go now. -- Tom
155 */
156 avail_ram = (char *)PAGE_ALIGN((unsigned long)_end);
157 puts("zimage at: "); puthex((unsigned long)zimage_start);
158 puts(" "); puthex((unsigned long)(zimage_size+zimage_start));
159 puts("\n");
160
161 if ( initrd_size ) {
162 puts("initrd at: ");
163 puthex((unsigned long)(&__ramdisk_begin));
164 puts(" "); puthex((unsigned long)(&__ramdisk_end));puts("\n");
165 }
166
167 avail_ram = (char *)0x00400000;
168 end_avail = (char *)0x00800000;
169 puts("avail ram: "); puthex((unsigned long)avail_ram); puts(" ");
170 puthex((unsigned long)end_avail); puts("\n");
171
172 if (keyb_present)
173 CRT_tstc(); /* Forces keyboard to be initialized */
174#ifdef CONFIG_GEMINI
175 /*
176 * If cmd_line is empty and cmd_preset is not, copy cmd_preset
177 * to cmd_line. This way we can override cmd_preset with the
178 * command line from Smon.
179 */
180
181 if ( (cmd_line[0] == '\0') && (cmd_preset[0] != '\0'))
182 memcpy (cmd_line, cmd_preset, sizeof(cmd_preset));
183#endif
184
185 /* Display standard Linux/PPC boot prompt for kernel args */
186 puts("\nLinux/PPC load: ");
187 cp = cmd_line;
188 memcpy (cmd_line, cmd_preset, sizeof(cmd_preset));
189 while ( *cp ) putc(*cp++);
190
191#ifdef INTERACTIVE_CONSOLE
192 /*
193 * If they have a console, allow them to edit the command line.
194 * Otherwise, don't bother wasting the five seconds.
195 */
196 while (timer++ < 5*1000) {
197 if (tstc()) {
198 while ((ch = getc()) != '\n' && ch != '\r') {
199 /* Test for backspace/delete */
200 if (ch == '\b' || ch == '\177') {
201 if (cp != cmd_line) {
202 cp--;
203 puts("\b \b");
204 }
205 /* Test for ^x/^u (and wipe the line) */
206 } else if (ch == '\030' || ch == '\025') {
207 while (cp != cmd_line) {
208 cp--;
209 puts("\b \b");
210 }
211 } else {
212 *cp++ = ch;
213 putc(ch);
214 }
215 }
216 break; /* Exit 'timer' loop */
217 }
218 udelay(1000); /* 1 msec */
219 }
220 *cp = 0;
221#endif
222 puts("\n");
223
224 puts("Uncompressing Linux...");
225 gunzip(0x0, 0x400000, zimage_start, &zimage_size);
226 puts("done.\n");
227
228 /* get the bi_rec address */
229 rec = bootinfo_addr(zimage_size);
230
231 /* We need to make sure that the initrd and bi_recs do not
232 * overlap. */
233 if ( initrd_size ) {
234 unsigned long rec_loc = (unsigned long) rec;
235 initrd_loc = (unsigned long)(&__ramdisk_begin);
236 /* If the bi_recs are in the middle of the current
237 * initrd, move the initrd to the next MB
238 * boundary. */
239 if ((rec_loc > initrd_loc) &&
240 ((initrd_loc + initrd_size) > rec_loc)) {
241 initrd_loc = _ALIGN((unsigned long)(zimage_size)
242 + (2 << 20) - 1, (2 << 20));
243 memmove((void *)initrd_loc, &__ramdisk_begin,
244 initrd_size);
245 puts("initrd moved: "); puthex(initrd_loc);
246 puts(" "); puthex(initrd_loc + initrd_size);
247 puts("\n");
248 }
249 }
250
251 bootinfo_init(rec);
252 if ( TotalMemory )
253 bootinfo_append(BI_MEMSIZE, sizeof(int), (void*)&TotalMemory);
254
255 bootinfo_append(BI_CMD_LINE, strlen(cmd_line)+1, (void*)cmd_line);
256
257 /* add a bi_rec for the initrd if it exists */
258 if (initrd_size) {
259 unsigned long initrd[2];
260
261 initrd[0] = initrd_loc;
262 initrd[1] = initrd_size;
263
264 bootinfo_append(BI_INITRD, sizeof(initrd), &initrd);
265 }
266 puts("Now booting the kernel\n");
267 serial_close(com_port);
268
269 return rec;
270}
271
272void __attribute__ ((weak))
273board_isa_init(void)
274{
275}
276
277/* Allow decompress_kernel to be hooked into. This is the default. */
278void * __attribute__ ((weak))
279load_kernel(unsigned long load_addr, int num_words, unsigned long cksum,
280 void *ign1, void *ign2)
281{
282 board_isa_init();
283 return decompress_kernel(load_addr, num_words, cksum);
284}
diff --git a/arch/ppc/boot/simple/mpc10x_memory.c b/arch/ppc/boot/simple/mpc10x_memory.c
new file mode 100644
index 000000000000..977daedc14c0
--- /dev/null
+++ b/arch/ppc/boot/simple/mpc10x_memory.c
@@ -0,0 +1,111 @@
1/*
2 * arch/ppc/boot/common/mpc10x_common.c
3 *
4 * A routine to find out how much memory the machine has.
5 *
6 * Based on:
7 * arch/ppc/kernel/mpc10x_common.c
8 *
9 * Author: Mark A. Greer
10 * mgreer@mvista.com
11 *
12 * 2001-2002 (c) MontaVista, Software, Inc. This file is licensed under
13 * the terms of the GNU General Public License version 2. This program
14 * is licensed "as is" without any warranty of any kind, whether express
15 * or implied.
16 */
17
18#include <linux/pci.h>
19#include <asm/types.h>
20#include <asm/io.h>
21#include "mpc10x.h"
22
23/*
24 * *** WARNING - A BAT MUST be set to access the PCI config addr/data regs ***
25 */
26
27/*
28 * PCI config space macros, similar to indirect_xxx and early_xxx macros.
29 * We assume bus 0.
30 */
31#define MPC10X_CFG_read(val, addr, type, op) *val = op((type)(addr))
32#define MPC10X_CFG_write(val, addr, type, op) op((type *)(addr), (val))
33
34#define MPC10X_PCI_OP(rw, size, type, op, mask) \
35static void \
36mpc10x_##rw##_config_##size(unsigned int *cfg_addr, \
37 unsigned int *cfg_data, int devfn, int offset, \
38 type val) \
39{ \
40 out_be32(cfg_addr, \
41 ((offset & 0xfc) << 24) | (devfn << 16) \
42 | (0 << 8) | 0x80); \
43 MPC10X_CFG_##rw(val, cfg_data + (offset & mask), type, op); \
44 return; \
45}
46
47MPC10X_PCI_OP(read, byte, u8 *, in_8, 3)
48MPC10X_PCI_OP(read, dword, u32 *, in_le32, 0)
49
50/*
51 * Read the memory controller registers to determine the amount of memory in
52 * the system. This assumes that the firmware has correctly set up the memory
53 * controller registers. On CONFIG_PPC_PREP, we know we are being called
54 * under a PReP memory map. On all other machines, we assume we are under
55 * a CHRP memory map. Further, on CONFIG_PPC_MULTIPLATFORM we must rename
56 * this function.
57 */
58#ifdef CONFIG_PPC_MULTIPLATFORM
59#define get_mem_size mpc10x_get_mem_size
60#endif
61unsigned long
62get_mem_size(void)
63{
64 unsigned int *config_addr, *config_data, val;
65 unsigned long start, end, total, offset;
66 int i;
67 unsigned char bank_enables;
68
69#ifdef CONFIG_PPC_PREP
70 config_addr = (unsigned int *)MPC10X_MAPA_CNFG_ADDR;
71 config_data = (unsigned int *)MPC10X_MAPA_CNFG_DATA;
72#else
73 config_addr = (unsigned int *)MPC10X_MAPB_CNFG_ADDR;
74 config_data = (unsigned int *)MPC10X_MAPB_CNFG_DATA;
75#endif
76
77 mpc10x_read_config_byte(config_addr, config_data, PCI_DEVFN(0,0),
78 MPC10X_MCTLR_MEM_BANK_ENABLES, &bank_enables);
79
80 total = 0;
81
82 for (i = 0; i < 8; i++) {
83 if (bank_enables & (1 << i)) {
84 offset = MPC10X_MCTLR_MEM_START_1 + ((i > 3) ? 4 : 0);
85 mpc10x_read_config_dword(config_addr, config_data,
86 PCI_DEVFN(0,0), offset, &val);
87 start = (val >> ((i & 3) << 3)) & 0xff;
88
89 offset = MPC10X_MCTLR_EXT_MEM_START_1 + ((i>3) ? 4 : 0);
90 mpc10x_read_config_dword(config_addr, config_data,
91 PCI_DEVFN(0,0), offset, &val);
92 val = (val >> ((i & 3) << 3)) & 0x03;
93 start = (val << 28) | (start << 20);
94
95 offset = MPC10X_MCTLR_MEM_END_1 + ((i > 3) ? 4 : 0);
96 mpc10x_read_config_dword(config_addr, config_data,
97 PCI_DEVFN(0,0), offset, &val);
98 end = (val >> ((i & 3) << 3)) & 0xff;
99
100 offset = MPC10X_MCTLR_EXT_MEM_END_1 + ((i > 3) ? 4 : 0);
101 mpc10x_read_config_dword(config_addr, config_data,
102 PCI_DEVFN(0,0), offset, &val);
103 val = (val >> ((i & 3) << 3)) & 0x03;
104 end = (val << 28) | (end << 20) | 0xfffff;
105
106 total += (end - start + 1);
107 }
108 }
109
110 return total;
111}
diff --git a/arch/ppc/boot/simple/mpc52xx_tty.c b/arch/ppc/boot/simple/mpc52xx_tty.c
new file mode 100644
index 000000000000..3acc6b7c0727
--- /dev/null
+++ b/arch/ppc/boot/simple/mpc52xx_tty.c
@@ -0,0 +1,140 @@
1/*
2 * arch/ppc/boot/simple/mpc52xx_tty.c
3 *
4 * Minimal serial functions needed to send messages out a MPC52xx
5 * Programmable Serial Controller (PSC).
6 *
7 * Author: Dale Farnsworth <dfarnsworth@mvista.com>
8 *
9 * 2003-2004 (c) MontaVista, Software, Inc. This file is licensed under the
10 * terms of the GNU General Public License version 2. This program is licensed
11 * "as is" without any warranty of any kind, whether express or implied.
12 */
13
14#include <linux/config.h>
15#include <linux/types.h>
16#include <asm/uaccess.h>
17#include <asm/mpc52xx.h>
18#include <asm/mpc52xx_psc.h>
19#include <asm/serial.h>
20#include <asm/io.h>
21#include <asm/time.h>
22
23
24#ifdef MPC52xx_PF_CONSOLE_PORT
25#define MPC52xx_CONSOLE MPC52xx_PSCx_OFFSET(MPC52xx_PF_CONSOLE_PORT)
26#define MPC52xx_PSC_CONFIG_SHIFT ((MPC52xx_PF_CONSOLE_PORT-1)<<2)
27#else
28#error "MPC52xx_PF_CONSOLE_PORT not defined"
29#endif
30
31static struct mpc52xx_psc __iomem *psc =
32 (struct mpc52xx_psc __iomem *) MPC52xx_PA(MPC52xx_CONSOLE);
33
34/* The decrementer counts at the system bus clock frequency
35 * divided by four. The most accurate time base is connected to the
36 * rtc. We read the decrementer change during one rtc tick
37 * and multiply by 4 to get the system bus clock frequency. Since a
38 * rtc tick is one seconds, and that's pretty long, we change the rtc
39 * dividers temporarly to set them 64x faster ;)
40 */
41static int
42mpc52xx_ipbfreq(void)
43{
44 struct mpc52xx_rtc __iomem *rtc =
45 (struct mpc52xx_rtc __iomem *) MPC52xx_PA(MPC52xx_RTC_OFFSET);
46 struct mpc52xx_cdm __iomem *cdm =
47 (struct mpc52xx_cdm __iomem *) MPC52xx_PA(MPC52xx_CDM_OFFSET);
48 int current_time, previous_time;
49 int tbl_start, tbl_end;
50 int xlbfreq, ipbfreq;
51
52 out_be32(&rtc->dividers, 0x8f1f0000); /* Set RTC 64x faster */
53 previous_time = in_be32(&rtc->time);
54 while ((current_time = in_be32(&rtc->time)) == previous_time) ;
55 tbl_start = get_tbl();
56 previous_time = current_time;
57 while ((current_time = in_be32(&rtc->time)) == previous_time) ;
58 tbl_end = get_tbl();
59 out_be32(&rtc->dividers, 0xffff0000); /* Restore RTC */
60
61 xlbfreq = (tbl_end - tbl_start) << 8;
62 ipbfreq = (in_8(&cdm->ipb_clk_sel) & 1) ? xlbfreq / 2 : xlbfreq;
63
64 return ipbfreq;
65}
66
67unsigned long
68serial_init(int ignored, void *ignored2)
69{
70 struct mpc52xx_gpio __iomem *gpio =
71 (struct mpc52xx_gpio __iomem *) MPC52xx_PA(MPC52xx_GPIO_OFFSET);
72 int divisor;
73 int mode1;
74 int mode2;
75 u32 val32;
76
77 static int been_here = 0;
78
79 if (been_here)
80 return 0;
81
82 been_here = 1;
83
84 val32 = in_be32(&gpio->port_config);
85 val32 &= ~(0x7 << MPC52xx_PSC_CONFIG_SHIFT);
86 val32 |= MPC52xx_GPIO_PSC_CONFIG_UART_WITHOUT_CD
87 << MPC52xx_PSC_CONFIG_SHIFT;
88 out_be32(&gpio->port_config, val32);
89
90 out_8(&psc->command, MPC52xx_PSC_RST_TX
91 | MPC52xx_PSC_RX_DISABLE | MPC52xx_PSC_TX_ENABLE);
92 out_8(&psc->command, MPC52xx_PSC_RST_RX);
93
94 out_be32(&psc->sicr, 0x0);
95 out_be16(&psc->mpc52xx_psc_clock_select, 0xdd00);
96 out_be16(&psc->tfalarm, 0xf8);
97
98 out_8(&psc->command, MPC52xx_PSC_SEL_MODE_REG_1
99 | MPC52xx_PSC_RX_ENABLE
100 | MPC52xx_PSC_TX_ENABLE);
101
102 divisor = ((mpc52xx_ipbfreq()
103 / (CONFIG_SERIAL_MPC52xx_CONSOLE_BAUD * 16)) + 1) >> 1;
104
105 mode1 = MPC52xx_PSC_MODE_8_BITS | MPC52xx_PSC_MODE_PARNONE
106 | MPC52xx_PSC_MODE_ERR;
107 mode2 = MPC52xx_PSC_MODE_ONE_STOP;
108
109 out_8(&psc->ctur, divisor>>8);
110 out_8(&psc->ctlr, divisor);
111 out_8(&psc->command, MPC52xx_PSC_SEL_MODE_REG_1);
112 out_8(&psc->mode, mode1);
113 out_8(&psc->mode, mode2);
114
115 return 0; /* ignored */
116}
117
118void
119serial_putc(void *ignored, const char c)
120{
121 serial_init(0, NULL);
122
123 while (!(in_be16(&psc->mpc52xx_psc_status) & MPC52xx_PSC_SR_TXEMP)) ;
124 out_8(&psc->mpc52xx_psc_buffer_8, c);
125 while (!(in_be16(&psc->mpc52xx_psc_status) & MPC52xx_PSC_SR_TXEMP)) ;
126}
127
128char
129serial_getc(void *ignored)
130{
131 while (!(in_be16(&psc->mpc52xx_psc_status) & MPC52xx_PSC_SR_RXRDY)) ;
132
133 return in_8(&psc->mpc52xx_psc_buffer_8);
134}
135
136int
137serial_tstc(void *ignored)
138{
139 return (in_be16(&psc->mpc52xx_psc_status) & MPC52xx_PSC_SR_RXRDY) != 0;
140}
diff --git a/arch/ppc/boot/simple/mv64x60_tty.c b/arch/ppc/boot/simple/mv64x60_tty.c
new file mode 100644
index 000000000000..5b45eb46b669
--- /dev/null
+++ b/arch/ppc/boot/simple/mv64x60_tty.c
@@ -0,0 +1,360 @@
1/*
2 * arch/ppc/boot/simple/mv64x60_tty.c
3 *
4 * Bootloader version of the embedded MPSC/UART driver for the Marvell 64x60.
5 * Note: Due to a GT64260A erratum, DMA will be used for UART input (via SDMA).
6 *
7 * Author: Mark A. Greer <mgreer@mvista.com>
8 *
9 * 2001 (c) MontaVista Software, Inc. This file is licensed under
10 * the terms of the GNU General Public License version 2. This program
11 * is licensed "as is" without any warranty of any kind, whether express
12 * or implied.
13 */
14
15/* This code assumes that the data cache has been disabled (L1, L2, L3). */
16
17#include <linux/config.h>
18#include <linux/types.h>
19#include <linux/serial_reg.h>
20#include <asm/serial.h>
21#include <asm/io.h>
22#include <asm/mv64x60_defs.h>
23#include <mpsc_defs.h>
24
25u32 mv64x60_console_baud = 9600;
26u32 mv64x60_mpsc_clk_src = 8; /* TCLK */
27u32 mv64x60_mpsc_clk_freq = 100000000;
28
29extern void udelay(long);
30static void stop_dma(int chan);
31
32static void __iomem *mv64x60_base = (void __iomem *)CONFIG_MV64X60_NEW_BASE;
33
34struct sdma_regs {
35 u32 sdc;
36 u32 sdcm;
37 u32 rx_desc;
38 u32 rx_buf_ptr;
39 u32 scrdp;
40 u32 tx_desc;
41 u32 sctdp;
42 u32 sftdp;
43};
44
45static struct sdma_regs sdma_regs[2];
46
47#define SDMA_REGS_INIT(s, reg_base) { \
48 (s)->sdc = (reg_base) + SDMA_SDC; \
49 (s)->sdcm = (reg_base) + SDMA_SDCM; \
50 (s)->rx_desc = (reg_base) + SDMA_RX_DESC; \
51 (s)->rx_buf_ptr = (reg_base) + SDMA_RX_BUF_PTR; \
52 (s)->scrdp = (reg_base) + SDMA_SCRDP; \
53 (s)->tx_desc = (reg_base) + SDMA_TX_DESC; \
54 (s)->sctdp = (reg_base) + SDMA_SCTDP; \
55 (s)->sftdp = (reg_base) + SDMA_SFTDP; \
56}
57
58static u32 mpsc_base[2] = { MV64x60_MPSC_0_OFFSET, MV64x60_MPSC_1_OFFSET };
59
60struct mv64x60_rx_desc {
61 u16 bufsize;
62 u16 bytecnt;
63 u32 cmd_stat;
64 u32 next_desc_ptr;
65 u32 buffer;
66};
67
68struct mv64x60_tx_desc {
69 u16 bytecnt;
70 u16 shadow;
71 u32 cmd_stat;
72 u32 next_desc_ptr;
73 u32 buffer;
74};
75
76#define MAX_RESET_WAIT 10000
77#define MAX_TX_WAIT 10000
78
79#define RX_NUM_DESC 2
80#define TX_NUM_DESC 2
81
82#define RX_BUF_SIZE 32
83#define TX_BUF_SIZE 32
84
85static struct mv64x60_rx_desc rd[2][RX_NUM_DESC] __attribute__ ((aligned(32)));
86static struct mv64x60_tx_desc td[2][TX_NUM_DESC] __attribute__ ((aligned(32)));
87
88static char rx_buf[2][RX_NUM_DESC * RX_BUF_SIZE] __attribute__ ((aligned(32)));
89static char tx_buf[2][TX_NUM_DESC * TX_BUF_SIZE] __attribute__ ((aligned(32)));
90
91static int cur_rd[2] = { 0, 0 };
92static int cur_td[2] = { 0, 0 };
93
94static char chan_initialized[2] = { 0, 0 };
95
96
97#define RX_INIT_RDP(rdp) { \
98 (rdp)->bufsize = 2; \
99 (rdp)->bytecnt = 0; \
100 (rdp)->cmd_stat = SDMA_DESC_CMDSTAT_L | SDMA_DESC_CMDSTAT_F | \
101 SDMA_DESC_CMDSTAT_O; \
102}
103
104#ifdef CONFIG_MV64360
105static u32 cpu2mem_tab[MV64x60_CPU2MEM_WINDOWS][2] = {
106 { MV64x60_CPU2MEM_0_BASE, MV64x60_CPU2MEM_0_SIZE },
107 { MV64x60_CPU2MEM_1_BASE, MV64x60_CPU2MEM_1_SIZE },
108 { MV64x60_CPU2MEM_2_BASE, MV64x60_CPU2MEM_2_SIZE },
109 { MV64x60_CPU2MEM_3_BASE, MV64x60_CPU2MEM_3_SIZE }
110};
111
112static u32 com2mem_tab[MV64x60_CPU2MEM_WINDOWS][2] = {
113 { MV64360_MPSC2MEM_0_BASE, MV64360_MPSC2MEM_0_SIZE },
114 { MV64360_MPSC2MEM_1_BASE, MV64360_MPSC2MEM_1_SIZE },
115 { MV64360_MPSC2MEM_2_BASE, MV64360_MPSC2MEM_2_SIZE },
116 { MV64360_MPSC2MEM_3_BASE, MV64360_MPSC2MEM_3_SIZE }
117};
118
119static u32 dram_selects[MV64x60_CPU2MEM_WINDOWS] = { 0xe, 0xd, 0xb, 0x7 };
120#endif
121
122unsigned long
123serial_init(int chan, void *ignored)
124{
125 u32 mpsc_routing_base, sdma_base, brg_bcr, cdv;
126 int i;
127
128 chan = (chan == 1); /* default to chan 0 if anything but 1 */
129
130 if (chan_initialized[chan])
131 return chan;
132
133 chan_initialized[chan] = 1;
134
135 if (chan == 0) {
136 sdma_base = MV64x60_SDMA_0_OFFSET;
137 brg_bcr = MV64x60_BRG_0_OFFSET + BRG_BCR;
138 SDMA_REGS_INIT(&sdma_regs[0], MV64x60_SDMA_0_OFFSET);
139 } else {
140 sdma_base = MV64x60_SDMA_1_OFFSET;
141 brg_bcr = MV64x60_BRG_1_OFFSET + BRG_BCR;
142 SDMA_REGS_INIT(&sdma_regs[0], MV64x60_SDMA_1_OFFSET);
143 }
144
145 mpsc_routing_base = MV64x60_MPSC_ROUTING_OFFSET;
146
147 stop_dma(chan);
148
149 /* Set up ring buffers */
150 for (i=0; i<RX_NUM_DESC; i++) {
151 RX_INIT_RDP(&rd[chan][i]);
152 rd[chan][i].buffer = (u32)&rx_buf[chan][i * RX_BUF_SIZE];
153 rd[chan][i].next_desc_ptr = (u32)&rd[chan][i+1];
154 }
155 rd[chan][RX_NUM_DESC - 1].next_desc_ptr = (u32)&rd[chan][0];
156
157 for (i=0; i<TX_NUM_DESC; i++) {
158 td[chan][i].bytecnt = 0;
159 td[chan][i].shadow = 0;
160 td[chan][i].buffer = (u32)&tx_buf[chan][i * TX_BUF_SIZE];
161 td[chan][i].cmd_stat = SDMA_DESC_CMDSTAT_F|SDMA_DESC_CMDSTAT_L;
162 td[chan][i].next_desc_ptr = (u32)&td[chan][i+1];
163 }
164 td[chan][TX_NUM_DESC - 1].next_desc_ptr = (u32)&td[chan][0];
165
166 /* Set MPSC Routing */
167 out_le32(mv64x60_base + mpsc_routing_base + MPSC_MRR, 0x3ffffe38);
168
169#ifdef CONFIG_GT64260
170 out_le32(mv64x60_base + GT64260_MPP_SERIAL_PORTS_MULTIPLEX, 0x00001102);
171#else /* Must be MV64360 or MV64460 */
172 {
173 u32 enables, prot_bits, v;
174
175 /* Set up comm unit to memory mapping windows */
176 /* Note: Assumes MV64x60_CPU2MEM_WINDOWS == 4 */
177
178 enables = in_le32(mv64x60_base + MV64360_CPU_BAR_ENABLE) & 0xf;
179 prot_bits = 0;
180
181 for (i=0; i<MV64x60_CPU2MEM_WINDOWS; i++) {
182 if (!(enables & (1 << i))) {
183 v = in_le32(mv64x60_base + cpu2mem_tab[i][0]);
184 v = ((v & 0xffff) << 16) | (dram_selects[i] << 8);
185 out_le32(mv64x60_base + com2mem_tab[i][0], v);
186
187 v = in_le32(mv64x60_base + cpu2mem_tab[i][1]);
188 v = (v & 0xffff) << 16;
189 out_le32(mv64x60_base + com2mem_tab[i][1], v);
190
191 prot_bits |= (0x3 << (i << 1)); /* r/w access */
192 }
193 }
194
195 out_le32(mv64x60_base + MV64360_MPSC_0_REMAP, 0);
196 out_le32(mv64x60_base + MV64360_MPSC_1_REMAP, 0);
197 out_le32(mv64x60_base + MV64360_MPSC2MEM_ACC_PROT_0, prot_bits);
198 out_le32(mv64x60_base + MV64360_MPSC2MEM_ACC_PROT_1, prot_bits);
199 out_le32(mv64x60_base + MV64360_MPSC2MEM_BAR_ENABLE, enables);
200 }
201#endif
202
203 /* MPSC 0/1 Rx & Tx get clocks BRG0/1 */
204 out_le32(mv64x60_base + mpsc_routing_base + MPSC_RCRR, 0x00000100);
205 out_le32(mv64x60_base + mpsc_routing_base + MPSC_TCRR, 0x00000100);
206
207 /* clear pending interrupts */
208 out_le32(mv64x60_base + MV64x60_SDMA_INTR_OFFSET + SDMA_INTR_MASK, 0);
209
210 out_le32(mv64x60_base + SDMA_SCRDP + sdma_base, (int)&rd[chan][0]);
211 out_le32(mv64x60_base + SDMA_SCTDP + sdma_base,
212 (int)&td[chan][TX_NUM_DESC - 1]);
213 out_le32(mv64x60_base + SDMA_SFTDP + sdma_base,
214 (int)&td[chan][TX_NUM_DESC - 1]);
215
216 out_le32(mv64x60_base + SDMA_SDC + sdma_base,
217 SDMA_SDC_RFT | SDMA_SDC_SFM | SDMA_SDC_BLMR | SDMA_SDC_BLMT |
218 (3 << 12));
219
220 cdv = ((mv64x60_mpsc_clk_freq/(32*mv64x60_console_baud))-1);
221 out_le32(mv64x60_base + brg_bcr,
222 ((mv64x60_mpsc_clk_src << 18) | (1 << 16) | cdv));
223
224 /* Put MPSC into UART mode, no null modem, 16x clock mode */
225 out_le32(mv64x60_base + MPSC_MMCRL + mpsc_base[chan], 0x000004c4);
226 out_le32(mv64x60_base + MPSC_MMCRH + mpsc_base[chan], 0x04400400);
227
228 out_le32(mv64x60_base + MPSC_CHR_1 + mpsc_base[chan], 0);
229 out_le32(mv64x60_base + MPSC_CHR_9 + mpsc_base[chan], 0);
230 out_le32(mv64x60_base + MPSC_CHR_10 + mpsc_base[chan], 0);
231 out_le32(mv64x60_base + MPSC_CHR_3 + mpsc_base[chan], 4);
232 out_le32(mv64x60_base + MPSC_CHR_4 + mpsc_base[chan], 0);
233 out_le32(mv64x60_base + MPSC_CHR_5 + mpsc_base[chan], 0);
234 out_le32(mv64x60_base + MPSC_CHR_6 + mpsc_base[chan], 0);
235 out_le32(mv64x60_base + MPSC_CHR_7 + mpsc_base[chan], 0);
236 out_le32(mv64x60_base + MPSC_CHR_8 + mpsc_base[chan], 0);
237
238 /* 8 data bits, 1 stop bit */
239 out_le32(mv64x60_base + MPSC_MPCR + mpsc_base[chan], (3 << 12));
240 out_le32(mv64x60_base + SDMA_SDCM + sdma_base, SDMA_SDCM_ERD);
241 out_le32(mv64x60_base + MPSC_CHR_2 + mpsc_base[chan], MPSC_CHR_2_EH);
242
243 udelay(100);
244
245 return chan;
246}
247
248static void
249stop_dma(int chan)
250{
251 int i;
252
253 /* Abort MPSC Rx (aborting Tx messes things up) */
254 out_le32(mv64x60_base + MPSC_CHR_2 + mpsc_base[chan], MPSC_CHR_2_RA);
255
256 /* Abort SDMA Rx, Tx */
257 out_le32(mv64x60_base + sdma_regs[chan].sdcm,
258 SDMA_SDCM_AR | SDMA_SDCM_STD);
259
260 for (i=0; i<MAX_RESET_WAIT; i++) {
261 if ((in_le32(mv64x60_base + sdma_regs[chan].sdcm) &
262 (SDMA_SDCM_AR | SDMA_SDCM_AT)) == 0)
263 break;
264
265 udelay(100);
266 }
267}
268
269static int
270wait_for_ownership(int chan)
271{
272 int i;
273
274 for (i=0; i<MAX_TX_WAIT; i++) {
275 if ((in_le32(mv64x60_base + sdma_regs[chan].sdcm) &
276 SDMA_SDCM_TXD) == 0)
277 break;
278
279 udelay(1000);
280 }
281
282 return (i < MAX_TX_WAIT);
283}
284
285void
286serial_putc(unsigned long com_port, unsigned char c)
287{
288 struct mv64x60_tx_desc *tdp;
289
290 if (wait_for_ownership(com_port) == 0)
291 return;
292
293 tdp = &td[com_port][cur_td[com_port]];
294 if (++cur_td[com_port] >= TX_NUM_DESC)
295 cur_td[com_port] = 0;
296
297 *(unchar *)(tdp->buffer ^ 7) = c;
298 tdp->bytecnt = 1;
299 tdp->shadow = 1;
300 tdp->cmd_stat = SDMA_DESC_CMDSTAT_L | SDMA_DESC_CMDSTAT_F |
301 SDMA_DESC_CMDSTAT_O;
302
303 out_le32(mv64x60_base + sdma_regs[com_port].sctdp, (int)tdp);
304 out_le32(mv64x60_base + sdma_regs[com_port].sftdp, (int)tdp);
305 out_le32(mv64x60_base + sdma_regs[com_port].sdcm,
306 in_le32(mv64x60_base + sdma_regs[com_port].sdcm) |
307 SDMA_SDCM_TXD);
308}
309
310unsigned char
311serial_getc(unsigned long com_port)
312{
313 struct mv64x60_rx_desc *rdp;
314 unchar c = '\0';
315
316 rdp = &rd[com_port][cur_rd[com_port]];
317
318 if ((rdp->cmd_stat & (SDMA_DESC_CMDSTAT_O|SDMA_DESC_CMDSTAT_ES)) == 0) {
319 c = *(unchar *)(rdp->buffer ^ 7);
320 RX_INIT_RDP(rdp);
321 if (++cur_rd[com_port] >= RX_NUM_DESC)
322 cur_rd[com_port] = 0;
323 }
324
325 return c;
326}
327
328int
329serial_tstc(unsigned long com_port)
330{
331 struct mv64x60_rx_desc *rdp;
332 int loop_count = 0;
333 int rc = 0;
334
335 rdp = &rd[com_port][cur_rd[com_port]];
336
337 /* Go thru rcv desc's until empty looking for one with data (no error)*/
338 while (((rdp->cmd_stat & SDMA_DESC_CMDSTAT_O) == 0) &&
339 (loop_count++ < RX_NUM_DESC)) {
340
341 /* If there was an error, reinit the desc & continue */
342 if ((rdp->cmd_stat & SDMA_DESC_CMDSTAT_ES) != 0) {
343 RX_INIT_RDP(rdp);
344 if (++cur_rd[com_port] >= RX_NUM_DESC)
345 cur_rd[com_port] = 0;
346 rdp = (struct mv64x60_rx_desc *)rdp->next_desc_ptr;
347 } else {
348 rc = 1;
349 break;
350 }
351 }
352
353 return rc;
354}
355
356void
357serial_close(unsigned long com_port)
358{
359 stop_dma(com_port);
360}
diff --git a/arch/ppc/boot/simple/openbios.c b/arch/ppc/boot/simple/openbios.c
new file mode 100644
index 000000000000..c732b6d70cfb
--- /dev/null
+++ b/arch/ppc/boot/simple/openbios.c
@@ -0,0 +1,37 @@
1/*
2 * arch/ppc/boot/simple/openbios.c
3 *
4 * 2005 (c) SYSGO AG - g.jaeger@sysgo.com
5 * This file is licensed under the terms of the GNU General Public
6 * License version 2. This program is licensed "as is" without
7 * any warranty of any kind, whether express or implied.
8 *
9 * Derived from arch/ppc/boot/simple/pibs.c (from MontaVista)
10 */
11
12#include <linux/types.h>
13#include <linux/config.h>
14#include <linux/string.h>
15#include <asm/ppcboot.h>
16#include <platforms/4xx/ebony.h>
17
18extern unsigned long decompress_kernel(unsigned long load_addr, int num_words,
19 unsigned long cksum);
20
21/* We need to make sure that this is before the images to ensure
22 * that it's in a mapped location. */
23bd_t hold_resid_buf __attribute__ ((__section__ (".data.boot")));
24bd_t *hold_residual = &hold_resid_buf;
25
26void *
27load_kernel(unsigned long load_addr, int num_words, unsigned long cksum,
28 void *ign1, void *ign2)
29{
30 decompress_kernel(load_addr, num_words, cksum);
31
32 /* simply copy the MAC addresses */
33 memcpy(hold_residual->bi_enetaddr, (char *)EBONY_OPENBIOS_MAC_BASE, 6);
34 memcpy(hold_residual->bi_enet1addr, (char *)(EBONY_OPENBIOS_MAC_BASE+EBONY_OPENBIOS_MAC_OFFSET), 6);
35
36 return (void *)hold_residual;
37}
diff --git a/arch/ppc/boot/simple/pci.c b/arch/ppc/boot/simple/pci.c
new file mode 100644
index 000000000000..b0f673c8b7d9
--- /dev/null
+++ b/arch/ppc/boot/simple/pci.c
@@ -0,0 +1,274 @@
1/* Stand alone funtions for QSpan Tundra support.
2 */
3#include <linux/types.h>
4#include <linux/pci.h>
5#include <asm/mpc8xx.h>
6
7extern void puthex(unsigned long val);
8extern void puts(const char *);
9
10/* To map PCI devices, you first write 0xffffffff into the device
11 * base address registers. When the register is read back, the
12 * number of most significant '1' bits describes the amount of address
13 * space needed for mapping. If the most significant bit is not set,
14 * either the device does not use that address register, or it has
15 * a fixed address that we can't change. After the address is assigned,
16 * the command register has to be written to enable the card.
17 */
18typedef struct {
19 u_char pci_bus;
20 u_char pci_devfn;
21 ushort pci_command;
22 uint pci_addrs[6];
23} pci_map_t;
24
25/* We should probably dynamically allocate these structures.
26*/
27#define MAX_PCI_DEVS 32
28int pci_dev_cnt;
29pci_map_t pci_map[MAX_PCI_DEVS];
30
31void pci_conf_write(int bus, int device, int func, int reg, uint writeval);
32void pci_conf_read(int bus, int device, int func, int reg, void *readval);
33void probe_addresses(int bus, int devfn);
34void map_pci_addrs(void);
35
36extern int
37qs_pci_read_config_byte(unsigned char bus, unsigned char dev_fn,
38 unsigned char offset, unsigned char *val);
39extern int
40qs_pci_read_config_word(unsigned char bus, unsigned char dev_fn,
41 unsigned char offset, unsigned short *val);
42extern int
43qs_pci_read_config_dword(unsigned char bus, unsigned char dev_fn,
44 unsigned char offset, unsigned int *val);
45extern int
46qs_pci_write_config_byte(unsigned char bus, unsigned char dev_fn,
47 unsigned char offset, unsigned char val);
48extern int
49qs_pci_write_config_word(unsigned char bus, unsigned char dev_fn,
50 unsigned char offset, unsigned short val);
51extern int
52qs_pci_write_config_dword(unsigned char bus, unsigned char dev_fn,
53 unsigned char offset, unsigned int val);
54
55
56/* This is a really stripped version of PCI bus scan. All we are
57 * looking for are devices that exist.
58 */
59void
60pci_scanner(int addr_probe)
61{
62 unsigned int devfn, l, class, bus_number;
63 unsigned char hdr_type, is_multi;
64
65 is_multi = 0;
66 bus_number = 0;
67 for (devfn = 0; devfn < 0xff; ++devfn) {
68 /* The device numbers are comprised of upper 5 bits of
69 * device number and lower 3 bits of multi-function number.
70 */
71 if ((devfn & 7) && !is_multi) {
72 /* Don't scan multifunction addresses if this is
73 * not a multifunction device.
74 */
75 continue;
76 }
77
78 /* Read the header to determine card type.
79 */
80 qs_pci_read_config_byte(bus_number, devfn, PCI_HEADER_TYPE,
81 &hdr_type);
82
83 /* If this is a base device number, check the header to
84 * determine if it is mulifunction.
85 */
86 if ((devfn & 7) == 0)
87 is_multi = hdr_type & 0x80;
88
89 /* Check to see if the board is really in the slot.
90 */
91 qs_pci_read_config_dword(bus_number, devfn, PCI_VENDOR_ID, &l);
92 /* some broken boards return 0 if a slot is empty: */
93 if (l == 0xffffffff || l == 0x00000000 || l == 0x0000ffff ||
94 l == 0xffff0000) {
95 /* Nothing there.
96 */
97 is_multi = 0;
98 continue;
99 }
100
101 /* If we are not performing an address probe,
102 * just simply print out some information.
103 */
104 if (!addr_probe) {
105 qs_pci_read_config_dword(bus_number, devfn,
106 PCI_CLASS_REVISION, &class);
107
108 class >>= 8; /* upper 3 bytes */
109
110#if 0
111 printf("Found (%3d:%d): vendor 0x%04x, device 0x%04x, class 0x%06x\n",
112 (devfn >> 3), (devfn & 7),
113 (l & 0xffff), (l >> 16) & 0xffff, class);
114#else
115 puts("Found ("); puthex(devfn >> 3);
116 puts(":"); puthex(devfn & 7);
117 puts("): vendor "); puthex(l & 0xffff);
118 puts(", device "); puthex((l >> 16) & 0xffff);
119 puts(", class "); puthex(class); puts("\n");
120#endif
121 }
122 else {
123 /* If this is a "normal" device, build address list.
124 */
125 if ((hdr_type & 0x7f) == PCI_HEADER_TYPE_NORMAL)
126 probe_addresses(bus_number, devfn);
127 }
128 }
129
130 /* Now map the boards.
131 */
132 if (addr_probe)
133 map_pci_addrs();
134}
135
136/* Probe addresses for the specified device. This is a destructive
137 * operation because it writes the registers.
138 */
139void
140probe_addresses(bus, devfn)
141{
142 int i;
143 uint pciaddr;
144 ushort pcicmd;
145 pci_map_t *pm;
146
147 if (pci_dev_cnt >= MAX_PCI_DEVS) {
148 puts("Too many PCI devices\n");
149 return;
150 }
151
152 pm = &pci_map[pci_dev_cnt++];
153
154 pm->pci_bus = bus;
155 pm->pci_devfn = devfn;
156
157 for (i=0; i<6; i++) {
158 qs_pci_write_config_dword(bus, devfn, PCI_BASE_ADDRESS_0 + (i * 4), -1);
159 qs_pci_read_config_dword(bus, devfn, PCI_BASE_ADDRESS_0 + (i * 4),
160 &pciaddr);
161 pm->pci_addrs[i] = pciaddr;
162 qs_pci_read_config_word(bus, devfn, PCI_COMMAND, &pcicmd);
163 pm->pci_command = pcicmd;
164 }
165}
166
167/* Map the cards into the PCI space. The PCI has separate memory
168 * and I/O spaces. In addition, some memory devices require mapping
169 * below 1M. The least significant 4 bits of the address register
170 * provide information. If this is an I/O device, only the LS bit
171 * is used to indicate that, so I/O devices can be mapped to a two byte
172 * boundard. Memory addresses can be mapped to a 32 byte boundary.
173 * The QSpan implementations usually have a 1Gbyte space for each
174 * memory and I/O spaces.
175 *
176 * This isn't a terribly fancy algorithm. I just map the spaces from
177 * the top starting with the largest address space. When finished,
178 * the registers are written and the card enabled.
179 *
180 * While the Tundra can map a large address space on most boards, we
181 * need to be careful because it may overlap other devices (like IMMR).
182 */
183#define MEMORY_SPACE_SIZE 0x20000000
184#define IO_SPACE_SIZE 0x20000000
185
186void
187map_pci_addrs()
188{
189 uint pci_mem_top, pci_mem_low;
190 uint pci_io_top;
191 uint addr_mask, reg_addr, space;
192 int i, j;
193 pci_map_t *pm;
194
195 pci_mem_top = MEMORY_SPACE_SIZE;
196 pci_io_top = IO_SPACE_SIZE;
197 pci_mem_low = (1 * 1024 * 1024); /* Below one meg addresses */
198
199 /* We can't map anything more than the maximum space, but test
200 * for it anyway to catch devices out of range.
201 */
202 addr_mask = 0x80000000;
203
204 do {
205 space = (~addr_mask) + 1; /* Size of the space */
206 for (i=0; i<pci_dev_cnt; i++) {
207 pm = &pci_map[i];
208 for (j=0; j<6; j++) {
209 /* If the MS bit is not set, this has either
210 * already been mapped, or is not used.
211 */
212 reg_addr = pm->pci_addrs[j];
213 if ((reg_addr & 0x80000000) == 0)
214 continue;
215 if (reg_addr & PCI_BASE_ADDRESS_SPACE_IO) {
216 if ((reg_addr & PCI_BASE_ADDRESS_IO_MASK) != addr_mask)
217 continue;
218 if (pci_io_top < space) {
219 puts("Out of PCI I/O space\n");
220 }
221 else {
222 pci_io_top -= space;
223 pm->pci_addrs[j] = pci_io_top;
224 pm->pci_command |= PCI_COMMAND_IO;
225 }
226 }
227 else {
228 if ((reg_addr & PCI_BASE_ADDRESS_MEM_MASK) != addr_mask)
229 continue;
230
231 /* Memory space. Test if below 1M.
232 */
233 if (reg_addr & PCI_BASE_ADDRESS_MEM_TYPE_1M) {
234 if (pci_mem_low < space) {
235 puts("Out of PCI 1M space\n");
236 }
237 else {
238 pci_mem_low -= space;
239 pm->pci_addrs[j] = pci_mem_low;
240 }
241 }
242 else {
243 if (pci_mem_top < space) {
244 puts("Out of PCI Mem space\n");
245 }
246 else {
247 pci_mem_top -= space;
248 pm->pci_addrs[j] = pci_mem_top;
249 }
250 }
251 pm->pci_command |= PCI_COMMAND_MEMORY;
252 }
253 }
254 }
255 addr_mask >>= 1;
256 addr_mask |= 0x80000000;
257 } while (addr_mask != 0xfffffffe);
258
259 /* Now, run the list one more time and map everything.
260 */
261 for (i=0; i<pci_dev_cnt; i++) {
262 pm = &pci_map[i];
263 for (j=0; j<6; j++) {
264 qs_pci_write_config_dword(pm->pci_bus, pm->pci_devfn,
265 PCI_BASE_ADDRESS_0 + (j * 4), pm->pci_addrs[j]);
266 }
267
268 /* Enable memory or address mapping.
269 */
270 qs_pci_write_config_word(pm->pci_bus, pm->pci_devfn, PCI_COMMAND,
271 pm->pci_command);
272 }
273}
274
diff --git a/arch/ppc/boot/simple/pibs.c b/arch/ppc/boot/simple/pibs.c
new file mode 100644
index 000000000000..1348740e503f
--- /dev/null
+++ b/arch/ppc/boot/simple/pibs.c
@@ -0,0 +1,103 @@
1/*
2 * 2004-2005 (c) MontaVista, Software, Inc. This file is licensed under
3 * the terms of the GNU General Public License version 2. This program
4 * is licensed "as is" without any warranty of any kind, whether express
5 * or implied.
6 */
7
8#include <linux/types.h>
9#include <linux/config.h>
10#include <linux/string.h>
11#include <linux/ctype.h>
12#include <asm/ppcboot.h>
13#include <asm/ibm4xx.h>
14
15extern unsigned long decompress_kernel(unsigned long load_addr, int num_words,
16 unsigned long cksum);
17
18/* We need to make sure that this is before the images to ensure
19 * that it's in a mapped location. - Tom */
20bd_t hold_resid_buf __attribute__ ((__section__ (".data.boot")));
21bd_t *hold_residual = &hold_resid_buf;
22
23/* String functions lifted from lib/vsprintf.c and lib/ctype.c */
24unsigned char _ctype[] = {
25_C,_C,_C,_C,_C,_C,_C,_C, /* 0-7 */
26_C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C, /* 8-15 */
27_C,_C,_C,_C,_C,_C,_C,_C, /* 16-23 */
28_C,_C,_C,_C,_C,_C,_C,_C, /* 24-31 */
29_S|_SP,_P,_P,_P,_P,_P,_P,_P, /* 32-39 */
30_P,_P,_P,_P,_P,_P,_P,_P, /* 40-47 */
31_D,_D,_D,_D,_D,_D,_D,_D, /* 48-55 */
32_D,_D,_P,_P,_P,_P,_P,_P, /* 56-63 */
33_P,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U, /* 64-71 */
34_U,_U,_U,_U,_U,_U,_U,_U, /* 72-79 */
35_U,_U,_U,_U,_U,_U,_U,_U, /* 80-87 */
36_U,_U,_U,_P,_P,_P,_P,_P, /* 88-95 */
37_P,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L, /* 96-103 */
38_L,_L,_L,_L,_L,_L,_L,_L, /* 104-111 */
39_L,_L,_L,_L,_L,_L,_L,_L, /* 112-119 */
40_L,_L,_L,_P,_P,_P,_P,_C, /* 120-127 */
410,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 128-143 */
420,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 144-159 */
43_S|_SP,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P, /* 160-175 */
44_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P, /* 176-191 */
45_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U, /* 192-207 */
46_U,_U,_U,_U,_U,_U,_U,_P,_U,_U,_U,_U,_U,_U,_U,_L, /* 208-223 */
47_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L, /* 224-239 */
48_L,_L,_L,_L,_L,_L,_L,_P,_L,_L,_L,_L,_L,_L,_L,_L}; /* 240-255 */
49
50/**
51 * simple_strtoull - convert a string to an unsigned long long
52 * @cp: The start of the string
53 * @endp: A pointer to the end of the parsed string will be placed here
54 * @base: The number base to use
55 */
56unsigned long long simple_strtoull(const char *cp,char **endp,unsigned int base)
57{
58 unsigned long long result = 0,value;
59
60 if (!base) {
61 base = 10;
62 if (*cp == '0') {
63 base = 8;
64 cp++;
65 if ((toupper(*cp) == 'X') && isxdigit(cp[1])) {
66 cp++;
67 base = 16;
68 }
69 }
70 } else if (base == 16) {
71 if (cp[0] == '0' && toupper(cp[1]) == 'X')
72 cp += 2;
73 }
74 while (isxdigit(*cp) && (value = isdigit(*cp) ? *cp-'0' : (islower(*cp)
75 ? toupper(*cp) : *cp)-'A'+10) < base) {
76 result = result*base + value;
77 cp++;
78 }
79 if (endp)
80 *endp = (char *)cp;
81 return result;
82}
83
84void *
85load_kernel(unsigned long load_addr, int num_words, unsigned long cksum,
86 void *ign1, void *ign2)
87{
88 unsigned long long mac64;
89
90 decompress_kernel(load_addr, num_words, cksum);
91
92 mac64 = simple_strtoull((char *)PIBS_MAC_BASE, 0, 16);
93 memcpy(hold_residual->bi_enetaddr, (char *)&mac64+2, 6);
94#ifdef CONFIG_440GX
95 mac64 = simple_strtoull((char *)(PIBS_MAC_BASE+PIBS_MAC_OFFSET), 0, 16);
96 memcpy(hold_residual->bi_enet1addr, (char *)&mac64+2, 6);
97 mac64 = simple_strtoull((char *)(PIBS_MAC_BASE+PIBS_MAC_OFFSET*2), 0, 16);
98 memcpy(hold_residual->bi_enet2addr, (char *)&mac64+2, 6);
99 mac64 = simple_strtoull((char *)(PIBS_MAC_BASE+PIBS_MAC_OFFSET*3), 0, 16);
100 memcpy(hold_residual->bi_enet3addr, (char *)&mac64+2, 6);
101#endif
102 return (void *)hold_residual;
103}
diff --git a/arch/ppc/boot/simple/prepmap.c b/arch/ppc/boot/simple/prepmap.c
new file mode 100644
index 000000000000..c871a4db6e8c
--- /dev/null
+++ b/arch/ppc/boot/simple/prepmap.c
@@ -0,0 +1,12 @@
1/*
2 * 2004 (C) IBM. This file is licensed under the terms of the GNU General
3 * Public License version 2. This program is licensed "as is" without any
4 * warranty of any kind, whether express or implied.
5 */
6
7#include <nonstdio.h>
8
9void board_isa_init(void)
10{
11 ISA_init(0x80000000);
12}
diff --git a/arch/ppc/boot/simple/qspan_pci.c b/arch/ppc/boot/simple/qspan_pci.c
new file mode 100644
index 000000000000..d2966d032a4c
--- /dev/null
+++ b/arch/ppc/boot/simple/qspan_pci.c
@@ -0,0 +1,269 @@
1/*
2 * LinuxPPC arch/ppc/kernel/qspan_pci.c Dan Malek (dmalek@jlc.net)
3 *
4 * QSpan Motorola bus to PCI bridge. The config address register
5 * is located 0x500 from the base of the bridge control/status registers.
6 * The data register is located at 0x504.
7 * This is a two step operation. First, the address register is written,
8 * then the data register is read/written as required.
9 * I don't know what to do about interrupts (yet).
10 */
11
12#include <linux/types.h>
13#include <linux/kernel.h>
14#include <linux/pci.h>
15#include <asm/mpc8xx.h>
16
17/*
18 * When reading the configuration space, if something does not respond
19 * the bus times out and we get a machine check interrupt. So, the
20 * good ol' exception tables come to mind to trap it and return some
21 * value.
22 *
23 * On an error we just return a -1, since that is what the caller wants
24 * returned if nothing is present. I copied this from __get_user_asm,
25 * with the only difference of returning -1 instead of EFAULT.
26 * There is an associated hack in the machine check trap code.
27 *
28 * The QSPAN is also a big endian device, that is it makes the PCI
29 * look big endian to us. This presents a problem for the Linux PCI
30 * functions, which assume little endian. For example, we see the
31 * first 32-bit word like this:
32 * ------------------------
33 * | Device ID | Vendor ID |
34 * ------------------------
35 * If we read/write as a double word, that's OK. But in our world,
36 * when read as a word, device ID is at location 0, not location 2 as
37 * the little endian PCI would believe. We have to switch bits in
38 * the PCI addresses given to us to get the data to/from the correct
39 * byte lanes.
40 *
41 * The QSPAN only supports 4 bits of "slot" in the dev_fn instead of 5.
42 * It always forces the MS bit to zero. Therefore, dev_fn values
43 * greater than 128 are returned as "no device found" errors.
44 *
45 * The QSPAN can only perform long word (32-bit) configuration cycles.
46 * The "offset" must have the two LS bits set to zero. Read operations
47 * require we read the entire word and then sort out what should be
48 * returned. Write operations other than long word require that we
49 * read the long word, update the proper word or byte, then write the
50 * entire long word back.
51 *
52 * PCI Bridge hack. We assume (correctly) that bus 0 is the primary
53 * PCI bus from the QSPAN. If we are called with a bus number other
54 * than zero, we create a Type 1 configuration access that a downstream
55 * PCI bridge will interpret.
56 */
57
58#define __get_pci_config(x, addr, op) \
59 __asm__ __volatile__( \
60 "1: "op" %0,0(%1)\n" \
61 " eieio\n" \
62 "2:\n" \
63 ".section .fixup,\"ax\"\n" \
64 "3: li %0,-1\n" \
65 " b 2b\n" \
66 ".section __ex_table,\"a\"\n" \
67 " .align 2\n" \
68 " .long 1b,3b\n" \
69 ".text" \
70 : "=r"(x) : "r"(addr))
71
72#define QS_CONFIG_ADDR ((volatile uint *)(PCI_CSR_ADDR + 0x500))
73#define QS_CONFIG_DATA ((volatile uint *)(PCI_CSR_ADDR + 0x504))
74
75#define mk_config_addr(bus, dev, offset) \
76 (((bus)<<16) | ((dev)<<8) | (offset & 0xfc))
77
78#define mk_config_type1(bus, dev, offset) \
79 mk_config_addr(bus, dev, offset) | 1;
80
81/* Initialize the QSpan device registers after power up.
82*/
83void
84qspan_init(void)
85{
86 uint *qptr;
87
88
89
90 qptr = (uint *)PCI_CSR_ADDR;
91
92 /* PCI Configuration/status. Upper bits written to clear
93 * pending interrupt or status. Lower bits enable QSPAN as
94 * PCI master, enable memory and I/O cycles, and enable PCI
95 * parity error checking.
96 * IMPORTANT: The last two bits of this word enable PCI
97 * master cycles into the QBus. The QSpan is broken and can't
98 * meet the timing specs of the PQ bus for this to work. Therefore,
99 * if you don't have external bus arbitration, you can't use
100 * this function.
101 */
102#ifdef EXTERNAL_PQ_ARB
103 qptr[1] = 0xf9000147;
104#else
105 qptr[1] = 0xf9000144;
106#endif
107
108 /* PCI Misc configuration. Set PCI latency timer resolution
109 * of 8 cycles, set cache size to 4 x 32.
110 */
111 qptr[3] = 0;
112
113 /* Set up PCI Target address mapping. Enable, Posted writes,
114 * 2Gbyte space (processor memory controller determines actual size).
115 */
116 qptr[64] = 0x8f000080;
117
118 /* Map processor 0x80000000 to PCI 0x00000000.
119 * Processor address bit 1 determines I/O type access (0x80000000)
120 * or memory type access (0xc0000000).
121 */
122 qptr[65] = 0x80000000;
123
124 /* Enable error logging and clear any pending error status.
125 */
126 qptr[80] = 0x90000000;
127
128 qptr[512] = 0x000c0003;
129
130 /* Set up Qbus slave image.
131 */
132 qptr[960] = 0x01000000;
133 qptr[961] = 0x000000d1;
134 qptr[964] = 0x00000000;
135 qptr[965] = 0x000000d1;
136
137}
138
139/* Functions to support PCI bios-like features to read/write configuration
140 * space. If the function fails for any reason, a -1 (0xffffffff) value
141 * must be returned.
142 */
143#define DEVICE_NOT_FOUND (-1)
144#define SUCCESSFUL 0
145
146int qs_pci_read_config_byte(unsigned char bus, unsigned char dev_fn,
147 unsigned char offset, unsigned char *val)
148{
149 uint temp;
150 u_char *cp;
151
152 if ((bus > 7) || (dev_fn > 127)) {
153 *val = 0xff;
154 return DEVICE_NOT_FOUND;
155 }
156
157 if (bus == 0)
158 *QS_CONFIG_ADDR = mk_config_addr(bus, dev_fn, offset);
159 else
160 *QS_CONFIG_ADDR = mk_config_type1(bus, dev_fn, offset);
161 __get_pci_config(temp, QS_CONFIG_DATA, "lwz");
162
163 offset ^= 0x03;
164 cp = ((u_char *)&temp) + (offset & 0x03);
165 *val = *cp;
166 return SUCCESSFUL;
167}
168
169int qs_pci_read_config_word(unsigned char bus, unsigned char dev_fn,
170 unsigned char offset, unsigned short *val)
171{
172 uint temp;
173 ushort *sp;
174
175 if ((bus > 7) || (dev_fn > 127)) {
176 *val = 0xffff;
177 return DEVICE_NOT_FOUND;
178 }
179
180 if (bus == 0)
181 *QS_CONFIG_ADDR = mk_config_addr(bus, dev_fn, offset);
182 else
183 *QS_CONFIG_ADDR = mk_config_type1(bus, dev_fn, offset);
184 __get_pci_config(temp, QS_CONFIG_DATA, "lwz");
185 offset ^= 0x02;
186
187 sp = ((ushort *)&temp) + ((offset >> 1) & 1);
188 *val = *sp;
189 return SUCCESSFUL;
190}
191
192int qs_pci_read_config_dword(unsigned char bus, unsigned char dev_fn,
193 unsigned char offset, unsigned int *val)
194{
195 if ((bus > 7) || (dev_fn > 127)) {
196 *val = 0xffffffff;
197 return DEVICE_NOT_FOUND;
198 }
199 if (bus == 0)
200 *QS_CONFIG_ADDR = mk_config_addr(bus, dev_fn, offset);
201 else
202 *QS_CONFIG_ADDR = mk_config_type1(bus, dev_fn, offset);
203 __get_pci_config(*val, QS_CONFIG_DATA, "lwz");
204 return SUCCESSFUL;
205}
206
207int qs_pci_write_config_byte(unsigned char bus, unsigned char dev_fn,
208 unsigned char offset, unsigned char val)
209{
210 uint temp;
211 u_char *cp;
212
213 if ((bus > 7) || (dev_fn > 127))
214 return DEVICE_NOT_FOUND;
215
216 qs_pci_read_config_dword(bus, dev_fn, offset, &temp);
217
218 offset ^= 0x03;
219 cp = ((u_char *)&temp) + (offset & 0x03);
220 *cp = val;
221
222 if (bus == 0)
223 *QS_CONFIG_ADDR = mk_config_addr(bus, dev_fn, offset);
224 else
225 *QS_CONFIG_ADDR = mk_config_type1(bus, dev_fn, offset);
226 *QS_CONFIG_DATA = temp;
227
228 return SUCCESSFUL;
229}
230
231int qs_pci_write_config_word(unsigned char bus, unsigned char dev_fn,
232 unsigned char offset, unsigned short val)
233{
234 uint temp;
235 ushort *sp;
236
237 if ((bus > 7) || (dev_fn > 127))
238 return DEVICE_NOT_FOUND;
239
240 qs_pci_read_config_dword(bus, dev_fn, offset, &temp);
241
242 offset ^= 0x02;
243 sp = ((ushort *)&temp) + ((offset >> 1) & 1);
244 *sp = val;
245
246 if (bus == 0)
247 *QS_CONFIG_ADDR = mk_config_addr(bus, dev_fn, offset);
248 else
249 *QS_CONFIG_ADDR = mk_config_type1(bus, dev_fn, offset);
250 *QS_CONFIG_DATA = temp;
251
252 return SUCCESSFUL;
253}
254
255int qs_pci_write_config_dword(unsigned char bus, unsigned char dev_fn,
256 unsigned char offset, unsigned int val)
257{
258 if ((bus > 7) || (dev_fn > 127))
259 return DEVICE_NOT_FOUND;
260
261 if (bus == 0)
262 *QS_CONFIG_ADDR = mk_config_addr(bus, dev_fn, offset);
263 else
264 *QS_CONFIG_ADDR = mk_config_type1(bus, dev_fn, offset);
265 *(unsigned int *)QS_CONFIG_DATA = val;
266
267 return SUCCESSFUL;
268}
269
diff --git a/arch/ppc/boot/simple/relocate.S b/arch/ppc/boot/simple/relocate.S
new file mode 100644
index 000000000000..555a216ccc49
--- /dev/null
+++ b/arch/ppc/boot/simple/relocate.S
@@ -0,0 +1,216 @@
1/*
2 * arch/ppc/boot/simple/relocate.S
3 *
4 * This is the common part of the loader relocation and initialization
5 * process. All of the board/processor specific initialization is
6 * done before we get here.
7 *
8 * Author: Tom Rini
9 * trini@mvista.com
10 * Derived from arch/ppc/boot/prep/head.S (Cort Dougan, many others).
11 *
12 * 2001-2004 (c) MontaVista, Software, Inc. This file is licensed under
13 * the terms of the GNU General Public License version 2. This program
14 * is licensed "as is" without any warranty of any kind, whether express
15 * or implied.
16 */
17
18#include <linux/config.h>
19#include <asm/cache.h>
20#include <asm/ppc_asm.h>
21
22#define GETSYM(reg, sym) \
23 lis reg, sym@h; ori reg, reg, sym@l
24
25 .text
26 /* We get called from the early initialization code.
27 * Register 3 has the address where we were loaded,
28 * Register 4 contains any residual data passed from the
29 * boot rom.
30 */
31 .globl relocate
32relocate:
33 /* Save r3, r4 for later.
34 * The r8/r11 are legacy registers so I don't have to
35 * rewrite the code below :-).
36 */
37 mr r8, r3
38 mr r11, r4
39
40 /* compute the size of the whole image in words. */
41 GETSYM(r4,start)
42 GETSYM(r5,end)
43
44 addi r5,r5,3 /* round up */
45 sub r5,r5,r4 /* end - start */
46 srwi r5,r5,2
47 mr r7,r5 /* Save for later use. */
48
49 /*
50 * Check if we need to relocate ourselves to the link addr or were
51 * we loaded there to begin with.
52 */
53 cmpw cr0,r3,r4
54 beq start_ldr /* If 0, we don't need to relocate */
55
56 /* Move this code somewhere safe. This is max(load + size, end)
57 * r8 == load address
58 */
59 GETSYM(r4, start)
60 GETSYM(r5, end)
61
62 sub r6,r5,r4
63 add r6,r8,r6 /* r6 == phys(load + size) */
64
65 cmpw r5,r6
66 bgt 1f
67 b 2f
681:
69 mr r6, r5
702:
71 /* dest is in r6 */
72 /* Ensure alignment --- this code is precautionary */
73 addi r6,r6,4
74 li r5,0x0003
75 andc r6,r6,r5
76
77 /* Find physical address and size of do_relocate */
78 GETSYM(r5, __relocate_start)
79 GETSYM(r4, __relocate_end)
80 GETSYM(r3, start)
81
82 /* Size to copy */
83 sub r4,r4,r5
84 srwi r4,r4,2
85
86 /* Src addr to copy (= __relocate_start - start + where_loaded) */
87 sub r3,r5,r3
88 add r5,r8,r3
89
90 /* Save dest */
91 mr r3, r6
92
93 /* Do the copy */
94 mtctr r4
953: lwz r4,0(r5)
96 stw r4,0(r3)
97 addi r3,r3,4
98 addi r5,r5,4
99 bdnz 3b
100
101 GETSYM(r4, __relocate_start)
102 GETSYM(r5, do_relocate)
103
104 sub r4,r5,r4 /* Get entry point for do_relocate in */
105 add r6,r6,r4 /* relocated section */
106
107 /* This will return to the relocated do_relocate */
108 mtlr r6
109 b flush_instruction_cache
110
111 .section ".relocate_code","xa"
112
113do_relocate:
114 /* We have 2 cases --- start < load, or start > load
115 * This determines whether we copy from the end, or the start.
116 * Its easier to have 2 loops than to have paramaterised
117 * loops. Sigh.
118 */
119 li r6,0 /* Clear checksum */
120 mtctr r7 /* Setup for a loop */
121
122 GETSYM(r4, start)
123 mr r3,r8 /* Get the load addr */
124
125 cmpw cr0,r4,r3 /* If we need to copy from the end, do so */
126 bgt do_relocate_from_end
127
128do_relocate_from_start:
1291: lwz r5,0(r3) /* Load and decrement */
130 stw r5,0(r4) /* Store and decrement */
131 addi r3,r3,4
132 addi r4,r4,4
133 xor r6,r6,r5 /* Update checksum */
134 bdnz 1b /* Are we done? */
135 b do_relocate_out /* Finished */
136
137do_relocate_from_end:
138 GETSYM(r3, end)
139 slwi r4,r7,2
140 add r4,r8,r4 /* Get the physical end */
1411: lwzu r5,-4(r4)
142 stwu r5, -4(r3)
143 xor r6,r6,r5
144 bdnz 1b
145
146do_relocate_out:
147 GETSYM(r3,start_ldr)
148 mtlr r3 /* Easiest way to do an absolute jump */
149/* Some boards don't boot up with the I-cache enabled. Do that
150 * now because the decompress runs much faster that way.
151 * As a side effect, we have to ensure the data cache is not enabled
152 * so we can access the serial I/O without trouble.
153 */
154 b flush_instruction_cache
155
156 .previous
157
158start_ldr:
159/* Clear all of BSS and set up stack for C calls */
160 lis r3,edata@h
161 ori r3,r3,edata@l
162 lis r4,end@h
163 ori r4,r4,end@l
164 subi r3,r3,4
165 subi r4,r4,4
166 li r0,0
16750: stwu r0,4(r3)
168 cmpw cr0,r3,r4
169 bne 50b
17090: mr r9,r1 /* Save old stack pointer (in case it matters) */
171 lis r1,.stack@h
172 ori r1,r1,.stack@l
173 addi r1,r1,4096*2
174 subi r1,r1,256
175 li r2,0x000F /* Mask pointer to 16-byte boundary */
176 andc r1,r1,r2
177
178 /*
179 * Exec kernel loader
180 */
181 mr r3,r8 /* Load point */
182 mr r4,r7 /* Program length */
183 mr r5,r6 /* Checksum */
184 mr r6,r11 /* Residual data */
185 mr r7,r25 /* Validated OFW interface */
186 bl load_kernel
187
188 /*
189 * Make sure the kernel knows we don't have things set in
190 * registers. -- Tom
191 */
192 li r4,0
193 li r5,0
194 li r6,0
195
196 /*
197 * Start at the begining.
198 */
199#ifdef CONFIG_PPC_MULTIPLATFORM
200 li r9,0xc
201 mtlr r9
202 /* tell kernel we're prep, by putting 0xdeadc0de at KERNELLOAD,
203 * and tell the kernel to start on the 4th instruction since we
204 * overwrite the first 3 sometimes (which are 'nop').
205 */
206 lis r10,0xdeadc0de@h
207 ori r10,r10,0xdeadc0de@l
208 li r9,0
209 stw r10,0(r9)
210#else
211 li r9,0
212 mtlr r9
213#endif
214 blr
215
216 .comm .stack,4096*2,4
diff --git a/arch/ppc/boot/simple/rw4/ppc_40x.h b/arch/ppc/boot/simple/rw4/ppc_40x.h
new file mode 100644
index 000000000000..561fb26f5a93
--- /dev/null
+++ b/arch/ppc/boot/simple/rw4/ppc_40x.h
@@ -0,0 +1,664 @@
1/*----------------------------------------------------------------------------+
2| This source code has been made available to you by IBM on an AS-IS
3| basis. Anyone receiving this source is licensed under IBM
4| copyrights to use it in any way he or she deems fit, including
5| copying it, modifying it, compiling it, and redistributing it either
6| with or without modifications. No license under IBM patents or
7| patent applications is to be implied by the copyright license.
8|
9| Any user of this software should understand that IBM cannot provide
10| technical support for this software and will not be responsible for
11| any consequences resulting from the use of this software.
12|
13| Any person who transfers this source code or any derivative work
14| must include the IBM copyright notice, this paragraph, and the
15| preceding two paragraphs in the transferred software.
16|
17| COPYRIGHT I B M CORPORATION 1997
18| LICENSED MATERIAL - PROGRAM PROPERTY OF I B M
19+----------------------------------------------------------------------------*/
20/*----------------------------------------------------------------------------+
21| Author: Tony J. Cerreto
22| Component: Assembler include file.
23| File: ppc_40x.h
24| Purpose: Include file containing PPC DCR defines.
25|
26| Changes:
27| Date Author Comment
28| --------- ------ --------------------------------------------------------
29| 01-Mar-00 tjc Created
30+----------------------------------------------------------------------------*/
31/* added by linguohui*/
32#define MW
33/*----------------------------------------------------------------------------+
34| PPC Special purpose registers Numbers
35+----------------------------------------------------------------------------*/
36#define ccr0 0x3b3 /* core configuration reg */
37#define ctr 0x009 /* count register */
38#define ctrreg 0x009 /* count register */
39#define dbcr0 0x3f2 /* debug control register 0 */
40#define dbcr1 0x3bd /* debug control register 1 */
41#define dbsr 0x3f0 /* debug status register */
42#define dccr 0x3fa /* data cache control reg. */
43#define dcwr 0x3ba /* data cache write-thru reg */
44#define dear 0x3d5 /* data exception address reg */
45#define esr 0x3d4 /* exception syndrome register */
46#define evpr 0x3d6 /* exception vector prefix reg */
47#define iccr 0x3fb /* instruction cache cntrl re */
48#define icdbdr 0x3d3 /* instr cache dbug data reg */
49#define lrreg 0x008 /* link register */
50#define pid 0x3b1 /* process id reg */
51#define pit 0x3db /* programmable interval time */
52#define pvr 0x11f /* processor version register */
53#define sgr 0x3b9 /* storage guarded reg */
54#define sler 0x3bb /* storage little endian reg */
55#define sprg0 0x110 /* special general purpose 0 */
56#define sprg1 0x111 /* special general purpose 1 */
57#define sprg2 0x112 /* special general purpose 2 */
58#define sprg3 0x113 /* special general purpose 3 */
59#define sprg4 0x114 /* special general purpose 4 */
60#define sprg5 0x115 /* special general purpose 5 */
61#define sprg6 0x116 /* special general purpose 6 */
62#define sprg7 0x117 /* special general purpose 7 */
63#define srr0 0x01a /* save/restore register 0 */
64#define srr1 0x01b /* save/restore register 1 */
65#define srr2 0x3de /* save/restore register 2 */
66#define srr3 0x3df /* save/restore register 3 */
67#define tbhi 0x11D
68#define tblo 0x11C
69#define tcr 0x3da /* timer control register */
70#define tsr 0x3d8 /* timer status register */
71#define xerreg 0x001 /* fixed point exception */
72#define xer 0x001 /* fixed point exception */
73#define zpr 0x3b0 /* zone protection reg */
74
75/*----------------------------------------------------------------------------+
76| Decompression Controller
77+----------------------------------------------------------------------------*/
78#define kiar 0x014 /* Decompression cntl addr reg */
79#define kidr 0x015 /* Decompression cntl data reg */
80#define kitor0 0x00 /* index table origin Reg 0 */
81#define kitor1 0x01 /* index table origin Reg 1 */
82#define kitor2 0x02 /* index table origin Reg 2 */
83#define kitor3 0x03 /* index table origin Reg 3 */
84#define kaddr0 0x04 /* addr decode Definition Reg 0 */
85#define kaddr1 0x05 /* addr decode Definition Reg 1 */
86#define kconf 0x40 /* Decompression cntl config reg */
87#define kid 0x41 /* Decompression cntl id reg */
88#define kver 0x42 /* Decompression cntl ver number */
89#define kpear 0x50 /* bus error addr reg (PLB) */
90#define kbear 0x51 /* bus error addr reg (DCP-EBC) */
91#define kesr0 0x52 /* bus error status reg 0 */
92
93/*----------------------------------------------------------------------------+
94| Romeo Specific Device Control Register Numbers.
95+----------------------------------------------------------------------------*/
96#ifndef VESTA
97#define cdbcr 0x3d7 /* cache debug cntrl reg */
98
99#define a_latcnt 0x1a9 /* PLB Latency count */
100#define a_tgval 0x1ac /* tone generation value */
101#define a_plb_pr 0x1bf /* PLB priority */
102
103#define cic_sel1 0x031 /* select register 1 */
104#define cic_sel2 0x032 /* select register 2 */
105
106#define clkgcrst 0x122 /* chip reset register */
107
108#define cp_cpmsr 0x100 /*rstatus register */
109#define cp_cpmer 0x101 /* enable register */
110
111#define dcp_kiar 0x190 /* indirect address register */
112#define dcp_kidr 0x191 /* indirect data register */
113
114#define hsmc_mcgr 0x1c0 /* HSMC global register */
115#define hsmc_mcbesr 0x1c1 /* bus error status register */
116#define hsmc_mcbear 0x1c2 /* bus error address register*/
117#define hsmc_mcbr0 0x1c4 /* SDRAM sub-ctrl bank reg 0 */
118#define hsmc_mccr0 0x1c5 /* SDRAM sub-ctrl ctrl reg 0 */
119#define hsmc_mcbr1 0x1c7 /* SDRAM sub-ctrl bank reg 1 */
120#define hsmc_mccr1 0x1c8 /* SDRAM sub-ctrl ctrl reg 1 */
121#define hsmc_sysr 0x1d1 /* system register */
122#define hsmc_data 0x1d2 /* data register */
123#define hsmc_mccrr 0x1d3 /* refresh register */
124
125#define ocm_pbar 0x1E0 /* base address register */
126
127#define plb0_pacr0 0x057 /* PLB arbiter control reg */
128#define plb1_pacr1 0x067 /* PLB arbiter control reg */
129
130#define v_displb 0x157 /* set left border of display*/
131#define v_disptb 0x158 /* top border of display */
132#define v_osd_la 0x159 /* first link address for OSD*/
133#define v_ptsdlta 0x15E /* PTS delta register */
134#define v_v0base 0x16C /* base mem add for VBI-0 */
135#define v_v1base 0x16D /* base mem add for VBI-1 */
136#define v_osbase 0x16E /* base mem add for OSD data */
137#endif
138
139/*----------------------------------------------------------------------------+
140| Vesta Device Control Register Numbers.
141+----------------------------------------------------------------------------*/
142/*----------------------------------------------------------------------------+
143| Cross bar switch.
144+----------------------------------------------------------------------------*/
145#define cbs0_cr 0x010 /* CBS configuration register */
146
147/*----------------------------------------------------------------------------+
148| DCR external master (DCRX).
149+----------------------------------------------------------------------------*/
150#define dcrx0_icr 0x020 /* internal control register */
151#define dcrx0_isr 0x021 /* internal status register */
152#define dcrx0_ecr 0x022 /* external control register */
153#define dcrx0_esr 0x023 /* external status register */
154#define dcrx0_tar 0x024 /* target address register */
155#define dcrx0_tdr 0x025 /* target data register */
156#define dcrx0_igr 0x026 /* interrupt generation register */
157#define dcrx0_bcr 0x027 /* buffer control register */
158
159/*----------------------------------------------------------------------------+
160| Chip interconnect configuration.
161+----------------------------------------------------------------------------*/
162#define cic0_cr 0x030 /* CIC control register */
163#define cic0_vcr 0x033 /* video macro control reg */
164#define cic0_sel3 0x035 /* select register 3 */
165
166/*----------------------------------------------------------------------------+
167| Chip interconnect configuration.
168+----------------------------------------------------------------------------*/
169#define sgpo0_sgpO 0x036 /* simplified GPIO output */
170#define sgpo0_gpod 0x037 /* simplified GPIO open drain */
171#define sgpo0_gptc 0x038 /* simplified GPIO tristate cntl */
172#define sgpo0_gpi 0x039 /* simplified GPIO input */
173
174/*----------------------------------------------------------------------------+
175| Universal interrupt controller.
176+----------------------------------------------------------------------------*/
177#define uic0_sr 0x040 /* status register */
178#define uic0_srs 0x041 /* status register set */
179#define uic0_er 0x042 /* enable register */
180#define uic0_cr 0x043 /* critical register */
181#define uic0_pr 0x044 /* parity register */
182#define uic0_tr 0x045 /* triggering register */
183#define uic0_msr 0x046 /* masked status register */
184#define uic0_vr 0x047 /* vector register */
185#define uic0_vcr 0x048 /* enable config register */
186
187/*----------------------------------------------------------------------------+
188| PLB 0 and 1.
189+----------------------------------------------------------------------------*/
190#define pb0_pesr 0x054 /* PLB error status reg 0 */
191#define pb0_pesrs 0x055 /* PLB error status reg 0 set */
192#define pb0_pear 0x056 /* PLB error address reg */
193
194#define pb1_pesr 0x064 /* PLB error status reg 1 */
195#define pb1_pesrs 0x065 /* PLB error status reg 1 set */
196#define pb1_pear 0x066 /* PLB error address reg */
197
198/*----------------------------------------------------------------------------+
199| EBIU DCR registers.
200+----------------------------------------------------------------------------*/
201#define ebiu0_brcrh0 0x070 /* bus region register 0 high */
202#define ebiu0_brcrh1 0x071 /* bus region register 1 high */
203#define ebiu0_brcrh2 0x072 /* bus region register 2 high */
204#define ebiu0_brcrh3 0x073 /* bus region register 3 high */
205#define ebiu0_brcrh4 0x074 /* bus region register 4 high */
206#define ebiu0_brcrh5 0x075 /* bus region register 5 high */
207#define ebiu0_brcrh6 0x076 /* bus region register 6 high */
208#define ebiu0_brcrh7 0x077 /* bus region register 7 high */
209#define ebiu0_brcr0 0x080 /* bus region register 0 */
210#define ebiu0_brcr1 0x081 /* bus region register 1 */
211#define ebiu0_brcr2 0x082 /* bus region register 2 */
212#define ebiu0_brcr3 0x083 /* bus region register 3 */
213#define ebiu0_brcr4 0x084 /* bus region register 4 */
214#define ebiu0_brcr5 0x085 /* bus region register 5 */
215#define ebiu0_brcr6 0x086 /* bus region register 6 */
216#define ebiu0_brcr7 0x087 /* bus region register 7 */
217#define ebiu0_bear 0x090 /* bus error address register */
218#define ebiu0_besr 0x091 /* bus error syndrome reg */
219#define ebiu0_besr0s 0x093 /* bus error syndrome reg */
220#define ebiu0_biucr 0x09a /* bus interface control reg */
221
222/*----------------------------------------------------------------------------+
223| OPB bridge.
224+----------------------------------------------------------------------------*/
225#define opbw0_gesr 0x0b0 /* error status reg */
226#define opbw0_gesrs 0x0b1 /* error status reg */
227#define opbw0_gear 0x0b2 /* error address reg */
228
229/*----------------------------------------------------------------------------+
230| DMA.
231+----------------------------------------------------------------------------*/
232#define dma0_cr0 0x0c0 /* DMA channel control reg 0 */
233#define dma0_ct0 0x0c1 /* DMA count register 0 */
234#define dma0_da0 0x0c2 /* DMA destination addr reg 0 */
235#define dma0_sa0 0x0c3 /* DMA source addr register 0 */
236#define dma0_cc0 0x0c4 /* DMA chained count 0 */
237#define dma0_cr1 0x0c8 /* DMA channel control reg 1 */
238#define dma0_ct1 0x0c9 /* DMA count register 1 */
239#define dma0_da1 0x0ca /* DMA destination addr reg 1 */
240#define dma0_sa1 0x0cb /* DMA source addr register 1 */
241#define dma0_cc1 0x0cc /* DMA chained count 1 */
242#define dma0_cr2 0x0d0 /* DMA channel control reg 2 */
243#define dma0_ct2 0x0d1 /* DMA count register 2 */
244#define dma0_da2 0x0d2 /* DMA destination addr reg 2 */
245#define dma0_sa2 0x0d3 /* DMA source addr register 2 */
246#define dma0_cc2 0x0d4 /* DMA chained count 2 */
247#define dma0_cr3 0x0d8 /* DMA channel control reg 3 */
248#define dma0_ct3 0x0d9 /* DMA count register 3 */
249#define dma0_da3 0x0da /* DMA destination addr reg 3 */
250#define dma0_sa3 0x0db /* DMA source addr register 3 */
251#define dma0_cc3 0x0dc /* DMA chained count 3 */
252#define dma0_sr 0x0e0 /* DMA status register */
253#define dma0_srs 0x0e1 /* DMA status register */
254#define dma0_s1 0x031 /* DMA select1 register */
255#define dma0_s2 0x032 /* DMA select2 register */
256
257/*---------------------------------------------------------------------------+
258| Clock and power management.
259+----------------------------------------------------------------------------*/
260#define cpm0_fr 0x102 /* force register */
261
262/*----------------------------------------------------------------------------+
263| Serial Clock Control.
264+----------------------------------------------------------------------------*/
265#define ser0_ccr 0x120 /* serial clock control register */
266
267/*----------------------------------------------------------------------------+
268| Audio Clock Control.
269+----------------------------------------------------------------------------*/
270#define aud0_apcr 0x121 /* audio clock ctrl register */
271
272/*----------------------------------------------------------------------------+
273| DENC.
274+----------------------------------------------------------------------------*/
275#define denc0_idr 0x130 /* DENC ID register */
276#define denc0_cr1 0x131 /* control register 1 */
277#define denc0_rr1 0x132 /* microvision 1 (reserved 1) */
278#define denc0_cr2 0x133 /* control register 2 */
279#define denc0_rr2 0x134 /* microvision 2 (reserved 2) */
280#define denc0_rr3 0x135 /* microvision 3 (reserved 3) */
281#define denc0_rr4 0x136 /* microvision 4 (reserved 4) */
282#define denc0_rr5 0x137 /* microvision 5 (reserved 5) */
283#define denc0_ccdr 0x138 /* closed caption data */
284#define denc0_cccr 0x139 /* closed caption control */
285#define denc0_trr 0x13A /* teletext request register */
286#define denc0_tosr 0x13B /* teletext odd field line se */
287#define denc0_tesr 0x13C /* teletext even field line s */
288#define denc0_rlsr 0x13D /* RGB rhift left register */
289#define denc0_vlsr 0x13E /* video level shift register */
290#define denc0_vsr 0x13F /* video scaling register */
291
292/*----------------------------------------------------------------------------+
293| Video decoder. Suspect 0x179, 0x169, 0x16a, 0x152 (rc).
294+----------------------------------------------------------------------------*/
295#define vid0_ccntl 0x140 /* control decoder operation */
296#define vid0_cmode 0x141 /* video operational mode */
297#define vid0_sstc0 0x142 /* STC high order bits 31:0 */
298#define vid0_sstc1 0x143 /* STC low order bit 32 */
299#define vid0_spts0 0x144 /* PTS high order bits 31:0 */
300#define vid0_spts1 0x145 /* PTS low order bit 32 */
301#define vid0_fifo 0x146 /* FIFO data port */
302#define vid0_fifos 0x147 /* FIFO status */
303#define vid0_cmd 0x148 /* send command to decoder */
304#define vid0_cmdd 0x149 /* port for command params */
305#define vid0_cmdst 0x14A /* command status */
306#define vid0_cmdad 0x14B /* command address */
307#define vid0_procia 0x14C /* instruction store */
308#define vid0_procid 0x14D /* data port for I_Store */
309#define vid0_osdm 0x151 /* OSD mode control */
310#define vid0_hosti 0x152 /* base interrupt register */
311#define vid0_mask 0x153 /* interrupt mask register */
312#define vid0_dispm 0x154 /* operational mode for Disp */
313#define vid0_dispd 0x155 /* setting for 'Sync' delay */
314#define vid0_vbctl 0x156 /* VBI */
315#define vid0_ttxctl 0x157 /* teletext control */
316#define vid0_disptb 0x158 /* display left/top border */
317#define vid0_osdgla 0x159 /* Graphics plane link addr */
318#define vid0_osdila 0x15A /* Image plane link addr */
319#define vid0_rbthr 0x15B /* rate buffer threshold */
320#define vid0_osdcla 0x15C /* Cursor link addr */
321#define vid0_stcca 0x15D /* STC common address */
322#define vid0_ptsctl 0x15F /* PTS Control */
323#define vid0_wprot 0x165 /* write protect for I_Store */
324#define vid0_vcqa 0x167 /* video clip queued block Ad */
325#define vid0_vcql 0x168 /* video clip queued block Le */
326#define vid0_blksz 0x169 /* block size bytes for copy op */
327#define vid0_srcad 0x16a /* copy source address bits 6-31 */
328#define vid0_udbas 0x16B /* base mem add for user data */
329#define vid0_vbibas 0x16C /* base mem add for VBI 0/1 */
330#define vid0_osdibas 0x16D /* Image plane base address */
331#define vid0_osdgbas 0x16E /* Graphic plane base address */
332#define vid0_rbbase 0x16F /* base mem add for video buf */
333#define vid0_dramad 0x170 /* DRAM address */
334#define vid0_dramdt 0x171 /* data port for DRAM access */
335#define vid0_dramcs 0x172 /* DRAM command and statusa */
336#define vid0_vcwa 0x173 /* v clip work address */
337#define vid0_vcwl 0x174 /* v clip work length */
338#define vid0_mseg0 0x175 /* segment address 0 */
339#define vid0_mseg1 0x176 /* segment address 1 */
340#define vid0_mseg2 0x177 /* segment address 2 */
341#define vid0_mseg3 0x178 /* segment address 3 */
342#define vid0_fbbase 0x179 /* frame buffer base memory */
343#define vid0_osdcbas 0x17A /* Cursor base addr */
344#define vid0_lboxtb 0x17B /* top left border */
345#define vid0_trdly 0x17C /* transparency gate delay */
346#define vid0_sbord 0x17D /* left/top small pict. bord. */
347#define vid0_zoffs 0x17E /* hor/ver zoom window */
348#define vid0_rbsz 0x17F /* rate buffer size read */
349
350/*----------------------------------------------------------------------------+
351| Transport demultiplexer.
352+----------------------------------------------------------------------------*/
353#define xpt0_lr 0x180 /* demux location register */
354#define xpt0_data 0x181 /* demux data register */
355#define xpt0_ir 0x182 /* demux interrupt register */
356
357#define xpt0_config1 0x0000 /* configuration 1 */
358#define xpt0_control1 0x0001 /* control 1 */
359#define xpt0_festat 0x0002 /* Front-end status */
360#define xpt0_feimask 0x0003 /* Front_end interrupt Mask */
361#define xpt0_ocmcnfg 0x0004 /* OCM Address */
362#define xpt0_settapi 0x0005 /* Set TAP Interrupt */
363
364#define xpt0_pcrhi 0x0010 /* PCR High */
365#define xpt0_pcrlow 0x0011 /* PCR Low */
366#define xpt0_lstchi 0x0012 /* Latched STC High */
367#define xpt0_lstclow 0x0013 /* Latched STC Low */
368#define xpt0_stchi 0x0014 /* STC High */
369#define xpt0_stclow 0x0015 /* STC Low */
370#define xpt0_pwm 0x0016 /* PWM */
371#define xpt0_pcrstct 0x0017 /* PCR-STC Threshold */
372#define xpt0_pcrstcd 0x0018 /* PCR-STC Delta */
373#define xpt0_stccomp 0x0019 /* STC Compare */
374#define xpt0_stccmpd 0x001a /* STC Compare Disarm */
375
376#define xpt0_dsstat 0x0048 /* Descrambler Status */
377#define xpt0_dsimask 0x0049 /* Descrambler Interrupt Mask */
378
379#define xpt0_vcchng 0x01f0 /* Video Channel Change */
380#define xpt0_acchng 0x01f1 /* Audio Channel Change */
381#define xpt0_axenable 0x01fe /* Aux PID Enables */
382#define xpt0_pcrpid 0x01ff /* PCR PID */
383
384#define xpt0_config2 0x1000 /* Configuration 2 */
385#define xpt0_pbuflvl 0x1002 /* Packet Buffer Level */
386#define xpt0_intmask 0x1003 /* Interrupt Mask */
387#define xpt0_plbcnfg 0x1004 /* PLB Configuration */
388
389#define xpt0_qint 0x1010 /* Queues Interrupts */
390#define xpt0_qintmsk 0x1011 /* Queues Interrupts Mask */
391#define xpt0_astatus 0x1012 /* Audio Status */
392#define xpt0_aintmask 0x1013 /* Audio Interrupt Mask */
393#define xpt0_vstatus 0x1014 /* Video Status */
394#define xpt0_vintmask 0x1015 /* Video Interrupt Mask */
395
396#define xpt0_qbase 0x1020 /* Queue Base */
397#define xpt0_bucketq 0x1021 /* Bucket Queue */
398#define xpt0_qstops 0x1024 /* Queue Stops */
399#define xpt0_qresets 0x1025 /* Queue Resets */
400#define xpt0_sfchng 0x1026 /* Section Filter Change */
401
402/*----------------------------------------------------------------------------+
403| Audio decoder. Suspect 0x1ad, 0x1b4, 0x1a3, 0x1a5 (read/write status)
404+----------------------------------------------------------------------------*/
405#define aud0_ctrl0 0x1a0 /* control 0 */
406#define aud0_ctrl1 0x1a1 /* control 1 */
407#define aud0_ctrl2 0x1a2 /* control 2 */
408#define aud0_cmd 0x1a3 /* command register */
409#define aud0_isr 0x1a4 /* interrupt status register */
410#define aud0_imr 0x1a5 /* interrupt mask register */
411#define aud0_dsr 0x1a6 /* decoder status register */
412#define aud0_stc 0x1a7 /* system time clock */
413#define aud0_csr 0x1a8 /* channel status register */
414#define aud0_lcnt 0x1a9 /* queued address register 2 */
415#define aud0_pts 0x1aa /* presentation time stamp */
416#define aud0_tgctrl 0x1ab /* tone generation control */
417#define aud0_qlr2 0x1ac /* queued length register 2 */
418#define aud0_auxd 0x1ad /* aux data */
419#define aud0_strmid 0x1ae /* stream ID */
420#define aud0_qar 0x1af /* queued address register */
421#define aud0_dsps 0x1b0 /* DSP status */
422#define aud0_qlr 0x1b1 /* queued len address */
423#define aud0_dspc 0x1b2 /* DSP control */
424#define aud0_wlr2 0x1b3 /* working length register 2 */
425#define aud0_instd 0x1b4 /* instruction download */
426#define aud0_war 0x1b5 /* working address register */
427#define aud0_seg1 0x1b6 /* segment 1 base register */
428#define aud0_seg2 0x1b7 /* segment 2 base register */
429#define aud0_avf 0x1b9 /* audio att value front */
430#define aud0_avr 0x1ba /* audio att value rear */
431#define aud0_avc 0x1bb /* audio att value center */
432#define aud0_seg3 0x1bc /* segment 3 base register */
433#define aud0_offset 0x1bd /* offset address */
434#define aud0_wrl 0x1be /* working length register */
435#define aud0_war2 0x1bf /* working address register 2 */
436
437/*----------------------------------------------------------------------------+
438| High speed memory controller 0 and 1.
439+----------------------------------------------------------------------------*/
440#define hsmc0_gr 0x1e0 /* HSMC global register */
441#define hsmc0_besr 0x1e1 /* bus error status register */
442#define hsmc0_bear 0x1e2 /* bus error address register */
443#define hsmc0_br0 0x1e4 /* SDRAM sub-ctrl bank reg 0 */
444#define hsmc0_cr0 0x1e5 /* SDRAM sub-ctrl ctrl reg 0 */
445#define hsmc0_br1 0x1e7 /* SDRAM sub-ctrl bank reg 1 */
446#define hsmc0_cr1 0x1e8 /* SDRAM sub-ctrl ctrl reg 1 */
447#define hsmc0_sysr 0x1f1 /* system register */
448#define hsmc0_data 0x1f2 /* data register */
449#define hsmc0_crr 0x1f3 /* refresh register */
450
451#define hsmc1_gr 0x1c0 /* HSMC global register */
452#define hsmc1_besr 0x1c1 /* bus error status register */
453#define hsmc1_bear 0x1c2 /* bus error address register */
454#define hsmc1_br0 0x1c4 /* SDRAM sub-ctrl bank reg 0 */
455#define hsmc1_cr0 0x1c5 /* SDRAM sub-ctrl ctrl reg 0 */
456#define hsmc1_br1 0x1c7 /* SDRAM sub-ctrl bank reg 1 */
457#define hsmc1_cr1 0x1c8 /* SDRAM sub-ctrl ctrl reg 1 */
458#define hsmc1_sysr 0x1d1 /* system register */
459#define hsmc1_data 0x1d2 /* data register */
460#define hsmc1_crr 0x1d3 /* refresh register */
461
462/*----------------------------------------------------------------------------+
463| Machine State Register bit definitions.
464+----------------------------------------------------------------------------*/
465#define msr_ape 0x00100000
466#define msr_apa 0x00080000
467#define msr_we 0x00040000
468#define msr_ce 0x00020000
469#define msr_ile 0x00010000
470#define msr_ee 0x00008000
471#define msr_pr 0x00004000
472#define msr_me 0x00001000
473#define msr_de 0x00000200
474#define msr_ir 0x00000020
475#define msr_dr 0x00000010
476#define msr_le 0x00000001
477
478/*----------------------------------------------------------------------------+
479| Used during interrupt processing.
480+----------------------------------------------------------------------------*/
481#define stack_reg_image_size 160
482
483/*----------------------------------------------------------------------------+
484| Function prolog definition and other Metaware (EABI) defines.
485+----------------------------------------------------------------------------*/
486#ifdef MW
487
488#define r0 0
489#define r1 1
490#define r2 2
491#define r3 3
492#define r4 4
493#define r5 5
494#define r6 6
495#define r7 7
496#define r8 8
497#define r9 9
498#define r10 10
499#define r11 11
500#define r12 12
501#define r13 13
502#define r14 14
503#define r15 15
504#define r16 16
505#define r17 17
506#define r18 18
507#define r19 19
508#define r20 20
509#define r21 21
510#define r22 22
511#define r23 23
512#define r24 24
513#define r25 25
514#define r26 26
515#define r27 27
516#define r28 28
517#define r29 29
518#define r30 30
519#define r31 31
520
521#define cr0 0
522#define cr1 1
523#define cr2 2
524#define cr3 3
525#define cr4 4
526#define cr5 5
527#define cr6 6
528#define cr7 7
529
530#define function_prolog(func_name) .text; \
531 .align 2; \
532 .globl func_name; \
533 func_name:
534#define function_epilog(func_name) .type func_name,@function; \
535 .size func_name,.-func_name
536
537#define function_call(func_name) bl func_name
538
539#define stack_frame_min 8
540#define stack_frame_bc 0
541#define stack_frame_lr 4
542#define stack_neg_off 0
543
544#endif
545
546/*----------------------------------------------------------------------------+
547| Function prolog definition and other DIAB (Elf) defines.
548+----------------------------------------------------------------------------*/
549#ifdef ELF_DIAB
550
551fprolog: macro f_name
552 .text
553 .align 2
554 .globl f_name
555f_name:
556 endm
557
558fepilog: macro f_name
559 .type f_name,@function
560 .size f_name,.-f_name
561 endm
562
563#define function_prolog(func_name) fprolog func_name
564#define function_epilog(func_name) fepilog func_name
565#define function_call(func_name) bl func_name
566
567#define stack_frame_min 8
568#define stack_frame_bc 0
569#define stack_frame_lr 4
570#define stack_neg_off 0
571
572#endif
573
574/*----------------------------------------------------------------------------+
575| Function prolog definition and other Xlc (XCOFF) defines.
576+----------------------------------------------------------------------------*/
577#ifdef XCOFF
578
579.machine "403ga"
580
581#define r0 0
582#define r1 1
583#define r2 2
584#define r3 3
585#define r4 4
586#define r5 5
587#define r6 6
588#define r7 7
589#define r8 8
590#define r9 9
591#define r10 10
592#define r11 11
593#define r12 12
594#define r13 13
595#define r14 14
596#define r15 15
597#define r16 16
598#define r17 17
599#define r18 18
600#define r19 19
601#define r20 20
602#define r21 21
603#define r22 22
604#define r23 23
605#define r24 24
606#define r25 25
607#define r26 26
608#define r27 27
609#define r28 28
610#define r29 29
611#define r30 30
612#define r31 31
613
614#define cr0 0
615#define cr1 1
616#define cr2 2
617#define cr3 3
618#define cr4 4
619#define cr5 5
620#define cr6 6
621#define cr7 7
622
623#define function_prolog(func_name) .csect .func_name[PR]; \
624 .globl .func_name[PR]; \
625 func_name:
626
627#define function_epilog(func_name) .toc; \
628 .csect func_name[DS]; \
629 .globl func_name[DS]; \
630 .long .func_name[PR]; \
631 .long TOC[tc0]
632
633#define function_call(func_name) .extern .func_name[PR]; \
634 stw r2,stack_frame_toc(r1); \
635 mfspr r2,sprg0; \
636 bl .func_name[PR]; \
637 lwz r2,stack_frame_toc(r1)
638
639#define stack_frame_min 56
640#define stack_frame_bc 0
641#define stack_frame_lr 8
642#define stack_frame_toc 20
643#define stack_neg_off 276
644
645#endif
646#define function_prolog(func_name) .text; \
647 .align 2; \
648 .globl func_name; \
649 func_name:
650#define function_epilog(func_name) .type func_name,@function; \
651 .size func_name,.-func_name
652
653#define function_call(func_name) bl func_name
654
655/*----------------------------------------------------------------------------+
656| Function prolog definition for GNU
657+----------------------------------------------------------------------------*/
658#ifdef _GNU_TOOL
659
660#define function_prolog(func_name) .globl func_name; \
661 func_name:
662#define function_epilog(func_name)
663
664#endif
diff --git a/arch/ppc/boot/simple/rw4/rw4_init.S b/arch/ppc/boot/simple/rw4/rw4_init.S
new file mode 100644
index 000000000000..b1061962e46b
--- /dev/null
+++ b/arch/ppc/boot/simple/rw4/rw4_init.S
@@ -0,0 +1,78 @@
1#define VESTA
2#include "ppc_40x.h"
3#
4 .align 2
5 .text
6#
7# added by linguohui
8 .extern initb_ebiu0, initb_config, hdw_init_finish
9 .extern initb_hsmc0, initb_hsmc1, initb_cache
10# end added
11 .globl HdwInit
12#
13HdwInit:
14#
15#-----------------------------------------------------------------------*
16# If we are not executing from the FLASH get out *
17#-----------------------------------------------------------------------*
18# SAW keep this or comment out a la Hawthorne?
19# r3 contains NIP when used with Linux
20# rlwinm r28, r3, 8, 24, 31 # if MSB == 0xFF -> FLASH address
21# cmpwi r28, 0xff
22# bne locn01
23#
24#
25#------------------------------------------------------------------------
26# Init_cpu. Bank registers are setup for the IBM STB.
27#------------------------------------------------------------------------
28#
29# Setup processor core clock to be driven off chip. This is GPI4 bit
30# twenty. Setup Open Drain, Output Select, Three-State Control, and
31# Three-State Select registers.
32#
33
34
35 pb0pesr = 0x054
36 pb0pear = 0x056
37
38 mflr r30
39
40#-----------------------------------------------------------------------------
41# Vectors will be at 0x1F000000
42# Dummy Machine check handler just does RFI before true handler gets installed
43#-----------------------------------------------------------------------------
44#if 1 /* xuwentao added*/
45#ifdef SDRAM16MB
46 lis r10,0x0000
47 addi r10,r10,0x0000
48#else
49 lis r10,0x1F00
50 addi r10,r10,0x0000
51#endif
52
53 mtspr evpr,r10 #EVPR: 0x0 or 0x1f000000 depending
54 isync # on SDRAM memory model used.
55
56 lis r10,0xFFFF # clear PB0_PESR because some
57 ori r10,r10,0xFFFF # transitions from flash,changed by linguohui
58 mtdcr pb0pesr,r10 # to load RAM image via RiscWatch
59 lis r10,0x0000 # cause PB0_PESR machine checks
60 mtdcr pb0pear,r10
61 addis r10,r10,0x0000 # clear the
62 mtxer r10 # XER just in case...
63#endif /* xuwentao*/
64
65 bl initb_ebiu0 # init EBIU
66
67 bl initb_config # config PPC and board
68
69
70
71
72#------------------------------------------------------------------------
73# EVPR setup moved to top of this function.
74#------------------------------------------------------------------------
75#
76 mtlr r30
77 blr
78 .end
diff --git a/arch/ppc/boot/simple/rw4/rw4_init_brd.S b/arch/ppc/boot/simple/rw4/rw4_init_brd.S
new file mode 100644
index 000000000000..386afdaad6c7
--- /dev/null
+++ b/arch/ppc/boot/simple/rw4/rw4_init_brd.S
@@ -0,0 +1,1125 @@
1/*----------------------------------------------------------------------------+
2| This source code has been made available to you by IBM on an AS-IS
3| basis. Anyone receiving this source is licensed under IBM
4| copyrights to use it in any way he or she deems fit, including
5| copying it, modifying it, compiling it, and redistributing it either
6| with or without modifications. No license under IBM patents or
7| patent applications is to be implied by the copyright license.
8|
9| Any user of this software should understand that IBM cannot provide
10| technical support for this software and will not be responsible for
11| any consequences resulting from the use of this software.
12|
13| Any person who transfers this source code or any derivative work
14| must include the IBM copyright notice, this paragraph, and the
15| preceding two paragraphs in the transferred software.
16|
17| COPYRIGHT I B M CORPORATION 1997
18| LICENSED MATERIAL - PROGRAM PROPERTY OF I B M
19+----------------------------------------------------------------------------*/
20/*----------------------------------------------------------------------------+
21| Author: Tony J. Cerreto
22| Component: BSPS
23| File: init_brd.s
24| Purpose: Vesta Evaluation Board initialization subroutines. The following
25| routines are available:
26| 1. INITB_EBIU0: Initialize EBIU0.
27| 2. INITB_CONFIG: Configure board.
28| 3. INITB_HSMC0: Initialize HSMC0 (SDRAM).
29| 4. INITB_HSMC1: Initialize HSMC1 (SDRAM).
30| 5. INITB_CACHE: Initialize Data and Instruction Cache.
31| 6. INITB_DCACHE: Initialize Data Cache.
32| 7. INITB_ICACHE: Initialize Instruction Cache.
33| 8. INITB_GET_CSPD: Get CPU Speed (Bus Speed and Processor Speed)
34|
35| Changes:
36| Date: Author Comment:
37| --------- ------ --------
38| 01-Mar-00 tjc Created
39| 04-Mar-00 jfh Modified CIC_SEL3_VAL to support 1284 (Mux3 & GPIO 21-28)
40| 04-Mar-00 jfh Modified XILINIX Reg 0 to support 1284 (Mux3 & GPIO 21-28)
41| 04-Mar-00 jfh Modified XILINIX Reg 1 to support 1284 (Mux3 & GPIO 21-28)
42| 04-Mar-00 jfh Modified XILINIX Reg 4 to support 1284 (Mux3 & GPIO 21-28)
43| 19-May-00 rlb Relcoated HSMC0 to 0x1F000000 to support 32MB of contiguous
44| SDRAM space. Changed cache ctl regs to reflect this.
45| 22-May-00 tjc Changed initb_get_cspd interface and eliminated
46| initb_get_bspd routines.
47| 26-May-00 tjc Added two nop instructions after all mtxxx/mfxxx
48| instructions due to PPC405 bug.
49+----------------------------------------------------------------------------*/
50#define VESTA
51#include "ppc_40x.h"
52#include "stb.h"
53
54/*----------------------------------------------------------------------------+
55| BOARD CONFIGURATION DEFINES
56+----------------------------------------------------------------------------*/
57#define CBS0_CR_VAL 0x00000002 /* CBS control reg value */
58#define CIC0_CR_VAL 0xD0800448 /* CIC control reg value */
59#define CIC0_SEL3_VAL 0x11500000 /* CIC select 3 reg value */
60#define CIC0_VCR_VAL 0x00631700 /* CIC video cntl reg value */
61
62/*----------------------------------------------------------------------------+
63| EBIU0 BANK REGISTERS DEFINES
64+----------------------------------------------------------------------------*/
65#define EBIU0_BRCRH0_VAL 0x00000000 /* BR High 0 (Extension Reg)*/
66#define EBIU0_BRCRH1_VAL 0x00000000 /* BR High 1 (Extension Reg)*/
67#define EBIU0_BRCRH2_VAL 0x40000000 /* BR High 2 (Extension Reg)*/
68#define EBIU0_BRCRH3_VAL 0x40000000 /* BR High 3 (Extension Reg)*/
69#define EBIU0_BRCRH4_VAL 0x00000000 /* BR High 4 (Extension Reg)*/
70#define EBIU0_BRCRH5_VAL 0x00000000 /* BR High 5 (Extension Reg)*/
71#define EBIU0_BRCRH6_VAL 0x00000000 /* BR High 6 (Extension Reg)*/
72#define EBIU0_BRCRH7_VAL 0x40000000 /* BR High 7 (Extension Reg)*/
73
74#define EBIU0_BRCR0_VAL 0xFC58BFFE /* BR 0: 16 bit Flash 4 MB */
75#define EBIU0_BRCR1_VAL 0xFF00BFFE /* BR 1: Ext Connector 1 MB */
76#if 1
77#define EBIU0_BRCR2_VAL 0x207CFFBE /* BR 2: Xilinx 8 MB */
78 /* twt == 0x3f */
79#else
80#define EBIU0_BRCR2_VAL 0x207CCFBE /* BR 2: Xilinx 8 MB */
81 /* twt == 0x0f */
82#endif
83#define EBIU0_BRCR3_VAL 0x407CBFBE /* BR 3: IDE Drive 8 MB */
84#define EBIU0_BRCR4_VAL 0xFF00BFFF /* BR 4: Disabled. 0 MB */
85#define EBIU0_BRCR5_VAL 0xFF00BFFF /* BR 5: Disabled. 0 MB */
86#define EBIU0_BRCR6_VAL 0xFF00BFFF /* BR 6: Disabled. 0 MB */
87#define EBIU0_BRCR7_VAL 0xCE3F0003 /* BR 7: Line Mode DMA 2 MB */
88
89/*----------------------------------------------------------------------------+
90| GPIO DEFINES
91+----------------------------------------------------------------------------*/
92#define STB_GPIO0_OUTPUT (STB_GPIO0_BASE_ADDRESS+ 0x00)
93#define STB_GPIO0_TC (STB_GPIO0_BASE_ADDRESS+ 0x04)
94#define STB_GPIO0_OS_0_31 (STB_GPIO0_BASE_ADDRESS+ 0x08)
95#define STB_GPIO0_OS_32_63 (STB_GPIO0_BASE_ADDRESS+ 0x0C)
96#define STB_GPIO0_TS_0_31 (STB_GPIO0_BASE_ADDRESS+ 0x10)
97#define STB_GPIO0_TS_32_63 (STB_GPIO0_BASE_ADDRESS+ 0x14)
98#define STB_GPIO0_OD (STB_GPIO0_BASE_ADDRESS+ 0x18)
99#define STB_GPIO0_INPUT (STB_GPIO0_BASE_ADDRESS+ 0x1C)
100#define STB_GPIO0_R1 (STB_GPIO0_BASE_ADDRESS+ 0x20)
101#define STB_GPIO0_R2 (STB_GPIO0_BASE_ADDRESS+ 0x24)
102#define STB_GPIO0_R3 (STB_GPIO0_BASE_ADDRESS+ 0x28)
103#define STB_GPIO0_IS_1_0_31 (STB_GPIO0_BASE_ADDRESS+ 0x30)
104#define STB_GPIO0_IS_1_32_63 (STB_GPIO0_BASE_ADDRESS+ 0x34)
105#define STB_GPIO0_IS_2_0_31 (STB_GPIO0_BASE_ADDRESS+ 0x38)
106#define STB_GPIO0_IS_2_32_63 (STB_GPIO0_BASE_ADDRESS+ 0x3C)
107#define STB_GPIO0_IS_3_0_31 (STB_GPIO0_BASE_ADDRESS+ 0x40)
108#define STB_GPIO0_IS_3_32_63 (STB_GPIO0_BASE_ADDRESS+ 0x44)
109#define STB_GPIO0_SS_1 (STB_GPIO0_BASE_ADDRESS+ 0x50)
110#define STB_GPIO0_SS_2 (STB_GPIO0_BASE_ADDRESS+ 0x54)
111#define STB_GPIO0_SS_3 (STB_GPIO0_BASE_ADDRESS+ 0x58)
112
113#define GPIO0_TC_VAL 0x0C020004 /* three-state control val */
114#define GPIO0_OS_0_31_VAL 0x51A00004 /* output select 0-31 val */
115#define GPIO0_OS_32_63_VAL 0x0000002F /* output select 32-63 val */
116#define GPIO0_TS_0_31_VAL 0x51A00000 /* three-state sel 0-31 val*/
117#define GPIO0_TS_32_63_VAL 0x0000000F /* three-state sel 32-63 val*/
118#define GPIO0_OD_VAL 0xC0000004 /* open drain val */
119#define GPIO0_IS_1_0_31_VAL 0x50000151 /* input select 1 0-31 val */
120#define GPIO0_IS_1_32_63_VAL 0x00000000 /* input select 1 32-63 val */
121#define GPIO0_IS_2_0_31_VAL 0x00000000 /* input select 2 0-31 val */
122#define GPIO0_IS_2_32_63_VAL 0x00000000 /* input select 2 32-63 val */
123#define GPIO0_IS_3_0_31_VAL 0x00000440 /* input select 3 0-31 val */
124#define GPIO0_IS_3_32_63_VAL 0x00000000 /* input select 3 32-63 val */
125#define GPIO0_SS_1_VAL 0x00000000 /* sync select 1 val */
126#define GPIO0_SS_2_VAL 0x00000000 /* sync select 2 val */
127#define GPIO0_SS_3_VAL 0x00000000 /* sync select 3 val */
128
129/*----------------------------------------------------------------------------+
130| XILINX DEFINES
131+----------------------------------------------------------------------------*/
132#define STB_XILINX_LED (STB_FPGA_BASE_ADDRESS+ 0x0100)
133#define STB_XILINX1_REG0 (STB_FPGA_BASE_ADDRESS+ 0x40000)
134#define STB_XILINX1_REG1 (STB_FPGA_BASE_ADDRESS+ 0x40002)
135#define STB_XILINX1_REG2 (STB_FPGA_BASE_ADDRESS+ 0x40004)
136#define STB_XILINX1_REG3 (STB_FPGA_BASE_ADDRESS+ 0x40006)
137#define STB_XILINX1_REG4 (STB_FPGA_BASE_ADDRESS+ 0x40008)
138#define STB_XILINX1_REG5 (STB_FPGA_BASE_ADDRESS+ 0x4000A)
139#define STB_XILINX1_REG6 (STB_FPGA_BASE_ADDRESS+ 0x4000C)
140#define STB_XILINX1_ID (STB_FPGA_BASE_ADDRESS+ 0x4000E)
141#define STB_XILINX1_FLUSH (STB_FPGA_BASE_ADDRESS+ 0x4000E)
142#define STB_XILINX2_REG0 (STB_FPGA_BASE_ADDRESS+ 0x80000)
143#define STB_XILINX2_REG1 (STB_FPGA_BASE_ADDRESS+ 0x80002)
144#define STB_XILINX2_REG2 (STB_FPGA_BASE_ADDRESS+ 0x80004)
145
146#define XILINX1_R0_VAL 0x2440 /* Xilinx 1 Register 0 Val */
147#define XILINX1_R1_VAL 0x0025 /* Xilinx 1 Register 1 Val */
148#define XILINX1_R2_VAL 0x0441 /* Xilinx 1 Register 2 Val */
149#define XILINX1_R3_VAL 0x0008 /* Xilinx 1 Register 3 Val */
150#define XILINX1_R4_VAL 0x0100 /* Xilinx 1 Register 4 Val */
151#define XILINX1_R5_VAL 0x6810 /* Xilinx 1 Register 5 Val */
152#define XILINX1_R6_VAL 0x0000 /* Xilinx 1 Register 6 Val */
153#if 0
154#define XILINX2_R0_VAL 0x0008 /* Xilinx 2 Register 0 Val */
155#define XILINX2_R1_VAL 0x0000 /* Xilinx 2 Register 1 Val */
156#else
157#define XILINX2_R0_VAL 0x0018 /* disable IBM IrDA RxD */
158#define XILINX2_R1_VAL 0x0008 /* enable SICC MAX chip */
159#endif
160#define XILINX2_R2_VAL 0x0000 /* Xilinx 2 Register 2 Val */
161
162/*----------------------------------------------------------------------------+
163| HSMC BANK REGISTERS DEFINES
164+----------------------------------------------------------------------------*/
165#ifdef SDRAM16MB
166#define HSMC0_BR0_VAL 0x000D2D55 /* 0x1F000000-007FFFFF R/W */
167#define HSMC0_BR1_VAL 0x008D2D55 /* 0x1F800000-1FFFFFFF R/W */
168#else
169#define HSMC0_BR0_VAL 0x1F0D2D55 /* 0x1F000000-007FFFFF R/W */
170#define HSMC0_BR1_VAL 0x1F8D2D55 /* 0x1F800000-1FFFFFFF R/W */
171#endif
172#define HSMC1_BR0_VAL 0xA00D2D55 /* 0xA0000000-A07FFFFF R/W */
173#define HSMC1_BR1_VAL 0xA08D2D55 /* 0xA0800000-A0FFFFFF R/W */
174
175/*----------------------------------------------------------------------------+
176| CACHE DEFINES
177+----------------------------------------------------------------------------*/
178#define DCACHE_NLINES 128 /* no. D-cache lines */
179#define DCACHE_NBYTES 32 /* no. bytes/ D-cache line */
180#define ICACHE_NLINES 256 /* no. I-cache lines */
181#define ICACHE_NBYTES 32 /* no. bytes/ I-cache line */
182#ifdef SDRAM16MB
183#define DCACHE_ENABLE 0x80000000 /* D-cache regions to enable*/
184#define ICACHE_ENABLE 0x80000001 /* I-cache regions to enable*/
185#else
186#define DCACHE_ENABLE 0x18000000 /* D-cache regions to enable*/
187#define ICACHE_ENABLE 0x18000001 /* I-cache regions to enable*/
188#endif
189
190/*----------------------------------------------------------------------------+
191| CPU CORE SPEED CALCULATION DEFINES
192+----------------------------------------------------------------------------*/
193#define GCS_LCNT 500000 /* CPU speed loop count */
194#define GCS_TROW_BYTES 8 /* no. bytes in table row */
195#define GCS_CTICK_TOL 100 /* allowable clock tick tol */
196#define GCS_NMULT 4 /* no. of core speed mults */
197
198 /*--------------------------------------------------------------------+
199 | No. 13.5Mhz
200 | Clock Ticks
201 | based on a
202 | loop count Bus
203 | of 100,000 Speed
204 +--------------------------------------------------------------------*/
205gcs_lookup_table:
206 .int 50000, 54000000 /* 54.0 Mhz */
207 .int 66667, 40500000 /* 40.5 Mhz */
208 .int 54545, 49500000 /* 49.5 Mhz */
209 .int 46154, 58500000 /* 58.5 Mhz */
210 .int 0, 0 /* end of table flag */
211
212
213/*****************************************************************************+
214| XXXXXXX XXX XXX XXXXXX XXXXXXX XXXXXX XX XX XX XXXX
215| XX X XX XX X XX X XX X XX XX XXX XX XXXX XX
216| XX X XXX XX XX X XX XX XXXX XX XX XX XX
217| XXXX X XX XXXX XXXXX XX XXXX XX XX XX
218| XX X XXX XX XX X XX XX XX XXX XXXXXX XX
219| XX X XX XX XX XX X XX XX XX XX XX XX XX XX
220| XXXXXXX XXX XXX XXXX XXXXXXX XXX XX XX XX XX XX XXXXXXX
221+*****************************************************************************/
222/******************************************************************************
223|
224| Routine: INITB_EBIU0.
225|
226| Purpose: Initialize all the EBIU0 Bank Registers
227| Parameters: None.
228| Returns: None.
229|
230******************************************************************************/
231 function_prolog(initb_ebiu0)
232 /*--------------------------------------------------------------------+
233 | Set EBIU0 Bank 0
234 +--------------------------------------------------------------------*/
235 lis r10,EBIU0_BRCR0_VAL@h
236 ori r10,r10,EBIU0_BRCR0_VAL@l
237 mtdcr ebiu0_brcr0,r10
238 lis r10,EBIU0_BRCRH0_VAL@h
239 ori r10,r10,EBIU0_BRCRH0_VAL@l
240 mtdcr ebiu0_brcrh0,r10
241
242 /*--------------------------------------------------------------------+
243 | Set EBIU0 Bank 1
244 +--------------------------------------------------------------------*/
245 lis r10,EBIU0_BRCR1_VAL@h
246 ori r10,r10,EBIU0_BRCR1_VAL@l
247 mtdcr ebiu0_brcr1,r10
248 lis r10,EBIU0_BRCRH1_VAL@h
249 ori r10,r10,EBIU0_BRCRH1_VAL@l
250 mtdcr ebiu0_brcrh1,r10
251
252 /*--------------------------------------------------------------------+
253 | Set EBIU0 Bank 2
254 +--------------------------------------------------------------------*/
255 lis r10,EBIU0_BRCR2_VAL@h
256 ori r10,r10,EBIU0_BRCR2_VAL@l
257 mtdcr ebiu0_brcr2,r10
258 lis r10,EBIU0_BRCRH2_VAL@h
259 ori r10,r10,EBIU0_BRCRH2_VAL@l
260 mtdcr ebiu0_brcrh2,r10
261
262 /*--------------------------------------------------------------------+
263 | Set EBIU0 Bank 3
264 +--------------------------------------------------------------------*/
265 lis r10,EBIU0_BRCR3_VAL@h
266 ori r10,r10,EBIU0_BRCR3_VAL@l
267 mtdcr ebiu0_brcr3,r10
268 lis r10,EBIU0_BRCRH3_VAL@h
269 ori r10,r10,EBIU0_BRCRH3_VAL@l
270 mtdcr ebiu0_brcrh3,r10
271
272 /*--------------------------------------------------------------------+
273 | Set EBIU0 Bank 4
274 +--------------------------------------------------------------------*/
275 lis r10,EBIU0_BRCR4_VAL@h
276 ori r10,r10,EBIU0_BRCR4_VAL@l
277 mtdcr ebiu0_brcr4,r10
278 lis r10,EBIU0_BRCRH4_VAL@h
279 ori r10,r10,EBIU0_BRCRH4_VAL@l
280 mtdcr ebiu0_brcrh4,r10
281
282 /*--------------------------------------------------------------------+
283 | Set EBIU0 Bank 5
284 +--------------------------------------------------------------------*/
285 lis r10,EBIU0_BRCR5_VAL@h
286 ori r10,r10,EBIU0_BRCR5_VAL@l
287 mtdcr ebiu0_brcr5,r10
288 lis r10,EBIU0_BRCRH5_VAL@h
289 ori r10,r10,EBIU0_BRCRH5_VAL@l
290 mtdcr ebiu0_brcrh5,r10
291
292 /*--------------------------------------------------------------------+
293 | Set EBIU0 Bank 6
294 +--------------------------------------------------------------------*/
295 lis r10,EBIU0_BRCR6_VAL@h
296 ori r10,r10,EBIU0_BRCR6_VAL@l
297 mtdcr ebiu0_brcr6,r10
298 lis r10,EBIU0_BRCRH6_VAL@h
299 ori r10,r10,EBIU0_BRCRH6_VAL@l
300 mtdcr ebiu0_brcrh6,r10
301
302 /*--------------------------------------------------------------------+
303 | Set EBIU0 Bank 7
304 +--------------------------------------------------------------------*/
305 lis r10,EBIU0_BRCR7_VAL@h
306 ori r10,r10,EBIU0_BRCR7_VAL@l
307 mtdcr ebiu0_brcr7,r10
308 lis r10,EBIU0_BRCRH7_VAL@h
309 ori r10,r10,EBIU0_BRCRH7_VAL@l
310 mtdcr ebiu0_brcrh7,r10
311
312 blr
313 function_epilog(initb_ebiu0)
314
315
316/******************************************************************************
317|
318| Routine: INITB_CONFIG
319|
320| Purpose: Configure the Vesta Evaluation Board. The following items
321| will be configured:
322| 1. Cross-Bar Switch.
323| 2. Chip Interconnect.
324| 3. Clear/reset key PPC registers.
325| 4. Xilinx and GPIO Registers.
326|
327| Returns: None.
328|
329******************************************************************************/
330 function_prolog(initb_config)
331 /*--------------------------------------------------------------------+
332 | Init CROSS-BAR SWITCH
333 +--------------------------------------------------------------------*/
334 lis r10,CBS0_CR_VAL@h /* r10 <- CBS Cntl Reg val */
335 ori r10,r10,CBS0_CR_VAL@l
336 mtdcr cbs0_cr,r10
337
338 /*--------------------------------------------------------------------+
339 | Init Chip-Interconnect (CIC) Registers
340 +--------------------------------------------------------------------*/
341 lis r10,CIC0_CR_VAL@h /* r10 <- CIC Cntl Reg val */
342 ori r10,r10,CIC0_CR_VAL@l
343 mtdcr cic0_cr,r10
344
345 lis r10,CIC0_SEL3_VAL@h /* r10 <- CIC SEL3 Reg val */
346 ori r10,r10,CIC0_SEL3_VAL@l
347 mtdcr cic0_sel3,r10
348
349 lis r10,CIC0_VCR_VAL@h /* r10 <- CIC Vid C-Reg val */
350 ori r10,r10,CIC0_VCR_VAL@l
351 mtdcr cic0_vcr,r10
352
353 /*--------------------------------------------------------------------+
354 | Clear SGR and DCWR
355 +--------------------------------------------------------------------*/
356 li r10,0x0000
357 mtspr sgr,r10
358 mtspr dcwr,r10
359
360 /*--------------------------------------------------------------------+
361 | Clear/set up some machine state registers.
362 +--------------------------------------------------------------------*/
363 li r10,0x0000 /* r10 <- 0 */
364 mtdcr ebiu0_besr,r10 /* clr Bus Err Syndrome Reg */
365 mtspr esr,r10 /* clr Exceptn Syndrome Reg */
366 mttcr r10 /* timer control register */
367
368 mtdcr uic0_er,r10 /* disable all interrupts */
369
370 /* UIC_IIC0 | UIC_IIC1 | UIC_U0 | UIC_IR_RCV | UIC_IR_XMIT */
371 lis r10, 0x00600e00@h
372 ori r10,r10,0x00600e00@l
373 mtdcr uic0_pr,r10
374
375 li r10,0x00000020 /* UIC_EIR1 */
376 mtdcr uic0_tr,r10
377
378 lis r10,0xFFFF /* r10 <- 0xFFFFFFFF */
379 ori r10,r10,0xFFFF /* */
380 mtdbsr r10 /* clear/reset the dbsr */
381 mtdcr uic0_sr,r10 /* clear pending interrupts */
382
383 li r10,0x1000 /* set Machine Exception bit*/
384 oris r10,r10,0x2 /* set Criticl Exception bit*/
385 mtmsr r10 /* change MSR */
386
387 /*--------------------------------------------------------------------+
388 | Clear XER.
389 +--------------------------------------------------------------------*/
390 li r10,0x0000
391 mtxer r10
392
393 /*--------------------------------------------------------------------+
394 | Init GPIO0 Registers
395 +--------------------------------------------------------------------*/
396 lis r10, STB_GPIO0_TC@h /* Three-state control */
397 ori r10,r10,STB_GPIO0_TC@l
398 lis r11, GPIO0_TC_VAL@h
399 ori r11,r11,GPIO0_TC_VAL@l
400 stw r11,0(r10)
401
402 lis r10, STB_GPIO0_OS_0_31@h /* output select 0-31 */
403 ori r10,r10,STB_GPIO0_OS_0_31@l
404 lis r11, GPIO0_OS_0_31_VAL@h
405 ori r11,r11,GPIO0_OS_0_31_VAL@l
406 stw r11,0(r10)
407
408 lis r10, STB_GPIO0_OS_32_63@h /* output select 32-63 */
409 ori r10,r10,STB_GPIO0_OS_32_63@l
410 lis r11, GPIO0_OS_32_63_VAL@h
411 ori r11,r11,GPIO0_OS_32_63_VAL@l
412 stw r11,0(r10)
413
414 lis r10, STB_GPIO0_TS_0_31@h /* three-state select 0-31 */
415 ori r10,r10,STB_GPIO0_TS_0_31@l
416 lis r11, GPIO0_TS_0_31_VAL@h
417 ori r11,r11,GPIO0_TS_0_31_VAL@l
418 stw r11,0(r10)
419
420 lis r10, STB_GPIO0_TS_32_63@h /* three-state select 32-63 */
421 ori r10,r10,STB_GPIO0_TS_32_63@l
422 lis r11, GPIO0_TS_32_63_VAL@h
423 ori r11,r11,GPIO0_TS_32_63_VAL@l
424 stw r11,0(r10)
425
426 lis r10, STB_GPIO0_OD@h /* open drain */
427 ori r10,r10,STB_GPIO0_OD@l
428 lis r11, GPIO0_OD_VAL@h
429 ori r11,r11,GPIO0_OD_VAL@l
430 stw r11,0(r10)
431
432 lis r10, STB_GPIO0_IS_1_0_31@h /* input select 1, 0-31 */
433 ori r10,r10,STB_GPIO0_IS_1_0_31@l
434 lis r11, GPIO0_IS_1_0_31_VAL@h
435 ori r11,r11,GPIO0_IS_1_0_31_VAL@l
436 stw r11,0(r10)
437
438 lis r10, STB_GPIO0_IS_1_32_63@h /* input select 1, 32-63 */
439 ori r10,r10,STB_GPIO0_IS_1_32_63@l
440 lis r11, GPIO0_IS_1_32_63_VAL@h
441 ori r11,r11,GPIO0_IS_1_32_63_VAL@l
442 stw r11,0(r10)
443
444 lis r10, STB_GPIO0_IS_2_0_31@h /* input select 2, 0-31 */
445 ori r10,r10,STB_GPIO0_IS_2_0_31@l
446 lis r11, GPIO0_IS_2_0_31_VAL@h
447 ori r11,r11,GPIO0_IS_2_0_31_VAL@l
448 stw r11,0(r10)
449
450 lis r10, STB_GPIO0_IS_2_32_63@h /* input select 2, 32-63 */
451 ori r10,r10,STB_GPIO0_IS_2_32_63@l
452 lis r11, GPIO0_IS_2_32_63_VAL@h
453 ori r11,r11,GPIO0_IS_2_32_63_VAL@l
454 stw r11,0(r10)
455
456 lis r10, STB_GPIO0_IS_3_0_31@h /* input select 3, 0-31 */
457 ori r10,r10,STB_GPIO0_IS_3_0_31@l
458 lis r11, GPIO0_IS_3_0_31_VAL@h
459 ori r11,r11,GPIO0_IS_3_0_31_VAL@l
460 stw r11,0(r10)
461
462 lis r10, STB_GPIO0_IS_3_32_63@h /* input select 3, 32-63 */
463 ori r10,r10,STB_GPIO0_IS_3_32_63@l
464 lis r11, GPIO0_IS_3_32_63_VAL@h
465 ori r11,r11,GPIO0_IS_3_32_63_VAL@l
466 stw r11,0(r10)
467
468 lis r10, STB_GPIO0_SS_1@h /* sync select 1 */
469 ori r10,r10,STB_GPIO0_SS_1@l
470 lis r11, GPIO0_SS_1_VAL@h
471 ori r11,r11,GPIO0_SS_1_VAL@l
472 stw r11,0(r10)
473
474 lis r10, STB_GPIO0_SS_2@h /* sync select 2 */
475 ori r10,r10,STB_GPIO0_SS_2@l
476 lis r11, GPIO0_SS_2_VAL@h
477 ori r11,r11,GPIO0_SS_2_VAL@l
478 stw r11,0(r10)
479
480 lis r10, STB_GPIO0_SS_3@h /* sync select 3 */
481 ori r10,r10,STB_GPIO0_SS_3@l
482 lis r11, GPIO0_SS_3_VAL@h
483 ori r11,r11,GPIO0_SS_3_VAL@l
484 stw r11,0(r10)
485
486 /*--------------------------------------------------------------------+
487 | Init Xilinx #1 Registers
488 +--------------------------------------------------------------------*/
489 lis r10, STB_XILINX1_REG0@h /* init Xilinx1 Reg 0 */
490 ori r10,r10,STB_XILINX1_REG0@l
491 li r11,XILINX1_R0_VAL
492 sth r11,0(r10)
493
494 lis r10, STB_XILINX1_REG1@h /* init Xilinx1 Reg 1 */
495 ori r10,r10,STB_XILINX1_REG1@l
496 li r11,XILINX1_R1_VAL
497 sth r11,0(r10)
498
499 lis r10, STB_XILINX1_REG2@h /* init Xilinx1 Reg 2 */
500 ori r10,r10,STB_XILINX1_REG2@l
501 li r11,XILINX1_R2_VAL
502 sth r11,0(r10)
503
504 lis r10, STB_XILINX1_REG3@h /* init Xilinx1 Reg 3 */
505 ori r10,r10,STB_XILINX1_REG3@l
506 li r11,XILINX1_R3_VAL
507 sth r11,0(r10)
508
509 lis r10, STB_XILINX1_REG4@h /* init Xilinx1 Reg 4 */
510 ori r10,r10,STB_XILINX1_REG4@l
511 li r11,XILINX1_R4_VAL
512 sth r11,0(r10)
513
514 lis r10, STB_XILINX1_REG5@h /* init Xilinx1 Reg 5 */
515 ori r10,r10,STB_XILINX1_REG5@l
516 li r11,XILINX1_R5_VAL
517 sth r11,0(r10)
518
519 lis r10, STB_XILINX1_REG6@h /* init Xilinx1 Reg 6 */
520 ori r10,r10,STB_XILINX1_REG6@l
521 li r11,XILINX1_R6_VAL
522 sth r11,0(r10)
523
524 lis r10, STB_XILINX1_FLUSH@h /* latch registers in Xilinx*/
525 ori r10,r10,STB_XILINX1_FLUSH@l
526 li r11,0x0000
527 sth r11,0(r10)
528
529 /*--------------------------------------------------------------------+
530 | Init Xilinx #2 Registers
531 +--------------------------------------------------------------------*/
532 lis r10, STB_XILINX2_REG0@h /* init Xilinx2 Reg 0 */
533 ori r10,r10,STB_XILINX2_REG0@l
534 li r11,XILINX2_R0_VAL
535 sth r11,0(r10)
536
537 lis r10, STB_XILINX2_REG1@h /* init Xilinx2 Reg 1 */
538 ori r10,r10,STB_XILINX2_REG1@l
539 li r11,XILINX2_R1_VAL
540 sth r11,0(r10)
541
542 lis r10, STB_XILINX2_REG2@h /* init Xilinx2 Reg 2 */
543 ori r10,r10,STB_XILINX2_REG2@l
544 li r11,XILINX2_R2_VAL
545 sth r11,0(r10)
546
547 blr
548 function_epilog(initb_config)
549
550
551/******************************************************************************
552|
553| Routine: INITB_HSMC0.
554|
555| Purpose: Initialize the HSMC0 Registers for SDRAM
556| Parameters: None.
557| Returns: R3 = 0: Successful
558| = -1: Unsuccessful, SDRAM did not reset properly.
559|
560******************************************************************************/
561 function_prolog(initb_hsmc0)
562 mflr r0 /* Save return addr */
563
564 /*--------------------------------------------------------------------+
565 | Set Global SDRAM Controller to recommended default
566 +--------------------------------------------------------------------*/
567 lis r10,0x6C00
568 ori r10,r10,0x0000
569 mtdcr hsmc0_gr,r10
570
571 /*--------------------------------------------------------------------+
572 | Set HSMC0 Data Register to recommended default
573 +--------------------------------------------------------------------*/
574 lis r10,0x0037
575 ori r10,r10,0x0000
576 mtdcr hsmc0_data,r10
577
578 /*--------------------------------------------------------------------+
579 | Init HSMC0 Bank Register 0
580 +--------------------------------------------------------------------*/
581 lis r10,HSMC0_BR0_VAL@h
582 ori r10,r10,HSMC0_BR0_VAL@l
583 mtdcr hsmc0_br0,r10
584
585 /*--------------------------------------------------------------------+
586 | Init HSMC0 Bank Register 1
587 +--------------------------------------------------------------------*/
588 lis r10,HSMC0_BR1_VAL@h
589 ori r10,r10,HSMC0_BR1_VAL@l
590 mtdcr hsmc0_br1,r10
591
592 /*--------------------------------------------------------------------+
593 | Set HSMC0 Control Reg 0
594 +--------------------------------------------------------------------*/
595 lis r10,0x8077 /* PRECHARGE ALL DEVICE BKS */
596 ori r10,r10,0x0000
597 mtdcr hsmc0_cr0,r10
598 li r3,0x0000
599 bl hsmc_cr_wait /* wait for op completion */
600 cmpwi cr0,r3,0x0000
601 bne cr0,hsmc0_err
602
603 lis r10,0x8078 /* AUTO-REFRESH */
604 ori r10,r10,0x0000
605 mtdcr hsmc0_cr0,r10
606 li r3,0x0000
607 bl hsmc_cr_wait /* wait for op completion */
608 cmpwi cr0,r3,0x0000
609 bne cr0,hsmc0_err
610
611 lis r10,0x8070 /* PROG MODE W/DATA REG VAL */
612 ori r10,r10,0x8000
613 mtdcr hsmc0_cr0,r10
614 li r3,0x0000
615 bl hsmc_cr_wait /* wait for op completion */
616 cmpwi cr0,r3,0x0000
617 bne hsmc0_err
618
619 /*--------------------------------------------------------------------+
620 | Set HSMC0 Control Reg 1
621 +--------------------------------------------------------------------*/
622 lis r10,0x8077 /* PRECHARGE ALL DEVICE BKS */
623 ori r10,r10,0x0000
624 mtdcr hsmc0_cr1,r10
625 li r3,0x0001
626 bl hsmc_cr_wait /* wait for op completion */
627 cmpwi cr0,r3,0x0000
628 bne cr0,hsmc0_err
629
630 lis r10,0x8078 /* AUTO-REFRESH */
631 ori r10,r10,0x0000
632 mtdcr hsmc0_cr1,r10
633 li r3,0x0001
634 bl hsmc_cr_wait /* wait for op completion */
635 cmpwi cr0,r3,0x0000
636 bne cr0,hsmc0_err
637
638 lis r10,0x8070 /* PROG MODE W/DATA REG VAL */
639 ori r10,r10,0x8000
640 mtdcr hsmc0_cr1,r10
641 li r3,0x0001
642 bl hsmc_cr_wait /* wait for op completion */
643 cmpwi cr0,r3,0x0000
644 bne cr0,hsmc0_err
645
646 /*--------------------------------------------------------------------+
647 | Set HSMC0 Refresh Register
648 +--------------------------------------------------------------------*/
649 lis r10,0x0FE1
650 ori r10,r10,0x0000
651 mtdcr hsmc0_crr,r10
652 li r3,0
653
654hsmc0_err:
655 mtlr r0
656 blr
657 function_epilog(initb_hsmc0)
658
659
660/******************************************************************************
661|
662| Routine: INITB_HSMC1.
663|
664| Purpose: Initialize the HSMC1 Registers for SDRAM
665| Parameters: None.
666| Returns: R3 = 0: Successful
667| = -1: Unsuccessful, SDRAM did not reset properly.
668|
669******************************************************************************/
670 function_prolog(initb_hsmc1)
671 mflr r0 /* Save return addr */
672
673 /*--------------------------------------------------------------------+
674 | Set Global SDRAM Controller to recommended default
675 +--------------------------------------------------------------------*/
676 lis r10,0x6C00
677 ori r10,r10,0x0000
678 mtdcr hsmc1_gr,r10
679
680 /*--------------------------------------------------------------------+
681 | Set HSMC1 Data Register to recommended default
682 +--------------------------------------------------------------------*/
683 lis r10,0x0037
684 ori r10,r10,0x0000
685 mtdcr hsmc1_data,r10
686
687 /*--------------------------------------------------------------------+
688 | Init HSMC1 Bank Register 0
689 +--------------------------------------------------------------------*/
690 lis r10,HSMC1_BR0_VAL@h
691 ori r10,r10,HSMC1_BR0_VAL@l
692 mtdcr hsmc1_br0,r10
693
694 /*--------------------------------------------------------------------+
695 | Init HSMC1 Bank Register 1
696 +--------------------------------------------------------------------*/
697 lis r10,HSMC1_BR1_VAL@h
698 ori r10,r10,HSMC1_BR1_VAL@l
699 mtdcr hsmc1_br1,r10
700
701 /*--------------------------------------------------------------------+
702 | Set HSMC1 Control Reg 0
703 +--------------------------------------------------------------------*/
704 lis r10,0x8077 /* PRECHARGE ALL DEVICE BANKS */
705 ori r10,r10,0x0000
706 mtdcr hsmc1_cr0,r10
707 li r3,0x0002
708 bl hsmc_cr_wait /* wait for operation completion */
709 cmpwi cr0,r3,0x0000
710 bne hsmc1_err
711
712 lis r10,0x8078 /* AUTO-REFRESH */
713 ori r10,r10,0x0000
714 mtdcr hsmc1_cr0,r10
715 li r3,0x0002
716 bl hsmc_cr_wait /* wait for operation completion */
717 cmpwi cr0,r3,0x0000
718 bne hsmc1_err
719
720 lis r10,0x8070 /* PROGRAM MODE W/DATA REG VALUE */
721 ori r10,r10,0x8000
722 mtdcr hsmc1_cr0,r10
723 li r3,0x0002
724 bl hsmc_cr_wait /* wait for operation completion */
725 cmpwi cr0,r3,0x0000
726 bne hsmc1_err
727
728 /*--------------------------------------------------------------------+
729 | Set HSMC1 Control Reg 1
730 +--------------------------------------------------------------------*/
731 lis r10,0x8077 /* PRECHARGE ALL DEVICE BKS */
732 ori r10,r10,0x0000
733 mtdcr hsmc1_cr1,r10
734 li r3,0x0003
735 bl hsmc_cr_wait /* wait for op completion */
736 cmpwi cr0,r3,0x0000
737 bne hsmc1_err
738
739 lis r10,0x8078 /* AUTO-REFRESH */
740 ori r10,r10,0x0000
741 mtdcr hsmc1_cr1,r10
742 li r3,0x0003
743 bl hsmc_cr_wait /* wait for op completion */
744 cmpwi cr0,r3,0x0000
745 bne hsmc1_err
746
747 lis r10,0x8070 /* PROG MODE W/DATA REG VAL */
748 ori r10,r10,0x8000
749 mtdcr hsmc1_cr1,r10
750 li r3,0x0003
751 bl hsmc_cr_wait /* wait for op completion */
752 cmpwi cr0,r3,0x0000
753 bne hsmc1_err
754
755 /*--------------------------------------------------------------------+
756 | Set HSMC1 Refresh Register
757 +--------------------------------------------------------------------*/
758 lis r10,0x0FE1
759 ori r10,r10,0x0000
760 mtdcr hsmc1_crr,r10
761 xor r3,r3,r3
762
763hsmc1_err:
764 mtlr r0
765 blr
766 function_epilog(initb_hsmc1)
767
768
769/******************************************************************************
770|
771| Routine: INITB_CACHE
772|
773| Purpose: This routine will enable Data and Instruction Cache.
774| The Data Cache is an 8K two-way set associative and the
775| Instruction Cache is an 16K two-way set associative cache.
776|
777| Parameters: None.
778|
779| Returns: None.
780|
781******************************************************************************/
782 function_prolog(initb_cache)
783 mflr r0 /* Save return addr */
784
785 bl initb_Dcache /* enable D-Cache */
786 bl initb_Icache /* enable I-Cache */
787
788 mtlr r0
789 blr
790 function_epilog(initb_cache)
791
792
793/******************************************************************************
794|
795| Routine: INITB_DCACHE
796|
797| Purpose: This routine will invalidate all data in the Data Cache and
798| then enable D-Cache. If cache is enabled already, the D-Cache
799| will be flushed before the data is invalidated.
800|
801| Parameters: None.
802|
803| Returns: None.
804|
805******************************************************************************/
806 function_prolog(initb_Dcache)
807 /*--------------------------------------------------------------------+
808 | Flush Data Cache if enabled
809 +--------------------------------------------------------------------*/
810 mfdccr r10 /* r10 <- DCCR */
811 isync /* ensure prev insts done */
812 cmpwi r10,0x00
813 beq ic_dcinv /* D-cache off, invalidate */
814
815 /*--------------------------------------------------------------------+
816 | Data Cache enabled, force known memory addresses to be Cached
817 +--------------------------------------------------------------------*/
818 lis r10,HSMC0_BR0_VAL@h /* r10 <- first memory loc */
819 andis. r10,r10,0xFFF0
820 li r11,DCACHE_NLINES /* r11 <- # A-way addresses */
821 addi r11,r11,DCACHE_NLINES /* r11 <- # B-way addresses */
822 mtctr r11 /* set loop counter */
823
824ic_dcload:
825 lwz r12,0(r10) /* force cache of address */
826 addi r10,r10,DCACHE_NBYTES /* r10 <- next memory loc */
827 bdnz ic_dcload
828 sync /* ensure prev insts done */
829 isync
830
831 /*--------------------------------------------------------------------+
832 | Flush the known memory addresses from Cache
833 +--------------------------------------------------------------------*/
834 lis r10,HSMC0_BR0_VAL@h /* r10 <- first memory loc */
835 andis. r10,r10,0xFFF0
836 mtctr r11 /* set loop counter */
837
838ic_dcflush:
839 dcbf 0,r10 /* flush D-cache line */
840 addi r10,r10,DCACHE_NBYTES /* r10 <- next memory loc */
841 bdnz ic_dcflush
842 sync /* ensure prev insts done */
843 isync
844
845 /*--------------------------------------------------------------------+
846 | Disable then invalidate Data Cache
847 +--------------------------------------------------------------------*/
848 li r10,0 /* r10 <- 0 */
849 mtdccr r10 /* disable the D-Cache */
850 isync /* ensure prev insts done */
851
852ic_dcinv:
853 li r10,0 /* r10 <- line address */
854 li r11,DCACHE_NLINES /* r11 <- # lines in cache */
855 mtctr r11 /* set loop counter */
856
857ic_dcloop:
858 dccci 0,r10 /* invalidate A/B cache lns */
859 addi r10,r10,DCACHE_NBYTES /* bump to next line */
860 bdnz ic_dcloop
861 sync /* ensure prev insts done */
862 isync
863
864 /*--------------------------------------------------------------------+
865 | Enable Data Cache
866 +--------------------------------------------------------------------*/
867 lis r10,DCACHE_ENABLE@h /* r10 <- D-cache enable msk*/
868 ori r10,r10,DCACHE_ENABLE@l
869 mtdccr r10
870 sync /* ensure prev insts done */
871 isync
872
873 blr
874 function_epilog(initb_Dcache)
875
876
877/******************************************************************************
878|
879| Routine: INITB_ICACHE
880|
881| Purpose: This routine will invalidate all data in the Instruction
882| Cache then enable I-Cache.
883|
884| Parameters: None.
885|
886| Returns: None.
887|
888******************************************************************************/
889 function_prolog(initb_Icache)
890 /*--------------------------------------------------------------------+
891 | Invalidate Instruction Cache
892 +--------------------------------------------------------------------*/
893 li r10,0 /* r10 <- lines address */
894 iccci 0,r10 /* invalidate all I-cache */
895 sync /* ensure prev insts done */
896 isync
897
898 /*--------------------------------------------------------------------+
899 | Enable Instruction Cache
900 +--------------------------------------------------------------------*/
901 lis r10,ICACHE_ENABLE@h /* r10 <- I-cache enable msk*/
902 ori r10,r10,ICACHE_ENABLE@l
903 mticcr r10
904 sync /* ensure prev insts done */
905 isync
906
907 blr
908 function_epilog(initb_Icache)
909
910#if 0
911/******************************************************************************
912|
913| Routine: INITB_GET_CSPD
914|
915| Purpose: Determine the CPU Core Speed. The 13.5 Mhz Time Base
916| Counter (TBC) is used to measure a conditional branch
917| instruction.
918|
919| Parameters: R3 = Address of Bus Speed
920| R4 = Address of Core Speed
921|
922| Returns: (R3) = >0: Bus Speed.
923| 0: Bus Speed not found in Look-Up Table.
924| (R4) = >0: Core Speed.
925| 0: Core Speed not found in Look-Up Table.
926|
927| Note: 1. This routine assumes the bdnz branch instruction takes
928| two instruction cycles to complete.
929| 2. This routine must be called before interrupts are enabled.
930|
931******************************************************************************/
932 function_prolog(initb_get_cspd)
933 mflr r0 /* Save return address */
934 /*--------------------------------------------------------------------+
935 | Set-up timed loop
936 +--------------------------------------------------------------------*/
937 lis r9,gcs_time_loop@h /* r9 <- addr loop instr */
938 ori r9,r9,gcs_time_loop@l
939 lis r10,GCS_LCNT@h /* r10 <- loop count */
940 ori r10,r10,GCS_LCNT@l
941 mtctr r10 /* ctr <- loop count */
942 lis r11,STB_TIMERS_TBC@h /* r11 <- TBC register addr */
943 ori r11,r11,STB_TIMERS_TBC@l
944 li r12,0 /* r12 <- 0 */
945
946 /*--------------------------------------------------------------------+
947 | Cache timed-loop instruction
948 +--------------------------------------------------------------------*/
949 icbt 0,r9
950 sync
951 isync
952
953 /*--------------------------------------------------------------------+
954 | Get number of 13.5 Mhz cycles to execute time-loop
955 +--------------------------------------------------------------------*/
956 stw r12,0(r11) /* reset TBC */
957gcs_time_loop:
958 bdnz+ gcs_time_loop /* force branch pred taken */
959 lwz r5,0(r11) /* r5 <- num 13.5 Mhz ticks */
960 li r6,5 /* LUT based on 1/5th the...*/
961 divw r5,r5,r6 /*..loop count used */
962 sync
963 isync
964
965 /*--------------------------------------------------------------------+
966 | Look-up core speed based on TBC value
967 +--------------------------------------------------------------------*/
968 lis r6,gcs_lookup_table@h /* r6 <- pts at core spd LUT*/
969 ori r6,r6,gcs_lookup_table@l
970 bl gcs_cspd_lookup /* find core speed in LUT */
971
972 mtlr r0 /* set return address */
973 blr
974 function_epilog(initb_get_cspd)
975
976#endif
977/*****************************************************************************+
978| XXXX XX XX XXXXXX XXXXXXX XXXXXX XX XX XX XXXX
979| XX XXX XX X XX X XX X XX XX XXX XX XXXX XX
980| XX XXXX XX XX XX X XX XX XXXX XX XX XX XX
981| XX XX XXXX XX XXXX XXXXX XX XXXX XX XX XX
982| XX XX XXX XX XX X XX XX XX XXX XXXXXX XX
983| XX XX XX XX XX X XX XX XX XX XX XX XX XX
984| XXXX XX XX XXXX XXXXXXX XXX XX XX XX XX XX XXXXXXX
985+*****************************************************************************/
986/******************************************************************************
987|
988| Routine: HSMC_CR_WAIT
989|
990| Purpose: Wait for the HSMC Control Register (bits 12-16) to be reset
991| after an auto-refresh, pre-charge or program mode register
992| command execution.
993|
994| Parameters: R3 = HSMC Control Register ID.
995| 0: HSMC0 CR0
996| 1: HSMC0 CR1
997| 2: HSMC1 CR0
998| 3: HSMC1 CR1
999|
1000| Returns: R3 = 0: Successful
1001| -1: Unsuccessful
1002|
1003******************************************************************************/
1004hsmc_cr_wait:
1005
1006 li r11,10 /* r11 <- retry counter */
1007 mtctr r11 /* set retry counter */
1008 mr r11,r3 /* r11 <- HSMC CR reg id */
1009
1010hsmc_cr_rep:
1011 bdz hsmc_cr_err /* branch if max retries hit*/
1012
1013 /*--------------------------------------------------------------------+
1014 | GET HSMCx_CRx value based on HSMC Control Register ID
1015 +--------------------------------------------------------------------*/
1016try_hsmc0_cr0: /* CHECK IF ID=HSMC0 CR0 REG*/
1017 cmpwi cr0,r11,0x0000
1018 bne cr0,try_hsmc0_cr1
1019 mfdcr r10,hsmc0_cr0 /* r11 <- HSMC0 CR0 value */
1020 b hsmc_cr_read
1021
1022try_hsmc0_cr1: /* CHECK IF ID=HSMC0 CR1 REG*/
1023 cmpwi cr0,r11,0x0001
1024 bne cr0,try_hsmc1_cr0
1025 mfdcr r10,hsmc0_cr1 /* r10 <- HSMC0 CR1 value */
1026 b hsmc_cr_read
1027
1028try_hsmc1_cr0: /* CHECK IF ID=HSMC1 CR0 REG*/
1029 cmpwi cr0,r11,0x0002
1030 bne cr0,try_hsmc1_cr1
1031 mfdcr r10,hsmc1_cr0 /* r10 <- HSMC1 CR0 value */
1032 b hsmc_cr_read
1033
1034try_hsmc1_cr1: /* CHECK IF ID=HSMC1 CR1 REG*/
1035 cmpwi cr0,r11,0x0003
1036 bne cr0,hsmc_cr_err
1037 mfdcr r10,hsmc1_cr1 /* r10 <- HSMC1 CR1 value */
1038
1039 /*--------------------------------------------------------------------+
1040 | Check if HSMC CR register was reset after command execution
1041 +--------------------------------------------------------------------*/
1042hsmc_cr_read:
1043 lis r12,0x000F /* create "AND" mask */
1044 ori r12,r12,0x8000
1045 and. r10,r10,r12 /* r10 <- HSMC CR bits 12-16*/
1046 bne cr0,hsmc_cr_rep /* wait for bits to reset */
1047 li r3,0 /* set return code = success*/
1048 b hsmc_cr_done
1049
1050hsmc_cr_err: /* ERROR: SDRAM didn't reset*/
1051 li r3,-1 /* set RC=unsuccessful */
1052
1053hsmc_cr_done:
1054 blr
1055
1056#if 0
1057/******************************************************************************
1058|
1059| Routine: GCS_CSPD_LOOKUP
1060|
1061| Purpose: Uses the number of 13.5 Mhz clock ticks found after executing
1062| the branch instruction time loop to look-up the CPU Core Speed
1063| in the Core Speed Look-up Table.
1064|
1065| Parameters: R3 = Address of Bus Speed
1066| R4 = Address of Core Speed
1067| R5 = Number of 13.5 Mhz clock ticks found in time loop.
1068| R6 = Pointer to Core-Speed Look-Up Table
1069|
1070| Returns: (R3) = >0: Bus Speed.
1071| 0: Bus Speed not found in Look-Up Table.
1072| (R4) = >0: Core Speed.
1073| 0: Core Speed not found in Look-Up Table.
1074|
1075| Note: Core Speed = Bus Speed * Mult Factor (1-4x).
1076|
1077******************************************************************************/
1078gcs_cspd_lookup:
1079
1080 li r9,1 /* r9 <- core speed mult */
1081 /*--------------------------------------------------------------------+
1082 | Get theoritical number 13.5 Mhz ticks for a given Bus Speed from
1083 | Look-up Table. Check all mult factors to determine if calculated
1084 | value matches theoretical value (within a tolerance).
1085 +--------------------------------------------------------------------*/
1086gcs_cspd_loop:
1087 lwz r10,0(r6) /* r10 <- no. ticks from LUT*/
1088 divw r10,r10,r9 /* r10 <- div mult (1-4x) */
1089 subi r11,r10,GCS_CTICK_TOL /* r11 <- no. tks low range */
1090 addi r12,r10,GCS_CTICK_TOL /* r12 <- no. tks high range*/
1091
1092 cmpw cr0,r5,r11 /* calc value within range? */
1093 blt gcs_cspd_retry /* less than low range */
1094 cmpw cr0,r5,r12
1095 bgt gcs_cspd_retry /* greater than high range */
1096 b gcs_cspd_fnd /* calc value within range */
1097
1098 /*--------------------------------------------------------------------+
1099 | SO FAR CORE SPEED NOT FOUND: Check next mult factor
1100 +--------------------------------------------------------------------*/
1101gcs_cspd_retry:
1102 addi r9,r9,1 /* bump mult factor (1-4x) */
1103 cmpwi cr0,r9,GCS_NMULT
1104 ble gcs_cspd_loop
1105
1106 /*--------------------------------------------------------------------+
1107 | SO FAR CORE SPEED NOT FOUND: Point at next Bus Speed in LUT
1108 +--------------------------------------------------------------------*/
1109 li r9,1 /* reset mult factor */
1110 addi r6,r6,GCS_TROW_BYTES /* point at next table entry*/
1111 lwz r10,0(r6)
1112 cmpwi cr0,r10,0 /* check for EOT flag */
1113 bne gcs_cspd_loop
1114
1115 /*--------------------------------------------------------------------+
1116 | COMPUTE CORE SPEED AND GET BUS SPEED FROM LOOK-UP TABLE
1117 +--------------------------------------------------------------------*/
1118gcs_cspd_fnd:
1119 lwz r5,4(r6) /* r5 <- Bus Speed in LUT */
1120 mullw r6,r5,r9 /* r6 <- Core speed */
1121 stw r5,0(r3) /* (r3) <- Bus Speed */
1122 stw r6,0(r4) /* (r4) <- Core Speed */
1123
1124 blr
1125#endif
diff --git a/arch/ppc/boot/simple/rw4/stb.h b/arch/ppc/boot/simple/rw4/stb.h
new file mode 100644
index 000000000000..fd98ee0f843e
--- /dev/null
+++ b/arch/ppc/boot/simple/rw4/stb.h
@@ -0,0 +1,239 @@
1/*----------------------------------------------------------------------------+
2| This source code has been made available to you by IBM on an AS-IS
3| basis. Anyone receiving this source is licensed under IBM
4| copyrights to use it in any way he or she deems fit, including
5| copying it, modifying it, compiling it, and redistributing it either
6| with or without modifications. No license under IBM patents or
7| patent applications is to be implied by the copyright license.
8|
9| Any user of this software should understand that IBM cannot provide
10| technical support for this software and will not be responsible for
11| any consequences resulting from the use of this software.
12|
13| Any person who transfers this source code or any derivative work
14| must include the IBM copyright notice, this paragraph, and the
15| preceding two paragraphs in the transferred software.
16|
17| COPYRIGHT I B M CORPORATION 1999
18| LICENSED MATERIAL - PROGRAM PROPERTY OF I B M
19+----------------------------------------------------------------------------*/
20/*----------------------------------------------------------------------------+
21| Author: Maciej P. Tyrlik
22| Component: Include file.
23| File: stb.h
24| Purpose: Common Set-tob-box definitions.
25| Changes:
26| Date: Comment:
27| ----- --------
28| 14-Jan-97 Created for ElPaso pass 1 MPT
29| 13-May-97 Added function prototype and global variables MPT
30| 08-Dec-98 Added RAW IR task information MPT
31| 19-Jan-99 Port to Romeo MPT
32| 19-May-00 Changed SDRAM to 32MB contiguous 0x1F000000 - 0x20FFFFFF RLB
33+----------------------------------------------------------------------------*/
34
35#ifndef _stb_h_
36#define _stb_h_
37
38/*----------------------------------------------------------------------------+
39| Read/write from I/O macros.
40+----------------------------------------------------------------------------*/
41#define inbyte(port) (*((unsigned char volatile *)(port)))
42#define outbyte(port,data) *(unsigned char volatile *)(port)=\
43 (unsigned char)(data)
44
45#define inshort(port) (*((unsigned short volatile *)(port)))
46#define outshort(port,data) *(unsigned short volatile *)(port)=\
47 (unsigned short)(data)
48
49#define inword(port) (*((unsigned long volatile *)(port)))
50#define outword(port,data) *(unsigned long volatile *)(port)=\
51 (unsigned long)(data)
52
53/*----------------------------------------------------------------------------+
54| STB interrupts.
55+----------------------------------------------------------------------------*/
56#define STB_XP_TP_INT 0
57#define STB_XP_APP_INT 1
58#define STB_AUD_INT 2
59#define STB_VID_INT 3
60#define STB_DMA0_INT 4
61#define STB_DMA1_INT 5
62#define STB_DMA2_INT 6
63#define STB_DMA3_INT 7
64#define STB_SCI_INT 8
65#define STB_I2C1_INT 9
66#define STB_I2C2_INT 10
67#define STB_GPT_PWM0 11
68#define STB_GPT_PWM1 12
69#define STB_SCP_INT 13
70#define STB_SSP_INT 14
71#define STB_GPT_PWM2 15
72#define STB_EXT5_INT 16
73#define STB_EXT6_INT 17
74#define STB_EXT7_INT 18
75#define STB_EXT8_INT 19
76#define STB_SCC_INT 20
77#define STB_SICC_RECV_INT 21
78#define STB_SICC_TRAN_INT 22
79#define STB_PPU_INT 23
80#define STB_DCRX_INT 24
81#define STB_EXT0_INT 25
82#define STB_EXT1_INT 26
83#define STB_EXT2_INT 27
84#define STB_EXT3_INT 28
85#define STB_EXT4_INT 29
86#define STB_REDWOOD_ENET_INT STB_EXT1_INT
87
88/*----------------------------------------------------------------------------+
89| STB tasks, task stack sizes, and task priorities. The actual task priority
90| is 1 more than the specified number since priority 0 is reserved (system
91| internaly adds 1 to supplied priority number).
92+----------------------------------------------------------------------------*/
93#define STB_IDLE_TASK_SS (5* 1024)
94#define STB_IDLE_TASK_PRIO 0
95#define STB_LEDTEST_SS (2* 1024)
96#define STB_LEDTEST_PRIO 0
97#define STB_CURSOR_TASK_SS (10* 1024)
98#define STB_CURSOR_TASK_PRIO 7
99#define STB_MPEG_TASK_SS (10* 1024)
100#define STB_MPEG_TASK_PRIO 9
101#define STB_DEMUX_TASK_SS (10* 1024)
102#define STB_DEMUX_TASK_PRIO 20
103#define RAW_STB_IR_TASK_SS (10* 1024)
104#define RAW_STB_IR_TASK_PRIO 20
105
106#define STB_SERIAL_ER_TASK_SS (10* 1024)
107#define STB_SERIAL_ER_TASK_PRIO 1
108#define STB_CA_TASK_SS (10* 1024)
109#define STB_CA_TASK_PRIO 8
110
111#define INIT_DEFAULT_VIDEO_SS (10* 1024)
112#define INIT_DEFAULT_VIDEO_PRIO 8
113#define INIT_DEFAULT_SERVI_SS (10* 1024)
114#define INIT_DEFAULT_SERVI_PRIO 8
115#define INIT_DEFAULT_POST_SS (10* 1024)
116#define INIT_DEFAULT_POST_PRIO 8
117#define INIT_DEFAULT_INTER_SS (10* 1024)
118#define INIT_DEFAULT_INTER_PRIO 8
119#define INIT_DEFAULT_BR_SS (10* 1024)
120#define INIT_DEFAULT_BR_PRIO 8
121#define INITIAL_TASK_STACK_SIZE (32* 1024)
122
123#ifdef VESTA
124/*----------------------------------------------------------------------------+
125| Vesta Overall Address Map (all addresses are double mapped, bit 0 of the
126| address is not decoded. Numbers below are dependent on board configuration.
127| FLASH, SDRAM, DRAM numbers can be affected by actual board setup.
128|
129| FFE0,0000 - FFFF,FFFF FLASH
130| F200,0000 - F210,FFFF FPGA logic
131| Ethernet = F200,0000
132| LED Display = F200,0100
133| Xilinx #1 Regs = F204,0000
134| Xilinx #2 Regs = F208,0000
135| Spare = F20C,0000
136| IDE CS0 = F210,0000
137| F410,0000 - F410,FFFF IDE CS1
138| C000,0000 - C7FF,FFFF OBP
139| C000,0000 - C000,0014 SICC (16550 + infra red)
140| C001,0000 - C001,0018 PPU (Parallel Port)
141| C002,0000 - C002,001B SC0 (Smart Card 0)
142| C003,0000 - C003,000F I2C0
143| C004,0000 - C004,0009 SCC (16550 UART)
144| C005,0000 - C005,0124 GPT (Timers)
145| C006,0000 - C006,0058 GPIO0
146| C007,0000 - C007,001b SC1 (Smart Card 1)
147| C008,0000 - C008,FFFF Unused
148| C009,0000 - C009,FFFF Unused
149| C00A,0000 - C00A,FFFF Unused
150| C00B,0000 - C00B,000F I2C1
151| C00C,0000 - C00C,0006 SCP
152| C00D,0000 - C00D,0010 SSP
153| A000,0000 - A0FF,FFFF SDRAM1 (16M)
154| 0000,0000 - 00FF,FFFF SDRAM0 (16M)
155+----------------------------------------------------------------------------*/
156#define STB_FLASH_BASE_ADDRESS 0xFFE00000
157#define STB_FPGA_BASE_ADDRESS 0xF2000000
158#define STB_SICC_BASE_ADDRESS 0xC0000000
159#define STB_PPU_BASE_ADDR 0xC0010000
160#define STB_SC0_BASE_ADDRESS 0xC0020000
161#define STB_I2C1_BASE_ADDRESS 0xC0030000
162#define STB_SCC_BASE_ADDRESS 0xC0040000
163#define STB_TIMERS_BASE_ADDRESS 0xC0050000
164#define STB_GPIO0_BASE_ADDRESS 0xC0060000
165#define STB_SC1_BASE_ADDRESS 0xC0070000
166#define STB_I2C2_BASE_ADDRESS 0xC00B0000
167#define STB_SCP_BASE_ADDRESS 0xC00C0000
168#define STB_SSP_BASE_ADDRESS 0xC00D0000
169/*----------------------------------------------------------------------------+
170|The following are used by the IBM RTOS SW.
171|15-May-00 Changed these values to reflect movement of base addresses in
172|order to support 32MB of contiguous SDRAM space.
173|Points to the cacheable region since these values are used in IBM RTOS
174|to establish the vector address.
175+----------------------------------------------------------------------------*/
176#define STB_SDRAM1_BASE_ADDRESS 0x20000000
177#define STB_SDRAM1_SIZE 0x01000000
178#define STB_SDRAM0_BASE_ADDRESS 0x1F000000
179#define STB_SDRAM0_SIZE 0x01000000
180
181#else
182/*----------------------------------------------------------------------------+
183| ElPaso Overall Address Map (all addresses are double mapped, bit 0 of the
184| address is not decoded. Numbers below are dependent on board configuration.
185| FLASH, SDRAM, DRAM numbers can be affected by actual board setup. OPB
186| devices are inside the ElPaso chip.
187| FFE0,0000 - FFFF,FFFF FLASH
188| F144,0000 - F104,FFFF FPGA logic
189| F140,0000 - F100,0000 ethernet (through FPGA logic)
190| C000,0000 - C7FF,FFFF OBP
191| C000,0000 - C000,0014 SICC (16550+ infra red)
192| C001,0000 - C001,0016 PPU (parallel port)
193| C002,0000 - C002,001B SC (smart card)
194| C003,0000 - C003,000F I2C 1
195| C004,0000 - C004,0009 SCC (16550 UART)
196| C005,0000 - C005,0124 Timers
197| C006,0000 - C006,0058 GPIO0
198| C007,0000 - C007,0058 GPIO1
199| C008,0000 - C008,0058 GPIO2
200| C009,0000 - C009,0058 GPIO3
201| C00A,0000 - C00A,0058 GPIO4
202| C00B,0000 - C00B,000F I2C 2
203| C00C,0000 - C00C,0006 SCP
204| C00D,0000 - C00D,0006 SSP
205| A000,0000 - A0FF,FFFF SDRAM 16M
206| 0000,0000 - 00FF,FFFF DRAM 16M
207+----------------------------------------------------------------------------*/
208#define STB_FLASH_BASE_ADDRESS 0xFFE00000
209#define STB_FPGA_BASE_ADDRESS 0xF1440000
210#define STB_ENET_BASE_ADDRESS 0xF1400000
211#define STB_SICC_BASE_ADDRESS 0xC0000000
212#define STB_PPU_BASE_ADDR 0xC0010000
213#define STB_SC_BASE_ADDRESS 0xC0020000
214#define STB_I2C1_BASE_ADDRESS 0xC0030000
215#define STB_SCC_BASE_ADDRESS 0xC0040000
216#define STB_TIMERS_BASE_ADDRESS 0xC0050000
217#define STB_GPIO0_BASE_ADDRESS 0xC0060000
218#define STB_GPIO1_BASE_ADDRESS 0xC0070000
219#define STB_GPIO2_BASE_ADDRESS 0xC0080000
220#define STB_GPIO3_BASE_ADDRESS 0xC0090000
221#define STB_GPIO4_BASE_ADDRESS 0xC00A0000
222#define STB_I2C2_BASE_ADDRESS 0xC00B0000
223#define STB_SCP_BASE_ADDRESS 0xC00C0000
224#define STB_SSP_BASE_ADDRESS 0xC00D0000
225#define STB_SDRAM_BASE_ADDRESS 0xA0000000
226#endif
227
228/*----------------------------------------------------------------------------+
229| Other common defines.
230+----------------------------------------------------------------------------*/
231#ifndef TRUE
232#define TRUE 1
233#endif
234
235#ifndef FALSE
236#define FALSE 0
237#endif
238
239#endif /* _stb_h_ */
diff --git a/arch/ppc/boot/utils/addRamDisk.c b/arch/ppc/boot/utils/addRamDisk.c
new file mode 100644
index 000000000000..93400dfcce7f
--- /dev/null
+++ b/arch/ppc/boot/utils/addRamDisk.c
@@ -0,0 +1,203 @@
1#include <stdio.h>
2#include <stdlib.h>
3#include <netinet/in.h>
4#include <unistd.h>
5#include <sys/types.h>
6#include <sys/stat.h>
7#include <string.h>
8
9#define ElfHeaderSize (64 * 1024)
10#define ElfPages (ElfHeaderSize / 4096)
11#define KERNELBASE (0xc0000000)
12
13void get4k(FILE *file, char *buf )
14{
15 unsigned j;
16 unsigned num = fread(buf, 1, 4096, file);
17 for ( j=num; j<4096; ++j )
18 buf[j] = 0;
19}
20
21void put4k(FILE *file, char *buf )
22{
23 fwrite(buf, 1, 4096, file);
24}
25
26void death(const char *msg, FILE *fdesc, const char *fname)
27{
28 printf(msg);
29 fclose(fdesc);
30 unlink(fname);
31 exit(1);
32}
33
34int main(int argc, char **argv)
35{
36 char inbuf[4096];
37 FILE *ramDisk = NULL;
38 FILE *inputVmlinux = NULL;
39 FILE *outputVmlinux = NULL;
40 unsigned i = 0;
41 u_int32_t ramFileLen = 0;
42 u_int32_t ramLen = 0;
43 u_int32_t roundR = 0;
44 u_int32_t kernelLen = 0;
45 u_int32_t actualKernelLen = 0;
46 u_int32_t round = 0;
47 u_int32_t roundedKernelLen = 0;
48 u_int32_t ramStartOffs = 0;
49 u_int32_t ramPages = 0;
50 u_int32_t roundedKernelPages = 0;
51 u_int32_t hvReleaseData = 0;
52 u_int32_t eyeCatcher = 0xc8a5d9c4;
53 u_int32_t naca = 0;
54 u_int32_t xRamDisk = 0;
55 u_int32_t xRamDiskSize = 0;
56 if ( argc < 2 ) {
57 printf("Name of RAM disk file missing.\n");
58 exit(1);
59 }
60
61 if ( argc < 3 ) {
62 printf("Name of vmlinux file missing.\n");
63 exit(1);
64 }
65
66 if ( argc < 4 ) {
67 printf("Name of vmlinux output file missing.\n");
68 exit(1);
69 }
70
71 ramDisk = fopen(argv[1], "r");
72 if ( ! ramDisk ) {
73 printf("RAM disk file \"%s\" failed to open.\n", argv[1]);
74 exit(1);
75 }
76 inputVmlinux = fopen(argv[2], "r");
77 if ( ! inputVmlinux ) {
78 printf("vmlinux file \"%s\" failed to open.\n", argv[2]);
79 exit(1);
80 }
81 outputVmlinux = fopen(argv[3], "w+");
82 if ( ! outputVmlinux ) {
83 printf("output vmlinux file \"%s\" failed to open.\n", argv[3]);
84 exit(1);
85 }
86 fseek(ramDisk, 0, SEEK_END);
87 ramFileLen = ftell(ramDisk);
88 fseek(ramDisk, 0, SEEK_SET);
89 printf("%s file size = %d\n", argv[1], ramFileLen);
90
91 ramLen = ramFileLen;
92
93 roundR = 4096 - (ramLen % 4096);
94 if ( roundR ) {
95 printf("Rounding RAM disk file up to a multiple of 4096, adding %d\n", roundR);
96 ramLen += roundR;
97 }
98
99 printf("Rounded RAM disk size is %d\n", ramLen);
100 fseek(inputVmlinux, 0, SEEK_END);
101 kernelLen = ftell(inputVmlinux);
102 fseek(inputVmlinux, 0, SEEK_SET);
103 printf("kernel file size = %d\n", kernelLen);
104 if ( kernelLen == 0 ) {
105 printf("You must have a linux kernel specified as argv[2]\n");
106 exit(1);
107 }
108
109 actualKernelLen = kernelLen - ElfHeaderSize;
110
111 printf("actual kernel length (minus ELF header) = %d\n", actualKernelLen);
112
113 round = actualKernelLen % 4096;
114 roundedKernelLen = actualKernelLen;
115 if ( round )
116 roundedKernelLen += (4096 - round);
117
118 printf("actual kernel length rounded up to a 4k multiple = %d\n", roundedKernelLen);
119
120 ramStartOffs = roundedKernelLen;
121 ramPages = ramLen / 4096;
122
123 printf("RAM disk pages to copy = %d\n", ramPages);
124
125 // Copy 64K ELF header
126 for (i=0; i<(ElfPages); ++i) {
127 get4k( inputVmlinux, inbuf );
128 put4k( outputVmlinux, inbuf );
129 }
130
131 roundedKernelPages = roundedKernelLen / 4096;
132
133 fseek(inputVmlinux, ElfHeaderSize, SEEK_SET);
134
135 for ( i=0; i<roundedKernelPages; ++i ) {
136 get4k( inputVmlinux, inbuf );
137 put4k( outputVmlinux, inbuf );
138 }
139
140 for ( i=0; i<ramPages; ++i ) {
141 get4k( ramDisk, inbuf );
142 put4k( outputVmlinux, inbuf );
143 }
144
145 /* Close the input files */
146 fclose(ramDisk);
147 fclose(inputVmlinux);
148 /* And flush the written output file */
149 fflush(outputVmlinux);
150
151 /* fseek to the hvReleaseData pointer */
152 fseek(outputVmlinux, ElfHeaderSize + 0x24, SEEK_SET);
153 if (fread(&hvReleaseData, 4, 1, outputVmlinux) != 1) {
154 death("Could not read hvReleaseData pointer\n", outputVmlinux, argv[3]);
155 }
156 hvReleaseData = ntohl(hvReleaseData); /* Convert to native int */
157 printf("hvReleaseData is at %08x\n", hvReleaseData);
158
159 /* fseek to the hvReleaseData */
160 fseek(outputVmlinux, ElfHeaderSize + hvReleaseData, SEEK_SET);
161 if (fread(inbuf, 0x40, 1, outputVmlinux) != 1) {
162 death("Could not read hvReleaseData\n", outputVmlinux, argv[3]);
163 }
164 /* Check hvReleaseData sanity */
165 if (memcmp(inbuf, &eyeCatcher, 4) != 0) {
166 death("hvReleaseData is invalid\n", outputVmlinux, argv[3]);
167 }
168 /* Get the naca pointer */
169 naca = ntohl(*((u_int32_t *) &inbuf[0x0c])) - KERNELBASE;
170 printf("naca is at %08x\n", naca);
171
172 /* fseek to the naca */
173 fseek(outputVmlinux, ElfHeaderSize + naca, SEEK_SET);
174 if (fread(inbuf, 0x18, 1, outputVmlinux) != 1) {
175 death("Could not read naca\n", outputVmlinux, argv[3]);
176 }
177 xRamDisk = ntohl(*((u_int32_t *) &inbuf[0x0c]));
178 xRamDiskSize = ntohl(*((u_int32_t *) &inbuf[0x14]));
179 /* Make sure a RAM disk isn't already present */
180 if ((xRamDisk != 0) || (xRamDiskSize != 0)) {
181 death("RAM disk is already attached to this kernel\n", outputVmlinux, argv[3]);
182 }
183 /* Fill in the values */
184 *((u_int32_t *) &inbuf[0x0c]) = htonl(ramStartOffs);
185 *((u_int32_t *) &inbuf[0x14]) = htonl(ramPages);
186
187 /* Write out the new naca */
188 fflush(outputVmlinux);
189 fseek(outputVmlinux, ElfHeaderSize + naca, SEEK_SET);
190 if (fwrite(inbuf, 0x18, 1, outputVmlinux) != 1) {
191 death("Could not write naca\n", outputVmlinux, argv[3]);
192 }
193 printf("RAM Disk of 0x%x pages size is attached to the kernel at offset 0x%08x\n",
194 ramPages, ramStartOffs);
195
196 /* Done */
197 fclose(outputVmlinux);
198 /* Set permission to executable */
199 chmod(argv[3], S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH);
200
201 return 0;
202}
203
diff --git a/arch/ppc/boot/utils/addSystemMap.c b/arch/ppc/boot/utils/addSystemMap.c
new file mode 100644
index 000000000000..4654f891b274
--- /dev/null
+++ b/arch/ppc/boot/utils/addSystemMap.c
@@ -0,0 +1,186 @@
1#include <stdio.h>
2#include <stdlib.h>
3#include <byteswap.h>
4#include <sys/types.h>
5#include <sys/stat.h>
6
7void xlate( char * inb, char * trb, unsigned len )
8{
9 unsigned i;
10 for ( i=0; i<len; ++i ) {
11 char c = *inb++;
12 char c1 = c >> 4;
13 char c2 = c & 0xf;
14 if ( c1 > 9 )
15 c1 = c1 + 'A' - 10;
16 else
17 c1 = c1 + '0';
18 if ( c2 > 9 )
19 c2 = c2 + 'A' - 10;
20 else
21 c2 = c2 + '0';
22 *trb++ = c1;
23 *trb++ = c2;
24 }
25 *trb = 0;
26}
27
28#define ElfHeaderSize (64 * 1024)
29#define ElfPages (ElfHeaderSize / 4096)
30#define KERNELBASE (0xc0000000)
31
32void get4k( /*istream *inf*/FILE *file, char *buf )
33{
34 unsigned j;
35 unsigned num = fread(buf, 1, 4096, file);
36 for ( j=num; j<4096; ++j )
37 buf[j] = 0;
38}
39
40void put4k( /*ostream *outf*/FILE *file, char *buf )
41{
42 fwrite(buf, 1, 4096, file);
43}
44
45int main(int argc, char **argv)
46{
47 char inbuf[4096];
48 FILE *ramDisk = NULL;
49 FILE *inputVmlinux = NULL;
50 FILE *outputVmlinux = NULL;
51 unsigned i = 0;
52 unsigned long ramFileLen = 0;
53 unsigned long ramLen = 0;
54 unsigned long roundR = 0;
55 unsigned long kernelLen = 0;
56 unsigned long actualKernelLen = 0;
57 unsigned long round = 0;
58 unsigned long roundedKernelLen = 0;
59 unsigned long ramStartOffs = 0;
60 unsigned long ramPages = 0;
61 unsigned long roundedKernelPages = 0;
62 if ( argc < 2 ) {
63 printf("Name of System Map file missing.\n");
64 exit(1);
65 }
66
67 if ( argc < 3 ) {
68 printf("Name of vmlinux file missing.\n");
69 exit(1);
70 }
71
72 if ( argc < 4 ) {
73 printf("Name of vmlinux output file missing.\n");
74 exit(1);
75 }
76
77 ramDisk = fopen(argv[1], "r");
78 if ( ! ramDisk ) {
79 printf("System Map file \"%s\" failed to open.\n", argv[1]);
80 exit(1);
81 }
82 inputVmlinux = fopen(argv[2], "r");
83 if ( ! inputVmlinux ) {
84 printf("vmlinux file \"%s\" failed to open.\n", argv[2]);
85 exit(1);
86 }
87 outputVmlinux = fopen(argv[3], "w");
88 if ( ! outputVmlinux ) {
89 printf("output vmlinux file \"%s\" failed to open.\n", argv[3]);
90 exit(1);
91 }
92 fseek(ramDisk, 0, SEEK_END);
93 ramFileLen = ftell(ramDisk);
94 fseek(ramDisk, 0, SEEK_SET);
95 printf("%s file size = %ld\n", argv[1], ramFileLen);
96
97 ramLen = ramFileLen;
98
99 roundR = 4096 - (ramLen % 4096);
100 if ( roundR ) {
101 printf("Rounding System Map file up to a multiple of 4096, adding %ld\n", roundR);
102 ramLen += roundR;
103 }
104
105 printf("Rounded System Map size is %ld\n", ramLen);
106 fseek(inputVmlinux, 0, SEEK_END);
107 kernelLen = ftell(inputVmlinux);
108 fseek(inputVmlinux, 0, SEEK_SET);
109 printf("kernel file size = %ld\n", kernelLen);
110 if ( kernelLen == 0 ) {
111 printf("You must have a linux kernel specified as argv[2]\n");
112 exit(1);
113 }
114
115 actualKernelLen = kernelLen - ElfHeaderSize;
116
117 printf("actual kernel length (minus ELF header) = %ld\n", actualKernelLen);
118
119 round = actualKernelLen % 4096;
120 roundedKernelLen = actualKernelLen;
121 if ( round )
122 roundedKernelLen += (4096 - round);
123
124 printf("actual kernel length rounded up to a 4k multiple = %ld\n", roundedKernelLen);
125
126 ramStartOffs = roundedKernelLen;
127 ramPages = ramLen / 4096;
128
129 printf("System map pages to copy = %ld\n", ramPages);
130
131 // Copy 64K ELF header
132 for (i=0; i<(ElfPages); ++i) {
133 get4k( inputVmlinux, inbuf );
134 put4k( outputVmlinux, inbuf );
135 }
136
137
138
139 roundedKernelPages = roundedKernelLen / 4096;
140
141 fseek(inputVmlinux, ElfHeaderSize, SEEK_SET);
142
143 {
144 for ( i=0; i<roundedKernelPages; ++i ) {
145 get4k( inputVmlinux, inbuf );
146 if ( i == 0 ) {
147 unsigned long * p;
148 printf("Storing embedded_sysmap_start at 0x3c\n");
149 p = (unsigned long *)(inbuf + 0x3c);
150
151#if (BYTE_ORDER == __BIG_ENDIAN)
152 *p = ramStartOffs;
153#else
154 *p = bswap_32(ramStartOffs);
155#endif
156
157 printf("Storing embedded_sysmap_end at 0x44\n");
158 p = (unsigned long *)(inbuf + 0x44);
159#if (BYTE_ORDER == __BIG_ENDIAN)
160 *p = ramStartOffs + ramFileLen;
161#else
162 *p = bswap_32(ramStartOffs + ramFileLen);
163#endif
164 }
165 put4k( outputVmlinux, inbuf );
166 }
167 }
168
169 {
170 for ( i=0; i<ramPages; ++i ) {
171 get4k( ramDisk, inbuf );
172 put4k( outputVmlinux, inbuf );
173 }
174 }
175
176
177 fclose(ramDisk);
178 fclose(inputVmlinux);
179 fclose(outputVmlinux);
180 /* Set permission to executable */
181 chmod(argv[3], S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH);
182
183 return 0;
184
185}
186
diff --git a/arch/ppc/boot/utils/addnote.c b/arch/ppc/boot/utils/addnote.c
new file mode 100644
index 000000000000..6c52b18f2d04
--- /dev/null
+++ b/arch/ppc/boot/utils/addnote.c
@@ -0,0 +1,175 @@
1/*
2 * Program to hack in a PT_NOTE program header entry in an ELF file.
3 * This is needed for OF on RS/6000s to load an image correctly.
4 * Note that OF needs a program header entry for the note, not an
5 * ELF section.
6 *
7 * Copyright 2000 Paul Mackerras.
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
13 *
14 * Usage: addnote zImage
15 */
16#include <stdio.h>
17#include <stdlib.h>
18#include <fcntl.h>
19#include <unistd.h>
20#include <string.h>
21
22char arch[] = "PowerPC";
23
24#define N_DESCR 6
25unsigned int descr[N_DESCR] = {
26#if 1
27 /* values for IBM RS/6000 machines */
28 0xffffffff, /* real-mode = true */
29 0x00c00000, /* real-base, i.e. where we expect OF to be */
30 0xffffffff, /* real-size */
31 0xffffffff, /* virt-base */
32 0xffffffff, /* virt-size */
33 0x4000, /* load-base */
34#else
35 /* values for longtrail CHRP */
36 0, /* real-mode = false */
37 0xffffffff, /* real-base */
38 0xffffffff, /* real-size */
39 0xffffffff, /* virt-base */
40 0xffffffff, /* virt-size */
41 0x00600000, /* load-base */
42#endif
43};
44
45unsigned char buf[512];
46
47#define GET_16BE(off) ((buf[off] << 8) + (buf[(off)+1]))
48#define GET_32BE(off) ((GET_16BE(off) << 16) + GET_16BE((off)+2))
49
50#define PUT_16BE(off, v) (buf[off] = ((v) >> 8) & 0xff, \
51 buf[(off) + 1] = (v) & 0xff)
52#define PUT_32BE(off, v) (PUT_16BE((off), (v) >> 16), \
53 PUT_16BE((off) + 2, (v)))
54
55/* Structure of an ELF file */
56#define E_IDENT 0 /* ELF header */
57#define E_PHOFF 28
58#define E_PHENTSIZE 42
59#define E_PHNUM 44
60#define E_HSIZE 52 /* size of ELF header */
61
62#define EI_MAGIC 0 /* offsets in E_IDENT area */
63#define EI_CLASS 4
64#define EI_DATA 5
65
66#define PH_TYPE 0 /* ELF program header */
67#define PH_OFFSET 4
68#define PH_FILESZ 16
69#define PH_HSIZE 32 /* size of program header */
70
71#define PT_NOTE 4 /* Program header type = note */
72
73#define ELFCLASS32 1
74#define ELFDATA2MSB 2
75
76unsigned char elf_magic[4] = { 0x7f, 'E', 'L', 'F' };
77
78int main(int ac, char **av)
79{
80 int fd, n, i;
81 int ph, ps, np;
82 int nnote, ns;
83
84 if (ac != 2) {
85 fprintf(stderr, "Usage: %s elf-file\n", av[0]);
86 exit(1);
87 }
88 fd = open(av[1], O_RDWR);
89 if (fd < 0) {
90 perror(av[1]);
91 exit(1);
92 }
93
94 nnote = strlen(arch) + 1 + (N_DESCR + 3) * 4;
95
96 n = read(fd, buf, sizeof(buf));
97 if (n < 0) {
98 perror("read");
99 exit(1);
100 }
101
102 if (n < E_HSIZE || memcmp(&buf[E_IDENT+EI_MAGIC], elf_magic, 4) != 0)
103 goto notelf;
104
105 if (buf[E_IDENT+EI_CLASS] != ELFCLASS32
106 || buf[E_IDENT+EI_DATA] != ELFDATA2MSB) {
107 fprintf(stderr, "%s is not a big-endian 32-bit ELF image\n",
108 av[1]);
109 exit(1);
110 }
111
112 ph = GET_32BE(E_PHOFF);
113 ps = GET_16BE(E_PHENTSIZE);
114 np = GET_16BE(E_PHNUM);
115 if (ph < E_HSIZE || ps < PH_HSIZE || np < 1)
116 goto notelf;
117 if (ph + (np + 1) * ps + nnote > n)
118 goto nospace;
119
120 for (i = 0; i < np; ++i) {
121 if (GET_32BE(ph + PH_TYPE) == PT_NOTE) {
122 fprintf(stderr, "%s already has a note entry\n",
123 av[1]);
124 exit(0);
125 }
126 ph += ps;
127 }
128
129 /* XXX check that the area we want to use is all zeroes */
130 for (i = 0; i < ps + nnote; ++i)
131 if (buf[ph + i] != 0)
132 goto nospace;
133
134 /* fill in the program header entry */
135 ns = ph + ps;
136 PUT_32BE(ph + PH_TYPE, PT_NOTE);
137 PUT_32BE(ph + PH_OFFSET, ns);
138 PUT_32BE(ph + PH_FILESZ, nnote);
139
140 /* fill in the note area we point to */
141 /* XXX we should probably make this a proper section */
142 PUT_32BE(ns, strlen(arch) + 1);
143 PUT_32BE(ns + 4, N_DESCR * 4);
144 PUT_32BE(ns + 8, 0x1275);
145 strcpy(&buf[ns + 12], arch);
146 ns += 12 + strlen(arch) + 1;
147 for (i = 0; i < N_DESCR; ++i)
148 PUT_32BE(ns + i * 4, descr[i]);
149
150 /* Update the number of program headers */
151 PUT_16BE(E_PHNUM, np + 1);
152
153 /* write back */
154 lseek(fd, (long) 0, SEEK_SET);
155 i = write(fd, buf, n);
156 if (i < 0) {
157 perror("write");
158 exit(1);
159 }
160 if (i < n) {
161 fprintf(stderr, "%s: write truncated\n", av[1]);
162 exit(1);
163 }
164
165 exit(0);
166
167 notelf:
168 fprintf(stderr, "%s does not appear to be an ELF file\n", av[0]);
169 exit(1);
170
171 nospace:
172 fprintf(stderr, "sorry, I can't find space in %s to put the note\n",
173 av[0]);
174 exit(1);
175}
diff --git a/arch/ppc/boot/utils/elf.pl b/arch/ppc/boot/utils/elf.pl
new file mode 100644
index 000000000000..d3e9d9d5b84e
--- /dev/null
+++ b/arch/ppc/boot/utils/elf.pl
@@ -0,0 +1,33 @@
1#
2# ELF header field numbers
3#
4
5$e_ident = 0; # Identification bytes / magic number
6$e_type = 1; # ELF file type
7$e_machine = 2; # Target machine type
8$e_version = 3; # File version
9$e_entry = 4; # Start address
10$e_phoff = 5; # Program header file offset
11$e_shoff = 6; # Section header file offset
12$e_flags = 7; # File flags
13$e_ehsize = 8; # Size of ELF header
14$e_phentsize = 9; # Size of program header
15$e_phnum = 10; # Number of program header entries
16$e_shentsize = 11; # Size of section header
17$e_shnum = 12; # Number of section header entries
18$e_shstrndx = 13; # Section header table string index
19
20#
21# Section header field numbers
22#
23
24$sh_name = 0; # Section name
25$sh_type = 1; # Section header type
26$sh_flags = 2; # Section header flags
27$sh_addr = 3; # Virtual address
28$sh_offset = 4; # File offset
29$sh_size = 5; # Section size
30$sh_link = 6; # Miscellaneous info
31$sh_info = 7; # More miscellaneous info
32$sh_addralign = 8; # Memory alignment
33$sh_entsize = 9; # Entry size if this is a table
diff --git a/arch/ppc/boot/utils/hack-coff.c b/arch/ppc/boot/utils/hack-coff.c
new file mode 100644
index 000000000000..5e5a6573a1ef
--- /dev/null
+++ b/arch/ppc/boot/utils/hack-coff.c
@@ -0,0 +1,84 @@
1/*
2 * hack-coff.c - hack the header of an xcoff file to fill in
3 * a few fields needed by the Open Firmware xcoff loader on
4 * Power Macs but not initialized by objcopy.
5 *
6 * Copyright (C) Paul Mackerras 1997.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
12 */
13#include <stdio.h>
14#include <stdlib.h>
15#include <unistd.h>
16#include <fcntl.h>
17#include <string.h>
18#include "rs6000.h"
19
20#define AOUT_MAGIC 0x010b
21
22#define get_16be(x) ((((unsigned char *)(x))[0] << 8) \
23 + ((unsigned char *)(x))[1])
24#define put_16be(x, v) (((unsigned char *)(x))[0] = (v) >> 8, \
25 ((unsigned char *)(x))[1] = (v) & 0xff)
26#define get_32be(x) ((((unsigned char *)(x))[0] << 24) \
27 + (((unsigned char *)(x))[1] << 16) \
28 + (((unsigned char *)(x))[2] << 8) \
29 + ((unsigned char *)(x))[3])
30
31int
32main(int ac, char **av)
33{
34 int fd;
35 int i, nsect;
36 int aoutsz;
37 struct external_filehdr fhdr;
38 AOUTHDR aout;
39 struct external_scnhdr shdr;
40
41 if (ac != 2) {
42 fprintf(stderr, "Usage: hack-coff coff-file\n");
43 exit(1);
44 }
45 if ((fd = open(av[1], 2)) == -1) {
46 perror(av[2]);
47 exit(1);
48 }
49 if (read(fd, &fhdr, sizeof(fhdr)) != sizeof(fhdr))
50 goto readerr;
51 i = get_16be(fhdr.f_magic);
52 if (i != U802TOCMAGIC && i != U802WRMAGIC && i != U802ROMAGIC) {
53 fprintf(stderr, "%s: not an xcoff file\n", av[1]);
54 exit(1);
55 }
56 aoutsz = get_16be(fhdr.f_opthdr);
57 if (read(fd, &aout, aoutsz) != aoutsz)
58 goto readerr;
59 nsect = get_16be(fhdr.f_nscns);
60 for (i = 0; i < nsect; ++i) {
61 if (read(fd, &shdr, sizeof(shdr)) != sizeof(shdr))
62 goto readerr;
63 if (strcmp(shdr.s_name, ".text") == 0) {
64 put_16be(aout.o_snentry, i+1);
65 put_16be(aout.o_sntext, i+1);
66 } else if (strcmp(shdr.s_name, ".data") == 0) {
67 put_16be(aout.o_sndata, i+1);
68 } else if (strcmp(shdr.s_name, ".bss") == 0) {
69 put_16be(aout.o_snbss, i+1);
70 }
71 }
72 put_16be(aout.magic, AOUT_MAGIC);
73 if (lseek(fd, (long) sizeof(struct external_filehdr), 0) == -1
74 || write(fd, &aout, aoutsz) != aoutsz) {
75 fprintf(stderr, "%s: write error\n", av[1]);
76 exit(1);
77 }
78 close(fd);
79 exit(0);
80
81readerr:
82 fprintf(stderr, "%s: read error or file too short\n", av[1]);
83 exit(1);
84}
diff --git a/arch/ppc/boot/utils/mkbugboot.c b/arch/ppc/boot/utils/mkbugboot.c
new file mode 100644
index 000000000000..886122283f39
--- /dev/null
+++ b/arch/ppc/boot/utils/mkbugboot.c
@@ -0,0 +1,187 @@
1/*
2 * arch/ppc/boot/utils/mkbugboot.c
3 *
4 * Makes a Motorola PPCBUG ROM bootable image which can be flashed
5 * into one of the FLASH banks on a Motorola PowerPlus board.
6 *
7 * Author: Matt Porter <mporter@mvista.com>
8 *
9 * 2001 (c) MontaVista, Software, Inc. This file is licensed under
10 * the terms of the GNU General Public License version 2. This program
11 * is licensed "as is" without any warranty of any kind, whether express
12 * or implied.
13 */
14
15#define ELF_HEADER_SIZE 65536
16
17#include <unistd.h>
18#include <sys/stat.h>
19#include <string.h>
20#include <stdio.h>
21#include <stdlib.h>
22#include <errno.h>
23#include <fcntl.h>
24#ifdef __sun__
25#include <inttypes.h>
26#else
27#include <stdint.h>
28#endif
29
30#ifdef __i386__
31#define cpu_to_be32(x) le32_to_cpu(x)
32#define cpu_to_be16(x) le16_to_cpu(x)
33#else
34#define cpu_to_be32(x) (x)
35#define cpu_to_be16(x) (x)
36#endif
37
38#define cpu_to_le32(x) le32_to_cpu((x))
39unsigned long le32_to_cpu(unsigned long x)
40{
41 return (((x & 0x000000ffU) << 24) |
42 ((x & 0x0000ff00U) << 8) |
43 ((x & 0x00ff0000U) >> 8) |
44 ((x & 0xff000000U) >> 24));
45}
46
47#define cpu_to_le16(x) le16_to_cpu((x))
48unsigned short le16_to_cpu(unsigned short x)
49{
50 return (((x & 0x00ff) << 8) |
51 ((x & 0xff00) >> 8));
52}
53
54/* size of read buffer */
55#define SIZE 0x1000
56
57/* PPCBUG ROM boot header */
58typedef struct bug_boot_header {
59 uint8_t magic_word[4]; /* "BOOT" */
60 uint32_t entry_offset; /* Offset from top of header to code */
61 uint32_t routine_length; /* Length of code */
62 uint8_t routine_name[8]; /* Name of the boot code */
63} bug_boot_header_t;
64
65#define HEADER_SIZE sizeof(bug_boot_header_t)
66
67uint32_t copy_image(int32_t in_fd, int32_t out_fd)
68{
69 uint8_t buf[SIZE];
70 int n;
71 uint32_t image_size = 0;
72 uint8_t zero = 0;
73
74 lseek(in_fd, ELF_HEADER_SIZE, SEEK_SET);
75
76 /* Copy an image while recording its size */
77 while ( (n = read(in_fd, buf, SIZE)) > 0 )
78 {
79 image_size = image_size + n;
80 write(out_fd, buf, n);
81 }
82
83 /* BUG romboot requires that our size is divisible by 2 */
84 /* align image to 2 byte boundary */
85 if (image_size % 2)
86 {
87 image_size++;
88 write(out_fd, &zero, 1);
89 }
90
91 return image_size;
92}
93
94void write_bugboot_header(int32_t out_fd, uint32_t boot_size)
95{
96 uint8_t header_block[HEADER_SIZE];
97 bug_boot_header_t *bbh = (bug_boot_header_t *)&header_block[0];
98
99 memset(header_block, 0, HEADER_SIZE);
100
101 /* Fill in the PPCBUG ROM boot header */
102 strncpy(bbh->magic_word, "BOOT", 4); /* PPCBUG magic word */
103 bbh->entry_offset = cpu_to_be32(HEADER_SIZE); /* Entry address */
104 bbh->routine_length= cpu_to_be32(HEADER_SIZE+boot_size+2); /* Routine length */
105 strncpy(bbh->routine_name, "LINUXROM", 8); /* Routine name */
106
107 /* Output the header and bootloader to the file */
108 write(out_fd, header_block, HEADER_SIZE);
109}
110
111uint16_t calc_checksum(int32_t bug_fd)
112{
113 uint32_t checksum_var = 0;
114 uint8_t buf[2];
115 int n;
116
117 /* Checksum loop */
118 while ( (n = read(bug_fd, buf, 2) ) )
119 {
120 checksum_var = checksum_var + *(uint16_t *)buf;
121
122 /* If we carry out, mask it and add one to the checksum */
123 if (checksum_var >> 16)
124 checksum_var = (checksum_var & 0x0000ffff) + 1;
125 }
126
127 return checksum_var;
128}
129
130int main(int argc, char *argv[])
131{
132 int32_t image_fd, bugboot_fd;
133 int argptr = 1;
134 uint32_t kernel_size = 0;
135 uint16_t checksum = 0;
136 uint8_t bugbootname[256];
137
138 if ( (argc != 3) )
139 {
140 fprintf(stderr, "usage: %s <kernel_image> <bugboot>\n",argv[0]);
141 exit(-1);
142 }
143
144 /* Get file args */
145
146 /* kernel image file */
147 if ((image_fd = open( argv[argptr] , 0)) < 0)
148 exit(-1);
149 argptr++;
150
151 /* bugboot file */
152 if ( !strcmp( argv[argptr], "-" ) )
153 bugboot_fd = 1; /* stdout */
154 else
155 if ((bugboot_fd = creat( argv[argptr] , 0755)) < 0)
156 exit(-1);
157 else
158 strcpy(bugbootname, argv[argptr]);
159 argptr++;
160
161 /* Set file position after ROM header block where zImage will be written */
162 lseek(bugboot_fd, HEADER_SIZE, SEEK_SET);
163
164 /* Copy kernel image into bugboot image */
165 kernel_size = copy_image(image_fd, bugboot_fd);
166 close(image_fd);
167
168 /* Set file position to beginning where header/romboot will be written */
169 lseek(bugboot_fd, 0, SEEK_SET);
170
171 /* Write out BUG header/romboot */
172 write_bugboot_header(bugboot_fd, kernel_size);
173
174 /* Close bugboot file */
175 close(bugboot_fd);
176
177 /* Reopen it as read/write */
178 bugboot_fd = open(bugbootname, O_RDWR);
179
180 /* Calculate checksum */
181 checksum = calc_checksum(bugboot_fd);
182
183 /* Write out the calculated checksum */
184 write(bugboot_fd, &checksum, 2);
185
186 return 0;
187}
diff --git a/arch/ppc/boot/utils/mknote.c b/arch/ppc/boot/utils/mknote.c
new file mode 100644
index 000000000000..b9fbb2cbfc8f
--- /dev/null
+++ b/arch/ppc/boot/utils/mknote.c
@@ -0,0 +1,44 @@
1/*
2 * Copyright (C) Cort Dougan 1999.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 *
9 * Generate a note section as per the CHRP specification.
10 *
11 */
12
13#include <stdio.h>
14#include <string.h>
15
16#define PL(x) printf("%c%c%c%c", ((x)>>24)&0xff, ((x)>>16)&0xff, ((x)>>8)&0xff, (x)&0xff );
17
18int main(void)
19{
20/* header */
21 /* namesz */
22 PL(strlen("PowerPC")+1);
23 /* descrsz */
24 PL(6*4);
25 /* type */
26 PL(0x1275);
27 /* name */
28 printf("PowerPC"); printf("%c", 0);
29
30/* descriptor */
31 /* real-mode */
32 PL(0xffffffff);
33 /* real-base */
34 PL(0x00c00000);
35 /* real-size */
36 PL(0xffffffff);
37 /* virt-base */
38 PL(0xffffffff);
39 /* virt-size */
40 PL(0xffffffff);
41 /* load-base */
42 PL(0x4000);
43 return 0;
44}
diff --git a/arch/ppc/boot/utils/mkprep.c b/arch/ppc/boot/utils/mkprep.c
new file mode 100644
index 000000000000..f6d5a2f2fcf6
--- /dev/null
+++ b/arch/ppc/boot/utils/mkprep.c
@@ -0,0 +1,293 @@
1/*
2 * Makes a prep bootable image which can be dd'd onto
3 * a disk device to make a bootdisk. Will take
4 * as input a elf executable, strip off the header
5 * and write out a boot image as:
6 * 1) default - strips elf header
7 * suitable as a network boot image
8 * 2) -pbp - strips elf header and writes out prep boot partition image
9 * cat or dd onto disk for booting
10 * 3) -asm - strips elf header and writes out as asm data
11 * useful for generating data for a compressed image
12 * -- Cort
13 *
14 * Modified for x86 hosted builds by Matt Porter <porter@neta.com>
15 * Modified for Sparc hosted builds by Peter Wahl <PeterWahl@web.de>
16 */
17
18#include <fcntl.h>
19#include <stdio.h>
20#include <stdlib.h>
21#include <string.h>
22#include <strings.h>
23#include <sys/stat.h>
24#include <unistd.h>
25
26#define cpu_to_le32(x) le32_to_cpu((x))
27unsigned long le32_to_cpu(unsigned long x)
28{
29 return (((x & 0x000000ffU) << 24) |
30 ((x & 0x0000ff00U) << 8) |
31 ((x & 0x00ff0000U) >> 8) |
32 ((x & 0xff000000U) >> 24));
33}
34
35
36#define cpu_to_le16(x) le16_to_cpu((x))
37unsigned short le16_to_cpu(unsigned short x)
38{
39 return (((x & 0x00ff) << 8) |
40 ((x & 0xff00) >> 8));
41}
42
43#define cpu_to_be32(x) (x)
44#define be32_to_cpu(x) (x)
45#define cpu_to_be16(x) (x)
46#define be16_to_cpu(x) (x)
47
48/* size of read buffer */
49#define SIZE 0x1000
50
51
52typedef unsigned long dword_t;
53typedef unsigned short word_t;
54typedef unsigned char byte_t;
55typedef byte_t block_t[512];
56typedef byte_t page_t[4096];
57
58
59/*
60 * Partition table entry
61 * - from the PReP spec
62 */
63typedef struct partition_entry {
64 byte_t boot_indicator;
65 byte_t starting_head;
66 byte_t starting_sector;
67 byte_t starting_cylinder;
68
69 byte_t system_indicator;
70 byte_t ending_head;
71 byte_t ending_sector;
72 byte_t ending_cylinder;
73
74 dword_t beginning_sector;
75 dword_t number_of_sectors;
76} partition_entry_t;
77
78#define BootActive 0x80
79#define SystemPrep 0x41
80
81void copy_image(int , int);
82void write_prep_partition(int , int );
83void write_asm_data( int in, int out );
84
85unsigned int elfhdr_size = 65536;
86
87int main(int argc, char *argv[])
88{
89 int in_fd, out_fd;
90 int argptr = 1;
91 unsigned int prep = 0;
92 unsigned int asmoutput = 0;
93
94 if ( (argc < 3) || (argc > 4) )
95 {
96 fprintf(stderr, "usage: %s [-pbp] [-asm] <boot-file> <image>\n",argv[0]);
97 exit(-1);
98 }
99
100 /* needs to handle args more elegantly -- but this is a small/simple program */
101
102 /* check for -pbp */
103 if ( !strcmp( argv[argptr], "-pbp" ) )
104 {
105 prep = 1;
106 argptr++;
107 }
108
109 /* check for -asm */
110 if ( !strcmp( argv[argptr], "-asm" ) )
111 {
112 asmoutput = 1;
113 argptr++;
114 }
115
116 /* input file */
117 if ( !strcmp( argv[argptr], "-" ) )
118 in_fd = 0; /* stdin */
119 else
120 if ((in_fd = open( argv[argptr] , 0)) < 0)
121 exit(-1);
122 argptr++;
123
124 /* output file */
125 if ( !strcmp( argv[argptr], "-" ) )
126 out_fd = 1; /* stdout */
127 else
128 if ((out_fd = creat( argv[argptr] , 0755)) < 0)
129 exit(-1);
130 argptr++;
131
132 /* skip elf header in input file */
133 /*if ( !prep )*/
134 lseek(in_fd, elfhdr_size, SEEK_SET);
135
136 /* write prep partition if necessary */
137 if ( prep )
138 write_prep_partition( in_fd, out_fd );
139
140 /* write input image to bootimage */
141 if ( asmoutput )
142 write_asm_data( in_fd, out_fd );
143 else
144 copy_image(in_fd, out_fd);
145
146 return 0;
147}
148
149void write_prep_partition(int in, int out)
150{
151 unsigned char block[512];
152 partition_entry_t pe;
153 dword_t *entry = (dword_t *)&block[0];
154 dword_t *length = (dword_t *)&block[sizeof(long)];
155 struct stat info;
156
157 if (fstat(in, &info) < 0)
158 {
159 fprintf(stderr,"info failed\n");
160 exit(-1);
161 }
162
163 bzero( block, sizeof block );
164
165 /* set entry point and boot image size skipping over elf header */
166#ifdef __i386__
167 *entry = 0x400/*+65536*/;
168 *length = info.st_size-elfhdr_size+0x400;
169#else
170 *entry = cpu_to_le32(0x400/*+65536*/);
171 *length = cpu_to_le32(info.st_size-elfhdr_size+0x400);
172#endif /* __i386__ */
173
174 /* sets magic number for msdos partition (used by linux) */
175 block[510] = 0x55;
176 block[511] = 0xAA;
177
178 /*
179 * Build a "PReP" partition table entry in the boot record
180 * - "PReP" may only look at the system_indicator
181 */
182 pe.boot_indicator = BootActive;
183 pe.system_indicator = SystemPrep;
184 /*
185 * The first block of the diskette is used by this "boot record" which
186 * actually contains the partition table. (The first block of the
187 * partition contains the boot image, but I digress...) We'll set up
188 * one partition on the diskette and it shall contain the rest of the
189 * diskette.
190 */
191 pe.starting_head = 0; /* zero-based */
192 pe.starting_sector = 2; /* one-based */
193 pe.starting_cylinder = 0; /* zero-based */
194 pe.ending_head = 1; /* assumes two heads */
195 pe.ending_sector = 18; /* assumes 18 sectors/track */
196 pe.ending_cylinder = 79; /* assumes 80 cylinders/diskette */
197
198 /*
199 * The "PReP" software ignores the above fields and just looks at
200 * the next two.
201 * - size of the diskette is (assumed to be)
202 * (2 tracks/cylinder)(18 sectors/tracks)(80 cylinders/diskette)
203 * - unlike the above sector numbers, the beginning sector is zero-based!
204 */
205#if 0
206 pe.beginning_sector = cpu_to_le32(1);
207#else
208 /* This has to be 0 on the PowerStack? */
209#ifdef __i386__
210 pe.beginning_sector = 0;
211#else
212 pe.beginning_sector = cpu_to_le32(0);
213#endif /* __i386__ */
214#endif
215
216#ifdef __i386__
217 pe.number_of_sectors = 2*18*80-1;
218#else
219 pe.number_of_sectors = cpu_to_le32(2*18*80-1);
220#endif /* __i386__ */
221
222 memcpy(&block[0x1BE], &pe, sizeof(pe));
223
224 write( out, block, sizeof(block) );
225 write( out, entry, sizeof(*entry) );
226 write( out, length, sizeof(*length) );
227 /* set file position to 2nd sector where image will be written */
228 lseek( out, 0x400, SEEK_SET );
229}
230
231
232
233void
234copy_image(int in, int out)
235{
236 char buf[SIZE];
237 int n;
238
239 while ( (n = read(in, buf, SIZE)) > 0 )
240 write(out, buf, n);
241}
242
243
244void
245write_asm_data( int in, int out )
246{
247 int i, cnt, pos, len;
248 unsigned int cksum, val;
249 unsigned char *lp;
250 unsigned char buf[SIZE];
251 unsigned char str[256];
252
253 write( out, "\t.data\n\t.globl input_data\ninput_data:\n",
254 strlen( "\t.data\n\t.globl input_data\ninput_data:\n" ) );
255 pos = 0;
256 cksum = 0;
257 while ((len = read(in, buf, sizeof(buf))) > 0)
258 {
259 cnt = 0;
260 lp = (unsigned char *)buf;
261 len = (len + 3) & ~3; /* Round up to longwords */
262 for (i = 0; i < len; i += 4)
263 {
264 if (cnt == 0)
265 {
266 write( out, "\t.long\t", strlen( "\t.long\t" ) );
267 }
268 sprintf( str, "0x%02X%02X%02X%02X", lp[0], lp[1], lp[2], lp[3]);
269 write( out, str, strlen(str) );
270 val = *(unsigned long *)lp;
271 cksum ^= val;
272 lp += 4;
273 if (++cnt == 4)
274 {
275 cnt = 0;
276 sprintf( str, " # %x \n", pos+i-12);
277 write( out, str, strlen(str) );
278 } else
279 {
280 write( out, ",", 1 );
281 }
282 }
283 if (cnt)
284 {
285 write( out, "0\n", 2 );
286 }
287 pos += len;
288 }
289 sprintf(str, "\t.globl input_len\ninput_len:\t.long\t0x%x\n", pos);
290 write( out, str, strlen(str) );
291
292 fprintf(stderr, "cksum = %x\n", cksum);
293}
diff --git a/arch/ppc/boot/utils/mktree.c b/arch/ppc/boot/utils/mktree.c
new file mode 100644
index 000000000000..2be22e28f2b3
--- /dev/null
+++ b/arch/ppc/boot/utils/mktree.c
@@ -0,0 +1,152 @@
1/*
2 * Makes a tree bootable image for IBM Evaluation boards.
3 * Basically, just take a zImage, skip the ELF header, and stuff
4 * a 32 byte header on the front.
5 *
6 * We use htonl, which is a network macro, to make sure we're doing
7 * The Right Thing on an LE machine. It's non-obvious, but it should
8 * work on anything BSD'ish.
9 */
10
11#include <fcntl.h>
12#include <stdio.h>
13#include <stdlib.h>
14#include <string.h>
15#include <sys/stat.h>
16#include <unistd.h>
17#include <netinet/in.h>
18#ifdef __sun__
19#include <inttypes.h>
20#else
21#include <stdint.h>
22#endif
23
24/* This gets tacked on the front of the image. There are also a few
25 * bytes allocated after the _start label used by the boot rom (see
26 * head.S for details).
27 */
28typedef struct boot_block {
29 uint32_t bb_magic; /* 0x0052504F */
30 uint32_t bb_dest; /* Target address of the image */
31 uint32_t bb_num_512blocks; /* Size, rounded-up, in 512 byte blks */
32 uint32_t bb_debug_flag; /* Run debugger or image after load */
33 uint32_t bb_entry_point; /* The image address to start */
34 uint32_t bb_checksum; /* 32 bit checksum including header */
35 uint32_t reserved[2];
36} boot_block_t;
37
38#define IMGBLK 512
39char tmpbuf[IMGBLK];
40
41int main(int argc, char *argv[])
42{
43 int in_fd, out_fd;
44 int nblks, i;
45 uint cksum, *cp;
46 struct stat st;
47 boot_block_t bt;
48
49 if (argc < 3) {
50 fprintf(stderr, "usage: %s <zImage-file> <boot-image> [entry-point]\n",argv[0]);
51 exit(1);
52 }
53
54 if (stat(argv[1], &st) < 0) {
55 perror("stat");
56 exit(2);
57 }
58
59 nblks = (st.st_size + IMGBLK) / IMGBLK;
60
61 bt.bb_magic = htonl(0x0052504F);
62
63 /* If we have the optional entry point parameter, use it */
64 if (argc == 4)
65 bt.bb_dest = bt.bb_entry_point = htonl(strtoul(argv[3], NULL, 0));
66 else
67 bt.bb_dest = bt.bb_entry_point = htonl(0x500000);
68
69 /* We know these from the linker command.
70 * ...and then move it up into memory a little more so the
71 * relocation can happen.
72 */
73 bt.bb_num_512blocks = htonl(nblks);
74 bt.bb_debug_flag = 0;
75
76 bt.bb_checksum = 0;
77
78 /* To be neat and tidy :-).
79 */
80 bt.reserved[0] = 0;
81 bt.reserved[1] = 0;
82
83 if ((in_fd = open(argv[1], O_RDONLY)) < 0) {
84 perror("zImage open");
85 exit(3);
86 }
87
88 if ((out_fd = open(argv[2], (O_RDWR | O_CREAT | O_TRUNC), 0666)) < 0) {
89 perror("bootfile open");
90 exit(3);
91 }
92
93 cksum = 0;
94 cp = (void *)&bt;
95 for (i=0; i<sizeof(bt)/sizeof(uint); i++)
96 cksum += *cp++;
97
98 /* Assume zImage is an ELF file, and skip the 64K header.
99 */
100 if (read(in_fd, tmpbuf, IMGBLK) != IMGBLK) {
101 fprintf(stderr, "%s is too small to be an ELF image\n",
102 argv[1]);
103 exit(4);
104 }
105
106 if ((*(uint *)tmpbuf) != htonl(0x7f454c46)) {
107 fprintf(stderr, "%s is not an ELF image\n", argv[1]);
108 exit(4);
109 }
110
111 if (lseek(in_fd, (64 * 1024), SEEK_SET) < 0) {
112 fprintf(stderr, "%s failed to seek in ELF image\n", argv[1]);
113 exit(4);
114 }
115
116 nblks -= (64 * 1024) / IMGBLK;
117
118 /* And away we go......
119 */
120 if (write(out_fd, &bt, sizeof(bt)) != sizeof(bt)) {
121 perror("boot-image write");
122 exit(5);
123 }
124
125 while (nblks-- > 0) {
126 if (read(in_fd, tmpbuf, IMGBLK) < 0) {
127 perror("zImage read");
128 exit(5);
129 }
130 cp = (uint *)tmpbuf;
131 for (i=0; i<sizeof(tmpbuf)/sizeof(uint); i++)
132 cksum += *cp++;
133 if (write(out_fd, tmpbuf, sizeof(tmpbuf)) != sizeof(tmpbuf)) {
134 perror("boot-image write");
135 exit(5);
136 }
137 }
138
139 /* rewrite the header with the computed checksum.
140 */
141 bt.bb_checksum = htonl(cksum);
142 if (lseek(out_fd, 0, SEEK_SET) < 0) {
143 perror("rewrite seek");
144 exit(1);
145 }
146 if (write(out_fd, &bt, sizeof(bt)) != sizeof(bt)) {
147 perror("boot-image rewrite");
148 exit(1);
149 }
150
151 exit(0);
152}
diff --git a/arch/ppc/configs/FADS_defconfig b/arch/ppc/configs/FADS_defconfig
new file mode 100644
index 000000000000..c1934f828a4b
--- /dev/null
+++ b/arch/ppc/configs/FADS_defconfig
@@ -0,0 +1,520 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7
8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12
13#
14# General setup
15#
16CONFIG_SWAP=y
17CONFIG_SYSVIPC=y
18# CONFIG_BSD_PROCESS_ACCT is not set
19CONFIG_SYSCTL=y
20CONFIG_LOG_BUF_SHIFT=14
21CONFIG_EMBEDDED=y
22CONFIG_FUTEX=y
23# CONFIG_EPOLL is not set
24
25#
26# Loadable module support
27#
28CONFIG_MODULES=y
29CONFIG_MODULE_UNLOAD=y
30# CONFIG_MODULE_FORCE_UNLOAD is not set
31CONFIG_OBSOLETE_MODPARM=y
32# CONFIG_MODVERSIONS is not set
33CONFIG_KMOD=y
34
35#
36# Platform support
37#
38CONFIG_PPC=y
39CONFIG_PPC32=y
40# CONFIG_6xx is not set
41# CONFIG_40x is not set
42# CONFIG_POWER3 is not set
43CONFIG_8xx=y
44
45#
46# IBM 4xx options
47#
48CONFIG_EMBEDDEDBOOT=y
49CONFIG_SERIAL_CONSOLE=y
50CONFIG_NOT_COHERENT_CACHE=y
51# CONFIG_RPXLITE is not set
52# CONFIG_RPXCLASSIC is not set
53# CONFIG_BSEIP is not set
54CONFIG_FADS=y
55# CONFIG_TQM823L is not set
56# CONFIG_TQM850L is not set
57# CONFIG_TQM855L is not set
58# CONFIG_TQM860L is not set
59# CONFIG_FPS850L is not set
60# CONFIG_SPD823TS is not set
61# CONFIG_IVMS8 is not set
62# CONFIG_IVML24 is not set
63# CONFIG_SM850 is not set
64# CONFIG_HERMES_PRO is not set
65# CONFIG_IP860 is not set
66# CONFIG_LWMON is not set
67# CONFIG_PCU_E is not set
68# CONFIG_CCM is not set
69# CONFIG_LANTEC is not set
70# CONFIG_MBX is not set
71# CONFIG_WINCEPT is not set
72# CONFIG_SMP is not set
73# CONFIG_PREEMPT is not set
74CONFIG_MATH_EMULATION=y
75# CONFIG_CPU_FREQ is not set
76
77#
78# General setup
79#
80# CONFIG_HIGHMEM is not set
81# CONFIG_PCI is not set
82# CONFIG_PCI_DOMAINS is not set
83# CONFIG_PCI_QSPAN is not set
84CONFIG_KCORE_ELF=y
85CONFIG_BINFMT_ELF=y
86CONFIG_KERNEL_ELF=y
87# CONFIG_BINFMT_MISC is not set
88# CONFIG_HOTPLUG is not set
89
90#
91# Parallel port support
92#
93# CONFIG_PARPORT is not set
94# CONFIG_CMDLINE_BOOL is not set
95
96#
97# Advanced setup
98#
99# CONFIG_ADVANCED_OPTIONS is not set
100
101#
102# Default settings for advanced configuration options are used
103#
104CONFIG_HIGHMEM_START=0xfe000000
105CONFIG_LOWMEM_SIZE=0x30000000
106CONFIG_KERNEL_START=0xc0000000
107CONFIG_TASK_SIZE=0x80000000
108CONFIG_BOOT_LOAD=0x00400000
109
110#
111# Memory Technology Devices (MTD)
112#
113# CONFIG_MTD is not set
114
115#
116# Plug and Play support
117#
118# CONFIG_PNP is not set
119
120#
121# Block devices
122#
123# CONFIG_BLK_DEV_FD is not set
124# CONFIG_BLK_DEV_LOOP is not set
125# CONFIG_BLK_DEV_NBD is not set
126# CONFIG_BLK_DEV_RAM is not set
127# CONFIG_BLK_DEV_INITRD is not set
128
129#
130# Multi-device support (RAID and LVM)
131#
132# CONFIG_MD is not set
133
134#
135# ATA/IDE/MFM/RLL support
136#
137# CONFIG_IDE is not set
138
139#
140# SCSI support
141#
142# CONFIG_SCSI is not set
143
144#
145# Fusion MPT device support
146#
147
148#
149# I2O device support
150#
151
152#
153# Networking support
154#
155CONFIG_NET=y
156
157#
158# Networking options
159#
160CONFIG_PACKET=y
161# CONFIG_PACKET_MMAP is not set
162# CONFIG_NETLINK_DEV is not set
163# CONFIG_NETFILTER is not set
164CONFIG_UNIX=y
165# CONFIG_NET_KEY is not set
166CONFIG_INET=y
167# CONFIG_IP_MULTICAST is not set
168# CONFIG_IP_ADVANCED_ROUTER is not set
169CONFIG_IP_PNP=y
170CONFIG_IP_PNP_DHCP=y
171CONFIG_IP_PNP_BOOTP=y
172# CONFIG_IP_PNP_RARP is not set
173# CONFIG_NET_IPIP is not set
174# CONFIG_NET_IPGRE is not set
175# CONFIG_ARPD is not set
176# CONFIG_INET_ECN is not set
177# CONFIG_SYN_COOKIES is not set
178# CONFIG_INET_AH is not set
179# CONFIG_INET_ESP is not set
180# CONFIG_INET_IPCOMP is not set
181# CONFIG_IPV6 is not set
182# CONFIG_XFRM_USER is not set
183
184#
185# SCTP Configuration (EXPERIMENTAL)
186#
187CONFIG_IPV6_SCTP__=y
188# CONFIG_IP_SCTP is not set
189# CONFIG_ATM is not set
190# CONFIG_VLAN_8021Q is not set
191# CONFIG_LLC is not set
192# CONFIG_DECNET is not set
193# CONFIG_BRIDGE is not set
194# CONFIG_X25 is not set
195# CONFIG_LAPB is not set
196# CONFIG_NET_DIVERT is not set
197# CONFIG_ECONET is not set
198# CONFIG_WAN_ROUTER is not set
199# CONFIG_NET_HW_FLOWCONTROL is not set
200
201#
202# QoS and/or fair queueing
203#
204# CONFIG_NET_SCHED is not set
205
206#
207# Network testing
208#
209# CONFIG_NET_PKTGEN is not set
210CONFIG_NETDEVICES=y
211# CONFIG_DUMMY is not set
212# CONFIG_BONDING is not set
213# CONFIG_EQUALIZER is not set
214# CONFIG_TUN is not set
215# CONFIG_ETHERTAP is not set
216
217#
218# Ethernet (10 or 100Mbit)
219#
220CONFIG_NET_ETHERNET=y
221# CONFIG_MII is not set
222# CONFIG_OAKNET is not set
223
224#
225# Ethernet (1000 Mbit)
226#
227
228#
229# Ethernet (10000 Mbit)
230#
231# CONFIG_PPP is not set
232# CONFIG_SLIP is not set
233
234#
235# Wireless LAN (non-hamradio)
236#
237# CONFIG_NET_RADIO is not set
238
239#
240# Token Ring devices (depends on LLC=y)
241#
242# CONFIG_SHAPER is not set
243
244#
245# Wan interfaces
246#
247# CONFIG_WAN is not set
248
249#
250# Amateur Radio support
251#
252# CONFIG_HAMRADIO is not set
253
254#
255# IrDA (infrared) support
256#
257# CONFIG_IRDA is not set
258
259#
260# ISDN subsystem
261#
262# CONFIG_ISDN_BOOL is not set
263
264#
265# Graphics support
266#
267# CONFIG_FB is not set
268
269#
270# Old CD-ROM drivers (not SCSI, not IDE)
271#
272# CONFIG_CD_NO_IDESCSI is not set
273
274#
275# Input device support
276#
277# CONFIG_INPUT is not set
278
279#
280# Userland interfaces
281#
282
283#
284# Input I/O drivers
285#
286# CONFIG_GAMEPORT is not set
287CONFIG_SOUND_GAMEPORT=y
288# CONFIG_SERIO is not set
289
290#
291# Input Device Drivers
292#
293
294#
295# Macintosh device drivers
296#
297
298#
299# Serial drivers
300#
301# CONFIG_SERIAL_8250 is not set
302
303#
304# Non-8250 serial port support
305#
306CONFIG_SERIAL_CORE=y
307CONFIG_SERIAL_CORE_CONSOLE=y
308CONFIG_SERIAL_CPM=y
309CONFIG_SERIAL_CPM_CONSOLE=y
310# CONFIG_SERIAL_CPM_SCC1 is not set
311# CONFIG_SERIAL_CPM_SCC2 is not set
312# CONFIG_SERIAL_CPM_SCC3 is not set
313# CONFIG_SERIAL_CPM_SCC4 is not set
314CONFIG_SERIAL_CPM_SMC1=y
315CONFIG_SERIAL_CPM_SMC2=y
316# CONFIG_SERIAL_CPM_ALT_SMC2 is not set
317CONFIG_UNIX98_PTYS=y
318# CONFIG_LEGACY_PTYS is not set
319
320#
321# I2C support
322#
323# CONFIG_I2C is not set
324
325#
326# I2C Hardware Sensors Mainboard support
327#
328
329#
330# I2C Hardware Sensors Chip support
331#
332# CONFIG_I2C_SENSOR is not set
333
334#
335# Mice
336#
337# CONFIG_BUSMOUSE is not set
338# CONFIG_QIC02_TAPE is not set
339
340#
341# IPMI
342#
343# CONFIG_IPMI_HANDLER is not set
344
345#
346# Watchdog Cards
347#
348# CONFIG_WATCHDOG is not set
349# CONFIG_NVRAM is not set
350CONFIG_GEN_RTC=y
351# CONFIG_GEN_RTC_X is not set
352# CONFIG_DTLK is not set
353# CONFIG_R3964 is not set
354# CONFIG_APPLICOM is not set
355
356#
357# Ftape, the floppy tape device driver
358#
359# CONFIG_FTAPE is not set
360# CONFIG_AGP is not set
361# CONFIG_DRM is not set
362# CONFIG_RAW_DRIVER is not set
363# CONFIG_HANGCHECK_TIMER is not set
364
365#
366# Multimedia devices
367#
368# CONFIG_VIDEO_DEV is not set
369
370#
371# Digital Video Broadcasting Devices
372#
373# CONFIG_DVB is not set
374
375#
376# File systems
377#
378# CONFIG_EXT2_FS is not set
379CONFIG_EXT3_FS=y
380CONFIG_EXT3_FS_XATTR=y
381# CONFIG_EXT3_FS_POSIX_ACL is not set
382# CONFIG_EXT3_FS_SECURITY is not set
383CONFIG_JBD=y
384# CONFIG_JBD_DEBUG is not set
385CONFIG_FS_MBCACHE=y
386# CONFIG_REISERFS_FS is not set
387# CONFIG_JFS_FS is not set
388# CONFIG_XFS_FS is not set
389# CONFIG_MINIX_FS is not set
390# CONFIG_ROMFS_FS is not set
391# CONFIG_QUOTA is not set
392# CONFIG_AUTOFS_FS is not set
393# CONFIG_AUTOFS4_FS is not set
394
395#
396# CD-ROM/DVD Filesystems
397#
398# CONFIG_ISO9660_FS is not set
399# CONFIG_UDF_FS is not set
400
401#
402# DOS/FAT/NT Filesystems
403#
404# CONFIG_FAT_FS is not set
405# CONFIG_NTFS_FS is not set
406
407#
408# Pseudo filesystems
409#
410CONFIG_PROC_FS=y
411# CONFIG_DEVFS_FS is not set
412CONFIG_DEVPTS_FS=y
413# CONFIG_DEVPTS_FS_XATTR is not set
414# CONFIG_TMPFS is not set
415CONFIG_RAMFS=y
416
417#
418# Miscellaneous filesystems
419#
420# CONFIG_ADFS_FS is not set
421# CONFIG_AFFS_FS is not set
422# CONFIG_HFS_FS is not set
423# CONFIG_BEFS_FS is not set
424# CONFIG_BFS_FS is not set
425# CONFIG_EFS_FS is not set
426# CONFIG_CRAMFS is not set
427# CONFIG_VXFS_FS is not set
428# CONFIG_HPFS_FS is not set
429# CONFIG_QNX4FS_FS is not set
430# CONFIG_SYSV_FS is not set
431# CONFIG_UFS_FS is not set
432
433#
434# Network File Systems
435#
436CONFIG_NFS_FS=y
437# CONFIG_NFS_V3 is not set
438# CONFIG_NFS_V4 is not set
439# CONFIG_NFSD is not set
440CONFIG_ROOT_NFS=y
441CONFIG_LOCKD=y
442# CONFIG_EXPORTFS is not set
443CONFIG_SUNRPC=y
444# CONFIG_SUNRPC_GSS is not set
445# CONFIG_SMB_FS is not set
446# CONFIG_CIFS is not set
447# CONFIG_NCP_FS is not set
448# CONFIG_CODA_FS is not set
449# CONFIG_INTERMEZZO_FS is not set
450# CONFIG_AFS_FS is not set
451
452#
453# Partition Types
454#
455CONFIG_PARTITION_ADVANCED=y
456# CONFIG_ACORN_PARTITION is not set
457# CONFIG_OSF_PARTITION is not set
458# CONFIG_AMIGA_PARTITION is not set
459# CONFIG_ATARI_PARTITION is not set
460# CONFIG_MAC_PARTITION is not set
461# CONFIG_MSDOS_PARTITION is not set
462# CONFIG_LDM_PARTITION is not set
463# CONFIG_NEC98_PARTITION is not set
464# CONFIG_SGI_PARTITION is not set
465# CONFIG_ULTRIX_PARTITION is not set
466# CONFIG_SUN_PARTITION is not set
467# CONFIG_EFI_PARTITION is not set
468
469#
470# Sound
471#
472# CONFIG_SOUND is not set
473
474#
475# MPC8xx CPM Options
476#
477CONFIG_SCC_ENET=y
478CONFIG_SCC1_ENET=y
479# CONFIG_SCC2_ENET is not set
480# CONFIG_SCC3_ENET is not set
481# CONFIG_FEC_ENET is not set
482CONFIG_ENET_BIG_BUFFERS=y
483
484#
485# Generic MPC8xx Options
486#
487CONFIG_8xx_COPYBACK=y
488# CONFIG_8xx_CPU6 is not set
489# CONFIG_UCODE_PATCH is not set
490
491#
492# USB support
493#
494# CONFIG_USB_GADGET is not set
495
496#
497# Bluetooth support
498#
499# CONFIG_BT is not set
500
501#
502# Library routines
503#
504# CONFIG_CRC32 is not set
505
506#
507# Kernel hacking
508#
509# CONFIG_DEBUG_KERNEL is not set
510# CONFIG_KALLSYMS is not set
511
512#
513# Security options
514#
515# CONFIG_SECURITY is not set
516
517#
518# Cryptographic options
519#
520# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/IVMS8_defconfig b/arch/ppc/configs/IVMS8_defconfig
new file mode 100644
index 000000000000..66bbefe8e9b3
--- /dev/null
+++ b/arch/ppc/configs/IVMS8_defconfig
@@ -0,0 +1,548 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7
8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12
13#
14# General setup
15#
16CONFIG_SWAP=y
17CONFIG_SYSVIPC=y
18# CONFIG_BSD_PROCESS_ACCT is not set
19CONFIG_SYSCTL=y
20CONFIG_LOG_BUF_SHIFT=14
21CONFIG_EMBEDDED=y
22CONFIG_FUTEX=y
23# CONFIG_EPOLL is not set
24
25#
26# Loadable module support
27#
28CONFIG_MODULES=y
29CONFIG_MODULE_UNLOAD=y
30# CONFIG_MODULE_FORCE_UNLOAD is not set
31CONFIG_OBSOLETE_MODPARM=y
32# CONFIG_MODVERSIONS is not set
33CONFIG_KMOD=y
34
35#
36# Platform support
37#
38CONFIG_PPC=y
39CONFIG_PPC32=y
40# CONFIG_6xx is not set
41# CONFIG_40x is not set
42# CONFIG_POWER3 is not set
43CONFIG_8xx=y
44
45#
46# IBM 4xx options
47#
48CONFIG_EMBEDDEDBOOT=y
49CONFIG_SERIAL_CONSOLE=y
50CONFIG_NOT_COHERENT_CACHE=y
51# CONFIG_RPXLITE is not set
52# CONFIG_RPXCLASSIC is not set
53# CONFIG_BSEIP is not set
54# CONFIG_FADS is not set
55# CONFIG_TQM823L is not set
56# CONFIG_TQM850L is not set
57# CONFIG_TQM855L is not set
58# CONFIG_TQM860L is not set
59# CONFIG_FPS850L is not set
60# CONFIG_SPD823TS is not set
61CONFIG_IVMS8=y
62# CONFIG_IVML24 is not set
63# CONFIG_SM850 is not set
64# CONFIG_HERMES_PRO is not set
65# CONFIG_IP860 is not set
66# CONFIG_LWMON is not set
67# CONFIG_PCU_E is not set
68# CONFIG_CCM is not set
69# CONFIG_LANTEC is not set
70# CONFIG_MBX is not set
71# CONFIG_WINCEPT is not set
72# CONFIG_SMP is not set
73# CONFIG_PREEMPT is not set
74CONFIG_MATH_EMULATION=y
75# CONFIG_CPU_FREQ is not set
76
77#
78# General setup
79#
80# CONFIG_HIGHMEM is not set
81# CONFIG_PCI is not set
82# CONFIG_PCI_DOMAINS is not set
83# CONFIG_PCI_QSPAN is not set
84CONFIG_KCORE_ELF=y
85CONFIG_BINFMT_ELF=y
86CONFIG_KERNEL_ELF=y
87# CONFIG_BINFMT_MISC is not set
88# CONFIG_HOTPLUG is not set
89
90#
91# Parallel port support
92#
93# CONFIG_PARPORT is not set
94# CONFIG_CMDLINE_BOOL is not set
95
96#
97# Advanced setup
98#
99# CONFIG_ADVANCED_OPTIONS is not set
100
101#
102# Default settings for advanced configuration options are used
103#
104CONFIG_HIGHMEM_START=0xfe000000
105CONFIG_LOWMEM_SIZE=0x30000000
106CONFIG_KERNEL_START=0xc0000000
107CONFIG_TASK_SIZE=0x80000000
108CONFIG_BOOT_LOAD=0x00400000
109
110#
111# Memory Technology Devices (MTD)
112#
113# CONFIG_MTD is not set
114
115#
116# Plug and Play support
117#
118# CONFIG_PNP is not set
119
120#
121# Block devices
122#
123# CONFIG_BLK_DEV_FD is not set
124# CONFIG_BLK_DEV_LOOP is not set
125# CONFIG_BLK_DEV_NBD is not set
126# CONFIG_BLK_DEV_RAM is not set
127# CONFIG_BLK_DEV_INITRD is not set
128
129#
130# Multi-device support (RAID and LVM)
131#
132# CONFIG_MD is not set
133
134#
135# ATA/IDE/MFM/RLL support
136#
137CONFIG_IDE=y
138
139#
140# IDE, ATA and ATAPI Block devices
141#
142CONFIG_BLK_DEV_IDE=y
143
144#
145# Please see Documentation/ide.txt for help/info on IDE drives
146#
147# CONFIG_BLK_DEV_HD is not set
148CONFIG_BLK_DEV_IDEDISK=y
149CONFIG_IDEDISK_MULTI_MODE=y
150# CONFIG_IDEDISK_STROKE is not set
151CONFIG_BLK_DEV_IDECD=y
152# CONFIG_BLK_DEV_IDEFLOPPY is not set
153# CONFIG_IDE_TASK_IOCTL is not set
154
155#
156# IDE chipset support/bugfixes
157#
158CONFIG_BLK_DEV_MPC8xx_IDE=y
159CONFIG_IDE_8xx_PCCARD=y
160# CONFIG_IDE_8xx_DIRECT is not set
161# CONFIG_IDE_EXT_DIRECT is not set
162
163#
164# SCSI support
165#
166# CONFIG_SCSI is not set
167
168#
169# Fusion MPT device support
170#
171
172#
173# I2O device support
174#
175
176#
177# Networking support
178#
179CONFIG_NET=y
180
181#
182# Networking options
183#
184CONFIG_PACKET=y
185# CONFIG_PACKET_MMAP is not set
186# CONFIG_NETLINK_DEV is not set
187# CONFIG_NETFILTER is not set
188CONFIG_UNIX=y
189# CONFIG_NET_KEY is not set
190CONFIG_INET=y
191# CONFIG_IP_MULTICAST is not set
192# CONFIG_IP_ADVANCED_ROUTER is not set
193CONFIG_IP_PNP=y
194CONFIG_IP_PNP_DHCP=y
195# CONFIG_IP_PNP_BOOTP is not set
196# CONFIG_IP_PNP_RARP is not set
197# CONFIG_NET_IPIP is not set
198# CONFIG_NET_IPGRE is not set
199# CONFIG_ARPD is not set
200# CONFIG_INET_ECN is not set
201# CONFIG_SYN_COOKIES is not set
202# CONFIG_INET_AH is not set
203# CONFIG_INET_ESP is not set
204# CONFIG_INET_IPCOMP is not set
205# CONFIG_IPV6 is not set
206# CONFIG_XFRM_USER is not set
207
208#
209# SCTP Configuration (EXPERIMENTAL)
210#
211CONFIG_IPV6_SCTP__=y
212# CONFIG_IP_SCTP is not set
213# CONFIG_ATM is not set
214# CONFIG_VLAN_8021Q is not set
215# CONFIG_LLC is not set
216# CONFIG_DECNET is not set
217# CONFIG_BRIDGE is not set
218# CONFIG_X25 is not set
219# CONFIG_LAPB is not set
220# CONFIG_NET_DIVERT is not set
221# CONFIG_ECONET is not set
222# CONFIG_WAN_ROUTER is not set
223# CONFIG_NET_HW_FLOWCONTROL is not set
224
225#
226# QoS and/or fair queueing
227#
228# CONFIG_NET_SCHED is not set
229
230#
231# Network testing
232#
233# CONFIG_NET_PKTGEN is not set
234CONFIG_NETDEVICES=y
235# CONFIG_DUMMY is not set
236# CONFIG_BONDING is not set
237# CONFIG_EQUALIZER is not set
238# CONFIG_TUN is not set
239# CONFIG_ETHERTAP is not set
240
241#
242# Ethernet (10 or 100Mbit)
243#
244CONFIG_NET_ETHERNET=y
245# CONFIG_MII is not set
246# CONFIG_OAKNET is not set
247
248#
249# Ethernet (1000 Mbit)
250#
251
252#
253# Ethernet (10000 Mbit)
254#
255# CONFIG_PPP is not set
256# CONFIG_SLIP is not set
257
258#
259# Wireless LAN (non-hamradio)
260#
261# CONFIG_NET_RADIO is not set
262
263#
264# Token Ring devices (depends on LLC=y)
265#
266# CONFIG_SHAPER is not set
267
268#
269# Wan interfaces
270#
271# CONFIG_WAN is not set
272
273#
274# Amateur Radio support
275#
276# CONFIG_HAMRADIO is not set
277
278#
279# IrDA (infrared) support
280#
281# CONFIG_IRDA is not set
282
283#
284# ISDN subsystem
285#
286# CONFIG_ISDN_BOOL is not set
287
288#
289# Graphics support
290#
291# CONFIG_FB is not set
292
293#
294# Old CD-ROM drivers (not SCSI, not IDE)
295#
296# CONFIG_CD_NO_IDESCSI is not set
297
298#
299# Input device support
300#
301# CONFIG_INPUT is not set
302
303#
304# Userland interfaces
305#
306
307#
308# Input I/O drivers
309#
310# CONFIG_GAMEPORT is not set
311CONFIG_SOUND_GAMEPORT=y
312# CONFIG_SERIO is not set
313
314#
315# Input Device Drivers
316#
317
318#
319# Macintosh device drivers
320#
321
322#
323# Serial drivers
324#
325# CONFIG_SERIAL_8250 is not set
326
327#
328# Non-8250 serial port support
329#
330CONFIG_SERIAL_CORE=y
331CONFIG_SERIAL_CORE_CONSOLE=y
332CONFIG_SERIAL_CPM=y
333CONFIG_SERIAL_CPM_CONSOLE=y
334# CONFIG_SERIAL_CPM_SCC1 is not set
335# CONFIG_SERIAL_CPM_SCC2 is not set
336# CONFIG_SERIAL_CPM_SCC3 is not set
337# CONFIG_SERIAL_CPM_SCC4 is not set
338CONFIG_SERIAL_CPM_SMC1=y
339# CONFIG_SERIAL_CPM_SMC2 is not set
340CONFIG_UNIX98_PTYS=y
341# CONFIG_LEGACY_PTYS is not set
342
343#
344# I2C support
345#
346# CONFIG_I2C is not set
347
348#
349# I2C Hardware Sensors Mainboard support
350#
351
352#
353# I2C Hardware Sensors Chip support
354#
355# CONFIG_I2C_SENSOR is not set
356
357#
358# Mice
359#
360# CONFIG_BUSMOUSE is not set
361# CONFIG_QIC02_TAPE is not set
362
363#
364# IPMI
365#
366# CONFIG_IPMI_HANDLER is not set
367
368#
369# Watchdog Cards
370#
371# CONFIG_WATCHDOG is not set
372# CONFIG_NVRAM is not set
373CONFIG_GEN_RTC=y
374# CONFIG_GEN_RTC_X is not set
375# CONFIG_DTLK is not set
376# CONFIG_R3964 is not set
377# CONFIG_APPLICOM is not set
378
379#
380# Ftape, the floppy tape device driver
381#
382# CONFIG_FTAPE is not set
383# CONFIG_AGP is not set
384# CONFIG_DRM is not set
385# CONFIG_RAW_DRIVER is not set
386# CONFIG_HANGCHECK_TIMER is not set
387
388#
389# Multimedia devices
390#
391# CONFIG_VIDEO_DEV is not set
392
393#
394# Digital Video Broadcasting Devices
395#
396# CONFIG_DVB is not set
397
398#
399# File systems
400#
401CONFIG_EXT2_FS=y
402# CONFIG_EXT2_FS_XATTR is not set
403CONFIG_EXT3_FS=y
404CONFIG_EXT3_FS_XATTR=y
405# CONFIG_EXT3_FS_POSIX_ACL is not set
406# CONFIG_EXT3_FS_SECURITY is not set
407CONFIG_JBD=y
408# CONFIG_JBD_DEBUG is not set
409CONFIG_FS_MBCACHE=y
410# CONFIG_REISERFS_FS is not set
411# CONFIG_JFS_FS is not set
412# CONFIG_XFS_FS is not set
413# CONFIG_MINIX_FS is not set
414# CONFIG_ROMFS_FS is not set
415# CONFIG_QUOTA is not set
416# CONFIG_AUTOFS_FS is not set
417# CONFIG_AUTOFS4_FS is not set
418
419#
420# CD-ROM/DVD Filesystems
421#
422CONFIG_ISO9660_FS=y
423# CONFIG_JOLIET is not set
424# CONFIG_ZISOFS is not set
425# CONFIG_UDF_FS is not set
426
427#
428# DOS/FAT/NT Filesystems
429#
430# CONFIG_FAT_FS is not set
431# CONFIG_NTFS_FS is not set
432
433#
434# Pseudo filesystems
435#
436CONFIG_PROC_FS=y
437# CONFIG_DEVFS_FS is not set
438CONFIG_DEVPTS_FS=y
439# CONFIG_DEVPTS_FS_XATTR is not set
440CONFIG_TMPFS=y
441CONFIG_RAMFS=y
442
443#
444# Miscellaneous filesystems
445#
446# CONFIG_ADFS_FS is not set
447# CONFIG_AFFS_FS is not set
448# CONFIG_HFS_FS is not set
449# CONFIG_BEFS_FS is not set
450# CONFIG_BFS_FS is not set
451# CONFIG_EFS_FS is not set
452# CONFIG_CRAMFS is not set
453# CONFIG_VXFS_FS is not set
454# CONFIG_HPFS_FS is not set
455# CONFIG_QNX4FS_FS is not set
456# CONFIG_SYSV_FS is not set
457# CONFIG_UFS_FS is not set
458
459#
460# Network File Systems
461#
462CONFIG_NFS_FS=y
463# CONFIG_NFS_V3 is not set
464# CONFIG_NFS_V4 is not set
465# CONFIG_NFSD is not set
466CONFIG_ROOT_NFS=y
467CONFIG_LOCKD=y
468# CONFIG_EXPORTFS is not set
469CONFIG_SUNRPC=y
470# CONFIG_SUNRPC_GSS is not set
471# CONFIG_SMB_FS is not set
472# CONFIG_CIFS is not set
473# CONFIG_NCP_FS is not set
474# CONFIG_CODA_FS is not set
475# CONFIG_INTERMEZZO_FS is not set
476# CONFIG_AFS_FS is not set
477
478#
479# Partition Types
480#
481CONFIG_PARTITION_ADVANCED=y
482# CONFIG_ACORN_PARTITION is not set
483# CONFIG_OSF_PARTITION is not set
484# CONFIG_AMIGA_PARTITION is not set
485# CONFIG_ATARI_PARTITION is not set
486CONFIG_MAC_PARTITION=y
487# CONFIG_MSDOS_PARTITION is not set
488# CONFIG_LDM_PARTITION is not set
489# CONFIG_NEC98_PARTITION is not set
490# CONFIG_SGI_PARTITION is not set
491# CONFIG_ULTRIX_PARTITION is not set
492# CONFIG_SUN_PARTITION is not set
493# CONFIG_EFI_PARTITION is not set
494
495#
496# Sound
497#
498# CONFIG_SOUND is not set
499
500#
501# MPC8xx CPM Options
502#
503# CONFIG_SCC_ENET is not set
504CONFIG_FEC_ENET=y
505CONFIG_USE_MDIO=y
506CONFIG_FEC_AM79C874=y
507CONFIG_FEC_LXT970=y
508CONFIG_FEC_LXT971=y
509CONFIG_FEC_QS6612=y
510CONFIG_ENET_BIG_BUFFERS=y
511
512#
513# Generic MPC8xx Options
514#
515CONFIG_8xx_COPYBACK=y
516# CONFIG_8xx_CPU6 is not set
517# CONFIG_UCODE_PATCH is not set
518
519#
520# USB support
521#
522# CONFIG_USB_GADGET is not set
523
524#
525# Bluetooth support
526#
527# CONFIG_BT is not set
528
529#
530# Library routines
531#
532# CONFIG_CRC32 is not set
533
534#
535# Kernel hacking
536#
537# CONFIG_DEBUG_KERNEL is not set
538# CONFIG_KALLSYMS is not set
539
540#
541# Security options
542#
543# CONFIG_SECURITY is not set
544
545#
546# Cryptographic options
547#
548# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/SM850_defconfig b/arch/ppc/configs/SM850_defconfig
new file mode 100644
index 000000000000..021884b43029
--- /dev/null
+++ b/arch/ppc/configs/SM850_defconfig
@@ -0,0 +1,522 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7
8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12
13#
14# General setup
15#
16CONFIG_SWAP=y
17CONFIG_SYSVIPC=y
18# CONFIG_BSD_PROCESS_ACCT is not set
19CONFIG_SYSCTL=y
20CONFIG_LOG_BUF_SHIFT=14
21CONFIG_EMBEDDED=y
22CONFIG_FUTEX=y
23# CONFIG_EPOLL is not set
24
25#
26# Loadable module support
27#
28CONFIG_MODULES=y
29CONFIG_MODULE_UNLOAD=y
30# CONFIG_MODULE_FORCE_UNLOAD is not set
31CONFIG_OBSOLETE_MODPARM=y
32# CONFIG_MODVERSIONS is not set
33CONFIG_KMOD=y
34
35#
36# Platform support
37#
38CONFIG_PPC=y
39CONFIG_PPC32=y
40# CONFIG_6xx is not set
41# CONFIG_40x is not set
42# CONFIG_POWER3 is not set
43CONFIG_8xx=y
44
45#
46# IBM 4xx options
47#
48CONFIG_EMBEDDEDBOOT=y
49CONFIG_SERIAL_CONSOLE=y
50CONFIG_NOT_COHERENT_CACHE=y
51# CONFIG_RPXLITE is not set
52# CONFIG_RPXCLASSIC is not set
53# CONFIG_BSEIP is not set
54# CONFIG_FADS is not set
55# CONFIG_TQM823L is not set
56# CONFIG_TQM850L is not set
57# CONFIG_TQM855L is not set
58# CONFIG_TQM860L is not set
59# CONFIG_FPS850L is not set
60# CONFIG_SPD823TS is not set
61# CONFIG_IVMS8 is not set
62# CONFIG_IVML24 is not set
63CONFIG_SM850=y
64# CONFIG_HERMES_PRO is not set
65# CONFIG_IP860 is not set
66# CONFIG_LWMON is not set
67# CONFIG_PCU_E is not set
68# CONFIG_CCM is not set
69# CONFIG_LANTEC is not set
70# CONFIG_MBX is not set
71# CONFIG_WINCEPT is not set
72CONFIG_TQM8xxL=y
73# CONFIG_SMP is not set
74# CONFIG_PREEMPT is not set
75CONFIG_MATH_EMULATION=y
76# CONFIG_CPU_FREQ is not set
77
78#
79# General setup
80#
81# CONFIG_HIGHMEM is not set
82# CONFIG_PCI is not set
83# CONFIG_PCI_DOMAINS is not set
84# CONFIG_PCI_QSPAN is not set
85CONFIG_KCORE_ELF=y
86CONFIG_BINFMT_ELF=y
87CONFIG_KERNEL_ELF=y
88# CONFIG_BINFMT_MISC is not set
89# CONFIG_HOTPLUG is not set
90
91#
92# Parallel port support
93#
94# CONFIG_PARPORT is not set
95CONFIG_CMDLINE_BOOL=y
96CONFIG_CMDLINE="console=ttyCPM1"
97
98#
99# Advanced setup
100#
101# CONFIG_ADVANCED_OPTIONS is not set
102
103#
104# Default settings for advanced configuration options are used
105#
106CONFIG_HIGHMEM_START=0xfe000000
107CONFIG_LOWMEM_SIZE=0x30000000
108CONFIG_KERNEL_START=0xc0000000
109CONFIG_TASK_SIZE=0x80000000
110CONFIG_BOOT_LOAD=0x00400000
111
112#
113# Memory Technology Devices (MTD)
114#
115# CONFIG_MTD is not set
116
117#
118# Plug and Play support
119#
120# CONFIG_PNP is not set
121
122#
123# Block devices
124#
125# CONFIG_BLK_DEV_FD is not set
126# CONFIG_BLK_DEV_LOOP is not set
127# CONFIG_BLK_DEV_NBD is not set
128# CONFIG_BLK_DEV_RAM is not set
129# CONFIG_BLK_DEV_INITRD is not set
130
131#
132# Multi-device support (RAID and LVM)
133#
134# CONFIG_MD is not set
135
136#
137# ATA/IDE/MFM/RLL support
138#
139# CONFIG_IDE is not set
140
141#
142# SCSI support
143#
144# CONFIG_SCSI is not set
145
146#
147# Fusion MPT device support
148#
149
150#
151# I2O device support
152#
153
154#
155# Networking support
156#
157CONFIG_NET=y
158
159#
160# Networking options
161#
162CONFIG_PACKET=y
163# CONFIG_PACKET_MMAP is not set
164# CONFIG_NETLINK_DEV is not set
165# CONFIG_NETFILTER is not set
166CONFIG_UNIX=y
167# CONFIG_NET_KEY is not set
168CONFIG_INET=y
169# CONFIG_IP_MULTICAST is not set
170# CONFIG_IP_ADVANCED_ROUTER is not set
171CONFIG_IP_PNP=y
172CONFIG_IP_PNP_DHCP=y
173# CONFIG_IP_PNP_BOOTP is not set
174# CONFIG_IP_PNP_RARP is not set
175# CONFIG_NET_IPIP is not set
176# CONFIG_NET_IPGRE is not set
177# CONFIG_ARPD is not set
178# CONFIG_INET_ECN is not set
179# CONFIG_SYN_COOKIES is not set
180# CONFIG_INET_AH is not set
181# CONFIG_INET_ESP is not set
182# CONFIG_INET_IPCOMP is not set
183# CONFIG_IPV6 is not set
184# CONFIG_XFRM_USER is not set
185
186#
187# SCTP Configuration (EXPERIMENTAL)
188#
189CONFIG_IPV6_SCTP__=y
190# CONFIG_IP_SCTP is not set
191# CONFIG_ATM is not set
192# CONFIG_VLAN_8021Q is not set
193# CONFIG_LLC is not set
194# CONFIG_DECNET is not set
195# CONFIG_BRIDGE is not set
196# CONFIG_X25 is not set
197# CONFIG_LAPB is not set
198# CONFIG_NET_DIVERT is not set
199# CONFIG_ECONET is not set
200# CONFIG_WAN_ROUTER is not set
201# CONFIG_NET_HW_FLOWCONTROL is not set
202
203#
204# QoS and/or fair queueing
205#
206# CONFIG_NET_SCHED is not set
207
208#
209# Network testing
210#
211# CONFIG_NET_PKTGEN is not set
212CONFIG_NETDEVICES=y
213# CONFIG_DUMMY is not set
214# CONFIG_BONDING is not set
215# CONFIG_EQUALIZER is not set
216# CONFIG_TUN is not set
217# CONFIG_ETHERTAP is not set
218
219#
220# Ethernet (10 or 100Mbit)
221#
222CONFIG_NET_ETHERNET=y
223# CONFIG_MII is not set
224# CONFIG_OAKNET is not set
225
226#
227# Ethernet (1000 Mbit)
228#
229
230#
231# Ethernet (10000 Mbit)
232#
233# CONFIG_PPP is not set
234# CONFIG_SLIP is not set
235
236#
237# Wireless LAN (non-hamradio)
238#
239# CONFIG_NET_RADIO is not set
240
241#
242# Token Ring devices (depends on LLC=y)
243#
244# CONFIG_SHAPER is not set
245
246#
247# Wan interfaces
248#
249# CONFIG_WAN is not set
250
251#
252# Amateur Radio support
253#
254# CONFIG_HAMRADIO is not set
255
256#
257# IrDA (infrared) support
258#
259# CONFIG_IRDA is not set
260
261#
262# ISDN subsystem
263#
264# CONFIG_ISDN_BOOL is not set
265
266#
267# Graphics support
268#
269# CONFIG_FB is not set
270
271#
272# Old CD-ROM drivers (not SCSI, not IDE)
273#
274# CONFIG_CD_NO_IDESCSI is not set
275
276#
277# Input device support
278#
279# CONFIG_INPUT is not set
280
281#
282# Userland interfaces
283#
284
285#
286# Input I/O drivers
287#
288# CONFIG_GAMEPORT is not set
289CONFIG_SOUND_GAMEPORT=y
290# CONFIG_SERIO is not set
291
292#
293# Input Device Drivers
294#
295
296#
297# Macintosh device drivers
298#
299
300#
301# Serial drivers
302#
303# CONFIG_SERIAL_8250 is not set
304
305#
306# Non-8250 serial port support
307#
308CONFIG_SERIAL_CORE=y
309CONFIG_SERIAL_CORE_CONSOLE=y
310CONFIG_SERIAL_CPM=y
311CONFIG_SERIAL_CPM_CONSOLE=y
312# CONFIG_SERIAL_CPM_SCC1 is not set
313# CONFIG_SERIAL_CPM_SCC2 is not set
314# CONFIG_SERIAL_CPM_SCC3 is not set
315# CONFIG_SERIAL_CPM_SCC4 is not set
316CONFIG_SERIAL_CPM_SMC1=y
317CONFIG_SERIAL_CPM_SMC2=y
318CONFIG_SERIAL_CPM_ALT_SMC2=y
319CONFIG_UNIX98_PTYS=y
320# CONFIG_LEGACY_PTYS is not set
321
322#
323# I2C support
324#
325# CONFIG_I2C is not set
326
327#
328# I2C Hardware Sensors Mainboard support
329#
330
331#
332# I2C Hardware Sensors Chip support
333#
334# CONFIG_I2C_SENSOR is not set
335
336#
337# Mice
338#
339# CONFIG_BUSMOUSE is not set
340# CONFIG_QIC02_TAPE is not set
341
342#
343# IPMI
344#
345# CONFIG_IPMI_HANDLER is not set
346
347#
348# Watchdog Cards
349#
350# CONFIG_WATCHDOG is not set
351# CONFIG_NVRAM is not set
352CONFIG_GEN_RTC=y
353# CONFIG_GEN_RTC_X is not set
354# CONFIG_DTLK is not set
355# CONFIG_R3964 is not set
356# CONFIG_APPLICOM is not set
357
358#
359# Ftape, the floppy tape device driver
360#
361# CONFIG_FTAPE is not set
362# CONFIG_AGP is not set
363# CONFIG_DRM is not set
364# CONFIG_RAW_DRIVER is not set
365# CONFIG_HANGCHECK_TIMER is not set
366
367#
368# Multimedia devices
369#
370# CONFIG_VIDEO_DEV is not set
371
372#
373# Digital Video Broadcasting Devices
374#
375# CONFIG_DVB is not set
376
377#
378# File systems
379#
380# CONFIG_EXT2_FS is not set
381CONFIG_EXT3_FS=y
382CONFIG_EXT3_FS_XATTR=y
383# CONFIG_EXT3_FS_POSIX_ACL is not set
384# CONFIG_EXT3_FS_SECURITY is not set
385CONFIG_JBD=y
386# CONFIG_JBD_DEBUG is not set
387CONFIG_FS_MBCACHE=y
388# CONFIG_REISERFS_FS is not set
389# CONFIG_JFS_FS is not set
390# CONFIG_XFS_FS is not set
391# CONFIG_MINIX_FS is not set
392# CONFIG_ROMFS_FS is not set
393# CONFIG_QUOTA is not set
394# CONFIG_AUTOFS_FS is not set
395# CONFIG_AUTOFS4_FS is not set
396
397#
398# CD-ROM/DVD Filesystems
399#
400# CONFIG_ISO9660_FS is not set
401# CONFIG_UDF_FS is not set
402
403#
404# DOS/FAT/NT Filesystems
405#
406# CONFIG_FAT_FS is not set
407# CONFIG_NTFS_FS is not set
408
409#
410# Pseudo filesystems
411#
412CONFIG_PROC_FS=y
413# CONFIG_DEVFS_FS is not set
414CONFIG_DEVPTS_FS=y
415# CONFIG_DEVPTS_FS_XATTR is not set
416CONFIG_TMPFS=y
417CONFIG_RAMFS=y
418
419#
420# Miscellaneous filesystems
421#
422# CONFIG_ADFS_FS is not set
423# CONFIG_AFFS_FS is not set
424# CONFIG_HFS_FS is not set
425# CONFIG_BEFS_FS is not set
426# CONFIG_BFS_FS is not set
427# CONFIG_EFS_FS is not set
428# CONFIG_CRAMFS is not set
429# CONFIG_VXFS_FS is not set
430# CONFIG_HPFS_FS is not set
431# CONFIG_QNX4FS_FS is not set
432# CONFIG_SYSV_FS is not set
433# CONFIG_UFS_FS is not set
434
435#
436# Network File Systems
437#
438CONFIG_NFS_FS=y
439# CONFIG_NFS_V3 is not set
440# CONFIG_NFS_V4 is not set
441# CONFIG_NFSD is not set
442CONFIG_ROOT_NFS=y
443CONFIG_LOCKD=y
444# CONFIG_EXPORTFS is not set
445CONFIG_SUNRPC=y
446# CONFIG_SUNRPC_GSS is not set
447# CONFIG_SMB_FS is not set
448# CONFIG_CIFS is not set
449# CONFIG_NCP_FS is not set
450# CONFIG_CODA_FS is not set
451# CONFIG_INTERMEZZO_FS is not set
452# CONFIG_AFS_FS is not set
453
454#
455# Partition Types
456#
457CONFIG_PARTITION_ADVANCED=y
458# CONFIG_ACORN_PARTITION is not set
459# CONFIG_OSF_PARTITION is not set
460# CONFIG_AMIGA_PARTITION is not set
461# CONFIG_ATARI_PARTITION is not set
462# CONFIG_MAC_PARTITION is not set
463# CONFIG_MSDOS_PARTITION is not set
464# CONFIG_LDM_PARTITION is not set
465# CONFIG_NEC98_PARTITION is not set
466# CONFIG_SGI_PARTITION is not set
467# CONFIG_ULTRIX_PARTITION is not set
468# CONFIG_SUN_PARTITION is not set
469# CONFIG_EFI_PARTITION is not set
470
471#
472# Sound
473#
474# CONFIG_SOUND is not set
475
476#
477# MPC8xx CPM Options
478#
479CONFIG_SCC_ENET=y
480# CONFIG_SCC1_ENET is not set
481# CONFIG_SCC2_ENET is not set
482CONFIG_SCC3_ENET=y
483# CONFIG_FEC_ENET is not set
484CONFIG_ENET_BIG_BUFFERS=y
485
486#
487# Generic MPC8xx Options
488#
489CONFIG_8xx_COPYBACK=y
490CONFIG_8xx_CPU6=y
491# CONFIG_UCODE_PATCH is not set
492
493#
494# USB support
495#
496# CONFIG_USB_GADGET is not set
497
498#
499# Bluetooth support
500#
501# CONFIG_BT is not set
502
503#
504# Library routines
505#
506# CONFIG_CRC32 is not set
507
508#
509# Kernel hacking
510#
511# CONFIG_DEBUG_KERNEL is not set
512# CONFIG_KALLSYMS is not set
513
514#
515# Security options
516#
517# CONFIG_SECURITY is not set
518
519#
520# Cryptographic options
521#
522# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/SPD823TS_defconfig b/arch/ppc/configs/SPD823TS_defconfig
new file mode 100644
index 000000000000..ba60fea2b834
--- /dev/null
+++ b/arch/ppc/configs/SPD823TS_defconfig
@@ -0,0 +1,520 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7
8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12
13#
14# General setup
15#
16CONFIG_SWAP=y
17CONFIG_SYSVIPC=y
18# CONFIG_BSD_PROCESS_ACCT is not set
19CONFIG_SYSCTL=y
20CONFIG_LOG_BUF_SHIFT=14
21CONFIG_EMBEDDED=y
22CONFIG_FUTEX=y
23# CONFIG_EPOLL is not set
24
25#
26# Loadable module support
27#
28CONFIG_MODULES=y
29CONFIG_MODULE_UNLOAD=y
30# CONFIG_MODULE_FORCE_UNLOAD is not set
31CONFIG_OBSOLETE_MODPARM=y
32# CONFIG_MODVERSIONS is not set
33CONFIG_KMOD=y
34
35#
36# Platform support
37#
38CONFIG_PPC=y
39CONFIG_PPC32=y
40# CONFIG_6xx is not set
41# CONFIG_40x is not set
42# CONFIG_POWER3 is not set
43CONFIG_8xx=y
44
45#
46# IBM 4xx options
47#
48CONFIG_EMBEDDEDBOOT=y
49CONFIG_SERIAL_CONSOLE=y
50CONFIG_NOT_COHERENT_CACHE=y
51# CONFIG_RPXLITE is not set
52# CONFIG_RPXCLASSIC is not set
53# CONFIG_BSEIP is not set
54# CONFIG_FADS is not set
55# CONFIG_TQM823L is not set
56# CONFIG_TQM850L is not set
57# CONFIG_TQM855L is not set
58# CONFIG_TQM860L is not set
59# CONFIG_FPS850L is not set
60CONFIG_SPD823TS=y
61# CONFIG_IVMS8 is not set
62# CONFIG_IVML24 is not set
63# CONFIG_SM850 is not set
64# CONFIG_HERMES_PRO is not set
65# CONFIG_IP860 is not set
66# CONFIG_LWMON is not set
67# CONFIG_PCU_E is not set
68# CONFIG_CCM is not set
69# CONFIG_LANTEC is not set
70# CONFIG_MBX is not set
71# CONFIG_WINCEPT is not set
72# CONFIG_SMP is not set
73# CONFIG_PREEMPT is not set
74CONFIG_MATH_EMULATION=y
75# CONFIG_CPU_FREQ is not set
76
77#
78# General setup
79#
80# CONFIG_HIGHMEM is not set
81# CONFIG_PCI is not set
82# CONFIG_PCI_DOMAINS is not set
83# CONFIG_PCI_QSPAN is not set
84CONFIG_KCORE_ELF=y
85CONFIG_BINFMT_ELF=y
86CONFIG_KERNEL_ELF=y
87# CONFIG_BINFMT_MISC is not set
88# CONFIG_HOTPLUG is not set
89
90#
91# Parallel port support
92#
93# CONFIG_PARPORT is not set
94# CONFIG_CMDLINE_BOOL is not set
95
96#
97# Advanced setup
98#
99# CONFIG_ADVANCED_OPTIONS is not set
100
101#
102# Default settings for advanced configuration options are used
103#
104CONFIG_HIGHMEM_START=0xfe000000
105CONFIG_LOWMEM_SIZE=0x30000000
106CONFIG_KERNEL_START=0xc0000000
107CONFIG_TASK_SIZE=0x80000000
108CONFIG_BOOT_LOAD=0x00400000
109
110#
111# Memory Technology Devices (MTD)
112#
113# CONFIG_MTD is not set
114
115#
116# Plug and Play support
117#
118# CONFIG_PNP is not set
119
120#
121# Block devices
122#
123# CONFIG_BLK_DEV_FD is not set
124# CONFIG_BLK_DEV_LOOP is not set
125# CONFIG_BLK_DEV_NBD is not set
126# CONFIG_BLK_DEV_RAM is not set
127# CONFIG_BLK_DEV_INITRD is not set
128
129#
130# Multi-device support (RAID and LVM)
131#
132# CONFIG_MD is not set
133
134#
135# ATA/IDE/MFM/RLL support
136#
137# CONFIG_IDE is not set
138
139#
140# SCSI support
141#
142# CONFIG_SCSI is not set
143
144#
145# Fusion MPT device support
146#
147
148#
149# I2O device support
150#
151
152#
153# Networking support
154#
155CONFIG_NET=y
156
157#
158# Networking options
159#
160CONFIG_PACKET=y
161# CONFIG_PACKET_MMAP is not set
162# CONFIG_NETLINK_DEV is not set
163# CONFIG_NETFILTER is not set
164CONFIG_UNIX=y
165# CONFIG_NET_KEY is not set
166CONFIG_INET=y
167# CONFIG_IP_MULTICAST is not set
168# CONFIG_IP_ADVANCED_ROUTER is not set
169CONFIG_IP_PNP=y
170CONFIG_IP_PNP_DHCP=y
171# CONFIG_IP_PNP_BOOTP is not set
172# CONFIG_IP_PNP_RARP is not set
173# CONFIG_NET_IPIP is not set
174# CONFIG_NET_IPGRE is not set
175# CONFIG_ARPD is not set
176# CONFIG_INET_ECN is not set
177# CONFIG_SYN_COOKIES is not set
178# CONFIG_INET_AH is not set
179# CONFIG_INET_ESP is not set
180# CONFIG_INET_IPCOMP is not set
181# CONFIG_IPV6 is not set
182# CONFIG_XFRM_USER is not set
183
184#
185# SCTP Configuration (EXPERIMENTAL)
186#
187CONFIG_IPV6_SCTP__=y
188# CONFIG_IP_SCTP is not set
189# CONFIG_ATM is not set
190# CONFIG_VLAN_8021Q is not set
191# CONFIG_LLC is not set
192# CONFIG_DECNET is not set
193# CONFIG_BRIDGE is not set
194# CONFIG_X25 is not set
195# CONFIG_LAPB is not set
196# CONFIG_NET_DIVERT is not set
197# CONFIG_ECONET is not set
198# CONFIG_WAN_ROUTER is not set
199# CONFIG_NET_HW_FLOWCONTROL is not set
200
201#
202# QoS and/or fair queueing
203#
204# CONFIG_NET_SCHED is not set
205
206#
207# Network testing
208#
209# CONFIG_NET_PKTGEN is not set
210CONFIG_NETDEVICES=y
211# CONFIG_DUMMY is not set
212# CONFIG_BONDING is not set
213# CONFIG_EQUALIZER is not set
214# CONFIG_TUN is not set
215# CONFIG_ETHERTAP is not set
216
217#
218# Ethernet (10 or 100Mbit)
219#
220CONFIG_NET_ETHERNET=y
221# CONFIG_MII is not set
222# CONFIG_OAKNET is not set
223
224#
225# Ethernet (1000 Mbit)
226#
227
228#
229# Ethernet (10000 Mbit)
230#
231# CONFIG_PPP is not set
232# CONFIG_SLIP is not set
233
234#
235# Wireless LAN (non-hamradio)
236#
237# CONFIG_NET_RADIO is not set
238
239#
240# Token Ring devices (depends on LLC=y)
241#
242# CONFIG_SHAPER is not set
243
244#
245# Wan interfaces
246#
247# CONFIG_WAN is not set
248
249#
250# Amateur Radio support
251#
252# CONFIG_HAMRADIO is not set
253
254#
255# IrDA (infrared) support
256#
257# CONFIG_IRDA is not set
258
259#
260# ISDN subsystem
261#
262# CONFIG_ISDN_BOOL is not set
263
264#
265# Graphics support
266#
267# CONFIG_FB is not set
268
269#
270# Old CD-ROM drivers (not SCSI, not IDE)
271#
272# CONFIG_CD_NO_IDESCSI is not set
273
274#
275# Input device support
276#
277# CONFIG_INPUT is not set
278
279#
280# Userland interfaces
281#
282
283#
284# Input I/O drivers
285#
286# CONFIG_GAMEPORT is not set
287CONFIG_SOUND_GAMEPORT=y
288# CONFIG_SERIO is not set
289
290#
291# Input Device Drivers
292#
293
294#
295# Macintosh device drivers
296#
297
298#
299# Serial drivers
300#
301# CONFIG_SERIAL_8250 is not set
302
303#
304# Non-8250 serial port support
305#
306CONFIG_SERIAL_CORE=y
307CONFIG_SERIAL_CORE_CONSOLE=y
308CONFIG_SERIAL_CPM=y
309CONFIG_SERIAL_CPM_CONSOLE=y
310# CONFIG_SERIAL_CPM_SCC1 is not set
311# CONFIG_SERIAL_CPM_SCC2 is not set
312# CONFIG_SERIAL_CPM_SCC3 is not set
313# CONFIG_SERIAL_CPM_SCC4 is not set
314CONFIG_SERIAL_CPM_SMC1=y
315# CONFIG_SERIAL_CPM_SMC2 is not set
316CONFIG_SERIAL_CPM_ALT_SMC2=y
317CONFIG_UNIX98_PTYS=y
318# CONFIG_LEGACY_PTYS is not set
319
320#
321# I2C support
322#
323# CONFIG_I2C is not set
324
325#
326# I2C Hardware Sensors Mainboard support
327#
328
329#
330# I2C Hardware Sensors Chip support
331#
332# CONFIG_I2C_SENSOR is not set
333
334#
335# Mice
336#
337# CONFIG_BUSMOUSE is not set
338# CONFIG_QIC02_TAPE is not set
339
340#
341# IPMI
342#
343# CONFIG_IPMI_HANDLER is not set
344
345#
346# Watchdog Cards
347#
348# CONFIG_WATCHDOG is not set
349# CONFIG_NVRAM is not set
350CONFIG_GEN_RTC=y
351# CONFIG_GEN_RTC_X is not set
352# CONFIG_DTLK is not set
353# CONFIG_R3964 is not set
354# CONFIG_APPLICOM is not set
355
356#
357# Ftape, the floppy tape device driver
358#
359# CONFIG_FTAPE is not set
360# CONFIG_AGP is not set
361# CONFIG_DRM is not set
362# CONFIG_RAW_DRIVER is not set
363# CONFIG_HANGCHECK_TIMER is not set
364
365#
366# Multimedia devices
367#
368# CONFIG_VIDEO_DEV is not set
369
370#
371# Digital Video Broadcasting Devices
372#
373# CONFIG_DVB is not set
374
375#
376# File systems
377#
378# CONFIG_EXT2_FS is not set
379CONFIG_EXT3_FS=y
380CONFIG_EXT3_FS_XATTR=y
381# CONFIG_EXT3_FS_POSIX_ACL is not set
382# CONFIG_EXT3_FS_SECURITY is not set
383CONFIG_JBD=y
384# CONFIG_JBD_DEBUG is not set
385CONFIG_FS_MBCACHE=y
386# CONFIG_REISERFS_FS is not set
387# CONFIG_JFS_FS is not set
388# CONFIG_XFS_FS is not set
389# CONFIG_MINIX_FS is not set
390# CONFIG_ROMFS_FS is not set
391# CONFIG_QUOTA is not set
392# CONFIG_AUTOFS_FS is not set
393# CONFIG_AUTOFS4_FS is not set
394
395#
396# CD-ROM/DVD Filesystems
397#
398# CONFIG_ISO9660_FS is not set
399# CONFIG_UDF_FS is not set
400
401#
402# DOS/FAT/NT Filesystems
403#
404# CONFIG_FAT_FS is not set
405# CONFIG_NTFS_FS is not set
406
407#
408# Pseudo filesystems
409#
410CONFIG_PROC_FS=y
411# CONFIG_DEVFS_FS is not set
412CONFIG_DEVPTS_FS=y
413# CONFIG_DEVPTS_FS_XATTR is not set
414CONFIG_TMPFS=y
415CONFIG_RAMFS=y
416
417#
418# Miscellaneous filesystems
419#
420# CONFIG_ADFS_FS is not set
421# CONFIG_AFFS_FS is not set
422# CONFIG_HFS_FS is not set
423# CONFIG_BEFS_FS is not set
424# CONFIG_BFS_FS is not set
425# CONFIG_EFS_FS is not set
426# CONFIG_CRAMFS is not set
427# CONFIG_VXFS_FS is not set
428# CONFIG_HPFS_FS is not set
429# CONFIG_QNX4FS_FS is not set
430# CONFIG_SYSV_FS is not set
431# CONFIG_UFS_FS is not set
432
433#
434# Network File Systems
435#
436CONFIG_NFS_FS=y
437# CONFIG_NFS_V3 is not set
438# CONFIG_NFS_V4 is not set
439# CONFIG_NFSD is not set
440CONFIG_ROOT_NFS=y
441CONFIG_LOCKD=y
442# CONFIG_EXPORTFS is not set
443CONFIG_SUNRPC=y
444# CONFIG_SUNRPC_GSS is not set
445# CONFIG_SMB_FS is not set
446# CONFIG_CIFS is not set
447# CONFIG_NCP_FS is not set
448# CONFIG_CODA_FS is not set
449# CONFIG_INTERMEZZO_FS is not set
450# CONFIG_AFS_FS is not set
451
452#
453# Partition Types
454#
455CONFIG_PARTITION_ADVANCED=y
456# CONFIG_ACORN_PARTITION is not set
457# CONFIG_OSF_PARTITION is not set
458# CONFIG_AMIGA_PARTITION is not set
459# CONFIG_ATARI_PARTITION is not set
460# CONFIG_MAC_PARTITION is not set
461# CONFIG_MSDOS_PARTITION is not set
462# CONFIG_LDM_PARTITION is not set
463# CONFIG_NEC98_PARTITION is not set
464# CONFIG_SGI_PARTITION is not set
465# CONFIG_ULTRIX_PARTITION is not set
466# CONFIG_SUN_PARTITION is not set
467# CONFIG_EFI_PARTITION is not set
468
469#
470# Sound
471#
472# CONFIG_SOUND is not set
473
474#
475# MPC8xx CPM Options
476#
477CONFIG_SCC_ENET=y
478# CONFIG_SCC1_ENET is not set
479CONFIG_SCC2_ENET=y
480# CONFIG_SCC3_ENET is not set
481# CONFIG_FEC_ENET is not set
482CONFIG_ENET_BIG_BUFFERS=y
483
484#
485# Generic MPC8xx Options
486#
487CONFIG_8xx_COPYBACK=y
488# CONFIG_8xx_CPU6 is not set
489# CONFIG_UCODE_PATCH is not set
490
491#
492# USB support
493#
494# CONFIG_USB_GADGET is not set
495
496#
497# Bluetooth support
498#
499# CONFIG_BT is not set
500
501#
502# Library routines
503#
504# CONFIG_CRC32 is not set
505
506#
507# Kernel hacking
508#
509# CONFIG_DEBUG_KERNEL is not set
510# CONFIG_KALLSYMS is not set
511
512#
513# Security options
514#
515# CONFIG_SECURITY is not set
516
517#
518# Cryptographic options
519#
520# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/TQM823L_defconfig b/arch/ppc/configs/TQM823L_defconfig
new file mode 100644
index 000000000000..3b44f3d79bf6
--- /dev/null
+++ b/arch/ppc/configs/TQM823L_defconfig
@@ -0,0 +1,521 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7
8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12
13#
14# General setup
15#
16CONFIG_SWAP=y
17CONFIG_SYSVIPC=y
18# CONFIG_BSD_PROCESS_ACCT is not set
19CONFIG_SYSCTL=y
20CONFIG_LOG_BUF_SHIFT=14
21CONFIG_EMBEDDED=y
22CONFIG_FUTEX=y
23# CONFIG_EPOLL is not set
24
25#
26# Loadable module support
27#
28CONFIG_MODULES=y
29CONFIG_MODULE_UNLOAD=y
30# CONFIG_MODULE_FORCE_UNLOAD is not set
31CONFIG_OBSOLETE_MODPARM=y
32# CONFIG_MODVERSIONS is not set
33CONFIG_KMOD=y
34
35#
36# Platform support
37#
38CONFIG_PPC=y
39CONFIG_PPC32=y
40# CONFIG_6xx is not set
41# CONFIG_40x is not set
42# CONFIG_POWER3 is not set
43CONFIG_8xx=y
44
45#
46# IBM 4xx options
47#
48CONFIG_EMBEDDEDBOOT=y
49CONFIG_SERIAL_CONSOLE=y
50CONFIG_NOT_COHERENT_CACHE=y
51# CONFIG_RPXLITE is not set
52# CONFIG_RPXCLASSIC is not set
53# CONFIG_BSEIP is not set
54# CONFIG_FADS is not set
55CONFIG_TQM823L=y
56# CONFIG_TQM850L is not set
57# CONFIG_TQM855L is not set
58# CONFIG_TQM860L is not set
59# CONFIG_FPS850L is not set
60# CONFIG_SPD823TS is not set
61# CONFIG_IVMS8 is not set
62# CONFIG_IVML24 is not set
63# CONFIG_SM850 is not set
64# CONFIG_HERMES_PRO is not set
65# CONFIG_IP860 is not set
66# CONFIG_LWMON is not set
67# CONFIG_PCU_E is not set
68# CONFIG_CCM is not set
69# CONFIG_LANTEC is not set
70# CONFIG_MBX is not set
71# CONFIG_WINCEPT is not set
72CONFIG_TQM8xxL=y
73# CONFIG_SMP is not set
74# CONFIG_PREEMPT is not set
75CONFIG_MATH_EMULATION=y
76# CONFIG_CPU_FREQ is not set
77
78#
79# General setup
80#
81# CONFIG_HIGHMEM is not set
82# CONFIG_PCI is not set
83# CONFIG_PCI_DOMAINS is not set
84# CONFIG_PCI_QSPAN is not set
85CONFIG_KCORE_ELF=y
86CONFIG_BINFMT_ELF=y
87CONFIG_KERNEL_ELF=y
88# CONFIG_BINFMT_MISC is not set
89# CONFIG_HOTPLUG is not set
90
91#
92# Parallel port support
93#
94# CONFIG_PARPORT is not set
95# CONFIG_CMDLINE_BOOL is not set
96
97#
98# Advanced setup
99#
100# CONFIG_ADVANCED_OPTIONS is not set
101
102#
103# Default settings for advanced configuration options are used
104#
105CONFIG_HIGHMEM_START=0xfe000000
106CONFIG_LOWMEM_SIZE=0x30000000
107CONFIG_KERNEL_START=0xc0000000
108CONFIG_TASK_SIZE=0x80000000
109CONFIG_BOOT_LOAD=0x00400000
110
111#
112# Memory Technology Devices (MTD)
113#
114# CONFIG_MTD is not set
115
116#
117# Plug and Play support
118#
119# CONFIG_PNP is not set
120
121#
122# Block devices
123#
124# CONFIG_BLK_DEV_FD is not set
125# CONFIG_BLK_DEV_LOOP is not set
126# CONFIG_BLK_DEV_NBD is not set
127# CONFIG_BLK_DEV_RAM is not set
128# CONFIG_BLK_DEV_INITRD is not set
129
130#
131# Multi-device support (RAID and LVM)
132#
133# CONFIG_MD is not set
134
135#
136# ATA/IDE/MFM/RLL support
137#
138# CONFIG_IDE is not set
139
140#
141# SCSI support
142#
143# CONFIG_SCSI is not set
144
145#
146# Fusion MPT device support
147#
148
149#
150# I2O device support
151#
152
153#
154# Networking support
155#
156CONFIG_NET=y
157
158#
159# Networking options
160#
161CONFIG_PACKET=y
162# CONFIG_PACKET_MMAP is not set
163# CONFIG_NETLINK_DEV is not set
164# CONFIG_NETFILTER is not set
165CONFIG_UNIX=y
166# CONFIG_NET_KEY is not set
167CONFIG_INET=y
168# CONFIG_IP_MULTICAST is not set
169# CONFIG_IP_ADVANCED_ROUTER is not set
170CONFIG_IP_PNP=y
171CONFIG_IP_PNP_DHCP=y
172# CONFIG_IP_PNP_BOOTP is not set
173# CONFIG_IP_PNP_RARP is not set
174# CONFIG_NET_IPIP is not set
175# CONFIG_NET_IPGRE is not set
176# CONFIG_ARPD is not set
177# CONFIG_INET_ECN is not set
178# CONFIG_SYN_COOKIES is not set
179# CONFIG_INET_AH is not set
180# CONFIG_INET_ESP is not set
181# CONFIG_INET_IPCOMP is not set
182# CONFIG_IPV6 is not set
183# CONFIG_XFRM_USER is not set
184
185#
186# SCTP Configuration (EXPERIMENTAL)
187#
188CONFIG_IPV6_SCTP__=y
189# CONFIG_IP_SCTP is not set
190# CONFIG_ATM is not set
191# CONFIG_VLAN_8021Q is not set
192# CONFIG_LLC is not set
193# CONFIG_DECNET is not set
194# CONFIG_BRIDGE is not set
195# CONFIG_X25 is not set
196# CONFIG_LAPB is not set
197# CONFIG_NET_DIVERT is not set
198# CONFIG_ECONET is not set
199# CONFIG_WAN_ROUTER is not set
200# CONFIG_NET_HW_FLOWCONTROL is not set
201
202#
203# QoS and/or fair queueing
204#
205# CONFIG_NET_SCHED is not set
206
207#
208# Network testing
209#
210# CONFIG_NET_PKTGEN is not set
211CONFIG_NETDEVICES=y
212# CONFIG_DUMMY is not set
213# CONFIG_BONDING is not set
214# CONFIG_EQUALIZER is not set
215# CONFIG_TUN is not set
216# CONFIG_ETHERTAP is not set
217
218#
219# Ethernet (10 or 100Mbit)
220#
221CONFIG_NET_ETHERNET=y
222# CONFIG_MII is not set
223# CONFIG_OAKNET is not set
224
225#
226# Ethernet (1000 Mbit)
227#
228
229#
230# Ethernet (10000 Mbit)
231#
232# CONFIG_PPP is not set
233# CONFIG_SLIP is not set
234
235#
236# Wireless LAN (non-hamradio)
237#
238# CONFIG_NET_RADIO is not set
239
240#
241# Token Ring devices (depends on LLC=y)
242#
243# CONFIG_SHAPER is not set
244
245#
246# Wan interfaces
247#
248# CONFIG_WAN is not set
249
250#
251# Amateur Radio support
252#
253# CONFIG_HAMRADIO is not set
254
255#
256# IrDA (infrared) support
257#
258# CONFIG_IRDA is not set
259
260#
261# ISDN subsystem
262#
263# CONFIG_ISDN_BOOL is not set
264
265#
266# Graphics support
267#
268# CONFIG_FB is not set
269
270#
271# Old CD-ROM drivers (not SCSI, not IDE)
272#
273# CONFIG_CD_NO_IDESCSI is not set
274
275#
276# Input device support
277#
278# CONFIG_INPUT is not set
279
280#
281# Userland interfaces
282#
283
284#
285# Input I/O drivers
286#
287# CONFIG_GAMEPORT is not set
288CONFIG_SOUND_GAMEPORT=y
289# CONFIG_SERIO is not set
290
291#
292# Input Device Drivers
293#
294
295#
296# Macintosh device drivers
297#
298
299#
300# Serial drivers
301#
302# CONFIG_SERIAL_8250 is not set
303
304#
305# Non-8250 serial port support
306#
307CONFIG_SERIAL_CORE=y
308CONFIG_SERIAL_CORE_CONSOLE=y
309CONFIG_SERIAL_CPM=y
310CONFIG_SERIAL_CPM_CONSOLE=y
311# CONFIG_SERIAL_CPM_SCC1 is not set
312# CONFIG_SERIAL_CPM_SCC2 is not set
313# CONFIG_SERIAL_CPM_SCC3 is not set
314# CONFIG_SERIAL_CPM_SCC4 is not set
315CONFIG_SERIAL_CPM_SMC1=y
316CONFIG_SERIAL_CPM_SMC2=y
317CONFIG_SERIAL_CPM_ALT_SMC2=y
318CONFIG_UNIX98_PTYS=y
319# CONFIG_LEGACY_PTYS is not set
320
321#
322# I2C support
323#
324# CONFIG_I2C is not set
325
326#
327# I2C Hardware Sensors Mainboard support
328#
329
330#
331# I2C Hardware Sensors Chip support
332#
333# CONFIG_I2C_SENSOR is not set
334
335#
336# Mice
337#
338# CONFIG_BUSMOUSE is not set
339# CONFIG_QIC02_TAPE is not set
340
341#
342# IPMI
343#
344# CONFIG_IPMI_HANDLER is not set
345
346#
347# Watchdog Cards
348#
349# CONFIG_WATCHDOG is not set
350# CONFIG_NVRAM is not set
351CONFIG_GEN_RTC=y
352# CONFIG_GEN_RTC_X is not set
353# CONFIG_DTLK is not set
354# CONFIG_R3964 is not set
355# CONFIG_APPLICOM is not set
356
357#
358# Ftape, the floppy tape device driver
359#
360# CONFIG_FTAPE is not set
361# CONFIG_AGP is not set
362# CONFIG_DRM is not set
363# CONFIG_RAW_DRIVER is not set
364# CONFIG_HANGCHECK_TIMER is not set
365
366#
367# Multimedia devices
368#
369# CONFIG_VIDEO_DEV is not set
370
371#
372# Digital Video Broadcasting Devices
373#
374# CONFIG_DVB is not set
375
376#
377# File systems
378#
379# CONFIG_EXT2_FS is not set
380CONFIG_EXT3_FS=y
381CONFIG_EXT3_FS_XATTR=y
382# CONFIG_EXT3_FS_POSIX_ACL is not set
383# CONFIG_EXT3_FS_SECURITY is not set
384CONFIG_JBD=y
385# CONFIG_JBD_DEBUG is not set
386CONFIG_FS_MBCACHE=y
387# CONFIG_REISERFS_FS is not set
388# CONFIG_JFS_FS is not set
389# CONFIG_XFS_FS is not set
390# CONFIG_MINIX_FS is not set
391# CONFIG_ROMFS_FS is not set
392# CONFIG_QUOTA is not set
393# CONFIG_AUTOFS_FS is not set
394# CONFIG_AUTOFS4_FS is not set
395
396#
397# CD-ROM/DVD Filesystems
398#
399# CONFIG_ISO9660_FS is not set
400# CONFIG_UDF_FS is not set
401
402#
403# DOS/FAT/NT Filesystems
404#
405# CONFIG_FAT_FS is not set
406# CONFIG_NTFS_FS is not set
407
408#
409# Pseudo filesystems
410#
411CONFIG_PROC_FS=y
412# CONFIG_DEVFS_FS is not set
413CONFIG_DEVPTS_FS=y
414# CONFIG_DEVPTS_FS_XATTR is not set
415CONFIG_TMPFS=y
416CONFIG_RAMFS=y
417
418#
419# Miscellaneous filesystems
420#
421# CONFIG_ADFS_FS is not set
422# CONFIG_AFFS_FS is not set
423# CONFIG_HFS_FS is not set
424# CONFIG_BEFS_FS is not set
425# CONFIG_BFS_FS is not set
426# CONFIG_EFS_FS is not set
427# CONFIG_CRAMFS is not set
428# CONFIG_VXFS_FS is not set
429# CONFIG_HPFS_FS is not set
430# CONFIG_QNX4FS_FS is not set
431# CONFIG_SYSV_FS is not set
432# CONFIG_UFS_FS is not set
433
434#
435# Network File Systems
436#
437CONFIG_NFS_FS=y
438# CONFIG_NFS_V3 is not set
439# CONFIG_NFS_V4 is not set
440# CONFIG_NFSD is not set
441CONFIG_ROOT_NFS=y
442CONFIG_LOCKD=y
443# CONFIG_EXPORTFS is not set
444CONFIG_SUNRPC=y
445# CONFIG_SUNRPC_GSS is not set
446# CONFIG_SMB_FS is not set
447# CONFIG_CIFS is not set
448# CONFIG_NCP_FS is not set
449# CONFIG_CODA_FS is not set
450# CONFIG_INTERMEZZO_FS is not set
451# CONFIG_AFS_FS is not set
452
453#
454# Partition Types
455#
456CONFIG_PARTITION_ADVANCED=y
457# CONFIG_ACORN_PARTITION is not set
458# CONFIG_OSF_PARTITION is not set
459# CONFIG_AMIGA_PARTITION is not set
460# CONFIG_ATARI_PARTITION is not set
461# CONFIG_MAC_PARTITION is not set
462# CONFIG_MSDOS_PARTITION is not set
463# CONFIG_LDM_PARTITION is not set
464# CONFIG_NEC98_PARTITION is not set
465# CONFIG_SGI_PARTITION is not set
466# CONFIG_ULTRIX_PARTITION is not set
467# CONFIG_SUN_PARTITION is not set
468# CONFIG_EFI_PARTITION is not set
469
470#
471# Sound
472#
473# CONFIG_SOUND is not set
474
475#
476# MPC8xx CPM Options
477#
478CONFIG_SCC_ENET=y
479# CONFIG_SCC1_ENET is not set
480CONFIG_SCC2_ENET=y
481# CONFIG_SCC3_ENET is not set
482# CONFIG_FEC_ENET is not set
483CONFIG_ENET_BIG_BUFFERS=y
484
485#
486# Generic MPC8xx Options
487#
488CONFIG_8xx_COPYBACK=y
489# CONFIG_8xx_CPU6 is not set
490# CONFIG_UCODE_PATCH is not set
491
492#
493# USB support
494#
495# CONFIG_USB_GADGET is not set
496
497#
498# Bluetooth support
499#
500# CONFIG_BT is not set
501
502#
503# Library routines
504#
505# CONFIG_CRC32 is not set
506
507#
508# Kernel hacking
509#
510# CONFIG_DEBUG_KERNEL is not set
511# CONFIG_KALLSYMS is not set
512
513#
514# Security options
515#
516# CONFIG_SECURITY is not set
517
518#
519# Cryptographic options
520#
521# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/TQM8260_defconfig b/arch/ppc/configs/TQM8260_defconfig
new file mode 100644
index 000000000000..57cfa83d12d9
--- /dev/null
+++ b/arch/ppc/configs/TQM8260_defconfig
@@ -0,0 +1,499 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7
8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12
13#
14# General setup
15#
16CONFIG_SWAP=y
17CONFIG_SYSVIPC=y
18# CONFIG_BSD_PROCESS_ACCT is not set
19CONFIG_SYSCTL=y
20CONFIG_LOG_BUF_SHIFT=14
21CONFIG_EMBEDDED=y
22CONFIG_FUTEX=y
23# CONFIG_EPOLL is not set
24
25#
26# Loadable module support
27#
28CONFIG_MODULES=y
29CONFIG_MODULE_UNLOAD=y
30# CONFIG_MODULE_FORCE_UNLOAD is not set
31CONFIG_OBSOLETE_MODPARM=y
32# CONFIG_MODVERSIONS is not set
33CONFIG_KMOD=y
34
35#
36# Platform support
37#
38CONFIG_PPC=y
39CONFIG_PPC32=y
40CONFIG_6xx=y
41# CONFIG_40x is not set
42# CONFIG_POWER3 is not set
43# CONFIG_8xx is not set
44
45#
46# IBM 4xx options
47#
48CONFIG_EMBEDDEDBOOT=y
49CONFIG_8260=y
50CONFIG_PPC_STD_MMU=y
51CONFIG_SERIAL_CONSOLE=y
52# CONFIG_EST8260 is not set
53# CONFIG_SBS8260 is not set
54# CONFIG_RPX6 is not set
55CONFIG_TQM8260=y
56# CONFIG_WILLOW_1 is not set
57# CONFIG_SMP is not set
58# CONFIG_PREEMPT is not set
59# CONFIG_CPU_FREQ is not set
60
61#
62# General setup
63#
64# CONFIG_HIGHMEM is not set
65# CONFIG_PCI is not set
66# CONFIG_PCI_DOMAINS is not set
67# CONFIG_PC_KEYBOARD is not set
68CONFIG_KCORE_ELF=y
69CONFIG_BINFMT_ELF=y
70CONFIG_KERNEL_ELF=y
71# CONFIG_BINFMT_MISC is not set
72# CONFIG_HOTPLUG is not set
73
74#
75# Parallel port support
76#
77# CONFIG_PARPORT is not set
78# CONFIG_PPC601_SYNC_FIX is not set
79# CONFIG_CMDLINE_BOOL is not set
80
81#
82# Advanced setup
83#
84# CONFIG_ADVANCED_OPTIONS is not set
85
86#
87# Default settings for advanced configuration options are used
88#
89CONFIG_HIGHMEM_START=0xfe000000
90CONFIG_LOWMEM_SIZE=0x30000000
91CONFIG_KERNEL_START=0xc0000000
92CONFIG_TASK_SIZE=0x80000000
93CONFIG_BOOT_LOAD=0x00400000
94
95#
96# Memory Technology Devices (MTD)
97#
98# CONFIG_MTD is not set
99
100#
101# Plug and Play support
102#
103# CONFIG_PNP is not set
104
105#
106# Block devices
107#
108# CONFIG_BLK_DEV_FD is not set
109# CONFIG_BLK_DEV_LOOP is not set
110# CONFIG_BLK_DEV_NBD is not set
111CONFIG_BLK_DEV_RAM=y
112CONFIG_BLK_DEV_RAM_SIZE=4096
113CONFIG_BLK_DEV_INITRD=y
114
115#
116# Multi-device support (RAID and LVM)
117#
118# CONFIG_MD is not set
119
120#
121# ATA/IDE/MFM/RLL support
122#
123# CONFIG_IDE is not set
124
125#
126# SCSI support
127#
128# CONFIG_SCSI is not set
129
130#
131# Fusion MPT device support
132#
133
134#
135# I2O device support
136#
137
138#
139# Networking support
140#
141CONFIG_NET=y
142
143#
144# Networking options
145#
146CONFIG_PACKET=y
147# CONFIG_PACKET_MMAP is not set
148# CONFIG_NETLINK_DEV is not set
149# CONFIG_NETFILTER is not set
150CONFIG_UNIX=y
151# CONFIG_NET_KEY is not set
152CONFIG_INET=y
153# CONFIG_IP_MULTICAST is not set
154# CONFIG_IP_ADVANCED_ROUTER is not set
155CONFIG_IP_PNP=y
156CONFIG_IP_PNP_DHCP=y
157# CONFIG_IP_PNP_BOOTP is not set
158# CONFIG_IP_PNP_RARP is not set
159# CONFIG_NET_IPIP is not set
160# CONFIG_NET_IPGRE is not set
161# CONFIG_ARPD is not set
162# CONFIG_INET_ECN is not set
163# CONFIG_SYN_COOKIES is not set
164# CONFIG_INET_AH is not set
165# CONFIG_INET_ESP is not set
166# CONFIG_INET_IPCOMP is not set
167# CONFIG_IPV6 is not set
168# CONFIG_XFRM_USER is not set
169
170#
171# SCTP Configuration (EXPERIMENTAL)
172#
173CONFIG_IPV6_SCTP__=y
174# CONFIG_IP_SCTP is not set
175# CONFIG_ATM is not set
176# CONFIG_VLAN_8021Q is not set
177# CONFIG_LLC is not set
178# CONFIG_DECNET is not set
179# CONFIG_BRIDGE is not set
180# CONFIG_X25 is not set
181# CONFIG_LAPB is not set
182# CONFIG_NET_DIVERT is not set
183# CONFIG_ECONET is not set
184# CONFIG_WAN_ROUTER is not set
185# CONFIG_NET_HW_FLOWCONTROL is not set
186
187#
188# QoS and/or fair queueing
189#
190# CONFIG_NET_SCHED is not set
191
192#
193# Network testing
194#
195# CONFIG_NET_PKTGEN is not set
196CONFIG_NETDEVICES=y
197# CONFIG_DUMMY is not set
198# CONFIG_BONDING is not set
199# CONFIG_EQUALIZER is not set
200# CONFIG_TUN is not set
201# CONFIG_ETHERTAP is not set
202
203#
204# Ethernet (10 or 100Mbit)
205#
206CONFIG_NET_ETHERNET=y
207# CONFIG_MII is not set
208# CONFIG_OAKNET is not set
209
210#
211# Ethernet (1000 Mbit)
212#
213
214#
215# Ethernet (10000 Mbit)
216#
217# CONFIG_PPP is not set
218# CONFIG_SLIP is not set
219
220#
221# Wireless LAN (non-hamradio)
222#
223# CONFIG_NET_RADIO is not set
224
225#
226# Token Ring devices (depends on LLC=y)
227#
228# CONFIG_SHAPER is not set
229
230#
231# Wan interfaces
232#
233# CONFIG_WAN is not set
234
235#
236# Amateur Radio support
237#
238# CONFIG_HAMRADIO is not set
239
240#
241# IrDA (infrared) support
242#
243# CONFIG_IRDA is not set
244
245#
246# ISDN subsystem
247#
248# CONFIG_ISDN_BOOL is not set
249
250#
251# Graphics support
252#
253# CONFIG_FB is not set
254
255#
256# Old CD-ROM drivers (not SCSI, not IDE)
257#
258# CONFIG_CD_NO_IDESCSI is not set
259
260#
261# Input device support
262#
263# CONFIG_INPUT is not set
264
265#
266# Userland interfaces
267#
268
269#
270# Input I/O drivers
271#
272# CONFIG_GAMEPORT is not set
273CONFIG_SOUND_GAMEPORT=y
274# CONFIG_SERIO is not set
275
276#
277# Input Device Drivers
278#
279
280#
281# Macintosh device drivers
282#
283
284#
285# Character devices
286#
287# CONFIG_SERIAL_NONSTANDARD is not set
288
289#
290# Serial drivers
291#
292CONFIG_SERIAL_8250=y
293CONFIG_SERIAL_8250_CONSOLE=y
294# CONFIG_SERIAL_8250_EXTENDED is not set
295
296#
297# Non-8250 serial port support
298#
299CONFIG_SERIAL_CORE=y
300CONFIG_SERIAL_CORE_CONSOLE=y
301CONFIG_UNIX98_PTYS=y
302CONFIG_UNIX98_PTY_COUNT=32
303
304#
305# I2C support
306#
307# CONFIG_I2C is not set
308
309#
310# I2C Hardware Sensors Mainboard support
311#
312
313#
314# I2C Hardware Sensors Chip support
315#
316# CONFIG_I2C_SENSOR is not set
317
318#
319# Mice
320#
321# CONFIG_BUSMOUSE is not set
322# CONFIG_QIC02_TAPE is not set
323
324#
325# IPMI
326#
327# CONFIG_IPMI_HANDLER is not set
328
329#
330# Watchdog Cards
331#
332# CONFIG_WATCHDOG is not set
333# CONFIG_NVRAM is not set
334CONFIG_GEN_RTC=y
335# CONFIG_GEN_RTC_X is not set
336# CONFIG_DTLK is not set
337# CONFIG_R3964 is not set
338# CONFIG_APPLICOM is not set
339
340#
341# Ftape, the floppy tape device driver
342#
343# CONFIG_FTAPE is not set
344# CONFIG_AGP is not set
345# CONFIG_DRM is not set
346# CONFIG_RAW_DRIVER is not set
347# CONFIG_HANGCHECK_TIMER is not set
348
349#
350# Multimedia devices
351#
352# CONFIG_VIDEO_DEV is not set
353
354#
355# Digital Video Broadcasting Devices
356#
357# CONFIG_DVB is not set
358
359#
360# File systems
361#
362CONFIG_EXT2_FS=y
363# CONFIG_EXT2_FS_XATTR is not set
364CONFIG_EXT3_FS=y
365CONFIG_EXT3_FS_XATTR=y
366# CONFIG_EXT3_FS_POSIX_ACL is not set
367# CONFIG_EXT3_FS_SECURITY is not set
368CONFIG_JBD=y
369# CONFIG_JBD_DEBUG is not set
370CONFIG_FS_MBCACHE=y
371# CONFIG_REISERFS_FS is not set
372# CONFIG_JFS_FS is not set
373# CONFIG_XFS_FS is not set
374# CONFIG_MINIX_FS is not set
375# CONFIG_ROMFS_FS is not set
376# CONFIG_QUOTA is not set
377# CONFIG_AUTOFS_FS is not set
378# CONFIG_AUTOFS4_FS is not set
379
380#
381# CD-ROM/DVD Filesystems
382#
383# CONFIG_ISO9660_FS is not set
384# CONFIG_UDF_FS is not set
385
386#
387# DOS/FAT/NT Filesystems
388#
389# CONFIG_FAT_FS is not set
390# CONFIG_NTFS_FS is not set
391
392#
393# Pseudo filesystems
394#
395CONFIG_PROC_FS=y
396# CONFIG_DEVFS_FS is not set
397CONFIG_DEVPTS_FS=y
398# CONFIG_DEVPTS_FS_XATTR is not set
399# CONFIG_TMPFS is not set
400CONFIG_RAMFS=y
401
402#
403# Miscellaneous filesystems
404#
405# CONFIG_ADFS_FS is not set
406# CONFIG_AFFS_FS is not set
407# CONFIG_HFS_FS is not set
408# CONFIG_BEFS_FS is not set
409# CONFIG_BFS_FS is not set
410# CONFIG_EFS_FS is not set
411# CONFIG_CRAMFS is not set
412# CONFIG_VXFS_FS is not set
413# CONFIG_HPFS_FS is not set
414# CONFIG_QNX4FS_FS is not set
415# CONFIG_SYSV_FS is not set
416# CONFIG_UFS_FS is not set
417
418#
419# Network File Systems
420#
421CONFIG_NFS_FS=y
422# CONFIG_NFS_V3 is not set
423# CONFIG_NFS_V4 is not set
424# CONFIG_NFSD is not set
425CONFIG_ROOT_NFS=y
426CONFIG_LOCKD=y
427# CONFIG_EXPORTFS is not set
428CONFIG_SUNRPC=y
429# CONFIG_SUNRPC_GSS is not set
430# CONFIG_SMB_FS is not set
431# CONFIG_CIFS is not set
432# CONFIG_NCP_FS is not set
433# CONFIG_CODA_FS is not set
434# CONFIG_INTERMEZZO_FS is not set
435# CONFIG_AFS_FS is not set
436
437#
438# Partition Types
439#
440CONFIG_PARTITION_ADVANCED=y
441# CONFIG_ACORN_PARTITION is not set
442# CONFIG_OSF_PARTITION is not set
443# CONFIG_AMIGA_PARTITION is not set
444# CONFIG_ATARI_PARTITION is not set
445# CONFIG_MAC_PARTITION is not set
446# CONFIG_MSDOS_PARTITION is not set
447# CONFIG_LDM_PARTITION is not set
448# CONFIG_NEC98_PARTITION is not set
449# CONFIG_SGI_PARTITION is not set
450# CONFIG_ULTRIX_PARTITION is not set
451# CONFIG_SUN_PARTITION is not set
452# CONFIG_EFI_PARTITION is not set
453
454#
455# Sound
456#
457# CONFIG_SOUND is not set
458# CONFIG_SCC_ENET is not set
459CONFIG_FEC_ENET=y
460# CONFIG_USE_MDIO is not set
461
462#
463# MPC8260 CPM Options
464#
465CONFIG_SCC_CONSOLE=y
466# CONFIG_FCC1_ENET is not set
467CONFIG_FCC2_ENET=y
468# CONFIG_FCC3_ENET is not set
469
470#
471# USB support
472#
473# CONFIG_USB_GADGET is not set
474
475#
476# Bluetooth support
477#
478# CONFIG_BT is not set
479
480#
481# Library routines
482#
483# CONFIG_CRC32 is not set
484
485#
486# Kernel hacking
487#
488# CONFIG_DEBUG_KERNEL is not set
489# CONFIG_KALLSYMS is not set
490
491#
492# Security options
493#
494# CONFIG_SECURITY is not set
495
496#
497# Cryptographic options
498#
499# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/TQM850L_defconfig b/arch/ppc/configs/TQM850L_defconfig
new file mode 100644
index 000000000000..b02d19630e31
--- /dev/null
+++ b/arch/ppc/configs/TQM850L_defconfig
@@ -0,0 +1,521 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7
8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12
13#
14# General setup
15#
16CONFIG_SWAP=y
17CONFIG_SYSVIPC=y
18# CONFIG_BSD_PROCESS_ACCT is not set
19CONFIG_SYSCTL=y
20CONFIG_LOG_BUF_SHIFT=14
21CONFIG_EMBEDDED=y
22CONFIG_FUTEX=y
23# CONFIG_EPOLL is not set
24
25#
26# Loadable module support
27#
28CONFIG_MODULES=y
29CONFIG_MODULE_UNLOAD=y
30# CONFIG_MODULE_FORCE_UNLOAD is not set
31CONFIG_OBSOLETE_MODPARM=y
32# CONFIG_MODVERSIONS is not set
33CONFIG_KMOD=y
34
35#
36# Platform support
37#
38CONFIG_PPC=y
39CONFIG_PPC32=y
40# CONFIG_6xx is not set
41# CONFIG_40x is not set
42# CONFIG_POWER3 is not set
43CONFIG_8xx=y
44
45#
46# IBM 4xx options
47#
48CONFIG_EMBEDDEDBOOT=y
49CONFIG_SERIAL_CONSOLE=y
50CONFIG_NOT_COHERENT_CACHE=y
51# CONFIG_RPXLITE is not set
52# CONFIG_RPXCLASSIC is not set
53# CONFIG_BSEIP is not set
54# CONFIG_FADS is not set
55# CONFIG_TQM823L is not set
56CONFIG_TQM850L=y
57# CONFIG_TQM855L is not set
58# CONFIG_TQM860L is not set
59# CONFIG_FPS850L is not set
60# CONFIG_SPD823TS is not set
61# CONFIG_IVMS8 is not set
62# CONFIG_IVML24 is not set
63# CONFIG_SM850 is not set
64# CONFIG_HERMES_PRO is not set
65# CONFIG_IP860 is not set
66# CONFIG_LWMON is not set
67# CONFIG_PCU_E is not set
68# CONFIG_CCM is not set
69# CONFIG_LANTEC is not set
70# CONFIG_MBX is not set
71# CONFIG_WINCEPT is not set
72CONFIG_TQM8xxL=y
73# CONFIG_SMP is not set
74# CONFIG_PREEMPT is not set
75CONFIG_MATH_EMULATION=y
76# CONFIG_CPU_FREQ is not set
77
78#
79# General setup
80#
81# CONFIG_HIGHMEM is not set
82# CONFIG_PCI is not set
83# CONFIG_PCI_DOMAINS is not set
84# CONFIG_PCI_QSPAN is not set
85CONFIG_KCORE_ELF=y
86CONFIG_BINFMT_ELF=y
87CONFIG_KERNEL_ELF=y
88# CONFIG_BINFMT_MISC is not set
89# CONFIG_HOTPLUG is not set
90
91#
92# Parallel port support
93#
94# CONFIG_PARPORT is not set
95# CONFIG_CMDLINE_BOOL is not set
96
97#
98# Advanced setup
99#
100# CONFIG_ADVANCED_OPTIONS is not set
101
102#
103# Default settings for advanced configuration options are used
104#
105CONFIG_HIGHMEM_START=0xfe000000
106CONFIG_LOWMEM_SIZE=0x30000000
107CONFIG_KERNEL_START=0xc0000000
108CONFIG_TASK_SIZE=0x80000000
109CONFIG_BOOT_LOAD=0x00400000
110
111#
112# Memory Technology Devices (MTD)
113#
114# CONFIG_MTD is not set
115
116#
117# Plug and Play support
118#
119# CONFIG_PNP is not set
120
121#
122# Block devices
123#
124# CONFIG_BLK_DEV_FD is not set
125# CONFIG_BLK_DEV_LOOP is not set
126# CONFIG_BLK_DEV_NBD is not set
127# CONFIG_BLK_DEV_RAM is not set
128# CONFIG_BLK_DEV_INITRD is not set
129
130#
131# Multi-device support (RAID and LVM)
132#
133# CONFIG_MD is not set
134
135#
136# ATA/IDE/MFM/RLL support
137#
138# CONFIG_IDE is not set
139
140#
141# SCSI support
142#
143# CONFIG_SCSI is not set
144
145#
146# Fusion MPT device support
147#
148
149#
150# I2O device support
151#
152
153#
154# Networking support
155#
156CONFIG_NET=y
157
158#
159# Networking options
160#
161CONFIG_PACKET=y
162# CONFIG_PACKET_MMAP is not set
163# CONFIG_NETLINK_DEV is not set
164# CONFIG_NETFILTER is not set
165CONFIG_UNIX=y
166# CONFIG_NET_KEY is not set
167CONFIG_INET=y
168# CONFIG_IP_MULTICAST is not set
169# CONFIG_IP_ADVANCED_ROUTER is not set
170CONFIG_IP_PNP=y
171CONFIG_IP_PNP_DHCP=y
172# CONFIG_IP_PNP_BOOTP is not set
173# CONFIG_IP_PNP_RARP is not set
174# CONFIG_NET_IPIP is not set
175# CONFIG_NET_IPGRE is not set
176# CONFIG_ARPD is not set
177# CONFIG_INET_ECN is not set
178# CONFIG_SYN_COOKIES is not set
179# CONFIG_INET_AH is not set
180# CONFIG_INET_ESP is not set
181# CONFIG_INET_IPCOMP is not set
182# CONFIG_IPV6 is not set
183# CONFIG_XFRM_USER is not set
184
185#
186# SCTP Configuration (EXPERIMENTAL)
187#
188CONFIG_IPV6_SCTP__=y
189# CONFIG_IP_SCTP is not set
190# CONFIG_ATM is not set
191# CONFIG_VLAN_8021Q is not set
192# CONFIG_LLC is not set
193# CONFIG_DECNET is not set
194# CONFIG_BRIDGE is not set
195# CONFIG_X25 is not set
196# CONFIG_LAPB is not set
197# CONFIG_NET_DIVERT is not set
198# CONFIG_ECONET is not set
199# CONFIG_WAN_ROUTER is not set
200# CONFIG_NET_HW_FLOWCONTROL is not set
201
202#
203# QoS and/or fair queueing
204#
205# CONFIG_NET_SCHED is not set
206
207#
208# Network testing
209#
210# CONFIG_NET_PKTGEN is not set
211CONFIG_NETDEVICES=y
212# CONFIG_DUMMY is not set
213# CONFIG_BONDING is not set
214# CONFIG_EQUALIZER is not set
215# CONFIG_TUN is not set
216# CONFIG_ETHERTAP is not set
217
218#
219# Ethernet (10 or 100Mbit)
220#
221CONFIG_NET_ETHERNET=y
222# CONFIG_MII is not set
223# CONFIG_OAKNET is not set
224
225#
226# Ethernet (1000 Mbit)
227#
228
229#
230# Ethernet (10000 Mbit)
231#
232# CONFIG_PPP is not set
233# CONFIG_SLIP is not set
234
235#
236# Wireless LAN (non-hamradio)
237#
238# CONFIG_NET_RADIO is not set
239
240#
241# Token Ring devices (depends on LLC=y)
242#
243# CONFIG_SHAPER is not set
244
245#
246# Wan interfaces
247#
248# CONFIG_WAN is not set
249
250#
251# Amateur Radio support
252#
253# CONFIG_HAMRADIO is not set
254
255#
256# IrDA (infrared) support
257#
258# CONFIG_IRDA is not set
259
260#
261# ISDN subsystem
262#
263# CONFIG_ISDN_BOOL is not set
264
265#
266# Graphics support
267#
268# CONFIG_FB is not set
269
270#
271# Old CD-ROM drivers (not SCSI, not IDE)
272#
273# CONFIG_CD_NO_IDESCSI is not set
274
275#
276# Input device support
277#
278# CONFIG_INPUT is not set
279
280#
281# Userland interfaces
282#
283
284#
285# Input I/O drivers
286#
287# CONFIG_GAMEPORT is not set
288CONFIG_SOUND_GAMEPORT=y
289# CONFIG_SERIO is not set
290
291#
292# Input Device Drivers
293#
294
295#
296# Macintosh device drivers
297#
298
299#
300# Serial drivers
301#
302# CONFIG_SERIAL_8250 is not set
303
304#
305# Non-8250 serial port support
306#
307CONFIG_SERIAL_CORE=y
308CONFIG_SERIAL_CORE_CONSOLE=y
309CONFIG_SERIAL_CPM=y
310CONFIG_SERIAL_CPM_CONSOLE=y
311# CONFIG_SERIAL_CPM_SCC1 is not set
312# CONFIG_SERIAL_CPM_SCC2 is not set
313# CONFIG_SERIAL_CPM_SCC3 is not set
314# CONFIG_SERIAL_CPM_SCC4 is not set
315CONFIG_SERIAL_CPM_SMC1=y
316CONFIG_SERIAL_CPM_SMC2=y
317CONFIG_SERIAL_CPM_ALT_SMC2=y
318CONFIG_UNIX98_PTYS=y
319# CONFIG_LEGACY_PTYS is not set
320
321#
322# I2C support
323#
324# CONFIG_I2C is not set
325
326#
327# I2C Hardware Sensors Mainboard support
328#
329
330#
331# I2C Hardware Sensors Chip support
332#
333# CONFIG_I2C_SENSOR is not set
334
335#
336# Mice
337#
338# CONFIG_BUSMOUSE is not set
339# CONFIG_QIC02_TAPE is not set
340
341#
342# IPMI
343#
344# CONFIG_IPMI_HANDLER is not set
345
346#
347# Watchdog Cards
348#
349# CONFIG_WATCHDOG is not set
350# CONFIG_NVRAM is not set
351CONFIG_GEN_RTC=y
352# CONFIG_GEN_RTC_X is not set
353# CONFIG_DTLK is not set
354# CONFIG_R3964 is not set
355# CONFIG_APPLICOM is not set
356
357#
358# Ftape, the floppy tape device driver
359#
360# CONFIG_FTAPE is not set
361# CONFIG_AGP is not set
362# CONFIG_DRM is not set
363# CONFIG_RAW_DRIVER is not set
364# CONFIG_HANGCHECK_TIMER is not set
365
366#
367# Multimedia devices
368#
369# CONFIG_VIDEO_DEV is not set
370
371#
372# Digital Video Broadcasting Devices
373#
374# CONFIG_DVB is not set
375
376#
377# File systems
378#
379# CONFIG_EXT2_FS is not set
380CONFIG_EXT3_FS=y
381CONFIG_EXT3_FS_XATTR=y
382# CONFIG_EXT3_FS_POSIX_ACL is not set
383# CONFIG_EXT3_FS_SECURITY is not set
384CONFIG_JBD=y
385# CONFIG_JBD_DEBUG is not set
386CONFIG_FS_MBCACHE=y
387# CONFIG_REISERFS_FS is not set
388# CONFIG_JFS_FS is not set
389# CONFIG_XFS_FS is not set
390# CONFIG_MINIX_FS is not set
391# CONFIG_ROMFS_FS is not set
392# CONFIG_QUOTA is not set
393# CONFIG_AUTOFS_FS is not set
394# CONFIG_AUTOFS4_FS is not set
395
396#
397# CD-ROM/DVD Filesystems
398#
399# CONFIG_ISO9660_FS is not set
400# CONFIG_UDF_FS is not set
401
402#
403# DOS/FAT/NT Filesystems
404#
405# CONFIG_FAT_FS is not set
406# CONFIG_NTFS_FS is not set
407
408#
409# Pseudo filesystems
410#
411CONFIG_PROC_FS=y
412# CONFIG_DEVFS_FS is not set
413CONFIG_DEVPTS_FS=y
414# CONFIG_DEVPTS_FS_XATTR is not set
415CONFIG_TMPFS=y
416CONFIG_RAMFS=y
417
418#
419# Miscellaneous filesystems
420#
421# CONFIG_ADFS_FS is not set
422# CONFIG_AFFS_FS is not set
423# CONFIG_HFS_FS is not set
424# CONFIG_BEFS_FS is not set
425# CONFIG_BFS_FS is not set
426# CONFIG_EFS_FS is not set
427# CONFIG_CRAMFS is not set
428# CONFIG_VXFS_FS is not set
429# CONFIG_HPFS_FS is not set
430# CONFIG_QNX4FS_FS is not set
431# CONFIG_SYSV_FS is not set
432# CONFIG_UFS_FS is not set
433
434#
435# Network File Systems
436#
437CONFIG_NFS_FS=y
438# CONFIG_NFS_V3 is not set
439# CONFIG_NFS_V4 is not set
440# CONFIG_NFSD is not set
441CONFIG_ROOT_NFS=y
442CONFIG_LOCKD=y
443# CONFIG_EXPORTFS is not set
444CONFIG_SUNRPC=y
445# CONFIG_SUNRPC_GSS is not set
446# CONFIG_SMB_FS is not set
447# CONFIG_CIFS is not set
448# CONFIG_NCP_FS is not set
449# CONFIG_CODA_FS is not set
450# CONFIG_INTERMEZZO_FS is not set
451# CONFIG_AFS_FS is not set
452
453#
454# Partition Types
455#
456CONFIG_PARTITION_ADVANCED=y
457# CONFIG_ACORN_PARTITION is not set
458# CONFIG_OSF_PARTITION is not set
459# CONFIG_AMIGA_PARTITION is not set
460# CONFIG_ATARI_PARTITION is not set
461# CONFIG_MAC_PARTITION is not set
462# CONFIG_MSDOS_PARTITION is not set
463# CONFIG_LDM_PARTITION is not set
464# CONFIG_NEC98_PARTITION is not set
465# CONFIG_SGI_PARTITION is not set
466# CONFIG_ULTRIX_PARTITION is not set
467# CONFIG_SUN_PARTITION is not set
468# CONFIG_EFI_PARTITION is not set
469
470#
471# Sound
472#
473# CONFIG_SOUND is not set
474
475#
476# MPC8xx CPM Options
477#
478CONFIG_SCC_ENET=y
479# CONFIG_SCC1_ENET is not set
480CONFIG_SCC2_ENET=y
481# CONFIG_SCC3_ENET is not set
482# CONFIG_FEC_ENET is not set
483CONFIG_ENET_BIG_BUFFERS=y
484
485#
486# Generic MPC8xx Options
487#
488CONFIG_8xx_COPYBACK=y
489CONFIG_8xx_CPU6=y
490# CONFIG_UCODE_PATCH is not set
491
492#
493# USB support
494#
495# CONFIG_USB_GADGET is not set
496
497#
498# Bluetooth support
499#
500# CONFIG_BT is not set
501
502#
503# Library routines
504#
505# CONFIG_CRC32 is not set
506
507#
508# Kernel hacking
509#
510# CONFIG_DEBUG_KERNEL is not set
511# CONFIG_KALLSYMS is not set
512
513#
514# Security options
515#
516# CONFIG_SECURITY is not set
517
518#
519# Cryptographic options
520#
521# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/TQM860L_defconfig b/arch/ppc/configs/TQM860L_defconfig
new file mode 100644
index 000000000000..857e4ab28011
--- /dev/null
+++ b/arch/ppc/configs/TQM860L_defconfig
@@ -0,0 +1,549 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7
8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12
13#
14# General setup
15#
16CONFIG_SWAP=y
17CONFIG_SYSVIPC=y
18# CONFIG_BSD_PROCESS_ACCT is not set
19CONFIG_SYSCTL=y
20CONFIG_LOG_BUF_SHIFT=14
21CONFIG_EMBEDDED=y
22CONFIG_FUTEX=y
23# CONFIG_EPOLL is not set
24
25#
26# Loadable module support
27#
28CONFIG_MODULES=y
29CONFIG_MODULE_UNLOAD=y
30# CONFIG_MODULE_FORCE_UNLOAD is not set
31CONFIG_OBSOLETE_MODPARM=y
32# CONFIG_MODVERSIONS is not set
33CONFIG_KMOD=y
34
35#
36# Platform support
37#
38CONFIG_PPC=y
39CONFIG_PPC32=y
40# CONFIG_6xx is not set
41# CONFIG_40x is not set
42# CONFIG_POWER3 is not set
43CONFIG_8xx=y
44
45#
46# IBM 4xx options
47#
48CONFIG_EMBEDDEDBOOT=y
49CONFIG_SERIAL_CONSOLE=y
50CONFIG_NOT_COHERENT_CACHE=y
51# CONFIG_RPXLITE is not set
52# CONFIG_RPXCLASSIC is not set
53# CONFIG_BSEIP is not set
54# CONFIG_FADS is not set
55# CONFIG_TQM823L is not set
56# CONFIG_TQM850L is not set
57# CONFIG_TQM855L is not set
58CONFIG_TQM860L=y
59# CONFIG_FPS850L is not set
60# CONFIG_SPD823TS is not set
61# CONFIG_IVMS8 is not set
62# CONFIG_IVML24 is not set
63# CONFIG_SM850 is not set
64# CONFIG_HERMES_PRO is not set
65# CONFIG_IP860 is not set
66# CONFIG_LWMON is not set
67# CONFIG_PCU_E is not set
68# CONFIG_CCM is not set
69# CONFIG_LANTEC is not set
70# CONFIG_MBX is not set
71# CONFIG_WINCEPT is not set
72CONFIG_TQM8xxL=y
73# CONFIG_SMP is not set
74# CONFIG_PREEMPT is not set
75CONFIG_MATH_EMULATION=y
76# CONFIG_CPU_FREQ is not set
77
78#
79# General setup
80#
81# CONFIG_HIGHMEM is not set
82# CONFIG_PCI is not set
83# CONFIG_PCI_DOMAINS is not set
84# CONFIG_PCI_QSPAN is not set
85CONFIG_KCORE_ELF=y
86CONFIG_BINFMT_ELF=y
87CONFIG_KERNEL_ELF=y
88# CONFIG_BINFMT_MISC is not set
89# CONFIG_HOTPLUG is not set
90
91#
92# Parallel port support
93#
94# CONFIG_PARPORT is not set
95# CONFIG_CMDLINE_BOOL is not set
96
97#
98# Advanced setup
99#
100# CONFIG_ADVANCED_OPTIONS is not set
101
102#
103# Default settings for advanced configuration options are used
104#
105CONFIG_HIGHMEM_START=0xfe000000
106CONFIG_LOWMEM_SIZE=0x30000000
107CONFIG_KERNEL_START=0xc0000000
108CONFIG_TASK_SIZE=0x80000000
109CONFIG_BOOT_LOAD=0x00400000
110
111#
112# Memory Technology Devices (MTD)
113#
114# CONFIG_MTD is not set
115
116#
117# Plug and Play support
118#
119# CONFIG_PNP is not set
120
121#
122# Block devices
123#
124# CONFIG_BLK_DEV_FD is not set
125# CONFIG_BLK_DEV_LOOP is not set
126# CONFIG_BLK_DEV_NBD is not set
127# CONFIG_BLK_DEV_RAM is not set
128# CONFIG_BLK_DEV_INITRD is not set
129
130#
131# Multi-device support (RAID and LVM)
132#
133# CONFIG_MD is not set
134
135#
136# ATA/IDE/MFM/RLL support
137#
138CONFIG_IDE=y
139
140#
141# IDE, ATA and ATAPI Block devices
142#
143CONFIG_BLK_DEV_IDE=y
144
145#
146# Please see Documentation/ide.txt for help/info on IDE drives
147#
148# CONFIG_BLK_DEV_HD is not set
149CONFIG_BLK_DEV_IDEDISK=y
150# CONFIG_IDEDISK_MULTI_MODE is not set
151# CONFIG_IDEDISK_STROKE is not set
152# CONFIG_BLK_DEV_IDECD is not set
153# CONFIG_BLK_DEV_IDEFLOPPY is not set
154# CONFIG_IDE_TASK_IOCTL is not set
155
156#
157# IDE chipset support/bugfixes
158#
159CONFIG_BLK_DEV_MPC8xx_IDE=y
160CONFIG_IDE_8xx_PCCARD=y
161# CONFIG_IDE_8xx_DIRECT is not set
162# CONFIG_IDE_EXT_DIRECT is not set
163
164#
165# SCSI support
166#
167# CONFIG_SCSI is not set
168
169#
170# Fusion MPT device support
171#
172
173#
174# I2O device support
175#
176
177#
178# Networking support
179#
180CONFIG_NET=y
181
182#
183# Networking options
184#
185CONFIG_PACKET=y
186# CONFIG_PACKET_MMAP is not set
187# CONFIG_NETLINK_DEV is not set
188# CONFIG_NETFILTER is not set
189CONFIG_UNIX=y
190# CONFIG_NET_KEY is not set
191CONFIG_INET=y
192# CONFIG_IP_MULTICAST is not set
193# CONFIG_IP_ADVANCED_ROUTER is not set
194CONFIG_IP_PNP=y
195CONFIG_IP_PNP_DHCP=y
196# CONFIG_IP_PNP_BOOTP is not set
197# CONFIG_IP_PNP_RARP is not set
198# CONFIG_NET_IPIP is not set
199# CONFIG_NET_IPGRE is not set
200# CONFIG_ARPD is not set
201# CONFIG_INET_ECN is not set
202# CONFIG_SYN_COOKIES is not set
203# CONFIG_INET_AH is not set
204# CONFIG_INET_ESP is not set
205# CONFIG_INET_IPCOMP is not set
206# CONFIG_IPV6 is not set
207# CONFIG_XFRM_USER is not set
208
209#
210# SCTP Configuration (EXPERIMENTAL)
211#
212CONFIG_IPV6_SCTP__=y
213# CONFIG_IP_SCTP is not set
214# CONFIG_ATM is not set
215# CONFIG_VLAN_8021Q is not set
216# CONFIG_LLC is not set
217# CONFIG_DECNET is not set
218# CONFIG_BRIDGE is not set
219# CONFIG_X25 is not set
220# CONFIG_LAPB is not set
221# CONFIG_NET_DIVERT is not set
222# CONFIG_ECONET is not set
223# CONFIG_WAN_ROUTER is not set
224# CONFIG_NET_HW_FLOWCONTROL is not set
225
226#
227# QoS and/or fair queueing
228#
229# CONFIG_NET_SCHED is not set
230
231#
232# Network testing
233#
234# CONFIG_NET_PKTGEN is not set
235CONFIG_NETDEVICES=y
236# CONFIG_DUMMY is not set
237# CONFIG_BONDING is not set
238# CONFIG_EQUALIZER is not set
239# CONFIG_TUN is not set
240# CONFIG_ETHERTAP is not set
241
242#
243# Ethernet (10 or 100Mbit)
244#
245CONFIG_NET_ETHERNET=y
246# CONFIG_MII is not set
247# CONFIG_OAKNET is not set
248
249#
250# Ethernet (1000 Mbit)
251#
252
253#
254# Ethernet (10000 Mbit)
255#
256# CONFIG_PPP is not set
257# CONFIG_SLIP is not set
258
259#
260# Wireless LAN (non-hamradio)
261#
262# CONFIG_NET_RADIO is not set
263
264#
265# Token Ring devices (depends on LLC=y)
266#
267# CONFIG_SHAPER is not set
268
269#
270# Wan interfaces
271#
272# CONFIG_WAN is not set
273
274#
275# Amateur Radio support
276#
277# CONFIG_HAMRADIO is not set
278
279#
280# IrDA (infrared) support
281#
282# CONFIG_IRDA is not set
283
284#
285# ISDN subsystem
286#
287# CONFIG_ISDN_BOOL is not set
288
289#
290# Graphics support
291#
292# CONFIG_FB is not set
293
294#
295# Old CD-ROM drivers (not SCSI, not IDE)
296#
297# CONFIG_CD_NO_IDESCSI is not set
298
299#
300# Input device support
301#
302# CONFIG_INPUT is not set
303
304#
305# Userland interfaces
306#
307
308#
309# Input I/O drivers
310#
311# CONFIG_GAMEPORT is not set
312CONFIG_SOUND_GAMEPORT=y
313# CONFIG_SERIO is not set
314
315#
316# Input Device Drivers
317#
318
319#
320# Macintosh device drivers
321#
322
323#
324# Serial drivers
325#
326# CONFIG_SERIAL_8250 is not set
327
328#
329# Non-8250 serial port support
330#
331CONFIG_SERIAL_CORE=y
332CONFIG_SERIAL_CORE_CONSOLE=y
333CONFIG_SERIAL_CPM=y
334CONFIG_SERIAL_CPM_CONSOLE=y
335# CONFIG_SERIAL_CPM_SCC1 is not set
336# CONFIG_SERIAL_CPM_SCC2 is not set
337# CONFIG_SERIAL_CPM_SCC3 is not set
338# CONFIG_SERIAL_CPM_SCC4 is not set
339CONFIG_SERIAL_CPM_SMC1=y
340CONFIG_SERIAL_CPM_SMC2=y
341CONFIG_UNIX98_PTYS=y
342# CONFIG_LEGACY_PTYS is not set
343
344#
345# I2C support
346#
347# CONFIG_I2C is not set
348
349#
350# I2C Hardware Sensors Mainboard support
351#
352
353#
354# I2C Hardware Sensors Chip support
355#
356# CONFIG_I2C_SENSOR is not set
357
358#
359# Mice
360#
361# CONFIG_BUSMOUSE is not set
362# CONFIG_QIC02_TAPE is not set
363
364#
365# IPMI
366#
367# CONFIG_IPMI_HANDLER is not set
368
369#
370# Watchdog Cards
371#
372# CONFIG_WATCHDOG is not set
373# CONFIG_NVRAM is not set
374CONFIG_GEN_RTC=y
375# CONFIG_GEN_RTC_X is not set
376# CONFIG_DTLK is not set
377# CONFIG_R3964 is not set
378# CONFIG_APPLICOM is not set
379
380#
381# Ftape, the floppy tape device driver
382#
383# CONFIG_FTAPE is not set
384# CONFIG_AGP is not set
385# CONFIG_DRM is not set
386# CONFIG_RAW_DRIVER is not set
387# CONFIG_HANGCHECK_TIMER is not set
388
389#
390# Multimedia devices
391#
392# CONFIG_VIDEO_DEV is not set
393
394#
395# Digital Video Broadcasting Devices
396#
397# CONFIG_DVB is not set
398
399#
400# File systems
401#
402CONFIG_EXT2_FS=y
403# CONFIG_EXT2_FS_XATTR is not set
404CONFIG_EXT3_FS=y
405CONFIG_EXT3_FS_XATTR=y
406# CONFIG_EXT3_FS_POSIX_ACL is not set
407# CONFIG_EXT3_FS_SECURITY is not set
408CONFIG_JBD=y
409# CONFIG_JBD_DEBUG is not set
410CONFIG_FS_MBCACHE=y
411# CONFIG_REISERFS_FS is not set
412# CONFIG_JFS_FS is not set
413# CONFIG_XFS_FS is not set
414# CONFIG_MINIX_FS is not set
415# CONFIG_ROMFS_FS is not set
416# CONFIG_QUOTA is not set
417# CONFIG_AUTOFS_FS is not set
418# CONFIG_AUTOFS4_FS is not set
419
420#
421# CD-ROM/DVD Filesystems
422#
423# CONFIG_ISO9660_FS is not set
424# CONFIG_UDF_FS is not set
425
426#
427# DOS/FAT/NT Filesystems
428#
429# CONFIG_FAT_FS is not set
430# CONFIG_NTFS_FS is not set
431
432#
433# Pseudo filesystems
434#
435CONFIG_PROC_FS=y
436# CONFIG_DEVFS_FS is not set
437CONFIG_DEVPTS_FS=y
438# CONFIG_DEVPTS_FS_XATTR is not set
439CONFIG_TMPFS=y
440CONFIG_RAMFS=y
441
442#
443# Miscellaneous filesystems
444#
445# CONFIG_ADFS_FS is not set
446# CONFIG_AFFS_FS is not set
447# CONFIG_HFS_FS is not set
448# CONFIG_BEFS_FS is not set
449# CONFIG_BFS_FS is not set
450# CONFIG_EFS_FS is not set
451# CONFIG_CRAMFS is not set
452# CONFIG_VXFS_FS is not set
453# CONFIG_HPFS_FS is not set
454# CONFIG_QNX4FS_FS is not set
455# CONFIG_SYSV_FS is not set
456# CONFIG_UFS_FS is not set
457
458#
459# Network File Systems
460#
461CONFIG_NFS_FS=y
462# CONFIG_NFS_V3 is not set
463# CONFIG_NFS_V4 is not set
464# CONFIG_NFSD is not set
465CONFIG_ROOT_NFS=y
466CONFIG_LOCKD=y
467# CONFIG_EXPORTFS is not set
468CONFIG_SUNRPC=y
469# CONFIG_SUNRPC_GSS is not set
470# CONFIG_SMB_FS is not set
471# CONFIG_CIFS is not set
472# CONFIG_NCP_FS is not set
473# CONFIG_CODA_FS is not set
474# CONFIG_INTERMEZZO_FS is not set
475# CONFIG_AFS_FS is not set
476
477#
478# Partition Types
479#
480CONFIG_PARTITION_ADVANCED=y
481# CONFIG_ACORN_PARTITION is not set
482# CONFIG_OSF_PARTITION is not set
483# CONFIG_AMIGA_PARTITION is not set
484# CONFIG_ATARI_PARTITION is not set
485CONFIG_MAC_PARTITION=y
486CONFIG_MSDOS_PARTITION=y
487# CONFIG_BSD_DISKLABEL is not set
488# CONFIG_MINIX_SUBPARTITION is not set
489# CONFIG_SOLARIS_X86_PARTITION is not set
490# CONFIG_UNIXWARE_DISKLABEL is not set
491# CONFIG_LDM_PARTITION is not set
492# CONFIG_NEC98_PARTITION is not set
493# CONFIG_SGI_PARTITION is not set
494# CONFIG_ULTRIX_PARTITION is not set
495# CONFIG_SUN_PARTITION is not set
496# CONFIG_EFI_PARTITION is not set
497
498#
499# Sound
500#
501# CONFIG_SOUND is not set
502
503#
504# MPC8xx CPM Options
505#
506CONFIG_SCC_ENET=y
507CONFIG_SCC1_ENET=y
508# CONFIG_SCC2_ENET is not set
509# CONFIG_SCC3_ENET is not set
510# CONFIG_FEC_ENET is not set
511CONFIG_ENET_BIG_BUFFERS=y
512
513#
514# Generic MPC8xx Options
515#
516CONFIG_8xx_COPYBACK=y
517# CONFIG_8xx_CPU6 is not set
518# CONFIG_UCODE_PATCH is not set
519
520#
521# USB support
522#
523# CONFIG_USB_GADGET is not set
524
525#
526# Bluetooth support
527#
528# CONFIG_BT is not set
529
530#
531# Library routines
532#
533# CONFIG_CRC32 is not set
534
535#
536# Kernel hacking
537#
538# CONFIG_DEBUG_KERNEL is not set
539# CONFIG_KALLSYMS is not set
540
541#
542# Security options
543#
544# CONFIG_SECURITY is not set
545
546#
547# Cryptographic options
548#
549# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/adir_defconfig b/arch/ppc/configs/adir_defconfig
new file mode 100644
index 000000000000..f20e6533dc79
--- /dev/null
+++ b/arch/ppc/configs/adir_defconfig
@@ -0,0 +1,805 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7
8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12
13#
14# General setup
15#
16CONFIG_SWAP=y
17CONFIG_SYSVIPC=y
18# CONFIG_BSD_PROCESS_ACCT is not set
19CONFIG_SYSCTL=y
20CONFIG_LOG_BUF_SHIFT=14
21# CONFIG_EMBEDDED is not set
22CONFIG_FUTEX=y
23CONFIG_EPOLL=y
24
25#
26# Loadable module support
27#
28CONFIG_MODULES=y
29CONFIG_MODULE_UNLOAD=y
30# CONFIG_MODULE_FORCE_UNLOAD is not set
31CONFIG_OBSOLETE_MODPARM=y
32# CONFIG_MODVERSIONS is not set
33CONFIG_KMOD=y
34
35#
36# Platform support
37#
38CONFIG_PPC=y
39CONFIG_PPC32=y
40CONFIG_6xx=y
41# CONFIG_40x is not set
42# CONFIG_POWER3 is not set
43# CONFIG_8xx is not set
44
45#
46# IBM 4xx options
47#
48# CONFIG_8260 is not set
49CONFIG_GENERIC_ISA_DMA=y
50CONFIG_PPC_STD_MMU=y
51# CONFIG_PPC_MULTIPLATFORM is not set
52# CONFIG_APUS is not set
53# CONFIG_WILLOW_2 is not set
54# CONFIG_PCORE is not set
55# CONFIG_POWERPMC250 is not set
56# CONFIG_EV64260 is not set
57# CONFIG_SPRUCE is not set
58# CONFIG_LOPEC is not set
59# CONFIG_MCPN765 is not set
60# CONFIG_MVME5100 is not set
61# CONFIG_PPLUS is not set
62# CONFIG_PRPMC750 is not set
63# CONFIG_PRPMC800 is not set
64# CONFIG_SANDPOINT is not set
65CONFIG_ADIR=y
66# CONFIG_K2 is not set
67# CONFIG_PAL4 is not set
68# CONFIG_GEMINI is not set
69# CONFIG_SMP is not set
70# CONFIG_PREEMPT is not set
71# CONFIG_ALTIVEC is not set
72# CONFIG_TAU is not set
73# CONFIG_CPU_FREQ is not set
74
75#
76# General setup
77#
78# CONFIG_HIGHMEM is not set
79CONFIG_PCI=y
80CONFIG_PCI_DOMAINS=y
81CONFIG_KCORE_ELF=y
82CONFIG_BINFMT_ELF=y
83CONFIG_KERNEL_ELF=y
84# CONFIG_BINFMT_MISC is not set
85CONFIG_PCI_LEGACY_PROC=y
86# CONFIG_PCI_NAMES is not set
87# CONFIG_HOTPLUG is not set
88
89#
90# Parallel port support
91#
92CONFIG_PARPORT=y
93CONFIG_PARPORT_PC=y
94CONFIG_PARPORT_PC_CML1=y
95# CONFIG_PARPORT_SERIAL is not set
96CONFIG_PARPORT_PC_FIFO=y
97CONFIG_PARPORT_PC_SUPERIO=y
98# CONFIG_PARPORT_OTHER is not set
99CONFIG_PARPORT_1284=y
100# CONFIG_PPC601_SYNC_FIX is not set
101CONFIG_CMDLINE_BOOL=y
102CONFIG_CMDLINE="ip=on"
103
104#
105# Advanced setup
106#
107# CONFIG_ADVANCED_OPTIONS is not set
108
109#
110# Default settings for advanced configuration options are used
111#
112CONFIG_HIGHMEM_START=0xfe000000
113CONFIG_LOWMEM_SIZE=0x30000000
114CONFIG_KERNEL_START=0xc0000000
115CONFIG_TASK_SIZE=0x80000000
116CONFIG_BOOT_LOAD=0x00800000
117
118#
119# Memory Technology Devices (MTD)
120#
121# CONFIG_MTD is not set
122
123#
124# Plug and Play support
125#
126# CONFIG_PNP is not set
127
128#
129# Block devices
130#
131CONFIG_BLK_DEV_FD=y
132# CONFIG_PARIDE is not set
133# CONFIG_BLK_CPQ_DA is not set
134# CONFIG_BLK_CPQ_CISS_DA is not set
135# CONFIG_BLK_DEV_DAC960 is not set
136# CONFIG_BLK_DEV_UMEM is not set
137CONFIG_BLK_DEV_LOOP=y
138# CONFIG_BLK_DEV_NBD is not set
139CONFIG_BLK_DEV_RAM=y
140CONFIG_BLK_DEV_RAM_SIZE=4096
141CONFIG_BLK_DEV_INITRD=y
142
143#
144# Multi-device support (RAID and LVM)
145#
146# CONFIG_MD is not set
147
148#
149# ATA/IDE/MFM/RLL support
150#
151# CONFIG_IDE is not set
152
153#
154# SCSI support
155#
156CONFIG_SCSI=y
157
158#
159# SCSI support type (disk, tape, CD-ROM)
160#
161CONFIG_BLK_DEV_SD=y
162CONFIG_CHR_DEV_ST=y
163# CONFIG_CHR_DEV_OSST is not set
164CONFIG_BLK_DEV_SR=y
165CONFIG_BLK_DEV_SR_VENDOR=y
166CONFIG_CHR_DEV_SG=y
167
168#
169# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
170#
171# CONFIG_SCSI_MULTI_LUN is not set
172# CONFIG_SCSI_REPORT_LUNS is not set
173CONFIG_SCSI_CONSTANTS=y
174# CONFIG_SCSI_LOGGING is not set
175
176#
177# SCSI low-level drivers
178#
179# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
180# CONFIG_SCSI_ACARD is not set
181# CONFIG_SCSI_AACRAID is not set
182# CONFIG_SCSI_AIC7XXX is not set
183# CONFIG_SCSI_AIC7XXX_OLD is not set
184# CONFIG_SCSI_AIC79XX is not set
185# CONFIG_SCSI_DPT_I2O is not set
186# CONFIG_SCSI_ADVANSYS is not set
187# CONFIG_SCSI_IN2000 is not set
188# CONFIG_SCSI_AM53C974 is not set
189# CONFIG_SCSI_MEGARAID is not set
190# CONFIG_SCSI_BUSLOGIC is not set
191# CONFIG_SCSI_CPQFCTS is not set
192# CONFIG_SCSI_DMX3191D is not set
193# CONFIG_SCSI_EATA is not set
194# CONFIG_SCSI_EATA_PIO is not set
195# CONFIG_SCSI_FUTURE_DOMAIN is not set
196# CONFIG_SCSI_GDTH is not set
197# CONFIG_SCSI_GENERIC_NCR5380 is not set
198# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
199# CONFIG_SCSI_INITIO is not set
200# CONFIG_SCSI_INIA100 is not set
201# CONFIG_SCSI_PPA is not set
202# CONFIG_SCSI_IMM is not set
203# CONFIG_SCSI_NCR53C7xx is not set
204# CONFIG_SCSI_SYM53C8XX_2 is not set
205CONFIG_SCSI_NCR53C8XX=y
206CONFIG_SCSI_SYM53C8XX=y
207CONFIG_SCSI_NCR53C8XX_DEFAULT_TAGS=8
208CONFIG_SCSI_NCR53C8XX_MAX_TAGS=32
209CONFIG_SCSI_NCR53C8XX_SYNC=20
210# CONFIG_SCSI_NCR53C8XX_PROFILE is not set
211# CONFIG_SCSI_NCR53C8XX_IOMAPPED is not set
212# CONFIG_SCSI_NCR53C8XX_PQS_PDS is not set
213# CONFIG_SCSI_NCR53C8XX_SYMBIOS_COMPAT is not set
214# CONFIG_SCSI_PCI2000 is not set
215# CONFIG_SCSI_PCI2220I is not set
216# CONFIG_SCSI_QLOGIC_ISP is not set
217# CONFIG_SCSI_QLOGIC_FC is not set
218# CONFIG_SCSI_QLOGIC_1280 is not set
219# CONFIG_SCSI_DC395x is not set
220# CONFIG_SCSI_DC390T is not set
221# CONFIG_SCSI_U14_34F is not set
222# CONFIG_SCSI_NSP32 is not set
223# CONFIG_SCSI_DEBUG is not set
224
225#
226# Fusion MPT device support
227#
228# CONFIG_FUSION is not set
229
230#
231# IEEE 1394 (FireWire) support (EXPERIMENTAL)
232#
233# CONFIG_IEEE1394 is not set
234
235#
236# I2O device support
237#
238# CONFIG_I2O is not set
239
240#
241# Networking support
242#
243CONFIG_NET=y
244
245#
246# Networking options
247#
248CONFIG_PACKET=y
249# CONFIG_PACKET_MMAP is not set
250# CONFIG_NETLINK_DEV is not set
251CONFIG_NETFILTER=y
252# CONFIG_NETFILTER_DEBUG is not set
253CONFIG_UNIX=y
254# CONFIG_NET_KEY is not set
255CONFIG_INET=y
256# CONFIG_IP_MULTICAST is not set
257# CONFIG_IP_ADVANCED_ROUTER is not set
258CONFIG_IP_PNP=y
259CONFIG_IP_PNP_DHCP=y
260# CONFIG_IP_PNP_BOOTP is not set
261# CONFIG_IP_PNP_RARP is not set
262# CONFIG_NET_IPIP is not set
263# CONFIG_NET_IPGRE is not set
264# CONFIG_ARPD is not set
265# CONFIG_INET_ECN is not set
266# CONFIG_SYN_COOKIES is not set
267# CONFIG_INET_AH is not set
268# CONFIG_INET_ESP is not set
269# CONFIG_INET_IPCOMP is not set
270
271#
272# IP: Netfilter Configuration
273#
274CONFIG_IP_NF_CONNTRACK=m
275CONFIG_IP_NF_FTP=m
276CONFIG_IP_NF_IRC=m
277CONFIG_IP_NF_TFTP=m
278CONFIG_IP_NF_AMANDA=m
279# CONFIG_IP_NF_QUEUE is not set
280CONFIG_IP_NF_IPTABLES=m
281CONFIG_IP_NF_MATCH_LIMIT=m
282CONFIG_IP_NF_MATCH_MAC=m
283CONFIG_IP_NF_MATCH_PKTTYPE=m
284CONFIG_IP_NF_MATCH_MARK=m
285CONFIG_IP_NF_MATCH_MULTIPORT=m
286CONFIG_IP_NF_MATCH_TOS=m
287CONFIG_IP_NF_MATCH_ECN=m
288CONFIG_IP_NF_MATCH_DSCP=m
289CONFIG_IP_NF_MATCH_AH_ESP=m
290CONFIG_IP_NF_MATCH_LENGTH=m
291CONFIG_IP_NF_MATCH_TTL=m
292CONFIG_IP_NF_MATCH_TCPMSS=m
293CONFIG_IP_NF_MATCH_HELPER=m
294CONFIG_IP_NF_MATCH_STATE=m
295CONFIG_IP_NF_MATCH_CONNTRACK=m
296CONFIG_IP_NF_MATCH_UNCLEAN=m
297CONFIG_IP_NF_MATCH_OWNER=m
298CONFIG_IP_NF_FILTER=m
299CONFIG_IP_NF_TARGET_REJECT=m
300CONFIG_IP_NF_TARGET_MIRROR=m
301CONFIG_IP_NF_NAT=m
302CONFIG_IP_NF_NAT_NEEDED=y
303CONFIG_IP_NF_TARGET_MASQUERADE=m
304CONFIG_IP_NF_TARGET_REDIRECT=m
305CONFIG_IP_NF_NAT_SNMP_BASIC=m
306CONFIG_IP_NF_NAT_IRC=m
307CONFIG_IP_NF_NAT_FTP=m
308CONFIG_IP_NF_NAT_TFTP=m
309CONFIG_IP_NF_NAT_AMANDA=m
310# CONFIG_IP_NF_MANGLE is not set
311# CONFIG_IP_NF_TARGET_LOG is not set
312# CONFIG_IP_NF_TARGET_ULOG is not set
313CONFIG_IP_NF_TARGET_TCPMSS=m
314CONFIG_IP_NF_ARPTABLES=m
315CONFIG_IP_NF_ARPFILTER=m
316CONFIG_IP_NF_COMPAT_IPCHAINS=m
317# CONFIG_IP_NF_COMPAT_IPFWADM is not set
318# CONFIG_IPV6 is not set
319# CONFIG_XFRM_USER is not set
320
321#
322# SCTP Configuration (EXPERIMENTAL)
323#
324CONFIG_IPV6_SCTP__=y
325# CONFIG_IP_SCTP is not set
326# CONFIG_ATM is not set
327# CONFIG_VLAN_8021Q is not set
328# CONFIG_LLC is not set
329# CONFIG_DECNET is not set
330# CONFIG_BRIDGE is not set
331# CONFIG_X25 is not set
332# CONFIG_LAPB is not set
333# CONFIG_NET_DIVERT is not set
334# CONFIG_ECONET is not set
335# CONFIG_WAN_ROUTER is not set
336# CONFIG_NET_HW_FLOWCONTROL is not set
337
338#
339# QoS and/or fair queueing
340#
341# CONFIG_NET_SCHED is not set
342
343#
344# Network testing
345#
346# CONFIG_NET_PKTGEN is not set
347CONFIG_NETDEVICES=y
348
349#
350# ARCnet devices
351#
352# CONFIG_ARCNET is not set
353# CONFIG_DUMMY is not set
354# CONFIG_BONDING is not set
355# CONFIG_EQUALIZER is not set
356# CONFIG_TUN is not set
357# CONFIG_ETHERTAP is not set
358
359#
360# Ethernet (10 or 100Mbit)
361#
362CONFIG_NET_ETHERNET=y
363CONFIG_MII=y
364# CONFIG_OAKNET is not set
365# CONFIG_HAPPYMEAL is not set
366# CONFIG_SUNGEM is not set
367# CONFIG_NET_VENDOR_3COM is not set
368
369#
370# Tulip family network device support
371#
372# CONFIG_NET_TULIP is not set
373# CONFIG_HP100 is not set
374CONFIG_NET_PCI=y
375# CONFIG_PCNET32 is not set
376# CONFIG_AMD8111_ETH is not set
377# CONFIG_ADAPTEC_STARFIRE is not set
378# CONFIG_B44 is not set
379# CONFIG_DGRS is not set
380CONFIG_EEPRO100=y
381# CONFIG_EEPRO100_PIO is not set
382# CONFIG_E100 is not set
383# CONFIG_FEALNX is not set
384# CONFIG_NATSEMI is not set
385# CONFIG_NE2K_PCI is not set
386# CONFIG_8139CP is not set
387# CONFIG_8139TOO is not set
388# CONFIG_SIS900 is not set
389# CONFIG_EPIC100 is not set
390# CONFIG_SUNDANCE is not set
391# CONFIG_TLAN is not set
392# CONFIG_VIA_RHINE is not set
393
394#
395# Ethernet (1000 Mbit)
396#
397# CONFIG_ACENIC is not set
398# CONFIG_DL2K is not set
399# CONFIG_E1000 is not set
400# CONFIG_NS83820 is not set
401# CONFIG_HAMACHI is not set
402# CONFIG_YELLOWFIN is not set
403# CONFIG_R8169 is not set
404# CONFIG_SK98LIN is not set
405# CONFIG_TIGON3 is not set
406
407#
408# Ethernet (10000 Mbit)
409#
410# CONFIG_IXGB is not set
411# CONFIG_FDDI is not set
412# CONFIG_HIPPI is not set
413# CONFIG_PLIP is not set
414# CONFIG_PPP is not set
415# CONFIG_SLIP is not set
416
417#
418# Wireless LAN (non-hamradio)
419#
420# CONFIG_NET_RADIO is not set
421
422#
423# Token Ring devices (depends on LLC=y)
424#
425# CONFIG_NET_FC is not set
426# CONFIG_RCPCI is not set
427# CONFIG_SHAPER is not set
428
429#
430# Wan interfaces
431#
432# CONFIG_WAN is not set
433
434#
435# Amateur Radio support
436#
437# CONFIG_HAMRADIO is not set
438
439#
440# IrDA (infrared) support
441#
442# CONFIG_IRDA is not set
443
444#
445# ISDN subsystem
446#
447# CONFIG_ISDN_BOOL is not set
448
449#
450# Graphics support
451#
452# CONFIG_FB is not set
453
454#
455# Old CD-ROM drivers (not SCSI, not IDE)
456#
457# CONFIG_CD_NO_IDESCSI is not set
458
459#
460# Input device support
461#
462# CONFIG_INPUT is not set
463
464#
465# Userland interfaces
466#
467
468#
469# Input I/O drivers
470#
471# CONFIG_GAMEPORT is not set
472CONFIG_SOUND_GAMEPORT=y
473# CONFIG_SERIO is not set
474
475#
476# Input Device Drivers
477#
478
479#
480# Macintosh device drivers
481#
482
483#
484# Character devices
485#
486# CONFIG_SERIAL_NONSTANDARD is not set
487
488#
489# Serial drivers
490#
491CONFIG_SERIAL_8250=y
492CONFIG_SERIAL_8250_CONSOLE=y
493# CONFIG_SERIAL_8250_EXTENDED is not set
494
495#
496# Non-8250 serial port support
497#
498CONFIG_SERIAL_CORE=y
499CONFIG_SERIAL_CORE_CONSOLE=y
500CONFIG_UNIX98_PTYS=y
501CONFIG_UNIX98_PTY_COUNT=256
502# CONFIG_PRINTER is not set
503# CONFIG_PPDEV is not set
504# CONFIG_TIPAR is not set
505
506#
507# I2C support
508#
509# CONFIG_I2C is not set
510
511#
512# I2C Hardware Sensors Mainboard support
513#
514
515#
516# I2C Hardware Sensors Chip support
517#
518# CONFIG_I2C_SENSOR is not set
519
520#
521# Mice
522#
523# CONFIG_BUSMOUSE is not set
524# CONFIG_QIC02_TAPE is not set
525
526#
527# IPMI
528#
529# CONFIG_IPMI_HANDLER is not set
530
531#
532# Watchdog Cards
533#
534# CONFIG_WATCHDOG is not set
535# CONFIG_NVRAM is not set
536CONFIG_GEN_RTC=y
537# CONFIG_GEN_RTC_X is not set
538# CONFIG_DTLK is not set
539# CONFIG_R3964 is not set
540# CONFIG_APPLICOM is not set
541
542#
543# Ftape, the floppy tape device driver
544#
545# CONFIG_FTAPE is not set
546# CONFIG_AGP is not set
547# CONFIG_DRM is not set
548# CONFIG_RAW_DRIVER is not set
549# CONFIG_HANGCHECK_TIMER is not set
550
551#
552# Multimedia devices
553#
554# CONFIG_VIDEO_DEV is not set
555
556#
557# Digital Video Broadcasting Devices
558#
559# CONFIG_DVB is not set
560
561#
562# File systems
563#
564CONFIG_EXT2_FS=y
565# CONFIG_EXT2_FS_XATTR is not set
566CONFIG_EXT3_FS=y
567CONFIG_EXT3_FS_XATTR=y
568# CONFIG_EXT3_FS_POSIX_ACL is not set
569# CONFIG_EXT3_FS_SECURITY is not set
570CONFIG_JBD=y
571# CONFIG_JBD_DEBUG is not set
572CONFIG_FS_MBCACHE=y
573# CONFIG_REISERFS_FS is not set
574# CONFIG_JFS_FS is not set
575# CONFIG_XFS_FS is not set
576# CONFIG_MINIX_FS is not set
577# CONFIG_ROMFS_FS is not set
578# CONFIG_QUOTA is not set
579# CONFIG_AUTOFS_FS is not set
580# CONFIG_AUTOFS4_FS is not set
581
582#
583# CD-ROM/DVD Filesystems
584#
585# CONFIG_ISO9660_FS is not set
586# CONFIG_UDF_FS is not set
587
588#
589# DOS/FAT/NT Filesystems
590#
591# CONFIG_FAT_FS is not set
592# CONFIG_NTFS_FS is not set
593
594#
595# Pseudo filesystems
596#
597CONFIG_PROC_FS=y
598# CONFIG_DEVFS_FS is not set
599CONFIG_DEVPTS_FS=y
600# CONFIG_DEVPTS_FS_XATTR is not set
601CONFIG_TMPFS=y
602CONFIG_RAMFS=y
603
604#
605# Miscellaneous filesystems
606#
607# CONFIG_ADFS_FS is not set
608# CONFIG_AFFS_FS is not set
609# CONFIG_HFS_FS is not set
610# CONFIG_BEFS_FS is not set
611# CONFIG_BFS_FS is not set
612# CONFIG_EFS_FS is not set
613# CONFIG_CRAMFS is not set
614# CONFIG_VXFS_FS is not set
615# CONFIG_HPFS_FS is not set
616# CONFIG_QNX4FS_FS is not set
617# CONFIG_SYSV_FS is not set
618# CONFIG_UFS_FS is not set
619
620#
621# Network File Systems
622#
623CONFIG_NFS_FS=y
624# CONFIG_NFS_V3 is not set
625# CONFIG_NFS_V4 is not set
626# CONFIG_NFSD is not set
627CONFIG_ROOT_NFS=y
628CONFIG_LOCKD=y
629# CONFIG_EXPORTFS is not set
630CONFIG_SUNRPC=y
631# CONFIG_SUNRPC_GSS is not set
632# CONFIG_SMB_FS is not set
633# CONFIG_CIFS is not set
634# CONFIG_NCP_FS is not set
635# CONFIG_CODA_FS is not set
636# CONFIG_INTERMEZZO_FS is not set
637# CONFIG_AFS_FS is not set
638
639#
640# Partition Types
641#
642# CONFIG_PARTITION_ADVANCED is not set
643CONFIG_MSDOS_PARTITION=y
644
645#
646# Sound
647#
648# CONFIG_SOUND is not set
649
650#
651# USB support
652#
653CONFIG_USB=y
654# CONFIG_USB_DEBUG is not set
655
656#
657# Miscellaneous USB options
658#
659CONFIG_USB_DEVICEFS=y
660# CONFIG_USB_BANDWIDTH is not set
661CONFIG_USB_DYNAMIC_MINORS=y
662
663#
664# USB Host Controller Drivers
665#
666# CONFIG_USB_EHCI_HCD is not set
667CONFIG_USB_OHCI_HCD=y
668# CONFIG_USB_UHCI_HCD is not set
669
670#
671# USB Device Class drivers
672#
673# CONFIG_USB_BLUETOOTH_TTY is not set
674CONFIG_USB_ACM=m
675# CONFIG_USB_PRINTER is not set
676CONFIG_USB_STORAGE=m
677# CONFIG_USB_STORAGE_DEBUG is not set
678# CONFIG_USB_STORAGE_DATAFAB is not set
679CONFIG_USB_STORAGE_FREECOM=y
680# CONFIG_USB_STORAGE_ISD200 is not set
681CONFIG_USB_STORAGE_DPCM=y
682# CONFIG_USB_STORAGE_HP8200e is not set
683# CONFIG_USB_STORAGE_SDDR09 is not set
684# CONFIG_USB_STORAGE_SDDR55 is not set
685# CONFIG_USB_STORAGE_JUMPSHOT is not set
686
687#
688# USB Human Interface Devices (HID)
689#
690CONFIG_USB_HID=m
691
692#
693# Input core support is needed for USB HID input layer or HIDBP support
694#
695CONFIG_USB_HIDDEV=y
696
697#
698# USB HID Boot Protocol drivers
699#
700
701#
702# USB Imaging devices
703#
704# CONFIG_USB_MDC800 is not set
705# CONFIG_USB_SCANNER is not set
706# CONFIG_USB_MICROTEK is not set
707# CONFIG_USB_HPUSBSCSI is not set
708
709#
710# USB Multimedia devices
711#
712# CONFIG_USB_DABUSB is not set
713
714#
715# Video4Linux support is needed for USB Multimedia device support
716#
717
718#
719# USB Network adaptors
720#
721# CONFIG_USB_CATC is not set
722# CONFIG_USB_KAWETH is not set
723# CONFIG_USB_PEGASUS is not set
724# CONFIG_USB_RTL8150 is not set
725# CONFIG_USB_USBNET is not set
726
727#
728# USB port drivers
729#
730# CONFIG_USB_USS720 is not set
731
732#
733# USB Serial Converter support
734#
735CONFIG_USB_SERIAL=m
736# CONFIG_USB_SERIAL_GENERIC is not set
737# CONFIG_USB_SERIAL_BELKIN is not set
738# CONFIG_USB_SERIAL_WHITEHEAT is not set
739# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set
740# CONFIG_USB_SERIAL_EMPEG is not set
741# CONFIG_USB_SERIAL_FTDI_SIO is not set
742CONFIG_USB_SERIAL_VISOR=m
743# CONFIG_USB_SERIAL_IPAQ is not set
744# CONFIG_USB_SERIAL_IR is not set
745# CONFIG_USB_SERIAL_EDGEPORT is not set
746# CONFIG_USB_SERIAL_EDGEPORT_TI is not set
747# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set
748CONFIG_USB_SERIAL_KEYSPAN=m
749# CONFIG_USB_SERIAL_KEYSPAN_MPR is not set
750CONFIG_USB_SERIAL_KEYSPAN_USA28=y
751CONFIG_USB_SERIAL_KEYSPAN_USA28X=y
752# CONFIG_USB_SERIAL_KEYSPAN_USA28XA is not set
753# CONFIG_USB_SERIAL_KEYSPAN_USA28XB is not set
754CONFIG_USB_SERIAL_KEYSPAN_USA19=y
755CONFIG_USB_SERIAL_KEYSPAN_USA18X=y
756CONFIG_USB_SERIAL_KEYSPAN_USA19W=y
757CONFIG_USB_SERIAL_KEYSPAN_USA19QW=y
758CONFIG_USB_SERIAL_KEYSPAN_USA19QI=y
759CONFIG_USB_SERIAL_KEYSPAN_USA49W=y
760# CONFIG_USB_SERIAL_KEYSPAN_USA49WLC is not set
761# CONFIG_USB_SERIAL_KLSI is not set
762# CONFIG_USB_SERIAL_KOBIL_SCT is not set
763# CONFIG_USB_SERIAL_MCT_U232 is not set
764# CONFIG_USB_SERIAL_PL2303 is not set
765# CONFIG_USB_SERIAL_SAFE is not set
766# CONFIG_USB_SERIAL_CYBERJACK is not set
767# CONFIG_USB_SERIAL_XIRCOM is not set
768# CONFIG_USB_SERIAL_OMNINET is not set
769CONFIG_USB_EZUSB=y
770
771#
772# USB Miscellaneous drivers
773#
774# CONFIG_USB_TIGL is not set
775# CONFIG_USB_AUERSWALD is not set
776# CONFIG_USB_RIO500 is not set
777# CONFIG_USB_LCD is not set
778# CONFIG_USB_TEST is not set
779# CONFIG_USB_GADGET is not set
780
781#
782# Bluetooth support
783#
784# CONFIG_BT is not set
785
786#
787# Library routines
788#
789# CONFIG_CRC32 is not set
790
791#
792# Kernel hacking
793#
794# CONFIG_DEBUG_KERNEL is not set
795# CONFIG_KALLSYMS is not set
796
797#
798# Security options
799#
800# CONFIG_SECURITY is not set
801
802#
803# Cryptographic options
804#
805# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/ads8272_defconfig b/arch/ppc/configs/ads8272_defconfig
new file mode 100644
index 000000000000..d1db7d14780e
--- /dev/null
+++ b/arch/ppc/configs/ads8272_defconfig
@@ -0,0 +1,582 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7CONFIG_PPC=y
8CONFIG_PPC32=y
9CONFIG_GENERIC_NVRAM=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_STANDALONE=y
17CONFIG_BROKEN_ON_SMP=y
18
19#
20# General setup
21#
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_POSIX_MQUEUE is not set
25# CONFIG_BSD_PROCESS_ACCT is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=14
29# CONFIG_HOTPLUG is not set
30# CONFIG_IKCONFIG is not set
31CONFIG_EMBEDDED=y
32# CONFIG_KALLSYMS is not set
33CONFIG_FUTEX=y
34# CONFIG_EPOLL is not set
35CONFIG_IOSCHED_NOOP=y
36CONFIG_IOSCHED_AS=y
37CONFIG_IOSCHED_DEADLINE=y
38CONFIG_IOSCHED_CFQ=y
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
40
41#
42# Loadable module support
43#
44# CONFIG_MODULES is not set
45
46#
47# Processor
48#
49CONFIG_6xx=y
50# CONFIG_40x is not set
51# CONFIG_44x is not set
52# CONFIG_POWER3 is not set
53# CONFIG_POWER4 is not set
54# CONFIG_8xx is not set
55# CONFIG_CPU_FREQ is not set
56CONFIG_EMBEDDEDBOOT=y
57CONFIG_PPC_STD_MMU=y
58
59#
60# Platform options
61#
62# CONFIG_PPC_MULTIPLATFORM is not set
63# CONFIG_APUS is not set
64# CONFIG_WILLOW is not set
65# CONFIG_PCORE is not set
66# CONFIG_POWERPMC250 is not set
67# CONFIG_EV64260 is not set
68# CONFIG_SPRUCE is not set
69# CONFIG_LOPEC is not set
70# CONFIG_MCPN765 is not set
71# CONFIG_MVME5100 is not set
72# CONFIG_PPLUS is not set
73# CONFIG_PRPMC750 is not set
74# CONFIG_PRPMC800 is not set
75# CONFIG_SANDPOINT is not set
76# CONFIG_ADIR is not set
77# CONFIG_K2 is not set
78# CONFIG_PAL4 is not set
79# CONFIG_GEMINI is not set
80# CONFIG_EST8260 is not set
81# CONFIG_SBC82xx is not set
82# CONFIG_SBS8260 is not set
83# CONFIG_RPX6 is not set
84# CONFIG_TQM8260 is not set
85CONFIG_ADS8272=y
86CONFIG_PQ2ADS=y
87CONFIG_8260=y
88CONFIG_8272=y
89CONFIG_CPM2=y
90# CONFIG_PC_KEYBOARD is not set
91CONFIG_SERIAL_CONSOLE=y
92# CONFIG_SMP is not set
93# CONFIG_PREEMPT is not set
94# CONFIG_HIGHMEM is not set
95CONFIG_KERNEL_ELF=y
96CONFIG_BINFMT_ELF=y
97# CONFIG_BINFMT_MISC is not set
98# CONFIG_CMDLINE_BOOL is not set
99
100#
101# Bus options
102#
103CONFIG_PCI=y
104CONFIG_PCI_DOMAINS=y
105# CONFIG_PCI_LEGACY_PROC is not set
106# CONFIG_PCI_NAMES is not set
107
108#
109# Advanced setup
110#
111# CONFIG_ADVANCED_OPTIONS is not set
112
113#
114# Default settings for advanced configuration options are used
115#
116CONFIG_HIGHMEM_START=0xfe000000
117CONFIG_LOWMEM_SIZE=0x30000000
118CONFIG_KERNEL_START=0xc0000000
119CONFIG_TASK_SIZE=0x80000000
120CONFIG_BOOT_LOAD=0x00400000
121
122#
123# Device Drivers
124#
125
126#
127# Generic Driver Options
128#
129
130#
131# Memory Technology Devices (MTD)
132#
133# CONFIG_MTD is not set
134
135#
136# Parallel port support
137#
138# CONFIG_PARPORT is not set
139
140#
141# Plug and Play support
142#
143
144#
145# Block devices
146#
147# CONFIG_BLK_DEV_FD is not set
148# CONFIG_BLK_CPQ_DA is not set
149# CONFIG_BLK_CPQ_CISS_DA is not set
150# CONFIG_BLK_DEV_DAC960 is not set
151# CONFIG_BLK_DEV_UMEM is not set
152CONFIG_BLK_DEV_LOOP=y
153# CONFIG_BLK_DEV_CRYPTOLOOP is not set
154# CONFIG_BLK_DEV_NBD is not set
155# CONFIG_BLK_DEV_CARMEL is not set
156CONFIG_BLK_DEV_RAM=y
157CONFIG_BLK_DEV_RAM_SIZE=32768
158CONFIG_BLK_DEV_INITRD=y
159# CONFIG_LBD is not set
160
161#
162# ATA/ATAPI/MFM/RLL support
163#
164# CONFIG_IDE is not set
165
166#
167# SCSI device support
168#
169# CONFIG_SCSI is not set
170
171#
172# Multi-device support (RAID and LVM)
173#
174# CONFIG_MD is not set
175
176#
177# Fusion MPT device support
178#
179
180#
181# IEEE 1394 (FireWire) support
182#
183# CONFIG_IEEE1394 is not set
184
185#
186# I2O device support
187#
188# CONFIG_I2O is not set
189
190#
191# Macintosh device drivers
192#
193
194#
195# Networking support
196#
197CONFIG_NET=y
198
199#
200# Networking options
201#
202CONFIG_PACKET=y
203# CONFIG_PACKET_MMAP is not set
204# CONFIG_NETLINK_DEV is not set
205CONFIG_UNIX=y
206# CONFIG_NET_KEY is not set
207CONFIG_INET=y
208CONFIG_IP_MULTICAST=y
209# CONFIG_IP_ADVANCED_ROUTER is not set
210CONFIG_IP_PNP=y
211CONFIG_IP_PNP_DHCP=y
212CONFIG_IP_PNP_BOOTP=y
213# CONFIG_IP_PNP_RARP is not set
214# CONFIG_NET_IPIP is not set
215# CONFIG_NET_IPGRE is not set
216# CONFIG_IP_MROUTE is not set
217# CONFIG_ARPD is not set
218CONFIG_SYN_COOKIES=y
219# CONFIG_INET_AH is not set
220# CONFIG_INET_ESP is not set
221# CONFIG_INET_IPCOMP is not set
222# CONFIG_IPV6 is not set
223# CONFIG_NETFILTER is not set
224
225#
226# SCTP Configuration (EXPERIMENTAL)
227#
228# CONFIG_IP_SCTP is not set
229# CONFIG_ATM is not set
230# CONFIG_BRIDGE is not set
231# CONFIG_VLAN_8021Q is not set
232# CONFIG_DECNET is not set
233# CONFIG_LLC2 is not set
234# CONFIG_IPX is not set
235# CONFIG_ATALK is not set
236# CONFIG_X25 is not set
237# CONFIG_LAPB is not set
238# CONFIG_NET_DIVERT is not set
239# CONFIG_ECONET is not set
240# CONFIG_WAN_ROUTER is not set
241# CONFIG_NET_HW_FLOWCONTROL is not set
242
243#
244# QoS and/or fair queueing
245#
246# CONFIG_NET_SCHED is not set
247
248#
249# Network testing
250#
251# CONFIG_NET_PKTGEN is not set
252# CONFIG_NETPOLL is not set
253# CONFIG_NET_POLL_CONTROLLER is not set
254# CONFIG_HAMRADIO is not set
255# CONFIG_IRDA is not set
256# CONFIG_BT is not set
257CONFIG_NETDEVICES=y
258# CONFIG_DUMMY is not set
259# CONFIG_BONDING is not set
260# CONFIG_EQUALIZER is not set
261# CONFIG_TUN is not set
262
263#
264# ARCnet devices
265#
266# CONFIG_ARCNET is not set
267
268#
269# Ethernet (10 or 100Mbit)
270#
271CONFIG_NET_ETHERNET=y
272# CONFIG_MII is not set
273# CONFIG_OAKNET is not set
274# CONFIG_HAPPYMEAL is not set
275# CONFIG_SUNGEM is not set
276# CONFIG_NET_VENDOR_3COM is not set
277
278#
279# Tulip family network device support
280#
281# CONFIG_NET_TULIP is not set
282# CONFIG_HP100 is not set
283# CONFIG_NET_PCI is not set
284
285#
286# Ethernet (1000 Mbit)
287#
288# CONFIG_ACENIC is not set
289# CONFIG_DL2K is not set
290# CONFIG_E1000 is not set
291# CONFIG_NS83820 is not set
292# CONFIG_HAMACHI is not set
293# CONFIG_YELLOWFIN is not set
294# CONFIG_R8169 is not set
295# CONFIG_SK98LIN is not set
296# CONFIG_TIGON3 is not set
297
298#
299# Ethernet (10000 Mbit)
300#
301# CONFIG_IXGB is not set
302# CONFIG_S2IO is not set
303
304#
305# Token Ring devices
306#
307# CONFIG_TR is not set
308
309#
310# Wireless LAN (non-hamradio)
311#
312# CONFIG_NET_RADIO is not set
313
314#
315# Wan interfaces
316#
317# CONFIG_WAN is not set
318# CONFIG_FDDI is not set
319# CONFIG_HIPPI is not set
320# CONFIG_PPP is not set
321# CONFIG_SLIP is not set
322# CONFIG_SHAPER is not set
323# CONFIG_NETCONSOLE is not set
324
325#
326# ISDN subsystem
327#
328# CONFIG_ISDN is not set
329
330#
331# Telephony Support
332#
333# CONFIG_PHONE is not set
334
335#
336# Input device support
337#
338CONFIG_INPUT=y
339
340#
341# Userland interfaces
342#
343# CONFIG_INPUT_MOUSEDEV is not set
344# CONFIG_INPUT_JOYDEV is not set
345# CONFIG_INPUT_TSDEV is not set
346# CONFIG_INPUT_EVDEV is not set
347# CONFIG_INPUT_EVBUG is not set
348
349#
350# Input I/O drivers
351#
352# CONFIG_GAMEPORT is not set
353CONFIG_SOUND_GAMEPORT=y
354# CONFIG_SERIO is not set
355# CONFIG_SERIO_I8042 is not set
356
357#
358# Input Device Drivers
359#
360# CONFIG_INPUT_KEYBOARD is not set
361# CONFIG_INPUT_MOUSE is not set
362# CONFIG_INPUT_JOYSTICK is not set
363# CONFIG_INPUT_TOUCHSCREEN is not set
364# CONFIG_INPUT_MISC is not set
365
366#
367# Character devices
368#
369# CONFIG_VT is not set
370# CONFIG_SERIAL_NONSTANDARD is not set
371
372#
373# Serial drivers
374#
375# CONFIG_SERIAL_8250 is not set
376
377#
378# Non-8250 serial port support
379#
380CONFIG_UNIX98_PTYS=y
381CONFIG_LEGACY_PTYS=y
382CONFIG_LEGACY_PTY_COUNT=256
383# CONFIG_QIC02_TAPE is not set
384
385#
386# IPMI
387#
388# CONFIG_IPMI_HANDLER is not set
389
390#
391# Watchdog Cards
392#
393# CONFIG_WATCHDOG is not set
394# CONFIG_NVRAM is not set
395CONFIG_GEN_RTC=y
396# CONFIG_GEN_RTC_X is not set
397# CONFIG_DTLK is not set
398# CONFIG_R3964 is not set
399# CONFIG_APPLICOM is not set
400
401#
402# Ftape, the floppy tape device driver
403#
404# CONFIG_FTAPE is not set
405# CONFIG_AGP is not set
406# CONFIG_DRM is not set
407# CONFIG_RAW_DRIVER is not set
408
409#
410# I2C support
411#
412# CONFIG_I2C is not set
413
414#
415# Misc devices
416#
417
418#
419# Multimedia devices
420#
421# CONFIG_VIDEO_DEV is not set
422
423#
424# Digital Video Broadcasting Devices
425#
426# CONFIG_DVB is not set
427
428#
429# Graphics support
430#
431# CONFIG_FB is not set
432
433#
434# Sound
435#
436# CONFIG_SOUND is not set
437
438#
439# USB support
440#
441# CONFIG_USB is not set
442
443#
444# USB Gadget Support
445#
446# CONFIG_USB_GADGET is not set
447
448#
449# File systems
450#
451CONFIG_EXT2_FS=y
452# CONFIG_EXT2_FS_XATTR is not set
453CONFIG_EXT3_FS=y
454CONFIG_EXT3_FS_XATTR=y
455# CONFIG_EXT3_FS_POSIX_ACL is not set
456# CONFIG_EXT3_FS_SECURITY is not set
457CONFIG_JBD=y
458# CONFIG_JBD_DEBUG is not set
459CONFIG_FS_MBCACHE=y
460# CONFIG_REISERFS_FS is not set
461# CONFIG_JFS_FS is not set
462# CONFIG_XFS_FS is not set
463# CONFIG_MINIX_FS is not set
464# CONFIG_ROMFS_FS is not set
465# CONFIG_QUOTA is not set
466# CONFIG_AUTOFS_FS is not set
467# CONFIG_AUTOFS4_FS is not set
468
469#
470# CD-ROM/DVD Filesystems
471#
472# CONFIG_ISO9660_FS is not set
473# CONFIG_UDF_FS is not set
474
475#
476# DOS/FAT/NT Filesystems
477#
478# CONFIG_FAT_FS is not set
479# CONFIG_NTFS_FS is not set
480
481#
482# Pseudo filesystems
483#
484CONFIG_PROC_FS=y
485CONFIG_PROC_KCORE=y
486CONFIG_SYSFS=y
487# CONFIG_DEVFS_FS is not set
488# CONFIG_DEVPTS_FS_XATTR is not set
489CONFIG_TMPFS=y
490# CONFIG_HUGETLB_PAGE is not set
491CONFIG_RAMFS=y
492
493#
494# Miscellaneous filesystems
495#
496# CONFIG_ADFS_FS is not set
497# CONFIG_AFFS_FS is not set
498# CONFIG_HFS_FS is not set
499# CONFIG_HFSPLUS_FS is not set
500# CONFIG_BEFS_FS is not set
501# CONFIG_BFS_FS is not set
502# CONFIG_EFS_FS is not set
503# CONFIG_CRAMFS is not set
504# CONFIG_VXFS_FS is not set
505# CONFIG_HPFS_FS is not set
506# CONFIG_QNX4FS_FS is not set
507# CONFIG_SYSV_FS is not set
508# CONFIG_UFS_FS is not set
509
510#
511# Network File Systems
512#
513CONFIG_NFS_FS=y
514# CONFIG_NFS_V3 is not set
515# CONFIG_NFS_V4 is not set
516# CONFIG_NFS_DIRECTIO is not set
517# CONFIG_NFSD is not set
518CONFIG_ROOT_NFS=y
519CONFIG_LOCKD=y
520# CONFIG_EXPORTFS is not set
521CONFIG_SUNRPC=y
522# CONFIG_RPCSEC_GSS_KRB5 is not set
523# CONFIG_SMB_FS is not set
524# CONFIG_CIFS is not set
525# CONFIG_NCP_FS is not set
526# CONFIG_CODA_FS is not set
527# CONFIG_AFS_FS is not set
528
529#
530# Partition Types
531#
532CONFIG_PARTITION_ADVANCED=y
533# CONFIG_ACORN_PARTITION is not set
534# CONFIG_OSF_PARTITION is not set
535# CONFIG_AMIGA_PARTITION is not set
536# CONFIG_ATARI_PARTITION is not set
537# CONFIG_MAC_PARTITION is not set
538# CONFIG_MSDOS_PARTITION is not set
539# CONFIG_LDM_PARTITION is not set
540# CONFIG_NEC98_PARTITION is not set
541# CONFIG_SGI_PARTITION is not set
542# CONFIG_ULTRIX_PARTITION is not set
543# CONFIG_SUN_PARTITION is not set
544# CONFIG_EFI_PARTITION is not set
545
546#
547# Native Language Support
548#
549# CONFIG_NLS is not set
550# CONFIG_SCC_ENET is not set
551CONFIG_FEC_ENET=y
552# CONFIG_USE_MDIO is not set
553
554#
555# CPM2 Options
556#
557CONFIG_SCC_CONSOLE=y
558CONFIG_FCC1_ENET=y
559# CONFIG_FCC2_ENET is not set
560# CONFIG_FCC3_ENET is not set
561
562#
563# Library routines
564#
565# CONFIG_CRC32 is not set
566# CONFIG_LIBCRC32C is not set
567
568#
569# Kernel hacking
570#
571# CONFIG_DEBUG_KERNEL is not set
572# CONFIG_KGDB_CONSOLE is not set
573
574#
575# Security options
576#
577# CONFIG_SECURITY is not set
578
579#
580# Cryptographic options
581#
582# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/apus_defconfig b/arch/ppc/configs/apus_defconfig
new file mode 100644
index 000000000000..e2245252d31f
--- /dev/null
+++ b/arch/ppc/configs/apus_defconfig
@@ -0,0 +1,920 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7
8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12
13#
14# General setup
15#
16CONFIG_SWAP=y
17CONFIG_SYSVIPC=y
18# CONFIG_BSD_PROCESS_ACCT is not set
19CONFIG_SYSCTL=y
20CONFIG_LOG_BUF_SHIFT=14
21# CONFIG_EMBEDDED is not set
22CONFIG_FUTEX=y
23CONFIG_EPOLL=y
24
25#
26# Loadable module support
27#
28CONFIG_MODULES=y
29CONFIG_MODULE_UNLOAD=y
30CONFIG_MODULE_FORCE_UNLOAD=y
31CONFIG_OBSOLETE_MODPARM=y
32# CONFIG_MODVERSIONS is not set
33CONFIG_KMOD=y
34
35#
36# Platform support
37#
38CONFIG_PPC=y
39CONFIG_PPC32=y
40CONFIG_6xx=y
41# CONFIG_40x is not set
42# CONFIG_POWER3 is not set
43# CONFIG_8xx is not set
44
45#
46# IBM 4xx options
47#
48# CONFIG_8260 is not set
49CONFIG_GENERIC_ISA_DMA=y
50CONFIG_PPC_STD_MMU=y
51CONFIG_SERIAL_CONSOLE=y
52# CONFIG_PPC_MULTIPLATFORM is not set
53CONFIG_APUS=y
54# CONFIG_WILLOW_2 is not set
55# CONFIG_PCORE is not set
56# CONFIG_POWERPMC250 is not set
57# CONFIG_EV64260 is not set
58# CONFIG_SPRUCE is not set
59# CONFIG_LOPEC is not set
60# CONFIG_MCPN765 is not set
61# CONFIG_MVME5100 is not set
62# CONFIG_PPLUS is not set
63# CONFIG_PRPMC750 is not set
64# CONFIG_PRPMC800 is not set
65# CONFIG_SANDPOINT is not set
66# CONFIG_ADIR is not set
67# CONFIG_K2 is not set
68# CONFIG_PAL4 is not set
69# CONFIG_GEMINI is not set
70# CONFIG_SMP is not set
71# CONFIG_PREEMPT is not set
72# CONFIG_ALTIVEC is not set
73# CONFIG_TAU is not set
74# CONFIG_CPU_FREQ is not set
75
76#
77# General setup
78#
79# CONFIG_HIGHMEM is not set
80CONFIG_PCI=y
81CONFIG_PCI_DOMAINS=y
82CONFIG_PCI_PERMEDIA=y
83CONFIG_KCORE_ELF=y
84CONFIG_BINFMT_ELF=y
85CONFIG_KERNEL_ELF=y
86CONFIG_BINFMT_MISC=m
87CONFIG_PCI_LEGACY_PROC=y
88CONFIG_PCI_NAMES=y
89# CONFIG_HOTPLUG is not set
90
91#
92# Parallel port support
93#
94CONFIG_PARPORT=m
95# CONFIG_PARPORT_PC is not set
96CONFIG_PARPORT_AMIGA=m
97# CONFIG_PARPORT_MFC3 is not set
98# CONFIG_PARPORT_OTHER is not set
99# CONFIG_PARPORT_1284 is not set
100CONFIG_PPC601_SYNC_FIX=y
101# CONFIG_CMDLINE_BOOL is not set
102CONFIG_AMIGA=y
103CONFIG_ZORRO=y
104CONFIG_ABSTRACT_CONSOLE=y
105CONFIG_APUS_FAST_EXCEPT=y
106CONFIG_AMIGA_PCMCIA=y
107CONFIG_AMIGA_BUILTIN_SERIAL=y
108CONFIG_GVPIOEXT=y
109CONFIG_GVPIOEXT_LP=m
110CONFIG_GVPIOEXT_PLIP=m
111CONFIG_MULTIFACE_III_TTY=y
112CONFIG_A2232=y
113CONFIG_WHIPPET_SERIAL=y
114CONFIG_APNE=y
115CONFIG_HEARTBEAT=y
116CONFIG_PROC_HARDWARE=y
117CONFIG_ZORRO_NAMES=y
118
119#
120# Advanced setup
121#
122# CONFIG_ADVANCED_OPTIONS is not set
123
124#
125# Default settings for advanced configuration options are used
126#
127CONFIG_HIGHMEM_START=0xfe000000
128CONFIG_LOWMEM_SIZE=0x30000000
129CONFIG_KERNEL_START=0xc0000000
130CONFIG_TASK_SIZE=0x80000000
131CONFIG_BOOT_LOAD=0x00800000
132
133#
134# Memory Technology Devices (MTD)
135#
136# CONFIG_MTD is not set
137
138#
139# Plug and Play support
140#
141# CONFIG_PNP is not set
142
143#
144# Block devices
145#
146# CONFIG_BLK_DEV_FD is not set
147CONFIG_AMIGA_FLOPPY=y
148CONFIG_AMIGA_Z2RAM=m
149# CONFIG_PARIDE is not set
150# CONFIG_BLK_CPQ_DA is not set
151# CONFIG_BLK_CPQ_CISS_DA is not set
152# CONFIG_BLK_DEV_DAC960 is not set
153# CONFIG_BLK_DEV_UMEM is not set
154CONFIG_BLK_DEV_LOOP=y
155CONFIG_BLK_DEV_NBD=m
156CONFIG_BLK_DEV_RAM=y
157CONFIG_BLK_DEV_RAM_SIZE=4096
158CONFIG_BLK_DEV_INITRD=y
159
160#
161# Multi-device support (RAID and LVM)
162#
163CONFIG_MD=y
164CONFIG_BLK_DEV_MD=m
165CONFIG_MD_LINEAR=m
166CONFIG_MD_RAID0=m
167CONFIG_MD_RAID1=m
168CONFIG_MD_RAID5=m
169# CONFIG_MD_MULTIPATH is not set
170CONFIG_BLK_DEV_DM=m
171
172#
173# ATA/IDE/MFM/RLL support
174#
175CONFIG_IDE=y
176
177#
178# IDE, ATA and ATAPI Block devices
179#
180CONFIG_BLK_DEV_IDE=y
181
182#
183# Please see Documentation/ide.txt for help/info on IDE drives
184#
185# CONFIG_BLK_DEV_HD is not set
186CONFIG_BLK_DEV_IDEDISK=y
187# CONFIG_IDEDISK_MULTI_MODE is not set
188# CONFIG_IDEDISK_STROKE is not set
189CONFIG_BLK_DEV_IDECD=y
190CONFIG_BLK_DEV_IDEFLOPPY=y
191CONFIG_BLK_DEV_IDESCSI=m
192# CONFIG_IDE_TASK_IOCTL is not set
193
194#
195# IDE chipset support/bugfixes
196#
197# CONFIG_BLK_DEV_IDEPCI is not set
198CONFIG_BLK_DEV_GAYLE=y
199CONFIG_BLK_DEV_IDEDOUBLER=y
200CONFIG_BLK_DEV_BUDDHA=y
201
202#
203# SCSI support
204#
205CONFIG_SCSI=y
206
207#
208# SCSI support type (disk, tape, CD-ROM)
209#
210CONFIG_BLK_DEV_SD=y
211CONFIG_CHR_DEV_ST=m
212CONFIG_CHR_DEV_OSST=m
213CONFIG_BLK_DEV_SR=y
214CONFIG_BLK_DEV_SR_VENDOR=y
215CONFIG_CHR_DEV_SG=m
216
217#
218# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
219#
220# CONFIG_SCSI_MULTI_LUN is not set
221# CONFIG_SCSI_REPORT_LUNS is not set
222CONFIG_SCSI_CONSTANTS=y
223CONFIG_SCSI_LOGGING=y
224
225#
226# SCSI low-level drivers
227#
228# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
229# CONFIG_SCSI_ACARD is not set
230# CONFIG_SCSI_AACRAID is not set
231# CONFIG_SCSI_AIC7XXX is not set
232# CONFIG_SCSI_AIC7XXX_OLD is not set
233# CONFIG_SCSI_AIC79XX is not set
234# CONFIG_SCSI_DPT_I2O is not set
235# CONFIG_SCSI_ADVANSYS is not set
236# CONFIG_SCSI_IN2000 is not set
237# CONFIG_SCSI_AM53C974 is not set
238# CONFIG_SCSI_MEGARAID is not set
239# CONFIG_SCSI_BUSLOGIC is not set
240# CONFIG_SCSI_CPQFCTS is not set
241# CONFIG_SCSI_DMX3191D is not set
242# CONFIG_SCSI_EATA is not set
243# CONFIG_SCSI_EATA_PIO is not set
244# CONFIG_SCSI_FUTURE_DOMAIN is not set
245# CONFIG_SCSI_GDTH is not set
246# CONFIG_SCSI_GENERIC_NCR5380 is not set
247# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
248# CONFIG_SCSI_INITIO is not set
249# CONFIG_SCSI_INIA100 is not set
250# CONFIG_SCSI_PPA is not set
251# CONFIG_SCSI_IMM is not set
252# CONFIG_SCSI_NCR53C7xx is not set
253# CONFIG_SCSI_SYM53C8XX_2 is not set
254# CONFIG_SCSI_NCR53C8XX is not set
255# CONFIG_SCSI_SYM53C8XX is not set
256# CONFIG_SCSI_PCI2000 is not set
257# CONFIG_SCSI_PCI2220I is not set
258# CONFIG_SCSI_QLOGIC_ISP is not set
259# CONFIG_SCSI_QLOGIC_FC is not set
260# CONFIG_SCSI_QLOGIC_1280 is not set
261# CONFIG_SCSI_DC395x is not set
262# CONFIG_SCSI_DC390T is not set
263# CONFIG_SCSI_U14_34F is not set
264# CONFIG_SCSI_NSP32 is not set
265# CONFIG_SCSI_DEBUG is not set
266CONFIG_A3000_SCSI=y
267CONFIG_A4000T_SCSI=y
268CONFIG_A2091_SCSI=y
269CONFIG_GVP11_SCSI=y
270CONFIG_CYBERSTORM_SCSI=y
271CONFIG_CYBERSTORMII_SCSI=y
272CONFIG_BLZ2060_SCSI=y
273CONFIG_BLZ1230_SCSI=y
274CONFIG_FASTLANE_SCSI=y
275CONFIG_A4091_SCSI=y
276CONFIG_WARPENGINE_SCSI=y
277CONFIG_BLZ603EPLUS_SCSI=y
278CONFIG_OKTAGON_SCSI=y
279
280#
281# Fusion MPT device support
282#
283# CONFIG_FUSION is not set
284
285#
286# IEEE 1394 (FireWire) support (EXPERIMENTAL)
287#
288# CONFIG_IEEE1394 is not set
289
290#
291# I2O device support
292#
293# CONFIG_I2O is not set
294
295#
296# Networking support
297#
298CONFIG_NET=y
299
300#
301# Networking options
302#
303CONFIG_PACKET=m
304CONFIG_PACKET_MMAP=y
305CONFIG_NETLINK_DEV=m
306CONFIG_NETFILTER=y
307# CONFIG_NETFILTER_DEBUG is not set
308CONFIG_UNIX=y
309# CONFIG_NET_KEY is not set
310CONFIG_INET=y
311# CONFIG_IP_MULTICAST is not set
312# CONFIG_IP_ADVANCED_ROUTER is not set
313# CONFIG_IP_PNP is not set
314# CONFIG_NET_IPIP is not set
315# CONFIG_NET_IPGRE is not set
316# CONFIG_ARPD is not set
317# CONFIG_INET_ECN is not set
318CONFIG_SYN_COOKIES=y
319# CONFIG_INET_AH is not set
320# CONFIG_INET_ESP is not set
321# CONFIG_INET_IPCOMP is not set
322
323#
324# IP: Netfilter Configuration
325#
326CONFIG_IP_NF_CONNTRACK=m
327CONFIG_IP_NF_FTP=m
328CONFIG_IP_NF_IRC=m
329CONFIG_IP_NF_TFTP=m
330CONFIG_IP_NF_AMANDA=m
331CONFIG_IP_NF_QUEUE=m
332CONFIG_IP_NF_IPTABLES=m
333CONFIG_IP_NF_MATCH_LIMIT=m
334CONFIG_IP_NF_MATCH_MAC=m
335# CONFIG_IP_NF_MATCH_PKTTYPE is not set
336CONFIG_IP_NF_MATCH_MARK=m
337CONFIG_IP_NF_MATCH_MULTIPORT=m
338CONFIG_IP_NF_MATCH_TOS=m
339# CONFIG_IP_NF_MATCH_ECN is not set
340# CONFIG_IP_NF_MATCH_DSCP is not set
341# CONFIG_IP_NF_MATCH_AH_ESP is not set
342CONFIG_IP_NF_MATCH_LENGTH=m
343CONFIG_IP_NF_MATCH_TTL=m
344CONFIG_IP_NF_MATCH_TCPMSS=m
345CONFIG_IP_NF_MATCH_HELPER=m
346CONFIG_IP_NF_MATCH_STATE=m
347CONFIG_IP_NF_MATCH_CONNTRACK=m
348CONFIG_IP_NF_MATCH_UNCLEAN=m
349CONFIG_IP_NF_MATCH_OWNER=m
350CONFIG_IP_NF_FILTER=m
351CONFIG_IP_NF_TARGET_REJECT=m
352CONFIG_IP_NF_TARGET_MIRROR=m
353CONFIG_IP_NF_NAT=m
354CONFIG_IP_NF_NAT_NEEDED=y
355CONFIG_IP_NF_TARGET_MASQUERADE=m
356CONFIG_IP_NF_TARGET_REDIRECT=m
357CONFIG_IP_NF_NAT_SNMP_BASIC=m
358CONFIG_IP_NF_NAT_IRC=m
359CONFIG_IP_NF_NAT_FTP=m
360CONFIG_IP_NF_NAT_TFTP=m
361CONFIG_IP_NF_NAT_AMANDA=m
362CONFIG_IP_NF_MANGLE=m
363CONFIG_IP_NF_TARGET_TOS=m
364CONFIG_IP_NF_TARGET_ECN=m
365CONFIG_IP_NF_TARGET_DSCP=m
366CONFIG_IP_NF_TARGET_MARK=m
367CONFIG_IP_NF_TARGET_LOG=m
368CONFIG_IP_NF_TARGET_ULOG=m
369CONFIG_IP_NF_TARGET_TCPMSS=m
370CONFIG_IP_NF_ARPTABLES=m
371CONFIG_IP_NF_ARPFILTER=m
372CONFIG_IP_NF_COMPAT_IPCHAINS=m
373# CONFIG_IP_NF_COMPAT_IPFWADM is not set
374# CONFIG_IPV6 is not set
375# CONFIG_XFRM_USER is not set
376
377#
378# SCTP Configuration (EXPERIMENTAL)
379#
380CONFIG_IPV6_SCTP__=y
381# CONFIG_IP_SCTP is not set
382# CONFIG_ATM is not set
383# CONFIG_VLAN_8021Q is not set
384# CONFIG_LLC is not set
385# CONFIG_DECNET is not set
386# CONFIG_BRIDGE is not set
387# CONFIG_X25 is not set
388# CONFIG_LAPB is not set
389# CONFIG_NET_DIVERT is not set
390# CONFIG_ECONET is not set
391# CONFIG_WAN_ROUTER is not set
392# CONFIG_NET_HW_FLOWCONTROL is not set
393
394#
395# QoS and/or fair queueing
396#
397# CONFIG_NET_SCHED is not set
398
399#
400# Network testing
401#
402# CONFIG_NET_PKTGEN is not set
403CONFIG_NETDEVICES=y
404
405#
406# ARCnet devices
407#
408# CONFIG_ARCNET is not set
409CONFIG_DUMMY=m
410# CONFIG_BONDING is not set
411# CONFIG_EQUALIZER is not set
412CONFIG_TUN=m
413# CONFIG_ETHERTAP is not set
414
415#
416# Ethernet (10 or 100Mbit)
417#
418CONFIG_NET_ETHERNET=y
419# CONFIG_MII is not set
420# CONFIG_OAKNET is not set
421CONFIG_ARIADNE=y
422# CONFIG_ZORRO8390 is not set
423CONFIG_A2065=y
424CONFIG_HYDRA=y
425# CONFIG_HAPPYMEAL is not set
426# CONFIG_SUNGEM is not set
427# CONFIG_NET_VENDOR_3COM is not set
428
429#
430# Tulip family network device support
431#
432# CONFIG_NET_TULIP is not set
433# CONFIG_HP100 is not set
434# CONFIG_NET_PCI is not set
435
436#
437# Ethernet (1000 Mbit)
438#
439# CONFIG_ACENIC is not set
440# CONFIG_DL2K is not set
441# CONFIG_E1000 is not set
442# CONFIG_NS83820 is not set
443# CONFIG_HAMACHI is not set
444# CONFIG_YELLOWFIN is not set
445# CONFIG_R8169 is not set
446# CONFIG_SK98LIN is not set
447# CONFIG_TIGON3 is not set
448
449#
450# Ethernet (10000 Mbit)
451#
452# CONFIG_IXGB is not set
453# CONFIG_FDDI is not set
454# CONFIG_HIPPI is not set
455CONFIG_PLIP=m
456CONFIG_PPP=y
457CONFIG_PPP_MULTILINK=y
458CONFIG_PPP_FILTER=y
459CONFIG_PPP_ASYNC=y
460CONFIG_PPP_SYNC_TTY=y
461CONFIG_PPP_DEFLATE=y
462CONFIG_PPP_BSDCOMP=y
463CONFIG_PPPOE=y
464CONFIG_SLIP=y
465CONFIG_SLIP_COMPRESSED=y
466CONFIG_SLIP_SMART=y
467CONFIG_SLIP_MODE_SLIP6=y
468
469#
470# Wireless LAN (non-hamradio)
471#
472# CONFIG_NET_RADIO is not set
473
474#
475# Token Ring devices (depends on LLC=y)
476#
477# CONFIG_NET_FC is not set
478# CONFIG_RCPCI is not set
479# CONFIG_SHAPER is not set
480
481#
482# Wan interfaces
483#
484# CONFIG_WAN is not set
485
486#
487# Amateur Radio support
488#
489# CONFIG_HAMRADIO is not set
490
491#
492# IrDA (infrared) support
493#
494# CONFIG_IRDA is not set
495
496#
497# ISDN subsystem
498#
499# CONFIG_ISDN_BOOL is not set
500
501#
502# Graphics support
503#
504CONFIG_FB=y
505# CONFIG_FB_CIRRUS is not set
506CONFIG_FB_PM2=y
507# CONFIG_FB_PM2_FIFO_DISCONNECT is not set
508# CONFIG_FB_PM2_PCI is not set
509CONFIG_FB_PM2_CVPPC=y
510CONFIG_FB_CYBER2000=y
511CONFIG_FB_AMIGA=y
512CONFIG_FB_AMIGA_OCS=y
513CONFIG_FB_AMIGA_ECS=y
514CONFIG_FB_AMIGA_AGA=y
515CONFIG_FB_CYBER=y
516CONFIG_FB_VIRGE=y
517CONFIG_FB_RETINAZ3=y
518CONFIG_FB_FM2=y
519# CONFIG_FB_CT65550 is not set
520# CONFIG_FB_IMSTT is not set
521# CONFIG_FB_S3TRIO is not set
522# CONFIG_FB_VGA16 is not set
523# CONFIG_FB_RIVA is not set
524# CONFIG_FB_MATROX is not set
525# CONFIG_FB_RADEON is not set
526# CONFIG_FB_ATY128 is not set
527# CONFIG_FB_ATY is not set
528# CONFIG_FB_SIS is not set
529# CONFIG_FB_NEOMAGIC is not set
530# CONFIG_FB_3DFX is not set
531# CONFIG_FB_VOODOO1 is not set
532# CONFIG_FB_TRIDENT is not set
533# CONFIG_FB_PM3 is not set
534# CONFIG_FB_VIRTUAL is not set
535
536#
537# Logo configuration
538#
539CONFIG_LOGO=y
540CONFIG_LOGO_LINUX_MONO=y
541CONFIG_LOGO_LINUX_VGA16=y
542CONFIG_LOGO_LINUX_CLUT224=y
543
544#
545# Old CD-ROM drivers (not SCSI, not IDE)
546#
547# CONFIG_CD_NO_IDESCSI is not set
548
549#
550# Input device support
551#
552CONFIG_INPUT=m
553
554#
555# Userland interfaces
556#
557CONFIG_INPUT_MOUSEDEV=m
558CONFIG_INPUT_MOUSEDEV_PSAUX=y
559CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
560CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
561CONFIG_INPUT_JOYDEV=m
562# CONFIG_INPUT_TSDEV is not set
563CONFIG_INPUT_EVDEV=m
564CONFIG_INPUT_EVBUG=m
565
566#
567# Input I/O drivers
568#
569# CONFIG_GAMEPORT is not set
570CONFIG_SOUND_GAMEPORT=y
571CONFIG_SERIO=y
572# CONFIG_SERIO_I8042 is not set
573CONFIG_SERIO_SERPORT=y
574# CONFIG_SERIO_CT82C710 is not set
575# CONFIG_SERIO_PARKBD is not set
576
577#
578# Input Device Drivers
579#
580CONFIG_INPUT_KEYBOARD=y
581CONFIG_KEYBOARD_ATKBD=m
582# CONFIG_KEYBOARD_SUNKBD is not set
583# CONFIG_KEYBOARD_XTKBD is not set
584# CONFIG_KEYBOARD_NEWTON is not set
585CONFIG_KEYBOARD_AMIGA=m
586CONFIG_INPUT_MOUSE=y
587CONFIG_MOUSE_PS2=m
588CONFIG_MOUSE_SERIAL=m
589CONFIG_MOUSE_AMIGA=m
590# CONFIG_INPUT_JOYSTICK is not set
591# CONFIG_INPUT_TOUCHSCREEN is not set
592CONFIG_INPUT_MISC=y
593# CONFIG_INPUT_PCSPKR is not set
594CONFIG_INPUT_UINPUT=m
595
596#
597# Macintosh device drivers
598#
599
600#
601# Character devices
602#
603# CONFIG_SERIAL_NONSTANDARD is not set
604
605#
606# Serial drivers
607#
608# CONFIG_SERIAL_8250 is not set
609
610#
611# Non-8250 serial port support
612#
613CONFIG_UNIX98_PTYS=y
614CONFIG_UNIX98_PTY_COUNT=256
615CONFIG_PRINTER=m
616# CONFIG_LP_CONSOLE is not set
617# CONFIG_PPDEV is not set
618# CONFIG_TIPAR is not set
619
620#
621# I2C support
622#
623# CONFIG_I2C is not set
624
625#
626# I2C Hardware Sensors Mainboard support
627#
628
629#
630# I2C Hardware Sensors Chip support
631#
632# CONFIG_I2C_SENSOR is not set
633
634#
635# Mice
636#
637CONFIG_BUSMOUSE=y
638# CONFIG_QIC02_TAPE is not set
639
640#
641# IPMI
642#
643# CONFIG_IPMI_HANDLER is not set
644
645#
646# Watchdog Cards
647#
648# CONFIG_WATCHDOG is not set
649# CONFIG_NVRAM is not set
650CONFIG_GEN_RTC=y
651# CONFIG_GEN_RTC_X is not set
652# CONFIG_DTLK is not set
653# CONFIG_R3964 is not set
654# CONFIG_APPLICOM is not set
655
656#
657# Ftape, the floppy tape device driver
658#
659# CONFIG_FTAPE is not set
660# CONFIG_AGP is not set
661# CONFIG_DRM is not set
662# CONFIG_RAW_DRIVER is not set
663# CONFIG_HANGCHECK_TIMER is not set
664
665#
666# Multimedia devices
667#
668# CONFIG_VIDEO_DEV is not set
669
670#
671# Digital Video Broadcasting Devices
672#
673# CONFIG_DVB is not set
674
675#
676# File systems
677#
678CONFIG_EXT2_FS=y
679# CONFIG_EXT2_FS_XATTR is not set
680CONFIG_EXT3_FS=y
681CONFIG_EXT3_FS_XATTR=y
682# CONFIG_EXT3_FS_POSIX_ACL is not set
683# CONFIG_EXT3_FS_SECURITY is not set
684CONFIG_JBD=y
685# CONFIG_JBD_DEBUG is not set
686CONFIG_FS_MBCACHE=y
687# CONFIG_REISERFS_FS is not set
688# CONFIG_JFS_FS is not set
689# CONFIG_XFS_FS is not set
690CONFIG_MINIX_FS=y
691CONFIG_ROMFS_FS=y
692# CONFIG_QUOTA is not set
693CONFIG_AUTOFS_FS=m
694CONFIG_AUTOFS4_FS=m
695
696#
697# CD-ROM/DVD Filesystems
698#
699CONFIG_ISO9660_FS=y
700CONFIG_JOLIET=y
701# CONFIG_ZISOFS is not set
702# CONFIG_UDF_FS is not set
703
704#
705# DOS/FAT/NT Filesystems
706#
707CONFIG_FAT_FS=y
708CONFIG_MSDOS_FS=y
709CONFIG_VFAT_FS=y
710# CONFIG_NTFS_FS is not set
711
712#
713# Pseudo filesystems
714#
715CONFIG_PROC_FS=y
716# CONFIG_DEVFS_FS is not set
717CONFIG_DEVPTS_FS=y
718# CONFIG_DEVPTS_FS_XATTR is not set
719CONFIG_TMPFS=y
720CONFIG_RAMFS=y
721
722#
723# Miscellaneous filesystems
724#
725# CONFIG_ADFS_FS is not set
726CONFIG_AFFS_FS=y
727CONFIG_HFS_FS=y
728# CONFIG_BEFS_FS is not set
729# CONFIG_BFS_FS is not set
730# CONFIG_EFS_FS is not set
731CONFIG_CRAMFS=y
732# CONFIG_VXFS_FS is not set
733# CONFIG_HPFS_FS is not set
734# CONFIG_QNX4FS_FS is not set
735# CONFIG_SYSV_FS is not set
736# CONFIG_UFS_FS is not set
737
738#
739# Network File Systems
740#
741CONFIG_NFS_FS=y
742CONFIG_NFS_V3=y
743# CONFIG_NFS_V4 is not set
744CONFIG_NFSD=m
745CONFIG_NFSD_V3=y
746# CONFIG_NFSD_V4 is not set
747# CONFIG_NFSD_TCP is not set
748CONFIG_LOCKD=y
749CONFIG_LOCKD_V4=y
750CONFIG_EXPORTFS=m
751CONFIG_SUNRPC=y
752# CONFIG_SUNRPC_GSS is not set
753CONFIG_SMB_FS=m
754# CONFIG_SMB_NLS_DEFAULT is not set
755# CONFIG_CIFS is not set
756# CONFIG_NCP_FS is not set
757CONFIG_CODA_FS=m
758# CONFIG_INTERMEZZO_FS is not set
759# CONFIG_AFS_FS is not set
760
761#
762# Partition Types
763#
764CONFIG_PARTITION_ADVANCED=y
765# CONFIG_ACORN_PARTITION is not set
766# CONFIG_OSF_PARTITION is not set
767CONFIG_AMIGA_PARTITION=y
768CONFIG_ATARI_PARTITION=y
769# CONFIG_MAC_PARTITION is not set
770CONFIG_MSDOS_PARTITION=y
771CONFIG_BSD_DISKLABEL=y
772# CONFIG_MINIX_SUBPARTITION is not set
773CONFIG_SOLARIS_X86_PARTITION=y
774CONFIG_UNIXWARE_DISKLABEL=y
775# CONFIG_LDM_PARTITION is not set
776# CONFIG_NEC98_PARTITION is not set
777# CONFIG_SGI_PARTITION is not set
778# CONFIG_ULTRIX_PARTITION is not set
779# CONFIG_SUN_PARTITION is not set
780# CONFIG_EFI_PARTITION is not set
781CONFIG_SMB_NLS=y
782CONFIG_NLS=y
783
784#
785# Native Language Support
786#
787CONFIG_NLS_DEFAULT="iso8859-1"
788CONFIG_NLS_CODEPAGE_437=m
789CONFIG_NLS_CODEPAGE_737=m
790CONFIG_NLS_CODEPAGE_775=m
791CONFIG_NLS_CODEPAGE_850=m
792CONFIG_NLS_CODEPAGE_852=m
793CONFIG_NLS_CODEPAGE_855=m
794CONFIG_NLS_CODEPAGE_857=m
795CONFIG_NLS_CODEPAGE_860=m
796CONFIG_NLS_CODEPAGE_861=m
797CONFIG_NLS_CODEPAGE_862=m
798CONFIG_NLS_CODEPAGE_863=m
799CONFIG_NLS_CODEPAGE_864=m
800CONFIG_NLS_CODEPAGE_865=m
801CONFIG_NLS_CODEPAGE_866=m
802CONFIG_NLS_CODEPAGE_869=m
803CONFIG_NLS_CODEPAGE_936=m
804CONFIG_NLS_CODEPAGE_950=m
805CONFIG_NLS_CODEPAGE_932=m
806CONFIG_NLS_CODEPAGE_949=m
807CONFIG_NLS_CODEPAGE_874=m
808CONFIG_NLS_ISO8859_8=m
809# CONFIG_NLS_CODEPAGE_1250 is not set
810CONFIG_NLS_CODEPAGE_1251=m
811CONFIG_NLS_ISO8859_1=m
812CONFIG_NLS_ISO8859_2=m
813CONFIG_NLS_ISO8859_3=m
814CONFIG_NLS_ISO8859_4=m
815CONFIG_NLS_ISO8859_5=m
816CONFIG_NLS_ISO8859_6=m
817CONFIG_NLS_ISO8859_7=m
818CONFIG_NLS_ISO8859_9=m
819CONFIG_NLS_ISO8859_13=m
820CONFIG_NLS_ISO8859_14=m
821CONFIG_NLS_ISO8859_15=m
822CONFIG_NLS_KOI8_R=m
823CONFIG_NLS_KOI8_U=m
824CONFIG_NLS_UTF8=m
825
826#
827# Sound
828#
829CONFIG_SOUND=y
830CONFIG_DMASOUND_PAULA=m
831CONFIG_DMASOUND=m
832
833#
834# Advanced Linux Sound Architecture
835#
836# CONFIG_SND is not set
837
838#
839# Open Sound System
840#
841CONFIG_SOUND_PRIME=m
842# CONFIG_SOUND_BT878 is not set
843# CONFIG_SOUND_CMPCI is not set
844# CONFIG_SOUND_EMU10K1 is not set
845# CONFIG_SOUND_FUSION is not set
846# CONFIG_SOUND_CS4281 is not set
847# CONFIG_SOUND_ES1370 is not set
848# CONFIG_SOUND_ES1371 is not set
849# CONFIG_SOUND_ESSSOLO1 is not set
850# CONFIG_SOUND_MAESTRO is not set
851# CONFIG_SOUND_MAESTRO3 is not set
852# CONFIG_SOUND_ICH is not set
853# CONFIG_SOUND_RME96XX is not set
854# CONFIG_SOUND_SONICVIBES is not set
855# CONFIG_SOUND_TRIDENT is not set
856# CONFIG_SOUND_MSNDCLAS is not set
857# CONFIG_SOUND_MSNDPIN is not set
858# CONFIG_SOUND_VIA82CXXX is not set
859CONFIG_SOUND_OSS=m
860CONFIG_SOUND_TRACEINIT=y
861CONFIG_SOUND_DMAP=y
862# CONFIG_SOUND_AD1816 is not set
863# CONFIG_SOUND_SGALAXY is not set
864# CONFIG_SOUND_ADLIB is not set
865# CONFIG_SOUND_ACI_MIXER is not set
866# CONFIG_SOUND_CS4232 is not set
867# CONFIG_SOUND_SSCAPE is not set
868# CONFIG_SOUND_GUS is not set
869CONFIG_SOUND_VMIDI=m
870# CONFIG_SOUND_TRIX is not set
871# CONFIG_SOUND_MSS is not set
872# CONFIG_SOUND_MPU401 is not set
873# CONFIG_SOUND_NM256 is not set
874# CONFIG_SOUND_MAD16 is not set
875# CONFIG_SOUND_PAS is not set
876# CONFIG_SOUND_PSS is not set
877# CONFIG_SOUND_SB is not set
878# CONFIG_SOUND_AWE32_SYNTH is not set
879# CONFIG_SOUND_WAVEFRONT is not set
880# CONFIG_SOUND_MAUI is not set
881# CONFIG_SOUND_YM3812 is not set
882# CONFIG_SOUND_OPL3SA1 is not set
883# CONFIG_SOUND_OPL3SA2 is not set
884# CONFIG_SOUND_YMFPCI is not set
885# CONFIG_SOUND_UART6850 is not set
886# CONFIG_SOUND_AEDSP16 is not set
887
888#
889# USB support
890#
891# CONFIG_USB is not set
892# CONFIG_USB_GADGET is not set
893
894#
895# Bluetooth support
896#
897# CONFIG_BT is not set
898
899#
900# Library routines
901#
902# CONFIG_CRC32 is not set
903CONFIG_ZLIB_INFLATE=y
904CONFIG_ZLIB_DEFLATE=y
905
906#
907# Kernel hacking
908#
909# CONFIG_DEBUG_KERNEL is not set
910# CONFIG_KALLSYMS is not set
911
912#
913# Security options
914#
915# CONFIG_SECURITY is not set
916
917#
918# Cryptographic options
919#
920# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/ash_defconfig b/arch/ppc/configs/ash_defconfig
new file mode 100644
index 000000000000..c4a73cc16cf6
--- /dev/null
+++ b/arch/ppc/configs/ash_defconfig
@@ -0,0 +1,666 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7CONFIG_PPC=y
8CONFIG_PPC32=y
9CONFIG_GENERIC_NVRAM=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_STANDALONE=y
17CONFIG_BROKEN_ON_SMP=y
18
19#
20# General setup
21#
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26CONFIG_LOG_BUF_SHIFT=14
27# CONFIG_HOTPLUG is not set
28# CONFIG_IKCONFIG is not set
29CONFIG_EMBEDDED=y
30# CONFIG_KALLSYMS is not set
31CONFIG_FUTEX=y
32# CONFIG_EPOLL is not set
33CONFIG_IOSCHED_NOOP=y
34CONFIG_IOSCHED_AS=y
35CONFIG_IOSCHED_DEADLINE=y
36# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
37
38#
39# Loadable module support
40#
41CONFIG_MODULES=y
42CONFIG_MODULE_UNLOAD=y
43# CONFIG_MODULE_FORCE_UNLOAD is not set
44CONFIG_OBSOLETE_MODPARM=y
45# CONFIG_MODVERSIONS is not set
46CONFIG_KMOD=y
47
48#
49# Processor
50#
51# CONFIG_6xx is not set
52CONFIG_40x=y
53# CONFIG_44x is not set
54# CONFIG_POWER3 is not set
55# CONFIG_POWER4 is not set
56# CONFIG_8xx is not set
57# CONFIG_MATH_EMULATION is not set
58# CONFIG_CPU_FREQ is not set
59CONFIG_4xx=y
60
61#
62# IBM 4xx options
63#
64CONFIG_ASH=y
65# CONFIG_CPCI405 is not set
66# CONFIG_EP405 is not set
67# CONFIG_EVB405EP is not set
68# CONFIG_OAK is not set
69# CONFIG_REDWOOD_5 is not set
70# CONFIG_REDWOOD_6 is not set
71# CONFIG_SYCAMORE is not set
72# CONFIG_WALNUT is not set
73CONFIG_NP405H=y
74CONFIG_IBM405_ERR77=y
75CONFIG_IBM405_ERR51=y
76CONFIG_IBM_OCP=y
77CONFIG_PPC_OCP=y
78CONFIG_IBM_OPENBIOS=y
79# CONFIG_PM is not set
80CONFIG_UART0_TTYS0=y
81# CONFIG_UART0_TTYS1 is not set
82CONFIG_NOT_COHERENT_CACHE=y
83
84#
85# Platform options
86#
87# CONFIG_PC_KEYBOARD is not set
88# CONFIG_SMP is not set
89# CONFIG_PREEMPT is not set
90# CONFIG_HIGHMEM is not set
91CONFIG_KERNEL_ELF=y
92CONFIG_BINFMT_ELF=y
93# CONFIG_BINFMT_MISC is not set
94CONFIG_CMDLINE_BOOL=y
95CONFIG_CMDLINE="ip=on"
96
97#
98# Bus options
99#
100CONFIG_PCI=y
101CONFIG_PCI_DOMAINS=y
102CONFIG_PCI_LEGACY_PROC=y
103# CONFIG_PCI_NAMES is not set
104
105#
106# Advanced setup
107#
108# CONFIG_ADVANCED_OPTIONS is not set
109
110#
111# Default settings for advanced configuration options are used
112#
113CONFIG_HIGHMEM_START=0xfe000000
114CONFIG_LOWMEM_SIZE=0x30000000
115CONFIG_KERNEL_START=0xc0000000
116CONFIG_TASK_SIZE=0x80000000
117CONFIG_BOOT_LOAD=0x00400000
118
119#
120# Device Drivers
121#
122
123#
124# Generic Driver Options
125#
126
127#
128# Memory Technology Devices (MTD)
129#
130# CONFIG_MTD is not set
131
132#
133# Parallel port support
134#
135# CONFIG_PARPORT is not set
136
137#
138# Plug and Play support
139#
140
141#
142# Block devices
143#
144# CONFIG_BLK_DEV_FD is not set
145# CONFIG_BLK_CPQ_DA is not set
146# CONFIG_BLK_CPQ_CISS_DA is not set
147# CONFIG_BLK_DEV_DAC960 is not set
148# CONFIG_BLK_DEV_UMEM is not set
149CONFIG_BLK_DEV_LOOP=y
150# CONFIG_BLK_DEV_CRYPTOLOOP is not set
151# CONFIG_BLK_DEV_NBD is not set
152# CONFIG_BLK_DEV_CARMEL is not set
153CONFIG_BLK_DEV_RAM=y
154CONFIG_BLK_DEV_RAM_SIZE=4096
155CONFIG_BLK_DEV_INITRD=y
156# CONFIG_LBD is not set
157
158#
159# ATA/ATAPI/MFM/RLL support
160#
161# CONFIG_IDE is not set
162
163#
164# SCSI device support
165#
166# CONFIG_SCSI is not set
167
168#
169# Multi-device support (RAID and LVM)
170#
171# CONFIG_MD is not set
172
173#
174# Fusion MPT device support
175#
176# CONFIG_FUSION is not set
177
178#
179# IEEE 1394 (FireWire) support
180#
181# CONFIG_IEEE1394 is not set
182
183#
184# I2O device support
185#
186# CONFIG_I2O is not set
187
188#
189# Macintosh device drivers
190#
191
192#
193# Networking support
194#
195CONFIG_NET=y
196
197#
198# Networking options
199#
200# CONFIG_PACKET is not set
201# CONFIG_NETLINK_DEV is not set
202CONFIG_UNIX=y
203# CONFIG_NET_KEY is not set
204CONFIG_INET=y
205CONFIG_IP_MULTICAST=y
206# CONFIG_IP_ADVANCED_ROUTER is not set
207CONFIG_IP_PNP=y
208# CONFIG_IP_PNP_DHCP is not set
209CONFIG_IP_PNP_BOOTP=y
210# CONFIG_IP_PNP_RARP is not set
211# CONFIG_NET_IPIP is not set
212# CONFIG_NET_IPGRE is not set
213# CONFIG_IP_MROUTE is not set
214# CONFIG_ARPD is not set
215CONFIG_SYN_COOKIES=y
216# CONFIG_INET_AH is not set
217# CONFIG_INET_ESP is not set
218# CONFIG_INET_IPCOMP is not set
219# CONFIG_IPV6 is not set
220# CONFIG_DECNET is not set
221# CONFIG_BRIDGE is not set
222# CONFIG_NETFILTER is not set
223
224#
225# SCTP Configuration (EXPERIMENTAL)
226#
227# CONFIG_IP_SCTP is not set
228# CONFIG_ATM is not set
229# CONFIG_VLAN_8021Q is not set
230# CONFIG_LLC2 is not set
231# CONFIG_IPX is not set
232# CONFIG_ATALK is not set
233# CONFIG_X25 is not set
234# CONFIG_LAPB is not set
235# CONFIG_NET_DIVERT is not set
236# CONFIG_ECONET is not set
237# CONFIG_WAN_ROUTER is not set
238# CONFIG_NET_HW_FLOWCONTROL is not set
239
240#
241# QoS and/or fair queueing
242#
243# CONFIG_NET_SCHED is not set
244
245#
246# Network testing
247#
248# CONFIG_NET_PKTGEN is not set
249CONFIG_NETDEVICES=y
250
251#
252# ARCnet devices
253#
254# CONFIG_ARCNET is not set
255# CONFIG_DUMMY is not set
256# CONFIG_BONDING is not set
257# CONFIG_EQUALIZER is not set
258# CONFIG_TUN is not set
259
260#
261# Ethernet (10 or 100Mbit)
262#
263# CONFIG_NET_ETHERNET is not set
264
265#
266# Ethernet (1000 Mbit)
267#
268# CONFIG_ACENIC is not set
269# CONFIG_DL2K is not set
270# CONFIG_E1000 is not set
271# CONFIG_NS83820 is not set
272# CONFIG_HAMACHI is not set
273# CONFIG_YELLOWFIN is not set
274# CONFIG_R8169 is not set
275# CONFIG_SIS190 is not set
276# CONFIG_SK98LIN is not set
277# CONFIG_TIGON3 is not set
278
279#
280# Ethernet (10000 Mbit)
281#
282# CONFIG_IXGB is not set
283CONFIG_IBM_EMAC=y
284# CONFIG_IBM_EMAC_ERRMSG is not set
285CONFIG_IBM_EMAC_RXB=64
286CONFIG_IBM_EMAC_TXB=8
287CONFIG_IBM_EMAC_FGAP=8
288CONFIG_IBM_EMAC_SKBRES=0
289# CONFIG_FDDI is not set
290# CONFIG_HIPPI is not set
291# CONFIG_PPP is not set
292# CONFIG_SLIP is not set
293
294#
295# Wireless LAN (non-hamradio)
296#
297# CONFIG_NET_RADIO is not set
298
299#
300# Token Ring devices
301#
302# CONFIG_TR is not set
303# CONFIG_RCPCI is not set
304# CONFIG_SHAPER is not set
305# CONFIG_NETCONSOLE is not set
306
307#
308# Wan interfaces
309#
310# CONFIG_WAN is not set
311
312#
313# Amateur Radio support
314#
315# CONFIG_HAMRADIO is not set
316
317#
318# IrDA (infrared) support
319#
320# CONFIG_IRDA is not set
321
322#
323# Bluetooth support
324#
325# CONFIG_BT is not set
326# CONFIG_NETPOLL is not set
327# CONFIG_NET_POLL_CONTROLLER is not set
328
329#
330# ISDN subsystem
331#
332# CONFIG_ISDN is not set
333
334#
335# Telephony Support
336#
337# CONFIG_PHONE is not set
338
339#
340# Input device support
341#
342CONFIG_INPUT=y
343
344#
345# Userland interfaces
346#
347CONFIG_INPUT_MOUSEDEV=y
348CONFIG_INPUT_MOUSEDEV_PSAUX=y
349CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
350CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
351# CONFIG_INPUT_JOYDEV is not set
352# CONFIG_INPUT_TSDEV is not set
353# CONFIG_INPUT_EVDEV is not set
354# CONFIG_INPUT_EVBUG is not set
355
356#
357# Input I/O drivers
358#
359# CONFIG_GAMEPORT is not set
360CONFIG_SOUND_GAMEPORT=y
361CONFIG_SERIO=y
362CONFIG_SERIO_I8042=y
363CONFIG_SERIO_SERPORT=y
364# CONFIG_SERIO_CT82C710 is not set
365# CONFIG_SERIO_PCIPS2 is not set
366
367#
368# Input Device Drivers
369#
370CONFIG_INPUT_KEYBOARD=y
371CONFIG_KEYBOARD_ATKBD=y
372# CONFIG_KEYBOARD_SUNKBD is not set
373# CONFIG_KEYBOARD_LKKBD is not set
374# CONFIG_KEYBOARD_XTKBD is not set
375# CONFIG_KEYBOARD_NEWTON is not set
376CONFIG_INPUT_MOUSE=y
377CONFIG_MOUSE_PS2=y
378# CONFIG_MOUSE_SERIAL is not set
379# CONFIG_MOUSE_VSXXXAA is not set
380# CONFIG_INPUT_JOYSTICK is not set
381# CONFIG_INPUT_TOUCHSCREEN is not set
382# CONFIG_INPUT_MISC is not set
383
384#
385# Character devices
386#
387# CONFIG_VT is not set
388# CONFIG_SERIAL_NONSTANDARD is not set
389
390#
391# Serial drivers
392#
393CONFIG_SERIAL_8250=y
394CONFIG_SERIAL_8250_CONSOLE=y
395CONFIG_SERIAL_8250_NR_UARTS=4
396# CONFIG_SERIAL_8250_EXTENDED is not set
397
398#
399# Non-8250 serial port support
400#
401CONFIG_SERIAL_CORE=y
402CONFIG_SERIAL_CORE_CONSOLE=y
403CONFIG_UNIX98_PTYS=y
404CONFIG_LEGACY_PTYS=y
405CONFIG_LEGACY_PTY_COUNT=256
406# CONFIG_QIC02_TAPE is not set
407
408#
409# IPMI
410#
411# CONFIG_IPMI_HANDLER is not set
412
413#
414# Watchdog Cards
415#
416CONFIG_WATCHDOG=y
417# CONFIG_WATCHDOG_NOWAYOUT is not set
418
419#
420# Watchdog Device Drivers
421#
422# CONFIG_SOFT_WATCHDOG is not set
423
424#
425# PCI-based Watchdog Cards
426#
427# CONFIG_PCIPCWATCHDOG is not set
428# CONFIG_WDTPCI is not set
429# CONFIG_NVRAM is not set
430CONFIG_GEN_RTC=y
431# CONFIG_GEN_RTC_X is not set
432# CONFIG_DTLK is not set
433# CONFIG_R3964 is not set
434# CONFIG_APPLICOM is not set
435
436#
437# Ftape, the floppy tape device driver
438#
439# CONFIG_FTAPE is not set
440# CONFIG_AGP is not set
441# CONFIG_DRM is not set
442# CONFIG_RAW_DRIVER is not set
443
444#
445# I2C support
446#
447CONFIG_I2C=y
448# CONFIG_I2C_CHARDEV is not set
449
450#
451# I2C Algorithms
452#
453# CONFIG_I2C_ALGOBIT is not set
454# CONFIG_I2C_ALGOPCF is not set
455
456#
457# I2C Hardware Bus support
458#
459# CONFIG_I2C_ALI1535 is not set
460# CONFIG_I2C_ALI15X3 is not set
461# CONFIG_I2C_AMD756 is not set
462# CONFIG_I2C_AMD8111 is not set
463# CONFIG_I2C_I801 is not set
464# CONFIG_I2C_I810 is not set
465# CONFIG_I2C_IBM_IIC is not set
466# CONFIG_I2C_ISA is not set
467# CONFIG_I2C_NFORCE2 is not set
468# CONFIG_I2C_PARPORT_LIGHT is not set
469# CONFIG_I2C_PIIX4 is not set
470# CONFIG_I2C_PROSAVAGE is not set
471# CONFIG_I2C_SAVAGE4 is not set
472# CONFIG_SCx200_ACB is not set
473# CONFIG_I2C_SIS5595 is not set
474# CONFIG_I2C_SIS630 is not set
475# CONFIG_I2C_SIS96X is not set
476# CONFIG_I2C_VIA is not set
477# CONFIG_I2C_VIAPRO is not set
478# CONFIG_I2C_VOODOO3 is not set
479
480#
481# Hardware Sensors Chip support
482#
483# CONFIG_I2C_SENSOR is not set
484# CONFIG_SENSORS_ADM1021 is not set
485# CONFIG_SENSORS_ASB100 is not set
486# CONFIG_SENSORS_DS1621 is not set
487# CONFIG_SENSORS_FSCHER is not set
488# CONFIG_SENSORS_GL518SM is not set
489# CONFIG_SENSORS_IT87 is not set
490# CONFIG_SENSORS_LM75 is not set
491# CONFIG_SENSORS_LM78 is not set
492# CONFIG_SENSORS_LM80 is not set
493# CONFIG_SENSORS_LM83 is not set
494# CONFIG_SENSORS_LM85 is not set
495# CONFIG_SENSORS_LM90 is not set
496# CONFIG_SENSORS_VIA686A is not set
497# CONFIG_SENSORS_W83781D is not set
498# CONFIG_SENSORS_W83L785TS is not set
499# CONFIG_SENSORS_W83627HF is not set
500
501#
502# Other I2C Chip support
503#
504# CONFIG_SENSORS_EEPROM is not set
505# CONFIG_I2C_DEBUG_CORE is not set
506# CONFIG_I2C_DEBUG_ALGO is not set
507# CONFIG_I2C_DEBUG_BUS is not set
508# CONFIG_I2C_DEBUG_CHIP is not set
509
510#
511# Misc devices
512#
513
514#
515# Multimedia devices
516#
517# CONFIG_VIDEO_DEV is not set
518
519#
520# Digital Video Broadcasting Devices
521#
522# CONFIG_DVB is not set
523
524#
525# Graphics support
526#
527# CONFIG_FB is not set
528
529#
530# Sound
531#
532# CONFIG_SOUND is not set
533
534#
535# USB support
536#
537# CONFIG_USB is not set
538
539#
540# USB Gadget Support
541#
542# CONFIG_USB_GADGET is not set
543
544#
545# File systems
546#
547CONFIG_EXT2_FS=y
548# CONFIG_EXT2_FS_XATTR is not set
549# CONFIG_EXT3_FS is not set
550# CONFIG_JBD is not set
551# CONFIG_REISERFS_FS is not set
552# CONFIG_JFS_FS is not set
553# CONFIG_XFS_FS is not set
554# CONFIG_MINIX_FS is not set
555# CONFIG_ROMFS_FS is not set
556# CONFIG_QUOTA is not set
557# CONFIG_AUTOFS_FS is not set
558# CONFIG_AUTOFS4_FS is not set
559
560#
561# CD-ROM/DVD Filesystems
562#
563# CONFIG_ISO9660_FS is not set
564# CONFIG_UDF_FS is not set
565
566#
567# DOS/FAT/NT Filesystems
568#
569# CONFIG_FAT_FS is not set
570# CONFIG_NTFS_FS is not set
571
572#
573# Pseudo filesystems
574#
575CONFIG_PROC_FS=y
576CONFIG_PROC_KCORE=y
577# CONFIG_DEVFS_FS is not set
578# CONFIG_DEVPTS_FS_XATTR is not set
579CONFIG_TMPFS=y
580# CONFIG_HUGETLB_PAGE is not set
581CONFIG_RAMFS=y
582
583#
584# Miscellaneous filesystems
585#
586# CONFIG_ADFS_FS is not set
587# CONFIG_AFFS_FS is not set
588# CONFIG_HFS_FS is not set
589# CONFIG_HFSPLUS_FS is not set
590# CONFIG_BEFS_FS is not set
591# CONFIG_BFS_FS is not set
592# CONFIG_EFS_FS is not set
593# CONFIG_CRAMFS is not set
594# CONFIG_VXFS_FS is not set
595# CONFIG_HPFS_FS is not set
596# CONFIG_QNX4FS_FS is not set
597# CONFIG_SYSV_FS is not set
598# CONFIG_UFS_FS is not set
599
600#
601# Network File Systems
602#
603CONFIG_NFS_FS=y
604# CONFIG_NFS_V3 is not set
605# CONFIG_NFS_V4 is not set
606# CONFIG_NFS_DIRECTIO is not set
607# CONFIG_NFSD is not set
608CONFIG_ROOT_NFS=y
609CONFIG_LOCKD=y
610# CONFIG_EXPORTFS is not set
611CONFIG_SUNRPC=y
612# CONFIG_RPCSEC_GSS_KRB5 is not set
613# CONFIG_SMB_FS is not set
614# CONFIG_CIFS is not set
615# CONFIG_NCP_FS is not set
616# CONFIG_CODA_FS is not set
617# CONFIG_INTERMEZZO_FS is not set
618# CONFIG_AFS_FS is not set
619
620#
621# Partition Types
622#
623CONFIG_PARTITION_ADVANCED=y
624# CONFIG_ACORN_PARTITION is not set
625# CONFIG_OSF_PARTITION is not set
626# CONFIG_AMIGA_PARTITION is not set
627# CONFIG_ATARI_PARTITION is not set
628# CONFIG_MAC_PARTITION is not set
629# CONFIG_MSDOS_PARTITION is not set
630# CONFIG_LDM_PARTITION is not set
631# CONFIG_NEC98_PARTITION is not set
632# CONFIG_SGI_PARTITION is not set
633# CONFIG_ULTRIX_PARTITION is not set
634# CONFIG_SUN_PARTITION is not set
635# CONFIG_EFI_PARTITION is not set
636
637#
638# Native Language Support
639#
640# CONFIG_NLS is not set
641
642#
643# IBM 40x options
644#
645
646#
647# Library routines
648#
649CONFIG_CRC32=y
650
651#
652# Kernel hacking
653#
654# CONFIG_DEBUG_KERNEL is not set
655# CONFIG_SERIAL_TEXT_DEBUG is not set
656CONFIG_OCP=y
657
658#
659# Security options
660#
661# CONFIG_SECURITY is not set
662
663#
664# Cryptographic options
665#
666# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/beech_defconfig b/arch/ppc/configs/beech_defconfig
new file mode 100644
index 000000000000..0bd671bdceb4
--- /dev/null
+++ b/arch/ppc/configs/beech_defconfig
@@ -0,0 +1,615 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7CONFIG_PPC=y
8CONFIG_PPC32=y
9
10#
11# Code maturity level options
12#
13CONFIG_EXPERIMENTAL=y
14CONFIG_CLEAN_COMPILE=y
15# CONFIG_STANDALONE is not set
16CONFIG_BROKEN_ON_SMP=y
17
18#
19# General setup
20#
21# CONFIG_SWAP is not set
22CONFIG_SYSVIPC=y
23# CONFIG_BSD_PROCESS_ACCT is not set
24CONFIG_SYSCTL=y
25CONFIG_LOG_BUF_SHIFT=14
26# CONFIG_IKCONFIG is not set
27CONFIG_EMBEDDED=y
28# CONFIG_KALLSYMS is not set
29CONFIG_FUTEX=y
30# CONFIG_EPOLL is not set
31CONFIG_IOSCHED_NOOP=y
32CONFIG_IOSCHED_AS=y
33CONFIG_IOSCHED_DEADLINE=y
34
35#
36# Loadable module support
37#
38CONFIG_MODULES=y
39CONFIG_MODULE_UNLOAD=y
40# CONFIG_MODULE_FORCE_UNLOAD is not set
41CONFIG_OBSOLETE_MODPARM=y
42CONFIG_MODVERSIONS=y
43CONFIG_KMOD=y
44
45#
46# Processor
47#
48# CONFIG_6xx is not set
49CONFIG_40x=y
50# CONFIG_44x is not set
51# CONFIG_POWER3 is not set
52# CONFIG_POWER4 is not set
53# CONFIG_8xx is not set
54# CONFIG_MATH_EMULATION is not set
55# CONFIG_CPU_FREQ is not set
56CONFIG_4xx=y
57
58#
59# IBM 4xx options
60#
61# CONFIG_ASH is not set
62CONFIG_BEECH=y
63# CONFIG_CEDAR is not set
64# CONFIG_CPCI405 is not set
65# CONFIG_EP405 is not set
66# CONFIG_OAK is not set
67# CONFIG_REDWOOD_4 is not set
68# CONFIG_REDWOOD_5 is not set
69# CONFIG_REDWOOD_6 is not set
70# CONFIG_SYCAMORE is not set
71# CONFIG_TIVO is not set
72# CONFIG_WALNUT is not set
73CONFIG_IBM405_ERR77=y
74CONFIG_IBM405_ERR51=y
75CONFIG_IBM_OCP=y
76CONFIG_IBM_OPENBIOS=y
77CONFIG_405_DMA=y
78# CONFIG_PM is not set
79CONFIG_UART0_TTYS0=y
80# CONFIG_UART0_TTYS1 is not set
81CONFIG_NOT_COHERENT_CACHE=y
82
83#
84# Platform options
85#
86# CONFIG_PC_KEYBOARD is not set
87# CONFIG_SMP is not set
88# CONFIG_PREEMPT is not set
89# CONFIG_HIGHMEM is not set
90CONFIG_KERNEL_ELF=y
91CONFIG_BINFMT_ELF=y
92# CONFIG_BINFMT_MISC is not set
93# CONFIG_CMDLINE_BOOL is not set
94
95#
96# Bus options
97#
98# CONFIG_PCI is not set
99# CONFIG_PCI_DOMAINS is not set
100# CONFIG_HOTPLUG is not set
101
102#
103# Parallel port support
104#
105# CONFIG_PARPORT is not set
106
107#
108# Advanced setup
109#
110# CONFIG_ADVANCED_OPTIONS is not set
111
112#
113# Default settings for advanced configuration options are used
114#
115CONFIG_HIGHMEM_START=0xfe000000
116CONFIG_LOWMEM_SIZE=0x30000000
117CONFIG_KERNEL_START=0xc0000000
118CONFIG_TASK_SIZE=0x80000000
119CONFIG_BOOT_LOAD=0x00400000
120
121#
122# Generic Driver Options
123#
124
125#
126# Memory Technology Devices (MTD)
127#
128CONFIG_MTD=y
129# CONFIG_MTD_DEBUG is not set
130CONFIG_MTD_PARTITIONS=y
131# CONFIG_MTD_CONCAT is not set
132# CONFIG_MTD_REDBOOT_PARTS is not set
133# CONFIG_MTD_CMDLINE_PARTS is not set
134
135#
136# User Modules And Translation Layers
137#
138CONFIG_MTD_CHAR=y
139CONFIG_MTD_BLOCK=y
140# CONFIG_FTL is not set
141# CONFIG_NFTL is not set
142# CONFIG_INFTL is not set
143
144#
145# RAM/ROM/Flash chip drivers
146#
147CONFIG_MTD_CFI=y
148CONFIG_MTD_JEDECPROBE=y
149CONFIG_MTD_GEN_PROBE=y
150# CONFIG_MTD_CFI_ADV_OPTIONS is not set
151# CONFIG_MTD_CFI_INTELEXT is not set
152CONFIG_MTD_CFI_AMDSTD=y
153# CONFIG_MTD_CFI_STAA is not set
154# CONFIG_MTD_RAM is not set
155# CONFIG_MTD_ROM is not set
156# CONFIG_MTD_ABSENT is not set
157# CONFIG_MTD_OBSOLETE_CHIPS is not set
158
159#
160# Mapping drivers for chip access
161#
162# CONFIG_MTD_COMPLEX_MAPPINGS is not set
163# CONFIG_MTD_PHYSMAP is not set
164CONFIG_MTD_BEECH=y
165
166#
167# Self-contained MTD device drivers
168#
169# CONFIG_MTD_SLRAM is not set
170# CONFIG_MTD_MTDRAM is not set
171# CONFIG_MTD_BLKMTD is not set
172
173#
174# Disk-On-Chip Device Drivers
175#
176# CONFIG_MTD_DOC2000 is not set
177# CONFIG_MTD_DOC2001 is not set
178# CONFIG_MTD_DOC2001PLUS is not set
179
180#
181# NAND Flash Device Drivers
182#
183# CONFIG_MTD_NAND is not set
184
185#
186# Plug and Play support
187#
188# CONFIG_PNP is not set
189
190#
191# Block devices
192#
193CONFIG_BLK_DEV_LOOP=y
194# CONFIG_BLK_DEV_CRYPTOLOOP is not set
195# CONFIG_BLK_DEV_NBD is not set
196CONFIG_BLK_DEV_RAM=y
197CONFIG_BLK_DEV_RAM_SIZE=4096
198CONFIG_BLK_DEV_INITRD=y
199# CONFIG_LBD is not set
200
201#
202# Multi-device support (RAID and LVM)
203#
204# CONFIG_MD is not set
205
206#
207# ATA/ATAPI/MFM/RLL support
208#
209# CONFIG_IDE is not set
210
211#
212# SCSI device support
213#
214# CONFIG_SCSI is not set
215
216#
217# Fusion MPT device support
218#
219
220#
221# I2O device support
222#
223
224#
225# Networking support
226#
227CONFIG_NET=y
228
229#
230# Networking options
231#
232# CONFIG_PACKET is not set
233# CONFIG_NETLINK_DEV is not set
234CONFIG_UNIX=y
235# CONFIG_NET_KEY is not set
236CONFIG_INET=y
237CONFIG_IP_MULTICAST=y
238# CONFIG_IP_ADVANCED_ROUTER is not set
239CONFIG_IP_PNP=y
240# CONFIG_IP_PNP_DHCP is not set
241CONFIG_IP_PNP_BOOTP=y
242CONFIG_IP_PNP_RARP=y
243# CONFIG_NET_IPIP is not set
244# CONFIG_NET_IPGRE is not set
245# CONFIG_IP_MROUTE is not set
246# CONFIG_ARPD is not set
247# CONFIG_INET_ECN is not set
248CONFIG_SYN_COOKIES=y
249# CONFIG_INET_AH is not set
250# CONFIG_INET_ESP is not set
251# CONFIG_INET_IPCOMP is not set
252# CONFIG_IPV6 is not set
253# CONFIG_DECNET is not set
254# CONFIG_BRIDGE is not set
255# CONFIG_NETFILTER is not set
256
257#
258# SCTP Configuration (EXPERIMENTAL)
259#
260CONFIG_IPV6_SCTP__=y
261# CONFIG_IP_SCTP is not set
262# CONFIG_ATM is not set
263# CONFIG_VLAN_8021Q is not set
264# CONFIG_LLC2 is not set
265# CONFIG_IPX is not set
266# CONFIG_ATALK is not set
267# CONFIG_X25 is not set
268# CONFIG_LAPB is not set
269# CONFIG_NET_DIVERT is not set
270# CONFIG_ECONET is not set
271# CONFIG_WAN_ROUTER is not set
272# CONFIG_NET_HW_FLOWCONTROL is not set
273
274#
275# QoS and/or fair queueing
276#
277# CONFIG_NET_SCHED is not set
278
279#
280# Network testing
281#
282# CONFIG_NET_PKTGEN is not set
283CONFIG_NETDEVICES=y
284# CONFIG_DUMMY is not set
285# CONFIG_BONDING is not set
286# CONFIG_EQUALIZER is not set
287# CONFIG_TUN is not set
288
289#
290# Ethernet (10 or 100Mbit)
291#
292CONFIG_NET_ETHERNET=y
293# CONFIG_MII is not set
294# CONFIG_OAKNET is not set
295
296#
297# Ethernet (1000 Mbit)
298#
299
300#
301# Ethernet (10000 Mbit)
302#
303# CONFIG_PPP is not set
304# CONFIG_SLIP is not set
305
306#
307# Wireless LAN (non-hamradio)
308#
309# CONFIG_NET_RADIO is not set
310
311#
312# Token Ring devices
313#
314# CONFIG_SHAPER is not set
315
316#
317# Wan interfaces
318#
319# CONFIG_WAN is not set
320
321#
322# Amateur Radio support
323#
324# CONFIG_HAMRADIO is not set
325
326#
327# IrDA (infrared) support
328#
329# CONFIG_IRDA is not set
330
331#
332# Bluetooth support
333#
334# CONFIG_BT is not set
335
336#
337# ISDN subsystem
338#
339# CONFIG_ISDN_BOOL is not set
340
341#
342# Graphics support
343#
344CONFIG_FB=y
345# CONFIG_FB_CT65550 is not set
346# CONFIG_FB_S3TRIO is not set
347# CONFIG_FB_VGA16 is not set
348# CONFIG_FB_VIRTUAL is not set
349
350#
351# Logo configuration
352#
353# CONFIG_LOGO is not set
354
355#
356# Input device support
357#
358CONFIG_INPUT=y
359
360#
361# Userland interfaces
362#
363# CONFIG_INPUT_MOUSEDEV is not set
364# CONFIG_INPUT_JOYDEV is not set
365# CONFIG_INPUT_TSDEV is not set
366# CONFIG_INPUT_EVDEV is not set
367# CONFIG_INPUT_EVBUG is not set
368
369#
370# Input I/O drivers
371#
372# CONFIG_GAMEPORT is not set
373CONFIG_SOUND_GAMEPORT=y
374CONFIG_SERIO=y
375# CONFIG_SERIO_I8042 is not set
376# CONFIG_SERIO_SERPORT is not set
377# CONFIG_SERIO_CT82C710 is not set
378
379#
380# Input Device Drivers
381#
382# CONFIG_INPUT_KEYBOARD is not set
383# CONFIG_INPUT_MOUSE is not set
384# CONFIG_INPUT_JOYSTICK is not set
385# CONFIG_INPUT_TOUCHSCREEN is not set
386# CONFIG_INPUT_MISC is not set
387
388#
389# Macintosh device drivers
390#
391
392#
393# Character devices
394#
395# CONFIG_VT is not set
396# CONFIG_SERIAL_NONSTANDARD is not set
397
398#
399# Serial drivers
400#
401CONFIG_SERIAL_8250=y
402CONFIG_SERIAL_8250_CONSOLE=y
403CONFIG_SERIAL_8250_NR_UARTS=4
404# CONFIG_SERIAL_8250_EXTENDED is not set
405
406#
407# Non-8250 serial port support
408#
409CONFIG_SERIAL_CORE=y
410CONFIG_SERIAL_CORE_CONSOLE=y
411CONFIG_UNIX98_PTYS=y
412CONFIG_UNIX98_PTY_COUNT=256
413
414#
415# I2C support
416#
417CONFIG_I2C=y
418# CONFIG_I2C_CHARDEV is not set
419
420#
421# I2C Algorithms
422#
423# CONFIG_I2C_ALGOBIT is not set
424# CONFIG_I2C_ALGOPCF is not set
425
426#
427# I2C Hardware Bus support
428#
429# CONFIG_I2C_AMD756 is not set
430# CONFIG_I2C_AMD8111 is not set
431CONFIG_I2C_IBM_IIC=y
432
433#
434# I2C Hardware Sensors Chip support
435#
436# CONFIG_I2C_SENSOR is not set
437# CONFIG_SENSORS_ADM1021 is not set
438# CONFIG_SENSORS_EEPROM is not set
439# CONFIG_SENSORS_IT87 is not set
440# CONFIG_SENSORS_LM75 is not set
441# CONFIG_SENSORS_LM78 is not set
442# CONFIG_SENSORS_LM85 is not set
443# CONFIG_SENSORS_VIA686A is not set
444# CONFIG_SENSORS_W83781D is not set
445
446#
447# Mice
448#
449# CONFIG_BUSMOUSE is not set
450# CONFIG_QIC02_TAPE is not set
451
452#
453# IPMI
454#
455# CONFIG_IPMI_HANDLER is not set
456
457#
458# Watchdog Cards
459#
460# CONFIG_WATCHDOG is not set
461# CONFIG_NVRAM is not set
462CONFIG_GEN_RTC=y
463# CONFIG_GEN_RTC_X is not set
464# CONFIG_DTLK is not set
465# CONFIG_R3964 is not set
466# CONFIG_APPLICOM is not set
467
468#
469# Ftape, the floppy tape device driver
470#
471# CONFIG_FTAPE is not set
472# CONFIG_AGP is not set
473# CONFIG_DRM is not set
474# CONFIG_RAW_DRIVER is not set
475
476#
477# Multimedia devices
478#
479# CONFIG_VIDEO_DEV is not set
480
481#
482# Digital Video Broadcasting Devices
483#
484# CONFIG_DVB is not set
485
486#
487# File systems
488#
489CONFIG_EXT2_FS=y
490# CONFIG_EXT2_FS_XATTR is not set
491# CONFIG_EXT3_FS is not set
492# CONFIG_JBD is not set
493# CONFIG_REISERFS_FS is not set
494# CONFIG_JFS_FS is not set
495# CONFIG_XFS_FS is not set
496# CONFIG_MINIX_FS is not set
497# CONFIG_ROMFS_FS is not set
498# CONFIG_QUOTA is not set
499# CONFIG_AUTOFS_FS is not set
500# CONFIG_AUTOFS4_FS is not set
501
502#
503# CD-ROM/DVD Filesystems
504#
505# CONFIG_ISO9660_FS is not set
506# CONFIG_UDF_FS is not set
507
508#
509# DOS/FAT/NT Filesystems
510#
511# CONFIG_FAT_FS is not set
512# CONFIG_NTFS_FS is not set
513
514#
515# Pseudo filesystems
516#
517CONFIG_PROC_FS=y
518CONFIG_PROC_KCORE=y
519CONFIG_DEVFS_FS=y
520# CONFIG_DEVFS_MOUNT is not set
521# CONFIG_DEVFS_DEBUG is not set
522CONFIG_DEVPTS_FS=y
523# CONFIG_DEVPTS_FS_XATTR is not set
524CONFIG_TMPFS=y
525# CONFIG_HUGETLB_PAGE is not set
526CONFIG_RAMFS=y
527
528#
529# Miscellaneous filesystems
530#
531# CONFIG_ADFS_FS is not set
532# CONFIG_AFFS_FS is not set
533# CONFIG_HFS_FS is not set
534# CONFIG_BEFS_FS is not set
535# CONFIG_BFS_FS is not set
536# CONFIG_EFS_FS is not set
537# CONFIG_JFFS_FS is not set
538# CONFIG_JFFS2_FS is not set
539# CONFIG_CRAMFS is not set
540# CONFIG_VXFS_FS is not set
541# CONFIG_HPFS_FS is not set
542# CONFIG_QNX4FS_FS is not set
543# CONFIG_SYSV_FS is not set
544# CONFIG_UFS_FS is not set
545
546#
547# Network File Systems
548#
549CONFIG_NFS_FS=y
550# CONFIG_NFS_V3 is not set
551# CONFIG_NFS_V4 is not set
552# CONFIG_NFSD is not set
553CONFIG_ROOT_NFS=y
554CONFIG_LOCKD=y
555# CONFIG_EXPORTFS is not set
556CONFIG_SUNRPC=y
557# CONFIG_SUNRPC_GSS is not set
558# CONFIG_SMB_FS is not set
559# CONFIG_CIFS is not set
560# CONFIG_NCP_FS is not set
561# CONFIG_CODA_FS is not set
562# CONFIG_INTERMEZZO_FS is not set
563# CONFIG_AFS_FS is not set
564
565#
566# Partition Types
567#
568# CONFIG_PARTITION_ADVANCED is not set
569CONFIG_MSDOS_PARTITION=y
570
571#
572# Sound
573#
574CONFIG_SOUND=y
575
576#
577# Advanced Linux Sound Architecture
578#
579# CONFIG_SND is not set
580
581#
582# Open Sound System
583#
584# CONFIG_SOUND_PRIME is not set
585
586#
587# IBM 40x options
588#
589
590#
591# USB support
592#
593# CONFIG_USB_GADGET is not set
594
595#
596# Library routines
597#
598# CONFIG_CRC32 is not set
599
600#
601# Kernel hacking
602#
603# CONFIG_DEBUG_KERNEL is not set
604# CONFIG_SERIAL_TEXT_DEBUG is not set
605CONFIG_OCP=y
606
607#
608# Security options
609#
610# CONFIG_SECURITY is not set
611
612#
613# Cryptographic options
614#
615# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/bseip_defconfig b/arch/ppc/configs/bseip_defconfig
new file mode 100644
index 000000000000..ce9f9f77f2ee
--- /dev/null
+++ b/arch/ppc/configs/bseip_defconfig
@@ -0,0 +1,517 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7
8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12
13#
14# General setup
15#
16CONFIG_SWAP=y
17CONFIG_SYSVIPC=y
18# CONFIG_BSD_PROCESS_ACCT is not set
19CONFIG_SYSCTL=y
20CONFIG_LOG_BUF_SHIFT=14
21CONFIG_EMBEDDED=y
22CONFIG_FUTEX=y
23# CONFIG_EPOLL is not set
24
25#
26# Loadable module support
27#
28# CONFIG_MODULES is not set
29
30#
31# Platform support
32#
33CONFIG_PPC=y
34CONFIG_PPC32=y
35# CONFIG_6xx is not set
36# CONFIG_40x is not set
37# CONFIG_POWER3 is not set
38CONFIG_8xx=y
39
40#
41# IBM 4xx options
42#
43CONFIG_EMBEDDEDBOOT=y
44CONFIG_SERIAL_CONSOLE=y
45CONFIG_NOT_COHERENT_CACHE=y
46# CONFIG_RPXLITE is not set
47# CONFIG_RPXCLASSIC is not set
48CONFIG_BSEIP=y
49# CONFIG_FADS is not set
50# CONFIG_TQM823L is not set
51# CONFIG_TQM850L is not set
52# CONFIG_TQM855L is not set
53# CONFIG_TQM860L is not set
54# CONFIG_FPS850L is not set
55# CONFIG_SPD823TS is not set
56# CONFIG_IVMS8 is not set
57# CONFIG_IVML24 is not set
58# CONFIG_SM850 is not set
59# CONFIG_HERMES_PRO is not set
60# CONFIG_IP860 is not set
61# CONFIG_LWMON is not set
62# CONFIG_PCU_E is not set
63# CONFIG_CCM is not set
64# CONFIG_LANTEC is not set
65# CONFIG_MBX is not set
66# CONFIG_WINCEPT is not set
67# CONFIG_SMP is not set
68# CONFIG_PREEMPT is not set
69CONFIG_MATH_EMULATION=y
70# CONFIG_CPU_FREQ is not set
71
72#
73# General setup
74#
75# CONFIG_HIGHMEM is not set
76# CONFIG_PCI is not set
77# CONFIG_PCI_DOMAINS is not set
78# CONFIG_PCI_QSPAN is not set
79CONFIG_KCORE_ELF=y
80CONFIG_BINFMT_ELF=y
81CONFIG_KERNEL_ELF=y
82# CONFIG_BINFMT_MISC is not set
83# CONFIG_HOTPLUG is not set
84
85#
86# Parallel port support
87#
88# CONFIG_PARPORT is not set
89# CONFIG_CMDLINE_BOOL is not set
90
91#
92# Advanced setup
93#
94# CONFIG_ADVANCED_OPTIONS is not set
95
96#
97# Default settings for advanced configuration options are used
98#
99CONFIG_HIGHMEM_START=0xfe000000
100CONFIG_LOWMEM_SIZE=0x30000000
101CONFIG_KERNEL_START=0xc0000000
102CONFIG_TASK_SIZE=0x80000000
103CONFIG_BOOT_LOAD=0x00400000
104
105#
106# Memory Technology Devices (MTD)
107#
108# CONFIG_MTD is not set
109
110#
111# Plug and Play support
112#
113# CONFIG_PNP is not set
114
115#
116# Block devices
117#
118# CONFIG_BLK_DEV_FD is not set
119CONFIG_BLK_DEV_LOOP=y
120# CONFIG_BLK_DEV_NBD is not set
121CONFIG_BLK_DEV_RAM=y
122CONFIG_BLK_DEV_RAM_SIZE=4096
123CONFIG_BLK_DEV_INITRD=y
124
125#
126# Multi-device support (RAID and LVM)
127#
128# CONFIG_MD is not set
129
130#
131# ATA/IDE/MFM/RLL support
132#
133# CONFIG_IDE is not set
134
135#
136# SCSI support
137#
138# CONFIG_SCSI is not set
139
140#
141# Fusion MPT device support
142#
143
144#
145# I2O device support
146#
147
148#
149# Networking support
150#
151CONFIG_NET=y
152
153#
154# Networking options
155#
156CONFIG_PACKET=y
157# CONFIG_PACKET_MMAP is not set
158# CONFIG_NETLINK_DEV is not set
159# CONFIG_NETFILTER is not set
160CONFIG_UNIX=y
161# CONFIG_NET_KEY is not set
162CONFIG_INET=y
163CONFIG_IP_MULTICAST=y
164# CONFIG_IP_ADVANCED_ROUTER is not set
165CONFIG_IP_PNP=y
166CONFIG_IP_PNP_DHCP=y
167CONFIG_IP_PNP_BOOTP=y
168# CONFIG_IP_PNP_RARP is not set
169# CONFIG_NET_IPIP is not set
170# CONFIG_NET_IPGRE is not set
171# CONFIG_IP_MROUTE is not set
172# CONFIG_ARPD is not set
173# CONFIG_INET_ECN is not set
174CONFIG_SYN_COOKIES=y
175# CONFIG_INET_AH is not set
176# CONFIG_INET_ESP is not set
177# CONFIG_INET_IPCOMP is not set
178# CONFIG_IPV6 is not set
179# CONFIG_XFRM_USER is not set
180
181#
182# SCTP Configuration (EXPERIMENTAL)
183#
184CONFIG_IPV6_SCTP__=y
185# CONFIG_IP_SCTP is not set
186# CONFIG_ATM is not set
187# CONFIG_VLAN_8021Q is not set
188# CONFIG_LLC is not set
189# CONFIG_DECNET is not set
190# CONFIG_BRIDGE is not set
191# CONFIG_X25 is not set
192# CONFIG_LAPB is not set
193# CONFIG_NET_DIVERT is not set
194# CONFIG_ECONET is not set
195# CONFIG_WAN_ROUTER is not set
196# CONFIG_NET_HW_FLOWCONTROL is not set
197
198#
199# QoS and/or fair queueing
200#
201# CONFIG_NET_SCHED is not set
202
203#
204# Network testing
205#
206# CONFIG_NET_PKTGEN is not set
207CONFIG_NETDEVICES=y
208# CONFIG_DUMMY is not set
209# CONFIG_BONDING is not set
210# CONFIG_EQUALIZER is not set
211# CONFIG_TUN is not set
212# CONFIG_ETHERTAP is not set
213
214#
215# Ethernet (10 or 100Mbit)
216#
217CONFIG_NET_ETHERNET=y
218# CONFIG_MII is not set
219# CONFIG_OAKNET is not set
220
221#
222# Ethernet (1000 Mbit)
223#
224
225#
226# Ethernet (10000 Mbit)
227#
228# CONFIG_PPP is not set
229# CONFIG_SLIP is not set
230
231#
232# Wireless LAN (non-hamradio)
233#
234# CONFIG_NET_RADIO is not set
235
236#
237# Token Ring devices (depends on LLC=y)
238#
239# CONFIG_SHAPER is not set
240
241#
242# Wan interfaces
243#
244# CONFIG_WAN is not set
245
246#
247# Amateur Radio support
248#
249# CONFIG_HAMRADIO is not set
250
251#
252# IrDA (infrared) support
253#
254# CONFIG_IRDA is not set
255
256#
257# ISDN subsystem
258#
259# CONFIG_ISDN_BOOL is not set
260
261#
262# Graphics support
263#
264# CONFIG_FB is not set
265
266#
267# Old CD-ROM drivers (not SCSI, not IDE)
268#
269# CONFIG_CD_NO_IDESCSI is not set
270
271#
272# Input device support
273#
274# CONFIG_INPUT is not set
275
276#
277# Userland interfaces
278#
279
280#
281# Input I/O drivers
282#
283# CONFIG_GAMEPORT is not set
284CONFIG_SOUND_GAMEPORT=y
285# CONFIG_SERIO is not set
286
287#
288# Input Device Drivers
289#
290
291#
292# Macintosh device drivers
293#
294
295#
296# Serial drivers
297#
298# CONFIG_SERIAL_8250 is not set
299
300#
301# Non-8250 serial port support
302#
303CONFIG_SERIAL_CORE=y
304CONFIG_SERIAL_CORE_CONSOLE=y
305CONFIG_SERIAL_CPM=y
306CONFIG_SERIAL_CPM_CONSOLE=y
307# CONFIG_SERIAL_CPM_SCC1 is not set
308# CONFIG_SERIAL_CPM_SCC2 is not set
309# CONFIG_SERIAL_CPM_SCC3 is not set
310# CONFIG_SERIAL_CPM_SCC4 is not set
311CONFIG_SERIAL_CPM_SMC1=y
312CONFIG_SERIAL_CPM_SMC2=y
313CONFIG_UNIX98_PTYS=y
314# CONFIG_LEGACY_PTYS is not set
315
316#
317# I2C support
318#
319# CONFIG_I2C is not set
320
321#
322# I2C Hardware Sensors Mainboard support
323#
324
325#
326# I2C Hardware Sensors Chip support
327#
328# CONFIG_I2C_SENSOR is not set
329
330#
331# Mice
332#
333# CONFIG_BUSMOUSE is not set
334# CONFIG_QIC02_TAPE is not set
335
336#
337# IPMI
338#
339# CONFIG_IPMI_HANDLER is not set
340
341#
342# Watchdog Cards
343#
344# CONFIG_WATCHDOG is not set
345# CONFIG_NVRAM is not set
346CONFIG_GEN_RTC=y
347# CONFIG_GEN_RTC_X is not set
348# CONFIG_DTLK is not set
349# CONFIG_R3964 is not set
350# CONFIG_APPLICOM is not set
351
352#
353# Ftape, the floppy tape device driver
354#
355# CONFIG_FTAPE is not set
356# CONFIG_AGP is not set
357# CONFIG_DRM is not set
358# CONFIG_RAW_DRIVER is not set
359# CONFIG_HANGCHECK_TIMER is not set
360
361#
362# Multimedia devices
363#
364# CONFIG_VIDEO_DEV is not set
365
366#
367# Digital Video Broadcasting Devices
368#
369# CONFIG_DVB is not set
370
371#
372# File systems
373#
374CONFIG_EXT2_FS=y
375# CONFIG_EXT2_FS_XATTR is not set
376CONFIG_EXT3_FS=y
377CONFIG_EXT3_FS_XATTR=y
378# CONFIG_EXT3_FS_POSIX_ACL is not set
379# CONFIG_EXT3_FS_SECURITY is not set
380CONFIG_JBD=y
381# CONFIG_JBD_DEBUG is not set
382CONFIG_FS_MBCACHE=y
383# CONFIG_REISERFS_FS is not set
384# CONFIG_JFS_FS is not set
385# CONFIG_XFS_FS is not set
386# CONFIG_MINIX_FS is not set
387# CONFIG_ROMFS_FS is not set
388# CONFIG_QUOTA is not set
389# CONFIG_AUTOFS_FS is not set
390# CONFIG_AUTOFS4_FS is not set
391
392#
393# CD-ROM/DVD Filesystems
394#
395# CONFIG_ISO9660_FS is not set
396# CONFIG_UDF_FS is not set
397
398#
399# DOS/FAT/NT Filesystems
400#
401# CONFIG_FAT_FS is not set
402# CONFIG_NTFS_FS is not set
403
404#
405# Pseudo filesystems
406#
407CONFIG_PROC_FS=y
408# CONFIG_DEVFS_FS is not set
409CONFIG_DEVPTS_FS=y
410# CONFIG_DEVPTS_FS_XATTR is not set
411CONFIG_TMPFS=y
412CONFIG_RAMFS=y
413
414#
415# Miscellaneous filesystems
416#
417# CONFIG_ADFS_FS is not set
418# CONFIG_AFFS_FS is not set
419# CONFIG_HFS_FS is not set
420# CONFIG_BEFS_FS is not set
421# CONFIG_BFS_FS is not set
422# CONFIG_EFS_FS is not set
423# CONFIG_CRAMFS is not set
424# CONFIG_VXFS_FS is not set
425# CONFIG_HPFS_FS is not set
426# CONFIG_QNX4FS_FS is not set
427# CONFIG_SYSV_FS is not set
428# CONFIG_UFS_FS is not set
429
430#
431# Network File Systems
432#
433CONFIG_NFS_FS=y
434# CONFIG_NFS_V3 is not set
435# CONFIG_NFS_V4 is not set
436# CONFIG_NFSD is not set
437CONFIG_ROOT_NFS=y
438CONFIG_LOCKD=y
439# CONFIG_EXPORTFS is not set
440CONFIG_SUNRPC=y
441# CONFIG_SUNRPC_GSS is not set
442# CONFIG_SMB_FS is not set
443# CONFIG_CIFS is not set
444# CONFIG_NCP_FS is not set
445# CONFIG_CODA_FS is not set
446# CONFIG_INTERMEZZO_FS is not set
447# CONFIG_AFS_FS is not set
448
449#
450# Partition Types
451#
452CONFIG_PARTITION_ADVANCED=y
453# CONFIG_ACORN_PARTITION is not set
454# CONFIG_OSF_PARTITION is not set
455# CONFIG_AMIGA_PARTITION is not set
456# CONFIG_ATARI_PARTITION is not set
457# CONFIG_MAC_PARTITION is not set
458# CONFIG_MSDOS_PARTITION is not set
459# CONFIG_LDM_PARTITION is not set
460# CONFIG_NEC98_PARTITION is not set
461# CONFIG_SGI_PARTITION is not set
462# CONFIG_ULTRIX_PARTITION is not set
463# CONFIG_SUN_PARTITION is not set
464# CONFIG_EFI_PARTITION is not set
465
466#
467# Sound
468#
469# CONFIG_SOUND is not set
470
471#
472# MPC8xx CPM Options
473#
474CONFIG_SCC_ENET=y
475# CONFIG_SCC1_ENET is not set
476CONFIG_SCC2_ENET=y
477# CONFIG_SCC3_ENET is not set
478# CONFIG_FEC_ENET is not set
479# CONFIG_ENET_BIG_BUFFERS is not set
480
481#
482# Generic MPC8xx Options
483#
484CONFIG_8xx_COPYBACK=y
485# CONFIG_8xx_CPU6 is not set
486# CONFIG_UCODE_PATCH is not set
487
488#
489# USB support
490#
491# CONFIG_USB_GADGET is not set
492
493#
494# Bluetooth support
495#
496# CONFIG_BT is not set
497
498#
499# Library routines
500#
501# CONFIG_CRC32 is not set
502
503#
504# Kernel hacking
505#
506# CONFIG_DEBUG_KERNEL is not set
507# CONFIG_KALLSYMS is not set
508
509#
510# Security options
511#
512# CONFIG_SECURITY is not set
513
514#
515# Cryptographic options
516#
517# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/bubinga_defconfig b/arch/ppc/configs/bubinga_defconfig
new file mode 100644
index 000000000000..ebec8013102c
--- /dev/null
+++ b/arch/ppc/configs/bubinga_defconfig
@@ -0,0 +1,592 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7CONFIG_PPC=y
8CONFIG_PPC32=y
9CONFIG_GENERIC_NVRAM=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16# CONFIG_STANDALONE is not set
17CONFIG_BROKEN_ON_SMP=y
18
19#
20# General setup
21#
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26CONFIG_LOG_BUF_SHIFT=14
27# CONFIG_HOTPLUG is not set
28# CONFIG_IKCONFIG is not set
29CONFIG_EMBEDDED=y
30# CONFIG_KALLSYMS is not set
31CONFIG_FUTEX=y
32# CONFIG_EPOLL is not set
33CONFIG_IOSCHED_NOOP=y
34CONFIG_IOSCHED_AS=y
35CONFIG_IOSCHED_DEADLINE=y
36# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
37
38#
39# Loadable module support
40#
41CONFIG_MODULES=y
42CONFIG_MODULE_UNLOAD=y
43# CONFIG_MODULE_FORCE_UNLOAD is not set
44CONFIG_OBSOLETE_MODPARM=y
45# CONFIG_MODVERSIONS is not set
46CONFIG_KMOD=y
47
48#
49# Processor
50#
51# CONFIG_6xx is not set
52CONFIG_40x=y
53# CONFIG_44x is not set
54# CONFIG_POWER3 is not set
55# CONFIG_POWER4 is not set
56# CONFIG_8xx is not set
57# CONFIG_MATH_EMULATION is not set
58# CONFIG_CPU_FREQ is not set
59CONFIG_4xx=y
60
61#
62# IBM 4xx options
63#
64# CONFIG_ASH is not set
65CONFIG_BUBINGA=y
66# CONFIG_CPCI405 is not set
67# CONFIG_EP405 is not set
68# CONFIG_OAK is not set
69# CONFIG_REDWOOD_5 is not set
70# CONFIG_REDWOOD_6 is not set
71# CONFIG_SYCAMORE is not set
72# CONFIG_WALNUT is not set
73CONFIG_IBM405_ERR77=y
74CONFIG_IBM405_ERR51=y
75CONFIG_IBM_OCP=y
76CONFIG_BIOS_FIXUP=y
77CONFIG_405EP=y
78CONFIG_IBM_OPENBIOS=y
79# CONFIG_PM is not set
80CONFIG_UART0_TTYS0=y
81# CONFIG_UART0_TTYS1 is not set
82CONFIG_NOT_COHERENT_CACHE=y
83
84#
85# Platform options
86#
87# CONFIG_PC_KEYBOARD is not set
88# CONFIG_SMP is not set
89# CONFIG_PREEMPT is not set
90# CONFIG_HIGHMEM is not set
91CONFIG_KERNEL_ELF=y
92CONFIG_BINFMT_ELF=y
93# CONFIG_BINFMT_MISC is not set
94# CONFIG_CMDLINE_BOOL is not set
95
96#
97# Bus options
98#
99CONFIG_PCI=y
100CONFIG_PCI_DOMAINS=y
101CONFIG_PCI_LEGACY_PROC=y
102# CONFIG_PCI_NAMES is not set
103
104#
105# Advanced setup
106#
107# CONFIG_ADVANCED_OPTIONS is not set
108
109#
110# Default settings for advanced configuration options are used
111#
112CONFIG_HIGHMEM_START=0xfe000000
113CONFIG_LOWMEM_SIZE=0x30000000
114CONFIG_KERNEL_START=0xc0000000
115CONFIG_TASK_SIZE=0x80000000
116CONFIG_BOOT_LOAD=0x00400000
117
118#
119# Device Drivers
120#
121
122#
123# Generic Driver Options
124#
125
126#
127# Memory Technology Devices (MTD)
128#
129# CONFIG_MTD is not set
130
131#
132# Parallel port support
133#
134# CONFIG_PARPORT is not set
135
136#
137# Plug and Play support
138#
139
140#
141# Block devices
142#
143# CONFIG_BLK_DEV_FD is not set
144# CONFIG_BLK_CPQ_DA is not set
145# CONFIG_BLK_CPQ_CISS_DA is not set
146# CONFIG_BLK_DEV_DAC960 is not set
147# CONFIG_BLK_DEV_UMEM is not set
148CONFIG_BLK_DEV_LOOP=y
149# CONFIG_BLK_DEV_CRYPTOLOOP is not set
150# CONFIG_BLK_DEV_NBD is not set
151# CONFIG_BLK_DEV_CARMEL is not set
152CONFIG_BLK_DEV_RAM=y
153CONFIG_BLK_DEV_RAM_SIZE=4096
154CONFIG_BLK_DEV_INITRD=y
155# CONFIG_LBD is not set
156
157#
158# ATA/ATAPI/MFM/RLL support
159#
160# CONFIG_IDE is not set
161
162#
163# SCSI device support
164#
165# CONFIG_SCSI is not set
166
167#
168# Multi-device support (RAID and LVM)
169#
170# CONFIG_MD is not set
171
172#
173# Fusion MPT device support
174#
175# CONFIG_FUSION is not set
176
177#
178# IEEE 1394 (FireWire) support
179#
180# CONFIG_IEEE1394 is not set
181
182#
183# I2O device support
184#
185# CONFIG_I2O is not set
186
187#
188# Macintosh device drivers
189#
190
191#
192# Networking support
193#
194CONFIG_NET=y
195
196#
197# Networking options
198#
199# CONFIG_PACKET is not set
200# CONFIG_NETLINK_DEV is not set
201CONFIG_UNIX=y
202# CONFIG_NET_KEY is not set
203CONFIG_INET=y
204CONFIG_IP_MULTICAST=y
205# CONFIG_IP_ADVANCED_ROUTER is not set
206CONFIG_IP_PNP=y
207# CONFIG_IP_PNP_DHCP is not set
208CONFIG_IP_PNP_BOOTP=y
209# CONFIG_IP_PNP_RARP is not set
210# CONFIG_NET_IPIP is not set
211# CONFIG_NET_IPGRE is not set
212# CONFIG_IP_MROUTE is not set
213# CONFIG_ARPD is not set
214CONFIG_SYN_COOKIES=y
215# CONFIG_INET_AH is not set
216# CONFIG_INET_ESP is not set
217# CONFIG_INET_IPCOMP is not set
218# CONFIG_IPV6 is not set
219# CONFIG_DECNET is not set
220# CONFIG_BRIDGE is not set
221# CONFIG_NETFILTER is not set
222
223#
224# SCTP Configuration (EXPERIMENTAL)
225#
226# CONFIG_IP_SCTP is not set
227# CONFIG_ATM is not set
228# CONFIG_VLAN_8021Q is not set
229# CONFIG_LLC2 is not set
230# CONFIG_IPX is not set
231# CONFIG_ATALK is not set
232# CONFIG_X25 is not set
233# CONFIG_LAPB is not set
234# CONFIG_NET_DIVERT is not set
235# CONFIG_ECONET is not set
236# CONFIG_WAN_ROUTER is not set
237# CONFIG_NET_HW_FLOWCONTROL is not set
238
239#
240# QoS and/or fair queueing
241#
242# CONFIG_NET_SCHED is not set
243
244#
245# Network testing
246#
247# CONFIG_NET_PKTGEN is not set
248CONFIG_NETDEVICES=y
249
250#
251# ARCnet devices
252#
253# CONFIG_ARCNET is not set
254# CONFIG_DUMMY is not set
255# CONFIG_BONDING is not set
256# CONFIG_EQUALIZER is not set
257# CONFIG_TUN is not set
258
259#
260# Ethernet (10 or 100Mbit)
261#
262CONFIG_NET_ETHERNET=y
263CONFIG_MII=y
264# CONFIG_OAKNET is not set
265# CONFIG_HAPPYMEAL is not set
266# CONFIG_SUNGEM is not set
267# CONFIG_NET_VENDOR_3COM is not set
268
269#
270# Tulip family network device support
271#
272# CONFIG_NET_TULIP is not set
273# CONFIG_HP100 is not set
274# CONFIG_NET_PCI is not set
275
276#
277# Ethernet (1000 Mbit)
278#
279# CONFIG_ACENIC is not set
280# CONFIG_DL2K is not set
281# CONFIG_E1000 is not set
282# CONFIG_NS83820 is not set
283# CONFIG_HAMACHI is not set
284# CONFIG_YELLOWFIN is not set
285# CONFIG_R8169 is not set
286# CONFIG_SIS190 is not set
287# CONFIG_SK98LIN is not set
288# CONFIG_TIGON3 is not set
289
290#
291# Ethernet (10000 Mbit)
292#
293# CONFIG_IXGB is not set
294CONFIG_IBM_EMAC=y
295# CONFIG_IBM_EMAC_ERRMSG is not set
296CONFIG_IBM_EMAC_RXB=64
297CONFIG_IBM_EMAC_TXB=8
298CONFIG_IBM_EMAC_FGAP=8
299CONFIG_IBM_EMAC_SKBRES=0
300# CONFIG_FDDI is not set
301# CONFIG_HIPPI is not set
302# CONFIG_PPP is not set
303# CONFIG_SLIP is not set
304
305#
306# Wireless LAN (non-hamradio)
307#
308# CONFIG_NET_RADIO is not set
309
310#
311# Token Ring devices
312#
313# CONFIG_TR is not set
314# CONFIG_RCPCI is not set
315# CONFIG_SHAPER is not set
316# CONFIG_NETCONSOLE is not set
317
318#
319# Wan interfaces
320#
321# CONFIG_WAN is not set
322
323#
324# Amateur Radio support
325#
326# CONFIG_HAMRADIO is not set
327
328#
329# IrDA (infrared) support
330#
331# CONFIG_IRDA is not set
332
333#
334# Bluetooth support
335#
336# CONFIG_BT is not set
337# CONFIG_NETPOLL is not set
338# CONFIG_NET_POLL_CONTROLLER is not set
339
340#
341# ISDN subsystem
342#
343# CONFIG_ISDN is not set
344
345#
346# Telephony Support
347#
348# CONFIG_PHONE is not set
349
350#
351# Input device support
352#
353CONFIG_INPUT=y
354
355#
356# Userland interfaces
357#
358# CONFIG_INPUT_MOUSEDEV is not set
359# CONFIG_INPUT_JOYDEV is not set
360# CONFIG_INPUT_TSDEV is not set
361# CONFIG_INPUT_EVDEV is not set
362# CONFIG_INPUT_EVBUG is not set
363
364#
365# Input I/O drivers
366#
367# CONFIG_GAMEPORT is not set
368CONFIG_SOUND_GAMEPORT=y
369CONFIG_SERIO=y
370# CONFIG_SERIO_I8042 is not set
371# CONFIG_SERIO_SERPORT is not set
372# CONFIG_SERIO_CT82C710 is not set
373# CONFIG_SERIO_PCIPS2 is not set
374
375#
376# Input Device Drivers
377#
378# CONFIG_INPUT_KEYBOARD is not set
379# CONFIG_INPUT_MOUSE is not set
380# CONFIG_INPUT_JOYSTICK is not set
381# CONFIG_INPUT_TOUCHSCREEN is not set
382# CONFIG_INPUT_MISC is not set
383
384#
385# Character devices
386#
387# CONFIG_VT is not set
388# CONFIG_SERIAL_NONSTANDARD is not set
389
390#
391# Serial drivers
392#
393CONFIG_SERIAL_8250=y
394CONFIG_SERIAL_8250_CONSOLE=y
395CONFIG_SERIAL_8250_NR_UARTS=4
396# CONFIG_SERIAL_8250_EXTENDED is not set
397
398#
399# Non-8250 serial port support
400#
401CONFIG_SERIAL_CORE=y
402CONFIG_SERIAL_CORE_CONSOLE=y
403CONFIG_UNIX98_PTYS=y
404CONFIG_LEGACY_PTYS=y
405CONFIG_LEGACY_PTY_COUNT=256
406# CONFIG_QIC02_TAPE is not set
407
408#
409# IPMI
410#
411# CONFIG_IPMI_HANDLER is not set
412
413#
414# Watchdog Cards
415#
416# CONFIG_WATCHDOG is not set
417# CONFIG_NVRAM is not set
418# CONFIG_GEN_RTC is not set
419# CONFIG_DTLK is not set
420# CONFIG_R3964 is not set
421# CONFIG_APPLICOM is not set
422
423#
424# Ftape, the floppy tape device driver
425#
426# CONFIG_FTAPE is not set
427# CONFIG_AGP is not set
428# CONFIG_DRM is not set
429# CONFIG_RAW_DRIVER is not set
430
431#
432# I2C support
433#
434# CONFIG_I2C is not set
435
436#
437# Misc devices
438#
439
440#
441# Multimedia devices
442#
443# CONFIG_VIDEO_DEV is not set
444
445#
446# Digital Video Broadcasting Devices
447#
448# CONFIG_DVB is not set
449
450#
451# Graphics support
452#
453# CONFIG_FB is not set
454
455#
456# Sound
457#
458# CONFIG_SOUND is not set
459
460#
461# USB support
462#
463# CONFIG_USB is not set
464
465#
466# USB Gadget Support
467#
468# CONFIG_USB_GADGET is not set
469
470#
471# File systems
472#
473CONFIG_EXT2_FS=y
474# CONFIG_EXT2_FS_XATTR is not set
475# CONFIG_EXT3_FS is not set
476# CONFIG_JBD is not set
477# CONFIG_REISERFS_FS is not set
478# CONFIG_JFS_FS is not set
479# CONFIG_XFS_FS is not set
480# CONFIG_MINIX_FS is not set
481# CONFIG_ROMFS_FS is not set
482# CONFIG_QUOTA is not set
483# CONFIG_AUTOFS_FS is not set
484# CONFIG_AUTOFS4_FS is not set
485
486#
487# CD-ROM/DVD Filesystems
488#
489# CONFIG_ISO9660_FS is not set
490# CONFIG_UDF_FS is not set
491
492#
493# DOS/FAT/NT Filesystems
494#
495# CONFIG_FAT_FS is not set
496# CONFIG_NTFS_FS is not set
497
498#
499# Pseudo filesystems
500#
501CONFIG_PROC_FS=y
502CONFIG_PROC_KCORE=y
503# CONFIG_DEVFS_FS is not set
504# CONFIG_DEVPTS_FS_XATTR is not set
505CONFIG_TMPFS=y
506# CONFIG_HUGETLB_PAGE is not set
507CONFIG_RAMFS=y
508
509#
510# Miscellaneous filesystems
511#
512# CONFIG_ADFS_FS is not set
513# CONFIG_AFFS_FS is not set
514# CONFIG_HFS_FS is not set
515# CONFIG_HFSPLUS_FS is not set
516# CONFIG_BEFS_FS is not set
517# CONFIG_BFS_FS is not set
518# CONFIG_EFS_FS is not set
519# CONFIG_CRAMFS is not set
520# CONFIG_VXFS_FS is not set
521# CONFIG_HPFS_FS is not set
522# CONFIG_QNX4FS_FS is not set
523# CONFIG_SYSV_FS is not set
524# CONFIG_UFS_FS is not set
525
526#
527# Network File Systems
528#
529CONFIG_NFS_FS=y
530# CONFIG_NFS_V3 is not set
531# CONFIG_NFS_V4 is not set
532# CONFIG_NFS_DIRECTIO is not set
533# CONFIG_NFSD is not set
534CONFIG_ROOT_NFS=y
535CONFIG_LOCKD=y
536# CONFIG_EXPORTFS is not set
537CONFIG_SUNRPC=y
538# CONFIG_RPCSEC_GSS_KRB5 is not set
539# CONFIG_SMB_FS is not set
540# CONFIG_CIFS is not set
541# CONFIG_NCP_FS is not set
542# CONFIG_CODA_FS is not set
543# CONFIG_INTERMEZZO_FS is not set
544# CONFIG_AFS_FS is not set
545
546#
547# Partition Types
548#
549CONFIG_PARTITION_ADVANCED=y
550# CONFIG_ACORN_PARTITION is not set
551# CONFIG_OSF_PARTITION is not set
552# CONFIG_AMIGA_PARTITION is not set
553# CONFIG_ATARI_PARTITION is not set
554# CONFIG_MAC_PARTITION is not set
555# CONFIG_MSDOS_PARTITION is not set
556# CONFIG_LDM_PARTITION is not set
557# CONFIG_NEC98_PARTITION is not set
558# CONFIG_SGI_PARTITION is not set
559# CONFIG_ULTRIX_PARTITION is not set
560# CONFIG_SUN_PARTITION is not set
561# CONFIG_EFI_PARTITION is not set
562
563#
564# Native Language Support
565#
566# CONFIG_NLS is not set
567
568#
569# IBM 40x options
570#
571
572#
573# Library routines
574#
575CONFIG_CRC32=y
576
577#
578# Kernel hacking
579#
580# CONFIG_DEBUG_KERNEL is not set
581# CONFIG_SERIAL_TEXT_DEBUG is not set
582CONFIG_PPC_OCP=y
583
584#
585# Security options
586#
587# CONFIG_SECURITY is not set
588
589#
590# Cryptographic options
591#
592# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/cedar_defconfig b/arch/ppc/configs/cedar_defconfig
new file mode 100644
index 000000000000..5de8288a0673
--- /dev/null
+++ b/arch/ppc/configs/cedar_defconfig
@@ -0,0 +1,534 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7
8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12
13#
14# General setup
15#
16CONFIG_SWAP=y
17CONFIG_SYSVIPC=y
18# CONFIG_BSD_PROCESS_ACCT is not set
19CONFIG_SYSCTL=y
20CONFIG_LOG_BUF_SHIFT=14
21CONFIG_EMBEDDED=y
22CONFIG_FUTEX=y
23# CONFIG_EPOLL is not set
24
25#
26# Loadable module support
27#
28CONFIG_MODULES=y
29CONFIG_MODULE_UNLOAD=y
30# CONFIG_MODULE_FORCE_UNLOAD is not set
31CONFIG_OBSOLETE_MODPARM=y
32# CONFIG_MODVERSIONS is not set
33CONFIG_KMOD=y
34
35#
36# Platform support
37#
38CONFIG_PPC=y
39CONFIG_PPC32=y
40# CONFIG_6xx is not set
41CONFIG_40x=y
42# CONFIG_POWER3 is not set
43# CONFIG_8xx is not set
44CONFIG_4xx=y
45
46#
47# IBM 4xx options
48#
49# CONFIG_ASH is not set
50# CONFIG_BEECH is not set
51CONFIG_CEDAR=y
52# CONFIG_CPCI405 is not set
53# CONFIG_EP405 is not set
54# CONFIG_OAK is not set
55# CONFIG_REDWOOD_4 is not set
56# CONFIG_REDWOOD_5 is not set
57# CONFIG_REDWOOD_6 is not set
58# CONFIG_SYCAMORE is not set
59# CONFIG_TIVO is not set
60# CONFIG_WALNUT is not set
61CONFIG_IBM405_ERR77=y
62CONFIG_IBM405_ERR51=y
63CONFIG_IBM_OCP=y
64CONFIG_NP405L=y
65CONFIG_BIOS_FIXUP=y
66CONFIG_IBM_OPENBIOS=y
67# CONFIG_405_DMA is not set
68# CONFIG_PM is not set
69CONFIG_UART0_TTYS0=y
70# CONFIG_UART0_TTYS1 is not set
71CONFIG_NOT_COHERENT_CACHE=y
72# CONFIG_SMP is not set
73# CONFIG_PREEMPT is not set
74# CONFIG_MATH_EMULATION is not set
75# CONFIG_CPU_FREQ is not set
76
77#
78# General setup
79#
80# CONFIG_HIGHMEM is not set
81# CONFIG_PCI is not set
82# CONFIG_PCI_DOMAINS is not set
83# CONFIG_PC_KEYBOARD is not set
84CONFIG_KCORE_ELF=y
85CONFIG_BINFMT_ELF=y
86CONFIG_KERNEL_ELF=y
87# CONFIG_BINFMT_MISC is not set
88# CONFIG_HOTPLUG is not set
89
90#
91# Parallel port support
92#
93# CONFIG_PARPORT is not set
94# CONFIG_CMDLINE_BOOL is not set
95
96#
97# Advanced setup
98#
99# CONFIG_ADVANCED_OPTIONS is not set
100
101#
102# Default settings for advanced configuration options are used
103#
104CONFIG_HIGHMEM_START=0xfe000000
105CONFIG_LOWMEM_SIZE=0x30000000
106CONFIG_KERNEL_START=0xc0000000
107CONFIG_TASK_SIZE=0x80000000
108CONFIG_BOOT_LOAD=0x00400000
109
110#
111# Memory Technology Devices (MTD)
112#
113# CONFIG_MTD is not set
114
115#
116# Plug and Play support
117#
118# CONFIG_PNP is not set
119
120#
121# Block devices
122#
123# CONFIG_BLK_DEV_FD is not set
124CONFIG_BLK_DEV_LOOP=y
125# CONFIG_BLK_DEV_NBD is not set
126CONFIG_BLK_DEV_RAM=y
127CONFIG_BLK_DEV_RAM_SIZE=4096
128CONFIG_BLK_DEV_INITRD=y
129
130#
131# Multi-device support (RAID and LVM)
132#
133# CONFIG_MD is not set
134
135#
136# ATA/IDE/MFM/RLL support
137#
138# CONFIG_IDE is not set
139
140#
141# SCSI support
142#
143# CONFIG_SCSI is not set
144
145#
146# Fusion MPT device support
147#
148
149#
150# I2O device support
151#
152
153#
154# Networking support
155#
156CONFIG_NET=y
157
158#
159# Networking options
160#
161# CONFIG_PACKET is not set
162# CONFIG_NETLINK_DEV is not set
163# CONFIG_NETFILTER is not set
164CONFIG_UNIX=y
165# CONFIG_NET_KEY is not set
166CONFIG_INET=y
167CONFIG_IP_MULTICAST=y
168# CONFIG_IP_ADVANCED_ROUTER is not set
169CONFIG_IP_PNP=y
170CONFIG_IP_PNP_DHCP=y
171CONFIG_IP_PNP_BOOTP=y
172CONFIG_IP_PNP_RARP=y
173# CONFIG_NET_IPIP is not set
174# CONFIG_NET_IPGRE is not set
175# CONFIG_IP_MROUTE is not set
176# CONFIG_ARPD is not set
177# CONFIG_INET_ECN is not set
178CONFIG_SYN_COOKIES=y
179# CONFIG_INET_AH is not set
180# CONFIG_INET_ESP is not set
181# CONFIG_INET_IPCOMP is not set
182# CONFIG_IPV6 is not set
183# CONFIG_XFRM_USER is not set
184
185#
186# SCTP Configuration (EXPERIMENTAL)
187#
188CONFIG_IPV6_SCTP__=y
189# CONFIG_IP_SCTP is not set
190# CONFIG_ATM is not set
191# CONFIG_VLAN_8021Q is not set
192# CONFIG_LLC is not set
193# CONFIG_DECNET is not set
194# CONFIG_BRIDGE is not set
195# CONFIG_X25 is not set
196# CONFIG_LAPB is not set
197# CONFIG_NET_DIVERT is not set
198# CONFIG_ECONET is not set
199# CONFIG_WAN_ROUTER is not set
200# CONFIG_NET_HW_FLOWCONTROL is not set
201
202#
203# QoS and/or fair queueing
204#
205# CONFIG_NET_SCHED is not set
206
207#
208# Network testing
209#
210# CONFIG_NET_PKTGEN is not set
211CONFIG_NETDEVICES=y
212# CONFIG_DUMMY is not set
213# CONFIG_BONDING is not set
214# CONFIG_EQUALIZER is not set
215# CONFIG_TUN is not set
216# CONFIG_ETHERTAP is not set
217
218#
219# Ethernet (10 or 100Mbit)
220#
221# CONFIG_NET_ETHERNET is not set
222
223#
224# Ethernet (1000 Mbit)
225#
226
227#
228# Ethernet (10000 Mbit)
229#
230# CONFIG_PPP is not set
231# CONFIG_SLIP is not set
232
233#
234# Wireless LAN (non-hamradio)
235#
236# CONFIG_NET_RADIO is not set
237
238#
239# Token Ring devices (depends on LLC=y)
240#
241# CONFIG_SHAPER is not set
242
243#
244# Wan interfaces
245#
246# CONFIG_WAN is not set
247
248#
249# Amateur Radio support
250#
251# CONFIG_HAMRADIO is not set
252
253#
254# IrDA (infrared) support
255#
256# CONFIG_IRDA is not set
257
258#
259# ISDN subsystem
260#
261# CONFIG_ISDN_BOOL is not set
262
263#
264# Graphics support
265#
266# CONFIG_FB is not set
267
268#
269# Old CD-ROM drivers (not SCSI, not IDE)
270#
271# CONFIG_CD_NO_IDESCSI is not set
272
273#
274# Input device support
275#
276# CONFIG_INPUT is not set
277
278#
279# Userland interfaces
280#
281
282#
283# Input I/O drivers
284#
285# CONFIG_GAMEPORT is not set
286CONFIG_SOUND_GAMEPORT=y
287# CONFIG_SERIO is not set
288
289#
290# Input Device Drivers
291#
292
293#
294# Macintosh device drivers
295#
296
297#
298# Character devices
299#
300# CONFIG_SERIAL_NONSTANDARD is not set
301
302#
303# Serial drivers
304#
305CONFIG_SERIAL_8250=y
306CONFIG_SERIAL_8250_CONSOLE=y
307# CONFIG_SERIAL_8250_EXTENDED is not set
308
309#
310# Non-8250 serial port support
311#
312CONFIG_SERIAL_CORE=y
313CONFIG_SERIAL_CORE_CONSOLE=y
314CONFIG_UNIX98_PTYS=y
315CONFIG_UNIX98_PTY_COUNT=256
316
317#
318# I2C support
319#
320CONFIG_I2C=y
321# CONFIG_I2C_ALGOBIT is not set
322# CONFIG_I2C_ALGOPCF is not set
323CONFIG_I2C_IBM_OCP_ALGO=y
324CONFIG_I2C_IBM_OCP_ADAP=y
325# CONFIG_I2C_CHARDEV is not set
326
327#
328# I2C Hardware Sensors Mainboard support
329#
330# CONFIG_I2C_AMD756 is not set
331# CONFIG_I2C_AMD8111 is not set
332
333#
334# I2C Hardware Sensors Chip support
335#
336# CONFIG_SENSORS_ADM1021 is not set
337# CONFIG_SENSORS_IT87 is not set
338# CONFIG_SENSORS_LM75 is not set
339# CONFIG_SENSORS_LM85 is not set
340# CONFIG_SENSORS_VIA686A is not set
341# CONFIG_SENSORS_W83781D is not set
342# CONFIG_I2C_SENSOR is not set
343
344#
345# Mice
346#
347# CONFIG_BUSMOUSE is not set
348# CONFIG_QIC02_TAPE is not set
349
350#
351# IPMI
352#
353# CONFIG_IPMI_HANDLER is not set
354
355#
356# Watchdog Cards
357#
358CONFIG_WATCHDOG=y
359# CONFIG_WATCHDOG_NOWAYOUT is not set
360# CONFIG_SOFT_WATCHDOG is not set
361# CONFIG_WDT is not set
362# CONFIG_WDTPCI is not set
363# CONFIG_PCWATCHDOG is not set
364# CONFIG_ACQUIRE_WDT is not set
365# CONFIG_ADVANTECH_WDT is not set
366# CONFIG_EUROTECH_WDT is not set
367# CONFIG_IB700_WDT is not set
368# CONFIG_MIXCOMWD is not set
369# CONFIG_SCx200_WDT is not set
370# CONFIG_60XX_WDT is not set
371# CONFIG_W83877F_WDT is not set
372# CONFIG_MACHZ_WDT is not set
373# CONFIG_SC520_WDT is not set
374# CONFIG_AMD7XX_TCO is not set
375# CONFIG_ALIM7101_WDT is not set
376# CONFIG_SC1200_WDT is not set
377# CONFIG_WAFER_WDT is not set
378# CONFIG_CPU5_WDT is not set
379# CONFIG_NVRAM is not set
380# CONFIG_GEN_RTC is not set
381# CONFIG_DTLK is not set
382# CONFIG_R3964 is not set
383# CONFIG_APPLICOM is not set
384
385#
386# Ftape, the floppy tape device driver
387#
388# CONFIG_FTAPE is not set
389# CONFIG_AGP is not set
390# CONFIG_DRM is not set
391# CONFIG_RAW_DRIVER is not set
392# CONFIG_HANGCHECK_TIMER is not set
393
394#
395# Multimedia devices
396#
397# CONFIG_VIDEO_DEV is not set
398
399#
400# Digital Video Broadcasting Devices
401#
402# CONFIG_DVB is not set
403
404#
405# File systems
406#
407CONFIG_EXT2_FS=y
408# CONFIG_EXT2_FS_XATTR is not set
409# CONFIG_EXT3_FS is not set
410# CONFIG_JBD is not set
411# CONFIG_REISERFS_FS is not set
412# CONFIG_JFS_FS is not set
413# CONFIG_XFS_FS is not set
414# CONFIG_MINIX_FS is not set
415# CONFIG_ROMFS_FS is not set
416# CONFIG_QUOTA is not set
417# CONFIG_AUTOFS_FS is not set
418# CONFIG_AUTOFS4_FS is not set
419
420#
421# CD-ROM/DVD Filesystems
422#
423# CONFIG_ISO9660_FS is not set
424# CONFIG_UDF_FS is not set
425
426#
427# DOS/FAT/NT Filesystems
428#
429# CONFIG_FAT_FS is not set
430# CONFIG_NTFS_FS is not set
431
432#
433# Pseudo filesystems
434#
435CONFIG_PROC_FS=y
436# CONFIG_DEVFS_FS is not set
437CONFIG_DEVPTS_FS=y
438# CONFIG_DEVPTS_FS_XATTR is not set
439CONFIG_TMPFS=y
440CONFIG_RAMFS=y
441
442#
443# Miscellaneous filesystems
444#
445# CONFIG_ADFS_FS is not set
446# CONFIG_AFFS_FS is not set
447# CONFIG_HFS_FS is not set
448# CONFIG_BEFS_FS is not set
449# CONFIG_BFS_FS is not set
450# CONFIG_EFS_FS is not set
451# CONFIG_CRAMFS is not set
452# CONFIG_VXFS_FS is not set
453# CONFIG_HPFS_FS is not set
454# CONFIG_QNX4FS_FS is not set
455# CONFIG_SYSV_FS is not set
456# CONFIG_UFS_FS is not set
457
458#
459# Network File Systems
460#
461CONFIG_NFS_FS=y
462# CONFIG_NFS_V3 is not set
463# CONFIG_NFS_V4 is not set
464# CONFIG_NFSD is not set
465CONFIG_ROOT_NFS=y
466CONFIG_LOCKD=y
467# CONFIG_EXPORTFS is not set
468CONFIG_SUNRPC=y
469# CONFIG_SUNRPC_GSS is not set
470# CONFIG_SMB_FS is not set
471# CONFIG_CIFS is not set
472# CONFIG_NCP_FS is not set
473# CONFIG_CODA_FS is not set
474# CONFIG_INTERMEZZO_FS is not set
475# CONFIG_AFS_FS is not set
476
477#
478# Partition Types
479#
480CONFIG_PARTITION_ADVANCED=y
481# CONFIG_ACORN_PARTITION is not set
482# CONFIG_OSF_PARTITION is not set
483# CONFIG_AMIGA_PARTITION is not set
484# CONFIG_ATARI_PARTITION is not set
485# CONFIG_MAC_PARTITION is not set
486# CONFIG_MSDOS_PARTITION is not set
487# CONFIG_LDM_PARTITION is not set
488# CONFIG_NEC98_PARTITION is not set
489# CONFIG_SGI_PARTITION is not set
490# CONFIG_ULTRIX_PARTITION is not set
491# CONFIG_SUN_PARTITION is not set
492# CONFIG_EFI_PARTITION is not set
493
494#
495# Sound
496#
497# CONFIG_SOUND is not set
498
499#
500# IBM 40x options
501#
502
503#
504# USB support
505#
506# CONFIG_USB_GADGET is not set
507
508#
509# Bluetooth support
510#
511# CONFIG_BT is not set
512
513#
514# Library routines
515#
516CONFIG_CRC32=y
517
518#
519# Kernel hacking
520#
521# CONFIG_DEBUG_KERNEL is not set
522# CONFIG_KALLSYMS is not set
523# CONFIG_SERIAL_TEXT_DEBUG is not set
524CONFIG_OCP=y
525
526#
527# Security options
528#
529# CONFIG_SECURITY is not set
530
531#
532# Cryptographic options
533#
534# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/chestnut_defconfig b/arch/ppc/configs/chestnut_defconfig
new file mode 100644
index 000000000000..e219aad4d0e3
--- /dev/null
+++ b/arch/ppc/configs/chestnut_defconfig
@@ -0,0 +1,794 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11
4# Fri Mar 11 14:32:49 2005
5#
6CONFIG_MMU=y
7CONFIG_GENERIC_HARDIRQS=y
8CONFIG_RWSEM_XCHGADD_ALGORITHM=y
9CONFIG_GENERIC_CALIBRATE_DELAY=y
10CONFIG_HAVE_DEC_LOCK=y
11CONFIG_PPC=y
12CONFIG_PPC32=y
13CONFIG_GENERIC_NVRAM=y
14
15#
16# Code maturity level options
17#
18CONFIG_EXPERIMENTAL=y
19CONFIG_CLEAN_COMPILE=y
20CONFIG_BROKEN_ON_SMP=y
21
22#
23# General setup
24#
25CONFIG_LOCALVERSION=""
26CONFIG_SWAP=y
27CONFIG_SYSVIPC=y
28# CONFIG_POSIX_MQUEUE is not set
29# CONFIG_BSD_PROCESS_ACCT is not set
30CONFIG_SYSCTL=y
31# CONFIG_AUDIT is not set
32CONFIG_LOG_BUF_SHIFT=14
33# CONFIG_HOTPLUG is not set
34CONFIG_KOBJECT_UEVENT=y
35# CONFIG_IKCONFIG is not set
36# CONFIG_EMBEDDED is not set
37CONFIG_KALLSYMS=y
38# CONFIG_KALLSYMS_EXTRA_PASS is not set
39CONFIG_BASE_FULL=y
40CONFIG_FUTEX=y
41CONFIG_EPOLL=y
42# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
43CONFIG_SHMEM=y
44CONFIG_CC_ALIGN_FUNCTIONS=0
45CONFIG_CC_ALIGN_LABELS=0
46CONFIG_CC_ALIGN_LOOPS=0
47CONFIG_CC_ALIGN_JUMPS=0
48# CONFIG_TINY_SHMEM is not set
49CONFIG_BASE_SMALL=0
50
51#
52# Loadable module support
53#
54CONFIG_MODULES=y
55CONFIG_MODULE_UNLOAD=y
56# CONFIG_MODULE_FORCE_UNLOAD is not set
57CONFIG_OBSOLETE_MODPARM=y
58# CONFIG_MODVERSIONS is not set
59# CONFIG_MODULE_SRCVERSION_ALL is not set
60CONFIG_KMOD=y
61
62#
63# Processor
64#
65CONFIG_6xx=y
66# CONFIG_40x is not set
67# CONFIG_44x is not set
68# CONFIG_POWER3 is not set
69# CONFIG_POWER4 is not set
70# CONFIG_8xx is not set
71# CONFIG_E500 is not set
72CONFIG_ALTIVEC=y
73# CONFIG_TAU is not set
74# CONFIG_CPU_FREQ is not set
75CONFIG_PPC_GEN550=y
76CONFIG_PPC_STD_MMU=y
77CONFIG_NOT_COHERENT_CACHE=y
78
79#
80# Platform options
81#
82# CONFIG_PPC_MULTIPLATFORM is not set
83# CONFIG_APUS is not set
84# CONFIG_KATANA is not set
85# CONFIG_WILLOW is not set
86# CONFIG_CPCI690 is not set
87# CONFIG_PCORE is not set
88# CONFIG_POWERPMC250 is not set
89CONFIG_CHESTNUT=y
90# CONFIG_SPRUCE is not set
91# CONFIG_EV64260 is not set
92# CONFIG_LOPEC is not set
93# CONFIG_MCPN765 is not set
94# CONFIG_MVME5100 is not set
95# CONFIG_PPLUS is not set
96# CONFIG_PRPMC750 is not set
97# CONFIG_PRPMC800 is not set
98# CONFIG_SANDPOINT is not set
99# CONFIG_RADSTONE_PPC7D is not set
100# CONFIG_ADIR is not set
101# CONFIG_K2 is not set
102# CONFIG_PAL4 is not set
103# CONFIG_GEMINI is not set
104# CONFIG_EST8260 is not set
105# CONFIG_SBC82xx is not set
106# CONFIG_SBS8260 is not set
107# CONFIG_RPX8260 is not set
108# CONFIG_TQM8260 is not set
109# CONFIG_ADS8272 is not set
110# CONFIG_PQ2FADS is not set
111# CONFIG_LITE5200 is not set
112# CONFIG_MPC834x_SYS is not set
113CONFIG_MV64360=y
114CONFIG_MV64X60=y
115
116#
117# Set bridge options
118#
119CONFIG_MV64X60_BASE=0xf1000000
120CONFIG_MV64X60_NEW_BASE=0xf1000000
121# CONFIG_SMP is not set
122# CONFIG_PREEMPT is not set
123# CONFIG_HIGHMEM is not set
124CONFIG_BINFMT_ELF=y
125CONFIG_BINFMT_MISC=y
126CONFIG_CMDLINE_BOOL=y
127CONFIG_CMDLINE="console=ttyS0,115200 ip=on"
128
129#
130# Bus options
131#
132CONFIG_GENERIC_ISA_DMA=y
133CONFIG_PCI=y
134CONFIG_PCI_DOMAINS=y
135CONFIG_PCI_LEGACY_PROC=y
136CONFIG_PCI_NAMES=y
137
138#
139# PCCARD (PCMCIA/CardBus) support
140#
141# CONFIG_PCCARD is not set
142
143#
144# PC-card bridges
145#
146
147#
148# Advanced setup
149#
150CONFIG_ADVANCED_OPTIONS=y
151CONFIG_HIGHMEM_START=0xfe000000
152# CONFIG_LOWMEM_SIZE_BOOL is not set
153CONFIG_LOWMEM_SIZE=0x30000000
154# CONFIG_KERNEL_START_BOOL is not set
155CONFIG_KERNEL_START=0xc0000000
156# CONFIG_TASK_SIZE_BOOL is not set
157CONFIG_TASK_SIZE=0x80000000
158# CONFIG_CONSISTENT_START_BOOL is not set
159CONFIG_CONSISTENT_START=0xff100000
160# CONFIG_CONSISTENT_SIZE_BOOL is not set
161CONFIG_CONSISTENT_SIZE=0x00200000
162# CONFIG_BOOT_LOAD_BOOL is not set
163CONFIG_BOOT_LOAD=0x00800000
164
165#
166# Device Drivers
167#
168
169#
170# Generic Driver Options
171#
172CONFIG_STANDALONE=y
173CONFIG_PREVENT_FIRMWARE_BUILD=y
174# CONFIG_FW_LOADER is not set
175
176#
177# Memory Technology Devices (MTD)
178#
179CONFIG_MTD=y
180# CONFIG_MTD_DEBUG is not set
181CONFIG_MTD_PARTITIONS=y
182# CONFIG_MTD_CONCAT is not set
183# CONFIG_MTD_REDBOOT_PARTS is not set
184# CONFIG_MTD_CMDLINE_PARTS is not set
185
186#
187# User Modules And Translation Layers
188#
189CONFIG_MTD_CHAR=y
190CONFIG_MTD_BLOCK=y
191# CONFIG_FTL is not set
192# CONFIG_NFTL is not set
193# CONFIG_INFTL is not set
194
195#
196# RAM/ROM/Flash chip drivers
197#
198CONFIG_MTD_CFI=y
199# CONFIG_MTD_JEDECPROBE is not set
200CONFIG_MTD_GEN_PROBE=y
201# CONFIG_MTD_CFI_ADV_OPTIONS is not set
202# CONFIG_MTD_CFI_NOSWAP is not set
203# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
204# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
205CONFIG_MTD_MAP_BANK_WIDTH_1=y
206CONFIG_MTD_MAP_BANK_WIDTH_2=y
207CONFIG_MTD_MAP_BANK_WIDTH_4=y
208# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
209# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
210# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
211CONFIG_MTD_CFI_I1=y
212CONFIG_MTD_CFI_I2=y
213# CONFIG_MTD_CFI_I4 is not set
214# CONFIG_MTD_CFI_I8 is not set
215CONFIG_MTD_CFI_INTELEXT=y
216# CONFIG_MTD_CFI_AMDSTD is not set
217# CONFIG_MTD_CFI_STAA is not set
218CONFIG_MTD_CFI_UTIL=y
219# CONFIG_MTD_RAM is not set
220# CONFIG_MTD_ROM is not set
221# CONFIG_MTD_ABSENT is not set
222# CONFIG_MTD_XIP is not set
223
224#
225# Mapping drivers for chip access
226#
227# CONFIG_MTD_COMPLEX_MAPPINGS is not set
228CONFIG_MTD_PHYSMAP=y
229CONFIG_MTD_PHYSMAP_START=0xfc000000
230CONFIG_MTD_PHYSMAP_LEN=0x02000000
231CONFIG_MTD_PHYSMAP_BANKWIDTH=4
232
233#
234# Self-contained MTD device drivers
235#
236# CONFIG_MTD_PMC551 is not set
237# CONFIG_MTD_SLRAM is not set
238# CONFIG_MTD_PHRAM is not set
239# CONFIG_MTD_MTDRAM is not set
240# CONFIG_MTD_BLKMTD is not set
241# CONFIG_MTD_BLOCK2MTD is not set
242
243#
244# Disk-On-Chip Device Drivers
245#
246# CONFIG_MTD_DOC2000 is not set
247# CONFIG_MTD_DOC2001 is not set
248# CONFIG_MTD_DOC2001PLUS is not set
249
250#
251# NAND Flash Device Drivers
252#
253# CONFIG_MTD_NAND is not set
254
255#
256# Parallel port support
257#
258# CONFIG_PARPORT is not set
259
260#
261# Plug and Play support
262#
263
264#
265# Block devices
266#
267# CONFIG_BLK_DEV_FD is not set
268# CONFIG_BLK_CPQ_DA is not set
269# CONFIG_BLK_CPQ_CISS_DA is not set
270# CONFIG_BLK_DEV_DAC960 is not set
271# CONFIG_BLK_DEV_UMEM is not set
272# CONFIG_BLK_DEV_COW_COMMON is not set
273CONFIG_BLK_DEV_LOOP=y
274# CONFIG_BLK_DEV_CRYPTOLOOP is not set
275# CONFIG_BLK_DEV_NBD is not set
276# CONFIG_BLK_DEV_SX8 is not set
277CONFIG_BLK_DEV_RAM=y
278CONFIG_BLK_DEV_RAM_COUNT=16
279CONFIG_BLK_DEV_RAM_SIZE=4096
280CONFIG_BLK_DEV_INITRD=y
281CONFIG_INITRAMFS_SOURCE=""
282# CONFIG_LBD is not set
283# CONFIG_CDROM_PKTCDVD is not set
284
285#
286# IO Schedulers
287#
288CONFIG_IOSCHED_NOOP=y
289CONFIG_IOSCHED_AS=y
290CONFIG_IOSCHED_DEADLINE=y
291CONFIG_IOSCHED_CFQ=y
292# CONFIG_ATA_OVER_ETH is not set
293
294#
295# ATA/ATAPI/MFM/RLL support
296#
297# CONFIG_IDE is not set
298
299#
300# SCSI device support
301#
302# CONFIG_SCSI is not set
303
304#
305# Multi-device support (RAID and LVM)
306#
307# CONFIG_MD is not set
308
309#
310# Fusion MPT device support
311#
312
313#
314# IEEE 1394 (FireWire) support
315#
316# CONFIG_IEEE1394 is not set
317
318#
319# I2O device support
320#
321# CONFIG_I2O is not set
322
323#
324# Macintosh device drivers
325#
326
327#
328# Networking support
329#
330CONFIG_NET=y
331
332#
333# Networking options
334#
335CONFIG_PACKET=y
336# CONFIG_PACKET_MMAP is not set
337# CONFIG_NETLINK_DEV is not set
338CONFIG_UNIX=y
339# CONFIG_NET_KEY is not set
340CONFIG_INET=y
341CONFIG_IP_MULTICAST=y
342# CONFIG_IP_ADVANCED_ROUTER is not set
343CONFIG_IP_PNP=y
344CONFIG_IP_PNP_DHCP=y
345# CONFIG_IP_PNP_BOOTP is not set
346# CONFIG_IP_PNP_RARP is not set
347# CONFIG_NET_IPIP is not set
348# CONFIG_NET_IPGRE is not set
349# CONFIG_IP_MROUTE is not set
350# CONFIG_ARPD is not set
351CONFIG_SYN_COOKIES=y
352# CONFIG_INET_AH is not set
353# CONFIG_INET_ESP is not set
354# CONFIG_INET_IPCOMP is not set
355# CONFIG_INET_TUNNEL is not set
356CONFIG_IP_TCPDIAG=y
357# CONFIG_IP_TCPDIAG_IPV6 is not set
358# CONFIG_IPV6 is not set
359# CONFIG_NETFILTER is not set
360
361#
362# SCTP Configuration (EXPERIMENTAL)
363#
364# CONFIG_IP_SCTP is not set
365# CONFIG_ATM is not set
366# CONFIG_BRIDGE is not set
367# CONFIG_VLAN_8021Q is not set
368# CONFIG_DECNET is not set
369# CONFIG_LLC2 is not set
370# CONFIG_IPX is not set
371# CONFIG_ATALK is not set
372# CONFIG_X25 is not set
373# CONFIG_LAPB is not set
374# CONFIG_NET_DIVERT is not set
375# CONFIG_ECONET is not set
376# CONFIG_WAN_ROUTER is not set
377
378#
379# QoS and/or fair queueing
380#
381# CONFIG_NET_SCHED is not set
382# CONFIG_NET_CLS_ROUTE is not set
383
384#
385# Network testing
386#
387# CONFIG_NET_PKTGEN is not set
388# CONFIG_NETPOLL is not set
389# CONFIG_NET_POLL_CONTROLLER is not set
390# CONFIG_HAMRADIO is not set
391# CONFIG_IRDA is not set
392# CONFIG_BT is not set
393CONFIG_NETDEVICES=y
394# CONFIG_DUMMY is not set
395# CONFIG_BONDING is not set
396# CONFIG_EQUALIZER is not set
397# CONFIG_TUN is not set
398
399#
400# ARCnet devices
401#
402# CONFIG_ARCNET is not set
403
404#
405# Ethernet (10 or 100Mbit)
406#
407CONFIG_NET_ETHERNET=y
408CONFIG_MII=y
409# CONFIG_HAPPYMEAL is not set
410# CONFIG_SUNGEM is not set
411# CONFIG_NET_VENDOR_3COM is not set
412
413#
414# Tulip family network device support
415#
416CONFIG_NET_TULIP=y
417# CONFIG_DE2104X is not set
418CONFIG_TULIP=y
419# CONFIG_TULIP_MWI is not set
420CONFIG_TULIP_MMIO=y
421# CONFIG_TULIP_NAPI is not set
422# CONFIG_DE4X5 is not set
423# CONFIG_WINBOND_840 is not set
424# CONFIG_DM9102 is not set
425# CONFIG_HP100 is not set
426CONFIG_NET_PCI=y
427# CONFIG_PCNET32 is not set
428# CONFIG_AMD8111_ETH is not set
429# CONFIG_ADAPTEC_STARFIRE is not set
430# CONFIG_B44 is not set
431# CONFIG_FORCEDETH is not set
432# CONFIG_DGRS is not set
433# CONFIG_EEPRO100 is not set
434CONFIG_E100=y
435# CONFIG_FEALNX is not set
436# CONFIG_NATSEMI is not set
437# CONFIG_NE2K_PCI is not set
438# CONFIG_8139CP is not set
439# CONFIG_8139TOO is not set
440# CONFIG_SIS900 is not set
441# CONFIG_EPIC100 is not set
442# CONFIG_SUNDANCE is not set
443# CONFIG_TLAN is not set
444# CONFIG_VIA_RHINE is not set
445
446#
447# Ethernet (1000 Mbit)
448#
449# CONFIG_ACENIC is not set
450# CONFIG_DL2K is not set
451# CONFIG_E1000 is not set
452# CONFIG_NS83820 is not set
453# CONFIG_HAMACHI is not set
454# CONFIG_YELLOWFIN is not set
455# CONFIG_R8169 is not set
456# CONFIG_SK98LIN is not set
457# CONFIG_VIA_VELOCITY is not set
458# CONFIG_TIGON3 is not set
459CONFIG_MV643XX_ETH=y
460CONFIG_MV643XX_ETH_0=y
461CONFIG_MV643XX_ETH_1=y
462# CONFIG_MV643XX_ETH_2 is not set
463
464#
465# Ethernet (10000 Mbit)
466#
467# CONFIG_IXGB is not set
468# CONFIG_S2IO is not set
469
470#
471# Token Ring devices
472#
473# CONFIG_TR is not set
474
475#
476# Wireless LAN (non-hamradio)
477#
478# CONFIG_NET_RADIO is not set
479
480#
481# Wan interfaces
482#
483# CONFIG_WAN is not set
484# CONFIG_FDDI is not set
485# CONFIG_HIPPI is not set
486# CONFIG_PPP is not set
487# CONFIG_SLIP is not set
488# CONFIG_SHAPER is not set
489# CONFIG_NETCONSOLE is not set
490
491#
492# ISDN subsystem
493#
494# CONFIG_ISDN is not set
495
496#
497# Telephony Support
498#
499# CONFIG_PHONE is not set
500
501#
502# Input device support
503#
504CONFIG_INPUT=y
505
506#
507# Userland interfaces
508#
509CONFIG_INPUT_MOUSEDEV=y
510CONFIG_INPUT_MOUSEDEV_PSAUX=y
511CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
512CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
513# CONFIG_INPUT_JOYDEV is not set
514# CONFIG_INPUT_TSDEV is not set
515# CONFIG_INPUT_EVDEV is not set
516# CONFIG_INPUT_EVBUG is not set
517
518#
519# Input Device Drivers
520#
521# CONFIG_INPUT_KEYBOARD is not set
522# CONFIG_INPUT_MOUSE is not set
523# CONFIG_INPUT_JOYSTICK is not set
524# CONFIG_INPUT_TOUCHSCREEN is not set
525# CONFIG_INPUT_MISC is not set
526
527#
528# Hardware I/O ports
529#
530# CONFIG_SERIO is not set
531# CONFIG_GAMEPORT is not set
532CONFIG_SOUND_GAMEPORT=y
533
534#
535# Character devices
536#
537CONFIG_VT=y
538CONFIG_VT_CONSOLE=y
539CONFIG_HW_CONSOLE=y
540# CONFIG_SERIAL_NONSTANDARD is not set
541
542#
543# Serial drivers
544#
545CONFIG_SERIAL_8250=y
546CONFIG_SERIAL_8250_CONSOLE=y
547CONFIG_SERIAL_8250_NR_UARTS=2
548# CONFIG_SERIAL_8250_EXTENDED is not set
549
550#
551# Non-8250 serial port support
552#
553# CONFIG_SERIAL_MPSC is not set
554CONFIG_SERIAL_CORE=y
555CONFIG_SERIAL_CORE_CONSOLE=y
556CONFIG_UNIX98_PTYS=y
557CONFIG_LEGACY_PTYS=y
558CONFIG_LEGACY_PTY_COUNT=256
559
560#
561# IPMI
562#
563# CONFIG_IPMI_HANDLER is not set
564
565#
566# Watchdog Cards
567#
568# CONFIG_WATCHDOG is not set
569# CONFIG_NVRAM is not set
570CONFIG_GEN_RTC=y
571# CONFIG_GEN_RTC_X is not set
572# CONFIG_DTLK is not set
573# CONFIG_R3964 is not set
574# CONFIG_APPLICOM is not set
575
576#
577# Ftape, the floppy tape device driver
578#
579# CONFIG_AGP is not set
580# CONFIG_DRM is not set
581# CONFIG_RAW_DRIVER is not set
582
583#
584# TPM devices
585#
586# CONFIG_TCG_TPM is not set
587
588#
589# I2C support
590#
591# CONFIG_I2C is not set
592
593#
594# Dallas's 1-wire bus
595#
596# CONFIG_W1 is not set
597
598#
599# Misc devices
600#
601
602#
603# Multimedia devices
604#
605# CONFIG_VIDEO_DEV is not set
606
607#
608# Digital Video Broadcasting Devices
609#
610# CONFIG_DVB is not set
611
612#
613# Graphics support
614#
615# CONFIG_FB is not set
616
617#
618# Console display driver support
619#
620# CONFIG_VGA_CONSOLE is not set
621CONFIG_DUMMY_CONSOLE=y
622
623#
624# Sound
625#
626# CONFIG_SOUND is not set
627
628#
629# USB support
630#
631# CONFIG_USB is not set
632CONFIG_USB_ARCH_HAS_HCD=y
633CONFIG_USB_ARCH_HAS_OHCI=y
634
635#
636# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
637#
638
639#
640# USB Gadget Support
641#
642# CONFIG_USB_GADGET is not set
643
644#
645# MMC/SD Card support
646#
647# CONFIG_MMC is not set
648
649#
650# InfiniBand support
651#
652# CONFIG_INFINIBAND is not set
653
654#
655# File systems
656#
657CONFIG_EXT2_FS=y
658# CONFIG_EXT2_FS_XATTR is not set
659# CONFIG_EXT3_FS is not set
660# CONFIG_JBD is not set
661# CONFIG_REISERFS_FS is not set
662# CONFIG_JFS_FS is not set
663
664#
665# XFS support
666#
667# CONFIG_XFS_FS is not set
668# CONFIG_MINIX_FS is not set
669# CONFIG_ROMFS_FS is not set
670# CONFIG_QUOTA is not set
671CONFIG_DNOTIFY=y
672# CONFIG_AUTOFS_FS is not set
673# CONFIG_AUTOFS4_FS is not set
674
675#
676# CD-ROM/DVD Filesystems
677#
678# CONFIG_ISO9660_FS is not set
679# CONFIG_UDF_FS is not set
680
681#
682# DOS/FAT/NT Filesystems
683#
684# CONFIG_MSDOS_FS is not set
685# CONFIG_VFAT_FS is not set
686# CONFIG_NTFS_FS is not set
687
688#
689# Pseudo filesystems
690#
691CONFIG_PROC_FS=y
692CONFIG_PROC_KCORE=y
693CONFIG_SYSFS=y
694CONFIG_DEVFS_FS=y
695CONFIG_DEVFS_MOUNT=y
696# CONFIG_DEVFS_DEBUG is not set
697# CONFIG_DEVPTS_FS_XATTR is not set
698CONFIG_TMPFS=y
699# CONFIG_TMPFS_XATTR is not set
700# CONFIG_HUGETLB_PAGE is not set
701CONFIG_RAMFS=y
702
703#
704# Miscellaneous filesystems
705#
706# CONFIG_ADFS_FS is not set
707# CONFIG_AFFS_FS is not set
708# CONFIG_HFS_FS is not set
709# CONFIG_HFSPLUS_FS is not set
710# CONFIG_BEFS_FS is not set
711# CONFIG_BFS_FS is not set
712# CONFIG_EFS_FS is not set
713# CONFIG_JFFS_FS is not set
714CONFIG_JFFS2_FS=y
715CONFIG_JFFS2_FS_DEBUG=0
716# CONFIG_JFFS2_FS_NAND is not set
717# CONFIG_JFFS2_FS_NOR_ECC is not set
718# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
719CONFIG_JFFS2_ZLIB=y
720CONFIG_JFFS2_RTIME=y
721# CONFIG_JFFS2_RUBIN is not set
722# CONFIG_CRAMFS is not set
723# CONFIG_VXFS_FS is not set
724# CONFIG_HPFS_FS is not set
725# CONFIG_QNX4FS_FS is not set
726# CONFIG_SYSV_FS is not set
727# CONFIG_UFS_FS is not set
728
729#
730# Network File Systems
731#
732CONFIG_NFS_FS=y
733CONFIG_NFS_V3=y
734# CONFIG_NFS_V4 is not set
735# CONFIG_NFS_DIRECTIO is not set
736# CONFIG_NFSD is not set
737CONFIG_ROOT_NFS=y
738CONFIG_LOCKD=y
739CONFIG_LOCKD_V4=y
740CONFIG_SUNRPC=y
741# CONFIG_RPCSEC_GSS_KRB5 is not set
742# CONFIG_RPCSEC_GSS_SPKM3 is not set
743# CONFIG_SMB_FS is not set
744# CONFIG_CIFS is not set
745# CONFIG_NCP_FS is not set
746# CONFIG_CODA_FS is not set
747# CONFIG_AFS_FS is not set
748
749#
750# Partition Types
751#
752# CONFIG_PARTITION_ADVANCED is not set
753CONFIG_MSDOS_PARTITION=y
754
755#
756# Native Language Support
757#
758# CONFIG_NLS is not set
759
760#
761# Library routines
762#
763# CONFIG_CRC_CCITT is not set
764CONFIG_CRC32=y
765# CONFIG_LIBCRC32C is not set
766CONFIG_ZLIB_INFLATE=y
767CONFIG_ZLIB_DEFLATE=y
768
769#
770# Profiling support
771#
772# CONFIG_PROFILING is not set
773
774#
775# Kernel hacking
776#
777# CONFIG_DEBUG_KERNEL is not set
778# CONFIG_PRINTK_TIME is not set
779# CONFIG_SERIAL_TEXT_DEBUG is not set
780
781#
782# Security options
783#
784# CONFIG_KEYS is not set
785# CONFIG_SECURITY is not set
786
787#
788# Cryptographic options
789#
790# CONFIG_CRYPTO is not set
791
792#
793# Hardware crypto devices
794#
diff --git a/arch/ppc/configs/common_defconfig b/arch/ppc/configs/common_defconfig
new file mode 100644
index 000000000000..95ead3f1b1cf
--- /dev/null
+++ b/arch/ppc/configs/common_defconfig
@@ -0,0 +1,1421 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.10-rc2
4# Thu Nov 18 08:22:35 2004
5#
6CONFIG_MMU=y
7CONFIG_GENERIC_HARDIRQS=y
8CONFIG_RWSEM_XCHGADD_ALGORITHM=y
9CONFIG_HAVE_DEC_LOCK=y
10CONFIG_PPC=y
11CONFIG_PPC32=y
12CONFIG_GENERIC_NVRAM=y
13
14#
15# Code maturity level options
16#
17CONFIG_EXPERIMENTAL=y
18CONFIG_CLEAN_COMPILE=y
19CONFIG_BROKEN_ON_SMP=y
20
21#
22# General setup
23#
24CONFIG_LOCALVERSION=""
25CONFIG_SWAP=y
26CONFIG_SYSVIPC=y
27CONFIG_POSIX_MQUEUE=y
28# CONFIG_BSD_PROCESS_ACCT is not set
29CONFIG_SYSCTL=y
30# CONFIG_AUDIT is not set
31CONFIG_LOG_BUF_SHIFT=14
32CONFIG_HOTPLUG=y
33CONFIG_KOBJECT_UEVENT=y
34CONFIG_IKCONFIG=y
35CONFIG_IKCONFIG_PROC=y
36# CONFIG_EMBEDDED is not set
37CONFIG_KALLSYMS=y
38# CONFIG_KALLSYMS_EXTRA_PASS is not set
39CONFIG_FUTEX=y
40CONFIG_EPOLL=y
41# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
42CONFIG_SHMEM=y
43CONFIG_CC_ALIGN_FUNCTIONS=0
44CONFIG_CC_ALIGN_LABELS=0
45CONFIG_CC_ALIGN_LOOPS=0
46CONFIG_CC_ALIGN_JUMPS=0
47# CONFIG_TINY_SHMEM is not set
48
49#
50# Loadable module support
51#
52CONFIG_MODULES=y
53CONFIG_MODULE_UNLOAD=y
54CONFIG_MODULE_FORCE_UNLOAD=y
55CONFIG_OBSOLETE_MODPARM=y
56CONFIG_MODVERSIONS=y
57# CONFIG_MODULE_SRCVERSION_ALL is not set
58CONFIG_KMOD=y
59
60#
61# Processor
62#
63CONFIG_6xx=y
64# CONFIG_40x is not set
65# CONFIG_44x is not set
66# CONFIG_POWER3 is not set
67# CONFIG_POWER4 is not set
68# CONFIG_8xx is not set
69# CONFIG_E500 is not set
70CONFIG_ALTIVEC=y
71CONFIG_TAU=y
72# CONFIG_TAU_INT is not set
73# CONFIG_TAU_AVERAGE is not set
74CONFIG_CPU_FREQ=y
75# CONFIG_CPU_FREQ_DEBUG is not set
76CONFIG_CPU_FREQ_PROC_INTF=y
77CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
78# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
79CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
80# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set
81# CONFIG_CPU_FREQ_GOV_USERSPACE is not set
82# CONFIG_CPU_FREQ_GOV_ONDEMAND is not set
83CONFIG_CPU_FREQ_PMAC=y
84CONFIG_CPU_FREQ_TABLE=y
85CONFIG_PPC601_SYNC_FIX=y
86CONFIG_PM=y
87CONFIG_PPC_STD_MMU=y
88
89#
90# Platform options
91#
92CONFIG_PPC_MULTIPLATFORM=y
93# CONFIG_APUS is not set
94# CONFIG_WILLOW is not set
95# CONFIG_PCORE is not set
96# CONFIG_POWERPMC250 is not set
97# CONFIG_EV64260 is not set
98# CONFIG_SPRUCE is not set
99# CONFIG_LOPEC is not set
100# CONFIG_MCPN765 is not set
101# CONFIG_MVME5100 is not set
102# CONFIG_PPLUS is not set
103# CONFIG_PRPMC750 is not set
104# CONFIG_PRPMC800 is not set
105# CONFIG_SANDPOINT is not set
106# CONFIG_ADIR is not set
107# CONFIG_K2 is not set
108# CONFIG_PAL4 is not set
109# CONFIG_GEMINI is not set
110# CONFIG_EST8260 is not set
111# CONFIG_SBC82xx is not set
112# CONFIG_SBS8260 is not set
113# CONFIG_RPX8260 is not set
114# CONFIG_TQM8260 is not set
115# CONFIG_ADS8272 is not set
116# CONFIG_LITE5200 is not set
117CONFIG_PPC_CHRP=y
118CONFIG_PPC_PMAC=y
119CONFIG_PPC_PREP=y
120CONFIG_PPC_OF=y
121CONFIG_PPCBUG_NVRAM=y
122# CONFIG_SMP is not set
123# CONFIG_PREEMPT is not set
124# CONFIG_HIGHMEM is not set
125CONFIG_BINFMT_ELF=y
126CONFIG_BINFMT_MISC=m
127CONFIG_PROC_DEVICETREE=y
128CONFIG_PREP_RESIDUAL=y
129CONFIG_PROC_PREPRESIDUAL=y
130CONFIG_CMDLINE_BOOL=y
131CONFIG_CMDLINE="console=ttyS0,9600 console=tty0 root=/dev/sda2"
132
133#
134# Bus options
135#
136CONFIG_ISA=y
137CONFIG_GENERIC_ISA_DMA=y
138CONFIG_PCI=y
139CONFIG_PCI_DOMAINS=y
140CONFIG_PCI_LEGACY_PROC=y
141CONFIG_PCI_NAMES=y
142
143#
144# PCCARD (PCMCIA/CardBus) support
145#
146# CONFIG_PCCARD is not set
147
148#
149# PC-card bridges
150#
151CONFIG_PCMCIA_PROBE=y
152
153#
154# Advanced setup
155#
156# CONFIG_ADVANCED_OPTIONS is not set
157
158#
159# Default settings for advanced configuration options are used
160#
161CONFIG_HIGHMEM_START=0xfe000000
162CONFIG_LOWMEM_SIZE=0x30000000
163CONFIG_KERNEL_START=0xc0000000
164CONFIG_TASK_SIZE=0x80000000
165CONFIG_BOOT_LOAD=0x00800000
166
167#
168# Device Drivers
169#
170
171#
172# Generic Driver Options
173#
174# CONFIG_STANDALONE is not set
175CONFIG_PREVENT_FIRMWARE_BUILD=y
176# CONFIG_FW_LOADER is not set
177
178#
179# Memory Technology Devices (MTD)
180#
181# CONFIG_MTD is not set
182
183#
184# Parallel port support
185#
186# CONFIG_PARPORT is not set
187
188#
189# Plug and Play support
190#
191# CONFIG_PNP is not set
192
193#
194# Block devices
195#
196CONFIG_BLK_DEV_FD=m
197# CONFIG_MAC_FLOPPY is not set
198# CONFIG_BLK_DEV_XD is not set
199# CONFIG_BLK_CPQ_DA is not set
200# CONFIG_BLK_CPQ_CISS_DA is not set
201# CONFIG_BLK_DEV_DAC960 is not set
202# CONFIG_BLK_DEV_UMEM is not set
203CONFIG_BLK_DEV_LOOP=y
204# CONFIG_BLK_DEV_CRYPTOLOOP is not set
205# CONFIG_BLK_DEV_NBD is not set
206# CONFIG_BLK_DEV_SX8 is not set
207# CONFIG_BLK_DEV_UB is not set
208CONFIG_BLK_DEV_RAM=y
209CONFIG_BLK_DEV_RAM_SIZE=4096
210CONFIG_BLK_DEV_INITRD=y
211CONFIG_INITRAMFS_SOURCE=""
212CONFIG_LBD=y
213# CONFIG_CDROM_PKTCDVD is not set
214
215#
216# IO Schedulers
217#
218CONFIG_IOSCHED_NOOP=y
219CONFIG_IOSCHED_AS=y
220CONFIG_IOSCHED_DEADLINE=y
221CONFIG_IOSCHED_CFQ=y
222
223#
224# ATA/ATAPI/MFM/RLL support
225#
226CONFIG_IDE=y
227CONFIG_BLK_DEV_IDE=y
228
229#
230# Please see Documentation/ide.txt for help/info on IDE drives
231#
232# CONFIG_BLK_DEV_IDE_SATA is not set
233CONFIG_BLK_DEV_IDEDISK=y
234# CONFIG_IDEDISK_MULTI_MODE is not set
235CONFIG_BLK_DEV_IDECD=y
236# CONFIG_BLK_DEV_IDETAPE is not set
237CONFIG_BLK_DEV_IDEFLOPPY=y
238CONFIG_BLK_DEV_IDESCSI=y
239# CONFIG_IDE_TASK_IOCTL is not set
240
241#
242# IDE chipset support/bugfixes
243#
244CONFIG_IDE_GENERIC=y
245CONFIG_BLK_DEV_IDEPCI=y
246CONFIG_IDEPCI_SHARE_IRQ=y
247# CONFIG_BLK_DEV_OFFBOARD is not set
248CONFIG_BLK_DEV_GENERIC=y
249# CONFIG_BLK_DEV_OPTI621 is not set
250CONFIG_BLK_DEV_SL82C105=y
251CONFIG_BLK_DEV_IDEDMA_PCI=y
252# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
253CONFIG_IDEDMA_PCI_AUTO=y
254# CONFIG_IDEDMA_ONLYDISK is not set
255# CONFIG_BLK_DEV_AEC62XX is not set
256# CONFIG_BLK_DEV_ALI15X3 is not set
257# CONFIG_BLK_DEV_AMD74XX is not set
258CONFIG_BLK_DEV_CMD64X=y
259# CONFIG_BLK_DEV_TRIFLEX is not set
260# CONFIG_BLK_DEV_CY82C693 is not set
261# CONFIG_BLK_DEV_CS5520 is not set
262# CONFIG_BLK_DEV_CS5530 is not set
263# CONFIG_BLK_DEV_HPT34X is not set
264# CONFIG_BLK_DEV_HPT366 is not set
265# CONFIG_BLK_DEV_SC1200 is not set
266# CONFIG_BLK_DEV_PIIX is not set
267# CONFIG_BLK_DEV_NS87415 is not set
268# CONFIG_BLK_DEV_PDC202XX_OLD is not set
269CONFIG_BLK_DEV_PDC202XX_NEW=y
270# CONFIG_PDC202XX_FORCE is not set
271# CONFIG_BLK_DEV_SVWKS is not set
272# CONFIG_BLK_DEV_SIIMAGE is not set
273# CONFIG_BLK_DEV_SLC90E66 is not set
274# CONFIG_BLK_DEV_TRM290 is not set
275# CONFIG_BLK_DEV_VIA82CXXX is not set
276CONFIG_BLK_DEV_IDE_PMAC=y
277CONFIG_BLK_DEV_IDE_PMAC_ATA100FIRST=y
278CONFIG_BLK_DEV_IDEDMA_PMAC=y
279CONFIG_BLK_DEV_IDE_PMAC_BLINK=y
280# CONFIG_IDE_ARM is not set
281# CONFIG_IDE_CHIPSETS is not set
282CONFIG_BLK_DEV_IDEDMA=y
283# CONFIG_IDEDMA_IVB is not set
284CONFIG_IDEDMA_AUTO=y
285# CONFIG_BLK_DEV_HD is not set
286
287#
288# SCSI device support
289#
290CONFIG_SCSI=y
291CONFIG_SCSI_PROC_FS=y
292
293#
294# SCSI support type (disk, tape, CD-ROM)
295#
296CONFIG_BLK_DEV_SD=y
297CONFIG_CHR_DEV_ST=y
298# CONFIG_CHR_DEV_OSST is not set
299CONFIG_BLK_DEV_SR=y
300CONFIG_BLK_DEV_SR_VENDOR=y
301CONFIG_CHR_DEV_SG=y
302
303#
304# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
305#
306# CONFIG_SCSI_MULTI_LUN is not set
307CONFIG_SCSI_CONSTANTS=y
308# CONFIG_SCSI_LOGGING is not set
309
310#
311# SCSI Transport Attributes
312#
313CONFIG_SCSI_SPI_ATTRS=y
314# CONFIG_SCSI_FC_ATTRS is not set
315
316#
317# SCSI low-level drivers
318#
319# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
320# CONFIG_SCSI_3W_9XXX is not set
321# CONFIG_SCSI_7000FASST is not set
322# CONFIG_SCSI_ACARD is not set
323# CONFIG_SCSI_AHA152X is not set
324# CONFIG_SCSI_AHA1542 is not set
325# CONFIG_SCSI_AACRAID is not set
326CONFIG_SCSI_AIC7XXX=m
327CONFIG_AIC7XXX_CMDS_PER_DEVICE=253
328CONFIG_AIC7XXX_RESET_DELAY_MS=15000
329CONFIG_AIC7XXX_DEBUG_ENABLE=y
330CONFIG_AIC7XXX_DEBUG_MASK=0
331CONFIG_AIC7XXX_REG_PRETTY_PRINT=y
332CONFIG_SCSI_AIC7XXX_OLD=m
333# CONFIG_SCSI_AIC79XX is not set
334# CONFIG_SCSI_DPT_I2O is not set
335# CONFIG_SCSI_IN2000 is not set
336# CONFIG_MEGARAID_NEWGEN is not set
337# CONFIG_MEGARAID_LEGACY is not set
338# CONFIG_SCSI_SATA is not set
339# CONFIG_SCSI_BUSLOGIC is not set
340# CONFIG_SCSI_DMX3191D is not set
341# CONFIG_SCSI_DTC3280 is not set
342# CONFIG_SCSI_EATA is not set
343# CONFIG_SCSI_EATA_PIO is not set
344# CONFIG_SCSI_FUTURE_DOMAIN is not set
345# CONFIG_SCSI_GDTH is not set
346# CONFIG_SCSI_GENERIC_NCR5380 is not set
347# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
348# CONFIG_SCSI_IPS is not set
349# CONFIG_SCSI_INITIO is not set
350# CONFIG_SCSI_INIA100 is not set
351# CONFIG_SCSI_NCR53C406A is not set
352CONFIG_SCSI_SYM53C8XX_2=y
353CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0
354CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
355CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
356# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set
357# CONFIG_SCSI_IPR is not set
358# CONFIG_SCSI_PAS16 is not set
359# CONFIG_SCSI_PSI240I is not set
360# CONFIG_SCSI_QLOGIC_FAS is not set
361# CONFIG_SCSI_QLOGIC_ISP is not set
362# CONFIG_SCSI_QLOGIC_FC is not set
363# CONFIG_SCSI_QLOGIC_1280 is not set
364# CONFIG_SCSI_QLOGIC_1280_1040 is not set
365CONFIG_SCSI_QLA2XXX=y
366# CONFIG_SCSI_QLA21XX is not set
367# CONFIG_SCSI_QLA22XX is not set
368# CONFIG_SCSI_QLA2300 is not set
369# CONFIG_SCSI_QLA2322 is not set
370# CONFIG_SCSI_QLA6312 is not set
371# CONFIG_SCSI_QLA6322 is not set
372# CONFIG_SCSI_SYM53C416 is not set
373# CONFIG_SCSI_DC395x is not set
374# CONFIG_SCSI_DC390T is not set
375# CONFIG_SCSI_T128 is not set
376# CONFIG_SCSI_U14_34F is not set
377# CONFIG_SCSI_NSP32 is not set
378# CONFIG_SCSI_DEBUG is not set
379CONFIG_SCSI_MESH=y
380CONFIG_SCSI_MESH_SYNC_RATE=5
381CONFIG_SCSI_MESH_RESET_DELAY_MS=4000
382CONFIG_SCSI_MAC53C94=y
383
384#
385# Old CD-ROM drivers (not SCSI, not IDE)
386#
387# CONFIG_CD_NO_IDESCSI is not set
388
389#
390# Multi-device support (RAID and LVM)
391#
392# CONFIG_MD is not set
393
394#
395# Fusion MPT device support
396#
397# CONFIG_FUSION is not set
398
399#
400# IEEE 1394 (FireWire) support
401#
402# CONFIG_IEEE1394 is not set
403
404#
405# I2O device support
406#
407# CONFIG_I2O is not set
408
409#
410# Macintosh device drivers
411#
412CONFIG_ADB=y
413CONFIG_ADB_CUDA=y
414CONFIG_ADB_PMU=y
415CONFIG_PMAC_PBOOK=y
416CONFIG_PMAC_APM_EMU=y
417CONFIG_PMAC_BACKLIGHT=y
418CONFIG_ADB_MACIO=y
419CONFIG_INPUT_ADBHID=y
420CONFIG_MAC_EMUMOUSEBTN=y
421CONFIG_THERM_WINDTUNNEL=m
422CONFIG_THERM_ADT746X=m
423# CONFIG_ANSLCD is not set
424
425#
426# Networking support
427#
428CONFIG_NET=y
429
430#
431# Networking options
432#
433CONFIG_PACKET=y
434# CONFIG_PACKET_MMAP is not set
435# CONFIG_NETLINK_DEV is not set
436CONFIG_UNIX=y
437# CONFIG_NET_KEY is not set
438CONFIG_INET=y
439CONFIG_IP_MULTICAST=y
440# CONFIG_IP_ADVANCED_ROUTER is not set
441# CONFIG_IP_PNP is not set
442# CONFIG_NET_IPIP is not set
443# CONFIG_NET_IPGRE is not set
444# CONFIG_IP_MROUTE is not set
445# CONFIG_ARPD is not set
446CONFIG_SYN_COOKIES=y
447# CONFIG_INET_AH is not set
448# CONFIG_INET_ESP is not set
449# CONFIG_INET_IPCOMP is not set
450# CONFIG_INET_TUNNEL is not set
451CONFIG_IP_TCPDIAG=y
452# CONFIG_IP_TCPDIAG_IPV6 is not set
453
454#
455# IP: Virtual Server Configuration
456#
457# CONFIG_IP_VS is not set
458# CONFIG_IPV6 is not set
459CONFIG_NETFILTER=y
460# CONFIG_NETFILTER_DEBUG is not set
461
462#
463# IP: Netfilter Configuration
464#
465CONFIG_IP_NF_CONNTRACK=m
466# CONFIG_IP_NF_CT_ACCT is not set
467# CONFIG_IP_NF_CONNTRACK_MARK is not set
468# CONFIG_IP_NF_CT_PROTO_SCTP is not set
469CONFIG_IP_NF_FTP=m
470CONFIG_IP_NF_IRC=m
471CONFIG_IP_NF_TFTP=m
472CONFIG_IP_NF_AMANDA=m
473# CONFIG_IP_NF_QUEUE is not set
474CONFIG_IP_NF_IPTABLES=m
475CONFIG_IP_NF_MATCH_LIMIT=m
476CONFIG_IP_NF_MATCH_IPRANGE=m
477CONFIG_IP_NF_MATCH_MAC=m
478CONFIG_IP_NF_MATCH_PKTTYPE=m
479CONFIG_IP_NF_MATCH_MARK=m
480CONFIG_IP_NF_MATCH_MULTIPORT=m
481CONFIG_IP_NF_MATCH_TOS=m
482CONFIG_IP_NF_MATCH_RECENT=m
483CONFIG_IP_NF_MATCH_ECN=m
484CONFIG_IP_NF_MATCH_DSCP=m
485CONFIG_IP_NF_MATCH_AH_ESP=m
486CONFIG_IP_NF_MATCH_LENGTH=m
487CONFIG_IP_NF_MATCH_TTL=m
488CONFIG_IP_NF_MATCH_TCPMSS=m
489CONFIG_IP_NF_MATCH_HELPER=m
490CONFIG_IP_NF_MATCH_STATE=m
491CONFIG_IP_NF_MATCH_CONNTRACK=m
492CONFIG_IP_NF_MATCH_OWNER=m
493# CONFIG_IP_NF_MATCH_ADDRTYPE is not set
494# CONFIG_IP_NF_MATCH_REALM is not set
495# CONFIG_IP_NF_MATCH_SCTP is not set
496# CONFIG_IP_NF_MATCH_COMMENT is not set
497# CONFIG_IP_NF_MATCH_HASHLIMIT is not set
498CONFIG_IP_NF_FILTER=m
499CONFIG_IP_NF_TARGET_REJECT=m
500# CONFIG_IP_NF_TARGET_LOG is not set
501CONFIG_IP_NF_TARGET_ULOG=m
502CONFIG_IP_NF_TARGET_TCPMSS=m
503CONFIG_IP_NF_NAT=m
504CONFIG_IP_NF_NAT_NEEDED=y
505CONFIG_IP_NF_TARGET_MASQUERADE=m
506CONFIG_IP_NF_TARGET_REDIRECT=m
507CONFIG_IP_NF_TARGET_NETMAP=m
508CONFIG_IP_NF_TARGET_SAME=m
509CONFIG_IP_NF_NAT_SNMP_BASIC=m
510CONFIG_IP_NF_NAT_IRC=m
511CONFIG_IP_NF_NAT_FTP=m
512CONFIG_IP_NF_NAT_TFTP=m
513CONFIG_IP_NF_NAT_AMANDA=m
514# CONFIG_IP_NF_MANGLE is not set
515CONFIG_IP_NF_RAW=m
516CONFIG_IP_NF_TARGET_NOTRACK=m
517# CONFIG_IP_NF_ARPTABLES is not set
518CONFIG_IP_NF_COMPAT_IPCHAINS=m
519# CONFIG_IP_NF_COMPAT_IPFWADM is not set
520
521#
522# SCTP Configuration (EXPERIMENTAL)
523#
524# CONFIG_IP_SCTP is not set
525# CONFIG_ATM is not set
526# CONFIG_BRIDGE is not set
527# CONFIG_VLAN_8021Q is not set
528# CONFIG_DECNET is not set
529# CONFIG_LLC2 is not set
530# CONFIG_IPX is not set
531# CONFIG_ATALK is not set
532# CONFIG_X25 is not set
533# CONFIG_LAPB is not set
534# CONFIG_NET_DIVERT is not set
535# CONFIG_ECONET is not set
536# CONFIG_WAN_ROUTER is not set
537
538#
539# QoS and/or fair queueing
540#
541# CONFIG_NET_SCHED is not set
542# CONFIG_NET_CLS_ROUTE is not set
543
544#
545# Network testing
546#
547# CONFIG_NET_PKTGEN is not set
548# CONFIG_NETPOLL is not set
549# CONFIG_NET_POLL_CONTROLLER is not set
550# CONFIG_HAMRADIO is not set
551# CONFIG_IRDA is not set
552# CONFIG_BT is not set
553CONFIG_NETDEVICES=y
554# CONFIG_DUMMY is not set
555# CONFIG_BONDING is not set
556# CONFIG_EQUALIZER is not set
557# CONFIG_TUN is not set
558
559#
560# ARCnet devices
561#
562# CONFIG_ARCNET is not set
563
564#
565# Ethernet (10 or 100Mbit)
566#
567CONFIG_NET_ETHERNET=y
568CONFIG_MII=y
569CONFIG_MACE=y
570# CONFIG_MACE_AAUI_PORT is not set
571CONFIG_BMAC=y
572# CONFIG_HAPPYMEAL is not set
573CONFIG_SUNGEM=y
574# CONFIG_NET_VENDOR_3COM is not set
575# CONFIG_LANCE is not set
576# CONFIG_NET_VENDOR_SMC is not set
577# CONFIG_NET_VENDOR_RACAL is not set
578
579#
580# Tulip family network device support
581#
582CONFIG_NET_TULIP=y
583CONFIG_DE2104X=y
584CONFIG_TULIP=y
585# CONFIG_TULIP_MWI is not set
586CONFIG_TULIP_MMIO=y
587# CONFIG_TULIP_NAPI is not set
588CONFIG_DE4X5=m
589# CONFIG_WINBOND_840 is not set
590# CONFIG_DM9102 is not set
591# CONFIG_AT1700 is not set
592# CONFIG_DEPCA is not set
593# CONFIG_HP100 is not set
594# CONFIG_NET_ISA is not set
595CONFIG_NET_PCI=y
596CONFIG_PCNET32=y
597# CONFIG_AMD8111_ETH is not set
598# CONFIG_ADAPTEC_STARFIRE is not set
599# CONFIG_AC3200 is not set
600# CONFIG_APRICOT is not set
601# CONFIG_B44 is not set
602# CONFIG_FORCEDETH is not set
603# CONFIG_CS89x0 is not set
604# CONFIG_DGRS is not set
605# CONFIG_EEPRO100 is not set
606# CONFIG_E100 is not set
607# CONFIG_FEALNX is not set
608# CONFIG_NATSEMI is not set
609# CONFIG_NE2K_PCI is not set
610# CONFIG_8139CP is not set
611# CONFIG_8139TOO is not set
612# CONFIG_SIS900 is not set
613# CONFIG_EPIC100 is not set
614# CONFIG_SUNDANCE is not set
615# CONFIG_TLAN is not set
616# CONFIG_VIA_RHINE is not set
617# CONFIG_NET_POCKET is not set
618
619#
620# Ethernet (1000 Mbit)
621#
622# CONFIG_ACENIC is not set
623# CONFIG_DL2K is not set
624# CONFIG_E1000 is not set
625# CONFIG_NS83820 is not set
626# CONFIG_HAMACHI is not set
627# CONFIG_YELLOWFIN is not set
628# CONFIG_R8169 is not set
629# CONFIG_SK98LIN is not set
630# CONFIG_VIA_VELOCITY is not set
631# CONFIG_TIGON3 is not set
632
633#
634# Ethernet (10000 Mbit)
635#
636# CONFIG_IXGB is not set
637# CONFIG_S2IO is not set
638
639#
640# Token Ring devices
641#
642# CONFIG_TR is not set
643
644#
645# Wireless LAN (non-hamradio)
646#
647CONFIG_NET_RADIO=y
648
649#
650# Obsolete Wireless cards support (pre-802.11)
651#
652# CONFIG_STRIP is not set
653# CONFIG_ARLAN is not set
654# CONFIG_WAVELAN is not set
655
656#
657# Wireless 802.11b ISA/PCI cards support
658#
659# CONFIG_AIRO is not set
660CONFIG_HERMES=m
661CONFIG_APPLE_AIRPORT=m
662# CONFIG_PLX_HERMES is not set
663# CONFIG_TMD_HERMES is not set
664# CONFIG_PCI_HERMES is not set
665# CONFIG_ATMEL is not set
666
667#
668# Prism GT/Duette 802.11(a/b/g) PCI/Cardbus support
669#
670# CONFIG_PRISM54 is not set
671CONFIG_NET_WIRELESS=y
672
673#
674# Wan interfaces
675#
676# CONFIG_WAN is not set
677# CONFIG_FDDI is not set
678# CONFIG_HIPPI is not set
679CONFIG_PPP=y
680CONFIG_PPP_MULTILINK=y
681CONFIG_PPP_FILTER=y
682CONFIG_PPP_ASYNC=y
683# CONFIG_PPP_SYNC_TTY is not set
684CONFIG_PPP_DEFLATE=y
685# CONFIG_PPP_BSDCOMP is not set
686# CONFIG_PPPOE is not set
687# CONFIG_SLIP is not set
688# CONFIG_NET_FC is not set
689# CONFIG_SHAPER is not set
690# CONFIG_NETCONSOLE is not set
691
692#
693# ISDN subsystem
694#
695# CONFIG_ISDN is not set
696
697#
698# Telephony Support
699#
700# CONFIG_PHONE is not set
701
702#
703# Input device support
704#
705CONFIG_INPUT=y
706
707#
708# Userland interfaces
709#
710CONFIG_INPUT_MOUSEDEV=y
711CONFIG_INPUT_MOUSEDEV_PSAUX=y
712CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
713CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
714# CONFIG_INPUT_JOYDEV is not set
715# CONFIG_INPUT_TSDEV is not set
716CONFIG_INPUT_EVDEV=y
717CONFIG_INPUT_EVBUG=m
718
719#
720# Input I/O drivers
721#
722# CONFIG_GAMEPORT is not set
723CONFIG_SOUND_GAMEPORT=y
724CONFIG_SERIO=y
725CONFIG_SERIO_I8042=y
726# CONFIG_SERIO_SERPORT is not set
727# CONFIG_SERIO_CT82C710 is not set
728# CONFIG_SERIO_PCIPS2 is not set
729# CONFIG_SERIO_RAW is not set
730
731#
732# Input Device Drivers
733#
734CONFIG_INPUT_KEYBOARD=y
735CONFIG_KEYBOARD_ATKBD=y
736# CONFIG_KEYBOARD_SUNKBD is not set
737# CONFIG_KEYBOARD_LKKBD is not set
738# CONFIG_KEYBOARD_XTKBD is not set
739# CONFIG_KEYBOARD_NEWTON is not set
740CONFIG_INPUT_MOUSE=y
741CONFIG_MOUSE_PS2=y
742# CONFIG_MOUSE_SERIAL is not set
743# CONFIG_MOUSE_INPORT is not set
744# CONFIG_MOUSE_LOGIBM is not set
745# CONFIG_MOUSE_PC110PAD is not set
746# CONFIG_MOUSE_VSXXXAA is not set
747# CONFIG_INPUT_JOYSTICK is not set
748# CONFIG_INPUT_TOUCHSCREEN is not set
749CONFIG_INPUT_MISC=y
750# CONFIG_INPUT_PCSPKR is not set
751CONFIG_INPUT_UINPUT=m
752
753#
754# Character devices
755#
756CONFIG_VT=y
757CONFIG_VT_CONSOLE=y
758CONFIG_HW_CONSOLE=y
759# CONFIG_SERIAL_NONSTANDARD is not set
760
761#
762# Serial drivers
763#
764CONFIG_SERIAL_8250=m
765CONFIG_SERIAL_8250_NR_UARTS=4
766# CONFIG_SERIAL_8250_EXTENDED is not set
767
768#
769# Non-8250 serial port support
770#
771CONFIG_SERIAL_CORE=y
772CONFIG_SERIAL_PMACZILOG=y
773# CONFIG_SERIAL_PMACZILOG_CONSOLE is not set
774CONFIG_UNIX98_PTYS=y
775CONFIG_LEGACY_PTYS=y
776CONFIG_LEGACY_PTY_COUNT=256
777
778#
779# IPMI
780#
781# CONFIG_IPMI_HANDLER is not set
782
783#
784# Watchdog Cards
785#
786# CONFIG_WATCHDOG is not set
787CONFIG_NVRAM=y
788CONFIG_GEN_RTC=y
789# CONFIG_GEN_RTC_X is not set
790# CONFIG_DTLK is not set
791# CONFIG_R3964 is not set
792# CONFIG_APPLICOM is not set
793
794#
795# Ftape, the floppy tape device driver
796#
797# CONFIG_AGP is not set
798# CONFIG_DRM is not set
799# CONFIG_RAW_DRIVER is not set
800
801#
802# I2C support
803#
804CONFIG_I2C=y
805CONFIG_I2C_CHARDEV=m
806
807#
808# I2C Algorithms
809#
810CONFIG_I2C_ALGOBIT=y
811# CONFIG_I2C_ALGOPCF is not set
812# CONFIG_I2C_ALGOPCA is not set
813
814#
815# I2C Hardware Bus support
816#
817# CONFIG_I2C_ALI1535 is not set
818# CONFIG_I2C_ALI1563 is not set
819# CONFIG_I2C_ALI15X3 is not set
820# CONFIG_I2C_AMD756 is not set
821# CONFIG_I2C_AMD8111 is not set
822# CONFIG_I2C_ELEKTOR is not set
823CONFIG_I2C_HYDRA=y
824# CONFIG_I2C_I801 is not set
825# CONFIG_I2C_I810 is not set
826# CONFIG_I2C_ISA is not set
827CONFIG_I2C_KEYWEST=m
828# CONFIG_I2C_NFORCE2 is not set
829# CONFIG_I2C_PARPORT_LIGHT is not set
830# CONFIG_I2C_PIIX4 is not set
831# CONFIG_I2C_PROSAVAGE is not set
832# CONFIG_I2C_SAVAGE4 is not set
833# CONFIG_SCx200_ACB is not set
834# CONFIG_I2C_SIS5595 is not set
835# CONFIG_I2C_SIS630 is not set
836# CONFIG_I2C_SIS96X is not set
837# CONFIG_I2C_STUB is not set
838# CONFIG_I2C_VIA is not set
839# CONFIG_I2C_VIAPRO is not set
840# CONFIG_I2C_VOODOO3 is not set
841# CONFIG_I2C_PCA_ISA is not set
842
843#
844# Hardware Sensors Chip support
845#
846# CONFIG_I2C_SENSOR is not set
847# CONFIG_SENSORS_ADM1021 is not set
848# CONFIG_SENSORS_ADM1025 is not set
849# CONFIG_SENSORS_ADM1031 is not set
850# CONFIG_SENSORS_ASB100 is not set
851# CONFIG_SENSORS_DS1621 is not set
852# CONFIG_SENSORS_FSCHER is not set
853# CONFIG_SENSORS_GL518SM is not set
854# CONFIG_SENSORS_IT87 is not set
855# CONFIG_SENSORS_LM63 is not set
856# CONFIG_SENSORS_LM75 is not set
857# CONFIG_SENSORS_LM77 is not set
858# CONFIG_SENSORS_LM78 is not set
859# CONFIG_SENSORS_LM80 is not set
860# CONFIG_SENSORS_LM83 is not set
861# CONFIG_SENSORS_LM85 is not set
862# CONFIG_SENSORS_LM87 is not set
863# CONFIG_SENSORS_LM90 is not set
864# CONFIG_SENSORS_MAX1619 is not set
865# CONFIG_SENSORS_PC87360 is not set
866# CONFIG_SENSORS_SMSC47M1 is not set
867# CONFIG_SENSORS_VIA686A is not set
868# CONFIG_SENSORS_W83781D is not set
869# CONFIG_SENSORS_W83L785TS is not set
870# CONFIG_SENSORS_W83627HF is not set
871
872#
873# Other I2C Chip support
874#
875# CONFIG_SENSORS_EEPROM is not set
876# CONFIG_SENSORS_PCF8574 is not set
877# CONFIG_SENSORS_PCF8591 is not set
878# CONFIG_SENSORS_RTC8564 is not set
879# CONFIG_I2C_DEBUG_CORE is not set
880# CONFIG_I2C_DEBUG_ALGO is not set
881# CONFIG_I2C_DEBUG_BUS is not set
882# CONFIG_I2C_DEBUG_CHIP is not set
883
884#
885# Dallas's 1-wire bus
886#
887# CONFIG_W1 is not set
888
889#
890# Misc devices
891#
892
893#
894# Multimedia devices
895#
896# CONFIG_VIDEO_DEV is not set
897
898#
899# Digital Video Broadcasting Devices
900#
901# CONFIG_DVB is not set
902
903#
904# Graphics support
905#
906CONFIG_FB=y
907CONFIG_FB_MODE_HELPERS=y
908# CONFIG_FB_TILEBLITTING is not set
909# CONFIG_FB_CIRRUS is not set
910# CONFIG_FB_PM2 is not set
911# CONFIG_FB_CYBER2000 is not set
912CONFIG_FB_OF=y
913CONFIG_FB_CONTROL=y
914CONFIG_FB_PLATINUM=y
915CONFIG_FB_VALKYRIE=y
916CONFIG_FB_CT65550=y
917# CONFIG_FB_ASILIANT is not set
918CONFIG_FB_IMSTT=y
919# CONFIG_FB_VGA16 is not set
920# CONFIG_FB_RIVA is not set
921CONFIG_FB_MATROX=y
922CONFIG_FB_MATROX_MILLENIUM=y
923CONFIG_FB_MATROX_MYSTIQUE=y
924# CONFIG_FB_MATROX_G450 is not set
925# CONFIG_FB_MATROX_G100A is not set
926CONFIG_FB_MATROX_I2C=y
927# CONFIG_FB_MATROX_MULTIHEAD is not set
928# CONFIG_FB_RADEON_OLD is not set
929CONFIG_FB_RADEON=y
930CONFIG_FB_RADEON_I2C=y
931# CONFIG_FB_RADEON_DEBUG is not set
932CONFIG_FB_ATY128=y
933CONFIG_FB_ATY=y
934CONFIG_FB_ATY_CT=y
935# CONFIG_FB_ATY_GENERIC_LCD is not set
936# CONFIG_FB_ATY_XL_INIT is not set
937CONFIG_FB_ATY_GX=y
938# CONFIG_FB_SAVAGE is not set
939# CONFIG_FB_SIS is not set
940# CONFIG_FB_NEOMAGIC is not set
941# CONFIG_FB_KYRO is not set
942CONFIG_FB_3DFX=y
943# CONFIG_FB_3DFX_ACCEL is not set
944# CONFIG_FB_VOODOO1 is not set
945# CONFIG_FB_TRIDENT is not set
946# CONFIG_FB_VIRTUAL is not set
947
948#
949# Console display driver support
950#
951CONFIG_VGA_CONSOLE=y
952# CONFIG_MDA_CONSOLE is not set
953CONFIG_DUMMY_CONSOLE=y
954CONFIG_FRAMEBUFFER_CONSOLE=y
955# CONFIG_FONTS is not set
956CONFIG_FONT_8x8=y
957CONFIG_FONT_8x16=y
958
959#
960# Logo configuration
961#
962CONFIG_LOGO=y
963CONFIG_LOGO_LINUX_MONO=y
964CONFIG_LOGO_LINUX_VGA16=y
965CONFIG_LOGO_LINUX_CLUT224=y
966
967#
968# Sound
969#
970CONFIG_SOUND=m
971CONFIG_DMASOUND_PMAC=m
972CONFIG_DMASOUND=m
973
974#
975# Advanced Linux Sound Architecture
976#
977CONFIG_SND=m
978CONFIG_SND_TIMER=m
979CONFIG_SND_PCM=m
980CONFIG_SND_HWDEP=m
981CONFIG_SND_RAWMIDI=m
982CONFIG_SND_SEQUENCER=m
983# CONFIG_SND_SEQ_DUMMY is not set
984CONFIG_SND_OSSEMUL=y
985CONFIG_SND_MIXER_OSS=m
986CONFIG_SND_PCM_OSS=m
987CONFIG_SND_SEQUENCER_OSS=y
988# CONFIG_SND_VERBOSE_PRINTK is not set
989# CONFIG_SND_DEBUG is not set
990
991#
992# Generic devices
993#
994CONFIG_SND_MPU401_UART=m
995CONFIG_SND_OPL3_LIB=m
996# CONFIG_SND_DUMMY is not set
997# CONFIG_SND_VIRMIDI is not set
998# CONFIG_SND_MTPAV is not set
999# CONFIG_SND_SERIAL_U16550 is not set
1000# CONFIG_SND_MPU401 is not set
1001
1002#
1003# ISA devices
1004#
1005# CONFIG_SND_AD1848 is not set
1006# CONFIG_SND_CS4231 is not set
1007CONFIG_SND_CS4232=m
1008# CONFIG_SND_CS4236 is not set
1009# CONFIG_SND_ES1688 is not set
1010# CONFIG_SND_ES18XX is not set
1011# CONFIG_SND_GUSCLASSIC is not set
1012# CONFIG_SND_GUSEXTREME is not set
1013# CONFIG_SND_GUSMAX is not set
1014# CONFIG_SND_INTERWAVE is not set
1015# CONFIG_SND_INTERWAVE_STB is not set
1016# CONFIG_SND_OPTI92X_AD1848 is not set
1017# CONFIG_SND_OPTI92X_CS4231 is not set
1018# CONFIG_SND_OPTI93X is not set
1019# CONFIG_SND_SB8 is not set
1020# CONFIG_SND_SB16 is not set
1021# CONFIG_SND_SBAWE is not set
1022# CONFIG_SND_WAVEFRONT is not set
1023# CONFIG_SND_CMI8330 is not set
1024# CONFIG_SND_OPL3SA2 is not set
1025# CONFIG_SND_SGALAXY is not set
1026# CONFIG_SND_SSCAPE is not set
1027
1028#
1029# PCI devices
1030#
1031# CONFIG_SND_ALI5451 is not set
1032# CONFIG_SND_ATIIXP is not set
1033# CONFIG_SND_ATIIXP_MODEM is not set
1034# CONFIG_SND_AU8810 is not set
1035# CONFIG_SND_AU8820 is not set
1036# CONFIG_SND_AU8830 is not set
1037# CONFIG_SND_AZT3328 is not set
1038# CONFIG_SND_BT87X is not set
1039# CONFIG_SND_CS46XX is not set
1040# CONFIG_SND_CS4281 is not set
1041# CONFIG_SND_EMU10K1 is not set
1042# CONFIG_SND_KORG1212 is not set
1043# CONFIG_SND_MIXART is not set
1044# CONFIG_SND_NM256 is not set
1045# CONFIG_SND_RME32 is not set
1046# CONFIG_SND_RME96 is not set
1047# CONFIG_SND_RME9652 is not set
1048# CONFIG_SND_HDSP is not set
1049# CONFIG_SND_TRIDENT is not set
1050# CONFIG_SND_YMFPCI is not set
1051# CONFIG_SND_ALS4000 is not set
1052# CONFIG_SND_CMIPCI is not set
1053# CONFIG_SND_ENS1370 is not set
1054# CONFIG_SND_ENS1371 is not set
1055# CONFIG_SND_ES1938 is not set
1056# CONFIG_SND_ES1968 is not set
1057# CONFIG_SND_MAESTRO3 is not set
1058# CONFIG_SND_FM801 is not set
1059# CONFIG_SND_ICE1712 is not set
1060# CONFIG_SND_ICE1724 is not set
1061# CONFIG_SND_INTEL8X0 is not set
1062# CONFIG_SND_INTEL8X0M is not set
1063# CONFIG_SND_SONICVIBES is not set
1064# CONFIG_SND_VIA82XX is not set
1065# CONFIG_SND_VX222 is not set
1066
1067#
1068# ALSA PowerMac devices
1069#
1070CONFIG_SND_POWERMAC=m
1071
1072#
1073# USB devices
1074#
1075CONFIG_SND_USB_AUDIO=m
1076# CONFIG_SND_USB_USX2Y is not set
1077
1078#
1079# Open Sound System
1080#
1081# CONFIG_SOUND_PRIME is not set
1082
1083#
1084# USB support
1085#
1086CONFIG_USB=y
1087# CONFIG_USB_DEBUG is not set
1088
1089#
1090# Miscellaneous USB options
1091#
1092CONFIG_USB_DEVICEFS=y
1093# CONFIG_USB_BANDWIDTH is not set
1094# CONFIG_USB_DYNAMIC_MINORS is not set
1095# CONFIG_USB_SUSPEND is not set
1096# CONFIG_USB_OTG is not set
1097CONFIG_USB_ARCH_HAS_HCD=y
1098CONFIG_USB_ARCH_HAS_OHCI=y
1099
1100#
1101# USB Host Controller Drivers
1102#
1103# CONFIG_USB_EHCI_HCD is not set
1104CONFIG_USB_OHCI_HCD=y
1105# CONFIG_USB_UHCI_HCD is not set
1106
1107#
1108# USB Device Class drivers
1109#
1110# CONFIG_USB_AUDIO is not set
1111# CONFIG_USB_BLUETOOTH_TTY is not set
1112# CONFIG_USB_MIDI is not set
1113CONFIG_USB_ACM=m
1114CONFIG_USB_PRINTER=m
1115CONFIG_USB_STORAGE=m
1116# CONFIG_USB_STORAGE_DEBUG is not set
1117# CONFIG_USB_STORAGE_RW_DETECT is not set
1118# CONFIG_USB_STORAGE_DATAFAB is not set
1119CONFIG_USB_STORAGE_FREECOM=y
1120# CONFIG_USB_STORAGE_ISD200 is not set
1121CONFIG_USB_STORAGE_DPCM=y
1122# CONFIG_USB_STORAGE_HP8200e is not set
1123# CONFIG_USB_STORAGE_SDDR09 is not set
1124# CONFIG_USB_STORAGE_SDDR55 is not set
1125# CONFIG_USB_STORAGE_JUMPSHOT is not set
1126
1127#
1128# USB Input Devices
1129#
1130CONFIG_USB_HID=y
1131CONFIG_USB_HIDINPUT=y
1132# CONFIG_HID_FF is not set
1133# CONFIG_USB_HIDDEV is not set
1134# CONFIG_USB_AIPTEK is not set
1135# CONFIG_USB_WACOM is not set
1136# CONFIG_USB_KBTAB is not set
1137# CONFIG_USB_POWERMATE is not set
1138# CONFIG_USB_MTOUCH is not set
1139# CONFIG_USB_EGALAX is not set
1140# CONFIG_USB_XPAD is not set
1141# CONFIG_USB_ATI_REMOTE is not set
1142
1143#
1144# USB Imaging devices
1145#
1146# CONFIG_USB_MDC800 is not set
1147# CONFIG_USB_MICROTEK is not set
1148# CONFIG_USB_HPUSBSCSI is not set
1149
1150#
1151# USB Multimedia devices
1152#
1153# CONFIG_USB_DABUSB is not set
1154
1155#
1156# Video4Linux support is needed for USB Multimedia device support
1157#
1158
1159#
1160# USB Network Adapters
1161#
1162# CONFIG_USB_CATC is not set
1163# CONFIG_USB_KAWETH is not set
1164# CONFIG_USB_PEGASUS is not set
1165# CONFIG_USB_RTL8150 is not set
1166# CONFIG_USB_USBNET is not set
1167
1168#
1169# USB port drivers
1170#
1171
1172#
1173# USB Serial Converter support
1174#
1175CONFIG_USB_SERIAL=m
1176# CONFIG_USB_SERIAL_GENERIC is not set
1177# CONFIG_USB_SERIAL_BELKIN is not set
1178# CONFIG_USB_SERIAL_WHITEHEAT is not set
1179# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set
1180# CONFIG_USB_SERIAL_CYPRESS_M8 is not set
1181# CONFIG_USB_SERIAL_EMPEG is not set
1182# CONFIG_USB_SERIAL_FTDI_SIO is not set
1183CONFIG_USB_SERIAL_VISOR=m
1184# CONFIG_USB_SERIAL_IPAQ is not set
1185# CONFIG_USB_SERIAL_IR is not set
1186# CONFIG_USB_SERIAL_EDGEPORT is not set
1187# CONFIG_USB_SERIAL_EDGEPORT_TI is not set
1188# CONFIG_USB_SERIAL_IPW is not set
1189# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set
1190CONFIG_USB_SERIAL_KEYSPAN=m
1191# CONFIG_USB_SERIAL_KEYSPAN_MPR is not set
1192CONFIG_USB_SERIAL_KEYSPAN_USA28=y
1193CONFIG_USB_SERIAL_KEYSPAN_USA28X=y
1194# CONFIG_USB_SERIAL_KEYSPAN_USA28XA is not set
1195# CONFIG_USB_SERIAL_KEYSPAN_USA28XB is not set
1196CONFIG_USB_SERIAL_KEYSPAN_USA19=y
1197CONFIG_USB_SERIAL_KEYSPAN_USA18X=y
1198CONFIG_USB_SERIAL_KEYSPAN_USA19W=y
1199CONFIG_USB_SERIAL_KEYSPAN_USA19QW=y
1200CONFIG_USB_SERIAL_KEYSPAN_USA19QI=y
1201CONFIG_USB_SERIAL_KEYSPAN_USA49W=y
1202# CONFIG_USB_SERIAL_KEYSPAN_USA49WLC is not set
1203# CONFIG_USB_SERIAL_KLSI is not set
1204# CONFIG_USB_SERIAL_KOBIL_SCT is not set
1205# CONFIG_USB_SERIAL_MCT_U232 is not set
1206# CONFIG_USB_SERIAL_PL2303 is not set
1207# CONFIG_USB_SERIAL_SAFE is not set
1208# CONFIG_USB_SERIAL_CYBERJACK is not set
1209# CONFIG_USB_SERIAL_XIRCOM is not set
1210# CONFIG_USB_SERIAL_OMNINET is not set
1211CONFIG_USB_EZUSB=y
1212
1213#
1214# USB Miscellaneous drivers
1215#
1216# CONFIG_USB_EMI62 is not set
1217# CONFIG_USB_EMI26 is not set
1218# CONFIG_USB_TIGL is not set
1219# CONFIG_USB_AUERSWALD is not set
1220# CONFIG_USB_RIO500 is not set
1221# CONFIG_USB_LEGOTOWER is not set
1222# CONFIG_USB_LCD is not set
1223# CONFIG_USB_LED is not set
1224# CONFIG_USB_CYTHERM is not set
1225# CONFIG_USB_PHIDGETKIT is not set
1226# CONFIG_USB_PHIDGETSERVO is not set
1227# CONFIG_USB_TEST is not set
1228
1229#
1230# USB ATM/DSL drivers
1231#
1232
1233#
1234# USB Gadget Support
1235#
1236# CONFIG_USB_GADGET is not set
1237
1238#
1239# File systems
1240#
1241CONFIG_EXT2_FS=y
1242# CONFIG_EXT2_FS_XATTR is not set
1243# CONFIG_EXT3_FS is not set
1244# CONFIG_JBD is not set
1245# CONFIG_REISERFS_FS is not set
1246# CONFIG_JFS_FS is not set
1247# CONFIG_XFS_FS is not set
1248# CONFIG_MINIX_FS is not set
1249# CONFIG_ROMFS_FS is not set
1250# CONFIG_QUOTA is not set
1251CONFIG_DNOTIFY=y
1252# CONFIG_AUTOFS_FS is not set
1253# CONFIG_AUTOFS4_FS is not set
1254
1255#
1256# CD-ROM/DVD Filesystems
1257#
1258CONFIG_ISO9660_FS=y
1259# CONFIG_JOLIET is not set
1260# CONFIG_ZISOFS is not set
1261# CONFIG_UDF_FS is not set
1262
1263#
1264# DOS/FAT/NT Filesystems
1265#
1266CONFIG_FAT_FS=m
1267CONFIG_MSDOS_FS=m
1268CONFIG_VFAT_FS=m
1269CONFIG_FAT_DEFAULT_CODEPAGE=437
1270CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1271# CONFIG_NTFS_FS is not set
1272
1273#
1274# Pseudo filesystems
1275#
1276CONFIG_PROC_FS=y
1277CONFIG_PROC_KCORE=y
1278CONFIG_SYSFS=y
1279CONFIG_DEVFS_FS=y
1280# CONFIG_DEVFS_MOUNT is not set
1281# CONFIG_DEVFS_DEBUG is not set
1282# CONFIG_DEVPTS_FS_XATTR is not set
1283CONFIG_TMPFS=y
1284# CONFIG_TMPFS_XATTR is not set
1285# CONFIG_HUGETLB_PAGE is not set
1286CONFIG_RAMFS=y
1287
1288#
1289# Miscellaneous filesystems
1290#
1291# CONFIG_ADFS_FS is not set
1292# CONFIG_AFFS_FS is not set
1293CONFIG_HFS_FS=m
1294CONFIG_HFSPLUS_FS=m
1295# CONFIG_BEFS_FS is not set
1296# CONFIG_BFS_FS is not set
1297# CONFIG_EFS_FS is not set
1298# CONFIG_CRAMFS is not set
1299# CONFIG_VXFS_FS is not set
1300# CONFIG_HPFS_FS is not set
1301# CONFIG_QNX4FS_FS is not set
1302# CONFIG_SYSV_FS is not set
1303# CONFIG_UFS_FS is not set
1304
1305#
1306# Network File Systems
1307#
1308CONFIG_NFS_FS=y
1309CONFIG_NFS_V3=y
1310# CONFIG_NFS_V4 is not set
1311# CONFIG_NFS_DIRECTIO is not set
1312CONFIG_NFSD=y
1313CONFIG_NFSD_V3=y
1314# CONFIG_NFSD_V4 is not set
1315CONFIG_NFSD_TCP=y
1316CONFIG_LOCKD=y
1317CONFIG_LOCKD_V4=y
1318CONFIG_EXPORTFS=y
1319CONFIG_SUNRPC=y
1320# CONFIG_RPCSEC_GSS_KRB5 is not set
1321# CONFIG_RPCSEC_GSS_SPKM3 is not set
1322# CONFIG_SMB_FS is not set
1323# CONFIG_CIFS is not set
1324# CONFIG_NCP_FS is not set
1325# CONFIG_CODA_FS is not set
1326# CONFIG_AFS_FS is not set
1327
1328#
1329# Partition Types
1330#
1331CONFIG_PARTITION_ADVANCED=y
1332# CONFIG_ACORN_PARTITION is not set
1333# CONFIG_OSF_PARTITION is not set
1334# CONFIG_AMIGA_PARTITION is not set
1335# CONFIG_ATARI_PARTITION is not set
1336CONFIG_MAC_PARTITION=y
1337CONFIG_MSDOS_PARTITION=y
1338# CONFIG_BSD_DISKLABEL is not set
1339# CONFIG_MINIX_SUBPARTITION is not set
1340# CONFIG_SOLARIS_X86_PARTITION is not set
1341# CONFIG_UNIXWARE_DISKLABEL is not set
1342# CONFIG_LDM_PARTITION is not set
1343# CONFIG_SGI_PARTITION is not set
1344# CONFIG_ULTRIX_PARTITION is not set
1345# CONFIG_SUN_PARTITION is not set
1346# CONFIG_EFI_PARTITION is not set
1347
1348#
1349# Native Language Support
1350#
1351CONFIG_NLS=y
1352CONFIG_NLS_DEFAULT="iso8859-1"
1353# CONFIG_NLS_CODEPAGE_437 is not set
1354# CONFIG_NLS_CODEPAGE_737 is not set
1355# CONFIG_NLS_CODEPAGE_775 is not set
1356# CONFIG_NLS_CODEPAGE_850 is not set
1357# CONFIG_NLS_CODEPAGE_852 is not set
1358# CONFIG_NLS_CODEPAGE_855 is not set
1359# CONFIG_NLS_CODEPAGE_857 is not set
1360# CONFIG_NLS_CODEPAGE_860 is not set
1361# CONFIG_NLS_CODEPAGE_861 is not set
1362# CONFIG_NLS_CODEPAGE_862 is not set
1363# CONFIG_NLS_CODEPAGE_863 is not set
1364# CONFIG_NLS_CODEPAGE_864 is not set
1365# CONFIG_NLS_CODEPAGE_865 is not set
1366# CONFIG_NLS_CODEPAGE_866 is not set
1367# CONFIG_NLS_CODEPAGE_869 is not set
1368# CONFIG_NLS_CODEPAGE_936 is not set
1369# CONFIG_NLS_CODEPAGE_950 is not set
1370# CONFIG_NLS_CODEPAGE_932 is not set
1371# CONFIG_NLS_CODEPAGE_949 is not set
1372# CONFIG_NLS_CODEPAGE_874 is not set
1373# CONFIG_NLS_ISO8859_8 is not set
1374# CONFIG_NLS_CODEPAGE_1250 is not set
1375# CONFIG_NLS_CODEPAGE_1251 is not set
1376# CONFIG_NLS_ASCII is not set
1377CONFIG_NLS_ISO8859_1=m
1378# CONFIG_NLS_ISO8859_2 is not set
1379# CONFIG_NLS_ISO8859_3 is not set
1380# CONFIG_NLS_ISO8859_4 is not set
1381# CONFIG_NLS_ISO8859_5 is not set
1382# CONFIG_NLS_ISO8859_6 is not set
1383# CONFIG_NLS_ISO8859_7 is not set
1384# CONFIG_NLS_ISO8859_9 is not set
1385# CONFIG_NLS_ISO8859_13 is not set
1386# CONFIG_NLS_ISO8859_14 is not set
1387# CONFIG_NLS_ISO8859_15 is not set
1388# CONFIG_NLS_KOI8_R is not set
1389# CONFIG_NLS_KOI8_U is not set
1390# CONFIG_NLS_UTF8 is not set
1391
1392#
1393# Library routines
1394#
1395CONFIG_CRC_CCITT=y
1396CONFIG_CRC32=y
1397# CONFIG_LIBCRC32C is not set
1398CONFIG_ZLIB_INFLATE=y
1399CONFIG_ZLIB_DEFLATE=y
1400
1401#
1402# Profiling support
1403#
1404# CONFIG_PROFILING is not set
1405
1406#
1407# Kernel hacking
1408#
1409# CONFIG_DEBUG_KERNEL is not set
1410CONFIG_BOOTX_TEXT=y
1411
1412#
1413# Security options
1414#
1415# CONFIG_KEYS is not set
1416# CONFIG_SECURITY is not set
1417
1418#
1419# Cryptographic options
1420#
1421# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/cpci405_defconfig b/arch/ppc/configs/cpci405_defconfig
new file mode 100644
index 000000000000..a336ffa8ff41
--- /dev/null
+++ b/arch/ppc/configs/cpci405_defconfig
@@ -0,0 +1,631 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7CONFIG_PPC=y
8CONFIG_PPC32=y
9CONFIG_GENERIC_NVRAM=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16# CONFIG_STANDALONE is not set
17CONFIG_BROKEN_ON_SMP=y
18
19#
20# General setup
21#
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26CONFIG_LOG_BUF_SHIFT=14
27# CONFIG_HOTPLUG is not set
28# CONFIG_IKCONFIG is not set
29CONFIG_EMBEDDED=y
30# CONFIG_KALLSYMS is not set
31CONFIG_FUTEX=y
32# CONFIG_EPOLL is not set
33CONFIG_IOSCHED_NOOP=y
34CONFIG_IOSCHED_AS=y
35CONFIG_IOSCHED_DEADLINE=y
36# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
37
38#
39# Loadable module support
40#
41CONFIG_MODULES=y
42CONFIG_MODULE_UNLOAD=y
43# CONFIG_MODULE_FORCE_UNLOAD is not set
44CONFIG_OBSOLETE_MODPARM=y
45# CONFIG_MODVERSIONS is not set
46CONFIG_KMOD=y
47
48#
49# Processor
50#
51# CONFIG_6xx is not set
52CONFIG_40x=y
53# CONFIG_44x is not set
54# CONFIG_POWER3 is not set
55# CONFIG_POWER4 is not set
56# CONFIG_8xx is not set
57# CONFIG_MATH_EMULATION is not set
58# CONFIG_CPU_FREQ is not set
59CONFIG_4xx=y
60
61#
62# IBM 4xx options
63#
64# CONFIG_ASH is not set
65CONFIG_CPCI405=y
66# CONFIG_EP405 is not set
67# CONFIG_EVB405EP is not set
68# CONFIG_OAK is not set
69# CONFIG_REDWOOD_5 is not set
70# CONFIG_REDWOOD_6 is not set
71# CONFIG_SYCAMORE is not set
72# CONFIG_WALNUT is not set
73CONFIG_IBM405_ERR77=y
74CONFIG_IBM405_ERR51=y
75CONFIG_IBM_OCP=y
76CONFIG_PPC_OCP=y
77CONFIG_405GP=y
78# CONFIG_PM is not set
79CONFIG_UART0_TTYS0=y
80# CONFIG_UART0_TTYS1 is not set
81CONFIG_NOT_COHERENT_CACHE=y
82
83#
84# Platform options
85#
86# CONFIG_PC_KEYBOARD is not set
87# CONFIG_SMP is not set
88# CONFIG_PREEMPT is not set
89# CONFIG_HIGHMEM is not set
90CONFIG_KERNEL_ELF=y
91CONFIG_BINFMT_ELF=y
92# CONFIG_BINFMT_MISC is not set
93CONFIG_CMDLINE_BOOL=y
94CONFIG_CMDLINE="ip=on"
95
96#
97# Bus options
98#
99CONFIG_PCI=y
100CONFIG_PCI_DOMAINS=y
101CONFIG_PCI_LEGACY_PROC=y
102# CONFIG_PCI_NAMES is not set
103
104#
105# Advanced setup
106#
107# CONFIG_ADVANCED_OPTIONS is not set
108
109#
110# Default settings for advanced configuration options are used
111#
112CONFIG_HIGHMEM_START=0xfe000000
113CONFIG_LOWMEM_SIZE=0x30000000
114CONFIG_KERNEL_START=0xc0000000
115CONFIG_TASK_SIZE=0x80000000
116CONFIG_BOOT_LOAD=0x00400000
117
118#
119# Device Drivers
120#
121
122#
123# Generic Driver Options
124#
125
126#
127# Memory Technology Devices (MTD)
128#
129# CONFIG_MTD is not set
130
131#
132# Parallel port support
133#
134# CONFIG_PARPORT is not set
135
136#
137# Plug and Play support
138#
139
140#
141# Block devices
142#
143# CONFIG_BLK_DEV_FD is not set
144# CONFIG_BLK_CPQ_DA is not set
145# CONFIG_BLK_CPQ_CISS_DA is not set
146# CONFIG_BLK_DEV_DAC960 is not set
147# CONFIG_BLK_DEV_UMEM is not set
148# CONFIG_BLK_DEV_LOOP is not set
149# CONFIG_BLK_DEV_NBD is not set
150# CONFIG_BLK_DEV_CARMEL is not set
151CONFIG_BLK_DEV_RAM=y
152CONFIG_BLK_DEV_RAM_SIZE=4096
153CONFIG_BLK_DEV_INITRD=y
154# CONFIG_LBD is not set
155
156#
157# ATA/ATAPI/MFM/RLL support
158#
159CONFIG_IDE=y
160CONFIG_BLK_DEV_IDE=y
161
162#
163# Please see Documentation/ide.txt for help/info on IDE drives
164#
165CONFIG_BLK_DEV_IDEDISK=y
166# CONFIG_IDEDISK_MULTI_MODE is not set
167# CONFIG_IDEDISK_STROKE is not set
168# CONFIG_BLK_DEV_IDECD is not set
169# CONFIG_BLK_DEV_IDETAPE is not set
170# CONFIG_BLK_DEV_IDEFLOPPY is not set
171# CONFIG_IDE_TASK_IOCTL is not set
172# CONFIG_IDE_TASKFILE_IO is not set
173
174#
175# IDE chipset support/bugfixes
176#
177CONFIG_IDE_GENERIC=y
178# CONFIG_BLK_DEV_IDEPCI is not set
179# CONFIG_BLK_DEV_IDEDMA is not set
180# CONFIG_IDEDMA_AUTO is not set
181# CONFIG_BLK_DEV_HD is not set
182
183#
184# SCSI device support
185#
186# CONFIG_SCSI is not set
187
188#
189# Multi-device support (RAID and LVM)
190#
191# CONFIG_MD is not set
192
193#
194# Fusion MPT device support
195#
196# CONFIG_FUSION is not set
197
198#
199# IEEE 1394 (FireWire) support
200#
201# CONFIG_IEEE1394 is not set
202
203#
204# I2O device support
205#
206# CONFIG_I2O is not set
207
208#
209# Macintosh device drivers
210#
211
212#
213# Networking support
214#
215CONFIG_NET=y
216
217#
218# Networking options
219#
220# CONFIG_PACKET is not set
221# CONFIG_NETLINK_DEV is not set
222CONFIG_UNIX=y
223# CONFIG_NET_KEY is not set
224CONFIG_INET=y
225CONFIG_IP_MULTICAST=y
226# CONFIG_IP_ADVANCED_ROUTER is not set
227CONFIG_IP_PNP=y
228# CONFIG_IP_PNP_DHCP is not set
229CONFIG_IP_PNP_BOOTP=y
230# CONFIG_IP_PNP_RARP is not set
231# CONFIG_NET_IPIP is not set
232# CONFIG_NET_IPGRE is not set
233# CONFIG_IP_MROUTE is not set
234# CONFIG_ARPD is not set
235CONFIG_SYN_COOKIES=y
236# CONFIG_INET_AH is not set
237# CONFIG_INET_ESP is not set
238# CONFIG_INET_IPCOMP is not set
239# CONFIG_IPV6 is not set
240# CONFIG_DECNET is not set
241# CONFIG_BRIDGE is not set
242# CONFIG_NETFILTER is not set
243
244#
245# SCTP Configuration (EXPERIMENTAL)
246#
247# CONFIG_IP_SCTP is not set
248# CONFIG_ATM is not set
249# CONFIG_VLAN_8021Q is not set
250# CONFIG_LLC2 is not set
251# CONFIG_IPX is not set
252# CONFIG_ATALK is not set
253# CONFIG_X25 is not set
254# CONFIG_LAPB is not set
255# CONFIG_NET_DIVERT is not set
256# CONFIG_ECONET is not set
257# CONFIG_WAN_ROUTER is not set
258# CONFIG_NET_HW_FLOWCONTROL is not set
259
260#
261# QoS and/or fair queueing
262#
263# CONFIG_NET_SCHED is not set
264
265#
266# Network testing
267#
268# CONFIG_NET_PKTGEN is not set
269CONFIG_NETDEVICES=y
270
271#
272# ARCnet devices
273#
274# CONFIG_ARCNET is not set
275# CONFIG_DUMMY is not set
276# CONFIG_BONDING is not set
277# CONFIG_EQUALIZER is not set
278# CONFIG_TUN is not set
279
280#
281# Ethernet (10 or 100Mbit)
282#
283# CONFIG_NET_ETHERNET is not set
284
285#
286# Ethernet (1000 Mbit)
287#
288# CONFIG_ACENIC is not set
289# CONFIG_DL2K is not set
290# CONFIG_E1000 is not set
291# CONFIG_NS83820 is not set
292# CONFIG_HAMACHI is not set
293# CONFIG_YELLOWFIN is not set
294# CONFIG_R8169 is not set
295# CONFIG_SIS190 is not set
296# CONFIG_SK98LIN is not set
297# CONFIG_TIGON3 is not set
298
299#
300# Ethernet (10000 Mbit)
301#
302# CONFIG_IXGB is not set
303CONFIG_IBM_EMAC=y
304# CONFIG_IBM_EMAC_ERRMSG is not set
305CONFIG_IBM_EMAC_RXB=64
306CONFIG_IBM_EMAC_TXB=8
307CONFIG_IBM_EMAC_FGAP=8
308CONFIG_IBM_EMAC_SKBRES=0
309# CONFIG_FDDI is not set
310# CONFIG_HIPPI is not set
311# CONFIG_PPP is not set
312# CONFIG_SLIP is not set
313
314#
315# Wireless LAN (non-hamradio)
316#
317# CONFIG_NET_RADIO is not set
318
319#
320# Token Ring devices
321#
322# CONFIG_TR is not set
323# CONFIG_RCPCI is not set
324# CONFIG_SHAPER is not set
325# CONFIG_NETCONSOLE is not set
326
327#
328# Wan interfaces
329#
330# CONFIG_WAN is not set
331
332#
333# Amateur Radio support
334#
335# CONFIG_HAMRADIO is not set
336
337#
338# IrDA (infrared) support
339#
340# CONFIG_IRDA is not set
341
342#
343# Bluetooth support
344#
345# CONFIG_BT is not set
346# CONFIG_NETPOLL is not set
347# CONFIG_NET_POLL_CONTROLLER is not set
348
349#
350# ISDN subsystem
351#
352# CONFIG_ISDN is not set
353
354#
355# Telephony Support
356#
357# CONFIG_PHONE is not set
358
359#
360# Input device support
361#
362CONFIG_INPUT=y
363
364#
365# Userland interfaces
366#
367# CONFIG_INPUT_MOUSEDEV is not set
368# CONFIG_INPUT_JOYDEV is not set
369# CONFIG_INPUT_TSDEV is not set
370# CONFIG_INPUT_EVDEV is not set
371# CONFIG_INPUT_EVBUG is not set
372
373#
374# Input I/O drivers
375#
376# CONFIG_GAMEPORT is not set
377CONFIG_SOUND_GAMEPORT=y
378CONFIG_SERIO=y
379# CONFIG_SERIO_I8042 is not set
380# CONFIG_SERIO_SERPORT is not set
381# CONFIG_SERIO_CT82C710 is not set
382# CONFIG_SERIO_PCIPS2 is not set
383
384#
385# Input Device Drivers
386#
387# CONFIG_INPUT_KEYBOARD is not set
388# CONFIG_INPUT_MOUSE is not set
389# CONFIG_INPUT_JOYSTICK is not set
390# CONFIG_INPUT_TOUCHSCREEN is not set
391# CONFIG_INPUT_MISC is not set
392
393#
394# Character devices
395#
396# CONFIG_VT is not set
397# CONFIG_SERIAL_NONSTANDARD is not set
398
399#
400# Serial drivers
401#
402CONFIG_SERIAL_8250=y
403CONFIG_SERIAL_8250_CONSOLE=y
404CONFIG_SERIAL_8250_NR_UARTS=4
405# CONFIG_SERIAL_8250_EXTENDED is not set
406
407#
408# Non-8250 serial port support
409#
410CONFIG_SERIAL_CORE=y
411CONFIG_SERIAL_CORE_CONSOLE=y
412# CONFIG_UNIX98_PTYS is not set
413CONFIG_LEGACY_PTYS=y
414CONFIG_LEGACY_PTY_COUNT=256
415# CONFIG_QIC02_TAPE is not set
416
417#
418# IPMI
419#
420# CONFIG_IPMI_HANDLER is not set
421
422#
423# Watchdog Cards
424#
425# CONFIG_WATCHDOG is not set
426# CONFIG_NVRAM is not set
427CONFIG_GEN_RTC=y
428# CONFIG_GEN_RTC_X is not set
429# CONFIG_DTLK is not set
430# CONFIG_R3964 is not set
431# CONFIG_APPLICOM is not set
432
433#
434# Ftape, the floppy tape device driver
435#
436# CONFIG_FTAPE is not set
437# CONFIG_AGP is not set
438# CONFIG_DRM is not set
439# CONFIG_RAW_DRIVER is not set
440
441#
442# I2C support
443#
444# CONFIG_I2C is not set
445
446#
447# Misc devices
448#
449
450#
451# Multimedia devices
452#
453# CONFIG_VIDEO_DEV is not set
454
455#
456# Digital Video Broadcasting Devices
457#
458# CONFIG_DVB is not set
459
460#
461# Graphics support
462#
463# CONFIG_FB is not set
464
465#
466# Sound
467#
468# CONFIG_SOUND is not set
469
470#
471# USB support
472#
473# CONFIG_USB is not set
474
475#
476# USB Gadget Support
477#
478# CONFIG_USB_GADGET is not set
479
480#
481# File systems
482#
483CONFIG_EXT2_FS=y
484# CONFIG_EXT2_FS_XATTR is not set
485# CONFIG_EXT3_FS is not set
486# CONFIG_JBD is not set
487# CONFIG_REISERFS_FS is not set
488# CONFIG_JFS_FS is not set
489# CONFIG_XFS_FS is not set
490# CONFIG_MINIX_FS is not set
491# CONFIG_ROMFS_FS is not set
492# CONFIG_QUOTA is not set
493# CONFIG_AUTOFS_FS is not set
494# CONFIG_AUTOFS4_FS is not set
495
496#
497# CD-ROM/DVD Filesystems
498#
499# CONFIG_ISO9660_FS is not set
500# CONFIG_UDF_FS is not set
501
502#
503# DOS/FAT/NT Filesystems
504#
505CONFIG_FAT_FS=y
506CONFIG_MSDOS_FS=y
507# CONFIG_VFAT_FS is not set
508# CONFIG_NTFS_FS is not set
509
510#
511# Pseudo filesystems
512#
513CONFIG_PROC_FS=y
514CONFIG_PROC_KCORE=y
515# CONFIG_DEVFS_FS is not set
516CONFIG_TMPFS=y
517# CONFIG_HUGETLB_PAGE is not set
518CONFIG_RAMFS=y
519
520#
521# Miscellaneous filesystems
522#
523# CONFIG_ADFS_FS is not set
524# CONFIG_AFFS_FS is not set
525# CONFIG_HFS_FS is not set
526# CONFIG_HFSPLUS_FS is not set
527# CONFIG_BEFS_FS is not set
528# CONFIG_BFS_FS is not set
529# CONFIG_EFS_FS is not set
530# CONFIG_CRAMFS is not set
531# CONFIG_VXFS_FS is not set
532# CONFIG_HPFS_FS is not set
533# CONFIG_QNX4FS_FS is not set
534# CONFIG_SYSV_FS is not set
535# CONFIG_UFS_FS is not set
536
537#
538# Network File Systems
539#
540CONFIG_NFS_FS=y
541CONFIG_NFS_V3=y
542# CONFIG_NFS_V4 is not set
543# CONFIG_NFS_DIRECTIO is not set
544# CONFIG_NFSD is not set
545CONFIG_ROOT_NFS=y
546CONFIG_LOCKD=y
547CONFIG_LOCKD_V4=y
548# CONFIG_EXPORTFS is not set
549CONFIG_SUNRPC=y
550# CONFIG_RPCSEC_GSS_KRB5 is not set
551# CONFIG_SMB_FS is not set
552# CONFIG_CIFS is not set
553# CONFIG_NCP_FS is not set
554# CONFIG_CODA_FS is not set
555# CONFIG_INTERMEZZO_FS is not set
556# CONFIG_AFS_FS is not set
557
558#
559# Partition Types
560#
561# CONFIG_PARTITION_ADVANCED is not set
562CONFIG_MSDOS_PARTITION=y
563
564#
565# Native Language Support
566#
567CONFIG_NLS=y
568CONFIG_NLS_DEFAULT="iso8859-1"
569# CONFIG_NLS_CODEPAGE_437 is not set
570# CONFIG_NLS_CODEPAGE_737 is not set
571# CONFIG_NLS_CODEPAGE_775 is not set
572# CONFIG_NLS_CODEPAGE_850 is not set
573# CONFIG_NLS_CODEPAGE_852 is not set
574# CONFIG_NLS_CODEPAGE_855 is not set
575# CONFIG_NLS_CODEPAGE_857 is not set
576# CONFIG_NLS_CODEPAGE_860 is not set
577# CONFIG_NLS_CODEPAGE_861 is not set
578# CONFIG_NLS_CODEPAGE_862 is not set
579# CONFIG_NLS_CODEPAGE_863 is not set
580# CONFIG_NLS_CODEPAGE_864 is not set
581# CONFIG_NLS_CODEPAGE_865 is not set
582# CONFIG_NLS_CODEPAGE_866 is not set
583# CONFIG_NLS_CODEPAGE_869 is not set
584# CONFIG_NLS_CODEPAGE_936 is not set
585# CONFIG_NLS_CODEPAGE_950 is not set
586# CONFIG_NLS_CODEPAGE_932 is not set
587# CONFIG_NLS_CODEPAGE_949 is not set
588# CONFIG_NLS_CODEPAGE_874 is not set
589# CONFIG_NLS_ISO8859_8 is not set
590# CONFIG_NLS_CODEPAGE_1250 is not set
591# CONFIG_NLS_CODEPAGE_1251 is not set
592CONFIG_NLS_ISO8859_1=y
593# CONFIG_NLS_ISO8859_2 is not set
594# CONFIG_NLS_ISO8859_3 is not set
595# CONFIG_NLS_ISO8859_4 is not set
596# CONFIG_NLS_ISO8859_5 is not set
597# CONFIG_NLS_ISO8859_6 is not set
598# CONFIG_NLS_ISO8859_7 is not set
599# CONFIG_NLS_ISO8859_9 is not set
600# CONFIG_NLS_ISO8859_13 is not set
601# CONFIG_NLS_ISO8859_14 is not set
602# CONFIG_NLS_ISO8859_15 is not set
603# CONFIG_NLS_KOI8_R is not set
604# CONFIG_NLS_KOI8_U is not set
605# CONFIG_NLS_UTF8 is not set
606
607#
608# IBM 40x options
609#
610
611#
612# Library routines
613#
614CONFIG_CRC32=y
615
616#
617# Kernel hacking
618#
619# CONFIG_DEBUG_KERNEL is not set
620# CONFIG_SERIAL_TEXT_DEBUG is not set
621CONFIG_OCP=y
622
623#
624# Security options
625#
626# CONFIG_SECURITY is not set
627
628#
629# Cryptographic options
630#
631# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/cpci690_defconfig b/arch/ppc/configs/cpci690_defconfig
new file mode 100644
index 000000000000..53948793d9af
--- /dev/null
+++ b/arch/ppc/configs/cpci690_defconfig
@@ -0,0 +1,686 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.10-rc2
4# Fri Dec 3 15:56:10 2004
5#
6CONFIG_MMU=y
7CONFIG_GENERIC_HARDIRQS=y
8CONFIG_RWSEM_XCHGADD_ALGORITHM=y
9CONFIG_HAVE_DEC_LOCK=y
10CONFIG_PPC=y
11CONFIG_PPC32=y
12CONFIG_GENERIC_NVRAM=y
13
14#
15# Code maturity level options
16#
17CONFIG_EXPERIMENTAL=y
18CONFIG_CLEAN_COMPILE=y
19CONFIG_BROKEN_ON_SMP=y
20
21#
22# General setup
23#
24CONFIG_LOCALVERSION=""
25# CONFIG_SWAP is not set
26CONFIG_SYSVIPC=y
27# CONFIG_POSIX_MQUEUE is not set
28# CONFIG_BSD_PROCESS_ACCT is not set
29CONFIG_SYSCTL=y
30# CONFIG_AUDIT is not set
31CONFIG_LOG_BUF_SHIFT=14
32# CONFIG_HOTPLUG is not set
33CONFIG_KOBJECT_UEVENT=y
34# CONFIG_IKCONFIG is not set
35# CONFIG_EMBEDDED is not set
36CONFIG_KALLSYMS=y
37# CONFIG_KALLSYMS_EXTRA_PASS is not set
38CONFIG_FUTEX=y
39CONFIG_EPOLL=y
40# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
41CONFIG_SHMEM=y
42CONFIG_CC_ALIGN_FUNCTIONS=0
43CONFIG_CC_ALIGN_LABELS=0
44CONFIG_CC_ALIGN_LOOPS=0
45CONFIG_CC_ALIGN_JUMPS=0
46# CONFIG_TINY_SHMEM is not set
47
48#
49# Loadable module support
50#
51CONFIG_MODULES=y
52CONFIG_MODULE_UNLOAD=y
53# CONFIG_MODULE_FORCE_UNLOAD is not set
54CONFIG_OBSOLETE_MODPARM=y
55# CONFIG_MODVERSIONS is not set
56# CONFIG_MODULE_SRCVERSION_ALL is not set
57CONFIG_KMOD=y
58
59#
60# Processor
61#
62CONFIG_6xx=y
63# CONFIG_40x is not set
64# CONFIG_44x is not set
65# CONFIG_POWER3 is not set
66# CONFIG_POWER4 is not set
67# CONFIG_8xx is not set
68# CONFIG_E500 is not set
69CONFIG_ALTIVEC=y
70# CONFIG_TAU is not set
71# CONFIG_CPU_FREQ is not set
72CONFIG_PPC_STD_MMU=y
73# CONFIG_NOT_COHERENT_CACHE is not set
74
75#
76# Platform options
77#
78# CONFIG_PPC_MULTIPLATFORM is not set
79# CONFIG_APUS is not set
80# CONFIG_KATANA is not set
81# CONFIG_DMV182 is not set
82# CONFIG_WILLOW is not set
83CONFIG_CPCI690=y
84# CONFIG_PCORE is not set
85# CONFIG_POWERPMC250 is not set
86# CONFIG_EV64260 is not set
87# CONFIG_DB64360 is not set
88# CONFIG_CHESTNUT is not set
89# CONFIG_SPRUCE is not set
90# CONFIG_LOPEC is not set
91# CONFIG_MCPN765 is not set
92# CONFIG_MVME5100 is not set
93# CONFIG_PPLUS is not set
94# CONFIG_PRPMC750 is not set
95# CONFIG_PRPMC800 is not set
96# CONFIG_PRPMC880 is not set
97# CONFIG_SANDPOINT is not set
98# CONFIG_ADIR is not set
99# CONFIG_K2 is not set
100# CONFIG_PAL4 is not set
101# CONFIG_GEMINI is not set
102# CONFIG_EST8260 is not set
103# CONFIG_SBC82xx is not set
104# CONFIG_SBS8260 is not set
105# CONFIG_RPX8260 is not set
106# CONFIG_TQM8260 is not set
107# CONFIG_ADS8272 is not set
108# CONFIG_LITE5200 is not set
109
110#
111# Set bridge options
112#
113CONFIG_MV64X60_BASE=0xf1000000
114CONFIG_MV64X60_NEW_BASE=0xf1000000
115CONFIG_GT64260=y
116CONFIG_MV64X60=y
117# CONFIG_SMP is not set
118# CONFIG_PREEMPT is not set
119# CONFIG_HIGHMEM is not set
120CONFIG_BINFMT_ELF=y
121CONFIG_BINFMT_MISC=y
122CONFIG_CMDLINE_BOOL=y
123CONFIG_CMDLINE="console=ttyMM0,9600 ip=on"
124
125#
126# Bus options
127#
128CONFIG_GENERIC_ISA_DMA=y
129CONFIG_PCI=y
130CONFIG_PCI_DOMAINS=y
131CONFIG_PCI_LEGACY_PROC=y
132CONFIG_PCI_NAMES=y
133
134#
135# Advanced setup
136#
137# CONFIG_ADVANCED_OPTIONS is not set
138
139#
140# Default settings for advanced configuration options are used
141#
142CONFIG_HIGHMEM_START=0xfe000000
143CONFIG_LOWMEM_SIZE=0x30000000
144CONFIG_KERNEL_START=0xc0000000
145CONFIG_TASK_SIZE=0x80000000
146CONFIG_BOOT_LOAD=0x00800000
147
148#
149# Device Drivers
150#
151
152#
153# Generic Driver Options
154#
155CONFIG_STANDALONE=y
156CONFIG_PREVENT_FIRMWARE_BUILD=y
157
158#
159# Memory Technology Devices (MTD)
160#
161# CONFIG_MTD is not set
162
163#
164# Parallel port support
165#
166# CONFIG_PARPORT is not set
167
168#
169# Plug and Play support
170#
171
172#
173# Block devices
174#
175# CONFIG_BLK_DEV_FD is not set
176# CONFIG_BLK_CPQ_DA is not set
177# CONFIG_BLK_CPQ_CISS_DA is not set
178# CONFIG_BLK_DEV_DAC960 is not set
179# CONFIG_BLK_DEV_UMEM is not set
180CONFIG_BLK_DEV_LOOP=y
181# CONFIG_BLK_DEV_CRYPTOLOOP is not set
182# CONFIG_BLK_DEV_NBD is not set
183# CONFIG_BLK_DEV_SX8 is not set
184CONFIG_BLK_DEV_RAM=y
185CONFIG_BLK_DEV_RAM_COUNT=16
186CONFIG_BLK_DEV_RAM_SIZE=4096
187CONFIG_BLK_DEV_INITRD=y
188CONFIG_INITRAMFS_SOURCE=""
189# CONFIG_LBD is not set
190# CONFIG_CDROM_PKTCDVD is not set
191
192#
193# IO Schedulers
194#
195CONFIG_IOSCHED_NOOP=y
196CONFIG_IOSCHED_AS=y
197CONFIG_IOSCHED_DEADLINE=y
198CONFIG_IOSCHED_CFQ=y
199
200#
201# ATA/ATAPI/MFM/RLL support
202#
203# CONFIG_IDE is not set
204
205#
206# SCSI device support
207#
208# CONFIG_SCSI is not set
209
210#
211# Multi-device support (RAID and LVM)
212#
213# CONFIG_MD is not set
214
215#
216# Fusion MPT device support
217#
218
219#
220# IEEE 1394 (FireWire) support
221#
222# CONFIG_IEEE1394 is not set
223
224#
225# I2O device support
226#
227# CONFIG_I2O is not set
228
229#
230# Macintosh device drivers
231#
232
233#
234# Networking support
235#
236CONFIG_NET=y
237
238#
239# Networking options
240#
241CONFIG_PACKET=y
242# CONFIG_PACKET_MMAP is not set
243# CONFIG_NETLINK_DEV is not set
244CONFIG_UNIX=y
245# CONFIG_NET_KEY is not set
246CONFIG_INET=y
247CONFIG_IP_MULTICAST=y
248# CONFIG_IP_ADVANCED_ROUTER is not set
249CONFIG_IP_PNP=y
250CONFIG_IP_PNP_DHCP=y
251# CONFIG_IP_PNP_BOOTP is not set
252# CONFIG_IP_PNP_RARP is not set
253# CONFIG_NET_IPIP is not set
254# CONFIG_NET_IPGRE is not set
255# CONFIG_IP_MROUTE is not set
256# CONFIG_ARPD is not set
257CONFIG_SYN_COOKIES=y
258# CONFIG_INET_AH is not set
259# CONFIG_INET_ESP is not set
260# CONFIG_INET_IPCOMP is not set
261# CONFIG_INET_TUNNEL is not set
262CONFIG_IP_TCPDIAG=y
263# CONFIG_IP_TCPDIAG_IPV6 is not set
264# CONFIG_IPV6 is not set
265# CONFIG_NETFILTER is not set
266
267#
268# SCTP Configuration (EXPERIMENTAL)
269#
270# CONFIG_IP_SCTP is not set
271# CONFIG_ATM is not set
272# CONFIG_BRIDGE is not set
273# CONFIG_VLAN_8021Q is not set
274# CONFIG_DECNET is not set
275# CONFIG_LLC2 is not set
276# CONFIG_IPX is not set
277# CONFIG_ATALK is not set
278# CONFIG_X25 is not set
279# CONFIG_LAPB is not set
280# CONFIG_NET_DIVERT is not set
281# CONFIG_ECONET is not set
282# CONFIG_WAN_ROUTER is not set
283
284#
285# QoS and/or fair queueing
286#
287# CONFIG_NET_SCHED is not set
288# CONFIG_NET_CLS_ROUTE is not set
289
290#
291# Network testing
292#
293# CONFIG_NET_PKTGEN is not set
294# CONFIG_NETPOLL is not set
295# CONFIG_NET_POLL_CONTROLLER is not set
296# CONFIG_HAMRADIO is not set
297# CONFIG_IRDA is not set
298# CONFIG_BT is not set
299CONFIG_NETDEVICES=y
300# CONFIG_DUMMY is not set
301# CONFIG_BONDING is not set
302# CONFIG_EQUALIZER is not set
303# CONFIG_TUN is not set
304
305#
306# ARCnet devices
307#
308# CONFIG_ARCNET is not set
309
310#
311# Ethernet (10 or 100Mbit)
312#
313CONFIG_NET_ETHERNET=y
314CONFIG_MII=y
315# CONFIG_HAPPYMEAL is not set
316# CONFIG_SUNGEM is not set
317# CONFIG_NET_VENDOR_3COM is not set
318
319#
320# Tulip family network device support
321#
322CONFIG_NET_TULIP=y
323# CONFIG_DE2104X is not set
324CONFIG_TULIP=y
325# CONFIG_TULIP_MWI is not set
326# CONFIG_TULIP_MMIO is not set
327# CONFIG_TULIP_NAPI is not set
328# CONFIG_DE4X5 is not set
329# CONFIG_WINBOND_840 is not set
330# CONFIG_DM9102 is not set
331# CONFIG_HP100 is not set
332CONFIG_NET_PCI=y
333# CONFIG_PCNET32 is not set
334# CONFIG_AMD8111_ETH is not set
335# CONFIG_ADAPTEC_STARFIRE is not set
336# CONFIG_B44 is not set
337# CONFIG_FORCEDETH is not set
338# CONFIG_DGRS is not set
339CONFIG_EEPRO100=y
340# CONFIG_EEPRO100_PIO is not set
341# CONFIG_E100 is not set
342# CONFIG_FEALNX is not set
343# CONFIG_NATSEMI is not set
344# CONFIG_NE2K_PCI is not set
345# CONFIG_8139CP is not set
346# CONFIG_8139TOO is not set
347# CONFIG_SIS900 is not set
348# CONFIG_EPIC100 is not set
349# CONFIG_SUNDANCE is not set
350# CONFIG_TLAN is not set
351# CONFIG_VIA_RHINE is not set
352
353#
354# Ethernet (1000 Mbit)
355#
356# CONFIG_ACENIC is not set
357# CONFIG_DL2K is not set
358# CONFIG_E1000 is not set
359# CONFIG_NS83820 is not set
360# CONFIG_HAMACHI is not set
361# CONFIG_YELLOWFIN is not set
362# CONFIG_R8169 is not set
363# CONFIG_SK98LIN is not set
364# CONFIG_VIA_VELOCITY is not set
365# CONFIG_TIGON3 is not set
366
367#
368# Ethernet (10000 Mbit)
369#
370# CONFIG_IXGB is not set
371# CONFIG_S2IO is not set
372
373#
374# Token Ring devices
375#
376# CONFIG_TR is not set
377
378#
379# Wireless LAN (non-hamradio)
380#
381# CONFIG_NET_RADIO is not set
382
383#
384# Wan interfaces
385#
386# CONFIG_WAN is not set
387# CONFIG_FDDI is not set
388# CONFIG_HIPPI is not set
389# CONFIG_PPP is not set
390# CONFIG_SLIP is not set
391# CONFIG_SHAPER is not set
392# CONFIG_NETCONSOLE is not set
393
394#
395# ISDN subsystem
396#
397# CONFIG_ISDN is not set
398
399#
400# Telephony Support
401#
402# CONFIG_PHONE is not set
403
404#
405# Input device support
406#
407CONFIG_INPUT=y
408
409#
410# Userland interfaces
411#
412CONFIG_INPUT_MOUSEDEV=y
413CONFIG_INPUT_MOUSEDEV_PSAUX=y
414CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
415CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
416# CONFIG_INPUT_JOYDEV is not set
417# CONFIG_INPUT_TSDEV is not set
418# CONFIG_INPUT_EVDEV is not set
419# CONFIG_INPUT_EVBUG is not set
420
421#
422# Input I/O drivers
423#
424# CONFIG_GAMEPORT is not set
425CONFIG_SOUND_GAMEPORT=y
426# CONFIG_SERIO is not set
427# CONFIG_SERIO_I8042 is not set
428
429#
430# Input Device Drivers
431#
432# CONFIG_INPUT_KEYBOARD is not set
433# CONFIG_INPUT_MOUSE is not set
434# CONFIG_INPUT_JOYSTICK is not set
435# CONFIG_INPUT_TOUCHSCREEN is not set
436# CONFIG_INPUT_MISC is not set
437
438#
439# Character devices
440#
441CONFIG_VT=y
442CONFIG_VT_CONSOLE=y
443CONFIG_HW_CONSOLE=y
444# CONFIG_SERIAL_NONSTANDARD is not set
445
446#
447# Serial drivers
448#
449# CONFIG_SERIAL_8250 is not set
450
451#
452# Non-8250 serial port support
453#
454CONFIG_SERIAL_MPSC=y
455CONFIG_SERIAL_MPSC_CONSOLE=y
456CONFIG_SERIAL_CORE=y
457CONFIG_SERIAL_CORE_CONSOLE=y
458CONFIG_UNIX98_PTYS=y
459CONFIG_LEGACY_PTYS=y
460CONFIG_LEGACY_PTY_COUNT=256
461
462#
463# IPMI
464#
465# CONFIG_IPMI_HANDLER is not set
466
467#
468# Watchdog Cards
469#
470# CONFIG_WATCHDOG is not set
471# CONFIG_NVRAM is not set
472CONFIG_GEN_RTC=y
473# CONFIG_GEN_RTC_X is not set
474# CONFIG_DTLK is not set
475# CONFIG_R3964 is not set
476# CONFIG_APPLICOM is not set
477
478#
479# Ftape, the floppy tape device driver
480#
481# CONFIG_AGP is not set
482# CONFIG_DRM is not set
483# CONFIG_RAW_DRIVER is not set
484
485#
486# I2C support
487#
488# CONFIG_I2C is not set
489
490#
491# Dallas's 1-wire bus
492#
493# CONFIG_W1 is not set
494
495#
496# Misc devices
497#
498
499#
500# Multimedia devices
501#
502# CONFIG_VIDEO_DEV is not set
503
504#
505# Digital Video Broadcasting Devices
506#
507# CONFIG_DVB is not set
508
509#
510# Graphics support
511#
512# CONFIG_FB is not set
513
514#
515# Console display driver support
516#
517# CONFIG_VGA_CONSOLE is not set
518CONFIG_DUMMY_CONSOLE=y
519
520#
521# Sound
522#
523# CONFIG_SOUND is not set
524
525#
526# USB support
527#
528# CONFIG_USB is not set
529CONFIG_USB_ARCH_HAS_HCD=y
530CONFIG_USB_ARCH_HAS_OHCI=y
531
532#
533# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
534#
535
536#
537# USB Gadget Support
538#
539# CONFIG_USB_GADGET is not set
540
541#
542# File systems
543#
544CONFIG_EXT2_FS=y
545# CONFIG_EXT2_FS_XATTR is not set
546# CONFIG_EXT3_FS is not set
547# CONFIG_JBD is not set
548# CONFIG_REISERFS_FS is not set
549# CONFIG_JFS_FS is not set
550# CONFIG_XFS_FS is not set
551# CONFIG_MINIX_FS is not set
552# CONFIG_ROMFS_FS is not set
553# CONFIG_QUOTA is not set
554CONFIG_DNOTIFY=y
555# CONFIG_AUTOFS_FS is not set
556# CONFIG_AUTOFS4_FS is not set
557
558#
559# CD-ROM/DVD Filesystems
560#
561# CONFIG_ISO9660_FS is not set
562# CONFIG_UDF_FS is not set
563
564#
565# DOS/FAT/NT Filesystems
566#
567# CONFIG_MSDOS_FS is not set
568# CONFIG_VFAT_FS is not set
569# CONFIG_NTFS_FS is not set
570
571#
572# Pseudo filesystems
573#
574CONFIG_PROC_FS=y
575CONFIG_PROC_KCORE=y
576CONFIG_SYSFS=y
577CONFIG_DEVFS_FS=y
578# CONFIG_DEVFS_MOUNT is not set
579# CONFIG_DEVFS_DEBUG is not set
580# CONFIG_DEVPTS_FS_XATTR is not set
581CONFIG_TMPFS=y
582# CONFIG_TMPFS_XATTR is not set
583# CONFIG_HUGETLB_PAGE is not set
584CONFIG_RAMFS=y
585
586#
587# Miscellaneous filesystems
588#
589# CONFIG_ADFS_FS is not set
590# CONFIG_AFFS_FS is not set
591# CONFIG_HFS_FS is not set
592# CONFIG_HFSPLUS_FS is not set
593# CONFIG_BEFS_FS is not set
594# CONFIG_BFS_FS is not set
595# CONFIG_EFS_FS is not set
596# CONFIG_CRAMFS is not set
597# CONFIG_VXFS_FS is not set
598# CONFIG_HPFS_FS is not set
599# CONFIG_QNX4FS_FS is not set
600# CONFIG_SYSV_FS is not set
601# CONFIG_UFS_FS is not set
602
603#
604# Network File Systems
605#
606CONFIG_NFS_FS=y
607CONFIG_NFS_V3=y
608CONFIG_NFS_V4=y
609# CONFIG_NFS_DIRECTIO is not set
610# CONFIG_NFSD is not set
611CONFIG_ROOT_NFS=y
612CONFIG_LOCKD=y
613CONFIG_LOCKD_V4=y
614# CONFIG_EXPORTFS is not set
615CONFIG_SUNRPC=y
616CONFIG_SUNRPC_GSS=y
617CONFIG_RPCSEC_GSS_KRB5=y
618# CONFIG_RPCSEC_GSS_SPKM3 is not set
619# CONFIG_SMB_FS is not set
620# CONFIG_CIFS is not set
621# CONFIG_NCP_FS is not set
622# CONFIG_CODA_FS is not set
623# CONFIG_AFS_FS is not set
624
625#
626# Partition Types
627#
628# CONFIG_PARTITION_ADVANCED is not set
629CONFIG_MSDOS_PARTITION=y
630
631#
632# Native Language Support
633#
634# CONFIG_NLS is not set
635
636#
637# Library routines
638#
639# CONFIG_CRC_CCITT is not set
640CONFIG_CRC32=y
641# CONFIG_LIBCRC32C is not set
642
643#
644# Profiling support
645#
646# CONFIG_PROFILING is not set
647
648#
649# Kernel hacking
650#
651# CONFIG_DEBUG_KERNEL is not set
652# CONFIG_SERIAL_TEXT_DEBUG is not set
653
654#
655# Security options
656#
657# CONFIG_KEYS is not set
658# CONFIG_SECURITY is not set
659
660#
661# Cryptographic options
662#
663CONFIG_CRYPTO=y
664# CONFIG_CRYPTO_HMAC is not set
665# CONFIG_CRYPTO_NULL is not set
666# CONFIG_CRYPTO_MD4 is not set
667CONFIG_CRYPTO_MD5=y
668# CONFIG_CRYPTO_SHA1 is not set
669# CONFIG_CRYPTO_SHA256 is not set
670# CONFIG_CRYPTO_SHA512 is not set
671# CONFIG_CRYPTO_WP512 is not set
672CONFIG_CRYPTO_DES=y
673# CONFIG_CRYPTO_BLOWFISH is not set
674# CONFIG_CRYPTO_TWOFISH is not set
675# CONFIG_CRYPTO_SERPENT is not set
676# CONFIG_CRYPTO_AES is not set
677# CONFIG_CRYPTO_CAST5 is not set
678# CONFIG_CRYPTO_CAST6 is not set
679# CONFIG_CRYPTO_TEA is not set
680# CONFIG_CRYPTO_ARC4 is not set
681# CONFIG_CRYPTO_KHAZAD is not set
682# CONFIG_CRYPTO_ANUBIS is not set
683# CONFIG_CRYPTO_DEFLATE is not set
684# CONFIG_CRYPTO_MICHAEL_MIC is not set
685# CONFIG_CRYPTO_CRC32C is not set
686# CONFIG_CRYPTO_TEST is not set
diff --git a/arch/ppc/configs/ebony_defconfig b/arch/ppc/configs/ebony_defconfig
new file mode 100644
index 000000000000..c8deca3b4545
--- /dev/null
+++ b/arch/ppc/configs/ebony_defconfig
@@ -0,0 +1,585 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7CONFIG_PPC=y
8CONFIG_PPC32=y
9CONFIG_GENERIC_NVRAM=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16# CONFIG_STANDALONE is not set
17CONFIG_BROKEN_ON_SMP=y
18
19#
20# General setup
21#
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24CONFIG_POSIX_MQUEUE=y
25# CONFIG_BSD_PROCESS_ACCT is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=14
29# CONFIG_HOTPLUG is not set
30# CONFIG_IKCONFIG is not set
31CONFIG_EMBEDDED=y
32CONFIG_KALLSYMS=y
33# CONFIG_KALLSYMS_ALL is not set
34CONFIG_FUTEX=y
35CONFIG_EPOLL=y
36CONFIG_IOSCHED_NOOP=y
37CONFIG_IOSCHED_AS=y
38CONFIG_IOSCHED_DEADLINE=y
39CONFIG_IOSCHED_CFQ=y
40# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
41
42#
43# Loadable module support
44#
45CONFIG_MODULES=y
46# CONFIG_MODULE_UNLOAD is not set
47CONFIG_OBSOLETE_MODPARM=y
48# CONFIG_MODVERSIONS is not set
49CONFIG_KMOD=y
50
51#
52# Processor
53#
54# CONFIG_6xx is not set
55# CONFIG_40x is not set
56CONFIG_44x=y
57# CONFIG_POWER3 is not set
58# CONFIG_POWER4 is not set
59# CONFIG_8xx is not set
60# CONFIG_E500 is not set
61CONFIG_BOOKE=y
62CONFIG_PTE_64BIT=y
63# CONFIG_MATH_EMULATION is not set
64# CONFIG_CPU_FREQ is not set
65CONFIG_4xx=y
66
67#
68# IBM 4xx options
69#
70CONFIG_EBONY=y
71# CONFIG_OCOTEA is not set
72CONFIG_440GP=y
73CONFIG_440=y
74CONFIG_IBM_OCP=y
75# CONFIG_PM is not set
76CONFIG_NOT_COHERENT_CACHE=y
77
78#
79# Platform options
80#
81# CONFIG_PC_KEYBOARD is not set
82# CONFIG_SMP is not set
83# CONFIG_PREEMPT is not set
84# CONFIG_HIGHMEM is not set
85CONFIG_KERNEL_ELF=y
86CONFIG_BINFMT_ELF=y
87# CONFIG_BINFMT_MISC is not set
88CONFIG_CMDLINE_BOOL=y
89CONFIG_CMDLINE="ip=on"
90
91#
92# Bus options
93#
94CONFIG_PCI=y
95CONFIG_PCI_DOMAINS=y
96# CONFIG_PCI_LEGACY_PROC is not set
97# CONFIG_PCI_NAMES is not set
98
99#
100# Advanced setup
101#
102# CONFIG_ADVANCED_OPTIONS is not set
103
104#
105# Default settings for advanced configuration options are used
106#
107CONFIG_HIGHMEM_START=0xfe000000
108CONFIG_LOWMEM_SIZE=0x30000000
109CONFIG_KERNEL_START=0xc0000000
110CONFIG_TASK_SIZE=0x80000000
111CONFIG_CONSISTENT_START=0xff100000
112CONFIG_CONSISTENT_SIZE=0x00200000
113CONFIG_BOOT_LOAD=0x01000000
114
115#
116# Device Drivers
117#
118
119#
120# Generic Driver Options
121#
122CONFIG_PREVENT_FIRMWARE_BUILD=y
123# CONFIG_DEBUG_DRIVER is not set
124
125#
126# Memory Technology Devices (MTD)
127#
128# CONFIG_MTD is not set
129
130#
131# Parallel port support
132#
133# CONFIG_PARPORT is not set
134
135#
136# Plug and Play support
137#
138
139#
140# Block devices
141#
142# CONFIG_BLK_DEV_FD is not set
143# CONFIG_BLK_CPQ_DA is not set
144# CONFIG_BLK_CPQ_CISS_DA is not set
145# CONFIG_BLK_DEV_DAC960 is not set
146# CONFIG_BLK_DEV_UMEM is not set
147# CONFIG_BLK_DEV_LOOP is not set
148# CONFIG_BLK_DEV_NBD is not set
149# CONFIG_BLK_DEV_SX8 is not set
150# CONFIG_BLK_DEV_RAM is not set
151CONFIG_LBD=y
152
153#
154# ATA/ATAPI/MFM/RLL support
155#
156# CONFIG_IDE is not set
157
158#
159# SCSI device support
160#
161# CONFIG_SCSI is not set
162
163#
164# Multi-device support (RAID and LVM)
165#
166# CONFIG_MD is not set
167
168#
169# Fusion MPT device support
170#
171
172#
173# IEEE 1394 (FireWire) support
174#
175# CONFIG_IEEE1394 is not set
176
177#
178# I2O device support
179#
180# CONFIG_I2O is not set
181
182#
183# Macintosh device drivers
184#
185
186#
187# Networking support
188#
189CONFIG_NET=y
190
191#
192# Networking options
193#
194CONFIG_PACKET=y
195# CONFIG_PACKET_MMAP is not set
196# CONFIG_NETLINK_DEV is not set
197CONFIG_UNIX=y
198# CONFIG_NET_KEY is not set
199CONFIG_INET=y
200# CONFIG_IP_MULTICAST is not set
201# CONFIG_IP_ADVANCED_ROUTER is not set
202CONFIG_IP_PNP=y
203# CONFIG_IP_PNP_DHCP is not set
204CONFIG_IP_PNP_BOOTP=y
205# CONFIG_IP_PNP_RARP is not set
206# CONFIG_NET_IPIP is not set
207# CONFIG_NET_IPGRE is not set
208# CONFIG_ARPD is not set
209# CONFIG_SYN_COOKIES is not set
210# CONFIG_INET_AH is not set
211# CONFIG_INET_ESP is not set
212# CONFIG_INET_IPCOMP is not set
213
214#
215# IP: Virtual Server Configuration
216#
217# CONFIG_IP_VS is not set
218# CONFIG_IPV6 is not set
219CONFIG_NETFILTER=y
220# CONFIG_NETFILTER_DEBUG is not set
221
222#
223# IP: Netfilter Configuration
224#
225# CONFIG_IP_NF_CONNTRACK is not set
226# CONFIG_IP_NF_QUEUE is not set
227# CONFIG_IP_NF_IPTABLES is not set
228# CONFIG_IP_NF_ARPTABLES is not set
229# CONFIG_IP_NF_COMPAT_IPCHAINS is not set
230# CONFIG_IP_NF_COMPAT_IPFWADM is not set
231
232#
233# SCTP Configuration (EXPERIMENTAL)
234#
235# CONFIG_IP_SCTP is not set
236# CONFIG_ATM is not set
237# CONFIG_BRIDGE is not set
238# CONFIG_VLAN_8021Q is not set
239# CONFIG_DECNET is not set
240# CONFIG_LLC2 is not set
241# CONFIG_IPX is not set
242# CONFIG_ATALK is not set
243# CONFIG_X25 is not set
244# CONFIG_LAPB is not set
245# CONFIG_NET_DIVERT is not set
246# CONFIG_ECONET is not set
247# CONFIG_WAN_ROUTER is not set
248# CONFIG_NET_HW_FLOWCONTROL is not set
249
250#
251# QoS and/or fair queueing
252#
253# CONFIG_NET_SCHED is not set
254# CONFIG_NET_CLS_ROUTE is not set
255
256#
257# Network testing
258#
259# CONFIG_NET_PKTGEN is not set
260# CONFIG_NETPOLL is not set
261# CONFIG_NET_POLL_CONTROLLER is not set
262# CONFIG_HAMRADIO is not set
263# CONFIG_IRDA is not set
264# CONFIG_BT is not set
265CONFIG_NETDEVICES=y
266# CONFIG_DUMMY is not set
267# CONFIG_BONDING is not set
268# CONFIG_EQUALIZER is not set
269# CONFIG_TUN is not set
270
271#
272# ARCnet devices
273#
274# CONFIG_ARCNET is not set
275
276#
277# Ethernet (10 or 100Mbit)
278#
279# CONFIG_NET_ETHERNET is not set
280CONFIG_IBM_EMAC=y
281# CONFIG_IBM_EMAC_ERRMSG is not set
282CONFIG_IBM_EMAC_RXB=64
283CONFIG_IBM_EMAC_TXB=8
284CONFIG_IBM_EMAC_FGAP=8
285CONFIG_IBM_EMAC_SKBRES=0
286
287#
288# Ethernet (1000 Mbit)
289#
290# CONFIG_ACENIC is not set
291# CONFIG_DL2K is not set
292# CONFIG_E1000 is not set
293# CONFIG_NS83820 is not set
294# CONFIG_HAMACHI is not set
295# CONFIG_YELLOWFIN is not set
296# CONFIG_R8169 is not set
297# CONFIG_SK98LIN is not set
298# CONFIG_TIGON3 is not set
299
300#
301# Ethernet (10000 Mbit)
302#
303# CONFIG_IXGB is not set
304# CONFIG_S2IO is not set
305
306#
307# Token Ring devices
308#
309# CONFIG_TR is not set
310
311#
312# Wireless LAN (non-hamradio)
313#
314# CONFIG_NET_RADIO is not set
315
316#
317# Wan interfaces
318#
319# CONFIG_WAN is not set
320# CONFIG_FDDI is not set
321# CONFIG_HIPPI is not set
322# CONFIG_PPP is not set
323# CONFIG_SLIP is not set
324# CONFIG_SHAPER is not set
325# CONFIG_NETCONSOLE is not set
326
327#
328# ISDN subsystem
329#
330# CONFIG_ISDN is not set
331
332#
333# Telephony Support
334#
335# CONFIG_PHONE is not set
336
337#
338# Input device support
339#
340CONFIG_INPUT=y
341
342#
343# Userland interfaces
344#
345CONFIG_INPUT_MOUSEDEV=y
346CONFIG_INPUT_MOUSEDEV_PSAUX=y
347CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
348CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
349# CONFIG_INPUT_JOYDEV is not set
350# CONFIG_INPUT_TSDEV is not set
351# CONFIG_INPUT_EVDEV is not set
352# CONFIG_INPUT_EVBUG is not set
353
354#
355# Input I/O drivers
356#
357# CONFIG_GAMEPORT is not set
358CONFIG_SOUND_GAMEPORT=y
359CONFIG_SERIO=y
360# CONFIG_SERIO_I8042 is not set
361# CONFIG_SERIO_SERPORT is not set
362# CONFIG_SERIO_CT82C710 is not set
363# CONFIG_SERIO_PCIPS2 is not set
364
365#
366# Input Device Drivers
367#
368# CONFIG_INPUT_KEYBOARD is not set
369# CONFIG_INPUT_MOUSE is not set
370# CONFIG_INPUT_JOYSTICK is not set
371# CONFIG_INPUT_TOUCHSCREEN is not set
372# CONFIG_INPUT_MISC is not set
373
374#
375# Character devices
376#
377# CONFIG_VT is not set
378# CONFIG_SERIAL_NONSTANDARD is not set
379
380#
381# Serial drivers
382#
383CONFIG_SERIAL_8250=y
384CONFIG_SERIAL_8250_CONSOLE=y
385CONFIG_SERIAL_8250_NR_UARTS=4
386CONFIG_SERIAL_8250_EXTENDED=y
387# CONFIG_SERIAL_8250_MANY_PORTS is not set
388CONFIG_SERIAL_8250_SHARE_IRQ=y
389# CONFIG_SERIAL_8250_DETECT_IRQ is not set
390# CONFIG_SERIAL_8250_MULTIPORT is not set
391# CONFIG_SERIAL_8250_RSA is not set
392
393#
394# Non-8250 serial port support
395#
396CONFIG_SERIAL_CORE=y
397CONFIG_SERIAL_CORE_CONSOLE=y
398CONFIG_UNIX98_PTYS=y
399CONFIG_LEGACY_PTYS=y
400CONFIG_LEGACY_PTY_COUNT=256
401# CONFIG_QIC02_TAPE is not set
402
403#
404# IPMI
405#
406# CONFIG_IPMI_HANDLER is not set
407
408#
409# Watchdog Cards
410#
411# CONFIG_WATCHDOG is not set
412# CONFIG_NVRAM is not set
413# CONFIG_GEN_RTC is not set
414# CONFIG_DTLK is not set
415# CONFIG_R3964 is not set
416# CONFIG_APPLICOM is not set
417
418#
419# Ftape, the floppy tape device driver
420#
421# CONFIG_FTAPE is not set
422# CONFIG_AGP is not set
423# CONFIG_DRM is not set
424# CONFIG_RAW_DRIVER is not set
425
426#
427# I2C support
428#
429# CONFIG_I2C is not set
430
431#
432# Misc devices
433#
434
435#
436# Multimedia devices
437#
438# CONFIG_VIDEO_DEV is not set
439
440#
441# Digital Video Broadcasting Devices
442#
443# CONFIG_DVB is not set
444
445#
446# Graphics support
447#
448# CONFIG_FB is not set
449
450#
451# Sound
452#
453# CONFIG_SOUND is not set
454
455#
456# USB support
457#
458# CONFIG_USB is not set
459
460#
461# USB Gadget Support
462#
463# CONFIG_USB_GADGET is not set
464
465#
466# File systems
467#
468# CONFIG_EXT2_FS is not set
469# CONFIG_EXT3_FS is not set
470# CONFIG_JBD is not set
471# CONFIG_REISERFS_FS is not set
472# CONFIG_JFS_FS is not set
473# CONFIG_XFS_FS is not set
474# CONFIG_MINIX_FS is not set
475# CONFIG_ROMFS_FS is not set
476# CONFIG_QUOTA is not set
477# CONFIG_AUTOFS_FS is not set
478# CONFIG_AUTOFS4_FS is not set
479
480#
481# CD-ROM/DVD Filesystems
482#
483# CONFIG_ISO9660_FS is not set
484# CONFIG_UDF_FS is not set
485
486#
487# DOS/FAT/NT Filesystems
488#
489# CONFIG_FAT_FS is not set
490# CONFIG_NTFS_FS is not set
491
492#
493# Pseudo filesystems
494#
495CONFIG_PROC_FS=y
496CONFIG_PROC_KCORE=y
497CONFIG_SYSFS=y
498# CONFIG_DEVFS_FS is not set
499# CONFIG_DEVPTS_FS_XATTR is not set
500# CONFIG_TMPFS is not set
501# CONFIG_HUGETLB_PAGE is not set
502CONFIG_RAMFS=y
503
504#
505# Miscellaneous filesystems
506#
507# CONFIG_ADFS_FS is not set
508# CONFIG_AFFS_FS is not set
509# CONFIG_HFS_FS is not set
510# CONFIG_HFSPLUS_FS is not set
511# CONFIG_BEFS_FS is not set
512# CONFIG_BFS_FS is not set
513# CONFIG_EFS_FS is not set
514# CONFIG_CRAMFS is not set
515# CONFIG_VXFS_FS is not set
516# CONFIG_HPFS_FS is not set
517# CONFIG_QNX4FS_FS is not set
518# CONFIG_SYSV_FS is not set
519# CONFIG_UFS_FS is not set
520
521#
522# Network File Systems
523#
524CONFIG_NFS_FS=y
525# CONFIG_NFS_V3 is not set
526# CONFIG_NFS_V4 is not set
527# CONFIG_NFS_DIRECTIO is not set
528# CONFIG_NFSD is not set
529CONFIG_ROOT_NFS=y
530CONFIG_LOCKD=y
531# CONFIG_EXPORTFS is not set
532CONFIG_SUNRPC=y
533# CONFIG_RPCSEC_GSS_KRB5 is not set
534# CONFIG_SMB_FS is not set
535# CONFIG_CIFS is not set
536# CONFIG_NCP_FS is not set
537# CONFIG_CODA_FS is not set
538# CONFIG_AFS_FS is not set
539
540#
541# Partition Types
542#
543# CONFIG_PARTITION_ADVANCED is not set
544CONFIG_MSDOS_PARTITION=y
545
546#
547# Native Language Support
548#
549# CONFIG_NLS is not set
550
551#
552# Library routines
553#
554CONFIG_CRC32=y
555# CONFIG_LIBCRC32C is not set
556
557#
558# Profiling support
559#
560# CONFIG_PROFILING is not set
561
562#
563# Kernel hacking
564#
565CONFIG_DEBUG_KERNEL=y
566# CONFIG_DEBUG_SLAB is not set
567# CONFIG_MAGIC_SYSRQ is not set
568# CONFIG_DEBUG_SPINLOCK is not set
569# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
570# CONFIG_KGDB is not set
571# CONFIG_XMON is not set
572CONFIG_BDI_SWITCH=y
573# CONFIG_DEBUG_INFO is not set
574# CONFIG_SERIAL_TEXT_DEBUG is not set
575CONFIG_PPC_OCP=y
576
577#
578# Security options
579#
580# CONFIG_SECURITY is not set
581
582#
583# Cryptographic options
584#
585# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/ep405_defconfig b/arch/ppc/configs/ep405_defconfig
new file mode 100644
index 000000000000..880b5f8d30c3
--- /dev/null
+++ b/arch/ppc/configs/ep405_defconfig
@@ -0,0 +1,572 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7CONFIG_PPC=y
8CONFIG_PPC32=y
9CONFIG_GENERIC_NVRAM=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16# CONFIG_STANDALONE is not set
17CONFIG_BROKEN_ON_SMP=y
18
19#
20# General setup
21#
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24CONFIG_POSIX_MQUEUE=y
25# CONFIG_BSD_PROCESS_ACCT is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=14
29# CONFIG_HOTPLUG is not set
30# CONFIG_IKCONFIG is not set
31CONFIG_EMBEDDED=y
32CONFIG_KALLSYMS=y
33CONFIG_FUTEX=y
34CONFIG_EPOLL=y
35CONFIG_IOSCHED_NOOP=y
36CONFIG_IOSCHED_AS=y
37CONFIG_IOSCHED_DEADLINE=y
38CONFIG_IOSCHED_CFQ=y
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
40
41#
42# Loadable module support
43#
44CONFIG_MODULES=y
45CONFIG_MODULE_UNLOAD=y
46# CONFIG_MODULE_FORCE_UNLOAD is not set
47CONFIG_OBSOLETE_MODPARM=y
48# CONFIG_MODVERSIONS is not set
49CONFIG_KMOD=y
50
51#
52# Processor
53#
54# CONFIG_6xx is not set
55CONFIG_40x=y
56# CONFIG_44x is not set
57# CONFIG_POWER3 is not set
58# CONFIG_POWER4 is not set
59# CONFIG_8xx is not set
60# CONFIG_MATH_EMULATION is not set
61# CONFIG_CPU_FREQ is not set
62CONFIG_4xx=y
63
64#
65# IBM 4xx options
66#
67# CONFIG_ASH is not set
68# CONFIG_BUBINGA is not set
69# CONFIG_CPCI405 is not set
70CONFIG_EP405=y
71# CONFIG_OAK is not set
72# CONFIG_REDWOOD_5 is not set
73# CONFIG_REDWOOD_6 is not set
74# CONFIG_SYCAMORE is not set
75# CONFIG_WALNUT is not set
76# CONFIG_EP405PC is not set
77CONFIG_IBM405_ERR77=y
78CONFIG_IBM405_ERR51=y
79CONFIG_IBM_OCP=y
80CONFIG_BIOS_FIXUP=y
81CONFIG_405GP=y
82CONFIG_EMBEDDEDBOOT=y
83# CONFIG_PM is not set
84CONFIG_UART0_TTYS0=y
85# CONFIG_UART0_TTYS1 is not set
86CONFIG_NOT_COHERENT_CACHE=y
87
88#
89# Platform options
90#
91# CONFIG_PC_KEYBOARD is not set
92# CONFIG_SMP is not set
93# CONFIG_PREEMPT is not set
94# CONFIG_HIGHMEM is not set
95CONFIG_KERNEL_ELF=y
96CONFIG_BINFMT_ELF=y
97# CONFIG_BINFMT_MISC is not set
98CONFIG_CMDLINE_BOOL=y
99CONFIG_CMDLINE="ip=on"
100
101#
102# Bus options
103#
104CONFIG_PCI=y
105CONFIG_PCI_DOMAINS=y
106# CONFIG_PCI_LEGACY_PROC is not set
107# CONFIG_PCI_NAMES is not set
108
109#
110# Advanced setup
111#
112# CONFIG_ADVANCED_OPTIONS is not set
113
114#
115# Default settings for advanced configuration options are used
116#
117CONFIG_HIGHMEM_START=0xfe000000
118CONFIG_LOWMEM_SIZE=0x30000000
119CONFIG_KERNEL_START=0xc0000000
120CONFIG_TASK_SIZE=0x80000000
121CONFIG_BOOT_LOAD=0x00400000
122
123#
124# Device Drivers
125#
126
127#
128# Generic Driver Options
129#
130
131#
132# Memory Technology Devices (MTD)
133#
134# CONFIG_MTD is not set
135
136#
137# Parallel port support
138#
139# CONFIG_PARPORT is not set
140
141#
142# Plug and Play support
143#
144
145#
146# Block devices
147#
148# CONFIG_BLK_DEV_FD is not set
149# CONFIG_BLK_CPQ_DA is not set
150# CONFIG_BLK_CPQ_CISS_DA is not set
151# CONFIG_BLK_DEV_DAC960 is not set
152# CONFIG_BLK_DEV_UMEM is not set
153CONFIG_BLK_DEV_LOOP=y
154# CONFIG_BLK_DEV_CRYPTOLOOP is not set
155# CONFIG_BLK_DEV_NBD is not set
156# CONFIG_BLK_DEV_CARMEL is not set
157CONFIG_BLK_DEV_RAM=y
158CONFIG_BLK_DEV_RAM_SIZE=4096
159CONFIG_BLK_DEV_INITRD=y
160# CONFIG_LBD is not set
161
162#
163# ATA/ATAPI/MFM/RLL support
164#
165# CONFIG_IDE is not set
166
167#
168# SCSI device support
169#
170# CONFIG_SCSI is not set
171
172#
173# Multi-device support (RAID and LVM)
174#
175# CONFIG_MD is not set
176
177#
178# Fusion MPT device support
179#
180
181#
182# IEEE 1394 (FireWire) support
183#
184# CONFIG_IEEE1394 is not set
185
186#
187# I2O device support
188#
189# CONFIG_I2O is not set
190
191#
192# Macintosh device drivers
193#
194
195#
196# Networking support
197#
198CONFIG_NET=y
199
200#
201# Networking options
202#
203# CONFIG_PACKET is not set
204# CONFIG_NETLINK_DEV is not set
205CONFIG_UNIX=y
206# CONFIG_NET_KEY is not set
207CONFIG_INET=y
208CONFIG_IP_MULTICAST=y
209# CONFIG_IP_ADVANCED_ROUTER is not set
210CONFIG_IP_PNP=y
211# CONFIG_IP_PNP_DHCP is not set
212CONFIG_IP_PNP_BOOTP=y
213# CONFIG_IP_PNP_RARP is not set
214# CONFIG_NET_IPIP is not set
215# CONFIG_NET_IPGRE is not set
216# CONFIG_IP_MROUTE is not set
217# CONFIG_ARPD is not set
218CONFIG_SYN_COOKIES=y
219# CONFIG_INET_AH is not set
220# CONFIG_INET_ESP is not set
221# CONFIG_INET_IPCOMP is not set
222# CONFIG_IPV6 is not set
223# CONFIG_NETFILTER is not set
224
225#
226# SCTP Configuration (EXPERIMENTAL)
227#
228# CONFIG_IP_SCTP is not set
229# CONFIG_ATM is not set
230# CONFIG_BRIDGE is not set
231# CONFIG_VLAN_8021Q is not set
232# CONFIG_DECNET is not set
233# CONFIG_LLC2 is not set
234# CONFIG_IPX is not set
235# CONFIG_ATALK is not set
236# CONFIG_X25 is not set
237# CONFIG_LAPB is not set
238# CONFIG_NET_DIVERT is not set
239# CONFIG_ECONET is not set
240# CONFIG_WAN_ROUTER is not set
241# CONFIG_NET_HW_FLOWCONTROL is not set
242
243#
244# QoS and/or fair queueing
245#
246# CONFIG_NET_SCHED is not set
247
248#
249# Network testing
250#
251# CONFIG_NET_PKTGEN is not set
252# CONFIG_NETPOLL is not set
253# CONFIG_NET_POLL_CONTROLLER is not set
254# CONFIG_HAMRADIO is not set
255# CONFIG_IRDA is not set
256# CONFIG_BT is not set
257CONFIG_NETDEVICES=y
258# CONFIG_DUMMY is not set
259# CONFIG_BONDING is not set
260# CONFIG_EQUALIZER is not set
261# CONFIG_TUN is not set
262
263#
264# ARCnet devices
265#
266# CONFIG_ARCNET is not set
267
268#
269# Ethernet (10 or 100Mbit)
270#
271CONFIG_NET_ETHERNET=y
272# CONFIG_MII is not set
273# CONFIG_OAKNET is not set
274# CONFIG_HAPPYMEAL is not set
275# CONFIG_SUNGEM is not set
276# CONFIG_NET_VENDOR_3COM is not set
277
278#
279# Tulip family network device support
280#
281# CONFIG_NET_TULIP is not set
282# CONFIG_HP100 is not set
283# CONFIG_NET_PCI is not set
284
285#
286# Ethernet (1000 Mbit)
287#
288# CONFIG_ACENIC is not set
289# CONFIG_DL2K is not set
290# CONFIG_E1000 is not set
291# CONFIG_NS83820 is not set
292# CONFIG_HAMACHI is not set
293# CONFIG_YELLOWFIN is not set
294# CONFIG_R8169 is not set
295# CONFIG_SK98LIN is not set
296# CONFIG_TIGON3 is not set
297
298#
299# Ethernet (10000 Mbit)
300#
301# CONFIG_IXGB is not set
302# CONFIG_S2IO is not set
303
304#
305# Token Ring devices
306#
307# CONFIG_TR is not set
308
309#
310# Wireless LAN (non-hamradio)
311#
312# CONFIG_NET_RADIO is not set
313
314#
315# Wan interfaces
316#
317# CONFIG_WAN is not set
318# CONFIG_FDDI is not set
319# CONFIG_HIPPI is not set
320# CONFIG_PPP is not set
321# CONFIG_SLIP is not set
322# CONFIG_RCPCI is not set
323# CONFIG_SHAPER is not set
324# CONFIG_NETCONSOLE is not set
325
326#
327# ISDN subsystem
328#
329# CONFIG_ISDN is not set
330
331#
332# Telephony Support
333#
334# CONFIG_PHONE is not set
335
336#
337# Input device support
338#
339CONFIG_INPUT=y
340
341#
342# Userland interfaces
343#
344CONFIG_INPUT_MOUSEDEV=y
345CONFIG_INPUT_MOUSEDEV_PSAUX=y
346CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
347CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
348# CONFIG_INPUT_JOYDEV is not set
349# CONFIG_INPUT_TSDEV is not set
350# CONFIG_INPUT_EVDEV is not set
351# CONFIG_INPUT_EVBUG is not set
352
353#
354# Input I/O drivers
355#
356# CONFIG_GAMEPORT is not set
357CONFIG_SOUND_GAMEPORT=y
358CONFIG_SERIO=y
359# CONFIG_SERIO_I8042 is not set
360CONFIG_SERIO_SERPORT=y
361# CONFIG_SERIO_CT82C710 is not set
362# CONFIG_SERIO_PCIPS2 is not set
363
364#
365# Input Device Drivers
366#
367# CONFIG_INPUT_KEYBOARD is not set
368# CONFIG_INPUT_MOUSE is not set
369# CONFIG_INPUT_JOYSTICK is not set
370# CONFIG_INPUT_TOUCHSCREEN is not set
371# CONFIG_INPUT_MISC is not set
372
373#
374# Character devices
375#
376# CONFIG_VT is not set
377# CONFIG_SERIAL_NONSTANDARD is not set
378
379#
380# Serial drivers
381#
382CONFIG_SERIAL_8250=y
383CONFIG_SERIAL_8250_CONSOLE=y
384CONFIG_SERIAL_8250_NR_UARTS=4
385# CONFIG_SERIAL_8250_EXTENDED is not set
386
387#
388# Non-8250 serial port support
389#
390CONFIG_SERIAL_CORE=y
391CONFIG_SERIAL_CORE_CONSOLE=y
392CONFIG_UNIX98_PTYS=y
393CONFIG_LEGACY_PTYS=y
394CONFIG_LEGACY_PTY_COUNT=256
395# CONFIG_QIC02_TAPE is not set
396
397#
398# IPMI
399#
400# CONFIG_IPMI_HANDLER is not set
401
402#
403# Watchdog Cards
404#
405# CONFIG_WATCHDOG is not set
406# CONFIG_NVRAM is not set
407CONFIG_GEN_RTC=y
408# CONFIG_GEN_RTC_X is not set
409# CONFIG_DTLK is not set
410# CONFIG_R3964 is not set
411# CONFIG_APPLICOM is not set
412
413#
414# Ftape, the floppy tape device driver
415#
416# CONFIG_FTAPE is not set
417# CONFIG_AGP is not set
418# CONFIG_DRM is not set
419# CONFIG_RAW_DRIVER is not set
420
421#
422# I2C support
423#
424# CONFIG_I2C is not set
425
426#
427# Misc devices
428#
429
430#
431# Multimedia devices
432#
433# CONFIG_VIDEO_DEV is not set
434
435#
436# Digital Video Broadcasting Devices
437#
438# CONFIG_DVB is not set
439
440#
441# Graphics support
442#
443# CONFIG_FB is not set
444
445#
446# Sound
447#
448# CONFIG_SOUND is not set
449
450#
451# USB support
452#
453# CONFIG_USB is not set
454
455#
456# USB Gadget Support
457#
458# CONFIG_USB_GADGET is not set
459
460#
461# File systems
462#
463CONFIG_EXT2_FS=y
464# CONFIG_EXT2_FS_XATTR is not set
465# CONFIG_EXT3_FS is not set
466# CONFIG_JBD is not set
467# CONFIG_REISERFS_FS is not set
468# CONFIG_JFS_FS is not set
469# CONFIG_XFS_FS is not set
470# CONFIG_MINIX_FS is not set
471# CONFIG_ROMFS_FS is not set
472# CONFIG_QUOTA is not set
473# CONFIG_AUTOFS_FS is not set
474# CONFIG_AUTOFS4_FS is not set
475
476#
477# CD-ROM/DVD Filesystems
478#
479# CONFIG_ISO9660_FS is not set
480# CONFIG_UDF_FS is not set
481
482#
483# DOS/FAT/NT Filesystems
484#
485# CONFIG_FAT_FS is not set
486# CONFIG_NTFS_FS is not set
487
488#
489# Pseudo filesystems
490#
491CONFIG_PROC_FS=y
492CONFIG_PROC_KCORE=y
493CONFIG_SYSFS=y
494# CONFIG_DEVFS_FS is not set
495# CONFIG_DEVPTS_FS_XATTR is not set
496CONFIG_TMPFS=y
497# CONFIG_HUGETLB_PAGE is not set
498CONFIG_RAMFS=y
499
500#
501# Miscellaneous filesystems
502#
503# CONFIG_ADFS_FS is not set
504# CONFIG_AFFS_FS is not set
505# CONFIG_HFS_FS is not set
506# CONFIG_HFSPLUS_FS is not set
507# CONFIG_BEFS_FS is not set
508# CONFIG_BFS_FS is not set
509# CONFIG_EFS_FS is not set
510# CONFIG_CRAMFS is not set
511# CONFIG_VXFS_FS is not set
512# CONFIG_HPFS_FS is not set
513# CONFIG_QNX4FS_FS is not set
514# CONFIG_SYSV_FS is not set
515# CONFIG_UFS_FS is not set
516
517#
518# Network File Systems
519#
520CONFIG_NFS_FS=y
521# CONFIG_NFS_V3 is not set
522# CONFIG_NFS_V4 is not set
523# CONFIG_NFS_DIRECTIO is not set
524# CONFIG_NFSD is not set
525CONFIG_ROOT_NFS=y
526CONFIG_LOCKD=y
527# CONFIG_EXPORTFS is not set
528CONFIG_SUNRPC=y
529# CONFIG_RPCSEC_GSS_KRB5 is not set
530# CONFIG_SMB_FS is not set
531# CONFIG_CIFS is not set
532# CONFIG_NCP_FS is not set
533# CONFIG_CODA_FS is not set
534# CONFIG_AFS_FS is not set
535
536#
537# Partition Types
538#
539# CONFIG_PARTITION_ADVANCED is not set
540CONFIG_MSDOS_PARTITION=y
541
542#
543# Native Language Support
544#
545# CONFIG_NLS is not set
546
547#
548# IBM 40x options
549#
550
551#
552# Library routines
553#
554CONFIG_CRC32=y
555# CONFIG_LIBCRC32C is not set
556
557#
558# Kernel hacking
559#
560# CONFIG_DEBUG_KERNEL is not set
561# CONFIG_SERIAL_TEXT_DEBUG is not set
562CONFIG_PPC_OCP=y
563
564#
565# Security options
566#
567# CONFIG_SECURITY is not set
568
569#
570# Cryptographic options
571#
572# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/est8260_defconfig b/arch/ppc/configs/est8260_defconfig
new file mode 100644
index 000000000000..b3f6446bb083
--- /dev/null
+++ b/arch/ppc/configs/est8260_defconfig
@@ -0,0 +1,491 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7
8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12
13#
14# General setup
15#
16CONFIG_SWAP=y
17CONFIG_SYSVIPC=y
18# CONFIG_BSD_PROCESS_ACCT is not set
19CONFIG_SYSCTL=y
20CONFIG_LOG_BUF_SHIFT=14
21CONFIG_EMBEDDED=y
22CONFIG_FUTEX=y
23# CONFIG_EPOLL is not set
24
25#
26# Loadable module support
27#
28# CONFIG_MODULES is not set
29
30#
31# Platform support
32#
33CONFIG_PPC=y
34CONFIG_PPC32=y
35CONFIG_6xx=y
36# CONFIG_40x is not set
37# CONFIG_POWER3 is not set
38# CONFIG_8xx is not set
39
40#
41# IBM 4xx options
42#
43CONFIG_EMBEDDEDBOOT=y
44CONFIG_8260=y
45CONFIG_PPC_STD_MMU=y
46CONFIG_SERIAL_CONSOLE=y
47CONFIG_EST8260=y
48# CONFIG_SBS8260 is not set
49# CONFIG_RPX6 is not set
50# CONFIG_TQM8260 is not set
51# CONFIG_WILLOW_1 is not set
52# CONFIG_SMP is not set
53# CONFIG_PREEMPT is not set
54# CONFIG_CPU_FREQ is not set
55
56#
57# General setup
58#
59# CONFIG_HIGHMEM is not set
60# CONFIG_PCI is not set
61# CONFIG_PCI_DOMAINS is not set
62# CONFIG_PC_KEYBOARD is not set
63CONFIG_KCORE_ELF=y
64CONFIG_BINFMT_ELF=y
65CONFIG_KERNEL_ELF=y
66# CONFIG_BINFMT_MISC is not set
67# CONFIG_HOTPLUG is not set
68
69#
70# Parallel port support
71#
72# CONFIG_PARPORT is not set
73# CONFIG_PPC601_SYNC_FIX is not set
74# CONFIG_CMDLINE_BOOL is not set
75
76#
77# Advanced setup
78#
79# CONFIG_ADVANCED_OPTIONS is not set
80
81#
82# Default settings for advanced configuration options are used
83#
84CONFIG_HIGHMEM_START=0xfe000000
85CONFIG_LOWMEM_SIZE=0x30000000
86CONFIG_KERNEL_START=0xc0000000
87CONFIG_TASK_SIZE=0x80000000
88CONFIG_BOOT_LOAD=0x00400000
89
90#
91# Memory Technology Devices (MTD)
92#
93# CONFIG_MTD is not set
94
95#
96# Plug and Play support
97#
98# CONFIG_PNP is not set
99
100#
101# Block devices
102#
103# CONFIG_BLK_DEV_FD is not set
104CONFIG_BLK_DEV_LOOP=y
105# CONFIG_BLK_DEV_NBD is not set
106CONFIG_BLK_DEV_RAM=y
107CONFIG_BLK_DEV_RAM_SIZE=4096
108CONFIG_BLK_DEV_INITRD=y
109
110#
111# Multi-device support (RAID and LVM)
112#
113# CONFIG_MD is not set
114
115#
116# ATA/IDE/MFM/RLL support
117#
118# CONFIG_IDE is not set
119
120#
121# SCSI support
122#
123# CONFIG_SCSI is not set
124
125#
126# Fusion MPT device support
127#
128
129#
130# I2O device support
131#
132
133#
134# Networking support
135#
136CONFIG_NET=y
137
138#
139# Networking options
140#
141CONFIG_PACKET=y
142# CONFIG_PACKET_MMAP is not set
143# CONFIG_NETLINK_DEV is not set
144# CONFIG_NETFILTER is not set
145CONFIG_UNIX=y
146# CONFIG_NET_KEY is not set
147CONFIG_INET=y
148CONFIG_IP_MULTICAST=y
149# CONFIG_IP_ADVANCED_ROUTER is not set
150CONFIG_IP_PNP=y
151CONFIG_IP_PNP_DHCP=y
152CONFIG_IP_PNP_BOOTP=y
153# CONFIG_IP_PNP_RARP is not set
154# CONFIG_NET_IPIP is not set
155# CONFIG_NET_IPGRE is not set
156# CONFIG_IP_MROUTE is not set
157# CONFIG_ARPD is not set
158# CONFIG_INET_ECN is not set
159CONFIG_SYN_COOKIES=y
160# CONFIG_INET_AH is not set
161# CONFIG_INET_ESP is not set
162# CONFIG_INET_IPCOMP is not set
163# CONFIG_IPV6 is not set
164# CONFIG_XFRM_USER is not set
165
166#
167# SCTP Configuration (EXPERIMENTAL)
168#
169CONFIG_IPV6_SCTP__=y
170# CONFIG_IP_SCTP is not set
171# CONFIG_ATM is not set
172# CONFIG_VLAN_8021Q is not set
173# CONFIG_LLC is not set
174# CONFIG_DECNET is not set
175# CONFIG_BRIDGE is not set
176# CONFIG_X25 is not set
177# CONFIG_LAPB is not set
178# CONFIG_NET_DIVERT is not set
179# CONFIG_ECONET is not set
180# CONFIG_WAN_ROUTER is not set
181# CONFIG_NET_HW_FLOWCONTROL is not set
182
183#
184# QoS and/or fair queueing
185#
186# CONFIG_NET_SCHED is not set
187
188#
189# Network testing
190#
191# CONFIG_NET_PKTGEN is not set
192CONFIG_NETDEVICES=y
193# CONFIG_DUMMY is not set
194# CONFIG_BONDING is not set
195# CONFIG_EQUALIZER is not set
196# CONFIG_TUN is not set
197# CONFIG_ETHERTAP is not set
198
199#
200# Ethernet (10 or 100Mbit)
201#
202CONFIG_NET_ETHERNET=y
203# CONFIG_MII is not set
204# CONFIG_OAKNET is not set
205
206#
207# Ethernet (1000 Mbit)
208#
209
210#
211# Ethernet (10000 Mbit)
212#
213# CONFIG_PPP is not set
214# CONFIG_SLIP is not set
215
216#
217# Wireless LAN (non-hamradio)
218#
219# CONFIG_NET_RADIO is not set
220
221#
222# Token Ring devices (depends on LLC=y)
223#
224# CONFIG_SHAPER is not set
225
226#
227# Wan interfaces
228#
229# CONFIG_WAN is not set
230
231#
232# Amateur Radio support
233#
234# CONFIG_HAMRADIO is not set
235
236#
237# IrDA (infrared) support
238#
239# CONFIG_IRDA is not set
240
241#
242# ISDN subsystem
243#
244# CONFIG_ISDN_BOOL is not set
245
246#
247# Graphics support
248#
249# CONFIG_FB is not set
250
251#
252# Old CD-ROM drivers (not SCSI, not IDE)
253#
254# CONFIG_CD_NO_IDESCSI is not set
255
256#
257# Input device support
258#
259# CONFIG_INPUT is not set
260
261#
262# Userland interfaces
263#
264
265#
266# Input I/O drivers
267#
268# CONFIG_GAMEPORT is not set
269CONFIG_SOUND_GAMEPORT=y
270# CONFIG_SERIO is not set
271
272#
273# Input Device Drivers
274#
275
276#
277# Macintosh device drivers
278#
279
280#
281# Character devices
282#
283# CONFIG_SERIAL_NONSTANDARD is not set
284
285#
286# Serial drivers
287#
288CONFIG_SERIAL_8250=y
289CONFIG_SERIAL_8250_CONSOLE=y
290# CONFIG_SERIAL_8250_EXTENDED is not set
291
292#
293# Non-8250 serial port support
294#
295CONFIG_SERIAL_CORE=y
296CONFIG_SERIAL_CORE_CONSOLE=y
297CONFIG_UNIX98_PTYS=y
298CONFIG_UNIX98_PTY_COUNT=256
299
300#
301# I2C support
302#
303# CONFIG_I2C is not set
304
305#
306# I2C Hardware Sensors Mainboard support
307#
308
309#
310# I2C Hardware Sensors Chip support
311#
312# CONFIG_I2C_SENSOR is not set
313
314#
315# Mice
316#
317# CONFIG_BUSMOUSE is not set
318# CONFIG_QIC02_TAPE is not set
319
320#
321# IPMI
322#
323# CONFIG_IPMI_HANDLER is not set
324
325#
326# Watchdog Cards
327#
328# CONFIG_WATCHDOG is not set
329# CONFIG_NVRAM is not set
330CONFIG_GEN_RTC=y
331# CONFIG_GEN_RTC_X is not set
332# CONFIG_DTLK is not set
333# CONFIG_R3964 is not set
334# CONFIG_APPLICOM is not set
335
336#
337# Ftape, the floppy tape device driver
338#
339# CONFIG_FTAPE is not set
340# CONFIG_AGP is not set
341# CONFIG_DRM is not set
342# CONFIG_RAW_DRIVER is not set
343# CONFIG_HANGCHECK_TIMER is not set
344
345#
346# Multimedia devices
347#
348# CONFIG_VIDEO_DEV is not set
349
350#
351# Digital Video Broadcasting Devices
352#
353# CONFIG_DVB is not set
354
355#
356# File systems
357#
358CONFIG_EXT2_FS=y
359# CONFIG_EXT2_FS_XATTR is not set
360CONFIG_EXT3_FS=y
361CONFIG_EXT3_FS_XATTR=y
362# CONFIG_EXT3_FS_POSIX_ACL is not set
363# CONFIG_EXT3_FS_SECURITY is not set
364CONFIG_JBD=y
365# CONFIG_JBD_DEBUG is not set
366CONFIG_FS_MBCACHE=y
367# CONFIG_REISERFS_FS is not set
368# CONFIG_JFS_FS is not set
369# CONFIG_XFS_FS is not set
370# CONFIG_MINIX_FS is not set
371# CONFIG_ROMFS_FS is not set
372# CONFIG_QUOTA is not set
373# CONFIG_AUTOFS_FS is not set
374# CONFIG_AUTOFS4_FS is not set
375
376#
377# CD-ROM/DVD Filesystems
378#
379# CONFIG_ISO9660_FS is not set
380# CONFIG_UDF_FS is not set
381
382#
383# DOS/FAT/NT Filesystems
384#
385# CONFIG_FAT_FS is not set
386# CONFIG_NTFS_FS is not set
387
388#
389# Pseudo filesystems
390#
391CONFIG_PROC_FS=y
392# CONFIG_DEVFS_FS is not set
393CONFIG_DEVPTS_FS=y
394# CONFIG_DEVPTS_FS_XATTR is not set
395CONFIG_TMPFS=y
396CONFIG_RAMFS=y
397
398#
399# Miscellaneous filesystems
400#
401# CONFIG_ADFS_FS is not set
402# CONFIG_AFFS_FS is not set
403# CONFIG_HFS_FS is not set
404# CONFIG_BEFS_FS is not set
405# CONFIG_BFS_FS is not set
406# CONFIG_EFS_FS is not set
407# CONFIG_CRAMFS is not set
408# CONFIG_VXFS_FS is not set
409# CONFIG_HPFS_FS is not set
410# CONFIG_QNX4FS_FS is not set
411# CONFIG_SYSV_FS is not set
412# CONFIG_UFS_FS is not set
413
414#
415# Network File Systems
416#
417CONFIG_NFS_FS=y
418# CONFIG_NFS_V3 is not set
419# CONFIG_NFS_V4 is not set
420# CONFIG_NFSD is not set
421CONFIG_ROOT_NFS=y
422CONFIG_LOCKD=y
423# CONFIG_EXPORTFS is not set
424CONFIG_SUNRPC=y
425# CONFIG_SUNRPC_GSS is not set
426# CONFIG_SMB_FS is not set
427# CONFIG_CIFS is not set
428# CONFIG_NCP_FS is not set
429# CONFIG_CODA_FS is not set
430# CONFIG_INTERMEZZO_FS is not set
431# CONFIG_AFS_FS is not set
432
433#
434# Partition Types
435#
436CONFIG_PARTITION_ADVANCED=y
437# CONFIG_ACORN_PARTITION is not set
438# CONFIG_OSF_PARTITION is not set
439# CONFIG_AMIGA_PARTITION is not set
440# CONFIG_ATARI_PARTITION is not set
441# CONFIG_MAC_PARTITION is not set
442# CONFIG_MSDOS_PARTITION is not set
443# CONFIG_LDM_PARTITION is not set
444# CONFIG_NEC98_PARTITION is not set
445# CONFIG_SGI_PARTITION is not set
446# CONFIG_ULTRIX_PARTITION is not set
447# CONFIG_SUN_PARTITION is not set
448# CONFIG_EFI_PARTITION is not set
449
450#
451# Sound
452#
453# CONFIG_SOUND is not set
454CONFIG_SCC_ENET=y
455# CONFIG_FEC_ENET is not set
456
457#
458# MPC8260 CPM Options
459#
460CONFIG_SCC_CONSOLE=y
461
462#
463# USB support
464#
465# CONFIG_USB_GADGET is not set
466
467#
468# Bluetooth support
469#
470# CONFIG_BT is not set
471
472#
473# Library routines
474#
475# CONFIG_CRC32 is not set
476
477#
478# Kernel hacking
479#
480# CONFIG_DEBUG_KERNEL is not set
481# CONFIG_KALLSYMS is not set
482
483#
484# Security options
485#
486# CONFIG_SECURITY is not set
487
488#
489# Cryptographic options
490#
491# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/ev64260_defconfig b/arch/ppc/configs/ev64260_defconfig
new file mode 100644
index 000000000000..84cc142a67bb
--- /dev/null
+++ b/arch/ppc/configs/ev64260_defconfig
@@ -0,0 +1,759 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.10-rc2
4# Fri Nov 19 11:17:02 2004
5#
6CONFIG_MMU=y
7CONFIG_GENERIC_HARDIRQS=y
8CONFIG_RWSEM_XCHGADD_ALGORITHM=y
9CONFIG_HAVE_DEC_LOCK=y
10CONFIG_PPC=y
11CONFIG_PPC32=y
12CONFIG_GENERIC_NVRAM=y
13
14#
15# Code maturity level options
16#
17CONFIG_EXPERIMENTAL=y
18CONFIG_CLEAN_COMPILE=y
19CONFIG_BROKEN_ON_SMP=y
20
21#
22# General setup
23#
24CONFIG_LOCALVERSION=""
25CONFIG_SWAP=y
26CONFIG_SYSVIPC=y
27# CONFIG_POSIX_MQUEUE is not set
28# CONFIG_BSD_PROCESS_ACCT is not set
29CONFIG_SYSCTL=y
30# CONFIG_AUDIT is not set
31CONFIG_LOG_BUF_SHIFT=14
32# CONFIG_HOTPLUG is not set
33CONFIG_KOBJECT_UEVENT=y
34# CONFIG_IKCONFIG is not set
35# CONFIG_EMBEDDED is not set
36CONFIG_KALLSYMS=y
37# CONFIG_KALLSYMS_EXTRA_PASS is not set
38CONFIG_FUTEX=y
39CONFIG_EPOLL=y
40# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
41CONFIG_SHMEM=y
42CONFIG_CC_ALIGN_FUNCTIONS=0
43CONFIG_CC_ALIGN_LABELS=0
44CONFIG_CC_ALIGN_LOOPS=0
45CONFIG_CC_ALIGN_JUMPS=0
46# CONFIG_TINY_SHMEM is not set
47
48#
49# Loadable module support
50#
51CONFIG_MODULES=y
52CONFIG_MODULE_UNLOAD=y
53# CONFIG_MODULE_FORCE_UNLOAD is not set
54CONFIG_OBSOLETE_MODPARM=y
55# CONFIG_MODVERSIONS is not set
56# CONFIG_MODULE_SRCVERSION_ALL is not set
57CONFIG_KMOD=y
58
59#
60# Processor
61#
62CONFIG_6xx=y
63# CONFIG_40x is not set
64# CONFIG_44x is not set
65# CONFIG_POWER3 is not set
66# CONFIG_POWER4 is not set
67# CONFIG_8xx is not set
68# CONFIG_E500 is not set
69CONFIG_ALTIVEC=y
70CONFIG_TAU=y
71# CONFIG_TAU_INT is not set
72# CONFIG_TAU_AVERAGE is not set
73# CONFIG_CPU_FREQ is not set
74CONFIG_PPC_GEN550=y
75CONFIG_PPC_STD_MMU=y
76# CONFIG_NOT_COHERENT_CACHE is not set
77
78#
79# Platform options
80#
81# CONFIG_PPC_MULTIPLATFORM is not set
82# CONFIG_APUS is not set
83# CONFIG_WILLOW is not set
84# CONFIG_PCORE is not set
85# CONFIG_POWERPMC250 is not set
86# CONFIG_SPRUCE is not set
87CONFIG_EV64260=y
88# CONFIG_LOPEC is not set
89# CONFIG_MCPN765 is not set
90# CONFIG_MVME5100 is not set
91# CONFIG_PPLUS is not set
92# CONFIG_PRPMC750 is not set
93# CONFIG_PRPMC800 is not set
94# CONFIG_SANDPOINT is not set
95# CONFIG_ADIR is not set
96# CONFIG_K2 is not set
97# CONFIG_PAL4 is not set
98# CONFIG_GEMINI is not set
99# CONFIG_EST8260 is not set
100# CONFIG_SBC82xx is not set
101# CONFIG_SBS8260 is not set
102# CONFIG_RPX8260 is not set
103# CONFIG_TQM8260 is not set
104# CONFIG_ADS8272 is not set
105# CONFIG_LITE5200 is not set
106CONFIG_GT64260=y
107CONFIG_MV64X60=y
108
109#
110# Set bridge options
111#
112CONFIG_MV64X60_BASE=0xf1000000
113CONFIG_MV64X60_NEW_BASE=0xfbe00000
114# CONFIG_SMP is not set
115# CONFIG_PREEMPT is not set
116# CONFIG_HIGHMEM is not set
117CONFIG_BINFMT_ELF=y
118CONFIG_BINFMT_MISC=y
119CONFIG_CMDLINE_BOOL=y
120CONFIG_CMDLINE="console=ttyS0,115200 ip=on"
121
122#
123# Bus options
124#
125CONFIG_GENERIC_ISA_DMA=y
126CONFIG_PCI=y
127CONFIG_PCI_DOMAINS=y
128CONFIG_PCI_LEGACY_PROC=y
129CONFIG_PCI_NAMES=y
130
131#
132# Advanced setup
133#
134# CONFIG_ADVANCED_OPTIONS is not set
135
136#
137# Default settings for advanced configuration options are used
138#
139CONFIG_HIGHMEM_START=0xfe000000
140CONFIG_LOWMEM_SIZE=0x30000000
141CONFIG_KERNEL_START=0xc0000000
142CONFIG_TASK_SIZE=0x80000000
143CONFIG_BOOT_LOAD=0x00800000
144
145#
146# Device Drivers
147#
148
149#
150# Generic Driver Options
151#
152CONFIG_STANDALONE=y
153CONFIG_PREVENT_FIRMWARE_BUILD=y
154
155#
156# Memory Technology Devices (MTD)
157#
158# CONFIG_MTD is not set
159
160#
161# Parallel port support
162#
163# CONFIG_PARPORT is not set
164
165#
166# Plug and Play support
167#
168
169#
170# Block devices
171#
172# CONFIG_BLK_DEV_FD is not set
173# CONFIG_BLK_CPQ_DA is not set
174# CONFIG_BLK_CPQ_CISS_DA is not set
175# CONFIG_BLK_DEV_DAC960 is not set
176# CONFIG_BLK_DEV_UMEM is not set
177CONFIG_BLK_DEV_LOOP=y
178# CONFIG_BLK_DEV_CRYPTOLOOP is not set
179# CONFIG_BLK_DEV_NBD is not set
180# CONFIG_BLK_DEV_SX8 is not set
181CONFIG_BLK_DEV_RAM=y
182CONFIG_BLK_DEV_RAM_SIZE=4096
183CONFIG_BLK_DEV_INITRD=y
184CONFIG_INITRAMFS_SOURCE=""
185# CONFIG_LBD is not set
186# CONFIG_CDROM_PKTCDVD is not set
187
188#
189# IO Schedulers
190#
191CONFIG_IOSCHED_NOOP=y
192CONFIG_IOSCHED_AS=y
193CONFIG_IOSCHED_DEADLINE=y
194CONFIG_IOSCHED_CFQ=y
195
196#
197# ATA/ATAPI/MFM/RLL support
198#
199# CONFIG_IDE is not set
200
201#
202# SCSI device support
203#
204# CONFIG_SCSI is not set
205
206#
207# Multi-device support (RAID and LVM)
208#
209# CONFIG_MD is not set
210
211#
212# Fusion MPT device support
213#
214
215#
216# IEEE 1394 (FireWire) support
217#
218# CONFIG_IEEE1394 is not set
219
220#
221# I2O device support
222#
223# CONFIG_I2O is not set
224
225#
226# Macintosh device drivers
227#
228
229#
230# Networking support
231#
232CONFIG_NET=y
233
234#
235# Networking options
236#
237CONFIG_PACKET=y
238# CONFIG_PACKET_MMAP is not set
239# CONFIG_NETLINK_DEV is not set
240CONFIG_UNIX=y
241# CONFIG_NET_KEY is not set
242CONFIG_INET=y
243CONFIG_IP_MULTICAST=y
244# CONFIG_IP_ADVANCED_ROUTER is not set
245CONFIG_IP_PNP=y
246CONFIG_IP_PNP_DHCP=y
247# CONFIG_IP_PNP_BOOTP is not set
248# CONFIG_IP_PNP_RARP is not set
249# CONFIG_NET_IPIP is not set
250# CONFIG_NET_IPGRE is not set
251# CONFIG_IP_MROUTE is not set
252# CONFIG_ARPD is not set
253CONFIG_SYN_COOKIES=y
254# CONFIG_INET_AH is not set
255# CONFIG_INET_ESP is not set
256# CONFIG_INET_IPCOMP is not set
257# CONFIG_INET_TUNNEL is not set
258CONFIG_IP_TCPDIAG=y
259# CONFIG_IP_TCPDIAG_IPV6 is not set
260
261#
262# IP: Virtual Server Configuration
263#
264# CONFIG_IP_VS is not set
265# CONFIG_IPV6 is not set
266CONFIG_NETFILTER=y
267# CONFIG_NETFILTER_DEBUG is not set
268
269#
270# IP: Netfilter Configuration
271#
272# CONFIG_IP_NF_CONNTRACK is not set
273# CONFIG_IP_NF_CONNTRACK_MARK is not set
274# CONFIG_IP_NF_QUEUE is not set
275# CONFIG_IP_NF_IPTABLES is not set
276# CONFIG_IP_NF_ARPTABLES is not set
277# CONFIG_IP_NF_COMPAT_IPCHAINS is not set
278# CONFIG_IP_NF_COMPAT_IPFWADM is not set
279
280#
281# SCTP Configuration (EXPERIMENTAL)
282#
283# CONFIG_IP_SCTP is not set
284# CONFIG_ATM is not set
285# CONFIG_BRIDGE is not set
286# CONFIG_VLAN_8021Q is not set
287# CONFIG_DECNET is not set
288# CONFIG_LLC2 is not set
289# CONFIG_IPX is not set
290# CONFIG_ATALK is not set
291# CONFIG_X25 is not set
292# CONFIG_LAPB is not set
293# CONFIG_NET_DIVERT is not set
294# CONFIG_ECONET is not set
295# CONFIG_WAN_ROUTER is not set
296
297#
298# QoS and/or fair queueing
299#
300# CONFIG_NET_SCHED is not set
301# CONFIG_NET_CLS_ROUTE is not set
302
303#
304# Network testing
305#
306# CONFIG_NET_PKTGEN is not set
307# CONFIG_NETPOLL is not set
308# CONFIG_NET_POLL_CONTROLLER is not set
309# CONFIG_HAMRADIO is not set
310# CONFIG_IRDA is not set
311# CONFIG_BT is not set
312CONFIG_NETDEVICES=y
313# CONFIG_DUMMY is not set
314# CONFIG_BONDING is not set
315# CONFIG_EQUALIZER is not set
316# CONFIG_TUN is not set
317
318#
319# ARCnet devices
320#
321# CONFIG_ARCNET is not set
322
323#
324# Ethernet (10 or 100Mbit)
325#
326CONFIG_NET_ETHERNET=y
327CONFIG_MII=y
328# CONFIG_HAPPYMEAL is not set
329# CONFIG_SUNGEM is not set
330# CONFIG_NET_VENDOR_3COM is not set
331
332#
333# Tulip family network device support
334#
335CONFIG_NET_TULIP=y
336# CONFIG_DE2104X is not set
337CONFIG_TULIP=y
338# CONFIG_TULIP_MWI is not set
339# CONFIG_TULIP_MMIO is not set
340# CONFIG_TULIP_NAPI is not set
341# CONFIG_DE4X5 is not set
342# CONFIG_WINBOND_840 is not set
343# CONFIG_DM9102 is not set
344# CONFIG_HP100 is not set
345CONFIG_NET_PCI=y
346# CONFIG_PCNET32 is not set
347# CONFIG_AMD8111_ETH is not set
348# CONFIG_ADAPTEC_STARFIRE is not set
349# CONFIG_B44 is not set
350# CONFIG_FORCEDETH is not set
351# CONFIG_DGRS is not set
352# CONFIG_EEPRO100 is not set
353CONFIG_E100=y
354# CONFIG_E100_NAPI is not set
355# CONFIG_FEALNX is not set
356# CONFIG_NATSEMI is not set
357# CONFIG_NE2K_PCI is not set
358# CONFIG_8139CP is not set
359# CONFIG_8139TOO is not set
360# CONFIG_SIS900 is not set
361# CONFIG_EPIC100 is not set
362# CONFIG_SUNDANCE is not set
363# CONFIG_TLAN is not set
364# CONFIG_VIA_RHINE is not set
365
366#
367# Ethernet (1000 Mbit)
368#
369# CONFIG_ACENIC is not set
370# CONFIG_DL2K is not set
371# CONFIG_E1000 is not set
372# CONFIG_NS83820 is not set
373# CONFIG_HAMACHI is not set
374# CONFIG_YELLOWFIN is not set
375# CONFIG_R8169 is not set
376# CONFIG_SK98LIN is not set
377# CONFIG_VIA_VELOCITY is not set
378# CONFIG_TIGON3 is not set
379
380#
381# Ethernet (10000 Mbit)
382#
383# CONFIG_IXGB is not set
384# CONFIG_S2IO is not set
385
386#
387# Token Ring devices
388#
389# CONFIG_TR is not set
390
391#
392# Wireless LAN (non-hamradio)
393#
394# CONFIG_NET_RADIO is not set
395
396#
397# Wan interfaces
398#
399# CONFIG_WAN is not set
400# CONFIG_FDDI is not set
401# CONFIG_HIPPI is not set
402# CONFIG_PPP is not set
403# CONFIG_SLIP is not set
404# CONFIG_SHAPER is not set
405# CONFIG_NETCONSOLE is not set
406
407#
408# ISDN subsystem
409#
410# CONFIG_ISDN is not set
411
412#
413# Telephony Support
414#
415# CONFIG_PHONE is not set
416
417#
418# Input device support
419#
420CONFIG_INPUT=y
421
422#
423# Userland interfaces
424#
425CONFIG_INPUT_MOUSEDEV=y
426CONFIG_INPUT_MOUSEDEV_PSAUX=y
427CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
428CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
429# CONFIG_INPUT_JOYDEV is not set
430# CONFIG_INPUT_TSDEV is not set
431# CONFIG_INPUT_EVDEV is not set
432# CONFIG_INPUT_EVBUG is not set
433
434#
435# Input I/O drivers
436#
437# CONFIG_GAMEPORT is not set
438CONFIG_SOUND_GAMEPORT=y
439CONFIG_SERIO=y
440CONFIG_SERIO_I8042=y
441CONFIG_SERIO_SERPORT=y
442# CONFIG_SERIO_CT82C710 is not set
443# CONFIG_SERIO_PCIPS2 is not set
444# CONFIG_SERIO_RAW is not set
445
446#
447# Input Device Drivers
448#
449CONFIG_INPUT_KEYBOARD=y
450CONFIG_KEYBOARD_ATKBD=y
451# CONFIG_KEYBOARD_SUNKBD is not set
452# CONFIG_KEYBOARD_LKKBD is not set
453# CONFIG_KEYBOARD_XTKBD is not set
454# CONFIG_KEYBOARD_NEWTON is not set
455CONFIG_INPUT_MOUSE=y
456CONFIG_MOUSE_PS2=y
457# CONFIG_MOUSE_SERIAL is not set
458# CONFIG_MOUSE_VSXXXAA is not set
459# CONFIG_INPUT_JOYSTICK is not set
460# CONFIG_INPUT_TOUCHSCREEN is not set
461# CONFIG_INPUT_MISC is not set
462
463#
464# Character devices
465#
466CONFIG_VT=y
467CONFIG_VT_CONSOLE=y
468CONFIG_HW_CONSOLE=y
469# CONFIG_SERIAL_NONSTANDARD is not set
470
471#
472# Serial drivers
473#
474CONFIG_SERIAL_8250=y
475CONFIG_SERIAL_8250_CONSOLE=y
476CONFIG_SERIAL_8250_NR_UARTS=4
477# CONFIG_SERIAL_8250_EXTENDED is not set
478
479#
480# Non-8250 serial port support
481#
482CONFIG_SERIAL_CORE=y
483CONFIG_SERIAL_CORE_CONSOLE=y
484CONFIG_UNIX98_PTYS=y
485CONFIG_LEGACY_PTYS=y
486CONFIG_LEGACY_PTY_COUNT=256
487
488#
489# IPMI
490#
491# CONFIG_IPMI_HANDLER is not set
492
493#
494# Watchdog Cards
495#
496# CONFIG_WATCHDOG is not set
497# CONFIG_NVRAM is not set
498CONFIG_GEN_RTC=y
499# CONFIG_GEN_RTC_X is not set
500# CONFIG_DTLK is not set
501# CONFIG_R3964 is not set
502# CONFIG_APPLICOM is not set
503
504#
505# Ftape, the floppy tape device driver
506#
507# CONFIG_AGP is not set
508# CONFIG_DRM is not set
509# CONFIG_RAW_DRIVER is not set
510
511#
512# I2C support
513#
514CONFIG_I2C=m
515CONFIG_I2C_CHARDEV=m
516
517#
518# I2C Algorithms
519#
520# CONFIG_I2C_ALGOBIT is not set
521# CONFIG_I2C_ALGOPCF is not set
522# CONFIG_I2C_ALGOPCA is not set
523
524#
525# I2C Hardware Bus support
526#
527# CONFIG_I2C_ALI1535 is not set
528# CONFIG_I2C_ALI1563 is not set
529# CONFIG_I2C_ALI15X3 is not set
530# CONFIG_I2C_AMD756 is not set
531# CONFIG_I2C_AMD8111 is not set
532# CONFIG_I2C_I801 is not set
533# CONFIG_I2C_I810 is not set
534# CONFIG_I2C_ISA is not set
535# CONFIG_I2C_NFORCE2 is not set
536# CONFIG_I2C_PARPORT_LIGHT is not set
537# CONFIG_I2C_PIIX4 is not set
538# CONFIG_I2C_PROSAVAGE is not set
539# CONFIG_I2C_SAVAGE4 is not set
540# CONFIG_SCx200_ACB is not set
541# CONFIG_I2C_SIS5595 is not set
542# CONFIG_I2C_SIS630 is not set
543# CONFIG_I2C_SIS96X is not set
544# CONFIG_I2C_STUB is not set
545# CONFIG_I2C_VIA is not set
546# CONFIG_I2C_VIAPRO is not set
547# CONFIG_I2C_VOODOO3 is not set
548# CONFIG_I2C_PCA_ISA is not set
549
550#
551# Hardware Sensors Chip support
552#
553# CONFIG_I2C_SENSOR is not set
554# CONFIG_SENSORS_ADM1021 is not set
555# CONFIG_SENSORS_ADM1025 is not set
556# CONFIG_SENSORS_ADM1031 is not set
557# CONFIG_SENSORS_ASB100 is not set
558# CONFIG_SENSORS_DS1621 is not set
559# CONFIG_SENSORS_FSCHER is not set
560# CONFIG_SENSORS_GL518SM is not set
561# CONFIG_SENSORS_IT87 is not set
562# CONFIG_SENSORS_LM63 is not set
563# CONFIG_SENSORS_LM75 is not set
564# CONFIG_SENSORS_LM77 is not set
565# CONFIG_SENSORS_LM78 is not set
566# CONFIG_SENSORS_LM80 is not set
567# CONFIG_SENSORS_LM83 is not set
568# CONFIG_SENSORS_LM85 is not set
569# CONFIG_SENSORS_LM87 is not set
570# CONFIG_SENSORS_LM90 is not set
571# CONFIG_SENSORS_MAX1619 is not set
572# CONFIG_SENSORS_PC87360 is not set
573# CONFIG_SENSORS_SMSC47M1 is not set
574# CONFIG_SENSORS_VIA686A is not set
575# CONFIG_SENSORS_W83781D is not set
576# CONFIG_SENSORS_W83L785TS is not set
577# CONFIG_SENSORS_W83627HF is not set
578
579#
580# Other I2C Chip support
581#
582# CONFIG_SENSORS_EEPROM is not set
583# CONFIG_SENSORS_PCF8574 is not set
584# CONFIG_SENSORS_PCF8591 is not set
585# CONFIG_SENSORS_RTC8564 is not set
586# CONFIG_I2C_DEBUG_CORE is not set
587# CONFIG_I2C_DEBUG_ALGO is not set
588# CONFIG_I2C_DEBUG_BUS is not set
589# CONFIG_I2C_DEBUG_CHIP is not set
590
591#
592# Dallas's 1-wire bus
593#
594# CONFIG_W1 is not set
595
596#
597# Misc devices
598#
599
600#
601# Multimedia devices
602#
603# CONFIG_VIDEO_DEV is not set
604
605#
606# Digital Video Broadcasting Devices
607#
608# CONFIG_DVB is not set
609
610#
611# Graphics support
612#
613# CONFIG_FB is not set
614
615#
616# Console display driver support
617#
618CONFIG_VGA_CONSOLE=y
619CONFIG_DUMMY_CONSOLE=y
620
621#
622# Sound
623#
624# CONFIG_SOUND is not set
625
626#
627# USB support
628#
629# CONFIG_USB is not set
630CONFIG_USB_ARCH_HAS_HCD=y
631CONFIG_USB_ARCH_HAS_OHCI=y
632
633#
634# USB Gadget Support
635#
636# CONFIG_USB_GADGET is not set
637
638#
639# File systems
640#
641CONFIG_EXT2_FS=y
642# CONFIG_EXT2_FS_XATTR is not set
643# CONFIG_EXT3_FS is not set
644# CONFIG_JBD is not set
645# CONFIG_REISERFS_FS is not set
646# CONFIG_JFS_FS is not set
647# CONFIG_XFS_FS is not set
648# CONFIG_MINIX_FS is not set
649# CONFIG_ROMFS_FS is not set
650# CONFIG_QUOTA is not set
651CONFIG_DNOTIFY=y
652# CONFIG_AUTOFS_FS is not set
653# CONFIG_AUTOFS4_FS is not set
654
655#
656# CD-ROM/DVD Filesystems
657#
658# CONFIG_ISO9660_FS is not set
659# CONFIG_UDF_FS is not set
660
661#
662# DOS/FAT/NT Filesystems
663#
664# CONFIG_MSDOS_FS is not set
665# CONFIG_VFAT_FS is not set
666# CONFIG_NTFS_FS is not set
667
668#
669# Pseudo filesystems
670#
671CONFIG_PROC_FS=y
672# CONFIG_PROC_KCORE is not set
673CONFIG_SYSFS=y
674CONFIG_DEVFS_FS=y
675# CONFIG_DEVFS_MOUNT is not set
676# CONFIG_DEVFS_DEBUG is not set
677# CONFIG_DEVPTS_FS_XATTR is not set
678CONFIG_TMPFS=y
679# CONFIG_TMPFS_XATTR is not set
680# CONFIG_HUGETLB_PAGE is not set
681CONFIG_RAMFS=y
682
683#
684# Miscellaneous filesystems
685#
686# CONFIG_ADFS_FS is not set
687# CONFIG_AFFS_FS is not set
688# CONFIG_HFS_FS is not set
689# CONFIG_HFSPLUS_FS is not set
690# CONFIG_BEFS_FS is not set
691# CONFIG_BFS_FS is not set
692# CONFIG_EFS_FS is not set
693# CONFIG_CRAMFS is not set
694# CONFIG_VXFS_FS is not set
695# CONFIG_HPFS_FS is not set
696# CONFIG_QNX4FS_FS is not set
697# CONFIG_SYSV_FS is not set
698# CONFIG_UFS_FS is not set
699
700#
701# Network File Systems
702#
703CONFIG_NFS_FS=y
704CONFIG_NFS_V3=y
705# CONFIG_NFS_V4 is not set
706# CONFIG_NFS_DIRECTIO is not set
707# CONFIG_NFSD is not set
708CONFIG_ROOT_NFS=y
709CONFIG_LOCKD=y
710CONFIG_LOCKD_V4=y
711# CONFIG_EXPORTFS is not set
712CONFIG_SUNRPC=y
713# CONFIG_RPCSEC_GSS_KRB5 is not set
714# CONFIG_RPCSEC_GSS_SPKM3 is not set
715# CONFIG_SMB_FS is not set
716# CONFIG_CIFS is not set
717# CONFIG_NCP_FS is not set
718# CONFIG_CODA_FS is not set
719# CONFIG_AFS_FS is not set
720
721#
722# Partition Types
723#
724# CONFIG_PARTITION_ADVANCED is not set
725CONFIG_MSDOS_PARTITION=y
726
727#
728# Native Language Support
729#
730# CONFIG_NLS is not set
731
732#
733# Library routines
734#
735# CONFIG_CRC_CCITT is not set
736CONFIG_CRC32=y
737# CONFIG_LIBCRC32C is not set
738
739#
740# Profiling support
741#
742# CONFIG_PROFILING is not set
743
744#
745# Kernel hacking
746#
747# CONFIG_DEBUG_KERNEL is not set
748# CONFIG_SERIAL_TEXT_DEBUG is not set
749
750#
751# Security options
752#
753# CONFIG_KEYS is not set
754# CONFIG_SECURITY is not set
755
756#
757# Cryptographic options
758#
759# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/gemini_defconfig b/arch/ppc/configs/gemini_defconfig
new file mode 100644
index 000000000000..ebcd17b097f1
--- /dev/null
+++ b/arch/ppc/configs/gemini_defconfig
@@ -0,0 +1,618 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7
8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12
13#
14# General setup
15#
16CONFIG_SWAP=y
17CONFIG_SYSVIPC=y
18# CONFIG_BSD_PROCESS_ACCT is not set
19CONFIG_SYSCTL=y
20CONFIG_LOG_BUF_SHIFT=14
21# CONFIG_EMBEDDED is not set
22CONFIG_FUTEX=y
23CONFIG_EPOLL=y
24
25#
26# Loadable module support
27#
28CONFIG_MODULES=y
29CONFIG_MODULE_UNLOAD=y
30# CONFIG_MODULE_FORCE_UNLOAD is not set
31CONFIG_OBSOLETE_MODPARM=y
32# CONFIG_MODVERSIONS is not set
33CONFIG_KMOD=y
34
35#
36# Platform support
37#
38CONFIG_PPC=y
39CONFIG_PPC32=y
40CONFIG_6xx=y
41# CONFIG_40x is not set
42# CONFIG_POWER3 is not set
43# CONFIG_8xx is not set
44
45#
46# IBM 4xx options
47#
48# CONFIG_8260 is not set
49CONFIG_GENERIC_ISA_DMA=y
50CONFIG_PPC_STD_MMU=y
51# CONFIG_PPC_MULTIPLATFORM is not set
52# CONFIG_APUS is not set
53# CONFIG_WILLOW_2 is not set
54# CONFIG_PCORE is not set
55# CONFIG_POWERPMC250 is not set
56# CONFIG_EV64260 is not set
57# CONFIG_SPRUCE is not set
58# CONFIG_LOPEC is not set
59# CONFIG_MCPN765 is not set
60# CONFIG_MVME5100 is not set
61# CONFIG_PPLUS is not set
62# CONFIG_PRPMC750 is not set
63# CONFIG_PRPMC800 is not set
64# CONFIG_SANDPOINT is not set
65# CONFIG_ADIR is not set
66# CONFIG_K2 is not set
67# CONFIG_PAL4 is not set
68CONFIG_GEMINI=y
69# CONFIG_SMP is not set
70# CONFIG_PREEMPT is not set
71CONFIG_ALTIVEC=y
72CONFIG_TAU=y
73# CONFIG_TAU_INT is not set
74# CONFIG_TAU_AVERAGE is not set
75# CONFIG_CPU_FREQ is not set
76
77#
78# General setup
79#
80# CONFIG_HIGHMEM is not set
81CONFIG_PCI=y
82CONFIG_PCI_DOMAINS=y
83CONFIG_KCORE_ELF=y
84CONFIG_BINFMT_ELF=y
85CONFIG_KERNEL_ELF=y
86# CONFIG_BINFMT_MISC is not set
87CONFIG_PCI_LEGACY_PROC=y
88CONFIG_PCI_NAMES=y
89# CONFIG_HOTPLUG is not set
90
91#
92# Parallel port support
93#
94# CONFIG_PARPORT is not set
95# CONFIG_PPC601_SYNC_FIX is not set
96# CONFIG_CMDLINE_BOOL is not set
97
98#
99# Advanced setup
100#
101# CONFIG_ADVANCED_OPTIONS is not set
102
103#
104# Default settings for advanced configuration options are used
105#
106CONFIG_HIGHMEM_START=0xfe000000
107CONFIG_LOWMEM_SIZE=0x30000000
108CONFIG_KERNEL_START=0xc0000000
109CONFIG_TASK_SIZE=0x80000000
110CONFIG_BOOT_LOAD=0x00800000
111
112#
113# Memory Technology Devices (MTD)
114#
115# CONFIG_MTD is not set
116
117#
118# Plug and Play support
119#
120# CONFIG_PNP is not set
121
122#
123# Block devices
124#
125# CONFIG_BLK_DEV_FD is not set
126# CONFIG_BLK_CPQ_DA is not set
127# CONFIG_BLK_CPQ_CISS_DA is not set
128# CONFIG_BLK_DEV_DAC960 is not set
129# CONFIG_BLK_DEV_UMEM is not set
130# CONFIG_BLK_DEV_LOOP is not set
131# CONFIG_BLK_DEV_NBD is not set
132CONFIG_BLK_DEV_RAM=y
133CONFIG_BLK_DEV_RAM_SIZE=4096
134CONFIG_BLK_DEV_INITRD=y
135
136#
137# Multi-device support (RAID and LVM)
138#
139# CONFIG_MD is not set
140
141#
142# ATA/IDE/MFM/RLL support
143#
144# CONFIG_IDE is not set
145
146#
147# SCSI support
148#
149CONFIG_SCSI=y
150
151#
152# SCSI support type (disk, tape, CD-ROM)
153#
154CONFIG_BLK_DEV_SD=y
155# CONFIG_CHR_DEV_ST is not set
156# CONFIG_CHR_DEV_OSST is not set
157CONFIG_BLK_DEV_SR=y
158CONFIG_BLK_DEV_SR_VENDOR=y
159CONFIG_CHR_DEV_SG=y
160
161#
162# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
163#
164# CONFIG_SCSI_MULTI_LUN is not set
165# CONFIG_SCSI_REPORT_LUNS is not set
166CONFIG_SCSI_CONSTANTS=y
167# CONFIG_SCSI_LOGGING is not set
168
169#
170# SCSI low-level drivers
171#
172# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
173# CONFIG_SCSI_ACARD is not set
174# CONFIG_SCSI_AACRAID is not set
175# CONFIG_SCSI_AIC7XXX is not set
176# CONFIG_SCSI_AIC7XXX_OLD is not set
177# CONFIG_SCSI_AIC79XX is not set
178# CONFIG_SCSI_DPT_I2O is not set
179# CONFIG_SCSI_ADVANSYS is not set
180# CONFIG_SCSI_IN2000 is not set
181# CONFIG_SCSI_AM53C974 is not set
182# CONFIG_SCSI_MEGARAID is not set
183# CONFIG_SCSI_BUSLOGIC is not set
184# CONFIG_SCSI_CPQFCTS is not set
185# CONFIG_SCSI_DMX3191D is not set
186# CONFIG_SCSI_EATA is not set
187# CONFIG_SCSI_EATA_PIO is not set
188# CONFIG_SCSI_FUTURE_DOMAIN is not set
189# CONFIG_SCSI_GDTH is not set
190# CONFIG_SCSI_GENERIC_NCR5380 is not set
191# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
192# CONFIG_SCSI_INITIO is not set
193# CONFIG_SCSI_INIA100 is not set
194# CONFIG_SCSI_NCR53C7xx is not set
195CONFIG_SCSI_SYM53C8XX_2=y
196CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0
197CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
198CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
199# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set
200# CONFIG_SCSI_PCI2000 is not set
201# CONFIG_SCSI_PCI2220I is not set
202# CONFIG_SCSI_QLOGIC_ISP is not set
203# CONFIG_SCSI_QLOGIC_FC is not set
204# CONFIG_SCSI_QLOGIC_1280 is not set
205# CONFIG_SCSI_DC395x is not set
206# CONFIG_SCSI_DC390T is not set
207# CONFIG_SCSI_U14_34F is not set
208# CONFIG_SCSI_NSP32 is not set
209# CONFIG_SCSI_DEBUG is not set
210
211#
212# Fusion MPT device support
213#
214# CONFIG_FUSION is not set
215
216#
217# IEEE 1394 (FireWire) support (EXPERIMENTAL)
218#
219# CONFIG_IEEE1394 is not set
220
221#
222# I2O device support
223#
224# CONFIG_I2O is not set
225
226#
227# Networking support
228#
229CONFIG_NET=y
230
231#
232# Networking options
233#
234CONFIG_PACKET=y
235# CONFIG_PACKET_MMAP is not set
236# CONFIG_NETLINK_DEV is not set
237CONFIG_NETFILTER=y
238# CONFIG_NETFILTER_DEBUG is not set
239CONFIG_UNIX=y
240# CONFIG_NET_KEY is not set
241CONFIG_INET=y
242# CONFIG_IP_MULTICAST is not set
243# CONFIG_IP_ADVANCED_ROUTER is not set
244# CONFIG_IP_PNP is not set
245# CONFIG_NET_IPIP is not set
246# CONFIG_NET_IPGRE is not set
247# CONFIG_ARPD is not set
248# CONFIG_INET_ECN is not set
249# CONFIG_SYN_COOKIES is not set
250# CONFIG_INET_AH is not set
251# CONFIG_INET_ESP is not set
252# CONFIG_INET_IPCOMP is not set
253
254#
255# IP: Netfilter Configuration
256#
257# CONFIG_IP_NF_CONNTRACK is not set
258# CONFIG_IP_NF_QUEUE is not set
259# CONFIG_IP_NF_IPTABLES is not set
260# CONFIG_IP_NF_ARPTABLES is not set
261# CONFIG_IP_NF_COMPAT_IPCHAINS is not set
262# CONFIG_IP_NF_COMPAT_IPFWADM is not set
263# CONFIG_IPV6 is not set
264# CONFIG_XFRM_USER is not set
265
266#
267# SCTP Configuration (EXPERIMENTAL)
268#
269CONFIG_IPV6_SCTP__=y
270# CONFIG_IP_SCTP is not set
271# CONFIG_ATM is not set
272# CONFIG_VLAN_8021Q is not set
273# CONFIG_LLC is not set
274# CONFIG_DECNET is not set
275# CONFIG_BRIDGE is not set
276# CONFIG_X25 is not set
277# CONFIG_LAPB is not set
278# CONFIG_NET_DIVERT is not set
279# CONFIG_ECONET is not set
280# CONFIG_WAN_ROUTER is not set
281# CONFIG_NET_HW_FLOWCONTROL is not set
282
283#
284# QoS and/or fair queueing
285#
286# CONFIG_NET_SCHED is not set
287
288#
289# Network testing
290#
291# CONFIG_NET_PKTGEN is not set
292CONFIG_NETDEVICES=y
293
294#
295# ARCnet devices
296#
297# CONFIG_ARCNET is not set
298# CONFIG_DUMMY is not set
299# CONFIG_BONDING is not set
300# CONFIG_EQUALIZER is not set
301# CONFIG_TUN is not set
302# CONFIG_ETHERTAP is not set
303
304#
305# Ethernet (10 or 100Mbit)
306#
307CONFIG_NET_ETHERNET=y
308# CONFIG_MII is not set
309# CONFIG_OAKNET is not set
310# CONFIG_HAPPYMEAL is not set
311# CONFIG_SUNGEM is not set
312# CONFIG_NET_VENDOR_3COM is not set
313
314#
315# Tulip family network device support
316#
317# CONFIG_NET_TULIP is not set
318# CONFIG_HP100 is not set
319# CONFIG_NET_PCI is not set
320
321#
322# Ethernet (1000 Mbit)
323#
324# CONFIG_ACENIC is not set
325# CONFIG_DL2K is not set
326# CONFIG_E1000 is not set
327# CONFIG_NS83820 is not set
328# CONFIG_HAMACHI is not set
329# CONFIG_YELLOWFIN is not set
330# CONFIG_R8169 is not set
331# CONFIG_SK98LIN is not set
332# CONFIG_TIGON3 is not set
333
334#
335# Ethernet (10000 Mbit)
336#
337# CONFIG_IXGB is not set
338# CONFIG_FDDI is not set
339# CONFIG_HIPPI is not set
340# CONFIG_PPP is not set
341# CONFIG_SLIP is not set
342
343#
344# Wireless LAN (non-hamradio)
345#
346# CONFIG_NET_RADIO is not set
347
348#
349# Token Ring devices (depends on LLC=y)
350#
351# CONFIG_NET_FC is not set
352# CONFIG_RCPCI is not set
353# CONFIG_SHAPER is not set
354
355#
356# Wan interfaces
357#
358# CONFIG_WAN is not set
359
360#
361# Amateur Radio support
362#
363# CONFIG_HAMRADIO is not set
364
365#
366# IrDA (infrared) support
367#
368# CONFIG_IRDA is not set
369
370#
371# ISDN subsystem
372#
373# CONFIG_ISDN_BOOL is not set
374
375#
376# Graphics support
377#
378# CONFIG_FB is not set
379
380#
381# Old CD-ROM drivers (not SCSI, not IDE)
382#
383# CONFIG_CD_NO_IDESCSI is not set
384
385#
386# Input device support
387#
388# CONFIG_INPUT is not set
389
390#
391# Userland interfaces
392#
393
394#
395# Input I/O drivers
396#
397# CONFIG_GAMEPORT is not set
398CONFIG_SOUND_GAMEPORT=y
399# CONFIG_SERIO is not set
400
401#
402# Input Device Drivers
403#
404
405#
406# Macintosh device drivers
407#
408
409#
410# Character devices
411#
412# CONFIG_SERIAL_NONSTANDARD is not set
413
414#
415# Serial drivers
416#
417CONFIG_SERIAL_8250=y
418CONFIG_SERIAL_8250_CONSOLE=y
419# CONFIG_SERIAL_8250_EXTENDED is not set
420
421#
422# Non-8250 serial port support
423#
424CONFIG_SERIAL_CORE=y
425CONFIG_SERIAL_CORE_CONSOLE=y
426CONFIG_UNIX98_PTYS=y
427CONFIG_UNIX98_PTY_COUNT=256
428
429#
430# I2C support
431#
432# CONFIG_I2C is not set
433
434#
435# I2C Hardware Sensors Mainboard support
436#
437
438#
439# I2C Hardware Sensors Chip support
440#
441# CONFIG_I2C_SENSOR is not set
442
443#
444# Mice
445#
446# CONFIG_BUSMOUSE is not set
447# CONFIG_QIC02_TAPE is not set
448
449#
450# IPMI
451#
452# CONFIG_IPMI_HANDLER is not set
453
454#
455# Watchdog Cards
456#
457# CONFIG_WATCHDOG is not set
458# CONFIG_NVRAM is not set
459CONFIG_GEN_RTC=y
460# CONFIG_GEN_RTC_X is not set
461# CONFIG_DTLK is not set
462# CONFIG_R3964 is not set
463# CONFIG_APPLICOM is not set
464
465#
466# Ftape, the floppy tape device driver
467#
468# CONFIG_FTAPE is not set
469# CONFIG_AGP is not set
470# CONFIG_DRM is not set
471# CONFIG_RAW_DRIVER is not set
472# CONFIG_HANGCHECK_TIMER is not set
473
474#
475# Multimedia devices
476#
477# CONFIG_VIDEO_DEV is not set
478
479#
480# Digital Video Broadcasting Devices
481#
482# CONFIG_DVB is not set
483
484#
485# File systems
486#
487CONFIG_EXT2_FS=y
488# CONFIG_EXT2_FS_XATTR is not set
489# CONFIG_EXT3_FS is not set
490# CONFIG_JBD is not set
491# CONFIG_REISERFS_FS is not set
492# CONFIG_JFS_FS is not set
493# CONFIG_XFS_FS is not set
494# CONFIG_MINIX_FS is not set
495# CONFIG_ROMFS_FS is not set
496# CONFIG_QUOTA is not set
497# CONFIG_AUTOFS_FS is not set
498# CONFIG_AUTOFS4_FS is not set
499
500#
501# CD-ROM/DVD Filesystems
502#
503CONFIG_ISO9660_FS=y
504# CONFIG_JOLIET is not set
505# CONFIG_ZISOFS is not set
506# CONFIG_UDF_FS is not set
507
508#
509# DOS/FAT/NT Filesystems
510#
511# CONFIG_FAT_FS is not set
512# CONFIG_NTFS_FS is not set
513
514#
515# Pseudo filesystems
516#
517CONFIG_PROC_FS=y
518CONFIG_DEVFS_FS=y
519# CONFIG_DEVFS_MOUNT is not set
520# CONFIG_DEVFS_DEBUG is not set
521CONFIG_DEVPTS_FS=y
522# CONFIG_DEVPTS_FS_XATTR is not set
523CONFIG_TMPFS=y
524CONFIG_RAMFS=y
525
526#
527# Miscellaneous filesystems
528#
529# CONFIG_ADFS_FS is not set
530# CONFIG_AFFS_FS is not set
531# CONFIG_HFS_FS is not set
532# CONFIG_BEFS_FS is not set
533# CONFIG_BFS_FS is not set
534# CONFIG_EFS_FS is not set
535# CONFIG_CRAMFS is not set
536# CONFIG_VXFS_FS is not set
537# CONFIG_HPFS_FS is not set
538# CONFIG_QNX4FS_FS is not set
539# CONFIG_SYSV_FS is not set
540# CONFIG_UFS_FS is not set
541
542#
543# Network File Systems
544#
545CONFIG_NFS_FS=y
546# CONFIG_NFS_V3 is not set
547# CONFIG_NFS_V4 is not set
548CONFIG_NFSD=y
549# CONFIG_NFSD_V3 is not set
550# CONFIG_NFSD_TCP is not set
551CONFIG_LOCKD=y
552CONFIG_EXPORTFS=y
553CONFIG_SUNRPC=y
554# CONFIG_SUNRPC_GSS is not set
555# CONFIG_SMB_FS is not set
556# CONFIG_CIFS is not set
557# CONFIG_NCP_FS is not set
558# CONFIG_CODA_FS is not set
559# CONFIG_INTERMEZZO_FS is not set
560# CONFIG_AFS_FS is not set
561
562#
563# Partition Types
564#
565CONFIG_PARTITION_ADVANCED=y
566# CONFIG_ACORN_PARTITION is not set
567# CONFIG_OSF_PARTITION is not set
568# CONFIG_AMIGA_PARTITION is not set
569# CONFIG_ATARI_PARTITION is not set
570# CONFIG_MAC_PARTITION is not set
571CONFIG_MSDOS_PARTITION=y
572# CONFIG_BSD_DISKLABEL is not set
573# CONFIG_MINIX_SUBPARTITION is not set
574CONFIG_SOLARIS_X86_PARTITION=y
575# CONFIG_UNIXWARE_DISKLABEL is not set
576# CONFIG_LDM_PARTITION is not set
577# CONFIG_NEC98_PARTITION is not set
578# CONFIG_SGI_PARTITION is not set
579# CONFIG_ULTRIX_PARTITION is not set
580# CONFIG_SUN_PARTITION is not set
581# CONFIG_EFI_PARTITION is not set
582
583#
584# Sound
585#
586# CONFIG_SOUND is not set
587
588#
589# USB support
590#
591# CONFIG_USB is not set
592# CONFIG_USB_GADGET is not set
593
594#
595# Bluetooth support
596#
597# CONFIG_BT is not set
598
599#
600# Library routines
601#
602# CONFIG_CRC32 is not set
603
604#
605# Kernel hacking
606#
607# CONFIG_DEBUG_KERNEL is not set
608# CONFIG_KALLSYMS is not set
609
610#
611# Security options
612#
613# CONFIG_SECURITY is not set
614
615#
616# Cryptographic options
617#
618# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/hdpu_defconfig b/arch/ppc/configs/hdpu_defconfig
new file mode 100644
index 000000000000..956a17897e33
--- /dev/null
+++ b/arch/ppc/configs/hdpu_defconfig
@@ -0,0 +1,890 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11
4# Wed Mar 16 12:43:19 2005
5#
6CONFIG_MMU=y
7CONFIG_GENERIC_HARDIRQS=y
8CONFIG_RWSEM_XCHGADD_ALGORITHM=y
9CONFIG_GENERIC_CALIBRATE_DELAY=y
10CONFIG_HAVE_DEC_LOCK=y
11CONFIG_PPC=y
12CONFIG_PPC32=y
13CONFIG_GENERIC_NVRAM=y
14
15#
16# Code maturity level options
17#
18CONFIG_EXPERIMENTAL=y
19CONFIG_CLEAN_COMPILE=y
20CONFIG_LOCK_KERNEL=y
21
22#
23# General setup
24#
25CONFIG_LOCALVERSION=""
26CONFIG_SWAP=y
27CONFIG_SYSVIPC=y
28# CONFIG_POSIX_MQUEUE is not set
29# CONFIG_BSD_PROCESS_ACCT is not set
30CONFIG_SYSCTL=y
31# CONFIG_AUDIT is not set
32CONFIG_HOTPLUG=y
33CONFIG_KOBJECT_UEVENT=y
34# CONFIG_IKCONFIG is not set
35# CONFIG_CPUSETS is not set
36CONFIG_EMBEDDED=y
37# CONFIG_KALLSYMS is not set
38CONFIG_BASE_FULL=y
39CONFIG_FUTEX=y
40CONFIG_EPOLL=y
41# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
42CONFIG_SHMEM=y
43CONFIG_CC_ALIGN_FUNCTIONS=0
44CONFIG_CC_ALIGN_LABELS=0
45CONFIG_CC_ALIGN_LOOPS=0
46CONFIG_CC_ALIGN_JUMPS=0
47# CONFIG_TINY_SHMEM is not set
48CONFIG_BASE_SMALL=0
49
50#
51# Loadable module support
52#
53CONFIG_MODULES=y
54CONFIG_MODULE_UNLOAD=y
55# CONFIG_MODULE_FORCE_UNLOAD is not set
56CONFIG_OBSOLETE_MODPARM=y
57# CONFIG_MODVERSIONS is not set
58# CONFIG_MODULE_SRCVERSION_ALL is not set
59CONFIG_KMOD=y
60CONFIG_STOP_MACHINE=y
61
62#
63# Processor
64#
65CONFIG_6xx=y
66# CONFIG_40x is not set
67# CONFIG_44x is not set
68# CONFIG_POWER3 is not set
69# CONFIG_POWER4 is not set
70# CONFIG_8xx is not set
71# CONFIG_E500 is not set
72CONFIG_ALTIVEC=y
73# CONFIG_TAU is not set
74# CONFIG_CPU_FREQ is not set
75# CONFIG_PM is not set
76CONFIG_PPC_STD_MMU=y
77# CONFIG_NOT_COHERENT_CACHE is not set
78
79#
80# Platform options
81#
82# CONFIG_PPC_MULTIPLATFORM is not set
83# CONFIG_APUS is not set
84# CONFIG_KATANA is not set
85# CONFIG_WILLOW is not set
86# CONFIG_CPCI690 is not set
87# CONFIG_PCORE is not set
88# CONFIG_POWERPMC250 is not set
89# CONFIG_CHESTNUT is not set
90# CONFIG_SPRUCE is not set
91CONFIG_HDPU=y
92# CONFIG_EV64260 is not set
93# CONFIG_LOPEC is not set
94# CONFIG_MCPN765 is not set
95# CONFIG_MVME5100 is not set
96# CONFIG_PPLUS is not set
97# CONFIG_PRPMC750 is not set
98# CONFIG_PRPMC800 is not set
99# CONFIG_SANDPOINT is not set
100# CONFIG_RADSTONE_PPC7D is not set
101# CONFIG_ADIR is not set
102# CONFIG_K2 is not set
103# CONFIG_PAL4 is not set
104# CONFIG_GEMINI is not set
105# CONFIG_EST8260 is not set
106# CONFIG_SBC82xx is not set
107# CONFIG_SBS8260 is not set
108# CONFIG_RPX8260 is not set
109# CONFIG_TQM8260 is not set
110# CONFIG_ADS8272 is not set
111# CONFIG_PQ2FADS is not set
112# CONFIG_LITE5200 is not set
113# CONFIG_MPC834x_SYS is not set
114CONFIG_MV64360=y
115CONFIG_MV64X60=y
116
117#
118# Set bridge options
119#
120CONFIG_MV64X60_BASE=0xf1000000
121CONFIG_MV64X60_NEW_BASE=0xf1000000
122# CONFIG_SMP is not set
123# CONFIG_IRQ_ALL_CPUS is not set
124# CONFIG_NR_CPUS is not set
125CONFIG_PREEMPT=y
126CONFIG_HIGHMEM=y
127CONFIG_BINFMT_ELF=y
128CONFIG_BINFMT_MISC=y
129CONFIG_CMDLINE_BOOL=y
130CONFIG_CMDLINE="root=/dev/nfs ip=auto"
131
132#
133# Bus options
134#
135CONFIG_GENERIC_ISA_DMA=y
136CONFIG_PCI=y
137CONFIG_PCI_DOMAINS=y
138CONFIG_PCI_LEGACY_PROC=y
139CONFIG_PCI_NAMES=y
140
141#
142# PCCARD (PCMCIA/CardBus) support
143#
144# CONFIG_PCCARD is not set
145
146#
147# Advanced setup
148#
149CONFIG_ADVANCED_OPTIONS=y
150# CONFIG_HIGHMEM_START_BOOL is not set
151CONFIG_HIGHMEM_START=0xfe000000
152# CONFIG_LOWMEM_SIZE_BOOL is not set
153CONFIG_LOWMEM_SIZE=0x30000000
154CONFIG_KERNEL_START_BOOL=y
155CONFIG_KERNEL_START=0x80000000
156# CONFIG_TASK_SIZE_BOOL is not set
157CONFIG_TASK_SIZE=0x80000000
158# CONFIG_BOOT_LOAD_BOOL is not set
159CONFIG_BOOT_LOAD=0x00800000
160
161#
162# Device Drivers
163#
164
165#
166# Generic Driver Options
167#
168CONFIG_STANDALONE=y
169CONFIG_PREVENT_FIRMWARE_BUILD=y
170CONFIG_FW_LOADER=y
171
172#
173# Memory Technology Devices (MTD)
174#
175CONFIG_MTD=y
176# CONFIG_MTD_DEBUG is not set
177# CONFIG_MTD_CONCAT is not set
178CONFIG_MTD_PARTITIONS=y
179# CONFIG_MTD_REDBOOT_PARTS is not set
180# CONFIG_MTD_CMDLINE_PARTS is not set
181
182#
183# User Modules And Translation Layers
184#
185CONFIG_MTD_CHAR=y
186# CONFIG_MTD_BLOCK is not set
187# CONFIG_MTD_BLOCK_RO is not set
188# CONFIG_FTL is not set
189# CONFIG_NFTL is not set
190# CONFIG_INFTL is not set
191
192#
193# RAM/ROM/Flash chip drivers
194#
195CONFIG_MTD_CFI=y
196# CONFIG_MTD_JEDECPROBE is not set
197CONFIG_MTD_GEN_PROBE=y
198# CONFIG_MTD_CFI_ADV_OPTIONS is not set
199CONFIG_MTD_MAP_BANK_WIDTH_1=y
200CONFIG_MTD_MAP_BANK_WIDTH_2=y
201CONFIG_MTD_MAP_BANK_WIDTH_4=y
202# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
203# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
204# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
205CONFIG_MTD_CFI_I1=y
206CONFIG_MTD_CFI_I2=y
207# CONFIG_MTD_CFI_I4 is not set
208# CONFIG_MTD_CFI_I8 is not set
209CONFIG_MTD_CFI_INTELEXT=y
210# CONFIG_MTD_CFI_AMDSTD is not set
211# CONFIG_MTD_CFI_STAA is not set
212CONFIG_MTD_CFI_UTIL=y
213# CONFIG_MTD_RAM is not set
214# CONFIG_MTD_ROM is not set
215# CONFIG_MTD_ABSENT is not set
216
217#
218# Mapping drivers for chip access
219#
220# CONFIG_MTD_COMPLEX_MAPPINGS is not set
221CONFIG_MTD_PHYSMAP=y
222CONFIG_MTD_PHYSMAP_START=0xfc000000
223CONFIG_MTD_PHYSMAP_LEN=0x04000000
224CONFIG_MTD_PHYSMAP_BANKWIDTH=4
225
226#
227# Self-contained MTD device drivers
228#
229# CONFIG_MTD_PMC551 is not set
230# CONFIG_MTD_SLRAM is not set
231# CONFIG_MTD_PHRAM is not set
232# CONFIG_MTD_MTDRAM is not set
233# CONFIG_MTD_BLKMTD is not set
234# CONFIG_MTD_BLOCK2MTD is not set
235
236#
237# Disk-On-Chip Device Drivers
238#
239# CONFIG_MTD_DOC2000 is not set
240# CONFIG_MTD_DOC2001 is not set
241# CONFIG_MTD_DOC2001PLUS is not set
242
243#
244# NAND Flash Device Drivers
245#
246# CONFIG_MTD_NAND is not set
247
248#
249# Parallel port support
250#
251# CONFIG_PARPORT is not set
252
253#
254# Plug and Play support
255#
256
257#
258# Block devices
259#
260# CONFIG_BLK_DEV_FD is not set
261# CONFIG_BLK_CPQ_DA is not set
262# CONFIG_BLK_CPQ_CISS_DA is not set
263# CONFIG_BLK_DEV_DAC960 is not set
264# CONFIG_BLK_DEV_UMEM is not set
265# CONFIG_BLK_DEV_COW_COMMON is not set
266CONFIG_BLK_DEV_LOOP=y
267# CONFIG_BLK_DEV_CRYPTOLOOP is not set
268# CONFIG_BLK_DEV_NBD is not set
269# CONFIG_BLK_DEV_SX8 is not set
270CONFIG_BLK_DEV_RAM=y
271CONFIG_BLK_DEV_RAM_COUNT=16
272CONFIG_BLK_DEV_RAM_SIZE=8192
273CONFIG_BLK_DEV_INITRD=y
274CONFIG_INITRAMFS_SOURCE=""
275# CONFIG_LBD is not set
276# CONFIG_CDROM_PKTCDVD is not set
277
278#
279# IO Schedulers
280#
281CONFIG_IOSCHED_NOOP=y
282CONFIG_IOSCHED_AS=y
283CONFIG_IOSCHED_DEADLINE=y
284CONFIG_IOSCHED_CFQ=y
285# CONFIG_ATA_OVER_ETH is not set
286
287#
288# ATA/ATAPI/MFM/RLL support
289#
290# CONFIG_IDE is not set
291
292#
293# SCSI device support
294#
295CONFIG_SCSI=y
296CONFIG_SCSI_PROC_FS=y
297
298#
299# SCSI support type (disk, tape, CD-ROM)
300#
301CONFIG_BLK_DEV_SD=y
302CONFIG_CHR_DEV_ST=y
303# CONFIG_CHR_DEV_OSST is not set
304CONFIG_BLK_DEV_SR=y
305# CONFIG_BLK_DEV_SR_VENDOR is not set
306CONFIG_CHR_DEV_SG=y
307
308#
309# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
310#
311# CONFIG_SCSI_MULTI_LUN is not set
312CONFIG_SCSI_CONSTANTS=y
313# CONFIG_SCSI_LOGGING is not set
314
315#
316# SCSI Transport Attributes
317#
318# CONFIG_SCSI_SPI_ATTRS is not set
319# CONFIG_SCSI_FC_ATTRS is not set
320# CONFIG_SCSI_ISCSI_ATTRS is not set
321
322#
323# SCSI low-level drivers
324#
325# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
326# CONFIG_SCSI_3W_9XXX is not set
327# CONFIG_SCSI_ACARD is not set
328# CONFIG_SCSI_AACRAID is not set
329CONFIG_SCSI_AIC7XXX=y
330CONFIG_AIC7XXX_CMDS_PER_DEVICE=32
331CONFIG_AIC7XXX_RESET_DELAY_MS=15000
332# CONFIG_AIC7XXX_DEBUG_ENABLE is not set
333CONFIG_AIC7XXX_DEBUG_MASK=0
334# CONFIG_AIC7XXX_REG_PRETTY_PRINT is not set
335# CONFIG_SCSI_AIC7XXX_OLD is not set
336# CONFIG_SCSI_AIC79XX is not set
337# CONFIG_SCSI_DPT_I2O is not set
338# CONFIG_MEGARAID_NEWGEN is not set
339# CONFIG_MEGARAID_LEGACY is not set
340# CONFIG_SCSI_SATA is not set
341# CONFIG_SCSI_BUSLOGIC is not set
342# CONFIG_SCSI_DMX3191D is not set
343# CONFIG_SCSI_EATA is not set
344# CONFIG_SCSI_EATA_PIO is not set
345# CONFIG_SCSI_FUTURE_DOMAIN is not set
346# CONFIG_SCSI_GDTH is not set
347# CONFIG_SCSI_IPS is not set
348# CONFIG_SCSI_INITIO is not set
349# CONFIG_SCSI_INIA100 is not set
350# CONFIG_SCSI_SYM53C8XX_2 is not set
351# CONFIG_SCSI_IPR is not set
352# CONFIG_SCSI_QLOGIC_ISP is not set
353# CONFIG_SCSI_QLOGIC_FC is not set
354# CONFIG_SCSI_QLOGIC_1280 is not set
355CONFIG_SCSI_QLA2XXX=y
356# CONFIG_SCSI_QLA21XX is not set
357# CONFIG_SCSI_QLA22XX is not set
358# CONFIG_SCSI_QLA2300 is not set
359# CONFIG_SCSI_QLA2322 is not set
360# CONFIG_SCSI_QLA6312 is not set
361# CONFIG_SCSI_DC395x is not set
362# CONFIG_SCSI_DC390T is not set
363# CONFIG_SCSI_NSP32 is not set
364# CONFIG_SCSI_DEBUG is not set
365
366#
367# Multi-device support (RAID and LVM)
368#
369# CONFIG_MD is not set
370
371#
372# Fusion MPT device support
373#
374# CONFIG_FUSION is not set
375
376#
377# IEEE 1394 (FireWire) support
378#
379# CONFIG_IEEE1394 is not set
380
381#
382# I2O device support
383#
384# CONFIG_I2O is not set
385
386#
387# Macintosh device drivers
388#
389
390#
391# Networking support
392#
393CONFIG_NET=y
394
395#
396# Networking options
397#
398CONFIG_PACKET=y
399CONFIG_PACKET_MMAP=y
400# CONFIG_NETLINK_DEV is not set
401CONFIG_UNIX=y
402# CONFIG_NET_KEY is not set
403CONFIG_INET=y
404CONFIG_IP_MULTICAST=y
405# CONFIG_IP_ADVANCED_ROUTER is not set
406CONFIG_IP_PNP=y
407# CONFIG_IP_PNP_DHCP is not set
408CONFIG_IP_PNP_BOOTP=y
409# CONFIG_IP_PNP_RARP is not set
410# CONFIG_NET_IPIP is not set
411# CONFIG_NET_IPGRE is not set
412# CONFIG_IP_MROUTE is not set
413# CONFIG_ARPD is not set
414# CONFIG_SYN_COOKIES is not set
415# CONFIG_INET_AH is not set
416# CONFIG_INET_ESP is not set
417# CONFIG_INET_IPCOMP is not set
418# CONFIG_INET_TUNNEL is not set
419# CONFIG_IP_TCPDIAG is not set
420# CONFIG_IP_TCPDIAG_IPV6 is not set
421# CONFIG_IPV6 is not set
422# CONFIG_NETFILTER is not set
423
424#
425# SCTP Configuration (EXPERIMENTAL)
426#
427# CONFIG_IP_SCTP is not set
428# CONFIG_ATM is not set
429# CONFIG_BRIDGE is not set
430# CONFIG_VLAN_8021Q is not set
431# CONFIG_DECNET is not set
432# CONFIG_LLC2 is not set
433# CONFIG_IPX is not set
434# CONFIG_ATALK is not set
435# CONFIG_X25 is not set
436# CONFIG_LAPB is not set
437# CONFIG_NET_DIVERT is not set
438# CONFIG_ECONET is not set
439# CONFIG_WAN_ROUTER is not set
440
441#
442# QoS and/or fair queueing
443#
444# CONFIG_NET_SCHED is not set
445# CONFIG_NET_CLS_ROUTE is not set
446
447#
448# Network testing
449#
450# CONFIG_NET_PKTGEN is not set
451# CONFIG_NETPOLL is not set
452# CONFIG_NET_POLL_CONTROLLER is not set
453# CONFIG_HAMRADIO is not set
454# CONFIG_IRDA is not set
455# CONFIG_BT is not set
456CONFIG_NETDEVICES=y
457# CONFIG_DUMMY is not set
458# CONFIG_BONDING is not set
459# CONFIG_EQUALIZER is not set
460# CONFIG_TUN is not set
461
462#
463# ARCnet devices
464#
465# CONFIG_ARCNET is not set
466
467#
468# Ethernet (10 or 100Mbit)
469#
470CONFIG_NET_ETHERNET=y
471CONFIG_MII=y
472# CONFIG_HAPPYMEAL is not set
473# CONFIG_SUNGEM is not set
474# CONFIG_NET_VENDOR_3COM is not set
475
476#
477# Tulip family network device support
478#
479# CONFIG_NET_TULIP is not set
480# CONFIG_HP100 is not set
481# CONFIG_NET_PCI is not set
482
483#
484# Ethernet (1000 Mbit)
485#
486# CONFIG_ACENIC is not set
487# CONFIG_DL2K is not set
488# CONFIG_E1000 is not set
489# CONFIG_NS83820 is not set
490# CONFIG_HAMACHI is not set
491# CONFIG_YELLOWFIN is not set
492# CONFIG_R8169 is not set
493# CONFIG_SK98LIN is not set
494# CONFIG_TIGON3 is not set
495CONFIG_MV643XX_ETH=y
496CONFIG_MV643XX_ETH_0=y
497# CONFIG_MV643XX_ETH_1 is not set
498# CONFIG_MV643XX_ETH_2 is not set
499
500#
501# Ethernet (10000 Mbit)
502#
503# CONFIG_IXGB is not set
504# CONFIG_S2IO is not set
505
506#
507# Token Ring devices
508#
509# CONFIG_TR is not set
510
511#
512# Wireless LAN (non-hamradio)
513#
514# CONFIG_NET_RADIO is not set
515
516#
517# Wan interfaces
518#
519# CONFIG_WAN is not set
520# CONFIG_FDDI is not set
521# CONFIG_HIPPI is not set
522# CONFIG_PPP is not set
523# CONFIG_SLIP is not set
524# CONFIG_NET_FC is not set
525# CONFIG_SHAPER is not set
526# CONFIG_NETCONSOLE is not set
527
528#
529# ISDN subsystem
530#
531# CONFIG_ISDN is not set
532
533#
534# Telephony Support
535#
536# CONFIG_PHONE is not set
537
538#
539# Input device support
540#
541CONFIG_INPUT=y
542
543#
544# Userland interfaces
545#
546CONFIG_INPUT_MOUSEDEV=y
547CONFIG_INPUT_MOUSEDEV_PSAUX=y
548CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
549CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
550# CONFIG_INPUT_JOYDEV is not set
551# CONFIG_INPUT_TSDEV is not set
552# CONFIG_INPUT_EVDEV is not set
553# CONFIG_INPUT_EVBUG is not set
554
555#
556# Input Device Drivers
557#
558# CONFIG_INPUT_KEYBOARD is not set
559# CONFIG_INPUT_MOUSE is not set
560# CONFIG_INPUT_JOYSTICK is not set
561# CONFIG_INPUT_TOUCHSCREEN is not set
562# CONFIG_INPUT_MISC is not set
563
564#
565# Hardware I/O ports
566#
567# CONFIG_SERIO is not set
568# CONFIG_GAMEPORT is not set
569CONFIG_SOUND_GAMEPORT=y
570
571#
572# Character devices
573#
574# CONFIG_VT is not set
575# CONFIG_SERIAL_NONSTANDARD is not set
576
577#
578# Serial drivers
579#
580# CONFIG_SERIAL_8250 is not set
581
582#
583# Non-8250 serial port support
584#
585CONFIG_SERIAL_MPSC=y
586CONFIG_SERIAL_MPSC_CONSOLE=y
587CONFIG_SERIAL_CORE=y
588CONFIG_SERIAL_CORE_CONSOLE=y
589CONFIG_UNIX98_PTYS=y
590CONFIG_LEGACY_PTYS=y
591CONFIG_LEGACY_PTY_COUNT=256
592
593#
594# IPMI
595#
596# CONFIG_IPMI_HANDLER is not set
597
598#
599# Watchdog Cards
600#
601# CONFIG_WATCHDOG is not set
602# CONFIG_NVRAM is not set
603CONFIG_GEN_RTC=y
604# CONFIG_GEN_RTC_X is not set
605# CONFIG_DTLK is not set
606# CONFIG_R3964 is not set
607# CONFIG_APPLICOM is not set
608
609#
610# Ftape, the floppy tape device driver
611#
612# CONFIG_AGP is not set
613# CONFIG_DRM is not set
614# CONFIG_RAW_DRIVER is not set
615
616#
617# TPM devices
618#
619# CONFIG_TCG_TPM is not set
620
621#
622# I2C support
623#
624# CONFIG_I2C is not set
625
626#
627# Dallas's 1-wire bus
628#
629# CONFIG_W1 is not set
630
631#
632# Misc devices
633#
634
635#
636# Multimedia devices
637#
638# CONFIG_VIDEO_DEV is not set
639
640#
641# Digital Video Broadcasting Devices
642#
643# CONFIG_DVB is not set
644
645#
646# Graphics support
647#
648# CONFIG_FB is not set
649
650#
651# Sound
652#
653# CONFIG_SOUND is not set
654
655#
656# USB support
657#
658CONFIG_USB_ARCH_HAS_HCD=y
659CONFIG_USB_ARCH_HAS_OHCI=y
660# CONFIG_USB is not set
661
662#
663# USB Gadget Support
664#
665# CONFIG_USB_GADGET is not set
666
667#
668# MMC/SD Card support
669#
670# CONFIG_MMC is not set
671
672#
673# InfiniBand support
674#
675# CONFIG_INFINIBAND is not set
676
677#
678# File systems
679#
680CONFIG_EXT2_FS=y
681# CONFIG_EXT2_FS_XATTR is not set
682CONFIG_EXT3_FS=y
683# CONFIG_EXT3_FS_XATTR is not set
684CONFIG_JBD=y
685# CONFIG_JBD_DEBUG is not set
686# CONFIG_REISERFS_FS is not set
687# CONFIG_JFS_FS is not set
688CONFIG_FS_POSIX_ACL=y
689
690#
691# XFS support
692#
693# CONFIG_XFS_FS is not set
694# CONFIG_MINIX_FS is not set
695# CONFIG_ROMFS_FS is not set
696# CONFIG_QUOTA is not set
697CONFIG_DNOTIFY=y
698# CONFIG_AUTOFS_FS is not set
699# CONFIG_AUTOFS4_FS is not set
700
701#
702# CD-ROM/DVD Filesystems
703#
704CONFIG_ISO9660_FS=y
705CONFIG_JOLIET=y
706# CONFIG_ZISOFS is not set
707CONFIG_UDF_FS=y
708CONFIG_UDF_NLS=y
709
710#
711# DOS/FAT/NT Filesystems
712#
713# CONFIG_MSDOS_FS is not set
714# CONFIG_VFAT_FS is not set
715# CONFIG_NTFS_FS is not set
716
717#
718# Pseudo filesystems
719#
720CONFIG_PROC_FS=y
721CONFIG_PROC_KCORE=y
722CONFIG_SYSFS=y
723# CONFIG_DEVFS_FS is not set
724# CONFIG_DEVPTS_FS_XATTR is not set
725CONFIG_TMPFS=y
726# CONFIG_TMPFS_XATTR is not set
727# CONFIG_HUGETLB_PAGE is not set
728CONFIG_RAMFS=y
729
730#
731# Miscellaneous filesystems
732#
733# CONFIG_ADFS_FS is not set
734# CONFIG_AFFS_FS is not set
735# CONFIG_HFS_FS is not set
736# CONFIG_HFSPLUS_FS is not set
737# CONFIG_BEFS_FS is not set
738# CONFIG_BFS_FS is not set
739# CONFIG_EFS_FS is not set
740# CONFIG_JFFS_FS is not set
741CONFIG_JFFS2_FS=y
742CONFIG_JFFS2_FS_DEBUG=0
743# CONFIG_JFFS2_FS_NAND is not set
744# CONFIG_JFFS2_FS_NOR_ECC is not set
745# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
746CONFIG_JFFS2_ZLIB=y
747CONFIG_JFFS2_RTIME=y
748# CONFIG_JFFS2_RUBIN is not set
749# CONFIG_CRAMFS is not set
750# CONFIG_VXFS_FS is not set
751# CONFIG_HPFS_FS is not set
752# CONFIG_QNX4FS_FS is not set
753# CONFIG_SYSV_FS is not set
754# CONFIG_UFS_FS is not set
755
756#
757# Network File Systems
758#
759CONFIG_NFS_FS=y
760CONFIG_NFS_V3=y
761CONFIG_NFS_V4=y
762CONFIG_NFS_DIRECTIO=y
763CONFIG_NFSD=y
764CONFIG_NFSD_V3=y
765CONFIG_NFSD_V4=y
766CONFIG_NFSD_TCP=y
767CONFIG_ROOT_NFS=y
768CONFIG_LOCKD=y
769CONFIG_LOCKD_V4=y
770CONFIG_EXPORTFS=y
771CONFIG_SUNRPC=y
772CONFIG_SUNRPC_GSS=y
773CONFIG_RPCSEC_GSS_KRB5=y
774# CONFIG_RPCSEC_GSS_SPKM3 is not set
775# CONFIG_SMB_FS is not set
776# CONFIG_CIFS is not set
777# CONFIG_NCP_FS is not set
778# CONFIG_CODA_FS is not set
779# CONFIG_AFS_FS is not set
780
781#
782# Partition Types
783#
784# CONFIG_PARTITION_ADVANCED is not set
785CONFIG_MSDOS_PARTITION=y
786
787#
788# Native Language Support
789#
790CONFIG_NLS=y
791CONFIG_NLS_DEFAULT="iso8859-1"
792# CONFIG_NLS_CODEPAGE_437 is not set
793# CONFIG_NLS_CODEPAGE_737 is not set
794# CONFIG_NLS_CODEPAGE_775 is not set
795# CONFIG_NLS_CODEPAGE_850 is not set
796# CONFIG_NLS_CODEPAGE_852 is not set
797# CONFIG_NLS_CODEPAGE_855 is not set
798# CONFIG_NLS_CODEPAGE_857 is not set
799# CONFIG_NLS_CODEPAGE_860 is not set
800# CONFIG_NLS_CODEPAGE_861 is not set
801# CONFIG_NLS_CODEPAGE_862 is not set
802# CONFIG_NLS_CODEPAGE_863 is not set
803# CONFIG_NLS_CODEPAGE_864 is not set
804# CONFIG_NLS_CODEPAGE_865 is not set
805# CONFIG_NLS_CODEPAGE_866 is not set
806# CONFIG_NLS_CODEPAGE_869 is not set
807# CONFIG_NLS_CODEPAGE_936 is not set
808# CONFIG_NLS_CODEPAGE_950 is not set
809# CONFIG_NLS_CODEPAGE_932 is not set
810# CONFIG_NLS_CODEPAGE_949 is not set
811# CONFIG_NLS_CODEPAGE_874 is not set
812# CONFIG_NLS_ISO8859_8 is not set
813# CONFIG_NLS_CODEPAGE_1250 is not set
814# CONFIG_NLS_CODEPAGE_1251 is not set
815# CONFIG_NLS_ASCII is not set
816# CONFIG_NLS_ISO8859_1 is not set
817# CONFIG_NLS_ISO8859_2 is not set
818# CONFIG_NLS_ISO8859_3 is not set
819# CONFIG_NLS_ISO8859_4 is not set
820# CONFIG_NLS_ISO8859_5 is not set
821# CONFIG_NLS_ISO8859_6 is not set
822# CONFIG_NLS_ISO8859_7 is not set
823# CONFIG_NLS_ISO8859_9 is not set
824# CONFIG_NLS_ISO8859_13 is not set
825# CONFIG_NLS_ISO8859_14 is not set
826# CONFIG_NLS_ISO8859_15 is not set
827# CONFIG_NLS_KOI8_R is not set
828# CONFIG_NLS_KOI8_U is not set
829# CONFIG_NLS_UTF8 is not set
830
831#
832# Library routines
833#
834# CONFIG_CRC_CCITT is not set
835CONFIG_CRC32=y
836# CONFIG_LIBCRC32C is not set
837CONFIG_ZLIB_INFLATE=y
838CONFIG_ZLIB_DEFLATE=y
839
840#
841# Profiling support
842#
843# CONFIG_PROFILING is not set
844
845#
846# Kernel hacking
847#
848# CONFIG_PRINTK_TIME is not set
849# CONFIG_DEBUG_KERNEL is not set
850CONFIG_LOG_BUF_SHIFT=15
851# CONFIG_SERIAL_TEXT_DEBUG is not set
852
853#
854# Security options
855#
856# CONFIG_KEYS is not set
857# CONFIG_SECURITY is not set
858
859#
860# Cryptographic options
861#
862CONFIG_CRYPTO=y
863# CONFIG_CRYPTO_HMAC is not set
864# CONFIG_CRYPTO_NULL is not set
865# CONFIG_CRYPTO_MD4 is not set
866CONFIG_CRYPTO_MD5=y
867# CONFIG_CRYPTO_SHA1 is not set
868# CONFIG_CRYPTO_SHA256 is not set
869# CONFIG_CRYPTO_SHA512 is not set
870# CONFIG_CRYPTO_WP512 is not set
871# CONFIG_CRYPTO_TGR192 is not set
872CONFIG_CRYPTO_DES=y
873# CONFIG_CRYPTO_BLOWFISH is not set
874# CONFIG_CRYPTO_TWOFISH is not set
875# CONFIG_CRYPTO_SERPENT is not set
876# CONFIG_CRYPTO_AES is not set
877# CONFIG_CRYPTO_CAST5 is not set
878# CONFIG_CRYPTO_CAST6 is not set
879# CONFIG_CRYPTO_TEA is not set
880# CONFIG_CRYPTO_ARC4 is not set
881# CONFIG_CRYPTO_KHAZAD is not set
882# CONFIG_CRYPTO_ANUBIS is not set
883# CONFIG_CRYPTO_DEFLATE is not set
884# CONFIG_CRYPTO_MICHAEL_MIC is not set
885# CONFIG_CRYPTO_CRC32C is not set
886# CONFIG_CRYPTO_TEST is not set
887
888#
889# Hardware crypto devices
890#
diff --git a/arch/ppc/configs/ibmchrp_defconfig b/arch/ppc/configs/ibmchrp_defconfig
new file mode 100644
index 000000000000..27f3e69c1f96
--- /dev/null
+++ b/arch/ppc/configs/ibmchrp_defconfig
@@ -0,0 +1,875 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7CONFIG_PPC=y
8CONFIG_PPC32=y
9CONFIG_GENERIC_NVRAM=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16# CONFIG_STANDALONE is not set
17CONFIG_BROKEN_ON_SMP=y
18
19#
20# General setup
21#
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24CONFIG_POSIX_MQUEUE=y
25# CONFIG_BSD_PROCESS_ACCT is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=14
29# CONFIG_HOTPLUG is not set
30CONFIG_IKCONFIG=y
31CONFIG_IKCONFIG_PROC=y
32# CONFIG_EMBEDDED is not set
33CONFIG_KALLSYMS=y
34CONFIG_FUTEX=y
35CONFIG_EPOLL=y
36CONFIG_IOSCHED_NOOP=y
37CONFIG_IOSCHED_AS=y
38CONFIG_IOSCHED_DEADLINE=y
39CONFIG_IOSCHED_CFQ=y
40# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
41
42#
43# Loadable module support
44#
45CONFIG_MODULES=y
46CONFIG_MODULE_UNLOAD=y
47CONFIG_MODULE_FORCE_UNLOAD=y
48CONFIG_OBSOLETE_MODPARM=y
49# CONFIG_MODVERSIONS is not set
50CONFIG_KMOD=y
51
52#
53# Processor
54#
55CONFIG_6xx=y
56# CONFIG_40x is not set
57# CONFIG_44x is not set
58# CONFIG_POWER3 is not set
59# CONFIG_POWER4 is not set
60# CONFIG_8xx is not set
61# CONFIG_ALTIVEC is not set
62# CONFIG_TAU is not set
63# CONFIG_CPU_FREQ is not set
64# CONFIG_PPC601_SYNC_FIX is not set
65CONFIG_PPC_STD_MMU=y
66
67#
68# Platform options
69#
70CONFIG_PPC_MULTIPLATFORM=y
71# CONFIG_APUS is not set
72# CONFIG_WILLOW is not set
73# CONFIG_PCORE is not set
74# CONFIG_POWERPMC250 is not set
75# CONFIG_EV64260 is not set
76# CONFIG_SPRUCE is not set
77# CONFIG_LOPEC is not set
78# CONFIG_MCPN765 is not set
79# CONFIG_MVME5100 is not set
80# CONFIG_PPLUS is not set
81# CONFIG_PRPMC750 is not set
82# CONFIG_PRPMC800 is not set
83# CONFIG_SANDPOINT is not set
84# CONFIG_ADIR is not set
85# CONFIG_K2 is not set
86# CONFIG_PAL4 is not set
87# CONFIG_GEMINI is not set
88# CONFIG_EST8260 is not set
89# CONFIG_SBS8260 is not set
90# CONFIG_RPX6 is not set
91# CONFIG_TQM8260 is not set
92CONFIG_PPC_CHRP=y
93CONFIG_PPC_PMAC=y
94CONFIG_PPC_PREP=y
95CONFIG_PPC_OF=y
96CONFIG_PPCBUG_NVRAM=y
97# CONFIG_SMP is not set
98# CONFIG_PREEMPT is not set
99CONFIG_HIGHMEM=y
100CONFIG_KERNEL_ELF=y
101CONFIG_BINFMT_ELF=y
102CONFIG_BINFMT_MISC=y
103CONFIG_PROC_DEVICETREE=y
104CONFIG_PPC_RTAS=y
105# CONFIG_PREP_RESIDUAL is not set
106# CONFIG_CMDLINE_BOOL is not set
107
108#
109# Bus options
110#
111CONFIG_ISA=y
112CONFIG_GENERIC_ISA_DMA=y
113CONFIG_PCI=y
114CONFIG_PCI_DOMAINS=y
115CONFIG_PCI_LEGACY_PROC=y
116CONFIG_PCI_NAMES=y
117
118#
119# Advanced setup
120#
121# CONFIG_ADVANCED_OPTIONS is not set
122
123#
124# Default settings for advanced configuration options are used
125#
126CONFIG_HIGHMEM_START=0xfe000000
127CONFIG_LOWMEM_SIZE=0x30000000
128CONFIG_KERNEL_START=0xc0000000
129CONFIG_TASK_SIZE=0x80000000
130CONFIG_BOOT_LOAD=0x00800000
131
132#
133# Device Drivers
134#
135
136#
137# Generic Driver Options
138#
139
140#
141# Memory Technology Devices (MTD)
142#
143# CONFIG_MTD is not set
144
145#
146# Parallel port support
147#
148# CONFIG_PARPORT is not set
149
150#
151# Plug and Play support
152#
153# CONFIG_PNP is not set
154
155#
156# Block devices
157#
158CONFIG_BLK_DEV_FD=y
159# CONFIG_BLK_DEV_XD is not set
160# CONFIG_BLK_CPQ_DA is not set
161# CONFIG_BLK_CPQ_CISS_DA is not set
162# CONFIG_BLK_DEV_DAC960 is not set
163# CONFIG_BLK_DEV_UMEM is not set
164CONFIG_BLK_DEV_LOOP=y
165# CONFIG_BLK_DEV_CRYPTOLOOP is not set
166# CONFIG_BLK_DEV_NBD is not set
167# CONFIG_BLK_DEV_CARMEL is not set
168CONFIG_BLK_DEV_RAM=y
169CONFIG_BLK_DEV_RAM_SIZE=4096
170CONFIG_BLK_DEV_INITRD=y
171CONFIG_LBD=y
172
173#
174# ATA/ATAPI/MFM/RLL support
175#
176# CONFIG_IDE is not set
177
178#
179# SCSI device support
180#
181CONFIG_SCSI=y
182CONFIG_SCSI_PROC_FS=y
183
184#
185# SCSI support type (disk, tape, CD-ROM)
186#
187CONFIG_BLK_DEV_SD=y
188CONFIG_CHR_DEV_ST=y
189# CONFIG_CHR_DEV_OSST is not set
190CONFIG_BLK_DEV_SR=y
191CONFIG_BLK_DEV_SR_VENDOR=y
192CONFIG_CHR_DEV_SG=y
193
194#
195# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
196#
197# CONFIG_SCSI_MULTI_LUN is not set
198# CONFIG_SCSI_REPORT_LUNS is not set
199CONFIG_SCSI_CONSTANTS=y
200# CONFIG_SCSI_LOGGING is not set
201
202#
203# SCSI Transport Attributes
204#
205CONFIG_SCSI_SPI_ATTRS=y
206# CONFIG_SCSI_FC_ATTRS is not set
207
208#
209# SCSI low-level drivers
210#
211# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
212# CONFIG_SCSI_7000FASST is not set
213# CONFIG_SCSI_ACARD is not set
214# CONFIG_SCSI_AHA152X is not set
215# CONFIG_SCSI_AHA1542 is not set
216# CONFIG_SCSI_AACRAID is not set
217# CONFIG_SCSI_AIC7XXX is not set
218# CONFIG_SCSI_AIC7XXX_OLD is not set
219# CONFIG_SCSI_AIC79XX is not set
220# CONFIG_SCSI_ADVANSYS is not set
221# CONFIG_SCSI_IN2000 is not set
222# CONFIG_SCSI_MEGARAID is not set
223# CONFIG_SCSI_SATA is not set
224# CONFIG_SCSI_BUSLOGIC is not set
225# CONFIG_SCSI_CPQFCTS is not set
226# CONFIG_SCSI_DMX3191D is not set
227# CONFIG_SCSI_DTC3280 is not set
228# CONFIG_SCSI_EATA is not set
229# CONFIG_SCSI_EATA_PIO is not set
230# CONFIG_SCSI_FUTURE_DOMAIN is not set
231# CONFIG_SCSI_GDTH is not set
232# CONFIG_SCSI_GENERIC_NCR5380 is not set
233# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
234# CONFIG_SCSI_IPS is not set
235# CONFIG_SCSI_INIA100 is not set
236# CONFIG_SCSI_NCR53C406A is not set
237CONFIG_SCSI_SYM53C8XX_2=y
238CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0
239CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
240CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
241# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set
242# CONFIG_SCSI_IPR is not set
243# CONFIG_SCSI_PAS16 is not set
244# CONFIG_SCSI_PSI240I is not set
245# CONFIG_SCSI_QLOGIC_FAS is not set
246# CONFIG_SCSI_QLOGIC_ISP is not set
247# CONFIG_SCSI_QLOGIC_FC is not set
248# CONFIG_SCSI_QLOGIC_1280 is not set
249CONFIG_SCSI_QLA2XXX=y
250# CONFIG_SCSI_QLA21XX is not set
251# CONFIG_SCSI_QLA22XX is not set
252# CONFIG_SCSI_QLA2300 is not set
253# CONFIG_SCSI_QLA2322 is not set
254# CONFIG_SCSI_QLA6312 is not set
255# CONFIG_SCSI_QLA6322 is not set
256# CONFIG_SCSI_SYM53C416 is not set
257# CONFIG_SCSI_DC395x is not set
258# CONFIG_SCSI_DC390T is not set
259# CONFIG_SCSI_T128 is not set
260# CONFIG_SCSI_U14_34F is not set
261# CONFIG_SCSI_NSP32 is not set
262# CONFIG_SCSI_DEBUG is not set
263# CONFIG_SCSI_MESH is not set
264# CONFIG_SCSI_MAC53C94 is not set
265
266#
267# Old CD-ROM drivers (not SCSI, not IDE)
268#
269# CONFIG_CD_NO_IDESCSI is not set
270
271#
272# Multi-device support (RAID and LVM)
273#
274# CONFIG_MD is not set
275
276#
277# Fusion MPT device support
278#
279# CONFIG_FUSION is not set
280
281#
282# IEEE 1394 (FireWire) support
283#
284# CONFIG_IEEE1394 is not set
285
286#
287# I2O device support
288#
289# CONFIG_I2O is not set
290
291#
292# Macintosh device drivers
293#
294# CONFIG_ADB is not set
295# CONFIG_ADB_CUDA is not set
296# CONFIG_ADB_PMU is not set
297# CONFIG_MAC_FLOPPY is not set
298# CONFIG_MAC_SERIAL is not set
299
300#
301# Networking support
302#
303CONFIG_NET=y
304
305#
306# Networking options
307#
308CONFIG_PACKET=y
309# CONFIG_PACKET_MMAP is not set
310# CONFIG_NETLINK_DEV is not set
311CONFIG_UNIX=y
312# CONFIG_NET_KEY is not set
313CONFIG_INET=y
314CONFIG_IP_MULTICAST=y
315# CONFIG_IP_ADVANCED_ROUTER is not set
316# CONFIG_IP_PNP is not set
317# CONFIG_NET_IPIP is not set
318# CONFIG_NET_IPGRE is not set
319# CONFIG_IP_MROUTE is not set
320# CONFIG_ARPD is not set
321CONFIG_SYN_COOKIES=y
322# CONFIG_INET_AH is not set
323# CONFIG_INET_ESP is not set
324# CONFIG_INET_IPCOMP is not set
325
326#
327# IP: Virtual Server Configuration
328#
329# CONFIG_IP_VS is not set
330# CONFIG_IPV6 is not set
331CONFIG_NETFILTER=y
332# CONFIG_NETFILTER_DEBUG is not set
333
334#
335# IP: Netfilter Configuration
336#
337CONFIG_IP_NF_CONNTRACK=m
338CONFIG_IP_NF_FTP=m
339CONFIG_IP_NF_IRC=m
340CONFIG_IP_NF_TFTP=m
341CONFIG_IP_NF_AMANDA=m
342# CONFIG_IP_NF_QUEUE is not set
343CONFIG_IP_NF_IPTABLES=m
344CONFIG_IP_NF_MATCH_LIMIT=m
345CONFIG_IP_NF_MATCH_IPRANGE=m
346CONFIG_IP_NF_MATCH_MAC=m
347# CONFIG_IP_NF_MATCH_PKTTYPE is not set
348CONFIG_IP_NF_MATCH_MARK=m
349CONFIG_IP_NF_MATCH_MULTIPORT=m
350CONFIG_IP_NF_MATCH_TOS=m
351CONFIG_IP_NF_MATCH_RECENT=m
352CONFIG_IP_NF_MATCH_ECN=m
353CONFIG_IP_NF_MATCH_DSCP=m
354CONFIG_IP_NF_MATCH_AH_ESP=m
355CONFIG_IP_NF_MATCH_LENGTH=m
356CONFIG_IP_NF_MATCH_TTL=m
357CONFIG_IP_NF_MATCH_TCPMSS=m
358CONFIG_IP_NF_MATCH_HELPER=m
359CONFIG_IP_NF_MATCH_STATE=m
360CONFIG_IP_NF_MATCH_CONNTRACK=m
361CONFIG_IP_NF_MATCH_OWNER=m
362CONFIG_IP_NF_FILTER=m
363CONFIG_IP_NF_TARGET_REJECT=m
364CONFIG_IP_NF_NAT=m
365CONFIG_IP_NF_NAT_NEEDED=y
366CONFIG_IP_NF_TARGET_MASQUERADE=m
367CONFIG_IP_NF_TARGET_REDIRECT=m
368CONFIG_IP_NF_TARGET_NETMAP=m
369CONFIG_IP_NF_TARGET_SAME=m
370CONFIG_IP_NF_NAT_SNMP_BASIC=m
371CONFIG_IP_NF_NAT_IRC=m
372CONFIG_IP_NF_NAT_FTP=m
373CONFIG_IP_NF_NAT_TFTP=m
374CONFIG_IP_NF_NAT_AMANDA=m
375# CONFIG_IP_NF_MANGLE is not set
376# CONFIG_IP_NF_TARGET_LOG is not set
377CONFIG_IP_NF_TARGET_ULOG=m
378CONFIG_IP_NF_TARGET_TCPMSS=m
379CONFIG_IP_NF_ARPTABLES=m
380CONFIG_IP_NF_ARPFILTER=m
381CONFIG_IP_NF_ARP_MANGLE=m
382CONFIG_IP_NF_COMPAT_IPCHAINS=m
383# CONFIG_IP_NF_COMPAT_IPFWADM is not set
384CONFIG_IP_NF_TARGET_NOTRACK=m
385CONFIG_IP_NF_RAW=m
386
387#
388# SCTP Configuration (EXPERIMENTAL)
389#
390# CONFIG_IP_SCTP is not set
391# CONFIG_ATM is not set
392# CONFIG_BRIDGE is not set
393# CONFIG_VLAN_8021Q is not set
394# CONFIG_DECNET is not set
395# CONFIG_LLC2 is not set
396# CONFIG_IPX is not set
397# CONFIG_ATALK is not set
398# CONFIG_X25 is not set
399# CONFIG_LAPB is not set
400# CONFIG_NET_DIVERT is not set
401# CONFIG_ECONET is not set
402# CONFIG_WAN_ROUTER is not set
403# CONFIG_NET_HW_FLOWCONTROL is not set
404
405#
406# QoS and/or fair queueing
407#
408# CONFIG_NET_SCHED is not set
409
410#
411# Network testing
412#
413# CONFIG_NET_PKTGEN is not set
414# CONFIG_NETPOLL is not set
415# CONFIG_NET_POLL_CONTROLLER is not set
416# CONFIG_HAMRADIO is not set
417# CONFIG_IRDA is not set
418# CONFIG_BT is not set
419CONFIG_NETDEVICES=y
420# CONFIG_DUMMY is not set
421# CONFIG_BONDING is not set
422# CONFIG_EQUALIZER is not set
423# CONFIG_TUN is not set
424
425#
426# ARCnet devices
427#
428# CONFIG_ARCNET is not set
429
430#
431# Ethernet (10 or 100Mbit)
432#
433CONFIG_NET_ETHERNET=y
434CONFIG_MII=y
435# CONFIG_MACE is not set
436# CONFIG_BMAC is not set
437# CONFIG_OAKNET is not set
438# CONFIG_HAPPYMEAL is not set
439# CONFIG_SUNGEM is not set
440# CONFIG_NET_VENDOR_3COM is not set
441# CONFIG_LANCE is not set
442# CONFIG_NET_VENDOR_SMC is not set
443# CONFIG_NET_VENDOR_RACAL is not set
444
445#
446# Tulip family network device support
447#
448# CONFIG_NET_TULIP is not set
449# CONFIG_AT1700 is not set
450# CONFIG_DEPCA is not set
451# CONFIG_HP100 is not set
452# CONFIG_NET_ISA is not set
453CONFIG_NET_PCI=y
454CONFIG_PCNET32=y
455# CONFIG_AMD8111_ETH is not set
456# CONFIG_ADAPTEC_STARFIRE is not set
457# CONFIG_AC3200 is not set
458# CONFIG_APRICOT is not set
459# CONFIG_B44 is not set
460# CONFIG_FORCEDETH is not set
461# CONFIG_CS89x0 is not set
462# CONFIG_DGRS is not set
463# CONFIG_EEPRO100 is not set
464# CONFIG_E100 is not set
465# CONFIG_FEALNX is not set
466# CONFIG_NATSEMI is not set
467# CONFIG_NE2K_PCI is not set
468# CONFIG_8139CP is not set
469# CONFIG_8139TOO is not set
470# CONFIG_SIS900 is not set
471# CONFIG_EPIC100 is not set
472# CONFIG_SUNDANCE is not set
473# CONFIG_TLAN is not set
474# CONFIG_VIA_RHINE is not set
475# CONFIG_NET_POCKET is not set
476
477#
478# Ethernet (1000 Mbit)
479#
480# CONFIG_ACENIC is not set
481# CONFIG_DL2K is not set
482# CONFIG_E1000 is not set
483# CONFIG_NS83820 is not set
484# CONFIG_HAMACHI is not set
485# CONFIG_YELLOWFIN is not set
486# CONFIG_R8169 is not set
487# CONFIG_SK98LIN is not set
488# CONFIG_TIGON3 is not set
489
490#
491# Ethernet (10000 Mbit)
492#
493# CONFIG_IXGB is not set
494# CONFIG_S2IO is not set
495
496#
497# Token Ring devices
498#
499# CONFIG_TR is not set
500
501#
502# Wireless LAN (non-hamradio)
503#
504# CONFIG_NET_RADIO is not set
505
506#
507# Wan interfaces
508#
509# CONFIG_WAN is not set
510# CONFIG_FDDI is not set
511# CONFIG_HIPPI is not set
512# CONFIG_PPP is not set
513# CONFIG_SLIP is not set
514# CONFIG_NET_FC is not set
515# CONFIG_RCPCI is not set
516# CONFIG_SHAPER is not set
517# CONFIG_NETCONSOLE is not set
518
519#
520# ISDN subsystem
521#
522# CONFIG_ISDN is not set
523
524#
525# Telephony Support
526#
527# CONFIG_PHONE is not set
528
529#
530# Input device support
531#
532CONFIG_INPUT=y
533
534#
535# Userland interfaces
536#
537CONFIG_INPUT_MOUSEDEV=y
538CONFIG_INPUT_MOUSEDEV_PSAUX=y
539CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
540CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
541# CONFIG_INPUT_JOYDEV is not set
542# CONFIG_INPUT_TSDEV is not set
543CONFIG_INPUT_EVDEV=y
544# CONFIG_INPUT_EVBUG is not set
545
546#
547# Input I/O drivers
548#
549# CONFIG_GAMEPORT is not set
550CONFIG_SOUND_GAMEPORT=y
551CONFIG_SERIO=y
552CONFIG_SERIO_I8042=y
553CONFIG_SERIO_SERPORT=y
554# CONFIG_SERIO_CT82C710 is not set
555# CONFIG_SERIO_PCIPS2 is not set
556
557#
558# Input Device Drivers
559#
560CONFIG_INPUT_KEYBOARD=y
561CONFIG_KEYBOARD_ATKBD=y
562# CONFIG_KEYBOARD_SUNKBD is not set
563# CONFIG_KEYBOARD_LKKBD is not set
564# CONFIG_KEYBOARD_XTKBD is not set
565# CONFIG_KEYBOARD_NEWTON is not set
566CONFIG_INPUT_MOUSE=y
567CONFIG_MOUSE_PS2=y
568# CONFIG_MOUSE_SERIAL is not set
569# CONFIG_MOUSE_INPORT is not set
570# CONFIG_MOUSE_LOGIBM is not set
571# CONFIG_MOUSE_PC110PAD is not set
572# CONFIG_MOUSE_VSXXXAA is not set
573# CONFIG_INPUT_JOYSTICK is not set
574# CONFIG_INPUT_TOUCHSCREEN is not set
575CONFIG_INPUT_MISC=y
576CONFIG_INPUT_UINPUT=y
577
578#
579# Character devices
580#
581CONFIG_VT=y
582CONFIG_VT_CONSOLE=y
583CONFIG_HW_CONSOLE=y
584# CONFIG_SERIAL_NONSTANDARD is not set
585
586#
587# Serial drivers
588#
589CONFIG_SERIAL_8250=y
590# CONFIG_SERIAL_8250_CONSOLE is not set
591CONFIG_SERIAL_8250_NR_UARTS=4
592# CONFIG_SERIAL_8250_EXTENDED is not set
593
594#
595# Non-8250 serial port support
596#
597CONFIG_SERIAL_CORE=y
598# CONFIG_SERIAL_PMACZILOG is not set
599CONFIG_UNIX98_PTYS=y
600CONFIG_LEGACY_PTYS=y
601CONFIG_LEGACY_PTY_COUNT=256
602# CONFIG_QIC02_TAPE is not set
603
604#
605# IPMI
606#
607# CONFIG_IPMI_HANDLER is not set
608
609#
610# Watchdog Cards
611#
612# CONFIG_WATCHDOG is not set
613CONFIG_NVRAM=y
614CONFIG_GEN_RTC=y
615# CONFIG_GEN_RTC_X is not set
616# CONFIG_DTLK is not set
617# CONFIG_R3964 is not set
618# CONFIG_APPLICOM is not set
619
620#
621# Ftape, the floppy tape device driver
622#
623# CONFIG_FTAPE is not set
624# CONFIG_AGP is not set
625# CONFIG_DRM is not set
626# CONFIG_RAW_DRIVER is not set
627
628#
629# I2C support
630#
631# CONFIG_I2C is not set
632
633#
634# Misc devices
635#
636
637#
638# Multimedia devices
639#
640# CONFIG_VIDEO_DEV is not set
641
642#
643# Digital Video Broadcasting Devices
644#
645# CONFIG_DVB is not set
646
647#
648# Graphics support
649#
650CONFIG_FB=y
651# CONFIG_FB_PM2 is not set
652# CONFIG_FB_CYBER2000 is not set
653CONFIG_FB_OF=y
654# CONFIG_FB_CONTROL is not set
655# CONFIG_FB_PLATINUM is not set
656# CONFIG_FB_VALKYRIE is not set
657# CONFIG_FB_CT65550 is not set
658# CONFIG_FB_IMSTT is not set
659# CONFIG_FB_S3TRIO is not set
660# CONFIG_FB_VGA16 is not set
661# CONFIG_FB_RIVA is not set
662CONFIG_FB_MATROX=y
663CONFIG_FB_MATROX_MILLENIUM=y
664CONFIG_FB_MATROX_MYSTIQUE=y
665# CONFIG_FB_MATROX_G450 is not set
666CONFIG_FB_MATROX_G100A=y
667CONFIG_FB_MATROX_G100=y
668# CONFIG_FB_MATROX_MULTIHEAD is not set
669# CONFIG_FB_RADEON_OLD is not set
670# CONFIG_FB_RADEON is not set
671# CONFIG_FB_ATY128 is not set
672# CONFIG_FB_ATY is not set
673# CONFIG_FB_SIS is not set
674# CONFIG_FB_NEOMAGIC is not set
675# CONFIG_FB_KYRO is not set
676CONFIG_FB_3DFX=y
677# CONFIG_FB_VOODOO1 is not set
678# CONFIG_FB_TRIDENT is not set
679# CONFIG_FB_VIRTUAL is not set
680
681#
682# Console display driver support
683#
684CONFIG_VGA_CONSOLE=y
685# CONFIG_MDA_CONSOLE is not set
686CONFIG_DUMMY_CONSOLE=y
687CONFIG_FRAMEBUFFER_CONSOLE=y
688CONFIG_PCI_CONSOLE=y
689# CONFIG_FONTS is not set
690CONFIG_FONT_8x8=y
691CONFIG_FONT_8x16=y
692
693#
694# Logo configuration
695#
696CONFIG_LOGO=y
697CONFIG_LOGO_LINUX_MONO=y
698CONFIG_LOGO_LINUX_VGA16=y
699CONFIG_LOGO_LINUX_CLUT224=y
700
701#
702# Sound
703#
704# CONFIG_SOUND is not set
705
706#
707# USB support
708#
709# CONFIG_USB is not set
710
711#
712# USB Gadget Support
713#
714# CONFIG_USB_GADGET is not set
715
716#
717# File systems
718#
719CONFIG_EXT2_FS=y
720# CONFIG_EXT2_FS_XATTR is not set
721# CONFIG_EXT3_FS is not set
722# CONFIG_JBD is not set
723# CONFIG_REISERFS_FS is not set
724# CONFIG_JFS_FS is not set
725# CONFIG_XFS_FS is not set
726# CONFIG_MINIX_FS is not set
727# CONFIG_ROMFS_FS is not set
728# CONFIG_QUOTA is not set
729# CONFIG_AUTOFS_FS is not set
730# CONFIG_AUTOFS4_FS is not set
731
732#
733# CD-ROM/DVD Filesystems
734#
735CONFIG_ISO9660_FS=y
736# CONFIG_JOLIET is not set
737# CONFIG_ZISOFS is not set
738# CONFIG_UDF_FS is not set
739
740#
741# DOS/FAT/NT Filesystems
742#
743CONFIG_FAT_FS=m
744CONFIG_MSDOS_FS=m
745CONFIG_VFAT_FS=m
746# CONFIG_NTFS_FS is not set
747
748#
749# Pseudo filesystems
750#
751CONFIG_PROC_FS=y
752CONFIG_PROC_KCORE=y
753CONFIG_SYSFS=y
754CONFIG_DEVFS_FS=y
755# CONFIG_DEVFS_MOUNT is not set
756# CONFIG_DEVFS_DEBUG is not set
757# CONFIG_DEVPTS_FS_XATTR is not set
758CONFIG_TMPFS=y
759# CONFIG_HUGETLB_PAGE is not set
760CONFIG_RAMFS=y
761
762#
763# Miscellaneous filesystems
764#
765# CONFIG_ADFS_FS is not set
766# CONFIG_AFFS_FS is not set
767# CONFIG_HFS_FS is not set
768# CONFIG_HFSPLUS_FS is not set
769# CONFIG_BEFS_FS is not set
770# CONFIG_BFS_FS is not set
771# CONFIG_EFS_FS is not set
772# CONFIG_CRAMFS is not set
773# CONFIG_VXFS_FS is not set
774# CONFIG_HPFS_FS is not set
775# CONFIG_QNX4FS_FS is not set
776# CONFIG_SYSV_FS is not set
777# CONFIG_UFS_FS is not set
778
779#
780# Network File Systems
781#
782# CONFIG_NFS_FS is not set
783# CONFIG_NFSD is not set
784# CONFIG_EXPORTFS is not set
785# CONFIG_SMB_FS is not set
786# CONFIG_CIFS is not set
787# CONFIG_NCP_FS is not set
788# CONFIG_CODA_FS is not set
789# CONFIG_AFS_FS is not set
790
791#
792# Partition Types
793#
794CONFIG_PARTITION_ADVANCED=y
795# CONFIG_ACORN_PARTITION is not set
796# CONFIG_OSF_PARTITION is not set
797# CONFIG_AMIGA_PARTITION is not set
798# CONFIG_ATARI_PARTITION is not set
799CONFIG_MAC_PARTITION=y
800CONFIG_MSDOS_PARTITION=y
801# CONFIG_BSD_DISKLABEL is not set
802# CONFIG_MINIX_SUBPARTITION is not set
803# CONFIG_SOLARIS_X86_PARTITION is not set
804# CONFIG_UNIXWARE_DISKLABEL is not set
805# CONFIG_LDM_PARTITION is not set
806# CONFIG_NEC98_PARTITION is not set
807# CONFIG_SGI_PARTITION is not set
808# CONFIG_ULTRIX_PARTITION is not set
809# CONFIG_SUN_PARTITION is not set
810# CONFIG_EFI_PARTITION is not set
811
812#
813# Native Language Support
814#
815CONFIG_NLS=y
816CONFIG_NLS_DEFAULT="iso8859-1"
817# CONFIG_NLS_CODEPAGE_437 is not set
818# CONFIG_NLS_CODEPAGE_737 is not set
819# CONFIG_NLS_CODEPAGE_775 is not set
820# CONFIG_NLS_CODEPAGE_850 is not set
821# CONFIG_NLS_CODEPAGE_852 is not set
822# CONFIG_NLS_CODEPAGE_855 is not set
823# CONFIG_NLS_CODEPAGE_857 is not set
824# CONFIG_NLS_CODEPAGE_860 is not set
825# CONFIG_NLS_CODEPAGE_861 is not set
826# CONFIG_NLS_CODEPAGE_862 is not set
827# CONFIG_NLS_CODEPAGE_863 is not set
828# CONFIG_NLS_CODEPAGE_864 is not set
829# CONFIG_NLS_CODEPAGE_865 is not set
830# CONFIG_NLS_CODEPAGE_866 is not set
831# CONFIG_NLS_CODEPAGE_869 is not set
832# CONFIG_NLS_CODEPAGE_936 is not set
833# CONFIG_NLS_CODEPAGE_950 is not set
834# CONFIG_NLS_CODEPAGE_932 is not set
835# CONFIG_NLS_CODEPAGE_949 is not set
836# CONFIG_NLS_CODEPAGE_874 is not set
837# CONFIG_NLS_ISO8859_8 is not set
838# CONFIG_NLS_CODEPAGE_1250 is not set
839# CONFIG_NLS_CODEPAGE_1251 is not set
840CONFIG_NLS_ISO8859_1=m
841# CONFIG_NLS_ISO8859_2 is not set
842# CONFIG_NLS_ISO8859_3 is not set
843# CONFIG_NLS_ISO8859_4 is not set
844# CONFIG_NLS_ISO8859_5 is not set
845# CONFIG_NLS_ISO8859_6 is not set
846# CONFIG_NLS_ISO8859_7 is not set
847# CONFIG_NLS_ISO8859_9 is not set
848# CONFIG_NLS_ISO8859_13 is not set
849# CONFIG_NLS_ISO8859_14 is not set
850# CONFIG_NLS_ISO8859_15 is not set
851# CONFIG_NLS_KOI8_R is not set
852# CONFIG_NLS_KOI8_U is not set
853# CONFIG_NLS_UTF8 is not set
854
855#
856# Library routines
857#
858CONFIG_CRC32=y
859# CONFIG_LIBCRC32C is not set
860
861#
862# Kernel hacking
863#
864# CONFIG_DEBUG_KERNEL is not set
865# CONFIG_BOOTX_TEXT is not set
866
867#
868# Security options
869#
870# CONFIG_SECURITY is not set
871
872#
873# Cryptographic options
874#
875# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/k2_defconfig b/arch/ppc/configs/k2_defconfig
new file mode 100644
index 000000000000..f10f5a6d2dae
--- /dev/null
+++ b/arch/ppc/configs/k2_defconfig
@@ -0,0 +1,680 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7CONFIG_PPC=y
8CONFIG_PPC32=y
9CONFIG_GENERIC_NVRAM=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_STANDALONE=y
17CONFIG_BROKEN_ON_SMP=y
18
19#
20# General setup
21#
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_POSIX_MQUEUE is not set
25# CONFIG_BSD_PROCESS_ACCT is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=14
29# CONFIG_HOTPLUG is not set
30# CONFIG_IKCONFIG is not set
31CONFIG_EMBEDDED=y
32CONFIG_KALLSYMS=y
33CONFIG_FUTEX=y
34CONFIG_EPOLL=y
35CONFIG_IOSCHED_NOOP=y
36CONFIG_IOSCHED_AS=y
37CONFIG_IOSCHED_DEADLINE=y
38CONFIG_IOSCHED_CFQ=y
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
40
41#
42# Loadable module support
43#
44CONFIG_MODULES=y
45CONFIG_MODULE_UNLOAD=y
46# CONFIG_MODULE_FORCE_UNLOAD is not set
47CONFIG_OBSOLETE_MODPARM=y
48# CONFIG_MODVERSIONS is not set
49CONFIG_KMOD=y
50
51#
52# Processor
53#
54CONFIG_6xx=y
55# CONFIG_40x is not set
56# CONFIG_44x is not set
57# CONFIG_POWER3 is not set
58# CONFIG_POWER4 is not set
59# CONFIG_8xx is not set
60# CONFIG_ALTIVEC is not set
61# CONFIG_TAU is not set
62# CONFIG_CPU_FREQ is not set
63CONFIG_PPC_STD_MMU=y
64
65#
66# Platform options
67#
68# CONFIG_PPC_MULTIPLATFORM is not set
69# CONFIG_APUS is not set
70# CONFIG_WILLOW is not set
71# CONFIG_PCORE is not set
72# CONFIG_POWERPMC250 is not set
73# CONFIG_EV64260 is not set
74# CONFIG_SPRUCE is not set
75# CONFIG_LOPEC is not set
76# CONFIG_MCPN765 is not set
77# CONFIG_MVME5100 is not set
78# CONFIG_PPLUS is not set
79# CONFIG_PRPMC750 is not set
80# CONFIG_PRPMC800 is not set
81# CONFIG_SANDPOINT is not set
82# CONFIG_ADIR is not set
83CONFIG_K2=y
84# CONFIG_PAL4 is not set
85# CONFIG_GEMINI is not set
86# CONFIG_EST8260 is not set
87# CONFIG_SBS8260 is not set
88# CONFIG_RPX6 is not set
89# CONFIG_TQM8260 is not set
90CONFIG_PPC_GEN550=y
91# CONFIG_CPC710_DATA_GATHERING is not set
92# CONFIG_SMP is not set
93# CONFIG_PREEMPT is not set
94# CONFIG_HIGHMEM is not set
95CONFIG_KERNEL_ELF=y
96CONFIG_BINFMT_ELF=y
97# CONFIG_BINFMT_MISC is not set
98CONFIG_CMDLINE_BOOL=y
99CONFIG_CMDLINE="ip=on"
100
101#
102# Bus options
103#
104CONFIG_GENERIC_ISA_DMA=y
105CONFIG_PCI=y
106CONFIG_PCI_DOMAINS=y
107# CONFIG_PCI_LEGACY_PROC is not set
108# CONFIG_PCI_NAMES is not set
109
110#
111# Advanced setup
112#
113# CONFIG_ADVANCED_OPTIONS is not set
114
115#
116# Default settings for advanced configuration options are used
117#
118CONFIG_HIGHMEM_START=0xfe000000
119CONFIG_LOWMEM_SIZE=0x30000000
120CONFIG_KERNEL_START=0xc0000000
121CONFIG_TASK_SIZE=0x80000000
122CONFIG_BOOT_LOAD=0x00800000
123
124#
125# Device Drivers
126#
127
128#
129# Generic Driver Options
130#
131
132#
133# Memory Technology Devices (MTD)
134#
135# CONFIG_MTD is not set
136
137#
138# Parallel port support
139#
140# CONFIG_PARPORT is not set
141
142#
143# Plug and Play support
144#
145
146#
147# Block devices
148#
149# CONFIG_BLK_DEV_FD is not set
150# CONFIG_BLK_CPQ_DA is not set
151# CONFIG_BLK_CPQ_CISS_DA is not set
152# CONFIG_BLK_DEV_DAC960 is not set
153# CONFIG_BLK_DEV_UMEM is not set
154CONFIG_BLK_DEV_LOOP=y
155# CONFIG_BLK_DEV_CRYPTOLOOP is not set
156# CONFIG_BLK_DEV_NBD is not set
157# CONFIG_BLK_DEV_CARMEL is not set
158CONFIG_BLK_DEV_RAM=y
159CONFIG_BLK_DEV_RAM_SIZE=4096
160CONFIG_BLK_DEV_INITRD=y
161# CONFIG_LBD is not set
162
163#
164# ATA/ATAPI/MFM/RLL support
165#
166CONFIG_IDE=y
167CONFIG_BLK_DEV_IDE=y
168
169#
170# Please see Documentation/ide.txt for help/info on IDE drives
171#
172CONFIG_BLK_DEV_IDEDISK=y
173# CONFIG_IDEDISK_MULTI_MODE is not set
174# CONFIG_IDEDISK_STROKE is not set
175# CONFIG_BLK_DEV_IDECD is not set
176# CONFIG_BLK_DEV_IDETAPE is not set
177# CONFIG_BLK_DEV_IDEFLOPPY is not set
178# CONFIG_IDE_TASK_IOCTL is not set
179# CONFIG_IDE_TASKFILE_IO is not set
180
181#
182# IDE chipset support/bugfixes
183#
184# CONFIG_IDE_GENERIC is not set
185CONFIG_BLK_DEV_IDEPCI=y
186# CONFIG_IDEPCI_SHARE_IRQ is not set
187# CONFIG_BLK_DEV_OFFBOARD is not set
188# CONFIG_BLK_DEV_GENERIC is not set
189# CONFIG_BLK_DEV_OPTI621 is not set
190# CONFIG_BLK_DEV_SL82C105 is not set
191CONFIG_BLK_DEV_IDEDMA_PCI=y
192# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
193# CONFIG_IDEDMA_PCI_AUTO is not set
194CONFIG_BLK_DEV_ADMA=y
195# CONFIG_BLK_DEV_AEC62XX is not set
196CONFIG_BLK_DEV_ALI15X3=y
197# CONFIG_WDC_ALI15X3 is not set
198# CONFIG_BLK_DEV_AMD74XX is not set
199# CONFIG_BLK_DEV_CMD64X is not set
200# CONFIG_BLK_DEV_TRIFLEX is not set
201# CONFIG_BLK_DEV_CY82C693 is not set
202# CONFIG_BLK_DEV_CS5520 is not set
203# CONFIG_BLK_DEV_CS5530 is not set
204# CONFIG_BLK_DEV_HPT34X is not set
205# CONFIG_BLK_DEV_HPT366 is not set
206# CONFIG_BLK_DEV_SC1200 is not set
207# CONFIG_BLK_DEV_PIIX is not set
208# CONFIG_BLK_DEV_NS87415 is not set
209# CONFIG_BLK_DEV_PDC202XX_OLD is not set
210# CONFIG_BLK_DEV_PDC202XX_NEW is not set
211# CONFIG_BLK_DEV_SVWKS is not set
212# CONFIG_BLK_DEV_SIIMAGE is not set
213# CONFIG_BLK_DEV_SLC90E66 is not set
214# CONFIG_BLK_DEV_TRM290 is not set
215# CONFIG_BLK_DEV_VIA82CXXX is not set
216CONFIG_BLK_DEV_IDEDMA=y
217# CONFIG_IDEDMA_IVB is not set
218# CONFIG_IDEDMA_AUTO is not set
219# CONFIG_BLK_DEV_HD is not set
220
221#
222# SCSI device support
223#
224# CONFIG_SCSI is not set
225
226#
227# Multi-device support (RAID and LVM)
228#
229# CONFIG_MD is not set
230
231#
232# Fusion MPT device support
233#
234# CONFIG_FUSION is not set
235
236#
237# IEEE 1394 (FireWire) support
238#
239# CONFIG_IEEE1394 is not set
240
241#
242# I2O device support
243#
244# CONFIG_I2O is not set
245
246#
247# Macintosh device drivers
248#
249
250#
251# Networking support
252#
253CONFIG_NET=y
254
255#
256# Networking options
257#
258CONFIG_PACKET=y
259# CONFIG_PACKET_MMAP is not set
260# CONFIG_NETLINK_DEV is not set
261CONFIG_UNIX=y
262# CONFIG_NET_KEY is not set
263CONFIG_INET=y
264# CONFIG_IP_MULTICAST is not set
265# CONFIG_IP_ADVANCED_ROUTER is not set
266CONFIG_IP_PNP=y
267CONFIG_IP_PNP_DHCP=y
268# CONFIG_IP_PNP_BOOTP is not set
269# CONFIG_IP_PNP_RARP is not set
270# CONFIG_NET_IPIP is not set
271# CONFIG_NET_IPGRE is not set
272# CONFIG_ARPD is not set
273# CONFIG_SYN_COOKIES is not set
274# CONFIG_INET_AH is not set
275# CONFIG_INET_ESP is not set
276# CONFIG_INET_IPCOMP is not set
277
278#
279# IP: Virtual Server Configuration
280#
281# CONFIG_IP_VS is not set
282# CONFIG_IPV6 is not set
283CONFIG_NETFILTER=y
284# CONFIG_NETFILTER_DEBUG is not set
285
286#
287# IP: Netfilter Configuration
288#
289CONFIG_IP_NF_CONNTRACK=m
290CONFIG_IP_NF_FTP=m
291# CONFIG_IP_NF_IRC is not set
292# CONFIG_IP_NF_TFTP is not set
293# CONFIG_IP_NF_AMANDA is not set
294# CONFIG_IP_NF_QUEUE is not set
295CONFIG_IP_NF_IPTABLES=m
296CONFIG_IP_NF_MATCH_LIMIT=m
297# CONFIG_IP_NF_MATCH_IPRANGE is not set
298CONFIG_IP_NF_MATCH_MAC=m
299CONFIG_IP_NF_MATCH_PKTTYPE=m
300CONFIG_IP_NF_MATCH_MARK=m
301CONFIG_IP_NF_MATCH_MULTIPORT=m
302CONFIG_IP_NF_MATCH_TOS=m
303# CONFIG_IP_NF_MATCH_RECENT is not set
304CONFIG_IP_NF_MATCH_ECN=m
305CONFIG_IP_NF_MATCH_DSCP=m
306CONFIG_IP_NF_MATCH_AH_ESP=m
307# CONFIG_IP_NF_MATCH_LENGTH is not set
308# CONFIG_IP_NF_MATCH_TTL is not set
309CONFIG_IP_NF_MATCH_TCPMSS=m
310CONFIG_IP_NF_MATCH_HELPER=m
311CONFIG_IP_NF_MATCH_STATE=m
312CONFIG_IP_NF_MATCH_CONNTRACK=m
313CONFIG_IP_NF_MATCH_OWNER=m
314CONFIG_IP_NF_FILTER=m
315CONFIG_IP_NF_TARGET_REJECT=m
316CONFIG_IP_NF_NAT=m
317CONFIG_IP_NF_NAT_NEEDED=y
318CONFIG_IP_NF_TARGET_MASQUERADE=m
319CONFIG_IP_NF_TARGET_REDIRECT=m
320# CONFIG_IP_NF_TARGET_NETMAP is not set
321# CONFIG_IP_NF_TARGET_SAME is not set
322# CONFIG_IP_NF_NAT_SNMP_BASIC is not set
323CONFIG_IP_NF_NAT_FTP=m
324# CONFIG_IP_NF_MANGLE is not set
325# CONFIG_IP_NF_TARGET_LOG is not set
326CONFIG_IP_NF_TARGET_ULOG=m
327CONFIG_IP_NF_TARGET_TCPMSS=m
328CONFIG_IP_NF_ARPTABLES=m
329CONFIG_IP_NF_ARPFILTER=m
330# CONFIG_IP_NF_ARP_MANGLE is not set
331CONFIG_IP_NF_COMPAT_IPCHAINS=m
332# CONFIG_IP_NF_COMPAT_IPFWADM is not set
333# CONFIG_IP_NF_RAW is not set
334
335#
336# SCTP Configuration (EXPERIMENTAL)
337#
338# CONFIG_IP_SCTP is not set
339# CONFIG_ATM is not set
340# CONFIG_BRIDGE is not set
341# CONFIG_VLAN_8021Q is not set
342# CONFIG_DECNET is not set
343# CONFIG_LLC2 is not set
344# CONFIG_IPX is not set
345# CONFIG_ATALK is not set
346# CONFIG_X25 is not set
347# CONFIG_LAPB is not set
348# CONFIG_NET_DIVERT is not set
349# CONFIG_ECONET is not set
350# CONFIG_WAN_ROUTER is not set
351# CONFIG_NET_HW_FLOWCONTROL is not set
352
353#
354# QoS and/or fair queueing
355#
356# CONFIG_NET_SCHED is not set
357
358#
359# Network testing
360#
361# CONFIG_NET_PKTGEN is not set
362# CONFIG_NETPOLL is not set
363# CONFIG_NET_POLL_CONTROLLER is not set
364# CONFIG_HAMRADIO is not set
365# CONFIG_IRDA is not set
366# CONFIG_BT is not set
367CONFIG_NETDEVICES=y
368# CONFIG_DUMMY is not set
369# CONFIG_BONDING is not set
370# CONFIG_EQUALIZER is not set
371# CONFIG_TUN is not set
372
373#
374# ARCnet devices
375#
376# CONFIG_ARCNET is not set
377
378#
379# Ethernet (10 or 100Mbit)
380#
381CONFIG_NET_ETHERNET=y
382CONFIG_MII=y
383# CONFIG_OAKNET is not set
384# CONFIG_HAPPYMEAL is not set
385# CONFIG_SUNGEM is not set
386# CONFIG_NET_VENDOR_3COM is not set
387
388#
389# Tulip family network device support
390#
391# CONFIG_NET_TULIP is not set
392# CONFIG_HP100 is not set
393CONFIG_NET_PCI=y
394# CONFIG_PCNET32 is not set
395# CONFIG_AMD8111_ETH is not set
396# CONFIG_ADAPTEC_STARFIRE is not set
397# CONFIG_B44 is not set
398# CONFIG_FORCEDETH is not set
399# CONFIG_DGRS is not set
400CONFIG_EEPRO100=y
401# CONFIG_EEPRO100_PIO is not set
402# CONFIG_E100 is not set
403# CONFIG_FEALNX is not set
404# CONFIG_NATSEMI is not set
405# CONFIG_NE2K_PCI is not set
406# CONFIG_8139CP is not set
407# CONFIG_8139TOO is not set
408# CONFIG_SIS900 is not set
409# CONFIG_EPIC100 is not set
410# CONFIG_SUNDANCE is not set
411# CONFIG_TLAN is not set
412# CONFIG_VIA_RHINE is not set
413
414#
415# Ethernet (1000 Mbit)
416#
417# CONFIG_ACENIC is not set
418# CONFIG_DL2K is not set
419# CONFIG_E1000 is not set
420# CONFIG_NS83820 is not set
421# CONFIG_HAMACHI is not set
422# CONFIG_YELLOWFIN is not set
423# CONFIG_R8169 is not set
424# CONFIG_SK98LIN is not set
425# CONFIG_TIGON3 is not set
426
427#
428# Ethernet (10000 Mbit)
429#
430# CONFIG_IXGB is not set
431# CONFIG_S2IO is not set
432
433#
434# Token Ring devices
435#
436# CONFIG_TR is not set
437
438#
439# Wireless LAN (non-hamradio)
440#
441# CONFIG_NET_RADIO is not set
442
443#
444# Wan interfaces
445#
446# CONFIG_WAN is not set
447# CONFIG_FDDI is not set
448# CONFIG_HIPPI is not set
449# CONFIG_PPP is not set
450# CONFIG_SLIP is not set
451# CONFIG_RCPCI is not set
452# CONFIG_SHAPER is not set
453# CONFIG_NETCONSOLE is not set
454
455#
456# ISDN subsystem
457#
458# CONFIG_ISDN is not set
459
460#
461# Telephony Support
462#
463# CONFIG_PHONE is not set
464
465#
466# Input device support
467#
468# CONFIG_INPUT is not set
469
470#
471# Userland interfaces
472#
473
474#
475# Input I/O drivers
476#
477# CONFIG_GAMEPORT is not set
478CONFIG_SOUND_GAMEPORT=y
479# CONFIG_SERIO is not set
480# CONFIG_SERIO_I8042 is not set
481
482#
483# Input Device Drivers
484#
485
486#
487# Character devices
488#
489# CONFIG_VT is not set
490# CONFIG_SERIAL_NONSTANDARD is not set
491
492#
493# Serial drivers
494#
495CONFIG_SERIAL_8250=y
496CONFIG_SERIAL_8250_CONSOLE=y
497CONFIG_SERIAL_8250_NR_UARTS=2
498# CONFIG_SERIAL_8250_EXTENDED is not set
499
500#
501# Non-8250 serial port support
502#
503CONFIG_SERIAL_CORE=y
504CONFIG_SERIAL_CORE_CONSOLE=y
505CONFIG_UNIX98_PTYS=y
506CONFIG_LEGACY_PTYS=y
507CONFIG_LEGACY_PTY_COUNT=256
508# CONFIG_QIC02_TAPE is not set
509
510#
511# IPMI
512#
513# CONFIG_IPMI_HANDLER is not set
514
515#
516# Watchdog Cards
517#
518# CONFIG_WATCHDOG is not set
519# CONFIG_NVRAM is not set
520CONFIG_GEN_RTC=y
521# CONFIG_GEN_RTC_X is not set
522# CONFIG_DTLK is not set
523# CONFIG_R3964 is not set
524# CONFIG_APPLICOM is not set
525
526#
527# Ftape, the floppy tape device driver
528#
529# CONFIG_FTAPE is not set
530# CONFIG_AGP is not set
531# CONFIG_DRM is not set
532# CONFIG_RAW_DRIVER is not set
533
534#
535# I2C support
536#
537# CONFIG_I2C is not set
538
539#
540# Misc devices
541#
542
543#
544# Multimedia devices
545#
546# CONFIG_VIDEO_DEV is not set
547
548#
549# Digital Video Broadcasting Devices
550#
551# CONFIG_DVB is not set
552
553#
554# Graphics support
555#
556# CONFIG_FB is not set
557
558#
559# Sound
560#
561# CONFIG_SOUND is not set
562
563#
564# USB support
565#
566# CONFIG_USB is not set
567
568#
569# USB Gadget Support
570#
571# CONFIG_USB_GADGET is not set
572
573#
574# File systems
575#
576CONFIG_EXT2_FS=y
577# CONFIG_EXT2_FS_XATTR is not set
578# CONFIG_EXT3_FS is not set
579# CONFIG_JBD is not set
580# CONFIG_REISERFS_FS is not set
581# CONFIG_JFS_FS is not set
582# CONFIG_XFS_FS is not set
583# CONFIG_MINIX_FS is not set
584# CONFIG_ROMFS_FS is not set
585# CONFIG_QUOTA is not set
586# CONFIG_AUTOFS_FS is not set
587# CONFIG_AUTOFS4_FS is not set
588
589#
590# CD-ROM/DVD Filesystems
591#
592# CONFIG_ISO9660_FS is not set
593# CONFIG_UDF_FS is not set
594
595#
596# DOS/FAT/NT Filesystems
597#
598# CONFIG_FAT_FS is not set
599# CONFIG_NTFS_FS is not set
600
601#
602# Pseudo filesystems
603#
604CONFIG_PROC_FS=y
605CONFIG_PROC_KCORE=y
606CONFIG_SYSFS=y
607# CONFIG_DEVFS_FS is not set
608# CONFIG_DEVPTS_FS_XATTR is not set
609CONFIG_TMPFS=y
610# CONFIG_HUGETLB_PAGE is not set
611CONFIG_RAMFS=y
612
613#
614# Miscellaneous filesystems
615#
616# CONFIG_ADFS_FS is not set
617# CONFIG_AFFS_FS is not set
618# CONFIG_HFS_FS is not set
619# CONFIG_HFSPLUS_FS is not set
620# CONFIG_BEFS_FS is not set
621# CONFIG_BFS_FS is not set
622# CONFIG_EFS_FS is not set
623# CONFIG_CRAMFS is not set
624# CONFIG_VXFS_FS is not set
625# CONFIG_HPFS_FS is not set
626# CONFIG_QNX4FS_FS is not set
627# CONFIG_SYSV_FS is not set
628# CONFIG_UFS_FS is not set
629
630#
631# Network File Systems
632#
633CONFIG_NFS_FS=y
634# CONFIG_NFS_V3 is not set
635# CONFIG_NFS_V4 is not set
636# CONFIG_NFS_DIRECTIO is not set
637# CONFIG_NFSD is not set
638CONFIG_ROOT_NFS=y
639CONFIG_LOCKD=y
640# CONFIG_EXPORTFS is not set
641CONFIG_SUNRPC=y
642# CONFIG_RPCSEC_GSS_KRB5 is not set
643# CONFIG_SMB_FS is not set
644# CONFIG_CIFS is not set
645# CONFIG_NCP_FS is not set
646# CONFIG_CODA_FS is not set
647# CONFIG_INTERMEZZO_FS is not set
648# CONFIG_AFS_FS is not set
649
650#
651# Partition Types
652#
653# CONFIG_PARTITION_ADVANCED is not set
654CONFIG_MSDOS_PARTITION=y
655
656#
657# Native Language Support
658#
659# CONFIG_NLS is not set
660
661#
662# Library routines
663#
664# CONFIG_CRC32 is not set
665
666#
667# Kernel hacking
668#
669# CONFIG_DEBUG_KERNEL is not set
670# CONFIG_SERIAL_TEXT_DEBUG is not set
671
672#
673# Security options
674#
675# CONFIG_SECURITY is not set
676
677#
678# Cryptographic options
679#
680# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/katana_defconfig b/arch/ppc/configs/katana_defconfig
new file mode 100644
index 000000000000..f0b0d5720154
--- /dev/null
+++ b/arch/ppc/configs/katana_defconfig
@@ -0,0 +1,861 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11
4# Tue Mar 8 17:31:00 2005
5#
6CONFIG_MMU=y
7CONFIG_GENERIC_HARDIRQS=y
8CONFIG_RWSEM_XCHGADD_ALGORITHM=y
9CONFIG_GENERIC_CALIBRATE_DELAY=y
10CONFIG_HAVE_DEC_LOCK=y
11CONFIG_PPC=y
12CONFIG_PPC32=y
13CONFIG_GENERIC_NVRAM=y
14
15#
16# Code maturity level options
17#
18CONFIG_EXPERIMENTAL=y
19CONFIG_CLEAN_COMPILE=y
20CONFIG_BROKEN_ON_SMP=y
21
22#
23# General setup
24#
25CONFIG_LOCALVERSION=""
26CONFIG_SWAP=y
27CONFIG_SYSVIPC=y
28# CONFIG_POSIX_MQUEUE is not set
29# CONFIG_BSD_PROCESS_ACCT is not set
30CONFIG_SYSCTL=y
31# CONFIG_AUDIT is not set
32CONFIG_LOG_BUF_SHIFT=14
33# CONFIG_HOTPLUG is not set
34CONFIG_KOBJECT_UEVENT=y
35# CONFIG_IKCONFIG is not set
36# CONFIG_EMBEDDED is not set
37CONFIG_KALLSYMS=y
38# CONFIG_KALLSYMS_EXTRA_PASS is not set
39CONFIG_BASE_FULL=y
40CONFIG_FUTEX=y
41CONFIG_EPOLL=y
42# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
43CONFIG_SHMEM=y
44CONFIG_CC_ALIGN_FUNCTIONS=0
45CONFIG_CC_ALIGN_LABELS=0
46CONFIG_CC_ALIGN_LOOPS=0
47CONFIG_CC_ALIGN_JUMPS=0
48# CONFIG_TINY_SHMEM is not set
49CONFIG_BASE_SMALL=0
50
51#
52# Loadable module support
53#
54CONFIG_MODULES=y
55CONFIG_MODULE_UNLOAD=y
56# CONFIG_MODULE_FORCE_UNLOAD is not set
57CONFIG_OBSOLETE_MODPARM=y
58# CONFIG_MODVERSIONS is not set
59# CONFIG_MODULE_SRCVERSION_ALL is not set
60CONFIG_KMOD=y
61
62#
63# Processor
64#
65CONFIG_6xx=y
66# CONFIG_40x is not set
67# CONFIG_44x is not set
68# CONFIG_POWER3 is not set
69# CONFIG_POWER4 is not set
70# CONFIG_8xx is not set
71# CONFIG_E500 is not set
72CONFIG_ALTIVEC=y
73# CONFIG_TAU is not set
74# CONFIG_CPU_FREQ is not set
75# CONFIG_83xx is not set
76CONFIG_PPC_STD_MMU=y
77CONFIG_NOT_COHERENT_CACHE=y
78
79#
80# Platform options
81#
82# CONFIG_PPC_MULTIPLATFORM is not set
83# CONFIG_APUS is not set
84CONFIG_KATANA=y
85# CONFIG_WILLOW is not set
86# CONFIG_CPCI690 is not set
87# CONFIG_PCORE is not set
88# CONFIG_POWERPMC250 is not set
89# CONFIG_CHESTNUT is not set
90# CONFIG_SPRUCE is not set
91# CONFIG_EV64260 is not set
92# CONFIG_LOPEC is not set
93# CONFIG_MCPN765 is not set
94# CONFIG_MVME5100 is not set
95# CONFIG_PPLUS is not set
96# CONFIG_PRPMC750 is not set
97# CONFIG_PRPMC800 is not set
98# CONFIG_SANDPOINT is not set
99# CONFIG_RADSTONE_PPC7D is not set
100# CONFIG_ADIR is not set
101# CONFIG_K2 is not set
102# CONFIG_PAL4 is not set
103# CONFIG_GEMINI is not set
104# CONFIG_EST8260 is not set
105# CONFIG_SBC82xx is not set
106# CONFIG_SBS8260 is not set
107# CONFIG_RPX8260 is not set
108# CONFIG_TQM8260 is not set
109# CONFIG_ADS8272 is not set
110# CONFIG_PQ2FADS is not set
111# CONFIG_LITE5200 is not set
112CONFIG_MV64360=y
113CONFIG_MV64X60=y
114
115#
116# Set bridge options
117#
118CONFIG_MV64X60_BASE=0xf8100000
119CONFIG_MV64X60_NEW_BASE=0xf8100000
120# CONFIG_SMP is not set
121# CONFIG_PREEMPT is not set
122# CONFIG_HIGHMEM is not set
123CONFIG_BINFMT_ELF=y
124CONFIG_BINFMT_MISC=y
125CONFIG_CMDLINE_BOOL=y
126CONFIG_CMDLINE="console=ttyMM0,9600 ip=on"
127
128#
129# Bus options
130#
131CONFIG_GENERIC_ISA_DMA=y
132CONFIG_PCI=y
133CONFIG_PCI_DOMAINS=y
134CONFIG_PCI_LEGACY_PROC=y
135CONFIG_PCI_NAMES=y
136
137#
138# PCCARD (PCMCIA/CardBus) support
139#
140# CONFIG_PCCARD is not set
141
142#
143# PC-card bridges
144#
145
146#
147# Advanced setup
148#
149CONFIG_ADVANCED_OPTIONS=y
150CONFIG_HIGHMEM_START=0xfe000000
151# CONFIG_LOWMEM_SIZE_BOOL is not set
152CONFIG_LOWMEM_SIZE=0x30000000
153# CONFIG_KERNEL_START_BOOL is not set
154CONFIG_KERNEL_START=0xc0000000
155# CONFIG_TASK_SIZE_BOOL is not set
156CONFIG_TASK_SIZE=0x80000000
157CONFIG_CONSISTENT_START_BOOL=y
158CONFIG_CONSISTENT_START=0xf0000000
159CONFIG_CONSISTENT_SIZE_BOOL=y
160CONFIG_CONSISTENT_SIZE=0x00400000
161# CONFIG_BOOT_LOAD_BOOL is not set
162CONFIG_BOOT_LOAD=0x00800000
163
164#
165# Device Drivers
166#
167
168#
169# Generic Driver Options
170#
171CONFIG_STANDALONE=y
172CONFIG_PREVENT_FIRMWARE_BUILD=y
173# CONFIG_FW_LOADER is not set
174
175#
176# Memory Technology Devices (MTD)
177#
178CONFIG_MTD=y
179# CONFIG_MTD_DEBUG is not set
180CONFIG_MTD_PARTITIONS=y
181CONFIG_MTD_CONCAT=y
182# CONFIG_MTD_REDBOOT_PARTS is not set
183# CONFIG_MTD_CMDLINE_PARTS is not set
184
185#
186# User Modules And Translation Layers
187#
188CONFIG_MTD_CHAR=y
189CONFIG_MTD_BLOCK=y
190# CONFIG_FTL is not set
191# CONFIG_NFTL is not set
192# CONFIG_INFTL is not set
193
194#
195# RAM/ROM/Flash chip drivers
196#
197CONFIG_MTD_CFI=y
198# CONFIG_MTD_JEDECPROBE is not set
199CONFIG_MTD_GEN_PROBE=y
200CONFIG_MTD_CFI_ADV_OPTIONS=y
201CONFIG_MTD_CFI_NOSWAP=y
202# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
203# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
204CONFIG_MTD_CFI_GEOMETRY=y
205# CONFIG_MTD_MAP_BANK_WIDTH_1 is not set
206# CONFIG_MTD_MAP_BANK_WIDTH_2 is not set
207CONFIG_MTD_MAP_BANK_WIDTH_4=y
208# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
209# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
210# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
211# CONFIG_MTD_CFI_I1 is not set
212CONFIG_MTD_CFI_I2=y
213# CONFIG_MTD_CFI_I4 is not set
214# CONFIG_MTD_CFI_I8 is not set
215CONFIG_MTD_CFI_INTELEXT=y
216# CONFIG_MTD_CFI_AMDSTD is not set
217# CONFIG_MTD_CFI_STAA is not set
218CONFIG_MTD_CFI_UTIL=y
219# CONFIG_MTD_RAM is not set
220# CONFIG_MTD_ROM is not set
221# CONFIG_MTD_ABSENT is not set
222# CONFIG_MTD_XIP is not set
223
224#
225# Mapping drivers for chip access
226#
227# CONFIG_MTD_COMPLEX_MAPPINGS is not set
228CONFIG_MTD_PHYSMAP=y
229CONFIG_MTD_PHYSMAP_START=0xe0000000
230CONFIG_MTD_PHYSMAP_LEN=0x0
231CONFIG_MTD_PHYSMAP_BANKWIDTH=4
232
233#
234# Self-contained MTD device drivers
235#
236# CONFIG_MTD_PMC551 is not set
237# CONFIG_MTD_SLRAM is not set
238CONFIG_MTD_PHRAM=y
239# CONFIG_MTD_MTDRAM is not set
240# CONFIG_MTD_BLKMTD is not set
241# CONFIG_MTD_BLOCK2MTD is not set
242
243#
244# Disk-On-Chip Device Drivers
245#
246# CONFIG_MTD_DOC2000 is not set
247# CONFIG_MTD_DOC2001 is not set
248# CONFIG_MTD_DOC2001PLUS is not set
249
250#
251# NAND Flash Device Drivers
252#
253# CONFIG_MTD_NAND is not set
254
255#
256# Parallel port support
257#
258# CONFIG_PARPORT is not set
259
260#
261# Plug and Play support
262#
263
264#
265# Block devices
266#
267# CONFIG_BLK_DEV_FD is not set
268# CONFIG_BLK_CPQ_DA is not set
269# CONFIG_BLK_CPQ_CISS_DA is not set
270# CONFIG_BLK_DEV_DAC960 is not set
271# CONFIG_BLK_DEV_UMEM is not set
272# CONFIG_BLK_DEV_COW_COMMON is not set
273CONFIG_BLK_DEV_LOOP=y
274# CONFIG_BLK_DEV_CRYPTOLOOP is not set
275# CONFIG_BLK_DEV_NBD is not set
276# CONFIG_BLK_DEV_SX8 is not set
277CONFIG_BLK_DEV_RAM=y
278CONFIG_BLK_DEV_RAM_COUNT=16
279CONFIG_BLK_DEV_RAM_SIZE=4096
280CONFIG_BLK_DEV_INITRD=y
281CONFIG_INITRAMFS_SOURCE=""
282# CONFIG_LBD is not set
283# CONFIG_CDROM_PKTCDVD is not set
284
285#
286# IO Schedulers
287#
288CONFIG_IOSCHED_NOOP=y
289CONFIG_IOSCHED_AS=y
290CONFIG_IOSCHED_DEADLINE=y
291CONFIG_IOSCHED_CFQ=y
292# CONFIG_ATA_OVER_ETH is not set
293
294#
295# ATA/ATAPI/MFM/RLL support
296#
297# CONFIG_IDE is not set
298
299#
300# SCSI device support
301#
302# CONFIG_SCSI is not set
303
304#
305# Multi-device support (RAID and LVM)
306#
307# CONFIG_MD is not set
308
309#
310# Fusion MPT device support
311#
312
313#
314# IEEE 1394 (FireWire) support
315#
316# CONFIG_IEEE1394 is not set
317
318#
319# I2O device support
320#
321# CONFIG_I2O is not set
322
323#
324# Macintosh device drivers
325#
326
327#
328# Networking support
329#
330CONFIG_NET=y
331
332#
333# Networking options
334#
335CONFIG_PACKET=y
336# CONFIG_PACKET_MMAP is not set
337# CONFIG_NETLINK_DEV is not set
338CONFIG_UNIX=y
339# CONFIG_NET_KEY is not set
340CONFIG_INET=y
341CONFIG_IP_MULTICAST=y
342# CONFIG_IP_ADVANCED_ROUTER is not set
343CONFIG_IP_PNP=y
344CONFIG_IP_PNP_DHCP=y
345# CONFIG_IP_PNP_BOOTP is not set
346# CONFIG_IP_PNP_RARP is not set
347# CONFIG_NET_IPIP is not set
348# CONFIG_NET_IPGRE is not set
349# CONFIG_IP_MROUTE is not set
350# CONFIG_ARPD is not set
351CONFIG_SYN_COOKIES=y
352# CONFIG_INET_AH is not set
353# CONFIG_INET_ESP is not set
354# CONFIG_INET_IPCOMP is not set
355# CONFIG_INET_TUNNEL is not set
356CONFIG_IP_TCPDIAG=y
357# CONFIG_IP_TCPDIAG_IPV6 is not set
358# CONFIG_IPV6 is not set
359# CONFIG_NETFILTER is not set
360
361#
362# SCTP Configuration (EXPERIMENTAL)
363#
364# CONFIG_IP_SCTP is not set
365# CONFIG_ATM is not set
366# CONFIG_BRIDGE is not set
367# CONFIG_VLAN_8021Q is not set
368# CONFIG_DECNET is not set
369# CONFIG_LLC2 is not set
370# CONFIG_IPX is not set
371# CONFIG_ATALK is not set
372# CONFIG_X25 is not set
373# CONFIG_LAPB is not set
374# CONFIG_NET_DIVERT is not set
375# CONFIG_ECONET is not set
376# CONFIG_WAN_ROUTER is not set
377
378#
379# QoS and/or fair queueing
380#
381# CONFIG_NET_SCHED is not set
382# CONFIG_NET_CLS_ROUTE is not set
383
384#
385# Network testing
386#
387# CONFIG_NET_PKTGEN is not set
388# CONFIG_NETPOLL is not set
389# CONFIG_NET_POLL_CONTROLLER is not set
390# CONFIG_HAMRADIO is not set
391# CONFIG_IRDA is not set
392# CONFIG_BT is not set
393CONFIG_NETDEVICES=y
394# CONFIG_DUMMY is not set
395# CONFIG_BONDING is not set
396# CONFIG_EQUALIZER is not set
397# CONFIG_TUN is not set
398
399#
400# ARCnet devices
401#
402# CONFIG_ARCNET is not set
403
404#
405# Ethernet (10 or 100Mbit)
406#
407CONFIG_NET_ETHERNET=y
408CONFIG_MII=y
409# CONFIG_HAPPYMEAL is not set
410# CONFIG_SUNGEM is not set
411# CONFIG_NET_VENDOR_3COM is not set
412
413#
414# Tulip family network device support
415#
416CONFIG_NET_TULIP=y
417# CONFIG_DE2104X is not set
418CONFIG_TULIP=y
419# CONFIG_TULIP_MWI is not set
420# CONFIG_TULIP_MMIO is not set
421# CONFIG_TULIP_NAPI is not set
422# CONFIG_DE4X5 is not set
423# CONFIG_WINBOND_840 is not set
424# CONFIG_DM9102 is not set
425# CONFIG_HP100 is not set
426CONFIG_NET_PCI=y
427# CONFIG_PCNET32 is not set
428# CONFIG_AMD8111_ETH is not set
429# CONFIG_ADAPTEC_STARFIRE is not set
430# CONFIG_B44 is not set
431# CONFIG_FORCEDETH is not set
432# CONFIG_DGRS is not set
433# CONFIG_EEPRO100 is not set
434CONFIG_E100=y
435# CONFIG_FEALNX is not set
436# CONFIG_NATSEMI is not set
437# CONFIG_NE2K_PCI is not set
438# CONFIG_8139CP is not set
439# CONFIG_8139TOO is not set
440# CONFIG_SIS900 is not set
441# CONFIG_EPIC100 is not set
442# CONFIG_SUNDANCE is not set
443# CONFIG_TLAN is not set
444# CONFIG_VIA_RHINE is not set
445
446#
447# Ethernet (1000 Mbit)
448#
449# CONFIG_ACENIC is not set
450# CONFIG_DL2K is not set
451# CONFIG_E1000 is not set
452# CONFIG_NS83820 is not set
453# CONFIG_HAMACHI is not set
454# CONFIG_YELLOWFIN is not set
455# CONFIG_R8169 is not set
456# CONFIG_SK98LIN is not set
457# CONFIG_VIA_VELOCITY is not set
458# CONFIG_TIGON3 is not set
459CONFIG_MV643XX_ETH=y
460CONFIG_MV643XX_ETH_0=y
461CONFIG_MV643XX_ETH_1=y
462CONFIG_MV643XX_ETH_2=y
463
464#
465# Ethernet (10000 Mbit)
466#
467# CONFIG_IXGB is not set
468# CONFIG_S2IO is not set
469
470#
471# Token Ring devices
472#
473# CONFIG_TR is not set
474
475#
476# Wireless LAN (non-hamradio)
477#
478# CONFIG_NET_RADIO is not set
479
480#
481# Wan interfaces
482#
483# CONFIG_WAN is not set
484# CONFIG_FDDI is not set
485# CONFIG_HIPPI is not set
486# CONFIG_PPP is not set
487# CONFIG_SLIP is not set
488# CONFIG_SHAPER is not set
489# CONFIG_NETCONSOLE is not set
490
491#
492# ISDN subsystem
493#
494# CONFIG_ISDN is not set
495
496#
497# Telephony Support
498#
499# CONFIG_PHONE is not set
500
501#
502# Input device support
503#
504CONFIG_INPUT=y
505
506#
507# Userland interfaces
508#
509CONFIG_INPUT_MOUSEDEV=y
510CONFIG_INPUT_MOUSEDEV_PSAUX=y
511CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
512CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
513# CONFIG_INPUT_JOYDEV is not set
514# CONFIG_INPUT_TSDEV is not set
515# CONFIG_INPUT_EVDEV is not set
516# CONFIG_INPUT_EVBUG is not set
517
518#
519# Input I/O drivers
520#
521# CONFIG_GAMEPORT is not set
522CONFIG_SOUND_GAMEPORT=y
523# CONFIG_SERIO is not set
524# CONFIG_SERIO_I8042 is not set
525
526#
527# Input Device Drivers
528#
529# CONFIG_INPUT_KEYBOARD is not set
530# CONFIG_INPUT_MOUSE is not set
531# CONFIG_INPUT_JOYSTICK is not set
532# CONFIG_INPUT_TOUCHSCREEN is not set
533# CONFIG_INPUT_MISC is not set
534
535#
536# Character devices
537#
538CONFIG_VT=y
539CONFIG_VT_CONSOLE=y
540CONFIG_HW_CONSOLE=y
541# CONFIG_SERIAL_NONSTANDARD is not set
542
543#
544# Serial drivers
545#
546# CONFIG_SERIAL_8250 is not set
547
548#
549# Non-8250 serial port support
550#
551CONFIG_SERIAL_MPSC=y
552CONFIG_SERIAL_MPSC_CONSOLE=y
553CONFIG_SERIAL_CORE=y
554CONFIG_SERIAL_CORE_CONSOLE=y
555CONFIG_UNIX98_PTYS=y
556CONFIG_LEGACY_PTYS=y
557CONFIG_LEGACY_PTY_COUNT=256
558
559#
560# IPMI
561#
562# CONFIG_IPMI_HANDLER is not set
563
564#
565# Watchdog Cards
566#
567# CONFIG_WATCHDOG is not set
568# CONFIG_NVRAM is not set
569CONFIG_GEN_RTC=y
570# CONFIG_GEN_RTC_X is not set
571# CONFIG_DTLK is not set
572# CONFIG_R3964 is not set
573# CONFIG_APPLICOM is not set
574
575#
576# Ftape, the floppy tape device driver
577#
578# CONFIG_AGP is not set
579# CONFIG_DRM is not set
580# CONFIG_RAW_DRIVER is not set
581
582#
583# I2C support
584#
585CONFIG_I2C=y
586CONFIG_I2C_CHARDEV=y
587
588#
589# I2C Algorithms
590#
591# CONFIG_I2C_ALGOBIT is not set
592# CONFIG_I2C_ALGOPCF is not set
593# CONFIG_I2C_ALGOPCA is not set
594
595#
596# I2C Hardware Bus support
597#
598# CONFIG_I2C_ALI1535 is not set
599# CONFIG_I2C_ALI1563 is not set
600# CONFIG_I2C_ALI15X3 is not set
601# CONFIG_I2C_AMD756 is not set
602# CONFIG_I2C_AMD8111 is not set
603# CONFIG_I2C_I801 is not set
604# CONFIG_I2C_I810 is not set
605# CONFIG_I2C_ISA is not set
606# CONFIG_I2C_MPC is not set
607# CONFIG_I2C_NFORCE2 is not set
608# CONFIG_I2C_PARPORT_LIGHT is not set
609# CONFIG_I2C_PIIX4 is not set
610# CONFIG_I2C_PROSAVAGE is not set
611# CONFIG_I2C_SAVAGE4 is not set
612# CONFIG_SCx200_ACB is not set
613# CONFIG_I2C_SIS5595 is not set
614# CONFIG_I2C_SIS630 is not set
615# CONFIG_I2C_SIS96X is not set
616# CONFIG_I2C_STUB is not set
617# CONFIG_I2C_VIA is not set
618# CONFIG_I2C_VIAPRO is not set
619# CONFIG_I2C_VOODOO3 is not set
620# CONFIG_I2C_PCA_ISA is not set
621CONFIG_I2C_MV64XXX=y
622
623#
624# Hardware Sensors Chip support
625#
626# CONFIG_I2C_SENSOR is not set
627# CONFIG_SENSORS_ADM1021 is not set
628# CONFIG_SENSORS_ADM1025 is not set
629# CONFIG_SENSORS_ADM1026 is not set
630# CONFIG_SENSORS_ADM1031 is not set
631# CONFIG_SENSORS_ASB100 is not set
632# CONFIG_SENSORS_DS1621 is not set
633# CONFIG_SENSORS_FSCHER is not set
634# CONFIG_SENSORS_FSCPOS is not set
635# CONFIG_SENSORS_GL518SM is not set
636# CONFIG_SENSORS_GL520SM is not set
637# CONFIG_SENSORS_IT87 is not set
638# CONFIG_SENSORS_LM63 is not set
639# CONFIG_SENSORS_LM75 is not set
640# CONFIG_SENSORS_LM77 is not set
641# CONFIG_SENSORS_LM78 is not set
642# CONFIG_SENSORS_LM80 is not set
643# CONFIG_SENSORS_LM83 is not set
644# CONFIG_SENSORS_LM85 is not set
645# CONFIG_SENSORS_LM87 is not set
646# CONFIG_SENSORS_LM90 is not set
647# CONFIG_SENSORS_MAX1619 is not set
648# CONFIG_SENSORS_PC87360 is not set
649# CONFIG_SENSORS_SMSC47B397 is not set
650# CONFIG_SENSORS_SIS5595 is not set
651# CONFIG_SENSORS_SMSC47M1 is not set
652# CONFIG_SENSORS_VIA686A is not set
653# CONFIG_SENSORS_W83781D is not set
654# CONFIG_SENSORS_W83L785TS is not set
655# CONFIG_SENSORS_W83627HF is not set
656
657#
658# Other I2C Chip support
659#
660# CONFIG_SENSORS_EEPROM is not set
661# CONFIG_SENSORS_PCF8574 is not set
662# CONFIG_SENSORS_PCF8591 is not set
663# CONFIG_SENSORS_RTC8564 is not set
664CONFIG_SENSORS_M41T00=y
665# CONFIG_I2C_DEBUG_CORE is not set
666# CONFIG_I2C_DEBUG_ALGO is not set
667# CONFIG_I2C_DEBUG_BUS is not set
668# CONFIG_I2C_DEBUG_CHIP is not set
669
670#
671# Dallas's 1-wire bus
672#
673# CONFIG_W1 is not set
674
675#
676# Misc devices
677#
678
679#
680# Multimedia devices
681#
682# CONFIG_VIDEO_DEV is not set
683
684#
685# Digital Video Broadcasting Devices
686#
687# CONFIG_DVB is not set
688
689#
690# Graphics support
691#
692# CONFIG_FB is not set
693
694#
695# Console display driver support
696#
697# CONFIG_VGA_CONSOLE is not set
698CONFIG_DUMMY_CONSOLE=y
699
700#
701# Sound
702#
703# CONFIG_SOUND is not set
704
705#
706# USB support
707#
708# CONFIG_USB is not set
709CONFIG_USB_ARCH_HAS_HCD=y
710CONFIG_USB_ARCH_HAS_OHCI=y
711
712#
713# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
714#
715
716#
717# USB Gadget Support
718#
719# CONFIG_USB_GADGET is not set
720
721#
722# MMC/SD Card support
723#
724# CONFIG_MMC is not set
725
726#
727# InfiniBand support
728#
729# CONFIG_INFINIBAND is not set
730
731#
732# File systems
733#
734CONFIG_EXT2_FS=y
735# CONFIG_EXT2_FS_XATTR is not set
736# CONFIG_EXT3_FS is not set
737# CONFIG_JBD is not set
738# CONFIG_REISERFS_FS is not set
739# CONFIG_JFS_FS is not set
740
741#
742# XFS support
743#
744# CONFIG_XFS_FS is not set
745# CONFIG_MINIX_FS is not set
746# CONFIG_ROMFS_FS is not set
747# CONFIG_QUOTA is not set
748CONFIG_DNOTIFY=y
749# CONFIG_AUTOFS_FS is not set
750# CONFIG_AUTOFS4_FS is not set
751
752#
753# CD-ROM/DVD Filesystems
754#
755# CONFIG_ISO9660_FS is not set
756# CONFIG_UDF_FS is not set
757
758#
759# DOS/FAT/NT Filesystems
760#
761# CONFIG_MSDOS_FS is not set
762# CONFIG_VFAT_FS is not set
763# CONFIG_NTFS_FS is not set
764
765#
766# Pseudo filesystems
767#
768CONFIG_PROC_FS=y
769CONFIG_PROC_KCORE=y
770CONFIG_SYSFS=y
771CONFIG_DEVFS_FS=y
772# CONFIG_DEVFS_MOUNT is not set
773# CONFIG_DEVFS_DEBUG is not set
774# CONFIG_DEVPTS_FS_XATTR is not set
775CONFIG_TMPFS=y
776# CONFIG_TMPFS_XATTR is not set
777# CONFIG_HUGETLB_PAGE is not set
778CONFIG_RAMFS=y
779
780#
781# Miscellaneous filesystems
782#
783# CONFIG_ADFS_FS is not set
784# CONFIG_AFFS_FS is not set
785# CONFIG_HFS_FS is not set
786# CONFIG_HFSPLUS_FS is not set
787# CONFIG_BEFS_FS is not set
788# CONFIG_BFS_FS is not set
789# CONFIG_EFS_FS is not set
790# CONFIG_JFFS_FS is not set
791# CONFIG_JFFS2_FS is not set
792# CONFIG_CRAMFS is not set
793# CONFIG_VXFS_FS is not set
794# CONFIG_HPFS_FS is not set
795# CONFIG_QNX4FS_FS is not set
796# CONFIG_SYSV_FS is not set
797# CONFIG_UFS_FS is not set
798
799#
800# Network File Systems
801#
802CONFIG_NFS_FS=y
803CONFIG_NFS_V3=y
804# CONFIG_NFS_V4 is not set
805# CONFIG_NFS_DIRECTIO is not set
806# CONFIG_NFSD is not set
807CONFIG_ROOT_NFS=y
808CONFIG_LOCKD=y
809CONFIG_LOCKD_V4=y
810CONFIG_SUNRPC=y
811# CONFIG_RPCSEC_GSS_KRB5 is not set
812# CONFIG_RPCSEC_GSS_SPKM3 is not set
813# CONFIG_SMB_FS is not set
814# CONFIG_CIFS is not set
815# CONFIG_NCP_FS is not set
816# CONFIG_CODA_FS is not set
817# CONFIG_AFS_FS is not set
818
819#
820# Partition Types
821#
822# CONFIG_PARTITION_ADVANCED is not set
823CONFIG_MSDOS_PARTITION=y
824
825#
826# Native Language Support
827#
828# CONFIG_NLS is not set
829
830#
831# Library routines
832#
833# CONFIG_CRC_CCITT is not set
834CONFIG_CRC32=y
835# CONFIG_LIBCRC32C is not set
836
837#
838# Profiling support
839#
840# CONFIG_PROFILING is not set
841
842#
843# Kernel hacking
844#
845# CONFIG_DEBUG_KERNEL is not set
846# CONFIG_PRINTK_TIME is not set
847
848#
849# Security options
850#
851# CONFIG_KEYS is not set
852# CONFIG_SECURITY is not set
853
854#
855# Cryptographic options
856#
857# CONFIG_CRYPTO is not set
858
859#
860# Hardware crypto devices
861#
diff --git a/arch/ppc/configs/lite5200_defconfig b/arch/ppc/configs/lite5200_defconfig
new file mode 100644
index 000000000000..7e7a943d8cfe
--- /dev/null
+++ b/arch/ppc/configs/lite5200_defconfig
@@ -0,0 +1,436 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7CONFIG_PPC=y
8CONFIG_PPC32=y
9CONFIG_GENERIC_NVRAM=y
10#
11# Code maturity level options
12#
13CONFIG_EXPERIMENTAL=y
14CONFIG_CLEAN_COMPILE=y
15CONFIG_STANDALONE=y
16CONFIG_BROKEN_ON_SMP=y
17#
18# General setup
19#
20CONFIG_SWAP=y
21CONFIG_SYSVIPC=y
22# CONFIG_BSD_PROCESS_ACCT is not set
23CONFIG_SYSCTL=y
24# CONFIG_AUDIT is not set
25CONFIG_LOG_BUF_SHIFT=14
26# CONFIG_HOTPLUG is not set
27# CONFIG_IKCONFIG is not set
28# CONFIG_EMBEDDED is not set
29CONFIG_KALLSYMS=y
30# CONFIG_KALLSYMS_ALL is not set
31# CONFIG_KALLSYMS_EXTRA_PASS is not set
32CONFIG_FUTEX=y
33CONFIG_EPOLL=y
34CONFIG_IOSCHED_NOOP=y
35CONFIG_IOSCHED_AS=y
36CONFIG_IOSCHED_DEADLINE=y
37CONFIG_IOSCHED_CFQ=y
38# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
39#
40# Loadable module support
41#
42CONFIG_MODULES=y
43CONFIG_MODULE_UNLOAD=y
44# CONFIG_MODULE_FORCE_UNLOAD is not set
45CONFIG_OBSOLETE_MODPARM=y
46CONFIG_MODVERSIONS=y
47CONFIG_KMOD=y
48#
49# Processor
50#
51CONFIG_6xx=y
52# CONFIG_40x is not set
53# CONFIG_44x is not set
54# CONFIG_POWER3 is not set
55# CONFIG_POWER4 is not set
56# CONFIG_8xx is not set
57# CONFIG_E500 is not set
58# CONFIG_ALTIVEC is not set
59# CONFIG_TAU is not set
60# CONFIG_CPU_FREQ is not set
61CONFIG_FSL_OCP=y
62CONFIG_PPC_STD_MMU=y
63#
64# Platform options
65#
66# CONFIG_PPC_MULTIPLATFORM is not set
67# CONFIG_APUS is not set
68# CONFIG_WILLOW is not set
69# CONFIG_PCORE is not set
70# CONFIG_POWERPMC250 is not set
71# CONFIG_EV64260 is not set
72# CONFIG_SPRUCE is not set
73# CONFIG_LOPEC is not set
74# CONFIG_MCPN765 is not set
75# CONFIG_MVME5100 is not set
76# CONFIG_PPLUS is not set
77# CONFIG_PRPMC750 is not set
78# CONFIG_PRPMC800 is not set
79# CONFIG_SANDPOINT is not set
80# CONFIG_ADIR is not set
81# CONFIG_K2 is not set
82# CONFIG_PAL4 is not set
83# CONFIG_GEMINI is not set
84# CONFIG_EST8260 is not set
85# CONFIG_SBC82xx is not set
86# CONFIG_SBS8260 is not set
87# CONFIG_RPX6 is not set
88# CONFIG_TQM8260 is not set
89# CONFIG_ADS8272 is not set
90CONFIG_LITE5200=y
91CONFIG_PPC_MPC52xx=y
92# CONFIG_SMP is not set
93# CONFIG_PREEMPT is not set
94# CONFIG_HIGHMEM is not set
95CONFIG_KERNEL_ELF=y
96CONFIG_BINFMT_ELF=y
97# CONFIG_BINFMT_MISC is not set
98CONFIG_CMDLINE_BOOL=y
99CONFIG_CMDLINE="console=ttyS0 root=/dev/ram0 rw"
100#
101# Bus options
102#
103CONFIG_GENERIC_ISA_DMA=y
104CONFIG_PCI=y
105CONFIG_PCI_DOMAINS=y
106# CONFIG_PCI_LEGACY_PROC is not set
107# CONFIG_PCI_NAMES is not set
108#
109# Advanced setup
110#
111CONFIG_ADVANCED_OPTIONS=y
112CONFIG_HIGHMEM_START=0xfe000000
113# CONFIG_LOWMEM_SIZE_BOOL is not set
114CONFIG_LOWMEM_SIZE=0x30000000
115# CONFIG_KERNEL_START_BOOL is not set
116CONFIG_KERNEL_START=0xc0000000
117# CONFIG_TASK_SIZE_BOOL is not set
118CONFIG_TASK_SIZE=0x80000000
119# CONFIG_BOOT_LOAD_BOOL is not set
120CONFIG_BOOT_LOAD=0x00800000
121#
122# Device Drivers
123#
124#
125# Generic Driver Options
126#
127CONFIG_PREVENT_FIRMWARE_BUILD=y
128# CONFIG_DEBUG_DRIVER is not set
129#
130# Memory Technology Devices (MTD)
131#
132# CONFIG_MTD is not set
133#
134# Parallel port support
135#
136# CONFIG_PARPORT is not set
137#
138# Plug and Play support
139#
140#
141# Block devices
142#
143# CONFIG_BLK_DEV_FD is not set
144# CONFIG_BLK_CPQ_DA is not set
145# CONFIG_BLK_CPQ_CISS_DA is not set
146# CONFIG_BLK_DEV_DAC960 is not set
147# CONFIG_BLK_DEV_UMEM is not set
148# CONFIG_BLK_DEV_LOOP is not set
149# CONFIG_BLK_DEV_SX8 is not set
150CONFIG_BLK_DEV_RAM=y
151CONFIG_BLK_DEV_RAM_SIZE=4096
152CONFIG_BLK_DEV_INITRD=y
153# CONFIG_LBD is not set
154#
155# ATA/ATAPI/MFM/RLL support
156#
157# CONFIG_IDE is not set
158#
159# SCSI device support
160#
161# CONFIG_SCSI is not set
162#
163# Multi-device support (RAID and LVM)
164#
165# CONFIG_MD is not set
166#
167# Fusion MPT device support
168#
169#
170# IEEE 1394 (FireWire) support
171#
172# CONFIG_IEEE1394 is not set
173#
174# I2O device support
175#
176# CONFIG_I2O is not set
177#
178# Macintosh device drivers
179#
180#
181# Networking support
182#
183# CONFIG_NET is not set
184# CONFIG_NETPOLL is not set
185# CONFIG_NET_POLL_CONTROLLER is not set
186#
187# ISDN subsystem
188#
189#
190# Telephony Support
191#
192# CONFIG_PHONE is not set
193#
194# Input device support
195#
196CONFIG_INPUT=y
197#
198# Userland interfaces
199#
200CONFIG_INPUT_MOUSEDEV=y
201CONFIG_INPUT_MOUSEDEV_PSAUX=y
202CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
203CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
204# CONFIG_INPUT_JOYDEV is not set
205# CONFIG_INPUT_TSDEV is not set
206CONFIG_INPUT_EVDEV=y
207CONFIG_INPUT_EVBUG=y
208#
209# Input I/O drivers
210#
211# CONFIG_GAMEPORT is not set
212CONFIG_SOUND_GAMEPORT=y
213CONFIG_SERIO=y
214# CONFIG_SERIO_I8042 is not set
215CONFIG_SERIO_SERPORT=y
216# CONFIG_SERIO_CT82C710 is not set
217# CONFIG_SERIO_PCIPS2 is not set
218#
219# Input Device Drivers
220#
221# CONFIG_INPUT_KEYBOARD is not set
222# CONFIG_INPUT_MOUSE is not set
223# CONFIG_INPUT_JOYSTICK is not set
224# CONFIG_INPUT_TOUCHSCREEN is not set
225# CONFIG_INPUT_MISC is not set
226#
227# Character devices
228#
229CONFIG_VT=y
230CONFIG_VT_CONSOLE=y
231CONFIG_HW_CONSOLE=y
232# CONFIG_SERIAL_NONSTANDARD is not set
233#
234# Serial drivers
235#
236# CONFIG_SERIAL_8250 is not set
237#
238# Non-8250 serial port support
239#
240CONFIG_SERIAL_CORE=y
241CONFIG_SERIAL_CORE_CONSOLE=y
242CONFIG_SERIAL_MPC52xx=y
243CONFIG_SERIAL_MPC52xx_CONSOLE=y
244CONFIG_SERIAL_MPC52xx_CONSOLE_BAUD=9600
245CONFIG_UNIX98_PTYS=y
246CONFIG_LEGACY_PTYS=y
247CONFIG_LEGACY_PTY_COUNT=256
248# CONFIG_QIC02_TAPE is not set
249#
250# IPMI
251#
252# CONFIG_IPMI_HANDLER is not set
253#
254# Watchdog Cards
255#
256# CONFIG_WATCHDOG is not set
257# CONFIG_NVRAM is not set
258# CONFIG_GEN_RTC is not set
259# CONFIG_DTLK is not set
260# CONFIG_R3964 is not set
261# CONFIG_APPLICOM is not set
262#
263# Ftape, the floppy tape device driver
264#
265# CONFIG_FTAPE is not set
266# CONFIG_AGP is not set
267# CONFIG_DRM is not set
268# CONFIG_RAW_DRIVER is not set
269#
270# I2C support
271#
272# CONFIG_I2C is not set
273#
274# Misc devices
275#
276#
277# Multimedia devices
278#
279# CONFIG_VIDEO_DEV is not set
280#
281# Digital Video Broadcasting Devices
282#
283#
284# Graphics support
285#
286# CONFIG_FB is not set
287#
288# Console display driver support
289#
290CONFIG_VGA_CONSOLE=y
291# CONFIG_MDA_CONSOLE is not set
292CONFIG_DUMMY_CONSOLE=y
293#
294# Sound
295#
296# CONFIG_SOUND is not set
297#
298# USB support
299#
300# CONFIG_USB is not set
301#
302# USB Gadget Support
303#
304# CONFIG_USB_GADGET is not set
305#
306# File systems
307#
308CONFIG_EXT2_FS=y
309# CONFIG_EXT2_FS_XATTR is not set
310# CONFIG_EXT3_FS is not set
311# CONFIG_JBD is not set
312# CONFIG_REISERFS_FS is not set
313# CONFIG_JFS_FS is not set
314# CONFIG_XFS_FS is not set
315# CONFIG_MINIX_FS is not set
316# CONFIG_ROMFS_FS is not set
317# CONFIG_QUOTA is not set
318# CONFIG_AUTOFS_FS is not set
319# CONFIG_AUTOFS4_FS is not set
320#
321# CD-ROM/DVD Filesystems
322#
323# CONFIG_ISO9660_FS is not set
324# CONFIG_UDF_FS is not set
325#
326# DOS/FAT/NT Filesystems
327#
328# CONFIG_FAT_FS is not set
329# CONFIG_NTFS_FS is not set
330#
331# Pseudo filesystems
332#
333CONFIG_PROC_FS=y
334CONFIG_PROC_KCORE=y
335CONFIG_SYSFS=y
336# CONFIG_DEVFS_FS is not set
337# CONFIG_DEVPTS_FS_XATTR is not set
338CONFIG_TMPFS=y
339# CONFIG_HUGETLB_PAGE is not set
340CONFIG_RAMFS=y
341#
342# Miscellaneous filesystems
343#
344# CONFIG_ADFS_FS is not set
345# CONFIG_AFFS_FS is not set
346# CONFIG_HFS_FS is not set
347# CONFIG_HFSPLUS_FS is not set
348# CONFIG_BEFS_FS is not set
349# CONFIG_BFS_FS is not set
350# CONFIG_EFS_FS is not set
351# CONFIG_CRAMFS is not set
352# CONFIG_VXFS_FS is not set
353# CONFIG_HPFS_FS is not set
354# CONFIG_QNX4FS_FS is not set
355# CONFIG_SYSV_FS is not set
356# CONFIG_UFS_FS is not set
357#
358# Partition Types
359#
360# CONFIG_PARTITION_ADVANCED is not set
361CONFIG_MSDOS_PARTITION=y
362#
363# Native Language Support
364#
365CONFIG_NLS=y
366CONFIG_NLS_DEFAULT="iso8859-1"
367# CONFIG_NLS_CODEPAGE_437 is not set
368# CONFIG_NLS_CODEPAGE_737 is not set
369# CONFIG_NLS_CODEPAGE_775 is not set
370# CONFIG_NLS_CODEPAGE_850 is not set
371# CONFIG_NLS_CODEPAGE_852 is not set
372# CONFIG_NLS_CODEPAGE_855 is not set
373# CONFIG_NLS_CODEPAGE_857 is not set
374# CONFIG_NLS_CODEPAGE_860 is not set
375# CONFIG_NLS_CODEPAGE_861 is not set
376# CONFIG_NLS_CODEPAGE_862 is not set
377# CONFIG_NLS_CODEPAGE_863 is not set
378# CONFIG_NLS_CODEPAGE_864 is not set
379# CONFIG_NLS_CODEPAGE_865 is not set
380# CONFIG_NLS_CODEPAGE_866 is not set
381# CONFIG_NLS_CODEPAGE_869 is not set
382# CONFIG_NLS_CODEPAGE_936 is not set
383# CONFIG_NLS_CODEPAGE_950 is not set
384# CONFIG_NLS_CODEPAGE_932 is not set
385# CONFIG_NLS_CODEPAGE_949 is not set
386# CONFIG_NLS_CODEPAGE_874 is not set
387# CONFIG_NLS_ISO8859_8 is not set
388# CONFIG_NLS_CODEPAGE_1250 is not set
389# CONFIG_NLS_CODEPAGE_1251 is not set
390# CONFIG_NLS_ASCII is not set
391CONFIG_NLS_ISO8859_1=m
392# CONFIG_NLS_ISO8859_2 is not set
393# CONFIG_NLS_ISO8859_3 is not set
394# CONFIG_NLS_ISO8859_4 is not set
395# CONFIG_NLS_ISO8859_5 is not set
396# CONFIG_NLS_ISO8859_6 is not set
397# CONFIG_NLS_ISO8859_7 is not set
398# CONFIG_NLS_ISO8859_9 is not set
399# CONFIG_NLS_ISO8859_13 is not set
400# CONFIG_NLS_ISO8859_14 is not set
401# CONFIG_NLS_ISO8859_15 is not set
402# CONFIG_NLS_KOI8_R is not set
403# CONFIG_NLS_KOI8_U is not set
404# CONFIG_NLS_UTF8 is not set
405#
406# Library routines
407#
408# CONFIG_CRC16 is not set
409# CONFIG_CRC32 is not set
410# CONFIG_LIBCRC32C is not set
411#
412# Profiling support
413#
414# CONFIG_PROFILING is not set
415#
416# Kernel hacking
417#
418CONFIG_DEBUG_KERNEL=y
419# CONFIG_DEBUG_SLAB is not set
420CONFIG_MAGIC_SYSRQ=y
421# CONFIG_DEBUG_SPINLOCK is not set
422CONFIG_DEBUG_SPINLOCK_SLEEP=y
423# CONFIG_KGDB is not set
424# CONFIG_XMON is not set
425# CONFIG_BDI_SWITCH is not set
426CONFIG_DEBUG_INFO=y
427CONFIG_SERIAL_TEXT_DEBUG=y
428CONFIG_PPC_OCP=y
429#
430# Security options
431#
432# CONFIG_SECURITY is not set
433#
434# Cryptographic options
435#
436# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/lopec_defconfig b/arch/ppc/configs/lopec_defconfig
new file mode 100644
index 000000000000..85ea06b3b5c6
--- /dev/null
+++ b/arch/ppc/configs/lopec_defconfig
@@ -0,0 +1,814 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7CONFIG_PPC=y
8CONFIG_PPC32=y
9CONFIG_GENERIC_NVRAM=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_STANDALONE=y
17CONFIG_BROKEN_ON_SMP=y
18
19#
20# General setup
21#
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_POSIX_MQUEUE is not set
25# CONFIG_BSD_PROCESS_ACCT is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=14
29CONFIG_HOTPLUG=y
30# CONFIG_IKCONFIG is not set
31CONFIG_EMBEDDED=y
32CONFIG_KALLSYMS=y
33CONFIG_FUTEX=y
34CONFIG_EPOLL=y
35CONFIG_IOSCHED_NOOP=y
36CONFIG_IOSCHED_AS=y
37CONFIG_IOSCHED_DEADLINE=y
38CONFIG_IOSCHED_CFQ=y
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
40
41#
42# Loadable module support
43#
44CONFIG_MODULES=y
45CONFIG_MODULE_UNLOAD=y
46# CONFIG_MODULE_FORCE_UNLOAD is not set
47CONFIG_OBSOLETE_MODPARM=y
48# CONFIG_MODVERSIONS is not set
49CONFIG_KMOD=y
50
51#
52# Processor
53#
54CONFIG_6xx=y
55# CONFIG_40x is not set
56# CONFIG_44x is not set
57# CONFIG_POWER3 is not set
58# CONFIG_POWER4 is not set
59# CONFIG_8xx is not set
60CONFIG_ALTIVEC=y
61# CONFIG_TAU is not set
62# CONFIG_CPU_FREQ is not set
63CONFIG_PPC_STD_MMU=y
64
65#
66# Platform options
67#
68# CONFIG_PPC_MULTIPLATFORM is not set
69# CONFIG_APUS is not set
70# CONFIG_WILLOW is not set
71# CONFIG_PCORE is not set
72# CONFIG_POWERPMC250 is not set
73# CONFIG_EV64260 is not set
74# CONFIG_SPRUCE is not set
75CONFIG_LOPEC=y
76# CONFIG_MCPN765 is not set
77# CONFIG_MVME5100 is not set
78# CONFIG_PPLUS is not set
79# CONFIG_PRPMC750 is not set
80# CONFIG_PRPMC800 is not set
81# CONFIG_SANDPOINT is not set
82# CONFIG_ADIR is not set
83# CONFIG_K2 is not set
84# CONFIG_PAL4 is not set
85# CONFIG_GEMINI is not set
86# CONFIG_EST8260 is not set
87# CONFIG_SBS8260 is not set
88# CONFIG_RPX6 is not set
89# CONFIG_TQM8260 is not set
90CONFIG_EPIC_SERIAL_MODE=y
91CONFIG_MPC10X_BRIDGE=y
92# CONFIG_MPC10X_STORE_GATHERING is not set
93CONFIG_PPCBUG_NVRAM=y
94# CONFIG_SMP is not set
95# CONFIG_PREEMPT is not set
96# CONFIG_HIGHMEM is not set
97CONFIG_KERNEL_ELF=y
98CONFIG_BINFMT_ELF=y
99CONFIG_BINFMT_MISC=m
100CONFIG_CMDLINE_BOOL=y
101CONFIG_CMDLINE="ip=on"
102
103#
104# Bus options
105#
106CONFIG_GENERIC_ISA_DMA=y
107CONFIG_PCI=y
108CONFIG_PCI_DOMAINS=y
109# CONFIG_PCI_LEGACY_PROC is not set
110CONFIG_PCI_NAMES=y
111
112#
113# PCMCIA/CardBus support
114#
115# CONFIG_PCMCIA is not set
116
117#
118# Advanced setup
119#
120# CONFIG_ADVANCED_OPTIONS is not set
121
122#
123# Default settings for advanced configuration options are used
124#
125CONFIG_HIGHMEM_START=0xfe000000
126CONFIG_LOWMEM_SIZE=0x30000000
127CONFIG_KERNEL_START=0xc0000000
128CONFIG_TASK_SIZE=0x80000000
129CONFIG_BOOT_LOAD=0x00800000
130
131#
132# Device Drivers
133#
134
135#
136# Generic Driver Options
137#
138# CONFIG_FW_LOADER is not set
139
140#
141# Memory Technology Devices (MTD)
142#
143# CONFIG_MTD is not set
144
145#
146# Parallel port support
147#
148# CONFIG_PARPORT is not set
149
150#
151# Plug and Play support
152#
153
154#
155# Block devices
156#
157# CONFIG_BLK_DEV_FD is not set
158# CONFIG_BLK_CPQ_DA is not set
159# CONFIG_BLK_CPQ_CISS_DA is not set
160# CONFIG_BLK_DEV_DAC960 is not set
161# CONFIG_BLK_DEV_UMEM is not set
162CONFIG_BLK_DEV_LOOP=m
163# CONFIG_BLK_DEV_CRYPTOLOOP is not set
164# CONFIG_BLK_DEV_NBD is not set
165# CONFIG_BLK_DEV_CARMEL is not set
166CONFIG_BLK_DEV_RAM=m
167CONFIG_BLK_DEV_RAM_SIZE=4096
168# CONFIG_LBD is not set
169
170#
171# ATA/ATAPI/MFM/RLL support
172#
173CONFIG_IDE=y
174CONFIG_BLK_DEV_IDE=y
175
176#
177# Please see Documentation/ide.txt for help/info on IDE drives
178#
179CONFIG_BLK_DEV_IDEDISK=y
180CONFIG_IDEDISK_MULTI_MODE=y
181# CONFIG_IDEDISK_STROKE is not set
182CONFIG_BLK_DEV_IDECD=y
183# CONFIG_BLK_DEV_IDETAPE is not set
184# CONFIG_BLK_DEV_IDEFLOPPY is not set
185# CONFIG_BLK_DEV_IDESCSI is not set
186# CONFIG_IDE_TASK_IOCTL is not set
187# CONFIG_IDE_TASKFILE_IO is not set
188
189#
190# IDE chipset support/bugfixes
191#
192CONFIG_IDE_GENERIC=y
193CONFIG_BLK_DEV_IDEPCI=y
194# CONFIG_IDEPCI_SHARE_IRQ is not set
195# CONFIG_BLK_DEV_OFFBOARD is not set
196CONFIG_BLK_DEV_GENERIC=y
197# CONFIG_BLK_DEV_OPTI621 is not set
198CONFIG_BLK_DEV_SL82C105=y
199CONFIG_BLK_DEV_IDEDMA_PCI=y
200# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
201CONFIG_IDEDMA_PCI_AUTO=y
202# CONFIG_IDEDMA_ONLYDISK is not set
203CONFIG_BLK_DEV_ADMA=y
204# CONFIG_BLK_DEV_AEC62XX is not set
205# CONFIG_BLK_DEV_ALI15X3 is not set
206# CONFIG_BLK_DEV_AMD74XX is not set
207# CONFIG_BLK_DEV_CMD64X is not set
208# CONFIG_BLK_DEV_TRIFLEX is not set
209# CONFIG_BLK_DEV_CY82C693 is not set
210# CONFIG_BLK_DEV_CS5520 is not set
211# CONFIG_BLK_DEV_CS5530 is not set
212# CONFIG_BLK_DEV_HPT34X is not set
213# CONFIG_BLK_DEV_HPT366 is not set
214# CONFIG_BLK_DEV_SC1200 is not set
215# CONFIG_BLK_DEV_PIIX is not set
216# CONFIG_BLK_DEV_NS87415 is not set
217# CONFIG_BLK_DEV_PDC202XX_OLD is not set
218# CONFIG_BLK_DEV_PDC202XX_NEW is not set
219# CONFIG_BLK_DEV_SVWKS is not set
220# CONFIG_BLK_DEV_SIIMAGE is not set
221# CONFIG_BLK_DEV_SLC90E66 is not set
222# CONFIG_BLK_DEV_TRM290 is not set
223# CONFIG_BLK_DEV_VIA82CXXX is not set
224CONFIG_BLK_DEV_IDEDMA=y
225# CONFIG_IDEDMA_IVB is not set
226CONFIG_IDEDMA_AUTO=y
227# CONFIG_BLK_DEV_HD is not set
228
229#
230# SCSI device support
231#
232CONFIG_SCSI=y
233CONFIG_SCSI_PROC_FS=y
234
235#
236# SCSI support type (disk, tape, CD-ROM)
237#
238CONFIG_BLK_DEV_SD=y
239# CONFIG_CHR_DEV_ST is not set
240# CONFIG_CHR_DEV_OSST is not set
241# CONFIG_BLK_DEV_SR is not set
242# CONFIG_CHR_DEV_SG is not set
243
244#
245# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
246#
247# CONFIG_SCSI_MULTI_LUN is not set
248# CONFIG_SCSI_REPORT_LUNS is not set
249CONFIG_SCSI_CONSTANTS=y
250# CONFIG_SCSI_LOGGING is not set
251
252#
253# SCSI Transport Attributes
254#
255CONFIG_SCSI_SPI_ATTRS=y
256# CONFIG_SCSI_FC_ATTRS is not set
257
258#
259# SCSI low-level drivers
260#
261# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
262# CONFIG_SCSI_ACARD is not set
263# CONFIG_SCSI_AACRAID is not set
264# CONFIG_SCSI_AIC7XXX is not set
265# CONFIG_SCSI_AIC7XXX_OLD is not set
266# CONFIG_SCSI_AIC79XX is not set
267# CONFIG_SCSI_ADVANSYS is not set
268# CONFIG_SCSI_MEGARAID is not set
269# CONFIG_SCSI_SATA is not set
270# CONFIG_SCSI_BUSLOGIC is not set
271# CONFIG_SCSI_CPQFCTS is not set
272# CONFIG_SCSI_DMX3191D is not set
273# CONFIG_SCSI_EATA is not set
274# CONFIG_SCSI_EATA_PIO is not set
275# CONFIG_SCSI_FUTURE_DOMAIN is not set
276# CONFIG_SCSI_GDTH is not set
277# CONFIG_SCSI_IPS is not set
278# CONFIG_SCSI_INIA100 is not set
279CONFIG_SCSI_SYM53C8XX_2=y
280CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0
281CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
282CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
283# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set
284# CONFIG_SCSI_IPR is not set
285# CONFIG_SCSI_QLOGIC_ISP is not set
286# CONFIG_SCSI_QLOGIC_FC is not set
287# CONFIG_SCSI_QLOGIC_1280 is not set
288CONFIG_SCSI_QLA2XXX=y
289# CONFIG_SCSI_QLA21XX is not set
290# CONFIG_SCSI_QLA22XX is not set
291# CONFIG_SCSI_QLA2300 is not set
292# CONFIG_SCSI_QLA2322 is not set
293# CONFIG_SCSI_QLA6312 is not set
294# CONFIG_SCSI_QLA6322 is not set
295# CONFIG_SCSI_DC395x is not set
296# CONFIG_SCSI_DC390T is not set
297# CONFIG_SCSI_NSP32 is not set
298# CONFIG_SCSI_DEBUG is not set
299
300#
301# Multi-device support (RAID and LVM)
302#
303# CONFIG_MD is not set
304
305#
306# Fusion MPT device support
307#
308# CONFIG_FUSION is not set
309
310#
311# IEEE 1394 (FireWire) support
312#
313# CONFIG_IEEE1394 is not set
314
315#
316# I2O device support
317#
318# CONFIG_I2O is not set
319
320#
321# Macintosh device drivers
322#
323
324#
325# Networking support
326#
327CONFIG_NET=y
328
329#
330# Networking options
331#
332CONFIG_PACKET=y
333# CONFIG_PACKET_MMAP is not set
334# CONFIG_NETLINK_DEV is not set
335CONFIG_UNIX=y
336# CONFIG_NET_KEY is not set
337CONFIG_INET=y
338CONFIG_IP_MULTICAST=y
339# CONFIG_IP_ADVANCED_ROUTER is not set
340CONFIG_IP_PNP=y
341# CONFIG_IP_PNP_DHCP is not set
342CONFIG_IP_PNP_BOOTP=y
343# CONFIG_IP_PNP_RARP is not set
344# CONFIG_NET_IPIP is not set
345# CONFIG_NET_IPGRE is not set
346# CONFIG_IP_MROUTE is not set
347# CONFIG_ARPD is not set
348CONFIG_SYN_COOKIES=y
349# CONFIG_INET_AH is not set
350# CONFIG_INET_ESP is not set
351# CONFIG_INET_IPCOMP is not set
352# CONFIG_IPV6 is not set
353# CONFIG_NETFILTER is not set
354
355#
356# SCTP Configuration (EXPERIMENTAL)
357#
358# CONFIG_IP_SCTP is not set
359# CONFIG_ATM is not set
360# CONFIG_BRIDGE is not set
361# CONFIG_VLAN_8021Q is not set
362# CONFIG_DECNET is not set
363# CONFIG_LLC2 is not set
364# CONFIG_IPX is not set
365# CONFIG_ATALK is not set
366# CONFIG_X25 is not set
367# CONFIG_LAPB is not set
368# CONFIG_NET_DIVERT is not set
369# CONFIG_ECONET is not set
370# CONFIG_WAN_ROUTER is not set
371# CONFIG_NET_HW_FLOWCONTROL is not set
372
373#
374# QoS and/or fair queueing
375#
376# CONFIG_NET_SCHED is not set
377
378#
379# Network testing
380#
381# CONFIG_NET_PKTGEN is not set
382# CONFIG_NETPOLL is not set
383# CONFIG_NET_POLL_CONTROLLER is not set
384# CONFIG_HAMRADIO is not set
385# CONFIG_IRDA is not set
386# CONFIG_BT is not set
387CONFIG_NETDEVICES=y
388CONFIG_DUMMY=m
389# CONFIG_BONDING is not set
390# CONFIG_EQUALIZER is not set
391# CONFIG_TUN is not set
392
393#
394# ARCnet devices
395#
396# CONFIG_ARCNET is not set
397
398#
399# Ethernet (10 or 100Mbit)
400#
401CONFIG_NET_ETHERNET=y
402CONFIG_MII=y
403# CONFIG_OAKNET is not set
404# CONFIG_HAPPYMEAL is not set
405# CONFIG_SUNGEM is not set
406# CONFIG_NET_VENDOR_3COM is not set
407
408#
409# Tulip family network device support
410#
411# CONFIG_NET_TULIP is not set
412# CONFIG_HP100 is not set
413CONFIG_NET_PCI=y
414# CONFIG_PCNET32 is not set
415# CONFIG_AMD8111_ETH is not set
416# CONFIG_ADAPTEC_STARFIRE is not set
417# CONFIG_B44 is not set
418# CONFIG_FORCEDETH is not set
419# CONFIG_DGRS is not set
420# CONFIG_EEPRO100 is not set
421CONFIG_E100=y
422# CONFIG_E100_NAPI is not set
423# CONFIG_FEALNX is not set
424# CONFIG_NATSEMI is not set
425# CONFIG_NE2K_PCI is not set
426# CONFIG_8139CP is not set
427# CONFIG_8139TOO is not set
428# CONFIG_SIS900 is not set
429# CONFIG_EPIC100 is not set
430# CONFIG_SUNDANCE is not set
431# CONFIG_TLAN is not set
432# CONFIG_VIA_RHINE is not set
433
434#
435# Ethernet (1000 Mbit)
436#
437# CONFIG_ACENIC is not set
438# CONFIG_DL2K is not set
439# CONFIG_E1000 is not set
440# CONFIG_NS83820 is not set
441# CONFIG_HAMACHI is not set
442# CONFIG_YELLOWFIN is not set
443# CONFIG_R8169 is not set
444# CONFIG_SK98LIN is not set
445# CONFIG_TIGON3 is not set
446
447#
448# Ethernet (10000 Mbit)
449#
450# CONFIG_IXGB is not set
451# CONFIG_S2IO is not set
452
453#
454# Token Ring devices
455#
456# CONFIG_TR is not set
457
458#
459# Wireless LAN (non-hamradio)
460#
461# CONFIG_NET_RADIO is not set
462
463#
464# Wan interfaces
465#
466# CONFIG_WAN is not set
467# CONFIG_FDDI is not set
468# CONFIG_HIPPI is not set
469# CONFIG_PPP is not set
470# CONFIG_SLIP is not set
471# CONFIG_NET_FC is not set
472# CONFIG_RCPCI is not set
473# CONFIG_SHAPER is not set
474# CONFIG_NETCONSOLE is not set
475
476#
477# ISDN subsystem
478#
479# CONFIG_ISDN is not set
480
481#
482# Telephony Support
483#
484# CONFIG_PHONE is not set
485
486#
487# Input device support
488#
489# CONFIG_INPUT is not set
490
491#
492# Userland interfaces
493#
494
495#
496# Input I/O drivers
497#
498# CONFIG_GAMEPORT is not set
499CONFIG_SOUND_GAMEPORT=y
500# CONFIG_SERIO is not set
501# CONFIG_SERIO_I8042 is not set
502
503#
504# Input Device Drivers
505#
506
507#
508# Character devices
509#
510# CONFIG_VT is not set
511# CONFIG_SERIAL_NONSTANDARD is not set
512
513#
514# Serial drivers
515#
516CONFIG_SERIAL_8250=y
517CONFIG_SERIAL_8250_CONSOLE=y
518CONFIG_SERIAL_8250_NR_UARTS=1
519# CONFIG_SERIAL_8250_EXTENDED is not set
520
521#
522# Non-8250 serial port support
523#
524CONFIG_SERIAL_CORE=y
525CONFIG_SERIAL_CORE_CONSOLE=y
526CONFIG_UNIX98_PTYS=y
527CONFIG_LEGACY_PTYS=y
528CONFIG_LEGACY_PTY_COUNT=256
529# CONFIG_QIC02_TAPE is not set
530
531#
532# IPMI
533#
534# CONFIG_IPMI_HANDLER is not set
535
536#
537# Watchdog Cards
538#
539# CONFIG_WATCHDOG is not set
540# CONFIG_NVRAM is not set
541CONFIG_GEN_RTC=y
542# CONFIG_GEN_RTC_X is not set
543# CONFIG_DTLK is not set
544# CONFIG_R3964 is not set
545# CONFIG_APPLICOM is not set
546
547#
548# Ftape, the floppy tape device driver
549#
550# CONFIG_FTAPE is not set
551# CONFIG_AGP is not set
552# CONFIG_DRM is not set
553# CONFIG_RAW_DRIVER is not set
554
555#
556# I2C support
557#
558# CONFIG_I2C is not set
559
560#
561# Misc devices
562#
563
564#
565# Multimedia devices
566#
567# CONFIG_VIDEO_DEV is not set
568
569#
570# Digital Video Broadcasting Devices
571#
572# CONFIG_DVB is not set
573
574#
575# Graphics support
576#
577# CONFIG_FB is not set
578
579#
580# Sound
581#
582# CONFIG_SOUND is not set
583
584#
585# USB support
586#
587CONFIG_USB=m
588# CONFIG_USB_DEBUG is not set
589
590#
591# Miscellaneous USB options
592#
593CONFIG_USB_DEVICEFS=y
594# CONFIG_USB_BANDWIDTH is not set
595# CONFIG_USB_DYNAMIC_MINORS is not set
596
597#
598# USB Host Controller Drivers
599#
600# CONFIG_USB_EHCI_HCD is not set
601CONFIG_USB_OHCI_HCD=m
602# CONFIG_USB_UHCI_HCD is not set
603
604#
605# USB Device Class drivers
606#
607# CONFIG_USB_BLUETOOTH_TTY is not set
608CONFIG_USB_ACM=m
609# CONFIG_USB_PRINTER is not set
610# CONFIG_USB_STORAGE is not set
611
612#
613# USB Human Interface Devices (HID)
614#
615CONFIG_USB_HID=m
616
617#
618# Input core support is needed for USB HID input layer or HIDBP support
619#
620# CONFIG_USB_HIDDEV is not set
621
622#
623# USB HID Boot Protocol drivers
624#
625
626#
627# USB Imaging devices
628#
629# CONFIG_USB_MDC800 is not set
630# CONFIG_USB_MICROTEK is not set
631# CONFIG_USB_HPUSBSCSI is not set
632
633#
634# USB Multimedia devices
635#
636# CONFIG_USB_DABUSB is not set
637
638#
639# Video4Linux support is needed for USB Multimedia device support
640#
641
642#
643# USB Network adaptors
644#
645# CONFIG_USB_CATC is not set
646# CONFIG_USB_KAWETH is not set
647# CONFIG_USB_PEGASUS is not set
648# CONFIG_USB_RTL8150 is not set
649# CONFIG_USB_USBNET is not set
650
651#
652# USB port drivers
653#
654
655#
656# USB Serial Converter support
657#
658CONFIG_USB_SERIAL=m
659# CONFIG_USB_SERIAL_GENERIC is not set
660# CONFIG_USB_SERIAL_BELKIN is not set
661# CONFIG_USB_SERIAL_WHITEHEAT is not set
662# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set
663# CONFIG_USB_SERIAL_EMPEG is not set
664# CONFIG_USB_SERIAL_FTDI_SIO is not set
665CONFIG_USB_SERIAL_VISOR=m
666# CONFIG_USB_SERIAL_IPAQ is not set
667# CONFIG_USB_SERIAL_IR is not set
668# CONFIG_USB_SERIAL_EDGEPORT is not set
669# CONFIG_USB_SERIAL_EDGEPORT_TI is not set
670# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set
671# CONFIG_USB_SERIAL_KEYSPAN is not set
672# CONFIG_USB_SERIAL_KLSI is not set
673# CONFIG_USB_SERIAL_KOBIL_SCT is not set
674# CONFIG_USB_SERIAL_MCT_U232 is not set
675# CONFIG_USB_SERIAL_PL2303 is not set
676# CONFIG_USB_SERIAL_SAFE is not set
677# CONFIG_USB_SERIAL_CYBERJACK is not set
678# CONFIG_USB_SERIAL_XIRCOM is not set
679# CONFIG_USB_SERIAL_OMNINET is not set
680
681#
682# USB Miscellaneous drivers
683#
684# CONFIG_USB_EMI62 is not set
685# CONFIG_USB_EMI26 is not set
686# CONFIG_USB_TIGL is not set
687# CONFIG_USB_AUERSWALD is not set
688# CONFIG_USB_RIO500 is not set
689# CONFIG_USB_LEGOTOWER is not set
690# CONFIG_USB_LCD is not set
691# CONFIG_USB_LED is not set
692# CONFIG_USB_CYTHERM is not set
693# CONFIG_USB_PHIDGETSERVO is not set
694# CONFIG_USB_TEST is not set
695
696#
697# USB Gadget Support
698#
699# CONFIG_USB_GADGET is not set
700
701#
702# File systems
703#
704CONFIG_EXT2_FS=y
705# CONFIG_EXT2_FS_XATTR is not set
706CONFIG_EXT3_FS=y
707CONFIG_EXT3_FS_XATTR=y
708# CONFIG_EXT3_FS_POSIX_ACL is not set
709# CONFIG_EXT3_FS_SECURITY is not set
710CONFIG_JBD=y
711# CONFIG_JBD_DEBUG is not set
712CONFIG_FS_MBCACHE=y
713# CONFIG_REISERFS_FS is not set
714# CONFIG_JFS_FS is not set
715# CONFIG_XFS_FS is not set
716# CONFIG_MINIX_FS is not set
717# CONFIG_ROMFS_FS is not set
718# CONFIG_QUOTA is not set
719# CONFIG_AUTOFS_FS is not set
720# CONFIG_AUTOFS4_FS is not set
721
722#
723# CD-ROM/DVD Filesystems
724#
725# CONFIG_ISO9660_FS is not set
726# CONFIG_UDF_FS is not set
727
728#
729# DOS/FAT/NT Filesystems
730#
731# CONFIG_FAT_FS is not set
732# CONFIG_NTFS_FS is not set
733
734#
735# Pseudo filesystems
736#
737CONFIG_PROC_FS=y
738CONFIG_PROC_KCORE=y
739CONFIG_SYSFS=y
740# CONFIG_DEVFS_FS is not set
741# CONFIG_DEVPTS_FS_XATTR is not set
742CONFIG_TMPFS=y
743# CONFIG_HUGETLB_PAGE is not set
744CONFIG_RAMFS=y
745
746#
747# Miscellaneous filesystems
748#
749# CONFIG_ADFS_FS is not set
750# CONFIG_AFFS_FS is not set
751# CONFIG_HFS_FS is not set
752# CONFIG_HFSPLUS_FS is not set
753# CONFIG_BEFS_FS is not set
754# CONFIG_BFS_FS is not set
755# CONFIG_EFS_FS is not set
756# CONFIG_CRAMFS is not set
757# CONFIG_VXFS_FS is not set
758# CONFIG_HPFS_FS is not set
759# CONFIG_QNX4FS_FS is not set
760# CONFIG_SYSV_FS is not set
761# CONFIG_UFS_FS is not set
762
763#
764# Network File Systems
765#
766CONFIG_NFS_FS=y
767CONFIG_NFS_V3=y
768# CONFIG_NFS_V4 is not set
769# CONFIG_NFS_DIRECTIO is not set
770# CONFIG_NFSD is not set
771CONFIG_ROOT_NFS=y
772CONFIG_LOCKD=y
773CONFIG_LOCKD_V4=y
774# CONFIG_EXPORTFS is not set
775CONFIG_SUNRPC=y
776# CONFIG_RPCSEC_GSS_KRB5 is not set
777# CONFIG_SMB_FS is not set
778# CONFIG_CIFS is not set
779# CONFIG_NCP_FS is not set
780# CONFIG_CODA_FS is not set
781# CONFIG_AFS_FS is not set
782
783#
784# Partition Types
785#
786# CONFIG_PARTITION_ADVANCED is not set
787CONFIG_MSDOS_PARTITION=y
788
789#
790# Native Language Support
791#
792# CONFIG_NLS is not set
793
794#
795# Library routines
796#
797# CONFIG_CRC32 is not set
798# CONFIG_LIBCRC32C is not set
799
800#
801# Kernel hacking
802#
803# CONFIG_DEBUG_KERNEL is not set
804# CONFIG_SERIAL_TEXT_DEBUG is not set
805
806#
807# Security options
808#
809# CONFIG_SECURITY is not set
810
811#
812# Cryptographic options
813#
814# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/luan_defconfig b/arch/ppc/configs/luan_defconfig
new file mode 100644
index 000000000000..71d7bf192e0e
--- /dev/null
+++ b/arch/ppc/configs/luan_defconfig
@@ -0,0 +1,668 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc2
4# Mon Jan 31 16:26:31 2005
5#
6CONFIG_MMU=y
7CONFIG_GENERIC_HARDIRQS=y
8CONFIG_RWSEM_XCHGADD_ALGORITHM=y
9CONFIG_GENERIC_CALIBRATE_DELAY=y
10CONFIG_HAVE_DEC_LOCK=y
11CONFIG_PPC=y
12CONFIG_PPC32=y
13CONFIG_GENERIC_NVRAM=y
14
15#
16# Code maturity level options
17#
18CONFIG_EXPERIMENTAL=y
19CONFIG_CLEAN_COMPILE=y
20CONFIG_BROKEN_ON_SMP=y
21
22#
23# General setup
24#
25CONFIG_LOCALVERSION=""
26CONFIG_SWAP=y
27CONFIG_SYSVIPC=y
28# CONFIG_POSIX_MQUEUE is not set
29# CONFIG_BSD_PROCESS_ACCT is not set
30CONFIG_SYSCTL=y
31# CONFIG_AUDIT is not set
32CONFIG_LOG_BUF_SHIFT=14
33# CONFIG_HOTPLUG is not set
34CONFIG_KOBJECT_UEVENT=y
35# CONFIG_IKCONFIG is not set
36CONFIG_EMBEDDED=y
37CONFIG_KALLSYMS=y
38# CONFIG_KALLSYMS_ALL is not set
39# CONFIG_KALLSYMS_EXTRA_PASS is not set
40CONFIG_FUTEX=y
41CONFIG_EPOLL=y
42# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
43CONFIG_SHMEM=y
44CONFIG_CC_ALIGN_FUNCTIONS=0
45CONFIG_CC_ALIGN_LABELS=0
46CONFIG_CC_ALIGN_LOOPS=0
47CONFIG_CC_ALIGN_JUMPS=0
48# CONFIG_TINY_SHMEM is not set
49
50#
51# Loadable module support
52#
53CONFIG_MODULES=y
54CONFIG_MODULE_UNLOAD=y
55# CONFIG_MODULE_FORCE_UNLOAD is not set
56CONFIG_OBSOLETE_MODPARM=y
57# CONFIG_MODVERSIONS is not set
58# CONFIG_MODULE_SRCVERSION_ALL is not set
59CONFIG_KMOD=y
60
61#
62# Processor
63#
64# CONFIG_6xx is not set
65# CONFIG_40x is not set
66CONFIG_44x=y
67# CONFIG_POWER3 is not set
68# CONFIG_POWER4 is not set
69# CONFIG_8xx is not set
70# CONFIG_E500 is not set
71CONFIG_BOOKE=y
72CONFIG_PTE_64BIT=y
73CONFIG_PHYS_64BIT=y
74# CONFIG_MATH_EMULATION is not set
75# CONFIG_CPU_FREQ is not set
76CONFIG_4xx=y
77
78#
79# IBM 4xx options
80#
81# CONFIG_EBONY is not set
82CONFIG_LUAN=y
83# CONFIG_OCOTEA is not set
84CONFIG_440SP=y
85CONFIG_440=y
86CONFIG_IBM_OCP=y
87CONFIG_IBM_EMAC4=y
88# CONFIG_PPC4xx_DMA is not set
89CONFIG_PPC_GEN550=y
90# CONFIG_PM is not set
91CONFIG_NOT_COHERENT_CACHE=y
92
93#
94# Platform options
95#
96# CONFIG_PC_KEYBOARD is not set
97# CONFIG_SMP is not set
98# CONFIG_PREEMPT is not set
99# CONFIG_HIGHMEM is not set
100CONFIG_BINFMT_ELF=y
101# CONFIG_BINFMT_MISC is not set
102CONFIG_CMDLINE_BOOL=y
103CONFIG_CMDLINE="ip=on console=ttyS0,115200"
104
105#
106# Bus options
107#
108CONFIG_PCI=y
109CONFIG_PCI_DOMAINS=y
110# CONFIG_PCI_LEGACY_PROC is not set
111# CONFIG_PCI_NAMES is not set
112
113#
114# PCCARD (PCMCIA/CardBus) support
115#
116# CONFIG_PCCARD is not set
117
118#
119# PC-card bridges
120#
121
122#
123# Advanced setup
124#
125# CONFIG_ADVANCED_OPTIONS is not set
126
127#
128# Default settings for advanced configuration options are used
129#
130CONFIG_HIGHMEM_START=0xfe000000
131CONFIG_LOWMEM_SIZE=0x30000000
132CONFIG_KERNEL_START=0xc0000000
133CONFIG_TASK_SIZE=0x80000000
134CONFIG_CONSISTENT_START=0xff100000
135CONFIG_CONSISTENT_SIZE=0x00200000
136CONFIG_BOOT_LOAD=0x01000000
137
138#
139# Device Drivers
140#
141
142#
143# Generic Driver Options
144#
145# CONFIG_STANDALONE is not set
146CONFIG_PREVENT_FIRMWARE_BUILD=y
147# CONFIG_FW_LOADER is not set
148# CONFIG_DEBUG_DRIVER is not set
149
150#
151# Memory Technology Devices (MTD)
152#
153# CONFIG_MTD is not set
154
155#
156# Parallel port support
157#
158# CONFIG_PARPORT is not set
159
160#
161# Plug and Play support
162#
163
164#
165# Block devices
166#
167# CONFIG_BLK_DEV_FD is not set
168# CONFIG_BLK_CPQ_DA is not set
169# CONFIG_BLK_CPQ_CISS_DA is not set
170# CONFIG_BLK_DEV_DAC960 is not set
171# CONFIG_BLK_DEV_UMEM is not set
172# CONFIG_BLK_DEV_COW_COMMON is not set
173# CONFIG_BLK_DEV_LOOP is not set
174# CONFIG_BLK_DEV_NBD is not set
175# CONFIG_BLK_DEV_SX8 is not set
176# CONFIG_BLK_DEV_RAM is not set
177CONFIG_BLK_DEV_RAM_COUNT=16
178CONFIG_INITRAMFS_SOURCE=""
179# CONFIG_LBD is not set
180# CONFIG_CDROM_PKTCDVD is not set
181
182#
183# IO Schedulers
184#
185CONFIG_IOSCHED_NOOP=y
186CONFIG_IOSCHED_AS=y
187CONFIG_IOSCHED_DEADLINE=y
188CONFIG_IOSCHED_CFQ=y
189# CONFIG_ATA_OVER_ETH is not set
190
191#
192# ATA/ATAPI/MFM/RLL support
193#
194# CONFIG_IDE is not set
195
196#
197# SCSI device support
198#
199# CONFIG_SCSI is not set
200
201#
202# Multi-device support (RAID and LVM)
203#
204# CONFIG_MD is not set
205
206#
207# Fusion MPT device support
208#
209
210#
211# IEEE 1394 (FireWire) support
212#
213# CONFIG_IEEE1394 is not set
214
215#
216# I2O device support
217#
218# CONFIG_I2O is not set
219
220#
221# Macintosh device drivers
222#
223
224#
225# Networking support
226#
227CONFIG_NET=y
228
229#
230# Networking options
231#
232CONFIG_PACKET=y
233# CONFIG_PACKET_MMAP is not set
234# CONFIG_NETLINK_DEV is not set
235CONFIG_UNIX=y
236# CONFIG_NET_KEY is not set
237CONFIG_INET=y
238# CONFIG_IP_MULTICAST is not set
239# CONFIG_IP_ADVANCED_ROUTER is not set
240CONFIG_IP_PNP=y
241# CONFIG_IP_PNP_DHCP is not set
242CONFIG_IP_PNP_BOOTP=y
243# CONFIG_IP_PNP_RARP is not set
244# CONFIG_NET_IPIP is not set
245# CONFIG_NET_IPGRE is not set
246# CONFIG_ARPD is not set
247# CONFIG_SYN_COOKIES is not set
248# CONFIG_INET_AH is not set
249# CONFIG_INET_ESP is not set
250# CONFIG_INET_IPCOMP is not set
251# CONFIG_INET_TUNNEL is not set
252CONFIG_IP_TCPDIAG=y
253# CONFIG_IP_TCPDIAG_IPV6 is not set
254
255#
256# IP: Virtual Server Configuration
257#
258# CONFIG_IP_VS is not set
259# CONFIG_IPV6 is not set
260CONFIG_NETFILTER=y
261# CONFIG_NETFILTER_DEBUG is not set
262
263#
264# IP: Netfilter Configuration
265#
266# CONFIG_IP_NF_CONNTRACK is not set
267# CONFIG_IP_NF_CONNTRACK_MARK is not set
268# CONFIG_IP_NF_QUEUE is not set
269# CONFIG_IP_NF_IPTABLES is not set
270# CONFIG_IP_NF_ARPTABLES is not set
271
272#
273# SCTP Configuration (EXPERIMENTAL)
274#
275# CONFIG_IP_SCTP is not set
276# CONFIG_ATM is not set
277# CONFIG_BRIDGE is not set
278# CONFIG_VLAN_8021Q is not set
279# CONFIG_DECNET is not set
280# CONFIG_LLC2 is not set
281# CONFIG_IPX is not set
282# CONFIG_ATALK is not set
283# CONFIG_X25 is not set
284# CONFIG_LAPB is not set
285# CONFIG_NET_DIVERT is not set
286# CONFIG_ECONET is not set
287# CONFIG_WAN_ROUTER is not set
288
289#
290# QoS and/or fair queueing
291#
292# CONFIG_NET_SCHED is not set
293# CONFIG_NET_CLS_ROUTE is not set
294
295#
296# Network testing
297#
298# CONFIG_NET_PKTGEN is not set
299# CONFIG_NETPOLL is not set
300# CONFIG_NET_POLL_CONTROLLER is not set
301# CONFIG_HAMRADIO is not set
302# CONFIG_IRDA is not set
303# CONFIG_BT is not set
304CONFIG_NETDEVICES=y
305# CONFIG_DUMMY is not set
306# CONFIG_BONDING is not set
307# CONFIG_EQUALIZER is not set
308# CONFIG_TUN is not set
309
310#
311# ARCnet devices
312#
313# CONFIG_ARCNET is not set
314
315#
316# Ethernet (10 or 100Mbit)
317#
318CONFIG_NET_ETHERNET=y
319# CONFIG_MII is not set
320# CONFIG_HAPPYMEAL is not set
321# CONFIG_SUNGEM is not set
322# CONFIG_NET_VENDOR_3COM is not set
323
324#
325# Tulip family network device support
326#
327# CONFIG_NET_TULIP is not set
328# CONFIG_HP100 is not set
329CONFIG_IBM_EMAC=y
330# CONFIG_IBM_EMAC_ERRMSG is not set
331CONFIG_IBM_EMAC_RXB=128
332CONFIG_IBM_EMAC_TXB=128
333CONFIG_IBM_EMAC_FGAP=8
334CONFIG_IBM_EMAC_SKBRES=0
335# CONFIG_NET_PCI is not set
336
337#
338# Ethernet (1000 Mbit)
339#
340# CONFIG_ACENIC is not set
341# CONFIG_DL2K is not set
342# CONFIG_E1000 is not set
343# CONFIG_NS83820 is not set
344# CONFIG_HAMACHI is not set
345# CONFIG_YELLOWFIN is not set
346# CONFIG_R8169 is not set
347# CONFIG_SK98LIN is not set
348# CONFIG_TIGON3 is not set
349
350#
351# Ethernet (10000 Mbit)
352#
353# CONFIG_IXGB is not set
354# CONFIG_S2IO is not set
355
356#
357# Token Ring devices
358#
359# CONFIG_TR is not set
360
361#
362# Wireless LAN (non-hamradio)
363#
364# CONFIG_NET_RADIO is not set
365
366#
367# Wan interfaces
368#
369# CONFIG_WAN is not set
370# CONFIG_FDDI is not set
371# CONFIG_HIPPI is not set
372# CONFIG_PPP is not set
373# CONFIG_SLIP is not set
374# CONFIG_SHAPER is not set
375# CONFIG_NETCONSOLE is not set
376
377#
378# ISDN subsystem
379#
380# CONFIG_ISDN is not set
381
382#
383# Telephony Support
384#
385# CONFIG_PHONE is not set
386
387#
388# Input device support
389#
390CONFIG_INPUT=y
391
392#
393# Userland interfaces
394#
395CONFIG_INPUT_MOUSEDEV=y
396CONFIG_INPUT_MOUSEDEV_PSAUX=y
397CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
398CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
399# CONFIG_INPUT_JOYDEV is not set
400# CONFIG_INPUT_TSDEV is not set
401# CONFIG_INPUT_EVDEV is not set
402# CONFIG_INPUT_EVBUG is not set
403
404#
405# Input I/O drivers
406#
407# CONFIG_GAMEPORT is not set
408CONFIG_SOUND_GAMEPORT=y
409CONFIG_SERIO=y
410# CONFIG_SERIO_I8042 is not set
411# CONFIG_SERIO_SERPORT is not set
412# CONFIG_SERIO_CT82C710 is not set
413# CONFIG_SERIO_PCIPS2 is not set
414# CONFIG_SERIO_LIBPS2 is not set
415# CONFIG_SERIO_RAW is not set
416
417#
418# Input Device Drivers
419#
420# CONFIG_INPUT_KEYBOARD is not set
421# CONFIG_INPUT_MOUSE is not set
422# CONFIG_INPUT_JOYSTICK is not set
423# CONFIG_INPUT_TOUCHSCREEN is not set
424# CONFIG_INPUT_MISC is not set
425
426#
427# Character devices
428#
429# CONFIG_VT is not set
430# CONFIG_SERIAL_NONSTANDARD is not set
431
432#
433# Serial drivers
434#
435CONFIG_SERIAL_8250=y
436CONFIG_SERIAL_8250_CONSOLE=y
437CONFIG_SERIAL_8250_NR_UARTS=4
438CONFIG_SERIAL_8250_EXTENDED=y
439# CONFIG_SERIAL_8250_MANY_PORTS is not set
440CONFIG_SERIAL_8250_SHARE_IRQ=y
441# CONFIG_SERIAL_8250_DETECT_IRQ is not set
442# CONFIG_SERIAL_8250_MULTIPORT is not set
443# CONFIG_SERIAL_8250_RSA is not set
444
445#
446# Non-8250 serial port support
447#
448CONFIG_SERIAL_CORE=y
449CONFIG_SERIAL_CORE_CONSOLE=y
450CONFIG_UNIX98_PTYS=y
451CONFIG_LEGACY_PTYS=y
452CONFIG_LEGACY_PTY_COUNT=256
453
454#
455# IPMI
456#
457# CONFIG_IPMI_HANDLER is not set
458
459#
460# Watchdog Cards
461#
462# CONFIG_WATCHDOG is not set
463# CONFIG_NVRAM is not set
464# CONFIG_GEN_RTC is not set
465# CONFIG_DTLK is not set
466# CONFIG_R3964 is not set
467# CONFIG_APPLICOM is not set
468
469#
470# Ftape, the floppy tape device driver
471#
472# CONFIG_AGP is not set
473# CONFIG_DRM is not set
474# CONFIG_RAW_DRIVER is not set
475
476#
477# I2C support
478#
479# CONFIG_I2C is not set
480
481#
482# Dallas's 1-wire bus
483#
484# CONFIG_W1 is not set
485
486#
487# Misc devices
488#
489
490#
491# Multimedia devices
492#
493# CONFIG_VIDEO_DEV is not set
494
495#
496# Digital Video Broadcasting Devices
497#
498# CONFIG_DVB is not set
499
500#
501# Graphics support
502#
503# CONFIG_FB is not set
504
505#
506# Sound
507#
508# CONFIG_SOUND is not set
509
510#
511# USB support
512#
513# CONFIG_USB is not set
514CONFIG_USB_ARCH_HAS_HCD=y
515CONFIG_USB_ARCH_HAS_OHCI=y
516
517#
518# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
519#
520
521#
522# USB Gadget Support
523#
524# CONFIG_USB_GADGET is not set
525
526#
527# MMC/SD Card support
528#
529# CONFIG_MMC is not set
530
531#
532# InfiniBand support
533#
534# CONFIG_INFINIBAND is not set
535
536#
537# File systems
538#
539# CONFIG_EXT2_FS is not set
540# CONFIG_EXT3_FS is not set
541# CONFIG_JBD is not set
542# CONFIG_REISERFS_FS is not set
543# CONFIG_JFS_FS is not set
544# CONFIG_XFS_FS is not set
545# CONFIG_MINIX_FS is not set
546# CONFIG_ROMFS_FS is not set
547# CONFIG_QUOTA is not set
548CONFIG_DNOTIFY=y
549# CONFIG_AUTOFS_FS is not set
550# CONFIG_AUTOFS4_FS is not set
551
552#
553# CD-ROM/DVD Filesystems
554#
555# CONFIG_ISO9660_FS is not set
556# CONFIG_UDF_FS is not set
557
558#
559# DOS/FAT/NT Filesystems
560#
561# CONFIG_MSDOS_FS is not set
562# CONFIG_VFAT_FS is not set
563# CONFIG_NTFS_FS is not set
564
565#
566# Pseudo filesystems
567#
568CONFIG_PROC_FS=y
569CONFIG_PROC_KCORE=y
570CONFIG_SYSFS=y
571# CONFIG_DEVFS_FS is not set
572# CONFIG_DEVPTS_FS_XATTR is not set
573# CONFIG_TMPFS is not set
574# CONFIG_HUGETLB_PAGE is not set
575CONFIG_RAMFS=y
576
577#
578# Miscellaneous filesystems
579#
580# CONFIG_ADFS_FS is not set
581# CONFIG_AFFS_FS is not set
582# CONFIG_HFS_FS is not set
583# CONFIG_HFSPLUS_FS is not set
584# CONFIG_BEFS_FS is not set
585# CONFIG_BFS_FS is not set
586# CONFIG_EFS_FS is not set
587# CONFIG_CRAMFS is not set
588# CONFIG_VXFS_FS is not set
589# CONFIG_HPFS_FS is not set
590# CONFIG_QNX4FS_FS is not set
591# CONFIG_SYSV_FS is not set
592# CONFIG_UFS_FS is not set
593
594#
595# Network File Systems
596#
597CONFIG_NFS_FS=y
598# CONFIG_NFS_V3 is not set
599# CONFIG_NFS_V4 is not set
600# CONFIG_NFS_DIRECTIO is not set
601# CONFIG_NFSD is not set
602CONFIG_ROOT_NFS=y
603CONFIG_LOCKD=y
604# CONFIG_EXPORTFS is not set
605CONFIG_SUNRPC=y
606# CONFIG_RPCSEC_GSS_KRB5 is not set
607# CONFIG_RPCSEC_GSS_SPKM3 is not set
608# CONFIG_SMB_FS is not set
609# CONFIG_CIFS is not set
610# CONFIG_NCP_FS is not set
611# CONFIG_CODA_FS is not set
612# CONFIG_AFS_FS is not set
613
614#
615# Partition Types
616#
617# CONFIG_PARTITION_ADVANCED is not set
618CONFIG_MSDOS_PARTITION=y
619
620#
621# Native Language Support
622#
623# CONFIG_NLS is not set
624
625#
626# Library routines
627#
628# CONFIG_CRC_CCITT is not set
629CONFIG_CRC32=y
630# CONFIG_LIBCRC32C is not set
631
632#
633# Profiling support
634#
635# CONFIG_PROFILING is not set
636
637#
638# Kernel hacking
639#
640CONFIG_DEBUG_KERNEL=y
641# CONFIG_MAGIC_SYSRQ is not set
642# CONFIG_SCHEDSTATS is not set
643# CONFIG_DEBUG_SLAB is not set
644# CONFIG_DEBUG_SPINLOCK is not set
645# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
646# CONFIG_DEBUG_KOBJECT is not set
647CONFIG_DEBUG_INFO=y
648# CONFIG_DEBUG_FS is not set
649# CONFIG_KGDB is not set
650# CONFIG_XMON is not set
651CONFIG_BDI_SWITCH=y
652# CONFIG_SERIAL_TEXT_DEBUG is not set
653CONFIG_PPC_OCP=y
654
655#
656# Security options
657#
658# CONFIG_KEYS is not set
659# CONFIG_SECURITY is not set
660
661#
662# Cryptographic options
663#
664# CONFIG_CRYPTO is not set
665
666#
667# Hardware crypto devices
668#
diff --git a/arch/ppc/configs/mbx_defconfig b/arch/ppc/configs/mbx_defconfig
new file mode 100644
index 000000000000..52c3799e67ba
--- /dev/null
+++ b/arch/ppc/configs/mbx_defconfig
@@ -0,0 +1,512 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7
8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12
13#
14# General setup
15#
16CONFIG_SWAP=y
17CONFIG_SYSVIPC=y
18# CONFIG_BSD_PROCESS_ACCT is not set
19# CONFIG_SYSCTL is not set
20CONFIG_LOG_BUF_SHIFT=14
21CONFIG_EMBEDDED=y
22CONFIG_FUTEX=y
23# CONFIG_EPOLL is not set
24
25#
26# Loadable module support
27#
28# CONFIG_MODULES is not set
29
30#
31# Platform support
32#
33CONFIG_PPC=y
34CONFIG_PPC32=y
35# CONFIG_6xx is not set
36# CONFIG_40x is not set
37# CONFIG_POWER3 is not set
38CONFIG_8xx=y
39
40#
41# IBM 4xx options
42#
43CONFIG_EMBEDDEDBOOT=y
44CONFIG_SERIAL_CONSOLE=y
45CONFIG_NOT_COHERENT_CACHE=y
46# CONFIG_RPXLITE is not set
47# CONFIG_RPXCLASSIC is not set
48# CONFIG_BSEIP is not set
49# CONFIG_FADS is not set
50# CONFIG_TQM823L is not set
51# CONFIG_TQM850L is not set
52# CONFIG_TQM855L is not set
53# CONFIG_TQM860L is not set
54# CONFIG_FPS850L is not set
55# CONFIG_SPD823TS is not set
56# CONFIG_IVMS8 is not set
57# CONFIG_IVML24 is not set
58# CONFIG_SM850 is not set
59# CONFIG_HERMES_PRO is not set
60# CONFIG_IP860 is not set
61# CONFIG_LWMON is not set
62# CONFIG_PCU_E is not set
63# CONFIG_CCM is not set
64# CONFIG_LANTEC is not set
65CONFIG_MBX=y
66# CONFIG_WINCEPT is not set
67# CONFIG_SMP is not set
68# CONFIG_PREEMPT is not set
69CONFIG_MATH_EMULATION=y
70# CONFIG_CPU_FREQ is not set
71
72#
73# General setup
74#
75# CONFIG_HIGHMEM is not set
76# CONFIG_PCI is not set
77# CONFIG_PCI_DOMAINS is not set
78# CONFIG_PCI_QSPAN is not set
79CONFIG_KCORE_ELF=y
80CONFIG_BINFMT_ELF=y
81CONFIG_KERNEL_ELF=y
82# CONFIG_BINFMT_MISC is not set
83# CONFIG_HOTPLUG is not set
84
85#
86# Parallel port support
87#
88# CONFIG_PARPORT is not set
89# CONFIG_CMDLINE_BOOL is not set
90
91#
92# Advanced setup
93#
94# CONFIG_ADVANCED_OPTIONS is not set
95
96#
97# Default settings for advanced configuration options are used
98#
99CONFIG_HIGHMEM_START=0xfe000000
100CONFIG_LOWMEM_SIZE=0x30000000
101CONFIG_KERNEL_START=0xc0000000
102CONFIG_TASK_SIZE=0x80000000
103CONFIG_BOOT_LOAD=0x00400000
104
105#
106# Memory Technology Devices (MTD)
107#
108# CONFIG_MTD is not set
109
110#
111# Plug and Play support
112#
113# CONFIG_PNP is not set
114
115#
116# Block devices
117#
118# CONFIG_BLK_DEV_FD is not set
119# CONFIG_BLK_DEV_LOOP is not set
120# CONFIG_BLK_DEV_NBD is not set
121# CONFIG_BLK_DEV_RAM is not set
122# CONFIG_BLK_DEV_INITRD is not set
123
124#
125# Multi-device support (RAID and LVM)
126#
127# CONFIG_MD is not set
128
129#
130# ATA/IDE/MFM/RLL support
131#
132# CONFIG_IDE is not set
133
134#
135# SCSI support
136#
137# CONFIG_SCSI is not set
138
139#
140# Fusion MPT device support
141#
142
143#
144# I2O device support
145#
146
147#
148# Networking support
149#
150CONFIG_NET=y
151
152#
153# Networking options
154#
155# CONFIG_PACKET is not set
156# CONFIG_NETLINK_DEV is not set
157# CONFIG_NETFILTER is not set
158CONFIG_UNIX=y
159# CONFIG_NET_KEY is not set
160CONFIG_INET=y
161# CONFIG_IP_MULTICAST is not set
162# CONFIG_IP_ADVANCED_ROUTER is not set
163CONFIG_IP_PNP=y
164CONFIG_IP_PNP_DHCP=y
165CONFIG_IP_PNP_BOOTP=y
166# CONFIG_IP_PNP_RARP is not set
167# CONFIG_NET_IPIP is not set
168# CONFIG_NET_IPGRE is not set
169# CONFIG_ARPD is not set
170# CONFIG_INET_ECN is not set
171# CONFIG_SYN_COOKIES is not set
172# CONFIG_INET_AH is not set
173# CONFIG_INET_ESP is not set
174# CONFIG_INET_IPCOMP is not set
175# CONFIG_IPV6 is not set
176# CONFIG_XFRM_USER is not set
177
178#
179# SCTP Configuration (EXPERIMENTAL)
180#
181CONFIG_IPV6_SCTP__=y
182# CONFIG_IP_SCTP is not set
183# CONFIG_ATM is not set
184# CONFIG_VLAN_8021Q is not set
185# CONFIG_LLC is not set
186# CONFIG_DECNET is not set
187# CONFIG_BRIDGE is not set
188# CONFIG_X25 is not set
189# CONFIG_LAPB is not set
190# CONFIG_NET_DIVERT is not set
191# CONFIG_ECONET is not set
192# CONFIG_WAN_ROUTER is not set
193# CONFIG_NET_HW_FLOWCONTROL is not set
194
195#
196# QoS and/or fair queueing
197#
198# CONFIG_NET_SCHED is not set
199
200#
201# Network testing
202#
203# CONFIG_NET_PKTGEN is not set
204CONFIG_NETDEVICES=y
205# CONFIG_DUMMY is not set
206# CONFIG_BONDING is not set
207# CONFIG_EQUALIZER is not set
208# CONFIG_TUN is not set
209# CONFIG_ETHERTAP is not set
210
211#
212# Ethernet (10 or 100Mbit)
213#
214CONFIG_NET_ETHERNET=y
215CONFIG_MII=y
216# CONFIG_OAKNET is not set
217
218#
219# Ethernet (1000 Mbit)
220#
221
222#
223# Ethernet (10000 Mbit)
224#
225# CONFIG_PPP is not set
226# CONFIG_SLIP is not set
227
228#
229# Wireless LAN (non-hamradio)
230#
231# CONFIG_NET_RADIO is not set
232
233#
234# Token Ring devices (depends on LLC=y)
235#
236# CONFIG_SHAPER is not set
237
238#
239# Wan interfaces
240#
241# CONFIG_WAN is not set
242
243#
244# Amateur Radio support
245#
246# CONFIG_HAMRADIO is not set
247
248#
249# IrDA (infrared) support
250#
251# CONFIG_IRDA is not set
252
253#
254# ISDN subsystem
255#
256# CONFIG_ISDN_BOOL is not set
257
258#
259# Graphics support
260#
261# CONFIG_FB is not set
262
263#
264# Old CD-ROM drivers (not SCSI, not IDE)
265#
266# CONFIG_CD_NO_IDESCSI is not set
267
268#
269# Input device support
270#
271# CONFIG_INPUT is not set
272
273#
274# Userland interfaces
275#
276
277#
278# Input I/O drivers
279#
280# CONFIG_GAMEPORT is not set
281CONFIG_SOUND_GAMEPORT=y
282# CONFIG_SERIO is not set
283
284#
285# Input Device Drivers
286#
287
288#
289# Macintosh device drivers
290#
291
292#
293# Serial drivers
294#
295# CONFIG_SERIAL_8250 is not set
296
297#
298# Non-8250 serial port support
299#
300CONFIG_SERIAL_CORE=y
301CONFIG_SERIAL_CORE_CONSOLE=y
302CONFIG_SERIAL_CPM=y
303CONFIG_SERIAL_CPM_CONSOLE=y
304# CONFIG_SERIAL_CPM_SCC1 is not set
305CONFIG_SERIAL_CPM_SCC2=y
306CONFIG_SERIAL_CPM_SCC3=y
307# CONFIG_SERIAL_CPM_SCC4 is not set
308CONFIG_SERIAL_CPM_SMC1=y
309CONFIG_SERIAL_CPM_SMC2=y
310CONFIG_UNIX98_PTYS=y
311# CONFIG_LEGACY_PTYS is not set
312
313#
314# I2C support
315#
316# CONFIG_I2C is not set
317
318#
319# I2C Hardware Sensors Mainboard support
320#
321
322#
323# I2C Hardware Sensors Chip support
324#
325# CONFIG_I2C_SENSOR is not set
326
327#
328# Mice
329#
330# CONFIG_BUSMOUSE is not set
331# CONFIG_QIC02_TAPE is not set
332
333#
334# IPMI
335#
336# CONFIG_IPMI_HANDLER is not set
337
338#
339# Watchdog Cards
340#
341# CONFIG_WATCHDOG is not set
342# CONFIG_NVRAM is not set
343CONFIG_GEN_RTC=y
344# CONFIG_GEN_RTC_X is not set
345# CONFIG_DTLK is not set
346# CONFIG_R3964 is not set
347# CONFIG_APPLICOM is not set
348
349#
350# Ftape, the floppy tape device driver
351#
352# CONFIG_FTAPE is not set
353# CONFIG_AGP is not set
354# CONFIG_DRM is not set
355# CONFIG_RAW_DRIVER is not set
356# CONFIG_HANGCHECK_TIMER is not set
357
358#
359# Multimedia devices
360#
361# CONFIG_VIDEO_DEV is not set
362
363#
364# Digital Video Broadcasting Devices
365#
366# CONFIG_DVB is not set
367
368#
369# File systems
370#
371CONFIG_EXT2_FS=y
372# CONFIG_EXT2_FS_XATTR is not set
373CONFIG_EXT3_FS=y
374CONFIG_EXT3_FS_XATTR=y
375# CONFIG_EXT3_FS_POSIX_ACL is not set
376# CONFIG_EXT3_FS_SECURITY is not set
377CONFIG_JBD=y
378# CONFIG_JBD_DEBUG is not set
379CONFIG_FS_MBCACHE=y
380# CONFIG_REISERFS_FS is not set
381# CONFIG_JFS_FS is not set
382# CONFIG_XFS_FS is not set
383# CONFIG_MINIX_FS is not set
384# CONFIG_ROMFS_FS is not set
385# CONFIG_QUOTA is not set
386# CONFIG_AUTOFS_FS is not set
387# CONFIG_AUTOFS4_FS is not set
388
389#
390# CD-ROM/DVD Filesystems
391#
392# CONFIG_ISO9660_FS is not set
393# CONFIG_UDF_FS is not set
394
395#
396# DOS/FAT/NT Filesystems
397#
398# CONFIG_FAT_FS is not set
399# CONFIG_NTFS_FS is not set
400
401#
402# Pseudo filesystems
403#
404CONFIG_PROC_FS=y
405# CONFIG_DEVFS_FS is not set
406CONFIG_TMPFS=y
407CONFIG_RAMFS=y
408
409#
410# Miscellaneous filesystems
411#
412# CONFIG_ADFS_FS is not set
413# CONFIG_AFFS_FS is not set
414# CONFIG_HFS_FS is not set
415# CONFIG_BEFS_FS is not set
416# CONFIG_BFS_FS is not set
417# CONFIG_EFS_FS is not set
418# CONFIG_CRAMFS is not set
419# CONFIG_VXFS_FS is not set
420# CONFIG_HPFS_FS is not set
421# CONFIG_QNX4FS_FS is not set
422# CONFIG_SYSV_FS is not set
423# CONFIG_UFS_FS is not set
424
425#
426# Network File Systems
427#
428CONFIG_NFS_FS=y
429# CONFIG_NFS_V3 is not set
430# CONFIG_NFS_V4 is not set
431# CONFIG_NFSD is not set
432CONFIG_ROOT_NFS=y
433CONFIG_LOCKD=y
434# CONFIG_EXPORTFS is not set
435CONFIG_SUNRPC=y
436# CONFIG_SUNRPC_GSS is not set
437# CONFIG_SMB_FS is not set
438# CONFIG_CIFS is not set
439# CONFIG_NCP_FS is not set
440# CONFIG_CODA_FS is not set
441# CONFIG_INTERMEZZO_FS is not set
442# CONFIG_AFS_FS is not set
443
444#
445# Partition Types
446#
447CONFIG_PARTITION_ADVANCED=y
448# CONFIG_ACORN_PARTITION is not set
449# CONFIG_OSF_PARTITION is not set
450# CONFIG_AMIGA_PARTITION is not set
451# CONFIG_ATARI_PARTITION is not set
452# CONFIG_MAC_PARTITION is not set
453# CONFIG_MSDOS_PARTITION is not set
454# CONFIG_LDM_PARTITION is not set
455# CONFIG_NEC98_PARTITION is not set
456# CONFIG_SGI_PARTITION is not set
457# CONFIG_ULTRIX_PARTITION is not set
458# CONFIG_SUN_PARTITION is not set
459# CONFIG_EFI_PARTITION is not set
460
461#
462# Sound
463#
464# CONFIG_SOUND is not set
465
466#
467# MPC8xx CPM Options
468#
469CONFIG_SCC_ENET=y
470CONFIG_SCC1_ENET=y
471# CONFIG_SCC2_ENET is not set
472# CONFIG_SCC3_ENET is not set
473# CONFIG_FEC_ENET is not set
474CONFIG_ENET_BIG_BUFFERS=y
475
476#
477# Generic MPC8xx Options
478#
479CONFIG_8xx_COPYBACK=y
480CONFIG_8xx_CPU6=y
481# CONFIG_UCODE_PATCH is not set
482
483#
484# USB support
485#
486# CONFIG_USB_GADGET is not set
487
488#
489# Bluetooth support
490#
491# CONFIG_BT is not set
492
493#
494# Library routines
495#
496# CONFIG_CRC32 is not set
497
498#
499# Kernel hacking
500#
501# CONFIG_DEBUG_KERNEL is not set
502# CONFIG_KALLSYMS is not set
503
504#
505# Security options
506#
507# CONFIG_SECURITY is not set
508
509#
510# Cryptographic options
511#
512# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/mcpn765_defconfig b/arch/ppc/configs/mcpn765_defconfig
new file mode 100644
index 000000000000..899e89a9ea6a
--- /dev/null
+++ b/arch/ppc/configs/mcpn765_defconfig
@@ -0,0 +1,579 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7CONFIG_PPC=y
8CONFIG_PPC32=y
9CONFIG_GENERIC_NVRAM=y
10
11#
12# Code maturity level options
13#
14# CONFIG_EXPERIMENTAL is not set
15CONFIG_CLEAN_COMPILE=y
16CONFIG_STANDALONE=y
17CONFIG_BROKEN_ON_SMP=y
18
19#
20# General setup
21#
22# CONFIG_SWAP is not set
23CONFIG_SYSVIPC=y
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26CONFIG_LOG_BUF_SHIFT=14
27# CONFIG_HOTPLUG is not set
28# CONFIG_IKCONFIG is not set
29CONFIG_EMBEDDED=y
30CONFIG_KALLSYMS=y
31CONFIG_FUTEX=y
32CONFIG_EPOLL=y
33CONFIG_IOSCHED_NOOP=y
34CONFIG_IOSCHED_AS=y
35CONFIG_IOSCHED_DEADLINE=y
36# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
37
38#
39# Loadable module support
40#
41CONFIG_MODULES=y
42# CONFIG_MODULE_UNLOAD is not set
43CONFIG_OBSOLETE_MODPARM=y
44# CONFIG_KMOD is not set
45
46#
47# Processor
48#
49CONFIG_6xx=y
50# CONFIG_40x is not set
51# CONFIG_44x is not set
52# CONFIG_POWER3 is not set
53# CONFIG_POWER4 is not set
54# CONFIG_8xx is not set
55CONFIG_ALTIVEC=y
56# CONFIG_TAU is not set
57# CONFIG_CPU_FREQ is not set
58CONFIG_PPC_STD_MMU=y
59
60#
61# Platform options
62#
63# CONFIG_PPC_MULTIPLATFORM is not set
64# CONFIG_APUS is not set
65# CONFIG_WILLOW is not set
66# CONFIG_PCORE is not set
67# CONFIG_POWERPMC250 is not set
68# CONFIG_EV64260 is not set
69# CONFIG_SPRUCE is not set
70# CONFIG_LOPEC is not set
71CONFIG_MCPN765=y
72# CONFIG_MVME5100 is not set
73# CONFIG_PPLUS is not set
74# CONFIG_PRPMC750 is not set
75# CONFIG_PRPMC800 is not set
76# CONFIG_SANDPOINT is not set
77# CONFIG_ADIR is not set
78# CONFIG_K2 is not set
79# CONFIG_PAL4 is not set
80# CONFIG_GEMINI is not set
81# CONFIG_EST8260 is not set
82# CONFIG_SBS8260 is not set
83# CONFIG_RPX6 is not set
84# CONFIG_TQM8260 is not set
85CONFIG_PPC_GEN550=y
86# CONFIG_SMP is not set
87# CONFIG_PREEMPT is not set
88CONFIG_HIGHMEM=y
89CONFIG_KERNEL_ELF=y
90CONFIG_BINFMT_ELF=y
91# CONFIG_BINFMT_MISC is not set
92CONFIG_CMDLINE_BOOL=y
93CONFIG_CMDLINE="ip=on"
94
95#
96# Bus options
97#
98CONFIG_GENERIC_ISA_DMA=y
99CONFIG_PCI=y
100CONFIG_PCI_DOMAINS=y
101# CONFIG_PCI_LEGACY_PROC is not set
102# CONFIG_PCI_NAMES is not set
103
104#
105# Advanced setup
106#
107# CONFIG_ADVANCED_OPTIONS is not set
108
109#
110# Default settings for advanced configuration options are used
111#
112CONFIG_HIGHMEM_START=0xfe000000
113CONFIG_LOWMEM_SIZE=0x30000000
114CONFIG_KERNEL_START=0xc0000000
115CONFIG_TASK_SIZE=0x80000000
116CONFIG_BOOT_LOAD=0x00800000
117
118#
119# Device Drivers
120#
121
122#
123# Generic Driver Options
124#
125
126#
127# Memory Technology Devices (MTD)
128#
129# CONFIG_MTD is not set
130
131#
132# Parallel port support
133#
134# CONFIG_PARPORT is not set
135
136#
137# Plug and Play support
138#
139
140#
141# Block devices
142#
143# CONFIG_BLK_DEV_FD is not set
144# CONFIG_BLK_CPQ_DA is not set
145# CONFIG_BLK_CPQ_CISS_DA is not set
146# CONFIG_BLK_DEV_DAC960 is not set
147CONFIG_BLK_DEV_LOOP=y
148# CONFIG_BLK_DEV_CRYPTOLOOP is not set
149# CONFIG_BLK_DEV_NBD is not set
150# CONFIG_BLK_DEV_CARMEL is not set
151CONFIG_BLK_DEV_RAM=y
152CONFIG_BLK_DEV_RAM_SIZE=4096
153CONFIG_BLK_DEV_INITRD=y
154# CONFIG_LBD is not set
155
156#
157# ATA/ATAPI/MFM/RLL support
158#
159CONFIG_IDE=y
160CONFIG_BLK_DEV_IDE=y
161
162#
163# Please see Documentation/ide.txt for help/info on IDE drives
164#
165CONFIG_BLK_DEV_IDEDISK=y
166# CONFIG_IDEDISK_MULTI_MODE is not set
167# CONFIG_IDEDISK_STROKE is not set
168# CONFIG_BLK_DEV_IDECD is not set
169# CONFIG_BLK_DEV_IDEFLOPPY is not set
170# CONFIG_IDE_TASK_IOCTL is not set
171
172#
173# IDE chipset support/bugfixes
174#
175# CONFIG_IDE_GENERIC is not set
176CONFIG_BLK_DEV_IDEPCI=y
177# CONFIG_IDEPCI_SHARE_IRQ is not set
178# CONFIG_BLK_DEV_OFFBOARD is not set
179# CONFIG_BLK_DEV_GENERIC is not set
180# CONFIG_BLK_DEV_SL82C105 is not set
181CONFIG_BLK_DEV_IDEDMA_PCI=y
182# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
183# CONFIG_IDEDMA_PCI_AUTO is not set
184CONFIG_BLK_DEV_ADMA=y
185# CONFIG_BLK_DEV_AEC62XX is not set
186# CONFIG_BLK_DEV_ALI15X3 is not set
187# CONFIG_BLK_DEV_AMD74XX is not set
188# CONFIG_BLK_DEV_CMD64X is not set
189# CONFIG_BLK_DEV_TRIFLEX is not set
190# CONFIG_BLK_DEV_CY82C693 is not set
191# CONFIG_BLK_DEV_CS5530 is not set
192# CONFIG_BLK_DEV_HPT34X is not set
193# CONFIG_BLK_DEV_HPT366 is not set
194# CONFIG_BLK_DEV_SC1200 is not set
195# CONFIG_BLK_DEV_PIIX is not set
196# CONFIG_BLK_DEV_NS87415 is not set
197# CONFIG_BLK_DEV_PDC202XX_OLD is not set
198# CONFIG_BLK_DEV_PDC202XX_NEW is not set
199# CONFIG_BLK_DEV_SVWKS is not set
200# CONFIG_BLK_DEV_SIIMAGE is not set
201# CONFIG_BLK_DEV_SLC90E66 is not set
202# CONFIG_BLK_DEV_TRM290 is not set
203CONFIG_BLK_DEV_VIA82CXXX=y
204CONFIG_BLK_DEV_IDEDMA=y
205# CONFIG_IDEDMA_IVB is not set
206# CONFIG_IDEDMA_AUTO is not set
207# CONFIG_BLK_DEV_HD is not set
208
209#
210# SCSI device support
211#
212# CONFIG_SCSI is not set
213
214#
215# Multi-device support (RAID and LVM)
216#
217# CONFIG_MD is not set
218
219#
220# Fusion MPT device support
221#
222# CONFIG_FUSION is not set
223
224#
225# IEEE 1394 (FireWire) support
226#
227# CONFIG_IEEE1394 is not set
228
229#
230# I2O device support
231#
232# CONFIG_I2O is not set
233
234#
235# Macintosh device drivers
236#
237
238#
239# Networking support
240#
241CONFIG_NET=y
242
243#
244# Networking options
245#
246CONFIG_PACKET=y
247# CONFIG_PACKET_MMAP is not set
248# CONFIG_NETLINK_DEV is not set
249CONFIG_UNIX=y
250# CONFIG_NET_KEY is not set
251CONFIG_INET=y
252# CONFIG_IP_MULTICAST is not set
253# CONFIG_IP_ADVANCED_ROUTER is not set
254CONFIG_IP_PNP=y
255CONFIG_IP_PNP_DHCP=y
256# CONFIG_IP_PNP_BOOTP is not set
257# CONFIG_IP_PNP_RARP is not set
258# CONFIG_NET_IPIP is not set
259# CONFIG_NET_IPGRE is not set
260# CONFIG_SYN_COOKIES is not set
261# CONFIG_INET_AH is not set
262# CONFIG_INET_ESP is not set
263# CONFIG_INET_IPCOMP is not set
264# CONFIG_DECNET is not set
265# CONFIG_BRIDGE is not set
266# CONFIG_NETFILTER is not set
267# CONFIG_VLAN_8021Q is not set
268# CONFIG_LLC2 is not set
269# CONFIG_IPX is not set
270# CONFIG_ATALK is not set
271
272#
273# QoS and/or fair queueing
274#
275# CONFIG_NET_SCHED is not set
276
277#
278# Network testing
279#
280# CONFIG_NET_PKTGEN is not set
281CONFIG_NETDEVICES=y
282
283#
284# ARCnet devices
285#
286# CONFIG_ARCNET is not set
287# CONFIG_DUMMY is not set
288# CONFIG_BONDING is not set
289# CONFIG_EQUALIZER is not set
290# CONFIG_TUN is not set
291
292#
293# Ethernet (10 or 100Mbit)
294#
295CONFIG_NET_ETHERNET=y
296CONFIG_MII=y
297# CONFIG_OAKNET is not set
298# CONFIG_HAPPYMEAL is not set
299# CONFIG_SUNGEM is not set
300# CONFIG_NET_VENDOR_3COM is not set
301
302#
303# Tulip family network device support
304#
305CONFIG_NET_TULIP=y
306CONFIG_TULIP=y
307# CONFIG_TULIP_MMIO is not set
308# CONFIG_TULIP_NAPI is not set
309# CONFIG_DE4X5 is not set
310# CONFIG_WINBOND_840 is not set
311# CONFIG_DM9102 is not set
312# CONFIG_HP100 is not set
313# CONFIG_NET_PCI is not set
314
315#
316# Ethernet (1000 Mbit)
317#
318# CONFIG_ACENIC is not set
319# CONFIG_DL2K is not set
320# CONFIG_E1000 is not set
321# CONFIG_NS83820 is not set
322# CONFIG_HAMACHI is not set
323# CONFIG_R8169 is not set
324# CONFIG_SK98LIN is not set
325# CONFIG_TIGON3 is not set
326
327#
328# Ethernet (10000 Mbit)
329#
330# CONFIG_IXGB is not set
331# CONFIG_FDDI is not set
332# CONFIG_PPP is not set
333# CONFIG_SLIP is not set
334
335#
336# Wireless LAN (non-hamradio)
337#
338# CONFIG_NET_RADIO is not set
339
340#
341# Token Ring devices
342#
343# CONFIG_TR is not set
344
345#
346# Wan interfaces
347#
348# CONFIG_WAN is not set
349
350#
351# Amateur Radio support
352#
353# CONFIG_HAMRADIO is not set
354
355#
356# IrDA (infrared) support
357#
358# CONFIG_IRDA is not set
359
360#
361# Bluetooth support
362#
363# CONFIG_BT is not set
364# CONFIG_NETPOLL is not set
365# CONFIG_NET_POLL_CONTROLLER is not set
366
367#
368# ISDN subsystem
369#
370# CONFIG_ISDN is not set
371
372#
373# Telephony Support
374#
375# CONFIG_PHONE is not set
376
377#
378# Input device support
379#
380# CONFIG_INPUT is not set
381
382#
383# Userland interfaces
384#
385
386#
387# Input I/O drivers
388#
389# CONFIG_GAMEPORT is not set
390CONFIG_SOUND_GAMEPORT=y
391# CONFIG_SERIO is not set
392# CONFIG_SERIO_I8042 is not set
393
394#
395# Input Device Drivers
396#
397
398#
399# Character devices
400#
401# CONFIG_VT is not set
402# CONFIG_SERIAL_NONSTANDARD is not set
403
404#
405# Serial drivers
406#
407CONFIG_SERIAL_8250=y
408CONFIG_SERIAL_8250_CONSOLE=y
409CONFIG_SERIAL_8250_NR_UARTS=4
410# CONFIG_SERIAL_8250_EXTENDED is not set
411
412#
413# Non-8250 serial port support
414#
415CONFIG_SERIAL_CORE=y
416CONFIG_SERIAL_CORE_CONSOLE=y
417CONFIG_UNIX98_PTYS=y
418CONFIG_LEGACY_PTYS=y
419CONFIG_LEGACY_PTY_COUNT=256
420# CONFIG_QIC02_TAPE is not set
421
422#
423# IPMI
424#
425# CONFIG_IPMI_HANDLER is not set
426
427#
428# Watchdog Cards
429#
430# CONFIG_WATCHDOG is not set
431# CONFIG_NVRAM is not set
432CONFIG_GEN_RTC=y
433# CONFIG_GEN_RTC_X is not set
434# CONFIG_DTLK is not set
435# CONFIG_R3964 is not set
436# CONFIG_APPLICOM is not set
437
438#
439# Ftape, the floppy tape device driver
440#
441# CONFIG_FTAPE is not set
442# CONFIG_AGP is not set
443# CONFIG_DRM is not set
444# CONFIG_RAW_DRIVER is not set
445
446#
447# I2C support
448#
449# CONFIG_I2C is not set
450
451#
452# Misc devices
453#
454
455#
456# Multimedia devices
457#
458# CONFIG_VIDEO_DEV is not set
459
460#
461# Digital Video Broadcasting Devices
462#
463# CONFIG_DVB is not set
464
465#
466# Graphics support
467#
468# CONFIG_FB is not set
469
470#
471# Sound
472#
473# CONFIG_SOUND is not set
474
475#
476# USB support
477#
478# CONFIG_USB is not set
479
480#
481# USB Gadget Support
482#
483# CONFIG_USB_GADGET is not set
484
485#
486# File systems
487#
488CONFIG_EXT2_FS=y
489# CONFIG_EXT2_FS_XATTR is not set
490# CONFIG_EXT3_FS is not set
491# CONFIG_JBD is not set
492# CONFIG_REISERFS_FS is not set
493# CONFIG_JFS_FS is not set
494# CONFIG_XFS_FS is not set
495# CONFIG_MINIX_FS is not set
496# CONFIG_ROMFS_FS is not set
497# CONFIG_QUOTA is not set
498# CONFIG_AUTOFS_FS is not set
499# CONFIG_AUTOFS4_FS is not set
500
501#
502# CD-ROM/DVD Filesystems
503#
504# CONFIG_ISO9660_FS is not set
505# CONFIG_UDF_FS is not set
506
507#
508# DOS/FAT/NT Filesystems
509#
510# CONFIG_FAT_FS is not set
511# CONFIG_NTFS_FS is not set
512
513#
514# Pseudo filesystems
515#
516CONFIG_PROC_FS=y
517CONFIG_PROC_KCORE=y
518# CONFIG_DEVPTS_FS_XATTR is not set
519CONFIG_TMPFS=y
520# CONFIG_HUGETLB_PAGE is not set
521CONFIG_RAMFS=y
522
523#
524# Miscellaneous filesystems
525#
526# CONFIG_HFSPLUS_FS is not set
527# CONFIG_CRAMFS is not set
528# CONFIG_VXFS_FS is not set
529# CONFIG_HPFS_FS is not set
530# CONFIG_QNX4FS_FS is not set
531# CONFIG_SYSV_FS is not set
532# CONFIG_UFS_FS is not set
533
534#
535# Network File Systems
536#
537CONFIG_NFS_FS=y
538# CONFIG_NFS_V3 is not set
539# CONFIG_NFSD is not set
540CONFIG_ROOT_NFS=y
541CONFIG_LOCKD=y
542# CONFIG_EXPORTFS is not set
543CONFIG_SUNRPC=y
544# CONFIG_SMB_FS is not set
545# CONFIG_CIFS is not set
546# CONFIG_NCP_FS is not set
547# CONFIG_CODA_FS is not set
548
549#
550# Partition Types
551#
552# CONFIG_PARTITION_ADVANCED is not set
553CONFIG_MSDOS_PARTITION=y
554
555#
556# Native Language Support
557#
558# CONFIG_NLS is not set
559
560#
561# Library routines
562#
563CONFIG_CRC32=y
564
565#
566# Kernel hacking
567#
568# CONFIG_DEBUG_KERNEL is not set
569# CONFIG_SERIAL_TEXT_DEBUG is not set
570
571#
572# Security options
573#
574# CONFIG_SECURITY is not set
575
576#
577# Cryptographic options
578#
579# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/menf1_defconfig b/arch/ppc/configs/menf1_defconfig
new file mode 100644
index 000000000000..321659b5505f
--- /dev/null
+++ b/arch/ppc/configs/menf1_defconfig
@@ -0,0 +1,621 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7
8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12
13#
14# General setup
15#
16CONFIG_SWAP=y
17CONFIG_SYSVIPC=y
18# CONFIG_BSD_PROCESS_ACCT is not set
19CONFIG_SYSCTL=y
20CONFIG_LOG_BUF_SHIFT=14
21# CONFIG_EMBEDDED is not set
22CONFIG_FUTEX=y
23CONFIG_EPOLL=y
24
25#
26# Loadable module support
27#
28CONFIG_MODULES=y
29CONFIG_MODULE_UNLOAD=y
30# CONFIG_MODULE_FORCE_UNLOAD is not set
31CONFIG_OBSOLETE_MODPARM=y
32# CONFIG_MODVERSIONS is not set
33CONFIG_KMOD=y
34
35#
36# Platform support
37#
38CONFIG_PPC=y
39CONFIG_PPC32=y
40CONFIG_6xx=y
41# CONFIG_40x is not set
42# CONFIG_POWER3 is not set
43# CONFIG_8xx is not set
44
45#
46# IBM 4xx options
47#
48# CONFIG_8260 is not set
49CONFIG_GENERIC_ISA_DMA=y
50CONFIG_PPC_STD_MMU=y
51# CONFIG_PPC_MULTIPLATFORM is not set
52# CONFIG_APUS is not set
53# CONFIG_WILLOW_2 is not set
54# CONFIG_PCORE is not set
55# CONFIG_POWERPMC250 is not set
56# CONFIG_EV64260 is not set
57# CONFIG_SPRUCE is not set
58CONFIG_MENF1=y
59# CONFIG_LOPEC is not set
60# CONFIG_MCPN765 is not set
61# CONFIG_MVME5100 is not set
62# CONFIG_PPLUS is not set
63# CONFIG_PRPMC750 is not set
64# CONFIG_PRPMC800 is not set
65# CONFIG_SANDPOINT is not set
66# CONFIG_ADIR is not set
67# CONFIG_K2 is not set
68# CONFIG_PAL4 is not set
69# CONFIG_GEMINI is not set
70CONFIG_MPC10X_STORE_GATHERING=y
71# CONFIG_SMP is not set
72# CONFIG_PREEMPT is not set
73# CONFIG_ALTIVEC is not set
74# CONFIG_TAU is not set
75# CONFIG_CPU_FREQ is not set
76
77#
78# General setup
79#
80# CONFIG_HIGHMEM is not set
81CONFIG_PCI=y
82CONFIG_PCI_DOMAINS=y
83CONFIG_KCORE_ELF=y
84CONFIG_BINFMT_ELF=y
85CONFIG_KERNEL_ELF=y
86# CONFIG_BINFMT_MISC is not set
87# CONFIG_PCI_LEGACY_PROC is not set
88# CONFIG_PCI_NAMES is not set
89# CONFIG_HOTPLUG is not set
90
91#
92# Parallel port support
93#
94# CONFIG_PARPORT is not set
95# CONFIG_PPC601_SYNC_FIX is not set
96CONFIG_CMDLINE_BOOL=y
97CONFIG_CMDLINE="ip=on"
98
99#
100# Advanced setup
101#
102# CONFIG_ADVANCED_OPTIONS is not set
103
104#
105# Default settings for advanced configuration options are used
106#
107CONFIG_HIGHMEM_START=0xfe000000
108CONFIG_LOWMEM_SIZE=0x30000000
109CONFIG_KERNEL_START=0xc0000000
110CONFIG_TASK_SIZE=0x80000000
111CONFIG_BOOT_LOAD=0x00800000
112
113#
114# Memory Technology Devices (MTD)
115#
116# CONFIG_MTD is not set
117
118#
119# Plug and Play support
120#
121# CONFIG_PNP is not set
122
123#
124# Block devices
125#
126# CONFIG_BLK_DEV_FD is not set
127# CONFIG_BLK_CPQ_DA is not set
128# CONFIG_BLK_CPQ_CISS_DA is not set
129# CONFIG_BLK_DEV_DAC960 is not set
130# CONFIG_BLK_DEV_UMEM is not set
131# CONFIG_BLK_DEV_LOOP is not set
132# CONFIG_BLK_DEV_NBD is not set
133# CONFIG_BLK_DEV_RAM is not set
134# CONFIG_BLK_DEV_INITRD is not set
135
136#
137# Multi-device support (RAID and LVM)
138#
139# CONFIG_MD is not set
140
141#
142# ATA/IDE/MFM/RLL support
143#
144CONFIG_IDE=y
145
146#
147# IDE, ATA and ATAPI Block devices
148#
149CONFIG_BLK_DEV_IDE=y
150
151#
152# Please see Documentation/ide.txt for help/info on IDE drives
153#
154# CONFIG_BLK_DEV_HD is not set
155CONFIG_BLK_DEV_IDEDISK=y
156# CONFIG_IDEDISK_MULTI_MODE is not set
157# CONFIG_IDEDISK_STROKE is not set
158CONFIG_BLK_DEV_IDECD=y
159# CONFIG_BLK_DEV_IDEFLOPPY is not set
160# CONFIG_IDE_TASK_IOCTL is not set
161
162#
163# IDE chipset support/bugfixes
164#
165# CONFIG_BLK_DEV_IDEPCI is not set
166
167#
168# SCSI support
169#
170# CONFIG_SCSI is not set
171
172#
173# Fusion MPT device support
174#
175
176#
177# IEEE 1394 (FireWire) support (EXPERIMENTAL)
178#
179# CONFIG_IEEE1394 is not set
180
181#
182# I2O device support
183#
184# CONFIG_I2O is not set
185
186#
187# Networking support
188#
189CONFIG_NET=y
190
191#
192# Networking options
193#
194CONFIG_PACKET=y
195# CONFIG_PACKET_MMAP is not set
196# CONFIG_NETLINK_DEV is not set
197CONFIG_NETFILTER=y
198# CONFIG_NETFILTER_DEBUG is not set
199CONFIG_UNIX=y
200# CONFIG_NET_KEY is not set
201CONFIG_INET=y
202CONFIG_IP_MULTICAST=y
203# CONFIG_IP_ADVANCED_ROUTER is not set
204CONFIG_IP_PNP=y
205CONFIG_IP_PNP_DHCP=y
206# CONFIG_IP_PNP_BOOTP is not set
207# CONFIG_IP_PNP_RARP is not set
208# CONFIG_NET_IPIP is not set
209# CONFIG_NET_IPGRE is not set
210# CONFIG_IP_MROUTE is not set
211# CONFIG_ARPD is not set
212# CONFIG_INET_ECN is not set
213# CONFIG_SYN_COOKIES is not set
214# CONFIG_INET_AH is not set
215# CONFIG_INET_ESP is not set
216# CONFIG_INET_IPCOMP is not set
217
218#
219# IP: Netfilter Configuration
220#
221CONFIG_IP_NF_CONNTRACK=m
222CONFIG_IP_NF_FTP=m
223CONFIG_IP_NF_IRC=m
224# CONFIG_IP_NF_TFTP is not set
225# CONFIG_IP_NF_AMANDA is not set
226# CONFIG_IP_NF_QUEUE is not set
227CONFIG_IP_NF_IPTABLES=m
228CONFIG_IP_NF_MATCH_LIMIT=m
229CONFIG_IP_NF_MATCH_MAC=m
230CONFIG_IP_NF_MATCH_PKTTYPE=m
231CONFIG_IP_NF_MATCH_MARK=m
232CONFIG_IP_NF_MATCH_MULTIPORT=m
233CONFIG_IP_NF_MATCH_TOS=m
234CONFIG_IP_NF_MATCH_ECN=m
235CONFIG_IP_NF_MATCH_DSCP=m
236CONFIG_IP_NF_MATCH_AH_ESP=m
237CONFIG_IP_NF_MATCH_LENGTH=m
238CONFIG_IP_NF_MATCH_TTL=m
239CONFIG_IP_NF_MATCH_TCPMSS=m
240CONFIG_IP_NF_MATCH_HELPER=m
241CONFIG_IP_NF_MATCH_STATE=m
242CONFIG_IP_NF_MATCH_CONNTRACK=m
243CONFIG_IP_NF_MATCH_UNCLEAN=m
244CONFIG_IP_NF_MATCH_OWNER=m
245CONFIG_IP_NF_FILTER=m
246CONFIG_IP_NF_TARGET_REJECT=m
247CONFIG_IP_NF_TARGET_MIRROR=m
248CONFIG_IP_NF_NAT=m
249CONFIG_IP_NF_NAT_NEEDED=y
250CONFIG_IP_NF_TARGET_MASQUERADE=m
251CONFIG_IP_NF_TARGET_REDIRECT=m
252# CONFIG_IP_NF_NAT_SNMP_BASIC is not set
253CONFIG_IP_NF_NAT_IRC=m
254CONFIG_IP_NF_NAT_FTP=m
255# CONFIG_IP_NF_MANGLE is not set
256# CONFIG_IP_NF_TARGET_LOG is not set
257CONFIG_IP_NF_TARGET_ULOG=m
258CONFIG_IP_NF_TARGET_TCPMSS=m
259CONFIG_IP_NF_ARPTABLES=m
260CONFIG_IP_NF_ARPFILTER=m
261CONFIG_IP_NF_COMPAT_IPCHAINS=m
262# CONFIG_IP_NF_COMPAT_IPFWADM is not set
263# CONFIG_IPV6 is not set
264# CONFIG_XFRM_USER is not set
265
266#
267# SCTP Configuration (EXPERIMENTAL)
268#
269CONFIG_IPV6_SCTP__=y
270# CONFIG_IP_SCTP is not set
271# CONFIG_ATM is not set
272# CONFIG_VLAN_8021Q is not set
273# CONFIG_LLC is not set
274# CONFIG_DECNET is not set
275# CONFIG_BRIDGE is not set
276# CONFIG_X25 is not set
277# CONFIG_LAPB is not set
278# CONFIG_NET_DIVERT is not set
279# CONFIG_ECONET is not set
280# CONFIG_WAN_ROUTER is not set
281# CONFIG_NET_HW_FLOWCONTROL is not set
282
283#
284# QoS and/or fair queueing
285#
286# CONFIG_NET_SCHED is not set
287
288#
289# Network testing
290#
291# CONFIG_NET_PKTGEN is not set
292CONFIG_NETDEVICES=y
293
294#
295# ARCnet devices
296#
297# CONFIG_ARCNET is not set
298# CONFIG_DUMMY is not set
299# CONFIG_BONDING is not set
300# CONFIG_EQUALIZER is not set
301# CONFIG_TUN is not set
302# CONFIG_ETHERTAP is not set
303
304#
305# Ethernet (10 or 100Mbit)
306#
307CONFIG_NET_ETHERNET=y
308CONFIG_MII=y
309# CONFIG_OAKNET is not set
310# CONFIG_HAPPYMEAL is not set
311# CONFIG_SUNGEM is not set
312# CONFIG_NET_VENDOR_3COM is not set
313
314#
315# Tulip family network device support
316#
317# CONFIG_NET_TULIP is not set
318# CONFIG_HP100 is not set
319CONFIG_NET_PCI=y
320# CONFIG_PCNET32 is not set
321# CONFIG_AMD8111_ETH is not set
322# CONFIG_ADAPTEC_STARFIRE is not set
323# CONFIG_B44 is not set
324# CONFIG_DGRS is not set
325# CONFIG_EEPRO100 is not set
326# CONFIG_E100 is not set
327# CONFIG_FEALNX is not set
328# CONFIG_NATSEMI is not set
329# CONFIG_NE2K_PCI is not set
330# CONFIG_8139CP is not set
331# CONFIG_8139TOO is not set
332# CONFIG_SIS900 is not set
333# CONFIG_EPIC100 is not set
334# CONFIG_SUNDANCE is not set
335# CONFIG_TLAN is not set
336# CONFIG_VIA_RHINE is not set
337
338#
339# Ethernet (1000 Mbit)
340#
341# CONFIG_ACENIC is not set
342# CONFIG_DL2K is not set
343# CONFIG_E1000 is not set
344# CONFIG_NS83820 is not set
345# CONFIG_HAMACHI is not set
346# CONFIG_YELLOWFIN is not set
347# CONFIG_R8169 is not set
348# CONFIG_SK98LIN is not set
349# CONFIG_TIGON3 is not set
350
351#
352# Ethernet (10000 Mbit)
353#
354# CONFIG_IXGB is not set
355# CONFIG_FDDI is not set
356# CONFIG_HIPPI is not set
357# CONFIG_PPP is not set
358# CONFIG_SLIP is not set
359
360#
361# Wireless LAN (non-hamradio)
362#
363# CONFIG_NET_RADIO is not set
364
365#
366# Token Ring devices (depends on LLC=y)
367#
368# CONFIG_RCPCI is not set
369# CONFIG_SHAPER is not set
370
371#
372# Wan interfaces
373#
374# CONFIG_WAN is not set
375
376#
377# Amateur Radio support
378#
379# CONFIG_HAMRADIO is not set
380
381#
382# IrDA (infrared) support
383#
384# CONFIG_IRDA is not set
385
386#
387# ISDN subsystem
388#
389# CONFIG_ISDN_BOOL is not set
390
391#
392# Graphics support
393#
394# CONFIG_FB is not set
395
396#
397# Old CD-ROM drivers (not SCSI, not IDE)
398#
399# CONFIG_CD_NO_IDESCSI is not set
400
401#
402# Input device support
403#
404# CONFIG_INPUT is not set
405
406#
407# Userland interfaces
408#
409
410#
411# Input I/O drivers
412#
413# CONFIG_GAMEPORT is not set
414CONFIG_SOUND_GAMEPORT=y
415# CONFIG_SERIO is not set
416
417#
418# Input Device Drivers
419#
420
421#
422# Macintosh device drivers
423#
424
425#
426# Character devices
427#
428# CONFIG_SERIAL_NONSTANDARD is not set
429
430#
431# Serial drivers
432#
433CONFIG_SERIAL_8250=y
434CONFIG_SERIAL_8250_CONSOLE=y
435# CONFIG_SERIAL_8250_EXTENDED is not set
436
437#
438# Non-8250 serial port support
439#
440CONFIG_SERIAL_CORE=y
441CONFIG_SERIAL_CORE_CONSOLE=y
442CONFIG_UNIX98_PTYS=y
443CONFIG_UNIX98_PTY_COUNT=256
444
445#
446# I2C support
447#
448# CONFIG_I2C is not set
449
450#
451# I2C Hardware Sensors Mainboard support
452#
453
454#
455# I2C Hardware Sensors Chip support
456#
457# CONFIG_I2C_SENSOR is not set
458
459#
460# Mice
461#
462# CONFIG_BUSMOUSE is not set
463# CONFIG_QIC02_TAPE is not set
464
465#
466# IPMI
467#
468# CONFIG_IPMI_HANDLER is not set
469
470#
471# Watchdog Cards
472#
473# CONFIG_WATCHDOG is not set
474# CONFIG_NVRAM is not set
475CONFIG_GEN_RTC=y
476# CONFIG_GEN_RTC_X is not set
477# CONFIG_DTLK is not set
478# CONFIG_R3964 is not set
479# CONFIG_APPLICOM is not set
480
481#
482# Ftape, the floppy tape device driver
483#
484# CONFIG_FTAPE is not set
485# CONFIG_AGP is not set
486# CONFIG_DRM is not set
487# CONFIG_RAW_DRIVER is not set
488# CONFIG_HANGCHECK_TIMER is not set
489
490#
491# Multimedia devices
492#
493# CONFIG_VIDEO_DEV is not set
494
495#
496# Digital Video Broadcasting Devices
497#
498# CONFIG_DVB is not set
499
500#
501# File systems
502#
503CONFIG_EXT2_FS=y
504# CONFIG_EXT2_FS_XATTR is not set
505CONFIG_EXT3_FS=y
506CONFIG_EXT3_FS_XATTR=y
507# CONFIG_EXT3_FS_POSIX_ACL is not set
508# CONFIG_EXT3_FS_SECURITY is not set
509CONFIG_JBD=y
510# CONFIG_JBD_DEBUG is not set
511CONFIG_FS_MBCACHE=y
512# CONFIG_REISERFS_FS is not set
513# CONFIG_JFS_FS is not set
514# CONFIG_XFS_FS is not set
515# CONFIG_MINIX_FS is not set
516# CONFIG_ROMFS_FS is not set
517# CONFIG_QUOTA is not set
518# CONFIG_AUTOFS_FS is not set
519# CONFIG_AUTOFS4_FS is not set
520
521#
522# CD-ROM/DVD Filesystems
523#
524CONFIG_ISO9660_FS=y
525# CONFIG_JOLIET is not set
526# CONFIG_ZISOFS is not set
527# CONFIG_UDF_FS is not set
528
529#
530# DOS/FAT/NT Filesystems
531#
532# CONFIG_FAT_FS is not set
533# CONFIG_NTFS_FS is not set
534
535#
536# Pseudo filesystems
537#
538CONFIG_PROC_FS=y
539# CONFIG_DEVFS_FS is not set
540CONFIG_DEVPTS_FS=y
541# CONFIG_DEVPTS_FS_XATTR is not set
542CONFIG_TMPFS=y
543CONFIG_RAMFS=y
544
545#
546# Miscellaneous filesystems
547#
548# CONFIG_ADFS_FS is not set
549# CONFIG_AFFS_FS is not set
550# CONFIG_HFS_FS is not set
551# CONFIG_BEFS_FS is not set
552# CONFIG_BFS_FS is not set
553# CONFIG_EFS_FS is not set
554# CONFIG_CRAMFS is not set
555# CONFIG_VXFS_FS is not set
556# CONFIG_HPFS_FS is not set
557# CONFIG_QNX4FS_FS is not set
558# CONFIG_SYSV_FS is not set
559# CONFIG_UFS_FS is not set
560
561#
562# Network File Systems
563#
564CONFIG_NFS_FS=y
565# CONFIG_NFS_V3 is not set
566# CONFIG_NFS_V4 is not set
567# CONFIG_NFSD is not set
568CONFIG_ROOT_NFS=y
569CONFIG_LOCKD=y
570# CONFIG_EXPORTFS is not set
571CONFIG_SUNRPC=y
572# CONFIG_SUNRPC_GSS is not set
573# CONFIG_SMB_FS is not set
574# CONFIG_CIFS is not set
575# CONFIG_NCP_FS is not set
576# CONFIG_CODA_FS is not set
577# CONFIG_INTERMEZZO_FS is not set
578# CONFIG_AFS_FS is not set
579
580#
581# Partition Types
582#
583# CONFIG_PARTITION_ADVANCED is not set
584CONFIG_MSDOS_PARTITION=y
585
586#
587# Sound
588#
589# CONFIG_SOUND is not set
590
591#
592# USB support
593#
594# CONFIG_USB is not set
595# CONFIG_USB_GADGET is not set
596
597#
598# Bluetooth support
599#
600# CONFIG_BT is not set
601
602#
603# Library routines
604#
605# CONFIG_CRC32 is not set
606
607#
608# Kernel hacking
609#
610# CONFIG_DEBUG_KERNEL is not set
611# CONFIG_KALLSYMS is not set
612
613#
614# Security options
615#
616# CONFIG_SECURITY is not set
617
618#
619# Cryptographic options
620#
621# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/mpc834x_sys_defconfig b/arch/ppc/configs/mpc834x_sys_defconfig
new file mode 100644
index 000000000000..4a5522ca8207
--- /dev/null
+++ b/arch/ppc/configs/mpc834x_sys_defconfig
@@ -0,0 +1,644 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc4
4# Thu Feb 17 16:12:23 2005
5#
6CONFIG_MMU=y
7CONFIG_GENERIC_HARDIRQS=y
8CONFIG_RWSEM_XCHGADD_ALGORITHM=y
9CONFIG_GENERIC_CALIBRATE_DELAY=y
10CONFIG_HAVE_DEC_LOCK=y
11CONFIG_PPC=y
12CONFIG_PPC32=y
13CONFIG_GENERIC_NVRAM=y
14
15#
16# Code maturity level options
17#
18CONFIG_EXPERIMENTAL=y
19CONFIG_CLEAN_COMPILE=y
20CONFIG_BROKEN_ON_SMP=y
21
22#
23# General setup
24#
25CONFIG_LOCALVERSION=""
26CONFIG_SWAP=y
27CONFIG_SYSVIPC=y
28# CONFIG_POSIX_MQUEUE is not set
29# CONFIG_BSD_PROCESS_ACCT is not set
30CONFIG_SYSCTL=y
31# CONFIG_AUDIT is not set
32CONFIG_LOG_BUF_SHIFT=14
33# CONFIG_HOTPLUG is not set
34CONFIG_KOBJECT_UEVENT=y
35# CONFIG_IKCONFIG is not set
36CONFIG_EMBEDDED=y
37# CONFIG_KALLSYMS is not set
38CONFIG_FUTEX=y
39# CONFIG_EPOLL is not set
40# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
41CONFIG_SHMEM=y
42CONFIG_CC_ALIGN_FUNCTIONS=0
43CONFIG_CC_ALIGN_LABELS=0
44CONFIG_CC_ALIGN_LOOPS=0
45CONFIG_CC_ALIGN_JUMPS=0
46# CONFIG_TINY_SHMEM is not set
47
48#
49# Loadable module support
50#
51# CONFIG_MODULES is not set
52
53#
54# Processor
55#
56CONFIG_6xx=y
57# CONFIG_40x is not set
58# CONFIG_44x is not set
59# CONFIG_POWER3 is not set
60# CONFIG_POWER4 is not set
61# CONFIG_8xx is not set
62# CONFIG_E500 is not set
63# CONFIG_CPU_FREQ is not set
64CONFIG_PPC_GEN550=y
65CONFIG_83xx=y
66
67#
68# Freescale 83xx options
69#
70CONFIG_MPC834x_SYS=y
71CONFIG_MPC834x=y
72CONFIG_PPC_STD_MMU=y
73
74#
75# Platform options
76#
77# CONFIG_SMP is not set
78# CONFIG_PREEMPT is not set
79# CONFIG_HIGHMEM is not set
80CONFIG_BINFMT_ELF=y
81# CONFIG_BINFMT_MISC is not set
82# CONFIG_CMDLINE_BOOL is not set
83
84#
85# Bus options
86#
87CONFIG_GENERIC_ISA_DMA=y
88# CONFIG_PCI is not set
89# CONFIG_PCI_DOMAINS is not set
90
91#
92# PCCARD (PCMCIA/CardBus) support
93#
94# CONFIG_PCCARD is not set
95
96#
97# PC-card bridges
98#
99
100#
101# Advanced setup
102#
103# CONFIG_ADVANCED_OPTIONS is not set
104
105#
106# Default settings for advanced configuration options are used
107#
108CONFIG_HIGHMEM_START=0xfe000000
109CONFIG_LOWMEM_SIZE=0x30000000
110CONFIG_KERNEL_START=0xc0000000
111CONFIG_TASK_SIZE=0x80000000
112CONFIG_BOOT_LOAD=0x00800000
113
114#
115# Device Drivers
116#
117
118#
119# Generic Driver Options
120#
121CONFIG_STANDALONE=y
122CONFIG_PREVENT_FIRMWARE_BUILD=y
123# CONFIG_FW_LOADER is not set
124
125#
126# Memory Technology Devices (MTD)
127#
128# CONFIG_MTD is not set
129
130#
131# Parallel port support
132#
133# CONFIG_PARPORT is not set
134
135#
136# Plug and Play support
137#
138
139#
140# Block devices
141#
142# CONFIG_BLK_DEV_FD is not set
143# CONFIG_BLK_DEV_COW_COMMON is not set
144CONFIG_BLK_DEV_LOOP=y
145# CONFIG_BLK_DEV_CRYPTOLOOP is not set
146# CONFIG_BLK_DEV_NBD is not set
147CONFIG_BLK_DEV_RAM=y
148CONFIG_BLK_DEV_RAM_COUNT=16
149CONFIG_BLK_DEV_RAM_SIZE=32768
150CONFIG_BLK_DEV_INITRD=y
151CONFIG_INITRAMFS_SOURCE=""
152# CONFIG_LBD is not set
153# CONFIG_CDROM_PKTCDVD is not set
154
155#
156# IO Schedulers
157#
158CONFIG_IOSCHED_NOOP=y
159CONFIG_IOSCHED_AS=y
160CONFIG_IOSCHED_DEADLINE=y
161CONFIG_IOSCHED_CFQ=y
162# CONFIG_ATA_OVER_ETH is not set
163
164#
165# ATA/ATAPI/MFM/RLL support
166#
167# CONFIG_IDE is not set
168
169#
170# SCSI device support
171#
172# CONFIG_SCSI is not set
173
174#
175# Multi-device support (RAID and LVM)
176#
177# CONFIG_MD is not set
178
179#
180# Fusion MPT device support
181#
182
183#
184# IEEE 1394 (FireWire) support
185#
186
187#
188# I2O device support
189#
190
191#
192# Macintosh device drivers
193#
194
195#
196# Networking support
197#
198CONFIG_NET=y
199
200#
201# Networking options
202#
203CONFIG_PACKET=y
204# CONFIG_PACKET_MMAP is not set
205# CONFIG_NETLINK_DEV is not set
206CONFIG_UNIX=y
207# CONFIG_NET_KEY is not set
208CONFIG_INET=y
209CONFIG_IP_MULTICAST=y
210# CONFIG_IP_ADVANCED_ROUTER is not set
211CONFIG_IP_PNP=y
212CONFIG_IP_PNP_DHCP=y
213CONFIG_IP_PNP_BOOTP=y
214# CONFIG_IP_PNP_RARP is not set
215# CONFIG_NET_IPIP is not set
216# CONFIG_NET_IPGRE is not set
217# CONFIG_IP_MROUTE is not set
218# CONFIG_ARPD is not set
219CONFIG_SYN_COOKIES=y
220# CONFIG_INET_AH is not set
221# CONFIG_INET_ESP is not set
222# CONFIG_INET_IPCOMP is not set
223# CONFIG_INET_TUNNEL is not set
224CONFIG_IP_TCPDIAG=y
225# CONFIG_IP_TCPDIAG_IPV6 is not set
226# CONFIG_IPV6 is not set
227# CONFIG_NETFILTER is not set
228
229#
230# SCTP Configuration (EXPERIMENTAL)
231#
232# CONFIG_IP_SCTP is not set
233# CONFIG_ATM is not set
234# CONFIG_BRIDGE is not set
235# CONFIG_VLAN_8021Q is not set
236# CONFIG_DECNET is not set
237# CONFIG_LLC2 is not set
238# CONFIG_IPX is not set
239# CONFIG_ATALK is not set
240# CONFIG_X25 is not set
241# CONFIG_LAPB is not set
242# CONFIG_NET_DIVERT is not set
243# CONFIG_ECONET is not set
244# CONFIG_WAN_ROUTER is not set
245
246#
247# QoS and/or fair queueing
248#
249# CONFIG_NET_SCHED is not set
250# CONFIG_NET_CLS_ROUTE is not set
251
252#
253# Network testing
254#
255# CONFIG_NET_PKTGEN is not set
256# CONFIG_NETPOLL is not set
257# CONFIG_NET_POLL_CONTROLLER is not set
258# CONFIG_HAMRADIO is not set
259# CONFIG_IRDA is not set
260# CONFIG_BT is not set
261CONFIG_NETDEVICES=y
262# CONFIG_DUMMY is not set
263# CONFIG_BONDING is not set
264# CONFIG_EQUALIZER is not set
265# CONFIG_TUN is not set
266
267#
268# Ethernet (10 or 100Mbit)
269#
270CONFIG_NET_ETHERNET=y
271CONFIG_MII=y
272
273#
274# Ethernet (1000 Mbit)
275#
276CONFIG_GIANFAR=y
277# CONFIG_GFAR_NAPI is not set
278
279#
280# Ethernet (10000 Mbit)
281#
282
283#
284# Token Ring devices
285#
286
287#
288# Wireless LAN (non-hamradio)
289#
290# CONFIG_NET_RADIO is not set
291
292#
293# Wan interfaces
294#
295# CONFIG_WAN is not set
296# CONFIG_PPP is not set
297# CONFIG_SLIP is not set
298# CONFIG_SHAPER is not set
299# CONFIG_NETCONSOLE is not set
300
301#
302# ISDN subsystem
303#
304# CONFIG_ISDN is not set
305
306#
307# Telephony Support
308#
309# CONFIG_PHONE is not set
310
311#
312# Input device support
313#
314CONFIG_INPUT=y
315
316#
317# Userland interfaces
318#
319# CONFIG_INPUT_MOUSEDEV is not set
320# CONFIG_INPUT_JOYDEV is not set
321# CONFIG_INPUT_TSDEV is not set
322# CONFIG_INPUT_EVDEV is not set
323# CONFIG_INPUT_EVBUG is not set
324
325#
326# Input I/O drivers
327#
328# CONFIG_GAMEPORT is not set
329CONFIG_SOUND_GAMEPORT=y
330# CONFIG_SERIO is not set
331# CONFIG_SERIO_I8042 is not set
332
333#
334# Input Device Drivers
335#
336# CONFIG_INPUT_KEYBOARD is not set
337# CONFIG_INPUT_MOUSE is not set
338# CONFIG_INPUT_JOYSTICK is not set
339# CONFIG_INPUT_TOUCHSCREEN is not set
340# CONFIG_INPUT_MISC is not set
341
342#
343# Character devices
344#
345# CONFIG_VT is not set
346# CONFIG_SERIAL_NONSTANDARD is not set
347
348#
349# Serial drivers
350#
351CONFIG_SERIAL_8250=y
352CONFIG_SERIAL_8250_CONSOLE=y
353CONFIG_SERIAL_8250_NR_UARTS=4
354# CONFIG_SERIAL_8250_EXTENDED is not set
355
356#
357# Non-8250 serial port support
358#
359CONFIG_SERIAL_CORE=y
360CONFIG_SERIAL_CORE_CONSOLE=y
361CONFIG_UNIX98_PTYS=y
362CONFIG_LEGACY_PTYS=y
363CONFIG_LEGACY_PTY_COUNT=256
364
365#
366# IPMI
367#
368# CONFIG_IPMI_HANDLER is not set
369
370#
371# Watchdog Cards
372#
373# CONFIG_WATCHDOG is not set
374# CONFIG_NVRAM is not set
375CONFIG_GEN_RTC=y
376# CONFIG_GEN_RTC_X is not set
377# CONFIG_DTLK is not set
378# CONFIG_R3964 is not set
379
380#
381# Ftape, the floppy tape device driver
382#
383# CONFIG_AGP is not set
384# CONFIG_DRM is not set
385# CONFIG_RAW_DRIVER is not set
386
387#
388# I2C support
389#
390CONFIG_I2C=y
391CONFIG_I2C_CHARDEV=y
392
393#
394# I2C Algorithms
395#
396# CONFIG_I2C_ALGOBIT is not set
397# CONFIG_I2C_ALGOPCF is not set
398# CONFIG_I2C_ALGOPCA is not set
399
400#
401# I2C Hardware Bus support
402#
403# CONFIG_I2C_ISA is not set
404CONFIG_I2C_MPC=y
405# CONFIG_I2C_PARPORT_LIGHT is not set
406# CONFIG_I2C_PCA_ISA is not set
407
408#
409# Hardware Sensors Chip support
410#
411# CONFIG_I2C_SENSOR is not set
412# CONFIG_SENSORS_ADM1021 is not set
413# CONFIG_SENSORS_ADM1025 is not set
414# CONFIG_SENSORS_ADM1026 is not set
415# CONFIG_SENSORS_ADM1031 is not set
416# CONFIG_SENSORS_ASB100 is not set
417# CONFIG_SENSORS_DS1621 is not set
418# CONFIG_SENSORS_FSCHER is not set
419# CONFIG_SENSORS_GL518SM is not set
420# CONFIG_SENSORS_IT87 is not set
421# CONFIG_SENSORS_LM63 is not set
422# CONFIG_SENSORS_LM75 is not set
423# CONFIG_SENSORS_LM77 is not set
424# CONFIG_SENSORS_LM78 is not set
425# CONFIG_SENSORS_LM80 is not set
426# CONFIG_SENSORS_LM83 is not set
427# CONFIG_SENSORS_LM85 is not set
428# CONFIG_SENSORS_LM87 is not set
429# CONFIG_SENSORS_LM90 is not set
430# CONFIG_SENSORS_MAX1619 is not set
431# CONFIG_SENSORS_PC87360 is not set
432# CONFIG_SENSORS_SMSC47B397 is not set
433# CONFIG_SENSORS_SMSC47M1 is not set
434# CONFIG_SENSORS_W83781D is not set
435# CONFIG_SENSORS_W83L785TS is not set
436# CONFIG_SENSORS_W83627HF is not set
437
438#
439# Other I2C Chip support
440#
441# CONFIG_SENSORS_EEPROM is not set
442# CONFIG_SENSORS_PCF8574 is not set
443# CONFIG_SENSORS_PCF8591 is not set
444# CONFIG_SENSORS_RTC8564 is not set
445# CONFIG_I2C_DEBUG_CORE is not set
446# CONFIG_I2C_DEBUG_ALGO is not set
447# CONFIG_I2C_DEBUG_BUS is not set
448# CONFIG_I2C_DEBUG_CHIP is not set
449
450#
451# Dallas's 1-wire bus
452#
453# CONFIG_W1 is not set
454
455#
456# Misc devices
457#
458
459#
460# Multimedia devices
461#
462# CONFIG_VIDEO_DEV is not set
463
464#
465# Digital Video Broadcasting Devices
466#
467# CONFIG_DVB is not set
468
469#
470# Graphics support
471#
472# CONFIG_FB is not set
473
474#
475# Sound
476#
477# CONFIG_SOUND is not set
478
479#
480# USB support
481#
482# CONFIG_USB_ARCH_HAS_HCD is not set
483# CONFIG_USB_ARCH_HAS_OHCI is not set
484
485#
486# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
487#
488
489#
490# USB Gadget Support
491#
492# CONFIG_USB_GADGET is not set
493
494#
495# MMC/SD Card support
496#
497# CONFIG_MMC is not set
498
499#
500# InfiniBand support
501#
502# CONFIG_INFINIBAND is not set
503
504#
505# File systems
506#
507CONFIG_EXT2_FS=y
508# CONFIG_EXT2_FS_XATTR is not set
509CONFIG_EXT3_FS=y
510CONFIG_EXT3_FS_XATTR=y
511# CONFIG_EXT3_FS_POSIX_ACL is not set
512# CONFIG_EXT3_FS_SECURITY is not set
513CONFIG_JBD=y
514# CONFIG_JBD_DEBUG is not set
515CONFIG_FS_MBCACHE=y
516# CONFIG_REISERFS_FS is not set
517# CONFIG_JFS_FS is not set
518
519#
520# XFS support
521#
522# CONFIG_XFS_FS is not set
523# CONFIG_MINIX_FS is not set
524# CONFIG_ROMFS_FS is not set
525# CONFIG_QUOTA is not set
526CONFIG_DNOTIFY=y
527# CONFIG_AUTOFS_FS is not set
528# CONFIG_AUTOFS4_FS is not set
529
530#
531# CD-ROM/DVD Filesystems
532#
533# CONFIG_ISO9660_FS is not set
534# CONFIG_UDF_FS is not set
535
536#
537# DOS/FAT/NT Filesystems
538#
539# CONFIG_MSDOS_FS is not set
540# CONFIG_VFAT_FS is not set
541# CONFIG_NTFS_FS is not set
542
543#
544# Pseudo filesystems
545#
546CONFIG_PROC_FS=y
547CONFIG_PROC_KCORE=y
548CONFIG_SYSFS=y
549# CONFIG_DEVFS_FS is not set
550# CONFIG_DEVPTS_FS_XATTR is not set
551CONFIG_TMPFS=y
552# CONFIG_TMPFS_XATTR is not set
553# CONFIG_HUGETLB_PAGE is not set
554CONFIG_RAMFS=y
555
556#
557# Miscellaneous filesystems
558#
559# CONFIG_ADFS_FS is not set
560# CONFIG_AFFS_FS is not set
561# CONFIG_HFS_FS is not set
562# CONFIG_HFSPLUS_FS is not set
563# CONFIG_BEFS_FS is not set
564# CONFIG_BFS_FS is not set
565# CONFIG_EFS_FS is not set
566# CONFIG_CRAMFS is not set
567# CONFIG_VXFS_FS is not set
568# CONFIG_HPFS_FS is not set
569# CONFIG_QNX4FS_FS is not set
570# CONFIG_SYSV_FS is not set
571# CONFIG_UFS_FS is not set
572
573#
574# Network File Systems
575#
576CONFIG_NFS_FS=y
577# CONFIG_NFS_V3 is not set
578# CONFIG_NFS_V4 is not set
579# CONFIG_NFS_DIRECTIO is not set
580# CONFIG_NFSD is not set
581CONFIG_ROOT_NFS=y
582CONFIG_LOCKD=y
583CONFIG_SUNRPC=y
584# CONFIG_RPCSEC_GSS_KRB5 is not set
585# CONFIG_RPCSEC_GSS_SPKM3 is not set
586# CONFIG_SMB_FS is not set
587# CONFIG_CIFS is not set
588# CONFIG_NCP_FS is not set
589# CONFIG_CODA_FS is not set
590# CONFIG_AFS_FS is not set
591
592#
593# Partition Types
594#
595CONFIG_PARTITION_ADVANCED=y
596# CONFIG_ACORN_PARTITION is not set
597# CONFIG_OSF_PARTITION is not set
598# CONFIG_AMIGA_PARTITION is not set
599# CONFIG_ATARI_PARTITION is not set
600# CONFIG_MAC_PARTITION is not set
601# CONFIG_MSDOS_PARTITION is not set
602# CONFIG_LDM_PARTITION is not set
603# CONFIG_SGI_PARTITION is not set
604# CONFIG_ULTRIX_PARTITION is not set
605# CONFIG_SUN_PARTITION is not set
606# CONFIG_EFI_PARTITION is not set
607
608#
609# Native Language Support
610#
611# CONFIG_NLS is not set
612
613#
614# Library routines
615#
616# CONFIG_CRC_CCITT is not set
617CONFIG_CRC32=y
618# CONFIG_LIBCRC32C is not set
619
620#
621# Profiling support
622#
623# CONFIG_PROFILING is not set
624
625#
626# Kernel hacking
627#
628# CONFIG_DEBUG_KERNEL is not set
629# CONFIG_SERIAL_TEXT_DEBUG is not set
630
631#
632# Security options
633#
634# CONFIG_KEYS is not set
635# CONFIG_SECURITY is not set
636
637#
638# Cryptographic options
639#
640# CONFIG_CRYPTO is not set
641
642#
643# Hardware crypto devices
644#
diff --git a/arch/ppc/configs/mpc8540_ads_defconfig b/arch/ppc/configs/mpc8540_ads_defconfig
new file mode 100644
index 000000000000..c5c86025e261
--- /dev/null
+++ b/arch/ppc/configs/mpc8540_ads_defconfig
@@ -0,0 +1,707 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc1
4# Thu Jan 20 01:23:13 2005
5#
6CONFIG_MMU=y
7CONFIG_GENERIC_HARDIRQS=y
8CONFIG_RWSEM_XCHGADD_ALGORITHM=y
9CONFIG_GENERIC_CALIBRATE_DELAY=y
10CONFIG_HAVE_DEC_LOCK=y
11CONFIG_PPC=y
12CONFIG_PPC32=y
13CONFIG_GENERIC_NVRAM=y
14
15#
16# Code maturity level options
17#
18CONFIG_EXPERIMENTAL=y
19CONFIG_CLEAN_COMPILE=y
20CONFIG_BROKEN_ON_SMP=y
21
22#
23# General setup
24#
25CONFIG_LOCALVERSION=""
26CONFIG_SWAP=y
27CONFIG_SYSVIPC=y
28# CONFIG_POSIX_MQUEUE is not set
29# CONFIG_BSD_PROCESS_ACCT is not set
30CONFIG_SYSCTL=y
31# CONFIG_AUDIT is not set
32CONFIG_LOG_BUF_SHIFT=14
33# CONFIG_HOTPLUG is not set
34CONFIG_KOBJECT_UEVENT=y
35# CONFIG_IKCONFIG is not set
36CONFIG_EMBEDDED=y
37# CONFIG_KALLSYMS is not set
38CONFIG_FUTEX=y
39# CONFIG_EPOLL is not set
40# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
41CONFIG_SHMEM=y
42CONFIG_CC_ALIGN_FUNCTIONS=0
43CONFIG_CC_ALIGN_LABELS=0
44CONFIG_CC_ALIGN_LOOPS=0
45CONFIG_CC_ALIGN_JUMPS=0
46# CONFIG_TINY_SHMEM is not set
47
48#
49# Loadable module support
50#
51# CONFIG_MODULES is not set
52
53#
54# Processor
55#
56# CONFIG_6xx is not set
57# CONFIG_40x is not set
58# CONFIG_44x is not set
59# CONFIG_POWER3 is not set
60# CONFIG_POWER4 is not set
61# CONFIG_8xx is not set
62CONFIG_E500=y
63CONFIG_BOOKE=y
64CONFIG_FSL_BOOKE=y
65CONFIG_SPE=y
66CONFIG_MATH_EMULATION=y
67# CONFIG_CPU_FREQ is not set
68CONFIG_PPC_GEN550=y
69CONFIG_85xx=y
70CONFIG_PPC_INDIRECT_PCI_BE=y
71
72#
73# Freescale 85xx options
74#
75CONFIG_MPC8540_ADS=y
76# CONFIG_MPC8555_CDS is not set
77# CONFIG_MPC8560_ADS is not set
78# CONFIG_SBC8560 is not set
79CONFIG_MPC8540=y
80
81#
82# Platform options
83#
84# CONFIG_SMP is not set
85# CONFIG_PREEMPT is not set
86# CONFIG_HIGHMEM is not set
87CONFIG_BINFMT_ELF=y
88# CONFIG_BINFMT_MISC is not set
89# CONFIG_CMDLINE_BOOL is not set
90
91#
92# Bus options
93#
94CONFIG_PCI=y
95CONFIG_PCI_DOMAINS=y
96# CONFIG_PCI_LEGACY_PROC is not set
97CONFIG_PCI_NAMES=y
98
99#
100# PCCARD (PCMCIA/CardBus) support
101#
102# CONFIG_PCCARD is not set
103
104#
105# PC-card bridges
106#
107
108#
109# Advanced setup
110#
111# CONFIG_ADVANCED_OPTIONS is not set
112
113#
114# Default settings for advanced configuration options are used
115#
116CONFIG_HIGHMEM_START=0xfe000000
117CONFIG_LOWMEM_SIZE=0x30000000
118CONFIG_KERNEL_START=0xc0000000
119CONFIG_TASK_SIZE=0x80000000
120CONFIG_BOOT_LOAD=0x00800000
121
122#
123# Device Drivers
124#
125
126#
127# Generic Driver Options
128#
129CONFIG_STANDALONE=y
130CONFIG_PREVENT_FIRMWARE_BUILD=y
131# CONFIG_FW_LOADER is not set
132
133#
134# Memory Technology Devices (MTD)
135#
136# CONFIG_MTD is not set
137
138#
139# Parallel port support
140#
141# CONFIG_PARPORT is not set
142
143#
144# Plug and Play support
145#
146
147#
148# Block devices
149#
150# CONFIG_BLK_DEV_FD is not set
151# CONFIG_BLK_CPQ_DA is not set
152# CONFIG_BLK_CPQ_CISS_DA is not set
153# CONFIG_BLK_DEV_DAC960 is not set
154# CONFIG_BLK_DEV_UMEM is not set
155# CONFIG_BLK_DEV_COW_COMMON is not set
156CONFIG_BLK_DEV_LOOP=y
157# CONFIG_BLK_DEV_CRYPTOLOOP is not set
158# CONFIG_BLK_DEV_NBD is not set
159# CONFIG_BLK_DEV_SX8 is not set
160CONFIG_BLK_DEV_RAM=y
161CONFIG_BLK_DEV_RAM_COUNT=16
162CONFIG_BLK_DEV_RAM_SIZE=32768
163CONFIG_BLK_DEV_INITRD=y
164CONFIG_INITRAMFS_SOURCE=""
165# CONFIG_LBD is not set
166# CONFIG_CDROM_PKTCDVD is not set
167
168#
169# IO Schedulers
170#
171CONFIG_IOSCHED_NOOP=y
172CONFIG_IOSCHED_AS=y
173CONFIG_IOSCHED_DEADLINE=y
174CONFIG_IOSCHED_CFQ=y
175# CONFIG_ATA_OVER_ETH is not set
176
177#
178# ATA/ATAPI/MFM/RLL support
179#
180# CONFIG_IDE is not set
181
182#
183# SCSI device support
184#
185# CONFIG_SCSI is not set
186
187#
188# Multi-device support (RAID and LVM)
189#
190# CONFIG_MD is not set
191
192#
193# Fusion MPT device support
194#
195
196#
197# IEEE 1394 (FireWire) support
198#
199# CONFIG_IEEE1394 is not set
200
201#
202# I2O device support
203#
204# CONFIG_I2O is not set
205
206#
207# Macintosh device drivers
208#
209
210#
211# Networking support
212#
213CONFIG_NET=y
214
215#
216# Networking options
217#
218CONFIG_PACKET=y
219# CONFIG_PACKET_MMAP is not set
220# CONFIG_NETLINK_DEV is not set
221CONFIG_UNIX=y
222# CONFIG_NET_KEY is not set
223CONFIG_INET=y
224CONFIG_IP_MULTICAST=y
225# CONFIG_IP_ADVANCED_ROUTER is not set
226CONFIG_IP_PNP=y
227CONFIG_IP_PNP_DHCP=y
228CONFIG_IP_PNP_BOOTP=y
229# CONFIG_IP_PNP_RARP is not set
230# CONFIG_NET_IPIP is not set
231# CONFIG_NET_IPGRE is not set
232# CONFIG_IP_MROUTE is not set
233# CONFIG_ARPD is not set
234CONFIG_SYN_COOKIES=y
235# CONFIG_INET_AH is not set
236# CONFIG_INET_ESP is not set
237# CONFIG_INET_IPCOMP is not set
238# CONFIG_INET_TUNNEL is not set
239CONFIG_IP_TCPDIAG=y
240# CONFIG_IP_TCPDIAG_IPV6 is not set
241# CONFIG_IPV6 is not set
242# CONFIG_NETFILTER is not set
243
244#
245# SCTP Configuration (EXPERIMENTAL)
246#
247# CONFIG_IP_SCTP is not set
248# CONFIG_ATM is not set
249# CONFIG_BRIDGE is not set
250# CONFIG_VLAN_8021Q is not set
251# CONFIG_DECNET is not set
252# CONFIG_LLC2 is not set
253# CONFIG_IPX is not set
254# CONFIG_ATALK is not set
255# CONFIG_X25 is not set
256# CONFIG_LAPB is not set
257# CONFIG_NET_DIVERT is not set
258# CONFIG_ECONET is not set
259# CONFIG_WAN_ROUTER is not set
260
261#
262# QoS and/or fair queueing
263#
264# CONFIG_NET_SCHED is not set
265# CONFIG_NET_CLS_ROUTE is not set
266
267#
268# Network testing
269#
270# CONFIG_NET_PKTGEN is not set
271# CONFIG_NETPOLL is not set
272# CONFIG_NET_POLL_CONTROLLER is not set
273# CONFIG_HAMRADIO is not set
274# CONFIG_IRDA is not set
275# CONFIG_BT is not set
276CONFIG_NETDEVICES=y
277# CONFIG_DUMMY is not set
278# CONFIG_BONDING is not set
279# CONFIG_EQUALIZER is not set
280# CONFIG_TUN is not set
281
282#
283# ARCnet devices
284#
285# CONFIG_ARCNET is not set
286
287#
288# Ethernet (10 or 100Mbit)
289#
290CONFIG_NET_ETHERNET=y
291CONFIG_MII=y
292# CONFIG_HAPPYMEAL is not set
293# CONFIG_SUNGEM is not set
294# CONFIG_NET_VENDOR_3COM is not set
295
296#
297# Tulip family network device support
298#
299# CONFIG_NET_TULIP is not set
300# CONFIG_HP100 is not set
301# CONFIG_NET_PCI is not set
302
303#
304# Ethernet (1000 Mbit)
305#
306# CONFIG_ACENIC is not set
307# CONFIG_DL2K is not set
308# CONFIG_E1000 is not set
309# CONFIG_NS83820 is not set
310# CONFIG_HAMACHI is not set
311# CONFIG_YELLOWFIN is not set
312# CONFIG_R8169 is not set
313# CONFIG_SK98LIN is not set
314# CONFIG_TIGON3 is not set
315CONFIG_GIANFAR=y
316CONFIG_GFAR_NAPI=y
317
318#
319# Ethernet (10000 Mbit)
320#
321# CONFIG_IXGB is not set
322# CONFIG_S2IO is not set
323
324#
325# Token Ring devices
326#
327# CONFIG_TR is not set
328
329#
330# Wireless LAN (non-hamradio)
331#
332# CONFIG_NET_RADIO is not set
333
334#
335# Wan interfaces
336#
337# CONFIG_WAN is not set
338# CONFIG_FDDI is not set
339# CONFIG_HIPPI is not set
340# CONFIG_PPP is not set
341# CONFIG_SLIP is not set
342# CONFIG_SHAPER is not set
343# CONFIG_NETCONSOLE is not set
344
345#
346# ISDN subsystem
347#
348# CONFIG_ISDN is not set
349
350#
351# Telephony Support
352#
353# CONFIG_PHONE is not set
354
355#
356# Input device support
357#
358CONFIG_INPUT=y
359
360#
361# Userland interfaces
362#
363# CONFIG_INPUT_MOUSEDEV is not set
364# CONFIG_INPUT_JOYDEV is not set
365# CONFIG_INPUT_TSDEV is not set
366# CONFIG_INPUT_EVDEV is not set
367# CONFIG_INPUT_EVBUG is not set
368
369#
370# Input I/O drivers
371#
372# CONFIG_GAMEPORT is not set
373CONFIG_SOUND_GAMEPORT=y
374# CONFIG_SERIO is not set
375# CONFIG_SERIO_I8042 is not set
376
377#
378# Input Device Drivers
379#
380# CONFIG_INPUT_KEYBOARD is not set
381# CONFIG_INPUT_MOUSE is not set
382# CONFIG_INPUT_JOYSTICK is not set
383# CONFIG_INPUT_TOUCHSCREEN is not set
384# CONFIG_INPUT_MISC is not set
385
386#
387# Character devices
388#
389# CONFIG_VT is not set
390# CONFIG_SERIAL_NONSTANDARD is not set
391
392#
393# Serial drivers
394#
395CONFIG_SERIAL_8250=y
396CONFIG_SERIAL_8250_CONSOLE=y
397CONFIG_SERIAL_8250_NR_UARTS=4
398# CONFIG_SERIAL_8250_EXTENDED is not set
399
400#
401# Non-8250 serial port support
402#
403CONFIG_SERIAL_CORE=y
404CONFIG_SERIAL_CORE_CONSOLE=y
405CONFIG_UNIX98_PTYS=y
406CONFIG_LEGACY_PTYS=y
407CONFIG_LEGACY_PTY_COUNT=256
408
409#
410# IPMI
411#
412# CONFIG_IPMI_HANDLER is not set
413
414#
415# Watchdog Cards
416#
417# CONFIG_WATCHDOG is not set
418# CONFIG_NVRAM is not set
419CONFIG_GEN_RTC=y
420# CONFIG_GEN_RTC_X is not set
421# CONFIG_DTLK is not set
422# CONFIG_R3964 is not set
423# CONFIG_APPLICOM is not set
424
425#
426# Ftape, the floppy tape device driver
427#
428# CONFIG_AGP is not set
429# CONFIG_DRM is not set
430# CONFIG_RAW_DRIVER is not set
431
432#
433# I2C support
434#
435CONFIG_I2C=y
436CONFIG_I2C_CHARDEV=y
437
438#
439# I2C Algorithms
440#
441# CONFIG_I2C_ALGOBIT is not set
442# CONFIG_I2C_ALGOPCF is not set
443# CONFIG_I2C_ALGOPCA is not set
444
445#
446# I2C Hardware Bus support
447#
448# CONFIG_I2C_ALI1535 is not set
449# CONFIG_I2C_ALI1563 is not set
450# CONFIG_I2C_ALI15X3 is not set
451# CONFIG_I2C_AMD756 is not set
452# CONFIG_I2C_AMD8111 is not set
453# CONFIG_I2C_I801 is not set
454# CONFIG_I2C_I810 is not set
455# CONFIG_I2C_ISA is not set
456CONFIG_I2C_MPC=y
457# CONFIG_I2C_NFORCE2 is not set
458# CONFIG_I2C_PARPORT_LIGHT is not set
459# CONFIG_I2C_PIIX4 is not set
460# CONFIG_I2C_PROSAVAGE is not set
461# CONFIG_I2C_SAVAGE4 is not set
462# CONFIG_SCx200_ACB is not set
463# CONFIG_I2C_SIS5595 is not set
464# CONFIG_I2C_SIS630 is not set
465# CONFIG_I2C_SIS96X is not set
466# CONFIG_I2C_VIA is not set
467# CONFIG_I2C_VIAPRO is not set
468# CONFIG_I2C_VOODOO3 is not set
469# CONFIG_I2C_PCA_ISA is not set
470
471#
472# Hardware Sensors Chip support
473#
474# CONFIG_I2C_SENSOR is not set
475# CONFIG_SENSORS_ADM1021 is not set
476# CONFIG_SENSORS_ADM1025 is not set
477# CONFIG_SENSORS_ADM1026 is not set
478# CONFIG_SENSORS_ADM1031 is not set
479# CONFIG_SENSORS_ASB100 is not set
480# CONFIG_SENSORS_DS1621 is not set
481# CONFIG_SENSORS_FSCHER is not set
482# CONFIG_SENSORS_GL518SM is not set
483# CONFIG_SENSORS_IT87 is not set
484# CONFIG_SENSORS_LM63 is not set
485# CONFIG_SENSORS_LM75 is not set
486# CONFIG_SENSORS_LM77 is not set
487# CONFIG_SENSORS_LM78 is not set
488# CONFIG_SENSORS_LM80 is not set
489# CONFIG_SENSORS_LM83 is not set
490# CONFIG_SENSORS_LM85 is not set
491# CONFIG_SENSORS_LM87 is not set
492# CONFIG_SENSORS_LM90 is not set
493# CONFIG_SENSORS_MAX1619 is not set
494# CONFIG_SENSORS_PC87360 is not set
495# CONFIG_SENSORS_SMSC47B397 is not set
496# CONFIG_SENSORS_SMSC47M1 is not set
497# CONFIG_SENSORS_VIA686A is not set
498# CONFIG_SENSORS_W83781D is not set
499# CONFIG_SENSORS_W83L785TS is not set
500# CONFIG_SENSORS_W83627HF is not set
501
502#
503# Other I2C Chip support
504#
505# CONFIG_SENSORS_EEPROM is not set
506# CONFIG_SENSORS_PCF8574 is not set
507# CONFIG_SENSORS_PCF8591 is not set
508# CONFIG_SENSORS_RTC8564 is not set
509# CONFIG_I2C_DEBUG_CORE is not set
510# CONFIG_I2C_DEBUG_ALGO is not set
511# CONFIG_I2C_DEBUG_BUS is not set
512# CONFIG_I2C_DEBUG_CHIP is not set
513
514#
515# Dallas's 1-wire bus
516#
517# CONFIG_W1 is not set
518
519#
520# Misc devices
521#
522
523#
524# Multimedia devices
525#
526# CONFIG_VIDEO_DEV is not set
527
528#
529# Digital Video Broadcasting Devices
530#
531# CONFIG_DVB is not set
532
533#
534# Graphics support
535#
536# CONFIG_FB is not set
537# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
538
539#
540# Sound
541#
542# CONFIG_SOUND is not set
543
544#
545# USB support
546#
547# CONFIG_USB is not set
548CONFIG_USB_ARCH_HAS_HCD=y
549CONFIG_USB_ARCH_HAS_OHCI=y
550
551#
552# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
553#
554
555#
556# USB Gadget Support
557#
558# CONFIG_USB_GADGET is not set
559
560#
561# MMC/SD Card support
562#
563# CONFIG_MMC is not set
564
565#
566# InfiniBand support
567#
568# CONFIG_INFINIBAND is not set
569
570#
571# File systems
572#
573CONFIG_EXT2_FS=y
574# CONFIG_EXT2_FS_XATTR is not set
575CONFIG_EXT3_FS=y
576CONFIG_EXT3_FS_XATTR=y
577# CONFIG_EXT3_FS_POSIX_ACL is not set
578# CONFIG_EXT3_FS_SECURITY is not set
579CONFIG_JBD=y
580# CONFIG_JBD_DEBUG is not set
581CONFIG_FS_MBCACHE=y
582# CONFIG_REISERFS_FS is not set
583# CONFIG_JFS_FS is not set
584# CONFIG_XFS_FS is not set
585# CONFIG_MINIX_FS is not set
586# CONFIG_ROMFS_FS is not set
587# CONFIG_QUOTA is not set
588CONFIG_DNOTIFY=y
589# CONFIG_AUTOFS_FS is not set
590# CONFIG_AUTOFS4_FS is not set
591
592#
593# CD-ROM/DVD Filesystems
594#
595# CONFIG_ISO9660_FS is not set
596# CONFIG_UDF_FS is not set
597
598#
599# DOS/FAT/NT Filesystems
600#
601# CONFIG_MSDOS_FS is not set
602# CONFIG_VFAT_FS is not set
603# CONFIG_NTFS_FS is not set
604
605#
606# Pseudo filesystems
607#
608CONFIG_PROC_FS=y
609CONFIG_PROC_KCORE=y
610CONFIG_SYSFS=y
611# CONFIG_DEVFS_FS is not set
612# CONFIG_DEVPTS_FS_XATTR is not set
613CONFIG_TMPFS=y
614# CONFIG_TMPFS_XATTR is not set
615# CONFIG_HUGETLB_PAGE is not set
616CONFIG_RAMFS=y
617
618#
619# Miscellaneous filesystems
620#
621# CONFIG_ADFS_FS is not set
622# CONFIG_AFFS_FS is not set
623# CONFIG_HFS_FS is not set
624# CONFIG_HFSPLUS_FS is not set
625# CONFIG_BEFS_FS is not set
626# CONFIG_BFS_FS is not set
627# CONFIG_EFS_FS is not set
628# CONFIG_CRAMFS is not set
629# CONFIG_VXFS_FS is not set
630# CONFIG_HPFS_FS is not set
631# CONFIG_QNX4FS_FS is not set
632# CONFIG_SYSV_FS is not set
633# CONFIG_UFS_FS is not set
634
635#
636# Network File Systems
637#
638CONFIG_NFS_FS=y
639# CONFIG_NFS_V3 is not set
640# CONFIG_NFS_V4 is not set
641# CONFIG_NFS_DIRECTIO is not set
642# CONFIG_NFSD is not set
643CONFIG_ROOT_NFS=y
644CONFIG_LOCKD=y
645# CONFIG_EXPORTFS is not set
646CONFIG_SUNRPC=y
647# CONFIG_RPCSEC_GSS_KRB5 is not set
648# CONFIG_RPCSEC_GSS_SPKM3 is not set
649# CONFIG_SMB_FS is not set
650# CONFIG_CIFS is not set
651# CONFIG_NCP_FS is not set
652# CONFIG_CODA_FS is not set
653# CONFIG_AFS_FS is not set
654
655#
656# Partition Types
657#
658CONFIG_PARTITION_ADVANCED=y
659# CONFIG_ACORN_PARTITION is not set
660# CONFIG_OSF_PARTITION is not set
661# CONFIG_AMIGA_PARTITION is not set
662# CONFIG_ATARI_PARTITION is not set
663# CONFIG_MAC_PARTITION is not set
664# CONFIG_MSDOS_PARTITION is not set
665# CONFIG_LDM_PARTITION is not set
666# CONFIG_SGI_PARTITION is not set
667# CONFIG_ULTRIX_PARTITION is not set
668# CONFIG_SUN_PARTITION is not set
669# CONFIG_EFI_PARTITION is not set
670
671#
672# Native Language Support
673#
674# CONFIG_NLS is not set
675
676#
677# Library routines
678#
679# CONFIG_CRC_CCITT is not set
680CONFIG_CRC32=y
681# CONFIG_LIBCRC32C is not set
682
683#
684# Profiling support
685#
686# CONFIG_PROFILING is not set
687
688#
689# Kernel hacking
690#
691# CONFIG_DEBUG_KERNEL is not set
692# CONFIG_SERIAL_TEXT_DEBUG is not set
693
694#
695# Security options
696#
697# CONFIG_KEYS is not set
698# CONFIG_SECURITY is not set
699
700#
701# Cryptographic options
702#
703# CONFIG_CRYPTO is not set
704
705#
706# Hardware crypto devices
707#
diff --git a/arch/ppc/configs/mpc8555_cds_defconfig b/arch/ppc/configs/mpc8555_cds_defconfig
new file mode 100644
index 000000000000..728bd9e1a8fa
--- /dev/null
+++ b/arch/ppc/configs/mpc8555_cds_defconfig
@@ -0,0 +1,718 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc1
4# Thu Jan 20 01:25:35 2005
5#
6CONFIG_MMU=y
7CONFIG_GENERIC_HARDIRQS=y
8CONFIG_RWSEM_XCHGADD_ALGORITHM=y
9CONFIG_GENERIC_CALIBRATE_DELAY=y
10CONFIG_HAVE_DEC_LOCK=y
11CONFIG_PPC=y
12CONFIG_PPC32=y
13CONFIG_GENERIC_NVRAM=y
14
15#
16# Code maturity level options
17#
18CONFIG_EXPERIMENTAL=y
19CONFIG_CLEAN_COMPILE=y
20CONFIG_BROKEN_ON_SMP=y
21
22#
23# General setup
24#
25CONFIG_LOCALVERSION=""
26CONFIG_SWAP=y
27CONFIG_SYSVIPC=y
28# CONFIG_POSIX_MQUEUE is not set
29# CONFIG_BSD_PROCESS_ACCT is not set
30CONFIG_SYSCTL=y
31# CONFIG_AUDIT is not set
32CONFIG_LOG_BUF_SHIFT=14
33# CONFIG_HOTPLUG is not set
34CONFIG_KOBJECT_UEVENT=y
35# CONFIG_IKCONFIG is not set
36CONFIG_EMBEDDED=y
37# CONFIG_KALLSYMS is not set
38CONFIG_FUTEX=y
39# CONFIG_EPOLL is not set
40# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
41CONFIG_SHMEM=y
42CONFIG_CC_ALIGN_FUNCTIONS=0
43CONFIG_CC_ALIGN_LABELS=0
44CONFIG_CC_ALIGN_LOOPS=0
45CONFIG_CC_ALIGN_JUMPS=0
46# CONFIG_TINY_SHMEM is not set
47
48#
49# Loadable module support
50#
51# CONFIG_MODULES is not set
52
53#
54# Processor
55#
56# CONFIG_6xx is not set
57# CONFIG_40x is not set
58# CONFIG_44x is not set
59# CONFIG_POWER3 is not set
60# CONFIG_POWER4 is not set
61# CONFIG_8xx is not set
62CONFIG_E500=y
63CONFIG_BOOKE=y
64CONFIG_FSL_BOOKE=y
65CONFIG_SPE=y
66CONFIG_MATH_EMULATION=y
67# CONFIG_CPU_FREQ is not set
68CONFIG_PPC_GEN550=y
69CONFIG_85xx=y
70CONFIG_PPC_INDIRECT_PCI_BE=y
71
72#
73# Freescale 85xx options
74#
75# CONFIG_MPC8540_ADS is not set
76CONFIG_MPC8555_CDS=y
77# CONFIG_MPC8560_ADS is not set
78# CONFIG_SBC8560 is not set
79CONFIG_MPC8555=y
80CONFIG_85xx_PCI2=y
81
82#
83# Platform options
84#
85CONFIG_CPM2=y
86# CONFIG_PC_KEYBOARD is not set
87# CONFIG_SMP is not set
88# CONFIG_PREEMPT is not set
89# CONFIG_HIGHMEM is not set
90CONFIG_BINFMT_ELF=y
91# CONFIG_BINFMT_MISC is not set
92# CONFIG_CMDLINE_BOOL is not set
93
94#
95# Bus options
96#
97CONFIG_PCI=y
98CONFIG_PCI_DOMAINS=y
99# CONFIG_PCI_LEGACY_PROC is not set
100CONFIG_PCI_NAMES=y
101
102#
103# PCCARD (PCMCIA/CardBus) support
104#
105# CONFIG_PCCARD is not set
106
107#
108# PC-card bridges
109#
110
111#
112# Advanced setup
113#
114# CONFIG_ADVANCED_OPTIONS is not set
115
116#
117# Default settings for advanced configuration options are used
118#
119CONFIG_HIGHMEM_START=0xfe000000
120CONFIG_LOWMEM_SIZE=0x30000000
121CONFIG_KERNEL_START=0xc0000000
122CONFIG_TASK_SIZE=0x80000000
123CONFIG_BOOT_LOAD=0x00800000
124
125#
126# Device Drivers
127#
128
129#
130# Generic Driver Options
131#
132CONFIG_STANDALONE=y
133CONFIG_PREVENT_FIRMWARE_BUILD=y
134# CONFIG_FW_LOADER is not set
135
136#
137# Memory Technology Devices (MTD)
138#
139# CONFIG_MTD is not set
140
141#
142# Parallel port support
143#
144# CONFIG_PARPORT is not set
145
146#
147# Plug and Play support
148#
149
150#
151# Block devices
152#
153# CONFIG_BLK_DEV_FD is not set
154# CONFIG_BLK_CPQ_DA is not set
155# CONFIG_BLK_CPQ_CISS_DA is not set
156# CONFIG_BLK_DEV_DAC960 is not set
157# CONFIG_BLK_DEV_UMEM is not set
158# CONFIG_BLK_DEV_COW_COMMON is not set
159CONFIG_BLK_DEV_LOOP=y
160# CONFIG_BLK_DEV_CRYPTOLOOP is not set
161# CONFIG_BLK_DEV_NBD is not set
162# CONFIG_BLK_DEV_SX8 is not set
163CONFIG_BLK_DEV_RAM=y
164CONFIG_BLK_DEV_RAM_COUNT=16
165CONFIG_BLK_DEV_RAM_SIZE=32768
166CONFIG_BLK_DEV_INITRD=y
167CONFIG_INITRAMFS_SOURCE=""
168# CONFIG_LBD is not set
169# CONFIG_CDROM_PKTCDVD is not set
170
171#
172# IO Schedulers
173#
174CONFIG_IOSCHED_NOOP=y
175CONFIG_IOSCHED_AS=y
176CONFIG_IOSCHED_DEADLINE=y
177CONFIG_IOSCHED_CFQ=y
178# CONFIG_ATA_OVER_ETH is not set
179
180#
181# ATA/ATAPI/MFM/RLL support
182#
183# CONFIG_IDE is not set
184
185#
186# SCSI device support
187#
188# CONFIG_SCSI is not set
189
190#
191# Multi-device support (RAID and LVM)
192#
193# CONFIG_MD is not set
194
195#
196# Fusion MPT device support
197#
198
199#
200# IEEE 1394 (FireWire) support
201#
202# CONFIG_IEEE1394 is not set
203
204#
205# I2O device support
206#
207# CONFIG_I2O is not set
208
209#
210# Macintosh device drivers
211#
212
213#
214# Networking support
215#
216CONFIG_NET=y
217
218#
219# Networking options
220#
221CONFIG_PACKET=y
222# CONFIG_PACKET_MMAP is not set
223# CONFIG_NETLINK_DEV is not set
224CONFIG_UNIX=y
225# CONFIG_NET_KEY is not set
226CONFIG_INET=y
227CONFIG_IP_MULTICAST=y
228# CONFIG_IP_ADVANCED_ROUTER is not set
229CONFIG_IP_PNP=y
230CONFIG_IP_PNP_DHCP=y
231CONFIG_IP_PNP_BOOTP=y
232# CONFIG_IP_PNP_RARP is not set
233# CONFIG_NET_IPIP is not set
234# CONFIG_NET_IPGRE is not set
235# CONFIG_IP_MROUTE is not set
236# CONFIG_ARPD is not set
237CONFIG_SYN_COOKIES=y
238# CONFIG_INET_AH is not set
239# CONFIG_INET_ESP is not set
240# CONFIG_INET_IPCOMP is not set
241# CONFIG_INET_TUNNEL is not set
242CONFIG_IP_TCPDIAG=y
243# CONFIG_IP_TCPDIAG_IPV6 is not set
244# CONFIG_IPV6 is not set
245# CONFIG_NETFILTER is not set
246
247#
248# SCTP Configuration (EXPERIMENTAL)
249#
250# CONFIG_IP_SCTP is not set
251# CONFIG_ATM is not set
252# CONFIG_BRIDGE is not set
253# CONFIG_VLAN_8021Q is not set
254# CONFIG_DECNET is not set
255# CONFIG_LLC2 is not set
256# CONFIG_IPX is not set
257# CONFIG_ATALK is not set
258# CONFIG_X25 is not set
259# CONFIG_LAPB is not set
260# CONFIG_NET_DIVERT is not set
261# CONFIG_ECONET is not set
262# CONFIG_WAN_ROUTER is not set
263
264#
265# QoS and/or fair queueing
266#
267# CONFIG_NET_SCHED is not set
268# CONFIG_NET_CLS_ROUTE is not set
269
270#
271# Network testing
272#
273# CONFIG_NET_PKTGEN is not set
274# CONFIG_NETPOLL is not set
275# CONFIG_NET_POLL_CONTROLLER is not set
276# CONFIG_HAMRADIO is not set
277# CONFIG_IRDA is not set
278# CONFIG_BT is not set
279CONFIG_NETDEVICES=y
280# CONFIG_DUMMY is not set
281# CONFIG_BONDING is not set
282# CONFIG_EQUALIZER is not set
283# CONFIG_TUN is not set
284
285#
286# ARCnet devices
287#
288# CONFIG_ARCNET is not set
289
290#
291# Ethernet (10 or 100Mbit)
292#
293CONFIG_NET_ETHERNET=y
294CONFIG_MII=y
295# CONFIG_HAPPYMEAL is not set
296# CONFIG_SUNGEM is not set
297# CONFIG_NET_VENDOR_3COM is not set
298
299#
300# Tulip family network device support
301#
302# CONFIG_NET_TULIP is not set
303# CONFIG_HP100 is not set
304# CONFIG_NET_PCI is not set
305
306#
307# Ethernet (1000 Mbit)
308#
309# CONFIG_ACENIC is not set
310# CONFIG_DL2K is not set
311# CONFIG_E1000 is not set
312# CONFIG_NS83820 is not set
313# CONFIG_HAMACHI is not set
314# CONFIG_YELLOWFIN is not set
315# CONFIG_R8169 is not set
316# CONFIG_SK98LIN is not set
317# CONFIG_TIGON3 is not set
318CONFIG_GIANFAR=y
319CONFIG_GFAR_NAPI=y
320
321#
322# Ethernet (10000 Mbit)
323#
324# CONFIG_IXGB is not set
325# CONFIG_S2IO is not set
326
327#
328# Token Ring devices
329#
330# CONFIG_TR is not set
331
332#
333# Wireless LAN (non-hamradio)
334#
335# CONFIG_NET_RADIO is not set
336
337#
338# Wan interfaces
339#
340# CONFIG_WAN is not set
341# CONFIG_FDDI is not set
342# CONFIG_HIPPI is not set
343# CONFIG_PPP is not set
344# CONFIG_SLIP is not set
345# CONFIG_SHAPER is not set
346# CONFIG_NETCONSOLE is not set
347
348#
349# ISDN subsystem
350#
351# CONFIG_ISDN is not set
352
353#
354# Telephony Support
355#
356# CONFIG_PHONE is not set
357
358#
359# Input device support
360#
361CONFIG_INPUT=y
362
363#
364# Userland interfaces
365#
366# CONFIG_INPUT_MOUSEDEV is not set
367# CONFIG_INPUT_JOYDEV is not set
368# CONFIG_INPUT_TSDEV is not set
369# CONFIG_INPUT_EVDEV is not set
370# CONFIG_INPUT_EVBUG is not set
371
372#
373# Input I/O drivers
374#
375# CONFIG_GAMEPORT is not set
376CONFIG_SOUND_GAMEPORT=y
377# CONFIG_SERIO is not set
378# CONFIG_SERIO_I8042 is not set
379
380#
381# Input Device Drivers
382#
383# CONFIG_INPUT_KEYBOARD is not set
384# CONFIG_INPUT_MOUSE is not set
385# CONFIG_INPUT_JOYSTICK is not set
386# CONFIG_INPUT_TOUCHSCREEN is not set
387# CONFIG_INPUT_MISC is not set
388
389#
390# Character devices
391#
392# CONFIG_VT is not set
393# CONFIG_SERIAL_NONSTANDARD is not set
394
395#
396# Serial drivers
397#
398CONFIG_SERIAL_8250=y
399CONFIG_SERIAL_8250_CONSOLE=y
400CONFIG_SERIAL_8250_NR_UARTS=4
401# CONFIG_SERIAL_8250_EXTENDED is not set
402
403#
404# Non-8250 serial port support
405#
406CONFIG_SERIAL_CORE=y
407CONFIG_SERIAL_CORE_CONSOLE=y
408# CONFIG_SERIAL_CPM is not set
409CONFIG_UNIX98_PTYS=y
410CONFIG_LEGACY_PTYS=y
411CONFIG_LEGACY_PTY_COUNT=256
412
413#
414# IPMI
415#
416# CONFIG_IPMI_HANDLER is not set
417
418#
419# Watchdog Cards
420#
421# CONFIG_WATCHDOG is not set
422# CONFIG_NVRAM is not set
423CONFIG_GEN_RTC=y
424# CONFIG_GEN_RTC_X is not set
425# CONFIG_DTLK is not set
426# CONFIG_R3964 is not set
427# CONFIG_APPLICOM is not set
428
429#
430# Ftape, the floppy tape device driver
431#
432# CONFIG_AGP is not set
433# CONFIG_DRM is not set
434# CONFIG_RAW_DRIVER is not set
435
436#
437# I2C support
438#
439CONFIG_I2C=y
440CONFIG_I2C_CHARDEV=y
441
442#
443# I2C Algorithms
444#
445# CONFIG_I2C_ALGOBIT is not set
446# CONFIG_I2C_ALGOPCF is not set
447# CONFIG_I2C_ALGOPCA is not set
448
449#
450# I2C Hardware Bus support
451#
452# CONFIG_I2C_ALI1535 is not set
453# CONFIG_I2C_ALI1563 is not set
454# CONFIG_I2C_ALI15X3 is not set
455# CONFIG_I2C_AMD756 is not set
456# CONFIG_I2C_AMD8111 is not set
457# CONFIG_I2C_I801 is not set
458# CONFIG_I2C_I810 is not set
459# CONFIG_I2C_ISA is not set
460CONFIG_I2C_MPC=y
461# CONFIG_I2C_NFORCE2 is not set
462# CONFIG_I2C_PARPORT_LIGHT is not set
463# CONFIG_I2C_PIIX4 is not set
464# CONFIG_I2C_PROSAVAGE is not set
465# CONFIG_I2C_SAVAGE4 is not set
466# CONFIG_SCx200_ACB is not set
467# CONFIG_I2C_SIS5595 is not set
468# CONFIG_I2C_SIS630 is not set
469# CONFIG_I2C_SIS96X is not set
470# CONFIG_I2C_VIA is not set
471# CONFIG_I2C_VIAPRO is not set
472# CONFIG_I2C_VOODOO3 is not set
473# CONFIG_I2C_PCA_ISA is not set
474
475#
476# Hardware Sensors Chip support
477#
478# CONFIG_I2C_SENSOR is not set
479# CONFIG_SENSORS_ADM1021 is not set
480# CONFIG_SENSORS_ADM1025 is not set
481# CONFIG_SENSORS_ADM1026 is not set
482# CONFIG_SENSORS_ADM1031 is not set
483# CONFIG_SENSORS_ASB100 is not set
484# CONFIG_SENSORS_DS1621 is not set
485# CONFIG_SENSORS_FSCHER is not set
486# CONFIG_SENSORS_GL518SM is not set
487# CONFIG_SENSORS_IT87 is not set
488# CONFIG_SENSORS_LM63 is not set
489# CONFIG_SENSORS_LM75 is not set
490# CONFIG_SENSORS_LM77 is not set
491# CONFIG_SENSORS_LM78 is not set
492# CONFIG_SENSORS_LM80 is not set
493# CONFIG_SENSORS_LM83 is not set
494# CONFIG_SENSORS_LM85 is not set
495# CONFIG_SENSORS_LM87 is not set
496# CONFIG_SENSORS_LM90 is not set
497# CONFIG_SENSORS_MAX1619 is not set
498# CONFIG_SENSORS_PC87360 is not set
499# CONFIG_SENSORS_SMSC47B397 is not set
500# CONFIG_SENSORS_SMSC47M1 is not set
501# CONFIG_SENSORS_VIA686A is not set
502# CONFIG_SENSORS_W83781D is not set
503# CONFIG_SENSORS_W83L785TS is not set
504# CONFIG_SENSORS_W83627HF is not set
505
506#
507# Other I2C Chip support
508#
509# CONFIG_SENSORS_EEPROM is not set
510# CONFIG_SENSORS_PCF8574 is not set
511# CONFIG_SENSORS_PCF8591 is not set
512# CONFIG_SENSORS_RTC8564 is not set
513# CONFIG_I2C_DEBUG_CORE is not set
514# CONFIG_I2C_DEBUG_ALGO is not set
515# CONFIG_I2C_DEBUG_BUS is not set
516# CONFIG_I2C_DEBUG_CHIP is not set
517
518#
519# Dallas's 1-wire bus
520#
521# CONFIG_W1 is not set
522
523#
524# Misc devices
525#
526
527#
528# Multimedia devices
529#
530# CONFIG_VIDEO_DEV is not set
531
532#
533# Digital Video Broadcasting Devices
534#
535# CONFIG_DVB is not set
536
537#
538# Graphics support
539#
540# CONFIG_FB is not set
541# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
542
543#
544# Sound
545#
546# CONFIG_SOUND is not set
547
548#
549# USB support
550#
551# CONFIG_USB is not set
552CONFIG_USB_ARCH_HAS_HCD=y
553CONFIG_USB_ARCH_HAS_OHCI=y
554
555#
556# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
557#
558
559#
560# USB Gadget Support
561#
562# CONFIG_USB_GADGET is not set
563
564#
565# MMC/SD Card support
566#
567# CONFIG_MMC is not set
568
569#
570# InfiniBand support
571#
572# CONFIG_INFINIBAND is not set
573
574#
575# File systems
576#
577CONFIG_EXT2_FS=y
578# CONFIG_EXT2_FS_XATTR is not set
579CONFIG_EXT3_FS=y
580CONFIG_EXT3_FS_XATTR=y
581# CONFIG_EXT3_FS_POSIX_ACL is not set
582# CONFIG_EXT3_FS_SECURITY is not set
583CONFIG_JBD=y
584# CONFIG_JBD_DEBUG is not set
585CONFIG_FS_MBCACHE=y
586# CONFIG_REISERFS_FS is not set
587# CONFIG_JFS_FS is not set
588# CONFIG_XFS_FS is not set
589# CONFIG_MINIX_FS is not set
590# CONFIG_ROMFS_FS is not set
591# CONFIG_QUOTA is not set
592CONFIG_DNOTIFY=y
593# CONFIG_AUTOFS_FS is not set
594# CONFIG_AUTOFS4_FS is not set
595
596#
597# CD-ROM/DVD Filesystems
598#
599# CONFIG_ISO9660_FS is not set
600# CONFIG_UDF_FS is not set
601
602#
603# DOS/FAT/NT Filesystems
604#
605# CONFIG_MSDOS_FS is not set
606# CONFIG_VFAT_FS is not set
607# CONFIG_NTFS_FS is not set
608
609#
610# Pseudo filesystems
611#
612CONFIG_PROC_FS=y
613CONFIG_PROC_KCORE=y
614CONFIG_SYSFS=y
615# CONFIG_DEVFS_FS is not set
616# CONFIG_DEVPTS_FS_XATTR is not set
617CONFIG_TMPFS=y
618# CONFIG_TMPFS_XATTR is not set
619# CONFIG_HUGETLB_PAGE is not set
620CONFIG_RAMFS=y
621
622#
623# Miscellaneous filesystems
624#
625# CONFIG_ADFS_FS is not set
626# CONFIG_AFFS_FS is not set
627# CONFIG_HFS_FS is not set
628# CONFIG_HFSPLUS_FS is not set
629# CONFIG_BEFS_FS is not set
630# CONFIG_BFS_FS is not set
631# CONFIG_EFS_FS is not set
632# CONFIG_CRAMFS is not set
633# CONFIG_VXFS_FS is not set
634# CONFIG_HPFS_FS is not set
635# CONFIG_QNX4FS_FS is not set
636# CONFIG_SYSV_FS is not set
637# CONFIG_UFS_FS is not set
638
639#
640# Network File Systems
641#
642CONFIG_NFS_FS=y
643# CONFIG_NFS_V3 is not set
644# CONFIG_NFS_V4 is not set
645# CONFIG_NFS_DIRECTIO is not set
646# CONFIG_NFSD is not set
647CONFIG_ROOT_NFS=y
648CONFIG_LOCKD=y
649# CONFIG_EXPORTFS is not set
650CONFIG_SUNRPC=y
651# CONFIG_RPCSEC_GSS_KRB5 is not set
652# CONFIG_RPCSEC_GSS_SPKM3 is not set
653# CONFIG_SMB_FS is not set
654# CONFIG_CIFS is not set
655# CONFIG_NCP_FS is not set
656# CONFIG_CODA_FS is not set
657# CONFIG_AFS_FS is not set
658
659#
660# Partition Types
661#
662CONFIG_PARTITION_ADVANCED=y
663# CONFIG_ACORN_PARTITION is not set
664# CONFIG_OSF_PARTITION is not set
665# CONFIG_AMIGA_PARTITION is not set
666# CONFIG_ATARI_PARTITION is not set
667# CONFIG_MAC_PARTITION is not set
668# CONFIG_MSDOS_PARTITION is not set
669# CONFIG_LDM_PARTITION is not set
670# CONFIG_SGI_PARTITION is not set
671# CONFIG_ULTRIX_PARTITION is not set
672# CONFIG_SUN_PARTITION is not set
673# CONFIG_EFI_PARTITION is not set
674
675#
676# Native Language Support
677#
678# CONFIG_NLS is not set
679# CONFIG_SCC_ENET is not set
680# CONFIG_FEC_ENET is not set
681
682#
683# CPM2 Options
684#
685
686#
687# Library routines
688#
689# CONFIG_CRC_CCITT is not set
690CONFIG_CRC32=y
691# CONFIG_LIBCRC32C is not set
692
693#
694# Profiling support
695#
696# CONFIG_PROFILING is not set
697
698#
699# Kernel hacking
700#
701# CONFIG_DEBUG_KERNEL is not set
702# CONFIG_KGDB_CONSOLE is not set
703# CONFIG_SERIAL_TEXT_DEBUG is not set
704
705#
706# Security options
707#
708# CONFIG_KEYS is not set
709# CONFIG_SECURITY is not set
710
711#
712# Cryptographic options
713#
714# CONFIG_CRYPTO is not set
715
716#
717# Hardware crypto devices
718#
diff --git a/arch/ppc/configs/mpc8560_ads_defconfig b/arch/ppc/configs/mpc8560_ads_defconfig
new file mode 100644
index 000000000000..38a343c9056a
--- /dev/null
+++ b/arch/ppc/configs/mpc8560_ads_defconfig
@@ -0,0 +1,719 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc1
4# Thu Jan 20 01:24:56 2005
5#
6CONFIG_MMU=y
7CONFIG_GENERIC_HARDIRQS=y
8CONFIG_RWSEM_XCHGADD_ALGORITHM=y
9CONFIG_GENERIC_CALIBRATE_DELAY=y
10CONFIG_HAVE_DEC_LOCK=y
11CONFIG_PPC=y
12CONFIG_PPC32=y
13CONFIG_GENERIC_NVRAM=y
14
15#
16# Code maturity level options
17#
18CONFIG_EXPERIMENTAL=y
19CONFIG_CLEAN_COMPILE=y
20CONFIG_BROKEN_ON_SMP=y
21
22#
23# General setup
24#
25CONFIG_LOCALVERSION=""
26CONFIG_SWAP=y
27CONFIG_SYSVIPC=y
28# CONFIG_POSIX_MQUEUE is not set
29# CONFIG_BSD_PROCESS_ACCT is not set
30CONFIG_SYSCTL=y
31# CONFIG_AUDIT is not set
32CONFIG_LOG_BUF_SHIFT=14
33# CONFIG_HOTPLUG is not set
34CONFIG_KOBJECT_UEVENT=y
35# CONFIG_IKCONFIG is not set
36CONFIG_EMBEDDED=y
37# CONFIG_KALLSYMS is not set
38CONFIG_FUTEX=y
39# CONFIG_EPOLL is not set
40# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
41CONFIG_SHMEM=y
42CONFIG_CC_ALIGN_FUNCTIONS=0
43CONFIG_CC_ALIGN_LABELS=0
44CONFIG_CC_ALIGN_LOOPS=0
45CONFIG_CC_ALIGN_JUMPS=0
46# CONFIG_TINY_SHMEM is not set
47
48#
49# Loadable module support
50#
51# CONFIG_MODULES is not set
52
53#
54# Processor
55#
56# CONFIG_6xx is not set
57# CONFIG_40x is not set
58# CONFIG_44x is not set
59# CONFIG_POWER3 is not set
60# CONFIG_POWER4 is not set
61# CONFIG_8xx is not set
62CONFIG_E500=y
63CONFIG_BOOKE=y
64CONFIG_FSL_BOOKE=y
65CONFIG_SPE=y
66CONFIG_MATH_EMULATION=y
67# CONFIG_CPU_FREQ is not set
68CONFIG_85xx=y
69CONFIG_PPC_INDIRECT_PCI_BE=y
70
71#
72# Freescale 85xx options
73#
74# CONFIG_MPC8540_ADS is not set
75# CONFIG_MPC8555_CDS is not set
76CONFIG_MPC8560_ADS=y
77# CONFIG_SBC8560 is not set
78CONFIG_MPC8560=y
79
80#
81# Platform options
82#
83CONFIG_CPM2=y
84# CONFIG_PC_KEYBOARD is not set
85# CONFIG_SMP is not set
86# CONFIG_PREEMPT is not set
87# CONFIG_HIGHMEM is not set
88CONFIG_BINFMT_ELF=y
89# CONFIG_BINFMT_MISC is not set
90# CONFIG_CMDLINE_BOOL is not set
91
92#
93# Bus options
94#
95CONFIG_PCI=y
96CONFIG_PCI_DOMAINS=y
97# CONFIG_PCI_LEGACY_PROC is not set
98CONFIG_PCI_NAMES=y
99
100#
101# PCCARD (PCMCIA/CardBus) support
102#
103# CONFIG_PCCARD is not set
104
105#
106# PC-card bridges
107#
108
109#
110# Advanced setup
111#
112# CONFIG_ADVANCED_OPTIONS is not set
113
114#
115# Default settings for advanced configuration options are used
116#
117CONFIG_HIGHMEM_START=0xfe000000
118CONFIG_LOWMEM_SIZE=0x30000000
119CONFIG_KERNEL_START=0xc0000000
120CONFIG_TASK_SIZE=0x80000000
121CONFIG_BOOT_LOAD=0x00800000
122
123#
124# Device Drivers
125#
126
127#
128# Generic Driver Options
129#
130CONFIG_STANDALONE=y
131CONFIG_PREVENT_FIRMWARE_BUILD=y
132# CONFIG_FW_LOADER is not set
133
134#
135# Memory Technology Devices (MTD)
136#
137# CONFIG_MTD is not set
138
139#
140# Parallel port support
141#
142# CONFIG_PARPORT is not set
143
144#
145# Plug and Play support
146#
147
148#
149# Block devices
150#
151# CONFIG_BLK_DEV_FD is not set
152# CONFIG_BLK_CPQ_DA is not set
153# CONFIG_BLK_CPQ_CISS_DA is not set
154# CONFIG_BLK_DEV_DAC960 is not set
155# CONFIG_BLK_DEV_UMEM is not set
156# CONFIG_BLK_DEV_COW_COMMON is not set
157CONFIG_BLK_DEV_LOOP=y
158# CONFIG_BLK_DEV_CRYPTOLOOP is not set
159# CONFIG_BLK_DEV_NBD is not set
160# CONFIG_BLK_DEV_SX8 is not set
161CONFIG_BLK_DEV_RAM=y
162CONFIG_BLK_DEV_RAM_COUNT=16
163CONFIG_BLK_DEV_RAM_SIZE=32768
164CONFIG_BLK_DEV_INITRD=y
165CONFIG_INITRAMFS_SOURCE=""
166# CONFIG_LBD is not set
167# CONFIG_CDROM_PKTCDVD is not set
168
169#
170# IO Schedulers
171#
172CONFIG_IOSCHED_NOOP=y
173CONFIG_IOSCHED_AS=y
174CONFIG_IOSCHED_DEADLINE=y
175CONFIG_IOSCHED_CFQ=y
176# CONFIG_ATA_OVER_ETH is not set
177
178#
179# ATA/ATAPI/MFM/RLL support
180#
181# CONFIG_IDE is not set
182
183#
184# SCSI device support
185#
186# CONFIG_SCSI is not set
187
188#
189# Multi-device support (RAID and LVM)
190#
191# CONFIG_MD is not set
192
193#
194# Fusion MPT device support
195#
196
197#
198# IEEE 1394 (FireWire) support
199#
200# CONFIG_IEEE1394 is not set
201
202#
203# I2O device support
204#
205# CONFIG_I2O is not set
206
207#
208# Macintosh device drivers
209#
210
211#
212# Networking support
213#
214CONFIG_NET=y
215
216#
217# Networking options
218#
219CONFIG_PACKET=y
220# CONFIG_PACKET_MMAP is not set
221# CONFIG_NETLINK_DEV is not set
222CONFIG_UNIX=y
223# CONFIG_NET_KEY is not set
224CONFIG_INET=y
225CONFIG_IP_MULTICAST=y
226# CONFIG_IP_ADVANCED_ROUTER is not set
227CONFIG_IP_PNP=y
228CONFIG_IP_PNP_DHCP=y
229CONFIG_IP_PNP_BOOTP=y
230# CONFIG_IP_PNP_RARP is not set
231# CONFIG_NET_IPIP is not set
232# CONFIG_NET_IPGRE is not set
233# CONFIG_IP_MROUTE is not set
234# CONFIG_ARPD is not set
235CONFIG_SYN_COOKIES=y
236# CONFIG_INET_AH is not set
237# CONFIG_INET_ESP is not set
238# CONFIG_INET_IPCOMP is not set
239# CONFIG_INET_TUNNEL is not set
240CONFIG_IP_TCPDIAG=y
241# CONFIG_IP_TCPDIAG_IPV6 is not set
242# CONFIG_IPV6 is not set
243# CONFIG_NETFILTER is not set
244
245#
246# SCTP Configuration (EXPERIMENTAL)
247#
248# CONFIG_IP_SCTP is not set
249# CONFIG_ATM is not set
250# CONFIG_BRIDGE is not set
251# CONFIG_VLAN_8021Q is not set
252# CONFIG_DECNET is not set
253# CONFIG_LLC2 is not set
254# CONFIG_IPX is not set
255# CONFIG_ATALK is not set
256# CONFIG_X25 is not set
257# CONFIG_LAPB is not set
258# CONFIG_NET_DIVERT is not set
259# CONFIG_ECONET is not set
260# CONFIG_WAN_ROUTER is not set
261
262#
263# QoS and/or fair queueing
264#
265# CONFIG_NET_SCHED is not set
266# CONFIG_NET_CLS_ROUTE is not set
267
268#
269# Network testing
270#
271# CONFIG_NET_PKTGEN is not set
272# CONFIG_NETPOLL is not set
273# CONFIG_NET_POLL_CONTROLLER is not set
274# CONFIG_HAMRADIO is not set
275# CONFIG_IRDA is not set
276# CONFIG_BT is not set
277CONFIG_NETDEVICES=y
278# CONFIG_DUMMY is not set
279# CONFIG_BONDING is not set
280# CONFIG_EQUALIZER is not set
281# CONFIG_TUN is not set
282
283#
284# ARCnet devices
285#
286# CONFIG_ARCNET is not set
287
288#
289# Ethernet (10 or 100Mbit)
290#
291CONFIG_NET_ETHERNET=y
292CONFIG_MII=y
293# CONFIG_HAPPYMEAL is not set
294# CONFIG_SUNGEM is not set
295# CONFIG_NET_VENDOR_3COM is not set
296
297#
298# Tulip family network device support
299#
300# CONFIG_NET_TULIP is not set
301# CONFIG_HP100 is not set
302# CONFIG_NET_PCI is not set
303
304#
305# Ethernet (1000 Mbit)
306#
307# CONFIG_ACENIC is not set
308# CONFIG_DL2K is not set
309# CONFIG_E1000 is not set
310# CONFIG_NS83820 is not set
311# CONFIG_HAMACHI is not set
312# CONFIG_YELLOWFIN is not set
313# CONFIG_R8169 is not set
314# CONFIG_SK98LIN is not set
315# CONFIG_TIGON3 is not set
316CONFIG_GIANFAR=y
317CONFIG_GFAR_NAPI=y
318
319#
320# Ethernet (10000 Mbit)
321#
322# CONFIG_IXGB is not set
323# CONFIG_S2IO is not set
324
325#
326# Token Ring devices
327#
328# CONFIG_TR is not set
329
330#
331# Wireless LAN (non-hamradio)
332#
333# CONFIG_NET_RADIO is not set
334
335#
336# Wan interfaces
337#
338# CONFIG_WAN is not set
339# CONFIG_FDDI is not set
340# CONFIG_HIPPI is not set
341# CONFIG_PPP is not set
342# CONFIG_SLIP is not set
343# CONFIG_SHAPER is not set
344# CONFIG_NETCONSOLE is not set
345
346#
347# ISDN subsystem
348#
349# CONFIG_ISDN is not set
350
351#
352# Telephony Support
353#
354# CONFIG_PHONE is not set
355
356#
357# Input device support
358#
359CONFIG_INPUT=y
360
361#
362# Userland interfaces
363#
364# CONFIG_INPUT_MOUSEDEV is not set
365# CONFIG_INPUT_JOYDEV is not set
366# CONFIG_INPUT_TSDEV is not set
367# CONFIG_INPUT_EVDEV is not set
368# CONFIG_INPUT_EVBUG is not set
369
370#
371# Input I/O drivers
372#
373# CONFIG_GAMEPORT is not set
374CONFIG_SOUND_GAMEPORT=y
375# CONFIG_SERIO is not set
376# CONFIG_SERIO_I8042 is not set
377
378#
379# Input Device Drivers
380#
381# CONFIG_INPUT_KEYBOARD is not set
382# CONFIG_INPUT_MOUSE is not set
383# CONFIG_INPUT_JOYSTICK is not set
384# CONFIG_INPUT_TOUCHSCREEN is not set
385# CONFIG_INPUT_MISC is not set
386
387#
388# Character devices
389#
390# CONFIG_VT is not set
391# CONFIG_SERIAL_NONSTANDARD is not set
392
393#
394# Serial drivers
395#
396# CONFIG_SERIAL_8250 is not set
397
398#
399# Non-8250 serial port support
400#
401CONFIG_SERIAL_CORE=y
402CONFIG_SERIAL_CORE_CONSOLE=y
403CONFIG_SERIAL_CPM=y
404CONFIG_SERIAL_CPM_CONSOLE=y
405CONFIG_SERIAL_CPM_SCC1=y
406# CONFIG_SERIAL_CPM_SCC2 is not set
407# CONFIG_SERIAL_CPM_SCC3 is not set
408CONFIG_SERIAL_CPM_SCC4=y
409# CONFIG_SERIAL_CPM_SMC1 is not set
410# CONFIG_SERIAL_CPM_SMC2 is not set
411CONFIG_UNIX98_PTYS=y
412CONFIG_LEGACY_PTYS=y
413CONFIG_LEGACY_PTY_COUNT=256
414
415#
416# IPMI
417#
418# CONFIG_IPMI_HANDLER is not set
419
420#
421# Watchdog Cards
422#
423# CONFIG_WATCHDOG is not set
424# CONFIG_NVRAM is not set
425CONFIG_GEN_RTC=y
426# CONFIG_GEN_RTC_X is not set
427# CONFIG_DTLK is not set
428# CONFIG_R3964 is not set
429# CONFIG_APPLICOM is not set
430
431#
432# Ftape, the floppy tape device driver
433#
434# CONFIG_AGP is not set
435# CONFIG_DRM is not set
436# CONFIG_RAW_DRIVER is not set
437
438#
439# I2C support
440#
441CONFIG_I2C=y
442CONFIG_I2C_CHARDEV=y
443
444#
445# I2C Algorithms
446#
447# CONFIG_I2C_ALGOBIT is not set
448# CONFIG_I2C_ALGOPCF is not set
449# CONFIG_I2C_ALGOPCA is not set
450
451#
452# I2C Hardware Bus support
453#
454# CONFIG_I2C_ALI1535 is not set
455# CONFIG_I2C_ALI1563 is not set
456# CONFIG_I2C_ALI15X3 is not set
457# CONFIG_I2C_AMD756 is not set
458# CONFIG_I2C_AMD8111 is not set
459# CONFIG_I2C_I801 is not set
460# CONFIG_I2C_I810 is not set
461# CONFIG_I2C_ISA is not set
462CONFIG_I2C_MPC=y
463# CONFIG_I2C_NFORCE2 is not set
464# CONFIG_I2C_PARPORT_LIGHT is not set
465# CONFIG_I2C_PIIX4 is not set
466# CONFIG_I2C_PROSAVAGE is not set
467# CONFIG_I2C_SAVAGE4 is not set
468# CONFIG_SCx200_ACB is not set
469# CONFIG_I2C_SIS5595 is not set
470# CONFIG_I2C_SIS630 is not set
471# CONFIG_I2C_SIS96X is not set
472# CONFIG_I2C_VIA is not set
473# CONFIG_I2C_VIAPRO is not set
474# CONFIG_I2C_VOODOO3 is not set
475# CONFIG_I2C_PCA_ISA is not set
476
477#
478# Hardware Sensors Chip support
479#
480# CONFIG_I2C_SENSOR is not set
481# CONFIG_SENSORS_ADM1021 is not set
482# CONFIG_SENSORS_ADM1025 is not set
483# CONFIG_SENSORS_ADM1026 is not set
484# CONFIG_SENSORS_ADM1031 is not set
485# CONFIG_SENSORS_ASB100 is not set
486# CONFIG_SENSORS_DS1621 is not set
487# CONFIG_SENSORS_FSCHER is not set
488# CONFIG_SENSORS_GL518SM is not set
489# CONFIG_SENSORS_IT87 is not set
490# CONFIG_SENSORS_LM63 is not set
491# CONFIG_SENSORS_LM75 is not set
492# CONFIG_SENSORS_LM77 is not set
493# CONFIG_SENSORS_LM78 is not set
494# CONFIG_SENSORS_LM80 is not set
495# CONFIG_SENSORS_LM83 is not set
496# CONFIG_SENSORS_LM85 is not set
497# CONFIG_SENSORS_LM87 is not set
498# CONFIG_SENSORS_LM90 is not set
499# CONFIG_SENSORS_MAX1619 is not set
500# CONFIG_SENSORS_PC87360 is not set
501# CONFIG_SENSORS_SMSC47B397 is not set
502# CONFIG_SENSORS_SMSC47M1 is not set
503# CONFIG_SENSORS_VIA686A is not set
504# CONFIG_SENSORS_W83781D is not set
505# CONFIG_SENSORS_W83L785TS is not set
506# CONFIG_SENSORS_W83627HF is not set
507
508#
509# Other I2C Chip support
510#
511# CONFIG_SENSORS_EEPROM is not set
512# CONFIG_SENSORS_PCF8574 is not set
513# CONFIG_SENSORS_PCF8591 is not set
514# CONFIG_SENSORS_RTC8564 is not set
515# CONFIG_I2C_DEBUG_CORE is not set
516# CONFIG_I2C_DEBUG_ALGO is not set
517# CONFIG_I2C_DEBUG_BUS is not set
518# CONFIG_I2C_DEBUG_CHIP is not set
519
520#
521# Dallas's 1-wire bus
522#
523# CONFIG_W1 is not set
524
525#
526# Misc devices
527#
528
529#
530# Multimedia devices
531#
532# CONFIG_VIDEO_DEV is not set
533
534#
535# Digital Video Broadcasting Devices
536#
537# CONFIG_DVB is not set
538
539#
540# Graphics support
541#
542# CONFIG_FB is not set
543# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
544
545#
546# Sound
547#
548# CONFIG_SOUND is not set
549
550#
551# USB support
552#
553# CONFIG_USB is not set
554CONFIG_USB_ARCH_HAS_HCD=y
555CONFIG_USB_ARCH_HAS_OHCI=y
556
557#
558# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
559#
560
561#
562# USB Gadget Support
563#
564# CONFIG_USB_GADGET is not set
565
566#
567# MMC/SD Card support
568#
569# CONFIG_MMC is not set
570
571#
572# InfiniBand support
573#
574# CONFIG_INFINIBAND is not set
575
576#
577# File systems
578#
579CONFIG_EXT2_FS=y
580# CONFIG_EXT2_FS_XATTR is not set
581CONFIG_EXT3_FS=y
582CONFIG_EXT3_FS_XATTR=y
583# CONFIG_EXT3_FS_POSIX_ACL is not set
584# CONFIG_EXT3_FS_SECURITY is not set
585CONFIG_JBD=y
586# CONFIG_JBD_DEBUG is not set
587CONFIG_FS_MBCACHE=y
588# CONFIG_REISERFS_FS is not set
589# CONFIG_JFS_FS is not set
590# CONFIG_XFS_FS is not set
591# CONFIG_MINIX_FS is not set
592# CONFIG_ROMFS_FS is not set
593# CONFIG_QUOTA is not set
594CONFIG_DNOTIFY=y
595# CONFIG_AUTOFS_FS is not set
596# CONFIG_AUTOFS4_FS is not set
597
598#
599# CD-ROM/DVD Filesystems
600#
601# CONFIG_ISO9660_FS is not set
602# CONFIG_UDF_FS is not set
603
604#
605# DOS/FAT/NT Filesystems
606#
607# CONFIG_MSDOS_FS is not set
608# CONFIG_VFAT_FS is not set
609# CONFIG_NTFS_FS is not set
610
611#
612# Pseudo filesystems
613#
614CONFIG_PROC_FS=y
615CONFIG_PROC_KCORE=y
616CONFIG_SYSFS=y
617# CONFIG_DEVFS_FS is not set
618# CONFIG_DEVPTS_FS_XATTR is not set
619CONFIG_TMPFS=y
620# CONFIG_TMPFS_XATTR is not set
621# CONFIG_HUGETLB_PAGE is not set
622CONFIG_RAMFS=y
623
624#
625# Miscellaneous filesystems
626#
627# CONFIG_ADFS_FS is not set
628# CONFIG_AFFS_FS is not set
629# CONFIG_HFS_FS is not set
630# CONFIG_HFSPLUS_FS is not set
631# CONFIG_BEFS_FS is not set
632# CONFIG_BFS_FS is not set
633# CONFIG_EFS_FS is not set
634# CONFIG_CRAMFS is not set
635# CONFIG_VXFS_FS is not set
636# CONFIG_HPFS_FS is not set
637# CONFIG_QNX4FS_FS is not set
638# CONFIG_SYSV_FS is not set
639# CONFIG_UFS_FS is not set
640
641#
642# Network File Systems
643#
644CONFIG_NFS_FS=y
645# CONFIG_NFS_V3 is not set
646# CONFIG_NFS_V4 is not set
647# CONFIG_NFS_DIRECTIO is not set
648# CONFIG_NFSD is not set
649CONFIG_ROOT_NFS=y
650CONFIG_LOCKD=y
651# CONFIG_EXPORTFS is not set
652CONFIG_SUNRPC=y
653# CONFIG_RPCSEC_GSS_KRB5 is not set
654# CONFIG_RPCSEC_GSS_SPKM3 is not set
655# CONFIG_SMB_FS is not set
656# CONFIG_CIFS is not set
657# CONFIG_NCP_FS is not set
658# CONFIG_CODA_FS is not set
659# CONFIG_AFS_FS is not set
660
661#
662# Partition Types
663#
664CONFIG_PARTITION_ADVANCED=y
665# CONFIG_ACORN_PARTITION is not set
666# CONFIG_OSF_PARTITION is not set
667# CONFIG_AMIGA_PARTITION is not set
668# CONFIG_ATARI_PARTITION is not set
669# CONFIG_MAC_PARTITION is not set
670# CONFIG_MSDOS_PARTITION is not set
671# CONFIG_LDM_PARTITION is not set
672# CONFIG_SGI_PARTITION is not set
673# CONFIG_ULTRIX_PARTITION is not set
674# CONFIG_SUN_PARTITION is not set
675# CONFIG_EFI_PARTITION is not set
676
677#
678# Native Language Support
679#
680# CONFIG_NLS is not set
681# CONFIG_SCC_ENET is not set
682# CONFIG_FEC_ENET is not set
683
684#
685# CPM2 Options
686#
687
688#
689# Library routines
690#
691# CONFIG_CRC_CCITT is not set
692CONFIG_CRC32=y
693# CONFIG_LIBCRC32C is not set
694
695#
696# Profiling support
697#
698# CONFIG_PROFILING is not set
699
700#
701# Kernel hacking
702#
703# CONFIG_DEBUG_KERNEL is not set
704# CONFIG_KGDB_CONSOLE is not set
705
706#
707# Security options
708#
709# CONFIG_KEYS is not set
710# CONFIG_SECURITY is not set
711
712#
713# Cryptographic options
714#
715# CONFIG_CRYPTO is not set
716
717#
718# Hardware crypto devices
719#
diff --git a/arch/ppc/configs/mvme5100_defconfig b/arch/ppc/configs/mvme5100_defconfig
new file mode 100644
index 000000000000..46776b9c1a33
--- /dev/null
+++ b/arch/ppc/configs/mvme5100_defconfig
@@ -0,0 +1,746 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.9-rc2
4# Wed Sep 22 09:53:26 2004
5#
6CONFIG_MMU=y
7CONFIG_RWSEM_XCHGADD_ALGORITHM=y
8CONFIG_HAVE_DEC_LOCK=y
9CONFIG_PPC=y
10CONFIG_PPC32=y
11CONFIG_GENERIC_NVRAM=y
12CONFIG_GENERIC_IOMAP=y
13
14#
15# Code maturity level options
16#
17CONFIG_EXPERIMENTAL=y
18CONFIG_CLEAN_COMPILE=y
19CONFIG_BROKEN_ON_SMP=y
20
21#
22# General setup
23#
24CONFIG_LOCALVERSION=""
25CONFIG_SWAP=y
26CONFIG_SYSVIPC=y
27# CONFIG_POSIX_MQUEUE is not set
28# CONFIG_BSD_PROCESS_ACCT is not set
29CONFIG_SYSCTL=y
30# CONFIG_AUDIT is not set
31CONFIG_LOG_BUF_SHIFT=14
32# CONFIG_HOTPLUG is not set
33# CONFIG_IKCONFIG is not set
34CONFIG_EMBEDDED=y
35CONFIG_KALLSYMS=y
36# CONFIG_KALLSYMS_EXTRA_PASS is not set
37CONFIG_FUTEX=y
38CONFIG_EPOLL=y
39CONFIG_IOSCHED_NOOP=y
40CONFIG_IOSCHED_AS=y
41CONFIG_IOSCHED_DEADLINE=y
42CONFIG_IOSCHED_CFQ=y
43# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
44CONFIG_SHMEM=y
45# CONFIG_TINY_SHMEM is not set
46
47#
48# Loadable module support
49#
50CONFIG_MODULES=y
51CONFIG_MODULE_UNLOAD=y
52# CONFIG_MODULE_FORCE_UNLOAD is not set
53CONFIG_OBSOLETE_MODPARM=y
54# CONFIG_MODVERSIONS is not set
55CONFIG_KMOD=y
56
57#
58# Processor
59#
60CONFIG_6xx=y
61# CONFIG_40x is not set
62# CONFIG_44x is not set
63# CONFIG_POWER3 is not set
64# CONFIG_POWER4 is not set
65# CONFIG_8xx is not set
66# CONFIG_E500 is not set
67CONFIG_ALTIVEC=y
68# CONFIG_TAU is not set
69# CONFIG_CPU_FREQ is not set
70CONFIG_PPC_STD_MMU=y
71
72#
73# Platform options
74#
75# CONFIG_PPC_MULTIPLATFORM is not set
76# CONFIG_APUS is not set
77# CONFIG_WILLOW is not set
78# CONFIG_PCORE is not set
79# CONFIG_POWERPMC250 is not set
80# CONFIG_EV64260 is not set
81# CONFIG_SPRUCE is not set
82# CONFIG_LOPEC is not set
83# CONFIG_MCPN765 is not set
84CONFIG_MVME5100=y
85# CONFIG_PPLUS is not set
86# CONFIG_PRPMC750 is not set
87# CONFIG_PRPMC800 is not set
88# CONFIG_SANDPOINT is not set
89# CONFIG_ADIR is not set
90# CONFIG_K2 is not set
91# CONFIG_PAL4 is not set
92# CONFIG_GEMINI is not set
93# CONFIG_EST8260 is not set
94# CONFIG_SBC82xx is not set
95# CONFIG_SBS8260 is not set
96# CONFIG_RPX8260 is not set
97# CONFIG_TQM8260 is not set
98# CONFIG_ADS8272 is not set
99# CONFIG_LITE5200 is not set
100# CONFIG_MVME5100_IPMC761_PRESENT is not set
101# CONFIG_SMP is not set
102# CONFIG_PREEMPT is not set
103# CONFIG_HIGHMEM is not set
104CONFIG_BINFMT_ELF=y
105# CONFIG_BINFMT_MISC is not set
106CONFIG_CMDLINE_BOOL=y
107CONFIG_CMDLINE="ip=on"
108
109#
110# Bus options
111#
112CONFIG_GENERIC_ISA_DMA=y
113CONFIG_PCI=y
114CONFIG_PCI_DOMAINS=y
115# CONFIG_PCI_LEGACY_PROC is not set
116# CONFIG_PCI_NAMES is not set
117
118#
119# Advanced setup
120#
121# CONFIG_ADVANCED_OPTIONS is not set
122
123#
124# Default settings for advanced configuration options are used
125#
126CONFIG_HIGHMEM_START=0xfe000000
127CONFIG_LOWMEM_SIZE=0x30000000
128CONFIG_KERNEL_START=0xc0000000
129CONFIG_TASK_SIZE=0x80000000
130CONFIG_BOOT_LOAD=0x00800000
131
132#
133# Device Drivers
134#
135
136#
137# Generic Driver Options
138#
139CONFIG_STANDALONE=y
140CONFIG_PREVENT_FIRMWARE_BUILD=y
141
142#
143# Memory Technology Devices (MTD)
144#
145# CONFIG_MTD is not set
146
147#
148# Parallel port support
149#
150# CONFIG_PARPORT is not set
151
152#
153# Plug and Play support
154#
155
156#
157# Block devices
158#
159# CONFIG_BLK_DEV_FD is not set
160# CONFIG_BLK_CPQ_DA is not set
161# CONFIG_BLK_CPQ_CISS_DA is not set
162# CONFIG_BLK_DEV_DAC960 is not set
163# CONFIG_BLK_DEV_UMEM is not set
164# CONFIG_BLK_DEV_LOOP is not set
165# CONFIG_BLK_DEV_NBD is not set
166# CONFIG_BLK_DEV_SX8 is not set
167CONFIG_BLK_DEV_RAM=y
168CONFIG_BLK_DEV_RAM_SIZE=4096
169CONFIG_BLK_DEV_INITRD=y
170# CONFIG_LBD is not set
171
172#
173# ATA/ATAPI/MFM/RLL support
174#
175CONFIG_IDE=y
176CONFIG_BLK_DEV_IDE=y
177
178#
179# Please see Documentation/ide.txt for help/info on IDE drives
180#
181# CONFIG_BLK_DEV_IDE_SATA is not set
182CONFIG_BLK_DEV_IDEDISK=y
183# CONFIG_IDEDISK_MULTI_MODE is not set
184# CONFIG_BLK_DEV_IDECD is not set
185# CONFIG_BLK_DEV_IDETAPE is not set
186# CONFIG_BLK_DEV_IDEFLOPPY is not set
187# CONFIG_BLK_DEV_IDESCSI is not set
188# CONFIG_IDE_TASK_IOCTL is not set
189# CONFIG_IDE_TASKFILE_IO is not set
190
191#
192# IDE chipset support/bugfixes
193#
194CONFIG_IDE_GENERIC=y
195# CONFIG_BLK_DEV_IDEPCI is not set
196# CONFIG_IDE_ARM is not set
197# CONFIG_BLK_DEV_IDEDMA is not set
198# CONFIG_IDEDMA_AUTO is not set
199# CONFIG_BLK_DEV_HD is not set
200
201#
202# SCSI device support
203#
204CONFIG_SCSI=y
205CONFIG_SCSI_PROC_FS=y
206
207#
208# SCSI support type (disk, tape, CD-ROM)
209#
210CONFIG_BLK_DEV_SD=y
211# CONFIG_CHR_DEV_ST is not set
212# CONFIG_CHR_DEV_OSST is not set
213CONFIG_BLK_DEV_SR=y
214# CONFIG_BLK_DEV_SR_VENDOR is not set
215# CONFIG_CHR_DEV_SG is not set
216
217#
218# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
219#
220# CONFIG_SCSI_MULTI_LUN is not set
221# CONFIG_SCSI_CONSTANTS is not set
222# CONFIG_SCSI_LOGGING is not set
223
224#
225# SCSI Transport Attributes
226#
227CONFIG_SCSI_SPI_ATTRS=y
228# CONFIG_SCSI_FC_ATTRS is not set
229
230#
231# SCSI low-level drivers
232#
233# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
234# CONFIG_SCSI_3W_9XXX is not set
235# CONFIG_SCSI_ACARD is not set
236# CONFIG_SCSI_AACRAID is not set
237# CONFIG_SCSI_AIC7XXX is not set
238# CONFIG_SCSI_AIC7XXX_OLD is not set
239# CONFIG_SCSI_AIC79XX is not set
240# CONFIG_SCSI_DPT_I2O is not set
241# CONFIG_MEGARAID_NEWGEN is not set
242# CONFIG_MEGARAID_LEGACY is not set
243# CONFIG_SCSI_SATA is not set
244# CONFIG_SCSI_BUSLOGIC is not set
245# CONFIG_SCSI_DMX3191D is not set
246# CONFIG_SCSI_EATA is not set
247# CONFIG_SCSI_EATA_PIO is not set
248# CONFIG_SCSI_FUTURE_DOMAIN is not set
249# CONFIG_SCSI_GDTH is not set
250# CONFIG_SCSI_IPS is not set
251# CONFIG_SCSI_INIA100 is not set
252CONFIG_SCSI_SYM53C8XX_2=y
253CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0
254CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=8
255CONFIG_SCSI_SYM53C8XX_MAX_TAGS=32
256# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set
257# CONFIG_SCSI_IPR is not set
258# CONFIG_SCSI_QLOGIC_ISP is not set
259# CONFIG_SCSI_QLOGIC_FC is not set
260# CONFIG_SCSI_QLOGIC_1280 is not set
261CONFIG_SCSI_QLA2XXX=y
262# CONFIG_SCSI_QLA21XX is not set
263# CONFIG_SCSI_QLA22XX is not set
264# CONFIG_SCSI_QLA2300 is not set
265# CONFIG_SCSI_QLA2322 is not set
266# CONFIG_SCSI_QLA6312 is not set
267# CONFIG_SCSI_QLA6322 is not set
268# CONFIG_SCSI_DC395x is not set
269# CONFIG_SCSI_DC390T is not set
270# CONFIG_SCSI_NSP32 is not set
271# CONFIG_SCSI_DEBUG is not set
272
273#
274# Multi-device support (RAID and LVM)
275#
276# CONFIG_MD is not set
277
278#
279# Fusion MPT device support
280#
281# CONFIG_FUSION is not set
282
283#
284# IEEE 1394 (FireWire) support
285#
286# CONFIG_IEEE1394 is not set
287
288#
289# I2O device support
290#
291# CONFIG_I2O is not set
292
293#
294# Macintosh device drivers
295#
296
297#
298# Networking support
299#
300CONFIG_NET=y
301
302#
303# Networking options
304#
305CONFIG_PACKET=y
306# CONFIG_PACKET_MMAP is not set
307# CONFIG_NETLINK_DEV is not set
308CONFIG_UNIX=y
309# CONFIG_NET_KEY is not set
310CONFIG_INET=y
311CONFIG_IP_MULTICAST=y
312# CONFIG_IP_ADVANCED_ROUTER is not set
313CONFIG_IP_PNP=y
314# CONFIG_IP_PNP_DHCP is not set
315CONFIG_IP_PNP_BOOTP=y
316# CONFIG_IP_PNP_RARP is not set
317# CONFIG_NET_IPIP is not set
318# CONFIG_NET_IPGRE is not set
319# CONFIG_IP_MROUTE is not set
320# CONFIG_ARPD is not set
321# CONFIG_SYN_COOKIES is not set
322# CONFIG_INET_AH is not set
323# CONFIG_INET_ESP is not set
324# CONFIG_INET_IPCOMP is not set
325CONFIG_INET_TUNNEL=m
326
327#
328# IP: Virtual Server Configuration
329#
330# CONFIG_IP_VS is not set
331# CONFIG_IPV6 is not set
332CONFIG_NETFILTER=y
333# CONFIG_NETFILTER_DEBUG is not set
334
335#
336# IP: Netfilter Configuration
337#
338CONFIG_IP_NF_CONNTRACK=m
339# CONFIG_IP_NF_CT_ACCT is not set
340# CONFIG_IP_NF_CT_PROTO_SCTP is not set
341CONFIG_IP_NF_FTP=m
342CONFIG_IP_NF_IRC=m
343CONFIG_IP_NF_TFTP=m
344CONFIG_IP_NF_AMANDA=m
345# CONFIG_IP_NF_QUEUE is not set
346CONFIG_IP_NF_IPTABLES=m
347# CONFIG_IP_NF_MATCH_LIMIT is not set
348# CONFIG_IP_NF_MATCH_IPRANGE is not set
349# CONFIG_IP_NF_MATCH_MAC is not set
350# CONFIG_IP_NF_MATCH_PKTTYPE is not set
351# CONFIG_IP_NF_MATCH_MARK is not set
352# CONFIG_IP_NF_MATCH_MULTIPORT is not set
353# CONFIG_IP_NF_MATCH_TOS is not set
354# CONFIG_IP_NF_MATCH_RECENT is not set
355# CONFIG_IP_NF_MATCH_ECN is not set
356# CONFIG_IP_NF_MATCH_DSCP is not set
357# CONFIG_IP_NF_MATCH_AH_ESP is not set
358# CONFIG_IP_NF_MATCH_LENGTH is not set
359# CONFIG_IP_NF_MATCH_TTL is not set
360# CONFIG_IP_NF_MATCH_TCPMSS is not set
361CONFIG_IP_NF_MATCH_HELPER=m
362# CONFIG_IP_NF_MATCH_STATE is not set
363# CONFIG_IP_NF_MATCH_CONNTRACK is not set
364# CONFIG_IP_NF_MATCH_OWNER is not set
365# CONFIG_IP_NF_MATCH_ADDRTYPE is not set
366# CONFIG_IP_NF_MATCH_REALM is not set
367# CONFIG_IP_NF_MATCH_SCTP is not set
368# CONFIG_IP_NF_FILTER is not set
369# CONFIG_IP_NF_TARGET_LOG is not set
370# CONFIG_IP_NF_TARGET_ULOG is not set
371# CONFIG_IP_NF_TARGET_TCPMSS is not set
372# CONFIG_IP_NF_NAT is not set
373# CONFIG_IP_NF_MANGLE is not set
374# CONFIG_IP_NF_RAW is not set
375# CONFIG_IP_NF_ARPTABLES is not set
376# CONFIG_IP_NF_COMPAT_IPCHAINS is not set
377# CONFIG_IP_NF_COMPAT_IPFWADM is not set
378CONFIG_XFRM=y
379CONFIG_XFRM_USER=y
380
381#
382# SCTP Configuration (EXPERIMENTAL)
383#
384# CONFIG_IP_SCTP is not set
385# CONFIG_ATM is not set
386# CONFIG_BRIDGE is not set
387# CONFIG_VLAN_8021Q is not set
388# CONFIG_DECNET is not set
389# CONFIG_LLC2 is not set
390# CONFIG_IPX is not set
391# CONFIG_ATALK is not set
392# CONFIG_X25 is not set
393# CONFIG_LAPB is not set
394# CONFIG_NET_DIVERT is not set
395# CONFIG_ECONET is not set
396# CONFIG_WAN_ROUTER is not set
397# CONFIG_NET_HW_FLOWCONTROL is not set
398
399#
400# QoS and/or fair queueing
401#
402# CONFIG_NET_SCHED is not set
403# CONFIG_NET_CLS_ROUTE is not set
404
405#
406# Network testing
407#
408# CONFIG_NET_PKTGEN is not set
409# CONFIG_NETPOLL is not set
410# CONFIG_NET_POLL_CONTROLLER is not set
411# CONFIG_HAMRADIO is not set
412# CONFIG_IRDA is not set
413# CONFIG_BT is not set
414CONFIG_NETDEVICES=y
415# CONFIG_DUMMY is not set
416# CONFIG_BONDING is not set
417# CONFIG_EQUALIZER is not set
418# CONFIG_TUN is not set
419
420#
421# ARCnet devices
422#
423# CONFIG_ARCNET is not set
424
425#
426# Ethernet (10 or 100Mbit)
427#
428CONFIG_NET_ETHERNET=y
429CONFIG_MII=y
430# CONFIG_HAPPYMEAL is not set
431# CONFIG_SUNGEM is not set
432# CONFIG_NET_VENDOR_3COM is not set
433
434#
435# Tulip family network device support
436#
437CONFIG_NET_TULIP=y
438# CONFIG_DE2104X is not set
439CONFIG_TULIP=y
440# CONFIG_TULIP_MWI is not set
441# CONFIG_TULIP_MMIO is not set
442# CONFIG_TULIP_NAPI is not set
443# CONFIG_DE4X5 is not set
444# CONFIG_WINBOND_840 is not set
445# CONFIG_DM9102 is not set
446# CONFIG_HP100 is not set
447CONFIG_NET_PCI=y
448# CONFIG_PCNET32 is not set
449# CONFIG_AMD8111_ETH is not set
450# CONFIG_ADAPTEC_STARFIRE is not set
451# CONFIG_B44 is not set
452# CONFIG_FORCEDETH is not set
453# CONFIG_DGRS is not set
454# CONFIG_EEPRO100 is not set
455CONFIG_E100=y
456# CONFIG_E100_NAPI is not set
457# CONFIG_FEALNX is not set
458# CONFIG_NATSEMI is not set
459# CONFIG_NE2K_PCI is not set
460# CONFIG_8139CP is not set
461# CONFIG_8139TOO is not set
462# CONFIG_SIS900 is not set
463# CONFIG_EPIC100 is not set
464# CONFIG_SUNDANCE is not set
465# CONFIG_TLAN is not set
466# CONFIG_VIA_RHINE is not set
467# CONFIG_VIA_VELOCITY is not set
468
469#
470# Ethernet (1000 Mbit)
471#
472# CONFIG_ACENIC is not set
473# CONFIG_DL2K is not set
474# CONFIG_E1000 is not set
475# CONFIG_NS83820 is not set
476# CONFIG_HAMACHI is not set
477# CONFIG_YELLOWFIN is not set
478# CONFIG_R8169 is not set
479# CONFIG_SK98LIN is not set
480# CONFIG_TIGON3 is not set
481
482#
483# Ethernet (10000 Mbit)
484#
485# CONFIG_IXGB is not set
486# CONFIG_S2IO is not set
487
488#
489# Token Ring devices
490#
491# CONFIG_TR is not set
492
493#
494# Wireless LAN (non-hamradio)
495#
496# CONFIG_NET_RADIO is not set
497
498#
499# Wan interfaces
500#
501# CONFIG_WAN is not set
502# CONFIG_FDDI is not set
503# CONFIG_HIPPI is not set
504# CONFIG_PPP is not set
505# CONFIG_SLIP is not set
506# CONFIG_NET_FC is not set
507# CONFIG_SHAPER is not set
508# CONFIG_NETCONSOLE is not set
509
510#
511# ISDN subsystem
512#
513# CONFIG_ISDN is not set
514
515#
516# Telephony Support
517#
518# CONFIG_PHONE is not set
519
520#
521# Input device support
522#
523# CONFIG_INPUT is not set
524
525#
526# Userland interfaces
527#
528
529#
530# Input I/O drivers
531#
532# CONFIG_GAMEPORT is not set
533CONFIG_SOUND_GAMEPORT=y
534# CONFIG_SERIO is not set
535# CONFIG_SERIO_I8042 is not set
536
537#
538# Input Device Drivers
539#
540
541#
542# Character devices
543#
544# CONFIG_VT is not set
545# CONFIG_SERIAL_NONSTANDARD is not set
546
547#
548# Serial drivers
549#
550CONFIG_SERIAL_8250=y
551CONFIG_SERIAL_8250_CONSOLE=y
552CONFIG_SERIAL_8250_NR_UARTS=4
553# CONFIG_SERIAL_8250_EXTENDED is not set
554
555#
556# Non-8250 serial port support
557#
558CONFIG_SERIAL_CORE=y
559CONFIG_SERIAL_CORE_CONSOLE=y
560CONFIG_UNIX98_PTYS=y
561CONFIG_LEGACY_PTYS=y
562CONFIG_LEGACY_PTY_COUNT=256
563
564#
565# IPMI
566#
567# CONFIG_IPMI_HANDLER is not set
568
569#
570# Watchdog Cards
571#
572# CONFIG_WATCHDOG is not set
573# CONFIG_NVRAM is not set
574CONFIG_GEN_RTC=y
575# CONFIG_GEN_RTC_X is not set
576# CONFIG_DTLK is not set
577# CONFIG_R3964 is not set
578# CONFIG_APPLICOM is not set
579
580#
581# Ftape, the floppy tape device driver
582#
583# CONFIG_AGP is not set
584# CONFIG_DRM is not set
585# CONFIG_RAW_DRIVER is not set
586
587#
588# I2C support
589#
590# CONFIG_I2C is not set
591
592#
593# Dallas's 1-wire bus
594#
595# CONFIG_W1 is not set
596
597#
598# Misc devices
599#
600
601#
602# Multimedia devices
603#
604# CONFIG_VIDEO_DEV is not set
605
606#
607# Digital Video Broadcasting Devices
608#
609# CONFIG_DVB is not set
610
611#
612# Graphics support
613#
614# CONFIG_FB is not set
615
616#
617# Sound
618#
619# CONFIG_SOUND is not set
620
621#
622# USB support
623#
624# CONFIG_USB is not set
625
626#
627# USB Gadget Support
628#
629# CONFIG_USB_GADGET is not set
630
631#
632# File systems
633#
634CONFIG_EXT2_FS=y
635# CONFIG_EXT2_FS_XATTR is not set
636# CONFIG_EXT3_FS is not set
637# CONFIG_JBD is not set
638# CONFIG_REISERFS_FS is not set
639# CONFIG_JFS_FS is not set
640# CONFIG_XFS_FS is not set
641# CONFIG_MINIX_FS is not set
642# CONFIG_ROMFS_FS is not set
643# CONFIG_QUOTA is not set
644# CONFIG_AUTOFS_FS is not set
645# CONFIG_AUTOFS4_FS is not set
646
647#
648# CD-ROM/DVD Filesystems
649#
650# CONFIG_ISO9660_FS is not set
651# CONFIG_UDF_FS is not set
652
653#
654# DOS/FAT/NT Filesystems
655#
656# CONFIG_MSDOS_FS is not set
657# CONFIG_VFAT_FS is not set
658# CONFIG_NTFS_FS is not set
659
660#
661# Pseudo filesystems
662#
663CONFIG_PROC_FS=y
664CONFIG_PROC_KCORE=y
665CONFIG_SYSFS=y
666# CONFIG_DEVFS_FS is not set
667# CONFIG_DEVPTS_FS_XATTR is not set
668CONFIG_TMPFS=y
669# CONFIG_HUGETLB_PAGE is not set
670CONFIG_RAMFS=y
671
672#
673# Miscellaneous filesystems
674#
675# CONFIG_ADFS_FS is not set
676# CONFIG_AFFS_FS is not set
677# CONFIG_HFS_FS is not set
678# CONFIG_HFSPLUS_FS is not set
679# CONFIG_BEFS_FS is not set
680# CONFIG_BFS_FS is not set
681# CONFIG_EFS_FS is not set
682# CONFIG_CRAMFS is not set
683# CONFIG_VXFS_FS is not set
684# CONFIG_HPFS_FS is not set
685# CONFIG_QNX4FS_FS is not set
686# CONFIG_SYSV_FS is not set
687# CONFIG_UFS_FS is not set
688
689#
690# Network File Systems
691#
692CONFIG_NFS_FS=y
693CONFIG_NFS_V3=y
694# CONFIG_NFS_V4 is not set
695# CONFIG_NFS_DIRECTIO is not set
696# CONFIG_NFSD is not set
697CONFIG_ROOT_NFS=y
698CONFIG_LOCKD=y
699CONFIG_LOCKD_V4=y
700# CONFIG_EXPORTFS is not set
701CONFIG_SUNRPC=y
702# CONFIG_RPCSEC_GSS_KRB5 is not set
703# CONFIG_RPCSEC_GSS_SPKM3 is not set
704# CONFIG_SMB_FS is not set
705# CONFIG_CIFS is not set
706# CONFIG_NCP_FS is not set
707# CONFIG_CODA_FS is not set
708# CONFIG_AFS_FS is not set
709
710#
711# Partition Types
712#
713# CONFIG_PARTITION_ADVANCED is not set
714CONFIG_MSDOS_PARTITION=y
715
716#
717# Native Language Support
718#
719# CONFIG_NLS is not set
720
721#
722# Library routines
723#
724# CONFIG_CRC_CCITT is not set
725CONFIG_CRC32=y
726# CONFIG_LIBCRC32C is not set
727
728#
729# Profiling support
730#
731# CONFIG_PROFILING is not set
732
733#
734# Kernel hacking
735#
736# CONFIG_DEBUG_KERNEL is not set
737
738#
739# Security options
740#
741# CONFIG_SECURITY is not set
742
743#
744# Cryptographic options
745#
746# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/oak_defconfig b/arch/ppc/configs/oak_defconfig
new file mode 100644
index 000000000000..366cc480cea3
--- /dev/null
+++ b/arch/ppc/configs/oak_defconfig
@@ -0,0 +1,485 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7
8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12
13#
14# General setup
15#
16CONFIG_SWAP=y
17CONFIG_SYSVIPC=y
18# CONFIG_BSD_PROCESS_ACCT is not set
19CONFIG_SYSCTL=y
20CONFIG_LOG_BUF_SHIFT=14
21CONFIG_EMBEDDED=y
22CONFIG_FUTEX=y
23# CONFIG_EPOLL is not set
24
25#
26# Loadable module support
27#
28CONFIG_MODULES=y
29CONFIG_MODULE_UNLOAD=y
30# CONFIG_MODULE_FORCE_UNLOAD is not set
31CONFIG_OBSOLETE_MODPARM=y
32# CONFIG_MODVERSIONS is not set
33CONFIG_KMOD=y
34
35#
36# Platform support
37#
38CONFIG_PPC=y
39CONFIG_PPC32=y
40# CONFIG_6xx is not set
41CONFIG_40x=y
42# CONFIG_POWER3 is not set
43# CONFIG_8xx is not set
44CONFIG_4xx=y
45
46#
47# IBM 4xx options
48#
49# CONFIG_ASH is not set
50# CONFIG_BEECH is not set
51# CONFIG_CEDAR is not set
52# CONFIG_CPCI405 is not set
53# CONFIG_EP405 is not set
54CONFIG_OAK=y
55# CONFIG_REDWOOD_4 is not set
56# CONFIG_REDWOOD_5 is not set
57# CONFIG_REDWOOD_6 is not set
58# CONFIG_SYCAMORE is not set
59# CONFIG_TIVO is not set
60# CONFIG_WALNUT is not set
61CONFIG_IBM405_ERR51=y
62CONFIG_403GCX=y
63# CONFIG_405_DMA is not set
64# CONFIG_PM is not set
65CONFIG_UART0_TTYS0=y
66# CONFIG_UART0_TTYS1 is not set
67CONFIG_NOT_COHERENT_CACHE=y
68# CONFIG_SMP is not set
69# CONFIG_PREEMPT is not set
70# CONFIG_MATH_EMULATION is not set
71# CONFIG_CPU_FREQ is not set
72
73#
74# General setup
75#
76# CONFIG_HIGHMEM is not set
77# CONFIG_PCI is not set
78# CONFIG_PCI_DOMAINS is not set
79# CONFIG_PC_KEYBOARD is not set
80CONFIG_KCORE_ELF=y
81CONFIG_BINFMT_ELF=y
82CONFIG_KERNEL_ELF=y
83# CONFIG_BINFMT_MISC is not set
84# CONFIG_HOTPLUG is not set
85
86#
87# Parallel port support
88#
89# CONFIG_PARPORT is not set
90# CONFIG_CMDLINE_BOOL is not set
91
92#
93# Advanced setup
94#
95# CONFIG_ADVANCED_OPTIONS is not set
96
97#
98# Default settings for advanced configuration options are used
99#
100CONFIG_HIGHMEM_START=0xfe000000
101CONFIG_LOWMEM_SIZE=0x30000000
102CONFIG_KERNEL_START=0xc0000000
103CONFIG_TASK_SIZE=0x80000000
104CONFIG_BOOT_LOAD=0x00400000
105
106#
107# Memory Technology Devices (MTD)
108#
109# CONFIG_MTD is not set
110
111#
112# Plug and Play support
113#
114# CONFIG_PNP is not set
115
116#
117# Block devices
118#
119# CONFIG_BLK_DEV_FD is not set
120CONFIG_BLK_DEV_LOOP=y
121# CONFIG_BLK_DEV_NBD is not set
122CONFIG_BLK_DEV_RAM=y
123CONFIG_BLK_DEV_RAM_SIZE=4096
124CONFIG_BLK_DEV_INITRD=y
125
126#
127# Multi-device support (RAID and LVM)
128#
129# CONFIG_MD is not set
130
131#
132# ATA/IDE/MFM/RLL support
133#
134# CONFIG_IDE is not set
135
136#
137# SCSI support
138#
139# CONFIG_SCSI is not set
140
141#
142# Fusion MPT device support
143#
144
145#
146# I2O device support
147#
148
149#
150# Networking support
151#
152CONFIG_NET=y
153
154#
155# Networking options
156#
157# CONFIG_PACKET is not set
158# CONFIG_NETLINK_DEV is not set
159# CONFIG_NETFILTER is not set
160CONFIG_UNIX=y
161# CONFIG_NET_KEY is not set
162CONFIG_INET=y
163CONFIG_IP_MULTICAST=y
164# CONFIG_IP_ADVANCED_ROUTER is not set
165CONFIG_IP_PNP=y
166# CONFIG_IP_PNP_DHCP is not set
167CONFIG_IP_PNP_BOOTP=y
168CONFIG_IP_PNP_RARP=y
169# CONFIG_NET_IPIP is not set
170# CONFIG_NET_IPGRE is not set
171# CONFIG_IP_MROUTE is not set
172# CONFIG_ARPD is not set
173# CONFIG_INET_ECN is not set
174CONFIG_SYN_COOKIES=y
175# CONFIG_INET_AH is not set
176# CONFIG_INET_ESP is not set
177# CONFIG_INET_IPCOMP is not set
178# CONFIG_IPV6 is not set
179# CONFIG_XFRM_USER is not set
180
181#
182# SCTP Configuration (EXPERIMENTAL)
183#
184CONFIG_IPV6_SCTP__=y
185# CONFIG_IP_SCTP is not set
186# CONFIG_ATM is not set
187# CONFIG_VLAN_8021Q is not set
188# CONFIG_LLC is not set
189# CONFIG_DECNET is not set
190# CONFIG_BRIDGE is not set
191# CONFIG_X25 is not set
192# CONFIG_LAPB is not set
193# CONFIG_NET_DIVERT is not set
194# CONFIG_ECONET is not set
195# CONFIG_WAN_ROUTER is not set
196# CONFIG_NET_HW_FLOWCONTROL is not set
197
198#
199# QoS and/or fair queueing
200#
201# CONFIG_NET_SCHED is not set
202
203#
204# Network testing
205#
206# CONFIG_NET_PKTGEN is not set
207CONFIG_NETDEVICES=y
208# CONFIG_DUMMY is not set
209# CONFIG_BONDING is not set
210# CONFIG_EQUALIZER is not set
211# CONFIG_TUN is not set
212# CONFIG_ETHERTAP is not set
213
214#
215# Ethernet (10 or 100Mbit)
216#
217CONFIG_NET_ETHERNET=y
218# CONFIG_MII is not set
219CONFIG_OAKNET=y
220
221#
222# Ethernet (1000 Mbit)
223#
224
225#
226# Ethernet (10000 Mbit)
227#
228# CONFIG_PPP is not set
229# CONFIG_SLIP is not set
230
231#
232# Wireless LAN (non-hamradio)
233#
234# CONFIG_NET_RADIO is not set
235
236#
237# Token Ring devices (depends on LLC=y)
238#
239# CONFIG_SHAPER is not set
240
241#
242# Wan interfaces
243#
244# CONFIG_WAN is not set
245
246#
247# Amateur Radio support
248#
249# CONFIG_HAMRADIO is not set
250
251#
252# IrDA (infrared) support
253#
254# CONFIG_IRDA is not set
255
256#
257# ISDN subsystem
258#
259# CONFIG_ISDN_BOOL is not set
260
261#
262# Graphics support
263#
264# CONFIG_FB is not set
265
266#
267# Old CD-ROM drivers (not SCSI, not IDE)
268#
269# CONFIG_CD_NO_IDESCSI is not set
270
271#
272# Input device support
273#
274# CONFIG_INPUT is not set
275
276#
277# Userland interfaces
278#
279
280#
281# Input I/O drivers
282#
283# CONFIG_GAMEPORT is not set
284CONFIG_SOUND_GAMEPORT=y
285# CONFIG_SERIO is not set
286
287#
288# Input Device Drivers
289#
290
291#
292# Macintosh device drivers
293#
294
295#
296# Character devices
297#
298# CONFIG_SERIAL_NONSTANDARD is not set
299
300#
301# Serial drivers
302#
303CONFIG_SERIAL_8250=y
304CONFIG_SERIAL_8250_CONSOLE=y
305# CONFIG_SERIAL_8250_EXTENDED is not set
306
307#
308# Non-8250 serial port support
309#
310CONFIG_SERIAL_CORE=y
311CONFIG_SERIAL_CORE_CONSOLE=y
312# CONFIG_UNIX98_PTYS is not set
313
314#
315# I2C support
316#
317# CONFIG_I2C is not set
318
319#
320# I2C Hardware Sensors Mainboard support
321#
322
323#
324# I2C Hardware Sensors Chip support
325#
326# CONFIG_I2C_SENSOR is not set
327
328#
329# Mice
330#
331# CONFIG_BUSMOUSE is not set
332# CONFIG_QIC02_TAPE is not set
333
334#
335# IPMI
336#
337# CONFIG_IPMI_HANDLER is not set
338
339#
340# Watchdog Cards
341#
342# CONFIG_WATCHDOG is not set
343# CONFIG_NVRAM is not set
344CONFIG_GEN_RTC=y
345# CONFIG_GEN_RTC_X is not set
346# CONFIG_DTLK is not set
347# CONFIG_R3964 is not set
348# CONFIG_APPLICOM is not set
349
350#
351# Ftape, the floppy tape device driver
352#
353# CONFIG_FTAPE is not set
354# CONFIG_AGP is not set
355# CONFIG_DRM is not set
356# CONFIG_RAW_DRIVER is not set
357# CONFIG_HANGCHECK_TIMER is not set
358
359#
360# Multimedia devices
361#
362# CONFIG_VIDEO_DEV is not set
363
364#
365# Digital Video Broadcasting Devices
366#
367# CONFIG_DVB is not set
368
369#
370# File systems
371#
372CONFIG_EXT2_FS=y
373# CONFIG_EXT2_FS_XATTR is not set
374# CONFIG_EXT3_FS is not set
375# CONFIG_JBD is not set
376# CONFIG_REISERFS_FS is not set
377# CONFIG_JFS_FS is not set
378# CONFIG_XFS_FS is not set
379# CONFIG_MINIX_FS is not set
380# CONFIG_ROMFS_FS is not set
381# CONFIG_QUOTA is not set
382# CONFIG_AUTOFS_FS is not set
383# CONFIG_AUTOFS4_FS is not set
384
385#
386# CD-ROM/DVD Filesystems
387#
388# CONFIG_ISO9660_FS is not set
389# CONFIG_UDF_FS is not set
390
391#
392# DOS/FAT/NT Filesystems
393#
394# CONFIG_FAT_FS is not set
395# CONFIG_NTFS_FS is not set
396
397#
398# Pseudo filesystems
399#
400CONFIG_PROC_FS=y
401# CONFIG_DEVFS_FS is not set
402CONFIG_TMPFS=y
403CONFIG_RAMFS=y
404
405#
406# Miscellaneous filesystems
407#
408# CONFIG_ADFS_FS is not set
409# CONFIG_AFFS_FS is not set
410# CONFIG_HFS_FS is not set
411# CONFIG_BEFS_FS is not set
412# CONFIG_BFS_FS is not set
413# CONFIG_EFS_FS is not set
414# CONFIG_CRAMFS is not set
415# CONFIG_VXFS_FS is not set
416# CONFIG_HPFS_FS is not set
417# CONFIG_QNX4FS_FS is not set
418# CONFIG_SYSV_FS is not set
419# CONFIG_UFS_FS is not set
420
421#
422# Network File Systems
423#
424CONFIG_NFS_FS=y
425# CONFIG_NFS_V3 is not set
426# CONFIG_NFS_V4 is not set
427# CONFIG_NFSD is not set
428CONFIG_ROOT_NFS=y
429CONFIG_LOCKD=y
430# CONFIG_EXPORTFS is not set
431CONFIG_SUNRPC=y
432# CONFIG_SUNRPC_GSS is not set
433# CONFIG_SMB_FS is not set
434# CONFIG_CIFS is not set
435# CONFIG_NCP_FS is not set
436# CONFIG_CODA_FS is not set
437# CONFIG_INTERMEZZO_FS is not set
438# CONFIG_AFS_FS is not set
439
440#
441# Partition Types
442#
443# CONFIG_PARTITION_ADVANCED is not set
444CONFIG_MSDOS_PARTITION=y
445
446#
447# Sound
448#
449# CONFIG_SOUND is not set
450
451#
452# IBM 40x options
453#
454
455#
456# USB support
457#
458# CONFIG_USB_GADGET is not set
459
460#
461# Bluetooth support
462#
463# CONFIG_BT is not set
464
465#
466# Library routines
467#
468# CONFIG_CRC32 is not set
469
470#
471# Kernel hacking
472#
473# CONFIG_DEBUG_KERNEL is not set
474# CONFIG_KALLSYMS is not set
475# CONFIG_SERIAL_TEXT_DEBUG is not set
476
477#
478# Security options
479#
480# CONFIG_SECURITY is not set
481
482#
483# Cryptographic options
484#
485# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/ocotea_defconfig b/arch/ppc/configs/ocotea_defconfig
new file mode 100644
index 000000000000..9dcf575c706f
--- /dev/null
+++ b/arch/ppc/configs/ocotea_defconfig
@@ -0,0 +1,599 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7CONFIG_PPC=y
8CONFIG_PPC32=y
9CONFIG_GENERIC_NVRAM=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16# CONFIG_STANDALONE is not set
17CONFIG_BROKEN_ON_SMP=y
18
19#
20# General setup
21#
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_POSIX_MQUEUE is not set
25# CONFIG_BSD_PROCESS_ACCT is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=14
29# CONFIG_HOTPLUG is not set
30# CONFIG_IKCONFIG is not set
31CONFIG_EMBEDDED=y
32CONFIG_KALLSYMS=y
33# CONFIG_KALLSYMS_ALL is not set
34CONFIG_FUTEX=y
35CONFIG_EPOLL=y
36CONFIG_IOSCHED_NOOP=y
37CONFIG_IOSCHED_AS=y
38CONFIG_IOSCHED_DEADLINE=y
39CONFIG_IOSCHED_CFQ=y
40# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
41
42#
43# Loadable module support
44#
45CONFIG_MODULES=y
46CONFIG_MODULE_UNLOAD=y
47# CONFIG_MODULE_FORCE_UNLOAD is not set
48CONFIG_OBSOLETE_MODPARM=y
49# CONFIG_MODVERSIONS is not set
50CONFIG_KMOD=y
51
52#
53# Processor
54#
55# CONFIG_6xx is not set
56# CONFIG_40x is not set
57CONFIG_44x=y
58# CONFIG_POWER3 is not set
59# CONFIG_POWER4 is not set
60# CONFIG_8xx is not set
61# CONFIG_E500 is not set
62CONFIG_BOOKE=y
63CONFIG_PTE_64BIT=y
64# CONFIG_MATH_EMULATION is not set
65# CONFIG_CPU_FREQ is not set
66CONFIG_4xx=y
67
68#
69# IBM 4xx options
70#
71# CONFIG_EBONY is not set
72CONFIG_OCOTEA=y
73CONFIG_440GX=y
74CONFIG_440A=y
75CONFIG_IBM_OCP=y
76CONFIG_IBM_EMAC4=y
77# CONFIG_PM is not set
78CONFIG_NOT_COHERENT_CACHE=y
79
80#
81# Platform options
82#
83# CONFIG_PC_KEYBOARD is not set
84# CONFIG_SMP is not set
85# CONFIG_PREEMPT is not set
86# CONFIG_HIGHMEM is not set
87CONFIG_KERNEL_ELF=y
88CONFIG_BINFMT_ELF=y
89# CONFIG_BINFMT_MISC is not set
90CONFIG_CMDLINE_BOOL=y
91CONFIG_CMDLINE="ip=on console=ttyS0,115200"
92
93#
94# Bus options
95#
96CONFIG_PCI=y
97CONFIG_PCI_DOMAINS=y
98# CONFIG_PCI_LEGACY_PROC is not set
99# CONFIG_PCI_NAMES is not set
100
101#
102# Advanced setup
103#
104# CONFIG_ADVANCED_OPTIONS is not set
105
106#
107# Default settings for advanced configuration options are used
108#
109CONFIG_HIGHMEM_START=0xfe000000
110CONFIG_LOWMEM_SIZE=0x30000000
111CONFIG_KERNEL_START=0xc0000000
112CONFIG_TASK_SIZE=0x80000000
113CONFIG_CONSISTENT_START=0xff100000
114CONFIG_CONSISTENT_SIZE=0x00200000
115CONFIG_BOOT_LOAD=0x01000000
116
117#
118# Device Drivers
119#
120
121#
122# Generic Driver Options
123#
124CONFIG_PREVENT_FIRMWARE_BUILD=y
125# CONFIG_DEBUG_DRIVER is not set
126
127#
128# Memory Technology Devices (MTD)
129#
130# CONFIG_MTD is not set
131
132#
133# Parallel port support
134#
135# CONFIG_PARPORT is not set
136
137#
138# Plug and Play support
139#
140
141#
142# Block devices
143#
144# CONFIG_BLK_DEV_FD is not set
145# CONFIG_BLK_CPQ_DA is not set
146# CONFIG_BLK_CPQ_CISS_DA is not set
147# CONFIG_BLK_DEV_DAC960 is not set
148# CONFIG_BLK_DEV_UMEM is not set
149# CONFIG_BLK_DEV_LOOP is not set
150# CONFIG_BLK_DEV_NBD is not set
151# CONFIG_BLK_DEV_SX8 is not set
152# CONFIG_BLK_DEV_RAM is not set
153# CONFIG_LBD is not set
154
155#
156# ATA/ATAPI/MFM/RLL support
157#
158# CONFIG_IDE is not set
159
160#
161# SCSI device support
162#
163# CONFIG_SCSI is not set
164
165#
166# Multi-device support (RAID and LVM)
167#
168# CONFIG_MD is not set
169
170#
171# Fusion MPT device support
172#
173
174#
175# IEEE 1394 (FireWire) support
176#
177# CONFIG_IEEE1394 is not set
178
179#
180# I2O device support
181#
182# CONFIG_I2O is not set
183
184#
185# Macintosh device drivers
186#
187
188#
189# Networking support
190#
191CONFIG_NET=y
192
193#
194# Networking options
195#
196CONFIG_PACKET=y
197# CONFIG_PACKET_MMAP is not set
198# CONFIG_NETLINK_DEV is not set
199CONFIG_UNIX=y
200# CONFIG_NET_KEY is not set
201CONFIG_INET=y
202# CONFIG_IP_MULTICAST is not set
203# CONFIG_IP_ADVANCED_ROUTER is not set
204CONFIG_IP_PNP=y
205# CONFIG_IP_PNP_DHCP is not set
206CONFIG_IP_PNP_BOOTP=y
207# CONFIG_IP_PNP_RARP is not set
208# CONFIG_NET_IPIP is not set
209# CONFIG_NET_IPGRE is not set
210# CONFIG_ARPD is not set
211# CONFIG_SYN_COOKIES is not set
212# CONFIG_INET_AH is not set
213# CONFIG_INET_ESP is not set
214# CONFIG_INET_IPCOMP is not set
215
216#
217# IP: Virtual Server Configuration
218#
219# CONFIG_IP_VS is not set
220# CONFIG_IPV6 is not set
221CONFIG_NETFILTER=y
222# CONFIG_NETFILTER_DEBUG is not set
223
224#
225# IP: Netfilter Configuration
226#
227# CONFIG_IP_NF_CONNTRACK is not set
228# CONFIG_IP_NF_QUEUE is not set
229# CONFIG_IP_NF_IPTABLES is not set
230# CONFIG_IP_NF_ARPTABLES is not set
231# CONFIG_IP_NF_COMPAT_IPCHAINS is not set
232# CONFIG_IP_NF_COMPAT_IPFWADM is not set
233
234#
235# SCTP Configuration (EXPERIMENTAL)
236#
237# CONFIG_IP_SCTP is not set
238# CONFIG_ATM is not set
239# CONFIG_BRIDGE is not set
240# CONFIG_VLAN_8021Q is not set
241# CONFIG_DECNET is not set
242# CONFIG_LLC2 is not set
243# CONFIG_IPX is not set
244# CONFIG_ATALK is not set
245# CONFIG_X25 is not set
246# CONFIG_LAPB is not set
247# CONFIG_NET_DIVERT is not set
248# CONFIG_ECONET is not set
249# CONFIG_WAN_ROUTER is not set
250# CONFIG_NET_HW_FLOWCONTROL is not set
251
252#
253# QoS and/or fair queueing
254#
255# CONFIG_NET_SCHED is not set
256# CONFIG_NET_CLS_ROUTE is not set
257
258#
259# Network testing
260#
261# CONFIG_NET_PKTGEN is not set
262# CONFIG_NETPOLL is not set
263# CONFIG_NET_POLL_CONTROLLER is not set
264# CONFIG_HAMRADIO is not set
265# CONFIG_IRDA is not set
266# CONFIG_BT is not set
267CONFIG_NETDEVICES=y
268# CONFIG_DUMMY is not set
269# CONFIG_BONDING is not set
270# CONFIG_EQUALIZER is not set
271# CONFIG_TUN is not set
272
273#
274# ARCnet devices
275#
276# CONFIG_ARCNET is not set
277
278#
279# Ethernet (10 or 100Mbit)
280#
281CONFIG_NET_ETHERNET=y
282# CONFIG_MII is not set
283# CONFIG_OAKNET is not set
284# CONFIG_HAPPYMEAL is not set
285# CONFIG_SUNGEM is not set
286# CONFIG_NET_VENDOR_3COM is not set
287
288#
289# Tulip family network device support
290#
291# CONFIG_NET_TULIP is not set
292# CONFIG_HP100 is not set
293CONFIG_IBM_EMAC=y
294# CONFIG_IBM_EMAC_ERRMSG is not set
295CONFIG_IBM_EMAC_RXB=128
296CONFIG_IBM_EMAC_TXB=128
297CONFIG_IBM_EMAC_FGAP=8
298CONFIG_IBM_EMAC_SKBRES=0
299# CONFIG_NET_PCI is not set
300
301#
302# Ethernet (1000 Mbit)
303#
304# CONFIG_ACENIC is not set
305# CONFIG_DL2K is not set
306# CONFIG_E1000 is not set
307# CONFIG_NS83820 is not set
308# CONFIG_HAMACHI is not set
309# CONFIG_YELLOWFIN is not set
310# CONFIG_R8169 is not set
311# CONFIG_SK98LIN is not set
312# CONFIG_TIGON3 is not set
313
314#
315# Ethernet (10000 Mbit)
316#
317# CONFIG_IXGB is not set
318# CONFIG_S2IO is not set
319
320#
321# Token Ring devices
322#
323# CONFIG_TR is not set
324
325#
326# Wireless LAN (non-hamradio)
327#
328# CONFIG_NET_RADIO is not set
329
330#
331# Wan interfaces
332#
333# CONFIG_WAN is not set
334# CONFIG_FDDI is not set
335# CONFIG_HIPPI is not set
336# CONFIG_PPP is not set
337# CONFIG_SLIP is not set
338# CONFIG_SHAPER is not set
339# CONFIG_NETCONSOLE is not set
340
341#
342# ISDN subsystem
343#
344# CONFIG_ISDN is not set
345
346#
347# Telephony Support
348#
349# CONFIG_PHONE is not set
350
351#
352# Input device support
353#
354CONFIG_INPUT=y
355
356#
357# Userland interfaces
358#
359CONFIG_INPUT_MOUSEDEV=y
360CONFIG_INPUT_MOUSEDEV_PSAUX=y
361CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
362CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
363# CONFIG_INPUT_JOYDEV is not set
364# CONFIG_INPUT_TSDEV is not set
365# CONFIG_INPUT_EVDEV is not set
366# CONFIG_INPUT_EVBUG is not set
367
368#
369# Input I/O drivers
370#
371# CONFIG_GAMEPORT is not set
372CONFIG_SOUND_GAMEPORT=y
373CONFIG_SERIO=y
374# CONFIG_SERIO_I8042 is not set
375# CONFIG_SERIO_SERPORT is not set
376# CONFIG_SERIO_CT82C710 is not set
377# CONFIG_SERIO_PCIPS2 is not set
378
379#
380# Input Device Drivers
381#
382# CONFIG_INPUT_KEYBOARD is not set
383# CONFIG_INPUT_MOUSE is not set
384# CONFIG_INPUT_JOYSTICK is not set
385# CONFIG_INPUT_TOUCHSCREEN is not set
386# CONFIG_INPUT_MISC is not set
387
388#
389# Character devices
390#
391# CONFIG_VT is not set
392# CONFIG_SERIAL_NONSTANDARD is not set
393
394#
395# Serial drivers
396#
397CONFIG_SERIAL_8250=y
398CONFIG_SERIAL_8250_CONSOLE=y
399CONFIG_SERIAL_8250_NR_UARTS=4
400CONFIG_SERIAL_8250_EXTENDED=y
401# CONFIG_SERIAL_8250_MANY_PORTS is not set
402CONFIG_SERIAL_8250_SHARE_IRQ=y
403# CONFIG_SERIAL_8250_DETECT_IRQ is not set
404# CONFIG_SERIAL_8250_MULTIPORT is not set
405# CONFIG_SERIAL_8250_RSA is not set
406
407#
408# Non-8250 serial port support
409#
410CONFIG_SERIAL_CORE=y
411CONFIG_SERIAL_CORE_CONSOLE=y
412CONFIG_UNIX98_PTYS=y
413CONFIG_LEGACY_PTYS=y
414CONFIG_LEGACY_PTY_COUNT=256
415# CONFIG_QIC02_TAPE is not set
416
417#
418# IPMI
419#
420# CONFIG_IPMI_HANDLER is not set
421
422#
423# Watchdog Cards
424#
425# CONFIG_WATCHDOG is not set
426# CONFIG_NVRAM is not set
427# CONFIG_GEN_RTC is not set
428# CONFIG_DTLK is not set
429# CONFIG_R3964 is not set
430# CONFIG_APPLICOM is not set
431
432#
433# Ftape, the floppy tape device driver
434#
435# CONFIG_FTAPE is not set
436# CONFIG_AGP is not set
437# CONFIG_DRM is not set
438# CONFIG_RAW_DRIVER is not set
439
440#
441# I2C support
442#
443# CONFIG_I2C is not set
444
445#
446# Misc devices
447#
448
449#
450# Multimedia devices
451#
452# CONFIG_VIDEO_DEV is not set
453
454#
455# Digital Video Broadcasting Devices
456#
457# CONFIG_DVB is not set
458
459#
460# Graphics support
461#
462# CONFIG_FB is not set
463
464#
465# Sound
466#
467# CONFIG_SOUND is not set
468
469#
470# USB support
471#
472# CONFIG_USB is not set
473
474#
475# USB Gadget Support
476#
477# CONFIG_USB_GADGET is not set
478
479#
480# File systems
481#
482# CONFIG_EXT2_FS is not set
483# CONFIG_EXT3_FS is not set
484# CONFIG_JBD is not set
485# CONFIG_REISERFS_FS is not set
486# CONFIG_JFS_FS is not set
487# CONFIG_XFS_FS is not set
488# CONFIG_MINIX_FS is not set
489# CONFIG_ROMFS_FS is not set
490# CONFIG_QUOTA is not set
491# CONFIG_AUTOFS_FS is not set
492# CONFIG_AUTOFS4_FS is not set
493
494#
495# CD-ROM/DVD Filesystems
496#
497# CONFIG_ISO9660_FS is not set
498# CONFIG_UDF_FS is not set
499
500#
501# DOS/FAT/NT Filesystems
502#
503# CONFIG_FAT_FS is not set
504# CONFIG_NTFS_FS is not set
505
506#
507# Pseudo filesystems
508#
509CONFIG_PROC_FS=y
510CONFIG_PROC_KCORE=y
511CONFIG_SYSFS=y
512# CONFIG_DEVFS_FS is not set
513# CONFIG_DEVPTS_FS_XATTR is not set
514# CONFIG_TMPFS is not set
515# CONFIG_HUGETLB_PAGE is not set
516CONFIG_RAMFS=y
517
518#
519# Miscellaneous filesystems
520#
521# CONFIG_ADFS_FS is not set
522# CONFIG_AFFS_FS is not set
523# CONFIG_HFS_FS is not set
524# CONFIG_HFSPLUS_FS is not set
525# CONFIG_BEFS_FS is not set
526# CONFIG_BFS_FS is not set
527# CONFIG_EFS_FS is not set
528# CONFIG_CRAMFS is not set
529# CONFIG_VXFS_FS is not set
530# CONFIG_HPFS_FS is not set
531# CONFIG_QNX4FS_FS is not set
532# CONFIG_SYSV_FS is not set
533# CONFIG_UFS_FS is not set
534
535#
536# Network File Systems
537#
538CONFIG_NFS_FS=y
539# CONFIG_NFS_V3 is not set
540# CONFIG_NFS_V4 is not set
541# CONFIG_NFS_DIRECTIO is not set
542# CONFIG_NFSD is not set
543CONFIG_ROOT_NFS=y
544CONFIG_LOCKD=y
545# CONFIG_EXPORTFS is not set
546CONFIG_SUNRPC=y
547# CONFIG_RPCSEC_GSS_KRB5 is not set
548# CONFIG_SMB_FS is not set
549# CONFIG_CIFS is not set
550# CONFIG_NCP_FS is not set
551# CONFIG_CODA_FS is not set
552# CONFIG_AFS_FS is not set
553
554#
555# Partition Types
556#
557# CONFIG_PARTITION_ADVANCED is not set
558CONFIG_MSDOS_PARTITION=y
559
560#
561# Native Language Support
562#
563# CONFIG_NLS is not set
564
565#
566# Library routines
567#
568CONFIG_CRC32=y
569# CONFIG_LIBCRC32C is not set
570
571#
572# Profiling support
573#
574# CONFIG_PROFILING is not set
575
576#
577# Kernel hacking
578#
579CONFIG_DEBUG_KERNEL=y
580# CONFIG_DEBUG_SLAB is not set
581# CONFIG_MAGIC_SYSRQ is not set
582# CONFIG_DEBUG_SPINLOCK is not set
583# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
584# CONFIG_KGDB is not set
585# CONFIG_XMON is not set
586CONFIG_BDI_SWITCH=y
587CONFIG_DEBUG_INFO=y
588# CONFIG_SERIAL_TEXT_DEBUG is not set
589CONFIG_PPC_OCP=y
590
591#
592# Security options
593#
594# CONFIG_SECURITY is not set
595
596#
597# Cryptographic options
598#
599# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/pcore_defconfig b/arch/ppc/configs/pcore_defconfig
new file mode 100644
index 000000000000..ed34405a7574
--- /dev/null
+++ b/arch/ppc/configs/pcore_defconfig
@@ -0,0 +1,716 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7CONFIG_PPC=y
8CONFIG_PPC32=y
9CONFIG_GENERIC_NVRAM=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_STANDALONE=y
17CONFIG_BROKEN_ON_SMP=y
18
19#
20# General setup
21#
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26CONFIG_LOG_BUF_SHIFT=14
27# CONFIG_HOTPLUG is not set
28# CONFIG_IKCONFIG is not set
29CONFIG_EMBEDDED=y
30CONFIG_KALLSYMS=y
31CONFIG_FUTEX=y
32CONFIG_EPOLL=y
33CONFIG_IOSCHED_NOOP=y
34CONFIG_IOSCHED_AS=y
35CONFIG_IOSCHED_DEADLINE=y
36# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
37
38#
39# Loadable module support
40#
41CONFIG_MODULES=y
42CONFIG_MODULE_UNLOAD=y
43# CONFIG_MODULE_FORCE_UNLOAD is not set
44CONFIG_OBSOLETE_MODPARM=y
45# CONFIG_MODVERSIONS is not set
46CONFIG_KMOD=y
47
48#
49# Processor
50#
51CONFIG_6xx=y
52# CONFIG_40x is not set
53# CONFIG_44x is not set
54# CONFIG_POWER3 is not set
55# CONFIG_POWER4 is not set
56# CONFIG_8xx is not set
57CONFIG_ALTIVEC=y
58# CONFIG_TAU is not set
59# CONFIG_CPU_FREQ is not set
60CONFIG_PPC_STD_MMU=y
61
62#
63# Platform options
64#
65# CONFIG_PPC_MULTIPLATFORM is not set
66# CONFIG_APUS is not set
67# CONFIG_WILLOW is not set
68CONFIG_PCORE=y
69# CONFIG_POWERPMC250 is not set
70# CONFIG_EV64260 is not set
71# CONFIG_SPRUCE is not set
72# CONFIG_LOPEC is not set
73# CONFIG_MCPN765 is not set
74# CONFIG_MVME5100 is not set
75# CONFIG_PPLUS is not set
76# CONFIG_PRPMC750 is not set
77# CONFIG_PRPMC800 is not set
78# CONFIG_SANDPOINT is not set
79# CONFIG_ADIR is not set
80# CONFIG_K2 is not set
81# CONFIG_PAL4 is not set
82# CONFIG_GEMINI is not set
83# CONFIG_EST8260 is not set
84# CONFIG_SBS8260 is not set
85# CONFIG_RPX6 is not set
86# CONFIG_TQM8260 is not set
87CONFIG_PPC_GEN550=y
88CONFIG_FORCE=y
89# CONFIG_MPC10X_STORE_GATHERING is not set
90# CONFIG_SMP is not set
91# CONFIG_PREEMPT is not set
92# CONFIG_HIGHMEM is not set
93CONFIG_KERNEL_ELF=y
94CONFIG_BINFMT_ELF=y
95# CONFIG_BINFMT_MISC is not set
96CONFIG_CMDLINE_BOOL=y
97CONFIG_CMDLINE="ip=on"
98
99#
100# Bus options
101#
102CONFIG_GENERIC_ISA_DMA=y
103CONFIG_PCI=y
104CONFIG_PCI_DOMAINS=y
105# CONFIG_PCI_LEGACY_PROC is not set
106# CONFIG_PCI_NAMES is not set
107
108#
109# Advanced setup
110#
111# CONFIG_ADVANCED_OPTIONS is not set
112
113#
114# Default settings for advanced configuration options are used
115#
116CONFIG_HIGHMEM_START=0xfe000000
117CONFIG_LOWMEM_SIZE=0x30000000
118CONFIG_KERNEL_START=0xc0000000
119CONFIG_TASK_SIZE=0x80000000
120CONFIG_BOOT_LOAD=0x00800000
121
122#
123# Device Drivers
124#
125
126#
127# Generic Driver Options
128#
129
130#
131# Memory Technology Devices (MTD)
132#
133# CONFIG_MTD is not set
134
135#
136# Parallel port support
137#
138# CONFIG_PARPORT is not set
139
140#
141# Plug and Play support
142#
143
144#
145# Block devices
146#
147# CONFIG_BLK_DEV_FD is not set
148# CONFIG_BLK_CPQ_DA is not set
149# CONFIG_BLK_CPQ_CISS_DA is not set
150# CONFIG_BLK_DEV_DAC960 is not set
151# CONFIG_BLK_DEV_UMEM is not set
152# CONFIG_BLK_DEV_LOOP is not set
153# CONFIG_BLK_DEV_NBD is not set
154# CONFIG_BLK_DEV_CARMEL is not set
155CONFIG_BLK_DEV_RAM=y
156CONFIG_BLK_DEV_RAM_SIZE=4096
157CONFIG_BLK_DEV_INITRD=y
158# CONFIG_LBD is not set
159
160#
161# ATA/ATAPI/MFM/RLL support
162#
163# CONFIG_IDE is not set
164
165#
166# SCSI device support
167#
168CONFIG_SCSI=y
169CONFIG_SCSI_PROC_FS=y
170
171#
172# SCSI support type (disk, tape, CD-ROM)
173#
174CONFIG_BLK_DEV_SD=y
175# CONFIG_CHR_DEV_ST is not set
176# CONFIG_CHR_DEV_OSST is not set
177CONFIG_BLK_DEV_SR=y
178# CONFIG_BLK_DEV_SR_VENDOR is not set
179# CONFIG_CHR_DEV_SG is not set
180
181#
182# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
183#
184# CONFIG_SCSI_MULTI_LUN is not set
185# CONFIG_SCSI_REPORT_LUNS is not set
186# CONFIG_SCSI_CONSTANTS is not set
187# CONFIG_SCSI_LOGGING is not set
188
189#
190# SCSI Transport Attributes
191#
192# CONFIG_SCSI_SPI_ATTRS is not set
193# CONFIG_SCSI_FC_ATTRS is not set
194
195#
196# SCSI low-level drivers
197#
198# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
199# CONFIG_SCSI_ACARD is not set
200# CONFIG_SCSI_AACRAID is not set
201# CONFIG_SCSI_AIC7XXX is not set
202# CONFIG_SCSI_AIC7XXX_OLD is not set
203# CONFIG_SCSI_AIC79XX is not set
204# CONFIG_SCSI_ADVANSYS is not set
205# CONFIG_SCSI_MEGARAID is not set
206# CONFIG_SCSI_SATA is not set
207# CONFIG_SCSI_BUSLOGIC is not set
208# CONFIG_SCSI_CPQFCTS is not set
209# CONFIG_SCSI_DMX3191D is not set
210# CONFIG_SCSI_EATA is not set
211# CONFIG_SCSI_EATA_PIO is not set
212# CONFIG_SCSI_FUTURE_DOMAIN is not set
213# CONFIG_SCSI_GDTH is not set
214# CONFIG_SCSI_IPS is not set
215# CONFIG_SCSI_INIA100 is not set
216CONFIG_SCSI_SYM53C8XX_2=y
217CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1
218CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
219CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
220# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set
221# CONFIG_SCSI_QLOGIC_ISP is not set
222# CONFIG_SCSI_QLOGIC_FC is not set
223# CONFIG_SCSI_QLOGIC_1280 is not set
224CONFIG_SCSI_QLA2XXX=y
225# CONFIG_SCSI_QLA21XX is not set
226# CONFIG_SCSI_QLA22XX is not set
227# CONFIG_SCSI_QLA2300 is not set
228# CONFIG_SCSI_QLA2322 is not set
229# CONFIG_SCSI_QLA6312 is not set
230# CONFIG_SCSI_QLA6322 is not set
231# CONFIG_SCSI_DC395x is not set
232# CONFIG_SCSI_DC390T is not set
233# CONFIG_SCSI_NSP32 is not set
234# CONFIG_SCSI_DEBUG is not set
235
236#
237# Multi-device support (RAID and LVM)
238#
239# CONFIG_MD is not set
240
241#
242# Fusion MPT device support
243#
244# CONFIG_FUSION is not set
245
246#
247# IEEE 1394 (FireWire) support
248#
249# CONFIG_IEEE1394 is not set
250
251#
252# I2O device support
253#
254# CONFIG_I2O is not set
255
256#
257# Macintosh device drivers
258#
259
260#
261# Networking support
262#
263CONFIG_NET=y
264
265#
266# Networking options
267#
268CONFIG_PACKET=y
269# CONFIG_PACKET_MMAP is not set
270# CONFIG_NETLINK_DEV is not set
271CONFIG_UNIX=y
272# CONFIG_NET_KEY is not set
273CONFIG_INET=y
274CONFIG_IP_MULTICAST=y
275# CONFIG_IP_ADVANCED_ROUTER is not set
276CONFIG_IP_PNP=y
277CONFIG_IP_PNP_DHCP=y
278# CONFIG_IP_PNP_BOOTP is not set
279# CONFIG_IP_PNP_RARP is not set
280# CONFIG_NET_IPIP is not set
281# CONFIG_NET_IPGRE is not set
282# CONFIG_IP_MROUTE is not set
283# CONFIG_ARPD is not set
284# CONFIG_SYN_COOKIES is not set
285# CONFIG_INET_AH is not set
286# CONFIG_INET_ESP is not set
287# CONFIG_INET_IPCOMP is not set
288
289#
290# IP: Virtual Server Configuration
291#
292# CONFIG_IP_VS is not set
293# CONFIG_IPV6 is not set
294# CONFIG_DECNET is not set
295# CONFIG_BRIDGE is not set
296CONFIG_NETFILTER=y
297# CONFIG_NETFILTER_DEBUG is not set
298
299#
300# IP: Netfilter Configuration
301#
302CONFIG_IP_NF_CONNTRACK=m
303CONFIG_IP_NF_FTP=m
304CONFIG_IP_NF_IRC=m
305# CONFIG_IP_NF_TFTP is not set
306# CONFIG_IP_NF_AMANDA is not set
307# CONFIG_IP_NF_QUEUE is not set
308CONFIG_IP_NF_IPTABLES=m
309CONFIG_IP_NF_MATCH_LIMIT=m
310# CONFIG_IP_NF_MATCH_IPRANGE is not set
311CONFIG_IP_NF_MATCH_MAC=m
312CONFIG_IP_NF_MATCH_PKTTYPE=m
313CONFIG_IP_NF_MATCH_MARK=m
314CONFIG_IP_NF_MATCH_MULTIPORT=m
315CONFIG_IP_NF_MATCH_TOS=m
316# CONFIG_IP_NF_MATCH_RECENT is not set
317CONFIG_IP_NF_MATCH_ECN=m
318CONFIG_IP_NF_MATCH_DSCP=m
319CONFIG_IP_NF_MATCH_AH_ESP=m
320CONFIG_IP_NF_MATCH_LENGTH=m
321CONFIG_IP_NF_MATCH_TTL=m
322CONFIG_IP_NF_MATCH_TCPMSS=m
323CONFIG_IP_NF_MATCH_HELPER=m
324CONFIG_IP_NF_MATCH_STATE=m
325CONFIG_IP_NF_MATCH_CONNTRACK=m
326CONFIG_IP_NF_MATCH_OWNER=m
327CONFIG_IP_NF_FILTER=m
328CONFIG_IP_NF_TARGET_REJECT=m
329CONFIG_IP_NF_NAT=m
330CONFIG_IP_NF_NAT_NEEDED=y
331CONFIG_IP_NF_TARGET_MASQUERADE=m
332CONFIG_IP_NF_TARGET_REDIRECT=m
333# CONFIG_IP_NF_TARGET_NETMAP is not set
334# CONFIG_IP_NF_TARGET_SAME is not set
335# CONFIG_IP_NF_NAT_SNMP_BASIC is not set
336CONFIG_IP_NF_NAT_IRC=m
337CONFIG_IP_NF_NAT_FTP=m
338# CONFIG_IP_NF_MANGLE is not set
339# CONFIG_IP_NF_TARGET_LOG is not set
340CONFIG_IP_NF_TARGET_ULOG=m
341CONFIG_IP_NF_TARGET_TCPMSS=m
342CONFIG_IP_NF_ARPTABLES=m
343CONFIG_IP_NF_ARPFILTER=m
344# CONFIG_IP_NF_ARP_MANGLE is not set
345CONFIG_IP_NF_COMPAT_IPCHAINS=m
346# CONFIG_IP_NF_COMPAT_IPFWADM is not set
347
348#
349# SCTP Configuration (EXPERIMENTAL)
350#
351# CONFIG_IP_SCTP is not set
352# CONFIG_ATM is not set
353# CONFIG_VLAN_8021Q is not set
354# CONFIG_LLC2 is not set
355# CONFIG_IPX is not set
356# CONFIG_ATALK is not set
357# CONFIG_X25 is not set
358# CONFIG_LAPB is not set
359# CONFIG_NET_DIVERT is not set
360# CONFIG_ECONET is not set
361# CONFIG_WAN_ROUTER is not set
362# CONFIG_NET_HW_FLOWCONTROL is not set
363
364#
365# QoS and/or fair queueing
366#
367# CONFIG_NET_SCHED is not set
368
369#
370# Network testing
371#
372# CONFIG_NET_PKTGEN is not set
373CONFIG_NETDEVICES=y
374
375#
376# ARCnet devices
377#
378# CONFIG_ARCNET is not set
379# CONFIG_DUMMY is not set
380# CONFIG_BONDING is not set
381# CONFIG_EQUALIZER is not set
382# CONFIG_TUN is not set
383
384#
385# Ethernet (10 or 100Mbit)
386#
387CONFIG_NET_ETHERNET=y
388CONFIG_MII=y
389# CONFIG_OAKNET is not set
390# CONFIG_HAPPYMEAL is not set
391# CONFIG_SUNGEM is not set
392# CONFIG_NET_VENDOR_3COM is not set
393
394#
395# Tulip family network device support
396#
397CONFIG_NET_TULIP=y
398# CONFIG_DE2104X is not set
399CONFIG_TULIP=y
400# CONFIG_TULIP_MWI is not set
401# CONFIG_TULIP_MMIO is not set
402# CONFIG_TULIP_NAPI is not set
403# CONFIG_DE4X5 is not set
404# CONFIG_WINBOND_840 is not set
405# CONFIG_DM9102 is not set
406# CONFIG_HP100 is not set
407CONFIG_NET_PCI=y
408# CONFIG_PCNET32 is not set
409# CONFIG_AMD8111_ETH is not set
410# CONFIG_ADAPTEC_STARFIRE is not set
411# CONFIG_B44 is not set
412# CONFIG_FORCEDETH is not set
413# CONFIG_DGRS is not set
414CONFIG_EEPRO100=y
415# CONFIG_EEPRO100_PIO is not set
416# CONFIG_E100 is not set
417# CONFIG_FEALNX is not set
418# CONFIG_NATSEMI is not set
419# CONFIG_NE2K_PCI is not set
420# CONFIG_8139CP is not set
421# CONFIG_8139TOO is not set
422# CONFIG_SIS900 is not set
423# CONFIG_EPIC100 is not set
424# CONFIG_SUNDANCE is not set
425# CONFIG_TLAN is not set
426# CONFIG_VIA_RHINE is not set
427
428#
429# Ethernet (1000 Mbit)
430#
431# CONFIG_ACENIC is not set
432# CONFIG_DL2K is not set
433# CONFIG_E1000 is not set
434# CONFIG_NS83820 is not set
435# CONFIG_HAMACHI is not set
436# CONFIG_YELLOWFIN is not set
437# CONFIG_R8169 is not set
438# CONFIG_SIS190 is not set
439# CONFIG_SK98LIN is not set
440# CONFIG_TIGON3 is not set
441
442#
443# Ethernet (10000 Mbit)
444#
445# CONFIG_IXGB is not set
446# CONFIG_FDDI is not set
447# CONFIG_HIPPI is not set
448# CONFIG_PPP is not set
449# CONFIG_SLIP is not set
450
451#
452# Wireless LAN (non-hamradio)
453#
454# CONFIG_NET_RADIO is not set
455
456#
457# Token Ring devices
458#
459# CONFIG_TR is not set
460# CONFIG_NET_FC is not set
461# CONFIG_RCPCI is not set
462# CONFIG_SHAPER is not set
463# CONFIG_NETCONSOLE is not set
464
465#
466# Wan interfaces
467#
468# CONFIG_WAN is not set
469
470#
471# Amateur Radio support
472#
473# CONFIG_HAMRADIO is not set
474
475#
476# IrDA (infrared) support
477#
478# CONFIG_IRDA is not set
479
480#
481# Bluetooth support
482#
483# CONFIG_BT is not set
484# CONFIG_NETPOLL is not set
485# CONFIG_NET_POLL_CONTROLLER is not set
486
487#
488# ISDN subsystem
489#
490# CONFIG_ISDN is not set
491
492#
493# Telephony Support
494#
495# CONFIG_PHONE is not set
496
497#
498# Input device support
499#
500# CONFIG_INPUT is not set
501
502#
503# Userland interfaces
504#
505
506#
507# Input I/O drivers
508#
509# CONFIG_GAMEPORT is not set
510CONFIG_SOUND_GAMEPORT=y
511# CONFIG_SERIO is not set
512# CONFIG_SERIO_I8042 is not set
513
514#
515# Input Device Drivers
516#
517
518#
519# Character devices
520#
521# CONFIG_VT is not set
522# CONFIG_SERIAL_NONSTANDARD is not set
523
524#
525# Serial drivers
526#
527CONFIG_SERIAL_8250=y
528CONFIG_SERIAL_8250_CONSOLE=y
529CONFIG_SERIAL_8250_NR_UARTS=2
530# CONFIG_SERIAL_8250_EXTENDED is not set
531
532#
533# Non-8250 serial port support
534#
535CONFIG_SERIAL_CORE=y
536CONFIG_SERIAL_CORE_CONSOLE=y
537CONFIG_UNIX98_PTYS=y
538CONFIG_LEGACY_PTYS=y
539CONFIG_LEGACY_PTY_COUNT=256
540# CONFIG_QIC02_TAPE is not set
541
542#
543# IPMI
544#
545# CONFIG_IPMI_HANDLER is not set
546
547#
548# Watchdog Cards
549#
550# CONFIG_WATCHDOG is not set
551# CONFIG_NVRAM is not set
552CONFIG_GEN_RTC=y
553# CONFIG_GEN_RTC_X is not set
554# CONFIG_DTLK is not set
555# CONFIG_R3964 is not set
556# CONFIG_APPLICOM is not set
557
558#
559# Ftape, the floppy tape device driver
560#
561# CONFIG_FTAPE is not set
562# CONFIG_AGP is not set
563# CONFIG_DRM is not set
564# CONFIG_RAW_DRIVER is not set
565
566#
567# I2C support
568#
569# CONFIG_I2C is not set
570
571#
572# Misc devices
573#
574
575#
576# Multimedia devices
577#
578# CONFIG_VIDEO_DEV is not set
579
580#
581# Digital Video Broadcasting Devices
582#
583# CONFIG_DVB is not set
584
585#
586# Graphics support
587#
588# CONFIG_FB is not set
589
590#
591# Sound
592#
593# CONFIG_SOUND is not set
594
595#
596# USB support
597#
598# CONFIG_USB is not set
599
600#
601# USB Gadget Support
602#
603# CONFIG_USB_GADGET is not set
604
605#
606# File systems
607#
608CONFIG_EXT2_FS=y
609# CONFIG_EXT2_FS_XATTR is not set
610CONFIG_EXT3_FS=y
611CONFIG_EXT3_FS_XATTR=y
612# CONFIG_EXT3_FS_POSIX_ACL is not set
613# CONFIG_EXT3_FS_SECURITY is not set
614CONFIG_JBD=y
615# CONFIG_JBD_DEBUG is not set
616CONFIG_FS_MBCACHE=y
617# CONFIG_REISERFS_FS is not set
618# CONFIG_JFS_FS is not set
619# CONFIG_XFS_FS is not set
620# CONFIG_MINIX_FS is not set
621# CONFIG_ROMFS_FS is not set
622# CONFIG_QUOTA is not set
623# CONFIG_AUTOFS_FS is not set
624# CONFIG_AUTOFS4_FS is not set
625
626#
627# CD-ROM/DVD Filesystems
628#
629# CONFIG_ISO9660_FS is not set
630# CONFIG_UDF_FS is not set
631
632#
633# DOS/FAT/NT Filesystems
634#
635# CONFIG_FAT_FS is not set
636# CONFIG_NTFS_FS is not set
637
638#
639# Pseudo filesystems
640#
641CONFIG_PROC_FS=y
642CONFIG_PROC_KCORE=y
643# CONFIG_DEVFS_FS is not set
644# CONFIG_DEVPTS_FS_XATTR is not set
645CONFIG_TMPFS=y
646# CONFIG_HUGETLB_PAGE is not set
647CONFIG_RAMFS=y
648
649#
650# Miscellaneous filesystems
651#
652# CONFIG_ADFS_FS is not set
653# CONFIG_AFFS_FS is not set
654# CONFIG_HFS_FS is not set
655# CONFIG_HFSPLUS_FS is not set
656# CONFIG_BEFS_FS is not set
657# CONFIG_BFS_FS is not set
658# CONFIG_EFS_FS is not set
659# CONFIG_CRAMFS is not set
660# CONFIG_VXFS_FS is not set
661# CONFIG_HPFS_FS is not set
662# CONFIG_QNX4FS_FS is not set
663# CONFIG_SYSV_FS is not set
664# CONFIG_UFS_FS is not set
665
666#
667# Network File Systems
668#
669CONFIG_NFS_FS=y
670# CONFIG_NFS_V3 is not set
671# CONFIG_NFS_V4 is not set
672# CONFIG_NFS_DIRECTIO is not set
673# CONFIG_NFSD is not set
674CONFIG_ROOT_NFS=y
675CONFIG_LOCKD=y
676# CONFIG_EXPORTFS is not set
677CONFIG_SUNRPC=y
678# CONFIG_RPCSEC_GSS_KRB5 is not set
679# CONFIG_SMB_FS is not set
680# CONFIG_CIFS is not set
681# CONFIG_NCP_FS is not set
682# CONFIG_CODA_FS is not set
683# CONFIG_INTERMEZZO_FS is not set
684# CONFIG_AFS_FS is not set
685
686#
687# Partition Types
688#
689# CONFIG_PARTITION_ADVANCED is not set
690CONFIG_MSDOS_PARTITION=y
691
692#
693# Native Language Support
694#
695# CONFIG_NLS is not set
696
697#
698# Library routines
699#
700CONFIG_CRC32=y
701
702#
703# Kernel hacking
704#
705# CONFIG_DEBUG_KERNEL is not set
706# CONFIG_SERIAL_TEXT_DEBUG is not set
707
708#
709# Security options
710#
711# CONFIG_SECURITY is not set
712
713#
714# Cryptographic options
715#
716# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/pmac_defconfig b/arch/ppc/configs/pmac_defconfig
new file mode 100644
index 000000000000..8eebb0455766
--- /dev/null
+++ b/arch/ppc/configs/pmac_defconfig
@@ -0,0 +1,1523 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc4
4# Sun Feb 13 14:56:58 2005
5#
6CONFIG_MMU=y
7CONFIG_GENERIC_HARDIRQS=y
8CONFIG_RWSEM_XCHGADD_ALGORITHM=y
9CONFIG_GENERIC_CALIBRATE_DELAY=y
10CONFIG_HAVE_DEC_LOCK=y
11CONFIG_PPC=y
12CONFIG_PPC32=y
13CONFIG_GENERIC_NVRAM=y
14
15#
16# Code maturity level options
17#
18CONFIG_EXPERIMENTAL=y
19CONFIG_CLEAN_COMPILE=y
20CONFIG_BROKEN_ON_SMP=y
21
22#
23# General setup
24#
25CONFIG_LOCALVERSION=""
26CONFIG_SWAP=y
27CONFIG_SYSVIPC=y
28CONFIG_POSIX_MQUEUE=y
29# CONFIG_BSD_PROCESS_ACCT is not set
30CONFIG_SYSCTL=y
31CONFIG_LOG_BUF_SHIFT=16
32CONFIG_HOTPLUG=y
33CONFIG_KOBJECT_UEVENT=y
34CONFIG_IKCONFIG=y
35CONFIG_IKCONFIG_PROC=y
36# CONFIG_EMBEDDED is not set
37CONFIG_KALLSYMS=y
38# CONFIG_KALLSYMS_ALL is not set
39# CONFIG_KALLSYMS_EXTRA_PASS is not set
40CONFIG_FUTEX=y
41CONFIG_EPOLL=y
42# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
43CONFIG_SHMEM=y
44CONFIG_CC_ALIGN_FUNCTIONS=0
45CONFIG_CC_ALIGN_LABELS=0
46CONFIG_CC_ALIGN_LOOPS=0
47CONFIG_CC_ALIGN_JUMPS=0
48# CONFIG_TINY_SHMEM is not set
49
50#
51# Loadable module support
52#
53CONFIG_MODULES=y
54CONFIG_MODULE_UNLOAD=y
55# CONFIG_MODULE_FORCE_UNLOAD is not set
56CONFIG_OBSOLETE_MODPARM=y
57CONFIG_MODVERSIONS=y
58CONFIG_MODULE_SRCVERSION_ALL=y
59CONFIG_KMOD=y
60
61#
62# Processor
63#
64CONFIG_6xx=y
65# CONFIG_40x is not set
66# CONFIG_44x is not set
67# CONFIG_POWER3 is not set
68# CONFIG_POWER4 is not set
69# CONFIG_8xx is not set
70# CONFIG_E500 is not set
71CONFIG_ALTIVEC=y
72CONFIG_TAU=y
73# CONFIG_TAU_INT is not set
74# CONFIG_TAU_AVERAGE is not set
75CONFIG_CPU_FREQ=y
76# CONFIG_CPU_FREQ_DEBUG is not set
77CONFIG_CPU_FREQ_STAT=m
78CONFIG_CPU_FREQ_STAT_DETAILS=y
79CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
80# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
81CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
82CONFIG_CPU_FREQ_GOV_POWERSAVE=m
83CONFIG_CPU_FREQ_GOV_USERSPACE=m
84CONFIG_CPU_FREQ_GOV_ONDEMAND=m
85CONFIG_CPU_FREQ_PMAC=y
86CONFIG_CPU_FREQ_TABLE=y
87CONFIG_PPC601_SYNC_FIX=y
88CONFIG_PM=y
89CONFIG_PPC_STD_MMU=y
90
91#
92# Platform options
93#
94CONFIG_PPC_MULTIPLATFORM=y
95# CONFIG_APUS is not set
96# CONFIG_KATANA is not set
97# CONFIG_WILLOW is not set
98# CONFIG_CPCI690 is not set
99# CONFIG_PCORE is not set
100# CONFIG_POWERPMC250 is not set
101# CONFIG_CHESTNUT is not set
102# CONFIG_SPRUCE is not set
103# CONFIG_EV64260 is not set
104# CONFIG_LOPEC is not set
105# CONFIG_MCPN765 is not set
106# CONFIG_MVME5100 is not set
107# CONFIG_PPLUS is not set
108# CONFIG_PRPMC750 is not set
109# CONFIG_PRPMC800 is not set
110# CONFIG_SANDPOINT is not set
111# CONFIG_ADIR is not set
112# CONFIG_K2 is not set
113# CONFIG_PAL4 is not set
114# CONFIG_GEMINI is not set
115# CONFIG_EST8260 is not set
116# CONFIG_SBC82xx is not set
117# CONFIG_SBS8260 is not set
118# CONFIG_RPX8260 is not set
119# CONFIG_TQM8260 is not set
120# CONFIG_ADS8272 is not set
121# CONFIG_PQ2FADS is not set
122# CONFIG_LITE5200 is not set
123CONFIG_PPC_CHRP=y
124CONFIG_PPC_PMAC=y
125CONFIG_PPC_PREP=y
126CONFIG_PPC_OF=y
127CONFIG_PPCBUG_NVRAM=y
128# CONFIG_SMP is not set
129# CONFIG_PREEMPT is not set
130# CONFIG_HIGHMEM is not set
131CONFIG_BINFMT_ELF=y
132CONFIG_BINFMT_MISC=m
133CONFIG_PROC_DEVICETREE=y
134# CONFIG_PREP_RESIDUAL is not set
135# CONFIG_CMDLINE_BOOL is not set
136
137#
138# Bus options
139#
140# CONFIG_ISA is not set
141CONFIG_GENERIC_ISA_DMA=y
142CONFIG_PCI=y
143CONFIG_PCI_DOMAINS=y
144CONFIG_PCI_LEGACY_PROC=y
145CONFIG_PCI_NAMES=y
146
147#
148# PCCARD (PCMCIA/CardBus) support
149#
150CONFIG_PCCARD=m
151# CONFIG_PCMCIA_DEBUG is not set
152CONFIG_PCMCIA=m
153CONFIG_CARDBUS=y
154
155#
156# PC-card bridges
157#
158CONFIG_YENTA=m
159# CONFIG_PD6729 is not set
160# CONFIG_I82092 is not set
161# CONFIG_TCIC is not set
162CONFIG_PCCARD_NONSTATIC=m
163
164#
165# Advanced setup
166#
167CONFIG_ADVANCED_OPTIONS=y
168CONFIG_HIGHMEM_START=0xfe000000
169# CONFIG_LOWMEM_SIZE_BOOL is not set
170CONFIG_LOWMEM_SIZE=0x30000000
171# CONFIG_KERNEL_START_BOOL is not set
172CONFIG_KERNEL_START=0xc0000000
173CONFIG_TASK_SIZE_BOOL=y
174CONFIG_TASK_SIZE=0xc0000000
175CONFIG_BOOT_LOAD=0x00800000
176
177#
178# Device Drivers
179#
180
181#
182# Generic Driver Options
183#
184# CONFIG_STANDALONE is not set
185CONFIG_PREVENT_FIRMWARE_BUILD=y
186# CONFIG_FW_LOADER is not set
187# CONFIG_DEBUG_DRIVER is not set
188
189#
190# Memory Technology Devices (MTD)
191#
192# CONFIG_MTD is not set
193
194#
195# Parallel port support
196#
197# CONFIG_PARPORT is not set
198
199#
200# Plug and Play support
201#
202
203#
204# Block devices
205#
206# CONFIG_BLK_DEV_FD is not set
207CONFIG_MAC_FLOPPY=m
208# CONFIG_BLK_CPQ_DA is not set
209# CONFIG_BLK_CPQ_CISS_DA is not set
210# CONFIG_BLK_DEV_DAC960 is not set
211# CONFIG_BLK_DEV_UMEM is not set
212# CONFIG_BLK_DEV_COW_COMMON is not set
213CONFIG_BLK_DEV_LOOP=y
214# CONFIG_BLK_DEV_CRYPTOLOOP is not set
215# CONFIG_BLK_DEV_NBD is not set
216# CONFIG_BLK_DEV_SX8 is not set
217# CONFIG_BLK_DEV_UB is not set
218CONFIG_BLK_DEV_RAM=y
219CONFIG_BLK_DEV_RAM_COUNT=16
220CONFIG_BLK_DEV_RAM_SIZE=4096
221CONFIG_BLK_DEV_INITRD=y
222CONFIG_INITRAMFS_SOURCE=""
223CONFIG_LBD=y
224CONFIG_CDROM_PKTCDVD=m
225CONFIG_CDROM_PKTCDVD_BUFFERS=8
226# CONFIG_CDROM_PKTCDVD_WCACHE is not set
227
228#
229# IO Schedulers
230#
231CONFIG_IOSCHED_NOOP=y
232CONFIG_IOSCHED_AS=y
233CONFIG_IOSCHED_DEADLINE=y
234CONFIG_IOSCHED_CFQ=y
235# CONFIG_ATA_OVER_ETH is not set
236
237#
238# ATA/ATAPI/MFM/RLL support
239#
240CONFIG_IDE=y
241CONFIG_BLK_DEV_IDE=y
242
243#
244# Please see Documentation/ide.txt for help/info on IDE drives
245#
246# CONFIG_BLK_DEV_IDE_SATA is not set
247CONFIG_BLK_DEV_IDEDISK=y
248# CONFIG_IDEDISK_MULTI_MODE is not set
249# CONFIG_BLK_DEV_IDECS is not set
250CONFIG_BLK_DEV_IDECD=y
251# CONFIG_BLK_DEV_IDETAPE is not set
252CONFIG_BLK_DEV_IDEFLOPPY=y
253CONFIG_BLK_DEV_IDESCSI=y
254# CONFIG_IDE_TASK_IOCTL is not set
255
256#
257# IDE chipset support/bugfixes
258#
259# CONFIG_IDE_GENERIC is not set
260CONFIG_BLK_DEV_IDEPCI=y
261CONFIG_IDEPCI_SHARE_IRQ=y
262# CONFIG_BLK_DEV_OFFBOARD is not set
263CONFIG_BLK_DEV_GENERIC=y
264# CONFIG_BLK_DEV_OPTI621 is not set
265# CONFIG_BLK_DEV_SL82C105 is not set
266CONFIG_BLK_DEV_IDEDMA_PCI=y
267# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
268CONFIG_IDEDMA_PCI_AUTO=y
269# CONFIG_IDEDMA_ONLYDISK is not set
270# CONFIG_BLK_DEV_AEC62XX is not set
271# CONFIG_BLK_DEV_ALI15X3 is not set
272# CONFIG_BLK_DEV_AMD74XX is not set
273CONFIG_BLK_DEV_CMD64X=y
274# CONFIG_BLK_DEV_TRIFLEX is not set
275# CONFIG_BLK_DEV_CY82C693 is not set
276# CONFIG_BLK_DEV_CS5520 is not set
277# CONFIG_BLK_DEV_CS5530 is not set
278# CONFIG_BLK_DEV_HPT34X is not set
279# CONFIG_BLK_DEV_HPT366 is not set
280# CONFIG_BLK_DEV_SC1200 is not set
281# CONFIG_BLK_DEV_PIIX is not set
282# CONFIG_BLK_DEV_NS87415 is not set
283# CONFIG_BLK_DEV_PDC202XX_OLD is not set
284CONFIG_BLK_DEV_PDC202XX_NEW=y
285# CONFIG_PDC202XX_FORCE is not set
286# CONFIG_BLK_DEV_SVWKS is not set
287# CONFIG_BLK_DEV_SIIMAGE is not set
288# CONFIG_BLK_DEV_SLC90E66 is not set
289# CONFIG_BLK_DEV_TRM290 is not set
290# CONFIG_BLK_DEV_VIA82CXXX is not set
291CONFIG_BLK_DEV_IDE_PMAC=y
292CONFIG_BLK_DEV_IDE_PMAC_ATA100FIRST=y
293CONFIG_BLK_DEV_IDEDMA_PMAC=y
294CONFIG_BLK_DEV_IDE_PMAC_BLINK=y
295# CONFIG_IDE_ARM is not set
296CONFIG_BLK_DEV_IDEDMA=y
297# CONFIG_IDEDMA_IVB is not set
298CONFIG_IDEDMA_AUTO=y
299# CONFIG_BLK_DEV_HD is not set
300
301#
302# SCSI device support
303#
304CONFIG_SCSI=y
305CONFIG_SCSI_PROC_FS=y
306
307#
308# SCSI support type (disk, tape, CD-ROM)
309#
310CONFIG_BLK_DEV_SD=y
311CONFIG_CHR_DEV_ST=y
312# CONFIG_CHR_DEV_OSST is not set
313CONFIG_BLK_DEV_SR=y
314CONFIG_BLK_DEV_SR_VENDOR=y
315CONFIG_CHR_DEV_SG=y
316
317#
318# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
319#
320# CONFIG_SCSI_MULTI_LUN is not set
321CONFIG_SCSI_CONSTANTS=y
322# CONFIG_SCSI_LOGGING is not set
323
324#
325# SCSI Transport Attributes
326#
327CONFIG_SCSI_SPI_ATTRS=y
328# CONFIG_SCSI_FC_ATTRS is not set
329# CONFIG_SCSI_ISCSI_ATTRS is not set
330
331#
332# SCSI low-level drivers
333#
334# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
335# CONFIG_SCSI_3W_9XXX is not set
336# CONFIG_SCSI_ACARD is not set
337# CONFIG_SCSI_AACRAID is not set
338CONFIG_SCSI_AIC7XXX=m
339CONFIG_AIC7XXX_CMDS_PER_DEVICE=253
340CONFIG_AIC7XXX_RESET_DELAY_MS=15000
341CONFIG_AIC7XXX_DEBUG_ENABLE=y
342CONFIG_AIC7XXX_DEBUG_MASK=0
343CONFIG_AIC7XXX_REG_PRETTY_PRINT=y
344CONFIG_SCSI_AIC7XXX_OLD=m
345# CONFIG_SCSI_AIC79XX is not set
346# CONFIG_SCSI_DPT_I2O is not set
347# CONFIG_MEGARAID_NEWGEN is not set
348# CONFIG_MEGARAID_LEGACY is not set
349# CONFIG_SCSI_SATA is not set
350# CONFIG_SCSI_BUSLOGIC is not set
351# CONFIG_SCSI_DMX3191D is not set
352# CONFIG_SCSI_EATA is not set
353# CONFIG_SCSI_EATA_PIO is not set
354# CONFIG_SCSI_FUTURE_DOMAIN is not set
355# CONFIG_SCSI_GDTH is not set
356# CONFIG_SCSI_IPS is not set
357# CONFIG_SCSI_INITIO is not set
358# CONFIG_SCSI_INIA100 is not set
359CONFIG_SCSI_SYM53C8XX_2=y
360CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0
361CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
362CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
363# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set
364# CONFIG_SCSI_IPR is not set
365# CONFIG_SCSI_QLOGIC_ISP is not set
366# CONFIG_SCSI_QLOGIC_FC is not set
367# CONFIG_SCSI_QLOGIC_1280 is not set
368CONFIG_SCSI_QLA2XXX=y
369# CONFIG_SCSI_QLA21XX is not set
370# CONFIG_SCSI_QLA22XX is not set
371# CONFIG_SCSI_QLA2300 is not set
372# CONFIG_SCSI_QLA2322 is not set
373# CONFIG_SCSI_QLA6312 is not set
374# CONFIG_SCSI_DC395x is not set
375# CONFIG_SCSI_DC390T is not set
376# CONFIG_SCSI_NSP32 is not set
377# CONFIG_SCSI_DEBUG is not set
378CONFIG_SCSI_MESH=y
379CONFIG_SCSI_MESH_SYNC_RATE=5
380CONFIG_SCSI_MESH_RESET_DELAY_MS=1000
381CONFIG_SCSI_MAC53C94=y
382
383#
384# PCMCIA SCSI adapter support
385#
386# CONFIG_PCMCIA_AHA152X is not set
387# CONFIG_PCMCIA_FDOMAIN is not set
388# CONFIG_PCMCIA_NINJA_SCSI is not set
389# CONFIG_PCMCIA_QLOGIC is not set
390# CONFIG_PCMCIA_SYM53C500 is not set
391
392#
393# Multi-device support (RAID and LVM)
394#
395# CONFIG_MD is not set
396
397#
398# Fusion MPT device support
399#
400# CONFIG_FUSION is not set
401
402#
403# IEEE 1394 (FireWire) support
404#
405CONFIG_IEEE1394=m
406
407#
408# Subsystem Options
409#
410# CONFIG_IEEE1394_VERBOSEDEBUG is not set
411# CONFIG_IEEE1394_OUI_DB is not set
412CONFIG_IEEE1394_EXTRA_CONFIG_ROMS=y
413CONFIG_IEEE1394_CONFIG_ROM_IP1394=y
414
415#
416# Device Drivers
417#
418# CONFIG_IEEE1394_PCILYNX is not set
419CONFIG_IEEE1394_OHCI1394=m
420
421#
422# Protocol Drivers
423#
424CONFIG_IEEE1394_VIDEO1394=m
425CONFIG_IEEE1394_SBP2=m
426# CONFIG_IEEE1394_SBP2_PHYS_DMA is not set
427CONFIG_IEEE1394_ETH1394=m
428CONFIG_IEEE1394_DV1394=m
429CONFIG_IEEE1394_RAWIO=m
430CONFIG_IEEE1394_CMP=m
431CONFIG_IEEE1394_AMDTP=m
432
433#
434# I2O device support
435#
436# CONFIG_I2O is not set
437
438#
439# Macintosh device drivers
440#
441CONFIG_ADB=y
442CONFIG_ADB_CUDA=y
443CONFIG_ADB_PMU=y
444CONFIG_PMAC_PBOOK=y
445CONFIG_PMAC_APM_EMU=y
446CONFIG_PMAC_BACKLIGHT=y
447CONFIG_ADB_MACIO=y
448CONFIG_INPUT_ADBHID=y
449CONFIG_MAC_EMUMOUSEBTN=y
450CONFIG_THERM_WINDTUNNEL=m
451CONFIG_THERM_ADT746X=m
452# CONFIG_ANSLCD is not set
453
454#
455# Networking support
456#
457CONFIG_NET=y
458
459#
460# Networking options
461#
462CONFIG_PACKET=y
463# CONFIG_PACKET_MMAP is not set
464# CONFIG_NETLINK_DEV is not set
465CONFIG_UNIX=y
466# CONFIG_NET_KEY is not set
467CONFIG_INET=y
468CONFIG_IP_MULTICAST=y
469# CONFIG_IP_ADVANCED_ROUTER is not set
470# CONFIG_IP_PNP is not set
471# CONFIG_NET_IPIP is not set
472# CONFIG_NET_IPGRE is not set
473# CONFIG_IP_MROUTE is not set
474# CONFIG_ARPD is not set
475CONFIG_SYN_COOKIES=y
476# CONFIG_INET_AH is not set
477# CONFIG_INET_ESP is not set
478# CONFIG_INET_IPCOMP is not set
479# CONFIG_INET_TUNNEL is not set
480CONFIG_IP_TCPDIAG=y
481# CONFIG_IP_TCPDIAG_IPV6 is not set
482
483#
484# IP: Virtual Server Configuration
485#
486# CONFIG_IP_VS is not set
487# CONFIG_IPV6 is not set
488CONFIG_NETFILTER=y
489# CONFIG_NETFILTER_DEBUG is not set
490
491#
492# IP: Netfilter Configuration
493#
494CONFIG_IP_NF_CONNTRACK=m
495CONFIG_IP_NF_CT_ACCT=y
496CONFIG_IP_NF_CONNTRACK_MARK=y
497CONFIG_IP_NF_CT_PROTO_SCTP=m
498CONFIG_IP_NF_FTP=m
499CONFIG_IP_NF_IRC=m
500CONFIG_IP_NF_TFTP=m
501CONFIG_IP_NF_AMANDA=m
502CONFIG_IP_NF_QUEUE=m
503CONFIG_IP_NF_IPTABLES=m
504CONFIG_IP_NF_MATCH_LIMIT=m
505CONFIG_IP_NF_MATCH_IPRANGE=m
506CONFIG_IP_NF_MATCH_MAC=m
507CONFIG_IP_NF_MATCH_PKTTYPE=m
508CONFIG_IP_NF_MATCH_MARK=m
509CONFIG_IP_NF_MATCH_MULTIPORT=m
510CONFIG_IP_NF_MATCH_TOS=m
511CONFIG_IP_NF_MATCH_RECENT=m
512CONFIG_IP_NF_MATCH_ECN=m
513CONFIG_IP_NF_MATCH_DSCP=m
514CONFIG_IP_NF_MATCH_AH_ESP=m
515CONFIG_IP_NF_MATCH_LENGTH=m
516CONFIG_IP_NF_MATCH_TTL=m
517CONFIG_IP_NF_MATCH_TCPMSS=m
518CONFIG_IP_NF_MATCH_HELPER=m
519CONFIG_IP_NF_MATCH_STATE=m
520CONFIG_IP_NF_MATCH_CONNTRACK=m
521CONFIG_IP_NF_MATCH_OWNER=m
522CONFIG_IP_NF_MATCH_ADDRTYPE=m
523CONFIG_IP_NF_MATCH_REALM=m
524CONFIG_IP_NF_MATCH_SCTP=m
525CONFIG_IP_NF_MATCH_COMMENT=m
526CONFIG_IP_NF_MATCH_CONNMARK=m
527CONFIG_IP_NF_MATCH_HASHLIMIT=m
528CONFIG_IP_NF_FILTER=m
529CONFIG_IP_NF_TARGET_REJECT=m
530CONFIG_IP_NF_TARGET_LOG=m
531CONFIG_IP_NF_TARGET_ULOG=m
532CONFIG_IP_NF_TARGET_TCPMSS=m
533CONFIG_IP_NF_NAT=m
534CONFIG_IP_NF_NAT_NEEDED=y
535CONFIG_IP_NF_TARGET_MASQUERADE=m
536CONFIG_IP_NF_TARGET_REDIRECT=m
537CONFIG_IP_NF_TARGET_NETMAP=m
538CONFIG_IP_NF_TARGET_SAME=m
539CONFIG_IP_NF_NAT_SNMP_BASIC=m
540CONFIG_IP_NF_NAT_IRC=m
541CONFIG_IP_NF_NAT_FTP=m
542CONFIG_IP_NF_NAT_TFTP=m
543CONFIG_IP_NF_NAT_AMANDA=m
544CONFIG_IP_NF_MANGLE=m
545CONFIG_IP_NF_TARGET_TOS=m
546CONFIG_IP_NF_TARGET_ECN=m
547CONFIG_IP_NF_TARGET_DSCP=m
548CONFIG_IP_NF_TARGET_MARK=m
549CONFIG_IP_NF_TARGET_CLASSIFY=m
550CONFIG_IP_NF_TARGET_CONNMARK=m
551CONFIG_IP_NF_TARGET_CLUSTERIP=m
552CONFIG_IP_NF_RAW=m
553CONFIG_IP_NF_TARGET_NOTRACK=m
554CONFIG_IP_NF_ARPTABLES=m
555CONFIG_IP_NF_ARPFILTER=m
556CONFIG_IP_NF_ARP_MANGLE=m
557
558#
559# SCTP Configuration (EXPERIMENTAL)
560#
561# CONFIG_IP_SCTP is not set
562# CONFIG_ATM is not set
563# CONFIG_BRIDGE is not set
564# CONFIG_VLAN_8021Q is not set
565# CONFIG_DECNET is not set
566# CONFIG_LLC2 is not set
567# CONFIG_IPX is not set
568# CONFIG_ATALK is not set
569# CONFIG_X25 is not set
570# CONFIG_LAPB is not set
571# CONFIG_NET_DIVERT is not set
572# CONFIG_ECONET is not set
573# CONFIG_WAN_ROUTER is not set
574
575#
576# QoS and/or fair queueing
577#
578# CONFIG_NET_SCHED is not set
579CONFIG_NET_CLS_ROUTE=y
580
581#
582# Network testing
583#
584# CONFIG_NET_PKTGEN is not set
585# CONFIG_NETPOLL is not set
586# CONFIG_NET_POLL_CONTROLLER is not set
587# CONFIG_HAMRADIO is not set
588CONFIG_IRDA=m
589
590#
591# IrDA protocols
592#
593CONFIG_IRLAN=m
594CONFIG_IRNET=m
595CONFIG_IRCOMM=m
596# CONFIG_IRDA_ULTRA is not set
597
598#
599# IrDA options
600#
601CONFIG_IRDA_CACHE_LAST_LSAP=y
602CONFIG_IRDA_FAST_RR=y
603# CONFIG_IRDA_DEBUG is not set
604
605#
606# Infrared-port device drivers
607#
608
609#
610# SIR device drivers
611#
612CONFIG_IRTTY_SIR=m
613
614#
615# Dongle support
616#
617# CONFIG_DONGLE is not set
618
619#
620# Old SIR device drivers
621#
622# CONFIG_IRPORT_SIR is not set
623
624#
625# Old Serial dongle support
626#
627
628#
629# FIR device drivers
630#
631# CONFIG_USB_IRDA is not set
632# CONFIG_SIGMATEL_FIR is not set
633# CONFIG_TOSHIBA_FIR is not set
634# CONFIG_VLSI_FIR is not set
635# CONFIG_BT is not set
636CONFIG_NETDEVICES=y
637# CONFIG_DUMMY is not set
638# CONFIG_BONDING is not set
639# CONFIG_EQUALIZER is not set
640# CONFIG_TUN is not set
641
642#
643# ARCnet devices
644#
645# CONFIG_ARCNET is not set
646
647#
648# Ethernet (10 or 100Mbit)
649#
650CONFIG_NET_ETHERNET=y
651CONFIG_MII=y
652CONFIG_MACE=y
653# CONFIG_MACE_AAUI_PORT is not set
654CONFIG_BMAC=y
655# CONFIG_HAPPYMEAL is not set
656CONFIG_SUNGEM=y
657# CONFIG_NET_VENDOR_3COM is not set
658
659#
660# Tulip family network device support
661#
662# CONFIG_NET_TULIP is not set
663# CONFIG_HP100 is not set
664CONFIG_NET_PCI=y
665CONFIG_PCNET32=y
666# CONFIG_AMD8111_ETH is not set
667# CONFIG_ADAPTEC_STARFIRE is not set
668# CONFIG_B44 is not set
669# CONFIG_FORCEDETH is not set
670# CONFIG_DGRS is not set
671# CONFIG_EEPRO100 is not set
672# CONFIG_E100 is not set
673# CONFIG_FEALNX is not set
674# CONFIG_NATSEMI is not set
675# CONFIG_NE2K_PCI is not set
676# CONFIG_8139CP is not set
677# CONFIG_8139TOO is not set
678# CONFIG_SIS900 is not set
679# CONFIG_EPIC100 is not set
680# CONFIG_SUNDANCE is not set
681# CONFIG_TLAN is not set
682# CONFIG_VIA_RHINE is not set
683
684#
685# Ethernet (1000 Mbit)
686#
687# CONFIG_ACENIC is not set
688# CONFIG_DL2K is not set
689# CONFIG_E1000 is not set
690# CONFIG_NS83820 is not set
691# CONFIG_HAMACHI is not set
692# CONFIG_YELLOWFIN is not set
693# CONFIG_R8169 is not set
694# CONFIG_SK98LIN is not set
695# CONFIG_VIA_VELOCITY is not set
696# CONFIG_TIGON3 is not set
697
698#
699# Ethernet (10000 Mbit)
700#
701# CONFIG_IXGB is not set
702# CONFIG_S2IO is not set
703
704#
705# Token Ring devices
706#
707# CONFIG_TR is not set
708
709#
710# Wireless LAN (non-hamradio)
711#
712CONFIG_NET_RADIO=y
713
714#
715# Obsolete Wireless cards support (pre-802.11)
716#
717# CONFIG_STRIP is not set
718# CONFIG_PCMCIA_WAVELAN is not set
719# CONFIG_PCMCIA_NETWAVE is not set
720
721#
722# Wireless 802.11 Frequency Hopping cards support
723#
724# CONFIG_PCMCIA_RAYCS is not set
725
726#
727# Wireless 802.11b ISA/PCI cards support
728#
729CONFIG_HERMES=m
730CONFIG_APPLE_AIRPORT=m
731# CONFIG_PLX_HERMES is not set
732# CONFIG_TMD_HERMES is not set
733# CONFIG_PCI_HERMES is not set
734# CONFIG_ATMEL is not set
735
736#
737# Wireless 802.11b Pcmcia/Cardbus cards support
738#
739CONFIG_PCMCIA_HERMES=m
740# CONFIG_AIRO_CS is not set
741# CONFIG_PCMCIA_WL3501 is not set
742
743#
744# Prism GT/Duette 802.11(a/b/g) PCI/Cardbus support
745#
746# CONFIG_PRISM54 is not set
747CONFIG_NET_WIRELESS=y
748
749#
750# PCMCIA network device support
751#
752# CONFIG_NET_PCMCIA is not set
753
754#
755# Wan interfaces
756#
757# CONFIG_WAN is not set
758# CONFIG_FDDI is not set
759# CONFIG_HIPPI is not set
760CONFIG_PPP=y
761CONFIG_PPP_MULTILINK=y
762# CONFIG_PPP_FILTER is not set
763CONFIG_PPP_ASYNC=y
764CONFIG_PPP_SYNC_TTY=m
765CONFIG_PPP_DEFLATE=y
766CONFIG_PPP_BSDCOMP=m
767CONFIG_PPPOE=m
768# CONFIG_SLIP is not set
769# CONFIG_NET_FC is not set
770# CONFIG_SHAPER is not set
771# CONFIG_NETCONSOLE is not set
772
773#
774# ISDN subsystem
775#
776# CONFIG_ISDN is not set
777
778#
779# Telephony Support
780#
781# CONFIG_PHONE is not set
782
783#
784# Input device support
785#
786CONFIG_INPUT=y
787
788#
789# Userland interfaces
790#
791CONFIG_INPUT_MOUSEDEV=y
792# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
793CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
794CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
795# CONFIG_INPUT_JOYDEV is not set
796# CONFIG_INPUT_TSDEV is not set
797CONFIG_INPUT_EVDEV=y
798# CONFIG_INPUT_EVBUG is not set
799
800#
801# Input I/O drivers
802#
803# CONFIG_GAMEPORT is not set
804CONFIG_SOUND_GAMEPORT=y
805# CONFIG_SERIO is not set
806# CONFIG_SERIO_I8042 is not set
807
808#
809# Input Device Drivers
810#
811CONFIG_INPUT_KEYBOARD=y
812# CONFIG_KEYBOARD_ATKBD is not set
813# CONFIG_KEYBOARD_SUNKBD is not set
814# CONFIG_KEYBOARD_LKKBD is not set
815# CONFIG_KEYBOARD_XTKBD is not set
816# CONFIG_KEYBOARD_NEWTON is not set
817CONFIG_INPUT_MOUSE=y
818# CONFIG_MOUSE_PS2 is not set
819# CONFIG_MOUSE_SERIAL is not set
820# CONFIG_MOUSE_VSXXXAA is not set
821# CONFIG_INPUT_JOYSTICK is not set
822# CONFIG_INPUT_TOUCHSCREEN is not set
823# CONFIG_INPUT_MISC is not set
824
825#
826# Character devices
827#
828CONFIG_VT=y
829CONFIG_VT_CONSOLE=y
830CONFIG_HW_CONSOLE=y
831# CONFIG_SERIAL_NONSTANDARD is not set
832
833#
834# Serial drivers
835#
836CONFIG_SERIAL_8250=m
837CONFIG_SERIAL_8250_CS=m
838CONFIG_SERIAL_8250_NR_UARTS=4
839# CONFIG_SERIAL_8250_EXTENDED is not set
840
841#
842# Non-8250 serial port support
843#
844CONFIG_SERIAL_CORE=y
845CONFIG_SERIAL_CORE_CONSOLE=y
846CONFIG_SERIAL_PMACZILOG=y
847CONFIG_SERIAL_PMACZILOG_CONSOLE=y
848CONFIG_UNIX98_PTYS=y
849CONFIG_LEGACY_PTYS=y
850CONFIG_LEGACY_PTY_COUNT=256
851
852#
853# IPMI
854#
855# CONFIG_IPMI_HANDLER is not set
856
857#
858# Watchdog Cards
859#
860# CONFIG_WATCHDOG is not set
861CONFIG_NVRAM=y
862CONFIG_GEN_RTC=y
863# CONFIG_GEN_RTC_X is not set
864# CONFIG_DTLK is not set
865# CONFIG_R3964 is not set
866# CONFIG_APPLICOM is not set
867
868#
869# Ftape, the floppy tape device driver
870#
871CONFIG_AGP=m
872CONFIG_AGP_UNINORTH=m
873CONFIG_DRM=m
874# CONFIG_DRM_TDFX is not set
875CONFIG_DRM_R128=m
876CONFIG_DRM_RADEON=m
877# CONFIG_DRM_MGA is not set
878# CONFIG_DRM_SIS is not set
879
880#
881# PCMCIA character devices
882#
883# CONFIG_SYNCLINK_CS is not set
884# CONFIG_RAW_DRIVER is not set
885
886#
887# I2C support
888#
889CONFIG_I2C=y
890CONFIG_I2C_CHARDEV=m
891
892#
893# I2C Algorithms
894#
895CONFIG_I2C_ALGOBIT=y
896# CONFIG_I2C_ALGOPCF is not set
897# CONFIG_I2C_ALGOPCA is not set
898
899#
900# I2C Hardware Bus support
901#
902# CONFIG_I2C_ALI1535 is not set
903# CONFIG_I2C_ALI1563 is not set
904# CONFIG_I2C_ALI15X3 is not set
905# CONFIG_I2C_AMD756 is not set
906# CONFIG_I2C_AMD8111 is not set
907# CONFIG_I2C_HYDRA is not set
908# CONFIG_I2C_I801 is not set
909# CONFIG_I2C_I810 is not set
910# CONFIG_I2C_ISA is not set
911CONFIG_I2C_KEYWEST=m
912# CONFIG_I2C_MPC is not set
913# CONFIG_I2C_NFORCE2 is not set
914# CONFIG_I2C_PARPORT_LIGHT is not set
915# CONFIG_I2C_PIIX4 is not set
916# CONFIG_I2C_PROSAVAGE is not set
917# CONFIG_I2C_SAVAGE4 is not set
918# CONFIG_SCx200_ACB is not set
919# CONFIG_I2C_SIS5595 is not set
920# CONFIG_I2C_SIS630 is not set
921# CONFIG_I2C_SIS96X is not set
922# CONFIG_I2C_STUB is not set
923# CONFIG_I2C_VIA is not set
924# CONFIG_I2C_VIAPRO is not set
925# CONFIG_I2C_VOODOO3 is not set
926# CONFIG_I2C_PCA_ISA is not set
927
928#
929# Hardware Sensors Chip support
930#
931# CONFIG_I2C_SENSOR is not set
932# CONFIG_SENSORS_ADM1021 is not set
933# CONFIG_SENSORS_ADM1025 is not set
934# CONFIG_SENSORS_ADM1026 is not set
935# CONFIG_SENSORS_ADM1031 is not set
936# CONFIG_SENSORS_ASB100 is not set
937# CONFIG_SENSORS_DS1621 is not set
938# CONFIG_SENSORS_FSCHER is not set
939# CONFIG_SENSORS_GL518SM is not set
940# CONFIG_SENSORS_IT87 is not set
941# CONFIG_SENSORS_LM63 is not set
942# CONFIG_SENSORS_LM75 is not set
943# CONFIG_SENSORS_LM77 is not set
944# CONFIG_SENSORS_LM78 is not set
945# CONFIG_SENSORS_LM80 is not set
946# CONFIG_SENSORS_LM83 is not set
947# CONFIG_SENSORS_LM85 is not set
948# CONFIG_SENSORS_LM87 is not set
949# CONFIG_SENSORS_LM90 is not set
950# CONFIG_SENSORS_MAX1619 is not set
951# CONFIG_SENSORS_PC87360 is not set
952# CONFIG_SENSORS_SMSC47B397 is not set
953# CONFIG_SENSORS_SMSC47M1 is not set
954# CONFIG_SENSORS_VIA686A is not set
955# CONFIG_SENSORS_W83781D is not set
956# CONFIG_SENSORS_W83L785TS is not set
957# CONFIG_SENSORS_W83627HF is not set
958
959#
960# Other I2C Chip support
961#
962# CONFIG_SENSORS_EEPROM is not set
963# CONFIG_SENSORS_PCF8574 is not set
964# CONFIG_SENSORS_PCF8591 is not set
965# CONFIG_SENSORS_RTC8564 is not set
966# CONFIG_I2C_DEBUG_CORE is not set
967# CONFIG_I2C_DEBUG_ALGO is not set
968# CONFIG_I2C_DEBUG_BUS is not set
969# CONFIG_I2C_DEBUG_CHIP is not set
970
971#
972# Dallas's 1-wire bus
973#
974# CONFIG_W1 is not set
975
976#
977# Misc devices
978#
979
980#
981# Multimedia devices
982#
983# CONFIG_VIDEO_DEV is not set
984
985#
986# Digital Video Broadcasting Devices
987#
988# CONFIG_DVB is not set
989
990#
991# Graphics support
992#
993CONFIG_FB=y
994CONFIG_FB_MODE_HELPERS=y
995CONFIG_FB_TILEBLITTING=y
996# CONFIG_FB_CIRRUS is not set
997# CONFIG_FB_PM2 is not set
998# CONFIG_FB_CYBER2000 is not set
999CONFIG_FB_OF=y
1000CONFIG_FB_CONTROL=y
1001CONFIG_FB_PLATINUM=y
1002CONFIG_FB_VALKYRIE=y
1003CONFIG_FB_CT65550=y
1004# CONFIG_FB_ASILIANT is not set
1005CONFIG_FB_IMSTT=y
1006# CONFIG_FB_VGA16 is not set
1007# CONFIG_FB_RIVA is not set
1008CONFIG_FB_MATROX=y
1009CONFIG_FB_MATROX_MILLENIUM=y
1010CONFIG_FB_MATROX_MYSTIQUE=y
1011CONFIG_FB_MATROX_G=y
1012# CONFIG_FB_MATROX_I2C is not set
1013# CONFIG_FB_MATROX_MULTIHEAD is not set
1014# CONFIG_FB_RADEON_OLD is not set
1015CONFIG_FB_RADEON=y
1016CONFIG_FB_RADEON_I2C=y
1017# CONFIG_FB_RADEON_DEBUG is not set
1018CONFIG_FB_ATY128=y
1019CONFIG_FB_ATY=y
1020CONFIG_FB_ATY_CT=y
1021CONFIG_FB_ATY_GENERIC_LCD=y
1022# CONFIG_FB_ATY_XL_INIT is not set
1023CONFIG_FB_ATY_GX=y
1024# CONFIG_FB_SAVAGE is not set
1025# CONFIG_FB_SIS is not set
1026# CONFIG_FB_NEOMAGIC is not set
1027# CONFIG_FB_KYRO is not set
1028CONFIG_FB_3DFX=y
1029CONFIG_FB_3DFX_ACCEL=y
1030# CONFIG_FB_VOODOO1 is not set
1031# CONFIG_FB_TRIDENT is not set
1032# CONFIG_FB_VIRTUAL is not set
1033
1034#
1035# Console display driver support
1036#
1037# CONFIG_VGA_CONSOLE is not set
1038CONFIG_DUMMY_CONSOLE=y
1039CONFIG_FRAMEBUFFER_CONSOLE=y
1040# CONFIG_FONTS is not set
1041CONFIG_FONT_8x8=y
1042CONFIG_FONT_8x16=y
1043
1044#
1045# Logo configuration
1046#
1047CONFIG_LOGO=y
1048CONFIG_LOGO_LINUX_MONO=y
1049CONFIG_LOGO_LINUX_VGA16=y
1050CONFIG_LOGO_LINUX_CLUT224=y
1051CONFIG_BACKLIGHT_LCD_SUPPORT=y
1052CONFIG_BACKLIGHT_CLASS_DEVICE=y
1053CONFIG_BACKLIGHT_DEVICE=y
1054CONFIG_LCD_CLASS_DEVICE=y
1055CONFIG_LCD_DEVICE=y
1056
1057#
1058# Sound
1059#
1060CONFIG_SOUND=m
1061CONFIG_DMASOUND_PMAC=m
1062CONFIG_DMASOUND=m
1063
1064#
1065# Advanced Linux Sound Architecture
1066#
1067CONFIG_SND=m
1068CONFIG_SND_TIMER=m
1069CONFIG_SND_PCM=m
1070CONFIG_SND_HWDEP=m
1071CONFIG_SND_RAWMIDI=m
1072CONFIG_SND_SEQUENCER=m
1073CONFIG_SND_SEQ_DUMMY=m
1074CONFIG_SND_OSSEMUL=y
1075CONFIG_SND_MIXER_OSS=m
1076CONFIG_SND_PCM_OSS=m
1077CONFIG_SND_SEQUENCER_OSS=y
1078# CONFIG_SND_VERBOSE_PRINTK is not set
1079# CONFIG_SND_DEBUG is not set
1080
1081#
1082# Generic devices
1083#
1084CONFIG_SND_DUMMY=m
1085# CONFIG_SND_VIRMIDI is not set
1086# CONFIG_SND_MTPAV is not set
1087# CONFIG_SND_SERIAL_U16550 is not set
1088# CONFIG_SND_MPU401 is not set
1089
1090#
1091# PCI devices
1092#
1093# CONFIG_SND_ALI5451 is not set
1094# CONFIG_SND_ATIIXP is not set
1095# CONFIG_SND_ATIIXP_MODEM is not set
1096# CONFIG_SND_AU8810 is not set
1097# CONFIG_SND_AU8820 is not set
1098# CONFIG_SND_AU8830 is not set
1099# CONFIG_SND_AZT3328 is not set
1100# CONFIG_SND_BT87X is not set
1101# CONFIG_SND_CS46XX is not set
1102# CONFIG_SND_CS4281 is not set
1103# CONFIG_SND_EMU10K1 is not set
1104# CONFIG_SND_EMU10K1X is not set
1105# CONFIG_SND_CA0106 is not set
1106# CONFIG_SND_KORG1212 is not set
1107# CONFIG_SND_MIXART is not set
1108# CONFIG_SND_NM256 is not set
1109# CONFIG_SND_RME32 is not set
1110# CONFIG_SND_RME96 is not set
1111# CONFIG_SND_RME9652 is not set
1112# CONFIG_SND_HDSP is not set
1113# CONFIG_SND_TRIDENT is not set
1114# CONFIG_SND_YMFPCI is not set
1115# CONFIG_SND_ALS4000 is not set
1116# CONFIG_SND_CMIPCI is not set
1117# CONFIG_SND_ENS1370 is not set
1118# CONFIG_SND_ENS1371 is not set
1119# CONFIG_SND_ES1938 is not set
1120# CONFIG_SND_ES1968 is not set
1121# CONFIG_SND_MAESTRO3 is not set
1122# CONFIG_SND_FM801 is not set
1123# CONFIG_SND_ICE1712 is not set
1124# CONFIG_SND_ICE1724 is not set
1125# CONFIG_SND_INTEL8X0 is not set
1126# CONFIG_SND_INTEL8X0M is not set
1127# CONFIG_SND_SONICVIBES is not set
1128# CONFIG_SND_VIA82XX is not set
1129# CONFIG_SND_VIA82XX_MODEM is not set
1130# CONFIG_SND_VX222 is not set
1131
1132#
1133# ALSA PowerMac devices
1134#
1135CONFIG_SND_POWERMAC=m
1136
1137#
1138# USB devices
1139#
1140CONFIG_SND_USB_AUDIO=m
1141CONFIG_SND_USB_USX2Y=m
1142
1143#
1144# PCMCIA devices
1145#
1146
1147#
1148# Open Sound System
1149#
1150# CONFIG_SOUND_PRIME is not set
1151
1152#
1153# USB support
1154#
1155CONFIG_USB=y
1156# CONFIG_USB_DEBUG is not set
1157
1158#
1159# Miscellaneous USB options
1160#
1161CONFIG_USB_DEVICEFS=y
1162# CONFIG_USB_BANDWIDTH is not set
1163CONFIG_USB_DYNAMIC_MINORS=y
1164CONFIG_USB_SUSPEND=y
1165# CONFIG_USB_OTG is not set
1166CONFIG_USB_ARCH_HAS_HCD=y
1167CONFIG_USB_ARCH_HAS_OHCI=y
1168
1169#
1170# USB Host Controller Drivers
1171#
1172# CONFIG_USB_EHCI_HCD is not set
1173CONFIG_USB_OHCI_HCD=y
1174# CONFIG_USB_UHCI_HCD is not set
1175# CONFIG_USB_SL811_HCD is not set
1176
1177#
1178# USB Device Class drivers
1179#
1180# CONFIG_USB_AUDIO is not set
1181# CONFIG_USB_BLUETOOTH_TTY is not set
1182# CONFIG_USB_MIDI is not set
1183CONFIG_USB_ACM=m
1184CONFIG_USB_PRINTER=m
1185
1186#
1187# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
1188#
1189# CONFIG_USB_STORAGE is not set
1190
1191#
1192# USB Input Devices
1193#
1194CONFIG_USB_HID=y
1195CONFIG_USB_HIDINPUT=y
1196# CONFIG_HID_FF is not set
1197CONFIG_USB_HIDDEV=y
1198# CONFIG_USB_AIPTEK is not set
1199# CONFIG_USB_WACOM is not set
1200# CONFIG_USB_KBTAB is not set
1201# CONFIG_USB_POWERMATE is not set
1202# CONFIG_USB_MTOUCH is not set
1203# CONFIG_USB_EGALAX is not set
1204# CONFIG_USB_XPAD is not set
1205# CONFIG_USB_ATI_REMOTE is not set
1206
1207#
1208# USB Imaging devices
1209#
1210# CONFIG_USB_MDC800 is not set
1211# CONFIG_USB_MICROTEK is not set
1212
1213#
1214# USB Multimedia devices
1215#
1216# CONFIG_USB_DABUSB is not set
1217
1218#
1219# Video4Linux support is needed for USB Multimedia device support
1220#
1221
1222#
1223# USB Network Adapters
1224#
1225# CONFIG_USB_CATC is not set
1226# CONFIG_USB_KAWETH is not set
1227CONFIG_USB_PEGASUS=m
1228# CONFIG_USB_RTL8150 is not set
1229# CONFIG_USB_USBNET is not set
1230
1231#
1232# USB port drivers
1233#
1234
1235#
1236# USB Serial Converter support
1237#
1238CONFIG_USB_SERIAL=m
1239# CONFIG_USB_SERIAL_GENERIC is not set
1240# CONFIG_USB_SERIAL_BELKIN is not set
1241# CONFIG_USB_SERIAL_WHITEHEAT is not set
1242# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set
1243# CONFIG_USB_SERIAL_CYPRESS_M8 is not set
1244# CONFIG_USB_SERIAL_EMPEG is not set
1245# CONFIG_USB_SERIAL_FTDI_SIO is not set
1246CONFIG_USB_SERIAL_VISOR=m
1247# CONFIG_USB_SERIAL_IPAQ is not set
1248# CONFIG_USB_SERIAL_IR is not set
1249# CONFIG_USB_SERIAL_EDGEPORT is not set
1250# CONFIG_USB_SERIAL_EDGEPORT_TI is not set
1251# CONFIG_USB_SERIAL_GARMIN is not set
1252# CONFIG_USB_SERIAL_IPW is not set
1253# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set
1254CONFIG_USB_SERIAL_KEYSPAN=m
1255CONFIG_USB_SERIAL_KEYSPAN_MPR=y
1256CONFIG_USB_SERIAL_KEYSPAN_USA28=y
1257CONFIG_USB_SERIAL_KEYSPAN_USA28X=y
1258CONFIG_USB_SERIAL_KEYSPAN_USA28XA=y
1259CONFIG_USB_SERIAL_KEYSPAN_USA28XB=y
1260CONFIG_USB_SERIAL_KEYSPAN_USA19=y
1261CONFIG_USB_SERIAL_KEYSPAN_USA18X=y
1262CONFIG_USB_SERIAL_KEYSPAN_USA19W=y
1263CONFIG_USB_SERIAL_KEYSPAN_USA19QW=y
1264CONFIG_USB_SERIAL_KEYSPAN_USA19QI=y
1265CONFIG_USB_SERIAL_KEYSPAN_USA49W=y
1266CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y
1267# CONFIG_USB_SERIAL_KLSI is not set
1268# CONFIG_USB_SERIAL_KOBIL_SCT is not set
1269# CONFIG_USB_SERIAL_MCT_U232 is not set
1270# CONFIG_USB_SERIAL_PL2303 is not set
1271# CONFIG_USB_SERIAL_SAFE is not set
1272# CONFIG_USB_SERIAL_TI is not set
1273# CONFIG_USB_SERIAL_CYBERJACK is not set
1274# CONFIG_USB_SERIAL_XIRCOM is not set
1275# CONFIG_USB_SERIAL_OMNINET is not set
1276CONFIG_USB_EZUSB=y
1277
1278#
1279# USB Miscellaneous drivers
1280#
1281# CONFIG_USB_EMI62 is not set
1282# CONFIG_USB_EMI26 is not set
1283# CONFIG_USB_AUERSWALD is not set
1284# CONFIG_USB_RIO500 is not set
1285# CONFIG_USB_LEGOTOWER is not set
1286# CONFIG_USB_LCD is not set
1287# CONFIG_USB_LED is not set
1288# CONFIG_USB_CYTHERM is not set
1289# CONFIG_USB_PHIDGETKIT is not set
1290# CONFIG_USB_PHIDGETSERVO is not set
1291# CONFIG_USB_IDMOUSE is not set
1292# CONFIG_USB_TEST is not set
1293
1294#
1295# USB ATM/DSL drivers
1296#
1297
1298#
1299# USB Gadget Support
1300#
1301# CONFIG_USB_GADGET is not set
1302
1303#
1304# MMC/SD Card support
1305#
1306# CONFIG_MMC is not set
1307
1308#
1309# InfiniBand support
1310#
1311# CONFIG_INFINIBAND is not set
1312
1313#
1314# File systems
1315#
1316CONFIG_EXT2_FS=y
1317CONFIG_EXT2_FS_XATTR=y
1318# CONFIG_EXT2_FS_POSIX_ACL is not set
1319# CONFIG_EXT2_FS_SECURITY is not set
1320CONFIG_EXT3_FS=y
1321CONFIG_EXT3_FS_XATTR=y
1322# CONFIG_EXT3_FS_POSIX_ACL is not set
1323# CONFIG_EXT3_FS_SECURITY is not set
1324CONFIG_JBD=y
1325# CONFIG_JBD_DEBUG is not set
1326CONFIG_FS_MBCACHE=y
1327# CONFIG_REISERFS_FS is not set
1328# CONFIG_JFS_FS is not set
1329
1330#
1331# XFS support
1332#
1333# CONFIG_XFS_FS is not set
1334# CONFIG_MINIX_FS is not set
1335# CONFIG_ROMFS_FS is not set
1336# CONFIG_QUOTA is not set
1337CONFIG_DNOTIFY=y
1338# CONFIG_AUTOFS_FS is not set
1339# CONFIG_AUTOFS4_FS is not set
1340
1341#
1342# CD-ROM/DVD Filesystems
1343#
1344CONFIG_ISO9660_FS=y
1345# CONFIG_JOLIET is not set
1346# CONFIG_ZISOFS is not set
1347CONFIG_UDF_FS=m
1348CONFIG_UDF_NLS=y
1349
1350#
1351# DOS/FAT/NT Filesystems
1352#
1353CONFIG_FAT_FS=m
1354CONFIG_MSDOS_FS=m
1355CONFIG_VFAT_FS=m
1356CONFIG_FAT_DEFAULT_CODEPAGE=437
1357CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1358# CONFIG_NTFS_FS is not set
1359
1360#
1361# Pseudo filesystems
1362#
1363CONFIG_PROC_FS=y
1364CONFIG_PROC_KCORE=y
1365CONFIG_SYSFS=y
1366# CONFIG_DEVFS_FS is not set
1367CONFIG_DEVPTS_FS_XATTR=y
1368CONFIG_DEVPTS_FS_SECURITY=y
1369CONFIG_TMPFS=y
1370CONFIG_TMPFS_XATTR=y
1371CONFIG_TMPFS_SECURITY=y
1372# CONFIG_HUGETLB_PAGE is not set
1373CONFIG_RAMFS=y
1374
1375#
1376# Miscellaneous filesystems
1377#
1378# CONFIG_ADFS_FS is not set
1379# CONFIG_AFFS_FS is not set
1380CONFIG_HFS_FS=m
1381CONFIG_HFSPLUS_FS=m
1382# CONFIG_BEFS_FS is not set
1383# CONFIG_BFS_FS is not set
1384# CONFIG_EFS_FS is not set
1385CONFIG_CRAMFS=m
1386# CONFIG_VXFS_FS is not set
1387# CONFIG_HPFS_FS is not set
1388# CONFIG_QNX4FS_FS is not set
1389# CONFIG_SYSV_FS is not set
1390# CONFIG_UFS_FS is not set
1391
1392#
1393# Network File Systems
1394#
1395CONFIG_NFS_FS=y
1396CONFIG_NFS_V3=y
1397# CONFIG_NFS_V4 is not set
1398# CONFIG_NFS_DIRECTIO is not set
1399CONFIG_NFSD=y
1400CONFIG_NFSD_V3=y
1401# CONFIG_NFSD_V4 is not set
1402CONFIG_NFSD_TCP=y
1403CONFIG_LOCKD=y
1404CONFIG_LOCKD_V4=y
1405CONFIG_EXPORTFS=y
1406CONFIG_SUNRPC=y
1407# CONFIG_RPCSEC_GSS_KRB5 is not set
1408# CONFIG_RPCSEC_GSS_SPKM3 is not set
1409CONFIG_SMB_FS=m
1410# CONFIG_SMB_NLS_DEFAULT is not set
1411# CONFIG_CIFS is not set
1412# CONFIG_NCP_FS is not set
1413# CONFIG_CODA_FS is not set
1414# CONFIG_AFS_FS is not set
1415
1416#
1417# Partition Types
1418#
1419CONFIG_PARTITION_ADVANCED=y
1420# CONFIG_ACORN_PARTITION is not set
1421# CONFIG_OSF_PARTITION is not set
1422# CONFIG_AMIGA_PARTITION is not set
1423# CONFIG_ATARI_PARTITION is not set
1424CONFIG_MAC_PARTITION=y
1425CONFIG_MSDOS_PARTITION=y
1426# CONFIG_BSD_DISKLABEL is not set
1427# CONFIG_MINIX_SUBPARTITION is not set
1428# CONFIG_SOLARIS_X86_PARTITION is not set
1429# CONFIG_UNIXWARE_DISKLABEL is not set
1430# CONFIG_LDM_PARTITION is not set
1431# CONFIG_SGI_PARTITION is not set
1432# CONFIG_ULTRIX_PARTITION is not set
1433# CONFIG_SUN_PARTITION is not set
1434# CONFIG_EFI_PARTITION is not set
1435
1436#
1437# Native Language Support
1438#
1439CONFIG_NLS=y
1440CONFIG_NLS_DEFAULT="iso8859-1"
1441# CONFIG_NLS_CODEPAGE_437 is not set
1442# CONFIG_NLS_CODEPAGE_737 is not set
1443# CONFIG_NLS_CODEPAGE_775 is not set
1444# CONFIG_NLS_CODEPAGE_850 is not set
1445# CONFIG_NLS_CODEPAGE_852 is not set
1446# CONFIG_NLS_CODEPAGE_855 is not set
1447# CONFIG_NLS_CODEPAGE_857 is not set
1448# CONFIG_NLS_CODEPAGE_860 is not set
1449# CONFIG_NLS_CODEPAGE_861 is not set
1450# CONFIG_NLS_CODEPAGE_862 is not set
1451# CONFIG_NLS_CODEPAGE_863 is not set
1452# CONFIG_NLS_CODEPAGE_864 is not set
1453# CONFIG_NLS_CODEPAGE_865 is not set
1454# CONFIG_NLS_CODEPAGE_866 is not set
1455# CONFIG_NLS_CODEPAGE_869 is not set
1456# CONFIG_NLS_CODEPAGE_936 is not set
1457# CONFIG_NLS_CODEPAGE_950 is not set
1458# CONFIG_NLS_CODEPAGE_932 is not set
1459# CONFIG_NLS_CODEPAGE_949 is not set
1460# CONFIG_NLS_CODEPAGE_874 is not set
1461# CONFIG_NLS_ISO8859_8 is not set
1462CONFIG_NLS_CODEPAGE_1250=m
1463CONFIG_NLS_CODEPAGE_1251=m
1464CONFIG_NLS_ASCII=m
1465CONFIG_NLS_ISO8859_1=m
1466# CONFIG_NLS_ISO8859_2 is not set
1467# CONFIG_NLS_ISO8859_3 is not set
1468# CONFIG_NLS_ISO8859_4 is not set
1469# CONFIG_NLS_ISO8859_5 is not set
1470# CONFIG_NLS_ISO8859_6 is not set
1471# CONFIG_NLS_ISO8859_7 is not set
1472# CONFIG_NLS_ISO8859_9 is not set
1473# CONFIG_NLS_ISO8859_13 is not set
1474# CONFIG_NLS_ISO8859_14 is not set
1475CONFIG_NLS_ISO8859_15=m
1476# CONFIG_NLS_KOI8_R is not set
1477# CONFIG_NLS_KOI8_U is not set
1478CONFIG_NLS_UTF8=m
1479
1480#
1481# Library routines
1482#
1483CONFIG_CRC_CCITT=y
1484CONFIG_CRC32=y
1485# CONFIG_LIBCRC32C is not set
1486CONFIG_ZLIB_INFLATE=y
1487CONFIG_ZLIB_DEFLATE=y
1488
1489#
1490# Profiling support
1491#
1492# CONFIG_PROFILING is not set
1493
1494#
1495# Kernel hacking
1496#
1497CONFIG_DEBUG_KERNEL=y
1498CONFIG_MAGIC_SYSRQ=y
1499# CONFIG_SCHEDSTATS is not set
1500# CONFIG_DEBUG_SLAB is not set
1501# CONFIG_DEBUG_SPINLOCK is not set
1502# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1503# CONFIG_DEBUG_KOBJECT is not set
1504# CONFIG_DEBUG_INFO is not set
1505# CONFIG_DEBUG_FS is not set
1506# CONFIG_XMON is not set
1507# CONFIG_BDI_SWITCH is not set
1508CONFIG_BOOTX_TEXT=y
1509
1510#
1511# Security options
1512#
1513# CONFIG_KEYS is not set
1514# CONFIG_SECURITY is not set
1515
1516#
1517# Cryptographic options
1518#
1519# CONFIG_CRYPTO is not set
1520
1521#
1522# Hardware crypto devices
1523#
diff --git a/arch/ppc/configs/power3_defconfig b/arch/ppc/configs/power3_defconfig
new file mode 100644
index 000000000000..93da595a4738
--- /dev/null
+++ b/arch/ppc/configs/power3_defconfig
@@ -0,0 +1,1034 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7CONFIG_PPC=y
8CONFIG_PPC32=y
9CONFIG_GENERIC_NVRAM=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16# CONFIG_STANDALONE is not set
17
18#
19# General setup
20#
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23CONFIG_POSIX_MQUEUE=y
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27CONFIG_LOG_BUF_SHIFT=15
28# CONFIG_HOTPLUG is not set
29CONFIG_IKCONFIG=y
30CONFIG_IKCONFIG_PROC=y
31# CONFIG_EMBEDDED is not set
32CONFIG_KALLSYMS=y
33CONFIG_FUTEX=y
34CONFIG_EPOLL=y
35CONFIG_IOSCHED_NOOP=y
36CONFIG_IOSCHED_AS=y
37CONFIG_IOSCHED_DEADLINE=y
38CONFIG_IOSCHED_CFQ=y
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
40
41#
42# Loadable module support
43#
44CONFIG_MODULES=y
45CONFIG_MODULE_UNLOAD=y
46CONFIG_MODULE_FORCE_UNLOAD=y
47CONFIG_OBSOLETE_MODPARM=y
48# CONFIG_MODVERSIONS is not set
49CONFIG_KMOD=y
50CONFIG_STOP_MACHINE=y
51
52#
53# Processor
54#
55# CONFIG_6xx is not set
56# CONFIG_40x is not set
57# CONFIG_44x is not set
58CONFIG_POWER3=y
59# CONFIG_POWER4 is not set
60# CONFIG_8xx is not set
61# CONFIG_CPU_FREQ is not set
62CONFIG_PPC64BRIDGE=y
63CONFIG_PPC_STD_MMU=y
64
65#
66# Platform options
67#
68CONFIG_PPC_MULTIPLATFORM=y
69# CONFIG_APUS is not set
70# CONFIG_WILLOW is not set
71# CONFIG_PCORE is not set
72# CONFIG_POWERPMC250 is not set
73# CONFIG_EV64260 is not set
74# CONFIG_SPRUCE is not set
75# CONFIG_LOPEC is not set
76# CONFIG_MCPN765 is not set
77# CONFIG_MVME5100 is not set
78# CONFIG_PPLUS is not set
79# CONFIG_PRPMC750 is not set
80# CONFIG_PRPMC800 is not set
81# CONFIG_SANDPOINT is not set
82# CONFIG_ADIR is not set
83# CONFIG_K2 is not set
84# CONFIG_PAL4 is not set
85# CONFIG_GEMINI is not set
86# CONFIG_EST8260 is not set
87# CONFIG_SBS8260 is not set
88# CONFIG_RPX6 is not set
89# CONFIG_TQM8260 is not set
90CONFIG_PPC_CHRP=y
91CONFIG_PPC_PMAC=y
92CONFIG_PPC_PREP=y
93CONFIG_PPC_OF=y
94CONFIG_PPCBUG_NVRAM=y
95CONFIG_SMP=y
96# CONFIG_IRQ_ALL_CPUS is not set
97CONFIG_NR_CPUS=32
98# CONFIG_PREEMPT is not set
99CONFIG_HIGHMEM=y
100CONFIG_KERNEL_ELF=y
101CONFIG_BINFMT_ELF=y
102CONFIG_BINFMT_MISC=y
103CONFIG_PROC_DEVICETREE=y
104CONFIG_PPC_RTAS=y
105# CONFIG_PREP_RESIDUAL is not set
106# CONFIG_CMDLINE_BOOL is not set
107
108#
109# Bus options
110#
111CONFIG_ISA=y
112CONFIG_GENERIC_ISA_DMA=y
113CONFIG_PCI=y
114CONFIG_PCI_DOMAINS=y
115CONFIG_PCI_LEGACY_PROC=y
116CONFIG_PCI_NAMES=y
117
118#
119# Advanced setup
120#
121CONFIG_ADVANCED_OPTIONS=y
122# CONFIG_HIGHMEM_START_BOOL is not set
123CONFIG_HIGHMEM_START=0xfe000000
124# CONFIG_LOWMEM_SIZE_BOOL is not set
125CONFIG_LOWMEM_SIZE=0x30000000
126# CONFIG_KERNEL_START_BOOL is not set
127CONFIG_KERNEL_START=0xc0000000
128CONFIG_TASK_SIZE_BOOL=y
129CONFIG_TASK_SIZE=0xc0000000
130CONFIG_BOOT_LOAD=0x00800000
131
132#
133# Device Drivers
134#
135
136#
137# Generic Driver Options
138#
139
140#
141# Memory Technology Devices (MTD)
142#
143# CONFIG_MTD is not set
144
145#
146# Parallel port support
147#
148CONFIG_PARPORT=m
149CONFIG_PARPORT_PC=m
150CONFIG_PARPORT_PC_CML1=m
151# CONFIG_PARPORT_SERIAL is not set
152CONFIG_PARPORT_PC_FIFO=y
153# CONFIG_PARPORT_PC_SUPERIO is not set
154# CONFIG_PARPORT_OTHER is not set
155# CONFIG_PARPORT_1284 is not set
156
157#
158# Plug and Play support
159#
160# CONFIG_PNP is not set
161
162#
163# Block devices
164#
165CONFIG_BLK_DEV_FD=y
166# CONFIG_BLK_DEV_XD is not set
167# CONFIG_PARIDE is not set
168# CONFIG_BLK_CPQ_DA is not set
169# CONFIG_BLK_CPQ_CISS_DA is not set
170# CONFIG_BLK_DEV_DAC960 is not set
171# CONFIG_BLK_DEV_UMEM is not set
172CONFIG_BLK_DEV_LOOP=y
173# CONFIG_BLK_DEV_CRYPTOLOOP is not set
174# CONFIG_BLK_DEV_NBD is not set
175# CONFIG_BLK_DEV_CARMEL is not set
176CONFIG_BLK_DEV_RAM=y
177CONFIG_BLK_DEV_RAM_SIZE=4096
178CONFIG_BLK_DEV_INITRD=y
179CONFIG_LBD=y
180
181#
182# ATA/ATAPI/MFM/RLL support
183#
184# CONFIG_IDE is not set
185
186#
187# SCSI device support
188#
189CONFIG_SCSI=y
190CONFIG_SCSI_PROC_FS=y
191
192#
193# SCSI support type (disk, tape, CD-ROM)
194#
195CONFIG_BLK_DEV_SD=y
196CONFIG_CHR_DEV_ST=y
197# CONFIG_CHR_DEV_OSST is not set
198CONFIG_BLK_DEV_SR=y
199CONFIG_BLK_DEV_SR_VENDOR=y
200CONFIG_CHR_DEV_SG=y
201
202#
203# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
204#
205# CONFIG_SCSI_MULTI_LUN is not set
206# CONFIG_SCSI_REPORT_LUNS is not set
207CONFIG_SCSI_CONSTANTS=y
208CONFIG_SCSI_LOGGING=y
209
210#
211# SCSI Transport Attributes
212#
213CONFIG_SCSI_SPI_ATTRS=y
214# CONFIG_SCSI_FC_ATTRS is not set
215
216#
217# SCSI low-level drivers
218#
219# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
220# CONFIG_SCSI_7000FASST is not set
221# CONFIG_SCSI_ACARD is not set
222# CONFIG_SCSI_AHA152X is not set
223# CONFIG_SCSI_AHA1542 is not set
224# CONFIG_SCSI_AACRAID is not set
225# CONFIG_SCSI_AIC7XXX is not set
226# CONFIG_SCSI_AIC7XXX_OLD is not set
227# CONFIG_SCSI_AIC79XX is not set
228# CONFIG_SCSI_ADVANSYS is not set
229# CONFIG_SCSI_IN2000 is not set
230# CONFIG_SCSI_MEGARAID is not set
231# CONFIG_SCSI_SATA is not set
232# CONFIG_SCSI_BUSLOGIC is not set
233# CONFIG_SCSI_CPQFCTS is not set
234# CONFIG_SCSI_DMX3191D is not set
235# CONFIG_SCSI_DTC3280 is not set
236# CONFIG_SCSI_EATA is not set
237# CONFIG_SCSI_EATA_PIO is not set
238# CONFIG_SCSI_FUTURE_DOMAIN is not set
239# CONFIG_SCSI_GDTH is not set
240# CONFIG_SCSI_GENERIC_NCR5380 is not set
241# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
242# CONFIG_SCSI_IPS is not set
243# CONFIG_SCSI_INIA100 is not set
244# CONFIG_SCSI_PPA is not set
245# CONFIG_SCSI_IMM is not set
246# CONFIG_SCSI_NCR53C406A is not set
247CONFIG_SCSI_SYM53C8XX_2=y
248CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1
249CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
250CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
251# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set
252# CONFIG_SCSI_IPR is not set
253# CONFIG_SCSI_PAS16 is not set
254# CONFIG_SCSI_PSI240I is not set
255# CONFIG_SCSI_QLOGIC_FAS is not set
256# CONFIG_SCSI_QLOGIC_ISP is not set
257# CONFIG_SCSI_QLOGIC_FC is not set
258# CONFIG_SCSI_QLOGIC_1280 is not set
259CONFIG_SCSI_QLA2XXX=y
260# CONFIG_SCSI_QLA21XX is not set
261# CONFIG_SCSI_QLA22XX is not set
262# CONFIG_SCSI_QLA2300 is not set
263# CONFIG_SCSI_QLA2322 is not set
264# CONFIG_SCSI_QLA6312 is not set
265# CONFIG_SCSI_QLA6322 is not set
266# CONFIG_SCSI_SYM53C416 is not set
267# CONFIG_SCSI_DC395x is not set
268# CONFIG_SCSI_DC390T is not set
269# CONFIG_SCSI_T128 is not set
270# CONFIG_SCSI_U14_34F is not set
271# CONFIG_SCSI_NSP32 is not set
272# CONFIG_SCSI_DEBUG is not set
273# CONFIG_SCSI_MESH is not set
274# CONFIG_SCSI_MAC53C94 is not set
275
276#
277# Old CD-ROM drivers (not SCSI, not IDE)
278#
279# CONFIG_CD_NO_IDESCSI is not set
280
281#
282# Multi-device support (RAID and LVM)
283#
284CONFIG_MD=y
285CONFIG_BLK_DEV_MD=y
286CONFIG_MD_LINEAR=y
287CONFIG_MD_RAID0=y
288CONFIG_MD_RAID1=y
289CONFIG_MD_RAID5=y
290CONFIG_MD_RAID6=y
291# CONFIG_MD_MULTIPATH is not set
292CONFIG_BLK_DEV_DM=y
293CONFIG_DM_CRYPT=y
294
295#
296# Fusion MPT device support
297#
298# CONFIG_FUSION is not set
299
300#
301# IEEE 1394 (FireWire) support
302#
303# CONFIG_IEEE1394 is not set
304
305#
306# I2O device support
307#
308# CONFIG_I2O is not set
309
310#
311# Macintosh device drivers
312#
313# CONFIG_ADB is not set
314# CONFIG_ADB_CUDA is not set
315# CONFIG_ADB_PMU is not set
316# CONFIG_MAC_FLOPPY is not set
317# CONFIG_MAC_SERIAL is not set
318
319#
320# Networking support
321#
322CONFIG_NET=y
323
324#
325# Networking options
326#
327CONFIG_PACKET=y
328# CONFIG_PACKET_MMAP is not set
329# CONFIG_NETLINK_DEV is not set
330CONFIG_UNIX=y
331# CONFIG_NET_KEY is not set
332CONFIG_INET=y
333CONFIG_IP_MULTICAST=y
334# CONFIG_IP_ADVANCED_ROUTER is not set
335# CONFIG_IP_PNP is not set
336# CONFIG_NET_IPIP is not set
337# CONFIG_NET_IPGRE is not set
338# CONFIG_IP_MROUTE is not set
339# CONFIG_ARPD is not set
340CONFIG_SYN_COOKIES=y
341# CONFIG_INET_AH is not set
342# CONFIG_INET_ESP is not set
343# CONFIG_INET_IPCOMP is not set
344# CONFIG_IPV6 is not set
345# CONFIG_NETFILTER is not set
346
347#
348# SCTP Configuration (EXPERIMENTAL)
349#
350# CONFIG_IP_SCTP is not set
351# CONFIG_ATM is not set
352# CONFIG_BRIDGE is not set
353# CONFIG_VLAN_8021Q is not set
354# CONFIG_DECNET is not set
355# CONFIG_LLC2 is not set
356# CONFIG_IPX is not set
357# CONFIG_ATALK is not set
358# CONFIG_X25 is not set
359# CONFIG_LAPB is not set
360# CONFIG_NET_DIVERT is not set
361# CONFIG_ECONET is not set
362# CONFIG_WAN_ROUTER is not set
363# CONFIG_NET_HW_FLOWCONTROL is not set
364
365#
366# QoS and/or fair queueing
367#
368# CONFIG_NET_SCHED is not set
369
370#
371# Network testing
372#
373# CONFIG_NET_PKTGEN is not set
374# CONFIG_NETPOLL is not set
375# CONFIG_NET_POLL_CONTROLLER is not set
376# CONFIG_HAMRADIO is not set
377# CONFIG_IRDA is not set
378# CONFIG_BT is not set
379CONFIG_NETDEVICES=y
380# CONFIG_DUMMY is not set
381# CONFIG_BONDING is not set
382# CONFIG_EQUALIZER is not set
383# CONFIG_TUN is not set
384
385#
386# ARCnet devices
387#
388# CONFIG_ARCNET is not set
389
390#
391# Ethernet (10 or 100Mbit)
392#
393CONFIG_NET_ETHERNET=y
394CONFIG_MII=y
395# CONFIG_MACE is not set
396# CONFIG_BMAC is not set
397# CONFIG_OAKNET is not set
398# CONFIG_HAPPYMEAL is not set
399# CONFIG_SUNGEM is not set
400# CONFIG_NET_VENDOR_3COM is not set
401# CONFIG_LANCE is not set
402# CONFIG_NET_VENDOR_SMC is not set
403# CONFIG_NET_VENDOR_RACAL is not set
404
405#
406# Tulip family network device support
407#
408# CONFIG_NET_TULIP is not set
409# CONFIG_AT1700 is not set
410# CONFIG_DEPCA is not set
411# CONFIG_HP100 is not set
412# CONFIG_NET_ISA is not set
413CONFIG_NET_PCI=y
414CONFIG_PCNET32=y
415# CONFIG_AMD8111_ETH is not set
416# CONFIG_ADAPTEC_STARFIRE is not set
417# CONFIG_AC3200 is not set
418# CONFIG_APRICOT is not set
419# CONFIG_B44 is not set
420# CONFIG_FORCEDETH is not set
421# CONFIG_CS89x0 is not set
422# CONFIG_DGRS is not set
423# CONFIG_EEPRO100 is not set
424CONFIG_E100=y
425# CONFIG_E100_NAPI is not set
426# CONFIG_FEALNX is not set
427# CONFIG_NATSEMI is not set
428# CONFIG_NE2K_PCI is not set
429# CONFIG_8139CP is not set
430# CONFIG_8139TOO is not set
431# CONFIG_SIS900 is not set
432# CONFIG_EPIC100 is not set
433# CONFIG_SUNDANCE is not set
434# CONFIG_TLAN is not set
435# CONFIG_VIA_RHINE is not set
436# CONFIG_NET_POCKET is not set
437
438#
439# Ethernet (1000 Mbit)
440#
441# CONFIG_ACENIC is not set
442# CONFIG_DL2K is not set
443CONFIG_E1000=y
444# CONFIG_E1000_NAPI is not set
445# CONFIG_NS83820 is not set
446# CONFIG_HAMACHI is not set
447# CONFIG_YELLOWFIN is not set
448# CONFIG_R8169 is not set
449# CONFIG_SK98LIN is not set
450# CONFIG_TIGON3 is not set
451
452#
453# Ethernet (10000 Mbit)
454#
455# CONFIG_IXGB is not set
456# CONFIG_S2IO is not set
457
458#
459# Token Ring devices
460#
461# CONFIG_TR is not set
462
463#
464# Wireless LAN (non-hamradio)
465#
466# CONFIG_NET_RADIO is not set
467
468#
469# Wan interfaces
470#
471# CONFIG_WAN is not set
472# CONFIG_FDDI is not set
473# CONFIG_HIPPI is not set
474# CONFIG_PLIP is not set
475# CONFIG_PPP is not set
476# CONFIG_SLIP is not set
477# CONFIG_NET_FC is not set
478# CONFIG_RCPCI is not set
479# CONFIG_SHAPER is not set
480# CONFIG_NETCONSOLE is not set
481
482#
483# ISDN subsystem
484#
485# CONFIG_ISDN is not set
486
487#
488# Telephony Support
489#
490# CONFIG_PHONE is not set
491
492#
493# Input device support
494#
495CONFIG_INPUT=y
496
497#
498# Userland interfaces
499#
500CONFIG_INPUT_MOUSEDEV=y
501CONFIG_INPUT_MOUSEDEV_PSAUX=y
502CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
503CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
504# CONFIG_INPUT_JOYDEV is not set
505# CONFIG_INPUT_TSDEV is not set
506CONFIG_INPUT_EVDEV=y
507# CONFIG_INPUT_EVBUG is not set
508
509#
510# Input I/O drivers
511#
512CONFIG_GAMEPORT=m
513CONFIG_SOUND_GAMEPORT=m
514# CONFIG_GAMEPORT_NS558 is not set
515# CONFIG_GAMEPORT_L4 is not set
516# CONFIG_GAMEPORT_EMU10K1 is not set
517# CONFIG_GAMEPORT_VORTEX is not set
518# CONFIG_GAMEPORT_FM801 is not set
519# CONFIG_GAMEPORT_CS461x is not set
520CONFIG_SERIO=y
521CONFIG_SERIO_I8042=y
522CONFIG_SERIO_SERPORT=y
523# CONFIG_SERIO_CT82C710 is not set
524# CONFIG_SERIO_PARKBD is not set
525# CONFIG_SERIO_PCIPS2 is not set
526
527#
528# Input Device Drivers
529#
530CONFIG_INPUT_KEYBOARD=y
531CONFIG_KEYBOARD_ATKBD=y
532# CONFIG_KEYBOARD_SUNKBD is not set
533# CONFIG_KEYBOARD_LKKBD is not set
534# CONFIG_KEYBOARD_XTKBD is not set
535# CONFIG_KEYBOARD_NEWTON is not set
536CONFIG_INPUT_MOUSE=y
537CONFIG_MOUSE_PS2=y
538# CONFIG_MOUSE_SERIAL is not set
539# CONFIG_MOUSE_INPORT is not set
540# CONFIG_MOUSE_LOGIBM is not set
541# CONFIG_MOUSE_PC110PAD is not set
542# CONFIG_MOUSE_VSXXXAA is not set
543# CONFIG_INPUT_JOYSTICK is not set
544# CONFIG_INPUT_TOUCHSCREEN is not set
545CONFIG_INPUT_MISC=y
546CONFIG_INPUT_UINPUT=y
547
548#
549# Character devices
550#
551CONFIG_VT=y
552CONFIG_VT_CONSOLE=y
553CONFIG_HW_CONSOLE=y
554# CONFIG_SERIAL_NONSTANDARD is not set
555
556#
557# Serial drivers
558#
559CONFIG_SERIAL_8250=y
560CONFIG_SERIAL_8250_CONSOLE=y
561CONFIG_SERIAL_8250_NR_UARTS=4
562# CONFIG_SERIAL_8250_EXTENDED is not set
563
564#
565# Non-8250 serial port support
566#
567CONFIG_SERIAL_CORE=y
568CONFIG_SERIAL_CORE_CONSOLE=y
569# CONFIG_SERIAL_PMACZILOG is not set
570CONFIG_UNIX98_PTYS=y
571CONFIG_LEGACY_PTYS=y
572CONFIG_LEGACY_PTY_COUNT=256
573CONFIG_PRINTER=m
574# CONFIG_LP_CONSOLE is not set
575# CONFIG_PPDEV is not set
576# CONFIG_TIPAR is not set
577# CONFIG_QIC02_TAPE is not set
578
579#
580# IPMI
581#
582# CONFIG_IPMI_HANDLER is not set
583
584#
585# Watchdog Cards
586#
587# CONFIG_WATCHDOG is not set
588CONFIG_NVRAM=y
589CONFIG_GEN_RTC=y
590# CONFIG_GEN_RTC_X is not set
591# CONFIG_DTLK is not set
592# CONFIG_R3964 is not set
593# CONFIG_APPLICOM is not set
594
595#
596# Ftape, the floppy tape device driver
597#
598# CONFIG_AGP is not set
599# CONFIG_DRM is not set
600# CONFIG_RAW_DRIVER is not set
601
602#
603# I2C support
604#
605CONFIG_I2C=y
606CONFIG_I2C_CHARDEV=y
607
608#
609# I2C Algorithms
610#
611CONFIG_I2C_ALGOBIT=y
612CONFIG_I2C_ALGOPCF=y
613
614#
615# I2C Hardware Bus support
616#
617# CONFIG_I2C_ALI1535 is not set
618# CONFIG_I2C_ALI1563 is not set
619# CONFIG_I2C_ALI15X3 is not set
620# CONFIG_I2C_AMD756 is not set
621# CONFIG_I2C_AMD8111 is not set
622# CONFIG_I2C_HYDRA is not set
623# CONFIG_I2C_I801 is not set
624# CONFIG_I2C_I810 is not set
625# CONFIG_I2C_ISA is not set
626# CONFIG_I2C_KEYWEST is not set
627# CONFIG_I2C_NFORCE2 is not set
628# CONFIG_I2C_PARPORT is not set
629# CONFIG_I2C_PARPORT_LIGHT is not set
630# CONFIG_I2C_PIIX4 is not set
631# CONFIG_I2C_PROSAVAGE is not set
632# CONFIG_I2C_SAVAGE4 is not set
633# CONFIG_SCx200_ACB is not set
634# CONFIG_I2C_SIS5595 is not set
635# CONFIG_I2C_SIS630 is not set
636# CONFIG_I2C_SIS96X is not set
637# CONFIG_I2C_VIA is not set
638# CONFIG_I2C_VIAPRO is not set
639# CONFIG_I2C_VOODOO3 is not set
640
641#
642# Hardware Sensors Chip support
643#
644# CONFIG_I2C_SENSOR is not set
645# CONFIG_SENSORS_ADM1021 is not set
646# CONFIG_SENSORS_ASB100 is not set
647# CONFIG_SENSORS_DS1621 is not set
648# CONFIG_SENSORS_FSCHER is not set
649# CONFIG_SENSORS_GL518SM is not set
650# CONFIG_SENSORS_IT87 is not set
651# CONFIG_SENSORS_LM75 is not set
652# CONFIG_SENSORS_LM78 is not set
653# CONFIG_SENSORS_LM80 is not set
654# CONFIG_SENSORS_LM83 is not set
655# CONFIG_SENSORS_LM85 is not set
656# CONFIG_SENSORS_LM90 is not set
657# CONFIG_SENSORS_VIA686A is not set
658# CONFIG_SENSORS_W83781D is not set
659# CONFIG_SENSORS_W83L785TS is not set
660# CONFIG_SENSORS_W83627HF is not set
661
662#
663# Other I2C Chip support
664#
665# CONFIG_SENSORS_EEPROM is not set
666# CONFIG_SENSORS_PCF8574 is not set
667# CONFIG_SENSORS_PCF8591 is not set
668# CONFIG_I2C_DEBUG_CORE is not set
669# CONFIG_I2C_DEBUG_ALGO is not set
670# CONFIG_I2C_DEBUG_BUS is not set
671# CONFIG_I2C_DEBUG_CHIP is not set
672
673#
674# Misc devices
675#
676
677#
678# Multimedia devices
679#
680# CONFIG_VIDEO_DEV is not set
681
682#
683# Digital Video Broadcasting Devices
684#
685# CONFIG_DVB is not set
686
687#
688# Graphics support
689#
690CONFIG_FB=y
691# CONFIG_FB_PM2 is not set
692# CONFIG_FB_CYBER2000 is not set
693CONFIG_FB_OF=y
694# CONFIG_FB_CONTROL is not set
695# CONFIG_FB_PLATINUM is not set
696# CONFIG_FB_VALKYRIE is not set
697# CONFIG_FB_CT65550 is not set
698# CONFIG_FB_IMSTT is not set
699# CONFIG_FB_S3TRIO is not set
700# CONFIG_FB_VGA16 is not set
701# CONFIG_FB_RIVA is not set
702CONFIG_FB_MATROX=y
703CONFIG_FB_MATROX_MILLENIUM=y
704CONFIG_FB_MATROX_MYSTIQUE=y
705# CONFIG_FB_MATROX_G450 is not set
706CONFIG_FB_MATROX_G100A=y
707CONFIG_FB_MATROX_G100=y
708CONFIG_FB_MATROX_I2C=y
709# CONFIG_FB_MATROX_MAVEN is not set
710CONFIG_FB_MATROX_MULTIHEAD=y
711# CONFIG_FB_RADEON_OLD is not set
712# CONFIG_FB_RADEON is not set
713# CONFIG_FB_ATY128 is not set
714# CONFIG_FB_ATY is not set
715# CONFIG_FB_SIS is not set
716# CONFIG_FB_NEOMAGIC is not set
717# CONFIG_FB_KYRO is not set
718# CONFIG_FB_3DFX is not set
719# CONFIG_FB_VOODOO1 is not set
720# CONFIG_FB_TRIDENT is not set
721# CONFIG_FB_VIRTUAL is not set
722
723#
724# Console display driver support
725#
726# CONFIG_VGA_CONSOLE is not set
727# CONFIG_MDA_CONSOLE is not set
728CONFIG_DUMMY_CONSOLE=y
729CONFIG_FRAMEBUFFER_CONSOLE=y
730CONFIG_PCI_CONSOLE=y
731# CONFIG_FONTS is not set
732CONFIG_FONT_8x8=y
733CONFIG_FONT_8x16=y
734
735#
736# Logo configuration
737#
738CONFIG_LOGO=y
739CONFIG_LOGO_LINUX_MONO=y
740CONFIG_LOGO_LINUX_VGA16=y
741CONFIG_LOGO_LINUX_CLUT224=y
742
743#
744# Sound
745#
746CONFIG_SOUND=y
747# CONFIG_DMASOUND_PMAC is not set
748
749#
750# Advanced Linux Sound Architecture
751#
752CONFIG_SND=m
753CONFIG_SND_TIMER=m
754CONFIG_SND_PCM=m
755CONFIG_SND_HWDEP=m
756CONFIG_SND_RAWMIDI=m
757CONFIG_SND_SEQUENCER=m
758CONFIG_SND_SEQ_DUMMY=m
759CONFIG_SND_OSSEMUL=y
760CONFIG_SND_MIXER_OSS=m
761CONFIG_SND_PCM_OSS=m
762CONFIG_SND_SEQUENCER_OSS=y
763# CONFIG_SND_VERBOSE_PRINTK is not set
764# CONFIG_SND_DEBUG is not set
765
766#
767# Generic devices
768#
769CONFIG_SND_MPU401_UART=m
770CONFIG_SND_OPL3_LIB=m
771CONFIG_SND_DUMMY=m
772# CONFIG_SND_VIRMIDI is not set
773# CONFIG_SND_MTPAV is not set
774# CONFIG_SND_SERIAL_U16550 is not set
775# CONFIG_SND_MPU401 is not set
776
777#
778# ISA devices
779#
780# CONFIG_SND_AD1848 is not set
781# CONFIG_SND_CS4231 is not set
782CONFIG_SND_CS4232=m
783# CONFIG_SND_CS4236 is not set
784# CONFIG_SND_ES1688 is not set
785# CONFIG_SND_ES18XX is not set
786# CONFIG_SND_GUSCLASSIC is not set
787# CONFIG_SND_GUSEXTREME is not set
788# CONFIG_SND_GUSMAX is not set
789# CONFIG_SND_INTERWAVE is not set
790# CONFIG_SND_INTERWAVE_STB is not set
791# CONFIG_SND_OPTI92X_AD1848 is not set
792# CONFIG_SND_OPTI92X_CS4231 is not set
793# CONFIG_SND_OPTI93X is not set
794# CONFIG_SND_SB8 is not set
795# CONFIG_SND_SB16 is not set
796# CONFIG_SND_SBAWE is not set
797# CONFIG_SND_WAVEFRONT is not set
798# CONFIG_SND_CMI8330 is not set
799# CONFIG_SND_OPL3SA2 is not set
800# CONFIG_SND_SGALAXY is not set
801# CONFIG_SND_SSCAPE is not set
802
803#
804# PCI devices
805#
806CONFIG_SND_AC97_CODEC=m
807# CONFIG_SND_ALI5451 is not set
808# CONFIG_SND_ATIIXP is not set
809# CONFIG_SND_AU8810 is not set
810# CONFIG_SND_AU8820 is not set
811# CONFIG_SND_AU8830 is not set
812# CONFIG_SND_AZT3328 is not set
813# CONFIG_SND_BT87X is not set
814CONFIG_SND_CS46XX=m
815# CONFIG_SND_CS46XX_NEW_DSP is not set
816CONFIG_SND_CS4281=m
817# CONFIG_SND_EMU10K1 is not set
818# CONFIG_SND_KORG1212 is not set
819# CONFIG_SND_MIXART is not set
820# CONFIG_SND_NM256 is not set
821# CONFIG_SND_RME32 is not set
822# CONFIG_SND_RME96 is not set
823# CONFIG_SND_RME9652 is not set
824# CONFIG_SND_HDSP is not set
825# CONFIG_SND_TRIDENT is not set
826# CONFIG_SND_YMFPCI is not set
827# CONFIG_SND_ALS4000 is not set
828# CONFIG_SND_CMIPCI is not set
829# CONFIG_SND_ENS1370 is not set
830# CONFIG_SND_ENS1371 is not set
831# CONFIG_SND_ES1938 is not set
832# CONFIG_SND_ES1968 is not set
833# CONFIG_SND_MAESTRO3 is not set
834# CONFIG_SND_FM801 is not set
835# CONFIG_SND_ICE1712 is not set
836# CONFIG_SND_ICE1724 is not set
837# CONFIG_SND_INTEL8X0 is not set
838# CONFIG_SND_INTEL8X0M is not set
839# CONFIG_SND_SONICVIBES is not set
840# CONFIG_SND_VIA82XX is not set
841# CONFIG_SND_VX222 is not set
842
843#
844# ALSA PowerMac devices
845#
846# CONFIG_SND_POWERMAC is not set
847
848#
849# Open Sound System
850#
851# CONFIG_SOUND_PRIME is not set
852
853#
854# USB support
855#
856# CONFIG_USB is not set
857
858#
859# USB Gadget Support
860#
861# CONFIG_USB_GADGET is not set
862
863#
864# File systems
865#
866CONFIG_EXT2_FS=y
867# CONFIG_EXT2_FS_XATTR is not set
868# CONFIG_EXT3_FS is not set
869# CONFIG_JBD is not set
870# CONFIG_REISERFS_FS is not set
871# CONFIG_JFS_FS is not set
872# CONFIG_XFS_FS is not set
873# CONFIG_MINIX_FS is not set
874# CONFIG_ROMFS_FS is not set
875# CONFIG_QUOTA is not set
876# CONFIG_AUTOFS_FS is not set
877# CONFIG_AUTOFS4_FS is not set
878
879#
880# CD-ROM/DVD Filesystems
881#
882CONFIG_ISO9660_FS=y
883CONFIG_JOLIET=y
884# CONFIG_ZISOFS is not set
885# CONFIG_UDF_FS is not set
886
887#
888# DOS/FAT/NT Filesystems
889#
890CONFIG_FAT_FS=y
891CONFIG_MSDOS_FS=y
892CONFIG_VFAT_FS=y
893# CONFIG_NTFS_FS is not set
894
895#
896# Pseudo filesystems
897#
898CONFIG_PROC_FS=y
899CONFIG_PROC_KCORE=y
900CONFIG_SYSFS=y
901# CONFIG_DEVFS_FS is not set
902# CONFIG_DEVPTS_FS_XATTR is not set
903CONFIG_TMPFS=y
904# CONFIG_HUGETLB_PAGE is not set
905CONFIG_RAMFS=y
906
907#
908# Miscellaneous filesystems
909#
910# CONFIG_ADFS_FS is not set
911# CONFIG_AFFS_FS is not set
912# CONFIG_HFS_FS is not set
913# CONFIG_HFSPLUS_FS is not set
914# CONFIG_BEFS_FS is not set
915# CONFIG_BFS_FS is not set
916# CONFIG_EFS_FS is not set
917# CONFIG_CRAMFS is not set
918# CONFIG_VXFS_FS is not set
919# CONFIG_HPFS_FS is not set
920# CONFIG_QNX4FS_FS is not set
921# CONFIG_SYSV_FS is not set
922# CONFIG_UFS_FS is not set
923
924#
925# Network File Systems
926#
927CONFIG_NFS_FS=y
928# CONFIG_NFS_V3 is not set
929# CONFIG_NFS_V4 is not set
930# CONFIG_NFS_DIRECTIO is not set
931CONFIG_NFSD=y
932# CONFIG_NFSD_V3 is not set
933# CONFIG_NFSD_TCP is not set
934CONFIG_LOCKD=y
935CONFIG_EXPORTFS=y
936CONFIG_SUNRPC=y
937# CONFIG_RPCSEC_GSS_KRB5 is not set
938# CONFIG_SMB_FS is not set
939# CONFIG_CIFS is not set
940# CONFIG_NCP_FS is not set
941# CONFIG_CODA_FS is not set
942# CONFIG_AFS_FS is not set
943
944#
945# Partition Types
946#
947# CONFIG_PARTITION_ADVANCED is not set
948CONFIG_MSDOS_PARTITION=y
949
950#
951# Native Language Support
952#
953CONFIG_NLS=y
954CONFIG_NLS_DEFAULT="iso8859-1"
955CONFIG_NLS_CODEPAGE_437=y
956# CONFIG_NLS_CODEPAGE_737 is not set
957# CONFIG_NLS_CODEPAGE_775 is not set
958# CONFIG_NLS_CODEPAGE_850 is not set
959# CONFIG_NLS_CODEPAGE_852 is not set
960# CONFIG_NLS_CODEPAGE_855 is not set
961# CONFIG_NLS_CODEPAGE_857 is not set
962# CONFIG_NLS_CODEPAGE_860 is not set
963# CONFIG_NLS_CODEPAGE_861 is not set
964# CONFIG_NLS_CODEPAGE_862 is not set
965# CONFIG_NLS_CODEPAGE_863 is not set
966# CONFIG_NLS_CODEPAGE_864 is not set
967# CONFIG_NLS_CODEPAGE_865 is not set
968# CONFIG_NLS_CODEPAGE_866 is not set
969# CONFIG_NLS_CODEPAGE_869 is not set
970# CONFIG_NLS_CODEPAGE_936 is not set
971# CONFIG_NLS_CODEPAGE_950 is not set
972# CONFIG_NLS_CODEPAGE_932 is not set
973# CONFIG_NLS_CODEPAGE_949 is not set
974# CONFIG_NLS_CODEPAGE_874 is not set
975# CONFIG_NLS_ISO8859_8 is not set
976# CONFIG_NLS_CODEPAGE_1250 is not set
977# CONFIG_NLS_CODEPAGE_1251 is not set
978CONFIG_NLS_ISO8859_1=y
979# CONFIG_NLS_ISO8859_2 is not set
980# CONFIG_NLS_ISO8859_3 is not set
981# CONFIG_NLS_ISO8859_4 is not set
982# CONFIG_NLS_ISO8859_5 is not set
983# CONFIG_NLS_ISO8859_6 is not set
984# CONFIG_NLS_ISO8859_7 is not set
985# CONFIG_NLS_ISO8859_9 is not set
986# CONFIG_NLS_ISO8859_13 is not set
987# CONFIG_NLS_ISO8859_14 is not set
988# CONFIG_NLS_ISO8859_15 is not set
989# CONFIG_NLS_KOI8_R is not set
990# CONFIG_NLS_KOI8_U is not set
991# CONFIG_NLS_UTF8 is not set
992
993#
994# Library routines
995#
996CONFIG_CRC32=y
997# CONFIG_LIBCRC32C is not set
998CONFIG_ZLIB_INFLATE=m
999CONFIG_ZLIB_DEFLATE=m
1000
1001#
1002# Kernel hacking
1003#
1004# CONFIG_DEBUG_KERNEL is not set
1005CONFIG_BOOTX_TEXT=y
1006
1007#
1008# Security options
1009#
1010# CONFIG_SECURITY is not set
1011
1012#
1013# Cryptographic options
1014#
1015CONFIG_CRYPTO=y
1016CONFIG_CRYPTO_HMAC=y
1017CONFIG_CRYPTO_NULL=y
1018CONFIG_CRYPTO_MD4=m
1019CONFIG_CRYPTO_MD5=m
1020CONFIG_CRYPTO_SHA1=m
1021CONFIG_CRYPTO_SHA256=m
1022CONFIG_CRYPTO_SHA512=m
1023CONFIG_CRYPTO_DES=m
1024CONFIG_CRYPTO_BLOWFISH=m
1025CONFIG_CRYPTO_TWOFISH=m
1026# CONFIG_CRYPTO_SERPENT is not set
1027CONFIG_CRYPTO_AES=m
1028CONFIG_CRYPTO_CAST5=m
1029CONFIG_CRYPTO_CAST6=m
1030CONFIG_CRYPTO_ARC4=m
1031CONFIG_CRYPTO_DEFLATE=m
1032CONFIG_CRYPTO_MICHAEL_MIC=m
1033# CONFIG_CRYPTO_CRC32C is not set
1034# CONFIG_CRYPTO_TEST is not set
diff --git a/arch/ppc/configs/pplus_defconfig b/arch/ppc/configs/pplus_defconfig
new file mode 100644
index 000000000000..5e459bcbf591
--- /dev/null
+++ b/arch/ppc/configs/pplus_defconfig
@@ -0,0 +1,720 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7CONFIG_PPC=y
8CONFIG_PPC32=y
9CONFIG_GENERIC_NVRAM=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_STANDALONE=y
17CONFIG_BROKEN_ON_SMP=y
18
19#
20# General setup
21#
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26CONFIG_LOG_BUF_SHIFT=14
27# CONFIG_HOTPLUG is not set
28# CONFIG_IKCONFIG is not set
29CONFIG_EMBEDDED=y
30CONFIG_KALLSYMS=y
31CONFIG_FUTEX=y
32CONFIG_EPOLL=y
33CONFIG_IOSCHED_NOOP=y
34CONFIG_IOSCHED_AS=y
35CONFIG_IOSCHED_DEADLINE=y
36# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
37
38#
39# Loadable module support
40#
41CONFIG_MODULES=y
42CONFIG_MODULE_UNLOAD=y
43# CONFIG_MODULE_FORCE_UNLOAD is not set
44CONFIG_OBSOLETE_MODPARM=y
45# CONFIG_MODVERSIONS is not set
46CONFIG_KMOD=y
47
48#
49# Processor
50#
51CONFIG_6xx=y
52# CONFIG_40x is not set
53# CONFIG_44x is not set
54# CONFIG_POWER3 is not set
55# CONFIG_POWER4 is not set
56# CONFIG_8xx is not set
57# CONFIG_ALTIVEC is not set
58# CONFIG_TAU is not set
59# CONFIG_CPU_FREQ is not set
60CONFIG_PPC_STD_MMU=y
61
62#
63# Platform options
64#
65# CONFIG_PPC_MULTIPLATFORM is not set
66# CONFIG_APUS is not set
67# CONFIG_WILLOW is not set
68# CONFIG_PCORE is not set
69# CONFIG_POWERPMC250 is not set
70# CONFIG_EV64260 is not set
71# CONFIG_SPRUCE is not set
72# CONFIG_LOPEC is not set
73# CONFIG_MCPN765 is not set
74# CONFIG_MVME5100 is not set
75CONFIG_PPLUS=y
76# CONFIG_PRPMC750 is not set
77# CONFIG_PRPMC800 is not set
78# CONFIG_SANDPOINT is not set
79# CONFIG_ADIR is not set
80# CONFIG_K2 is not set
81# CONFIG_PAL4 is not set
82# CONFIG_GEMINI is not set
83# CONFIG_EST8260 is not set
84# CONFIG_SBS8260 is not set
85# CONFIG_RPX6 is not set
86# CONFIG_TQM8260 is not set
87CONFIG_PPC_GEN550=y
88# CONFIG_PPCBUG_NVRAM is not set
89# CONFIG_SMP is not set
90# CONFIG_PREEMPT is not set
91# CONFIG_HIGHMEM is not set
92CONFIG_KERNEL_ELF=y
93CONFIG_BINFMT_ELF=y
94# CONFIG_BINFMT_MISC is not set
95CONFIG_CMDLINE_BOOL=y
96CONFIG_CMDLINE="ip=on"
97
98#
99# Bus options
100#
101CONFIG_GENERIC_ISA_DMA=y
102CONFIG_PCI=y
103CONFIG_PCI_DOMAINS=y
104# CONFIG_PCI_LEGACY_PROC is not set
105# CONFIG_PCI_NAMES is not set
106
107#
108# Advanced setup
109#
110# CONFIG_ADVANCED_OPTIONS is not set
111
112#
113# Default settings for advanced configuration options are used
114#
115CONFIG_HIGHMEM_START=0xfe000000
116CONFIG_LOWMEM_SIZE=0x30000000
117CONFIG_KERNEL_START=0xc0000000
118CONFIG_TASK_SIZE=0x80000000
119CONFIG_BOOT_LOAD=0x00800000
120
121#
122# Device Drivers
123#
124
125#
126# Generic Driver Options
127#
128
129#
130# Memory Technology Devices (MTD)
131#
132# CONFIG_MTD is not set
133
134#
135# Parallel port support
136#
137# CONFIG_PARPORT is not set
138
139#
140# Plug and Play support
141#
142
143#
144# Block devices
145#
146CONFIG_BLK_DEV_FD=y
147# CONFIG_BLK_CPQ_DA is not set
148# CONFIG_BLK_CPQ_CISS_DA is not set
149# CONFIG_BLK_DEV_DAC960 is not set
150# CONFIG_BLK_DEV_UMEM is not set
151# CONFIG_BLK_DEV_LOOP is not set
152# CONFIG_BLK_DEV_NBD is not set
153# CONFIG_BLK_DEV_RAM is not set
154# CONFIG_BLK_DEV_INITRD is not set
155# CONFIG_LBD is not set
156
157#
158# ATA/ATAPI/MFM/RLL support
159#
160CONFIG_IDE=y
161CONFIG_BLK_DEV_IDE=y
162
163#
164# Please see Documentation/ide.txt for help/info on IDE drives
165#
166CONFIG_BLK_DEV_IDEDISK=y
167# CONFIG_IDEDISK_MULTI_MODE is not set
168# CONFIG_IDEDISK_STROKE is not set
169CONFIG_BLK_DEV_IDECD=y
170# CONFIG_BLK_DEV_IDETAPE is not set
171CONFIG_BLK_DEV_IDEFLOPPY=y
172CONFIG_BLK_DEV_IDESCSI=y
173# CONFIG_IDE_TASK_IOCTL is not set
174# CONFIG_IDE_TASKFILE_IO is not set
175
176#
177# IDE chipset support/bugfixes
178#
179CONFIG_IDE_GENERIC=y
180# CONFIG_BLK_DEV_IDEPCI is not set
181# CONFIG_BLK_DEV_IDEDMA is not set
182# CONFIG_IDEDMA_AUTO is not set
183# CONFIG_BLK_DEV_HD is not set
184
185#
186# SCSI device support
187#
188CONFIG_SCSI=y
189CONFIG_SCSI_PROC_FS=y
190
191#
192# SCSI support type (disk, tape, CD-ROM)
193#
194CONFIG_BLK_DEV_SD=y
195CONFIG_CHR_DEV_ST=y
196# CONFIG_CHR_DEV_OSST is not set
197CONFIG_BLK_DEV_SR=y
198CONFIG_BLK_DEV_SR_VENDOR=y
199CONFIG_CHR_DEV_SG=y
200
201#
202# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
203#
204# CONFIG_SCSI_MULTI_LUN is not set
205# CONFIG_SCSI_REPORT_LUNS is not set
206CONFIG_SCSI_CONSTANTS=y
207# CONFIG_SCSI_LOGGING is not set
208
209#
210# SCSI low-level drivers
211#
212# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
213# CONFIG_SCSI_ACARD is not set
214# CONFIG_SCSI_AACRAID is not set
215# CONFIG_SCSI_AIC7XXX is not set
216# CONFIG_SCSI_AIC7XXX_OLD is not set
217# CONFIG_SCSI_AIC79XX is not set
218# CONFIG_SCSI_ADVANSYS is not set
219# CONFIG_SCSI_MEGARAID is not set
220# CONFIG_SCSI_SATA is not set
221# CONFIG_SCSI_BUSLOGIC is not set
222# CONFIG_SCSI_CPQFCTS is not set
223# CONFIG_SCSI_DMX3191D is not set
224# CONFIG_SCSI_EATA is not set
225# CONFIG_SCSI_EATA_PIO is not set
226# CONFIG_SCSI_FUTURE_DOMAIN is not set
227# CONFIG_SCSI_GDTH is not set
228# CONFIG_SCSI_IPS is not set
229# CONFIG_SCSI_INIA100 is not set
230# CONFIG_SCSI_SYM53C8XX_2 is not set
231# CONFIG_SCSI_QLOGIC_ISP is not set
232# CONFIG_SCSI_QLOGIC_FC is not set
233# CONFIG_SCSI_QLOGIC_1280 is not set
234CONFIG_SCSI_QLA2XXX=y
235# CONFIG_SCSI_QLA21XX is not set
236# CONFIG_SCSI_QLA22XX is not set
237# CONFIG_SCSI_QLA2300 is not set
238# CONFIG_SCSI_QLA2322 is not set
239# CONFIG_SCSI_QLA6312 is not set
240# CONFIG_SCSI_QLA6322 is not set
241# CONFIG_SCSI_DC395x is not set
242# CONFIG_SCSI_DC390T is not set
243# CONFIG_SCSI_NSP32 is not set
244# CONFIG_SCSI_DEBUG is not set
245
246#
247# Multi-device support (RAID and LVM)
248#
249# CONFIG_MD is not set
250
251#
252# Fusion MPT device support
253#
254# CONFIG_FUSION is not set
255
256#
257# IEEE 1394 (FireWire) support
258#
259# CONFIG_IEEE1394 is not set
260
261#
262# I2O device support
263#
264# CONFIG_I2O is not set
265
266#
267# Macintosh device drivers
268#
269
270#
271# Networking support
272#
273CONFIG_NET=y
274
275#
276# Networking options
277#
278CONFIG_PACKET=y
279# CONFIG_PACKET_MMAP is not set
280# CONFIG_NETLINK_DEV is not set
281CONFIG_UNIX=y
282# CONFIG_NET_KEY is not set
283CONFIG_INET=y
284CONFIG_IP_MULTICAST=y
285# CONFIG_IP_ADVANCED_ROUTER is not set
286CONFIG_IP_PNP=y
287CONFIG_IP_PNP_DHCP=y
288# CONFIG_IP_PNP_BOOTP is not set
289# CONFIG_IP_PNP_RARP is not set
290# CONFIG_NET_IPIP is not set
291# CONFIG_NET_IPGRE is not set
292# CONFIG_IP_MROUTE is not set
293# CONFIG_ARPD is not set
294# CONFIG_INET_ECN is not set
295CONFIG_SYN_COOKIES=y
296# CONFIG_INET_AH is not set
297# CONFIG_INET_ESP is not set
298# CONFIG_INET_IPCOMP is not set
299
300#
301# IP: Virtual Server Configuration
302#
303# CONFIG_IP_VS is not set
304# CONFIG_IPV6 is not set
305# CONFIG_DECNET is not set
306# CONFIG_BRIDGE is not set
307CONFIG_NETFILTER=y
308# CONFIG_NETFILTER_DEBUG is not set
309
310#
311# IP: Netfilter Configuration
312#
313CONFIG_IP_NF_CONNTRACK=m
314CONFIG_IP_NF_FTP=m
315# CONFIG_IP_NF_IRC is not set
316# CONFIG_IP_NF_TFTP is not set
317# CONFIG_IP_NF_AMANDA is not set
318# CONFIG_IP_NF_QUEUE is not set
319CONFIG_IP_NF_IPTABLES=m
320CONFIG_IP_NF_MATCH_LIMIT=m
321# CONFIG_IP_NF_MATCH_IPRANGE is not set
322CONFIG_IP_NF_MATCH_MAC=m
323CONFIG_IP_NF_MATCH_PKTTYPE=m
324CONFIG_IP_NF_MATCH_MARK=m
325CONFIG_IP_NF_MATCH_MULTIPORT=m
326CONFIG_IP_NF_MATCH_TOS=m
327# CONFIG_IP_NF_MATCH_RECENT is not set
328CONFIG_IP_NF_MATCH_ECN=m
329CONFIG_IP_NF_MATCH_DSCP=m
330CONFIG_IP_NF_MATCH_AH_ESP=m
331# CONFIG_IP_NF_MATCH_LENGTH is not set
332# CONFIG_IP_NF_MATCH_TTL is not set
333# CONFIG_IP_NF_MATCH_TCPMSS is not set
334CONFIG_IP_NF_MATCH_HELPER=m
335CONFIG_IP_NF_MATCH_STATE=m
336CONFIG_IP_NF_MATCH_CONNTRACK=m
337CONFIG_IP_NF_MATCH_OWNER=m
338CONFIG_IP_NF_FILTER=m
339CONFIG_IP_NF_TARGET_REJECT=m
340CONFIG_IP_NF_NAT=m
341CONFIG_IP_NF_NAT_NEEDED=y
342CONFIG_IP_NF_TARGET_MASQUERADE=m
343CONFIG_IP_NF_TARGET_REDIRECT=m
344# CONFIG_IP_NF_TARGET_NETMAP is not set
345# CONFIG_IP_NF_TARGET_SAME is not set
346# CONFIG_IP_NF_NAT_SNMP_BASIC is not set
347CONFIG_IP_NF_NAT_FTP=m
348# CONFIG_IP_NF_MANGLE is not set
349# CONFIG_IP_NF_TARGET_LOG is not set
350CONFIG_IP_NF_TARGET_ULOG=m
351# CONFIG_IP_NF_TARGET_TCPMSS is not set
352CONFIG_IP_NF_ARPTABLES=m
353CONFIG_IP_NF_ARPFILTER=m
354# CONFIG_IP_NF_ARP_MANGLE is not set
355CONFIG_IP_NF_COMPAT_IPCHAINS=m
356# CONFIG_IP_NF_COMPAT_IPFWADM is not set
357
358#
359# SCTP Configuration (EXPERIMENTAL)
360#
361CONFIG_IPV6_SCTP__=y
362# CONFIG_IP_SCTP is not set
363# CONFIG_ATM is not set
364# CONFIG_VLAN_8021Q is not set
365# CONFIG_LLC2 is not set
366# CONFIG_IPX is not set
367# CONFIG_ATALK is not set
368# CONFIG_X25 is not set
369# CONFIG_LAPB is not set
370# CONFIG_NET_DIVERT is not set
371# CONFIG_ECONET is not set
372# CONFIG_WAN_ROUTER is not set
373# CONFIG_NET_HW_FLOWCONTROL is not set
374
375#
376# QoS and/or fair queueing
377#
378# CONFIG_NET_SCHED is not set
379
380#
381# Network testing
382#
383# CONFIG_NET_PKTGEN is not set
384CONFIG_NETDEVICES=y
385
386#
387# ARCnet devices
388#
389# CONFIG_ARCNET is not set
390# CONFIG_DUMMY is not set
391# CONFIG_BONDING is not set
392# CONFIG_EQUALIZER is not set
393# CONFIG_TUN is not set
394
395#
396# Ethernet (10 or 100Mbit)
397#
398CONFIG_NET_ETHERNET=y
399CONFIG_MII=y
400CONFIG_CRC32=y
401# CONFIG_OAKNET is not set
402# CONFIG_HAPPYMEAL is not set
403# CONFIG_SUNGEM is not set
404# CONFIG_NET_VENDOR_3COM is not set
405
406#
407# Tulip family network device support
408#
409CONFIG_NET_TULIP=y
410# CONFIG_DE2104X is not set
411CONFIG_TULIP=y
412# CONFIG_TULIP_MWI is not set
413# CONFIG_TULIP_MMIO is not set
414# CONFIG_TULIP_NAPI is not set
415# CONFIG_DE4X5 is not set
416# CONFIG_WINBOND_840 is not set
417# CONFIG_DM9102 is not set
418# CONFIG_HP100 is not set
419CONFIG_NET_PCI=y
420# CONFIG_PCNET32 is not set
421# CONFIG_AMD8111_ETH is not set
422# CONFIG_ADAPTEC_STARFIRE is not set
423# CONFIG_B44 is not set
424# CONFIG_FORCEDETH is not set
425# CONFIG_DGRS is not set
426CONFIG_EEPRO100=y
427# CONFIG_EEPRO100_PIO is not set
428# CONFIG_E100 is not set
429# CONFIG_FEALNX is not set
430# CONFIG_NATSEMI is not set
431# CONFIG_NE2K_PCI is not set
432# CONFIG_8139CP is not set
433# CONFIG_8139TOO is not set
434# CONFIG_SIS900 is not set
435# CONFIG_EPIC100 is not set
436# CONFIG_SUNDANCE is not set
437# CONFIG_TLAN is not set
438# CONFIG_VIA_RHINE is not set
439
440#
441# Ethernet (1000 Mbit)
442#
443# CONFIG_ACENIC is not set
444# CONFIG_DL2K is not set
445# CONFIG_E1000 is not set
446# CONFIG_NS83820 is not set
447# CONFIG_HAMACHI is not set
448# CONFIG_YELLOWFIN is not set
449# CONFIG_R8169 is not set
450# CONFIG_SIS190 is not set
451# CONFIG_SK98LIN is not set
452# CONFIG_TIGON3 is not set
453
454#
455# Ethernet (10000 Mbit)
456#
457# CONFIG_IXGB is not set
458# CONFIG_FDDI is not set
459# CONFIG_HIPPI is not set
460# CONFIG_PPP is not set
461# CONFIG_SLIP is not set
462
463#
464# Wireless LAN (non-hamradio)
465#
466# CONFIG_NET_RADIO is not set
467
468#
469# Token Ring devices
470#
471# CONFIG_TR is not set
472# CONFIG_NET_FC is not set
473# CONFIG_RCPCI is not set
474# CONFIG_SHAPER is not set
475
476#
477# Wan interfaces
478#
479# CONFIG_WAN is not set
480
481#
482# Amateur Radio support
483#
484# CONFIG_HAMRADIO is not set
485
486#
487# IrDA (infrared) support
488#
489# CONFIG_IRDA is not set
490
491#
492# Bluetooth support
493#
494# CONFIG_BT is not set
495
496#
497# ISDN subsystem
498#
499# CONFIG_ISDN is not set
500
501#
502# Telephony Support
503#
504# CONFIG_PHONE is not set
505
506#
507# Input device support
508#
509# CONFIG_INPUT is not set
510
511#
512# Userland interfaces
513#
514
515#
516# Input I/O drivers
517#
518# CONFIG_GAMEPORT is not set
519CONFIG_SOUND_GAMEPORT=y
520# CONFIG_SERIO is not set
521# CONFIG_SERIO_I8042 is not set
522
523#
524# Input Device Drivers
525#
526
527#
528# Character devices
529#
530# CONFIG_VT is not set
531# CONFIG_SERIAL_NONSTANDARD is not set
532
533#
534# Serial drivers
535#
536CONFIG_SERIAL_8250=y
537CONFIG_SERIAL_8250_CONSOLE=y
538CONFIG_SERIAL_8250_NR_UARTS=4
539# CONFIG_SERIAL_8250_EXTENDED is not set
540
541#
542# Non-8250 serial port support
543#
544CONFIG_SERIAL_CORE=y
545CONFIG_SERIAL_CORE_CONSOLE=y
546CONFIG_UNIX98_PTYS=y
547CONFIG_LEGACY_PTYS=y
548CONFIG_LEGACY_PTY_COUNT=256
549
550#
551# Mice
552#
553# CONFIG_BUSMOUSE is not set
554# CONFIG_QIC02_TAPE is not set
555
556#
557# IPMI
558#
559# CONFIG_IPMI_HANDLER is not set
560
561#
562# Watchdog Cards
563#
564# CONFIG_WATCHDOG is not set
565# CONFIG_NVRAM is not set
566CONFIG_GEN_RTC=y
567# CONFIG_GEN_RTC_X is not set
568# CONFIG_DTLK is not set
569# CONFIG_R3964 is not set
570# CONFIG_APPLICOM is not set
571
572#
573# Ftape, the floppy tape device driver
574#
575# CONFIG_FTAPE is not set
576# CONFIG_AGP is not set
577# CONFIG_DRM is not set
578# CONFIG_RAW_DRIVER is not set
579
580#
581# I2C support
582#
583# CONFIG_I2C is not set
584
585#
586# Multimedia devices
587#
588# CONFIG_VIDEO_DEV is not set
589
590#
591# Digital Video Broadcasting Devices
592#
593# CONFIG_DVB is not set
594
595#
596# Graphics support
597#
598# CONFIG_FB is not set
599
600#
601# Sound
602#
603# CONFIG_SOUND is not set
604
605#
606# USB support
607#
608# CONFIG_USB is not set
609
610#
611# USB Gadget Support
612#
613# CONFIG_USB_GADGET is not set
614
615#
616# File systems
617#
618CONFIG_EXT2_FS=y
619# CONFIG_EXT2_FS_XATTR is not set
620# CONFIG_EXT3_FS is not set
621# CONFIG_JBD is not set
622# CONFIG_REISERFS_FS is not set
623# CONFIG_JFS_FS is not set
624# CONFIG_XFS_FS is not set
625# CONFIG_MINIX_FS is not set
626# CONFIG_ROMFS_FS is not set
627# CONFIG_QUOTA is not set
628# CONFIG_AUTOFS_FS is not set
629# CONFIG_AUTOFS4_FS is not set
630
631#
632# CD-ROM/DVD Filesystems
633#
634CONFIG_ISO9660_FS=y
635# CONFIG_JOLIET is not set
636# CONFIG_ZISOFS is not set
637# CONFIG_UDF_FS is not set
638
639#
640# DOS/FAT/NT Filesystems
641#
642# CONFIG_FAT_FS is not set
643# CONFIG_NTFS_FS is not set
644
645#
646# Pseudo filesystems
647#
648CONFIG_PROC_FS=y
649CONFIG_PROC_KCORE=y
650# CONFIG_DEVFS_FS is not set
651# CONFIG_DEVPTS_FS_XATTR is not set
652# CONFIG_TMPFS is not set
653# CONFIG_HUGETLB_PAGE is not set
654CONFIG_RAMFS=y
655
656#
657# Miscellaneous filesystems
658#
659# CONFIG_ADFS_FS is not set
660# CONFIG_AFFS_FS is not set
661# CONFIG_HFS_FS is not set
662# CONFIG_BEFS_FS is not set
663# CONFIG_BFS_FS is not set
664# CONFIG_EFS_FS is not set
665# CONFIG_CRAMFS is not set
666# CONFIG_VXFS_FS is not set
667# CONFIG_HPFS_FS is not set
668# CONFIG_QNX4FS_FS is not set
669# CONFIG_SYSV_FS is not set
670# CONFIG_UFS_FS is not set
671
672#
673# Network File Systems
674#
675CONFIG_NFS_FS=y
676# CONFIG_NFS_V3 is not set
677# CONFIG_NFS_V4 is not set
678# CONFIG_NFS_DIRECTIO is not set
679# CONFIG_NFSD is not set
680CONFIG_ROOT_NFS=y
681CONFIG_LOCKD=y
682# CONFIG_EXPORTFS is not set
683CONFIG_SUNRPC=y
684# CONFIG_SUNRPC_GSS is not set
685# CONFIG_SMB_FS is not set
686# CONFIG_CIFS is not set
687# CONFIG_NCP_FS is not set
688# CONFIG_CODA_FS is not set
689# CONFIG_AFS_FS is not set
690
691#
692# Partition Types
693#
694# CONFIG_PARTITION_ADVANCED is not set
695CONFIG_MSDOS_PARTITION=y
696
697#
698# Native Language Support
699#
700# CONFIG_NLS is not set
701
702#
703# Library routines
704#
705
706#
707# Kernel hacking
708#
709# CONFIG_DEBUG_KERNEL is not set
710# CONFIG_SERIAL_TEXT_DEBUG is not set
711
712#
713# Security options
714#
715# CONFIG_SECURITY is not set
716
717#
718# Cryptographic options
719#
720# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/prpmc750_defconfig b/arch/ppc/configs/prpmc750_defconfig
new file mode 100644
index 000000000000..82d52f66b742
--- /dev/null
+++ b/arch/ppc/configs/prpmc750_defconfig
@@ -0,0 +1,594 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7CONFIG_PPC=y
8CONFIG_PPC32=y
9CONFIG_GENERIC_NVRAM=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_STANDALONE=y
17CONFIG_BROKEN_ON_SMP=y
18
19#
20# General setup
21#
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_POSIX_MQUEUE is not set
25# CONFIG_BSD_PROCESS_ACCT is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=14
29# CONFIG_HOTPLUG is not set
30# CONFIG_IKCONFIG is not set
31CONFIG_EMBEDDED=y
32# CONFIG_KALLSYMS is not set
33CONFIG_FUTEX=y
34# CONFIG_EPOLL is not set
35CONFIG_IOSCHED_NOOP=y
36CONFIG_IOSCHED_AS=y
37CONFIG_IOSCHED_DEADLINE=y
38CONFIG_IOSCHED_CFQ=y
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
40
41#
42# Loadable module support
43#
44CONFIG_MODULES=y
45CONFIG_MODULE_UNLOAD=y
46# CONFIG_MODULE_FORCE_UNLOAD is not set
47CONFIG_OBSOLETE_MODPARM=y
48# CONFIG_MODVERSIONS is not set
49CONFIG_KMOD=y
50
51#
52# Processor
53#
54CONFIG_6xx=y
55# CONFIG_40x is not set
56# CONFIG_44x is not set
57# CONFIG_POWER3 is not set
58# CONFIG_POWER4 is not set
59# CONFIG_8xx is not set
60# CONFIG_ALTIVEC is not set
61# CONFIG_TAU is not set
62# CONFIG_CPU_FREQ is not set
63CONFIG_PPC_STD_MMU=y
64
65#
66# Platform options
67#
68# CONFIG_PPC_MULTIPLATFORM is not set
69# CONFIG_APUS is not set
70# CONFIG_WILLOW is not set
71# CONFIG_PCORE is not set
72# CONFIG_POWERPMC250 is not set
73# CONFIG_EV64260 is not set
74# CONFIG_SPRUCE is not set
75# CONFIG_LOPEC is not set
76# CONFIG_MCPN765 is not set
77# CONFIG_MVME5100 is not set
78# CONFIG_PPLUS is not set
79CONFIG_PRPMC750=y
80# CONFIG_PRPMC800 is not set
81# CONFIG_SANDPOINT is not set
82# CONFIG_ADIR is not set
83# CONFIG_K2 is not set
84# CONFIG_PAL4 is not set
85# CONFIG_GEMINI is not set
86# CONFIG_EST8260 is not set
87# CONFIG_SBS8260 is not set
88# CONFIG_RPX6 is not set
89# CONFIG_TQM8260 is not set
90CONFIG_PPC_GEN550=y
91# CONFIG_SMP is not set
92# CONFIG_PREEMPT is not set
93# CONFIG_HIGHMEM is not set
94CONFIG_KERNEL_ELF=y
95CONFIG_BINFMT_ELF=y
96# CONFIG_BINFMT_MISC is not set
97CONFIG_CMDLINE_BOOL=y
98CONFIG_CMDLINE="ip=on"
99
100#
101# Bus options
102#
103CONFIG_GENERIC_ISA_DMA=y
104CONFIG_PCI=y
105CONFIG_PCI_DOMAINS=y
106# CONFIG_PCI_LEGACY_PROC is not set
107# CONFIG_PCI_NAMES is not set
108
109#
110# Advanced setup
111#
112# CONFIG_ADVANCED_OPTIONS is not set
113
114#
115# Default settings for advanced configuration options are used
116#
117CONFIG_HIGHMEM_START=0xfe000000
118CONFIG_LOWMEM_SIZE=0x30000000
119CONFIG_KERNEL_START=0xc0000000
120CONFIG_TASK_SIZE=0x80000000
121CONFIG_BOOT_LOAD=0x00800000
122
123#
124# Device Drivers
125#
126
127#
128# Generic Driver Options
129#
130
131#
132# Memory Technology Devices (MTD)
133#
134# CONFIG_MTD is not set
135
136#
137# Parallel port support
138#
139# CONFIG_PARPORT is not set
140
141#
142# Plug and Play support
143#
144
145#
146# Block devices
147#
148# CONFIG_BLK_DEV_FD is not set
149# CONFIG_BLK_CPQ_DA is not set
150# CONFIG_BLK_CPQ_CISS_DA is not set
151# CONFIG_BLK_DEV_DAC960 is not set
152# CONFIG_BLK_DEV_UMEM is not set
153# CONFIG_BLK_DEV_LOOP is not set
154# CONFIG_BLK_DEV_NBD is not set
155# CONFIG_BLK_DEV_CARMEL is not set
156CONFIG_BLK_DEV_RAM=y
157CONFIG_BLK_DEV_RAM_SIZE=4096
158CONFIG_BLK_DEV_INITRD=y
159# CONFIG_LBD is not set
160
161#
162# ATA/ATAPI/MFM/RLL support
163#
164# CONFIG_IDE is not set
165
166#
167# SCSI device support
168#
169# CONFIG_SCSI is not set
170
171#
172# Multi-device support (RAID and LVM)
173#
174# CONFIG_MD is not set
175
176#
177# Fusion MPT device support
178#
179# CONFIG_FUSION is not set
180
181#
182# IEEE 1394 (FireWire) support
183#
184# CONFIG_IEEE1394 is not set
185
186#
187# I2O device support
188#
189# CONFIG_I2O is not set
190
191#
192# Macintosh device drivers
193#
194
195#
196# Networking support
197#
198CONFIG_NET=y
199
200#
201# Networking options
202#
203CONFIG_PACKET=y
204# CONFIG_PACKET_MMAP is not set
205# CONFIG_NETLINK_DEV is not set
206CONFIG_UNIX=y
207# CONFIG_NET_KEY is not set
208CONFIG_INET=y
209CONFIG_IP_MULTICAST=y
210# CONFIG_IP_ADVANCED_ROUTER is not set
211CONFIG_IP_PNP=y
212CONFIG_IP_PNP_DHCP=y
213# CONFIG_IP_PNP_BOOTP is not set
214# CONFIG_IP_PNP_RARP is not set
215# CONFIG_NET_IPIP is not set
216# CONFIG_NET_IPGRE is not set
217# CONFIG_IP_MROUTE is not set
218# CONFIG_ARPD is not set
219# CONFIG_SYN_COOKIES is not set
220# CONFIG_INET_AH is not set
221# CONFIG_INET_ESP is not set
222# CONFIG_INET_IPCOMP is not set
223# CONFIG_IPV6 is not set
224# CONFIG_NETFILTER is not set
225
226#
227# SCTP Configuration (EXPERIMENTAL)
228#
229# CONFIG_IP_SCTP is not set
230# CONFIG_ATM is not set
231# CONFIG_BRIDGE is not set
232# CONFIG_VLAN_8021Q is not set
233# CONFIG_DECNET is not set
234# CONFIG_LLC2 is not set
235# CONFIG_IPX is not set
236# CONFIG_ATALK is not set
237# CONFIG_X25 is not set
238# CONFIG_LAPB is not set
239# CONFIG_NET_DIVERT is not set
240# CONFIG_ECONET is not set
241# CONFIG_WAN_ROUTER is not set
242# CONFIG_NET_HW_FLOWCONTROL is not set
243
244#
245# QoS and/or fair queueing
246#
247# CONFIG_NET_SCHED is not set
248
249#
250# Network testing
251#
252# CONFIG_NET_PKTGEN is not set
253# CONFIG_NETPOLL is not set
254# CONFIG_NET_POLL_CONTROLLER is not set
255# CONFIG_HAMRADIO is not set
256# CONFIG_IRDA is not set
257# CONFIG_BT is not set
258CONFIG_NETDEVICES=y
259# CONFIG_DUMMY is not set
260# CONFIG_BONDING is not set
261# CONFIG_EQUALIZER is not set
262# CONFIG_TUN is not set
263
264#
265# ARCnet devices
266#
267# CONFIG_ARCNET is not set
268
269#
270# Ethernet (10 or 100Mbit)
271#
272CONFIG_NET_ETHERNET=y
273CONFIG_MII=y
274# CONFIG_OAKNET is not set
275# CONFIG_HAPPYMEAL is not set
276# CONFIG_SUNGEM is not set
277# CONFIG_NET_VENDOR_3COM is not set
278
279#
280# Tulip family network device support
281#
282CONFIG_NET_TULIP=y
283# CONFIG_DE2104X is not set
284CONFIG_TULIP=y
285# CONFIG_TULIP_MWI is not set
286CONFIG_TULIP_MMIO=y
287# CONFIG_TULIP_NAPI is not set
288# CONFIG_DE4X5 is not set
289# CONFIG_WINBOND_840 is not set
290# CONFIG_DM9102 is not set
291# CONFIG_HP100 is not set
292CONFIG_NET_PCI=y
293# CONFIG_PCNET32 is not set
294# CONFIG_AMD8111_ETH is not set
295# CONFIG_ADAPTEC_STARFIRE is not set
296# CONFIG_B44 is not set
297# CONFIG_FORCEDETH is not set
298# CONFIG_DGRS is not set
299CONFIG_EEPRO100=y
300# CONFIG_EEPRO100_PIO is not set
301# CONFIG_E100 is not set
302# CONFIG_FEALNX is not set
303# CONFIG_NATSEMI is not set
304# CONFIG_NE2K_PCI is not set
305# CONFIG_8139CP is not set
306# CONFIG_8139TOO is not set
307# CONFIG_SIS900 is not set
308# CONFIG_EPIC100 is not set
309# CONFIG_SUNDANCE is not set
310# CONFIG_TLAN is not set
311# CONFIG_VIA_RHINE is not set
312
313#
314# Ethernet (1000 Mbit)
315#
316# CONFIG_ACENIC is not set
317# CONFIG_DL2K is not set
318# CONFIG_E1000 is not set
319# CONFIG_NS83820 is not set
320# CONFIG_HAMACHI is not set
321# CONFIG_YELLOWFIN is not set
322# CONFIG_R8169 is not set
323# CONFIG_SK98LIN is not set
324# CONFIG_TIGON3 is not set
325
326#
327# Ethernet (10000 Mbit)
328#
329# CONFIG_IXGB is not set
330# CONFIG_S2IO is not set
331
332#
333# Token Ring devices
334#
335# CONFIG_TR is not set
336
337#
338# Wireless LAN (non-hamradio)
339#
340# CONFIG_NET_RADIO is not set
341
342#
343# Wan interfaces
344#
345# CONFIG_WAN is not set
346# CONFIG_FDDI is not set
347# CONFIG_HIPPI is not set
348# CONFIG_PPP is not set
349# CONFIG_SLIP is not set
350# CONFIG_RCPCI is not set
351# CONFIG_SHAPER is not set
352# CONFIG_NETCONSOLE is not set
353
354#
355# ISDN subsystem
356#
357# CONFIG_ISDN is not set
358
359#
360# Telephony Support
361#
362# CONFIG_PHONE is not set
363
364#
365# Input device support
366#
367CONFIG_INPUT=y
368
369#
370# Userland interfaces
371#
372# CONFIG_INPUT_MOUSEDEV is not set
373# CONFIG_INPUT_JOYDEV is not set
374# CONFIG_INPUT_TSDEV is not set
375# CONFIG_INPUT_EVDEV is not set
376# CONFIG_INPUT_EVBUG is not set
377
378#
379# Input I/O drivers
380#
381# CONFIG_GAMEPORT is not set
382CONFIG_SOUND_GAMEPORT=y
383# CONFIG_SERIO is not set
384# CONFIG_SERIO_I8042 is not set
385
386#
387# Input Device Drivers
388#
389# CONFIG_INPUT_KEYBOARD is not set
390# CONFIG_INPUT_MOUSE is not set
391# CONFIG_INPUT_JOYSTICK is not set
392# CONFIG_INPUT_TOUCHSCREEN is not set
393# CONFIG_INPUT_MISC is not set
394
395#
396# Character devices
397#
398# CONFIG_VT is not set
399# CONFIG_SERIAL_NONSTANDARD is not set
400
401#
402# Serial drivers
403#
404CONFIG_SERIAL_8250=y
405CONFIG_SERIAL_8250_CONSOLE=y
406CONFIG_SERIAL_8250_NR_UARTS=4
407# CONFIG_SERIAL_8250_EXTENDED is not set
408
409#
410# Non-8250 serial port support
411#
412CONFIG_SERIAL_CORE=y
413CONFIG_SERIAL_CORE_CONSOLE=y
414CONFIG_UNIX98_PTYS=y
415CONFIG_LEGACY_PTYS=y
416CONFIG_LEGACY_PTY_COUNT=256
417# CONFIG_QIC02_TAPE is not set
418
419#
420# IPMI
421#
422# CONFIG_IPMI_HANDLER is not set
423
424#
425# Watchdog Cards
426#
427# CONFIG_WATCHDOG is not set
428# CONFIG_NVRAM is not set
429CONFIG_GEN_RTC=y
430# CONFIG_GEN_RTC_X is not set
431# CONFIG_DTLK is not set
432# CONFIG_R3964 is not set
433# CONFIG_APPLICOM is not set
434
435#
436# Ftape, the floppy tape device driver
437#
438# CONFIG_FTAPE is not set
439# CONFIG_AGP is not set
440# CONFIG_DRM is not set
441# CONFIG_RAW_DRIVER is not set
442
443#
444# I2C support
445#
446# CONFIG_I2C is not set
447
448#
449# Misc devices
450#
451
452#
453# Multimedia devices
454#
455# CONFIG_VIDEO_DEV is not set
456
457#
458# Digital Video Broadcasting Devices
459#
460# CONFIG_DVB is not set
461
462#
463# Graphics support
464#
465# CONFIG_FB is not set
466
467#
468# Sound
469#
470# CONFIG_SOUND is not set
471
472#
473# USB support
474#
475# CONFIG_USB is not set
476
477#
478# USB Gadget Support
479#
480# CONFIG_USB_GADGET is not set
481
482#
483# File systems
484#
485CONFIG_EXT2_FS=y
486# CONFIG_EXT2_FS_XATTR is not set
487CONFIG_EXT3_FS=y
488CONFIG_EXT3_FS_XATTR=y
489# CONFIG_EXT3_FS_POSIX_ACL is not set
490# CONFIG_EXT3_FS_SECURITY is not set
491CONFIG_JBD=y
492# CONFIG_JBD_DEBUG is not set
493CONFIG_FS_MBCACHE=y
494# CONFIG_REISERFS_FS is not set
495# CONFIG_JFS_FS is not set
496# CONFIG_XFS_FS is not set
497# CONFIG_MINIX_FS is not set
498# CONFIG_ROMFS_FS is not set
499# CONFIG_QUOTA is not set
500# CONFIG_AUTOFS_FS is not set
501# CONFIG_AUTOFS4_FS is not set
502
503#
504# CD-ROM/DVD Filesystems
505#
506# CONFIG_ISO9660_FS is not set
507# CONFIG_UDF_FS is not set
508
509#
510# DOS/FAT/NT Filesystems
511#
512# CONFIG_FAT_FS is not set
513# CONFIG_NTFS_FS is not set
514
515#
516# Pseudo filesystems
517#
518CONFIG_PROC_FS=y
519CONFIG_PROC_KCORE=y
520CONFIG_SYSFS=y
521# CONFIG_DEVFS_FS is not set
522# CONFIG_DEVPTS_FS_XATTR is not set
523CONFIG_TMPFS=y
524# CONFIG_HUGETLB_PAGE is not set
525CONFIG_RAMFS=y
526
527#
528# Miscellaneous filesystems
529#
530# CONFIG_ADFS_FS is not set
531# CONFIG_AFFS_FS is not set
532# CONFIG_HFS_FS is not set
533# CONFIG_HFSPLUS_FS is not set
534# CONFIG_BEFS_FS is not set
535# CONFIG_BFS_FS is not set
536# CONFIG_EFS_FS is not set
537# CONFIG_CRAMFS is not set
538# CONFIG_VXFS_FS is not set
539# CONFIG_HPFS_FS is not set
540# CONFIG_QNX4FS_FS is not set
541# CONFIG_SYSV_FS is not set
542# CONFIG_UFS_FS is not set
543
544#
545# Network File Systems
546#
547CONFIG_NFS_FS=y
548# CONFIG_NFS_V3 is not set
549# CONFIG_NFS_V4 is not set
550# CONFIG_NFS_DIRECTIO is not set
551# CONFIG_NFSD is not set
552CONFIG_ROOT_NFS=y
553CONFIG_LOCKD=y
554# CONFIG_EXPORTFS is not set
555CONFIG_SUNRPC=y
556# CONFIG_RPCSEC_GSS_KRB5 is not set
557# CONFIG_SMB_FS is not set
558# CONFIG_CIFS is not set
559# CONFIG_NCP_FS is not set
560# CONFIG_CODA_FS is not set
561# CONFIG_INTERMEZZO_FS is not set
562# CONFIG_AFS_FS is not set
563
564#
565# Partition Types
566#
567# CONFIG_PARTITION_ADVANCED is not set
568CONFIG_MSDOS_PARTITION=y
569
570#
571# Native Language Support
572#
573# CONFIG_NLS is not set
574
575#
576# Library routines
577#
578CONFIG_CRC32=y
579
580#
581# Kernel hacking
582#
583# CONFIG_DEBUG_KERNEL is not set
584# CONFIG_SERIAL_TEXT_DEBUG is not set
585
586#
587# Security options
588#
589# CONFIG_SECURITY is not set
590
591#
592# Cryptographic options
593#
594# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/prpmc800_defconfig b/arch/ppc/configs/prpmc800_defconfig
new file mode 100644
index 000000000000..613c2664d3e8
--- /dev/null
+++ b/arch/ppc/configs/prpmc800_defconfig
@@ -0,0 +1,656 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7CONFIG_PPC=y
8CONFIG_PPC32=y
9CONFIG_GENERIC_NVRAM=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_STANDALONE=y
17CONFIG_BROKEN_ON_SMP=y
18
19#
20# General setup
21#
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_POSIX_MQUEUE is not set
25# CONFIG_BSD_PROCESS_ACCT is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=14
29# CONFIG_HOTPLUG is not set
30# CONFIG_IKCONFIG is not set
31CONFIG_EMBEDDED=y
32# CONFIG_KALLSYMS is not set
33CONFIG_FUTEX=y
34# CONFIG_EPOLL is not set
35CONFIG_IOSCHED_NOOP=y
36CONFIG_IOSCHED_AS=y
37CONFIG_IOSCHED_DEADLINE=y
38CONFIG_IOSCHED_CFQ=y
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
40
41#
42# Loadable module support
43#
44CONFIG_MODULES=y
45CONFIG_MODULE_UNLOAD=y
46# CONFIG_MODULE_FORCE_UNLOAD is not set
47CONFIG_OBSOLETE_MODPARM=y
48# CONFIG_MODVERSIONS is not set
49CONFIG_KMOD=y
50
51#
52# Processor
53#
54CONFIG_6xx=y
55# CONFIG_40x is not set
56# CONFIG_44x is not set
57# CONFIG_POWER3 is not set
58# CONFIG_POWER4 is not set
59# CONFIG_8xx is not set
60CONFIG_ALTIVEC=y
61# CONFIG_TAU is not set
62# CONFIG_CPU_FREQ is not set
63CONFIG_PPC_STD_MMU=y
64
65#
66# Platform options
67#
68# CONFIG_PPC_MULTIPLATFORM is not set
69# CONFIG_APUS is not set
70# CONFIG_WILLOW is not set
71# CONFIG_PCORE is not set
72# CONFIG_POWERPMC250 is not set
73# CONFIG_EV64260 is not set
74# CONFIG_SPRUCE is not set
75# CONFIG_LOPEC is not set
76# CONFIG_MCPN765 is not set
77# CONFIG_MVME5100 is not set
78# CONFIG_PPLUS is not set
79# CONFIG_PRPMC750 is not set
80CONFIG_PRPMC800=y
81# CONFIG_SANDPOINT is not set
82# CONFIG_ADIR is not set
83# CONFIG_K2 is not set
84# CONFIG_PAL4 is not set
85# CONFIG_GEMINI is not set
86# CONFIG_EST8260 is not set
87# CONFIG_SBS8260 is not set
88# CONFIG_RPX6 is not set
89# CONFIG_TQM8260 is not set
90CONFIG_PPC_GEN550=y
91# CONFIG_NONMONARCH_SUPPORT is not set
92CONFIG_HARRIER=y
93# CONFIG_HARRIER_STORE_GATHERING is not set
94# CONFIG_SMP is not set
95# CONFIG_PREEMPT is not set
96# CONFIG_HIGHMEM is not set
97CONFIG_KERNEL_ELF=y
98CONFIG_BINFMT_ELF=y
99# CONFIG_BINFMT_MISC is not set
100CONFIG_CMDLINE_BOOL=y
101CONFIG_CMDLINE="ip=on"
102
103#
104# Bus options
105#
106CONFIG_GENERIC_ISA_DMA=y
107CONFIG_PCI=y
108CONFIG_PCI_DOMAINS=y
109# CONFIG_PCI_LEGACY_PROC is not set
110# CONFIG_PCI_NAMES is not set
111
112#
113# Advanced setup
114#
115# CONFIG_ADVANCED_OPTIONS is not set
116
117#
118# Default settings for advanced configuration options are used
119#
120CONFIG_HIGHMEM_START=0xfe000000
121CONFIG_LOWMEM_SIZE=0x30000000
122CONFIG_KERNEL_START=0xc0000000
123CONFIG_TASK_SIZE=0x80000000
124CONFIG_BOOT_LOAD=0x00800000
125
126#
127# Device Drivers
128#
129
130#
131# Generic Driver Options
132#
133
134#
135# Memory Technology Devices (MTD)
136#
137# CONFIG_MTD is not set
138
139#
140# Parallel port support
141#
142# CONFIG_PARPORT is not set
143
144#
145# Plug and Play support
146#
147
148#
149# Block devices
150#
151# CONFIG_BLK_DEV_FD is not set
152# CONFIG_BLK_CPQ_DA is not set
153# CONFIG_BLK_CPQ_CISS_DA is not set
154# CONFIG_BLK_DEV_DAC960 is not set
155# CONFIG_BLK_DEV_UMEM is not set
156# CONFIG_BLK_DEV_LOOP is not set
157# CONFIG_BLK_DEV_NBD is not set
158# CONFIG_BLK_DEV_CARMEL is not set
159CONFIG_BLK_DEV_RAM=y
160CONFIG_BLK_DEV_RAM_SIZE=4096
161CONFIG_BLK_DEV_INITRD=y
162# CONFIG_LBD is not set
163
164#
165# ATA/ATAPI/MFM/RLL support
166#
167# CONFIG_IDE is not set
168
169#
170# SCSI device support
171#
172CONFIG_SCSI=y
173CONFIG_SCSI_PROC_FS=y
174
175#
176# SCSI support type (disk, tape, CD-ROM)
177#
178CONFIG_BLK_DEV_SD=y
179CONFIG_CHR_DEV_ST=y
180# CONFIG_CHR_DEV_OSST is not set
181CONFIG_BLK_DEV_SR=y
182# CONFIG_BLK_DEV_SR_VENDOR is not set
183# CONFIG_CHR_DEV_SG is not set
184
185#
186# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
187#
188# CONFIG_SCSI_MULTI_LUN is not set
189# CONFIG_SCSI_REPORT_LUNS is not set
190# CONFIG_SCSI_CONSTANTS is not set
191# CONFIG_SCSI_LOGGING is not set
192
193#
194# SCSI Transport Attributes
195#
196CONFIG_SCSI_SPI_ATTRS=y
197# CONFIG_SCSI_FC_ATTRS is not set
198
199#
200# SCSI low-level drivers
201#
202# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
203# CONFIG_SCSI_ACARD is not set
204# CONFIG_SCSI_AACRAID is not set
205# CONFIG_SCSI_AIC7XXX is not set
206# CONFIG_SCSI_AIC7XXX_OLD is not set
207# CONFIG_SCSI_AIC79XX is not set
208# CONFIG_SCSI_ADVANSYS is not set
209# CONFIG_SCSI_MEGARAID is not set
210# CONFIG_SCSI_SATA is not set
211# CONFIG_SCSI_BUSLOGIC is not set
212# CONFIG_SCSI_CPQFCTS is not set
213# CONFIG_SCSI_DMX3191D is not set
214# CONFIG_SCSI_EATA is not set
215# CONFIG_SCSI_EATA_PIO is not set
216# CONFIG_SCSI_FUTURE_DOMAIN is not set
217# CONFIG_SCSI_GDTH is not set
218# CONFIG_SCSI_IPS is not set
219# CONFIG_SCSI_INIA100 is not set
220CONFIG_SCSI_SYM53C8XX_2=y
221CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1
222CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
223CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
224# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set
225# CONFIG_SCSI_QLOGIC_ISP is not set
226# CONFIG_SCSI_QLOGIC_FC is not set
227# CONFIG_SCSI_QLOGIC_1280 is not set
228CONFIG_SCSI_QLA2XXX=y
229# CONFIG_SCSI_QLA21XX is not set
230# CONFIG_SCSI_QLA22XX is not set
231# CONFIG_SCSI_QLA2300 is not set
232# CONFIG_SCSI_QLA2322 is not set
233# CONFIG_SCSI_QLA6312 is not set
234# CONFIG_SCSI_QLA6322 is not set
235# CONFIG_SCSI_DC395x is not set
236# CONFIG_SCSI_DC390T is not set
237# CONFIG_SCSI_NSP32 is not set
238# CONFIG_SCSI_DEBUG is not set
239
240#
241# Multi-device support (RAID and LVM)
242#
243# CONFIG_MD is not set
244
245#
246# Fusion MPT device support
247#
248# CONFIG_FUSION is not set
249
250#
251# IEEE 1394 (FireWire) support
252#
253# CONFIG_IEEE1394 is not set
254
255#
256# I2O device support
257#
258# CONFIG_I2O is not set
259
260#
261# Macintosh device drivers
262#
263
264#
265# Networking support
266#
267CONFIG_NET=y
268
269#
270# Networking options
271#
272CONFIG_PACKET=y
273# CONFIG_PACKET_MMAP is not set
274# CONFIG_NETLINK_DEV is not set
275CONFIG_UNIX=y
276# CONFIG_NET_KEY is not set
277CONFIG_INET=y
278CONFIG_IP_MULTICAST=y
279# CONFIG_IP_ADVANCED_ROUTER is not set
280CONFIG_IP_PNP=y
281CONFIG_IP_PNP_DHCP=y
282# CONFIG_IP_PNP_BOOTP is not set
283# CONFIG_IP_PNP_RARP is not set
284# CONFIG_NET_IPIP is not set
285# CONFIG_NET_IPGRE is not set
286# CONFIG_IP_MROUTE is not set
287# CONFIG_ARPD is not set
288# CONFIG_SYN_COOKIES is not set
289# CONFIG_INET_AH is not set
290# CONFIG_INET_ESP is not set
291# CONFIG_INET_IPCOMP is not set
292# CONFIG_IPV6 is not set
293# CONFIG_NETFILTER is not set
294
295#
296# SCTP Configuration (EXPERIMENTAL)
297#
298# CONFIG_IP_SCTP is not set
299# CONFIG_ATM is not set
300# CONFIG_BRIDGE is not set
301# CONFIG_VLAN_8021Q is not set
302# CONFIG_DECNET is not set
303# CONFIG_LLC2 is not set
304# CONFIG_IPX is not set
305# CONFIG_ATALK is not set
306# CONFIG_X25 is not set
307# CONFIG_LAPB is not set
308# CONFIG_NET_DIVERT is not set
309# CONFIG_ECONET is not set
310# CONFIG_WAN_ROUTER is not set
311# CONFIG_NET_HW_FLOWCONTROL is not set
312
313#
314# QoS and/or fair queueing
315#
316# CONFIG_NET_SCHED is not set
317
318#
319# Network testing
320#
321# CONFIG_NET_PKTGEN is not set
322# CONFIG_NETPOLL is not set
323# CONFIG_NET_POLL_CONTROLLER is not set
324# CONFIG_HAMRADIO is not set
325# CONFIG_IRDA is not set
326# CONFIG_BT is not set
327CONFIG_NETDEVICES=y
328# CONFIG_DUMMY is not set
329# CONFIG_BONDING is not set
330# CONFIG_EQUALIZER is not set
331# CONFIG_TUN is not set
332
333#
334# ARCnet devices
335#
336# CONFIG_ARCNET is not set
337
338#
339# Ethernet (10 or 100Mbit)
340#
341CONFIG_NET_ETHERNET=y
342CONFIG_MII=y
343# CONFIG_OAKNET is not set
344# CONFIG_HAPPYMEAL is not set
345# CONFIG_SUNGEM is not set
346# CONFIG_NET_VENDOR_3COM is not set
347
348#
349# Tulip family network device support
350#
351# CONFIG_NET_TULIP is not set
352# CONFIG_HP100 is not set
353CONFIG_NET_PCI=y
354# CONFIG_PCNET32 is not set
355# CONFIG_AMD8111_ETH is not set
356# CONFIG_ADAPTEC_STARFIRE is not set
357# CONFIG_B44 is not set
358# CONFIG_FORCEDETH is not set
359# CONFIG_DGRS is not set
360CONFIG_EEPRO100=y
361# CONFIG_EEPRO100_PIO is not set
362# CONFIG_E100 is not set
363# CONFIG_FEALNX is not set
364# CONFIG_NATSEMI is not set
365# CONFIG_NE2K_PCI is not set
366# CONFIG_8139CP is not set
367# CONFIG_8139TOO is not set
368# CONFIG_SIS900 is not set
369# CONFIG_EPIC100 is not set
370# CONFIG_SUNDANCE is not set
371# CONFIG_TLAN is not set
372# CONFIG_VIA_RHINE is not set
373
374#
375# Ethernet (1000 Mbit)
376#
377# CONFIG_ACENIC is not set
378# CONFIG_DL2K is not set
379# CONFIG_E1000 is not set
380# CONFIG_NS83820 is not set
381# CONFIG_HAMACHI is not set
382# CONFIG_YELLOWFIN is not set
383# CONFIG_R8169 is not set
384# CONFIG_SK98LIN is not set
385# CONFIG_TIGON3 is not set
386
387#
388# Ethernet (10000 Mbit)
389#
390# CONFIG_IXGB is not set
391# CONFIG_S2IO is not set
392
393#
394# Token Ring devices
395#
396# CONFIG_TR is not set
397
398#
399# Wireless LAN (non-hamradio)
400#
401# CONFIG_NET_RADIO is not set
402
403#
404# Wan interfaces
405#
406# CONFIG_WAN is not set
407# CONFIG_FDDI is not set
408# CONFIG_HIPPI is not set
409# CONFIG_PPP is not set
410# CONFIG_SLIP is not set
411# CONFIG_NET_FC is not set
412# CONFIG_RCPCI is not set
413# CONFIG_SHAPER is not set
414# CONFIG_NETCONSOLE is not set
415
416#
417# ISDN subsystem
418#
419# CONFIG_ISDN is not set
420
421#
422# Telephony Support
423#
424# CONFIG_PHONE is not set
425
426#
427# Input device support
428#
429CONFIG_INPUT=y
430
431#
432# Userland interfaces
433#
434# CONFIG_INPUT_MOUSEDEV is not set
435# CONFIG_INPUT_JOYDEV is not set
436# CONFIG_INPUT_TSDEV is not set
437# CONFIG_INPUT_EVDEV is not set
438# CONFIG_INPUT_EVBUG is not set
439
440#
441# Input I/O drivers
442#
443# CONFIG_GAMEPORT is not set
444CONFIG_SOUND_GAMEPORT=y
445# CONFIG_SERIO is not set
446# CONFIG_SERIO_I8042 is not set
447
448#
449# Input Device Drivers
450#
451# CONFIG_INPUT_KEYBOARD is not set
452# CONFIG_INPUT_MOUSE is not set
453# CONFIG_INPUT_JOYSTICK is not set
454# CONFIG_INPUT_TOUCHSCREEN is not set
455# CONFIG_INPUT_MISC is not set
456
457#
458# Character devices
459#
460# CONFIG_VT is not set
461# CONFIG_SERIAL_NONSTANDARD is not set
462
463#
464# Serial drivers
465#
466CONFIG_SERIAL_8250=y
467CONFIG_SERIAL_8250_CONSOLE=y
468CONFIG_SERIAL_8250_NR_UARTS=4
469# CONFIG_SERIAL_8250_EXTENDED is not set
470
471#
472# Non-8250 serial port support
473#
474CONFIG_SERIAL_CORE=y
475CONFIG_SERIAL_CORE_CONSOLE=y
476CONFIG_UNIX98_PTYS=y
477CONFIG_LEGACY_PTYS=y
478CONFIG_LEGACY_PTY_COUNT=256
479# CONFIG_QIC02_TAPE is not set
480
481#
482# IPMI
483#
484# CONFIG_IPMI_HANDLER is not set
485
486#
487# Watchdog Cards
488#
489# CONFIG_WATCHDOG is not set
490# CONFIG_NVRAM is not set
491CONFIG_GEN_RTC=y
492# CONFIG_GEN_RTC_X is not set
493# CONFIG_DTLK is not set
494# CONFIG_R3964 is not set
495# CONFIG_APPLICOM is not set
496
497#
498# Ftape, the floppy tape device driver
499#
500# CONFIG_FTAPE is not set
501# CONFIG_AGP is not set
502# CONFIG_DRM is not set
503# CONFIG_RAW_DRIVER is not set
504
505#
506# I2C support
507#
508# CONFIG_I2C is not set
509
510#
511# Misc devices
512#
513
514#
515# Multimedia devices
516#
517# CONFIG_VIDEO_DEV is not set
518
519#
520# Digital Video Broadcasting Devices
521#
522# CONFIG_DVB is not set
523
524#
525# Graphics support
526#
527# CONFIG_FB is not set
528
529#
530# Sound
531#
532# CONFIG_SOUND is not set
533
534#
535# USB support
536#
537# CONFIG_USB is not set
538
539#
540# USB Gadget Support
541#
542# CONFIG_USB_GADGET is not set
543
544#
545# File systems
546#
547CONFIG_EXT2_FS=y
548# CONFIG_EXT2_FS_XATTR is not set
549CONFIG_EXT3_FS=y
550CONFIG_EXT3_FS_XATTR=y
551# CONFIG_EXT3_FS_POSIX_ACL is not set
552# CONFIG_EXT3_FS_SECURITY is not set
553CONFIG_JBD=y
554# CONFIG_JBD_DEBUG is not set
555CONFIG_FS_MBCACHE=y
556# CONFIG_REISERFS_FS is not set
557# CONFIG_JFS_FS is not set
558# CONFIG_XFS_FS is not set
559# CONFIG_MINIX_FS is not set
560# CONFIG_ROMFS_FS is not set
561# CONFIG_QUOTA is not set
562# CONFIG_AUTOFS_FS is not set
563# CONFIG_AUTOFS4_FS is not set
564
565#
566# CD-ROM/DVD Filesystems
567#
568# CONFIG_ISO9660_FS is not set
569# CONFIG_UDF_FS is not set
570
571#
572# DOS/FAT/NT Filesystems
573#
574# CONFIG_FAT_FS is not set
575# CONFIG_NTFS_FS is not set
576
577#
578# Pseudo filesystems
579#
580CONFIG_PROC_FS=y
581CONFIG_PROC_KCORE=y
582CONFIG_SYSFS=y
583# CONFIG_DEVFS_FS is not set
584# CONFIG_DEVPTS_FS_XATTR is not set
585CONFIG_TMPFS=y
586# CONFIG_HUGETLB_PAGE is not set
587CONFIG_RAMFS=y
588
589#
590# Miscellaneous filesystems
591#
592# CONFIG_ADFS_FS is not set
593# CONFIG_AFFS_FS is not set
594# CONFIG_HFS_FS is not set
595# CONFIG_HFSPLUS_FS is not set
596# CONFIG_BEFS_FS is not set
597# CONFIG_BFS_FS is not set
598# CONFIG_EFS_FS is not set
599# CONFIG_CRAMFS is not set
600# CONFIG_VXFS_FS is not set
601# CONFIG_HPFS_FS is not set
602# CONFIG_QNX4FS_FS is not set
603# CONFIG_SYSV_FS is not set
604# CONFIG_UFS_FS is not set
605
606#
607# Network File Systems
608#
609CONFIG_NFS_FS=y
610# CONFIG_NFS_V3 is not set
611# CONFIG_NFS_V4 is not set
612# CONFIG_NFS_DIRECTIO is not set
613# CONFIG_NFSD is not set
614CONFIG_ROOT_NFS=y
615CONFIG_LOCKD=y
616# CONFIG_EXPORTFS is not set
617CONFIG_SUNRPC=y
618# CONFIG_RPCSEC_GSS_KRB5 is not set
619# CONFIG_SMB_FS is not set
620# CONFIG_CIFS is not set
621# CONFIG_NCP_FS is not set
622# CONFIG_CODA_FS is not set
623# CONFIG_INTERMEZZO_FS is not set
624# CONFIG_AFS_FS is not set
625
626#
627# Partition Types
628#
629# CONFIG_PARTITION_ADVANCED is not set
630CONFIG_MSDOS_PARTITION=y
631
632#
633# Native Language Support
634#
635# CONFIG_NLS is not set
636
637#
638# Library routines
639#
640# CONFIG_CRC32 is not set
641
642#
643# Kernel hacking
644#
645# CONFIG_DEBUG_KERNEL is not set
646# CONFIG_SERIAL_TEXT_DEBUG is not set
647
648#
649# Security options
650#
651# CONFIG_SECURITY is not set
652
653#
654# Cryptographic options
655#
656# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/radstone_ppc7d_defconfig b/arch/ppc/configs/radstone_ppc7d_defconfig
new file mode 100644
index 000000000000..7f6467e77949
--- /dev/null
+++ b/arch/ppc/configs/radstone_ppc7d_defconfig
@@ -0,0 +1,956 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11
4# Tue Mar 15 14:31:19 2005
5#
6CONFIG_MMU=y
7CONFIG_GENERIC_HARDIRQS=y
8CONFIG_RWSEM_XCHGADD_ALGORITHM=y
9CONFIG_GENERIC_CALIBRATE_DELAY=y
10CONFIG_HAVE_DEC_LOCK=y
11CONFIG_PPC=y
12CONFIG_PPC32=y
13CONFIG_GENERIC_NVRAM=y
14
15#
16# Code maturity level options
17#
18CONFIG_EXPERIMENTAL=y
19CONFIG_CLEAN_COMPILE=y
20CONFIG_BROKEN_ON_SMP=y
21
22#
23# General setup
24#
25CONFIG_LOCALVERSION=""
26CONFIG_SWAP=y
27CONFIG_SYSVIPC=y
28# CONFIG_POSIX_MQUEUE is not set
29# CONFIG_BSD_PROCESS_ACCT is not set
30CONFIG_SYSCTL=y
31# CONFIG_AUDIT is not set
32# CONFIG_HOTPLUG is not set
33CONFIG_KOBJECT_UEVENT=y
34# CONFIG_IKCONFIG is not set
35CONFIG_EMBEDDED=y
36CONFIG_KALLSYMS=y
37CONFIG_KALLSYMS_EXTRA_PASS=y
38CONFIG_BASE_FULL=y
39CONFIG_FUTEX=y
40CONFIG_EPOLL=y
41# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
42CONFIG_SHMEM=y
43CONFIG_CC_ALIGN_FUNCTIONS=0
44CONFIG_CC_ALIGN_LABELS=0
45CONFIG_CC_ALIGN_LOOPS=0
46CONFIG_CC_ALIGN_JUMPS=0
47# CONFIG_TINY_SHMEM is not set
48CONFIG_BASE_SMALL=0
49
50#
51# Loadable module support
52#
53CONFIG_MODULES=y
54CONFIG_MODULE_UNLOAD=y
55# CONFIG_MODULE_FORCE_UNLOAD is not set
56CONFIG_OBSOLETE_MODPARM=y
57# CONFIG_MODVERSIONS is not set
58# CONFIG_MODULE_SRCVERSION_ALL is not set
59CONFIG_KMOD=y
60
61#
62# Processor
63#
64CONFIG_6xx=y
65# CONFIG_40x is not set
66# CONFIG_44x is not set
67# CONFIG_POWER3 is not set
68# CONFIG_POWER4 is not set
69# CONFIG_8xx is not set
70# CONFIG_E500 is not set
71CONFIG_ALTIVEC=y
72# CONFIG_TAU is not set
73# CONFIG_CPU_FREQ is not set
74CONFIG_PPC_GEN550=y
75# CONFIG_PM is not set
76CONFIG_PPC_STD_MMU=y
77# CONFIG_NOT_COHERENT_CACHE is not set
78
79#
80# Platform options
81#
82# CONFIG_PPC_MULTIPLATFORM is not set
83# CONFIG_APUS is not set
84# CONFIG_KATANA is not set
85# CONFIG_WILLOW is not set
86# CONFIG_CPCI690 is not set
87# CONFIG_PCORE is not set
88# CONFIG_POWERPMC250 is not set
89# CONFIG_CHESTNUT is not set
90# CONFIG_SPRUCE is not set
91# CONFIG_EV64260 is not set
92# CONFIG_LOPEC is not set
93# CONFIG_MCPN765 is not set
94# CONFIG_MVME5100 is not set
95# CONFIG_PPLUS is not set
96# CONFIG_PRPMC750 is not set
97# CONFIG_PRPMC800 is not set
98# CONFIG_SANDPOINT is not set
99CONFIG_RADSTONE_PPC7D=y
100# CONFIG_ADIR is not set
101# CONFIG_K2 is not set
102# CONFIG_PAL4 is not set
103# CONFIG_GEMINI is not set
104# CONFIG_EST8260 is not set
105# CONFIG_SBC82xx is not set
106# CONFIG_SBS8260 is not set
107# CONFIG_RPX8260 is not set
108# CONFIG_TQM8260 is not set
109# CONFIG_ADS8272 is not set
110# CONFIG_PQ2FADS is not set
111# CONFIG_LITE5200 is not set
112# CONFIG_MPC834x_SYS is not set
113CONFIG_MV64360=y
114CONFIG_MV64X60=y
115
116#
117# Set bridge options
118#
119CONFIG_MV64X60_BASE=0xfef00000
120CONFIG_MV64X60_NEW_BASE=0xfef00000
121# CONFIG_SMP is not set
122# CONFIG_PREEMPT is not set
123# CONFIG_HIGHMEM is not set
124CONFIG_BINFMT_ELF=y
125CONFIG_BINFMT_MISC=y
126CONFIG_CMDLINE_BOOL=y
127CONFIG_CMDLINE="console=ttyS0,9600"
128
129#
130# Bus options
131#
132CONFIG_GENERIC_ISA_DMA=y
133CONFIG_PCI=y
134CONFIG_PCI_DOMAINS=y
135CONFIG_PCI_LEGACY_PROC=y
136CONFIG_PCI_NAMES=y
137
138#
139# PCCARD (PCMCIA/CardBus) support
140#
141# CONFIG_PCCARD is not set
142
143#
144# Advanced setup
145#
146CONFIG_ADVANCED_OPTIONS=y
147CONFIG_HIGHMEM_START=0xfe000000
148# CONFIG_LOWMEM_SIZE_BOOL is not set
149CONFIG_LOWMEM_SIZE=0x30000000
150# CONFIG_KERNEL_START_BOOL is not set
151CONFIG_KERNEL_START=0xc0000000
152# CONFIG_TASK_SIZE_BOOL is not set
153CONFIG_TASK_SIZE=0x80000000
154# CONFIG_BOOT_LOAD_BOOL is not set
155CONFIG_BOOT_LOAD=0x00800000
156
157#
158# Device Drivers
159#
160
161#
162# Generic Driver Options
163#
164CONFIG_STANDALONE=y
165CONFIG_PREVENT_FIRMWARE_BUILD=y
166# CONFIG_FW_LOADER is not set
167
168#
169# Memory Technology Devices (MTD)
170#
171CONFIG_MTD=y
172# CONFIG_MTD_DEBUG is not set
173# CONFIG_MTD_CONCAT is not set
174# CONFIG_MTD_PARTITIONS is not set
175
176#
177# User Modules And Translation Layers
178#
179CONFIG_MTD_CHAR=y
180CONFIG_MTD_BLOCK=y
181CONFIG_FTL=y
182# CONFIG_NFTL is not set
183# CONFIG_INFTL is not set
184
185#
186# RAM/ROM/Flash chip drivers
187#
188CONFIG_MTD_CFI=y
189# CONFIG_MTD_JEDECPROBE is not set
190CONFIG_MTD_GEN_PROBE=y
191CONFIG_MTD_CFI_ADV_OPTIONS=y
192CONFIG_MTD_CFI_NOSWAP=y
193# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
194# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
195# CONFIG_MTD_CFI_GEOMETRY is not set
196CONFIG_MTD_MAP_BANK_WIDTH_1=y
197CONFIG_MTD_MAP_BANK_WIDTH_2=y
198CONFIG_MTD_MAP_BANK_WIDTH_4=y
199# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
200# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
201# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
202CONFIG_MTD_CFI_I1=y
203CONFIG_MTD_CFI_I2=y
204# CONFIG_MTD_CFI_I4 is not set
205# CONFIG_MTD_CFI_I8 is not set
206CONFIG_MTD_CFI_INTELEXT=y
207# CONFIG_MTD_CFI_AMDSTD is not set
208# CONFIG_MTD_CFI_STAA is not set
209CONFIG_MTD_CFI_UTIL=y
210# CONFIG_MTD_RAM is not set
211# CONFIG_MTD_ROM is not set
212# CONFIG_MTD_ABSENT is not set
213# CONFIG_MTD_XIP is not set
214
215#
216# Mapping drivers for chip access
217#
218# CONFIG_MTD_COMPLEX_MAPPINGS is not set
219# CONFIG_MTD_PHYSMAP is not set
220
221#
222# Self-contained MTD device drivers
223#
224# CONFIG_MTD_PMC551 is not set
225# CONFIG_MTD_SLRAM is not set
226# CONFIG_MTD_PHRAM is not set
227# CONFIG_MTD_MTDRAM is not set
228# CONFIG_MTD_BLKMTD is not set
229# CONFIG_MTD_BLOCK2MTD is not set
230
231#
232# Disk-On-Chip Device Drivers
233#
234# CONFIG_MTD_DOC2000 is not set
235# CONFIG_MTD_DOC2001 is not set
236# CONFIG_MTD_DOC2001PLUS is not set
237
238#
239# NAND Flash Device Drivers
240#
241# CONFIG_MTD_NAND is not set
242
243#
244# Parallel port support
245#
246# CONFIG_PARPORT is not set
247
248#
249# Plug and Play support
250#
251
252#
253# Block devices
254#
255# CONFIG_BLK_DEV_FD is not set
256# CONFIG_BLK_CPQ_DA is not set
257# CONFIG_BLK_CPQ_CISS_DA is not set
258# CONFIG_BLK_DEV_DAC960 is not set
259# CONFIG_BLK_DEV_UMEM is not set
260# CONFIG_BLK_DEV_COW_COMMON is not set
261CONFIG_BLK_DEV_LOOP=y
262# CONFIG_BLK_DEV_CRYPTOLOOP is not set
263# CONFIG_BLK_DEV_NBD is not set
264# CONFIG_BLK_DEV_SX8 is not set
265CONFIG_BLK_DEV_RAM=y
266CONFIG_BLK_DEV_RAM_COUNT=16
267CONFIG_BLK_DEV_RAM_SIZE=8192
268CONFIG_BLK_DEV_INITRD=y
269CONFIG_INITRAMFS_SOURCE=""
270# CONFIG_LBD is not set
271# CONFIG_CDROM_PKTCDVD is not set
272
273#
274# IO Schedulers
275#
276CONFIG_IOSCHED_NOOP=y
277CONFIG_IOSCHED_AS=y
278CONFIG_IOSCHED_DEADLINE=y
279CONFIG_IOSCHED_CFQ=y
280# CONFIG_ATA_OVER_ETH is not set
281
282#
283# ATA/ATAPI/MFM/RLL support
284#
285# CONFIG_IDE is not set
286
287#
288# SCSI device support
289#
290CONFIG_SCSI=y
291CONFIG_SCSI_PROC_FS=y
292
293#
294# SCSI support type (disk, tape, CD-ROM)
295#
296CONFIG_BLK_DEV_SD=y
297# CONFIG_CHR_DEV_ST is not set
298# CONFIG_CHR_DEV_OSST is not set
299CONFIG_BLK_DEV_SR=y
300CONFIG_BLK_DEV_SR_VENDOR=y
301CONFIG_CHR_DEV_SG=y
302
303#
304# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
305#
306CONFIG_SCSI_MULTI_LUN=y
307CONFIG_SCSI_CONSTANTS=y
308CONFIG_SCSI_LOGGING=y
309
310#
311# SCSI Transport Attributes
312#
313CONFIG_SCSI_SPI_ATTRS=y
314# CONFIG_SCSI_FC_ATTRS is not set
315# CONFIG_SCSI_ISCSI_ATTRS is not set
316
317#
318# SCSI low-level drivers
319#
320# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
321# CONFIG_SCSI_3W_9XXX is not set
322# CONFIG_SCSI_ACARD is not set
323# CONFIG_SCSI_AACRAID is not set
324# CONFIG_SCSI_AIC7XXX is not set
325# CONFIG_SCSI_AIC7XXX_OLD is not set
326# CONFIG_SCSI_AIC79XX is not set
327# CONFIG_SCSI_DPT_I2O is not set
328# CONFIG_MEGARAID_NEWGEN is not set
329# CONFIG_MEGARAID_LEGACY is not set
330# CONFIG_SCSI_SATA is not set
331# CONFIG_SCSI_BUSLOGIC is not set
332# CONFIG_SCSI_DMX3191D is not set
333# CONFIG_SCSI_EATA is not set
334# CONFIG_SCSI_EATA_PIO is not set
335# CONFIG_SCSI_FUTURE_DOMAIN is not set
336# CONFIG_SCSI_GDTH is not set
337# CONFIG_SCSI_IPS is not set
338# CONFIG_SCSI_INITIO is not set
339# CONFIG_SCSI_INIA100 is not set
340CONFIG_SCSI_SYM53C8XX_2=y
341CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1
342CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
343CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
344# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set
345# CONFIG_SCSI_IPR is not set
346# CONFIG_SCSI_QLOGIC_ISP is not set
347# CONFIG_SCSI_QLOGIC_FC is not set
348# CONFIG_SCSI_QLOGIC_1280 is not set
349CONFIG_SCSI_QLA2XXX=y
350# CONFIG_SCSI_QLA21XX is not set
351# CONFIG_SCSI_QLA22XX is not set
352# CONFIG_SCSI_QLA2300 is not set
353# CONFIG_SCSI_QLA2322 is not set
354# CONFIG_SCSI_QLA6312 is not set
355# CONFIG_SCSI_DC395x is not set
356# CONFIG_SCSI_DC390T is not set
357# CONFIG_SCSI_NSP32 is not set
358# CONFIG_SCSI_DEBUG is not set
359
360#
361# Multi-device support (RAID and LVM)
362#
363# CONFIG_MD is not set
364
365#
366# Fusion MPT device support
367#
368# CONFIG_FUSION is not set
369
370#
371# IEEE 1394 (FireWire) support
372#
373# CONFIG_IEEE1394 is not set
374
375#
376# I2O device support
377#
378# CONFIG_I2O is not set
379
380#
381# Macintosh device drivers
382#
383
384#
385# Networking support
386#
387CONFIG_NET=y
388
389#
390# Networking options
391#
392CONFIG_PACKET=y
393# CONFIG_PACKET_MMAP is not set
394# CONFIG_NETLINK_DEV is not set
395CONFIG_UNIX=y
396# CONFIG_NET_KEY is not set
397CONFIG_INET=y
398CONFIG_IP_MULTICAST=y
399# CONFIG_IP_ADVANCED_ROUTER is not set
400CONFIG_IP_PNP=y
401CONFIG_IP_PNP_DHCP=y
402CONFIG_IP_PNP_BOOTP=y
403# CONFIG_IP_PNP_RARP is not set
404# CONFIG_NET_IPIP is not set
405# CONFIG_NET_IPGRE is not set
406# CONFIG_IP_MROUTE is not set
407# CONFIG_ARPD is not set
408CONFIG_SYN_COOKIES=y
409# CONFIG_INET_AH is not set
410# CONFIG_INET_ESP is not set
411# CONFIG_INET_IPCOMP is not set
412# CONFIG_INET_TUNNEL is not set
413CONFIG_IP_TCPDIAG=y
414# CONFIG_IP_TCPDIAG_IPV6 is not set
415# CONFIG_IPV6 is not set
416# CONFIG_NETFILTER is not set
417
418#
419# SCTP Configuration (EXPERIMENTAL)
420#
421# CONFIG_IP_SCTP is not set
422# CONFIG_ATM is not set
423CONFIG_BRIDGE=y
424# CONFIG_VLAN_8021Q is not set
425# CONFIG_DECNET is not set
426# CONFIG_LLC2 is not set
427# CONFIG_IPX is not set
428# CONFIG_ATALK is not set
429# CONFIG_X25 is not set
430# CONFIG_LAPB is not set
431# CONFIG_NET_DIVERT is not set
432# CONFIG_ECONET is not set
433# CONFIG_WAN_ROUTER is not set
434
435#
436# QoS and/or fair queueing
437#
438# CONFIG_NET_SCHED is not set
439# CONFIG_NET_CLS_ROUTE is not set
440
441#
442# Network testing
443#
444# CONFIG_NET_PKTGEN is not set
445# CONFIG_NETPOLL is not set
446# CONFIG_NET_POLL_CONTROLLER is not set
447# CONFIG_HAMRADIO is not set
448# CONFIG_IRDA is not set
449# CONFIG_BT is not set
450CONFIG_NETDEVICES=y
451# CONFIG_DUMMY is not set
452# CONFIG_BONDING is not set
453# CONFIG_EQUALIZER is not set
454# CONFIG_TUN is not set
455
456#
457# ARCnet devices
458#
459# CONFIG_ARCNET is not set
460
461#
462# Ethernet (10 or 100Mbit)
463#
464CONFIG_NET_ETHERNET=y
465CONFIG_MII=y
466# CONFIG_HAPPYMEAL is not set
467# CONFIG_SUNGEM is not set
468# CONFIG_NET_VENDOR_3COM is not set
469
470#
471# Tulip family network device support
472#
473CONFIG_NET_TULIP=y
474# CONFIG_DE2104X is not set
475CONFIG_TULIP=y
476# CONFIG_TULIP_MWI is not set
477# CONFIG_TULIP_MMIO is not set
478# CONFIG_TULIP_NAPI is not set
479# CONFIG_DE4X5 is not set
480# CONFIG_WINBOND_840 is not set
481# CONFIG_DM9102 is not set
482# CONFIG_HP100 is not set
483CONFIG_NET_PCI=y
484# CONFIG_PCNET32 is not set
485# CONFIG_AMD8111_ETH is not set
486# CONFIG_ADAPTEC_STARFIRE is not set
487# CONFIG_B44 is not set
488# CONFIG_FORCEDETH is not set
489# CONFIG_DGRS is not set
490# CONFIG_EEPRO100 is not set
491CONFIG_E100=y
492# CONFIG_FEALNX is not set
493# CONFIG_NATSEMI is not set
494# CONFIG_NE2K_PCI is not set
495# CONFIG_8139CP is not set
496# CONFIG_8139TOO is not set
497# CONFIG_SIS900 is not set
498# CONFIG_EPIC100 is not set
499# CONFIG_SUNDANCE is not set
500# CONFIG_TLAN is not set
501# CONFIG_VIA_RHINE is not set
502
503#
504# Ethernet (1000 Mbit)
505#
506# CONFIG_ACENIC is not set
507# CONFIG_DL2K is not set
508# CONFIG_E1000 is not set
509# CONFIG_NS83820 is not set
510# CONFIG_HAMACHI is not set
511# CONFIG_YELLOWFIN is not set
512CONFIG_R8169=y
513CONFIG_R8169_NAPI=y
514CONFIG_SK98LIN=y
515# CONFIG_VIA_VELOCITY is not set
516CONFIG_TIGON3=y
517CONFIG_MV643XX_ETH=y
518CONFIG_MV643XX_ETH_0=y
519CONFIG_MV643XX_ETH_1=y
520# CONFIG_MV643XX_ETH_2 is not set
521
522#
523# Ethernet (10000 Mbit)
524#
525# CONFIG_IXGB is not set
526# CONFIG_S2IO is not set
527
528#
529# Token Ring devices
530#
531# CONFIG_TR is not set
532
533#
534# Wireless LAN (non-hamradio)
535#
536# CONFIG_NET_RADIO is not set
537
538#
539# Wan interfaces
540#
541# CONFIG_WAN is not set
542# CONFIG_FDDI is not set
543# CONFIG_HIPPI is not set
544# CONFIG_PPP is not set
545# CONFIG_SLIP is not set
546# CONFIG_NET_FC is not set
547# CONFIG_SHAPER is not set
548# CONFIG_NETCONSOLE is not set
549
550#
551# ISDN subsystem
552#
553# CONFIG_ISDN is not set
554
555#
556# Telephony Support
557#
558# CONFIG_PHONE is not set
559
560#
561# Input device support
562#
563CONFIG_INPUT=y
564
565#
566# Userland interfaces
567#
568CONFIG_INPUT_MOUSEDEV=y
569CONFIG_INPUT_MOUSEDEV_PSAUX=y
570CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
571CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
572# CONFIG_INPUT_JOYDEV is not set
573# CONFIG_INPUT_TSDEV is not set
574# CONFIG_INPUT_EVDEV is not set
575# CONFIG_INPUT_EVBUG is not set
576
577#
578# Input Device Drivers
579#
580CONFIG_INPUT_KEYBOARD=y
581CONFIG_KEYBOARD_ATKBD=y
582# CONFIG_KEYBOARD_SUNKBD is not set
583# CONFIG_KEYBOARD_LKKBD is not set
584CONFIG_KEYBOARD_XTKBD=y
585# CONFIG_KEYBOARD_NEWTON is not set
586# CONFIG_INPUT_MOUSE is not set
587# CONFIG_INPUT_JOYSTICK is not set
588# CONFIG_INPUT_TOUCHSCREEN is not set
589# CONFIG_INPUT_MISC is not set
590
591#
592# Hardware I/O ports
593#
594CONFIG_SERIO=y
595CONFIG_SERIO_I8042=y
596CONFIG_SERIO_SERPORT=y
597# CONFIG_SERIO_PCIPS2 is not set
598CONFIG_SERIO_LIBPS2=y
599# CONFIG_SERIO_RAW is not set
600# CONFIG_GAMEPORT is not set
601CONFIG_SOUND_GAMEPORT=y
602
603#
604# Character devices
605#
606CONFIG_VT=y
607# CONFIG_VT_CONSOLE is not set
608CONFIG_HW_CONSOLE=y
609# CONFIG_SERIAL_NONSTANDARD is not set
610
611#
612# Serial drivers
613#
614CONFIG_SERIAL_8250=y
615CONFIG_SERIAL_8250_CONSOLE=y
616CONFIG_SERIAL_8250_NR_UARTS=4
617# CONFIG_SERIAL_8250_EXTENDED is not set
618
619#
620# Non-8250 serial port support
621#
622CONFIG_SERIAL_MPSC=y
623# CONFIG_SERIAL_MPSC_CONSOLE is not set
624CONFIG_SERIAL_CORE=y
625CONFIG_SERIAL_CORE_CONSOLE=y
626CONFIG_UNIX98_PTYS=y
627CONFIG_LEGACY_PTYS=y
628CONFIG_LEGACY_PTY_COUNT=256
629
630#
631# IPMI
632#
633# CONFIG_IPMI_HANDLER is not set
634
635#
636# Watchdog Cards
637#
638CONFIG_WATCHDOG=y
639CONFIG_WATCHDOG_NOWAYOUT=y
640
641#
642# Watchdog Device Drivers
643#
644# CONFIG_SOFT_WATCHDOG is not set
645
646#
647# PCI-based Watchdog Cards
648#
649# CONFIG_PCIPCWATCHDOG is not set
650# CONFIG_WDTPCI is not set
651# CONFIG_NVRAM is not set
652CONFIG_GEN_RTC=y
653# CONFIG_GEN_RTC_X is not set
654# CONFIG_DTLK is not set
655# CONFIG_R3964 is not set
656# CONFIG_APPLICOM is not set
657
658#
659# Ftape, the floppy tape device driver
660#
661# CONFIG_AGP is not set
662# CONFIG_DRM is not set
663# CONFIG_RAW_DRIVER is not set
664
665#
666# TPM devices
667#
668# CONFIG_TCG_TPM is not set
669
670#
671# I2C support
672#
673CONFIG_I2C=y
674CONFIG_I2C_CHARDEV=y
675
676#
677# I2C Algorithms
678#
679# CONFIG_I2C_ALGOBIT is not set
680# CONFIG_I2C_ALGOPCF is not set
681# CONFIG_I2C_ALGOPCA is not set
682
683#
684# I2C Hardware Bus support
685#
686# CONFIG_I2C_ALI1535 is not set
687# CONFIG_I2C_ALI1563 is not set
688# CONFIG_I2C_ALI15X3 is not set
689# CONFIG_I2C_AMD756 is not set
690# CONFIG_I2C_AMD8111 is not set
691# CONFIG_I2C_I801 is not set
692# CONFIG_I2C_I810 is not set
693# CONFIG_I2C_ISA is not set
694# CONFIG_I2C_MPC is not set
695# CONFIG_I2C_NFORCE2 is not set
696# CONFIG_I2C_PARPORT_LIGHT is not set
697# CONFIG_I2C_PIIX4 is not set
698# CONFIG_I2C_PROSAVAGE is not set
699# CONFIG_I2C_SAVAGE4 is not set
700# CONFIG_SCx200_ACB is not set
701# CONFIG_I2C_SIS5595 is not set
702# CONFIG_I2C_SIS630 is not set
703# CONFIG_I2C_SIS96X is not set
704# CONFIG_I2C_STUB is not set
705# CONFIG_I2C_VIA is not set
706# CONFIG_I2C_VIAPRO is not set
707# CONFIG_I2C_VOODOO3 is not set
708# CONFIG_I2C_PCA_ISA is not set
709CONFIG_I2C_MV64XXX=y
710
711#
712# Hardware Sensors Chip support
713#
714CONFIG_I2C_SENSOR=y
715# CONFIG_SENSORS_ADM1021 is not set
716# CONFIG_SENSORS_ADM1025 is not set
717# CONFIG_SENSORS_ADM1026 is not set
718# CONFIG_SENSORS_ADM1031 is not set
719# CONFIG_SENSORS_ASB100 is not set
720# CONFIG_SENSORS_DS1621 is not set
721# CONFIG_SENSORS_FSCHER is not set
722# CONFIG_SENSORS_FSCPOS is not set
723# CONFIG_SENSORS_GL518SM is not set
724# CONFIG_SENSORS_GL520SM is not set
725# CONFIG_SENSORS_IT87 is not set
726# CONFIG_SENSORS_LM63 is not set
727# CONFIG_SENSORS_LM75 is not set
728# CONFIG_SENSORS_LM77 is not set
729# CONFIG_SENSORS_LM78 is not set
730# CONFIG_SENSORS_LM80 is not set
731# CONFIG_SENSORS_LM83 is not set
732# CONFIG_SENSORS_LM85 is not set
733# CONFIG_SENSORS_LM87 is not set
734CONFIG_SENSORS_LM90=y
735# CONFIG_SENSORS_MAX1619 is not set
736# CONFIG_SENSORS_PC87360 is not set
737# CONFIG_SENSORS_SMSC47B397 is not set
738# CONFIG_SENSORS_SIS5595 is not set
739# CONFIG_SENSORS_SMSC47M1 is not set
740# CONFIG_SENSORS_VIA686A is not set
741# CONFIG_SENSORS_W83781D is not set
742# CONFIG_SENSORS_W83L785TS is not set
743# CONFIG_SENSORS_W83627HF is not set
744
745#
746# Other I2C Chip support
747#
748# CONFIG_SENSORS_EEPROM is not set
749# CONFIG_SENSORS_PCF8574 is not set
750# CONFIG_SENSORS_PCF8591 is not set
751# CONFIG_SENSORS_RTC8564 is not set
752# CONFIG_SENSORS_M41T00 is not set
753# CONFIG_I2C_DEBUG_CORE is not set
754# CONFIG_I2C_DEBUG_ALGO is not set
755# CONFIG_I2C_DEBUG_BUS is not set
756# CONFIG_I2C_DEBUG_CHIP is not set
757
758#
759# Dallas's 1-wire bus
760#
761# CONFIG_W1 is not set
762
763#
764# Misc devices
765#
766
767#
768# Multimedia devices
769#
770# CONFIG_VIDEO_DEV is not set
771
772#
773# Digital Video Broadcasting Devices
774#
775# CONFIG_DVB is not set
776
777#
778# Graphics support
779#
780# CONFIG_FB is not set
781
782#
783# Console display driver support
784#
785# CONFIG_VGA_CONSOLE is not set
786CONFIG_DUMMY_CONSOLE=y
787
788#
789# Sound
790#
791# CONFIG_SOUND is not set
792
793#
794# USB support
795#
796CONFIG_USB_ARCH_HAS_HCD=y
797CONFIG_USB_ARCH_HAS_OHCI=y
798# CONFIG_USB is not set
799
800#
801# USB Gadget Support
802#
803# CONFIG_USB_GADGET is not set
804
805#
806# MMC/SD Card support
807#
808# CONFIG_MMC is not set
809
810#
811# InfiniBand support
812#
813# CONFIG_INFINIBAND is not set
814
815#
816# File systems
817#
818CONFIG_EXT2_FS=y
819# CONFIG_EXT2_FS_XATTR is not set
820# CONFIG_EXT3_FS is not set
821# CONFIG_JBD is not set
822# CONFIG_REISERFS_FS is not set
823# CONFIG_JFS_FS is not set
824
825#
826# XFS support
827#
828# CONFIG_XFS_FS is not set
829# CONFIG_MINIX_FS is not set
830# CONFIG_ROMFS_FS is not set
831# CONFIG_QUOTA is not set
832CONFIG_DNOTIFY=y
833# CONFIG_AUTOFS_FS is not set
834# CONFIG_AUTOFS4_FS is not set
835
836#
837# CD-ROM/DVD Filesystems
838#
839CONFIG_ISO9660_FS=y
840# CONFIG_JOLIET is not set
841# CONFIG_ZISOFS is not set
842# CONFIG_UDF_FS is not set
843
844#
845# DOS/FAT/NT Filesystems
846#
847# CONFIG_MSDOS_FS is not set
848# CONFIG_VFAT_FS is not set
849# CONFIG_NTFS_FS is not set
850
851#
852# Pseudo filesystems
853#
854CONFIG_PROC_FS=y
855CONFIG_PROC_KCORE=y
856CONFIG_SYSFS=y
857# CONFIG_DEVFS_FS is not set
858# CONFIG_DEVPTS_FS_XATTR is not set
859CONFIG_TMPFS=y
860# CONFIG_TMPFS_XATTR is not set
861# CONFIG_HUGETLB_PAGE is not set
862CONFIG_RAMFS=y
863
864#
865# Miscellaneous filesystems
866#
867# CONFIG_ADFS_FS is not set
868# CONFIG_AFFS_FS is not set
869# CONFIG_HFS_FS is not set
870# CONFIG_HFSPLUS_FS is not set
871# CONFIG_BEFS_FS is not set
872# CONFIG_BFS_FS is not set
873# CONFIG_EFS_FS is not set
874# CONFIG_JFFS_FS is not set
875CONFIG_JFFS2_FS=y
876CONFIG_JFFS2_FS_DEBUG=0
877# CONFIG_JFFS2_FS_NAND is not set
878# CONFIG_JFFS2_FS_NOR_ECC is not set
879# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
880CONFIG_JFFS2_ZLIB=y
881CONFIG_JFFS2_RTIME=y
882# CONFIG_JFFS2_RUBIN is not set
883# CONFIG_CRAMFS is not set
884# CONFIG_VXFS_FS is not set
885# CONFIG_HPFS_FS is not set
886# CONFIG_QNX4FS_FS is not set
887# CONFIG_SYSV_FS is not set
888# CONFIG_UFS_FS is not set
889
890#
891# Network File Systems
892#
893CONFIG_NFS_FS=y
894CONFIG_NFS_V3=y
895# CONFIG_NFS_V4 is not set
896# CONFIG_NFS_DIRECTIO is not set
897# CONFIG_NFSD is not set
898CONFIG_ROOT_NFS=y
899CONFIG_LOCKD=y
900CONFIG_LOCKD_V4=y
901CONFIG_SUNRPC=y
902# CONFIG_RPCSEC_GSS_KRB5 is not set
903# CONFIG_RPCSEC_GSS_SPKM3 is not set
904# CONFIG_SMB_FS is not set
905# CONFIG_CIFS is not set
906# CONFIG_NCP_FS is not set
907# CONFIG_CODA_FS is not set
908# CONFIG_AFS_FS is not set
909
910#
911# Partition Types
912#
913# CONFIG_PARTITION_ADVANCED is not set
914CONFIG_MSDOS_PARTITION=y
915
916#
917# Native Language Support
918#
919# CONFIG_NLS is not set
920
921#
922# Library routines
923#
924CONFIG_CRC_CCITT=y
925CONFIG_CRC32=y
926# CONFIG_LIBCRC32C is not set
927CONFIG_ZLIB_INFLATE=y
928CONFIG_ZLIB_DEFLATE=y
929
930#
931# Profiling support
932#
933# CONFIG_PROFILING is not set
934
935#
936# Kernel hacking
937#
938# CONFIG_PRINTK_TIME is not set
939# CONFIG_DEBUG_KERNEL is not set
940CONFIG_LOG_BUF_SHIFT=14
941# CONFIG_SERIAL_TEXT_DEBUG is not set
942
943#
944# Security options
945#
946# CONFIG_KEYS is not set
947# CONFIG_SECURITY is not set
948
949#
950# Cryptographic options
951#
952# CONFIG_CRYPTO is not set
953
954#
955# Hardware crypto devices
956#
diff --git a/arch/ppc/configs/rainier_defconfig b/arch/ppc/configs/rainier_defconfig
new file mode 100644
index 000000000000..4d4fcdc61bb7
--- /dev/null
+++ b/arch/ppc/configs/rainier_defconfig
@@ -0,0 +1,599 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7
8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12
13#
14# General setup
15#
16# CONFIG_SWAP is not set
17CONFIG_SYSVIPC=y
18# CONFIG_BSD_PROCESS_ACCT is not set
19CONFIG_SYSCTL=y
20CONFIG_LOG_BUF_SHIFT=14
21CONFIG_EMBEDDED=y
22CONFIG_FUTEX=y
23# CONFIG_EPOLL is not set
24
25#
26# Loadable module support
27#
28CONFIG_MODULES=y
29# CONFIG_MODULE_UNLOAD is not set
30CONFIG_OBSOLETE_MODPARM=y
31CONFIG_MODVERSIONS=y
32CONFIG_KMOD=y
33
34#
35# Platform support
36#
37CONFIG_PPC=y
38CONFIG_PPC32=y
39# CONFIG_6xx is not set
40CONFIG_40x=y
41# CONFIG_POWER3 is not set
42# CONFIG_8xx is not set
43CONFIG_4xx=y
44
45#
46# IBM 4xx options
47#
48# CONFIG_ASH is not set
49# CONFIG_BEECH is not set
50# CONFIG_CEDAR is not set
51# CONFIG_CPCI405 is not set
52# CONFIG_EP405 is not set
53# CONFIG_OAK is not set
54# CONFIG_REDWOOD_4 is not set
55# CONFIG_REDWOOD_5 is not set
56# CONFIG_REDWOOD_6 is not set
57# CONFIG_SYCAMORE is not set
58# CONFIG_TIVO is not set
59CONFIG_WALNUT=y
60CONFIG_IBM405_ERR77=y
61CONFIG_IBM405_ERR51=y
62CONFIG_IBM_OCP=y
63CONFIG_BIOS_FIXUP=y
64CONFIG_405GP=y
65CONFIG_IBM_OPENBIOS=y
66CONFIG_405_DMA=y
67# CONFIG_PM is not set
68CONFIG_UART0_TTYS0=y
69# CONFIG_UART0_TTYS1 is not set
70CONFIG_NOT_COHERENT_CACHE=y
71# CONFIG_SMP is not set
72# CONFIG_PREEMPT is not set
73# CONFIG_MATH_EMULATION is not set
74# CONFIG_CPU_FREQ is not set
75
76#
77# General setup
78#
79# CONFIG_HIGHMEM is not set
80CONFIG_PCI=y
81CONFIG_PCI_DOMAINS=y
82# CONFIG_PC_KEYBOARD is not set
83CONFIG_KCORE_ELF=y
84CONFIG_BINFMT_ELF=y
85CONFIG_KERNEL_ELF=y
86# CONFIG_BINFMT_MISC is not set
87# CONFIG_PCI_LEGACY_PROC is not set
88CONFIG_PCI_NAMES=y
89# CONFIG_HOTPLUG is not set
90
91#
92# Parallel port support
93#
94# CONFIG_PARPORT is not set
95# CONFIG_CMDLINE_BOOL is not set
96
97#
98# Advanced setup
99#
100# CONFIG_ADVANCED_OPTIONS is not set
101
102#
103# Default settings for advanced configuration options are used
104#
105CONFIG_HIGHMEM_START=0xfe000000
106CONFIG_LOWMEM_SIZE=0x30000000
107CONFIG_KERNEL_START=0xc0000000
108CONFIG_TASK_SIZE=0x80000000
109CONFIG_BOOT_LOAD=0x00400000
110
111#
112# Memory Technology Devices (MTD)
113#
114# CONFIG_MTD is not set
115
116#
117# Plug and Play support
118#
119# CONFIG_PNP is not set
120
121#
122# Block devices
123#
124# CONFIG_BLK_DEV_FD is not set
125# CONFIG_BLK_CPQ_DA is not set
126# CONFIG_BLK_CPQ_CISS_DA is not set
127# CONFIG_BLK_DEV_DAC960 is not set
128# CONFIG_BLK_DEV_UMEM is not set
129CONFIG_BLK_DEV_LOOP=y
130CONFIG_BLK_DEV_NBD=y
131CONFIG_BLK_DEV_RAM=y
132CONFIG_BLK_DEV_RAM_SIZE=4096
133CONFIG_BLK_DEV_INITRD=y
134
135#
136# Multi-device support (RAID and LVM)
137#
138# CONFIG_MD is not set
139
140#
141# ATA/IDE/MFM/RLL support
142#
143# CONFIG_IDE is not set
144
145#
146# SCSI support
147#
148# CONFIG_SCSI is not set
149
150#
151# Fusion MPT device support
152#
153
154#
155# IEEE 1394 (FireWire) support (EXPERIMENTAL)
156#
157# CONFIG_IEEE1394 is not set
158
159#
160# I2O device support
161#
162# CONFIG_I2O is not set
163
164#
165# Networking support
166#
167CONFIG_NET=y
168
169#
170# Networking options
171#
172CONFIG_PACKET=y
173# CONFIG_PACKET_MMAP is not set
174# CONFIG_NETLINK_DEV is not set
175# CONFIG_NETFILTER is not set
176CONFIG_UNIX=y
177# CONFIG_NET_KEY is not set
178CONFIG_INET=y
179CONFIG_IP_MULTICAST=y
180# CONFIG_IP_ADVANCED_ROUTER is not set
181CONFIG_IP_PNP=y
182# CONFIG_IP_PNP_DHCP is not set
183CONFIG_IP_PNP_BOOTP=y
184CONFIG_IP_PNP_RARP=y
185# CONFIG_NET_IPIP is not set
186# CONFIG_NET_IPGRE is not set
187# CONFIG_IP_MROUTE is not set
188# CONFIG_ARPD is not set
189# CONFIG_INET_ECN is not set
190CONFIG_SYN_COOKIES=y
191# CONFIG_INET_AH is not set
192# CONFIG_INET_ESP is not set
193# CONFIG_INET_IPCOMP is not set
194# CONFIG_IPV6 is not set
195# CONFIG_XFRM_USER is not set
196
197#
198# SCTP Configuration (EXPERIMENTAL)
199#
200CONFIG_IPV6_SCTP__=y
201# CONFIG_IP_SCTP is not set
202# CONFIG_ATM is not set
203# CONFIG_VLAN_8021Q is not set
204# CONFIG_LLC is not set
205# CONFIG_DECNET is not set
206# CONFIG_BRIDGE is not set
207# CONFIG_X25 is not set
208# CONFIG_LAPB is not set
209# CONFIG_NET_DIVERT is not set
210# CONFIG_ECONET is not set
211# CONFIG_WAN_ROUTER is not set
212# CONFIG_NET_HW_FLOWCONTROL is not set
213
214#
215# QoS and/or fair queueing
216#
217# CONFIG_NET_SCHED is not set
218
219#
220# Network testing
221#
222# CONFIG_NET_PKTGEN is not set
223CONFIG_NETDEVICES=y
224
225#
226# ARCnet devices
227#
228# CONFIG_ARCNET is not set
229# CONFIG_DUMMY is not set
230# CONFIG_BONDING is not set
231# CONFIG_EQUALIZER is not set
232# CONFIG_TUN is not set
233# CONFIG_ETHERTAP is not set
234
235#
236# Ethernet (10 or 100Mbit)
237#
238CONFIG_NET_ETHERNET=y
239CONFIG_MII=y
240# CONFIG_OAKNET is not set
241# CONFIG_HAPPYMEAL is not set
242# CONFIG_SUNGEM is not set
243# CONFIG_NET_VENDOR_3COM is not set
244
245#
246# Tulip family network device support
247#
248# CONFIG_NET_TULIP is not set
249# CONFIG_HP100 is not set
250CONFIG_NET_PCI=y
251CONFIG_PCNET32=y
252# CONFIG_AMD8111_ETH is not set
253# CONFIG_ADAPTEC_STARFIRE is not set
254# CONFIG_B44 is not set
255# CONFIG_DGRS is not set
256CONFIG_EEPRO100=y
257# CONFIG_EEPRO100_PIO is not set
258# CONFIG_E100 is not set
259# CONFIG_FEALNX is not set
260# CONFIG_NATSEMI is not set
261# CONFIG_NE2K_PCI is not set
262# CONFIG_8139CP is not set
263# CONFIG_8139TOO is not set
264# CONFIG_SIS900 is not set
265# CONFIG_EPIC100 is not set
266# CONFIG_SUNDANCE is not set
267# CONFIG_TLAN is not set
268# CONFIG_VIA_RHINE is not set
269
270#
271# Ethernet (1000 Mbit)
272#
273# CONFIG_ACENIC is not set
274# CONFIG_DL2K is not set
275# CONFIG_E1000 is not set
276# CONFIG_NS83820 is not set
277# CONFIG_HAMACHI is not set
278# CONFIG_YELLOWFIN is not set
279# CONFIG_R8169 is not set
280# CONFIG_SK98LIN is not set
281# CONFIG_TIGON3 is not set
282
283#
284# Ethernet (10000 Mbit)
285#
286# CONFIG_IXGB is not set
287# CONFIG_FDDI is not set
288# CONFIG_HIPPI is not set
289CONFIG_PPP=y
290# CONFIG_PPP_MULTILINK is not set
291# CONFIG_PPP_FILTER is not set
292# CONFIG_PPP_ASYNC is not set
293# CONFIG_PPP_SYNC_TTY is not set
294# CONFIG_PPP_DEFLATE is not set
295# CONFIG_PPP_BSDCOMP is not set
296# CONFIG_PPPOE is not set
297# CONFIG_SLIP is not set
298
299#
300# Wireless LAN (non-hamradio)
301#
302# CONFIG_NET_RADIO is not set
303
304#
305# Token Ring devices (depends on LLC=y)
306#
307# CONFIG_RCPCI is not set
308# CONFIG_SHAPER is not set
309
310#
311# Wan interfaces
312#
313# CONFIG_WAN is not set
314
315#
316# Amateur Radio support
317#
318# CONFIG_HAMRADIO is not set
319
320#
321# IrDA (infrared) support
322#
323# CONFIG_IRDA is not set
324
325#
326# ISDN subsystem
327#
328# CONFIG_ISDN_BOOL is not set
329
330#
331# Graphics support
332#
333# CONFIG_FB is not set
334
335#
336# Old CD-ROM drivers (not SCSI, not IDE)
337#
338# CONFIG_CD_NO_IDESCSI is not set
339
340#
341# Input device support
342#
343# CONFIG_INPUT is not set
344
345#
346# Userland interfaces
347#
348
349#
350# Input I/O drivers
351#
352# CONFIG_GAMEPORT is not set
353CONFIG_SOUND_GAMEPORT=y
354CONFIG_SERIO=y
355CONFIG_SERIO_I8042=y
356CONFIG_SERIO_SERPORT=y
357# CONFIG_SERIO_CT82C710 is not set
358
359#
360# Input Device Drivers
361#
362
363#
364# Macintosh device drivers
365#
366
367#
368# Character devices
369#
370# CONFIG_SERIAL_NONSTANDARD is not set
371
372#
373# Serial drivers
374#
375# CONFIG_SERIAL_8250 is not set
376
377#
378# Non-8250 serial port support
379#
380CONFIG_UNIX98_PTYS=y
381CONFIG_UNIX98_PTY_COUNT=256
382
383#
384# I2C support
385#
386CONFIG_I2C=y
387# CONFIG_I2C_ALGOBIT is not set
388# CONFIG_I2C_ALGOPCF is not set
389# CONFIG_I2C_IBM_OCP_ALGO is not set
390CONFIG_I2C_CHARDEV=y
391
392#
393# I2C Hardware Sensors Mainboard support
394#
395# CONFIG_I2C_ALI15X3 is not set
396# CONFIG_I2C_AMD756 is not set
397# CONFIG_I2C_AMD8111 is not set
398# CONFIG_I2C_I801 is not set
399# CONFIG_I2C_PIIX4 is not set
400# CONFIG_I2C_SIS96X is not set
401# CONFIG_I2C_VIAPRO is not set
402
403#
404# I2C Hardware Sensors Chip support
405#
406# CONFIG_SENSORS_ADM1021 is not set
407# CONFIG_SENSORS_IT87 is not set
408# CONFIG_SENSORS_LM75 is not set
409# CONFIG_SENSORS_LM85 is not set
410# CONFIG_SENSORS_VIA686A is not set
411# CONFIG_SENSORS_W83781D is not set
412# CONFIG_I2C_SENSOR is not set
413
414#
415# Mice
416#
417CONFIG_BUSMOUSE=y
418# CONFIG_QIC02_TAPE is not set
419
420#
421# IPMI
422#
423# CONFIG_IPMI_HANDLER is not set
424
425#
426# Watchdog Cards
427#
428CONFIG_WATCHDOG=y
429# CONFIG_WATCHDOG_NOWAYOUT is not set
430# CONFIG_SOFT_WATCHDOG is not set
431# CONFIG_WDT is not set
432# CONFIG_WDTPCI is not set
433# CONFIG_PCWATCHDOG is not set
434# CONFIG_ACQUIRE_WDT is not set
435# CONFIG_ADVANTECH_WDT is not set
436# CONFIG_EUROTECH_WDT is not set
437# CONFIG_IB700_WDT is not set
438# CONFIG_MIXCOMWD is not set
439# CONFIG_SCx200_WDT is not set
440# CONFIG_60XX_WDT is not set
441# CONFIG_W83877F_WDT is not set
442# CONFIG_MACHZ_WDT is not set
443# CONFIG_SC520_WDT is not set
444# CONFIG_AMD7XX_TCO is not set
445# CONFIG_ALIM7101_WDT is not set
446# CONFIG_SC1200_WDT is not set
447# CONFIG_WAFER_WDT is not set
448# CONFIG_CPU5_WDT is not set
449# CONFIG_NVRAM is not set
450CONFIG_GEN_RTC=y
451# CONFIG_GEN_RTC_X is not set
452# CONFIG_DTLK is not set
453# CONFIG_R3964 is not set
454# CONFIG_APPLICOM is not set
455
456#
457# Ftape, the floppy tape device driver
458#
459# CONFIG_FTAPE is not set
460# CONFIG_AGP is not set
461# CONFIG_DRM is not set
462# CONFIG_RAW_DRIVER is not set
463# CONFIG_HANGCHECK_TIMER is not set
464
465#
466# Multimedia devices
467#
468# CONFIG_VIDEO_DEV is not set
469
470#
471# Digital Video Broadcasting Devices
472#
473# CONFIG_DVB is not set
474
475#
476# File systems
477#
478CONFIG_EXT2_FS=y
479# CONFIG_EXT2_FS_XATTR is not set
480# CONFIG_EXT3_FS is not set
481# CONFIG_JBD is not set
482# CONFIG_REISERFS_FS is not set
483# CONFIG_JFS_FS is not set
484# CONFIG_XFS_FS is not set
485# CONFIG_MINIX_FS is not set
486# CONFIG_ROMFS_FS is not set
487# CONFIG_QUOTA is not set
488CONFIG_AUTOFS_FS=y
489# CONFIG_AUTOFS4_FS is not set
490
491#
492# CD-ROM/DVD Filesystems
493#
494CONFIG_ISO9660_FS=y
495# CONFIG_JOLIET is not set
496# CONFIG_ZISOFS is not set
497# CONFIG_UDF_FS is not set
498
499#
500# DOS/FAT/NT Filesystems
501#
502# CONFIG_FAT_FS is not set
503# CONFIG_NTFS_FS is not set
504
505#
506# Pseudo filesystems
507#
508CONFIG_PROC_FS=y
509# CONFIG_DEVFS_FS is not set
510CONFIG_DEVPTS_FS=y
511# CONFIG_DEVPTS_FS_XATTR is not set
512CONFIG_TMPFS=y
513CONFIG_RAMFS=y
514
515#
516# Miscellaneous filesystems
517#
518# CONFIG_ADFS_FS is not set
519# CONFIG_AFFS_FS is not set
520# CONFIG_HFS_FS is not set
521# CONFIG_BEFS_FS is not set
522# CONFIG_BFS_FS is not set
523# CONFIG_EFS_FS is not set
524# CONFIG_CRAMFS is not set
525# CONFIG_VXFS_FS is not set
526# CONFIG_HPFS_FS is not set
527# CONFIG_QNX4FS_FS is not set
528# CONFIG_SYSV_FS is not set
529# CONFIG_UFS_FS is not set
530
531#
532# Network File Systems
533#
534CONFIG_NFS_FS=y
535# CONFIG_NFS_V3 is not set
536# CONFIG_NFS_V4 is not set
537CONFIG_NFSD=y
538# CONFIG_NFSD_V3 is not set
539# CONFIG_NFSD_TCP is not set
540CONFIG_ROOT_NFS=y
541CONFIG_LOCKD=y
542CONFIG_EXPORTFS=y
543CONFIG_SUNRPC=y
544# CONFIG_SUNRPC_GSS is not set
545# CONFIG_SMB_FS is not set
546# CONFIG_CIFS is not set
547# CONFIG_NCP_FS is not set
548# CONFIG_CODA_FS is not set
549# CONFIG_INTERMEZZO_FS is not set
550# CONFIG_AFS_FS is not set
551
552#
553# Partition Types
554#
555# CONFIG_PARTITION_ADVANCED is not set
556CONFIG_MSDOS_PARTITION=y
557
558#
559# Sound
560#
561# CONFIG_SOUND is not set
562
563#
564# IBM 40x options
565#
566
567#
568# USB support
569#
570# CONFIG_USB is not set
571# CONFIG_USB_GADGET is not set
572
573#
574# Bluetooth support
575#
576# CONFIG_BT is not set
577
578#
579# Library routines
580#
581# CONFIG_CRC32 is not set
582
583#
584# Kernel hacking
585#
586# CONFIG_DEBUG_KERNEL is not set
587# CONFIG_KALLSYMS is not set
588# CONFIG_SERIAL_TEXT_DEBUG is not set
589CONFIG_OCP=y
590
591#
592# Security options
593#
594# CONFIG_SECURITY is not set
595
596#
597# Cryptographic options
598#
599# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/redwood5_defconfig b/arch/ppc/configs/redwood5_defconfig
new file mode 100644
index 000000000000..4c5486da4139
--- /dev/null
+++ b/arch/ppc/configs/redwood5_defconfig
@@ -0,0 +1,557 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7CONFIG_PPC=y
8CONFIG_PPC32=y
9CONFIG_GENERIC_NVRAM=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16# CONFIG_STANDALONE is not set
17CONFIG_BROKEN_ON_SMP=y
18
19#
20# General setup
21#
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26CONFIG_LOG_BUF_SHIFT=14
27# CONFIG_HOTPLUG is not set
28# CONFIG_IKCONFIG is not set
29CONFIG_EMBEDDED=y
30# CONFIG_KALLSYMS is not set
31CONFIG_FUTEX=y
32# CONFIG_EPOLL is not set
33CONFIG_IOSCHED_NOOP=y
34CONFIG_IOSCHED_AS=y
35CONFIG_IOSCHED_DEADLINE=y
36# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
37
38#
39# Loadable module support
40#
41CONFIG_MODULES=y
42CONFIG_MODULE_UNLOAD=y
43# CONFIG_MODULE_FORCE_UNLOAD is not set
44CONFIG_OBSOLETE_MODPARM=y
45# CONFIG_MODVERSIONS is not set
46CONFIG_KMOD=y
47
48#
49# Processor
50#
51# CONFIG_6xx is not set
52CONFIG_40x=y
53# CONFIG_44x is not set
54# CONFIG_POWER3 is not set
55# CONFIG_POWER4 is not set
56# CONFIG_8xx is not set
57# CONFIG_MATH_EMULATION is not set
58# CONFIG_CPU_FREQ is not set
59CONFIG_4xx=y
60
61#
62# IBM 4xx options
63#
64# CONFIG_ASH is not set
65# CONFIG_CPCI405 is not set
66# CONFIG_EP405 is not set
67# CONFIG_OAK is not set
68CONFIG_REDWOOD_5=y
69# CONFIG_REDWOOD_6 is not set
70# CONFIG_SYCAMORE is not set
71# CONFIG_WALNUT is not set
72CONFIG_IBM405_ERR77=y
73CONFIG_IBM405_ERR51=y
74CONFIG_IBM_OCP=y
75CONFIG_PPC_OCP=y
76CONFIG_STB03xxx=y
77CONFIG_IBM_OPENBIOS=y
78# CONFIG_PM is not set
79CONFIG_UART0_TTYS0=y
80# CONFIG_UART0_TTYS1 is not set
81# CONFIG_SERIAL_SICC is not set
82CONFIG_NOT_COHERENT_CACHE=y
83
84#
85# Platform options
86#
87# CONFIG_PC_KEYBOARD is not set
88# CONFIG_SMP is not set
89# CONFIG_PREEMPT is not set
90# CONFIG_HIGHMEM is not set
91CONFIG_KERNEL_ELF=y
92CONFIG_BINFMT_ELF=y
93# CONFIG_BINFMT_MISC is not set
94CONFIG_CMDLINE_BOOL=y
95CONFIG_CMDLINE="ip=on"
96
97#
98# Bus options
99#
100# CONFIG_PCI is not set
101# CONFIG_PCI_DOMAINS is not set
102
103#
104# Advanced setup
105#
106# CONFIG_ADVANCED_OPTIONS is not set
107
108#
109# Default settings for advanced configuration options are used
110#
111CONFIG_HIGHMEM_START=0xfe000000
112CONFIG_LOWMEM_SIZE=0x30000000
113CONFIG_KERNEL_START=0xc0000000
114CONFIG_TASK_SIZE=0x80000000
115CONFIG_BOOT_LOAD=0x00400000
116
117#
118# Device Drivers
119#
120
121#
122# Generic Driver Options
123#
124
125#
126# Memory Technology Devices (MTD)
127#
128# CONFIG_MTD is not set
129
130#
131# Parallel port support
132#
133# CONFIG_PARPORT is not set
134
135#
136# Plug and Play support
137#
138
139#
140# Block devices
141#
142# CONFIG_BLK_DEV_FD is not set
143CONFIG_BLK_DEV_LOOP=y
144# CONFIG_BLK_DEV_CRYPTOLOOP is not set
145# CONFIG_BLK_DEV_NBD is not set
146CONFIG_BLK_DEV_RAM=y
147CONFIG_BLK_DEV_RAM_SIZE=4096
148CONFIG_BLK_DEV_INITRD=y
149# CONFIG_LBD is not set
150
151#
152# ATA/ATAPI/MFM/RLL support
153#
154CONFIG_IDE=y
155CONFIG_BLK_DEV_IDE=y
156
157#
158# Please see Documentation/ide.txt for help/info on IDE drives
159#
160CONFIG_BLK_DEV_IDEDISK=y
161# CONFIG_IDEDISK_MULTI_MODE is not set
162# CONFIG_IDEDISK_STROKE is not set
163# CONFIG_BLK_DEV_IDECD is not set
164# CONFIG_BLK_DEV_IDETAPE is not set
165# CONFIG_BLK_DEV_IDEFLOPPY is not set
166# CONFIG_IDE_TASK_IOCTL is not set
167# CONFIG_IDE_TASKFILE_IO is not set
168
169#
170# IDE chipset support/bugfixes
171#
172CONFIG_IDE_GENERIC=y
173# CONFIG_BLK_DEV_IDEDMA is not set
174# CONFIG_IDEDMA_AUTO is not set
175# CONFIG_BLK_DEV_HD is not set
176
177#
178# SCSI device support
179#
180# CONFIG_SCSI is not set
181
182#
183# Multi-device support (RAID and LVM)
184#
185# CONFIG_MD is not set
186
187#
188# Fusion MPT device support
189#
190
191#
192# IEEE 1394 (FireWire) support
193#
194# CONFIG_IEEE1394 is not set
195
196#
197# I2O device support
198#
199
200#
201# Macintosh device drivers
202#
203
204#
205# Networking support
206#
207CONFIG_NET=y
208
209#
210# Networking options
211#
212# CONFIG_PACKET is not set
213# CONFIG_NETLINK_DEV is not set
214CONFIG_UNIX=y
215# CONFIG_NET_KEY is not set
216CONFIG_INET=y
217CONFIG_IP_MULTICAST=y
218# CONFIG_IP_ADVANCED_ROUTER is not set
219CONFIG_IP_PNP=y
220CONFIG_IP_PNP_DHCP=y
221CONFIG_IP_PNP_BOOTP=y
222CONFIG_IP_PNP_RARP=y
223# CONFIG_NET_IPIP is not set
224# CONFIG_NET_IPGRE is not set
225# CONFIG_IP_MROUTE is not set
226# CONFIG_ARPD is not set
227CONFIG_SYN_COOKIES=y
228# CONFIG_INET_AH is not set
229# CONFIG_INET_ESP is not set
230# CONFIG_INET_IPCOMP is not set
231# CONFIG_IPV6 is not set
232# CONFIG_DECNET is not set
233# CONFIG_BRIDGE is not set
234# CONFIG_NETFILTER is not set
235
236#
237# SCTP Configuration (EXPERIMENTAL)
238#
239# CONFIG_IP_SCTP is not set
240# CONFIG_ATM is not set
241# CONFIG_VLAN_8021Q is not set
242# CONFIG_LLC2 is not set
243# CONFIG_IPX is not set
244# CONFIG_ATALK is not set
245# CONFIG_X25 is not set
246# CONFIG_LAPB is not set
247# CONFIG_NET_DIVERT is not set
248# CONFIG_ECONET is not set
249# CONFIG_WAN_ROUTER is not set
250# CONFIG_NET_HW_FLOWCONTROL is not set
251
252#
253# QoS and/or fair queueing
254#
255# CONFIG_NET_SCHED is not set
256
257#
258# Network testing
259#
260# CONFIG_NET_PKTGEN is not set
261CONFIG_NETDEVICES=y
262# CONFIG_DUMMY is not set
263# CONFIG_BONDING is not set
264# CONFIG_EQUALIZER is not set
265# CONFIG_TUN is not set
266
267#
268# Ethernet (10 or 100Mbit)
269#
270CONFIG_NET_ETHERNET=y
271CONFIG_MII=y
272# CONFIG_OAKNET is not set
273
274#
275# Ethernet (1000 Mbit)
276#
277
278#
279# Ethernet (10000 Mbit)
280#
281# CONFIG_IBM_EMAC is not set
282# CONFIG_PPP is not set
283# CONFIG_SLIP is not set
284
285#
286# Wireless LAN (non-hamradio)
287#
288# CONFIG_NET_RADIO is not set
289
290#
291# Token Ring devices
292#
293# CONFIG_SHAPER is not set
294# CONFIG_NETCONSOLE is not set
295
296#
297# Wan interfaces
298#
299# CONFIG_WAN is not set
300
301#
302# Amateur Radio support
303#
304# CONFIG_HAMRADIO is not set
305
306#
307# IrDA (infrared) support
308#
309# CONFIG_IRDA is not set
310
311#
312# Bluetooth support
313#
314# CONFIG_BT is not set
315# CONFIG_NETPOLL is not set
316# CONFIG_NET_POLL_CONTROLLER is not set
317
318#
319# ISDN subsystem
320#
321# CONFIG_ISDN is not set
322
323#
324# Telephony Support
325#
326# CONFIG_PHONE is not set
327
328#
329# Input device support
330#
331CONFIG_INPUT=y
332
333#
334# Userland interfaces
335#
336# CONFIG_INPUT_MOUSEDEV is not set
337# CONFIG_INPUT_JOYDEV is not set
338# CONFIG_INPUT_TSDEV is not set
339# CONFIG_INPUT_EVDEV is not set
340# CONFIG_INPUT_EVBUG is not set
341
342#
343# Input I/O drivers
344#
345# CONFIG_GAMEPORT is not set
346CONFIG_SOUND_GAMEPORT=y
347CONFIG_SERIO=y
348# CONFIG_SERIO_I8042 is not set
349# CONFIG_SERIO_SERPORT is not set
350# CONFIG_SERIO_CT82C710 is not set
351
352#
353# Input Device Drivers
354#
355# CONFIG_INPUT_KEYBOARD is not set
356# CONFIG_INPUT_MOUSE is not set
357# CONFIG_INPUT_JOYSTICK is not set
358# CONFIG_INPUT_TOUCHSCREEN is not set
359# CONFIG_INPUT_MISC is not set
360
361#
362# Character devices
363#
364# CONFIG_VT is not set
365# CONFIG_SERIAL_NONSTANDARD is not set
366
367#
368# Serial drivers
369#
370CONFIG_SERIAL_8250=y
371CONFIG_SERIAL_8250_CONSOLE=y
372CONFIG_SERIAL_8250_NR_UARTS=4
373# CONFIG_SERIAL_8250_EXTENDED is not set
374
375#
376# Non-8250 serial port support
377#
378CONFIG_SERIAL_CORE=y
379CONFIG_SERIAL_CORE_CONSOLE=y
380# CONFIG_UNIX98_PTYS is not set
381CONFIG_LEGACY_PTYS=y
382CONFIG_LEGACY_PTY_COUNT=256
383# CONFIG_QIC02_TAPE is not set
384
385#
386# IPMI
387#
388# CONFIG_IPMI_HANDLER is not set
389
390#
391# Watchdog Cards
392#
393# CONFIG_WATCHDOG is not set
394# CONFIG_NVRAM is not set
395CONFIG_GEN_RTC=y
396# CONFIG_GEN_RTC_X is not set
397# CONFIG_DTLK is not set
398# CONFIG_R3964 is not set
399# CONFIG_APPLICOM is not set
400
401#
402# Ftape, the floppy tape device driver
403#
404# CONFIG_FTAPE is not set
405# CONFIG_AGP is not set
406# CONFIG_DRM is not set
407# CONFIG_RAW_DRIVER is not set
408
409#
410# I2C support
411#
412# CONFIG_I2C is not set
413
414#
415# Misc devices
416#
417
418#
419# Multimedia devices
420#
421# CONFIG_VIDEO_DEV is not set
422
423#
424# Digital Video Broadcasting Devices
425#
426# CONFIG_DVB is not set
427
428#
429# Graphics support
430#
431# CONFIG_FB is not set
432
433#
434# Sound
435#
436# CONFIG_SOUND is not set
437
438#
439# USB support
440#
441
442#
443# USB Gadget Support
444#
445# CONFIG_USB_GADGET is not set
446
447#
448# File systems
449#
450CONFIG_EXT2_FS=y
451# CONFIG_EXT2_FS_XATTR is not set
452# CONFIG_EXT3_FS is not set
453# CONFIG_JBD is not set
454# CONFIG_REISERFS_FS is not set
455# CONFIG_JFS_FS is not set
456# CONFIG_XFS_FS is not set
457# CONFIG_MINIX_FS is not set
458# CONFIG_ROMFS_FS is not set
459# CONFIG_QUOTA is not set
460# CONFIG_AUTOFS_FS is not set
461# CONFIG_AUTOFS4_FS is not set
462
463#
464# CD-ROM/DVD Filesystems
465#
466# CONFIG_ISO9660_FS is not set
467# CONFIG_UDF_FS is not set
468
469#
470# DOS/FAT/NT Filesystems
471#
472# CONFIG_FAT_FS is not set
473# CONFIG_NTFS_FS is not set
474
475#
476# Pseudo filesystems
477#
478CONFIG_PROC_FS=y
479CONFIG_PROC_KCORE=y
480# CONFIG_DEVFS_FS is not set
481CONFIG_TMPFS=y
482# CONFIG_HUGETLB_PAGE is not set
483CONFIG_RAMFS=y
484
485#
486# Miscellaneous filesystems
487#
488# CONFIG_ADFS_FS is not set
489# CONFIG_AFFS_FS is not set
490# CONFIG_HFS_FS is not set
491# CONFIG_HFSPLUS_FS is not set
492# CONFIG_BEFS_FS is not set
493# CONFIG_BFS_FS is not set
494# CONFIG_EFS_FS is not set
495# CONFIG_CRAMFS is not set
496# CONFIG_VXFS_FS is not set
497# CONFIG_HPFS_FS is not set
498# CONFIG_QNX4FS_FS is not set
499# CONFIG_SYSV_FS is not set
500# CONFIG_UFS_FS is not set
501
502#
503# Network File Systems
504#
505CONFIG_NFS_FS=y
506# CONFIG_NFS_V3 is not set
507# CONFIG_NFS_V4 is not set
508# CONFIG_NFS_DIRECTIO is not set
509# CONFIG_NFSD is not set
510CONFIG_ROOT_NFS=y
511CONFIG_LOCKD=y
512# CONFIG_EXPORTFS is not set
513CONFIG_SUNRPC=y
514# CONFIG_RPCSEC_GSS_KRB5 is not set
515# CONFIG_SMB_FS is not set
516# CONFIG_CIFS is not set
517# CONFIG_NCP_FS is not set
518# CONFIG_CODA_FS is not set
519# CONFIG_INTERMEZZO_FS is not set
520# CONFIG_AFS_FS is not set
521
522#
523# Partition Types
524#
525# CONFIG_PARTITION_ADVANCED is not set
526CONFIG_MSDOS_PARTITION=y
527
528#
529# Native Language Support
530#
531# CONFIG_NLS is not set
532
533#
534# IBM 40x options
535#
536
537#
538# Library routines
539#
540# CONFIG_CRC32 is not set
541
542#
543# Kernel hacking
544#
545# CONFIG_DEBUG_KERNEL is not set
546# CONFIG_SERIAL_TEXT_DEBUG is not set
547CONFIG_OCP=y
548
549#
550# Security options
551#
552# CONFIG_SECURITY is not set
553
554#
555# Cryptographic options
556#
557# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/redwood6_defconfig b/arch/ppc/configs/redwood6_defconfig
new file mode 100644
index 000000000000..5752845c2601
--- /dev/null
+++ b/arch/ppc/configs/redwood6_defconfig
@@ -0,0 +1,535 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7CONFIG_PPC=y
8CONFIG_PPC32=y
9CONFIG_GENERIC_NVRAM=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16# CONFIG_STANDALONE is not set
17CONFIG_BROKEN_ON_SMP=y
18
19#
20# General setup
21#
22# CONFIG_SWAP is not set
23CONFIG_SYSVIPC=y
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26CONFIG_LOG_BUF_SHIFT=14
27# CONFIG_HOTPLUG is not set
28# CONFIG_IKCONFIG is not set
29CONFIG_EMBEDDED=y
30# CONFIG_KALLSYMS is not set
31CONFIG_FUTEX=y
32# CONFIG_EPOLL is not set
33CONFIG_IOSCHED_NOOP=y
34CONFIG_IOSCHED_AS=y
35CONFIG_IOSCHED_DEADLINE=y
36# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
37
38#
39# Loadable module support
40#
41CONFIG_MODULES=y
42# CONFIG_MODULE_UNLOAD is not set
43CONFIG_OBSOLETE_MODPARM=y
44# CONFIG_MODVERSIONS is not set
45CONFIG_KMOD=y
46
47#
48# Processor
49#
50# CONFIG_6xx is not set
51CONFIG_40x=y
52# CONFIG_44x is not set
53# CONFIG_POWER3 is not set
54# CONFIG_POWER4 is not set
55# CONFIG_8xx is not set
56# CONFIG_MATH_EMULATION is not set
57# CONFIG_CPU_FREQ is not set
58CONFIG_4xx=y
59
60#
61# IBM 4xx options
62#
63# CONFIG_ASH is not set
64# CONFIG_CPCI405 is not set
65# CONFIG_EP405 is not set
66# CONFIG_OAK is not set
67# CONFIG_REDWOOD_5 is not set
68CONFIG_REDWOOD_6=y
69# CONFIG_SYCAMORE is not set
70# CONFIG_WALNUT is not set
71CONFIG_IBM405_ERR77=y
72CONFIG_IBM405_ERR51=y
73CONFIG_IBM_OCP=y
74CONFIG_PPC_OCP=y
75CONFIG_STB03xxx=y
76CONFIG_IBM_OPENBIOS=y
77# CONFIG_PM is not set
78CONFIG_UART0_TTYS0=y
79# CONFIG_UART0_TTYS1 is not set
80# CONFIG_SERIAL_SICC is not set
81CONFIG_NOT_COHERENT_CACHE=y
82
83#
84# Platform options
85#
86# CONFIG_PC_KEYBOARD is not set
87# CONFIG_SMP is not set
88# CONFIG_PREEMPT is not set
89# CONFIG_HIGHMEM is not set
90CONFIG_KERNEL_ELF=y
91CONFIG_BINFMT_ELF=y
92# CONFIG_BINFMT_MISC is not set
93CONFIG_CMDLINE_BOOL=y
94CONFIG_CMDLINE="ip=on"
95
96#
97# Bus options
98#
99# CONFIG_PCI is not set
100# CONFIG_PCI_DOMAINS is not set
101
102#
103# Advanced setup
104#
105# CONFIG_ADVANCED_OPTIONS is not set
106
107#
108# Default settings for advanced configuration options are used
109#
110CONFIG_HIGHMEM_START=0xfe000000
111CONFIG_LOWMEM_SIZE=0x30000000
112CONFIG_KERNEL_START=0xc0000000
113CONFIG_TASK_SIZE=0x80000000
114CONFIG_BOOT_LOAD=0x00400000
115
116#
117# Device Drivers
118#
119
120#
121# Generic Driver Options
122#
123
124#
125# Memory Technology Devices (MTD)
126#
127# CONFIG_MTD is not set
128
129#
130# Parallel port support
131#
132# CONFIG_PARPORT is not set
133
134#
135# Plug and Play support
136#
137
138#
139# Block devices
140#
141# CONFIG_BLK_DEV_FD is not set
142CONFIG_BLK_DEV_LOOP=y
143# CONFIG_BLK_DEV_CRYPTOLOOP is not set
144# CONFIG_BLK_DEV_NBD is not set
145CONFIG_BLK_DEV_RAM=y
146CONFIG_BLK_DEV_RAM_SIZE=4096
147CONFIG_BLK_DEV_INITRD=y
148# CONFIG_LBD is not set
149
150#
151# ATA/ATAPI/MFM/RLL support
152#
153# CONFIG_IDE is not set
154
155#
156# SCSI device support
157#
158# CONFIG_SCSI is not set
159
160#
161# Multi-device support (RAID and LVM)
162#
163# CONFIG_MD is not set
164
165#
166# Fusion MPT device support
167#
168
169#
170# IEEE 1394 (FireWire) support
171#
172# CONFIG_IEEE1394 is not set
173
174#
175# I2O device support
176#
177
178#
179# Macintosh device drivers
180#
181
182#
183# Networking support
184#
185CONFIG_NET=y
186
187#
188# Networking options
189#
190# CONFIG_PACKET is not set
191# CONFIG_NETLINK_DEV is not set
192CONFIG_UNIX=y
193# CONFIG_NET_KEY is not set
194CONFIG_INET=y
195CONFIG_IP_MULTICAST=y
196# CONFIG_IP_ADVANCED_ROUTER is not set
197CONFIG_IP_PNP=y
198# CONFIG_IP_PNP_DHCP is not set
199CONFIG_IP_PNP_BOOTP=y
200CONFIG_IP_PNP_RARP=y
201# CONFIG_NET_IPIP is not set
202# CONFIG_NET_IPGRE is not set
203# CONFIG_IP_MROUTE is not set
204# CONFIG_ARPD is not set
205CONFIG_SYN_COOKIES=y
206# CONFIG_INET_AH is not set
207# CONFIG_INET_ESP is not set
208# CONFIG_INET_IPCOMP is not set
209# CONFIG_IPV6 is not set
210# CONFIG_DECNET is not set
211# CONFIG_BRIDGE is not set
212# CONFIG_NETFILTER is not set
213
214#
215# SCTP Configuration (EXPERIMENTAL)
216#
217# CONFIG_IP_SCTP is not set
218# CONFIG_ATM is not set
219# CONFIG_VLAN_8021Q is not set
220# CONFIG_LLC2 is not set
221# CONFIG_IPX is not set
222# CONFIG_ATALK is not set
223# CONFIG_X25 is not set
224# CONFIG_LAPB is not set
225# CONFIG_NET_DIVERT is not set
226# CONFIG_ECONET is not set
227# CONFIG_WAN_ROUTER is not set
228# CONFIG_NET_HW_FLOWCONTROL is not set
229
230#
231# QoS and/or fair queueing
232#
233# CONFIG_NET_SCHED is not set
234
235#
236# Network testing
237#
238# CONFIG_NET_PKTGEN is not set
239CONFIG_NETDEVICES=y
240# CONFIG_DUMMY is not set
241# CONFIG_BONDING is not set
242# CONFIG_EQUALIZER is not set
243# CONFIG_TUN is not set
244
245#
246# Ethernet (10 or 100Mbit)
247#
248CONFIG_NET_ETHERNET=y
249CONFIG_MII=y
250# CONFIG_OAKNET is not set
251
252#
253# Ethernet (1000 Mbit)
254#
255
256#
257# Ethernet (10000 Mbit)
258#
259# CONFIG_IBM_EMAC is not set
260# CONFIG_PPP is not set
261# CONFIG_SLIP is not set
262
263#
264# Wireless LAN (non-hamradio)
265#
266# CONFIG_NET_RADIO is not set
267
268#
269# Token Ring devices
270#
271# CONFIG_SHAPER is not set
272# CONFIG_NETCONSOLE is not set
273
274#
275# Wan interfaces
276#
277# CONFIG_WAN is not set
278
279#
280# Amateur Radio support
281#
282# CONFIG_HAMRADIO is not set
283
284#
285# IrDA (infrared) support
286#
287# CONFIG_IRDA is not set
288
289#
290# Bluetooth support
291#
292# CONFIG_BT is not set
293# CONFIG_NETPOLL is not set
294# CONFIG_NET_POLL_CONTROLLER is not set
295
296#
297# ISDN subsystem
298#
299# CONFIG_ISDN is not set
300
301#
302# Telephony Support
303#
304# CONFIG_PHONE is not set
305
306#
307# Input device support
308#
309CONFIG_INPUT=y
310
311#
312# Userland interfaces
313#
314# CONFIG_INPUT_MOUSEDEV is not set
315# CONFIG_INPUT_JOYDEV is not set
316# CONFIG_INPUT_TSDEV is not set
317# CONFIG_INPUT_EVDEV is not set
318# CONFIG_INPUT_EVBUG is not set
319
320#
321# Input I/O drivers
322#
323# CONFIG_GAMEPORT is not set
324CONFIG_SOUND_GAMEPORT=y
325CONFIG_SERIO=y
326# CONFIG_SERIO_I8042 is not set
327# CONFIG_SERIO_SERPORT is not set
328# CONFIG_SERIO_CT82C710 is not set
329
330#
331# Input Device Drivers
332#
333# CONFIG_INPUT_KEYBOARD is not set
334# CONFIG_INPUT_MOUSE is not set
335# CONFIG_INPUT_JOYSTICK is not set
336# CONFIG_INPUT_TOUCHSCREEN is not set
337# CONFIG_INPUT_MISC is not set
338
339#
340# Character devices
341#
342# CONFIG_VT is not set
343# CONFIG_SERIAL_NONSTANDARD is not set
344
345#
346# Serial drivers
347#
348CONFIG_SERIAL_8250=y
349CONFIG_SERIAL_8250_CONSOLE=y
350CONFIG_SERIAL_8250_NR_UARTS=4
351# CONFIG_SERIAL_8250_EXTENDED is not set
352
353#
354# Non-8250 serial port support
355#
356CONFIG_SERIAL_CORE=y
357CONFIG_SERIAL_CORE_CONSOLE=y
358CONFIG_UNIX98_PTYS=y
359CONFIG_LEGACY_PTYS=y
360CONFIG_LEGACY_PTY_COUNT=256
361# CONFIG_QIC02_TAPE is not set
362
363#
364# IPMI
365#
366# CONFIG_IPMI_HANDLER is not set
367
368#
369# Watchdog Cards
370#
371# CONFIG_WATCHDOG is not set
372# CONFIG_NVRAM is not set
373# CONFIG_GEN_RTC is not set
374# CONFIG_DTLK is not set
375# CONFIG_R3964 is not set
376# CONFIG_APPLICOM is not set
377
378#
379# Ftape, the floppy tape device driver
380#
381# CONFIG_FTAPE is not set
382# CONFIG_AGP is not set
383# CONFIG_DRM is not set
384# CONFIG_RAW_DRIVER is not set
385
386#
387# I2C support
388#
389# CONFIG_I2C is not set
390
391#
392# Misc devices
393#
394
395#
396# Multimedia devices
397#
398# CONFIG_VIDEO_DEV is not set
399
400#
401# Digital Video Broadcasting Devices
402#
403# CONFIG_DVB is not set
404
405#
406# Graphics support
407#
408# CONFIG_FB is not set
409
410#
411# Sound
412#
413# CONFIG_SOUND is not set
414
415#
416# USB support
417#
418
419#
420# USB Gadget Support
421#
422# CONFIG_USB_GADGET is not set
423
424#
425# File systems
426#
427CONFIG_EXT2_FS=y
428# CONFIG_EXT2_FS_XATTR is not set
429# CONFIG_EXT3_FS is not set
430# CONFIG_JBD is not set
431# CONFIG_REISERFS_FS is not set
432# CONFIG_JFS_FS is not set
433# CONFIG_XFS_FS is not set
434# CONFIG_MINIX_FS is not set
435# CONFIG_ROMFS_FS is not set
436# CONFIG_QUOTA is not set
437# CONFIG_AUTOFS_FS is not set
438# CONFIG_AUTOFS4_FS is not set
439
440#
441# CD-ROM/DVD Filesystems
442#
443# CONFIG_ISO9660_FS is not set
444# CONFIG_UDF_FS is not set
445
446#
447# DOS/FAT/NT Filesystems
448#
449# CONFIG_FAT_FS is not set
450# CONFIG_NTFS_FS is not set
451
452#
453# Pseudo filesystems
454#
455CONFIG_PROC_FS=y
456CONFIG_PROC_KCORE=y
457# CONFIG_DEVFS_FS is not set
458# CONFIG_DEVPTS_FS_XATTR is not set
459CONFIG_TMPFS=y
460# CONFIG_HUGETLB_PAGE is not set
461CONFIG_RAMFS=y
462
463#
464# Miscellaneous filesystems
465#
466# CONFIG_ADFS_FS is not set
467# CONFIG_AFFS_FS is not set
468# CONFIG_HFS_FS is not set
469# CONFIG_HFSPLUS_FS is not set
470# CONFIG_BEFS_FS is not set
471# CONFIG_BFS_FS is not set
472# CONFIG_EFS_FS is not set
473# CONFIG_CRAMFS is not set
474# CONFIG_VXFS_FS is not set
475# CONFIG_HPFS_FS is not set
476# CONFIG_QNX4FS_FS is not set
477# CONFIG_SYSV_FS is not set
478# CONFIG_UFS_FS is not set
479
480#
481# Network File Systems
482#
483CONFIG_NFS_FS=y
484# CONFIG_NFS_V3 is not set
485# CONFIG_NFS_V4 is not set
486# CONFIG_NFS_DIRECTIO is not set
487# CONFIG_NFSD is not set
488CONFIG_ROOT_NFS=y
489CONFIG_LOCKD=y
490# CONFIG_EXPORTFS is not set
491CONFIG_SUNRPC=y
492# CONFIG_RPCSEC_GSS_KRB5 is not set
493# CONFIG_SMB_FS is not set
494# CONFIG_CIFS is not set
495# CONFIG_NCP_FS is not set
496# CONFIG_CODA_FS is not set
497# CONFIG_INTERMEZZO_FS is not set
498# CONFIG_AFS_FS is not set
499
500#
501# Partition Types
502#
503# CONFIG_PARTITION_ADVANCED is not set
504CONFIG_MSDOS_PARTITION=y
505
506#
507# Native Language Support
508#
509# CONFIG_NLS is not set
510
511#
512# IBM 40x options
513#
514
515#
516# Library routines
517#
518# CONFIG_CRC32 is not set
519
520#
521# Kernel hacking
522#
523# CONFIG_DEBUG_KERNEL is not set
524# CONFIG_SERIAL_TEXT_DEBUG is not set
525CONFIG_OCP=y
526
527#
528# Security options
529#
530# CONFIG_SECURITY is not set
531
532#
533# Cryptographic options
534#
535# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/redwood_defconfig b/arch/ppc/configs/redwood_defconfig
new file mode 100644
index 000000000000..4aa348dcf22c
--- /dev/null
+++ b/arch/ppc/configs/redwood_defconfig
@@ -0,0 +1,540 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7CONFIG_PPC=y
8CONFIG_PPC32=y
9
10#
11# Code maturity level options
12#
13CONFIG_EXPERIMENTAL=y
14CONFIG_CLEAN_COMPILE=y
15# CONFIG_STANDALONE is not set
16CONFIG_BROKEN_ON_SMP=y
17
18#
19# General setup
20#
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_BSD_PROCESS_ACCT is not set
24CONFIG_SYSCTL=y
25CONFIG_LOG_BUF_SHIFT=14
26# CONFIG_IKCONFIG is not set
27CONFIG_EMBEDDED=y
28# CONFIG_KALLSYMS is not set
29CONFIG_FUTEX=y
30# CONFIG_EPOLL is not set
31CONFIG_IOSCHED_NOOP=y
32CONFIG_IOSCHED_AS=y
33CONFIG_IOSCHED_DEADLINE=y
34
35#
36# Loadable module support
37#
38CONFIG_MODULES=y
39# CONFIG_MODULE_UNLOAD is not set
40CONFIG_OBSOLETE_MODPARM=y
41# CONFIG_MODVERSIONS is not set
42CONFIG_KMOD=y
43
44#
45# Processor
46#
47# CONFIG_6xx is not set
48CONFIG_40x=y
49# CONFIG_44x is not set
50# CONFIG_POWER3 is not set
51# CONFIG_POWER4 is not set
52# CONFIG_8xx is not set
53# CONFIG_MATH_EMULATION is not set
54# CONFIG_CPU_FREQ is not set
55CONFIG_4xx=y
56
57#
58# IBM 4xx options
59#
60# CONFIG_ASH is not set
61# CONFIG_BEECH is not set
62# CONFIG_CEDAR is not set
63# CONFIG_CPCI405 is not set
64# CONFIG_EP405 is not set
65# CONFIG_OAK is not set
66CONFIG_REDWOOD_4=y
67# CONFIG_REDWOOD_5 is not set
68# CONFIG_REDWOOD_6 is not set
69# CONFIG_SYCAMORE is not set
70# CONFIG_TIVO is not set
71# CONFIG_WALNUT is not set
72CONFIG_IBM405_ERR77=y
73CONFIG_IBM405_ERR51=y
74CONFIG_IBM_OCP=y
75CONFIG_STB03xxx=y
76CONFIG_IBM_OPENBIOS=y
77# CONFIG_405_DMA is not set
78# CONFIG_PM is not set
79CONFIG_UART0_TTYS0=y
80# CONFIG_UART0_TTYS1 is not set
81# CONFIG_SERIAL_SICC is not set
82CONFIG_NOT_COHERENT_CACHE=y
83
84#
85# Platform options
86#
87# CONFIG_PC_KEYBOARD is not set
88# CONFIG_SMP is not set
89# CONFIG_PREEMPT is not set
90# CONFIG_HIGHMEM is not set
91CONFIG_KERNEL_ELF=y
92CONFIG_BINFMT_ELF=y
93# CONFIG_BINFMT_MISC is not set
94# CONFIG_CMDLINE_BOOL is not set
95
96#
97# Bus options
98#
99# CONFIG_PCI is not set
100# CONFIG_PCI_DOMAINS is not set
101# CONFIG_HOTPLUG is not set
102
103#
104# Parallel port support
105#
106# CONFIG_PARPORT is not set
107
108#
109# Advanced setup
110#
111# CONFIG_ADVANCED_OPTIONS is not set
112
113#
114# Default settings for advanced configuration options are used
115#
116CONFIG_HIGHMEM_START=0xfe000000
117CONFIG_LOWMEM_SIZE=0x30000000
118CONFIG_KERNEL_START=0xc0000000
119CONFIG_TASK_SIZE=0x80000000
120CONFIG_BOOT_LOAD=0x00400000
121
122#
123# Generic Driver Options
124#
125
126#
127# Memory Technology Devices (MTD)
128#
129# CONFIG_MTD is not set
130
131#
132# Plug and Play support
133#
134# CONFIG_PNP is not set
135
136#
137# Block devices
138#
139CONFIG_BLK_DEV_LOOP=y
140# CONFIG_BLK_DEV_CRYPTOLOOP is not set
141# CONFIG_BLK_DEV_NBD is not set
142CONFIG_BLK_DEV_RAM=y
143CONFIG_BLK_DEV_RAM_SIZE=4096
144CONFIG_BLK_DEV_INITRD=y
145# CONFIG_LBD is not set
146
147#
148# Multi-device support (RAID and LVM)
149#
150# CONFIG_MD is not set
151
152#
153# ATA/ATAPI/MFM/RLL support
154#
155# CONFIG_IDE is not set
156
157#
158# SCSI device support
159#
160# CONFIG_SCSI is not set
161
162#
163# Fusion MPT device support
164#
165
166#
167# I2O device support
168#
169
170#
171# Networking support
172#
173CONFIG_NET=y
174
175#
176# Networking options
177#
178# CONFIG_PACKET is not set
179# CONFIG_NETLINK_DEV is not set
180CONFIG_UNIX=y
181# CONFIG_NET_KEY is not set
182CONFIG_INET=y
183CONFIG_IP_MULTICAST=y
184# CONFIG_IP_ADVANCED_ROUTER is not set
185CONFIG_IP_PNP=y
186CONFIG_IP_PNP_DHCP=y
187CONFIG_IP_PNP_BOOTP=y
188CONFIG_IP_PNP_RARP=y
189# CONFIG_NET_IPIP is not set
190# CONFIG_NET_IPGRE is not set
191# CONFIG_IP_MROUTE is not set
192# CONFIG_ARPD is not set
193# CONFIG_INET_ECN is not set
194CONFIG_SYN_COOKIES=y
195# CONFIG_INET_AH is not set
196# CONFIG_INET_ESP is not set
197# CONFIG_INET_IPCOMP is not set
198# CONFIG_IPV6 is not set
199# CONFIG_DECNET is not set
200# CONFIG_BRIDGE is not set
201# CONFIG_NETFILTER is not set
202
203#
204# SCTP Configuration (EXPERIMENTAL)
205#
206CONFIG_IPV6_SCTP__=y
207# CONFIG_IP_SCTP is not set
208# CONFIG_ATM is not set
209# CONFIG_VLAN_8021Q is not set
210# CONFIG_LLC2 is not set
211# CONFIG_IPX is not set
212# CONFIG_ATALK is not set
213# CONFIG_X25 is not set
214# CONFIG_LAPB is not set
215# CONFIG_NET_DIVERT is not set
216# CONFIG_ECONET is not set
217# CONFIG_WAN_ROUTER is not set
218# CONFIG_NET_HW_FLOWCONTROL is not set
219
220#
221# QoS and/or fair queueing
222#
223# CONFIG_NET_SCHED is not set
224
225#
226# Network testing
227#
228# CONFIG_NET_PKTGEN is not set
229CONFIG_NETDEVICES=y
230# CONFIG_DUMMY is not set
231# CONFIG_BONDING is not set
232# CONFIG_EQUALIZER is not set
233# CONFIG_TUN is not set
234
235#
236# Ethernet (10 or 100Mbit)
237#
238CONFIG_NET_ETHERNET=y
239CONFIG_MII=y
240CONFIG_OAKNET=y
241
242#
243# Ethernet (1000 Mbit)
244#
245
246#
247# Ethernet (10000 Mbit)
248#
249# CONFIG_PPP is not set
250# CONFIG_SLIP is not set
251
252#
253# Wireless LAN (non-hamradio)
254#
255# CONFIG_NET_RADIO is not set
256
257#
258# Token Ring devices
259#
260# CONFIG_SHAPER is not set
261
262#
263# Wan interfaces
264#
265# CONFIG_WAN is not set
266
267#
268# Amateur Radio support
269#
270# CONFIG_HAMRADIO is not set
271
272#
273# IrDA (infrared) support
274#
275# CONFIG_IRDA is not set
276
277#
278# Bluetooth support
279#
280# CONFIG_BT is not set
281
282#
283# ISDN subsystem
284#
285# CONFIG_ISDN_BOOL is not set
286
287#
288# Graphics support
289#
290# CONFIG_FB is not set
291
292#
293# Input device support
294#
295CONFIG_INPUT=y
296
297#
298# Userland interfaces
299#
300# CONFIG_INPUT_MOUSEDEV is not set
301# CONFIG_INPUT_JOYDEV is not set
302# CONFIG_INPUT_TSDEV is not set
303# CONFIG_INPUT_EVDEV is not set
304# CONFIG_INPUT_EVBUG is not set
305
306#
307# Input I/O drivers
308#
309# CONFIG_GAMEPORT is not set
310CONFIG_SOUND_GAMEPORT=y
311CONFIG_SERIO=y
312# CONFIG_SERIO_I8042 is not set
313# CONFIG_SERIO_SERPORT is not set
314# CONFIG_SERIO_CT82C710 is not set
315
316#
317# Input Device Drivers
318#
319# CONFIG_INPUT_KEYBOARD is not set
320# CONFIG_INPUT_MOUSE is not set
321# CONFIG_INPUT_JOYSTICK is not set
322# CONFIG_INPUT_TOUCHSCREEN is not set
323# CONFIG_INPUT_MISC is not set
324
325#
326# Macintosh device drivers
327#
328
329#
330# Character devices
331#
332# CONFIG_VT is not set
333# CONFIG_SERIAL_NONSTANDARD is not set
334
335#
336# Serial drivers
337#
338CONFIG_SERIAL_8250=y
339CONFIG_SERIAL_8250_CONSOLE=y
340CONFIG_SERIAL_8250_NR_UARTS=4
341# CONFIG_SERIAL_8250_EXTENDED is not set
342
343#
344# Non-8250 serial port support
345#
346CONFIG_SERIAL_CORE=y
347CONFIG_SERIAL_CORE_CONSOLE=y
348# CONFIG_UNIX98_PTYS is not set
349
350#
351# I2C support
352#
353CONFIG_I2C=y
354# CONFIG_I2C_CHARDEV is not set
355
356#
357# I2C Algorithms
358#
359# CONFIG_I2C_ALGOBIT is not set
360# CONFIG_I2C_ALGOPCF is not set
361
362#
363# I2C Hardware Bus support
364#
365# CONFIG_I2C_AMD756 is not set
366# CONFIG_I2C_AMD8111 is not set
367CONFIG_I2C_IBM_IIC=y
368
369#
370# I2C Hardware Sensors Chip support
371#
372# CONFIG_I2C_SENSOR is not set
373# CONFIG_SENSORS_ADM1021 is not set
374# CONFIG_SENSORS_EEPROM is not set
375# CONFIG_SENSORS_IT87 is not set
376# CONFIG_SENSORS_LM75 is not set
377# CONFIG_SENSORS_LM78 is not set
378# CONFIG_SENSORS_LM85 is not set
379# CONFIG_SENSORS_VIA686A is not set
380# CONFIG_SENSORS_W83781D is not set
381
382#
383# Mice
384#
385# CONFIG_BUSMOUSE is not set
386# CONFIG_QIC02_TAPE is not set
387
388#
389# IPMI
390#
391# CONFIG_IPMI_HANDLER is not set
392
393#
394# Watchdog Cards
395#
396# CONFIG_WATCHDOG is not set
397# CONFIG_NVRAM is not set
398CONFIG_GEN_RTC=y
399# CONFIG_GEN_RTC_X is not set
400# CONFIG_DTLK is not set
401# CONFIG_R3964 is not set
402# CONFIG_APPLICOM is not set
403
404#
405# Ftape, the floppy tape device driver
406#
407# CONFIG_FTAPE is not set
408# CONFIG_AGP is not set
409# CONFIG_DRM is not set
410# CONFIG_RAW_DRIVER is not set
411
412#
413# Multimedia devices
414#
415# CONFIG_VIDEO_DEV is not set
416
417#
418# Digital Video Broadcasting Devices
419#
420# CONFIG_DVB is not set
421
422#
423# File systems
424#
425CONFIG_EXT2_FS=y
426# CONFIG_EXT2_FS_XATTR is not set
427CONFIG_EXT3_FS=y
428CONFIG_EXT3_FS_XATTR=y
429# CONFIG_EXT3_FS_POSIX_ACL is not set
430# CONFIG_EXT3_FS_SECURITY is not set
431CONFIG_JBD=y
432# CONFIG_JBD_DEBUG is not set
433CONFIG_FS_MBCACHE=y
434# CONFIG_REISERFS_FS is not set
435# CONFIG_JFS_FS is not set
436# CONFIG_XFS_FS is not set
437# CONFIG_MINIX_FS is not set
438# CONFIG_ROMFS_FS is not set
439# CONFIG_QUOTA is not set
440# CONFIG_AUTOFS_FS is not set
441# CONFIG_AUTOFS4_FS is not set
442
443#
444# CD-ROM/DVD Filesystems
445#
446# CONFIG_ISO9660_FS is not set
447# CONFIG_UDF_FS is not set
448
449#
450# DOS/FAT/NT Filesystems
451#
452# CONFIG_FAT_FS is not set
453# CONFIG_NTFS_FS is not set
454
455#
456# Pseudo filesystems
457#
458CONFIG_PROC_FS=y
459CONFIG_PROC_KCORE=y
460# CONFIG_DEVFS_FS is not set
461CONFIG_TMPFS=y
462# CONFIG_HUGETLB_PAGE is not set
463CONFIG_RAMFS=y
464
465#
466# Miscellaneous filesystems
467#
468# CONFIG_ADFS_FS is not set
469# CONFIG_AFFS_FS is not set
470# CONFIG_HFS_FS is not set
471# CONFIG_BEFS_FS is not set
472# CONFIG_BFS_FS is not set
473# CONFIG_EFS_FS is not set
474# CONFIG_CRAMFS is not set
475# CONFIG_VXFS_FS is not set
476# CONFIG_HPFS_FS is not set
477# CONFIG_QNX4FS_FS is not set
478# CONFIG_SYSV_FS is not set
479# CONFIG_UFS_FS is not set
480
481#
482# Network File Systems
483#
484CONFIG_NFS_FS=y
485# CONFIG_NFS_V3 is not set
486# CONFIG_NFS_V4 is not set
487# CONFIG_NFSD is not set
488CONFIG_ROOT_NFS=y
489CONFIG_LOCKD=y
490# CONFIG_EXPORTFS is not set
491CONFIG_SUNRPC=y
492# CONFIG_SUNRPC_GSS is not set
493# CONFIG_SMB_FS is not set
494# CONFIG_CIFS is not set
495# CONFIG_NCP_FS is not set
496# CONFIG_CODA_FS is not set
497# CONFIG_INTERMEZZO_FS is not set
498# CONFIG_AFS_FS is not set
499
500#
501# Partition Types
502#
503# CONFIG_PARTITION_ADVANCED is not set
504CONFIG_MSDOS_PARTITION=y
505
506#
507# Sound
508#
509# CONFIG_SOUND is not set
510
511#
512# IBM 40x options
513#
514
515#
516# USB support
517#
518# CONFIG_USB_GADGET is not set
519
520#
521# Library routines
522#
523CONFIG_CRC32=y
524
525#
526# Kernel hacking
527#
528# CONFIG_DEBUG_KERNEL is not set
529CONFIG_SERIAL_TEXT_DEBUG=y
530CONFIG_OCP=y
531
532#
533# Security options
534#
535# CONFIG_SECURITY is not set
536
537#
538# Cryptographic options
539#
540# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/rpx8260_defconfig b/arch/ppc/configs/rpx8260_defconfig
new file mode 100644
index 000000000000..a9c4544ae560
--- /dev/null
+++ b/arch/ppc/configs/rpx8260_defconfig
@@ -0,0 +1,555 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7CONFIG_PPC=y
8CONFIG_PPC32=y
9CONFIG_GENERIC_NVRAM=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_STANDALONE=y
17CONFIG_BROKEN_ON_SMP=y
18
19#
20# General setup
21#
22# CONFIG_SWAP is not set
23CONFIG_SYSVIPC=y
24# CONFIG_POSIX_MQUEUE is not set
25# CONFIG_BSD_PROCESS_ACCT is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=14
29# CONFIG_HOTPLUG is not set
30# CONFIG_IKCONFIG is not set
31CONFIG_EMBEDDED=y
32# CONFIG_KALLSYMS is not set
33CONFIG_FUTEX=y
34# CONFIG_EPOLL is not set
35CONFIG_IOSCHED_NOOP=y
36CONFIG_IOSCHED_AS=y
37CONFIG_IOSCHED_DEADLINE=y
38CONFIG_IOSCHED_CFQ=y
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
40
41#
42# Loadable module support
43#
44# CONFIG_MODULES is not set
45
46#
47# Processor
48#
49CONFIG_6xx=y
50# CONFIG_40x is not set
51# CONFIG_44x is not set
52# CONFIG_POWER3 is not set
53# CONFIG_POWER4 is not set
54# CONFIG_8xx is not set
55# CONFIG_E500 is not set
56# CONFIG_CPU_FREQ is not set
57CONFIG_EMBEDDEDBOOT=y
58CONFIG_PPC_STD_MMU=y
59
60#
61# Platform options
62#
63# CONFIG_PPC_MULTIPLATFORM is not set
64# CONFIG_APUS is not set
65# CONFIG_WILLOW is not set
66# CONFIG_PCORE is not set
67# CONFIG_POWERPMC250 is not set
68# CONFIG_EV64260 is not set
69# CONFIG_SPRUCE is not set
70# CONFIG_LOPEC is not set
71# CONFIG_MCPN765 is not set
72# CONFIG_MVME5100 is not set
73# CONFIG_PPLUS is not set
74# CONFIG_PRPMC750 is not set
75# CONFIG_PRPMC800 is not set
76# CONFIG_SANDPOINT is not set
77# CONFIG_ADIR is not set
78# CONFIG_K2 is not set
79# CONFIG_PAL4 is not set
80# CONFIG_GEMINI is not set
81# CONFIG_EST8260 is not set
82# CONFIG_SBC82xx is not set
83# CONFIG_SBS8260 is not set
84CONFIG_RPX8260=y
85# CONFIG_TQM8260 is not set
86# CONFIG_ADS8272 is not set
87CONFIG_8260=y
88CONFIG_CPM2=y
89# CONFIG_PC_KEYBOARD is not set
90# CONFIG_SMP is not set
91# CONFIG_PREEMPT is not set
92# CONFIG_HIGHMEM is not set
93CONFIG_KERNEL_ELF=y
94CONFIG_BINFMT_ELF=y
95# CONFIG_BINFMT_MISC is not set
96# CONFIG_CMDLINE_BOOL is not set
97
98#
99# Bus options
100#
101# CONFIG_PCI is not set
102# CONFIG_PCI_DOMAINS is not set
103
104#
105# Advanced setup
106#
107# CONFIG_ADVANCED_OPTIONS is not set
108
109#
110# Default settings for advanced configuration options are used
111#
112CONFIG_HIGHMEM_START=0xfe000000
113CONFIG_LOWMEM_SIZE=0x30000000
114CONFIG_KERNEL_START=0xc0000000
115CONFIG_TASK_SIZE=0x80000000
116CONFIG_BOOT_LOAD=0x00400000
117
118#
119# Device Drivers
120#
121
122#
123# Generic Driver Options
124#
125CONFIG_PREVENT_FIRMWARE_BUILD=y
126
127#
128# Memory Technology Devices (MTD)
129#
130# CONFIG_MTD is not set
131
132#
133# Parallel port support
134#
135# CONFIG_PARPORT is not set
136
137#
138# Plug and Play support
139#
140
141#
142# Block devices
143#
144# CONFIG_BLK_DEV_FD is not set
145CONFIG_BLK_DEV_LOOP=y
146# CONFIG_BLK_DEV_CRYPTOLOOP is not set
147# CONFIG_BLK_DEV_NBD is not set
148CONFIG_BLK_DEV_RAM=y
149CONFIG_BLK_DEV_RAM_SIZE=4096
150CONFIG_BLK_DEV_INITRD=y
151# CONFIG_LBD is not set
152
153#
154# ATA/ATAPI/MFM/RLL support
155#
156# CONFIG_IDE is not set
157
158#
159# SCSI device support
160#
161# CONFIG_SCSI is not set
162
163#
164# Multi-device support (RAID and LVM)
165#
166# CONFIG_MD is not set
167
168#
169# Fusion MPT device support
170#
171
172#
173# IEEE 1394 (FireWire) support
174#
175# CONFIG_IEEE1394 is not set
176
177#
178# I2O device support
179#
180
181#
182# Macintosh device drivers
183#
184
185#
186# Networking support
187#
188CONFIG_NET=y
189
190#
191# Networking options
192#
193CONFIG_PACKET=y
194# CONFIG_PACKET_MMAP is not set
195# CONFIG_NETLINK_DEV is not set
196CONFIG_UNIX=y
197# CONFIG_NET_KEY is not set
198CONFIG_INET=y
199CONFIG_IP_MULTICAST=y
200# CONFIG_IP_ADVANCED_ROUTER is not set
201CONFIG_IP_PNP=y
202# CONFIG_IP_PNP_DHCP is not set
203CONFIG_IP_PNP_BOOTP=y
204# CONFIG_IP_PNP_RARP is not set
205# CONFIG_NET_IPIP is not set
206# CONFIG_NET_IPGRE is not set
207# CONFIG_IP_MROUTE is not set
208# CONFIG_ARPD is not set
209CONFIG_SYN_COOKIES=y
210# CONFIG_INET_AH is not set
211# CONFIG_INET_ESP is not set
212# CONFIG_INET_IPCOMP is not set
213# CONFIG_IPV6 is not set
214# CONFIG_NETFILTER is not set
215
216#
217# SCTP Configuration (EXPERIMENTAL)
218#
219# CONFIG_IP_SCTP is not set
220# CONFIG_ATM is not set
221# CONFIG_BRIDGE is not set
222# CONFIG_VLAN_8021Q is not set
223# CONFIG_DECNET is not set
224# CONFIG_LLC2 is not set
225# CONFIG_IPX is not set
226# CONFIG_ATALK is not set
227# CONFIG_X25 is not set
228# CONFIG_LAPB is not set
229# CONFIG_NET_DIVERT is not set
230# CONFIG_ECONET is not set
231# CONFIG_WAN_ROUTER is not set
232# CONFIG_NET_HW_FLOWCONTROL is not set
233
234#
235# QoS and/or fair queueing
236#
237# CONFIG_NET_SCHED is not set
238# CONFIG_NET_CLS_ROUTE is not set
239
240#
241# Network testing
242#
243# CONFIG_NET_PKTGEN is not set
244# CONFIG_NETPOLL is not set
245# CONFIG_NET_POLL_CONTROLLER is not set
246# CONFIG_HAMRADIO is not set
247# CONFIG_IRDA is not set
248# CONFIG_BT is not set
249CONFIG_NETDEVICES=y
250# CONFIG_DUMMY is not set
251# CONFIG_BONDING is not set
252# CONFIG_EQUALIZER is not set
253# CONFIG_TUN is not set
254
255#
256# Ethernet (10 or 100Mbit)
257#
258CONFIG_NET_ETHERNET=y
259# CONFIG_MII is not set
260# CONFIG_OAKNET is not set
261
262#
263# Ethernet (1000 Mbit)
264#
265
266#
267# Ethernet (10000 Mbit)
268#
269
270#
271# Token Ring devices
272#
273
274#
275# Wireless LAN (non-hamradio)
276#
277# CONFIG_NET_RADIO is not set
278
279#
280# Wan interfaces
281#
282# CONFIG_WAN is not set
283# CONFIG_PPP is not set
284# CONFIG_SLIP is not set
285# CONFIG_SHAPER is not set
286# CONFIG_NETCONSOLE is not set
287
288#
289# ISDN subsystem
290#
291# CONFIG_ISDN is not set
292
293#
294# Telephony Support
295#
296# CONFIG_PHONE is not set
297
298#
299# Input device support
300#
301# CONFIG_INPUT is not set
302
303#
304# Userland interfaces
305#
306
307#
308# Input I/O drivers
309#
310# CONFIG_GAMEPORT is not set
311CONFIG_SOUND_GAMEPORT=y
312# CONFIG_SERIO is not set
313# CONFIG_SERIO_I8042 is not set
314
315#
316# Input Device Drivers
317#
318
319#
320# Character devices
321#
322# CONFIG_VT is not set
323# CONFIG_SERIAL_NONSTANDARD is not set
324
325#
326# Serial drivers
327#
328# CONFIG_SERIAL_8250 is not set
329
330#
331# Non-8250 serial port support
332#
333CONFIG_SERIAL_CORE=y
334CONFIG_SERIAL_CORE_CONSOLE=y
335CONFIG_SERIAL_CPM=y
336CONFIG_SERIAL_CPM_CONSOLE=y
337# CONFIG_SERIAL_CPM_SCC1 is not set
338# CONFIG_SERIAL_CPM_SCC2 is not set
339# CONFIG_SERIAL_CPM_SCC3 is not set
340# CONFIG_SERIAL_CPM_SCC4 is not set
341CONFIG_SERIAL_CPM_SMC1=y
342# CONFIG_SERIAL_CPM_SMC2 is not set
343CONFIG_UNIX98_PTYS=y
344CONFIG_LEGACY_PTYS=y
345CONFIG_LEGACY_PTY_COUNT=256
346# CONFIG_QIC02_TAPE is not set
347
348#
349# IPMI
350#
351# CONFIG_IPMI_HANDLER is not set
352
353#
354# Watchdog Cards
355#
356# CONFIG_WATCHDOG is not set
357# CONFIG_NVRAM is not set
358# CONFIG_GEN_RTC is not set
359# CONFIG_DTLK is not set
360# CONFIG_R3964 is not set
361# CONFIG_APPLICOM is not set
362
363#
364# Ftape, the floppy tape device driver
365#
366# CONFIG_FTAPE is not set
367# CONFIG_AGP is not set
368# CONFIG_DRM is not set
369# CONFIG_RAW_DRIVER is not set
370
371#
372# I2C support
373#
374# CONFIG_I2C is not set
375
376#
377# Dallas's 1-wire bus
378#
379# CONFIG_W1 is not set
380
381#
382# Misc devices
383#
384
385#
386# Multimedia devices
387#
388# CONFIG_VIDEO_DEV is not set
389
390#
391# Digital Video Broadcasting Devices
392#
393# CONFIG_DVB is not set
394
395#
396# Graphics support
397#
398# CONFIG_FB is not set
399
400#
401# Sound
402#
403# CONFIG_SOUND is not set
404
405#
406# USB support
407#
408
409#
410# USB Gadget Support
411#
412# CONFIG_USB_GADGET is not set
413
414#
415# File systems
416#
417CONFIG_EXT2_FS=y
418# CONFIG_EXT2_FS_XATTR is not set
419CONFIG_EXT3_FS=y
420CONFIG_EXT3_FS_XATTR=y
421# CONFIG_EXT3_FS_POSIX_ACL is not set
422# CONFIG_EXT3_FS_SECURITY is not set
423CONFIG_JBD=y
424# CONFIG_JBD_DEBUG is not set
425CONFIG_FS_MBCACHE=y
426# CONFIG_REISERFS_FS is not set
427# CONFIG_JFS_FS is not set
428# CONFIG_XFS_FS is not set
429# CONFIG_MINIX_FS is not set
430# CONFIG_ROMFS_FS is not set
431# CONFIG_QUOTA is not set
432# CONFIG_AUTOFS_FS is not set
433# CONFIG_AUTOFS4_FS is not set
434
435#
436# CD-ROM/DVD Filesystems
437#
438# CONFIG_ISO9660_FS is not set
439# CONFIG_UDF_FS is not set
440
441#
442# DOS/FAT/NT Filesystems
443#
444# CONFIG_MSDOS_FS is not set
445# CONFIG_VFAT_FS is not set
446# CONFIG_NTFS_FS is not set
447
448#
449# Pseudo filesystems
450#
451CONFIG_PROC_FS=y
452CONFIG_PROC_KCORE=y
453CONFIG_SYSFS=y
454# CONFIG_DEVFS_FS is not set
455# CONFIG_DEVPTS_FS_XATTR is not set
456CONFIG_TMPFS=y
457# CONFIG_HUGETLB_PAGE is not set
458CONFIG_RAMFS=y
459
460#
461# Miscellaneous filesystems
462#
463# CONFIG_ADFS_FS is not set
464# CONFIG_AFFS_FS is not set
465# CONFIG_HFS_FS is not set
466# CONFIG_HFSPLUS_FS is not set
467# CONFIG_BEFS_FS is not set
468# CONFIG_BFS_FS is not set
469# CONFIG_EFS_FS is not set
470# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
471# CONFIG_CRAMFS is not set
472# CONFIG_VXFS_FS is not set
473# CONFIG_HPFS_FS is not set
474# CONFIG_QNX4FS_FS is not set
475# CONFIG_SYSV_FS is not set
476# CONFIG_UFS_FS is not set
477
478#
479# Network File Systems
480#
481CONFIG_NFS_FS=y
482CONFIG_NFS_V3=y
483# CONFIG_NFS_V4 is not set
484# CONFIG_NFS_DIRECTIO is not set
485# CONFIG_NFSD is not set
486CONFIG_ROOT_NFS=y
487CONFIG_LOCKD=y
488CONFIG_LOCKD_V4=y
489# CONFIG_EXPORTFS is not set
490CONFIG_SUNRPC=y
491# CONFIG_RPCSEC_GSS_KRB5 is not set
492# CONFIG_SMB_FS is not set
493# CONFIG_CIFS is not set
494# CONFIG_NCP_FS is not set
495# CONFIG_CODA_FS is not set
496# CONFIG_AFS_FS is not set
497
498#
499# Partition Types
500#
501CONFIG_PARTITION_ADVANCED=y
502# CONFIG_ACORN_PARTITION is not set
503# CONFIG_OSF_PARTITION is not set
504# CONFIG_AMIGA_PARTITION is not set
505# CONFIG_ATARI_PARTITION is not set
506# CONFIG_MAC_PARTITION is not set
507# CONFIG_MSDOS_PARTITION is not set
508# CONFIG_LDM_PARTITION is not set
509# CONFIG_SGI_PARTITION is not set
510# CONFIG_ULTRIX_PARTITION is not set
511# CONFIG_SUN_PARTITION is not set
512# CONFIG_EFI_PARTITION is not set
513
514#
515# Native Language Support
516#
517# CONFIG_NLS is not set
518# CONFIG_SCC_ENET is not set
519CONFIG_FEC_ENET=y
520# CONFIG_USE_MDIO is not set
521
522#
523# CPM2 Options
524#
525# CONFIG_FCC1_ENET is not set
526# CONFIG_FCC2_ENET is not set
527CONFIG_FCC3_ENET=y
528
529#
530# Library routines
531#
532# CONFIG_CRC_CCITT is not set
533# CONFIG_CRC32 is not set
534# CONFIG_LIBCRC32C is not set
535
536#
537# Profiling support
538#
539# CONFIG_PROFILING is not set
540
541#
542# Kernel hacking
543#
544# CONFIG_DEBUG_KERNEL is not set
545# CONFIG_KGDB_CONSOLE is not set
546
547#
548# Security options
549#
550# CONFIG_SECURITY is not set
551
552#
553# Cryptographic options
554#
555# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/rpxcllf_defconfig b/arch/ppc/configs/rpxcllf_defconfig
new file mode 100644
index 000000000000..cf932f13fa86
--- /dev/null
+++ b/arch/ppc/configs/rpxcllf_defconfig
@@ -0,0 +1,582 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.10-rc1
4# Mon Nov 1 16:41:04 2004
5#
6CONFIG_MMU=y
7CONFIG_GENERIC_HARDIRQS=y
8CONFIG_RWSEM_XCHGADD_ALGORITHM=y
9CONFIG_HAVE_DEC_LOCK=y
10CONFIG_PPC=y
11CONFIG_PPC32=y
12CONFIG_GENERIC_NVRAM=y
13
14#
15# Code maturity level options
16#
17CONFIG_EXPERIMENTAL=y
18# CONFIG_CLEAN_COMPILE is not set
19CONFIG_BROKEN=y
20CONFIG_BROKEN_ON_SMP=y
21
22#
23# General setup
24#
25CONFIG_LOCALVERSION=""
26# CONFIG_SWAP is not set
27CONFIG_SYSVIPC=y
28# CONFIG_POSIX_MQUEUE is not set
29# CONFIG_BSD_PROCESS_ACCT is not set
30CONFIG_SYSCTL=y
31# CONFIG_AUDIT is not set
32CONFIG_LOG_BUF_SHIFT=14
33# CONFIG_HOTPLUG is not set
34# CONFIG_KOBJECT_UEVENT is not set
35# CONFIG_IKCONFIG is not set
36CONFIG_EMBEDDED=y
37# CONFIG_KALLSYMS is not set
38# CONFIG_FUTEX is not set
39# CONFIG_EPOLL is not set
40# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
41# CONFIG_SHMEM is not set
42CONFIG_CC_ALIGN_FUNCTIONS=0
43CONFIG_CC_ALIGN_LABELS=0
44CONFIG_CC_ALIGN_LOOPS=0
45CONFIG_CC_ALIGN_JUMPS=0
46CONFIG_TINY_SHMEM=y
47
48#
49# Loadable module support
50#
51# CONFIG_MODULES is not set
52
53#
54# Processor
55#
56# CONFIG_6xx is not set
57# CONFIG_40x is not set
58# CONFIG_44x is not set
59# CONFIG_POWER3 is not set
60# CONFIG_POWER4 is not set
61CONFIG_8xx=y
62# CONFIG_E500 is not set
63CONFIG_MATH_EMULATION=y
64# CONFIG_CPU_FREQ is not set
65CONFIG_EMBEDDEDBOOT=y
66CONFIG_NOT_COHERENT_CACHE=y
67
68#
69# Platform options
70#
71# CONFIG_RPXLITE is not set
72CONFIG_RPXCLASSIC=y
73# CONFIG_BSEIP is not set
74# CONFIG_FADS is not set
75# CONFIG_TQM823L is not set
76# CONFIG_TQM850L is not set
77# CONFIG_TQM855L is not set
78# CONFIG_TQM860L is not set
79# CONFIG_FPS850L is not set
80# CONFIG_SPD823TS is not set
81# CONFIG_IVMS8 is not set
82# CONFIG_IVML24 is not set
83# CONFIG_SM850 is not set
84# CONFIG_HERMES_PRO is not set
85# CONFIG_IP860 is not set
86# CONFIG_LWMON is not set
87# CONFIG_PCU_E is not set
88# CONFIG_CCM is not set
89# CONFIG_LANTEC is not set
90# CONFIG_MBX is not set
91# CONFIG_WINCEPT is not set
92# CONFIG_SMP is not set
93# CONFIG_PREEMPT is not set
94# CONFIG_HIGHMEM is not set
95CONFIG_BINFMT_ELF=y
96# CONFIG_BINFMT_MISC is not set
97# CONFIG_CMDLINE_BOOL is not set
98
99#
100# Bus options
101#
102# CONFIG_PCI is not set
103# CONFIG_PCI_DOMAINS is not set
104# CONFIG_PCI_QSPAN is not set
105
106#
107# Advanced setup
108#
109# CONFIG_ADVANCED_OPTIONS is not set
110
111#
112# Default settings for advanced configuration options are used
113#
114CONFIG_HIGHMEM_START=0xfe000000
115CONFIG_LOWMEM_SIZE=0x30000000
116CONFIG_KERNEL_START=0xc0000000
117CONFIG_TASK_SIZE=0x80000000
118CONFIG_CONSISTENT_START=0xff100000
119CONFIG_CONSISTENT_SIZE=0x00200000
120CONFIG_BOOT_LOAD=0x00400000
121
122#
123# Device Drivers
124#
125
126#
127# Generic Driver Options
128#
129CONFIG_STANDALONE=y
130CONFIG_PREVENT_FIRMWARE_BUILD=y
131
132#
133# Memory Technology Devices (MTD)
134#
135# CONFIG_MTD is not set
136
137#
138# Parallel port support
139#
140# CONFIG_PARPORT is not set
141
142#
143# Plug and Play support
144#
145
146#
147# Block devices
148#
149# CONFIG_BLK_DEV_FD is not set
150CONFIG_BLK_DEV_LOOP=y
151# CONFIG_BLK_DEV_CRYPTOLOOP is not set
152# CONFIG_BLK_DEV_NBD is not set
153CONFIG_BLK_DEV_RAM=y
154CONFIG_BLK_DEV_RAM_SIZE=4096
155CONFIG_BLK_DEV_INITRD=y
156CONFIG_INITRAMFS_SOURCE=""
157# CONFIG_LBD is not set
158# CONFIG_CDROM_PKTCDVD is not set
159
160#
161# IO Schedulers
162#
163CONFIG_IOSCHED_NOOP=y
164CONFIG_IOSCHED_AS=y
165CONFIG_IOSCHED_DEADLINE=y
166CONFIG_IOSCHED_CFQ=y
167
168#
169# ATA/ATAPI/MFM/RLL support
170#
171# CONFIG_IDE is not set
172
173#
174# SCSI device support
175#
176# CONFIG_SCSI is not set
177
178#
179# Multi-device support (RAID and LVM)
180#
181# CONFIG_MD is not set
182
183#
184# Fusion MPT device support
185#
186
187#
188# IEEE 1394 (FireWire) support
189#
190# CONFIG_IEEE1394 is not set
191
192#
193# I2O device support
194#
195
196#
197# Macintosh device drivers
198#
199
200#
201# Networking support
202#
203CONFIG_NET=y
204
205#
206# Networking options
207#
208CONFIG_PACKET=y
209# CONFIG_PACKET_MMAP is not set
210# CONFIG_NETLINK_DEV is not set
211CONFIG_UNIX=y
212# CONFIG_NET_KEY is not set
213CONFIG_INET=y
214CONFIG_IP_MULTICAST=y
215# CONFIG_IP_ADVANCED_ROUTER is not set
216CONFIG_IP_PNP=y
217# CONFIG_IP_PNP_DHCP is not set
218CONFIG_IP_PNP_BOOTP=y
219# CONFIG_IP_PNP_RARP is not set
220# CONFIG_NET_IPIP is not set
221# CONFIG_NET_IPGRE is not set
222# CONFIG_IP_MROUTE is not set
223# CONFIG_ARPD is not set
224# CONFIG_SYN_COOKIES is not set
225# CONFIG_INET_AH is not set
226# CONFIG_INET_ESP is not set
227# CONFIG_INET_IPCOMP is not set
228# CONFIG_INET_TUNNEL is not set
229# CONFIG_IPV6 is not set
230# CONFIG_NETFILTER is not set
231
232#
233# SCTP Configuration (EXPERIMENTAL)
234#
235# CONFIG_IP_SCTP is not set
236# CONFIG_ATM is not set
237# CONFIG_BRIDGE is not set
238# CONFIG_VLAN_8021Q is not set
239# CONFIG_DECNET is not set
240# CONFIG_LLC2 is not set
241# CONFIG_IPX is not set
242# CONFIG_ATALK is not set
243# CONFIG_X25 is not set
244# CONFIG_LAPB is not set
245# CONFIG_NET_DIVERT is not set
246# CONFIG_ECONET is not set
247# CONFIG_WAN_ROUTER is not set
248
249#
250# QoS and/or fair queueing
251#
252# CONFIG_NET_SCHED is not set
253# CONFIG_NET_CLS_ROUTE is not set
254
255#
256# Network testing
257#
258# CONFIG_NET_PKTGEN is not set
259# CONFIG_NETPOLL is not set
260# CONFIG_NET_POLL_CONTROLLER is not set
261# CONFIG_HAMRADIO is not set
262# CONFIG_IRDA is not set
263# CONFIG_BT is not set
264CONFIG_NETDEVICES=y
265# CONFIG_DUMMY is not set
266# CONFIG_BONDING is not set
267# CONFIG_EQUALIZER is not set
268# CONFIG_TUN is not set
269
270#
271# Ethernet (10 or 100Mbit)
272#
273CONFIG_NET_ETHERNET=y
274# CONFIG_MII is not set
275# CONFIG_OAKNET is not set
276
277#
278# Ethernet (1000 Mbit)
279#
280
281#
282# Ethernet (10000 Mbit)
283#
284
285#
286# Token Ring devices
287#
288
289#
290# Wireless LAN (non-hamradio)
291#
292# CONFIG_NET_RADIO is not set
293
294#
295# Wan interfaces
296#
297# CONFIG_WAN is not set
298# CONFIG_PPP is not set
299# CONFIG_SLIP is not set
300# CONFIG_SHAPER is not set
301# CONFIG_NETCONSOLE is not set
302
303#
304# ISDN subsystem
305#
306# CONFIG_ISDN is not set
307
308#
309# Telephony Support
310#
311# CONFIG_PHONE is not set
312
313#
314# Input device support
315#
316# CONFIG_INPUT is not set
317
318#
319# Userland interfaces
320#
321
322#
323# Input I/O drivers
324#
325# CONFIG_GAMEPORT is not set
326CONFIG_SOUND_GAMEPORT=y
327# CONFIG_SERIO is not set
328# CONFIG_SERIO_I8042 is not set
329
330#
331# Input Device Drivers
332#
333
334#
335# Character devices
336#
337# CONFIG_VT is not set
338# CONFIG_SERIAL_NONSTANDARD is not set
339
340#
341# Serial drivers
342#
343# CONFIG_SERIAL_8250 is not set
344
345#
346# Non-8250 serial port support
347#
348CONFIG_SERIAL_CORE=y
349CONFIG_SERIAL_CORE_CONSOLE=y
350CONFIG_SERIAL_CPM=y
351CONFIG_SERIAL_CPM_CONSOLE=y
352# CONFIG_SERIAL_CPM_SCC1 is not set
353CONFIG_SERIAL_CPM_SCC2=y
354CONFIG_SERIAL_CPM_SCC3=y
355# CONFIG_SERIAL_CPM_SCC4 is not set
356CONFIG_SERIAL_CPM_SMC1=y
357CONFIG_SERIAL_CPM_SMC2=y
358CONFIG_UNIX98_PTYS=y
359# CONFIG_LEGACY_PTYS is not set
360
361#
362# IPMI
363#
364# CONFIG_IPMI_HANDLER is not set
365
366#
367# Watchdog Cards
368#
369# CONFIG_WATCHDOG is not set
370# CONFIG_NVRAM is not set
371CONFIG_GEN_RTC=y
372# CONFIG_GEN_RTC_X is not set
373# CONFIG_DTLK is not set
374# CONFIG_R3964 is not set
375
376#
377# Ftape, the floppy tape device driver
378#
379# CONFIG_AGP is not set
380# CONFIG_DRM is not set
381# CONFIG_RAW_DRIVER is not set
382
383#
384# I2C support
385#
386# CONFIG_I2C is not set
387
388#
389# Dallas's 1-wire bus
390#
391# CONFIG_W1 is not set
392
393#
394# Misc devices
395#
396
397#
398# Multimedia devices
399#
400# CONFIG_VIDEO_DEV is not set
401
402#
403# Digital Video Broadcasting Devices
404#
405# CONFIG_DVB is not set
406
407#
408# Graphics support
409#
410# CONFIG_FB is not set
411
412#
413# Sound
414#
415# CONFIG_SOUND is not set
416
417#
418# USB support
419#
420# CONFIG_USB_ARCH_HAS_HCD is not set
421# CONFIG_USB_ARCH_HAS_OHCI is not set
422
423#
424# USB Gadget Support
425#
426# CONFIG_USB_GADGET is not set
427
428#
429# File systems
430#
431CONFIG_EXT2_FS=y
432# CONFIG_EXT2_FS_XATTR is not set
433CONFIG_EXT3_FS=y
434CONFIG_EXT3_FS_XATTR=y
435# CONFIG_EXT3_FS_POSIX_ACL is not set
436# CONFIG_EXT3_FS_SECURITY is not set
437CONFIG_JBD=y
438# CONFIG_JBD_DEBUG is not set
439CONFIG_FS_MBCACHE=y
440# CONFIG_REISERFS_FS is not set
441# CONFIG_JFS_FS is not set
442# CONFIG_XFS_FS is not set
443# CONFIG_MINIX_FS is not set
444# CONFIG_ROMFS_FS is not set
445# CONFIG_QUOTA is not set
446CONFIG_DNOTIFY=y
447# CONFIG_AUTOFS_FS is not set
448# CONFIG_AUTOFS4_FS is not set
449
450#
451# CD-ROM/DVD Filesystems
452#
453# CONFIG_ISO9660_FS is not set
454# CONFIG_UDF_FS is not set
455
456#
457# DOS/FAT/NT Filesystems
458#
459# CONFIG_MSDOS_FS is not set
460# CONFIG_VFAT_FS is not set
461# CONFIG_NTFS_FS is not set
462
463#
464# Pseudo filesystems
465#
466CONFIG_PROC_FS=y
467CONFIG_PROC_KCORE=y
468CONFIG_SYSFS=y
469# CONFIG_DEVFS_FS is not set
470# CONFIG_DEVPTS_FS_XATTR is not set
471CONFIG_TMPFS=y
472# CONFIG_TMPFS_XATTR is not set
473# CONFIG_HUGETLBFS is not set
474# CONFIG_HUGETLB_PAGE is not set
475CONFIG_RAMFS=y
476
477#
478# Miscellaneous filesystems
479#
480# CONFIG_ADFS_FS is not set
481# CONFIG_AFFS_FS is not set
482# CONFIG_HFS_FS is not set
483# CONFIG_HFSPLUS_FS is not set
484# CONFIG_BEFS_FS is not set
485# CONFIG_BFS_FS is not set
486# CONFIG_EFS_FS is not set
487# CONFIG_CRAMFS is not set
488# CONFIG_VXFS_FS is not set
489# CONFIG_HPFS_FS is not set
490# CONFIG_QNX4FS_FS is not set
491# CONFIG_SYSV_FS is not set
492# CONFIG_UFS_FS is not set
493
494#
495# Network File Systems
496#
497CONFIG_NFS_FS=y
498# CONFIG_NFS_V3 is not set
499# CONFIG_NFS_V4 is not set
500# CONFIG_NFS_DIRECTIO is not set
501# CONFIG_NFSD is not set
502CONFIG_ROOT_NFS=y
503CONFIG_LOCKD=y
504# CONFIG_EXPORTFS is not set
505CONFIG_SUNRPC=y
506# CONFIG_RPCSEC_GSS_KRB5 is not set
507# CONFIG_RPCSEC_GSS_SPKM3 is not set
508# CONFIG_SMB_FS is not set
509# CONFIG_CIFS is not set
510# CONFIG_NCP_FS is not set
511# CONFIG_CODA_FS is not set
512# CONFIG_AFS_FS is not set
513
514#
515# Partition Types
516#
517CONFIG_PARTITION_ADVANCED=y
518# CONFIG_ACORN_PARTITION is not set
519# CONFIG_OSF_PARTITION is not set
520# CONFIG_AMIGA_PARTITION is not set
521# CONFIG_ATARI_PARTITION is not set
522# CONFIG_MAC_PARTITION is not set
523# CONFIG_MSDOS_PARTITION is not set
524# CONFIG_LDM_PARTITION is not set
525# CONFIG_SGI_PARTITION is not set
526# CONFIG_ULTRIX_PARTITION is not set
527# CONFIG_SUN_PARTITION is not set
528# CONFIG_EFI_PARTITION is not set
529
530#
531# Native Language Support
532#
533# CONFIG_NLS is not set
534
535#
536# MPC8xx CPM Options
537#
538CONFIG_SCC_ENET=y
539CONFIG_SCC1_ENET=y
540# CONFIG_SCC2_ENET is not set
541# CONFIG_SCC3_ENET is not set
542CONFIG_FEC_ENET=y
543# CONFIG_USE_MDIO is not set
544CONFIG_ENET_BIG_BUFFERS=y
545
546#
547# Generic MPC8xx Options
548#
549CONFIG_8xx_COPYBACK=y
550# CONFIG_8xx_CPU6 is not set
551CONFIG_NO_UCODE_PATCH=y
552# CONFIG_USB_SOF_UCODE_PATCH is not set
553# CONFIG_I2C_SPI_UCODE_PATCH is not set
554# CONFIG_I2C_SPI_SMC1_UCODE_PATCH is not set
555
556#
557# Library routines
558#
559# CONFIG_CRC_CCITT is not set
560# CONFIG_CRC32 is not set
561# CONFIG_LIBCRC32C is not set
562
563#
564# Profiling support
565#
566# CONFIG_PROFILING is not set
567
568#
569# Kernel hacking
570#
571# CONFIG_DEBUG_KERNEL is not set
572
573#
574# Security options
575#
576# CONFIG_KEYS is not set
577# CONFIG_SECURITY is not set
578
579#
580# Cryptographic options
581#
582# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/rpxlite_defconfig b/arch/ppc/configs/rpxlite_defconfig
new file mode 100644
index 000000000000..828dd6eb5b43
--- /dev/null
+++ b/arch/ppc/configs/rpxlite_defconfig
@@ -0,0 +1,581 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.10-rc1
4# Mon Nov 1 16:41:09 2004
5#
6CONFIG_MMU=y
7CONFIG_GENERIC_HARDIRQS=y
8CONFIG_RWSEM_XCHGADD_ALGORITHM=y
9CONFIG_HAVE_DEC_LOCK=y
10CONFIG_PPC=y
11CONFIG_PPC32=y
12CONFIG_GENERIC_NVRAM=y
13
14#
15# Code maturity level options
16#
17CONFIG_EXPERIMENTAL=y
18# CONFIG_CLEAN_COMPILE is not set
19CONFIG_BROKEN=y
20CONFIG_BROKEN_ON_SMP=y
21
22#
23# General setup
24#
25CONFIG_LOCALVERSION=""
26# CONFIG_SWAP is not set
27CONFIG_SYSVIPC=y
28# CONFIG_POSIX_MQUEUE is not set
29# CONFIG_BSD_PROCESS_ACCT is not set
30CONFIG_SYSCTL=y
31# CONFIG_AUDIT is not set
32CONFIG_LOG_BUF_SHIFT=14
33# CONFIG_HOTPLUG is not set
34# CONFIG_KOBJECT_UEVENT is not set
35# CONFIG_IKCONFIG is not set
36CONFIG_EMBEDDED=y
37# CONFIG_KALLSYMS is not set
38# CONFIG_FUTEX is not set
39# CONFIG_EPOLL is not set
40# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
41# CONFIG_SHMEM is not set
42CONFIG_CC_ALIGN_FUNCTIONS=0
43CONFIG_CC_ALIGN_LABELS=0
44CONFIG_CC_ALIGN_LOOPS=0
45CONFIG_CC_ALIGN_JUMPS=0
46CONFIG_TINY_SHMEM=y
47
48#
49# Loadable module support
50#
51# CONFIG_MODULES is not set
52
53#
54# Processor
55#
56# CONFIG_6xx is not set
57# CONFIG_40x is not set
58# CONFIG_44x is not set
59# CONFIG_POWER3 is not set
60# CONFIG_POWER4 is not set
61CONFIG_8xx=y
62# CONFIG_E500 is not set
63CONFIG_MATH_EMULATION=y
64# CONFIG_CPU_FREQ is not set
65CONFIG_EMBEDDEDBOOT=y
66CONFIG_NOT_COHERENT_CACHE=y
67
68#
69# Platform options
70#
71CONFIG_RPXLITE=y
72# CONFIG_RPXCLASSIC is not set
73# CONFIG_BSEIP is not set
74# CONFIG_FADS is not set
75# CONFIG_TQM823L is not set
76# CONFIG_TQM850L is not set
77# CONFIG_TQM855L is not set
78# CONFIG_TQM860L is not set
79# CONFIG_FPS850L is not set
80# CONFIG_SPD823TS is not set
81# CONFIG_IVMS8 is not set
82# CONFIG_IVML24 is not set
83# CONFIG_SM850 is not set
84# CONFIG_HERMES_PRO is not set
85# CONFIG_IP860 is not set
86# CONFIG_LWMON is not set
87# CONFIG_PCU_E is not set
88# CONFIG_CCM is not set
89# CONFIG_LANTEC is not set
90# CONFIG_MBX is not set
91# CONFIG_WINCEPT is not set
92# CONFIG_SMP is not set
93# CONFIG_PREEMPT is not set
94# CONFIG_HIGHMEM is not set
95CONFIG_BINFMT_ELF=y
96# CONFIG_BINFMT_MISC is not set
97# CONFIG_CMDLINE_BOOL is not set
98
99#
100# Bus options
101#
102# CONFIG_PCI is not set
103# CONFIG_PCI_DOMAINS is not set
104# CONFIG_PCI_QSPAN is not set
105
106#
107# Advanced setup
108#
109# CONFIG_ADVANCED_OPTIONS is not set
110
111#
112# Default settings for advanced configuration options are used
113#
114CONFIG_HIGHMEM_START=0xfe000000
115CONFIG_LOWMEM_SIZE=0x30000000
116CONFIG_KERNEL_START=0xc0000000
117CONFIG_TASK_SIZE=0x80000000
118CONFIG_CONSISTENT_START=0xff100000
119CONFIG_CONSISTENT_SIZE=0x00200000
120CONFIG_BOOT_LOAD=0x00400000
121
122#
123# Device Drivers
124#
125
126#
127# Generic Driver Options
128#
129CONFIG_STANDALONE=y
130CONFIG_PREVENT_FIRMWARE_BUILD=y
131
132#
133# Memory Technology Devices (MTD)
134#
135# CONFIG_MTD is not set
136
137#
138# Parallel port support
139#
140# CONFIG_PARPORT is not set
141
142#
143# Plug and Play support
144#
145
146#
147# Block devices
148#
149# CONFIG_BLK_DEV_FD is not set
150CONFIG_BLK_DEV_LOOP=y
151# CONFIG_BLK_DEV_CRYPTOLOOP is not set
152# CONFIG_BLK_DEV_NBD is not set
153CONFIG_BLK_DEV_RAM=y
154CONFIG_BLK_DEV_RAM_SIZE=4096
155CONFIG_BLK_DEV_INITRD=y
156CONFIG_INITRAMFS_SOURCE=""
157# CONFIG_LBD is not set
158# CONFIG_CDROM_PKTCDVD is not set
159
160#
161# IO Schedulers
162#
163CONFIG_IOSCHED_NOOP=y
164CONFIG_IOSCHED_AS=y
165CONFIG_IOSCHED_DEADLINE=y
166CONFIG_IOSCHED_CFQ=y
167
168#
169# ATA/ATAPI/MFM/RLL support
170#
171# CONFIG_IDE is not set
172
173#
174# SCSI device support
175#
176# CONFIG_SCSI is not set
177
178#
179# Multi-device support (RAID and LVM)
180#
181# CONFIG_MD is not set
182
183#
184# Fusion MPT device support
185#
186
187#
188# IEEE 1394 (FireWire) support
189#
190# CONFIG_IEEE1394 is not set
191
192#
193# I2O device support
194#
195
196#
197# Macintosh device drivers
198#
199
200#
201# Networking support
202#
203CONFIG_NET=y
204
205#
206# Networking options
207#
208CONFIG_PACKET=y
209# CONFIG_PACKET_MMAP is not set
210# CONFIG_NETLINK_DEV is not set
211CONFIG_UNIX=y
212# CONFIG_NET_KEY is not set
213CONFIG_INET=y
214CONFIG_IP_MULTICAST=y
215# CONFIG_IP_ADVANCED_ROUTER is not set
216CONFIG_IP_PNP=y
217# CONFIG_IP_PNP_DHCP is not set
218CONFIG_IP_PNP_BOOTP=y
219# CONFIG_IP_PNP_RARP is not set
220# CONFIG_NET_IPIP is not set
221# CONFIG_NET_IPGRE is not set
222# CONFIG_IP_MROUTE is not set
223# CONFIG_ARPD is not set
224# CONFIG_SYN_COOKIES is not set
225# CONFIG_INET_AH is not set
226# CONFIG_INET_ESP is not set
227# CONFIG_INET_IPCOMP is not set
228# CONFIG_INET_TUNNEL is not set
229# CONFIG_IPV6 is not set
230# CONFIG_NETFILTER is not set
231
232#
233# SCTP Configuration (EXPERIMENTAL)
234#
235# CONFIG_IP_SCTP is not set
236# CONFIG_ATM is not set
237# CONFIG_BRIDGE is not set
238# CONFIG_VLAN_8021Q is not set
239# CONFIG_DECNET is not set
240# CONFIG_LLC2 is not set
241# CONFIG_IPX is not set
242# CONFIG_ATALK is not set
243# CONFIG_X25 is not set
244# CONFIG_LAPB is not set
245# CONFIG_NET_DIVERT is not set
246# CONFIG_ECONET is not set
247# CONFIG_WAN_ROUTER is not set
248
249#
250# QoS and/or fair queueing
251#
252# CONFIG_NET_SCHED is not set
253# CONFIG_NET_CLS_ROUTE is not set
254
255#
256# Network testing
257#
258# CONFIG_NET_PKTGEN is not set
259# CONFIG_NETPOLL is not set
260# CONFIG_NET_POLL_CONTROLLER is not set
261# CONFIG_HAMRADIO is not set
262# CONFIG_IRDA is not set
263# CONFIG_BT is not set
264CONFIG_NETDEVICES=y
265# CONFIG_DUMMY is not set
266# CONFIG_BONDING is not set
267# CONFIG_EQUALIZER is not set
268# CONFIG_TUN is not set
269
270#
271# Ethernet (10 or 100Mbit)
272#
273CONFIG_NET_ETHERNET=y
274# CONFIG_MII is not set
275# CONFIG_OAKNET is not set
276
277#
278# Ethernet (1000 Mbit)
279#
280
281#
282# Ethernet (10000 Mbit)
283#
284
285#
286# Token Ring devices
287#
288
289#
290# Wireless LAN (non-hamradio)
291#
292# CONFIG_NET_RADIO is not set
293
294#
295# Wan interfaces
296#
297# CONFIG_WAN is not set
298# CONFIG_PPP is not set
299# CONFIG_SLIP is not set
300# CONFIG_SHAPER is not set
301# CONFIG_NETCONSOLE is not set
302
303#
304# ISDN subsystem
305#
306# CONFIG_ISDN is not set
307
308#
309# Telephony Support
310#
311# CONFIG_PHONE is not set
312
313#
314# Input device support
315#
316# CONFIG_INPUT is not set
317
318#
319# Userland interfaces
320#
321
322#
323# Input I/O drivers
324#
325# CONFIG_GAMEPORT is not set
326CONFIG_SOUND_GAMEPORT=y
327# CONFIG_SERIO is not set
328# CONFIG_SERIO_I8042 is not set
329
330#
331# Input Device Drivers
332#
333
334#
335# Character devices
336#
337# CONFIG_VT is not set
338# CONFIG_SERIAL_NONSTANDARD is not set
339
340#
341# Serial drivers
342#
343# CONFIG_SERIAL_8250 is not set
344
345#
346# Non-8250 serial port support
347#
348CONFIG_SERIAL_CORE=y
349CONFIG_SERIAL_CORE_CONSOLE=y
350CONFIG_SERIAL_CPM=y
351CONFIG_SERIAL_CPM_CONSOLE=y
352# CONFIG_SERIAL_CPM_SCC1 is not set
353# CONFIG_SERIAL_CPM_SCC2 is not set
354# CONFIG_SERIAL_CPM_SCC3 is not set
355# CONFIG_SERIAL_CPM_SCC4 is not set
356CONFIG_SERIAL_CPM_SMC1=y
357# CONFIG_SERIAL_CPM_SMC2 is not set
358CONFIG_UNIX98_PTYS=y
359# CONFIG_LEGACY_PTYS is not set
360
361#
362# IPMI
363#
364# CONFIG_IPMI_HANDLER is not set
365
366#
367# Watchdog Cards
368#
369# CONFIG_WATCHDOG is not set
370# CONFIG_NVRAM is not set
371CONFIG_GEN_RTC=y
372# CONFIG_GEN_RTC_X is not set
373# CONFIG_DTLK is not set
374# CONFIG_R3964 is not set
375
376#
377# Ftape, the floppy tape device driver
378#
379# CONFIG_AGP is not set
380# CONFIG_DRM is not set
381# CONFIG_RAW_DRIVER is not set
382
383#
384# I2C support
385#
386# CONFIG_I2C is not set
387
388#
389# Dallas's 1-wire bus
390#
391# CONFIG_W1 is not set
392
393#
394# Misc devices
395#
396
397#
398# Multimedia devices
399#
400# CONFIG_VIDEO_DEV is not set
401
402#
403# Digital Video Broadcasting Devices
404#
405# CONFIG_DVB is not set
406
407#
408# Graphics support
409#
410# CONFIG_FB is not set
411
412#
413# Sound
414#
415# CONFIG_SOUND is not set
416
417#
418# USB support
419#
420# CONFIG_USB_ARCH_HAS_HCD is not set
421# CONFIG_USB_ARCH_HAS_OHCI is not set
422
423#
424# USB Gadget Support
425#
426# CONFIG_USB_GADGET is not set
427
428#
429# File systems
430#
431CONFIG_EXT2_FS=y
432# CONFIG_EXT2_FS_XATTR is not set
433CONFIG_EXT3_FS=y
434CONFIG_EXT3_FS_XATTR=y
435# CONFIG_EXT3_FS_POSIX_ACL is not set
436# CONFIG_EXT3_FS_SECURITY is not set
437CONFIG_JBD=y
438# CONFIG_JBD_DEBUG is not set
439CONFIG_FS_MBCACHE=y
440# CONFIG_REISERFS_FS is not set
441# CONFIG_JFS_FS is not set
442# CONFIG_XFS_FS is not set
443# CONFIG_MINIX_FS is not set
444# CONFIG_ROMFS_FS is not set
445# CONFIG_QUOTA is not set
446CONFIG_DNOTIFY=y
447# CONFIG_AUTOFS_FS is not set
448# CONFIG_AUTOFS4_FS is not set
449
450#
451# CD-ROM/DVD Filesystems
452#
453# CONFIG_ISO9660_FS is not set
454# CONFIG_UDF_FS is not set
455
456#
457# DOS/FAT/NT Filesystems
458#
459# CONFIG_MSDOS_FS is not set
460# CONFIG_VFAT_FS is not set
461# CONFIG_NTFS_FS is not set
462
463#
464# Pseudo filesystems
465#
466CONFIG_PROC_FS=y
467CONFIG_PROC_KCORE=y
468CONFIG_SYSFS=y
469# CONFIG_DEVFS_FS is not set
470# CONFIG_DEVPTS_FS_XATTR is not set
471CONFIG_TMPFS=y
472# CONFIG_TMPFS_XATTR is not set
473# CONFIG_HUGETLBFS is not set
474# CONFIG_HUGETLB_PAGE is not set
475CONFIG_RAMFS=y
476
477#
478# Miscellaneous filesystems
479#
480# CONFIG_ADFS_FS is not set
481# CONFIG_AFFS_FS is not set
482# CONFIG_HFS_FS is not set
483# CONFIG_HFSPLUS_FS is not set
484# CONFIG_BEFS_FS is not set
485# CONFIG_BFS_FS is not set
486# CONFIG_EFS_FS is not set
487# CONFIG_CRAMFS is not set
488# CONFIG_VXFS_FS is not set
489# CONFIG_HPFS_FS is not set
490# CONFIG_QNX4FS_FS is not set
491# CONFIG_SYSV_FS is not set
492# CONFIG_UFS_FS is not set
493
494#
495# Network File Systems
496#
497CONFIG_NFS_FS=y
498# CONFIG_NFS_V3 is not set
499# CONFIG_NFS_V4 is not set
500# CONFIG_NFS_DIRECTIO is not set
501# CONFIG_NFSD is not set
502CONFIG_ROOT_NFS=y
503CONFIG_LOCKD=y
504# CONFIG_EXPORTFS is not set
505CONFIG_SUNRPC=y
506# CONFIG_RPCSEC_GSS_KRB5 is not set
507# CONFIG_RPCSEC_GSS_SPKM3 is not set
508# CONFIG_SMB_FS is not set
509# CONFIG_CIFS is not set
510# CONFIG_NCP_FS is not set
511# CONFIG_CODA_FS is not set
512# CONFIG_AFS_FS is not set
513
514#
515# Partition Types
516#
517CONFIG_PARTITION_ADVANCED=y
518# CONFIG_ACORN_PARTITION is not set
519# CONFIG_OSF_PARTITION is not set
520# CONFIG_AMIGA_PARTITION is not set
521# CONFIG_ATARI_PARTITION is not set
522# CONFIG_MAC_PARTITION is not set
523# CONFIG_MSDOS_PARTITION is not set
524# CONFIG_LDM_PARTITION is not set
525# CONFIG_SGI_PARTITION is not set
526# CONFIG_ULTRIX_PARTITION is not set
527# CONFIG_SUN_PARTITION is not set
528# CONFIG_EFI_PARTITION is not set
529
530#
531# Native Language Support
532#
533# CONFIG_NLS is not set
534
535#
536# MPC8xx CPM Options
537#
538CONFIG_SCC_ENET=y
539# CONFIG_SCC1_ENET is not set
540CONFIG_SCC2_ENET=y
541# CONFIG_SCC3_ENET is not set
542# CONFIG_FEC_ENET is not set
543# CONFIG_ENET_BIG_BUFFERS is not set
544
545#
546# Generic MPC8xx Options
547#
548CONFIG_8xx_COPYBACK=y
549# CONFIG_8xx_CPU6 is not set
550CONFIG_NO_UCODE_PATCH=y
551# CONFIG_USB_SOF_UCODE_PATCH is not set
552# CONFIG_I2C_SPI_UCODE_PATCH is not set
553# CONFIG_I2C_SPI_SMC1_UCODE_PATCH is not set
554
555#
556# Library routines
557#
558# CONFIG_CRC_CCITT is not set
559# CONFIG_CRC32 is not set
560# CONFIG_LIBCRC32C is not set
561
562#
563# Profiling support
564#
565# CONFIG_PROFILING is not set
566
567#
568# Kernel hacking
569#
570# CONFIG_DEBUG_KERNEL is not set
571
572#
573# Security options
574#
575# CONFIG_KEYS is not set
576# CONFIG_SECURITY is not set
577
578#
579# Cryptographic options
580#
581# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/sandpoint_defconfig b/arch/ppc/configs/sandpoint_defconfig
new file mode 100644
index 000000000000..0f4393a07f82
--- /dev/null
+++ b/arch/ppc/configs/sandpoint_defconfig
@@ -0,0 +1,737 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7CONFIG_PPC=y
8CONFIG_PPC32=y
9CONFIG_GENERIC_NVRAM=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_STANDALONE=y
17CONFIG_BROKEN_ON_SMP=y
18
19#
20# General setup
21#
22# CONFIG_SWAP is not set
23CONFIG_SYSVIPC=y
24# CONFIG_POSIX_MQUEUE is not set
25# CONFIG_BSD_PROCESS_ACCT is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=14
29CONFIG_HOTPLUG=y
30# CONFIG_IKCONFIG is not set
31CONFIG_EMBEDDED=y
32CONFIG_KALLSYMS=y
33CONFIG_FUTEX=y
34CONFIG_EPOLL=y
35CONFIG_IOSCHED_NOOP=y
36CONFIG_IOSCHED_AS=y
37CONFIG_IOSCHED_DEADLINE=y
38CONFIG_IOSCHED_CFQ=y
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
40
41#
42# Loadable module support
43#
44CONFIG_MODULES=y
45CONFIG_MODULE_UNLOAD=y
46# CONFIG_MODULE_FORCE_UNLOAD is not set
47CONFIG_OBSOLETE_MODPARM=y
48# CONFIG_MODVERSIONS is not set
49CONFIG_KMOD=y
50
51#
52# Processor
53#
54CONFIG_6xx=y
55# CONFIG_40x is not set
56# CONFIG_44x is not set
57# CONFIG_POWER3 is not set
58# CONFIG_POWER4 is not set
59# CONFIG_8xx is not set
60CONFIG_ALTIVEC=y
61# CONFIG_TAU is not set
62# CONFIG_CPU_FREQ is not set
63CONFIG_PPC_STD_MMU=y
64
65#
66# Platform options
67#
68# CONFIG_PPC_MULTIPLATFORM is not set
69# CONFIG_APUS is not set
70# CONFIG_WILLOW is not set
71# CONFIG_PCORE is not set
72# CONFIG_POWERPMC250 is not set
73# CONFIG_EV64260 is not set
74# CONFIG_SPRUCE is not set
75# CONFIG_LOPEC is not set
76# CONFIG_MCPN765 is not set
77# CONFIG_MVME5100 is not set
78# CONFIG_PPLUS is not set
79# CONFIG_PRPMC750 is not set
80# CONFIG_PRPMC800 is not set
81CONFIG_SANDPOINT=y
82# CONFIG_ADIR is not set
83# CONFIG_K2 is not set
84# CONFIG_PAL4 is not set
85# CONFIG_GEMINI is not set
86# CONFIG_EST8260 is not set
87# CONFIG_SBS8260 is not set
88# CONFIG_RPX6 is not set
89# CONFIG_TQM8260 is not set
90CONFIG_PPC_GEN550=y
91CONFIG_EPIC_SERIAL_MODE=y
92CONFIG_MPC10X_BRIDGE=y
93# CONFIG_MPC10X_STORE_GATHERING is not set
94# CONFIG_SMP is not set
95# CONFIG_PREEMPT is not set
96# CONFIG_HIGHMEM is not set
97CONFIG_KERNEL_ELF=y
98CONFIG_BINFMT_ELF=y
99CONFIG_BINFMT_MISC=m
100CONFIG_CMDLINE_BOOL=y
101CONFIG_CMDLINE="ip=on"
102
103#
104# Bus options
105#
106CONFIG_GENERIC_ISA_DMA=y
107CONFIG_PCI=y
108CONFIG_PCI_DOMAINS=y
109# CONFIG_PCI_LEGACY_PROC is not set
110# CONFIG_PCI_NAMES is not set
111
112#
113# PCMCIA/CardBus support
114#
115# CONFIG_PCMCIA is not set
116
117#
118# Advanced setup
119#
120# CONFIG_ADVANCED_OPTIONS is not set
121
122#
123# Default settings for advanced configuration options are used
124#
125CONFIG_HIGHMEM_START=0xfe000000
126CONFIG_LOWMEM_SIZE=0x30000000
127CONFIG_KERNEL_START=0xc0000000
128CONFIG_TASK_SIZE=0x80000000
129CONFIG_BOOT_LOAD=0x00800000
130
131#
132# Device Drivers
133#
134
135#
136# Generic Driver Options
137#
138# CONFIG_FW_LOADER is not set
139
140#
141# Memory Technology Devices (MTD)
142#
143# CONFIG_MTD is not set
144
145#
146# Parallel port support
147#
148# CONFIG_PARPORT is not set
149
150#
151# Plug and Play support
152#
153
154#
155# Block devices
156#
157# CONFIG_BLK_DEV_FD is not set
158# CONFIG_BLK_CPQ_DA is not set
159# CONFIG_BLK_CPQ_CISS_DA is not set
160# CONFIG_BLK_DEV_DAC960 is not set
161# CONFIG_BLK_DEV_UMEM is not set
162CONFIG_BLK_DEV_LOOP=y
163# CONFIG_BLK_DEV_CRYPTOLOOP is not set
164# CONFIG_BLK_DEV_NBD is not set
165# CONFIG_BLK_DEV_CARMEL is not set
166CONFIG_BLK_DEV_RAM=y
167CONFIG_BLK_DEV_RAM_SIZE=4096
168CONFIG_BLK_DEV_INITRD=y
169# CONFIG_LBD is not set
170
171#
172# ATA/ATAPI/MFM/RLL support
173#
174CONFIG_IDE=y
175CONFIG_BLK_DEV_IDE=y
176
177#
178# Please see Documentation/ide.txt for help/info on IDE drives
179#
180CONFIG_BLK_DEV_IDEDISK=y
181# CONFIG_IDEDISK_MULTI_MODE is not set
182# CONFIG_IDEDISK_STROKE is not set
183CONFIG_BLK_DEV_IDECD=y
184# CONFIG_BLK_DEV_IDETAPE is not set
185# CONFIG_BLK_DEV_IDEFLOPPY is not set
186# CONFIG_IDE_TASK_IOCTL is not set
187CONFIG_IDE_TASKFILE_IO=y
188
189#
190# IDE chipset support/bugfixes
191#
192CONFIG_IDE_GENERIC=y
193# CONFIG_BLK_DEV_IDEPCI is not set
194# CONFIG_BLK_DEV_IDEDMA is not set
195# CONFIG_IDEDMA_AUTO is not set
196# CONFIG_BLK_DEV_HD is not set
197
198#
199# SCSI device support
200#
201# CONFIG_SCSI is not set
202
203#
204# Multi-device support (RAID and LVM)
205#
206# CONFIG_MD is not set
207
208#
209# Fusion MPT device support
210#
211
212#
213# IEEE 1394 (FireWire) support
214#
215# CONFIG_IEEE1394 is not set
216
217#
218# I2O device support
219#
220# CONFIG_I2O is not set
221
222#
223# Macintosh device drivers
224#
225
226#
227# Networking support
228#
229CONFIG_NET=y
230
231#
232# Networking options
233#
234CONFIG_PACKET=y
235# CONFIG_PACKET_MMAP is not set
236# CONFIG_NETLINK_DEV is not set
237CONFIG_UNIX=y
238# CONFIG_NET_KEY is not set
239CONFIG_INET=y
240CONFIG_IP_MULTICAST=y
241# CONFIG_IP_ADVANCED_ROUTER is not set
242CONFIG_IP_PNP=y
243# CONFIG_IP_PNP_DHCP is not set
244CONFIG_IP_PNP_BOOTP=y
245# CONFIG_IP_PNP_RARP is not set
246# CONFIG_NET_IPIP is not set
247# CONFIG_NET_IPGRE is not set
248# CONFIG_IP_MROUTE is not set
249# CONFIG_ARPD is not set
250# CONFIG_SYN_COOKIES is not set
251# CONFIG_INET_AH is not set
252# CONFIG_INET_ESP is not set
253# CONFIG_INET_IPCOMP is not set
254# CONFIG_IPV6 is not set
255# CONFIG_NETFILTER is not set
256
257#
258# SCTP Configuration (EXPERIMENTAL)
259#
260# CONFIG_IP_SCTP is not set
261# CONFIG_ATM is not set
262# CONFIG_BRIDGE is not set
263# CONFIG_VLAN_8021Q is not set
264# CONFIG_DECNET is not set
265# CONFIG_LLC2 is not set
266# CONFIG_IPX is not set
267# CONFIG_ATALK is not set
268# CONFIG_X25 is not set
269# CONFIG_LAPB is not set
270# CONFIG_NET_DIVERT is not set
271# CONFIG_ECONET is not set
272# CONFIG_WAN_ROUTER is not set
273# CONFIG_NET_HW_FLOWCONTROL is not set
274
275#
276# QoS and/or fair queueing
277#
278# CONFIG_NET_SCHED is not set
279
280#
281# Network testing
282#
283# CONFIG_NET_PKTGEN is not set
284# CONFIG_NETPOLL is not set
285# CONFIG_NET_POLL_CONTROLLER is not set
286# CONFIG_HAMRADIO is not set
287# CONFIG_IRDA is not set
288# CONFIG_BT is not set
289CONFIG_NETDEVICES=y
290CONFIG_DUMMY=m
291# CONFIG_BONDING is not set
292# CONFIG_EQUALIZER is not set
293# CONFIG_TUN is not set
294
295#
296# ARCnet devices
297#
298# CONFIG_ARCNET is not set
299
300#
301# Ethernet (10 or 100Mbit)
302#
303CONFIG_NET_ETHERNET=y
304CONFIG_MII=y
305# CONFIG_OAKNET is not set
306# CONFIG_HAPPYMEAL is not set
307# CONFIG_SUNGEM is not set
308CONFIG_NET_VENDOR_3COM=y
309CONFIG_VORTEX=y
310# CONFIG_TYPHOON is not set
311
312#
313# Tulip family network device support
314#
315CONFIG_NET_TULIP=y
316# CONFIG_DE2104X is not set
317CONFIG_TULIP=y
318# CONFIG_TULIP_MWI is not set
319# CONFIG_TULIP_MMIO is not set
320# CONFIG_TULIP_NAPI is not set
321# CONFIG_DE4X5 is not set
322# CONFIG_WINBOND_840 is not set
323# CONFIG_DM9102 is not set
324# CONFIG_HP100 is not set
325CONFIG_NET_PCI=y
326# CONFIG_PCNET32 is not set
327# CONFIG_AMD8111_ETH is not set
328# CONFIG_ADAPTEC_STARFIRE is not set
329# CONFIG_B44 is not set
330# CONFIG_FORCEDETH is not set
331# CONFIG_DGRS is not set
332# CONFIG_EEPRO100 is not set
333CONFIG_E100=y
334# CONFIG_E100_NAPI is not set
335# CONFIG_FEALNX is not set
336# CONFIG_NATSEMI is not set
337# CONFIG_NE2K_PCI is not set
338# CONFIG_8139CP is not set
339CONFIG_8139TOO=y
340CONFIG_8139TOO_PIO=y
341# CONFIG_8139TOO_TUNE_TWISTER is not set
342# CONFIG_8139TOO_8129 is not set
343# CONFIG_8139_OLD_RX_RESET is not set
344# CONFIG_SIS900 is not set
345# CONFIG_EPIC100 is not set
346# CONFIG_SUNDANCE is not set
347# CONFIG_TLAN is not set
348# CONFIG_VIA_RHINE is not set
349
350#
351# Ethernet (1000 Mbit)
352#
353# CONFIG_ACENIC is not set
354# CONFIG_DL2K is not set
355# CONFIG_E1000 is not set
356# CONFIG_NS83820 is not set
357# CONFIG_HAMACHI is not set
358# CONFIG_YELLOWFIN is not set
359# CONFIG_R8169 is not set
360# CONFIG_SK98LIN is not set
361# CONFIG_TIGON3 is not set
362
363#
364# Ethernet (10000 Mbit)
365#
366# CONFIG_IXGB is not set
367# CONFIG_S2IO is not set
368
369#
370# Token Ring devices
371#
372# CONFIG_TR is not set
373
374#
375# Wireless LAN (non-hamradio)
376#
377# CONFIG_NET_RADIO is not set
378
379#
380# Wan interfaces
381#
382# CONFIG_WAN is not set
383# CONFIG_FDDI is not set
384# CONFIG_HIPPI is not set
385CONFIG_PPP=m
386# CONFIG_PPP_MULTILINK is not set
387# CONFIG_PPP_FILTER is not set
388CONFIG_PPP_ASYNC=m
389CONFIG_PPP_SYNC_TTY=m
390CONFIG_PPP_DEFLATE=m
391CONFIG_PPP_BSDCOMP=m
392# CONFIG_PPPOE is not set
393# CONFIG_SLIP is not set
394# CONFIG_RCPCI is not set
395# CONFIG_SHAPER is not set
396# CONFIG_NETCONSOLE is not set
397
398#
399# ISDN subsystem
400#
401# CONFIG_ISDN is not set
402
403#
404# Telephony Support
405#
406# CONFIG_PHONE is not set
407
408#
409# Input device support
410#
411# CONFIG_INPUT is not set
412
413#
414# Userland interfaces
415#
416
417#
418# Input I/O drivers
419#
420# CONFIG_GAMEPORT is not set
421CONFIG_SOUND_GAMEPORT=y
422# CONFIG_SERIO is not set
423# CONFIG_SERIO_I8042 is not set
424
425#
426# Input Device Drivers
427#
428
429#
430# Character devices
431#
432# CONFIG_VT is not set
433# CONFIG_SERIAL_NONSTANDARD is not set
434
435#
436# Serial drivers
437#
438CONFIG_SERIAL_8250=y
439CONFIG_SERIAL_8250_CONSOLE=y
440CONFIG_SERIAL_8250_NR_UARTS=2
441# CONFIG_SERIAL_8250_EXTENDED is not set
442
443#
444# Non-8250 serial port support
445#
446CONFIG_SERIAL_CORE=y
447CONFIG_SERIAL_CORE_CONSOLE=y
448CONFIG_UNIX98_PTYS=y
449CONFIG_LEGACY_PTYS=y
450CONFIG_LEGACY_PTY_COUNT=256
451# CONFIG_QIC02_TAPE is not set
452
453#
454# IPMI
455#
456# CONFIG_IPMI_HANDLER is not set
457
458#
459# Watchdog Cards
460#
461# CONFIG_WATCHDOG is not set
462# CONFIG_NVRAM is not set
463CONFIG_GEN_RTC=y
464# CONFIG_GEN_RTC_X is not set
465# CONFIG_DTLK is not set
466# CONFIG_R3964 is not set
467# CONFIG_APPLICOM is not set
468
469#
470# Ftape, the floppy tape device driver
471#
472# CONFIG_FTAPE is not set
473# CONFIG_AGP is not set
474# CONFIG_DRM is not set
475# CONFIG_RAW_DRIVER is not set
476
477#
478# I2C support
479#
480# CONFIG_I2C is not set
481
482#
483# Misc devices
484#
485
486#
487# Multimedia devices
488#
489# CONFIG_VIDEO_DEV is not set
490
491#
492# Digital Video Broadcasting Devices
493#
494# CONFIG_DVB is not set
495
496#
497# Graphics support
498#
499# CONFIG_FB is not set
500
501#
502# Sound
503#
504# CONFIG_SOUND is not set
505
506#
507# USB support
508#
509CONFIG_USB=y
510# CONFIG_USB_DEBUG is not set
511
512#
513# Miscellaneous USB options
514#
515CONFIG_USB_DEVICEFS=y
516# CONFIG_USB_BANDWIDTH is not set
517# CONFIG_USB_DYNAMIC_MINORS is not set
518
519#
520# USB Host Controller Drivers
521#
522# CONFIG_USB_EHCI_HCD is not set
523CONFIG_USB_OHCI_HCD=y
524# CONFIG_USB_UHCI_HCD is not set
525
526#
527# USB Device Class drivers
528#
529# CONFIG_USB_BLUETOOTH_TTY is not set
530CONFIG_USB_ACM=m
531# CONFIG_USB_PRINTER is not set
532# CONFIG_USB_STORAGE is not set
533
534#
535# USB Human Interface Devices (HID)
536#
537# CONFIG_USB_HID is not set
538
539#
540# Input core support is needed for USB HID input layer or HIDBP support
541#
542
543#
544# USB HID Boot Protocol drivers
545#
546
547#
548# USB Imaging devices
549#
550# CONFIG_USB_MDC800 is not set
551
552#
553# USB Multimedia devices
554#
555# CONFIG_USB_DABUSB is not set
556
557#
558# Video4Linux support is needed for USB Multimedia device support
559#
560
561#
562# USB Network adaptors
563#
564# CONFIG_USB_CATC is not set
565# CONFIG_USB_KAWETH is not set
566# CONFIG_USB_PEGASUS is not set
567# CONFIG_USB_RTL8150 is not set
568# CONFIG_USB_USBNET is not set
569
570#
571# USB port drivers
572#
573
574#
575# USB Serial Converter support
576#
577CONFIG_USB_SERIAL=m
578# CONFIG_USB_SERIAL_GENERIC is not set
579# CONFIG_USB_SERIAL_BELKIN is not set
580# CONFIG_USB_SERIAL_WHITEHEAT is not set
581# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set
582# CONFIG_USB_SERIAL_EMPEG is not set
583# CONFIG_USB_SERIAL_FTDI_SIO is not set
584CONFIG_USB_SERIAL_VISOR=m
585# CONFIG_USB_SERIAL_IPAQ is not set
586# CONFIG_USB_SERIAL_IR is not set
587# CONFIG_USB_SERIAL_EDGEPORT is not set
588# CONFIG_USB_SERIAL_EDGEPORT_TI is not set
589# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set
590# CONFIG_USB_SERIAL_KEYSPAN is not set
591# CONFIG_USB_SERIAL_KLSI is not set
592# CONFIG_USB_SERIAL_KOBIL_SCT is not set
593# CONFIG_USB_SERIAL_MCT_U232 is not set
594# CONFIG_USB_SERIAL_PL2303 is not set
595# CONFIG_USB_SERIAL_SAFE is not set
596# CONFIG_USB_SERIAL_CYBERJACK is not set
597# CONFIG_USB_SERIAL_XIRCOM is not set
598# CONFIG_USB_SERIAL_OMNINET is not set
599
600#
601# USB Miscellaneous drivers
602#
603# CONFIG_USB_EMI62 is not set
604# CONFIG_USB_EMI26 is not set
605# CONFIG_USB_TIGL is not set
606# CONFIG_USB_AUERSWALD is not set
607# CONFIG_USB_RIO500 is not set
608# CONFIG_USB_LEGOTOWER is not set
609# CONFIG_USB_LCD is not set
610# CONFIG_USB_LED is not set
611# CONFIG_USB_CYTHERM is not set
612# CONFIG_USB_PHIDGETSERVO is not set
613# CONFIG_USB_TEST is not set
614
615#
616# USB Gadget Support
617#
618# CONFIG_USB_GADGET is not set
619
620#
621# File systems
622#
623CONFIG_EXT2_FS=y
624# CONFIG_EXT2_FS_XATTR is not set
625CONFIG_EXT3_FS=y
626CONFIG_EXT3_FS_XATTR=y
627# CONFIG_EXT3_FS_POSIX_ACL is not set
628# CONFIG_EXT3_FS_SECURITY is not set
629CONFIG_JBD=y
630# CONFIG_JBD_DEBUG is not set
631CONFIG_FS_MBCACHE=y
632# CONFIG_REISERFS_FS is not set
633# CONFIG_JFS_FS is not set
634# CONFIG_XFS_FS is not set
635# CONFIG_MINIX_FS is not set
636# CONFIG_ROMFS_FS is not set
637# CONFIG_QUOTA is not set
638# CONFIG_AUTOFS_FS is not set
639# CONFIG_AUTOFS4_FS is not set
640
641#
642# CD-ROM/DVD Filesystems
643#
644CONFIG_ISO9660_FS=y
645# CONFIG_JOLIET is not set
646# CONFIG_ZISOFS is not set
647# CONFIG_UDF_FS is not set
648
649#
650# DOS/FAT/NT Filesystems
651#
652# CONFIG_FAT_FS is not set
653# CONFIG_NTFS_FS is not set
654
655#
656# Pseudo filesystems
657#
658CONFIG_PROC_FS=y
659CONFIG_PROC_KCORE=y
660CONFIG_SYSFS=y
661# CONFIG_DEVFS_FS is not set
662# CONFIG_DEVPTS_FS_XATTR is not set
663CONFIG_TMPFS=y
664# CONFIG_HUGETLB_PAGE is not set
665CONFIG_RAMFS=y
666
667#
668# Miscellaneous filesystems
669#
670# CONFIG_ADFS_FS is not set
671# CONFIG_AFFS_FS is not set
672# CONFIG_HFS_FS is not set
673# CONFIG_HFSPLUS_FS is not set
674# CONFIG_BEFS_FS is not set
675# CONFIG_BFS_FS is not set
676# CONFIG_EFS_FS is not set
677# CONFIG_CRAMFS is not set
678# CONFIG_VXFS_FS is not set
679# CONFIG_HPFS_FS is not set
680# CONFIG_QNX4FS_FS is not set
681# CONFIG_SYSV_FS is not set
682# CONFIG_UFS_FS is not set
683
684#
685# Network File Systems
686#
687CONFIG_NFS_FS=y
688CONFIG_NFS_V3=y
689# CONFIG_NFS_V4 is not set
690# CONFIG_NFS_DIRECTIO is not set
691# CONFIG_NFSD is not set
692CONFIG_ROOT_NFS=y
693CONFIG_LOCKD=y
694CONFIG_LOCKD_V4=y
695# CONFIG_EXPORTFS is not set
696CONFIG_SUNRPC=y
697# CONFIG_RPCSEC_GSS_KRB5 is not set
698# CONFIG_SMB_FS is not set
699# CONFIG_CIFS is not set
700# CONFIG_NCP_FS is not set
701# CONFIG_CODA_FS is not set
702# CONFIG_AFS_FS is not set
703
704#
705# Partition Types
706#
707# CONFIG_PARTITION_ADVANCED is not set
708CONFIG_MSDOS_PARTITION=y
709
710#
711# Native Language Support
712#
713# CONFIG_NLS is not set
714
715#
716# Library routines
717#
718CONFIG_CRC32=y
719# CONFIG_LIBCRC32C is not set
720CONFIG_ZLIB_INFLATE=m
721CONFIG_ZLIB_DEFLATE=m
722
723#
724# Kernel hacking
725#
726# CONFIG_DEBUG_KERNEL is not set
727# CONFIG_SERIAL_TEXT_DEBUG is not set
728
729#
730# Security options
731#
732# CONFIG_SECURITY is not set
733
734#
735# Cryptographic options
736#
737# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/spruce_defconfig b/arch/ppc/configs/spruce_defconfig
new file mode 100644
index 000000000000..430dd9c59feb
--- /dev/null
+++ b/arch/ppc/configs/spruce_defconfig
@@ -0,0 +1,577 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7CONFIG_PPC=y
8CONFIG_PPC32=y
9CONFIG_GENERIC_NVRAM=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_STANDALONE=y
17CONFIG_BROKEN_ON_SMP=y
18
19#
20# General setup
21#
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24CONFIG_POSIX_MQUEUE=y
25# CONFIG_BSD_PROCESS_ACCT is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=14
29# CONFIG_HOTPLUG is not set
30# CONFIG_IKCONFIG is not set
31CONFIG_EMBEDDED=y
32CONFIG_KALLSYMS=y
33CONFIG_FUTEX=y
34CONFIG_EPOLL=y
35CONFIG_IOSCHED_NOOP=y
36CONFIG_IOSCHED_AS=y
37CONFIG_IOSCHED_DEADLINE=y
38CONFIG_IOSCHED_CFQ=y
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
40
41#
42# Loadable module support
43#
44CONFIG_MODULES=y
45CONFIG_MODULE_UNLOAD=y
46# CONFIG_MODULE_FORCE_UNLOAD is not set
47CONFIG_OBSOLETE_MODPARM=y
48# CONFIG_MODVERSIONS is not set
49CONFIG_KMOD=y
50
51#
52# Processor
53#
54CONFIG_6xx=y
55# CONFIG_40x is not set
56# CONFIG_44x is not set
57# CONFIG_POWER3 is not set
58# CONFIG_POWER4 is not set
59# CONFIG_8xx is not set
60# CONFIG_ALTIVEC is not set
61# CONFIG_TAU is not set
62# CONFIG_CPU_FREQ is not set
63CONFIG_PPC_STD_MMU=y
64
65#
66# Platform options
67#
68# CONFIG_PPC_MULTIPLATFORM is not set
69# CONFIG_APUS is not set
70# CONFIG_WILLOW is not set
71# CONFIG_PCORE is not set
72# CONFIG_POWERPMC250 is not set
73# CONFIG_EV64260 is not set
74CONFIG_SPRUCE=y
75# CONFIG_LOPEC is not set
76# CONFIG_MCPN765 is not set
77# CONFIG_MVME5100 is not set
78# CONFIG_PPLUS is not set
79# CONFIG_PRPMC750 is not set
80# CONFIG_PRPMC800 is not set
81# CONFIG_SANDPOINT is not set
82# CONFIG_ADIR is not set
83# CONFIG_K2 is not set
84# CONFIG_PAL4 is not set
85# CONFIG_GEMINI is not set
86# CONFIG_EST8260 is not set
87# CONFIG_SBS8260 is not set
88# CONFIG_RPX6 is not set
89# CONFIG_TQM8260 is not set
90CONFIG_PPC_GEN550=y
91CONFIG_SPRUCE_BAUD_33M=y
92# CONFIG_SMP is not set
93# CONFIG_PREEMPT is not set
94# CONFIG_HIGHMEM is not set
95CONFIG_KERNEL_ELF=y
96CONFIG_BINFMT_ELF=y
97# CONFIG_BINFMT_MISC is not set
98CONFIG_CMDLINE_BOOL=y
99CONFIG_CMDLINE="ip=on"
100
101#
102# Bus options
103#
104CONFIG_GENERIC_ISA_DMA=y
105CONFIG_PCI=y
106CONFIG_PCI_DOMAINS=y
107CONFIG_PCI_LEGACY_PROC=y
108# CONFIG_PCI_NAMES is not set
109
110#
111# Advanced setup
112#
113# CONFIG_ADVANCED_OPTIONS is not set
114
115#
116# Default settings for advanced configuration options are used
117#
118CONFIG_HIGHMEM_START=0xfe000000
119CONFIG_LOWMEM_SIZE=0x30000000
120CONFIG_KERNEL_START=0xc0000000
121CONFIG_TASK_SIZE=0x80000000
122CONFIG_BOOT_LOAD=0x00800000
123
124#
125# Device Drivers
126#
127
128#
129# Generic Driver Options
130#
131
132#
133# Memory Technology Devices (MTD)
134#
135# CONFIG_MTD is not set
136
137#
138# Parallel port support
139#
140# CONFIG_PARPORT is not set
141
142#
143# Plug and Play support
144#
145
146#
147# Block devices
148#
149# CONFIG_BLK_DEV_FD is not set
150# CONFIG_BLK_CPQ_DA is not set
151# CONFIG_BLK_CPQ_CISS_DA is not set
152# CONFIG_BLK_DEV_DAC960 is not set
153# CONFIG_BLK_DEV_UMEM is not set
154# CONFIG_BLK_DEV_LOOP is not set
155# CONFIG_BLK_DEV_NBD is not set
156# CONFIG_BLK_DEV_CARMEL is not set
157# CONFIG_BLK_DEV_RAM is not set
158# CONFIG_LBD is not set
159
160#
161# ATA/ATAPI/MFM/RLL support
162#
163# CONFIG_IDE is not set
164
165#
166# SCSI device support
167#
168# CONFIG_SCSI is not set
169
170#
171# Multi-device support (RAID and LVM)
172#
173# CONFIG_MD is not set
174
175#
176# Fusion MPT device support
177#
178
179#
180# IEEE 1394 (FireWire) support
181#
182# CONFIG_IEEE1394 is not set
183
184#
185# I2O device support
186#
187# CONFIG_I2O is not set
188
189#
190# Macintosh device drivers
191#
192
193#
194# Networking support
195#
196CONFIG_NET=y
197
198#
199# Networking options
200#
201CONFIG_PACKET=y
202# CONFIG_PACKET_MMAP is not set
203# CONFIG_NETLINK_DEV is not set
204CONFIG_UNIX=y
205# CONFIG_NET_KEY is not set
206CONFIG_INET=y
207# CONFIG_IP_MULTICAST is not set
208# CONFIG_IP_ADVANCED_ROUTER is not set
209CONFIG_IP_PNP=y
210CONFIG_IP_PNP_DHCP=y
211# CONFIG_IP_PNP_BOOTP is not set
212# CONFIG_IP_PNP_RARP is not set
213# CONFIG_NET_IPIP is not set
214# CONFIG_NET_IPGRE is not set
215# CONFIG_ARPD is not set
216# CONFIG_SYN_COOKIES is not set
217# CONFIG_INET_AH is not set
218# CONFIG_INET_ESP is not set
219# CONFIG_INET_IPCOMP is not set
220# CONFIG_IPV6 is not set
221# CONFIG_NETFILTER is not set
222
223#
224# SCTP Configuration (EXPERIMENTAL)
225#
226# CONFIG_IP_SCTP is not set
227# CONFIG_ATM is not set
228# CONFIG_BRIDGE is not set
229# CONFIG_VLAN_8021Q is not set
230# CONFIG_DECNET is not set
231# CONFIG_LLC2 is not set
232# CONFIG_IPX is not set
233# CONFIG_ATALK is not set
234# CONFIG_X25 is not set
235# CONFIG_LAPB is not set
236# CONFIG_NET_DIVERT is not set
237# CONFIG_ECONET is not set
238# CONFIG_WAN_ROUTER is not set
239# CONFIG_NET_HW_FLOWCONTROL is not set
240
241#
242# QoS and/or fair queueing
243#
244# CONFIG_NET_SCHED is not set
245
246#
247# Network testing
248#
249# CONFIG_NET_PKTGEN is not set
250# CONFIG_NETPOLL is not set
251# CONFIG_NET_POLL_CONTROLLER is not set
252# CONFIG_HAMRADIO is not set
253# CONFIG_IRDA is not set
254# CONFIG_BT is not set
255CONFIG_NETDEVICES=y
256# CONFIG_DUMMY is not set
257# CONFIG_BONDING is not set
258# CONFIG_EQUALIZER is not set
259# CONFIG_TUN is not set
260
261#
262# ARCnet devices
263#
264# CONFIG_ARCNET is not set
265
266#
267# Ethernet (10 or 100Mbit)
268#
269CONFIG_NET_ETHERNET=y
270CONFIG_MII=y
271# CONFIG_OAKNET is not set
272# CONFIG_HAPPYMEAL is not set
273# CONFIG_SUNGEM is not set
274# CONFIG_NET_VENDOR_3COM is not set
275
276#
277# Tulip family network device support
278#
279# CONFIG_NET_TULIP is not set
280# CONFIG_HP100 is not set
281CONFIG_NET_PCI=y
282CONFIG_PCNET32=y
283# CONFIG_AMD8111_ETH is not set
284# CONFIG_ADAPTEC_STARFIRE is not set
285# CONFIG_B44 is not set
286# CONFIG_FORCEDETH is not set
287# CONFIG_DGRS is not set
288# CONFIG_EEPRO100 is not set
289# CONFIG_E100 is not set
290# CONFIG_FEALNX is not set
291# CONFIG_NATSEMI is not set
292# CONFIG_NE2K_PCI is not set
293# CONFIG_8139CP is not set
294# CONFIG_8139TOO is not set
295# CONFIG_SIS900 is not set
296# CONFIG_EPIC100 is not set
297# CONFIG_SUNDANCE is not set
298# CONFIG_TLAN is not set
299# CONFIG_VIA_RHINE is not set
300
301#
302# Ethernet (1000 Mbit)
303#
304# CONFIG_ACENIC is not set
305# CONFIG_DL2K is not set
306# CONFIG_E1000 is not set
307# CONFIG_NS83820 is not set
308# CONFIG_HAMACHI is not set
309# CONFIG_YELLOWFIN is not set
310# CONFIG_R8169 is not set
311# CONFIG_SK98LIN is not set
312# CONFIG_TIGON3 is not set
313
314#
315# Ethernet (10000 Mbit)
316#
317# CONFIG_IXGB is not set
318# CONFIG_S2IO is not set
319
320#
321# Token Ring devices
322#
323# CONFIG_TR is not set
324
325#
326# Wireless LAN (non-hamradio)
327#
328# CONFIG_NET_RADIO is not set
329
330#
331# Wan interfaces
332#
333# CONFIG_WAN is not set
334# CONFIG_FDDI is not set
335# CONFIG_HIPPI is not set
336# CONFIG_PPP is not set
337# CONFIG_SLIP is not set
338# CONFIG_RCPCI is not set
339# CONFIG_SHAPER is not set
340# CONFIG_NETCONSOLE is not set
341
342#
343# ISDN subsystem
344#
345# CONFIG_ISDN is not set
346
347#
348# Telephony Support
349#
350# CONFIG_PHONE is not set
351
352#
353# Input device support
354#
355# CONFIG_INPUT is not set
356
357#
358# Userland interfaces
359#
360
361#
362# Input I/O drivers
363#
364# CONFIG_GAMEPORT is not set
365CONFIG_SOUND_GAMEPORT=y
366CONFIG_SERIO=y
367CONFIG_SERIO_I8042=y
368CONFIG_SERIO_SERPORT=y
369# CONFIG_SERIO_CT82C710 is not set
370CONFIG_SERIO_PCIPS2=y
371
372#
373# Input Device Drivers
374#
375
376#
377# Character devices
378#
379# CONFIG_VT is not set
380# CONFIG_SERIAL_NONSTANDARD is not set
381
382#
383# Serial drivers
384#
385CONFIG_SERIAL_8250=y
386CONFIG_SERIAL_8250_CONSOLE=y
387CONFIG_SERIAL_8250_NR_UARTS=2
388# CONFIG_SERIAL_8250_EXTENDED is not set
389
390#
391# Non-8250 serial port support
392#
393CONFIG_SERIAL_CORE=y
394CONFIG_SERIAL_CORE_CONSOLE=y
395CONFIG_UNIX98_PTYS=y
396CONFIG_LEGACY_PTYS=y
397CONFIG_LEGACY_PTY_COUNT=256
398# CONFIG_QIC02_TAPE is not set
399
400#
401# IPMI
402#
403# CONFIG_IPMI_HANDLER is not set
404
405#
406# Watchdog Cards
407#
408# CONFIG_WATCHDOG is not set
409# CONFIG_NVRAM is not set
410CONFIG_GEN_RTC=y
411# CONFIG_GEN_RTC_X is not set
412# CONFIG_DTLK is not set
413# CONFIG_R3964 is not set
414# CONFIG_APPLICOM is not set
415
416#
417# Ftape, the floppy tape device driver
418#
419# CONFIG_FTAPE is not set
420# CONFIG_AGP is not set
421# CONFIG_DRM is not set
422# CONFIG_RAW_DRIVER is not set
423
424#
425# I2C support
426#
427# CONFIG_I2C is not set
428
429#
430# Misc devices
431#
432
433#
434# Multimedia devices
435#
436# CONFIG_VIDEO_DEV is not set
437
438#
439# Digital Video Broadcasting Devices
440#
441# CONFIG_DVB is not set
442
443#
444# Graphics support
445#
446# CONFIG_FB is not set
447
448#
449# Sound
450#
451# CONFIG_SOUND is not set
452
453#
454# USB support
455#
456# CONFIG_USB is not set
457
458#
459# USB Gadget Support
460#
461# CONFIG_USB_GADGET is not set
462
463#
464# File systems
465#
466CONFIG_EXT2_FS=y
467# CONFIG_EXT2_FS_XATTR is not set
468CONFIG_EXT3_FS=y
469CONFIG_EXT3_FS_XATTR=y
470# CONFIG_EXT3_FS_POSIX_ACL is not set
471# CONFIG_EXT3_FS_SECURITY is not set
472CONFIG_JBD=y
473# CONFIG_JBD_DEBUG is not set
474CONFIG_FS_MBCACHE=y
475# CONFIG_REISERFS_FS is not set
476# CONFIG_JFS_FS is not set
477# CONFIG_XFS_FS is not set
478# CONFIG_MINIX_FS is not set
479# CONFIG_ROMFS_FS is not set
480# CONFIG_QUOTA is not set
481# CONFIG_AUTOFS_FS is not set
482# CONFIG_AUTOFS4_FS is not set
483
484#
485# CD-ROM/DVD Filesystems
486#
487CONFIG_ISO9660_FS=y
488# CONFIG_JOLIET is not set
489# CONFIG_ZISOFS is not set
490# CONFIG_UDF_FS is not set
491
492#
493# DOS/FAT/NT Filesystems
494#
495# CONFIG_FAT_FS is not set
496# CONFIG_NTFS_FS is not set
497
498#
499# Pseudo filesystems
500#
501CONFIG_PROC_FS=y
502CONFIG_PROC_KCORE=y
503CONFIG_SYSFS=y
504# CONFIG_DEVFS_FS is not set
505# CONFIG_DEVPTS_FS_XATTR is not set
506CONFIG_TMPFS=y
507# CONFIG_HUGETLB_PAGE is not set
508CONFIG_RAMFS=y
509
510#
511# Miscellaneous filesystems
512#
513# CONFIG_ADFS_FS is not set
514# CONFIG_AFFS_FS is not set
515# CONFIG_HFS_FS is not set
516# CONFIG_HFSPLUS_FS is not set
517# CONFIG_BEFS_FS is not set
518# CONFIG_BFS_FS is not set
519# CONFIG_EFS_FS is not set
520# CONFIG_CRAMFS is not set
521# CONFIG_VXFS_FS is not set
522# CONFIG_HPFS_FS is not set
523# CONFIG_QNX4FS_FS is not set
524# CONFIG_SYSV_FS is not set
525# CONFIG_UFS_FS is not set
526
527#
528# Network File Systems
529#
530CONFIG_NFS_FS=y
531# CONFIG_NFS_V3 is not set
532# CONFIG_NFS_V4 is not set
533# CONFIG_NFS_DIRECTIO is not set
534# CONFIG_NFSD is not set
535CONFIG_ROOT_NFS=y
536CONFIG_LOCKD=y
537# CONFIG_EXPORTFS is not set
538CONFIG_SUNRPC=y
539# CONFIG_RPCSEC_GSS_KRB5 is not set
540# CONFIG_SMB_FS is not set
541# CONFIG_CIFS is not set
542# CONFIG_NCP_FS is not set
543# CONFIG_CODA_FS is not set
544# CONFIG_AFS_FS is not set
545
546#
547# Partition Types
548#
549# CONFIG_PARTITION_ADVANCED is not set
550CONFIG_MSDOS_PARTITION=y
551
552#
553# Native Language Support
554#
555# CONFIG_NLS is not set
556
557#
558# Library routines
559#
560CONFIG_CRC32=y
561# CONFIG_LIBCRC32C is not set
562
563#
564# Kernel hacking
565#
566# CONFIG_DEBUG_KERNEL is not set
567# CONFIG_SERIAL_TEXT_DEBUG is not set
568
569#
570# Security options
571#
572# CONFIG_SECURITY is not set
573
574#
575# Cryptographic options
576#
577# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/stx_gp3_defconfig b/arch/ppc/configs/stx_gp3_defconfig
new file mode 100644
index 000000000000..66dae8367659
--- /dev/null
+++ b/arch/ppc/configs/stx_gp3_defconfig
@@ -0,0 +1,972 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc2
4# Wed Jan 26 14:32:58 2005
5#
6CONFIG_MMU=y
7CONFIG_GENERIC_HARDIRQS=y
8CONFIG_RWSEM_XCHGADD_ALGORITHM=y
9CONFIG_GENERIC_CALIBRATE_DELAY=y
10CONFIG_HAVE_DEC_LOCK=y
11CONFIG_PPC=y
12CONFIG_PPC32=y
13CONFIG_GENERIC_NVRAM=y
14
15#
16# Code maturity level options
17#
18CONFIG_EXPERIMENTAL=y
19CONFIG_CLEAN_COMPILE=y
20CONFIG_BROKEN_ON_SMP=y
21
22#
23# General setup
24#
25CONFIG_LOCALVERSION=""
26CONFIG_SWAP=y
27CONFIG_SYSVIPC=y
28# CONFIG_POSIX_MQUEUE is not set
29# CONFIG_BSD_PROCESS_ACCT is not set
30CONFIG_SYSCTL=y
31# CONFIG_AUDIT is not set
32CONFIG_LOG_BUF_SHIFT=14
33CONFIG_HOTPLUG=y
34CONFIG_KOBJECT_UEVENT=y
35# CONFIG_IKCONFIG is not set
36CONFIG_EMBEDDED=y
37CONFIG_KALLSYMS=y
38# CONFIG_KALLSYMS_ALL is not set
39# CONFIG_KALLSYMS_EXTRA_PASS is not set
40CONFIG_FUTEX=y
41CONFIG_EPOLL=y
42# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
43CONFIG_SHMEM=y
44CONFIG_CC_ALIGN_FUNCTIONS=0
45CONFIG_CC_ALIGN_LABELS=0
46CONFIG_CC_ALIGN_LOOPS=0
47CONFIG_CC_ALIGN_JUMPS=0
48# CONFIG_TINY_SHMEM is not set
49
50#
51# Loadable module support
52#
53CONFIG_MODULES=y
54# CONFIG_MODULE_UNLOAD is not set
55CONFIG_OBSOLETE_MODPARM=y
56CONFIG_MODVERSIONS=y
57# CONFIG_MODULE_SRCVERSION_ALL is not set
58CONFIG_KMOD=y
59
60#
61# Processor
62#
63# CONFIG_6xx is not set
64# CONFIG_40x is not set
65# CONFIG_44x is not set
66# CONFIG_POWER3 is not set
67# CONFIG_POWER4 is not set
68# CONFIG_8xx is not set
69CONFIG_E500=y
70CONFIG_BOOKE=y
71CONFIG_FSL_BOOKE=y
72# CONFIG_SPE is not set
73CONFIG_MATH_EMULATION=y
74# CONFIG_CPU_FREQ is not set
75CONFIG_85xx=y
76CONFIG_PPC_INDIRECT_PCI_BE=y
77
78#
79# Freescale 85xx options
80#
81# CONFIG_MPC8540_ADS is not set
82# CONFIG_MPC8555_CDS is not set
83# CONFIG_MPC8560_ADS is not set
84# CONFIG_SBC8560 is not set
85CONFIG_STX_GP3=y
86CONFIG_MPC8560=y
87
88#
89# Platform options
90#
91CONFIG_CPM2=y
92# CONFIG_PC_KEYBOARD is not set
93# CONFIG_SMP is not set
94# CONFIG_PREEMPT is not set
95CONFIG_HIGHMEM=y
96CONFIG_BINFMT_ELF=y
97CONFIG_BINFMT_MISC=m
98# CONFIG_CMDLINE_BOOL is not set
99
100#
101# Bus options
102#
103CONFIG_PCI=y
104CONFIG_PCI_DOMAINS=y
105# CONFIG_PCI_LEGACY_PROC is not set
106# CONFIG_PCI_NAMES is not set
107
108#
109# PCCARD (PCMCIA/CardBus) support
110#
111# CONFIG_PCCARD is not set
112
113#
114# PC-card bridges
115#
116
117#
118# Advanced setup
119#
120# CONFIG_ADVANCED_OPTIONS is not set
121
122#
123# Default settings for advanced configuration options are used
124#
125CONFIG_HIGHMEM_START=0xfe000000
126CONFIG_LOWMEM_SIZE=0x30000000
127CONFIG_KERNEL_START=0xc0000000
128CONFIG_TASK_SIZE=0x80000000
129CONFIG_BOOT_LOAD=0x00800000
130
131#
132# Device Drivers
133#
134
135#
136# Generic Driver Options
137#
138CONFIG_STANDALONE=y
139CONFIG_PREVENT_FIRMWARE_BUILD=y
140# CONFIG_FW_LOADER is not set
141# CONFIG_DEBUG_DRIVER is not set
142
143#
144# Memory Technology Devices (MTD)
145#
146# CONFIG_MTD is not set
147
148#
149# Parallel port support
150#
151CONFIG_PARPORT=m
152CONFIG_PARPORT_PC=m
153# CONFIG_PARPORT_PC_FIFO is not set
154# CONFIG_PARPORT_PC_SUPERIO is not set
155# CONFIG_PARPORT_OTHER is not set
156# CONFIG_PARPORT_1284 is not set
157
158#
159# Plug and Play support
160#
161
162#
163# Block devices
164#
165# CONFIG_BLK_DEV_FD is not set
166# CONFIG_PARIDE is not set
167# CONFIG_BLK_CPQ_DA is not set
168# CONFIG_BLK_CPQ_CISS_DA is not set
169# CONFIG_BLK_DEV_DAC960 is not set
170# CONFIG_BLK_DEV_UMEM is not set
171# CONFIG_BLK_DEV_COW_COMMON is not set
172CONFIG_BLK_DEV_LOOP=m
173# CONFIG_BLK_DEV_CRYPTOLOOP is not set
174CONFIG_BLK_DEV_NBD=m
175# CONFIG_BLK_DEV_SX8 is not set
176CONFIG_BLK_DEV_RAM=m
177CONFIG_BLK_DEV_RAM_COUNT=16
178CONFIG_BLK_DEV_RAM_SIZE=4096
179CONFIG_INITRAMFS_SOURCE=""
180# CONFIG_LBD is not set
181# CONFIG_CDROM_PKTCDVD is not set
182
183#
184# IO Schedulers
185#
186CONFIG_IOSCHED_NOOP=y
187CONFIG_IOSCHED_AS=y
188CONFIG_IOSCHED_DEADLINE=y
189CONFIG_IOSCHED_CFQ=y
190# CONFIG_ATA_OVER_ETH is not set
191
192#
193# ATA/ATAPI/MFM/RLL support
194#
195CONFIG_IDE=y
196CONFIG_BLK_DEV_IDE=y
197
198#
199# Please see Documentation/ide.txt for help/info on IDE drives
200#
201# CONFIG_BLK_DEV_IDE_SATA is not set
202CONFIG_BLK_DEV_IDEDISK=y
203# CONFIG_IDEDISK_MULTI_MODE is not set
204CONFIG_BLK_DEV_IDECD=m
205# CONFIG_BLK_DEV_IDETAPE is not set
206# CONFIG_BLK_DEV_IDEFLOPPY is not set
207# CONFIG_BLK_DEV_IDESCSI is not set
208# CONFIG_IDE_TASK_IOCTL is not set
209
210#
211# IDE chipset support/bugfixes
212#
213CONFIG_IDE_GENERIC=y
214# CONFIG_BLK_DEV_IDEPCI is not set
215# CONFIG_IDE_ARM is not set
216# CONFIG_BLK_DEV_IDEDMA is not set
217# CONFIG_IDEDMA_AUTO is not set
218# CONFIG_BLK_DEV_HD is not set
219
220#
221# SCSI device support
222#
223CONFIG_SCSI=m
224CONFIG_SCSI_PROC_FS=y
225
226#
227# SCSI support type (disk, tape, CD-ROM)
228#
229CONFIG_BLK_DEV_SD=m
230CONFIG_CHR_DEV_ST=m
231# CONFIG_CHR_DEV_OSST is not set
232CONFIG_BLK_DEV_SR=m
233# CONFIG_BLK_DEV_SR_VENDOR is not set
234CONFIG_CHR_DEV_SG=m
235
236#
237# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
238#
239CONFIG_SCSI_MULTI_LUN=y
240CONFIG_SCSI_CONSTANTS=y
241# CONFIG_SCSI_LOGGING is not set
242
243#
244# SCSI Transport Attributes
245#
246# CONFIG_SCSI_SPI_ATTRS is not set
247# CONFIG_SCSI_FC_ATTRS is not set
248# CONFIG_SCSI_ISCSI_ATTRS is not set
249
250#
251# SCSI low-level drivers
252#
253# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
254# CONFIG_SCSI_3W_9XXX is not set
255# CONFIG_SCSI_ACARD is not set
256# CONFIG_SCSI_AACRAID is not set
257# CONFIG_SCSI_AIC7XXX is not set
258# CONFIG_SCSI_AIC7XXX_OLD is not set
259# CONFIG_SCSI_AIC79XX is not set
260# CONFIG_SCSI_DPT_I2O is not set
261# CONFIG_MEGARAID_NEWGEN is not set
262# CONFIG_MEGARAID_LEGACY is not set
263# CONFIG_SCSI_SATA is not set
264# CONFIG_SCSI_BUSLOGIC is not set
265# CONFIG_SCSI_DMX3191D is not set
266# CONFIG_SCSI_EATA is not set
267# CONFIG_SCSI_EATA_PIO is not set
268# CONFIG_SCSI_FUTURE_DOMAIN is not set
269# CONFIG_SCSI_GDTH is not set
270# CONFIG_SCSI_IPS is not set
271# CONFIG_SCSI_INITIO is not set
272# CONFIG_SCSI_INIA100 is not set
273# CONFIG_SCSI_PPA is not set
274# CONFIG_SCSI_IMM is not set
275# CONFIG_SCSI_SYM53C8XX_2 is not set
276# CONFIG_SCSI_IPR is not set
277# CONFIG_SCSI_QLOGIC_ISP is not set
278# CONFIG_SCSI_QLOGIC_FC is not set
279# CONFIG_SCSI_QLOGIC_1280 is not set
280CONFIG_SCSI_QLA2XXX=m
281# CONFIG_SCSI_QLA21XX is not set
282# CONFIG_SCSI_QLA22XX is not set
283# CONFIG_SCSI_QLA2300 is not set
284# CONFIG_SCSI_QLA2322 is not set
285# CONFIG_SCSI_QLA6312 is not set
286# CONFIG_SCSI_DC395x is not set
287# CONFIG_SCSI_DC390T is not set
288# CONFIG_SCSI_NSP32 is not set
289# CONFIG_SCSI_DEBUG is not set
290
291#
292# Multi-device support (RAID and LVM)
293#
294# CONFIG_MD is not set
295
296#
297# Fusion MPT device support
298#
299# CONFIG_FUSION is not set
300
301#
302# IEEE 1394 (FireWire) support
303#
304# CONFIG_IEEE1394 is not set
305
306#
307# I2O device support
308#
309# CONFIG_I2O is not set
310
311#
312# Macintosh device drivers
313#
314
315#
316# Networking support
317#
318CONFIG_NET=y
319
320#
321# Networking options
322#
323CONFIG_PACKET=y
324# CONFIG_PACKET_MMAP is not set
325# CONFIG_NETLINK_DEV is not set
326CONFIG_UNIX=y
327# CONFIG_NET_KEY is not set
328CONFIG_INET=y
329# CONFIG_IP_MULTICAST is not set
330# CONFIG_IP_ADVANCED_ROUTER is not set
331CONFIG_IP_PNP=y
332# CONFIG_IP_PNP_DHCP is not set
333CONFIG_IP_PNP_BOOTP=y
334# CONFIG_IP_PNP_RARP is not set
335# CONFIG_NET_IPIP is not set
336# CONFIG_NET_IPGRE is not set
337# CONFIG_ARPD is not set
338# CONFIG_SYN_COOKIES is not set
339# CONFIG_INET_AH is not set
340# CONFIG_INET_ESP is not set
341# CONFIG_INET_IPCOMP is not set
342# CONFIG_INET_TUNNEL is not set
343CONFIG_IP_TCPDIAG=y
344# CONFIG_IP_TCPDIAG_IPV6 is not set
345
346#
347# IP: Virtual Server Configuration
348#
349# CONFIG_IP_VS is not set
350# CONFIG_IPV6 is not set
351CONFIG_NETFILTER=y
352# CONFIG_NETFILTER_DEBUG is not set
353
354#
355# IP: Netfilter Configuration
356#
357CONFIG_IP_NF_CONNTRACK=m
358# CONFIG_IP_NF_CT_ACCT is not set
359# CONFIG_IP_NF_CONNTRACK_MARK is not set
360# CONFIG_IP_NF_CT_PROTO_SCTP is not set
361CONFIG_IP_NF_FTP=m
362CONFIG_IP_NF_IRC=m
363# CONFIG_IP_NF_TFTP is not set
364# CONFIG_IP_NF_AMANDA is not set
365# CONFIG_IP_NF_QUEUE is not set
366CONFIG_IP_NF_IPTABLES=m
367# CONFIG_IP_NF_MATCH_LIMIT is not set
368# CONFIG_IP_NF_MATCH_IPRANGE is not set
369# CONFIG_IP_NF_MATCH_MAC is not set
370# CONFIG_IP_NF_MATCH_PKTTYPE is not set
371# CONFIG_IP_NF_MATCH_MARK is not set
372# CONFIG_IP_NF_MATCH_MULTIPORT is not set
373# CONFIG_IP_NF_MATCH_TOS is not set
374# CONFIG_IP_NF_MATCH_RECENT is not set
375# CONFIG_IP_NF_MATCH_ECN is not set
376# CONFIG_IP_NF_MATCH_DSCP is not set
377# CONFIG_IP_NF_MATCH_AH_ESP is not set
378# CONFIG_IP_NF_MATCH_LENGTH is not set
379# CONFIG_IP_NF_MATCH_TTL is not set
380# CONFIG_IP_NF_MATCH_TCPMSS is not set
381# CONFIG_IP_NF_MATCH_HELPER is not set
382# CONFIG_IP_NF_MATCH_STATE is not set
383# CONFIG_IP_NF_MATCH_CONNTRACK is not set
384# CONFIG_IP_NF_MATCH_OWNER is not set
385# CONFIG_IP_NF_MATCH_ADDRTYPE is not set
386# CONFIG_IP_NF_MATCH_REALM is not set
387# CONFIG_IP_NF_MATCH_SCTP is not set
388# CONFIG_IP_NF_MATCH_COMMENT is not set
389# CONFIG_IP_NF_MATCH_HASHLIMIT is not set
390CONFIG_IP_NF_FILTER=m
391# CONFIG_IP_NF_TARGET_REJECT is not set
392# CONFIG_IP_NF_TARGET_LOG is not set
393# CONFIG_IP_NF_TARGET_ULOG is not set
394# CONFIG_IP_NF_TARGET_TCPMSS is not set
395CONFIG_IP_NF_NAT=m
396CONFIG_IP_NF_NAT_NEEDED=y
397CONFIG_IP_NF_TARGET_MASQUERADE=m
398CONFIG_IP_NF_TARGET_REDIRECT=m
399# CONFIG_IP_NF_TARGET_NETMAP is not set
400# CONFIG_IP_NF_TARGET_SAME is not set
401CONFIG_IP_NF_NAT_SNMP_BASIC=m
402CONFIG_IP_NF_NAT_IRC=m
403CONFIG_IP_NF_NAT_FTP=m
404# CONFIG_IP_NF_MANGLE is not set
405# CONFIG_IP_NF_RAW is not set
406# CONFIG_IP_NF_ARPTABLES is not set
407
408#
409# SCTP Configuration (EXPERIMENTAL)
410#
411# CONFIG_IP_SCTP is not set
412# CONFIG_ATM is not set
413# CONFIG_BRIDGE is not set
414# CONFIG_VLAN_8021Q is not set
415# CONFIG_DECNET is not set
416# CONFIG_LLC2 is not set
417# CONFIG_IPX is not set
418# CONFIG_ATALK is not set
419# CONFIG_X25 is not set
420# CONFIG_LAPB is not set
421# CONFIG_NET_DIVERT is not set
422# CONFIG_ECONET is not set
423# CONFIG_WAN_ROUTER is not set
424
425#
426# QoS and/or fair queueing
427#
428# CONFIG_NET_SCHED is not set
429# CONFIG_NET_CLS_ROUTE is not set
430
431#
432# Network testing
433#
434# CONFIG_NET_PKTGEN is not set
435# CONFIG_NETPOLL is not set
436# CONFIG_NET_POLL_CONTROLLER is not set
437# CONFIG_HAMRADIO is not set
438# CONFIG_IRDA is not set
439# CONFIG_BT is not set
440CONFIG_NETDEVICES=y
441# CONFIG_DUMMY is not set
442# CONFIG_BONDING is not set
443# CONFIG_EQUALIZER is not set
444# CONFIG_TUN is not set
445
446#
447# ARCnet devices
448#
449# CONFIG_ARCNET is not set
450
451#
452# Ethernet (10 or 100Mbit)
453#
454CONFIG_NET_ETHERNET=y
455# CONFIG_MII is not set
456# CONFIG_HAPPYMEAL is not set
457# CONFIG_SUNGEM is not set
458# CONFIG_NET_VENDOR_3COM is not set
459
460#
461# Tulip family network device support
462#
463# CONFIG_NET_TULIP is not set
464# CONFIG_HP100 is not set
465# CONFIG_NET_PCI is not set
466
467#
468# Ethernet (1000 Mbit)
469#
470# CONFIG_ACENIC is not set
471# CONFIG_DL2K is not set
472# CONFIG_E1000 is not set
473# CONFIG_NS83820 is not set
474# CONFIG_HAMACHI is not set
475# CONFIG_YELLOWFIN is not set
476# CONFIG_R8169 is not set
477# CONFIG_SK98LIN is not set
478# CONFIG_TIGON3 is not set
479CONFIG_GIANFAR=y
480CONFIG_GFAR_NAPI=y
481
482#
483# Ethernet (10000 Mbit)
484#
485# CONFIG_IXGB is not set
486# CONFIG_S2IO is not set
487
488#
489# Token Ring devices
490#
491# CONFIG_TR is not set
492
493#
494# Wireless LAN (non-hamradio)
495#
496# CONFIG_NET_RADIO is not set
497
498#
499# Wan interfaces
500#
501# CONFIG_WAN is not set
502# CONFIG_FDDI is not set
503# CONFIG_HIPPI is not set
504# CONFIG_PLIP is not set
505# CONFIG_PPP is not set
506# CONFIG_SLIP is not set
507# CONFIG_NET_FC is not set
508# CONFIG_SHAPER is not set
509# CONFIG_NETCONSOLE is not set
510
511#
512# ISDN subsystem
513#
514# CONFIG_ISDN is not set
515
516#
517# Telephony Support
518#
519# CONFIG_PHONE is not set
520
521#
522# Input device support
523#
524CONFIG_INPUT=y
525
526#
527# Userland interfaces
528#
529CONFIG_INPUT_MOUSEDEV=y
530CONFIG_INPUT_MOUSEDEV_PSAUX=y
531CONFIG_INPUT_MOUSEDEV_SCREEN_X=1280
532CONFIG_INPUT_MOUSEDEV_SCREEN_Y=1024
533CONFIG_INPUT_JOYDEV=m
534# CONFIG_INPUT_TSDEV is not set
535CONFIG_INPUT_EVDEV=m
536# CONFIG_INPUT_EVBUG is not set
537
538#
539# Input I/O drivers
540#
541# CONFIG_GAMEPORT is not set
542CONFIG_SOUND_GAMEPORT=y
543CONFIG_SERIO=y
544CONFIG_SERIO_I8042=y
545CONFIG_SERIO_SERPORT=y
546# CONFIG_SERIO_CT82C710 is not set
547# CONFIG_SERIO_PARKBD is not set
548# CONFIG_SERIO_PCIPS2 is not set
549CONFIG_SERIO_LIBPS2=y
550# CONFIG_SERIO_RAW is not set
551
552#
553# Input Device Drivers
554#
555CONFIG_INPUT_KEYBOARD=y
556CONFIG_KEYBOARD_ATKBD=y
557# CONFIG_KEYBOARD_SUNKBD is not set
558# CONFIG_KEYBOARD_LKKBD is not set
559# CONFIG_KEYBOARD_XTKBD is not set
560# CONFIG_KEYBOARD_NEWTON is not set
561CONFIG_INPUT_MOUSE=y
562CONFIG_MOUSE_PS2=y
563# CONFIG_MOUSE_SERIAL is not set
564# CONFIG_MOUSE_VSXXXAA is not set
565# CONFIG_INPUT_JOYSTICK is not set
566# CONFIG_INPUT_TOUCHSCREEN is not set
567# CONFIG_INPUT_MISC is not set
568
569#
570# Character devices
571#
572# CONFIG_VT is not set
573# CONFIG_SERIAL_NONSTANDARD is not set
574
575#
576# Serial drivers
577#
578# CONFIG_SERIAL_8250 is not set
579
580#
581# Non-8250 serial port support
582#
583CONFIG_SERIAL_CORE=y
584CONFIG_SERIAL_CORE_CONSOLE=y
585CONFIG_SERIAL_CPM=y
586CONFIG_SERIAL_CPM_CONSOLE=y
587# CONFIG_SERIAL_CPM_SCC1 is not set
588CONFIG_SERIAL_CPM_SCC2=y
589# CONFIG_SERIAL_CPM_SCC3 is not set
590# CONFIG_SERIAL_CPM_SCC4 is not set
591# CONFIG_SERIAL_CPM_SMC1 is not set
592# CONFIG_SERIAL_CPM_SMC2 is not set
593CONFIG_UNIX98_PTYS=y
594CONFIG_LEGACY_PTYS=y
595CONFIG_LEGACY_PTY_COUNT=256
596CONFIG_PRINTER=m
597# CONFIG_LP_CONSOLE is not set
598# CONFIG_PPDEV is not set
599# CONFIG_TIPAR is not set
600
601#
602# IPMI
603#
604# CONFIG_IPMI_HANDLER is not set
605
606#
607# Watchdog Cards
608#
609# CONFIG_WATCHDOG is not set
610# CONFIG_NVRAM is not set
611# CONFIG_GEN_RTC is not set
612# CONFIG_DTLK is not set
613# CONFIG_R3964 is not set
614# CONFIG_APPLICOM is not set
615
616#
617# Ftape, the floppy tape device driver
618#
619CONFIG_AGP=m
620CONFIG_DRM=m
621# CONFIG_DRM_TDFX is not set
622# CONFIG_DRM_R128 is not set
623# CONFIG_DRM_RADEON is not set
624# CONFIG_DRM_MGA is not set
625# CONFIG_DRM_SIS is not set
626# CONFIG_RAW_DRIVER is not set
627
628#
629# I2C support
630#
631CONFIG_I2C=m
632CONFIG_I2C_CHARDEV=m
633
634#
635# I2C Algorithms
636#
637CONFIG_I2C_ALGOBIT=m
638# CONFIG_I2C_ALGOPCF is not set
639# CONFIG_I2C_ALGOPCA is not set
640
641#
642# I2C Hardware Bus support
643#
644# CONFIG_I2C_ALI1535 is not set
645# CONFIG_I2C_ALI1563 is not set
646# CONFIG_I2C_ALI15X3 is not set
647# CONFIG_I2C_AMD756 is not set
648# CONFIG_I2C_AMD8111 is not set
649# CONFIG_I2C_I801 is not set
650# CONFIG_I2C_I810 is not set
651# CONFIG_I2C_ISA is not set
652# CONFIG_I2C_MPC is not set
653# CONFIG_I2C_NFORCE2 is not set
654# CONFIG_I2C_PARPORT is not set
655# CONFIG_I2C_PARPORT_LIGHT is not set
656# CONFIG_I2C_PIIX4 is not set
657# CONFIG_I2C_PROSAVAGE is not set
658# CONFIG_I2C_SAVAGE4 is not set
659# CONFIG_SCx200_ACB is not set
660# CONFIG_I2C_SIS5595 is not set
661# CONFIG_I2C_SIS630 is not set
662# CONFIG_I2C_SIS96X is not set
663# CONFIG_I2C_STUB is not set
664# CONFIG_I2C_VIA is not set
665# CONFIG_I2C_VIAPRO is not set
666# CONFIG_I2C_VOODOO3 is not set
667# CONFIG_I2C_PCA_ISA is not set
668
669#
670# Hardware Sensors Chip support
671#
672# CONFIG_I2C_SENSOR is not set
673# CONFIG_SENSORS_ADM1021 is not set
674# CONFIG_SENSORS_ADM1025 is not set
675# CONFIG_SENSORS_ADM1026 is not set
676# CONFIG_SENSORS_ADM1031 is not set
677# CONFIG_SENSORS_ASB100 is not set
678# CONFIG_SENSORS_DS1621 is not set
679# CONFIG_SENSORS_FSCHER is not set
680# CONFIG_SENSORS_GL518SM is not set
681# CONFIG_SENSORS_IT87 is not set
682# CONFIG_SENSORS_LM63 is not set
683# CONFIG_SENSORS_LM75 is not set
684# CONFIG_SENSORS_LM77 is not set
685# CONFIG_SENSORS_LM78 is not set
686# CONFIG_SENSORS_LM80 is not set
687# CONFIG_SENSORS_LM83 is not set
688# CONFIG_SENSORS_LM85 is not set
689# CONFIG_SENSORS_LM87 is not set
690# CONFIG_SENSORS_LM90 is not set
691# CONFIG_SENSORS_MAX1619 is not set
692# CONFIG_SENSORS_PC87360 is not set
693# CONFIG_SENSORS_SMSC47B397 is not set
694# CONFIG_SENSORS_SMSC47M1 is not set
695# CONFIG_SENSORS_VIA686A is not set
696# CONFIG_SENSORS_W83781D is not set
697# CONFIG_SENSORS_W83L785TS is not set
698# CONFIG_SENSORS_W83627HF is not set
699
700#
701# Other I2C Chip support
702#
703# CONFIG_SENSORS_EEPROM is not set
704# CONFIG_SENSORS_PCF8574 is not set
705# CONFIG_SENSORS_PCF8591 is not set
706# CONFIG_SENSORS_RTC8564 is not set
707# CONFIG_I2C_DEBUG_CORE is not set
708# CONFIG_I2C_DEBUG_ALGO is not set
709# CONFIG_I2C_DEBUG_BUS is not set
710# CONFIG_I2C_DEBUG_CHIP is not set
711
712#
713# Dallas's 1-wire bus
714#
715# CONFIG_W1 is not set
716
717#
718# Misc devices
719#
720
721#
722# Multimedia devices
723#
724# CONFIG_VIDEO_DEV is not set
725
726#
727# Digital Video Broadcasting Devices
728#
729# CONFIG_DVB is not set
730
731#
732# Graphics support
733#
734# CONFIG_FB is not set
735# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
736
737#
738# Sound
739#
740CONFIG_SOUND=m
741
742#
743# Advanced Linux Sound Architecture
744#
745# CONFIG_SND is not set
746
747#
748# Open Sound System
749#
750# CONFIG_SOUND_PRIME is not set
751
752#
753# USB support
754#
755# CONFIG_USB is not set
756CONFIG_USB_ARCH_HAS_HCD=y
757CONFIG_USB_ARCH_HAS_OHCI=y
758
759#
760# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
761#
762
763#
764# USB Gadget Support
765#
766# CONFIG_USB_GADGET is not set
767
768#
769# MMC/SD Card support
770#
771# CONFIG_MMC is not set
772
773#
774# InfiniBand support
775#
776# CONFIG_INFINIBAND is not set
777
778#
779# File systems
780#
781CONFIG_EXT2_FS=y
782# CONFIG_EXT2_FS_XATTR is not set
783CONFIG_EXT3_FS=y
784CONFIG_EXT3_FS_XATTR=y
785# CONFIG_EXT3_FS_POSIX_ACL is not set
786# CONFIG_EXT3_FS_SECURITY is not set
787CONFIG_JBD=y
788CONFIG_JBD_DEBUG=y
789CONFIG_FS_MBCACHE=y
790# CONFIG_REISERFS_FS is not set
791# CONFIG_JFS_FS is not set
792# CONFIG_XFS_FS is not set
793# CONFIG_MINIX_FS is not set
794# CONFIG_ROMFS_FS is not set
795# CONFIG_QUOTA is not set
796CONFIG_DNOTIFY=y
797CONFIG_AUTOFS_FS=m
798CONFIG_AUTOFS4_FS=y
799
800#
801# CD-ROM/DVD Filesystems
802#
803CONFIG_ISO9660_FS=m
804# CONFIG_JOLIET is not set
805# CONFIG_ZISOFS is not set
806CONFIG_UDF_FS=m
807CONFIG_UDF_NLS=y
808
809#
810# DOS/FAT/NT Filesystems
811#
812CONFIG_FAT_FS=m
813CONFIG_MSDOS_FS=m
814CONFIG_VFAT_FS=m
815CONFIG_FAT_DEFAULT_CODEPAGE=437
816CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
817# CONFIG_NTFS_FS is not set
818
819#
820# Pseudo filesystems
821#
822CONFIG_PROC_FS=y
823# CONFIG_PROC_KCORE is not set
824CONFIG_SYSFS=y
825CONFIG_DEVFS_FS=y
826# CONFIG_DEVFS_MOUNT is not set
827# CONFIG_DEVFS_DEBUG is not set
828# CONFIG_DEVPTS_FS_XATTR is not set
829CONFIG_TMPFS=y
830# CONFIG_TMPFS_XATTR is not set
831# CONFIG_HUGETLB_PAGE is not set
832CONFIG_RAMFS=y
833
834#
835# Miscellaneous filesystems
836#
837# CONFIG_ADFS_FS is not set
838# CONFIG_AFFS_FS is not set
839# CONFIG_HFS_FS is not set
840# CONFIG_HFSPLUS_FS is not set
841# CONFIG_BEFS_FS is not set
842# CONFIG_BFS_FS is not set
843# CONFIG_EFS_FS is not set
844CONFIG_CRAMFS=m
845# CONFIG_VXFS_FS is not set
846# CONFIG_HPFS_FS is not set
847# CONFIG_QNX4FS_FS is not set
848# CONFIG_SYSV_FS is not set
849# CONFIG_UFS_FS is not set
850
851#
852# Network File Systems
853#
854CONFIG_NFS_FS=y
855CONFIG_NFS_V3=y
856# CONFIG_NFS_V4 is not set
857# CONFIG_NFS_DIRECTIO is not set
858# CONFIG_NFSD is not set
859CONFIG_ROOT_NFS=y
860CONFIG_LOCKD=y
861CONFIG_LOCKD_V4=y
862# CONFIG_EXPORTFS is not set
863CONFIG_SUNRPC=y
864# CONFIG_RPCSEC_GSS_KRB5 is not set
865# CONFIG_RPCSEC_GSS_SPKM3 is not set
866CONFIG_SMB_FS=m
867# CONFIG_SMB_NLS_DEFAULT is not set
868# CONFIG_CIFS is not set
869# CONFIG_NCP_FS is not set
870# CONFIG_CODA_FS is not set
871# CONFIG_AFS_FS is not set
872
873#
874# Partition Types
875#
876# CONFIG_PARTITION_ADVANCED is not set
877CONFIG_MSDOS_PARTITION=y
878
879#
880# Native Language Support
881#
882CONFIG_NLS=y
883CONFIG_NLS_DEFAULT="iso8859-1"
884# CONFIG_NLS_CODEPAGE_437 is not set
885# CONFIG_NLS_CODEPAGE_737 is not set
886# CONFIG_NLS_CODEPAGE_775 is not set
887# CONFIG_NLS_CODEPAGE_850 is not set
888# CONFIG_NLS_CODEPAGE_852 is not set
889# CONFIG_NLS_CODEPAGE_855 is not set
890# CONFIG_NLS_CODEPAGE_857 is not set
891# CONFIG_NLS_CODEPAGE_860 is not set
892# CONFIG_NLS_CODEPAGE_861 is not set
893# CONFIG_NLS_CODEPAGE_862 is not set
894# CONFIG_NLS_CODEPAGE_863 is not set
895# CONFIG_NLS_CODEPAGE_864 is not set
896# CONFIG_NLS_CODEPAGE_865 is not set
897# CONFIG_NLS_CODEPAGE_866 is not set
898# CONFIG_NLS_CODEPAGE_869 is not set
899# CONFIG_NLS_CODEPAGE_936 is not set
900# CONFIG_NLS_CODEPAGE_950 is not set
901# CONFIG_NLS_CODEPAGE_932 is not set
902# CONFIG_NLS_CODEPAGE_949 is not set
903# CONFIG_NLS_CODEPAGE_874 is not set
904# CONFIG_NLS_ISO8859_8 is not set
905# CONFIG_NLS_CODEPAGE_1250 is not set
906# CONFIG_NLS_CODEPAGE_1251 is not set
907# CONFIG_NLS_ASCII is not set
908# CONFIG_NLS_ISO8859_1 is not set
909# CONFIG_NLS_ISO8859_2 is not set
910# CONFIG_NLS_ISO8859_3 is not set
911# CONFIG_NLS_ISO8859_4 is not set
912# CONFIG_NLS_ISO8859_5 is not set
913# CONFIG_NLS_ISO8859_6 is not set
914# CONFIG_NLS_ISO8859_7 is not set
915# CONFIG_NLS_ISO8859_9 is not set
916# CONFIG_NLS_ISO8859_13 is not set
917# CONFIG_NLS_ISO8859_14 is not set
918# CONFIG_NLS_ISO8859_15 is not set
919# CONFIG_NLS_KOI8_R is not set
920# CONFIG_NLS_KOI8_U is not set
921# CONFIG_NLS_UTF8 is not set
922# CONFIG_SCC_ENET is not set
923# CONFIG_FEC_ENET is not set
924
925#
926# CPM2 Options
927#
928
929#
930# Library routines
931#
932CONFIG_CRC_CCITT=y
933CONFIG_CRC32=y
934# CONFIG_LIBCRC32C is not set
935CONFIG_ZLIB_INFLATE=m
936
937#
938# Profiling support
939#
940# CONFIG_PROFILING is not set
941
942#
943# Kernel hacking
944#
945CONFIG_DEBUG_KERNEL=y
946# CONFIG_MAGIC_SYSRQ is not set
947# CONFIG_SCHEDSTATS is not set
948# CONFIG_DEBUG_SLAB is not set
949# CONFIG_DEBUG_SPINLOCK is not set
950# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
951# CONFIG_DEBUG_KOBJECT is not set
952# CONFIG_DEBUG_HIGHMEM is not set
953# CONFIG_DEBUG_INFO is not set
954# CONFIG_DEBUG_FS is not set
955# CONFIG_KGDB_CONSOLE is not set
956# CONFIG_XMON is not set
957CONFIG_BDI_SWITCH=y
958
959#
960# Security options
961#
962# CONFIG_KEYS is not set
963# CONFIG_SECURITY is not set
964
965#
966# Cryptographic options
967#
968# CONFIG_CRYPTO is not set
969
970#
971# Hardware crypto devices
972#
diff --git a/arch/ppc/configs/sycamore_defconfig b/arch/ppc/configs/sycamore_defconfig
new file mode 100644
index 000000000000..758114cfea5c
--- /dev/null
+++ b/arch/ppc/configs/sycamore_defconfig
@@ -0,0 +1,664 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7CONFIG_PPC=y
8CONFIG_PPC32=y
9CONFIG_GENERIC_NVRAM=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_STANDALONE=y
17CONFIG_BROKEN_ON_SMP=y
18
19#
20# General setup
21#
22# CONFIG_SWAP is not set
23CONFIG_SYSVIPC=y
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26CONFIG_LOG_BUF_SHIFT=14
27# CONFIG_HOTPLUG is not set
28# CONFIG_IKCONFIG is not set
29CONFIG_EMBEDDED=y
30# CONFIG_KALLSYMS is not set
31CONFIG_FUTEX=y
32# CONFIG_EPOLL is not set
33CONFIG_IOSCHED_NOOP=y
34CONFIG_IOSCHED_AS=y
35CONFIG_IOSCHED_DEADLINE=y
36# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
37
38#
39# Loadable module support
40#
41CONFIG_MODULES=y
42CONFIG_MODULE_UNLOAD=y
43# CONFIG_MODULE_FORCE_UNLOAD is not set
44CONFIG_OBSOLETE_MODPARM=y
45CONFIG_MODVERSIONS=y
46CONFIG_KMOD=y
47
48#
49# Processor
50#
51# CONFIG_6xx is not set
52CONFIG_40x=y
53# CONFIG_44x is not set
54# CONFIG_POWER3 is not set
55# CONFIG_POWER4 is not set
56# CONFIG_8xx is not set
57# CONFIG_MATH_EMULATION is not set
58# CONFIG_CPU_FREQ is not set
59CONFIG_4xx=y
60
61#
62# IBM 4xx options
63#
64# CONFIG_ASH is not set
65# CONFIG_CPCI405 is not set
66# CONFIG_EP405 is not set
67# CONFIG_EVB405EP is not set
68# CONFIG_OAK is not set
69# CONFIG_REDWOOD_5 is not set
70# CONFIG_REDWOOD_6 is not set
71CONFIG_SYCAMORE=y
72# CONFIG_WALNUT is not set
73CONFIG_IBM_OCP=y
74CONFIG_PPC_OCP=y
75CONFIG_BIOS_FIXUP=y
76CONFIG_405GPR=y
77CONFIG_IBM_OPENBIOS=y
78# CONFIG_PM is not set
79CONFIG_UART0_TTYS0=y
80# CONFIG_UART0_TTYS1 is not set
81CONFIG_NOT_COHERENT_CACHE=y
82
83#
84# Platform options
85#
86# CONFIG_PC_KEYBOARD is not set
87# CONFIG_SMP is not set
88# CONFIG_PREEMPT is not set
89# CONFIG_HIGHMEM is not set
90CONFIG_KERNEL_ELF=y
91CONFIG_BINFMT_ELF=y
92# CONFIG_BINFMT_MISC is not set
93CONFIG_CMDLINE_BOOL=y
94CONFIG_CMDLINE="ip=on"
95
96#
97# Bus options
98#
99CONFIG_PCI=y
100CONFIG_PCI_DOMAINS=y
101# CONFIG_PCI_LEGACY_PROC is not set
102# CONFIG_PCI_NAMES is not set
103
104#
105# Advanced setup
106#
107# CONFIG_ADVANCED_OPTIONS is not set
108
109#
110# Default settings for advanced configuration options are used
111#
112CONFIG_HIGHMEM_START=0xfe000000
113CONFIG_LOWMEM_SIZE=0x30000000
114CONFIG_KERNEL_START=0xc0000000
115CONFIG_TASK_SIZE=0x80000000
116CONFIG_BOOT_LOAD=0x00400000
117
118#
119# Device Drivers
120#
121
122#
123# Generic Driver Options
124#
125
126#
127# Memory Technology Devices (MTD)
128#
129# CONFIG_MTD is not set
130
131#
132# Parallel port support
133#
134# CONFIG_PARPORT is not set
135
136#
137# Plug and Play support
138#
139
140#
141# Block devices
142#
143# CONFIG_BLK_DEV_FD is not set
144# CONFIG_BLK_CPQ_DA is not set
145# CONFIG_BLK_CPQ_CISS_DA is not set
146# CONFIG_BLK_DEV_DAC960 is not set
147# CONFIG_BLK_DEV_UMEM is not set
148CONFIG_BLK_DEV_LOOP=y
149# CONFIG_BLK_DEV_CRYPTOLOOP is not set
150# CONFIG_BLK_DEV_NBD is not set
151# CONFIG_BLK_DEV_CARMEL is not set
152CONFIG_BLK_DEV_RAM=y
153CONFIG_BLK_DEV_RAM_SIZE=4096
154CONFIG_BLK_DEV_INITRD=y
155# CONFIG_LBD is not set
156
157#
158# ATA/ATAPI/MFM/RLL support
159#
160# CONFIG_IDE is not set
161
162#
163# SCSI device support
164#
165# CONFIG_SCSI is not set
166
167#
168# Multi-device support (RAID and LVM)
169#
170# CONFIG_MD is not set
171
172#
173# Fusion MPT device support
174#
175# CONFIG_FUSION is not set
176
177#
178# IEEE 1394 (FireWire) support
179#
180# CONFIG_IEEE1394 is not set
181
182#
183# I2O device support
184#
185# CONFIG_I2O is not set
186
187#
188# Macintosh device drivers
189#
190
191#
192# Networking support
193#
194CONFIG_NET=y
195
196#
197# Networking options
198#
199# CONFIG_PACKET is not set
200# CONFIG_NETLINK_DEV is not set
201CONFIG_UNIX=y
202# CONFIG_NET_KEY is not set
203CONFIG_INET=y
204CONFIG_IP_MULTICAST=y
205# CONFIG_IP_ADVANCED_ROUTER is not set
206CONFIG_IP_PNP=y
207# CONFIG_IP_PNP_DHCP is not set
208CONFIG_IP_PNP_BOOTP=y
209# CONFIG_IP_PNP_RARP is not set
210# CONFIG_NET_IPIP is not set
211# CONFIG_NET_IPGRE is not set
212# CONFIG_IP_MROUTE is not set
213# CONFIG_ARPD is not set
214CONFIG_SYN_COOKIES=y
215# CONFIG_INET_AH is not set
216# CONFIG_INET_ESP is not set
217# CONFIG_INET_IPCOMP is not set
218# CONFIG_IPV6 is not set
219# CONFIG_DECNET is not set
220# CONFIG_BRIDGE is not set
221# CONFIG_NETFILTER is not set
222
223#
224# SCTP Configuration (EXPERIMENTAL)
225#
226# CONFIG_IP_SCTP is not set
227# CONFIG_ATM is not set
228# CONFIG_VLAN_8021Q is not set
229# CONFIG_LLC2 is not set
230# CONFIG_IPX is not set
231# CONFIG_ATALK is not set
232# CONFIG_X25 is not set
233# CONFIG_LAPB is not set
234# CONFIG_NET_DIVERT is not set
235# CONFIG_ECONET is not set
236# CONFIG_WAN_ROUTER is not set
237# CONFIG_NET_HW_FLOWCONTROL is not set
238
239#
240# QoS and/or fair queueing
241#
242# CONFIG_NET_SCHED is not set
243
244#
245# Network testing
246#
247# CONFIG_NET_PKTGEN is not set
248CONFIG_NETDEVICES=y
249
250#
251# ARCnet devices
252#
253# CONFIG_ARCNET is not set
254# CONFIG_DUMMY is not set
255# CONFIG_BONDING is not set
256# CONFIG_EQUALIZER is not set
257# CONFIG_TUN is not set
258
259#
260# Ethernet (10 or 100Mbit)
261#
262CONFIG_NET_ETHERNET=y
263CONFIG_MII=y
264# CONFIG_OAKNET is not set
265# CONFIG_HAPPYMEAL is not set
266# CONFIG_SUNGEM is not set
267# CONFIG_NET_VENDOR_3COM is not set
268
269#
270# Tulip family network device support
271#
272# CONFIG_NET_TULIP is not set
273# CONFIG_HP100 is not set
274# CONFIG_NET_PCI is not set
275
276#
277# Ethernet (1000 Mbit)
278#
279# CONFIG_ACENIC is not set
280# CONFIG_DL2K is not set
281# CONFIG_E1000 is not set
282# CONFIG_NS83820 is not set
283# CONFIG_HAMACHI is not set
284# CONFIG_YELLOWFIN is not set
285# CONFIG_R8169 is not set
286# CONFIG_SIS190 is not set
287# CONFIG_SK98LIN is not set
288# CONFIG_TIGON3 is not set
289
290#
291# Ethernet (10000 Mbit)
292#
293# CONFIG_IXGB is not set
294CONFIG_IBM_EMAC=y
295# CONFIG_IBM_EMAC_ERRMSG is not set
296CONFIG_IBM_EMAC_RXB=64
297CONFIG_IBM_EMAC_TXB=8
298CONFIG_IBM_EMAC_FGAP=8
299CONFIG_IBM_EMAC_SKBRES=0
300# CONFIG_FDDI is not set
301# CONFIG_HIPPI is not set
302# CONFIG_PPP is not set
303# CONFIG_SLIP is not set
304
305#
306# Wireless LAN (non-hamradio)
307#
308# CONFIG_NET_RADIO is not set
309
310#
311# Token Ring devices
312#
313# CONFIG_TR is not set
314# CONFIG_RCPCI is not set
315# CONFIG_SHAPER is not set
316# CONFIG_NETCONSOLE is not set
317
318#
319# Wan interfaces
320#
321# CONFIG_WAN is not set
322
323#
324# Amateur Radio support
325#
326# CONFIG_HAMRADIO is not set
327
328#
329# IrDA (infrared) support
330#
331# CONFIG_IRDA is not set
332
333#
334# Bluetooth support
335#
336# CONFIG_BT is not set
337# CONFIG_NETPOLL is not set
338# CONFIG_NET_POLL_CONTROLLER is not set
339
340#
341# ISDN subsystem
342#
343# CONFIG_ISDN is not set
344
345#
346# Telephony Support
347#
348# CONFIG_PHONE is not set
349
350#
351# Input device support
352#
353CONFIG_INPUT=y
354
355#
356# Userland interfaces
357#
358CONFIG_INPUT_MOUSEDEV=y
359CONFIG_INPUT_MOUSEDEV_PSAUX=y
360CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
361CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
362# CONFIG_INPUT_JOYDEV is not set
363# CONFIG_INPUT_TSDEV is not set
364# CONFIG_INPUT_EVDEV is not set
365# CONFIG_INPUT_EVBUG is not set
366
367#
368# Input I/O drivers
369#
370# CONFIG_GAMEPORT is not set
371CONFIG_SOUND_GAMEPORT=y
372CONFIG_SERIO=y
373CONFIG_SERIO_I8042=y
374CONFIG_SERIO_SERPORT=y
375# CONFIG_SERIO_CT82C710 is not set
376# CONFIG_SERIO_PCIPS2 is not set
377
378#
379# Input Device Drivers
380#
381CONFIG_INPUT_KEYBOARD=y
382CONFIG_KEYBOARD_ATKBD=y
383# CONFIG_KEYBOARD_SUNKBD is not set
384# CONFIG_KEYBOARD_LKKBD is not set
385# CONFIG_KEYBOARD_XTKBD is not set
386# CONFIG_KEYBOARD_NEWTON is not set
387CONFIG_INPUT_MOUSE=y
388CONFIG_MOUSE_PS2=y
389# CONFIG_MOUSE_SERIAL is not set
390# CONFIG_MOUSE_VSXXXAA is not set
391# CONFIG_INPUT_JOYSTICK is not set
392# CONFIG_INPUT_TOUCHSCREEN is not set
393# CONFIG_INPUT_MISC is not set
394
395#
396# Character devices
397#
398# CONFIG_VT is not set
399# CONFIG_SERIAL_NONSTANDARD is not set
400
401#
402# Serial drivers
403#
404CONFIG_SERIAL_8250=y
405CONFIG_SERIAL_8250_CONSOLE=y
406CONFIG_SERIAL_8250_NR_UARTS=4
407# CONFIG_SERIAL_8250_EXTENDED is not set
408
409#
410# Non-8250 serial port support
411#
412CONFIG_SERIAL_CORE=y
413CONFIG_SERIAL_CORE_CONSOLE=y
414CONFIG_UNIX98_PTYS=y
415CONFIG_LEGACY_PTYS=y
416CONFIG_LEGACY_PTY_COUNT=256
417# CONFIG_QIC02_TAPE is not set
418
419#
420# IPMI
421#
422# CONFIG_IPMI_HANDLER is not set
423
424#
425# Watchdog Cards
426#
427# CONFIG_WATCHDOG is not set
428# CONFIG_NVRAM is not set
429# CONFIG_GEN_RTC is not set
430# CONFIG_DTLK is not set
431# CONFIG_R3964 is not set
432# CONFIG_APPLICOM is not set
433
434#
435# Ftape, the floppy tape device driver
436#
437# CONFIG_FTAPE is not set
438# CONFIG_AGP is not set
439# CONFIG_DRM is not set
440# CONFIG_RAW_DRIVER is not set
441
442#
443# I2C support
444#
445CONFIG_I2C=y
446CONFIG_I2C_CHARDEV=y
447
448#
449# I2C Algorithms
450#
451# CONFIG_I2C_ALGOBIT is not set
452# CONFIG_I2C_ALGOPCF is not set
453
454#
455# I2C Hardware Bus support
456#
457# CONFIG_I2C_ALI1535 is not set
458# CONFIG_I2C_ALI15X3 is not set
459# CONFIG_I2C_AMD756 is not set
460# CONFIG_I2C_AMD8111 is not set
461# CONFIG_I2C_I801 is not set
462# CONFIG_I2C_I810 is not set
463# CONFIG_I2C_IBM_IIC is not set
464# CONFIG_I2C_ISA is not set
465# CONFIG_I2C_NFORCE2 is not set
466# CONFIG_I2C_PARPORT_LIGHT is not set
467# CONFIG_I2C_PIIX4 is not set
468# CONFIG_I2C_PROSAVAGE is not set
469# CONFIG_I2C_SAVAGE4 is not set
470# CONFIG_SCx200_ACB is not set
471# CONFIG_I2C_SIS5595 is not set
472# CONFIG_I2C_SIS630 is not set
473# CONFIG_I2C_SIS96X is not set
474# CONFIG_I2C_VIA is not set
475# CONFIG_I2C_VIAPRO is not set
476# CONFIG_I2C_VOODOO3 is not set
477
478#
479# Hardware Sensors Chip support
480#
481# CONFIG_I2C_SENSOR is not set
482# CONFIG_SENSORS_ADM1021 is not set
483# CONFIG_SENSORS_ASB100 is not set
484# CONFIG_SENSORS_DS1621 is not set
485# CONFIG_SENSORS_FSCHER is not set
486# CONFIG_SENSORS_GL518SM is not set
487# CONFIG_SENSORS_IT87 is not set
488# CONFIG_SENSORS_LM75 is not set
489# CONFIG_SENSORS_LM78 is not set
490# CONFIG_SENSORS_LM80 is not set
491# CONFIG_SENSORS_LM83 is not set
492# CONFIG_SENSORS_LM85 is not set
493# CONFIG_SENSORS_LM90 is not set
494# CONFIG_SENSORS_VIA686A is not set
495# CONFIG_SENSORS_W83781D is not set
496# CONFIG_SENSORS_W83L785TS is not set
497# CONFIG_SENSORS_W83627HF is not set
498
499#
500# Other I2C Chip support
501#
502# CONFIG_SENSORS_EEPROM is not set
503# CONFIG_I2C_DEBUG_CORE is not set
504# CONFIG_I2C_DEBUG_ALGO is not set
505# CONFIG_I2C_DEBUG_BUS is not set
506# CONFIG_I2C_DEBUG_CHIP is not set
507
508#
509# Misc devices
510#
511
512#
513# Multimedia devices
514#
515# CONFIG_VIDEO_DEV is not set
516
517#
518# Digital Video Broadcasting Devices
519#
520# CONFIG_DVB is not set
521
522#
523# Graphics support
524#
525# CONFIG_FB is not set
526
527#
528# Sound
529#
530# CONFIG_SOUND is not set
531
532#
533# USB support
534#
535# CONFIG_USB is not set
536
537#
538# USB Gadget Support
539#
540# CONFIG_USB_GADGET is not set
541
542#
543# File systems
544#
545CONFIG_EXT2_FS=y
546# CONFIG_EXT2_FS_XATTR is not set
547# CONFIG_EXT3_FS is not set
548# CONFIG_JBD is not set
549# CONFIG_REISERFS_FS is not set
550# CONFIG_JFS_FS is not set
551# CONFIG_XFS_FS is not set
552# CONFIG_MINIX_FS is not set
553# CONFIG_ROMFS_FS is not set
554# CONFIG_QUOTA is not set
555# CONFIG_AUTOFS_FS is not set
556# CONFIG_AUTOFS4_FS is not set
557
558#
559# CD-ROM/DVD Filesystems
560#
561# CONFIG_ISO9660_FS is not set
562# CONFIG_UDF_FS is not set
563
564#
565# DOS/FAT/NT Filesystems
566#
567# CONFIG_FAT_FS is not set
568# CONFIG_NTFS_FS is not set
569
570#
571# Pseudo filesystems
572#
573CONFIG_PROC_FS=y
574CONFIG_PROC_KCORE=y
575# CONFIG_DEVFS_FS is not set
576# CONFIG_DEVPTS_FS_XATTR is not set
577CONFIG_TMPFS=y
578# CONFIG_HUGETLB_PAGE is not set
579CONFIG_RAMFS=y
580
581#
582# Miscellaneous filesystems
583#
584# CONFIG_ADFS_FS is not set
585# CONFIG_AFFS_FS is not set
586# CONFIG_HFS_FS is not set
587# CONFIG_HFSPLUS_FS is not set
588# CONFIG_BEFS_FS is not set
589# CONFIG_BFS_FS is not set
590# CONFIG_EFS_FS is not set
591# CONFIG_CRAMFS is not set
592# CONFIG_VXFS_FS is not set
593# CONFIG_HPFS_FS is not set
594# CONFIG_QNX4FS_FS is not set
595# CONFIG_SYSV_FS is not set
596# CONFIG_UFS_FS is not set
597
598#
599# Network File Systems
600#
601CONFIG_NFS_FS=y
602# CONFIG_NFS_V3 is not set
603# CONFIG_NFS_V4 is not set
604# CONFIG_NFS_DIRECTIO is not set
605# CONFIG_NFSD is not set
606CONFIG_ROOT_NFS=y
607CONFIG_LOCKD=y
608# CONFIG_EXPORTFS is not set
609CONFIG_SUNRPC=y
610# CONFIG_RPCSEC_GSS_KRB5 is not set
611# CONFIG_SMB_FS is not set
612# CONFIG_CIFS is not set
613# CONFIG_NCP_FS is not set
614# CONFIG_CODA_FS is not set
615# CONFIG_INTERMEZZO_FS is not set
616# CONFIG_AFS_FS is not set
617
618#
619# Partition Types
620#
621CONFIG_PARTITION_ADVANCED=y
622# CONFIG_ACORN_PARTITION is not set
623# CONFIG_OSF_PARTITION is not set
624# CONFIG_AMIGA_PARTITION is not set
625# CONFIG_ATARI_PARTITION is not set
626# CONFIG_MAC_PARTITION is not set
627# CONFIG_MSDOS_PARTITION is not set
628# CONFIG_LDM_PARTITION is not set
629# CONFIG_NEC98_PARTITION is not set
630# CONFIG_SGI_PARTITION is not set
631# CONFIG_ULTRIX_PARTITION is not set
632# CONFIG_SUN_PARTITION is not set
633# CONFIG_EFI_PARTITION is not set
634
635#
636# Native Language Support
637#
638# CONFIG_NLS is not set
639
640#
641# IBM 40x options
642#
643
644#
645# Library routines
646#
647CONFIG_CRC32=y
648
649#
650# Kernel hacking
651#
652# CONFIG_DEBUG_KERNEL is not set
653# CONFIG_SERIAL_TEXT_DEBUG is not set
654CONFIG_OCP=y
655
656#
657# Security options
658#
659# CONFIG_SECURITY is not set
660
661#
662# Cryptographic options
663#
664# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/walnut_defconfig b/arch/ppc/configs/walnut_defconfig
new file mode 100644
index 000000000000..bf9721a7a818
--- /dev/null
+++ b/arch/ppc/configs/walnut_defconfig
@@ -0,0 +1,578 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7CONFIG_PPC=y
8CONFIG_PPC32=y
9CONFIG_GENERIC_NVRAM=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16# CONFIG_STANDALONE is not set
17CONFIG_BROKEN_ON_SMP=y
18
19#
20# General setup
21#
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24CONFIG_POSIX_MQUEUE=y
25# CONFIG_BSD_PROCESS_ACCT is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=14
29# CONFIG_HOTPLUG is not set
30# CONFIG_IKCONFIG is not set
31CONFIG_EMBEDDED=y
32# CONFIG_KALLSYMS is not set
33CONFIG_FUTEX=y
34# CONFIG_EPOLL is not set
35CONFIG_IOSCHED_NOOP=y
36CONFIG_IOSCHED_AS=y
37CONFIG_IOSCHED_DEADLINE=y
38CONFIG_IOSCHED_CFQ=y
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
40
41#
42# Loadable module support
43#
44CONFIG_MODULES=y
45CONFIG_MODULE_UNLOAD=y
46# CONFIG_MODULE_FORCE_UNLOAD is not set
47CONFIG_OBSOLETE_MODPARM=y
48# CONFIG_MODVERSIONS is not set
49CONFIG_KMOD=y
50
51#
52# Processor
53#
54# CONFIG_6xx is not set
55CONFIG_40x=y
56# CONFIG_44x is not set
57# CONFIG_POWER3 is not set
58# CONFIG_POWER4 is not set
59# CONFIG_8xx is not set
60# CONFIG_MATH_EMULATION is not set
61# CONFIG_CPU_FREQ is not set
62CONFIG_4xx=y
63
64#
65# IBM 4xx options
66#
67# CONFIG_ASH is not set
68# CONFIG_BUBINGA is not set
69# CONFIG_CPCI405 is not set
70# CONFIG_EP405 is not set
71# CONFIG_OAK is not set
72# CONFIG_REDWOOD_5 is not set
73# CONFIG_REDWOOD_6 is not set
74# CONFIG_SYCAMORE is not set
75CONFIG_WALNUT=y
76CONFIG_IBM405_ERR77=y
77CONFIG_IBM405_ERR51=y
78CONFIG_IBM_OCP=y
79CONFIG_BIOS_FIXUP=y
80CONFIG_405GP=y
81CONFIG_IBM_OPENBIOS=y
82# CONFIG_PM is not set
83CONFIG_UART0_TTYS0=y
84# CONFIG_UART0_TTYS1 is not set
85CONFIG_NOT_COHERENT_CACHE=y
86
87#
88# Platform options
89#
90# CONFIG_PC_KEYBOARD is not set
91# CONFIG_SMP is not set
92# CONFIG_PREEMPT is not set
93# CONFIG_HIGHMEM is not set
94CONFIG_KERNEL_ELF=y
95CONFIG_BINFMT_ELF=y
96# CONFIG_BINFMT_MISC is not set
97CONFIG_CMDLINE_BOOL=y
98CONFIG_CMDLINE="ip=on"
99
100#
101# Bus options
102#
103CONFIG_PCI=y
104CONFIG_PCI_DOMAINS=y
105CONFIG_PCI_LEGACY_PROC=y
106# CONFIG_PCI_NAMES is not set
107
108#
109# Advanced setup
110#
111# CONFIG_ADVANCED_OPTIONS is not set
112
113#
114# Default settings for advanced configuration options are used
115#
116CONFIG_HIGHMEM_START=0xfe000000
117CONFIG_LOWMEM_SIZE=0x30000000
118CONFIG_KERNEL_START=0xc0000000
119CONFIG_TASK_SIZE=0x80000000
120CONFIG_BOOT_LOAD=0x00400000
121
122#
123# Device Drivers
124#
125
126#
127# Generic Driver Options
128#
129
130#
131# Memory Technology Devices (MTD)
132#
133# CONFIG_MTD is not set
134
135#
136# Parallel port support
137#
138# CONFIG_PARPORT is not set
139
140#
141# Plug and Play support
142#
143
144#
145# Block devices
146#
147# CONFIG_BLK_DEV_FD is not set
148# CONFIG_BLK_CPQ_DA is not set
149# CONFIG_BLK_CPQ_CISS_DA is not set
150# CONFIG_BLK_DEV_DAC960 is not set
151# CONFIG_BLK_DEV_UMEM is not set
152CONFIG_BLK_DEV_LOOP=y
153# CONFIG_BLK_DEV_CRYPTOLOOP is not set
154# CONFIG_BLK_DEV_NBD is not set
155# CONFIG_BLK_DEV_CARMEL is not set
156CONFIG_BLK_DEV_RAM=y
157CONFIG_BLK_DEV_RAM_SIZE=4096
158CONFIG_BLK_DEV_INITRD=y
159# CONFIG_LBD is not set
160
161#
162# ATA/ATAPI/MFM/RLL support
163#
164# CONFIG_IDE is not set
165
166#
167# SCSI device support
168#
169# CONFIG_SCSI is not set
170
171#
172# Multi-device support (RAID and LVM)
173#
174# CONFIG_MD is not set
175
176#
177# Fusion MPT device support
178#
179
180#
181# IEEE 1394 (FireWire) support
182#
183# CONFIG_IEEE1394 is not set
184
185#
186# I2O device support
187#
188# CONFIG_I2O is not set
189
190#
191# Macintosh device drivers
192#
193
194#
195# Networking support
196#
197CONFIG_NET=y
198
199#
200# Networking options
201#
202# CONFIG_PACKET is not set
203# CONFIG_NETLINK_DEV is not set
204CONFIG_UNIX=y
205# CONFIG_NET_KEY is not set
206CONFIG_INET=y
207CONFIG_IP_MULTICAST=y
208# CONFIG_IP_ADVANCED_ROUTER is not set
209CONFIG_IP_PNP=y
210# CONFIG_IP_PNP_DHCP is not set
211CONFIG_IP_PNP_BOOTP=y
212# CONFIG_IP_PNP_RARP is not set
213# CONFIG_NET_IPIP is not set
214# CONFIG_NET_IPGRE is not set
215# CONFIG_IP_MROUTE is not set
216# CONFIG_ARPD is not set
217CONFIG_SYN_COOKIES=y
218# CONFIG_INET_AH is not set
219# CONFIG_INET_ESP is not set
220# CONFIG_INET_IPCOMP is not set
221# CONFIG_IPV6 is not set
222# CONFIG_NETFILTER is not set
223
224#
225# SCTP Configuration (EXPERIMENTAL)
226#
227# CONFIG_IP_SCTP is not set
228# CONFIG_ATM is not set
229# CONFIG_BRIDGE is not set
230# CONFIG_VLAN_8021Q is not set
231# CONFIG_DECNET is not set
232# CONFIG_LLC2 is not set
233# CONFIG_IPX is not set
234# CONFIG_ATALK is not set
235# CONFIG_X25 is not set
236# CONFIG_LAPB is not set
237# CONFIG_NET_DIVERT is not set
238# CONFIG_ECONET is not set
239# CONFIG_WAN_ROUTER is not set
240# CONFIG_NET_HW_FLOWCONTROL is not set
241
242#
243# QoS and/or fair queueing
244#
245# CONFIG_NET_SCHED is not set
246
247#
248# Network testing
249#
250# CONFIG_NET_PKTGEN is not set
251# CONFIG_NETPOLL is not set
252# CONFIG_NET_POLL_CONTROLLER is not set
253# CONFIG_HAMRADIO is not set
254# CONFIG_IRDA is not set
255# CONFIG_BT is not set
256CONFIG_NETDEVICES=y
257# CONFIG_DUMMY is not set
258# CONFIG_BONDING is not set
259# CONFIG_EQUALIZER is not set
260# CONFIG_TUN is not set
261
262#
263# ARCnet devices
264#
265# CONFIG_ARCNET is not set
266
267#
268# Ethernet (10 or 100Mbit)
269#
270CONFIG_NET_ETHERNET=y
271CONFIG_MII=y
272# CONFIG_OAKNET is not set
273# CONFIG_HAPPYMEAL is not set
274# CONFIG_SUNGEM is not set
275# CONFIG_NET_VENDOR_3COM is not set
276
277#
278# Tulip family network device support
279#
280# CONFIG_NET_TULIP is not set
281# CONFIG_HP100 is not set
282# CONFIG_NET_PCI is not set
283
284#
285# Ethernet (1000 Mbit)
286#
287# CONFIG_ACENIC is not set
288# CONFIG_DL2K is not set
289# CONFIG_E1000 is not set
290# CONFIG_NS83820 is not set
291# CONFIG_HAMACHI is not set
292# CONFIG_YELLOWFIN is not set
293# CONFIG_R8169 is not set
294# CONFIG_SK98LIN is not set
295# CONFIG_TIGON3 is not set
296
297#
298# Ethernet (10000 Mbit)
299#
300# CONFIG_IXGB is not set
301# CONFIG_S2IO is not set
302
303#
304# Token Ring devices
305#
306# CONFIG_TR is not set
307
308#
309# Wireless LAN (non-hamradio)
310#
311# CONFIG_NET_RADIO is not set
312
313#
314# Wan interfaces
315#
316# CONFIG_WAN is not set
317# CONFIG_FDDI is not set
318# CONFIG_HIPPI is not set
319# CONFIG_PPP is not set
320# CONFIG_SLIP is not set
321# CONFIG_RCPCI is not set
322# CONFIG_SHAPER is not set
323# CONFIG_NETCONSOLE is not set
324
325#
326# ISDN subsystem
327#
328# CONFIG_ISDN is not set
329
330#
331# Telephony Support
332#
333# CONFIG_PHONE is not set
334
335#
336# Input device support
337#
338CONFIG_INPUT=y
339
340#
341# Userland interfaces
342#
343# CONFIG_INPUT_MOUSEDEV is not set
344# CONFIG_INPUT_JOYDEV is not set
345# CONFIG_INPUT_TSDEV is not set
346# CONFIG_INPUT_EVDEV is not set
347# CONFIG_INPUT_EVBUG is not set
348
349#
350# Input I/O drivers
351#
352# CONFIG_GAMEPORT is not set
353CONFIG_SOUND_GAMEPORT=y
354CONFIG_SERIO=y
355# CONFIG_SERIO_I8042 is not set
356# CONFIG_SERIO_SERPORT is not set
357# CONFIG_SERIO_CT82C710 is not set
358# CONFIG_SERIO_PCIPS2 is not set
359
360#
361# Input Device Drivers
362#
363# CONFIG_INPUT_KEYBOARD is not set
364# CONFIG_INPUT_MOUSE is not set
365# CONFIG_INPUT_JOYSTICK is not set
366# CONFIG_INPUT_TOUCHSCREEN is not set
367# CONFIG_INPUT_MISC is not set
368
369#
370# Character devices
371#
372# CONFIG_VT is not set
373# CONFIG_SERIAL_NONSTANDARD is not set
374
375#
376# Serial drivers
377#
378CONFIG_SERIAL_8250=y
379CONFIG_SERIAL_8250_CONSOLE=y
380CONFIG_SERIAL_8250_NR_UARTS=4
381# CONFIG_SERIAL_8250_EXTENDED is not set
382
383#
384# Non-8250 serial port support
385#
386CONFIG_SERIAL_CORE=y
387CONFIG_SERIAL_CORE_CONSOLE=y
388CONFIG_UNIX98_PTYS=y
389CONFIG_LEGACY_PTYS=y
390CONFIG_LEGACY_PTY_COUNT=256
391# CONFIG_QIC02_TAPE is not set
392
393#
394# IPMI
395#
396# CONFIG_IPMI_HANDLER is not set
397
398#
399# Watchdog Cards
400#
401# CONFIG_WATCHDOG is not set
402# CONFIG_NVRAM is not set
403# CONFIG_GEN_RTC is not set
404# CONFIG_DTLK is not set
405# CONFIG_R3964 is not set
406# CONFIG_APPLICOM is not set
407
408#
409# Ftape, the floppy tape device driver
410#
411# CONFIG_FTAPE is not set
412# CONFIG_AGP is not set
413# CONFIG_DRM is not set
414# CONFIG_RAW_DRIVER is not set
415
416#
417# I2C support
418#
419# CONFIG_I2C is not set
420
421#
422# Misc devices
423#
424
425#
426# Multimedia devices
427#
428# CONFIG_VIDEO_DEV is not set
429
430#
431# Digital Video Broadcasting Devices
432#
433# CONFIG_DVB is not set
434
435#
436# Graphics support
437#
438# CONFIG_FB is not set
439
440#
441# Sound
442#
443# CONFIG_SOUND is not set
444
445#
446# USB support
447#
448# CONFIG_USB is not set
449
450#
451# USB Gadget Support
452#
453# CONFIG_USB_GADGET is not set
454
455#
456# File systems
457#
458CONFIG_EXT2_FS=y
459# CONFIG_EXT2_FS_XATTR is not set
460# CONFIG_EXT3_FS is not set
461# CONFIG_JBD is not set
462# CONFIG_REISERFS_FS is not set
463# CONFIG_JFS_FS is not set
464# CONFIG_XFS_FS is not set
465# CONFIG_MINIX_FS is not set
466# CONFIG_ROMFS_FS is not set
467# CONFIG_QUOTA is not set
468# CONFIG_AUTOFS_FS is not set
469# CONFIG_AUTOFS4_FS is not set
470
471#
472# CD-ROM/DVD Filesystems
473#
474# CONFIG_ISO9660_FS is not set
475# CONFIG_UDF_FS is not set
476
477#
478# DOS/FAT/NT Filesystems
479#
480# CONFIG_FAT_FS is not set
481# CONFIG_NTFS_FS is not set
482
483#
484# Pseudo filesystems
485#
486CONFIG_PROC_FS=y
487CONFIG_PROC_KCORE=y
488CONFIG_SYSFS=y
489# CONFIG_DEVFS_FS is not set
490# CONFIG_DEVPTS_FS_XATTR is not set
491CONFIG_TMPFS=y
492# CONFIG_HUGETLB_PAGE is not set
493CONFIG_RAMFS=y
494
495#
496# Miscellaneous filesystems
497#
498# CONFIG_ADFS_FS is not set
499# CONFIG_AFFS_FS is not set
500# CONFIG_HFS_FS is not set
501# CONFIG_HFSPLUS_FS is not set
502# CONFIG_BEFS_FS is not set
503# CONFIG_BFS_FS is not set
504# CONFIG_EFS_FS is not set
505# CONFIG_CRAMFS is not set
506# CONFIG_VXFS_FS is not set
507# CONFIG_HPFS_FS is not set
508# CONFIG_QNX4FS_FS is not set
509# CONFIG_SYSV_FS is not set
510# CONFIG_UFS_FS is not set
511
512#
513# Network File Systems
514#
515CONFIG_NFS_FS=y
516# CONFIG_NFS_V3 is not set
517# CONFIG_NFS_V4 is not set
518# CONFIG_NFS_DIRECTIO is not set
519# CONFIG_NFSD is not set
520CONFIG_ROOT_NFS=y
521CONFIG_LOCKD=y
522# CONFIG_EXPORTFS is not set
523CONFIG_SUNRPC=y
524# CONFIG_RPCSEC_GSS_KRB5 is not set
525# CONFIG_SMB_FS is not set
526# CONFIG_CIFS is not set
527# CONFIG_NCP_FS is not set
528# CONFIG_CODA_FS is not set
529# CONFIG_AFS_FS is not set
530
531#
532# Partition Types
533#
534CONFIG_PARTITION_ADVANCED=y
535# CONFIG_ACORN_PARTITION is not set
536# CONFIG_OSF_PARTITION is not set
537# CONFIG_AMIGA_PARTITION is not set
538# CONFIG_ATARI_PARTITION is not set
539# CONFIG_MAC_PARTITION is not set
540# CONFIG_MSDOS_PARTITION is not set
541# CONFIG_LDM_PARTITION is not set
542# CONFIG_NEC98_PARTITION is not set
543# CONFIG_SGI_PARTITION is not set
544# CONFIG_ULTRIX_PARTITION is not set
545# CONFIG_SUN_PARTITION is not set
546# CONFIG_EFI_PARTITION is not set
547
548#
549# Native Language Support
550#
551# CONFIG_NLS is not set
552
553#
554# IBM 40x options
555#
556
557#
558# Library routines
559#
560CONFIG_CRC32=y
561# CONFIG_LIBCRC32C is not set
562
563#
564# Kernel hacking
565#
566# CONFIG_DEBUG_KERNEL is not set
567# CONFIG_SERIAL_TEXT_DEBUG is not set
568CONFIG_PPC_OCP=y
569
570#
571# Security options
572#
573# CONFIG_SECURITY is not set
574
575#
576# Cryptographic options
577#
578# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/kernel/Makefile b/arch/ppc/kernel/Makefile
new file mode 100644
index 000000000000..86bc878cb3ee
--- /dev/null
+++ b/arch/ppc/kernel/Makefile
@@ -0,0 +1,33 @@
1#
2# Makefile for the linux kernel.
3#
4
5extra-$(CONFIG_PPC_STD_MMU) := head.o
6extra-$(CONFIG_40x) := head_4xx.o
7extra-$(CONFIG_44x) := head_44x.o
8extra-$(CONFIG_FSL_BOOKE) := head_fsl_booke.o
9extra-$(CONFIG_8xx) := head_8xx.o
10extra-$(CONFIG_6xx) += idle_6xx.o
11extra-$(CONFIG_POWER4) += idle_power4.o
12extra-y += vmlinux.lds
13
14obj-y := entry.o traps.o irq.o idle.o time.o misc.o \
15 process.o signal.o ptrace.o align.o \
16 semaphore.o syscalls.o setup.o \
17 cputable.o ppc_htab.o perfmon.o
18obj-$(CONFIG_6xx) += l2cr.o cpu_setup_6xx.o
19obj-$(CONFIG_SOFTWARE_SUSPEND) += swsusp.o
20obj-$(CONFIG_POWER4) += cpu_setup_power4.o
21obj-$(CONFIG_MODULES) += module.o ppc_ksyms.o
22obj-$(CONFIG_NOT_COHERENT_CACHE) += dma-mapping.o
23obj-$(CONFIG_PCI) += pci.o
24obj-$(CONFIG_KGDB) += ppc-stub.o
25obj-$(CONFIG_SMP) += smp.o smp-tbsync.o
26obj-$(CONFIG_TAU) += temp.o
27obj-$(CONFIG_ALTIVEC) += vecemu.o vector.o
28obj-$(CONFIG_FSL_BOOKE) += perfmon_fsl_booke.o
29
30ifndef CONFIG_MATH_EMULATION
31obj-$(CONFIG_8xx) += softemu8xx.o
32endif
33
diff --git a/arch/ppc/kernel/align.c b/arch/ppc/kernel/align.c
new file mode 100644
index 000000000000..79c929475037
--- /dev/null
+++ b/arch/ppc/kernel/align.c
@@ -0,0 +1,398 @@
1/*
2 * align.c - handle alignment exceptions for the Power PC.
3 *
4 * Copyright (c) 1996 Paul Mackerras <paulus@cs.anu.edu.au>
5 * Copyright (c) 1998-1999 TiVo, Inc.
6 * PowerPC 403GCX modifications.
7 * Copyright (c) 1999 Grant Erickson <grant@lcse.umn.edu>
8 * PowerPC 403GCX/405GP modifications.
9 */
10#include <linux/config.h>
11#include <linux/kernel.h>
12#include <linux/mm.h>
13#include <asm/ptrace.h>
14#include <asm/processor.h>
15#include <asm/uaccess.h>
16#include <asm/system.h>
17#include <asm/cache.h>
18
19struct aligninfo {
20 unsigned char len;
21 unsigned char flags;
22};
23
24#if defined(CONFIG_4xx) || defined(CONFIG_POWER4) || defined(CONFIG_BOOKE)
25#define OPCD(inst) (((inst) & 0xFC000000) >> 26)
26#define RS(inst) (((inst) & 0x03E00000) >> 21)
27#define RA(inst) (((inst) & 0x001F0000) >> 16)
28#define IS_XFORM(code) ((code) == 31)
29#endif
30
31#define INVALID { 0, 0 }
32
33#define LD 1 /* load */
34#define ST 2 /* store */
35#define SE 4 /* sign-extend value */
36#define F 8 /* to/from fp regs */
37#define U 0x10 /* update index register */
38#define M 0x20 /* multiple load/store */
39#define S 0x40 /* single-precision fp, or byte-swap value */
40#define SX 0x40 /* byte count in XER */
41#define HARD 0x80 /* string, stwcx. */
42
43#define DCBZ 0x5f /* 8xx/82xx dcbz faults when cache not enabled */
44
45/*
46 * The PowerPC stores certain bits of the instruction that caused the
47 * alignment exception in the DSISR register. This array maps those
48 * bits to information about the operand length and what the
49 * instruction would do.
50 */
51static struct aligninfo aligninfo[128] = {
52 { 4, LD }, /* 00 0 0000: lwz / lwarx */
53 INVALID, /* 00 0 0001 */
54 { 4, ST }, /* 00 0 0010: stw */
55 INVALID, /* 00 0 0011 */
56 { 2, LD }, /* 00 0 0100: lhz */
57 { 2, LD+SE }, /* 00 0 0101: lha */
58 { 2, ST }, /* 00 0 0110: sth */
59 { 4, LD+M }, /* 00 0 0111: lmw */
60 { 4, LD+F+S }, /* 00 0 1000: lfs */
61 { 8, LD+F }, /* 00 0 1001: lfd */
62 { 4, ST+F+S }, /* 00 0 1010: stfs */
63 { 8, ST+F }, /* 00 0 1011: stfd */
64 INVALID, /* 00 0 1100 */
65 INVALID, /* 00 0 1101: ld/ldu/lwa */
66 INVALID, /* 00 0 1110 */
67 INVALID, /* 00 0 1111: std/stdu */
68 { 4, LD+U }, /* 00 1 0000: lwzu */
69 INVALID, /* 00 1 0001 */
70 { 4, ST+U }, /* 00 1 0010: stwu */
71 INVALID, /* 00 1 0011 */
72 { 2, LD+U }, /* 00 1 0100: lhzu */
73 { 2, LD+SE+U }, /* 00 1 0101: lhau */
74 { 2, ST+U }, /* 00 1 0110: sthu */
75 { 4, ST+M }, /* 00 1 0111: stmw */
76 { 4, LD+F+S+U }, /* 00 1 1000: lfsu */
77 { 8, LD+F+U }, /* 00 1 1001: lfdu */
78 { 4, ST+F+S+U }, /* 00 1 1010: stfsu */
79 { 8, ST+F+U }, /* 00 1 1011: stfdu */
80 INVALID, /* 00 1 1100 */
81 INVALID, /* 00 1 1101 */
82 INVALID, /* 00 1 1110 */
83 INVALID, /* 00 1 1111 */
84 INVALID, /* 01 0 0000: ldx */
85 INVALID, /* 01 0 0001 */
86 INVALID, /* 01 0 0010: stdx */
87 INVALID, /* 01 0 0011 */
88 INVALID, /* 01 0 0100 */
89 INVALID, /* 01 0 0101: lwax */
90 INVALID, /* 01 0 0110 */
91 INVALID, /* 01 0 0111 */
92 { 4, LD+M+HARD+SX }, /* 01 0 1000: lswx */
93 { 4, LD+M+HARD }, /* 01 0 1001: lswi */
94 { 4, ST+M+HARD+SX }, /* 01 0 1010: stswx */
95 { 4, ST+M+HARD }, /* 01 0 1011: stswi */
96 INVALID, /* 01 0 1100 */
97 INVALID, /* 01 0 1101 */
98 INVALID, /* 01 0 1110 */
99 INVALID, /* 01 0 1111 */
100 INVALID, /* 01 1 0000: ldux */
101 INVALID, /* 01 1 0001 */
102 INVALID, /* 01 1 0010: stdux */
103 INVALID, /* 01 1 0011 */
104 INVALID, /* 01 1 0100 */
105 INVALID, /* 01 1 0101: lwaux */
106 INVALID, /* 01 1 0110 */
107 INVALID, /* 01 1 0111 */
108 INVALID, /* 01 1 1000 */
109 INVALID, /* 01 1 1001 */
110 INVALID, /* 01 1 1010 */
111 INVALID, /* 01 1 1011 */
112 INVALID, /* 01 1 1100 */
113 INVALID, /* 01 1 1101 */
114 INVALID, /* 01 1 1110 */
115 INVALID, /* 01 1 1111 */
116 INVALID, /* 10 0 0000 */
117 INVALID, /* 10 0 0001 */
118 { 0, ST+HARD }, /* 10 0 0010: stwcx. */
119 INVALID, /* 10 0 0011 */
120 INVALID, /* 10 0 0100 */
121 INVALID, /* 10 0 0101 */
122 INVALID, /* 10 0 0110 */
123 INVALID, /* 10 0 0111 */
124 { 4, LD+S }, /* 10 0 1000: lwbrx */
125 INVALID, /* 10 0 1001 */
126 { 4, ST+S }, /* 10 0 1010: stwbrx */
127 INVALID, /* 10 0 1011 */
128 { 2, LD+S }, /* 10 0 1100: lhbrx */
129 INVALID, /* 10 0 1101 */
130 { 2, ST+S }, /* 10 0 1110: sthbrx */
131 INVALID, /* 10 0 1111 */
132 INVALID, /* 10 1 0000 */
133 INVALID, /* 10 1 0001 */
134 INVALID, /* 10 1 0010 */
135 INVALID, /* 10 1 0011 */
136 INVALID, /* 10 1 0100 */
137 INVALID, /* 10 1 0101 */
138 INVALID, /* 10 1 0110 */
139 INVALID, /* 10 1 0111 */
140 INVALID, /* 10 1 1000 */
141 INVALID, /* 10 1 1001 */
142 INVALID, /* 10 1 1010 */
143 INVALID, /* 10 1 1011 */
144 INVALID, /* 10 1 1100 */
145 INVALID, /* 10 1 1101 */
146 INVALID, /* 10 1 1110 */
147 { 0, ST+HARD }, /* 10 1 1111: dcbz */
148 { 4, LD }, /* 11 0 0000: lwzx */
149 INVALID, /* 11 0 0001 */
150 { 4, ST }, /* 11 0 0010: stwx */
151 INVALID, /* 11 0 0011 */
152 { 2, LD }, /* 11 0 0100: lhzx */
153 { 2, LD+SE }, /* 11 0 0101: lhax */
154 { 2, ST }, /* 11 0 0110: sthx */
155 INVALID, /* 11 0 0111 */
156 { 4, LD+F+S }, /* 11 0 1000: lfsx */
157 { 8, LD+F }, /* 11 0 1001: lfdx */
158 { 4, ST+F+S }, /* 11 0 1010: stfsx */
159 { 8, ST+F }, /* 11 0 1011: stfdx */
160 INVALID, /* 11 0 1100 */
161 INVALID, /* 11 0 1101: lmd */
162 INVALID, /* 11 0 1110 */
163 INVALID, /* 11 0 1111: stmd */
164 { 4, LD+U }, /* 11 1 0000: lwzux */
165 INVALID, /* 11 1 0001 */
166 { 4, ST+U }, /* 11 1 0010: stwux */
167 INVALID, /* 11 1 0011 */
168 { 2, LD+U }, /* 11 1 0100: lhzux */
169 { 2, LD+SE+U }, /* 11 1 0101: lhaux */
170 { 2, ST+U }, /* 11 1 0110: sthux */
171 INVALID, /* 11 1 0111 */
172 { 4, LD+F+S+U }, /* 11 1 1000: lfsux */
173 { 8, LD+F+U }, /* 11 1 1001: lfdux */
174 { 4, ST+F+S+U }, /* 11 1 1010: stfsux */
175 { 8, ST+F+U }, /* 11 1 1011: stfdux */
176 INVALID, /* 11 1 1100 */
177 INVALID, /* 11 1 1101 */
178 INVALID, /* 11 1 1110 */
179 INVALID, /* 11 1 1111 */
180};
181
182#define SWAP(a, b) (t = (a), (a) = (b), (b) = t)
183
184int
185fix_alignment(struct pt_regs *regs)
186{
187 int instr, nb, flags;
188#if defined(CONFIG_4xx) || defined(CONFIG_POWER4) || defined(CONFIG_BOOKE)
189 int opcode, f1, f2, f3;
190#endif
191 int i, t;
192 int reg, areg;
193 int offset, nb0;
194 unsigned char __user *addr;
195 unsigned char *rptr;
196 union {
197 long l;
198 float f;
199 double d;
200 unsigned char v[8];
201 } data;
202
203 CHECK_FULL_REGS(regs);
204
205#if defined(CONFIG_4xx) || defined(CONFIG_POWER4) || defined(CONFIG_BOOKE)
206 /* The 4xx-family & Book-E processors have no DSISR register,
207 * so we emulate it.
208 * The POWER4 has a DSISR register but doesn't set it on
209 * an alignment fault. -- paulus
210 */
211
212 if (__get_user(instr, (unsigned int __user *) regs->nip))
213 return 0;
214 opcode = OPCD(instr);
215 reg = RS(instr);
216 areg = RA(instr);
217
218 if (!IS_XFORM(opcode)) {
219 f1 = 0;
220 f2 = (instr & 0x04000000) >> 26;
221 f3 = (instr & 0x78000000) >> 27;
222 } else {
223 f1 = (instr & 0x00000006) >> 1;
224 f2 = (instr & 0x00000040) >> 6;
225 f3 = (instr & 0x00000780) >> 7;
226 }
227
228 instr = ((f1 << 5) | (f2 << 4) | f3);
229#else
230 reg = (regs->dsisr >> 5) & 0x1f; /* source/dest register */
231 areg = regs->dsisr & 0x1f; /* register to update */
232 instr = (regs->dsisr >> 10) & 0x7f;
233#endif
234
235 nb = aligninfo[instr].len;
236 if (nb == 0) {
237 long __user *p;
238 int i;
239
240 if (instr != DCBZ)
241 return 0; /* too hard or invalid instruction */
242 /*
243 * The dcbz (data cache block zero) instruction
244 * gives an alignment fault if used on non-cacheable
245 * memory. We handle the fault mainly for the
246 * case when we are running with the cache disabled
247 * for debugging.
248 */
249 p = (long __user *) (regs->dar & -L1_CACHE_BYTES);
250 if (user_mode(regs)
251 && !access_ok(VERIFY_WRITE, p, L1_CACHE_BYTES))
252 return -EFAULT;
253 for (i = 0; i < L1_CACHE_BYTES / sizeof(long); ++i)
254 if (__put_user(0, p+i))
255 return -EFAULT;
256 return 1;
257 }
258
259 flags = aligninfo[instr].flags;
260 if ((flags & (LD|ST)) == 0)
261 return 0;
262
263 /* For the 4xx-family & Book-E processors, the 'dar' field of the
264 * pt_regs structure is overloaded and is really from the DEAR.
265 */
266
267 addr = (unsigned char __user *)regs->dar;
268
269 if (flags & M) {
270 /* lmw, stmw, lswi/x, stswi/x */
271 nb0 = 0;
272 if (flags & HARD) {
273 if (flags & SX) {
274 nb = regs->xer & 127;
275 if (nb == 0)
276 return 1;
277 } else {
278 if (__get_user(instr,
279 (unsigned int __user *)regs->nip))
280 return 0;
281 nb = (instr >> 11) & 0x1f;
282 if (nb == 0)
283 nb = 32;
284 }
285 if (nb + reg * 4 > 128) {
286 nb0 = nb + reg * 4 - 128;
287 nb = 128 - reg * 4;
288 }
289 } else {
290 /* lwm, stmw */
291 nb = (32 - reg) * 4;
292 }
293 rptr = (unsigned char *) &regs->gpr[reg];
294 if (flags & LD) {
295 for (i = 0; i < nb; ++i)
296 if (__get_user(rptr[i], addr+i))
297 return -EFAULT;
298 if (nb0 > 0) {
299 rptr = (unsigned char *) &regs->gpr[0];
300 addr += nb;
301 for (i = 0; i < nb0; ++i)
302 if (__get_user(rptr[i], addr+i))
303 return -EFAULT;
304 }
305 for (; (i & 3) != 0; ++i)
306 rptr[i] = 0;
307 } else {
308 for (i = 0; i < nb; ++i)
309 if (__put_user(rptr[i], addr+i))
310 return -EFAULT;
311 if (nb0 > 0) {
312 rptr = (unsigned char *) &regs->gpr[0];
313 addr += nb;
314 for (i = 0; i < nb0; ++i)
315 if (__put_user(rptr[i], addr+i))
316 return -EFAULT;
317 }
318 }
319 return 1;
320 }
321
322 offset = 0;
323 if (nb < 4) {
324 /* read/write the least significant bits */
325 data.l = 0;
326 offset = 4 - nb;
327 }
328
329 /* Verify the address of the operand */
330 if (user_mode(regs)) {
331 if (!access_ok((flags & ST? VERIFY_WRITE: VERIFY_READ), addr, nb))
332 return -EFAULT; /* bad address */
333 }
334
335 if (flags & F) {
336 preempt_disable();
337 if (regs->msr & MSR_FP)
338 giveup_fpu(current);
339 preempt_enable();
340 }
341
342 /* If we read the operand, copy it in, else get register values */
343 if (flags & LD) {
344 for (i = 0; i < nb; ++i)
345 if (__get_user(data.v[offset+i], addr+i))
346 return -EFAULT;
347 } else if (flags & F) {
348 data.d = current->thread.fpr[reg];
349 } else {
350 data.l = regs->gpr[reg];
351 }
352
353 switch (flags & ~U) {
354 case LD+SE: /* sign extend */
355 if (data.v[2] >= 0x80)
356 data.v[0] = data.v[1] = -1;
357 break;
358
359 case LD+S: /* byte-swap */
360 case ST+S:
361 if (nb == 2) {
362 SWAP(data.v[2], data.v[3]);
363 } else {
364 SWAP(data.v[0], data.v[3]);
365 SWAP(data.v[1], data.v[2]);
366 }
367 break;
368
369 /* Single-precision FP load and store require conversions... */
370 case LD+F+S:
371 preempt_disable();
372 enable_kernel_fp();
373 cvt_fd(&data.f, &data.d, &current->thread.fpscr);
374 preempt_enable();
375 break;
376 case ST+F+S:
377 preempt_disable();
378 enable_kernel_fp();
379 cvt_df(&data.d, &data.f, &current->thread.fpscr);
380 preempt_enable();
381 break;
382 }
383
384 if (flags & ST) {
385 for (i = 0; i < nb; ++i)
386 if (__put_user(data.v[offset+i], addr+i))
387 return -EFAULT;
388 } else if (flags & F) {
389 current->thread.fpr[reg] = data.d;
390 } else {
391 regs->gpr[reg] = data.l;
392 }
393
394 if (flags & U)
395 regs->gpr[areg] = regs->dar;
396
397 return 1;
398}
diff --git a/arch/ppc/kernel/asm-offsets.c b/arch/ppc/kernel/asm-offsets.c
new file mode 100644
index 000000000000..d9ad1d776d0e
--- /dev/null
+++ b/arch/ppc/kernel/asm-offsets.c
@@ -0,0 +1,146 @@
1/*
2 * This program is used to generate definitions needed by
3 * assembly language modules.
4 *
5 * We use the technique used in the OSF Mach kernel code:
6 * generate asm statements containing #defines,
7 * compile this file to assembler, and then extract the
8 * #defines from the assembly-language output.
9 */
10
11#include <linux/config.h>
12#include <linux/signal.h>
13#include <linux/sched.h>
14#include <linux/kernel.h>
15#include <linux/errno.h>
16#include <linux/string.h>
17#include <linux/types.h>
18#include <linux/ptrace.h>
19#include <linux/suspend.h>
20#include <linux/mman.h>
21#include <linux/mm.h>
22#include <asm/io.h>
23#include <asm/page.h>
24#include <asm/pgtable.h>
25#include <asm/processor.h>
26#include <asm/cputable.h>
27#include <asm/thread_info.h>
28
29#define DEFINE(sym, val) \
30 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
31
32#define BLANK() asm volatile("\n->" : : )
33
34int
35main(void)
36{
37 DEFINE(THREAD, offsetof(struct task_struct, thread));
38 DEFINE(THREAD_INFO, offsetof(struct task_struct, thread_info));
39 DEFINE(MM, offsetof(struct task_struct, mm));
40 DEFINE(PTRACE, offsetof(struct task_struct, ptrace));
41 DEFINE(KSP, offsetof(struct thread_struct, ksp));
42 DEFINE(PGDIR, offsetof(struct thread_struct, pgdir));
43 DEFINE(LAST_SYSCALL, offsetof(struct thread_struct, last_syscall));
44 DEFINE(PT_REGS, offsetof(struct thread_struct, regs));
45 DEFINE(THREAD_FPEXC_MODE, offsetof(struct thread_struct, fpexc_mode));
46 DEFINE(THREAD_FPR0, offsetof(struct thread_struct, fpr[0]));
47 DEFINE(THREAD_FPSCR, offsetof(struct thread_struct, fpscr));
48#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
49 DEFINE(THREAD_DBCR0, offsetof(struct thread_struct, dbcr0));
50 DEFINE(PT_PTRACED, PT_PTRACED);
51#endif
52#ifdef CONFIG_ALTIVEC
53 DEFINE(THREAD_VR0, offsetof(struct thread_struct, vr[0]));
54 DEFINE(THREAD_VRSAVE, offsetof(struct thread_struct, vrsave));
55 DEFINE(THREAD_VSCR, offsetof(struct thread_struct, vscr));
56 DEFINE(THREAD_USED_VR, offsetof(struct thread_struct, used_vr));
57#endif /* CONFIG_ALTIVEC */
58#ifdef CONFIG_SPE
59 DEFINE(THREAD_EVR0, offsetof(struct thread_struct, evr[0]));
60 DEFINE(THREAD_ACC, offsetof(struct thread_struct, acc));
61 DEFINE(THREAD_SPEFSCR, offsetof(struct thread_struct, spefscr));
62 DEFINE(THREAD_USED_SPE, offsetof(struct thread_struct, used_spe));
63#endif /* CONFIG_SPE */
64 /* Interrupt register frame */
65 DEFINE(STACK_FRAME_OVERHEAD, STACK_FRAME_OVERHEAD);
66 DEFINE(INT_FRAME_SIZE, STACK_FRAME_OVERHEAD + sizeof(struct pt_regs));
67 /* in fact we only use gpr0 - gpr9 and gpr20 - gpr23 */
68 DEFINE(GPR0, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[0]));
69 DEFINE(GPR1, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[1]));
70 DEFINE(GPR2, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[2]));
71 DEFINE(GPR3, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[3]));
72 DEFINE(GPR4, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[4]));
73 DEFINE(GPR5, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[5]));
74 DEFINE(GPR6, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[6]));
75 DEFINE(GPR7, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[7]));
76 DEFINE(GPR8, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[8]));
77 DEFINE(GPR9, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[9]));
78 DEFINE(GPR10, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[10]));
79 DEFINE(GPR11, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[11]));
80 DEFINE(GPR12, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[12]));
81 DEFINE(GPR13, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[13]));
82 DEFINE(GPR14, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[14]));
83 DEFINE(GPR15, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[15]));
84 DEFINE(GPR16, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[16]));
85 DEFINE(GPR17, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[17]));
86 DEFINE(GPR18, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[18]));
87 DEFINE(GPR19, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[19]));
88 DEFINE(GPR20, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[20]));
89 DEFINE(GPR21, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[21]));
90 DEFINE(GPR22, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[22]));
91 DEFINE(GPR23, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[23]));
92 DEFINE(GPR24, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[24]));
93 DEFINE(GPR25, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[25]));
94 DEFINE(GPR26, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[26]));
95 DEFINE(GPR27, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[27]));
96 DEFINE(GPR28, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[28]));
97 DEFINE(GPR29, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[29]));
98 DEFINE(GPR30, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[30]));
99 DEFINE(GPR31, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[31]));
100 /* Note: these symbols include _ because they overlap with special
101 * register names
102 */
103 DEFINE(_NIP, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, nip));
104 DEFINE(_MSR, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, msr));
105 DEFINE(_CTR, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, ctr));
106 DEFINE(_LINK, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, link));
107 DEFINE(_CCR, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, ccr));
108 DEFINE(_MQ, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, mq));
109 DEFINE(_XER, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, xer));
110 DEFINE(_DAR, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, dar));
111 DEFINE(_DSISR, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, dsisr));
112 /* The PowerPC 400-class & Book-E processors have neither the DAR nor the DSISR
113 * SPRs. Hence, we overload them to hold the similar DEAR and ESR SPRs
114 * for such processors. For critical interrupts we use them to
115 * hold SRR0 and SRR1.
116 */
117 DEFINE(_DEAR, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, dar));
118 DEFINE(_ESR, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, dsisr));
119 DEFINE(ORIG_GPR3, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, orig_gpr3));
120 DEFINE(RESULT, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, result));
121 DEFINE(TRAP, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, trap));
122 DEFINE(CLONE_VM, CLONE_VM);
123 DEFINE(CLONE_UNTRACED, CLONE_UNTRACED);
124 DEFINE(MM_PGD, offsetof(struct mm_struct, pgd));
125
126 /* About the CPU features table */
127 DEFINE(CPU_SPEC_ENTRY_SIZE, sizeof(struct cpu_spec));
128 DEFINE(CPU_SPEC_PVR_MASK, offsetof(struct cpu_spec, pvr_mask));
129 DEFINE(CPU_SPEC_PVR_VALUE, offsetof(struct cpu_spec, pvr_value));
130 DEFINE(CPU_SPEC_FEATURES, offsetof(struct cpu_spec, cpu_features));
131 DEFINE(CPU_SPEC_SETUP, offsetof(struct cpu_spec, cpu_setup));
132
133 DEFINE(TI_TASK, offsetof(struct thread_info, task));
134 DEFINE(TI_EXECDOMAIN, offsetof(struct thread_info, exec_domain));
135 DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));
136 DEFINE(TI_LOCAL_FLAGS, offsetof(struct thread_info, local_flags));
137 DEFINE(TI_CPU, offsetof(struct thread_info, cpu));
138 DEFINE(TI_PREEMPT, offsetof(struct thread_info, preempt_count));
139
140 DEFINE(pbe_address, offsetof(struct pbe, address));
141 DEFINE(pbe_orig_address, offsetof(struct pbe, orig_address));
142 DEFINE(pbe_next, offsetof(struct pbe, next));
143
144 DEFINE(NUM_USER_SEGMENTS, TASK_SIZE>>28);
145 return 0;
146}
diff --git a/arch/ppc/kernel/bitops.c b/arch/ppc/kernel/bitops.c
new file mode 100644
index 000000000000..7f53d193968b
--- /dev/null
+++ b/arch/ppc/kernel/bitops.c
@@ -0,0 +1,126 @@
1/*
2 * Copyright (C) 1996 Paul Mackerras.
3 */
4
5#include <linux/kernel.h>
6#include <linux/bitops.h>
7
8/*
9 * If the bitops are not inlined in bitops.h, they are defined here.
10 * -- paulus
11 */
12#if !__INLINE_BITOPS
13void set_bit(int nr, volatile void * addr)
14{
15 unsigned long old;
16 unsigned long mask = 1 << (nr & 0x1f);
17 unsigned long *p = ((unsigned long *)addr) + (nr >> 5);
18
19 __asm__ __volatile__(SMP_WMB "\n\
201: lwarx %0,0,%3 \n\
21 or %0,%0,%2 \n"
22 PPC405_ERR77(0,%3)
23" stwcx. %0,0,%3 \n\
24 bne 1b"
25 SMP_MB
26 : "=&r" (old), "=m" (*p)
27 : "r" (mask), "r" (p), "m" (*p)
28 : "cc" );
29}
30
31void clear_bit(int nr, volatile void *addr)
32{
33 unsigned long old;
34 unsigned long mask = 1 << (nr & 0x1f);
35 unsigned long *p = ((unsigned long *)addr) + (nr >> 5);
36
37 __asm__ __volatile__(SMP_WMB "\n\
381: lwarx %0,0,%3 \n\
39 andc %0,%0,%2 \n"
40 PPC405_ERR77(0,%3)
41" stwcx. %0,0,%3 \n\
42 bne 1b"
43 SMP_MB
44 : "=&r" (old), "=m" (*p)
45 : "r" (mask), "r" (p), "m" (*p)
46 : "cc");
47}
48
49void change_bit(int nr, volatile void *addr)
50{
51 unsigned long old;
52 unsigned long mask = 1 << (nr & 0x1f);
53 unsigned long *p = ((unsigned long *)addr) + (nr >> 5);
54
55 __asm__ __volatile__(SMP_WMB "\n\
561: lwarx %0,0,%3 \n\
57 xor %0,%0,%2 \n"
58 PPC405_ERR77(0,%3)
59" stwcx. %0,0,%3 \n\
60 bne 1b"
61 SMP_MB
62 : "=&r" (old), "=m" (*p)
63 : "r" (mask), "r" (p), "m" (*p)
64 : "cc");
65}
66
67int test_and_set_bit(int nr, volatile void *addr)
68{
69 unsigned int old, t;
70 unsigned int mask = 1 << (nr & 0x1f);
71 volatile unsigned int *p = ((volatile unsigned int *)addr) + (nr >> 5);
72
73 __asm__ __volatile__(SMP_WMB "\n\
741: lwarx %0,0,%4 \n\
75 or %1,%0,%3 \n"
76 PPC405_ERR77(0,%4)
77" stwcx. %1,0,%4 \n\
78 bne 1b"
79 SMP_MB
80 : "=&r" (old), "=&r" (t), "=m" (*p)
81 : "r" (mask), "r" (p), "m" (*p)
82 : "cc");
83
84 return (old & mask) != 0;
85}
86
87int test_and_clear_bit(int nr, volatile void *addr)
88{
89 unsigned int old, t;
90 unsigned int mask = 1 << (nr & 0x1f);
91 volatile unsigned int *p = ((volatile unsigned int *)addr) + (nr >> 5);
92
93 __asm__ __volatile__(SMP_WMB "\n\
941: lwarx %0,0,%4 \n\
95 andc %1,%0,%3 \n"
96 PPC405_ERR77(0,%4)
97" stwcx. %1,0,%4 \n\
98 bne 1b"
99 SMP_MB
100 : "=&r" (old), "=&r" (t), "=m" (*p)
101 : "r" (mask), "r" (p), "m" (*p)
102 : "cc");
103
104 return (old & mask) != 0;
105}
106
107int test_and_change_bit(int nr, volatile void *addr)
108{
109 unsigned int old, t;
110 unsigned int mask = 1 << (nr & 0x1f);
111 volatile unsigned int *p = ((volatile unsigned int *)addr) + (nr >> 5);
112
113 __asm__ __volatile__(SMP_WMB "\n\
1141: lwarx %0,0,%4 \n\
115 xor %1,%0,%3 \n"
116 PPC405_ERR77(0,%4)
117" stwcx. %1,0,%4 \n\
118 bne 1b"
119 SMP_MB
120 : "=&r" (old), "=&r" (t), "=m" (*p)
121 : "r" (mask), "r" (p), "m" (*p)
122 : "cc");
123
124 return (old & mask) != 0;
125}
126#endif /* !__INLINE_BITOPS */
diff --git a/arch/ppc/kernel/cpu_setup_6xx.S b/arch/ppc/kernel/cpu_setup_6xx.S
new file mode 100644
index 000000000000..74f781b486a3
--- /dev/null
+++ b/arch/ppc/kernel/cpu_setup_6xx.S
@@ -0,0 +1,440 @@
1/*
2 * This file contains low level CPU setup functions.
3 * Copyright (C) 2003 Benjamin Herrenschmidt (benh@kernel.crashing.org)
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 *
10 */
11
12#include <linux/config.h>
13#include <asm/processor.h>
14#include <asm/page.h>
15#include <asm/ppc_asm.h>
16#include <asm/cputable.h>
17#include <asm/ppc_asm.h>
18#include <asm/offsets.h>
19#include <asm/cache.h>
20
21_GLOBAL(__setup_cpu_601)
22 blr
23_GLOBAL(__setup_cpu_603)
24 b setup_common_caches
25_GLOBAL(__setup_cpu_604)
26 mflr r4
27 bl setup_common_caches
28 bl setup_604_hid0
29 mtlr r4
30 blr
31_GLOBAL(__setup_cpu_750)
32 mflr r4
33 bl setup_common_caches
34 bl setup_750_7400_hid0
35 mtlr r4
36 blr
37_GLOBAL(__setup_cpu_750cx)
38 mflr r4
39 bl setup_common_caches
40 bl setup_750_7400_hid0
41 bl setup_750cx
42 mtlr r4
43 blr
44_GLOBAL(__setup_cpu_750fx)
45 mflr r4
46 bl setup_common_caches
47 bl setup_750_7400_hid0
48 bl setup_750fx
49 mtlr r4
50 blr
51_GLOBAL(__setup_cpu_7400)
52 mflr r4
53 bl setup_7400_workarounds
54 bl setup_common_caches
55 bl setup_750_7400_hid0
56 mtlr r4
57 blr
58_GLOBAL(__setup_cpu_7410)
59 mflr r4
60 bl setup_7410_workarounds
61 bl setup_common_caches
62 bl setup_750_7400_hid0
63 li r3,0
64 mtspr SPRN_L2CR2,r3
65 mtlr r4
66 blr
67_GLOBAL(__setup_cpu_745x)
68 mflr r4
69 bl setup_common_caches
70 bl setup_745x_specifics
71 mtlr r4
72 blr
73
74/* Enable caches for 603's, 604, 750 & 7400 */
75setup_common_caches:
76 mfspr r11,SPRN_HID0
77 andi. r0,r11,HID0_DCE
78 ori r11,r11,HID0_ICE|HID0_DCE
79 ori r8,r11,HID0_ICFI
80 bne 1f /* don't invalidate the D-cache */
81 ori r8,r8,HID0_DCI /* unless it wasn't enabled */
821: sync
83 mtspr SPRN_HID0,r8 /* enable and invalidate caches */
84 sync
85 mtspr SPRN_HID0,r11 /* enable caches */
86 sync
87 isync
88 blr
89
90/* 604, 604e, 604ev, ...
91 * Enable superscalar execution & branch history table
92 */
93setup_604_hid0:
94 mfspr r11,SPRN_HID0
95 ori r11,r11,HID0_SIED|HID0_BHTE
96 ori r8,r11,HID0_BTCD
97 sync
98 mtspr SPRN_HID0,r8 /* flush branch target address cache */
99 sync /* on 604e/604r */
100 mtspr SPRN_HID0,r11
101 sync
102 isync
103 blr
104
105/* 7400 <= rev 2.7 and 7410 rev = 1.0 suffer from some
106 * erratas we work around here.
107 * Moto MPC710CE.pdf describes them, those are errata
108 * #3, #4 and #5
109 * Note that we assume the firmware didn't choose to
110 * apply other workarounds (there are other ones documented
111 * in the .pdf). It appear that Apple firmware only works
112 * around #3 and with the same fix we use. We may want to
113 * check if the CPU is using 60x bus mode in which case
114 * the workaround for errata #4 is useless. Also, we may
115 * want to explicitely clear HID0_NOPDST as this is not
116 * needed once we have applied workaround #5 (though it's
117 * not set by Apple's firmware at least).
118 */
119setup_7400_workarounds:
120 mfpvr r3
121 rlwinm r3,r3,0,20,31
122 cmpwi 0,r3,0x0207
123 ble 1f
124 blr
125setup_7410_workarounds:
126 mfpvr r3
127 rlwinm r3,r3,0,20,31
128 cmpwi 0,r3,0x0100
129 bnelr
1301:
131 mfspr r11,SPRN_MSSSR0
132 /* Errata #3: Set L1OPQ_SIZE to 0x10 */
133 rlwinm r11,r11,0,9,6
134 oris r11,r11,0x0100
135 /* Errata #4: Set L2MQ_SIZE to 1 (check for MPX mode first ?) */
136 oris r11,r11,0x0002
137 /* Errata #5: Set DRLT_SIZE to 0x01 */
138 rlwinm r11,r11,0,5,2
139 oris r11,r11,0x0800
140 sync
141 mtspr SPRN_MSSSR0,r11
142 sync
143 isync
144 blr
145
146/* 740/750/7400/7410
147 * Enable Store Gathering (SGE), Address Brodcast (ABE),
148 * Branch History Table (BHTE), Branch Target ICache (BTIC)
149 * Dynamic Power Management (DPM), Speculative (SPD)
150 * Clear Instruction cache throttling (ICTC)
151 */
152setup_750_7400_hid0:
153 mfspr r11,SPRN_HID0
154 ori r11,r11,HID0_SGE | HID0_ABE | HID0_BHTE | HID0_BTIC
155BEGIN_FTR_SECTION
156 oris r11,r11,HID0_DPM@h /* enable dynamic power mgmt */
157END_FTR_SECTION_IFCLR(CPU_FTR_NO_DPM)
158 li r3,HID0_SPD
159 andc r11,r11,r3 /* clear SPD: enable speculative */
160 li r3,0
161 mtspr SPRN_ICTC,r3 /* Instruction Cache Throttling off */
162 isync
163 mtspr SPRN_HID0,r11
164 sync
165 isync
166 blr
167
168/* 750cx specific
169 * Looks like we have to disable NAP feature for some PLL settings...
170 * (waiting for confirmation)
171 */
172setup_750cx:
173 mfspr r10, SPRN_HID1
174 rlwinm r10,r10,4,28,31
175 cmpwi cr0,r10,7
176 cmpwi cr1,r10,9
177 cmpwi cr2,r10,11
178 cror 4*cr0+eq,4*cr0+eq,4*cr1+eq
179 cror 4*cr0+eq,4*cr0+eq,4*cr2+eq
180 bnelr
181 lwz r6,CPU_SPEC_FEATURES(r5)
182 li r7,CPU_FTR_CAN_NAP
183 andc r6,r6,r7
184 stw r6,CPU_SPEC_FEATURES(r5)
185 blr
186
187/* 750fx specific
188 */
189setup_750fx:
190 blr
191
192/* MPC 745x
193 * Enable Store Gathering (SGE), Branch Folding (FOLD)
194 * Branch History Table (BHTE), Branch Target ICache (BTIC)
195 * Dynamic Power Management (DPM), Speculative (SPD)
196 * Ensure our data cache instructions really operate.
197 * Timebase has to be running or we wouldn't have made it here,
198 * just ensure we don't disable it.
199 * Clear Instruction cache throttling (ICTC)
200 * Enable L2 HW prefetch
201 */
202setup_745x_specifics:
203 /* We check for the presence of an L3 cache setup by
204 * the firmware. If any, we disable NAP capability as
205 * it's known to be bogus on rev 2.1 and earlier
206 */
207 mfspr r11,SPRN_L3CR
208 andis. r11,r11,L3CR_L3E@h
209 beq 1f
210 lwz r6,CPU_SPEC_FEATURES(r5)
211 andi. r0,r6,CPU_FTR_L3_DISABLE_NAP
212 beq 1f
213 li r7,CPU_FTR_CAN_NAP
214 andc r6,r6,r7
215 stw r6,CPU_SPEC_FEATURES(r5)
2161:
217 mfspr r11,SPRN_HID0
218
219 /* All of the bits we have to set.....
220 */
221 ori r11,r11,HID0_SGE | HID0_FOLD | HID0_BHTE | HID0_LRSTK | HID0_BTIC
222BEGIN_FTR_SECTION
223 xori r11,r11,HID0_BTIC
224END_FTR_SECTION_IFSET(CPU_FTR_NO_BTIC)
225BEGIN_FTR_SECTION
226 oris r11,r11,HID0_DPM@h /* enable dynamic power mgmt */
227END_FTR_SECTION_IFCLR(CPU_FTR_NO_DPM)
228
229 /* All of the bits we have to clear....
230 */
231 li r3,HID0_SPD | HID0_NOPDST | HID0_NOPTI
232 andc r11,r11,r3 /* clear SPD: enable speculative */
233 li r3,0
234
235 mtspr SPRN_ICTC,r3 /* Instruction Cache Throttling off */
236 isync
237 mtspr SPRN_HID0,r11
238 sync
239 isync
240
241 /* Enable L2 HW prefetch
242 */
243 mfspr r3,SPRN_MSSCR0
244 ori r3,r3,3
245 sync
246 mtspr SPRN_MSSCR0,r3
247 sync
248 isync
249 blr
250
251/* Definitions for the table use to save CPU states */
252#define CS_HID0 0
253#define CS_HID1 4
254#define CS_HID2 8
255#define CS_MSSCR0 12
256#define CS_MSSSR0 16
257#define CS_ICTRL 20
258#define CS_LDSTCR 24
259#define CS_LDSTDB 28
260#define CS_SIZE 32
261
262 .data
263 .balign L1_CACHE_LINE_SIZE
264cpu_state_storage:
265 .space CS_SIZE
266 .balign L1_CACHE_LINE_SIZE,0
267 .text
268
269/* Called in normal context to backup CPU 0 state. This
270 * does not include cache settings. This function is also
271 * called for machine sleep. This does not include the MMU
272 * setup, BATs, etc... but rather the "special" registers
273 * like HID0, HID1, MSSCR0, etc...
274 */
275_GLOBAL(__save_cpu_setup)
276 /* Some CR fields are volatile, we back it up all */
277 mfcr r7
278
279 /* Get storage ptr */
280 lis r5,cpu_state_storage@h
281 ori r5,r5,cpu_state_storage@l
282
283 /* Save HID0 (common to all CONFIG_6xx cpus) */
284 mfspr r3,SPRN_HID0
285 stw r3,CS_HID0(r5)
286
287 /* Now deal with CPU type dependent registers */
288 mfspr r3,SPRN_PVR
289 srwi r3,r3,16
290 cmplwi cr0,r3,0x8000 /* 7450 */
291 cmplwi cr1,r3,0x000c /* 7400 */
292 cmplwi cr2,r3,0x800c /* 7410 */
293 cmplwi cr3,r3,0x8001 /* 7455 */
294 cmplwi cr4,r3,0x8002 /* 7457 */
295 cmplwi cr5,r3,0x8003 /* 7447A */
296 cmplwi cr6,r3,0x7000 /* 750FX */
297 /* cr1 is 7400 || 7410 */
298 cror 4*cr1+eq,4*cr1+eq,4*cr2+eq
299 /* cr0 is 74xx */
300 cror 4*cr0+eq,4*cr0+eq,4*cr3+eq
301 cror 4*cr0+eq,4*cr0+eq,4*cr4+eq
302 cror 4*cr0+eq,4*cr0+eq,4*cr1+eq
303 cror 4*cr0+eq,4*cr0+eq,4*cr5+eq
304 bne 1f
305 /* Backup 74xx specific regs */
306 mfspr r4,SPRN_MSSCR0
307 stw r4,CS_MSSCR0(r5)
308 mfspr r4,SPRN_MSSSR0
309 stw r4,CS_MSSSR0(r5)
310 beq cr1,1f
311 /* Backup 745x specific registers */
312 mfspr r4,SPRN_HID1
313 stw r4,CS_HID1(r5)
314 mfspr r4,SPRN_ICTRL
315 stw r4,CS_ICTRL(r5)
316 mfspr r4,SPRN_LDSTCR
317 stw r4,CS_LDSTCR(r5)
318 mfspr r4,SPRN_LDSTDB
319 stw r4,CS_LDSTDB(r5)
3201:
321 bne cr6,1f
322 /* Backup 750FX specific registers */
323 mfspr r4,SPRN_HID1
324 stw r4,CS_HID1(r5)
325 /* If rev 2.x, backup HID2 */
326 mfspr r3,SPRN_PVR
327 andi. r3,r3,0xff00
328 cmpwi cr0,r3,0x0200
329 bne 1f
330 mfspr r4,SPRN_HID2
331 stw r4,CS_HID2(r5)
3321:
333 mtcr r7
334 blr
335
336/* Called with no MMU context (typically MSR:IR/DR off) to
337 * restore CPU state as backed up by the previous
338 * function. This does not include cache setting
339 */
340_GLOBAL(__restore_cpu_setup)
341 /* Some CR fields are volatile, we back it up all */
342 mfcr r7
343
344 /* Get storage ptr */
345 lis r5,(cpu_state_storage-KERNELBASE)@h
346 ori r5,r5,cpu_state_storage@l
347
348 /* Restore HID0 */
349 lwz r3,CS_HID0(r5)
350 sync
351 isync
352 mtspr SPRN_HID0,r3
353 sync
354 isync
355
356 /* Now deal with CPU type dependent registers */
357 mfspr r3,SPRN_PVR
358 srwi r3,r3,16
359 cmplwi cr0,r3,0x8000 /* 7450 */
360 cmplwi cr1,r3,0x000c /* 7400 */
361 cmplwi cr2,r3,0x800c /* 7410 */
362 cmplwi cr3,r3,0x8001 /* 7455 */
363 cmplwi cr4,r3,0x8002 /* 7457 */
364 cmplwi cr5,r3,0x8003 /* 7447A */
365 cmplwi cr6,r3,0x7000 /* 750FX */
366 /* cr1 is 7400 || 7410 */
367 cror 4*cr1+eq,4*cr1+eq,4*cr2+eq
368 /* cr0 is 74xx */
369 cror 4*cr0+eq,4*cr0+eq,4*cr3+eq
370 cror 4*cr0+eq,4*cr0+eq,4*cr4+eq
371 cror 4*cr0+eq,4*cr0+eq,4*cr1+eq
372 cror 4*cr0+eq,4*cr0+eq,4*cr5+eq
373 bne 2f
374 /* Restore 74xx specific regs */
375 lwz r4,CS_MSSCR0(r5)
376 sync
377 mtspr SPRN_MSSCR0,r4
378 sync
379 isync
380 lwz r4,CS_MSSSR0(r5)
381 sync
382 mtspr SPRN_MSSSR0,r4
383 sync
384 isync
385 bne cr2,1f
386 /* Clear 7410 L2CR2 */
387 li r4,0
388 mtspr SPRN_L2CR2,r4
3891: beq cr1,2f
390 /* Restore 745x specific registers */
391 lwz r4,CS_HID1(r5)
392 sync
393 mtspr SPRN_HID1,r4
394 isync
395 sync
396 lwz r4,CS_ICTRL(r5)
397 sync
398 mtspr SPRN_ICTRL,r4
399 isync
400 sync
401 lwz r4,CS_LDSTCR(r5)
402 sync
403 mtspr SPRN_LDSTCR,r4
404 isync
405 sync
406 lwz r4,CS_LDSTDB(r5)
407 sync
408 mtspr SPRN_LDSTDB,r4
409 isync
410 sync
4112: bne cr6,1f
412 /* Restore 750FX specific registers
413 * that is restore HID2 on rev 2.x and PLL config & switch
414 * to PLL 0 on all
415 */
416 /* If rev 2.x, restore HID2 with low voltage bit cleared */
417 mfspr r3,SPRN_PVR
418 andi. r3,r3,0xff00
419 cmpwi cr0,r3,0x0200
420 bne 4f
421 lwz r4,CS_HID2(r5)
422 rlwinm r4,r4,0,19,17
423 mtspr SPRN_HID2,r4
424 sync
4254:
426 lwz r4,CS_HID1(r5)
427 rlwinm r5,r4,0,16,14
428 mtspr SPRN_HID1,r5
429 /* Wait for PLL to stabilize */
430 mftbl r5
4313: mftbl r6
432 sub r6,r6,r5
433 cmplwi cr0,r6,10000
434 ble 3b
435 /* Setup final PLL */
436 mtspr SPRN_HID1,r4
4371:
438 mtcr r7
439 blr
440
diff --git a/arch/ppc/kernel/cpu_setup_power4.S b/arch/ppc/kernel/cpu_setup_power4.S
new file mode 100644
index 000000000000..f2ea1a990f17
--- /dev/null
+++ b/arch/ppc/kernel/cpu_setup_power4.S
@@ -0,0 +1,201 @@
1/*
2 * This file contains low level CPU setup functions.
3 * Copyright (C) 2003 Benjamin Herrenschmidt (benh@kernel.crashing.org)
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 *
10 */
11
12#include <linux/config.h>
13#include <asm/processor.h>
14#include <asm/page.h>
15#include <asm/ppc_asm.h>
16#include <asm/cputable.h>
17#include <asm/ppc_asm.h>
18#include <asm/offsets.h>
19#include <asm/cache.h>
20
21_GLOBAL(__970_cpu_preinit)
22 /*
23 * Deal only with PPC970 and PPC970FX.
24 */
25 mfspr r0,SPRN_PVR
26 srwi r0,r0,16
27 cmpwi cr0,r0,0x39
28 cmpwi cr1,r0,0x3c
29 cror 4*cr0+eq,4*cr0+eq,4*cr1+eq
30 bnelr
31
32 /* Make sure HID4:rm_ci is off before MMU is turned off, that large
33 * pages are enabled with HID4:61 and clear HID5:DCBZ_size and
34 * HID5:DCBZ32_ill
35 */
36 li r0,0
37 mfspr r11,SPRN_HID4
38 rldimi r11,r0,40,23 /* clear bit 23 (rm_ci) */
39 rldimi r11,r0,2,61 /* clear bit 61 (lg_pg_en) */
40 sync
41 mtspr SPRN_HID4,r11
42 isync
43 sync
44 mfspr r11,SPRN_HID5
45 rldimi r11,r0,6,56 /* clear bits 56 & 57 (DCBZ*) */
46 sync
47 mtspr SPRN_HID5,r11
48 isync
49 sync
50
51 /* Setup some basic HID1 features */
52 mfspr r0,SPRN_HID1
53 li r11,0x1200 /* enable i-fetch cacheability */
54 sldi r11,r11,44 /* and prefetch */
55 or r0,r0,r11
56 mtspr SPRN_HID1,r0
57 mtspr SPRN_HID1,r0
58 isync
59
60 /* Clear HIOR */
61 li r0,0
62 sync
63 mtspr SPRN_HIOR,0 /* Clear interrupt prefix */
64 isync
65 blr
66
67_GLOBAL(__setup_cpu_power4)
68 blr
69_GLOBAL(__setup_cpu_ppc970)
70 mfspr r0,SPRN_HID0
71 li r11,5 /* clear DOZE and SLEEP */
72 rldimi r0,r11,52,8 /* set NAP and DPM */
73 mtspr SPRN_HID0,r0
74 mfspr r0,SPRN_HID0
75 mfspr r0,SPRN_HID0
76 mfspr r0,SPRN_HID0
77 mfspr r0,SPRN_HID0
78 mfspr r0,SPRN_HID0
79 mfspr r0,SPRN_HID0
80 sync
81 isync
82 blr
83
84/* Definitions for the table use to save CPU states */
85#define CS_HID0 0
86#define CS_HID1 8
87#define CS_HID4 16
88#define CS_HID5 24
89#define CS_SIZE 32
90
91 .data
92 .balign L1_CACHE_LINE_SIZE
93cpu_state_storage:
94 .space CS_SIZE
95 .balign L1_CACHE_LINE_SIZE,0
96 .text
97
98/* Called in normal context to backup CPU 0 state. This
99 * does not include cache settings. This function is also
100 * called for machine sleep. This does not include the MMU
101 * setup, BATs, etc... but rather the "special" registers
102 * like HID0, HID1, HID4, etc...
103 */
104_GLOBAL(__save_cpu_setup)
105 /* Some CR fields are volatile, we back it up all */
106 mfcr r7
107
108 /* Get storage ptr */
109 lis r5,cpu_state_storage@h
110 ori r5,r5,cpu_state_storage@l
111
112 /* We only deal with 970 for now */
113 mfspr r0,SPRN_PVR
114 srwi r0,r0,16
115 cmpwi cr0,r0,0x39
116 cmpwi cr1,r0,0x3c
117 cror 4*cr0+eq,4*cr0+eq,4*cr1+eq
118 bne 1f
119
120 /* Save HID0,1,4 and 5 */
121 mfspr r3,SPRN_HID0
122 std r3,CS_HID0(r5)
123 mfspr r3,SPRN_HID1
124 std r3,CS_HID1(r5)
125 mfspr r3,SPRN_HID4
126 std r3,CS_HID4(r5)
127 mfspr r3,SPRN_HID5
128 std r3,CS_HID5(r5)
129
1301:
131 mtcr r7
132 blr
133
134/* Called with no MMU context (typically MSR:IR/DR off) to
135 * restore CPU state as backed up by the previous
136 * function. This does not include cache setting
137 */
138_GLOBAL(__restore_cpu_setup)
139 /* Some CR fields are volatile, we back it up all */
140 mfcr r7
141
142 /* Get storage ptr */
143 lis r5,(cpu_state_storage-KERNELBASE)@h
144 ori r5,r5,cpu_state_storage@l
145
146 /* We only deal with 970 for now */
147 mfspr r0,SPRN_PVR
148 srwi r0,r0,16
149 cmpwi cr0,r0,0x39
150 cmpwi cr1,r0,0x3c
151 cror 4*cr0+eq,4*cr0+eq,4*cr1+eq
152 bne 1f
153
154 /* Clear interrupt prefix */
155 li r0,0
156 sync
157 mtspr SPRN_HIOR,0
158 isync
159
160 /* Restore HID0 */
161 ld r3,CS_HID0(r5)
162 sync
163 isync
164 mtspr SPRN_HID0,r3
165 mfspr r3,SPRN_HID0
166 mfspr r3,SPRN_HID0
167 mfspr r3,SPRN_HID0
168 mfspr r3,SPRN_HID0
169 mfspr r3,SPRN_HID0
170 mfspr r3,SPRN_HID0
171 sync
172 isync
173
174 /* Restore HID1 */
175 ld r3,CS_HID1(r5)
176 sync
177 isync
178 mtspr SPRN_HID1,r3
179 mtspr SPRN_HID1,r3
180 sync
181 isync
182
183 /* Restore HID4 */
184 ld r3,CS_HID4(r5)
185 sync
186 isync
187 mtspr SPRN_HID4,r3
188 sync
189 isync
190
191 /* Restore HID5 */
192 ld r3,CS_HID5(r5)
193 sync
194 isync
195 mtspr SPRN_HID5,r3
196 sync
197 isync
1981:
199 mtcr r7
200 blr
201
diff --git a/arch/ppc/kernel/cputable.c b/arch/ppc/kernel/cputable.c
new file mode 100644
index 000000000000..8aa5e8c69009
--- /dev/null
+++ b/arch/ppc/kernel/cputable.c
@@ -0,0 +1,922 @@
1/*
2 * arch/ppc/kernel/cputable.c
3 *
4 * Copyright (C) 2001 Ben. Herrenschmidt (benh@kernel.crashing.org)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#include <linux/config.h>
13#include <linux/string.h>
14#include <linux/sched.h>
15#include <linux/threads.h>
16#include <linux/init.h>
17#include <asm/cputable.h>
18
19struct cpu_spec* cur_cpu_spec[NR_CPUS];
20
21extern void __setup_cpu_601(unsigned long offset, int cpu_nr, struct cpu_spec* spec);
22extern void __setup_cpu_603(unsigned long offset, int cpu_nr, struct cpu_spec* spec);
23extern void __setup_cpu_604(unsigned long offset, int cpu_nr, struct cpu_spec* spec);
24extern void __setup_cpu_750(unsigned long offset, int cpu_nr, struct cpu_spec* spec);
25extern void __setup_cpu_750cx(unsigned long offset, int cpu_nr, struct cpu_spec* spec);
26extern void __setup_cpu_750fx(unsigned long offset, int cpu_nr, struct cpu_spec* spec);
27extern void __setup_cpu_7400(unsigned long offset, int cpu_nr, struct cpu_spec* spec);
28extern void __setup_cpu_7410(unsigned long offset, int cpu_nr, struct cpu_spec* spec);
29extern void __setup_cpu_745x(unsigned long offset, int cpu_nr, struct cpu_spec* spec);
30extern void __setup_cpu_power3(unsigned long offset, int cpu_nr, struct cpu_spec* spec);
31extern void __setup_cpu_power4(unsigned long offset, int cpu_nr, struct cpu_spec* spec);
32extern void __setup_cpu_ppc970(unsigned long offset, int cpu_nr, struct cpu_spec* spec);
33extern void __setup_cpu_generic(unsigned long offset, int cpu_nr, struct cpu_spec* spec);
34
35#define CLASSIC_PPC (!defined(CONFIG_8xx) && !defined(CONFIG_4xx) && \
36 !defined(CONFIG_POWER3) && !defined(CONFIG_POWER4) && \
37 !defined(CONFIG_BOOKE))
38
39/* This table only contains "desktop" CPUs, it need to be filled with embedded
40 * ones as well...
41 */
42#define COMMON_PPC (PPC_FEATURE_32 | PPC_FEATURE_HAS_FPU | \
43 PPC_FEATURE_HAS_MMU)
44
45/* We only set the altivec features if the kernel was compiled with altivec
46 * support
47 */
48#ifdef CONFIG_ALTIVEC
49#define CPU_FTR_ALTIVEC_COMP CPU_FTR_ALTIVEC
50#define PPC_FEATURE_ALTIVEC_COMP PPC_FEATURE_HAS_ALTIVEC
51#else
52#define CPU_FTR_ALTIVEC_COMP 0
53#define PPC_FEATURE_ALTIVEC_COMP 0
54#endif
55
56/* We only set the spe features if the kernel was compiled with
57 * spe support
58 */
59#ifdef CONFIG_SPE
60#define PPC_FEATURE_SPE_COMP PPC_FEATURE_HAS_SPE
61#else
62#define PPC_FEATURE_SPE_COMP 0
63#endif
64
65/* We need to mark all pages as being coherent if we're SMP or we
66 * have a 74[45]x and an MPC107 host bridge.
67 */
68#if defined(CONFIG_SMP) || defined(CONFIG_MPC10X_BRIDGE)
69#define CPU_FTR_COMMON CPU_FTR_NEED_COHERENT
70#else
71#define CPU_FTR_COMMON 0
72#endif
73
74/* The powersave features NAP & DOZE seems to confuse BDI when
75 debugging. So if a BDI is used, disable theses
76 */
77#ifndef CONFIG_BDI_SWITCH
78#define CPU_FTR_MAYBE_CAN_DOZE CPU_FTR_CAN_DOZE
79#define CPU_FTR_MAYBE_CAN_NAP CPU_FTR_CAN_NAP
80#else
81#define CPU_FTR_MAYBE_CAN_DOZE 0
82#define CPU_FTR_MAYBE_CAN_NAP 0
83#endif
84
85struct cpu_spec cpu_specs[] = {
86#if CLASSIC_PPC
87 { /* 601 */
88 .pvr_mask = 0xffff0000,
89 .pvr_value = 0x00010000,
90 .cpu_name = "601",
91 .cpu_features = CPU_FTR_COMMON | CPU_FTR_601 |
92 CPU_FTR_HPTE_TABLE,
93 .cpu_user_features = COMMON_PPC | PPC_FEATURE_601_INSTR |
94 PPC_FEATURE_UNIFIED_CACHE,
95 .icache_bsize = 32,
96 .dcache_bsize = 32,
97 .cpu_setup = __setup_cpu_601
98 },
99 { /* 603 */
100 .pvr_mask = 0xffff0000,
101 .pvr_value = 0x00030000,
102 .cpu_name = "603",
103 .cpu_features = CPU_FTR_COMMON |
104 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_MAYBE_CAN_DOZE |
105 CPU_FTR_USE_TB | CPU_FTR_MAYBE_CAN_NAP,
106 .cpu_user_features = COMMON_PPC,
107 .icache_bsize = 32,
108 .dcache_bsize = 32,
109 .cpu_setup = __setup_cpu_603
110 },
111 { /* 603e */
112 .pvr_mask = 0xffff0000,
113 .pvr_value = 0x00060000,
114 .cpu_name = "603e",
115 .cpu_features = CPU_FTR_COMMON |
116 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_MAYBE_CAN_DOZE |
117 CPU_FTR_USE_TB | CPU_FTR_MAYBE_CAN_NAP,
118 .cpu_user_features = COMMON_PPC,
119 .icache_bsize = 32,
120 .dcache_bsize = 32,
121 .cpu_setup = __setup_cpu_603
122 },
123 { /* 603ev */
124 .pvr_mask = 0xffff0000,
125 .pvr_value = 0x00070000,
126 .cpu_name = "603ev",
127 .cpu_features = CPU_FTR_COMMON |
128 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_MAYBE_CAN_DOZE |
129 CPU_FTR_USE_TB | CPU_FTR_MAYBE_CAN_NAP,
130 .cpu_user_features = COMMON_PPC,
131 .icache_bsize = 32,
132 .dcache_bsize = 32,
133 .cpu_setup = __setup_cpu_603
134 },
135 { /* 604 */
136 .pvr_mask = 0xffff0000,
137 .pvr_value = 0x00040000,
138 .cpu_name = "604",
139 .cpu_features = CPU_FTR_COMMON |
140 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB |
141 CPU_FTR_604_PERF_MON | CPU_FTR_HPTE_TABLE,
142 .cpu_user_features = COMMON_PPC,
143 .icache_bsize = 32,
144 .dcache_bsize = 32,
145 .num_pmcs = 2,
146 .cpu_setup = __setup_cpu_604
147 },
148 { /* 604e */
149 .pvr_mask = 0xfffff000,
150 .pvr_value = 0x00090000,
151 .cpu_name = "604e",
152 .cpu_features = CPU_FTR_COMMON |
153 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB |
154 CPU_FTR_604_PERF_MON | CPU_FTR_HPTE_TABLE,
155 .cpu_user_features = COMMON_PPC,
156 .icache_bsize = 32,
157 .dcache_bsize = 32,
158 .num_pmcs = 4,
159 .cpu_setup = __setup_cpu_604
160 },
161 { /* 604r */
162 .pvr_mask = 0xffff0000,
163 .pvr_value = 0x00090000,
164 .cpu_name = "604r",
165 .cpu_features = CPU_FTR_COMMON |
166 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB |
167 CPU_FTR_604_PERF_MON | CPU_FTR_HPTE_TABLE,
168 .cpu_user_features = COMMON_PPC,
169 .icache_bsize = 32,
170 .dcache_bsize = 32,
171 .num_pmcs = 4,
172 .cpu_setup = __setup_cpu_604
173 },
174 { /* 604ev */
175 .pvr_mask = 0xffff0000,
176 .pvr_value = 0x000a0000,
177 .cpu_name = "604ev",
178 .cpu_features = CPU_FTR_COMMON |
179 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB |
180 CPU_FTR_604_PERF_MON | CPU_FTR_HPTE_TABLE,
181 .cpu_user_features = COMMON_PPC,
182 .icache_bsize = 32,
183 .dcache_bsize = 32,
184 .num_pmcs = 4,
185 .cpu_setup = __setup_cpu_604
186 },
187 { /* 740/750 (0x4202, don't support TAU ?) */
188 .pvr_mask = 0xffffffff,
189 .pvr_value = 0x00084202,
190 .cpu_name = "740/750",
191 .cpu_features = CPU_FTR_COMMON |
192 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_MAYBE_CAN_DOZE |
193 CPU_FTR_USE_TB | CPU_FTR_L2CR | CPU_FTR_HPTE_TABLE |
194 CPU_FTR_MAYBE_CAN_NAP,
195 .cpu_user_features = COMMON_PPC,
196 .icache_bsize = 32,
197 .dcache_bsize = 32,
198 .num_pmcs = 4,
199 .cpu_setup = __setup_cpu_750
200 },
201 { /* 745/755 */
202 .pvr_mask = 0xfffff000,
203 .pvr_value = 0x00083000,
204 .cpu_name = "745/755",
205 .cpu_features = CPU_FTR_COMMON |
206 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_MAYBE_CAN_DOZE |
207 CPU_FTR_USE_TB | CPU_FTR_L2CR | CPU_FTR_TAU |
208 CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP,
209 .cpu_user_features = COMMON_PPC,
210 .icache_bsize = 32,
211 .dcache_bsize = 32,
212 .num_pmcs = 4,
213 .cpu_setup = __setup_cpu_750
214 },
215 { /* 750CX (80100 and 8010x?) */
216 .pvr_mask = 0xfffffff0,
217 .pvr_value = 0x00080100,
218 .cpu_name = "750CX",
219 .cpu_features = CPU_FTR_COMMON |
220 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_MAYBE_CAN_DOZE |
221 CPU_FTR_USE_TB | CPU_FTR_L2CR | CPU_FTR_TAU |
222 CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP,
223 .cpu_user_features = COMMON_PPC,
224 .icache_bsize = 32,
225 .dcache_bsize = 32,
226 .num_pmcs = 4,
227 .cpu_setup = __setup_cpu_750cx
228 },
229 { /* 750CX (82201 and 82202) */
230 .pvr_mask = 0xfffffff0,
231 .pvr_value = 0x00082200,
232 .cpu_name = "750CX",
233 .cpu_features = CPU_FTR_COMMON |
234 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_MAYBE_CAN_DOZE |
235 CPU_FTR_USE_TB | CPU_FTR_L2CR | CPU_FTR_TAU |
236 CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP,
237 .cpu_user_features = COMMON_PPC,
238 .icache_bsize = 32,
239 .dcache_bsize = 32,
240 .num_pmcs = 4,
241 .cpu_setup = __setup_cpu_750cx
242 },
243 { /* 750CXe (82214) */
244 .pvr_mask = 0xfffffff0,
245 .pvr_value = 0x00082210,
246 .cpu_name = "750CXe",
247 .cpu_features = CPU_FTR_COMMON |
248 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_MAYBE_CAN_DOZE |
249 CPU_FTR_USE_TB | CPU_FTR_L2CR | CPU_FTR_TAU |
250 CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP,
251 .cpu_user_features = COMMON_PPC,
252 .icache_bsize = 32,
253 .dcache_bsize = 32,
254 .num_pmcs = 4,
255 .cpu_setup = __setup_cpu_750cx
256 },
257 { /* 750FX rev 1.x */
258 .pvr_mask = 0xffffff00,
259 .pvr_value = 0x70000100,
260 .cpu_name = "750FX",
261 .cpu_features = CPU_FTR_COMMON |
262 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_MAYBE_CAN_DOZE |
263 CPU_FTR_USE_TB | CPU_FTR_L2CR | CPU_FTR_TAU |
264 CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP |
265 CPU_FTR_DUAL_PLL_750FX | CPU_FTR_NO_DPM,
266 .cpu_user_features = COMMON_PPC,
267 .icache_bsize = 32,
268 .dcache_bsize = 32,
269 .num_pmcs = 4,
270 .cpu_setup = __setup_cpu_750
271 },
272 { /* 750FX rev 2.0 must disable HID0[DPM] */
273 .pvr_mask = 0xffffffff,
274 .pvr_value = 0x70000200,
275 .cpu_name = "750FX",
276 .cpu_features = CPU_FTR_COMMON |
277 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_MAYBE_CAN_DOZE |
278 CPU_FTR_USE_TB | CPU_FTR_L2CR | CPU_FTR_TAU |
279 CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP |
280 CPU_FTR_NO_DPM,
281 .cpu_user_features = COMMON_PPC,
282 .icache_bsize = 32,
283 .dcache_bsize = 32,
284 .num_pmcs = 4,
285 .cpu_setup = __setup_cpu_750
286 },
287 { /* 750FX (All revs except 2.0) */
288 .pvr_mask = 0xffff0000,
289 .pvr_value = 0x70000000,
290 .cpu_name = "750FX",
291 .cpu_features = CPU_FTR_COMMON |
292 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_MAYBE_CAN_DOZE |
293 CPU_FTR_USE_TB | CPU_FTR_L2CR | CPU_FTR_TAU |
294 CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP |
295 CPU_FTR_DUAL_PLL_750FX | CPU_FTR_HAS_HIGH_BATS,
296 .cpu_user_features = COMMON_PPC,
297 .icache_bsize = 32,
298 .dcache_bsize = 32,
299 .num_pmcs = 4,
300 .cpu_setup = __setup_cpu_750fx
301 },
302 { /* 750GX */
303 .pvr_mask = 0xffff0000,
304 .pvr_value = 0x70020000,
305 .cpu_name = "750GX",
306 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
307 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB |
308 CPU_FTR_L2CR | CPU_FTR_TAU | CPU_FTR_HPTE_TABLE |
309 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_DUAL_PLL_750FX |
310 CPU_FTR_HAS_HIGH_BATS,
311 .cpu_user_features = COMMON_PPC,
312 .icache_bsize = 32,
313 .dcache_bsize = 32,
314 .num_pmcs = 4,
315 .cpu_setup = __setup_cpu_750fx
316 },
317 { /* 740/750 (L2CR bit need fixup for 740) */
318 .pvr_mask = 0xffff0000,
319 .pvr_value = 0x00080000,
320 .cpu_name = "740/750",
321 .cpu_features = CPU_FTR_COMMON |
322 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_MAYBE_CAN_DOZE |
323 CPU_FTR_USE_TB | CPU_FTR_L2CR | CPU_FTR_TAU |
324 CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP,
325 .cpu_user_features = COMMON_PPC,
326 .icache_bsize = 32,
327 .dcache_bsize = 32,
328 .num_pmcs = 4,
329 .cpu_setup = __setup_cpu_750
330 },
331 { /* 7400 rev 1.1 ? (no TAU) */
332 .pvr_mask = 0xffffffff,
333 .pvr_value = 0x000c1101,
334 .cpu_name = "7400 (1.1)",
335 .cpu_features = CPU_FTR_COMMON |
336 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_MAYBE_CAN_DOZE |
337 CPU_FTR_USE_TB | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP |
338 CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP,
339 .cpu_user_features = COMMON_PPC | PPC_FEATURE_ALTIVEC_COMP,
340 .icache_bsize = 32,
341 .dcache_bsize = 32,
342 .num_pmcs = 4,
343 .cpu_setup = __setup_cpu_7400
344 },
345 { /* 7400 */
346 .pvr_mask = 0xffff0000,
347 .pvr_value = 0x000c0000,
348 .cpu_name = "7400",
349 .cpu_features = CPU_FTR_COMMON |
350 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_MAYBE_CAN_DOZE |
351 CPU_FTR_USE_TB | CPU_FTR_L2CR | CPU_FTR_TAU |
352 CPU_FTR_ALTIVEC_COMP | CPU_FTR_HPTE_TABLE |
353 CPU_FTR_MAYBE_CAN_NAP,
354 .cpu_user_features = COMMON_PPC | PPC_FEATURE_ALTIVEC_COMP,
355 .icache_bsize = 32,
356 .dcache_bsize = 32,
357 .num_pmcs = 4,
358 .cpu_setup = __setup_cpu_7400
359 },
360 { /* 7410 */
361 .pvr_mask = 0xffff0000,
362 .pvr_value = 0x800c0000,
363 .cpu_name = "7410",
364 .cpu_features = CPU_FTR_COMMON |
365 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_MAYBE_CAN_DOZE |
366 CPU_FTR_USE_TB | CPU_FTR_L2CR | CPU_FTR_TAU |
367 CPU_FTR_ALTIVEC_COMP | CPU_FTR_HPTE_TABLE |
368 CPU_FTR_MAYBE_CAN_NAP,
369 .cpu_user_features = COMMON_PPC | PPC_FEATURE_ALTIVEC_COMP,
370 .icache_bsize = 32,
371 .dcache_bsize = 32,
372 .num_pmcs = 4,
373 .cpu_setup = __setup_cpu_7410
374 },
375 { /* 7450 2.0 - no doze/nap */
376 .pvr_mask = 0xffffffff,
377 .pvr_value = 0x80000200,
378 .cpu_name = "7450",
379 .cpu_features = CPU_FTR_COMMON |
380 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB |
381 CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | CPU_FTR_L3CR |
382 CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 |
383 CPU_FTR_NEED_COHERENT,
384 .cpu_user_features = COMMON_PPC | PPC_FEATURE_ALTIVEC_COMP,
385 .icache_bsize = 32,
386 .dcache_bsize = 32,
387 .num_pmcs = 6,
388 .cpu_setup = __setup_cpu_745x
389 },
390 { /* 7450 2.1 */
391 .pvr_mask = 0xffffffff,
392 .pvr_value = 0x80000201,
393 .cpu_name = "7450",
394 .cpu_features = CPU_FTR_COMMON |
395 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB |
396 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR |
397 CPU_FTR_ALTIVEC_COMP | CPU_FTR_L3CR |
398 CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 |
399 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_L3_DISABLE_NAP |
400 CPU_FTR_NEED_COHERENT,
401 .cpu_user_features = COMMON_PPC | PPC_FEATURE_ALTIVEC_COMP,
402 .icache_bsize = 32,
403 .dcache_bsize = 32,
404 .num_pmcs = 6,
405 .cpu_setup = __setup_cpu_745x
406 },
407 { /* 7450 2.3 and newer */
408 .pvr_mask = 0xffff0000,
409 .pvr_value = 0x80000000,
410 .cpu_name = "7450",
411 .cpu_features = CPU_FTR_COMMON |
412 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB |
413 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR |
414 CPU_FTR_ALTIVEC_COMP | CPU_FTR_L3CR |
415 CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 |
416 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_NEED_COHERENT,
417 .cpu_user_features = COMMON_PPC | PPC_FEATURE_ALTIVEC_COMP,
418 .icache_bsize = 32,
419 .dcache_bsize = 32,
420 .num_pmcs = 6,
421 .cpu_setup = __setup_cpu_745x
422 },
423 { /* 7455 rev 1.x */
424 .pvr_mask = 0xffffff00,
425 .pvr_value = 0x80010100,
426 .cpu_name = "7455",
427 .cpu_features = CPU_FTR_COMMON |
428 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB |
429 CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | CPU_FTR_L3CR |
430 CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 |
431 CPU_FTR_HAS_HIGH_BATS | CPU_FTR_NEED_COHERENT,
432 .cpu_user_features = COMMON_PPC | PPC_FEATURE_ALTIVEC_COMP,
433 .icache_bsize = 32,
434 .dcache_bsize = 32,
435 .num_pmcs = 6,
436 .cpu_setup = __setup_cpu_745x
437 },
438 { /* 7455 rev 2.0 */
439 .pvr_mask = 0xffffffff,
440 .pvr_value = 0x80010200,
441 .cpu_name = "7455",
442 .cpu_features = CPU_FTR_COMMON |
443 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB |
444 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR |
445 CPU_FTR_ALTIVEC_COMP | CPU_FTR_L3CR |
446 CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 |
447 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_L3_DISABLE_NAP |
448 CPU_FTR_NEED_COHERENT | CPU_FTR_HAS_HIGH_BATS,
449 .cpu_user_features = COMMON_PPC | PPC_FEATURE_ALTIVEC_COMP,
450 .icache_bsize = 32,
451 .dcache_bsize = 32,
452 .num_pmcs = 6,
453 .cpu_setup = __setup_cpu_745x
454 },
455 { /* 7455 others */
456 .pvr_mask = 0xffff0000,
457 .pvr_value = 0x80010000,
458 .cpu_name = "7455",
459 .cpu_features = CPU_FTR_COMMON |
460 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB |
461 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR |
462 CPU_FTR_ALTIVEC_COMP | CPU_FTR_L3CR |
463 CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 |
464 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS |
465 CPU_FTR_NEED_COHERENT,
466 .cpu_user_features = COMMON_PPC | PPC_FEATURE_ALTIVEC_COMP,
467 .icache_bsize = 32,
468 .dcache_bsize = 32,
469 .num_pmcs = 6,
470 .cpu_setup = __setup_cpu_745x
471 },
472 { /* 7447/7457 Rev 1.0 */
473 .pvr_mask = 0xffffffff,
474 .pvr_value = 0x80020100,
475 .cpu_name = "7447/7457",
476 .cpu_features = CPU_FTR_COMMON |
477 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB |
478 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR |
479 CPU_FTR_ALTIVEC_COMP | CPU_FTR_L3CR |
480 CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 |
481 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS |
482 CPU_FTR_NEED_COHERENT | CPU_FTR_NO_BTIC,
483 .cpu_user_features = COMMON_PPC | PPC_FEATURE_ALTIVEC_COMP,
484 .icache_bsize = 32,
485 .dcache_bsize = 32,
486 .num_pmcs = 6,
487 .cpu_setup = __setup_cpu_745x
488 },
489 { /* 7447/7457 Rev 1.1 */
490 .pvr_mask = 0xffffffff,
491 .pvr_value = 0x80020101,
492 .cpu_name = "7447/7457",
493 .cpu_features = CPU_FTR_COMMON |
494 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB |
495 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR |
496 CPU_FTR_ALTIVEC_COMP | CPU_FTR_L3CR |
497 CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 |
498 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS |
499 CPU_FTR_NEED_COHERENT | CPU_FTR_NO_BTIC,
500 .cpu_user_features = COMMON_PPC | PPC_FEATURE_ALTIVEC_COMP,
501 .icache_bsize = 32,
502 .dcache_bsize = 32,
503 .num_pmcs = 6,
504 .cpu_setup = __setup_cpu_745x
505 },
506 { /* 7447/7457 Rev 1.2 and later */
507 .pvr_mask = 0xffff0000,
508 .pvr_value = 0x80020000,
509 .cpu_name = "7447/7457",
510 .cpu_features = CPU_FTR_COMMON |
511 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB |
512 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR |
513 CPU_FTR_ALTIVEC_COMP | CPU_FTR_L3CR |
514 CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 |
515 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS |
516 CPU_FTR_NEED_COHERENT,
517 .cpu_user_features = COMMON_PPC | PPC_FEATURE_ALTIVEC_COMP,
518 .icache_bsize = 32,
519 .dcache_bsize = 32,
520 .num_pmcs = 6,
521 .cpu_setup = __setup_cpu_745x
522 },
523 { /* 7447A */
524 .pvr_mask = 0xffff0000,
525 .pvr_value = 0x80030000,
526 .cpu_name = "7447A",
527 .cpu_features = CPU_FTR_COMMON |
528 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB |
529 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR |
530 CPU_FTR_ALTIVEC_COMP | CPU_FTR_HPTE_TABLE |
531 CPU_FTR_SPEC7450 | CPU_FTR_NAP_DISABLE_L2_PR |
532 CPU_FTR_HAS_HIGH_BATS | CPU_FTR_NEED_COHERENT,
533 .cpu_user_features = COMMON_PPC | PPC_FEATURE_ALTIVEC_COMP,
534 .icache_bsize = 32,
535 .dcache_bsize = 32,
536 .num_pmcs = 6,
537 .cpu_setup = __setup_cpu_745x
538 },
539 { /* 82xx (8240, 8245, 8260 are all 603e cores) */
540 .pvr_mask = 0x7fff0000,
541 .pvr_value = 0x00810000,
542 .cpu_name = "82xx",
543 .cpu_features = CPU_FTR_COMMON |
544 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_MAYBE_CAN_DOZE |
545 CPU_FTR_USE_TB,
546 .cpu_user_features = COMMON_PPC,
547 .icache_bsize = 32,
548 .dcache_bsize = 32,
549 .cpu_setup = __setup_cpu_603
550 },
551 { /* All G2_LE (603e core, plus some) have the same pvr */
552 .pvr_mask = 0x7fff0000,
553 .pvr_value = 0x00820000,
554 .cpu_name = "G2_LE",
555 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
556 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB |
557 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_HAS_HIGH_BATS,
558 .cpu_user_features = COMMON_PPC,
559 .icache_bsize = 32,
560 .dcache_bsize = 32,
561 .cpu_setup = __setup_cpu_603
562 },
563 { /* e300 (a 603e core, plus some) on 83xx */
564 .pvr_mask = 0x7fff0000,
565 .pvr_value = 0x00830000,
566 .cpu_name = "e300",
567 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
568 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB |
569 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_HAS_HIGH_BATS,
570 .cpu_user_features = COMMON_PPC,
571 .icache_bsize = 32,
572 .dcache_bsize = 32,
573 .cpu_setup = __setup_cpu_603
574 },
575 { /* default match, we assume split I/D cache & TB (non-601)... */
576 .pvr_mask = 0x00000000,
577 .pvr_value = 0x00000000,
578 .cpu_name = "(generic PPC)",
579 .cpu_features = CPU_FTR_COMMON |
580 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB |
581 CPU_FTR_HPTE_TABLE,
582 .cpu_user_features = COMMON_PPC,
583 .icache_bsize = 32,
584 .dcache_bsize = 32,
585 .cpu_setup = __setup_cpu_generic
586 },
587#endif /* CLASSIC_PPC */
588#ifdef CONFIG_PPC64BRIDGE
589 { /* Power3 */
590 .pvr_mask = 0xffff0000,
591 .pvr_value = 0x00400000,
592 .cpu_name = "Power3 (630)",
593 .cpu_features = CPU_FTR_COMMON |
594 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB |
595 CPU_FTR_HPTE_TABLE,
596 .cpu_user_features = COMMON_PPC | PPC_FEATURE_64,
597 .icache_bsize = 128,
598 .dcache_bsize = 128,
599 .num_pmcs = 8,
600 .cpu_setup = __setup_cpu_power3
601 },
602 { /* Power3+ */
603 .pvr_mask = 0xffff0000,
604 .pvr_value = 0x00410000,
605 .cpu_name = "Power3 (630+)",
606 .cpu_features = CPU_FTR_COMMON |
607 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB |
608 CPU_FTR_HPTE_TABLE,
609 .cpu_user_features = COMMON_PPC | PPC_FEATURE_64,
610 .icache_bsize = 128,
611 .dcache_bsize = 128,
612 .num_pmcs = 8,
613 .cpu_setup = __setup_cpu_power3
614 },
615 { /* I-star */
616 .pvr_mask = 0xffff0000,
617 .pvr_value = 0x00360000,
618 .cpu_name = "I-star",
619 .cpu_features = CPU_FTR_COMMON |
620 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB |
621 CPU_FTR_HPTE_TABLE,
622 .cpu_user_features = COMMON_PPC | PPC_FEATURE_64,
623 .icache_bsize = 128,
624 .dcache_bsize = 128,
625 .num_pmcs = 8,
626 .cpu_setup = __setup_cpu_power3
627 },
628 { /* S-star */
629 .pvr_mask = 0xffff0000,
630 .pvr_value = 0x00370000,
631 .cpu_name = "S-star",
632 .cpu_features = CPU_FTR_COMMON |
633 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB |
634 CPU_FTR_HPTE_TABLE,
635 .cpu_user_features = COMMON_PPC | PPC_FEATURE_64,
636 .icache_bsize = 128,
637 .dcache_bsize = 128,
638 .num_pmcs = 8,
639 .cpu_setup = __setup_cpu_power3
640 },
641#endif /* CONFIG_PPC64BRIDGE */
642#ifdef CONFIG_POWER4
643 { /* Power4 */
644 .pvr_mask = 0xffff0000,
645 .pvr_value = 0x00350000,
646 .cpu_name = "Power4",
647 .cpu_features = CPU_FTR_COMMON |
648 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB |
649 CPU_FTR_HPTE_TABLE,
650 .cpu_user_features = COMMON_PPC | PPC_FEATURE_64,
651 .icache_bsize = 128,
652 .dcache_bsize = 128,
653 .num_pmcs = 8,
654 .cpu_setup = __setup_cpu_power4
655 },
656 { /* PPC970 */
657 .pvr_mask = 0xffff0000,
658 .pvr_value = 0x00390000,
659 .cpu_name = "PPC970",
660 .cpu_features = CPU_FTR_COMMON |
661 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB |
662 CPU_FTR_HPTE_TABLE |
663 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MAYBE_CAN_NAP,
664 .cpu_user_features = COMMON_PPC | PPC_FEATURE_64 |
665 PPC_FEATURE_ALTIVEC_COMP,
666 .icache_bsize = 128,
667 .dcache_bsize = 128,
668 .num_pmcs = 8,
669 .cpu_setup = __setup_cpu_ppc970
670 },
671 { /* PPC970FX */
672 .pvr_mask = 0xffff0000,
673 .pvr_value = 0x003c0000,
674 .cpu_name = "PPC970FX",
675 .cpu_features = CPU_FTR_COMMON |
676 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB |
677 CPU_FTR_HPTE_TABLE |
678 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MAYBE_CAN_NAP,
679 .cpu_user_features = COMMON_PPC | PPC_FEATURE_64 |
680 PPC_FEATURE_ALTIVEC_COMP,
681 .icache_bsize = 128,
682 .dcache_bsize = 128,
683 .num_pmcs = 8,
684 .cpu_setup = __setup_cpu_ppc970
685 },
686#endif /* CONFIG_POWER4 */
687#ifdef CONFIG_8xx
688 { /* 8xx */
689 .pvr_mask = 0xffff0000,
690 .pvr_value = 0x00500000,
691 .cpu_name = "8xx",
692 /* CPU_FTR_MAYBE_CAN_DOZE is possible,
693 * if the 8xx code is there.... */
694 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
695 CPU_FTR_USE_TB,
696 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
697 .icache_bsize = 16,
698 .dcache_bsize = 16,
699 },
700#endif /* CONFIG_8xx */
701#ifdef CONFIG_40x
702 { /* 403GC */
703 .pvr_mask = 0xffffff00,
704 .pvr_value = 0x00200200,
705 .cpu_name = "403GC",
706 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
707 CPU_FTR_USE_TB,
708 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
709 .icache_bsize = 16,
710 .dcache_bsize = 16,
711 },
712 { /* 403GCX */
713 .pvr_mask = 0xffffff00,
714 .pvr_value = 0x00201400,
715 .cpu_name = "403GCX",
716 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
717 CPU_FTR_USE_TB,
718 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
719 .icache_bsize = 16,
720 .dcache_bsize = 16,
721 },
722 { /* 403G ?? */
723 .pvr_mask = 0xffff0000,
724 .pvr_value = 0x00200000,
725 .cpu_name = "403G ??",
726 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
727 CPU_FTR_USE_TB,
728 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
729 .icache_bsize = 16,
730 .dcache_bsize = 16,
731 },
732 { /* 405GP */
733 .pvr_mask = 0xffff0000,
734 .pvr_value = 0x40110000,
735 .cpu_name = "405GP",
736 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
737 CPU_FTR_USE_TB,
738 .cpu_user_features = PPC_FEATURE_32 |
739 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
740 .icache_bsize = 32,
741 .dcache_bsize = 32,
742 },
743 { /* STB 03xxx */
744 .pvr_mask = 0xffff0000,
745 .pvr_value = 0x40130000,
746 .cpu_name = "STB03xxx",
747 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
748 CPU_FTR_USE_TB,
749 .cpu_user_features = PPC_FEATURE_32 |
750 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
751 .icache_bsize = 32,
752 .dcache_bsize = 32,
753 },
754 { /* STB 04xxx */
755 .pvr_mask = 0xffff0000,
756 .pvr_value = 0x41810000,
757 .cpu_name = "STB04xxx",
758 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
759 CPU_FTR_USE_TB,
760 .cpu_user_features = PPC_FEATURE_32 |
761 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
762 .icache_bsize = 32,
763 .dcache_bsize = 32,
764 },
765 { /* NP405L */
766 .pvr_mask = 0xffff0000,
767 .pvr_value = 0x41610000,
768 .cpu_name = "NP405L",
769 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
770 CPU_FTR_USE_TB,
771 .cpu_user_features = PPC_FEATURE_32 |
772 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
773 .icache_bsize = 32,
774 .dcache_bsize = 32,
775 },
776 { /* NP4GS3 */
777 .pvr_mask = 0xffff0000,
778 .pvr_value = 0x40B10000,
779 .cpu_name = "NP4GS3",
780 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
781 CPU_FTR_USE_TB,
782 .cpu_user_features = PPC_FEATURE_32 |
783 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
784 .icache_bsize = 32,
785 .dcache_bsize = 32,
786 },
787 { /* NP405H */
788 .pvr_mask = 0xffff0000,
789 .pvr_value = 0x41410000,
790 .cpu_name = "NP405H",
791 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
792 CPU_FTR_USE_TB,
793 .cpu_user_features = PPC_FEATURE_32 |
794 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
795 .icache_bsize = 32,
796 .dcache_bsize = 32,
797 },
798 { /* 405GPr */
799 .pvr_mask = 0xffff0000,
800 .pvr_value = 0x50910000,
801 .cpu_name = "405GPr",
802 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
803 CPU_FTR_USE_TB,
804 .cpu_user_features = PPC_FEATURE_32 |
805 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
806 .icache_bsize = 32,
807 .dcache_bsize = 32,
808 },
809 { /* STBx25xx */
810 .pvr_mask = 0xffff0000,
811 .pvr_value = 0x51510000,
812 .cpu_name = "STBx25xx",
813 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
814 CPU_FTR_USE_TB,
815 .cpu_user_features = PPC_FEATURE_32 |
816 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
817 .icache_bsize = 32,
818 .dcache_bsize = 32,
819 },
820 { /* 405LP */
821 .pvr_mask = 0xffff0000,
822 .pvr_value = 0x41F10000,
823 .cpu_name = "405LP",
824 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
825 CPU_FTR_USE_TB,
826 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
827 .icache_bsize = 32,
828 .dcache_bsize = 32,
829 },
830 { /* Xilinx Virtex-II Pro */
831 .pvr_mask = 0xffff0000,
832 .pvr_value = 0x20010000,
833 .cpu_name = "Virtex-II Pro",
834 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
835 CPU_FTR_USE_TB,
836 .cpu_user_features = PPC_FEATURE_32 |
837 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
838 .icache_bsize = 32,
839 .dcache_bsize = 32,
840 },
841
842#endif /* CONFIG_40x */
843#ifdef CONFIG_44x
844 { /* 440GP Rev. B */
845 .pvr_mask = 0xf0000fff,
846 .pvr_value = 0x40000440,
847 .cpu_name = "440GP Rev. B",
848 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
849 CPU_FTR_USE_TB,
850 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
851 .icache_bsize = 32,
852 .dcache_bsize = 32,
853 },
854 { /* 440GP Rev. C */
855 .pvr_mask = 0xf0000fff,
856 .pvr_value = 0x40000481,
857 .cpu_name = "440GP Rev. C",
858 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
859 CPU_FTR_USE_TB,
860 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
861 .icache_bsize = 32,
862 .dcache_bsize = 32,
863 },
864 { /* 440GX Rev. A */
865 .pvr_mask = 0xf0000fff,
866 .pvr_value = 0x50000850,
867 .cpu_name = "440GX Rev. A",
868 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
869 CPU_FTR_USE_TB,
870 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
871 .icache_bsize = 32,
872 .dcache_bsize = 32,
873 },
874 { /* 440GX Rev. B */
875 .pvr_mask = 0xf0000fff,
876 .pvr_value = 0x50000851,
877 .cpu_name = "440GX Rev. B",
878 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
879 CPU_FTR_USE_TB,
880 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
881 .icache_bsize = 32,
882 .dcache_bsize = 32,
883 },
884 { /* 440GX Rev. C */
885 .pvr_mask = 0xf0000fff,
886 .pvr_value = 0x50000892,
887 .cpu_name = "440GX Rev. C",
888 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
889 CPU_FTR_USE_TB,
890 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
891 .icache_bsize = 32,
892 .dcache_bsize = 32,
893 },
894#endif /* CONFIG_44x */
895#ifdef CONFIG_E500
896 { /* e500 */
897 .pvr_mask = 0xffff0000,
898 .pvr_value = 0x80200000,
899 .cpu_name = "e500",
900 /* xxx - galak: add CPU_FTR_MAYBE_CAN_DOZE */
901 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
902 CPU_FTR_USE_TB,
903 .cpu_user_features = PPC_FEATURE_32 |
904 PPC_FEATURE_HAS_MMU | PPC_FEATURE_SPE_COMP |
905 PPC_FEATURE_HAS_EFP_SINGLE,
906 .icache_bsize = 32,
907 .dcache_bsize = 32,
908 .num_pmcs = 4,
909 },
910#endif
911#if !CLASSIC_PPC
912 { /* default match */
913 .pvr_mask = 0x00000000,
914 .pvr_value = 0x00000000,
915 .cpu_name = "(generic PPC)",
916 .cpu_features = CPU_FTR_COMMON,
917 .cpu_user_features = PPC_FEATURE_32,
918 .icache_bsize = 32,
919 .dcache_bsize = 32,
920 }
921#endif /* !CLASSIC_PPC */
922};
diff --git a/arch/ppc/kernel/dma-mapping.c b/arch/ppc/kernel/dma-mapping.c
new file mode 100644
index 000000000000..e0c631cf96b0
--- /dev/null
+++ b/arch/ppc/kernel/dma-mapping.c
@@ -0,0 +1,447 @@
1/*
2 * PowerPC version derived from arch/arm/mm/consistent.c
3 * Copyright (C) 2001 Dan Malek (dmalek@jlc.net)
4 *
5 * Copyright (C) 2000 Russell King
6 *
7 * Consistent memory allocators. Used for DMA devices that want to
8 * share uncached memory with the processor core. The function return
9 * is the virtual address and 'dma_handle' is the physical address.
10 * Mostly stolen from the ARM port, with some changes for PowerPC.
11 * -- Dan
12 *
13 * Reorganized to get rid of the arch-specific consistent_* functions
14 * and provide non-coherent implementations for the DMA API. -Matt
15 *
16 * Added in_interrupt() safe dma_alloc_coherent()/dma_free_coherent()
17 * implementation. This is pulled straight from ARM and barely
18 * modified. -Matt
19 *
20 * This program is free software; you can redistribute it and/or modify
21 * it under the terms of the GNU General Public License version 2 as
22 * published by the Free Software Foundation.
23 */
24
25#include <linux/config.h>
26#include <linux/module.h>
27#include <linux/signal.h>
28#include <linux/sched.h>
29#include <linux/kernel.h>
30#include <linux/errno.h>
31#include <linux/string.h>
32#include <linux/types.h>
33#include <linux/ptrace.h>
34#include <linux/mman.h>
35#include <linux/mm.h>
36#include <linux/swap.h>
37#include <linux/stddef.h>
38#include <linux/vmalloc.h>
39#include <linux/init.h>
40#include <linux/delay.h>
41#include <linux/bootmem.h>
42#include <linux/highmem.h>
43#include <linux/dma-mapping.h>
44#include <linux/hardirq.h>
45
46#include <asm/pgalloc.h>
47#include <asm/prom.h>
48#include <asm/io.h>
49#include <asm/mmu_context.h>
50#include <asm/pgtable.h>
51#include <asm/mmu.h>
52#include <asm/uaccess.h>
53#include <asm/smp.h>
54#include <asm/machdep.h>
55
56int map_page(unsigned long va, phys_addr_t pa, int flags);
57
58#include <asm/tlbflush.h>
59
60/*
61 * This address range defaults to a value that is safe for all
62 * platforms which currently set CONFIG_NOT_COHERENT_CACHE. It
63 * can be further configured for specific applications under
64 * the "Advanced Setup" menu. -Matt
65 */
66#define CONSISTENT_BASE (CONFIG_CONSISTENT_START)
67#define CONSISTENT_END (CONFIG_CONSISTENT_START + CONFIG_CONSISTENT_SIZE)
68#define CONSISTENT_OFFSET(x) (((unsigned long)(x) - CONSISTENT_BASE) >> PAGE_SHIFT)
69
70/*
71 * This is the page table (2MB) covering uncached, DMA consistent allocations
72 */
73static pte_t *consistent_pte;
74static DEFINE_SPINLOCK(consistent_lock);
75
76/*
77 * VM region handling support.
78 *
79 * This should become something generic, handling VM region allocations for
80 * vmalloc and similar (ioremap, module space, etc).
81 *
82 * I envisage vmalloc()'s supporting vm_struct becoming:
83 *
84 * struct vm_struct {
85 * struct vm_region region;
86 * unsigned long flags;
87 * struct page **pages;
88 * unsigned int nr_pages;
89 * unsigned long phys_addr;
90 * };
91 *
92 * get_vm_area() would then call vm_region_alloc with an appropriate
93 * struct vm_region head (eg):
94 *
95 * struct vm_region vmalloc_head = {
96 * .vm_list = LIST_HEAD_INIT(vmalloc_head.vm_list),
97 * .vm_start = VMALLOC_START,
98 * .vm_end = VMALLOC_END,
99 * };
100 *
101 * However, vmalloc_head.vm_start is variable (typically, it is dependent on
102 * the amount of RAM found at boot time.) I would imagine that get_vm_area()
103 * would have to initialise this each time prior to calling vm_region_alloc().
104 */
105struct vm_region {
106 struct list_head vm_list;
107 unsigned long vm_start;
108 unsigned long vm_end;
109};
110
111static struct vm_region consistent_head = {
112 .vm_list = LIST_HEAD_INIT(consistent_head.vm_list),
113 .vm_start = CONSISTENT_BASE,
114 .vm_end = CONSISTENT_END,
115};
116
117static struct vm_region *
118vm_region_alloc(struct vm_region *head, size_t size, int gfp)
119{
120 unsigned long addr = head->vm_start, end = head->vm_end - size;
121 unsigned long flags;
122 struct vm_region *c, *new;
123
124 new = kmalloc(sizeof(struct vm_region), gfp);
125 if (!new)
126 goto out;
127
128 spin_lock_irqsave(&consistent_lock, flags);
129
130 list_for_each_entry(c, &head->vm_list, vm_list) {
131 if ((addr + size) < addr)
132 goto nospc;
133 if ((addr + size) <= c->vm_start)
134 goto found;
135 addr = c->vm_end;
136 if (addr > end)
137 goto nospc;
138 }
139
140 found:
141 /*
142 * Insert this entry _before_ the one we found.
143 */
144 list_add_tail(&new->vm_list, &c->vm_list);
145 new->vm_start = addr;
146 new->vm_end = addr + size;
147
148 spin_unlock_irqrestore(&consistent_lock, flags);
149 return new;
150
151 nospc:
152 spin_unlock_irqrestore(&consistent_lock, flags);
153 kfree(new);
154 out:
155 return NULL;
156}
157
158static struct vm_region *vm_region_find(struct vm_region *head, unsigned long addr)
159{
160 struct vm_region *c;
161
162 list_for_each_entry(c, &head->vm_list, vm_list) {
163 if (c->vm_start == addr)
164 goto out;
165 }
166 c = NULL;
167 out:
168 return c;
169}
170
171/*
172 * Allocate DMA-coherent memory space and return both the kernel remapped
173 * virtual and bus address for that space.
174 */
175void *
176__dma_alloc_coherent(size_t size, dma_addr_t *handle, int gfp)
177{
178 struct page *page;
179 struct vm_region *c;
180 unsigned long order;
181 u64 mask = 0x00ffffff, limit; /* ISA default */
182
183 if (!consistent_pte) {
184 printk(KERN_ERR "%s: not initialised\n", __func__);
185 dump_stack();
186 return NULL;
187 }
188
189 size = PAGE_ALIGN(size);
190 limit = (mask + 1) & ~mask;
191 if ((limit && size >= limit) || size >= (CONSISTENT_END - CONSISTENT_BASE)) {
192 printk(KERN_WARNING "coherent allocation too big (requested %#x mask %#Lx)\n",
193 size, mask);
194 return NULL;
195 }
196
197 order = get_order(size);
198
199 if (mask != 0xffffffff)
200 gfp |= GFP_DMA;
201
202 page = alloc_pages(gfp, order);
203 if (!page)
204 goto no_page;
205
206 /*
207 * Invalidate any data that might be lurking in the
208 * kernel direct-mapped region for device DMA.
209 */
210 {
211 unsigned long kaddr = (unsigned long)page_address(page);
212 memset(page_address(page), 0, size);
213 flush_dcache_range(kaddr, kaddr + size);
214 }
215
216 /*
217 * Allocate a virtual address in the consistent mapping region.
218 */
219 c = vm_region_alloc(&consistent_head, size,
220 gfp & ~(__GFP_DMA | __GFP_HIGHMEM));
221 if (c) {
222 unsigned long vaddr = c->vm_start;
223 pte_t *pte = consistent_pte + CONSISTENT_OFFSET(vaddr);
224 struct page *end = page + (1 << order);
225
226 /*
227 * Set the "dma handle"
228 */
229 *handle = page_to_bus(page);
230
231 do {
232 BUG_ON(!pte_none(*pte));
233
234 set_page_count(page, 1);
235 SetPageReserved(page);
236 set_pte_at(&init_mm, vaddr,
237 pte, mk_pte(page, pgprot_noncached(PAGE_KERNEL)));
238 page++;
239 pte++;
240 vaddr += PAGE_SIZE;
241 } while (size -= PAGE_SIZE);
242
243 /*
244 * Free the otherwise unused pages.
245 */
246 while (page < end) {
247 set_page_count(page, 1);
248 __free_page(page);
249 page++;
250 }
251
252 return (void *)c->vm_start;
253 }
254
255 if (page)
256 __free_pages(page, order);
257 no_page:
258 return NULL;
259}
260EXPORT_SYMBOL(__dma_alloc_coherent);
261
262/*
263 * free a page as defined by the above mapping.
264 */
265void __dma_free_coherent(size_t size, void *vaddr)
266{
267 struct vm_region *c;
268 unsigned long flags, addr;
269 pte_t *ptep;
270
271 size = PAGE_ALIGN(size);
272
273 spin_lock_irqsave(&consistent_lock, flags);
274
275 c = vm_region_find(&consistent_head, (unsigned long)vaddr);
276 if (!c)
277 goto no_area;
278
279 if ((c->vm_end - c->vm_start) != size) {
280 printk(KERN_ERR "%s: freeing wrong coherent size (%ld != %d)\n",
281 __func__, c->vm_end - c->vm_start, size);
282 dump_stack();
283 size = c->vm_end - c->vm_start;
284 }
285
286 ptep = consistent_pte + CONSISTENT_OFFSET(c->vm_start);
287 addr = c->vm_start;
288 do {
289 pte_t pte = ptep_get_and_clear(&init_mm, addr, ptep);
290 unsigned long pfn;
291
292 ptep++;
293 addr += PAGE_SIZE;
294
295 if (!pte_none(pte) && pte_present(pte)) {
296 pfn = pte_pfn(pte);
297
298 if (pfn_valid(pfn)) {
299 struct page *page = pfn_to_page(pfn);
300 ClearPageReserved(page);
301
302 __free_page(page);
303 continue;
304 }
305 }
306
307 printk(KERN_CRIT "%s: bad page in kernel page table\n",
308 __func__);
309 } while (size -= PAGE_SIZE);
310
311 flush_tlb_kernel_range(c->vm_start, c->vm_end);
312
313 list_del(&c->vm_list);
314
315 spin_unlock_irqrestore(&consistent_lock, flags);
316
317 kfree(c);
318 return;
319
320 no_area:
321 spin_unlock_irqrestore(&consistent_lock, flags);
322 printk(KERN_ERR "%s: trying to free invalid coherent area: %p\n",
323 __func__, vaddr);
324 dump_stack();
325}
326EXPORT_SYMBOL(__dma_free_coherent);
327
328/*
329 * Initialise the consistent memory allocation.
330 */
331static int __init dma_alloc_init(void)
332{
333 pgd_t *pgd;
334 pmd_t *pmd;
335 pte_t *pte;
336 int ret = 0;
337
338 spin_lock(&init_mm.page_table_lock);
339
340 do {
341 pgd = pgd_offset(&init_mm, CONSISTENT_BASE);
342 pmd = pmd_alloc(&init_mm, pgd, CONSISTENT_BASE);
343 if (!pmd) {
344 printk(KERN_ERR "%s: no pmd tables\n", __func__);
345 ret = -ENOMEM;
346 break;
347 }
348 WARN_ON(!pmd_none(*pmd));
349
350 pte = pte_alloc_kernel(&init_mm, pmd, CONSISTENT_BASE);
351 if (!pte) {
352 printk(KERN_ERR "%s: no pte tables\n", __func__);
353 ret = -ENOMEM;
354 break;
355 }
356
357 consistent_pte = pte;
358 } while (0);
359
360 spin_unlock(&init_mm.page_table_lock);
361
362 return ret;
363}
364
365core_initcall(dma_alloc_init);
366
367/*
368 * make an area consistent.
369 */
370void __dma_sync(void *vaddr, size_t size, int direction)
371{
372 unsigned long start = (unsigned long)vaddr;
373 unsigned long end = start + size;
374
375 switch (direction) {
376 case DMA_NONE:
377 BUG();
378 case DMA_FROM_DEVICE: /* invalidate only */
379 invalidate_dcache_range(start, end);
380 break;
381 case DMA_TO_DEVICE: /* writeback only */
382 clean_dcache_range(start, end);
383 break;
384 case DMA_BIDIRECTIONAL: /* writeback and invalidate */
385 flush_dcache_range(start, end);
386 break;
387 }
388}
389EXPORT_SYMBOL(__dma_sync);
390
391#ifdef CONFIG_HIGHMEM
392/*
393 * __dma_sync_page() implementation for systems using highmem.
394 * In this case, each page of a buffer must be kmapped/kunmapped
395 * in order to have a virtual address for __dma_sync(). This must
396 * not sleep so kmap_atmomic()/kunmap_atomic() are used.
397 *
398 * Note: yes, it is possible and correct to have a buffer extend
399 * beyond the first page.
400 */
401static inline void __dma_sync_page_highmem(struct page *page,
402 unsigned long offset, size_t size, int direction)
403{
404 size_t seg_size = min((size_t)PAGE_SIZE, size) - offset;
405 size_t cur_size = seg_size;
406 unsigned long flags, start, seg_offset = offset;
407 int nr_segs = PAGE_ALIGN(size + (PAGE_SIZE - offset))/PAGE_SIZE;
408 int seg_nr = 0;
409
410 local_irq_save(flags);
411
412 do {
413 start = (unsigned long)kmap_atomic(page + seg_nr,
414 KM_PPC_SYNC_PAGE) + seg_offset;
415
416 /* Sync this buffer segment */
417 __dma_sync((void *)start, seg_size, direction);
418 kunmap_atomic((void *)start, KM_PPC_SYNC_PAGE);
419 seg_nr++;
420
421 /* Calculate next buffer segment size */
422 seg_size = min((size_t)PAGE_SIZE, size - cur_size);
423
424 /* Add the segment size to our running total */
425 cur_size += seg_size;
426 seg_offset = 0;
427 } while (seg_nr < nr_segs);
428
429 local_irq_restore(flags);
430}
431#endif /* CONFIG_HIGHMEM */
432
433/*
434 * __dma_sync_page makes memory consistent. identical to __dma_sync, but
435 * takes a struct page instead of a virtual address
436 */
437void __dma_sync_page(struct page *page, unsigned long offset,
438 size_t size, int direction)
439{
440#ifdef CONFIG_HIGHMEM
441 __dma_sync_page_highmem(page, offset, size, direction);
442#else
443 unsigned long start = (unsigned long)page_address(page) + offset;
444 __dma_sync((void *)start, size, direction);
445#endif
446}
447EXPORT_SYMBOL(__dma_sync_page);
diff --git a/arch/ppc/kernel/entry.S b/arch/ppc/kernel/entry.S
new file mode 100644
index 000000000000..035217d6c0f1
--- /dev/null
+++ b/arch/ppc/kernel/entry.S
@@ -0,0 +1,969 @@
1/*
2 * PowerPC version
3 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
4 * Rewritten by Cort Dougan (cort@fsmlabs.com) for PReP
5 * Copyright (C) 1996 Cort Dougan <cort@fsmlabs.com>
6 * Adapted for Power Macintosh by Paul Mackerras.
7 * Low-level exception handlers and MMU support
8 * rewritten by Paul Mackerras.
9 * Copyright (C) 1996 Paul Mackerras.
10 * MPC8xx modifications Copyright (C) 1997 Dan Malek (dmalek@jlc.net).
11 *
12 * This file contains the system call entry code, context switch
13 * code, and exception/interrupt return code for PowerPC.
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version
18 * 2 of the License, or (at your option) any later version.
19 *
20 */
21
22#include <linux/config.h>
23#include <linux/errno.h>
24#include <linux/sys.h>
25#include <linux/threads.h>
26#include <asm/processor.h>
27#include <asm/page.h>
28#include <asm/mmu.h>
29#include <asm/cputable.h>
30#include <asm/thread_info.h>
31#include <asm/ppc_asm.h>
32#include <asm/offsets.h>
33#include <asm/unistd.h>
34
35#undef SHOW_SYSCALLS
36#undef SHOW_SYSCALLS_TASK
37
38/*
39 * MSR_KERNEL is > 0x10000 on 4xx/Book-E since it include MSR_CE.
40 */
41#if MSR_KERNEL >= 0x10000
42#define LOAD_MSR_KERNEL(r, x) lis r,(x)@h; ori r,r,(x)@l
43#else
44#define LOAD_MSR_KERNEL(r, x) li r,(x)
45#endif
46
47#ifdef CONFIG_BOOKE
48#include "head_booke.h"
49 .globl mcheck_transfer_to_handler
50mcheck_transfer_to_handler:
51 mtspr MCHECK_SPRG,r8
52 BOOKE_LOAD_MCHECK_STACK
53 lwz r0,GPR10-INT_FRAME_SIZE(r8)
54 stw r0,GPR10(r11)
55 lwz r0,GPR11-INT_FRAME_SIZE(r8)
56 stw r0,GPR11(r11)
57 mfspr r8,MCHECK_SPRG
58 b transfer_to_handler_full
59
60 .globl crit_transfer_to_handler
61crit_transfer_to_handler:
62 mtspr CRIT_SPRG,r8
63 BOOKE_LOAD_CRIT_STACK
64 lwz r0,GPR10-INT_FRAME_SIZE(r8)
65 stw r0,GPR10(r11)
66 lwz r0,GPR11-INT_FRAME_SIZE(r8)
67 stw r0,GPR11(r11)
68 mfspr r8,CRIT_SPRG
69 /* fall through */
70#endif
71
72#ifdef CONFIG_40x
73 .globl crit_transfer_to_handler
74crit_transfer_to_handler:
75 lwz r0,crit_r10@l(0)
76 stw r0,GPR10(r11)
77 lwz r0,crit_r11@l(0)
78 stw r0,GPR11(r11)
79 /* fall through */
80#endif
81
82/*
83 * This code finishes saving the registers to the exception frame
84 * and jumps to the appropriate handler for the exception, turning
85 * on address translation.
86 * Note that we rely on the caller having set cr0.eq iff the exception
87 * occurred in kernel mode (i.e. MSR:PR = 0).
88 */
89 .globl transfer_to_handler_full
90transfer_to_handler_full:
91 SAVE_NVGPRS(r11)
92 /* fall through */
93
94 .globl transfer_to_handler
95transfer_to_handler:
96 stw r2,GPR2(r11)
97 stw r12,_NIP(r11)
98 stw r9,_MSR(r11)
99 andi. r2,r9,MSR_PR
100 mfctr r12
101 mfspr r2,SPRN_XER
102 stw r12,_CTR(r11)
103 stw r2,_XER(r11)
104 mfspr r12,SPRN_SPRG3
105 addi r2,r12,-THREAD
106 tovirt(r2,r2) /* set r2 to current */
107 beq 2f /* if from user, fix up THREAD.regs */
108 addi r11,r1,STACK_FRAME_OVERHEAD
109 stw r11,PT_REGS(r12)
110#if defined(CONFIG_40x) || defined(CONFIG_BOOKE)
111 /* Check to see if the dbcr0 register is set up to debug. Use the
112 single-step bit to do this. */
113 lwz r12,THREAD_DBCR0(r12)
114 andis. r12,r12,DBCR0_IC@h
115 beq+ 3f
116 /* From user and task is ptraced - load up global dbcr0 */
117 li r12,-1 /* clear all pending debug events */
118 mtspr SPRN_DBSR,r12
119 lis r11,global_dbcr0@ha
120 tophys(r11,r11)
121 addi r11,r11,global_dbcr0@l
122 lwz r12,0(r11)
123 mtspr SPRN_DBCR0,r12
124 lwz r12,4(r11)
125 addi r12,r12,-1
126 stw r12,4(r11)
127#endif
128 b 3f
1292: /* if from kernel, check interrupted DOZE/NAP mode and
130 * check for stack overflow
131 */
132#ifdef CONFIG_6xx
133 mfspr r11,SPRN_HID0
134 mtcr r11
135BEGIN_FTR_SECTION
136 bt- 8,power_save_6xx_restore /* Check DOZE */
137END_FTR_SECTION_IFSET(CPU_FTR_CAN_DOZE)
138BEGIN_FTR_SECTION
139 bt- 9,power_save_6xx_restore /* Check NAP */
140END_FTR_SECTION_IFSET(CPU_FTR_CAN_NAP)
141#endif /* CONFIG_6xx */
142 .globl transfer_to_handler_cont
143transfer_to_handler_cont:
144 lwz r11,THREAD_INFO-THREAD(r12)
145 cmplw r1,r11 /* if r1 <= current->thread_info */
146 ble- stack_ovf /* then the kernel stack overflowed */
1473:
148 mflr r9
149 lwz r11,0(r9) /* virtual address of handler */
150 lwz r9,4(r9) /* where to go when done */
151 FIX_SRR1(r10,r12)
152 mtspr SPRN_SRR0,r11
153 mtspr SPRN_SRR1,r10
154 mtlr r9
155 SYNC
156 RFI /* jump to handler, enable MMU */
157
158/*
159 * On kernel stack overflow, load up an initial stack pointer
160 * and call StackOverflow(regs), which should not return.
161 */
162stack_ovf:
163 /* sometimes we use a statically-allocated stack, which is OK. */
164 lis r11,_end@h
165 ori r11,r11,_end@l
166 cmplw r1,r11
167 ble 3b /* r1 <= &_end is OK */
168 SAVE_NVGPRS(r11)
169 addi r3,r1,STACK_FRAME_OVERHEAD
170 lis r1,init_thread_union@ha
171 addi r1,r1,init_thread_union@l
172 addi r1,r1,THREAD_SIZE-STACK_FRAME_OVERHEAD
173 lis r9,StackOverflow@ha
174 addi r9,r9,StackOverflow@l
175 LOAD_MSR_KERNEL(r10,MSR_KERNEL)
176 FIX_SRR1(r10,r12)
177 mtspr SPRN_SRR0,r9
178 mtspr SPRN_SRR1,r10
179 SYNC
180 RFI
181
182/*
183 * Handle a system call.
184 */
185 .stabs "arch/ppc/kernel/",N_SO,0,0,0f
186 .stabs "entry.S",N_SO,0,0,0f
1870:
188
189_GLOBAL(DoSyscall)
190 stw r0,THREAD+LAST_SYSCALL(r2)
191 stw r3,ORIG_GPR3(r1)
192 li r12,0
193 stw r12,RESULT(r1)
194 lwz r11,_CCR(r1) /* Clear SO bit in CR */
195 rlwinm r11,r11,0,4,2
196 stw r11,_CCR(r1)
197#ifdef SHOW_SYSCALLS
198 bl do_show_syscall
199#endif /* SHOW_SYSCALLS */
200 rlwinm r10,r1,0,0,18 /* current_thread_info() */
201 lwz r11,TI_LOCAL_FLAGS(r10)
202 rlwinm r11,r11,0,~_TIFL_FORCE_NOERROR
203 stw r11,TI_LOCAL_FLAGS(r10)
204 lwz r11,TI_FLAGS(r10)
205 andi. r11,r11,_TIF_SYSCALL_TRACE
206 bne- syscall_dotrace
207syscall_dotrace_cont:
208 cmplwi 0,r0,NR_syscalls
209 lis r10,sys_call_table@h
210 ori r10,r10,sys_call_table@l
211 slwi r0,r0,2
212 bge- 66f
213 lwzx r10,r10,r0 /* Fetch system call handler [ptr] */
214 mtlr r10
215 addi r9,r1,STACK_FRAME_OVERHEAD
216 blrl /* Call handler */
217 .globl ret_from_syscall
218ret_from_syscall:
219#ifdef SHOW_SYSCALLS
220 bl do_show_syscall_exit
221#endif
222 mr r6,r3
223 li r11,-_LAST_ERRNO
224 cmplw 0,r3,r11
225 rlwinm r12,r1,0,0,18 /* current_thread_info() */
226 blt+ 30f
227 lwz r11,TI_LOCAL_FLAGS(r12)
228 andi. r11,r11,_TIFL_FORCE_NOERROR
229 bne 30f
230 neg r3,r3
231 lwz r10,_CCR(r1) /* Set SO bit in CR */
232 oris r10,r10,0x1000
233 stw r10,_CCR(r1)
234
235 /* disable interrupts so current_thread_info()->flags can't change */
23630: LOAD_MSR_KERNEL(r10,MSR_KERNEL) /* doesn't include MSR_EE */
237 SYNC
238 MTMSRD(r10)
239 lwz r9,TI_FLAGS(r12)
240 andi. r0,r9,(_TIF_SYSCALL_TRACE|_TIF_SIGPENDING|_TIF_NEED_RESCHED)
241 bne- syscall_exit_work
242syscall_exit_cont:
243#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
244 /* If the process has its own DBCR0 value, load it up. The single
245 step bit tells us that dbcr0 should be loaded. */
246 lwz r0,THREAD+THREAD_DBCR0(r2)
247 andis. r10,r0,DBCR0_IC@h
248 bnel- load_dbcr0
249#endif
250 stwcx. r0,0,r1 /* to clear the reservation */
251 lwz r4,_LINK(r1)
252 lwz r5,_CCR(r1)
253 mtlr r4
254 mtcr r5
255 lwz r7,_NIP(r1)
256 lwz r8,_MSR(r1)
257 FIX_SRR1(r8, r0)
258 lwz r2,GPR2(r1)
259 lwz r1,GPR1(r1)
260 mtspr SPRN_SRR0,r7
261 mtspr SPRN_SRR1,r8
262 SYNC
263 RFI
264
26566: li r3,-ENOSYS
266 b ret_from_syscall
267
268 .globl ret_from_fork
269ret_from_fork:
270 REST_NVGPRS(r1)
271 bl schedule_tail
272 li r3,0
273 b ret_from_syscall
274
275/* Traced system call support */
276syscall_dotrace:
277 SAVE_NVGPRS(r1)
278 li r0,0xc00
279 stw r0,TRAP(r1)
280 bl do_syscall_trace
281 lwz r0,GPR0(r1) /* Restore original registers */
282 lwz r3,GPR3(r1)
283 lwz r4,GPR4(r1)
284 lwz r5,GPR5(r1)
285 lwz r6,GPR6(r1)
286 lwz r7,GPR7(r1)
287 lwz r8,GPR8(r1)
288 REST_NVGPRS(r1)
289 b syscall_dotrace_cont
290
291syscall_exit_work:
292 stw r6,RESULT(r1) /* Save result */
293 stw r3,GPR3(r1) /* Update return value */
294 andi. r0,r9,_TIF_SYSCALL_TRACE
295 beq 5f
296 ori r10,r10,MSR_EE
297 SYNC
298 MTMSRD(r10) /* re-enable interrupts */
299 lwz r4,TRAP(r1)
300 andi. r4,r4,1
301 beq 4f
302 SAVE_NVGPRS(r1)
303 li r4,0xc00
304 stw r4,TRAP(r1)
3054:
306 bl do_syscall_trace
307 REST_NVGPRS(r1)
3082:
309 lwz r3,GPR3(r1)
310 LOAD_MSR_KERNEL(r10,MSR_KERNEL) /* doesn't include MSR_EE */
311 SYNC
312 MTMSRD(r10) /* disable interrupts again */
313 rlwinm r12,r1,0,0,18 /* current_thread_info() */
314 lwz r9,TI_FLAGS(r12)
3155:
316 andi. r0,r9,_TIF_NEED_RESCHED
317 bne 1f
318 lwz r5,_MSR(r1)
319 andi. r5,r5,MSR_PR
320 beq syscall_exit_cont
321 andi. r0,r9,_TIF_SIGPENDING
322 beq syscall_exit_cont
323 b do_user_signal
3241:
325 ori r10,r10,MSR_EE
326 SYNC
327 MTMSRD(r10) /* re-enable interrupts */
328 bl schedule
329 b 2b
330
331#ifdef SHOW_SYSCALLS
332do_show_syscall:
333#ifdef SHOW_SYSCALLS_TASK
334 lis r11,show_syscalls_task@ha
335 lwz r11,show_syscalls_task@l(r11)
336 cmp 0,r2,r11
337 bnelr
338#endif
339 stw r31,GPR31(r1)
340 mflr r31
341 lis r3,7f@ha
342 addi r3,r3,7f@l
343 lwz r4,GPR0(r1)
344 lwz r5,GPR3(r1)
345 lwz r6,GPR4(r1)
346 lwz r7,GPR5(r1)
347 lwz r8,GPR6(r1)
348 lwz r9,GPR7(r1)
349 bl printk
350 lis r3,77f@ha
351 addi r3,r3,77f@l
352 lwz r4,GPR8(r1)
353 mr r5,r2
354 bl printk
355 lwz r0,GPR0(r1)
356 lwz r3,GPR3(r1)
357 lwz r4,GPR4(r1)
358 lwz r5,GPR5(r1)
359 lwz r6,GPR6(r1)
360 lwz r7,GPR7(r1)
361 lwz r8,GPR8(r1)
362 mtlr r31
363 lwz r31,GPR31(r1)
364 blr
365
366do_show_syscall_exit:
367#ifdef SHOW_SYSCALLS_TASK
368 lis r11,show_syscalls_task@ha
369 lwz r11,show_syscalls_task@l(r11)
370 cmp 0,r2,r11
371 bnelr
372#endif
373 stw r31,GPR31(r1)
374 mflr r31
375 stw r3,RESULT(r1) /* Save result */
376 mr r4,r3
377 lis r3,79f@ha
378 addi r3,r3,79f@l
379 bl printk
380 lwz r3,RESULT(r1)
381 mtlr r31
382 lwz r31,GPR31(r1)
383 blr
384
3857: .string "syscall %d(%x, %x, %x, %x, %x, "
38677: .string "%x), current=%p\n"
38779: .string " -> %x\n"
388 .align 2,0
389
390#ifdef SHOW_SYSCALLS_TASK
391 .data
392 .globl show_syscalls_task
393show_syscalls_task:
394 .long -1
395 .text
396#endif
397#endif /* SHOW_SYSCALLS */
398
399/*
400 * The sigsuspend and rt_sigsuspend system calls can call do_signal
401 * and thus put the process into the stopped state where we might
402 * want to examine its user state with ptrace. Therefore we need
403 * to save all the nonvolatile registers (r13 - r31) before calling
404 * the C code.
405 */
406 .globl ppc_sigsuspend
407ppc_sigsuspend:
408 SAVE_NVGPRS(r1)
409 lwz r0,TRAP(r1)
410 rlwinm r0,r0,0,0,30 /* clear LSB to indicate full */
411 stw r0,TRAP(r1) /* register set saved */
412 b sys_sigsuspend
413
414 .globl ppc_rt_sigsuspend
415ppc_rt_sigsuspend:
416 SAVE_NVGPRS(r1)
417 lwz r0,TRAP(r1)
418 rlwinm r0,r0,0,0,30
419 stw r0,TRAP(r1)
420 b sys_rt_sigsuspend
421
422 .globl ppc_fork
423ppc_fork:
424 SAVE_NVGPRS(r1)
425 lwz r0,TRAP(r1)
426 rlwinm r0,r0,0,0,30 /* clear LSB to indicate full */
427 stw r0,TRAP(r1) /* register set saved */
428 b sys_fork
429
430 .globl ppc_vfork
431ppc_vfork:
432 SAVE_NVGPRS(r1)
433 lwz r0,TRAP(r1)
434 rlwinm r0,r0,0,0,30 /* clear LSB to indicate full */
435 stw r0,TRAP(r1) /* register set saved */
436 b sys_vfork
437
438 .globl ppc_clone
439ppc_clone:
440 SAVE_NVGPRS(r1)
441 lwz r0,TRAP(r1)
442 rlwinm r0,r0,0,0,30 /* clear LSB to indicate full */
443 stw r0,TRAP(r1) /* register set saved */
444 b sys_clone
445
446 .globl ppc_swapcontext
447ppc_swapcontext:
448 SAVE_NVGPRS(r1)
449 lwz r0,TRAP(r1)
450 rlwinm r0,r0,0,0,30 /* clear LSB to indicate full */
451 stw r0,TRAP(r1) /* register set saved */
452 b sys_swapcontext
453
454/*
455 * Top-level page fault handling.
456 * This is in assembler because if do_page_fault tells us that
457 * it is a bad kernel page fault, we want to save the non-volatile
458 * registers before calling bad_page_fault.
459 */
460 .globl handle_page_fault
461handle_page_fault:
462 stw r4,_DAR(r1)
463 addi r3,r1,STACK_FRAME_OVERHEAD
464 bl do_page_fault
465 cmpwi r3,0
466 beq+ ret_from_except
467 SAVE_NVGPRS(r1)
468 lwz r0,TRAP(r1)
469 clrrwi r0,r0,1
470 stw r0,TRAP(r1)
471 mr r5,r3
472 addi r3,r1,STACK_FRAME_OVERHEAD
473 lwz r4,_DAR(r1)
474 bl bad_page_fault
475 b ret_from_except_full
476
477/*
478 * This routine switches between two different tasks. The process
479 * state of one is saved on its kernel stack. Then the state
480 * of the other is restored from its kernel stack. The memory
481 * management hardware is updated to the second process's state.
482 * Finally, we can return to the second process.
483 * On entry, r3 points to the THREAD for the current task, r4
484 * points to the THREAD for the new task.
485 *
486 * This routine is always called with interrupts disabled.
487 *
488 * Note: there are two ways to get to the "going out" portion
489 * of this code; either by coming in via the entry (_switch)
490 * or via "fork" which must set up an environment equivalent
491 * to the "_switch" path. If you change this , you'll have to
492 * change the fork code also.
493 *
494 * The code which creates the new task context is in 'copy_thread'
495 * in arch/ppc/kernel/process.c
496 */
497_GLOBAL(_switch)
498 stwu r1,-INT_FRAME_SIZE(r1)
499 mflr r0
500 stw r0,INT_FRAME_SIZE+4(r1)
501 /* r3-r12 are caller saved -- Cort */
502 SAVE_NVGPRS(r1)
503 stw r0,_NIP(r1) /* Return to switch caller */
504 mfmsr r11
505 li r0,MSR_FP /* Disable floating-point */
506#ifdef CONFIG_ALTIVEC
507BEGIN_FTR_SECTION
508 oris r0,r0,MSR_VEC@h /* Disable altivec */
509 mfspr r12,SPRN_VRSAVE /* save vrsave register value */
510 stw r12,THREAD+THREAD_VRSAVE(r2)
511END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
512#endif /* CONFIG_ALTIVEC */
513#ifdef CONFIG_SPE
514 oris r0,r0,MSR_SPE@h /* Disable SPE */
515 mfspr r12,SPRN_SPEFSCR /* save spefscr register value */
516 stw r12,THREAD+THREAD_SPEFSCR(r2)
517#endif /* CONFIG_SPE */
518 and. r0,r0,r11 /* FP or altivec or SPE enabled? */
519 beq+ 1f
520 andc r11,r11,r0
521 MTMSRD(r11)
522 isync
5231: stw r11,_MSR(r1)
524 mfcr r10
525 stw r10,_CCR(r1)
526 stw r1,KSP(r3) /* Set old stack pointer */
527
528#ifdef CONFIG_SMP
529 /* We need a sync somewhere here to make sure that if the
530 * previous task gets rescheduled on another CPU, it sees all
531 * stores it has performed on this one.
532 */
533 sync
534#endif /* CONFIG_SMP */
535
536 tophys(r0,r4)
537 CLR_TOP32(r0)
538 mtspr SPRN_SPRG3,r0 /* Update current THREAD phys addr */
539 lwz r1,KSP(r4) /* Load new stack pointer */
540
541 /* save the old current 'last' for return value */
542 mr r3,r2
543 addi r2,r4,-THREAD /* Update current */
544
545#ifdef CONFIG_ALTIVEC
546BEGIN_FTR_SECTION
547 lwz r0,THREAD+THREAD_VRSAVE(r2)
548 mtspr SPRN_VRSAVE,r0 /* if G4, restore VRSAVE reg */
549END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
550#endif /* CONFIG_ALTIVEC */
551#ifdef CONFIG_SPE
552 lwz r0,THREAD+THREAD_SPEFSCR(r2)
553 mtspr SPRN_SPEFSCR,r0 /* restore SPEFSCR reg */
554#endif /* CONFIG_SPE */
555
556 lwz r0,_CCR(r1)
557 mtcrf 0xFF,r0
558 /* r3-r12 are destroyed -- Cort */
559 REST_NVGPRS(r1)
560
561 lwz r4,_NIP(r1) /* Return to _switch caller in new task */
562 mtlr r4
563 addi r1,r1,INT_FRAME_SIZE
564 blr
565
566 .globl sigreturn_exit
567sigreturn_exit:
568 subi r1,r3,STACK_FRAME_OVERHEAD
569 rlwinm r12,r1,0,0,18 /* current_thread_info() */
570 lwz r9,TI_FLAGS(r12)
571 andi. r0,r9,_TIF_SYSCALL_TRACE
572 bnel- do_syscall_trace
573 /* fall through */
574
575 .globl ret_from_except_full
576ret_from_except_full:
577 REST_NVGPRS(r1)
578 /* fall through */
579
580 .globl ret_from_except
581ret_from_except:
582 /* Hard-disable interrupts so that current_thread_info()->flags
583 * can't change between when we test it and when we return
584 * from the interrupt. */
585 LOAD_MSR_KERNEL(r10,MSR_KERNEL)
586 SYNC /* Some chip revs have problems here... */
587 MTMSRD(r10) /* disable interrupts */
588
589 lwz r3,_MSR(r1) /* Returning to user mode? */
590 andi. r0,r3,MSR_PR
591 beq resume_kernel
592
593user_exc_return: /* r10 contains MSR_KERNEL here */
594 /* Check current_thread_info()->flags */
595 rlwinm r9,r1,0,0,18
596 lwz r9,TI_FLAGS(r9)
597 andi. r0,r9,(_TIF_SIGPENDING|_TIF_NEED_RESCHED)
598 bne do_work
599
600restore_user:
601#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
602 /* Check whether this process has its own DBCR0 value. The single
603 step bit tells us that dbcr0 should be loaded. */
604 lwz r0,THREAD+THREAD_DBCR0(r2)
605 andis. r10,r0,DBCR0_IC@h
606 bnel- load_dbcr0
607#endif
608
609#ifdef CONFIG_PREEMPT
610 b restore
611
612/* N.B. the only way to get here is from the beq following ret_from_except. */
613resume_kernel:
614 /* check current_thread_info->preempt_count */
615 rlwinm r9,r1,0,0,18
616 lwz r0,TI_PREEMPT(r9)
617 cmpwi 0,r0,0 /* if non-zero, just restore regs and return */
618 bne restore
619 lwz r0,TI_FLAGS(r9)
620 andi. r0,r0,_TIF_NEED_RESCHED
621 beq+ restore
622 andi. r0,r3,MSR_EE /* interrupts off? */
623 beq restore /* don't schedule if so */
6241: bl preempt_schedule_irq
625 rlwinm r9,r1,0,0,18
626 lwz r3,TI_FLAGS(r9)
627 andi. r0,r3,_TIF_NEED_RESCHED
628 bne- 1b
629#else
630resume_kernel:
631#endif /* CONFIG_PREEMPT */
632
633 /* interrupts are hard-disabled at this point */
634restore:
635 lwz r0,GPR0(r1)
636 lwz r2,GPR2(r1)
637 REST_4GPRS(3, r1)
638 REST_2GPRS(7, r1)
639
640 lwz r10,_XER(r1)
641 lwz r11,_CTR(r1)
642 mtspr SPRN_XER,r10
643 mtctr r11
644
645 PPC405_ERR77(0,r1)
646 stwcx. r0,0,r1 /* to clear the reservation */
647
648#if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE))
649 lwz r9,_MSR(r1)
650 andi. r10,r9,MSR_RI /* check if this exception occurred */
651 beql nonrecoverable /* at a bad place (MSR:RI = 0) */
652
653 lwz r10,_CCR(r1)
654 lwz r11,_LINK(r1)
655 mtcrf 0xFF,r10
656 mtlr r11
657
658 /*
659 * Once we put values in SRR0 and SRR1, we are in a state
660 * where exceptions are not recoverable, since taking an
661 * exception will trash SRR0 and SRR1. Therefore we clear the
662 * MSR:RI bit to indicate this. If we do take an exception,
663 * we can't return to the point of the exception but we
664 * can restart the exception exit path at the label
665 * exc_exit_restart below. -- paulus
666 */
667 LOAD_MSR_KERNEL(r10,MSR_KERNEL & ~MSR_RI)
668 SYNC
669 MTMSRD(r10) /* clear the RI bit */
670 .globl exc_exit_restart
671exc_exit_restart:
672 lwz r9,_MSR(r1)
673 lwz r12,_NIP(r1)
674 FIX_SRR1(r9,r10)
675 mtspr SPRN_SRR0,r12
676 mtspr SPRN_SRR1,r9
677 REST_4GPRS(9, r1)
678 lwz r1,GPR1(r1)
679 .globl exc_exit_restart_end
680exc_exit_restart_end:
681 SYNC
682 RFI
683
684#else /* !(CONFIG_4xx || CONFIG_BOOKE) */
685 /*
686 * This is a bit different on 4xx/Book-E because it doesn't have
687 * the RI bit in the MSR.
688 * The TLB miss handler checks if we have interrupted
689 * the exception exit path and restarts it if so
690 * (well maybe one day it will... :).
691 */
692 lwz r11,_LINK(r1)
693 mtlr r11
694 lwz r10,_CCR(r1)
695 mtcrf 0xff,r10
696 REST_2GPRS(9, r1)
697 .globl exc_exit_restart
698exc_exit_restart:
699 lwz r11,_NIP(r1)
700 lwz r12,_MSR(r1)
701exc_exit_start:
702 mtspr SPRN_SRR0,r11
703 mtspr SPRN_SRR1,r12
704 REST_2GPRS(11, r1)
705 lwz r1,GPR1(r1)
706 .globl exc_exit_restart_end
707exc_exit_restart_end:
708 PPC405_ERR77_SYNC
709 rfi
710 b . /* prevent prefetch past rfi */
711
712/*
713 * Returning from a critical interrupt in user mode doesn't need
714 * to be any different from a normal exception. For a critical
715 * interrupt in the kernel, we just return (without checking for
716 * preemption) since the interrupt may have happened at some crucial
717 * place (e.g. inside the TLB miss handler), and because we will be
718 * running with r1 pointing into critical_stack, not the current
719 * process's kernel stack (and therefore current_thread_info() will
720 * give the wrong answer).
721 * We have to restore various SPRs that may have been in use at the
722 * time of the critical interrupt.
723 *
724 */
725 .globl ret_from_crit_exc
726ret_from_crit_exc:
727 REST_NVGPRS(r1)
728 lwz r3,_MSR(r1)
729 andi. r3,r3,MSR_PR
730 LOAD_MSR_KERNEL(r10,MSR_KERNEL)
731 bne user_exc_return
732
733 lwz r0,GPR0(r1)
734 lwz r2,GPR2(r1)
735 REST_4GPRS(3, r1)
736 REST_2GPRS(7, r1)
737
738 lwz r10,_XER(r1)
739 lwz r11,_CTR(r1)
740 mtspr SPRN_XER,r10
741 mtctr r11
742
743 PPC405_ERR77(0,r1)
744 stwcx. r0,0,r1 /* to clear the reservation */
745
746 lwz r11,_LINK(r1)
747 mtlr r11
748 lwz r10,_CCR(r1)
749 mtcrf 0xff,r10
750#ifdef CONFIG_40x
751 /* avoid any possible TLB misses here by turning off MSR.DR, we
752 * assume the instructions here are mapped by a pinned TLB entry */
753 li r10,MSR_IR
754 mtmsr r10
755 isync
756 tophys(r1, r1)
757#endif
758 lwz r9,_DEAR(r1)
759 lwz r10,_ESR(r1)
760 mtspr SPRN_DEAR,r9
761 mtspr SPRN_ESR,r10
762 lwz r11,_NIP(r1)
763 lwz r12,_MSR(r1)
764 mtspr SPRN_CSRR0,r11
765 mtspr SPRN_CSRR1,r12
766 lwz r9,GPR9(r1)
767 lwz r12,GPR12(r1)
768 lwz r10,GPR10(r1)
769 lwz r11,GPR11(r1)
770 lwz r1,GPR1(r1)
771 PPC405_ERR77_SYNC
772 rfci
773 b . /* prevent prefetch past rfci */
774
775#ifdef CONFIG_BOOKE
776/*
777 * Return from a machine check interrupt, similar to a critical
778 * interrupt.
779 */
780 .globl ret_from_mcheck_exc
781ret_from_mcheck_exc:
782 REST_NVGPRS(r1)
783 lwz r3,_MSR(r1)
784 andi. r3,r3,MSR_PR
785 LOAD_MSR_KERNEL(r10,MSR_KERNEL)
786 bne user_exc_return
787
788 lwz r0,GPR0(r1)
789 lwz r2,GPR2(r1)
790 REST_4GPRS(3, r1)
791 REST_2GPRS(7, r1)
792
793 lwz r10,_XER(r1)
794 lwz r11,_CTR(r1)
795 mtspr SPRN_XER,r10
796 mtctr r11
797
798 stwcx. r0,0,r1 /* to clear the reservation */
799
800 lwz r11,_LINK(r1)
801 mtlr r11
802 lwz r10,_CCR(r1)
803 mtcrf 0xff,r10
804 lwz r9,_DEAR(r1)
805 lwz r10,_ESR(r1)
806 mtspr SPRN_DEAR,r9
807 mtspr SPRN_ESR,r10
808 lwz r11,_NIP(r1)
809 lwz r12,_MSR(r1)
810 mtspr SPRN_MCSRR0,r11
811 mtspr SPRN_MCSRR1,r12
812 lwz r9,GPR9(r1)
813 lwz r12,GPR12(r1)
814 lwz r10,GPR10(r1)
815 lwz r11,GPR11(r1)
816 lwz r1,GPR1(r1)
817 RFMCI
818#endif /* CONFIG_BOOKE */
819
820/*
821 * Load the DBCR0 value for a task that is being ptraced,
822 * having first saved away the global DBCR0. Note that r0
823 * has the dbcr0 value to set upon entry to this.
824 */
825load_dbcr0:
826 mfmsr r10 /* first disable debug exceptions */
827 rlwinm r10,r10,0,~MSR_DE
828 mtmsr r10
829 isync
830 mfspr r10,SPRN_DBCR0
831 lis r11,global_dbcr0@ha
832 addi r11,r11,global_dbcr0@l
833 stw r10,0(r11)
834 mtspr SPRN_DBCR0,r0
835 lwz r10,4(r11)
836 addi r10,r10,1
837 stw r10,4(r11)
838 li r11,-1
839 mtspr SPRN_DBSR,r11 /* clear all pending debug events */
840 blr
841
842 .comm global_dbcr0,8
843#endif /* !(CONFIG_4xx || CONFIG_BOOKE) */
844
845do_work: /* r10 contains MSR_KERNEL here */
846 andi. r0,r9,_TIF_NEED_RESCHED
847 beq do_user_signal
848
849do_resched: /* r10 contains MSR_KERNEL here */
850 ori r10,r10,MSR_EE
851 SYNC
852 MTMSRD(r10) /* hard-enable interrupts */
853 bl schedule
854recheck:
855 LOAD_MSR_KERNEL(r10,MSR_KERNEL)
856 SYNC
857 MTMSRD(r10) /* disable interrupts */
858 rlwinm r9,r1,0,0,18
859 lwz r9,TI_FLAGS(r9)
860 andi. r0,r9,_TIF_NEED_RESCHED
861 bne- do_resched
862 andi. r0,r9,_TIF_SIGPENDING
863 beq restore_user
864do_user_signal: /* r10 contains MSR_KERNEL here */
865 ori r10,r10,MSR_EE
866 SYNC
867 MTMSRD(r10) /* hard-enable interrupts */
868 /* save r13-r31 in the exception frame, if not already done */
869 lwz r3,TRAP(r1)
870 andi. r0,r3,1
871 beq 2f
872 SAVE_NVGPRS(r1)
873 rlwinm r3,r3,0,0,30
874 stw r3,TRAP(r1)
8752: li r3,0
876 addi r4,r1,STACK_FRAME_OVERHEAD
877 bl do_signal
878 REST_NVGPRS(r1)
879 b recheck
880
881/*
882 * We come here when we are at the end of handling an exception
883 * that occurred at a place where taking an exception will lose
884 * state information, such as the contents of SRR0 and SRR1.
885 */
886nonrecoverable:
887 lis r10,exc_exit_restart_end@ha
888 addi r10,r10,exc_exit_restart_end@l
889 cmplw r12,r10
890 bge 3f
891 lis r11,exc_exit_restart@ha
892 addi r11,r11,exc_exit_restart@l
893 cmplw r12,r11
894 blt 3f
895 lis r10,ee_restarts@ha
896 lwz r12,ee_restarts@l(r10)
897 addi r12,r12,1
898 stw r12,ee_restarts@l(r10)
899 mr r12,r11 /* restart at exc_exit_restart */
900 blr
9013: /* OK, we can't recover, kill this process */
902 /* but the 601 doesn't implement the RI bit, so assume it's OK */
903BEGIN_FTR_SECTION
904 blr
905END_FTR_SECTION_IFSET(CPU_FTR_601)
906 lwz r3,TRAP(r1)
907 andi. r0,r3,1
908 beq 4f
909 SAVE_NVGPRS(r1)
910 rlwinm r3,r3,0,0,30
911 stw r3,TRAP(r1)
9124: addi r3,r1,STACK_FRAME_OVERHEAD
913 bl nonrecoverable_exception
914 /* shouldn't return */
915 b 4b
916
917 .comm ee_restarts,4
918
919/*
920 * PROM code for specific machines follows. Put it
921 * here so it's easy to add arch-specific sections later.
922 * -- Cort
923 */
924#ifdef CONFIG_PPC_OF
925/*
926 * On CHRP, the Run-Time Abstraction Services (RTAS) have to be
927 * called with the MMU off.
928 */
929_GLOBAL(enter_rtas)
930 stwu r1,-INT_FRAME_SIZE(r1)
931 mflr r0
932 stw r0,INT_FRAME_SIZE+4(r1)
933 lis r4,rtas_data@ha
934 lwz r4,rtas_data@l(r4)
935 lis r6,1f@ha /* physical return address for rtas */
936 addi r6,r6,1f@l
937 tophys(r6,r6)
938 tophys(r7,r1)
939 lis r8,rtas_entry@ha
940 lwz r8,rtas_entry@l(r8)
941 mfmsr r9
942 stw r9,8(r1)
943 LOAD_MSR_KERNEL(r0,MSR_KERNEL)
944 SYNC /* disable interrupts so SRR0/1 */
945 MTMSRD(r0) /* don't get trashed */
946 li r9,MSR_KERNEL & ~(MSR_IR|MSR_DR)
947 mtlr r6
948 CLR_TOP32(r7)
949 mtspr SPRN_SPRG2,r7
950 mtspr SPRN_SRR0,r8
951 mtspr SPRN_SRR1,r9
952 RFI
9531: tophys(r9,r1)
954 lwz r8,INT_FRAME_SIZE+4(r9) /* get return address */
955 lwz r9,8(r9) /* original msr value */
956 FIX_SRR1(r9,r0)
957 addi r1,r1,INT_FRAME_SIZE
958 li r0,0
959 mtspr SPRN_SPRG2,r0
960 mtspr SPRN_SRR0,r8
961 mtspr SPRN_SRR1,r9
962 RFI /* return to caller */
963
964 .globl machine_check_in_rtas
965machine_check_in_rtas:
966 twi 31,0,0
967 /* XXX load up BATs and panic */
968
969#endif /* CONFIG_PPC_OF */
diff --git a/arch/ppc/kernel/find_name.c b/arch/ppc/kernel/find_name.c
new file mode 100644
index 000000000000..3c0fa8e0c077
--- /dev/null
+++ b/arch/ppc/kernel/find_name.c
@@ -0,0 +1,48 @@
1#include <stdio.h>
2#include <asm/page.h>
3#include <sys/mman.h>
4#include <strings.h>
5/*
6 * Finds a given address in the System.map and prints it out
7 * with its neighbors. -- Cort
8 */
9
10int main(int argc, char **argv)
11{
12 unsigned long addr, cmp, i;
13 FILE *f;
14 char s[256], last[256];
15
16 if ( argc < 2 )
17 {
18 fprintf(stderr, "Usage: %s <address>\n", argv[0]);
19 return -1;
20 }
21
22 for ( i = 1 ; argv[i] ; i++ )
23 {
24 sscanf( argv[i], "%0lx", &addr );
25 /* adjust if addr is relative to kernelbase */
26 if ( addr < PAGE_OFFSET )
27 addr += PAGE_OFFSET;
28
29 if ( (f = fopen( "System.map", "r" )) == NULL )
30 {
31 perror("fopen()\n");
32 exit(-1);
33 }
34
35 while ( !feof(f) )
36 {
37 fgets(s, 255 , f);
38 sscanf( s, "%0lx", &cmp );
39 if ( addr < cmp )
40 break;
41 strcpy( last, s);
42 }
43
44 printf( "%s%s", last, s );
45 }
46 fclose(f);
47 return 0;
48}
diff --git a/arch/ppc/kernel/head.S b/arch/ppc/kernel/head.S
new file mode 100644
index 000000000000..1a89a71e0acc
--- /dev/null
+++ b/arch/ppc/kernel/head.S
@@ -0,0 +1,1710 @@
1/*
2 * PowerPC version
3 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
4 *
5 * Rewritten by Cort Dougan (cort@cs.nmt.edu) for PReP
6 * Copyright (C) 1996 Cort Dougan <cort@cs.nmt.edu>
7 * Adapted for Power Macintosh by Paul Mackerras.
8 * Low-level exception handlers and MMU support
9 * rewritten by Paul Mackerras.
10 * Copyright (C) 1996 Paul Mackerras.
11 * MPC8xx modifications Copyright (C) 1997 Dan Malek (dmalek@jlc.net).
12 * Amiga/APUS changes by Jesper Skov (jskov@cygnus.co.uk).
13 *
14 * This file contains the low-level support and setup for the
15 * PowerPC platform, including trap and interrupt dispatch.
16 * (The PPC 8xx embedded CPUs use head_8xx.S instead.)
17 *
18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License
20 * as published by the Free Software Foundation; either version
21 * 2 of the License, or (at your option) any later version.
22 *
23 */
24
25#include <linux/config.h>
26#include <asm/processor.h>
27#include <asm/page.h>
28#include <asm/mmu.h>
29#include <asm/pgtable.h>
30#include <asm/cputable.h>
31#include <asm/cache.h>
32#include <asm/thread_info.h>
33#include <asm/ppc_asm.h>
34#include <asm/offsets.h>
35
36#ifdef CONFIG_APUS
37#include <asm/amigappc.h>
38#endif
39
40#ifdef CONFIG_PPC64BRIDGE
41#define LOAD_BAT(n, reg, RA, RB) \
42 ld RA,(n*32)+0(reg); \
43 ld RB,(n*32)+8(reg); \
44 mtspr SPRN_IBAT##n##U,RA; \
45 mtspr SPRN_IBAT##n##L,RB; \
46 ld RA,(n*32)+16(reg); \
47 ld RB,(n*32)+24(reg); \
48 mtspr SPRN_DBAT##n##U,RA; \
49 mtspr SPRN_DBAT##n##L,RB; \
50
51#else /* CONFIG_PPC64BRIDGE */
52
53/* 601 only have IBAT; cr0.eq is set on 601 when using this macro */
54#define LOAD_BAT(n, reg, RA, RB) \
55 /* see the comment for clear_bats() -- Cort */ \
56 li RA,0; \
57 mtspr SPRN_IBAT##n##U,RA; \
58 mtspr SPRN_DBAT##n##U,RA; \
59 lwz RA,(n*16)+0(reg); \
60 lwz RB,(n*16)+4(reg); \
61 mtspr SPRN_IBAT##n##U,RA; \
62 mtspr SPRN_IBAT##n##L,RB; \
63 beq 1f; \
64 lwz RA,(n*16)+8(reg); \
65 lwz RB,(n*16)+12(reg); \
66 mtspr SPRN_DBAT##n##U,RA; \
67 mtspr SPRN_DBAT##n##L,RB; \
681:
69#endif /* CONFIG_PPC64BRIDGE */
70
71 .text
72 .stabs "arch/ppc/kernel/",N_SO,0,0,0f
73 .stabs "head.S",N_SO,0,0,0f
740:
75 .globl _stext
76_stext:
77
78/*
79 * _start is defined this way because the XCOFF loader in the OpenFirmware
80 * on the powermac expects the entry point to be a procedure descriptor.
81 */
82 .text
83 .globl _start
84_start:
85 /*
86 * These are here for legacy reasons, the kernel used to
87 * need to look like a coff function entry for the pmac
88 * but we're always started by some kind of bootloader now.
89 * -- Cort
90 */
91 nop /* used by __secondary_hold on prep (mtx) and chrp smp */
92 nop /* used by __secondary_hold on prep (mtx) and chrp smp */
93 nop
94
95/* PMAC
96 * Enter here with the kernel text, data and bss loaded starting at
97 * 0, running with virtual == physical mapping.
98 * r5 points to the prom entry point (the client interface handler
99 * address). Address translation is turned on, with the prom
100 * managing the hash table. Interrupts are disabled. The stack
101 * pointer (r1) points to just below the end of the half-meg region
102 * from 0x380000 - 0x400000, which is mapped in already.
103 *
104 * If we are booted from MacOS via BootX, we enter with the kernel
105 * image loaded somewhere, and the following values in registers:
106 * r3: 'BooX' (0x426f6f58)
107 * r4: virtual address of boot_infos_t
108 * r5: 0
109 *
110 * APUS
111 * r3: 'APUS'
112 * r4: physical address of memory base
113 * Linux/m68k style BootInfo structure at &_end.
114 *
115 * PREP
116 * This is jumped to on prep systems right after the kernel is relocated
117 * to its proper place in memory by the boot loader. The expected layout
118 * of the regs is:
119 * r3: ptr to residual data
120 * r4: initrd_start or if no initrd then 0
121 * r5: initrd_end - unused if r4 is 0
122 * r6: Start of command line string
123 * r7: End of command line string
124 *
125 * This just gets a minimal mmu environment setup so we can call
126 * start_here() to do the real work.
127 * -- Cort
128 */
129
130 .globl __start
131__start:
132/*
133 * We have to do any OF calls before we map ourselves to KERNELBASE,
134 * because OF may have I/O devices mapped into that area
135 * (particularly on CHRP).
136 */
137 mr r31,r3 /* save parameters */
138 mr r30,r4
139 mr r29,r5
140 mr r28,r6
141 mr r27,r7
142 li r24,0 /* cpu # */
143
144/*
145 * early_init() does the early machine identification and does
146 * the necessary low-level setup and clears the BSS
147 * -- Cort <cort@fsmlabs.com>
148 */
149 bl early_init
150
151/*
152 * On POWER4, we first need to tweak some CPU configuration registers
153 * like real mode cache inhibit or exception base
154 */
155#ifdef CONFIG_POWER4
156 bl __970_cpu_preinit
157#endif /* CONFIG_POWER4 */
158
159#ifdef CONFIG_APUS
160/* On APUS the __va/__pa constants need to be set to the correct
161 * values before continuing.
162 */
163 mr r4,r30
164 bl fix_mem_constants
165#endif /* CONFIG_APUS */
166
167/* Switch MMU off, clear BATs and flush TLB. At this point, r3 contains
168 * the physical address we are running at, returned by early_init()
169 */
170 bl mmu_off
171__after_mmu_off:
172#ifndef CONFIG_POWER4
173 bl clear_bats
174 bl flush_tlbs
175
176 bl initial_bats
177#if !defined(CONFIG_APUS) && defined(CONFIG_BOOTX_TEXT)
178 bl setup_disp_bat
179#endif
180#else /* CONFIG_POWER4 */
181 bl reloc_offset
182 bl initial_mm_power4
183#endif /* CONFIG_POWER4 */
184
185/*
186 * Call setup_cpu for CPU 0 and initialize 6xx Idle
187 */
188 bl reloc_offset
189 li r24,0 /* cpu# */
190 bl call_setup_cpu /* Call setup_cpu for this CPU */
191#ifdef CONFIG_6xx
192 bl reloc_offset
193 bl init_idle_6xx
194#endif /* CONFIG_6xx */
195#ifdef CONFIG_POWER4
196 bl reloc_offset
197 bl init_idle_power4
198#endif /* CONFIG_POWER4 */
199
200
201#ifndef CONFIG_APUS
202/*
203 * We need to run with _start at physical address 0.
204 * On CHRP, we are loaded at 0x10000 since OF on CHRP uses
205 * the exception vectors at 0 (and therefore this copy
206 * overwrites OF's exception vectors with our own).
207 * If the MMU is already turned on, we copy stuff to KERNELBASE,
208 * otherwise we copy it to 0.
209 */
210 bl reloc_offset
211 mr r26,r3
212 addis r4,r3,KERNELBASE@h /* current address of _start */
213 cmpwi 0,r4,0 /* are we already running at 0? */
214 bne relocate_kernel
215#endif /* CONFIG_APUS */
216/*
217 * we now have the 1st 16M of ram mapped with the bats.
218 * prep needs the mmu to be turned on here, but pmac already has it on.
219 * this shouldn't bother the pmac since it just gets turned on again
220 * as we jump to our code at KERNELBASE. -- Cort
221 * Actually no, pmac doesn't have it on any more. BootX enters with MMU
222 * off, and in other cases, we now turn it off before changing BATs above.
223 */
224turn_on_mmu:
225 mfmsr r0
226 ori r0,r0,MSR_DR|MSR_IR
227 mtspr SPRN_SRR1,r0
228 lis r0,start_here@h
229 ori r0,r0,start_here@l
230 mtspr SPRN_SRR0,r0
231 SYNC
232 RFI /* enables MMU */
233
234/*
235 * We need __secondary_hold as a place to hold the other cpus on
236 * an SMP machine, even when we are running a UP kernel.
237 */
238 . = 0xc0 /* for prep bootloader */
239 li r3,1 /* MTX only has 1 cpu */
240 .globl __secondary_hold
241__secondary_hold:
242 /* tell the master we're here */
243 stw r3,4(0)
244#ifdef CONFIG_SMP
245100: lwz r4,0(0)
246 /* wait until we're told to start */
247 cmpw 0,r4,r3
248 bne 100b
249 /* our cpu # was at addr 0 - go */
250 mr r24,r3 /* cpu # */
251 b __secondary_start
252#else
253 b .
254#endif /* CONFIG_SMP */
255
256/*
257 * Exception entry code. This code runs with address translation
258 * turned off, i.e. using physical addresses.
259 * We assume sprg3 has the physical address of the current
260 * task's thread_struct.
261 */
262#define EXCEPTION_PROLOG \
263 mtspr SPRN_SPRG0,r10; \
264 mtspr SPRN_SPRG1,r11; \
265 mfcr r10; \
266 EXCEPTION_PROLOG_1; \
267 EXCEPTION_PROLOG_2
268
269#define EXCEPTION_PROLOG_1 \
270 mfspr r11,SPRN_SRR1; /* check whether user or kernel */ \
271 andi. r11,r11,MSR_PR; \
272 tophys(r11,r1); /* use tophys(r1) if kernel */ \
273 beq 1f; \
274 mfspr r11,SPRN_SPRG3; \
275 lwz r11,THREAD_INFO-THREAD(r11); \
276 addi r11,r11,THREAD_SIZE; \
277 tophys(r11,r11); \
2781: subi r11,r11,INT_FRAME_SIZE /* alloc exc. frame */
279
280
281#define EXCEPTION_PROLOG_2 \
282 CLR_TOP32(r11); \
283 stw r10,_CCR(r11); /* save registers */ \
284 stw r12,GPR12(r11); \
285 stw r9,GPR9(r11); \
286 mfspr r10,SPRN_SPRG0; \
287 stw r10,GPR10(r11); \
288 mfspr r12,SPRN_SPRG1; \
289 stw r12,GPR11(r11); \
290 mflr r10; \
291 stw r10,_LINK(r11); \
292 mfspr r12,SPRN_SRR0; \
293 mfspr r9,SPRN_SRR1; \
294 stw r1,GPR1(r11); \
295 stw r1,0(r11); \
296 tovirt(r1,r11); /* set new kernel sp */ \
297 li r10,MSR_KERNEL & ~(MSR_IR|MSR_DR); /* can take exceptions */ \
298 MTMSRD(r10); /* (except for mach check in rtas) */ \
299 stw r0,GPR0(r11); \
300 SAVE_4GPRS(3, r11); \
301 SAVE_2GPRS(7, r11)
302
303/*
304 * Note: code which follows this uses cr0.eq (set if from kernel),
305 * r11, r12 (SRR0), and r9 (SRR1).
306 *
307 * Note2: once we have set r1 we are in a position to take exceptions
308 * again, and we could thus set MSR:RI at that point.
309 */
310
311/*
312 * Exception vectors.
313 */
314#define EXCEPTION(n, label, hdlr, xfer) \
315 . = n; \
316label: \
317 EXCEPTION_PROLOG; \
318 addi r3,r1,STACK_FRAME_OVERHEAD; \
319 xfer(n, hdlr)
320
321#define EXC_XFER_TEMPLATE(n, hdlr, trap, copyee, tfer, ret) \
322 li r10,trap; \
323 stw r10,TRAP(r11); \
324 li r10,MSR_KERNEL; \
325 copyee(r10, r9); \
326 bl tfer; \
327i##n: \
328 .long hdlr; \
329 .long ret
330
331#define COPY_EE(d, s) rlwimi d,s,0,16,16
332#define NOCOPY(d, s)
333
334#define EXC_XFER_STD(n, hdlr) \
335 EXC_XFER_TEMPLATE(n, hdlr, n, NOCOPY, transfer_to_handler_full, \
336 ret_from_except_full)
337
338#define EXC_XFER_LITE(n, hdlr) \
339 EXC_XFER_TEMPLATE(n, hdlr, n+1, NOCOPY, transfer_to_handler, \
340 ret_from_except)
341
342#define EXC_XFER_EE(n, hdlr) \
343 EXC_XFER_TEMPLATE(n, hdlr, n, COPY_EE, transfer_to_handler_full, \
344 ret_from_except_full)
345
346#define EXC_XFER_EE_LITE(n, hdlr) \
347 EXC_XFER_TEMPLATE(n, hdlr, n+1, COPY_EE, transfer_to_handler, \
348 ret_from_except)
349
350/* System reset */
351/* core99 pmac starts the seconary here by changing the vector, and
352 putting it back to what it was (UnknownException) when done. */
353#if defined(CONFIG_GEMINI) && defined(CONFIG_SMP)
354 . = 0x100
355 b __secondary_start_gemini
356#else
357 EXCEPTION(0x100, Reset, UnknownException, EXC_XFER_STD)
358#endif
359
360/* Machine check */
361/*
362 * On CHRP, this is complicated by the fact that we could get a
363 * machine check inside RTAS, and we have no guarantee that certain
364 * critical registers will have the values we expect. The set of
365 * registers that might have bad values includes all the GPRs
366 * and all the BATs. We indicate that we are in RTAS by putting
367 * a non-zero value, the address of the exception frame to use,
368 * in SPRG2. The machine check handler checks SPRG2 and uses its
369 * value if it is non-zero. If we ever needed to free up SPRG2,
370 * we could use a field in the thread_info or thread_struct instead.
371 * (Other exception handlers assume that r1 is a valid kernel stack
372 * pointer when we take an exception from supervisor mode.)
373 * -- paulus.
374 */
375 . = 0x200
376 mtspr SPRN_SPRG0,r10
377 mtspr SPRN_SPRG1,r11
378 mfcr r10
379#ifdef CONFIG_PPC_CHRP
380 mfspr r11,SPRN_SPRG2
381 cmpwi 0,r11,0
382 bne 7f
383#endif /* CONFIG_PPC_CHRP */
384 EXCEPTION_PROLOG_1
3857: EXCEPTION_PROLOG_2
386 addi r3,r1,STACK_FRAME_OVERHEAD
387#ifdef CONFIG_PPC_CHRP
388 mfspr r4,SPRN_SPRG2
389 cmpwi cr1,r4,0
390 bne cr1,1f
391#endif
392 EXC_XFER_STD(0x200, MachineCheckException)
393#ifdef CONFIG_PPC_CHRP
3941: b machine_check_in_rtas
395#endif
396
397/* Data access exception. */
398 . = 0x300
399#ifdef CONFIG_PPC64BRIDGE
400 b DataAccess
401DataAccessCont:
402#else
403DataAccess:
404 EXCEPTION_PROLOG
405#endif /* CONFIG_PPC64BRIDGE */
406 mfspr r10,SPRN_DSISR
407 andis. r0,r10,0xa470 /* weird error? */
408 bne 1f /* if not, try to put a PTE */
409 mfspr r4,SPRN_DAR /* into the hash table */
410 rlwinm r3,r10,32-15,21,21 /* DSISR_STORE -> _PAGE_RW */
411 bl hash_page
4121: stw r10,_DSISR(r11)
413 mr r5,r10
414 mfspr r4,SPRN_DAR
415 EXC_XFER_EE_LITE(0x300, handle_page_fault)
416
417#ifdef CONFIG_PPC64BRIDGE
418/* SLB fault on data access. */
419 . = 0x380
420 b DataSegment
421#endif /* CONFIG_PPC64BRIDGE */
422
423/* Instruction access exception. */
424 . = 0x400
425#ifdef CONFIG_PPC64BRIDGE
426 b InstructionAccess
427InstructionAccessCont:
428#else
429InstructionAccess:
430 EXCEPTION_PROLOG
431#endif /* CONFIG_PPC64BRIDGE */
432 andis. r0,r9,0x4000 /* no pte found? */
433 beq 1f /* if so, try to put a PTE */
434 li r3,0 /* into the hash table */
435 mr r4,r12 /* SRR0 is fault address */
436 bl hash_page
4371: mr r4,r12
438 mr r5,r9
439 EXC_XFER_EE_LITE(0x400, handle_page_fault)
440
441#ifdef CONFIG_PPC64BRIDGE
442/* SLB fault on instruction access. */
443 . = 0x480
444 b InstructionSegment
445#endif /* CONFIG_PPC64BRIDGE */
446
447/* External interrupt */
448 EXCEPTION(0x500, HardwareInterrupt, do_IRQ, EXC_XFER_LITE)
449
450/* Alignment exception */
451 . = 0x600
452Alignment:
453 EXCEPTION_PROLOG
454 mfspr r4,SPRN_DAR
455 stw r4,_DAR(r11)
456 mfspr r5,SPRN_DSISR
457 stw r5,_DSISR(r11)
458 addi r3,r1,STACK_FRAME_OVERHEAD
459 EXC_XFER_EE(0x600, AlignmentException)
460
461/* Program check exception */
462 EXCEPTION(0x700, ProgramCheck, ProgramCheckException, EXC_XFER_STD)
463
464/* Floating-point unavailable */
465 . = 0x800
466FPUnavailable:
467 EXCEPTION_PROLOG
468 bne load_up_fpu /* if from user, just load it up */
469 addi r3,r1,STACK_FRAME_OVERHEAD
470 EXC_XFER_EE_LITE(0x800, KernelFP)
471
472/* Decrementer */
473 EXCEPTION(0x900, Decrementer, timer_interrupt, EXC_XFER_LITE)
474
475 EXCEPTION(0xa00, Trap_0a, UnknownException, EXC_XFER_EE)
476 EXCEPTION(0xb00, Trap_0b, UnknownException, EXC_XFER_EE)
477
478/* System call */
479 . = 0xc00
480SystemCall:
481 EXCEPTION_PROLOG
482 EXC_XFER_EE_LITE(0xc00, DoSyscall)
483
484/* Single step - not used on 601 */
485 EXCEPTION(0xd00, SingleStep, SingleStepException, EXC_XFER_STD)
486 EXCEPTION(0xe00, Trap_0e, UnknownException, EXC_XFER_EE)
487
488/*
489 * The Altivec unavailable trap is at 0x0f20. Foo.
490 * We effectively remap it to 0x3000.
491 * We include an altivec unavailable exception vector even if
492 * not configured for Altivec, so that you can't panic a
493 * non-altivec kernel running on a machine with altivec just
494 * by executing an altivec instruction.
495 */
496 . = 0xf00
497 b Trap_0f
498
499 . = 0xf20
500 b AltiVecUnavailable
501
502Trap_0f:
503 EXCEPTION_PROLOG
504 addi r3,r1,STACK_FRAME_OVERHEAD
505 EXC_XFER_EE(0xf00, UnknownException)
506
507/*
508 * Handle TLB miss for instruction on 603/603e.
509 * Note: we get an alternate set of r0 - r3 to use automatically.
510 */
511 . = 0x1000
512InstructionTLBMiss:
513/*
514 * r0: stored ctr
515 * r1: linux style pte ( later becomes ppc hardware pte )
516 * r2: ptr to linux-style pte
517 * r3: scratch
518 */
519 mfctr r0
520 /* Get PTE (linux-style) and check access */
521 mfspr r3,SPRN_IMISS
522 lis r1,KERNELBASE@h /* check if kernel address */
523 cmplw 0,r3,r1
524 mfspr r2,SPRN_SPRG3
525 li r1,_PAGE_USER|_PAGE_PRESENT /* low addresses tested as user */
526 lwz r2,PGDIR(r2)
527 blt+ 112f
528 lis r2,swapper_pg_dir@ha /* if kernel address, use */
529 addi r2,r2,swapper_pg_dir@l /* kernel page table */
530 mfspr r1,SPRN_SRR1 /* and MSR_PR bit from SRR1 */
531 rlwinm r1,r1,32-12,29,29 /* shift MSR_PR to _PAGE_USER posn */
532112: tophys(r2,r2)
533 rlwimi r2,r3,12,20,29 /* insert top 10 bits of address */
534 lwz r2,0(r2) /* get pmd entry */
535 rlwinm. r2,r2,0,0,19 /* extract address of pte page */
536 beq- InstructionAddressInvalid /* return if no mapping */
537 rlwimi r2,r3,22,20,29 /* insert next 10 bits of address */
538 lwz r3,0(r2) /* get linux-style pte */
539 andc. r1,r1,r3 /* check access & ~permission */
540 bne- InstructionAddressInvalid /* return if access not permitted */
541 ori r3,r3,_PAGE_ACCESSED /* set _PAGE_ACCESSED in pte */
542 /*
543 * NOTE! We are assuming this is not an SMP system, otherwise
544 * we would need to update the pte atomically with lwarx/stwcx.
545 */
546 stw r3,0(r2) /* update PTE (accessed bit) */
547 /* Convert linux-style PTE to low word of PPC-style PTE */
548 rlwinm r1,r3,32-10,31,31 /* _PAGE_RW -> PP lsb */
549 rlwinm r2,r3,32-7,31,31 /* _PAGE_DIRTY -> PP lsb */
550 and r1,r1,r2 /* writable if _RW and _DIRTY */
551 rlwimi r3,r3,32-1,30,30 /* _PAGE_USER -> PP msb */
552 rlwimi r3,r3,32-1,31,31 /* _PAGE_USER -> PP lsb */
553 ori r1,r1,0xe14 /* clear out reserved bits and M */
554 andc r1,r3,r1 /* PP = user? (rw&dirty? 2: 3): 0 */
555 mtspr SPRN_RPA,r1
556 mfspr r3,SPRN_IMISS
557 tlbli r3
558 mfspr r3,SPRN_SRR1 /* Need to restore CR0 */
559 mtcrf 0x80,r3
560 rfi
561InstructionAddressInvalid:
562 mfspr r3,SPRN_SRR1
563 rlwinm r1,r3,9,6,6 /* Get load/store bit */
564
565 addis r1,r1,0x2000
566 mtspr SPRN_DSISR,r1 /* (shouldn't be needed) */
567 mtctr r0 /* Restore CTR */
568 andi. r2,r3,0xFFFF /* Clear upper bits of SRR1 */
569 or r2,r2,r1
570 mtspr SPRN_SRR1,r2
571 mfspr r1,SPRN_IMISS /* Get failing address */
572 rlwinm. r2,r2,0,31,31 /* Check for little endian access */
573 rlwimi r2,r2,1,30,30 /* change 1 -> 3 */
574 xor r1,r1,r2
575 mtspr SPRN_DAR,r1 /* Set fault address */
576 mfmsr r0 /* Restore "normal" registers */
577 xoris r0,r0,MSR_TGPR>>16
578 mtcrf 0x80,r3 /* Restore CR0 */
579 mtmsr r0
580 b InstructionAccess
581
582/*
583 * Handle TLB miss for DATA Load operation on 603/603e
584 */
585 . = 0x1100
586DataLoadTLBMiss:
587/*
588 * r0: stored ctr
589 * r1: linux style pte ( later becomes ppc hardware pte )
590 * r2: ptr to linux-style pte
591 * r3: scratch
592 */
593 mfctr r0
594 /* Get PTE (linux-style) and check access */
595 mfspr r3,SPRN_DMISS
596 lis r1,KERNELBASE@h /* check if kernel address */
597 cmplw 0,r3,r1
598 mfspr r2,SPRN_SPRG3
599 li r1,_PAGE_USER|_PAGE_PRESENT /* low addresses tested as user */
600 lwz r2,PGDIR(r2)
601 blt+ 112f
602 lis r2,swapper_pg_dir@ha /* if kernel address, use */
603 addi r2,r2,swapper_pg_dir@l /* kernel page table */
604 mfspr r1,SPRN_SRR1 /* and MSR_PR bit from SRR1 */
605 rlwinm r1,r1,32-12,29,29 /* shift MSR_PR to _PAGE_USER posn */
606112: tophys(r2,r2)
607 rlwimi r2,r3,12,20,29 /* insert top 10 bits of address */
608 lwz r2,0(r2) /* get pmd entry */
609 rlwinm. r2,r2,0,0,19 /* extract address of pte page */
610 beq- DataAddressInvalid /* return if no mapping */
611 rlwimi r2,r3,22,20,29 /* insert next 10 bits of address */
612 lwz r3,0(r2) /* get linux-style pte */
613 andc. r1,r1,r3 /* check access & ~permission */
614 bne- DataAddressInvalid /* return if access not permitted */
615 ori r3,r3,_PAGE_ACCESSED /* set _PAGE_ACCESSED in pte */
616 /*
617 * NOTE! We are assuming this is not an SMP system, otherwise
618 * we would need to update the pte atomically with lwarx/stwcx.
619 */
620 stw r3,0(r2) /* update PTE (accessed bit) */
621 /* Convert linux-style PTE to low word of PPC-style PTE */
622 rlwinm r1,r3,32-10,31,31 /* _PAGE_RW -> PP lsb */
623 rlwinm r2,r3,32-7,31,31 /* _PAGE_DIRTY -> PP lsb */
624 and r1,r1,r2 /* writable if _RW and _DIRTY */
625 rlwimi r3,r3,32-1,30,30 /* _PAGE_USER -> PP msb */
626 rlwimi r3,r3,32-1,31,31 /* _PAGE_USER -> PP lsb */
627 ori r1,r1,0xe14 /* clear out reserved bits and M */
628 andc r1,r3,r1 /* PP = user? (rw&dirty? 2: 3): 0 */
629 mtspr SPRN_RPA,r1
630 mfspr r3,SPRN_DMISS
631 tlbld r3
632 mfspr r3,SPRN_SRR1 /* Need to restore CR0 */
633 mtcrf 0x80,r3
634 rfi
635DataAddressInvalid:
636 mfspr r3,SPRN_SRR1
637 rlwinm r1,r3,9,6,6 /* Get load/store bit */
638 addis r1,r1,0x2000
639 mtspr SPRN_DSISR,r1
640 mtctr r0 /* Restore CTR */
641 andi. r2,r3,0xFFFF /* Clear upper bits of SRR1 */
642 mtspr SPRN_SRR1,r2
643 mfspr r1,SPRN_DMISS /* Get failing address */
644 rlwinm. r2,r2,0,31,31 /* Check for little endian access */
645 beq 20f /* Jump if big endian */
646 xori r1,r1,3
64720: mtspr SPRN_DAR,r1 /* Set fault address */
648 mfmsr r0 /* Restore "normal" registers */
649 xoris r0,r0,MSR_TGPR>>16
650 mtcrf 0x80,r3 /* Restore CR0 */
651 mtmsr r0
652 b DataAccess
653
654/*
655 * Handle TLB miss for DATA Store on 603/603e
656 */
657 . = 0x1200
658DataStoreTLBMiss:
659/*
660 * r0: stored ctr
661 * r1: linux style pte ( later becomes ppc hardware pte )
662 * r2: ptr to linux-style pte
663 * r3: scratch
664 */
665 mfctr r0
666 /* Get PTE (linux-style) and check access */
667 mfspr r3,SPRN_DMISS
668 lis r1,KERNELBASE@h /* check if kernel address */
669 cmplw 0,r3,r1
670 mfspr r2,SPRN_SPRG3
671 li r1,_PAGE_RW|_PAGE_USER|_PAGE_PRESENT /* access flags */
672 lwz r2,PGDIR(r2)
673 blt+ 112f
674 lis r2,swapper_pg_dir@ha /* if kernel address, use */
675 addi r2,r2,swapper_pg_dir@l /* kernel page table */
676 mfspr r1,SPRN_SRR1 /* and MSR_PR bit from SRR1 */
677 rlwinm r1,r1,32-12,29,29 /* shift MSR_PR to _PAGE_USER posn */
678112: tophys(r2,r2)
679 rlwimi r2,r3,12,20,29 /* insert top 10 bits of address */
680 lwz r2,0(r2) /* get pmd entry */
681 rlwinm. r2,r2,0,0,19 /* extract address of pte page */
682 beq- DataAddressInvalid /* return if no mapping */
683 rlwimi r2,r3,22,20,29 /* insert next 10 bits of address */
684 lwz r3,0(r2) /* get linux-style pte */
685 andc. r1,r1,r3 /* check access & ~permission */
686 bne- DataAddressInvalid /* return if access not permitted */
687 ori r3,r3,_PAGE_ACCESSED|_PAGE_DIRTY
688 /*
689 * NOTE! We are assuming this is not an SMP system, otherwise
690 * we would need to update the pte atomically with lwarx/stwcx.
691 */
692 stw r3,0(r2) /* update PTE (accessed/dirty bits) */
693 /* Convert linux-style PTE to low word of PPC-style PTE */
694 rlwimi r3,r3,32-1,30,30 /* _PAGE_USER -> PP msb */
695 li r1,0xe15 /* clear out reserved bits and M */
696 andc r1,r3,r1 /* PP = user? 2: 0 */
697 mtspr SPRN_RPA,r1
698 mfspr r3,SPRN_DMISS
699 tlbld r3
700 mfspr r3,SPRN_SRR1 /* Need to restore CR0 */
701 mtcrf 0x80,r3
702 rfi
703
704#ifndef CONFIG_ALTIVEC
705#define AltivecAssistException UnknownException
706#endif
707
708 EXCEPTION(0x1300, Trap_13, InstructionBreakpoint, EXC_XFER_EE)
709 EXCEPTION(0x1400, SMI, SMIException, EXC_XFER_EE)
710 EXCEPTION(0x1500, Trap_15, UnknownException, EXC_XFER_EE)
711#ifdef CONFIG_POWER4
712 EXCEPTION(0x1600, Trap_16, UnknownException, EXC_XFER_EE)
713 EXCEPTION(0x1700, Trap_17, AltivecAssistException, EXC_XFER_EE)
714 EXCEPTION(0x1800, Trap_18, TAUException, EXC_XFER_STD)
715#else /* !CONFIG_POWER4 */
716 EXCEPTION(0x1600, Trap_16, AltivecAssistException, EXC_XFER_EE)
717 EXCEPTION(0x1700, Trap_17, TAUException, EXC_XFER_STD)
718 EXCEPTION(0x1800, Trap_18, UnknownException, EXC_XFER_EE)
719#endif /* CONFIG_POWER4 */
720 EXCEPTION(0x1900, Trap_19, UnknownException, EXC_XFER_EE)
721 EXCEPTION(0x1a00, Trap_1a, UnknownException, EXC_XFER_EE)
722 EXCEPTION(0x1b00, Trap_1b, UnknownException, EXC_XFER_EE)
723 EXCEPTION(0x1c00, Trap_1c, UnknownException, EXC_XFER_EE)
724 EXCEPTION(0x1d00, Trap_1d, UnknownException, EXC_XFER_EE)
725 EXCEPTION(0x1e00, Trap_1e, UnknownException, EXC_XFER_EE)
726 EXCEPTION(0x1f00, Trap_1f, UnknownException, EXC_XFER_EE)
727 EXCEPTION(0x2000, RunMode, RunModeException, EXC_XFER_EE)
728 EXCEPTION(0x2100, Trap_21, UnknownException, EXC_XFER_EE)
729 EXCEPTION(0x2200, Trap_22, UnknownException, EXC_XFER_EE)
730 EXCEPTION(0x2300, Trap_23, UnknownException, EXC_XFER_EE)
731 EXCEPTION(0x2400, Trap_24, UnknownException, EXC_XFER_EE)
732 EXCEPTION(0x2500, Trap_25, UnknownException, EXC_XFER_EE)
733 EXCEPTION(0x2600, Trap_26, UnknownException, EXC_XFER_EE)
734 EXCEPTION(0x2700, Trap_27, UnknownException, EXC_XFER_EE)
735 EXCEPTION(0x2800, Trap_28, UnknownException, EXC_XFER_EE)
736 EXCEPTION(0x2900, Trap_29, UnknownException, EXC_XFER_EE)
737 EXCEPTION(0x2a00, Trap_2a, UnknownException, EXC_XFER_EE)
738 EXCEPTION(0x2b00, Trap_2b, UnknownException, EXC_XFER_EE)
739 EXCEPTION(0x2c00, Trap_2c, UnknownException, EXC_XFER_EE)
740 EXCEPTION(0x2d00, Trap_2d, UnknownException, EXC_XFER_EE)
741 EXCEPTION(0x2e00, Trap_2e, UnknownException, EXC_XFER_EE)
742 EXCEPTION(0x2f00, MOLTrampoline, UnknownException, EXC_XFER_EE_LITE)
743
744 .globl mol_trampoline
745 .set mol_trampoline, i0x2f00
746
747 . = 0x3000
748
749AltiVecUnavailable:
750 EXCEPTION_PROLOG
751#ifdef CONFIG_ALTIVEC
752 bne load_up_altivec /* if from user, just load it up */
753#endif /* CONFIG_ALTIVEC */
754 EXC_XFER_EE_LITE(0xf20, AltivecUnavailException)
755
756#ifdef CONFIG_PPC64BRIDGE
757DataAccess:
758 EXCEPTION_PROLOG
759 b DataAccessCont
760
761InstructionAccess:
762 EXCEPTION_PROLOG
763 b InstructionAccessCont
764
765DataSegment:
766 EXCEPTION_PROLOG
767 addi r3,r1,STACK_FRAME_OVERHEAD
768 mfspr r4,SPRN_DAR
769 stw r4,_DAR(r11)
770 EXC_XFER_STD(0x380, UnknownException)
771
772InstructionSegment:
773 EXCEPTION_PROLOG
774 addi r3,r1,STACK_FRAME_OVERHEAD
775 EXC_XFER_STD(0x480, UnknownException)
776#endif /* CONFIG_PPC64BRIDGE */
777
778/*
779 * This task wants to use the FPU now.
780 * On UP, disable FP for the task which had the FPU previously,
781 * and save its floating-point registers in its thread_struct.
782 * Load up this task's FP registers from its thread_struct,
783 * enable the FPU for the current task and return to the task.
784 */
785load_up_fpu:
786 mfmsr r5
787 ori r5,r5,MSR_FP
788#ifdef CONFIG_PPC64BRIDGE
789 clrldi r5,r5,1 /* turn off 64-bit mode */
790#endif /* CONFIG_PPC64BRIDGE */
791 SYNC
792 MTMSRD(r5) /* enable use of fpu now */
793 isync
794/*
795 * For SMP, we don't do lazy FPU switching because it just gets too
796 * horrendously complex, especially when a task switches from one CPU
797 * to another. Instead we call giveup_fpu in switch_to.
798 */
799#ifndef CONFIG_SMP
800 tophys(r6,0) /* get __pa constant */
801 addis r3,r6,last_task_used_math@ha
802 lwz r4,last_task_used_math@l(r3)
803 cmpwi 0,r4,0
804 beq 1f
805 add r4,r4,r6
806 addi r4,r4,THREAD /* want last_task_used_math->thread */
807 SAVE_32FPRS(0, r4)
808 mffs fr0
809 stfd fr0,THREAD_FPSCR-4(r4)
810 lwz r5,PT_REGS(r4)
811 add r5,r5,r6
812 lwz r4,_MSR-STACK_FRAME_OVERHEAD(r5)
813 li r10,MSR_FP|MSR_FE0|MSR_FE1
814 andc r4,r4,r10 /* disable FP for previous task */
815 stw r4,_MSR-STACK_FRAME_OVERHEAD(r5)
8161:
817#endif /* CONFIG_SMP */
818 /* enable use of FP after return */
819 mfspr r5,SPRN_SPRG3 /* current task's THREAD (phys) */
820 lwz r4,THREAD_FPEXC_MODE(r5)
821 ori r9,r9,MSR_FP /* enable FP for current */
822 or r9,r9,r4
823 lfd fr0,THREAD_FPSCR-4(r5)
824 mtfsf 0xff,fr0
825 REST_32FPRS(0, r5)
826#ifndef CONFIG_SMP
827 subi r4,r5,THREAD
828 sub r4,r4,r6
829 stw r4,last_task_used_math@l(r3)
830#endif /* CONFIG_SMP */
831 /* restore registers and return */
832 /* we haven't used ctr or xer or lr */
833 /* fall through to fast_exception_return */
834
835 .globl fast_exception_return
836fast_exception_return:
837 andi. r10,r9,MSR_RI /* check for recoverable interrupt */
838 beq 1f /* if not, we've got problems */
8392: REST_4GPRS(3, r11)
840 lwz r10,_CCR(r11)
841 REST_GPR(1, r11)
842 mtcr r10
843 lwz r10,_LINK(r11)
844 mtlr r10
845 REST_GPR(10, r11)
846 mtspr SPRN_SRR1,r9
847 mtspr SPRN_SRR0,r12
848 REST_GPR(9, r11)
849 REST_GPR(12, r11)
850 lwz r11,GPR11(r11)
851 SYNC
852 RFI
853
854/* check if the exception happened in a restartable section */
8551: lis r3,exc_exit_restart_end@ha
856 addi r3,r3,exc_exit_restart_end@l
857 cmplw r12,r3
858 bge 3f
859 lis r4,exc_exit_restart@ha
860 addi r4,r4,exc_exit_restart@l
861 cmplw r12,r4
862 blt 3f
863 lis r3,fee_restarts@ha
864 tophys(r3,r3)
865 lwz r5,fee_restarts@l(r3)
866 addi r5,r5,1
867 stw r5,fee_restarts@l(r3)
868 mr r12,r4 /* restart at exc_exit_restart */
869 b 2b
870
871 .comm fee_restarts,4
872
873/* aargh, a nonrecoverable interrupt, panic */
874/* aargh, we don't know which trap this is */
875/* but the 601 doesn't implement the RI bit, so assume it's OK */
8763:
877BEGIN_FTR_SECTION
878 b 2b
879END_FTR_SECTION_IFSET(CPU_FTR_601)
880 li r10,-1
881 stw r10,TRAP(r11)
882 addi r3,r1,STACK_FRAME_OVERHEAD
883 li r10,MSR_KERNEL
884 bl transfer_to_handler_full
885 .long nonrecoverable_exception
886 .long ret_from_except
887
888/*
889 * FP unavailable trap from kernel - print a message, but let
890 * the task use FP in the kernel until it returns to user mode.
891 */
892KernelFP:
893 lwz r3,_MSR(r1)
894 ori r3,r3,MSR_FP
895 stw r3,_MSR(r1) /* enable use of FP after return */
896 lis r3,86f@h
897 ori r3,r3,86f@l
898 mr r4,r2 /* current */
899 lwz r5,_NIP(r1)
900 bl printk
901 b ret_from_except
90286: .string "floating point used in kernel (task=%p, pc=%x)\n"
903 .align 4,0
904
905#ifdef CONFIG_ALTIVEC
906/* Note that the AltiVec support is closely modeled after the FP
907 * support. Changes to one are likely to be applicable to the
908 * other! */
909load_up_altivec:
910/*
911 * Disable AltiVec for the task which had AltiVec previously,
912 * and save its AltiVec registers in its thread_struct.
913 * Enables AltiVec for use in the kernel on return.
914 * On SMP we know the AltiVec units are free, since we give it up every
915 * switch. -- Kumar
916 */
917 mfmsr r5
918 oris r5,r5,MSR_VEC@h
919 MTMSRD(r5) /* enable use of AltiVec now */
920 isync
921/*
922 * For SMP, we don't do lazy AltiVec switching because it just gets too
923 * horrendously complex, especially when a task switches from one CPU
924 * to another. Instead we call giveup_altivec in switch_to.
925 */
926#ifndef CONFIG_SMP
927 tophys(r6,0)
928 addis r3,r6,last_task_used_altivec@ha
929 lwz r4,last_task_used_altivec@l(r3)
930 cmpwi 0,r4,0
931 beq 1f
932 add r4,r4,r6
933 addi r4,r4,THREAD /* want THREAD of last_task_used_altivec */
934 SAVE_32VR(0,r10,r4)
935 mfvscr vr0
936 li r10,THREAD_VSCR
937 stvx vr0,r10,r4
938 lwz r5,PT_REGS(r4)
939 add r5,r5,r6
940 lwz r4,_MSR-STACK_FRAME_OVERHEAD(r5)
941 lis r10,MSR_VEC@h
942 andc r4,r4,r10 /* disable altivec for previous task */
943 stw r4,_MSR-STACK_FRAME_OVERHEAD(r5)
9441:
945#endif /* CONFIG_SMP */
946 /* enable use of AltiVec after return */
947 oris r9,r9,MSR_VEC@h
948 mfspr r5,SPRN_SPRG3 /* current task's THREAD (phys) */
949 li r4,1
950 li r10,THREAD_VSCR
951 stw r4,THREAD_USED_VR(r5)
952 lvx vr0,r10,r5
953 mtvscr vr0
954 REST_32VR(0,r10,r5)
955#ifndef CONFIG_SMP
956 subi r4,r5,THREAD
957 sub r4,r4,r6
958 stw r4,last_task_used_altivec@l(r3)
959#endif /* CONFIG_SMP */
960 /* restore registers and return */
961 /* we haven't used ctr or xer or lr */
962 b fast_exception_return
963
964/*
965 * AltiVec unavailable trap from kernel - print a message, but let
966 * the task use AltiVec in the kernel until it returns to user mode.
967 */
968KernelAltiVec:
969 lwz r3,_MSR(r1)
970 oris r3,r3,MSR_VEC@h
971 stw r3,_MSR(r1) /* enable use of AltiVec after return */
972 lis r3,87f@h
973 ori r3,r3,87f@l
974 mr r4,r2 /* current */
975 lwz r5,_NIP(r1)
976 bl printk
977 b ret_from_except
97887: .string "AltiVec used in kernel (task=%p, pc=%x) \n"
979 .align 4,0
980
981/*
982 * giveup_altivec(tsk)
983 * Disable AltiVec for the task given as the argument,
984 * and save the AltiVec registers in its thread_struct.
985 * Enables AltiVec for use in the kernel on return.
986 */
987
988 .globl giveup_altivec
989giveup_altivec:
990 mfmsr r5
991 oris r5,r5,MSR_VEC@h
992 SYNC
993 MTMSRD(r5) /* enable use of AltiVec now */
994 isync
995 cmpwi 0,r3,0
996 beqlr- /* if no previous owner, done */
997 addi r3,r3,THREAD /* want THREAD of task */
998 lwz r5,PT_REGS(r3)
999 cmpwi 0,r5,0
1000 SAVE_32VR(0, r4, r3)
1001 mfvscr vr0
1002 li r4,THREAD_VSCR
1003 stvx vr0,r4,r3
1004 beq 1f
1005 lwz r4,_MSR-STACK_FRAME_OVERHEAD(r5)
1006 lis r3,MSR_VEC@h
1007 andc r4,r4,r3 /* disable AltiVec for previous task */
1008 stw r4,_MSR-STACK_FRAME_OVERHEAD(r5)
10091:
1010#ifndef CONFIG_SMP
1011 li r5,0
1012 lis r4,last_task_used_altivec@ha
1013 stw r5,last_task_used_altivec@l(r4)
1014#endif /* CONFIG_SMP */
1015 blr
1016#endif /* CONFIG_ALTIVEC */
1017
1018/*
1019 * giveup_fpu(tsk)
1020 * Disable FP for the task given as the argument,
1021 * and save the floating-point registers in its thread_struct.
1022 * Enables the FPU for use in the kernel on return.
1023 */
1024 .globl giveup_fpu
1025giveup_fpu:
1026 mfmsr r5
1027 ori r5,r5,MSR_FP
1028 SYNC_601
1029 ISYNC_601
1030 MTMSRD(r5) /* enable use of fpu now */
1031 SYNC_601
1032 isync
1033 cmpwi 0,r3,0
1034 beqlr- /* if no previous owner, done */
1035 addi r3,r3,THREAD /* want THREAD of task */
1036 lwz r5,PT_REGS(r3)
1037 cmpwi 0,r5,0
1038 SAVE_32FPRS(0, r3)
1039 mffs fr0
1040 stfd fr0,THREAD_FPSCR-4(r3)
1041 beq 1f
1042 lwz r4,_MSR-STACK_FRAME_OVERHEAD(r5)
1043 li r3,MSR_FP|MSR_FE0|MSR_FE1
1044 andc r4,r4,r3 /* disable FP for previous task */
1045 stw r4,_MSR-STACK_FRAME_OVERHEAD(r5)
10461:
1047#ifndef CONFIG_SMP
1048 li r5,0
1049 lis r4,last_task_used_math@ha
1050 stw r5,last_task_used_math@l(r4)
1051#endif /* CONFIG_SMP */
1052 blr
1053
1054/*
1055 * This code is jumped to from the startup code to copy
1056 * the kernel image to physical address 0.
1057 */
1058relocate_kernel:
1059 addis r9,r26,klimit@ha /* fetch klimit */
1060 lwz r25,klimit@l(r9)
1061 addis r25,r25,-KERNELBASE@h
1062 li r3,0 /* Destination base address */
1063 li r6,0 /* Destination offset */
1064 li r5,0x4000 /* # bytes of memory to copy */
1065 bl copy_and_flush /* copy the first 0x4000 bytes */
1066 addi r0,r3,4f@l /* jump to the address of 4f */
1067 mtctr r0 /* in copy and do the rest. */
1068 bctr /* jump to the copy */
10694: mr r5,r25
1070 bl copy_and_flush /* copy the rest */
1071 b turn_on_mmu
1072
1073/*
1074 * Copy routine used to copy the kernel to start at physical address 0
1075 * and flush and invalidate the caches as needed.
1076 * r3 = dest addr, r4 = source addr, r5 = copy limit, r6 = start offset
1077 * on exit, r3, r4, r5 are unchanged, r6 is updated to be >= r5.
1078 */
1079copy_and_flush:
1080 addi r5,r5,-4
1081 addi r6,r6,-4
10824: li r0,L1_CACHE_LINE_SIZE/4
1083 mtctr r0
10843: addi r6,r6,4 /* copy a cache line */
1085 lwzx r0,r6,r4
1086 stwx r0,r6,r3
1087 bdnz 3b
1088 dcbst r6,r3 /* write it to memory */
1089 sync
1090 icbi r6,r3 /* flush the icache line */
1091 cmplw 0,r6,r5
1092 blt 4b
1093 sync /* additional sync needed on g4 */
1094 isync
1095 addi r5,r5,4
1096 addi r6,r6,4
1097 blr
1098
1099#ifdef CONFIG_APUS
1100/*
1101 * On APUS the physical base address of the kernel is not known at compile
1102 * time, which means the __pa/__va constants used are incorrect. In the
1103 * __init section is recorded the virtual addresses of instructions using
1104 * these constants, so all that has to be done is fix these before
1105 * continuing the kernel boot.
1106 *
1107 * r4 = The physical address of the kernel base.
1108 */
1109fix_mem_constants:
1110 mr r10,r4
1111 addis r10,r10,-KERNELBASE@h /* virt_to_phys constant */
1112 neg r11,r10 /* phys_to_virt constant */
1113
1114 lis r12,__vtop_table_begin@h
1115 ori r12,r12,__vtop_table_begin@l
1116 add r12,r12,r10 /* table begin phys address */
1117 lis r13,__vtop_table_end@h
1118 ori r13,r13,__vtop_table_end@l
1119 add r13,r13,r10 /* table end phys address */
1120 subi r12,r12,4
1121 subi r13,r13,4
11221: lwzu r14,4(r12) /* virt address of instruction */
1123 add r14,r14,r10 /* phys address of instruction */
1124 lwz r15,0(r14) /* instruction, now insert top */
1125 rlwimi r15,r10,16,16,31 /* half of vp const in low half */
1126 stw r15,0(r14) /* of instruction and restore. */
1127 dcbst r0,r14 /* write it to memory */
1128 sync
1129 icbi r0,r14 /* flush the icache line */
1130 cmpw r12,r13
1131 bne 1b
1132 sync /* additional sync needed on g4 */
1133 isync
1134
1135/*
1136 * Map the memory where the exception handlers will
1137 * be copied to when hash constants have been patched.
1138 */
1139#ifdef CONFIG_APUS_FAST_EXCEPT
1140 lis r8,0xfff0
1141#else
1142 lis r8,0
1143#endif
1144 ori r8,r8,0x2 /* 128KB, supervisor */
1145 mtspr SPRN_DBAT3U,r8
1146 mtspr SPRN_DBAT3L,r8
1147
1148 lis r12,__ptov_table_begin@h
1149 ori r12,r12,__ptov_table_begin@l
1150 add r12,r12,r10 /* table begin phys address */
1151 lis r13,__ptov_table_end@h
1152 ori r13,r13,__ptov_table_end@l
1153 add r13,r13,r10 /* table end phys address */
1154 subi r12,r12,4
1155 subi r13,r13,4
11561: lwzu r14,4(r12) /* virt address of instruction */
1157 add r14,r14,r10 /* phys address of instruction */
1158 lwz r15,0(r14) /* instruction, now insert top */
1159 rlwimi r15,r11,16,16,31 /* half of pv const in low half*/
1160 stw r15,0(r14) /* of instruction and restore. */
1161 dcbst r0,r14 /* write it to memory */
1162 sync
1163 icbi r0,r14 /* flush the icache line */
1164 cmpw r12,r13
1165 bne 1b
1166
1167 sync /* additional sync needed on g4 */
1168 isync /* No speculative loading until now */
1169 blr
1170
1171/***********************************************************************
1172 * Please note that on APUS the exception handlers are located at the
1173 * physical address 0xfff0000. For this reason, the exception handlers
1174 * cannot use relative branches to access the code below.
1175 ***********************************************************************/
1176#endif /* CONFIG_APUS */
1177
1178#ifdef CONFIG_SMP
1179#ifdef CONFIG_GEMINI
1180 .globl __secondary_start_gemini
1181__secondary_start_gemini:
1182 mfspr r4,SPRN_HID0
1183 ori r4,r4,HID0_ICFI
1184 li r3,0
1185 ori r3,r3,HID0_ICE
1186 andc r4,r4,r3
1187 mtspr SPRN_HID0,r4
1188 sync
1189 bl gemini_prom_init
1190 b __secondary_start
1191#endif /* CONFIG_GEMINI */
1192 .globl __secondary_start_psurge
1193__secondary_start_psurge:
1194 li r24,1 /* cpu # */
1195 b __secondary_start_psurge99
1196 .globl __secondary_start_psurge2
1197__secondary_start_psurge2:
1198 li r24,2 /* cpu # */
1199 b __secondary_start_psurge99
1200 .globl __secondary_start_psurge3
1201__secondary_start_psurge3:
1202 li r24,3 /* cpu # */
1203 b __secondary_start_psurge99
1204__secondary_start_psurge99:
1205 /* we come in here with IR=0 and DR=1, and DBAT 0
1206 set to map the 0xf0000000 - 0xffffffff region */
1207 mfmsr r0
1208 rlwinm r0,r0,0,28,26 /* clear DR (0x10) */
1209 SYNC
1210 mtmsr r0
1211 isync
1212
1213 .globl __secondary_start
1214__secondary_start:
1215#ifdef CONFIG_PPC64BRIDGE
1216 mfmsr r0
1217 clrldi r0,r0,1 /* make sure it's in 32-bit mode */
1218 SYNC
1219 MTMSRD(r0)
1220 isync
1221#endif
1222 /* Copy some CPU settings from CPU 0 */
1223 bl __restore_cpu_setup
1224
1225 lis r3,-KERNELBASE@h
1226 mr r4,r24
1227 bl identify_cpu
1228 bl call_setup_cpu /* Call setup_cpu for this CPU */
1229#ifdef CONFIG_6xx
1230 lis r3,-KERNELBASE@h
1231 bl init_idle_6xx
1232#endif /* CONFIG_6xx */
1233#ifdef CONFIG_POWER4
1234 lis r3,-KERNELBASE@h
1235 bl init_idle_power4
1236#endif /* CONFIG_POWER4 */
1237
1238 /* get current_thread_info and current */
1239 lis r1,secondary_ti@ha
1240 tophys(r1,r1)
1241 lwz r1,secondary_ti@l(r1)
1242 tophys(r2,r1)
1243 lwz r2,TI_TASK(r2)
1244
1245 /* stack */
1246 addi r1,r1,THREAD_SIZE-STACK_FRAME_OVERHEAD
1247 li r0,0
1248 tophys(r3,r1)
1249 stw r0,0(r3)
1250
1251 /* load up the MMU */
1252 bl load_up_mmu
1253
1254 /* ptr to phys current thread */
1255 tophys(r4,r2)
1256 addi r4,r4,THREAD /* phys address of our thread_struct */
1257 CLR_TOP32(r4)
1258 mtspr SPRN_SPRG3,r4
1259 li r3,0
1260 mtspr SPRN_SPRG2,r3 /* 0 => not in RTAS */
1261
1262 /* enable MMU and jump to start_secondary */
1263 li r4,MSR_KERNEL
1264 FIX_SRR1(r4,r5)
1265 lis r3,start_secondary@h
1266 ori r3,r3,start_secondary@l
1267 mtspr SPRN_SRR0,r3
1268 mtspr SPRN_SRR1,r4
1269 SYNC
1270 RFI
1271#endif /* CONFIG_SMP */
1272
1273/*
1274 * Those generic dummy functions are kept for CPUs not
1275 * included in CONFIG_6xx
1276 */
1277_GLOBAL(__setup_cpu_power3)
1278 blr
1279_GLOBAL(__setup_cpu_generic)
1280 blr
1281
1282#if !defined(CONFIG_6xx) && !defined(CONFIG_POWER4)
1283_GLOBAL(__save_cpu_setup)
1284 blr
1285_GLOBAL(__restore_cpu_setup)
1286 blr
1287#endif /* !defined(CONFIG_6xx) && !defined(CONFIG_POWER4) */
1288
1289
1290/*
1291 * Load stuff into the MMU. Intended to be called with
1292 * IR=0 and DR=0.
1293 */
1294load_up_mmu:
1295 sync /* Force all PTE updates to finish */
1296 isync
1297 tlbia /* Clear all TLB entries */
1298 sync /* wait for tlbia/tlbie to finish */
1299 TLBSYNC /* ... on all CPUs */
1300 /* Load the SDR1 register (hash table base & size) */
1301 lis r6,_SDR1@ha
1302 tophys(r6,r6)
1303 lwz r6,_SDR1@l(r6)
1304 mtspr SPRN_SDR1,r6
1305#ifdef CONFIG_PPC64BRIDGE
1306 /* clear the ASR so we only use the pseudo-segment registers. */
1307 li r6,0
1308 mtasr r6
1309#endif /* CONFIG_PPC64BRIDGE */
1310 li r0,16 /* load up segment register values */
1311 mtctr r0 /* for context 0 */
1312 lis r3,0x2000 /* Ku = 1, VSID = 0 */
1313 li r4,0
13143: mtsrin r3,r4
1315 addi r3,r3,0x111 /* increment VSID */
1316 addis r4,r4,0x1000 /* address of next segment */
1317 bdnz 3b
1318#ifndef CONFIG_POWER4
1319/* Load the BAT registers with the values set up by MMU_init.
1320 MMU_init takes care of whether we're on a 601 or not. */
1321 mfpvr r3
1322 srwi r3,r3,16
1323 cmpwi r3,1
1324 lis r3,BATS@ha
1325 addi r3,r3,BATS@l
1326 tophys(r3,r3)
1327 LOAD_BAT(0,r3,r4,r5)
1328 LOAD_BAT(1,r3,r4,r5)
1329 LOAD_BAT(2,r3,r4,r5)
1330 LOAD_BAT(3,r3,r4,r5)
1331#endif /* CONFIG_POWER4 */
1332 blr
1333
1334/*
1335 * This is where the main kernel code starts.
1336 */
1337start_here:
1338 /* ptr to current */
1339 lis r2,init_task@h
1340 ori r2,r2,init_task@l
1341 /* Set up for using our exception vectors */
1342 /* ptr to phys current thread */
1343 tophys(r4,r2)
1344 addi r4,r4,THREAD /* init task's THREAD */
1345 CLR_TOP32(r4)
1346 mtspr SPRN_SPRG3,r4
1347 li r3,0
1348 mtspr SPRN_SPRG2,r3 /* 0 => not in RTAS */
1349
1350 /* stack */
1351 lis r1,init_thread_union@ha
1352 addi r1,r1,init_thread_union@l
1353 li r0,0
1354 stwu r0,THREAD_SIZE-STACK_FRAME_OVERHEAD(r1)
1355/*
1356 * Do early bootinfo parsing, platform-specific initialization,
1357 * and set up the MMU.
1358 */
1359 mr r3,r31
1360 mr r4,r30
1361 mr r5,r29
1362 mr r6,r28
1363 mr r7,r27
1364 bl machine_init
1365 bl MMU_init
1366
1367#ifdef CONFIG_APUS
1368 /* Copy exception code to exception vector base on APUS. */
1369 lis r4,KERNELBASE@h
1370#ifdef CONFIG_APUS_FAST_EXCEPT
1371 lis r3,0xfff0 /* Copy to 0xfff00000 */
1372#else
1373 lis r3,0 /* Copy to 0x00000000 */
1374#endif
1375 li r5,0x4000 /* # bytes of memory to copy */
1376 li r6,0
1377 bl copy_and_flush /* copy the first 0x4000 bytes */
1378#endif /* CONFIG_APUS */
1379
1380/*
1381 * Go back to running unmapped so we can load up new values
1382 * for SDR1 (hash table pointer) and the segment registers
1383 * and change to using our exception vectors.
1384 */
1385 lis r4,2f@h
1386 ori r4,r4,2f@l
1387 tophys(r4,r4)
1388 li r3,MSR_KERNEL & ~(MSR_IR|MSR_DR)
1389 FIX_SRR1(r3,r5)
1390 mtspr SPRN_SRR0,r4
1391 mtspr SPRN_SRR1,r3
1392 SYNC
1393 RFI
1394/* Load up the kernel context */
13952: bl load_up_mmu
1396
1397#ifdef CONFIG_BDI_SWITCH
1398 /* Add helper information for the Abatron bdiGDB debugger.
1399 * We do this here because we know the mmu is disabled, and
1400 * will be enabled for real in just a few instructions.
1401 */
1402 lis r5, abatron_pteptrs@h
1403 ori r5, r5, abatron_pteptrs@l
1404 stw r5, 0xf0(r0) /* This much match your Abatron config */
1405 lis r6, swapper_pg_dir@h
1406 ori r6, r6, swapper_pg_dir@l
1407 tophys(r5, r5)
1408 stw r6, 0(r5)
1409#endif /* CONFIG_BDI_SWITCH */
1410
1411/* Now turn on the MMU for real! */
1412 li r4,MSR_KERNEL
1413 FIX_SRR1(r4,r5)
1414 lis r3,start_kernel@h
1415 ori r3,r3,start_kernel@l
1416 mtspr SPRN_SRR0,r3
1417 mtspr SPRN_SRR1,r4
1418 SYNC
1419 RFI
1420
1421/*
1422 * Set up the segment registers for a new context.
1423 */
1424_GLOBAL(set_context)
1425 mulli r3,r3,897 /* multiply context by skew factor */
1426 rlwinm r3,r3,4,8,27 /* VSID = (context & 0xfffff) << 4 */
1427 addis r3,r3,0x6000 /* Set Ks, Ku bits */
1428 li r0,NUM_USER_SEGMENTS
1429 mtctr r0
1430
1431#ifdef CONFIG_BDI_SWITCH
1432 /* Context switch the PTE pointer for the Abatron BDI2000.
1433 * The PGDIR is passed as second argument.
1434 */
1435 lis r5, KERNELBASE@h
1436 lwz r5, 0xf0(r5)
1437 stw r4, 0x4(r5)
1438#endif
1439 li r4,0
1440 isync
14413:
1442#ifdef CONFIG_PPC64BRIDGE
1443 slbie r4
1444#endif /* CONFIG_PPC64BRIDGE */
1445 mtsrin r3,r4
1446 addi r3,r3,0x111 /* next VSID */
1447 rlwinm r3,r3,0,8,3 /* clear out any overflow from VSID field */
1448 addis r4,r4,0x1000 /* address of next segment */
1449 bdnz 3b
1450 sync
1451 isync
1452 blr
1453
1454/*
1455 * An undocumented "feature" of 604e requires that the v bit
1456 * be cleared before changing BAT values.
1457 *
1458 * Also, newer IBM firmware does not clear bat3 and 4 so
1459 * this makes sure it's done.
1460 * -- Cort
1461 */
1462clear_bats:
1463 li r10,0
1464 mfspr r9,SPRN_PVR
1465 rlwinm r9,r9,16,16,31 /* r9 = 1 for 601, 4 for 604 */
1466 cmpwi r9, 1
1467 beq 1f
1468
1469 mtspr SPRN_DBAT0U,r10
1470 mtspr SPRN_DBAT0L,r10
1471 mtspr SPRN_DBAT1U,r10
1472 mtspr SPRN_DBAT1L,r10
1473 mtspr SPRN_DBAT2U,r10
1474 mtspr SPRN_DBAT2L,r10
1475 mtspr SPRN_DBAT3U,r10
1476 mtspr SPRN_DBAT3L,r10
14771:
1478 mtspr SPRN_IBAT0U,r10
1479 mtspr SPRN_IBAT0L,r10
1480 mtspr SPRN_IBAT1U,r10
1481 mtspr SPRN_IBAT1L,r10
1482 mtspr SPRN_IBAT2U,r10
1483 mtspr SPRN_IBAT2L,r10
1484 mtspr SPRN_IBAT3U,r10
1485 mtspr SPRN_IBAT3L,r10
1486BEGIN_FTR_SECTION
1487 /* Here's a tweak: at this point, CPU setup have
1488 * not been called yet, so HIGH_BAT_EN may not be
1489 * set in HID0 for the 745x processors. However, it
1490 * seems that doesn't affect our ability to actually
1491 * write to these SPRs.
1492 */
1493 mtspr SPRN_DBAT4U,r10
1494 mtspr SPRN_DBAT4L,r10
1495 mtspr SPRN_DBAT5U,r10
1496 mtspr SPRN_DBAT5L,r10
1497 mtspr SPRN_DBAT6U,r10
1498 mtspr SPRN_DBAT6L,r10
1499 mtspr SPRN_DBAT7U,r10
1500 mtspr SPRN_DBAT7L,r10
1501 mtspr SPRN_IBAT4U,r10
1502 mtspr SPRN_IBAT4L,r10
1503 mtspr SPRN_IBAT5U,r10
1504 mtspr SPRN_IBAT5L,r10
1505 mtspr SPRN_IBAT6U,r10
1506 mtspr SPRN_IBAT6L,r10
1507 mtspr SPRN_IBAT7U,r10
1508 mtspr SPRN_IBAT7L,r10
1509END_FTR_SECTION_IFSET(CPU_FTR_HAS_HIGH_BATS)
1510 blr
1511
1512flush_tlbs:
1513 lis r10, 0x40
15141: addic. r10, r10, -0x1000
1515 tlbie r10
1516 blt 1b
1517 sync
1518 blr
1519
1520mmu_off:
1521 addi r4, r3, __after_mmu_off - _start
1522 mfmsr r3
1523 andi. r0,r3,MSR_DR|MSR_IR /* MMU enabled? */
1524 beqlr
1525 andc r3,r3,r0
1526 mtspr SPRN_SRR0,r4
1527 mtspr SPRN_SRR1,r3
1528 sync
1529 RFI
1530
1531#ifndef CONFIG_POWER4
1532/*
1533 * Use the first pair of BAT registers to map the 1st 16MB
1534 * of RAM to KERNELBASE. From this point on we can't safely
1535 * call OF any more.
1536 */
1537initial_bats:
1538 lis r11,KERNELBASE@h
1539#ifndef CONFIG_PPC64BRIDGE
1540 mfspr r9,SPRN_PVR
1541 rlwinm r9,r9,16,16,31 /* r9 = 1 for 601, 4 for 604 */
1542 cmpwi 0,r9,1
1543 bne 4f
1544 ori r11,r11,4 /* set up BAT registers for 601 */
1545 li r8,0x7f /* valid, block length = 8MB */
1546 oris r9,r11,0x800000@h /* set up BAT reg for 2nd 8M */
1547 oris r10,r8,0x800000@h /* set up BAT reg for 2nd 8M */
1548 mtspr SPRN_IBAT0U,r11 /* N.B. 601 has valid bit in */
1549 mtspr SPRN_IBAT0L,r8 /* lower BAT register */
1550 mtspr SPRN_IBAT1U,r9
1551 mtspr SPRN_IBAT1L,r10
1552 isync
1553 blr
1554#endif /* CONFIG_PPC64BRIDGE */
1555
15564: tophys(r8,r11)
1557#ifdef CONFIG_SMP
1558 ori r8,r8,0x12 /* R/W access, M=1 */
1559#else
1560 ori r8,r8,2 /* R/W access */
1561#endif /* CONFIG_SMP */
1562#ifdef CONFIG_APUS
1563 ori r11,r11,BL_8M<<2|0x2 /* set up 8MB BAT registers for 604 */
1564#else
1565 ori r11,r11,BL_256M<<2|0x2 /* set up BAT registers for 604 */
1566#endif /* CONFIG_APUS */
1567
1568#ifdef CONFIG_PPC64BRIDGE
1569 /* clear out the high 32 bits in the BAT */
1570 clrldi r11,r11,32
1571 clrldi r8,r8,32
1572#endif /* CONFIG_PPC64BRIDGE */
1573 mtspr SPRN_DBAT0L,r8 /* N.B. 6xx (not 601) have valid */
1574 mtspr SPRN_DBAT0U,r11 /* bit in upper BAT register */
1575 mtspr SPRN_IBAT0L,r8
1576 mtspr SPRN_IBAT0U,r11
1577 isync
1578 blr
1579
1580#if !defined(CONFIG_APUS) && defined(CONFIG_BOOTX_TEXT)
1581setup_disp_bat:
1582 /*
1583 * setup the display bat prepared for us in prom.c
1584 */
1585 mflr r8
1586 bl reloc_offset
1587 mtlr r8
1588 addis r8,r3,disp_BAT@ha
1589 addi r8,r8,disp_BAT@l
1590 lwz r11,0(r8)
1591 lwz r8,4(r8)
1592 mfspr r9,SPRN_PVR
1593 rlwinm r9,r9,16,16,31 /* r9 = 1 for 601, 4 for 604 */
1594 cmpwi 0,r9,1
1595 beq 1f
1596 mtspr SPRN_DBAT3L,r8
1597 mtspr SPRN_DBAT3U,r11
1598 blr
15991: mtspr SPRN_IBAT3L,r8
1600 mtspr SPRN_IBAT3U,r11
1601 blr
1602
1603#endif /* !defined(CONFIG_APUS) && defined(CONFIG_BOOTX_TEXT) */
1604
1605#else /* CONFIG_POWER4 */
1606/*
1607 * Load up the SDR1 and segment register values now
1608 * since we don't have the BATs.
1609 * Also make sure we are running in 32-bit mode.
1610 */
1611
1612initial_mm_power4:
1613 addis r14,r3,_SDR1@ha /* get the value from _SDR1 */
1614 lwz r14,_SDR1@l(r14) /* assume hash table below 4GB */
1615 mtspr SPRN_SDR1,r14
1616 slbia
1617 lis r4,0x2000 /* set pseudo-segment reg 12 */
1618 ori r5,r4,0x0ccc
1619 mtsr 12,r5
1620#if 0
1621 ori r5,r4,0x0888 /* set pseudo-segment reg 8 */
1622 mtsr 8,r5 /* (for access to serial port) */
1623#endif
1624#ifdef CONFIG_BOOTX_TEXT
1625 ori r5,r4,0x0999 /* set pseudo-segment reg 9 */
1626 mtsr 9,r5 /* (for access to screen) */
1627#endif
1628 mfmsr r0
1629 clrldi r0,r0,1
1630 sync
1631 mtmsr r0
1632 isync
1633 blr
1634
1635#endif /* CONFIG_POWER4 */
1636
1637#ifdef CONFIG_8260
1638/* Jump into the system reset for the rom.
1639 * We first disable the MMU, and then jump to the ROM reset address.
1640 *
1641 * r3 is the board info structure, r4 is the location for starting.
1642 * I use this for building a small kernel that can load other kernels,
1643 * rather than trying to write or rely on a rom monitor that can tftp load.
1644 */
1645 .globl m8260_gorom
1646m8260_gorom:
1647 mfmsr r0
1648 rlwinm r0,r0,0,17,15 /* clear MSR_EE in r0 */
1649 sync
1650 mtmsr r0
1651 sync
1652 mfspr r11, SPRN_HID0
1653 lis r10, 0
1654 ori r10,r10,HID0_ICE|HID0_DCE
1655 andc r11, r11, r10
1656 mtspr SPRN_HID0, r11
1657 isync
1658 li r5, MSR_ME|MSR_RI
1659 lis r6,2f@h
1660 addis r6,r6,-KERNELBASE@h
1661 ori r6,r6,2f@l
1662 mtspr SPRN_SRR0,r6
1663 mtspr SPRN_SRR1,r5
1664 isync
1665 sync
1666 rfi
16672:
1668 mtlr r4
1669 blr
1670#endif
1671
1672
1673/*
1674 * We put a few things here that have to be page-aligned.
1675 * This stuff goes at the beginning of the data segment,
1676 * which is page-aligned.
1677 */
1678 .data
1679 .globl sdata
1680sdata:
1681 .globl empty_zero_page
1682empty_zero_page:
1683 .space 4096
1684
1685 .globl swapper_pg_dir
1686swapper_pg_dir:
1687 .space 4096
1688
1689/*
1690 * This space gets a copy of optional info passed to us by the bootstrap
1691 * Used to pass parameters into the kernel like root=/dev/sda1, etc.
1692 */
1693 .globl cmd_line
1694cmd_line:
1695 .space 512
1696
1697 .globl intercept_table
1698intercept_table:
1699 .long 0, 0, i0x200, i0x300, i0x400, 0, i0x600, i0x700
1700 .long i0x800, 0, 0, 0, 0, i0xd00, 0, 0
1701 .long 0, 0, 0, i0x1300, 0, 0, 0, 0
1702 .long 0, 0, 0, 0, 0, 0, 0, 0
1703 .long 0, 0, 0, 0, 0, 0, 0, 0
1704 .long 0, 0, 0, 0, 0, 0, 0, 0
1705
1706/* Room for two PTE pointers, usually the kernel and current user pointers
1707 * to their respective root page table.
1708 */
1709abatron_pteptrs:
1710 .space 8
diff --git a/arch/ppc/kernel/head_44x.S b/arch/ppc/kernel/head_44x.S
new file mode 100644
index 000000000000..9ed8165a3d6c
--- /dev/null
+++ b/arch/ppc/kernel/head_44x.S
@@ -0,0 +1,753 @@
1/*
2 * arch/ppc/kernel/head_44x.S
3 *
4 * Kernel execution entry point code.
5 *
6 * Copyright (c) 1995-1996 Gary Thomas <gdt@linuxppc.org>
7 * Initial PowerPC version.
8 * Copyright (c) 1996 Cort Dougan <cort@cs.nmt.edu>
9 * Rewritten for PReP
10 * Copyright (c) 1996 Paul Mackerras <paulus@cs.anu.edu.au>
11 * Low-level exception handers, MMU support, and rewrite.
12 * Copyright (c) 1997 Dan Malek <dmalek@jlc.net>
13 * PowerPC 8xx modifications.
14 * Copyright (c) 1998-1999 TiVo, Inc.
15 * PowerPC 403GCX modifications.
16 * Copyright (c) 1999 Grant Erickson <grant@lcse.umn.edu>
17 * PowerPC 403GCX/405GP modifications.
18 * Copyright 2000 MontaVista Software Inc.
19 * PPC405 modifications
20 * PowerPC 403GCX/405GP modifications.
21 * Author: MontaVista Software, Inc.
22 * frank_rowand@mvista.com or source@mvista.com
23 * debbie_chu@mvista.com
24 * Copyright 2002-2005 MontaVista Software, Inc.
25 * PowerPC 44x support, Matt Porter <mporter@kernel.crashing.org>
26 *
27 * This program is free software; you can redistribute it and/or modify it
28 * under the terms of the GNU General Public License as published by the
29 * Free Software Foundation; either version 2 of the License, or (at your
30 * option) any later version.
31 */
32
33#include <linux/config.h>
34#include <asm/processor.h>
35#include <asm/page.h>
36#include <asm/mmu.h>
37#include <asm/pgtable.h>
38#include <asm/ibm4xx.h>
39#include <asm/ibm44x.h>
40#include <asm/cputable.h>
41#include <asm/thread_info.h>
42#include <asm/ppc_asm.h>
43#include <asm/offsets.h>
44#include "head_booke.h"
45
46
47/* As with the other PowerPC ports, it is expected that when code
48 * execution begins here, the following registers contain valid, yet
49 * optional, information:
50 *
51 * r3 - Board info structure pointer (DRAM, frequency, MAC address, etc.)
52 * r4 - Starting address of the init RAM disk
53 * r5 - Ending address of the init RAM disk
54 * r6 - Start of kernel command line string (e.g. "mem=128")
55 * r7 - End of kernel command line string
56 *
57 */
58 .text
59_GLOBAL(_stext)
60_GLOBAL(_start)
61 /*
62 * Reserve a word at a fixed location to store the address
63 * of abatron_pteptrs
64 */
65 nop
66/*
67 * Save parameters we are passed
68 */
69 mr r31,r3
70 mr r30,r4
71 mr r29,r5
72 mr r28,r6
73 mr r27,r7
74 li r24,0 /* CPU number */
75
76/*
77 * Set up the initial MMU state
78 *
79 * We are still executing code at the virtual address
80 * mappings set by the firmware for the base of RAM.
81 *
82 * We first invalidate all TLB entries but the one
83 * we are running from. We then load the KERNELBASE
84 * mappings so we can begin to use kernel addresses
85 * natively and so the interrupt vector locations are
86 * permanently pinned (necessary since Book E
87 * implementations always have translation enabled).
88 *
89 * TODO: Use the known TLB entry we are running from to
90 * determine which physical region we are located
91 * in. This can be used to determine where in RAM
92 * (on a shared CPU system) or PCI memory space
93 * (on a DRAMless system) we are located.
94 * For now, we assume a perfect world which means
95 * we are located at the base of DRAM (physical 0).
96 */
97
98/*
99 * Search TLB for entry that we are currently using.
100 * Invalidate all entries but the one we are using.
101 */
102 /* Load our current PID->MMUCR TID and MSR IS->MMUCR STS */
103 mfspr r3,SPRN_PID /* Get PID */
104 mfmsr r4 /* Get MSR */
105 andi. r4,r4,MSR_IS@l /* TS=1? */
106 beq wmmucr /* If not, leave STS=0 */
107 oris r3,r3,PPC44x_MMUCR_STS@h /* Set STS=1 */
108wmmucr: mtspr SPRN_MMUCR,r3 /* Put MMUCR */
109 sync
110
111 bl invstr /* Find our address */
112invstr: mflr r5 /* Make it accessible */
113 tlbsx r23,0,r5 /* Find entry we are in */
114 li r4,0 /* Start at TLB entry 0 */
115 li r3,0 /* Set PAGEID inval value */
1161: cmpw r23,r4 /* Is this our entry? */
117 beq skpinv /* If so, skip the inval */
118 tlbwe r3,r4,PPC44x_TLB_PAGEID /* If not, inval the entry */
119skpinv: addi r4,r4,1 /* Increment */
120 cmpwi r4,64 /* Are we done? */
121 bne 1b /* If not, repeat */
122 isync /* If so, context change */
123
124/*
125 * Configure and load pinned entry into TLB slot 63.
126 */
127
128 lis r3,KERNELBASE@h /* Load the kernel virtual address */
129 ori r3,r3,KERNELBASE@l
130
131 /* Kernel is at the base of RAM */
132 li r4, 0 /* Load the kernel physical address */
133
134 /* Load the kernel PID = 0 */
135 li r0,0
136 mtspr SPRN_PID,r0
137 sync
138
139 /* Initialize MMUCR */
140 li r5,0
141 mtspr SPRN_MMUCR,r5
142 sync
143
144 /* pageid fields */
145 clrrwi r3,r3,10 /* Mask off the effective page number */
146 ori r3,r3,PPC44x_TLB_VALID | PPC44x_TLB_256M
147
148 /* xlat fields */
149 clrrwi r4,r4,10 /* Mask off the real page number */
150 /* ERPN is 0 for first 4GB page */
151
152 /* attrib fields */
153 /* Added guarded bit to protect against speculative loads/stores */
154 li r5,0
155 ori r5,r5,(PPC44x_TLB_SW | PPC44x_TLB_SR | PPC44x_TLB_SX | PPC44x_TLB_G)
156
157 li r0,63 /* TLB slot 63 */
158
159 tlbwe r3,r0,PPC44x_TLB_PAGEID /* Load the pageid fields */
160 tlbwe r4,r0,PPC44x_TLB_XLAT /* Load the translation fields */
161 tlbwe r5,r0,PPC44x_TLB_ATTRIB /* Load the attrib/access fields */
162
163 /* Force context change */
164 mfmsr r0
165 mtspr SPRN_SRR1, r0
166 lis r0,3f@h
167 ori r0,r0,3f@l
168 mtspr SPRN_SRR0,r0
169 sync
170 rfi
171
172 /* If necessary, invalidate original entry we used */
1733: cmpwi r23,63
174 beq 4f
175 li r6,0
176 tlbwe r6,r23,PPC44x_TLB_PAGEID
177 isync
178
1794:
180#ifdef CONFIG_SERIAL_TEXT_DEBUG
181 /*
182 * Add temporary UART mapping for early debug. This
183 * mapping must be identical to that used by the early
184 * bootloader code since the same asm/serial.h parameters
185 * are used for polled operation.
186 */
187 /* pageid fields */
188 lis r3,UART0_IO_BASE@h
189 ori r3,r3,PPC44x_TLB_VALID | PPC44x_TLB_256M
190
191 /* xlat fields */
192 lis r4,UART0_PHYS_IO_BASE@h /* RPN depends on SoC */
193 ori r4,r4,0x0001 /* ERPN is 1 for second 4GB page */
194
195 /* attrib fields */
196 li r5,0
197 ori r5,r5,(PPC44x_TLB_SW | PPC44x_TLB_SR | PPC44x_TLB_I | PPC44x_TLB_G)
198
199 li r0,1 /* TLB slot 1 */
200
201 tlbwe r3,r0,PPC44x_TLB_PAGEID /* Load the pageid fields */
202 tlbwe r4,r0,PPC44x_TLB_XLAT /* Load the translation fields */
203 tlbwe r5,r0,PPC44x_TLB_ATTRIB /* Load the attrib/access fields */
204
205 /* Force context change */
206 isync
207#endif /* CONFIG_SERIAL_TEXT_DEBUG */
208
209 /* Establish the interrupt vector offsets */
210 SET_IVOR(0, CriticalInput);
211 SET_IVOR(1, MachineCheck);
212 SET_IVOR(2, DataStorage);
213 SET_IVOR(3, InstructionStorage);
214 SET_IVOR(4, ExternalInput);
215 SET_IVOR(5, Alignment);
216 SET_IVOR(6, Program);
217 SET_IVOR(7, FloatingPointUnavailable);
218 SET_IVOR(8, SystemCall);
219 SET_IVOR(9, AuxillaryProcessorUnavailable);
220 SET_IVOR(10, Decrementer);
221 SET_IVOR(11, FixedIntervalTimer);
222 SET_IVOR(12, WatchdogTimer);
223 SET_IVOR(13, DataTLBError);
224 SET_IVOR(14, InstructionTLBError);
225 SET_IVOR(15, Debug);
226
227 /* Establish the interrupt vector base */
228 lis r4,interrupt_base@h /* IVPR only uses the high 16-bits */
229 mtspr SPRN_IVPR,r4
230
231 /*
232 * This is where the main kernel code starts.
233 */
234
235 /* ptr to current */
236 lis r2,init_task@h
237 ori r2,r2,init_task@l
238
239 /* ptr to current thread */
240 addi r4,r2,THREAD /* init task's THREAD */
241 mtspr SPRN_SPRG3,r4
242
243 /* stack */
244 lis r1,init_thread_union@h
245 ori r1,r1,init_thread_union@l
246 li r0,0
247 stwu r0,THREAD_SIZE-STACK_FRAME_OVERHEAD(r1)
248
249 bl early_init
250
251/*
252 * Decide what sort of machine this is and initialize the MMU.
253 */
254 mr r3,r31
255 mr r4,r30
256 mr r5,r29
257 mr r6,r28
258 mr r7,r27
259 bl machine_init
260 bl MMU_init
261
262 /* Setup PTE pointers for the Abatron bdiGDB */
263 lis r6, swapper_pg_dir@h
264 ori r6, r6, swapper_pg_dir@l
265 lis r5, abatron_pteptrs@h
266 ori r5, r5, abatron_pteptrs@l
267 lis r4, KERNELBASE@h
268 ori r4, r4, KERNELBASE@l
269 stw r5, 0(r4) /* Save abatron_pteptrs at a fixed location */
270 stw r6, 0(r5)
271
272 /* Let's move on */
273 lis r4,start_kernel@h
274 ori r4,r4,start_kernel@l
275 lis r3,MSR_KERNEL@h
276 ori r3,r3,MSR_KERNEL@l
277 mtspr SPRN_SRR0,r4
278 mtspr SPRN_SRR1,r3
279 rfi /* change context and jump to start_kernel */
280
281/*
282 * Interrupt vector entry code
283 *
284 * The Book E MMUs are always on so we don't need to handle
285 * interrupts in real mode as with previous PPC processors. In
286 * this case we handle interrupts in the kernel virtual address
287 * space.
288 *
289 * Interrupt vectors are dynamically placed relative to the
290 * interrupt prefix as determined by the address of interrupt_base.
291 * The interrupt vectors offsets are programmed using the labels
292 * for each interrupt vector entry.
293 *
294 * Interrupt vectors must be aligned on a 16 byte boundary.
295 * We align on a 32 byte cache line boundary for good measure.
296 */
297
298interrupt_base:
299 /* Critical Input Interrupt */
300 CRITICAL_EXCEPTION(0x0100, CriticalInput, UnknownException)
301
302 /* Machine Check Interrupt */
303#ifdef CONFIG_440A
304 MCHECK_EXCEPTION(0x0200, MachineCheck, MachineCheckException)
305#else
306 CRITICAL_EXCEPTION(0x0200, MachineCheck, MachineCheckException)
307#endif
308
309 /* Data Storage Interrupt */
310 START_EXCEPTION(DataStorage)
311 mtspr SPRN_SPRG0, r10 /* Save some working registers */
312 mtspr SPRN_SPRG1, r11
313 mtspr SPRN_SPRG4W, r12
314 mtspr SPRN_SPRG5W, r13
315 mfcr r11
316 mtspr SPRN_SPRG7W, r11
317
318 /*
319 * Check if it was a store fault, if not then bail
320 * because a user tried to access a kernel or
321 * read-protected page. Otherwise, get the
322 * offending address and handle it.
323 */
324 mfspr r10, SPRN_ESR
325 andis. r10, r10, ESR_ST@h
326 beq 2f
327
328 mfspr r10, SPRN_DEAR /* Get faulting address */
329
330 /* If we are faulting a kernel address, we have to use the
331 * kernel page tables.
332 */
333 andis. r11, r10, 0x8000
334 beq 3f
335 lis r11, swapper_pg_dir@h
336 ori r11, r11, swapper_pg_dir@l
337
338 mfspr r12,SPRN_MMUCR
339 rlwinm r12,r12,0,0,23 /* Clear TID */
340
341 b 4f
342
343 /* Get the PGD for the current thread */
3443:
345 mfspr r11,SPRN_SPRG3
346 lwz r11,PGDIR(r11)
347
348 /* Load PID into MMUCR TID */
349 mfspr r12,SPRN_MMUCR /* Get MMUCR */
350 mfspr r13,SPRN_PID /* Get PID */
351 rlwimi r12,r13,0,24,31 /* Set TID */
352
3534:
354 mtspr SPRN_MMUCR,r12
355
356 rlwinm r12, r10, 13, 19, 29 /* Compute pgdir/pmd offset */
357 lwzx r11, r12, r11 /* Get pgd/pmd entry */
358 rlwinm. r12, r11, 0, 0, 20 /* Extract pt base address */
359 beq 2f /* Bail if no table */
360
361 rlwimi r12, r10, 23, 20, 28 /* Compute pte address */
362 lwz r11, 4(r12) /* Get pte entry */
363
364 andi. r13, r11, _PAGE_RW /* Is it writeable? */
365 beq 2f /* Bail if not */
366
367 /* Update 'changed'.
368 */
369 ori r11, r11, _PAGE_DIRTY|_PAGE_ACCESSED|_PAGE_HWWRITE
370 stw r11, 4(r12) /* Update Linux page table */
371
372 li r13, PPC44x_TLB_SR@l /* Set SR */
373 rlwimi r13, r11, 29, 29, 29 /* SX = _PAGE_HWEXEC */
374 rlwimi r13, r11, 0, 30, 30 /* SW = _PAGE_RW */
375 rlwimi r13, r11, 29, 28, 28 /* UR = _PAGE_USER */
376 rlwimi r12, r11, 31, 26, 26 /* (_PAGE_USER>>1)->r12 */
377 rlwimi r12, r11, 29, 30, 30 /* (_PAGE_USER>>3)->r12 */
378 and r12, r12, r11 /* HWEXEC/RW & USER */
379 rlwimi r13, r12, 0, 26, 26 /* UX = HWEXEC & USER */
380 rlwimi r13, r12, 3, 27, 27 /* UW = RW & USER */
381
382 rlwimi r11,r13,0,26,31 /* Insert static perms */
383
384 rlwinm r11,r11,0,20,15 /* Clear U0-U3 */
385
386 /* find the TLB index that caused the fault. It has to be here. */
387 tlbsx r10, 0, r10
388
389 tlbwe r11, r10, PPC44x_TLB_ATTRIB /* Write ATTRIB */
390
391 /* Done...restore registers and get out of here.
392 */
393 mfspr r11, SPRN_SPRG7R
394 mtcr r11
395 mfspr r13, SPRN_SPRG5R
396 mfspr r12, SPRN_SPRG4R
397
398 mfspr r11, SPRN_SPRG1
399 mfspr r10, SPRN_SPRG0
400 rfi /* Force context change */
401
4022:
403 /*
404 * The bailout. Restore registers to pre-exception conditions
405 * and call the heavyweights to help us out.
406 */
407 mfspr r11, SPRN_SPRG7R
408 mtcr r11
409 mfspr r13, SPRN_SPRG5R
410 mfspr r12, SPRN_SPRG4R
411
412 mfspr r11, SPRN_SPRG1
413 mfspr r10, SPRN_SPRG0
414 b data_access
415
416 /* Instruction Storage Interrupt */
417 INSTRUCTION_STORAGE_EXCEPTION
418
419 /* External Input Interrupt */
420 EXCEPTION(0x0500, ExternalInput, do_IRQ, EXC_XFER_LITE)
421
422 /* Alignment Interrupt */
423 ALIGNMENT_EXCEPTION
424
425 /* Program Interrupt */
426 PROGRAM_EXCEPTION
427
428 /* Floating Point Unavailable Interrupt */
429 EXCEPTION(0x2010, FloatingPointUnavailable, UnknownException, EXC_XFER_EE)
430
431 /* System Call Interrupt */
432 START_EXCEPTION(SystemCall)
433 NORMAL_EXCEPTION_PROLOG
434 EXC_XFER_EE_LITE(0x0c00, DoSyscall)
435
436 /* Auxillary Processor Unavailable Interrupt */
437 EXCEPTION(0x2020, AuxillaryProcessorUnavailable, UnknownException, EXC_XFER_EE)
438
439 /* Decrementer Interrupt */
440 DECREMENTER_EXCEPTION
441
442 /* Fixed Internal Timer Interrupt */
443 /* TODO: Add FIT support */
444 EXCEPTION(0x1010, FixedIntervalTimer, UnknownException, EXC_XFER_EE)
445
446 /* Watchdog Timer Interrupt */
447 /* TODO: Add watchdog support */
448 CRITICAL_EXCEPTION(0x1020, WatchdogTimer, UnknownException)
449
450 /* Data TLB Error Interrupt */
451 START_EXCEPTION(DataTLBError)
452 mtspr SPRN_SPRG0, r10 /* Save some working registers */
453 mtspr SPRN_SPRG1, r11
454 mtspr SPRN_SPRG4W, r12
455 mtspr SPRN_SPRG5W, r13
456 mfcr r11
457 mtspr SPRN_SPRG7W, r11
458 mfspr r10, SPRN_DEAR /* Get faulting address */
459
460 /* If we are faulting a kernel address, we have to use the
461 * kernel page tables.
462 */
463 andis. r11, r10, 0x8000
464 beq 3f
465 lis r11, swapper_pg_dir@h
466 ori r11, r11, swapper_pg_dir@l
467
468 mfspr r12,SPRN_MMUCR
469 rlwinm r12,r12,0,0,23 /* Clear TID */
470
471 b 4f
472
473 /* Get the PGD for the current thread */
4743:
475 mfspr r11,SPRN_SPRG3
476 lwz r11,PGDIR(r11)
477
478 /* Load PID into MMUCR TID */
479 mfspr r12,SPRN_MMUCR
480 mfspr r13,SPRN_PID /* Get PID */
481 rlwimi r12,r13,0,24,31 /* Set TID */
482
4834:
484 mtspr SPRN_MMUCR,r12
485
486 rlwinm r12, r10, 13, 19, 29 /* Compute pgdir/pmd offset */
487 lwzx r11, r12, r11 /* Get pgd/pmd entry */
488 rlwinm. r12, r11, 0, 0, 20 /* Extract pt base address */
489 beq 2f /* Bail if no table */
490
491 rlwimi r12, r10, 23, 20, 28 /* Compute pte address */
492 lwz r11, 4(r12) /* Get pte entry */
493 andi. r13, r11, _PAGE_PRESENT /* Is the page present? */
494 beq 2f /* Bail if not present */
495
496 ori r11, r11, _PAGE_ACCESSED
497 stw r11, 4(r12)
498
499 /* Jump to common tlb load */
500 b finish_tlb_load
501
5022:
503 /* The bailout. Restore registers to pre-exception conditions
504 * and call the heavyweights to help us out.
505 */
506 mfspr r11, SPRN_SPRG7R
507 mtcr r11
508 mfspr r13, SPRN_SPRG5R
509 mfspr r12, SPRN_SPRG4R
510 mfspr r11, SPRN_SPRG1
511 mfspr r10, SPRN_SPRG0
512 b data_access
513
514 /* Instruction TLB Error Interrupt */
515 /*
516 * Nearly the same as above, except we get our
517 * information from different registers and bailout
518 * to a different point.
519 */
520 START_EXCEPTION(InstructionTLBError)
521 mtspr SPRN_SPRG0, r10 /* Save some working registers */
522 mtspr SPRN_SPRG1, r11
523 mtspr SPRN_SPRG4W, r12
524 mtspr SPRN_SPRG5W, r13
525 mfcr r11
526 mtspr SPRN_SPRG7W, r11
527 mfspr r10, SPRN_SRR0 /* Get faulting address */
528
529 /* If we are faulting a kernel address, we have to use the
530 * kernel page tables.
531 */
532 andis. r11, r10, 0x8000
533 beq 3f
534 lis r11, swapper_pg_dir@h
535 ori r11, r11, swapper_pg_dir@l
536
537 mfspr r12,SPRN_MMUCR
538 rlwinm r12,r12,0,0,23 /* Clear TID */
539
540 b 4f
541
542 /* Get the PGD for the current thread */
5433:
544 mfspr r11,SPRN_SPRG3
545 lwz r11,PGDIR(r11)
546
547 /* Load PID into MMUCR TID */
548 mfspr r12,SPRN_MMUCR
549 mfspr r13,SPRN_PID /* Get PID */
550 rlwimi r12,r13,0,24,31 /* Set TID */
551
5524:
553 mtspr SPRN_MMUCR,r12
554
555 rlwinm r12, r10, 13, 19, 29 /* Compute pgdir/pmd offset */
556 lwzx r11, r12, r11 /* Get pgd/pmd entry */
557 rlwinm. r12, r11, 0, 0, 20 /* Extract pt base address */
558 beq 2f /* Bail if no table */
559
560 rlwimi r12, r10, 23, 20, 28 /* Compute pte address */
561 lwz r11, 4(r12) /* Get pte entry */
562 andi. r13, r11, _PAGE_PRESENT /* Is the page present? */
563 beq 2f /* Bail if not present */
564
565 ori r11, r11, _PAGE_ACCESSED
566 stw r11, 4(r12)
567
568 /* Jump to common TLB load point */
569 b finish_tlb_load
570
5712:
572 /* The bailout. Restore registers to pre-exception conditions
573 * and call the heavyweights to help us out.
574 */
575 mfspr r11, SPRN_SPRG7R
576 mtcr r11
577 mfspr r13, SPRN_SPRG5R
578 mfspr r12, SPRN_SPRG4R
579 mfspr r11, SPRN_SPRG1
580 mfspr r10, SPRN_SPRG0
581 b InstructionStorage
582
583 /* Debug Interrupt */
584 DEBUG_EXCEPTION
585
586/*
587 * Local functions
588 */
589 /*
590 * Data TLB exceptions will bail out to this point
591 * if they can't resolve the lightweight TLB fault.
592 */
593data_access:
594 NORMAL_EXCEPTION_PROLOG
595 mfspr r5,SPRN_ESR /* Grab the ESR, save it, pass arg3 */
596 stw r5,_ESR(r11)
597 mfspr r4,SPRN_DEAR /* Grab the DEAR, save it, pass arg2 */
598 EXC_XFER_EE_LITE(0x0300, handle_page_fault)
599
600/*
601
602 * Both the instruction and data TLB miss get to this
603 * point to load the TLB.
604 * r10 - EA of fault
605 * r11 - available to use
606 * r12 - Pointer to the 64-bit PTE
607 * r13 - available to use
608 * MMUCR - loaded with proper value when we get here
609 * Upon exit, we reload everything and RFI.
610 */
611finish_tlb_load:
612 /*
613 * We set execute, because we don't have the granularity to
614 * properly set this at the page level (Linux problem).
615 * If shared is set, we cause a zero PID->TID load.
616 * Many of these bits are software only. Bits we don't set
617 * here we (properly should) assume have the appropriate value.
618 */
619
620 /* Load the next available TLB index */
621 lis r13, tlb_44x_index@ha
622 lwz r13, tlb_44x_index@l(r13)
623 /* Load the TLB high watermark */
624 lis r11, tlb_44x_hwater@ha
625 lwz r11, tlb_44x_hwater@l(r11)
626
627 /* Increment, rollover, and store TLB index */
628 addi r13, r13, 1
629 cmpw 0, r13, r11 /* reserve entries */
630 ble 7f
631 li r13, 0
6327:
633 /* Store the next available TLB index */
634 lis r11, tlb_44x_index@ha
635 stw r13, tlb_44x_index@l(r11)
636
637 lwz r11, 0(r12) /* Get MS word of PTE */
638 lwz r12, 4(r12) /* Get LS word of PTE */
639 rlwimi r11, r12, 0, 0 , 19 /* Insert RPN */
640 tlbwe r11, r13, PPC44x_TLB_XLAT /* Write XLAT */
641
642 /*
643 * Create PAGEID. This is the faulting address,
644 * page size, and valid flag.
645 */
646 li r11, PPC44x_TLB_VALID | PPC44x_TLB_4K
647 rlwimi r10, r11, 0, 20, 31 /* Insert valid and page size */
648 tlbwe r10, r13, PPC44x_TLB_PAGEID /* Write PAGEID */
649
650 li r10, PPC44x_TLB_SR@l /* Set SR */
651 rlwimi r10, r12, 0, 30, 30 /* Set SW = _PAGE_RW */
652 rlwimi r10, r12, 29, 29, 29 /* SX = _PAGE_HWEXEC */
653 rlwimi r10, r12, 29, 28, 28 /* UR = _PAGE_USER */
654 rlwimi r11, r12, 31, 26, 26 /* (_PAGE_USER>>1)->r12 */
655 and r11, r12, r11 /* HWEXEC & USER */
656 rlwimi r10, r11, 0, 26, 26 /* UX = HWEXEC & USER */
657
658 rlwimi r12, r10, 0, 26, 31 /* Insert static perms */
659 rlwinm r12, r12, 0, 20, 15 /* Clear U0-U3 */
660 tlbwe r12, r13, PPC44x_TLB_ATTRIB /* Write ATTRIB */
661
662 /* Done...restore registers and get out of here.
663 */
664 mfspr r11, SPRN_SPRG7R
665 mtcr r11
666 mfspr r13, SPRN_SPRG5R
667 mfspr r12, SPRN_SPRG4R
668 mfspr r11, SPRN_SPRG1
669 mfspr r10, SPRN_SPRG0
670 rfi /* Force context change */
671
672/*
673 * Global functions
674 */
675
676/*
677 * extern void giveup_altivec(struct task_struct *prev)
678 *
679 * The 44x core does not have an AltiVec unit.
680 */
681_GLOBAL(giveup_altivec)
682 blr
683
684/*
685 * extern void giveup_fpu(struct task_struct *prev)
686 *
687 * The 44x core does not have an FPU.
688 */
689_GLOBAL(giveup_fpu)
690 blr
691
692/*
693 * extern void abort(void)
694 *
695 * At present, this routine just applies a system reset.
696 */
697_GLOBAL(abort)
698 mfspr r13,SPRN_DBCR0
699 oris r13,r13,DBCR0_RST_SYSTEM@h
700 mtspr SPRN_DBCR0,r13
701
702_GLOBAL(set_context)
703
704#ifdef CONFIG_BDI_SWITCH
705 /* Context switch the PTE pointer for the Abatron BDI2000.
706 * The PGDIR is the second parameter.
707 */
708 lis r5, abatron_pteptrs@h
709 ori r5, r5, abatron_pteptrs@l
710 stw r4, 0x4(r5)
711#endif
712 mtspr SPRN_PID,r3
713 isync /* Force context change */
714 blr
715
716/*
717 * We put a few things here that have to be page-aligned. This stuff
718 * goes at the beginning of the data segment, which is page-aligned.
719 */
720 .data
721_GLOBAL(sdata)
722_GLOBAL(empty_zero_page)
723 .space 4096
724
725/*
726 * To support >32-bit physical addresses, we use an 8KB pgdir.
727 */
728_GLOBAL(swapper_pg_dir)
729 .space 8192
730
731/* Reserved 4k for the critical exception stack & 4k for the machine
732 * check stack per CPU for kernel mode exceptions */
733 .section .bss
734 .align 12
735exception_stack_bottom:
736 .space BOOKE_EXCEPTION_STACK_SIZE
737_GLOBAL(exception_stack_top)
738
739/*
740 * This space gets a copy of optional info passed to us by the bootstrap
741 * which is used to pass parameters into the kernel like root=/dev/sda1, etc.
742 */
743_GLOBAL(cmd_line)
744 .space 512
745
746/*
747 * Room for two PTE pointers, usually the kernel and current user pointers
748 * to their respective root page table.
749 */
750abatron_pteptrs:
751 .space 8
752
753
diff --git a/arch/ppc/kernel/head_4xx.S b/arch/ppc/kernel/head_4xx.S
new file mode 100644
index 000000000000..6f5d380e2345
--- /dev/null
+++ b/arch/ppc/kernel/head_4xx.S
@@ -0,0 +1,1010 @@
1/*
2 * Copyright (c) 1995-1996 Gary Thomas <gdt@linuxppc.org>
3 * Initial PowerPC version.
4 * Copyright (c) 1996 Cort Dougan <cort@cs.nmt.edu>
5 * Rewritten for PReP
6 * Copyright (c) 1996 Paul Mackerras <paulus@cs.anu.edu.au>
7 * Low-level exception handers, MMU support, and rewrite.
8 * Copyright (c) 1997 Dan Malek <dmalek@jlc.net>
9 * PowerPC 8xx modifications.
10 * Copyright (c) 1998-1999 TiVo, Inc.
11 * PowerPC 403GCX modifications.
12 * Copyright (c) 1999 Grant Erickson <grant@lcse.umn.edu>
13 * PowerPC 403GCX/405GP modifications.
14 * Copyright 2000 MontaVista Software Inc.
15 * PPC405 modifications
16 * PowerPC 403GCX/405GP modifications.
17 * Author: MontaVista Software, Inc.
18 * frank_rowand@mvista.com or source@mvista.com
19 * debbie_chu@mvista.com
20 *
21 *
22 * Module name: head_4xx.S
23 *
24 * Description:
25 * Kernel execution entry point code.
26 *
27 * This program is free software; you can redistribute it and/or
28 * modify it under the terms of the GNU General Public License
29 * as published by the Free Software Foundation; either version
30 * 2 of the License, or (at your option) any later version.
31 *
32 */
33
34#include <linux/config.h>
35#include <asm/processor.h>
36#include <asm/page.h>
37#include <asm/mmu.h>
38#include <asm/pgtable.h>
39#include <asm/ibm4xx.h>
40#include <asm/cputable.h>
41#include <asm/thread_info.h>
42#include <asm/ppc_asm.h>
43#include <asm/offsets.h>
44
45/* As with the other PowerPC ports, it is expected that when code
46 * execution begins here, the following registers contain valid, yet
47 * optional, information:
48 *
49 * r3 - Board info structure pointer (DRAM, frequency, MAC address, etc.)
50 * r4 - Starting address of the init RAM disk
51 * r5 - Ending address of the init RAM disk
52 * r6 - Start of kernel command line string (e.g. "mem=96m")
53 * r7 - End of kernel command line string
54 *
55 * This is all going to change RSN when we add bi_recs....... -- Dan
56 */
57 .text
58_GLOBAL(_stext)
59_GLOBAL(_start)
60
61 /* Save parameters we are passed.
62 */
63 mr r31,r3
64 mr r30,r4
65 mr r29,r5
66 mr r28,r6
67 mr r27,r7
68
69 /* We have to turn on the MMU right away so we get cache modes
70 * set correctly.
71 */
72 bl initial_mmu
73
74/* We now have the lower 16 Meg mapped into TLB entries, and the caches
75 * ready to work.
76 */
77turn_on_mmu:
78 lis r0,MSR_KERNEL@h
79 ori r0,r0,MSR_KERNEL@l
80 mtspr SPRN_SRR1,r0
81 lis r0,start_here@h
82 ori r0,r0,start_here@l
83 mtspr SPRN_SRR0,r0
84 SYNC
85 rfi /* enables MMU */
86 b . /* prevent prefetch past rfi */
87
88/*
89 * This area is used for temporarily saving registers during the
90 * critical exception prolog.
91 */
92 . = 0xc0
93crit_save:
94_GLOBAL(crit_r10)
95 .space 4
96_GLOBAL(crit_r11)
97 .space 4
98
99/*
100 * Exception vector entry code. This code runs with address translation
101 * turned off (i.e. using physical addresses). We assume SPRG3 has the
102 * physical address of the current task thread_struct.
103 * Note that we have to have decremented r1 before we write to any fields
104 * of the exception frame, since a critical interrupt could occur at any
105 * time, and it will write to the area immediately below the current r1.
106 */
107#define NORMAL_EXCEPTION_PROLOG \
108 mtspr SPRN_SPRG0,r10; /* save two registers to work with */\
109 mtspr SPRN_SPRG1,r11; \
110 mtspr SPRN_SPRG2,r1; \
111 mfcr r10; /* save CR in r10 for now */\
112 mfspr r11,SPRN_SRR1; /* check whether user or kernel */\
113 andi. r11,r11,MSR_PR; \
114 beq 1f; \
115 mfspr r1,SPRN_SPRG3; /* if from user, start at top of */\
116 lwz r1,THREAD_INFO-THREAD(r1); /* this thread's kernel stack */\
117 addi r1,r1,THREAD_SIZE; \
1181: subi r1,r1,INT_FRAME_SIZE; /* Allocate an exception frame */\
119 tophys(r11,r1); \
120 stw r10,_CCR(r11); /* save various registers */\
121 stw r12,GPR12(r11); \
122 stw r9,GPR9(r11); \
123 mfspr r10,SPRN_SPRG0; \
124 stw r10,GPR10(r11); \
125 mfspr r12,SPRN_SPRG1; \
126 stw r12,GPR11(r11); \
127 mflr r10; \
128 stw r10,_LINK(r11); \
129 mfspr r10,SPRN_SPRG2; \
130 mfspr r12,SPRN_SRR0; \
131 stw r10,GPR1(r11); \
132 mfspr r9,SPRN_SRR1; \
133 stw r10,0(r11); \
134 rlwinm r9,r9,0,14,12; /* clear MSR_WE (necessary?) */\
135 stw r0,GPR0(r11); \
136 SAVE_4GPRS(3, r11); \
137 SAVE_2GPRS(7, r11)
138
139/*
140 * Exception prolog for critical exceptions. This is a little different
141 * from the normal exception prolog above since a critical exception
142 * can potentially occur at any point during normal exception processing.
143 * Thus we cannot use the same SPRG registers as the normal prolog above.
144 * Instead we use a couple of words of memory at low physical addresses.
145 * This is OK since we don't support SMP on these processors.
146 */
147#define CRITICAL_EXCEPTION_PROLOG \
148 stw r10,crit_r10@l(0); /* save two registers to work with */\
149 stw r11,crit_r11@l(0); \
150 mfcr r10; /* save CR in r10 for now */\
151 mfspr r11,SPRN_SRR3; /* check whether user or kernel */\
152 andi. r11,r11,MSR_PR; \
153 lis r11,critical_stack_top@h; \
154 ori r11,r11,critical_stack_top@l; \
155 beq 1f; \
156 /* COMING FROM USER MODE */ \
157 mfspr r11,SPRN_SPRG3; /* if from user, start at top of */\
158 lwz r11,THREAD_INFO-THREAD(r11); /* this thread's kernel stack */\
159 addi r11,r11,THREAD_SIZE; \
1601: subi r11,r11,INT_FRAME_SIZE; /* Allocate an exception frame */\
161 tophys(r11,r11); \
162 stw r10,_CCR(r11); /* save various registers */\
163 stw r12,GPR12(r11); \
164 stw r9,GPR9(r11); \
165 mflr r10; \
166 stw r10,_LINK(r11); \
167 mfspr r12,SPRN_DEAR; /* save DEAR and ESR in the frame */\
168 stw r12,_DEAR(r11); /* since they may have had stuff */\
169 mfspr r9,SPRN_ESR; /* in them at the point where the */\
170 stw r9,_ESR(r11); /* exception was taken */\
171 mfspr r12,SPRN_SRR2; \
172 stw r1,GPR1(r11); \
173 mfspr r9,SPRN_SRR3; \
174 stw r1,0(r11); \
175 tovirt(r1,r11); \
176 rlwinm r9,r9,0,14,12; /* clear MSR_WE (necessary?) */\
177 stw r0,GPR0(r11); \
178 SAVE_4GPRS(3, r11); \
179 SAVE_2GPRS(7, r11)
180
181 /*
182 * State at this point:
183 * r9 saved in stack frame, now saved SRR3 & ~MSR_WE
184 * r10 saved in crit_r10 and in stack frame, trashed
185 * r11 saved in crit_r11 and in stack frame,
186 * now phys stack/exception frame pointer
187 * r12 saved in stack frame, now saved SRR2
188 * CR saved in stack frame, CR0.EQ = !SRR3.PR
189 * LR, DEAR, ESR in stack frame
190 * r1 saved in stack frame, now virt stack/excframe pointer
191 * r0, r3-r8 saved in stack frame
192 */
193
194/*
195 * Exception vectors.
196 */
197#define START_EXCEPTION(n, label) \
198 . = n; \
199label:
200
201#define EXCEPTION(n, label, hdlr, xfer) \
202 START_EXCEPTION(n, label); \
203 NORMAL_EXCEPTION_PROLOG; \
204 addi r3,r1,STACK_FRAME_OVERHEAD; \
205 xfer(n, hdlr)
206
207#define CRITICAL_EXCEPTION(n, label, hdlr) \
208 START_EXCEPTION(n, label); \
209 CRITICAL_EXCEPTION_PROLOG; \
210 addi r3,r1,STACK_FRAME_OVERHEAD; \
211 EXC_XFER_TEMPLATE(hdlr, n+2, (MSR_KERNEL & ~(MSR_ME|MSR_DE|MSR_CE)), \
212 NOCOPY, crit_transfer_to_handler, \
213 ret_from_crit_exc)
214
215#define EXC_XFER_TEMPLATE(hdlr, trap, msr, copyee, tfer, ret) \
216 li r10,trap; \
217 stw r10,TRAP(r11); \
218 lis r10,msr@h; \
219 ori r10,r10,msr@l; \
220 copyee(r10, r9); \
221 bl tfer; \
222 .long hdlr; \
223 .long ret
224
225#define COPY_EE(d, s) rlwimi d,s,0,16,16
226#define NOCOPY(d, s)
227
228#define EXC_XFER_STD(n, hdlr) \
229 EXC_XFER_TEMPLATE(hdlr, n, MSR_KERNEL, NOCOPY, transfer_to_handler_full, \
230 ret_from_except_full)
231
232#define EXC_XFER_LITE(n, hdlr) \
233 EXC_XFER_TEMPLATE(hdlr, n+1, MSR_KERNEL, NOCOPY, transfer_to_handler, \
234 ret_from_except)
235
236#define EXC_XFER_EE(n, hdlr) \
237 EXC_XFER_TEMPLATE(hdlr, n, MSR_KERNEL, COPY_EE, transfer_to_handler_full, \
238 ret_from_except_full)
239
240#define EXC_XFER_EE_LITE(n, hdlr) \
241 EXC_XFER_TEMPLATE(hdlr, n+1, MSR_KERNEL, COPY_EE, transfer_to_handler, \
242 ret_from_except)
243
244
245/*
246 * 0x0100 - Critical Interrupt Exception
247 */
248 CRITICAL_EXCEPTION(0x0100, CriticalInterrupt, UnknownException)
249
250/*
251 * 0x0200 - Machine Check Exception
252 */
253 CRITICAL_EXCEPTION(0x0200, MachineCheck, MachineCheckException)
254
255/*
256 * 0x0300 - Data Storage Exception
257 * This happens for just a few reasons. U0 set (but we don't do that),
258 * or zone protection fault (user violation, write to protected page).
259 * If this is just an update of modified status, we do that quickly
260 * and exit. Otherwise, we call heavywight functions to do the work.
261 */
262 START_EXCEPTION(0x0300, DataStorage)
263 mtspr SPRN_SPRG0, r10 /* Save some working registers */
264 mtspr SPRN_SPRG1, r11
265#ifdef CONFIG_403GCX
266 stw r12, 0(r0)
267 stw r9, 4(r0)
268 mfcr r11
269 mfspr r12, SPRN_PID
270 stw r11, 8(r0)
271 stw r12, 12(r0)
272#else
273 mtspr SPRN_SPRG4, r12
274 mtspr SPRN_SPRG5, r9
275 mfcr r11
276 mfspr r12, SPRN_PID
277 mtspr SPRN_SPRG7, r11
278 mtspr SPRN_SPRG6, r12
279#endif
280
281 /* First, check if it was a zone fault (which means a user
282 * tried to access a kernel or read-protected page - always
283 * a SEGV). All other faults here must be stores, so no
284 * need to check ESR_DST as well. */
285 mfspr r10, SPRN_ESR
286 andis. r10, r10, ESR_DIZ@h
287 bne 2f
288
289 mfspr r10, SPRN_DEAR /* Get faulting address */
290
291 /* If we are faulting a kernel address, we have to use the
292 * kernel page tables.
293 */
294 andis. r11, r10, 0x8000
295 beq 3f
296 lis r11, swapper_pg_dir@h
297 ori r11, r11, swapper_pg_dir@l
298 li r9, 0
299 mtspr SPRN_PID, r9 /* TLB will have 0 TID */
300 b 4f
301
302 /* Get the PGD for the current thread.
303 */
3043:
305 mfspr r11,SPRN_SPRG3
306 lwz r11,PGDIR(r11)
3074:
308 tophys(r11, r11)
309 rlwimi r11, r10, 12, 20, 29 /* Create L1 (pgdir/pmd) address */
310 lwz r11, 0(r11) /* Get L1 entry */
311 rlwinm. r12, r11, 0, 0, 19 /* Extract L2 (pte) base address */
312 beq 2f /* Bail if no table */
313
314 rlwimi r12, r10, 22, 20, 29 /* Compute PTE address */
315 lwz r11, 0(r12) /* Get Linux PTE */
316
317 andi. r9, r11, _PAGE_RW /* Is it writeable? */
318 beq 2f /* Bail if not */
319
320 /* Update 'changed'.
321 */
322 ori r11, r11, _PAGE_DIRTY|_PAGE_ACCESSED|_PAGE_HWWRITE
323 stw r11, 0(r12) /* Update Linux page table */
324
325 /* Most of the Linux PTE is ready to load into the TLB LO.
326 * We set ZSEL, where only the LS-bit determines user access.
327 * We set execute, because we don't have the granularity to
328 * properly set this at the page level (Linux problem).
329 * If shared is set, we cause a zero PID->TID load.
330 * Many of these bits are software only. Bits we don't set
331 * here we (properly should) assume have the appropriate value.
332 */
333 li r12, 0x0ce2
334 andc r11, r11, r12 /* Make sure 20, 21 are zero */
335
336 /* find the TLB index that caused the fault. It has to be here.
337 */
338 tlbsx r9, 0, r10
339
340 tlbwe r11, r9, TLB_DATA /* Load TLB LO */
341
342 /* Done...restore registers and get out of here.
343 */
344#ifdef CONFIG_403GCX
345 lwz r12, 12(r0)
346 lwz r11, 8(r0)
347 mtspr SPRN_PID, r12
348 mtcr r11
349 lwz r9, 4(r0)
350 lwz r12, 0(r0)
351#else
352 mfspr r12, SPRN_SPRG6
353 mfspr r11, SPRN_SPRG7
354 mtspr SPRN_PID, r12
355 mtcr r11
356 mfspr r9, SPRN_SPRG5
357 mfspr r12, SPRN_SPRG4
358#endif
359 mfspr r11, SPRN_SPRG1
360 mfspr r10, SPRN_SPRG0
361 PPC405_ERR77_SYNC
362 rfi /* Should sync shadow TLBs */
363 b . /* prevent prefetch past rfi */
364
3652:
366 /* The bailout. Restore registers to pre-exception conditions
367 * and call the heavyweights to help us out.
368 */
369#ifdef CONFIG_403GCX
370 lwz r12, 12(r0)
371 lwz r11, 8(r0)
372 mtspr SPRN_PID, r12
373 mtcr r11
374 lwz r9, 4(r0)
375 lwz r12, 0(r0)
376#else
377 mfspr r12, SPRN_SPRG6
378 mfspr r11, SPRN_SPRG7
379 mtspr SPRN_PID, r12
380 mtcr r11
381 mfspr r9, SPRN_SPRG5
382 mfspr r12, SPRN_SPRG4
383#endif
384 mfspr r11, SPRN_SPRG1
385 mfspr r10, SPRN_SPRG0
386 b DataAccess
387
388/*
389 * 0x0400 - Instruction Storage Exception
390 * This is caused by a fetch from non-execute or guarded pages.
391 */
392 START_EXCEPTION(0x0400, InstructionAccess)
393 NORMAL_EXCEPTION_PROLOG
394 mr r4,r12 /* Pass SRR0 as arg2 */
395 li r5,0 /* Pass zero as arg3 */
396 EXC_XFER_EE_LITE(0x400, handle_page_fault)
397
398/* 0x0500 - External Interrupt Exception */
399 EXCEPTION(0x0500, HardwareInterrupt, do_IRQ, EXC_XFER_LITE)
400
401/* 0x0600 - Alignment Exception */
402 START_EXCEPTION(0x0600, Alignment)
403 NORMAL_EXCEPTION_PROLOG
404 mfspr r4,SPRN_DEAR /* Grab the DEAR and save it */
405 stw r4,_DEAR(r11)
406 addi r3,r1,STACK_FRAME_OVERHEAD
407 EXC_XFER_EE(0x600, AlignmentException)
408
409/* 0x0700 - Program Exception */
410 START_EXCEPTION(0x0700, ProgramCheck)
411 NORMAL_EXCEPTION_PROLOG
412 mfspr r4,SPRN_ESR /* Grab the ESR and save it */
413 stw r4,_ESR(r11)
414 addi r3,r1,STACK_FRAME_OVERHEAD
415 EXC_XFER_STD(0x700, ProgramCheckException)
416
417 EXCEPTION(0x0800, Trap_08, UnknownException, EXC_XFER_EE)
418 EXCEPTION(0x0900, Trap_09, UnknownException, EXC_XFER_EE)
419 EXCEPTION(0x0A00, Trap_0A, UnknownException, EXC_XFER_EE)
420 EXCEPTION(0x0B00, Trap_0B, UnknownException, EXC_XFER_EE)
421
422/* 0x0C00 - System Call Exception */
423 START_EXCEPTION(0x0C00, SystemCall)
424 NORMAL_EXCEPTION_PROLOG
425 EXC_XFER_EE_LITE(0xc00, DoSyscall)
426
427 EXCEPTION(0x0D00, Trap_0D, UnknownException, EXC_XFER_EE)
428 EXCEPTION(0x0E00, Trap_0E, UnknownException, EXC_XFER_EE)
429 EXCEPTION(0x0F00, Trap_0F, UnknownException, EXC_XFER_EE)
430
431/* 0x1000 - Programmable Interval Timer (PIT) Exception */
432 START_EXCEPTION(0x1000, Decrementer)
433 NORMAL_EXCEPTION_PROLOG
434 lis r0,TSR_PIS@h
435 mtspr SPRN_TSR,r0 /* Clear the PIT exception */
436 addi r3,r1,STACK_FRAME_OVERHEAD
437 EXC_XFER_LITE(0x1000, timer_interrupt)
438
439#if 0
440/* NOTE:
441 * FIT and WDT handlers are not implemented yet.
442 */
443
444/* 0x1010 - Fixed Interval Timer (FIT) Exception
445*/
446 STND_EXCEPTION(0x1010, FITException, UnknownException)
447
448/* 0x1020 - Watchdog Timer (WDT) Exception
449*/
450
451 CRITICAL_EXCEPTION(0x1020, WDTException, UnknownException)
452#endif
453
454/* 0x1100 - Data TLB Miss Exception
455 * As the name implies, translation is not in the MMU, so search the
456 * page tables and fix it. The only purpose of this function is to
457 * load TLB entries from the page table if they exist.
458 */
459 START_EXCEPTION(0x1100, DTLBMiss)
460 mtspr SPRN_SPRG0, r10 /* Save some working registers */
461 mtspr SPRN_SPRG1, r11
462#ifdef CONFIG_403GCX
463 stw r12, 0(r0)
464 stw r9, 4(r0)
465 mfcr r11
466 mfspr r12, SPRN_PID
467 stw r11, 8(r0)
468 stw r12, 12(r0)
469#else
470 mtspr SPRN_SPRG4, r12
471 mtspr SPRN_SPRG5, r9
472 mfcr r11
473 mfspr r12, SPRN_PID
474 mtspr SPRN_SPRG7, r11
475 mtspr SPRN_SPRG6, r12
476#endif
477 mfspr r10, SPRN_DEAR /* Get faulting address */
478
479 /* If we are faulting a kernel address, we have to use the
480 * kernel page tables.
481 */
482 andis. r11, r10, 0x8000
483 beq 3f
484 lis r11, swapper_pg_dir@h
485 ori r11, r11, swapper_pg_dir@l
486 li r9, 0
487 mtspr SPRN_PID, r9 /* TLB will have 0 TID */
488 b 4f
489
490 /* Get the PGD for the current thread.
491 */
4923:
493 mfspr r11,SPRN_SPRG3
494 lwz r11,PGDIR(r11)
4954:
496 tophys(r11, r11)
497 rlwimi r11, r10, 12, 20, 29 /* Create L1 (pgdir/pmd) address */
498 lwz r12, 0(r11) /* Get L1 entry */
499 andi. r9, r12, _PMD_PRESENT /* Check if it points to a PTE page */
500 beq 2f /* Bail if no table */
501
502 rlwimi r12, r10, 22, 20, 29 /* Compute PTE address */
503 lwz r11, 0(r12) /* Get Linux PTE */
504 andi. r9, r11, _PAGE_PRESENT
505 beq 5f
506
507 ori r11, r11, _PAGE_ACCESSED
508 stw r11, 0(r12)
509
510 /* Create TLB tag. This is the faulting address plus a static
511 * set of bits. These are size, valid, E, U0.
512 */
513 li r12, 0x00c0
514 rlwimi r10, r12, 0, 20, 31
515
516 b finish_tlb_load
517
5182: /* Check for possible large-page pmd entry */
519 rlwinm. r9, r12, 2, 22, 24
520 beq 5f
521
522 /* Create TLB tag. This is the faulting address, plus a static
523 * set of bits (valid, E, U0) plus the size from the PMD.
524 */
525 ori r9, r9, 0x40
526 rlwimi r10, r9, 0, 20, 31
527 mr r11, r12
528
529 b finish_tlb_load
530
5315:
532 /* The bailout. Restore registers to pre-exception conditions
533 * and call the heavyweights to help us out.
534 */
535#ifdef CONFIG_403GCX
536 lwz r12, 12(r0)
537 lwz r11, 8(r0)
538 mtspr SPRN_PID, r12
539 mtcr r11
540 lwz r9, 4(r0)
541 lwz r12, 0(r0)
542#else
543 mfspr r12, SPRN_SPRG6
544 mfspr r11, SPRN_SPRG7
545 mtspr SPRN_PID, r12
546 mtcr r11
547 mfspr r9, SPRN_SPRG5
548 mfspr r12, SPRN_SPRG4
549#endif
550 mfspr r11, SPRN_SPRG1
551 mfspr r10, SPRN_SPRG0
552 b DataAccess
553
554/* 0x1200 - Instruction TLB Miss Exception
555 * Nearly the same as above, except we get our information from different
556 * registers and bailout to a different point.
557 */
558 START_EXCEPTION(0x1200, ITLBMiss)
559 mtspr SPRN_SPRG0, r10 /* Save some working registers */
560 mtspr SPRN_SPRG1, r11
561#ifdef CONFIG_403GCX
562 stw r12, 0(r0)
563 stw r9, 4(r0)
564 mfcr r11
565 mfspr r12, SPRN_PID
566 stw r11, 8(r0)
567 stw r12, 12(r0)
568#else
569 mtspr SPRN_SPRG4, r12
570 mtspr SPRN_SPRG5, r9
571 mfcr r11
572 mfspr r12, SPRN_PID
573 mtspr SPRN_SPRG7, r11
574 mtspr SPRN_SPRG6, r12
575#endif
576 mfspr r10, SPRN_SRR0 /* Get faulting address */
577
578 /* If we are faulting a kernel address, we have to use the
579 * kernel page tables.
580 */
581 andis. r11, r10, 0x8000
582 beq 3f
583 lis r11, swapper_pg_dir@h
584 ori r11, r11, swapper_pg_dir@l
585 li r9, 0
586 mtspr SPRN_PID, r9 /* TLB will have 0 TID */
587 b 4f
588
589 /* Get the PGD for the current thread.
590 */
5913:
592 mfspr r11,SPRN_SPRG3
593 lwz r11,PGDIR(r11)
5944:
595 tophys(r11, r11)
596 rlwimi r11, r10, 12, 20, 29 /* Create L1 (pgdir/pmd) address */
597 lwz r12, 0(r11) /* Get L1 entry */
598 andi. r9, r12, _PMD_PRESENT /* Check if it points to a PTE page */
599 beq 2f /* Bail if no table */
600
601 rlwimi r12, r10, 22, 20, 29 /* Compute PTE address */
602 lwz r11, 0(r12) /* Get Linux PTE */
603 andi. r9, r11, _PAGE_PRESENT
604 beq 5f
605
606 ori r11, r11, _PAGE_ACCESSED
607 stw r11, 0(r12)
608
609 /* Create TLB tag. This is the faulting address plus a static
610 * set of bits. These are size, valid, E, U0.
611 */
612 li r12, 0x00c0
613 rlwimi r10, r12, 0, 20, 31
614
615 b finish_tlb_load
616
6172: /* Check for possible large-page pmd entry */
618 rlwinm. r9, r12, 2, 22, 24
619 beq 5f
620
621 /* Create TLB tag. This is the faulting address, plus a static
622 * set of bits (valid, E, U0) plus the size from the PMD.
623 */
624 ori r9, r9, 0x40
625 rlwimi r10, r9, 0, 20, 31
626 mr r11, r12
627
628 b finish_tlb_load
629
6305:
631 /* The bailout. Restore registers to pre-exception conditions
632 * and call the heavyweights to help us out.
633 */
634#ifdef CONFIG_403GCX
635 lwz r12, 12(r0)
636 lwz r11, 8(r0)
637 mtspr SPRN_PID, r12
638 mtcr r11
639 lwz r9, 4(r0)
640 lwz r12, 0(r0)
641#else
642 mfspr r12, SPRN_SPRG6
643 mfspr r11, SPRN_SPRG7
644 mtspr SPRN_PID, r12
645 mtcr r11
646 mfspr r9, SPRN_SPRG5
647 mfspr r12, SPRN_SPRG4
648#endif
649 mfspr r11, SPRN_SPRG1
650 mfspr r10, SPRN_SPRG0
651 b InstructionAccess
652
653 EXCEPTION(0x1300, Trap_13, UnknownException, EXC_XFER_EE)
654 EXCEPTION(0x1400, Trap_14, UnknownException, EXC_XFER_EE)
655 EXCEPTION(0x1500, Trap_15, UnknownException, EXC_XFER_EE)
656 EXCEPTION(0x1600, Trap_16, UnknownException, EXC_XFER_EE)
657#ifdef CONFIG_IBM405_ERR51
658 /* 405GP errata 51 */
659 START_EXCEPTION(0x1700, Trap_17)
660 b DTLBMiss
661#else
662 EXCEPTION(0x1700, Trap_17, UnknownException, EXC_XFER_EE)
663#endif
664 EXCEPTION(0x1800, Trap_18, UnknownException, EXC_XFER_EE)
665 EXCEPTION(0x1900, Trap_19, UnknownException, EXC_XFER_EE)
666 EXCEPTION(0x1A00, Trap_1A, UnknownException, EXC_XFER_EE)
667 EXCEPTION(0x1B00, Trap_1B, UnknownException, EXC_XFER_EE)
668 EXCEPTION(0x1C00, Trap_1C, UnknownException, EXC_XFER_EE)
669 EXCEPTION(0x1D00, Trap_1D, UnknownException, EXC_XFER_EE)
670 EXCEPTION(0x1E00, Trap_1E, UnknownException, EXC_XFER_EE)
671 EXCEPTION(0x1F00, Trap_1F, UnknownException, EXC_XFER_EE)
672
673/* Check for a single step debug exception while in an exception
674 * handler before state has been saved. This is to catch the case
675 * where an instruction that we are trying to single step causes
676 * an exception (eg ITLB/DTLB miss) and thus the first instruction of
677 * the exception handler generates a single step debug exception.
678 *
679 * If we get a debug trap on the first instruction of an exception handler,
680 * we reset the MSR_DE in the _exception handler's_ MSR (the debug trap is
681 * a critical exception, so we are using SPRN_CSRR1 to manipulate the MSR).
682 * The exception handler was handling a non-critical interrupt, so it will
683 * save (and later restore) the MSR via SPRN_SRR1, which will still have
684 * the MSR_DE bit set.
685 */
686 /* 0x2000 - Debug Exception */
687 START_EXCEPTION(0x2000, DebugTrap)
688 CRITICAL_EXCEPTION_PROLOG
689
690 /*
691 * If this is a single step or branch-taken exception in an
692 * exception entry sequence, it was probably meant to apply to
693 * the code where the exception occurred (since exception entry
694 * doesn't turn off DE automatically). We simulate the effect
695 * of turning off DE on entry to an exception handler by turning
696 * off DE in the SRR3 value and clearing the debug status.
697 */
698 mfspr r10,SPRN_DBSR /* check single-step/branch taken */
699 andis. r10,r10,DBSR_IC@h
700 beq+ 2f
701
702 andi. r10,r9,MSR_IR|MSR_PR /* check supervisor + MMU off */
703 beq 1f /* branch and fix it up */
704
705 mfspr r10,SPRN_SRR2 /* Faulting instruction address */
706 cmplwi r10,0x2100
707 bgt+ 2f /* address above exception vectors */
708
709 /* here it looks like we got an inappropriate debug exception. */
7101: rlwinm r9,r9,0,~MSR_DE /* clear DE in the SRR3 value */
711 lis r10,DBSR_IC@h /* clear the IC event */
712 mtspr SPRN_DBSR,r10
713 /* restore state and get out */
714 lwz r10,_CCR(r11)
715 lwz r0,GPR0(r11)
716 lwz r1,GPR1(r11)
717 mtcrf 0x80,r10
718 mtspr SPRN_SRR2,r12
719 mtspr SPRN_SRR3,r9
720 lwz r9,GPR9(r11)
721 lwz r12,GPR12(r11)
722 lwz r10,crit_r10@l(0)
723 lwz r11,crit_r11@l(0)
724 PPC405_ERR77_SYNC
725 rfci
726 b .
727
728 /* continue normal handling for a critical exception... */
7292: mfspr r4,SPRN_DBSR
730 addi r3,r1,STACK_FRAME_OVERHEAD
731 EXC_XFER_TEMPLATE(DebugException, 0x2002, \
732 (MSR_KERNEL & ~(MSR_ME|MSR_DE|MSR_CE)), \
733 NOCOPY, crit_transfer_to_handler, ret_from_crit_exc)
734
735/*
736 * The other Data TLB exceptions bail out to this point
737 * if they can't resolve the lightweight TLB fault.
738 */
739DataAccess:
740 NORMAL_EXCEPTION_PROLOG
741 mfspr r5,SPRN_ESR /* Grab the ESR, save it, pass arg3 */
742 stw r5,_ESR(r11)
743 mfspr r4,SPRN_DEAR /* Grab the DEAR, save it, pass arg2 */
744 EXC_XFER_EE_LITE(0x300, handle_page_fault)
745
746/* Other PowerPC processors, namely those derived from the 6xx-series
747 * have vectors from 0x2100 through 0x2F00 defined, but marked as reserved.
748 * However, for the 4xx-series processors these are neither defined nor
749 * reserved.
750 */
751
752 /* Damn, I came up one instruction too many to fit into the
753 * exception space :-). Both the instruction and data TLB
754 * miss get to this point to load the TLB.
755 * r10 - TLB_TAG value
756 * r11 - Linux PTE
757 * r12, r9 - avilable to use
758 * PID - loaded with proper value when we get here
759 * Upon exit, we reload everything and RFI.
760 * Actually, it will fit now, but oh well.....a common place
761 * to load the TLB.
762 */
763tlb_4xx_index:
764 .long 0
765finish_tlb_load:
766 /* load the next available TLB index.
767 */
768 lwz r9, tlb_4xx_index@l(0)
769 addi r9, r9, 1
770 andi. r9, r9, (PPC4XX_TLB_SIZE-1)
771 stw r9, tlb_4xx_index@l(0)
772
7736:
774 /*
775 * Clear out the software-only bits in the PTE to generate the
776 * TLB_DATA value. These are the bottom 2 bits of the RPM, the
777 * top 3 bits of the zone field, and M.
778 */
779 li r12, 0x0ce2
780 andc r11, r11, r12
781
782 tlbwe r11, r9, TLB_DATA /* Load TLB LO */
783 tlbwe r10, r9, TLB_TAG /* Load TLB HI */
784
785 /* Done...restore registers and get out of here.
786 */
787#ifdef CONFIG_403GCX
788 lwz r12, 12(r0)
789 lwz r11, 8(r0)
790 mtspr SPRN_PID, r12
791 mtcr r11
792 lwz r9, 4(r0)
793 lwz r12, 0(r0)
794#else
795 mfspr r12, SPRN_SPRG6
796 mfspr r11, SPRN_SPRG7
797 mtspr SPRN_PID, r12
798 mtcr r11
799 mfspr r9, SPRN_SPRG5
800 mfspr r12, SPRN_SPRG4
801#endif
802 mfspr r11, SPRN_SPRG1
803 mfspr r10, SPRN_SPRG0
804 PPC405_ERR77_SYNC
805 rfi /* Should sync shadow TLBs */
806 b . /* prevent prefetch past rfi */
807
808/* extern void giveup_fpu(struct task_struct *prev)
809 *
810 * The PowerPC 4xx family of processors do not have an FPU, so this just
811 * returns.
812 */
813_GLOBAL(giveup_fpu)
814 blr
815
816/* This is where the main kernel code starts.
817 */
818start_here:
819
820 /* ptr to current */
821 lis r2,init_task@h
822 ori r2,r2,init_task@l
823
824 /* ptr to phys current thread */
825 tophys(r4,r2)
826 addi r4,r4,THREAD /* init task's THREAD */
827 mtspr SPRN_SPRG3,r4
828
829 /* stack */
830 lis r1,init_thread_union@ha
831 addi r1,r1,init_thread_union@l
832 li r0,0
833 stwu r0,THREAD_SIZE-STACK_FRAME_OVERHEAD(r1)
834
835 bl early_init /* We have to do this with MMU on */
836
837/*
838 * Decide what sort of machine this is and initialize the MMU.
839 */
840 mr r3,r31
841 mr r4,r30
842 mr r5,r29
843 mr r6,r28
844 mr r7,r27
845 bl machine_init
846 bl MMU_init
847
848/* Go back to running unmapped so we can load up new values
849 * and change to using our exception vectors.
850 * On the 4xx, all we have to do is invalidate the TLB to clear
851 * the old 16M byte TLB mappings.
852 */
853 lis r4,2f@h
854 ori r4,r4,2f@l
855 tophys(r4,r4)
856 lis r3,(MSR_KERNEL & ~(MSR_IR|MSR_DR))@h
857 ori r3,r3,(MSR_KERNEL & ~(MSR_IR|MSR_DR))@l
858 mtspr SPRN_SRR0,r4
859 mtspr SPRN_SRR1,r3
860 rfi
861 b . /* prevent prefetch past rfi */
862
863/* Load up the kernel context */
8642:
865 sync /* Flush to memory before changing TLB */
866 tlbia
867 isync /* Flush shadow TLBs */
868
869 /* set up the PTE pointers for the Abatron bdiGDB.
870 */
871 lis r6, swapper_pg_dir@h
872 ori r6, r6, swapper_pg_dir@l
873 lis r5, abatron_pteptrs@h
874 ori r5, r5, abatron_pteptrs@l
875 stw r5, 0xf0(r0) /* Must match your Abatron config file */
876 tophys(r5,r5)
877 stw r6, 0(r5)
878
879/* Now turn on the MMU for real! */
880 lis r4,MSR_KERNEL@h
881 ori r4,r4,MSR_KERNEL@l
882 lis r3,start_kernel@h
883 ori r3,r3,start_kernel@l
884 mtspr SPRN_SRR0,r3
885 mtspr SPRN_SRR1,r4
886 rfi /* enable MMU and jump to start_kernel */
887 b . /* prevent prefetch past rfi */
888
889/* Set up the initial MMU state so we can do the first level of
890 * kernel initialization. This maps the first 16 MBytes of memory 1:1
891 * virtual to physical and more importantly sets the cache mode.
892 */
893initial_mmu:
894 tlbia /* Invalidate all TLB entries */
895 isync
896
897 /* We should still be executing code at physical address 0x0000xxxx
898 * at this point. However, start_here is at virtual address
899 * 0xC000xxxx. So, set up a TLB mapping to cover this once
900 * translation is enabled.
901 */
902
903 lis r3,KERNELBASE@h /* Load the kernel virtual address */
904 ori r3,r3,KERNELBASE@l
905 tophys(r4,r3) /* Load the kernel physical address */
906
907 iccci r0,r3 /* Invalidate the i-cache before use */
908
909 /* Load the kernel PID.
910 */
911 li r0,0
912 mtspr SPRN_PID,r0
913 sync
914
915 /* Configure and load two entries into TLB slots 62 and 63.
916 * In case we are pinning TLBs, these are reserved in by the
917 * other TLB functions. If not reserving, then it doesn't
918 * matter where they are loaded.
919 */
920 clrrwi r4,r4,10 /* Mask off the real page number */
921 ori r4,r4,(TLB_WR | TLB_EX) /* Set the write and execute bits */
922
923 clrrwi r3,r3,10 /* Mask off the effective page number */
924 ori r3,r3,(TLB_VALID | TLB_PAGESZ(PAGESZ_16M))
925
926 li r0,63 /* TLB slot 63 */
927
928 tlbwe r4,r0,TLB_DATA /* Load the data portion of the entry */
929 tlbwe r3,r0,TLB_TAG /* Load the tag portion of the entry */
930
931#if defined(CONFIG_SERIAL_TEXT_DEBUG) && defined(SERIAL_DEBUG_IO_BASE)
932
933 /* Load a TLB entry for the UART, so that ppc4xx_progress() can use
934 * the UARTs nice and early. We use a 4k real==virtual mapping. */
935
936 lis r3,SERIAL_DEBUG_IO_BASE@h
937 ori r3,r3,SERIAL_DEBUG_IO_BASE@l
938 mr r4,r3
939 clrrwi r4,r4,12
940 ori r4,r4,(TLB_WR|TLB_I|TLB_M|TLB_G)
941
942 clrrwi r3,r3,12
943 ori r3,r3,(TLB_VALID | TLB_PAGESZ(PAGESZ_4K))
944
945 li r0,0 /* TLB slot 0 */
946 tlbwe r4,r0,TLB_DATA
947 tlbwe r3,r0,TLB_TAG
948#endif /* CONFIG_SERIAL_DEBUG_TEXT && SERIAL_DEBUG_IO_BASE */
949
950 isync
951
952 /* Establish the exception vector base
953 */
954 lis r4,KERNELBASE@h /* EVPR only uses the high 16-bits */
955 tophys(r0,r4) /* Use the physical address */
956 mtspr SPRN_EVPR,r0
957
958 blr
959
960_GLOBAL(abort)
961 mfspr r13,SPRN_DBCR0
962 oris r13,r13,DBCR0_RST_SYSTEM@h
963 mtspr SPRN_DBCR0,r13
964
965_GLOBAL(set_context)
966
967#ifdef CONFIG_BDI_SWITCH
968 /* Context switch the PTE pointer for the Abatron BDI2000.
969 * The PGDIR is the second parameter.
970 */
971 lis r5, KERNELBASE@h
972 lwz r5, 0xf0(r5)
973 stw r4, 0x4(r5)
974#endif
975 sync
976 mtspr SPRN_PID,r3
977 isync /* Need an isync to flush shadow */
978 /* TLBs after changing PID */
979 blr
980
981/* We put a few things here that have to be page-aligned. This stuff
982 * goes at the beginning of the data segment, which is page-aligned.
983 */
984 .data
985_GLOBAL(sdata)
986_GLOBAL(empty_zero_page)
987 .space 4096
988_GLOBAL(swapper_pg_dir)
989 .space 4096
990
991
992/* Stack for handling critical exceptions from kernel mode */
993 .section .bss
994 .align 12
995exception_stack_bottom:
996 .space 4096
997critical_stack_top:
998_GLOBAL(exception_stack_top)
999
1000/* This space gets a copy of optional info passed to us by the bootstrap
1001 * which is used to pass parameters into the kernel like root=/dev/sda1, etc.
1002 */
1003_GLOBAL(cmd_line)
1004 .space 512
1005
1006/* Room for two PTE pointers, usually the kernel and current user pointers
1007 * to their respective root page table.
1008 */
1009abatron_pteptrs:
1010 .space 8
diff --git a/arch/ppc/kernel/head_8xx.S b/arch/ppc/kernel/head_8xx.S
new file mode 100644
index 000000000000..5a7a64e91fc5
--- /dev/null
+++ b/arch/ppc/kernel/head_8xx.S
@@ -0,0 +1,862 @@
1/*
2 * arch/ppc/kernel/except_8xx.S
3 *
4 * PowerPC version
5 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
6 * Rewritten by Cort Dougan (cort@cs.nmt.edu) for PReP
7 * Copyright (C) 1996 Cort Dougan <cort@cs.nmt.edu>
8 * Low-level exception handlers and MMU support
9 * rewritten by Paul Mackerras.
10 * Copyright (C) 1996 Paul Mackerras.
11 * MPC8xx modifications by Dan Malek
12 * Copyright (C) 1997 Dan Malek (dmalek@jlc.net).
13 *
14 * This file contains low-level support and setup for PowerPC 8xx
15 * embedded processors, including trap and interrupt dispatch.
16 *
17 * This program is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU General Public License
19 * as published by the Free Software Foundation; either version
20 * 2 of the License, or (at your option) any later version.
21 *
22 */
23
24#include <linux/config.h>
25#include <asm/processor.h>
26#include <asm/page.h>
27#include <asm/mmu.h>
28#include <asm/cache.h>
29#include <asm/pgtable.h>
30#include <asm/cputable.h>
31#include <asm/thread_info.h>
32#include <asm/ppc_asm.h>
33#include <asm/offsets.h>
34
35/* Macro to make the code more readable. */
36#ifdef CONFIG_8xx_CPU6
37#define DO_8xx_CPU6(val, reg) \
38 li reg, val; \
39 stw reg, 12(r0); \
40 lwz reg, 12(r0);
41#else
42#define DO_8xx_CPU6(val, reg)
43#endif
44 .text
45 .globl _stext
46_stext:
47 .text
48 .globl _start
49_start:
50
51/* MPC8xx
52 * This port was done on an MBX board with an 860. Right now I only
53 * support an ELF compressed (zImage) boot from EPPC-Bug because the
54 * code there loads up some registers before calling us:
55 * r3: ptr to board info data
56 * r4: initrd_start or if no initrd then 0
57 * r5: initrd_end - unused if r4 is 0
58 * r6: Start of command line string
59 * r7: End of command line string
60 *
61 * I decided to use conditional compilation instead of checking PVR and
62 * adding more processor specific branches around code I don't need.
63 * Since this is an embedded processor, I also appreciate any memory
64 * savings I can get.
65 *
66 * The MPC8xx does not have any BATs, but it supports large page sizes.
67 * We first initialize the MMU to support 8M byte pages, then load one
68 * entry into each of the instruction and data TLBs to map the first
69 * 8M 1:1. I also mapped an additional I/O space 1:1 so we can get to
70 * the "internal" processor registers before MMU_init is called.
71 *
72 * The TLB code currently contains a major hack. Since I use the condition
73 * code register, I have to save and restore it. I am out of registers, so
74 * I just store it in memory location 0 (the TLB handlers are not reentrant).
75 * To avoid making any decisions, I need to use the "segment" valid bit
76 * in the first level table, but that would require many changes to the
77 * Linux page directory/table functions that I don't want to do right now.
78 *
79 * I used to use SPRG2 for a temporary register in the TLB handler, but it
80 * has since been put to other uses. I now use a hack to save a register
81 * and the CCR at memory location 0.....Someday I'll fix this.....
82 * -- Dan
83 */
84 .globl __start
85__start:
86 mr r31,r3 /* save parameters */
87 mr r30,r4
88 mr r29,r5
89 mr r28,r6
90 mr r27,r7
91
92 /* We have to turn on the MMU right away so we get cache modes
93 * set correctly.
94 */
95 bl initial_mmu
96
97/* We now have the lower 8 Meg mapped into TLB entries, and the caches
98 * ready to work.
99 */
100
101turn_on_mmu:
102 mfmsr r0
103 ori r0,r0,MSR_DR|MSR_IR
104 mtspr SPRN_SRR1,r0
105 lis r0,start_here@h
106 ori r0,r0,start_here@l
107 mtspr SPRN_SRR0,r0
108 SYNC
109 rfi /* enables MMU */
110
111/*
112 * Exception entry code. This code runs with address translation
113 * turned off, i.e. using physical addresses.
114 * We assume sprg3 has the physical address of the current
115 * task's thread_struct.
116 */
117#define EXCEPTION_PROLOG \
118 mtspr SPRN_SPRG0,r10; \
119 mtspr SPRN_SPRG1,r11; \
120 mfcr r10; \
121 EXCEPTION_PROLOG_1; \
122 EXCEPTION_PROLOG_2
123
124#define EXCEPTION_PROLOG_1 \
125 mfspr r11,SPRN_SRR1; /* check whether user or kernel */ \
126 andi. r11,r11,MSR_PR; \
127 tophys(r11,r1); /* use tophys(r1) if kernel */ \
128 beq 1f; \
129 mfspr r11,SPRN_SPRG3; \
130 lwz r11,THREAD_INFO-THREAD(r11); \
131 addi r11,r11,THREAD_SIZE; \
132 tophys(r11,r11); \
1331: subi r11,r11,INT_FRAME_SIZE /* alloc exc. frame */
134
135
136#define EXCEPTION_PROLOG_2 \
137 CLR_TOP32(r11); \
138 stw r10,_CCR(r11); /* save registers */ \
139 stw r12,GPR12(r11); \
140 stw r9,GPR9(r11); \
141 mfspr r10,SPRN_SPRG0; \
142 stw r10,GPR10(r11); \
143 mfspr r12,SPRN_SPRG1; \
144 stw r12,GPR11(r11); \
145 mflr r10; \
146 stw r10,_LINK(r11); \
147 mfspr r12,SPRN_SRR0; \
148 mfspr r9,SPRN_SRR1; \
149 stw r1,GPR1(r11); \
150 stw r1,0(r11); \
151 tovirt(r1,r11); /* set new kernel sp */ \
152 li r10,MSR_KERNEL & ~(MSR_IR|MSR_DR); /* can take exceptions */ \
153 MTMSRD(r10); /* (except for mach check in rtas) */ \
154 stw r0,GPR0(r11); \
155 SAVE_4GPRS(3, r11); \
156 SAVE_2GPRS(7, r11)
157
158/*
159 * Note: code which follows this uses cr0.eq (set if from kernel),
160 * r11, r12 (SRR0), and r9 (SRR1).
161 *
162 * Note2: once we have set r1 we are in a position to take exceptions
163 * again, and we could thus set MSR:RI at that point.
164 */
165
166/*
167 * Exception vectors.
168 */
169#define EXCEPTION(n, label, hdlr, xfer) \
170 . = n; \
171label: \
172 EXCEPTION_PROLOG; \
173 addi r3,r1,STACK_FRAME_OVERHEAD; \
174 xfer(n, hdlr)
175
176#define EXC_XFER_TEMPLATE(n, hdlr, trap, copyee, tfer, ret) \
177 li r10,trap; \
178 stw r10,TRAP(r11); \
179 li r10,MSR_KERNEL; \
180 copyee(r10, r9); \
181 bl tfer; \
182i##n: \
183 .long hdlr; \
184 .long ret
185
186#define COPY_EE(d, s) rlwimi d,s,0,16,16
187#define NOCOPY(d, s)
188
189#define EXC_XFER_STD(n, hdlr) \
190 EXC_XFER_TEMPLATE(n, hdlr, n, NOCOPY, transfer_to_handler_full, \
191 ret_from_except_full)
192
193#define EXC_XFER_LITE(n, hdlr) \
194 EXC_XFER_TEMPLATE(n, hdlr, n+1, NOCOPY, transfer_to_handler, \
195 ret_from_except)
196
197#define EXC_XFER_EE(n, hdlr) \
198 EXC_XFER_TEMPLATE(n, hdlr, n, COPY_EE, transfer_to_handler_full, \
199 ret_from_except_full)
200
201#define EXC_XFER_EE_LITE(n, hdlr) \
202 EXC_XFER_TEMPLATE(n, hdlr, n+1, COPY_EE, transfer_to_handler, \
203 ret_from_except)
204
205/* System reset */
206 EXCEPTION(0x100, Reset, UnknownException, EXC_XFER_STD)
207
208/* Machine check */
209 . = 0x200
210MachineCheck:
211 EXCEPTION_PROLOG
212 mfspr r4,SPRN_DAR
213 stw r4,_DAR(r11)
214 mfspr r5,SPRN_DSISR
215 stw r5,_DSISR(r11)
216 addi r3,r1,STACK_FRAME_OVERHEAD
217 EXC_XFER_STD(0x200, MachineCheckException)
218
219/* Data access exception.
220 * This is "never generated" by the MPC8xx. We jump to it for other
221 * translation errors.
222 */
223 . = 0x300
224DataAccess:
225 EXCEPTION_PROLOG
226 mfspr r10,SPRN_DSISR
227 stw r10,_DSISR(r11)
228 mr r5,r10
229 mfspr r4,SPRN_DAR
230 EXC_XFER_EE_LITE(0x300, handle_page_fault)
231
232/* Instruction access exception.
233 * This is "never generated" by the MPC8xx. We jump to it for other
234 * translation errors.
235 */
236 . = 0x400
237InstructionAccess:
238 EXCEPTION_PROLOG
239 mr r4,r12
240 mr r5,r9
241 EXC_XFER_EE_LITE(0x400, handle_page_fault)
242
243/* External interrupt */
244 EXCEPTION(0x500, HardwareInterrupt, do_IRQ, EXC_XFER_LITE)
245
246/* Alignment exception */
247 . = 0x600
248Alignment:
249 EXCEPTION_PROLOG
250 mfspr r4,SPRN_DAR
251 stw r4,_DAR(r11)
252 mfspr r5,SPRN_DSISR
253 stw r5,_DSISR(r11)
254 addi r3,r1,STACK_FRAME_OVERHEAD
255 EXC_XFER_EE(0x600, AlignmentException)
256
257/* Program check exception */
258 EXCEPTION(0x700, ProgramCheck, ProgramCheckException, EXC_XFER_STD)
259
260/* No FPU on MPC8xx. This exception is not supposed to happen.
261*/
262 EXCEPTION(0x800, FPUnavailable, UnknownException, EXC_XFER_STD)
263
264/* Decrementer */
265 EXCEPTION(0x900, Decrementer, timer_interrupt, EXC_XFER_LITE)
266
267 EXCEPTION(0xa00, Trap_0a, UnknownException, EXC_XFER_EE)
268 EXCEPTION(0xb00, Trap_0b, UnknownException, EXC_XFER_EE)
269
270/* System call */
271 . = 0xc00
272SystemCall:
273 EXCEPTION_PROLOG
274 EXC_XFER_EE_LITE(0xc00, DoSyscall)
275
276/* Single step - not used on 601 */
277 EXCEPTION(0xd00, SingleStep, SingleStepException, EXC_XFER_STD)
278 EXCEPTION(0xe00, Trap_0e, UnknownException, EXC_XFER_EE)
279 EXCEPTION(0xf00, Trap_0f, UnknownException, EXC_XFER_EE)
280
281/* On the MPC8xx, this is a software emulation interrupt. It occurs
282 * for all unimplemented and illegal instructions.
283 */
284 EXCEPTION(0x1000, SoftEmu, SoftwareEmulation, EXC_XFER_STD)
285
286 . = 0x1100
287/*
288 * For the MPC8xx, this is a software tablewalk to load the instruction
289 * TLB. It is modelled after the example in the Motorola manual. The task
290 * switch loads the M_TWB register with the pointer to the first level table.
291 * If we discover there is no second level table (the value is zero), the
292 * plan was to load that into the TLB, which causes another fault into the
293 * TLB Error interrupt where we can handle such problems. However, that did
294 * not work, so if we discover there is no second level table, we restore
295 * registers and branch to the error exception. We have to use the MD_xxx
296 * registers for the tablewalk because the equivalent MI_xxx registers
297 * only perform the attribute functions.
298 */
299InstructionTLBMiss:
300#ifdef CONFIG_8xx_CPU6
301 stw r3, 8(r0)
302#endif
303 DO_8xx_CPU6(0x3f80, r3)
304 mtspr SPRN_M_TW, r10 /* Save a couple of working registers */
305 mfcr r10
306 stw r10, 0(r0)
307 stw r11, 4(r0)
308 mfspr r10, SPRN_SRR0 /* Get effective address of fault */
309 DO_8xx_CPU6(0x3780, r3)
310 mtspr SPRN_MD_EPN, r10 /* Have to use MD_EPN for walk, MI_EPN can't */
311 mfspr r10, SPRN_M_TWB /* Get level 1 table entry address */
312
313 /* If we are faulting a kernel address, we have to use the
314 * kernel page tables.
315 */
316 andi. r11, r10, 0x0800 /* Address >= 0x80000000 */
317 beq 3f
318 lis r11, swapper_pg_dir@h
319 ori r11, r11, swapper_pg_dir@l
320 rlwimi r10, r11, 0, 2, 19
3213:
322 lwz r11, 0(r10) /* Get the level 1 entry */
323 rlwinm. r10, r11,0,0,19 /* Extract page descriptor page address */
324 beq 2f /* If zero, don't try to find a pte */
325
326 /* We have a pte table, so load the MI_TWC with the attributes
327 * for this "segment."
328 */
329 ori r11,r11,1 /* Set valid bit */
330 DO_8xx_CPU6(0x2b80, r3)
331 mtspr SPRN_MI_TWC, r11 /* Set segment attributes */
332 DO_8xx_CPU6(0x3b80, r3)
333 mtspr SPRN_MD_TWC, r11 /* Load pte table base address */
334 mfspr r11, SPRN_MD_TWC /* ....and get the pte address */
335 lwz r10, 0(r11) /* Get the pte */
336
337 ori r10, r10, _PAGE_ACCESSED
338 stw r10, 0(r11)
339
340 /* The Linux PTE won't go exactly into the MMU TLB.
341 * Software indicator bits 21, 22 and 28 must be clear.
342 * Software indicator bits 24, 25, 26, and 27 must be
343 * set. All other Linux PTE bits control the behavior
344 * of the MMU.
345 */
3462: li r11, 0x00f0
347 rlwimi r10, r11, 0, 24, 28 /* Set 24-27, clear 28 */
348 DO_8xx_CPU6(0x2d80, r3)
349 mtspr SPRN_MI_RPN, r10 /* Update TLB entry */
350
351 mfspr r10, SPRN_M_TW /* Restore registers */
352 lwz r11, 0(r0)
353 mtcr r11
354 lwz r11, 4(r0)
355#ifdef CONFIG_8xx_CPU6
356 lwz r3, 8(r0)
357#endif
358 rfi
359
360 . = 0x1200
361DataStoreTLBMiss:
362#ifdef CONFIG_8xx_CPU6
363 stw r3, 8(r0)
364#endif
365 DO_8xx_CPU6(0x3f80, r3)
366 mtspr SPRN_M_TW, r10 /* Save a couple of working registers */
367 mfcr r10
368 stw r10, 0(r0)
369 stw r11, 4(r0)
370 mfspr r10, SPRN_M_TWB /* Get level 1 table entry address */
371
372 /* If we are faulting a kernel address, we have to use the
373 * kernel page tables.
374 */
375 andi. r11, r10, 0x0800
376 beq 3f
377 lis r11, swapper_pg_dir@h
378 ori r11, r11, swapper_pg_dir@l
379 rlwimi r10, r11, 0, 2, 19
3803:
381 lwz r11, 0(r10) /* Get the level 1 entry */
382 rlwinm. r10, r11,0,0,19 /* Extract page descriptor page address */
383 beq 2f /* If zero, don't try to find a pte */
384
385 /* We have a pte table, so load fetch the pte from the table.
386 */
387 ori r11, r11, 1 /* Set valid bit in physical L2 page */
388 DO_8xx_CPU6(0x3b80, r3)
389 mtspr SPRN_MD_TWC, r11 /* Load pte table base address */
390 mfspr r10, SPRN_MD_TWC /* ....and get the pte address */
391 lwz r10, 0(r10) /* Get the pte */
392
393 /* Insert the Guarded flag into the TWC from the Linux PTE.
394 * It is bit 27 of both the Linux PTE and the TWC (at least
395 * I got that right :-). It will be better when we can put
396 * this into the Linux pgd/pmd and load it in the operation
397 * above.
398 */
399 rlwimi r11, r10, 0, 27, 27
400 DO_8xx_CPU6(0x3b80, r3)
401 mtspr SPRN_MD_TWC, r11
402
403 mfspr r11, SPRN_MD_TWC /* get the pte address again */
404 ori r10, r10, _PAGE_ACCESSED
405 stw r10, 0(r11)
406
407 /* The Linux PTE won't go exactly into the MMU TLB.
408 * Software indicator bits 21, 22 and 28 must be clear.
409 * Software indicator bits 24, 25, 26, and 27 must be
410 * set. All other Linux PTE bits control the behavior
411 * of the MMU.
412 */
4132: li r11, 0x00f0
414 rlwimi r10, r11, 0, 24, 28 /* Set 24-27, clear 28 */
415 DO_8xx_CPU6(0x3d80, r3)
416 mtspr SPRN_MD_RPN, r10 /* Update TLB entry */
417
418 mfspr r10, SPRN_M_TW /* Restore registers */
419 lwz r11, 0(r0)
420 mtcr r11
421 lwz r11, 4(r0)
422#ifdef CONFIG_8xx_CPU6
423 lwz r3, 8(r0)
424#endif
425 rfi
426
427/* This is an instruction TLB error on the MPC8xx. This could be due
428 * to many reasons, such as executing guarded memory or illegal instruction
429 * addresses. There is nothing to do but handle a big time error fault.
430 */
431 . = 0x1300
432InstructionTLBError:
433 b InstructionAccess
434
435/* This is the data TLB error on the MPC8xx. This could be due to
436 * many reasons, including a dirty update to a pte. We can catch that
437 * one here, but anything else is an error. First, we track down the
438 * Linux pte. If it is valid, write access is allowed, but the
439 * page dirty bit is not set, we will set it and reload the TLB. For
440 * any other case, we bail out to a higher level function that can
441 * handle it.
442 */
443 . = 0x1400
444DataTLBError:
445#ifdef CONFIG_8xx_CPU6
446 stw r3, 8(r0)
447#endif
448 DO_8xx_CPU6(0x3f80, r3)
449 mtspr SPRN_M_TW, r10 /* Save a couple of working registers */
450 mfcr r10
451 stw r10, 0(r0)
452 stw r11, 4(r0)
453
454 /* First, make sure this was a store operation.
455 */
456 mfspr r10, SPRN_DSISR
457 andis. r11, r10, 0x0200 /* If set, indicates store op */
458 beq 2f
459
460 /* The EA of a data TLB miss is automatically stored in the MD_EPN
461 * register. The EA of a data TLB error is automatically stored in
462 * the DAR, but not the MD_EPN register. We must copy the 20 most
463 * significant bits of the EA from the DAR to MD_EPN before we
464 * start walking the page tables. We also need to copy the CASID
465 * value from the M_CASID register.
466 * Addendum: The EA of a data TLB error is _supposed_ to be stored
467 * in DAR, but it seems that this doesn't happen in some cases, such
468 * as when the error is due to a dcbi instruction to a page with a
469 * TLB that doesn't have the changed bit set. In such cases, there
470 * does not appear to be any way to recover the EA of the error
471 * since it is neither in DAR nor MD_EPN. As a workaround, the
472 * _PAGE_HWWRITE bit is set for all kernel data pages when the PTEs
473 * are initialized in mapin_ram(). This will avoid the problem,
474 * assuming we only use the dcbi instruction on kernel addresses.
475 */
476 mfspr r10, SPRN_DAR
477 rlwinm r11, r10, 0, 0, 19
478 ori r11, r11, MD_EVALID
479 mfspr r10, SPRN_M_CASID
480 rlwimi r11, r10, 0, 28, 31
481 DO_8xx_CPU6(0x3780, r3)
482 mtspr SPRN_MD_EPN, r11
483
484 mfspr r10, SPRN_M_TWB /* Get level 1 table entry address */
485
486 /* If we are faulting a kernel address, we have to use the
487 * kernel page tables.
488 */
489 andi. r11, r10, 0x0800
490 beq 3f
491 lis r11, swapper_pg_dir@h
492 ori r11, r11, swapper_pg_dir@l
493 rlwimi r10, r11, 0, 2, 19
4943:
495 lwz r11, 0(r10) /* Get the level 1 entry */
496 rlwinm. r10, r11,0,0,19 /* Extract page descriptor page address */
497 beq 2f /* If zero, bail */
498
499 /* We have a pte table, so fetch the pte from the table.
500 */
501 ori r11, r11, 1 /* Set valid bit in physical L2 page */
502 DO_8xx_CPU6(0x3b80, r3)
503 mtspr SPRN_MD_TWC, r11 /* Load pte table base address */
504 mfspr r11, SPRN_MD_TWC /* ....and get the pte address */
505 lwz r10, 0(r11) /* Get the pte */
506
507 andi. r11, r10, _PAGE_RW /* Is it writeable? */
508 beq 2f /* Bail out if not */
509
510 /* Update 'changed', among others.
511 */
512 ori r10, r10, _PAGE_DIRTY|_PAGE_ACCESSED|_PAGE_HWWRITE
513 mfspr r11, SPRN_MD_TWC /* Get pte address again */
514 stw r10, 0(r11) /* and update pte in table */
515
516 /* The Linux PTE won't go exactly into the MMU TLB.
517 * Software indicator bits 21, 22 and 28 must be clear.
518 * Software indicator bits 24, 25, 26, and 27 must be
519 * set. All other Linux PTE bits control the behavior
520 * of the MMU.
521 */
522 li r11, 0x00f0
523 rlwimi r10, r11, 0, 24, 28 /* Set 24-27, clear 28 */
524 DO_8xx_CPU6(0x3d80, r3)
525 mtspr SPRN_MD_RPN, r10 /* Update TLB entry */
526
527 mfspr r10, SPRN_M_TW /* Restore registers */
528 lwz r11, 0(r0)
529 mtcr r11
530 lwz r11, 4(r0)
531#ifdef CONFIG_8xx_CPU6
532 lwz r3, 8(r0)
533#endif
534 rfi
5352:
536 mfspr r10, SPRN_M_TW /* Restore registers */
537 lwz r11, 0(r0)
538 mtcr r11
539 lwz r11, 4(r0)
540#ifdef CONFIG_8xx_CPU6
541 lwz r3, 8(r0)
542#endif
543 b DataAccess
544
545 EXCEPTION(0x1500, Trap_15, UnknownException, EXC_XFER_EE)
546 EXCEPTION(0x1600, Trap_16, UnknownException, EXC_XFER_EE)
547 EXCEPTION(0x1700, Trap_17, UnknownException, EXC_XFER_EE)
548 EXCEPTION(0x1800, Trap_18, UnknownException, EXC_XFER_EE)
549 EXCEPTION(0x1900, Trap_19, UnknownException, EXC_XFER_EE)
550 EXCEPTION(0x1a00, Trap_1a, UnknownException, EXC_XFER_EE)
551 EXCEPTION(0x1b00, Trap_1b, UnknownException, EXC_XFER_EE)
552
553/* On the MPC8xx, these next four traps are used for development
554 * support of breakpoints and such. Someday I will get around to
555 * using them.
556 */
557 EXCEPTION(0x1c00, Trap_1c, UnknownException, EXC_XFER_EE)
558 EXCEPTION(0x1d00, Trap_1d, UnknownException, EXC_XFER_EE)
559 EXCEPTION(0x1e00, Trap_1e, UnknownException, EXC_XFER_EE)
560 EXCEPTION(0x1f00, Trap_1f, UnknownException, EXC_XFER_EE)
561
562 . = 0x2000
563
564 .globl giveup_fpu
565giveup_fpu:
566 blr
567
568/*
569 * This is where the main kernel code starts.
570 */
571start_here:
572 /* ptr to current */
573 lis r2,init_task@h
574 ori r2,r2,init_task@l
575
576 /* ptr to phys current thread */
577 tophys(r4,r2)
578 addi r4,r4,THREAD /* init task's THREAD */
579 mtspr SPRN_SPRG3,r4
580 li r3,0
581 mtspr SPRN_SPRG2,r3 /* 0 => r1 has kernel sp */
582
583 /* stack */
584 lis r1,init_thread_union@ha
585 addi r1,r1,init_thread_union@l
586 li r0,0
587 stwu r0,THREAD_SIZE-STACK_FRAME_OVERHEAD(r1)
588
589 bl early_init /* We have to do this with MMU on */
590
591/*
592 * Decide what sort of machine this is and initialize the MMU.
593 */
594 mr r3,r31
595 mr r4,r30
596 mr r5,r29
597 mr r6,r28
598 mr r7,r27
599 bl machine_init
600 bl MMU_init
601
602/*
603 * Go back to running unmapped so we can load up new values
604 * and change to using our exception vectors.
605 * On the 8xx, all we have to do is invalidate the TLB to clear
606 * the old 8M byte TLB mappings and load the page table base register.
607 */
608 /* The right way to do this would be to track it down through
609 * init's THREAD like the context switch code does, but this is
610 * easier......until someone changes init's static structures.
611 */
612 lis r6, swapper_pg_dir@h
613 ori r6, r6, swapper_pg_dir@l
614 tophys(r6,r6)
615#ifdef CONFIG_8xx_CPU6
616 lis r4, cpu6_errata_word@h
617 ori r4, r4, cpu6_errata_word@l
618 li r3, 0x3980
619 stw r3, 12(r4)
620 lwz r3, 12(r4)
621#endif
622 mtspr SPRN_M_TWB, r6
623 lis r4,2f@h
624 ori r4,r4,2f@l
625 tophys(r4,r4)
626 li r3,MSR_KERNEL & ~(MSR_IR|MSR_DR)
627 mtspr SPRN_SRR0,r4
628 mtspr SPRN_SRR1,r3
629 rfi
630/* Load up the kernel context */
6312:
632 SYNC /* Force all PTE updates to finish */
633 tlbia /* Clear all TLB entries */
634 sync /* wait for tlbia/tlbie to finish */
635 TLBSYNC /* ... on all CPUs */
636
637 /* set up the PTE pointers for the Abatron bdiGDB.
638 */
639 tovirt(r6,r6)
640 lis r5, abatron_pteptrs@h
641 ori r5, r5, abatron_pteptrs@l
642 stw r5, 0xf0(r0) /* Must match your Abatron config file */
643 tophys(r5,r5)
644 stw r6, 0(r5)
645
646/* Now turn on the MMU for real! */
647 li r4,MSR_KERNEL
648 lis r3,start_kernel@h
649 ori r3,r3,start_kernel@l
650 mtspr SPRN_SRR0,r3
651 mtspr SPRN_SRR1,r4
652 rfi /* enable MMU and jump to start_kernel */
653
654/* Set up the initial MMU state so we can do the first level of
655 * kernel initialization. This maps the first 8 MBytes of memory 1:1
656 * virtual to physical. Also, set the cache mode since that is defined
657 * by TLB entries and perform any additional mapping (like of the IMMR).
658 * If configured to pin some TLBs, we pin the first 8 Mbytes of kernel,
659 * 24 Mbytes of data, and the 8M IMMR space. Anything not covered by
660 * these mappings is mapped by page tables.
661 */
662initial_mmu:
663 tlbia /* Invalidate all TLB entries */
664#ifdef CONFIG_PIN_TLB
665 lis r8, MI_RSV4I@h
666 ori r8, r8, 0x1c00
667#else
668 li r8, 0
669#endif
670 mtspr SPRN_MI_CTR, r8 /* Set instruction MMU control */
671
672#ifdef CONFIG_PIN_TLB
673 lis r10, (MD_RSV4I | MD_RESETVAL)@h
674 ori r10, r10, 0x1c00
675 mr r8, r10
676#else
677 lis r10, MD_RESETVAL@h
678#endif
679#ifndef CONFIG_8xx_COPYBACK
680 oris r10, r10, MD_WTDEF@h
681#endif
682 mtspr SPRN_MD_CTR, r10 /* Set data TLB control */
683
684 /* Now map the lower 8 Meg into the TLBs. For this quick hack,
685 * we can load the instruction and data TLB registers with the
686 * same values.
687 */
688 lis r8, KERNELBASE@h /* Create vaddr for TLB */
689 ori r8, r8, MI_EVALID /* Mark it valid */
690 mtspr SPRN_MI_EPN, r8
691 mtspr SPRN_MD_EPN, r8
692 li r8, MI_PS8MEG /* Set 8M byte page */
693 ori r8, r8, MI_SVALID /* Make it valid */
694 mtspr SPRN_MI_TWC, r8
695 mtspr SPRN_MD_TWC, r8
696 li r8, MI_BOOTINIT /* Create RPN for address 0 */
697 mtspr SPRN_MI_RPN, r8 /* Store TLB entry */
698 mtspr SPRN_MD_RPN, r8
699 lis r8, MI_Kp@h /* Set the protection mode */
700 mtspr SPRN_MI_AP, r8
701 mtspr SPRN_MD_AP, r8
702
703 /* Map another 8 MByte at the IMMR to get the processor
704 * internal registers (among other things).
705 */
706#ifdef CONFIG_PIN_TLB
707 addi r10, r10, 0x0100
708 mtspr SPRN_MD_CTR, r10
709#endif
710 mfspr r9, 638 /* Get current IMMR */
711 andis. r9, r9, 0xff80 /* Get 8Mbyte boundary */
712
713 mr r8, r9 /* Create vaddr for TLB */
714 ori r8, r8, MD_EVALID /* Mark it valid */
715 mtspr SPRN_MD_EPN, r8
716 li r8, MD_PS8MEG /* Set 8M byte page */
717 ori r8, r8, MD_SVALID /* Make it valid */
718 mtspr SPRN_MD_TWC, r8
719 mr r8, r9 /* Create paddr for TLB */
720 ori r8, r8, MI_BOOTINIT|0x2 /* Inhibit cache -- Cort */
721 mtspr SPRN_MD_RPN, r8
722
723#ifdef CONFIG_PIN_TLB
724 /* Map two more 8M kernel data pages.
725 */
726 addi r10, r10, 0x0100
727 mtspr SPRN_MD_CTR, r10
728
729 lis r8, KERNELBASE@h /* Create vaddr for TLB */
730 addis r8, r8, 0x0080 /* Add 8M */
731 ori r8, r8, MI_EVALID /* Mark it valid */
732 mtspr SPRN_MD_EPN, r8
733 li r9, MI_PS8MEG /* Set 8M byte page */
734 ori r9, r9, MI_SVALID /* Make it valid */
735 mtspr SPRN_MD_TWC, r9
736 li r11, MI_BOOTINIT /* Create RPN for address 0 */
737 addis r11, r11, 0x0080 /* Add 8M */
738 mtspr SPRN_MD_RPN, r8
739
740 addis r8, r8, 0x0080 /* Add 8M */
741 mtspr SPRN_MD_EPN, r8
742 mtspr SPRN_MD_TWC, r9
743 addis r11, r11, 0x0080 /* Add 8M */
744 mtspr SPRN_MD_RPN, r8
745#endif
746
747 /* Since the cache is enabled according to the information we
748 * just loaded into the TLB, invalidate and enable the caches here.
749 * We should probably check/set other modes....later.
750 */
751 lis r8, IDC_INVALL@h
752 mtspr SPRN_IC_CST, r8
753 mtspr SPRN_DC_CST, r8
754 lis r8, IDC_ENABLE@h
755 mtspr SPRN_IC_CST, r8
756#ifdef CONFIG_8xx_COPYBACK
757 mtspr SPRN_DC_CST, r8
758#else
759 /* For a debug option, I left this here to easily enable
760 * the write through cache mode
761 */
762 lis r8, DC_SFWT@h
763 mtspr SPRN_DC_CST, r8
764 lis r8, IDC_ENABLE@h
765 mtspr SPRN_DC_CST, r8
766#endif
767 blr
768
769
770/*
771 * Set up to use a given MMU context.
772 * r3 is context number, r4 is PGD pointer.
773 *
774 * We place the physical address of the new task page directory loaded
775 * into the MMU base register, and set the ASID compare register with
776 * the new "context."
777 */
778_GLOBAL(set_context)
779
780#ifdef CONFIG_BDI_SWITCH
781 /* Context switch the PTE pointer for the Abatron BDI2000.
782 * The PGDIR is passed as second argument.
783 */
784 lis r5, KERNELBASE@h
785 lwz r5, 0xf0(r5)
786 stw r4, 0x4(r5)
787#endif
788
789#ifdef CONFIG_8xx_CPU6
790 lis r6, cpu6_errata_word@h
791 ori r6, r6, cpu6_errata_word@l
792 tophys (r4, r4)
793 li r7, 0x3980
794 stw r7, 12(r6)
795 lwz r7, 12(r6)
796 mtspr SPRN_M_TWB, r4 /* Update MMU base address */
797 li r7, 0x3380
798 stw r7, 12(r6)
799 lwz r7, 12(r6)
800 mtspr SPRN_M_CASID, r3 /* Update context */
801#else
802 mtspr SPRN_M_CASID,r3 /* Update context */
803 tophys (r4, r4)
804 mtspr SPRN_M_TWB, r4 /* and pgd */
805#endif
806 SYNC
807 blr
808
809#ifdef CONFIG_8xx_CPU6
810/* It's here because it is unique to the 8xx.
811 * It is important we get called with interrupts disabled. I used to
812 * do that, but it appears that all code that calls this already had
813 * interrupt disabled.
814 */
815 .globl set_dec_cpu6
816set_dec_cpu6:
817 lis r7, cpu6_errata_word@h
818 ori r7, r7, cpu6_errata_word@l
819 li r4, 0x2c00
820 stw r4, 8(r7)
821 lwz r4, 8(r7)
822 mtspr 22, r3 /* Update Decrementer */
823 SYNC
824 blr
825#endif
826
827/*
828 * We put a few things here that have to be page-aligned.
829 * This stuff goes at the beginning of the data segment,
830 * which is page-aligned.
831 */
832 .data
833 .globl sdata
834sdata:
835 .globl empty_zero_page
836empty_zero_page:
837 .space 4096
838
839 .globl swapper_pg_dir
840swapper_pg_dir:
841 .space 4096
842
843/*
844 * This space gets a copy of optional info passed to us by the bootstrap
845 * Used to pass parameters into the kernel like root=/dev/sda1, etc.
846 */
847 .globl cmd_line
848cmd_line:
849 .space 512
850
851/* Room for two PTE table poiners, usually the kernel and current user
852 * pointer to their respective root page table (pgdir).
853 */
854abatron_pteptrs:
855 .space 8
856
857#ifdef CONFIG_8xx_CPU6
858 .globl cpu6_errata_word
859cpu6_errata_word:
860 .space 16
861#endif
862
diff --git a/arch/ppc/kernel/head_booke.h b/arch/ppc/kernel/head_booke.h
new file mode 100644
index 000000000000..884dac916bce
--- /dev/null
+++ b/arch/ppc/kernel/head_booke.h
@@ -0,0 +1,340 @@
1#ifndef __HEAD_BOOKE_H__
2#define __HEAD_BOOKE_H__
3
4/*
5 * Macros used for common Book-e exception handling
6 */
7
8#define SET_IVOR(vector_number, vector_label) \
9 li r26,vector_label@l; \
10 mtspr SPRN_IVOR##vector_number,r26; \
11 sync
12
13#define NORMAL_EXCEPTION_PROLOG \
14 mtspr SPRN_SPRG0,r10; /* save two registers to work with */\
15 mtspr SPRN_SPRG1,r11; \
16 mtspr SPRN_SPRG4W,r1; \
17 mfcr r10; /* save CR in r10 for now */\
18 mfspr r11,SPRN_SRR1; /* check whether user or kernel */\
19 andi. r11,r11,MSR_PR; \
20 beq 1f; \
21 mfspr r1,SPRN_SPRG3; /* if from user, start at top of */\
22 lwz r1,THREAD_INFO-THREAD(r1); /* this thread's kernel stack */\
23 addi r1,r1,THREAD_SIZE; \
241: subi r1,r1,INT_FRAME_SIZE; /* Allocate an exception frame */\
25 mr r11,r1; \
26 stw r10,_CCR(r11); /* save various registers */\
27 stw r12,GPR12(r11); \
28 stw r9,GPR9(r11); \
29 mfspr r10,SPRN_SPRG0; \
30 stw r10,GPR10(r11); \
31 mfspr r12,SPRN_SPRG1; \
32 stw r12,GPR11(r11); \
33 mflr r10; \
34 stw r10,_LINK(r11); \
35 mfspr r10,SPRN_SPRG4R; \
36 mfspr r12,SPRN_SRR0; \
37 stw r10,GPR1(r11); \
38 mfspr r9,SPRN_SRR1; \
39 stw r10,0(r11); \
40 rlwinm r9,r9,0,14,12; /* clear MSR_WE (necessary?) */\
41 stw r0,GPR0(r11); \
42 SAVE_4GPRS(3, r11); \
43 SAVE_2GPRS(7, r11)
44
45/* To handle the additional exception priority levels on 40x and Book-E
46 * processors we allocate a 4k stack per additional priority level. The various
47 * head_xxx.S files allocate space (exception_stack_top) for each priority's
48 * stack times the number of CPUs
49 *
50 * On 40x critical is the only additional level
51 * On 44x/e500 we have critical and machine check
52 *
53 * Additionally we reserve a SPRG for each priority level so we can free up a
54 * GPR to use as the base for indirect access to the exception stacks. This
55 * is necessary since the MMU is always on, for Book-E parts, and the stacks
56 * are offset from KERNELBASE.
57 *
58 */
59#define BOOKE_EXCEPTION_STACK_SIZE (8192)
60
61/* CRIT_SPRG only used in critical exception handling */
62#define CRIT_SPRG SPRN_SPRG2
63/* MCHECK_SPRG only used in critical exception handling */
64#define MCHECK_SPRG SPRN_SPRG6W
65
66#define MCHECK_STACK_TOP (exception_stack_top - 4096)
67#define CRIT_STACK_TOP (exception_stack_top)
68
69#ifdef CONFIG_SMP
70#define BOOKE_LOAD_CRIT_STACK \
71 mfspr r8,SPRN_PIR; \
72 mulli r8,r8,BOOKE_EXCEPTION_STACK_SIZE; \
73 neg r8,r8; \
74 addis r8,r8,CRIT_STACK_TOP@ha; \
75 addi r8,r8,CRIT_STACK_TOP@l
76#define BOOKE_LOAD_MCHECK_STACK \
77 mfspr r8,SPRN_PIR; \
78 mulli r8,r8,BOOKE_EXCEPTION_STACK_SIZE; \
79 neg r8,r8; \
80 addis r8,r8,MCHECK_STACK_TOP@ha; \
81 addi r8,r8,MCHECK_STACK_TOP@l
82#else
83#define BOOKE_LOAD_CRIT_STACK \
84 lis r8,CRIT_STACK_TOP@h; \
85 ori r8,r8,CRIT_STACK_TOP@l
86#define BOOKE_LOAD_MCHECK_STACK \
87 lis r8,MCHECK_STACK_TOP@h; \
88 ori r8,r8,MCHECK_STACK_TOP@l
89#endif
90
91/*
92 * Exception prolog for critical exceptions. This is a little different
93 * from the normal exception prolog above since a critical exception
94 * can potentially occur at any point during normal exception processing.
95 * Thus we cannot use the same SPRG registers as the normal prolog above.
96 * Instead we use a portion of the critical exception stack at low physical
97 * addresses.
98 */
99
100#define CRITICAL_EXCEPTION_PROLOG \
101 mtspr CRIT_SPRG,r8; \
102 BOOKE_LOAD_CRIT_STACK; /* r8 points to the crit stack */ \
103 stw r10,GPR10-INT_FRAME_SIZE(r8); \
104 stw r11,GPR11-INT_FRAME_SIZE(r8); \
105 mfcr r10; /* save CR in r10 for now */\
106 mfspr r11,SPRN_CSRR1; /* check whether user or kernel */\
107 andi. r11,r11,MSR_PR; \
108 mr r11,r8; \
109 mfspr r8,CRIT_SPRG; \
110 beq 1f; \
111 /* COMING FROM USER MODE */ \
112 mfspr r11,SPRN_SPRG3; /* if from user, start at top of */\
113 lwz r11,THREAD_INFO-THREAD(r11); /* this thread's kernel stack */\
114 addi r11,r11,THREAD_SIZE; \
1151: subi r11,r11,INT_FRAME_SIZE; /* Allocate an exception frame */\
116 stw r10,_CCR(r11); /* save various registers */\
117 stw r12,GPR12(r11); \
118 stw r9,GPR9(r11); \
119 mflr r10; \
120 stw r10,_LINK(r11); \
121 mfspr r12,SPRN_DEAR; /* save DEAR and ESR in the frame */\
122 stw r12,_DEAR(r11); /* since they may have had stuff */\
123 mfspr r9,SPRN_ESR; /* in them at the point where the */\
124 stw r9,_ESR(r11); /* exception was taken */\
125 mfspr r12,SPRN_CSRR0; \
126 stw r1,GPR1(r11); \
127 mfspr r9,SPRN_CSRR1; \
128 stw r1,0(r11); \
129 mr r1,r11; \
130 rlwinm r9,r9,0,14,12; /* clear MSR_WE (necessary?) */\
131 stw r0,GPR0(r11); \
132 SAVE_4GPRS(3, r11); \
133 SAVE_2GPRS(7, r11)
134
135/*
136 * Exception prolog for machine check exceptions. This is similar to
137 * the critical exception prolog, except that machine check exceptions
138 * have their stack.
139 */
140#define MCHECK_EXCEPTION_PROLOG \
141 mtspr MCHECK_SPRG,r8; \
142 BOOKE_LOAD_MCHECK_STACK; /* r8 points to the mcheck stack */\
143 stw r10,GPR10-INT_FRAME_SIZE(r8); \
144 stw r11,GPR11-INT_FRAME_SIZE(r8); \
145 mfcr r10; /* save CR in r10 for now */\
146 mfspr r11,SPRN_MCSRR1; /* check whether user or kernel */\
147 andi. r11,r11,MSR_PR; \
148 mr r11,r8; \
149 mfspr r8,MCHECK_SPRG; \
150 beq 1f; \
151 /* COMING FROM USER MODE */ \
152 mfspr r11,SPRN_SPRG3; /* if from user, start at top of */\
153 lwz r11,THREAD_INFO-THREAD(r11); /* this thread's kernel stack */\
154 addi r11,r11,THREAD_SIZE; \
1551: subi r11,r11,INT_FRAME_SIZE; /* Allocate an exception frame */\
156 stw r10,_CCR(r11); /* save various registers */\
157 stw r12,GPR12(r11); \
158 stw r9,GPR9(r11); \
159 mflr r10; \
160 stw r10,_LINK(r11); \
161 mfspr r12,SPRN_DEAR; /* save DEAR and ESR in the frame */\
162 stw r12,_DEAR(r11); /* since they may have had stuff */\
163 mfspr r9,SPRN_ESR; /* in them at the point where the */\
164 stw r9,_ESR(r11); /* exception was taken */\
165 mfspr r12,SPRN_MCSRR0; \
166 stw r1,GPR1(r11); \
167 mfspr r9,SPRN_MCSRR1; \
168 stw r1,0(r11); \
169 mr r1,r11; \
170 rlwinm r9,r9,0,14,12; /* clear MSR_WE (necessary?) */\
171 stw r0,GPR0(r11); \
172 SAVE_4GPRS(3, r11); \
173 SAVE_2GPRS(7, r11)
174
175/*
176 * Exception vectors.
177 */
178#define START_EXCEPTION(label) \
179 .align 5; \
180label:
181
182#define FINISH_EXCEPTION(func) \
183 bl transfer_to_handler_full; \
184 .long func; \
185 .long ret_from_except_full
186
187#define EXCEPTION(n, label, hdlr, xfer) \
188 START_EXCEPTION(label); \
189 NORMAL_EXCEPTION_PROLOG; \
190 addi r3,r1,STACK_FRAME_OVERHEAD; \
191 xfer(n, hdlr)
192
193#define CRITICAL_EXCEPTION(n, label, hdlr) \
194 START_EXCEPTION(label); \
195 CRITICAL_EXCEPTION_PROLOG; \
196 addi r3,r1,STACK_FRAME_OVERHEAD; \
197 EXC_XFER_TEMPLATE(hdlr, n+2, (MSR_KERNEL & ~(MSR_ME|MSR_DE|MSR_CE)), \
198 NOCOPY, crit_transfer_to_handler, \
199 ret_from_crit_exc)
200
201#define MCHECK_EXCEPTION(n, label, hdlr) \
202 START_EXCEPTION(label); \
203 MCHECK_EXCEPTION_PROLOG; \
204 mfspr r5,SPRN_ESR; \
205 stw r5,_ESR(r11); \
206 addi r3,r1,STACK_FRAME_OVERHEAD; \
207 EXC_XFER_TEMPLATE(hdlr, n+2, (MSR_KERNEL & ~(MSR_ME|MSR_DE|MSR_CE)), \
208 NOCOPY, mcheck_transfer_to_handler, \
209 ret_from_mcheck_exc)
210
211#define EXC_XFER_TEMPLATE(hdlr, trap, msr, copyee, tfer, ret) \
212 li r10,trap; \
213 stw r10,TRAP(r11); \
214 lis r10,msr@h; \
215 ori r10,r10,msr@l; \
216 copyee(r10, r9); \
217 bl tfer; \
218 .long hdlr; \
219 .long ret
220
221#define COPY_EE(d, s) rlwimi d,s,0,16,16
222#define NOCOPY(d, s)
223
224#define EXC_XFER_STD(n, hdlr) \
225 EXC_XFER_TEMPLATE(hdlr, n, MSR_KERNEL, NOCOPY, transfer_to_handler_full, \
226 ret_from_except_full)
227
228#define EXC_XFER_LITE(n, hdlr) \
229 EXC_XFER_TEMPLATE(hdlr, n+1, MSR_KERNEL, NOCOPY, transfer_to_handler, \
230 ret_from_except)
231
232#define EXC_XFER_EE(n, hdlr) \
233 EXC_XFER_TEMPLATE(hdlr, n, MSR_KERNEL, COPY_EE, transfer_to_handler_full, \
234 ret_from_except_full)
235
236#define EXC_XFER_EE_LITE(n, hdlr) \
237 EXC_XFER_TEMPLATE(hdlr, n+1, MSR_KERNEL, COPY_EE, transfer_to_handler, \
238 ret_from_except)
239
240
241/* Check for a single step debug exception while in an exception
242 * handler before state has been saved. This is to catch the case
243 * where an instruction that we are trying to single step causes
244 * an exception (eg ITLB/DTLB miss) and thus the first instruction of
245 * the exception handler generates a single step debug exception.
246 *
247 * If we get a debug trap on the first instruction of an exception handler,
248 * we reset the MSR_DE in the _exception handler's_ MSR (the debug trap is
249 * a critical exception, so we are using SPRN_CSRR1 to manipulate the MSR).
250 * The exception handler was handling a non-critical interrupt, so it will
251 * save (and later restore) the MSR via SPRN_CSRR1, which will still have
252 * the MSR_DE bit set.
253 */
254#define DEBUG_EXCEPTION \
255 START_EXCEPTION(Debug); \
256 CRITICAL_EXCEPTION_PROLOG; \
257 \
258 /* \
259 * If there is a single step or branch-taken exception in an \
260 * exception entry sequence, it was probably meant to apply to \
261 * the code where the exception occurred (since exception entry \
262 * doesn't turn off DE automatically). We simulate the effect \
263 * of turning off DE on entry to an exception handler by turning \
264 * off DE in the CSRR1 value and clearing the debug status. \
265 */ \
266 mfspr r10,SPRN_DBSR; /* check single-step/branch taken */ \
267 andis. r10,r10,DBSR_IC@h; \
268 beq+ 2f; \
269 \
270 lis r10,KERNELBASE@h; /* check if exception in vectors */ \
271 ori r10,r10,KERNELBASE@l; \
272 cmplw r12,r10; \
273 blt+ 2f; /* addr below exception vectors */ \
274 \
275 lis r10,Debug@h; \
276 ori r10,r10,Debug@l; \
277 cmplw r12,r10; \
278 bgt+ 2f; /* addr above exception vectors */ \
279 \
280 /* here it looks like we got an inappropriate debug exception. */ \
2811: rlwinm r9,r9,0,~MSR_DE; /* clear DE in the CSRR1 value */ \
282 lis r10,DBSR_IC@h; /* clear the IC event */ \
283 mtspr SPRN_DBSR,r10; \
284 /* restore state and get out */ \
285 lwz r10,_CCR(r11); \
286 lwz r0,GPR0(r11); \
287 lwz r1,GPR1(r11); \
288 mtcrf 0x80,r10; \
289 mtspr SPRN_CSRR0,r12; \
290 mtspr SPRN_CSRR1,r9; \
291 lwz r9,GPR9(r11); \
292 lwz r12,GPR12(r11); \
293 mtspr CRIT_SPRG,r8; \
294 BOOKE_LOAD_CRIT_STACK; /* r8 points to the crit stack */ \
295 lwz r10,GPR10-INT_FRAME_SIZE(r8); \
296 lwz r11,GPR11-INT_FRAME_SIZE(r8); \
297 mfspr r8,CRIT_SPRG; \
298 \
299 rfci; \
300 b .; \
301 \
302 /* continue normal handling for a critical exception... */ \
3032: mfspr r4,SPRN_DBSR; \
304 addi r3,r1,STACK_FRAME_OVERHEAD; \
305 EXC_XFER_TEMPLATE(DebugException, 0x2002, (MSR_KERNEL & ~(MSR_ME|MSR_DE|MSR_CE)), NOCOPY, crit_transfer_to_handler, ret_from_crit_exc)
306
307#define INSTRUCTION_STORAGE_EXCEPTION \
308 START_EXCEPTION(InstructionStorage) \
309 NORMAL_EXCEPTION_PROLOG; \
310 mfspr r5,SPRN_ESR; /* Grab the ESR and save it */ \
311 stw r5,_ESR(r11); \
312 mr r4,r12; /* Pass SRR0 as arg2 */ \
313 li r5,0; /* Pass zero as arg3 */ \
314 EXC_XFER_EE_LITE(0x0400, handle_page_fault)
315
316#define ALIGNMENT_EXCEPTION \
317 START_EXCEPTION(Alignment) \
318 NORMAL_EXCEPTION_PROLOG; \
319 mfspr r4,SPRN_DEAR; /* Grab the DEAR and save it */ \
320 stw r4,_DEAR(r11); \
321 addi r3,r1,STACK_FRAME_OVERHEAD; \
322 EXC_XFER_EE(0x0600, AlignmentException)
323
324#define PROGRAM_EXCEPTION \
325 START_EXCEPTION(Program) \
326 NORMAL_EXCEPTION_PROLOG; \
327 mfspr r4,SPRN_ESR; /* Grab the ESR and save it */ \
328 stw r4,_ESR(r11); \
329 addi r3,r1,STACK_FRAME_OVERHEAD; \
330 EXC_XFER_STD(0x0700, ProgramCheckException)
331
332#define DECREMENTER_EXCEPTION \
333 START_EXCEPTION(Decrementer) \
334 NORMAL_EXCEPTION_PROLOG; \
335 lis r0,TSR_DIS@h; /* Setup the DEC interrupt mask */ \
336 mtspr SPRN_TSR,r0; /* Clear the DEC interrupt */ \
337 addi r3,r1,STACK_FRAME_OVERHEAD; \
338 EXC_XFER_LITE(0x0900, timer_interrupt)
339
340#endif /* __HEAD_BOOKE_H__ */
diff --git a/arch/ppc/kernel/head_fsl_booke.S b/arch/ppc/kernel/head_fsl_booke.S
new file mode 100644
index 000000000000..dea19c216fc3
--- /dev/null
+++ b/arch/ppc/kernel/head_fsl_booke.S
@@ -0,0 +1,952 @@
1/*
2 * arch/ppc/kernel/head_fsl_booke.S
3 *
4 * Kernel execution entry point code.
5 *
6 * Copyright (c) 1995-1996 Gary Thomas <gdt@linuxppc.org>
7 * Initial PowerPC version.
8 * Copyright (c) 1996 Cort Dougan <cort@cs.nmt.edu>
9 * Rewritten for PReP
10 * Copyright (c) 1996 Paul Mackerras <paulus@cs.anu.edu.au>
11 * Low-level exception handers, MMU support, and rewrite.
12 * Copyright (c) 1997 Dan Malek <dmalek@jlc.net>
13 * PowerPC 8xx modifications.
14 * Copyright (c) 1998-1999 TiVo, Inc.
15 * PowerPC 403GCX modifications.
16 * Copyright (c) 1999 Grant Erickson <grant@lcse.umn.edu>
17 * PowerPC 403GCX/405GP modifications.
18 * Copyright 2000 MontaVista Software Inc.
19 * PPC405 modifications
20 * PowerPC 403GCX/405GP modifications.
21 * Author: MontaVista Software, Inc.
22 * frank_rowand@mvista.com or source@mvista.com
23 * debbie_chu@mvista.com
24 * Copyright 2002-2004 MontaVista Software, Inc.
25 * PowerPC 44x support, Matt Porter <mporter@kernel.crashing.org>
26 * Copyright 2004 Freescale Semiconductor, Inc
27 * PowerPC e500 modifications, Kumar Gala <kumar.gala@freescale.com>
28 *
29 * This program is free software; you can redistribute it and/or modify it
30 * under the terms of the GNU General Public License as published by the
31 * Free Software Foundation; either version 2 of the License, or (at your
32 * option) any later version.
33 */
34
35#include <linux/config.h>
36#include <linux/threads.h>
37#include <asm/processor.h>
38#include <asm/page.h>
39#include <asm/mmu.h>
40#include <asm/pgtable.h>
41#include <asm/cputable.h>
42#include <asm/thread_info.h>
43#include <asm/ppc_asm.h>
44#include <asm/offsets.h>
45#include "head_booke.h"
46
47/* As with the other PowerPC ports, it is expected that when code
48 * execution begins here, the following registers contain valid, yet
49 * optional, information:
50 *
51 * r3 - Board info structure pointer (DRAM, frequency, MAC address, etc.)
52 * r4 - Starting address of the init RAM disk
53 * r5 - Ending address of the init RAM disk
54 * r6 - Start of kernel command line string (e.g. "mem=128")
55 * r7 - End of kernel command line string
56 *
57 */
58 .text
59_GLOBAL(_stext)
60_GLOBAL(_start)
61 /*
62 * Reserve a word at a fixed location to store the address
63 * of abatron_pteptrs
64 */
65 nop
66/*
67 * Save parameters we are passed
68 */
69 mr r31,r3
70 mr r30,r4
71 mr r29,r5
72 mr r28,r6
73 mr r27,r7
74 li r24,0 /* CPU number */
75
76/* We try to not make any assumptions about how the boot loader
77 * setup or used the TLBs. We invalidate all mappings from the
78 * boot loader and load a single entry in TLB1[0] to map the
79 * first 16M of kernel memory. Any boot info passed from the
80 * bootloader needs to live in this first 16M.
81 *
82 * Requirement on bootloader:
83 * - The page we're executing in needs to reside in TLB1 and
84 * have IPROT=1. If not an invalidate broadcast could
85 * evict the entry we're currently executing in.
86 *
87 * r3 = Index of TLB1 were executing in
88 * r4 = Current MSR[IS]
89 * r5 = Index of TLB1 temp mapping
90 *
91 * Later in mapin_ram we will correctly map lowmem, and resize TLB1[0]
92 * if needed
93 */
94
95/* 1. Find the index of the entry we're executing in */
96 bl invstr /* Find our address */
97invstr: mflr r6 /* Make it accessible */
98 mfmsr r7
99 rlwinm r4,r7,27,31,31 /* extract MSR[IS] */
100 mfspr r7, SPRN_PID0
101 slwi r7,r7,16
102 or r7,r7,r4
103 mtspr SPRN_MAS6,r7
104 tlbsx 0,r6 /* search MSR[IS], SPID=PID0 */
105 mfspr r7,SPRN_MAS1
106 andis. r7,r7,MAS1_VALID@h
107 bne match_TLB
108 mfspr r7,SPRN_PID1
109 slwi r7,r7,16
110 or r7,r7,r4
111 mtspr SPRN_MAS6,r7
112 tlbsx 0,r6 /* search MSR[IS], SPID=PID1 */
113 mfspr r7,SPRN_MAS1
114 andis. r7,r7,MAS1_VALID@h
115 bne match_TLB
116 mfspr r7, SPRN_PID2
117 slwi r7,r7,16
118 or r7,r7,r4
119 mtspr SPRN_MAS6,r7
120 tlbsx 0,r6 /* Fall through, we had to match */
121match_TLB:
122 mfspr r7,SPRN_MAS0
123 rlwinm r3,r7,16,20,31 /* Extract MAS0(Entry) */
124
125 mfspr r7,SPRN_MAS1 /* Insure IPROT set */
126 oris r7,r7,MAS1_IPROT@h
127 mtspr SPRN_MAS1,r7
128 tlbwe
129
130/* 2. Invalidate all entries except the entry we're executing in */
131 mfspr r9,SPRN_TLB1CFG
132 andi. r9,r9,0xfff
133 li r6,0 /* Set Entry counter to 0 */
1341: lis r7,0x1000 /* Set MAS0(TLBSEL) = 1 */
135 rlwimi r7,r6,16,4,15 /* Setup MAS0 = TLBSEL | ESEL(r6) */
136 mtspr SPRN_MAS0,r7
137 tlbre
138 mfspr r7,SPRN_MAS1
139 rlwinm r7,r7,0,2,31 /* Clear MAS1 Valid and IPROT */
140 cmpw r3,r6
141 beq skpinv /* Dont update the current execution TLB */
142 mtspr SPRN_MAS1,r7
143 tlbwe
144 isync
145skpinv: addi r6,r6,1 /* Increment */
146 cmpw r6,r9 /* Are we done? */
147 bne 1b /* If not, repeat */
148
149 /* Invalidate TLB0 */
150 li r6,0x04
151 tlbivax 0,r6
152#ifdef CONFIG_SMP
153 tlbsync
154#endif
155 /* Invalidate TLB1 */
156 li r6,0x0c
157 tlbivax 0,r6
158#ifdef CONFIG_SMP
159 tlbsync
160#endif
161 msync
162
163/* 3. Setup a temp mapping and jump to it */
164 andi. r5, r3, 0x1 /* Find an entry not used and is non-zero */
165 addi r5, r5, 0x1
166 lis r7,0x1000 /* Set MAS0(TLBSEL) = 1 */
167 rlwimi r7,r3,16,4,15 /* Setup MAS0 = TLBSEL | ESEL(r3) */
168 mtspr SPRN_MAS0,r7
169 tlbre
170
171 /* Just modify the entry ID and EPN for the temp mapping */
172 lis r7,0x1000 /* Set MAS0(TLBSEL) = 1 */
173 rlwimi r7,r5,16,4,15 /* Setup MAS0 = TLBSEL | ESEL(r5) */
174 mtspr SPRN_MAS0,r7
175 xori r6,r4,1 /* Setup TMP mapping in the other Address space */
176 slwi r6,r6,12
177 oris r6,r6,(MAS1_VALID|MAS1_IPROT)@h
178 ori r6,r6,(MAS1_TSIZE(BOOKE_PAGESZ_4K))@l
179 mtspr SPRN_MAS1,r6
180 mfspr r6,SPRN_MAS2
181 li r7,0 /* temp EPN = 0 */
182 rlwimi r7,r6,0,20,31
183 mtspr SPRN_MAS2,r7
184 tlbwe
185
186 xori r6,r4,1
187 slwi r6,r6,5 /* setup new context with other address space */
188 bl 1f /* Find our address */
1891: mflr r9
190 rlwimi r7,r9,0,20,31
191 addi r7,r7,24
192 mtspr SPRN_SRR0,r7
193 mtspr SPRN_SRR1,r6
194 rfi
195
196/* 4. Clear out PIDs & Search info */
197 li r6,0
198 mtspr SPRN_PID0,r6
199 mtspr SPRN_PID1,r6
200 mtspr SPRN_PID2,r6
201 mtspr SPRN_MAS6,r6
202
203/* 5. Invalidate mapping we started in */
204 lis r7,0x1000 /* Set MAS0(TLBSEL) = 1 */
205 rlwimi r7,r3,16,4,15 /* Setup MAS0 = TLBSEL | ESEL(r3) */
206 mtspr SPRN_MAS0,r7
207 tlbre
208 li r6,0
209 mtspr SPRN_MAS1,r6
210 tlbwe
211 /* Invalidate TLB1 */
212 li r9,0x0c
213 tlbivax 0,r9
214#ifdef CONFIG_SMP
215 tlbsync
216#endif
217 msync
218
219/* 6. Setup KERNELBASE mapping in TLB1[0] */
220 lis r6,0x1000 /* Set MAS0(TLBSEL) = TLB1(1), ESEL = 0 */
221 mtspr SPRN_MAS0,r6
222 lis r6,(MAS1_VALID|MAS1_IPROT)@h
223 ori r6,r6,(MAS1_TSIZE(BOOKE_PAGESZ_16M))@l
224 mtspr SPRN_MAS1,r6
225 li r7,0
226 lis r6,KERNELBASE@h
227 ori r6,r6,KERNELBASE@l
228 rlwimi r6,r7,0,20,31
229 mtspr SPRN_MAS2,r6
230 li r7,(MAS3_SX|MAS3_SW|MAS3_SR)
231 mtspr SPRN_MAS3,r7
232 tlbwe
233
234/* 7. Jump to KERNELBASE mapping */
235 li r7,0
236 bl 1f /* Find our address */
2371: mflr r9
238 rlwimi r6,r9,0,20,31
239 addi r6,r6,24
240 mtspr SPRN_SRR0,r6
241 mtspr SPRN_SRR1,r7
242 rfi /* start execution out of TLB1[0] entry */
243
244/* 8. Clear out the temp mapping */
245 lis r7,0x1000 /* Set MAS0(TLBSEL) = 1 */
246 rlwimi r7,r5,16,4,15 /* Setup MAS0 = TLBSEL | ESEL(r5) */
247 mtspr SPRN_MAS0,r7
248 tlbre
249 mtspr SPRN_MAS1,r8
250 tlbwe
251 /* Invalidate TLB1 */
252 li r9,0x0c
253 tlbivax 0,r9
254#ifdef CONFIG_SMP
255 tlbsync
256#endif
257 msync
258
259 /* Establish the interrupt vector offsets */
260 SET_IVOR(0, CriticalInput);
261 SET_IVOR(1, MachineCheck);
262 SET_IVOR(2, DataStorage);
263 SET_IVOR(3, InstructionStorage);
264 SET_IVOR(4, ExternalInput);
265 SET_IVOR(5, Alignment);
266 SET_IVOR(6, Program);
267 SET_IVOR(7, FloatingPointUnavailable);
268 SET_IVOR(8, SystemCall);
269 SET_IVOR(9, AuxillaryProcessorUnavailable);
270 SET_IVOR(10, Decrementer);
271 SET_IVOR(11, FixedIntervalTimer);
272 SET_IVOR(12, WatchdogTimer);
273 SET_IVOR(13, DataTLBError);
274 SET_IVOR(14, InstructionTLBError);
275 SET_IVOR(15, Debug);
276 SET_IVOR(32, SPEUnavailable);
277 SET_IVOR(33, SPEFloatingPointData);
278 SET_IVOR(34, SPEFloatingPointRound);
279 SET_IVOR(35, PerformanceMonitor);
280
281 /* Establish the interrupt vector base */
282 lis r4,interrupt_base@h /* IVPR only uses the high 16-bits */
283 mtspr SPRN_IVPR,r4
284
285 /* Setup the defaults for TLB entries */
286 li r2,(MAS4_TSIZED(BOOKE_PAGESZ_4K))@l
287 mtspr SPRN_MAS4, r2
288
289#if 0
290 /* Enable DOZE */
291 mfspr r2,SPRN_HID0
292 oris r2,r2,HID0_DOZE@h
293 mtspr SPRN_HID0, r2
294#endif
295
296 /*
297 * This is where the main kernel code starts.
298 */
299
300 /* ptr to current */
301 lis r2,init_task@h
302 ori r2,r2,init_task@l
303
304 /* ptr to current thread */
305 addi r4,r2,THREAD /* init task's THREAD */
306 mtspr SPRN_SPRG3,r4
307
308 /* stack */
309 lis r1,init_thread_union@h
310 ori r1,r1,init_thread_union@l
311 li r0,0
312 stwu r0,THREAD_SIZE-STACK_FRAME_OVERHEAD(r1)
313
314 bl early_init
315
316 mfspr r3,SPRN_TLB1CFG
317 andi. r3,r3,0xfff
318 lis r4,num_tlbcam_entries@ha
319 stw r3,num_tlbcam_entries@l(r4)
320/*
321 * Decide what sort of machine this is and initialize the MMU.
322 */
323 mr r3,r31
324 mr r4,r30
325 mr r5,r29
326 mr r6,r28
327 mr r7,r27
328 bl machine_init
329 bl MMU_init
330
331 /* Setup PTE pointers for the Abatron bdiGDB */
332 lis r6, swapper_pg_dir@h
333 ori r6, r6, swapper_pg_dir@l
334 lis r5, abatron_pteptrs@h
335 ori r5, r5, abatron_pteptrs@l
336 lis r4, KERNELBASE@h
337 ori r4, r4, KERNELBASE@l
338 stw r5, 0(r4) /* Save abatron_pteptrs at a fixed location */
339 stw r6, 0(r5)
340
341 /* Let's move on */
342 lis r4,start_kernel@h
343 ori r4,r4,start_kernel@l
344 lis r3,MSR_KERNEL@h
345 ori r3,r3,MSR_KERNEL@l
346 mtspr SPRN_SRR0,r4
347 mtspr SPRN_SRR1,r3
348 rfi /* change context and jump to start_kernel */
349
350/*
351 * Interrupt vector entry code
352 *
353 * The Book E MMUs are always on so we don't need to handle
354 * interrupts in real mode as with previous PPC processors. In
355 * this case we handle interrupts in the kernel virtual address
356 * space.
357 *
358 * Interrupt vectors are dynamically placed relative to the
359 * interrupt prefix as determined by the address of interrupt_base.
360 * The interrupt vectors offsets are programmed using the labels
361 * for each interrupt vector entry.
362 *
363 * Interrupt vectors must be aligned on a 16 byte boundary.
364 * We align on a 32 byte cache line boundary for good measure.
365 */
366
367interrupt_base:
368 /* Critical Input Interrupt */
369 CRITICAL_EXCEPTION(0x0100, CriticalInput, UnknownException)
370
371 /* Machine Check Interrupt */
372 MCHECK_EXCEPTION(0x0200, MachineCheck, MachineCheckException)
373
374 /* Data Storage Interrupt */
375 START_EXCEPTION(DataStorage)
376 mtspr SPRN_SPRG0, r10 /* Save some working registers */
377 mtspr SPRN_SPRG1, r11
378 mtspr SPRN_SPRG4W, r12
379 mtspr SPRN_SPRG5W, r13
380 mfcr r11
381 mtspr SPRN_SPRG7W, r11
382
383 /*
384 * Check if it was a store fault, if not then bail
385 * because a user tried to access a kernel or
386 * read-protected page. Otherwise, get the
387 * offending address and handle it.
388 */
389 mfspr r10, SPRN_ESR
390 andis. r10, r10, ESR_ST@h
391 beq 2f
392
393 mfspr r10, SPRN_DEAR /* Get faulting address */
394
395 /* If we are faulting a kernel address, we have to use the
396 * kernel page tables.
397 */
398 lis r11, TASK_SIZE@h
399 ori r11, r11, TASK_SIZE@l
400 cmplw 0, r10, r11
401 bge 2f
402
403 /* Get the PGD for the current thread */
4043:
405 mfspr r11,SPRN_SPRG3
406 lwz r11,PGDIR(r11)
4074:
408 rlwimi r11, r10, 12, 20, 29 /* Create L1 (pgdir/pmd) address */
409 lwz r11, 0(r11) /* Get L1 entry */
410 rlwinm. r12, r11, 0, 0, 19 /* Extract L2 (pte) base address */
411 beq 2f /* Bail if no table */
412
413 rlwimi r12, r10, 22, 20, 29 /* Compute PTE address */
414 lwz r11, 0(r12) /* Get Linux PTE */
415
416 /* Are _PAGE_USER & _PAGE_RW set & _PAGE_HWWRITE not? */
417 andi. r13, r11, _PAGE_RW|_PAGE_USER|_PAGE_HWWRITE
418 cmpwi 0, r13, _PAGE_RW|_PAGE_USER
419 bne 2f /* Bail if not */
420
421 /* Update 'changed'. */
422 ori r11, r11, _PAGE_DIRTY|_PAGE_ACCESSED|_PAGE_HWWRITE
423 stw r11, 0(r12) /* Update Linux page table */
424
425 /* MAS2 not updated as the entry does exist in the tlb, this
426 fault taken to detect state transition (eg: COW -> DIRTY)
427 */
428 lis r12, MAS3_RPN@h
429 ori r12, r12, _PAGE_HWEXEC | MAS3_RPN@l
430 and r11, r11, r12
431 rlwimi r11, r11, 31, 27, 27 /* SX <- _PAGE_HWEXEC */
432 ori r11, r11, (MAS3_UW|MAS3_SW|MAS3_UR|MAS3_SR)@l /* set static perms */
433
434 /* update search PID in MAS6, AS = 0 */
435 mfspr r12, SPRN_PID0
436 slwi r12, r12, 16
437 mtspr SPRN_MAS6, r12
438
439 /* find the TLB index that caused the fault. It has to be here. */
440 tlbsx 0, r10
441
442 mtspr SPRN_MAS3,r11
443 tlbwe
444
445 /* Done...restore registers and get out of here. */
446 mfspr r11, SPRN_SPRG7R
447 mtcr r11
448 mfspr r13, SPRN_SPRG5R
449 mfspr r12, SPRN_SPRG4R
450 mfspr r11, SPRN_SPRG1
451 mfspr r10, SPRN_SPRG0
452 rfi /* Force context change */
453
4542:
455 /*
456 * The bailout. Restore registers to pre-exception conditions
457 * and call the heavyweights to help us out.
458 */
459 mfspr r11, SPRN_SPRG7R
460 mtcr r11
461 mfspr r13, SPRN_SPRG5R
462 mfspr r12, SPRN_SPRG4R
463 mfspr r11, SPRN_SPRG1
464 mfspr r10, SPRN_SPRG0
465 b data_access
466
467 /* Instruction Storage Interrupt */
468 INSTRUCTION_STORAGE_EXCEPTION
469
470 /* External Input Interrupt */
471 EXCEPTION(0x0500, ExternalInput, do_IRQ, EXC_XFER_LITE)
472
473 /* Alignment Interrupt */
474 ALIGNMENT_EXCEPTION
475
476 /* Program Interrupt */
477 PROGRAM_EXCEPTION
478
479 /* Floating Point Unavailable Interrupt */
480 EXCEPTION(0x0800, FloatingPointUnavailable, UnknownException, EXC_XFER_EE)
481
482 /* System Call Interrupt */
483 START_EXCEPTION(SystemCall)
484 NORMAL_EXCEPTION_PROLOG
485 EXC_XFER_EE_LITE(0x0c00, DoSyscall)
486
487 /* Auxillary Processor Unavailable Interrupt */
488 EXCEPTION(0x2900, AuxillaryProcessorUnavailable, UnknownException, EXC_XFER_EE)
489
490 /* Decrementer Interrupt */
491 DECREMENTER_EXCEPTION
492
493 /* Fixed Internal Timer Interrupt */
494 /* TODO: Add FIT support */
495 EXCEPTION(0x3100, FixedIntervalTimer, UnknownException, EXC_XFER_EE)
496
497 /* Watchdog Timer Interrupt */
498 /* TODO: Add watchdog support */
499 CRITICAL_EXCEPTION(0x3200, WatchdogTimer, UnknownException)
500
501 /* Data TLB Error Interrupt */
502 START_EXCEPTION(DataTLBError)
503 mtspr SPRN_SPRG0, r10 /* Save some working registers */
504 mtspr SPRN_SPRG1, r11
505 mtspr SPRN_SPRG4W, r12
506 mtspr SPRN_SPRG5W, r13
507 mfcr r11
508 mtspr SPRN_SPRG7W, r11
509 mfspr r10, SPRN_DEAR /* Get faulting address */
510
511 /* If we are faulting a kernel address, we have to use the
512 * kernel page tables.
513 */
514 lis r11, TASK_SIZE@h
515 ori r11, r11, TASK_SIZE@l
516 cmplw 5, r10, r11
517 blt 5, 3f
518 lis r11, swapper_pg_dir@h
519 ori r11, r11, swapper_pg_dir@l
520
521 mfspr r12,SPRN_MAS1 /* Set TID to 0 */
522 rlwinm r12,r12,0,16,1
523 mtspr SPRN_MAS1,r12
524
525 b 4f
526
527 /* Get the PGD for the current thread */
5283:
529 mfspr r11,SPRN_SPRG3
530 lwz r11,PGDIR(r11)
531
5324:
533 rlwimi r11, r10, 12, 20, 29 /* Create L1 (pgdir/pmd) address */
534 lwz r11, 0(r11) /* Get L1 entry */
535 rlwinm. r12, r11, 0, 0, 19 /* Extract L2 (pte) base address */
536 beq 2f /* Bail if no table */
537
538 rlwimi r12, r10, 22, 20, 29 /* Compute PTE address */
539 lwz r11, 0(r12) /* Get Linux PTE */
540 andi. r13, r11, _PAGE_PRESENT
541 beq 2f
542
543 ori r11, r11, _PAGE_ACCESSED
544 stw r11, 0(r12)
545
546 /* Jump to common tlb load */
547 b finish_tlb_load
5482:
549 /* The bailout. Restore registers to pre-exception conditions
550 * and call the heavyweights to help us out.
551 */
552 mfspr r11, SPRN_SPRG7R
553 mtcr r11
554 mfspr r13, SPRN_SPRG5R
555 mfspr r12, SPRN_SPRG4R
556 mfspr r11, SPRN_SPRG1
557 mfspr r10, SPRN_SPRG0
558 b data_access
559
560 /* Instruction TLB Error Interrupt */
561 /*
562 * Nearly the same as above, except we get our
563 * information from different registers and bailout
564 * to a different point.
565 */
566 START_EXCEPTION(InstructionTLBError)
567 mtspr SPRN_SPRG0, r10 /* Save some working registers */
568 mtspr SPRN_SPRG1, r11
569 mtspr SPRN_SPRG4W, r12
570 mtspr SPRN_SPRG5W, r13
571 mfcr r11
572 mtspr SPRN_SPRG7W, r11
573 mfspr r10, SPRN_SRR0 /* Get faulting address */
574
575 /* If we are faulting a kernel address, we have to use the
576 * kernel page tables.
577 */
578 lis r11, TASK_SIZE@h
579 ori r11, r11, TASK_SIZE@l
580 cmplw 5, r10, r11
581 blt 5, 3f
582 lis r11, swapper_pg_dir@h
583 ori r11, r11, swapper_pg_dir@l
584
585 mfspr r12,SPRN_MAS1 /* Set TID to 0 */
586 rlwinm r12,r12,0,16,1
587 mtspr SPRN_MAS1,r12
588
589 b 4f
590
591 /* Get the PGD for the current thread */
5923:
593 mfspr r11,SPRN_SPRG3
594 lwz r11,PGDIR(r11)
595
5964:
597 rlwimi r11, r10, 12, 20, 29 /* Create L1 (pgdir/pmd) address */
598 lwz r11, 0(r11) /* Get L1 entry */
599 rlwinm. r12, r11, 0, 0, 19 /* Extract L2 (pte) base address */
600 beq 2f /* Bail if no table */
601
602 rlwimi r12, r10, 22, 20, 29 /* Compute PTE address */
603 lwz r11, 0(r12) /* Get Linux PTE */
604 andi. r13, r11, _PAGE_PRESENT
605 beq 2f
606
607 ori r11, r11, _PAGE_ACCESSED
608 stw r11, 0(r12)
609
610 /* Jump to common TLB load point */
611 b finish_tlb_load
612
6132:
614 /* The bailout. Restore registers to pre-exception conditions
615 * and call the heavyweights to help us out.
616 */
617 mfspr r11, SPRN_SPRG7R
618 mtcr r11
619 mfspr r13, SPRN_SPRG5R
620 mfspr r12, SPRN_SPRG4R
621 mfspr r11, SPRN_SPRG1
622 mfspr r10, SPRN_SPRG0
623 b InstructionStorage
624
625#ifdef CONFIG_SPE
626 /* SPE Unavailable */
627 START_EXCEPTION(SPEUnavailable)
628 NORMAL_EXCEPTION_PROLOG
629 bne load_up_spe
630 addi r3,r1,STACK_FRAME_OVERHEAD
631 EXC_XFER_EE_LITE(0x2010, KernelSPE)
632#else
633 EXCEPTION(0x2020, SPEUnavailable, UnknownException, EXC_XFER_EE)
634#endif /* CONFIG_SPE */
635
636 /* SPE Floating Point Data */
637#ifdef CONFIG_SPE
638 EXCEPTION(0x2030, SPEFloatingPointData, SPEFloatingPointException, EXC_XFER_EE);
639#else
640 EXCEPTION(0x2040, SPEFloatingPointData, UnknownException, EXC_XFER_EE)
641#endif /* CONFIG_SPE */
642
643 /* SPE Floating Point Round */
644 EXCEPTION(0x2050, SPEFloatingPointRound, UnknownException, EXC_XFER_EE)
645
646 /* Performance Monitor */
647 EXCEPTION(0x2060, PerformanceMonitor, PerformanceMonitorException, EXC_XFER_STD)
648
649
650 /* Debug Interrupt */
651 DEBUG_EXCEPTION
652
653/*
654 * Local functions
655 */
656 /*
657 * Data TLB exceptions will bail out to this point
658 * if they can't resolve the lightweight TLB fault.
659 */
660data_access:
661 NORMAL_EXCEPTION_PROLOG
662 mfspr r5,SPRN_ESR /* Grab the ESR, save it, pass arg3 */
663 stw r5,_ESR(r11)
664 mfspr r4,SPRN_DEAR /* Grab the DEAR, save it, pass arg2 */
665 andis. r10,r5,(ESR_ILK|ESR_DLK)@h
666 bne 1f
667 EXC_XFER_EE_LITE(0x0300, handle_page_fault)
6681:
669 addi r3,r1,STACK_FRAME_OVERHEAD
670 EXC_XFER_EE_LITE(0x0300, CacheLockingException)
671
672/*
673
674 * Both the instruction and data TLB miss get to this
675 * point to load the TLB.
676 * r10 - EA of fault
677 * r11 - TLB (info from Linux PTE)
678 * r12, r13 - available to use
679 * CR5 - results of addr < TASK_SIZE
680 * MAS0, MAS1 - loaded with proper value when we get here
681 * MAS2, MAS3 - will need additional info from Linux PTE
682 * Upon exit, we reload everything and RFI.
683 */
684finish_tlb_load:
685 /*
686 * We set execute, because we don't have the granularity to
687 * properly set this at the page level (Linux problem).
688 * Many of these bits are software only. Bits we don't set
689 * here we (properly should) assume have the appropriate value.
690 */
691
692 mfspr r12, SPRN_MAS2
693 rlwimi r12, r11, 26, 27, 31 /* extract WIMGE from pte */
694 mtspr SPRN_MAS2, r12
695
696 bge 5, 1f
697
698 /* addr > TASK_SIZE */
699 li r10, (MAS3_UX | MAS3_UW | MAS3_UR)
700 andi. r13, r11, (_PAGE_USER | _PAGE_HWWRITE | _PAGE_HWEXEC)
701 andi. r12, r11, _PAGE_USER /* Test for _PAGE_USER */
702 iseleq r12, 0, r10
703 and r10, r12, r13
704 srwi r12, r10, 1
705 or r12, r12, r10 /* Copy user perms into supervisor */
706 b 2f
707
708 /* addr <= TASK_SIZE */
7091: rlwinm r12, r11, 31, 29, 29 /* Extract _PAGE_HWWRITE into SW */
710 ori r12, r12, (MAS3_SX | MAS3_SR)
711
7122: rlwimi r11, r12, 0, 20, 31 /* Extract RPN from PTE and merge with perms */
713 mtspr SPRN_MAS3, r11
714 tlbwe
715
716 /* Done...restore registers and get out of here. */
717 mfspr r11, SPRN_SPRG7R
718 mtcr r11
719 mfspr r13, SPRN_SPRG5R
720 mfspr r12, SPRN_SPRG4R
721 mfspr r11, SPRN_SPRG1
722 mfspr r10, SPRN_SPRG0
723 rfi /* Force context change */
724
725#ifdef CONFIG_SPE
726/* Note that the SPE support is closely modeled after the AltiVec
727 * support. Changes to one are likely to be applicable to the
728 * other! */
729load_up_spe:
730/*
731 * Disable SPE for the task which had SPE previously,
732 * and save its SPE registers in its thread_struct.
733 * Enables SPE for use in the kernel on return.
734 * On SMP we know the SPE units are free, since we give it up every
735 * switch. -- Kumar
736 */
737 mfmsr r5
738 oris r5,r5,MSR_SPE@h
739 mtmsr r5 /* enable use of SPE now */
740 isync
741/*
742 * For SMP, we don't do lazy SPE switching because it just gets too
743 * horrendously complex, especially when a task switches from one CPU
744 * to another. Instead we call giveup_spe in switch_to.
745 */
746#ifndef CONFIG_SMP
747 lis r3,last_task_used_spe@ha
748 lwz r4,last_task_used_spe@l(r3)
749 cmpi 0,r4,0
750 beq 1f
751 addi r4,r4,THREAD /* want THREAD of last_task_used_spe */
752 SAVE_32EVR(0,r10,r4)
753 evxor evr10, evr10, evr10 /* clear out evr10 */
754 evmwumiaa evr10, evr10, evr10 /* evr10 <- ACC = 0 * 0 + ACC */
755 li r5,THREAD_ACC
756 evstddx evr10, r4, r5 /* save off accumulator */
757 lwz r5,PT_REGS(r4)
758 lwz r4,_MSR-STACK_FRAME_OVERHEAD(r5)
759 lis r10,MSR_SPE@h
760 andc r4,r4,r10 /* disable SPE for previous task */
761 stw r4,_MSR-STACK_FRAME_OVERHEAD(r5)
7621:
763#endif /* CONFIG_SMP */
764 /* enable use of SPE after return */
765 oris r9,r9,MSR_SPE@h
766 mfspr r5,SPRN_SPRG3 /* current task's THREAD (phys) */
767 li r4,1
768 li r10,THREAD_ACC
769 stw r4,THREAD_USED_SPE(r5)
770 evlddx evr4,r10,r5
771 evmra evr4,evr4
772 REST_32EVR(0,r10,r5)
773#ifndef CONFIG_SMP
774 subi r4,r5,THREAD
775 stw r4,last_task_used_spe@l(r3)
776#endif /* CONFIG_SMP */
777 /* restore registers and return */
7782: REST_4GPRS(3, r11)
779 lwz r10,_CCR(r11)
780 REST_GPR(1, r11)
781 mtcr r10
782 lwz r10,_LINK(r11)
783 mtlr r10
784 REST_GPR(10, r11)
785 mtspr SPRN_SRR1,r9
786 mtspr SPRN_SRR0,r12
787 REST_GPR(9, r11)
788 REST_GPR(12, r11)
789 lwz r11,GPR11(r11)
790 SYNC
791 rfi
792
793/*
794 * SPE unavailable trap from kernel - print a message, but let
795 * the task use SPE in the kernel until it returns to user mode.
796 */
797KernelSPE:
798 lwz r3,_MSR(r1)
799 oris r3,r3,MSR_SPE@h
800 stw r3,_MSR(r1) /* enable use of SPE after return */
801 lis r3,87f@h
802 ori r3,r3,87f@l
803 mr r4,r2 /* current */
804 lwz r5,_NIP(r1)
805 bl printk
806 b ret_from_except
80787: .string "SPE used in kernel (task=%p, pc=%x) \n"
808 .align 4,0
809
810#endif /* CONFIG_SPE */
811
812/*
813 * Global functions
814 */
815
816/*
817 * extern void loadcam_entry(unsigned int index)
818 *
819 * Load TLBCAM[index] entry in to the L2 CAM MMU
820 */
821_GLOBAL(loadcam_entry)
822 lis r4,TLBCAM@ha
823 addi r4,r4,TLBCAM@l
824 mulli r5,r3,20
825 add r3,r5,r4
826 lwz r4,0(r3)
827 mtspr SPRN_MAS0,r4
828 lwz r4,4(r3)
829 mtspr SPRN_MAS1,r4
830 lwz r4,8(r3)
831 mtspr SPRN_MAS2,r4
832 lwz r4,12(r3)
833 mtspr SPRN_MAS3,r4
834 tlbwe
835 isync
836 blr
837
838/*
839 * extern void giveup_altivec(struct task_struct *prev)
840 *
841 * The e500 core does not have an AltiVec unit.
842 */
843_GLOBAL(giveup_altivec)
844 blr
845
846#ifdef CONFIG_SPE
847/*
848 * extern void giveup_spe(struct task_struct *prev)
849 *
850 */
851_GLOBAL(giveup_spe)
852 mfmsr r5
853 oris r5,r5,MSR_SPE@h
854 SYNC
855 mtmsr r5 /* enable use of SPE now */
856 isync
857 cmpi 0,r3,0
858 beqlr- /* if no previous owner, done */
859 addi r3,r3,THREAD /* want THREAD of task */
860 lwz r5,PT_REGS(r3)
861 cmpi 0,r5,0
862 SAVE_32EVR(0, r4, r3)
863 evxor evr6, evr6, evr6 /* clear out evr6 */
864 evmwumiaa evr6, evr6, evr6 /* evr6 <- ACC = 0 * 0 + ACC */
865 li r4,THREAD_ACC
866 evstddx evr6, r4, r3 /* save off accumulator */
867 mfspr r6,SPRN_SPEFSCR
868 stw r6,THREAD_SPEFSCR(r3) /* save spefscr register value */
869 beq 1f
870 lwz r4,_MSR-STACK_FRAME_OVERHEAD(r5)
871 lis r3,MSR_SPE@h
872 andc r4,r4,r3 /* disable SPE for previous task */
873 stw r4,_MSR-STACK_FRAME_OVERHEAD(r5)
8741:
875#ifndef CONFIG_SMP
876 li r5,0
877 lis r4,last_task_used_spe@ha
878 stw r5,last_task_used_spe@l(r4)
879#endif /* CONFIG_SMP */
880 blr
881#endif /* CONFIG_SPE */
882
883/*
884 * extern void giveup_fpu(struct task_struct *prev)
885 *
886 * The e500 core does not have an FPU.
887 */
888_GLOBAL(giveup_fpu)
889 blr
890
891/*
892 * extern void abort(void)
893 *
894 * At present, this routine just applies a system reset.
895 */
896_GLOBAL(abort)
897 li r13,0
898 mtspr SPRN_DBCR0,r13 /* disable all debug events */
899 mfmsr r13
900 ori r13,r13,MSR_DE@l /* Enable Debug Events */
901 mtmsr r13
902 mfspr r13,SPRN_DBCR0
903 lis r13,(DBCR0_IDM|DBCR0_RST_CHIP)@h
904 mtspr SPRN_DBCR0,r13
905
906_GLOBAL(set_context)
907
908#ifdef CONFIG_BDI_SWITCH
909 /* Context switch the PTE pointer for the Abatron BDI2000.
910 * The PGDIR is the second parameter.
911 */
912 lis r5, abatron_pteptrs@h
913 ori r5, r5, abatron_pteptrs@l
914 stw r4, 0x4(r5)
915#endif
916 mtspr SPRN_PID,r3
917 isync /* Force context change */
918 blr
919
920/*
921 * We put a few things here that have to be page-aligned. This stuff
922 * goes at the beginning of the data segment, which is page-aligned.
923 */
924 .data
925_GLOBAL(sdata)
926_GLOBAL(empty_zero_page)
927 .space 4096
928_GLOBAL(swapper_pg_dir)
929 .space 4096
930
931/* Reserved 4k for the critical exception stack & 4k for the machine
932 * check stack per CPU for kernel mode exceptions */
933 .section .bss
934 .align 12
935exception_stack_bottom:
936 .space BOOKE_EXCEPTION_STACK_SIZE * NR_CPUS
937_GLOBAL(exception_stack_top)
938
939/*
940 * This space gets a copy of optional info passed to us by the bootstrap
941 * which is used to pass parameters into the kernel like root=/dev/sda1, etc.
942 */
943_GLOBAL(cmd_line)
944 .space 512
945
946/*
947 * Room for two PTE pointers, usually the kernel and current user pointers
948 * to their respective root page table.
949 */
950abatron_pteptrs:
951 .space 8
952
diff --git a/arch/ppc/kernel/idle.c b/arch/ppc/kernel/idle.c
new file mode 100644
index 000000000000..53547b6de45b
--- /dev/null
+++ b/arch/ppc/kernel/idle.c
@@ -0,0 +1,100 @@
1/*
2 * Idle daemon for PowerPC. Idle daemon will handle any action
3 * that needs to be taken when the system becomes idle.
4 *
5 * Written by Cort Dougan (cort@cs.nmt.edu). Subsequently hacked
6 * on by Tom Rini, Armin Kuster, Paul Mackerras and others.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
12 */
13#include <linux/config.h>
14#include <linux/errno.h>
15#include <linux/sched.h>
16#include <linux/kernel.h>
17#include <linux/mm.h>
18#include <linux/smp.h>
19#include <linux/smp_lock.h>
20#include <linux/stddef.h>
21#include <linux/unistd.h>
22#include <linux/ptrace.h>
23#include <linux/slab.h>
24#include <linux/sysctl.h>
25
26#include <asm/pgtable.h>
27#include <asm/uaccess.h>
28#include <asm/system.h>
29#include <asm/io.h>
30#include <asm/mmu.h>
31#include <asm/cache.h>
32#include <asm/cputable.h>
33#include <asm/machdep.h>
34
35void default_idle(void)
36{
37 void (*powersave)(void);
38
39 powersave = ppc_md.power_save;
40
41 if (!need_resched()) {
42 if (powersave != NULL)
43 powersave();
44#ifdef CONFIG_SMP
45 else {
46 set_thread_flag(TIF_POLLING_NRFLAG);
47 while (!need_resched())
48 barrier();
49 clear_thread_flag(TIF_POLLING_NRFLAG);
50 }
51#endif
52 }
53 if (need_resched())
54 schedule();
55}
56
57/*
58 * The body of the idle task.
59 */
60void cpu_idle(void)
61{
62 for (;;)
63 if (ppc_md.idle != NULL)
64 ppc_md.idle();
65 else
66 default_idle();
67}
68
69#if defined(CONFIG_SYSCTL) && defined(CONFIG_6xx)
70/*
71 * Register the sysctl to set/clear powersave_nap.
72 */
73extern unsigned long powersave_nap;
74
75static ctl_table powersave_nap_ctl_table[]={
76 {
77 .ctl_name = KERN_PPC_POWERSAVE_NAP,
78 .procname = "powersave-nap",
79 .data = &powersave_nap,
80 .maxlen = sizeof(int),
81 .mode = 0644,
82 .proc_handler = &proc_dointvec,
83 },
84 { 0, },
85};
86static ctl_table powersave_nap_sysctl_root[] = {
87 { 1, "kernel", NULL, 0, 0755, powersave_nap_ctl_table, },
88 { 0,},
89};
90
91static int __init
92register_powersave_nap_sysctl(void)
93{
94 register_sysctl_table(powersave_nap_sysctl_root, 0);
95
96 return 0;
97}
98
99__initcall(register_powersave_nap_sysctl);
100#endif
diff --git a/arch/ppc/kernel/idle_6xx.S b/arch/ppc/kernel/idle_6xx.S
new file mode 100644
index 000000000000..25d009c75f7b
--- /dev/null
+++ b/arch/ppc/kernel/idle_6xx.S
@@ -0,0 +1,233 @@
1/*
2 * This file contains the power_save function for 6xx & 7xxx CPUs
3 * rewritten in assembler
4 *
5 * Warning ! This code assumes that if your machine has a 750fx
6 * it will have PLL 1 set to low speed mode (used during NAP/DOZE).
7 * if this is not the case some additional changes will have to
8 * be done to check a runtime var (a bit like powersave-nap)
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version
13 * 2 of the License, or (at your option) any later version.
14 */
15
16#include <linux/config.h>
17#include <linux/threads.h>
18#include <asm/processor.h>
19#include <asm/page.h>
20#include <asm/cputable.h>
21#include <asm/thread_info.h>
22#include <asm/ppc_asm.h>
23#include <asm/offsets.h>
24
25#undef DEBUG
26
27 .text
28
29/*
30 * Init idle, called at early CPU setup time from head.S for each CPU
31 * Make sure no rest of NAP mode remains in HID0, save default
32 * values for some CPU specific registers. Called with r24
33 * containing CPU number and r3 reloc offset
34 */
35_GLOBAL(init_idle_6xx)
36BEGIN_FTR_SECTION
37 mfspr r4,SPRN_HID0
38 rlwinm r4,r4,0,10,8 /* Clear NAP */
39 mtspr SPRN_HID0, r4
40 b 1f
41END_FTR_SECTION_IFSET(CPU_FTR_CAN_NAP)
42 blr
431:
44 slwi r5,r24,2
45 add r5,r5,r3
46BEGIN_FTR_SECTION
47 mfspr r4,SPRN_MSSCR0
48 addis r6,r5, nap_save_msscr0@ha
49 stw r4,nap_save_msscr0@l(r6)
50END_FTR_SECTION_IFSET(CPU_FTR_NAP_DISABLE_L2_PR)
51BEGIN_FTR_SECTION
52 mfspr r4,SPRN_HID1
53 addis r6,r5,nap_save_hid1@ha
54 stw r4,nap_save_hid1@l(r6)
55END_FTR_SECTION_IFSET(CPU_FTR_DUAL_PLL_750FX)
56 blr
57
58/*
59 * Here is the power_save_6xx function. This could eventually be
60 * split into several functions & changing the function pointer
61 * depending on the various features.
62 */
63_GLOBAL(ppc6xx_idle)
64 /* Check if we can nap or doze, put HID0 mask in r3
65 */
66 lis r3, 0
67BEGIN_FTR_SECTION
68 lis r3,HID0_DOZE@h
69END_FTR_SECTION_IFSET(CPU_FTR_CAN_DOZE)
70BEGIN_FTR_SECTION
71 /* We must dynamically check for the NAP feature as it
72 * can be cleared by CPU init after the fixups are done
73 */
74 lis r4,cur_cpu_spec@ha
75 lwz r4,cur_cpu_spec@l(r4)
76 lwz r4,CPU_SPEC_FEATURES(r4)
77 andi. r0,r4,CPU_FTR_CAN_NAP
78 beq 1f
79 /* Now check if user or arch enabled NAP mode */
80 lis r4,powersave_nap@ha
81 lwz r4,powersave_nap@l(r4)
82 cmpwi 0,r4,0
83 beq 1f
84 lis r3,HID0_NAP@h
851:
86END_FTR_SECTION_IFSET(CPU_FTR_CAN_NAP)
87 cmpwi 0,r3,0
88 beqlr
89
90 /* Clear MSR:EE */
91 mfmsr r7
92 rlwinm r0,r7,0,17,15
93 mtmsr r0
94
95 /* Check current_thread_info()->flags */
96 rlwinm r4,r1,0,0,18
97 lwz r4,TI_FLAGS(r4)
98 andi. r0,r4,_TIF_NEED_RESCHED
99 beq 1f
100 mtmsr r7 /* out of line this ? */
101 blr
1021:
103 /* Some pre-nap cleanups needed on some CPUs */
104 andis. r0,r3,HID0_NAP@h
105 beq 2f
106BEGIN_FTR_SECTION
107 /* Disable L2 prefetch on some 745x and try to ensure
108 * L2 prefetch engines are idle. As explained by errata
109 * text, we can't be sure they are, we just hope very hard
110 * that well be enough (sic !). At least I noticed Apple
111 * doesn't even bother doing the dcbf's here...
112 */
113 mfspr r4,SPRN_MSSCR0
114 rlwinm r4,r4,0,0,29
115 sync
116 mtspr SPRN_MSSCR0,r4
117 sync
118 isync
119 lis r4,KERNELBASE@h
120 dcbf 0,r4
121 dcbf 0,r4
122 dcbf 0,r4
123 dcbf 0,r4
124END_FTR_SECTION_IFSET(CPU_FTR_NAP_DISABLE_L2_PR)
125#ifdef DEBUG
126 lis r6,nap_enter_count@ha
127 lwz r4,nap_enter_count@l(r6)
128 addi r4,r4,1
129 stw r4,nap_enter_count@l(r6)
130#endif
1312:
132BEGIN_FTR_SECTION
133 /* Go to low speed mode on some 750FX */
134 lis r4,powersave_lowspeed@ha
135 lwz r4,powersave_lowspeed@l(r4)
136 cmpwi 0,r4,0
137 beq 1f
138 mfspr r4,SPRN_HID1
139 oris r4,r4,0x0001
140 mtspr SPRN_HID1,r4
1411:
142END_FTR_SECTION_IFSET(CPU_FTR_DUAL_PLL_750FX)
143
144 /* Go to NAP or DOZE now */
145 mfspr r4,SPRN_HID0
146 lis r5,(HID0_NAP|HID0_SLEEP)@h
147BEGIN_FTR_SECTION
148 oris r5,r5,HID0_DOZE@h
149END_FTR_SECTION_IFSET(CPU_FTR_CAN_DOZE)
150 andc r4,r4,r5
151 or r4,r4,r3
152BEGIN_FTR_SECTION
153 oris r4,r4,HID0_DPM@h /* that should be done once for all */
154END_FTR_SECTION_IFCLR(CPU_FTR_NO_DPM)
155 mtspr SPRN_HID0,r4
156BEGIN_FTR_SECTION
157 DSSALL
158 sync
159END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
160 ori r7,r7,MSR_EE /* Could be ommited (already set) */
161 oris r7,r7,MSR_POW@h
162 sync
163 isync
164 mtmsr r7
165 isync
166 sync
167 blr
168
169/*
170 * Return from NAP/DOZE mode, restore some CPU specific registers,
171 * we are called with DR/IR still off and r2 containing physical
172 * address of current.
173 */
174_GLOBAL(power_save_6xx_restore)
175 mfspr r11,SPRN_HID0
176 rlwinm. r11,r11,0,10,8 /* Clear NAP & copy NAP bit !state to cr1 EQ */
177 cror 4*cr1+eq,4*cr0+eq,4*cr0+eq
178BEGIN_FTR_SECTION
179 rlwinm r11,r11,0,9,7 /* Clear DOZE */
180END_FTR_SECTION_IFSET(CPU_FTR_CAN_DOZE)
181 mtspr SPRN_HID0, r11
182
183#ifdef DEBUG
184 beq cr1,1f
185 lis r11,(nap_return_count-KERNELBASE)@ha
186 lwz r9,nap_return_count@l(r11)
187 addi r9,r9,1
188 stw r9,nap_return_count@l(r11)
1891:
190#endif
191
192 rlwinm r9,r1,0,0,18
193 tophys(r9,r9)
194 lwz r11,TI_CPU(r9)
195 slwi r11,r11,2
196 /* Todo make sure all these are in the same page
197 * and load r22 (@ha part + CPU offset) only once
198 */
199BEGIN_FTR_SECTION
200 beq cr1,1f
201 addis r9,r11,(nap_save_msscr0-KERNELBASE)@ha
202 lwz r9,nap_save_msscr0@l(r9)
203 mtspr SPRN_MSSCR0, r9
204 sync
205 isync
2061:
207END_FTR_SECTION_IFSET(CPU_FTR_NAP_DISABLE_L2_PR)
208BEGIN_FTR_SECTION
209 addis r9,r11,(nap_save_hid1-KERNELBASE)@ha
210 lwz r9,nap_save_hid1@l(r9)
211 mtspr SPRN_HID1, r9
212END_FTR_SECTION_IFSET(CPU_FTR_DUAL_PLL_750FX)
213 b transfer_to_handler_cont
214
215 .data
216
217_GLOBAL(nap_save_msscr0)
218 .space 4*NR_CPUS
219
220_GLOBAL(nap_save_hid1)
221 .space 4*NR_CPUS
222
223_GLOBAL(powersave_nap)
224 .long 0
225_GLOBAL(powersave_lowspeed)
226 .long 0
227
228#ifdef DEBUG
229_GLOBAL(nap_enter_count)
230 .space 4
231_GLOBAL(nap_return_count)
232 .space 4
233#endif
diff --git a/arch/ppc/kernel/idle_power4.S b/arch/ppc/kernel/idle_power4.S
new file mode 100644
index 000000000000..73a58ff03900
--- /dev/null
+++ b/arch/ppc/kernel/idle_power4.S
@@ -0,0 +1,91 @@
1/*
2 * This file contains the power_save function for 6xx & 7xxx CPUs
3 * rewritten in assembler
4 *
5 * Warning ! This code assumes that if your machine has a 750fx
6 * it will have PLL 1 set to low speed mode (used during NAP/DOZE).
7 * if this is not the case some additional changes will have to
8 * be done to check a runtime var (a bit like powersave-nap)
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version
13 * 2 of the License, or (at your option) any later version.
14 */
15
16#include <linux/config.h>
17#include <linux/threads.h>
18#include <asm/processor.h>
19#include <asm/page.h>
20#include <asm/cputable.h>
21#include <asm/thread_info.h>
22#include <asm/ppc_asm.h>
23#include <asm/offsets.h>
24
25#undef DEBUG
26
27 .text
28
29/*
30 * Init idle, called at early CPU setup time from head.S for each CPU
31 * So nothing for now. Called with r24 containing CPU number and r3
32 * reloc offset
33 */
34 .globl init_idle_power4
35init_idle_power4:
36 blr
37
38/*
39 * Here is the power_save_6xx function. This could eventually be
40 * split into several functions & changing the function pointer
41 * depending on the various features.
42 */
43 .globl power4_idle
44power4_idle:
45BEGIN_FTR_SECTION
46 blr
47END_FTR_SECTION_IFCLR(CPU_FTR_CAN_NAP)
48 /* We must dynamically check for the NAP feature as it
49 * can be cleared by CPU init after the fixups are done
50 */
51 lis r4,cur_cpu_spec@ha
52 lwz r4,cur_cpu_spec@l(r4)
53 lwz r4,CPU_SPEC_FEATURES(r4)
54 andi. r0,r4,CPU_FTR_CAN_NAP
55 beqlr
56 /* Now check if user or arch enabled NAP mode */
57 lis r4,powersave_nap@ha
58 lwz r4,powersave_nap@l(r4)
59 cmpwi 0,r4,0
60 beqlr
61
62 /* Clear MSR:EE */
63 mfmsr r7
64 rlwinm r0,r7,0,17,15
65 mtmsr r0
66
67 /* Check current_thread_info()->flags */
68 rlwinm r4,r1,0,0,18
69 lwz r4,TI_FLAGS(r4)
70 andi. r0,r4,_TIF_NEED_RESCHED
71 beq 1f
72 mtmsr r7 /* out of line this ? */
73 blr
741:
75 /* Go to NAP now */
76BEGIN_FTR_SECTION
77 DSSALL
78 sync
79END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
80 ori r7,r7,MSR_EE /* Could be ommited (already set) */
81 oris r7,r7,MSR_POW@h
82 sync
83 isync
84 mtmsr r7
85 isync
86 sync
87 blr
88
89 .globl powersave_nap
90powersave_nap:
91 .long 0
diff --git a/arch/ppc/kernel/irq.c b/arch/ppc/kernel/irq.c
new file mode 100644
index 000000000000..8843f3af230f
--- /dev/null
+++ b/arch/ppc/kernel/irq.c
@@ -0,0 +1,164 @@
1/*
2 * arch/ppc/kernel/irq.c
3 *
4 * Derived from arch/i386/kernel/irq.c
5 * Copyright (C) 1992 Linus Torvalds
6 * Adapted from arch/i386 by Gary Thomas
7 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
8 * Updated and modified by Cort Dougan <cort@fsmlabs.com>
9 * Copyright (C) 1996-2001 Cort Dougan
10 * Adapted for Power Macintosh by Paul Mackerras
11 * Copyright (C) 1996 Paul Mackerras (paulus@cs.anu.edu.au)
12 * Amiga/APUS changes by Jesper Skov (jskov@cygnus.co.uk).
13 *
14 * This file contains the code used by various IRQ handling routines:
15 * asking for different IRQ's should be done through these routines
16 * instead of just grabbing them. Thus setups with different IRQ numbers
17 * shouldn't result in any weird surprises, and installing new handlers
18 * should be easier.
19 *
20 * The MPC8xx has an interrupt mask in the SIU. If a bit is set, the
21 * interrupt is _enabled_. As expected, IRQ0 is bit 0 in the 32-bit
22 * mask register (of which only 16 are defined), hence the weird shifting
23 * and complement of the cached_irq_mask. I want to be able to stuff
24 * this right into the SIU SMASK register.
25 * Many of the prep/chrp functions are conditional compiled on CONFIG_8xx
26 * to reduce code space and undefined function references.
27 */
28
29#include <linux/errno.h>
30#include <linux/module.h>
31#include <linux/threads.h>
32#include <linux/kernel_stat.h>
33#include <linux/signal.h>
34#include <linux/sched.h>
35#include <linux/ptrace.h>
36#include <linux/ioport.h>
37#include <linux/interrupt.h>
38#include <linux/timex.h>
39#include <linux/config.h>
40#include <linux/init.h>
41#include <linux/slab.h>
42#include <linux/pci.h>
43#include <linux/delay.h>
44#include <linux/irq.h>
45#include <linux/proc_fs.h>
46#include <linux/random.h>
47#include <linux/seq_file.h>
48#include <linux/cpumask.h>
49#include <linux/profile.h>
50#include <linux/bitops.h>
51
52#include <asm/uaccess.h>
53#include <asm/system.h>
54#include <asm/io.h>
55#include <asm/pgtable.h>
56#include <asm/irq.h>
57#include <asm/cache.h>
58#include <asm/prom.h>
59#include <asm/ptrace.h>
60
61#define NR_MASK_WORDS ((NR_IRQS + 31) / 32)
62
63extern atomic_t ipi_recv;
64extern atomic_t ipi_sent;
65
66#define MAXCOUNT 10000000
67
68int ppc_spurious_interrupts = 0;
69struct irqaction *ppc_irq_action[NR_IRQS];
70unsigned long ppc_cached_irq_mask[NR_MASK_WORDS];
71unsigned long ppc_lost_interrupts[NR_MASK_WORDS];
72atomic_t ppc_n_lost_interrupts;
73
74#ifdef CONFIG_TAU_INT
75extern int tau_initialized;
76extern int tau_interrupts(int);
77#endif
78
79int show_interrupts(struct seq_file *p, void *v)
80{
81 int i = *(loff_t *) v, j;
82 struct irqaction * action;
83 unsigned long flags;
84
85 if (i == 0) {
86 seq_puts(p, " ");
87 for (j=0; j<NR_CPUS; j++)
88 if (cpu_online(j))
89 seq_printf(p, "CPU%d ", j);
90 seq_putc(p, '\n');
91 }
92
93 if (i < NR_IRQS) {
94 spin_lock_irqsave(&irq_desc[i].lock, flags);
95 action = irq_desc[i].action;
96 if ( !action || !action->handler )
97 goto skip;
98 seq_printf(p, "%3d: ", i);
99#ifdef CONFIG_SMP
100 for (j = 0; j < NR_CPUS; j++)
101 if (cpu_online(j))
102 seq_printf(p, "%10u ",
103 kstat_cpu(j).irqs[i]);
104#else
105 seq_printf(p, "%10u ", kstat_irqs(i));
106#endif /* CONFIG_SMP */
107 if (irq_desc[i].handler)
108 seq_printf(p, " %s ", irq_desc[i].handler->typename);
109 else
110 seq_puts(p, " None ");
111 seq_printf(p, "%s", (irq_desc[i].status & IRQ_LEVEL) ? "Level " : "Edge ");
112 seq_printf(p, " %s", action->name);
113 for (action = action->next; action; action = action->next)
114 seq_printf(p, ", %s", action->name);
115 seq_putc(p, '\n');
116skip:
117 spin_unlock_irqrestore(&irq_desc[i].lock, flags);
118 } else if (i == NR_IRQS) {
119#ifdef CONFIG_TAU_INT
120 if (tau_initialized){
121 seq_puts(p, "TAU: ");
122 for (j = 0; j < NR_CPUS; j++)
123 if (cpu_online(j))
124 seq_printf(p, "%10u ", tau_interrupts(j));
125 seq_puts(p, " PowerPC Thermal Assist (cpu temp)\n");
126 }
127#endif
128#ifdef CONFIG_SMP
129 /* should this be per processor send/receive? */
130 seq_printf(p, "IPI (recv/sent): %10u/%u\n",
131 atomic_read(&ipi_recv), atomic_read(&ipi_sent));
132#endif
133 seq_printf(p, "BAD: %10u\n", ppc_spurious_interrupts);
134 }
135 return 0;
136}
137
138void do_IRQ(struct pt_regs *regs)
139{
140 int irq, first = 1;
141 irq_enter();
142
143 /*
144 * Every platform is required to implement ppc_md.get_irq.
145 * This function will either return an irq number or -1 to
146 * indicate there are no more pending. But the first time
147 * through the loop this means there wasn't and IRQ pending.
148 * The value -2 is for buggy hardware and means that this IRQ
149 * has already been handled. -- Tom
150 */
151 while ((irq = ppc_md.get_irq(regs)) >= 0) {
152 __do_IRQ(irq, regs);
153 first = 0;
154 }
155 if (irq != -2 && first)
156 /* That's not SMP safe ... but who cares ? */
157 ppc_spurious_interrupts++;
158 irq_exit();
159}
160
161void __init init_IRQ(void)
162{
163 ppc_md.init_IRQ();
164}
diff --git a/arch/ppc/kernel/l2cr.S b/arch/ppc/kernel/l2cr.S
new file mode 100644
index 000000000000..c39441048266
--- /dev/null
+++ b/arch/ppc/kernel/l2cr.S
@@ -0,0 +1,442 @@
1/*
2 L2CR functions
3 Copyright © 1997-1998 by PowerLogix R & D, Inc.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18*/
19/*
20 Thur, Dec. 12, 1998.
21 - First public release, contributed by PowerLogix.
22 ***********
23 Sat, Aug. 7, 1999.
24 - Terry: Made sure code disabled interrupts before running. (Previously
25 it was assumed interrupts were already disabled).
26 - Terry: Updated for tentative G4 support. 4MB of memory is now flushed
27 instead of 2MB. (Prob. only 3 is necessary).
28 - Terry: Updated for workaround to HID0[DPM] processor bug
29 during global invalidates.
30 ***********
31 Thu, July 13, 2000.
32 - Terry: Added isync to correct for an errata.
33
34 22 August 2001.
35 - DanM: Finally added the 7450 patch I've had for the past
36 several months. The L2CR is similar, but I'm going
37 to assume the user of this functions knows what they
38 are doing.
39
40 Author: Terry Greeniaus (tgree@phys.ualberta.ca)
41 Please e-mail updates to this file to me, thanks!
42*/
43#include <linux/config.h>
44#include <asm/processor.h>
45#include <asm/cputable.h>
46#include <asm/ppc_asm.h>
47#include <asm/cache.h>
48#include <asm/page.h>
49
50/* Usage:
51
52 When setting the L2CR register, you must do a few special
53 things. If you are enabling the cache, you must perform a
54 global invalidate. If you are disabling the cache, you must
55 flush the cache contents first. This routine takes care of
56 doing these things. When first enabling the cache, make sure
57 you pass in the L2CR you want, as well as passing in the
58 global invalidate bit set. A global invalidate will only be
59 performed if the L2I bit is set in applyThis. When enabling
60 the cache, you should also set the L2E bit in applyThis. If
61 you want to modify the L2CR contents after the cache has been
62 enabled, the recommended procedure is to first call
63 __setL2CR(0) to disable the cache and then call it again with
64 the new values for L2CR. Examples:
65
66 _setL2CR(0) - disables the cache
67 _setL2CR(0xB3A04000) - enables my G3 upgrade card:
68 - L2E set to turn on the cache
69 - L2SIZ set to 1MB
70 - L2CLK set to 1:1
71 - L2RAM set to pipelined synchronous late-write
72 - L2I set to perform a global invalidation
73 - L2OH set to 0.5 nS
74 - L2DF set because this upgrade card
75 requires it
76
77 A similar call should work for your card. You need to know
78 the correct setting for your card and then place them in the
79 fields I have outlined above. Other fields support optional
80 features, such as L2DO which caches only data, or L2TS which
81 causes cache pushes from the L1 cache to go to the L2 cache
82 instead of to main memory.
83
84IMPORTANT:
85 Starting with the 7450, the bits in this register have moved
86 or behave differently. The Enable, Parity Enable, Size,
87 and L2 Invalidate are the only bits that have not moved.
88 The size is read-only for these processors with internal L2
89 cache, and the invalidate is a control as well as status.
90 -- Dan
91
92*/
93/*
94 * Summary: this procedure ignores the L2I bit in the value passed in,
95 * flushes the cache if it was already enabled, always invalidates the
96 * cache, then enables the cache if the L2E bit is set in the value
97 * passed in.
98 * -- paulus.
99 */
100_GLOBAL(_set_L2CR)
101 /* Make sure this is a 750 or 7400 chip */
102BEGIN_FTR_SECTION
103 li r3,-1
104 blr
105END_FTR_SECTION_IFCLR(CPU_FTR_L2CR)
106
107 mflr r9
108
109 /* Stop DST streams */
110BEGIN_FTR_SECTION
111 DSSALL
112 sync
113END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
114
115 /* Turn off interrupts and data relocation. */
116 mfmsr r7 /* Save MSR in r7 */
117 rlwinm r4,r7,0,17,15
118 rlwinm r4,r4,0,28,26 /* Turn off DR bit */
119 sync
120 mtmsr r4
121 isync
122
123 /* Before we perform the global invalidation, we must disable dynamic
124 * power management via HID0[DPM] to work around a processor bug where
125 * DPM can possibly interfere with the state machine in the processor
126 * that invalidates the L2 cache tags.
127 */
128 mfspr r8,SPRN_HID0 /* Save HID0 in r8 */
129 rlwinm r4,r8,0,12,10 /* Turn off HID0[DPM] */
130 sync
131 mtspr SPRN_HID0,r4 /* Disable DPM */
132 sync
133
134 /* Get the current enable bit of the L2CR into r4 */
135 mfspr r4,SPRN_L2CR
136
137 /* Tweak some bits */
138 rlwinm r5,r3,0,0,0 /* r5 contains the new enable bit */
139 rlwinm r3,r3,0,11,9 /* Turn off the invalidate bit */
140 rlwinm r3,r3,0,1,31 /* Turn off the enable bit */
141
142 /* Check to see if we need to flush */
143 rlwinm. r4,r4,0,0,0
144 beq 2f
145
146 /* Flush the cache. First, read the first 4MB of memory (physical) to
147 * put new data in the cache. (Actually we only need
148 * the size of the L2 cache plus the size of the L1 cache, but 4MB will
149 * cover everything just to be safe).
150 */
151
152 /**** Might be a good idea to set L2DO here - to prevent instructions
153 from getting into the cache. But since we invalidate
154 the next time we enable the cache it doesn't really matter.
155 Don't do this unless you accomodate all processor variations.
156 The bit moved on the 7450.....
157 ****/
158
159 /* TODO: use HW flush assist when available */
160
161 lis r4,0x0002
162 mtctr r4
163 li r4,0
1641:
165 lwzx r0,r0,r4
166 addi r4,r4,32 /* Go to start of next cache line */
167 bdnz 1b
168 isync
169
170 /* Now, flush the first 4MB of memory */
171 lis r4,0x0002
172 mtctr r4
173 li r4,0
174 sync
1751:
176 dcbf 0,r4
177 addi r4,r4,32 /* Go to start of next cache line */
178 bdnz 1b
179
1802:
181 /* Set up the L2CR configuration bits (and switch L2 off) */
182 /* CPU errata: Make sure the mtspr below is already in the
183 * L1 icache
184 */
185 b 20f
186 .balign L1_CACHE_LINE_SIZE
18722:
188 sync
189 mtspr SPRN_L2CR,r3
190 sync
191 b 23f
19220:
193 b 21f
19421: sync
195 isync
196 b 22b
197
19823:
199 /* Perform a global invalidation */
200 oris r3,r3,0x0020
201 sync
202 mtspr SPRN_L2CR,r3
203 sync
204 isync /* For errata */
205
206BEGIN_FTR_SECTION
207 /* On the 7450, we wait for the L2I bit to clear......
208 */
20910: mfspr r3,SPRN_L2CR
210 andis. r4,r3,0x0020
211 bne 10b
212 b 11f
213END_FTR_SECTION_IFSET(CPU_FTR_SPEC7450)
214
215 /* Wait for the invalidation to complete */
2163: mfspr r3,SPRN_L2CR
217 rlwinm. r4,r3,0,31,31
218 bne 3b
219
22011: rlwinm r3,r3,0,11,9 /* Turn off the L2I bit */
221 sync
222 mtspr SPRN_L2CR,r3
223 sync
224
225 /* See if we need to enable the cache */
226 cmplwi r5,0
227 beq 4f
228
229 /* Enable the cache */
230 oris r3,r3,0x8000
231 mtspr SPRN_L2CR,r3
232 sync
233
2344:
235
236 /* Restore HID0[DPM] to whatever it was before */
237 sync
238 mtspr 1008,r8
239 sync
240
241 /* Restore MSR (restores EE and DR bits to original state) */
242 SYNC
243 mtmsr r7
244 isync
245
246 mtlr r9
247 blr
248
249_GLOBAL(_get_L2CR)
250 /* Return the L2CR contents */
251 li r3,0
252BEGIN_FTR_SECTION
253 mfspr r3,SPRN_L2CR
254END_FTR_SECTION_IFSET(CPU_FTR_L2CR)
255 blr
256
257
258/*
259 * Here is a similar routine for dealing with the L3 cache
260 * on the 745x family of chips
261 */
262
263_GLOBAL(_set_L3CR)
264 /* Make sure this is a 745x chip */
265BEGIN_FTR_SECTION
266 li r3,-1
267 blr
268END_FTR_SECTION_IFCLR(CPU_FTR_L3CR)
269
270 /* Turn off interrupts and data relocation. */
271 mfmsr r7 /* Save MSR in r7 */
272 rlwinm r4,r7,0,17,15
273 rlwinm r4,r4,0,28,26 /* Turn off DR bit */
274 sync
275 mtmsr r4
276 isync
277
278 /* Stop DST streams */
279 DSSALL
280 sync
281
282 /* Get the current enable bit of the L3CR into r4 */
283 mfspr r4,SPRN_L3CR
284
285 /* Tweak some bits */
286 rlwinm r5,r3,0,0,0 /* r5 contains the new enable bit */
287 rlwinm r3,r3,0,22,20 /* Turn off the invalidate bit */
288 rlwinm r3,r3,0,2,31 /* Turn off the enable & PE bits */
289 rlwinm r3,r3,0,5,3 /* Turn off the clken bit */
290 /* Check to see if we need to flush */
291 rlwinm. r4,r4,0,0,0
292 beq 2f
293
294 /* Flush the cache.
295 */
296
297 /* TODO: use HW flush assist */
298
299 lis r4,0x0008
300 mtctr r4
301 li r4,0
3021:
303 lwzx r0,r0,r4
304 dcbf 0,r4
305 addi r4,r4,32 /* Go to start of next cache line */
306 bdnz 1b
307
3082:
309 /* Set up the L3CR configuration bits (and switch L3 off) */
310 sync
311 mtspr SPRN_L3CR,r3
312 sync
313
314 oris r3,r3,L3CR_L3RES@h /* Set reserved bit 5 */
315 mtspr SPRN_L3CR,r3
316 sync
317 oris r3,r3,L3CR_L3CLKEN@h /* Set clken */
318 mtspr SPRN_L3CR,r3
319 sync
320
321 /* Wait for stabilize */
322 li r0,256
323 mtctr r0
3241: bdnz 1b
325
326 /* Perform a global invalidation */
327 ori r3,r3,0x0400
328 sync
329 mtspr SPRN_L3CR,r3
330 sync
331 isync
332
333 /* We wait for the L3I bit to clear...... */
33410: mfspr r3,SPRN_L3CR
335 andi. r4,r3,0x0400
336 bne 10b
337
338 /* Clear CLKEN */
339 rlwinm r3,r3,0,5,3 /* Turn off the clken bit */
340 mtspr SPRN_L3CR,r3
341 sync
342
343 /* Wait for stabilize */
344 li r0,256
345 mtctr r0
3461: bdnz 1b
347
348 /* See if we need to enable the cache */
349 cmplwi r5,0
350 beq 4f
351
352 /* Enable the cache */
353 oris r3,r3,(L3CR_L3E | L3CR_L3CLKEN)@h
354 mtspr SPRN_L3CR,r3
355 sync
356
357 /* Wait for stabilize */
358 li r0,256
359 mtctr r0
3601: bdnz 1b
361
362 /* Restore MSR (restores EE and DR bits to original state) */
3634: SYNC
364 mtmsr r7
365 isync
366 blr
367
368_GLOBAL(_get_L3CR)
369 /* Return the L3CR contents */
370 li r3,0
371BEGIN_FTR_SECTION
372 mfspr r3,SPRN_L3CR
373END_FTR_SECTION_IFSET(CPU_FTR_L3CR)
374 blr
375
376/* --- End of PowerLogix code ---
377 */
378
379
380/* flush_disable_L1() - Flush and disable L1 cache
381 *
382 * clobbers r0, r3, ctr, cr0
383 * Must be called with interrupts disabled and MMU enabled.
384 */
385_GLOBAL(__flush_disable_L1)
386 /* Stop pending alitvec streams and memory accesses */
387BEGIN_FTR_SECTION
388 DSSALL
389END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
390 sync
391
392 /* Load counter to 0x4000 cache lines (512k) and
393 * load cache with datas
394 */
395 li r3,0x4000 /* 512kB / 32B */
396 mtctr r3
397 lis r3,KERNELBASE@h
3981:
399 lwz r0,0(r3)
400 addi r3,r3,0x0020 /* Go to start of next cache line */
401 bdnz 1b
402 isync
403 sync
404
405 /* Now flush those cache lines */
406 li r3,0x4000 /* 512kB / 32B */
407 mtctr r3
408 lis r3,KERNELBASE@h
4091:
410 dcbf 0,r3
411 addi r3,r3,0x0020 /* Go to start of next cache line */
412 bdnz 1b
413 sync
414
415 /* We can now disable the L1 cache (HID0:DCE, HID0:ICE) */
416 mfspr r3,SPRN_HID0
417 rlwinm r3,r3,0,18,15
418 mtspr SPRN_HID0,r3
419 sync
420 isync
421 blr
422
423/* inval_enable_L1 - Invalidate and enable L1 cache
424 *
425 * Assumes L1 is already disabled and MSR:EE is off
426 *
427 * clobbers r3
428 */
429_GLOBAL(__inval_enable_L1)
430 /* Enable and then Flash inval the instruction & data cache */
431 mfspr r3,SPRN_HID0
432 ori r3,r3, HID0_ICE|HID0_ICFI|HID0_DCE|HID0_DCI
433 sync
434 isync
435 mtspr SPRN_HID0,r3
436 xori r3,r3, HID0_ICFI|HID0_DCI
437 mtspr SPRN_HID0,r3
438 sync
439
440 blr
441
442
diff --git a/arch/ppc/kernel/misc.S b/arch/ppc/kernel/misc.S
new file mode 100644
index 000000000000..73f7c23b0dd4
--- /dev/null
+++ b/arch/ppc/kernel/misc.S
@@ -0,0 +1,1453 @@
1/*
2 * This file contains miscellaneous low-level functions.
3 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
4 *
5 * Largely rewritten by Cort Dougan (cort@cs.nmt.edu)
6 * and Paul Mackerras.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
12 *
13 */
14
15#include <linux/config.h>
16#include <linux/sys.h>
17#include <asm/unistd.h>
18#include <asm/errno.h>
19#include <asm/processor.h>
20#include <asm/page.h>
21#include <asm/cache.h>
22#include <asm/cputable.h>
23#include <asm/mmu.h>
24#include <asm/ppc_asm.h>
25#include <asm/thread_info.h>
26#include <asm/offsets.h>
27
28 .text
29
30 .align 5
31_GLOBAL(__delay)
32 cmpwi 0,r3,0
33 mtctr r3
34 beqlr
351: bdnz 1b
36 blr
37
38/*
39 * Returns (address we're running at) - (address we were linked at)
40 * for use before the text and data are mapped to KERNELBASE.
41 */
42_GLOBAL(reloc_offset)
43 mflr r0
44 bl 1f
451: mflr r3
46 lis r4,1b@ha
47 addi r4,r4,1b@l
48 subf r3,r4,r3
49 mtlr r0
50 blr
51
52/*
53 * add_reloc_offset(x) returns x + reloc_offset().
54 */
55_GLOBAL(add_reloc_offset)
56 mflr r0
57 bl 1f
581: mflr r5
59 lis r4,1b@ha
60 addi r4,r4,1b@l
61 subf r5,r4,r5
62 add r3,r3,r5
63 mtlr r0
64 blr
65
66/*
67 * sub_reloc_offset(x) returns x - reloc_offset().
68 */
69_GLOBAL(sub_reloc_offset)
70 mflr r0
71 bl 1f
721: mflr r5
73 lis r4,1b@ha
74 addi r4,r4,1b@l
75 subf r5,r4,r5
76 subf r3,r5,r3
77 mtlr r0
78 blr
79
80/*
81 * reloc_got2 runs through the .got2 section adding an offset
82 * to each entry.
83 */
84_GLOBAL(reloc_got2)
85 mflr r11
86 lis r7,__got2_start@ha
87 addi r7,r7,__got2_start@l
88 lis r8,__got2_end@ha
89 addi r8,r8,__got2_end@l
90 subf r8,r7,r8
91 srwi. r8,r8,2
92 beqlr
93 mtctr r8
94 bl 1f
951: mflr r0
96 lis r4,1b@ha
97 addi r4,r4,1b@l
98 subf r0,r4,r0
99 add r7,r0,r7
1002: lwz r0,0(r7)
101 add r0,r0,r3
102 stw r0,0(r7)
103 addi r7,r7,4
104 bdnz 2b
105 mtlr r11
106 blr
107
108/*
109 * identify_cpu,
110 * called with r3 = data offset and r4 = CPU number
111 * doesn't change r3
112 */
113_GLOBAL(identify_cpu)
114 addis r8,r3,cpu_specs@ha
115 addi r8,r8,cpu_specs@l
116 mfpvr r7
1171:
118 lwz r5,CPU_SPEC_PVR_MASK(r8)
119 and r5,r5,r7
120 lwz r6,CPU_SPEC_PVR_VALUE(r8)
121 cmplw 0,r6,r5
122 beq 1f
123 addi r8,r8,CPU_SPEC_ENTRY_SIZE
124 b 1b
1251:
126 addis r6,r3,cur_cpu_spec@ha
127 addi r6,r6,cur_cpu_spec@l
128 slwi r4,r4,2
129 sub r8,r8,r3
130 stwx r8,r4,r6
131 blr
132
133/*
134 * do_cpu_ftr_fixups - goes through the list of CPU feature fixups
135 * and writes nop's over sections of code that don't apply for this cpu.
136 * r3 = data offset (not changed)
137 */
138_GLOBAL(do_cpu_ftr_fixups)
139 /* Get CPU 0 features */
140 addis r6,r3,cur_cpu_spec@ha
141 addi r6,r6,cur_cpu_spec@l
142 lwz r4,0(r6)
143 add r4,r4,r3
144 lwz r4,CPU_SPEC_FEATURES(r4)
145
146 /* Get the fixup table */
147 addis r6,r3,__start___ftr_fixup@ha
148 addi r6,r6,__start___ftr_fixup@l
149 addis r7,r3,__stop___ftr_fixup@ha
150 addi r7,r7,__stop___ftr_fixup@l
151
152 /* Do the fixup */
1531: cmplw 0,r6,r7
154 bgelr
155 addi r6,r6,16
156 lwz r8,-16(r6) /* mask */
157 and r8,r8,r4
158 lwz r9,-12(r6) /* value */
159 cmplw 0,r8,r9
160 beq 1b
161 lwz r8,-8(r6) /* section begin */
162 lwz r9,-4(r6) /* section end */
163 subf. r9,r8,r9
164 beq 1b
165 /* write nops over the section of code */
166 /* todo: if large section, add a branch at the start of it */
167 srwi r9,r9,2
168 mtctr r9
169 add r8,r8,r3
170 lis r0,0x60000000@h /* nop */
1713: stw r0,0(r8)
172 andi. r10,r4,CPU_FTR_SPLIT_ID_CACHE@l
173 beq 2f
174 dcbst 0,r8 /* suboptimal, but simpler */
175 sync
176 icbi 0,r8
1772: addi r8,r8,4
178 bdnz 3b
179 sync /* additional sync needed on g4 */
180 isync
181 b 1b
182
183/*
184 * call_setup_cpu - call the setup_cpu function for this cpu
185 * r3 = data offset, r24 = cpu number
186 *
187 * Setup function is called with:
188 * r3 = data offset
189 * r4 = CPU number
190 * r5 = ptr to CPU spec (relocated)
191 */
192_GLOBAL(call_setup_cpu)
193 addis r5,r3,cur_cpu_spec@ha
194 addi r5,r5,cur_cpu_spec@l
195 slwi r4,r24,2
196 lwzx r5,r4,r5
197 add r5,r5,r3
198 lwz r6,CPU_SPEC_SETUP(r5)
199 add r6,r6,r3
200 mtctr r6
201 mr r4,r24
202 bctr
203
204#if defined(CONFIG_CPU_FREQ_PMAC) && defined(CONFIG_6xx)
205
206/* This gets called by via-pmu.c to switch the PLL selection
207 * on 750fx CPU. This function should really be moved to some
208 * other place (as most of the cpufreq code in via-pmu
209 */
210_GLOBAL(low_choose_750fx_pll)
211 /* Clear MSR:EE */
212 mfmsr r7
213 rlwinm r0,r7,0,17,15
214 mtmsr r0
215
216 /* If switching to PLL1, disable HID0:BTIC */
217 cmplwi cr0,r3,0
218 beq 1f
219 mfspr r5,SPRN_HID0
220 rlwinm r5,r5,0,27,25
221 sync
222 mtspr SPRN_HID0,r5
223 isync
224 sync
225
2261:
227 /* Calc new HID1 value */
228 mfspr r4,SPRN_HID1 /* Build a HID1:PS bit from parameter */
229 rlwinm r5,r3,16,15,15 /* Clear out HID1:PS from value read */
230 rlwinm r4,r4,0,16,14 /* Could have I used rlwimi here ? */
231 or r4,r4,r5
232 mtspr SPRN_HID1,r4
233
234 /* Store new HID1 image */
235 rlwinm r6,r1,0,0,18
236 lwz r6,TI_CPU(r6)
237 slwi r6,r6,2
238 addis r6,r6,nap_save_hid1@ha
239 stw r4,nap_save_hid1@l(r6)
240
241 /* If switching to PLL0, enable HID0:BTIC */
242 cmplwi cr0,r3,0
243 bne 1f
244 mfspr r5,SPRN_HID0
245 ori r5,r5,HID0_BTIC
246 sync
247 mtspr SPRN_HID0,r5
248 isync
249 sync
250
2511:
252 /* Return */
253 mtmsr r7
254 blr
255
256_GLOBAL(low_choose_7447a_dfs)
257 /* Clear MSR:EE */
258 mfmsr r7
259 rlwinm r0,r7,0,17,15
260 mtmsr r0
261
262 /* Calc new HID1 value */
263 mfspr r4,SPRN_HID1
264 insrwi r4,r3,1,9 /* insert parameter into bit 9 */
265 sync
266 mtspr SPRN_HID1,r4
267 sync
268 isync
269
270 /* Return */
271 mtmsr r7
272 blr
273
274#endif /* CONFIG_CPU_FREQ_PMAC && CONFIG_6xx */
275
276/* void local_save_flags_ptr(unsigned long *flags) */
277_GLOBAL(local_save_flags_ptr)
278 mfmsr r4
279 stw r4,0(r3)
280 blr
281 /*
282 * Need these nops here for taking over save/restore to
283 * handle lost intrs
284 * -- Cort
285 */
286 nop
287 nop
288 nop
289 nop
290 nop
291 nop
292 nop
293 nop
294 nop
295 nop
296 nop
297 nop
298 nop
299 nop
300 nop
301 nop
302 nop
303_GLOBAL(local_save_flags_ptr_end)
304
305/* void local_irq_restore(unsigned long flags) */
306_GLOBAL(local_irq_restore)
307/*
308 * Just set/clear the MSR_EE bit through restore/flags but do not
309 * change anything else. This is needed by the RT system and makes
310 * sense anyway.
311 * -- Cort
312 */
313 mfmsr r4
314 /* Copy all except the MSR_EE bit from r4 (current MSR value)
315 to r3. This is the sort of thing the rlwimi instruction is
316 designed for. -- paulus. */
317 rlwimi r3,r4,0,17,15
318 /* Check if things are setup the way we want _already_. */
319 cmpw 0,r3,r4
320 beqlr
3211: SYNC
322 mtmsr r3
323 SYNC
324 blr
325 nop
326 nop
327 nop
328 nop
329 nop
330 nop
331 nop
332 nop
333 nop
334 nop
335 nop
336 nop
337 nop
338 nop
339 nop
340 nop
341 nop
342 nop
343 nop
344_GLOBAL(local_irq_restore_end)
345
346_GLOBAL(local_irq_disable)
347 mfmsr r0 /* Get current interrupt state */
348 rlwinm r3,r0,16+1,32-1,31 /* Extract old value of 'EE' */
349 rlwinm r0,r0,0,17,15 /* clear MSR_EE in r0 */
350 SYNC /* Some chip revs have problems here... */
351 mtmsr r0 /* Update machine state */
352 blr /* Done */
353 /*
354 * Need these nops here for taking over save/restore to
355 * handle lost intrs
356 * -- Cort
357 */
358 nop
359 nop
360 nop
361 nop
362 nop
363 nop
364 nop
365 nop
366 nop
367 nop
368 nop
369 nop
370 nop
371 nop
372 nop
373_GLOBAL(local_irq_disable_end)
374
375_GLOBAL(local_irq_enable)
376 mfmsr r3 /* Get current state */
377 ori r3,r3,MSR_EE /* Turn on 'EE' bit */
378 SYNC /* Some chip revs have problems here... */
379 mtmsr r3 /* Update machine state */
380 blr
381 /*
382 * Need these nops here for taking over save/restore to
383 * handle lost intrs
384 * -- Cort
385 */
386 nop
387 nop
388 nop
389 nop
390 nop
391 nop
392 nop
393 nop
394 nop
395 nop
396 nop
397 nop
398 nop
399 nop
400 nop
401 nop
402_GLOBAL(local_irq_enable_end)
403
404/*
405 * complement mask on the msr then "or" some values on.
406 * _nmask_and_or_msr(nmask, value_to_or)
407 */
408_GLOBAL(_nmask_and_or_msr)
409 mfmsr r0 /* Get current msr */
410 andc r0,r0,r3 /* And off the bits set in r3 (first parm) */
411 or r0,r0,r4 /* Or on the bits in r4 (second parm) */
412 SYNC /* Some chip revs have problems here... */
413 mtmsr r0 /* Update machine state */
414 isync
415 blr /* Done */
416
417
418/*
419 * Flush MMU TLB
420 */
421_GLOBAL(_tlbia)
422#if defined(CONFIG_40x)
423 sync /* Flush to memory before changing mapping */
424 tlbia
425 isync /* Flush shadow TLB */
426#elif defined(CONFIG_44x)
427 li r3,0
428 sync
429
430 /* Load high watermark */
431 lis r4,tlb_44x_hwater@ha
432 lwz r5,tlb_44x_hwater@l(r4)
433
4341: tlbwe r3,r3,PPC44x_TLB_PAGEID
435 addi r3,r3,1
436 cmpw 0,r3,r5
437 ble 1b
438
439 isync
440#elif defined(CONFIG_FSL_BOOKE)
441 /* Invalidate all entries in TLB0 */
442 li r3, 0x04
443 tlbivax 0,3
444 /* Invalidate all entries in TLB1 */
445 li r3, 0x0c
446 tlbivax 0,3
447 /* Invalidate all entries in TLB2 */
448 li r3, 0x14
449 tlbivax 0,3
450 /* Invalidate all entries in TLB3 */
451 li r3, 0x1c
452 tlbivax 0,3
453 msync
454#ifdef CONFIG_SMP
455 tlbsync
456#endif /* CONFIG_SMP */
457#else /* !(CONFIG_40x || CONFIG_44x || CONFIG_FSL_BOOKE) */
458#if defined(CONFIG_SMP)
459 rlwinm r8,r1,0,0,18
460 lwz r8,TI_CPU(r8)
461 oris r8,r8,10
462 mfmsr r10
463 SYNC
464 rlwinm r0,r10,0,17,15 /* clear bit 16 (MSR_EE) */
465 rlwinm r0,r0,0,28,26 /* clear DR */
466 mtmsr r0
467 SYNC_601
468 isync
469 lis r9,mmu_hash_lock@h
470 ori r9,r9,mmu_hash_lock@l
471 tophys(r9,r9)
47210: lwarx r7,0,r9
473 cmpwi 0,r7,0
474 bne- 10b
475 stwcx. r8,0,r9
476 bne- 10b
477 sync
478 tlbia
479 sync
480 TLBSYNC
481 li r0,0
482 stw r0,0(r9) /* clear mmu_hash_lock */
483 mtmsr r10
484 SYNC_601
485 isync
486#else /* CONFIG_SMP */
487 sync
488 tlbia
489 sync
490#endif /* CONFIG_SMP */
491#endif /* ! defined(CONFIG_40x) */
492 blr
493
494/*
495 * Flush MMU TLB for a particular address
496 */
497_GLOBAL(_tlbie)
498#if defined(CONFIG_40x)
499 tlbsx. r3, 0, r3
500 bne 10f
501 sync
502 /* There are only 64 TLB entries, so r3 < 64, which means bit 25 is clear.
503 * Since 25 is the V bit in the TLB_TAG, loading this value will invalidate
504 * the TLB entry. */
505 tlbwe r3, r3, TLB_TAG
506 isync
50710:
508#elif defined(CONFIG_44x)
509 mfspr r4,SPRN_MMUCR
510 mfspr r5,SPRN_PID /* Get PID */
511 rlwimi r4,r5,0,24,31 /* Set TID */
512 mtspr SPRN_MMUCR,r4
513
514 tlbsx. r3, 0, r3
515 bne 10f
516 sync
517 /* There are only 64 TLB entries, so r3 < 64,
518 * which means bit 22, is clear. Since 22 is
519 * the V bit in the TLB_PAGEID, loading this
520 * value will invalidate the TLB entry.
521 */
522 tlbwe r3, r3, PPC44x_TLB_PAGEID
523 isync
52410:
525#elif defined(CONFIG_FSL_BOOKE)
526 rlwinm r4, r3, 0, 0, 19
527 ori r5, r4, 0x08 /* TLBSEL = 1 */
528 ori r6, r4, 0x10 /* TLBSEL = 2 */
529 ori r7, r4, 0x18 /* TLBSEL = 3 */
530 tlbivax 0, r4
531 tlbivax 0, r5
532 tlbivax 0, r6
533 tlbivax 0, r7
534 msync
535#if defined(CONFIG_SMP)
536 tlbsync
537#endif /* CONFIG_SMP */
538#else /* !(CONFIG_40x || CONFIG_44x || CONFIG_FSL_BOOKE) */
539#if defined(CONFIG_SMP)
540 rlwinm r8,r1,0,0,18
541 lwz r8,TI_CPU(r8)
542 oris r8,r8,11
543 mfmsr r10
544 SYNC
545 rlwinm r0,r10,0,17,15 /* clear bit 16 (MSR_EE) */
546 rlwinm r0,r0,0,28,26 /* clear DR */
547 mtmsr r0
548 SYNC_601
549 isync
550 lis r9,mmu_hash_lock@h
551 ori r9,r9,mmu_hash_lock@l
552 tophys(r9,r9)
55310: lwarx r7,0,r9
554 cmpwi 0,r7,0
555 bne- 10b
556 stwcx. r8,0,r9
557 bne- 10b
558 eieio
559 tlbie r3
560 sync
561 TLBSYNC
562 li r0,0
563 stw r0,0(r9) /* clear mmu_hash_lock */
564 mtmsr r10
565 SYNC_601
566 isync
567#else /* CONFIG_SMP */
568 tlbie r3
569 sync
570#endif /* CONFIG_SMP */
571#endif /* ! CONFIG_40x */
572 blr
573
574/*
575 * Flush instruction cache.
576 * This is a no-op on the 601.
577 */
578_GLOBAL(flush_instruction_cache)
579#if defined(CONFIG_8xx)
580 isync
581 lis r5, IDC_INVALL@h
582 mtspr SPRN_IC_CST, r5
583#elif defined(CONFIG_4xx)
584#ifdef CONFIG_403GCX
585 li r3, 512
586 mtctr r3
587 lis r4, KERNELBASE@h
5881: iccci 0, r4
589 addi r4, r4, 16
590 bdnz 1b
591#else
592 lis r3, KERNELBASE@h
593 iccci 0,r3
594#endif
595#elif CONFIG_FSL_BOOKE
596 mfspr r3,SPRN_L1CSR1
597 ori r3,r3,L1CSR1_ICFI|L1CSR1_ICLFR
598 mtspr SPRN_L1CSR1,r3
599#else
600 mfspr r3,SPRN_PVR
601 rlwinm r3,r3,16,16,31
602 cmpwi 0,r3,1
603 beqlr /* for 601, do nothing */
604 /* 603/604 processor - use invalidate-all bit in HID0 */
605 mfspr r3,SPRN_HID0
606 ori r3,r3,HID0_ICFI
607 mtspr SPRN_HID0,r3
608#endif /* CONFIG_8xx/4xx */
609 isync
610 blr
611
612/*
613 * Write any modified data cache blocks out to memory
614 * and invalidate the corresponding instruction cache blocks.
615 * This is a no-op on the 601.
616 *
617 * flush_icache_range(unsigned long start, unsigned long stop)
618 */
619_GLOBAL(flush_icache_range)
620BEGIN_FTR_SECTION
621 blr /* for 601, do nothing */
622END_FTR_SECTION_IFSET(PPC_FEATURE_UNIFIED_CACHE)
623 li r5,L1_CACHE_LINE_SIZE-1
624 andc r3,r3,r5
625 subf r4,r3,r4
626 add r4,r4,r5
627 srwi. r4,r4,LG_L1_CACHE_LINE_SIZE
628 beqlr
629 mtctr r4
630 mr r6,r3
6311: dcbst 0,r3
632 addi r3,r3,L1_CACHE_LINE_SIZE
633 bdnz 1b
634 sync /* wait for dcbst's to get to ram */
635 mtctr r4
6362: icbi 0,r6
637 addi r6,r6,L1_CACHE_LINE_SIZE
638 bdnz 2b
639 sync /* additional sync needed on g4 */
640 isync
641 blr
642/*
643 * Write any modified data cache blocks out to memory.
644 * Does not invalidate the corresponding cache lines (especially for
645 * any corresponding instruction cache).
646 *
647 * clean_dcache_range(unsigned long start, unsigned long stop)
648 */
649_GLOBAL(clean_dcache_range)
650 li r5,L1_CACHE_LINE_SIZE-1
651 andc r3,r3,r5
652 subf r4,r3,r4
653 add r4,r4,r5
654 srwi. r4,r4,LG_L1_CACHE_LINE_SIZE
655 beqlr
656 mtctr r4
657
6581: dcbst 0,r3
659 addi r3,r3,L1_CACHE_LINE_SIZE
660 bdnz 1b
661 sync /* wait for dcbst's to get to ram */
662 blr
663
664/*
665 * Write any modified data cache blocks out to memory and invalidate them.
666 * Does not invalidate the corresponding instruction cache blocks.
667 *
668 * flush_dcache_range(unsigned long start, unsigned long stop)
669 */
670_GLOBAL(flush_dcache_range)
671 li r5,L1_CACHE_LINE_SIZE-1
672 andc r3,r3,r5
673 subf r4,r3,r4
674 add r4,r4,r5
675 srwi. r4,r4,LG_L1_CACHE_LINE_SIZE
676 beqlr
677 mtctr r4
678
6791: dcbf 0,r3
680 addi r3,r3,L1_CACHE_LINE_SIZE
681 bdnz 1b
682 sync /* wait for dcbst's to get to ram */
683 blr
684
685/*
686 * Like above, but invalidate the D-cache. This is used by the 8xx
687 * to invalidate the cache so the PPC core doesn't get stale data
688 * from the CPM (no cache snooping here :-).
689 *
690 * invalidate_dcache_range(unsigned long start, unsigned long stop)
691 */
692_GLOBAL(invalidate_dcache_range)
693 li r5,L1_CACHE_LINE_SIZE-1
694 andc r3,r3,r5
695 subf r4,r3,r4
696 add r4,r4,r5
697 srwi. r4,r4,LG_L1_CACHE_LINE_SIZE
698 beqlr
699 mtctr r4
700
7011: dcbi 0,r3
702 addi r3,r3,L1_CACHE_LINE_SIZE
703 bdnz 1b
704 sync /* wait for dcbi's to get to ram */
705 blr
706
707#ifdef CONFIG_NOT_COHERENT_CACHE
708/*
709 * 40x cores have 8K or 16K dcache and 32 byte line size.
710 * 44x has a 32K dcache and 32 byte line size.
711 * 8xx has 1, 2, 4, 8K variants.
712 * For now, cover the worst case of the 44x.
713 * Must be called with external interrupts disabled.
714 */
715#define CACHE_NWAYS 64
716#define CACHE_NLINES 16
717
718_GLOBAL(flush_dcache_all)
719 li r4, (2 * CACHE_NWAYS * CACHE_NLINES)
720 mtctr r4
721 lis r5, KERNELBASE@h
7221: lwz r3, 0(r5) /* Load one word from every line */
723 addi r5, r5, L1_CACHE_LINE_SIZE
724 bdnz 1b
725 blr
726#endif /* CONFIG_NOT_COHERENT_CACHE */
727
728/*
729 * Flush a particular page from the data cache to RAM.
730 * Note: this is necessary because the instruction cache does *not*
731 * snoop from the data cache.
732 * This is a no-op on the 601 which has a unified cache.
733 *
734 * void __flush_dcache_icache(void *page)
735 */
736_GLOBAL(__flush_dcache_icache)
737BEGIN_FTR_SECTION
738 blr /* for 601, do nothing */
739END_FTR_SECTION_IFSET(PPC_FEATURE_UNIFIED_CACHE)
740 rlwinm r3,r3,0,0,19 /* Get page base address */
741 li r4,4096/L1_CACHE_LINE_SIZE /* Number of lines in a page */
742 mtctr r4
743 mr r6,r3
7440: dcbst 0,r3 /* Write line to ram */
745 addi r3,r3,L1_CACHE_LINE_SIZE
746 bdnz 0b
747 sync
748 mtctr r4
7491: icbi 0,r6
750 addi r6,r6,L1_CACHE_LINE_SIZE
751 bdnz 1b
752 sync
753 isync
754 blr
755
756/*
757 * Flush a particular page from the data cache to RAM, identified
758 * by its physical address. We turn off the MMU so we can just use
759 * the physical address (this may be a highmem page without a kernel
760 * mapping).
761 *
762 * void __flush_dcache_icache_phys(unsigned long physaddr)
763 */
764_GLOBAL(__flush_dcache_icache_phys)
765BEGIN_FTR_SECTION
766 blr /* for 601, do nothing */
767END_FTR_SECTION_IFSET(PPC_FEATURE_UNIFIED_CACHE)
768 mfmsr r10
769 rlwinm r0,r10,0,28,26 /* clear DR */
770 mtmsr r0
771 isync
772 rlwinm r3,r3,0,0,19 /* Get page base address */
773 li r4,4096/L1_CACHE_LINE_SIZE /* Number of lines in a page */
774 mtctr r4
775 mr r6,r3
7760: dcbst 0,r3 /* Write line to ram */
777 addi r3,r3,L1_CACHE_LINE_SIZE
778 bdnz 0b
779 sync
780 mtctr r4
7811: icbi 0,r6
782 addi r6,r6,L1_CACHE_LINE_SIZE
783 bdnz 1b
784 sync
785 mtmsr r10 /* restore DR */
786 isync
787 blr
788
789/*
790 * Clear pages using the dcbz instruction, which doesn't cause any
791 * memory traffic (except to write out any cache lines which get
792 * displaced). This only works on cacheable memory.
793 *
794 * void clear_pages(void *page, int order) ;
795 */
796_GLOBAL(clear_pages)
797 li r0,4096/L1_CACHE_LINE_SIZE
798 slw r0,r0,r4
799 mtctr r0
800#ifdef CONFIG_8xx
801 li r4, 0
8021: stw r4, 0(r3)
803 stw r4, 4(r3)
804 stw r4, 8(r3)
805 stw r4, 12(r3)
806#else
8071: dcbz 0,r3
808#endif
809 addi r3,r3,L1_CACHE_LINE_SIZE
810 bdnz 1b
811 blr
812
813/*
814 * Copy a whole page. We use the dcbz instruction on the destination
815 * to reduce memory traffic (it eliminates the unnecessary reads of
816 * the destination into cache). This requires that the destination
817 * is cacheable.
818 */
819#define COPY_16_BYTES \
820 lwz r6,4(r4); \
821 lwz r7,8(r4); \
822 lwz r8,12(r4); \
823 lwzu r9,16(r4); \
824 stw r6,4(r3); \
825 stw r7,8(r3); \
826 stw r8,12(r3); \
827 stwu r9,16(r3)
828
829_GLOBAL(copy_page)
830 addi r3,r3,-4
831 addi r4,r4,-4
832
833#ifdef CONFIG_8xx
834 /* don't use prefetch on 8xx */
835 li r0,4096/L1_CACHE_LINE_SIZE
836 mtctr r0
8371: COPY_16_BYTES
838 bdnz 1b
839 blr
840
841#else /* not 8xx, we can prefetch */
842 li r5,4
843
844#if MAX_COPY_PREFETCH > 1
845 li r0,MAX_COPY_PREFETCH
846 li r11,4
847 mtctr r0
84811: dcbt r11,r4
849 addi r11,r11,L1_CACHE_LINE_SIZE
850 bdnz 11b
851#else /* MAX_COPY_PREFETCH == 1 */
852 dcbt r5,r4
853 li r11,L1_CACHE_LINE_SIZE+4
854#endif /* MAX_COPY_PREFETCH */
855 li r0,4096/L1_CACHE_LINE_SIZE - MAX_COPY_PREFETCH
856 crclr 4*cr0+eq
8572:
858 mtctr r0
8591:
860 dcbt r11,r4
861 dcbz r5,r3
862 COPY_16_BYTES
863#if L1_CACHE_LINE_SIZE >= 32
864 COPY_16_BYTES
865#if L1_CACHE_LINE_SIZE >= 64
866 COPY_16_BYTES
867 COPY_16_BYTES
868#if L1_CACHE_LINE_SIZE >= 128
869 COPY_16_BYTES
870 COPY_16_BYTES
871 COPY_16_BYTES
872 COPY_16_BYTES
873#endif
874#endif
875#endif
876 bdnz 1b
877 beqlr
878 crnot 4*cr0+eq,4*cr0+eq
879 li r0,MAX_COPY_PREFETCH
880 li r11,4
881 b 2b
882#endif /* CONFIG_8xx */
883
884/*
885 * void atomic_clear_mask(atomic_t mask, atomic_t *addr)
886 * void atomic_set_mask(atomic_t mask, atomic_t *addr);
887 */
888_GLOBAL(atomic_clear_mask)
88910: lwarx r5,0,r4
890 andc r5,r5,r3
891 PPC405_ERR77(0,r4)
892 stwcx. r5,0,r4
893 bne- 10b
894 blr
895_GLOBAL(atomic_set_mask)
89610: lwarx r5,0,r4
897 or r5,r5,r3
898 PPC405_ERR77(0,r4)
899 stwcx. r5,0,r4
900 bne- 10b
901 blr
902
903/*
904 * I/O string operations
905 *
906 * insb(port, buf, len)
907 * outsb(port, buf, len)
908 * insw(port, buf, len)
909 * outsw(port, buf, len)
910 * insl(port, buf, len)
911 * outsl(port, buf, len)
912 * insw_ns(port, buf, len)
913 * outsw_ns(port, buf, len)
914 * insl_ns(port, buf, len)
915 * outsl_ns(port, buf, len)
916 *
917 * The *_ns versions don't do byte-swapping.
918 */
919_GLOBAL(_insb)
920 cmpwi 0,r5,0
921 mtctr r5
922 subi r4,r4,1
923 blelr-
92400: lbz r5,0(r3)
925 eieio
926 stbu r5,1(r4)
927 bdnz 00b
928 blr
929
930_GLOBAL(_outsb)
931 cmpwi 0,r5,0
932 mtctr r5
933 subi r4,r4,1
934 blelr-
93500: lbzu r5,1(r4)
936 stb r5,0(r3)
937 eieio
938 bdnz 00b
939 blr
940
941_GLOBAL(_insw)
942 cmpwi 0,r5,0
943 mtctr r5
944 subi r4,r4,2
945 blelr-
94600: lhbrx r5,0,r3
947 eieio
948 sthu r5,2(r4)
949 bdnz 00b
950 blr
951
952_GLOBAL(_outsw)
953 cmpwi 0,r5,0
954 mtctr r5
955 subi r4,r4,2
956 blelr-
95700: lhzu r5,2(r4)
958 eieio
959 sthbrx r5,0,r3
960 bdnz 00b
961 blr
962
963_GLOBAL(_insl)
964 cmpwi 0,r5,0
965 mtctr r5
966 subi r4,r4,4
967 blelr-
96800: lwbrx r5,0,r3
969 eieio
970 stwu r5,4(r4)
971 bdnz 00b
972 blr
973
974_GLOBAL(_outsl)
975 cmpwi 0,r5,0
976 mtctr r5
977 subi r4,r4,4
978 blelr-
97900: lwzu r5,4(r4)
980 stwbrx r5,0,r3
981 eieio
982 bdnz 00b
983 blr
984
985_GLOBAL(__ide_mm_insw)
986_GLOBAL(_insw_ns)
987 cmpwi 0,r5,0
988 mtctr r5
989 subi r4,r4,2
990 blelr-
99100: lhz r5,0(r3)
992 eieio
993 sthu r5,2(r4)
994 bdnz 00b
995 blr
996
997_GLOBAL(__ide_mm_outsw)
998_GLOBAL(_outsw_ns)
999 cmpwi 0,r5,0
1000 mtctr r5
1001 subi r4,r4,2
1002 blelr-
100300: lhzu r5,2(r4)
1004 sth r5,0(r3)
1005 eieio
1006 bdnz 00b
1007 blr
1008
1009_GLOBAL(__ide_mm_insl)
1010_GLOBAL(_insl_ns)
1011 cmpwi 0,r5,0
1012 mtctr r5
1013 subi r4,r4,4
1014 blelr-
101500: lwz r5,0(r3)
1016 eieio
1017 stwu r5,4(r4)
1018 bdnz 00b
1019 blr
1020
1021_GLOBAL(__ide_mm_outsl)
1022_GLOBAL(_outsl_ns)
1023 cmpwi 0,r5,0
1024 mtctr r5
1025 subi r4,r4,4
1026 blelr-
102700: lwzu r5,4(r4)
1028 stw r5,0(r3)
1029 eieio
1030 bdnz 00b
1031 blr
1032
1033/*
1034 * Extended precision shifts.
1035 *
1036 * Updated to be valid for shift counts from 0 to 63 inclusive.
1037 * -- Gabriel
1038 *
1039 * R3/R4 has 64 bit value
1040 * R5 has shift count
1041 * result in R3/R4
1042 *
1043 * ashrdi3: arithmetic right shift (sign propagation)
1044 * lshrdi3: logical right shift
1045 * ashldi3: left shift
1046 */
1047_GLOBAL(__ashrdi3)
1048 subfic r6,r5,32
1049 srw r4,r4,r5 # LSW = count > 31 ? 0 : LSW >> count
1050 addi r7,r5,32 # could be xori, or addi with -32
1051 slw r6,r3,r6 # t1 = count > 31 ? 0 : MSW << (32-count)
1052 rlwinm r8,r7,0,32 # t3 = (count < 32) ? 32 : 0
1053 sraw r7,r3,r7 # t2 = MSW >> (count-32)
1054 or r4,r4,r6 # LSW |= t1
1055 slw r7,r7,r8 # t2 = (count < 32) ? 0 : t2
1056 sraw r3,r3,r5 # MSW = MSW >> count
1057 or r4,r4,r7 # LSW |= t2
1058 blr
1059
1060_GLOBAL(__ashldi3)
1061 subfic r6,r5,32
1062 slw r3,r3,r5 # MSW = count > 31 ? 0 : MSW << count
1063 addi r7,r5,32 # could be xori, or addi with -32
1064 srw r6,r4,r6 # t1 = count > 31 ? 0 : LSW >> (32-count)
1065 slw r7,r4,r7 # t2 = count < 32 ? 0 : LSW << (count-32)
1066 or r3,r3,r6 # MSW |= t1
1067 slw r4,r4,r5 # LSW = LSW << count
1068 or r3,r3,r7 # MSW |= t2
1069 blr
1070
1071_GLOBAL(__lshrdi3)
1072 subfic r6,r5,32
1073 srw r4,r4,r5 # LSW = count > 31 ? 0 : LSW >> count
1074 addi r7,r5,32 # could be xori, or addi with -32
1075 slw r6,r3,r6 # t1 = count > 31 ? 0 : MSW << (32-count)
1076 srw r7,r3,r7 # t2 = count < 32 ? 0 : MSW >> (count-32)
1077 or r4,r4,r6 # LSW |= t1
1078 srw r3,r3,r5 # MSW = MSW >> count
1079 or r4,r4,r7 # LSW |= t2
1080 blr
1081
1082_GLOBAL(abs)
1083 srawi r4,r3,31
1084 xor r3,r3,r4
1085 sub r3,r3,r4
1086 blr
1087
1088_GLOBAL(_get_SP)
1089 mr r3,r1 /* Close enough */
1090 blr
1091
1092/*
1093 * These are used in the alignment trap handler when emulating
1094 * single-precision loads and stores.
1095 * We restore and save the fpscr so the task gets the same result
1096 * and exceptions as if the cpu had performed the load or store.
1097 */
1098
1099#if defined(CONFIG_4xx) || defined(CONFIG_E500)
1100_GLOBAL(cvt_fd)
1101 lfs 0,0(r3)
1102 stfd 0,0(r4)
1103 blr
1104
1105_GLOBAL(cvt_df)
1106 lfd 0,0(r3)
1107 stfs 0,0(r4)
1108 blr
1109#else
1110_GLOBAL(cvt_fd)
1111 lfd 0,-4(r5) /* load up fpscr value */
1112 mtfsf 0xff,0
1113 lfs 0,0(r3)
1114 stfd 0,0(r4)
1115 mffs 0 /* save new fpscr value */
1116 stfd 0,-4(r5)
1117 blr
1118
1119_GLOBAL(cvt_df)
1120 lfd 0,-4(r5) /* load up fpscr value */
1121 mtfsf 0xff,0
1122 lfd 0,0(r3)
1123 stfs 0,0(r4)
1124 mffs 0 /* save new fpscr value */
1125 stfd 0,-4(r5)
1126 blr
1127#endif
1128
1129/*
1130 * Create a kernel thread
1131 * kernel_thread(fn, arg, flags)
1132 */
1133_GLOBAL(kernel_thread)
1134 stwu r1,-16(r1)
1135 stw r30,8(r1)
1136 stw r31,12(r1)
1137 mr r30,r3 /* function */
1138 mr r31,r4 /* argument */
1139 ori r3,r5,CLONE_VM /* flags */
1140 oris r3,r3,CLONE_UNTRACED>>16
1141 li r4,0 /* new sp (unused) */
1142 li r0,__NR_clone
1143 sc
1144 cmpwi 0,r3,0 /* parent or child? */
1145 bne 1f /* return if parent */
1146 li r0,0 /* make top-level stack frame */
1147 stwu r0,-16(r1)
1148 mtlr r30 /* fn addr in lr */
1149 mr r3,r31 /* load arg and call fn */
1150 blrl
1151 li r0,__NR_exit /* exit if function returns */
1152 li r3,0
1153 sc
11541: lwz r30,8(r1)
1155 lwz r31,12(r1)
1156 addi r1,r1,16
1157 blr
1158
1159/*
1160 * This routine is just here to keep GCC happy - sigh...
1161 */
1162_GLOBAL(__main)
1163 blr
1164
1165#define SYSCALL(name) \
1166_GLOBAL(name) \
1167 li r0,__NR_##name; \
1168 sc; \
1169 bnslr; \
1170 lis r4,errno@ha; \
1171 stw r3,errno@l(r4); \
1172 li r3,-1; \
1173 blr
1174
1175SYSCALL(execve)
1176
1177/* Why isn't this a) automatic, b) written in 'C'? */
1178 .data
1179 .align 4
1180_GLOBAL(sys_call_table)
1181 .long sys_restart_syscall /* 0 */
1182 .long sys_exit
1183 .long ppc_fork
1184 .long sys_read
1185 .long sys_write
1186 .long sys_open /* 5 */
1187 .long sys_close
1188 .long sys_waitpid
1189 .long sys_creat
1190 .long sys_link
1191 .long sys_unlink /* 10 */
1192 .long sys_execve
1193 .long sys_chdir
1194 .long sys_time
1195 .long sys_mknod
1196 .long sys_chmod /* 15 */
1197 .long sys_lchown
1198 .long sys_ni_syscall /* old break syscall holder */
1199 .long sys_stat
1200 .long sys_lseek
1201 .long sys_getpid /* 20 */
1202 .long sys_mount
1203 .long sys_oldumount
1204 .long sys_setuid
1205 .long sys_getuid
1206 .long sys_stime /* 25 */
1207 .long sys_ptrace
1208 .long sys_alarm
1209 .long sys_fstat
1210 .long sys_pause
1211 .long sys_utime /* 30 */
1212 .long sys_ni_syscall /* old stty syscall holder */
1213 .long sys_ni_syscall /* old gtty syscall holder */
1214 .long sys_access
1215 .long sys_nice
1216 .long sys_ni_syscall /* 35 */ /* old ftime syscall holder */
1217 .long sys_sync
1218 .long sys_kill
1219 .long sys_rename
1220 .long sys_mkdir
1221 .long sys_rmdir /* 40 */
1222 .long sys_dup
1223 .long sys_pipe
1224 .long sys_times
1225 .long sys_ni_syscall /* old prof syscall holder */
1226 .long sys_brk /* 45 */
1227 .long sys_setgid
1228 .long sys_getgid
1229 .long sys_signal
1230 .long sys_geteuid
1231 .long sys_getegid /* 50 */
1232 .long sys_acct
1233 .long sys_umount /* recycled never used phys() */
1234 .long sys_ni_syscall /* old lock syscall holder */
1235 .long sys_ioctl
1236 .long sys_fcntl /* 55 */
1237 .long sys_ni_syscall /* old mpx syscall holder */
1238 .long sys_setpgid
1239 .long sys_ni_syscall /* old ulimit syscall holder */
1240 .long sys_olduname
1241 .long sys_umask /* 60 */
1242 .long sys_chroot
1243 .long sys_ustat
1244 .long sys_dup2
1245 .long sys_getppid
1246 .long sys_getpgrp /* 65 */
1247 .long sys_setsid
1248 .long sys_sigaction
1249 .long sys_sgetmask
1250 .long sys_ssetmask
1251 .long sys_setreuid /* 70 */
1252 .long sys_setregid
1253 .long ppc_sigsuspend
1254 .long sys_sigpending
1255 .long sys_sethostname
1256 .long sys_setrlimit /* 75 */
1257 .long sys_old_getrlimit
1258 .long sys_getrusage
1259 .long sys_gettimeofday
1260 .long sys_settimeofday
1261 .long sys_getgroups /* 80 */
1262 .long sys_setgroups
1263 .long ppc_select
1264 .long sys_symlink
1265 .long sys_lstat
1266 .long sys_readlink /* 85 */
1267 .long sys_uselib
1268 .long sys_swapon
1269 .long sys_reboot
1270 .long old_readdir
1271 .long sys_mmap /* 90 */
1272 .long sys_munmap
1273 .long sys_truncate
1274 .long sys_ftruncate
1275 .long sys_fchmod
1276 .long sys_fchown /* 95 */
1277 .long sys_getpriority
1278 .long sys_setpriority
1279 .long sys_ni_syscall /* old profil syscall holder */
1280 .long sys_statfs
1281 .long sys_fstatfs /* 100 */
1282 .long sys_ni_syscall
1283 .long sys_socketcall
1284 .long sys_syslog
1285 .long sys_setitimer
1286 .long sys_getitimer /* 105 */
1287 .long sys_newstat
1288 .long sys_newlstat
1289 .long sys_newfstat
1290 .long sys_uname
1291 .long sys_ni_syscall /* 110 */
1292 .long sys_vhangup
1293 .long sys_ni_syscall /* old 'idle' syscall */
1294 .long sys_ni_syscall
1295 .long sys_wait4
1296 .long sys_swapoff /* 115 */
1297 .long sys_sysinfo
1298 .long sys_ipc
1299 .long sys_fsync
1300 .long sys_sigreturn
1301 .long ppc_clone /* 120 */
1302 .long sys_setdomainname
1303 .long sys_newuname
1304 .long sys_ni_syscall
1305 .long sys_adjtimex
1306 .long sys_mprotect /* 125 */
1307 .long sys_sigprocmask
1308 .long sys_ni_syscall /* old sys_create_module */
1309 .long sys_init_module
1310 .long sys_delete_module
1311 .long sys_ni_syscall /* old sys_get_kernel_syms */ /* 130 */
1312 .long sys_quotactl
1313 .long sys_getpgid
1314 .long sys_fchdir
1315 .long sys_bdflush
1316 .long sys_sysfs /* 135 */
1317 .long sys_personality
1318 .long sys_ni_syscall /* for afs_syscall */
1319 .long sys_setfsuid
1320 .long sys_setfsgid
1321 .long sys_llseek /* 140 */
1322 .long sys_getdents
1323 .long ppc_select
1324 .long sys_flock
1325 .long sys_msync
1326 .long sys_readv /* 145 */
1327 .long sys_writev
1328 .long sys_getsid
1329 .long sys_fdatasync
1330 .long sys_sysctl
1331 .long sys_mlock /* 150 */
1332 .long sys_munlock
1333 .long sys_mlockall
1334 .long sys_munlockall
1335 .long sys_sched_setparam
1336 .long sys_sched_getparam /* 155 */
1337 .long sys_sched_setscheduler
1338 .long sys_sched_getscheduler
1339 .long sys_sched_yield
1340 .long sys_sched_get_priority_max
1341 .long sys_sched_get_priority_min /* 160 */
1342 .long sys_sched_rr_get_interval
1343 .long sys_nanosleep
1344 .long sys_mremap
1345 .long sys_setresuid
1346 .long sys_getresuid /* 165 */
1347 .long sys_ni_syscall /* old sys_query_module */
1348 .long sys_poll
1349 .long sys_nfsservctl
1350 .long sys_setresgid
1351 .long sys_getresgid /* 170 */
1352 .long sys_prctl
1353 .long sys_rt_sigreturn
1354 .long sys_rt_sigaction
1355 .long sys_rt_sigprocmask
1356 .long sys_rt_sigpending /* 175 */
1357 .long sys_rt_sigtimedwait
1358 .long sys_rt_sigqueueinfo
1359 .long ppc_rt_sigsuspend
1360 .long sys_pread64
1361 .long sys_pwrite64 /* 180 */
1362 .long sys_chown
1363 .long sys_getcwd
1364 .long sys_capget
1365 .long sys_capset
1366 .long sys_sigaltstack /* 185 */
1367 .long sys_sendfile
1368 .long sys_ni_syscall /* streams1 */
1369 .long sys_ni_syscall /* streams2 */
1370 .long ppc_vfork
1371 .long sys_getrlimit /* 190 */
1372 .long sys_readahead
1373 .long sys_mmap2
1374 .long sys_truncate64
1375 .long sys_ftruncate64
1376 .long sys_stat64 /* 195 */
1377 .long sys_lstat64
1378 .long sys_fstat64
1379 .long sys_pciconfig_read
1380 .long sys_pciconfig_write
1381 .long sys_pciconfig_iobase /* 200 */
1382 .long sys_ni_syscall /* 201 - reserved - MacOnLinux - new */
1383 .long sys_getdents64
1384 .long sys_pivot_root
1385 .long sys_fcntl64
1386 .long sys_madvise /* 205 */
1387 .long sys_mincore
1388 .long sys_gettid
1389 .long sys_tkill
1390 .long sys_setxattr
1391 .long sys_lsetxattr /* 210 */
1392 .long sys_fsetxattr
1393 .long sys_getxattr
1394 .long sys_lgetxattr
1395 .long sys_fgetxattr
1396 .long sys_listxattr /* 215 */
1397 .long sys_llistxattr
1398 .long sys_flistxattr
1399 .long sys_removexattr
1400 .long sys_lremovexattr
1401 .long sys_fremovexattr /* 220 */
1402 .long sys_futex
1403 .long sys_sched_setaffinity
1404 .long sys_sched_getaffinity
1405 .long sys_ni_syscall
1406 .long sys_ni_syscall /* 225 - reserved for Tux */
1407 .long sys_sendfile64
1408 .long sys_io_setup
1409 .long sys_io_destroy
1410 .long sys_io_getevents
1411 .long sys_io_submit /* 230 */
1412 .long sys_io_cancel
1413 .long sys_set_tid_address
1414 .long sys_fadvise64
1415 .long sys_exit_group
1416 .long sys_lookup_dcookie /* 235 */
1417 .long sys_epoll_create
1418 .long sys_epoll_ctl
1419 .long sys_epoll_wait
1420 .long sys_remap_file_pages
1421 .long sys_timer_create /* 240 */
1422 .long sys_timer_settime
1423 .long sys_timer_gettime
1424 .long sys_timer_getoverrun
1425 .long sys_timer_delete
1426 .long sys_clock_settime /* 245 */
1427 .long sys_clock_gettime
1428 .long sys_clock_getres
1429 .long sys_clock_nanosleep
1430 .long ppc_swapcontext
1431 .long sys_tgkill /* 250 */
1432 .long sys_utimes
1433 .long sys_statfs64
1434 .long sys_fstatfs64
1435 .long ppc_fadvise64_64
1436 .long sys_ni_syscall /* 255 - rtas (used on ppc64) */
1437 .long sys_debug_setcontext
1438 .long sys_ni_syscall /* 257 reserved for vserver */
1439 .long sys_ni_syscall /* 258 reserved for new sys_remap_file_pages */
1440 .long sys_ni_syscall /* 259 reserved for new sys_mbind */
1441 .long sys_ni_syscall /* 260 reserved for new sys_get_mempolicy */
1442 .long sys_ni_syscall /* 261 reserved for new sys_set_mempolicy */
1443 .long sys_mq_open
1444 .long sys_mq_unlink
1445 .long sys_mq_timedsend
1446 .long sys_mq_timedreceive /* 265 */
1447 .long sys_mq_notify
1448 .long sys_mq_getsetattr
1449 .long sys_ni_syscall /* 268 reserved for sys_kexec_load */
1450 .long sys_add_key
1451 .long sys_request_key /* 270 */
1452 .long sys_keyctl
1453 .long sys_waitid
diff --git a/arch/ppc/kernel/module.c b/arch/ppc/kernel/module.c
new file mode 100644
index 000000000000..92f4e5f64f02
--- /dev/null
+++ b/arch/ppc/kernel/module.c
@@ -0,0 +1,320 @@
1/* Kernel module help for PPC.
2 Copyright (C) 2001 Rusty Russell.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17*/
18#include <linux/module.h>
19#include <linux/moduleloader.h>
20#include <linux/elf.h>
21#include <linux/vmalloc.h>
22#include <linux/fs.h>
23#include <linux/string.h>
24#include <linux/kernel.h>
25#include <linux/cache.h>
26
27#if 0
28#define DEBUGP printk
29#else
30#define DEBUGP(fmt , ...)
31#endif
32
33LIST_HEAD(module_bug_list);
34
35void *module_alloc(unsigned long size)
36{
37 if (size == 0)
38 return NULL;
39 return vmalloc(size);
40}
41
42/* Free memory returned from module_alloc */
43void module_free(struct module *mod, void *module_region)
44{
45 vfree(module_region);
46 /* FIXME: If module_region == mod->init_region, trim exception
47 table entries. */
48}
49
50/* Count how many different relocations (different symbol, different
51 addend) */
52static unsigned int count_relocs(const Elf32_Rela *rela, unsigned int num)
53{
54 unsigned int i, j, ret = 0;
55
56 /* Sure, this is order(n^2), but it's usually short, and not
57 time critical */
58 for (i = 0; i < num; i++) {
59 for (j = 0; j < i; j++) {
60 /* If this addend appeared before, it's
61 already been counted */
62 if (ELF32_R_SYM(rela[i].r_info)
63 == ELF32_R_SYM(rela[j].r_info)
64 && rela[i].r_addend == rela[j].r_addend)
65 break;
66 }
67 if (j == i) ret++;
68 }
69 return ret;
70}
71
72/* Get the potential trampolines size required of the init and
73 non-init sections */
74static unsigned long get_plt_size(const Elf32_Ehdr *hdr,
75 const Elf32_Shdr *sechdrs,
76 const char *secstrings,
77 int is_init)
78{
79 unsigned long ret = 0;
80 unsigned i;
81
82 /* Everything marked ALLOC (this includes the exported
83 symbols) */
84 for (i = 1; i < hdr->e_shnum; i++) {
85 /* If it's called *.init*, and we're not init, we're
86 not interested */
87 if ((strstr(secstrings + sechdrs[i].sh_name, ".init") != 0)
88 != is_init)
89 continue;
90
91 /* We don't want to look at debug sections. */
92 if (strstr(secstrings + sechdrs[i].sh_name, ".debug") != 0)
93 continue;
94
95 if (sechdrs[i].sh_type == SHT_RELA) {
96 DEBUGP("Found relocations in section %u\n", i);
97 DEBUGP("Ptr: %p. Number: %u\n",
98 (void *)hdr + sechdrs[i].sh_offset,
99 sechdrs[i].sh_size / sizeof(Elf32_Rela));
100 ret += count_relocs((void *)hdr
101 + sechdrs[i].sh_offset,
102 sechdrs[i].sh_size
103 / sizeof(Elf32_Rela))
104 * sizeof(struct ppc_plt_entry);
105 }
106 }
107
108 return ret;
109}
110
111int module_frob_arch_sections(Elf32_Ehdr *hdr,
112 Elf32_Shdr *sechdrs,
113 char *secstrings,
114 struct module *me)
115{
116 unsigned int i;
117
118 /* Find .plt and .init.plt sections */
119 for (i = 0; i < hdr->e_shnum; i++) {
120 if (strcmp(secstrings + sechdrs[i].sh_name, ".init.plt") == 0)
121 me->arch.init_plt_section = i;
122 else if (strcmp(secstrings + sechdrs[i].sh_name, ".plt") == 0)
123 me->arch.core_plt_section = i;
124 }
125 if (!me->arch.core_plt_section || !me->arch.init_plt_section) {
126 printk("Module doesn't contain .plt or .init.plt sections.\n");
127 return -ENOEXEC;
128 }
129
130 /* Override their sizes */
131 sechdrs[me->arch.core_plt_section].sh_size
132 = get_plt_size(hdr, sechdrs, secstrings, 0);
133 sechdrs[me->arch.init_plt_section].sh_size
134 = get_plt_size(hdr, sechdrs, secstrings, 1);
135 return 0;
136}
137
138int apply_relocate(Elf32_Shdr *sechdrs,
139 const char *strtab,
140 unsigned int symindex,
141 unsigned int relsec,
142 struct module *module)
143{
144 printk(KERN_ERR "%s: Non-ADD RELOCATION unsupported\n",
145 module->name);
146 return -ENOEXEC;
147}
148
149static inline int entry_matches(struct ppc_plt_entry *entry, Elf32_Addr val)
150{
151 if (entry->jump[0] == 0x3d600000 + ((val + 0x8000) >> 16)
152 && entry->jump[1] == 0x396b0000 + (val & 0xffff))
153 return 1;
154 return 0;
155}
156
157/* Set up a trampoline in the PLT to bounce us to the distant function */
158static uint32_t do_plt_call(void *location,
159 Elf32_Addr val,
160 Elf32_Shdr *sechdrs,
161 struct module *mod)
162{
163 struct ppc_plt_entry *entry;
164
165 DEBUGP("Doing plt for call to 0x%x at 0x%x\n", val, (unsigned int)location);
166 /* Init, or core PLT? */
167 if (location >= mod->module_core
168 && location < mod->module_core + mod->core_size)
169 entry = (void *)sechdrs[mod->arch.core_plt_section].sh_addr;
170 else
171 entry = (void *)sechdrs[mod->arch.init_plt_section].sh_addr;
172
173 /* Find this entry, or if that fails, the next avail. entry */
174 while (entry->jump[0]) {
175 if (entry_matches(entry, val)) return (uint32_t)entry;
176 entry++;
177 }
178
179 /* Stolen from Paul Mackerras as well... */
180 entry->jump[0] = 0x3d600000+((val+0x8000)>>16); /* lis r11,sym@ha */
181 entry->jump[1] = 0x396b0000 + (val&0xffff); /* addi r11,r11,sym@l*/
182 entry->jump[2] = 0x7d6903a6; /* mtctr r11 */
183 entry->jump[3] = 0x4e800420; /* bctr */
184
185 DEBUGP("Initialized plt for 0x%x at %p\n", val, entry);
186 return (uint32_t)entry;
187}
188
189int apply_relocate_add(Elf32_Shdr *sechdrs,
190 const char *strtab,
191 unsigned int symindex,
192 unsigned int relsec,
193 struct module *module)
194{
195 unsigned int i;
196 Elf32_Rela *rela = (void *)sechdrs[relsec].sh_addr;
197 Elf32_Sym *sym;
198 uint32_t *location;
199 uint32_t value;
200
201 DEBUGP("Applying ADD relocate section %u to %u\n", relsec,
202 sechdrs[relsec].sh_info);
203 for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rela); i++) {
204 /* This is where to make the change */
205 location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr
206 + rela[i].r_offset;
207 /* This is the symbol it is referring to. Note that all
208 undefined symbols have been resolved. */
209 sym = (Elf32_Sym *)sechdrs[symindex].sh_addr
210 + ELF32_R_SYM(rela[i].r_info);
211 /* `Everything is relative'. */
212 value = sym->st_value + rela[i].r_addend;
213
214 switch (ELF32_R_TYPE(rela[i].r_info)) {
215 case R_PPC_ADDR32:
216 /* Simply set it */
217 *(uint32_t *)location = value;
218 break;
219
220 case R_PPC_ADDR16_LO:
221 /* Low half of the symbol */
222 *(uint16_t *)location = value;
223 break;
224
225 case R_PPC_ADDR16_HA:
226 /* Sign-adjusted lower 16 bits: PPC ELF ABI says:
227 (((x >> 16) + ((x & 0x8000) ? 1 : 0))) & 0xFFFF.
228 This is the same, only sane.
229 */
230 *(uint16_t *)location = (value + 0x8000) >> 16;
231 break;
232
233 case R_PPC_REL24:
234 if ((int)(value - (uint32_t)location) < -0x02000000
235 || (int)(value - (uint32_t)location) >= 0x02000000)
236 value = do_plt_call(location, value,
237 sechdrs, module);
238
239 /* Only replace bits 2 through 26 */
240 DEBUGP("REL24 value = %08X. location = %08X\n",
241 value, (uint32_t)location);
242 DEBUGP("Location before: %08X.\n",
243 *(uint32_t *)location);
244 *(uint32_t *)location
245 = (*(uint32_t *)location & ~0x03fffffc)
246 | ((value - (uint32_t)location)
247 & 0x03fffffc);
248 DEBUGP("Location after: %08X.\n",
249 *(uint32_t *)location);
250 DEBUGP("ie. jump to %08X+%08X = %08X\n",
251 *(uint32_t *)location & 0x03fffffc,
252 (uint32_t)location,
253 (*(uint32_t *)location & 0x03fffffc)
254 + (uint32_t)location);
255 break;
256
257 case R_PPC_REL32:
258 /* 32-bit relative jump. */
259 *(uint32_t *)location = value - (uint32_t)location;
260 break;
261
262 default:
263 printk("%s: unknown ADD relocation: %u\n",
264 module->name,
265 ELF32_R_TYPE(rela[i].r_info));
266 return -ENOEXEC;
267 }
268 }
269 return 0;
270}
271
272int module_finalize(const Elf_Ehdr *hdr,
273 const Elf_Shdr *sechdrs,
274 struct module *me)
275{
276 char *secstrings;
277 unsigned int i;
278
279 me->arch.bug_table = NULL;
280 me->arch.num_bugs = 0;
281
282 /* Find the __bug_table section, if present */
283 secstrings = (char *)hdr + sechdrs[hdr->e_shstrndx].sh_offset;
284 for (i = 1; i < hdr->e_shnum; i++) {
285 if (strcmp(secstrings+sechdrs[i].sh_name, "__bug_table"))
286 continue;
287 me->arch.bug_table = (void *) sechdrs[i].sh_addr;
288 me->arch.num_bugs = sechdrs[i].sh_size / sizeof(struct bug_entry);
289 break;
290 }
291
292 /*
293 * Strictly speaking this should have a spinlock to protect against
294 * traversals, but since we only traverse on BUG()s, a spinlock
295 * could potentially lead to deadlock and thus be counter-productive.
296 */
297 list_add(&me->arch.bug_list, &module_bug_list);
298
299 return 0;
300}
301
302void module_arch_cleanup(struct module *mod)
303{
304 list_del(&mod->arch.bug_list);
305}
306
307struct bug_entry *module_find_bug(unsigned long bugaddr)
308{
309 struct mod_arch_specific *mod;
310 unsigned int i;
311 struct bug_entry *bug;
312
313 list_for_each_entry(mod, &module_bug_list, bug_list) {
314 bug = mod->bug_table;
315 for (i = 0; i < mod->num_bugs; ++i, ++bug)
316 if (bugaddr == bug->bug_addr)
317 return bug;
318 }
319 return NULL;
320}
diff --git a/arch/ppc/kernel/pci.c b/arch/ppc/kernel/pci.c
new file mode 100644
index 000000000000..98f94b60204c
--- /dev/null
+++ b/arch/ppc/kernel/pci.c
@@ -0,0 +1,1849 @@
1/*
2 * Common pmac/prep/chrp pci routines. -- Cort
3 */
4
5#include <linux/config.h>
6#include <linux/kernel.h>
7#include <linux/pci.h>
8#include <linux/delay.h>
9#include <linux/string.h>
10#include <linux/init.h>
11#include <linux/capability.h>
12#include <linux/sched.h>
13#include <linux/errno.h>
14#include <linux/bootmem.h>
15
16#include <asm/processor.h>
17#include <asm/io.h>
18#include <asm/prom.h>
19#include <asm/sections.h>
20#include <asm/pci-bridge.h>
21#include <asm/byteorder.h>
22#include <asm/irq.h>
23#include <asm/uaccess.h>
24
25#undef DEBUG
26
27#ifdef DEBUG
28#define DBG(x...) printk(x)
29#else
30#define DBG(x...)
31#endif
32
33unsigned long isa_io_base = 0;
34unsigned long isa_mem_base = 0;
35unsigned long pci_dram_offset = 0;
36int pcibios_assign_bus_offset = 1;
37
38void pcibios_make_OF_bus_map(void);
39
40static int pci_relocate_bridge_resource(struct pci_bus *bus, int i);
41static int probe_resource(struct pci_bus *parent, struct resource *pr,
42 struct resource *res, struct resource **conflict);
43static void update_bridge_base(struct pci_bus *bus, int i);
44static void pcibios_fixup_resources(struct pci_dev* dev);
45static void fixup_broken_pcnet32(struct pci_dev* dev);
46static int reparent_resources(struct resource *parent, struct resource *res);
47static void fixup_rev1_53c810(struct pci_dev* dev);
48static void fixup_cpc710_pci64(struct pci_dev* dev);
49#ifdef CONFIG_PPC_OF
50static u8* pci_to_OF_bus_map;
51#endif
52
53/* By default, we don't re-assign bus numbers. We do this only on
54 * some pmacs
55 */
56int pci_assign_all_busses;
57
58struct pci_controller* hose_head;
59struct pci_controller** hose_tail = &hose_head;
60
61static int pci_bus_count;
62
63static void
64fixup_rev1_53c810(struct pci_dev* dev)
65{
66 /* rev 1 ncr53c810 chips don't set the class at all which means
67 * they don't get their resources remapped. Fix that here.
68 */
69
70 if ((dev->class == PCI_CLASS_NOT_DEFINED)) {
71 printk("NCR 53c810 rev 1 detected, setting PCI class.\n");
72 dev->class = PCI_CLASS_STORAGE_SCSI;
73 }
74}
75DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NCR, PCI_DEVICE_ID_NCR_53C810, fixup_rev1_53c810);
76
77static void
78fixup_broken_pcnet32(struct pci_dev* dev)
79{
80 if ((dev->class>>8 == PCI_CLASS_NETWORK_ETHERNET)) {
81 dev->vendor = PCI_VENDOR_ID_AMD;
82 pci_write_config_word(dev, PCI_VENDOR_ID, PCI_VENDOR_ID_AMD);
83 pci_name_device(dev);
84 }
85}
86DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TRIDENT, PCI_ANY_ID, fixup_broken_pcnet32);
87
88static void
89fixup_cpc710_pci64(struct pci_dev* dev)
90{
91 /* Hide the PCI64 BARs from the kernel as their content doesn't
92 * fit well in the resource management
93 */
94 dev->resource[0].start = dev->resource[0].end = 0;
95 dev->resource[0].flags = 0;
96 dev->resource[1].start = dev->resource[1].end = 0;
97 dev->resource[1].flags = 0;
98}
99DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_CPC710_PCI64, fixup_cpc710_pci64);
100
101static void
102pcibios_fixup_resources(struct pci_dev *dev)
103{
104 struct pci_controller* hose = (struct pci_controller *)dev->sysdata;
105 int i;
106 unsigned long offset;
107
108 if (!hose) {
109 printk(KERN_ERR "No hose for PCI dev %s!\n", pci_name(dev));
110 return;
111 }
112 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
113 struct resource *res = dev->resource + i;
114 if (!res->flags)
115 continue;
116 if (res->end == 0xffffffff) {
117 DBG("PCI:%s Resource %d [%08lx-%08lx] is unassigned\n",
118 pci_name(dev), i, res->start, res->end);
119 res->end -= res->start;
120 res->start = 0;
121 res->flags |= IORESOURCE_UNSET;
122 continue;
123 }
124 offset = 0;
125 if (res->flags & IORESOURCE_MEM) {
126 offset = hose->pci_mem_offset;
127 } else if (res->flags & IORESOURCE_IO) {
128 offset = (unsigned long) hose->io_base_virt
129 - isa_io_base;
130 }
131 if (offset != 0) {
132 res->start += offset;
133 res->end += offset;
134#ifdef DEBUG
135 printk("Fixup res %d (%lx) of dev %s: %lx -> %lx\n",
136 i, res->flags, pci_name(dev),
137 res->start - offset, res->start);
138#endif
139 }
140 }
141
142 /* Call machine specific resource fixup */
143 if (ppc_md.pcibios_fixup_resources)
144 ppc_md.pcibios_fixup_resources(dev);
145}
146DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pcibios_fixup_resources);
147
148void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
149 struct resource *res)
150{
151 unsigned long offset = 0;
152 struct pci_controller *hose = dev->sysdata;
153
154 if (hose && res->flags & IORESOURCE_IO)
155 offset = (unsigned long)hose->io_base_virt - isa_io_base;
156 else if (hose && res->flags & IORESOURCE_MEM)
157 offset = hose->pci_mem_offset;
158 region->start = res->start - offset;
159 region->end = res->end - offset;
160}
161EXPORT_SYMBOL(pcibios_resource_to_bus);
162
163/*
164 * We need to avoid collisions with `mirrored' VGA ports
165 * and other strange ISA hardware, so we always want the
166 * addresses to be allocated in the 0x000-0x0ff region
167 * modulo 0x400.
168 *
169 * Why? Because some silly external IO cards only decode
170 * the low 10 bits of the IO address. The 0x00-0xff region
171 * is reserved for motherboard devices that decode all 16
172 * bits, so it's ok to allocate at, say, 0x2800-0x28ff,
173 * but we want to try to avoid allocating at 0x2900-0x2bff
174 * which might have be mirrored at 0x0100-0x03ff..
175 */
176void pcibios_align_resource(void *data, struct resource *res, unsigned long size,
177 unsigned long align)
178{
179 struct pci_dev *dev = data;
180
181 if (res->flags & IORESOURCE_IO) {
182 unsigned long start = res->start;
183
184 if (size > 0x100) {
185 printk(KERN_ERR "PCI: I/O Region %s/%d too large"
186 " (%ld bytes)\n", pci_name(dev),
187 dev->resource - res, size);
188 }
189
190 if (start & 0x300) {
191 start = (start + 0x3ff) & ~0x3ff;
192 res->start = start;
193 }
194 }
195}
196EXPORT_SYMBOL(pcibios_align_resource);
197
198/*
199 * Handle resources of PCI devices. If the world were perfect, we could
200 * just allocate all the resource regions and do nothing more. It isn't.
201 * On the other hand, we cannot just re-allocate all devices, as it would
202 * require us to know lots of host bridge internals. So we attempt to
203 * keep as much of the original configuration as possible, but tweak it
204 * when it's found to be wrong.
205 *
206 * Known BIOS problems we have to work around:
207 * - I/O or memory regions not configured
208 * - regions configured, but not enabled in the command register
209 * - bogus I/O addresses above 64K used
210 * - expansion ROMs left enabled (this may sound harmless, but given
211 * the fact the PCI specs explicitly allow address decoders to be
212 * shared between expansion ROMs and other resource regions, it's
213 * at least dangerous)
214 *
215 * Our solution:
216 * (1) Allocate resources for all buses behind PCI-to-PCI bridges.
217 * This gives us fixed barriers on where we can allocate.
218 * (2) Allocate resources for all enabled devices. If there is
219 * a collision, just mark the resource as unallocated. Also
220 * disable expansion ROMs during this step.
221 * (3) Try to allocate resources for disabled devices. If the
222 * resources were assigned correctly, everything goes well,
223 * if they weren't, they won't disturb allocation of other
224 * resources.
225 * (4) Assign new addresses to resources which were either
226 * not configured at all or misconfigured. If explicitly
227 * requested by the user, configure expansion ROM address
228 * as well.
229 */
230
231static void __init
232pcibios_allocate_bus_resources(struct list_head *bus_list)
233{
234 struct pci_bus *bus;
235 int i;
236 struct resource *res, *pr;
237
238 /* Depth-First Search on bus tree */
239 list_for_each_entry(bus, bus_list, node) {
240 for (i = 0; i < 4; ++i) {
241 if ((res = bus->resource[i]) == NULL || !res->flags
242 || res->start > res->end)
243 continue;
244 if (bus->parent == NULL)
245 pr = (res->flags & IORESOURCE_IO)?
246 &ioport_resource: &iomem_resource;
247 else {
248 pr = pci_find_parent_resource(bus->self, res);
249 if (pr == res) {
250 /* this happens when the generic PCI
251 * code (wrongly) decides that this
252 * bridge is transparent -- paulus
253 */
254 continue;
255 }
256 }
257
258 DBG("PCI: bridge rsrc %lx..%lx (%lx), parent %p\n",
259 res->start, res->end, res->flags, pr);
260 if (pr) {
261 if (request_resource(pr, res) == 0)
262 continue;
263 /*
264 * Must be a conflict with an existing entry.
265 * Move that entry (or entries) under the
266 * bridge resource and try again.
267 */
268 if (reparent_resources(pr, res) == 0)
269 continue;
270 }
271 printk(KERN_ERR "PCI: Cannot allocate resource region "
272 "%d of PCI bridge %d\n", i, bus->number);
273 if (pci_relocate_bridge_resource(bus, i))
274 bus->resource[i] = NULL;
275 }
276 pcibios_allocate_bus_resources(&bus->children);
277 }
278}
279
280/*
281 * Reparent resource children of pr that conflict with res
282 * under res, and make res replace those children.
283 */
284static int __init
285reparent_resources(struct resource *parent, struct resource *res)
286{
287 struct resource *p, **pp;
288 struct resource **firstpp = NULL;
289
290 for (pp = &parent->child; (p = *pp) != NULL; pp = &p->sibling) {
291 if (p->end < res->start)
292 continue;
293 if (res->end < p->start)
294 break;
295 if (p->start < res->start || p->end > res->end)
296 return -1; /* not completely contained */
297 if (firstpp == NULL)
298 firstpp = pp;
299 }
300 if (firstpp == NULL)
301 return -1; /* didn't find any conflicting entries? */
302 res->parent = parent;
303 res->child = *firstpp;
304 res->sibling = *pp;
305 *firstpp = res;
306 *pp = NULL;
307 for (p = res->child; p != NULL; p = p->sibling) {
308 p->parent = res;
309 DBG(KERN_INFO "PCI: reparented %s [%lx..%lx] under %s\n",
310 p->name, p->start, p->end, res->name);
311 }
312 return 0;
313}
314
315/*
316 * A bridge has been allocated a range which is outside the range
317 * of its parent bridge, so it needs to be moved.
318 */
319static int __init
320pci_relocate_bridge_resource(struct pci_bus *bus, int i)
321{
322 struct resource *res, *pr, *conflict;
323 unsigned long try, size;
324 int j;
325 struct pci_bus *parent = bus->parent;
326
327 if (parent == NULL) {
328 /* shouldn't ever happen */
329 printk(KERN_ERR "PCI: can't move host bridge resource\n");
330 return -1;
331 }
332 res = bus->resource[i];
333 if (res == NULL)
334 return -1;
335 pr = NULL;
336 for (j = 0; j < 4; j++) {
337 struct resource *r = parent->resource[j];
338 if (!r)
339 continue;
340 if ((res->flags ^ r->flags) & (IORESOURCE_IO | IORESOURCE_MEM))
341 continue;
342 if (!((res->flags ^ r->flags) & IORESOURCE_PREFETCH)) {
343 pr = r;
344 break;
345 }
346 if (res->flags & IORESOURCE_PREFETCH)
347 pr = r;
348 }
349 if (pr == NULL)
350 return -1;
351 size = res->end - res->start;
352 if (pr->start > pr->end || size > pr->end - pr->start)
353 return -1;
354 try = pr->end;
355 for (;;) {
356 res->start = try - size;
357 res->end = try;
358 if (probe_resource(bus->parent, pr, res, &conflict) == 0)
359 break;
360 if (conflict->start <= pr->start + size)
361 return -1;
362 try = conflict->start - 1;
363 }
364 if (request_resource(pr, res)) {
365 DBG(KERN_ERR "PCI: huh? couldn't move to %lx..%lx\n",
366 res->start, res->end);
367 return -1; /* "can't happen" */
368 }
369 update_bridge_base(bus, i);
370 printk(KERN_INFO "PCI: bridge %d resource %d moved to %lx..%lx\n",
371 bus->number, i, res->start, res->end);
372 return 0;
373}
374
375static int __init
376probe_resource(struct pci_bus *parent, struct resource *pr,
377 struct resource *res, struct resource **conflict)
378{
379 struct pci_bus *bus;
380 struct pci_dev *dev;
381 struct resource *r;
382 int i;
383
384 for (r = pr->child; r != NULL; r = r->sibling) {
385 if (r->end >= res->start && res->end >= r->start) {
386 *conflict = r;
387 return 1;
388 }
389 }
390 list_for_each_entry(bus, &parent->children, node) {
391 for (i = 0; i < 4; ++i) {
392 if ((r = bus->resource[i]) == NULL)
393 continue;
394 if (!r->flags || r->start > r->end || r == res)
395 continue;
396 if (pci_find_parent_resource(bus->self, r) != pr)
397 continue;
398 if (r->end >= res->start && res->end >= r->start) {
399 *conflict = r;
400 return 1;
401 }
402 }
403 }
404 list_for_each_entry(dev, &parent->devices, bus_list) {
405 for (i = 0; i < 6; ++i) {
406 r = &dev->resource[i];
407 if (!r->flags || (r->flags & IORESOURCE_UNSET))
408 continue;
409 if (pci_find_parent_resource(dev, r) != pr)
410 continue;
411 if (r->end >= res->start && res->end >= r->start) {
412 *conflict = r;
413 return 1;
414 }
415 }
416 }
417 return 0;
418}
419
420static void __init
421update_bridge_base(struct pci_bus *bus, int i)
422{
423 struct resource *res = bus->resource[i];
424 u8 io_base_lo, io_limit_lo;
425 u16 mem_base, mem_limit;
426 u16 cmd;
427 unsigned long start, end, off;
428 struct pci_dev *dev = bus->self;
429 struct pci_controller *hose = dev->sysdata;
430
431 if (!hose) {
432 printk("update_bridge_base: no hose?\n");
433 return;
434 }
435 pci_read_config_word(dev, PCI_COMMAND, &cmd);
436 pci_write_config_word(dev, PCI_COMMAND,
437 cmd & ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY));
438 if (res->flags & IORESOURCE_IO) {
439 off = (unsigned long) hose->io_base_virt - isa_io_base;
440 start = res->start - off;
441 end = res->end - off;
442 io_base_lo = (start >> 8) & PCI_IO_RANGE_MASK;
443 io_limit_lo = (end >> 8) & PCI_IO_RANGE_MASK;
444 if (end > 0xffff) {
445 pci_write_config_word(dev, PCI_IO_BASE_UPPER16,
446 start >> 16);
447 pci_write_config_word(dev, PCI_IO_LIMIT_UPPER16,
448 end >> 16);
449 io_base_lo |= PCI_IO_RANGE_TYPE_32;
450 } else
451 io_base_lo |= PCI_IO_RANGE_TYPE_16;
452 pci_write_config_byte(dev, PCI_IO_BASE, io_base_lo);
453 pci_write_config_byte(dev, PCI_IO_LIMIT, io_limit_lo);
454
455 } else if ((res->flags & (IORESOURCE_MEM | IORESOURCE_PREFETCH))
456 == IORESOURCE_MEM) {
457 off = hose->pci_mem_offset;
458 mem_base = ((res->start - off) >> 16) & PCI_MEMORY_RANGE_MASK;
459 mem_limit = ((res->end - off) >> 16) & PCI_MEMORY_RANGE_MASK;
460 pci_write_config_word(dev, PCI_MEMORY_BASE, mem_base);
461 pci_write_config_word(dev, PCI_MEMORY_LIMIT, mem_limit);
462
463 } else if ((res->flags & (IORESOURCE_MEM | IORESOURCE_PREFETCH))
464 == (IORESOURCE_MEM | IORESOURCE_PREFETCH)) {
465 off = hose->pci_mem_offset;
466 mem_base = ((res->start - off) >> 16) & PCI_PREF_RANGE_MASK;
467 mem_limit = ((res->end - off) >> 16) & PCI_PREF_RANGE_MASK;
468 pci_write_config_word(dev, PCI_PREF_MEMORY_BASE, mem_base);
469 pci_write_config_word(dev, PCI_PREF_MEMORY_LIMIT, mem_limit);
470
471 } else {
472 DBG(KERN_ERR "PCI: ugh, bridge %s res %d has flags=%lx\n",
473 pci_name(dev), i, res->flags);
474 }
475 pci_write_config_word(dev, PCI_COMMAND, cmd);
476}
477
478static inline void alloc_resource(struct pci_dev *dev, int idx)
479{
480 struct resource *pr, *r = &dev->resource[idx];
481
482 DBG("PCI:%s: Resource %d: %08lx-%08lx (f=%lx)\n",
483 pci_name(dev), idx, r->start, r->end, r->flags);
484 pr = pci_find_parent_resource(dev, r);
485 if (!pr || request_resource(pr, r) < 0) {
486 printk(KERN_ERR "PCI: Cannot allocate resource region %d"
487 " of device %s\n", idx, pci_name(dev));
488 if (pr)
489 DBG("PCI: parent is %p: %08lx-%08lx (f=%lx)\n",
490 pr, pr->start, pr->end, pr->flags);
491 /* We'll assign a new address later */
492 r->flags |= IORESOURCE_UNSET;
493 r->end -= r->start;
494 r->start = 0;
495 }
496}
497
498static void __init
499pcibios_allocate_resources(int pass)
500{
501 struct pci_dev *dev = NULL;
502 int idx, disabled;
503 u16 command;
504 struct resource *r;
505
506 while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
507 pci_read_config_word(dev, PCI_COMMAND, &command);
508 for (idx = 0; idx < 6; idx++) {
509 r = &dev->resource[idx];
510 if (r->parent) /* Already allocated */
511 continue;
512 if (!r->flags || (r->flags & IORESOURCE_UNSET))
513 continue; /* Not assigned at all */
514 if (r->flags & IORESOURCE_IO)
515 disabled = !(command & PCI_COMMAND_IO);
516 else
517 disabled = !(command & PCI_COMMAND_MEMORY);
518 if (pass == disabled)
519 alloc_resource(dev, idx);
520 }
521 if (pass)
522 continue;
523 r = &dev->resource[PCI_ROM_RESOURCE];
524 if (r->flags & IORESOURCE_ROM_ENABLE) {
525 /* Turn the ROM off, leave the resource region, but keep it unregistered. */
526 u32 reg;
527 DBG("PCI: Switching off ROM of %s\n", pci_name(dev));
528 r->flags &= ~IORESOURCE_ROM_ENABLE;
529 pci_read_config_dword(dev, dev->rom_base_reg, &reg);
530 pci_write_config_dword(dev, dev->rom_base_reg,
531 reg & ~PCI_ROM_ADDRESS_ENABLE);
532 }
533 }
534}
535
536static void __init
537pcibios_assign_resources(void)
538{
539 struct pci_dev *dev = NULL;
540 int idx;
541 struct resource *r;
542
543 while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
544 int class = dev->class >> 8;
545
546 /* Don't touch classless devices and host bridges */
547 if (!class || class == PCI_CLASS_BRIDGE_HOST)
548 continue;
549
550 for (idx = 0; idx < 6; idx++) {
551 r = &dev->resource[idx];
552
553 /*
554 * We shall assign a new address to this resource,
555 * either because the BIOS (sic) forgot to do so
556 * or because we have decided the old address was
557 * unusable for some reason.
558 */
559 if ((r->flags & IORESOURCE_UNSET) && r->end &&
560 (!ppc_md.pcibios_enable_device_hook ||
561 !ppc_md.pcibios_enable_device_hook(dev, 1))) {
562 r->flags &= ~IORESOURCE_UNSET;
563 pci_assign_resource(dev, idx);
564 }
565 }
566
567#if 0 /* don't assign ROMs */
568 r = &dev->resource[PCI_ROM_RESOURCE];
569 r->end -= r->start;
570 r->start = 0;
571 if (r->end)
572 pci_assign_resource(dev, PCI_ROM_RESOURCE);
573#endif
574 }
575}
576
577
578int
579pcibios_enable_resources(struct pci_dev *dev, int mask)
580{
581 u16 cmd, old_cmd;
582 int idx;
583 struct resource *r;
584
585 pci_read_config_word(dev, PCI_COMMAND, &cmd);
586 old_cmd = cmd;
587 for (idx=0; idx<6; idx++) {
588 /* Only set up the requested stuff */
589 if (!(mask & (1<<idx)))
590 continue;
591
592 r = &dev->resource[idx];
593 if (r->flags & IORESOURCE_UNSET) {
594 printk(KERN_ERR "PCI: Device %s not available because of resource collisions\n", pci_name(dev));
595 return -EINVAL;
596 }
597 if (r->flags & IORESOURCE_IO)
598 cmd |= PCI_COMMAND_IO;
599 if (r->flags & IORESOURCE_MEM)
600 cmd |= PCI_COMMAND_MEMORY;
601 }
602 if (dev->resource[PCI_ROM_RESOURCE].start)
603 cmd |= PCI_COMMAND_MEMORY;
604 if (cmd != old_cmd) {
605 printk("PCI: Enabling device %s (%04x -> %04x)\n", pci_name(dev), old_cmd, cmd);
606 pci_write_config_word(dev, PCI_COMMAND, cmd);
607 }
608 return 0;
609}
610
611static int next_controller_index;
612
613struct pci_controller * __init
614pcibios_alloc_controller(void)
615{
616 struct pci_controller *hose;
617
618 hose = (struct pci_controller *)alloc_bootmem(sizeof(*hose));
619 memset(hose, 0, sizeof(struct pci_controller));
620
621 *hose_tail = hose;
622 hose_tail = &hose->next;
623
624 hose->index = next_controller_index++;
625
626 return hose;
627}
628
629#ifdef CONFIG_PPC_OF
630/*
631 * Functions below are used on OpenFirmware machines.
632 */
633static void __openfirmware
634make_one_node_map(struct device_node* node, u8 pci_bus)
635{
636 int *bus_range;
637 int len;
638
639 if (pci_bus >= pci_bus_count)
640 return;
641 bus_range = (int *) get_property(node, "bus-range", &len);
642 if (bus_range == NULL || len < 2 * sizeof(int)) {
643 printk(KERN_WARNING "Can't get bus-range for %s, "
644 "assuming it starts at 0\n", node->full_name);
645 pci_to_OF_bus_map[pci_bus] = 0;
646 } else
647 pci_to_OF_bus_map[pci_bus] = bus_range[0];
648
649 for (node=node->child; node != 0;node = node->sibling) {
650 struct pci_dev* dev;
651 unsigned int *class_code, *reg;
652
653 class_code = (unsigned int *) get_property(node, "class-code", NULL);
654 if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI &&
655 (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS))
656 continue;
657 reg = (unsigned int *)get_property(node, "reg", NULL);
658 if (!reg)
659 continue;
660 dev = pci_find_slot(pci_bus, ((reg[0] >> 8) & 0xff));
661 if (!dev || !dev->subordinate)
662 continue;
663 make_one_node_map(node, dev->subordinate->number);
664 }
665}
666
667void __openfirmware
668pcibios_make_OF_bus_map(void)
669{
670 int i;
671 struct pci_controller* hose;
672 u8* of_prop_map;
673
674 pci_to_OF_bus_map = (u8*)kmalloc(pci_bus_count, GFP_KERNEL);
675 if (!pci_to_OF_bus_map) {
676 printk(KERN_ERR "Can't allocate OF bus map !\n");
677 return;
678 }
679
680 /* We fill the bus map with invalid values, that helps
681 * debugging.
682 */
683 for (i=0; i<pci_bus_count; i++)
684 pci_to_OF_bus_map[i] = 0xff;
685
686 /* For each hose, we begin searching bridges */
687 for(hose=hose_head; hose; hose=hose->next) {
688 struct device_node* node;
689 node = (struct device_node *)hose->arch_data;
690 if (!node)
691 continue;
692 make_one_node_map(node, hose->first_busno);
693 }
694 of_prop_map = get_property(find_path_device("/"), "pci-OF-bus-map", NULL);
695 if (of_prop_map)
696 memcpy(of_prop_map, pci_to_OF_bus_map, pci_bus_count);
697#ifdef DEBUG
698 printk("PCI->OF bus map:\n");
699 for (i=0; i<pci_bus_count; i++) {
700 if (pci_to_OF_bus_map[i] == 0xff)
701 continue;
702 printk("%d -> %d\n", i, pci_to_OF_bus_map[i]);
703 }
704#endif
705}
706
707typedef int (*pci_OF_scan_iterator)(struct device_node* node, void* data);
708
709static struct device_node* __openfirmware
710scan_OF_pci_childs(struct device_node* node, pci_OF_scan_iterator filter, void* data)
711{
712 struct device_node* sub_node;
713
714 for (; node != 0;node = node->sibling) {
715 unsigned int *class_code;
716
717 if (filter(node, data))
718 return node;
719
720 /* For PCI<->PCI bridges or CardBus bridges, we go down
721 * Note: some OFs create a parent node "multifunc-device" as
722 * a fake root for all functions of a multi-function device,
723 * we go down them as well.
724 */
725 class_code = (unsigned int *) get_property(node, "class-code", NULL);
726 if ((!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI &&
727 (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) &&
728 strcmp(node->name, "multifunc-device"))
729 continue;
730 sub_node = scan_OF_pci_childs(node->child, filter, data);
731 if (sub_node)
732 return sub_node;
733 }
734 return NULL;
735}
736
737static int
738scan_OF_pci_childs_iterator(struct device_node* node, void* data)
739{
740 unsigned int *reg;
741 u8* fdata = (u8*)data;
742
743 reg = (unsigned int *) get_property(node, "reg", NULL);
744 if (reg && ((reg[0] >> 8) & 0xff) == fdata[1]
745 && ((reg[0] >> 16) & 0xff) == fdata[0])
746 return 1;
747 return 0;
748}
749
750static struct device_node* __openfirmware
751scan_OF_childs_for_device(struct device_node* node, u8 bus, u8 dev_fn)
752{
753 u8 filter_data[2] = {bus, dev_fn};
754
755 return scan_OF_pci_childs(node, scan_OF_pci_childs_iterator, filter_data);
756}
757
758/*
759 * Scans the OF tree for a device node matching a PCI device
760 */
761struct device_node *
762pci_busdev_to_OF_node(struct pci_bus *bus, int devfn)
763{
764 struct pci_controller *hose;
765 struct device_node *node;
766 int busnr;
767
768 if (!have_of)
769 return NULL;
770
771 /* Lookup the hose */
772 busnr = bus->number;
773 hose = pci_bus_to_hose(busnr);
774 if (!hose)
775 return NULL;
776
777 /* Check it has an OF node associated */
778 node = (struct device_node *) hose->arch_data;
779 if (!node)
780 return NULL;
781
782 /* Fixup bus number according to what OF think it is. */
783#ifdef CONFIG_PPC_PMAC
784 /* The G5 need a special case here. Basically, we don't remap all
785 * busses on it so we don't create the pci-OF-map. However, we do
786 * remap the AGP bus and so have to deal with it. A future better
787 * fix has to be done by making the remapping per-host and always
788 * filling the pci_to_OF map. --BenH
789 */
790 if (_machine == _MACH_Pmac && busnr >= 0xf0)
791 busnr -= 0xf0;
792 else
793#endif
794 if (pci_to_OF_bus_map)
795 busnr = pci_to_OF_bus_map[busnr];
796 if (busnr == 0xff)
797 return NULL;
798
799 /* Now, lookup childs of the hose */
800 return scan_OF_childs_for_device(node->child, busnr, devfn);
801}
802
803struct device_node*
804pci_device_to_OF_node(struct pci_dev *dev)
805{
806 return pci_busdev_to_OF_node(dev->bus, dev->devfn);
807}
808
809/* This routine is meant to be used early during boot, when the
810 * PCI bus numbers have not yet been assigned, and you need to
811 * issue PCI config cycles to an OF device.
812 * It could also be used to "fix" RTAS config cycles if you want
813 * to set pci_assign_all_busses to 1 and still use RTAS for PCI
814 * config cycles.
815 */
816struct pci_controller*
817pci_find_hose_for_OF_device(struct device_node* node)
818{
819 if (!have_of)
820 return NULL;
821 while(node) {
822 struct pci_controller* hose;
823 for (hose=hose_head;hose;hose=hose->next)
824 if (hose->arch_data == node)
825 return hose;
826 node=node->parent;
827 }
828 return NULL;
829}
830
831static int __openfirmware
832find_OF_pci_device_filter(struct device_node* node, void* data)
833{
834 return ((void *)node == data);
835}
836
837/*
838 * Returns the PCI device matching a given OF node
839 */
840int
841pci_device_from_OF_node(struct device_node* node, u8* bus, u8* devfn)
842{
843 unsigned int *reg;
844 struct pci_controller* hose;
845 struct pci_dev* dev = NULL;
846
847 if (!have_of)
848 return -ENODEV;
849 /* Make sure it's really a PCI device */
850 hose = pci_find_hose_for_OF_device(node);
851 if (!hose || !hose->arch_data)
852 return -ENODEV;
853 if (!scan_OF_pci_childs(((struct device_node*)hose->arch_data)->child,
854 find_OF_pci_device_filter, (void *)node))
855 return -ENODEV;
856 reg = (unsigned int *) get_property(node, "reg", NULL);
857 if (!reg)
858 return -ENODEV;
859 *bus = (reg[0] >> 16) & 0xff;
860 *devfn = ((reg[0] >> 8) & 0xff);
861
862 /* Ok, here we need some tweak. If we have already renumbered
863 * all busses, we can't rely on the OF bus number any more.
864 * the pci_to_OF_bus_map is not enough as several PCI busses
865 * may match the same OF bus number.
866 */
867 if (!pci_to_OF_bus_map)
868 return 0;
869 while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
870 if (pci_to_OF_bus_map[dev->bus->number] != *bus)
871 continue;
872 if (dev->devfn != *devfn)
873 continue;
874 *bus = dev->bus->number;
875 return 0;
876 }
877 return -ENODEV;
878}
879
880void __init
881pci_process_bridge_OF_ranges(struct pci_controller *hose,
882 struct device_node *dev, int primary)
883{
884 static unsigned int static_lc_ranges[256] __initdata;
885 unsigned int *dt_ranges, *lc_ranges, *ranges, *prev;
886 unsigned int size;
887 int rlen = 0, orig_rlen;
888 int memno = 0;
889 struct resource *res;
890 int np, na = prom_n_addr_cells(dev);
891 np = na + 5;
892
893 /* First we try to merge ranges to fix a problem with some pmacs
894 * that can have more than 3 ranges, fortunately using contiguous
895 * addresses -- BenH
896 */
897 dt_ranges = (unsigned int *) get_property(dev, "ranges", &rlen);
898 if (!dt_ranges)
899 return;
900 /* Sanity check, though hopefully that never happens */
901 if (rlen > sizeof(static_lc_ranges)) {
902 printk(KERN_WARNING "OF ranges property too large !\n");
903 rlen = sizeof(static_lc_ranges);
904 }
905 lc_ranges = static_lc_ranges;
906 memcpy(lc_ranges, dt_ranges, rlen);
907 orig_rlen = rlen;
908
909 /* Let's work on a copy of the "ranges" property instead of damaging
910 * the device-tree image in memory
911 */
912 ranges = lc_ranges;
913 prev = NULL;
914 while ((rlen -= np * sizeof(unsigned int)) >= 0) {
915 if (prev) {
916 if (prev[0] == ranges[0] && prev[1] == ranges[1] &&
917 (prev[2] + prev[na+4]) == ranges[2] &&
918 (prev[na+2] + prev[na+4]) == ranges[na+2]) {
919 prev[na+4] += ranges[na+4];
920 ranges[0] = 0;
921 ranges += np;
922 continue;
923 }
924 }
925 prev = ranges;
926 ranges += np;
927 }
928
929 /*
930 * The ranges property is laid out as an array of elements,
931 * each of which comprises:
932 * cells 0 - 2: a PCI address
933 * cells 3 or 3+4: a CPU physical address
934 * (size depending on dev->n_addr_cells)
935 * cells 4+5 or 5+6: the size of the range
936 */
937 ranges = lc_ranges;
938 rlen = orig_rlen;
939 while (ranges && (rlen -= np * sizeof(unsigned int)) >= 0) {
940 res = NULL;
941 size = ranges[na+4];
942 switch (ranges[0] >> 24) {
943 case 1: /* I/O space */
944 if (ranges[2] != 0)
945 break;
946 hose->io_base_phys = ranges[na+2];
947 /* limit I/O space to 16MB */
948 if (size > 0x01000000)
949 size = 0x01000000;
950 hose->io_base_virt = ioremap(ranges[na+2], size);
951 if (primary)
952 isa_io_base = (unsigned long) hose->io_base_virt;
953 res = &hose->io_resource;
954 res->flags = IORESOURCE_IO;
955 res->start = ranges[2];
956 break;
957 case 2: /* memory space */
958 memno = 0;
959 if (ranges[1] == 0 && ranges[2] == 0
960 && ranges[na+4] <= (16 << 20)) {
961 /* 1st 16MB, i.e. ISA memory area */
962 if (primary)
963 isa_mem_base = ranges[na+2];
964 memno = 1;
965 }
966 while (memno < 3 && hose->mem_resources[memno].flags)
967 ++memno;
968 if (memno == 0)
969 hose->pci_mem_offset = ranges[na+2] - ranges[2];
970 if (memno < 3) {
971 res = &hose->mem_resources[memno];
972 res->flags = IORESOURCE_MEM;
973 res->start = ranges[na+2];
974 }
975 break;
976 }
977 if (res != NULL) {
978 res->name = dev->full_name;
979 res->end = res->start + size - 1;
980 res->parent = NULL;
981 res->sibling = NULL;
982 res->child = NULL;
983 }
984 ranges += np;
985 }
986}
987
988/* We create the "pci-OF-bus-map" property now so it appears in the
989 * /proc device tree
990 */
991void __init
992pci_create_OF_bus_map(void)
993{
994 struct property* of_prop;
995
996 of_prop = (struct property*) alloc_bootmem(sizeof(struct property) + 256);
997 if (of_prop && find_path_device("/")) {
998 memset(of_prop, -1, sizeof(struct property) + 256);
999 of_prop->name = "pci-OF-bus-map";
1000 of_prop->length = 256;
1001 of_prop->value = (unsigned char *)&of_prop[1];
1002 prom_add_property(find_path_device("/"), of_prop);
1003 }
1004}
1005
1006static ssize_t pci_show_devspec(struct device *dev, char *buf)
1007{
1008 struct pci_dev *pdev;
1009 struct device_node *np;
1010
1011 pdev = to_pci_dev (dev);
1012 np = pci_device_to_OF_node(pdev);
1013 if (np == NULL || np->full_name == NULL)
1014 return 0;
1015 return sprintf(buf, "%s", np->full_name);
1016}
1017static DEVICE_ATTR(devspec, S_IRUGO, pci_show_devspec, NULL);
1018
1019#endif /* CONFIG_PPC_OF */
1020
1021/* Add sysfs properties */
1022void pcibios_add_platform_entries(struct pci_dev *pdev)
1023{
1024#ifdef CONFIG_PPC_OF
1025 device_create_file(&pdev->dev, &dev_attr_devspec);
1026#endif /* CONFIG_PPC_OF */
1027}
1028
1029
1030#ifdef CONFIG_PPC_PMAC
1031/*
1032 * This set of routines checks for PCI<->PCI bridges that have closed
1033 * IO resources and have child devices. It tries to re-open an IO
1034 * window on them.
1035 *
1036 * This is a _temporary_ fix to workaround a problem with Apple's OF
1037 * closing IO windows on P2P bridges when the OF drivers of cards
1038 * below this bridge don't claim any IO range (typically ATI or
1039 * Adaptec).
1040 *
1041 * A more complete fix would be to use drivers/pci/setup-bus.c, which
1042 * involves a working pcibios_fixup_pbus_ranges(), some more care about
1043 * ordering when creating the host bus resources, and maybe a few more
1044 * minor tweaks
1045 */
1046
1047/* Initialize bridges with base/limit values we have collected */
1048static void __init
1049do_update_p2p_io_resource(struct pci_bus *bus, int enable_vga)
1050{
1051 struct pci_dev *bridge = bus->self;
1052 struct pci_controller* hose = (struct pci_controller *)bridge->sysdata;
1053 u32 l;
1054 u16 w;
1055 struct resource res;
1056
1057 if (bus->resource[0] == NULL)
1058 return;
1059 res = *(bus->resource[0]);
1060
1061 DBG("Remapping Bus %d, bridge: %s\n", bus->number, pci_name(bridge));
1062 res.start -= ((unsigned long) hose->io_base_virt - isa_io_base);
1063 res.end -= ((unsigned long) hose->io_base_virt - isa_io_base);
1064 DBG(" IO window: %08lx-%08lx\n", res.start, res.end);
1065
1066 /* Set up the top and bottom of the PCI I/O segment for this bus. */
1067 pci_read_config_dword(bridge, PCI_IO_BASE, &l);
1068 l &= 0xffff000f;
1069 l |= (res.start >> 8) & 0x00f0;
1070 l |= res.end & 0xf000;
1071 pci_write_config_dword(bridge, PCI_IO_BASE, l);
1072
1073 if ((l & PCI_IO_RANGE_TYPE_MASK) == PCI_IO_RANGE_TYPE_32) {
1074 l = (res.start >> 16) | (res.end & 0xffff0000);
1075 pci_write_config_dword(bridge, PCI_IO_BASE_UPPER16, l);
1076 }
1077
1078 pci_read_config_word(bridge, PCI_COMMAND, &w);
1079 w |= PCI_COMMAND_IO;
1080 pci_write_config_word(bridge, PCI_COMMAND, w);
1081
1082#if 0 /* Enabling this causes XFree 4.2.0 to hang during PCI probe */
1083 if (enable_vga) {
1084 pci_read_config_word(bridge, PCI_BRIDGE_CONTROL, &w);
1085 w |= PCI_BRIDGE_CTL_VGA;
1086 pci_write_config_word(bridge, PCI_BRIDGE_CONTROL, w);
1087 }
1088#endif
1089}
1090
1091/* This function is pretty basic and actually quite broken for the
1092 * general case, it's enough for us right now though. It's supposed
1093 * to tell us if we need to open an IO range at all or not and what
1094 * size.
1095 */
1096static int __init
1097check_for_io_childs(struct pci_bus *bus, struct resource* res, int *found_vga)
1098{
1099 struct pci_dev *dev;
1100 int i;
1101 int rc = 0;
1102
1103#define push_end(res, size) do { unsigned long __sz = (size) ; \
1104 res->end = ((res->end + __sz) / (__sz + 1)) * (__sz + 1) + __sz; \
1105 } while (0)
1106
1107 list_for_each_entry(dev, &bus->devices, bus_list) {
1108 u16 class = dev->class >> 8;
1109
1110 if (class == PCI_CLASS_DISPLAY_VGA ||
1111 class == PCI_CLASS_NOT_DEFINED_VGA)
1112 *found_vga = 1;
1113 if (class >> 8 == PCI_BASE_CLASS_BRIDGE && dev->subordinate)
1114 rc |= check_for_io_childs(dev->subordinate, res, found_vga);
1115 if (class == PCI_CLASS_BRIDGE_CARDBUS)
1116 push_end(res, 0xfff);
1117
1118 for (i=0; i<PCI_NUM_RESOURCES; i++) {
1119 struct resource *r;
1120 unsigned long r_size;
1121
1122 if (dev->class >> 8 == PCI_CLASS_BRIDGE_PCI
1123 && i >= PCI_BRIDGE_RESOURCES)
1124 continue;
1125 r = &dev->resource[i];
1126 r_size = r->end - r->start;
1127 if (r_size < 0xfff)
1128 r_size = 0xfff;
1129 if (r->flags & IORESOURCE_IO && (r_size) != 0) {
1130 rc = 1;
1131 push_end(res, r_size);
1132 }
1133 }
1134 }
1135
1136 return rc;
1137}
1138
1139/* Here we scan all P2P bridges of a given level that have a closed
1140 * IO window. Note that the test for the presence of a VGA card should
1141 * be improved to take into account already configured P2P bridges,
1142 * currently, we don't see them and might end up configuring 2 bridges
1143 * with VGA pass through enabled
1144 */
1145static void __init
1146do_fixup_p2p_level(struct pci_bus *bus)
1147{
1148 struct pci_bus *b;
1149 int i, parent_io;
1150 int has_vga = 0;
1151
1152 for (parent_io=0; parent_io<4; parent_io++)
1153 if (bus->resource[parent_io]
1154 && bus->resource[parent_io]->flags & IORESOURCE_IO)
1155 break;
1156 if (parent_io >= 4)
1157 return;
1158
1159 list_for_each_entry(b, &bus->children, node) {
1160 struct pci_dev *d = b->self;
1161 struct pci_controller* hose = (struct pci_controller *)d->sysdata;
1162 struct resource *res = b->resource[0];
1163 struct resource tmp_res;
1164 unsigned long max;
1165 int found_vga = 0;
1166
1167 memset(&tmp_res, 0, sizeof(tmp_res));
1168 tmp_res.start = bus->resource[parent_io]->start;
1169
1170 /* We don't let low addresses go through that closed P2P bridge, well,
1171 * that may not be necessary but I feel safer that way
1172 */
1173 if (tmp_res.start == 0)
1174 tmp_res.start = 0x1000;
1175
1176 if (!list_empty(&b->devices) && res && res->flags == 0 &&
1177 res != bus->resource[parent_io] &&
1178 (d->class >> 8) == PCI_CLASS_BRIDGE_PCI &&
1179 check_for_io_childs(b, &tmp_res, &found_vga)) {
1180 u8 io_base_lo;
1181
1182 printk(KERN_INFO "Fixing up IO bus %s\n", b->name);
1183
1184 if (found_vga) {
1185 if (has_vga) {
1186 printk(KERN_WARNING "Skipping VGA, already active"
1187 " on bus segment\n");
1188 found_vga = 0;
1189 } else
1190 has_vga = 1;
1191 }
1192 pci_read_config_byte(d, PCI_IO_BASE, &io_base_lo);
1193
1194 if ((io_base_lo & PCI_IO_RANGE_TYPE_MASK) == PCI_IO_RANGE_TYPE_32)
1195 max = ((unsigned long) hose->io_base_virt
1196 - isa_io_base) + 0xffffffff;
1197 else
1198 max = ((unsigned long) hose->io_base_virt
1199 - isa_io_base) + 0xffff;
1200
1201 *res = tmp_res;
1202 res->flags = IORESOURCE_IO;
1203 res->name = b->name;
1204
1205 /* Find a resource in the parent where we can allocate */
1206 for (i = 0 ; i < 4; i++) {
1207 struct resource *r = bus->resource[i];
1208 if (!r)
1209 continue;
1210 if ((r->flags & IORESOURCE_IO) == 0)
1211 continue;
1212 DBG("Trying to allocate from %08lx, size %08lx from parent"
1213 " res %d: %08lx -> %08lx\n",
1214 res->start, res->end, i, r->start, r->end);
1215
1216 if (allocate_resource(r, res, res->end + 1, res->start, max,
1217 res->end + 1, NULL, NULL) < 0) {
1218 DBG("Failed !\n");
1219 continue;
1220 }
1221 do_update_p2p_io_resource(b, found_vga);
1222 break;
1223 }
1224 }
1225 do_fixup_p2p_level(b);
1226 }
1227}
1228
1229static void
1230pcibios_fixup_p2p_bridges(void)
1231{
1232 struct pci_bus *b;
1233
1234 list_for_each_entry(b, &pci_root_buses, node)
1235 do_fixup_p2p_level(b);
1236}
1237
1238#endif /* CONFIG_PPC_PMAC */
1239
1240static int __init
1241pcibios_init(void)
1242{
1243 struct pci_controller *hose;
1244 struct pci_bus *bus;
1245 int next_busno;
1246
1247 printk(KERN_INFO "PCI: Probing PCI hardware\n");
1248
1249 /* Scan all of the recorded PCI controllers. */
1250 for (next_busno = 0, hose = hose_head; hose; hose = hose->next) {
1251 if (pci_assign_all_busses)
1252 hose->first_busno = next_busno;
1253 hose->last_busno = 0xff;
1254 bus = pci_scan_bus(hose->first_busno, hose->ops, hose);
1255 hose->last_busno = bus->subordinate;
1256 if (pci_assign_all_busses || next_busno <= hose->last_busno)
1257 next_busno = hose->last_busno + pcibios_assign_bus_offset;
1258 }
1259 pci_bus_count = next_busno;
1260
1261 /* OpenFirmware based machines need a map of OF bus
1262 * numbers vs. kernel bus numbers since we may have to
1263 * remap them.
1264 */
1265 if (pci_assign_all_busses && have_of)
1266 pcibios_make_OF_bus_map();
1267
1268 /* Do machine dependent PCI interrupt routing */
1269 if (ppc_md.pci_swizzle && ppc_md.pci_map_irq)
1270 pci_fixup_irqs(ppc_md.pci_swizzle, ppc_md.pci_map_irq);
1271
1272 /* Call machine dependent fixup */
1273 if (ppc_md.pcibios_fixup)
1274 ppc_md.pcibios_fixup();
1275
1276 /* Allocate and assign resources */
1277 pcibios_allocate_bus_resources(&pci_root_buses);
1278 pcibios_allocate_resources(0);
1279 pcibios_allocate_resources(1);
1280#ifdef CONFIG_PPC_PMAC
1281 pcibios_fixup_p2p_bridges();
1282#endif /* CONFIG_PPC_PMAC */
1283 pcibios_assign_resources();
1284
1285 /* Call machine dependent post-init code */
1286 if (ppc_md.pcibios_after_init)
1287 ppc_md.pcibios_after_init();
1288
1289 return 0;
1290}
1291
1292subsys_initcall(pcibios_init);
1293
1294unsigned char __init
1295common_swizzle(struct pci_dev *dev, unsigned char *pinp)
1296{
1297 struct pci_controller *hose = dev->sysdata;
1298
1299 if (dev->bus->number != hose->first_busno) {
1300 u8 pin = *pinp;
1301 do {
1302 pin = bridge_swizzle(pin, PCI_SLOT(dev->devfn));
1303 /* Move up the chain of bridges. */
1304 dev = dev->bus->self;
1305 } while (dev->bus->self);
1306 *pinp = pin;
1307
1308 /* The slot is the idsel of the last bridge. */
1309 }
1310 return PCI_SLOT(dev->devfn);
1311}
1312
1313unsigned long resource_fixup(struct pci_dev * dev, struct resource * res,
1314 unsigned long start, unsigned long size)
1315{
1316 return start;
1317}
1318
1319void __init pcibios_fixup_bus(struct pci_bus *bus)
1320{
1321 struct pci_controller *hose = (struct pci_controller *) bus->sysdata;
1322 unsigned long io_offset;
1323 struct resource *res;
1324 int i;
1325
1326 io_offset = (unsigned long)hose->io_base_virt - isa_io_base;
1327 if (bus->parent == NULL) {
1328 /* This is a host bridge - fill in its resources */
1329 hose->bus = bus;
1330
1331 bus->resource[0] = res = &hose->io_resource;
1332 if (!res->flags) {
1333 if (io_offset)
1334 printk(KERN_ERR "I/O resource not set for host"
1335 " bridge %d\n", hose->index);
1336 res->start = 0;
1337 res->end = IO_SPACE_LIMIT;
1338 res->flags = IORESOURCE_IO;
1339 }
1340 res->start += io_offset;
1341 res->end += io_offset;
1342
1343 for (i = 0; i < 3; ++i) {
1344 res = &hose->mem_resources[i];
1345 if (!res->flags) {
1346 if (i > 0)
1347 continue;
1348 printk(KERN_ERR "Memory resource not set for "
1349 "host bridge %d\n", hose->index);
1350 res->start = hose->pci_mem_offset;
1351 res->end = ~0U;
1352 res->flags = IORESOURCE_MEM;
1353 }
1354 bus->resource[i+1] = res;
1355 }
1356 } else {
1357 /* This is a subordinate bridge */
1358 pci_read_bridge_bases(bus);
1359
1360 for (i = 0; i < 4; ++i) {
1361 if ((res = bus->resource[i]) == NULL)
1362 continue;
1363 if (!res->flags)
1364 continue;
1365 if (io_offset && (res->flags & IORESOURCE_IO)) {
1366 res->start += io_offset;
1367 res->end += io_offset;
1368 } else if (hose->pci_mem_offset
1369 && (res->flags & IORESOURCE_MEM)) {
1370 res->start += hose->pci_mem_offset;
1371 res->end += hose->pci_mem_offset;
1372 }
1373 }
1374 }
1375
1376 if (ppc_md.pcibios_fixup_bus)
1377 ppc_md.pcibios_fixup_bus(bus);
1378}
1379
1380char __init *pcibios_setup(char *str)
1381{
1382 return str;
1383}
1384
1385/* the next one is stolen from the alpha port... */
1386void __init
1387pcibios_update_irq(struct pci_dev *dev, int irq)
1388{
1389 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq);
1390 /* XXX FIXME - update OF device tree node interrupt property */
1391}
1392
1393int pcibios_enable_device(struct pci_dev *dev, int mask)
1394{
1395 u16 cmd, old_cmd;
1396 int idx;
1397 struct resource *r;
1398
1399 if (ppc_md.pcibios_enable_device_hook)
1400 if (ppc_md.pcibios_enable_device_hook(dev, 0))
1401 return -EINVAL;
1402
1403 pci_read_config_word(dev, PCI_COMMAND, &cmd);
1404 old_cmd = cmd;
1405 for (idx=0; idx<6; idx++) {
1406 r = &dev->resource[idx];
1407 if (r->flags & IORESOURCE_UNSET) {
1408 printk(KERN_ERR "PCI: Device %s not available because of resource collisions\n", pci_name(dev));
1409 return -EINVAL;
1410 }
1411 if (r->flags & IORESOURCE_IO)
1412 cmd |= PCI_COMMAND_IO;
1413 if (r->flags & IORESOURCE_MEM)
1414 cmd |= PCI_COMMAND_MEMORY;
1415 }
1416 if (cmd != old_cmd) {
1417 printk("PCI: Enabling device %s (%04x -> %04x)\n",
1418 pci_name(dev), old_cmd, cmd);
1419 pci_write_config_word(dev, PCI_COMMAND, cmd);
1420 }
1421 return 0;
1422}
1423
1424struct pci_controller*
1425pci_bus_to_hose(int bus)
1426{
1427 struct pci_controller* hose = hose_head;
1428
1429 for (; hose; hose = hose->next)
1430 if (bus >= hose->first_busno && bus <= hose->last_busno)
1431 return hose;
1432 return NULL;
1433}
1434
1435void*
1436pci_bus_io_base(unsigned int bus)
1437{
1438 struct pci_controller *hose;
1439
1440 hose = pci_bus_to_hose(bus);
1441 if (!hose)
1442 return NULL;
1443 return hose->io_base_virt;
1444}
1445
1446unsigned long
1447pci_bus_io_base_phys(unsigned int bus)
1448{
1449 struct pci_controller *hose;
1450
1451 hose = pci_bus_to_hose(bus);
1452 if (!hose)
1453 return 0;
1454 return hose->io_base_phys;
1455}
1456
1457unsigned long
1458pci_bus_mem_base_phys(unsigned int bus)
1459{
1460 struct pci_controller *hose;
1461
1462 hose = pci_bus_to_hose(bus);
1463 if (!hose)
1464 return 0;
1465 return hose->pci_mem_offset;
1466}
1467
1468unsigned long
1469pci_resource_to_bus(struct pci_dev *pdev, struct resource *res)
1470{
1471 /* Hack alert again ! See comments in chrp_pci.c
1472 */
1473 struct pci_controller* hose =
1474 (struct pci_controller *)pdev->sysdata;
1475 if (hose && res->flags & IORESOURCE_MEM)
1476 return res->start - hose->pci_mem_offset;
1477 /* We may want to do something with IOs here... */
1478 return res->start;
1479}
1480
1481
1482static struct resource *__pci_mmap_make_offset(struct pci_dev *dev,
1483 unsigned long *offset,
1484 enum pci_mmap_state mmap_state)
1485{
1486 struct pci_controller *hose = pci_bus_to_hose(dev->bus->number);
1487 unsigned long io_offset = 0;
1488 int i, res_bit;
1489
1490 if (hose == 0)
1491 return NULL; /* should never happen */
1492
1493 /* If memory, add on the PCI bridge address offset */
1494 if (mmap_state == pci_mmap_mem) {
1495 *offset += hose->pci_mem_offset;
1496 res_bit = IORESOURCE_MEM;
1497 } else {
1498 io_offset = (unsigned long)hose->io_base_virt;
1499 *offset += io_offset;
1500 res_bit = IORESOURCE_IO;
1501 }
1502
1503 /*
1504 * Check that the offset requested corresponds to one of the
1505 * resources of the device.
1506 */
1507 for (i = 0; i <= PCI_ROM_RESOURCE; i++) {
1508 struct resource *rp = &dev->resource[i];
1509 int flags = rp->flags;
1510
1511 /* treat ROM as memory (should be already) */
1512 if (i == PCI_ROM_RESOURCE)
1513 flags |= IORESOURCE_MEM;
1514
1515 /* Active and same type? */
1516 if ((flags & res_bit) == 0)
1517 continue;
1518
1519 /* In the range of this resource? */
1520 if (*offset < (rp->start & PAGE_MASK) || *offset > rp->end)
1521 continue;
1522
1523 /* found it! construct the final physical address */
1524 if (mmap_state == pci_mmap_io)
1525 *offset += hose->io_base_phys - _IO_BASE;
1526 return rp;
1527 }
1528
1529 return NULL;
1530}
1531
1532/*
1533 * Set vm_page_prot of VMA, as appropriate for this architecture, for a pci
1534 * device mapping.
1535 */
1536static pgprot_t __pci_mmap_set_pgprot(struct pci_dev *dev, struct resource *rp,
1537 pgprot_t protection,
1538 enum pci_mmap_state mmap_state,
1539 int write_combine)
1540{
1541 unsigned long prot = pgprot_val(protection);
1542
1543 /* Write combine is always 0 on non-memory space mappings. On
1544 * memory space, if the user didn't pass 1, we check for a
1545 * "prefetchable" resource. This is a bit hackish, but we use
1546 * this to workaround the inability of /sysfs to provide a write
1547 * combine bit
1548 */
1549 if (mmap_state != pci_mmap_mem)
1550 write_combine = 0;
1551 else if (write_combine == 0) {
1552 if (rp->flags & IORESOURCE_PREFETCH)
1553 write_combine = 1;
1554 }
1555
1556 /* XXX would be nice to have a way to ask for write-through */
1557 prot |= _PAGE_NO_CACHE;
1558 if (write_combine)
1559 prot &= ~_PAGE_GUARDED;
1560 else
1561 prot |= _PAGE_GUARDED;
1562
1563 printk("PCI map for %s:%lx, prot: %lx\n", pci_name(dev), rp->start,
1564 prot);
1565
1566 return __pgprot(prot);
1567}
1568
1569/*
1570 * This one is used by /dev/mem and fbdev who have no clue about the
1571 * PCI device, it tries to find the PCI device first and calls the
1572 * above routine
1573 */
1574pgprot_t pci_phys_mem_access_prot(struct file *file,
1575 unsigned long offset,
1576 unsigned long size,
1577 pgprot_t protection)
1578{
1579 struct pci_dev *pdev = NULL;
1580 struct resource *found = NULL;
1581 unsigned long prot = pgprot_val(protection);
1582 int i;
1583
1584 if (page_is_ram(offset >> PAGE_SHIFT))
1585 return prot;
1586
1587 prot |= _PAGE_NO_CACHE | _PAGE_GUARDED;
1588
1589 for_each_pci_dev(pdev) {
1590 for (i = 0; i <= PCI_ROM_RESOURCE; i++) {
1591 struct resource *rp = &pdev->resource[i];
1592 int flags = rp->flags;
1593
1594 /* Active and same type? */
1595 if ((flags & IORESOURCE_MEM) == 0)
1596 continue;
1597 /* In the range of this resource? */
1598 if (offset < (rp->start & PAGE_MASK) ||
1599 offset > rp->end)
1600 continue;
1601 found = rp;
1602 break;
1603 }
1604 if (found)
1605 break;
1606 }
1607 if (found) {
1608 if (found->flags & IORESOURCE_PREFETCH)
1609 prot &= ~_PAGE_GUARDED;
1610 pci_dev_put(pdev);
1611 }
1612
1613 DBG("non-PCI map for %lx, prot: %lx\n", offset, prot);
1614
1615 return __pgprot(prot);
1616}
1617
1618
1619/*
1620 * Perform the actual remap of the pages for a PCI device mapping, as
1621 * appropriate for this architecture. The region in the process to map
1622 * is described by vm_start and vm_end members of VMA, the base physical
1623 * address is found in vm_pgoff.
1624 * The pci device structure is provided so that architectures may make mapping
1625 * decisions on a per-device or per-bus basis.
1626 *
1627 * Returns a negative error code on failure, zero on success.
1628 */
1629int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
1630 enum pci_mmap_state mmap_state,
1631 int write_combine)
1632{
1633 unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
1634 struct resource *rp;
1635 int ret;
1636
1637 rp = __pci_mmap_make_offset(dev, &offset, mmap_state);
1638 if (rp == NULL)
1639 return -EINVAL;
1640
1641 vma->vm_pgoff = offset >> PAGE_SHIFT;
1642 vma->vm_flags |= VM_SHM | VM_LOCKED | VM_IO;
1643 vma->vm_page_prot = __pci_mmap_set_pgprot(dev, rp,
1644 vma->vm_page_prot,
1645 mmap_state, write_combine);
1646
1647 ret = remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
1648 vma->vm_end - vma->vm_start, vma->vm_page_prot);
1649
1650 return ret;
1651}
1652
1653/* Obsolete functions. Should be removed once the symbios driver
1654 * is fixed
1655 */
1656unsigned long
1657phys_to_bus(unsigned long pa)
1658{
1659 struct pci_controller *hose;
1660 int i;
1661
1662 for (hose = hose_head; hose; hose = hose->next) {
1663 for (i = 0; i < 3; ++i) {
1664 if (pa >= hose->mem_resources[i].start
1665 && pa <= hose->mem_resources[i].end) {
1666 /*
1667 * XXX the hose->pci_mem_offset really
1668 * only applies to mem_resources[0].
1669 * We need a way to store an offset for
1670 * the others. -- paulus
1671 */
1672 if (i == 0)
1673 pa -= hose->pci_mem_offset;
1674 return pa;
1675 }
1676 }
1677 }
1678 /* hmmm, didn't find it */
1679 return 0;
1680}
1681
1682unsigned long
1683pci_phys_to_bus(unsigned long pa, int busnr)
1684{
1685 struct pci_controller* hose = pci_bus_to_hose(busnr);
1686 if (!hose)
1687 return pa;
1688 return pa - hose->pci_mem_offset;
1689}
1690
1691unsigned long
1692pci_bus_to_phys(unsigned int ba, int busnr)
1693{
1694 struct pci_controller* hose = pci_bus_to_hose(busnr);
1695 if (!hose)
1696 return ba;
1697 return ba + hose->pci_mem_offset;
1698}
1699
1700/* Provide information on locations of various I/O regions in physical
1701 * memory. Do this on a per-card basis so that we choose the right
1702 * root bridge.
1703 * Note that the returned IO or memory base is a physical address
1704 */
1705
1706long sys_pciconfig_iobase(long which, unsigned long bus, unsigned long devfn)
1707{
1708 struct pci_controller* hose;
1709 long result = -EOPNOTSUPP;
1710
1711 /* Argh ! Please forgive me for that hack, but that's the
1712 * simplest way to get existing XFree to not lockup on some
1713 * G5 machines... So when something asks for bus 0 io base
1714 * (bus 0 is HT root), we return the AGP one instead.
1715 */
1716#ifdef CONFIG_PPC_PMAC
1717 if (_machine == _MACH_Pmac && machine_is_compatible("MacRISC4"))
1718 if (bus == 0)
1719 bus = 0xf0;
1720#endif /* CONFIG_PPC_PMAC */
1721
1722 hose = pci_bus_to_hose(bus);
1723 if (!hose)
1724 return -ENODEV;
1725
1726 switch (which) {
1727 case IOBASE_BRIDGE_NUMBER:
1728 return (long)hose->first_busno;
1729 case IOBASE_MEMORY:
1730 return (long)hose->pci_mem_offset;
1731 case IOBASE_IO:
1732 return (long)hose->io_base_phys;
1733 case IOBASE_ISA_IO:
1734 return (long)isa_io_base;
1735 case IOBASE_ISA_MEM:
1736 return (long)isa_mem_base;
1737 }
1738
1739 return result;
1740}
1741
1742void __init
1743pci_init_resource(struct resource *res, unsigned long start, unsigned long end,
1744 int flags, char *name)
1745{
1746 res->start = start;
1747 res->end = end;
1748 res->flags = flags;
1749 res->name = name;
1750 res->parent = NULL;
1751 res->sibling = NULL;
1752 res->child = NULL;
1753}
1754
1755void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max)
1756{
1757 unsigned long start = pci_resource_start(dev, bar);
1758 unsigned long len = pci_resource_len(dev, bar);
1759 unsigned long flags = pci_resource_flags(dev, bar);
1760
1761 if (!len)
1762 return NULL;
1763 if (max && len > max)
1764 len = max;
1765 if (flags & IORESOURCE_IO)
1766 return ioport_map(start, len);
1767 if (flags & IORESOURCE_MEM)
1768 /* Not checking IORESOURCE_CACHEABLE because PPC does
1769 * not currently distinguish between ioremap and
1770 * ioremap_nocache.
1771 */
1772 return ioremap(start, len);
1773 /* What? */
1774 return NULL;
1775}
1776
1777void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
1778{
1779 /* Nothing to do */
1780}
1781EXPORT_SYMBOL(pci_iomap);
1782EXPORT_SYMBOL(pci_iounmap);
1783
1784
1785/*
1786 * Null PCI config access functions, for the case when we can't
1787 * find a hose.
1788 */
1789#define NULL_PCI_OP(rw, size, type) \
1790static int \
1791null_##rw##_config_##size(struct pci_dev *dev, int offset, type val) \
1792{ \
1793 return PCIBIOS_DEVICE_NOT_FOUND; \
1794}
1795
1796static int
1797null_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
1798 int len, u32 *val)
1799{
1800 return PCIBIOS_DEVICE_NOT_FOUND;
1801}
1802
1803static int
1804null_write_config(struct pci_bus *bus, unsigned int devfn, int offset,
1805 int len, u32 val)
1806{
1807 return PCIBIOS_DEVICE_NOT_FOUND;
1808}
1809
1810static struct pci_ops null_pci_ops =
1811{
1812 null_read_config,
1813 null_write_config
1814};
1815
1816/*
1817 * These functions are used early on before PCI scanning is done
1818 * and all of the pci_dev and pci_bus structures have been created.
1819 */
1820static struct pci_bus *
1821fake_pci_bus(struct pci_controller *hose, int busnr)
1822{
1823 static struct pci_bus bus;
1824
1825 if (hose == 0) {
1826 hose = pci_bus_to_hose(busnr);
1827 if (hose == 0)
1828 printk(KERN_ERR "Can't find hose for PCI bus %d!\n", busnr);
1829 }
1830 bus.number = busnr;
1831 bus.sysdata = hose;
1832 bus.ops = hose? hose->ops: &null_pci_ops;
1833 return &bus;
1834}
1835
1836#define EARLY_PCI_OP(rw, size, type) \
1837int early_##rw##_config_##size(struct pci_controller *hose, int bus, \
1838 int devfn, int offset, type value) \
1839{ \
1840 return pci_bus_##rw##_config_##size(fake_pci_bus(hose, bus), \
1841 devfn, offset, value); \
1842}
1843
1844EARLY_PCI_OP(read, byte, u8 *)
1845EARLY_PCI_OP(read, word, u16 *)
1846EARLY_PCI_OP(read, dword, u32 *)
1847EARLY_PCI_OP(write, byte, u8)
1848EARLY_PCI_OP(write, word, u16)
1849EARLY_PCI_OP(write, dword, u32)
diff --git a/arch/ppc/kernel/perfmon.c b/arch/ppc/kernel/perfmon.c
new file mode 100644
index 000000000000..918f6b252e45
--- /dev/null
+++ b/arch/ppc/kernel/perfmon.c
@@ -0,0 +1,93 @@
1/* kernel/perfmon.c
2 * PPC 32 Performance Monitor Infrastructure
3 *
4 * Author: Andy Fleming
5 * Copyright (c) 2004 Freescale Semiconductor, Inc
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12
13#include <linux/errno.h>
14#include <linux/sched.h>
15#include <linux/kernel.h>
16#include <linux/mm.h>
17#include <linux/stddef.h>
18#include <linux/unistd.h>
19#include <linux/ptrace.h>
20#include <linux/slab.h>
21#include <linux/user.h>
22#include <linux/a.out.h>
23#include <linux/interrupt.h>
24#include <linux/config.h>
25#include <linux/init.h>
26#include <linux/module.h>
27#include <linux/prctl.h>
28
29#include <asm/pgtable.h>
30#include <asm/uaccess.h>
31#include <asm/system.h>
32#include <asm/io.h>
33#include <asm/reg.h>
34#include <asm/xmon.h>
35
36/* A lock to regulate grabbing the interrupt */
37DEFINE_SPINLOCK(perfmon_lock);
38
39#ifdef CONFIG_FSL_BOOKE
40static void dummy_perf(struct pt_regs *regs)
41{
42 unsigned int pmgc0 = mfpmr(PMRN_PMGC0);
43
44 pmgc0 &= ~PMGC0_PMIE;
45 mtpmr(PMRN_PMGC0, pmgc0);
46}
47
48#else
49/* Ensure exceptions are disabled */
50
51static void dummy_perf(struct pt_regs *regs)
52{
53 unsigned int mmcr0 = mfspr(SPRN_MMCR0);
54
55 mmcr0 &= ~MMCR0_PMXE;
56 mtspr(SPRN_MMCR0, mmcr0);
57}
58#endif
59
60void (*perf_irq)(struct pt_regs *) = dummy_perf;
61
62/* Grab the interrupt, if it's free.
63 * Returns 0 on success, -1 if the interrupt is taken already */
64int request_perfmon_irq(void (*handler)(struct pt_regs *))
65{
66 int err = 0;
67
68 spin_lock(&perfmon_lock);
69
70 if (perf_irq == dummy_perf)
71 perf_irq = handler;
72 else {
73 pr_info("perfmon irq already handled by %p\n", perf_irq);
74 err = -1;
75 }
76
77 spin_unlock(&perfmon_lock);
78
79 return err;
80}
81
82void free_perfmon_irq(void)
83{
84 spin_lock(&perfmon_lock);
85
86 perf_irq = dummy_perf;
87
88 spin_unlock(&perfmon_lock);
89}
90
91EXPORT_SYMBOL(perf_irq);
92EXPORT_SYMBOL(request_perfmon_irq);
93EXPORT_SYMBOL(free_perfmon_irq);
diff --git a/arch/ppc/kernel/perfmon_fsl_booke.c b/arch/ppc/kernel/perfmon_fsl_booke.c
new file mode 100644
index 000000000000..03526bfb0840
--- /dev/null
+++ b/arch/ppc/kernel/perfmon_fsl_booke.c
@@ -0,0 +1,222 @@
1/* kernel/perfmon_fsl_booke.c
2 * Freescale Book-E Performance Monitor code
3 *
4 * Author: Andy Fleming
5 * Copyright (c) 2004 Freescale Semiconductor, Inc
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12
13#include <linux/errno.h>
14#include <linux/sched.h>
15#include <linux/kernel.h>
16#include <linux/mm.h>
17#include <linux/stddef.h>
18#include <linux/unistd.h>
19#include <linux/ptrace.h>
20#include <linux/slab.h>
21#include <linux/user.h>
22#include <linux/a.out.h>
23#include <linux/interrupt.h>
24#include <linux/config.h>
25#include <linux/init.h>
26#include <linux/module.h>
27#include <linux/prctl.h>
28
29#include <asm/pgtable.h>
30#include <asm/uaccess.h>
31#include <asm/system.h>
32#include <asm/io.h>
33#include <asm/reg.h>
34#include <asm/xmon.h>
35#include <asm/perfmon.h>
36
37static inline u32 get_pmlca(int ctr);
38static inline void set_pmlca(int ctr, u32 pmlca);
39
40static inline u32 get_pmlca(int ctr)
41{
42 u32 pmlca;
43
44 switch (ctr) {
45 case 0:
46 pmlca = mfpmr(PMRN_PMLCA0);
47 break;
48 case 1:
49 pmlca = mfpmr(PMRN_PMLCA1);
50 break;
51 case 2:
52 pmlca = mfpmr(PMRN_PMLCA2);
53 break;
54 case 3:
55 pmlca = mfpmr(PMRN_PMLCA3);
56 break;
57 default:
58 panic("Bad ctr number\n");
59 }
60
61 return pmlca;
62}
63
64static inline void set_pmlca(int ctr, u32 pmlca)
65{
66 switch (ctr) {
67 case 0:
68 mtpmr(PMRN_PMLCA0, pmlca);
69 break;
70 case 1:
71 mtpmr(PMRN_PMLCA1, pmlca);
72 break;
73 case 2:
74 mtpmr(PMRN_PMLCA2, pmlca);
75 break;
76 case 3:
77 mtpmr(PMRN_PMLCA3, pmlca);
78 break;
79 default:
80 panic("Bad ctr number\n");
81 }
82}
83
84void init_pmc_stop(int ctr)
85{
86 u32 pmlca = (PMLCA_FC | PMLCA_FCS | PMLCA_FCU |
87 PMLCA_FCM1 | PMLCA_FCM0);
88 u32 pmlcb = 0;
89
90 switch (ctr) {
91 case 0:
92 mtpmr(PMRN_PMLCA0, pmlca);
93 mtpmr(PMRN_PMLCB0, pmlcb);
94 break;
95 case 1:
96 mtpmr(PMRN_PMLCA1, pmlca);
97 mtpmr(PMRN_PMLCB1, pmlcb);
98 break;
99 case 2:
100 mtpmr(PMRN_PMLCA2, pmlca);
101 mtpmr(PMRN_PMLCB2, pmlcb);
102 break;
103 case 3:
104 mtpmr(PMRN_PMLCA3, pmlca);
105 mtpmr(PMRN_PMLCB3, pmlcb);
106 break;
107 default:
108 panic("Bad ctr number!\n");
109 }
110}
111
112void set_pmc_event(int ctr, int event)
113{
114 u32 pmlca;
115
116 pmlca = get_pmlca(ctr);
117
118 pmlca = (pmlca & ~PMLCA_EVENT_MASK) |
119 ((event << PMLCA_EVENT_SHIFT) &
120 PMLCA_EVENT_MASK);
121
122 set_pmlca(ctr, pmlca);
123}
124
125void set_pmc_user_kernel(int ctr, int user, int kernel)
126{
127 u32 pmlca;
128
129 pmlca = get_pmlca(ctr);
130
131 if(user)
132 pmlca &= ~PMLCA_FCU;
133 else
134 pmlca |= PMLCA_FCU;
135
136 if(kernel)
137 pmlca &= ~PMLCA_FCS;
138 else
139 pmlca |= PMLCA_FCS;
140
141 set_pmlca(ctr, pmlca);
142}
143
144void set_pmc_marked(int ctr, int mark0, int mark1)
145{
146 u32 pmlca = get_pmlca(ctr);
147
148 if(mark0)
149 pmlca &= ~PMLCA_FCM0;
150 else
151 pmlca |= PMLCA_FCM0;
152
153 if(mark1)
154 pmlca &= ~PMLCA_FCM1;
155 else
156 pmlca |= PMLCA_FCM1;
157
158 set_pmlca(ctr, pmlca);
159}
160
161void pmc_start_ctr(int ctr, int enable)
162{
163 u32 pmlca = get_pmlca(ctr);
164
165 pmlca &= ~PMLCA_FC;
166
167 if (enable)
168 pmlca |= PMLCA_CE;
169 else
170 pmlca &= ~PMLCA_CE;
171
172 set_pmlca(ctr, pmlca);
173}
174
175void pmc_start_ctrs(int enable)
176{
177 u32 pmgc0 = mfpmr(PMRN_PMGC0);
178
179 pmgc0 &= ~PMGC0_FAC;
180 pmgc0 |= PMGC0_FCECE;
181
182 if (enable)
183 pmgc0 |= PMGC0_PMIE;
184 else
185 pmgc0 &= ~PMGC0_PMIE;
186
187 mtpmr(PMRN_PMGC0, pmgc0);
188}
189
190void pmc_stop_ctrs(void)
191{
192 u32 pmgc0 = mfpmr(PMRN_PMGC0);
193
194 pmgc0 |= PMGC0_FAC;
195
196 pmgc0 &= ~(PMGC0_PMIE | PMGC0_FCECE);
197
198 mtpmr(PMRN_PMGC0, pmgc0);
199}
200
201void dump_pmcs(void)
202{
203 printk("pmgc0: %x\n", mfpmr(PMRN_PMGC0));
204 printk("pmc\t\tpmlca\t\tpmlcb\n");
205 printk("%8x\t%8x\t%8x\n", mfpmr(PMRN_PMC0),
206 mfpmr(PMRN_PMLCA0), mfpmr(PMRN_PMLCB0));
207 printk("%8x\t%8x\t%8x\n", mfpmr(PMRN_PMC1),
208 mfpmr(PMRN_PMLCA1), mfpmr(PMRN_PMLCB1));
209 printk("%8x\t%8x\t%8x\n", mfpmr(PMRN_PMC2),
210 mfpmr(PMRN_PMLCA2), mfpmr(PMRN_PMLCB2));
211 printk("%8x\t%8x\t%8x\n", mfpmr(PMRN_PMC3),
212 mfpmr(PMRN_PMLCA3), mfpmr(PMRN_PMLCB3));
213}
214
215EXPORT_SYMBOL(init_pmc_stop);
216EXPORT_SYMBOL(set_pmc_event);
217EXPORT_SYMBOL(set_pmc_user_kernel);
218EXPORT_SYMBOL(set_pmc_marked);
219EXPORT_SYMBOL(pmc_start_ctr);
220EXPORT_SYMBOL(pmc_start_ctrs);
221EXPORT_SYMBOL(pmc_stop_ctrs);
222EXPORT_SYMBOL(dump_pmcs);
diff --git a/arch/ppc/kernel/ppc-stub.c b/arch/ppc/kernel/ppc-stub.c
new file mode 100644
index 000000000000..d61889c24046
--- /dev/null
+++ b/arch/ppc/kernel/ppc-stub.c
@@ -0,0 +1,867 @@
1/*
2 * ppc-stub.c: KGDB support for the Linux kernel.
3 *
4 * adapted from arch/sparc/kernel/sparc-stub.c for the PowerPC
5 * some stuff borrowed from Paul Mackerras' xmon
6 * Copyright (C) 1998 Michael AK Tesch (tesch@cs.wisc.edu)
7 *
8 * Modifications to run under Linux
9 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
10 *
11 * This file originally came from the gdb sources, and the
12 * copyright notices have been retained below.
13 */
14
15/****************************************************************************
16
17 THIS SOFTWARE IS NOT COPYRIGHTED
18
19 HP offers the following for use in the public domain. HP makes no
20 warranty with regard to the software or its performance and the
21 user accepts the software "AS IS" with all faults.
22
23 HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD
24 TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES
25 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
26
27****************************************************************************/
28
29/****************************************************************************
30 * Header: remcom.c,v 1.34 91/03/09 12:29:49 glenne Exp $
31 *
32 * Module name: remcom.c $
33 * Revision: 1.34 $
34 * Date: 91/03/09 12:29:49 $
35 * Contributor: Lake Stevens Instrument Division$
36 *
37 * Description: low level support for gdb debugger. $
38 *
39 * Considerations: only works on target hardware $
40 *
41 * Written by: Glenn Engel $
42 * ModuleState: Experimental $
43 *
44 * NOTES: See Below $
45 *
46 * Modified for SPARC by Stu Grossman, Cygnus Support.
47 *
48 * This code has been extensively tested on the Fujitsu SPARClite demo board.
49 *
50 * To enable debugger support, two things need to happen. One, a
51 * call to set_debug_traps() is necessary in order to allow any breakpoints
52 * or error conditions to be properly intercepted and reported to gdb.
53 * Two, a breakpoint needs to be generated to begin communication. This
54 * is most easily accomplished by a call to breakpoint(). Breakpoint()
55 * simulates a breakpoint by executing a trap #1.
56 *
57 *************
58 *
59 * The following gdb commands are supported:
60 *
61 * command function Return value
62 *
63 * g return the value of the CPU registers hex data or ENN
64 * G set the value of the CPU registers OK or ENN
65 * qOffsets Get section offsets. Reply is Text=xxx;Data=yyy;Bss=zzz
66 *
67 * mAA..AA,LLLL Read LLLL bytes at address AA..AA hex data or ENN
68 * MAA..AA,LLLL: Write LLLL bytes at address AA.AA OK or ENN
69 *
70 * c Resume at current address SNN ( signal NN)
71 * cAA..AA Continue at address AA..AA SNN
72 *
73 * s Step one instruction SNN
74 * sAA..AA Step one instruction from AA..AA SNN
75 *
76 * k kill
77 *
78 * ? What was the last sigval ? SNN (signal NN)
79 *
80 * bBB..BB Set baud rate to BB..BB OK or BNN, then sets
81 * baud rate
82 *
83 * All commands and responses are sent with a packet which includes a
84 * checksum. A packet consists of
85 *
86 * $<packet info>#<checksum>.
87 *
88 * where
89 * <packet info> :: <characters representing the command or response>
90 * <checksum> :: <two hex digits computed as modulo 256 sum of <packetinfo>>
91 *
92 * When a packet is received, it is first acknowledged with either '+' or '-'.
93 * '+' indicates a successful transfer. '-' indicates a failed transfer.
94 *
95 * Example:
96 *
97 * Host: Reply:
98 * $m0,10#2a +$00010203040506070809101112131415#42
99 *
100 ****************************************************************************/
101
102#include <linux/config.h>
103#include <linux/kernel.h>
104#include <linux/string.h>
105#include <linux/mm.h>
106#include <linux/smp.h>
107#include <linux/smp_lock.h>
108#include <linux/init.h>
109#include <linux/sysrq.h>
110
111#include <asm/cacheflush.h>
112#include <asm/system.h>
113#include <asm/signal.h>
114#include <asm/kgdb.h>
115#include <asm/pgtable.h>
116#include <asm/ptrace.h>
117
118void breakinst(void);
119
120/*
121 * BUFMAX defines the maximum number of characters in inbound/outbound buffers
122 * at least NUMREGBYTES*2 are needed for register packets
123 */
124#define BUFMAX 2048
125static char remcomInBuffer[BUFMAX];
126static char remcomOutBuffer[BUFMAX];
127
128static int initialized;
129static int kgdb_active;
130static int kgdb_started;
131static u_int fault_jmp_buf[100];
132static int kdebug;
133
134
135static const char hexchars[]="0123456789abcdef";
136
137/* Place where we save old trap entries for restoration - sparc*/
138/* struct tt_entry kgdb_savettable[256]; */
139/* typedef void (*trapfunc_t)(void); */
140
141static void kgdb_fault_handler(struct pt_regs *regs);
142static int handle_exception (struct pt_regs *regs);
143
144#if 0
145/* Install an exception handler for kgdb */
146static void exceptionHandler(int tnum, unsigned int *tfunc)
147{
148 /* We are dorking with a live trap table, all irqs off */
149}
150#endif
151
152int
153kgdb_setjmp(long *buf)
154{
155 asm ("mflr 0; stw 0,0(%0);"
156 "stw 1,4(%0); stw 2,8(%0);"
157 "mfcr 0; stw 0,12(%0);"
158 "stmw 13,16(%0)"
159 : : "r" (buf));
160 /* XXX should save fp regs as well */
161 return 0;
162}
163void
164kgdb_longjmp(long *buf, int val)
165{
166 if (val == 0)
167 val = 1;
168 asm ("lmw 13,16(%0);"
169 "lwz 0,12(%0); mtcrf 0x38,0;"
170 "lwz 0,0(%0); lwz 1,4(%0); lwz 2,8(%0);"
171 "mtlr 0; mr 3,%1"
172 : : "r" (buf), "r" (val));
173}
174/* Convert ch from a hex digit to an int */
175static int
176hex(unsigned char ch)
177{
178 if (ch >= 'a' && ch <= 'f')
179 return ch-'a'+10;
180 if (ch >= '0' && ch <= '9')
181 return ch-'0';
182 if (ch >= 'A' && ch <= 'F')
183 return ch-'A'+10;
184 return -1;
185}
186
187/* Convert the memory pointed to by mem into hex, placing result in buf.
188 * Return a pointer to the last char put in buf (null), in case of mem fault,
189 * return 0.
190 */
191static unsigned char *
192mem2hex(const char *mem, char *buf, int count)
193{
194 unsigned char ch;
195 unsigned short tmp_s;
196 unsigned long tmp_l;
197
198 if (kgdb_setjmp((long*)fault_jmp_buf) == 0) {
199 debugger_fault_handler = kgdb_fault_handler;
200
201 /* Accessing 16 bit and 32 bit objects in a single
202 ** load instruction is required to avoid bad side
203 ** effects for some IO registers.
204 */
205
206 if ((count == 2) && (((long)mem & 1) == 0)) {
207 tmp_s = *(unsigned short *)mem;
208 mem += 2;
209 *buf++ = hexchars[(tmp_s >> 12) & 0xf];
210 *buf++ = hexchars[(tmp_s >> 8) & 0xf];
211 *buf++ = hexchars[(tmp_s >> 4) & 0xf];
212 *buf++ = hexchars[tmp_s & 0xf];
213
214 } else if ((count == 4) && (((long)mem & 3) == 0)) {
215 tmp_l = *(unsigned int *)mem;
216 mem += 4;
217 *buf++ = hexchars[(tmp_l >> 28) & 0xf];
218 *buf++ = hexchars[(tmp_l >> 24) & 0xf];
219 *buf++ = hexchars[(tmp_l >> 20) & 0xf];
220 *buf++ = hexchars[(tmp_l >> 16) & 0xf];
221 *buf++ = hexchars[(tmp_l >> 12) & 0xf];
222 *buf++ = hexchars[(tmp_l >> 8) & 0xf];
223 *buf++ = hexchars[(tmp_l >> 4) & 0xf];
224 *buf++ = hexchars[tmp_l & 0xf];
225
226 } else {
227 while (count-- > 0) {
228 ch = *mem++;
229 *buf++ = hexchars[ch >> 4];
230 *buf++ = hexchars[ch & 0xf];
231 }
232 }
233
234 } else {
235 /* error condition */
236 }
237 debugger_fault_handler = NULL;
238 *buf = 0;
239 return buf;
240}
241
242/* convert the hex array pointed to by buf into binary to be placed in mem
243 * return a pointer to the character AFTER the last byte written.
244*/
245static char *
246hex2mem(char *buf, char *mem, int count)
247{
248 unsigned char ch;
249 int i;
250 char *orig_mem;
251 unsigned short tmp_s;
252 unsigned long tmp_l;
253
254 orig_mem = mem;
255
256 if (kgdb_setjmp((long*)fault_jmp_buf) == 0) {
257 debugger_fault_handler = kgdb_fault_handler;
258
259 /* Accessing 16 bit and 32 bit objects in a single
260 ** store instruction is required to avoid bad side
261 ** effects for some IO registers.
262 */
263
264 if ((count == 2) && (((long)mem & 1) == 0)) {
265 tmp_s = hex(*buf++) << 12;
266 tmp_s |= hex(*buf++) << 8;
267 tmp_s |= hex(*buf++) << 4;
268 tmp_s |= hex(*buf++);
269
270 *(unsigned short *)mem = tmp_s;
271 mem += 2;
272
273 } else if ((count == 4) && (((long)mem & 3) == 0)) {
274 tmp_l = hex(*buf++) << 28;
275 tmp_l |= hex(*buf++) << 24;
276 tmp_l |= hex(*buf++) << 20;
277 tmp_l |= hex(*buf++) << 16;
278 tmp_l |= hex(*buf++) << 12;
279 tmp_l |= hex(*buf++) << 8;
280 tmp_l |= hex(*buf++) << 4;
281 tmp_l |= hex(*buf++);
282
283 *(unsigned long *)mem = tmp_l;
284 mem += 4;
285
286 } else {
287 for (i=0; i<count; i++) {
288 ch = hex(*buf++) << 4;
289 ch |= hex(*buf++);
290 *mem++ = ch;
291 }
292 }
293
294
295 /*
296 ** Flush the data cache, invalidate the instruction cache.
297 */
298 flush_icache_range((int)orig_mem, (int)orig_mem + count - 1);
299
300 } else {
301 /* error condition */
302 }
303 debugger_fault_handler = NULL;
304 return mem;
305}
306
307/*
308 * While we find nice hex chars, build an int.
309 * Return number of chars processed.
310 */
311static int
312hexToInt(char **ptr, int *intValue)
313{
314 int numChars = 0;
315 int hexValue;
316
317 *intValue = 0;
318
319 if (kgdb_setjmp((long*)fault_jmp_buf) == 0) {
320 debugger_fault_handler = kgdb_fault_handler;
321 while (**ptr) {
322 hexValue = hex(**ptr);
323 if (hexValue < 0)
324 break;
325
326 *intValue = (*intValue << 4) | hexValue;
327 numChars ++;
328
329 (*ptr)++;
330 }
331 } else {
332 /* error condition */
333 }
334 debugger_fault_handler = NULL;
335
336 return (numChars);
337}
338
339/* scan for the sequence $<data>#<checksum> */
340static void
341getpacket(char *buffer)
342{
343 unsigned char checksum;
344 unsigned char xmitcsum;
345 int i;
346 int count;
347 unsigned char ch;
348
349 do {
350 /* wait around for the start character, ignore all other
351 * characters */
352 while ((ch = (getDebugChar() & 0x7f)) != '$') ;
353
354 checksum = 0;
355 xmitcsum = -1;
356
357 count = 0;
358
359 /* now, read until a # or end of buffer is found */
360 while (count < BUFMAX) {
361 ch = getDebugChar() & 0x7f;
362 if (ch == '#')
363 break;
364 checksum = checksum + ch;
365 buffer[count] = ch;
366 count = count + 1;
367 }
368
369 if (count >= BUFMAX)
370 continue;
371
372 buffer[count] = 0;
373
374 if (ch == '#') {
375 xmitcsum = hex(getDebugChar() & 0x7f) << 4;
376 xmitcsum |= hex(getDebugChar() & 0x7f);
377 if (checksum != xmitcsum)
378 putDebugChar('-'); /* failed checksum */
379 else {
380 putDebugChar('+'); /* successful transfer */
381 /* if a sequence char is present, reply the ID */
382 if (buffer[2] == ':') {
383 putDebugChar(buffer[0]);
384 putDebugChar(buffer[1]);
385 /* remove sequence chars from buffer */
386 count = strlen(buffer);
387 for (i=3; i <= count; i++)
388 buffer[i-3] = buffer[i];
389 }
390 }
391 }
392 } while (checksum != xmitcsum);
393}
394
395/* send the packet in buffer. */
396static void putpacket(unsigned char *buffer)
397{
398 unsigned char checksum;
399 int count;
400 unsigned char ch, recv;
401
402 /* $<packet info>#<checksum>. */
403 do {
404 putDebugChar('$');
405 checksum = 0;
406 count = 0;
407
408 while ((ch = buffer[count])) {
409 putDebugChar(ch);
410 checksum += ch;
411 count += 1;
412 }
413
414 putDebugChar('#');
415 putDebugChar(hexchars[checksum >> 4]);
416 putDebugChar(hexchars[checksum & 0xf]);
417 recv = getDebugChar();
418 } while ((recv & 0x7f) != '+');
419}
420
421static void kgdb_flush_cache_all(void)
422{
423 flush_instruction_cache();
424}
425
426/* Set up exception handlers for tracing and breakpoints
427 * [could be called kgdb_init()]
428 */
429void set_debug_traps(void)
430{
431#if 0
432 unsigned char c;
433
434 save_and_cli(flags);
435
436 /* In case GDB is started before us, ack any packets (presumably
437 * "$?#xx") sitting there.
438 *
439 * I've found this code causes more problems than it solves,
440 * so that's why it's commented out. GDB seems to work fine
441 * now starting either before or after the kernel -bwb
442 */
443
444 while((c = getDebugChar()) != '$');
445 while((c = getDebugChar()) != '#');
446 c = getDebugChar(); /* eat first csum byte */
447 c = getDebugChar(); /* eat second csum byte */
448 putDebugChar('+'); /* ack it */
449#endif
450 debugger = kgdb;
451 debugger_bpt = kgdb_bpt;
452 debugger_sstep = kgdb_sstep;
453 debugger_iabr_match = kgdb_iabr_match;
454 debugger_dabr_match = kgdb_dabr_match;
455
456 initialized = 1;
457}
458
459static void kgdb_fault_handler(struct pt_regs *regs)
460{
461 kgdb_longjmp((long*)fault_jmp_buf, 1);
462}
463
464int kgdb_bpt(struct pt_regs *regs)
465{
466 return handle_exception(regs);
467}
468
469int kgdb_sstep(struct pt_regs *regs)
470{
471 return handle_exception(regs);
472}
473
474void kgdb(struct pt_regs *regs)
475{
476 handle_exception(regs);
477}
478
479int kgdb_iabr_match(struct pt_regs *regs)
480{
481 printk(KERN_ERR "kgdb doesn't support iabr, what?!?\n");
482 return handle_exception(regs);
483}
484
485int kgdb_dabr_match(struct pt_regs *regs)
486{
487 printk(KERN_ERR "kgdb doesn't support dabr, what?!?\n");
488 return handle_exception(regs);
489}
490
491/* Convert the hardware trap type code to a unix signal number. */
492/*
493 * This table contains the mapping between PowerPC hardware trap types, and
494 * signals, which are primarily what GDB understands.
495 */
496static struct hard_trap_info
497{
498 unsigned int tt; /* Trap type code for powerpc */
499 unsigned char signo; /* Signal that we map this trap into */
500} hard_trap_info[] = {
501#if defined(CONFIG_40x) || defined(CONFIG_BOOKE)
502 { 0x100, SIGINT }, /* critical input interrupt */
503 { 0x200, SIGSEGV }, /* machine check */
504 { 0x300, SIGSEGV }, /* data storage */
505 { 0x400, SIGBUS }, /* instruction storage */
506 { 0x500, SIGINT }, /* interrupt */
507 { 0x600, SIGBUS }, /* alignment */
508 { 0x700, SIGILL }, /* program */
509 { 0x800, SIGILL }, /* reserved */
510 { 0x900, SIGILL }, /* reserved */
511 { 0xa00, SIGILL }, /* reserved */
512 { 0xb00, SIGILL }, /* reserved */
513 { 0xc00, SIGCHLD }, /* syscall */
514 { 0xd00, SIGILL }, /* reserved */
515 { 0xe00, SIGILL }, /* reserved */
516 { 0xf00, SIGILL }, /* reserved */
517 /*
518 ** 0x1000 PIT
519 ** 0x1010 FIT
520 ** 0x1020 watchdog
521 ** 0x1100 data TLB miss
522 ** 0x1200 instruction TLB miss
523 */
524 { 0x2002, SIGTRAP}, /* debug */
525#else
526 { 0x200, SIGSEGV }, /* machine check */
527 { 0x300, SIGSEGV }, /* address error (store) */
528 { 0x400, SIGBUS }, /* instruction bus error */
529 { 0x500, SIGINT }, /* interrupt */
530 { 0x600, SIGBUS }, /* alingment */
531 { 0x700, SIGTRAP }, /* breakpoint trap */
532 { 0x800, SIGFPE }, /* fpu unavail */
533 { 0x900, SIGALRM }, /* decrementer */
534 { 0xa00, SIGILL }, /* reserved */
535 { 0xb00, SIGILL }, /* reserved */
536 { 0xc00, SIGCHLD }, /* syscall */
537 { 0xd00, SIGTRAP }, /* single-step/watch */
538 { 0xe00, SIGFPE }, /* fp assist */
539#endif
540 { 0, 0} /* Must be last */
541
542};
543
544static int computeSignal(unsigned int tt)
545{
546 struct hard_trap_info *ht;
547
548 for (ht = hard_trap_info; ht->tt && ht->signo; ht++)
549 if (ht->tt == tt)
550 return ht->signo;
551
552 return SIGHUP; /* default for things we don't know about */
553}
554
555#define PC_REGNUM 64
556#define SP_REGNUM 1
557
558/*
559 * This function does all command processing for interfacing to gdb.
560 */
561static int
562handle_exception (struct pt_regs *regs)
563{
564 int sigval;
565 int addr;
566 int length;
567 char *ptr;
568 unsigned int msr;
569
570 /* We don't handle user-mode breakpoints. */
571 if (user_mode(regs))
572 return 0;
573
574 if (debugger_fault_handler) {
575 debugger_fault_handler(regs);
576 panic("kgdb longjump failed!\n");
577 }
578 if (kgdb_active) {
579 printk(KERN_ERR "interrupt while in kgdb, returning\n");
580 return 0;
581 }
582
583 kgdb_active = 1;
584 kgdb_started = 1;
585
586#ifdef KGDB_DEBUG
587 printk("kgdb: entering handle_exception; trap [0x%x]\n",
588 (unsigned int)regs->trap);
589#endif
590
591 kgdb_interruptible(0);
592 lock_kernel();
593 msr = mfmsr();
594 mtmsr(msr & ~MSR_EE); /* disable interrupts */
595
596 if (regs->nip == (unsigned long)breakinst) {
597 /* Skip over breakpoint trap insn */
598 regs->nip += 4;
599 }
600
601 /* reply to host that an exception has occurred */
602 sigval = computeSignal(regs->trap);
603 ptr = remcomOutBuffer;
604
605 *ptr++ = 'T';
606 *ptr++ = hexchars[sigval >> 4];
607 *ptr++ = hexchars[sigval & 0xf];
608 *ptr++ = hexchars[PC_REGNUM >> 4];
609 *ptr++ = hexchars[PC_REGNUM & 0xf];
610 *ptr++ = ':';
611 ptr = mem2hex((char *)&regs->nip, ptr, 4);
612 *ptr++ = ';';
613 *ptr++ = hexchars[SP_REGNUM >> 4];
614 *ptr++ = hexchars[SP_REGNUM & 0xf];
615 *ptr++ = ':';
616 ptr = mem2hex(((char *)regs) + SP_REGNUM*4, ptr, 4);
617 *ptr++ = ';';
618 *ptr++ = 0;
619
620 putpacket(remcomOutBuffer);
621 if (kdebug)
622 printk("remcomOutBuffer: %s\n", remcomOutBuffer);
623
624 /* XXX We may want to add some features dealing with poking the
625 * XXX page tables, ... (look at sparc-stub.c for more info)
626 * XXX also required hacking to the gdb sources directly...
627 */
628
629 while (1) {
630 remcomOutBuffer[0] = 0;
631
632 getpacket(remcomInBuffer);
633 switch (remcomInBuffer[0]) {
634 case '?': /* report most recent signal */
635 remcomOutBuffer[0] = 'S';
636 remcomOutBuffer[1] = hexchars[sigval >> 4];
637 remcomOutBuffer[2] = hexchars[sigval & 0xf];
638 remcomOutBuffer[3] = 0;
639 break;
640#if 0
641 case 'q': /* this screws up gdb for some reason...*/
642 {
643 extern long _start, sdata, __bss_start;
644
645 ptr = &remcomInBuffer[1];
646 if (strncmp(ptr, "Offsets", 7) != 0)
647 break;
648
649 ptr = remcomOutBuffer;
650 sprintf(ptr, "Text=%8.8x;Data=%8.8x;Bss=%8.8x",
651 &_start, &sdata, &__bss_start);
652 break;
653 }
654#endif
655 case 'd':
656 /* toggle debug flag */
657 kdebug ^= 1;
658 break;
659
660 case 'g': /* return the value of the CPU registers.
661 * some of them are non-PowerPC names :(
662 * they are stored in gdb like:
663 * struct {
664 * u32 gpr[32];
665 * f64 fpr[32];
666 * u32 pc, ps, cnd, lr; (ps=msr)
667 * u32 cnt, xer, mq;
668 * }
669 */
670 {
671 int i;
672 ptr = remcomOutBuffer;
673 /* General Purpose Regs */
674 ptr = mem2hex((char *)regs, ptr, 32 * 4);
675 /* Floating Point Regs - FIXME */
676 /*ptr = mem2hex((char *), ptr, 32 * 8);*/
677 for(i=0; i<(32*8*2); i++) { /* 2chars/byte */
678 ptr[i] = '0';
679 }
680 ptr += 32*8*2;
681 /* pc, msr, cr, lr, ctr, xer, (mq is unused) */
682 ptr = mem2hex((char *)&regs->nip, ptr, 4);
683 ptr = mem2hex((char *)&regs->msr, ptr, 4);
684 ptr = mem2hex((char *)&regs->ccr, ptr, 4);
685 ptr = mem2hex((char *)&regs->link, ptr, 4);
686 ptr = mem2hex((char *)&regs->ctr, ptr, 4);
687 ptr = mem2hex((char *)&regs->xer, ptr, 4);
688 }
689 break;
690
691 case 'G': /* set the value of the CPU registers */
692 {
693 ptr = &remcomInBuffer[1];
694
695 /*
696 * If the stack pointer has moved, you should pray.
697 * (cause only god can help you).
698 */
699
700 /* General Purpose Regs */
701 hex2mem(ptr, (char *)regs, 32 * 4);
702
703 /* Floating Point Regs - FIXME?? */
704 /*ptr = hex2mem(ptr, ??, 32 * 8);*/
705 ptr += 32*8*2;
706
707 /* pc, msr, cr, lr, ctr, xer, (mq is unused) */
708 ptr = hex2mem(ptr, (char *)&regs->nip, 4);
709 ptr = hex2mem(ptr, (char *)&regs->msr, 4);
710 ptr = hex2mem(ptr, (char *)&regs->ccr, 4);
711 ptr = hex2mem(ptr, (char *)&regs->link, 4);
712 ptr = hex2mem(ptr, (char *)&regs->ctr, 4);
713 ptr = hex2mem(ptr, (char *)&regs->xer, 4);
714
715 strcpy(remcomOutBuffer,"OK");
716 }
717 break;
718 case 'H':
719 /* don't do anything, yet, just acknowledge */
720 hexToInt(&ptr, &addr);
721 strcpy(remcomOutBuffer,"OK");
722 break;
723
724 case 'm': /* mAA..AA,LLLL Read LLLL bytes at address AA..AA */
725 /* Try to read %x,%x. */
726
727 ptr = &remcomInBuffer[1];
728
729 if (hexToInt(&ptr, &addr) && *ptr++ == ','
730 && hexToInt(&ptr, &length)) {
731 if (mem2hex((char *)addr, remcomOutBuffer,
732 length))
733 break;
734 strcpy(remcomOutBuffer, "E03");
735 } else
736 strcpy(remcomOutBuffer, "E01");
737 break;
738
739 case 'M': /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */
740 /* Try to read '%x,%x:'. */
741
742 ptr = &remcomInBuffer[1];
743
744 if (hexToInt(&ptr, &addr) && *ptr++ == ','
745 && hexToInt(&ptr, &length)
746 && *ptr++ == ':') {
747 if (hex2mem(ptr, (char *)addr, length))
748 strcpy(remcomOutBuffer, "OK");
749 else
750 strcpy(remcomOutBuffer, "E03");
751 flush_icache_range(addr, addr+length);
752 } else
753 strcpy(remcomOutBuffer, "E02");
754 break;
755
756
757 case 'k': /* kill the program, actually just continue */
758 case 'c': /* cAA..AA Continue; address AA..AA optional */
759 /* try to read optional parameter, pc unchanged if no parm */
760
761 ptr = &remcomInBuffer[1];
762 if (hexToInt(&ptr, &addr))
763 regs->nip = addr;
764
765/* Need to flush the instruction cache here, as we may have deposited a
766 * breakpoint, and the icache probably has no way of knowing that a data ref to
767 * some location may have changed something that is in the instruction cache.
768 */
769 kgdb_flush_cache_all();
770 mtmsr(msr);
771
772 kgdb_interruptible(1);
773 unlock_kernel();
774 kgdb_active = 0;
775 if (kdebug) {
776 printk("remcomInBuffer: %s\n", remcomInBuffer);
777 printk("remcomOutBuffer: %s\n", remcomOutBuffer);
778 }
779 return 1;
780
781 case 's':
782 kgdb_flush_cache_all();
783#if defined(CONFIG_40x) || defined(CONFIG_BOOKE)
784 mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) | DBCR0_IC);
785 regs->msr |= MSR_DE;
786#else
787 regs->msr |= MSR_SE;
788#endif
789 unlock_kernel();
790 kgdb_active = 0;
791 if (kdebug) {
792 printk("remcomInBuffer: %s\n", remcomInBuffer);
793 printk("remcomOutBuffer: %s\n", remcomOutBuffer);
794 }
795 return 1;
796
797 case 'r': /* Reset (if user process..exit ???)*/
798 panic("kgdb reset.");
799 break;
800 } /* switch */
801 if (remcomOutBuffer[0] && kdebug) {
802 printk("remcomInBuffer: %s\n", remcomInBuffer);
803 printk("remcomOutBuffer: %s\n", remcomOutBuffer);
804 }
805 /* reply to the request */
806 putpacket(remcomOutBuffer);
807 } /* while(1) */
808}
809
810/* This function will generate a breakpoint exception. It is used at the
811 beginning of a program to sync up with a debugger and can be used
812 otherwise as a quick means to stop program execution and "break" into
813 the debugger. */
814
815void
816breakpoint(void)
817{
818 if (!initialized) {
819 printk("breakpoint() called b4 kgdb init\n");
820 return;
821 }
822
823 asm(" .globl breakinst \n\
824 breakinst: .long 0x7d821008");
825}
826
827#ifdef CONFIG_KGDB_CONSOLE
828/* Output string in GDB O-packet format if GDB has connected. If nothing
829 output, returns 0 (caller must then handle output). */
830int
831kgdb_output_string (const char* s, unsigned int count)
832{
833 char buffer[512];
834
835 if (!kgdb_started)
836 return 0;
837
838 count = (count <= (sizeof(buffer) / 2 - 2))
839 ? count : (sizeof(buffer) / 2 - 2);
840
841 buffer[0] = 'O';
842 mem2hex (s, &buffer[1], count);
843 putpacket(buffer);
844
845 return 1;
846}
847#endif
848
849static void sysrq_handle_gdb(int key, struct pt_regs *pt_regs,
850 struct tty_struct *tty)
851{
852 printk("Entering GDB stub\n");
853 breakpoint();
854}
855static struct sysrq_key_op sysrq_gdb_op = {
856 .handler = sysrq_handle_gdb,
857 .help_msg = "Gdb",
858 .action_msg = "GDB",
859};
860
861static int gdb_register_sysrq(void)
862{
863 printk("Registering GDB sysrq handler\n");
864 register_sysrq_key('g', &sysrq_gdb_op);
865 return 0;
866}
867module_init(gdb_register_sysrq);
diff --git a/arch/ppc/kernel/ppc_htab.c b/arch/ppc/kernel/ppc_htab.c
new file mode 100644
index 000000000000..ca810025993f
--- /dev/null
+++ b/arch/ppc/kernel/ppc_htab.c
@@ -0,0 +1,467 @@
1/*
2 * PowerPC hash table management proc entry. Will show information
3 * about the current hash table and will allow changes to it.
4 *
5 * Written by Cort Dougan (cort@cs.nmt.edu)
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12
13#include <linux/config.h>
14#include <linux/errno.h>
15#include <linux/sched.h>
16#include <linux/proc_fs.h>
17#include <linux/stat.h>
18#include <linux/sysctl.h>
19#include <linux/ctype.h>
20#include <linux/threads.h>
21#include <linux/smp_lock.h>
22#include <linux/seq_file.h>
23#include <linux/init.h>
24#include <linux/bitops.h>
25
26#include <asm/uaccess.h>
27#include <asm/mmu.h>
28#include <asm/residual.h>
29#include <asm/io.h>
30#include <asm/pgtable.h>
31#include <asm/cputable.h>
32#include <asm/system.h>
33#include <asm/reg.h>
34
35static int ppc_htab_show(struct seq_file *m, void *v);
36static ssize_t ppc_htab_write(struct file * file, const char __user * buffer,
37 size_t count, loff_t *ppos);
38extern PTE *Hash, *Hash_end;
39extern unsigned long Hash_size, Hash_mask;
40extern unsigned long _SDR1;
41extern unsigned long htab_reloads;
42extern unsigned long htab_preloads;
43extern unsigned long htab_evicts;
44extern unsigned long pte_misses;
45extern unsigned long pte_errors;
46extern unsigned int primary_pteg_full;
47extern unsigned int htab_hash_searches;
48
49static int ppc_htab_open(struct inode *inode, struct file *file)
50{
51 return single_open(file, ppc_htab_show, NULL);
52}
53
54struct file_operations ppc_htab_operations = {
55 .open = ppc_htab_open,
56 .read = seq_read,
57 .llseek = seq_lseek,
58 .write = ppc_htab_write,
59 .release = single_release,
60};
61
62static char *pmc1_lookup(unsigned long mmcr0)
63{
64 switch ( mmcr0 & (0x7f<<7) )
65 {
66 case 0x0:
67 return "none";
68 case MMCR0_PMC1_CYCLES:
69 return "cycles";
70 case MMCR0_PMC1_ICACHEMISS:
71 return "ic miss";
72 case MMCR0_PMC1_DTLB:
73 return "dtlb miss";
74 default:
75 return "unknown";
76 }
77}
78
79static char *pmc2_lookup(unsigned long mmcr0)
80{
81 switch ( mmcr0 & 0x3f )
82 {
83 case 0x0:
84 return "none";
85 case MMCR0_PMC2_CYCLES:
86 return "cycles";
87 case MMCR0_PMC2_DCACHEMISS:
88 return "dc miss";
89 case MMCR0_PMC2_ITLB:
90 return "itlb miss";
91 case MMCR0_PMC2_LOADMISSTIME:
92 return "load miss time";
93 default:
94 return "unknown";
95 }
96}
97
98/*
99 * print some useful info about the hash table. This function
100 * is _REALLY_ slow (see the nested for loops below) but nothing
101 * in here should be really timing critical. -- Cort
102 */
103static int ppc_htab_show(struct seq_file *m, void *v)
104{
105 unsigned long mmcr0 = 0, pmc1 = 0, pmc2 = 0;
106#if defined(CONFIG_PPC_STD_MMU) && !defined(CONFIG_PPC64BRIDGE)
107 unsigned int kptes = 0, uptes = 0;
108 PTE *ptr;
109#endif /* CONFIG_PPC_STD_MMU */
110
111 if (cpu_has_feature(CPU_FTR_604_PERF_MON)) {
112 mmcr0 = mfspr(SPRN_MMCR0);
113 pmc1 = mfspr(SPRN_PMC1);
114 pmc2 = mfspr(SPRN_PMC2);
115 seq_printf(m,
116 "604 Performance Monitoring\n"
117 "MMCR0\t\t: %08lx %s%s ",
118 mmcr0,
119 ( mmcr0>>28 & 0x2 ) ? "(user mode counted)" : "",
120 ( mmcr0>>28 & 0x4 ) ? "(kernel mode counted)" : "");
121 seq_printf(m,
122 "\nPMC1\t\t: %08lx (%s)\n"
123 "PMC2\t\t: %08lx (%s)\n",
124 pmc1, pmc1_lookup(mmcr0),
125 pmc2, pmc2_lookup(mmcr0));
126 }
127
128#ifdef CONFIG_PPC_STD_MMU
129 /* if we don't have a htab */
130 if ( Hash_size == 0 ) {
131 seq_printf(m, "No Hash Table used\n");
132 return 0;
133 }
134
135#ifndef CONFIG_PPC64BRIDGE
136 for (ptr = Hash; ptr < Hash_end; ptr++) {
137 unsigned int mctx, vsid;
138
139 if (!ptr->v)
140 continue;
141 /* undo the esid skew */
142 vsid = ptr->vsid;
143 mctx = ((vsid - (vsid & 0xf) * 0x111) >> 4) & 0xfffff;
144 if (mctx == 0)
145 kptes++;
146 else
147 uptes++;
148 }
149#endif
150
151 seq_printf(m,
152 "PTE Hash Table Information\n"
153 "Size\t\t: %luKb\n"
154 "Buckets\t\t: %lu\n"
155 "Address\t\t: %08lx\n"
156 "Entries\t\t: %lu\n"
157#ifndef CONFIG_PPC64BRIDGE
158 "User ptes\t: %u\n"
159 "Kernel ptes\t: %u\n"
160 "Percent full\t: %lu%%\n"
161#endif
162 , (unsigned long)(Hash_size>>10),
163 (Hash_size/(sizeof(PTE)*8)),
164 (unsigned long)Hash,
165 Hash_size/sizeof(PTE)
166#ifndef CONFIG_PPC64BRIDGE
167 , uptes,
168 kptes,
169 ((kptes+uptes)*100) / (Hash_size/sizeof(PTE))
170#endif
171 );
172
173 seq_printf(m,
174 "Reloads\t\t: %lu\n"
175 "Preloads\t: %lu\n"
176 "Searches\t: %u\n"
177 "Overflows\t: %u\n"
178 "Evicts\t\t: %lu\n",
179 htab_reloads, htab_preloads, htab_hash_searches,
180 primary_pteg_full, htab_evicts);
181#endif /* CONFIG_PPC_STD_MMU */
182
183 seq_printf(m,
184 "Non-error misses: %lu\n"
185 "Error misses\t: %lu\n",
186 pte_misses, pte_errors);
187 return 0;
188}
189
190/*
191 * Allow user to define performance counters and resize the hash table
192 */
193static ssize_t ppc_htab_write(struct file * file, const char __user * ubuffer,
194 size_t count, loff_t *ppos)
195{
196#ifdef CONFIG_PPC_STD_MMU
197 unsigned long tmp;
198 char buffer[16];
199
200 if (!capable(CAP_SYS_ADMIN))
201 return -EACCES;
202 if (strncpy_from_user(buffer, ubuffer, 15))
203 return -EFAULT;
204 buffer[15] = 0;
205
206 /* don't set the htab size for now */
207 if ( !strncmp( buffer, "size ", 5) )
208 return -EBUSY;
209
210 if ( !strncmp( buffer, "reset", 5) )
211 {
212 if (cpu_has_feature(CPU_FTR_604_PERF_MON)) {
213 /* reset PMC1 and PMC2 */
214 mtspr(SPRN_PMC1, 0);
215 mtspr(SPRN_PMC2, 0);
216 }
217 htab_reloads = 0;
218 htab_evicts = 0;
219 pte_misses = 0;
220 pte_errors = 0;
221 }
222
223 /* Everything below here requires the performance monitor feature. */
224 if (!cpu_has_feature(CPU_FTR_604_PERF_MON))
225 return count;
226
227 /* turn off performance monitoring */
228 if ( !strncmp( buffer, "off", 3) )
229 {
230 mtspr(SPRN_MMCR0, 0);
231 mtspr(SPRN_PMC1, 0);
232 mtspr(SPRN_PMC2, 0);
233 }
234
235 if ( !strncmp( buffer, "user", 4) )
236 {
237 /* setup mmcr0 and clear the correct pmc */
238 tmp = (mfspr(SPRN_MMCR0) & ~(0x60000000)) | 0x20000000;
239 mtspr(SPRN_MMCR0, tmp);
240 mtspr(SPRN_PMC1, 0);
241 mtspr(SPRN_PMC2, 0);
242 }
243
244 if ( !strncmp( buffer, "kernel", 6) )
245 {
246 /* setup mmcr0 and clear the correct pmc */
247 tmp = (mfspr(SPRN_MMCR0) & ~(0x60000000)) | 0x40000000;
248 mtspr(SPRN_MMCR0, tmp);
249 mtspr(SPRN_PMC1, 0);
250 mtspr(SPRN_PMC2, 0);
251 }
252
253 /* PMC1 values */
254 if ( !strncmp( buffer, "dtlb", 4) )
255 {
256 /* setup mmcr0 and clear the correct pmc */
257 tmp = (mfspr(SPRN_MMCR0) & ~(0x7F << 7)) | MMCR0_PMC1_DTLB;
258 mtspr(SPRN_MMCR0, tmp);
259 mtspr(SPRN_PMC1, 0);
260 }
261
262 if ( !strncmp( buffer, "ic miss", 7) )
263 {
264 /* setup mmcr0 and clear the correct pmc */
265 tmp = (mfspr(SPRN_MMCR0) & ~(0x7F<<7)) | MMCR0_PMC1_ICACHEMISS;
266 mtspr(SPRN_MMCR0, tmp);
267 mtspr(SPRN_PMC1, 0);
268 }
269
270 /* PMC2 values */
271 if ( !strncmp( buffer, "load miss time", 14) )
272 {
273 /* setup mmcr0 and clear the correct pmc */
274 asm volatile(
275 "mfspr %0,%1\n\t" /* get current mccr0 */
276 "rlwinm %0,%0,0,0,31-6\n\t" /* clear bits [26-31] */
277 "ori %0,%0,%2 \n\t" /* or in mmcr0 settings */
278 "mtspr %1,%0 \n\t" /* set new mccr0 */
279 "mtspr %3,%4 \n\t" /* reset the pmc */
280 : "=r" (tmp)
281 : "i" (SPRN_MMCR0),
282 "i" (MMCR0_PMC2_LOADMISSTIME),
283 "i" (SPRN_PMC2), "r" (0) );
284 }
285
286 if ( !strncmp( buffer, "itlb", 4) )
287 {
288 /* setup mmcr0 and clear the correct pmc */
289 asm volatile(
290 "mfspr %0,%1\n\t" /* get current mccr0 */
291 "rlwinm %0,%0,0,0,31-6\n\t" /* clear bits [26-31] */
292 "ori %0,%0,%2 \n\t" /* or in mmcr0 settings */
293 "mtspr %1,%0 \n\t" /* set new mccr0 */
294 "mtspr %3,%4 \n\t" /* reset the pmc */
295 : "=r" (tmp)
296 : "i" (SPRN_MMCR0), "i" (MMCR0_PMC2_ITLB),
297 "i" (SPRN_PMC2), "r" (0) );
298 }
299
300 if ( !strncmp( buffer, "dc miss", 7) )
301 {
302 /* setup mmcr0 and clear the correct pmc */
303 asm volatile(
304 "mfspr %0,%1\n\t" /* get current mccr0 */
305 "rlwinm %0,%0,0,0,31-6\n\t" /* clear bits [26-31] */
306 "ori %0,%0,%2 \n\t" /* or in mmcr0 settings */
307 "mtspr %1,%0 \n\t" /* set new mccr0 */
308 "mtspr %3,%4 \n\t" /* reset the pmc */
309 : "=r" (tmp)
310 : "i" (SPRN_MMCR0), "i" (MMCR0_PMC2_DCACHEMISS),
311 "i" (SPRN_PMC2), "r" (0) );
312 }
313
314 return count;
315#else /* CONFIG_PPC_STD_MMU */
316 return 0;
317#endif /* CONFIG_PPC_STD_MMU */
318}
319
320int proc_dol2crvec(ctl_table *table, int write, struct file *filp,
321 void __user *buffer_arg, size_t *lenp, loff_t *ppos)
322{
323 int vleft, first=1, len, left, val;
324 char __user *buffer = (char __user *) buffer_arg;
325 #define TMPBUFLEN 256
326 char buf[TMPBUFLEN], *p;
327 static const char *sizestrings[4] = {
328 "2MB", "256KB", "512KB", "1MB"
329 };
330 static const char *clockstrings[8] = {
331 "clock disabled", "+1 clock", "+1.5 clock", "reserved(3)",
332 "+2 clock", "+2.5 clock", "+3 clock", "reserved(7)"
333 };
334 static const char *typestrings[4] = {
335 "flow-through burst SRAM", "reserved SRAM",
336 "pipelined burst SRAM", "pipelined late-write SRAM"
337 };
338 static const char *holdstrings[4] = {
339 "0.5", "1.0", "(reserved2)", "(reserved3)"
340 };
341
342 if (!cpu_has_feature(CPU_FTR_L2CR))
343 return -EFAULT;
344
345 if ( /*!table->maxlen ||*/ (*ppos && !write)) {
346 *lenp = 0;
347 return 0;
348 }
349
350 vleft = table->maxlen / sizeof(int);
351 left = *lenp;
352
353 for (; left /*&& vleft--*/; first=0) {
354 if (write) {
355 while (left) {
356 char c;
357 if(get_user(c, buffer))
358 return -EFAULT;
359 if (!isspace(c))
360 break;
361 left--;
362 buffer++;
363 }
364 if (!left)
365 break;
366 len = left;
367 if (len > TMPBUFLEN-1)
368 len = TMPBUFLEN-1;
369 if(copy_from_user(buf, buffer, len))
370 return -EFAULT;
371 buf[len] = 0;
372 p = buf;
373 if (*p < '0' || *p > '9')
374 break;
375 val = simple_strtoul(p, &p, 0);
376 len = p-buf;
377 if ((len < left) && *p && !isspace(*p))
378 break;
379 buffer += len;
380 left -= len;
381 _set_L2CR(val);
382 } else {
383 p = buf;
384 if (!first)
385 *p++ = '\t';
386 val = _get_L2CR();
387 p += sprintf(p, "0x%08x: ", val);
388 p += sprintf(p, " %s", (val >> 31) & 1 ? "enabled" :
389 "disabled");
390 p += sprintf(p, ", %sparity", (val>>30)&1 ? "" : "no ");
391 p += sprintf(p, ", %s", sizestrings[(val >> 28) & 3]);
392 p += sprintf(p, ", %s", clockstrings[(val >> 25) & 7]);
393 p += sprintf(p, ", %s", typestrings[(val >> 23) & 2]);
394 p += sprintf(p, "%s", (val>>22)&1 ? ", data only" : "");
395 p += sprintf(p, "%s", (val>>20)&1 ? ", ZZ enabled": "");
396 p += sprintf(p, ", %s", (val>>19)&1 ? "write-through" :
397 "copy-back");
398 p += sprintf(p, "%s", (val>>18)&1 ? ", testing" : "");
399 p += sprintf(p, ", %sns hold",holdstrings[(val>>16)&3]);
400 p += sprintf(p, "%s", (val>>15)&1 ? ", DLL slow" : "");
401 p += sprintf(p, "%s", (val>>14)&1 ? ", diff clock" :"");
402 p += sprintf(p, "%s", (val>>13)&1 ? ", DLL bypass" :"");
403
404 p += sprintf(p,"\n");
405
406 len = strlen(buf);
407 if (len > left)
408 len = left;
409 if (copy_to_user(buffer, buf, len))
410 return -EFAULT;
411 left -= len;
412 buffer += len;
413 break;
414 }
415 }
416
417 if (!write && !first && left) {
418 if(put_user('\n', (char __user *) buffer))
419 return -EFAULT;
420 left--, buffer++;
421 }
422 if (write) {
423 char __user *s = (char __user *) buffer;
424 while (left) {
425 char c;
426 if(get_user(c, s++))
427 return -EFAULT;
428 if (!isspace(c))
429 break;
430 left--;
431 }
432 }
433 if (write && first)
434 return -EINVAL;
435 *lenp -= left;
436 *ppos += *lenp;
437 return 0;
438}
439
440#ifdef CONFIG_SYSCTL
441/*
442 * Register our sysctl.
443 */
444static ctl_table htab_ctl_table[]={
445 {
446 .ctl_name = KERN_PPC_L2CR,
447 .procname = "l2cr",
448 .mode = 0644,
449 .proc_handler = &proc_dol2crvec,
450 },
451 { 0, },
452};
453static ctl_table htab_sysctl_root[] = {
454 { 1, "kernel", NULL, 0, 0755, htab_ctl_table, },
455 { 0,},
456};
457
458static int __init
459register_ppc_htab_sysctl(void)
460{
461 register_sysctl_table(htab_sysctl_root, 0);
462
463 return 0;
464}
465
466__initcall(register_ppc_htab_sysctl);
467#endif
diff --git a/arch/ppc/kernel/ppc_ksyms.c b/arch/ppc/kernel/ppc_ksyms.c
new file mode 100644
index 000000000000..2ccb58fe4fc3
--- /dev/null
+++ b/arch/ppc/kernel/ppc_ksyms.c
@@ -0,0 +1,350 @@
1#include <linux/config.h>
2#include <linux/module.h>
3#include <linux/threads.h>
4#include <linux/smp.h>
5#include <linux/sched.h>
6#include <linux/elfcore.h>
7#include <linux/string.h>
8#include <linux/interrupt.h>
9#include <linux/tty.h>
10#include <linux/vt_kern.h>
11#include <linux/nvram.h>
12#include <linux/console.h>
13#include <linux/irq.h>
14#include <linux/pci.h>
15#include <linux/delay.h>
16#include <linux/ide.h>
17#include <linux/pm.h>
18#include <linux/bitops.h>
19
20#include <asm/page.h>
21#include <asm/semaphore.h>
22#include <asm/processor.h>
23#include <asm/uaccess.h>
24#include <asm/io.h>
25#include <asm/ide.h>
26#include <asm/atomic.h>
27#include <asm/checksum.h>
28#include <asm/pgtable.h>
29#include <asm/tlbflush.h>
30#include <linux/adb.h>
31#include <linux/cuda.h>
32#include <linux/pmu.h>
33#include <asm/prom.h>
34#include <asm/system.h>
35#include <asm/pci-bridge.h>
36#include <asm/irq.h>
37#include <asm/pmac_feature.h>
38#include <asm/dma.h>
39#include <asm/machdep.h>
40#include <asm/hw_irq.h>
41#include <asm/nvram.h>
42#include <asm/mmu_context.h>
43#include <asm/backlight.h>
44#include <asm/time.h>
45#include <asm/cputable.h>
46#include <asm/btext.h>
47#include <asm/div64.h>
48#include <asm/xmon.h>
49
50#ifdef CONFIG_8xx
51#include <asm/commproc.h>
52#endif
53
54/* Tell string.h we don't want memcpy etc. as cpp defines */
55#define EXPORT_SYMTAB_STROPS
56
57extern void transfer_to_handler(void);
58extern void do_syscall_trace(void);
59extern void do_IRQ(struct pt_regs *regs);
60extern void MachineCheckException(struct pt_regs *regs);
61extern void AlignmentException(struct pt_regs *regs);
62extern void ProgramCheckException(struct pt_regs *regs);
63extern void SingleStepException(struct pt_regs *regs);
64extern int do_signal(sigset_t *, struct pt_regs *);
65extern int pmac_newworld;
66extern int sys_sigreturn(struct pt_regs *regs);
67
68long long __ashrdi3(long long, int);
69long long __ashldi3(long long, int);
70long long __lshrdi3(long long, int);
71
72extern unsigned long mm_ptov (unsigned long paddr);
73
74EXPORT_SYMBOL(clear_pages);
75EXPORT_SYMBOL(clear_user_page);
76EXPORT_SYMBOL(do_signal);
77EXPORT_SYMBOL(do_syscall_trace);
78EXPORT_SYMBOL(transfer_to_handler);
79EXPORT_SYMBOL(do_IRQ);
80EXPORT_SYMBOL(MachineCheckException);
81EXPORT_SYMBOL(AlignmentException);
82EXPORT_SYMBOL(ProgramCheckException);
83EXPORT_SYMBOL(SingleStepException);
84EXPORT_SYMBOL(sys_sigreturn);
85EXPORT_SYMBOL(ppc_n_lost_interrupts);
86EXPORT_SYMBOL(ppc_lost_interrupts);
87
88EXPORT_SYMBOL(ISA_DMA_THRESHOLD);
89EXPORT_SYMBOL(DMA_MODE_READ);
90EXPORT_SYMBOL(DMA_MODE_WRITE);
91#if defined(CONFIG_PPC_PREP)
92EXPORT_SYMBOL(_prep_type);
93EXPORT_SYMBOL(ucSystemType);
94#endif
95
96#if !defined(__INLINE_BITOPS)
97EXPORT_SYMBOL(set_bit);
98EXPORT_SYMBOL(clear_bit);
99EXPORT_SYMBOL(change_bit);
100EXPORT_SYMBOL(test_and_set_bit);
101EXPORT_SYMBOL(test_and_clear_bit);
102EXPORT_SYMBOL(test_and_change_bit);
103#endif /* __INLINE_BITOPS */
104
105EXPORT_SYMBOL(strcpy);
106EXPORT_SYMBOL(strncpy);
107EXPORT_SYMBOL(strcat);
108EXPORT_SYMBOL(strncat);
109EXPORT_SYMBOL(strchr);
110EXPORT_SYMBOL(strrchr);
111EXPORT_SYMBOL(strpbrk);
112EXPORT_SYMBOL(strstr);
113EXPORT_SYMBOL(strlen);
114EXPORT_SYMBOL(strnlen);
115EXPORT_SYMBOL(strcmp);
116EXPORT_SYMBOL(strncmp);
117EXPORT_SYMBOL(strcasecmp);
118EXPORT_SYMBOL(__div64_32);
119
120EXPORT_SYMBOL(csum_partial);
121EXPORT_SYMBOL(csum_partial_copy_generic);
122EXPORT_SYMBOL(ip_fast_csum);
123EXPORT_SYMBOL(csum_tcpudp_magic);
124
125EXPORT_SYMBOL(__copy_tofrom_user);
126EXPORT_SYMBOL(__clear_user);
127EXPORT_SYMBOL(__strncpy_from_user);
128EXPORT_SYMBOL(__strnlen_user);
129
130/*
131EXPORT_SYMBOL(inb);
132EXPORT_SYMBOL(inw);
133EXPORT_SYMBOL(inl);
134EXPORT_SYMBOL(outb);
135EXPORT_SYMBOL(outw);
136EXPORT_SYMBOL(outl);
137EXPORT_SYMBOL(outsl);*/
138
139EXPORT_SYMBOL(_insb);
140EXPORT_SYMBOL(_outsb);
141EXPORT_SYMBOL(_insw);
142EXPORT_SYMBOL(_outsw);
143EXPORT_SYMBOL(_insl);
144EXPORT_SYMBOL(_outsl);
145EXPORT_SYMBOL(_insw_ns);
146EXPORT_SYMBOL(_outsw_ns);
147EXPORT_SYMBOL(_insl_ns);
148EXPORT_SYMBOL(_outsl_ns);
149EXPORT_SYMBOL(iopa);
150EXPORT_SYMBOL(mm_ptov);
151EXPORT_SYMBOL(ioremap);
152#ifdef CONFIG_44x
153EXPORT_SYMBOL(ioremap64);
154#endif
155EXPORT_SYMBOL(__ioremap);
156EXPORT_SYMBOL(iounmap);
157EXPORT_SYMBOL(ioremap_bot); /* aka VMALLOC_END */
158
159#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
160EXPORT_SYMBOL(ppc_ide_md);
161#endif
162
163#ifdef CONFIG_PCI
164EXPORT_SYMBOL(isa_io_base);
165EXPORT_SYMBOL(isa_mem_base);
166EXPORT_SYMBOL(pci_dram_offset);
167EXPORT_SYMBOL(pci_alloc_consistent);
168EXPORT_SYMBOL(pci_free_consistent);
169EXPORT_SYMBOL(pci_bus_io_base);
170EXPORT_SYMBOL(pci_bus_io_base_phys);
171EXPORT_SYMBOL(pci_bus_mem_base_phys);
172EXPORT_SYMBOL(pci_bus_to_hose);
173EXPORT_SYMBOL(pci_resource_to_bus);
174EXPORT_SYMBOL(pci_phys_to_bus);
175EXPORT_SYMBOL(pci_bus_to_phys);
176#endif /* CONFIG_PCI */
177
178#ifdef CONFIG_NOT_COHERENT_CACHE
179EXPORT_SYMBOL(flush_dcache_all);
180#endif
181
182EXPORT_SYMBOL(start_thread);
183EXPORT_SYMBOL(kernel_thread);
184
185EXPORT_SYMBOL(flush_instruction_cache);
186EXPORT_SYMBOL(giveup_fpu);
187EXPORT_SYMBOL(flush_icache_range);
188EXPORT_SYMBOL(flush_dcache_range);
189EXPORT_SYMBOL(flush_icache_user_range);
190EXPORT_SYMBOL(flush_dcache_page);
191EXPORT_SYMBOL(flush_tlb_kernel_range);
192EXPORT_SYMBOL(flush_tlb_page);
193EXPORT_SYMBOL(_tlbie);
194#ifdef CONFIG_ALTIVEC
195EXPORT_SYMBOL(last_task_used_altivec);
196EXPORT_SYMBOL(giveup_altivec);
197#endif /* CONFIG_ALTIVEC */
198#ifdef CONFIG_SPE
199EXPORT_SYMBOL(last_task_used_spe);
200EXPORT_SYMBOL(giveup_spe);
201#endif /* CONFIG_SPE */
202#ifdef CONFIG_SMP
203EXPORT_SYMBOL(smp_call_function);
204EXPORT_SYMBOL(smp_hw_index);
205#endif
206
207EXPORT_SYMBOL(ppc_md);
208
209#ifdef CONFIG_ADB
210EXPORT_SYMBOL(adb_request);
211EXPORT_SYMBOL(adb_register);
212EXPORT_SYMBOL(adb_unregister);
213EXPORT_SYMBOL(adb_poll);
214EXPORT_SYMBOL(adb_try_handler_change);
215#endif /* CONFIG_ADB */
216#ifdef CONFIG_ADB_CUDA
217EXPORT_SYMBOL(cuda_request);
218EXPORT_SYMBOL(cuda_poll);
219#endif /* CONFIG_ADB_CUDA */
220#ifdef CONFIG_PPC_MULTIPLATFORM
221EXPORT_SYMBOL(_machine);
222#endif
223#ifdef CONFIG_PPC_PMAC
224EXPORT_SYMBOL(sys_ctrler);
225EXPORT_SYMBOL(pmac_newworld);
226#endif
227#ifdef CONFIG_PPC_OF
228EXPORT_SYMBOL(find_devices);
229EXPORT_SYMBOL(find_type_devices);
230EXPORT_SYMBOL(find_compatible_devices);
231EXPORT_SYMBOL(find_path_device);
232EXPORT_SYMBOL(device_is_compatible);
233EXPORT_SYMBOL(machine_is_compatible);
234EXPORT_SYMBOL(find_all_nodes);
235EXPORT_SYMBOL(get_property);
236EXPORT_SYMBOL(request_OF_resource);
237EXPORT_SYMBOL(release_OF_resource);
238EXPORT_SYMBOL(pci_busdev_to_OF_node);
239EXPORT_SYMBOL(pci_device_to_OF_node);
240EXPORT_SYMBOL(pci_device_from_OF_node);
241EXPORT_SYMBOL(of_find_node_by_name);
242EXPORT_SYMBOL(of_find_node_by_type);
243EXPORT_SYMBOL(of_find_compatible_node);
244EXPORT_SYMBOL(of_find_node_by_path);
245EXPORT_SYMBOL(of_find_all_nodes);
246EXPORT_SYMBOL(of_get_parent);
247EXPORT_SYMBOL(of_get_next_child);
248EXPORT_SYMBOL(of_node_get);
249EXPORT_SYMBOL(of_node_put);
250#endif /* CONFIG_PPC_OF */
251#if defined(CONFIG_BOOTX_TEXT)
252EXPORT_SYMBOL(btext_update_display);
253#endif
254#if defined(CONFIG_SCSI) && defined(CONFIG_PPC_PMAC)
255EXPORT_SYMBOL(note_scsi_host);
256#endif
257#ifdef CONFIG_VT
258EXPORT_SYMBOL(kd_mksound);
259#endif
260EXPORT_SYMBOL(to_tm);
261
262EXPORT_SYMBOL(pm_power_off);
263
264EXPORT_SYMBOL(__ashrdi3);
265EXPORT_SYMBOL(__ashldi3);
266EXPORT_SYMBOL(__lshrdi3);
267EXPORT_SYMBOL(memcpy);
268EXPORT_SYMBOL(memset);
269EXPORT_SYMBOL(memmove);
270EXPORT_SYMBOL(memscan);
271EXPORT_SYMBOL(memcmp);
272EXPORT_SYMBOL(memchr);
273
274#if defined(CONFIG_FB_VGA16_MODULE)
275EXPORT_SYMBOL(screen_info);
276#endif
277
278EXPORT_SYMBOL(__delay);
279#ifndef INLINE_IRQS
280EXPORT_SYMBOL(local_irq_enable);
281EXPORT_SYMBOL(local_irq_enable_end);
282EXPORT_SYMBOL(local_irq_disable);
283EXPORT_SYMBOL(local_irq_disable_end);
284EXPORT_SYMBOL(local_save_flags_ptr);
285EXPORT_SYMBOL(local_save_flags_ptr_end);
286EXPORT_SYMBOL(local_irq_restore);
287EXPORT_SYMBOL(local_irq_restore_end);
288#endif
289EXPORT_SYMBOL(timer_interrupt);
290EXPORT_SYMBOL(irq_desc);
291EXPORT_SYMBOL(tb_ticks_per_jiffy);
292EXPORT_SYMBOL(get_wchan);
293EXPORT_SYMBOL(console_drivers);
294#ifdef CONFIG_XMON
295EXPORT_SYMBOL(xmon);
296EXPORT_SYMBOL(xmon_printf);
297#endif
298EXPORT_SYMBOL(__up);
299EXPORT_SYMBOL(__down);
300EXPORT_SYMBOL(__down_interruptible);
301
302#if defined(CONFIG_KGDB) || defined(CONFIG_XMON)
303extern void (*debugger)(struct pt_regs *regs);
304extern int (*debugger_bpt)(struct pt_regs *regs);
305extern int (*debugger_sstep)(struct pt_regs *regs);
306extern int (*debugger_iabr_match)(struct pt_regs *regs);
307extern int (*debugger_dabr_match)(struct pt_regs *regs);
308extern void (*debugger_fault_handler)(struct pt_regs *regs);
309
310EXPORT_SYMBOL(debugger);
311EXPORT_SYMBOL(debugger_bpt);
312EXPORT_SYMBOL(debugger_sstep);
313EXPORT_SYMBOL(debugger_iabr_match);
314EXPORT_SYMBOL(debugger_dabr_match);
315EXPORT_SYMBOL(debugger_fault_handler);
316#endif
317
318#ifdef CONFIG_8xx
319EXPORT_SYMBOL(cpm_install_handler);
320EXPORT_SYMBOL(cpm_free_handler);
321#endif /* CONFIG_8xx */
322#if defined(CONFIG_8xx) || defined(CONFIG_40x) || defined(CONFIG_85xx) ||\
323 defined(CONFIG_83xx)
324EXPORT_SYMBOL(__res);
325#endif
326
327EXPORT_SYMBOL(next_mmu_context);
328EXPORT_SYMBOL(set_context);
329EXPORT_SYMBOL(handle_mm_fault); /* For MOL */
330EXPORT_SYMBOL(disarm_decr);
331#ifdef CONFIG_PPC_STD_MMU
332extern long mol_trampoline;
333EXPORT_SYMBOL(mol_trampoline); /* For MOL */
334EXPORT_SYMBOL(flush_hash_pages); /* For MOL */
335#ifdef CONFIG_SMP
336extern int mmu_hash_lock;
337EXPORT_SYMBOL(mmu_hash_lock); /* For MOL */
338#endif /* CONFIG_SMP */
339extern long *intercept_table;
340EXPORT_SYMBOL(intercept_table);
341#endif /* CONFIG_PPC_STD_MMU */
342EXPORT_SYMBOL(cur_cpu_spec);
343#ifdef CONFIG_PPC_PMAC
344extern unsigned long agp_special_page;
345EXPORT_SYMBOL(agp_special_page);
346#endif
347#if defined(CONFIG_40x) || defined(CONFIG_BOOKE)
348EXPORT_SYMBOL(__mtdcr);
349EXPORT_SYMBOL(__mfdcr);
350#endif
diff --git a/arch/ppc/kernel/process.c b/arch/ppc/kernel/process.c
new file mode 100644
index 000000000000..82de66e4db6d
--- /dev/null
+++ b/arch/ppc/kernel/process.c
@@ -0,0 +1,781 @@
1/*
2 * arch/ppc/kernel/process.c
3 *
4 * Derived from "arch/i386/kernel/process.c"
5 * Copyright (C) 1995 Linus Torvalds
6 *
7 * Updated and modified by Cort Dougan (cort@cs.nmt.edu) and
8 * Paul Mackerras (paulus@cs.anu.edu.au)
9 *
10 * PowerPC version
11 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version
16 * 2 of the License, or (at your option) any later version.
17 *
18 */
19
20#include <linux/config.h>
21#include <linux/errno.h>
22#include <linux/sched.h>
23#include <linux/kernel.h>
24#include <linux/mm.h>
25#include <linux/smp.h>
26#include <linux/smp_lock.h>
27#include <linux/stddef.h>
28#include <linux/unistd.h>
29#include <linux/ptrace.h>
30#include <linux/slab.h>
31#include <linux/user.h>
32#include <linux/elf.h>
33#include <linux/init.h>
34#include <linux/prctl.h>
35#include <linux/init_task.h>
36#include <linux/module.h>
37#include <linux/kallsyms.h>
38#include <linux/mqueue.h>
39#include <linux/hardirq.h>
40
41#include <asm/pgtable.h>
42#include <asm/uaccess.h>
43#include <asm/system.h>
44#include <asm/io.h>
45#include <asm/processor.h>
46#include <asm/mmu.h>
47#include <asm/prom.h>
48
49extern unsigned long _get_SP(void);
50
51struct task_struct *last_task_used_math = NULL;
52struct task_struct *last_task_used_altivec = NULL;
53struct task_struct *last_task_used_spe = NULL;
54
55static struct fs_struct init_fs = INIT_FS;
56static struct files_struct init_files = INIT_FILES;
57static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
58static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
59struct mm_struct init_mm = INIT_MM(init_mm);
60EXPORT_SYMBOL(init_mm);
61
62/* this is 8kB-aligned so we can get to the thread_info struct
63 at the base of it from the stack pointer with 1 integer instruction. */
64union thread_union init_thread_union
65 __attribute__((__section__(".data.init_task"))) =
66{ INIT_THREAD_INFO(init_task) };
67
68/* initial task structure */
69struct task_struct init_task = INIT_TASK(init_task);
70EXPORT_SYMBOL(init_task);
71
72/* only used to get secondary processor up */
73struct task_struct *current_set[NR_CPUS] = {&init_task, };
74
75#undef SHOW_TASK_SWITCHES
76#undef CHECK_STACK
77
78#if defined(CHECK_STACK)
79unsigned long
80kernel_stack_top(struct task_struct *tsk)
81{
82 return ((unsigned long)tsk) + sizeof(union task_union);
83}
84
85unsigned long
86task_top(struct task_struct *tsk)
87{
88 return ((unsigned long)tsk) + sizeof(struct thread_info);
89}
90
91/* check to make sure the kernel stack is healthy */
92int check_stack(struct task_struct *tsk)
93{
94 unsigned long stack_top = kernel_stack_top(tsk);
95 unsigned long tsk_top = task_top(tsk);
96 int ret = 0;
97
98#if 0
99 /* check thread magic */
100 if ( tsk->thread.magic != THREAD_MAGIC )
101 {
102 ret |= 1;
103 printk("thread.magic bad: %08x\n", tsk->thread.magic);
104 }
105#endif
106
107 if ( !tsk )
108 printk("check_stack(): tsk bad tsk %p\n",tsk);
109
110 /* check if stored ksp is bad */
111 if ( (tsk->thread.ksp > stack_top) || (tsk->thread.ksp < tsk_top) )
112 {
113 printk("stack out of bounds: %s/%d\n"
114 " tsk_top %08lx ksp %08lx stack_top %08lx\n",
115 tsk->comm,tsk->pid,
116 tsk_top, tsk->thread.ksp, stack_top);
117 ret |= 2;
118 }
119
120 /* check if stack ptr RIGHT NOW is bad */
121 if ( (tsk == current) && ((_get_SP() > stack_top ) || (_get_SP() < tsk_top)) )
122 {
123 printk("current stack ptr out of bounds: %s/%d\n"
124 " tsk_top %08lx sp %08lx stack_top %08lx\n",
125 current->comm,current->pid,
126 tsk_top, _get_SP(), stack_top);
127 ret |= 4;
128 }
129
130#if 0
131 /* check amount of free stack */
132 for ( i = (unsigned long *)task_top(tsk) ; i < kernel_stack_top(tsk) ; i++ )
133 {
134 if ( !i )
135 printk("check_stack(): i = %p\n", i);
136 if ( *i != 0 )
137 {
138 /* only notify if it's less than 900 bytes */
139 if ( (i - (unsigned long *)task_top(tsk)) < 900 )
140 printk("%d bytes free on stack\n",
141 i - task_top(tsk));
142 break;
143 }
144 }
145#endif
146
147 if (ret)
148 {
149 panic("bad kernel stack");
150 }
151 return(ret);
152}
153#endif /* defined(CHECK_STACK) */
154
155#ifdef CONFIG_ALTIVEC
156int
157dump_altivec(struct pt_regs *regs, elf_vrregset_t *vrregs)
158{
159 if (regs->msr & MSR_VEC)
160 giveup_altivec(current);
161 memcpy(vrregs, &current->thread.vr[0], sizeof(*vrregs));
162 return 1;
163}
164
165void
166enable_kernel_altivec(void)
167{
168 WARN_ON(preemptible());
169
170#ifdef CONFIG_SMP
171 if (current->thread.regs && (current->thread.regs->msr & MSR_VEC))
172 giveup_altivec(current);
173 else
174 giveup_altivec(NULL); /* just enable AltiVec for kernel - force */
175#else
176 giveup_altivec(last_task_used_altivec);
177#endif /* __SMP __ */
178}
179EXPORT_SYMBOL(enable_kernel_altivec);
180#endif /* CONFIG_ALTIVEC */
181
182#ifdef CONFIG_SPE
183int
184dump_spe(struct pt_regs *regs, elf_vrregset_t *evrregs)
185{
186 if (regs->msr & MSR_SPE)
187 giveup_spe(current);
188 /* We copy u32 evr[32] + u64 acc + u32 spefscr -> 35 */
189 memcpy(evrregs, &current->thread.evr[0], sizeof(u32) * 35);
190 return 1;
191}
192
193void
194enable_kernel_spe(void)
195{
196 WARN_ON(preemptible());
197
198#ifdef CONFIG_SMP
199 if (current->thread.regs && (current->thread.regs->msr & MSR_SPE))
200 giveup_spe(current);
201 else
202 giveup_spe(NULL); /* just enable SPE for kernel - force */
203#else
204 giveup_spe(last_task_used_spe);
205#endif /* __SMP __ */
206}
207EXPORT_SYMBOL(enable_kernel_spe);
208#endif /* CONFIG_SPE */
209
210void
211enable_kernel_fp(void)
212{
213 WARN_ON(preemptible());
214
215#ifdef CONFIG_SMP
216 if (current->thread.regs && (current->thread.regs->msr & MSR_FP))
217 giveup_fpu(current);
218 else
219 giveup_fpu(NULL); /* just enables FP for kernel */
220#else
221 giveup_fpu(last_task_used_math);
222#endif /* CONFIG_SMP */
223}
224EXPORT_SYMBOL(enable_kernel_fp);
225
226int
227dump_task_fpu(struct task_struct *tsk, elf_fpregset_t *fpregs)
228{
229 preempt_disable();
230 if (tsk->thread.regs && (tsk->thread.regs->msr & MSR_FP))
231 giveup_fpu(tsk);
232 preempt_enable();
233 memcpy(fpregs, &tsk->thread.fpr[0], sizeof(*fpregs));
234 return 1;
235}
236
237struct task_struct *__switch_to(struct task_struct *prev,
238 struct task_struct *new)
239{
240 struct thread_struct *new_thread, *old_thread;
241 unsigned long s;
242 struct task_struct *last;
243
244 local_irq_save(s);
245#ifdef CHECK_STACK
246 check_stack(prev);
247 check_stack(new);
248#endif
249
250#ifdef CONFIG_SMP
251 /* avoid complexity of lazy save/restore of fpu
252 * by just saving it every time we switch out if
253 * this task used the fpu during the last quantum.
254 *
255 * If it tries to use the fpu again, it'll trap and
256 * reload its fp regs. So we don't have to do a restore
257 * every switch, just a save.
258 * -- Cort
259 */
260 if (prev->thread.regs && (prev->thread.regs->msr & MSR_FP))
261 giveup_fpu(prev);
262#ifdef CONFIG_ALTIVEC
263 /*
264 * If the previous thread used altivec in the last quantum
265 * (thus changing altivec regs) then save them.
266 * We used to check the VRSAVE register but not all apps
267 * set it, so we don't rely on it now (and in fact we need
268 * to save & restore VSCR even if VRSAVE == 0). -- paulus
269 *
270 * On SMP we always save/restore altivec regs just to avoid the
271 * complexity of changing processors.
272 * -- Cort
273 */
274 if ((prev->thread.regs && (prev->thread.regs->msr & MSR_VEC)))
275 giveup_altivec(prev);
276#endif /* CONFIG_ALTIVEC */
277#ifdef CONFIG_SPE
278 /*
279 * If the previous thread used spe in the last quantum
280 * (thus changing spe regs) then save them.
281 *
282 * On SMP we always save/restore spe regs just to avoid the
283 * complexity of changing processors.
284 */
285 if ((prev->thread.regs && (prev->thread.regs->msr & MSR_SPE)))
286 giveup_spe(prev);
287#endif /* CONFIG_SPE */
288#endif /* CONFIG_SMP */
289
290 /* Avoid the trap. On smp this this never happens since
291 * we don't set last_task_used_altivec -- Cort
292 */
293 if (new->thread.regs && last_task_used_altivec == new)
294 new->thread.regs->msr |= MSR_VEC;
295#ifdef CONFIG_SPE
296 /* Avoid the trap. On smp this this never happens since
297 * we don't set last_task_used_spe
298 */
299 if (new->thread.regs && last_task_used_spe == new)
300 new->thread.regs->msr |= MSR_SPE;
301#endif /* CONFIG_SPE */
302 new_thread = &new->thread;
303 old_thread = &current->thread;
304 last = _switch(old_thread, new_thread);
305 local_irq_restore(s);
306 return last;
307}
308
309void show_regs(struct pt_regs * regs)
310{
311 int i, trap;
312
313 printk("NIP: %08lX LR: %08lX SP: %08lX REGS: %p TRAP: %04lx %s\n",
314 regs->nip, regs->link, regs->gpr[1], regs, regs->trap,
315 print_tainted());
316 printk("MSR: %08lx EE: %01x PR: %01x FP: %01x ME: %01x IR/DR: %01x%01x\n",
317 regs->msr, regs->msr&MSR_EE ? 1 : 0, regs->msr&MSR_PR ? 1 : 0,
318 regs->msr & MSR_FP ? 1 : 0,regs->msr&MSR_ME ? 1 : 0,
319 regs->msr&MSR_IR ? 1 : 0,
320 regs->msr&MSR_DR ? 1 : 0);
321 trap = TRAP(regs);
322 if (trap == 0x300 || trap == 0x600)
323 printk("DAR: %08lX, DSISR: %08lX\n", regs->dar, regs->dsisr);
324 printk("TASK = %p[%d] '%s' THREAD: %p\n",
325 current, current->pid, current->comm, current->thread_info);
326 printk("Last syscall: %ld ", current->thread.last_syscall);
327
328#ifdef CONFIG_SMP
329 printk(" CPU: %d", smp_processor_id());
330#endif /* CONFIG_SMP */
331
332 for (i = 0; i < 32; i++) {
333 long r;
334 if ((i % 8) == 0)
335 printk("\n" KERN_INFO "GPR%02d: ", i);
336 if (__get_user(r, &regs->gpr[i]))
337 break;
338 printk("%08lX ", r);
339 if (i == 12 && !FULL_REGS(regs))
340 break;
341 }
342 printk("\n");
343#ifdef CONFIG_KALLSYMS
344 /*
345 * Lookup NIP late so we have the best change of getting the
346 * above info out without failing
347 */
348 printk("NIP [%08lx] ", regs->nip);
349 print_symbol("%s\n", regs->nip);
350 printk("LR [%08lx] ", regs->link);
351 print_symbol("%s\n", regs->link);
352#endif
353 show_stack(current, (unsigned long *) regs->gpr[1]);
354}
355
356void exit_thread(void)
357{
358 if (last_task_used_math == current)
359 last_task_used_math = NULL;
360 if (last_task_used_altivec == current)
361 last_task_used_altivec = NULL;
362#ifdef CONFIG_SPE
363 if (last_task_used_spe == current)
364 last_task_used_spe = NULL;
365#endif
366}
367
368void flush_thread(void)
369{
370 if (last_task_used_math == current)
371 last_task_used_math = NULL;
372 if (last_task_used_altivec == current)
373 last_task_used_altivec = NULL;
374#ifdef CONFIG_SPE
375 if (last_task_used_spe == current)
376 last_task_used_spe = NULL;
377#endif
378}
379
380void
381release_thread(struct task_struct *t)
382{
383}
384
385/*
386 * This gets called before we allocate a new thread and copy
387 * the current task into it.
388 */
389void prepare_to_copy(struct task_struct *tsk)
390{
391 struct pt_regs *regs = tsk->thread.regs;
392
393 if (regs == NULL)
394 return;
395 preempt_disable();
396 if (regs->msr & MSR_FP)
397 giveup_fpu(current);
398#ifdef CONFIG_ALTIVEC
399 if (regs->msr & MSR_VEC)
400 giveup_altivec(current);
401#endif /* CONFIG_ALTIVEC */
402#ifdef CONFIG_SPE
403 if (regs->msr & MSR_SPE)
404 giveup_spe(current);
405#endif /* CONFIG_SPE */
406 preempt_enable();
407}
408
409/*
410 * Copy a thread..
411 */
412int
413copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
414 unsigned long unused,
415 struct task_struct *p, struct pt_regs *regs)
416{
417 struct pt_regs *childregs, *kregs;
418 extern void ret_from_fork(void);
419 unsigned long sp = (unsigned long)p->thread_info + THREAD_SIZE;
420 unsigned long childframe;
421
422 CHECK_FULL_REGS(regs);
423 /* Copy registers */
424 sp -= sizeof(struct pt_regs);
425 childregs = (struct pt_regs *) sp;
426 *childregs = *regs;
427 if ((childregs->msr & MSR_PR) == 0) {
428 /* for kernel thread, set `current' and stackptr in new task */
429 childregs->gpr[1] = sp + sizeof(struct pt_regs);
430 childregs->gpr[2] = (unsigned long) p;
431 p->thread.regs = NULL; /* no user register state */
432 } else {
433 childregs->gpr[1] = usp;
434 p->thread.regs = childregs;
435 if (clone_flags & CLONE_SETTLS)
436 childregs->gpr[2] = childregs->gpr[6];
437 }
438 childregs->gpr[3] = 0; /* Result from fork() */
439 sp -= STACK_FRAME_OVERHEAD;
440 childframe = sp;
441
442 /*
443 * The way this works is that at some point in the future
444 * some task will call _switch to switch to the new task.
445 * That will pop off the stack frame created below and start
446 * the new task running at ret_from_fork. The new task will
447 * do some house keeping and then return from the fork or clone
448 * system call, using the stack frame created above.
449 */
450 sp -= sizeof(struct pt_regs);
451 kregs = (struct pt_regs *) sp;
452 sp -= STACK_FRAME_OVERHEAD;
453 p->thread.ksp = sp;
454 kregs->nip = (unsigned long)ret_from_fork;
455
456 p->thread.last_syscall = -1;
457
458 return 0;
459}
460
461/*
462 * Set up a thread for executing a new program
463 */
464void start_thread(struct pt_regs *regs, unsigned long nip, unsigned long sp)
465{
466 set_fs(USER_DS);
467 memset(regs->gpr, 0, sizeof(regs->gpr));
468 regs->ctr = 0;
469 regs->link = 0;
470 regs->xer = 0;
471 regs->ccr = 0;
472 regs->mq = 0;
473 regs->nip = nip;
474 regs->gpr[1] = sp;
475 regs->msr = MSR_USER;
476 if (last_task_used_math == current)
477 last_task_used_math = NULL;
478 if (last_task_used_altivec == current)
479 last_task_used_altivec = NULL;
480#ifdef CONFIG_SPE
481 if (last_task_used_spe == current)
482 last_task_used_spe = NULL;
483#endif
484 memset(current->thread.fpr, 0, sizeof(current->thread.fpr));
485 current->thread.fpscr = 0;
486#ifdef CONFIG_ALTIVEC
487 memset(current->thread.vr, 0, sizeof(current->thread.vr));
488 memset(&current->thread.vscr, 0, sizeof(current->thread.vscr));
489 current->thread.vrsave = 0;
490 current->thread.used_vr = 0;
491#endif /* CONFIG_ALTIVEC */
492#ifdef CONFIG_SPE
493 memset(current->thread.evr, 0, sizeof(current->thread.evr));
494 current->thread.acc = 0;
495 current->thread.spefscr = 0;
496 current->thread.used_spe = 0;
497#endif /* CONFIG_SPE */
498}
499
500#define PR_FP_ALL_EXCEPT (PR_FP_EXC_DIV | PR_FP_EXC_OVF | PR_FP_EXC_UND \
501 | PR_FP_EXC_RES | PR_FP_EXC_INV)
502
503int set_fpexc_mode(struct task_struct *tsk, unsigned int val)
504{
505 struct pt_regs *regs = tsk->thread.regs;
506
507 /* This is a bit hairy. If we are an SPE enabled processor
508 * (have embedded fp) we store the IEEE exception enable flags in
509 * fpexc_mode. fpexc_mode is also used for setting FP exception
510 * mode (asyn, precise, disabled) for 'Classic' FP. */
511 if (val & PR_FP_EXC_SW_ENABLE) {
512#ifdef CONFIG_SPE
513 tsk->thread.fpexc_mode = val &
514 (PR_FP_EXC_SW_ENABLE | PR_FP_ALL_EXCEPT);
515#else
516 return -EINVAL;
517#endif
518 } else {
519 /* on a CONFIG_SPE this does not hurt us. The bits that
520 * __pack_fe01 use do not overlap with bits used for
521 * PR_FP_EXC_SW_ENABLE. Additionally, the MSR[FE0,FE1] bits
522 * on CONFIG_SPE implementations are reserved so writing to
523 * them does not change anything */
524 if (val > PR_FP_EXC_PRECISE)
525 return -EINVAL;
526 tsk->thread.fpexc_mode = __pack_fe01(val);
527 if (regs != NULL && (regs->msr & MSR_FP) != 0)
528 regs->msr = (regs->msr & ~(MSR_FE0|MSR_FE1))
529 | tsk->thread.fpexc_mode;
530 }
531 return 0;
532}
533
534int get_fpexc_mode(struct task_struct *tsk, unsigned long adr)
535{
536 unsigned int val;
537
538 if (tsk->thread.fpexc_mode & PR_FP_EXC_SW_ENABLE)
539#ifdef CONFIG_SPE
540 val = tsk->thread.fpexc_mode;
541#else
542 return -EINVAL;
543#endif
544 else
545 val = __unpack_fe01(tsk->thread.fpexc_mode);
546 return put_user(val, (unsigned int __user *) adr);
547}
548
549int sys_clone(unsigned long clone_flags, unsigned long usp,
550 int __user *parent_tidp, void __user *child_threadptr,
551 int __user *child_tidp, int p6,
552 struct pt_regs *regs)
553{
554 CHECK_FULL_REGS(regs);
555 if (usp == 0)
556 usp = regs->gpr[1]; /* stack pointer for child */
557 return do_fork(clone_flags, usp, regs, 0, parent_tidp, child_tidp);
558}
559
560int sys_fork(int p1, int p2, int p3, int p4, int p5, int p6,
561 struct pt_regs *regs)
562{
563 CHECK_FULL_REGS(regs);
564 return do_fork(SIGCHLD, regs->gpr[1], regs, 0, NULL, NULL);
565}
566
567int sys_vfork(int p1, int p2, int p3, int p4, int p5, int p6,
568 struct pt_regs *regs)
569{
570 CHECK_FULL_REGS(regs);
571 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs->gpr[1],
572 regs, 0, NULL, NULL);
573}
574
575int sys_execve(unsigned long a0, unsigned long a1, unsigned long a2,
576 unsigned long a3, unsigned long a4, unsigned long a5,
577 struct pt_regs *regs)
578{
579 int error;
580 char * filename;
581
582 filename = getname((char __user *) a0);
583 error = PTR_ERR(filename);
584 if (IS_ERR(filename))
585 goto out;
586 preempt_disable();
587 if (regs->msr & MSR_FP)
588 giveup_fpu(current);
589#ifdef CONFIG_ALTIVEC
590 if (regs->msr & MSR_VEC)
591 giveup_altivec(current);
592#endif /* CONFIG_ALTIVEC */
593#ifdef CONFIG_SPE
594 if (regs->msr & MSR_SPE)
595 giveup_spe(current);
596#endif /* CONFIG_SPE */
597 preempt_enable();
598 error = do_execve(filename, (char __user *__user *) a1,
599 (char __user *__user *) a2, regs);
600 if (error == 0) {
601 task_lock(current);
602 current->ptrace &= ~PT_DTRACE;
603 task_unlock(current);
604 }
605 putname(filename);
606out:
607 return error;
608}
609
610void dump_stack(void)
611{
612 show_stack(current, NULL);
613}
614
615EXPORT_SYMBOL(dump_stack);
616
617void show_stack(struct task_struct *tsk, unsigned long *stack)
618{
619 unsigned long sp, stack_top, prev_sp, ret;
620 int count = 0;
621 unsigned long next_exc = 0;
622 struct pt_regs *regs;
623 extern char ret_from_except, ret_from_except_full, ret_from_syscall;
624
625 sp = (unsigned long) stack;
626 if (tsk == NULL)
627 tsk = current;
628 if (sp == 0) {
629 if (tsk == current)
630 asm("mr %0,1" : "=r" (sp));
631 else
632 sp = tsk->thread.ksp;
633 }
634
635 prev_sp = (unsigned long) (tsk->thread_info + 1);
636 stack_top = (unsigned long) tsk->thread_info + THREAD_SIZE;
637 while (count < 16 && sp > prev_sp && sp < stack_top && (sp & 3) == 0) {
638 if (count == 0) {
639 printk("Call trace:");
640#ifdef CONFIG_KALLSYMS
641 printk("\n");
642#endif
643 } else {
644 if (next_exc) {
645 ret = next_exc;
646 next_exc = 0;
647 } else
648 ret = *(unsigned long *)(sp + 4);
649 printk(" [%08lx] ", ret);
650#ifdef CONFIG_KALLSYMS
651 print_symbol("%s", ret);
652 printk("\n");
653#endif
654 if (ret == (unsigned long) &ret_from_except
655 || ret == (unsigned long) &ret_from_except_full
656 || ret == (unsigned long) &ret_from_syscall) {
657 /* sp + 16 points to an exception frame */
658 regs = (struct pt_regs *) (sp + 16);
659 if (sp + 16 + sizeof(*regs) <= stack_top)
660 next_exc = regs->nip;
661 }
662 }
663 ++count;
664 sp = *(unsigned long *)sp;
665 }
666#ifndef CONFIG_KALLSYMS
667 if (count > 0)
668 printk("\n");
669#endif
670}
671
672#if 0
673/*
674 * Low level print for debugging - Cort
675 */
676int __init ll_printk(const char *fmt, ...)
677{
678 va_list args;
679 char buf[256];
680 int i;
681
682 va_start(args, fmt);
683 i=vsprintf(buf,fmt,args);
684 ll_puts(buf);
685 va_end(args);
686 return i;
687}
688
689int lines = 24, cols = 80;
690int orig_x = 0, orig_y = 0;
691
692void puthex(unsigned long val)
693{
694 unsigned char buf[10];
695 int i;
696 for (i = 7; i >= 0; i--)
697 {
698 buf[i] = "0123456789ABCDEF"[val & 0x0F];
699 val >>= 4;
700 }
701 buf[8] = '\0';
702 prom_print(buf);
703}
704
705void __init ll_puts(const char *s)
706{
707 int x,y;
708 char *vidmem = (char *)/*(_ISA_MEM_BASE + 0xB8000) */0xD00B8000;
709 char c;
710 extern int mem_init_done;
711
712 if ( mem_init_done ) /* assume this means we can printk */
713 {
714 printk(s);
715 return;
716 }
717
718#if 0
719 if ( have_of )
720 {
721 prom_print(s);
722 return;
723 }
724#endif
725
726 /*
727 * can't ll_puts on chrp without openfirmware yet.
728 * vidmem just needs to be setup for it.
729 * -- Cort
730 */
731 if ( _machine != _MACH_prep )
732 return;
733 x = orig_x;
734 y = orig_y;
735
736 while ( ( c = *s++ ) != '\0' ) {
737 if ( c == '\n' ) {
738 x = 0;
739 if ( ++y >= lines ) {
740 /*scroll();*/
741 /*y--;*/
742 y = 0;
743 }
744 } else {
745 vidmem [ ( x + cols * y ) * 2 ] = c;
746 if ( ++x >= cols ) {
747 x = 0;
748 if ( ++y >= lines ) {
749 /*scroll();*/
750 /*y--;*/
751 y = 0;
752 }
753 }
754 }
755 }
756
757 orig_x = x;
758 orig_y = y;
759}
760#endif
761
762unsigned long get_wchan(struct task_struct *p)
763{
764 unsigned long ip, sp;
765 unsigned long stack_page = (unsigned long) p->thread_info;
766 int count = 0;
767 if (!p || p == current || p->state == TASK_RUNNING)
768 return 0;
769 sp = p->thread.ksp;
770 do {
771 sp = *(unsigned long *)sp;
772 if (sp < stack_page || sp >= stack_page + 8188)
773 return 0;
774 if (count > 0) {
775 ip = *(unsigned long *)(sp + 4);
776 if (!in_sched_functions(ip))
777 return ip;
778 }
779 } while (count++ < 16);
780 return 0;
781}
diff --git a/arch/ppc/kernel/ptrace.c b/arch/ppc/kernel/ptrace.c
new file mode 100644
index 000000000000..426b6f7d9de3
--- /dev/null
+++ b/arch/ppc/kernel/ptrace.c
@@ -0,0 +1,474 @@
1/*
2 * arch/ppc/kernel/ptrace.c
3 *
4 * PowerPC version
5 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
6 *
7 * Derived from "arch/m68k/kernel/ptrace.c"
8 * Copyright (C) 1994 by Hamish Macdonald
9 * Taken from linux/kernel/ptrace.c and modified for M680x0.
10 * linux/kernel/ptrace.c is by Ross Biro 1/23/92, edited by Linus Torvalds
11 *
12 * Modified by Cort Dougan (cort@hq.fsmlabs.com)
13 * and Paul Mackerras (paulus@linuxcare.com.au).
14 *
15 * This file is subject to the terms and conditions of the GNU General
16 * Public License. See the file README.legal in the main directory of
17 * this archive for more details.
18 */
19
20#include <linux/kernel.h>
21#include <linux/sched.h>
22#include <linux/mm.h>
23#include <linux/smp.h>
24#include <linux/smp_lock.h>
25#include <linux/errno.h>
26#include <linux/ptrace.h>
27#include <linux/user.h>
28#include <linux/security.h>
29
30#include <asm/uaccess.h>
31#include <asm/page.h>
32#include <asm/pgtable.h>
33#include <asm/system.h>
34
35/*
36 * Set of msr bits that gdb can change on behalf of a process.
37 */
38#if defined(CONFIG_40x) || defined(CONFIG_BOOKE)
39#define MSR_DEBUGCHANGE 0
40#else
41#define MSR_DEBUGCHANGE (MSR_SE | MSR_BE)
42#endif
43
44/*
45 * does not yet catch signals sent when the child dies.
46 * in exit.c or in signal.c.
47 */
48
49/*
50 * Get contents of register REGNO in task TASK.
51 */
52static inline unsigned long get_reg(struct task_struct *task, int regno)
53{
54 if (regno < sizeof(struct pt_regs) / sizeof(unsigned long)
55 && task->thread.regs != NULL)
56 return ((unsigned long *)task->thread.regs)[regno];
57 return (0);
58}
59
60/*
61 * Write contents of register REGNO in task TASK.
62 */
63static inline int put_reg(struct task_struct *task, int regno,
64 unsigned long data)
65{
66 if (regno <= PT_MQ && task->thread.regs != NULL) {
67 if (regno == PT_MSR)
68 data = (data & MSR_DEBUGCHANGE)
69 | (task->thread.regs->msr & ~MSR_DEBUGCHANGE);
70 ((unsigned long *)task->thread.regs)[regno] = data;
71 return 0;
72 }
73 return -EIO;
74}
75
76#ifdef CONFIG_ALTIVEC
77/*
78 * Get contents of AltiVec register state in task TASK
79 */
80static inline int get_vrregs(unsigned long __user *data, struct task_struct *task)
81{
82 int i, j;
83
84 if (!access_ok(VERIFY_WRITE, data, 133 * sizeof(unsigned long)))
85 return -EFAULT;
86
87 /* copy AltiVec registers VR[0] .. VR[31] */
88 for (i = 0; i < 32; i++)
89 for (j = 0; j < 4; j++, data++)
90 if (__put_user(task->thread.vr[i].u[j], data))
91 return -EFAULT;
92
93 /* copy VSCR */
94 for (i = 0; i < 4; i++, data++)
95 if (__put_user(task->thread.vscr.u[i], data))
96 return -EFAULT;
97
98 /* copy VRSAVE */
99 if (__put_user(task->thread.vrsave, data))
100 return -EFAULT;
101
102 return 0;
103}
104
105/*
106 * Write contents of AltiVec register state into task TASK.
107 */
108static inline int set_vrregs(struct task_struct *task, unsigned long __user *data)
109{
110 int i, j;
111
112 if (!access_ok(VERIFY_READ, data, 133 * sizeof(unsigned long)))
113 return -EFAULT;
114
115 /* copy AltiVec registers VR[0] .. VR[31] */
116 for (i = 0; i < 32; i++)
117 for (j = 0; j < 4; j++, data++)
118 if (__get_user(task->thread.vr[i].u[j], data))
119 return -EFAULT;
120
121 /* copy VSCR */
122 for (i = 0; i < 4; i++, data++)
123 if (__get_user(task->thread.vscr.u[i], data))
124 return -EFAULT;
125
126 /* copy VRSAVE */
127 if (__get_user(task->thread.vrsave, data))
128 return -EFAULT;
129
130 return 0;
131}
132#endif
133
134#ifdef CONFIG_SPE
135
136/*
137 * For get_evrregs/set_evrregs functions 'data' has the following layout:
138 *
139 * struct {
140 * u32 evr[32];
141 * u64 acc;
142 * u32 spefscr;
143 * }
144 */
145
146/*
147 * Get contents of SPE register state in task TASK.
148 */
149static inline int get_evrregs(unsigned long *data, struct task_struct *task)
150{
151 int i;
152
153 if (!access_ok(VERIFY_WRITE, data, 35 * sizeof(unsigned long)))
154 return -EFAULT;
155
156 /* copy SPEFSCR */
157 if (__put_user(task->thread.spefscr, &data[34]))
158 return -EFAULT;
159
160 /* copy SPE registers EVR[0] .. EVR[31] */
161 for (i = 0; i < 32; i++, data++)
162 if (__put_user(task->thread.evr[i], data))
163 return -EFAULT;
164
165 /* copy ACC */
166 if (__put_user64(task->thread.acc, (unsigned long long *)data))
167 return -EFAULT;
168
169 return 0;
170}
171
172/*
173 * Write contents of SPE register state into task TASK.
174 */
175static inline int set_evrregs(struct task_struct *task, unsigned long *data)
176{
177 int i;
178
179 if (!access_ok(VERIFY_READ, data, 35 * sizeof(unsigned long)))
180 return -EFAULT;
181
182 /* copy SPEFSCR */
183 if (__get_user(task->thread.spefscr, &data[34]))
184 return -EFAULT;
185
186 /* copy SPE registers EVR[0] .. EVR[31] */
187 for (i = 0; i < 32; i++, data++)
188 if (__get_user(task->thread.evr[i], data))
189 return -EFAULT;
190 /* copy ACC */
191 if (__get_user64(task->thread.acc, (unsigned long long*)data))
192 return -EFAULT;
193
194 return 0;
195}
196#endif /* CONFIG_SPE */
197
198static inline void
199set_single_step(struct task_struct *task)
200{
201 struct pt_regs *regs = task->thread.regs;
202
203 if (regs != NULL) {
204#if defined(CONFIG_40x) || defined(CONFIG_BOOKE)
205 task->thread.dbcr0 = DBCR0_IDM | DBCR0_IC;
206 regs->msr |= MSR_DE;
207#else
208 regs->msr |= MSR_SE;
209#endif
210 }
211}
212
213static inline void
214clear_single_step(struct task_struct *task)
215{
216 struct pt_regs *regs = task->thread.regs;
217
218 if (regs != NULL) {
219#if defined(CONFIG_40x) || defined(CONFIG_BOOKE)
220 task->thread.dbcr0 = 0;
221 regs->msr &= ~MSR_DE;
222#else
223 regs->msr &= ~MSR_SE;
224#endif
225 }
226}
227
228/*
229 * Called by kernel/ptrace.c when detaching..
230 *
231 * Make sure single step bits etc are not set.
232 */
233void ptrace_disable(struct task_struct *child)
234{
235 /* make sure the single step bit is not set. */
236 clear_single_step(child);
237}
238
239int sys_ptrace(long request, long pid, long addr, long data)
240{
241 struct task_struct *child;
242 int ret = -EPERM;
243
244 lock_kernel();
245 if (request == PTRACE_TRACEME) {
246 /* are we already being traced? */
247 if (current->ptrace & PT_PTRACED)
248 goto out;
249 ret = security_ptrace(current->parent, current);
250 if (ret)
251 goto out;
252 /* set the ptrace bit in the process flags. */
253 current->ptrace |= PT_PTRACED;
254 ret = 0;
255 goto out;
256 }
257 ret = -ESRCH;
258 read_lock(&tasklist_lock);
259 child = find_task_by_pid(pid);
260 if (child)
261 get_task_struct(child);
262 read_unlock(&tasklist_lock);
263 if (!child)
264 goto out;
265
266 ret = -EPERM;
267 if (pid == 1) /* you may not mess with init */
268 goto out_tsk;
269
270 if (request == PTRACE_ATTACH) {
271 ret = ptrace_attach(child);
272 goto out_tsk;
273 }
274
275 ret = ptrace_check_attach(child, request == PTRACE_KILL);
276 if (ret < 0)
277 goto out_tsk;
278
279 switch (request) {
280 /* when I and D space are separate, these will need to be fixed. */
281 case PTRACE_PEEKTEXT: /* read word at location addr. */
282 case PTRACE_PEEKDATA: {
283 unsigned long tmp;
284 int copied;
285
286 copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0);
287 ret = -EIO;
288 if (copied != sizeof(tmp))
289 break;
290 ret = put_user(tmp,(unsigned long __user *) data);
291 break;
292 }
293
294 /* read the word at location addr in the USER area. */
295 /* XXX this will need fixing for 64-bit */
296 case PTRACE_PEEKUSR: {
297 unsigned long index, tmp;
298
299 ret = -EIO;
300 /* convert to index and check */
301 index = (unsigned long) addr >> 2;
302 if ((addr & 3) || index > PT_FPSCR
303 || child->thread.regs == NULL)
304 break;
305
306 CHECK_FULL_REGS(child->thread.regs);
307 if (index < PT_FPR0) {
308 tmp = get_reg(child, (int) index);
309 } else {
310 preempt_disable();
311 if (child->thread.regs->msr & MSR_FP)
312 giveup_fpu(child);
313 preempt_enable();
314 tmp = ((unsigned long *)child->thread.fpr)[index - PT_FPR0];
315 }
316 ret = put_user(tmp,(unsigned long __user *) data);
317 break;
318 }
319
320 /* If I and D space are separate, this will have to be fixed. */
321 case PTRACE_POKETEXT: /* write the word at location addr. */
322 case PTRACE_POKEDATA:
323 ret = 0;
324 if (access_process_vm(child, addr, &data, sizeof(data), 1) == sizeof(data))
325 break;
326 ret = -EIO;
327 break;
328
329 /* write the word at location addr in the USER area */
330 case PTRACE_POKEUSR: {
331 unsigned long index;
332
333 ret = -EIO;
334 /* convert to index and check */
335 index = (unsigned long) addr >> 2;
336 if ((addr & 3) || index > PT_FPSCR
337 || child->thread.regs == NULL)
338 break;
339
340 CHECK_FULL_REGS(child->thread.regs);
341 if (index == PT_ORIG_R3)
342 break;
343 if (index < PT_FPR0) {
344 ret = put_reg(child, index, data);
345 } else {
346 preempt_disable();
347 if (child->thread.regs->msr & MSR_FP)
348 giveup_fpu(child);
349 preempt_enable();
350 ((unsigned long *)child->thread.fpr)[index - PT_FPR0] = data;
351 ret = 0;
352 }
353 break;
354 }
355
356 case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */
357 case PTRACE_CONT: { /* restart after signal. */
358 ret = -EIO;
359 if ((unsigned long) data > _NSIG)
360 break;
361 if (request == PTRACE_SYSCALL) {
362 set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
363 } else {
364 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
365 }
366 child->exit_code = data;
367 /* make sure the single step bit is not set. */
368 clear_single_step(child);
369 wake_up_process(child);
370 ret = 0;
371 break;
372 }
373
374/*
375 * make the child exit. Best I can do is send it a sigkill.
376 * perhaps it should be put in the status that it wants to
377 * exit.
378 */
379 case PTRACE_KILL: {
380 ret = 0;
381 if (child->exit_state == EXIT_ZOMBIE) /* already dead */
382 break;
383 child->exit_code = SIGKILL;
384 /* make sure the single step bit is not set. */
385 clear_single_step(child);
386 wake_up_process(child);
387 break;
388 }
389
390 case PTRACE_SINGLESTEP: { /* set the trap flag. */
391 ret = -EIO;
392 if ((unsigned long) data > _NSIG)
393 break;
394 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
395 set_single_step(child);
396 child->exit_code = data;
397 /* give it a chance to run. */
398 wake_up_process(child);
399 ret = 0;
400 break;
401 }
402
403 case PTRACE_DETACH:
404 ret = ptrace_detach(child, data);
405 break;
406
407#ifdef CONFIG_ALTIVEC
408 case PTRACE_GETVRREGS:
409 /* Get the child altivec register state. */
410 preempt_disable();
411 if (child->thread.regs->msr & MSR_VEC)
412 giveup_altivec(child);
413 preempt_enable();
414 ret = get_vrregs((unsigned long __user *)data, child);
415 break;
416
417 case PTRACE_SETVRREGS:
418 /* Set the child altivec register state. */
419 /* this is to clear the MSR_VEC bit to force a reload
420 * of register state from memory */
421 preempt_disable();
422 if (child->thread.regs->msr & MSR_VEC)
423 giveup_altivec(child);
424 preempt_enable();
425 ret = set_vrregs(child, (unsigned long __user *)data);
426 break;
427#endif
428#ifdef CONFIG_SPE
429 case PTRACE_GETEVRREGS:
430 /* Get the child spe register state. */
431 if (child->thread.regs->msr & MSR_SPE)
432 giveup_spe(child);
433 ret = get_evrregs((unsigned long __user *)data, child);
434 break;
435
436 case PTRACE_SETEVRREGS:
437 /* Set the child spe register state. */
438 /* this is to clear the MSR_SPE bit to force a reload
439 * of register state from memory */
440 if (child->thread.regs->msr & MSR_SPE)
441 giveup_spe(child);
442 ret = set_evrregs(child, (unsigned long __user *)data);
443 break;
444#endif
445
446 default:
447 ret = ptrace_request(child, request, addr, data);
448 break;
449 }
450out_tsk:
451 put_task_struct(child);
452out:
453 unlock_kernel();
454 return ret;
455}
456
457void do_syscall_trace(void)
458{
459 if (!test_thread_flag(TIF_SYSCALL_TRACE)
460 || !(current->ptrace & PT_PTRACED))
461 return;
462 ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
463 ? 0x80 : 0));
464
465 /*
466 * this isn't the same as continuing with a signal, but it will do
467 * for normal use. strace only continues with a signal if the
468 * stopping signal is not SIGTRAP. -brl
469 */
470 if (current->exit_code) {
471 send_sig(current->exit_code, current, 1);
472 current->exit_code = 0;
473 }
474}
diff --git a/arch/ppc/kernel/semaphore.c b/arch/ppc/kernel/semaphore.c
new file mode 100644
index 000000000000..2fe429b27c14
--- /dev/null
+++ b/arch/ppc/kernel/semaphore.c
@@ -0,0 +1,131 @@
1/*
2 * PowerPC-specific semaphore code.
3 *
4 * Copyright (C) 1999 Cort Dougan <cort@cs.nmt.edu>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 *
11 * April 2001 - Reworked by Paul Mackerras <paulus@samba.org>
12 * to eliminate the SMP races in the old version between the updates
13 * of `count' and `waking'. Now we use negative `count' values to
14 * indicate that some process(es) are waiting for the semaphore.
15 */
16
17#include <linux/sched.h>
18#include <linux/init.h>
19#include <asm/atomic.h>
20#include <asm/semaphore.h>
21#include <asm/errno.h>
22
23/*
24 * Atomically update sem->count.
25 * This does the equivalent of the following:
26 *
27 * old_count = sem->count;
28 * tmp = MAX(old_count, 0) + incr;
29 * sem->count = tmp;
30 * return old_count;
31 */
32static inline int __sem_update_count(struct semaphore *sem, int incr)
33{
34 int old_count, tmp;
35
36 __asm__ __volatile__("\n"
37"1: lwarx %0,0,%3\n"
38" srawi %1,%0,31\n"
39" andc %1,%0,%1\n"
40" add %1,%1,%4\n"
41 PPC405_ERR77(0,%3)
42" stwcx. %1,0,%3\n"
43" bne 1b"
44 : "=&r" (old_count), "=&r" (tmp), "=m" (sem->count)
45 : "r" (&sem->count), "r" (incr), "m" (sem->count)
46 : "cc");
47
48 return old_count;
49}
50
51void __up(struct semaphore *sem)
52{
53 /*
54 * Note that we incremented count in up() before we came here,
55 * but that was ineffective since the result was <= 0, and
56 * any negative value of count is equivalent to 0.
57 * This ends up setting count to 1, unless count is now > 0
58 * (i.e. because some other cpu has called up() in the meantime),
59 * in which case we just increment count.
60 */
61 __sem_update_count(sem, 1);
62 wake_up(&sem->wait);
63}
64
65/*
66 * Note that when we come in to __down or __down_interruptible,
67 * we have already decremented count, but that decrement was
68 * ineffective since the result was < 0, and any negative value
69 * of count is equivalent to 0.
70 * Thus it is only when we decrement count from some value > 0
71 * that we have actually got the semaphore.
72 */
73void __sched __down(struct semaphore *sem)
74{
75 struct task_struct *tsk = current;
76 DECLARE_WAITQUEUE(wait, tsk);
77
78 tsk->state = TASK_UNINTERRUPTIBLE;
79 add_wait_queue_exclusive(&sem->wait, &wait);
80 smp_wmb();
81
82 /*
83 * Try to get the semaphore. If the count is > 0, then we've
84 * got the semaphore; we decrement count and exit the loop.
85 * If the count is 0 or negative, we set it to -1, indicating
86 * that we are asleep, and then sleep.
87 */
88 while (__sem_update_count(sem, -1) <= 0) {
89 schedule();
90 tsk->state = TASK_UNINTERRUPTIBLE;
91 }
92 remove_wait_queue(&sem->wait, &wait);
93 tsk->state = TASK_RUNNING;
94
95 /*
96 * If there are any more sleepers, wake one of them up so
97 * that it can either get the semaphore, or set count to -1
98 * indicating that there are still processes sleeping.
99 */
100 wake_up(&sem->wait);
101}
102
103int __sched __down_interruptible(struct semaphore * sem)
104{
105 int retval = 0;
106 struct task_struct *tsk = current;
107 DECLARE_WAITQUEUE(wait, tsk);
108
109 tsk->state = TASK_INTERRUPTIBLE;
110 add_wait_queue_exclusive(&sem->wait, &wait);
111 smp_wmb();
112
113 while (__sem_update_count(sem, -1) <= 0) {
114 if (signal_pending(current)) {
115 /*
116 * A signal is pending - give up trying.
117 * Set sem->count to 0 if it is negative,
118 * since we are no longer sleeping.
119 */
120 __sem_update_count(sem, 0);
121 retval = -EINTR;
122 break;
123 }
124 schedule();
125 tsk->state = TASK_INTERRUPTIBLE;
126 }
127 tsk->state = TASK_RUNNING;
128 remove_wait_queue(&sem->wait, &wait);
129 wake_up(&sem->wait);
130 return retval;
131}
diff --git a/arch/ppc/kernel/setup.c b/arch/ppc/kernel/setup.c
new file mode 100644
index 000000000000..e97ce635b99e
--- /dev/null
+++ b/arch/ppc/kernel/setup.c
@@ -0,0 +1,778 @@
1/*
2 * Common prep/pmac/chrp boot and setup code.
3 */
4
5#include <linux/config.h>
6#include <linux/module.h>
7#include <linux/string.h>
8#include <linux/sched.h>
9#include <linux/init.h>
10#include <linux/kernel.h>
11#include <linux/reboot.h>
12#include <linux/delay.h>
13#include <linux/initrd.h>
14#include <linux/ide.h>
15#include <linux/tty.h>
16#include <linux/bootmem.h>
17#include <linux/seq_file.h>
18#include <linux/root_dev.h>
19#include <linux/cpu.h>
20#include <linux/console.h>
21
22#include <asm/residual.h>
23#include <asm/io.h>
24#include <asm/prom.h>
25#include <asm/processor.h>
26#include <asm/pgtable.h>
27#include <asm/bootinfo.h>
28#include <asm/setup.h>
29#include <asm/amigappc.h>
30#include <asm/smp.h>
31#include <asm/elf.h>
32#include <asm/cputable.h>
33#include <asm/bootx.h>
34#include <asm/btext.h>
35#include <asm/machdep.h>
36#include <asm/uaccess.h>
37#include <asm/system.h>
38#include <asm/pmac_feature.h>
39#include <asm/sections.h>
40#include <asm/nvram.h>
41#include <asm/xmon.h>
42#include <asm/ocp.h>
43
44#if defined(CONFIG_85xx) || defined(CONFIG_83xx)
45#include <asm/ppc_sys.h>
46#endif
47
48#if defined CONFIG_KGDB
49#include <asm/kgdb.h>
50#endif
51
52extern void platform_init(unsigned long r3, unsigned long r4,
53 unsigned long r5, unsigned long r6, unsigned long r7);
54extern void bootx_init(unsigned long r4, unsigned long phys);
55extern void identify_cpu(unsigned long offset, unsigned long cpu);
56extern void do_cpu_ftr_fixups(unsigned long offset);
57extern void reloc_got2(unsigned long offset);
58
59extern void ppc6xx_idle(void);
60extern void power4_idle(void);
61
62extern boot_infos_t *boot_infos;
63struct ide_machdep_calls ppc_ide_md;
64char *sysmap;
65unsigned long sysmap_size;
66
67/* Used with the BI_MEMSIZE bootinfo parameter to store the memory
68 size value reported by the boot loader. */
69unsigned long boot_mem_size;
70
71unsigned long ISA_DMA_THRESHOLD;
72unsigned long DMA_MODE_READ, DMA_MODE_WRITE;
73
74#ifdef CONFIG_PPC_MULTIPLATFORM
75int _machine = 0;
76
77extern void prep_init(unsigned long r3, unsigned long r4,
78 unsigned long r5, unsigned long r6, unsigned long r7);
79extern void pmac_init(unsigned long r3, unsigned long r4,
80 unsigned long r5, unsigned long r6, unsigned long r7);
81extern void chrp_init(unsigned long r3, unsigned long r4,
82 unsigned long r5, unsigned long r6, unsigned long r7);
83#endif /* CONFIG_PPC_MULTIPLATFORM */
84
85#ifdef CONFIG_MAGIC_SYSRQ
86unsigned long SYSRQ_KEY = 0x54;
87#endif /* CONFIG_MAGIC_SYSRQ */
88
89#ifdef CONFIG_VGA_CONSOLE
90unsigned long vgacon_remap_base;
91#endif
92
93struct machdep_calls ppc_md;
94
95/*
96 * These are used in binfmt_elf.c to put aux entries on the stack
97 * for each elf executable being started.
98 */
99int dcache_bsize;
100int icache_bsize;
101int ucache_bsize;
102
103#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_FB_VGA16) || \
104 defined(CONFIG_FB_VGA16_MODULE) || defined(CONFIG_FB_VESA)
105struct screen_info screen_info = {
106 0, 25, /* orig-x, orig-y */
107 0, /* unused */
108 0, /* orig-video-page */
109 0, /* orig-video-mode */
110 80, /* orig-video-cols */
111 0,0,0, /* ega_ax, ega_bx, ega_cx */
112 25, /* orig-video-lines */
113 1, /* orig-video-isVGA */
114 16 /* orig-video-points */
115};
116#endif /* CONFIG_VGA_CONSOLE || CONFIG_FB_VGA16 || CONFIG_FB_VESA */
117
118void machine_restart(char *cmd)
119{
120#ifdef CONFIG_NVRAM
121 nvram_sync();
122#endif
123 ppc_md.restart(cmd);
124}
125
126EXPORT_SYMBOL(machine_restart);
127
128void machine_power_off(void)
129{
130#ifdef CONFIG_NVRAM
131 nvram_sync();
132#endif
133 ppc_md.power_off();
134}
135
136EXPORT_SYMBOL(machine_power_off);
137
138void machine_halt(void)
139{
140#ifdef CONFIG_NVRAM
141 nvram_sync();
142#endif
143 ppc_md.halt();
144}
145
146EXPORT_SYMBOL(machine_halt);
147
148void (*pm_power_off)(void) = machine_power_off;
149
150#ifdef CONFIG_TAU
151extern u32 cpu_temp(unsigned long cpu);
152extern u32 cpu_temp_both(unsigned long cpu);
153#endif /* CONFIG_TAU */
154
155int show_cpuinfo(struct seq_file *m, void *v)
156{
157 int i = (int) v - 1;
158 int err = 0;
159 unsigned int pvr;
160 unsigned short maj, min;
161 unsigned long lpj;
162
163 if (i >= NR_CPUS) {
164 /* Show summary information */
165#ifdef CONFIG_SMP
166 unsigned long bogosum = 0;
167 for (i = 0; i < NR_CPUS; ++i)
168 if (cpu_online(i))
169 bogosum += cpu_data[i].loops_per_jiffy;
170 seq_printf(m, "total bogomips\t: %lu.%02lu\n",
171 bogosum/(500000/HZ), bogosum/(5000/HZ) % 100);
172#endif /* CONFIG_SMP */
173
174 if (ppc_md.show_cpuinfo != NULL)
175 err = ppc_md.show_cpuinfo(m);
176 return err;
177 }
178
179#ifdef CONFIG_SMP
180 if (!cpu_online(i))
181 return 0;
182 pvr = cpu_data[i].pvr;
183 lpj = cpu_data[i].loops_per_jiffy;
184#else
185 pvr = mfspr(SPRN_PVR);
186 lpj = loops_per_jiffy;
187#endif
188
189 seq_printf(m, "processor\t: %d\n", i);
190 seq_printf(m, "cpu\t\t: ");
191
192 if (cur_cpu_spec[i]->pvr_mask)
193 seq_printf(m, "%s", cur_cpu_spec[i]->cpu_name);
194 else
195 seq_printf(m, "unknown (%08x)", pvr);
196#ifdef CONFIG_ALTIVEC
197 if (cur_cpu_spec[i]->cpu_features & CPU_FTR_ALTIVEC)
198 seq_printf(m, ", altivec supported");
199#endif
200 seq_printf(m, "\n");
201
202#ifdef CONFIG_TAU
203 if (cur_cpu_spec[i]->cpu_features & CPU_FTR_TAU) {
204#ifdef CONFIG_TAU_AVERAGE
205 /* more straightforward, but potentially misleading */
206 seq_printf(m, "temperature \t: %u C (uncalibrated)\n",
207 cpu_temp(i));
208#else
209 /* show the actual temp sensor range */
210 u32 temp;
211 temp = cpu_temp_both(i);
212 seq_printf(m, "temperature \t: %u-%u C (uncalibrated)\n",
213 temp & 0xff, temp >> 16);
214#endif
215 }
216#endif /* CONFIG_TAU */
217
218 if (ppc_md.show_percpuinfo != NULL) {
219 err = ppc_md.show_percpuinfo(m, i);
220 if (err)
221 return err;
222 }
223
224 switch (PVR_VER(pvr)) {
225 case 0x0020: /* 403 family */
226 maj = PVR_MAJ(pvr) + 1;
227 min = PVR_MIN(pvr);
228 break;
229 case 0x1008: /* 740P/750P ?? */
230 maj = ((pvr >> 8) & 0xFF) - 1;
231 min = pvr & 0xFF;
232 break;
233 case 0x8083: /* e300 */
234 maj = PVR_MAJ(pvr);
235 min = PVR_MIN(pvr);
236 break;
237 case 0x8020: /* e500 */
238 maj = PVR_MAJ(pvr);
239 min = PVR_MIN(pvr);
240 break;
241 default:
242 maj = (pvr >> 8) & 0xFF;
243 min = pvr & 0xFF;
244 break;
245 }
246
247 seq_printf(m, "revision\t: %hd.%hd (pvr %04x %04x)\n",
248 maj, min, PVR_VER(pvr), PVR_REV(pvr));
249
250 seq_printf(m, "bogomips\t: %lu.%02lu\n",
251 lpj / (500000/HZ), (lpj / (5000/HZ)) % 100);
252
253#if defined(CONFIG_85xx) || defined(CONFIG_83xx)
254 if (cur_ppc_sys_spec->ppc_sys_name)
255 seq_printf(m, "chipset\t\t: %s\n",
256 cur_ppc_sys_spec->ppc_sys_name);
257#endif
258
259#ifdef CONFIG_SMP
260 seq_printf(m, "\n");
261#endif
262
263 return 0;
264}
265
266static void *c_start(struct seq_file *m, loff_t *pos)
267{
268 int i = *pos;
269
270 return i <= NR_CPUS? (void *) (i + 1): NULL;
271}
272
273static void *c_next(struct seq_file *m, void *v, loff_t *pos)
274{
275 ++*pos;
276 return c_start(m, pos);
277}
278
279static void c_stop(struct seq_file *m, void *v)
280{
281}
282
283struct seq_operations cpuinfo_op = {
284 .start =c_start,
285 .next = c_next,
286 .stop = c_stop,
287 .show = show_cpuinfo,
288};
289
290/*
291 * We're called here very early in the boot. We determine the machine
292 * type and call the appropriate low-level setup functions.
293 * -- Cort <cort@fsmlabs.com>
294 *
295 * Note that the kernel may be running at an address which is different
296 * from the address that it was linked at, so we must use RELOC/PTRRELOC
297 * to access static data (including strings). -- paulus
298 */
299__init
300unsigned long
301early_init(int r3, int r4, int r5)
302{
303 unsigned long phys;
304 unsigned long offset = reloc_offset();
305
306 /* Default */
307 phys = offset + KERNELBASE;
308
309 /* First zero the BSS -- use memset, some arches don't have
310 * caches on yet */
311 memset_io(PTRRELOC(&__bss_start), 0, _end - __bss_start);
312
313 /*
314 * Identify the CPU type and fix up code sections
315 * that depend on which cpu we have.
316 */
317 identify_cpu(offset, 0);
318 do_cpu_ftr_fixups(offset);
319
320#if defined(CONFIG_PPC_MULTIPLATFORM)
321 reloc_got2(offset);
322
323 /* If we came here from BootX, clear the screen,
324 * set up some pointers and return. */
325 if ((r3 == 0x426f6f58) && (r5 == 0))
326 bootx_init(r4, phys);
327
328 /*
329 * don't do anything on prep
330 * for now, don't use bootinfo because it breaks yaboot 0.5
331 * and assume that if we didn't find a magic number, we have OF
332 */
333 else if (*(unsigned long *)(0) != 0xdeadc0de)
334 phys = prom_init(r3, r4, (prom_entry)r5);
335
336 reloc_got2(-offset);
337#endif
338
339 return phys;
340}
341
342#ifdef CONFIG_PPC_OF
343/*
344 * Assume here that all clock rates are the same in a
345 * smp system. -- Cort
346 */
347int __openfirmware
348of_show_percpuinfo(struct seq_file *m, int i)
349{
350 struct device_node *cpu_node;
351 u32 *fp;
352 int s;
353
354 cpu_node = find_type_devices("cpu");
355 if (!cpu_node)
356 return 0;
357 for (s = 0; s < i && cpu_node->next; s++)
358 cpu_node = cpu_node->next;
359 fp = (u32 *)get_property(cpu_node, "clock-frequency", NULL);
360 if (fp)
361 seq_printf(m, "clock\t\t: %dMHz\n", *fp / 1000000);
362 return 0;
363}
364
365void __init
366intuit_machine_type(void)
367{
368 char *model;
369 struct device_node *root;
370
371 /* ask the OF info if we're a chrp or pmac */
372 root = find_path_device("/");
373 if (root != 0) {
374 /* assume pmac unless proven to be chrp -- Cort */
375 _machine = _MACH_Pmac;
376 model = get_property(root, "device_type", NULL);
377 if (model && !strncmp("chrp", model, 4))
378 _machine = _MACH_chrp;
379 else {
380 model = get_property(root, "model", NULL);
381 if (model && !strncmp(model, "IBM", 3))
382 _machine = _MACH_chrp;
383 }
384 }
385}
386#endif
387
388#ifdef CONFIG_PPC_MULTIPLATFORM
389/*
390 * The PPC_MULTIPLATFORM version of platform_init...
391 */
392void __init
393platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
394 unsigned long r6, unsigned long r7)
395{
396#ifdef CONFIG_BOOTX_TEXT
397 if (boot_text_mapped) {
398 btext_clearscreen();
399 btext_welcome();
400 }
401#endif
402
403 parse_bootinfo(find_bootinfo());
404
405 /* if we didn't get any bootinfo telling us what we are... */
406 if (_machine == 0) {
407 /* prep boot loader tells us if we're prep or not */
408 if ( *(unsigned long *)(KERNELBASE) == (0xdeadc0de) )
409 _machine = _MACH_prep;
410 }
411
412 /* not much more to do here, if prep */
413 if (_machine == _MACH_prep) {
414 prep_init(r3, r4, r5, r6, r7);
415 return;
416 }
417
418 /* prom_init has already been called from __start */
419 if (boot_infos)
420 relocate_nodes();
421
422 /* If we aren't PReP, we can find out if we're Pmac
423 * or CHRP with this. */
424 if (_machine == 0)
425 intuit_machine_type();
426
427 /* finish_device_tree may need _machine defined. */
428 finish_device_tree();
429
430 /*
431 * If we were booted via quik, r3 points to the physical
432 * address of the command-line parameters.
433 * If we were booted from an xcoff image (i.e. netbooted or
434 * booted from floppy), we get the command line from the
435 * bootargs property of the /chosen node.
436 * If an initial ramdisk is present, r3 and r4
437 * are used for initrd_start and initrd_size,
438 * otherwise they contain 0xdeadbeef.
439 */
440 if (r3 >= 0x4000 && r3 < 0x800000 && r4 == 0) {
441 strlcpy(cmd_line, (char *)r3 + KERNELBASE,
442 sizeof(cmd_line));
443 } else if (boot_infos != 0) {
444 /* booted by BootX - check for ramdisk */
445 if (boot_infos->kernelParamsOffset != 0)
446 strlcpy(cmd_line, (char *) boot_infos
447 + boot_infos->kernelParamsOffset,
448 sizeof(cmd_line));
449#ifdef CONFIG_BLK_DEV_INITRD
450 if (boot_infos->ramDisk) {
451 initrd_start = (unsigned long) boot_infos
452 + boot_infos->ramDisk;
453 initrd_end = initrd_start + boot_infos->ramDiskSize;
454 initrd_below_start_ok = 1;
455 }
456#endif
457 } else {
458 struct device_node *chosen;
459 char *p;
460
461#ifdef CONFIG_BLK_DEV_INITRD
462 if (r3 && r4 && r4 != 0xdeadbeef) {
463 if (r3 < KERNELBASE)
464 r3 += KERNELBASE;
465 initrd_start = r3;
466 initrd_end = r3 + r4;
467 ROOT_DEV = Root_RAM0;
468 initrd_below_start_ok = 1;
469 }
470#endif
471 chosen = find_devices("chosen");
472 if (chosen != NULL) {
473 p = get_property(chosen, "bootargs", NULL);
474 if (p && *p) {
475 strlcpy(cmd_line, p, sizeof(cmd_line));
476 }
477 }
478 }
479#ifdef CONFIG_ADB
480 if (strstr(cmd_line, "adb_sync")) {
481 extern int __adb_probe_sync;
482 __adb_probe_sync = 1;
483 }
484#endif /* CONFIG_ADB */
485
486 switch (_machine) {
487 case _MACH_Pmac:
488 pmac_init(r3, r4, r5, r6, r7);
489 break;
490 case _MACH_chrp:
491 chrp_init(r3, r4, r5, r6, r7);
492 break;
493 }
494}
495
496#ifdef CONFIG_SERIAL_CORE_CONSOLE
497extern char *of_stdout_device;
498
499static int __init set_preferred_console(void)
500{
501 struct device_node *prom_stdout;
502 char *name;
503 int offset;
504
505 if (of_stdout_device == NULL)
506 return -ENODEV;
507
508 /* The user has requested a console so this is already set up. */
509 if (strstr(saved_command_line, "console="))
510 return -EBUSY;
511
512 prom_stdout = find_path_device(of_stdout_device);
513 if (!prom_stdout)
514 return -ENODEV;
515
516 name = (char *)get_property(prom_stdout, "name", NULL);
517 if (!name)
518 return -ENODEV;
519
520 if (strcmp(name, "serial") == 0) {
521 int i;
522 u32 *reg = (u32 *)get_property(prom_stdout, "reg", &i);
523 if (i > 8) {
524 switch (reg[1]) {
525 case 0x3f8:
526 offset = 0;
527 break;
528 case 0x2f8:
529 offset = 1;
530 break;
531 case 0x898:
532 offset = 2;
533 break;
534 case 0x890:
535 offset = 3;
536 break;
537 default:
538 /* We dont recognise the serial port */
539 return -ENODEV;
540 }
541 }
542 } else if (strcmp(name, "ch-a") == 0)
543 offset = 0;
544 else if (strcmp(name, "ch-b") == 0)
545 offset = 1;
546 else
547 return -ENODEV;
548 return add_preferred_console("ttyS", offset, NULL);
549}
550console_initcall(set_preferred_console);
551#endif /* CONFIG_SERIAL_CORE_CONSOLE */
552#endif /* CONFIG_PPC_MULTIPLATFORM */
553
554struct bi_record *find_bootinfo(void)
555{
556 struct bi_record *rec;
557
558 rec = (struct bi_record *)_ALIGN((ulong)__bss_start+(1<<20)-1,(1<<20));
559 if ( rec->tag != BI_FIRST ) {
560 /*
561 * This 0x10000 offset is a terrible hack but it will go away when
562 * we have the bootloader handle all the relocation and
563 * prom calls -- Cort
564 */
565 rec = (struct bi_record *)_ALIGN((ulong)__bss_start+0x10000+(1<<20)-1,(1<<20));
566 if ( rec->tag != BI_FIRST )
567 return NULL;
568 }
569 return rec;
570}
571
572void parse_bootinfo(struct bi_record *rec)
573{
574 if (rec == NULL || rec->tag != BI_FIRST)
575 return;
576 while (rec->tag != BI_LAST) {
577 ulong *data = rec->data;
578 switch (rec->tag) {
579 case BI_CMD_LINE:
580 strlcpy(cmd_line, (void *)data, sizeof(cmd_line));
581 break;
582 case BI_SYSMAP:
583 sysmap = (char *)((data[0] >= (KERNELBASE)) ? data[0] :
584 (data[0]+KERNELBASE));
585 sysmap_size = data[1];
586 break;
587#ifdef CONFIG_BLK_DEV_INITRD
588 case BI_INITRD:
589 initrd_start = data[0] + KERNELBASE;
590 initrd_end = data[0] + data[1] + KERNELBASE;
591 break;
592#endif /* CONFIG_BLK_DEV_INITRD */
593#ifdef CONFIG_PPC_MULTIPLATFORM
594 case BI_MACHTYPE:
595 _machine = data[0];
596 break;
597#endif
598 case BI_MEMSIZE:
599 boot_mem_size = data[0];
600 break;
601 }
602 rec = (struct bi_record *)((ulong)rec + rec->size);
603 }
604}
605
606/*
607 * Find out what kind of machine we're on and save any data we need
608 * from the early boot process (devtree is copied on pmac by prom_init()).
609 * This is called very early on the boot process, after a minimal
610 * MMU environment has been set up but before MMU_init is called.
611 */
612void __init
613machine_init(unsigned long r3, unsigned long r4, unsigned long r5,
614 unsigned long r6, unsigned long r7)
615{
616#ifdef CONFIG_CMDLINE
617 strlcpy(cmd_line, CONFIG_CMDLINE, sizeof(cmd_line));
618#endif /* CONFIG_CMDLINE */
619
620#ifdef CONFIG_6xx
621 ppc_md.power_save = ppc6xx_idle;
622#endif
623#ifdef CONFIG_POWER4
624 ppc_md.power_save = power4_idle;
625#endif
626
627 platform_init(r3, r4, r5, r6, r7);
628
629 if (ppc_md.progress)
630 ppc_md.progress("id mach(): done", 0x200);
631}
632
633/* Checks "l2cr=xxxx" command-line option */
634int __init ppc_setup_l2cr(char *str)
635{
636 if (cpu_has_feature(CPU_FTR_L2CR)) {
637 unsigned long val = simple_strtoul(str, NULL, 0);
638 printk(KERN_INFO "l2cr set to %lx\n", val);
639 _set_L2CR(0); /* force invalidate by disable cache */
640 _set_L2CR(val); /* and enable it */
641 }
642 return 1;
643}
644__setup("l2cr=", ppc_setup_l2cr);
645
646#ifdef CONFIG_GENERIC_NVRAM
647
648/* Generic nvram hooks used by drivers/char/gen_nvram.c */
649unsigned char nvram_read_byte(int addr)
650{
651 if (ppc_md.nvram_read_val)
652 return ppc_md.nvram_read_val(addr);
653 return 0xff;
654}
655EXPORT_SYMBOL(nvram_read_byte);
656
657void nvram_write_byte(unsigned char val, int addr)
658{
659 if (ppc_md.nvram_write_val)
660 ppc_md.nvram_write_val(addr, val);
661}
662EXPORT_SYMBOL(nvram_write_byte);
663
664void nvram_sync(void)
665{
666 if (ppc_md.nvram_sync)
667 ppc_md.nvram_sync();
668}
669EXPORT_SYMBOL(nvram_sync);
670
671#endif /* CONFIG_NVRAM */
672
673static struct cpu cpu_devices[NR_CPUS];
674
675int __init ppc_init(void)
676{
677 int i;
678
679 /* clear the progress line */
680 if ( ppc_md.progress ) ppc_md.progress(" ", 0xffff);
681
682 /* register CPU devices */
683 for (i = 0; i < NR_CPUS; i++)
684 if (cpu_possible(i))
685 register_cpu(&cpu_devices[i], i, NULL);
686
687 /* call platform init */
688 if (ppc_md.init != NULL) {
689 ppc_md.init();
690 }
691 return 0;
692}
693
694arch_initcall(ppc_init);
695
696/* Warning, IO base is not yet inited */
697void __init setup_arch(char **cmdline_p)
698{
699 extern char *klimit;
700 extern void do_init_bootmem(void);
701
702 /* so udelay does something sensible, assume <= 1000 bogomips */
703 loops_per_jiffy = 500000000 / HZ;
704
705#ifdef CONFIG_PPC_MULTIPLATFORM
706 /* This could be called "early setup arch", it must be done
707 * now because xmon need it
708 */
709 if (_machine == _MACH_Pmac)
710 pmac_feature_init(); /* New cool way */
711#endif
712
713#ifdef CONFIG_XMON
714 xmon_map_scc();
715 if (strstr(cmd_line, "xmon"))
716 xmon(NULL);
717#endif /* CONFIG_XMON */
718 if ( ppc_md.progress ) ppc_md.progress("setup_arch: enter", 0x3eab);
719
720#if defined(CONFIG_KGDB)
721 if (ppc_md.kgdb_map_scc)
722 ppc_md.kgdb_map_scc();
723 set_debug_traps();
724 if (strstr(cmd_line, "gdb")) {
725 if (ppc_md.progress)
726 ppc_md.progress("setup_arch: kgdb breakpoint", 0x4000);
727 printk("kgdb breakpoint activated\n");
728 breakpoint();
729 }
730#endif
731
732 /*
733 * Set cache line size based on type of cpu as a default.
734 * Systems with OF can look in the properties on the cpu node(s)
735 * for a possibly more accurate value.
736 */
737 if (cpu_has_feature(CPU_FTR_SPLIT_ID_CACHE)) {
738 dcache_bsize = cur_cpu_spec[0]->dcache_bsize;
739 icache_bsize = cur_cpu_spec[0]->icache_bsize;
740 ucache_bsize = 0;
741 } else
742 ucache_bsize = dcache_bsize = icache_bsize
743 = cur_cpu_spec[0]->dcache_bsize;
744
745 /* reboot on panic */
746 panic_timeout = 180;
747
748 init_mm.start_code = PAGE_OFFSET;
749 init_mm.end_code = (unsigned long) _etext;
750 init_mm.end_data = (unsigned long) _edata;
751 init_mm.brk = (unsigned long) klimit;
752
753 /* Save unparsed command line copy for /proc/cmdline */
754 strlcpy(saved_command_line, cmd_line, COMMAND_LINE_SIZE);
755 *cmdline_p = cmd_line;
756
757 /* set up the bootmem stuff with available memory */
758 do_init_bootmem();
759 if ( ppc_md.progress ) ppc_md.progress("setup_arch: bootmem", 0x3eab);
760
761#ifdef CONFIG_PPC_OCP
762 /* Initialize OCP device list */
763 ocp_early_init();
764 if ( ppc_md.progress ) ppc_md.progress("ocp: exit", 0x3eab);
765#endif
766
767#ifdef CONFIG_DUMMY_CONSOLE
768 conswitchp = &dummy_con;
769#endif
770
771 ppc_md.setup_arch();
772 if ( ppc_md.progress ) ppc_md.progress("arch: exit", 0x3eab);
773
774 paging_init();
775
776 /* this is for modules since _machine can be a define -- Cort */
777 ppc_md.ppc_machine = _machine;
778}
diff --git a/arch/ppc/kernel/signal.c b/arch/ppc/kernel/signal.c
new file mode 100644
index 000000000000..9567d3041ea7
--- /dev/null
+++ b/arch/ppc/kernel/signal.c
@@ -0,0 +1,775 @@
1/*
2 * arch/ppc/kernel/signal.c
3 *
4 * PowerPC version
5 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
6 *
7 * Derived from "arch/i386/kernel/signal.c"
8 * Copyright (C) 1991, 1992 Linus Torvalds
9 * 1997-11-28 Modified for POSIX.1b signals by Richard Henderson
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version
14 * 2 of the License, or (at your option) any later version.
15 */
16
17#include <linux/sched.h>
18#include <linux/mm.h>
19#include <linux/smp.h>
20#include <linux/smp_lock.h>
21#include <linux/kernel.h>
22#include <linux/signal.h>
23#include <linux/errno.h>
24#include <linux/wait.h>
25#include <linux/ptrace.h>
26#include <linux/unistd.h>
27#include <linux/stddef.h>
28#include <linux/elf.h>
29#include <linux/tty.h>
30#include <linux/binfmts.h>
31#include <linux/suspend.h>
32#include <asm/ucontext.h>
33#include <asm/uaccess.h>
34#include <asm/pgtable.h>
35#include <asm/cacheflush.h>
36
37#undef DEBUG_SIG
38
39#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
40
41extern void sigreturn_exit(struct pt_regs *);
42
43#define GP_REGS_SIZE min(sizeof(elf_gregset_t), sizeof(struct pt_regs))
44
45int do_signal(sigset_t *oldset, struct pt_regs *regs);
46
47/*
48 * Atomically swap in the new signal mask, and wait for a signal.
49 */
50int
51sys_sigsuspend(old_sigset_t mask, int p2, int p3, int p4, int p6, int p7,
52 struct pt_regs *regs)
53{
54 sigset_t saveset;
55
56 mask &= _BLOCKABLE;
57 spin_lock_irq(&current->sighand->siglock);
58 saveset = current->blocked;
59 siginitset(&current->blocked, mask);
60 recalc_sigpending();
61 spin_unlock_irq(&current->sighand->siglock);
62
63 regs->result = -EINTR;
64 regs->gpr[3] = EINTR;
65 regs->ccr |= 0x10000000;
66 while (1) {
67 current->state = TASK_INTERRUPTIBLE;
68 schedule();
69 if (do_signal(&saveset, regs))
70 sigreturn_exit(regs);
71 }
72}
73
74int
75sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize, int p3, int p4,
76 int p6, int p7, struct pt_regs *regs)
77{
78 sigset_t saveset, newset;
79
80 /* XXX: Don't preclude handling different sized sigset_t's. */
81 if (sigsetsize != sizeof(sigset_t))
82 return -EINVAL;
83
84 if (copy_from_user(&newset, unewset, sizeof(newset)))
85 return -EFAULT;
86 sigdelsetmask(&newset, ~_BLOCKABLE);
87
88 spin_lock_irq(&current->sighand->siglock);
89 saveset = current->blocked;
90 current->blocked = newset;
91 recalc_sigpending();
92 spin_unlock_irq(&current->sighand->siglock);
93
94 regs->result = -EINTR;
95 regs->gpr[3] = EINTR;
96 regs->ccr |= 0x10000000;
97 while (1) {
98 current->state = TASK_INTERRUPTIBLE;
99 schedule();
100 if (do_signal(&saveset, regs))
101 sigreturn_exit(regs);
102 }
103}
104
105
106int
107sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, int r5,
108 int r6, int r7, int r8, struct pt_regs *regs)
109{
110 return do_sigaltstack(uss, uoss, regs->gpr[1]);
111}
112
113int
114sys_sigaction(int sig, const struct old_sigaction __user *act,
115 struct old_sigaction __user *oact)
116{
117 struct k_sigaction new_ka, old_ka;
118 int ret;
119
120 if (act) {
121 old_sigset_t mask;
122 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
123 __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
124 __get_user(new_ka.sa.sa_restorer, &act->sa_restorer))
125 return -EFAULT;
126 __get_user(new_ka.sa.sa_flags, &act->sa_flags);
127 __get_user(mask, &act->sa_mask);
128 siginitset(&new_ka.sa.sa_mask, mask);
129 }
130
131 ret = do_sigaction(sig, (act? &new_ka: NULL), (oact? &old_ka: NULL));
132
133 if (!ret && oact) {
134 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
135 __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
136 __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer))
137 return -EFAULT;
138 __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
139 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask);
140 }
141
142 return ret;
143}
144
145/*
146 * When we have signals to deliver, we set up on the
147 * user stack, going down from the original stack pointer:
148 * a sigregs struct
149 * a sigcontext struct
150 * a gap of __SIGNAL_FRAMESIZE bytes
151 *
152 * Each of these things must be a multiple of 16 bytes in size.
153 *
154 */
155struct sigregs {
156 struct mcontext mctx; /* all the register values */
157 /* Programs using the rs6000/xcoff abi can save up to 19 gp regs
158 and 18 fp regs below sp before decrementing it. */
159 int abigap[56];
160};
161
162/* We use the mc_pad field for the signal return trampoline. */
163#define tramp mc_pad
164
165/*
166 * When we have rt signals to deliver, we set up on the
167 * user stack, going down from the original stack pointer:
168 * one rt_sigframe struct (siginfo + ucontext + ABI gap)
169 * a gap of __SIGNAL_FRAMESIZE+16 bytes
170 * (the +16 is to get the siginfo and ucontext in the same
171 * positions as in older kernels).
172 *
173 * Each of these things must be a multiple of 16 bytes in size.
174 *
175 */
176struct rt_sigframe
177{
178 struct siginfo info;
179 struct ucontext uc;
180 /* Programs using the rs6000/xcoff abi can save up to 19 gp regs
181 and 18 fp regs below sp before decrementing it. */
182 int abigap[56];
183};
184
185/*
186 * Save the current user registers on the user stack.
187 * We only save the altivec/spe registers if the process has used
188 * altivec/spe instructions at some point.
189 */
190static int
191save_user_regs(struct pt_regs *regs, struct mcontext __user *frame, int sigret)
192{
193 /* save general and floating-point registers */
194 CHECK_FULL_REGS(regs);
195 preempt_disable();
196 if (regs->msr & MSR_FP)
197 giveup_fpu(current);
198#ifdef CONFIG_ALTIVEC
199 if (current->thread.used_vr && (regs->msr & MSR_VEC))
200 giveup_altivec(current);
201#endif /* CONFIG_ALTIVEC */
202#ifdef CONFIG_SPE
203 if (current->thread.used_spe && (regs->msr & MSR_SPE))
204 giveup_spe(current);
205#endif /* CONFIG_ALTIVEC */
206 preempt_enable();
207
208 if (__copy_to_user(&frame->mc_gregs, regs, GP_REGS_SIZE)
209 || __copy_to_user(&frame->mc_fregs, current->thread.fpr,
210 ELF_NFPREG * sizeof(double)))
211 return 1;
212
213 current->thread.fpscr = 0; /* turn off all fp exceptions */
214
215#ifdef CONFIG_ALTIVEC
216 /* save altivec registers */
217 if (current->thread.used_vr) {
218 if (__copy_to_user(&frame->mc_vregs, current->thread.vr,
219 ELF_NVRREG * sizeof(vector128)))
220 return 1;
221 /* set MSR_VEC in the saved MSR value to indicate that
222 frame->mc_vregs contains valid data */
223 if (__put_user(regs->msr | MSR_VEC, &frame->mc_gregs[PT_MSR]))
224 return 1;
225 }
226 /* else assert((regs->msr & MSR_VEC) == 0) */
227
228 /* We always copy to/from vrsave, it's 0 if we don't have or don't
229 * use altivec. Since VSCR only contains 32 bits saved in the least
230 * significant bits of a vector, we "cheat" and stuff VRSAVE in the
231 * most significant bits of that same vector. --BenH
232 */
233 if (__put_user(current->thread.vrsave, (u32 __user *)&frame->mc_vregs[32]))
234 return 1;
235#endif /* CONFIG_ALTIVEC */
236
237#ifdef CONFIG_SPE
238 /* save spe registers */
239 if (current->thread.used_spe) {
240 if (__copy_to_user(&frame->mc_vregs, current->thread.evr,
241 ELF_NEVRREG * sizeof(u32)))
242 return 1;
243 /* set MSR_SPE in the saved MSR value to indicate that
244 frame->mc_vregs contains valid data */
245 if (__put_user(regs->msr | MSR_SPE, &frame->mc_gregs[PT_MSR]))
246 return 1;
247 }
248 /* else assert((regs->msr & MSR_SPE) == 0) */
249
250 /* We always copy to/from spefscr */
251 if (__put_user(current->thread.spefscr, (u32 *)&frame->mc_vregs + ELF_NEVRREG))
252 return 1;
253#endif /* CONFIG_SPE */
254
255 if (sigret) {
256 /* Set up the sigreturn trampoline: li r0,sigret; sc */
257 if (__put_user(0x38000000UL + sigret, &frame->tramp[0])
258 || __put_user(0x44000002UL, &frame->tramp[1]))
259 return 1;
260 flush_icache_range((unsigned long) &frame->tramp[0],
261 (unsigned long) &frame->tramp[2]);
262 }
263
264 return 0;
265}
266
267/*
268 * Restore the current user register values from the user stack,
269 * (except for MSR).
270 */
271static int
272restore_user_regs(struct pt_regs *regs, struct mcontext __user *sr, int sig)
273{
274 unsigned long save_r2 = 0;
275#if defined(CONFIG_ALTIVEC) || defined(CONFIG_SPE)
276 unsigned long msr;
277#endif
278
279 /* backup/restore the TLS as we don't want it to be modified */
280 if (!sig)
281 save_r2 = regs->gpr[2];
282 /* copy up to but not including MSR */
283 if (__copy_from_user(regs, &sr->mc_gregs, PT_MSR * sizeof(elf_greg_t)))
284 return 1;
285 /* copy from orig_r3 (the word after the MSR) up to the end */
286 if (__copy_from_user(&regs->orig_gpr3, &sr->mc_gregs[PT_ORIG_R3],
287 GP_REGS_SIZE - PT_ORIG_R3 * sizeof(elf_greg_t)))
288 return 1;
289 if (!sig)
290 regs->gpr[2] = save_r2;
291
292 /* force the process to reload the FP registers from
293 current->thread when it next does FP instructions */
294 regs->msr &= ~(MSR_FP | MSR_FE0 | MSR_FE1);
295 if (__copy_from_user(current->thread.fpr, &sr->mc_fregs,
296 sizeof(sr->mc_fregs)))
297 return 1;
298
299#ifdef CONFIG_ALTIVEC
300 /* force the process to reload the altivec registers from
301 current->thread when it next does altivec instructions */
302 regs->msr &= ~MSR_VEC;
303 if (!__get_user(msr, &sr->mc_gregs[PT_MSR]) && (msr & MSR_VEC) != 0) {
304 /* restore altivec registers from the stack */
305 if (__copy_from_user(current->thread.vr, &sr->mc_vregs,
306 sizeof(sr->mc_vregs)))
307 return 1;
308 } else if (current->thread.used_vr)
309 memset(&current->thread.vr, 0, ELF_NVRREG * sizeof(vector128));
310
311 /* Always get VRSAVE back */
312 if (__get_user(current->thread.vrsave, (u32 __user *)&sr->mc_vregs[32]))
313 return 1;
314#endif /* CONFIG_ALTIVEC */
315
316#ifdef CONFIG_SPE
317 /* force the process to reload the spe registers from
318 current->thread when it next does spe instructions */
319 regs->msr &= ~MSR_SPE;
320 if (!__get_user(msr, &sr->mc_gregs[PT_MSR]) && (msr & MSR_SPE) != 0) {
321 /* restore spe registers from the stack */
322 if (__copy_from_user(current->thread.evr, &sr->mc_vregs,
323 ELF_NEVRREG * sizeof(u32)))
324 return 1;
325 } else if (current->thread.used_spe)
326 memset(&current->thread.evr, 0, ELF_NEVRREG * sizeof(u32));
327
328 /* Always get SPEFSCR back */
329 if (__get_user(current->thread.spefscr, (u32 *)&sr->mc_vregs + ELF_NEVRREG))
330 return 1;
331#endif /* CONFIG_SPE */
332
333#ifndef CONFIG_SMP
334 preempt_disable();
335 if (last_task_used_math == current)
336 last_task_used_math = NULL;
337 if (last_task_used_altivec == current)
338 last_task_used_altivec = NULL;
339 if (last_task_used_spe == current)
340 last_task_used_spe = NULL;
341 preempt_enable();
342#endif
343 return 0;
344}
345
346/*
347 * Restore the user process's signal mask
348 */
349static void
350restore_sigmask(sigset_t *set)
351{
352 sigdelsetmask(set, ~_BLOCKABLE);
353 spin_lock_irq(&current->sighand->siglock);
354 current->blocked = *set;
355 recalc_sigpending();
356 spin_unlock_irq(&current->sighand->siglock);
357}
358
359/*
360 * Set up a signal frame for a "real-time" signal handler
361 * (one which gets siginfo).
362 */
363static void
364handle_rt_signal(unsigned long sig, struct k_sigaction *ka,
365 siginfo_t *info, sigset_t *oldset, struct pt_regs * regs,
366 unsigned long newsp)
367{
368 struct rt_sigframe __user *rt_sf;
369 struct mcontext __user *frame;
370 unsigned long origsp = newsp;
371
372 /* Set up Signal Frame */
373 /* Put a Real Time Context onto stack */
374 newsp -= sizeof(*rt_sf);
375 rt_sf = (struct rt_sigframe __user *) newsp;
376
377 /* create a stack frame for the caller of the handler */
378 newsp -= __SIGNAL_FRAMESIZE + 16;
379
380 if (!access_ok(VERIFY_WRITE, (void __user *) newsp, origsp - newsp))
381 goto badframe;
382
383 /* Put the siginfo & fill in most of the ucontext */
384 if (copy_siginfo_to_user(&rt_sf->info, info)
385 || __put_user(0, &rt_sf->uc.uc_flags)
386 || __put_user(0, &rt_sf->uc.uc_link)
387 || __put_user(current->sas_ss_sp, &rt_sf->uc.uc_stack.ss_sp)
388 || __put_user(sas_ss_flags(regs->gpr[1]),
389 &rt_sf->uc.uc_stack.ss_flags)
390 || __put_user(current->sas_ss_size, &rt_sf->uc.uc_stack.ss_size)
391 || __put_user(&rt_sf->uc.uc_mcontext, &rt_sf->uc.uc_regs)
392 || __copy_to_user(&rt_sf->uc.uc_sigmask, oldset, sizeof(*oldset)))
393 goto badframe;
394
395 /* Save user registers on the stack */
396 frame = &rt_sf->uc.uc_mcontext;
397 if (save_user_regs(regs, frame, __NR_rt_sigreturn))
398 goto badframe;
399
400 if (put_user(regs->gpr[1], (unsigned long __user *)newsp))
401 goto badframe;
402 regs->gpr[1] = newsp;
403 regs->gpr[3] = sig;
404 regs->gpr[4] = (unsigned long) &rt_sf->info;
405 regs->gpr[5] = (unsigned long) &rt_sf->uc;
406 regs->gpr[6] = (unsigned long) rt_sf;
407 regs->nip = (unsigned long) ka->sa.sa_handler;
408 regs->link = (unsigned long) frame->tramp;
409 regs->trap = 0;
410
411 return;
412
413badframe:
414#ifdef DEBUG_SIG
415 printk("badframe in handle_rt_signal, regs=%p frame=%p newsp=%lx\n",
416 regs, frame, newsp);
417#endif
418 force_sigsegv(sig, current);
419}
420
421static int do_setcontext(struct ucontext __user *ucp, struct pt_regs *regs, int sig)
422{
423 sigset_t set;
424 struct mcontext __user *mcp;
425
426 if (__copy_from_user(&set, &ucp->uc_sigmask, sizeof(set))
427 || __get_user(mcp, &ucp->uc_regs))
428 return -EFAULT;
429 restore_sigmask(&set);
430 if (restore_user_regs(regs, mcp, sig))
431 return -EFAULT;
432
433 return 0;
434}
435
436int sys_swapcontext(struct ucontext __user *old_ctx,
437 struct ucontext __user *new_ctx,
438 int ctx_size, int r6, int r7, int r8, struct pt_regs *regs)
439{
440 unsigned char tmp;
441
442 /* Context size is for future use. Right now, we only make sure
443 * we are passed something we understand
444 */
445 if (ctx_size < sizeof(struct ucontext))
446 return -EINVAL;
447
448 if (old_ctx != NULL) {
449 if (!access_ok(VERIFY_WRITE, old_ctx, sizeof(*old_ctx))
450 || save_user_regs(regs, &old_ctx->uc_mcontext, 0)
451 || __copy_to_user(&old_ctx->uc_sigmask,
452 &current->blocked, sizeof(sigset_t))
453 || __put_user(&old_ctx->uc_mcontext, &old_ctx->uc_regs))
454 return -EFAULT;
455 }
456 if (new_ctx == NULL)
457 return 0;
458 if (!access_ok(VERIFY_READ, new_ctx, sizeof(*new_ctx))
459 || __get_user(tmp, (u8 __user *) new_ctx)
460 || __get_user(tmp, (u8 __user *) (new_ctx + 1) - 1))
461 return -EFAULT;
462
463 /*
464 * If we get a fault copying the context into the kernel's
465 * image of the user's registers, we can't just return -EFAULT
466 * because the user's registers will be corrupted. For instance
467 * the NIP value may have been updated but not some of the
468 * other registers. Given that we have done the access_ok
469 * and successfully read the first and last bytes of the region
470 * above, this should only happen in an out-of-memory situation
471 * or if another thread unmaps the region containing the context.
472 * We kill the task with a SIGSEGV in this situation.
473 */
474 if (do_setcontext(new_ctx, regs, 0))
475 do_exit(SIGSEGV);
476 sigreturn_exit(regs);
477 /* doesn't actually return back to here */
478 return 0;
479}
480
481int sys_rt_sigreturn(int r3, int r4, int r5, int r6, int r7, int r8,
482 struct pt_regs *regs)
483{
484 struct rt_sigframe __user *rt_sf;
485
486 /* Always make any pending restarted system calls return -EINTR */
487 current_thread_info()->restart_block.fn = do_no_restart_syscall;
488
489 rt_sf = (struct rt_sigframe __user *)
490 (regs->gpr[1] + __SIGNAL_FRAMESIZE + 16);
491 if (!access_ok(VERIFY_READ, rt_sf, sizeof(struct rt_sigframe)))
492 goto bad;
493 if (do_setcontext(&rt_sf->uc, regs, 1))
494 goto bad;
495
496 /*
497 * It's not clear whether or why it is desirable to save the
498 * sigaltstack setting on signal delivery and restore it on
499 * signal return. But other architectures do this and we have
500 * always done it up until now so it is probably better not to
501 * change it. -- paulus
502 */
503 do_sigaltstack(&rt_sf->uc.uc_stack, NULL, regs->gpr[1]);
504
505 sigreturn_exit(regs); /* doesn't return here */
506 return 0;
507
508 bad:
509 force_sig(SIGSEGV, current);
510 return 0;
511}
512
513int sys_debug_setcontext(struct ucontext __user *ctx,
514 int ndbg, struct sig_dbg_op *dbg,
515 int r6, int r7, int r8,
516 struct pt_regs *regs)
517{
518 struct sig_dbg_op op;
519 int i;
520 unsigned long new_msr = regs->msr;
521#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
522 unsigned long new_dbcr0 = current->thread.dbcr0;
523#endif
524
525 for (i=0; i<ndbg; i++) {
526 if (__copy_from_user(&op, dbg, sizeof(op)))
527 return -EFAULT;
528 switch (op.dbg_type) {
529 case SIG_DBG_SINGLE_STEPPING:
530#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
531 if (op.dbg_value) {
532 new_msr |= MSR_DE;
533 new_dbcr0 |= (DBCR0_IDM | DBCR0_IC);
534 } else {
535 new_msr &= ~MSR_DE;
536 new_dbcr0 &= ~(DBCR0_IDM | DBCR0_IC);
537 }
538#else
539 if (op.dbg_value)
540 new_msr |= MSR_SE;
541 else
542 new_msr &= ~MSR_SE;
543#endif
544 break;
545 case SIG_DBG_BRANCH_TRACING:
546#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
547 return -EINVAL;
548#else
549 if (op.dbg_value)
550 new_msr |= MSR_BE;
551 else
552 new_msr &= ~MSR_BE;
553#endif
554 break;
555
556 default:
557 return -EINVAL;
558 }
559 }
560
561 /* We wait until here to actually install the values in the
562 registers so if we fail in the above loop, it will not
563 affect the contents of these registers. After this point,
564 failure is a problem, anyway, and it's very unlikely unless
565 the user is really doing something wrong. */
566 regs->msr = new_msr;
567#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
568 current->thread.dbcr0 = new_dbcr0;
569#endif
570
571 /*
572 * If we get a fault copying the context into the kernel's
573 * image of the user's registers, we can't just return -EFAULT
574 * because the user's registers will be corrupted. For instance
575 * the NIP value may have been updated but not some of the
576 * other registers. Given that we have done the access_ok
577 * and successfully read the first and last bytes of the region
578 * above, this should only happen in an out-of-memory situation
579 * or if another thread unmaps the region containing the context.
580 * We kill the task with a SIGSEGV in this situation.
581 */
582 if (do_setcontext(ctx, regs, 1)) {
583 force_sig(SIGSEGV, current);
584 goto out;
585 }
586
587 /*
588 * It's not clear whether or why it is desirable to save the
589 * sigaltstack setting on signal delivery and restore it on
590 * signal return. But other architectures do this and we have
591 * always done it up until now so it is probably better not to
592 * change it. -- paulus
593 */
594 do_sigaltstack(&ctx->uc_stack, NULL, regs->gpr[1]);
595
596 sigreturn_exit(regs);
597 /* doesn't actually return back to here */
598
599 out:
600 return 0;
601}
602
603/*
604 * OK, we're invoking a handler
605 */
606static void
607handle_signal(unsigned long sig, struct k_sigaction *ka,
608 siginfo_t *info, sigset_t *oldset, struct pt_regs * regs,
609 unsigned long newsp)
610{
611 struct sigcontext __user *sc;
612 struct sigregs __user *frame;
613 unsigned long origsp = newsp;
614
615 /* Set up Signal Frame */
616 newsp -= sizeof(struct sigregs);
617 frame = (struct sigregs __user *) newsp;
618
619 /* Put a sigcontext on the stack */
620 newsp -= sizeof(*sc);
621 sc = (struct sigcontext __user *) newsp;
622
623 /* create a stack frame for the caller of the handler */
624 newsp -= __SIGNAL_FRAMESIZE;
625
626 if (!access_ok(VERIFY_WRITE, (void __user *) newsp, origsp - newsp))
627 goto badframe;
628
629#if _NSIG != 64
630#error "Please adjust handle_signal()"
631#endif
632 if (__put_user((unsigned long) ka->sa.sa_handler, &sc->handler)
633 || __put_user(oldset->sig[0], &sc->oldmask)
634 || __put_user(oldset->sig[1], &sc->_unused[3])
635 || __put_user((struct pt_regs *)frame, &sc->regs)
636 || __put_user(sig, &sc->signal))
637 goto badframe;
638
639 if (save_user_regs(regs, &frame->mctx, __NR_sigreturn))
640 goto badframe;
641
642 if (put_user(regs->gpr[1], (unsigned long __user *)newsp))
643 goto badframe;
644 regs->gpr[1] = newsp;
645 regs->gpr[3] = sig;
646 regs->gpr[4] = (unsigned long) sc;
647 regs->nip = (unsigned long) ka->sa.sa_handler;
648 regs->link = (unsigned long) frame->mctx.tramp;
649 regs->trap = 0;
650
651 return;
652
653badframe:
654#ifdef DEBUG_SIG
655 printk("badframe in handle_signal, regs=%p frame=%p newsp=%lx\n",
656 regs, frame, newsp);
657#endif
658 force_sigsegv(sig, current);
659}
660
661/*
662 * Do a signal return; undo the signal stack.
663 */
664int sys_sigreturn(int r3, int r4, int r5, int r6, int r7, int r8,
665 struct pt_regs *regs)
666{
667 struct sigcontext __user *sc;
668 struct sigcontext sigctx;
669 struct mcontext __user *sr;
670 sigset_t set;
671
672 /* Always make any pending restarted system calls return -EINTR */
673 current_thread_info()->restart_block.fn = do_no_restart_syscall;
674
675 sc = (struct sigcontext __user *)(regs->gpr[1] + __SIGNAL_FRAMESIZE);
676 if (copy_from_user(&sigctx, sc, sizeof(sigctx)))
677 goto badframe;
678
679 set.sig[0] = sigctx.oldmask;
680 set.sig[1] = sigctx._unused[3];
681 restore_sigmask(&set);
682
683 sr = (struct mcontext __user *) sigctx.regs;
684 if (!access_ok(VERIFY_READ, sr, sizeof(*sr))
685 || restore_user_regs(regs, sr, 1))
686 goto badframe;
687
688 sigreturn_exit(regs); /* doesn't return */
689 return 0;
690
691badframe:
692 force_sig(SIGSEGV, current);
693 return 0;
694}
695
696/*
697 * Note that 'init' is a special process: it doesn't get signals it doesn't
698 * want to handle. Thus you cannot kill init even with a SIGKILL even by
699 * mistake.
700 */
701int do_signal(sigset_t *oldset, struct pt_regs *regs)
702{
703 siginfo_t info;
704 struct k_sigaction ka;
705 unsigned long frame, newsp;
706 int signr, ret;
707
708 if (current->flags & PF_FREEZE) {
709 refrigerator(PF_FREEZE);
710 signr = 0;
711 ret = regs->gpr[3];
712 if (!signal_pending(current))
713 goto no_signal;
714 }
715
716 if (!oldset)
717 oldset = &current->blocked;
718
719 newsp = frame = 0;
720
721 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
722
723 if (TRAP(regs) == 0x0C00 /* System Call! */
724 && regs->ccr & 0x10000000 /* error signalled */
725 && ((ret = regs->gpr[3]) == ERESTARTSYS
726 || ret == ERESTARTNOHAND || ret == ERESTARTNOINTR
727 || ret == ERESTART_RESTARTBLOCK)) {
728
729 if (signr > 0
730 && (ret == ERESTARTNOHAND || ret == ERESTART_RESTARTBLOCK
731 || (ret == ERESTARTSYS
732 && !(ka.sa.sa_flags & SA_RESTART)))) {
733 /* make the system call return an EINTR error */
734 regs->result = -EINTR;
735 regs->gpr[3] = EINTR;
736 /* note that the cr0.SO bit is already set */
737 } else {
738no_signal:
739 regs->nip -= 4; /* Back up & retry system call */
740 regs->result = 0;
741 regs->trap = 0;
742 if (ret == ERESTART_RESTARTBLOCK)
743 regs->gpr[0] = __NR_restart_syscall;
744 else
745 regs->gpr[3] = regs->orig_gpr3;
746 }
747 }
748
749 if (signr == 0)
750 return 0; /* no signals delivered */
751
752 if ((ka.sa.sa_flags & SA_ONSTACK) && current->sas_ss_size
753 && !on_sig_stack(regs->gpr[1]))
754 newsp = current->sas_ss_sp + current->sas_ss_size;
755 else
756 newsp = regs->gpr[1];
757 newsp &= ~0xfUL;
758
759 /* Whee! Actually deliver the signal. */
760 if (ka.sa.sa_flags & SA_SIGINFO)
761 handle_rt_signal(signr, &ka, &info, oldset, regs, newsp);
762 else
763 handle_signal(signr, &ka, &info, oldset, regs, newsp);
764
765 if (!(ka.sa.sa_flags & SA_NODEFER)) {
766 spin_lock_irq(&current->sighand->siglock);
767 sigorsets(&current->blocked,&current->blocked,&ka.sa.sa_mask);
768 sigaddset(&current->blocked, signr);
769 recalc_sigpending();
770 spin_unlock_irq(&current->sighand->siglock);
771 }
772
773 return 1;
774}
775
diff --git a/arch/ppc/kernel/smp-tbsync.c b/arch/ppc/kernel/smp-tbsync.c
new file mode 100644
index 000000000000..2c9cd95bcea6
--- /dev/null
+++ b/arch/ppc/kernel/smp-tbsync.c
@@ -0,0 +1,181 @@
1/*
2 * Smp timebase synchronization for ppc.
3 *
4 * Copyright (C) 2003 Samuel Rydh (samuel@ibrium.se)
5 *
6 */
7
8#include <linux/config.h>
9#include <linux/kernel.h>
10#include <linux/sched.h>
11#include <linux/smp.h>
12#include <linux/unistd.h>
13#include <linux/init.h>
14#include <asm/atomic.h>
15#include <asm/smp.h>
16#include <asm/time.h>
17
18#define NUM_ITER 300
19
20enum {
21 kExit=0, kSetAndTest, kTest
22};
23
24static struct {
25 volatile int tbu;
26 volatile int tbl;
27 volatile int mark;
28 volatile int cmd;
29 volatile int handshake;
30 int filler[3];
31
32 volatile int ack;
33 int filler2[7];
34
35 volatile int race_result;
36} *tbsync;
37
38static volatile int running;
39
40static void __devinit
41enter_contest( int mark, int add )
42{
43 while( (int)(get_tbl() - mark) < 0 )
44 tbsync->race_result = add;
45}
46
47void __devinit
48smp_generic_take_timebase( void )
49{
50 int cmd, tbl, tbu;
51
52 local_irq_disable();
53 while( !running )
54 ;
55 rmb();
56
57 for( ;; ) {
58 tbsync->ack = 1;
59 while( !tbsync->handshake )
60 ;
61 rmb();
62
63 cmd = tbsync->cmd;
64 tbl = tbsync->tbl;
65 tbu = tbsync->tbu;
66 tbsync->ack = 0;
67 if( cmd == kExit )
68 return;
69
70 if( cmd == kSetAndTest ) {
71 while( tbsync->handshake )
72 ;
73 asm volatile ("mttbl %0" :: "r" (tbl) );
74 asm volatile ("mttbu %0" :: "r" (tbu) );
75 } else {
76 while( tbsync->handshake )
77 ;
78 }
79 enter_contest( tbsync->mark, -1 );
80 }
81 local_irq_enable();
82}
83
84static int __devinit
85start_contest( int cmd, int offset, int num )
86{
87 int i, tbu, tbl, mark, score=0;
88
89 tbsync->cmd = cmd;
90
91 local_irq_disable();
92 for( i=-3; i<num; ) {
93 tbl = get_tbl() + 400;
94 tbsync->tbu = tbu = get_tbu();
95 tbsync->tbl = tbl + offset;
96 tbsync->mark = mark = tbl + 400;
97
98 wmb();
99
100 tbsync->handshake = 1;
101 while( tbsync->ack )
102 ;
103
104 while( (int)(get_tbl() - tbl) <= 0 )
105 ;
106 tbsync->handshake = 0;
107 enter_contest( mark, 1 );
108
109 while( !tbsync->ack )
110 ;
111
112 if( tbsync->tbu != get_tbu() || ((tbsync->tbl ^ get_tbl()) & 0x80000000) )
113 continue;
114 if( i++ > 0 )
115 score += tbsync->race_result;
116 }
117 local_irq_enable();
118 return score;
119}
120
121void __devinit
122smp_generic_give_timebase( void )
123{
124 int i, score, score2, old, min=0, max=5000, offset=1000;
125
126 printk("Synchronizing timebase\n");
127
128 /* if this fails then this kernel won't work anyway... */
129 tbsync = kmalloc( sizeof(*tbsync), GFP_KERNEL );
130 memset( tbsync, 0, sizeof(*tbsync) );
131 mb();
132 running = 1;
133
134 while( !tbsync->ack )
135 ;
136
137 /* binary search */
138 for( old=-1 ; old != offset ; offset=(min+max)/2 ) {
139 score = start_contest( kSetAndTest, offset, NUM_ITER );
140
141 printk("score %d, offset %d\n", score, offset );
142
143 if( score > 0 )
144 max = offset;
145 else
146 min = offset;
147 old = offset;
148 }
149 score = start_contest( kSetAndTest, min, NUM_ITER );
150 score2 = start_contest( kSetAndTest, max, NUM_ITER );
151
152 printk( "Min %d (score %d), Max %d (score %d)\n", min, score, max, score2 );
153 score = abs( score );
154 score2 = abs( score2 );
155 offset = (score < score2) ? min : max;
156
157 /* guard against inaccurate mttb */
158 for( i=0; i<10; i++ ) {
159 start_contest( kSetAndTest, offset, NUM_ITER/10 );
160
161 if( (score2=start_contest(kTest, offset, NUM_ITER)) < 0 )
162 score2 = -score2;
163 if( score2 <= score || score2 < 20 )
164 break;
165 }
166 printk("Final offset: %d (%d/%d)\n", offset, score2, NUM_ITER );
167
168 /* exiting */
169 tbsync->cmd = kExit;
170 wmb();
171 tbsync->handshake = 1;
172 while( tbsync->ack )
173 ;
174 tbsync->handshake = 0;
175 kfree( tbsync );
176 tbsync = NULL;
177 running = 0;
178
179 /* all done */
180 smp_tb_synchronized = 1;
181}
diff --git a/arch/ppc/kernel/smp.c b/arch/ppc/kernel/smp.c
new file mode 100644
index 000000000000..e70b587b9e51
--- /dev/null
+++ b/arch/ppc/kernel/smp.c
@@ -0,0 +1,399 @@
1/*
2 * Smp support for ppc.
3 *
4 * Written by Cort Dougan (cort@cs.nmt.edu) borrowing a great
5 * deal of code from the sparc and intel versions.
6 *
7 * Copyright (C) 1999 Cort Dougan <cort@cs.nmt.edu>
8 *
9 */
10
11#include <linux/config.h>
12#include <linux/kernel.h>
13#include <linux/module.h>
14#include <linux/sched.h>
15#include <linux/smp.h>
16#include <linux/smp_lock.h>
17#include <linux/interrupt.h>
18#include <linux/kernel_stat.h>
19#include <linux/delay.h>
20#include <linux/init.h>
21#include <linux/spinlock.h>
22#include <linux/cache.h>
23
24#include <asm/ptrace.h>
25#include <asm/atomic.h>
26#include <asm/irq.h>
27#include <asm/page.h>
28#include <asm/pgtable.h>
29#include <asm/io.h>
30#include <asm/prom.h>
31#include <asm/smp.h>
32#include <asm/residual.h>
33#include <asm/time.h>
34#include <asm/thread_info.h>
35#include <asm/tlbflush.h>
36#include <asm/xmon.h>
37
38volatile int smp_commenced;
39int smp_tb_synchronized;
40struct cpuinfo_PPC cpu_data[NR_CPUS];
41struct klock_info_struct klock_info = { KLOCK_CLEAR, 0 };
42atomic_t ipi_recv;
43atomic_t ipi_sent;
44cpumask_t cpu_online_map;
45cpumask_t cpu_possible_map;
46int smp_hw_index[NR_CPUS];
47struct thread_info *secondary_ti;
48
49EXPORT_SYMBOL(cpu_online_map);
50EXPORT_SYMBOL(cpu_possible_map);
51
52/* SMP operations for this machine */
53static struct smp_ops_t *smp_ops;
54
55/* all cpu mappings are 1-1 -- Cort */
56volatile unsigned long cpu_callin_map[NR_CPUS];
57
58int start_secondary(void *);
59void smp_call_function_interrupt(void);
60static int __smp_call_function(void (*func) (void *info), void *info,
61 int wait, int target);
62
63/* Low level assembly function used to backup CPU 0 state */
64extern void __save_cpu_setup(void);
65
66/* Since OpenPIC has only 4 IPIs, we use slightly different message numbers.
67 *
68 * Make sure this matches openpic_request_IPIs in open_pic.c, or what shows up
69 * in /proc/interrupts will be wrong!!! --Troy */
70#define PPC_MSG_CALL_FUNCTION 0
71#define PPC_MSG_RESCHEDULE 1
72#define PPC_MSG_INVALIDATE_TLB 2
73#define PPC_MSG_XMON_BREAK 3
74
75static inline void
76smp_message_pass(int target, int msg, unsigned long data, int wait)
77{
78 if (smp_ops){
79 atomic_inc(&ipi_sent);
80 smp_ops->message_pass(target,msg,data,wait);
81 }
82}
83
84/*
85 * Common functions
86 */
87void smp_message_recv(int msg, struct pt_regs *regs)
88{
89 atomic_inc(&ipi_recv);
90
91 switch( msg ) {
92 case PPC_MSG_CALL_FUNCTION:
93 smp_call_function_interrupt();
94 break;
95 case PPC_MSG_RESCHEDULE:
96 set_need_resched();
97 break;
98 case PPC_MSG_INVALIDATE_TLB:
99 _tlbia();
100 break;
101#ifdef CONFIG_XMON
102 case PPC_MSG_XMON_BREAK:
103 xmon(regs);
104 break;
105#endif /* CONFIG_XMON */
106 default:
107 printk("SMP %d: smp_message_recv(): unknown msg %d\n",
108 smp_processor_id(), msg);
109 break;
110 }
111}
112
113/*
114 * 750's don't broadcast tlb invalidates so
115 * we have to emulate that behavior.
116 * -- Cort
117 */
118void smp_send_tlb_invalidate(int cpu)
119{
120 if ( PVR_VER(mfspr(SPRN_PVR)) == 8 )
121 smp_message_pass(MSG_ALL_BUT_SELF, PPC_MSG_INVALIDATE_TLB, 0, 0);
122}
123
124void smp_send_reschedule(int cpu)
125{
126 /*
127 * This is only used if `cpu' is running an idle task,
128 * so it will reschedule itself anyway...
129 *
130 * This isn't the case anymore since the other CPU could be
131 * sleeping and won't reschedule until the next interrupt (such
132 * as the timer).
133 * -- Cort
134 */
135 /* This is only used if `cpu' is running an idle task,
136 so it will reschedule itself anyway... */
137 smp_message_pass(cpu, PPC_MSG_RESCHEDULE, 0, 0);
138}
139
140#ifdef CONFIG_XMON
141void smp_send_xmon_break(int cpu)
142{
143 smp_message_pass(cpu, PPC_MSG_XMON_BREAK, 0, 0);
144}
145#endif /* CONFIG_XMON */
146
147static void stop_this_cpu(void *dummy)
148{
149 local_irq_disable();
150 while (1)
151 ;
152}
153
154void smp_send_stop(void)
155{
156 smp_call_function(stop_this_cpu, NULL, 1, 0);
157}
158
159/*
160 * Structure and data for smp_call_function(). This is designed to minimise
161 * static memory requirements. It also looks cleaner.
162 * Stolen from the i386 version.
163 */
164static DEFINE_SPINLOCK(call_lock);
165
166static struct call_data_struct {
167 void (*func) (void *info);
168 void *info;
169 atomic_t started;
170 atomic_t finished;
171 int wait;
172} *call_data;
173
174/*
175 * this function sends a 'generic call function' IPI to all other CPUs
176 * in the system.
177 */
178
179int smp_call_function(void (*func) (void *info), void *info, int nonatomic,
180 int wait)
181/*
182 * [SUMMARY] Run a function on all other CPUs.
183 * <func> The function to run. This must be fast and non-blocking.
184 * <info> An arbitrary pointer to pass to the function.
185 * <nonatomic> currently unused.
186 * <wait> If true, wait (atomically) until function has completed on other CPUs.
187 * [RETURNS] 0 on success, else a negative status code. Does not return until
188 * remote CPUs are nearly ready to execute <<func>> or are or have executed.
189 *
190 * You must not call this function with disabled interrupts or from a
191 * hardware interrupt handler or from a bottom half handler.
192 */
193{
194 /* FIXME: get cpu lock with hotplug cpus, or change this to
195 bitmask. --RR */
196 if (num_online_cpus() <= 1)
197 return 0;
198 /* Can deadlock when called with interrupts disabled */
199 WARN_ON(irqs_disabled());
200 return __smp_call_function(func, info, wait, MSG_ALL_BUT_SELF);
201}
202
203static int __smp_call_function(void (*func) (void *info), void *info,
204 int wait, int target)
205{
206 struct call_data_struct data;
207 int ret = -1;
208 int timeout;
209 int ncpus = 1;
210
211 if (target == MSG_ALL_BUT_SELF)
212 ncpus = num_online_cpus() - 1;
213 else if (target == MSG_ALL)
214 ncpus = num_online_cpus();
215
216 data.func = func;
217 data.info = info;
218 atomic_set(&data.started, 0);
219 data.wait = wait;
220 if (wait)
221 atomic_set(&data.finished, 0);
222
223 spin_lock(&call_lock);
224 call_data = &data;
225 /* Send a message to all other CPUs and wait for them to respond */
226 smp_message_pass(target, PPC_MSG_CALL_FUNCTION, 0, 0);
227
228 /* Wait for response */
229 timeout = 1000000;
230 while (atomic_read(&data.started) != ncpus) {
231 if (--timeout == 0) {
232 printk("smp_call_function on cpu %d: other cpus not responding (%d)\n",
233 smp_processor_id(), atomic_read(&data.started));
234 goto out;
235 }
236 barrier();
237 udelay(1);
238 }
239
240 if (wait) {
241 timeout = 1000000;
242 while (atomic_read(&data.finished) != ncpus) {
243 if (--timeout == 0) {
244 printk("smp_call_function on cpu %d: other cpus not finishing (%d/%d)\n",
245 smp_processor_id(), atomic_read(&data.finished), atomic_read(&data.started));
246 goto out;
247 }
248 barrier();
249 udelay(1);
250 }
251 }
252 ret = 0;
253
254 out:
255 spin_unlock(&call_lock);
256 return ret;
257}
258
259void smp_call_function_interrupt(void)
260{
261 void (*func) (void *info) = call_data->func;
262 void *info = call_data->info;
263 int wait = call_data->wait;
264
265 /*
266 * Notify initiating CPU that I've grabbed the data and am
267 * about to execute the function
268 */
269 atomic_inc(&call_data->started);
270 /*
271 * At this point the info structure may be out of scope unless wait==1
272 */
273 (*func)(info);
274 if (wait)
275 atomic_inc(&call_data->finished);
276}
277
278static void __devinit smp_store_cpu_info(int id)
279{
280 struct cpuinfo_PPC *c = &cpu_data[id];
281
282 /* assume bogomips are same for everything */
283 c->loops_per_jiffy = loops_per_jiffy;
284 c->pvr = mfspr(SPRN_PVR);
285}
286
287void __init smp_prepare_cpus(unsigned int max_cpus)
288{
289 int num_cpus, i;
290
291 /* Fixup boot cpu */
292 smp_store_cpu_info(smp_processor_id());
293 cpu_callin_map[smp_processor_id()] = 1;
294
295 smp_ops = ppc_md.smp_ops;
296 if (smp_ops == NULL) {
297 printk("SMP not supported on this machine.\n");
298 return;
299 }
300
301 /* Probe platform for CPUs: always linear. */
302 num_cpus = smp_ops->probe();
303 for (i = 0; i < num_cpus; ++i)
304 cpu_set(i, cpu_possible_map);
305
306 /* Backup CPU 0 state */
307 __save_cpu_setup();
308
309 if (smp_ops->space_timers)
310 smp_ops->space_timers(num_cpus);
311}
312
313void __devinit smp_prepare_boot_cpu(void)
314{
315 cpu_set(smp_processor_id(), cpu_online_map);
316 cpu_set(smp_processor_id(), cpu_possible_map);
317}
318
319int __init setup_profiling_timer(unsigned int multiplier)
320{
321 return 0;
322}
323
324/* Processor coming up starts here */
325int __devinit start_secondary(void *unused)
326{
327 int cpu;
328
329 atomic_inc(&init_mm.mm_count);
330 current->active_mm = &init_mm;
331
332 cpu = smp_processor_id();
333 smp_store_cpu_info(cpu);
334 set_dec(tb_ticks_per_jiffy);
335 cpu_callin_map[cpu] = 1;
336
337 printk("CPU %i done callin...\n", cpu);
338 smp_ops->setup_cpu(cpu);
339 printk("CPU %i done setup...\n", cpu);
340 local_irq_enable();
341 smp_ops->take_timebase();
342 printk("CPU %i done timebase take...\n", cpu);
343
344 cpu_idle();
345 return 0;
346}
347
348int __cpu_up(unsigned int cpu)
349{
350 struct task_struct *p;
351 char buf[32];
352 int c;
353
354 /* create a process for the processor */
355 /* only regs.msr is actually used, and 0 is OK for it */
356 p = fork_idle(cpu);
357 if (IS_ERR(p))
358 panic("failed fork for CPU %u: %li", cpu, PTR_ERR(p));
359 secondary_ti = p->thread_info;
360 p->thread_info->cpu = cpu;
361
362 /*
363 * There was a cache flush loop here to flush the cache
364 * to memory for the first 8MB of RAM. The cache flush
365 * has been pushed into the kick_cpu function for those
366 * platforms that need it.
367 */
368
369 /* wake up cpu */
370 smp_ops->kick_cpu(cpu);
371
372 /*
373 * wait to see if the cpu made a callin (is actually up).
374 * use this value that I found through experimentation.
375 * -- Cort
376 */
377 for (c = 1000; c && !cpu_callin_map[cpu]; c--)
378 udelay(100);
379
380 if (!cpu_callin_map[cpu]) {
381 sprintf(buf, "didn't find cpu %u", cpu);
382 if (ppc_md.progress) ppc_md.progress(buf, 0x360+cpu);
383 printk("Processor %u is stuck.\n", cpu);
384 return -ENOENT;
385 }
386
387 sprintf(buf, "found cpu %u", cpu);
388 if (ppc_md.progress) ppc_md.progress(buf, 0x350+cpu);
389 printk("Processor %d found.\n", cpu);
390
391 smp_ops->give_timebase();
392 cpu_set(cpu, cpu_online_map);
393 return 0;
394}
395
396void smp_cpus_done(unsigned int max_cpus)
397{
398 smp_ops->setup_cpu(0);
399}
diff --git a/arch/ppc/kernel/softemu8xx.c b/arch/ppc/kernel/softemu8xx.c
new file mode 100644
index 000000000000..9bbb6bf7b645
--- /dev/null
+++ b/arch/ppc/kernel/softemu8xx.c
@@ -0,0 +1,147 @@
1/*
2 * Software emulation of some PPC instructions for the 8xx core.
3 *
4 * Copyright (C) 1998 Dan Malek (dmalek@jlc.net)
5 *
6 * Software floating emuation for the MPC8xx processor. I did this mostly
7 * because it was easier than trying to get the libraries compiled for
8 * software floating point. The goal is still to get the libraries done,
9 * but I lost patience and needed some hacks to at least get init and
10 * shells running. The first problem is the setjmp/longjmp that save
11 * and restore the floating point registers.
12 *
13 * For this emulation, our working registers are found on the register
14 * save area.
15 */
16
17#include <linux/errno.h>
18#include <linux/sched.h>
19#include <linux/kernel.h>
20#include <linux/mm.h>
21#include <linux/stddef.h>
22#include <linux/unistd.h>
23#include <linux/ptrace.h>
24#include <linux/slab.h>
25#include <linux/user.h>
26#include <linux/a.out.h>
27#include <linux/interrupt.h>
28
29#include <asm/pgtable.h>
30#include <asm/uaccess.h>
31#include <asm/system.h>
32#include <asm/io.h>
33
34extern void
35print_8xx_pte(struct mm_struct *mm, unsigned long addr);
36extern int
37get_8xx_pte(struct mm_struct *mm, unsigned long addr);
38
39/* Eventually we may need a look-up table, but this works for now.
40*/
41#define LFS 48
42#define LFD 50
43#define LFDU 51
44#define STFD 54
45#define STFDU 55
46#define FMR 63
47
48/*
49 * We return 0 on success, 1 on unimplemented instruction, and EFAULT
50 * if a load/store faulted.
51 */
52int
53Soft_emulate_8xx(struct pt_regs *regs)
54{
55 uint inst, instword;
56 uint flreg, idxreg, disp;
57 uint retval;
58 signed short sdisp;
59 uint *ea, *ip;
60
61 retval = 0;
62
63 instword = *((uint *)regs->nip);
64 inst = instword >> 26;
65
66 flreg = (instword >> 21) & 0x1f;
67 idxreg = (instword >> 16) & 0x1f;
68 disp = instword & 0xffff;
69
70 ea = (uint *)(regs->gpr[idxreg] + disp);
71 ip = (uint *)&current->thread.fpr[flreg];
72
73 switch ( inst )
74 {
75 case LFD:
76 /* this is a 16 bit quantity that is sign extended
77 * so use a signed short here -- Cort
78 */
79 sdisp = (instword & 0xffff);
80 ea = (uint *)(regs->gpr[idxreg] + sdisp);
81 if (copy_from_user(ip, ea, sizeof(double)))
82 retval = -EFAULT;
83 break;
84
85 case LFDU:
86 if (copy_from_user(ip, ea, sizeof(double)))
87 retval = -EFAULT;
88 else
89 regs->gpr[idxreg] = (uint)ea;
90 break;
91 case LFS:
92 sdisp = (instword & 0xffff);
93 ea = (uint *)(regs->gpr[idxreg] + sdisp);
94 if (copy_from_user(ip, ea, sizeof(float)))
95 retval = -EFAULT;
96 break;
97 case STFD:
98 /* this is a 16 bit quantity that is sign extended
99 * so use a signed short here -- Cort
100 */
101 sdisp = (instword & 0xffff);
102 ea = (uint *)(regs->gpr[idxreg] + sdisp);
103 if (copy_to_user(ea, ip, sizeof(double)))
104 retval = -EFAULT;
105 break;
106
107 case STFDU:
108 if (copy_to_user(ea, ip, sizeof(double)))
109 retval = -EFAULT;
110 else
111 regs->gpr[idxreg] = (uint)ea;
112 break;
113 case FMR:
114 /* assume this is a fp move -- Cort */
115 memcpy( ip, &current->thread.fpr[(instword>>11)&0x1f],
116 sizeof(double) );
117 break;
118 default:
119 retval = 1;
120 printk("Bad emulation %s/%d\n"
121 " NIP: %08lx instruction: %08x opcode: %x "
122 "A: %x B: %x C: %x code: %x rc: %x\n",
123 current->comm,current->pid,
124 regs->nip,
125 instword,inst,
126 (instword>>16)&0x1f,
127 (instword>>11)&0x1f,
128 (instword>>6)&0x1f,
129 (instword>>1)&0x3ff,
130 instword&1);
131 {
132 int pa;
133 print_8xx_pte(current->mm,regs->nip);
134 pa = get_8xx_pte(current->mm,regs->nip) & PAGE_MASK;
135 pa |= (regs->nip & ~PAGE_MASK);
136 pa = (unsigned long)__va(pa);
137 printk("Kernel VA for NIP %x ", pa);
138 print_8xx_pte(current->mm,pa);
139 }
140
141 }
142
143 if (retval == 0)
144 regs->nip += 4;
145 return(retval);
146}
147
diff --git a/arch/ppc/kernel/swsusp.S b/arch/ppc/kernel/swsusp.S
new file mode 100644
index 000000000000..55148bb88d39
--- /dev/null
+++ b/arch/ppc/kernel/swsusp.S
@@ -0,0 +1,349 @@
1#include <linux/config.h>
2#include <linux/threads.h>
3#include <asm/processor.h>
4#include <asm/page.h>
5#include <asm/cputable.h>
6#include <asm/thread_info.h>
7#include <asm/ppc_asm.h>
8#include <asm/offsets.h>
9
10
11/*
12 * Structure for storing CPU registers on the save area.
13 */
14#define SL_SP 0
15#define SL_PC 4
16#define SL_MSR 8
17#define SL_SDR1 0xc
18#define SL_SPRG0 0x10 /* 4 sprg's */
19#define SL_DBAT0 0x20
20#define SL_IBAT0 0x28
21#define SL_DBAT1 0x30
22#define SL_IBAT1 0x38
23#define SL_DBAT2 0x40
24#define SL_IBAT2 0x48
25#define SL_DBAT3 0x50
26#define SL_IBAT3 0x58
27#define SL_TB 0x60
28#define SL_R2 0x68
29#define SL_CR 0x6c
30#define SL_LR 0x70
31#define SL_R12 0x74 /* r12 to r31 */
32#define SL_SIZE (SL_R12 + 80)
33
34 .section .data
35 .align 5
36
37_GLOBAL(swsusp_save_area)
38 .space SL_SIZE
39
40
41 .section .text
42 .align 5
43
44_GLOBAL(swsusp_arch_suspend)
45
46 lis r11,swsusp_save_area@h
47 ori r11,r11,swsusp_save_area@l
48
49 mflr r0
50 stw r0,SL_LR(r11)
51 mfcr r0
52 stw r0,SL_CR(r11)
53 stw r1,SL_SP(r11)
54 stw r2,SL_R2(r11)
55 stmw r12,SL_R12(r11)
56
57 /* Save MSR & SDR1 */
58 mfmsr r4
59 stw r4,SL_MSR(r11)
60 mfsdr1 r4
61 stw r4,SL_SDR1(r11)
62
63 /* Get a stable timebase and save it */
641: mftbu r4
65 stw r4,SL_TB(r11)
66 mftb r5
67 stw r5,SL_TB+4(r11)
68 mftbu r3
69 cmpw r3,r4
70 bne 1b
71
72 /* Save SPRGs */
73 mfsprg r4,0
74 stw r4,SL_SPRG0(r11)
75 mfsprg r4,1
76 stw r4,SL_SPRG0+4(r11)
77 mfsprg r4,2
78 stw r4,SL_SPRG0+8(r11)
79 mfsprg r4,3
80 stw r4,SL_SPRG0+12(r11)
81
82 /* Save BATs */
83 mfdbatu r4,0
84 stw r4,SL_DBAT0(r11)
85 mfdbatl r4,0
86 stw r4,SL_DBAT0+4(r11)
87 mfdbatu r4,1
88 stw r4,SL_DBAT1(r11)
89 mfdbatl r4,1
90 stw r4,SL_DBAT1+4(r11)
91 mfdbatu r4,2
92 stw r4,SL_DBAT2(r11)
93 mfdbatl r4,2
94 stw r4,SL_DBAT2+4(r11)
95 mfdbatu r4,3
96 stw r4,SL_DBAT3(r11)
97 mfdbatl r4,3
98 stw r4,SL_DBAT3+4(r11)
99 mfibatu r4,0
100 stw r4,SL_IBAT0(r11)
101 mfibatl r4,0
102 stw r4,SL_IBAT0+4(r11)
103 mfibatu r4,1
104 stw r4,SL_IBAT1(r11)
105 mfibatl r4,1
106 stw r4,SL_IBAT1+4(r11)
107 mfibatu r4,2
108 stw r4,SL_IBAT2(r11)
109 mfibatl r4,2
110 stw r4,SL_IBAT2+4(r11)
111 mfibatu r4,3
112 stw r4,SL_IBAT3(r11)
113 mfibatl r4,3
114 stw r4,SL_IBAT3+4(r11)
115
116#if 0
117 /* Backup various CPU config stuffs */
118 bl __save_cpu_setup
119#endif
120 /* Call the low level suspend stuff (we should probably have made
121 * a stackframe...
122 */
123 bl swsusp_save
124
125 /* Restore LR from the save area */
126 lis r11,swsusp_save_area@h
127 ori r11,r11,swsusp_save_area@l
128 lwz r0,SL_LR(r11)
129 mtlr r0
130
131 blr
132
133
134/* Resume code */
135_GLOBAL(swsusp_arch_resume)
136
137 /* Stop pending alitvec streams and memory accesses */
138BEGIN_FTR_SECTION
139 DSSALL
140END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
141 sync
142
143 /* Disable MSR:DR to make sure we don't take a TLB or
144 * hash miss during the copy, as our hash table will
145 * for a while be unuseable. For .text, we assume we are
146 * covered by a BAT. This works only for non-G5 at this
147 * point. G5 will need a better approach, possibly using
148 * a small temporary hash table filled with large mappings,
149 * disabling the MMU completely isn't a good option for
150 * performance reasons.
151 * (Note that 750's may have the same performance issue as
152 * the G5 in this case, we should investigate using moving
153 * BATs for these CPUs)
154 */
155 mfmsr r0
156 sync
157 rlwinm r0,r0,0,28,26 /* clear MSR_DR */
158 mtmsr r0
159 sync
160 isync
161
162 /* Load ptr the list of pages to copy in r3 */
163 lis r11,(pagedir_nosave - KERNELBASE)@h
164 ori r11,r11,pagedir_nosave@l
165 lwz r10,0(r11)
166
167 /* Copy the pages. This is a very basic implementation, to
168 * be replaced by something more cache efficient */
1691:
170 tophys(r3,r10)
171 li r0,256
172 mtctr r0
173 lwz r11,pbe_address(r3) /* source */
174 tophys(r5,r11)
175 lwz r10,pbe_orig_address(r3) /* destination */
176 tophys(r6,r10)
1772:
178 lwz r8,0(r5)
179 lwz r9,4(r5)
180 lwz r10,8(r5)
181 lwz r11,12(r5)
182 addi r5,r5,16
183 stw r8,0(r6)
184 stw r9,4(r6)
185 stw r10,8(r6)
186 stw r11,12(r6)
187 addi r6,r6,16
188 bdnz 2b
189 lwz r10,pbe_next(r3)
190 cmpwi 0,r10,0
191 bne 1b
192
193 /* Do a very simple cache flush/inval of the L1 to ensure
194 * coherency of the icache
195 */
196 lis r3,0x0002
197 mtctr r3
198 li r3, 0
1991:
200 lwz r0,0(r3)
201 addi r3,r3,0x0020
202 bdnz 1b
203 isync
204 sync
205
206 /* Now flush those cache lines */
207 lis r3,0x0002
208 mtctr r3
209 li r3, 0
2101:
211 dcbf 0,r3
212 addi r3,r3,0x0020
213 bdnz 1b
214 sync
215
216 /* Ok, we are now running with the kernel data of the old
217 * kernel fully restored. We can get to the save area
218 * easily now. As for the rest of the code, it assumes the
219 * loader kernel and the booted one are exactly identical
220 */
221 lis r11,swsusp_save_area@h
222 ori r11,r11,swsusp_save_area@l
223 tophys(r11,r11)
224
225#if 0
226 /* Restore various CPU config stuffs */
227 bl __restore_cpu_setup
228#endif
229 /* Restore the BATs, and SDR1. Then we can turn on the MMU.
230 * This is a bit hairy as we are running out of those BATs,
231 * but first, our code is probably in the icache, and we are
232 * writing the same value to the BAT, so that should be fine,
233 * though a better solution will have to be found long-term
234 */
235 lwz r4,SL_SDR1(r11)
236 mtsdr1 r4
237 lwz r4,SL_SPRG0(r11)
238 mtsprg 0,r4
239 lwz r4,SL_SPRG0+4(r11)
240 mtsprg 1,r4
241 lwz r4,SL_SPRG0+8(r11)
242 mtsprg 2,r4
243 lwz r4,SL_SPRG0+12(r11)
244 mtsprg 3,r4
245
246#if 0
247 lwz r4,SL_DBAT0(r11)
248 mtdbatu 0,r4
249 lwz r4,SL_DBAT0+4(r11)
250 mtdbatl 0,r4
251 lwz r4,SL_DBAT1(r11)
252 mtdbatu 1,r4
253 lwz r4,SL_DBAT1+4(r11)
254 mtdbatl 1,r4
255 lwz r4,SL_DBAT2(r11)
256 mtdbatu 2,r4
257 lwz r4,SL_DBAT2+4(r11)
258 mtdbatl 2,r4
259 lwz r4,SL_DBAT3(r11)
260 mtdbatu 3,r4
261 lwz r4,SL_DBAT3+4(r11)
262 mtdbatl 3,r4
263 lwz r4,SL_IBAT0(r11)
264 mtibatu 0,r4
265 lwz r4,SL_IBAT0+4(r11)
266 mtibatl 0,r4
267 lwz r4,SL_IBAT1(r11)
268 mtibatu 1,r4
269 lwz r4,SL_IBAT1+4(r11)
270 mtibatl 1,r4
271 lwz r4,SL_IBAT2(r11)
272 mtibatu 2,r4
273 lwz r4,SL_IBAT2+4(r11)
274 mtibatl 2,r4
275 lwz r4,SL_IBAT3(r11)
276 mtibatu 3,r4
277 lwz r4,SL_IBAT3+4(r11)
278 mtibatl 3,r4
279#endif
280
281BEGIN_FTR_SECTION
282 li r4,0
283 mtspr SPRN_DBAT4U,r4
284 mtspr SPRN_DBAT4L,r4
285 mtspr SPRN_DBAT5U,r4
286 mtspr SPRN_DBAT5L,r4
287 mtspr SPRN_DBAT6U,r4
288 mtspr SPRN_DBAT6L,r4
289 mtspr SPRN_DBAT7U,r4
290 mtspr SPRN_DBAT7L,r4
291 mtspr SPRN_IBAT4U,r4
292 mtspr SPRN_IBAT4L,r4
293 mtspr SPRN_IBAT5U,r4
294 mtspr SPRN_IBAT5L,r4
295 mtspr SPRN_IBAT6U,r4
296 mtspr SPRN_IBAT6L,r4
297 mtspr SPRN_IBAT7U,r4
298 mtspr SPRN_IBAT7L,r4
299END_FTR_SECTION_IFSET(CPU_FTR_HAS_HIGH_BATS)
300
301 /* Flush all TLBs */
302 lis r4,0x1000
3031: addic. r4,r4,-0x1000
304 tlbie r4
305 blt 1b
306 sync
307
308 /* restore the MSR and turn on the MMU */
309 lwz r3,SL_MSR(r11)
310 bl turn_on_mmu
311 tovirt(r11,r11)
312
313 /* Restore TB */
314 li r3,0
315 mttbl r3
316 lwz r3,SL_TB(r11)
317 lwz r4,SL_TB+4(r11)
318 mttbu r3
319 mttbl r4
320
321 /* Kick decrementer */
322 li r0,1
323 mtdec r0
324
325 /* Restore the callee-saved registers and return */
326 lwz r0,SL_CR(r11)
327 mtcr r0
328 lwz r2,SL_R2(r11)
329 lmw r12,SL_R12(r11)
330 lwz r1,SL_SP(r11)
331 lwz r0,SL_LR(r11)
332 mtlr r0
333
334 // XXX Note: we don't really need to call swsusp_resume
335
336 li r3,0
337 blr
338
339/* FIXME:This construct is actually not useful since we don't shut
340 * down the instruction MMU, we could just flip back MSR-DR on.
341 */
342turn_on_mmu:
343 mflr r4
344 mtsrr0 r4
345 mtsrr1 r3
346 sync
347 isync
348 rfi
349
diff --git a/arch/ppc/kernel/syscalls.c b/arch/ppc/kernel/syscalls.c
new file mode 100644
index 000000000000..124313ce3c09
--- /dev/null
+++ b/arch/ppc/kernel/syscalls.c
@@ -0,0 +1,272 @@
1/*
2 * arch/ppc/kernel/sys_ppc.c
3 *
4 * PowerPC version
5 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
6 *
7 * Derived from "arch/i386/kernel/sys_i386.c"
8 * Adapted from the i386 version by Gary Thomas
9 * Modified by Cort Dougan (cort@cs.nmt.edu)
10 * and Paul Mackerras (paulus@cs.anu.edu.au).
11 *
12 * This file contains various random system calls that
13 * have a non-standard calling sequence on the Linux/PPC
14 * platform.
15 *
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License
18 * as published by the Free Software Foundation; either version
19 * 2 of the License, or (at your option) any later version.
20 *
21 */
22
23#include <linux/errno.h>
24#include <linux/sched.h>
25#include <linux/mm.h>
26#include <linux/smp.h>
27#include <linux/smp_lock.h>
28#include <linux/sem.h>
29#include <linux/msg.h>
30#include <linux/shm.h>
31#include <linux/stat.h>
32#include <linux/syscalls.h>
33#include <linux/mman.h>
34#include <linux/sys.h>
35#include <linux/ipc.h>
36#include <linux/utsname.h>
37#include <linux/file.h>
38#include <linux/unistd.h>
39
40#include <asm/uaccess.h>
41#include <asm/ipc.h>
42#include <asm/semaphore.h>
43
44void
45check_bugs(void)
46{
47}
48
49/*
50 * sys_ipc() is the de-multiplexer for the SysV IPC calls..
51 *
52 * This is really horribly ugly.
53 */
54int
55sys_ipc (uint call, int first, int second, int third, void __user *ptr, long fifth)
56{
57 int version, ret;
58
59 version = call >> 16; /* hack for backward compatibility */
60 call &= 0xffff;
61
62 ret = -ENOSYS;
63 switch (call) {
64 case SEMOP:
65 ret = sys_semtimedop (first, (struct sembuf __user *)ptr,
66 second, NULL);
67 break;
68 case SEMTIMEDOP:
69 ret = sys_semtimedop (first, (struct sembuf __user *)ptr,
70 second, (const struct timespec __user *) fifth);
71 break;
72 case SEMGET:
73 ret = sys_semget (first, second, third);
74 break;
75 case SEMCTL: {
76 union semun fourth;
77
78 if (!ptr)
79 break;
80 if ((ret = access_ok(VERIFY_READ, ptr, sizeof(long)) ? 0 : -EFAULT)
81 || (ret = get_user(fourth.__pad, (void __user *__user *)ptr)))
82 break;
83 ret = sys_semctl (first, second, third, fourth);
84 break;
85 }
86 case MSGSND:
87 ret = sys_msgsnd (first, (struct msgbuf __user *) ptr, second, third);
88 break;
89 case MSGRCV:
90 switch (version) {
91 case 0: {
92 struct ipc_kludge tmp;
93
94 if (!ptr)
95 break;
96 if ((ret = access_ok(VERIFY_READ, ptr, sizeof(tmp)) ? 0 : -EFAULT)
97 || (ret = copy_from_user(&tmp,
98 (struct ipc_kludge __user *) ptr,
99 sizeof (tmp)) ? -EFAULT : 0))
100 break;
101 ret = sys_msgrcv (first, tmp.msgp, second, tmp.msgtyp,
102 third);
103 break;
104 }
105 default:
106 ret = sys_msgrcv (first, (struct msgbuf __user *) ptr,
107 second, fifth, third);
108 break;
109 }
110 break;
111 case MSGGET:
112 ret = sys_msgget ((key_t) first, second);
113 break;
114 case MSGCTL:
115 ret = sys_msgctl (first, second, (struct msqid_ds __user *) ptr);
116 break;
117 case SHMAT: {
118 ulong raddr;
119
120 if ((ret = access_ok(VERIFY_WRITE, (ulong __user *) third,
121 sizeof(ulong)) ? 0 : -EFAULT))
122 break;
123 ret = do_shmat (first, (char __user *) ptr, second, &raddr);
124 if (ret)
125 break;
126 ret = put_user (raddr, (ulong __user *) third);
127 break;
128 }
129 case SHMDT:
130 ret = sys_shmdt ((char __user *)ptr);
131 break;
132 case SHMGET:
133 ret = sys_shmget (first, second, third);
134 break;
135 case SHMCTL:
136 ret = sys_shmctl (first, second, (struct shmid_ds __user *) ptr);
137 break;
138 }
139
140 return ret;
141}
142
143/*
144 * sys_pipe() is the normal C calling standard for creating
145 * a pipe. It's not the way unix traditionally does this, though.
146 */
147int sys_pipe(int __user *fildes)
148{
149 int fd[2];
150 int error;
151
152 error = do_pipe(fd);
153 if (!error) {
154 if (copy_to_user(fildes, fd, 2*sizeof(int)))
155 error = -EFAULT;
156 }
157 return error;
158}
159
160static inline unsigned long
161do_mmap2(unsigned long addr, size_t len,
162 unsigned long prot, unsigned long flags,
163 unsigned long fd, unsigned long pgoff)
164{
165 struct file * file = NULL;
166 int ret = -EBADF;
167
168 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
169 if (!(flags & MAP_ANONYMOUS)) {
170 if (!(file = fget(fd)))
171 goto out;
172 }
173
174 down_write(&current->mm->mmap_sem);
175 ret = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
176 up_write(&current->mm->mmap_sem);
177 if (file)
178 fput(file);
179out:
180 return ret;
181}
182
183unsigned long sys_mmap2(unsigned long addr, size_t len,
184 unsigned long prot, unsigned long flags,
185 unsigned long fd, unsigned long pgoff)
186{
187 return do_mmap2(addr, len, prot, flags, fd, pgoff);
188}
189
190unsigned long sys_mmap(unsigned long addr, size_t len,
191 unsigned long prot, unsigned long flags,
192 unsigned long fd, off_t offset)
193{
194 int err = -EINVAL;
195
196 if (offset & ~PAGE_MASK)
197 goto out;
198
199 err = do_mmap2(addr, len, prot, flags, fd, offset >> PAGE_SHIFT);
200out:
201 return err;
202}
203
204/*
205 * Due to some executables calling the wrong select we sometimes
206 * get wrong args. This determines how the args are being passed
207 * (a single ptr to them all args passed) then calls
208 * sys_select() with the appropriate args. -- Cort
209 */
210int
211ppc_select(int n, fd_set __user *inp, fd_set __user *outp, fd_set __user *exp, struct timeval __user *tvp)
212{
213 if ( (unsigned long)n >= 4096 )
214 {
215 unsigned long __user *buffer = (unsigned long __user *)n;
216 if (!access_ok(VERIFY_READ, buffer, 5*sizeof(unsigned long))
217 || __get_user(n, buffer)
218 || __get_user(inp, ((fd_set __user * __user *)(buffer+1)))
219 || __get_user(outp, ((fd_set __user * __user *)(buffer+2)))
220 || __get_user(exp, ((fd_set __user * __user *)(buffer+3)))
221 || __get_user(tvp, ((struct timeval __user * __user *)(buffer+4))))
222 return -EFAULT;
223 }
224 return sys_select(n, inp, outp, exp, tvp);
225}
226
227int sys_uname(struct old_utsname __user * name)
228{
229 int err = -EFAULT;
230
231 down_read(&uts_sem);
232 if (name && !copy_to_user(name, &system_utsname, sizeof (*name)))
233 err = 0;
234 up_read(&uts_sem);
235 return err;
236}
237
238int sys_olduname(struct oldold_utsname __user * name)
239{
240 int error;
241
242 if (!name)
243 return -EFAULT;
244 if (!access_ok(VERIFY_WRITE,name,sizeof(struct oldold_utsname)))
245 return -EFAULT;
246
247 down_read(&uts_sem);
248 error = __copy_to_user(&name->sysname,&system_utsname.sysname,__OLD_UTS_LEN);
249 error -= __put_user(0,name->sysname+__OLD_UTS_LEN);
250 error -= __copy_to_user(&name->nodename,&system_utsname.nodename,__OLD_UTS_LEN);
251 error -= __put_user(0,name->nodename+__OLD_UTS_LEN);
252 error -= __copy_to_user(&name->release,&system_utsname.release,__OLD_UTS_LEN);
253 error -= __put_user(0,name->release+__OLD_UTS_LEN);
254 error -= __copy_to_user(&name->version,&system_utsname.version,__OLD_UTS_LEN);
255 error -= __put_user(0,name->version+__OLD_UTS_LEN);
256 error -= __copy_to_user(&name->machine,&system_utsname.machine,__OLD_UTS_LEN);
257 error = __put_user(0,name->machine+__OLD_UTS_LEN);
258 up_read(&uts_sem);
259
260 error = error ? -EFAULT : 0;
261 return error;
262}
263
264/*
265 * We put the arguments in a different order so we only use 6
266 * registers for arguments, rather than 7 as sys_fadvise64_64 needs
267 * (because `offset' goes in r5/r6).
268 */
269long ppc_fadvise64_64(int fd, int advice, loff_t offset, loff_t len)
270{
271 return sys_fadvise64_64(fd, offset, len, advice);
272}
diff --git a/arch/ppc/kernel/temp.c b/arch/ppc/kernel/temp.c
new file mode 100644
index 000000000000..fe8bb634ead0
--- /dev/null
+++ b/arch/ppc/kernel/temp.c
@@ -0,0 +1,272 @@
1/*
2 * temp.c Thermal management for cpu's with Thermal Assist Units
3 *
4 * Written by Troy Benjegerdes <hozer@drgw.net>
5 *
6 * TODO:
7 * dynamic power management to limit peak CPU temp (using ICTC)
8 * calibration???
9 *
10 * Silly, crazy ideas: use cpu load (from scheduler) and ICTC to extend battery
11 * life in portables, and add a 'performance/watt' metric somewhere in /proc
12 */
13
14#include <linux/config.h>
15#include <linux/errno.h>
16#include <linux/jiffies.h>
17#include <linux/kernel.h>
18#include <linux/param.h>
19#include <linux/string.h>
20#include <linux/mm.h>
21#include <linux/interrupt.h>
22#include <linux/init.h>
23
24#include <asm/segment.h>
25#include <asm/io.h>
26#include <asm/reg.h>
27#include <asm/nvram.h>
28#include <asm/cache.h>
29#include <asm/8xx_immap.h>
30#include <asm/machdep.h>
31
32static struct tau_temp
33{
34 int interrupts;
35 unsigned char low;
36 unsigned char high;
37 unsigned char grew;
38} tau[NR_CPUS];
39
40struct timer_list tau_timer;
41
42#undef DEBUG
43
44/* TODO: put these in a /proc interface, with some sanity checks, and maybe
45 * dynamic adjustment to minimize # of interrupts */
46/* configurable values for step size and how much to expand the window when
47 * we get an interrupt. These are based on the limit that was out of range */
48#define step_size 2 /* step size when temp goes out of range */
49#define window_expand 1 /* expand the window by this much */
50/* configurable values for shrinking the window */
51#define shrink_timer 2*HZ /* period between shrinking the window */
52#define min_window 2 /* minimum window size, degrees C */
53
54void set_thresholds(unsigned long cpu)
55{
56#ifdef CONFIG_TAU_INT
57 /*
58 * setup THRM1,
59 * threshold, valid bit, enable interrupts, interrupt when below threshold
60 */
61 mtspr(SPRN_THRM1, THRM1_THRES(tau[cpu].low) | THRM1_V | THRM1_TIE | THRM1_TID);
62
63 /* setup THRM2,
64 * threshold, valid bit, enable interrupts, interrupt when above threshhold
65 */
66 mtspr (SPRN_THRM2, THRM1_THRES(tau[cpu].high) | THRM1_V | THRM1_TIE);
67#else
68 /* same thing but don't enable interrupts */
69 mtspr(SPRN_THRM1, THRM1_THRES(tau[cpu].low) | THRM1_V | THRM1_TID);
70 mtspr(SPRN_THRM2, THRM1_THRES(tau[cpu].high) | THRM1_V);
71#endif
72}
73
74void TAUupdate(int cpu)
75{
76 unsigned thrm;
77
78#ifdef DEBUG
79 printk("TAUupdate ");
80#endif
81
82 /* if both thresholds are crossed, the step_sizes cancel out
83 * and the window winds up getting expanded twice. */
84 if((thrm = mfspr(SPRN_THRM1)) & THRM1_TIV){ /* is valid? */
85 if(thrm & THRM1_TIN){ /* crossed low threshold */
86 if (tau[cpu].low >= step_size){
87 tau[cpu].low -= step_size;
88 tau[cpu].high -= (step_size - window_expand);
89 }
90 tau[cpu].grew = 1;
91#ifdef DEBUG
92 printk("low threshold crossed ");
93#endif
94 }
95 }
96 if((thrm = mfspr(SPRN_THRM2)) & THRM1_TIV){ /* is valid? */
97 if(thrm & THRM1_TIN){ /* crossed high threshold */
98 if (tau[cpu].high <= 127-step_size){
99 tau[cpu].low += (step_size - window_expand);
100 tau[cpu].high += step_size;
101 }
102 tau[cpu].grew = 1;
103#ifdef DEBUG
104 printk("high threshold crossed ");
105#endif
106 }
107 }
108
109#ifdef DEBUG
110 printk("grew = %d\n", tau[cpu].grew);
111#endif
112
113#ifndef CONFIG_TAU_INT /* tau_timeout will do this if not using interrupts */
114 set_thresholds(cpu);
115#endif
116
117}
118
119#ifdef CONFIG_TAU_INT
120/*
121 * TAU interrupts - called when we have a thermal assist unit interrupt
122 * with interrupts disabled
123 */
124
125void TAUException(struct pt_regs * regs)
126{
127 int cpu = smp_processor_id();
128
129 irq_enter();
130 tau[cpu].interrupts++;
131
132 TAUupdate(cpu);
133
134 irq_exit();
135}
136#endif /* CONFIG_TAU_INT */
137
138static void tau_timeout(void * info)
139{
140 int cpu;
141 unsigned long flags;
142 int size;
143 int shrink;
144
145 /* disabling interrupts *should* be okay */
146 local_irq_save(flags);
147 cpu = smp_processor_id();
148
149#ifndef CONFIG_TAU_INT
150 TAUupdate(cpu);
151#endif
152
153 size = tau[cpu].high - tau[cpu].low;
154 if (size > min_window && ! tau[cpu].grew) {
155 /* do an exponential shrink of half the amount currently over size */
156 shrink = (2 + size - min_window) / 4;
157 if (shrink) {
158 tau[cpu].low += shrink;
159 tau[cpu].high -= shrink;
160 } else { /* size must have been min_window + 1 */
161 tau[cpu].low += 1;
162#if 1 /* debug */
163 if ((tau[cpu].high - tau[cpu].low) != min_window){
164 printk(KERN_ERR "temp.c: line %d, logic error\n", __LINE__);
165 }
166#endif
167 }
168 }
169
170 tau[cpu].grew = 0;
171
172 set_thresholds(cpu);
173
174 /*
175 * Do the enable every time, since otherwise a bunch of (relatively)
176 * complex sleep code needs to be added. One mtspr every time
177 * tau_timeout is called is probably not a big deal.
178 *
179 * Enable thermal sensor and set up sample interval timer
180 * need 20 us to do the compare.. until a nice 'cpu_speed' function
181 * call is implemented, just assume a 500 mhz clock. It doesn't really
182 * matter if we take too long for a compare since it's all interrupt
183 * driven anyway.
184 *
185 * use a extra long time.. (60 us @ 500 mhz)
186 */
187 mtspr(SPRN_THRM3, THRM3_SITV(500*60) | THRM3_E);
188
189 local_irq_restore(flags);
190}
191
192static void tau_timeout_smp(unsigned long unused)
193{
194
195 /* schedule ourselves to be run again */
196 mod_timer(&tau_timer, jiffies + shrink_timer) ;
197 on_each_cpu(tau_timeout, NULL, 1, 0);
198}
199
200/*
201 * setup the TAU
202 *
203 * Set things up to use THRM1 as a temperature lower bound, and THRM2 as an upper bound.
204 * Start off at zero
205 */
206
207int tau_initialized = 0;
208
209void __init TAU_init_smp(void * info)
210{
211 unsigned long cpu = smp_processor_id();
212
213 /* set these to a reasonable value and let the timer shrink the
214 * window */
215 tau[cpu].low = 5;
216 tau[cpu].high = 120;
217
218 set_thresholds(cpu);
219}
220
221int __init TAU_init(void)
222{
223 /* We assume in SMP that if one CPU has TAU support, they
224 * all have it --BenH
225 */
226 if (!cpu_has_feature(CPU_FTR_TAU)) {
227 printk("Thermal assist unit not available\n");
228 tau_initialized = 0;
229 return 1;
230 }
231
232
233 /* first, set up the window shrinking timer */
234 init_timer(&tau_timer);
235 tau_timer.function = tau_timeout_smp;
236 tau_timer.expires = jiffies + shrink_timer;
237 add_timer(&tau_timer);
238
239 on_each_cpu(TAU_init_smp, NULL, 1, 0);
240
241 printk("Thermal assist unit ");
242#ifdef CONFIG_TAU_INT
243 printk("using interrupts, ");
244#else
245 printk("using timers, ");
246#endif
247 printk("shrink_timer: %d jiffies\n", shrink_timer);
248 tau_initialized = 1;
249
250 return 0;
251}
252
253__initcall(TAU_init);
254
255/*
256 * return current temp
257 */
258
259u32 cpu_temp_both(unsigned long cpu)
260{
261 return ((tau[cpu].high << 16) | tau[cpu].low);
262}
263
264int cpu_temp(unsigned long cpu)
265{
266 return ((tau[cpu].high + tau[cpu].low) / 2);
267}
268
269int tau_interrupts(unsigned long cpu)
270{
271 return (tau[cpu].interrupts);
272}
diff --git a/arch/ppc/kernel/time.c b/arch/ppc/kernel/time.c
new file mode 100644
index 000000000000..50724139402c
--- /dev/null
+++ b/arch/ppc/kernel/time.c
@@ -0,0 +1,447 @@
1/*
2 * Common time routines among all ppc machines.
3 *
4 * Written by Cort Dougan (cort@cs.nmt.edu) to merge
5 * Paul Mackerras' version and mine for PReP and Pmac.
6 * MPC8xx/MBX changes by Dan Malek (dmalek@jlc.net).
7 *
8 * First round of bugfixes by Gabriel Paubert (paubert@iram.es)
9 * to make clock more stable (2.4.0-test5). The only thing
10 * that this code assumes is that the timebases have been synchronized
11 * by firmware on SMP and are never stopped (never do sleep
12 * on SMP then, nap and doze are OK).
13 *
14 * TODO (not necessarily in this file):
15 * - improve precision and reproducibility of timebase frequency
16 * measurement at boot time.
17 * - get rid of xtime_lock for gettimeofday (generic kernel problem
18 * to be implemented on all architectures for SMP scalability and
19 * eventually implementing gettimeofday without entering the kernel).
20 * - put all time/clock related variables in a single structure
21 * to minimize number of cache lines touched by gettimeofday()
22 * - for astronomical applications: add a new function to get
23 * non ambiguous timestamps even around leap seconds. This needs
24 * a new timestamp format and a good name.
25 *
26 *
27 * The following comment is partially obsolete (at least the long wait
28 * is no more a valid reason):
29 * Since the MPC8xx has a programmable interrupt timer, I decided to
30 * use that rather than the decrementer. Two reasons: 1.) the clock
31 * frequency is low, causing 2.) a long wait in the timer interrupt
32 * while ((d = get_dec()) == dval)
33 * loop. The MPC8xx can be driven from a variety of input clocks,
34 * so a number of assumptions have been made here because the kernel
35 * parameter HZ is a constant. We assume (correctly, today :-) that
36 * the MPC8xx on the MBX board is driven from a 32.768 kHz crystal.
37 * This is then divided by 4, providing a 8192 Hz clock into the PIT.
38 * Since it is not possible to get a nice 100 Hz clock out of this, without
39 * creating a software PLL, I have set HZ to 128. -- Dan
40 *
41 * 1997-09-10 Updated NTP code according to technical memorandum Jan '96
42 * "A Kernel Model for Precision Timekeeping" by Dave Mills
43 */
44
45#include <linux/config.h>
46#include <linux/errno.h>
47#include <linux/sched.h>
48#include <linux/kernel.h>
49#include <linux/param.h>
50#include <linux/string.h>
51#include <linux/mm.h>
52#include <linux/module.h>
53#include <linux/interrupt.h>
54#include <linux/timex.h>
55#include <linux/kernel_stat.h>
56#include <linux/mc146818rtc.h>
57#include <linux/time.h>
58#include <linux/init.h>
59#include <linux/profile.h>
60
61#include <asm/segment.h>
62#include <asm/io.h>
63#include <asm/nvram.h>
64#include <asm/cache.h>
65#include <asm/8xx_immap.h>
66#include <asm/machdep.h>
67
68#include <asm/time.h>
69
70/* XXX false sharing with below? */
71u64 jiffies_64 = INITIAL_JIFFIES;
72
73EXPORT_SYMBOL(jiffies_64);
74
75unsigned long disarm_decr[NR_CPUS];
76
77extern struct timezone sys_tz;
78
79/* keep track of when we need to update the rtc */
80time_t last_rtc_update;
81
82/* The decrementer counts down by 128 every 128ns on a 601. */
83#define DECREMENTER_COUNT_601 (1000000000 / HZ)
84
85unsigned tb_ticks_per_jiffy;
86unsigned tb_to_us;
87unsigned tb_last_stamp;
88unsigned long tb_to_ns_scale;
89
90extern unsigned long wall_jiffies;
91
92static long time_offset;
93
94DEFINE_SPINLOCK(rtc_lock);
95
96EXPORT_SYMBOL(rtc_lock);
97
98/* Timer interrupt helper function */
99static inline int tb_delta(unsigned *jiffy_stamp) {
100 int delta;
101 if (__USE_RTC()) {
102 delta = get_rtcl();
103 if (delta < *jiffy_stamp) *jiffy_stamp -= 1000000000;
104 delta -= *jiffy_stamp;
105 } else {
106 delta = get_tbl() - *jiffy_stamp;
107 }
108 return delta;
109}
110
111#ifdef CONFIG_SMP
112unsigned long profile_pc(struct pt_regs *regs)
113{
114 unsigned long pc = instruction_pointer(regs);
115
116 if (in_lock_functions(pc))
117 return regs->link;
118
119 return pc;
120}
121EXPORT_SYMBOL(profile_pc);
122#endif
123
124/*
125 * timer_interrupt - gets called when the decrementer overflows,
126 * with interrupts disabled.
127 * We set it up to overflow again in 1/HZ seconds.
128 */
129void timer_interrupt(struct pt_regs * regs)
130{
131 int next_dec;
132 unsigned long cpu = smp_processor_id();
133 unsigned jiffy_stamp = last_jiffy_stamp(cpu);
134 extern void do_IRQ(struct pt_regs *);
135
136 if (atomic_read(&ppc_n_lost_interrupts) != 0)
137 do_IRQ(regs);
138
139 irq_enter();
140
141 while ((next_dec = tb_ticks_per_jiffy - tb_delta(&jiffy_stamp)) <= 0) {
142 jiffy_stamp += tb_ticks_per_jiffy;
143
144 profile_tick(CPU_PROFILING, regs);
145 update_process_times(user_mode(regs));
146
147 if (smp_processor_id())
148 continue;
149
150 /* We are in an interrupt, no need to save/restore flags */
151 write_seqlock(&xtime_lock);
152 tb_last_stamp = jiffy_stamp;
153 do_timer(regs);
154
155 /*
156 * update the rtc when needed, this should be performed on the
157 * right fraction of a second. Half or full second ?
158 * Full second works on mk48t59 clocks, others need testing.
159 * Note that this update is basically only used through
160 * the adjtimex system calls. Setting the HW clock in
161 * any other way is a /dev/rtc and userland business.
162 * This is still wrong by -0.5/+1.5 jiffies because of the
163 * timer interrupt resolution and possible delay, but here we
164 * hit a quantization limit which can only be solved by higher
165 * resolution timers and decoupling time management from timer
166 * interrupts. This is also wrong on the clocks
167 * which require being written at the half second boundary.
168 * We should have an rtc call that only sets the minutes and
169 * seconds like on Intel to avoid problems with non UTC clocks.
170 */
171 if ( ppc_md.set_rtc_time && (time_status & STA_UNSYNC) == 0 &&
172 xtime.tv_sec - last_rtc_update >= 659 &&
173 abs((xtime.tv_nsec / 1000) - (1000000-1000000/HZ)) < 500000/HZ &&
174 jiffies - wall_jiffies == 1) {
175 if (ppc_md.set_rtc_time(xtime.tv_sec+1 + time_offset) == 0)
176 last_rtc_update = xtime.tv_sec+1;
177 else
178 /* Try again one minute later */
179 last_rtc_update += 60;
180 }
181 write_sequnlock(&xtime_lock);
182 }
183 if ( !disarm_decr[smp_processor_id()] )
184 set_dec(next_dec);
185 last_jiffy_stamp(cpu) = jiffy_stamp;
186
187 if (ppc_md.heartbeat && !ppc_md.heartbeat_count--)
188 ppc_md.heartbeat();
189
190 irq_exit();
191}
192
193/*
194 * This version of gettimeofday has microsecond resolution.
195 */
196void do_gettimeofday(struct timeval *tv)
197{
198 unsigned long flags;
199 unsigned long seq;
200 unsigned delta, lost_ticks, usec, sec;
201
202 do {
203 seq = read_seqbegin_irqsave(&xtime_lock, flags);
204 sec = xtime.tv_sec;
205 usec = (xtime.tv_nsec / 1000);
206 delta = tb_ticks_since(tb_last_stamp);
207#ifdef CONFIG_SMP
208 /* As long as timebases are not in sync, gettimeofday can only
209 * have jiffy resolution on SMP.
210 */
211 if (!smp_tb_synchronized)
212 delta = 0;
213#endif /* CONFIG_SMP */
214 lost_ticks = jiffies - wall_jiffies;
215 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
216
217 usec += mulhwu(tb_to_us, tb_ticks_per_jiffy * lost_ticks + delta);
218 while (usec >= 1000000) {
219 sec++;
220 usec -= 1000000;
221 }
222 tv->tv_sec = sec;
223 tv->tv_usec = usec;
224}
225
226EXPORT_SYMBOL(do_gettimeofday);
227
228int do_settimeofday(struct timespec *tv)
229{
230 time_t wtm_sec, new_sec = tv->tv_sec;
231 long wtm_nsec, new_nsec = tv->tv_nsec;
232 unsigned long flags;
233 int tb_delta;
234
235 if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
236 return -EINVAL;
237
238 write_seqlock_irqsave(&xtime_lock, flags);
239 /* Updating the RTC is not the job of this code. If the time is
240 * stepped under NTP, the RTC will be update after STA_UNSYNC
241 * is cleared. Tool like clock/hwclock either copy the RTC
242 * to the system time, in which case there is no point in writing
243 * to the RTC again, or write to the RTC but then they don't call
244 * settimeofday to perform this operation. Note also that
245 * we don't touch the decrementer since:
246 * a) it would lose timer interrupt synchronization on SMP
247 * (if it is working one day)
248 * b) it could make one jiffy spuriously shorter or longer
249 * which would introduce another source of uncertainty potentially
250 * harmful to relatively short timers.
251 */
252
253 /* This works perfectly on SMP only if the tb are in sync but
254 * guarantees an error < 1 jiffy even if they are off by eons,
255 * still reasonable when gettimeofday resolution is 1 jiffy.
256 */
257 tb_delta = tb_ticks_since(last_jiffy_stamp(smp_processor_id()));
258 tb_delta += (jiffies - wall_jiffies) * tb_ticks_per_jiffy;
259
260 new_nsec -= 1000 * mulhwu(tb_to_us, tb_delta);
261
262 wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - new_sec);
263 wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - new_nsec);
264
265 set_normalized_timespec(&xtime, new_sec, new_nsec);
266 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
267
268 /* In case of a large backwards jump in time with NTP, we want the
269 * clock to be updated as soon as the PLL is again in lock.
270 */
271 last_rtc_update = new_sec - 658;
272
273 time_adjust = 0; /* stop active adjtime() */
274 time_status |= STA_UNSYNC;
275 time_state = TIME_ERROR; /* p. 24, (a) */
276 time_maxerror = NTP_PHASE_LIMIT;
277 time_esterror = NTP_PHASE_LIMIT;
278 write_sequnlock_irqrestore(&xtime_lock, flags);
279 clock_was_set();
280 return 0;
281}
282
283EXPORT_SYMBOL(do_settimeofday);
284
285/* This function is only called on the boot processor */
286void __init time_init(void)
287{
288 time_t sec, old_sec;
289 unsigned old_stamp, stamp, elapsed;
290
291 if (ppc_md.time_init != NULL)
292 time_offset = ppc_md.time_init();
293
294 if (__USE_RTC()) {
295 /* 601 processor: dec counts down by 128 every 128ns */
296 tb_ticks_per_jiffy = DECREMENTER_COUNT_601;
297 /* mulhwu_scale_factor(1000000000, 1000000) is 0x418937 */
298 tb_to_us = 0x418937;
299 } else {
300 ppc_md.calibrate_decr();
301 tb_to_ns_scale = mulhwu(tb_to_us, 1000 << 10);
302 }
303
304 /* Now that the decrementer is calibrated, it can be used in case the
305 * clock is stuck, but the fact that we have to handle the 601
306 * makes things more complex. Repeatedly read the RTC until the
307 * next second boundary to try to achieve some precision. If there
308 * is no RTC, we still need to set tb_last_stamp and
309 * last_jiffy_stamp(cpu 0) to the current stamp.
310 */
311 stamp = get_native_tbl();
312 if (ppc_md.get_rtc_time) {
313 sec = ppc_md.get_rtc_time();
314 elapsed = 0;
315 do {
316 old_stamp = stamp;
317 old_sec = sec;
318 stamp = get_native_tbl();
319 if (__USE_RTC() && stamp < old_stamp)
320 old_stamp -= 1000000000;
321 elapsed += stamp - old_stamp;
322 sec = ppc_md.get_rtc_time();
323 } while ( sec == old_sec && elapsed < 2*HZ*tb_ticks_per_jiffy);
324 if (sec==old_sec)
325 printk("Warning: real time clock seems stuck!\n");
326 xtime.tv_sec = sec;
327 xtime.tv_nsec = 0;
328 /* No update now, we just read the time from the RTC ! */
329 last_rtc_update = xtime.tv_sec;
330 }
331 last_jiffy_stamp(0) = tb_last_stamp = stamp;
332
333 /* Not exact, but the timer interrupt takes care of this */
334 set_dec(tb_ticks_per_jiffy);
335
336 /* If platform provided a timezone (pmac), we correct the time */
337 if (time_offset) {
338 sys_tz.tz_minuteswest = -time_offset / 60;
339 sys_tz.tz_dsttime = 0;
340 xtime.tv_sec -= time_offset;
341 }
342 set_normalized_timespec(&wall_to_monotonic,
343 -xtime.tv_sec, -xtime.tv_nsec);
344}
345
346#define FEBRUARY 2
347#define STARTOFTIME 1970
348#define SECDAY 86400L
349#define SECYR (SECDAY * 365)
350
351/*
352 * Note: this is wrong for 2100, but our signed 32-bit time_t will
353 * have overflowed long before that, so who cares. -- paulus
354 */
355#define leapyear(year) ((year) % 4 == 0)
356#define days_in_year(a) (leapyear(a) ? 366 : 365)
357#define days_in_month(a) (month_days[(a) - 1])
358
359static int month_days[12] = {
360 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
361};
362
363void to_tm(int tim, struct rtc_time * tm)
364{
365 register int i;
366 register long hms, day, gday;
367
368 gday = day = tim / SECDAY;
369 hms = tim % SECDAY;
370
371 /* Hours, minutes, seconds are easy */
372 tm->tm_hour = hms / 3600;
373 tm->tm_min = (hms % 3600) / 60;
374 tm->tm_sec = (hms % 3600) % 60;
375
376 /* Number of years in days */
377 for (i = STARTOFTIME; day >= days_in_year(i); i++)
378 day -= days_in_year(i);
379 tm->tm_year = i;
380
381 /* Number of months in days left */
382 if (leapyear(tm->tm_year))
383 days_in_month(FEBRUARY) = 29;
384 for (i = 1; day >= days_in_month(i); i++)
385 day -= days_in_month(i);
386 days_in_month(FEBRUARY) = 28;
387 tm->tm_mon = i;
388
389 /* Days are what is left over (+1) from all that. */
390 tm->tm_mday = day + 1;
391
392 /*
393 * Determine the day of week. Jan. 1, 1970 was a Thursday.
394 */
395 tm->tm_wday = (gday + 4) % 7;
396}
397
398/* Auxiliary function to compute scaling factors */
399/* Actually the choice of a timebase running at 1/4 the of the bus
400 * frequency giving resolution of a few tens of nanoseconds is quite nice.
401 * It makes this computation very precise (27-28 bits typically) which
402 * is optimistic considering the stability of most processor clock
403 * oscillators and the precision with which the timebase frequency
404 * is measured but does not harm.
405 */
406unsigned mulhwu_scale_factor(unsigned inscale, unsigned outscale) {
407 unsigned mlt=0, tmp, err;
408 /* No concern for performance, it's done once: use a stupid
409 * but safe and compact method to find the multiplier.
410 */
411 for (tmp = 1U<<31; tmp != 0; tmp >>= 1) {
412 if (mulhwu(inscale, mlt|tmp) < outscale) mlt|=tmp;
413 }
414 /* We might still be off by 1 for the best approximation.
415 * A side effect of this is that if outscale is too large
416 * the returned value will be zero.
417 * Many corner cases have been checked and seem to work,
418 * some might have been forgotten in the test however.
419 */
420 err = inscale*(mlt+1);
421 if (err <= inscale/2) mlt++;
422 return mlt;
423}
424
425unsigned long long sched_clock(void)
426{
427 unsigned long lo, hi, hi2;
428 unsigned long long tb;
429
430 if (!__USE_RTC()) {
431 do {
432 hi = get_tbu();
433 lo = get_tbl();
434 hi2 = get_tbu();
435 } while (hi2 != hi);
436 tb = ((unsigned long long) hi << 32) | lo;
437 tb = (tb * tb_to_ns_scale) >> 10;
438 } else {
439 do {
440 hi = get_rtcu();
441 lo = get_rtcl();
442 hi2 = get_rtcu();
443 } while (hi2 != hi);
444 tb = ((unsigned long long) hi) * 1000000000 + lo;
445 }
446 return tb;
447}
diff --git a/arch/ppc/kernel/traps.c b/arch/ppc/kernel/traps.c
new file mode 100644
index 000000000000..ed5c7acdca70
--- /dev/null
+++ b/arch/ppc/kernel/traps.c
@@ -0,0 +1,886 @@
1/*
2 * arch/ppc/kernel/traps.c
3 *
4 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 *
11 * Modified by Cort Dougan (cort@cs.nmt.edu)
12 * and Paul Mackerras (paulus@cs.anu.edu.au)
13 */
14
15/*
16 * This file handles the architecture-dependent parts of hardware exceptions
17 */
18
19#include <linux/errno.h>
20#include <linux/sched.h>
21#include <linux/kernel.h>
22#include <linux/mm.h>
23#include <linux/stddef.h>
24#include <linux/unistd.h>
25#include <linux/ptrace.h>
26#include <linux/slab.h>
27#include <linux/user.h>
28#include <linux/a.out.h>
29#include <linux/interrupt.h>
30#include <linux/config.h>
31#include <linux/init.h>
32#include <linux/module.h>
33#include <linux/prctl.h>
34
35#include <asm/pgtable.h>
36#include <asm/uaccess.h>
37#include <asm/system.h>
38#include <asm/io.h>
39#include <asm/reg.h>
40#include <asm/xmon.h>
41#ifdef CONFIG_PMAC_BACKLIGHT
42#include <asm/backlight.h>
43#endif
44#include <asm/perfmon.h>
45
46#ifdef CONFIG_XMON
47void (*debugger)(struct pt_regs *regs) = xmon;
48int (*debugger_bpt)(struct pt_regs *regs) = xmon_bpt;
49int (*debugger_sstep)(struct pt_regs *regs) = xmon_sstep;
50int (*debugger_iabr_match)(struct pt_regs *regs) = xmon_iabr_match;
51int (*debugger_dabr_match)(struct pt_regs *regs) = xmon_dabr_match;
52void (*debugger_fault_handler)(struct pt_regs *regs);
53#else
54#ifdef CONFIG_KGDB
55void (*debugger)(struct pt_regs *regs);
56int (*debugger_bpt)(struct pt_regs *regs);
57int (*debugger_sstep)(struct pt_regs *regs);
58int (*debugger_iabr_match)(struct pt_regs *regs);
59int (*debugger_dabr_match)(struct pt_regs *regs);
60void (*debugger_fault_handler)(struct pt_regs *regs);
61#else
62#define debugger(regs) do { } while (0)
63#define debugger_bpt(regs) 0
64#define debugger_sstep(regs) 0
65#define debugger_iabr_match(regs) 0
66#define debugger_dabr_match(regs) 0
67#define debugger_fault_handler ((void (*)(struct pt_regs *))0)
68#endif
69#endif
70
71/*
72 * Trap & Exception support
73 */
74
75DEFINE_SPINLOCK(die_lock);
76
77void die(const char * str, struct pt_regs * fp, long err)
78{
79 static int die_counter;
80 int nl = 0;
81 console_verbose();
82 spin_lock_irq(&die_lock);
83#ifdef CONFIG_PMAC_BACKLIGHT
84 set_backlight_enable(1);
85 set_backlight_level(BACKLIGHT_MAX);
86#endif
87 printk("Oops: %s, sig: %ld [#%d]\n", str, err, ++die_counter);
88#ifdef CONFIG_PREEMPT
89 printk("PREEMPT ");
90 nl = 1;
91#endif
92#ifdef CONFIG_SMP
93 printk("SMP NR_CPUS=%d ", NR_CPUS);
94 nl = 1;
95#endif
96 if (nl)
97 printk("\n");
98 show_regs(fp);
99 spin_unlock_irq(&die_lock);
100 /* do_exit() should take care of panic'ing from an interrupt
101 * context so we don't handle it here
102 */
103 do_exit(err);
104}
105
106void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr)
107{
108 siginfo_t info;
109
110 if (!user_mode(regs)) {
111 debugger(regs);
112 die("Exception in kernel mode", regs, signr);
113 }
114 info.si_signo = signr;
115 info.si_errno = 0;
116 info.si_code = code;
117 info.si_addr = (void __user *) addr;
118 force_sig_info(signr, &info, current);
119}
120
121/*
122 * I/O accesses can cause machine checks on powermacs.
123 * Check if the NIP corresponds to the address of a sync
124 * instruction for which there is an entry in the exception
125 * table.
126 * Note that the 601 only takes a machine check on TEA
127 * (transfer error ack) signal assertion, and does not
128 * set any of the top 16 bits of SRR1.
129 * -- paulus.
130 */
131static inline int check_io_access(struct pt_regs *regs)
132{
133#ifdef CONFIG_PPC_PMAC
134 unsigned long msr = regs->msr;
135 const struct exception_table_entry *entry;
136 unsigned int *nip = (unsigned int *)regs->nip;
137
138 if (((msr & 0xffff0000) == 0 || (msr & (0x80000 | 0x40000)))
139 && (entry = search_exception_tables(regs->nip)) != NULL) {
140 /*
141 * Check that it's a sync instruction, or somewhere
142 * in the twi; isync; nop sequence that inb/inw/inl uses.
143 * As the address is in the exception table
144 * we should be able to read the instr there.
145 * For the debug message, we look at the preceding
146 * load or store.
147 */
148 if (*nip == 0x60000000) /* nop */
149 nip -= 2;
150 else if (*nip == 0x4c00012c) /* isync */
151 --nip;
152 if (*nip == 0x7c0004ac || (*nip >> 26) == 3) {
153 /* sync or twi */
154 unsigned int rb;
155
156 --nip;
157 rb = (*nip >> 11) & 0x1f;
158 printk(KERN_DEBUG "%s bad port %lx at %p\n",
159 (*nip & 0x100)? "OUT to": "IN from",
160 regs->gpr[rb] - _IO_BASE, nip);
161 regs->msr |= MSR_RI;
162 regs->nip = entry->fixup;
163 return 1;
164 }
165 }
166#endif /* CONFIG_PPC_PMAC */
167 return 0;
168}
169
170#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
171/* On 4xx, the reason for the machine check or program exception
172 is in the ESR. */
173#define get_reason(regs) ((regs)->dsisr)
174#ifndef CONFIG_E500
175#define get_mc_reason(regs) ((regs)->dsisr)
176#else
177#define get_mc_reason(regs) (mfspr(SPRN_MCSR))
178#endif
179#define REASON_FP 0
180#define REASON_ILLEGAL ESR_PIL
181#define REASON_PRIVILEGED ESR_PPR
182#define REASON_TRAP ESR_PTR
183
184/* single-step stuff */
185#define single_stepping(regs) (current->thread.dbcr0 & DBCR0_IC)
186#define clear_single_step(regs) (current->thread.dbcr0 &= ~DBCR0_IC)
187
188#else
189/* On non-4xx, the reason for the machine check or program
190 exception is in the MSR. */
191#define get_reason(regs) ((regs)->msr)
192#define get_mc_reason(regs) ((regs)->msr)
193#define REASON_FP 0x100000
194#define REASON_ILLEGAL 0x80000
195#define REASON_PRIVILEGED 0x40000
196#define REASON_TRAP 0x20000
197
198#define single_stepping(regs) ((regs)->msr & MSR_SE)
199#define clear_single_step(regs) ((regs)->msr &= ~MSR_SE)
200#endif
201
202/*
203 * This is "fall-back" implementation for configurations
204 * which don't provide platform-specific machine check info
205 */
206void __attribute__ ((weak))
207platform_machine_check(struct pt_regs *regs)
208{
209}
210
211void MachineCheckException(struct pt_regs *regs)
212{
213 unsigned long reason = get_mc_reason(regs);
214
215 if (user_mode(regs)) {
216 regs->msr |= MSR_RI;
217 _exception(SIGBUS, regs, BUS_ADRERR, regs->nip);
218 return;
219 }
220
221#if defined(CONFIG_8xx) && defined(CONFIG_PCI)
222 /* the qspan pci read routines can cause machine checks -- Cort */
223 bad_page_fault(regs, regs->dar, SIGBUS);
224 return;
225#endif
226
227 if (debugger_fault_handler) {
228 debugger_fault_handler(regs);
229 regs->msr |= MSR_RI;
230 return;
231 }
232
233 if (check_io_access(regs))
234 return;
235
236#if defined(CONFIG_4xx) && !defined(CONFIG_440A)
237 if (reason & ESR_IMCP) {
238 printk("Instruction");
239 mtspr(SPRN_ESR, reason & ~ESR_IMCP);
240 } else
241 printk("Data");
242 printk(" machine check in kernel mode.\n");
243#elif defined(CONFIG_440A)
244 printk("Machine check in kernel mode.\n");
245 if (reason & ESR_IMCP){
246 printk("Instruction Synchronous Machine Check exception\n");
247 mtspr(SPRN_ESR, reason & ~ESR_IMCP);
248 }
249 else {
250 u32 mcsr = mfspr(SPRN_MCSR);
251 if (mcsr & MCSR_IB)
252 printk("Instruction Read PLB Error\n");
253 if (mcsr & MCSR_DRB)
254 printk("Data Read PLB Error\n");
255 if (mcsr & MCSR_DWB)
256 printk("Data Write PLB Error\n");
257 if (mcsr & MCSR_TLBP)
258 printk("TLB Parity Error\n");
259 if (mcsr & MCSR_ICP){
260 flush_instruction_cache();
261 printk("I-Cache Parity Error\n");
262 }
263 if (mcsr & MCSR_DCSP)
264 printk("D-Cache Search Parity Error\n");
265 if (mcsr & MCSR_DCFP)
266 printk("D-Cache Flush Parity Error\n");
267 if (mcsr & MCSR_IMPE)
268 printk("Machine Check exception is imprecise\n");
269
270 /* Clear MCSR */
271 mtspr(SPRN_MCSR, mcsr);
272 }
273#elif defined (CONFIG_E500)
274 printk("Machine check in kernel mode.\n");
275 printk("Caused by (from MCSR=%lx): ", reason);
276
277 if (reason & MCSR_MCP)
278 printk("Machine Check Signal\n");
279 if (reason & MCSR_ICPERR)
280 printk("Instruction Cache Parity Error\n");
281 if (reason & MCSR_DCP_PERR)
282 printk("Data Cache Push Parity Error\n");
283 if (reason & MCSR_DCPERR)
284 printk("Data Cache Parity Error\n");
285 if (reason & MCSR_GL_CI)
286 printk("Guarded Load or Cache-Inhibited stwcx.\n");
287 if (reason & MCSR_BUS_IAERR)
288 printk("Bus - Instruction Address Error\n");
289 if (reason & MCSR_BUS_RAERR)
290 printk("Bus - Read Address Error\n");
291 if (reason & MCSR_BUS_WAERR)
292 printk("Bus - Write Address Error\n");
293 if (reason & MCSR_BUS_IBERR)
294 printk("Bus - Instruction Data Error\n");
295 if (reason & MCSR_BUS_RBERR)
296 printk("Bus - Read Data Bus Error\n");
297 if (reason & MCSR_BUS_WBERR)
298 printk("Bus - Read Data Bus Error\n");
299 if (reason & MCSR_BUS_IPERR)
300 printk("Bus - Instruction Parity Error\n");
301 if (reason & MCSR_BUS_RPERR)
302 printk("Bus - Read Parity Error\n");
303#else /* !CONFIG_4xx && !CONFIG_E500 */
304 printk("Machine check in kernel mode.\n");
305 printk("Caused by (from SRR1=%lx): ", reason);
306 switch (reason & 0x601F0000) {
307 case 0x80000:
308 printk("Machine check signal\n");
309 break;
310 case 0: /* for 601 */
311 case 0x40000:
312 case 0x140000: /* 7450 MSS error and TEA */
313 printk("Transfer error ack signal\n");
314 break;
315 case 0x20000:
316 printk("Data parity error signal\n");
317 break;
318 case 0x10000:
319 printk("Address parity error signal\n");
320 break;
321 case 0x20000000:
322 printk("L1 Data Cache error\n");
323 break;
324 case 0x40000000:
325 printk("L1 Instruction Cache error\n");
326 break;
327 case 0x00100000:
328 printk("L2 data cache parity error\n");
329 break;
330 default:
331 printk("Unknown values in msr\n");
332 }
333#endif /* CONFIG_4xx */
334
335 /*
336 * Optional platform-provided routine to print out
337 * additional info, e.g. bus error registers.
338 */
339 platform_machine_check(regs);
340
341 debugger(regs);
342 die("machine check", regs, SIGBUS);
343}
344
345void SMIException(struct pt_regs *regs)
346{
347 debugger(regs);
348#if !(defined(CONFIG_XMON) || defined(CONFIG_KGDB))
349 show_regs(regs);
350 panic("System Management Interrupt");
351#endif
352}
353
354void UnknownException(struct pt_regs *regs)
355{
356 printk("Bad trap at PC: %lx, MSR: %lx, vector=%lx %s\n",
357 regs->nip, regs->msr, regs->trap, print_tainted());
358 _exception(SIGTRAP, regs, 0, 0);
359}
360
361void InstructionBreakpoint(struct pt_regs *regs)
362{
363 if (debugger_iabr_match(regs))
364 return;
365 _exception(SIGTRAP, regs, TRAP_BRKPT, 0);
366}
367
368void RunModeException(struct pt_regs *regs)
369{
370 _exception(SIGTRAP, regs, 0, 0);
371}
372
373/* Illegal instruction emulation support. Originally written to
374 * provide the PVR to user applications using the mfspr rd, PVR.
375 * Return non-zero if we can't emulate, or -EFAULT if the associated
376 * memory access caused an access fault. Return zero on success.
377 *
378 * There are a couple of ways to do this, either "decode" the instruction
379 * or directly match lots of bits. In this case, matching lots of
380 * bits is faster and easier.
381 *
382 */
383#define INST_MFSPR_PVR 0x7c1f42a6
384#define INST_MFSPR_PVR_MASK 0xfc1fffff
385
386#define INST_DCBA 0x7c0005ec
387#define INST_DCBA_MASK 0x7c0007fe
388
389#define INST_MCRXR 0x7c000400
390#define INST_MCRXR_MASK 0x7c0007fe
391
392#define INST_STRING 0x7c00042a
393#define INST_STRING_MASK 0x7c0007fe
394#define INST_STRING_GEN_MASK 0x7c00067e
395#define INST_LSWI 0x7c0004aa
396#define INST_LSWX 0x7c00042a
397#define INST_STSWI 0x7c0005aa
398#define INST_STSWX 0x7c00052a
399
400static int emulate_string_inst(struct pt_regs *regs, u32 instword)
401{
402 u8 rT = (instword >> 21) & 0x1f;
403 u8 rA = (instword >> 16) & 0x1f;
404 u8 NB_RB = (instword >> 11) & 0x1f;
405 u32 num_bytes;
406 u32 EA;
407 int pos = 0;
408
409 /* Early out if we are an invalid form of lswx */
410 if ((instword & INST_STRING_MASK) == INST_LSWX)
411 if ((rA >= rT) || (NB_RB >= rT) || (rT == rA) || (rT == NB_RB))
412 return -EINVAL;
413
414 /* Early out if we are an invalid form of lswi */
415 if ((instword & INST_STRING_MASK) == INST_LSWI)
416 if ((rA >= rT) || (rT == rA))
417 return -EINVAL;
418
419 EA = (rA == 0) ? 0 : regs->gpr[rA];
420
421 switch (instword & INST_STRING_MASK) {
422 case INST_LSWX:
423 case INST_STSWX:
424 EA += NB_RB;
425 num_bytes = regs->xer & 0x7f;
426 break;
427 case INST_LSWI:
428 case INST_STSWI:
429 num_bytes = (NB_RB == 0) ? 32 : NB_RB;
430 break;
431 default:
432 return -EINVAL;
433 }
434
435 while (num_bytes != 0)
436 {
437 u8 val;
438 u32 shift = 8 * (3 - (pos & 0x3));
439
440 switch ((instword & INST_STRING_MASK)) {
441 case INST_LSWX:
442 case INST_LSWI:
443 if (get_user(val, (u8 __user *)EA))
444 return -EFAULT;
445 /* first time updating this reg,
446 * zero it out */
447 if (pos == 0)
448 regs->gpr[rT] = 0;
449 regs->gpr[rT] |= val << shift;
450 break;
451 case INST_STSWI:
452 case INST_STSWX:
453 val = regs->gpr[rT] >> shift;
454 if (put_user(val, (u8 __user *)EA))
455 return -EFAULT;
456 break;
457 }
458 /* move EA to next address */
459 EA += 1;
460 num_bytes--;
461
462 /* manage our position within the register */
463 if (++pos == 4) {
464 pos = 0;
465 if (++rT == 32)
466 rT = 0;
467 }
468 }
469
470 return 0;
471}
472
473static int emulate_instruction(struct pt_regs *regs)
474{
475 u32 instword;
476 u32 rd;
477
478 if (!user_mode(regs))
479 return -EINVAL;
480 CHECK_FULL_REGS(regs);
481
482 if (get_user(instword, (u32 __user *)(regs->nip)))
483 return -EFAULT;
484
485 /* Emulate the mfspr rD, PVR.
486 */
487 if ((instword & INST_MFSPR_PVR_MASK) == INST_MFSPR_PVR) {
488 rd = (instword >> 21) & 0x1f;
489 regs->gpr[rd] = mfspr(SPRN_PVR);
490 return 0;
491 }
492
493 /* Emulating the dcba insn is just a no-op. */
494 if ((instword & INST_DCBA_MASK) == INST_DCBA)
495 return 0;
496
497 /* Emulate the mcrxr insn. */
498 if ((instword & INST_MCRXR_MASK) == INST_MCRXR) {
499 int shift = (instword >> 21) & 0x1c;
500 unsigned long msk = 0xf0000000UL >> shift;
501
502 regs->ccr = (regs->ccr & ~msk) | ((regs->xer >> shift) & msk);
503 regs->xer &= ~0xf0000000UL;
504 return 0;
505 }
506
507 /* Emulate load/store string insn. */
508 if ((instword & INST_STRING_GEN_MASK) == INST_STRING)
509 return emulate_string_inst(regs, instword);
510
511 return -EINVAL;
512}
513
514/*
515 * After we have successfully emulated an instruction, we have to
516 * check if the instruction was being single-stepped, and if so,
517 * pretend we got a single-step exception. This was pointed out
518 * by Kumar Gala. -- paulus
519 */
520static void emulate_single_step(struct pt_regs *regs)
521{
522 if (single_stepping(regs)) {
523 clear_single_step(regs);
524 _exception(SIGTRAP, regs, TRAP_TRACE, 0);
525 }
526}
527
528/*
529 * Look through the list of trap instructions that are used for BUG(),
530 * BUG_ON() and WARN_ON() and see if we hit one. At this point we know
531 * that the exception was caused by a trap instruction of some kind.
532 * Returns 1 if we should continue (i.e. it was a WARN_ON) or 0
533 * otherwise.
534 */
535extern struct bug_entry __start___bug_table[], __stop___bug_table[];
536
537#ifndef CONFIG_MODULES
538#define module_find_bug(x) NULL
539#endif
540
541static struct bug_entry *find_bug(unsigned long bugaddr)
542{
543 struct bug_entry *bug;
544
545 for (bug = __start___bug_table; bug < __stop___bug_table; ++bug)
546 if (bugaddr == bug->bug_addr)
547 return bug;
548 return module_find_bug(bugaddr);
549}
550
551int check_bug_trap(struct pt_regs *regs)
552{
553 struct bug_entry *bug;
554 unsigned long addr;
555
556 if (regs->msr & MSR_PR)
557 return 0; /* not in kernel */
558 addr = regs->nip; /* address of trap instruction */
559 if (addr < PAGE_OFFSET)
560 return 0;
561 bug = find_bug(regs->nip);
562 if (bug == NULL)
563 return 0;
564 if (bug->line & BUG_WARNING_TRAP) {
565 /* this is a WARN_ON rather than BUG/BUG_ON */
566#ifdef CONFIG_XMON
567 xmon_printf(KERN_ERR "Badness in %s at %s:%d\n",
568 bug->function, bug->file,
569 bug->line & ~BUG_WARNING_TRAP);
570#endif /* CONFIG_XMON */
571 printk(KERN_ERR "Badness in %s at %s:%d\n",
572 bug->function, bug->file,
573 bug->line & ~BUG_WARNING_TRAP);
574 dump_stack();
575 return 1;
576 }
577#ifdef CONFIG_XMON
578 xmon_printf(KERN_CRIT "kernel BUG in %s at %s:%d!\n",
579 bug->function, bug->file, bug->line);
580 xmon(regs);
581#endif /* CONFIG_XMON */
582 printk(KERN_CRIT "kernel BUG in %s at %s:%d!\n",
583 bug->function, bug->file, bug->line);
584
585 return 0;
586}
587
588void ProgramCheckException(struct pt_regs *regs)
589{
590 unsigned int reason = get_reason(regs);
591 extern int do_mathemu(struct pt_regs *regs);
592
593#ifdef CONFIG_MATH_EMULATION
594 /* (reason & REASON_ILLEGAL) would be the obvious thing here,
595 * but there seems to be a hardware bug on the 405GP (RevD)
596 * that means ESR is sometimes set incorrectly - either to
597 * ESR_DST (!?) or 0. In the process of chasing this with the
598 * hardware people - not sure if it can happen on any illegal
599 * instruction or only on FP instructions, whether there is a
600 * pattern to occurences etc. -dgibson 31/Mar/2003 */
601 if (!(reason & REASON_TRAP) && do_mathemu(regs) == 0) {
602 emulate_single_step(regs);
603 return;
604 }
605#endif /* CONFIG_MATH_EMULATION */
606
607 if (reason & REASON_FP) {
608 /* IEEE FP exception */
609 int code = 0;
610 u32 fpscr;
611
612 /* We must make sure the FP state is consistent with
613 * our MSR_FP in regs
614 */
615 preempt_disable();
616 if (regs->msr & MSR_FP)
617 giveup_fpu(current);
618 preempt_enable();
619
620 fpscr = current->thread.fpscr;
621 fpscr &= fpscr << 22; /* mask summary bits with enables */
622 if (fpscr & FPSCR_VX)
623 code = FPE_FLTINV;
624 else if (fpscr & FPSCR_OX)
625 code = FPE_FLTOVF;
626 else if (fpscr & FPSCR_UX)
627 code = FPE_FLTUND;
628 else if (fpscr & FPSCR_ZX)
629 code = FPE_FLTDIV;
630 else if (fpscr & FPSCR_XX)
631 code = FPE_FLTRES;
632 _exception(SIGFPE, regs, code, regs->nip);
633 return;
634 }
635
636 if (reason & REASON_TRAP) {
637 /* trap exception */
638 if (debugger_bpt(regs))
639 return;
640 if (check_bug_trap(regs)) {
641 regs->nip += 4;
642 return;
643 }
644 _exception(SIGTRAP, regs, TRAP_BRKPT, 0);
645 return;
646 }
647
648 /* Try to emulate it if we should. */
649 if (reason & (REASON_ILLEGAL | REASON_PRIVILEGED)) {
650 switch (emulate_instruction(regs)) {
651 case 0:
652 regs->nip += 4;
653 emulate_single_step(regs);
654 return;
655 case -EFAULT:
656 _exception(SIGSEGV, regs, SEGV_MAPERR, regs->nip);
657 return;
658 }
659 }
660
661 if (reason & REASON_PRIVILEGED)
662 _exception(SIGILL, regs, ILL_PRVOPC, regs->nip);
663 else
664 _exception(SIGILL, regs, ILL_ILLOPC, regs->nip);
665}
666
667void SingleStepException(struct pt_regs *regs)
668{
669 regs->msr &= ~(MSR_SE | MSR_BE); /* Turn off 'trace' bits */
670 if (debugger_sstep(regs))
671 return;
672 _exception(SIGTRAP, regs, TRAP_TRACE, 0);
673}
674
675void AlignmentException(struct pt_regs *regs)
676{
677 int fixed;
678
679 fixed = fix_alignment(regs);
680 if (fixed == 1) {
681 regs->nip += 4; /* skip over emulated instruction */
682 return;
683 }
684 if (fixed == -EFAULT) {
685 /* fixed == -EFAULT means the operand address was bad */
686 if (user_mode(regs))
687 _exception(SIGSEGV, regs, SEGV_ACCERR, regs->dar);
688 else
689 bad_page_fault(regs, regs->dar, SIGSEGV);
690 return;
691 }
692 _exception(SIGBUS, regs, BUS_ADRALN, regs->dar);
693}
694
695void StackOverflow(struct pt_regs *regs)
696{
697 printk(KERN_CRIT "Kernel stack overflow in process %p, r1=%lx\n",
698 current, regs->gpr[1]);
699 debugger(regs);
700 show_regs(regs);
701 panic("kernel stack overflow");
702}
703
704void nonrecoverable_exception(struct pt_regs *regs)
705{
706 printk(KERN_ERR "Non-recoverable exception at PC=%lx MSR=%lx\n",
707 regs->nip, regs->msr);
708 debugger(regs);
709 die("nonrecoverable exception", regs, SIGKILL);
710}
711
712void trace_syscall(struct pt_regs *regs)
713{
714 printk("Task: %p(%d), PC: %08lX/%08lX, Syscall: %3ld, Result: %s%ld %s\n",
715 current, current->pid, regs->nip, regs->link, regs->gpr[0],
716 regs->ccr&0x10000000?"Error=":"", regs->gpr[3], print_tainted());
717}
718
719#ifdef CONFIG_8xx
720void SoftwareEmulation(struct pt_regs *regs)
721{
722 extern int do_mathemu(struct pt_regs *);
723 extern int Soft_emulate_8xx(struct pt_regs *);
724 int errcode;
725
726 CHECK_FULL_REGS(regs);
727
728 if (!user_mode(regs)) {
729 debugger(regs);
730 die("Kernel Mode Software FPU Emulation", regs, SIGFPE);
731 }
732
733#ifdef CONFIG_MATH_EMULATION
734 errcode = do_mathemu(regs);
735#else
736 errcode = Soft_emulate_8xx(regs);
737#endif
738 if (errcode) {
739 if (errcode > 0)
740 _exception(SIGFPE, regs, 0, 0);
741 else if (errcode == -EFAULT)
742 _exception(SIGSEGV, regs, 0, 0);
743 else
744 _exception(SIGILL, regs, ILL_ILLOPC, regs->nip);
745 } else
746 emulate_single_step(regs);
747}
748#endif /* CONFIG_8xx */
749
750#if defined(CONFIG_40x) || defined(CONFIG_BOOKE)
751
752void DebugException(struct pt_regs *regs, unsigned long debug_status)
753{
754 if (debug_status & DBSR_IC) { /* instruction completion */
755 regs->msr &= ~MSR_DE;
756 if (user_mode(regs)) {
757 current->thread.dbcr0 &= ~DBCR0_IC;
758 } else {
759 /* Disable instruction completion */
760 mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) & ~DBCR0_IC);
761 /* Clear the instruction completion event */
762 mtspr(SPRN_DBSR, DBSR_IC);
763 if (debugger_sstep(regs))
764 return;
765 }
766 _exception(SIGTRAP, regs, TRAP_TRACE, 0);
767 }
768}
769#endif /* CONFIG_4xx || CONFIG_BOOKE */
770
771#if !defined(CONFIG_TAU_INT)
772void TAUException(struct pt_regs *regs)
773{
774 printk("TAU trap at PC: %lx, MSR: %lx, vector=%lx %s\n",
775 regs->nip, regs->msr, regs->trap, print_tainted());
776}
777#endif /* CONFIG_INT_TAU */
778
779void AltivecUnavailException(struct pt_regs *regs)
780{
781 static int kernel_altivec_count;
782
783#ifndef CONFIG_ALTIVEC
784 if (user_mode(regs)) {
785 /* A user program has executed an altivec instruction,
786 but this kernel doesn't support altivec. */
787 _exception(SIGILL, regs, ILL_ILLOPC, regs->nip);
788 return;
789 }
790#endif
791 /* The kernel has executed an altivec instruction without
792 first enabling altivec. Whinge but let it do it. */
793 if (++kernel_altivec_count < 10)
794 printk(KERN_ERR "AltiVec used in kernel (task=%p, pc=%lx)\n",
795 current, regs->nip);
796 regs->msr |= MSR_VEC;
797}
798
799#ifdef CONFIG_ALTIVEC
800void AltivecAssistException(struct pt_regs *regs)
801{
802 int err;
803
804 preempt_disable();
805 if (regs->msr & MSR_VEC)
806 giveup_altivec(current);
807 preempt_enable();
808
809 err = emulate_altivec(regs);
810 if (err == 0) {
811 regs->nip += 4; /* skip emulated instruction */
812 emulate_single_step(regs);
813 return;
814 }
815
816 if (err == -EFAULT) {
817 /* got an error reading the instruction */
818 _exception(SIGSEGV, regs, SEGV_ACCERR, regs->nip);
819 } else {
820 /* didn't recognize the instruction */
821 /* XXX quick hack for now: set the non-Java bit in the VSCR */
822 printk(KERN_ERR "unrecognized altivec instruction "
823 "in %s at %lx\n", current->comm, regs->nip);
824 current->thread.vscr.u[3] |= 0x10000;
825 }
826}
827#endif /* CONFIG_ALTIVEC */
828
829void PerformanceMonitorException(struct pt_regs *regs)
830{
831 perf_irq(regs);
832}
833
834#ifdef CONFIG_FSL_BOOKE
835void CacheLockingException(struct pt_regs *regs, unsigned long address,
836 unsigned long error_code)
837{
838 /* We treat cache locking instructions from the user
839 * as priv ops, in the future we could try to do
840 * something smarter
841 */
842 if (error_code & (ESR_DLK|ESR_ILK))
843 _exception(SIGILL, regs, ILL_PRVOPC, regs->nip);
844 return;
845}
846#endif /* CONFIG_FSL_BOOKE */
847
848#ifdef CONFIG_SPE
849void SPEFloatingPointException(struct pt_regs *regs)
850{
851 unsigned long spefscr;
852 int fpexc_mode;
853 int code = 0;
854
855 spefscr = current->thread.spefscr;
856 fpexc_mode = current->thread.fpexc_mode;
857
858 /* Hardware does not neccessarily set sticky
859 * underflow/overflow/invalid flags */
860 if ((spefscr & SPEFSCR_FOVF) && (fpexc_mode & PR_FP_EXC_OVF)) {
861 code = FPE_FLTOVF;
862 spefscr |= SPEFSCR_FOVFS;
863 }
864 else if ((spefscr & SPEFSCR_FUNF) && (fpexc_mode & PR_FP_EXC_UND)) {
865 code = FPE_FLTUND;
866 spefscr |= SPEFSCR_FUNFS;
867 }
868 else if ((spefscr & SPEFSCR_FDBZ) && (fpexc_mode & PR_FP_EXC_DIV))
869 code = FPE_FLTDIV;
870 else if ((spefscr & SPEFSCR_FINV) && (fpexc_mode & PR_FP_EXC_INV)) {
871 code = FPE_FLTINV;
872 spefscr |= SPEFSCR_FINVS;
873 }
874 else if ((spefscr & (SPEFSCR_FG | SPEFSCR_FX)) && (fpexc_mode & PR_FP_EXC_RES))
875 code = FPE_FLTRES;
876
877 current->thread.spefscr = spefscr;
878
879 _exception(SIGFPE, regs, code, regs->nip);
880 return;
881}
882#endif
883
884void __init trap_init(void)
885{
886}
diff --git a/arch/ppc/kernel/vecemu.c b/arch/ppc/kernel/vecemu.c
new file mode 100644
index 000000000000..604d0947cb20
--- /dev/null
+++ b/arch/ppc/kernel/vecemu.c
@@ -0,0 +1,345 @@
1/*
2 * Routines to emulate some Altivec/VMX instructions, specifically
3 * those that can trap when given denormalized operands in Java mode.
4 */
5#include <linux/kernel.h>
6#include <linux/errno.h>
7#include <linux/sched.h>
8#include <asm/ptrace.h>
9#include <asm/processor.h>
10#include <asm/uaccess.h>
11
12/* Functions in vector.S */
13extern void vaddfp(vector128 *dst, vector128 *a, vector128 *b);
14extern void vsubfp(vector128 *dst, vector128 *a, vector128 *b);
15extern void vmaddfp(vector128 *dst, vector128 *a, vector128 *b, vector128 *c);
16extern void vnmsubfp(vector128 *dst, vector128 *a, vector128 *b, vector128 *c);
17extern void vrefp(vector128 *dst, vector128 *src);
18extern void vrsqrtefp(vector128 *dst, vector128 *src);
19extern void vexptep(vector128 *dst, vector128 *src);
20
21static unsigned int exp2s[8] = {
22 0x800000,
23 0x8b95c2,
24 0x9837f0,
25 0xa5fed7,
26 0xb504f3,
27 0xc5672a,
28 0xd744fd,
29 0xeac0c7
30};
31
32/*
33 * Computes an estimate of 2^x. The `s' argument is the 32-bit
34 * single-precision floating-point representation of x.
35 */
36static unsigned int eexp2(unsigned int s)
37{
38 int exp, pwr;
39 unsigned int mant, frac;
40
41 /* extract exponent field from input */
42 exp = ((s >> 23) & 0xff) - 127;
43 if (exp > 7) {
44 /* check for NaN input */
45 if (exp == 128 && (s & 0x7fffff) != 0)
46 return s | 0x400000; /* return QNaN */
47 /* 2^-big = 0, 2^+big = +Inf */
48 return (s & 0x80000000)? 0: 0x7f800000; /* 0 or +Inf */
49 }
50 if (exp < -23)
51 return 0x3f800000; /* 1.0 */
52
53 /* convert to fixed point integer in 9.23 representation */
54 pwr = (s & 0x7fffff) | 0x800000;
55 if (exp > 0)
56 pwr <<= exp;
57 else
58 pwr >>= -exp;
59 if (s & 0x80000000)
60 pwr = -pwr;
61
62 /* extract integer part, which becomes exponent part of result */
63 exp = (pwr >> 23) + 126;
64 if (exp >= 254)
65 return 0x7f800000;
66 if (exp < -23)
67 return 0;
68
69 /* table lookup on top 3 bits of fraction to get mantissa */
70 mant = exp2s[(pwr >> 20) & 7];
71
72 /* linear interpolation using remaining 20 bits of fraction */
73 asm("mulhwu %0,%1,%2" : "=r" (frac)
74 : "r" (pwr << 12), "r" (0x172b83ff));
75 asm("mulhwu %0,%1,%2" : "=r" (frac) : "r" (frac), "r" (mant));
76 mant += frac;
77
78 if (exp >= 0)
79 return mant + (exp << 23);
80
81 /* denormalized result */
82 exp = -exp;
83 mant += 1 << (exp - 1);
84 return mant >> exp;
85}
86
87/*
88 * Computes an estimate of log_2(x). The `s' argument is the 32-bit
89 * single-precision floating-point representation of x.
90 */
91static unsigned int elog2(unsigned int s)
92{
93 int exp, mant, lz, frac;
94
95 exp = s & 0x7f800000;
96 mant = s & 0x7fffff;
97 if (exp == 0x7f800000) { /* Inf or NaN */
98 if (mant != 0)
99 s |= 0x400000; /* turn NaN into QNaN */
100 return s;
101 }
102 if ((exp | mant) == 0) /* +0 or -0 */
103 return 0xff800000; /* return -Inf */
104
105 if (exp == 0) {
106 /* denormalized */
107 asm("cntlzw %0,%1" : "=r" (lz) : "r" (mant));
108 mant <<= lz - 8;
109 exp = (-118 - lz) << 23;
110 } else {
111 mant |= 0x800000;
112 exp -= 127 << 23;
113 }
114
115 if (mant >= 0xb504f3) { /* 2^0.5 * 2^23 */
116 exp |= 0x400000; /* 0.5 * 2^23 */
117 asm("mulhwu %0,%1,%2" : "=r" (mant)
118 : "r" (mant), "r" (0xb504f334)); /* 2^-0.5 * 2^32 */
119 }
120 if (mant >= 0x9837f0) { /* 2^0.25 * 2^23 */
121 exp |= 0x200000; /* 0.25 * 2^23 */
122 asm("mulhwu %0,%1,%2" : "=r" (mant)
123 : "r" (mant), "r" (0xd744fccb)); /* 2^-0.25 * 2^32 */
124 }
125 if (mant >= 0x8b95c2) { /* 2^0.125 * 2^23 */
126 exp |= 0x100000; /* 0.125 * 2^23 */
127 asm("mulhwu %0,%1,%2" : "=r" (mant)
128 : "r" (mant), "r" (0xeac0c6e8)); /* 2^-0.125 * 2^32 */
129 }
130 if (mant > 0x800000) { /* 1.0 * 2^23 */
131 /* calculate (mant - 1) * 1.381097463 */
132 /* 1.381097463 == 0.125 / (2^0.125 - 1) */
133 asm("mulhwu %0,%1,%2" : "=r" (frac)
134 : "r" ((mant - 0x800000) << 1), "r" (0xb0c7cd3a));
135 exp += frac;
136 }
137 s = exp & 0x80000000;
138 if (exp != 0) {
139 if (s)
140 exp = -exp;
141 asm("cntlzw %0,%1" : "=r" (lz) : "r" (exp));
142 lz = 8 - lz;
143 if (lz > 0)
144 exp >>= lz;
145 else if (lz < 0)
146 exp <<= -lz;
147 s += ((lz + 126) << 23) + exp;
148 }
149 return s;
150}
151
152#define VSCR_SAT 1
153
154static int ctsxs(unsigned int x, int scale, unsigned int *vscrp)
155{
156 int exp, mant;
157
158 exp = (x >> 23) & 0xff;
159 mant = x & 0x7fffff;
160 if (exp == 255 && mant != 0)
161 return 0; /* NaN -> 0 */
162 exp = exp - 127 + scale;
163 if (exp < 0)
164 return 0; /* round towards zero */
165 if (exp >= 31) {
166 /* saturate, unless the result would be -2^31 */
167 if (x + (scale << 23) != 0xcf000000)
168 *vscrp |= VSCR_SAT;
169 return (x & 0x80000000)? 0x80000000: 0x7fffffff;
170 }
171 mant |= 0x800000;
172 mant = (mant << 7) >> (30 - exp);
173 return (x & 0x80000000)? -mant: mant;
174}
175
176static unsigned int ctuxs(unsigned int x, int scale, unsigned int *vscrp)
177{
178 int exp;
179 unsigned int mant;
180
181 exp = (x >> 23) & 0xff;
182 mant = x & 0x7fffff;
183 if (exp == 255 && mant != 0)
184 return 0; /* NaN -> 0 */
185 exp = exp - 127 + scale;
186 if (exp < 0)
187 return 0; /* round towards zero */
188 if (x & 0x80000000) {
189 /* negative => saturate to 0 */
190 *vscrp |= VSCR_SAT;
191 return 0;
192 }
193 if (exp >= 32) {
194 /* saturate */
195 *vscrp |= VSCR_SAT;
196 return 0xffffffff;
197 }
198 mant |= 0x800000;
199 mant = (mant << 8) >> (31 - exp);
200 return mant;
201}
202
203/* Round to floating integer, towards 0 */
204static unsigned int rfiz(unsigned int x)
205{
206 int exp;
207
208 exp = ((x >> 23) & 0xff) - 127;
209 if (exp == 128 && (x & 0x7fffff) != 0)
210 return x | 0x400000; /* NaN -> make it a QNaN */
211 if (exp >= 23)
212 return x; /* it's an integer already (or Inf) */
213 if (exp < 0)
214 return x & 0x80000000; /* |x| < 1.0 rounds to 0 */
215 return x & ~(0x7fffff >> exp);
216}
217
218/* Round to floating integer, towards +/- Inf */
219static unsigned int rfii(unsigned int x)
220{
221 int exp, mask;
222
223 exp = ((x >> 23) & 0xff) - 127;
224 if (exp == 128 && (x & 0x7fffff) != 0)
225 return x | 0x400000; /* NaN -> make it a QNaN */
226 if (exp >= 23)
227 return x; /* it's an integer already (or Inf) */
228 if ((x & 0x7fffffff) == 0)
229 return x; /* +/-0 -> +/-0 */
230 if (exp < 0)
231 /* 0 < |x| < 1.0 rounds to +/- 1.0 */
232 return (x & 0x80000000) | 0x3f800000;
233 mask = 0x7fffff >> exp;
234 /* mantissa overflows into exponent - that's OK,
235 it can't overflow into the sign bit */
236 return (x + mask) & ~mask;
237}
238
239/* Round to floating integer, to nearest */
240static unsigned int rfin(unsigned int x)
241{
242 int exp, half;
243
244 exp = ((x >> 23) & 0xff) - 127;
245 if (exp == 128 && (x & 0x7fffff) != 0)
246 return x | 0x400000; /* NaN -> make it a QNaN */
247 if (exp >= 23)
248 return x; /* it's an integer already (or Inf) */
249 if (exp < -1)
250 return x & 0x80000000; /* |x| < 0.5 -> +/-0 */
251 if (exp == -1)
252 /* 0.5 <= |x| < 1.0 rounds to +/- 1.0 */
253 return (x & 0x80000000) | 0x3f800000;
254 half = 0x400000 >> exp;
255 /* add 0.5 to the magnitude and chop off the fraction bits */
256 return (x + half) & ~(0x7fffff >> exp);
257}
258
259int emulate_altivec(struct pt_regs *regs)
260{
261 unsigned int instr, i;
262 unsigned int va, vb, vc, vd;
263 vector128 *vrs;
264
265 if (get_user(instr, (unsigned int __user *) regs->nip))
266 return -EFAULT;
267 if ((instr >> 26) != 4)
268 return -EINVAL; /* not an altivec instruction */
269 vd = (instr >> 21) & 0x1f;
270 va = (instr >> 16) & 0x1f;
271 vb = (instr >> 11) & 0x1f;
272 vc = (instr >> 6) & 0x1f;
273
274 vrs = current->thread.vr;
275 switch (instr & 0x3f) {
276 case 10:
277 switch (vc) {
278 case 0: /* vaddfp */
279 vaddfp(&vrs[vd], &vrs[va], &vrs[vb]);
280 break;
281 case 1: /* vsubfp */
282 vsubfp(&vrs[vd], &vrs[va], &vrs[vb]);
283 break;
284 case 4: /* vrefp */
285 vrefp(&vrs[vd], &vrs[vb]);
286 break;
287 case 5: /* vrsqrtefp */
288 vrsqrtefp(&vrs[vd], &vrs[vb]);
289 break;
290 case 6: /* vexptefp */
291 for (i = 0; i < 4; ++i)
292 vrs[vd].u[i] = eexp2(vrs[vb].u[i]);
293 break;
294 case 7: /* vlogefp */
295 for (i = 0; i < 4; ++i)
296 vrs[vd].u[i] = elog2(vrs[vb].u[i]);
297 break;
298 case 8: /* vrfin */
299 for (i = 0; i < 4; ++i)
300 vrs[vd].u[i] = rfin(vrs[vb].u[i]);
301 break;
302 case 9: /* vrfiz */
303 for (i = 0; i < 4; ++i)
304 vrs[vd].u[i] = rfiz(vrs[vb].u[i]);
305 break;
306 case 10: /* vrfip */
307 for (i = 0; i < 4; ++i) {
308 u32 x = vrs[vb].u[i];
309 x = (x & 0x80000000)? rfiz(x): rfii(x);
310 vrs[vd].u[i] = x;
311 }
312 break;
313 case 11: /* vrfim */
314 for (i = 0; i < 4; ++i) {
315 u32 x = vrs[vb].u[i];
316 x = (x & 0x80000000)? rfii(x): rfiz(x);
317 vrs[vd].u[i] = x;
318 }
319 break;
320 case 14: /* vctuxs */
321 for (i = 0; i < 4; ++i)
322 vrs[vd].u[i] = ctuxs(vrs[vb].u[i], va,
323 &current->thread.vscr.u[3]);
324 break;
325 case 15: /* vctsxs */
326 for (i = 0; i < 4; ++i)
327 vrs[vd].u[i] = ctsxs(vrs[vb].u[i], va,
328 &current->thread.vscr.u[3]);
329 break;
330 default:
331 return -EINVAL;
332 }
333 break;
334 case 46: /* vmaddfp */
335 vmaddfp(&vrs[vd], &vrs[va], &vrs[vb], &vrs[vc]);
336 break;
337 case 47: /* vnmsubfp */
338 vnmsubfp(&vrs[vd], &vrs[va], &vrs[vb], &vrs[vc]);
339 break;
340 default:
341 return -EINVAL;
342 }
343
344 return 0;
345}
diff --git a/arch/ppc/kernel/vector.S b/arch/ppc/kernel/vector.S
new file mode 100644
index 000000000000..82a21346bf80
--- /dev/null
+++ b/arch/ppc/kernel/vector.S
@@ -0,0 +1,217 @@
1#include <asm/ppc_asm.h>
2#include <asm/processor.h>
3
4/*
5 * The routines below are in assembler so we can closely control the
6 * usage of floating-point registers. These routines must be called
7 * with preempt disabled.
8 */
9 .data
10fpzero:
11 .long 0
12fpone:
13 .long 0x3f800000 /* 1.0 in single-precision FP */
14fphalf:
15 .long 0x3f000000 /* 0.5 in single-precision FP */
16
17 .text
18/*
19 * Internal routine to enable floating point and set FPSCR to 0.
20 * Don't call it from C; it doesn't use the normal calling convention.
21 */
22fpenable:
23 mfmsr r10
24 ori r11,r10,MSR_FP
25 mtmsr r11
26 isync
27 stfd fr0,24(r1)
28 stfd fr1,16(r1)
29 stfd fr31,8(r1)
30 lis r11,fpzero@ha
31 mffs fr31
32 lfs fr1,fpzero@l(r11)
33 mtfsf 0xff,fr1
34 blr
35
36fpdisable:
37 mtfsf 0xff,fr31
38 lfd fr31,8(r1)
39 lfd fr1,16(r1)
40 lfd fr0,24(r1)
41 mtmsr r10
42 isync
43 blr
44
45/*
46 * Vector add, floating point.
47 */
48 .globl vaddfp
49vaddfp:
50 stwu r1,-32(r1)
51 mflr r0
52 stw r0,36(r1)
53 bl fpenable
54 li r0,4
55 mtctr r0
56 li r6,0
571: lfsx fr0,r4,r6
58 lfsx fr1,r5,r6
59 fadds fr0,fr0,fr1
60 stfsx fr0,r3,r6
61 addi r6,r6,4
62 bdnz 1b
63 bl fpdisable
64 lwz r0,36(r1)
65 mtlr r0
66 addi r1,r1,32
67 blr
68
69/*
70 * Vector subtract, floating point.
71 */
72 .globl vsubfp
73vsubfp:
74 stwu r1,-32(r1)
75 mflr r0
76 stw r0,36(r1)
77 bl fpenable
78 li r0,4
79 mtctr r0
80 li r6,0
811: lfsx fr0,r4,r6
82 lfsx fr1,r5,r6
83 fsubs fr0,fr0,fr1
84 stfsx fr0,r3,r6
85 addi r6,r6,4
86 bdnz 1b
87 bl fpdisable
88 lwz r0,36(r1)
89 mtlr r0
90 addi r1,r1,32
91 blr
92
93/*
94 * Vector multiply and add, floating point.
95 */
96 .globl vmaddfp
97vmaddfp:
98 stwu r1,-48(r1)
99 mflr r0
100 stw r0,52(r1)
101 bl fpenable
102 stfd fr2,32(r1)
103 li r0,4
104 mtctr r0
105 li r7,0
1061: lfsx fr0,r4,r7
107 lfsx fr1,r5,r7
108 lfsx fr2,r6,r7
109 fmadds fr0,fr0,fr2,fr1
110 stfsx fr0,r3,r7
111 addi r7,r7,4
112 bdnz 1b
113 lfd fr2,32(r1)
114 bl fpdisable
115 lwz r0,52(r1)
116 mtlr r0
117 addi r1,r1,48
118 blr
119
120/*
121 * Vector negative multiply and subtract, floating point.
122 */
123 .globl vnmsubfp
124vnmsubfp:
125 stwu r1,-48(r1)
126 mflr r0
127 stw r0,52(r1)
128 bl fpenable
129 stfd fr2,32(r1)
130 li r0,4
131 mtctr r0
132 li r7,0
1331: lfsx fr0,r4,r7
134 lfsx fr1,r5,r7
135 lfsx fr2,r6,r7
136 fnmsubs fr0,fr0,fr2,fr1
137 stfsx fr0,r3,r7
138 addi r7,r7,4
139 bdnz 1b
140 lfd fr2,32(r1)
141 bl fpdisable
142 lwz r0,52(r1)
143 mtlr r0
144 addi r1,r1,48
145 blr
146
147/*
148 * Vector reciprocal estimate. We just compute 1.0/x.
149 * r3 -> destination, r4 -> source.
150 */
151 .globl vrefp
152vrefp:
153 stwu r1,-32(r1)
154 mflr r0
155 stw r0,36(r1)
156 bl fpenable
157 lis r9,fpone@ha
158 li r0,4
159 lfs fr1,fpone@l(r9)
160 mtctr r0
161 li r6,0
1621: lfsx fr0,r4,r6
163 fdivs fr0,fr1,fr0
164 stfsx fr0,r3,r6
165 addi r6,r6,4
166 bdnz 1b
167 bl fpdisable
168 lwz r0,36(r1)
169 mtlr r0
170 addi r1,r1,32
171 blr
172
173/*
174 * Vector reciprocal square-root estimate, floating point.
175 * We use the frsqrte instruction for the initial estimate followed
176 * by 2 iterations of Newton-Raphson to get sufficient accuracy.
177 * r3 -> destination, r4 -> source.
178 */
179 .globl vrsqrtefp
180vrsqrtefp:
181 stwu r1,-48(r1)
182 mflr r0
183 stw r0,52(r1)
184 bl fpenable
185 stfd fr2,32(r1)
186 stfd fr3,40(r1)
187 stfd fr4,48(r1)
188 stfd fr5,56(r1)
189 lis r9,fpone@ha
190 lis r8,fphalf@ha
191 li r0,4
192 lfs fr4,fpone@l(r9)
193 lfs fr5,fphalf@l(r8)
194 mtctr r0
195 li r6,0
1961: lfsx fr0,r4,r6
197 frsqrte fr1,fr0 /* r = frsqrte(s) */
198 fmuls fr3,fr1,fr0 /* r * s */
199 fmuls fr2,fr1,fr5 /* r * 0.5 */
200 fnmsubs fr3,fr1,fr3,fr4 /* 1 - s * r * r */
201 fmadds fr1,fr2,fr3,fr1 /* r = r + 0.5 * r * (1 - s * r * r) */
202 fmuls fr3,fr1,fr0 /* r * s */
203 fmuls fr2,fr1,fr5 /* r * 0.5 */
204 fnmsubs fr3,fr1,fr3,fr4 /* 1 - s * r * r */
205 fmadds fr1,fr2,fr3,fr1 /* r = r + 0.5 * r * (1 - s * r * r) */
206 stfsx fr1,r3,r6
207 addi r6,r6,4
208 bdnz 1b
209 lfd fr5,56(r1)
210 lfd fr4,48(r1)
211 lfd fr3,40(r1)
212 lfd fr2,32(r1)
213 bl fpdisable
214 lwz r0,36(r1)
215 mtlr r0
216 addi r1,r1,32
217 blr
diff --git a/arch/ppc/kernel/vmlinux.lds.S b/arch/ppc/kernel/vmlinux.lds.S
new file mode 100644
index 000000000000..0c0e714b84de
--- /dev/null
+++ b/arch/ppc/kernel/vmlinux.lds.S
@@ -0,0 +1,192 @@
1#include <asm-generic/vmlinux.lds.h>
2
3OUTPUT_ARCH(powerpc:common)
4jiffies = jiffies_64 + 4;
5SECTIONS
6{
7 /* Read-only sections, merged into text segment: */
8 . = + SIZEOF_HEADERS;
9 .interp : { *(.interp) }
10 .hash : { *(.hash) }
11 .dynsym : { *(.dynsym) }
12 .dynstr : { *(.dynstr) }
13 .rel.text : { *(.rel.text) }
14 .rela.text : { *(.rela.text) }
15 .rel.data : { *(.rel.data) }
16 .rela.data : { *(.rela.data) }
17 .rel.rodata : { *(.rel.rodata) }
18 .rela.rodata : { *(.rela.rodata) }
19 .rel.got : { *(.rel.got) }
20 .rela.got : { *(.rela.got) }
21 .rel.ctors : { *(.rel.ctors) }
22 .rela.ctors : { *(.rela.ctors) }
23 .rel.dtors : { *(.rel.dtors) }
24 .rela.dtors : { *(.rela.dtors) }
25 .rel.bss : { *(.rel.bss) }
26 .rela.bss : { *(.rela.bss) }
27 .rel.plt : { *(.rel.plt) }
28 .rela.plt : { *(.rela.plt) }
29/* .init : { *(.init) } =0*/
30 .plt : { *(.plt) }
31 .text :
32 {
33 *(.text)
34 SCHED_TEXT
35 LOCK_TEXT
36 *(.fixup)
37 *(.got1)
38 __got2_start = .;
39 *(.got2)
40 __got2_end = .;
41 }
42 _etext = .;
43 PROVIDE (etext = .);
44
45 RODATA
46 .fini : { *(.fini) } =0
47 .ctors : { *(.ctors) }
48 .dtors : { *(.dtors) }
49
50 .fixup : { *(.fixup) }
51
52 __ex_table : {
53 __start___ex_table = .;
54 *(__ex_table)
55 __stop___ex_table = .;
56 }
57
58 __bug_table : {
59 __start___bug_table = .;
60 *(__bug_table)
61 __stop___bug_table = .;
62 }
63
64 /* Read-write section, merged into data segment: */
65 . = ALIGN(4096);
66 .data :
67 {
68 *(.data)
69 *(.data1)
70 *(.sdata)
71 *(.sdata2)
72 *(.got.plt) *(.got)
73 *(.dynamic)
74 CONSTRUCTORS
75 }
76
77 . = ALIGN(4096);
78 __nosave_begin = .;
79 .data_nosave : { *(.data.nosave) }
80 . = ALIGN(4096);
81 __nosave_end = .;
82
83 . = ALIGN(32);
84 .data.cacheline_aligned : { *(.data.cacheline_aligned) }
85
86 _edata = .;
87 PROVIDE (edata = .);
88
89 . = ALIGN(8192);
90 .data.init_task : { *(.data.init_task) }
91
92 . = ALIGN(4096);
93 __init_begin = .;
94 .init.text : {
95 _sinittext = .;
96 *(.init.text)
97 _einittext = .;
98 }
99 .init.data : {
100 *(.init.data);
101 __vtop_table_begin = .;
102 *(.vtop_fixup);
103 __vtop_table_end = .;
104 __ptov_table_begin = .;
105 *(.ptov_fixup);
106 __ptov_table_end = .;
107 }
108 . = ALIGN(16);
109 __setup_start = .;
110 .init.setup : { *(.init.setup) }
111 __setup_end = .;
112 __initcall_start = .;
113 .initcall.init : {
114 *(.initcall1.init)
115 *(.initcall2.init)
116 *(.initcall3.init)
117 *(.initcall4.init)
118 *(.initcall5.init)
119 *(.initcall6.init)
120 *(.initcall7.init)
121 }
122 __initcall_end = .;
123
124 __con_initcall_start = .;
125 .con_initcall.init : { *(.con_initcall.init) }
126 __con_initcall_end = .;
127
128 SECURITY_INIT
129
130 __start___ftr_fixup = .;
131 __ftr_fixup : { *(__ftr_fixup) }
132 __stop___ftr_fixup = .;
133
134 . = ALIGN(32);
135 __per_cpu_start = .;
136 .data.percpu : { *(.data.percpu) }
137 __per_cpu_end = .;
138
139 . = ALIGN(4096);
140 __initramfs_start = .;
141 .init.ramfs : { *(.init.ramfs) }
142 __initramfs_end = .;
143
144 . = ALIGN(4096);
145 __init_end = .;
146
147 . = ALIGN(4096);
148 __pmac_begin = .;
149 .pmac.text : { *(.pmac.text) }
150 .pmac.data : { *(.pmac.data) }
151 . = ALIGN(4096);
152 __pmac_end = .;
153
154 . = ALIGN(4096);
155 __prep_begin = .;
156 .prep.text : { *(.prep.text) }
157 .prep.data : { *(.prep.data) }
158 . = ALIGN(4096);
159 __prep_end = .;
160
161 . = ALIGN(4096);
162 __chrp_begin = .;
163 .chrp.text : { *(.chrp.text) }
164 .chrp.data : { *(.chrp.data) }
165 . = ALIGN(4096);
166 __chrp_end = .;
167
168 . = ALIGN(4096);
169 __openfirmware_begin = .;
170 .openfirmware.text : { *(.openfirmware.text) }
171 .openfirmware.data : { *(.openfirmware.data) }
172 . = ALIGN(4096);
173 __openfirmware_end = .;
174
175 __bss_start = .;
176 .bss :
177 {
178 *(.sbss) *(.scommon)
179 *(.dynbss)
180 *(.bss)
181 *(COMMON)
182 }
183 __bss_stop = .;
184
185 _end = . ;
186 PROVIDE (end = .);
187
188 /* Sections to be discarded. */
189 /DISCARD/ : {
190 *(.exitcall.exit)
191 }
192}
diff --git a/arch/ppc/lib/Makefile b/arch/ppc/lib/Makefile
new file mode 100644
index 000000000000..1c380e67d435
--- /dev/null
+++ b/arch/ppc/lib/Makefile
@@ -0,0 +1,9 @@
1#
2# Makefile for ppc-specific library files..
3#
4
5obj-y := checksum.o string.o strcase.o dec_and_lock.o div64.o
6
7obj-$(CONFIG_SMP) += locks.o
8obj-$(CONFIG_8xx) += rheap.o
9obj-$(CONFIG_CPM2) += rheap.o
diff --git a/arch/ppc/lib/checksum.S b/arch/ppc/lib/checksum.S
new file mode 100644
index 000000000000..7874e8a80455
--- /dev/null
+++ b/arch/ppc/lib/checksum.S
@@ -0,0 +1,225 @@
1/*
2 * This file contains assembly-language implementations
3 * of IP-style 1's complement checksum routines.
4 *
5 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 *
12 * Severely hacked about by Paul Mackerras (paulus@cs.anu.edu.au).
13 */
14
15#include <linux/sys.h>
16#include <asm/processor.h>
17#include <asm/errno.h>
18#include <asm/ppc_asm.h>
19
20 .text
21
22/*
23 * ip_fast_csum(buf, len) -- Optimized for IP header
24 * len is in words and is always >= 5.
25 */
26_GLOBAL(ip_fast_csum)
27 lwz r0,0(r3)
28 lwzu r5,4(r3)
29 addic. r4,r4,-2
30 addc r0,r0,r5
31 mtctr r4
32 blelr-
331: lwzu r4,4(r3)
34 adde r0,r0,r4
35 bdnz 1b
36 addze r0,r0 /* add in final carry */
37 rlwinm r3,r0,16,0,31 /* fold two halves together */
38 add r3,r0,r3
39 not r3,r3
40 srwi r3,r3,16
41 blr
42
43/*
44 * Compute checksum of TCP or UDP pseudo-header:
45 * csum_tcpudp_magic(saddr, daddr, len, proto, sum)
46 */
47_GLOBAL(csum_tcpudp_magic)
48 rlwimi r5,r6,16,0,15 /* put proto in upper half of len */
49 addc r0,r3,r4 /* add 4 32-bit words together */
50 adde r0,r0,r5
51 adde r0,r0,r7
52 addze r0,r0 /* add in final carry */
53 rlwinm r3,r0,16,0,31 /* fold two halves together */
54 add r3,r0,r3
55 not r3,r3
56 srwi r3,r3,16
57 blr
58
59/*
60 * computes the checksum of a memory block at buff, length len,
61 * and adds in "sum" (32-bit)
62 *
63 * csum_partial(buff, len, sum)
64 */
65_GLOBAL(csum_partial)
66 addic r0,r5,0
67 subi r3,r3,4
68 srwi. r6,r4,2
69 beq 3f /* if we're doing < 4 bytes */
70 andi. r5,r3,2 /* Align buffer to longword boundary */
71 beq+ 1f
72 lhz r5,4(r3) /* do 2 bytes to get aligned */
73 addi r3,r3,2
74 subi r4,r4,2
75 addc r0,r0,r5
76 srwi. r6,r4,2 /* # words to do */
77 beq 3f
781: mtctr r6
792: lwzu r5,4(r3) /* the bdnz has zero overhead, so it should */
80 adde r0,r0,r5 /* be unnecessary to unroll this loop */
81 bdnz 2b
82 andi. r4,r4,3
833: cmpwi 0,r4,2
84 blt+ 4f
85 lhz r5,4(r3)
86 addi r3,r3,2
87 subi r4,r4,2
88 adde r0,r0,r5
894: cmpwi 0,r4,1
90 bne+ 5f
91 lbz r5,4(r3)
92 slwi r5,r5,8 /* Upper byte of word */
93 adde r0,r0,r5
945: addze r3,r0 /* add in final carry */
95 blr
96
97/*
98 * Computes the checksum of a memory block at src, length len,
99 * and adds in "sum" (32-bit), while copying the block to dst.
100 * If an access exception occurs on src or dst, it stores -EFAULT
101 * to *src_err or *dst_err respectively, and (for an error on
102 * src) zeroes the rest of dst.
103 *
104 * csum_partial_copy_generic(src, dst, len, sum, src_err, dst_err)
105 */
106_GLOBAL(csum_partial_copy_generic)
107 addic r0,r6,0
108 subi r3,r3,4
109 subi r4,r4,4
110 srwi. r6,r5,2
111 beq 3f /* if we're doing < 4 bytes */
112 andi. r9,r4,2 /* Align dst to longword boundary */
113 beq+ 1f
11481: lhz r6,4(r3) /* do 2 bytes to get aligned */
115 addi r3,r3,2
116 subi r5,r5,2
11791: sth r6,4(r4)
118 addi r4,r4,2
119 addc r0,r0,r6
120 srwi. r6,r5,2 /* # words to do */
121 beq 3f
1221: srwi. r6,r5,4 /* # groups of 4 words to do */
123 beq 10f
124 mtctr r6
12571: lwz r6,4(r3)
12672: lwz r9,8(r3)
12773: lwz r10,12(r3)
12874: lwzu r11,16(r3)
129 adde r0,r0,r6
13075: stw r6,4(r4)
131 adde r0,r0,r9
13276: stw r9,8(r4)
133 adde r0,r0,r10
13477: stw r10,12(r4)
135 adde r0,r0,r11
13678: stwu r11,16(r4)
137 bdnz 71b
13810: rlwinm. r6,r5,30,30,31 /* # words left to do */
139 beq 13f
140 mtctr r6
14182: lwzu r9,4(r3)
14292: stwu r9,4(r4)
143 adde r0,r0,r9
144 bdnz 82b
14513: andi. r5,r5,3
1463: cmpwi 0,r5,2
147 blt+ 4f
14883: lhz r6,4(r3)
149 addi r3,r3,2
150 subi r5,r5,2
15193: sth r6,4(r4)
152 addi r4,r4,2
153 adde r0,r0,r6
1544: cmpwi 0,r5,1
155 bne+ 5f
15684: lbz r6,4(r3)
15794: stb r6,4(r4)
158 slwi r6,r6,8 /* Upper byte of word */
159 adde r0,r0,r6
1605: addze r3,r0 /* add in final carry */
161 blr
162
163/* These shouldn't go in the fixup section, since that would
164 cause the ex_table addresses to get out of order. */
165
166src_error_4:
167 mfctr r6 /* update # bytes remaining from ctr */
168 rlwimi r5,r6,4,0,27
169 b 79f
170src_error_1:
171 li r6,0
172 subi r5,r5,2
17395: sth r6,4(r4)
174 addi r4,r4,2
17579: srwi. r6,r5,2
176 beq 3f
177 mtctr r6
178src_error_2:
179 li r6,0
18096: stwu r6,4(r4)
181 bdnz 96b
1823: andi. r5,r5,3
183 beq src_error
184src_error_3:
185 li r6,0
186 mtctr r5
187 addi r4,r4,3
18897: stbu r6,1(r4)
189 bdnz 97b
190src_error:
191 cmpwi 0,r7,0
192 beq 1f
193 li r6,-EFAULT
194 stw r6,0(r7)
1951: addze r3,r0
196 blr
197
198dst_error:
199 cmpwi 0,r8,0
200 beq 1f
201 li r6,-EFAULT
202 stw r6,0(r8)
2031: addze r3,r0
204 blr
205
206.section __ex_table,"a"
207 .long 81b,src_error_1
208 .long 91b,dst_error
209 .long 71b,src_error_4
210 .long 72b,src_error_4
211 .long 73b,src_error_4
212 .long 74b,src_error_4
213 .long 75b,dst_error
214 .long 76b,dst_error
215 .long 77b,dst_error
216 .long 78b,dst_error
217 .long 82b,src_error_2
218 .long 92b,dst_error
219 .long 83b,src_error_3
220 .long 93b,dst_error
221 .long 84b,src_error_3
222 .long 94b,dst_error
223 .long 95b,dst_error
224 .long 96b,dst_error
225 .long 97b,dst_error
diff --git a/arch/ppc/lib/dec_and_lock.c b/arch/ppc/lib/dec_and_lock.c
new file mode 100644
index 000000000000..4ee888070d91
--- /dev/null
+++ b/arch/ppc/lib/dec_and_lock.c
@@ -0,0 +1,46 @@
1#include <linux/module.h>
2#include <linux/spinlock.h>
3#include <asm/atomic.h>
4#include <asm/system.h>
5
6/*
7 * This is an implementation of the notion of "decrement a
8 * reference count, and return locked if it decremented to zero".
9 *
10 * This implementation can be used on any architecture that
11 * has a cmpxchg, and where atomic->value is an int holding
12 * the value of the atomic (i.e. the high bits aren't used
13 * for a lock or anything like that).
14 *
15 * N.B. ATOMIC_DEC_AND_LOCK gets defined in include/linux/spinlock.h
16 * if spinlocks are empty and thus atomic_dec_and_lock is defined
17 * to be atomic_dec_and_test - in that case we don't need it
18 * defined here as well.
19 */
20
21#ifndef ATOMIC_DEC_AND_LOCK
22int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock)
23{
24 int counter;
25 int newcount;
26
27 for (;;) {
28 counter = atomic_read(atomic);
29 newcount = counter - 1;
30 if (!newcount)
31 break; /* do it the slow way */
32
33 newcount = cmpxchg(&atomic->counter, counter, newcount);
34 if (newcount == counter)
35 return 0;
36 }
37
38 spin_lock(lock);
39 if (atomic_dec_and_test(atomic))
40 return 1;
41 spin_unlock(lock);
42 return 0;
43}
44
45EXPORT_SYMBOL(_atomic_dec_and_lock);
46#endif /* ATOMIC_DEC_AND_LOCK */
diff --git a/arch/ppc/lib/div64.S b/arch/ppc/lib/div64.S
new file mode 100644
index 000000000000..3527569e9926
--- /dev/null
+++ b/arch/ppc/lib/div64.S
@@ -0,0 +1,58 @@
1/*
2 * Divide a 64-bit unsigned number by a 32-bit unsigned number.
3 * This routine assumes that the top 32 bits of the dividend are
4 * non-zero to start with.
5 * On entry, r3 points to the dividend, which get overwritten with
6 * the 64-bit quotient, and r4 contains the divisor.
7 * On exit, r3 contains the remainder.
8 *
9 * Copyright (C) 2002 Paul Mackerras, IBM Corp.
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version
14 * 2 of the License, or (at your option) any later version.
15 */
16#include <asm/ppc_asm.h>
17#include <asm/processor.h>
18
19_GLOBAL(__div64_32)
20 lwz r5,0(r3) # get the dividend into r5/r6
21 lwz r6,4(r3)
22 cmplw r5,r4
23 li r7,0
24 li r8,0
25 blt 1f
26 divwu r7,r5,r4 # if dividend.hi >= divisor,
27 mullw r0,r7,r4 # quotient.hi = dividend.hi / divisor
28 subf. r5,r0,r5 # dividend.hi %= divisor
29 beq 3f
301: mr r11,r5 # here dividend.hi != 0
31 andis. r0,r5,0xc000
32 bne 2f
33 cntlzw r0,r5 # we are shifting the dividend right
34 li r10,-1 # to make it < 2^32, and shifting
35 srw r10,r10,r0 # the divisor right the same amount,
36 add r9,r4,r10 # rounding up (so the estimate cannot
37 andc r11,r6,r10 # ever be too large, only too small)
38 andc r9,r9,r10
39 or r11,r5,r11
40 rotlw r9,r9,r0
41 rotlw r11,r11,r0
42 divwu r11,r11,r9 # then we divide the shifted quantities
432: mullw r10,r11,r4 # to get an estimate of the quotient,
44 mulhwu r9,r11,r4 # multiply the estimate by the divisor,
45 subfc r6,r10,r6 # take the product from the divisor,
46 add r8,r8,r11 # and add the estimate to the accumulated
47 subfe. r5,r9,r5 # quotient
48 bne 1b
493: cmplw r6,r4
50 blt 4f
51 divwu r0,r6,r4 # perform the remaining 32-bit division
52 mullw r10,r0,r4 # and get the remainder
53 add r8,r8,r0
54 subf r6,r10,r6
554: stw r7,0(r3) # return the quotient in *r3
56 stw r8,4(r3)
57 mr r3,r6 # return the remainder in r3
58 blr
diff --git a/arch/ppc/lib/locks.c b/arch/ppc/lib/locks.c
new file mode 100644
index 000000000000..694163d696d8
--- /dev/null
+++ b/arch/ppc/lib/locks.c
@@ -0,0 +1,190 @@
1/*
2 * Locks for smp ppc
3 *
4 * Written by Cort Dougan (cort@cs.nmt.edu)
5 */
6
7#include <linux/config.h>
8#include <linux/sched.h>
9#include <linux/spinlock.h>
10#include <linux/module.h>
11#include <asm/ppc_asm.h>
12#include <asm/smp.h>
13
14#ifdef CONFIG_DEBUG_SPINLOCK
15
16#undef INIT_STUCK
17#define INIT_STUCK 200000000 /*0xffffffff*/
18
19/*
20 * Try to acquire a spinlock.
21 * Only does the stwcx. if the load returned 0 - the Programming
22 * Environments Manual suggests not doing unnecessary stcwx.'s
23 * since they may inhibit forward progress by other CPUs in getting
24 * a lock.
25 */
26static inline unsigned long __spin_trylock(volatile unsigned long *lock)
27{
28 unsigned long ret;
29
30 __asm__ __volatile__ ("\n\
311: lwarx %0,0,%1\n\
32 cmpwi 0,%0,0\n\
33 bne 2f\n"
34 PPC405_ERR77(0,%1)
35" stwcx. %2,0,%1\n\
36 bne- 1b\n\
37 isync\n\
382:"
39 : "=&r"(ret)
40 : "r"(lock), "r"(1)
41 : "cr0", "memory");
42
43 return ret;
44}
45
46void _raw_spin_lock(spinlock_t *lock)
47{
48 int cpu = smp_processor_id();
49 unsigned int stuck = INIT_STUCK;
50 while (__spin_trylock(&lock->lock)) {
51 while ((unsigned volatile long)lock->lock != 0) {
52 if (!--stuck) {
53 printk("_spin_lock(%p) CPU#%d NIP %p"
54 " holder: cpu %ld pc %08lX\n",
55 lock, cpu, __builtin_return_address(0),
56 lock->owner_cpu,lock->owner_pc);
57 stuck = INIT_STUCK;
58 /* steal the lock */
59 /*xchg_u32((void *)&lock->lock,0);*/
60 }
61 }
62 }
63 lock->owner_pc = (unsigned long)__builtin_return_address(0);
64 lock->owner_cpu = cpu;
65}
66EXPORT_SYMBOL(_raw_spin_lock);
67
68int _raw_spin_trylock(spinlock_t *lock)
69{
70 if (__spin_trylock(&lock->lock))
71 return 0;
72 lock->owner_cpu = smp_processor_id();
73 lock->owner_pc = (unsigned long)__builtin_return_address(0);
74 return 1;
75}
76EXPORT_SYMBOL(_raw_spin_trylock);
77
78void _raw_spin_unlock(spinlock_t *lp)
79{
80 if ( !lp->lock )
81 printk("_spin_unlock(%p): no lock cpu %d curr PC %p %s/%d\n",
82 lp, smp_processor_id(), __builtin_return_address(0),
83 current->comm, current->pid);
84 if ( lp->owner_cpu != smp_processor_id() )
85 printk("_spin_unlock(%p): cpu %d trying clear of cpu %d pc %lx val %lx\n",
86 lp, smp_processor_id(), (int)lp->owner_cpu,
87 lp->owner_pc,lp->lock);
88 lp->owner_pc = lp->owner_cpu = 0;
89 wmb();
90 lp->lock = 0;
91}
92EXPORT_SYMBOL(_raw_spin_unlock);
93
94/*
95 * For rwlocks, zero is unlocked, -1 is write-locked,
96 * positive is read-locked.
97 */
98static __inline__ int __read_trylock(rwlock_t *rw)
99{
100 signed int tmp;
101
102 __asm__ __volatile__(
103"2: lwarx %0,0,%1 # __read_trylock\n\
104 addic. %0,%0,1\n\
105 ble- 1f\n"
106 PPC405_ERR77(0,%1)
107" stwcx. %0,0,%1\n\
108 bne- 2b\n\
109 isync\n\
1101:"
111 : "=&r"(tmp)
112 : "r"(&rw->lock)
113 : "cr0", "memory");
114
115 return tmp;
116}
117
118int _raw_read_trylock(rwlock_t *rw)
119{
120 return __read_trylock(rw) > 0;
121}
122EXPORT_SYMBOL(_raw_read_trylock);
123
124void _raw_read_lock(rwlock_t *rw)
125{
126 unsigned int stuck;
127
128 while (__read_trylock(rw) <= 0) {
129 stuck = INIT_STUCK;
130 while (!read_can_lock(rw)) {
131 if (--stuck == 0) {
132 printk("_read_lock(%p) CPU#%d lock %d\n",
133 rw, _smp_processor_id(), rw->lock);
134 stuck = INIT_STUCK;
135 }
136 }
137 }
138}
139EXPORT_SYMBOL(_raw_read_lock);
140
141void _raw_read_unlock(rwlock_t *rw)
142{
143 if ( rw->lock == 0 )
144 printk("_read_unlock(): %s/%d (nip %08lX) lock %d\n",
145 current->comm,current->pid,current->thread.regs->nip,
146 rw->lock);
147 wmb();
148 atomic_dec((atomic_t *) &(rw)->lock);
149}
150EXPORT_SYMBOL(_raw_read_unlock);
151
152void _raw_write_lock(rwlock_t *rw)
153{
154 unsigned int stuck;
155
156 while (cmpxchg(&rw->lock, 0, -1) != 0) {
157 stuck = INIT_STUCK;
158 while (!write_can_lock(rw)) {
159 if (--stuck == 0) {
160 printk("write_lock(%p) CPU#%d lock %d)\n",
161 rw, _smp_processor_id(), rw->lock);
162 stuck = INIT_STUCK;
163 }
164 }
165 }
166 wmb();
167}
168EXPORT_SYMBOL(_raw_write_lock);
169
170int _raw_write_trylock(rwlock_t *rw)
171{
172 if (cmpxchg(&rw->lock, 0, -1) != 0)
173 return 0;
174 wmb();
175 return 1;
176}
177EXPORT_SYMBOL(_raw_write_trylock);
178
179void _raw_write_unlock(rwlock_t *rw)
180{
181 if (rw->lock >= 0)
182 printk("_write_lock(): %s/%d (nip %08lX) lock %d\n",
183 current->comm,current->pid,current->thread.regs->nip,
184 rw->lock);
185 wmb();
186 rw->lock = 0;
187}
188EXPORT_SYMBOL(_raw_write_unlock);
189
190#endif
diff --git a/arch/ppc/lib/rheap.c b/arch/ppc/lib/rheap.c
new file mode 100644
index 000000000000..42c5de2c898f
--- /dev/null
+++ b/arch/ppc/lib/rheap.c
@@ -0,0 +1,693 @@
1/*
2 * arch/ppc/syslib/rheap.c
3 *
4 * A Remote Heap. Remote means that we don't touch the memory that the
5 * heap points to. Normal heap implementations use the memory they manage
6 * to place their list. We cannot do that because the memory we manage may
7 * have special properties, for example it is uncachable or of different
8 * endianess.
9 *
10 * Author: Pantelis Antoniou <panto@intracom.gr>
11 *
12 * 2004 (c) INTRACOM S.A. Greece. This file is licensed under
13 * the terms of the GNU General Public License version 2. This program
14 * is licensed "as is" without any warranty of any kind, whether express
15 * or implied.
16 */
17#include <linux/types.h>
18#include <linux/errno.h>
19#include <linux/mm.h>
20#include <linux/slab.h>
21
22#include <asm/rheap.h>
23
24/*
25 * Fixup a list_head, needed when copying lists. If the pointers fall
26 * between s and e, apply the delta. This assumes that
27 * sizeof(struct list_head *) == sizeof(unsigned long *).
28 */
29static inline void fixup(unsigned long s, unsigned long e, int d,
30 struct list_head *l)
31{
32 unsigned long *pp;
33
34 pp = (unsigned long *)&l->next;
35 if (*pp >= s && *pp < e)
36 *pp += d;
37
38 pp = (unsigned long *)&l->prev;
39 if (*pp >= s && *pp < e)
40 *pp += d;
41}
42
43/* Grow the allocated blocks */
44static int grow(rh_info_t * info, int max_blocks)
45{
46 rh_block_t *block, *blk;
47 int i, new_blocks;
48 int delta;
49 unsigned long blks, blke;
50
51 if (max_blocks <= info->max_blocks)
52 return -EINVAL;
53
54 new_blocks = max_blocks - info->max_blocks;
55
56 block = kmalloc(sizeof(rh_block_t) * max_blocks, GFP_KERNEL);
57 if (block == NULL)
58 return -ENOMEM;
59
60 if (info->max_blocks > 0) {
61
62 /* copy old block area */
63 memcpy(block, info->block,
64 sizeof(rh_block_t) * info->max_blocks);
65
66 delta = (char *)block - (char *)info->block;
67
68 /* and fixup list pointers */
69 blks = (unsigned long)info->block;
70 blke = (unsigned long)(info->block + info->max_blocks);
71
72 for (i = 0, blk = block; i < info->max_blocks; i++, blk++)
73 fixup(blks, blke, delta, &blk->list);
74
75 fixup(blks, blke, delta, &info->empty_list);
76 fixup(blks, blke, delta, &info->free_list);
77 fixup(blks, blke, delta, &info->taken_list);
78
79 /* free the old allocated memory */
80 if ((info->flags & RHIF_STATIC_BLOCK) == 0)
81 kfree(info->block);
82 }
83
84 info->block = block;
85 info->empty_slots += new_blocks;
86 info->max_blocks = max_blocks;
87 info->flags &= ~RHIF_STATIC_BLOCK;
88
89 /* add all new blocks to the free list */
90 for (i = 0, blk = block + info->max_blocks; i < new_blocks; i++, blk++)
91 list_add(&blk->list, &info->empty_list);
92
93 return 0;
94}
95
96/*
97 * Assure at least the required amount of empty slots. If this function
98 * causes a grow in the block area then all pointers kept to the block
99 * area are invalid!
100 */
101static int assure_empty(rh_info_t * info, int slots)
102{
103 int max_blocks;
104
105 /* This function is not meant to be used to grow uncontrollably */
106 if (slots >= 4)
107 return -EINVAL;
108
109 /* Enough space */
110 if (info->empty_slots >= slots)
111 return 0;
112
113 /* Next 16 sized block */
114 max_blocks = ((info->max_blocks + slots) + 15) & ~15;
115
116 return grow(info, max_blocks);
117}
118
119static rh_block_t *get_slot(rh_info_t * info)
120{
121 rh_block_t *blk;
122
123 /* If no more free slots, and failure to extend. */
124 /* XXX: You should have called assure_empty before */
125 if (info->empty_slots == 0) {
126 printk(KERN_ERR "rh: out of slots; crash is imminent.\n");
127 return NULL;
128 }
129
130 /* Get empty slot to use */
131 blk = list_entry(info->empty_list.next, rh_block_t, list);
132 list_del_init(&blk->list);
133 info->empty_slots--;
134
135 /* Initialize */
136 blk->start = NULL;
137 blk->size = 0;
138 blk->owner = NULL;
139
140 return blk;
141}
142
143static inline void release_slot(rh_info_t * info, rh_block_t * blk)
144{
145 list_add(&blk->list, &info->empty_list);
146 info->empty_slots++;
147}
148
149static void attach_free_block(rh_info_t * info, rh_block_t * blkn)
150{
151 rh_block_t *blk;
152 rh_block_t *before;
153 rh_block_t *after;
154 rh_block_t *next;
155 int size;
156 unsigned long s, e, bs, be;
157 struct list_head *l;
158
159 /* We assume that they are aligned properly */
160 size = blkn->size;
161 s = (unsigned long)blkn->start;
162 e = s + size;
163
164 /* Find the blocks immediately before and after the given one
165 * (if any) */
166 before = NULL;
167 after = NULL;
168 next = NULL;
169
170 list_for_each(l, &info->free_list) {
171 blk = list_entry(l, rh_block_t, list);
172
173 bs = (unsigned long)blk->start;
174 be = bs + blk->size;
175
176 if (next == NULL && s >= bs)
177 next = blk;
178
179 if (be == s)
180 before = blk;
181
182 if (e == bs)
183 after = blk;
184
185 /* If both are not null, break now */
186 if (before != NULL && after != NULL)
187 break;
188 }
189
190 /* Now check if they are really adjacent */
191 if (before != NULL && s != (unsigned long)before->start + before->size)
192 before = NULL;
193
194 if (after != NULL && e != (unsigned long)after->start)
195 after = NULL;
196
197 /* No coalescing; list insert and return */
198 if (before == NULL && after == NULL) {
199
200 if (next != NULL)
201 list_add(&blkn->list, &next->list);
202 else
203 list_add(&blkn->list, &info->free_list);
204
205 return;
206 }
207
208 /* We don't need it anymore */
209 release_slot(info, blkn);
210
211 /* Grow the before block */
212 if (before != NULL && after == NULL) {
213 before->size += size;
214 return;
215 }
216
217 /* Grow the after block backwards */
218 if (before == NULL && after != NULL) {
219 after->start = (int8_t *)after->start - size;
220 after->size += size;
221 return;
222 }
223
224 /* Grow the before block, and release the after block */
225 before->size += size + after->size;
226 list_del(&after->list);
227 release_slot(info, after);
228}
229
230static void attach_taken_block(rh_info_t * info, rh_block_t * blkn)
231{
232 rh_block_t *blk;
233 struct list_head *l;
234
235 /* Find the block immediately before the given one (if any) */
236 list_for_each(l, &info->taken_list) {
237 blk = list_entry(l, rh_block_t, list);
238 if (blk->start > blkn->start) {
239 list_add_tail(&blkn->list, &blk->list);
240 return;
241 }
242 }
243
244 list_add_tail(&blkn->list, &info->taken_list);
245}
246
247/*
248 * Create a remote heap dynamically. Note that no memory for the blocks
249 * are allocated. It will upon the first allocation
250 */
251rh_info_t *rh_create(unsigned int alignment)
252{
253 rh_info_t *info;
254
255 /* Alignment must be a power of two */
256 if ((alignment & (alignment - 1)) != 0)
257 return ERR_PTR(-EINVAL);
258
259 info = kmalloc(sizeof(*info), GFP_KERNEL);
260 if (info == NULL)
261 return ERR_PTR(-ENOMEM);
262
263 info->alignment = alignment;
264
265 /* Initially everything as empty */
266 info->block = NULL;
267 info->max_blocks = 0;
268 info->empty_slots = 0;
269 info->flags = 0;
270
271 INIT_LIST_HEAD(&info->empty_list);
272 INIT_LIST_HEAD(&info->free_list);
273 INIT_LIST_HEAD(&info->taken_list);
274
275 return info;
276}
277
278/*
279 * Destroy a dynamically created remote heap. Deallocate only if the areas
280 * are not static
281 */
282void rh_destroy(rh_info_t * info)
283{
284 if ((info->flags & RHIF_STATIC_BLOCK) == 0 && info->block != NULL)
285 kfree(info->block);
286
287 if ((info->flags & RHIF_STATIC_INFO) == 0)
288 kfree(info);
289}
290
291/*
292 * Initialize in place a remote heap info block. This is needed to support
293 * operation very early in the startup of the kernel, when it is not yet safe
294 * to call kmalloc.
295 */
296void rh_init(rh_info_t * info, unsigned int alignment, int max_blocks,
297 rh_block_t * block)
298{
299 int i;
300 rh_block_t *blk;
301
302 /* Alignment must be a power of two */
303 if ((alignment & (alignment - 1)) != 0)
304 return;
305
306 info->alignment = alignment;
307
308 /* Initially everything as empty */
309 info->block = block;
310 info->max_blocks = max_blocks;
311 info->empty_slots = max_blocks;
312 info->flags = RHIF_STATIC_INFO | RHIF_STATIC_BLOCK;
313
314 INIT_LIST_HEAD(&info->empty_list);
315 INIT_LIST_HEAD(&info->free_list);
316 INIT_LIST_HEAD(&info->taken_list);
317
318 /* Add all new blocks to the free list */
319 for (i = 0, blk = block; i < max_blocks; i++, blk++)
320 list_add(&blk->list, &info->empty_list);
321}
322
323/* Attach a free memory region, coalesces regions if adjuscent */
324int rh_attach_region(rh_info_t * info, void *start, int size)
325{
326 rh_block_t *blk;
327 unsigned long s, e, m;
328 int r;
329
330 /* The region must be aligned */
331 s = (unsigned long)start;
332 e = s + size;
333 m = info->alignment - 1;
334
335 /* Round start up */
336 s = (s + m) & ~m;
337
338 /* Round end down */
339 e = e & ~m;
340
341 /* Take final values */
342 start = (void *)s;
343 size = (int)(e - s);
344
345 /* Grow the blocks, if needed */
346 r = assure_empty(info, 1);
347 if (r < 0)
348 return r;
349
350 blk = get_slot(info);
351 blk->start = start;
352 blk->size = size;
353 blk->owner = NULL;
354
355 attach_free_block(info, blk);
356
357 return 0;
358}
359
360/* Detatch given address range, splits free block if needed. */
361void *rh_detach_region(rh_info_t * info, void *start, int size)
362{
363 struct list_head *l;
364 rh_block_t *blk, *newblk;
365 unsigned long s, e, m, bs, be;
366
367 /* Validate size */
368 if (size <= 0)
369 return ERR_PTR(-EINVAL);
370
371 /* The region must be aligned */
372 s = (unsigned long)start;
373 e = s + size;
374 m = info->alignment - 1;
375
376 /* Round start up */
377 s = (s + m) & ~m;
378
379 /* Round end down */
380 e = e & ~m;
381
382 if (assure_empty(info, 1) < 0)
383 return ERR_PTR(-ENOMEM);
384
385 blk = NULL;
386 list_for_each(l, &info->free_list) {
387 blk = list_entry(l, rh_block_t, list);
388 /* The range must lie entirely inside one free block */
389 bs = (unsigned long)blk->start;
390 be = (unsigned long)blk->start + blk->size;
391 if (s >= bs && e <= be)
392 break;
393 blk = NULL;
394 }
395
396 if (blk == NULL)
397 return ERR_PTR(-ENOMEM);
398
399 /* Perfect fit */
400 if (bs == s && be == e) {
401 /* Delete from free list, release slot */
402 list_del(&blk->list);
403 release_slot(info, blk);
404 return (void *)s;
405 }
406
407 /* blk still in free list, with updated start and/or size */
408 if (bs == s || be == e) {
409 if (bs == s)
410 blk->start = (int8_t *)blk->start + size;
411 blk->size -= size;
412
413 } else {
414 /* The front free fragment */
415 blk->size = s - bs;
416
417 /* the back free fragment */
418 newblk = get_slot(info);
419 newblk->start = (void *)e;
420 newblk->size = be - e;
421
422 list_add(&newblk->list, &blk->list);
423 }
424
425 return (void *)s;
426}
427
428void *rh_alloc(rh_info_t * info, int size, const char *owner)
429{
430 struct list_head *l;
431 rh_block_t *blk;
432 rh_block_t *newblk;
433 void *start;
434
435 /* Validate size */
436 if (size <= 0)
437 return ERR_PTR(-EINVAL);
438
439 /* Align to configured alignment */
440 size = (size + (info->alignment - 1)) & ~(info->alignment - 1);
441
442 if (assure_empty(info, 1) < 0)
443 return ERR_PTR(-ENOMEM);
444
445 blk = NULL;
446 list_for_each(l, &info->free_list) {
447 blk = list_entry(l, rh_block_t, list);
448 if (size <= blk->size)
449 break;
450 blk = NULL;
451 }
452
453 if (blk == NULL)
454 return ERR_PTR(-ENOMEM);
455
456 /* Just fits */
457 if (blk->size == size) {
458 /* Move from free list to taken list */
459 list_del(&blk->list);
460 blk->owner = owner;
461 start = blk->start;
462
463 attach_taken_block(info, blk);
464
465 return start;
466 }
467
468 newblk = get_slot(info);
469 newblk->start = blk->start;
470 newblk->size = size;
471 newblk->owner = owner;
472
473 /* blk still in free list, with updated start, size */
474 blk->start = (int8_t *)blk->start + size;
475 blk->size -= size;
476
477 start = newblk->start;
478
479 attach_taken_block(info, newblk);
480
481 return start;
482}
483
484/* allocate at precisely the given address */
485void *rh_alloc_fixed(rh_info_t * info, void *start, int size, const char *owner)
486{
487 struct list_head *l;
488 rh_block_t *blk, *newblk1, *newblk2;
489 unsigned long s, e, m, bs, be;
490
491 /* Validate size */
492 if (size <= 0)
493 return ERR_PTR(-EINVAL);
494
495 /* The region must be aligned */
496 s = (unsigned long)start;
497 e = s + size;
498 m = info->alignment - 1;
499
500 /* Round start up */
501 s = (s + m) & ~m;
502
503 /* Round end down */
504 e = e & ~m;
505
506 if (assure_empty(info, 2) < 0)
507 return ERR_PTR(-ENOMEM);
508
509 blk = NULL;
510 list_for_each(l, &info->free_list) {
511 blk = list_entry(l, rh_block_t, list);
512 /* The range must lie entirely inside one free block */
513 bs = (unsigned long)blk->start;
514 be = (unsigned long)blk->start + blk->size;
515 if (s >= bs && e <= be)
516 break;
517 }
518
519 if (blk == NULL)
520 return ERR_PTR(-ENOMEM);
521
522 /* Perfect fit */
523 if (bs == s && be == e) {
524 /* Move from free list to taken list */
525 list_del(&blk->list);
526 blk->owner = owner;
527
528 start = blk->start;
529 attach_taken_block(info, blk);
530
531 return start;
532
533 }
534
535 /* blk still in free list, with updated start and/or size */
536 if (bs == s || be == e) {
537 if (bs == s)
538 blk->start = (int8_t *)blk->start + size;
539 blk->size -= size;
540
541 } else {
542 /* The front free fragment */
543 blk->size = s - bs;
544
545 /* The back free fragment */
546 newblk2 = get_slot(info);
547 newblk2->start = (void *)e;
548 newblk2->size = be - e;
549
550 list_add(&newblk2->list, &blk->list);
551 }
552
553 newblk1 = get_slot(info);
554 newblk1->start = (void *)s;
555 newblk1->size = e - s;
556 newblk1->owner = owner;
557
558 start = newblk1->start;
559 attach_taken_block(info, newblk1);
560
561 return start;
562}
563
564int rh_free(rh_info_t * info, void *start)
565{
566 rh_block_t *blk, *blk2;
567 struct list_head *l;
568 int size;
569
570 /* Linear search for block */
571 blk = NULL;
572 list_for_each(l, &info->taken_list) {
573 blk2 = list_entry(l, rh_block_t, list);
574 if (start < blk2->start)
575 break;
576 blk = blk2;
577 }
578
579 if (blk == NULL || start > (blk->start + blk->size))
580 return -EINVAL;
581
582 /* Remove from taken list */
583 list_del(&blk->list);
584
585 /* Get size of freed block */
586 size = blk->size;
587 attach_free_block(info, blk);
588
589 return size;
590}
591
592int rh_get_stats(rh_info_t * info, int what, int max_stats, rh_stats_t * stats)
593{
594 rh_block_t *blk;
595 struct list_head *l;
596 struct list_head *h;
597 int nr;
598
599 switch (what) {
600
601 case RHGS_FREE:
602 h = &info->free_list;
603 break;
604
605 case RHGS_TAKEN:
606 h = &info->taken_list;
607 break;
608
609 default:
610 return -EINVAL;
611 }
612
613 /* Linear search for block */
614 nr = 0;
615 list_for_each(l, h) {
616 blk = list_entry(l, rh_block_t, list);
617 if (stats != NULL && nr < max_stats) {
618 stats->start = blk->start;
619 stats->size = blk->size;
620 stats->owner = blk->owner;
621 stats++;
622 }
623 nr++;
624 }
625
626 return nr;
627}
628
629int rh_set_owner(rh_info_t * info, void *start, const char *owner)
630{
631 rh_block_t *blk, *blk2;
632 struct list_head *l;
633 int size;
634
635 /* Linear search for block */
636 blk = NULL;
637 list_for_each(l, &info->taken_list) {
638 blk2 = list_entry(l, rh_block_t, list);
639 if (start < blk2->start)
640 break;
641 blk = blk2;
642 }
643
644 if (blk == NULL || start > (blk->start + blk->size))
645 return -EINVAL;
646
647 blk->owner = owner;
648 size = blk->size;
649
650 return size;
651}
652
653void rh_dump(rh_info_t * info)
654{
655 static rh_stats_t st[32]; /* XXX maximum 32 blocks */
656 int maxnr;
657 int i, nr;
658
659 maxnr = sizeof(st) / sizeof(st[0]);
660
661 printk(KERN_INFO
662 "info @0x%p (%d slots empty / %d max)\n",
663 info, info->empty_slots, info->max_blocks);
664
665 printk(KERN_INFO " Free:\n");
666 nr = rh_get_stats(info, RHGS_FREE, maxnr, st);
667 if (nr > maxnr)
668 nr = maxnr;
669 for (i = 0; i < nr; i++)
670 printk(KERN_INFO
671 " 0x%p-0x%p (%u)\n",
672 st[i].start, (int8_t *) st[i].start + st[i].size,
673 st[i].size);
674 printk(KERN_INFO "\n");
675
676 printk(KERN_INFO " Taken:\n");
677 nr = rh_get_stats(info, RHGS_TAKEN, maxnr, st);
678 if (nr > maxnr)
679 nr = maxnr;
680 for (i = 0; i < nr; i++)
681 printk(KERN_INFO
682 " 0x%p-0x%p (%u) %s\n",
683 st[i].start, (int8_t *) st[i].start + st[i].size,
684 st[i].size, st[i].owner != NULL ? st[i].owner : "");
685 printk(KERN_INFO "\n");
686}
687
688void rh_dump_blk(rh_info_t * info, rh_block_t * blk)
689{
690 printk(KERN_INFO
691 "blk @0x%p: 0x%p-0x%p (%u)\n",
692 blk, blk->start, (int8_t *) blk->start + blk->size, blk->size);
693}
diff --git a/arch/ppc/lib/strcase.c b/arch/ppc/lib/strcase.c
new file mode 100644
index 000000000000..36b521091bbc
--- /dev/null
+++ b/arch/ppc/lib/strcase.c
@@ -0,0 +1,23 @@
1#include <linux/ctype.h>
2
3int strcasecmp(const char *s1, const char *s2)
4{
5 int c1, c2;
6
7 do {
8 c1 = tolower(*s1++);
9 c2 = tolower(*s2++);
10 } while (c1 == c2 && c1 != 0);
11 return c1 - c2;
12}
13
14int strncasecmp(const char *s1, const char *s2, int n)
15{
16 int c1, c2;
17
18 do {
19 c1 = tolower(*s1++);
20 c2 = tolower(*s2++);
21 } while ((--n > 0) && c1 == c2 && c1 != 0);
22 return c1 - c2;
23}
diff --git a/arch/ppc/lib/string.S b/arch/ppc/lib/string.S
new file mode 100644
index 000000000000..8d08a2eb225e
--- /dev/null
+++ b/arch/ppc/lib/string.S
@@ -0,0 +1,716 @@
1/*
2 * String handling functions for PowerPC.
3 *
4 * Copyright (C) 1996 Paul Mackerras.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11#include <linux/config.h>
12#include <asm/processor.h>
13#include <asm/cache.h>
14#include <asm/errno.h>
15#include <asm/ppc_asm.h>
16
17#define COPY_16_BYTES \
18 lwz r7,4(r4); \
19 lwz r8,8(r4); \
20 lwz r9,12(r4); \
21 lwzu r10,16(r4); \
22 stw r7,4(r6); \
23 stw r8,8(r6); \
24 stw r9,12(r6); \
25 stwu r10,16(r6)
26
27#define COPY_16_BYTES_WITHEX(n) \
288 ## n ## 0: \
29 lwz r7,4(r4); \
308 ## n ## 1: \
31 lwz r8,8(r4); \
328 ## n ## 2: \
33 lwz r9,12(r4); \
348 ## n ## 3: \
35 lwzu r10,16(r4); \
368 ## n ## 4: \
37 stw r7,4(r6); \
388 ## n ## 5: \
39 stw r8,8(r6); \
408 ## n ## 6: \
41 stw r9,12(r6); \
428 ## n ## 7: \
43 stwu r10,16(r6)
44
45#define COPY_16_BYTES_EXCODE(n) \
469 ## n ## 0: \
47 addi r5,r5,-(16 * n); \
48 b 104f; \
499 ## n ## 1: \
50 addi r5,r5,-(16 * n); \
51 b 105f; \
52.section __ex_table,"a"; \
53 .align 2; \
54 .long 8 ## n ## 0b,9 ## n ## 0b; \
55 .long 8 ## n ## 1b,9 ## n ## 0b; \
56 .long 8 ## n ## 2b,9 ## n ## 0b; \
57 .long 8 ## n ## 3b,9 ## n ## 0b; \
58 .long 8 ## n ## 4b,9 ## n ## 1b; \
59 .long 8 ## n ## 5b,9 ## n ## 1b; \
60 .long 8 ## n ## 6b,9 ## n ## 1b; \
61 .long 8 ## n ## 7b,9 ## n ## 1b; \
62 .text
63
64 .text
65 .stabs "arch/ppc/lib/",N_SO,0,0,0f
66 .stabs "string.S",N_SO,0,0,0f
67
68CACHELINE_BYTES = L1_CACHE_LINE_SIZE
69LG_CACHELINE_BYTES = LG_L1_CACHE_LINE_SIZE
70CACHELINE_MASK = (L1_CACHE_LINE_SIZE-1)
71
72_GLOBAL(strcpy)
73 addi r5,r3,-1
74 addi r4,r4,-1
751: lbzu r0,1(r4)
76 cmpwi 0,r0,0
77 stbu r0,1(r5)
78 bne 1b
79 blr
80
81/* This clears out any unused part of the destination buffer,
82 just as the libc version does. -- paulus */
83_GLOBAL(strncpy)
84 cmpwi 0,r5,0
85 beqlr
86 mtctr r5
87 addi r6,r3,-1
88 addi r4,r4,-1
891: lbzu r0,1(r4)
90 cmpwi 0,r0,0
91 stbu r0,1(r6)
92 bdnzf 2,1b /* dec ctr, branch if ctr != 0 && !cr0.eq */
93 bnelr /* if we didn't hit a null char, we're done */
94 mfctr r5
95 cmpwi 0,r5,0 /* any space left in destination buffer? */
96 beqlr /* we know r0 == 0 here */
972: stbu r0,1(r6) /* clear it out if so */
98 bdnz 2b
99 blr
100
101_GLOBAL(strcat)
102 addi r5,r3,-1
103 addi r4,r4,-1
1041: lbzu r0,1(r5)
105 cmpwi 0,r0,0
106 bne 1b
107 addi r5,r5,-1
1081: lbzu r0,1(r4)
109 cmpwi 0,r0,0
110 stbu r0,1(r5)
111 bne 1b
112 blr
113
114_GLOBAL(strcmp)
115 addi r5,r3,-1
116 addi r4,r4,-1
1171: lbzu r3,1(r5)
118 cmpwi 1,r3,0
119 lbzu r0,1(r4)
120 subf. r3,r0,r3
121 beqlr 1
122 beq 1b
123 blr
124
125_GLOBAL(strlen)
126 addi r4,r3,-1
1271: lbzu r0,1(r4)
128 cmpwi 0,r0,0
129 bne 1b
130 subf r3,r3,r4
131 blr
132
133/*
134 * Use dcbz on the complete cache lines in the destination
135 * to set them to zero. This requires that the destination
136 * area is cacheable. -- paulus
137 */
138_GLOBAL(cacheable_memzero)
139 mr r5,r4
140 li r4,0
141 addi r6,r3,-4
142 cmplwi 0,r5,4
143 blt 7f
144 stwu r4,4(r6)
145 beqlr
146 andi. r0,r6,3
147 add r5,r0,r5
148 subf r6,r0,r6
149 clrlwi r7,r6,32-LG_CACHELINE_BYTES
150 add r8,r7,r5
151 srwi r9,r8,LG_CACHELINE_BYTES
152 addic. r9,r9,-1 /* total number of complete cachelines */
153 ble 2f
154 xori r0,r7,CACHELINE_MASK & ~3
155 srwi. r0,r0,2
156 beq 3f
157 mtctr r0
1584: stwu r4,4(r6)
159 bdnz 4b
1603: mtctr r9
161 li r7,4
162#if !defined(CONFIG_8xx)
16310: dcbz r7,r6
164#else
16510: stw r4, 4(r6)
166 stw r4, 8(r6)
167 stw r4, 12(r6)
168 stw r4, 16(r6)
169#if CACHE_LINE_SIZE >= 32
170 stw r4, 20(r6)
171 stw r4, 24(r6)
172 stw r4, 28(r6)
173 stw r4, 32(r6)
174#endif /* CACHE_LINE_SIZE */
175#endif
176 addi r6,r6,CACHELINE_BYTES
177 bdnz 10b
178 clrlwi r5,r8,32-LG_CACHELINE_BYTES
179 addi r5,r5,4
1802: srwi r0,r5,2
181 mtctr r0
182 bdz 6f
1831: stwu r4,4(r6)
184 bdnz 1b
1856: andi. r5,r5,3
1867: cmpwi 0,r5,0
187 beqlr
188 mtctr r5
189 addi r6,r6,3
1908: stbu r4,1(r6)
191 bdnz 8b
192 blr
193
194_GLOBAL(memset)
195 rlwimi r4,r4,8,16,23
196 rlwimi r4,r4,16,0,15
197 addi r6,r3,-4
198 cmplwi 0,r5,4
199 blt 7f
200 stwu r4,4(r6)
201 beqlr
202 andi. r0,r6,3
203 add r5,r0,r5
204 subf r6,r0,r6
205 srwi r0,r5,2
206 mtctr r0
207 bdz 6f
2081: stwu r4,4(r6)
209 bdnz 1b
2106: andi. r5,r5,3
2117: cmpwi 0,r5,0
212 beqlr
213 mtctr r5
214 addi r6,r6,3
2158: stbu r4,1(r6)
216 bdnz 8b
217 blr
218
219/*
220 * This version uses dcbz on the complete cache lines in the
221 * destination area to reduce memory traffic. This requires that
222 * the destination area is cacheable.
223 * We only use this version if the source and dest don't overlap.
224 * -- paulus.
225 */
226_GLOBAL(cacheable_memcpy)
227 add r7,r3,r5 /* test if the src & dst overlap */
228 add r8,r4,r5
229 cmplw 0,r4,r7
230 cmplw 1,r3,r8
231 crand 0,0,4 /* cr0.lt &= cr1.lt */
232 blt memcpy /* if regions overlap */
233
234 addi r4,r4,-4
235 addi r6,r3,-4
236 neg r0,r3
237 andi. r0,r0,CACHELINE_MASK /* # bytes to start of cache line */
238 beq 58f
239
240 cmplw 0,r5,r0 /* is this more than total to do? */
241 blt 63f /* if not much to do */
242 andi. r8,r0,3 /* get it word-aligned first */
243 subf r5,r0,r5
244 mtctr r8
245 beq+ 61f
24670: lbz r9,4(r4) /* do some bytes */
247 stb r9,4(r6)
248 addi r4,r4,1
249 addi r6,r6,1
250 bdnz 70b
25161: srwi. r0,r0,2
252 mtctr r0
253 beq 58f
25472: lwzu r9,4(r4) /* do some words */
255 stwu r9,4(r6)
256 bdnz 72b
257
25858: srwi. r0,r5,LG_CACHELINE_BYTES /* # complete cachelines */
259 clrlwi r5,r5,32-LG_CACHELINE_BYTES
260 li r11,4
261 mtctr r0
262 beq 63f
26353:
264#if !defined(CONFIG_8xx)
265 dcbz r11,r6
266#endif
267 COPY_16_BYTES
268#if L1_CACHE_LINE_SIZE >= 32
269 COPY_16_BYTES
270#if L1_CACHE_LINE_SIZE >= 64
271 COPY_16_BYTES
272 COPY_16_BYTES
273#if L1_CACHE_LINE_SIZE >= 128
274 COPY_16_BYTES
275 COPY_16_BYTES
276 COPY_16_BYTES
277 COPY_16_BYTES
278#endif
279#endif
280#endif
281 bdnz 53b
282
28363: srwi. r0,r5,2
284 mtctr r0
285 beq 64f
28630: lwzu r0,4(r4)
287 stwu r0,4(r6)
288 bdnz 30b
289
29064: andi. r0,r5,3
291 mtctr r0
292 beq+ 65f
29340: lbz r0,4(r4)
294 stb r0,4(r6)
295 addi r4,r4,1
296 addi r6,r6,1
297 bdnz 40b
29865: blr
299
300_GLOBAL(memmove)
301 cmplw 0,r3,r4
302 bgt backwards_memcpy
303 /* fall through */
304
305_GLOBAL(memcpy)
306 srwi. r7,r5,3
307 addi r6,r3,-4
308 addi r4,r4,-4
309 beq 2f /* if less than 8 bytes to do */
310 andi. r0,r6,3 /* get dest word aligned */
311 mtctr r7
312 bne 5f
3131: lwz r7,4(r4)
314 lwzu r8,8(r4)
315 stw r7,4(r6)
316 stwu r8,8(r6)
317 bdnz 1b
318 andi. r5,r5,7
3192: cmplwi 0,r5,4
320 blt 3f
321 lwzu r0,4(r4)
322 addi r5,r5,-4
323 stwu r0,4(r6)
3243: cmpwi 0,r5,0
325 beqlr
326 mtctr r5
327 addi r4,r4,3
328 addi r6,r6,3
3294: lbzu r0,1(r4)
330 stbu r0,1(r6)
331 bdnz 4b
332 blr
3335: subfic r0,r0,4
334 mtctr r0
3356: lbz r7,4(r4)
336 addi r4,r4,1
337 stb r7,4(r6)
338 addi r6,r6,1
339 bdnz 6b
340 subf r5,r0,r5
341 rlwinm. r7,r5,32-3,3,31
342 beq 2b
343 mtctr r7
344 b 1b
345
346_GLOBAL(backwards_memcpy)
347 rlwinm. r7,r5,32-3,3,31 /* r0 = r5 >> 3 */
348 add r6,r3,r5
349 add r4,r4,r5
350 beq 2f
351 andi. r0,r6,3
352 mtctr r7
353 bne 5f
3541: lwz r7,-4(r4)
355 lwzu r8,-8(r4)
356 stw r7,-4(r6)
357 stwu r8,-8(r6)
358 bdnz 1b
359 andi. r5,r5,7
3602: cmplwi 0,r5,4
361 blt 3f
362 lwzu r0,-4(r4)
363 subi r5,r5,4
364 stwu r0,-4(r6)
3653: cmpwi 0,r5,0
366 beqlr
367 mtctr r5
3684: lbzu r0,-1(r4)
369 stbu r0,-1(r6)
370 bdnz 4b
371 blr
3725: mtctr r0
3736: lbzu r7,-1(r4)
374 stbu r7,-1(r6)
375 bdnz 6b
376 subf r5,r0,r5
377 rlwinm. r7,r5,32-3,3,31
378 beq 2b
379 mtctr r7
380 b 1b
381
382_GLOBAL(memcmp)
383 cmpwi 0,r5,0
384 ble- 2f
385 mtctr r5
386 addi r6,r3,-1
387 addi r4,r4,-1
3881: lbzu r3,1(r6)
389 lbzu r0,1(r4)
390 subf. r3,r0,r3
391 bdnzt 2,1b
392 blr
3932: li r3,0
394 blr
395
396_GLOBAL(memchr)
397 cmpwi 0,r5,0
398 ble- 2f
399 mtctr r5
400 addi r3,r3,-1
4011: lbzu r0,1(r3)
402 cmpw 0,r0,r4
403 bdnzf 2,1b
404 beqlr
4052: li r3,0
406 blr
407
408_GLOBAL(__copy_tofrom_user)
409 addi r4,r4,-4
410 addi r6,r3,-4
411 neg r0,r3
412 andi. r0,r0,CACHELINE_MASK /* # bytes to start of cache line */
413 beq 58f
414
415 cmplw 0,r5,r0 /* is this more than total to do? */
416 blt 63f /* if not much to do */
417 andi. r8,r0,3 /* get it word-aligned first */
418 mtctr r8
419 beq+ 61f
42070: lbz r9,4(r4) /* do some bytes */
42171: stb r9,4(r6)
422 addi r4,r4,1
423 addi r6,r6,1
424 bdnz 70b
42561: subf r5,r0,r5
426 srwi. r0,r0,2
427 mtctr r0
428 beq 58f
42972: lwzu r9,4(r4) /* do some words */
43073: stwu r9,4(r6)
431 bdnz 72b
432
433 .section __ex_table,"a"
434 .align 2
435 .long 70b,100f
436 .long 71b,101f
437 .long 72b,102f
438 .long 73b,103f
439 .text
440
44158: srwi. r0,r5,LG_CACHELINE_BYTES /* # complete cachelines */
442 clrlwi r5,r5,32-LG_CACHELINE_BYTES
443 li r11,4
444 beq 63f
445
446#ifdef CONFIG_8xx
447 /* Don't use prefetch on 8xx */
448 mtctr r0
44953: COPY_16_BYTES_WITHEX(0)
450 bdnz 53b
451
452#else /* not CONFIG_8xx */
453 /* Here we decide how far ahead to prefetch the source */
454 li r3,4
455 cmpwi r0,1
456 li r7,0
457 ble 114f
458 li r7,1
459#if MAX_COPY_PREFETCH > 1
460 /* Heuristically, for large transfers we prefetch
461 MAX_COPY_PREFETCH cachelines ahead. For small transfers
462 we prefetch 1 cacheline ahead. */
463 cmpwi r0,MAX_COPY_PREFETCH
464 ble 112f
465 li r7,MAX_COPY_PREFETCH
466112: mtctr r7
467111: dcbt r3,r4
468 addi r3,r3,CACHELINE_BYTES
469 bdnz 111b
470#else
471 dcbt r3,r4
472 addi r3,r3,CACHELINE_BYTES
473#endif /* MAX_COPY_PREFETCH > 1 */
474
475114: subf r8,r7,r0
476 mr r0,r7
477 mtctr r8
478
47953: dcbt r3,r4
48054: dcbz r11,r6
481 .section __ex_table,"a"
482 .align 2
483 .long 54b,105f
484 .text
485/* the main body of the cacheline loop */
486 COPY_16_BYTES_WITHEX(0)
487#if L1_CACHE_LINE_SIZE >= 32
488 COPY_16_BYTES_WITHEX(1)
489#if L1_CACHE_LINE_SIZE >= 64
490 COPY_16_BYTES_WITHEX(2)
491 COPY_16_BYTES_WITHEX(3)
492#if L1_CACHE_LINE_SIZE >= 128
493 COPY_16_BYTES_WITHEX(4)
494 COPY_16_BYTES_WITHEX(5)
495 COPY_16_BYTES_WITHEX(6)
496 COPY_16_BYTES_WITHEX(7)
497#endif
498#endif
499#endif
500 bdnz 53b
501 cmpwi r0,0
502 li r3,4
503 li r7,0
504 bne 114b
505#endif /* CONFIG_8xx */
506
50763: srwi. r0,r5,2
508 mtctr r0
509 beq 64f
51030: lwzu r0,4(r4)
51131: stwu r0,4(r6)
512 bdnz 30b
513
51464: andi. r0,r5,3
515 mtctr r0
516 beq+ 65f
51740: lbz r0,4(r4)
51841: stb r0,4(r6)
519 addi r4,r4,1
520 addi r6,r6,1
521 bdnz 40b
52265: li r3,0
523 blr
524
525/* read fault, initial single-byte copy */
526100: li r9,0
527 b 90f
528/* write fault, initial single-byte copy */
529101: li r9,1
53090: subf r5,r8,r5
531 li r3,0
532 b 99f
533/* read fault, initial word copy */
534102: li r9,0
535 b 91f
536/* write fault, initial word copy */
537103: li r9,1
53891: li r3,2
539 b 99f
540
541/*
542 * this stuff handles faults in the cacheline loop and branches to either
543 * 104f (if in read part) or 105f (if in write part), after updating r5
544 */
545 COPY_16_BYTES_EXCODE(0)
546#if L1_CACHE_LINE_SIZE >= 32
547 COPY_16_BYTES_EXCODE(1)
548#if L1_CACHE_LINE_SIZE >= 64
549 COPY_16_BYTES_EXCODE(2)
550 COPY_16_BYTES_EXCODE(3)
551#if L1_CACHE_LINE_SIZE >= 128
552 COPY_16_BYTES_EXCODE(4)
553 COPY_16_BYTES_EXCODE(5)
554 COPY_16_BYTES_EXCODE(6)
555 COPY_16_BYTES_EXCODE(7)
556#endif
557#endif
558#endif
559
560/* read fault in cacheline loop */
561104: li r9,0
562 b 92f
563/* fault on dcbz (effectively a write fault) */
564/* or write fault in cacheline loop */
565105: li r9,1
56692: li r3,LG_CACHELINE_BYTES
567 b 99f
568/* read fault in final word loop */
569108: li r9,0
570 b 93f
571/* write fault in final word loop */
572109: li r9,1
57393: andi. r5,r5,3
574 li r3,2
575 b 99f
576/* read fault in final byte loop */
577110: li r9,0
578 b 94f
579/* write fault in final byte loop */
580111: li r9,1
58194: li r5,0
582 li r3,0
583/*
584 * At this stage the number of bytes not copied is
585 * r5 + (ctr << r3), and r9 is 0 for read or 1 for write.
586 */
58799: mfctr r0
588 slw r3,r0,r3
589 add. r3,r3,r5
590 beq 120f /* shouldn't happen */
591 cmpwi 0,r9,0
592 bne 120f
593/* for a read fault, first try to continue the copy one byte at a time */
594 mtctr r3
595130: lbz r0,4(r4)
596131: stb r0,4(r6)
597 addi r4,r4,1
598 addi r6,r6,1
599 bdnz 130b
600/* then clear out the destination: r3 bytes starting at 4(r6) */
601132: mfctr r3
602 srwi. r0,r3,2
603 li r9,0
604 mtctr r0
605 beq 113f
606112: stwu r9,4(r6)
607 bdnz 112b
608113: andi. r0,r3,3
609 mtctr r0
610 beq 120f
611114: stb r9,4(r6)
612 addi r6,r6,1
613 bdnz 114b
614120: blr
615
616 .section __ex_table,"a"
617 .align 2
618 .long 30b,108b
619 .long 31b,109b
620 .long 40b,110b
621 .long 41b,111b
622 .long 130b,132b
623 .long 131b,120b
624 .long 112b,120b
625 .long 114b,120b
626 .text
627
628_GLOBAL(__clear_user)
629 addi r6,r3,-4
630 li r3,0
631 li r5,0
632 cmplwi 0,r4,4
633 blt 7f
634 /* clear a single word */
63511: stwu r5,4(r6)
636 beqlr
637 /* clear word sized chunks */
638 andi. r0,r6,3
639 add r4,r0,r4
640 subf r6,r0,r6
641 srwi r0,r4,2
642 andi. r4,r4,3
643 mtctr r0
644 bdz 7f
6451: stwu r5,4(r6)
646 bdnz 1b
647 /* clear byte sized chunks */
6487: cmpwi 0,r4,0
649 beqlr
650 mtctr r4
651 addi r6,r6,3
6528: stbu r5,1(r6)
653 bdnz 8b
654 blr
65590: mr r3,r4
656 blr
65791: mfctr r3
658 slwi r3,r3,2
659 add r3,r3,r4
660 blr
66192: mfctr r3
662 blr
663
664 .section __ex_table,"a"
665 .align 2
666 .long 11b,90b
667 .long 1b,91b
668 .long 8b,92b
669 .text
670
671_GLOBAL(__strncpy_from_user)
672 addi r6,r3,-1
673 addi r4,r4,-1
674 cmpwi 0,r5,0
675 beq 2f
676 mtctr r5
6771: lbzu r0,1(r4)
678 cmpwi 0,r0,0
679 stbu r0,1(r6)
680 bdnzf 2,1b /* dec ctr, branch if ctr != 0 && !cr0.eq */
681 beq 3f
6822: addi r6,r6,1
6833: subf r3,r3,r6
684 blr
68599: li r3,-EFAULT
686 blr
687
688 .section __ex_table,"a"
689 .align 2
690 .long 1b,99b
691 .text
692
693/* r3 = str, r4 = len (> 0), r5 = top (highest addr) */
694_GLOBAL(__strnlen_user)
695 addi r7,r3,-1
696 subf r6,r7,r5 /* top+1 - str */
697 cmplw 0,r4,r6
698 bge 0f
699 mr r6,r4
7000: mtctr r6 /* ctr = min(len, top - str) */
7011: lbzu r0,1(r7) /* get next byte */
702 cmpwi 0,r0,0
703 bdnzf 2,1b /* loop if --ctr != 0 && byte != 0 */
704 addi r7,r7,1
705 subf r3,r3,r7 /* number of bytes we have looked at */
706 beqlr /* return if we found a 0 byte */
707 cmpw 0,r3,r4 /* did we look at all len bytes? */
708 blt 99f /* if not, must have hit top */
709 addi r3,r4,1 /* return len + 1 to indicate no null found */
710 blr
71199: li r3,0 /* bad address, return 0 */
712 blr
713
714 .section __ex_table,"a"
715 .align 2
716 .long 1b,99b
diff --git a/arch/ppc/math-emu/Makefile b/arch/ppc/math-emu/Makefile
new file mode 100644
index 000000000000..754143e8936b
--- /dev/null
+++ b/arch/ppc/math-emu/Makefile
@@ -0,0 +1,13 @@
1
2obj-y := math.o fmr.o lfd.o stfd.o
3
4obj-$(CONFIG_MATH_EMULATION) += fabs.o fadd.o fadds.o fcmpo.o fcmpu.o \
5 fctiw.o fctiwz.o fdiv.o fdivs.o \
6 fmadd.o fmadds.o fmsub.o fmsubs.o \
7 fmul.o fmuls.o fnabs.o fneg.o types.o \
8 fnmadd.o fnmadds.o fnmsub.o fnmsubs.o \
9 fres.o frsp.o frsqrte.o fsel.o lfs.o \
10 fsqrt.o fsqrts.o fsub.o fsubs.o \
11 mcrfs.o mffs.o mtfsb0.o mtfsb1.o \
12 mtfsf.o mtfsfi.o stfiwx.o stfs.o \
13 udivmodti4.o
diff --git a/arch/ppc/math-emu/double.h b/arch/ppc/math-emu/double.h
new file mode 100644
index 000000000000..ffba8b67f059
--- /dev/null
+++ b/arch/ppc/math-emu/double.h
@@ -0,0 +1,129 @@
1/*
2 * Definitions for IEEE Double Precision
3 */
4
5#if _FP_W_TYPE_SIZE < 32
6#error "Here's a nickel kid. Go buy yourself a real computer."
7#endif
8
9#if _FP_W_TYPE_SIZE < 64
10#define _FP_FRACTBITS_D (2 * _FP_W_TYPE_SIZE)
11#else
12#define _FP_FRACTBITS_D _FP_W_TYPE_SIZE
13#endif
14
15#define _FP_FRACBITS_D 53
16#define _FP_FRACXBITS_D (_FP_FRACTBITS_D - _FP_FRACBITS_D)
17#define _FP_WFRACBITS_D (_FP_WORKBITS + _FP_FRACBITS_D)
18#define _FP_WFRACXBITS_D (_FP_FRACTBITS_D - _FP_WFRACBITS_D)
19#define _FP_EXPBITS_D 11
20#define _FP_EXPBIAS_D 1023
21#define _FP_EXPMAX_D 2047
22
23#define _FP_QNANBIT_D \
24 ((_FP_W_TYPE)1 << ((_FP_FRACBITS_D-2) % _FP_W_TYPE_SIZE))
25#define _FP_IMPLBIT_D \
26 ((_FP_W_TYPE)1 << ((_FP_FRACBITS_D-1) % _FP_W_TYPE_SIZE))
27#define _FP_OVERFLOW_D \
28 ((_FP_W_TYPE)1 << (_FP_WFRACBITS_D % _FP_W_TYPE_SIZE))
29
30#if _FP_W_TYPE_SIZE < 64
31
32union _FP_UNION_D
33{
34 double flt;
35 struct {
36#if __BYTE_ORDER == __BIG_ENDIAN
37 unsigned sign : 1;
38 unsigned exp : _FP_EXPBITS_D;
39 unsigned frac1 : _FP_FRACBITS_D - (_FP_IMPLBIT_D != 0) - _FP_W_TYPE_SIZE;
40 unsigned frac0 : _FP_W_TYPE_SIZE;
41#else
42 unsigned frac0 : _FP_W_TYPE_SIZE;
43 unsigned frac1 : _FP_FRACBITS_D - (_FP_IMPLBIT_D != 0) - _FP_W_TYPE_SIZE;
44 unsigned exp : _FP_EXPBITS_D;
45 unsigned sign : 1;
46#endif
47 } bits __attribute__((packed));
48};
49
50#define FP_DECL_D(X) _FP_DECL(2,X)
51#define FP_UNPACK_RAW_D(X,val) _FP_UNPACK_RAW_2(D,X,val)
52#define FP_PACK_RAW_D(val,X) _FP_PACK_RAW_2(D,val,X)
53
54#define FP_UNPACK_D(X,val) \
55 do { \
56 _FP_UNPACK_RAW_2(D,X,val); \
57 _FP_UNPACK_CANONICAL(D,2,X); \
58 } while (0)
59
60#define FP_PACK_D(val,X) \
61 do { \
62 _FP_PACK_CANONICAL(D,2,X); \
63 _FP_PACK_RAW_2(D,val,X); \
64 } while (0)
65
66#define FP_NEG_D(R,X) _FP_NEG(D,2,R,X)
67#define FP_ADD_D(R,X,Y) _FP_ADD(D,2,R,X,Y)
68#define FP_SUB_D(R,X,Y) _FP_SUB(D,2,R,X,Y)
69#define FP_MUL_D(R,X,Y) _FP_MUL(D,2,R,X,Y)
70#define FP_DIV_D(R,X,Y) _FP_DIV(D,2,R,X,Y)
71#define FP_SQRT_D(R,X) _FP_SQRT(D,2,R,X)
72
73#define FP_CMP_D(r,X,Y,un) _FP_CMP(D,2,r,X,Y,un)
74#define FP_CMP_EQ_D(r,X,Y) _FP_CMP_EQ(D,2,r,X,Y)
75
76#define FP_TO_INT_D(r,X,rsz,rsg) _FP_TO_INT(D,2,r,X,rsz,rsg)
77#define FP_FROM_INT_D(X,r,rs,rt) _FP_FROM_INT(D,2,X,r,rs,rt)
78
79#else
80
81union _FP_UNION_D
82{
83 double flt;
84 struct {
85#if __BYTE_ORDER == __BIG_ENDIAN
86 unsigned sign : 1;
87 unsigned exp : _FP_EXPBITS_D;
88 unsigned long frac : _FP_FRACBITS_D - (_FP_IMPLBIT_D != 0);
89#else
90 unsigned long frac : _FP_FRACBITS_D - (_FP_IMPLBIT_D != 0);
91 unsigned exp : _FP_EXPBITS_D;
92 unsigned sign : 1;
93#endif
94 } bits __attribute__((packed));
95};
96
97#define FP_DECL_D(X) _FP_DECL(1,X)
98#define FP_UNPACK_RAW_D(X,val) _FP_UNPACK_RAW_1(D,X,val)
99#define FP_PACK_RAW_D(val,X) _FP_PACK_RAW_1(D,val,X)
100
101#define FP_UNPACK_D(X,val) \
102 do { \
103 _FP_UNPACK_RAW_1(D,X,val); \
104 _FP_UNPACK_CANONICAL(D,1,X); \
105 } while (0)
106
107#define FP_PACK_D(val,X) \
108 do { \
109 _FP_PACK_CANONICAL(D,1,X); \
110 _FP_PACK_RAW_1(D,val,X); \
111 } while (0)
112
113#define FP_NEG_D(R,X) _FP_NEG(D,1,R,X)
114#define FP_ADD_D(R,X,Y) _FP_ADD(D,1,R,X,Y)
115#define FP_SUB_D(R,X,Y) _FP_SUB(D,1,R,X,Y)
116#define FP_MUL_D(R,X,Y) _FP_MUL(D,1,R,X,Y)
117#define FP_DIV_D(R,X,Y) _FP_DIV(D,1,R,X,Y)
118#define FP_SQRT_D(R,X) _FP_SQRT(D,1,R,X)
119
120/* The implementation of _FP_MUL_D and _FP_DIV_D should be chosen by
121 the target machine. */
122
123#define FP_CMP_D(r,X,Y,un) _FP_CMP(D,1,r,X,Y,un)
124#define FP_CMP_EQ_D(r,X,Y) _FP_CMP_EQ(D,1,r,X,Y)
125
126#define FP_TO_INT_D(r,X,rsz,rsg) _FP_TO_INT(D,1,r,X,rsz,rsg)
127#define FP_FROM_INT_D(X,r,rs,rt) _FP_FROM_INT(D,1,X,r,rs,rt)
128
129#endif /* W_TYPE_SIZE < 64 */
diff --git a/arch/ppc/math-emu/fabs.c b/arch/ppc/math-emu/fabs.c
new file mode 100644
index 000000000000..41f0617f3d3a
--- /dev/null
+++ b/arch/ppc/math-emu/fabs.c
@@ -0,0 +1,18 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5int
6fabs(u32 *frD, u32 *frB)
7{
8 frD[0] = frB[0] & 0x7fffffff;
9 frD[1] = frB[1];
10
11#ifdef DEBUG
12 printk("%s: D %p, B %p: ", __FUNCTION__, frD, frB);
13 dump_double(frD);
14 printk("\n");
15#endif
16
17 return 0;
18}
diff --git a/arch/ppc/math-emu/fadd.c b/arch/ppc/math-emu/fadd.c
new file mode 100644
index 000000000000..fc8836488b64
--- /dev/null
+++ b/arch/ppc/math-emu/fadd.c
@@ -0,0 +1,38 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5#include "soft-fp.h"
6#include "double.h"
7
8int
9fadd(void *frD, void *frA, void *frB)
10{
11 FP_DECL_D(A);
12 FP_DECL_D(B);
13 FP_DECL_D(R);
14 int ret = 0;
15
16#ifdef DEBUG
17 printk("%s: %p %p %p\n", __FUNCTION__, frD, frA, frB);
18#endif
19
20 __FP_UNPACK_D(A, frA);
21 __FP_UNPACK_D(B, frB);
22
23#ifdef DEBUG
24 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c);
25 printk("B: %ld %lu %lu %ld (%ld)\n", B_s, B_f1, B_f0, B_e, B_c);
26#endif
27
28 if (A_s != B_s && A_c == FP_CLS_INF && B_c == FP_CLS_INF)
29 ret |= EFLAG_VXISI;
30
31 FP_ADD_D(R, A, B);
32
33#ifdef DEBUG
34 printk("D: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c);
35#endif
36
37 return (ret | __FP_PACK_D(frD, R));
38}
diff --git a/arch/ppc/math-emu/fadds.c b/arch/ppc/math-emu/fadds.c
new file mode 100644
index 000000000000..93025b6c8f3c
--- /dev/null
+++ b/arch/ppc/math-emu/fadds.c
@@ -0,0 +1,39 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5#include "soft-fp.h"
6#include "double.h"
7#include "single.h"
8
9int
10fadds(void *frD, void *frA, void *frB)
11{
12 FP_DECL_D(A);
13 FP_DECL_D(B);
14 FP_DECL_D(R);
15 int ret = 0;
16
17#ifdef DEBUG
18 printk("%s: %p %p %p\n", __FUNCTION__, frD, frA, frB);
19#endif
20
21 __FP_UNPACK_D(A, frA);
22 __FP_UNPACK_D(B, frB);
23
24#ifdef DEBUG
25 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c);
26 printk("B: %ld %lu %lu %ld (%ld)\n", B_s, B_f1, B_f0, B_e, B_c);
27#endif
28
29 if (A_s != B_s && A_c == FP_CLS_INF && B_c == FP_CLS_INF)
30 ret |= EFLAG_VXISI;
31
32 FP_ADD_D(R, A, B);
33
34#ifdef DEBUG
35 printk("D: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c);
36#endif
37
38 return (ret | __FP_PACK_DS(frD, R));
39}
diff --git a/arch/ppc/math-emu/fcmpo.c b/arch/ppc/math-emu/fcmpo.c
new file mode 100644
index 000000000000..4efac394b4cb
--- /dev/null
+++ b/arch/ppc/math-emu/fcmpo.c
@@ -0,0 +1,46 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5#include "soft-fp.h"
6#include "double.h"
7
8int
9fcmpo(u32 *ccr, int crfD, void *frA, void *frB)
10{
11 FP_DECL_D(A);
12 FP_DECL_D(B);
13 int code[4] = { (1 << 3), (1 << 1), (1 << 2), (1 << 0) };
14 long cmp;
15 int ret = 0;
16
17#ifdef DEBUG
18 printk("%s: %p (%08x) %d %p %p\n", __FUNCTION__, ccr, *ccr, crfD, frA, frB);
19#endif
20
21 __FP_UNPACK_D(A, frA);
22 __FP_UNPACK_D(B, frB);
23
24#ifdef DEBUG
25 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c);
26 printk("B: %ld %lu %lu %ld (%ld)\n", B_s, B_f1, B_f0, B_e, B_c);
27#endif
28
29 if (A_c == FP_CLS_NAN || B_c == FP_CLS_NAN)
30 ret |= EFLAG_VXVC;
31
32 FP_CMP_D(cmp, A, B, 2);
33 cmp = code[(cmp + 1) & 3];
34
35 __FPU_FPSCR &= ~(0x1f000);
36 __FPU_FPSCR |= (cmp << 12);
37
38 *ccr &= ~(15 << ((7 - crfD) << 2));
39 *ccr |= (cmp << ((7 - crfD) << 2));
40
41#ifdef DEBUG
42 printk("CR: %08x\n", *ccr);
43#endif
44
45 return ret;
46}
diff --git a/arch/ppc/math-emu/fcmpu.c b/arch/ppc/math-emu/fcmpu.c
new file mode 100644
index 000000000000..b7e33176e618
--- /dev/null
+++ b/arch/ppc/math-emu/fcmpu.c
@@ -0,0 +1,42 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5#include "soft-fp.h"
6#include "double.h"
7
8int
9fcmpu(u32 *ccr, int crfD, void *frA, void *frB)
10{
11 FP_DECL_D(A);
12 FP_DECL_D(B);
13 int code[4] = { (1 << 3), (1 << 1), (1 << 2), (1 << 0) };
14 long cmp;
15
16#ifdef DEBUG
17 printk("%s: %p (%08x) %d %p %p\n", __FUNCTION__, ccr, *ccr, crfD, frA, frB);
18#endif
19
20 __FP_UNPACK_D(A, frA);
21 __FP_UNPACK_D(B, frB);
22
23#ifdef DEBUG
24 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c);
25 printk("B: %ld %lu %lu %ld (%ld)\n", B_s, B_f1, B_f0, B_e, B_c);
26#endif
27
28 FP_CMP_D(cmp, A, B, 2);
29 cmp = code[(cmp + 1) & 3];
30
31 __FPU_FPSCR &= ~(0x1f000);
32 __FPU_FPSCR |= (cmp << 12);
33
34 *ccr &= ~(15 << ((7 - crfD) << 2));
35 *ccr |= (cmp << ((7 - crfD) << 2));
36
37#ifdef DEBUG
38 printk("CR: %08x\n", *ccr);
39#endif
40
41 return 0;
42}
diff --git a/arch/ppc/math-emu/fctiw.c b/arch/ppc/math-emu/fctiw.c
new file mode 100644
index 000000000000..3b3c98b840cf
--- /dev/null
+++ b/arch/ppc/math-emu/fctiw.c
@@ -0,0 +1,25 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5#include "soft-fp.h"
6#include "double.h"
7
8int
9fctiw(u32 *frD, void *frB)
10{
11 FP_DECL_D(B);
12 unsigned int r;
13
14 __FP_UNPACK_D(B, frB);
15 FP_TO_INT_D(r, B, 32, 1);
16 frD[1] = r;
17
18#ifdef DEBUG
19 printk("%s: D %p, B %p: ", __FUNCTION__, frD, frB);
20 dump_double(frD);
21 printk("\n");
22#endif
23
24 return 0;
25}
diff --git a/arch/ppc/math-emu/fctiwz.c b/arch/ppc/math-emu/fctiwz.c
new file mode 100644
index 000000000000..7717eb6fcfb6
--- /dev/null
+++ b/arch/ppc/math-emu/fctiwz.c
@@ -0,0 +1,32 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5#include "soft-fp.h"
6#include "double.h"
7
8int
9fctiwz(u32 *frD, void *frB)
10{
11 FP_DECL_D(B);
12 u32 fpscr;
13 unsigned int r;
14
15 fpscr = __FPU_FPSCR;
16 __FPU_FPSCR &= ~(3);
17 __FPU_FPSCR |= FP_RND_ZERO;
18
19 __FP_UNPACK_D(B, frB);
20 FP_TO_INT_D(r, B, 32, 1);
21 frD[1] = r;
22
23 __FPU_FPSCR = fpscr;
24
25#ifdef DEBUG
26 printk("%s: D %p, B %p: ", __FUNCTION__, frD, frB);
27 dump_double(frD);
28 printk("\n");
29#endif
30
31 return 0;
32}
diff --git a/arch/ppc/math-emu/fdiv.c b/arch/ppc/math-emu/fdiv.c
new file mode 100644
index 000000000000..f2fba825b2d0
--- /dev/null
+++ b/arch/ppc/math-emu/fdiv.c
@@ -0,0 +1,53 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5#include "soft-fp.h"
6#include "double.h"
7
8int
9fdiv(void *frD, void *frA, void *frB)
10{
11 FP_DECL_D(A);
12 FP_DECL_D(B);
13 FP_DECL_D(R);
14 int ret = 0;
15
16#ifdef DEBUG
17 printk("%s: %p %p %p\n", __FUNCTION__, frD, frA, frB);
18#endif
19
20 __FP_UNPACK_D(A, frA);
21 __FP_UNPACK_D(B, frB);
22
23#ifdef DEBUG
24 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c);
25 printk("B: %ld %lu %lu %ld (%ld)\n", B_s, B_f1, B_f0, B_e, B_c);
26#endif
27
28 if (A_c == FP_CLS_ZERO && B_c == FP_CLS_ZERO) {
29 ret |= EFLAG_VXZDZ;
30#ifdef DEBUG
31 printk("%s: FPSCR_VXZDZ raised\n", __FUNCTION__);
32#endif
33 }
34 if (A_c == FP_CLS_INF && B_c == FP_CLS_INF) {
35 ret |= EFLAG_VXIDI;
36#ifdef DEBUG
37 printk("%s: FPSCR_VXIDI raised\n", __FUNCTION__);
38#endif
39 }
40
41 if (B_c == FP_CLS_ZERO && A_c != FP_CLS_ZERO) {
42 ret |= EFLAG_DIVZERO;
43 if (__FPU_TRAP_P(EFLAG_DIVZERO))
44 return ret;
45 }
46 FP_DIV_D(R, A, B);
47
48#ifdef DEBUG
49 printk("D: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c);
50#endif
51
52 return (ret | __FP_PACK_D(frD, R));
53}
diff --git a/arch/ppc/math-emu/fdivs.c b/arch/ppc/math-emu/fdivs.c
new file mode 100644
index 000000000000..b971196e3175
--- /dev/null
+++ b/arch/ppc/math-emu/fdivs.c
@@ -0,0 +1,55 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5#include "soft-fp.h"
6#include "double.h"
7#include "single.h"
8
9int
10fdivs(void *frD, void *frA, void *frB)
11{
12 FP_DECL_D(A);
13 FP_DECL_D(B);
14 FP_DECL_D(R);
15 int ret = 0;
16
17#ifdef DEBUG
18 printk("%s: %p %p %p\n", __FUNCTION__, frD, frA, frB);
19#endif
20
21 __FP_UNPACK_D(A, frA);
22 __FP_UNPACK_D(B, frB);
23
24#ifdef DEBUG
25 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c);
26 printk("B: %ld %lu %lu %ld (%ld)\n", B_s, B_f1, B_f0, B_e, B_c);
27#endif
28
29 if (A_c == FP_CLS_ZERO && B_c == FP_CLS_ZERO) {
30 ret |= EFLAG_VXZDZ;
31#ifdef DEBUG
32 printk("%s: FPSCR_VXZDZ raised\n", __FUNCTION__);
33#endif
34 }
35 if (A_c == FP_CLS_INF && B_c == FP_CLS_INF) {
36 ret |= EFLAG_VXIDI;
37#ifdef DEBUG
38 printk("%s: FPSCR_VXIDI raised\n", __FUNCTION__);
39#endif
40 }
41
42 if (B_c == FP_CLS_ZERO && A_c != FP_CLS_ZERO) {
43 ret |= EFLAG_DIVZERO;
44 if (__FPU_TRAP_P(EFLAG_DIVZERO))
45 return ret;
46 }
47
48 FP_DIV_D(R, A, B);
49
50#ifdef DEBUG
51 printk("D: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c);
52#endif
53
54 return (ret | __FP_PACK_DS(frD, R));
55}
diff --git a/arch/ppc/math-emu/fmadd.c b/arch/ppc/math-emu/fmadd.c
new file mode 100644
index 000000000000..0a1dbce793e9
--- /dev/null
+++ b/arch/ppc/math-emu/fmadd.c
@@ -0,0 +1,48 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5#include "soft-fp.h"
6#include "double.h"
7
8int
9fmadd(void *frD, void *frA, void *frB, void *frC)
10{
11 FP_DECL_D(R);
12 FP_DECL_D(A);
13 FP_DECL_D(B);
14 FP_DECL_D(C);
15 FP_DECL_D(T);
16 int ret = 0;
17
18#ifdef DEBUG
19 printk("%s: %p %p %p %p\n", __FUNCTION__, frD, frA, frB, frC);
20#endif
21
22 __FP_UNPACK_D(A, frA);
23 __FP_UNPACK_D(B, frB);
24 __FP_UNPACK_D(C, frC);
25
26#ifdef DEBUG
27 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c);
28 printk("B: %ld %lu %lu %ld (%ld)\n", B_s, B_f1, B_f0, B_e, B_c);
29 printk("C: %ld %lu %lu %ld (%ld)\n", C_s, C_f1, C_f0, C_e, C_c);
30#endif
31
32 if ((A_c == FP_CLS_INF && C_c == FP_CLS_ZERO) ||
33 (A_c == FP_CLS_ZERO && C_c == FP_CLS_INF))
34 ret |= EFLAG_VXIMZ;
35
36 FP_MUL_D(T, A, C);
37
38 if (T_s != B_s && T_c == FP_CLS_INF && B_c == FP_CLS_INF)
39 ret |= EFLAG_VXISI;
40
41 FP_ADD_D(R, T, B);
42
43#ifdef DEBUG
44 printk("D: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c);
45#endif
46
47 return (ret | __FP_PACK_D(frD, R));
48}
diff --git a/arch/ppc/math-emu/fmadds.c b/arch/ppc/math-emu/fmadds.c
new file mode 100644
index 000000000000..0f70bba9445e
--- /dev/null
+++ b/arch/ppc/math-emu/fmadds.c
@@ -0,0 +1,49 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5#include "soft-fp.h"
6#include "double.h"
7#include "single.h"
8
9int
10fmadds(void *frD, void *frA, void *frB, void *frC)
11{
12 FP_DECL_D(R);
13 FP_DECL_D(A);
14 FP_DECL_D(B);
15 FP_DECL_D(C);
16 FP_DECL_D(T);
17 int ret = 0;
18
19#ifdef DEBUG
20 printk("%s: %p %p %p %p\n", __FUNCTION__, frD, frA, frB, frC);
21#endif
22
23 __FP_UNPACK_D(A, frA);
24 __FP_UNPACK_D(B, frB);
25 __FP_UNPACK_D(C, frC);
26
27#ifdef DEBUG
28 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c);
29 printk("B: %ld %lu %lu %ld (%ld)\n", B_s, B_f1, B_f0, B_e, B_c);
30 printk("C: %ld %lu %lu %ld (%ld)\n", C_s, C_f1, C_f0, C_e, C_c);
31#endif
32
33 if ((A_c == FP_CLS_INF && C_c == FP_CLS_ZERO) ||
34 (A_c == FP_CLS_ZERO && C_c == FP_CLS_INF))
35 ret |= EFLAG_VXIMZ;
36
37 FP_MUL_D(T, A, C);
38
39 if (T_s != B_s && T_c == FP_CLS_INF && B_c == FP_CLS_INF)
40 ret |= EFLAG_VXISI;
41
42 FP_ADD_D(R, T, B);
43
44#ifdef DEBUG
45 printk("D: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c);
46#endif
47
48 return (ret | __FP_PACK_DS(frD, R));
49}
diff --git a/arch/ppc/math-emu/fmr.c b/arch/ppc/math-emu/fmr.c
new file mode 100644
index 000000000000..28df700c0c7e
--- /dev/null
+++ b/arch/ppc/math-emu/fmr.c
@@ -0,0 +1,18 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5int
6fmr(u32 *frD, u32 *frB)
7{
8 frD[0] = frB[0];
9 frD[1] = frB[1];
10
11#ifdef DEBUG
12 printk("%s: D %p, B %p: ", __FUNCTION__, frD, frB);
13 dump_double(frD);
14 printk("\n");
15#endif
16
17 return 0;
18}
diff --git a/arch/ppc/math-emu/fmsub.c b/arch/ppc/math-emu/fmsub.c
new file mode 100644
index 000000000000..203fd48a6fec
--- /dev/null
+++ b/arch/ppc/math-emu/fmsub.c
@@ -0,0 +1,51 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5#include "soft-fp.h"
6#include "double.h"
7
8int
9fmsub(void *frD, void *frA, void *frB, void *frC)
10{
11 FP_DECL_D(R);
12 FP_DECL_D(A);
13 FP_DECL_D(B);
14 FP_DECL_D(C);
15 FP_DECL_D(T);
16 int ret = 0;
17
18#ifdef DEBUG
19 printk("%s: %p %p %p %p\n", __FUNCTION__, frD, frA, frB, frC);
20#endif
21
22 __FP_UNPACK_D(A, frA);
23 __FP_UNPACK_D(B, frB);
24 __FP_UNPACK_D(C, frC);
25
26#ifdef DEBUG
27 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c);
28 printk("B: %ld %lu %lu %ld (%ld)\n", B_s, B_f1, B_f0, B_e, B_c);
29 printk("C: %ld %lu %lu %ld (%ld)\n", C_s, C_f1, C_f0, C_e, C_c);
30#endif
31
32 if ((A_c == FP_CLS_INF && C_c == FP_CLS_ZERO) ||
33 (A_c == FP_CLS_ZERO && C_c == FP_CLS_INF))
34 ret |= EFLAG_VXIMZ;
35
36 FP_MUL_D(T, A, C);
37
38 if (B_c != FP_CLS_NAN)
39 B_s ^= 1;
40
41 if (T_s != B_s && T_c == FP_CLS_INF && B_c == FP_CLS_INF)
42 ret |= EFLAG_VXISI;
43
44 FP_ADD_D(R, T, B);
45
46#ifdef DEBUG
47 printk("D: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c);
48#endif
49
50 return (ret | __FP_PACK_D(frD, R));
51}
diff --git a/arch/ppc/math-emu/fmsubs.c b/arch/ppc/math-emu/fmsubs.c
new file mode 100644
index 000000000000..8ce68624c189
--- /dev/null
+++ b/arch/ppc/math-emu/fmsubs.c
@@ -0,0 +1,52 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5#include "soft-fp.h"
6#include "double.h"
7#include "single.h"
8
9int
10fmsubs(void *frD, void *frA, void *frB, void *frC)
11{
12 FP_DECL_D(R);
13 FP_DECL_D(A);
14 FP_DECL_D(B);
15 FP_DECL_D(C);
16 FP_DECL_D(T);
17 int ret = 0;
18
19#ifdef DEBUG
20 printk("%s: %p %p %p %p\n", __FUNCTION__, frD, frA, frB, frC);
21#endif
22
23 __FP_UNPACK_D(A, frA);
24 __FP_UNPACK_D(B, frB);
25 __FP_UNPACK_D(C, frC);
26
27#ifdef DEBUG
28 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c);
29 printk("B: %ld %lu %lu %ld (%ld)\n", B_s, B_f1, B_f0, B_e, B_c);
30 printk("C: %ld %lu %lu %ld (%ld)\n", C_s, C_f1, C_f0, C_e, C_c);
31#endif
32
33 if ((A_c == FP_CLS_INF && C_c == FP_CLS_ZERO) ||
34 (A_c == FP_CLS_ZERO && C_c == FP_CLS_INF))
35 ret |= EFLAG_VXIMZ;
36
37 FP_MUL_D(T, A, C);
38
39 if (B_c != FP_CLS_NAN)
40 B_s ^= 1;
41
42 if (T_s != B_s && T_c == FP_CLS_INF && B_c == FP_CLS_INF)
43 ret |= EFLAG_VXISI;
44
45 FP_ADD_D(R, T, B);
46
47#ifdef DEBUG
48 printk("D: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c);
49#endif
50
51 return (ret | __FP_PACK_DS(frD, R));
52}
diff --git a/arch/ppc/math-emu/fmul.c b/arch/ppc/math-emu/fmul.c
new file mode 100644
index 000000000000..66c7e79aae2e
--- /dev/null
+++ b/arch/ppc/math-emu/fmul.c
@@ -0,0 +1,42 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5#include "soft-fp.h"
6#include "double.h"
7
8int
9fmul(void *frD, void *frA, void *frB)
10{
11 FP_DECL_D(A);
12 FP_DECL_D(B);
13 FP_DECL_D(R);
14 int ret = 0;
15
16#ifdef DEBUG
17 printk("%s: %p %p %p\n", __FUNCTION__, frD, frA, frB);
18#endif
19
20 __FP_UNPACK_D(A, frA);
21 __FP_UNPACK_D(B, frB);
22
23#ifdef DEBUG
24 printk("A: %ld %lu %lu %ld (%ld) [%08lx.%08lx %lx]\n",
25 A_s, A_f1, A_f0, A_e, A_c, A_f1, A_f0, A_e + 1023);
26 printk("B: %ld %lu %lu %ld (%ld) [%08lx.%08lx %lx]\n",
27 B_s, B_f1, B_f0, B_e, B_c, B_f1, B_f0, B_e + 1023);
28#endif
29
30 if ((A_c == FP_CLS_INF && B_c == FP_CLS_ZERO) ||
31 (A_c == FP_CLS_ZERO && B_c == FP_CLS_INF))
32 ret |= EFLAG_VXIMZ;
33
34 FP_MUL_D(R, A, B);
35
36#ifdef DEBUG
37 printk("D: %ld %lu %lu %ld (%ld) [%08lx.%08lx %lx]\n",
38 R_s, R_f1, R_f0, R_e, R_c, R_f1, R_f0, R_e + 1023);
39#endif
40
41 return (ret | __FP_PACK_D(frD, R));
42}
diff --git a/arch/ppc/math-emu/fmuls.c b/arch/ppc/math-emu/fmuls.c
new file mode 100644
index 000000000000..26bc4278271c
--- /dev/null
+++ b/arch/ppc/math-emu/fmuls.c
@@ -0,0 +1,43 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5#include "soft-fp.h"
6#include "double.h"
7#include "single.h"
8
9int
10fmuls(void *frD, void *frA, void *frB)
11{
12 FP_DECL_D(A);
13 FP_DECL_D(B);
14 FP_DECL_D(R);
15 int ret = 0;
16
17#ifdef DEBUG
18 printk("%s: %p %p %p\n", __FUNCTION__, frD, frA, frB);
19#endif
20
21 __FP_UNPACK_D(A, frA);
22 __FP_UNPACK_D(B, frB);
23
24#ifdef DEBUG
25 printk("A: %ld %lu %lu %ld (%ld) [%08lx.%08lx %lx]\n",
26 A_s, A_f1, A_f0, A_e, A_c, A_f1, A_f0, A_e + 1023);
27 printk("B: %ld %lu %lu %ld (%ld) [%08lx.%08lx %lx]\n",
28 B_s, B_f1, B_f0, B_e, B_c, B_f1, B_f0, B_e + 1023);
29#endif
30
31 if ((A_c == FP_CLS_INF && B_c == FP_CLS_ZERO) ||
32 (A_c == FP_CLS_ZERO && B_c == FP_CLS_INF))
33 ret |= EFLAG_VXIMZ;
34
35 FP_MUL_D(R, A, B);
36
37#ifdef DEBUG
38 printk("D: %ld %lu %lu %ld (%ld) [%08lx.%08lx %lx]\n",
39 R_s, R_f1, R_f0, R_e, R_c, R_f1, R_f0, R_e + 1023);
40#endif
41
42 return (ret | __FP_PACK_DS(frD, R));
43}
diff --git a/arch/ppc/math-emu/fnabs.c b/arch/ppc/math-emu/fnabs.c
new file mode 100644
index 000000000000..c6b913d179e0
--- /dev/null
+++ b/arch/ppc/math-emu/fnabs.c
@@ -0,0 +1,18 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5int
6fnabs(u32 *frD, u32 *frB)
7{
8 frD[0] = frB[0] | 0x80000000;
9 frD[1] = frB[1];
10
11#ifdef DEBUG
12 printk("%s: D %p, B %p: ", __FUNCTION__, frD, frB);
13 dump_double(frD);
14 printk("\n");
15#endif
16
17 return 0;
18}
diff --git a/arch/ppc/math-emu/fneg.c b/arch/ppc/math-emu/fneg.c
new file mode 100644
index 000000000000..fe9a98deff69
--- /dev/null
+++ b/arch/ppc/math-emu/fneg.c
@@ -0,0 +1,18 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5int
6fneg(u32 *frD, u32 *frB)
7{
8 frD[0] = frB[0] ^ 0x80000000;
9 frD[1] = frB[1];
10
11#ifdef DEBUG
12 printk("%s: D %p, B %p: ", __FUNCTION__, frD, frB);
13 dump_double(frD);
14 printk("\n");
15#endif
16
17 return 0;
18}
diff --git a/arch/ppc/math-emu/fnmadd.c b/arch/ppc/math-emu/fnmadd.c
new file mode 100644
index 000000000000..7f312276d920
--- /dev/null
+++ b/arch/ppc/math-emu/fnmadd.c
@@ -0,0 +1,51 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5#include "soft-fp.h"
6#include "double.h"
7
8int
9fnmadd(void *frD, void *frA, void *frB, void *frC)
10{
11 FP_DECL_D(R);
12 FP_DECL_D(A);
13 FP_DECL_D(B);
14 FP_DECL_D(C);
15 FP_DECL_D(T);
16 int ret = 0;
17
18#ifdef DEBUG
19 printk("%s: %p %p %p %p\n", __FUNCTION__, frD, frA, frB, frC);
20#endif
21
22 __FP_UNPACK_D(A, frA);
23 __FP_UNPACK_D(B, frB);
24 __FP_UNPACK_D(C, frC);
25
26#ifdef DEBUG
27 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c);
28 printk("B: %ld %lu %lu %ld (%ld)\n", B_s, B_f1, B_f0, B_e, B_c);
29 printk("C: %ld %lu %lu %ld (%ld)\n", C_s, C_f1, C_f0, C_e, C_c);
30#endif
31
32 if ((A_c == FP_CLS_INF && C_c == FP_CLS_ZERO) ||
33 (A_c == FP_CLS_ZERO && C_c == FP_CLS_INF))
34 ret |= EFLAG_VXIMZ;
35
36 FP_MUL_D(T, A, C);
37
38 if (T_s != B_s && T_c == FP_CLS_INF && B_c == FP_CLS_INF)
39 ret |= EFLAG_VXISI;
40
41 FP_ADD_D(R, T, B);
42
43 if (R_c != FP_CLS_NAN)
44 R_s ^= 1;
45
46#ifdef DEBUG
47 printk("D: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c);
48#endif
49
50 return (ret | __FP_PACK_D(frD, R));
51}
diff --git a/arch/ppc/math-emu/fnmadds.c b/arch/ppc/math-emu/fnmadds.c
new file mode 100644
index 000000000000..65454c9c70bc
--- /dev/null
+++ b/arch/ppc/math-emu/fnmadds.c
@@ -0,0 +1,52 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5#include "soft-fp.h"
6#include "double.h"
7#include "single.h"
8
9int
10fnmadds(void *frD, void *frA, void *frB, void *frC)
11{
12 FP_DECL_D(R);
13 FP_DECL_D(A);
14 FP_DECL_D(B);
15 FP_DECL_D(C);
16 FP_DECL_D(T);
17 int ret = 0;
18
19#ifdef DEBUG
20 printk("%s: %p %p %p %p\n", __FUNCTION__, frD, frA, frB, frC);
21#endif
22
23 __FP_UNPACK_D(A, frA);
24 __FP_UNPACK_D(B, frB);
25 __FP_UNPACK_D(C, frC);
26
27#ifdef DEBUG
28 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c);
29 printk("B: %ld %lu %lu %ld (%ld)\n", B_s, B_f1, B_f0, B_e, B_c);
30 printk("C: %ld %lu %lu %ld (%ld)\n", C_s, C_f1, C_f0, C_e, C_c);
31#endif
32
33 if ((A_c == FP_CLS_INF && C_c == FP_CLS_ZERO) ||
34 (A_c == FP_CLS_ZERO && C_c == FP_CLS_INF))
35 ret |= EFLAG_VXIMZ;
36
37 FP_MUL_D(T, A, C);
38
39 if (T_s != B_s && T_c == FP_CLS_INF && B_c == FP_CLS_INF)
40 ret |= EFLAG_VXISI;
41
42 FP_ADD_D(R, T, B);
43
44 if (R_c != FP_CLS_NAN)
45 R_s ^= 1;
46
47#ifdef DEBUG
48 printk("D: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c);
49#endif
50
51 return (ret | __FP_PACK_DS(frD, R));
52}
diff --git a/arch/ppc/math-emu/fnmsub.c b/arch/ppc/math-emu/fnmsub.c
new file mode 100644
index 000000000000..f1ca7482b5f0
--- /dev/null
+++ b/arch/ppc/math-emu/fnmsub.c
@@ -0,0 +1,54 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5#include "soft-fp.h"
6#include "double.h"
7
8int
9fnmsub(void *frD, void *frA, void *frB, void *frC)
10{
11 FP_DECL_D(R);
12 FP_DECL_D(A);
13 FP_DECL_D(B);
14 FP_DECL_D(C);
15 FP_DECL_D(T);
16 int ret = 0;
17
18#ifdef DEBUG
19 printk("%s: %p %p %p %p\n", __FUNCTION__, frD, frA, frB, frC);
20#endif
21
22 __FP_UNPACK_D(A, frA);
23 __FP_UNPACK_D(B, frB);
24 __FP_UNPACK_D(C, frC);
25
26#ifdef DEBUG
27 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c);
28 printk("B: %ld %lu %lu %ld (%ld)\n", B_s, B_f1, B_f0, B_e, B_c);
29 printk("C: %ld %lu %lu %ld (%ld)\n", C_s, C_f1, C_f0, C_e, C_c);
30#endif
31
32 if ((A_c == FP_CLS_INF && C_c == FP_CLS_ZERO) ||
33 (A_c == FP_CLS_ZERO && C_c == FP_CLS_INF))
34 ret |= EFLAG_VXIMZ;
35
36 FP_MUL_D(T, A, C);
37
38 if (B_c != FP_CLS_NAN)
39 B_s ^= 1;
40
41 if (T_s != B_s && T_c == FP_CLS_INF && B_c == FP_CLS_INF)
42 ret |= EFLAG_VXISI;
43
44 FP_ADD_D(R, T, B);
45
46 if (R_c != FP_CLS_NAN)
47 R_s ^= 1;
48
49#ifdef DEBUG
50 printk("D: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c);
51#endif
52
53 return (ret | __FP_PACK_D(frD, R));
54}
diff --git a/arch/ppc/math-emu/fnmsubs.c b/arch/ppc/math-emu/fnmsubs.c
new file mode 100644
index 000000000000..5c9a09a87dc7
--- /dev/null
+++ b/arch/ppc/math-emu/fnmsubs.c
@@ -0,0 +1,55 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5#include "soft-fp.h"
6#include "double.h"
7#include "single.h"
8
9int
10fnmsubs(void *frD, void *frA, void *frB, void *frC)
11{
12 FP_DECL_D(R);
13 FP_DECL_D(A);
14 FP_DECL_D(B);
15 FP_DECL_D(C);
16 FP_DECL_D(T);
17 int ret = 0;
18
19#ifdef DEBUG
20 printk("%s: %p %p %p %p\n", __FUNCTION__, frD, frA, frB, frC);
21#endif
22
23 __FP_UNPACK_D(A, frA);
24 __FP_UNPACK_D(B, frB);
25 __FP_UNPACK_D(C, frC);
26
27#ifdef DEBUG
28 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c);
29 printk("B: %ld %lu %lu %ld (%ld)\n", B_s, B_f1, B_f0, B_e, B_c);
30 printk("C: %ld %lu %lu %ld (%ld)\n", C_s, C_f1, C_f0, C_e, C_c);
31#endif
32
33 if ((A_c == FP_CLS_INF && C_c == FP_CLS_ZERO) ||
34 (A_c == FP_CLS_ZERO && C_c == FP_CLS_INF))
35 ret |= EFLAG_VXIMZ;
36
37 FP_MUL_D(T, A, C);
38
39 if (B_c != FP_CLS_NAN)
40 B_s ^= 1;
41
42 if (T_s != B_s && T_c == FP_CLS_INF && B_c == FP_CLS_INF)
43 ret |= EFLAG_VXISI;
44
45 FP_ADD_D(R, T, B);
46
47 if (R_c != FP_CLS_NAN)
48 R_s ^= 1;
49
50#ifdef DEBUG
51 printk("D: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c);
52#endif
53
54 return (ret | __FP_PACK_DS(frD, R));
55}
diff --git a/arch/ppc/math-emu/fres.c b/arch/ppc/math-emu/fres.c
new file mode 100644
index 000000000000..ec11e46d20af
--- /dev/null
+++ b/arch/ppc/math-emu/fres.c
@@ -0,0 +1,12 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5int
6fres(void *frD, void *frB)
7{
8#ifdef DEBUG
9 printk("%s: %p %p\n", __FUNCTION__, frD, frB);
10#endif
11 return -ENOSYS;
12}
diff --git a/arch/ppc/math-emu/frsp.c b/arch/ppc/math-emu/frsp.c
new file mode 100644
index 000000000000..d879b2a3d0c9
--- /dev/null
+++ b/arch/ppc/math-emu/frsp.c
@@ -0,0 +1,25 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5#include "soft-fp.h"
6#include "double.h"
7#include "single.h"
8
9int
10frsp(void *frD, void *frB)
11{
12 FP_DECL_D(B);
13
14#ifdef DEBUG
15 printk("%s: D %p, B %p\n", __FUNCTION__, frD, frB);
16#endif
17
18 __FP_UNPACK_D(B, frB);
19
20#ifdef DEBUG
21 printk("B: %ld %lu %lu %ld (%ld)\n", B_s, B_f1, B_f0, B_e, B_c);
22#endif
23
24 return __FP_PACK_DS(frD, B);
25}
diff --git a/arch/ppc/math-emu/frsqrte.c b/arch/ppc/math-emu/frsqrte.c
new file mode 100644
index 000000000000..a11ae1829850
--- /dev/null
+++ b/arch/ppc/math-emu/frsqrte.c
@@ -0,0 +1,12 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5int
6frsqrte(void *frD, void *frB)
7{
8#ifdef DEBUG
9 printk("%s: %p %p\n", __FUNCTION__, frD, frB);
10#endif
11 return 0;
12}
diff --git a/arch/ppc/math-emu/fsel.c b/arch/ppc/math-emu/fsel.c
new file mode 100644
index 000000000000..e36e6e72819a
--- /dev/null
+++ b/arch/ppc/math-emu/fsel.c
@@ -0,0 +1,38 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5#include "soft-fp.h"
6#include "double.h"
7
8int
9fsel(u32 *frD, void *frA, u32 *frB, u32 *frC)
10{
11 FP_DECL_D(A);
12
13#ifdef DEBUG
14 printk("%s: %p %p %p %p\n", __FUNCTION__, frD, frA, frB, frC);
15#endif
16
17 __FP_UNPACK_D(A, frA);
18
19#ifdef DEBUG
20 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c);
21 printk("B: %08x %08x\n", frB[0], frB[1]);
22 printk("C: %08x %08x\n", frC[0], frC[1]);
23#endif
24
25 if (A_c == FP_CLS_NAN || (A_c != FP_CLS_ZERO && A_s)) {
26 frD[0] = frB[0];
27 frD[1] = frB[1];
28 } else {
29 frD[0] = frC[0];
30 frD[1] = frC[1];
31 }
32
33#ifdef DEBUG
34 printk("D: %08x.%08x\n", frD[0], frD[1]);
35#endif
36
37 return 0;
38}
diff --git a/arch/ppc/math-emu/fsqrt.c b/arch/ppc/math-emu/fsqrt.c
new file mode 100644
index 000000000000..6f8319f64a8a
--- /dev/null
+++ b/arch/ppc/math-emu/fsqrt.c
@@ -0,0 +1,37 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5#include "soft-fp.h"
6#include "double.h"
7
8int
9fsqrt(void *frD, void *frB)
10{
11 FP_DECL_D(B);
12 FP_DECL_D(R);
13 int ret = 0;
14
15#ifdef DEBUG
16 printk("%s: %p %p %p %p\n", __FUNCTION__, frD, frB);
17#endif
18
19 __FP_UNPACK_D(B, frB);
20
21#ifdef DEBUG
22 printk("B: %ld %lu %lu %ld (%ld)\n", B_s, B_f1, B_f0, B_e, B_c);
23#endif
24
25 if (B_s && B_c != FP_CLS_ZERO)
26 ret |= EFLAG_VXSQRT;
27 if (B_c == FP_CLS_NAN)
28 ret |= EFLAG_VXSNAN;
29
30 FP_SQRT_D(R, B);
31
32#ifdef DEBUG
33 printk("R: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c);
34#endif
35
36 return (ret | __FP_PACK_D(frD, R));
37}
diff --git a/arch/ppc/math-emu/fsqrts.c b/arch/ppc/math-emu/fsqrts.c
new file mode 100644
index 000000000000..3b2b1cf55c12
--- /dev/null
+++ b/arch/ppc/math-emu/fsqrts.c
@@ -0,0 +1,38 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5#include "soft-fp.h"
6#include "double.h"
7#include "single.h"
8
9int
10fsqrts(void *frD, void *frB)
11{
12 FP_DECL_D(B);
13 FP_DECL_D(R);
14 int ret = 0;
15
16#ifdef DEBUG
17 printk("%s: %p %p %p %p\n", __FUNCTION__, frD, frB);
18#endif
19
20 __FP_UNPACK_D(B, frB);
21
22#ifdef DEBUG
23 printk("B: %ld %lu %lu %ld (%ld)\n", B_s, B_f1, B_f0, B_e, B_c);
24#endif
25
26 if (B_s && B_c != FP_CLS_ZERO)
27 ret |= EFLAG_VXSQRT;
28 if (B_c == FP_CLS_NAN)
29 ret |= EFLAG_VXSNAN;
30
31 FP_SQRT_D(R, B);
32
33#ifdef DEBUG
34 printk("R: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c);
35#endif
36
37 return (ret | __FP_PACK_DS(frD, R));
38}
diff --git a/arch/ppc/math-emu/fsub.c b/arch/ppc/math-emu/fsub.c
new file mode 100644
index 000000000000..956679042bb2
--- /dev/null
+++ b/arch/ppc/math-emu/fsub.c
@@ -0,0 +1,41 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5#include "soft-fp.h"
6#include "double.h"
7
8int
9fsub(void *frD, void *frA, void *frB)
10{
11 FP_DECL_D(A);
12 FP_DECL_D(B);
13 FP_DECL_D(R);
14 int ret = 0;
15
16#ifdef DEBUG
17 printk("%s: %p %p %p\n", __FUNCTION__, frD, frA, frB);
18#endif
19
20 __FP_UNPACK_D(A, frA);
21 __FP_UNPACK_D(B, frB);
22
23#ifdef DEBUG
24 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c);
25 printk("B: %ld %lu %lu %ld (%ld)\n", B_s, B_f1, B_f0, B_e, B_c);
26#endif
27
28 if (B_c != FP_CLS_NAN)
29 B_s ^= 1;
30
31 if (A_s != B_s && A_c == FP_CLS_INF && B_c == FP_CLS_INF)
32 ret |= EFLAG_VXISI;
33
34 FP_ADD_D(R, A, B);
35
36#ifdef DEBUG
37 printk("D: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c);
38#endif
39
40 return (ret | __FP_PACK_D(frD, R));
41}
diff --git a/arch/ppc/math-emu/fsubs.c b/arch/ppc/math-emu/fsubs.c
new file mode 100644
index 000000000000..3428117dfe8c
--- /dev/null
+++ b/arch/ppc/math-emu/fsubs.c
@@ -0,0 +1,42 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5#include "soft-fp.h"
6#include "double.h"
7#include "single.h"
8
9int
10fsubs(void *frD, void *frA, void *frB)
11{
12 FP_DECL_D(A);
13 FP_DECL_D(B);
14 FP_DECL_D(R);
15 int ret = 0;
16
17#ifdef DEBUG
18 printk("%s: %p %p %p\n", __FUNCTION__, frD, frA, frB);
19#endif
20
21 __FP_UNPACK_D(A, frA);
22 __FP_UNPACK_D(B, frB);
23
24#ifdef DEBUG
25 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c);
26 printk("B: %ld %lu %lu %ld (%ld)\n", B_s, B_f1, B_f0, B_e, B_c);
27#endif
28
29 if (B_c != FP_CLS_NAN)
30 B_s ^= 1;
31
32 if (A_s != B_s && A_c == FP_CLS_INF && B_c == FP_CLS_INF)
33 ret |= EFLAG_VXISI;
34
35 FP_ADD_D(R, A, B);
36
37#ifdef DEBUG
38 printk("D: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c);
39#endif
40
41 return (ret | __FP_PACK_DS(frD, R));
42}
diff --git a/arch/ppc/math-emu/lfd.c b/arch/ppc/math-emu/lfd.c
new file mode 100644
index 000000000000..7d38101c329b
--- /dev/null
+++ b/arch/ppc/math-emu/lfd.c
@@ -0,0 +1,19 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5#include "sfp-machine.h"
6#include "double.h"
7
8int
9lfd(void *frD, void *ea)
10{
11 if (copy_from_user(frD, ea, sizeof(double)))
12 return -EFAULT;
13#ifdef DEBUG
14 printk("%s: D %p, ea %p: ", __FUNCTION__, frD, ea);
15 dump_double(frD);
16 printk("\n");
17#endif
18 return 0;
19}
diff --git a/arch/ppc/math-emu/lfs.c b/arch/ppc/math-emu/lfs.c
new file mode 100644
index 000000000000..c86dee3d7655
--- /dev/null
+++ b/arch/ppc/math-emu/lfs.c
@@ -0,0 +1,37 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5#include "soft-fp.h"
6#include "double.h"
7#include "single.h"
8
9int
10lfs(void *frD, void *ea)
11{
12 FP_DECL_D(R);
13 FP_DECL_S(A);
14 float f;
15
16#ifdef DEBUG
17 printk("%s: D %p, ea %p\n", __FUNCTION__, frD, ea);
18#endif
19
20 if (copy_from_user(&f, ea, sizeof(float)))
21 return -EFAULT;
22
23 __FP_UNPACK_S(A, &f);
24
25#ifdef DEBUG
26 printk("A: %ld %lu %ld (%ld) [%08lx]\n", A_s, A_f, A_e, A_c,
27 *(unsigned long *)&f);
28#endif
29
30 FP_CONV(D, S, 2, 1, R, A);
31
32#ifdef DEBUG
33 printk("R: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c);
34#endif
35
36 return __FP_PACK_D(frD, R);
37}
diff --git a/arch/ppc/math-emu/math.c b/arch/ppc/math-emu/math.c
new file mode 100644
index 000000000000..b7dff53a7103
--- /dev/null
+++ b/arch/ppc/math-emu/math.c
@@ -0,0 +1,485 @@
1/*
2 * arch/ppc/math-emu/math.c
3 *
4 * Copyright (C) 1999 Eddie C. Dost (ecd@atecom.com)
5 */
6
7#include <linux/config.h>
8#include <linux/types.h>
9#include <linux/sched.h>
10
11#include <asm/uaccess.h>
12#include <asm/reg.h>
13
14#include "sfp-machine.h"
15#include "double.h"
16
17#define FLOATFUNC(x) extern int x(void *, void *, void *, void *)
18
19FLOATFUNC(fadd);
20FLOATFUNC(fadds);
21FLOATFUNC(fdiv);
22FLOATFUNC(fdivs);
23FLOATFUNC(fmul);
24FLOATFUNC(fmuls);
25FLOATFUNC(fsub);
26FLOATFUNC(fsubs);
27
28FLOATFUNC(fmadd);
29FLOATFUNC(fmadds);
30FLOATFUNC(fmsub);
31FLOATFUNC(fmsubs);
32FLOATFUNC(fnmadd);
33FLOATFUNC(fnmadds);
34FLOATFUNC(fnmsub);
35FLOATFUNC(fnmsubs);
36
37FLOATFUNC(fctiw);
38FLOATFUNC(fctiwz);
39FLOATFUNC(frsp);
40
41FLOATFUNC(fcmpo);
42FLOATFUNC(fcmpu);
43
44FLOATFUNC(mcrfs);
45FLOATFUNC(mffs);
46FLOATFUNC(mtfsb0);
47FLOATFUNC(mtfsb1);
48FLOATFUNC(mtfsf);
49FLOATFUNC(mtfsfi);
50
51FLOATFUNC(lfd);
52FLOATFUNC(lfs);
53
54FLOATFUNC(stfd);
55FLOATFUNC(stfs);
56FLOATFUNC(stfiwx);
57
58FLOATFUNC(fabs);
59FLOATFUNC(fmr);
60FLOATFUNC(fnabs);
61FLOATFUNC(fneg);
62
63/* Optional */
64FLOATFUNC(fres);
65FLOATFUNC(frsqrte);
66FLOATFUNC(fsel);
67FLOATFUNC(fsqrt);
68FLOATFUNC(fsqrts);
69
70
71#define OP31 0x1f /* 31 */
72#define LFS 0x30 /* 48 */
73#define LFSU 0x31 /* 49 */
74#define LFD 0x32 /* 50 */
75#define LFDU 0x33 /* 51 */
76#define STFS 0x34 /* 52 */
77#define STFSU 0x35 /* 53 */
78#define STFD 0x36 /* 54 */
79#define STFDU 0x37 /* 55 */
80#define OP59 0x3b /* 59 */
81#define OP63 0x3f /* 63 */
82
83/* Opcode 31: */
84/* X-Form: */
85#define LFSX 0x217 /* 535 */
86#define LFSUX 0x237 /* 567 */
87#define LFDX 0x257 /* 599 */
88#define LFDUX 0x277 /* 631 */
89#define STFSX 0x297 /* 663 */
90#define STFSUX 0x2b7 /* 695 */
91#define STFDX 0x2d7 /* 727 */
92#define STFDUX 0x2f7 /* 759 */
93#define STFIWX 0x3d7 /* 983 */
94
95/* Opcode 59: */
96/* A-Form: */
97#define FDIVS 0x012 /* 18 */
98#define FSUBS 0x014 /* 20 */
99#define FADDS 0x015 /* 21 */
100#define FSQRTS 0x016 /* 22 */
101#define FRES 0x018 /* 24 */
102#define FMULS 0x019 /* 25 */
103#define FMSUBS 0x01c /* 28 */
104#define FMADDS 0x01d /* 29 */
105#define FNMSUBS 0x01e /* 30 */
106#define FNMADDS 0x01f /* 31 */
107
108/* Opcode 63: */
109/* A-Form: */
110#define FDIV 0x012 /* 18 */
111#define FSUB 0x014 /* 20 */
112#define FADD 0x015 /* 21 */
113#define FSQRT 0x016 /* 22 */
114#define FSEL 0x017 /* 23 */
115#define FMUL 0x019 /* 25 */
116#define FRSQRTE 0x01a /* 26 */
117#define FMSUB 0x01c /* 28 */
118#define FMADD 0x01d /* 29 */
119#define FNMSUB 0x01e /* 30 */
120#define FNMADD 0x01f /* 31 */
121
122/* X-Form: */
123#define FCMPU 0x000 /* 0 */
124#define FRSP 0x00c /* 12 */
125#define FCTIW 0x00e /* 14 */
126#define FCTIWZ 0x00f /* 15 */
127#define FCMPO 0x020 /* 32 */
128#define MTFSB1 0x026 /* 38 */
129#define FNEG 0x028 /* 40 */
130#define MCRFS 0x040 /* 64 */
131#define MTFSB0 0x046 /* 70 */
132#define FMR 0x048 /* 72 */
133#define MTFSFI 0x086 /* 134 */
134#define FNABS 0x088 /* 136 */
135#define FABS 0x108 /* 264 */
136#define MFFS 0x247 /* 583 */
137#define MTFSF 0x2c7 /* 711 */
138
139
140#define AB 2
141#define AC 3
142#define ABC 4
143#define D 5
144#define DU 6
145#define X 7
146#define XA 8
147#define XB 9
148#define XCR 11
149#define XCRB 12
150#define XCRI 13
151#define XCRL 16
152#define XE 14
153#define XEU 15
154#define XFLB 10
155
156#ifdef CONFIG_MATH_EMULATION
157static int
158record_exception(struct pt_regs *regs, int eflag)
159{
160 u32 fpscr;
161
162 fpscr = __FPU_FPSCR;
163
164 if (eflag) {
165 fpscr |= FPSCR_FX;
166 if (eflag & EFLAG_OVERFLOW)
167 fpscr |= FPSCR_OX;
168 if (eflag & EFLAG_UNDERFLOW)
169 fpscr |= FPSCR_UX;
170 if (eflag & EFLAG_DIVZERO)
171 fpscr |= FPSCR_ZX;
172 if (eflag & EFLAG_INEXACT)
173 fpscr |= FPSCR_XX;
174 if (eflag & EFLAG_VXSNAN)
175 fpscr |= FPSCR_VXSNAN;
176 if (eflag & EFLAG_VXISI)
177 fpscr |= FPSCR_VXISI;
178 if (eflag & EFLAG_VXIDI)
179 fpscr |= FPSCR_VXIDI;
180 if (eflag & EFLAG_VXZDZ)
181 fpscr |= FPSCR_VXZDZ;
182 if (eflag & EFLAG_VXIMZ)
183 fpscr |= FPSCR_VXIMZ;
184 if (eflag & EFLAG_VXVC)
185 fpscr |= FPSCR_VXVC;
186 if (eflag & EFLAG_VXSOFT)
187 fpscr |= FPSCR_VXSOFT;
188 if (eflag & EFLAG_VXSQRT)
189 fpscr |= FPSCR_VXSQRT;
190 if (eflag & EFLAG_VXCVI)
191 fpscr |= FPSCR_VXCVI;
192 }
193
194 fpscr &= ~(FPSCR_VX);
195 if (fpscr & (FPSCR_VXSNAN | FPSCR_VXISI | FPSCR_VXIDI |
196 FPSCR_VXZDZ | FPSCR_VXIMZ | FPSCR_VXVC |
197 FPSCR_VXSOFT | FPSCR_VXSQRT | FPSCR_VXCVI))
198 fpscr |= FPSCR_VX;
199
200 fpscr &= ~(FPSCR_FEX);
201 if (((fpscr & FPSCR_VX) && (fpscr & FPSCR_VE)) ||
202 ((fpscr & FPSCR_OX) && (fpscr & FPSCR_OE)) ||
203 ((fpscr & FPSCR_UX) && (fpscr & FPSCR_UE)) ||
204 ((fpscr & FPSCR_ZX) && (fpscr & FPSCR_ZE)) ||
205 ((fpscr & FPSCR_XX) && (fpscr & FPSCR_XE)))
206 fpscr |= FPSCR_FEX;
207
208 __FPU_FPSCR = fpscr;
209
210 return (fpscr & FPSCR_FEX) ? 1 : 0;
211}
212#endif /* CONFIG_MATH_EMULATION */
213
214int
215do_mathemu(struct pt_regs *regs)
216{
217 void *op0 = 0, *op1 = 0, *op2 = 0, *op3 = 0;
218 unsigned long pc = regs->nip;
219 signed short sdisp;
220 u32 insn = 0;
221 int idx = 0;
222#ifdef CONFIG_MATH_EMULATION
223 int (*func)(void *, void *, void *, void *);
224 int type = 0;
225 int eflag, trap;
226#endif
227
228 if (get_user(insn, (u32 *)pc))
229 return -EFAULT;
230
231#ifndef CONFIG_MATH_EMULATION
232 switch (insn >> 26) {
233 case LFD:
234 idx = (insn >> 16) & 0x1f;
235 sdisp = (insn & 0xffff);
236 op0 = (void *)&current->thread.fpr[(insn >> 21) & 0x1f];
237 op1 = (void *)((idx ? regs->gpr[idx] : 0) + sdisp);
238 lfd(op0, op1, op2, op3);
239 break;
240 case LFDU:
241 idx = (insn >> 16) & 0x1f;
242 sdisp = (insn & 0xffff);
243 op0 = (void *)&current->thread.fpr[(insn >> 21) & 0x1f];
244 op1 = (void *)((idx ? regs->gpr[idx] : 0) + sdisp);
245 lfd(op0, op1, op2, op3);
246 regs->gpr[idx] = (unsigned long)op1;
247 break;
248 case STFD:
249 idx = (insn >> 16) & 0x1f;
250 sdisp = (insn & 0xffff);
251 op0 = (void *)&current->thread.fpr[(insn >> 21) & 0x1f];
252 op1 = (void *)((idx ? regs->gpr[idx] : 0) + sdisp);
253 stfd(op0, op1, op2, op3);
254 break;
255 case STFDU:
256 idx = (insn >> 16) & 0x1f;
257 sdisp = (insn & 0xffff);
258 op0 = (void *)&current->thread.fpr[(insn >> 21) & 0x1f];
259 op1 = (void *)((idx ? regs->gpr[idx] : 0) + sdisp);
260 stfd(op0, op1, op2, op3);
261 regs->gpr[idx] = (unsigned long)op1;
262 break;
263 case OP63:
264 op0 = (void *)&current->thread.fpr[(insn >> 21) & 0x1f];
265 op1 = (void *)&current->thread.fpr[(insn >> 11) & 0x1f];
266 fmr(op0, op1, op2, op3);
267 break;
268 default:
269 goto illegal;
270 }
271#else /* CONFIG_MATH_EMULATION */
272 switch (insn >> 26) {
273 case LFS: func = lfs; type = D; break;
274 case LFSU: func = lfs; type = DU; break;
275 case LFD: func = lfd; type = D; break;
276 case LFDU: func = lfd; type = DU; break;
277 case STFS: func = stfs; type = D; break;
278 case STFSU: func = stfs; type = DU; break;
279 case STFD: func = stfd; type = D; break;
280 case STFDU: func = stfd; type = DU; break;
281
282 case OP31:
283 switch ((insn >> 1) & 0x3ff) {
284 case LFSX: func = lfs; type = XE; break;
285 case LFSUX: func = lfs; type = XEU; break;
286 case LFDX: func = lfd; type = XE; break;
287 case LFDUX: func = lfd; type = XEU; break;
288 case STFSX: func = stfs; type = XE; break;
289 case STFSUX: func = stfs; type = XEU; break;
290 case STFDX: func = stfd; type = XE; break;
291 case STFDUX: func = stfd; type = XEU; break;
292 case STFIWX: func = stfiwx; type = XE; break;
293 default:
294 goto illegal;
295 }
296 break;
297
298 case OP59:
299 switch ((insn >> 1) & 0x1f) {
300 case FDIVS: func = fdivs; type = AB; break;
301 case FSUBS: func = fsubs; type = AB; break;
302 case FADDS: func = fadds; type = AB; break;
303 case FSQRTS: func = fsqrts; type = AB; break;
304 case FRES: func = fres; type = AB; break;
305 case FMULS: func = fmuls; type = AC; break;
306 case FMSUBS: func = fmsubs; type = ABC; break;
307 case FMADDS: func = fmadds; type = ABC; break;
308 case FNMSUBS: func = fnmsubs; type = ABC; break;
309 case FNMADDS: func = fnmadds; type = ABC; break;
310 default:
311 goto illegal;
312 }
313 break;
314
315 case OP63:
316 if (insn & 0x20) {
317 switch ((insn >> 1) & 0x1f) {
318 case FDIV: func = fdiv; type = AB; break;
319 case FSUB: func = fsub; type = AB; break;
320 case FADD: func = fadd; type = AB; break;
321 case FSQRT: func = fsqrt; type = AB; break;
322 case FSEL: func = fsel; type = ABC; break;
323 case FMUL: func = fmul; type = AC; break;
324 case FRSQRTE: func = frsqrte; type = AB; break;
325 case FMSUB: func = fmsub; type = ABC; break;
326 case FMADD: func = fmadd; type = ABC; break;
327 case FNMSUB: func = fnmsub; type = ABC; break;
328 case FNMADD: func = fnmadd; type = ABC; break;
329 default:
330 goto illegal;
331 }
332 break;
333 }
334
335 switch ((insn >> 1) & 0x3ff) {
336 case FCMPU: func = fcmpu; type = XCR; break;
337 case FRSP: func = frsp; type = XB; break;
338 case FCTIW: func = fctiw; type = XB; break;
339 case FCTIWZ: func = fctiwz; type = XB; break;
340 case FCMPO: func = fcmpo; type = XCR; break;
341 case MTFSB1: func = mtfsb1; type = XCRB; break;
342 case FNEG: func = fneg; type = XB; break;
343 case MCRFS: func = mcrfs; type = XCRL; break;
344 case MTFSB0: func = mtfsb0; type = XCRB; break;
345 case FMR: func = fmr; type = XB; break;
346 case MTFSFI: func = mtfsfi; type = XCRI; break;
347 case FNABS: func = fnabs; type = XB; break;
348 case FABS: func = fabs; type = XB; break;
349 case MFFS: func = mffs; type = X; break;
350 case MTFSF: func = mtfsf; type = XFLB; break;
351 default:
352 goto illegal;
353 }
354 break;
355
356 default:
357 goto illegal;
358 }
359
360 switch (type) {
361 case AB:
362 op0 = (void *)&current->thread.fpr[(insn >> 21) & 0x1f];
363 op1 = (void *)&current->thread.fpr[(insn >> 16) & 0x1f];
364 op2 = (void *)&current->thread.fpr[(insn >> 11) & 0x1f];
365 break;
366
367 case AC:
368 op0 = (void *)&current->thread.fpr[(insn >> 21) & 0x1f];
369 op1 = (void *)&current->thread.fpr[(insn >> 16) & 0x1f];
370 op2 = (void *)&current->thread.fpr[(insn >> 6) & 0x1f];
371 break;
372
373 case ABC:
374 op0 = (void *)&current->thread.fpr[(insn >> 21) & 0x1f];
375 op1 = (void *)&current->thread.fpr[(insn >> 16) & 0x1f];
376 op2 = (void *)&current->thread.fpr[(insn >> 11) & 0x1f];
377 op3 = (void *)&current->thread.fpr[(insn >> 6) & 0x1f];
378 break;
379
380 case D:
381 idx = (insn >> 16) & 0x1f;
382 sdisp = (insn & 0xffff);
383 op0 = (void *)&current->thread.fpr[(insn >> 21) & 0x1f];
384 op1 = (void *)((idx ? regs->gpr[idx] : 0) + sdisp);
385 break;
386
387 case DU:
388 idx = (insn >> 16) & 0x1f;
389 if (!idx)
390 goto illegal;
391
392 sdisp = (insn & 0xffff);
393 op0 = (void *)&current->thread.fpr[(insn >> 21) & 0x1f];
394 op1 = (void *)(regs->gpr[idx] + sdisp);
395 break;
396
397 case X:
398 op0 = (void *)&current->thread.fpr[(insn >> 21) & 0x1f];
399 break;
400
401 case XA:
402 op0 = (void *)&current->thread.fpr[(insn >> 21) & 0x1f];
403 op1 = (void *)&current->thread.fpr[(insn >> 16) & 0x1f];
404 break;
405
406 case XB:
407 op0 = (void *)&current->thread.fpr[(insn >> 21) & 0x1f];
408 op1 = (void *)&current->thread.fpr[(insn >> 11) & 0x1f];
409 break;
410
411 case XE:
412 idx = (insn >> 16) & 0x1f;
413 if (!idx)
414 goto illegal;
415
416 op0 = (void *)&current->thread.fpr[(insn >> 21) & 0x1f];
417 op1 = (void *)(regs->gpr[idx] + regs->gpr[(insn >> 11) & 0x1f]);
418 break;
419
420 case XEU:
421 idx = (insn >> 16) & 0x1f;
422 op0 = (void *)&current->thread.fpr[(insn >> 21) & 0x1f];
423 op1 = (void *)((idx ? regs->gpr[idx] : 0)
424 + regs->gpr[(insn >> 11) & 0x1f]);
425 break;
426
427 case XCR:
428 op0 = (void *)&regs->ccr;
429 op1 = (void *)((insn >> 23) & 0x7);
430 op2 = (void *)&current->thread.fpr[(insn >> 16) & 0x1f];
431 op3 = (void *)&current->thread.fpr[(insn >> 11) & 0x1f];
432 break;
433
434 case XCRL:
435 op0 = (void *)&regs->ccr;
436 op1 = (void *)((insn >> 23) & 0x7);
437 op2 = (void *)((insn >> 18) & 0x7);
438 break;
439
440 case XCRB:
441 op0 = (void *)((insn >> 21) & 0x1f);
442 break;
443
444 case XCRI:
445 op0 = (void *)((insn >> 23) & 0x7);
446 op1 = (void *)((insn >> 12) & 0xf);
447 break;
448
449 case XFLB:
450 op0 = (void *)((insn >> 17) & 0xff);
451 op1 = (void *)&current->thread.fpr[(insn >> 11) & 0x1f];
452 break;
453
454 default:
455 goto illegal;
456 }
457
458 eflag = func(op0, op1, op2, op3);
459
460 if (insn & 1) {
461 regs->ccr &= ~(0x0f000000);
462 regs->ccr |= (__FPU_FPSCR >> 4) & 0x0f000000;
463 }
464
465 trap = record_exception(regs, eflag);
466 if (trap)
467 return 1;
468
469 switch (type) {
470 case DU:
471 case XEU:
472 regs->gpr[idx] = (unsigned long)op1;
473 break;
474
475 default:
476 break;
477 }
478#endif /* CONFIG_MATH_EMULATION */
479
480 regs->nip += 4;
481 return 0;
482
483illegal:
484 return -ENOSYS;
485}
diff --git a/arch/ppc/math-emu/mcrfs.c b/arch/ppc/math-emu/mcrfs.c
new file mode 100644
index 000000000000..106dd912914b
--- /dev/null
+++ b/arch/ppc/math-emu/mcrfs.c
@@ -0,0 +1,31 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5#include "soft-fp.h"
6
7int
8mcrfs(u32 *ccr, u32 crfD, u32 crfS)
9{
10 u32 value, clear;
11
12#ifdef DEBUG
13 printk("%s: %p (%08x) %d %d\n", __FUNCTION__, ccr, *ccr, crfD, crfS);
14#endif
15
16 clear = 15 << ((7 - crfS) << 2);
17 if (!crfS)
18 clear = 0x90000000;
19
20 value = (__FPU_FPSCR >> ((7 - crfS) << 2)) & 15;
21 __FPU_FPSCR &= ~(clear);
22
23 *ccr &= ~(15 << ((7 - crfD) << 2));
24 *ccr |= (value << ((7 - crfD) << 2));
25
26#ifdef DEBUG
27 printk("CR: %08x\n", __FUNCTION__, *ccr);
28#endif
29
30 return 0;
31}
diff --git a/arch/ppc/math-emu/mffs.c b/arch/ppc/math-emu/mffs.c
new file mode 100644
index 000000000000..f477c9170e75
--- /dev/null
+++ b/arch/ppc/math-emu/mffs.c
@@ -0,0 +1,17 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5#include "soft-fp.h"
6
7int
8mffs(u32 *frD)
9{
10 frD[1] = __FPU_FPSCR;
11
12#ifdef DEBUG
13 printk("%s: frD %p: %08x.%08x\n", __FUNCTION__, frD, frD[0], frD[1]);
14#endif
15
16 return 0;
17}
diff --git a/arch/ppc/math-emu/mtfsb0.c b/arch/ppc/math-emu/mtfsb0.c
new file mode 100644
index 000000000000..99bfd80f4af3
--- /dev/null
+++ b/arch/ppc/math-emu/mtfsb0.c
@@ -0,0 +1,18 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5#include "soft-fp.h"
6
7int
8mtfsb0(int crbD)
9{
10 if ((crbD != 1) && (crbD != 2))
11 __FPU_FPSCR &= ~(1 << (31 - crbD));
12
13#ifdef DEBUG
14 printk("%s: %d %08lx\n", __FUNCTION__, crbD, __FPU_FPSCR);
15#endif
16
17 return 0;
18}
diff --git a/arch/ppc/math-emu/mtfsb1.c b/arch/ppc/math-emu/mtfsb1.c
new file mode 100644
index 000000000000..3d9e7ed92d2b
--- /dev/null
+++ b/arch/ppc/math-emu/mtfsb1.c
@@ -0,0 +1,18 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5#include "soft-fp.h"
6
7int
8mtfsb1(int crbD)
9{
10 if ((crbD != 1) && (crbD != 2))
11 __FPU_FPSCR |= (1 << (31 - crbD));
12
13#ifdef DEBUG
14 printk("%s: %d %08lx\n", __FUNCTION__, crbD, __FPU_FPSCR);
15#endif
16
17 return 0;
18}
diff --git a/arch/ppc/math-emu/mtfsf.c b/arch/ppc/math-emu/mtfsf.c
new file mode 100644
index 000000000000..d70cf714994c
--- /dev/null
+++ b/arch/ppc/math-emu/mtfsf.c
@@ -0,0 +1,45 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5#include "soft-fp.h"
6
7int
8mtfsf(unsigned int FM, u32 *frB)
9{
10 u32 mask;
11
12 if (FM == 0)
13 return 0;
14
15 if (FM == 0xff)
16 mask = 0x9fffffff;
17 else {
18 mask = 0;
19 if (FM & (1 << 0))
20 mask |= 0x90000000;
21 if (FM & (1 << 1))
22 mask |= 0x0f000000;
23 if (FM & (1 << 2))
24 mask |= 0x00f00000;
25 if (FM & (1 << 3))
26 mask |= 0x000f0000;
27 if (FM & (1 << 4))
28 mask |= 0x0000f000;
29 if (FM & (1 << 5))
30 mask |= 0x00000f00;
31 if (FM & (1 << 6))
32 mask |= 0x000000f0;
33 if (FM & (1 << 7))
34 mask |= 0x0000000f;
35 }
36
37 __FPU_FPSCR &= ~(mask);
38 __FPU_FPSCR |= (frB[1] & mask);
39
40#ifdef DEBUG
41 printk("%s: %02x %p: %08lx\n", __FUNCTION__, FM, frB, __FPU_FPSCR);
42#endif
43
44 return 0;
45}
diff --git a/arch/ppc/math-emu/mtfsfi.c b/arch/ppc/math-emu/mtfsfi.c
new file mode 100644
index 000000000000..71df854baa7e
--- /dev/null
+++ b/arch/ppc/math-emu/mtfsfi.c
@@ -0,0 +1,23 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5#include "soft-fp.h"
6
7int
8mtfsfi(unsigned int crfD, unsigned int IMM)
9{
10 u32 mask = 0xf;
11
12 if (!crfD)
13 mask = 9;
14
15 __FPU_FPSCR &= ~(mask << ((7 - crfD) << 2));
16 __FPU_FPSCR |= (IMM & 0xf) << ((7 - crfD) << 2);
17
18#ifdef DEBUG
19 printk("%s: %d %x: %08lx\n", __FUNCTION__, crfD, IMM, __FPU_FPSCR);
20#endif
21
22 return 0;
23}
diff --git a/arch/ppc/math-emu/op-1.h b/arch/ppc/math-emu/op-1.h
new file mode 100644
index 000000000000..c92fa95f562e
--- /dev/null
+++ b/arch/ppc/math-emu/op-1.h
@@ -0,0 +1,245 @@
1/*
2 * Basic one-word fraction declaration and manipulation.
3 */
4
5#define _FP_FRAC_DECL_1(X) _FP_W_TYPE X##_f
6#define _FP_FRAC_COPY_1(D,S) (D##_f = S##_f)
7#define _FP_FRAC_SET_1(X,I) (X##_f = I)
8#define _FP_FRAC_HIGH_1(X) (X##_f)
9#define _FP_FRAC_LOW_1(X) (X##_f)
10#define _FP_FRAC_WORD_1(X,w) (X##_f)
11
12#define _FP_FRAC_ADDI_1(X,I) (X##_f += I)
13#define _FP_FRAC_SLL_1(X,N) \
14 do { \
15 if (__builtin_constant_p(N) && (N) == 1) \
16 X##_f += X##_f; \
17 else \
18 X##_f <<= (N); \
19 } while (0)
20#define _FP_FRAC_SRL_1(X,N) (X##_f >>= N)
21
22/* Right shift with sticky-lsb. */
23#define _FP_FRAC_SRS_1(X,N,sz) __FP_FRAC_SRS_1(X##_f, N, sz)
24
25#define __FP_FRAC_SRS_1(X,N,sz) \
26 (X = (X >> (N) | (__builtin_constant_p(N) && (N) == 1 \
27 ? X & 1 : (X << (_FP_W_TYPE_SIZE - (N))) != 0)))
28
29#define _FP_FRAC_ADD_1(R,X,Y) (R##_f = X##_f + Y##_f)
30#define _FP_FRAC_SUB_1(R,X,Y) (R##_f = X##_f - Y##_f)
31#define _FP_FRAC_CLZ_1(z, X) __FP_CLZ(z, X##_f)
32
33/* Predicates */
34#define _FP_FRAC_NEGP_1(X) ((_FP_WS_TYPE)X##_f < 0)
35#define _FP_FRAC_ZEROP_1(X) (X##_f == 0)
36#define _FP_FRAC_OVERP_1(fs,X) (X##_f & _FP_OVERFLOW_##fs)
37#define _FP_FRAC_EQ_1(X, Y) (X##_f == Y##_f)
38#define _FP_FRAC_GE_1(X, Y) (X##_f >= Y##_f)
39#define _FP_FRAC_GT_1(X, Y) (X##_f > Y##_f)
40
41#define _FP_ZEROFRAC_1 0
42#define _FP_MINFRAC_1 1
43
44/*
45 * Unpack the raw bits of a native fp value. Do not classify or
46 * normalize the data.
47 */
48
49#define _FP_UNPACK_RAW_1(fs, X, val) \
50 do { \
51 union _FP_UNION_##fs _flo; _flo.flt = (val); \
52 \
53 X##_f = _flo.bits.frac; \
54 X##_e = _flo.bits.exp; \
55 X##_s = _flo.bits.sign; \
56 } while (0)
57
58
59/*
60 * Repack the raw bits of a native fp value.
61 */
62
63#define _FP_PACK_RAW_1(fs, val, X) \
64 do { \
65 union _FP_UNION_##fs _flo; \
66 \
67 _flo.bits.frac = X##_f; \
68 _flo.bits.exp = X##_e; \
69 _flo.bits.sign = X##_s; \
70 \
71 (val) = _flo.flt; \
72 } while (0)
73
74
75/*
76 * Multiplication algorithms:
77 */
78
79/* Basic. Assuming the host word size is >= 2*FRACBITS, we can do the
80 multiplication immediately. */
81
82#define _FP_MUL_MEAT_1_imm(fs, R, X, Y) \
83 do { \
84 R##_f = X##_f * Y##_f; \
85 /* Normalize since we know where the msb of the multiplicands \
86 were (bit B), we know that the msb of the of the product is \
87 at either 2B or 2B-1. */ \
88 _FP_FRAC_SRS_1(R, _FP_WFRACBITS_##fs-1, 2*_FP_WFRACBITS_##fs); \
89 } while (0)
90
91/* Given a 1W * 1W => 2W primitive, do the extended multiplication. */
92
93#define _FP_MUL_MEAT_1_wide(fs, R, X, Y, doit) \
94 do { \
95 _FP_W_TYPE _Z_f0, _Z_f1; \
96 doit(_Z_f1, _Z_f0, X##_f, Y##_f); \
97 /* Normalize since we know where the msb of the multiplicands \
98 were (bit B), we know that the msb of the of the product is \
99 at either 2B or 2B-1. */ \
100 _FP_FRAC_SRS_2(_Z, _FP_WFRACBITS_##fs-1, 2*_FP_WFRACBITS_##fs); \
101 R##_f = _Z_f0; \
102 } while (0)
103
104/* Finally, a simple widening multiply algorithm. What fun! */
105
106#define _FP_MUL_MEAT_1_hard(fs, R, X, Y) \
107 do { \
108 _FP_W_TYPE _xh, _xl, _yh, _yl, _z_f0, _z_f1, _a_f0, _a_f1; \
109 \
110 /* split the words in half */ \
111 _xh = X##_f >> (_FP_W_TYPE_SIZE/2); \
112 _xl = X##_f & (((_FP_W_TYPE)1 << (_FP_W_TYPE_SIZE/2)) - 1); \
113 _yh = Y##_f >> (_FP_W_TYPE_SIZE/2); \
114 _yl = Y##_f & (((_FP_W_TYPE)1 << (_FP_W_TYPE_SIZE/2)) - 1); \
115 \
116 /* multiply the pieces */ \
117 _z_f0 = _xl * _yl; \
118 _a_f0 = _xh * _yl; \
119 _a_f1 = _xl * _yh; \
120 _z_f1 = _xh * _yh; \
121 \
122 /* reassemble into two full words */ \
123 if ((_a_f0 += _a_f1) < _a_f1) \
124 _z_f1 += (_FP_W_TYPE)1 << (_FP_W_TYPE_SIZE/2); \
125 _a_f1 = _a_f0 >> (_FP_W_TYPE_SIZE/2); \
126 _a_f0 = _a_f0 << (_FP_W_TYPE_SIZE/2); \
127 _FP_FRAC_ADD_2(_z, _z, _a); \
128 \
129 /* normalize */ \
130 _FP_FRAC_SRS_2(_z, _FP_WFRACBITS_##fs - 1, 2*_FP_WFRACBITS_##fs); \
131 R##_f = _z_f0; \
132 } while (0)
133
134
135/*
136 * Division algorithms:
137 */
138
139/* Basic. Assuming the host word size is >= 2*FRACBITS, we can do the
140 division immediately. Give this macro either _FP_DIV_HELP_imm for
141 C primitives or _FP_DIV_HELP_ldiv for the ISO function. Which you
142 choose will depend on what the compiler does with divrem4. */
143
144#define _FP_DIV_MEAT_1_imm(fs, R, X, Y, doit) \
145 do { \
146 _FP_W_TYPE _q, _r; \
147 X##_f <<= (X##_f < Y##_f \
148 ? R##_e--, _FP_WFRACBITS_##fs \
149 : _FP_WFRACBITS_##fs - 1); \
150 doit(_q, _r, X##_f, Y##_f); \
151 R##_f = _q | (_r != 0); \
152 } while (0)
153
154/* GCC's longlong.h defines a 2W / 1W => (1W,1W) primitive udiv_qrnnd
155 that may be useful in this situation. This first is for a primitive
156 that requires normalization, the second for one that does not. Look
157 for UDIV_NEEDS_NORMALIZATION to tell which your machine needs. */
158
159#define _FP_DIV_MEAT_1_udiv_norm(fs, R, X, Y) \
160 do { \
161 _FP_W_TYPE _nh, _nl, _q, _r; \
162 \
163 /* Normalize Y -- i.e. make the most significant bit set. */ \
164 Y##_f <<= _FP_WFRACXBITS_##fs - 1; \
165 \
166 /* Shift X op correspondingly high, that is, up one full word. */ \
167 if (X##_f <= Y##_f) \
168 { \
169 _nl = 0; \
170 _nh = X##_f; \
171 } \
172 else \
173 { \
174 R##_e++; \
175 _nl = X##_f << (_FP_W_TYPE_SIZE-1); \
176 _nh = X##_f >> 1; \
177 } \
178 \
179 udiv_qrnnd(_q, _r, _nh, _nl, Y##_f); \
180 R##_f = _q | (_r != 0); \
181 } while (0)
182
183#define _FP_DIV_MEAT_1_udiv(fs, R, X, Y) \
184 do { \
185 _FP_W_TYPE _nh, _nl, _q, _r; \
186 if (X##_f < Y##_f) \
187 { \
188 R##_e--; \
189 _nl = X##_f << _FP_WFRACBITS_##fs; \
190 _nh = X##_f >> _FP_WFRACXBITS_##fs; \
191 } \
192 else \
193 { \
194 _nl = X##_f << (_FP_WFRACBITS_##fs - 1); \
195 _nh = X##_f >> (_FP_WFRACXBITS_##fs + 1); \
196 } \
197 udiv_qrnnd(_q, _r, _nh, _nl, Y##_f); \
198 R##_f = _q | (_r != 0); \
199 } while (0)
200
201
202/*
203 * Square root algorithms:
204 * We have just one right now, maybe Newton approximation
205 * should be added for those machines where division is fast.
206 */
207
208#define _FP_SQRT_MEAT_1(R, S, T, X, q) \
209 do { \
210 while (q) \
211 { \
212 T##_f = S##_f + q; \
213 if (T##_f <= X##_f) \
214 { \
215 S##_f = T##_f + q; \
216 X##_f -= T##_f; \
217 R##_f += q; \
218 } \
219 _FP_FRAC_SLL_1(X, 1); \
220 q >>= 1; \
221 } \
222 } while (0)
223
224/*
225 * Assembly/disassembly for converting to/from integral types.
226 * No shifting or overflow handled here.
227 */
228
229#define _FP_FRAC_ASSEMBLE_1(r, X, rsize) (r = X##_f)
230#define _FP_FRAC_DISASSEMBLE_1(X, r, rsize) (X##_f = r)
231
232
233/*
234 * Convert FP values between word sizes
235 */
236
237#define _FP_FRAC_CONV_1_1(dfs, sfs, D, S) \
238 do { \
239 D##_f = S##_f; \
240 if (_FP_WFRACBITS_##sfs > _FP_WFRACBITS_##dfs) \
241 _FP_FRAC_SRS_1(D, (_FP_WFRACBITS_##sfs-_FP_WFRACBITS_##dfs), \
242 _FP_WFRACBITS_##sfs); \
243 else \
244 D##_f <<= _FP_WFRACBITS_##dfs - _FP_WFRACBITS_##sfs; \
245 } while (0)
diff --git a/arch/ppc/math-emu/op-2.h b/arch/ppc/math-emu/op-2.h
new file mode 100644
index 000000000000..b9b06b4c6ea1
--- /dev/null
+++ b/arch/ppc/math-emu/op-2.h
@@ -0,0 +1,433 @@
1/*
2 * Basic two-word fraction declaration and manipulation.
3 */
4
5#define _FP_FRAC_DECL_2(X) _FP_W_TYPE X##_f0, X##_f1
6#define _FP_FRAC_COPY_2(D,S) (D##_f0 = S##_f0, D##_f1 = S##_f1)
7#define _FP_FRAC_SET_2(X,I) __FP_FRAC_SET_2(X, I)
8#define _FP_FRAC_HIGH_2(X) (X##_f1)
9#define _FP_FRAC_LOW_2(X) (X##_f0)
10#define _FP_FRAC_WORD_2(X,w) (X##_f##w)
11
12#define _FP_FRAC_SLL_2(X,N) \
13 do { \
14 if ((N) < _FP_W_TYPE_SIZE) \
15 { \
16 if (__builtin_constant_p(N) && (N) == 1) \
17 { \
18 X##_f1 = X##_f1 + X##_f1 + (((_FP_WS_TYPE)(X##_f0)) < 0); \
19 X##_f0 += X##_f0; \
20 } \
21 else \
22 { \
23 X##_f1 = X##_f1 << (N) | X##_f0 >> (_FP_W_TYPE_SIZE - (N)); \
24 X##_f0 <<= (N); \
25 } \
26 } \
27 else \
28 { \
29 X##_f1 = X##_f0 << ((N) - _FP_W_TYPE_SIZE); \
30 X##_f0 = 0; \
31 } \
32 } while (0)
33
34#define _FP_FRAC_SRL_2(X,N) \
35 do { \
36 if ((N) < _FP_W_TYPE_SIZE) \
37 { \
38 X##_f0 = X##_f0 >> (N) | X##_f1 << (_FP_W_TYPE_SIZE - (N)); \
39 X##_f1 >>= (N); \
40 } \
41 else \
42 { \
43 X##_f0 = X##_f1 >> ((N) - _FP_W_TYPE_SIZE); \
44 X##_f1 = 0; \
45 } \
46 } while (0)
47
48/* Right shift with sticky-lsb. */
49#define _FP_FRAC_SRS_2(X,N,sz) \
50 do { \
51 if ((N) < _FP_W_TYPE_SIZE) \
52 { \
53 X##_f0 = (X##_f1 << (_FP_W_TYPE_SIZE - (N)) | X##_f0 >> (N) | \
54 (__builtin_constant_p(N) && (N) == 1 \
55 ? X##_f0 & 1 \
56 : (X##_f0 << (_FP_W_TYPE_SIZE - (N))) != 0)); \
57 X##_f1 >>= (N); \
58 } \
59 else \
60 { \
61 X##_f0 = (X##_f1 >> ((N) - _FP_W_TYPE_SIZE) | \
62 (((X##_f1 << (sz - (N))) | X##_f0) != 0)); \
63 X##_f1 = 0; \
64 } \
65 } while (0)
66
67#define _FP_FRAC_ADDI_2(X,I) \
68 __FP_FRAC_ADDI_2(X##_f1, X##_f0, I)
69
70#define _FP_FRAC_ADD_2(R,X,Y) \
71 __FP_FRAC_ADD_2(R##_f1, R##_f0, X##_f1, X##_f0, Y##_f1, Y##_f0)
72
73#define _FP_FRAC_SUB_2(R,X,Y) \
74 __FP_FRAC_SUB_2(R##_f1, R##_f0, X##_f1, X##_f0, Y##_f1, Y##_f0)
75
76#define _FP_FRAC_CLZ_2(R,X) \
77 do { \
78 if (X##_f1) \
79 __FP_CLZ(R,X##_f1); \
80 else \
81 { \
82 __FP_CLZ(R,X##_f0); \
83 R += _FP_W_TYPE_SIZE; \
84 } \
85 } while(0)
86
87/* Predicates */
88#define _FP_FRAC_NEGP_2(X) ((_FP_WS_TYPE)X##_f1 < 0)
89#define _FP_FRAC_ZEROP_2(X) ((X##_f1 | X##_f0) == 0)
90#define _FP_FRAC_OVERP_2(fs,X) (X##_f1 & _FP_OVERFLOW_##fs)
91#define _FP_FRAC_EQ_2(X, Y) (X##_f1 == Y##_f1 && X##_f0 == Y##_f0)
92#define _FP_FRAC_GT_2(X, Y) \
93 ((X##_f1 > Y##_f1) || (X##_f1 == Y##_f1 && X##_f0 > Y##_f0))
94#define _FP_FRAC_GE_2(X, Y) \
95 ((X##_f1 > Y##_f1) || (X##_f1 == Y##_f1 && X##_f0 >= Y##_f0))
96
97#define _FP_ZEROFRAC_2 0, 0
98#define _FP_MINFRAC_2 0, 1
99
100/*
101 * Internals
102 */
103
104#define __FP_FRAC_SET_2(X,I1,I0) (X##_f0 = I0, X##_f1 = I1)
105
106#define __FP_CLZ_2(R, xh, xl) \
107 do { \
108 if (xh) \
109 __FP_CLZ(R,xl); \
110 else \
111 { \
112 __FP_CLZ(R,xl); \
113 R += _FP_W_TYPE_SIZE; \
114 } \
115 } while(0)
116
117#if 0
118
119#ifndef __FP_FRAC_ADDI_2
120#define __FP_FRAC_ADDI_2(xh, xl, i) \
121 (xh += ((xl += i) < i))
122#endif
123#ifndef __FP_FRAC_ADD_2
124#define __FP_FRAC_ADD_2(rh, rl, xh, xl, yh, yl) \
125 (rh = xh + yh + ((rl = xl + yl) < xl))
126#endif
127#ifndef __FP_FRAC_SUB_2
128#define __FP_FRAC_SUB_2(rh, rl, xh, xl, yh, yl) \
129 (rh = xh - yh - ((rl = xl - yl) > xl))
130#endif
131
132#else
133
134#undef __FP_FRAC_ADDI_2
135#define __FP_FRAC_ADDI_2(xh, xl, i) add_ssaaaa(xh, xl, xh, xl, 0, i)
136#undef __FP_FRAC_ADD_2
137#define __FP_FRAC_ADD_2 add_ssaaaa
138#undef __FP_FRAC_SUB_2
139#define __FP_FRAC_SUB_2 sub_ddmmss
140
141#endif
142
143/*
144 * Unpack the raw bits of a native fp value. Do not classify or
145 * normalize the data.
146 */
147
148#define _FP_UNPACK_RAW_2(fs, X, val) \
149 do { \
150 union _FP_UNION_##fs _flo; _flo.flt = (val); \
151 \
152 X##_f0 = _flo.bits.frac0; \
153 X##_f1 = _flo.bits.frac1; \
154 X##_e = _flo.bits.exp; \
155 X##_s = _flo.bits.sign; \
156 } while (0)
157
158
159/*
160 * Repack the raw bits of a native fp value.
161 */
162
163#define _FP_PACK_RAW_2(fs, val, X) \
164 do { \
165 union _FP_UNION_##fs _flo; \
166 \
167 _flo.bits.frac0 = X##_f0; \
168 _flo.bits.frac1 = X##_f1; \
169 _flo.bits.exp = X##_e; \
170 _flo.bits.sign = X##_s; \
171 \
172 (val) = _flo.flt; \
173 } while (0)
174
175
176/*
177 * Multiplication algorithms:
178 */
179
180/* Given a 1W * 1W => 2W primitive, do the extended multiplication. */
181
182#define _FP_MUL_MEAT_2_wide(fs, R, X, Y, doit) \
183 do { \
184 _FP_FRAC_DECL_4(_z); _FP_FRAC_DECL_2(_b); _FP_FRAC_DECL_2(_c); \
185 \
186 doit(_FP_FRAC_WORD_4(_z,1), _FP_FRAC_WORD_4(_z,0), X##_f0, Y##_f0); \
187 doit(_b_f1, _b_f0, X##_f0, Y##_f1); \
188 doit(_c_f1, _c_f0, X##_f1, Y##_f0); \
189 doit(_FP_FRAC_WORD_4(_z,3), _FP_FRAC_WORD_4(_z,2), X##_f1, Y##_f1); \
190 \
191 __FP_FRAC_ADD_4(_FP_FRAC_WORD_4(_z,3),_FP_FRAC_WORD_4(_z,2), \
192 _FP_FRAC_WORD_4(_z,1),_FP_FRAC_WORD_4(_z,0), \
193 0, _b_f1, _b_f0, 0, \
194 _FP_FRAC_WORD_4(_z,3),_FP_FRAC_WORD_4(_z,2), \
195 _FP_FRAC_WORD_4(_z,1),_FP_FRAC_WORD_4(_z,0)); \
196 __FP_FRAC_ADD_4(_FP_FRAC_WORD_4(_z,3),_FP_FRAC_WORD_4(_z,2), \
197 _FP_FRAC_WORD_4(_z,1),_FP_FRAC_WORD_4(_z,0), \
198 0, _c_f1, _c_f0, 0, \
199 _FP_FRAC_WORD_4(_z,3),_FP_FRAC_WORD_4(_z,2), \
200 _FP_FRAC_WORD_4(_z,1),_FP_FRAC_WORD_4(_z,0)); \
201 \
202 /* Normalize since we know where the msb of the multiplicands \
203 were (bit B), we know that the msb of the of the product is \
204 at either 2B or 2B-1. */ \
205 _FP_FRAC_SRS_4(_z, _FP_WFRACBITS_##fs-1, 2*_FP_WFRACBITS_##fs); \
206 R##_f0 = _FP_FRAC_WORD_4(_z,0); \
207 R##_f1 = _FP_FRAC_WORD_4(_z,1); \
208 } while (0)
209
210/* This next macro appears to be totally broken. Fortunately nowhere
211 * seems to use it :-> The problem is that we define _z[4] but
212 * then use it in _FP_FRAC_SRS_4, which will attempt to access
213 * _z_f[n] which will cause an error. The fix probably involves
214 * declaring it with _FP_FRAC_DECL_4, see previous macro. -- PMM 02/1998
215 */
216#define _FP_MUL_MEAT_2_gmp(fs, R, X, Y) \
217 do { \
218 _FP_W_TYPE _x[2], _y[2], _z[4]; \
219 _x[0] = X##_f0; _x[1] = X##_f1; \
220 _y[0] = Y##_f0; _y[1] = Y##_f1; \
221 \
222 mpn_mul_n(_z, _x, _y, 2); \
223 \
224 /* Normalize since we know where the msb of the multiplicands \
225 were (bit B), we know that the msb of the of the product is \
226 at either 2B or 2B-1. */ \
227 _FP_FRAC_SRS_4(_z, _FP_WFRACBITS##_fs-1, 2*_FP_WFRACBITS_##fs); \
228 R##_f0 = _z[0]; \
229 R##_f1 = _z[1]; \
230 } while (0)
231
232
233/*
234 * Division algorithms:
235 * This seems to be giving me difficulties -- PMM
236 * Look, NetBSD seems to be able to comment algorithms. Can't you?
237 * I've thrown printks at the problem.
238 * This now appears to work, but I still don't really know why.
239 * Also, I don't think the result is properly normalised...
240 */
241
242#define _FP_DIV_MEAT_2_udiv_64(fs, R, X, Y) \
243 do { \
244 extern void _fp_udivmodti4(_FP_W_TYPE q[2], _FP_W_TYPE r[2], \
245 _FP_W_TYPE n1, _FP_W_TYPE n0, \
246 _FP_W_TYPE d1, _FP_W_TYPE d0); \
247 _FP_W_TYPE _n_f3, _n_f2, _n_f1, _n_f0, _r_f1, _r_f0; \
248 _FP_W_TYPE _q_f1, _q_f0, _m_f1, _m_f0; \
249 _FP_W_TYPE _rmem[2], _qmem[2]; \
250 /* I think this check is to ensure that the result is normalised. \
251 * Assuming X,Y normalised (ie in [1.0,2.0)) X/Y will be in \
252 * [0.5,2.0). Furthermore, it will be less than 1.0 iff X < Y. \
253 * In this case we tweak things. (this is based on comments in \
254 * the NetBSD FPU emulation code. ) \
255 * We know X,Y are normalised because we ensure this as part of \
256 * the unpacking process. -- PMM \
257 */ \
258 if (_FP_FRAC_GT_2(X, Y)) \
259 { \
260/* R##_e++; */ \
261 _n_f3 = X##_f1 >> 1; \
262 _n_f2 = X##_f1 << (_FP_W_TYPE_SIZE - 1) | X##_f0 >> 1; \
263 _n_f1 = X##_f0 << (_FP_W_TYPE_SIZE - 1); \
264 _n_f0 = 0; \
265 } \
266 else \
267 { \
268 R##_e--; \
269 _n_f3 = X##_f1; \
270 _n_f2 = X##_f0; \
271 _n_f1 = _n_f0 = 0; \
272 } \
273 \
274 /* Normalize, i.e. make the most significant bit of the \
275 denominator set. CHANGED: - 1 to nothing -- PMM */ \
276 _FP_FRAC_SLL_2(Y, _FP_WFRACXBITS_##fs /* -1 */); \
277 \
278 /* Do the 256/128 bit division given the 128-bit _fp_udivmodtf4 \
279 primitive snagged from libgcc2.c. */ \
280 \
281 _fp_udivmodti4(_qmem, _rmem, _n_f3, _n_f2, 0, Y##_f1); \
282 _q_f1 = _qmem[0]; \
283 umul_ppmm(_m_f1, _m_f0, _q_f1, Y##_f0); \
284 _r_f1 = _rmem[0]; \
285 _r_f0 = _n_f1; \
286 if (_FP_FRAC_GT_2(_m, _r)) \
287 { \
288 _q_f1--; \
289 _FP_FRAC_ADD_2(_r, _r, Y); \
290 if (_FP_FRAC_GE_2(_r, Y) && _FP_FRAC_GT_2(_m, _r)) \
291 { \
292 _q_f1--; \
293 _FP_FRAC_ADD_2(_r, _r, Y); \
294 } \
295 } \
296 _FP_FRAC_SUB_2(_r, _r, _m); \
297 \
298 _fp_udivmodti4(_qmem, _rmem, _r_f1, _r_f0, 0, Y##_f1); \
299 _q_f0 = _qmem[0]; \
300 umul_ppmm(_m_f1, _m_f0, _q_f0, Y##_f0); \
301 _r_f1 = _rmem[0]; \
302 _r_f0 = _n_f0; \
303 if (_FP_FRAC_GT_2(_m, _r)) \
304 { \
305 _q_f0--; \
306 _FP_FRAC_ADD_2(_r, _r, Y); \
307 if (_FP_FRAC_GE_2(_r, Y) && _FP_FRAC_GT_2(_m, _r)) \
308 { \
309 _q_f0--; \
310 _FP_FRAC_ADD_2(_r, _r, Y); \
311 } \
312 } \
313 _FP_FRAC_SUB_2(_r, _r, _m); \
314 \
315 R##_f1 = _q_f1; \
316 R##_f0 = _q_f0 | ((_r_f1 | _r_f0) != 0); \
317 /* adjust so answer is normalized again. I'm not sure what the \
318 * final sz param should be. In practice it's never used since \
319 * N is 1 which is always going to be < _FP_W_TYPE_SIZE... \
320 */ \
321 /* _FP_FRAC_SRS_2(R,1,_FP_WFRACBITS_##fs); */ \
322 } while (0)
323
324
325#define _FP_DIV_MEAT_2_gmp(fs, R, X, Y) \
326 do { \
327 _FP_W_TYPE _x[4], _y[2], _z[4]; \
328 _y[0] = Y##_f0; _y[1] = Y##_f1; \
329 _x[0] = _x[3] = 0; \
330 if (_FP_FRAC_GT_2(X, Y)) \
331 { \
332 R##_e++; \
333 _x[1] = (X##_f0 << (_FP_WFRACBITS-1 - _FP_W_TYPE_SIZE) | \
334 X##_f1 >> (_FP_W_TYPE_SIZE - \
335 (_FP_WFRACBITS-1 - _FP_W_TYPE_SIZE))); \
336 _x[2] = X##_f1 << (_FP_WFRACBITS-1 - _FP_W_TYPE_SIZE); \
337 } \
338 else \
339 { \
340 _x[1] = (X##_f0 << (_FP_WFRACBITS - _FP_W_TYPE_SIZE) | \
341 X##_f1 >> (_FP_W_TYPE_SIZE - \
342 (_FP_WFRACBITS - _FP_W_TYPE_SIZE))); \
343 _x[2] = X##_f1 << (_FP_WFRACBITS - _FP_W_TYPE_SIZE); \
344 } \
345 \
346 (void) mpn_divrem (_z, 0, _x, 4, _y, 2); \
347 R##_f1 = _z[1]; \
348 R##_f0 = _z[0] | ((_x[0] | _x[1]) != 0); \
349 } while (0)
350
351
352/*
353 * Square root algorithms:
354 * We have just one right now, maybe Newton approximation
355 * should be added for those machines where division is fast.
356 */
357
358#define _FP_SQRT_MEAT_2(R, S, T, X, q) \
359 do { \
360 while (q) \
361 { \
362 T##_f1 = S##_f1 + q; \
363 if (T##_f1 <= X##_f1) \
364 { \
365 S##_f1 = T##_f1 + q; \
366 X##_f1 -= T##_f1; \
367 R##_f1 += q; \
368 } \
369 _FP_FRAC_SLL_2(X, 1); \
370 q >>= 1; \
371 } \
372 q = (_FP_W_TYPE)1 << (_FP_W_TYPE_SIZE - 1); \
373 while (q) \
374 { \
375 T##_f0 = S##_f0 + q; \
376 T##_f1 = S##_f1; \
377 if (T##_f1 < X##_f1 || \
378 (T##_f1 == X##_f1 && T##_f0 < X##_f0)) \
379 { \
380 S##_f0 = T##_f0 + q; \
381 if (((_FP_WS_TYPE)T##_f0) < 0 && \
382 ((_FP_WS_TYPE)S##_f0) >= 0) \
383 S##_f1++; \
384 _FP_FRAC_SUB_2(X, X, T); \
385 R##_f0 += q; \
386 } \
387 _FP_FRAC_SLL_2(X, 1); \
388 q >>= 1; \
389 } \
390 } while (0)
391
392
393/*
394 * Assembly/disassembly for converting to/from integral types.
395 * No shifting or overflow handled here.
396 */
397
398#define _FP_FRAC_ASSEMBLE_2(r, X, rsize) \
399 do { \
400 if (rsize <= _FP_W_TYPE_SIZE) \
401 r = X##_f0; \
402 else \
403 { \
404 r = X##_f1; \
405 r <<= _FP_W_TYPE_SIZE; \
406 r += X##_f0; \
407 } \
408 } while (0)
409
410#define _FP_FRAC_DISASSEMBLE_2(X, r, rsize) \
411 do { \
412 X##_f0 = r; \
413 X##_f1 = (rsize <= _FP_W_TYPE_SIZE ? 0 : r >> _FP_W_TYPE_SIZE); \
414 } while (0)
415
416/*
417 * Convert FP values between word sizes
418 */
419
420#define _FP_FRAC_CONV_1_2(dfs, sfs, D, S) \
421 do { \
422 _FP_FRAC_SRS_2(S, (_FP_WFRACBITS_##sfs - _FP_WFRACBITS_##dfs), \
423 _FP_WFRACBITS_##sfs); \
424 D##_f = S##_f0; \
425 } while (0)
426
427#define _FP_FRAC_CONV_2_1(dfs, sfs, D, S) \
428 do { \
429 D##_f0 = S##_f; \
430 D##_f1 = 0; \
431 _FP_FRAC_SLL_2(D, (_FP_WFRACBITS_##dfs - _FP_WFRACBITS_##sfs)); \
432 } while (0)
433
diff --git a/arch/ppc/math-emu/op-4.h b/arch/ppc/math-emu/op-4.h
new file mode 100644
index 000000000000..fcdd6d064c54
--- /dev/null
+++ b/arch/ppc/math-emu/op-4.h
@@ -0,0 +1,297 @@
1/*
2 * Basic four-word fraction declaration and manipulation.
3 *
4 * When adding quadword support for 32 bit machines, we need
5 * to be a little careful as double multiply uses some of these
6 * macros: (in op-2.h)
7 * _FP_MUL_MEAT_2_wide() uses _FP_FRAC_DECL_4, _FP_FRAC_WORD_4,
8 * _FP_FRAC_ADD_4, _FP_FRAC_SRS_4
9 * _FP_MUL_MEAT_2_gmp() uses _FP_FRAC_SRS_4 (and should use
10 * _FP_FRAC_DECL_4: it appears to be broken and is not used
11 * anywhere anyway. )
12 *
13 * I've now fixed all the macros that were here from the sparc64 code.
14 * [*none* of the shift macros were correct!] -- PMM 02/1998
15 *
16 * The only quadword stuff that remains to be coded is:
17 * 1) the conversion to/from ints, which requires
18 * that we check (in op-common.h) that the following do the right thing
19 * for quadwords: _FP_TO_INT(Q,4,r,X,rsz,rsg), _FP_FROM_INT(Q,4,X,r,rs,rt)
20 * 2) multiply, divide and sqrt, which require:
21 * _FP_MUL_MEAT_4_*(R,X,Y), _FP_DIV_MEAT_4_*(R,X,Y), _FP_SQRT_MEAT_4(R,S,T,X,q),
22 * This also needs _FP_MUL_MEAT_Q and _FP_DIV_MEAT_Q to be defined to
23 * some suitable _FP_MUL_MEAT_4_* macros in sfp-machine.h.
24 * [we're free to choose whatever FP_MUL_MEAT_4_* macros we need for
25 * these; they are used nowhere else. ]
26 */
27
28#define _FP_FRAC_DECL_4(X) _FP_W_TYPE X##_f[4]
29#define _FP_FRAC_COPY_4(D,S) \
30 (D##_f[0] = S##_f[0], D##_f[1] = S##_f[1], \
31 D##_f[2] = S##_f[2], D##_f[3] = S##_f[3])
32/* The _FP_FRAC_SET_n(X,I) macro is intended for use with another
33 * macro such as _FP_ZEROFRAC_n which returns n comma separated values.
34 * The result is that we get an expansion of __FP_FRAC_SET_n(X,I0,I1,I2,I3)
35 * which just assigns the In values to the array X##_f[].
36 * This is why the number of parameters doesn't appear to match
37 * at first glance... -- PMM
38 */
39#define _FP_FRAC_SET_4(X,I) __FP_FRAC_SET_4(X, I)
40#define _FP_FRAC_HIGH_4(X) (X##_f[3])
41#define _FP_FRAC_LOW_4(X) (X##_f[0])
42#define _FP_FRAC_WORD_4(X,w) (X##_f[w])
43
44#define _FP_FRAC_SLL_4(X,N) \
45 do { \
46 _FP_I_TYPE _up, _down, _skip, _i; \
47 _skip = (N) / _FP_W_TYPE_SIZE; \
48 _up = (N) % _FP_W_TYPE_SIZE; \
49 _down = _FP_W_TYPE_SIZE - _up; \
50 for (_i = 3; _i > _skip; --_i) \
51 X##_f[_i] = X##_f[_i-_skip] << _up | X##_f[_i-_skip-1] >> _down; \
52/* bugfixed: was X##_f[_i] <<= _up; -- PMM 02/1998 */ \
53 X##_f[_i] = X##_f[0] << _up; \
54 for (--_i; _i >= 0; --_i) \
55 X##_f[_i] = 0; \
56 } while (0)
57
58/* This one was broken too */
59#define _FP_FRAC_SRL_4(X,N) \
60 do { \
61 _FP_I_TYPE _up, _down, _skip, _i; \
62 _skip = (N) / _FP_W_TYPE_SIZE; \
63 _down = (N) % _FP_W_TYPE_SIZE; \
64 _up = _FP_W_TYPE_SIZE - _down; \
65 for (_i = 0; _i < 3-_skip; ++_i) \
66 X##_f[_i] = X##_f[_i+_skip] >> _down | X##_f[_i+_skip+1] << _up; \
67 X##_f[_i] = X##_f[3] >> _down; \
68 for (++_i; _i < 4; ++_i) \
69 X##_f[_i] = 0; \
70 } while (0)
71
72
73/* Right shift with sticky-lsb.
74 * What this actually means is that we do a standard right-shift,
75 * but that if any of the bits that fall off the right hand side
76 * were one then we always set the LSbit.
77 */
78#define _FP_FRAC_SRS_4(X,N,size) \
79 do { \
80 _FP_I_TYPE _up, _down, _skip, _i; \
81 _FP_W_TYPE _s; \
82 _skip = (N) / _FP_W_TYPE_SIZE; \
83 _down = (N) % _FP_W_TYPE_SIZE; \
84 _up = _FP_W_TYPE_SIZE - _down; \
85 for (_s = _i = 0; _i < _skip; ++_i) \
86 _s |= X##_f[_i]; \
87 _s |= X##_f[_i] << _up; \
88/* s is now != 0 if we want to set the LSbit */ \
89 for (_i = 0; _i < 3-_skip; ++_i) \
90 X##_f[_i] = X##_f[_i+_skip] >> _down | X##_f[_i+_skip+1] << _up; \
91 X##_f[_i] = X##_f[3] >> _down; \
92 for (++_i; _i < 4; ++_i) \
93 X##_f[_i] = 0; \
94 /* don't fix the LSB until the very end when we're sure f[0] is stable */ \
95 X##_f[0] |= (_s != 0); \
96 } while (0)
97
98#define _FP_FRAC_ADD_4(R,X,Y) \
99 __FP_FRAC_ADD_4(R##_f[3], R##_f[2], R##_f[1], R##_f[0], \
100 X##_f[3], X##_f[2], X##_f[1], X##_f[0], \
101 Y##_f[3], Y##_f[2], Y##_f[1], Y##_f[0])
102
103#define _FP_FRAC_SUB_4(R,X,Y) \
104 __FP_FRAC_SUB_4(R##_f[3], R##_f[2], R##_f[1], R##_f[0], \
105 X##_f[3], X##_f[2], X##_f[1], X##_f[0], \
106 Y##_f[3], Y##_f[2], Y##_f[1], Y##_f[0])
107
108#define _FP_FRAC_ADDI_4(X,I) \
109 __FP_FRAC_ADDI_4(X##_f[3], X##_f[2], X##_f[1], X##_f[0], I)
110
111#define _FP_ZEROFRAC_4 0,0,0,0
112#define _FP_MINFRAC_4 0,0,0,1
113
114#define _FP_FRAC_ZEROP_4(X) ((X##_f[0] | X##_f[1] | X##_f[2] | X##_f[3]) == 0)
115#define _FP_FRAC_NEGP_4(X) ((_FP_WS_TYPE)X##_f[3] < 0)
116#define _FP_FRAC_OVERP_4(fs,X) (X##_f[0] & _FP_OVERFLOW_##fs)
117
118#define _FP_FRAC_EQ_4(X,Y) \
119 (X##_f[0] == Y##_f[0] && X##_f[1] == Y##_f[1] \
120 && X##_f[2] == Y##_f[2] && X##_f[3] == Y##_f[3])
121
122#define _FP_FRAC_GT_4(X,Y) \
123 (X##_f[3] > Y##_f[3] || \
124 (X##_f[3] == Y##_f[3] && (X##_f[2] > Y##_f[2] || \
125 (X##_f[2] == Y##_f[2] && (X##_f[1] > Y##_f[1] || \
126 (X##_f[1] == Y##_f[1] && X##_f[0] > Y##_f[0]) \
127 )) \
128 )) \
129 )
130
131#define _FP_FRAC_GE_4(X,Y) \
132 (X##_f[3] > Y##_f[3] || \
133 (X##_f[3] == Y##_f[3] && (X##_f[2] > Y##_f[2] || \
134 (X##_f[2] == Y##_f[2] && (X##_f[1] > Y##_f[1] || \
135 (X##_f[1] == Y##_f[1] && X##_f[0] >= Y##_f[0]) \
136 )) \
137 )) \
138 )
139
140
141#define _FP_FRAC_CLZ_4(R,X) \
142 do { \
143 if (X##_f[3]) \
144 { \
145 __FP_CLZ(R,X##_f[3]); \
146 } \
147 else if (X##_f[2]) \
148 { \
149 __FP_CLZ(R,X##_f[2]); \
150 R += _FP_W_TYPE_SIZE; \
151 } \
152 else if (X##_f[1]) \
153 { \
154 __FP_CLZ(R,X##_f[2]); \
155 R += _FP_W_TYPE_SIZE*2; \
156 } \
157 else \
158 { \
159 __FP_CLZ(R,X##_f[0]); \
160 R += _FP_W_TYPE_SIZE*3; \
161 } \
162 } while(0)
163
164
165#define _FP_UNPACK_RAW_4(fs, X, val) \
166 do { \
167 union _FP_UNION_##fs _flo; _flo.flt = (val); \
168 X##_f[0] = _flo.bits.frac0; \
169 X##_f[1] = _flo.bits.frac1; \
170 X##_f[2] = _flo.bits.frac2; \
171 X##_f[3] = _flo.bits.frac3; \
172 X##_e = _flo.bits.exp; \
173 X##_s = _flo.bits.sign; \
174 } while (0)
175
176#define _FP_PACK_RAW_4(fs, val, X) \
177 do { \
178 union _FP_UNION_##fs _flo; \
179 _flo.bits.frac0 = X##_f[0]; \
180 _flo.bits.frac1 = X##_f[1]; \
181 _flo.bits.frac2 = X##_f[2]; \
182 _flo.bits.frac3 = X##_f[3]; \
183 _flo.bits.exp = X##_e; \
184 _flo.bits.sign = X##_s; \
185 (val) = _flo.flt; \
186 } while (0)
187
188
189/*
190 * Internals
191 */
192
193#define __FP_FRAC_SET_4(X,I3,I2,I1,I0) \
194 (X##_f[3] = I3, X##_f[2] = I2, X##_f[1] = I1, X##_f[0] = I0)
195
196#ifndef __FP_FRAC_ADD_4
197#define __FP_FRAC_ADD_4(r3,r2,r1,r0,x3,x2,x1,x0,y3,y2,y1,y0) \
198 (r0 = x0 + y0, \
199 r1 = x1 + y1 + (r0 < x0), \
200 r2 = x2 + y2 + (r1 < x1), \
201 r3 = x3 + y3 + (r2 < x2))
202#endif
203
204#ifndef __FP_FRAC_SUB_4
205#define __FP_FRAC_SUB_4(r3,r2,r1,r0,x3,x2,x1,x0,y3,y2,y1,y0) \
206 (r0 = x0 - y0, \
207 r1 = x1 - y1 - (r0 > x0), \
208 r2 = x2 - y2 - (r1 > x1), \
209 r3 = x3 - y3 - (r2 > x2))
210#endif
211
212#ifndef __FP_FRAC_ADDI_4
213/* I always wanted to be a lisp programmer :-> */
214#define __FP_FRAC_ADDI_4(x3,x2,x1,x0,i) \
215 (x3 += ((x2 += ((x1 += ((x0 += i) < x0)) < x1) < x2)))
216#endif
217
218/* Convert FP values between word sizes. This appears to be more
219 * complicated than I'd have expected it to be, so these might be
220 * wrong... These macros are in any case somewhat bogus because they
221 * use information about what various FRAC_n variables look like
222 * internally [eg, that 2 word vars are X_f0 and x_f1]. But so do
223 * the ones in op-2.h and op-1.h.
224 */
225#define _FP_FRAC_CONV_1_4(dfs, sfs, D, S) \
226 do { \
227 _FP_FRAC_SRS_4(S, (_FP_WFRACBITS_##sfs - _FP_WFRACBITS_##dfs), \
228 _FP_WFRACBITS_##sfs); \
229 D##_f = S##_f[0]; \
230 } while (0)
231
232#define _FP_FRAC_CONV_2_4(dfs, sfs, D, S) \
233 do { \
234 _FP_FRAC_SRS_4(S, (_FP_WFRACBITS_##sfs - _FP_WFRACBITS_##dfs), \
235 _FP_WFRACBITS_##sfs); \
236 D##_f0 = S##_f[0]; \
237 D##_f1 = S##_f[1]; \
238 } while (0)
239
240/* Assembly/disassembly for converting to/from integral types.
241 * No shifting or overflow handled here.
242 */
243/* Put the FP value X into r, which is an integer of size rsize. */
244#define _FP_FRAC_ASSEMBLE_4(r, X, rsize) \
245 do { \
246 if (rsize <= _FP_W_TYPE_SIZE) \
247 r = X##_f[0]; \
248 else if (rsize <= 2*_FP_W_TYPE_SIZE) \
249 { \
250 r = X##_f[1]; \
251 r <<= _FP_W_TYPE_SIZE; \
252 r += X##_f[0]; \
253 } \
254 else \
255 { \
256 /* I'm feeling lazy so we deal with int == 3words (implausible)*/ \
257 /* and int == 4words as a single case. */ \
258 r = X##_f[3]; \
259 r <<= _FP_W_TYPE_SIZE; \
260 r += X##_f[2]; \
261 r <<= _FP_W_TYPE_SIZE; \
262 r += X##_f[1]; \
263 r <<= _FP_W_TYPE_SIZE; \
264 r += X##_f[0]; \
265 } \
266 } while (0)
267
268/* "No disassemble Number Five!" */
269/* move an integer of size rsize into X's fractional part. We rely on
270 * the _f[] array consisting of words of size _FP_W_TYPE_SIZE to avoid
271 * having to mask the values we store into it.
272 */
273#define _FP_FRAC_DISASSEMBLE_4(X, r, rsize) \
274 do { \
275 X##_f[0] = r; \
276 X##_f[1] = (rsize <= _FP_W_TYPE_SIZE ? 0 : r >> _FP_W_TYPE_SIZE); \
277 X##_f[2] = (rsize <= 2*_FP_W_TYPE_SIZE ? 0 : r >> 2*_FP_W_TYPE_SIZE); \
278 X##_f[3] = (rsize <= 3*_FP_W_TYPE_SIZE ? 0 : r >> 3*_FP_W_TYPE_SIZE); \
279 } while (0)
280
281#define _FP_FRAC_CONV_4_1(dfs, sfs, D, S) \
282 do { \
283 D##_f[0] = S##_f; \
284 D##_f[1] = D##_f[2] = D##_f[3] = 0; \
285 _FP_FRAC_SLL_4(D, (_FP_WFRACBITS_##dfs - _FP_WFRACBITS_##sfs)); \
286 } while (0)
287
288#define _FP_FRAC_CONV_4_2(dfs, sfs, D, S) \
289 do { \
290 D##_f[0] = S##_f0; \
291 D##_f[1] = S##_f1; \
292 D##_f[2] = D##_f[3] = 0; \
293 _FP_FRAC_SLL_4(D, (_FP_WFRACBITS_##dfs - _FP_WFRACBITS_##sfs)); \
294 } while (0)
295
296/* FIXME! This has to be written */
297#define _FP_SQRT_MEAT_4(R, S, T, X, q)
diff --git a/arch/ppc/math-emu/op-common.h b/arch/ppc/math-emu/op-common.h
new file mode 100644
index 000000000000..afb82b6498ce
--- /dev/null
+++ b/arch/ppc/math-emu/op-common.h
@@ -0,0 +1,688 @@
1#define _FP_DECL(wc, X) \
2 _FP_I_TYPE X##_c, X##_s, X##_e; \
3 _FP_FRAC_DECL_##wc(X)
4
5/*
6 * Finish truely unpacking a native fp value by classifying the kind
7 * of fp value and normalizing both the exponent and the fraction.
8 */
9
10#define _FP_UNPACK_CANONICAL(fs, wc, X) \
11do { \
12 switch (X##_e) \
13 { \
14 default: \
15 _FP_FRAC_HIGH_##wc(X) |= _FP_IMPLBIT_##fs; \
16 _FP_FRAC_SLL_##wc(X, _FP_WORKBITS); \
17 X##_e -= _FP_EXPBIAS_##fs; \
18 X##_c = FP_CLS_NORMAL; \
19 break; \
20 \
21 case 0: \
22 if (_FP_FRAC_ZEROP_##wc(X)) \
23 X##_c = FP_CLS_ZERO; \
24 else \
25 { \
26 /* a denormalized number */ \
27 _FP_I_TYPE _shift; \
28 _FP_FRAC_CLZ_##wc(_shift, X); \
29 _shift -= _FP_FRACXBITS_##fs; \
30 _FP_FRAC_SLL_##wc(X, (_shift+_FP_WORKBITS)); \
31 X##_e -= _FP_EXPBIAS_##fs - 1 + _shift; \
32 X##_c = FP_CLS_NORMAL; \
33 } \
34 break; \
35 \
36 case _FP_EXPMAX_##fs: \
37 if (_FP_FRAC_ZEROP_##wc(X)) \
38 X##_c = FP_CLS_INF; \
39 else \
40 /* we don't differentiate between signaling and quiet nans */ \
41 X##_c = FP_CLS_NAN; \
42 break; \
43 } \
44} while (0)
45
46
47/*
48 * Before packing the bits back into the native fp result, take care
49 * of such mundane things as rounding and overflow. Also, for some
50 * kinds of fp values, the original parts may not have been fully
51 * extracted -- but that is ok, we can regenerate them now.
52 */
53
54#define _FP_PACK_CANONICAL(fs, wc, X) \
55({int __ret = 0; \
56 switch (X##_c) \
57 { \
58 case FP_CLS_NORMAL: \
59 X##_e += _FP_EXPBIAS_##fs; \
60 if (X##_e > 0) \
61 { \
62 __ret |= _FP_ROUND(wc, X); \
63 if (_FP_FRAC_OVERP_##wc(fs, X)) \
64 { \
65 _FP_FRAC_SRL_##wc(X, (_FP_WORKBITS+1)); \
66 X##_e++; \
67 } \
68 else \
69 _FP_FRAC_SRL_##wc(X, _FP_WORKBITS); \
70 if (X##_e >= _FP_EXPMAX_##fs) \
71 { \
72 /* overflow to infinity */ \
73 X##_e = _FP_EXPMAX_##fs; \
74 _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \
75 __ret |= EFLAG_OVERFLOW; \
76 } \
77 } \
78 else \
79 { \
80 /* we've got a denormalized number */ \
81 X##_e = -X##_e + 1; \
82 if (X##_e <= _FP_WFRACBITS_##fs) \
83 { \
84 _FP_FRAC_SRS_##wc(X, X##_e, _FP_WFRACBITS_##fs); \
85 _FP_FRAC_SLL_##wc(X, 1); \
86 if (_FP_FRAC_OVERP_##wc(fs, X)) \
87 { \
88 X##_e = 1; \
89 _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \
90 } \
91 else \
92 { \
93 X##_e = 0; \
94 _FP_FRAC_SRL_##wc(X, _FP_WORKBITS+1); \
95 __ret |= EFLAG_UNDERFLOW; \
96 } \
97 } \
98 else \
99 { \
100 /* underflow to zero */ \
101 X##_e = 0; \
102 _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \
103 __ret |= EFLAG_UNDERFLOW; \
104 } \
105 } \
106 break; \
107 \
108 case FP_CLS_ZERO: \
109 X##_e = 0; \
110 _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \
111 break; \
112 \
113 case FP_CLS_INF: \
114 X##_e = _FP_EXPMAX_##fs; \
115 _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \
116 break; \
117 \
118 case FP_CLS_NAN: \
119 X##_e = _FP_EXPMAX_##fs; \
120 if (!_FP_KEEPNANFRACP) \
121 { \
122 _FP_FRAC_SET_##wc(X, _FP_NANFRAC_##fs); \
123 X##_s = 0; \
124 } \
125 else \
126 _FP_FRAC_HIGH_##wc(X) |= _FP_QNANBIT_##fs; \
127 break; \
128 } \
129 __ret; \
130})
131
132
133/*
134 * Main addition routine. The input values should be cooked.
135 */
136
137#define _FP_ADD(fs, wc, R, X, Y) \
138do { \
139 switch (_FP_CLS_COMBINE(X##_c, Y##_c)) \
140 { \
141 case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_NORMAL): \
142 { \
143 /* shift the smaller number so that its exponent matches the larger */ \
144 _FP_I_TYPE diff = X##_e - Y##_e; \
145 \
146 if (diff < 0) \
147 { \
148 diff = -diff; \
149 if (diff <= _FP_WFRACBITS_##fs) \
150 _FP_FRAC_SRS_##wc(X, diff, _FP_WFRACBITS_##fs); \
151 else if (!_FP_FRAC_ZEROP_##wc(X)) \
152 _FP_FRAC_SET_##wc(X, _FP_MINFRAC_##wc); \
153 else \
154 _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \
155 R##_e = Y##_e; \
156 } \
157 else \
158 { \
159 if (diff > 0) \
160 { \
161 if (diff <= _FP_WFRACBITS_##fs) \
162 _FP_FRAC_SRS_##wc(Y, diff, _FP_WFRACBITS_##fs); \
163 else if (!_FP_FRAC_ZEROP_##wc(Y)) \
164 _FP_FRAC_SET_##wc(Y, _FP_MINFRAC_##wc); \
165 else \
166 _FP_FRAC_SET_##wc(Y, _FP_ZEROFRAC_##wc); \
167 } \
168 R##_e = X##_e; \
169 } \
170 \
171 R##_c = FP_CLS_NORMAL; \
172 \
173 if (X##_s == Y##_s) \
174 { \
175 R##_s = X##_s; \
176 _FP_FRAC_ADD_##wc(R, X, Y); \
177 if (_FP_FRAC_OVERP_##wc(fs, R)) \
178 { \
179 _FP_FRAC_SRS_##wc(R, 1, _FP_WFRACBITS_##fs); \
180 R##_e++; \
181 } \
182 } \
183 else \
184 { \
185 R##_s = X##_s; \
186 _FP_FRAC_SUB_##wc(R, X, Y); \
187 if (_FP_FRAC_ZEROP_##wc(R)) \
188 { \
189 /* return an exact zero */ \
190 if (FP_ROUNDMODE == FP_RND_MINF) \
191 R##_s |= Y##_s; \
192 else \
193 R##_s &= Y##_s; \
194 R##_c = FP_CLS_ZERO; \
195 } \
196 else \
197 { \
198 if (_FP_FRAC_NEGP_##wc(R)) \
199 { \
200 _FP_FRAC_SUB_##wc(R, Y, X); \
201 R##_s = Y##_s; \
202 } \
203 \
204 /* renormalize after subtraction */ \
205 _FP_FRAC_CLZ_##wc(diff, R); \
206 diff -= _FP_WFRACXBITS_##fs; \
207 if (diff) \
208 { \
209 R##_e -= diff; \
210 _FP_FRAC_SLL_##wc(R, diff); \
211 } \
212 } \
213 } \
214 break; \
215 } \
216 \
217 case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_NAN): \
218 _FP_CHOOSENAN(fs, wc, R, X, Y); \
219 break; \
220 \
221 case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_ZERO): \
222 R##_e = X##_e; \
223 case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_NORMAL): \
224 case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_INF): \
225 case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_ZERO): \
226 _FP_FRAC_COPY_##wc(R, X); \
227 R##_s = X##_s; \
228 R##_c = X##_c; \
229 break; \
230 \
231 case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_NORMAL): \
232 R##_e = Y##_e; \
233 case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_NAN): \
234 case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NAN): \
235 case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_NAN): \
236 _FP_FRAC_COPY_##wc(R, Y); \
237 R##_s = Y##_s; \
238 R##_c = Y##_c; \
239 break; \
240 \
241 case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_INF): \
242 if (X##_s != Y##_s) \
243 { \
244 /* +INF + -INF => NAN */ \
245 _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs); \
246 R##_s = X##_s ^ Y##_s; \
247 R##_c = FP_CLS_NAN; \
248 break; \
249 } \
250 /* FALLTHRU */ \
251 \
252 case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NORMAL): \
253 case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_ZERO): \
254 R##_s = X##_s; \
255 R##_c = FP_CLS_INF; \
256 break; \
257 \
258 case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_INF): \
259 case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_INF): \
260 R##_s = Y##_s; \
261 R##_c = FP_CLS_INF; \
262 break; \
263 \
264 case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_ZERO): \
265 /* make sure the sign is correct */ \
266 if (FP_ROUNDMODE == FP_RND_MINF) \
267 R##_s = X##_s | Y##_s; \
268 else \
269 R##_s = X##_s & Y##_s; \
270 R##_c = FP_CLS_ZERO; \
271 break; \
272 \
273 default: \
274 abort(); \
275 } \
276} while (0)
277
278
279/*
280 * Main negation routine. FIXME -- when we care about setting exception
281 * bits reliably, this will not do. We should examine all of the fp classes.
282 */
283
284#define _FP_NEG(fs, wc, R, X) \
285 do { \
286 _FP_FRAC_COPY_##wc(R, X); \
287 R##_c = X##_c; \
288 R##_e = X##_e; \
289 R##_s = 1 ^ X##_s; \
290 } while (0)
291
292
293/*
294 * Main multiplication routine. The input values should be cooked.
295 */
296
297#define _FP_MUL(fs, wc, R, X, Y) \
298do { \
299 R##_s = X##_s ^ Y##_s; \
300 switch (_FP_CLS_COMBINE(X##_c, Y##_c)) \
301 { \
302 case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_NORMAL): \
303 R##_c = FP_CLS_NORMAL; \
304 R##_e = X##_e + Y##_e + 1; \
305 \
306 _FP_MUL_MEAT_##fs(R,X,Y); \
307 \
308 if (_FP_FRAC_OVERP_##wc(fs, R)) \
309 _FP_FRAC_SRS_##wc(R, 1, _FP_WFRACBITS_##fs); \
310 else \
311 R##_e--; \
312 break; \
313 \
314 case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_NAN): \
315 _FP_CHOOSENAN(fs, wc, R, X, Y); \
316 break; \
317 \
318 case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_NORMAL): \
319 case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_INF): \
320 case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_ZERO): \
321 R##_s = X##_s; \
322 \
323 case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_INF): \
324 case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NORMAL): \
325 case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_NORMAL): \
326 case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_ZERO): \
327 _FP_FRAC_COPY_##wc(R, X); \
328 R##_c = X##_c; \
329 break; \
330 \
331 case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_NAN): \
332 case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NAN): \
333 case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_NAN): \
334 R##_s = Y##_s; \
335 \
336 case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_INF): \
337 case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_ZERO): \
338 _FP_FRAC_COPY_##wc(R, Y); \
339 R##_c = Y##_c; \
340 break; \
341 \
342 case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_ZERO): \
343 case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_INF): \
344 R##_c = FP_CLS_NAN; \
345 _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs); \
346 break; \
347 \
348 default: \
349 abort(); \
350 } \
351} while (0)
352
353
354/*
355 * Main division routine. The input values should be cooked.
356 */
357
358#define _FP_DIV(fs, wc, R, X, Y) \
359do { \
360 R##_s = X##_s ^ Y##_s; \
361 switch (_FP_CLS_COMBINE(X##_c, Y##_c)) \
362 { \
363 case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_NORMAL): \
364 R##_c = FP_CLS_NORMAL; \
365 R##_e = X##_e - Y##_e; \
366 \
367 _FP_DIV_MEAT_##fs(R,X,Y); \
368 break; \
369 \
370 case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_NAN): \
371 _FP_CHOOSENAN(fs, wc, R, X, Y); \
372 break; \
373 \
374 case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_NORMAL): \
375 case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_INF): \
376 case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_ZERO): \
377 R##_s = X##_s; \
378 _FP_FRAC_COPY_##wc(R, X); \
379 R##_c = X##_c; \
380 break; \
381 \
382 case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_NAN): \
383 case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NAN): \
384 case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_NAN): \
385 R##_s = Y##_s; \
386 _FP_FRAC_COPY_##wc(R, Y); \
387 R##_c = Y##_c; \
388 break; \
389 \
390 case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_INF): \
391 case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_INF): \
392 case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_NORMAL): \
393 R##_c = FP_CLS_ZERO; \
394 break; \
395 \
396 case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_ZERO): \
397 case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_ZERO): \
398 case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NORMAL): \
399 R##_c = FP_CLS_INF; \
400 break; \
401 \
402 case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_INF): \
403 case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_ZERO): \
404 R##_c = FP_CLS_NAN; \
405 _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs); \
406 break; \
407 \
408 default: \
409 abort(); \
410 } \
411} while (0)
412
413
414/*
415 * Main differential comparison routine. The inputs should be raw not
416 * cooked. The return is -1,0,1 for normal values, 2 otherwise.
417 */
418
419#define _FP_CMP(fs, wc, ret, X, Y, un) \
420 do { \
421 /* NANs are unordered */ \
422 if ((X##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc(X)) \
423 || (Y##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc(Y))) \
424 { \
425 ret = un; \
426 } \
427 else \
428 { \
429 int __x_zero = (!X##_e && _FP_FRAC_ZEROP_##wc(X)) ? 1 : 0; \
430 int __y_zero = (!Y##_e && _FP_FRAC_ZEROP_##wc(Y)) ? 1 : 0; \
431 \
432 if (__x_zero && __y_zero) \
433 ret = 0; \
434 else if (__x_zero) \
435 ret = Y##_s ? 1 : -1; \
436 else if (__y_zero) \
437 ret = X##_s ? -1 : 1; \
438 else if (X##_s != Y##_s) \
439 ret = X##_s ? -1 : 1; \
440 else if (X##_e > Y##_e) \
441 ret = X##_s ? -1 : 1; \
442 else if (X##_e < Y##_e) \
443 ret = X##_s ? 1 : -1; \
444 else if (_FP_FRAC_GT_##wc(X, Y)) \
445 ret = X##_s ? -1 : 1; \
446 else if (_FP_FRAC_GT_##wc(Y, X)) \
447 ret = X##_s ? 1 : -1; \
448 else \
449 ret = 0; \
450 } \
451 } while (0)
452
453
454/* Simplification for strict equality. */
455
456#define _FP_CMP_EQ(fs, wc, ret, X, Y) \
457 do { \
458 /* NANs are unordered */ \
459 if ((X##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc(X)) \
460 || (Y##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc(Y))) \
461 { \
462 ret = 1; \
463 } \
464 else \
465 { \
466 ret = !(X##_e == Y##_e \
467 && _FP_FRAC_EQ_##wc(X, Y) \
468 && (X##_s == Y##_s || !X##_e && _FP_FRAC_ZEROP_##wc(X))); \
469 } \
470 } while (0)
471
472/*
473 * Main square root routine. The input value should be cooked.
474 */
475
476#define _FP_SQRT(fs, wc, R, X) \
477do { \
478 _FP_FRAC_DECL_##wc(T); _FP_FRAC_DECL_##wc(S); \
479 _FP_W_TYPE q; \
480 switch (X##_c) \
481 { \
482 case FP_CLS_NAN: \
483 R##_s = 0; \
484 R##_c = FP_CLS_NAN; \
485 _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \
486 break; \
487 case FP_CLS_INF: \
488 if (X##_s) \
489 { \
490 R##_s = 0; \
491 R##_c = FP_CLS_NAN; /* sNAN */ \
492 } \
493 else \
494 { \
495 R##_s = 0; \
496 R##_c = FP_CLS_INF; /* sqrt(+inf) = +inf */ \
497 } \
498 break; \
499 case FP_CLS_ZERO: \
500 R##_s = X##_s; \
501 R##_c = FP_CLS_ZERO; /* sqrt(+-0) = +-0 */ \
502 break; \
503 case FP_CLS_NORMAL: \
504 R##_s = 0; \
505 if (X##_s) \
506 { \
507 R##_c = FP_CLS_NAN; /* sNAN */ \
508 break; \
509 } \
510 R##_c = FP_CLS_NORMAL; \
511 if (X##_e & 1) \
512 _FP_FRAC_SLL_##wc(X, 1); \
513 R##_e = X##_e >> 1; \
514 _FP_FRAC_SET_##wc(S, _FP_ZEROFRAC_##wc); \
515 _FP_FRAC_SET_##wc(R, _FP_ZEROFRAC_##wc); \
516 q = _FP_OVERFLOW_##fs; \
517 _FP_FRAC_SLL_##wc(X, 1); \
518 _FP_SQRT_MEAT_##wc(R, S, T, X, q); \
519 _FP_FRAC_SRL_##wc(R, 1); \
520 } \
521 } while (0)
522
523/*
524 * Convert from FP to integer
525 */
526
527/* "When a NaN, infinity, large positive argument >= 2147483648.0, or
528 * large negative argument <= -2147483649.0 is converted to an integer,
529 * the invalid_current bit...should be set and fp_exception_IEEE_754 should
530 * be raised. If the floating point invalid trap is disabled, no trap occurs
531 * and a numerical result is generated: if the sign bit of the operand
532 * is 0, the result is 2147483647; if the sign bit of the operand is 1,
533 * the result is -2147483648."
534 * Similarly for conversion to extended ints, except that the boundaries
535 * are >= 2^63, <= -(2^63 + 1), and the results are 2^63 + 1 for s=0 and
536 * -2^63 for s=1.
537 * -- SPARC Architecture Manual V9, Appendix B, which specifies how
538 * SPARCs resolve implementation dependencies in the IEEE-754 spec.
539 * I don't believe that the code below follows this. I'm not even sure
540 * it's right!
541 * It doesn't cope with needing to convert to an n bit integer when there
542 * is no n bit integer type. Fortunately gcc provides long long so this
543 * isn't a problem for sparc32.
544 * I have, however, fixed its NaN handling to conform as above.
545 * -- PMM 02/1998
546 * NB: rsigned is not 'is r declared signed?' but 'should the value stored
547 * in r be signed or unsigned?'. r is always(?) declared unsigned.
548 * Comments below are mine, BTW -- PMM
549 */
550#define _FP_TO_INT(fs, wc, r, X, rsize, rsigned) \
551 do { \
552 switch (X##_c) \
553 { \
554 case FP_CLS_NORMAL: \
555 if (X##_e < 0) \
556 { \
557 /* case FP_CLS_NAN: see above! */ \
558 case FP_CLS_ZERO: \
559 r = 0; \
560 } \
561 else if (X##_e >= rsize - (rsigned != 0)) \
562 { /* overflow */ \
563 case FP_CLS_NAN: \
564 case FP_CLS_INF: \
565 if (rsigned) \
566 { \
567 r = 1; \
568 r <<= rsize - 1; \
569 r -= 1 - X##_s; \
570 } \
571 else \
572 { \
573 r = 0; \
574 if (!X##_s) \
575 r = ~r; \
576 } \
577 } \
578 else \
579 { \
580 if (_FP_W_TYPE_SIZE*wc < rsize) \
581 { \
582 _FP_FRAC_ASSEMBLE_##wc(r, X, rsize); \
583 r <<= X##_e - _FP_WFRACBITS_##fs; \
584 } \
585 else \
586 { \
587 if (X##_e >= _FP_WFRACBITS_##fs) \
588 _FP_FRAC_SLL_##wc(X, (X##_e - _FP_WFRACBITS_##fs + 1));\
589 else \
590 _FP_FRAC_SRL_##wc(X, (_FP_WFRACBITS_##fs - X##_e - 1));\
591 _FP_FRAC_ASSEMBLE_##wc(r, X, rsize); \
592 } \
593 if (rsigned && X##_s) \
594 r = -r; \
595 } \
596 break; \
597 } \
598 } while (0)
599
600#define _FP_FROM_INT(fs, wc, X, r, rsize, rtype) \
601 do { \
602 if (r) \
603 { \
604 X##_c = FP_CLS_NORMAL; \
605 \
606 if ((X##_s = (r < 0))) \
607 r = -r; \
608 /* Note that `r' is now considered unsigned, so we don't have \
609 to worry about the single signed overflow case. */ \
610 \
611 if (rsize <= _FP_W_TYPE_SIZE) \
612 __FP_CLZ(X##_e, r); \
613 else \
614 __FP_CLZ_2(X##_e, (_FP_W_TYPE)(r >> _FP_W_TYPE_SIZE), \
615 (_FP_W_TYPE)r); \
616 if (rsize < _FP_W_TYPE_SIZE) \
617 X##_e -= (_FP_W_TYPE_SIZE - rsize); \
618 X##_e = rsize - X##_e - 1; \
619 \
620 if (_FP_FRACBITS_##fs < rsize && _FP_WFRACBITS_##fs < X##_e) \
621 __FP_FRAC_SRS_1(r, (X##_e - _FP_WFRACBITS_##fs), rsize); \
622 r &= ~((_FP_W_TYPE)1 << X##_e); \
623 _FP_FRAC_DISASSEMBLE_##wc(X, ((unsigned rtype)r), rsize); \
624 _FP_FRAC_SLL_##wc(X, (_FP_WFRACBITS_##fs - X##_e - 1)); \
625 } \
626 else \
627 { \
628 X##_c = FP_CLS_ZERO, X##_s = 0; \
629 } \
630 } while (0)
631
632
633#define FP_CONV(dfs,sfs,dwc,swc,D,S) \
634 do { \
635 _FP_FRAC_CONV_##dwc##_##swc(dfs, sfs, D, S); \
636 D##_e = S##_e; \
637 D##_c = S##_c; \
638 D##_s = S##_s; \
639 } while (0)
640
641/*
642 * Helper primitives.
643 */
644
645/* Count leading zeros in a word. */
646
647#ifndef __FP_CLZ
648#if _FP_W_TYPE_SIZE < 64
649/* this is just to shut the compiler up about shifts > word length -- PMM 02/1998 */
650#define __FP_CLZ(r, x) \
651 do { \
652 _FP_W_TYPE _t = (x); \
653 r = _FP_W_TYPE_SIZE - 1; \
654 if (_t > 0xffff) r -= 16; \
655 if (_t > 0xffff) _t >>= 16; \
656 if (_t > 0xff) r -= 8; \
657 if (_t > 0xff) _t >>= 8; \
658 if (_t & 0xf0) r -= 4; \
659 if (_t & 0xf0) _t >>= 4; \
660 if (_t & 0xc) r -= 2; \
661 if (_t & 0xc) _t >>= 2; \
662 if (_t & 0x2) r -= 1; \
663 } while (0)
664#else /* not _FP_W_TYPE_SIZE < 64 */
665#define __FP_CLZ(r, x) \
666 do { \
667 _FP_W_TYPE _t = (x); \
668 r = _FP_W_TYPE_SIZE - 1; \
669 if (_t > 0xffffffff) r -= 32; \
670 if (_t > 0xffffffff) _t >>= 32; \
671 if (_t > 0xffff) r -= 16; \
672 if (_t > 0xffff) _t >>= 16; \
673 if (_t > 0xff) r -= 8; \
674 if (_t > 0xff) _t >>= 8; \
675 if (_t & 0xf0) r -= 4; \
676 if (_t & 0xf0) _t >>= 4; \
677 if (_t & 0xc) r -= 2; \
678 if (_t & 0xc) _t >>= 2; \
679 if (_t & 0x2) r -= 1; \
680 } while (0)
681#endif /* not _FP_W_TYPE_SIZE < 64 */
682#endif /* ndef __FP_CLZ */
683
684#define _FP_DIV_HELP_imm(q, r, n, d) \
685 do { \
686 q = n / d, r = n % d; \
687 } while (0)
688
diff --git a/arch/ppc/math-emu/sfp-machine.h b/arch/ppc/math-emu/sfp-machine.h
new file mode 100644
index 000000000000..686e06d29186
--- /dev/null
+++ b/arch/ppc/math-emu/sfp-machine.h
@@ -0,0 +1,377 @@
1/* Machine-dependent software floating-point definitions. PPC version.
2 Copyright (C) 1997 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If
17 not, write to the Free Software Foundation, Inc.,
18 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
20 Actually, this is a PPC (32bit) version, written based on the
21 i386, sparc, and sparc64 versions, by me,
22 Peter Maydell (pmaydell@chiark.greenend.org.uk).
23 Comments are by and large also mine, although they may be inaccurate.
24
25 In picking out asm fragments I've gone with the lowest common
26 denominator, which also happens to be the hardware I have :->
27 That is, a SPARC without hardware multiply and divide.
28 */
29
30/* basic word size definitions */
31#define _FP_W_TYPE_SIZE 32
32#define _FP_W_TYPE unsigned long
33#define _FP_WS_TYPE signed long
34#define _FP_I_TYPE long
35
36#define __ll_B ((UWtype) 1 << (W_TYPE_SIZE / 2))
37#define __ll_lowpart(t) ((UWtype) (t) & (__ll_B - 1))
38#define __ll_highpart(t) ((UWtype) (t) >> (W_TYPE_SIZE / 2))
39
40/* You can optionally code some things like addition in asm. For
41 * example, i386 defines __FP_FRAC_ADD_2 as asm. If you don't
42 * then you get a fragment of C code [if you change an #ifdef 0
43 * in op-2.h] or a call to add_ssaaaa (see below).
44 * Good places to look for asm fragments to use are gcc and glibc.
45 * gcc's longlong.h is useful.
46 */
47
48/* We need to know how to multiply and divide. If the host word size
49 * is >= 2*fracbits you can use FP_MUL_MEAT_n_imm(t,R,X,Y) which
50 * codes the multiply with whatever gcc does to 'a * b'.
51 * _FP_MUL_MEAT_n_wide(t,R,X,Y,f) is used when you have an asm
52 * function that can multiply two 1W values and get a 2W result.
53 * Otherwise you're stuck with _FP_MUL_MEAT_n_hard(t,R,X,Y) which
54 * does bitshifting to avoid overflow.
55 * For division there is FP_DIV_MEAT_n_imm(t,R,X,Y,f) for word size
56 * >= 2*fracbits, where f is either _FP_DIV_HELP_imm or
57 * _FP_DIV_HELP_ldiv (see op-1.h).
58 * _FP_DIV_MEAT_udiv() is if you have asm to do 2W/1W => (1W, 1W).
59 * [GCC and glibc have longlong.h which has the asm macro udiv_qrnnd
60 * to do this.]
61 * In general, 'n' is the number of words required to hold the type,
62 * and 't' is either S, D or Q for single/double/quad.
63 * -- PMM
64 */
65/* Example: SPARC64:
66 * #define _FP_MUL_MEAT_S(R,X,Y) _FP_MUL_MEAT_1_imm(S,R,X,Y)
67 * #define _FP_MUL_MEAT_D(R,X,Y) _FP_MUL_MEAT_1_wide(D,R,X,Y,umul_ppmm)
68 * #define _FP_MUL_MEAT_Q(R,X,Y) _FP_MUL_MEAT_2_wide(Q,R,X,Y,umul_ppmm)
69 *
70 * #define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_imm(S,R,X,Y,_FP_DIV_HELP_imm)
71 * #define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_1_udiv(D,R,X,Y)
72 * #define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_2_udiv_64(Q,R,X,Y)
73 *
74 * Example: i386:
75 * #define _FP_MUL_MEAT_S(R,X,Y) _FP_MUL_MEAT_1_wide(S,R,X,Y,_i386_mul_32_64)
76 * #define _FP_MUL_MEAT_D(R,X,Y) _FP_MUL_MEAT_2_wide(D,R,X,Y,_i386_mul_32_64)
77 *
78 * #define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_udiv(S,R,X,Y,_i386_div_64_32)
79 * #define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv_64(D,R,X,Y)
80 */
81
82#define _FP_MUL_MEAT_S(R,X,Y) _FP_MUL_MEAT_1_wide(S,R,X,Y,umul_ppmm)
83#define _FP_MUL_MEAT_D(R,X,Y) _FP_MUL_MEAT_2_wide(D,R,X,Y,umul_ppmm)
84
85#define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_udiv(S,R,X,Y)
86#define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv_64(D,R,X,Y)
87
88/* These macros define what NaN looks like. They're supposed to expand to
89 * a comma-separated set of 32bit unsigned ints that encode NaN.
90 */
91#define _FP_NANFRAC_S _FP_QNANBIT_S
92#define _FP_NANFRAC_D _FP_QNANBIT_D, 0
93#define _FP_NANFRAC_Q _FP_QNANBIT_Q, 0, 0, 0
94
95#define _FP_KEEPNANFRACP 1
96
97/* This macro appears to be called when both X and Y are NaNs, and
98 * has to choose one and copy it to R. i386 goes for the larger of the
99 * two, sparc64 just picks Y. I don't understand this at all so I'll
100 * go with sparc64 because it's shorter :-> -- PMM
101 */
102#define _FP_CHOOSENAN(fs, wc, R, X, Y) \
103 do { \
104 R##_s = Y##_s; \
105 _FP_FRAC_COPY_##wc(R,Y); \
106 R##_c = FP_CLS_NAN; \
107 } while (0)
108
109
110extern void fp_unpack_d(long *, unsigned long *, unsigned long *,
111 long *, long *, void *);
112extern int fp_pack_d(void *, long, unsigned long, unsigned long, long, long);
113extern int fp_pack_ds(void *, long, unsigned long, unsigned long, long, long);
114
115#define __FP_UNPACK_RAW_1(fs, X, val) \
116 do { \
117 union _FP_UNION_##fs *_flo = \
118 (union _FP_UNION_##fs *)val; \
119 \
120 X##_f = _flo->bits.frac; \
121 X##_e = _flo->bits.exp; \
122 X##_s = _flo->bits.sign; \
123 } while (0)
124
125#define __FP_UNPACK_RAW_2(fs, X, val) \
126 do { \
127 union _FP_UNION_##fs *_flo = \
128 (union _FP_UNION_##fs *)val; \
129 \
130 X##_f0 = _flo->bits.frac0; \
131 X##_f1 = _flo->bits.frac1; \
132 X##_e = _flo->bits.exp; \
133 X##_s = _flo->bits.sign; \
134 } while (0)
135
136#define __FP_UNPACK_S(X,val) \
137 do { \
138 __FP_UNPACK_RAW_1(S,X,val); \
139 _FP_UNPACK_CANONICAL(S,1,X); \
140 } while (0)
141
142#define __FP_UNPACK_D(X,val) \
143 fp_unpack_d(&X##_s, &X##_f1, &X##_f0, &X##_e, &X##_c, val)
144
145#define __FP_PACK_RAW_1(fs, val, X) \
146 do { \
147 union _FP_UNION_##fs *_flo = \
148 (union _FP_UNION_##fs *)val; \
149 \
150 _flo->bits.frac = X##_f; \
151 _flo->bits.exp = X##_e; \
152 _flo->bits.sign = X##_s; \
153 } while (0)
154
155#define __FP_PACK_RAW_2(fs, val, X) \
156 do { \
157 union _FP_UNION_##fs *_flo = \
158 (union _FP_UNION_##fs *)val; \
159 \
160 _flo->bits.frac0 = X##_f0; \
161 _flo->bits.frac1 = X##_f1; \
162 _flo->bits.exp = X##_e; \
163 _flo->bits.sign = X##_s; \
164 } while (0)
165
166#include <linux/kernel.h>
167#include <linux/sched.h>
168
169#define __FPU_FPSCR (current->thread.fpscr)
170
171/* We only actually write to the destination register
172 * if exceptions signalled (if any) will not trap.
173 */
174#define __FPU_ENABLED_EXC \
175({ \
176 (__FPU_FPSCR >> 3) & 0x1f; \
177})
178
179#define __FPU_TRAP_P(bits) \
180 ((__FPU_ENABLED_EXC & (bits)) != 0)
181
182#define __FP_PACK_S(val,X) \
183({ int __exc = _FP_PACK_CANONICAL(S,1,X); \
184 if(!__exc || !__FPU_TRAP_P(__exc)) \
185 __FP_PACK_RAW_1(S,val,X); \
186 __exc; \
187})
188
189#define __FP_PACK_D(val,X) \
190 fp_pack_d(val, X##_s, X##_f1, X##_f0, X##_e, X##_c)
191
192#define __FP_PACK_DS(val,X) \
193 fp_pack_ds(val, X##_s, X##_f1, X##_f0, X##_e, X##_c)
194
195/* Obtain the current rounding mode. */
196#define FP_ROUNDMODE \
197({ \
198 __FPU_FPSCR & 0x3; \
199})
200
201/* the asm fragments go here: all these are taken from glibc-2.0.5's
202 * stdlib/longlong.h
203 */
204
205#include <linux/types.h>
206#include <asm/byteorder.h>
207
208/* add_ssaaaa is used in op-2.h and should be equivalent to
209 * #define add_ssaaaa(sh,sl,ah,al,bh,bl) (sh = ah+bh+ (( sl = al+bl) < al))
210 * add_ssaaaa(high_sum, low_sum, high_addend_1, low_addend_1,
211 * high_addend_2, low_addend_2) adds two UWtype integers, composed by
212 * HIGH_ADDEND_1 and LOW_ADDEND_1, and HIGH_ADDEND_2 and LOW_ADDEND_2
213 * respectively. The result is placed in HIGH_SUM and LOW_SUM. Overflow
214 * (i.e. carry out) is not stored anywhere, and is lost.
215 */
216#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
217 do { \
218 if (__builtin_constant_p (bh) && (bh) == 0) \
219 __asm__ ("{a%I4|add%I4c} %1,%3,%4\n\t{aze|addze} %0,%2" \
220 : "=r" ((USItype)(sh)), \
221 "=&r" ((USItype)(sl)) \
222 : "%r" ((USItype)(ah)), \
223 "%r" ((USItype)(al)), \
224 "rI" ((USItype)(bl))); \
225 else if (__builtin_constant_p (bh) && (bh) ==~(USItype) 0) \
226 __asm__ ("{a%I4|add%I4c} %1,%3,%4\n\t{ame|addme} %0,%2" \
227 : "=r" ((USItype)(sh)), \
228 "=&r" ((USItype)(sl)) \
229 : "%r" ((USItype)(ah)), \
230 "%r" ((USItype)(al)), \
231 "rI" ((USItype)(bl))); \
232 else \
233 __asm__ ("{a%I5|add%I5c} %1,%4,%5\n\t{ae|adde} %0,%2,%3" \
234 : "=r" ((USItype)(sh)), \
235 "=&r" ((USItype)(sl)) \
236 : "%r" ((USItype)(ah)), \
237 "r" ((USItype)(bh)), \
238 "%r" ((USItype)(al)), \
239 "rI" ((USItype)(bl))); \
240 } while (0)
241
242/* sub_ddmmss is used in op-2.h and udivmodti4.c and should be equivalent to
243 * #define sub_ddmmss(sh, sl, ah, al, bh, bl) (sh = ah-bh - ((sl = al-bl) > al))
244 * sub_ddmmss(high_difference, low_difference, high_minuend, low_minuend,
245 * high_subtrahend, low_subtrahend) subtracts two two-word UWtype integers,
246 * composed by HIGH_MINUEND_1 and LOW_MINUEND_1, and HIGH_SUBTRAHEND_2 and
247 * LOW_SUBTRAHEND_2 respectively. The result is placed in HIGH_DIFFERENCE
248 * and LOW_DIFFERENCE. Overflow (i.e. carry out) is not stored anywhere,
249 * and is lost.
250 */
251#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
252 do { \
253 if (__builtin_constant_p (ah) && (ah) == 0) \
254 __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{sfze|subfze} %0,%2" \
255 : "=r" ((USItype)(sh)), \
256 "=&r" ((USItype)(sl)) \
257 : "r" ((USItype)(bh)), \
258 "rI" ((USItype)(al)), \
259 "r" ((USItype)(bl))); \
260 else if (__builtin_constant_p (ah) && (ah) ==~(USItype) 0) \
261 __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{sfme|subfme} %0,%2" \
262 : "=r" ((USItype)(sh)), \
263 "=&r" ((USItype)(sl)) \
264 : "r" ((USItype)(bh)), \
265 "rI" ((USItype)(al)), \
266 "r" ((USItype)(bl))); \
267 else if (__builtin_constant_p (bh) && (bh) == 0) \
268 __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{ame|addme} %0,%2" \
269 : "=r" ((USItype)(sh)), \
270 "=&r" ((USItype)(sl)) \
271 : "r" ((USItype)(ah)), \
272 "rI" ((USItype)(al)), \
273 "r" ((USItype)(bl))); \
274 else if (__builtin_constant_p (bh) && (bh) ==~(USItype) 0) \
275 __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{aze|addze} %0,%2" \
276 : "=r" ((USItype)(sh)), \
277 "=&r" ((USItype)(sl)) \
278 : "r" ((USItype)(ah)), \
279 "rI" ((USItype)(al)), \
280 "r" ((USItype)(bl))); \
281 else \
282 __asm__ ("{sf%I4|subf%I4c} %1,%5,%4\n\t{sfe|subfe} %0,%3,%2" \
283 : "=r" ((USItype)(sh)), \
284 "=&r" ((USItype)(sl)) \
285 : "r" ((USItype)(ah)), \
286 "r" ((USItype)(bh)), \
287 "rI" ((USItype)(al)), \
288 "r" ((USItype)(bl))); \
289 } while (0)
290
291/* asm fragments for mul and div */
292
293/* umul_ppmm(high_prod, low_prod, multipler, multiplicand) multiplies two
294 * UWtype integers MULTIPLER and MULTIPLICAND, and generates a two UWtype
295 * word product in HIGH_PROD and LOW_PROD.
296 */
297#define umul_ppmm(ph, pl, m0, m1) \
298 do { \
299 USItype __m0 = (m0), __m1 = (m1); \
300 __asm__ ("mulhwu %0,%1,%2" \
301 : "=r" ((USItype)(ph)) \
302 : "%r" (__m0), \
303 "r" (__m1)); \
304 (pl) = __m0 * __m1; \
305 } while (0)
306
307/* udiv_qrnnd(quotient, remainder, high_numerator, low_numerator,
308 * denominator) divides a UDWtype, composed by the UWtype integers
309 * HIGH_NUMERATOR and LOW_NUMERATOR, by DENOMINATOR and places the quotient
310 * in QUOTIENT and the remainder in REMAINDER. HIGH_NUMERATOR must be less
311 * than DENOMINATOR for correct operation. If, in addition, the most
312 * significant bit of DENOMINATOR must be 1, then the pre-processor symbol
313 * UDIV_NEEDS_NORMALIZATION is defined to 1.
314 */
315#define udiv_qrnnd(q, r, n1, n0, d) \
316 do { \
317 UWtype __d1, __d0, __q1, __q0, __r1, __r0, __m; \
318 __d1 = __ll_highpart (d); \
319 __d0 = __ll_lowpart (d); \
320 \
321 __r1 = (n1) % __d1; \
322 __q1 = (n1) / __d1; \
323 __m = (UWtype) __q1 * __d0; \
324 __r1 = __r1 * __ll_B | __ll_highpart (n0); \
325 if (__r1 < __m) \
326 { \
327 __q1--, __r1 += (d); \
328 if (__r1 >= (d)) /* we didn't get carry when adding to __r1 */ \
329 if (__r1 < __m) \
330 __q1--, __r1 += (d); \
331 } \
332 __r1 -= __m; \
333 \
334 __r0 = __r1 % __d1; \
335 __q0 = __r1 / __d1; \
336 __m = (UWtype) __q0 * __d0; \
337 __r0 = __r0 * __ll_B | __ll_lowpart (n0); \
338 if (__r0 < __m) \
339 { \
340 __q0--, __r0 += (d); \
341 if (__r0 >= (d)) \
342 if (__r0 < __m) \
343 __q0--, __r0 += (d); \
344 } \
345 __r0 -= __m; \
346 \
347 (q) = (UWtype) __q1 * __ll_B | __q0; \
348 (r) = __r0; \
349 } while (0)
350
351#define UDIV_NEEDS_NORMALIZATION 1
352
353#define abort() \
354 return 0
355
356#ifdef __BIG_ENDIAN
357#define __BYTE_ORDER __BIG_ENDIAN
358#else
359#define __BYTE_ORDER __LITTLE_ENDIAN
360#endif
361
362/* Exception flags. */
363#define EFLAG_INVALID (1 << (31 - 2))
364#define EFLAG_OVERFLOW (1 << (31 - 3))
365#define EFLAG_UNDERFLOW (1 << (31 - 4))
366#define EFLAG_DIVZERO (1 << (31 - 5))
367#define EFLAG_INEXACT (1 << (31 - 6))
368
369#define EFLAG_VXSNAN (1 << (31 - 7))
370#define EFLAG_VXISI (1 << (31 - 8))
371#define EFLAG_VXIDI (1 << (31 - 9))
372#define EFLAG_VXZDZ (1 << (31 - 10))
373#define EFLAG_VXIMZ (1 << (31 - 11))
374#define EFLAG_VXVC (1 << (31 - 12))
375#define EFLAG_VXSOFT (1 << (31 - 21))
376#define EFLAG_VXSQRT (1 << (31 - 22))
377#define EFLAG_VXCVI (1 << (31 - 23))
diff --git a/arch/ppc/math-emu/single.h b/arch/ppc/math-emu/single.h
new file mode 100644
index 000000000000..f19d99451815
--- /dev/null
+++ b/arch/ppc/math-emu/single.h
@@ -0,0 +1,66 @@
1/*
2 * Definitions for IEEE Single Precision
3 */
4
5#if _FP_W_TYPE_SIZE < 32
6#error "Here's a nickel kid. Go buy yourself a real computer."
7#endif
8
9#define _FP_FRACBITS_S 24
10#define _FP_FRACXBITS_S (_FP_W_TYPE_SIZE - _FP_FRACBITS_S)
11#define _FP_WFRACBITS_S (_FP_WORKBITS + _FP_FRACBITS_S)
12#define _FP_WFRACXBITS_S (_FP_W_TYPE_SIZE - _FP_WFRACBITS_S)
13#define _FP_EXPBITS_S 8
14#define _FP_EXPBIAS_S 127
15#define _FP_EXPMAX_S 255
16#define _FP_QNANBIT_S ((_FP_W_TYPE)1 << (_FP_FRACBITS_S-2))
17#define _FP_IMPLBIT_S ((_FP_W_TYPE)1 << (_FP_FRACBITS_S-1))
18#define _FP_OVERFLOW_S ((_FP_W_TYPE)1 << (_FP_WFRACBITS_S))
19
20/* The implementation of _FP_MUL_MEAT_S and _FP_DIV_MEAT_S should be
21 chosen by the target machine. */
22
23union _FP_UNION_S
24{
25 float flt;
26 struct {
27#if __BYTE_ORDER == __BIG_ENDIAN
28 unsigned sign : 1;
29 unsigned exp : _FP_EXPBITS_S;
30 unsigned frac : _FP_FRACBITS_S - (_FP_IMPLBIT_S != 0);
31#else
32 unsigned frac : _FP_FRACBITS_S - (_FP_IMPLBIT_S != 0);
33 unsigned exp : _FP_EXPBITS_S;
34 unsigned sign : 1;
35#endif
36 } bits __attribute__((packed));
37};
38
39#define FP_DECL_S(X) _FP_DECL(1,X)
40#define FP_UNPACK_RAW_S(X,val) _FP_UNPACK_RAW_1(S,X,val)
41#define FP_PACK_RAW_S(val,X) _FP_PACK_RAW_1(S,val,X)
42
43#define FP_UNPACK_S(X,val) \
44 do { \
45 _FP_UNPACK_RAW_1(S,X,val); \
46 _FP_UNPACK_CANONICAL(S,1,X); \
47 } while (0)
48
49#define FP_PACK_S(val,X) \
50 do { \
51 _FP_PACK_CANONICAL(S,1,X); \
52 _FP_PACK_RAW_1(S,val,X); \
53 } while (0)
54
55#define FP_NEG_S(R,X) _FP_NEG(S,1,R,X)
56#define FP_ADD_S(R,X,Y) _FP_ADD(S,1,R,X,Y)
57#define FP_SUB_S(R,X,Y) _FP_SUB(S,1,R,X,Y)
58#define FP_MUL_S(R,X,Y) _FP_MUL(S,1,R,X,Y)
59#define FP_DIV_S(R,X,Y) _FP_DIV(S,1,R,X,Y)
60#define FP_SQRT_S(R,X) _FP_SQRT(S,1,R,X)
61
62#define FP_CMP_S(r,X,Y,un) _FP_CMP(S,1,r,X,Y,un)
63#define FP_CMP_EQ_S(r,X,Y) _FP_CMP_EQ(S,1,r,X,Y)
64
65#define FP_TO_INT_S(r,X,rsz,rsg) _FP_TO_INT(S,1,r,X,rsz,rsg)
66#define FP_FROM_INT_S(X,r,rs,rt) _FP_FROM_INT(S,1,X,r,rs,rt)
diff --git a/arch/ppc/math-emu/soft-fp.h b/arch/ppc/math-emu/soft-fp.h
new file mode 100644
index 000000000000..cca39598f873
--- /dev/null
+++ b/arch/ppc/math-emu/soft-fp.h
@@ -0,0 +1,104 @@
1#ifndef SOFT_FP_H
2#define SOFT_FP_H
3
4#include "sfp-machine.h"
5
6#define _FP_WORKBITS 3
7#define _FP_WORK_LSB ((_FP_W_TYPE)1 << 3)
8#define _FP_WORK_ROUND ((_FP_W_TYPE)1 << 2)
9#define _FP_WORK_GUARD ((_FP_W_TYPE)1 << 1)
10#define _FP_WORK_STICKY ((_FP_W_TYPE)1 << 0)
11
12#ifndef FP_RND_NEAREST
13# define FP_RND_NEAREST 0
14# define FP_RND_ZERO 1
15# define FP_RND_PINF 2
16# define FP_RND_MINF 3
17#ifndef FP_ROUNDMODE
18# define FP_ROUNDMODE FP_RND_NEAREST
19#endif
20#endif
21
22#define _FP_ROUND_NEAREST(wc, X) \
23({ int __ret = 0; \
24 int __frac = _FP_FRAC_LOW_##wc(X) & 15; \
25 if (__frac & 7) { \
26 __ret = EFLAG_INEXACT; \
27 if ((__frac & 7) != _FP_WORK_ROUND) \
28 _FP_FRAC_ADDI_##wc(X, _FP_WORK_ROUND); \
29 else if (__frac & _FP_WORK_LSB) \
30 _FP_FRAC_ADDI_##wc(X, _FP_WORK_ROUND); \
31 } \
32 __ret; \
33})
34
35#define _FP_ROUND_ZERO(wc, X) \
36({ int __ret = 0; \
37 if (_FP_FRAC_LOW_##wc(X) & 7) \
38 __ret = EFLAG_INEXACT; \
39 __ret; \
40})
41
42#define _FP_ROUND_PINF(wc, X) \
43({ int __ret = EFLAG_INEXACT; \
44 if (!X##_s && (_FP_FRAC_LOW_##wc(X) & 7)) \
45 _FP_FRAC_ADDI_##wc(X, _FP_WORK_LSB); \
46 else __ret = 0; \
47 __ret; \
48})
49
50#define _FP_ROUND_MINF(wc, X) \
51({ int __ret = EFLAG_INEXACT; \
52 if (X##_s && (_FP_FRAC_LOW_##wc(X) & 7)) \
53 _FP_FRAC_ADDI_##wc(X, _FP_WORK_LSB); \
54 else __ret = 0; \
55 __ret; \
56})
57
58#define _FP_ROUND(wc, X) \
59({ int __ret = 0; \
60 switch (FP_ROUNDMODE) \
61 { \
62 case FP_RND_NEAREST: \
63 __ret |= _FP_ROUND_NEAREST(wc,X); \
64 break; \
65 case FP_RND_ZERO: \
66 __ret |= _FP_ROUND_ZERO(wc,X); \
67 break; \
68 case FP_RND_PINF: \
69 __ret |= _FP_ROUND_PINF(wc,X); \
70 break; \
71 case FP_RND_MINF: \
72 __ret |= _FP_ROUND_MINF(wc,X); \
73 break; \
74 }; \
75 __ret; \
76})
77
78#define FP_CLS_NORMAL 0
79#define FP_CLS_ZERO 1
80#define FP_CLS_INF 2
81#define FP_CLS_NAN 3
82
83#define _FP_CLS_COMBINE(x,y) (((x) << 2) | (y))
84
85#include "op-1.h"
86#include "op-2.h"
87#include "op-4.h"
88#include "op-common.h"
89
90/* Sigh. Silly things longlong.h needs. */
91#define UWtype _FP_W_TYPE
92#define W_TYPE_SIZE _FP_W_TYPE_SIZE
93
94typedef int SItype __attribute__((mode(SI)));
95typedef int DItype __attribute__((mode(DI)));
96typedef unsigned int USItype __attribute__((mode(SI)));
97typedef unsigned int UDItype __attribute__((mode(DI)));
98#if _FP_W_TYPE_SIZE == 32
99typedef unsigned int UHWtype __attribute__((mode(HI)));
100#elif _FP_W_TYPE_SIZE == 64
101typedef USItype UHWtype;
102#endif
103
104#endif
diff --git a/arch/ppc/math-emu/stfd.c b/arch/ppc/math-emu/stfd.c
new file mode 100644
index 000000000000..3f8c2558a9e8
--- /dev/null
+++ b/arch/ppc/math-emu/stfd.c
@@ -0,0 +1,20 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5int
6stfd(void *frS, void *ea)
7{
8#if 0
9#ifdef DEBUG
10 printk("%s: S %p, ea %p: ", __FUNCTION__, frS, ea);
11 dump_double(frS);
12 printk("\n");
13#endif
14#endif
15
16 if (copy_to_user(ea, frS, sizeof(double)))
17 return -EFAULT;
18
19 return 0;
20}
diff --git a/arch/ppc/math-emu/stfiwx.c b/arch/ppc/math-emu/stfiwx.c
new file mode 100644
index 000000000000..95caaeec6a08
--- /dev/null
+++ b/arch/ppc/math-emu/stfiwx.c
@@ -0,0 +1,16 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5int
6stfiwx(u32 *frS, void *ea)
7{
8#ifdef DEBUG
9 printk("%s: %p %p\n", __FUNCTION__, frS, ea);
10#endif
11
12 if (copy_to_user(ea, &frS[1], sizeof(frS[1])))
13 return -EFAULT;
14
15 return 0;
16}
diff --git a/arch/ppc/math-emu/stfs.c b/arch/ppc/math-emu/stfs.c
new file mode 100644
index 000000000000..e87ca23c6dc3
--- /dev/null
+++ b/arch/ppc/math-emu/stfs.c
@@ -0,0 +1,41 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5#include "soft-fp.h"
6#include "double.h"
7#include "single.h"
8
9int
10stfs(void *frS, void *ea)
11{
12 FP_DECL_D(A);
13 FP_DECL_S(R);
14 float f;
15 int err;
16
17#ifdef DEBUG
18 printk("%s: S %p, ea %p\n", __FUNCTION__, frS, ea);
19#endif
20
21 __FP_UNPACK_D(A, frS);
22
23#ifdef DEBUG
24 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c);
25#endif
26
27 FP_CONV(S, D, 1, 2, R, A);
28
29#ifdef DEBUG
30 printk("R: %ld %lu %ld (%ld)\n", R_s, R_f, R_e, R_c);
31#endif
32
33 err = _FP_PACK_CANONICAL(S, 1, R);
34 if (!err || !__FPU_TRAP_P(err)) {
35 __FP_PACK_RAW_1(S, &f, R);
36 if (copy_to_user(ea, &f, sizeof(float)))
37 return -EFAULT;
38 }
39
40 return err;
41}
diff --git a/arch/ppc/math-emu/types.c b/arch/ppc/math-emu/types.c
new file mode 100644
index 000000000000..e1ed15d829db
--- /dev/null
+++ b/arch/ppc/math-emu/types.c
@@ -0,0 +1,51 @@
1#include "soft-fp.h"
2#include "double.h"
3#include "single.h"
4
5void
6fp_unpack_d(long *_s, unsigned long *_f1, unsigned long *_f0,
7 long *_e, long *_c, void *val)
8{
9 FP_DECL_D(X);
10
11 __FP_UNPACK_RAW_2(D, X, val);
12
13 _FP_UNPACK_CANONICAL(D, 2, X);
14
15 *_s = X_s;
16 *_f1 = X_f1;
17 *_f0 = X_f0;
18 *_e = X_e;
19 *_c = X_c;
20}
21
22int
23fp_pack_d(void *val, long X_s, unsigned long X_f1,
24 unsigned long X_f0, long X_e, long X_c)
25{
26 int exc;
27
28 exc = _FP_PACK_CANONICAL(D, 2, X);
29 if (!exc || !__FPU_TRAP_P(exc))
30 __FP_PACK_RAW_2(D, val, X);
31 return exc;
32}
33
34int
35fp_pack_ds(void *val, long X_s, unsigned long X_f1,
36 unsigned long X_f0, long X_e, long X_c)
37{
38 FP_DECL_S(__X);
39 int exc;
40
41 FP_CONV(S, D, 1, 2, __X, X);
42 exc = _FP_PACK_CANONICAL(S, 1, __X);
43 if (!exc || !__FPU_TRAP_P(exc)) {
44 _FP_UNPACK_CANONICAL(S, 1, __X);
45 FP_CONV(D, S, 2, 1, X, __X);
46 exc |= _FP_PACK_CANONICAL(D, 2, X);
47 if (!exc || !__FPU_TRAP_P(exc))
48 __FP_PACK_RAW_2(D, val, X);
49 }
50 return exc;
51}
diff --git a/arch/ppc/math-emu/udivmodti4.c b/arch/ppc/math-emu/udivmodti4.c
new file mode 100644
index 000000000000..7e112dc1e2f2
--- /dev/null
+++ b/arch/ppc/math-emu/udivmodti4.c
@@ -0,0 +1,191 @@
1/* This has so very few changes over libgcc2's __udivmoddi4 it isn't funny. */
2
3#include "soft-fp.h"
4
5#undef count_leading_zeros
6#define count_leading_zeros __FP_CLZ
7
8void
9_fp_udivmodti4(_FP_W_TYPE q[2], _FP_W_TYPE r[2],
10 _FP_W_TYPE n1, _FP_W_TYPE n0,
11 _FP_W_TYPE d1, _FP_W_TYPE d0)
12{
13 _FP_W_TYPE q0, q1, r0, r1;
14 _FP_I_TYPE b, bm;
15
16 if (d1 == 0)
17 {
18#if !UDIV_NEEDS_NORMALIZATION
19 if (d0 > n1)
20 {
21 /* 0q = nn / 0D */
22
23 udiv_qrnnd (q0, n0, n1, n0, d0);
24 q1 = 0;
25
26 /* Remainder in n0. */
27 }
28 else
29 {
30 /* qq = NN / 0d */
31
32 if (d0 == 0)
33 d0 = 1 / d0; /* Divide intentionally by zero. */
34
35 udiv_qrnnd (q1, n1, 0, n1, d0);
36 udiv_qrnnd (q0, n0, n1, n0, d0);
37
38 /* Remainder in n0. */
39 }
40
41 r0 = n0;
42 r1 = 0;
43
44#else /* UDIV_NEEDS_NORMALIZATION */
45
46 if (d0 > n1)
47 {
48 /* 0q = nn / 0D */
49
50 count_leading_zeros (bm, d0);
51
52 if (bm != 0)
53 {
54 /* Normalize, i.e. make the most significant bit of the
55 denominator set. */
56
57 d0 = d0 << bm;
58 n1 = (n1 << bm) | (n0 >> (_FP_W_TYPE_SIZE - bm));
59 n0 = n0 << bm;
60 }
61
62 udiv_qrnnd (q0, n0, n1, n0, d0);
63 q1 = 0;
64
65 /* Remainder in n0 >> bm. */
66 }
67 else
68 {
69 /* qq = NN / 0d */
70
71 if (d0 == 0)
72 d0 = 1 / d0; /* Divide intentionally by zero. */
73
74 count_leading_zeros (bm, d0);
75
76 if (bm == 0)
77 {
78 /* From (n1 >= d0) /\ (the most significant bit of d0 is set),
79 conclude (the most significant bit of n1 is set) /\ (the
80 leading quotient digit q1 = 1).
81
82 This special case is necessary, not an optimization.
83 (Shifts counts of SI_TYPE_SIZE are undefined.) */
84
85 n1 -= d0;
86 q1 = 1;
87 }
88 else
89 {
90 _FP_W_TYPE n2;
91
92 /* Normalize. */
93
94 b = _FP_W_TYPE_SIZE - bm;
95
96 d0 = d0 << bm;
97 n2 = n1 >> b;
98 n1 = (n1 << bm) | (n0 >> b);
99 n0 = n0 << bm;
100
101 udiv_qrnnd (q1, n1, n2, n1, d0);
102 }
103
104 /* n1 != d0... */
105
106 udiv_qrnnd (q0, n0, n1, n0, d0);
107
108 /* Remainder in n0 >> bm. */
109 }
110
111 r0 = n0 >> bm;
112 r1 = 0;
113#endif /* UDIV_NEEDS_NORMALIZATION */
114 }
115 else
116 {
117 if (d1 > n1)
118 {
119 /* 00 = nn / DD */
120
121 q0 = 0;
122 q1 = 0;
123
124 /* Remainder in n1n0. */
125 r0 = n0;
126 r1 = n1;
127 }
128 else
129 {
130 /* 0q = NN / dd */
131
132 count_leading_zeros (bm, d1);
133 if (bm == 0)
134 {
135 /* From (n1 >= d1) /\ (the most significant bit of d1 is set),
136 conclude (the most significant bit of n1 is set) /\ (the
137 quotient digit q0 = 0 or 1).
138
139 This special case is necessary, not an optimization. */
140
141 /* The condition on the next line takes advantage of that
142 n1 >= d1 (true due to program flow). */
143 if (n1 > d1 || n0 >= d0)
144 {
145 q0 = 1;
146 sub_ddmmss (n1, n0, n1, n0, d1, d0);
147 }
148 else
149 q0 = 0;
150
151 q1 = 0;
152
153 r0 = n0;
154 r1 = n1;
155 }
156 else
157 {
158 _FP_W_TYPE m1, m0, n2;
159
160 /* Normalize. */
161
162 b = _FP_W_TYPE_SIZE - bm;
163
164 d1 = (d1 << bm) | (d0 >> b);
165 d0 = d0 << bm;
166 n2 = n1 >> b;
167 n1 = (n1 << bm) | (n0 >> b);
168 n0 = n0 << bm;
169
170 udiv_qrnnd (q0, n1, n2, n1, d1);
171 umul_ppmm (m1, m0, q0, d0);
172
173 if (m1 > n1 || (m1 == n1 && m0 > n0))
174 {
175 q0--;
176 sub_ddmmss (m1, m0, m1, m0, d1, d0);
177 }
178
179 q1 = 0;
180
181 /* Remainder in (n1n0 - m1m0) >> bm. */
182 sub_ddmmss (n1, n0, n1, n0, m1, m0);
183 r0 = (n1 << b) | (n0 >> bm);
184 r1 = n1 >> bm;
185 }
186 }
187 }
188
189 q[0] = q0; q[1] = q1;
190 r[0] = r0, r[1] = r1;
191}
diff --git a/arch/ppc/mm/44x_mmu.c b/arch/ppc/mm/44x_mmu.c
new file mode 100644
index 000000000000..72f7c0d1c0ed
--- /dev/null
+++ b/arch/ppc/mm/44x_mmu.c
@@ -0,0 +1,121 @@
1/*
2 * Modifications by Matt Porter (mporter@mvista.com) to support
3 * PPC44x Book E processors.
4 *
5 * This file contains the routines for initializing the MMU
6 * on the 4xx series of chips.
7 * -- paulus
8 *
9 * Derived from arch/ppc/mm/init.c:
10 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
11 *
12 * Modifications by Paul Mackerras (PowerMac) (paulus@cs.anu.edu.au)
13 * and Cort Dougan (PReP) (cort@cs.nmt.edu)
14 * Copyright (C) 1996 Paul Mackerras
15 * Amiga/APUS changes by Jesper Skov (jskov@cygnus.co.uk).
16 *
17 * Derived from "arch/i386/mm/init.c"
18 * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds
19 *
20 * This program is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU General Public License
22 * as published by the Free Software Foundation; either version
23 * 2 of the License, or (at your option) any later version.
24 *
25 */
26
27#include <linux/config.h>
28#include <linux/signal.h>
29#include <linux/sched.h>
30#include <linux/kernel.h>
31#include <linux/errno.h>
32#include <linux/string.h>
33#include <linux/types.h>
34#include <linux/ptrace.h>
35#include <linux/mman.h>
36#include <linux/mm.h>
37#include <linux/swap.h>
38#include <linux/stddef.h>
39#include <linux/vmalloc.h>
40#include <linux/init.h>
41#include <linux/delay.h>
42#include <linux/bootmem.h>
43#include <linux/highmem.h>
44
45#include <asm/pgalloc.h>
46#include <asm/prom.h>
47#include <asm/io.h>
48#include <asm/mmu_context.h>
49#include <asm/pgtable.h>
50#include <asm/mmu.h>
51#include <asm/uaccess.h>
52#include <asm/smp.h>
53#include <asm/bootx.h>
54#include <asm/machdep.h>
55#include <asm/setup.h>
56
57#include "mmu_decl.h"
58
59extern char etext[], _stext[];
60
61/* Used by the 44x TLB replacement exception handler.
62 * Just needed it declared someplace.
63 */
64unsigned int tlb_44x_index = 0;
65unsigned int tlb_44x_hwater = 62;
66
67/*
68 * "Pins" a 256MB TLB entry in AS0 for kernel lowmem
69 */
70static void __init
71ppc44x_pin_tlb(int slot, unsigned int virt, unsigned int phys)
72{
73 unsigned long attrib = 0;
74
75 __asm__ __volatile__("\
76 clrrwi %2,%2,10\n\
77 ori %2,%2,%4\n\
78 clrrwi %1,%1,10\n\
79 li %0,0\n\
80 ori %0,%0,%5\n\
81 tlbwe %2,%3,%6\n\
82 tlbwe %1,%3,%7\n\
83 tlbwe %0,%3,%8"
84 :
85 : "r" (attrib), "r" (phys), "r" (virt), "r" (slot),
86 "i" (PPC44x_TLB_VALID | PPC44x_TLB_256M),
87 "i" (PPC44x_TLB_SW | PPC44x_TLB_SR | PPC44x_TLB_SX | PPC44x_TLB_G),
88 "i" (PPC44x_TLB_PAGEID),
89 "i" (PPC44x_TLB_XLAT),
90 "i" (PPC44x_TLB_ATTRIB));
91}
92
93/*
94 * MMU_init_hw does the chip-specific initialization of the MMU hardware.
95 */
96void __init MMU_init_hw(void)
97{
98 flush_instruction_cache();
99}
100
101unsigned long __init mmu_mapin_ram(void)
102{
103 unsigned int pinned_tlbs = 1;
104 int i;
105
106 /* Determine number of entries necessary to cover lowmem */
107 pinned_tlbs = (unsigned int)
108 (_ALIGN(total_lowmem, PPC44x_PIN_SIZE) >> PPC44x_PIN_SHIFT);
109
110 /* Write upper watermark to save location */
111 tlb_44x_hwater = PPC44x_LOW_SLOT - pinned_tlbs;
112
113 /* If necessary, set additional pinned TLBs */
114 if (pinned_tlbs > 1)
115 for (i = (PPC44x_LOW_SLOT-(pinned_tlbs-1)); i < PPC44x_LOW_SLOT; i++) {
116 unsigned int phys_addr = (PPC44x_LOW_SLOT-i) * PPC44x_PIN_SIZE;
117 ppc44x_pin_tlb(i, phys_addr+PAGE_OFFSET, phys_addr);
118 }
119
120 return total_lowmem;
121}
diff --git a/arch/ppc/mm/4xx_mmu.c b/arch/ppc/mm/4xx_mmu.c
new file mode 100644
index 000000000000..a7f616140381
--- /dev/null
+++ b/arch/ppc/mm/4xx_mmu.c
@@ -0,0 +1,142 @@
1/*
2 * This file contains the routines for initializing the MMU
3 * on the 4xx series of chips.
4 * -- paulus
5 *
6 * Derived from arch/ppc/mm/init.c:
7 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
8 *
9 * Modifications by Paul Mackerras (PowerMac) (paulus@cs.anu.edu.au)
10 * and Cort Dougan (PReP) (cort@cs.nmt.edu)
11 * Copyright (C) 1996 Paul Mackerras
12 * Amiga/APUS changes by Jesper Skov (jskov@cygnus.co.uk).
13 *
14 * Derived from "arch/i386/mm/init.c"
15 * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds
16 *
17 * This program is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU General Public License
19 * as published by the Free Software Foundation; either version
20 * 2 of the License, or (at your option) any later version.
21 *
22 */
23
24#include <linux/config.h>
25#include <linux/signal.h>
26#include <linux/sched.h>
27#include <linux/kernel.h>
28#include <linux/errno.h>
29#include <linux/string.h>
30#include <linux/types.h>
31#include <linux/ptrace.h>
32#include <linux/mman.h>
33#include <linux/mm.h>
34#include <linux/swap.h>
35#include <linux/stddef.h>
36#include <linux/vmalloc.h>
37#include <linux/init.h>
38#include <linux/delay.h>
39#include <linux/bootmem.h>
40#include <linux/highmem.h>
41
42#include <asm/pgalloc.h>
43#include <asm/prom.h>
44#include <asm/io.h>
45#include <asm/mmu_context.h>
46#include <asm/pgtable.h>
47#include <asm/mmu.h>
48#include <asm/uaccess.h>
49#include <asm/smp.h>
50#include <asm/bootx.h>
51#include <asm/machdep.h>
52#include <asm/setup.h>
53#include "mmu_decl.h"
54
55extern int __map_without_ltlbs;
56/*
57 * MMU_init_hw does the chip-specific initialization of the MMU hardware.
58 */
59void __init MMU_init_hw(void)
60{
61 /*
62 * The Zone Protection Register (ZPR) defines how protection will
63 * be applied to every page which is a member of a given zone. At
64 * present, we utilize only two of the 4xx's zones.
65 * The zone index bits (of ZSEL) in the PTE are used for software
66 * indicators, except the LSB. For user access, zone 1 is used,
67 * for kernel access, zone 0 is used. We set all but zone 1
68 * to zero, allowing only kernel access as indicated in the PTE.
69 * For zone 1, we set a 01 binary (a value of 10 will not work)
70 * to allow user access as indicated in the PTE. This also allows
71 * kernel access as indicated in the PTE.
72 */
73
74 mtspr(SPRN_ZPR, 0x10000000);
75
76 flush_instruction_cache();
77
78 /*
79 * Set up the real-mode cache parameters for the exception vector
80 * handlers (which are run in real-mode).
81 */
82
83 mtspr(SPRN_DCWR, 0x00000000); /* All caching is write-back */
84
85 /*
86 * Cache instruction and data space where the exception
87 * vectors and the kernel live in real-mode.
88 */
89
90 mtspr(SPRN_DCCR, 0xF0000000); /* 512 MB of data space at 0x0. */
91 mtspr(SPRN_ICCR, 0xF0000000); /* 512 MB of instr. space at 0x0. */
92}
93
94#define LARGE_PAGE_SIZE_16M (1<<24)
95#define LARGE_PAGE_SIZE_4M (1<<22)
96
97unsigned long __init mmu_mapin_ram(void)
98{
99 unsigned long v, s;
100 phys_addr_t p;
101
102 v = KERNELBASE;
103 p = PPC_MEMSTART;
104 s = 0;
105
106 if (__map_without_ltlbs) {
107 return s;
108 }
109
110 while (s <= (total_lowmem - LARGE_PAGE_SIZE_16M)) {
111 pmd_t *pmdp;
112 unsigned long val = p | _PMD_SIZE_16M | _PAGE_HWEXEC | _PAGE_HWWRITE;
113
114 spin_lock(&init_mm.page_table_lock);
115 pmdp = pmd_offset(pgd_offset_k(v), v);
116 pmd_val(*pmdp++) = val;
117 pmd_val(*pmdp++) = val;
118 pmd_val(*pmdp++) = val;
119 pmd_val(*pmdp++) = val;
120 spin_unlock(&init_mm.page_table_lock);
121
122 v += LARGE_PAGE_SIZE_16M;
123 p += LARGE_PAGE_SIZE_16M;
124 s += LARGE_PAGE_SIZE_16M;
125 }
126
127 while (s <= (total_lowmem - LARGE_PAGE_SIZE_4M)) {
128 pmd_t *pmdp;
129 unsigned long val = p | _PMD_SIZE_4M | _PAGE_HWEXEC | _PAGE_HWWRITE;
130
131 spin_lock(&init_mm.page_table_lock);
132 pmdp = pmd_offset(pgd_offset_k(v), v);
133 pmd_val(*pmdp) = val;
134 spin_unlock(&init_mm.page_table_lock);
135
136 v += LARGE_PAGE_SIZE_4M;
137 p += LARGE_PAGE_SIZE_4M;
138 s += LARGE_PAGE_SIZE_4M;
139 }
140
141 return s;
142}
diff --git a/arch/ppc/mm/Makefile b/arch/ppc/mm/Makefile
new file mode 100644
index 000000000000..cd3eae147cf8
--- /dev/null
+++ b/arch/ppc/mm/Makefile
@@ -0,0 +1,11 @@
1#
2# Makefile for the linux ppc-specific parts of the memory manager.
3#
4
5obj-y := fault.o init.o mem_pieces.o \
6 mmu_context.o pgtable.o
7
8obj-$(CONFIG_PPC_STD_MMU) += hashtable.o ppc_mmu.o tlb.o
9obj-$(CONFIG_40x) += 4xx_mmu.o
10obj-$(CONFIG_44x) += 44x_mmu.o
11obj-$(CONFIG_FSL_BOOKE) += fsl_booke_mmu.o
diff --git a/arch/ppc/mm/fault.c b/arch/ppc/mm/fault.c
new file mode 100644
index 000000000000..57d9930843ac
--- /dev/null
+++ b/arch/ppc/mm/fault.c
@@ -0,0 +1,440 @@
1/*
2 * arch/ppc/mm/fault.c
3 *
4 * PowerPC version
5 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
6 *
7 * Derived from "arch/i386/mm/fault.c"
8 * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds
9 *
10 * Modified by Cort Dougan and Paul Mackerras.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version
15 * 2 of the License, or (at your option) any later version.
16 */
17
18#include <linux/config.h>
19#include <linux/signal.h>
20#include <linux/sched.h>
21#include <linux/kernel.h>
22#include <linux/errno.h>
23#include <linux/string.h>
24#include <linux/types.h>
25#include <linux/ptrace.h>
26#include <linux/mman.h>
27#include <linux/mm.h>
28#include <linux/interrupt.h>
29#include <linux/highmem.h>
30#include <linux/module.h>
31
32#include <asm/page.h>
33#include <asm/pgtable.h>
34#include <asm/mmu.h>
35#include <asm/mmu_context.h>
36#include <asm/system.h>
37#include <asm/uaccess.h>
38#include <asm/tlbflush.h>
39
40#if defined(CONFIG_XMON) || defined(CONFIG_KGDB)
41extern void (*debugger)(struct pt_regs *);
42extern void (*debugger_fault_handler)(struct pt_regs *);
43extern int (*debugger_dabr_match)(struct pt_regs *);
44int debugger_kernel_faults = 1;
45#endif
46
47unsigned long htab_reloads; /* updated by hashtable.S:hash_page() */
48unsigned long htab_evicts; /* updated by hashtable.S:hash_page() */
49unsigned long htab_preloads; /* updated by hashtable.S:add_hash_page() */
50unsigned long pte_misses; /* updated by do_page_fault() */
51unsigned long pte_errors; /* updated by do_page_fault() */
52unsigned int probingmem;
53
54/*
55 * Check whether the instruction at regs->nip is a store using
56 * an update addressing form which will update r1.
57 */
58static int store_updates_sp(struct pt_regs *regs)
59{
60 unsigned int inst;
61
62 if (get_user(inst, (unsigned int __user *)regs->nip))
63 return 0;
64 /* check for 1 in the rA field */
65 if (((inst >> 16) & 0x1f) != 1)
66 return 0;
67 /* check major opcode */
68 switch (inst >> 26) {
69 case 37: /* stwu */
70 case 39: /* stbu */
71 case 45: /* sthu */
72 case 53: /* stfsu */
73 case 55: /* stfdu */
74 return 1;
75 case 31:
76 /* check minor opcode */
77 switch ((inst >> 1) & 0x3ff) {
78 case 183: /* stwux */
79 case 247: /* stbux */
80 case 439: /* sthux */
81 case 695: /* stfsux */
82 case 759: /* stfdux */
83 return 1;
84 }
85 }
86 return 0;
87}
88
89/*
90 * For 600- and 800-family processors, the error_code parameter is DSISR
91 * for a data fault, SRR1 for an instruction fault. For 400-family processors
92 * the error_code parameter is ESR for a data fault, 0 for an instruction
93 * fault.
94 */
95int do_page_fault(struct pt_regs *regs, unsigned long address,
96 unsigned long error_code)
97{
98 struct vm_area_struct * vma;
99 struct mm_struct *mm = current->mm;
100 siginfo_t info;
101 int code = SEGV_MAPERR;
102#if defined(CONFIG_4xx) || defined (CONFIG_BOOKE)
103 int is_write = error_code & ESR_DST;
104#else
105 int is_write = 0;
106
107 /*
108 * Fortunately the bit assignments in SRR1 for an instruction
109 * fault and DSISR for a data fault are mostly the same for the
110 * bits we are interested in. But there are some bits which
111 * indicate errors in DSISR but can validly be set in SRR1.
112 */
113 if (TRAP(regs) == 0x400)
114 error_code &= 0x48200000;
115 else
116 is_write = error_code & 0x02000000;
117#endif /* CONFIG_4xx || CONFIG_BOOKE */
118
119#if defined(CONFIG_XMON) || defined(CONFIG_KGDB)
120 if (debugger_fault_handler && TRAP(regs) == 0x300) {
121 debugger_fault_handler(regs);
122 return 0;
123 }
124#if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE))
125 if (error_code & 0x00400000) {
126 /* DABR match */
127 if (debugger_dabr_match(regs))
128 return 0;
129 }
130#endif /* !(CONFIG_4xx || CONFIG_BOOKE)*/
131#endif /* CONFIG_XMON || CONFIG_KGDB */
132
133 if (in_atomic() || mm == NULL)
134 return SIGSEGV;
135
136 down_read(&mm->mmap_sem);
137 vma = find_vma(mm, address);
138 if (!vma)
139 goto bad_area;
140 if (vma->vm_start <= address)
141 goto good_area;
142 if (!(vma->vm_flags & VM_GROWSDOWN))
143 goto bad_area;
144 if (!is_write)
145 goto bad_area;
146
147 /*
148 * N.B. The rs6000/xcoff ABI allows programs to access up to
149 * a few hundred bytes below the stack pointer.
150 * The kernel signal delivery code writes up to about 1.5kB
151 * below the stack pointer (r1) before decrementing it.
152 * The exec code can write slightly over 640kB to the stack
153 * before setting the user r1. Thus we allow the stack to
154 * expand to 1MB without further checks.
155 */
156 if (address + 0x100000 < vma->vm_end) {
157 /* get user regs even if this fault is in kernel mode */
158 struct pt_regs *uregs = current->thread.regs;
159 if (uregs == NULL)
160 goto bad_area;
161
162 /*
163 * A user-mode access to an address a long way below
164 * the stack pointer is only valid if the instruction
165 * is one which would update the stack pointer to the
166 * address accessed if the instruction completed,
167 * i.e. either stwu rs,n(r1) or stwux rs,r1,rb
168 * (or the byte, halfword, float or double forms).
169 *
170 * If we don't check this then any write to the area
171 * between the last mapped region and the stack will
172 * expand the stack rather than segfaulting.
173 */
174 if (address + 2048 < uregs->gpr[1]
175 && (!user_mode(regs) || !store_updates_sp(regs)))
176 goto bad_area;
177 }
178 if (expand_stack(vma, address))
179 goto bad_area;
180
181good_area:
182 code = SEGV_ACCERR;
183#if defined(CONFIG_6xx)
184 if (error_code & 0x95700000)
185 /* an error such as lwarx to I/O controller space,
186 address matching DABR, eciwx, etc. */
187 goto bad_area;
188#endif /* CONFIG_6xx */
189#if defined(CONFIG_8xx)
190 /* The MPC8xx seems to always set 0x80000000, which is
191 * "undefined". Of those that can be set, this is the only
192 * one which seems bad.
193 */
194 if (error_code & 0x10000000)
195 /* Guarded storage error. */
196 goto bad_area;
197#endif /* CONFIG_8xx */
198
199 /* a write */
200 if (is_write) {
201 if (!(vma->vm_flags & VM_WRITE))
202 goto bad_area;
203#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
204 /* an exec - 4xx/Book-E allows for per-page execute permission */
205 } else if (TRAP(regs) == 0x400) {
206 pte_t *ptep;
207
208#if 0
209 /* It would be nice to actually enforce the VM execute
210 permission on CPUs which can do so, but far too
211 much stuff in userspace doesn't get the permissions
212 right, so we let any page be executed for now. */
213 if (! (vma->vm_flags & VM_EXEC))
214 goto bad_area;
215#endif
216
217 /* Since 4xx/Book-E supports per-page execute permission,
218 * we lazily flush dcache to icache. */
219 ptep = NULL;
220 if (get_pteptr(mm, address, &ptep) && pte_present(*ptep)) {
221 struct page *page = pte_page(*ptep);
222
223 if (! test_bit(PG_arch_1, &page->flags)) {
224 flush_dcache_icache_page(page);
225 set_bit(PG_arch_1, &page->flags);
226 }
227 pte_update(ptep, 0, _PAGE_HWEXEC);
228 _tlbie(address);
229 pte_unmap(ptep);
230 up_read(&mm->mmap_sem);
231 return 0;
232 }
233 if (ptep != NULL)
234 pte_unmap(ptep);
235#endif
236 /* a read */
237 } else {
238 /* protection fault */
239 if (error_code & 0x08000000)
240 goto bad_area;
241 if (!(vma->vm_flags & (VM_READ | VM_EXEC)))
242 goto bad_area;
243 }
244
245 /*
246 * If for any reason at all we couldn't handle the fault,
247 * make sure we exit gracefully rather than endlessly redo
248 * the fault.
249 */
250 survive:
251 switch (handle_mm_fault(mm, vma, address, is_write)) {
252 case VM_FAULT_MINOR:
253 current->min_flt++;
254 break;
255 case VM_FAULT_MAJOR:
256 current->maj_flt++;
257 break;
258 case VM_FAULT_SIGBUS:
259 goto do_sigbus;
260 case VM_FAULT_OOM:
261 goto out_of_memory;
262 default:
263 BUG();
264 }
265
266 up_read(&mm->mmap_sem);
267 /*
268 * keep track of tlb+htab misses that are good addrs but
269 * just need pte's created via handle_mm_fault()
270 * -- Cort
271 */
272 pte_misses++;
273 return 0;
274
275bad_area:
276 up_read(&mm->mmap_sem);
277 pte_errors++;
278
279 /* User mode accesses cause a SIGSEGV */
280 if (user_mode(regs)) {
281 info.si_signo = SIGSEGV;
282 info.si_errno = 0;
283 info.si_code = code;
284 info.si_addr = (void __user *) address;
285 force_sig_info(SIGSEGV, &info, current);
286 return 0;
287 }
288
289 return SIGSEGV;
290
291/*
292 * We ran out of memory, or some other thing happened to us that made
293 * us unable to handle the page fault gracefully.
294 */
295out_of_memory:
296 up_read(&mm->mmap_sem);
297 if (current->pid == 1) {
298 yield();
299 down_read(&mm->mmap_sem);
300 goto survive;
301 }
302 printk("VM: killing process %s\n", current->comm);
303 if (user_mode(regs))
304 do_exit(SIGKILL);
305 return SIGKILL;
306
307do_sigbus:
308 up_read(&mm->mmap_sem);
309 info.si_signo = SIGBUS;
310 info.si_errno = 0;
311 info.si_code = BUS_ADRERR;
312 info.si_addr = (void __user *)address;
313 force_sig_info (SIGBUS, &info, current);
314 if (!user_mode(regs))
315 return SIGBUS;
316 return 0;
317}
318
319/*
320 * bad_page_fault is called when we have a bad access from the kernel.
321 * It is called from the DSI and ISI handlers in head.S and from some
322 * of the procedures in traps.c.
323 */
324void
325bad_page_fault(struct pt_regs *regs, unsigned long address, int sig)
326{
327 const struct exception_table_entry *entry;
328
329 /* Are we prepared to handle this fault? */
330 if ((entry = search_exception_tables(regs->nip)) != NULL) {
331 regs->nip = entry->fixup;
332 return;
333 }
334
335 /* kernel has accessed a bad area */
336#if defined(CONFIG_XMON) || defined(CONFIG_KGDB)
337 if (debugger_kernel_faults)
338 debugger(regs);
339#endif
340 die("kernel access of bad area", regs, sig);
341}
342
343#ifdef CONFIG_8xx
344
345/* The pgtable.h claims some functions generically exist, but I
346 * can't find them......
347 */
348pte_t *va_to_pte(unsigned long address)
349{
350 pgd_t *dir;
351 pmd_t *pmd;
352 pte_t *pte;
353
354 if (address < TASK_SIZE)
355 return NULL;
356
357 dir = pgd_offset(&init_mm, address);
358 if (dir) {
359 pmd = pmd_offset(dir, address & PAGE_MASK);
360 if (pmd && pmd_present(*pmd)) {
361 pte = pte_offset_kernel(pmd, address & PAGE_MASK);
362 if (pte && pte_present(*pte))
363 return(pte);
364 }
365 }
366 return NULL;
367}
368
369unsigned long va_to_phys(unsigned long address)
370{
371 pte_t *pte;
372
373 pte = va_to_pte(address);
374 if (pte)
375 return(((unsigned long)(pte_val(*pte)) & PAGE_MASK) | (address & ~(PAGE_MASK)));
376 return (0);
377}
378
379void
380print_8xx_pte(struct mm_struct *mm, unsigned long addr)
381{
382 pgd_t * pgd;
383 pmd_t * pmd;
384 pte_t * pte;
385
386 printk(" pte @ 0x%8lx: ", addr);
387 pgd = pgd_offset(mm, addr & PAGE_MASK);
388 if (pgd) {
389 pmd = pmd_offset(pgd, addr & PAGE_MASK);
390 if (pmd && pmd_present(*pmd)) {
391 pte = pte_offset_kernel(pmd, addr & PAGE_MASK);
392 if (pte) {
393 printk(" (0x%08lx)->(0x%08lx)->0x%08lx\n",
394 (long)pgd, (long)pte, (long)pte_val(*pte));
395#define pp ((long)pte_val(*pte))
396 printk(" RPN: %05lx PP: %lx SPS: %lx SH: %lx "
397 "CI: %lx v: %lx\n",
398 pp>>12, /* rpn */
399 (pp>>10)&3, /* pp */
400 (pp>>3)&1, /* small */
401 (pp>>2)&1, /* shared */
402 (pp>>1)&1, /* cache inhibit */
403 pp&1 /* valid */
404 );
405#undef pp
406 }
407 else {
408 printk("no pte\n");
409 }
410 }
411 else {
412 printk("no pmd\n");
413 }
414 }
415 else {
416 printk("no pgd\n");
417 }
418}
419
420int
421get_8xx_pte(struct mm_struct *mm, unsigned long addr)
422{
423 pgd_t * pgd;
424 pmd_t * pmd;
425 pte_t * pte;
426 int retval = 0;
427
428 pgd = pgd_offset(mm, addr & PAGE_MASK);
429 if (pgd) {
430 pmd = pmd_offset(pgd, addr & PAGE_MASK);
431 if (pmd && pmd_present(*pmd)) {
432 pte = pte_offset_kernel(pmd, addr & PAGE_MASK);
433 if (pte) {
434 retval = (int)pte_val(*pte);
435 }
436 }
437 }
438 return(retval);
439}
440#endif /* CONFIG_8xx */
diff --git a/arch/ppc/mm/fsl_booke_mmu.c b/arch/ppc/mm/fsl_booke_mmu.c
new file mode 100644
index 000000000000..36233bdcdf8f
--- /dev/null
+++ b/arch/ppc/mm/fsl_booke_mmu.c
@@ -0,0 +1,236 @@
1/*
2 * Modifications by Kumar Gala (kumar.gala@freescale.com) to support
3 * E500 Book E processors.
4 *
5 * Copyright 2004 Freescale Semiconductor, Inc
6 *
7 * This file contains the routines for initializing the MMU
8 * on the 4xx series of chips.
9 * -- paulus
10 *
11 * Derived from arch/ppc/mm/init.c:
12 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
13 *
14 * Modifications by Paul Mackerras (PowerMac) (paulus@cs.anu.edu.au)
15 * and Cort Dougan (PReP) (cort@cs.nmt.edu)
16 * Copyright (C) 1996 Paul Mackerras
17 * Amiga/APUS changes by Jesper Skov (jskov@cygnus.co.uk).
18 *
19 * Derived from "arch/i386/mm/init.c"
20 * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds
21 *
22 * This program is free software; you can redistribute it and/or
23 * modify it under the terms of the GNU General Public License
24 * as published by the Free Software Foundation; either version
25 * 2 of the License, or (at your option) any later version.
26 *
27 */
28
29#include <linux/config.h>
30#include <linux/signal.h>
31#include <linux/sched.h>
32#include <linux/kernel.h>
33#include <linux/errno.h>
34#include <linux/string.h>
35#include <linux/types.h>
36#include <linux/ptrace.h>
37#include <linux/mman.h>
38#include <linux/mm.h>
39#include <linux/swap.h>
40#include <linux/stddef.h>
41#include <linux/vmalloc.h>
42#include <linux/init.h>
43#include <linux/delay.h>
44#include <linux/bootmem.h>
45#include <linux/highmem.h>
46
47#include <asm/pgalloc.h>
48#include <asm/prom.h>
49#include <asm/io.h>
50#include <asm/mmu_context.h>
51#include <asm/pgtable.h>
52#include <asm/mmu.h>
53#include <asm/uaccess.h>
54#include <asm/smp.h>
55#include <asm/bootx.h>
56#include <asm/machdep.h>
57#include <asm/setup.h>
58
59extern void loadcam_entry(unsigned int index);
60unsigned int tlbcam_index;
61unsigned int num_tlbcam_entries;
62static unsigned long __cam0, __cam1, __cam2;
63extern unsigned long total_lowmem;
64extern unsigned long __max_low_memory;
65#define MAX_LOW_MEM CONFIG_LOWMEM_SIZE
66
67struct tlbcam {
68 u32 MAS0;
69 u32 MAS1;
70 u32 MAS2;
71 u32 MAS3;
72 u32 MAS7;
73} TLBCAM[NUM_TLBCAMS];
74
75struct tlbcamrange {
76 unsigned long start;
77 unsigned long limit;
78 phys_addr_t phys;
79} tlbcam_addrs[NUM_TLBCAMS];
80
81extern unsigned int tlbcam_index;
82
83/*
84 * Return PA for this VA if it is mapped by a CAM, or 0
85 */
86unsigned long v_mapped_by_tlbcam(unsigned long va)
87{
88 int b;
89 for (b = 0; b < tlbcam_index; ++b)
90 if (va >= tlbcam_addrs[b].start && va < tlbcam_addrs[b].limit)
91 return tlbcam_addrs[b].phys + (va - tlbcam_addrs[b].start);
92 return 0;
93}
94
95/*
96 * Return VA for a given PA or 0 if not mapped
97 */
98unsigned long p_mapped_by_tlbcam(unsigned long pa)
99{
100 int b;
101 for (b = 0; b < tlbcam_index; ++b)
102 if (pa >= tlbcam_addrs[b].phys
103 && pa < (tlbcam_addrs[b].limit-tlbcam_addrs[b].start)
104 +tlbcam_addrs[b].phys)
105 return tlbcam_addrs[b].start+(pa-tlbcam_addrs[b].phys);
106 return 0;
107}
108
109/*
110 * Set up one of the I/D BAT (block address translation) register pairs.
111 * The parameters are not checked; in particular size must be a power
112 * of 4 between 4k and 256M.
113 */
114void settlbcam(int index, unsigned long virt, phys_addr_t phys,
115 unsigned int size, int flags, unsigned int pid)
116{
117 unsigned int tsize, lz;
118
119 asm ("cntlzw %0,%1" : "=r" (lz) : "r" (size));
120 tsize = (21 - lz) / 2;
121
122#ifdef CONFIG_SMP
123 if ((flags & _PAGE_NO_CACHE) == 0)
124 flags |= _PAGE_COHERENT;
125#endif
126
127 TLBCAM[index].MAS0 = MAS0_TLBSEL(1) | MAS0_ESEL(index);
128 TLBCAM[index].MAS1 = MAS1_VALID | MAS1_IPROT | MAS1_TSIZE(tsize) | MAS1_TID(pid);
129 TLBCAM[index].MAS2 = virt & PAGE_MASK;
130
131 TLBCAM[index].MAS2 |= (flags & _PAGE_WRITETHRU) ? MAS2_W : 0;
132 TLBCAM[index].MAS2 |= (flags & _PAGE_NO_CACHE) ? MAS2_I : 0;
133 TLBCAM[index].MAS2 |= (flags & _PAGE_COHERENT) ? MAS2_M : 0;
134 TLBCAM[index].MAS2 |= (flags & _PAGE_GUARDED) ? MAS2_G : 0;
135 TLBCAM[index].MAS2 |= (flags & _PAGE_ENDIAN) ? MAS2_E : 0;
136
137 TLBCAM[index].MAS3 = (phys & PAGE_MASK) | MAS3_SX | MAS3_SR;
138 TLBCAM[index].MAS3 |= ((flags & _PAGE_RW) ? MAS3_SW : 0);
139
140#ifndef CONFIG_KGDB /* want user access for breakpoints */
141 if (flags & _PAGE_USER) {
142 TLBCAM[index].MAS3 |= MAS3_UX | MAS3_UR;
143 TLBCAM[index].MAS3 |= ((flags & _PAGE_RW) ? MAS3_UW : 0);
144 }
145#else
146 TLBCAM[index].MAS3 |= MAS3_UX | MAS3_UR;
147 TLBCAM[index].MAS3 |= ((flags & _PAGE_RW) ? MAS3_UW : 0);
148#endif
149
150 tlbcam_addrs[index].start = virt;
151 tlbcam_addrs[index].limit = virt + size - 1;
152 tlbcam_addrs[index].phys = phys;
153
154 loadcam_entry(index);
155}
156
157void invalidate_tlbcam_entry(int index)
158{
159 TLBCAM[index].MAS0 = MAS0_TLBSEL(1) | MAS0_ESEL(index);
160 TLBCAM[index].MAS1 = ~MAS1_VALID;
161
162 loadcam_entry(index);
163}
164
165void __init cam_mapin_ram(unsigned long cam0, unsigned long cam1,
166 unsigned long cam2)
167{
168 settlbcam(0, KERNELBASE, PPC_MEMSTART, cam0, _PAGE_KERNEL, 0);
169 tlbcam_index++;
170 if (cam1) {
171 tlbcam_index++;
172 settlbcam(1, KERNELBASE+cam0, PPC_MEMSTART+cam0, cam1, _PAGE_KERNEL, 0);
173 }
174 if (cam2) {
175 tlbcam_index++;
176 settlbcam(2, KERNELBASE+cam0+cam1, PPC_MEMSTART+cam0+cam1, cam2, _PAGE_KERNEL, 0);
177 }
178}
179
180/*
181 * MMU_init_hw does the chip-specific initialization of the MMU hardware.
182 */
183void __init MMU_init_hw(void)
184{
185 flush_instruction_cache();
186}
187
188unsigned long __init mmu_mapin_ram(void)
189{
190 cam_mapin_ram(__cam0, __cam1, __cam2);
191
192 return __cam0 + __cam1 + __cam2;
193}
194
195
196void __init
197adjust_total_lowmem(void)
198{
199 unsigned long max_low_mem = MAX_LOW_MEM;
200 unsigned long cam_max = 0x10000000;
201 unsigned long ram;
202
203 /* adjust CAM size to max_low_mem */
204 if (max_low_mem < cam_max)
205 cam_max = max_low_mem;
206
207 /* adjust lowmem size to max_low_mem */
208 if (max_low_mem < total_lowmem)
209 ram = max_low_mem;
210 else
211 ram = total_lowmem;
212
213 /* Calculate CAM values */
214 __cam0 = 1UL << 2 * (__ilog2(ram) / 2);
215 if (__cam0 > cam_max)
216 __cam0 = cam_max;
217 ram -= __cam0;
218 if (ram) {
219 __cam1 = 1UL << 2 * (__ilog2(ram) / 2);
220 if (__cam1 > cam_max)
221 __cam1 = cam_max;
222 ram -= __cam1;
223 }
224 if (ram) {
225 __cam2 = 1UL << 2 * (__ilog2(ram) / 2);
226 if (__cam2 > cam_max)
227 __cam2 = cam_max;
228 ram -= __cam2;
229 }
230
231 printk(KERN_INFO "Memory CAM mapping: CAM0=%ldMb, CAM1=%ldMb,"
232 " CAM2=%ldMb residual: %ldMb\n",
233 __cam0 >> 20, __cam1 >> 20, __cam2 >> 20,
234 (total_lowmem - __cam0 - __cam1 - __cam2) >> 20);
235 __max_low_memory = max_low_mem = __cam0 + __cam1 + __cam2;
236}
diff --git a/arch/ppc/mm/hashtable.S b/arch/ppc/mm/hashtable.S
new file mode 100644
index 000000000000..ab83132a7ed0
--- /dev/null
+++ b/arch/ppc/mm/hashtable.S
@@ -0,0 +1,642 @@
1/*
2 * arch/ppc/kernel/hashtable.S
3 *
4 * $Id: hashtable.S,v 1.6 1999/10/08 01:56:15 paulus Exp $
5 *
6 * PowerPC version
7 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
8 * Rewritten by Cort Dougan (cort@cs.nmt.edu) for PReP
9 * Copyright (C) 1996 Cort Dougan <cort@cs.nmt.edu>
10 * Adapted for Power Macintosh by Paul Mackerras.
11 * Low-level exception handlers and MMU support
12 * rewritten by Paul Mackerras.
13 * Copyright (C) 1996 Paul Mackerras.
14 *
15 * This file contains low-level assembler routines for managing
16 * the PowerPC MMU hash table. (PPC 8xx processors don't use a
17 * hash table, so this file is not used on them.)
18 *
19 * This program is free software; you can redistribute it and/or
20 * modify it under the terms of the GNU General Public License
21 * as published by the Free Software Foundation; either version
22 * 2 of the License, or (at your option) any later version.
23 *
24 */
25
26#include <linux/config.h>
27#include <asm/processor.h>
28#include <asm/page.h>
29#include <asm/pgtable.h>
30#include <asm/cputable.h>
31#include <asm/ppc_asm.h>
32#include <asm/thread_info.h>
33#include <asm/offsets.h>
34
35#ifdef CONFIG_SMP
36 .comm mmu_hash_lock,4
37#endif /* CONFIG_SMP */
38
39/*
40 * Sync CPUs with hash_page taking & releasing the hash
41 * table lock
42 */
43#ifdef CONFIG_SMP
44 .text
45_GLOBAL(hash_page_sync)
46 lis r8,mmu_hash_lock@h
47 ori r8,r8,mmu_hash_lock@l
48 lis r0,0x0fff
49 b 10f
5011: lwz r6,0(r8)
51 cmpwi 0,r6,0
52 bne 11b
5310: lwarx r6,0,r8
54 cmpwi 0,r6,0
55 bne- 11b
56 stwcx. r0,0,r8
57 bne- 10b
58 isync
59 eieio
60 li r0,0
61 stw r0,0(r8)
62 blr
63#endif
64
65/*
66 * Load a PTE into the hash table, if possible.
67 * The address is in r4, and r3 contains an access flag:
68 * _PAGE_RW (0x400) if a write.
69 * r9 contains the SRR1 value, from which we use the MSR_PR bit.
70 * SPRG3 contains the physical address of the current task's thread.
71 *
72 * Returns to the caller if the access is illegal or there is no
73 * mapping for the address. Otherwise it places an appropriate PTE
74 * in the hash table and returns from the exception.
75 * Uses r0, r3 - r8, ctr, lr.
76 */
77 .text
78_GLOBAL(hash_page)
79#ifdef CONFIG_PPC64BRIDGE
80 mfmsr r0
81 clrldi r0,r0,1 /* make sure it's in 32-bit mode */
82 MTMSRD(r0)
83 isync
84#endif
85 tophys(r7,0) /* gets -KERNELBASE into r7 */
86#ifdef CONFIG_SMP
87 addis r8,r7,mmu_hash_lock@h
88 ori r8,r8,mmu_hash_lock@l
89 lis r0,0x0fff
90 b 10f
9111: lwz r6,0(r8)
92 cmpwi 0,r6,0
93 bne 11b
9410: lwarx r6,0,r8
95 cmpwi 0,r6,0
96 bne- 11b
97 stwcx. r0,0,r8
98 bne- 10b
99 isync
100#endif
101 /* Get PTE (linux-style) and check access */
102 lis r0,KERNELBASE@h /* check if kernel address */
103 cmplw 0,r4,r0
104 mfspr r8,SPRN_SPRG3 /* current task's THREAD (phys) */
105 ori r3,r3,_PAGE_USER|_PAGE_PRESENT /* test low addresses as user */
106 lwz r5,PGDIR(r8) /* virt page-table root */
107 blt+ 112f /* assume user more likely */
108 lis r5,swapper_pg_dir@ha /* if kernel address, use */
109 addi r5,r5,swapper_pg_dir@l /* kernel page table */
110 rlwimi r3,r9,32-12,29,29 /* MSR_PR -> _PAGE_USER */
111112: add r5,r5,r7 /* convert to phys addr */
112 rlwimi r5,r4,12,20,29 /* insert top 10 bits of address */
113 lwz r8,0(r5) /* get pmd entry */
114 rlwinm. r8,r8,0,0,19 /* extract address of pte page */
115#ifdef CONFIG_SMP
116 beq- hash_page_out /* return if no mapping */
117#else
118 /* XXX it seems like the 601 will give a machine fault on the
119 rfi if its alignment is wrong (bottom 4 bits of address are
120 8 or 0xc) and we have had a not-taken conditional branch
121 to the address following the rfi. */
122 beqlr-
123#endif
124 rlwimi r8,r4,22,20,29 /* insert next 10 bits of address */
125 rlwinm r0,r3,32-3,24,24 /* _PAGE_RW access -> _PAGE_DIRTY */
126 ori r0,r0,_PAGE_ACCESSED|_PAGE_HASHPTE
127
128 /*
129 * Update the linux PTE atomically. We do the lwarx up-front
130 * because almost always, there won't be a permission violation
131 * and there won't already be an HPTE, and thus we will have
132 * to update the PTE to set _PAGE_HASHPTE. -- paulus.
133 */
134retry:
135 lwarx r6,0,r8 /* get linux-style pte */
136 andc. r5,r3,r6 /* check access & ~permission */
137#ifdef CONFIG_SMP
138 bne- hash_page_out /* return if access not permitted */
139#else
140 bnelr-
141#endif
142 or r5,r0,r6 /* set accessed/dirty bits */
143 stwcx. r5,0,r8 /* attempt to update PTE */
144 bne- retry /* retry if someone got there first */
145
146 mfsrin r3,r4 /* get segment reg for segment */
147 mfctr r0
148 stw r0,_CTR(r11)
149 bl create_hpte /* add the hash table entry */
150
151/*
152 * htab_reloads counts the number of times we have to fault an
153 * HPTE into the hash table. This should only happen after a
154 * fork (because fork does a flush_tlb_mm) or a vmalloc or ioremap.
155 * Where a page is faulted into a process's address space,
156 * update_mmu_cache gets called to put the HPTE into the hash table
157 * and those are counted as preloads rather than reloads.
158 */
159 addis r8,r7,htab_reloads@ha
160 lwz r3,htab_reloads@l(r8)
161 addi r3,r3,1
162 stw r3,htab_reloads@l(r8)
163
164#ifdef CONFIG_SMP
165 eieio
166 addis r8,r7,mmu_hash_lock@ha
167 li r0,0
168 stw r0,mmu_hash_lock@l(r8)
169#endif
170
171 /* Return from the exception */
172 lwz r5,_CTR(r11)
173 mtctr r5
174 lwz r0,GPR0(r11)
175 lwz r7,GPR7(r11)
176 lwz r8,GPR8(r11)
177 b fast_exception_return
178
179#ifdef CONFIG_SMP
180hash_page_out:
181 eieio
182 addis r8,r7,mmu_hash_lock@ha
183 li r0,0
184 stw r0,mmu_hash_lock@l(r8)
185 blr
186#endif /* CONFIG_SMP */
187
188/*
189 * Add an entry for a particular page to the hash table.
190 *
191 * add_hash_page(unsigned context, unsigned long va, unsigned long pmdval)
192 *
193 * We assume any necessary modifications to the pte (e.g. setting
194 * the accessed bit) have already been done and that there is actually
195 * a hash table in use (i.e. we're not on a 603).
196 */
197_GLOBAL(add_hash_page)
198 mflr r0
199 stw r0,4(r1)
200
201 /* Convert context and va to VSID */
202 mulli r3,r3,897*16 /* multiply context by context skew */
203 rlwinm r0,r4,4,28,31 /* get ESID (top 4 bits of va) */
204 mulli r0,r0,0x111 /* multiply by ESID skew */
205 add r3,r3,r0 /* note create_hpte trims to 24 bits */
206
207#ifdef CONFIG_SMP
208 rlwinm r8,r1,0,0,18 /* use cpu number to make tag */
209 lwz r8,TI_CPU(r8) /* to go in mmu_hash_lock */
210 oris r8,r8,12
211#endif /* CONFIG_SMP */
212
213 /*
214 * We disable interrupts here, even on UP, because we don't
215 * want to race with hash_page, and because we want the
216 * _PAGE_HASHPTE bit to be a reliable indication of whether
217 * the HPTE exists (or at least whether one did once).
218 * We also turn off the MMU for data accesses so that we
219 * we can't take a hash table miss (assuming the code is
220 * covered by a BAT). -- paulus
221 */
222 mfmsr r10
223 SYNC
224 rlwinm r0,r10,0,17,15 /* clear bit 16 (MSR_EE) */
225 rlwinm r0,r0,0,28,26 /* clear MSR_DR */
226 mtmsr r0
227 SYNC_601
228 isync
229
230 tophys(r7,0)
231
232#ifdef CONFIG_SMP
233 addis r9,r7,mmu_hash_lock@ha
234 addi r9,r9,mmu_hash_lock@l
23510: lwarx r0,0,r9 /* take the mmu_hash_lock */
236 cmpi 0,r0,0
237 bne- 11f
238 stwcx. r8,0,r9
239 beq+ 12f
24011: lwz r0,0(r9)
241 cmpi 0,r0,0
242 beq 10b
243 b 11b
24412: isync
245#endif
246
247 /*
248 * Fetch the linux pte and test and set _PAGE_HASHPTE atomically.
249 * If _PAGE_HASHPTE was already set, we don't replace the existing
250 * HPTE, so we just unlock and return.
251 */
252 mr r8,r5
253 rlwimi r8,r4,22,20,29
2541: lwarx r6,0,r8
255 andi. r0,r6,_PAGE_HASHPTE
256 bne 9f /* if HASHPTE already set, done */
257 ori r5,r6,_PAGE_HASHPTE
258 stwcx. r5,0,r8
259 bne- 1b
260
261 bl create_hpte
262
263 addis r8,r7,htab_preloads@ha
264 lwz r3,htab_preloads@l(r8)
265 addi r3,r3,1
266 stw r3,htab_preloads@l(r8)
267
2689:
269#ifdef CONFIG_SMP
270 eieio
271 li r0,0
272 stw r0,0(r9) /* clear mmu_hash_lock */
273#endif
274
275 /* reenable interrupts and DR */
276 mtmsr r10
277 SYNC_601
278 isync
279
280 lwz r0,4(r1)
281 mtlr r0
282 blr
283
284/*
285 * This routine adds a hardware PTE to the hash table.
286 * It is designed to be called with the MMU either on or off.
287 * r3 contains the VSID, r4 contains the virtual address,
288 * r5 contains the linux PTE, r6 contains the old value of the
289 * linux PTE (before setting _PAGE_HASHPTE) and r7 contains the
290 * offset to be added to addresses (0 if the MMU is on,
291 * -KERNELBASE if it is off).
292 * On SMP, the caller should have the mmu_hash_lock held.
293 * We assume that the caller has (or will) set the _PAGE_HASHPTE
294 * bit in the linux PTE in memory. The value passed in r6 should
295 * be the old linux PTE value; if it doesn't have _PAGE_HASHPTE set
296 * this routine will skip the search for an existing HPTE.
297 * This procedure modifies r0, r3 - r6, r8, cr0.
298 * -- paulus.
299 *
300 * For speed, 4 of the instructions get patched once the size and
301 * physical address of the hash table are known. These definitions
302 * of Hash_base and Hash_bits below are just an example.
303 */
304Hash_base = 0xc0180000
305Hash_bits = 12 /* e.g. 256kB hash table */
306Hash_msk = (((1 << Hash_bits) - 1) * 64)
307
308#ifndef CONFIG_PPC64BRIDGE
309/* defines for the PTE format for 32-bit PPCs */
310#define PTE_SIZE 8
311#define PTEG_SIZE 64
312#define LG_PTEG_SIZE 6
313#define LDPTEu lwzu
314#define STPTE stw
315#define CMPPTE cmpw
316#define PTE_H 0x40
317#define PTE_V 0x80000000
318#define TST_V(r) rlwinm. r,r,0,0,0
319#define SET_V(r) oris r,r,PTE_V@h
320#define CLR_V(r,t) rlwinm r,r,0,1,31
321
322#else
323/* defines for the PTE format for 64-bit PPCs */
324#define PTE_SIZE 16
325#define PTEG_SIZE 128
326#define LG_PTEG_SIZE 7
327#define LDPTEu ldu
328#define STPTE std
329#define CMPPTE cmpd
330#define PTE_H 2
331#define PTE_V 1
332#define TST_V(r) andi. r,r,PTE_V
333#define SET_V(r) ori r,r,PTE_V
334#define CLR_V(r,t) li t,PTE_V; andc r,r,t
335#endif /* CONFIG_PPC64BRIDGE */
336
337#define HASH_LEFT 31-(LG_PTEG_SIZE+Hash_bits-1)
338#define HASH_RIGHT 31-LG_PTEG_SIZE
339
340_GLOBAL(create_hpte)
341 /* Convert linux-style PTE (r5) to low word of PPC-style PTE (r8) */
342 rlwinm r8,r5,32-10,31,31 /* _PAGE_RW -> PP lsb */
343 rlwinm r0,r5,32-7,31,31 /* _PAGE_DIRTY -> PP lsb */
344 and r8,r8,r0 /* writable if _RW & _DIRTY */
345 rlwimi r5,r5,32-1,30,30 /* _PAGE_USER -> PP msb */
346 rlwimi r5,r5,32-2,31,31 /* _PAGE_USER -> PP lsb */
347 ori r8,r8,0xe14 /* clear out reserved bits and M */
348 andc r8,r5,r8 /* PP = user? (rw&dirty? 2: 3): 0 */
349BEGIN_FTR_SECTION
350 ori r8,r8,_PAGE_COHERENT /* set M (coherence required) */
351END_FTR_SECTION_IFSET(CPU_FTR_NEED_COHERENT)
352
353 /* Construct the high word of the PPC-style PTE (r5) */
354#ifndef CONFIG_PPC64BRIDGE
355 rlwinm r5,r3,7,1,24 /* put VSID in 0x7fffff80 bits */
356 rlwimi r5,r4,10,26,31 /* put in API (abbrev page index) */
357#else /* CONFIG_PPC64BRIDGE */
358 clrlwi r3,r3,8 /* reduce vsid to 24 bits */
359 sldi r5,r3,12 /* shift vsid into position */
360 rlwimi r5,r4,16,20,24 /* put in API (abbrev page index) */
361#endif /* CONFIG_PPC64BRIDGE */
362 SET_V(r5) /* set V (valid) bit */
363
364 /* Get the address of the primary PTE group in the hash table (r3) */
365_GLOBAL(hash_page_patch_A)
366 addis r0,r7,Hash_base@h /* base address of hash table */
367 rlwimi r0,r3,LG_PTEG_SIZE,HASH_LEFT,HASH_RIGHT /* VSID -> hash */
368 rlwinm r3,r4,20+LG_PTEG_SIZE,HASH_LEFT,HASH_RIGHT /* PI -> hash */
369 xor r3,r3,r0 /* make primary hash */
370 li r0,8 /* PTEs/group */
371
372 /*
373 * Test the _PAGE_HASHPTE bit in the old linux PTE, and skip the search
374 * if it is clear, meaning that the HPTE isn't there already...
375 */
376 andi. r6,r6,_PAGE_HASHPTE
377 beq+ 10f /* no PTE: go look for an empty slot */
378 tlbie r4
379
380 addis r4,r7,htab_hash_searches@ha
381 lwz r6,htab_hash_searches@l(r4)
382 addi r6,r6,1 /* count how many searches we do */
383 stw r6,htab_hash_searches@l(r4)
384
385 /* Search the primary PTEG for a PTE whose 1st (d)word matches r5 */
386 mtctr r0
387 addi r4,r3,-PTE_SIZE
3881: LDPTEu r6,PTE_SIZE(r4) /* get next PTE */
389 CMPPTE 0,r6,r5
390 bdnzf 2,1b /* loop while ctr != 0 && !cr0.eq */
391 beq+ found_slot
392
393 /* Search the secondary PTEG for a matching PTE */
394 ori r5,r5,PTE_H /* set H (secondary hash) bit */
395_GLOBAL(hash_page_patch_B)
396 xoris r4,r3,Hash_msk>>16 /* compute secondary hash */
397 xori r4,r4,(-PTEG_SIZE & 0xffff)
398 addi r4,r4,-PTE_SIZE
399 mtctr r0
4002: LDPTEu r6,PTE_SIZE(r4)
401 CMPPTE 0,r6,r5
402 bdnzf 2,2b
403 beq+ found_slot
404 xori r5,r5,PTE_H /* clear H bit again */
405
406 /* Search the primary PTEG for an empty slot */
40710: mtctr r0
408 addi r4,r3,-PTE_SIZE /* search primary PTEG */
4091: LDPTEu r6,PTE_SIZE(r4) /* get next PTE */
410 TST_V(r6) /* test valid bit */
411 bdnzf 2,1b /* loop while ctr != 0 && !cr0.eq */
412 beq+ found_empty
413
414 /* update counter of times that the primary PTEG is full */
415 addis r4,r7,primary_pteg_full@ha
416 lwz r6,primary_pteg_full@l(r4)
417 addi r6,r6,1
418 stw r6,primary_pteg_full@l(r4)
419
420 /* Search the secondary PTEG for an empty slot */
421 ori r5,r5,PTE_H /* set H (secondary hash) bit */
422_GLOBAL(hash_page_patch_C)
423 xoris r4,r3,Hash_msk>>16 /* compute secondary hash */
424 xori r4,r4,(-PTEG_SIZE & 0xffff)
425 addi r4,r4,-PTE_SIZE
426 mtctr r0
4272: LDPTEu r6,PTE_SIZE(r4)
428 TST_V(r6)
429 bdnzf 2,2b
430 beq+ found_empty
431 xori r5,r5,PTE_H /* clear H bit again */
432
433 /*
434 * Choose an arbitrary slot in the primary PTEG to overwrite.
435 * Since both the primary and secondary PTEGs are full, and we
436 * have no information that the PTEs in the primary PTEG are
437 * more important or useful than those in the secondary PTEG,
438 * and we know there is a definite (although small) speed
439 * advantage to putting the PTE in the primary PTEG, we always
440 * put the PTE in the primary PTEG.
441 */
442 addis r4,r7,next_slot@ha
443 lwz r6,next_slot@l(r4)
444 addi r6,r6,PTE_SIZE
445 andi. r6,r6,7*PTE_SIZE
446 stw r6,next_slot@l(r4)
447 add r4,r3,r6
448
449 /* update counter of evicted pages */
450 addis r6,r7,htab_evicts@ha
451 lwz r3,htab_evicts@l(r6)
452 addi r3,r3,1
453 stw r3,htab_evicts@l(r6)
454
455#ifndef CONFIG_SMP
456 /* Store PTE in PTEG */
457found_empty:
458 STPTE r5,0(r4)
459found_slot:
460 STPTE r8,PTE_SIZE/2(r4)
461
462#else /* CONFIG_SMP */
463/*
464 * Between the tlbie above and updating the hash table entry below,
465 * another CPU could read the hash table entry and put it in its TLB.
466 * There are 3 cases:
467 * 1. using an empty slot
468 * 2. updating an earlier entry to change permissions (i.e. enable write)
469 * 3. taking over the PTE for an unrelated address
470 *
471 * In each case it doesn't really matter if the other CPUs have the old
472 * PTE in their TLB. So we don't need to bother with another tlbie here,
473 * which is convenient as we've overwritten the register that had the
474 * address. :-) The tlbie above is mainly to make sure that this CPU comes
475 * and gets the new PTE from the hash table.
476 *
477 * We do however have to make sure that the PTE is never in an invalid
478 * state with the V bit set.
479 */
480found_empty:
481found_slot:
482 CLR_V(r5,r0) /* clear V (valid) bit in PTE */
483 STPTE r5,0(r4)
484 sync
485 TLBSYNC
486 STPTE r8,PTE_SIZE/2(r4) /* put in correct RPN, WIMG, PP bits */
487 sync
488 SET_V(r5)
489 STPTE r5,0(r4) /* finally set V bit in PTE */
490#endif /* CONFIG_SMP */
491
492 sync /* make sure pte updates get to memory */
493 blr
494
495 .comm next_slot,4
496 .comm primary_pteg_full,4
497 .comm htab_hash_searches,4
498
499/*
500 * Flush the entry for a particular page from the hash table.
501 *
502 * flush_hash_pages(unsigned context, unsigned long va, unsigned long pmdval,
503 * int count)
504 *
505 * We assume that there is a hash table in use (Hash != 0).
506 */
507_GLOBAL(flush_hash_pages)
508 tophys(r7,0)
509
510 /*
511 * We disable interrupts here, even on UP, because we want
512 * the _PAGE_HASHPTE bit to be a reliable indication of
513 * whether the HPTE exists (or at least whether one did once).
514 * We also turn off the MMU for data accesses so that we
515 * we can't take a hash table miss (assuming the code is
516 * covered by a BAT). -- paulus
517 */
518 mfmsr r10
519 SYNC
520 rlwinm r0,r10,0,17,15 /* clear bit 16 (MSR_EE) */
521 rlwinm r0,r0,0,28,26 /* clear MSR_DR */
522 mtmsr r0
523 SYNC_601
524 isync
525
526 /* First find a PTE in the range that has _PAGE_HASHPTE set */
527 rlwimi r5,r4,22,20,29
5281: lwz r0,0(r5)
529 cmpwi cr1,r6,1
530 andi. r0,r0,_PAGE_HASHPTE
531 bne 2f
532 ble cr1,19f
533 addi r4,r4,0x1000
534 addi r5,r5,4
535 addi r6,r6,-1
536 b 1b
537
538 /* Convert context and va to VSID */
5392: mulli r3,r3,897*16 /* multiply context by context skew */
540 rlwinm r0,r4,4,28,31 /* get ESID (top 4 bits of va) */
541 mulli r0,r0,0x111 /* multiply by ESID skew */
542 add r3,r3,r0 /* note code below trims to 24 bits */
543
544 /* Construct the high word of the PPC-style PTE (r11) */
545#ifndef CONFIG_PPC64BRIDGE
546 rlwinm r11,r3,7,1,24 /* put VSID in 0x7fffff80 bits */
547 rlwimi r11,r4,10,26,31 /* put in API (abbrev page index) */
548#else /* CONFIG_PPC64BRIDGE */
549 clrlwi r3,r3,8 /* reduce vsid to 24 bits */
550 sldi r11,r3,12 /* shift vsid into position */
551 rlwimi r11,r4,16,20,24 /* put in API (abbrev page index) */
552#endif /* CONFIG_PPC64BRIDGE */
553 SET_V(r11) /* set V (valid) bit */
554
555#ifdef CONFIG_SMP
556 addis r9,r7,mmu_hash_lock@ha
557 addi r9,r9,mmu_hash_lock@l
558 rlwinm r8,r1,0,0,18
559 add r8,r8,r7
560 lwz r8,TI_CPU(r8)
561 oris r8,r8,9
56210: lwarx r0,0,r9
563 cmpi 0,r0,0
564 bne- 11f
565 stwcx. r8,0,r9
566 beq+ 12f
56711: lwz r0,0(r9)
568 cmpi 0,r0,0
569 beq 10b
570 b 11b
57112: isync
572#endif
573
574 /*
575 * Check the _PAGE_HASHPTE bit in the linux PTE. If it is
576 * already clear, we're done (for this pte). If not,
577 * clear it (atomically) and proceed. -- paulus.
578 */
57933: lwarx r8,0,r5 /* fetch the pte */
580 andi. r0,r8,_PAGE_HASHPTE
581 beq 8f /* done if HASHPTE is already clear */
582 rlwinm r8,r8,0,31,29 /* clear HASHPTE bit */
583 stwcx. r8,0,r5 /* update the pte */
584 bne- 33b
585
586 /* Get the address of the primary PTE group in the hash table (r3) */
587_GLOBAL(flush_hash_patch_A)
588 addis r8,r7,Hash_base@h /* base address of hash table */
589 rlwimi r8,r3,LG_PTEG_SIZE,HASH_LEFT,HASH_RIGHT /* VSID -> hash */
590 rlwinm r0,r4,20+LG_PTEG_SIZE,HASH_LEFT,HASH_RIGHT /* PI -> hash */
591 xor r8,r0,r8 /* make primary hash */
592
593 /* Search the primary PTEG for a PTE whose 1st (d)word matches r5 */
594 li r0,8 /* PTEs/group */
595 mtctr r0
596 addi r12,r8,-PTE_SIZE
5971: LDPTEu r0,PTE_SIZE(r12) /* get next PTE */
598 CMPPTE 0,r0,r11
599 bdnzf 2,1b /* loop while ctr != 0 && !cr0.eq */
600 beq+ 3f
601
602 /* Search the secondary PTEG for a matching PTE */
603 ori r11,r11,PTE_H /* set H (secondary hash) bit */
604 li r0,8 /* PTEs/group */
605_GLOBAL(flush_hash_patch_B)
606 xoris r12,r8,Hash_msk>>16 /* compute secondary hash */
607 xori r12,r12,(-PTEG_SIZE & 0xffff)
608 addi r12,r12,-PTE_SIZE
609 mtctr r0
6102: LDPTEu r0,PTE_SIZE(r12)
611 CMPPTE 0,r0,r11
612 bdnzf 2,2b
613 xori r11,r11,PTE_H /* clear H again */
614 bne- 4f /* should rarely fail to find it */
615
6163: li r0,0
617 STPTE r0,0(r12) /* invalidate entry */
6184: sync
619 tlbie r4 /* in hw tlb too */
620 sync
621
6228: ble cr1,9f /* if all ptes checked */
62381: addi r6,r6,-1
624 addi r5,r5,4 /* advance to next pte */
625 addi r4,r4,0x1000
626 lwz r0,0(r5) /* check next pte */
627 cmpwi cr1,r6,1
628 andi. r0,r0,_PAGE_HASHPTE
629 bne 33b
630 bgt cr1,81b
631
6329:
633#ifdef CONFIG_SMP
634 TLBSYNC
635 li r0,0
636 stw r0,0(r9) /* clear mmu_hash_lock */
637#endif
638
63919: mtmsr r10
640 SYNC_601
641 isync
642 blr
diff --git a/arch/ppc/mm/init.c b/arch/ppc/mm/init.c
new file mode 100644
index 000000000000..be02a7fec2b7
--- /dev/null
+++ b/arch/ppc/mm/init.c
@@ -0,0 +1,667 @@
1/*
2 * PowerPC version
3 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
4 *
5 * Modifications by Paul Mackerras (PowerMac) (paulus@cs.anu.edu.au)
6 * and Cort Dougan (PReP) (cort@cs.nmt.edu)
7 * Copyright (C) 1996 Paul Mackerras
8 * Amiga/APUS changes by Jesper Skov (jskov@cygnus.co.uk).
9 * PPC44x/36-bit changes by Matt Porter (mporter@mvista.com)
10 *
11 * Derived from "arch/i386/mm/init.c"
12 * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds
13 *
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version
17 * 2 of the License, or (at your option) any later version.
18 *
19 */
20
21#include <linux/config.h>
22#include <linux/module.h>
23#include <linux/sched.h>
24#include <linux/kernel.h>
25#include <linux/errno.h>
26#include <linux/string.h>
27#include <linux/types.h>
28#include <linux/mm.h>
29#include <linux/stddef.h>
30#include <linux/init.h>
31#include <linux/bootmem.h>
32#include <linux/highmem.h>
33#include <linux/initrd.h>
34#include <linux/pagemap.h>
35
36#include <asm/pgalloc.h>
37#include <asm/prom.h>
38#include <asm/io.h>
39#include <asm/mmu_context.h>
40#include <asm/pgtable.h>
41#include <asm/mmu.h>
42#include <asm/smp.h>
43#include <asm/machdep.h>
44#include <asm/btext.h>
45#include <asm/tlb.h>
46#include <asm/bootinfo.h>
47
48#include "mem_pieces.h"
49#include "mmu_decl.h"
50
51#if defined(CONFIG_KERNEL_START_BOOL) || defined(CONFIG_LOWMEM_SIZE_BOOL)
52/* The ammount of lowmem must be within 0xF0000000 - KERNELBASE. */
53#if (CONFIG_LOWMEM_SIZE > (0xF0000000 - KERNELBASE))
54#error "You must adjust CONFIG_LOWMEM_SIZE or CONFIG_START_KERNEL"
55#endif
56#endif
57#define MAX_LOW_MEM CONFIG_LOWMEM_SIZE
58
59DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
60
61unsigned long total_memory;
62unsigned long total_lowmem;
63
64unsigned long ppc_memstart;
65unsigned long ppc_memoffset = PAGE_OFFSET;
66
67int mem_init_done;
68int init_bootmem_done;
69int boot_mapsize;
70#ifdef CONFIG_PPC_PMAC
71unsigned long agp_special_page;
72#endif
73
74extern char _end[];
75extern char etext[], _stext[];
76extern char __init_begin, __init_end;
77extern char __prep_begin, __prep_end;
78extern char __chrp_begin, __chrp_end;
79extern char __pmac_begin, __pmac_end;
80extern char __openfirmware_begin, __openfirmware_end;
81
82#ifdef CONFIG_HIGHMEM
83pte_t *kmap_pte;
84pgprot_t kmap_prot;
85
86EXPORT_SYMBOL(kmap_prot);
87EXPORT_SYMBOL(kmap_pte);
88#endif
89
90void MMU_init(void);
91void set_phys_avail(unsigned long total_ram);
92
93/* XXX should be in current.h -- paulus */
94extern struct task_struct *current_set[NR_CPUS];
95
96char *klimit = _end;
97struct mem_pieces phys_avail;
98
99extern char *sysmap;
100extern unsigned long sysmap_size;
101
102/*
103 * this tells the system to map all of ram with the segregs
104 * (i.e. page tables) instead of the bats.
105 * -- Cort
106 */
107int __map_without_bats;
108int __map_without_ltlbs;
109
110/* max amount of RAM to use */
111unsigned long __max_memory;
112/* max amount of low RAM to map in */
113unsigned long __max_low_memory = MAX_LOW_MEM;
114
115void show_mem(void)
116{
117 int i,free = 0,total = 0,reserved = 0;
118 int shared = 0, cached = 0;
119 int highmem = 0;
120
121 printk("Mem-info:\n");
122 show_free_areas();
123 printk("Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10));
124 i = max_mapnr;
125 while (i-- > 0) {
126 total++;
127 if (PageHighMem(mem_map+i))
128 highmem++;
129 if (PageReserved(mem_map+i))
130 reserved++;
131 else if (PageSwapCache(mem_map+i))
132 cached++;
133 else if (!page_count(mem_map+i))
134 free++;
135 else
136 shared += page_count(mem_map+i) - 1;
137 }
138 printk("%d pages of RAM\n",total);
139 printk("%d pages of HIGHMEM\n", highmem);
140 printk("%d free pages\n",free);
141 printk("%d reserved pages\n",reserved);
142 printk("%d pages shared\n",shared);
143 printk("%d pages swap cached\n",cached);
144}
145
146/* Free up now-unused memory */
147static void free_sec(unsigned long start, unsigned long end, const char *name)
148{
149 unsigned long cnt = 0;
150
151 while (start < end) {
152 ClearPageReserved(virt_to_page(start));
153 set_page_count(virt_to_page(start), 1);
154 free_page(start);
155 cnt++;
156 start += PAGE_SIZE;
157 }
158 if (cnt) {
159 printk(" %ldk %s", cnt << (PAGE_SHIFT - 10), name);
160 totalram_pages += cnt;
161 }
162}
163
164void free_initmem(void)
165{
166#define FREESEC(TYPE) \
167 free_sec((unsigned long)(&__ ## TYPE ## _begin), \
168 (unsigned long)(&__ ## TYPE ## _end), \
169 #TYPE);
170
171 printk ("Freeing unused kernel memory:");
172 FREESEC(init);
173 if (_machine != _MACH_Pmac)
174 FREESEC(pmac);
175 if (_machine != _MACH_chrp)
176 FREESEC(chrp);
177 if (_machine != _MACH_prep)
178 FREESEC(prep);
179 if (!have_of)
180 FREESEC(openfirmware);
181 printk("\n");
182#undef FREESEC
183}
184
185#ifdef CONFIG_BLK_DEV_INITRD
186void free_initrd_mem(unsigned long start, unsigned long end)
187{
188 printk ("Freeing initrd memory: %ldk freed\n", (end - start) >> 10);
189
190 for (; start < end; start += PAGE_SIZE) {
191 ClearPageReserved(virt_to_page(start));
192 set_page_count(virt_to_page(start), 1);
193 free_page(start);
194 totalram_pages++;
195 }
196}
197#endif
198
199/*
200 * Check for command-line options that affect what MMU_init will do.
201 */
202void MMU_setup(void)
203{
204 /* Check for nobats option (used in mapin_ram). */
205 if (strstr(cmd_line, "nobats")) {
206 __map_without_bats = 1;
207 }
208
209 if (strstr(cmd_line, "noltlbs")) {
210 __map_without_ltlbs = 1;
211 }
212
213 /* Look for mem= option on command line */
214 if (strstr(cmd_line, "mem=")) {
215 char *p, *q;
216 unsigned long maxmem = 0;
217
218 for (q = cmd_line; (p = strstr(q, "mem=")) != 0; ) {
219 q = p + 4;
220 if (p > cmd_line && p[-1] != ' ')
221 continue;
222 maxmem = simple_strtoul(q, &q, 0);
223 if (*q == 'k' || *q == 'K') {
224 maxmem <<= 10;
225 ++q;
226 } else if (*q == 'm' || *q == 'M') {
227 maxmem <<= 20;
228 ++q;
229 }
230 }
231 __max_memory = maxmem;
232 }
233}
234
235/*
236 * MMU_init sets up the basic memory mappings for the kernel,
237 * including both RAM and possibly some I/O regions,
238 * and sets up the page tables and the MMU hardware ready to go.
239 */
240void __init MMU_init(void)
241{
242 if (ppc_md.progress)
243 ppc_md.progress("MMU:enter", 0x111);
244
245 /* parse args from command line */
246 MMU_setup();
247
248 /*
249 * Figure out how much memory we have, how much
250 * is lowmem, and how much is highmem. If we were
251 * passed the total memory size from the bootloader,
252 * just use it.
253 */
254 if (boot_mem_size)
255 total_memory = boot_mem_size;
256 else
257 total_memory = ppc_md.find_end_of_memory();
258
259 if (__max_memory && total_memory > __max_memory)
260 total_memory = __max_memory;
261 total_lowmem = total_memory;
262#ifdef CONFIG_FSL_BOOKE
263 /* Freescale Book-E parts expect lowmem to be mapped by fixed TLB
264 * entries, so we need to adjust lowmem to match the amount we can map
265 * in the fixed entries */
266 adjust_total_lowmem();
267#endif /* CONFIG_FSL_BOOKE */
268 if (total_lowmem > __max_low_memory) {
269 total_lowmem = __max_low_memory;
270#ifndef CONFIG_HIGHMEM
271 total_memory = total_lowmem;
272#endif /* CONFIG_HIGHMEM */
273 }
274 set_phys_avail(total_lowmem);
275
276 /* Initialize the MMU hardware */
277 if (ppc_md.progress)
278 ppc_md.progress("MMU:hw init", 0x300);
279 MMU_init_hw();
280
281 /* Map in all of RAM starting at KERNELBASE */
282 if (ppc_md.progress)
283 ppc_md.progress("MMU:mapin", 0x301);
284 mapin_ram();
285
286#ifdef CONFIG_HIGHMEM
287 ioremap_base = PKMAP_BASE;
288#else
289 ioremap_base = 0xfe000000UL; /* for now, could be 0xfffff000 */
290#endif /* CONFIG_HIGHMEM */
291 ioremap_bot = ioremap_base;
292
293 /* Map in I/O resources */
294 if (ppc_md.progress)
295 ppc_md.progress("MMU:setio", 0x302);
296 if (ppc_md.setup_io_mappings)
297 ppc_md.setup_io_mappings();
298
299 /* Initialize the context management stuff */
300 mmu_context_init();
301
302 if (ppc_md.progress)
303 ppc_md.progress("MMU:exit", 0x211);
304
305#ifdef CONFIG_BOOTX_TEXT
306 /* By default, we are no longer mapped */
307 boot_text_mapped = 0;
308 /* Must be done last, or ppc_md.progress will die. */
309 map_boot_text();
310#endif
311}
312
313/* This is only called until mem_init is done. */
314void __init *early_get_page(void)
315{
316 void *p;
317
318 if (init_bootmem_done) {
319 p = alloc_bootmem_pages(PAGE_SIZE);
320 } else {
321 p = mem_pieces_find(PAGE_SIZE, PAGE_SIZE);
322 }
323 return p;
324}
325
326/*
327 * Initialize the bootmem system and give it all the memory we
328 * have available.
329 */
330void __init do_init_bootmem(void)
331{
332 unsigned long start, size;
333 int i;
334
335 /*
336 * Find an area to use for the bootmem bitmap.
337 * We look for the first area which is at least
338 * 128kB in length (128kB is enough for a bitmap
339 * for 4GB of memory, using 4kB pages), plus 1 page
340 * (in case the address isn't page-aligned).
341 */
342 start = 0;
343 size = 0;
344 for (i = 0; i < phys_avail.n_regions; ++i) {
345 unsigned long a = phys_avail.regions[i].address;
346 unsigned long s = phys_avail.regions[i].size;
347 if (s <= size)
348 continue;
349 start = a;
350 size = s;
351 if (s >= 33 * PAGE_SIZE)
352 break;
353 }
354 start = PAGE_ALIGN(start);
355
356 min_low_pfn = start >> PAGE_SHIFT;
357 max_low_pfn = (PPC_MEMSTART + total_lowmem) >> PAGE_SHIFT;
358 max_pfn = (PPC_MEMSTART + total_memory) >> PAGE_SHIFT;
359 boot_mapsize = init_bootmem_node(&contig_page_data, min_low_pfn,
360 PPC_MEMSTART >> PAGE_SHIFT,
361 max_low_pfn);
362
363 /* remove the bootmem bitmap from the available memory */
364 mem_pieces_remove(&phys_avail, start, boot_mapsize, 1);
365
366 /* add everything in phys_avail into the bootmem map */
367 for (i = 0; i < phys_avail.n_regions; ++i)
368 free_bootmem(phys_avail.regions[i].address,
369 phys_avail.regions[i].size);
370
371 init_bootmem_done = 1;
372}
373
374/*
375 * paging_init() sets up the page tables - in fact we've already done this.
376 */
377void __init paging_init(void)
378{
379 unsigned long zones_size[MAX_NR_ZONES], i;
380
381#ifdef CONFIG_HIGHMEM
382 map_page(PKMAP_BASE, 0, 0); /* XXX gross */
383 pkmap_page_table = pte_offset_kernel(pmd_offset(pgd_offset_k
384 (PKMAP_BASE), PKMAP_BASE), PKMAP_BASE);
385 map_page(KMAP_FIX_BEGIN, 0, 0); /* XXX gross */
386 kmap_pte = pte_offset_kernel(pmd_offset(pgd_offset_k
387 (KMAP_FIX_BEGIN), KMAP_FIX_BEGIN), KMAP_FIX_BEGIN);
388 kmap_prot = PAGE_KERNEL;
389#endif /* CONFIG_HIGHMEM */
390
391 /*
392 * All pages are DMA-able so we put them all in the DMA zone.
393 */
394 zones_size[ZONE_DMA] = total_lowmem >> PAGE_SHIFT;
395 for (i = 1; i < MAX_NR_ZONES; i++)
396 zones_size[i] = 0;
397
398#ifdef CONFIG_HIGHMEM
399 zones_size[ZONE_HIGHMEM] = (total_memory - total_lowmem) >> PAGE_SHIFT;
400#endif /* CONFIG_HIGHMEM */
401
402 free_area_init(zones_size);
403}
404
405void __init mem_init(void)
406{
407 unsigned long addr;
408 int codepages = 0;
409 int datapages = 0;
410 int initpages = 0;
411#ifdef CONFIG_HIGHMEM
412 unsigned long highmem_mapnr;
413
414 highmem_mapnr = total_lowmem >> PAGE_SHIFT;
415#endif /* CONFIG_HIGHMEM */
416 max_mapnr = total_memory >> PAGE_SHIFT;
417
418 high_memory = (void *) __va(PPC_MEMSTART + total_lowmem);
419 num_physpages = max_mapnr; /* RAM is assumed contiguous */
420
421 totalram_pages += free_all_bootmem();
422
423#ifdef CONFIG_BLK_DEV_INITRD
424 /* if we are booted from BootX with an initial ramdisk,
425 make sure the ramdisk pages aren't reserved. */
426 if (initrd_start) {
427 for (addr = initrd_start; addr < initrd_end; addr += PAGE_SIZE)
428 ClearPageReserved(virt_to_page(addr));
429 }
430#endif /* CONFIG_BLK_DEV_INITRD */
431
432#ifdef CONFIG_PPC_OF
433 /* mark the RTAS pages as reserved */
434 if ( rtas_data )
435 for (addr = (ulong)__va(rtas_data);
436 addr < PAGE_ALIGN((ulong)__va(rtas_data)+rtas_size) ;
437 addr += PAGE_SIZE)
438 SetPageReserved(virt_to_page(addr));
439#endif
440#ifdef CONFIG_PPC_PMAC
441 if (agp_special_page)
442 SetPageReserved(virt_to_page(agp_special_page));
443#endif
444 if ( sysmap )
445 for (addr = (unsigned long)sysmap;
446 addr < PAGE_ALIGN((unsigned long)sysmap+sysmap_size) ;
447 addr += PAGE_SIZE)
448 SetPageReserved(virt_to_page(addr));
449
450 for (addr = PAGE_OFFSET; addr < (unsigned long)high_memory;
451 addr += PAGE_SIZE) {
452 if (!PageReserved(virt_to_page(addr)))
453 continue;
454 if (addr < (ulong) etext)
455 codepages++;
456 else if (addr >= (unsigned long)&__init_begin
457 && addr < (unsigned long)&__init_end)
458 initpages++;
459 else if (addr < (ulong) klimit)
460 datapages++;
461 }
462
463#ifdef CONFIG_HIGHMEM
464 {
465 unsigned long pfn;
466
467 for (pfn = highmem_mapnr; pfn < max_mapnr; ++pfn) {
468 struct page *page = mem_map + pfn;
469
470 ClearPageReserved(page);
471 set_bit(PG_highmem, &page->flags);
472 set_page_count(page, 1);
473 __free_page(page);
474 totalhigh_pages++;
475 }
476 totalram_pages += totalhigh_pages;
477 }
478#endif /* CONFIG_HIGHMEM */
479
480 printk("Memory: %luk available (%dk kernel code, %dk data, %dk init, %ldk highmem)\n",
481 (unsigned long)nr_free_pages()<< (PAGE_SHIFT-10),
482 codepages<< (PAGE_SHIFT-10), datapages<< (PAGE_SHIFT-10),
483 initpages<< (PAGE_SHIFT-10),
484 (unsigned long) (totalhigh_pages << (PAGE_SHIFT-10)));
485 if (sysmap)
486 printk("System.map loaded at 0x%08x for debugger, size: %ld bytes\n",
487 (unsigned int)sysmap, sysmap_size);
488#ifdef CONFIG_PPC_PMAC
489 if (agp_special_page)
490 printk(KERN_INFO "AGP special page: 0x%08lx\n", agp_special_page);
491#endif
492
493 mem_init_done = 1;
494}
495
496/*
497 * Set phys_avail to the amount of physical memory,
498 * less the kernel text/data/bss.
499 */
500void __init
501set_phys_avail(unsigned long total_memory)
502{
503 unsigned long kstart, ksize;
504
505 /*
506 * Initially, available physical memory is equivalent to all
507 * physical memory.
508 */
509
510 phys_avail.regions[0].address = PPC_MEMSTART;
511 phys_avail.regions[0].size = total_memory;
512 phys_avail.n_regions = 1;
513
514 /*
515 * Map out the kernel text/data/bss from the available physical
516 * memory.
517 */
518
519 kstart = __pa(_stext); /* should be 0 */
520 ksize = PAGE_ALIGN(klimit - _stext);
521
522 mem_pieces_remove(&phys_avail, kstart, ksize, 0);
523 mem_pieces_remove(&phys_avail, 0, 0x4000, 0);
524
525#if defined(CONFIG_BLK_DEV_INITRD)
526 /* Remove the init RAM disk from the available memory. */
527 if (initrd_start) {
528 mem_pieces_remove(&phys_avail, __pa(initrd_start),
529 initrd_end - initrd_start, 1);
530 }
531#endif /* CONFIG_BLK_DEV_INITRD */
532#ifdef CONFIG_PPC_OF
533 /* remove the RTAS pages from the available memory */
534 if (rtas_data)
535 mem_pieces_remove(&phys_avail, rtas_data, rtas_size, 1);
536#endif
537 /* remove the sysmap pages from the available memory */
538 if (sysmap)
539 mem_pieces_remove(&phys_avail, __pa(sysmap), sysmap_size, 1);
540#ifdef CONFIG_PPC_PMAC
541 /* Because of some uninorth weirdness, we need a page of
542 * memory as high as possible (it must be outside of the
543 * bus address seen as the AGP aperture). It will be used
544 * by the r128 DRM driver
545 *
546 * FIXME: We need to make sure that page doesn't overlap any of the\
547 * above. This could be done by improving mem_pieces_find to be able
548 * to do a backward search from the end of the list.
549 */
550 if (_machine == _MACH_Pmac && find_devices("uni-north-agp")) {
551 agp_special_page = (total_memory - PAGE_SIZE);
552 mem_pieces_remove(&phys_avail, agp_special_page, PAGE_SIZE, 0);
553 agp_special_page = (unsigned long)__va(agp_special_page);
554 }
555#endif /* CONFIG_PPC_PMAC */
556}
557
558/* Mark some memory as reserved by removing it from phys_avail. */
559void __init reserve_phys_mem(unsigned long start, unsigned long size)
560{
561 mem_pieces_remove(&phys_avail, start, size, 1);
562}
563
564/*
565 * This is called when a page has been modified by the kernel.
566 * It just marks the page as not i-cache clean. We do the i-cache
567 * flush later when the page is given to a user process, if necessary.
568 */
569void flush_dcache_page(struct page *page)
570{
571 clear_bit(PG_arch_1, &page->flags);
572}
573
574void flush_dcache_icache_page(struct page *page)
575{
576#ifdef CONFIG_BOOKE
577 __flush_dcache_icache(kmap(page));
578 kunmap(page);
579#else
580 __flush_dcache_icache_phys(page_to_pfn(page) << PAGE_SHIFT);
581#endif
582
583}
584void clear_user_page(void *page, unsigned long vaddr, struct page *pg)
585{
586 clear_page(page);
587 clear_bit(PG_arch_1, &pg->flags);
588}
589
590void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
591 struct page *pg)
592{
593 copy_page(vto, vfrom);
594 clear_bit(PG_arch_1, &pg->flags);
595}
596
597void flush_icache_user_range(struct vm_area_struct *vma, struct page *page,
598 unsigned long addr, int len)
599{
600 unsigned long maddr;
601
602 maddr = (unsigned long) kmap(page) + (addr & ~PAGE_MASK);
603 flush_icache_range(maddr, maddr + len);
604 kunmap(page);
605}
606
607/*
608 * This is called at the end of handling a user page fault, when the
609 * fault has been handled by updating a PTE in the linux page tables.
610 * We use it to preload an HPTE into the hash table corresponding to
611 * the updated linux PTE.
612 */
613void update_mmu_cache(struct vm_area_struct *vma, unsigned long address,
614 pte_t pte)
615{
616 /* handle i-cache coherency */
617 unsigned long pfn = pte_pfn(pte);
618
619 if (pfn_valid(pfn)) {
620 struct page *page = pfn_to_page(pfn);
621 if (!PageReserved(page)
622 && !test_bit(PG_arch_1, &page->flags)) {
623 if (vma->vm_mm == current->active_mm)
624 __flush_dcache_icache((void *) address);
625 else
626 flush_dcache_icache_page(page);
627 set_bit(PG_arch_1, &page->flags);
628 }
629 }
630
631#ifdef CONFIG_PPC_STD_MMU
632 /* We only want HPTEs for linux PTEs that have _PAGE_ACCESSED set */
633 if (Hash != 0 && pte_young(pte)) {
634 struct mm_struct *mm;
635 pmd_t *pmd;
636
637 mm = (address < TASK_SIZE)? vma->vm_mm: &init_mm;
638 pmd = pmd_offset(pgd_offset(mm, address), address);
639 if (!pmd_none(*pmd))
640 add_hash_page(mm->context, address, pmd_val(*pmd));
641 }
642#endif
643}
644
645/*
646 * This is called by /dev/mem to know if a given address has to
647 * be mapped non-cacheable or not
648 */
649int page_is_ram(unsigned long pfn)
650{
651 unsigned long paddr = (pfn << PAGE_SHIFT);
652
653 return paddr < __pa(high_memory);
654}
655
656pgprot_t phys_mem_access_prot(struct file *file, unsigned long addr,
657 unsigned long size, pgprot_t vma_prot)
658{
659 if (ppc_md.phys_mem_access_prot)
660 return ppc_md.phys_mem_access_prot(file, addr, size, vma_prot);
661
662 if (!page_is_ram(addr >> PAGE_SHIFT))
663 vma_prot = __pgprot(pgprot_val(vma_prot)
664 | _PAGE_GUARDED | _PAGE_NO_CACHE);
665 return vma_prot;
666}
667EXPORT_SYMBOL(phys_mem_access_prot);
diff --git a/arch/ppc/mm/mem_pieces.c b/arch/ppc/mm/mem_pieces.c
new file mode 100644
index 000000000000..3d639052017e
--- /dev/null
+++ b/arch/ppc/mm/mem_pieces.c
@@ -0,0 +1,163 @@
1/*
2 * Copyright (c) 1996 Paul Mackerras <paulus@cs.anu.edu.au>
3 * Changes to accommodate Power Macintoshes.
4 * Cort Dougan <cort@cs.nmt.edu>
5 * Rewrites.
6 * Grant Erickson <grant@lcse.umn.edu>
7 * General rework and split from mm/init.c.
8 *
9 * Module name: mem_pieces.c
10 *
11 * Description:
12 * Routines and data structures for manipulating and representing
13 * phyiscal memory extents (i.e. address/length pairs).
14 *
15 */
16
17#include <linux/config.h>
18#include <linux/kernel.h>
19#include <linux/stddef.h>
20#include <linux/init.h>
21#include <asm/page.h>
22
23#include "mem_pieces.h"
24
25extern struct mem_pieces phys_avail;
26
27static void mem_pieces_print(struct mem_pieces *);
28
29/*
30 * Scan a region for a piece of a given size with the required alignment.
31 */
32void __init *
33mem_pieces_find(unsigned int size, unsigned int align)
34{
35 int i;
36 unsigned a, e;
37 struct mem_pieces *mp = &phys_avail;
38
39 for (i = 0; i < mp->n_regions; ++i) {
40 a = mp->regions[i].address;
41 e = a + mp->regions[i].size;
42 a = (a + align - 1) & -align;
43 if (a + size <= e) {
44 mem_pieces_remove(mp, a, size, 1);
45 return (void *) __va(a);
46 }
47 }
48 panic("Couldn't find %u bytes at %u alignment\n", size, align);
49
50 return NULL;
51}
52
53/*
54 * Remove some memory from an array of pieces
55 */
56void __init
57mem_pieces_remove(struct mem_pieces *mp, unsigned int start, unsigned int size,
58 int must_exist)
59{
60 int i, j;
61 unsigned int end, rs, re;
62 struct reg_property *rp;
63
64 end = start + size;
65 for (i = 0, rp = mp->regions; i < mp->n_regions; ++i, ++rp) {
66 if (end > rp->address && start < rp->address + rp->size)
67 break;
68 }
69 if (i >= mp->n_regions) {
70 if (must_exist)
71 printk("mem_pieces_remove: [%x,%x) not in any region\n",
72 start, end);
73 return;
74 }
75 for (; i < mp->n_regions && end > rp->address; ++i, ++rp) {
76 rs = rp->address;
77 re = rs + rp->size;
78 if (must_exist && (start < rs || end > re)) {
79 printk("mem_pieces_remove: bad overlap [%x,%x) with",
80 start, end);
81 mem_pieces_print(mp);
82 must_exist = 0;
83 }
84 if (start > rs) {
85 rp->size = start - rs;
86 if (end < re) {
87 /* need to split this entry */
88 if (mp->n_regions >= MEM_PIECES_MAX)
89 panic("eek... mem_pieces overflow");
90 for (j = mp->n_regions; j > i + 1; --j)
91 mp->regions[j] = mp->regions[j-1];
92 ++mp->n_regions;
93 rp[1].address = end;
94 rp[1].size = re - end;
95 }
96 } else {
97 if (end < re) {
98 rp->address = end;
99 rp->size = re - end;
100 } else {
101 /* need to delete this entry */
102 for (j = i; j < mp->n_regions - 1; ++j)
103 mp->regions[j] = mp->regions[j+1];
104 --mp->n_regions;
105 --i;
106 --rp;
107 }
108 }
109 }
110}
111
112static void __init
113mem_pieces_print(struct mem_pieces *mp)
114{
115 int i;
116
117 for (i = 0; i < mp->n_regions; ++i)
118 printk(" [%x, %x)", mp->regions[i].address,
119 mp->regions[i].address + mp->regions[i].size);
120 printk("\n");
121}
122
123void __init
124mem_pieces_sort(struct mem_pieces *mp)
125{
126 unsigned long a, s;
127 int i, j;
128
129 for (i = 1; i < mp->n_regions; ++i) {
130 a = mp->regions[i].address;
131 s = mp->regions[i].size;
132 for (j = i - 1; j >= 0; --j) {
133 if (a >= mp->regions[j].address)
134 break;
135 mp->regions[j+1] = mp->regions[j];
136 }
137 mp->regions[j+1].address = a;
138 mp->regions[j+1].size = s;
139 }
140}
141
142void __init
143mem_pieces_coalesce(struct mem_pieces *mp)
144{
145 unsigned long a, s, ns;
146 int i, j, d;
147
148 d = 0;
149 for (i = 0; i < mp->n_regions; i = j) {
150 a = mp->regions[i].address;
151 s = mp->regions[i].size;
152 for (j = i + 1; j < mp->n_regions
153 && mp->regions[j].address - a <= s; ++j) {
154 ns = mp->regions[j].address + mp->regions[j].size - a;
155 if (ns > s)
156 s = ns;
157 }
158 mp->regions[d].address = a;
159 mp->regions[d].size = s;
160 ++d;
161 }
162 mp->n_regions = d;
163}
diff --git a/arch/ppc/mm/mem_pieces.h b/arch/ppc/mm/mem_pieces.h
new file mode 100644
index 000000000000..e2b700dc7f18
--- /dev/null
+++ b/arch/ppc/mm/mem_pieces.h
@@ -0,0 +1,48 @@
1/*
2 * Copyright (c) 1996 Paul Mackerras <paulus@cs.anu.edu.au>
3 * Changes to accommodate Power Macintoshes.
4 * Cort Dougan <cort@cs.nmt.edu>
5 * Rewrites.
6 * Grant Erickson <grant@lcse.umn.edu>
7 * General rework and split from mm/init.c.
8 *
9 * Module name: mem_pieces.h
10 *
11 * Description:
12 * Routines and data structures for manipulating and representing
13 * phyiscal memory extents (i.e. address/length pairs).
14 *
15 */
16
17#ifndef __MEM_PIECES_H__
18#define __MEM_PIECES_H__
19
20#include <asm/prom.h>
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26
27/* Type Definitions */
28
29#define MEM_PIECES_MAX 32
30
31struct mem_pieces {
32 int n_regions;
33 struct reg_property regions[MEM_PIECES_MAX];
34};
35
36/* Function Prototypes */
37
38extern void *mem_pieces_find(unsigned int size, unsigned int align);
39extern void mem_pieces_remove(struct mem_pieces *mp, unsigned int start,
40 unsigned int size, int must_exist);
41extern void mem_pieces_coalesce(struct mem_pieces *mp);
42extern void mem_pieces_sort(struct mem_pieces *mp);
43
44#ifdef __cplusplus
45}
46#endif
47
48#endif /* __MEM_PIECES_H__ */
diff --git a/arch/ppc/mm/mmu_context.c b/arch/ppc/mm/mmu_context.c
new file mode 100644
index 000000000000..a8816e0f6a86
--- /dev/null
+++ b/arch/ppc/mm/mmu_context.c
@@ -0,0 +1,86 @@
1/*
2 * This file contains the routines for handling the MMU on those
3 * PowerPC implementations where the MMU substantially follows the
4 * architecture specification. This includes the 6xx, 7xx, 7xxx,
5 * 8260, and POWER3 implementations but excludes the 8xx and 4xx.
6 * -- paulus
7 *
8 * Derived from arch/ppc/mm/init.c:
9 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
10 *
11 * Modifications by Paul Mackerras (PowerMac) (paulus@cs.anu.edu.au)
12 * and Cort Dougan (PReP) (cort@cs.nmt.edu)
13 * Copyright (C) 1996 Paul Mackerras
14 * Amiga/APUS changes by Jesper Skov (jskov@cygnus.co.uk).
15 *
16 * Derived from "arch/i386/mm/init.c"
17 * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds
18 *
19 * This program is free software; you can redistribute it and/or
20 * modify it under the terms of the GNU General Public License
21 * as published by the Free Software Foundation; either version
22 * 2 of the License, or (at your option) any later version.
23 *
24 */
25
26#include <linux/config.h>
27#include <linux/mm.h>
28#include <linux/init.h>
29
30#include <asm/mmu_context.h>
31#include <asm/tlbflush.h>
32
33mm_context_t next_mmu_context;
34unsigned long context_map[LAST_CONTEXT / BITS_PER_LONG + 1];
35#ifdef FEW_CONTEXTS
36atomic_t nr_free_contexts;
37struct mm_struct *context_mm[LAST_CONTEXT+1];
38void steal_context(void);
39#endif /* FEW_CONTEXTS */
40
41/*
42 * Initialize the context management stuff.
43 */
44void __init
45mmu_context_init(void)
46{
47 /*
48 * Some processors have too few contexts to reserve one for
49 * init_mm, and require using context 0 for a normal task.
50 * Other processors reserve the use of context zero for the kernel.
51 * This code assumes FIRST_CONTEXT < 32.
52 */
53 context_map[0] = (1 << FIRST_CONTEXT) - 1;
54 next_mmu_context = FIRST_CONTEXT;
55#ifdef FEW_CONTEXTS
56 atomic_set(&nr_free_contexts, LAST_CONTEXT - FIRST_CONTEXT + 1);
57#endif /* FEW_CONTEXTS */
58}
59
60#ifdef FEW_CONTEXTS
61/*
62 * Steal a context from a task that has one at the moment.
63 * This is only used on 8xx and 4xx and we presently assume that
64 * they don't do SMP. If they do then this will have to check
65 * whether the MM we steal is in use.
66 * We also assume that this is only used on systems that don't
67 * use an MMU hash table - this is true for 8xx and 4xx.
68 * This isn't an LRU system, it just frees up each context in
69 * turn (sort-of pseudo-random replacement :). This would be the
70 * place to implement an LRU scheme if anyone was motivated to do it.
71 * -- paulus
72 */
73void
74steal_context(void)
75{
76 struct mm_struct *mm;
77
78 /* free up context `next_mmu_context' */
79 /* if we shouldn't free context 0, don't... */
80 if (next_mmu_context < FIRST_CONTEXT)
81 next_mmu_context = FIRST_CONTEXT;
82 mm = context_mm[next_mmu_context];
83 flush_tlb_mm(mm);
84 destroy_context(mm);
85}
86#endif /* FEW_CONTEXTS */
diff --git a/arch/ppc/mm/mmu_decl.h b/arch/ppc/mm/mmu_decl.h
new file mode 100644
index 000000000000..ffcdb46997dc
--- /dev/null
+++ b/arch/ppc/mm/mmu_decl.h
@@ -0,0 +1,83 @@
1/*
2 * Declarations of procedures and variables shared between files
3 * in arch/ppc/mm/.
4 *
5 * Derived from arch/ppc/mm/init.c:
6 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
7 *
8 * Modifications by Paul Mackerras (PowerMac) (paulus@cs.anu.edu.au)
9 * and Cort Dougan (PReP) (cort@cs.nmt.edu)
10 * Copyright (C) 1996 Paul Mackerras
11 * Amiga/APUS changes by Jesper Skov (jskov@cygnus.co.uk).
12 *
13 * Derived from "arch/i386/mm/init.c"
14 * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds
15 *
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License
18 * as published by the Free Software Foundation; either version
19 * 2 of the License, or (at your option) any later version.
20 *
21 */
22#include <asm/tlbflush.h>
23#include <asm/mmu.h>
24
25extern void mapin_ram(void);
26extern int map_page(unsigned long va, phys_addr_t pa, int flags);
27extern void setbat(int index, unsigned long virt, unsigned long phys,
28 unsigned int size, int flags);
29extern void reserve_phys_mem(unsigned long start, unsigned long size);
30extern void settlbcam(int index, unsigned long virt, phys_addr_t phys,
31 unsigned int size, int flags, unsigned int pid);
32extern void invalidate_tlbcam_entry(int index);
33
34extern int __map_without_bats;
35extern unsigned long ioremap_base;
36extern unsigned long ioremap_bot;
37extern unsigned int rtas_data, rtas_size;
38
39extern unsigned long total_memory;
40extern unsigned long total_lowmem;
41extern int mem_init_done;
42
43extern PTE *Hash, *Hash_end;
44extern unsigned long Hash_size, Hash_mask;
45
46/* ...and now those things that may be slightly different between processor
47 * architectures. -- Dan
48 */
49#if defined(CONFIG_8xx)
50#define flush_HPTE(X, va, pg) _tlbie(va)
51#define MMU_init_hw() do { } while(0)
52#define mmu_mapin_ram() (0UL)
53
54#elif defined(CONFIG_4xx)
55#define flush_HPTE(X, va, pg) _tlbie(va)
56extern void MMU_init_hw(void);
57extern unsigned long mmu_mapin_ram(void);
58
59#elif defined(CONFIG_FSL_BOOKE)
60#define flush_HPTE(X, va, pg) _tlbie(va)
61extern void MMU_init_hw(void);
62extern unsigned long mmu_mapin_ram(void);
63extern void adjust_total_lowmem(void);
64
65#else
66/* anything except 4xx or 8xx */
67extern void MMU_init_hw(void);
68extern unsigned long mmu_mapin_ram(void);
69
70/* Be careful....this needs to be updated if we ever encounter 603 SMPs,
71 * which includes all new 82xx processors. We need tlbie/tlbsync here
72 * in that case (I think). -- Dan.
73 */
74static inline void flush_HPTE(unsigned context, unsigned long va,
75 unsigned long pdval)
76{
77 if ((Hash != 0) &&
78 cpu_has_feature(CPU_FTR_HPTE_TABLE))
79 flush_hash_pages(0, va, pdval, 1);
80 else
81 _tlbie(va);
82}
83#endif
diff --git a/arch/ppc/mm/pgtable.c b/arch/ppc/mm/pgtable.c
new file mode 100644
index 000000000000..0a5cd20275c4
--- /dev/null
+++ b/arch/ppc/mm/pgtable.c
@@ -0,0 +1,471 @@
1/*
2 * This file contains the routines setting up the linux page tables.
3 * -- paulus
4 *
5 * Derived from arch/ppc/mm/init.c:
6 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
7 *
8 * Modifications by Paul Mackerras (PowerMac) (paulus@cs.anu.edu.au)
9 * and Cort Dougan (PReP) (cort@cs.nmt.edu)
10 * Copyright (C) 1996 Paul Mackerras
11 * Amiga/APUS changes by Jesper Skov (jskov@cygnus.co.uk).
12 *
13 * Derived from "arch/i386/mm/init.c"
14 * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds
15 *
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License
18 * as published by the Free Software Foundation; either version
19 * 2 of the License, or (at your option) any later version.
20 *
21 */
22
23#include <linux/config.h>
24#include <linux/kernel.h>
25#include <linux/module.h>
26#include <linux/types.h>
27#include <linux/mm.h>
28#include <linux/vmalloc.h>
29#include <linux/init.h>
30#include <linux/highmem.h>
31
32#include <asm/pgtable.h>
33#include <asm/pgalloc.h>
34#include <asm/io.h>
35
36#include "mmu_decl.h"
37
38unsigned long ioremap_base;
39unsigned long ioremap_bot;
40int io_bat_index;
41
42#if defined(CONFIG_6xx) || defined(CONFIG_POWER3)
43#define HAVE_BATS 1
44#endif
45
46#if defined(CONFIG_FSL_BOOKE)
47#define HAVE_TLBCAM 1
48#endif
49
50extern char etext[], _stext[];
51
52#ifdef CONFIG_SMP
53extern void hash_page_sync(void);
54#endif
55
56#ifdef HAVE_BATS
57extern unsigned long v_mapped_by_bats(unsigned long va);
58extern unsigned long p_mapped_by_bats(unsigned long pa);
59void setbat(int index, unsigned long virt, unsigned long phys,
60 unsigned int size, int flags);
61
62#else /* !HAVE_BATS */
63#define v_mapped_by_bats(x) (0UL)
64#define p_mapped_by_bats(x) (0UL)
65#endif /* HAVE_BATS */
66
67#ifdef HAVE_TLBCAM
68extern unsigned int tlbcam_index;
69extern unsigned int num_tlbcam_entries;
70extern unsigned long v_mapped_by_tlbcam(unsigned long va);
71extern unsigned long p_mapped_by_tlbcam(unsigned long pa);
72#else /* !HAVE_TLBCAM */
73#define v_mapped_by_tlbcam(x) (0UL)
74#define p_mapped_by_tlbcam(x) (0UL)
75#endif /* HAVE_TLBCAM */
76
77#ifdef CONFIG_44x
78/* 44x uses an 8kB pgdir because it has 8-byte Linux PTEs. */
79#define PGDIR_ORDER 1
80#else
81#define PGDIR_ORDER 0
82#endif
83
84pgd_t *pgd_alloc(struct mm_struct *mm)
85{
86 pgd_t *ret;
87
88 ret = (pgd_t *)__get_free_pages(GFP_KERNEL|__GFP_ZERO, PGDIR_ORDER);
89 return ret;
90}
91
92void pgd_free(pgd_t *pgd)
93{
94 free_pages((unsigned long)pgd, PGDIR_ORDER);
95}
96
97pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
98{
99 pte_t *pte;
100 extern int mem_init_done;
101 extern void *early_get_page(void);
102
103 if (mem_init_done) {
104 pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
105 } else {
106 pte = (pte_t *)early_get_page();
107 if (pte)
108 clear_page(pte);
109 }
110 return pte;
111}
112
113struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address)
114{
115 struct page *ptepage;
116
117#ifdef CONFIG_HIGHPTE
118 int flags = GFP_KERNEL | __GFP_HIGHMEM | __GFP_REPEAT;
119#else
120 int flags = GFP_KERNEL | __GFP_REPEAT;
121#endif
122
123 ptepage = alloc_pages(flags, 0);
124 if (ptepage)
125 clear_highpage(ptepage);
126 return ptepage;
127}
128
129void pte_free_kernel(pte_t *pte)
130{
131#ifdef CONFIG_SMP
132 hash_page_sync();
133#endif
134 free_page((unsigned long)pte);
135}
136
137void pte_free(struct page *ptepage)
138{
139#ifdef CONFIG_SMP
140 hash_page_sync();
141#endif
142 __free_page(ptepage);
143}
144
145#ifndef CONFIG_44x
146void __iomem *
147ioremap(phys_addr_t addr, unsigned long size)
148{
149 return __ioremap(addr, size, _PAGE_NO_CACHE);
150}
151#else /* CONFIG_44x */
152void __iomem *
153ioremap64(unsigned long long addr, unsigned long size)
154{
155 return __ioremap(addr, size, _PAGE_NO_CACHE);
156}
157
158void __iomem *
159ioremap(phys_addr_t addr, unsigned long size)
160{
161 phys_addr_t addr64 = fixup_bigphys_addr(addr, size);
162
163 return ioremap64(addr64, size);
164}
165#endif /* CONFIG_44x */
166
167void __iomem *
168__ioremap(phys_addr_t addr, unsigned long size, unsigned long flags)
169{
170 unsigned long v, i;
171 phys_addr_t p;
172 int err;
173
174 /*
175 * Choose an address to map it to.
176 * Once the vmalloc system is running, we use it.
177 * Before then, we use space going down from ioremap_base
178 * (ioremap_bot records where we're up to).
179 */
180 p = addr & PAGE_MASK;
181 size = PAGE_ALIGN(addr + size) - p;
182
183 /*
184 * If the address lies within the first 16 MB, assume it's in ISA
185 * memory space
186 */
187 if (p < 16*1024*1024)
188 p += _ISA_MEM_BASE;
189
190 /*
191 * Don't allow anybody to remap normal RAM that we're using.
192 * mem_init() sets high_memory so only do the check after that.
193 */
194 if ( mem_init_done && (p < virt_to_phys(high_memory)) )
195 {
196 printk("__ioremap(): phys addr "PTE_FMT" is RAM lr %p\n", p,
197 __builtin_return_address(0));
198 return NULL;
199 }
200
201 if (size == 0)
202 return NULL;
203
204 /*
205 * Is it already mapped? Perhaps overlapped by a previous
206 * BAT mapping. If the whole area is mapped then we're done,
207 * otherwise remap it since we want to keep the virt addrs for
208 * each request contiguous.
209 *
210 * We make the assumption here that if the bottom and top
211 * of the range we want are mapped then it's mapped to the
212 * same virt address (and this is contiguous).
213 * -- Cort
214 */
215 if ((v = p_mapped_by_bats(p)) /*&& p_mapped_by_bats(p+size-1)*/ )
216 goto out;
217
218 if ((v = p_mapped_by_tlbcam(p)))
219 goto out;
220
221 if (mem_init_done) {
222 struct vm_struct *area;
223 area = get_vm_area(size, VM_IOREMAP);
224 if (area == 0)
225 return NULL;
226 v = (unsigned long) area->addr;
227 } else {
228 v = (ioremap_bot -= size);
229 }
230
231 if ((flags & _PAGE_PRESENT) == 0)
232 flags |= _PAGE_KERNEL;
233 if (flags & _PAGE_NO_CACHE)
234 flags |= _PAGE_GUARDED;
235
236 /*
237 * Should check if it is a candidate for a BAT mapping
238 */
239
240 err = 0;
241 for (i = 0; i < size && err == 0; i += PAGE_SIZE)
242 err = map_page(v+i, p+i, flags);
243 if (err) {
244 if (mem_init_done)
245 vunmap((void *)v);
246 return NULL;
247 }
248
249out:
250 return (void __iomem *) (v + ((unsigned long)addr & ~PAGE_MASK));
251}
252
253void iounmap(volatile void __iomem *addr)
254{
255 /*
256 * If mapped by BATs then there is nothing to do.
257 * Calling vfree() generates a benign warning.
258 */
259 if (v_mapped_by_bats((unsigned long)addr)) return;
260
261 if (addr > high_memory && (unsigned long) addr < ioremap_bot)
262 vunmap((void *) (PAGE_MASK & (unsigned long)addr));
263}
264
265void __iomem *ioport_map(unsigned long port, unsigned int len)
266{
267 return (void __iomem *) (port + _IO_BASE);
268}
269
270void ioport_unmap(void __iomem *addr)
271{
272 /* Nothing to do */
273}
274EXPORT_SYMBOL(ioport_map);
275EXPORT_SYMBOL(ioport_unmap);
276
277int
278map_page(unsigned long va, phys_addr_t pa, int flags)
279{
280 pmd_t *pd;
281 pte_t *pg;
282 int err = -ENOMEM;
283
284 spin_lock(&init_mm.page_table_lock);
285 /* Use upper 10 bits of VA to index the first level map */
286 pd = pmd_offset(pgd_offset_k(va), va);
287 /* Use middle 10 bits of VA to index the second-level map */
288 pg = pte_alloc_kernel(&init_mm, pd, va);
289 if (pg != 0) {
290 err = 0;
291 set_pte_at(&init_mm, va, pg, pfn_pte(pa >> PAGE_SHIFT, __pgprot(flags)));
292 if (mem_init_done)
293 flush_HPTE(0, va, pmd_val(*pd));
294 }
295 spin_unlock(&init_mm.page_table_lock);
296 return err;
297}
298
299/*
300 * Map in all of physical memory starting at KERNELBASE.
301 */
302void __init mapin_ram(void)
303{
304 unsigned long v, p, s, f;
305
306 s = mmu_mapin_ram();
307 v = KERNELBASE + s;
308 p = PPC_MEMSTART + s;
309 for (; s < total_lowmem; s += PAGE_SIZE) {
310 if ((char *) v >= _stext && (char *) v < etext)
311 f = _PAGE_RAM_TEXT;
312 else
313 f = _PAGE_RAM;
314 map_page(v, p, f);
315 v += PAGE_SIZE;
316 p += PAGE_SIZE;
317 }
318}
319
320/* is x a power of 2? */
321#define is_power_of_2(x) ((x) != 0 && (((x) & ((x) - 1)) == 0))
322
323/* is x a power of 4? */
324#define is_power_of_4(x) ((x) != 0 && (((x) & (x-1)) == 0) && (ffs(x) & 1))
325
326/*
327 * Set up a mapping for a block of I/O.
328 * virt, phys, size must all be page-aligned.
329 * This should only be called before ioremap is called.
330 */
331void __init io_block_mapping(unsigned long virt, phys_addr_t phys,
332 unsigned int size, int flags)
333{
334 int i;
335
336 if (virt > KERNELBASE && virt < ioremap_bot)
337 ioremap_bot = ioremap_base = virt;
338
339#ifdef HAVE_BATS
340 /*
341 * Use a BAT for this if possible...
342 */
343 if (io_bat_index < 2 && is_power_of_2(size)
344 && (virt & (size - 1)) == 0 && (phys & (size - 1)) == 0) {
345 setbat(io_bat_index, virt, phys, size, flags);
346 ++io_bat_index;
347 return;
348 }
349#endif /* HAVE_BATS */
350
351#ifdef HAVE_TLBCAM
352 /*
353 * Use a CAM for this if possible...
354 */
355 if (tlbcam_index < num_tlbcam_entries && is_power_of_4(size)
356 && (virt & (size - 1)) == 0 && (phys & (size - 1)) == 0) {
357 settlbcam(tlbcam_index, virt, phys, size, flags, 0);
358 ++tlbcam_index;
359 return;
360 }
361#endif /* HAVE_TLBCAM */
362
363 /* No BATs available, put it in the page tables. */
364 for (i = 0; i < size; i += PAGE_SIZE)
365 map_page(virt + i, phys + i, flags);
366}
367
368/* Scan the real Linux page tables and return a PTE pointer for
369 * a virtual address in a context.
370 * Returns true (1) if PTE was found, zero otherwise. The pointer to
371 * the PTE pointer is unmodified if PTE is not found.
372 */
373int
374get_pteptr(struct mm_struct *mm, unsigned long addr, pte_t **ptep)
375{
376 pgd_t *pgd;
377 pmd_t *pmd;
378 pte_t *pte;
379 int retval = 0;
380
381 pgd = pgd_offset(mm, addr & PAGE_MASK);
382 if (pgd) {
383 pmd = pmd_offset(pgd, addr & PAGE_MASK);
384 if (pmd_present(*pmd)) {
385 pte = pte_offset_map(pmd, addr & PAGE_MASK);
386 if (pte) {
387 retval = 1;
388 *ptep = pte;
389 /* XXX caller needs to do pte_unmap, yuck */
390 }
391 }
392 }
393 return(retval);
394}
395
396/* Find physical address for this virtual address. Normally used by
397 * I/O functions, but anyone can call it.
398 */
399unsigned long iopa(unsigned long addr)
400{
401 unsigned long pa;
402
403 /* I don't know why this won't work on PMacs or CHRP. It
404 * appears there is some bug, or there is some implicit
405 * mapping done not properly represented by BATs or in page
406 * tables.......I am actively working on resolving this, but
407 * can't hold up other stuff. -- Dan
408 */
409 pte_t *pte;
410 struct mm_struct *mm;
411
412 /* Check the BATs */
413 pa = v_mapped_by_bats(addr);
414 if (pa)
415 return pa;
416
417 /* Allow mapping of user addresses (within the thread)
418 * for DMA if necessary.
419 */
420 if (addr < TASK_SIZE)
421 mm = current->mm;
422 else
423 mm = &init_mm;
424
425 pa = 0;
426 if (get_pteptr(mm, addr, &pte)) {
427 pa = (pte_val(*pte) & PAGE_MASK) | (addr & ~PAGE_MASK);
428 pte_unmap(pte);
429 }
430
431 return(pa);
432}
433
434/* This is will find the virtual address for a physical one....
435 * Swiped from APUS, could be dangerous :-).
436 * This is only a placeholder until I really find a way to make this
437 * work. -- Dan
438 */
439unsigned long
440mm_ptov (unsigned long paddr)
441{
442 unsigned long ret;
443#if 0
444 if (paddr < 16*1024*1024)
445 ret = ZTWO_VADDR(paddr);
446 else {
447 int i;
448
449 for (i = 0; i < kmap_chunk_count;){
450 unsigned long phys = kmap_chunks[i++];
451 unsigned long size = kmap_chunks[i++];
452 unsigned long virt = kmap_chunks[i++];
453 if (paddr >= phys
454 && paddr < (phys + size)){
455 ret = virt + paddr - phys;
456 goto exit;
457 }
458 }
459
460 ret = (unsigned long) __va(paddr);
461 }
462exit:
463#ifdef DEBUGPV
464 printk ("PTOV(%lx)=%lx\n", paddr, ret);
465#endif
466#else
467 ret = (unsigned long)paddr + KERNELBASE;
468#endif
469 return ret;
470}
471
diff --git a/arch/ppc/mm/ppc_mmu.c b/arch/ppc/mm/ppc_mmu.c
new file mode 100644
index 000000000000..9a381ed5eb21
--- /dev/null
+++ b/arch/ppc/mm/ppc_mmu.c
@@ -0,0 +1,296 @@
1/*
2 * This file contains the routines for handling the MMU on those
3 * PowerPC implementations where the MMU substantially follows the
4 * architecture specification. This includes the 6xx, 7xx, 7xxx,
5 * 8260, and POWER3 implementations but excludes the 8xx and 4xx.
6 * -- paulus
7 *
8 * Derived from arch/ppc/mm/init.c:
9 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
10 *
11 * Modifications by Paul Mackerras (PowerMac) (paulus@cs.anu.edu.au)
12 * and Cort Dougan (PReP) (cort@cs.nmt.edu)
13 * Copyright (C) 1996 Paul Mackerras
14 * Amiga/APUS changes by Jesper Skov (jskov@cygnus.co.uk).
15 *
16 * Derived from "arch/i386/mm/init.c"
17 * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds
18 *
19 * This program is free software; you can redistribute it and/or
20 * modify it under the terms of the GNU General Public License
21 * as published by the Free Software Foundation; either version
22 * 2 of the License, or (at your option) any later version.
23 *
24 */
25
26#include <linux/config.h>
27#include <linux/kernel.h>
28#include <linux/mm.h>
29#include <linux/init.h>
30#include <linux/highmem.h>
31
32#include <asm/prom.h>
33#include <asm/mmu.h>
34#include <asm/machdep.h>
35
36#include "mmu_decl.h"
37#include "mem_pieces.h"
38
39PTE *Hash, *Hash_end;
40unsigned long Hash_size, Hash_mask;
41unsigned long _SDR1;
42
43union ubat { /* BAT register values to be loaded */
44 BAT bat;
45#ifdef CONFIG_PPC64BRIDGE
46 u64 word[2];
47#else
48 u32 word[2];
49#endif
50} BATS[4][2]; /* 4 pairs of IBAT, DBAT */
51
52struct batrange { /* stores address ranges mapped by BATs */
53 unsigned long start;
54 unsigned long limit;
55 unsigned long phys;
56} bat_addrs[4];
57
58/*
59 * Return PA for this VA if it is mapped by a BAT, or 0
60 */
61unsigned long v_mapped_by_bats(unsigned long va)
62{
63 int b;
64 for (b = 0; b < 4; ++b)
65 if (va >= bat_addrs[b].start && va < bat_addrs[b].limit)
66 return bat_addrs[b].phys + (va - bat_addrs[b].start);
67 return 0;
68}
69
70/*
71 * Return VA for a given PA or 0 if not mapped
72 */
73unsigned long p_mapped_by_bats(unsigned long pa)
74{
75 int b;
76 for (b = 0; b < 4; ++b)
77 if (pa >= bat_addrs[b].phys
78 && pa < (bat_addrs[b].limit-bat_addrs[b].start)
79 +bat_addrs[b].phys)
80 return bat_addrs[b].start+(pa-bat_addrs[b].phys);
81 return 0;
82}
83
84unsigned long __init mmu_mapin_ram(void)
85{
86#ifdef CONFIG_POWER4
87 return 0;
88#else
89 unsigned long tot, bl, done;
90 unsigned long max_size = (256<<20);
91 unsigned long align;
92
93 if (__map_without_bats)
94 return 0;
95
96 /* Set up BAT2 and if necessary BAT3 to cover RAM. */
97
98 /* Make sure we don't map a block larger than the
99 smallest alignment of the physical address. */
100 /* alignment of PPC_MEMSTART */
101 align = ~(PPC_MEMSTART-1) & PPC_MEMSTART;
102 /* set BAT block size to MIN(max_size, align) */
103 if (align && align < max_size)
104 max_size = align;
105
106 tot = total_lowmem;
107 for (bl = 128<<10; bl < max_size; bl <<= 1) {
108 if (bl * 2 > tot)
109 break;
110 }
111
112 setbat(2, KERNELBASE, PPC_MEMSTART, bl, _PAGE_RAM);
113 done = (unsigned long)bat_addrs[2].limit - KERNELBASE + 1;
114 if ((done < tot) && !bat_addrs[3].limit) {
115 /* use BAT3 to cover a bit more */
116 tot -= done;
117 for (bl = 128<<10; bl < max_size; bl <<= 1)
118 if (bl * 2 > tot)
119 break;
120 setbat(3, KERNELBASE+done, PPC_MEMSTART+done, bl, _PAGE_RAM);
121 done = (unsigned long)bat_addrs[3].limit - KERNELBASE + 1;
122 }
123
124 return done;
125#endif
126}
127
128/*
129 * Set up one of the I/D BAT (block address translation) register pairs.
130 * The parameters are not checked; in particular size must be a power
131 * of 2 between 128k and 256M.
132 */
133void __init setbat(int index, unsigned long virt, unsigned long phys,
134 unsigned int size, int flags)
135{
136 unsigned int bl;
137 int wimgxpp;
138 union ubat *bat = BATS[index];
139
140 if (((flags & _PAGE_NO_CACHE) == 0) &&
141 cpu_has_feature(CPU_FTR_NEED_COHERENT))
142 flags |= _PAGE_COHERENT;
143
144 bl = (size >> 17) - 1;
145 if (PVR_VER(mfspr(SPRN_PVR)) != 1) {
146 /* 603, 604, etc. */
147 /* Do DBAT first */
148 wimgxpp = flags & (_PAGE_WRITETHRU | _PAGE_NO_CACHE
149 | _PAGE_COHERENT | _PAGE_GUARDED);
150 wimgxpp |= (flags & _PAGE_RW)? BPP_RW: BPP_RX;
151 bat[1].word[0] = virt | (bl << 2) | 2; /* Vs=1, Vp=0 */
152 bat[1].word[1] = phys | wimgxpp;
153#ifndef CONFIG_KGDB /* want user access for breakpoints */
154 if (flags & _PAGE_USER)
155#endif
156 bat[1].bat.batu.vp = 1;
157 if (flags & _PAGE_GUARDED) {
158 /* G bit must be zero in IBATs */
159 bat[0].word[0] = bat[0].word[1] = 0;
160 } else {
161 /* make IBAT same as DBAT */
162 bat[0] = bat[1];
163 }
164 } else {
165 /* 601 cpu */
166 if (bl > BL_8M)
167 bl = BL_8M;
168 wimgxpp = flags & (_PAGE_WRITETHRU | _PAGE_NO_CACHE
169 | _PAGE_COHERENT);
170 wimgxpp |= (flags & _PAGE_RW)?
171 ((flags & _PAGE_USER)? PP_RWRW: PP_RWXX): PP_RXRX;
172 bat->word[0] = virt | wimgxpp | 4; /* Ks=0, Ku=1 */
173 bat->word[1] = phys | bl | 0x40; /* V=1 */
174 }
175
176 bat_addrs[index].start = virt;
177 bat_addrs[index].limit = virt + ((bl + 1) << 17) - 1;
178 bat_addrs[index].phys = phys;
179}
180
181/*
182 * Initialize the hash table and patch the instructions in hashtable.S.
183 */
184void __init MMU_init_hw(void)
185{
186 unsigned int hmask, mb, mb2;
187 unsigned int n_hpteg, lg_n_hpteg;
188
189 extern unsigned int hash_page_patch_A[];
190 extern unsigned int hash_page_patch_B[], hash_page_patch_C[];
191 extern unsigned int hash_page[];
192 extern unsigned int flush_hash_patch_A[], flush_hash_patch_B[];
193
194 if (!cpu_has_feature(CPU_FTR_HPTE_TABLE)) {
195 /*
196 * Put a blr (procedure return) instruction at the
197 * start of hash_page, since we can still get DSI
198 * exceptions on a 603.
199 */
200 hash_page[0] = 0x4e800020;
201 flush_icache_range((unsigned long) &hash_page[0],
202 (unsigned long) &hash_page[1]);
203 return;
204 }
205
206 if ( ppc_md.progress ) ppc_md.progress("hash:enter", 0x105);
207
208#ifdef CONFIG_PPC64BRIDGE
209#define LG_HPTEG_SIZE 7 /* 128 bytes per HPTEG */
210#define SDR1_LOW_BITS (lg_n_hpteg - 11)
211#define MIN_N_HPTEG 2048 /* min 256kB hash table */
212#else
213#define LG_HPTEG_SIZE 6 /* 64 bytes per HPTEG */
214#define SDR1_LOW_BITS ((n_hpteg - 1) >> 10)
215#define MIN_N_HPTEG 1024 /* min 64kB hash table */
216#endif
217
218#ifdef CONFIG_POWER4
219 /* The hash table has already been allocated and initialized
220 in prom.c */
221 n_hpteg = Hash_size >> LG_HPTEG_SIZE;
222 lg_n_hpteg = __ilog2(n_hpteg);
223
224 /* Remove the hash table from the available memory */
225 if (Hash)
226 reserve_phys_mem(__pa(Hash), Hash_size);
227
228#else /* CONFIG_POWER4 */
229 /*
230 * Allow 1 HPTE (1/8 HPTEG) for each page of memory.
231 * This is less than the recommended amount, but then
232 * Linux ain't AIX.
233 */
234 n_hpteg = total_memory / (PAGE_SIZE * 8);
235 if (n_hpteg < MIN_N_HPTEG)
236 n_hpteg = MIN_N_HPTEG;
237 lg_n_hpteg = __ilog2(n_hpteg);
238 if (n_hpteg & (n_hpteg - 1)) {
239 ++lg_n_hpteg; /* round up if not power of 2 */
240 n_hpteg = 1 << lg_n_hpteg;
241 }
242 Hash_size = n_hpteg << LG_HPTEG_SIZE;
243
244 /*
245 * Find some memory for the hash table.
246 */
247 if ( ppc_md.progress ) ppc_md.progress("hash:find piece", 0x322);
248 Hash = mem_pieces_find(Hash_size, Hash_size);
249 cacheable_memzero(Hash, Hash_size);
250 _SDR1 = __pa(Hash) | SDR1_LOW_BITS;
251#endif /* CONFIG_POWER4 */
252
253 Hash_end = (PTE *) ((unsigned long)Hash + Hash_size);
254
255 printk("Total memory = %ldMB; using %ldkB for hash table (at %p)\n",
256 total_memory >> 20, Hash_size >> 10, Hash);
257
258
259 /*
260 * Patch up the instructions in hashtable.S:create_hpte
261 */
262 if ( ppc_md.progress ) ppc_md.progress("hash:patch", 0x345);
263 Hash_mask = n_hpteg - 1;
264 hmask = Hash_mask >> (16 - LG_HPTEG_SIZE);
265 mb2 = mb = 32 - LG_HPTEG_SIZE - lg_n_hpteg;
266 if (lg_n_hpteg > 16)
267 mb2 = 16 - LG_HPTEG_SIZE;
268
269 hash_page_patch_A[0] = (hash_page_patch_A[0] & ~0xffff)
270 | ((unsigned int)(Hash) >> 16);
271 hash_page_patch_A[1] = (hash_page_patch_A[1] & ~0x7c0) | (mb << 6);
272 hash_page_patch_A[2] = (hash_page_patch_A[2] & ~0x7c0) | (mb2 << 6);
273 hash_page_patch_B[0] = (hash_page_patch_B[0] & ~0xffff) | hmask;
274 hash_page_patch_C[0] = (hash_page_patch_C[0] & ~0xffff) | hmask;
275
276 /*
277 * Ensure that the locations we've patched have been written
278 * out from the data cache and invalidated in the instruction
279 * cache, on those machines with split caches.
280 */
281 flush_icache_range((unsigned long) &hash_page_patch_A[0],
282 (unsigned long) &hash_page_patch_C[1]);
283
284 /*
285 * Patch up the instructions in hashtable.S:flush_hash_page
286 */
287 flush_hash_patch_A[0] = (flush_hash_patch_A[0] & ~0xffff)
288 | ((unsigned int)(Hash) >> 16);
289 flush_hash_patch_A[1] = (flush_hash_patch_A[1] & ~0x7c0) | (mb << 6);
290 flush_hash_patch_A[2] = (flush_hash_patch_A[2] & ~0x7c0) | (mb2 << 6);
291 flush_hash_patch_B[0] = (flush_hash_patch_B[0] & ~0xffff) | hmask;
292 flush_icache_range((unsigned long) &flush_hash_patch_A[0],
293 (unsigned long) &flush_hash_patch_B[1]);
294
295 if ( ppc_md.progress ) ppc_md.progress("hash:done", 0x205);
296}
diff --git a/arch/ppc/mm/tlb.c b/arch/ppc/mm/tlb.c
new file mode 100644
index 000000000000..6c3dc3c44c86
--- /dev/null
+++ b/arch/ppc/mm/tlb.c
@@ -0,0 +1,183 @@
1/*
2 * This file contains the routines for TLB flushing.
3 * On machines where the MMU uses a hash table to store virtual to
4 * physical translations, these routines flush entries from the
5 * hash table also.
6 * -- paulus
7 *
8 * Derived from arch/ppc/mm/init.c:
9 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
10 *
11 * Modifications by Paul Mackerras (PowerMac) (paulus@cs.anu.edu.au)
12 * and Cort Dougan (PReP) (cort@cs.nmt.edu)
13 * Copyright (C) 1996 Paul Mackerras
14 * Amiga/APUS changes by Jesper Skov (jskov@cygnus.co.uk).
15 *
16 * Derived from "arch/i386/mm/init.c"
17 * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds
18 *
19 * This program is free software; you can redistribute it and/or
20 * modify it under the terms of the GNU General Public License
21 * as published by the Free Software Foundation; either version
22 * 2 of the License, or (at your option) any later version.
23 *
24 */
25
26#include <linux/config.h>
27#include <linux/kernel.h>
28#include <linux/mm.h>
29#include <linux/init.h>
30#include <linux/highmem.h>
31#include <asm/tlbflush.h>
32#include <asm/tlb.h>
33
34#include "mmu_decl.h"
35
36/*
37 * Called when unmapping pages to flush entries from the TLB/hash table.
38 */
39void flush_hash_entry(struct mm_struct *mm, pte_t *ptep, unsigned long addr)
40{
41 unsigned long ptephys;
42
43 if (Hash != 0) {
44 ptephys = __pa(ptep) & PAGE_MASK;
45 flush_hash_pages(mm->context, addr, ptephys, 1);
46 }
47}
48
49/*
50 * Called by ptep_set_access_flags, must flush on CPUs for which the
51 * DSI handler can't just "fixup" the TLB on a write fault
52 */
53void flush_tlb_page_nohash(struct vm_area_struct *vma, unsigned long addr)
54{
55 if (Hash != 0)
56 return;
57 _tlbie(addr);
58}
59
60/*
61 * Called at the end of a mmu_gather operation to make sure the
62 * TLB flush is completely done.
63 */
64void tlb_flush(struct mmu_gather *tlb)
65{
66 if (Hash == 0) {
67 /*
68 * 603 needs to flush the whole TLB here since
69 * it doesn't use a hash table.
70 */
71 _tlbia();
72 }
73}
74
75/*
76 * TLB flushing:
77 *
78 * - flush_tlb_mm(mm) flushes the specified mm context TLB's
79 * - flush_tlb_page(vma, vmaddr) flushes one page
80 * - flush_tlb_range(vma, start, end) flushes a range of pages
81 * - flush_tlb_kernel_range(start, end) flushes kernel pages
82 *
83 * since the hardware hash table functions as an extension of the
84 * tlb as far as the linux tables are concerned, flush it too.
85 * -- Cort
86 */
87
88/*
89 * 750 SMP is a Bad Idea because the 750 doesn't broadcast all
90 * the cache operations on the bus. Hence we need to use an IPI
91 * to get the other CPU(s) to invalidate their TLBs.
92 */
93#ifdef CONFIG_SMP_750
94#define FINISH_FLUSH smp_send_tlb_invalidate(0)
95#else
96#define FINISH_FLUSH do { } while (0)
97#endif
98
99static void flush_range(struct mm_struct *mm, unsigned long start,
100 unsigned long end)
101{
102 pmd_t *pmd;
103 unsigned long pmd_end;
104 int count;
105 unsigned int ctx = mm->context;
106
107 if (Hash == 0) {
108 _tlbia();
109 return;
110 }
111 start &= PAGE_MASK;
112 if (start >= end)
113 return;
114 end = (end - 1) | ~PAGE_MASK;
115 pmd = pmd_offset(pgd_offset(mm, start), start);
116 for (;;) {
117 pmd_end = ((start + PGDIR_SIZE) & PGDIR_MASK) - 1;
118 if (pmd_end > end)
119 pmd_end = end;
120 if (!pmd_none(*pmd)) {
121 count = ((pmd_end - start) >> PAGE_SHIFT) + 1;
122 flush_hash_pages(ctx, start, pmd_val(*pmd), count);
123 }
124 if (pmd_end == end)
125 break;
126 start = pmd_end + 1;
127 ++pmd;
128 }
129}
130
131/*
132 * Flush kernel TLB entries in the given range
133 */
134void flush_tlb_kernel_range(unsigned long start, unsigned long end)
135{
136 flush_range(&init_mm, start, end);
137 FINISH_FLUSH;
138}
139
140/*
141 * Flush all the (user) entries for the address space described by mm.
142 */
143void flush_tlb_mm(struct mm_struct *mm)
144{
145 struct vm_area_struct *mp;
146
147 if (Hash == 0) {
148 _tlbia();
149 return;
150 }
151
152 for (mp = mm->mmap; mp != NULL; mp = mp->vm_next)
153 flush_range(mp->vm_mm, mp->vm_start, mp->vm_end);
154 FINISH_FLUSH;
155}
156
157void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr)
158{
159 struct mm_struct *mm;
160 pmd_t *pmd;
161
162 if (Hash == 0) {
163 _tlbie(vmaddr);
164 return;
165 }
166 mm = (vmaddr < TASK_SIZE)? vma->vm_mm: &init_mm;
167 pmd = pmd_offset(pgd_offset(mm, vmaddr), vmaddr);
168 if (!pmd_none(*pmd))
169 flush_hash_pages(mm->context, vmaddr, pmd_val(*pmd), 1);
170 FINISH_FLUSH;
171}
172
173/*
174 * For each address in the range, find the pte for the address
175 * and check _PAGE_HASHPTE bit; if it is set, find and destroy
176 * the corresponding HPTE.
177 */
178void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
179 unsigned long end)
180{
181 flush_range(vma->vm_mm, start, end);
182 FINISH_FLUSH;
183}
diff --git a/arch/ppc/oprofile/Kconfig b/arch/ppc/oprofile/Kconfig
new file mode 100644
index 000000000000..19d37730b664
--- /dev/null
+++ b/arch/ppc/oprofile/Kconfig
@@ -0,0 +1,23 @@
1
2menu "Profiling support"
3 depends on EXPERIMENTAL
4
5config PROFILING
6 bool "Profiling support (EXPERIMENTAL)"
7 help
8 Say Y here to enable the extended profiling support mechanisms used
9 by profilers such as OProfile.
10
11
12config OPROFILE
13 tristate "OProfile system profiling (EXPERIMENTAL)"
14 depends on PROFILING
15 help
16 OProfile is a profiling system capable of profiling the
17 whole system, include the kernel, kernel modules, libraries,
18 and applications.
19
20 If unsure, say N.
21
22endmenu
23
diff --git a/arch/ppc/oprofile/Makefile b/arch/ppc/oprofile/Makefile
new file mode 100644
index 000000000000..e2218d32a4eb
--- /dev/null
+++ b/arch/ppc/oprofile/Makefile
@@ -0,0 +1,14 @@
1obj-$(CONFIG_OPROFILE) += oprofile.o
2
3DRIVER_OBJS := $(addprefix ../../../drivers/oprofile/, \
4 oprof.o cpu_buffer.o buffer_sync.o \
5 event_buffer.o oprofile_files.o \
6 oprofilefs.o oprofile_stats.o \
7 timer_int.o )
8
9oprofile-y := $(DRIVER_OBJS) common.o
10
11ifeq ($(CONFIG_FSL_BOOKE),y)
12 oprofile-y += op_model_fsl_booke.o
13endif
14
diff --git a/arch/ppc/oprofile/common.c b/arch/ppc/oprofile/common.c
new file mode 100644
index 000000000000..3169c67abea7
--- /dev/null
+++ b/arch/ppc/oprofile/common.c
@@ -0,0 +1,161 @@
1/*
2 * PPC 32 oprofile support
3 * Based on PPC64 oprofile support
4 * Copyright (C) 2004 Anton Blanchard <anton@au.ibm.com>, IBM
5 *
6 * Copyright (C) Freescale Semiconductor, Inc 2004
7 *
8 * Author: Andy Fleming
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version
13 * 2 of the License, or (at your option) any later version.
14 */
15
16#include <linux/oprofile.h>
17#include <linux/slab.h>
18#include <linux/init.h>
19#include <linux/smp.h>
20#include <linux/errno.h>
21#include <asm/ptrace.h>
22#include <asm/system.h>
23#include <asm/perfmon.h>
24#include <asm/cputable.h>
25
26#include "op_impl.h"
27
28static struct op_ppc32_model *model;
29
30static struct op_counter_config ctr[OP_MAX_COUNTER];
31static struct op_system_config sys;
32
33static void op_handle_interrupt(struct pt_regs *regs)
34{
35 model->handle_interrupt(regs, ctr);
36}
37
38static int op_ppc32_setup(void)
39{
40 /* Install our interrupt handler into the existing hook. */
41 if(request_perfmon_irq(&op_handle_interrupt))
42 return -EBUSY;
43
44 mb();
45
46 /* Pre-compute the values to stuff in the hardware registers. */
47 model->reg_setup(ctr, &sys, model->num_counters);
48
49#if 0
50 /* FIXME: Make multi-cpu work */
51 /* Configure the registers on all cpus. */
52 on_each_cpu(model->reg_setup, NULL, 0, 1);
53#endif
54
55 return 0;
56}
57
58static void op_ppc32_shutdown(void)
59{
60 mb();
61
62 /* Remove our interrupt handler. We may be removing this module. */
63 free_perfmon_irq();
64}
65
66static void op_ppc32_cpu_start(void *dummy)
67{
68 model->start(ctr);
69}
70
71static int op_ppc32_start(void)
72{
73 on_each_cpu(op_ppc32_cpu_start, NULL, 0, 1);
74 return 0;
75}
76
77static inline void op_ppc32_cpu_stop(void *dummy)
78{
79 model->stop();
80}
81
82static void op_ppc32_stop(void)
83{
84 on_each_cpu(op_ppc32_cpu_stop, NULL, 0, 1);
85}
86
87static int op_ppc32_create_files(struct super_block *sb, struct dentry *root)
88{
89 int i;
90
91 for (i = 0; i < model->num_counters; ++i) {
92 struct dentry *dir;
93 char buf[3];
94
95 snprintf(buf, sizeof buf, "%d", i);
96 dir = oprofilefs_mkdir(sb, root, buf);
97
98 oprofilefs_create_ulong(sb, dir, "enabled", &ctr[i].enabled);
99 oprofilefs_create_ulong(sb, dir, "event", &ctr[i].event);
100 oprofilefs_create_ulong(sb, dir, "count", &ctr[i].count);
101 oprofilefs_create_ulong(sb, dir, "kernel", &ctr[i].kernel);
102 oprofilefs_create_ulong(sb, dir, "user", &ctr[i].user);
103
104 /* FIXME: Not sure if this is used */
105 oprofilefs_create_ulong(sb, dir, "unit_mask", &ctr[i].unit_mask);
106 }
107
108 oprofilefs_create_ulong(sb, root, "enable_kernel", &sys.enable_kernel);
109 oprofilefs_create_ulong(sb, root, "enable_user", &sys.enable_user);
110
111 /* Default to tracing both kernel and user */
112 sys.enable_kernel = 1;
113 sys.enable_user = 1;
114
115 return 0;
116}
117
118static struct oprofile_operations oprof_ppc32_ops = {
119 .create_files = op_ppc32_create_files,
120 .setup = op_ppc32_setup,
121 .shutdown = op_ppc32_shutdown,
122 .start = op_ppc32_start,
123 .stop = op_ppc32_stop,
124 .cpu_type = NULL /* To be filled in below. */
125};
126
127int __init oprofile_arch_init(struct oprofile_operations *ops)
128{
129 char *name;
130 int cpu_id = smp_processor_id();
131
132#ifdef CONFIG_FSL_BOOKE
133 model = &op_model_fsl_booke;
134#else
135 return -ENODEV;
136#endif
137
138 name = kmalloc(32, GFP_KERNEL);
139
140 if (NULL == name)
141 return -ENOMEM;
142
143 sprintf(name, "ppc/%s", cur_cpu_spec[cpu_id]->cpu_name);
144
145 oprof_ppc32_ops.cpu_type = name;
146
147 model->num_counters = cur_cpu_spec[cpu_id]->num_pmcs;
148
149 *ops = oprof_ppc32_ops;
150
151 printk(KERN_INFO "oprofile: using %s performance monitoring.\n",
152 oprof_ppc32_ops.cpu_type);
153
154 return 0;
155}
156
157void oprofile_arch_exit(void)
158{
159 kfree(oprof_ppc32_ops.cpu_type);
160 oprof_ppc32_ops.cpu_type = NULL;
161}
diff --git a/arch/ppc/oprofile/op_impl.h b/arch/ppc/oprofile/op_impl.h
new file mode 100644
index 000000000000..bc336dc971e3
--- /dev/null
+++ b/arch/ppc/oprofile/op_impl.h
@@ -0,0 +1,45 @@
1/*
2 * Copyright (C) 2004 Anton Blanchard <anton@au.ibm.com>, IBM
3 *
4 * Based on alpha version.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef OP_IMPL_H
13#define OP_IMPL_H 1
14
15#define OP_MAX_COUNTER 8
16
17/* Per-counter configuration as set via oprofilefs. */
18struct op_counter_config {
19 unsigned long enabled;
20 unsigned long event;
21 unsigned long count;
22 unsigned long kernel;
23 unsigned long user;
24 unsigned long unit_mask;
25};
26
27/* System-wide configuration as set via oprofilefs. */
28struct op_system_config {
29 unsigned long enable_kernel;
30 unsigned long enable_user;
31};
32
33/* Per-arch configuration */
34struct op_ppc32_model {
35 void (*reg_setup) (struct op_counter_config *,
36 struct op_system_config *,
37 int num_counters);
38 void (*start) (struct op_counter_config *);
39 void (*stop) (void);
40 void (*handle_interrupt) (struct pt_regs *,
41 struct op_counter_config *);
42 int num_counters;
43};
44
45#endif /* OP_IMPL_H */
diff --git a/arch/ppc/oprofile/op_model_fsl_booke.c b/arch/ppc/oprofile/op_model_fsl_booke.c
new file mode 100644
index 000000000000..fc9c859358c6
--- /dev/null
+++ b/arch/ppc/oprofile/op_model_fsl_booke.c
@@ -0,0 +1,184 @@
1/*
2 * oprofile/op_model_e500.c
3 *
4 * Freescale Book-E oprofile support, based on ppc64 oprofile support
5 * Copyright (C) 2004 Anton Blanchard <anton@au.ibm.com>, IBM
6 *
7 * Copyright (c) 2004 Freescale Semiconductor, Inc
8 *
9 * Author: Andy Fleming
10 * Maintainer: Kumar Gala <Kumar.Gala@freescale.com>
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version
15 * 2 of the License, or (at your option) any later version.
16 */
17
18#include <linux/oprofile.h>
19#include <linux/init.h>
20#include <linux/smp.h>
21#include <asm/ptrace.h>
22#include <asm/system.h>
23#include <asm/processor.h>
24#include <asm/cputable.h>
25#include <asm/reg_booke.h>
26#include <asm/page.h>
27#include <asm/perfmon.h>
28
29#include "op_impl.h"
30
31static unsigned long reset_value[OP_MAX_COUNTER];
32
33static int num_counters;
34static int oprofile_running;
35
36static inline unsigned int ctr_read(unsigned int i)
37{
38 switch(i) {
39 case 0:
40 return mfpmr(PMRN_PMC0);
41 case 1:
42 return mfpmr(PMRN_PMC1);
43 case 2:
44 return mfpmr(PMRN_PMC2);
45 case 3:
46 return mfpmr(PMRN_PMC3);
47 default:
48 return 0;
49 }
50}
51
52static inline void ctr_write(unsigned int i, unsigned int val)
53{
54 switch(i) {
55 case 0:
56 mtpmr(PMRN_PMC0, val);
57 break;
58 case 1:
59 mtpmr(PMRN_PMC1, val);
60 break;
61 case 2:
62 mtpmr(PMRN_PMC2, val);
63 break;
64 case 3:
65 mtpmr(PMRN_PMC3, val);
66 break;
67 default:
68 break;
69 }
70}
71
72
73static void fsl_booke_reg_setup(struct op_counter_config *ctr,
74 struct op_system_config *sys,
75 int num_ctrs)
76{
77 int i;
78
79 num_counters = num_ctrs;
80
81 /* freeze all counters */
82 pmc_stop_ctrs();
83
84 /* Our counters count up, and "count" refers to
85 * how much before the next interrupt, and we interrupt
86 * on overflow. So we calculate the starting value
87 * which will give us "count" until overflow.
88 * Then we set the events on the enabled counters */
89 for (i = 0; i < num_counters; ++i) {
90 reset_value[i] = 0x80000000UL - ctr[i].count;
91
92 init_pmc_stop(i);
93
94 set_pmc_event(i, ctr[i].event);
95
96 set_pmc_user_kernel(i, ctr[i].user, ctr[i].kernel);
97 }
98}
99
100static void fsl_booke_start(struct op_counter_config *ctr)
101{
102 int i;
103
104 mtmsr(mfmsr() | MSR_PMM);
105
106 for (i = 0; i < num_counters; ++i) {
107 if (ctr[i].enabled) {
108 ctr_write(i, reset_value[i]);
109 /* Set Each enabled counterd to only
110 * count when the Mark bit is not set */
111 set_pmc_marked(i, 1, 0);
112 pmc_start_ctr(i, 1);
113 } else {
114 ctr_write(i, 0);
115
116 /* Set the ctr to be stopped */
117 pmc_start_ctr(i, 0);
118 }
119 }
120
121 /* Clear the freeze bit, and enable the interrupt.
122 * The counters won't actually start until the rfi clears
123 * the PMM bit */
124 pmc_start_ctrs(1);
125
126 oprofile_running = 1;
127
128 pr_debug("start on cpu %d, pmgc0 %x\n", smp_processor_id(),
129 mfpmr(PMRN_PMGC0));
130}
131
132static void fsl_booke_stop(void)
133{
134 /* freeze counters */
135 pmc_stop_ctrs();
136
137 oprofile_running = 0;
138
139 pr_debug("stop on cpu %d, pmgc0 %x\n", smp_processor_id(),
140 mfpmr(PMRN_PMGC0));
141
142 mb();
143}
144
145
146static void fsl_booke_handle_interrupt(struct pt_regs *regs,
147 struct op_counter_config *ctr)
148{
149 unsigned long pc;
150 int is_kernel;
151 int val;
152 int i;
153
154 /* set the PMM bit (see comment below) */
155 mtmsr(mfmsr() | MSR_PMM);
156
157 pc = regs->nip;
158 is_kernel = (pc >= KERNELBASE);
159
160 for (i = 0; i < num_counters; ++i) {
161 val = ctr_read(i);
162 if (val < 0) {
163 if (oprofile_running && ctr[i].enabled) {
164 oprofile_add_pc(pc, is_kernel, i);
165 ctr_write(i, reset_value[i]);
166 } else {
167 ctr_write(i, 0);
168 }
169 }
170 }
171
172 /* The freeze bit was set by the interrupt. */
173 /* Clear the freeze bit, and reenable the interrupt.
174 * The counters won't actually start until the rfi clears
175 * the PMM bit */
176 pmc_start_ctrs(1);
177}
178
179struct op_ppc32_model op_model_fsl_booke = {
180 .reg_setup = fsl_booke_reg_setup,
181 .start = fsl_booke_start,
182 .stop = fsl_booke_stop,
183 .handle_interrupt = fsl_booke_handle_interrupt,
184};
diff --git a/arch/ppc/platforms/4xx/Kconfig b/arch/ppc/platforms/4xx/Kconfig
new file mode 100644
index 000000000000..a0612a86455a
--- /dev/null
+++ b/arch/ppc/platforms/4xx/Kconfig
@@ -0,0 +1,247 @@
1config 4xx
2 bool
3 depends on 40x || 44x
4 default y
5
6menu "IBM 4xx options"
7 depends on 4xx
8
9choice
10 prompt "Machine Type"
11 depends on 40x
12 default WALNUT
13
14config ASH
15 bool "Ash"
16 help
17 This option enables support for the IBM NP405H evaluation board.
18
19config BUBINGA
20 bool "Bubinga"
21 help
22 This option enables support for the IBM 405EP evaluation board.
23
24config CPCI405
25 bool "CPCI405"
26 help
27 This option enables support for the CPCI405 board.
28
29config EP405
30 bool "EP405/EP405PC"
31 help
32 This option enables support for the EP405/EP405PC boards.
33
34config OAK
35 bool "Oak"
36 help
37 This option enables support for the IBM 403GCX evaluation board.
38
39config REDWOOD_5
40 bool "Redwood-5"
41 help
42 This option enables support for the IBM STB04 evaluation board.
43
44config REDWOOD_6
45 bool "Redwood-6"
46 help
47 This option enables support for the IBM STBx25xx evaluation board.
48
49config SYCAMORE
50 bool "Sycamore"
51 help
52 This option enables support for the IBM PPC405GPr evaluation board.
53
54config WALNUT
55 bool "Walnut"
56 help
57 This option enables support for the IBM PPC405GP evaluation board.
58
59config XILINX_ML300
60 bool "Xilinx-ML300"
61 help
62 This option enables support for the Xilinx ML300 evaluation board.
63
64endchoice
65
66choice
67 prompt "Machine Type"
68 depends on 44x
69 default EBONY
70
71config EBONY
72 bool "Ebony"
73 help
74 This option enables support for the IBM PPC440GP evaluation board.
75
76config LUAN
77 bool "Luan"
78 help
79 This option enables support for the IBM PPC440SP evaluation board.
80
81config OCOTEA
82 bool "Ocotea"
83 help
84 This option enables support for the IBM PPC440GX evaluation board.
85
86endchoice
87
88config EP405PC
89 bool "EP405PC Support"
90 depends on EP405
91
92
93# It's often necessary to know the specific 4xx processor type.
94# Fortunately, it is impled (so far) from the board type, so we
95# don't need to ask more redundant questions.
96config NP405H
97 bool
98 depends on ASH
99 default y
100
101config 440GP
102 bool
103 depends on EBONY
104 default y
105
106config 440GX
107 bool
108 depends on OCOTEA
109 default y
110
111config 440SP
112 bool
113 depends on LUAN
114 default y
115
116config 440
117 bool
118 depends on 440GP || 440SP
119 default y
120
121config 440A
122 bool
123 depends on 440GX
124 default y
125
126# All 405-based cores up until the 405GPR and 405EP have this errata.
127config IBM405_ERR77
128 bool
129 depends on 40x && !403GCX && !405GPR
130 default y
131
132# All 40x-based cores, up until the 405GPR and 405EP have this errata.
133config IBM405_ERR51
134 bool
135 depends on 40x && !405GPR
136 default y
137
138config BOOKE
139 bool
140 depends on 44x
141 default y
142
143config IBM_OCP
144 bool
145 depends on ASH || BUBINGA || CPCI405 || EBONY || EP405 || LUAN || OCOTEA || REDWOOD_5 || REDWOOD_6 || SYCAMORE || WALNUT
146 default y
147
148config XILINX_OCP
149 bool
150 depends on XILINX_ML300
151 default y
152
153config IBM_EMAC4
154 bool
155 depends on 440GX || 440SP
156 default y
157
158config BIOS_FIXUP
159 bool
160 depends on BUBINGA || EP405 || SYCAMORE || WALNUT
161 default y
162
163config 403GCX
164 bool
165 depends OAK
166 default y
167
168config 405EP
169 bool
170 depends on BUBINGA
171 default y
172
173config 405GP
174 bool
175 depends on CPCI405 || EP405 || WALNUT
176 default y
177
178config 405GPR
179 bool
180 depends on SYCAMORE
181 default y
182
183config VIRTEX_II_PRO
184 bool
185 depends on XILINX_ML300
186 default y
187
188config STB03xxx
189 bool
190 depends on REDWOOD_5 || REDWOOD_6
191 default y
192
193config EMBEDDEDBOOT
194 bool
195 depends on EP405 || XILINX_ML300
196 default y
197
198config IBM_OPENBIOS
199 bool
200 depends on ASH || BUBINGA || REDWOOD_5 || REDWOOD_6 || SYCAMORE || WALNUT
201 default y
202
203config PPC4xx_DMA
204 bool "PPC4xx DMA controller support"
205 depends on 4xx
206
207config PPC4xx_EDMA
208 bool
209 depends on !STB03xxx && PPC4xx_DMA
210 default y
211
212config PPC_GEN550
213 bool
214 depends on 4xx
215 default y
216
217config PM
218 bool "Power Management support (EXPERIMENTAL)"
219 depends on 4xx && EXPERIMENTAL
220
221choice
222 prompt "TTYS0 device and default console"
223 depends on 40x
224 default UART0_TTYS0
225
226config UART0_TTYS0
227 bool "UART0"
228
229config UART0_TTYS1
230 bool "UART1"
231
232endchoice
233
234config SERIAL_SICC
235 bool "SICC Serial port support"
236 depends on STB03xxx
237
238config UART1_DFLT_CONSOLE
239 bool
240 depends on SERIAL_SICC && UART0_TTYS1
241 default y
242
243config SERIAL_SICC_CONSOLE
244 bool
245 depends on SERIAL_SICC && UART0_TTYS1
246 default y
247endmenu
diff --git a/arch/ppc/platforms/4xx/Makefile b/arch/ppc/platforms/4xx/Makefile
new file mode 100644
index 000000000000..ea470c6adbb6
--- /dev/null
+++ b/arch/ppc/platforms/4xx/Makefile
@@ -0,0 +1,27 @@
1#
2# Makefile for the PowerPC 4xx linux kernel.
3
4obj-$(CONFIG_ASH) += ash.o
5obj-$(CONFIG_CPCI405) += cpci405.o
6obj-$(CONFIG_EBONY) += ebony.o
7obj-$(CONFIG_EP405) += ep405.o
8obj-$(CONFIG_BUBINGA) += bubinga.o
9obj-$(CONFIG_LUAN) += luan.o
10obj-$(CONFIG_OAK) += oak.o
11obj-$(CONFIG_OCOTEA) += ocotea.o
12obj-$(CONFIG_REDWOOD_5) += redwood5.o
13obj-$(CONFIG_REDWOOD_6) += redwood6.o
14obj-$(CONFIG_SYCAMORE) += sycamore.o
15obj-$(CONFIG_WALNUT) += walnut.o
16obj-$(CONFIG_XILINX_ML300) += xilinx_ml300.o
17
18obj-$(CONFIG_405GP) += ibm405gp.o
19obj-$(CONFIG_REDWOOD_5) += ibmstb4.o
20obj-$(CONFIG_NP405H) += ibmnp405h.o
21obj-$(CONFIG_REDWOOD_6) += ibmstbx25.o
22obj-$(CONFIG_440GP) += ibm440gp.o
23obj-$(CONFIG_440GX) += ibm440gx.o
24obj-$(CONFIG_440SP) += ibm440sp.o
25obj-$(CONFIG_405EP) += ibm405ep.o
26obj-$(CONFIG_405GPR) += ibm405gpr.o
27obj-$(CONFIG_VIRTEX_II_PRO) += virtex-ii_pro.o
diff --git a/arch/ppc/platforms/4xx/ash.c b/arch/ppc/platforms/4xx/ash.c
new file mode 100644
index 000000000000..ce2911793716
--- /dev/null
+++ b/arch/ppc/platforms/4xx/ash.c
@@ -0,0 +1,250 @@
1/*
2 * arch/ppc/platforms/4xx/ash.c
3 *
4 * Support for the IBM NP405H ash eval board
5 *
6 * Author: Armin Kuster <akuster@mvista.com>
7 *
8 * 2001-2002 (c) MontaVista, Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
11 * or implied.
12 */
13#include <linux/config.h>
14#include <linux/init.h>
15#include <linux/pagemap.h>
16#include <linux/pci.h>
17
18#include <asm/machdep.h>
19#include <asm/pci-bridge.h>
20#include <asm/io.h>
21#include <asm/ocp.h>
22#include <asm/ibm_ocp_pci.h>
23#include <asm/todc.h>
24
25#ifdef DEBUG
26#define DBG(x...) printk(x)
27#else
28#define DBG(x...)
29#endif
30
31void *ash_rtc_base;
32
33/* Some IRQs unique to Walnut.
34 * Used by the generic 405 PCI setup functions in ppc4xx_pci.c
35 */
36int __init
37ppc405_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
38{
39 static char pci_irq_table[][4] =
40 /*
41 * PCI IDSEL/INTPIN->INTLINE
42 * A B C D
43 */
44 {
45 {24, 24, 24, 24}, /* IDSEL 1 - PCI slot 1 */
46 {25, 25, 25, 25}, /* IDSEL 2 - PCI slot 2 */
47 {26, 26, 26, 26}, /* IDSEL 3 - PCI slot 3 */
48 {27, 27, 27, 27}, /* IDSEL 4 - PCI slot 4 */
49 };
50
51 const long min_idsel = 1, max_idsel = 4, irqs_per_slot = 4;
52 return PCI_IRQ_TABLE_LOOKUP;
53}
54
55void __init
56ash_setup_arch(void)
57{
58 ppc4xx_setup_arch();
59
60 ibm_ocp_set_emac(0, 3);
61
62#ifdef CONFIG_DEBUG_BRINGUP
63 int i;
64 printk("\n");
65 printk("machine\t: %s\n", PPC4xx_MACHINE_NAME);
66 printk("\n");
67 printk("bi_s_version\t %s\n", bip->bi_s_version);
68 printk("bi_r_version\t %s\n", bip->bi_r_version);
69 printk("bi_memsize\t 0x%8.8x\t %dMBytes\n", bip->bi_memsize,
70 bip->bi_memsize / (1024 * 1000));
71 for (i = 0; i < EMAC_NUMS; i++) {
72 printk("bi_enetaddr %d\t %2.2x%2.2x%2.2x-%2.2x%2.2x%2.2x\n", i,
73 bip->bi_enetaddr[i][0], bip->bi_enetaddr[i][1],
74 bip->bi_enetaddr[i][2], bip->bi_enetaddr[i][3],
75 bip->bi_enetaddr[i][4], bip->bi_enetaddr[i][5]);
76 }
77 printk("bi_pci_enetaddr %d\t %2.2x%2.2x%2.2x-%2.2x%2.2x%2.2x\n", 0,
78 bip->bi_pci_enetaddr[0], bip->bi_pci_enetaddr[1],
79 bip->bi_pci_enetaddr[2], bip->bi_pci_enetaddr[3],
80 bip->bi_pci_enetaddr[4], bip->bi_pci_enetaddr[5]);
81
82 printk("bi_intfreq\t 0x%8.8x\t clock:\t %dMhz\n",
83 bip->bi_intfreq, bip->bi_intfreq / 1000000);
84
85 printk("bi_busfreq\t 0x%8.8x\t plb bus clock:\t %dMHz\n",
86 bip->bi_busfreq, bip->bi_busfreq / 1000000);
87 printk("bi_pci_busfreq\t 0x%8.8x\t pci bus clock:\t %dMHz\n",
88 bip->bi_pci_busfreq, bip->bi_pci_busfreq / 1000000);
89
90 printk("\n");
91#endif
92 /* RTC step for ash */
93 ash_rtc_base = (void *) ASH_RTC_VADDR;
94 TODC_INIT(TODC_TYPE_DS1743, ash_rtc_base, ash_rtc_base, ash_rtc_base,
95 8);
96}
97
98void __init
99bios_fixup(struct pci_controller *hose, struct pcil0_regs *pcip)
100{
101 /*
102 * Expected PCI mapping:
103 *
104 * PLB addr PCI memory addr
105 * --------------------- ---------------------
106 * 0000'0000 - 7fff'ffff <--- 0000'0000 - 7fff'ffff
107 * 8000'0000 - Bfff'ffff ---> 8000'0000 - Bfff'ffff
108 *
109 * PLB addr PCI io addr
110 * --------------------- ---------------------
111 * e800'0000 - e800'ffff ---> 0000'0000 - 0001'0000
112 *
113 * The following code is simplified by assuming that the bootrom
114 * has been well behaved in following this mapping.
115 */
116
117#ifdef DEBUG
118 int i;
119
120 printk("ioremap PCLIO_BASE = 0x%x\n", pcip);
121 printk("PCI bridge regs before fixup \n");
122 for (i = 0; i <= 2; i++) {
123 printk(" pmm%dma\t0x%x\n", i, in_le32(&(pcip->pmm[i].ma)));
124 printk(" pmm%dla\t0x%x\n", i, in_le32(&(pcip->pmm[i].la)));
125 printk(" pmm%dpcila\t0x%x\n", i,
126 in_le32(&(pcip->pmm[i].pcila)));
127 printk(" pmm%dpciha\t0x%x\n", i,
128 in_le32(&(pcip->pmm[i].pciha)));
129 }
130 printk(" ptm1ms\t0x%x\n", in_le32(&(pcip->ptm1ms)));
131 printk(" ptm1la\t0x%x\n", in_le32(&(pcip->ptm1la)));
132 printk(" ptm2ms\t0x%x\n", in_le32(&(pcip->ptm2ms)));
133 printk(" ptm2la\t0x%x\n", in_le32(&(pcip->ptm2la)));
134 for (bar = PCI_BASE_ADDRESS_1; bar <= PCI_BASE_ADDRESS_2; bar += 4) {
135 early_read_config_dword(hose, hose->first_busno,
136 PCI_FUNC(hose->first_busno), bar,
137 &bar_response);
138 DBG("BUS %d, device %d, Function %d bar 0x%8.8x is 0x%8.8x\n",
139 hose->first_busno, PCI_SLOT(hose->first_busno),
140 PCI_FUNC(hose->first_busno), bar, bar_response);
141 }
142
143#endif
144 if (ppc_md.progress)
145 ppc_md.progress("bios_fixup(): enter", 0x800);
146
147 /* added for IBM boot rom version 1.15 bios bar changes -AK */
148
149 /* Disable region first */
150 out_le32((void *) &(pcip->pmm[0].ma), 0x00000000);
151 /* PLB starting addr, PCI: 0x80000000 */
152 out_le32((void *) &(pcip->pmm[0].la), 0x80000000);
153 /* PCI start addr, 0x80000000 */
154 out_le32((void *) &(pcip->pmm[0].pcila), PPC405_PCI_MEM_BASE);
155 /* 512MB range of PLB to PCI */
156 out_le32((void *) &(pcip->pmm[0].pciha), 0x00000000);
157 /* Enable no pre-fetch, enable region */
158 out_le32((void *) &(pcip->pmm[0].ma), ((0xffffffff -
159 (PPC405_PCI_UPPER_MEM -
160 PPC405_PCI_MEM_BASE)) | 0x01));
161
162 /* Disable region one */
163 out_le32((void *) &(pcip->pmm[1].ma), 0x00000000);
164 out_le32((void *) &(pcip->pmm[1].la), 0x00000000);
165 out_le32((void *) &(pcip->pmm[1].pcila), 0x00000000);
166 out_le32((void *) &(pcip->pmm[1].pciha), 0x00000000);
167 out_le32((void *) &(pcip->pmm[1].ma), 0x00000000);
168
169 /* Disable region two */
170 out_le32((void *) &(pcip->pmm[2].ma), 0x00000000);
171 out_le32((void *) &(pcip->pmm[2].la), 0x00000000);
172 out_le32((void *) &(pcip->pmm[2].pcila), 0x00000000);
173 out_le32((void *) &(pcip->pmm[2].pciha), 0x00000000);
174 out_le32((void *) &(pcip->pmm[2].ma), 0x00000000);
175
176 /* Enable PTM1 and PTM2, mapped to PLB address 0. */
177
178 out_le32((void *) &(pcip->ptm1la), 0x00000000);
179 out_le32((void *) &(pcip->ptm1ms), 0x00000001);
180 out_le32((void *) &(pcip->ptm2la), 0x00000000);
181 out_le32((void *) &(pcip->ptm2ms), 0x00000001);
182
183 /* Write zero to PTM1 BAR. */
184
185 early_write_config_dword(hose, hose->first_busno,
186 PCI_FUNC(hose->first_busno),
187 PCI_BASE_ADDRESS_1,
188 0x00000000);
189
190 /* Disable PTM2 (unused) */
191
192 out_le32((void *) &(pcip->ptm2la), 0x00000000);
193 out_le32((void *) &(pcip->ptm2ms), 0x00000000);
194
195 /* end work arround */
196 if (ppc_md.progress)
197 ppc_md.progress("bios_fixup(): done", 0x800);
198
199#ifdef DEBUG
200 printk("PCI bridge regs after fixup \n");
201 for (i = 0; i <= 2; i++) {
202 printk(" pmm%dma\t0x%x\n", i, in_le32(&(pcip->pmm[i].ma)));
203 printk(" pmm%dla\t0x%x\n", i, in_le32(&(pcip->pmm[i].la)));
204 printk(" pmm%dpcila\t0x%x\n", i,
205 in_le32(&(pcip->pmm[i].pcila)));
206 printk(" pmm%dpciha\t0x%x\n", i,
207 in_le32(&(pcip->pmm[i].pciha)));
208 }
209 printk(" ptm1ms\t0x%x\n", in_le32(&(pcip->ptm1ms)));
210 printk(" ptm1la\t0x%x\n", in_le32(&(pcip->ptm1la)));
211 printk(" ptm2ms\t0x%x\n", in_le32(&(pcip->ptm2ms)));
212 printk(" ptm2la\t0x%x\n", in_le32(&(pcip->ptm2la)));
213
214 for (bar = PCI_BASE_ADDRESS_1; bar <= PCI_BASE_ADDRESS_2; bar += 4) {
215 early_read_config_dword(hose, hose->first_busno,
216 PCI_FUNC(hose->first_busno), bar,
217 &bar_response);
218 DBG("BUS %d, device %d, Function %d bar 0x%8.8x is 0x%8.8x\n",
219 hose->first_busno, PCI_SLOT(hose->first_busno),
220 PCI_FUNC(hose->first_busno), bar, bar_response);
221 }
222
223
224#endif
225}
226
227void __init
228ash_map_io(void)
229{
230 ppc4xx_map_io();
231 io_block_mapping(ASH_RTC_VADDR, ASH_RTC_PADDR, ASH_RTC_SIZE, _PAGE_IO);
232}
233
234void __init
235platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
236 unsigned long r6, unsigned long r7)
237{
238 ppc4xx_init(r3, r4, r5, r6, r7);
239
240 ppc_md.setup_arch = ash_setup_arch;
241 ppc_md.setup_io_mappings = ash_map_io;
242
243#ifdef CONFIG_PPC_RTC
244 ppc_md.time_init = todc_time_init;
245 ppc_md.set_rtc_time = todc_set_rtc_time;
246 ppc_md.get_rtc_time = todc_get_rtc_time;
247 ppc_md.nvram_read_val = todc_direct_read_val;
248 ppc_md.nvram_write_val = todc_direct_write_val;
249#endif
250}
diff --git a/arch/ppc/platforms/4xx/ash.h b/arch/ppc/platforms/4xx/ash.h
new file mode 100644
index 000000000000..5f7448ea418d
--- /dev/null
+++ b/arch/ppc/platforms/4xx/ash.h
@@ -0,0 +1,83 @@
1/*
2 * arch/ppc/platforms/4xx/ash.h
3 *
4 * Macros, definitions, and data structures specific to the IBM PowerPC
5 * Ash eval board.
6 *
7 * Author: Armin Kuster <akuster@mvista.com>
8 *
9 * 2000-2002 (c) MontaVista, Software, Inc. This file is licensed under
10 * the terms of the GNU General Public License version 2. This program
11 * is licensed "as is" without any warranty of any kind, whether express
12 * or implied.
13 */
14
15#ifdef __KERNEL__
16#ifndef __ASM_ASH_H__
17#define __ASM_ASH_H__
18#include <platforms/4xx/ibmnp405h.h>
19
20#ifndef __ASSEMBLY__
21/*
22 * Data structure defining board information maintained by the boot
23 * ROM on IBM's "Ash" evaluation board. An effort has been made to
24 * keep the field names consistent with the 8xx 'bd_t' board info
25 * structures.
26 */
27
28typedef struct board_info {
29 unsigned char bi_s_version[4]; /* Version of this structure */
30 unsigned char bi_r_version[30]; /* Version of the IBM ROM */
31 unsigned int bi_memsize; /* DRAM installed, in bytes */
32 unsigned char bi_enetaddr[4][6]; /* Local Ethernet MAC address */
33 unsigned char bi_pci_enetaddr[6];
34 unsigned int bi_intfreq; /* Processor speed, in Hz */
35 unsigned int bi_busfreq; /* PLB Bus speed, in Hz */
36 unsigned int bi_pci_busfreq; /* PCI speed in Hz */
37} bd_t;
38
39/* Some 4xx parts use a different timebase frequency from the internal clock.
40*/
41#define bi_tbfreq bi_intfreq
42
43/* Memory map for the IBM "Ash" NP405H evaluation board.
44 */
45
46extern void *ash_rtc_base;
47#define ASH_RTC_PADDR ((uint)0xf0000000)
48#define ASH_RTC_VADDR ASH_RTC_PADDR
49#define ASH_RTC_SIZE ((uint)8*1024)
50
51
52/* Early initialization address mapping for block_io.
53 * Standard 405GP map.
54 */
55#define PPC4xx_PCI_IO_PADDR ((uint)PPC405_PCI_PHY_IO_BASE)
56#define PPC4xx_PCI_IO_VADDR PPC4xx_PCI_IO_PADDR
57#define PPC4xx_PCI_IO_SIZE ((uint)64*1024)
58#define PPC4xx_PCI_CFG_PADDR ((uint)PPC405_PCI_CONFIG_ADDR)
59#define PPC4xx_PCI_CFG_VADDR PPC4xx_PCI_CFG_PADDR
60#define PPC4xx_PCI_CFG_SIZE ((uint)4*1024)
61#define PPC4xx_PCI_LCFG_PADDR ((uint)0xef400000)
62#define PPC4xx_PCI_LCFG_VADDR PPC4xx_PCI_LCFG_PADDR
63#define PPC4xx_PCI_LCFG_SIZE ((uint)4*1024)
64#define PPC4xx_ONB_IO_PADDR ((uint)0xef600000)
65#define PPC4xx_ONB_IO_VADDR PPC4xx_ONB_IO_PADDR
66#define PPC4xx_ONB_IO_SIZE ((uint)4*1024)
67
68#define NR_BOARD_IRQS 32
69
70#ifdef CONFIG_PPC405GP_INTERNAL_CLOCK
71#define BASE_BAUD 201600
72#else
73#define BASE_BAUD 691200
74#endif
75
76#define PPC4xx_MACHINE_NAME "IBM NP405H Ash"
77
78extern char pci_irq_table[][4];
79
80
81#endif /* !__ASSEMBLY__ */
82#endif /* __ASM_ASH_H__ */
83#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/4xx/bubinga.c b/arch/ppc/platforms/4xx/bubinga.c
new file mode 100644
index 000000000000..3678abf86313
--- /dev/null
+++ b/arch/ppc/platforms/4xx/bubinga.c
@@ -0,0 +1,263 @@
1/*
2 * Support for IBM PPC 405EP evaluation board (Bubinga).
3 *
4 * Author: SAW (IBM), derived from walnut.c.
5 * Maintained by MontaVista Software <source@mvista.com>
6 *
7 * 2003 (c) MontaVista Softare Inc. This file is licensed under the
8 * terms of the GNU General Public License version 2. This program is
9 * licensed "as is" without any warranty of any kind, whether express
10 * or implied.
11 */
12
13#include <linux/config.h>
14#include <linux/init.h>
15#include <linux/smp.h>
16#include <linux/threads.h>
17#include <linux/param.h>
18#include <linux/string.h>
19#include <linux/blkdev.h>
20#include <linux/pci.h>
21#include <linux/rtc.h>
22#include <linux/tty.h>
23#include <linux/serial.h>
24#include <linux/serial_core.h>
25
26#include <asm/system.h>
27#include <asm/pci-bridge.h>
28#include <asm/processor.h>
29#include <asm/machdep.h>
30#include <asm/page.h>
31#include <asm/time.h>
32#include <asm/io.h>
33#include <asm/todc.h>
34#include <asm/kgdb.h>
35#include <asm/ocp.h>
36#include <asm/ibm_ocp_pci.h>
37
38#include <platforms/4xx/ibm405ep.h>
39
40#undef DEBUG
41
42#ifdef DEBUG
43#define DBG(x...) printk(x)
44#else
45#define DBG(x...)
46#endif
47
48extern bd_t __res;
49
50void *bubinga_rtc_base;
51
52/* Some IRQs unique to the board
53 * Used by the generic 405 PCI setup functions in ppc4xx_pci.c
54 */
55int __init
56ppc405_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
57{
58 static char pci_irq_table[][4] =
59 /*
60 * PCI IDSEL/INTPIN->INTLINE
61 * A B C D
62 */
63 {
64 {28, 28, 28, 28}, /* IDSEL 1 - PCI slot 1 */
65 {29, 29, 29, 29}, /* IDSEL 2 - PCI slot 2 */
66 {30, 30, 30, 30}, /* IDSEL 3 - PCI slot 3 */
67 {31, 31, 31, 31}, /* IDSEL 4 - PCI slot 4 */
68 };
69
70 const long min_idsel = 1, max_idsel = 4, irqs_per_slot = 4;
71 return PCI_IRQ_TABLE_LOOKUP;
72};
73
74/* The serial clock for the chip is an internal clock determined by
75 * different clock speeds/dividers.
76 * Calculate the proper input baud rate and setup the serial driver.
77 */
78static void __init
79bubinga_early_serial_map(void)
80{
81 u32 uart_div;
82 int uart_clock;
83 struct uart_port port;
84
85 /* Calculate the serial clock input frequency
86 *
87 * The base baud is the PLL OUTA (provided in the board info
88 * structure) divided by the external UART Divisor, divided
89 * by 16.
90 */
91 uart_div = (mfdcr(DCRN_CPC0_UCR_BASE) & DCRN_CPC0_UCR_U0DIV);
92 uart_clock = __res.bi_pllouta_freq / uart_div;
93
94 /* Setup serial port access */
95 memset(&port, 0, sizeof(port));
96 port.membase = (void*)ACTING_UART0_IO_BASE;
97 port.irq = ACTING_UART0_INT;
98 port.uartclk = uart_clock;
99 port.regshift = 0;
100 port.iotype = SERIAL_IO_MEM;
101 port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST;
102 port.line = 0;
103
104 if (early_serial_setup(&port) != 0) {
105 printk("Early serial init of port 0 failed\n");
106 }
107
108 port.membase = (void*)ACTING_UART1_IO_BASE;
109 port.irq = ACTING_UART1_INT;
110 port.line = 1;
111
112 if (early_serial_setup(&port) != 0) {
113 printk("Early serial init of port 1 failed\n");
114 }
115}
116
117void __init
118bios_fixup(struct pci_controller *hose, struct pcil0_regs *pcip)
119{
120
121 unsigned int bar_response, bar;
122 /*
123 * Expected PCI mapping:
124 *
125 * PLB addr PCI memory addr
126 * --------------------- ---------------------
127 * 0000'0000 - 7fff'ffff <--- 0000'0000 - 7fff'ffff
128 * 8000'0000 - Bfff'ffff ---> 8000'0000 - Bfff'ffff
129 *
130 * PLB addr PCI io addr
131 * --------------------- ---------------------
132 * e800'0000 - e800'ffff ---> 0000'0000 - 0001'0000
133 *
134 * The following code is simplified by assuming that the bootrom
135 * has been well behaved in following this mapping.
136 */
137
138#ifdef DEBUG
139 int i;
140
141 printk("ioremap PCLIO_BASE = 0x%x\n", pcip);
142 printk("PCI bridge regs before fixup \n");
143 for (i = 0; i <= 3; i++) {
144 printk(" pmm%dma\t0x%x\n", i, in_le32(&(pcip->pmm[i].ma)));
145 printk(" pmm%dma\t0x%x\n", i, in_le32(&(pcip->pmm[i].la)));
146 printk(" pmm%dma\t0x%x\n", i, in_le32(&(pcip->pmm[i].pcila)));
147 printk(" pmm%dma\t0x%x\n", i, in_le32(&(pcip->pmm[i].pciha)));
148 }
149 printk(" ptm1ms\t0x%x\n", in_le32(&(pcip->ptm1ms)));
150 printk(" ptm1la\t0x%x\n", in_le32(&(pcip->ptm1la)));
151 printk(" ptm2ms\t0x%x\n", in_le32(&(pcip->ptm2ms)));
152 printk(" ptm2la\t0x%x\n", in_le32(&(pcip->ptm2la)));
153
154#endif
155
156 /* added for IBM boot rom version 1.15 bios bar changes -AK */
157
158 /* Disable region first */
159 out_le32((void *) &(pcip->pmm[0].ma), 0x00000000);
160 /* PLB starting addr, PCI: 0x80000000 */
161 out_le32((void *) &(pcip->pmm[0].la), 0x80000000);
162 /* PCI start addr, 0x80000000 */
163 out_le32((void *) &(pcip->pmm[0].pcila), PPC405_PCI_MEM_BASE);
164 /* 512MB range of PLB to PCI */
165 out_le32((void *) &(pcip->pmm[0].pciha), 0x00000000);
166 /* Enable no pre-fetch, enable region */
167 out_le32((void *) &(pcip->pmm[0].ma), ((0xffffffff -
168 (PPC405_PCI_UPPER_MEM -
169 PPC405_PCI_MEM_BASE)) | 0x01));
170
171 /* Disable region one */
172 out_le32((void *) &(pcip->pmm[1].ma), 0x00000000);
173 out_le32((void *) &(pcip->pmm[1].la), 0x00000000);
174 out_le32((void *) &(pcip->pmm[1].pcila), 0x00000000);
175 out_le32((void *) &(pcip->pmm[1].pciha), 0x00000000);
176 out_le32((void *) &(pcip->pmm[1].ma), 0x00000000);
177 out_le32((void *) &(pcip->ptm1ms), 0x00000001);
178
179 /* Disable region two */
180 out_le32((void *) &(pcip->pmm[2].ma), 0x00000000);
181 out_le32((void *) &(pcip->pmm[2].la), 0x00000000);
182 out_le32((void *) &(pcip->pmm[2].pcila), 0x00000000);
183 out_le32((void *) &(pcip->pmm[2].pciha), 0x00000000);
184 out_le32((void *) &(pcip->pmm[2].ma), 0x00000000);
185 out_le32((void *) &(pcip->ptm2ms), 0x00000000);
186 out_le32((void *) &(pcip->ptm2la), 0x00000000);
187
188 /* Zero config bars */
189 for (bar = PCI_BASE_ADDRESS_1; bar <= PCI_BASE_ADDRESS_2; bar += 4) {
190 early_write_config_dword(hose, hose->first_busno,
191 PCI_FUNC(hose->first_busno), bar,
192 0x00000000);
193 early_read_config_dword(hose, hose->first_busno,
194 PCI_FUNC(hose->first_busno), bar,
195 &bar_response);
196 DBG("BUS %d, device %d, Function %d bar 0x%8.8x is 0x%8.8x\n",
197 hose->first_busno, PCI_SLOT(hose->first_busno),
198 PCI_FUNC(hose->first_busno), bar, bar_response);
199 }
200 /* end work arround */
201
202#ifdef DEBUG
203 printk("PCI bridge regs after fixup \n");
204 for (i = 0; i <= 3; i++) {
205 printk(" pmm%dma\t0x%x\n", i, in_le32(&(pcip->pmm[i].ma)));
206 printk(" pmm%dma\t0x%x\n", i, in_le32(&(pcip->pmm[i].la)));
207 printk(" pmm%dma\t0x%x\n", i, in_le32(&(pcip->pmm[i].pcila)));
208 printk(" pmm%dma\t0x%x\n", i, in_le32(&(pcip->pmm[i].pciha)));
209 }
210 printk(" ptm1ms\t0x%x\n", in_le32(&(pcip->ptm1ms)));
211 printk(" ptm1la\t0x%x\n", in_le32(&(pcip->ptm1la)));
212 printk(" ptm2ms\t0x%x\n", in_le32(&(pcip->ptm2ms)));
213 printk(" ptm2la\t0x%x\n", in_le32(&(pcip->ptm2la)));
214
215#endif
216}
217
218void __init
219bubinga_setup_arch(void)
220{
221 ppc4xx_setup_arch();
222
223 ibm_ocp_set_emac(0, 1);
224
225 bubinga_early_serial_map();
226
227 /* RTC step for the evb405ep */
228 bubinga_rtc_base = (void *) BUBINGA_RTC_VADDR;
229 TODC_INIT(TODC_TYPE_DS1743, bubinga_rtc_base, bubinga_rtc_base,
230 bubinga_rtc_base, 8);
231 /* Identify the system */
232 printk("IBM Bubinga port (MontaVista Software, Inc. <source@mvista.com>)\n");
233}
234
235void __init
236bubinga_map_io(void)
237{
238 ppc4xx_map_io();
239 io_block_mapping(BUBINGA_RTC_VADDR,
240 BUBINGA_RTC_PADDR, BUBINGA_RTC_SIZE, _PAGE_IO);
241}
242
243void __init
244platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
245 unsigned long r6, unsigned long r7)
246{
247 ppc4xx_init(r3, r4, r5, r6, r7);
248
249 ppc_md.setup_arch = bubinga_setup_arch;
250 ppc_md.setup_io_mappings = bubinga_map_io;
251
252#ifdef CONFIG_GEN_RTC
253 ppc_md.time_init = todc_time_init;
254 ppc_md.set_rtc_time = todc_set_rtc_time;
255 ppc_md.get_rtc_time = todc_get_rtc_time;
256 ppc_md.nvram_read_val = todc_direct_read_val;
257 ppc_md.nvram_write_val = todc_direct_write_val;
258#endif
259#ifdef CONFIG_KGDB
260 ppc_md.early_serial_map = bubinga_early_serial_map;
261#endif
262}
263
diff --git a/arch/ppc/platforms/4xx/bubinga.h b/arch/ppc/platforms/4xx/bubinga.h
new file mode 100644
index 000000000000..b1df856f8e22
--- /dev/null
+++ b/arch/ppc/platforms/4xx/bubinga.h
@@ -0,0 +1,69 @@
1/*
2 * Support for IBM PPC 405EP evaluation board (Bubinga).
3 *
4 * Author: SAW (IBM), derived from walnut.h.
5 * Maintained by MontaVista Software <source@mvista.com>
6 *
7 * 2003 (c) MontaVista Softare Inc. This file is licensed under the
8 * terms of the GNU General Public License version 2. This program is
9 * licensed "as is" without any warranty of any kind, whether express
10 * or implied.
11 */
12
13#ifdef __KERNEL__
14#ifndef __BUBINGA_H__
15#define __BUBINGA_H__
16
17/* 405EP */
18#include <platforms/4xx/ibm405ep.h>
19
20#ifndef __ASSEMBLY__
21/*
22 * Data structure defining board information maintained by the boot
23 * ROM on IBM's evaluation board. An effort has been made to
24 * keep the field names consistent with the 8xx 'bd_t' board info
25 * structures.
26 */
27
28typedef struct board_info {
29 unsigned char bi_s_version[4]; /* Version of this structure */
30 unsigned char bi_r_version[30]; /* Version of the IBM ROM */
31 unsigned int bi_memsize; /* DRAM installed, in bytes */
32 unsigned char bi_enetaddr[2][6]; /* Local Ethernet MAC address */ unsigned char bi_pci_enetaddr[6]; /* PCI Ethernet MAC address */
33 unsigned int bi_intfreq; /* Processor speed, in Hz */
34 unsigned int bi_busfreq; /* PLB Bus speed, in Hz */
35 unsigned int bi_pci_busfreq; /* PCI Bus speed, in Hz */
36 unsigned int bi_opb_busfreq; /* OPB Bus speed, in Hz */
37 unsigned int bi_pllouta_freq; /* PLL OUTA speed, in Hz */
38} bd_t;
39
40/* Some 4xx parts use a different timebase frequency from the internal clock.
41*/
42#define bi_tbfreq bi_intfreq
43
44
45/* Memory map for the Bubinga board.
46 * Generic 4xx plus RTC.
47 */
48
49extern void *bubinga_rtc_base;
50#define BUBINGA_RTC_PADDR ((uint)0xf0000000)
51#define BUBINGA_RTC_VADDR BUBINGA_RTC_PADDR
52#define BUBINGA_RTC_SIZE ((uint)8*1024)
53
54/* The UART clock is based off an internal clock -
55 * define BASE_BAUD based on the internal clock and divider(s).
56 * Since BASE_BAUD must be a constant, we will initialize it
57 * using clock/divider values which OpenBIOS initializes
58 * for typical configurations at various CPU speeds.
59 * The base baud is calculated as (FWDA / EXT UART DIV / 16)
60 */
61#define BASE_BAUD 0
62
63#define BUBINGA_FPGA_BASE 0xF0300000
64
65#define PPC4xx_MACHINE_NAME "IBM Bubinga"
66
67#endif /* !__ASSEMBLY__ */
68#endif /* __BUBINGA_H__ */
69#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/4xx/cpci405.c b/arch/ppc/platforms/4xx/cpci405.c
new file mode 100644
index 000000000000..ff966773a0bf
--- /dev/null
+++ b/arch/ppc/platforms/4xx/cpci405.c
@@ -0,0 +1,84 @@
1/*
2 * arch/ppc/platforms/cpci405.c
3 *
4 * Board setup routines for the esd CPCI-405 cPCI Board.
5 *
6 * Author: Stefan Roese
7 * stefan.roese@esd-electronics.com
8 *
9 * Copyright 2001 esd electronic system design - hannover germany
10 *
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
15 *
16 */
17
18#include <linux/config.h>
19#include <linux/init.h>
20#include <linux/pci.h>
21#include <asm/system.h>
22#include <asm/pci-bridge.h>
23#include <asm/machdep.h>
24#include <asm/todc.h>
25#include <asm/ocp.h>
26
27void *cpci405_nvram;
28
29/*
30 * Some IRQs unique to CPCI-405.
31 */
32int __init
33ppc405_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
34{
35 static char pci_irq_table[][4] =
36 /*
37 * PCI IDSEL/INTPIN->INTLINE
38 * A B C D
39 */
40 {
41 {28, 28, 28, 28}, /* IDSEL 15 - cPCI slot 8 */
42 {29, 29, 29, 29}, /* IDSEL 16 - cPCI slot 7 */
43 {30, 30, 30, 30}, /* IDSEL 17 - cPCI slot 6 */
44 {27, 27, 27, 27}, /* IDSEL 18 - cPCI slot 5 */
45 {28, 28, 28, 28}, /* IDSEL 19 - cPCI slot 4 */
46 {29, 29, 29, 29}, /* IDSEL 20 - cPCI slot 3 */
47 {30, 30, 30, 30}, /* IDSEL 21 - cPCI slot 2 */
48 };
49 const long min_idsel = 15, max_idsel = 21, irqs_per_slot = 4;
50 return PCI_IRQ_TABLE_LOOKUP;
51};
52
53void __init
54cpci405_setup_arch(void)
55{
56 ppc4xx_setup_arch();
57
58 ibm_ocp_set_emac(0, 0);
59
60 TODC_INIT(TODC_TYPE_MK48T35, cpci405_nvram, cpci405_nvram, cpci405_nvram, 8);
61}
62
63void __init
64cpci405_map_io(void)
65{
66 ppc4xx_map_io();
67 cpci405_nvram = ioremap(CPCI405_NVRAM_PADDR, CPCI405_NVRAM_SIZE);
68}
69
70void __init
71platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
72 unsigned long r6, unsigned long r7)
73{
74 ppc4xx_init(r3, r4, r5, r6, r7);
75
76 ppc_md.setup_arch = cpci405_setup_arch;
77 ppc_md.setup_io_mappings = cpci405_map_io;
78
79 ppc_md.time_init = todc_time_init;
80 ppc_md.set_rtc_time = todc_set_rtc_time;
81 ppc_md.get_rtc_time = todc_get_rtc_time;
82 ppc_md.nvram_read_val = todc_direct_read_val;
83 ppc_md.nvram_write_val = todc_direct_write_val;
84}
diff --git a/arch/ppc/platforms/4xx/cpci405.h b/arch/ppc/platforms/4xx/cpci405.h
new file mode 100644
index 000000000000..e27f7cb650d8
--- /dev/null
+++ b/arch/ppc/platforms/4xx/cpci405.h
@@ -0,0 +1,37 @@
1/*
2 * CPCI-405 board specific definitions
3 *
4 * Copyright (c) 2001 Stefan Roese (stefan.roese@esd-electronics.com)
5 */
6
7#ifdef __KERNEL__
8#ifndef __ASM_CPCI405_H__
9#define __ASM_CPCI405_H__
10
11#include <linux/config.h>
12
13/* We have a 405GP core */
14#include <platforms/4xx/ibm405gp.h>
15
16#include <asm/ppcboot.h>
17
18#ifndef __ASSEMBLY__
19/* Some 4xx parts use a different timebase frequency from the internal clock.
20*/
21#define bi_tbfreq bi_intfreq
22
23/* Map for the NVRAM space */
24#define CPCI405_NVRAM_PADDR ((uint)0xf0200000)
25#define CPCI405_NVRAM_SIZE ((uint)32*1024)
26
27#ifdef CONFIG_PPC405GP_INTERNAL_CLOCK
28#define BASE_BAUD 201600
29#else
30#define BASE_BAUD 691200
31#endif
32
33#define PPC4xx_MACHINE_NAME "esd CPCI-405"
34
35#endif /* !__ASSEMBLY__ */
36#endif /* __ASM_CPCI405_H__ */
37#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/4xx/ebony.c b/arch/ppc/platforms/4xx/ebony.c
new file mode 100644
index 000000000000..f63bca83e757
--- /dev/null
+++ b/arch/ppc/platforms/4xx/ebony.c
@@ -0,0 +1,356 @@
1/*
2 * arch/ppc/platforms/4xx/ebony.c
3 *
4 * Ebony board specific routines
5 *
6 * Matt Porter <mporter@kernel.crashing.org>
7 * Copyright 2002-2005 MontaVista Software Inc.
8 *
9 * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
10 * Copyright (c) 2003, 2004 Zultys Technologies
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 */
17
18#include <linux/config.h>
19#include <linux/stddef.h>
20#include <linux/kernel.h>
21#include <linux/init.h>
22#include <linux/errno.h>
23#include <linux/reboot.h>
24#include <linux/pci.h>
25#include <linux/kdev_t.h>
26#include <linux/types.h>
27#include <linux/major.h>
28#include <linux/blkdev.h>
29#include <linux/console.h>
30#include <linux/delay.h>
31#include <linux/ide.h>
32#include <linux/initrd.h>
33#include <linux/irq.h>
34#include <linux/seq_file.h>
35#include <linux/root_dev.h>
36#include <linux/tty.h>
37#include <linux/serial.h>
38#include <linux/serial_core.h>
39
40#include <asm/system.h>
41#include <asm/pgtable.h>
42#include <asm/page.h>
43#include <asm/dma.h>
44#include <asm/io.h>
45#include <asm/machdep.h>
46#include <asm/ocp.h>
47#include <asm/pci-bridge.h>
48#include <asm/time.h>
49#include <asm/todc.h>
50#include <asm/bootinfo.h>
51#include <asm/ppc4xx_pic.h>
52#include <asm/ppcboot.h>
53
54#include <syslib/gen550.h>
55#include <syslib/ibm440gp_common.h>
56
57/*
58 * This is a horrible kludge, we eventually need to abstract this
59 * generic PHY stuff, so the standard phy mode defines can be
60 * easily used from arch code.
61 */
62#include "../../../../drivers/net/ibm_emac/ibm_emac_phy.h"
63
64bd_t __res;
65
66static struct ibm44x_clocks clocks __initdata;
67
68/*
69 * Ebony external IRQ triggering/polarity settings
70 */
71unsigned char ppc4xx_uic_ext_irq_cfg[] __initdata = {
72 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* IRQ0: PCI slot 0 */
73 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* IRQ1: PCI slot 1 */
74 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* IRQ2: PCI slot 2 */
75 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* IRQ3: PCI slot 3 */
76 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* IRQ4: IRDA */
77 (IRQ_SENSE_EDGE | IRQ_POLARITY_NEGATIVE), /* IRQ5: SMI pushbutton */
78 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* IRQ6: PHYs */
79 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* IRQ7: AUX */
80 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* IRQ8: EXT */
81 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* IRQ9: EXT */
82 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* IRQ10: EXT */
83 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* IRQ11: EXT */
84 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* IRQ12: EXT */
85};
86
87static void __init
88ebony_calibrate_decr(void)
89{
90 unsigned int freq;
91
92 /*
93 * Determine system clock speed
94 *
95 * If we are on Rev. B silicon, then use
96 * default external system clock. If we are
97 * on Rev. C silicon then errata forces us to
98 * use the internal clock.
99 */
100 switch (PVR_REV(mfspr(SPRN_PVR))) {
101 case PVR_REV(PVR_440GP_RB):
102 freq = EBONY_440GP_RB_SYSCLK;
103 break;
104 case PVR_REV(PVR_440GP_RC1):
105 default:
106 freq = EBONY_440GP_RC_SYSCLK;
107 break;
108 }
109
110 ibm44x_calibrate_decr(freq);
111}
112
113static int
114ebony_show_cpuinfo(struct seq_file *m)
115{
116 seq_printf(m, "vendor\t\t: IBM\n");
117 seq_printf(m, "machine\t\t: Ebony\n");
118
119 return 0;
120}
121
122static inline int
123ebony_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
124{
125 static char pci_irq_table[][4] =
126 /*
127 * PCI IDSEL/INTPIN->INTLINE
128 * A B C D
129 */
130 {
131 { 23, 23, 23, 23 }, /* IDSEL 1 - PCI Slot 0 */
132 { 24, 24, 24, 24 }, /* IDSEL 2 - PCI Slot 1 */
133 { 25, 25, 25, 25 }, /* IDSEL 3 - PCI Slot 2 */
134 { 26, 26, 26, 26 }, /* IDSEL 4 - PCI Slot 3 */
135 };
136
137 const long min_idsel = 1, max_idsel = 4, irqs_per_slot = 4;
138 return PCI_IRQ_TABLE_LOOKUP;
139}
140
141#define PCIX_WRITEL(value, offset) \
142 (writel(value, pcix_reg_base + offset))
143
144/*
145 * FIXME: This is only here to "make it work". This will move
146 * to a ibm_pcix.c which will contain a generic IBM PCIX bridge
147 * configuration library. -Matt
148 */
149static void __init
150ebony_setup_pcix(void)
151{
152 void *pcix_reg_base;
153
154 pcix_reg_base = ioremap64(PCIX0_REG_BASE, PCIX_REG_SIZE);
155
156 /* Disable all windows */
157 PCIX_WRITEL(0, PCIX0_POM0SA);
158 PCIX_WRITEL(0, PCIX0_POM1SA);
159 PCIX_WRITEL(0, PCIX0_POM2SA);
160 PCIX_WRITEL(0, PCIX0_PIM0SA);
161 PCIX_WRITEL(0, PCIX0_PIM1SA);
162 PCIX_WRITEL(0, PCIX0_PIM2SA);
163
164 /* Setup 2GB PLB->PCI outbound mem window (3_8000_0000->0_8000_0000) */
165 PCIX_WRITEL(0x00000003, PCIX0_POM0LAH);
166 PCIX_WRITEL(0x80000000, PCIX0_POM0LAL);
167 PCIX_WRITEL(0x00000000, PCIX0_POM0PCIAH);
168 PCIX_WRITEL(0x80000000, PCIX0_POM0PCIAL);
169 PCIX_WRITEL(0x80000001, PCIX0_POM0SA);
170
171 /* Setup 2GB PCI->PLB inbound memory window at 0, enable MSIs */
172 PCIX_WRITEL(0x00000000, PCIX0_PIM0LAH);
173 PCIX_WRITEL(0x00000000, PCIX0_PIM0LAL);
174 PCIX_WRITEL(0x80000007, PCIX0_PIM0SA);
175
176 eieio();
177}
178
179static void __init
180ebony_setup_hose(void)
181{
182 struct pci_controller *hose;
183
184 /* Configure windows on the PCI-X host bridge */
185 ebony_setup_pcix();
186
187 hose = pcibios_alloc_controller();
188
189 if (!hose)
190 return;
191
192 hose->first_busno = 0;
193 hose->last_busno = 0xff;
194
195 hose->pci_mem_offset = EBONY_PCI_MEM_OFFSET;
196
197 pci_init_resource(&hose->io_resource,
198 EBONY_PCI_LOWER_IO,
199 EBONY_PCI_UPPER_IO,
200 IORESOURCE_IO,
201 "PCI host bridge");
202
203 pci_init_resource(&hose->mem_resources[0],
204 EBONY_PCI_LOWER_MEM,
205 EBONY_PCI_UPPER_MEM,
206 IORESOURCE_MEM,
207 "PCI host bridge");
208
209 hose->io_space.start = EBONY_PCI_LOWER_IO;
210 hose->io_space.end = EBONY_PCI_UPPER_IO;
211 hose->mem_space.start = EBONY_PCI_LOWER_MEM;
212 hose->mem_space.end = EBONY_PCI_UPPER_MEM;
213 isa_io_base =
214 (unsigned long)ioremap64(EBONY_PCI_IO_BASE, EBONY_PCI_IO_SIZE);
215 hose->io_base_virt = (void *)isa_io_base;
216
217 setup_indirect_pci(hose,
218 EBONY_PCI_CFGA_PLB32,
219 EBONY_PCI_CFGD_PLB32);
220 hose->set_cfg_type = 1;
221
222 hose->last_busno = pciauto_bus_scan(hose, hose->first_busno);
223
224 ppc_md.pci_swizzle = common_swizzle;
225 ppc_md.pci_map_irq = ebony_map_irq;
226}
227
228TODC_ALLOC();
229
230static void __init
231ebony_early_serial_map(void)
232{
233 struct uart_port port;
234
235 /* Setup ioremapped serial port access */
236 memset(&port, 0, sizeof(port));
237 port.membase = ioremap64(PPC440GP_UART0_ADDR, 8);
238 port.irq = 0;
239 port.uartclk = clocks.uart0;
240 port.regshift = 0;
241 port.iotype = SERIAL_IO_MEM;
242 port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST;
243 port.line = 0;
244
245 if (early_serial_setup(&port) != 0) {
246 printk("Early serial init of port 0 failed\n");
247 }
248
249#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
250 /* Configure debug serial access */
251 gen550_init(0, &port);
252#endif
253
254 port.membase = ioremap64(PPC440GP_UART1_ADDR, 8);
255 port.irq = 1;
256 port.uartclk = clocks.uart1;
257 port.line = 1;
258
259 if (early_serial_setup(&port) != 0) {
260 printk("Early serial init of port 1 failed\n");
261 }
262
263#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
264 /* Configure debug serial access */
265 gen550_init(1, &port);
266#endif
267}
268
269static void __init
270ebony_setup_arch(void)
271{
272 struct ocp_def *def;
273 struct ocp_func_emac_data *emacdata;
274
275 /* Set mac_addr for each EMAC */
276 def = ocp_get_one_device(OCP_VENDOR_IBM, OCP_FUNC_EMAC, 0);
277 emacdata = def->additions;
278 emacdata->phy_map = 0x00000001; /* Skip 0x00 */
279 emacdata->phy_mode = PHY_MODE_RMII;
280 memcpy(emacdata->mac_addr, __res.bi_enetaddr, 6);
281
282 def = ocp_get_one_device(OCP_VENDOR_IBM, OCP_FUNC_EMAC, 1);
283 emacdata = def->additions;
284 emacdata->phy_map = 0x00000001; /* Skip 0x00 */
285 emacdata->phy_mode = PHY_MODE_RMII;
286 memcpy(emacdata->mac_addr, __res.bi_enet1addr, 6);
287
288 /*
289 * Determine various clocks.
290 * To be completely correct we should get SysClk
291 * from FPGA, because it can be changed by on-board switches
292 * --ebs
293 */
294 ibm440gp_get_clocks(&clocks, 33333333, 6 * 1843200);
295 ocp_sys_info.opb_bus_freq = clocks.opb;
296
297 /* Setup TODC access */
298 TODC_INIT(TODC_TYPE_DS1743,
299 0,
300 0,
301 ioremap64(EBONY_RTC_ADDR, EBONY_RTC_SIZE),
302 8);
303
304 /* init to some ~sane value until calibrate_delay() runs */
305 loops_per_jiffy = 50000000/HZ;
306
307 /* Setup PCI host bridge */
308 ebony_setup_hose();
309
310#ifdef CONFIG_BLK_DEV_INITRD
311 if (initrd_start)
312 ROOT_DEV = Root_RAM0;
313 else
314#endif
315#ifdef CONFIG_ROOT_NFS
316 ROOT_DEV = Root_NFS;
317#else
318 ROOT_DEV = Root_HDA1;
319#endif
320
321 ebony_early_serial_map();
322
323 /* Identify the system */
324 printk("IBM Ebony port (MontaVista Software, Inc. (source@mvista.com))\n");
325}
326
327void __init platform_init(unsigned long r3, unsigned long r4,
328 unsigned long r5, unsigned long r6, unsigned long r7)
329{
330 parse_bootinfo(find_bootinfo());
331
332 /*
333 * If we were passed in a board information, copy it into the
334 * residual data area.
335 */
336 if (r3)
337 __res = *(bd_t *)(r3 + KERNELBASE);
338
339 ibm44x_platform_init();
340
341 ppc_md.setup_arch = ebony_setup_arch;
342 ppc_md.show_cpuinfo = ebony_show_cpuinfo;
343 ppc_md.get_irq = NULL; /* Set in ppc4xx_pic_init() */
344
345 ppc_md.calibrate_decr = ebony_calibrate_decr;
346 ppc_md.time_init = todc_time_init;
347 ppc_md.set_rtc_time = todc_set_rtc_time;
348 ppc_md.get_rtc_time = todc_get_rtc_time;
349
350 ppc_md.nvram_read_val = todc_direct_read_val;
351 ppc_md.nvram_write_val = todc_direct_write_val;
352#ifdef CONFIG_KGDB
353 ppc_md.early_serial_map = ebony_early_serial_map;
354#endif
355}
356
diff --git a/arch/ppc/platforms/4xx/ebony.h b/arch/ppc/platforms/4xx/ebony.h
new file mode 100644
index 000000000000..47c391c9174d
--- /dev/null
+++ b/arch/ppc/platforms/4xx/ebony.h
@@ -0,0 +1,91 @@
1/*
2 * arch/ppc/platforms/ebony.h
3 *
4 * Ebony board definitions
5 *
6 * Matt Porter <mporter@mvista.com>
7 *
8 * Copyright 2002 MontaVista Software Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15
16#ifdef __KERNEL__
17#ifndef __ASM_EBONY_H__
18#define __ASM_EBONY_H__
19
20#include <linux/config.h>
21#include <platforms/4xx/ibm440gp.h>
22
23/* F/W TLB mapping used in bootloader glue to reset EMAC */
24#define PPC44x_EMAC0_MR0 0xE0000800
25
26/* Where to find the MAC info */
27#define EBONY_OPENBIOS_MAC_BASE 0xfffffe0c
28#define EBONY_OPENBIOS_MAC_OFFSET 0x0c
29
30/* Default clock rates for Rev. B and Rev. C silicon */
31#define EBONY_440GP_RB_SYSCLK 33000000
32#define EBONY_440GP_RC_SYSCLK 400000000
33
34/* RTC/NVRAM location */
35#define EBONY_RTC_ADDR 0x0000000148000000ULL
36#define EBONY_RTC_SIZE 0x2000
37
38/* Flash */
39#define EBONY_FPGA_ADDR 0x0000000148300000ULL
40#define EBONY_BOOT_SMALL_FLASH(x) (x & 0x20)
41#define EBONY_ONBRD_FLASH_EN(x) (x & 0x02)
42#define EBONY_FLASH_SEL(x) (x & 0x01)
43#define EBONY_SMALL_FLASH_LOW1 0x00000001ff800000ULL
44#define EBONY_SMALL_FLASH_LOW2 0x00000001ff880000ULL
45#define EBONY_SMALL_FLASH_HIGH1 0x00000001fff00000ULL
46#define EBONY_SMALL_FLASH_HIGH2 0x00000001fff80000ULL
47#define EBONY_SMALL_FLASH_SIZE 0x80000
48#define EBONY_LARGE_FLASH_LOW 0x00000001ff800000ULL
49#define EBONY_LARGE_FLASH_HIGH 0x00000001ffc00000ULL
50#define EBONY_LARGE_FLASH_SIZE 0x400000
51
52#define EBONY_SMALL_FLASH_BASE 0x00000001fff80000ULL
53#define EBONY_LARGE_FLASH_BASE 0x00000001ff800000ULL
54
55/*
56 * Serial port defines
57 */
58
59/* OpenBIOS defined UART mappings, used before early_serial_setup */
60#define UART0_IO_BASE 0xE0000200
61#define UART1_IO_BASE 0xE0000300
62
63/* external Epson SG-615P */
64#define BASE_BAUD 691200
65
66#define STD_UART_OP(num) \
67 { 0, BASE_BAUD, 0, UART##num##_INT, \
68 (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST), \
69 iomem_base: UART##num##_IO_BASE, \
70 io_type: SERIAL_IO_MEM},
71
72#define SERIAL_PORT_DFNS \
73 STD_UART_OP(0) \
74 STD_UART_OP(1)
75
76/* PCI support */
77#define EBONY_PCI_LOWER_IO 0x00000000
78#define EBONY_PCI_UPPER_IO 0x0000ffff
79#define EBONY_PCI_LOWER_MEM 0x80002000
80#define EBONY_PCI_UPPER_MEM 0xffffefff
81
82#define EBONY_PCI_CFGREGS_BASE 0x000000020ec00000
83#define EBONY_PCI_CFGA_PLB32 0x0ec00000
84#define EBONY_PCI_CFGD_PLB32 0x0ec00004
85
86#define EBONY_PCI_IO_BASE 0x0000000208000000ULL
87#define EBONY_PCI_IO_SIZE 0x00010000
88#define EBONY_PCI_MEM_OFFSET 0x00000000
89
90#endif /* __ASM_EBONY_H__ */
91#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/4xx/ep405.c b/arch/ppc/platforms/4xx/ep405.c
new file mode 100644
index 000000000000..26a07cdb30ec
--- /dev/null
+++ b/arch/ppc/platforms/4xx/ep405.c
@@ -0,0 +1,197 @@
1/*
2 * arch/ppc/platforms/4xx/ep405.c
3 *
4 * Embedded Planet 405GP board
5 * http://www.embeddedplanet.com
6 *
7 * Author: Matthew Locke <mlocke@mvista.com>
8 *
9 * 2001 (c) MontaVista, Software, Inc. This file is licensed under
10 * the terms of the GNU General Public License version 2. This program
11 * is licensed "as is" without any warranty of any kind, whether express
12 * or implied.
13 */
14#include <linux/config.h>
15#include <linux/init.h>
16#include <linux/pci.h>
17#include <asm/system.h>
18#include <asm/pci-bridge.h>
19#include <asm/machdep.h>
20#include <asm/todc.h>
21#include <asm/ocp.h>
22#include <asm/ibm_ocp_pci.h>
23
24#undef DEBUG
25#ifdef DEBUG
26#define DBG(x...) printk(x)
27#else
28#define DBG(x...)
29#endif
30
31u8 *ep405_bcsr;
32u8 *ep405_nvram;
33
34static struct {
35 u8 cpld_xirq_select;
36 int pci_idsel;
37 int irq;
38} ep405_devtable[] = {
39#ifdef CONFIG_EP405PC
40 {0x07, 0x0E, 25}, /* EP405PC: USB */
41#endif
42};
43
44int __init
45ppc405_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
46{
47 int i;
48
49 /* AFAICT this is only called a few times during PCI setup, so
50 performance is not critical */
51 for (i = 0; i < ARRAY_SIZE(ep405_devtable); i++) {
52 if (idsel == ep405_devtable[i].pci_idsel)
53 return ep405_devtable[i].irq;
54 }
55 return -1;
56};
57
58void __init
59ep405_setup_arch(void)
60{
61 ppc4xx_setup_arch();
62
63 ibm_ocp_set_emac(0, 0);
64
65 if (__res.bi_nvramsize == 512*1024) {
66 /* FIXME: we should properly handle NVRTCs of different sizes */
67 TODC_INIT(TODC_TYPE_DS1557, ep405_nvram, ep405_nvram, ep405_nvram, 8);
68 }
69}
70
71void __init
72bios_fixup(struct pci_controller *hose, struct pcil0_regs *pcip)
73{
74 unsigned int bar_response, bar;
75 /*
76 * Expected PCI mapping:
77 *
78 * PLB addr PCI memory addr
79 * --------------------- ---------------------
80 * 0000'0000 - 7fff'ffff <--- 0000'0000 - 7fff'ffff
81 * 8000'0000 - Bfff'ffff ---> 8000'0000 - Bfff'ffff
82 *
83 * PLB addr PCI io addr
84 * --------------------- ---------------------
85 * e800'0000 - e800'ffff ---> 0000'0000 - 0001'0000
86 *
87 */
88
89 /* Disable region zero first */
90 out_le32((void *) &(pcip->pmm[0].ma), 0x00000000);
91 /* PLB starting addr, PCI: 0x80000000 */
92 out_le32((void *) &(pcip->pmm[0].la), 0x80000000);
93 /* PCI start addr, 0x80000000 */
94 out_le32((void *) &(pcip->pmm[0].pcila), PPC405_PCI_MEM_BASE);
95 /* 512MB range of PLB to PCI */
96 out_le32((void *) &(pcip->pmm[0].pciha), 0x00000000);
97 /* Enable no pre-fetch, enable region */
98 out_le32((void *) &(pcip->pmm[0].ma), ((0xffffffff -
99 (PPC405_PCI_UPPER_MEM -
100 PPC405_PCI_MEM_BASE)) | 0x01));
101
102 /* Disable region one */
103 out_le32((void *) &(pcip->pmm[1].ma), 0x00000000);
104 out_le32((void *) &(pcip->pmm[1].la), 0x00000000);
105 out_le32((void *) &(pcip->pmm[1].pcila), 0x00000000);
106 out_le32((void *) &(pcip->pmm[1].pciha), 0x00000000);
107 out_le32((void *) &(pcip->pmm[1].ma), 0x00000000);
108 out_le32((void *) &(pcip->ptm1ms), 0x00000000);
109
110 /* Disable region two */
111 out_le32((void *) &(pcip->pmm[2].ma), 0x00000000);
112 out_le32((void *) &(pcip->pmm[2].la), 0x00000000);
113 out_le32((void *) &(pcip->pmm[2].pcila), 0x00000000);
114 out_le32((void *) &(pcip->pmm[2].pciha), 0x00000000);
115 out_le32((void *) &(pcip->pmm[2].ma), 0x00000000);
116 out_le32((void *) &(pcip->ptm2ms), 0x00000000);
117
118 /* Configure PTM (PCI->PLB) region 1 */
119 out_le32((void *) &(pcip->ptm1la), 0x00000000); /* PLB base address */
120 /* Disable PTM region 2 */
121 out_le32((void *) &(pcip->ptm2ms), 0x00000000);
122
123 /* Zero config bars */
124 for (bar = PCI_BASE_ADDRESS_1; bar <= PCI_BASE_ADDRESS_2; bar += 4) {
125 early_write_config_dword(hose, hose->first_busno,
126 PCI_FUNC(hose->first_busno), bar,
127 0x00000000);
128 early_read_config_dword(hose, hose->first_busno,
129 PCI_FUNC(hose->first_busno), bar,
130 &bar_response);
131 DBG("BUS %d, device %d, Function %d bar 0x%8.8x is 0x%8.8x\n",
132 hose->first_busno, PCI_SLOT(hose->first_busno),
133 PCI_FUNC(hose->first_busno), bar, bar_response);
134 }
135 /* end work arround */
136}
137
138void __init
139ep405_map_io(void)
140{
141 bd_t *bip = &__res;
142
143 ppc4xx_map_io();
144
145 ep405_bcsr = ioremap(EP405_BCSR_PADDR, EP405_BCSR_SIZE);
146
147 if (bip->bi_nvramsize > 0) {
148 ep405_nvram = ioremap(EP405_NVRAM_PADDR, bip->bi_nvramsize);
149 }
150}
151
152void __init
153ep405_init_IRQ(void)
154{
155 int i;
156
157 ppc4xx_init_IRQ();
158
159 /* Workaround for a bug in the firmware it incorrectly sets
160 the IRQ polarities for XIRQ0 and XIRQ1 */
161 mtdcr(DCRN_UIC_PR(DCRN_UIC0_BASE), 0xffffff80); /* set the polarity */
162 mtdcr(DCRN_UIC_SR(DCRN_UIC0_BASE), 0x00000060); /* clear bogus interrupts */
163
164 /* Activate the XIRQs from the CPLD */
165 writeb(0xf0, ep405_bcsr+10);
166
167 /* Set up IRQ routing */
168 for (i = 0; i < ARRAY_SIZE(ep405_devtable); i++) {
169 if ( (ep405_devtable[i].irq >= 25)
170 && (ep405_devtable[i].irq) <= 31) {
171 writeb(ep405_devtable[i].cpld_xirq_select, ep405_bcsr+5);
172 writeb(ep405_devtable[i].irq - 25, ep405_bcsr+6);
173 }
174 }
175}
176
177void __init
178platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
179 unsigned long r6, unsigned long r7)
180{
181 ppc4xx_init(r3, r4, r5, r6, r7);
182
183 ppc_md.setup_arch = ep405_setup_arch;
184 ppc_md.setup_io_mappings = ep405_map_io;
185 ppc_md.init_IRQ = ep405_init_IRQ;
186
187 ppc_md.nvram_read_val = todc_direct_read_val;
188 ppc_md.nvram_write_val = todc_direct_write_val;
189
190 if (__res.bi_nvramsize == 512*1024) {
191 ppc_md.time_init = todc_time_init;
192 ppc_md.set_rtc_time = todc_set_rtc_time;
193 ppc_md.get_rtc_time = todc_get_rtc_time;
194 } else {
195 printk("EP405: NVRTC size is not 512k (not a DS1557). Not sure what to do with it\n");
196 }
197}
diff --git a/arch/ppc/platforms/4xx/ep405.h b/arch/ppc/platforms/4xx/ep405.h
new file mode 100644
index 000000000000..ea3eb21338fb
--- /dev/null
+++ b/arch/ppc/platforms/4xx/ep405.h
@@ -0,0 +1,54 @@
1/*
2 * arch/ppc/platforms/4xx/ep405.h
3 *
4 * Embedded Planet 405GP board
5 * http://www.embeddedplanet.com
6 *
7 * Author: Matthew Locke <mlocke@mvista.com>
8 *
9 * 2000 (c) MontaVista, Software, Inc. This file is licensed under
10 * the terms of the GNU General Public License version 2. This program
11 * is licensed "as is" without any warranty of any kind, whether express
12 * or implied.
13 */
14
15#ifdef __KERNEL__
16#ifndef __ASM_EP405_H__
17#define __ASM_EP405_H__
18
19/* We have a 405GP core */
20#include <platforms/4xx/ibm405gp.h>
21
22#ifndef __ASSEMBLY__
23
24#include <linux/types.h>
25
26typedef struct board_info {
27 unsigned int bi_memsize; /* DRAM installed, in bytes */
28 unsigned char bi_enetaddr[6]; /* Local Ethernet MAC address */
29 unsigned int bi_intfreq; /* Processor speed, in Hz */
30 unsigned int bi_busfreq; /* PLB Bus speed, in Hz */
31 unsigned int bi_pci_busfreq; /* PCI Bus speed, in Hz */
32 unsigned int bi_nvramsize; /* Size of the NVRAM/RTC */
33} bd_t;
34
35/* Some 4xx parts use a different timebase frequency from the internal clock.
36*/
37#define bi_tbfreq bi_intfreq
38
39extern u8 *ep405_bcsr;
40extern u8 *ep405_nvram;
41
42/* Map for the BCSR and NVRAM space */
43#define EP405_BCSR_PADDR ((uint)0xf4000000)
44#define EP405_BCSR_SIZE ((uint)16)
45#define EP405_NVRAM_PADDR ((uint)0xf4200000)
46
47/* serial defines */
48#define BASE_BAUD 399193
49
50#define PPC4xx_MACHINE_NAME "Embedded Planet 405GP"
51
52#endif /* !__ASSEMBLY__ */
53#endif /* __ASM_EP405_H__ */
54#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/4xx/ibm405ep.c b/arch/ppc/platforms/4xx/ibm405ep.c
new file mode 100644
index 000000000000..6d44567f4dd2
--- /dev/null
+++ b/arch/ppc/platforms/4xx/ibm405ep.c
@@ -0,0 +1,143 @@
1/*
2 * arch/ppc/platforms/ibm405ep.c
3 *
4 * Support for IBM PPC 405EP processors.
5 *
6 * Author: SAW (IBM), derived from ibmnp405l.c.
7 * Maintained by MontaVista Software <source@mvista.com>
8 *
9 * 2003 (c) MontaVista Softare Inc. This file is licensed under the
10 * terms of the GNU General Public License version 2. This program is
11 * licensed "as is" without any warranty of any kind, whether express
12 * or implied.
13 */
14
15#include <linux/config.h>
16#include <linux/init.h>
17#include <linux/smp.h>
18#include <linux/threads.h>
19#include <linux/param.h>
20#include <linux/string.h>
21
22#include <asm/ibm4xx.h>
23#include <asm/ocp.h>
24#include <asm/ppc4xx_pic.h>
25
26#include <platforms/4xx/ibm405ep.h>
27
28static struct ocp_func_mal_data ibm405ep_mal0_def = {
29 .num_tx_chans = 4, /* Number of TX channels */
30 .num_rx_chans = 2, /* Number of RX channels */
31 .txeob_irq = 11, /* TX End Of Buffer IRQ */
32 .rxeob_irq = 12, /* RX End Of Buffer IRQ */
33 .txde_irq = 13, /* TX Descriptor Error IRQ */
34 .rxde_irq = 14, /* RX Descriptor Error IRQ */
35 .serr_irq = 10, /* MAL System Error IRQ */
36};
37OCP_SYSFS_MAL_DATA()
38
39static struct ocp_func_emac_data ibm405ep_emac0_def = {
40 .rgmii_idx = -1, /* No RGMII */
41 .rgmii_mux = -1, /* No RGMII */
42 .zmii_idx = -1, /* ZMII device index */
43 .zmii_mux = 0, /* ZMII input of this EMAC */
44 .mal_idx = 0, /* MAL device index */
45 .mal_rx_chan = 0, /* MAL rx channel number */
46 .mal_tx_chan = 0, /* MAL tx channel number */
47 .wol_irq = 9, /* WOL interrupt number */
48 .mdio_idx = 0, /* MDIO via EMAC0 */
49 .tah_idx = -1, /* No TAH */
50};
51
52static struct ocp_func_emac_data ibm405ep_emac1_def = {
53 .rgmii_idx = -1, /* No RGMII */
54 .rgmii_mux = -1, /* No RGMII */
55 .zmii_idx = -1, /* ZMII device index */
56 .zmii_mux = 0, /* ZMII input of this EMAC */
57 .mal_idx = 0, /* MAL device index */
58 .mal_rx_chan = 1, /* MAL rx channel number */
59 .mal_tx_chan = 2, /* MAL tx channel number */
60 .wol_irq = 9, /* WOL interrupt number */
61 .mdio_idx = 0, /* MDIO via EMAC0 */
62 .tah_idx = -1, /* No TAH */
63};
64OCP_SYSFS_EMAC_DATA()
65
66static struct ocp_func_iic_data ibm405ep_iic0_def = {
67 .fast_mode = 0, /* Use standad mode (100Khz) */
68};
69OCP_SYSFS_IIC_DATA()
70
71struct ocp_def core_ocp[] = {
72 { .vendor = OCP_VENDOR_IBM,
73 .function = OCP_FUNC_OPB,
74 .index = 0,
75 .paddr = 0xEF600000,
76 .irq = OCP_IRQ_NA,
77 .pm = OCP_CPM_NA,
78 },
79 { .vendor = OCP_VENDOR_IBM,
80 .function = OCP_FUNC_16550,
81 .index = 0,
82 .paddr = UART0_IO_BASE,
83 .irq = UART0_INT,
84 .pm = IBM_CPM_UART0
85 },
86 { .vendor = OCP_VENDOR_IBM,
87 .function = OCP_FUNC_16550,
88 .index = 1,
89 .paddr = UART1_IO_BASE,
90 .irq = UART1_INT,
91 .pm = IBM_CPM_UART1
92 },
93 { .vendor = OCP_VENDOR_IBM,
94 .function = OCP_FUNC_IIC,
95 .paddr = 0xEF600500,
96 .irq = 2,
97 .pm = IBM_CPM_IIC0,
98 .additions = &ibm405ep_iic0_def,
99 .show = &ocp_show_iic_data
100 },
101 { .vendor = OCP_VENDOR_IBM,
102 .function = OCP_FUNC_GPIO,
103 .paddr = 0xEF600700,
104 .irq = OCP_IRQ_NA,
105 .pm = IBM_CPM_GPIO0
106 },
107 { .vendor = OCP_VENDOR_IBM,
108 .function = OCP_FUNC_MAL,
109 .paddr = OCP_PADDR_NA,
110 .irq = OCP_IRQ_NA,
111 .pm = OCP_CPM_NA,
112 .additions = &ibm405ep_mal0_def,
113 .show = &ocp_show_mal_data
114 },
115 { .vendor = OCP_VENDOR_IBM,
116 .function = OCP_FUNC_EMAC,
117 .index = 0,
118 .paddr = EMAC0_BASE,
119 .irq = 15,
120 .pm = OCP_CPM_NA,
121 .additions = &ibm405ep_emac0_def,
122 .show = &ocp_show_emac_data
123 },
124 { .vendor = OCP_VENDOR_IBM,
125 .function = OCP_FUNC_EMAC,
126 .index = 1,
127 .paddr = 0xEF600900,
128 .irq = 17,
129 .pm = OCP_CPM_NA,
130 .additions = &ibm405ep_emac1_def,
131 .show = &ocp_show_emac_data
132 },
133 { .vendor = OCP_VENDOR_INVALID
134 }
135};
136
137/* Polarity and triggering settings for internal interrupt sources */
138struct ppc4xx_uic_settings ppc4xx_core_uic_cfg[] __initdata = {
139 { .polarity = 0xffff7f80,
140 .triggering = 0x00000000,
141 .ext_irq_mask = 0x0000007f, /* IRQ0 - IRQ6 */
142 }
143};
diff --git a/arch/ppc/platforms/4xx/ibm405ep.h b/arch/ppc/platforms/4xx/ibm405ep.h
new file mode 100644
index 000000000000..e051e3fe8c63
--- /dev/null
+++ b/arch/ppc/platforms/4xx/ibm405ep.h
@@ -0,0 +1,148 @@
1/*
2 * arch/ppc/platforms/4xx/ibm405ep.h
3 *
4 * IBM PPC 405EP processor defines.
5 *
6 * Author: SAW (IBM), derived from ibm405gp.h.
7 * Maintained by MontaVista Software <source@mvista.com>
8 *
9 * 2003 (c) MontaVista Softare Inc. This file is licensed under the
10 * terms of the GNU General Public License version 2. This program is
11 * licensed "as is" without any warranty of any kind, whether express
12 * or implied.
13 */
14
15#ifdef __KERNEL__
16#ifndef __ASM_IBM405EP_H__
17#define __ASM_IBM405EP_H__
18
19#include <linux/config.h>
20
21/* ibm405.h at bottom of this file */
22
23/* PCI
24 * PCI Bridge config reg definitions
25 * see 17-19 of manual
26 */
27
28#define PPC405_PCI_CONFIG_ADDR 0xeec00000
29#define PPC405_PCI_CONFIG_DATA 0xeec00004
30
31#define PPC405_PCI_PHY_MEM_BASE 0x80000000 /* hose_a->pci_mem_offset */
32 /* setbat */
33#define PPC405_PCI_MEM_BASE PPC405_PCI_PHY_MEM_BASE /* setbat */
34#define PPC405_PCI_PHY_IO_BASE 0xe8000000 /* setbat */
35#define PPC405_PCI_IO_BASE PPC405_PCI_PHY_IO_BASE /* setbat */
36
37#define PPC405_PCI_LOWER_MEM 0x80000000 /* hose_a->mem_space.start */
38#define PPC405_PCI_UPPER_MEM 0xBfffffff /* hose_a->mem_space.end */
39#define PPC405_PCI_LOWER_IO 0x00000000 /* hose_a->io_space.start */
40#define PPC405_PCI_UPPER_IO 0x0000ffff /* hose_a->io_space.end */
41
42#define PPC405_ISA_IO_BASE PPC405_PCI_IO_BASE
43
44#define PPC4xx_PCI_IO_PADDR ((uint)PPC405_PCI_PHY_IO_BASE)
45#define PPC4xx_PCI_IO_VADDR PPC4xx_PCI_IO_PADDR
46#define PPC4xx_PCI_IO_SIZE ((uint)64*1024)
47#define PPC4xx_PCI_CFG_PADDR ((uint)PPC405_PCI_CONFIG_ADDR)
48#define PPC4xx_PCI_CFG_VADDR PPC4xx_PCI_CFG_PADDR
49#define PPC4xx_PCI_CFG_SIZE ((uint)4*1024)
50#define PPC4xx_PCI_LCFG_PADDR ((uint)0xef400000)
51#define PPC4xx_PCI_LCFG_VADDR PPC4xx_PCI_LCFG_PADDR
52#define PPC4xx_PCI_LCFG_SIZE ((uint)4*1024)
53#define PPC4xx_ONB_IO_PADDR ((uint)0xef600000)
54#define PPC4xx_ONB_IO_VADDR PPC4xx_ONB_IO_PADDR
55#define PPC4xx_ONB_IO_SIZE ((uint)4*1024)
56
57/* serial port defines */
58#define RS_TABLE_SIZE 2
59
60#define UART0_INT 0
61#define UART1_INT 1
62
63#define PCIL0_BASE 0xEF400000
64#define UART0_IO_BASE 0xEF600300
65#define UART1_IO_BASE 0xEF600400
66#define EMAC0_BASE 0xEF600800
67
68#define BD_EMAC_ADDR(e,i) bi_enetaddr[e][i]
69
70#if defined(CONFIG_UART0_TTYS0)
71#define ACTING_UART0_IO_BASE UART0_IO_BASE
72#define ACTING_UART1_IO_BASE UART1_IO_BASE
73#define ACTING_UART0_INT UART0_INT
74#define ACTING_UART1_INT UART1_INT
75#else
76#define ACTING_UART0_IO_BASE UART1_IO_BASE
77#define ACTING_UART1_IO_BASE UART0_IO_BASE
78#define ACTING_UART0_INT UART1_INT
79#define ACTING_UART1_INT UART0_INT
80#endif
81
82#define STD_UART_OP(num) \
83 { 0, BASE_BAUD, 0, ACTING_UART##num##_INT, \
84 (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST), \
85 iomem_base: (u8 *)ACTING_UART##num##_IO_BASE, \
86 io_type: SERIAL_IO_MEM},
87
88#define SERIAL_DEBUG_IO_BASE ACTING_UART0_IO_BASE
89#define SERIAL_PORT_DFNS \
90 STD_UART_OP(0) \
91 STD_UART_OP(1)
92
93/* DCR defines */
94#define DCRN_CPMSR_BASE 0x0BA
95#define DCRN_CPMFR_BASE 0x0B9
96
97#define DCRN_CPC0_PLLMR0_BASE 0x0F0
98#define DCRN_CPC0_BOOT_BASE 0x0F1
99#define DCRN_CPC0_CR1_BASE 0x0F2
100#define DCRN_CPC0_EPRCSR_BASE 0x0F3
101#define DCRN_CPC0_PLLMR1_BASE 0x0F4
102#define DCRN_CPC0_UCR_BASE 0x0F5
103#define DCRN_CPC0_UCR_U0DIV 0x07F
104#define DCRN_CPC0_SRR_BASE 0x0F6
105#define DCRN_CPC0_JTAGID_BASE 0x0F7
106#define DCRN_CPC0_SPARE_BASE 0x0F8
107#define DCRN_CPC0_PCI_BASE 0x0F9
108
109
110#define IBM_CPM_GPT 0x80000000 /* GPT interface */
111#define IBM_CPM_PCI 0x40000000 /* PCI bridge */
112#define IBM_CPM_UIC 0x00010000 /* Universal Int Controller */
113#define IBM_CPM_CPU 0x00008000 /* processor core */
114#define IBM_CPM_EBC 0x00002000 /* EBC controller */
115#define IBM_CPM_SDRAM0 0x00004000 /* SDRAM memory controller */
116#define IBM_CPM_GPIO0 0x00001000 /* General Purpose IO */
117#define IBM_CPM_TMRCLK 0x00000400 /* CPU timers */
118#define IBM_CPM_PLB 0x00000100 /* PLB bus arbiter */
119#define IBM_CPM_OPB 0x00000080 /* PLB to OPB bridge */
120#define IBM_CPM_DMA 0x00000040 /* DMA controller */
121#define IBM_CPM_IIC0 0x00000010 /* IIC interface */
122#define IBM_CPM_UART1 0x00000002 /* serial port 0 */
123#define IBM_CPM_UART0 0x00000001 /* serial port 1 */
124#define DFLT_IBM4xx_PM ~(IBM_CPM_PCI | IBM_CPM_CPU | IBM_CPM_DMA \
125 | IBM_CPM_OPB | IBM_CPM_EBC \
126 | IBM_CPM_SDRAM0 | IBM_CPM_PLB \
127 | IBM_CPM_UIC | IBM_CPM_TMRCLK)
128#define DCRN_DMA0_BASE 0x100
129#define DCRN_DMA1_BASE 0x108
130#define DCRN_DMA2_BASE 0x110
131#define DCRN_DMA3_BASE 0x118
132#define DCRNCAP_DMA_SG 1 /* have DMA scatter/gather capability */
133#define DCRN_DMASR_BASE 0x120
134#define DCRN_EBC_BASE 0x012
135#define DCRN_DCP0_BASE 0x014
136#define DCRN_MAL_BASE 0x180
137#define DCRN_OCM0_BASE 0x018
138#define DCRN_PLB0_BASE 0x084
139#define DCRN_PLLMR_BASE 0x0B0
140#define DCRN_POB0_BASE 0x0A0
141#define DCRN_SDRAM0_BASE 0x010
142#define DCRN_UIC0_BASE 0x0C0
143#define UIC0 DCRN_UIC0_BASE
144
145#include <asm/ibm405.h>
146
147#endif /* __ASM_IBM405EP_H__ */
148#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/4xx/ibm405gp.c b/arch/ppc/platforms/4xx/ibm405gp.c
new file mode 100644
index 000000000000..dfd7ef3ba5f8
--- /dev/null
+++ b/arch/ppc/platforms/4xx/ibm405gp.c
@@ -0,0 +1,120 @@
1/*
2 *
3 * Copyright 2000-2001 MontaVista Software Inc.
4 * Original author: Armin Kuster akuster@mvista.com
5 *
6 * Module name: ibm405gp.c
7 *
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 */
15
16#include <linux/config.h>
17#include <linux/init.h>
18#include <linux/smp.h>
19#include <linux/threads.h>
20#include <linux/param.h>
21#include <linux/string.h>
22#include <platforms/4xx/ibm405gp.h>
23#include <asm/ibm4xx.h>
24#include <asm/ocp.h>
25#include <asm/ppc4xx_pic.h>
26
27static struct ocp_func_emac_data ibm405gp_emac0_def = {
28 .rgmii_idx = -1, /* No RGMII */
29 .rgmii_mux = -1, /* No RGMII */
30 .zmii_idx = -1, /* ZMII device index */
31 .zmii_mux = 0, /* ZMII input of this EMAC */
32 .mal_idx = 0, /* MAL device index */
33 .mal_rx_chan = 0, /* MAL rx channel number */
34 .mal_tx_chan = 0, /* MAL tx channel number */
35 .wol_irq = 9, /* WOL interrupt number */
36 .mdio_idx = -1, /* No shared MDIO */
37 .tah_idx = -1, /* No TAH */
38};
39OCP_SYSFS_EMAC_DATA()
40
41static struct ocp_func_mal_data ibm405gp_mal0_def = {
42 .num_tx_chans = 1, /* Number of TX channels */
43 .num_rx_chans = 1, /* Number of RX channels */
44 .txeob_irq = 11, /* TX End Of Buffer IRQ */
45 .rxeob_irq = 12, /* RX End Of Buffer IRQ */
46 .txde_irq = 13, /* TX Descriptor Error IRQ */
47 .rxde_irq = 14, /* RX Descriptor Error IRQ */
48 .serr_irq = 10, /* MAL System Error IRQ */
49};
50OCP_SYSFS_MAL_DATA()
51
52static struct ocp_func_iic_data ibm405gp_iic0_def = {
53 .fast_mode = 0, /* Use standad mode (100Khz) */
54};
55OCP_SYSFS_IIC_DATA()
56
57struct ocp_def core_ocp[] = {
58 { .vendor = OCP_VENDOR_IBM,
59 .function = OCP_FUNC_OPB,
60 .index = 0,
61 .paddr = 0xEF600000,
62 .irq = OCP_IRQ_NA,
63 .pm = OCP_CPM_NA,
64 },
65 { .vendor = OCP_VENDOR_IBM,
66 .function = OCP_FUNC_16550,
67 .index = 0,
68 .paddr = UART0_IO_BASE,
69 .irq = UART0_INT,
70 .pm = IBM_CPM_UART0
71 },
72 { .vendor = OCP_VENDOR_IBM,
73 .function = OCP_FUNC_16550,
74 .index = 1,
75 .paddr = UART1_IO_BASE,
76 .irq = UART1_INT,
77 .pm = IBM_CPM_UART1
78 },
79 { .vendor = OCP_VENDOR_IBM,
80 .function = OCP_FUNC_IIC,
81 .paddr = 0xEF600500,
82 .irq = 2,
83 .pm = IBM_CPM_IIC0,
84 .additions = &ibm405gp_iic0_def,
85 .show = &ocp_show_iic_data,
86 },
87 { .vendor = OCP_VENDOR_IBM,
88 .function = OCP_FUNC_GPIO,
89 .paddr = 0xEF600700,
90 .irq = OCP_IRQ_NA,
91 .pm = IBM_CPM_GPIO0
92 },
93 { .vendor = OCP_VENDOR_IBM,
94 .function = OCP_FUNC_MAL,
95 .paddr = OCP_PADDR_NA,
96 .irq = OCP_IRQ_NA,
97 .pm = OCP_CPM_NA,
98 .additions = &ibm405gp_mal0_def,
99 .show = &ocp_show_mal_data,
100 },
101 { .vendor = OCP_VENDOR_IBM,
102 .function = OCP_FUNC_EMAC,
103 .index = 0,
104 .paddr = EMAC0_BASE,
105 .irq = 15,
106 .pm = IBM_CPM_EMAC0,
107 .additions = &ibm405gp_emac0_def,
108 .show = &ocp_show_emac_data,
109 },
110 { .vendor = OCP_VENDOR_INVALID
111 }
112};
113
114/* Polarity and triggering settings for internal interrupt sources */
115struct ppc4xx_uic_settings ppc4xx_core_uic_cfg[] __initdata = {
116 { .polarity = 0xffffff80,
117 .triggering = 0x10000000,
118 .ext_irq_mask = 0x0000007f, /* IRQ0 - IRQ6 */
119 }
120};
diff --git a/arch/ppc/platforms/4xx/ibm405gp.h b/arch/ppc/platforms/4xx/ibm405gp.h
new file mode 100644
index 000000000000..b2b642e81af7
--- /dev/null
+++ b/arch/ppc/platforms/4xx/ibm405gp.h
@@ -0,0 +1,151 @@
1/*
2 * arch/ppc/platforms/4xx/ibm405gp.h
3 *
4 * Author: Armin Kuster akuster@mvista.com
5 *
6 * 2001 (c) MontaVista, Software, Inc. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10 */
11
12#ifdef __KERNEL__
13#ifndef __ASM_IBM405GP_H__
14#define __ASM_IBM405GP_H__
15
16#include <linux/config.h>
17
18/* ibm405.h at bottom of this file */
19
20/* PCI
21 * PCI Bridge config reg definitions
22 * see 17-19 of manual
23 */
24
25#define PPC405_PCI_CONFIG_ADDR 0xeec00000
26#define PPC405_PCI_CONFIG_DATA 0xeec00004
27
28#define PPC405_PCI_PHY_MEM_BASE 0x80000000 /* hose_a->pci_mem_offset */
29 /* setbat */
30#define PPC405_PCI_MEM_BASE PPC405_PCI_PHY_MEM_BASE /* setbat */
31#define PPC405_PCI_PHY_IO_BASE 0xe8000000 /* setbat */
32#define PPC405_PCI_IO_BASE PPC405_PCI_PHY_IO_BASE /* setbat */
33
34#define PPC405_PCI_LOWER_MEM 0x80000000 /* hose_a->mem_space.start */
35#define PPC405_PCI_UPPER_MEM 0xBfffffff /* hose_a->mem_space.end */
36#define PPC405_PCI_LOWER_IO 0x00000000 /* hose_a->io_space.start */
37#define PPC405_PCI_UPPER_IO 0x0000ffff /* hose_a->io_space.end */
38
39#define PPC405_ISA_IO_BASE PPC405_PCI_IO_BASE
40
41#define PPC4xx_PCI_IO_PADDR ((uint)PPC405_PCI_PHY_IO_BASE)
42#define PPC4xx_PCI_IO_VADDR PPC4xx_PCI_IO_PADDR
43#define PPC4xx_PCI_IO_SIZE ((uint)64*1024)
44#define PPC4xx_PCI_CFG_PADDR ((uint)PPC405_PCI_CONFIG_ADDR)
45#define PPC4xx_PCI_CFG_VADDR PPC4xx_PCI_CFG_PADDR
46#define PPC4xx_PCI_CFG_SIZE ((uint)4*1024)
47#define PPC4xx_PCI_LCFG_PADDR ((uint)0xef400000)
48#define PPC4xx_PCI_LCFG_VADDR PPC4xx_PCI_LCFG_PADDR
49#define PPC4xx_PCI_LCFG_SIZE ((uint)4*1024)
50#define PPC4xx_ONB_IO_PADDR ((uint)0xef600000)
51#define PPC4xx_ONB_IO_VADDR PPC4xx_ONB_IO_PADDR
52#define PPC4xx_ONB_IO_SIZE ((uint)4*1024)
53
54/* serial port defines */
55#define RS_TABLE_SIZE 2
56
57#define UART0_INT 0
58#define UART1_INT 1
59
60#define PCIL0_BASE 0xEF400000
61#define UART0_IO_BASE 0xEF600300
62#define UART1_IO_BASE 0xEF600400
63#define EMAC0_BASE 0xEF600800
64
65#define BD_EMAC_ADDR(e,i) bi_enetaddr[i]
66
67#define STD_UART_OP(num) \
68 { 0, BASE_BAUD, 0, UART##num##_INT, \
69 (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST), \
70 iomem_base: (u8 *)UART##num##_IO_BASE, \
71 io_type: SERIAL_IO_MEM},
72
73#if defined(CONFIG_UART0_TTYS0)
74#define SERIAL_DEBUG_IO_BASE UART0_IO_BASE
75#define SERIAL_PORT_DFNS \
76 STD_UART_OP(0) \
77 STD_UART_OP(1)
78#endif
79
80#if defined(CONFIG_UART0_TTYS1)
81#define SERIAL_DEBUG_IO_BASE UART1_IO_BASE
82#define SERIAL_PORT_DFNS \
83 STD_UART_OP(1) \
84 STD_UART_OP(0)
85#endif
86
87/* DCR defines */
88#define DCRN_CHCR_BASE 0x0B1
89#define DCRN_CHPSR_BASE 0x0B4
90#define DCRN_CPMSR_BASE 0x0B8
91#define DCRN_CPMFR_BASE 0x0BA
92
93#define CHR0_U0EC 0x00000080 /* Select external clock for UART0 */
94#define CHR0_U1EC 0x00000040 /* Select external clock for UART1 */
95#define CHR0_UDIV 0x0000003E /* UART internal clock divisor */
96#define CHR1_CETE 0x00800000 /* CPU external timer enable */
97
98#define DCRN_CHPSR_BASE 0x0B4
99#define PSR_PLL_FWD_MASK 0xC0000000
100#define PSR_PLL_FDBACK_MASK 0x30000000
101#define PSR_PLL_TUNING_MASK 0x0E000000
102#define PSR_PLB_CPU_MASK 0x01800000
103#define PSR_OPB_PLB_MASK 0x00600000
104#define PSR_PCI_PLB_MASK 0x00180000
105#define PSR_EB_PLB_MASK 0x00060000
106#define PSR_ROM_WIDTH_MASK 0x00018000
107#define PSR_ROM_LOC 0x00004000
108#define PSR_PCI_ASYNC_EN 0x00001000
109#define PSR_PCI_ARBIT_EN 0x00000400
110
111#define IBM_CPM_IIC0 0x80000000 /* IIC interface */
112#define IBM_CPM_PCI 0x40000000 /* PCI bridge */
113#define IBM_CPM_CPU 0x20000000 /* processor core */
114#define IBM_CPM_DMA 0x10000000 /* DMA controller */
115#define IBM_CPM_OPB 0x08000000 /* PLB to OPB bridge */
116#define IBM_CPM_DCP 0x04000000 /* CodePack */
117#define IBM_CPM_EBC 0x02000000 /* ROM/SRAM peripheral controller */
118#define IBM_CPM_SDRAM0 0x01000000 /* SDRAM memory controller */
119#define IBM_CPM_PLB 0x00800000 /* PLB bus arbiter */
120#define IBM_CPM_GPIO0 0x00400000 /* General Purpose IO (??) */
121#define IBM_CPM_UART0 0x00200000 /* serial port 0 */
122#define IBM_CPM_UART1 0x00100000 /* serial port 1 */
123#define IBM_CPM_UIC 0x00080000 /* Universal Interrupt Controller */
124#define IBM_CPM_TMRCLK 0x00040000 /* CPU timers */
125#define IBM_CPM_EMAC0 0x00020000 /* on-chip ethernet MM unit */
126#define DFLT_IBM4xx_PM ~(IBM_CPM_PCI | IBM_CPM_CPU | IBM_CPM_DMA \
127 | IBM_CPM_OPB | IBM_CPM_EBC \
128 | IBM_CPM_SDRAM0 | IBM_CPM_PLB \
129 | IBM_CPM_UIC | IBM_CPM_TMRCLK)
130
131#define DCRN_DMA0_BASE 0x100
132#define DCRN_DMA1_BASE 0x108
133#define DCRN_DMA2_BASE 0x110
134#define DCRN_DMA3_BASE 0x118
135#define DCRNCAP_DMA_SG 1 /* have DMA scatter/gather capability */
136#define DCRN_DMASR_BASE 0x120
137#define DCRN_EBC_BASE 0x012
138#define DCRN_DCP0_BASE 0x014
139#define DCRN_MAL_BASE 0x180
140#define DCRN_OCM0_BASE 0x018
141#define DCRN_PLB0_BASE 0x084
142#define DCRN_PLLMR_BASE 0x0B0
143#define DCRN_POB0_BASE 0x0A0
144#define DCRN_SDRAM0_BASE 0x010
145#define DCRN_UIC0_BASE 0x0C0
146#define UIC0 DCRN_UIC0_BASE
147
148#include <asm/ibm405.h>
149
150#endif /* __ASM_IBM405GP_H__ */
151#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/4xx/ibm405gpr.c b/arch/ppc/platforms/4xx/ibm405gpr.c
new file mode 100644
index 000000000000..01c8ccbc7214
--- /dev/null
+++ b/arch/ppc/platforms/4xx/ibm405gpr.c
@@ -0,0 +1,117 @@
1/*
2 * arch/ppc/platforms/4xx/ibm405gpr.c
3 *
4 * Author: Armin Kuster <akuster@mvista.com>
5 *
6 * 2002 (c) MontaVista, Software, Inc. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10 */
11
12#include <linux/config.h>
13#include <linux/init.h>
14#include <linux/smp.h>
15#include <linux/threads.h>
16#include <linux/param.h>
17#include <linux/string.h>
18#include <platforms/4xx/ibm405gpr.h>
19#include <asm/ibm4xx.h>
20#include <asm/ocp.h>
21#include <asm/ppc4xx_pic.h>
22
23static struct ocp_func_emac_data ibm405gpr_emac0_def = {
24 .rgmii_idx = -1, /* No RGMII */
25 .rgmii_mux = -1, /* No RGMII */
26 .zmii_idx = -1, /* ZMII device index */
27 .zmii_mux = 0, /* ZMII input of this EMAC */
28 .mal_idx = 0, /* MAL device index */
29 .mal_rx_chan = 0, /* MAL rx channel number */
30 .mal_tx_chan = 0, /* MAL tx channel number */
31 .wol_irq = 9, /* WOL interrupt number */
32 .mdio_idx = -1, /* No shared MDIO */
33 .tah_idx = -1, /* No TAH */
34};
35OCP_SYSFS_EMAC_DATA()
36
37static struct ocp_func_mal_data ibm405gpr_mal0_def = {
38 .num_tx_chans = 1, /* Number of TX channels */
39 .num_rx_chans = 1, /* Number of RX channels */
40 .txeob_irq = 11, /* TX End Of Buffer IRQ */
41 .rxeob_irq = 12, /* RX End Of Buffer IRQ */
42 .txde_irq = 13, /* TX Descriptor Error IRQ */
43 .rxde_irq = 14, /* RX Descriptor Error IRQ */
44 .serr_irq = 10, /* MAL System Error IRQ */
45};
46OCP_SYSFS_MAL_DATA()
47
48static struct ocp_func_iic_data ibm405gpr_iic0_def = {
49 .fast_mode = 0, /* Use standad mode (100Khz) */
50};
51
52OCP_SYSFS_IIC_DATA()
53
54struct ocp_def core_ocp[] = {
55 { .vendor = OCP_VENDOR_IBM,
56 .function = OCP_FUNC_OPB,
57 .index = 0,
58 .paddr = 0xEF600000,
59 .irq = OCP_IRQ_NA,
60 .pm = OCP_CPM_NA,
61 },
62 { .vendor = OCP_VENDOR_IBM,
63 .function = OCP_FUNC_16550,
64 .index = 0,
65 .paddr = UART0_IO_BASE,
66 .irq = UART0_INT,
67 .pm = IBM_CPM_UART0
68 },
69 { .vendor = OCP_VENDOR_IBM,
70 .function = OCP_FUNC_16550,
71 .index = 1,
72 .paddr = UART1_IO_BASE,
73 .irq = UART1_INT,
74 .pm = IBM_CPM_UART1
75 },
76 { .vendor = OCP_VENDOR_IBM,
77 .function = OCP_FUNC_IIC,
78 .paddr = 0xEF600500,
79 .irq = 2,
80 .pm = IBM_CPM_IIC0,
81 .additions = &ibm405gpr_iic0_def,
82 .show = &ocp_show_iic_data,
83 },
84 { .vendor = OCP_VENDOR_IBM,
85 .function = OCP_FUNC_GPIO,
86 .paddr = 0xEF600700,
87 .irq = OCP_IRQ_NA,
88 .pm = IBM_CPM_GPIO0
89 },
90 { .vendor = OCP_VENDOR_IBM,
91 .function = OCP_FUNC_MAL,
92 .paddr = OCP_PADDR_NA,
93 .irq = OCP_IRQ_NA,
94 .pm = OCP_CPM_NA,
95 .additions = &ibm405gpr_mal0_def,
96 .show = &ocp_show_mal_data,
97 },
98 { .vendor = OCP_VENDOR_IBM,
99 .function = OCP_FUNC_EMAC,
100 .index = 0,
101 .paddr = EMAC0_BASE,
102 .irq = 15,
103 .pm = IBM_CPM_EMAC0,
104 .additions = &ibm405gpr_emac0_def,
105 .show = &ocp_show_emac_data,
106 },
107 { .vendor = OCP_VENDOR_INVALID
108 }
109};
110
111/* Polarity and triggering settings for internal interrupt sources */
112struct ppc4xx_uic_settings ppc4xx_core_uic_cfg[] __initdata = {
113 { .polarity = 0xffffe000,
114 .triggering = 0x10000000,
115 .ext_irq_mask = 0x00001fff, /* IRQ7 - IRQ12, IRQ0 - IRQ6 */
116 }
117};
diff --git a/arch/ppc/platforms/4xx/ibm405gpr.h b/arch/ppc/platforms/4xx/ibm405gpr.h
new file mode 100644
index 000000000000..45412fb4368f
--- /dev/null
+++ b/arch/ppc/platforms/4xx/ibm405gpr.h
@@ -0,0 +1,151 @@
1/*
2 * arch/ppc/platforms/4xx/ibm405gpr.h
3 *
4 * Author: Armin Kuster <akuster@mvista.com>
5 *
6 * 2002 (c) MontaVista, Software, Inc. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10 */
11
12#ifdef __KERNEL__
13#ifndef __ASM_IBM405GPR_H__
14#define __ASM_IBM405GPR_H__
15
16#include <linux/config.h>
17
18/* ibm405.h at bottom of this file */
19
20/* PCI
21 * PCI Bridge config reg definitions
22 * see 17-19 of manual
23 */
24
25#define PPC405_PCI_CONFIG_ADDR 0xeec00000
26#define PPC405_PCI_CONFIG_DATA 0xeec00004
27
28#define PPC405_PCI_PHY_MEM_BASE 0x80000000 /* hose_a->pci_mem_offset */
29 /* setbat */
30#define PPC405_PCI_MEM_BASE PPC405_PCI_PHY_MEM_BASE /* setbat */
31#define PPC405_PCI_PHY_IO_BASE 0xe8000000 /* setbat */
32#define PPC405_PCI_IO_BASE PPC405_PCI_PHY_IO_BASE /* setbat */
33
34#define PPC405_PCI_LOWER_MEM 0x80000000 /* hose_a->mem_space.start */
35#define PPC405_PCI_UPPER_MEM 0xBfffffff /* hose_a->mem_space.end */
36#define PPC405_PCI_LOWER_IO 0x00000000 /* hose_a->io_space.start */
37#define PPC405_PCI_UPPER_IO 0x0000ffff /* hose_a->io_space.end */
38
39#define PPC405_ISA_IO_BASE PPC405_PCI_IO_BASE
40
41#define PPC4xx_PCI_IO_PADDR ((uint)PPC405_PCI_PHY_IO_BASE)
42#define PPC4xx_PCI_IO_VADDR PPC4xx_PCI_IO_PADDR
43#define PPC4xx_PCI_IO_SIZE ((uint)64*1024)
44#define PPC4xx_PCI_CFG_PADDR ((uint)PPC405_PCI_CONFIG_ADDR)
45#define PPC4xx_PCI_CFG_VADDR PPC4xx_PCI_CFG_PADDR
46#define PPC4xx_PCI_CFG_SIZE ((uint)4*1024)
47#define PPC4xx_PCI_LCFG_PADDR ((uint)0xef400000)
48#define PPC4xx_PCI_LCFG_VADDR PPC4xx_PCI_LCFG_PADDR
49#define PPC4xx_PCI_LCFG_SIZE ((uint)4*1024)
50#define PPC4xx_ONB_IO_PADDR ((uint)0xef600000)
51#define PPC4xx_ONB_IO_VADDR PPC4xx_ONB_IO_PADDR
52#define PPC4xx_ONB_IO_SIZE ((uint)4*1024)
53
54/* serial port defines */
55#define RS_TABLE_SIZE 2
56
57#define UART0_INT 0
58#define UART1_INT 1
59
60#define PCIL0_BASE 0xEF400000
61#define UART0_IO_BASE 0xEF600300
62#define UART1_IO_BASE 0xEF600400
63#define EMAC0_BASE 0xEF600800
64
65#define BD_EMAC_ADDR(e,i) bi_enetaddr[i]
66
67#define STD_UART_OP(num) \
68 { 0, BASE_BAUD, 0, UART##num##_INT, \
69 (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST), \
70 iomem_base: (u8 *)UART##num##_IO_BASE, \
71 io_type: SERIAL_IO_MEM},
72
73#if defined(CONFIG_UART0_TTYS0)
74#define SERIAL_DEBUG_IO_BASE UART0_IO_BASE
75#define SERIAL_PORT_DFNS \
76 STD_UART_OP(0) \
77 STD_UART_OP(1)
78#endif
79
80#if defined(CONFIG_UART0_TTYS1)
81#define SERIAL_DEBUG_IO_BASE UART1_IO_BASE
82#define SERIAL_PORT_DFNS \
83 STD_UART_OP(1) \
84 STD_UART_OP(0)
85#endif
86
87/* DCR defines */
88#define DCRN_CHCR_BASE 0x0B1
89#define DCRN_CHPSR_BASE 0x0B4
90#define DCRN_CPMSR_BASE 0x0B8
91#define DCRN_CPMFR_BASE 0x0BA
92
93#define CHR0_U0EC 0x00000080 /* Select external clock for UART0 */
94#define CHR0_U1EC 0x00000040 /* Select external clock for UART1 */
95#define CHR0_UDIV 0x0000003E /* UART internal clock divisor */
96#define CHR1_CETE 0x00800000 /* CPU external timer enable */
97
98#define DCRN_CHPSR_BASE 0x0B4
99#define PSR_PLL_FWD_MASK 0xC0000000
100#define PSR_PLL_FDBACK_MASK 0x30000000
101#define PSR_PLL_TUNING_MASK 0x0E000000
102#define PSR_PLB_CPU_MASK 0x01800000
103#define PSR_OPB_PLB_MASK 0x00600000
104#define PSR_PCI_PLB_MASK 0x00180000
105#define PSR_EB_PLB_MASK 0x00060000
106#define PSR_ROM_WIDTH_MASK 0x00018000
107#define PSR_ROM_LOC 0x00004000
108#define PSR_PCI_ASYNC_EN 0x00001000
109#define PSR_PCI_ARBIT_EN 0x00000400
110
111#define IBM_CPM_IIC0 0x80000000 /* IIC interface */
112#define IBM_CPM_PCI 0x40000000 /* PCI bridge */
113#define IBM_CPM_CPU 0x20000000 /* processor core */
114#define IBM_CPM_DMA 0x10000000 /* DMA controller */
115#define IBM_CPM_OPB 0x08000000 /* PLB to OPB bridge */
116#define IBM_CPM_DCP 0x04000000 /* CodePack */
117#define IBM_CPM_EBC 0x02000000 /* ROM/SRAM peripheral controller */
118#define IBM_CPM_SDRAM0 0x01000000 /* SDRAM memory controller */
119#define IBM_CPM_PLB 0x00800000 /* PLB bus arbiter */
120#define IBM_CPM_GPIO0 0x00400000 /* General Purpose IO (??) */
121#define IBM_CPM_UART0 0x00200000 /* serial port 0 */
122#define IBM_CPM_UART1 0x00100000 /* serial port 1 */
123#define IBM_CPM_UIC 0x00080000 /* Universal Interrupt Controller */
124#define IBM_CPM_TMRCLK 0x00040000 /* CPU timers */
125#define IBM_CPM_EMAC0 0x00020000 /* on-chip ethernet MM unit */
126#define DFLT_IBM4xx_PM ~(IBM_CPM_PCI | IBM_CPM_CPU | IBM_CPM_DMA \
127 | IBM_CPM_OPB | IBM_CPM_EBC \
128 | IBM_CPM_SDRAM0 | IBM_CPM_PLB \
129 | IBM_CPM_UIC | IBM_CPM_TMRCLK)
130
131#define DCRN_DMA0_BASE 0x100
132#define DCRN_DMA1_BASE 0x108
133#define DCRN_DMA2_BASE 0x110
134#define DCRN_DMA3_BASE 0x118
135#define DCRNCAP_DMA_SG 1 /* have DMA scatter/gather capability */
136#define DCRN_DMASR_BASE 0x120
137#define DCRN_EBC_BASE 0x012
138#define DCRN_DCP0_BASE 0x014
139#define DCRN_MAL_BASE 0x180
140#define DCRN_OCM0_BASE 0x018
141#define DCRN_PLB0_BASE 0x084
142#define DCRN_PLLMR_BASE 0x0B0
143#define DCRN_POB0_BASE 0x0A0
144#define DCRN_SDRAM0_BASE 0x010
145#define DCRN_UIC0_BASE 0x0C0
146#define UIC0 DCRN_UIC0_BASE
147
148#include <asm/ibm405.h>
149
150#endif /* __ASM_IBM405GPR_H__ */
151#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/4xx/ibm440gp.c b/arch/ppc/platforms/4xx/ibm440gp.c
new file mode 100644
index 000000000000..27615ef8309c
--- /dev/null
+++ b/arch/ppc/platforms/4xx/ibm440gp.c
@@ -0,0 +1,164 @@
1/*
2 * arch/ppc/platforms/4xx/ibm440gp.c
3 *
4 * PPC440GP I/O descriptions
5 *
6 * Matt Porter <mporter@mvista.com>
7 * Copyright 2002-2004 MontaVista Software Inc.
8 *
9 * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
10 * Copyright (c) 2003, 2004 Zultys Technologies
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 *
17 */
18#include <linux/init.h>
19#include <linux/module.h>
20#include <platforms/4xx/ibm440gp.h>
21#include <asm/ocp.h>
22#include <asm/ppc4xx_pic.h>
23
24static struct ocp_func_emac_data ibm440gp_emac0_def = {
25 .rgmii_idx = -1, /* No RGMII */
26 .rgmii_mux = -1, /* No RGMII */
27 .zmii_idx = 0, /* ZMII device index */
28 .zmii_mux = 0, /* ZMII input of this EMAC */
29 .mal_idx = 0, /* MAL device index */
30 .mal_rx_chan = 0, /* MAL rx channel number */
31 .mal_tx_chan = 0, /* MAL tx channel number */
32 .wol_irq = 61, /* WOL interrupt number */
33 .mdio_idx = -1, /* No shared MDIO */
34 .tah_idx = -1, /* No TAH */
35};
36
37static struct ocp_func_emac_data ibm440gp_emac1_def = {
38 .rgmii_idx = -1, /* No RGMII */
39 .rgmii_mux = -1, /* No RGMII */
40 .zmii_idx = 0, /* ZMII device index */
41 .zmii_mux = 1, /* ZMII input of this EMAC */
42 .mal_idx = 0, /* MAL device index */
43 .mal_rx_chan = 1, /* MAL rx channel number */
44 .mal_tx_chan = 2, /* MAL tx channel number */
45 .wol_irq = 63, /* WOL interrupt number */
46 .mdio_idx = -1, /* No shared MDIO */
47 .tah_idx = -1, /* No TAH */
48};
49OCP_SYSFS_EMAC_DATA()
50
51static struct ocp_func_mal_data ibm440gp_mal0_def = {
52 .num_tx_chans = 4, /* Number of TX channels */
53 .num_rx_chans = 2, /* Number of RX channels */
54 .txeob_irq = 10, /* TX End Of Buffer IRQ */
55 .rxeob_irq = 11, /* RX End Of Buffer IRQ */
56 .txde_irq = 33, /* TX Descriptor Error IRQ */
57 .rxde_irq = 34, /* RX Descriptor Error IRQ */
58 .serr_irq = 32, /* MAL System Error IRQ */
59};
60OCP_SYSFS_MAL_DATA()
61
62static struct ocp_func_iic_data ibm440gp_iic0_def = {
63 .fast_mode = 0, /* Use standad mode (100Khz) */
64};
65
66static struct ocp_func_iic_data ibm440gp_iic1_def = {
67 .fast_mode = 0, /* Use standad mode (100Khz) */
68};
69OCP_SYSFS_IIC_DATA()
70
71struct ocp_def core_ocp[] = {
72 { .vendor = OCP_VENDOR_IBM,
73 .function = OCP_FUNC_OPB,
74 .index = 0,
75 .paddr = 0x0000000140000000ULL,
76 .irq = OCP_IRQ_NA,
77 .pm = OCP_CPM_NA,
78 },
79 { .vendor = OCP_VENDOR_IBM,
80 .function = OCP_FUNC_16550,
81 .index = 0,
82 .paddr = PPC440GP_UART0_ADDR,
83 .irq = UART0_INT,
84 .pm = IBM_CPM_UART0,
85 },
86 { .vendor = OCP_VENDOR_IBM,
87 .function = OCP_FUNC_16550,
88 .index = 1,
89 .paddr = PPC440GP_UART1_ADDR,
90 .irq = UART1_INT,
91 .pm = IBM_CPM_UART1,
92 },
93 { .vendor = OCP_VENDOR_IBM,
94 .function = OCP_FUNC_IIC,
95 .index = 0,
96 .paddr = 0x0000000140000400ULL,
97 .irq = 2,
98 .pm = IBM_CPM_IIC0,
99 .additions = &ibm440gp_iic0_def,
100 .show = &ocp_show_iic_data
101 },
102 { .vendor = OCP_VENDOR_IBM,
103 .function = OCP_FUNC_IIC,
104 .index = 1,
105 .paddr = 0x0000000140000500ULL,
106 .irq = 3,
107 .pm = IBM_CPM_IIC1,
108 .additions = &ibm440gp_iic1_def,
109 .show = &ocp_show_iic_data
110 },
111 { .vendor = OCP_VENDOR_IBM,
112 .function = OCP_FUNC_GPIO,
113 .index = 0,
114 .paddr = 0x0000000140000700ULL,
115 .irq = OCP_IRQ_NA,
116 .pm = IBM_CPM_GPIO0,
117 },
118 { .vendor = OCP_VENDOR_IBM,
119 .function = OCP_FUNC_MAL,
120 .paddr = OCP_PADDR_NA,
121 .irq = OCP_IRQ_NA,
122 .pm = OCP_CPM_NA,
123 .additions = &ibm440gp_mal0_def,
124 .show = &ocp_show_mal_data,
125 },
126 { .vendor = OCP_VENDOR_IBM,
127 .function = OCP_FUNC_EMAC,
128 .index = 0,
129 .paddr = 0x0000000140000800ULL,
130 .irq = 60,
131 .pm = OCP_CPM_NA,
132 .additions = &ibm440gp_emac0_def,
133 .show = &ocp_show_emac_data,
134 },
135 { .vendor = OCP_VENDOR_IBM,
136 .function = OCP_FUNC_EMAC,
137 .index = 1,
138 .paddr = 0x0000000140000900ULL,
139 .irq = 62,
140 .pm = OCP_CPM_NA,
141 .additions = &ibm440gp_emac1_def,
142 .show = &ocp_show_emac_data,
143 },
144 { .vendor = OCP_VENDOR_IBM,
145 .function = OCP_FUNC_ZMII,
146 .paddr = 0x0000000140000780ULL,
147 .irq = OCP_IRQ_NA,
148 .pm = OCP_CPM_NA,
149 },
150 { .vendor = OCP_VENDOR_INVALID
151 }
152};
153
154/* Polarity and triggering settings for internal interrupt sources */
155struct ppc4xx_uic_settings ppc4xx_core_uic_cfg[] __initdata = {
156 { .polarity = 0xfffffe03,
157 .triggering = 0x01c00000,
158 .ext_irq_mask = 0x000001fc, /* IRQ0 - IRQ6 */
159 },
160 { .polarity = 0xffffc0ff,
161 .triggering = 0x00ff8000,
162 .ext_irq_mask = 0x00003f00, /* IRQ7 - IRQ12 */
163 },
164};
diff --git a/arch/ppc/platforms/4xx/ibm440gp.h b/arch/ppc/platforms/4xx/ibm440gp.h
new file mode 100644
index 000000000000..ae1efc03b295
--- /dev/null
+++ b/arch/ppc/platforms/4xx/ibm440gp.h
@@ -0,0 +1,66 @@
1/*
2 * arch/ppc/platforms/4xx/ibm440gp.h
3 *
4 * PPC440GP definitions
5 *
6 * Roland Dreier <roland@digitalvampire.org>
7 *
8 * Copyright 2002 Roland Dreier
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 * This file contains code that was originally in the files ibm44x.h
16 * and ebony.h, which were written by Matt Porter of MontaVista Software Inc.
17 */
18
19#ifdef __KERNEL__
20#ifndef __PPC_PLATFORMS_IBM440GP_H
21#define __PPC_PLATFORMS_IBM440GP_H
22
23#include <linux/config.h>
24
25/* UART */
26#define PPC440GP_UART0_ADDR 0x0000000140000200ULL
27#define PPC440GP_UART1_ADDR 0x0000000140000300ULL
28#define UART0_INT 0
29#define UART1_INT 1
30
31/* Clock and Power Management */
32#define IBM_CPM_IIC0 0x80000000 /* IIC interface */
33#define IBM_CPM_IIC1 0x40000000 /* IIC interface */
34#define IBM_CPM_PCI 0x20000000 /* PCI bridge */
35#define IBM_CPM_CPU 0x02000000 /* processor core */
36#define IBM_CPM_DMA 0x01000000 /* DMA controller */
37#define IBM_CPM_BGO 0x00800000 /* PLB to OPB bus arbiter */
38#define IBM_CPM_BGI 0x00400000 /* OPB to PLB bridge */
39#define IBM_CPM_EBC 0x00200000 /* External Bux Controller */
40#define IBM_CPM_EBM 0x00100000 /* Ext Bus Master Interface */
41#define IBM_CPM_DMC 0x00080000 /* SDRAM peripheral controller */
42#define IBM_CPM_PLB 0x00040000 /* PLB bus arbiter */
43#define IBM_CPM_SRAM 0x00020000 /* SRAM memory controller */
44#define IBM_CPM_PPM 0x00002000 /* PLB Performance Monitor */
45#define IBM_CPM_UIC1 0x00001000 /* Universal Interrupt Controller */
46#define IBM_CPM_GPIO0 0x00000800 /* General Purpose IO (??) */
47#define IBM_CPM_GPT 0x00000400 /* General Purpose Timers */
48#define IBM_CPM_UART0 0x00000200 /* serial port 0 */
49#define IBM_CPM_UART1 0x00000100 /* serial port 1 */
50#define IBM_CPM_UIC0 0x00000080 /* Universal Interrupt Controller */
51#define IBM_CPM_TMRCLK 0x00000040 /* CPU timers */
52
53#define DFLT_IBM4xx_PM ~(IBM_CPM_UIC | IBM_CPM_UIC1 | IBM_CPM_CPU \
54 | IBM_CPM_EBC | IBM_CPM_SRAM | IBM_CPM_BGO \
55 | IBM_CPM_EBM | IBM_CPM_PLB | IBM_CPM_OPB \
56 | IBM_CPM_TMRCLK | IBM_CPM_DMA | IBM_CPM_PCI)
57/*
58 * Serial port defines
59 */
60#define RS_TABLE_SIZE 2
61
62#include <asm/ibm44x.h>
63#include <syslib/ibm440gp_common.h>
64
65#endif /* __PPC_PLATFORMS_IBM440GP_H */
66#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/4xx/ibm440gx.c b/arch/ppc/platforms/4xx/ibm440gx.c
new file mode 100644
index 000000000000..1f38f42835b4
--- /dev/null
+++ b/arch/ppc/platforms/4xx/ibm440gx.c
@@ -0,0 +1,234 @@
1/*
2 * arch/ppc/platforms/4xx/ibm440gx.c
3 *
4 * PPC440GX I/O descriptions
5 *
6 * Matt Porter <mporter@mvista.com>
7 * Copyright 2002-2004 MontaVista Software Inc.
8 *
9 * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
10 * Copyright (c) 2003, 2004 Zultys Technologies
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 *
17 */
18#include <linux/init.h>
19#include <linux/module.h>
20#include <platforms/4xx/ibm440gx.h>
21#include <asm/ocp.h>
22#include <asm/ppc4xx_pic.h>
23
24static struct ocp_func_emac_data ibm440gx_emac0_def = {
25 .rgmii_idx = -1, /* No RGMII */
26 .rgmii_mux = -1, /* No RGMII */
27 .zmii_idx = 0, /* ZMII device index */
28 .zmii_mux = 0, /* ZMII input of this EMAC */
29 .mal_idx = 0, /* MAL device index */
30 .mal_rx_chan = 0, /* MAL rx channel number */
31 .mal_tx_chan = 0, /* MAL tx channel number */
32 .wol_irq = 61, /* WOL interrupt number */
33 .mdio_idx = -1, /* No shared MDIO */
34 .tah_idx = -1, /* No TAH */
35};
36
37static struct ocp_func_emac_data ibm440gx_emac1_def = {
38 .rgmii_idx = -1, /* No RGMII */
39 .rgmii_mux = -1, /* No RGMII */
40 .zmii_idx = 0, /* ZMII device index */
41 .zmii_mux = 1, /* ZMII input of this EMAC */
42 .mal_idx = 0, /* MAL device index */
43 .mal_rx_chan = 1, /* MAL rx channel number */
44 .mal_tx_chan = 1, /* MAL tx channel number */
45 .wol_irq = 63, /* WOL interrupt number */
46 .mdio_idx = -1, /* No shared MDIO */
47 .tah_idx = -1, /* No TAH */
48};
49
50static struct ocp_func_emac_data ibm440gx_emac2_def = {
51 .rgmii_idx = 0, /* RGMII device index */
52 .rgmii_mux = 0, /* RGMII input of this EMAC */
53 .zmii_idx = 0, /* ZMII device index */
54 .zmii_mux = 2, /* ZMII input of this EMAC */
55 .mal_idx = 0, /* MAL device index */
56 .mal_rx_chan = 2, /* MAL rx channel number */
57 .mal_tx_chan = 2, /* MAL tx channel number */
58 .wol_irq = 65, /* WOL interrupt number */
59 .mdio_idx = -1, /* No shared MDIO */
60 .tah_idx = 0, /* TAH device index */
61 .jumbo = 1, /* Jumbo frames supported */
62};
63
64static struct ocp_func_emac_data ibm440gx_emac3_def = {
65 .rgmii_idx = 0, /* RGMII device index */
66 .rgmii_mux = 1, /* RGMII input of this EMAC */
67 .zmii_idx = 0, /* ZMII device index */
68 .zmii_mux = 3, /* ZMII input of this EMAC */
69 .mal_idx = 0, /* MAL device index */
70 .mal_rx_chan = 3, /* MAL rx channel number */
71 .mal_tx_chan = 3, /* MAL tx channel number */
72 .wol_irq = 67, /* WOL interrupt number */
73 .mdio_idx = -1, /* No shared MDIO */
74 .tah_idx = 1, /* TAH device index */
75 .jumbo = 1, /* Jumbo frames supported */
76};
77OCP_SYSFS_EMAC_DATA()
78
79static struct ocp_func_mal_data ibm440gx_mal0_def = {
80 .num_tx_chans = 4, /* Number of TX channels */
81 .num_rx_chans = 4, /* Number of RX channels */
82 .txeob_irq = 10, /* TX End Of Buffer IRQ */
83 .rxeob_irq = 11, /* RX End Of Buffer IRQ */
84 .txde_irq = 33, /* TX Descriptor Error IRQ */
85 .rxde_irq = 34, /* RX Descriptor Error IRQ */
86 .serr_irq = 32, /* MAL System Error IRQ */
87};
88OCP_SYSFS_MAL_DATA()
89
90static struct ocp_func_iic_data ibm440gx_iic0_def = {
91 .fast_mode = 0, /* Use standad mode (100Khz) */
92};
93
94static struct ocp_func_iic_data ibm440gx_iic1_def = {
95 .fast_mode = 0, /* Use standad mode (100Khz) */
96};
97OCP_SYSFS_IIC_DATA()
98
99struct ocp_def core_ocp[] = {
100 { .vendor = OCP_VENDOR_IBM,
101 .function = OCP_FUNC_OPB,
102 .index = 0,
103 .paddr = 0x0000000140000000ULL,
104 .irq = OCP_IRQ_NA,
105 .pm = OCP_CPM_NA,
106 },
107 { .vendor = OCP_VENDOR_IBM,
108 .function = OCP_FUNC_16550,
109 .index = 0,
110 .paddr = PPC440GX_UART0_ADDR,
111 .irq = UART0_INT,
112 .pm = IBM_CPM_UART0,
113 },
114 { .vendor = OCP_VENDOR_IBM,
115 .function = OCP_FUNC_16550,
116 .index = 1,
117 .paddr = PPC440GX_UART1_ADDR,
118 .irq = UART1_INT,
119 .pm = IBM_CPM_UART1,
120 },
121 { .vendor = OCP_VENDOR_IBM,
122 .function = OCP_FUNC_IIC,
123 .index = 0,
124 .paddr = 0x0000000140000400ULL,
125 .irq = 2,
126 .pm = IBM_CPM_IIC0,
127 .additions = &ibm440gx_iic0_def,
128 .show = &ocp_show_iic_data
129 },
130 { .vendor = OCP_VENDOR_IBM,
131 .function = OCP_FUNC_IIC,
132 .index = 1,
133 .paddr = 0x0000000140000500ULL,
134 .irq = 3,
135 .pm = IBM_CPM_IIC1,
136 .additions = &ibm440gx_iic1_def,
137 .show = &ocp_show_iic_data
138 },
139 { .vendor = OCP_VENDOR_IBM,
140 .function = OCP_FUNC_GPIO,
141 .index = 0,
142 .paddr = 0x0000000140000700ULL,
143 .irq = OCP_IRQ_NA,
144 .pm = IBM_CPM_GPIO0,
145 },
146 { .vendor = OCP_VENDOR_IBM,
147 .function = OCP_FUNC_MAL,
148 .paddr = OCP_PADDR_NA,
149 .irq = OCP_IRQ_NA,
150 .pm = OCP_CPM_NA,
151 .additions = &ibm440gx_mal0_def,
152 .show = &ocp_show_mal_data,
153 },
154 { .vendor = OCP_VENDOR_IBM,
155 .function = OCP_FUNC_EMAC,
156 .index = 0,
157 .paddr = 0x0000000140000800ULL,
158 .irq = 60,
159 .pm = OCP_CPM_NA,
160 .additions = &ibm440gx_emac0_def,
161 .show = &ocp_show_emac_data,
162 },
163 { .vendor = OCP_VENDOR_IBM,
164 .function = OCP_FUNC_EMAC,
165 .index = 1,
166 .paddr = 0x0000000140000900ULL,
167 .irq = 62,
168 .pm = OCP_CPM_NA,
169 .additions = &ibm440gx_emac1_def,
170 .show = &ocp_show_emac_data,
171 },
172 { .vendor = OCP_VENDOR_IBM,
173 .function = OCP_FUNC_EMAC,
174 .index = 2,
175 .paddr = 0x0000000140000C00ULL,
176 .irq = 64,
177 .pm = OCP_CPM_NA,
178 .additions = &ibm440gx_emac2_def,
179 .show = &ocp_show_emac_data,
180 },
181 { .vendor = OCP_VENDOR_IBM,
182 .function = OCP_FUNC_EMAC,
183 .index = 3,
184 .paddr = 0x0000000140000E00ULL,
185 .irq = 66,
186 .pm = OCP_CPM_NA,
187 .additions = &ibm440gx_emac3_def,
188 .show = &ocp_show_emac_data,
189 },
190 { .vendor = OCP_VENDOR_IBM,
191 .function = OCP_FUNC_RGMII,
192 .paddr = 0x0000000140000790ULL,
193 .irq = OCP_IRQ_NA,
194 .pm = OCP_CPM_NA,
195 },
196 { .vendor = OCP_VENDOR_IBM,
197 .function = OCP_FUNC_ZMII,
198 .paddr = 0x0000000140000780ULL,
199 .irq = OCP_IRQ_NA,
200 .pm = OCP_CPM_NA,
201 },
202 { .vendor = OCP_VENDOR_IBM,
203 .function = OCP_FUNC_TAH,
204 .index = 0,
205 .paddr = 0x0000000140000b50ULL,
206 .irq = 68,
207 .pm = OCP_CPM_NA,
208 },
209 { .vendor = OCP_VENDOR_IBM,
210 .function = OCP_FUNC_TAH,
211 .index = 1,
212 .paddr = 0x0000000140000d50ULL,
213 .irq = 69,
214 .pm = OCP_CPM_NA,
215 },
216 { .vendor = OCP_VENDOR_INVALID
217 }
218};
219
220/* Polarity and triggering settings for internal interrupt sources */
221struct ppc4xx_uic_settings ppc4xx_core_uic_cfg[] __initdata = {
222 { .polarity = 0xfffffe03,
223 .triggering = 0x01c00000,
224 .ext_irq_mask = 0x000001fc, /* IRQ0 - IRQ6 */
225 },
226 { .polarity = 0xffffc0ff,
227 .triggering = 0x00ff8000,
228 .ext_irq_mask = 0x00003f00, /* IRQ7 - IRQ12 */
229 },
230 { .polarity = 0xffff83ff,
231 .triggering = 0x000f83c0,
232 .ext_irq_mask = 0x00007c00, /* IRQ13 - IRQ17 */
233 },
234};
diff --git a/arch/ppc/platforms/4xx/ibm440gx.h b/arch/ppc/platforms/4xx/ibm440gx.h
new file mode 100644
index 000000000000..0b59d8dcd03c
--- /dev/null
+++ b/arch/ppc/platforms/4xx/ibm440gx.h
@@ -0,0 +1,74 @@
1/*
2 * arch/ppc/platforms/ibm440gx.h
3 *
4 * PPC440GX definitions
5 *
6 * Matt Porter <mporter@mvista.com>
7 *
8 * Copyright 2002 Roland Dreier
9 * Copyright 2003 MontaVista Software, Inc.
10 *
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
15 *
16 */
17
18#ifdef __KERNEL__
19#ifndef __PPC_PLATFORMS_IBM440GX_H
20#define __PPC_PLATFORMS_IBM440GX_H
21
22#include <linux/config.h>
23
24#include <asm/ibm44x.h>
25
26/* UART */
27#define PPC440GX_UART0_ADDR 0x0000000140000200ULL
28#define PPC440GX_UART1_ADDR 0x0000000140000300ULL
29#define UART0_INT 0
30#define UART1_INT 1
31
32/* Clock and Power Management */
33#define IBM_CPM_IIC0 0x80000000 /* IIC interface */
34#define IBM_CPM_IIC1 0x40000000 /* IIC interface */
35#define IBM_CPM_PCI 0x20000000 /* PCI bridge */
36#define IBM_CPM_RGMII 0x10000000 /* RGMII */
37#define IBM_CPM_TAHOE0 0x08000000 /* TAHOE 0 */
38#define IBM_CPM_TAHOE1 0x04000000 /* TAHOE 1 */
39#define IBM_CPM_CPU 0x02000000 /* processor core */
40#define IBM_CPM_DMA 0x01000000 /* DMA controller */
41#define IBM_CPM_BGO 0x00800000 /* PLB to OPB bus arbiter */
42#define IBM_CPM_BGI 0x00400000 /* OPB to PLB bridge */
43#define IBM_CPM_EBC 0x00200000 /* External Bux Controller */
44#define IBM_CPM_EBM 0x00100000 /* Ext Bus Master Interface */
45#define IBM_CPM_DMC 0x00080000 /* SDRAM peripheral controller */
46#define IBM_CPM_PLB 0x00040000 /* PLB bus arbiter */
47#define IBM_CPM_SRAM 0x00020000 /* SRAM memory controller */
48#define IBM_CPM_PPM 0x00002000 /* PLB Performance Monitor */
49#define IBM_CPM_UIC1 0x00001000 /* Universal Interrupt Controller */
50#define IBM_CPM_GPIO0 0x00000800 /* General Purpose IO (??) */
51#define IBM_CPM_GPT 0x00000400 /* General Purpose Timers */
52#define IBM_CPM_UART0 0x00000200 /* serial port 0 */
53#define IBM_CPM_UART1 0x00000100 /* serial port 1 */
54#define IBM_CPM_UIC0 0x00000080 /* Universal Interrupt Controller */
55#define IBM_CPM_TMRCLK 0x00000040 /* CPU timers */
56#define IBM_CPM_EMAC0 0x00000020 /* EMAC 0 */
57#define IBM_CPM_EMAC1 0x00000010 /* EMAC 1 */
58#define IBM_CPM_EMAC2 0x00000008 /* EMAC 2 */
59#define IBM_CPM_EMAC3 0x00000004 /* EMAC 3 */
60
61#define DFLT_IBM4xx_PM ~(IBM_CPM_UIC | IBM_CPM_UIC1 | IBM_CPM_CPU \
62 | IBM_CPM_EBC | IBM_CPM_SRAM | IBM_CPM_BGO \
63 | IBM_CPM_EBM | IBM_CPM_PLB | IBM_CPM_OPB \
64 | IBM_CPM_TMRCLK | IBM_CPM_DMA | IBM_CPM_PCI \
65 | IBM_CPM_TAHOE0 | IBM_CPM_TAHOE1 \
66 | IBM_CPM_EMAC0 | IBM_CPM_EMAC1 \
67 | IBM_CPM_EMAC2 | IBM_CPM_EMAC3 )
68/*
69 * Serial port defines
70 */
71#define RS_TABLE_SIZE 2
72
73#endif /* __PPC_PLATFORMS_IBM440GX_H */
74#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/4xx/ibm440sp.c b/arch/ppc/platforms/4xx/ibm440sp.c
new file mode 100644
index 000000000000..a203efb47aba
--- /dev/null
+++ b/arch/ppc/platforms/4xx/ibm440sp.c
@@ -0,0 +1,131 @@
1/*
2 * arch/ppc/platforms/4xx/ibm440sp.c
3 *
4 * PPC440SP I/O descriptions
5 *
6 * Matt Porter <mporter@kernel.crashing.org>
7 * Copyright 2002-2005 MontaVista Software Inc.
8 *
9 * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
10 * Copyright (c) 2003, 2004 Zultys Technologies
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 *
17 */
18#include <linux/init.h>
19#include <linux/module.h>
20#include <platforms/4xx/ibm440sp.h>
21#include <asm/ocp.h>
22
23static struct ocp_func_emac_data ibm440sp_emac0_def = {
24 .rgmii_idx = -1, /* No RGMII */
25 .rgmii_mux = -1, /* No RGMII */
26 .zmii_idx = -1, /* No ZMII */
27 .zmii_mux = -1, /* No ZMII */
28 .mal_idx = 0, /* MAL device index */
29 .mal_rx_chan = 0, /* MAL rx channel number */
30 .mal_tx_chan = 0, /* MAL tx channel number */
31 .wol_irq = 61, /* WOL interrupt number */
32 .mdio_idx = -1, /* No shared MDIO */
33 .tah_idx = -1, /* No TAH */
34 .jumbo = 1, /* Jumbo frames supported */
35};
36OCP_SYSFS_EMAC_DATA()
37
38static struct ocp_func_mal_data ibm440sp_mal0_def = {
39 .num_tx_chans = 4, /* Number of TX channels */
40 .num_rx_chans = 4, /* Number of RX channels */
41 .txeob_irq = 38, /* TX End Of Buffer IRQ */
42 .rxeob_irq = 39, /* RX End Of Buffer IRQ */
43 .txde_irq = 34, /* TX Descriptor Error IRQ */
44 .rxde_irq = 35, /* RX Descriptor Error IRQ */
45 .serr_irq = 33, /* MAL System Error IRQ */
46};
47OCP_SYSFS_MAL_DATA()
48
49static struct ocp_func_iic_data ibm440sp_iic0_def = {
50 .fast_mode = 0, /* Use standad mode (100Khz) */
51};
52
53static struct ocp_func_iic_data ibm440sp_iic1_def = {
54 .fast_mode = 0, /* Use standad mode (100Khz) */
55};
56OCP_SYSFS_IIC_DATA()
57
58struct ocp_def core_ocp[] = {
59 { .vendor = OCP_VENDOR_IBM,
60 .function = OCP_FUNC_OPB,
61 .index = 0,
62 .paddr = 0x0000000140000000ULL,
63 .irq = OCP_IRQ_NA,
64 .pm = OCP_CPM_NA,
65 },
66 { .vendor = OCP_VENDOR_IBM,
67 .function = OCP_FUNC_16550,
68 .index = 0,
69 .paddr = PPC440SP_UART0_ADDR,
70 .irq = UART0_INT,
71 .pm = IBM_CPM_UART0,
72 },
73 { .vendor = OCP_VENDOR_IBM,
74 .function = OCP_FUNC_16550,
75 .index = 1,
76 .paddr = PPC440SP_UART1_ADDR,
77 .irq = UART1_INT,
78 .pm = IBM_CPM_UART1,
79 },
80 { .vendor = OCP_VENDOR_IBM,
81 .function = OCP_FUNC_16550,
82 .index = 2,
83 .paddr = PPC440SP_UART2_ADDR,
84 .irq = UART2_INT,
85 .pm = IBM_CPM_UART2,
86 },
87 { .vendor = OCP_VENDOR_IBM,
88 .function = OCP_FUNC_IIC,
89 .index = 0,
90 .paddr = 0x00000001f0000400ULL,
91 .irq = 2,
92 .pm = IBM_CPM_IIC0,
93 .additions = &ibm440sp_iic0_def,
94 .show = &ocp_show_iic_data
95 },
96 { .vendor = OCP_VENDOR_IBM,
97 .function = OCP_FUNC_IIC,
98 .index = 1,
99 .paddr = 0x00000001f0000500ULL,
100 .irq = 3,
101 .pm = IBM_CPM_IIC1,
102 .additions = &ibm440sp_iic1_def,
103 .show = &ocp_show_iic_data
104 },
105 { .vendor = OCP_VENDOR_IBM,
106 .function = OCP_FUNC_GPIO,
107 .index = 0,
108 .paddr = 0x00000001f0000700ULL,
109 .irq = OCP_IRQ_NA,
110 .pm = IBM_CPM_GPIO0,
111 },
112 { .vendor = OCP_VENDOR_IBM,
113 .function = OCP_FUNC_MAL,
114 .paddr = OCP_PADDR_NA,
115 .irq = OCP_IRQ_NA,
116 .pm = OCP_CPM_NA,
117 .additions = &ibm440sp_mal0_def,
118 .show = &ocp_show_mal_data,
119 },
120 { .vendor = OCP_VENDOR_IBM,
121 .function = OCP_FUNC_EMAC,
122 .index = 0,
123 .paddr = 0x00000001f0000800ULL,
124 .irq = 60,
125 .pm = OCP_CPM_NA,
126 .additions = &ibm440sp_emac0_def,
127 .show = &ocp_show_emac_data,
128 },
129 { .vendor = OCP_VENDOR_INVALID
130 }
131};
diff --git a/arch/ppc/platforms/4xx/ibm440sp.h b/arch/ppc/platforms/4xx/ibm440sp.h
new file mode 100644
index 000000000000..c71e46a18b9e
--- /dev/null
+++ b/arch/ppc/platforms/4xx/ibm440sp.h
@@ -0,0 +1,64 @@
1/*
2 * arch/ppc/platforms/4xx/ibm440sp.h
3 *
4 * PPC440SP definitions
5 *
6 * Matt Porter <mporter@kernel.crashing.org>
7 *
8 * Copyright 2004-2005 MontaVista Software, Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15
16#ifdef __KERNEL__
17#ifndef __PPC_PLATFORMS_IBM440SP_H
18#define __PPC_PLATFORMS_IBM440SP_H
19
20#include <linux/config.h>
21
22#include <asm/ibm44x.h>
23
24/* UART */
25#define PPC440SP_UART0_ADDR 0x00000001f0000200ULL
26#define PPC440SP_UART1_ADDR 0x00000001f0000300ULL
27#define PPC440SP_UART2_ADDR 0x00000001f0000600ULL
28#define UART0_INT 0
29#define UART1_INT 1
30#define UART2_INT 2
31
32/* Clock and Power Management */
33#define IBM_CPM_IIC0 0x80000000 /* IIC interface */
34#define IBM_CPM_IIC1 0x40000000 /* IIC interface */
35#define IBM_CPM_PCI 0x20000000 /* PCI bridge */
36#define IBM_CPM_CPU 0x02000000 /* processor core */
37#define IBM_CPM_DMA 0x01000000 /* DMA controller */
38#define IBM_CPM_BGO 0x00800000 /* PLB to OPB bus arbiter */
39#define IBM_CPM_BGI 0x00400000 /* OPB to PLB bridge */
40#define IBM_CPM_EBC 0x00200000 /* External Bux Controller */
41#define IBM_CPM_EBM 0x00100000 /* Ext Bus Master Interface */
42#define IBM_CPM_DMC 0x00080000 /* SDRAM peripheral controller */
43#define IBM_CPM_PLB 0x00040000 /* PLB bus arbiter */
44#define IBM_CPM_SRAM 0x00020000 /* SRAM memory controller */
45#define IBM_CPM_PPM 0x00002000 /* PLB Performance Monitor */
46#define IBM_CPM_UIC1 0x00001000 /* Universal Interrupt Controller */
47#define IBM_CPM_GPIO0 0x00000800 /* General Purpose IO (??) */
48#define IBM_CPM_GPT 0x00000400 /* General Purpose Timers */
49#define IBM_CPM_UART0 0x00000200 /* serial port 0 */
50#define IBM_CPM_UART1 0x00000100 /* serial port 1 */
51#define IBM_CPM_UART2 0x00000100 /* serial port 1 */
52#define IBM_CPM_UIC0 0x00000080 /* Universal Interrupt Controller */
53#define IBM_CPM_TMRCLK 0x00000040 /* CPU timers */
54#define IBM_CPM_EMAC0 0x00000020 /* EMAC 0 */
55
56#define DFLT_IBM4xx_PM ~(IBM_CPM_UIC | IBM_CPM_UIC1 | IBM_CPM_CPU \
57 | IBM_CPM_EBC | IBM_CPM_SRAM | IBM_CPM_BGO \
58 | IBM_CPM_EBM | IBM_CPM_PLB | IBM_CPM_OPB \
59 | IBM_CPM_TMRCLK | IBM_CPM_DMA | IBM_CPM_PCI \
60 | IBM_CPM_TAHOE0 | IBM_CPM_TAHOE1 \
61 | IBM_CPM_EMAC0 | IBM_CPM_EMAC1 \
62 | IBM_CPM_EMAC2 | IBM_CPM_EMAC3 )
63#endif /* __PPC_PLATFORMS_IBM440SP_H */
64#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/4xx/ibmnp405h.c b/arch/ppc/platforms/4xx/ibmnp405h.c
new file mode 100644
index 000000000000..ecdc5be6ae28
--- /dev/null
+++ b/arch/ppc/platforms/4xx/ibmnp405h.c
@@ -0,0 +1,172 @@
1/*
2 * arch/ppc/platforms/4xx/ibmnp405h.c
3 *
4 * Author: Armin Kuster <akuster@mvista.com>
5 *
6 * 2000-2002 (c) MontaVista, Software, Inc. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10 */
11
12#include <linux/config.h>
13#include <linux/init.h>
14#include <asm/ocp.h>
15#include <platforms/4xx/ibmnp405h.h>
16
17static struct ocp_func_emac_data ibmnp405h_emac0_def = {
18 .rgmii_idx = -1, /* No RGMII */
19 .rgmii_mux = -1, /* No RGMII */
20 .zmii_idx = 0, /* ZMII device index */
21 .zmii_mux = 0, /* ZMII input of this EMAC */
22 .mal_idx = 0, /* MAL device index */
23 .mal_rx_chan = 0, /* MAL rx channel number */
24 .mal_tx_chan = 0, /* MAL tx channel number */
25 .wol_irq = 41, /* WOL interrupt number */
26 .mdio_idx = -1, /* No shared MDIO */
27 .tah_idx = -1, /* No TAH */
28};
29
30static struct ocp_func_emac_data ibmnp405h_emac1_def = {
31 .rgmii_idx = -1, /* No RGMII */
32 .rgmii_mux = -1, /* No RGMII */
33 .zmii_idx = 0, /* ZMII device index */
34 .zmii_mux = 1, /* ZMII input of this EMAC */
35 .mal_idx = 0, /* MAL device index */
36 .mal_rx_chan = 1, /* MAL rx channel number */
37 .mal_tx_chan = 1, /* MAL tx channel number */
38 .wol_irq = 41, /* WOL interrupt number */
39 .mdio_idx = -1, /* No shared MDIO */
40 .tah_idx = -1, /* No TAH */
41};
42static struct ocp_func_emac_data ibmnp405h_emac2_def = {
43 .rgmii_idx = -1, /* No RGMII */
44 .rgmii_mux = -1, /* No RGMII */
45 .zmii_idx = 0, /* ZMII device index */
46 .zmii_mux = 2, /* ZMII input of this EMAC */
47 .mal_idx = 0, /* MAL device index */
48 .mal_rx_chan = 2, /* MAL rx channel number */
49 .mal_tx_chan = 2, /* MAL tx channel number */
50 .wol_irq = 41, /* WOL interrupt number */
51 .mdio_idx = -1, /* No shared MDIO */
52 .tah_idx = -1, /* No TAH */
53};
54static struct ocp_func_emac_data ibmnp405h_emac3_def = {
55 .rgmii_idx = -1, /* No RGMII */
56 .rgmii_mux = -1, /* No RGMII */
57 .zmii_idx = 0, /* ZMII device index */
58 .zmii_mux = 3, /* ZMII input of this EMAC */
59 .mal_idx = 0, /* MAL device index */
60 .mal_rx_chan = 3, /* MAL rx channel number */
61 .mal_tx_chan = 3, /* MAL tx channel number */
62 .wol_irq = 41, /* WOL interrupt number */
63 .mdio_idx = -1, /* No shared MDIO */
64 .tah_idx = -1, /* No TAH */
65};
66OCP_SYSFS_EMAC_DATA()
67
68static struct ocp_func_mal_data ibmnp405h_mal0_def = {
69 .num_tx_chans = 8, /* Number of TX channels */
70 .num_rx_chans = 4, /* Number of RX channels */
71 .txeob_irq = 17, /* TX End Of Buffer IRQ */
72 .rxeob_irq = 18, /* RX End Of Buffer IRQ */
73 .txde_irq = 46, /* TX Descriptor Error IRQ */
74 .rxde_irq = 47, /* RX Descriptor Error IRQ */
75 .serr_irq = 45, /* MAL System Error IRQ */
76};
77OCP_SYSFS_MAL_DATA()
78
79static struct ocp_func_iic_data ibmnp405h_iic0_def = {
80 .fast_mode = 0, /* Use standad mode (100Khz) */
81};
82OCP_SYSFS_IIC_DATA()
83
84struct ocp_def core_ocp[] = {
85 { .vendor = OCP_VENDOR_IBM,
86 .function = OCP_FUNC_OPB,
87 .index = 0,
88 .paddr = 0xEF600000,
89 .irq = OCP_IRQ_NA,
90 .pm = OCP_CPM_NA,
91 },
92 { .vendor = OCP_VENDOR_IBM,
93 .function = OCP_FUNC_16550,
94 .index = 0,
95 .paddr = UART0_IO_BASE,
96 .irq = UART0_INT,
97 .pm = IBM_CPM_UART0
98 },
99 { .vendor = OCP_VENDOR_IBM,
100 .function = OCP_FUNC_16550,
101 .index = 1,
102 .paddr = UART1_IO_BASE,
103 .irq = UART1_INT,
104 .pm = IBM_CPM_UART1
105 },
106 { .vendor = OCP_VENDOR_IBM,
107 .function = OCP_FUNC_IIC,
108 .paddr = 0xEF600500,
109 .irq = 2,
110 .pm = IBM_CPM_IIC0,
111 .additions = &ibmnp405h_iic0_def,
112 .show = &ocp_show_iic_data
113 },
114 { .vendor = OCP_VENDOR_IBM,
115 .function = OCP_FUNC_GPIO,
116 .paddr = 0xEF600700,
117 .irq = OCP_IRQ_NA,
118 .pm = IBM_CPM_GPIO0
119 },
120 { .vendor = OCP_VENDOR_IBM,
121 .function = OCP_FUNC_MAL,
122 .paddr = OCP_PADDR_NA,
123 .irq = OCP_IRQ_NA,
124 .pm = OCP_CPM_NA,
125 .additions = &ibmnp405h_mal0_def,
126 .show = &ocp_show_mal_data,
127 },
128 { .vendor = OCP_VENDOR_IBM,
129 .function = OCP_FUNC_EMAC,
130 .index = 0,
131 .paddr = EMAC0_BASE,
132 .irq = 37,
133 .pm = IBM_CPM_EMAC0,
134 .additions = &ibmnp405h_emac0_def,
135 .show = &ocp_show_emac_data,
136 },
137 { .vendor = OCP_VENDOR_IBM,
138 .function = OCP_FUNC_EMAC,
139 .index = 1,
140 .paddr = 0xEF600900,
141 .irq = 38,
142 .pm = IBM_CPM_EMAC1,
143 .additions = &ibmnp405h_emac1_def,
144 .show = &ocp_show_emac_data,
145 },
146 { .vendor = OCP_VENDOR_IBM,
147 .function = OCP_FUNC_EMAC,
148 .index = 2,
149 .paddr = 0xEF600a00,
150 .irq = 39,
151 .pm = IBM_CPM_EMAC2,
152 .additions = &ibmnp405h_emac2_def,
153 .show = &ocp_show_emac_data,
154 },
155 { .vendor = OCP_VENDOR_IBM,
156 .function = OCP_FUNC_EMAC,
157 .index = 3,
158 .paddr = 0xEF600b00,
159 .irq = 40,
160 .pm = IBM_CPM_EMAC3,
161 .additions = &ibmnp405h_emac3_def,
162 .show = &ocp_show_emac_data,
163 },
164 { .vendor = OCP_VENDOR_IBM,
165 .function = OCP_FUNC_ZMII,
166 .paddr = 0xEF600C10,
167 .irq = OCP_IRQ_NA,
168 .pm = OCP_CPM_NA,
169 },
170 { .vendor = OCP_VENDOR_INVALID
171 }
172};
diff --git a/arch/ppc/platforms/4xx/ibmnp405h.h b/arch/ppc/platforms/4xx/ibmnp405h.h
new file mode 100644
index 000000000000..e2c2b06128c8
--- /dev/null
+++ b/arch/ppc/platforms/4xx/ibmnp405h.h
@@ -0,0 +1,157 @@
1/*
2 * arch/ppc/platforms/4xx/ibmnp405h.h
3 *
4 * Author: Armin Kuster <akuster@mvista.com>
5 *
6 * 2002 (c) MontaVista, Software, Inc. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10 */
11
12#ifdef __KERNEL__
13#ifndef __ASM_IBMNP405H_H__
14#define __ASM_IBMNP405H_H__
15
16#include <linux/config.h>
17
18/* ibm405.h at bottom of this file */
19
20#define PPC405_PCI_CONFIG_ADDR 0xeec00000
21#define PPC405_PCI_CONFIG_DATA 0xeec00004
22#define PPC405_PCI_PHY_MEM_BASE 0x80000000 /* hose_a->pci_mem_offset */
23 /* setbat */
24#define PPC405_PCI_MEM_BASE PPC405_PCI_PHY_MEM_BASE /* setbat */
25#define PPC405_PCI_PHY_IO_BASE 0xe8000000 /* setbat */
26#define PPC405_PCI_IO_BASE PPC405_PCI_PHY_IO_BASE /* setbat */
27
28#define PPC405_PCI_LOWER_MEM 0x00000000 /* hose_a->mem_space.start */
29#define PPC405_PCI_UPPER_MEM 0xBfffffff /* hose_a->mem_space.end */
30#define PPC405_PCI_LOWER_IO 0x00000000 /* hose_a->io_space.start */
31#define PPC405_PCI_UPPER_IO 0x0000ffff /* hose_a->io_space.end */
32
33#define PPC405_ISA_IO_BASE PPC405_PCI_IO_BASE
34
35#define PPC4xx_PCI_IO_ADDR ((uint)PPC405_PCI_PHY_IO_BASE)
36#define PPC4xx_PCI_IO_SIZE ((uint)64*1024)
37#define PPC4xx_PCI_CFG_ADDR ((uint)PPC405_PCI_CONFIG_ADDR)
38#define PPC4xx_PCI_CFG_SIZE ((uint)4*1024)
39#define PPC4xx_PCI_LCFG_ADDR ((uint)0xef400000)
40#define PPC4xx_PCI_LCFG_SIZE ((uint)4*1024)
41#define PPC4xx_ONB_IO_ADDR ((uint)0xef600000)
42#define PPC4xx_ONB_IO_SIZE ((uint)4*1024)
43
44/* serial port defines */
45#define RS_TABLE_SIZE 4
46
47#define UART0_INT 0
48#define UART1_INT 1
49#define PCIL0_BASE 0xEF400000
50#define UART0_IO_BASE 0xEF600300
51#define UART1_IO_BASE 0xEF600400
52#define OPB0_BASE 0xEF600600
53#define EMAC0_BASE 0xEF600800
54
55#define BD_EMAC_ADDR(e,i) bi_enetaddr[e][i]
56
57#define STD_UART_OP(num) \
58 { 0, BASE_BAUD, 0, UART##num##_INT, \
59 (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST), \
60 iomem_base:(u8 *) UART##num##_IO_BASE, \
61 io_type: SERIAL_IO_MEM},
62
63#if defined(CONFIG_UART0_TTYS0)
64#define SERIAL_DEBUG_IO_BASE UART0_IO_BASE
65#define SERIAL_PORT_DFNS \
66 STD_UART_OP(0) \
67 STD_UART_OP(1)
68#endif
69
70#if defined(CONFIG_UART0_TTYS1)
71#define SERIAL_DEBUG_IO_BASE UART0_IO_BASE
72#define SERIAL_PORT_DFNS \
73 STD_UART_OP(1) \
74 STD_UART_OP(0)
75#endif
76
77/* DCR defines */
78/* ------------------------------------------------------------------------- */
79
80#define DCRN_CHCR_BASE 0x0F1
81#define DCRN_CHPSR_BASE 0x0B4
82#define DCRN_CPMSR_BASE 0x0BA
83#define DCRN_CPMFR_BASE 0x0B9
84#define DCRN_CPMER_BASE 0x0B8
85
86/* CPM Clocking & Power Mangement defines */
87#define IBM_CPM_PCI 0x40000000 /* PCI */
88#define IBM_CPM_EMAC2 0x20000000 /* EMAC 2 MII */
89#define IBM_CPM_EMAC3 0x04000000 /* EMAC 3 MII */
90#define IBM_CPM_EMAC0 0x00800000 /* EMAC 0 MII */
91#define IBM_CPM_EMAC1 0x00100000 /* EMAC 1 MII */
92#define IBM_CPM_EMMII 0 /* Shift value for MII */
93#define IBM_CPM_EMRX 1 /* Shift value for recv */
94#define IBM_CPM_EMTX 2 /* Shift value for MAC */
95#define IBM_CPM_UIC1 0x00020000 /* Universal Interrupt Controller */
96#define IBM_CPM_UIC0 0x00010000 /* Universal Interrupt Controller */
97#define IBM_CPM_CPU 0x00008000 /* processor core */
98#define IBM_CPM_EBC 0x00004000 /* ROM/SRAM peripheral controller */
99#define IBM_CPM_SDRAM0 0x00002000 /* SDRAM memory controller */
100#define IBM_CPM_GPIO0 0x00001000 /* General Purpose IO (??) */
101#define IBM_CPM_HDLC 0x00000800 /* HDCL */
102#define IBM_CPM_TMRCLK 0x00000400 /* CPU timers */
103#define IBM_CPM_PLB 0x00000100 /* PLB bus arbiter */
104#define IBM_CPM_OPB 0x00000080 /* PLB to OPB bridge */
105#define IBM_CPM_DMA 0x00000040 /* DMA controller */
106#define IBM_CPM_IIC0 0x00000010 /* IIC interface */
107#define IBM_CPM_UART0 0x00000002 /* serial port 0 */
108#define IBM_CPM_UART1 0x00000001 /* serial port 1 */
109/* this is the default setting for devices put to sleep when booting */
110
111#define DFLT_IBM4xx_PM ~(IBM_CPM_UIC0 | IBM_CPM_UIC1 | IBM_CPM_CPU \
112 | IBM_CPM_EBC | IBM_CPM_SDRAM0 | IBM_CPM_PLB \
113 | IBM_CPM_OPB | IBM_CPM_TMRCLK | IBM_CPM_DMA \
114 | IBM_CPM_EMAC0 | IBM_CPM_EMAC1 | IBM_CPM_EMAC2 \
115 | IBM_CPM_EMAC3 | IBM_CPM_PCI)
116
117#define DCRN_DMA0_BASE 0x100
118#define DCRN_DMA1_BASE 0x108
119#define DCRN_DMA2_BASE 0x110
120#define DCRN_DMA3_BASE 0x118
121#define DCRNCAP_DMA_SG 1 /* have DMA scatter/gather capability */
122#define DCRN_DMASR_BASE 0x120
123#define DCRN_EBC_BASE 0x012
124#define DCRN_DCP0_BASE 0x014
125#define DCRN_MAL_BASE 0x180
126#define DCRN_OCM0_BASE 0x018
127#define DCRN_PLB0_BASE 0x084
128#define DCRN_PLLMR_BASE 0x0B0
129#define DCRN_POB0_BASE 0x0A0
130#define DCRN_SDRAM0_BASE 0x010
131#define DCRN_UIC0_BASE 0x0C0
132#define DCRN_UIC1_BASE 0x0D0
133#define DCRN_CPC0_EPRCSR 0x0F3
134
135#define UIC0_UIC1NC 0x00000002
136
137#define CHR1_CETE 0x00000004 /* CPU external timer enable */
138#define UIC0 DCRN_UIC0_BASE
139#define UIC1 DCRN_UIC1_BASE
140
141#undef NR_UICS
142#define NR_UICS 2
143
144/* EMAC DCRN's FIXME: armin */
145#define DCRN_MALRXCTP2R(base) ((base) + 0x42) /* Channel Rx 2 Channel Table Pointer */
146#define DCRN_MALRXCTP3R(base) ((base) + 0x43) /* Channel Rx 3 Channel Table Pointer */
147#define DCRN_MALTXCTP4R(base) ((base) + 0x24) /* Channel Tx 4 Channel Table Pointer */
148#define DCRN_MALTXCTP5R(base) ((base) + 0x25) /* Channel Tx 5 Channel Table Pointer */
149#define DCRN_MALTXCTP6R(base) ((base) + 0x26) /* Channel Tx 6 Channel Table Pointer */
150#define DCRN_MALTXCTP7R(base) ((base) + 0x27) /* Channel Tx 7 Channel Table Pointer */
151#define DCRN_MALRCBS2(base) ((base) + 0x62) /* Channel Rx 2 Channel Buffer Size */
152#define DCRN_MALRCBS3(base) ((base) + 0x63) /* Channel Rx 3 Channel Buffer Size */
153
154#include <asm/ibm405.h>
155
156#endif /* __ASM_IBMNP405H_H__ */
157#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/4xx/ibmstb4.c b/arch/ppc/platforms/4xx/ibmstb4.c
new file mode 100644
index 000000000000..874d16bab73c
--- /dev/null
+++ b/arch/ppc/platforms/4xx/ibmstb4.c
@@ -0,0 +1,83 @@
1/*
2 * arch/ppc/platforms/4xx/ibmstb4.c
3 *
4 * Author: Armin Kuster <akuster@mvista.com>
5 *
6 * 2000-2001 (c) MontaVista, Software, Inc. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10 */
11
12#include <linux/init.h>
13#include <asm/ocp.h>
14#include <platforms/4xx/ibmstb4.h>
15
16static struct ocp_func_iic_data ibmstb4_iic0_def = {
17 .fast_mode = 0, /* Use standad mode (100Khz) */
18};
19
20static struct ocp_func_iic_data ibmstb4_iic1_def = {
21 .fast_mode = 0, /* Use standad mode (100Khz) */
22};
23OCP_SYSFS_IIC_DATA()
24
25struct ocp_def core_ocp[] __initdata = {
26 { .vendor = OCP_VENDOR_IBM,
27 .function = OCP_FUNC_16550,
28 .index = 0,
29 .paddr = UART0_IO_BASE,
30 .irq = UART0_INT,
31 .pm = IBM_CPM_UART0,
32 },
33 { .vendor = OCP_VENDOR_IBM,
34 .function = OCP_FUNC_16550,
35 .index = 1,
36 .paddr = UART1_IO_BASE,
37 .irq = UART1_INT,
38 .pm = IBM_CPM_UART1,
39 },
40 { .vendor = OCP_VENDOR_IBM,
41 .function = OCP_FUNC_16550,
42 .index = 2,
43 .paddr = UART2_IO_BASE,
44 .irq = UART2_INT,
45 .pm = IBM_CPM_UART2,
46 },
47 { .vendor = OCP_VENDOR_IBM,
48 .function = OCP_FUNC_IIC,
49 .paddr = IIC0_BASE,
50 .irq = IIC0_IRQ,
51 .pm = IBM_CPM_IIC0,
52 .additions = &ibmstb4_iic0_def,
53 .show = &ocp_show_iic_data
54 },
55 { .vendor = OCP_VENDOR_IBM,
56 .function = OCP_FUNC_IIC,
57 .paddr = IIC1_BASE,
58 .irq = IIC1_IRQ,
59 .pm = IBM_CPM_IIC1,
60 .additions = &ibmstb4_iic1_def,
61 .show = &ocp_show_iic_data
62 },
63 { .vendor = OCP_VENDOR_IBM,
64 .function = OCP_FUNC_GPIO,
65 .paddr = GPIO0_BASE,
66 .irq = OCP_IRQ_NA,
67 .pm = IBM_CPM_GPIO0,
68 },
69 { .vendor = OCP_VENDOR_IBM,
70 .function = OCP_FUNC_IDE,
71 .paddr = IDE0_BASE,
72 .irq = IDE0_IRQ,
73 .pm = OCP_CPM_NA,
74 },
75 { .vendor = OCP_VENDOR_IBM,
76 .function = OCP_FUNC_USB,
77 .paddr = USB0_BASE,
78 .irq = USB0_IRQ,
79 .pm = OCP_CPM_NA,
80 },
81 { .vendor = OCP_VENDOR_INVALID,
82 }
83};
diff --git a/arch/ppc/platforms/4xx/ibmstb4.h b/arch/ppc/platforms/4xx/ibmstb4.h
new file mode 100644
index 000000000000..bcb4b1ee71f2
--- /dev/null
+++ b/arch/ppc/platforms/4xx/ibmstb4.h
@@ -0,0 +1,238 @@
1/*
2 * arch/ppc/platforms/4xx/ibmstb4.h
3 *
4 * Author: Armin Kuster <akuster@mvista.com>
5 *
6 * 2001 (c) MontaVista, Software, Inc. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10 */
11
12#ifdef __KERNEL__
13#ifndef __ASM_IBMSTB4_H__
14#define __ASM_IBMSTB4_H__
15
16#include <linux/config.h>
17
18/* serial port defines */
19#define STB04xxx_IO_BASE ((uint)0xe0000000)
20#define PPC4xx_PCI_IO_ADDR STB04xxx_IO_BASE
21#define PPC4xx_ONB_IO_PADDR STB04xxx_IO_BASE
22#define PPC4xx_ONB_IO_VADDR ((uint)0xe0000000)
23#define PPC4xx_ONB_IO_SIZE ((uint)14*64*1024)
24
25/*
26 * map STB04xxx internal i/o address (0x400x00xx) to an address
27 * which is below the 2GB limit...
28 *
29 * 4000 000x uart1 -> 0xe000 000x
30 * 4001 00xx ppu
31 * 4002 00xx smart card
32 * 4003 000x iic
33 * 4004 000x uart0
34 * 4005 0xxx timer
35 * 4006 00xx gpio
36 * 4007 00xx smart card
37 * 400b 000x iic
38 * 400c 000x scp
39 * 400d 000x modem
40 * 400e 000x uart2
41*/
42#define STB04xxx_MAP_IO_ADDR(a) (((uint)(a)) + (STB04xxx_IO_BASE - 0x40000000))
43
44#define RS_TABLE_SIZE 3
45#define UART0_INT 20
46
47#ifdef __BOOTER__
48#define UART0_IO_BASE 0x40040000
49#else
50#define UART0_IO_BASE 0xe0040000
51#endif
52
53#define UART1_INT 21
54
55#ifdef __BOOTER__
56#define UART1_IO_BASE 0x40000000
57#else
58#define UART1_IO_BASE 0xe0000000
59#endif
60
61#define UART2_INT 31
62#ifdef __BOOTER__
63#define UART2_IO_BASE 0x400e0000
64#else
65#define UART2_IO_BASE 0xe00e0000
66#endif
67
68#define IDE0_BASE 0x400F0000
69#define IDE0_SIZE 0x200
70#define IDE0_IRQ 25
71#define IIC0_BASE 0x40030000
72#define IIC1_BASE 0x400b0000
73#define OPB0_BASE 0x40000000
74#define GPIO0_BASE 0x40060000
75
76#define USB0_IRQ 18
77#define USB0_BASE STB04xxx_MAP_IO_ADDR(0x40010000)
78#define USB0_EXTENT 4096
79
80#define IIC_NUMS 2
81#define UART_NUMS 3
82#define IIC0_IRQ 9
83#define IIC1_IRQ 10
84#define IIC_OWN 0x55
85#define IIC_CLOCK 50
86
87#define BD_EMAC_ADDR(e,i) bi_enetaddr[i]
88
89#define STD_UART_OP(num) \
90 { 0, BASE_BAUD, 0, UART##num##_INT, \
91 (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST), \
92 iomem_base: (u8 *)UART##num##_IO_BASE, \
93 io_type: SERIAL_IO_MEM},
94
95#if defined(CONFIG_UART0_TTYS0)
96#define SERIAL_DEBUG_IO_BASE UART0_IO_BASE
97#define SERIAL_PORT_DFNS \
98 STD_UART_OP(0) \
99 STD_UART_OP(1) \
100 STD_UART_OP(2)
101#endif
102
103#if defined(CONFIG_UART0_TTYS1)
104#define SERIAL_DEBUG_IO_BASE UART2_IO_BASE
105#define SERIAL_PORT_DFNS \
106 STD_UART_OP(1) \
107 STD_UART_OP(0) \
108 STD_UART_OP(2)
109#endif
110
111#if defined(CONFIG_UART0_TTYS2)
112#define SERIAL_DEBUG_IO_BASE UART2_IO_BASE
113#define SERIAL_PORT_DFNS \
114 STD_UART_OP(2) \
115 STD_UART_OP(0) \
116 STD_UART_OP(1)
117#endif
118
119#define DCRN_BE_BASE 0x090
120#define DCRN_DMA0_BASE 0x0C0
121#define DCRN_DMA1_BASE 0x0C8
122#define DCRN_DMA2_BASE 0x0D0
123#define DCRN_DMA3_BASE 0x0D8
124#define DCRNCAP_DMA_CC 1 /* have DMA chained count capability */
125#define DCRN_DMASR_BASE 0x0E0
126#define DCRN_PLB0_BASE 0x054
127#define DCRN_PLB1_BASE 0x064
128#define DCRN_POB0_BASE 0x0B0
129#define DCRN_SCCR_BASE 0x120
130#define DCRN_UIC0_BASE 0x040
131#define DCRN_BE_BASE 0x090
132#define DCRN_DMA0_BASE 0x0C0
133#define DCRN_DMA1_BASE 0x0C8
134#define DCRN_DMA2_BASE 0x0D0
135#define DCRN_DMA3_BASE 0x0D8
136#define DCRN_CIC_BASE 0x030
137#define DCRN_DMASR_BASE 0x0E0
138#define DCRN_EBIMC_BASE 0x070
139#define DCRN_DCRX_BASE 0x020
140#define DCRN_CPMFR_BASE 0x102
141#define DCRN_SCCR_BASE 0x120
142#define UIC0 DCRN_UIC0_BASE
143
144#define IBM_CPM_IIC0 0x80000000 /* IIC 0 interface */
145#define IBM_CPM_USB0 0x40000000 /* IEEE-1284 */
146#define IBM_CPM_IIC1 0x20000000 /* IIC 1 interface */
147#define IBM_CPM_CPU 0x10000000 /* PPC405B3 clock control */
148#define IBM_CPM_AUD 0x08000000 /* Audio Decoder */
149#define IBM_CPM_EBIU 0x04000000 /* External Bus Interface Unit */
150#define IBM_CPM_SDRAM1 0x02000000 /* SDRAM 1 memory controller */
151#define IBM_CPM_DMA 0x01000000 /* DMA controller */
152#define IBM_CPM_DMA1 0x00800000 /* reserved */
153#define IBM_CPM_XPT1 0x00400000 /* reserved */
154#define IBM_CPM_XPT2 0x00200000 /* reserved */
155#define IBM_CPM_UART1 0x00100000 /* Serial 1 / Infrared */
156#define IBM_CPM_UART0 0x00080000 /* Serial 0 / 16550 */
157#define IBM_CPM_EPI 0x00040000 /* DCR Extension */
158#define IBM_CPM_SC0 0x00020000 /* Smart Card 0 */
159#define IBM_CPM_VID 0x00010000 /* reserved */
160#define IBM_CPM_SC1 0x00008000 /* Smart Card 1 */
161#define IBM_CPM_USBSDRA 0x00004000 /* SDRAM 0 memory controller */
162#define IBM_CPM_XPT0 0x00002000 /* Transport - 54 Mhz */
163#define IBM_CPM_CBS 0x00001000 /* Cross Bar Switch */
164#define IBM_CPM_GPT 0x00000800 /* GPTPWM */
165#define IBM_CPM_GPIO0 0x00000400 /* General Purpose IO 0 */
166#define IBM_CPM_DENC 0x00000200 /* Digital video Encoder */
167#define IBM_CPM_TMRCLK 0x00000100 /* CPU timers */
168#define IBM_CPM_XPT27 0x00000080 /* Transport - 27 Mhz */
169#define IBM_CPM_UIC 0x00000040 /* Universal Interrupt Controller */
170#define IBM_CPM_SSP 0x00000010 /* Modem Serial Interface (SSP) */
171#define IBM_CPM_UART2 0x00000008 /* Serial Control Port */
172#define IBM_CPM_DDIO 0x00000004 /* Descrambler */
173#define IBM_CPM_VID2 0x00000002 /* Video Decoder clock domain 2 */
174
175#define DFLT_IBM4xx_PM ~(IBM_CPM_CPU | IBM_CPM_EBIU | IBM_CPM_SDRAM1 \
176 | IBM_CPM_DMA | IBM_CPM_DMA1 | IBM_CPM_CBS \
177 | IBM_CPM_USBSDRA | IBM_CPM_XPT0 | IBM_CPM_TMRCLK \
178 | IBM_CPM_XPT27 | IBM_CPM_UIC )
179
180#define DCRN_BEAR (DCRN_BE_BASE + 0x0) /* Bus Error Address Register */
181#define DCRN_BESR (DCRN_BE_BASE + 0x1) /* Bus Error Syndrome Register */
182/* DCRN_BESR */
183#define BESR_DSES 0x80000000 /* Data-Side Error Status */
184#define BESR_DMES 0x40000000 /* DMA Error Status */
185#define BESR_RWS 0x20000000 /* Read/Write Status */
186#define BESR_ETMASK 0x1C000000 /* Error Type */
187#define ET_PROT 0
188#define ET_PARITY 1
189#define ET_NCFG 2
190#define ET_BUSERR 4
191#define ET_BUSTO 6
192
193#define CHR1_CETE 0x00800000 /* CPU external timer enable */
194#define CHR1_PCIPW 0x00008000 /* PCI Int enable/Peripheral Write enable */
195
196#define DCRN_CICCR (DCRN_CIC_BASE + 0x0) /* CIC Control Register */
197#define DCRN_DMAS1 (DCRN_CIC_BASE + 0x1) /* DMA Select1 Register */
198#define DCRN_DMAS2 (DCRN_CIC_BASE + 0x2) /* DMA Select2 Register */
199#define DCRN_CICVCR (DCRN_CIC_BASE + 0x3) /* CIC Video COntro Register */
200#define DCRN_CICSEL3 (DCRN_CIC_BASE + 0x5) /* CIC Select 3 Register */
201#define DCRN_SGPO (DCRN_CIC_BASE + 0x6) /* CIC GPIO Output Register */
202#define DCRN_SGPOD (DCRN_CIC_BASE + 0x7) /* CIC GPIO OD Register */
203#define DCRN_SGPTC (DCRN_CIC_BASE + 0x8) /* CIC GPIO Tristate Ctrl Reg */
204#define DCRN_SGPI (DCRN_CIC_BASE + 0x9) /* CIC GPIO Input Reg */
205
206#define DCRN_DCRXICR (DCRN_DCRX_BASE + 0x0) /* Internal Control Register */
207#define DCRN_DCRXISR (DCRN_DCRX_BASE + 0x1) /* Internal Status Register */
208#define DCRN_DCRXECR (DCRN_DCRX_BASE + 0x2) /* External Control Register */
209#define DCRN_DCRXESR (DCRN_DCRX_BASE + 0x3) /* External Status Register */
210#define DCRN_DCRXTAR (DCRN_DCRX_BASE + 0x4) /* Target Address Register */
211#define DCRN_DCRXTDR (DCRN_DCRX_BASE + 0x5) /* Target Data Register */
212#define DCRN_DCRXIGR (DCRN_DCRX_BASE + 0x6) /* Interrupt Generation Register */
213#define DCRN_DCRXBCR (DCRN_DCRX_BASE + 0x7) /* Line Buffer Control Register */
214
215#define DCRN_BRCRH0 (DCRN_EBIMC_BASE + 0x0) /* Bus Region Config High 0 */
216#define DCRN_BRCRH1 (DCRN_EBIMC_BASE + 0x1) /* Bus Region Config High 1 */
217#define DCRN_BRCRH2 (DCRN_EBIMC_BASE + 0x2) /* Bus Region Config High 2 */
218#define DCRN_BRCRH3 (DCRN_EBIMC_BASE + 0x3) /* Bus Region Config High 3 */
219#define DCRN_BRCRH4 (DCRN_EBIMC_BASE + 0x4) /* Bus Region Config High 4 */
220#define DCRN_BRCRH5 (DCRN_EBIMC_BASE + 0x5) /* Bus Region Config High 5 */
221#define DCRN_BRCRH6 (DCRN_EBIMC_BASE + 0x6) /* Bus Region Config High 6 */
222#define DCRN_BRCRH7 (DCRN_EBIMC_BASE + 0x7) /* Bus Region Config High 7 */
223#define DCRN_BRCR0 (DCRN_EBIMC_BASE + 0x10) /* BRC 0 */
224#define DCRN_BRCR1 (DCRN_EBIMC_BASE + 0x11) /* BRC 1 */
225#define DCRN_BRCR2 (DCRN_EBIMC_BASE + 0x12) /* BRC 2 */
226#define DCRN_BRCR3 (DCRN_EBIMC_BASE + 0x13) /* BRC 3 */
227#define DCRN_BRCR4 (DCRN_EBIMC_BASE + 0x14) /* BRC 4 */
228#define DCRN_BRCR5 (DCRN_EBIMC_BASE + 0x15) /* BRC 5 */
229#define DCRN_BRCR6 (DCRN_EBIMC_BASE + 0x16) /* BRC 6 */
230#define DCRN_BRCR7 (DCRN_EBIMC_BASE + 0x17) /* BRC 7 */
231#define DCRN_BEAR0 (DCRN_EBIMC_BASE + 0x20) /* Bus Error Address Register */
232#define DCRN_BESR0 (DCRN_EBIMC_BASE + 0x21) /* Bus Error Status Register */
233#define DCRN_BIUCR (DCRN_EBIMC_BASE + 0x2A) /* Bus Interfac Unit Ctrl Reg */
234
235#include <asm/ibm405.h>
236
237#endif /* __ASM_IBMSTB4_H__ */
238#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/4xx/ibmstbx25.c b/arch/ppc/platforms/4xx/ibmstbx25.c
new file mode 100644
index 000000000000..b895b9cca57d
--- /dev/null
+++ b/arch/ppc/platforms/4xx/ibmstbx25.c
@@ -0,0 +1,68 @@
1/*
2 * arch/ppc/platforms/4xx/ibmstbx25.c
3 *
4 * Author: Armin Kuster <akuster@mvista.com>
5 *
6 * 2000-2002 (c) MontaVista, Software, Inc. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10 */
11
12#include <linux/init.h>
13#include <asm/ocp.h>
14#include <platforms/4xx/ibmstbx25.h>
15#include <asm/ppc4xx_pic.h>
16
17static struct ocp_func_iic_data ibmstbx25_iic0_def = {
18 .fast_mode = 0, /* Use standad mode (100Khz) */
19};
20OCP_SYSFS_IIC_DATA()
21
22struct ocp_def core_ocp[] __initdata = {
23 { .vendor = OCP_VENDOR_IBM,
24 .function = OCP_FUNC_16550,
25 .index = 0,
26 .paddr = UART0_IO_BASE,
27 .irq = UART0_INT,
28 .pm = IBM_CPM_UART0,
29 },
30 { .vendor = OCP_VENDOR_IBM,
31 .function = OCP_FUNC_16550,
32 .index = 1,
33 .paddr = UART1_IO_BASE,
34 .irq = UART1_INT,
35 .pm = IBM_CPM_UART1,
36 },
37 { .vendor = OCP_VENDOR_IBM,
38 .function = OCP_FUNC_16550,
39 .index = 2,
40 .paddr = UART2_IO_BASE,
41 .irq = UART2_INT,
42 .pm = IBM_CPM_UART2,
43 },
44 { .vendor = OCP_VENDOR_IBM,
45 .function = OCP_FUNC_IIC,
46 .paddr = IIC0_BASE,
47 .irq = IIC0_IRQ,
48 .pm = IBM_CPM_IIC0,
49 .additions = &ibmstbx25_iic0_def,
50 .show = &ocp_show_iic_data
51 },
52 { .vendor = OCP_VENDOR_IBM,
53 .function = OCP_FUNC_GPIO,
54 .paddr = GPIO0_BASE,
55 .irq = OCP_IRQ_NA,
56 .pm = IBM_CPM_GPIO0,
57 },
58 { .vendor = OCP_VENDOR_INVALID
59 }
60};
61
62/* Polarity and triggering settings for internal interrupt sources */
63struct ppc4xx_uic_settings ppc4xx_core_uic_cfg[] __initdata = {
64 { .polarity = 0xffff8f80,
65 .triggering = 0x00000000,
66 .ext_irq_mask = 0x0000707f, /* IRQ7 - IRQ9, IRQ0 - IRQ6 */
67 }
68};
diff --git a/arch/ppc/platforms/4xx/ibmstbx25.h b/arch/ppc/platforms/4xx/ibmstbx25.h
new file mode 100644
index 000000000000..9a2efc366e9c
--- /dev/null
+++ b/arch/ppc/platforms/4xx/ibmstbx25.h
@@ -0,0 +1,261 @@
1/*
2 * arch/ppc/platforms/4xx/ibmstbx25.h
3 *
4 * Author: Armin Kuster <akuster@mvista.com>
5 *
6 * 2002 (c) MontaVista, Software, Inc. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10 */
11
12#ifdef __KERNEL__
13#ifndef __ASM_IBMSTBX25_H__
14#define __ASM_IBMSTBX25_H__
15
16#include <linux/config.h>
17
18/* serial port defines */
19#define STBx25xx_IO_BASE ((uint)0xe0000000)
20#define PPC4xx_ONB_IO_PADDR STBx25xx_IO_BASE
21#define PPC4xx_ONB_IO_VADDR ((uint)0xe0000000)
22#define PPC4xx_ONB_IO_SIZE ((uint)14*64*1024)
23
24/*
25 * map STBxxxx internal i/o address (0x400x00xx) to an address
26 * which is below the 2GB limit...
27 *
28 * 4000 000x uart1 -> 0xe000 000x
29 * 4001 00xx uart2
30 * 4002 00xx smart card
31 * 4003 000x iic
32 * 4004 000x uart0
33 * 4005 0xxx timer
34 * 4006 00xx gpio
35 * 4007 00xx smart card
36 * 400b 000x iic
37 * 400c 000x scp
38 * 400d 000x modem
39 * 400e 000x uart2
40*/
41#define STBx25xx_MAP_IO_ADDR(a) (((uint)(a)) + (STBx25xx_IO_BASE - 0x40000000))
42
43#define RS_TABLE_SIZE 3
44
45#define OPB_BASE_START 0x40000000
46#define EBIU_BASE_START 0xF0100000
47#define DCR_BASE_START 0x0000
48
49#ifdef __BOOTER__
50#define UART1_IO_BASE 0x40000000
51#define UART2_IO_BASE 0x40010000
52#else
53#define UART1_IO_BASE 0xe0000000
54#define UART2_IO_BASE 0xe0010000
55#endif
56#define SC0_BASE 0x40020000 /* smart card #0 */
57#define IIC0_BASE 0x40030000
58#ifdef __BOOTER__
59#define UART0_IO_BASE 0x40040000
60#else
61#define UART0_IO_BASE 0xe0040000
62#endif
63#define SCC0_BASE 0x40040000 /* Serial 0 controller IrdA */
64#define GPT0_BASE 0x40050000 /* General purpose timers */
65#define GPIO0_BASE 0x40060000
66#define SC1_BASE 0x40070000 /* smart card #1 */
67#define SCP0_BASE 0x400C0000 /* Serial Controller Port */
68#define SSP0_BASE 0x400D0000 /* Sync serial port */
69
70#define IDE0_BASE 0xf0100000
71#define REDWOOD_IDE_CTRL 0xf1100000
72
73#define RTCFPC_IRQ 0
74#define XPORT_IRQ 1
75#define AUD_IRQ 2
76#define AID_IRQ 3
77#define DMA0 4
78#define DMA1_IRQ 5
79#define DMA2_IRQ 6
80#define DMA3_IRQ 7
81#define SC0_IRQ 8
82#define IIC0_IRQ 9
83#define IIR0_IRQ 10
84#define GPT0_IRQ 11
85#define GPT1_IRQ 12
86#define SCP0_IRQ 13
87#define SSP0_IRQ 14
88#define GPT2_IRQ 15 /* count down timer */
89#define SC1_IRQ 16
90/* IRQ 17 - 19 external */
91#define UART0_INT 20
92#define UART1_INT 21
93#define UART2_INT 22
94#define XPTDMA_IRQ 23
95#define DCRIDE_IRQ 24
96/* IRQ 25 - 30 external */
97#define IDE0_IRQ 26
98
99#define IIC_NUMS 1
100#define UART_NUMS 3
101#define IIC_OWN 0x55
102#define IIC_CLOCK 50
103
104#define BD_EMAC_ADDR(e,i) bi_enetaddr[i]
105
106#define STD_UART_OP(num) \
107 { 0, BASE_BAUD, 0, UART##num##_INT, \
108 (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST), \
109 iomem_base: (u8 *)UART##num##_IO_BASE, \
110 io_type: SERIAL_IO_MEM},
111
112#if defined(CONFIG_UART0_TTYS0)
113#define SERIAL_DEBUG_IO_BASE UART0_IO_BASE
114#define SERIAL_PORT_DFNS \
115 STD_UART_OP(0) \
116 STD_UART_OP(1) \
117 STD_UART_OP(2)
118#endif
119
120#if defined(CONFIG_UART0_TTYS1)
121#define SERIAL_DEBUG_IO_BASE UART2_IO_BASE
122#define SERIAL_PORT_DFNS \
123 STD_UART_OP(1) \
124 STD_UART_OP(0) \
125 STD_UART_OP(2)
126#endif
127
128#if defined(CONFIG_UART0_TTYS2)
129#define SERIAL_DEBUG_IO_BASE UART2_IO_BASE
130#define SERIAL_PORT_DFNS \
131 STD_UART_OP(2) \
132 STD_UART_OP(0) \
133 STD_UART_OP(1)
134#endif
135
136#define DCRN_BE_BASE 0x090
137#define DCRN_DMA0_BASE 0x0C0
138#define DCRN_DMA1_BASE 0x0C8
139#define DCRN_DMA2_BASE 0x0D0
140#define DCRN_DMA3_BASE 0x0D8
141#define DCRNCAP_DMA_CC 1 /* have DMA chained count capability */
142#define DCRN_DMASR_BASE 0x0E0
143#define DCRN_PLB0_BASE 0x054
144#define DCRN_PLB1_BASE 0x064
145#define DCRN_POB0_BASE 0x0B0
146#define DCRN_SCCR_BASE 0x120
147#define DCRN_UIC0_BASE 0x040
148#define DCRN_BE_BASE 0x090
149#define DCRN_DMA0_BASE 0x0C0
150#define DCRN_DMA1_BASE 0x0C8
151#define DCRN_DMA2_BASE 0x0D0
152#define DCRN_DMA3_BASE 0x0D8
153#define DCRN_CIC_BASE 0x030
154#define DCRN_DMASR_BASE 0x0E0
155#define DCRN_EBIMC_BASE 0x070
156#define DCRN_DCRX_BASE 0x020
157#define DCRN_CPMFR_BASE 0x102
158#define DCRN_SCCR_BASE 0x120
159#define DCRN_RTCFP_BASE 0x310
160
161#define UIC0 DCRN_UIC0_BASE
162
163#define IBM_CPM_IIC0 0x80000000 /* IIC 0 interface */
164#define IBM_CPM_CPU 0x10000000 /* PPC405B3 clock control */
165#define IBM_CPM_AUD 0x08000000 /* Audio Decoder */
166#define IBM_CPM_EBIU 0x04000000 /* External Bus Interface Unit */
167#define IBM_CPM_IRR 0x02000000 /* Infrared receiver */
168#define IBM_CPM_DMA 0x01000000 /* DMA controller */
169#define IBM_CPM_UART2 0x00200000 /* Serial Control Port */
170#define IBM_CPM_UART1 0x00100000 /* Serial 1 / Infrared */
171#define IBM_CPM_UART0 0x00080000 /* Serial 0 / 16550 */
172#define IBM_PM_DCRIDE 0x00040000 /* DCR timeout & IDE line Mode clock */
173#define IBM_CPM_SC0 0x00020000 /* Smart Card 0 */
174#define IBM_CPM_VID 0x00010000 /* reserved */
175#define IBM_CPM_SC1 0x00008000 /* Smart Card 0 */
176#define IBM_CPM_XPT0 0x00002000 /* Transport - 54 Mhz */
177#define IBM_CPM_CBS 0x00001000 /* Cross Bar Switch */
178#define IBM_CPM_GPT 0x00000800 /* GPTPWM */
179#define IBM_CPM_GPIO0 0x00000400 /* General Purpose IO 0 */
180#define IBM_CPM_DENC 0x00000200 /* Digital video Encoder */
181#define IBM_CPM_C405T 0x00000100 /* CPU timers */
182#define IBM_CPM_XPT27 0x00000080 /* Transport - 27 Mhz */
183#define IBM_CPM_UIC 0x00000040 /* Universal Interrupt Controller */
184#define IBM_CPM_RTCFPC 0x00000020 /* Realtime clock and front panel */
185#define IBM_CPM_SSP 0x00000010 /* Modem Serial Interface (SSP) */
186#define IBM_CPM_VID2 0x00000002 /* Video Decoder clock domain 2 */
187#define DFLT_IBM4xx_PM ~(IBM_CPM_CPU | IBM_CPM_EBIU | IBM_CPM_DMA \
188 | IBM_CPM_CBS | IBM_CPM_XPT0 | IBM_CPM_C405T \
189 | IBM_CPM_XPT27 | IBM_CPM_UIC)
190
191#define DCRN_BEAR (DCRN_BE_BASE + 0x0) /* Bus Error Address Register */
192#define DCRN_BESR (DCRN_BE_BASE + 0x1) /* Bus Error Syndrome Register */
193/* DCRN_BESR */
194#define BESR_DSES 0x80000000 /* Data-Side Error Status */
195#define BESR_DMES 0x40000000 /* DMA Error Status */
196#define BESR_RWS 0x20000000 /* Read/Write Status */
197#define BESR_ETMASK 0x1C000000 /* Error Type */
198#define ET_PROT 0
199#define ET_PARITY 1
200#define ET_NCFG 2
201#define ET_BUSERR 4
202#define ET_BUSTO 6
203
204#define CHR1_CETE 0x00800000 /* CPU external timer enable */
205#define CHR1_PCIPW 0x00008000 /* PCI Int enable/Peripheral Write enable */
206
207#define DCRN_CICCR (DCRN_CIC_BASE + 0x0) /* CIC Control Register */
208#define DCRN_DMAS1 (DCRN_CIC_BASE + 0x1) /* DMA Select1 Register */
209#define DCRN_DMAS2 (DCRN_CIC_BASE + 0x2) /* DMA Select2 Register */
210#define DCRN_CICVCR (DCRN_CIC_BASE + 0x3) /* CIC Video COntro Register */
211#define DCRN_CICSEL3 (DCRN_CIC_BASE + 0x5) /* CIC Select 3 Register */
212#define DCRN_SGPO (DCRN_CIC_BASE + 0x6) /* CIC GPIO Output Register */
213#define DCRN_SGPOD (DCRN_CIC_BASE + 0x7) /* CIC GPIO OD Register */
214#define DCRN_SGPTC (DCRN_CIC_BASE + 0x8) /* CIC GPIO Tristate Ctrl Reg */
215#define DCRN_SGPI (DCRN_CIC_BASE + 0x9) /* CIC GPIO Input Reg */
216
217#define DCRN_DCRXICR (DCRN_DCRX_BASE + 0x0) /* Internal Control Register */
218#define DCRN_DCRXISR (DCRN_DCRX_BASE + 0x1) /* Internal Status Register */
219#define DCRN_DCRXECR (DCRN_DCRX_BASE + 0x2) /* External Control Register */
220#define DCRN_DCRXESR (DCRN_DCRX_BASE + 0x3) /* External Status Register */
221#define DCRN_DCRXTAR (DCRN_DCRX_BASE + 0x4) /* Target Address Register */
222#define DCRN_DCRXTDR (DCRN_DCRX_BASE + 0x5) /* Target Data Register */
223#define DCRN_DCRXIGR (DCRN_DCRX_BASE + 0x6) /* Interrupt Generation Register */
224#define DCRN_DCRXBCR (DCRN_DCRX_BASE + 0x7) /* Line Buffer Control Register */
225
226#define DCRN_BRCRH0 (DCRN_EBIMC_BASE + 0x0) /* Bus Region Config High 0 */
227#define DCRN_BRCRH1 (DCRN_EBIMC_BASE + 0x1) /* Bus Region Config High 1 */
228#define DCRN_BRCRH2 (DCRN_EBIMC_BASE + 0x2) /* Bus Region Config High 2 */
229#define DCRN_BRCRH3 (DCRN_EBIMC_BASE + 0x3) /* Bus Region Config High 3 */
230#define DCRN_BRCRH4 (DCRN_EBIMC_BASE + 0x4) /* Bus Region Config High 4 */
231#define DCRN_BRCRH5 (DCRN_EBIMC_BASE + 0x5) /* Bus Region Config High 5 */
232#define DCRN_BRCRH6 (DCRN_EBIMC_BASE + 0x6) /* Bus Region Config High 6 */
233#define DCRN_BRCRH7 (DCRN_EBIMC_BASE + 0x7) /* Bus Region Config High 7 */
234#define DCRN_BRCR0 (DCRN_EBIMC_BASE + 0x10) /* BRC 0 */
235#define DCRN_BRCR1 (DCRN_EBIMC_BASE + 0x11) /* BRC 1 */
236#define DCRN_BRCR2 (DCRN_EBIMC_BASE + 0x12) /* BRC 2 */
237#define DCRN_BRCR3 (DCRN_EBIMC_BASE + 0x13) /* BRC 3 */
238#define DCRN_BRCR4 (DCRN_EBIMC_BASE + 0x14) /* BRC 4 */
239#define DCRN_BRCR5 (DCRN_EBIMC_BASE + 0x15) /* BRC 5 */
240#define DCRN_BRCR6 (DCRN_EBIMC_BASE + 0x16) /* BRC 6 */
241#define DCRN_BRCR7 (DCRN_EBIMC_BASE + 0x17) /* BRC 7 */
242#define DCRN_BEAR0 (DCRN_EBIMC_BASE + 0x20) /* Bus Error Address Register */
243#define DCRN_BESR0 (DCRN_EBIMC_BASE + 0x21) /* Bus Error Status Register */
244#define DCRN_BIUCR (DCRN_EBIMC_BASE + 0x2A) /* Bus Interfac Unit Ctrl Reg */
245
246#define DCRN_RTC_FPC0_CNTL (DCRN_RTCFP_BASE + 0x00) /* RTC cntl */
247#define DCRN_RTC_FPC0_INT (DCRN_RTCFP_BASE + 0x01) /* RTC Interrupt */
248#define DCRN_RTC_FPC0_TIME (DCRN_RTCFP_BASE + 0x02) /* RTC time reg */
249#define DCRN_RTC_FPC0_ALRM (DCRN_RTCFP_BASE + 0x03) /* RTC Alarm reg */
250#define DCRN_RTC_FPC0_D1 (DCRN_RTCFP_BASE + 0x04) /* LED Data 1 */
251#define DCRN_RTC_FPC0_D2 (DCRN_RTCFP_BASE + 0x05) /* LED Data 2 */
252#define DCRN_RTC_FPC0_D3 (DCRN_RTCFP_BASE + 0x06) /* LED Data 3 */
253#define DCRN_RTC_FPC0_D4 (DCRN_RTCFP_BASE + 0x07) /* LED Data 4 */
254#define DCRN_RTC_FPC0_D5 (DCRN_RTCFP_BASE + 0x08) /* LED Data 5 */
255#define DCRN_RTC_FPC0_FCNTL (DCRN_RTCFP_BASE + 0x09) /* LED control */
256#define DCRN_RTC_FPC0_BRT (DCRN_RTCFP_BASE + 0x0A) /* Brightness cntl */
257
258#include <asm/ibm405.h>
259
260#endif /* __ASM_IBMSTBX25_H__ */
261#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/4xx/luan.c b/arch/ppc/platforms/4xx/luan.c
new file mode 100644
index 000000000000..1df2339f1f6c
--- /dev/null
+++ b/arch/ppc/platforms/4xx/luan.c
@@ -0,0 +1,387 @@
1/*
2 * arch/ppc/platforms/4xx/luan.c
3 *
4 * Luan board specific routines
5 *
6 * Matt Porter <mporter@kernel.crashing.org>
7 *
8 * Copyright 2004-2005 MontaVista Software Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15
16#include <linux/config.h>
17#include <linux/stddef.h>
18#include <linux/kernel.h>
19#include <linux/init.h>
20#include <linux/errno.h>
21#include <linux/reboot.h>
22#include <linux/pci.h>
23#include <linux/kdev_t.h>
24#include <linux/types.h>
25#include <linux/major.h>
26#include <linux/blkdev.h>
27#include <linux/console.h>
28#include <linux/delay.h>
29#include <linux/ide.h>
30#include <linux/initrd.h>
31#include <linux/irq.h>
32#include <linux/seq_file.h>
33#include <linux/root_dev.h>
34#include <linux/tty.h>
35#include <linux/serial.h>
36#include <linux/serial_core.h>
37
38#include <asm/system.h>
39#include <asm/pgtable.h>
40#include <asm/page.h>
41#include <asm/dma.h>
42#include <asm/io.h>
43#include <asm/machdep.h>
44#include <asm/ocp.h>
45#include <asm/pci-bridge.h>
46#include <asm/time.h>
47#include <asm/todc.h>
48#include <asm/bootinfo.h>
49#include <asm/ppc4xx_pic.h>
50#include <asm/ppcboot.h>
51
52#include <syslib/ibm44x_common.h>
53#include <syslib/ibm440gx_common.h>
54#include <syslib/ibm440sp_common.h>
55
56/*
57 * This is a horrible kludge, we eventually need to abstract this
58 * generic PHY stuff, so the standard phy mode defines can be
59 * easily used from arch code.
60 */
61#include "../../../../drivers/net/ibm_emac/ibm_emac_phy.h"
62
63bd_t __res;
64
65static struct ibm44x_clocks clocks __initdata;
66
67static void __init
68luan_calibrate_decr(void)
69{
70 unsigned int freq;
71
72 if (mfspr(SPRN_CCR1) & CCR1_TCS)
73 freq = LUAN_TMR_CLK;
74 else
75 freq = clocks.cpu;
76
77 ibm44x_calibrate_decr(freq);
78}
79
80static int
81luan_show_cpuinfo(struct seq_file *m)
82{
83 seq_printf(m, "vendor\t\t: IBM\n");
84 seq_printf(m, "machine\t\t: PPC440SP EVB (Luan)\n");
85
86 return 0;
87}
88
89static inline int
90luan_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
91{
92 struct pci_controller *hose = pci_bus_to_hose(dev->bus->number);
93
94 /* PCIX0 in adapter mode, no host interrupt routing */
95
96 /* PCIX1 */
97 if (hose->index == 0) {
98 static char pci_irq_table[][4] =
99 /*
100 * PCI IDSEL/INTPIN->INTLINE
101 * A B C D
102 */
103 {
104 { 49, 49, 49, 49 }, /* IDSEL 1 - PCIX1 Slot 0 */
105 { 49, 49, 49, 49 }, /* IDSEL 2 - PCIX1 Slot 1 */
106 { 49, 49, 49, 49 }, /* IDSEL 3 - PCIX1 Slot 2 */
107 { 49, 49, 49, 49 }, /* IDSEL 4 - PCIX1 Slot 3 */
108 };
109 const long min_idsel = 1, max_idsel = 4, irqs_per_slot = 4;
110 return PCI_IRQ_TABLE_LOOKUP;
111 /* PCIX2 */
112 } else if (hose->index == 1) {
113 static char pci_irq_table[][4] =
114 /*
115 * PCI IDSEL/INTPIN->INTLINE
116 * A B C D
117 */
118 {
119 { 50, 50, 50, 50 }, /* IDSEL 1 - PCIX2 Slot 0 */
120 { 50, 50, 50, 50 }, /* IDSEL 2 - PCIX2 Slot 1 */
121 { 50, 50, 50, 50 }, /* IDSEL 3 - PCIX2 Slot 2 */
122 { 50, 50, 50, 50 }, /* IDSEL 4 - PCIX2 Slot 3 */
123 };
124 const long min_idsel = 1, max_idsel = 4, irqs_per_slot = 4;
125 return PCI_IRQ_TABLE_LOOKUP;
126 }
127 return -1;
128}
129
130static void __init luan_set_emacdata(void)
131{
132 struct ocp_def *def;
133 struct ocp_func_emac_data *emacdata;
134
135 /* Set phy_map, phy_mode, and mac_addr for the EMAC */
136 def = ocp_get_one_device(OCP_VENDOR_IBM, OCP_FUNC_EMAC, 0);
137 emacdata = def->additions;
138 emacdata->phy_map = 0x00000001; /* Skip 0x00 */
139 emacdata->phy_mode = PHY_MODE_GMII;
140 memcpy(emacdata->mac_addr, __res.bi_enetaddr, 6);
141}
142
143#define PCIX_READW(offset) \
144 (readw((void *)((u32)pcix_reg_base+offset)))
145
146#define PCIX_WRITEW(value, offset) \
147 (writew(value, (void *)((u32)pcix_reg_base+offset)))
148
149#define PCIX_WRITEL(value, offset) \
150 (writel(value, (void *)((u32)pcix_reg_base+offset)))
151
152static void __init
153luan_setup_pcix(void)
154{
155 int i;
156 void *pcix_reg_base;
157
158 for (i=0;i<3;i++) {
159 pcix_reg_base = ioremap64(PCIX0_REG_BASE + i*PCIX_REG_OFFSET, PCIX_REG_SIZE);
160
161 /* Enable PCIX0 I/O, Mem, and Busmaster cycles */
162 PCIX_WRITEW(PCIX_READW(PCIX0_COMMAND) | PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER, PCIX0_COMMAND);
163
164 /* Disable all windows */
165 PCIX_WRITEL(0, PCIX0_POM0SA);
166 PCIX_WRITEL(0, PCIX0_POM1SA);
167 PCIX_WRITEL(0, PCIX0_POM2SA);
168 PCIX_WRITEL(0, PCIX0_PIM0SA);
169 PCIX_WRITEL(0, PCIX0_PIM0SAH);
170 PCIX_WRITEL(0, PCIX0_PIM1SA);
171 PCIX_WRITEL(0, PCIX0_PIM2SA);
172 PCIX_WRITEL(0, PCIX0_PIM2SAH);
173
174 /*
175 * Setup 512MB PLB->PCI outbound mem window
176 * (a_n000_0000->0_n000_0000)
177 * */
178 PCIX_WRITEL(0x0000000a, PCIX0_POM0LAH);
179 PCIX_WRITEL(0x80000000 | i*LUAN_PCIX_MEM_SIZE, PCIX0_POM0LAL);
180 PCIX_WRITEL(0x00000000, PCIX0_POM0PCIAH);
181 PCIX_WRITEL(0x80000000 | i*LUAN_PCIX_MEM_SIZE, PCIX0_POM0PCIAL);
182 PCIX_WRITEL(0xe0000001, PCIX0_POM0SA);
183
184 /* Setup 2GB PCI->PLB inbound memory window at 0, enable MSIs */
185 PCIX_WRITEL(0x00000000, PCIX0_PIM0LAH);
186 PCIX_WRITEL(0x00000000, PCIX0_PIM0LAL);
187 PCIX_WRITEL(0xe0000007, PCIX0_PIM0SA);
188 PCIX_WRITEL(0xffffffff, PCIX0_PIM0SAH);
189
190 iounmap(pcix_reg_base);
191 }
192
193 eieio();
194}
195
196static void __init
197luan_setup_hose(struct pci_controller *hose,
198 int lower_mem,
199 int upper_mem,
200 int cfga,
201 int cfgd,
202 u64 pcix_io_base)
203{
204 char name[20];
205
206 sprintf(name, "PCIX%d host bridge", hose->index);
207
208 hose->pci_mem_offset = LUAN_PCIX_MEM_OFFSET;
209
210 pci_init_resource(&hose->io_resource,
211 LUAN_PCIX_LOWER_IO,
212 LUAN_PCIX_UPPER_IO,
213 IORESOURCE_IO,
214 name);
215
216 pci_init_resource(&hose->mem_resources[0],
217 lower_mem,
218 upper_mem,
219 IORESOURCE_MEM,
220 name);
221
222 hose->io_space.start = LUAN_PCIX_LOWER_IO;
223 hose->io_space.end = LUAN_PCIX_UPPER_IO;
224 hose->mem_space.start = lower_mem;
225 hose->mem_space.end = upper_mem;
226 isa_io_base =
227 (unsigned long)ioremap64(pcix_io_base, PCIX_IO_SIZE);
228 hose->io_base_virt = (void *)isa_io_base;
229
230 setup_indirect_pci(hose, cfga, cfgd);
231 hose->set_cfg_type = 1;
232}
233
234static void __init
235luan_setup_hoses(void)
236{
237 struct pci_controller *hose1, *hose2;
238
239 /* Configure windows on the PCI-X host bridge */
240 luan_setup_pcix();
241
242 /* Allocate hoses for PCIX1 and PCIX2 */
243 hose1 = pcibios_alloc_controller();
244 hose2 = pcibios_alloc_controller();
245 if (!hose1 || !hose2)
246 return;
247
248 /* Setup PCIX1 */
249 hose1->first_busno = 0;
250 hose1->last_busno = 0xff;
251
252 luan_setup_hose(hose1,
253 LUAN_PCIX1_LOWER_MEM,
254 LUAN_PCIX1_UPPER_MEM,
255 PCIX1_CFGA,
256 PCIX1_CFGD,
257 PCIX1_IO_BASE);
258
259 hose1->last_busno = pciauto_bus_scan(hose1, hose1->first_busno);
260
261 /* Setup PCIX2 */
262 hose2->first_busno = hose1->last_busno + 1;
263 hose2->last_busno = 0xff;
264
265 luan_setup_hose(hose2,
266 LUAN_PCIX2_LOWER_MEM,
267 LUAN_PCIX2_UPPER_MEM,
268 PCIX2_CFGA,
269 PCIX2_CFGD,
270 PCIX2_IO_BASE);
271
272 hose2->last_busno = pciauto_bus_scan(hose2, hose2->first_busno);
273
274 ppc_md.pci_swizzle = common_swizzle;
275 ppc_md.pci_map_irq = luan_map_irq;
276}
277
278TODC_ALLOC();
279
280static void __init
281luan_early_serial_map(void)
282{
283 struct uart_port port;
284
285 /* Setup ioremapped serial port access */
286 memset(&port, 0, sizeof(port));
287 port.membase = ioremap64(PPC440SP_UART0_ADDR, 8);
288 port.irq = UART0_INT;
289 port.uartclk = clocks.uart0;
290 port.regshift = 0;
291 port.iotype = SERIAL_IO_MEM;
292 port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST;
293 port.line = 0;
294
295 if (early_serial_setup(&port) != 0) {
296 printk("Early serial init of port 0 failed\n");
297 }
298
299 port.membase = ioremap64(PPC440SP_UART1_ADDR, 8);
300 port.irq = UART1_INT;
301 port.uartclk = clocks.uart1;
302 port.line = 1;
303
304 if (early_serial_setup(&port) != 0) {
305 printk("Early serial init of port 1 failed\n");
306 }
307
308 port.membase = ioremap64(PPC440SP_UART2_ADDR, 8);
309 port.irq = UART2_INT;
310 port.uartclk = BASE_BAUD;
311 port.line = 2;
312
313 if (early_serial_setup(&port) != 0) {
314 printk("Early serial init of port 2 failed\n");
315 }
316}
317
318static void __init
319luan_setup_arch(void)
320{
321 luan_set_emacdata();
322
323#if !defined(CONFIG_BDI_SWITCH)
324 /*
325 * The Abatron BDI JTAG debugger does not tolerate others
326 * mucking with the debug registers.
327 */
328 mtspr(SPRN_DBCR0, (DBCR0_TDE | DBCR0_IDM));
329#endif
330
331 /*
332 * Determine various clocks.
333 * To be completely correct we should get SysClk
334 * from FPGA, because it can be changed by on-board switches
335 * --ebs
336 */
337 /* 440GX and 440SP clocking is the same -mdp */
338 ibm440gx_get_clocks(&clocks, 33333333, 6 * 1843200);
339 ocp_sys_info.opb_bus_freq = clocks.opb;
340
341 /* init to some ~sane value until calibrate_delay() runs */
342 loops_per_jiffy = 50000000/HZ;
343
344 /* Setup PCIXn host bridges */
345 luan_setup_hoses();
346
347#ifdef CONFIG_BLK_DEV_INITRD
348 if (initrd_start)
349 ROOT_DEV = Root_RAM0;
350 else
351#endif
352#ifdef CONFIG_ROOT_NFS
353 ROOT_DEV = Root_NFS;
354#else
355 ROOT_DEV = Root_HDA1;
356#endif
357
358 luan_early_serial_map();
359
360 /* Identify the system */
361 printk("Luan port (MontaVista Software, Inc. <source@mvista.com>)\n");
362}
363
364void __init platform_init(unsigned long r3, unsigned long r4,
365 unsigned long r5, unsigned long r6, unsigned long r7)
366{
367 parse_bootinfo(find_bootinfo());
368
369 /*
370 * If we were passed in a board information, copy it into the
371 * residual data area.
372 */
373 if (r3)
374 __res = *(bd_t *)(r3 + KERNELBASE);
375
376 ibm44x_platform_init();
377
378 ppc_md.setup_arch = luan_setup_arch;
379 ppc_md.show_cpuinfo = luan_show_cpuinfo;
380 ppc_md.find_end_of_memory = ibm440sp_find_end_of_memory;
381 ppc_md.get_irq = NULL; /* Set in ppc4xx_pic_init() */
382
383 ppc_md.calibrate_decr = luan_calibrate_decr;
384#ifdef CONFIG_KGDB
385 ppc_md.early_serial_map = luan_early_serial_map;
386#endif
387}
diff --git a/arch/ppc/platforms/4xx/luan.h b/arch/ppc/platforms/4xx/luan.h
new file mode 100644
index 000000000000..09b444c87816
--- /dev/null
+++ b/arch/ppc/platforms/4xx/luan.h
@@ -0,0 +1,80 @@
1/*
2 * arch/ppc/platforms/4xx/luan.h
3 *
4 * Luan board definitions
5 *
6 * Matt Porter <mporter@kernel.crashing.org>
7 *
8 * Copyright 2004-2005 MontaVista Software Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 */
16
17#ifdef __KERNEL__
18#ifndef __ASM_LUAN_H__
19#define __ASM_LUAN_H__
20
21#include <linux/config.h>
22#include <platforms/4xx/ibm440sp.h>
23
24/* F/W TLB mapping used in bootloader glue to reset EMAC */
25#define PPC44x_EMAC0_MR0 0xa0000800
26
27/* Location of MAC addresses in PIBS image */
28#define PIBS_FLASH_BASE 0xffe00000
29#define PIBS_MAC_BASE (PIBS_FLASH_BASE+0x1b0400)
30
31/* External timer clock frequency */
32#define LUAN_TMR_CLK 25000000
33
34/* Flash */
35#define LUAN_FPGA_REG_0 0x0000000148300000ULL
36#define LUAN_BOOT_LARGE_FLASH(x) (x & 0x40)
37#define LUAN_SMALL_FLASH_LOW 0x00000001ff900000ULL
38#define LUAN_SMALL_FLASH_HIGH 0x00000001ffe00000ULL
39#define LUAN_SMALL_FLASH_SIZE 0x100000
40#define LUAN_LARGE_FLASH_LOW 0x00000001ff800000ULL
41#define LUAN_LARGE_FLASH_HIGH 0x00000001ffc00000ULL
42#define LUAN_LARGE_FLASH_SIZE 0x400000
43
44/*
45 * Serial port defines
46 */
47#define RS_TABLE_SIZE 3
48
49/* PIBS defined UART mappings, used before early_serial_setup */
50#define UART0_IO_BASE 0xa0000200
51#define UART1_IO_BASE 0xa0000300
52#define UART2_IO_BASE 0xa0000600
53
54#define BASE_BAUD 11059200
55#define STD_UART_OP(num) \
56 { 0, BASE_BAUD, 0, UART##num##_INT, \
57 (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST), \
58 iomem_base: UART##num##_IO_BASE, \
59 io_type: SERIAL_IO_MEM},
60
61#define SERIAL_PORT_DFNS \
62 STD_UART_OP(0) \
63 STD_UART_OP(1) \
64 STD_UART_OP(2)
65
66/* PCI support */
67#define LUAN_PCIX_LOWER_IO 0x00000000
68#define LUAN_PCIX_UPPER_IO 0x0000ffff
69#define LUAN_PCIX0_LOWER_MEM 0x80000000
70#define LUAN_PCIX0_UPPER_MEM 0x9fffffff
71#define LUAN_PCIX1_LOWER_MEM 0xa0000000
72#define LUAN_PCIX1_UPPER_MEM 0xbfffffff
73#define LUAN_PCIX2_LOWER_MEM 0xc0000000
74#define LUAN_PCIX2_UPPER_MEM 0xdfffffff
75
76#define LUAN_PCIX_MEM_SIZE 0x20000000
77#define LUAN_PCIX_MEM_OFFSET 0x00000000
78
79#endif /* __ASM_LUAN_H__ */
80#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/4xx/oak.c b/arch/ppc/platforms/4xx/oak.c
new file mode 100644
index 000000000000..fa25ee1fa733
--- /dev/null
+++ b/arch/ppc/platforms/4xx/oak.c
@@ -0,0 +1,255 @@
1/*
2 *
3 * Copyright (c) 1999-2000 Grant Erickson <grant@lcse.umn.edu>
4 *
5 * Module name: oak.c
6 *
7 * Description:
8 * Architecture- / platform-specific boot-time initialization code for
9 * the IBM PowerPC 403GCX "Oak" evaluation board. Adapted from original
10 * code by Gary Thomas, Cort Dougan <cort@fsmlabs.com>, and Dan Malek
11 * <dan@net4x.com>.
12 *
13 */
14
15#include <linux/config.h>
16#include <linux/init.h>
17#include <linux/smp.h>
18#include <linux/threads.h>
19#include <linux/param.h>
20#include <linux/string.h>
21#include <linux/initrd.h>
22#include <linux/irq.h>
23#include <linux/seq_file.h>
24
25#include <asm/board.h>
26#include <asm/machdep.h>
27#include <asm/page.h>
28#include <asm/bootinfo.h>
29#include <asm/ppc4xx_pic.h>
30#include <asm/time.h>
31
32#include "oak.h"
33
34/* Function Prototypes */
35
36extern void abort(void);
37
38/* Global Variables */
39
40unsigned char __res[sizeof(bd_t)];
41
42
43/*
44 * void __init oak_init()
45 *
46 * Description:
47 * This routine...
48 *
49 * Input(s):
50 * r3 - Optional pointer to a board information structure.
51 * r4 - Optional pointer to the physical starting address of the init RAM
52 * disk.
53 * r5 - Optional pointer to the physical ending address of the init RAM
54 * disk.
55 * r6 - Optional pointer to the physical starting address of any kernel
56 * command-line parameters.
57 * r7 - Optional pointer to the physical ending address of any kernel
58 * command-line parameters.
59 *
60 * Output(s):
61 * N/A
62 *
63 * Returns:
64 * N/A
65 *
66 */
67void __init
68platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
69 unsigned long r6, unsigned long r7)
70{
71 parse_bootinfo(find_bootinfo());
72
73 /*
74 * If we were passed in a board information, copy it into the
75 * residual data area.
76 */
77 if (r3) {
78 memcpy((void *)__res, (void *)(r3 + KERNELBASE), sizeof(bd_t));
79 }
80
81#if defined(CONFIG_BLK_DEV_INITRD)
82 /*
83 * If the init RAM disk has been configured in, and there's a valid
84 * starting address for it, set it up.
85 */
86 if (r4) {
87 initrd_start = r4 + KERNELBASE;
88 initrd_end = r5 + KERNELBASE;
89 }
90#endif /* CONFIG_BLK_DEV_INITRD */
91
92 /* Copy the kernel command line arguments to a safe place. */
93
94 if (r6) {
95 *(char *)(r7 + KERNELBASE) = 0;
96 strcpy(cmd_line, (char *)(r6 + KERNELBASE));
97 }
98
99 /* Initialize machine-dependency vectors */
100
101 ppc_md.setup_arch = oak_setup_arch;
102 ppc_md.show_percpuinfo = oak_show_percpuinfo;
103 ppc_md.irq_canonicalize = NULL;
104 ppc_md.init_IRQ = ppc4xx_pic_init;
105 ppc_md.get_irq = NULL; /* Set in ppc4xx_pic_init() */
106 ppc_md.init = NULL;
107
108 ppc_md.restart = oak_restart;
109 ppc_md.power_off = oak_power_off;
110 ppc_md.halt = oak_halt;
111
112 ppc_md.time_init = oak_time_init;
113 ppc_md.set_rtc_time = oak_set_rtc_time;
114 ppc_md.get_rtc_time = oak_get_rtc_time;
115 ppc_md.calibrate_decr = oak_calibrate_decr;
116}
117
118/*
119 * Document me.
120 */
121void __init
122oak_setup_arch(void)
123{
124 /* XXX - Implement me */
125}
126
127/*
128 * int oak_show_percpuinfo()
129 *
130 * Description:
131 * This routine pretty-prints the platform's internal CPU and bus clock
132 * frequencies into the buffer for usage in /proc/cpuinfo.
133 *
134 * Input(s):
135 * *buffer - Buffer into which CPU and bus clock frequencies are to be
136 * printed.
137 *
138 * Output(s):
139 * *buffer - Buffer with the CPU and bus clock frequencies.
140 *
141 * Returns:
142 * The number of bytes copied into 'buffer' if OK, otherwise zero or less
143 * on error.
144 */
145int
146oak_show_percpuinfo(struct seq_file *m, int i)
147{
148 bd_t *bp = (bd_t *)__res;
149
150 seq_printf(m, "clock\t\t: %dMHz\n"
151 "bus clock\t\t: %dMHz\n",
152 bp->bi_intfreq / 1000000,
153 bp->bi_busfreq / 1000000);
154
155 return 0;
156}
157
158/*
159 * Document me.
160 */
161void
162oak_restart(char *cmd)
163{
164 abort();
165}
166
167/*
168 * Document me.
169 */
170void
171oak_power_off(void)
172{
173 oak_restart(NULL);
174}
175
176/*
177 * Document me.
178 */
179void
180oak_halt(void)
181{
182 oak_restart(NULL);
183}
184
185/*
186 * Document me.
187 */
188long __init
189oak_time_init(void)
190{
191 /* XXX - Implement me */
192 return 0;
193}
194
195/*
196 * Document me.
197 */
198int __init
199oak_set_rtc_time(unsigned long time)
200{
201 /* XXX - Implement me */
202
203 return (0);
204}
205
206/*
207 * Document me.
208 */
209unsigned long __init
210oak_get_rtc_time(void)
211{
212 /* XXX - Implement me */
213
214 return (0);
215}
216
217/*
218 * void __init oak_calibrate_decr()
219 *
220 * Description:
221 * This routine retrieves the internal processor frequency from the board
222 * information structure, sets up the kernel timer decrementer based on
223 * that value, enables the 403 programmable interval timer (PIT) and sets
224 * it up for auto-reload.
225 *
226 * Input(s):
227 * N/A
228 *
229 * Output(s):
230 * N/A
231 *
232 * Returns:
233 * N/A
234 *
235 */
236void __init
237oak_calibrate_decr(void)
238{
239 unsigned int freq;
240 bd_t *bip = (bd_t *)__res;
241
242 freq = bip->bi_intfreq;
243
244 decrementer_count = freq / HZ;
245 count_period_num = 1;
246 count_period_den = freq;
247
248 /* Enable the PIT and set auto-reload of its value */
249
250 mtspr(SPRN_TCR, TCR_PIE | TCR_ARE);
251
252 /* Clear any pending timer interrupts */
253
254 mtspr(SPRN_TSR, TSR_ENW | TSR_WIS | TSR_PIS | TSR_FIS);
255}
diff --git a/arch/ppc/platforms/4xx/oak.h b/arch/ppc/platforms/4xx/oak.h
new file mode 100644
index 000000000000..1b86a4c66b04
--- /dev/null
+++ b/arch/ppc/platforms/4xx/oak.h
@@ -0,0 +1,96 @@
1/*
2 *
3 * Copyright (c) 1999 Grant Erickson <grant@lcse.umn.edu>
4 *
5 * Module name: oak.h
6 *
7 * Description:
8 * Macros, definitions, and data structures specific to the IBM PowerPC
9 * 403G{A,B,C,CX} "Oak" evaluation board. Anything specific to the pro-
10 * cessor itself is defined elsewhere.
11 *
12 */
13
14#ifdef __KERNEL__
15#ifndef __ASM_OAK_H__
16#define __ASM_OAK_H__
17
18/* We have an IBM 403G{A,B,C,CX} core */
19#include <asm/ibm403.h>
20
21#define _IO_BASE 0
22#define _ISA_MEM_BASE 0
23#define PCI_DRAM_OFFSET 0
24
25/* Memory map for the "Oak" evaluation board */
26
27#define PPC403SPU_IO_BASE 0x40000000 /* 403 On-chip serial port */
28#define PPC403SPU_IO_SIZE 0x00000008
29#define OAKSERIAL_IO_BASE 0x7E000000 /* NS16550DV serial port */
30#define OAKSERIAL_IO_SIZE 0x00000008
31#define OAKNET_IO_BASE 0xF4000000 /* NS83902AV Ethernet */
32#define OAKNET_IO_SIZE 0x00000040
33#define OAKPROM_IO_BASE 0xFFFE0000 /* AMD 29F010 Flash ROM */
34#define OAKPROM_IO_SIZE 0x00020000
35
36
37/* Interrupt assignments fixed by the hardware implementation */
38
39/* This is annoying kbuild-2.4 problem. -- Tom */
40
41#define PPC403SPU_RX_INT 4 /* AIC_INT4 */
42#define PPC403SPU_TX_INT 5 /* AIC_INT5 */
43#define OAKNET_INT 27 /* AIC_INT27 */
44#define OAKSERIAL_INT 28 /* AIC_INT28 */
45
46#ifndef __ASSEMBLY__
47/*
48 * Data structure defining board information maintained by the boot
49 * ROM on IBM's "Oak" evaluation board. An effort has been made to
50 * keep the field names consistent with the 8xx 'bd_t' board info
51 * structures.
52 */
53
54typedef struct board_info {
55 unsigned char bi_s_version[4]; /* Version of this structure */
56 unsigned char bi_r_version[30]; /* Version of the IBM ROM */
57 unsigned int bi_memsize; /* DRAM installed, in bytes */
58 unsigned char bi_enetaddr[6]; /* Ethernet MAC address */
59 unsigned int bi_intfreq; /* Processor speed, in Hz */
60 unsigned int bi_busfreq; /* Bus speed, in Hz */
61} bd_t;
62
63#ifdef __cplusplus
64extern "C" {
65#endif
66
67extern void oak_init(unsigned long r3,
68 unsigned long ird_start,
69 unsigned long ird_end,
70 unsigned long cline_start,
71 unsigned long cline_end);
72extern void oak_setup_arch(void);
73extern int oak_setup_residual(char *buffer);
74extern void oak_init_IRQ(void);
75extern int oak_get_irq(struct pt_regs *regs);
76extern void oak_restart(char *cmd);
77extern void oak_power_off(void);
78extern void oak_halt(void);
79extern void oak_time_init(void);
80extern int oak_set_rtc_time(unsigned long now);
81extern unsigned long oak_get_rtc_time(void);
82extern void oak_calibrate_decr(void);
83
84#ifdef __cplusplus
85}
86#endif
87
88/* Some 4xx parts use a different timebase frequency from the internal clock.
89*/
90#define bi_tbfreq bi_intfreq
91
92#define PPC4xx_MACHINE_NAME "IBM Oak"
93
94#endif /* !__ASSEMBLY__ */
95#endif /* __ASM_OAK_H__ */
96#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/4xx/oak_setup.h b/arch/ppc/platforms/4xx/oak_setup.h
new file mode 100644
index 000000000000..8648bd084df8
--- /dev/null
+++ b/arch/ppc/platforms/4xx/oak_setup.h
@@ -0,0 +1,50 @@
1/*
2 *
3 * Copyright (c) 1999-2000 Grant Erickson <grant@lcse.umn.edu>
4 *
5 * Module name: oak_setup.h
6 *
7 * Description:
8 * Architecture- / platform-specific boot-time initialization code for
9 * the IBM PowerPC 403GCX "Oak" evaluation board. Adapted from original
10 * code by Gary Thomas, Cort Dougan <cort@cs.nmt.edu>, and Dan Malek
11 * <dan@netx4.com>.
12 *
13 */
14
15#ifndef __OAK_SETUP_H__
16#define __OAK_SETUP_H__
17
18#include <asm/ptrace.h>
19#include <asm/board.h>
20
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26extern unsigned char __res[sizeof(bd_t)];
27
28extern void oak_init(unsigned long r3,
29 unsigned long ird_start,
30 unsigned long ird_end,
31 unsigned long cline_start,
32 unsigned long cline_end);
33extern void oak_setup_arch(void);
34extern int oak_setup_residual(char *buffer);
35extern void oak_init_IRQ(void);
36extern int oak_get_irq(struct pt_regs *regs);
37extern void oak_restart(char *cmd);
38extern void oak_power_off(void);
39extern void oak_halt(void);
40extern void oak_time_init(void);
41extern int oak_set_rtc_time(unsigned long now);
42extern unsigned long oak_get_rtc_time(void);
43extern void oak_calibrate_decr(void);
44
45
46#ifdef __cplusplus
47}
48#endif
49
50#endif /* __OAK_SETUP_H__ */
diff --git a/arch/ppc/platforms/4xx/ocotea.c b/arch/ppc/platforms/4xx/ocotea.c
new file mode 100644
index 000000000000..28de707434f1
--- /dev/null
+++ b/arch/ppc/platforms/4xx/ocotea.c
@@ -0,0 +1,367 @@
1/*
2 * arch/ppc/platforms/4xx/ocotea.c
3 *
4 * Ocotea board specific routines
5 *
6 * Matt Porter <mporter@kernel.crashing.org>
7 *
8 * Copyright 2003-2005 MontaVista Software Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15
16#include <linux/config.h>
17#include <linux/stddef.h>
18#include <linux/kernel.h>
19#include <linux/init.h>
20#include <linux/errno.h>
21#include <linux/reboot.h>
22#include <linux/pci.h>
23#include <linux/kdev_t.h>
24#include <linux/types.h>
25#include <linux/major.h>
26#include <linux/blkdev.h>
27#include <linux/console.h>
28#include <linux/delay.h>
29#include <linux/ide.h>
30#include <linux/initrd.h>
31#include <linux/irq.h>
32#include <linux/seq_file.h>
33#include <linux/root_dev.h>
34#include <linux/tty.h>
35#include <linux/serial.h>
36#include <linux/serial_core.h>
37
38#include <asm/system.h>
39#include <asm/pgtable.h>
40#include <asm/page.h>
41#include <asm/dma.h>
42#include <asm/io.h>
43#include <asm/machdep.h>
44#include <asm/ocp.h>
45#include <asm/pci-bridge.h>
46#include <asm/time.h>
47#include <asm/todc.h>
48#include <asm/bootinfo.h>
49#include <asm/ppc4xx_pic.h>
50#include <asm/ppcboot.h>
51
52#include <syslib/gen550.h>
53#include <syslib/ibm440gx_common.h>
54
55/*
56 * This is a horrible kludge, we eventually need to abstract this
57 * generic PHY stuff, so the standard phy mode defines can be
58 * easily used from arch code.
59 */
60#include "../../../../drivers/net/ibm_emac/ibm_emac_phy.h"
61
62bd_t __res;
63
64static struct ibm44x_clocks clocks __initdata;
65
66static void __init
67ocotea_calibrate_decr(void)
68{
69 unsigned int freq;
70
71 if (mfspr(SPRN_CCR1) & CCR1_TCS)
72 freq = OCOTEA_TMR_CLK;
73 else
74 freq = clocks.cpu;
75
76 ibm44x_calibrate_decr(freq);
77}
78
79static int
80ocotea_show_cpuinfo(struct seq_file *m)
81{
82 seq_printf(m, "vendor\t\t: IBM\n");
83 seq_printf(m, "machine\t\t: PPC440GX EVB (Ocotea)\n");
84 ibm440gx_show_cpuinfo(m);
85 return 0;
86}
87
88static inline int
89ocotea_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
90{
91 static char pci_irq_table[][4] =
92 /*
93 * PCI IDSEL/INTPIN->INTLINE
94 * A B C D
95 */
96 {
97 { 23, 23, 23, 23 }, /* IDSEL 1 - PCI Slot 0 */
98 { 24, 24, 24, 24 }, /* IDSEL 2 - PCI Slot 1 */
99 { 25, 25, 25, 25 }, /* IDSEL 3 - PCI Slot 2 */
100 { 26, 26, 26, 26 }, /* IDSEL 4 - PCI Slot 3 */
101 };
102
103 const long min_idsel = 1, max_idsel = 4, irqs_per_slot = 4;
104 return PCI_IRQ_TABLE_LOOKUP;
105}
106
107static void __init ocotea_set_emacdata(void)
108{
109 struct ocp_def *def;
110 struct ocp_func_emac_data *emacdata;
111 int i;
112
113 /*
114 * Note: Current rev. board only operates in Group 4a
115 * mode, so we always set EMAC0-1 for SMII and EMAC2-3
116 * for RGMII (though these could run in RTBI just the same).
117 *
118 * The FPGA reg 3 information isn't even suitable for
119 * determining the phy_mode, so if the board becomes
120 * usable in !4a, it will be necessary to parse an environment
121 * variable from the firmware or similar to properly configure
122 * the phy_map/phy_mode.
123 */
124 /* Set phy_map, phy_mode, and mac_addr for each EMAC */
125 for (i=0; i<4; i++) {
126 def = ocp_get_one_device(OCP_VENDOR_IBM, OCP_FUNC_EMAC, i);
127 emacdata = def->additions;
128 if (i < 2) {
129 emacdata->phy_map = 0x00000001; /* Skip 0x00 */
130 emacdata->phy_mode = PHY_MODE_SMII;
131 }
132 else {
133 emacdata->phy_map = 0x0000ffff; /* Skip 0x00-0x0f */
134 emacdata->phy_mode = PHY_MODE_RGMII;
135 }
136 if (i == 0)
137 memcpy(emacdata->mac_addr, __res.bi_enetaddr, 6);
138 else if (i == 1)
139 memcpy(emacdata->mac_addr, __res.bi_enet1addr, 6);
140 else if (i == 2)
141 memcpy(emacdata->mac_addr, __res.bi_enet2addr, 6);
142 else if (i == 3)
143 memcpy(emacdata->mac_addr, __res.bi_enet3addr, 6);
144 }
145}
146
147#define PCIX_READW(offset) \
148 (readw(pcix_reg_base+offset))
149
150#define PCIX_WRITEW(value, offset) \
151 (writew(value, pcix_reg_base+offset))
152
153#define PCIX_WRITEL(value, offset) \
154 (writel(value, pcix_reg_base+offset))
155
156/*
157 * FIXME: This is only here to "make it work". This will move
158 * to a ibm_pcix.c which will contain a generic IBM PCIX bridge
159 * configuration library. -Matt
160 */
161static void __init
162ocotea_setup_pcix(void)
163{
164 void *pcix_reg_base;
165
166 pcix_reg_base = ioremap64(PCIX0_REG_BASE, PCIX_REG_SIZE);
167
168 /* Enable PCIX0 I/O, Mem, and Busmaster cycles */
169 PCIX_WRITEW(PCIX_READW(PCIX0_COMMAND) | PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER, PCIX0_COMMAND);
170
171 /* Disable all windows */
172 PCIX_WRITEL(0, PCIX0_POM0SA);
173 PCIX_WRITEL(0, PCIX0_POM1SA);
174 PCIX_WRITEL(0, PCIX0_POM2SA);
175 PCIX_WRITEL(0, PCIX0_PIM0SA);
176 PCIX_WRITEL(0, PCIX0_PIM0SAH);
177 PCIX_WRITEL(0, PCIX0_PIM1SA);
178 PCIX_WRITEL(0, PCIX0_PIM2SA);
179 PCIX_WRITEL(0, PCIX0_PIM2SAH);
180
181 /* Setup 2GB PLB->PCI outbound mem window (3_8000_0000->0_8000_0000) */
182 PCIX_WRITEL(0x00000003, PCIX0_POM0LAH);
183 PCIX_WRITEL(0x80000000, PCIX0_POM0LAL);
184 PCIX_WRITEL(0x00000000, PCIX0_POM0PCIAH);
185 PCIX_WRITEL(0x80000000, PCIX0_POM0PCIAL);
186 PCIX_WRITEL(0x80000001, PCIX0_POM0SA);
187
188 /* Setup 2GB PCI->PLB inbound memory window at 0, enable MSIs */
189 PCIX_WRITEL(0x00000000, PCIX0_PIM0LAH);
190 PCIX_WRITEL(0x00000000, PCIX0_PIM0LAL);
191 PCIX_WRITEL(0xe0000007, PCIX0_PIM0SA);
192
193 eieio();
194}
195
196static void __init
197ocotea_setup_hose(void)
198{
199 struct pci_controller *hose;
200
201 /* Configure windows on the PCI-X host bridge */
202 ocotea_setup_pcix();
203
204 hose = pcibios_alloc_controller();
205
206 if (!hose)
207 return;
208
209 hose->first_busno = 0;
210 hose->last_busno = 0xff;
211
212 hose->pci_mem_offset = OCOTEA_PCI_MEM_OFFSET;
213
214 pci_init_resource(&hose->io_resource,
215 OCOTEA_PCI_LOWER_IO,
216 OCOTEA_PCI_UPPER_IO,
217 IORESOURCE_IO,
218 "PCI host bridge");
219
220 pci_init_resource(&hose->mem_resources[0],
221 OCOTEA_PCI_LOWER_MEM,
222 OCOTEA_PCI_UPPER_MEM,
223 IORESOURCE_MEM,
224 "PCI host bridge");
225
226 hose->io_space.start = OCOTEA_PCI_LOWER_IO;
227 hose->io_space.end = OCOTEA_PCI_UPPER_IO;
228 hose->mem_space.start = OCOTEA_PCI_LOWER_MEM;
229 hose->mem_space.end = OCOTEA_PCI_UPPER_MEM;
230 isa_io_base =
231 (unsigned long)ioremap64(OCOTEA_PCI_IO_BASE, OCOTEA_PCI_IO_SIZE);
232 hose->io_base_virt = (void *)isa_io_base;
233
234 setup_indirect_pci(hose,
235 OCOTEA_PCI_CFGA_PLB32,
236 OCOTEA_PCI_CFGD_PLB32);
237 hose->set_cfg_type = 1;
238
239 hose->last_busno = pciauto_bus_scan(hose, hose->first_busno);
240
241 ppc_md.pci_swizzle = common_swizzle;
242 ppc_md.pci_map_irq = ocotea_map_irq;
243}
244
245
246TODC_ALLOC();
247
248static void __init
249ocotea_early_serial_map(void)
250{
251 struct uart_port port;
252
253 /* Setup ioremapped serial port access */
254 memset(&port, 0, sizeof(port));
255 port.membase = ioremap64(PPC440GX_UART0_ADDR, 8);
256 port.irq = UART0_INT;
257 port.uartclk = clocks.uart0;
258 port.regshift = 0;
259 port.iotype = SERIAL_IO_MEM;
260 port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST;
261 port.line = 0;
262
263 if (early_serial_setup(&port) != 0) {
264 printk("Early serial init of port 0 failed\n");
265 }
266
267#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
268 /* Configure debug serial access */
269 gen550_init(0, &port);
270#endif
271
272 port.membase = ioremap64(PPC440GX_UART1_ADDR, 8);
273 port.irq = UART1_INT;
274 port.uartclk = clocks.uart1;
275 port.line = 1;
276
277 if (early_serial_setup(&port) != 0) {
278 printk("Early serial init of port 1 failed\n");
279 }
280
281#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
282 /* Configure debug serial access */
283 gen550_init(1, &port);
284#endif
285}
286
287static void __init
288ocotea_setup_arch(void)
289{
290 ocotea_set_emacdata();
291
292 ibm440gx_tah_enable();
293
294 /* Setup TODC access */
295 TODC_INIT(TODC_TYPE_DS1743,
296 0,
297 0,
298 ioremap64(OCOTEA_RTC_ADDR, OCOTEA_RTC_SIZE),
299 8);
300
301 /* init to some ~sane value until calibrate_delay() runs */
302 loops_per_jiffy = 50000000/HZ;
303
304 /* Setup PCI host bridge */
305 ocotea_setup_hose();
306
307#ifdef CONFIG_BLK_DEV_INITRD
308 if (initrd_start)
309 ROOT_DEV = Root_RAM0;
310 else
311#endif
312#ifdef CONFIG_ROOT_NFS
313 ROOT_DEV = Root_NFS;
314#else
315 ROOT_DEV = Root_HDA1;
316#endif
317
318 ocotea_early_serial_map();
319
320 /* Identify the system */
321 printk("IBM Ocotea port (MontaVista Software, Inc. <source@mvista.com>)\n");
322}
323
324static void __init ocotea_init(void)
325{
326 ibm440gx_l2c_setup(&clocks);
327}
328
329void __init platform_init(unsigned long r3, unsigned long r4,
330 unsigned long r5, unsigned long r6, unsigned long r7)
331{
332 parse_bootinfo(find_bootinfo());
333
334 /*
335 * If we were passed in a board information, copy it into the
336 * residual data area.
337 */
338 if (r3)
339 __res = *(bd_t *)(r3 + KERNELBASE);
340
341 /*
342 * Determine various clocks.
343 * To be completely correct we should get SysClk
344 * from FPGA, because it can be changed by on-board switches
345 * --ebs
346 */
347 ibm440gx_get_clocks(&clocks, 33333333, 6 * 1843200);
348 ocp_sys_info.opb_bus_freq = clocks.opb;
349
350 ibm44x_platform_init();
351
352 ppc_md.setup_arch = ocotea_setup_arch;
353 ppc_md.show_cpuinfo = ocotea_show_cpuinfo;
354 ppc_md.get_irq = NULL; /* Set in ppc4xx_pic_init() */
355
356 ppc_md.calibrate_decr = ocotea_calibrate_decr;
357 ppc_md.time_init = todc_time_init;
358 ppc_md.set_rtc_time = todc_set_rtc_time;
359 ppc_md.get_rtc_time = todc_get_rtc_time;
360
361 ppc_md.nvram_read_val = todc_direct_read_val;
362 ppc_md.nvram_write_val = todc_direct_write_val;
363#ifdef CONFIG_KGDB
364 ppc_md.early_serial_map = ocotea_early_serial_map;
365#endif
366 ppc_md.init = ocotea_init;
367}
diff --git a/arch/ppc/platforms/4xx/ocotea.h b/arch/ppc/platforms/4xx/ocotea.h
new file mode 100644
index 000000000000..202dc8251190
--- /dev/null
+++ b/arch/ppc/platforms/4xx/ocotea.h
@@ -0,0 +1,88 @@
1/*
2 * arch/ppc/platforms/ocotea.h
3 *
4 * Ocotea board definitions
5 *
6 * Matt Porter <mporter@kernel.crashing.org>
7 *
8 * Copyright 2003-2005 MontaVista Software Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 */
16
17#ifdef __KERNEL__
18#ifndef __ASM_OCOTEA_H__
19#define __ASM_OCOTEA_H__
20
21#include <linux/config.h>
22#include <platforms/4xx/ibm440gx.h>
23
24/* F/W TLB mapping used in bootloader glue to reset EMAC */
25#define PPC44x_EMAC0_MR0 0xe0000800
26
27/* Location of MAC addresses in PIBS image */
28#define PIBS_FLASH_BASE 0xfff00000
29#define PIBS_MAC_BASE (PIBS_FLASH_BASE+0xb0500)
30#define PIBS_MAC_SIZE 0x200
31#define PIBS_MAC_OFFSET 0x100
32
33/* External timer clock frequency */
34#define OCOTEA_TMR_CLK 25000000
35
36/* RTC/NVRAM location */
37#define OCOTEA_RTC_ADDR 0x0000000148000000ULL
38#define OCOTEA_RTC_SIZE 0x2000
39
40/* Flash */
41#define OCOTEA_FPGA_REG_0 0x0000000148300000ULL
42#define OCOTEA_BOOT_LARGE_FLASH(x) (x & 0x40)
43#define OCOTEA_SMALL_FLASH_LOW 0x00000001ff900000ULL
44#define OCOTEA_SMALL_FLASH_HIGH 0x00000001fff00000ULL
45#define OCOTEA_SMALL_FLASH_SIZE 0x100000
46#define OCOTEA_LARGE_FLASH_LOW 0x00000001ff800000ULL
47#define OCOTEA_LARGE_FLASH_HIGH 0x00000001ffc00000ULL
48#define OCOTEA_LARGE_FLASH_SIZE 0x400000
49
50/* FPGA_REG_3 (Ethernet Groups) */
51#define OCOTEA_FPGA_REG_3 0x0000000148300003ULL
52
53/*
54 * Serial port defines
55 */
56#define RS_TABLE_SIZE 2
57
58/* OpenBIOS defined UART mappings, used before early_serial_setup */
59#define UART0_IO_BASE 0xE0000200
60#define UART1_IO_BASE 0xE0000300
61
62#define BASE_BAUD 11059200/16
63#define STD_UART_OP(num) \
64 { 0, BASE_BAUD, 0, UART##num##_INT, \
65 (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST), \
66 iomem_base: UART##num##_IO_BASE, \
67 io_type: SERIAL_IO_MEM},
68
69#define SERIAL_PORT_DFNS \
70 STD_UART_OP(0) \
71 STD_UART_OP(1)
72
73/* PCI support */
74#define OCOTEA_PCI_LOWER_IO 0x00000000
75#define OCOTEA_PCI_UPPER_IO 0x0000ffff
76#define OCOTEA_PCI_LOWER_MEM 0x80000000
77#define OCOTEA_PCI_UPPER_MEM 0xffffefff
78
79#define OCOTEA_PCI_CFGREGS_BASE 0x000000020ec00000ULL
80#define OCOTEA_PCI_CFGA_PLB32 0x0ec00000
81#define OCOTEA_PCI_CFGD_PLB32 0x0ec00004
82
83#define OCOTEA_PCI_IO_BASE 0x0000000208000000ULL
84#define OCOTEA_PCI_IO_SIZE 0x00010000
85#define OCOTEA_PCI_MEM_OFFSET 0x00000000
86
87#endif /* __ASM_OCOTEA_H__ */
88#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/4xx/redwood5.c b/arch/ppc/platforms/4xx/redwood5.c
new file mode 100644
index 000000000000..2f5e410afbc5
--- /dev/null
+++ b/arch/ppc/platforms/4xx/redwood5.c
@@ -0,0 +1,110 @@
1/*
2 * arch/ppc/platforms/4xx/redwood5.c
3 *
4 * Support for the IBM redwood5 eval board file
5 *
6 * Author: Armin Kuster <akuster@mvista.com>
7 *
8 * 2000-2001 (c) MontaVista, Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
11 * or implied.
12 */
13
14#include <linux/config.h>
15#include <linux/init.h>
16#include <linux/pagemap.h>
17#include <linux/device.h>
18#include <linux/ioport.h>
19#include <asm/io.h>
20#include <asm/machdep.h>
21
22static struct resource smc91x_resources[] = {
23 [0] = {
24 .start = SMC91111_BASE_ADDR,
25 .end = SMC91111_BASE_ADDR + SMC91111_REG_SIZE - 1,
26 .flags = IORESOURCE_MEM,
27 },
28 [1] = {
29 .start = SMC91111_IRQ,
30 .end = SMC91111_IRQ,
31 .flags = IORESOURCE_IRQ,
32 },
33};
34
35static struct platform_device smc91x_device = {
36 .name = "smc91x",
37 .id = 0,
38 .num_resources = ARRAY_SIZE(smc91x_resources),
39 .resource = smc91x_resources,
40};
41
42static struct platform_device *redwood5_devs[] __initdata = {
43 &smc91x_device,
44};
45
46static int __init
47redwood5_platform_add_devices(void)
48{
49 return platform_add_devices(redwood5_devs, ARRAY_SIZE(redwood5_devs));
50}
51
52void __init
53redwood5_setup_arch(void)
54{
55 ppc4xx_setup_arch();
56
57#ifdef CONFIG_DEBUG_BRINGUP
58 printk("\n");
59 printk("machine\t: %s\n", PPC4xx_MACHINE_NAME);
60 printk("\n");
61 printk("bi_s_version\t %s\n", bip->bi_s_version);
62 printk("bi_r_version\t %s\n", bip->bi_r_version);
63 printk("bi_memsize\t 0x%8.8x\t %dMBytes\n", bip->bi_memsize,bip->bi_memsize/(1024*1000));
64 printk("bi_enetaddr %d\t %2.2x%2.2x%2.2x-%2.2x%2.2x%2.2x\n", 0,
65 bip->bi_enetaddr[0], bip->bi_enetaddr[1],
66 bip->bi_enetaddr[2], bip->bi_enetaddr[3],
67 bip->bi_enetaddr[4], bip->bi_enetaddr[5]);
68
69 printk("bi_intfreq\t 0x%8.8x\t clock:\t %dMhz\n",
70 bip->bi_intfreq, bip->bi_intfreq/ 1000000);
71
72 printk("bi_busfreq\t 0x%8.8x\t plb bus clock:\t %dMHz\n",
73 bip->bi_busfreq, bip->bi_busfreq / 1000000 );
74 printk("bi_tbfreq\t 0x%8.8x\t TB freq:\t %dMHz\n",
75 bip->bi_tbfreq, bip->bi_tbfreq/1000000);
76
77 printk("\n");
78#endif
79 device_initcall(redwood5_platform_add_devices);
80}
81
82void __init
83redwood5_map_io(void)
84{
85 int i;
86
87 ppc4xx_map_io();
88 for (i = 0; i < 16; i++) {
89 unsigned long v, p;
90
91 /* 0x400x0000 -> 0xe00x0000 */
92 p = 0x40000000 | (i << 16);
93 v = STB04xxx_IO_BASE | (i << 16);
94
95 io_block_mapping(v, p, PAGE_SIZE,
96 _PAGE_NO_CACHE | pgprot_val(PAGE_KERNEL) | _PAGE_GUARDED);
97 }
98
99
100}
101
102void __init
103platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
104 unsigned long r6, unsigned long r7)
105{
106 ppc4xx_init(r3, r4, r5, r6, r7);
107
108 ppc_md.setup_arch = redwood5_setup_arch;
109 ppc_md.setup_io_mappings = redwood5_map_io;
110}
diff --git a/arch/ppc/platforms/4xx/redwood5.h b/arch/ppc/platforms/4xx/redwood5.h
new file mode 100644
index 000000000000..264e34fb3fbd
--- /dev/null
+++ b/arch/ppc/platforms/4xx/redwood5.h
@@ -0,0 +1,54 @@
1/*
2 * arch/ppc/platforms/4xx/redwood5.h
3 *
4 * Macros, definitions, and data structures specific to the IBM PowerPC
5 * STB03xxx "Redwood" evaluation board.
6 *
7 * Author: Armin Kuster <akuster@mvista.com>
8 *
9 * 2001 (c) MontaVista, Software, Inc. This file is licensed under
10 * the terms of the GNU General Public License version 2. This program
11 * is licensed "as is" without any warranty of any kind, whether express
12 * or implied.
13 */
14
15#ifdef __KERNEL__
16#ifndef __ASM_REDWOOD5_H__
17#define __ASM_REDWOOD5_H__
18
19/* Redwood5 has an STB04xxx core */
20#include <platforms/4xx/ibmstb4.h>
21
22#ifndef __ASSEMBLY__
23typedef struct board_info {
24 unsigned char bi_s_version[4]; /* Version of this structure */
25 unsigned char bi_r_version[30]; /* Version of the IBM ROM */
26 unsigned int bi_memsize; /* DRAM installed, in bytes */
27 unsigned int bi_dummy; /* field shouldn't exist */
28 unsigned char bi_enetaddr[6]; /* Ethernet MAC address */
29 unsigned int bi_intfreq; /* Processor speed, in Hz */
30 unsigned int bi_busfreq; /* Bus speed, in Hz */
31 unsigned int bi_tbfreq; /* Software timebase freq */
32} bd_t;
33#endif /* !__ASSEMBLY__ */
34
35
36#define SMC91111_BASE_ADDR 0xf2000300
37#define SMC91111_REG_SIZE 16
38#define SMC91111_IRQ 28
39
40#ifdef MAX_HWIFS
41#undef MAX_HWIFS
42#endif
43#define MAX_HWIFS 1
44
45#define _IO_BASE 0
46#define _ISA_MEM_BASE 0
47#define PCI_DRAM_OFFSET 0
48
49#define BASE_BAUD (378000000 / 18 / 16)
50
51#define PPC4xx_MACHINE_NAME "IBM Redwood5"
52
53#endif /* __ASM_REDWOOD5_H__ */
54#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/4xx/redwood6.c b/arch/ppc/platforms/4xx/redwood6.c
new file mode 100644
index 000000000000..8b1012994dfc
--- /dev/null
+++ b/arch/ppc/platforms/4xx/redwood6.c
@@ -0,0 +1,159 @@
1/*
2 * arch/ppc/platforms/4xx/redwood6.c
3 *
4 * Author: Armin Kuster <akuster@mvista.com>
5 *
6 * 2002 (c) MontaVista, Software, Inc. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10 */
11
12#include <linux/config.h>
13#include <linux/init.h>
14#include <linux/pagemap.h>
15#include <linux/device.h>
16#include <linux/ioport.h>
17#include <asm/io.h>
18#include <asm/ppc4xx_pic.h>
19#include <linux/delay.h>
20#include <asm/machdep.h>
21
22/*
23 * Define external IRQ senses and polarities.
24 */
25unsigned char ppc4xx_uic_ext_irq_cfg[] __initdata = {
26 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 7 */
27 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 8 */
28 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 9 */
29 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 0 */
30 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 1 */
31 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 2 */
32 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 3 */
33 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 4 */
34 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 5 */
35 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 6 */
36};
37
38static struct resource smc91x_resources[] = {
39 [0] = {
40 .start = SMC91111_BASE_ADDR,
41 .end = SMC91111_BASE_ADDR + SMC91111_REG_SIZE - 1,
42 .flags = IORESOURCE_MEM,
43 },
44 [1] = {
45 .start = SMC91111_IRQ,
46 .end = SMC91111_IRQ,
47 .flags = IORESOURCE_IRQ,
48 },
49};
50
51static struct platform_device smc91x_device = {
52 .name = "smc91x",
53 .id = 0,
54 .num_resources = ARRAY_SIZE(smc91x_resources),
55 .resource = smc91x_resources,
56};
57
58static struct platform_device *redwood6_devs[] __initdata = {
59 &smc91x_device,
60};
61
62static int __init
63redwood6_platform_add_devices(void)
64{
65 return platform_add_devices(redwood6_devs, ARRAY_SIZE(redwood6_devs));
66}
67
68
69void __init
70redwood6_setup_arch(void)
71{
72#ifdef CONFIG_IDE
73 void *xilinx, *xilinx_1, *xilinx_2;
74 unsigned short us_reg5;
75#endif
76
77 ppc4xx_setup_arch();
78
79#ifdef CONFIG_IDE
80 xilinx = (unsigned long) ioremap(IDE_XLINUX_MUX_BASE, 0x10);
81 /* init xilinx control registers - enable ide mux, clear reset bit */
82 if (!xilinx) {
83 printk(KERN_CRIT
84 "redwood6_setup_arch() xilinxi ioremap failed\n");
85 return;
86 }
87 xilinx_1 = xilinx + 0xa;
88 xilinx_2 = xilinx + 0xe;
89
90 us_reg5 = readb(xilinx_1);
91 writeb(0x01d1, xilinx_1);
92 writeb(0x0008, xilinx_2);
93
94 udelay(10 * 1000);
95
96 writeb(0x01d1, xilinx_1);
97 writeb(0x0008, xilinx_2);
98#endif
99
100#ifdef DEBUG_BRINGUP
101 bd_t *bip = (bd_t *) __res;
102 printk("\n");
103 printk("machine\t: %s\n", PPC4xx_MACHINE_NAME);
104 printk("\n");
105 printk("bi_s_version\t %s\n", bip->bi_s_version);
106 printk("bi_r_version\t %s\n", bip->bi_r_version);
107 printk("bi_memsize\t 0x%8.8x\t %dMBytes\n", bip->bi_memsize,
108 bip->bi_memsize / (1024 * 1000));
109 printk("bi_enetaddr %d\t %2.2x%2.2x%2.2x-%2.2x%2.2x%2.2x\n", 0,
110 bip->bi_enetaddr[0], bip->bi_enetaddr[1], bip->bi_enetaddr[2],
111 bip->bi_enetaddr[3], bip->bi_enetaddr[4], bip->bi_enetaddr[5]);
112
113 printk("bi_intfreq\t 0x%8.8x\t clock:\t %dMhz\n",
114 bip->bi_intfreq, bip->bi_intfreq / 1000000);
115
116 printk("bi_busfreq\t 0x%8.8x\t plb bus clock:\t %dMHz\n",
117 bip->bi_busfreq, bip->bi_busfreq / 1000000);
118 printk("bi_tbfreq\t 0x%8.8x\t TB freq:\t %dMHz\n",
119 bip->bi_tbfreq, bip->bi_tbfreq / 1000000);
120
121 printk("\n");
122#endif
123
124 /* Identify the system */
125 printk(KERN_INFO "IBM Redwood6 (STBx25XX) Platform\n");
126 printk(KERN_INFO
127 "Port by MontaVista Software, Inc. (source@mvista.com)\n");
128
129 device_initcall(redwood6_platform_add_devices);
130}
131
132void __init
133redwood6_map_io(void)
134{
135 int i;
136
137 ppc4xx_map_io();
138 for (i = 0; i < 16; i++) {
139 unsigned long v, p;
140
141 /* 0x400x0000 -> 0xe00x0000 */
142 p = 0x40000000 | (i << 16);
143 v = STBx25xx_IO_BASE | (i << 16);
144
145 io_block_mapping(v, p, PAGE_SIZE,
146 _PAGE_NO_CACHE | pgprot_val(PAGE_KERNEL) |
147 _PAGE_GUARDED);
148 }
149}
150
151void __init
152platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
153 unsigned long r6, unsigned long r7)
154{
155 ppc4xx_init(r3, r4, r5, r6, r7);
156
157 ppc_md.setup_arch = redwood6_setup_arch;
158 ppc_md.setup_io_mappings = redwood6_map_io;
159}
diff --git a/arch/ppc/platforms/4xx/redwood6.h b/arch/ppc/platforms/4xx/redwood6.h
new file mode 100644
index 000000000000..1814b9f5fc3a
--- /dev/null
+++ b/arch/ppc/platforms/4xx/redwood6.h
@@ -0,0 +1,55 @@
1/*
2 * arch/ppc/platforms/4xx/redwood6.h
3 *
4 * Macros, definitions, and data structures specific to the IBM PowerPC
5 * STBx25xx "Redwood6" evaluation board.
6 *
7 * Author: Armin Kuster <akuster@mvista.com>
8 *
9 * 2002 (c) MontaVista, Software, Inc. This file is licensed under
10 * the terms of the GNU General Public License version 2. This program
11 * is licensed "as is" without any warranty of any kind, whether express
12 * or implied.
13 */
14
15#ifdef __KERNEL__
16#ifndef __ASM_REDWOOD5_H__
17#define __ASM_REDWOOD5_H__
18
19/* Redwood6 has an STBx25xx core */
20#include <platforms/4xx/ibmstbx25.h>
21
22#ifndef __ASSEMBLY__
23typedef struct board_info {
24 unsigned char bi_s_version[4]; /* Version of this structure */
25 unsigned char bi_r_version[30]; /* Version of the IBM ROM */
26 unsigned int bi_memsize; /* DRAM installed, in bytes */
27 unsigned int bi_dummy; /* field shouldn't exist */
28 unsigned char bi_enetaddr[6]; /* Ethernet MAC address */
29 unsigned int bi_intfreq; /* Processor speed, in Hz */
30 unsigned int bi_busfreq; /* Bus speed, in Hz */
31 unsigned int bi_tbfreq; /* Software timebase freq */
32} bd_t;
33#endif /* !__ASSEMBLY__ */
34
35#define SMC91111_BASE_ADDR 0xf2030300
36#define SMC91111_REG_SIZE 16
37#define SMC91111_IRQ 27
38#define IDE_XLINUX_MUX_BASE 0xf2040000
39#define IDE_DMA_ADDR 0xfce00000
40
41#ifdef MAX_HWIFS
42#undef MAX_HWIFS
43#endif
44#define MAX_HWIFS 1
45
46#define _IO_BASE 0
47#define _ISA_MEM_BASE 0
48#define PCI_DRAM_OFFSET 0
49
50#define BASE_BAUD (378000000 / 18 / 16)
51
52#define PPC4xx_MACHINE_NAME "IBM Redwood6"
53
54#endif /* __ASM_REDWOOD5_H__ */
55#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/4xx/sycamore.c b/arch/ppc/platforms/4xx/sycamore.c
new file mode 100644
index 000000000000..d8019eec4704
--- /dev/null
+++ b/arch/ppc/platforms/4xx/sycamore.c
@@ -0,0 +1,278 @@
1/*
2 * arch/ppc/platforms/4xx/sycamore.c
3 *
4 * Architecture- / platform-specific boot-time initialization code for
5 * IBM PowerPC 4xx based boards.
6 *
7 * Author: Armin Kuster <akuster@mvista.com>
8 *
9 * 2000-2002 (c) MontaVista, Software, Inc. This file is licensed under
10 * the terms of the GNU General Public License version 2. This program
11 * is licensed "as is" without any warranty of any kind, whether express
12 * or implied.
13 */
14#include <linux/config.h>
15#include <linux/init.h>
16#include <linux/smp.h>
17#include <linux/threads.h>
18#include <linux/param.h>
19#include <linux/string.h>
20#include <linux/pci.h>
21#include <linux/rtc.h>
22
23#include <asm/ocp.h>
24#include <asm/ppc4xx_pic.h>
25#include <asm/system.h>
26#include <asm/pci-bridge.h>
27#include <asm/machdep.h>
28#include <asm/page.h>
29#include <asm/time.h>
30#include <asm/io.h>
31#include <asm/ibm_ocp_pci.h>
32#include <asm/todc.h>
33
34#undef DEBUG
35
36#ifdef DEBUG
37#define DBG(x...) printk(x)
38#else
39#define DBG(x...)
40#endif
41
42void *kb_cs;
43void *kb_data;
44void *sycamore_rtc_base;
45
46/*
47 * Define external IRQ senses and polarities.
48 */
49unsigned char ppc4xx_uic_ext_irq_cfg[] __initdata = {
50 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 7 */
51 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 8 */
52 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 9 */
53 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 10 */
54 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 11 */
55 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 12 */
56 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 0 */
57 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 1 */
58 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 2 */
59 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 3 */
60 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 4 */
61 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 5 */
62 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 6 */
63};
64
65
66/* Some IRQs unique to Sycamore.
67 * Used by the generic 405 PCI setup functions in ppc4xx_pci.c
68 */
69int __init
70ppc405_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
71{
72 static char pci_irq_table[][4] =
73 /*
74 * PCI IDSEL/INTPIN->INTLINE
75 * A B C D
76 */
77 {
78 {28, 28, 28, 28}, /* IDSEL 1 - PCI slot 1 */
79 {29, 29, 29, 29}, /* IDSEL 2 - PCI slot 2 */
80 {30, 30, 30, 30}, /* IDSEL 3 - PCI slot 3 */
81 {31, 31, 31, 31}, /* IDSEL 4 - PCI slot 4 */
82 };
83
84 const long min_idsel = 1, max_idsel = 4, irqs_per_slot = 4;
85 return PCI_IRQ_TABLE_LOOKUP;
86};
87
88void __init
89sycamore_setup_arch(void)
90{
91#define SYCAMORE_PS2_BASE 0xF0100000
92#define SYCAMORE_FPGA_BASE 0xF0300000
93
94 void *fpga_brdc;
95 unsigned char fpga_brdc_data;
96 void *fpga_enable;
97 void *fpga_polarity;
98 void *fpga_status;
99 void *fpga_trigger;
100
101 ppc4xx_setup_arch();
102
103 ibm_ocp_set_emac(0, 1);
104
105 kb_data = ioremap(SYCAMORE_PS2_BASE, 8);
106 if (!kb_data) {
107 printk(KERN_CRIT
108 "sycamore_setup_arch() kb_data ioremap failed\n");
109 return;
110 }
111
112 kb_cs = kb_data + 1;
113
114 fpga_status = ioremap(SYCAMORE_FPGA_BASE, 8);
115 if (!fpga_status) {
116 printk(KERN_CRIT
117 "sycamore_setup_arch() fpga_status ioremap failed\n");
118 return;
119 }
120
121 fpga_enable = fpga_status + 1;
122 fpga_polarity = fpga_status + 2;
123 fpga_trigger = fpga_status + 3;
124 fpga_brdc = fpga_status + 4;
125
126 /* split the keyboard and mouse interrupts */
127 fpga_brdc_data = readb(fpga_brdc);
128 fpga_brdc_data |= 0x80;
129 writeb(fpga_brdc_data, fpga_brdc);
130
131 writeb(0x3, fpga_enable);
132
133 writeb(0x3, fpga_polarity);
134
135 writeb(0x3, fpga_trigger);
136
137 /* RTC step for the sycamore */
138 sycamore_rtc_base = (void *) SYCAMORE_RTC_VADDR;
139 TODC_INIT(TODC_TYPE_DS1743, sycamore_rtc_base, sycamore_rtc_base,
140 sycamore_rtc_base, 8);
141
142 /* Identify the system */
143 printk(KERN_INFO "IBM Sycamore (IBM405GPr) Platform\n");
144 printk(KERN_INFO
145 "Port by MontaVista Software, Inc. (source@mvista.com)\n");
146}
147
148void __init
149bios_fixup(struct pci_controller *hose, struct pcil0_regs *pcip)
150{
151#ifdef CONFIG_PCI
152 unsigned int bar_response, bar;
153 /*
154 * Expected PCI mapping:
155 *
156 * PLB addr PCI memory addr
157 * --------------------- ---------------------
158 * 0000'0000 - 7fff'ffff <--- 0000'0000 - 7fff'ffff
159 * 8000'0000 - Bfff'ffff ---> 8000'0000 - Bfff'ffff
160 *
161 * PLB addr PCI io addr
162 * --------------------- ---------------------
163 * e800'0000 - e800'ffff ---> 0000'0000 - 0001'0000
164 *
165 * The following code is simplified by assuming that the bootrom
166 * has been well behaved in following this mapping.
167 */
168
169#ifdef DEBUG
170 int i;
171
172 printk("ioremap PCLIO_BASE = 0x%x\n", pcip);
173 printk("PCI bridge regs before fixup \n");
174 for (i = 0; i <= 3; i++) {
175 printk(" pmm%dma\t0x%x\n", i, in_le32(&(pcip->pmm[i].ma)));
176 printk(" pmm%dma\t0x%x\n", i, in_le32(&(pcip->pmm[i].la)));
177 printk(" pmm%dma\t0x%x\n", i, in_le32(&(pcip->pmm[i].pcila)));
178 printk(" pmm%dma\t0x%x\n", i, in_le32(&(pcip->pmm[i].pciha)));
179 }
180 printk(" ptm1ms\t0x%x\n", in_le32(&(pcip->ptm1ms)));
181 printk(" ptm1la\t0x%x\n", in_le32(&(pcip->ptm1la)));
182 printk(" ptm2ms\t0x%x\n", in_le32(&(pcip->ptm2ms)));
183 printk(" ptm2la\t0x%x\n", in_le32(&(pcip->ptm2la)));
184
185#endif
186
187 /* added for IBM boot rom version 1.15 bios bar changes -AK */
188
189 /* Disable region first */
190 out_le32((void *) &(pcip->pmm[0].ma), 0x00000000);
191 /* PLB starting addr, PCI: 0x80000000 */
192 out_le32((void *) &(pcip->pmm[0].la), 0x80000000);
193 /* PCI start addr, 0x80000000 */
194 out_le32((void *) &(pcip->pmm[0].pcila), PPC405_PCI_MEM_BASE);
195 /* 512MB range of PLB to PCI */
196 out_le32((void *) &(pcip->pmm[0].pciha), 0x00000000);
197 /* Enable no pre-fetch, enable region */
198 out_le32((void *) &(pcip->pmm[0].ma), ((0xffffffff -
199 (PPC405_PCI_UPPER_MEM -
200 PPC405_PCI_MEM_BASE)) | 0x01));
201
202 /* Enable inbound region one - 1GB size */
203 out_le32((void *) &(pcip->ptm1ms), 0xc0000001);
204
205 /* Disable outbound region one */
206 out_le32((void *) &(pcip->pmm[1].ma), 0x00000000);
207 out_le32((void *) &(pcip->pmm[1].la), 0x00000000);
208 out_le32((void *) &(pcip->pmm[1].pcila), 0x00000000);
209 out_le32((void *) &(pcip->pmm[1].pciha), 0x00000000);
210 out_le32((void *) &(pcip->pmm[1].ma), 0x00000000);
211
212 /* Disable inbound region two */
213 out_le32((void *) &(pcip->ptm2ms), 0x00000000);
214
215 /* Disable outbound region two */
216 out_le32((void *) &(pcip->pmm[2].ma), 0x00000000);
217 out_le32((void *) &(pcip->pmm[2].la), 0x00000000);
218 out_le32((void *) &(pcip->pmm[2].pcila), 0x00000000);
219 out_le32((void *) &(pcip->pmm[2].pciha), 0x00000000);
220 out_le32((void *) &(pcip->pmm[2].ma), 0x00000000);
221
222 /* Zero config bars */
223 for (bar = PCI_BASE_ADDRESS_1; bar <= PCI_BASE_ADDRESS_2; bar += 4) {
224 early_write_config_dword(hose, hose->first_busno,
225 PCI_FUNC(hose->first_busno), bar,
226 0x00000000);
227 early_read_config_dword(hose, hose->first_busno,
228 PCI_FUNC(hose->first_busno), bar,
229 &bar_response);
230 DBG("BUS %d, device %d, Function %d bar 0x%8.8x is 0x%8.8x\n",
231 hose->first_busno, PCI_SLOT(hose->first_busno),
232 PCI_FUNC(hose->first_busno), bar, bar_response);
233 }
234 /* end work arround */
235
236#ifdef DEBUG
237 printk("PCI bridge regs after fixup \n");
238 for (i = 0; i <= 3; i++) {
239 printk(" pmm%dma\t0x%x\n", i, in_le32(&(pcip->pmm[i].ma)));
240 printk(" pmm%dma\t0x%x\n", i, in_le32(&(pcip->pmm[i].la)));
241 printk(" pmm%dma\t0x%x\n", i, in_le32(&(pcip->pmm[i].pcila)));
242 printk(" pmm%dma\t0x%x\n", i, in_le32(&(pcip->pmm[i].pciha)));
243 }
244 printk(" ptm1ms\t0x%x\n", in_le32(&(pcip->ptm1ms)));
245 printk(" ptm1la\t0x%x\n", in_le32(&(pcip->ptm1la)));
246 printk(" ptm2ms\t0x%x\n", in_le32(&(pcip->ptm2ms)));
247 printk(" ptm2la\t0x%x\n", in_le32(&(pcip->ptm2la)));
248
249#endif
250#endif
251
252}
253
254void __init
255sycamore_map_io(void)
256{
257 ppc4xx_map_io();
258 io_block_mapping(SYCAMORE_RTC_VADDR,
259 SYCAMORE_RTC_PADDR, SYCAMORE_RTC_SIZE, _PAGE_IO);
260}
261
262void __init
263platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
264 unsigned long r6, unsigned long r7)
265{
266 ppc4xx_init(r3, r4, r5, r6, r7);
267
268 ppc_md.setup_arch = sycamore_setup_arch;
269 ppc_md.setup_io_mappings = sycamore_map_io;
270
271#ifdef CONFIG_GEN_RTC
272 ppc_md.time_init = todc_time_init;
273 ppc_md.set_rtc_time = todc_set_rtc_time;
274 ppc_md.get_rtc_time = todc_get_rtc_time;
275 ppc_md.nvram_read_val = todc_direct_read_val;
276 ppc_md.nvram_write_val = todc_direct_write_val;
277#endif
278}
diff --git a/arch/ppc/platforms/4xx/sycamore.h b/arch/ppc/platforms/4xx/sycamore.h
new file mode 100644
index 000000000000..3e7b4e2c8c57
--- /dev/null
+++ b/arch/ppc/platforms/4xx/sycamore.h
@@ -0,0 +1,67 @@
1/*
2 * arch/ppc/platforms/4xx/sycamore.h
3 *
4 * Macros, definitions, and data structures specific to the IBM PowerPC
5 * 405GPr "Sycamore" evaluation board.
6 *
7 * Author: Armin Kuster <akuster@mvista.com>
8 *
9 * 2000 (c) MontaVista, Software, Inc. This file is licensed under
10 * the terms of the GNU General Public License version 2. This program
11 * is licensed "as is" without any warranty of any kind, whether express
12 * or implied.
13 */
14
15#ifdef __KERNEL__
16#ifndef __ASM_SYCAMORE_H__
17#define __ASM_SYCAMORE_H__
18
19#include <platforms/4xx/ibm405gpr.h>
20
21#ifndef __ASSEMBLY__
22/*
23 * Data structure defining board information maintained by the boot
24 * ROM on IBM's "Sycamore" evaluation board. An effort has been made to
25 * keep the field names consistent with the 8xx 'bd_t' board info
26 * structures.
27 */
28
29typedef struct board_info {
30 unsigned char bi_s_version[4]; /* Version of this structure */
31 unsigned char bi_r_version[30]; /* Version of the IBM ROM */
32 unsigned int bi_memsize; /* DRAM installed, in bytes */
33 unsigned char bi_enetaddr[6]; /* Local Ethernet MAC address */
34 unsigned char bi_pci_enetaddr[6]; /* PCI Ethernet MAC address */
35 unsigned int bi_intfreq; /* Processor speed, in Hz */
36 unsigned int bi_busfreq; /* PLB Bus speed, in Hz */
37 unsigned int bi_pci_busfreq; /* PCI Bus speed, in Hz */
38} bd_t;
39
40/* Some 4xx parts use a different timebase frequency from the internal clock.
41*/
42#define bi_tbfreq bi_intfreq
43
44
45/* Memory map for the IBM "Sycamore" 405GP evaluation board.
46 * Generic 4xx plus RTC.
47 */
48
49extern void *sycamore_rtc_base;
50#define SYCAMORE_RTC_PADDR ((uint)0xf0000000)
51#define SYCAMORE_RTC_VADDR SYCAMORE_RTC_PADDR
52#define SYCAMORE_RTC_SIZE ((uint)8*1024)
53
54#ifdef CONFIG_PPC405GP_INTERNAL_CLOCK
55#define BASE_BAUD 201600
56#else
57#define BASE_BAUD 691200
58#endif
59
60#define SYCAMORE_PS2_BASE 0xF0100000
61#define SYCAMORE_FPGA_BASE 0xF0300000
62
63#define PPC4xx_MACHINE_NAME "IBM Sycamore"
64
65#endif /* !__ASSEMBLY__ */
66#endif /* __ASM_SYCAMORE_H__ */
67#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/4xx/virtex-ii_pro.c b/arch/ppc/platforms/4xx/virtex-ii_pro.c
new file mode 100644
index 000000000000..097cc9d5aca0
--- /dev/null
+++ b/arch/ppc/platforms/4xx/virtex-ii_pro.c
@@ -0,0 +1,60 @@
1/*
2 * arch/ppc/platforms/4xx/virtex-ii_pro.c
3 *
4 * Author: MontaVista Software, Inc.
5 * source@mvista.com
6 *
7 * 2002-2004 (c) MontaVista Software, Inc. This file is licensed under the
8 * terms of the GNU General Public License version 2. This program is licensed
9 * "as is" without any warranty of any kind, whether express or implied.
10 */
11
12#include <linux/config.h>
13#include <linux/init.h>
14#include <asm/ocp.h>
15#include "virtex-ii_pro.h"
16
17/* Have OCP take care of the serial ports. */
18struct ocp_def core_ocp[] = {
19#ifdef XPAR_UARTNS550_0_BASEADDR
20 { .vendor = OCP_VENDOR_XILINX,
21 .function = OCP_FUNC_16550,
22 .index = 0,
23 .paddr = XPAR_UARTNS550_0_BASEADDR,
24 .irq = XPAR_INTC_0_UARTNS550_0_VEC_ID,
25 .pm = OCP_CPM_NA
26 },
27#ifdef XPAR_UARTNS550_1_BASEADDR
28 { .vendor = OCP_VENDOR_XILINX,
29 .function = OCP_FUNC_16550,
30 .index = 1,
31 .paddr = XPAR_UARTNS550_1_BASEADDR,
32 .irq = XPAR_INTC_0_UARTNS550_1_VEC_ID,
33 .pm = OCP_CPM_NA
34 },
35#ifdef XPAR_UARTNS550_2_BASEADDR
36 { .vendor = OCP_VENDOR_XILINX,
37 .function = OCP_FUNC_16550,
38 .index = 2,
39 .paddr = XPAR_UARTNS550_2_BASEADDR,
40 .irq = XPAR_INTC_0_UARTNS550_2_VEC_ID,
41 .pm = OCP_CPM_NA
42 },
43#ifdef XPAR_UARTNS550_3_BASEADDR
44 { .vendor = OCP_VENDOR_XILINX,
45 .function = OCP_FUNC_16550,
46 .index = 3,
47 .paddr = XPAR_UARTNS550_3_BASEADDR,
48 .irq = XPAR_INTC_0_UARTNS550_3_VEC_ID,
49 .pm = OCP_CPM_NA
50 },
51#ifdef XPAR_UARTNS550_4_BASEADDR
52#error Edit this file to add more devices.
53#endif /* 4 */
54#endif /* 3 */
55#endif /* 2 */
56#endif /* 1 */
57#endif /* 0 */
58 { .vendor = OCP_VENDOR_INVALID
59 }
60};
diff --git a/arch/ppc/platforms/4xx/virtex-ii_pro.h b/arch/ppc/platforms/4xx/virtex-ii_pro.h
new file mode 100644
index 000000000000..9014c4887339
--- /dev/null
+++ b/arch/ppc/platforms/4xx/virtex-ii_pro.h
@@ -0,0 +1,99 @@
1/*
2 * arch/ppc/platforms/4xx/virtex-ii_pro.h
3 *
4 * Include file that defines the Xilinx Virtex-II Pro processor
5 *
6 * Author: MontaVista Software, Inc.
7 * source@mvista.com
8 *
9 * 2002-2004 (c) MontaVista Software, Inc. This file is licensed under the
10 * terms of the GNU General Public License version 2. This program is licensed
11 * "as is" without any warranty of any kind, whether express or implied.
12 */
13
14#ifdef __KERNEL__
15#ifndef __ASM_VIRTEXIIPRO_H__
16#define __ASM_VIRTEXIIPRO_H__
17
18#include <linux/config.h>
19#include <asm/xparameters.h>
20
21/* serial defines */
22
23#define RS_TABLE_SIZE 4 /* change this and add more devices below
24 if you have more then 4 16x50 UARTs */
25
26#define BASE_BAUD (XPAR_UARTNS550_0_CLOCK_FREQ_HZ/16)
27
28/* The serial ports in the Virtex-II Pro have each I/O byte in the
29 * LSByte of a word. This means that iomem_reg_shift needs to be 2 to
30 * change the byte offsets into word offsets. In addition the base
31 * addresses need to have 3 added to them to get to the LSByte.
32 */
33#define STD_UART_OP(num) \
34 { 0, BASE_BAUD, 0, XPAR_INTC_0_UARTNS550_##num##_VEC_ID, \
35 ASYNC_BOOT_AUTOCONF, \
36 .iomem_base = (u8 *)XPAR_UARTNS550_##num##_BASEADDR + 3, \
37 .iomem_reg_shift = 2, \
38 .io_type = SERIAL_IO_MEM},
39
40#if defined(XPAR_INTC_0_UARTNS550_0_VEC_ID)
41#define ML300_UART0 STD_UART_OP(0)
42#else
43#define ML300_UART0
44#endif
45
46#if defined(XPAR_INTC_0_UARTNS550_1_VEC_ID)
47#define ML300_UART1 STD_UART_OP(1)
48#else
49#define ML300_UART1
50#endif
51
52#if defined(XPAR_INTC_0_UARTNS550_2_VEC_ID)
53#define ML300_UART2 STD_UART_OP(2)
54#else
55#define ML300_UART2
56#endif
57
58#if defined(XPAR_INTC_0_UARTNS550_3_VEC_ID)
59#define ML300_UART3 STD_UART_OP(3)
60#else
61#define ML300_UART3
62#endif
63
64#if defined(XPAR_INTC_0_UARTNS550_4_VEC_ID)
65#error Edit this file to add more devices.
66#elif defined(XPAR_INTC_0_UARTNS550_3_VEC_ID)
67#define NR_SER_PORTS 4
68#elif defined(XPAR_INTC_0_UARTNS550_2_VEC_ID)
69#define NR_SER_PORTS 3
70#elif defined(XPAR_INTC_0_UARTNS550_1_VEC_ID)
71#define NR_SER_PORTS 2
72#elif defined(XPAR_INTC_0_UARTNS550_0_VEC_ID)
73#define NR_SER_PORTS 1
74#else
75#define NR_SER_PORTS 0
76#endif
77
78#if defined(CONFIG_UART0_TTYS0)
79#define SERIAL_PORT_DFNS \
80 ML300_UART0 \
81 ML300_UART1 \
82 ML300_UART2 \
83 ML300_UART3
84#endif
85
86#if defined(CONFIG_UART0_TTYS1)
87#define SERIAL_PORT_DFNS \
88 ML300_UART1 \
89 ML300_UART0 \
90 ML300_UART2 \
91 ML300_UART3
92#endif
93
94#define DCRN_CPMFR_BASE 0
95
96#include <asm/ibm405.h>
97
98#endif /* __ASM_VIRTEXIIPRO_H__ */
99#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/4xx/walnut.c b/arch/ppc/platforms/4xx/walnut.c
new file mode 100644
index 000000000000..a33eda4b7489
--- /dev/null
+++ b/arch/ppc/platforms/4xx/walnut.c
@@ -0,0 +1,249 @@
1/*
2 * arch/ppc/platforms/4xx/walnut.c
3 *
4 * Architecture- / platform-specific boot-time initialization code for
5 * IBM PowerPC 4xx based boards. Adapted from original
6 * code by Gary Thomas, Cort Dougan <cort@fsmlabs.com>, and Dan Malek
7 * <dan@net4x.com>.
8 *
9 * Copyright(c) 1999-2000 Grant Erickson <grant@lcse.umn.edu>
10 *
11 * 2002 (c) MontaVista, Software, Inc. This file is licensed under
12 * the terms of the GNU General Public License version 2. This program
13 * is licensed "as is" without any warranty of any kind, whether express
14 * or implied.
15 */
16#include <linux/config.h>
17#include <linux/init.h>
18#include <linux/smp.h>
19#include <linux/threads.h>
20#include <linux/param.h>
21#include <linux/string.h>
22#include <linux/pci.h>
23#include <linux/rtc.h>
24
25#include <asm/system.h>
26#include <asm/pci-bridge.h>
27#include <asm/machdep.h>
28#include <asm/page.h>
29#include <asm/time.h>
30#include <asm/io.h>
31#include <asm/ocp.h>
32#include <asm/ibm_ocp_pci.h>
33#include <asm/todc.h>
34
35#undef DEBUG
36
37#ifdef DEBUG
38#define DBG(x...) printk(x)
39#else
40#define DBG(x...)
41#endif
42
43void *kb_cs;
44void *kb_data;
45void *walnut_rtc_base;
46
47/* Some IRQs unique to Walnut.
48 * Used by the generic 405 PCI setup functions in ppc4xx_pci.c
49 */
50int __init
51ppc405_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
52{
53 static char pci_irq_table[][4] =
54 /*
55 * PCI IDSEL/INTPIN->INTLINE
56 * A B C D
57 */
58 {
59 {28, 28, 28, 28}, /* IDSEL 1 - PCI slot 1 */
60 {29, 29, 29, 29}, /* IDSEL 2 - PCI slot 2 */
61 {30, 30, 30, 30}, /* IDSEL 3 - PCI slot 3 */
62 {31, 31, 31, 31}, /* IDSEL 4 - PCI slot 4 */
63 };
64
65 const long min_idsel = 1, max_idsel = 4, irqs_per_slot = 4;
66 return PCI_IRQ_TABLE_LOOKUP;
67};
68
69void __init
70walnut_setup_arch(void)
71{
72
73 void *fpga_brdc;
74 unsigned char fpga_brdc_data;
75 void *fpga_enable;
76 void *fpga_polarity;
77 void *fpga_status;
78 void *fpga_trigger;
79
80 ppc4xx_setup_arch();
81
82 ibm_ocp_set_emac(0, 0);
83
84 kb_data = ioremap(WALNUT_PS2_BASE, 8);
85 if (!kb_data) {
86 printk(KERN_CRIT
87 "walnut_setup_arch() kb_data ioremap failed\n");
88 return;
89 }
90
91 kb_cs = kb_data + 1;
92
93 fpga_status = ioremap(WALNUT_FPGA_BASE, 8);
94 if (!fpga_status) {
95 printk(KERN_CRIT
96 "walnut_setup_arch() fpga_status ioremap failed\n");
97 return;
98 }
99
100 fpga_enable = fpga_status + 1;
101 fpga_polarity = fpga_status + 2;
102 fpga_trigger = fpga_status + 3;
103 fpga_brdc = fpga_status + 4;
104
105 /* split the keyboard and mouse interrupts */
106 fpga_brdc_data = readb(fpga_brdc);
107 fpga_brdc_data |= 0x80;
108 writeb(fpga_brdc_data, fpga_brdc);
109
110 writeb(0x3, fpga_enable);
111
112 writeb(0x3, fpga_polarity);
113
114 writeb(0x3, fpga_trigger);
115
116 /* RTC step for the walnut */
117 walnut_rtc_base = (void *) WALNUT_RTC_VADDR;
118 TODC_INIT(TODC_TYPE_DS1743, walnut_rtc_base, walnut_rtc_base,
119 walnut_rtc_base, 8);
120 /* Identify the system */
121 printk("IBM Walnut port (C) 2000-2002 MontaVista Software, Inc. (source@mvista.com)\n");
122}
123
124void __init
125bios_fixup(struct pci_controller *hose, struct pcil0_regs *pcip)
126{
127#ifdef CONFIG_PCI
128 unsigned int bar_response, bar;
129 /*
130 * Expected PCI mapping:
131 *
132 * PLB addr PCI memory addr
133 * --------------------- ---------------------
134 * 0000'0000 - 7fff'ffff <--- 0000'0000 - 7fff'ffff
135 * 8000'0000 - Bfff'ffff ---> 8000'0000 - Bfff'ffff
136 *
137 * PLB addr PCI io addr
138 * --------------------- ---------------------
139 * e800'0000 - e800'ffff ---> 0000'0000 - 0001'0000
140 *
141 * The following code is simplified by assuming that the bootrom
142 * has been well behaved in following this mapping.
143 */
144
145#ifdef DEBUG
146 int i;
147
148 printk("ioremap PCLIO_BASE = 0x%x\n", pcip);
149 printk("PCI bridge regs before fixup \n");
150 for (i = 0; i <= 3; i++) {
151 printk(" pmm%dma\t0x%x\n", i, in_le32(&(pcip->pmm[i].ma)));
152 printk(" pmm%dma\t0x%x\n", i, in_le32(&(pcip->pmm[i].la)));
153 printk(" pmm%dma\t0x%x\n", i, in_le32(&(pcip->pmm[i].pcila)));
154 printk(" pmm%dma\t0x%x\n", i, in_le32(&(pcip->pmm[i].pciha)));
155 }
156 printk(" ptm1ms\t0x%x\n", in_le32(&(pcip->ptm1ms)));
157 printk(" ptm1la\t0x%x\n", in_le32(&(pcip->ptm1la)));
158 printk(" ptm2ms\t0x%x\n", in_le32(&(pcip->ptm2ms)));
159 printk(" ptm2la\t0x%x\n", in_le32(&(pcip->ptm2la)));
160
161#endif
162
163 /* added for IBM boot rom version 1.15 bios bar changes -AK */
164
165 /* Disable region first */
166 out_le32((void *) &(pcip->pmm[0].ma), 0x00000000);
167 /* PLB starting addr, PCI: 0x80000000 */
168 out_le32((void *) &(pcip->pmm[0].la), 0x80000000);
169 /* PCI start addr, 0x80000000 */
170 out_le32((void *) &(pcip->pmm[0].pcila), PPC405_PCI_MEM_BASE);
171 /* 512MB range of PLB to PCI */
172 out_le32((void *) &(pcip->pmm[0].pciha), 0x00000000);
173 /* Enable no pre-fetch, enable region */
174 out_le32((void *) &(pcip->pmm[0].ma), ((0xffffffff -
175 (PPC405_PCI_UPPER_MEM -
176 PPC405_PCI_MEM_BASE)) | 0x01));
177
178 /* Disable region one */
179 out_le32((void *) &(pcip->pmm[1].ma), 0x00000000);
180 out_le32((void *) &(pcip->pmm[1].la), 0x00000000);
181 out_le32((void *) &(pcip->pmm[1].pcila), 0x00000000);
182 out_le32((void *) &(pcip->pmm[1].pciha), 0x00000000);
183 out_le32((void *) &(pcip->pmm[1].ma), 0x00000000);
184 out_le32((void *) &(pcip->ptm1ms), 0x00000000);
185
186 /* Disable region two */
187 out_le32((void *) &(pcip->pmm[2].ma), 0x00000000);
188 out_le32((void *) &(pcip->pmm[2].la), 0x00000000);
189 out_le32((void *) &(pcip->pmm[2].pcila), 0x00000000);
190 out_le32((void *) &(pcip->pmm[2].pciha), 0x00000000);
191 out_le32((void *) &(pcip->pmm[2].ma), 0x00000000);
192 out_le32((void *) &(pcip->ptm2ms), 0x00000000);
193
194 /* Zero config bars */
195 for (bar = PCI_BASE_ADDRESS_1; bar <= PCI_BASE_ADDRESS_2; bar += 4) {
196 early_write_config_dword(hose, hose->first_busno,
197 PCI_FUNC(hose->first_busno), bar,
198 0x00000000);
199 early_read_config_dword(hose, hose->first_busno,
200 PCI_FUNC(hose->first_busno), bar,
201 &bar_response);
202 DBG("BUS %d, device %d, Function %d bar 0x%8.8x is 0x%8.8x\n",
203 hose->first_busno, PCI_SLOT(hose->first_busno),
204 PCI_FUNC(hose->first_busno), bar, bar_response);
205 }
206 /* end work arround */
207
208#ifdef DEBUG
209 printk("PCI bridge regs after fixup \n");
210 for (i = 0; i <= 3; i++) {
211 printk(" pmm%dma\t0x%x\n", i, in_le32(&(pcip->pmm[i].ma)));
212 printk(" pmm%dma\t0x%x\n", i, in_le32(&(pcip->pmm[i].la)));
213 printk(" pmm%dma\t0x%x\n", i, in_le32(&(pcip->pmm[i].pcila)));
214 printk(" pmm%dma\t0x%x\n", i, in_le32(&(pcip->pmm[i].pciha)));
215 }
216 printk(" ptm1ms\t0x%x\n", in_le32(&(pcip->ptm1ms)));
217 printk(" ptm1la\t0x%x\n", in_le32(&(pcip->ptm1la)));
218 printk(" ptm2ms\t0x%x\n", in_le32(&(pcip->ptm2ms)));
219 printk(" ptm2la\t0x%x\n", in_le32(&(pcip->ptm2la)));
220
221#endif
222#endif
223}
224
225void __init
226walnut_map_io(void)
227{
228 ppc4xx_map_io();
229 io_block_mapping(WALNUT_RTC_VADDR,
230 WALNUT_RTC_PADDR, WALNUT_RTC_SIZE, _PAGE_IO);
231}
232
233void __init
234platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
235 unsigned long r6, unsigned long r7)
236{
237 ppc4xx_init(r3, r4, r5, r6, r7);
238
239 ppc_md.setup_arch = walnut_setup_arch;
240 ppc_md.setup_io_mappings = walnut_map_io;
241
242#ifdef CONFIG_GEN_RTC
243 ppc_md.time_init = todc_time_init;
244 ppc_md.set_rtc_time = todc_set_rtc_time;
245 ppc_md.get_rtc_time = todc_get_rtc_time;
246 ppc_md.nvram_read_val = todc_direct_read_val;
247 ppc_md.nvram_write_val = todc_direct_write_val;
248#endif
249}
diff --git a/arch/ppc/platforms/4xx/walnut.h b/arch/ppc/platforms/4xx/walnut.h
new file mode 100644
index 000000000000..04cfbf3696b9
--- /dev/null
+++ b/arch/ppc/platforms/4xx/walnut.h
@@ -0,0 +1,72 @@
1/*
2 * arch/ppc/platforms/4xx/walnut.h
3 *
4 * Macros, definitions, and data structures specific to the IBM PowerPC
5 * 405GP "Walnut" evaluation board.
6 *
7 * Authors: Grant Erickson <grant@lcse.umn.edu>, Frank Rowand
8 * <frank_rowand@mvista.com>, Debbie Chu <debbie_chu@mvista.com> or
9 * source@mvista.com
10 *
11 * Copyright (c) 1999 Grant Erickson <grant@lcse.umn.edu>
12 *
13 * 2000 (c) MontaVista, Software, Inc. This file is licensed under
14 * the terms of the GNU General Public License version 2. This program
15 * is licensed "as is" without any warranty of any kind, whether express
16 * or implied.
17 */
18
19#ifdef __KERNEL__
20#ifndef __ASM_WALNUT_H__
21#define __ASM_WALNUT_H__
22
23/* We have a 405GP core */
24#include <platforms/4xx/ibm405gp.h>
25
26#ifndef __ASSEMBLY__
27/*
28 * Data structure defining board information maintained by the boot
29 * ROM on IBM's "Walnut" evaluation board. An effort has been made to
30 * keep the field names consistent with the 8xx 'bd_t' board info
31 * structures.
32 */
33
34typedef struct board_info {
35 unsigned char bi_s_version[4]; /* Version of this structure */
36 unsigned char bi_r_version[30]; /* Version of the IBM ROM */
37 unsigned int bi_memsize; /* DRAM installed, in bytes */
38 unsigned char bi_enetaddr[6]; /* Local Ethernet MAC address */
39 unsigned char bi_pci_enetaddr[6]; /* PCI Ethernet MAC address */
40 unsigned int bi_intfreq; /* Processor speed, in Hz */
41 unsigned int bi_busfreq; /* PLB Bus speed, in Hz */
42 unsigned int bi_pci_busfreq; /* PCI Bus speed, in Hz */
43} bd_t;
44
45/* Some 4xx parts use a different timebase frequency from the internal clock.
46*/
47#define bi_tbfreq bi_intfreq
48
49
50/* Memory map for the IBM "Walnut" 405GP evaluation board.
51 * Generic 4xx plus RTC.
52 */
53
54extern void *walnut_rtc_base;
55#define WALNUT_RTC_PADDR ((uint)0xf0000000)
56#define WALNUT_RTC_VADDR WALNUT_RTC_PADDR
57#define WALNUT_RTC_SIZE ((uint)8*1024)
58
59#ifdef CONFIG_PPC405GP_INTERNAL_CLOCK
60#define BASE_BAUD 201600
61#else
62#define BASE_BAUD 691200
63#endif
64
65#define WALNUT_PS2_BASE 0xF0100000
66#define WALNUT_FPGA_BASE 0xF0300000
67
68#define PPC4xx_MACHINE_NAME "IBM Walnut"
69
70#endif /* !__ASSEMBLY__ */
71#endif /* __ASM_WALNUT_H__ */
72#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/4xx/xilinx_ml300.c b/arch/ppc/platforms/4xx/xilinx_ml300.c
new file mode 100644
index 000000000000..0b1b77d986bf
--- /dev/null
+++ b/arch/ppc/platforms/4xx/xilinx_ml300.c
@@ -0,0 +1,146 @@
1/*
2 * arch/ppc/platforms/4xx/xilinx_ml300.c
3 *
4 * Xilinx ML300 evaluation board initialization
5 *
6 * Author: MontaVista Software, Inc.
7 * source@mvista.com
8 *
9 * 2002-2004 (c) MontaVista Software, Inc. This file is licensed under the
10 * terms of the GNU General Public License version 2. This program is licensed
11 * "as is" without any warranty of any kind, whether express or implied.
12 */
13
14#include <linux/config.h>
15#include <linux/init.h>
16#include <linux/irq.h>
17#include <linux/tty.h>
18#include <linux/serial.h>
19#include <linux/serial_core.h>
20#include <linux/serialP.h>
21#include <asm/io.h>
22#include <asm/machdep.h>
23#include <asm/ocp.h>
24
25#include <platforms/4xx/virtex-ii_pro.h> /* for NR_SER_PORTS */
26
27/*
28 * As an overview of how the following functions (platform_init,
29 * ml300_map_io, ml300_setup_arch and ml300_init_IRQ) fit into the
30 * kernel startup procedure, here's a call tree:
31 *
32 * start_here arch/ppc/kernel/head_4xx.S
33 * early_init arch/ppc/kernel/setup.c
34 * machine_init arch/ppc/kernel/setup.c
35 * platform_init this file
36 * ppc4xx_init arch/ppc/syslib/ppc4xx_setup.c
37 * parse_bootinfo
38 * find_bootinfo
39 * "setup some default ppc_md pointers"
40 * MMU_init arch/ppc/mm/init.c
41 * *ppc_md.setup_io_mappings == ml300_map_io this file
42 * ppc4xx_map_io arch/ppc/syslib/ppc4xx_setup.c
43 * start_kernel init/main.c
44 * setup_arch arch/ppc/kernel/setup.c
45 * #if defined(CONFIG_KGDB)
46 * *ppc_md.kgdb_map_scc() == gen550_kgdb_map_scc
47 * #endif
48 * *ppc_md.setup_arch == ml300_setup_arch this file
49 * ppc4xx_setup_arch arch/ppc/syslib/ppc4xx_setup.c
50 * ppc4xx_find_bridges arch/ppc/syslib/ppc405_pci.c
51 * init_IRQ arch/ppc/kernel/irq.c
52 * *ppc_md.init_IRQ == ml300_init_IRQ this file
53 * ppc4xx_init_IRQ arch/ppc/syslib/ppc4xx_setup.c
54 * ppc4xx_pic_init arch/ppc/syslib/xilinx_pic.c
55 */
56
57#if defined(XPAR_POWER_0_POWERDOWN_BASEADDR)
58
59static volatile unsigned *powerdown_base =
60 (volatile unsigned *) XPAR_POWER_0_POWERDOWN_BASEADDR;
61
62static void
63xilinx_power_off(void)
64{
65 local_irq_disable();
66 out_be32(powerdown_base, XPAR_POWER_0_POWERDOWN_VALUE);
67 while (1) ;
68}
69#endif
70
71void __init
72ml300_map_io(void)
73{
74 ppc4xx_map_io();
75
76#if defined(XPAR_POWER_0_POWERDOWN_BASEADDR)
77 powerdown_base = ioremap((unsigned long) powerdown_base,
78 XPAR_POWER_0_POWERDOWN_HIGHADDR -
79 XPAR_POWER_0_POWERDOWN_BASEADDR + 1);
80#endif
81}
82
83static void __init
84ml300_early_serial_map(void)
85{
86#ifdef CONFIG_SERIAL_8250
87 struct serial_state old_ports[] = { SERIAL_PORT_DFNS };
88 struct uart_port port;
89 int i;
90
91 /* Setup ioremapped serial port access */
92 for (i = 0; i < ARRAY_SIZE(old_ports); i++ ) {
93 memset(&port, 0, sizeof(port));
94 port.membase = ioremap((phys_addr_t)(old_ports[i].iomem_base), 16);
95 port.irq = old_ports[i].irq;
96 port.uartclk = old_ports[i].baud_base * 16;
97 port.regshift = old_ports[i].iomem_reg_shift;
98 port.iotype = SERIAL_IO_MEM;
99 port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST;
100 port.line = i;
101
102 if (early_serial_setup(&port) != 0) {
103 printk("Early serial init of port %d failed\n", i);
104 }
105 }
106#endif /* CONFIG_SERIAL_8250 */
107}
108
109void __init
110ml300_setup_arch(void)
111{
112 ppc4xx_setup_arch(); /* calls ppc4xx_find_bridges() */
113
114 ml300_early_serial_map();
115
116 /* Identify the system */
117 printk(KERN_INFO "Xilinx Virtex-II Pro port\n");
118 printk(KERN_INFO "Port by MontaVista Software, Inc. (source@mvista.com)\n");
119}
120
121/* Called after board_setup_irq from ppc4xx_init_IRQ(). */
122void __init
123ml300_init_irq(void)
124{
125 ppc4xx_init_IRQ();
126}
127
128void __init
129platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
130 unsigned long r6, unsigned long r7)
131{
132 ppc4xx_init(r3, r4, r5, r6, r7);
133
134 ppc_md.setup_arch = ml300_setup_arch;
135 ppc_md.setup_io_mappings = ml300_map_io;
136 ppc_md.init_IRQ = ml300_init_irq;
137
138#if defined(XPAR_POWER_0_POWERDOWN_BASEADDR)
139 ppc_md.power_off = xilinx_power_off;
140#endif
141
142#ifdef CONFIG_KGDB
143 ppc_md.early_serial_map = ml300_early_serial_map;
144#endif
145}
146
diff --git a/arch/ppc/platforms/4xx/xilinx_ml300.h b/arch/ppc/platforms/4xx/xilinx_ml300.h
new file mode 100644
index 000000000000..f8c588412336
--- /dev/null
+++ b/arch/ppc/platforms/4xx/xilinx_ml300.h
@@ -0,0 +1,47 @@
1/*
2 * arch/ppc/platforms/4xx/xilinx_ml300.h
3 *
4 * Include file that defines the Xilinx ML300 evaluation board
5 *
6 * Author: MontaVista Software, Inc.
7 * source@mvista.com
8 *
9 * 2002-2004 (c) MontaVista Software, Inc. This file is licensed under the
10 * terms of the GNU General Public License version 2. This program is licensed
11 * "as is" without any warranty of any kind, whether express or implied.
12 */
13
14#ifdef __KERNEL__
15#ifndef __ASM_XILINX_ML300_H__
16#define __ASM_XILINX_ML300_H__
17
18/* ML300 has a Xilinx Virtex-II Pro processor */
19#include <platforms/4xx/virtex-ii_pro.h>
20
21#ifndef __ASSEMBLY__
22
23#include <linux/types.h>
24
25typedef struct board_info {
26 unsigned int bi_memsize; /* DRAM installed, in bytes */
27 unsigned char bi_enetaddr[6]; /* Local Ethernet MAC address */
28 unsigned int bi_intfreq; /* Processor speed, in Hz */
29 unsigned int bi_busfreq; /* PLB Bus speed, in Hz */
30 unsigned int bi_pci_busfreq; /* PCI Bus speed, in Hz */
31} bd_t;
32
33/* Some 4xx parts use a different timebase frequency from the internal clock.
34*/
35#define bi_tbfreq bi_intfreq
36
37#endif /* !__ASSEMBLY__ */
38
39/* We don't need anything mapped. Size of zero will accomplish that. */
40#define PPC4xx_ONB_IO_PADDR 0u
41#define PPC4xx_ONB_IO_VADDR 0u
42#define PPC4xx_ONB_IO_SIZE 0u
43
44#define PPC4xx_MACHINE_NAME "Xilinx ML300"
45
46#endif /* __ASM_XILINX_ML300_H__ */
47#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/4xx/xparameters/xparameters_ml300.h b/arch/ppc/platforms/4xx/xparameters/xparameters_ml300.h
new file mode 100644
index 000000000000..97e3f4d4bd54
--- /dev/null
+++ b/arch/ppc/platforms/4xx/xparameters/xparameters_ml300.h
@@ -0,0 +1,310 @@
1/*******************************************************************
2*
3* Author: Xilinx, Inc.
4*
5*
6* This program is free software; you can redistribute it and/or modify it
7* under the terms of the GNU General Public License as published by the
8* Free Software Foundation; either version 2 of the License, or (at your
9* option) any later version.
10*
11*
12* XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
13* COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
14* ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR STANDARD,
15* XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION IS FREE
16* FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE FOR OBTAINING
17* ANY THIRD PARTY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.
18* XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
19* THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY
20* WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM
21* CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND
22* FITNESS FOR A PARTICULAR PURPOSE.
23*
24*
25* Xilinx hardware products are not intended for use in life support
26* appliances, devices, or systems. Use in such applications is
27* expressly prohibited.
28*
29*
30* (c) Copyright 2002-2004 Xilinx Inc.
31* All rights reserved.
32*
33*
34* You should have received a copy of the GNU General Public License along
35* with this program; if not, write to the Free Software Foundation, Inc.,
36* 675 Mass Ave, Cambridge, MA 02139, USA.
37*
38* Description: Driver parameters
39*
40*******************************************************************/
41
42#define XPAR_XPCI_NUM_INSTANCES 1
43#define XPAR_XPCI_CLOCK_HZ 33333333
44#define XPAR_OPB_PCI_REF_0_DEVICE_ID 0
45#define XPAR_OPB_PCI_REF_0_BASEADDR 0x20000000
46#define XPAR_OPB_PCI_REF_0_HIGHADDR 0x3FFFFFFF
47#define XPAR_OPB_PCI_REF_0_CONFIG_ADDR 0x3C000000
48#define XPAR_OPB_PCI_REF_0_CONFIG_DATA 0x3C000004
49#define XPAR_OPB_PCI_REF_0_LCONFIG_ADDR 0x3E000000
50#define XPAR_OPB_PCI_REF_0_MEM_BASEADDR 0x20000000
51#define XPAR_OPB_PCI_REF_0_MEM_HIGHADDR 0x37FFFFFF
52#define XPAR_OPB_PCI_REF_0_IO_BASEADDR 0x38000000
53#define XPAR_OPB_PCI_REF_0_IO_HIGHADDR 0x3BFFFFFF
54
55/******************************************************************/
56
57#define XPAR_XEMAC_NUM_INSTANCES 1
58#define XPAR_OPB_ETHERNET_0_BASEADDR 0x60000000
59#define XPAR_OPB_ETHERNET_0_HIGHADDR 0x60003FFF
60#define XPAR_OPB_ETHERNET_0_DEVICE_ID 0
61#define XPAR_OPB_ETHERNET_0_ERR_COUNT_EXIST 1
62#define XPAR_OPB_ETHERNET_0_DMA_PRESENT 1
63#define XPAR_OPB_ETHERNET_0_MII_EXIST 1
64
65/******************************************************************/
66
67#define XPAR_MY_OPB_GPIO_0_DEVICE_ID_0 0
68#define XPAR_MY_OPB_GPIO_0_BASEADDR_0 0x90000000
69#define XPAR_MY_OPB_GPIO_0_HIGHADDR_0 (0x90000000+0x7)
70#define XPAR_MY_OPB_GPIO_0_DEVICE_ID_1 1
71#define XPAR_MY_OPB_GPIO_0_BASEADDR_1 (0x90000000+0x8)
72#define XPAR_MY_OPB_GPIO_0_HIGHADDR_1 (0x90000000+0x1F)
73#define XPAR_XGPIO_NUM_INSTANCES 2
74
75/******************************************************************/
76
77#define XPAR_XIIC_NUM_INSTANCES 1
78#define XPAR_OPB_IIC_0_BASEADDR 0xA8000000
79#define XPAR_OPB_IIC_0_HIGHADDR 0xA80001FF
80#define XPAR_OPB_IIC_0_DEVICE_ID 0
81#define XPAR_OPB_IIC_0_TEN_BIT_ADR 0
82
83/******************************************************************/
84
85#define XPAR_XUARTNS550_NUM_INSTANCES 2
86#define XPAR_XUARTNS550_CLOCK_HZ 100000000
87#define XPAR_OPB_UART16550_0_BASEADDR 0xA0000000
88#define XPAR_OPB_UART16550_0_HIGHADDR 0xA0001FFF
89#define XPAR_OPB_UART16550_0_DEVICE_ID 0
90#define XPAR_OPB_UART16550_1_BASEADDR 0xA0010000
91#define XPAR_OPB_UART16550_1_HIGHADDR 0xA0011FFF
92#define XPAR_OPB_UART16550_1_DEVICE_ID 1
93
94/******************************************************************/
95
96#define XPAR_XSPI_NUM_INSTANCES 1
97#define XPAR_OPB_SPI_0_BASEADDR 0xA4000000
98#define XPAR_OPB_SPI_0_HIGHADDR 0xA400007F
99#define XPAR_OPB_SPI_0_DEVICE_ID 0
100#define XPAR_OPB_SPI_0_FIFO_EXIST 1
101#define XPAR_OPB_SPI_0_SPI_SLAVE_ONLY 0
102#define XPAR_OPB_SPI_0_NUM_SS_BITS 1
103
104/******************************************************************/
105
106#define XPAR_XPS2_NUM_INSTANCES 2
107#define XPAR_OPB_PS2_DUAL_REF_0_DEVICE_ID_0 0
108#define XPAR_OPB_PS2_DUAL_REF_0_BASEADDR_0 0xA9000000
109#define XPAR_OPB_PS2_DUAL_REF_0_HIGHADDR_0 (0xA9000000+0x3F)
110#define XPAR_OPB_PS2_DUAL_REF_0_DEVICE_ID_1 1
111#define XPAR_OPB_PS2_DUAL_REF_0_BASEADDR_1 (0xA9000000+0x1000)
112#define XPAR_OPB_PS2_DUAL_REF_0_HIGHADDR_1 (0xA9000000+0x103F)
113
114/******************************************************************/
115
116#define XPAR_XTOUCHSCREEN_NUM_INSTANCES 1
117#define XPAR_OPB_TSD_REF_0_BASEADDR 0xAA000000
118#define XPAR_OPB_TSD_REF_0_HIGHADDR 0xAA000007
119#define XPAR_OPB_TSD_REF_0_DEVICE_ID 0
120
121/******************************************************************/
122
123#define XPAR_OPB_AC97_CONTROLLER_REF_0_BASEADDR 0xA6000000
124#define XPAR_OPB_AC97_CONTROLLER_REF_0_HIGHADDR 0xA60000FF
125#define XPAR_OPB_PAR_PORT_REF_0_BASEADDR 0x90010000
126#define XPAR_OPB_PAR_PORT_REF_0_HIGHADDR 0x900100FF
127#define XPAR_PLB_DDR_0_BASEADDR 0x00000000
128#define XPAR_PLB_DDR_0_HIGHADDR 0x0FFFFFFF
129
130/******************************************************************/
131
132#define XPAR_XINTC_HAS_IPR 1
133#define XPAR_INTC_MAX_NUM_INTR_INPUTS 18
134#define XPAR_XINTC_USE_DCR 0
135#define XPAR_XINTC_NUM_INSTANCES 1
136#define XPAR_DCR_INTC_0_BASEADDR 0xD0000FC0
137#define XPAR_DCR_INTC_0_HIGHADDR 0xD0000FDF
138#define XPAR_DCR_INTC_0_DEVICE_ID 0
139#define XPAR_DCR_INTC_0_KIND_OF_INTR 0x00038000
140
141/******************************************************************/
142
143#define XPAR_DCR_INTC_0_MISC_LOGIC_0_PHY_MII_INT_INTR 0
144#define XPAR_DCR_INTC_0_OPB_ETHERNET_0_IP2INTC_IRPT_INTR 1
145#define XPAR_DCR_INTC_0_MISC_LOGIC_0_IIC_TEMP_CRIT_INTR 2
146#define XPAR_DCR_INTC_0_MISC_LOGIC_0_IIC_IRQ_INTR 3
147#define XPAR_DCR_INTC_0_OPB_IIC_0_IP2INTC_IRPT_INTR 4
148#define XPAR_DCR_INTC_0_OPB_SYSACE_0_SYSACE_IRQ_INTR 5
149#define XPAR_DCR_INTC_0_OPB_UART16550_0_IP2INTC_IRPT_INTR 6
150#define XPAR_DCR_INTC_0_OPB_UART16550_1_IP2INTC_IRPT_INTR 7
151#define XPAR_DCR_INTC_0_OPB_PS2_DUAL_REF_0_SYS_INTR1_INTR 8
152#define XPAR_DCR_INTC_0_OPB_PS2_DUAL_REF_0_SYS_INTR2_INTR 9
153#define XPAR_DCR_INTC_0_OPB_SPI_0_IP2INTC_IRPT_INTR 10
154#define XPAR_DCR_INTC_0_OPB_TSD_REF_0_INTR_INTR 11
155#define XPAR_DCR_INTC_0_OPB_AC97_CONTROLLER_REF_0_PLAYBACK_INTERRUPT_INTR 12
156#define XPAR_DCR_INTC_0_OPB_AC97_CONTROLLER_REF_0_RECORD_INTERRUPT_INTR 13
157#define XPAR_DCR_INTC_0_OPB_PCI_REF_0_INTR_OUT_INTR 14
158#define XPAR_DCR_INTC_0_PLB2OPB_BRIDGE_0_BUS_ERROR_DET_INTR 15
159#define XPAR_DCR_INTC_0_PLB_V34_0_BUS_ERROR_DET_INTR 16
160#define XPAR_DCR_INTC_0_OPB2PLB_BRIDGE_0_BUS_ERROR_DET_INTR 17
161
162/******************************************************************/
163
164#define XPAR_XTFT_NUM_INSTANCES 1
165#define XPAR_PLB_TFT_CNTLR_REF_0_DCR_BASEADDR 0xD0000200
166#define XPAR_PLB_TFT_CNTLR_REF_0_DCR_HIGHADDR 0xD0000207
167#define XPAR_PLB_TFT_CNTLR_REF_0_DEVICE_ID 0
168
169/******************************************************************/
170
171#define XPAR_XSYSACE_MEM_WIDTH 8
172#define XPAR_XSYSACE_NUM_INSTANCES 1
173#define XPAR_OPB_SYSACE_0_BASEADDR 0xCF000000
174#define XPAR_OPB_SYSACE_0_HIGHADDR 0xCF0001FF
175#define XPAR_OPB_SYSACE_0_DEVICE_ID 0
176#define XPAR_OPB_SYSACE_0_MEM_WIDTH 8
177
178/******************************************************************/
179
180#define XPAR_CPU_PPC405_CORE_CLOCK_FREQ_HZ 300000000
181
182/******************************************************************/
183
184/******************************************************************/
185
186/* Linux Redefines */
187
188/******************************************************************/
189
190#define XPAR_UARTNS550_0_BASEADDR (XPAR_OPB_UART16550_0_BASEADDR+0x1000)
191#define XPAR_UARTNS550_0_HIGHADDR XPAR_OPB_UART16550_0_HIGHADDR
192#define XPAR_UARTNS550_0_CLOCK_FREQ_HZ XPAR_XUARTNS550_CLOCK_HZ
193#define XPAR_UARTNS550_0_DEVICE_ID XPAR_OPB_UART16550_0_DEVICE_ID
194#define XPAR_UARTNS550_1_BASEADDR (XPAR_OPB_UART16550_1_BASEADDR+0x1000)
195#define XPAR_UARTNS550_1_HIGHADDR XPAR_OPB_UART16550_1_HIGHADDR
196#define XPAR_UARTNS550_1_CLOCK_FREQ_HZ XPAR_XUARTNS550_CLOCK_HZ
197#define XPAR_UARTNS550_1_DEVICE_ID XPAR_OPB_UART16550_1_DEVICE_ID
198
199/******************************************************************/
200
201#define XPAR_GPIO_0_BASEADDR XPAR_MY_OPB_GPIO_0_BASEADDR_0
202#define XPAR_GPIO_0_HIGHADDR XPAR_MY_OPB_GPIO_0_HIGHADDR_0
203#define XPAR_GPIO_0_DEVICE_ID XPAR_MY_OPB_GPIO_0_DEVICE_ID_0
204#define XPAR_GPIO_1_BASEADDR XPAR_MY_OPB_GPIO_0_BASEADDR_1
205#define XPAR_GPIO_1_HIGHADDR XPAR_MY_OPB_GPIO_0_HIGHADDR_1
206#define XPAR_GPIO_1_DEVICE_ID XPAR_MY_OPB_GPIO_0_DEVICE_ID_1
207
208/******************************************************************/
209
210#define XPAR_IIC_0_BASEADDR XPAR_OPB_IIC_0_BASEADDR
211#define XPAR_IIC_0_HIGHADDR XPAR_OPB_IIC_0_HIGHADDR
212#define XPAR_IIC_0_TEN_BIT_ADR XPAR_OPB_IIC_0_TEN_BIT_ADR
213#define XPAR_IIC_0_DEVICE_ID XPAR_OPB_IIC_0_DEVICE_ID
214
215/******************************************************************/
216
217#define XPAR_SYSACE_0_BASEADDR XPAR_OPB_SYSACE_0_BASEADDR
218#define XPAR_SYSACE_0_HIGHADDR XPAR_OPB_SYSACE_0_HIGHADDR
219#define XPAR_SYSACE_0_DEVICE_ID XPAR_OPB_SYSACE_0_DEVICE_ID
220
221/******************************************************************/
222
223#define XPAR_INTC_0_BASEADDR XPAR_DCR_INTC_0_BASEADDR
224#define XPAR_INTC_0_HIGHADDR XPAR_DCR_INTC_0_HIGHADDR
225#define XPAR_INTC_0_KIND_OF_INTR XPAR_DCR_INTC_0_KIND_OF_INTR
226#define XPAR_INTC_0_DEVICE_ID XPAR_DCR_INTC_0_DEVICE_ID
227
228/******************************************************************/
229
230#define XPAR_INTC_0_EMAC_0_VEC_ID XPAR_DCR_INTC_0_OPB_ETHERNET_0_IP2INTC_IRPT_INTR
231#define XPAR_INTC_0_IIC_0_VEC_ID XPAR_DCR_INTC_0_OPB_IIC_0_IP2INTC_IRPT_INTR
232#define XPAR_INTC_0_SYSACE_0_VEC_ID XPAR_DCR_INTC_0_OPB_SYSACE_0_SYSACE_IRQ_INTR
233#define XPAR_INTC_0_UARTNS550_0_VEC_ID XPAR_DCR_INTC_0_OPB_UART16550_0_IP2INTC_IRPT_INTR
234#define XPAR_INTC_0_UARTNS550_1_VEC_ID XPAR_DCR_INTC_0_OPB_UART16550_1_IP2INTC_IRPT_INTR
235#define XPAR_INTC_0_PS2_0_VEC_ID XPAR_DCR_INTC_0_OPB_PS2_DUAL_REF_0_SYS_INTR1_INTR
236#define XPAR_INTC_0_PS2_1_VEC_ID XPAR_DCR_INTC_0_OPB_PS2_DUAL_REF_0_SYS_INTR2_INTR
237#define XPAR_INTC_0_SPI_0_VEC_ID XPAR_DCR_INTC_0_OPB_SPI_0_IP2INTC_IRPT_INTR
238#define XPAR_INTC_0_TOUCHSCREEN_0_VEC_ID XPAR_DCR_INTC_0_OPB_TSD_REF_0_INTR_INTR
239#define XPAR_INTC_0_PCI_0_VEC_ID_A XPAR_DCR_INTC_0_OPB_PCI_REF_0_INTR_OUT_INTR
240#define XPAR_INTC_0_PCI_0_VEC_ID_B XPAR_DCR_INTC_0_OPB_PCI_REF_0_INTR_OUT_INTR
241#define XPAR_INTC_0_PCI_0_VEC_ID_C XPAR_DCR_INTC_0_OPB_PCI_REF_0_INTR_OUT_INTR
242#define XPAR_INTC_0_PCI_0_VEC_ID_D XPAR_DCR_INTC_0_OPB_PCI_REF_0_INTR_OUT_INTR
243
244/******************************************************************/
245
246#define XPAR_EMAC_0_BASEADDR XPAR_OPB_ETHERNET_0_BASEADDR
247#define XPAR_EMAC_0_HIGHADDR XPAR_OPB_ETHERNET_0_HIGHADDR
248#define XPAR_EMAC_0_DMA_PRESENT XPAR_OPB_ETHERNET_0_DMA_PRESENT
249#define XPAR_EMAC_0_MII_EXIST XPAR_OPB_ETHERNET_0_MII_EXIST
250#define XPAR_EMAC_0_ERR_COUNT_EXIST XPAR_OPB_ETHERNET_0_ERR_COUNT_EXIST
251#define XPAR_EMAC_0_DEVICE_ID XPAR_OPB_ETHERNET_0_DEVICE_ID
252
253/******************************************************************/
254
255#define XPAR_SPI_0_BASEADDR XPAR_OPB_SPI_0_BASEADDR
256#define XPAR_SPI_0_HIGHADDR XPAR_OPB_SPI_0_HIGHADDR
257#define XPAR_SPI_0_DEVICE_ID XPAR_OPB_SPI_0_DEVICE_ID
258
259/******************************************************************/
260
261#define XPAR_TOUCHSCREEN_0_BASEADDR XPAR_OPB_TSD_REF_0_BASEADDR
262#define XPAR_TOUCHSCREEN_0_HIGHADDR XPAR_OPB_TSD_REF_0_HIGHADDR
263#define XPAR_TOUCHSCREEN_0_DEVICE_ID XPAR_OPB_TSD_REF_0_DEVICE_ID
264
265/******************************************************************/
266
267#define XPAR_TFT_0_BASEADDR XPAR_PLB_TFT_CNTLR_REF_0_DCR_BASEADDR
268
269/******************************************************************/
270
271#define XPAR_PCI_0_BASEADDR XPAR_OPB_PCI_REF_0_BASEADDR
272#define XPAR_PCI_0_HIGHADDR XPAR_OPB_PCI_REF_0_HIGHADDR
273#define XPAR_PCI_0_CONFIG_ADDR XPAR_OPB_PCI_REF_0_CONFIG_ADDR
274#define XPAR_PCI_0_CONFIG_DATA XPAR_OPB_PCI_REF_0_CONFIG_DATA
275#define XPAR_PCI_0_LCONFIG_ADDR XPAR_OPB_PCI_REF_0_LCONFIG_ADDR
276#define XPAR_PCI_0_MEM_BASEADDR XPAR_OPB_PCI_REF_0_MEM_BASEADDR
277#define XPAR_PCI_0_MEM_HIGHADDR XPAR_OPB_PCI_REF_0_MEM_HIGHADDR
278#define XPAR_PCI_0_IO_BASEADDR XPAR_OPB_PCI_REF_0_IO_BASEADDR
279#define XPAR_PCI_0_IO_HIGHADDR XPAR_OPB_PCI_REF_0_IO_HIGHADDR
280#define XPAR_PCI_0_CLOCK_FREQ_HZ XPAR_XPCI_CLOCK_HZ
281#define XPAR_PCI_0_DEVICE_ID XPAR_OPB_PCI_REF_0_DEVICE_ID
282
283/******************************************************************/
284
285#define XPAR_PS2_0_BASEADDR XPAR_OPB_PS2_DUAL_REF_0_BASEADDR_0
286#define XPAR_PS2_0_HIGHADDR XPAR_OPB_PS2_DUAL_REF_0_HIGHADDR_0
287#define XPAR_PS2_0_DEVICE_ID XPAR_OPB_PS2_DUAL_REF_0_DEVICE_ID_0
288#define XPAR_PS2_1_BASEADDR XPAR_OPB_PS2_DUAL_REF_0_BASEADDR_1
289#define XPAR_PS2_1_HIGHADDR XPAR_OPB_PS2_DUAL_REF_0_HIGHADDR_1
290#define XPAR_PS2_1_DEVICE_ID XPAR_OPB_PS2_DUAL_REF_0_DEVICE_ID_1
291
292/******************************************************************/
293
294#define XPAR_PLB_CLOCK_FREQ_HZ 100000000
295#define XPAR_CORE_CLOCK_FREQ_HZ XPAR_CPU_PPC405_CORE_CLOCK_FREQ_HZ
296#define XPAR_DDR_0_SIZE 0x08000000
297
298/******************************************************************/
299
300#define XPAR_PERSISTENT_0_IIC_0_BASEADDR 0x00000400
301#define XPAR_PERSISTENT_0_IIC_0_HIGHADDR 0x000007FF
302#define XPAR_PERSISTENT_0_IIC_0_EEPROMADDR 0xA0
303
304/******************************************************************/
305
306#define XPAR_POWER_0_POWERDOWN_BASEADDR 0x90000004
307#define XPAR_POWER_0_POWERDOWN_HIGHADDR 0x90000007
308#define XPAR_POWER_0_POWERDOWN_VALUE 0xFF
309
310/******************************************************************/
diff --git a/arch/ppc/platforms/83xx/Makefile b/arch/ppc/platforms/83xx/Makefile
new file mode 100644
index 000000000000..eb55341d6a17
--- /dev/null
+++ b/arch/ppc/platforms/83xx/Makefile
@@ -0,0 +1,4 @@
1#
2# Makefile for the PowerPC 83xx linux kernel.
3#
4obj-$(CONFIG_MPC834x_SYS) += mpc834x_sys.o
diff --git a/arch/ppc/platforms/83xx/mpc834x_sys.c b/arch/ppc/platforms/83xx/mpc834x_sys.c
new file mode 100644
index 000000000000..b3b0f51979d2
--- /dev/null
+++ b/arch/ppc/platforms/83xx/mpc834x_sys.c
@@ -0,0 +1,289 @@
1/*
2 * arch/ppc/platforms/83xx/mpc834x_sys.c
3 *
4 * MPC834x SYS board specific routines
5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com>
7 *
8 * Copyright 2005 Freescale Semiconductor Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15
16#include <linux/config.h>
17#include <linux/stddef.h>
18#include <linux/kernel.h>
19#include <linux/init.h>
20#include <linux/errno.h>
21#include <linux/reboot.h>
22#include <linux/pci.h>
23#include <linux/kdev_t.h>
24#include <linux/major.h>
25#include <linux/console.h>
26#include <linux/delay.h>
27#include <linux/irq.h>
28#include <linux/seq_file.h>
29#include <linux/root_dev.h>
30#include <linux/serial.h>
31#include <linux/tty.h> /* for linux/serial_core.h */
32#include <linux/serial_core.h>
33#include <linux/initrd.h>
34#include <linux/module.h>
35#include <linux/fsl_devices.h>
36
37#include <asm/system.h>
38#include <asm/pgtable.h>
39#include <asm/page.h>
40#include <asm/atomic.h>
41#include <asm/time.h>
42#include <asm/io.h>
43#include <asm/machdep.h>
44#include <asm/prom.h>
45#include <asm/ipic.h>
46#include <asm/bootinfo.h>
47#include <asm/pci-bridge.h>
48#include <asm/mpc83xx.h>
49#include <asm/irq.h>
50#include <asm/kgdb.h>
51#include <asm/ppc_sys.h>
52#include <mm/mmu_decl.h>
53
54#include <syslib/ppc83xx_setup.h>
55
56#ifndef CONFIG_PCI
57unsigned long isa_io_base = 0;
58unsigned long isa_mem_base = 0;
59#endif
60
61extern unsigned long total_memory; /* in mm/init */
62
63unsigned char __res[sizeof (bd_t)];
64
65#ifdef CONFIG_PCI
66#error "PCI is not supported"
67/* NEED mpc83xx_map_irq & mpc83xx_exclude_device
68 see platforms/85xx/mpc85xx_ads_common.c */
69#endif /* CONFIG_PCI */
70
71/* ************************************************************************
72 *
73 * Setup the architecture
74 *
75 */
76static void __init
77mpc834x_sys_setup_arch(void)
78{
79 bd_t *binfo = (bd_t *) __res;
80 unsigned int freq;
81 struct gianfar_platform_data *pdata;
82
83 /* get the core frequency */
84 freq = binfo->bi_intfreq;
85
86 /* Set loops_per_jiffy to a half-way reasonable value,
87 for use until calibrate_delay gets called. */
88 loops_per_jiffy = freq / HZ;
89
90#ifdef CONFIG_PCI
91 /* setup PCI host bridges */
92 mpc83xx_sys_setup_hose();
93#endif
94 mpc83xx_early_serial_map();
95
96 /* setup the board related information for the enet controllers */
97 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC83xx_TSEC1);
98 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
99 pdata->interruptPHY = MPC83xx_IRQ_EXT1;
100 pdata->phyid = 0;
101 /* fixup phy address */
102 pdata->phy_reg_addr += binfo->bi_immr_base;
103 memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6);
104
105 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC83xx_TSEC2);
106 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
107 pdata->interruptPHY = MPC83xx_IRQ_EXT2;
108 pdata->phyid = 1;
109 /* fixup phy address */
110 pdata->phy_reg_addr += binfo->bi_immr_base;
111 memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6);
112
113#ifdef CONFIG_BLK_DEV_INITRD
114 if (initrd_start)
115 ROOT_DEV = Root_RAM0;
116 else
117#endif
118#ifdef CONFIG_ROOT_NFS
119 ROOT_DEV = Root_NFS;
120#else
121 ROOT_DEV = Root_HDA1;
122#endif
123}
124
125static void __init
126mpc834x_sys_map_io(void)
127{
128 /* we steal the lowest ioremap addr for virt space */
129 io_block_mapping(VIRT_IMMRBAR, immrbar, 1024*1024, _PAGE_IO);
130 io_block_mapping(BCSR_VIRT_ADDR, BCSR_PHYS_ADDR, BCSR_SIZE, _PAGE_IO);
131}
132
133int
134mpc834x_sys_show_cpuinfo(struct seq_file *m)
135{
136 uint pvid, svid, phid1;
137 bd_t *binfo = (bd_t *) __res;
138 unsigned int freq;
139
140 /* get the core frequency */
141 freq = binfo->bi_intfreq;
142
143 pvid = mfspr(SPRN_PVR);
144 svid = mfspr(SPRN_SVR);
145
146 seq_printf(m, "Vendor\t\t: Freescale Inc.\n");
147 seq_printf(m, "Machine\t\t: mpc%s sys\n", cur_ppc_sys_spec->ppc_sys_name);
148 seq_printf(m, "core clock\t: %d MHz\n"
149 "bus clock\t: %d MHz\n",
150 (int)(binfo->bi_intfreq / 1000000),
151 (int)(binfo->bi_busfreq / 1000000));
152 seq_printf(m, "PVR\t\t: 0x%x\n", pvid);
153 seq_printf(m, "SVR\t\t: 0x%x\n", svid);
154
155 /* Display cpu Pll setting */
156 phid1 = mfspr(SPRN_HID1);
157 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
158
159 /* Display the amount of memory */
160 seq_printf(m, "Memory\t\t: %d MB\n", (int)(binfo->bi_memsize / (1024 * 1024)));
161
162 return 0;
163}
164
165
166void __init
167mpc834x_sys_init_IRQ(void)
168{
169 bd_t *binfo = (bd_t *) __res;
170
171 u8 senses[8] = {
172 0, /* EXT 0 */
173 IRQ_SENSE_LEVEL, /* EXT 1 */
174 IRQ_SENSE_LEVEL, /* EXT 2 */
175 0, /* EXT 3 */
176 0, /* EXT 4 */
177 0, /* EXT 5 */
178 0, /* EXT 6 */
179 0, /* EXT 7 */
180 };
181
182 ipic_init(binfo->bi_immr_base + 0x00700, 0, MPC83xx_IPIC_IRQ_OFFSET, senses, 8);
183
184 /* Initialize the default interrupt mapping priorities,
185 * in case the boot rom changed something on us.
186 */
187 ipic_set_default_priority();
188}
189
190static __inline__ void
191mpc834x_sys_set_bat(void)
192{
193 /* we steal the lowest ioremap addr for virt space */
194 mb();
195 mtspr(SPRN_DBAT1U, VIRT_IMMRBAR | 0x1e);
196 mtspr(SPRN_DBAT1L, immrbar | 0x2a);
197 mb();
198}
199
200void __init
201platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
202 unsigned long r6, unsigned long r7)
203{
204 bd_t *binfo = (bd_t *) __res;
205
206 /* parse_bootinfo must always be called first */
207 parse_bootinfo(find_bootinfo());
208
209 /*
210 * If we were passed in a board information, copy it into the
211 * residual data area.
212 */
213 if (r3) {
214 memcpy((void *) __res, (void *) (r3 + KERNELBASE),
215 sizeof (bd_t));
216 }
217
218#if defined(CONFIG_BLK_DEV_INITRD)
219 /*
220 * If the init RAM disk has been configured in, and there's a valid
221 * starting address for it, set it up.
222 */
223 if (r4) {
224 initrd_start = r4 + KERNELBASE;
225 initrd_end = r5 + KERNELBASE;
226 }
227#endif /* CONFIG_BLK_DEV_INITRD */
228
229 /* Copy the kernel command line arguments to a safe place. */
230 if (r6) {
231 *(char *) (r7 + KERNELBASE) = 0;
232 strcpy(cmd_line, (char *) (r6 + KERNELBASE));
233 }
234
235 immrbar = binfo->bi_immr_base;
236
237 mpc834x_sys_set_bat();
238
239#if defined(CONFIG_SERIAL_8250) && defined(CONFIG_SERIAL_TEXT_DEBUG)
240 {
241 struct uart_port p;
242
243 memset(&p, 0, sizeof (p));
244 p.iotype = SERIAL_IO_MEM;
245 p.membase = (unsigned char __iomem *)(VIRT_IMMRBAR + 0x4500);
246 p.uartclk = binfo->bi_busfreq;
247
248 gen550_init(0, &p);
249
250 memset(&p, 0, sizeof (p));
251 p.iotype = SERIAL_IO_MEM;
252 p.membase = (unsigned char __iomem *)(VIRT_IMMRBAR + 0x4600);
253 p.uartclk = binfo->bi_busfreq;
254
255 gen550_init(1, &p);
256 }
257#endif
258
259 identify_ppc_sys_by_id(mfspr(SPRN_SVR));
260
261 /* setup the PowerPC module struct */
262 ppc_md.setup_arch = mpc834x_sys_setup_arch;
263 ppc_md.show_cpuinfo = mpc834x_sys_show_cpuinfo;
264
265 ppc_md.init_IRQ = mpc834x_sys_init_IRQ;
266 ppc_md.get_irq = ipic_get_irq;
267
268 ppc_md.restart = mpc83xx_restart;
269 ppc_md.power_off = mpc83xx_power_off;
270 ppc_md.halt = mpc83xx_halt;
271
272 ppc_md.find_end_of_memory = mpc83xx_find_end_of_memory;
273 ppc_md.setup_io_mappings = mpc834x_sys_map_io;
274
275 ppc_md.time_init = mpc83xx_time_init;
276 ppc_md.set_rtc_time = NULL;
277 ppc_md.get_rtc_time = NULL;
278 ppc_md.calibrate_decr = mpc83xx_calibrate_decr;
279
280 ppc_md.early_serial_map = mpc83xx_early_serial_map;
281#if defined(CONFIG_SERIAL_8250) && defined(CONFIG_SERIAL_TEXT_DEBUG)
282 ppc_md.progress = gen550_progress;
283#endif /* CONFIG_SERIAL_8250 && CONFIG_SERIAL_TEXT_DEBUG */
284
285 if (ppc_md.progress)
286 ppc_md.progress("mpc834x_sys_init(): exit", 0);
287
288 return;
289}
diff --git a/arch/ppc/platforms/83xx/mpc834x_sys.h b/arch/ppc/platforms/83xx/mpc834x_sys.h
new file mode 100644
index 000000000000..f4d055ae19c1
--- /dev/null
+++ b/arch/ppc/platforms/83xx/mpc834x_sys.h
@@ -0,0 +1,51 @@
1/*
2 * arch/ppc/platforms/83xx/mpc834x_sys.h
3 *
4 * MPC834X SYS common board definitions
5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com>
7 *
8 * Copyright 2005 Freescale Semiconductor, Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 */
16
17#ifndef __MACH_MPC83XX_SYS_H__
18#define __MACH_MPC83XX_SYS_H__
19
20#include <linux/config.h>
21#include <linux/init.h>
22#include <linux/seq_file.h>
23#include <syslib/ppc83xx_setup.h>
24#include <asm/ppcboot.h>
25
26#define VIRT_IMMRBAR ((uint)0xfe000000)
27
28#define BCSR_PHYS_ADDR ((uint)0xf8000000)
29#define BCSR_VIRT_ADDR ((uint)0xfe100000)
30#define BCSR_SIZE ((uint)(32 * 1024))
31
32#ifdef CONFIG_PCI
33/* PCI interrupt controller */
34#define PIRQA MPC83xx_IRQ_IRQ4
35#define PIRQB MPC83xx_IRQ_IRQ5
36#define PIRQC MPC83xx_IRQ_IRQ6
37#define PIRQD MPC83xx_IRQ_IRQ7
38
39#define MPC834x_SYS_PCI1_LOWER_IO 0x00000000
40#define MPC834x_SYS_PCI1_UPPER_IO 0x00ffffff
41
42#define MPC834x_SYS_PCI1_LOWER_MEM 0x80000000
43#define MPC834x_SYS_PCI1_UPPER_MEM 0x9fffffff
44
45#define MPC834x_SYS_PCI1_IO_BASE 0xe2000000
46#define MPC834x_SYS_PCI1_MEM_OFFSET 0x00000000
47
48#define MPC834x_SYS_PCI1_IO_SIZE 0x01000000
49#endif /* CONFIG_PCI */
50
51#endif /* __MACH_MPC83XX_SYS_H__ */
diff --git a/arch/ppc/platforms/85xx/Kconfig b/arch/ppc/platforms/85xx/Kconfig
new file mode 100644
index 000000000000..ff92e38e7da1
--- /dev/null
+++ b/arch/ppc/platforms/85xx/Kconfig
@@ -0,0 +1,76 @@
1config 85xx
2 bool
3 depends on E500
4 default y
5
6config PPC_INDIRECT_PCI_BE
7 bool
8 depends on 85xx
9 default y
10
11menu "Freescale 85xx options"
12 depends on E500
13
14choice
15 prompt "Machine Type"
16 depends on 85xx
17 default MPC8540_ADS
18
19config MPC8540_ADS
20 bool "Freescale MPC8540 ADS"
21 help
22 This option enables support for the MPC 8540 ADS evaluation board.
23
24config MPC8555_CDS
25 bool "Freescale MPC8555 CDS"
26 help
27 This option enablese support for the MPC8555 CDS evaluation board.
28
29config MPC8560_ADS
30 bool "Freescale MPC8560 ADS"
31 help
32 This option enables support for the MPC 8560 ADS evaluation board.
33
34config SBC8560
35 bool "WindRiver PowerQUICC III SBC8560"
36 help
37 This option enables support for the WindRiver PowerQUICC III
38 SBC8560 board.
39
40config STX_GP3
41 bool "Silicon Turnkey Express GP3"
42 help
43 This option enables support for the Silicon Turnkey Express GP3
44 board.
45
46endchoice
47
48# It's often necessary to know the specific 85xx processor type.
49# Fortunately, it is implied (so far) from the board type, so we
50# don't need to ask more redundant questions.
51config MPC8540
52 bool
53 depends on MPC8540_ADS
54 default y
55
56config MPC8555
57 bool
58 depends on MPC8555_CDS
59 default y
60
61config MPC8560
62 bool
63 depends on SBC8560 || MPC8560_ADS || STX_GP3
64 default y
65
66config 85xx_PCI2
67 bool "Supprt for 2nd PCI host controller"
68 depends on MPC8555_CDS
69 default y
70
71config PPC_GEN550
72 bool
73 depends on MPC8540 || SBC8560 || MPC8555
74 default y
75
76endmenu
diff --git a/arch/ppc/platforms/85xx/Makefile b/arch/ppc/platforms/85xx/Makefile
new file mode 100644
index 000000000000..854fbd298ba2
--- /dev/null
+++ b/arch/ppc/platforms/85xx/Makefile
@@ -0,0 +1,8 @@
1#
2# Makefile for the PowerPC 85xx linux kernel.
3#
4obj-$(CONFIG_MPC8540_ADS) += mpc85xx_ads_common.o mpc8540_ads.o
5obj-$(CONFIG_MPC8555_CDS) += mpc85xx_cds_common.o
6obj-$(CONFIG_MPC8560_ADS) += mpc85xx_ads_common.o mpc8560_ads.o
7obj-$(CONFIG_SBC8560) += sbc85xx.o sbc8560.o
8obj-$(CONFIG_STX_GP3) += stx_gp3.o
diff --git a/arch/ppc/platforms/85xx/mpc8540_ads.c b/arch/ppc/platforms/85xx/mpc8540_ads.c
new file mode 100644
index 000000000000..4d857d6d633d
--- /dev/null
+++ b/arch/ppc/platforms/85xx/mpc8540_ads.c
@@ -0,0 +1,218 @@
1/*
2 * arch/ppc/platforms/85xx/mpc8540_ads.c
3 *
4 * MPC8540ADS board specific routines
5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com>
7 *
8 * Copyright 2004 Freescale Semiconductor Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15
16#include <linux/config.h>
17#include <linux/stddef.h>
18#include <linux/kernel.h>
19#include <linux/init.h>
20#include <linux/errno.h>
21#include <linux/reboot.h>
22#include <linux/pci.h>
23#include <linux/kdev_t.h>
24#include <linux/major.h>
25#include <linux/console.h>
26#include <linux/delay.h>
27#include <linux/irq.h>
28#include <linux/seq_file.h>
29#include <linux/root_dev.h>
30#include <linux/serial.h>
31#include <linux/tty.h> /* for linux/serial_core.h */
32#include <linux/serial_core.h>
33#include <linux/initrd.h>
34#include <linux/module.h>
35#include <linux/fsl_devices.h>
36
37#include <asm/system.h>
38#include <asm/pgtable.h>
39#include <asm/page.h>
40#include <asm/atomic.h>
41#include <asm/time.h>
42#include <asm/io.h>
43#include <asm/machdep.h>
44#include <asm/prom.h>
45#include <asm/open_pic.h>
46#include <asm/bootinfo.h>
47#include <asm/pci-bridge.h>
48#include <asm/mpc85xx.h>
49#include <asm/irq.h>
50#include <asm/immap_85xx.h>
51#include <asm/kgdb.h>
52#include <asm/ppc_sys.h>
53#include <mm/mmu_decl.h>
54
55#include <syslib/ppc85xx_setup.h>
56
57/* ************************************************************************
58 *
59 * Setup the architecture
60 *
61 */
62static void __init
63mpc8540ads_setup_arch(void)
64{
65 bd_t *binfo = (bd_t *) __res;
66 unsigned int freq;
67 struct gianfar_platform_data *pdata;
68
69 /* get the core frequency */
70 freq = binfo->bi_intfreq;
71
72 if (ppc_md.progress)
73 ppc_md.progress("mpc8540ads_setup_arch()", 0);
74
75 /* Set loops_per_jiffy to a half-way reasonable value,
76 for use until calibrate_delay gets called. */
77 loops_per_jiffy = freq / HZ;
78
79#ifdef CONFIG_PCI
80 /* setup PCI host bridges */
81 mpc85xx_setup_hose();
82#endif
83
84#ifdef CONFIG_SERIAL_8250
85 mpc85xx_early_serial_map();
86#endif
87
88#ifdef CONFIG_SERIAL_TEXT_DEBUG
89 /* Invalidate the entry we stole earlier the serial ports
90 * should be properly mapped */
91 invalidate_tlbcam_entry(NUM_TLBCAMS - 1);
92#endif
93
94 /* setup the board related information for the enet controllers */
95 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1);
96 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
97 pdata->interruptPHY = MPC85xx_IRQ_EXT5;
98 pdata->phyid = 0;
99 /* fixup phy address */
100 pdata->phy_reg_addr += binfo->bi_immr_base;
101 memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6);
102
103 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC2);
104 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
105 pdata->interruptPHY = MPC85xx_IRQ_EXT5;
106 pdata->phyid = 1;
107 /* fixup phy address */
108 pdata->phy_reg_addr += binfo->bi_immr_base;
109 memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6);
110
111 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_FEC);
112 pdata->board_flags = 0;
113 pdata->interruptPHY = MPC85xx_IRQ_EXT5;
114 pdata->phyid = 3;
115 /* fixup phy address */
116 pdata->phy_reg_addr += binfo->bi_immr_base;
117 memcpy(pdata->mac_addr, binfo->bi_enet2addr, 6);
118
119#ifdef CONFIG_BLK_DEV_INITRD
120 if (initrd_start)
121 ROOT_DEV = Root_RAM0;
122 else
123#endif
124#ifdef CONFIG_ROOT_NFS
125 ROOT_DEV = Root_NFS;
126#else
127 ROOT_DEV = Root_HDA1;
128#endif
129}
130
131/* ************************************************************************ */
132void __init
133platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
134 unsigned long r6, unsigned long r7)
135{
136 /* parse_bootinfo must always be called first */
137 parse_bootinfo(find_bootinfo());
138
139 /*
140 * If we were passed in a board information, copy it into the
141 * residual data area.
142 */
143 if (r3) {
144 memcpy((void *) __res, (void *) (r3 + KERNELBASE),
145 sizeof (bd_t));
146 }
147#ifdef CONFIG_SERIAL_TEXT_DEBUG
148 {
149 bd_t *binfo = (bd_t *) __res;
150 struct uart_port p;
151
152 /* Use the last TLB entry to map CCSRBAR to allow access to DUART regs */
153 settlbcam(NUM_TLBCAMS - 1, binfo->bi_immr_base,
154 binfo->bi_immr_base, MPC85xx_CCSRBAR_SIZE, _PAGE_IO, 0);
155
156 memset(&p, 0, sizeof (p));
157 p.iotype = SERIAL_IO_MEM;
158 p.membase = (void *) binfo->bi_immr_base + MPC85xx_UART0_OFFSET;
159 p.uartclk = binfo->bi_busfreq;
160
161 gen550_init(0, &p);
162
163 memset(&p, 0, sizeof (p));
164 p.iotype = SERIAL_IO_MEM;
165 p.membase = (void *) binfo->bi_immr_base + MPC85xx_UART1_OFFSET;
166 p.uartclk = binfo->bi_busfreq;
167
168 gen550_init(1, &p);
169 }
170#endif
171
172#if defined(CONFIG_BLK_DEV_INITRD)
173 /*
174 * If the init RAM disk has been configured in, and there's a valid
175 * starting address for it, set it up.
176 */
177 if (r4) {
178 initrd_start = r4 + KERNELBASE;
179 initrd_end = r5 + KERNELBASE;
180 }
181#endif /* CONFIG_BLK_DEV_INITRD */
182
183 /* Copy the kernel command line arguments to a safe place. */
184
185 if (r6) {
186 *(char *) (r7 + KERNELBASE) = 0;
187 strcpy(cmd_line, (char *) (r6 + KERNELBASE));
188 }
189
190 identify_ppc_sys_by_id(mfspr(SPRN_SVR));
191
192 /* setup the PowerPC module struct */
193 ppc_md.setup_arch = mpc8540ads_setup_arch;
194 ppc_md.show_cpuinfo = mpc85xx_ads_show_cpuinfo;
195
196 ppc_md.init_IRQ = mpc85xx_ads_init_IRQ;
197 ppc_md.get_irq = openpic_get_irq;
198
199 ppc_md.restart = mpc85xx_restart;
200 ppc_md.power_off = mpc85xx_power_off;
201 ppc_md.halt = mpc85xx_halt;
202
203 ppc_md.find_end_of_memory = mpc85xx_find_end_of_memory;
204
205 ppc_md.time_init = NULL;
206 ppc_md.set_rtc_time = NULL;
207 ppc_md.get_rtc_time = NULL;
208 ppc_md.calibrate_decr = mpc85xx_calibrate_decr;
209
210#if defined(CONFIG_SERIAL_8250) && defined(CONFIG_SERIAL_TEXT_DEBUG)
211 ppc_md.progress = gen550_progress;
212#endif /* CONFIG_SERIAL_8250 && CONFIG_SERIAL_TEXT_DEBUG */
213
214 if (ppc_md.progress)
215 ppc_md.progress("mpc8540ads_init(): exit", 0);
216
217 return;
218}
diff --git a/arch/ppc/platforms/85xx/mpc8540_ads.h b/arch/ppc/platforms/85xx/mpc8540_ads.h
new file mode 100644
index 000000000000..3d05d7c4a938
--- /dev/null
+++ b/arch/ppc/platforms/85xx/mpc8540_ads.h
@@ -0,0 +1,25 @@
1/*
2 * arch/ppc/platforms/85xx/mpc8540_ads.h
3 *
4 * MPC8540ADS board definitions
5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com>
7 *
8 * Copyright 2004 Freescale Semiconductor Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 */
16
17#ifndef __MACH_MPC8540ADS_H__
18#define __MACH_MPC8540ADS_H__
19
20#include <linux/config.h>
21#include <linux/initrd.h>
22#include <syslib/ppc85xx_setup.h>
23#include <platforms/85xx/mpc85xx_ads_common.h>
24
25#endif /* __MACH_MPC8540ADS_H__ */
diff --git a/arch/ppc/platforms/85xx/mpc8555_cds.h b/arch/ppc/platforms/85xx/mpc8555_cds.h
new file mode 100644
index 000000000000..e0e75568bc57
--- /dev/null
+++ b/arch/ppc/platforms/85xx/mpc8555_cds.h
@@ -0,0 +1,26 @@
1/*
2 * arch/ppc/platforms/mpc8555_cds.h
3 *
4 * MPC8555CDS board definitions
5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com>
7 *
8 * Copyright 2004 Freescale Semiconductor Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 */
16
17#ifndef __MACH_MPC8555CDS_H__
18#define __MACH_MPC8555CDS_H__
19
20#include <linux/config.h>
21#include <syslib/ppc85xx_setup.h>
22#include <platforms/85xx/mpc85xx_cds_common.h>
23
24#define CPM_MAP_ADDR (CCSRBAR + MPC85xx_CPM_OFFSET)
25
26#endif /* __MACH_MPC8555CDS_H__ */
diff --git a/arch/ppc/platforms/85xx/mpc8560_ads.c b/arch/ppc/platforms/85xx/mpc8560_ads.c
new file mode 100644
index 000000000000..761b8c7b25d2
--- /dev/null
+++ b/arch/ppc/platforms/85xx/mpc8560_ads.c
@@ -0,0 +1,210 @@
1/*
2 * arch/ppc/platforms/85xx/mpc8560_ads.c
3 *
4 * MPC8560ADS board specific routines
5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com>
7 *
8 * Copyright 2004 Freescale Semiconductor Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15
16#include <linux/config.h>
17#include <linux/stddef.h>
18#include <linux/kernel.h>
19#include <linux/init.h>
20#include <linux/errno.h>
21#include <linux/reboot.h>
22#include <linux/pci.h>
23#include <linux/kdev_t.h>
24#include <linux/major.h>
25#include <linux/console.h>
26#include <linux/delay.h>
27#include <linux/irq.h>
28#include <linux/seq_file.h>
29#include <linux/root_dev.h>
30#include <linux/serial.h>
31#include <linux/tty.h> /* for linux/serial_core.h */
32#include <linux/serial_core.h>
33#include <linux/initrd.h>
34#include <linux/module.h>
35#include <linux/fsl_devices.h>
36
37#include <asm/system.h>
38#include <asm/pgtable.h>
39#include <asm/page.h>
40#include <asm/atomic.h>
41#include <asm/time.h>
42#include <asm/io.h>
43#include <asm/machdep.h>
44#include <asm/prom.h>
45#include <asm/open_pic.h>
46#include <asm/bootinfo.h>
47#include <asm/pci-bridge.h>
48#include <asm/mpc85xx.h>
49#include <asm/irq.h>
50#include <asm/immap_85xx.h>
51#include <asm/kgdb.h>
52#include <asm/ppc_sys.h>
53#include <asm/cpm2.h>
54#include <mm/mmu_decl.h>
55
56#include <syslib/cpm2_pic.h>
57#include <syslib/ppc85xx_common.h>
58#include <syslib/ppc85xx_setup.h>
59
60extern void cpm2_reset(void);
61
62/* ************************************************************************
63 *
64 * Setup the architecture
65 *
66 */
67
68static void __init
69mpc8560ads_setup_arch(void)
70{
71 bd_t *binfo = (bd_t *) __res;
72 unsigned int freq;
73 struct gianfar_platform_data *pdata;
74
75 cpm2_reset();
76
77 /* get the core frequency */
78 freq = binfo->bi_intfreq;
79
80 if (ppc_md.progress)
81 ppc_md.progress("mpc8560ads_setup_arch()", 0);
82
83 /* Set loops_per_jiffy to a half-way reasonable value,
84 for use until calibrate_delay gets called. */
85 loops_per_jiffy = freq / HZ;
86
87#ifdef CONFIG_PCI
88 /* setup PCI host bridges */
89 mpc85xx_setup_hose();
90#endif
91
92 /* setup the board related information for the enet controllers */
93 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1);
94 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
95 pdata->interruptPHY = MPC85xx_IRQ_EXT5;
96 pdata->phyid = 0;
97 /* fixup phy address */
98 pdata->phy_reg_addr += binfo->bi_immr_base;
99 memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6);
100
101 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC2);
102 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
103 pdata->interruptPHY = MPC85xx_IRQ_EXT5;
104 pdata->phyid = 1;
105 /* fixup phy address */
106 pdata->phy_reg_addr += binfo->bi_immr_base;
107 memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6);
108
109#ifdef CONFIG_BLK_DEV_INITRD
110 if (initrd_start)
111 ROOT_DEV = Root_RAM0;
112 else
113#endif
114#ifdef CONFIG_ROOT_NFS
115 ROOT_DEV = Root_NFS;
116#else
117 ROOT_DEV = Root_HDA1;
118#endif
119}
120
121static irqreturn_t cpm2_cascade(int irq, void *dev_id, struct pt_regs *regs)
122{
123 while ((irq = cpm2_get_irq(regs)) >= 0)
124 __do_IRQ(irq, regs);
125 return IRQ_HANDLED;
126}
127
128static struct irqaction cpm2_irqaction = {
129 .handler = cpm2_cascade,
130 .flags = SA_INTERRUPT,
131 .mask = CPU_MASK_NONE,
132 .name = "cpm2_cascade",
133};
134
135static void __init
136mpc8560_ads_init_IRQ(void)
137{
138 /* Setup OpenPIC */
139 mpc85xx_ads_init_IRQ();
140
141 /* Setup CPM2 PIC */
142 cpm2_init_IRQ();
143
144 setup_irq(MPC85xx_IRQ_CPM, &cpm2_irqaction);
145
146 return;
147}
148
149
150
151/* ************************************************************************ */
152void __init
153platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
154 unsigned long r6, unsigned long r7)
155{
156 /* parse_bootinfo must always be called first */
157 parse_bootinfo(find_bootinfo());
158
159 /*
160 * If we were passed in a board information, copy it into the
161 * residual data area.
162 */
163 if (r3) {
164 memcpy((void *) __res, (void *) (r3 + KERNELBASE),
165 sizeof (bd_t));
166
167 }
168#if defined(CONFIG_BLK_DEV_INITRD)
169 /*
170 * If the init RAM disk has been configured in, and there's a valid
171 * starting address for it, set it up.
172 */
173 if (r4) {
174 initrd_start = r4 + KERNELBASE;
175 initrd_end = r5 + KERNELBASE;
176 }
177#endif /* CONFIG_BLK_DEV_INITRD */
178
179 /* Copy the kernel command line arguments to a safe place. */
180
181 if (r6) {
182 *(char *) (r7 + KERNELBASE) = 0;
183 strcpy(cmd_line, (char *) (r6 + KERNELBASE));
184 }
185
186 identify_ppc_sys_by_id(mfspr(SPRN_SVR));
187
188 /* setup the PowerPC module struct */
189 ppc_md.setup_arch = mpc8560ads_setup_arch;
190 ppc_md.show_cpuinfo = mpc85xx_ads_show_cpuinfo;
191
192 ppc_md.init_IRQ = mpc8560_ads_init_IRQ;
193 ppc_md.get_irq = openpic_get_irq;
194
195 ppc_md.restart = mpc85xx_restart;
196 ppc_md.power_off = mpc85xx_power_off;
197 ppc_md.halt = mpc85xx_halt;
198
199 ppc_md.find_end_of_memory = mpc85xx_find_end_of_memory;
200
201 ppc_md.time_init = NULL;
202 ppc_md.set_rtc_time = NULL;
203 ppc_md.get_rtc_time = NULL;
204 ppc_md.calibrate_decr = mpc85xx_calibrate_decr;
205
206 if (ppc_md.progress)
207 ppc_md.progress("mpc8560ads_init(): exit", 0);
208
209 return;
210}
diff --git a/arch/ppc/platforms/85xx/mpc8560_ads.h b/arch/ppc/platforms/85xx/mpc8560_ads.h
new file mode 100644
index 000000000000..7df885d73e9d
--- /dev/null
+++ b/arch/ppc/platforms/85xx/mpc8560_ads.h
@@ -0,0 +1,27 @@
1/*
2 * arch/ppc/platforms/mpc8560_ads.h
3 *
4 * MPC8540ADS board definitions
5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com>
7 *
8 * Copyright 2004 Freescale Semiconductor Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 */
16
17#ifndef __MACH_MPC8560ADS_H
18#define __MACH_MPC8560ADS_H
19
20#include <linux/config.h>
21#include <syslib/ppc85xx_setup.h>
22#include <platforms/85xx/mpc85xx_ads_common.h>
23
24#define CPM_MAP_ADDR (CCSRBAR + MPC85xx_CPM_OFFSET)
25#define PHY_INTERRUPT MPC85xx_IRQ_EXT7
26
27#endif /* __MACH_MPC8560ADS_H */
diff --git a/arch/ppc/platforms/85xx/mpc85xx_ads_common.c b/arch/ppc/platforms/85xx/mpc85xx_ads_common.c
new file mode 100644
index 000000000000..ba9f9f562c45
--- /dev/null
+++ b/arch/ppc/platforms/85xx/mpc85xx_ads_common.c
@@ -0,0 +1,225 @@
1/*
2 * arch/ppc/platforms/85xx/mpc85xx_ads_common.c
3 *
4 * MPC85xx ADS board common routines
5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com>
7 *
8 * Copyright 2004 Freescale Semiconductor Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15
16#include <linux/config.h>
17#include <linux/stddef.h>
18#include <linux/kernel.h>
19#include <linux/init.h>
20#include <linux/errno.h>
21#include <linux/reboot.h>
22#include <linux/pci.h>
23#include <linux/kdev_t.h>
24#include <linux/major.h>
25#include <linux/console.h>
26#include <linux/delay.h>
27#include <linux/irq.h>
28#include <linux/seq_file.h>
29#include <linux/serial.h>
30#include <linux/module.h>
31
32#include <asm/system.h>
33#include <asm/pgtable.h>
34#include <asm/page.h>
35#include <asm/atomic.h>
36#include <asm/time.h>
37#include <asm/io.h>
38#include <asm/machdep.h>
39#include <asm/prom.h>
40#include <asm/open_pic.h>
41#include <asm/bootinfo.h>
42#include <asm/pci-bridge.h>
43#include <asm/mpc85xx.h>
44#include <asm/irq.h>
45#include <asm/immap_85xx.h>
46#include <asm/ppc_sys.h>
47
48#include <mm/mmu_decl.h>
49
50#include <platforms/85xx/mpc85xx_ads_common.h>
51
52#ifndef CONFIG_PCI
53unsigned long isa_io_base = 0;
54unsigned long isa_mem_base = 0;
55#endif
56
57extern unsigned long total_memory; /* in mm/init */
58
59unsigned char __res[sizeof (bd_t)];
60
61/* Internal interrupts are all Level Sensitive, and Positive Polarity */
62
63static u_char mpc85xx_ads_openpic_initsenses[] __initdata = {
64 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 0: L2 Cache */
65 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 1: ECM */
66 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 2: DDR DRAM */
67 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 3: LBIU */
68 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 4: DMA 0 */
69 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 5: DMA 1 */
70 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 6: DMA 2 */
71 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 7: DMA 3 */
72 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 8: PCI/PCI-X */
73 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 9: RIO Inbound Port Write Error */
74 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 10: RIO Doorbell Inbound */
75 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 11: RIO Outbound Message */
76 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 12: RIO Inbound Message */
77 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 13: TSEC 0 Transmit */
78 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 14: TSEC 0 Receive */
79 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 15: Unused */
80 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 16: Unused */
81 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 17: Unused */
82 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 18: TSEC 0 Receive/Transmit Error */
83 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 19: TSEC 1 Transmit */
84 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 20: TSEC 1 Receive */
85 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 21: Unused */
86 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 22: Unused */
87 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 23: Unused */
88 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 24: TSEC 1 Receive/Transmit Error */
89 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 25: Fast Ethernet */
90 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 26: DUART */
91 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 27: I2C */
92 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 28: Performance Monitor */
93 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 29: Unused */
94 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 30: CPM */
95 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 31: Unused */
96 0x0, /* External 0: */
97#if defined(CONFIG_PCI)
98 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 1: PCI slot 0 */
99 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 2: PCI slot 1 */
100 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 3: PCI slot 2 */
101 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 4: PCI slot 3 */
102#else
103 0x0, /* External 1: */
104 0x0, /* External 2: */
105 0x0, /* External 3: */
106 0x0, /* External 4: */
107#endif
108 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 5: PHY */
109 0x0, /* External 6: */
110 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 7: PHY */
111 0x0, /* External 8: */
112 0x0, /* External 9: */
113 0x0, /* External 10: */
114 0x0, /* External 11: */
115};
116
117/* ************************************************************************ */
118int
119mpc85xx_ads_show_cpuinfo(struct seq_file *m)
120{
121 uint pvid, svid, phid1;
122 uint memsize = total_memory;
123 bd_t *binfo = (bd_t *) __res;
124 unsigned int freq;
125
126 /* get the core frequency */
127 freq = binfo->bi_intfreq;
128
129 pvid = mfspr(SPRN_PVR);
130 svid = mfspr(SPRN_SVR);
131
132 seq_printf(m, "Vendor\t\t: Freescale Semiconductor\n");
133 seq_printf(m, "Machine\t\t: mpc%sads\n", cur_ppc_sys_spec->ppc_sys_name);
134 seq_printf(m, "clock\t\t: %dMHz\n", freq / 1000000);
135 seq_printf(m, "PVR\t\t: 0x%x\n", pvid);
136 seq_printf(m, "SVR\t\t: 0x%x\n", svid);
137
138 /* Display cpu Pll setting */
139 phid1 = mfspr(SPRN_HID1);
140 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
141
142 /* Display the amount of memory */
143 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
144
145 return 0;
146}
147
148void __init
149mpc85xx_ads_init_IRQ(void)
150{
151 bd_t *binfo = (bd_t *) __res;
152 /* Determine the Physical Address of the OpenPIC regs */
153 phys_addr_t OpenPIC_PAddr =
154 binfo->bi_immr_base + MPC85xx_OPENPIC_OFFSET;
155 OpenPIC_Addr = ioremap(OpenPIC_PAddr, MPC85xx_OPENPIC_SIZE);
156 OpenPIC_InitSenses = mpc85xx_ads_openpic_initsenses;
157 OpenPIC_NumInitSenses = sizeof (mpc85xx_ads_openpic_initsenses);
158
159 /* Skip reserved space and internal sources */
160 openpic_set_sources(0, 32, OpenPIC_Addr + 0x10200);
161 /* Map PIC IRQs 0-11 */
162 openpic_set_sources(32, 12, OpenPIC_Addr + 0x10000);
163
164 /* we let openpic interrupts starting from an offset, to
165 * leave space for cascading interrupts underneath.
166 */
167 openpic_init(MPC85xx_OPENPIC_IRQ_OFFSET);
168
169 return;
170}
171
172#ifdef CONFIG_PCI
173/*
174 * interrupt routing
175 */
176
177int
178mpc85xx_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
179{
180 static char pci_irq_table[][4] =
181 /*
182 * This is little evil, but works around the fact
183 * that revA boards have IDSEL starting at 18
184 * and others boards (older) start at 12
185 *
186 * PCI IDSEL/INTPIN->INTLINE
187 * A B C D
188 */
189 {
190 {PIRQA, PIRQB, PIRQC, PIRQD}, /* IDSEL 2 */
191 {PIRQD, PIRQA, PIRQB, PIRQC},
192 {PIRQC, PIRQD, PIRQA, PIRQB},
193 {PIRQB, PIRQC, PIRQD, PIRQA}, /* IDSEL 5 */
194 {0, 0, 0, 0}, /* -- */
195 {0, 0, 0, 0}, /* -- */
196 {0, 0, 0, 0}, /* -- */
197 {0, 0, 0, 0}, /* -- */
198 {0, 0, 0, 0}, /* -- */
199 {0, 0, 0, 0}, /* -- */
200 {PIRQA, PIRQB, PIRQC, PIRQD}, /* IDSEL 12 */
201 {PIRQD, PIRQA, PIRQB, PIRQC},
202 {PIRQC, PIRQD, PIRQA, PIRQB},
203 {PIRQB, PIRQC, PIRQD, PIRQA}, /* IDSEL 15 */
204 {0, 0, 0, 0}, /* -- */
205 {0, 0, 0, 0}, /* -- */
206 {PIRQA, PIRQB, PIRQC, PIRQD}, /* IDSEL 18 */
207 {PIRQD, PIRQA, PIRQB, PIRQC},
208 {PIRQC, PIRQD, PIRQA, PIRQB},
209 {PIRQB, PIRQC, PIRQD, PIRQA}, /* IDSEL 21 */
210 };
211
212 const long min_idsel = 2, max_idsel = 21, irqs_per_slot = 4;
213 return PCI_IRQ_TABLE_LOOKUP;
214}
215
216int
217mpc85xx_exclude_device(u_char bus, u_char devfn)
218{
219 if (bus == 0 && PCI_SLOT(devfn) == 0)
220 return PCIBIOS_DEVICE_NOT_FOUND;
221 else
222 return PCIBIOS_SUCCESSFUL;
223}
224
225#endif /* CONFIG_PCI */
diff --git a/arch/ppc/platforms/85xx/mpc85xx_ads_common.h b/arch/ppc/platforms/85xx/mpc85xx_ads_common.h
new file mode 100644
index 000000000000..3875e839cff7
--- /dev/null
+++ b/arch/ppc/platforms/85xx/mpc85xx_ads_common.h
@@ -0,0 +1,50 @@
1/*
2 * arch/ppc/platforms/85xx/mpc85xx_ads_common.h
3 *
4 * MPC85XX ADS common board definitions
5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com>
7 *
8 * Copyright 2004 Freescale Semiconductor Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 */
16
17#ifndef __MACH_MPC85XX_ADS_H__
18#define __MACH_MPC85XX_ADS_H__
19
20#include <linux/config.h>
21#include <linux/init.h>
22#include <linux/seq_file.h>
23#include <asm/ppcboot.h>
24
25#define BOARD_CCSRBAR ((uint)0xe0000000)
26#define BCSR_ADDR ((uint)0xf8000000)
27#define BCSR_SIZE ((uint)(32 * 1024))
28
29extern int mpc85xx_ads_show_cpuinfo(struct seq_file *m);
30extern void mpc85xx_ads_init_IRQ(void) __init;
31extern void mpc85xx_ads_map_io(void) __init;
32
33/* PCI interrupt controller */
34#define PIRQA MPC85xx_IRQ_EXT1
35#define PIRQB MPC85xx_IRQ_EXT2
36#define PIRQC MPC85xx_IRQ_EXT3
37#define PIRQD MPC85xx_IRQ_EXT4
38
39#define MPC85XX_PCI1_LOWER_IO 0x00000000
40#define MPC85XX_PCI1_UPPER_IO 0x00ffffff
41
42#define MPC85XX_PCI1_LOWER_MEM 0x80000000
43#define MPC85XX_PCI1_UPPER_MEM 0x9fffffff
44
45#define MPC85XX_PCI1_IO_BASE 0xe2000000
46#define MPC85XX_PCI1_MEM_OFFSET 0x00000000
47
48#define MPC85XX_PCI1_IO_SIZE 0x01000000
49
50#endif /* __MACH_MPC85XX_ADS_H__ */
diff --git a/arch/ppc/platforms/85xx/mpc85xx_cds_common.c b/arch/ppc/platforms/85xx/mpc85xx_cds_common.c
new file mode 100644
index 000000000000..6c020d67ad70
--- /dev/null
+++ b/arch/ppc/platforms/85xx/mpc85xx_cds_common.c
@@ -0,0 +1,467 @@
1/*
2 * arch/ppc/platform/85xx/mpc85xx_cds_common.c
3 *
4 * MPC85xx CDS board specific routines
5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com>
7 *
8 * Copyright 2004 Freescale Semiconductor, Inc
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15
16#include <linux/config.h>
17#include <linux/stddef.h>
18#include <linux/kernel.h>
19#include <linux/init.h>
20#include <linux/errno.h>
21#include <linux/reboot.h>
22#include <linux/pci.h>
23#include <linux/kdev_t.h>
24#include <linux/major.h>
25#include <linux/console.h>
26#include <linux/delay.h>
27#include <linux/irq.h>
28#include <linux/seq_file.h>
29#include <linux/serial.h>
30#include <linux/module.h>
31#include <linux/root_dev.h>
32#include <linux/initrd.h>
33#include <linux/tty.h>
34#include <linux/serial_core.h>
35#include <linux/fsl_devices.h>
36
37#include <asm/system.h>
38#include <asm/pgtable.h>
39#include <asm/page.h>
40#include <asm/atomic.h>
41#include <asm/time.h>
42#include <asm/todc.h>
43#include <asm/io.h>
44#include <asm/machdep.h>
45#include <asm/prom.h>
46#include <asm/open_pic.h>
47#include <asm/bootinfo.h>
48#include <asm/pci-bridge.h>
49#include <asm/mpc85xx.h>
50#include <asm/irq.h>
51#include <asm/immap_85xx.h>
52#include <asm/immap_cpm2.h>
53#include <asm/ppc_sys.h>
54#include <asm/kgdb.h>
55
56#include <mm/mmu_decl.h>
57#include <syslib/cpm2_pic.h>
58#include <syslib/ppc85xx_common.h>
59#include <syslib/ppc85xx_setup.h>
60
61
62#ifndef CONFIG_PCI
63unsigned long isa_io_base = 0;
64unsigned long isa_mem_base = 0;
65#endif
66
67extern unsigned long total_memory; /* in mm/init */
68
69unsigned char __res[sizeof (bd_t)];
70
71static int cds_pci_slot = 2;
72static volatile u8 * cadmus;
73
74/* Internal interrupts are all Level Sensitive, and Positive Polarity */
75
76static u_char mpc85xx_cds_openpic_initsenses[] __initdata = {
77 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 0: L2 Cache */
78 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 1: ECM */
79 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 2: DDR DRAM */
80 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 3: LBIU */
81 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 4: DMA 0 */
82 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 5: DMA 1 */
83 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 6: DMA 2 */
84 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 7: DMA 3 */
85 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 8: PCI/PCI-X */
86 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 9: RIO Inbound Port Write Error */
87 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 10: RIO Doorbell Inbound */
88 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 11: RIO Outbound Message */
89 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 12: RIO Inbound Message */
90 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 13: TSEC 0 Transmit */
91 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 14: TSEC 0 Receive */
92 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 15: Unused */
93 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 16: Unused */
94 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 17: Unused */
95 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 18: TSEC 0 Receive/Transmit Error */
96 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 19: TSEC 1 Transmit */
97 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 20: TSEC 1 Receive */
98 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 21: Unused */
99 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 22: Unused */
100 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 23: Unused */
101 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 24: TSEC 1 Receive/Transmit Error */
102 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 25: Fast Ethernet */
103 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 26: DUART */
104 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 27: I2C */
105 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 28: Performance Monitor */
106 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 29: Unused */
107 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 30: CPM */
108 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 31: Unused */
109#if defined(CONFIG_PCI)
110 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 0: PCI1 slot */
111 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 1: PCI1 slot */
112 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 2: PCI1 slot */
113 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 3: PCI1 slot */
114#else
115 0x0, /* External 0: */
116 0x0, /* External 1: */
117 0x0, /* External 2: */
118 0x0, /* External 3: */
119#endif
120 0x0, /* External 4: */
121 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 5: PHY */
122 0x0, /* External 6: */
123 0x0, /* External 7: */
124 0x0, /* External 8: */
125 0x0, /* External 9: */
126 0x0, /* External 10: */
127#if defined(CONFIG_85xx_PCI2) && defined(CONFIG_PCI)
128 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 11: PCI2 slot 0 */
129#else
130 0x0, /* External 11: */
131#endif
132};
133
134/* ************************************************************************ */
135int
136mpc85xx_cds_show_cpuinfo(struct seq_file *m)
137{
138 uint pvid, svid, phid1;
139 uint memsize = total_memory;
140 bd_t *binfo = (bd_t *) __res;
141 unsigned int freq;
142
143 /* get the core frequency */
144 freq = binfo->bi_intfreq;
145
146 pvid = mfspr(SPRN_PVR);
147 svid = mfspr(SPRN_SVR);
148
149 seq_printf(m, "Vendor\t\t: Freescale Semiconductor\n");
150 seq_printf(m, "Machine\t\t: CDS - MPC%s (%x)\n", cur_ppc_sys_spec->ppc_sys_name, cadmus[CM_VER]);
151 seq_printf(m, "clock\t\t: %dMHz\n", freq / 1000000);
152 seq_printf(m, "PVR\t\t: 0x%x\n", pvid);
153 seq_printf(m, "SVR\t\t: 0x%x\n", svid);
154
155 /* Display cpu Pll setting */
156 phid1 = mfspr(SPRN_HID1);
157 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
158
159 /* Display the amount of memory */
160 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
161
162 return 0;
163}
164
165#ifdef CONFIG_CPM2
166static void cpm2_cascade(int irq, void *dev_id, struct pt_regs *regs)
167{
168 while((irq = cpm2_get_irq(regs)) >= 0)
169 __do_IRQ(irq, regs);
170}
171
172static struct irqaction cpm2_irqaction = {
173 .handler = cpm2_cascade,
174 .flags = SA_INTERRUPT,
175 .mask = CPU_MASK_NONE,
176 .name = "cpm2_cascade",
177};
178#endif /* CONFIG_CPM2 */
179
180void __init
181mpc85xx_cds_init_IRQ(void)
182{
183 bd_t *binfo = (bd_t *) __res;
184
185 /* Determine the Physical Address of the OpenPIC regs */
186 phys_addr_t OpenPIC_PAddr = binfo->bi_immr_base + MPC85xx_OPENPIC_OFFSET;
187 OpenPIC_Addr = ioremap(OpenPIC_PAddr, MPC85xx_OPENPIC_SIZE);
188 OpenPIC_InitSenses = mpc85xx_cds_openpic_initsenses;
189 OpenPIC_NumInitSenses = sizeof (mpc85xx_cds_openpic_initsenses);
190
191 /* Skip reserved space and internal sources */
192 openpic_set_sources(0, 32, OpenPIC_Addr + 0x10200);
193 /* Map PIC IRQs 0-11 */
194 openpic_set_sources(32, 12, OpenPIC_Addr + 0x10000);
195
196 /* we let openpic interrupts starting from an offset, to
197 * leave space for cascading interrupts underneath.
198 */
199 openpic_init(MPC85xx_OPENPIC_IRQ_OFFSET);
200
201#ifdef CONFIG_CPM2
202 /* Setup CPM2 PIC */
203 cpm2_init_IRQ();
204
205 setup_irq(MPC85xx_IRQ_CPM, &cpm2_irqaction);
206#endif
207
208 return;
209}
210
211#ifdef CONFIG_PCI
212/*
213 * interrupt routing
214 */
215int
216mpc85xx_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
217{
218 struct pci_controller *hose = pci_bus_to_hose(dev->bus->number);
219
220 if (!hose->index)
221 {
222 /* Handle PCI1 interrupts */
223 char pci_irq_table[][4] =
224 /*
225 * PCI IDSEL/INTPIN->INTLINE
226 * A B C D
227 */
228
229 /* Note IRQ assignment for slots is based on which slot the elysium is
230 * in -- in this setup elysium is in slot #2 (this PIRQA as first
231 * interrupt on slot */
232 {
233 { 0, 1, 2, 3 }, /* 16 - PMC */
234 { 3, 0, 0, 0 }, /* 17 P2P (Tsi320) */
235 { 0, 1, 2, 3 }, /* 18 - Slot 1 */
236 { 1, 2, 3, 0 }, /* 19 - Slot 2 */
237 { 2, 3, 0, 1 }, /* 20 - Slot 3 */
238 { 3, 0, 1, 2 }, /* 21 - Slot 4 */
239 };
240
241 const long min_idsel = 16, max_idsel = 21, irqs_per_slot = 4;
242 int i, j;
243
244 for (i = 0; i < 6; i++)
245 for (j = 0; j < 4; j++)
246 pci_irq_table[i][j] =
247 ((pci_irq_table[i][j] + 5 -
248 cds_pci_slot) & 0x3) + PIRQ0A;
249
250 return PCI_IRQ_TABLE_LOOKUP;
251 } else {
252 /* Handle PCI2 interrupts (if we have one) */
253 char pci_irq_table[][4] =
254 {
255 /*
256 * We only have one slot and one interrupt
257 * going to PIRQA - PIRQD */
258 { PIRQ1A, PIRQ1A, PIRQ1A, PIRQ1A }, /* 21 - slot 0 */
259 };
260
261 const long min_idsel = 21, max_idsel = 21, irqs_per_slot = 4;
262
263 return PCI_IRQ_TABLE_LOOKUP;
264 }
265}
266
267#define ARCADIA_HOST_BRIDGE_IDSEL 17
268#define ARCADIA_2ND_BRIDGE_IDSEL 3
269
270extern int mpc85xx_pci1_last_busno;
271
272int
273mpc85xx_exclude_device(u_char bus, u_char devfn)
274{
275 if (bus == 0 && PCI_SLOT(devfn) == 0)
276 return PCIBIOS_DEVICE_NOT_FOUND;
277#ifdef CONFIG_85xx_PCI2
278 if (mpc85xx_pci1_last_busno)
279 if (bus == (mpc85xx_pci1_last_busno + 1) && PCI_SLOT(devfn) == 0)
280 return PCIBIOS_DEVICE_NOT_FOUND;
281#endif
282 /* We explicitly do not go past the Tundra 320 Bridge */
283 if (bus == 1)
284 return PCIBIOS_DEVICE_NOT_FOUND;
285 if ((bus == 0) && (PCI_SLOT(devfn) == ARCADIA_2ND_BRIDGE_IDSEL))
286 return PCIBIOS_DEVICE_NOT_FOUND;
287 else
288 return PCIBIOS_SUCCESSFUL;
289}
290#endif /* CONFIG_PCI */
291
292TODC_ALLOC();
293
294/* ************************************************************************
295 *
296 * Setup the architecture
297 *
298 */
299static void __init
300mpc85xx_cds_setup_arch(void)
301{
302 bd_t *binfo = (bd_t *) __res;
303 unsigned int freq;
304 struct gianfar_platform_data *pdata;
305
306 /* get the core frequency */
307 freq = binfo->bi_intfreq;
308
309 printk("mpc85xx_cds_setup_arch\n");
310
311#ifdef CONFIG_CPM2
312 cpm2_reset();
313#endif
314
315 cadmus = ioremap(CADMUS_BASE, CADMUS_SIZE);
316 cds_pci_slot = ((cadmus[CM_CSR] >> 6) & 0x3) + 1;
317 printk("CDS Version = %x in PCI slot %d\n", cadmus[CM_VER], cds_pci_slot);
318
319 /* Setup TODC access */
320 TODC_INIT(TODC_TYPE_DS1743,
321 0,
322 0,
323 ioremap(CDS_RTC_ADDR, CDS_RTC_SIZE),
324 8);
325
326 /* Set loops_per_jiffy to a half-way reasonable value,
327 for use until calibrate_delay gets called. */
328 loops_per_jiffy = freq / HZ;
329
330#ifdef CONFIG_PCI
331 /* setup PCI host bridges */
332 mpc85xx_setup_hose();
333#endif
334
335#ifdef CONFIG_SERIAL_8250
336 mpc85xx_early_serial_map();
337#endif
338
339#ifdef CONFIG_SERIAL_TEXT_DEBUG
340 /* Invalidate the entry we stole earlier the serial ports
341 * should be properly mapped */
342 invalidate_tlbcam_entry(NUM_TLBCAMS - 1);
343#endif
344
345 /* setup the board related information for the enet controllers */
346 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1);
347 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
348 pdata->interruptPHY = MPC85xx_IRQ_EXT5;
349 pdata->phyid = 0;
350 /* fixup phy address */
351 pdata->phy_reg_addr += binfo->bi_immr_base;
352 memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6);
353
354 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC2);
355 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
356 pdata->interruptPHY = MPC85xx_IRQ_EXT5;
357 pdata->phyid = 1;
358 /* fixup phy address */
359 pdata->phy_reg_addr += binfo->bi_immr_base;
360 memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6);
361
362
363#ifdef CONFIG_BLK_DEV_INITRD
364 if (initrd_start)
365 ROOT_DEV = Root_RAM0;
366 else
367#endif
368#ifdef CONFIG_ROOT_NFS
369 ROOT_DEV = Root_NFS;
370#else
371 ROOT_DEV = Root_HDA1;
372#endif
373}
374
375/* ************************************************************************ */
376void __init
377platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
378 unsigned long r6, unsigned long r7)
379{
380 /* parse_bootinfo must always be called first */
381 parse_bootinfo(find_bootinfo());
382
383 /*
384 * If we were passed in a board information, copy it into the
385 * residual data area.
386 */
387 if (r3) {
388 memcpy((void *) __res, (void *) (r3 + KERNELBASE),
389 sizeof (bd_t));
390
391 }
392#ifdef CONFIG_SERIAL_TEXT_DEBUG
393 {
394 bd_t *binfo = (bd_t *) __res;
395 struct uart_port p;
396
397 /* Use the last TLB entry to map CCSRBAR to allow access to DUART regs */
398 settlbcam(NUM_TLBCAMS - 1, binfo->bi_immr_base,
399 binfo->bi_immr_base, MPC85xx_CCSRBAR_SIZE, _PAGE_IO, 0);
400
401 memset(&p, 0, sizeof (p));
402 p.iotype = SERIAL_IO_MEM;
403 p.membase = (void *) binfo->bi_immr_base + MPC85xx_UART0_OFFSET;
404 p.uartclk = binfo->bi_busfreq;
405
406 gen550_init(0, &p);
407
408 memset(&p, 0, sizeof (p));
409 p.iotype = SERIAL_IO_MEM;
410 p.membase = (void *) binfo->bi_immr_base + MPC85xx_UART1_OFFSET;
411 p.uartclk = binfo->bi_busfreq;
412
413 gen550_init(1, &p);
414 }
415#endif
416
417#if defined(CONFIG_BLK_DEV_INITRD)
418 /*
419 * If the init RAM disk has been configured in, and there's a valid
420 * starting address for it, set it up.
421 */
422 if (r4) {
423 initrd_start = r4 + KERNELBASE;
424 initrd_end = r5 + KERNELBASE;
425 }
426#endif /* CONFIG_BLK_DEV_INITRD */
427
428 /* Copy the kernel command line arguments to a safe place. */
429
430 if (r6) {
431 *(char *) (r7 + KERNELBASE) = 0;
432 strcpy(cmd_line, (char *) (r6 + KERNELBASE));
433 }
434
435 identify_ppc_sys_by_id(mfspr(SPRN_SVR));
436
437 /* setup the PowerPC module struct */
438 ppc_md.setup_arch = mpc85xx_cds_setup_arch;
439 ppc_md.show_cpuinfo = mpc85xx_cds_show_cpuinfo;
440
441 ppc_md.init_IRQ = mpc85xx_cds_init_IRQ;
442 ppc_md.get_irq = openpic_get_irq;
443
444 ppc_md.restart = mpc85xx_restart;
445 ppc_md.power_off = mpc85xx_power_off;
446 ppc_md.halt = mpc85xx_halt;
447
448 ppc_md.find_end_of_memory = mpc85xx_find_end_of_memory;
449
450 ppc_md.calibrate_decr = mpc85xx_calibrate_decr;
451
452 ppc_md.time_init = todc_time_init;
453 ppc_md.set_rtc_time = todc_set_rtc_time;
454 ppc_md.get_rtc_time = todc_get_rtc_time;
455
456 ppc_md.nvram_read_val = todc_direct_read_val;
457 ppc_md.nvram_write_val = todc_direct_write_val;
458
459#if defined(CONFIG_SERIAL_8250) && defined(CONFIG_SERIAL_TEXT_DEBUG)
460 ppc_md.progress = gen550_progress;
461#endif /* CONFIG_SERIAL_8250 && CONFIG_SERIAL_TEXT_DEBUG */
462
463 if (ppc_md.progress)
464 ppc_md.progress("mpc85xx_cds_init(): exit", 0);
465
466 return;
467}
diff --git a/arch/ppc/platforms/85xx/mpc85xx_cds_common.h b/arch/ppc/platforms/85xx/mpc85xx_cds_common.h
new file mode 100644
index 000000000000..7627d77504bd
--- /dev/null
+++ b/arch/ppc/platforms/85xx/mpc85xx_cds_common.h
@@ -0,0 +1,80 @@
1/*
2 * arch/ppc/platforms/85xx/mpc85xx_cds_common.h
3 *
4 * MPC85xx CDS board definitions
5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com>
7 *
8 * Copyright 2004 Freescale Semiconductor, Inc
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 */
16
17#ifndef __MACH_MPC85XX_CDS_H__
18#define __MACH_MPC85XX_CDS_H__
19
20#include <linux/config.h>
21#include <linux/serial.h>
22#include <asm/ppcboot.h>
23#include <linux/initrd.h>
24#include <syslib/ppc85xx_setup.h>
25
26#define BOARD_CCSRBAR ((uint)0xe0000000)
27#define CCSRBAR_SIZE ((uint)1024*1024)
28
29/* CADMUS info */
30#define CADMUS_BASE (0xf8004000)
31#define CADMUS_SIZE (256)
32#define CM_VER (0)
33#define CM_CSR (1)
34#define CM_RST (2)
35
36/* CDS NVRAM/RTC */
37#define CDS_RTC_ADDR (0xf8000000)
38#define CDS_RTC_SIZE (8 * 1024)
39
40/* PCI config */
41#define PCI1_CFG_ADDR_OFFSET (0x8000)
42#define PCI1_CFG_DATA_OFFSET (0x8004)
43
44#define PCI2_CFG_ADDR_OFFSET (0x9000)
45#define PCI2_CFG_DATA_OFFSET (0x9004)
46
47/* PCI interrupt controller */
48#define PIRQ0A MPC85xx_IRQ_EXT0
49#define PIRQ0B MPC85xx_IRQ_EXT1
50#define PIRQ0C MPC85xx_IRQ_EXT2
51#define PIRQ0D MPC85xx_IRQ_EXT3
52#define PIRQ1A MPC85xx_IRQ_EXT11
53
54/* PCI 1 memory map */
55#define MPC85XX_PCI1_LOWER_IO 0x00000000
56#define MPC85XX_PCI1_UPPER_IO 0x00ffffff
57
58#define MPC85XX_PCI1_LOWER_MEM 0x80000000
59#define MPC85XX_PCI1_UPPER_MEM 0x9fffffff
60
61#define MPC85XX_PCI1_IO_BASE 0xe2000000
62#define MPC85XX_PCI1_MEM_OFFSET 0x00000000
63
64#define MPC85XX_PCI1_IO_SIZE 0x01000000
65
66/* PCI 2 memory map */
67/* Note: the standard PPC fixups will cause IO space to get bumped by
68 * hose->io_base_virt - isa_io_base => MPC85XX_PCI1_IO_SIZE */
69#define MPC85XX_PCI2_LOWER_IO 0x00000000
70#define MPC85XX_PCI2_UPPER_IO 0x00ffffff
71
72#define MPC85XX_PCI2_LOWER_MEM 0xa0000000
73#define MPC85XX_PCI2_UPPER_MEM 0xbfffffff
74
75#define MPC85XX_PCI2_IO_BASE 0xe3000000
76#define MPC85XX_PCI2_MEM_OFFSET 0x00000000
77
78#define MPC85XX_PCI2_IO_SIZE 0x01000000
79
80#endif /* __MACH_MPC85XX_CDS_H__ */
diff --git a/arch/ppc/platforms/85xx/sbc8560.c b/arch/ppc/platforms/85xx/sbc8560.c
new file mode 100644
index 000000000000..9ab05e590c3e
--- /dev/null
+++ b/arch/ppc/platforms/85xx/sbc8560.c
@@ -0,0 +1,227 @@
1/*
2 * arch/ppc/platforms/85xx/sbc8560.c
3 *
4 * Wind River SBC8560 board specific routines
5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com>
7 *
8 * Copyright 2004 Freescale Semiconductor Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15
16#include <linux/config.h>
17#include <linux/stddef.h>
18#include <linux/kernel.h>
19#include <linux/init.h>
20#include <linux/errno.h>
21#include <linux/reboot.h>
22#include <linux/pci.h>
23#include <linux/kdev_t.h>
24#include <linux/major.h>
25#include <linux/console.h>
26#include <linux/delay.h>
27#include <linux/irq.h>
28#include <linux/seq_file.h>
29#include <linux/root_dev.h>
30#include <linux/serial.h>
31#include <linux/tty.h> /* for linux/serial_core.h */
32#include <linux/serial_core.h>
33#include <linux/initrd.h>
34#include <linux/module.h>
35#include <linux/fsl_devices.h>
36
37#include <asm/system.h>
38#include <asm/pgtable.h>
39#include <asm/page.h>
40#include <asm/atomic.h>
41#include <asm/time.h>
42#include <asm/io.h>
43#include <asm/machdep.h>
44#include <asm/prom.h>
45#include <asm/open_pic.h>
46#include <asm/bootinfo.h>
47#include <asm/pci-bridge.h>
48#include <asm/mpc85xx.h>
49#include <asm/irq.h>
50#include <asm/immap_85xx.h>
51#include <asm/kgdb.h>
52#include <asm/ppc_sys.h>
53#include <mm/mmu_decl.h>
54
55#include <syslib/ppc85xx_common.h>
56#include <syslib/ppc85xx_setup.h>
57
58#ifdef CONFIG_SERIAL_8250
59static void __init
60sbc8560_early_serial_map(void)
61{
62 struct uart_port uart_req;
63
64 /* Setup serial port access */
65 memset(&uart_req, 0, sizeof (uart_req));
66 uart_req.irq = MPC85xx_IRQ_EXT9;
67 uart_req.flags = STD_COM_FLAGS;
68 uart_req.uartclk = BASE_BAUD * 16;
69 uart_req.iotype = SERIAL_IO_MEM;
70 uart_req.mapbase = UARTA_ADDR;
71 uart_req.membase = ioremap(uart_req.mapbase, MPC85xx_UART0_SIZE);
72 uart_req.type = PORT_16650;
73
74#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
75 gen550_init(0, &uart_req);
76#endif
77
78 if (early_serial_setup(&uart_req) != 0)
79 printk("Early serial init of port 0 failed\n");
80
81 /* Assume early_serial_setup() doesn't modify uart_req */
82 uart_req.line = 1;
83 uart_req.mapbase = UARTB_ADDR;
84 uart_req.membase = ioremap(uart_req.mapbase, MPC85xx_UART1_SIZE);
85 uart_req.irq = MPC85xx_IRQ_EXT10;
86
87#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
88 gen550_init(1, &uart_req);
89#endif
90
91 if (early_serial_setup(&uart_req) != 0)
92 printk("Early serial init of port 1 failed\n");
93}
94#endif
95
96/* ************************************************************************
97 *
98 * Setup the architecture
99 *
100 */
101static void __init
102sbc8560_setup_arch(void)
103{
104 bd_t *binfo = (bd_t *) __res;
105 unsigned int freq;
106 struct gianfar_platform_data *pdata;
107
108 /* get the core frequency */
109 freq = binfo->bi_intfreq;
110
111 if (ppc_md.progress)
112 ppc_md.progress("sbc8560_setup_arch()", 0);
113
114 /* Set loops_per_jiffy to a half-way reasonable value,
115 for use until calibrate_delay gets called. */
116 loops_per_jiffy = freq / HZ;
117
118#ifdef CONFIG_PCI
119 /* setup PCI host bridges */
120 mpc85xx_setup_hose();
121#endif
122#ifdef CONFIG_SERIAL_8250
123 sbc8560_early_serial_map();
124#endif
125#ifdef CONFIG_SERIAL_TEXT_DEBUG
126 /* Invalidate the entry we stole earlier the serial ports
127 * should be properly mapped */
128 invalidate_tlbcam_entry(NUM_TLBCAMS - 1);
129#endif
130
131 /* setup the board related information for the enet controllers */
132 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1);
133 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
134 pdata->interruptPHY = MPC85xx_IRQ_EXT6;
135 pdata->phyid = 25;
136 /* fixup phy address */
137 pdata->phy_reg_addr += binfo->bi_immr_base;
138 memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6);
139
140 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC2);
141 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
142 pdata->interruptPHY = MPC85xx_IRQ_EXT7;
143 pdata->phyid = 26;
144 /* fixup phy address */
145 pdata->phy_reg_addr += binfo->bi_immr_base;
146 memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6);
147
148#ifdef CONFIG_BLK_DEV_INITRD
149 if (initrd_start)
150 ROOT_DEV = Root_RAM0;
151 else
152#endif
153#ifdef CONFIG_ROOT_NFS
154 ROOT_DEV = Root_NFS;
155#else
156 ROOT_DEV = Root_HDA1;
157#endif
158}
159
160/* ************************************************************************ */
161void __init
162platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
163 unsigned long r6, unsigned long r7)
164{
165 /* parse_bootinfo must always be called first */
166 parse_bootinfo(find_bootinfo());
167
168 /*
169 * If we were passed in a board information, copy it into the
170 * residual data area.
171 */
172 if (r3) {
173 memcpy((void *) __res, (void *) (r3 + KERNELBASE),
174 sizeof (bd_t));
175 }
176
177#ifdef CONFIG_SERIAL_TEXT_DEBUG
178 /* Use the last TLB entry to map CCSRBAR to allow access to DUART regs */
179 settlbcam(NUM_TLBCAMS - 1, UARTA_ADDR,
180 UARTA_ADDR, 0x1000, _PAGE_IO, 0);
181#endif
182
183#if defined(CONFIG_BLK_DEV_INITRD)
184 /*
185 * If the init RAM disk has been configured in, and there's a valid
186 * starting address for it, set it up.
187 */
188 if (r4) {
189 initrd_start = r4 + KERNELBASE;
190 initrd_end = r5 + KERNELBASE;
191 }
192#endif /* CONFIG_BLK_DEV_INITRD */
193
194 /* Copy the kernel command line arguments to a safe place. */
195
196 if (r6) {
197 *(char *) (r7 + KERNELBASE) = 0;
198 strcpy(cmd_line, (char *) (r6 + KERNELBASE));
199 }
200
201 identify_ppc_sys_by_id(mfspr(SPRN_SVR));
202
203 /* setup the PowerPC module struct */
204 ppc_md.setup_arch = sbc8560_setup_arch;
205 ppc_md.show_cpuinfo = sbc8560_show_cpuinfo;
206
207 ppc_md.init_IRQ = sbc8560_init_IRQ;
208 ppc_md.get_irq = openpic_get_irq;
209
210 ppc_md.restart = mpc85xx_restart;
211 ppc_md.power_off = mpc85xx_power_off;
212 ppc_md.halt = mpc85xx_halt;
213
214 ppc_md.find_end_of_memory = mpc85xx_find_end_of_memory;
215
216 ppc_md.time_init = NULL;
217 ppc_md.set_rtc_time = NULL;
218 ppc_md.get_rtc_time = NULL;
219 ppc_md.calibrate_decr = mpc85xx_calibrate_decr;
220
221#if defined(CONFIG_SERIAL_8250) && defined(CONFIG_SERIAL_TEXT_DEBUG)
222 ppc_md.progress = gen550_progress;
223#endif /* CONFIG_SERIAL_8250 && CONFIG_SERIAL_TEXT_DEBUG */
224
225 if (ppc_md.progress)
226 ppc_md.progress("sbc8560_init(): exit", 0);
227}
diff --git a/arch/ppc/platforms/85xx/sbc8560.h b/arch/ppc/platforms/85xx/sbc8560.h
new file mode 100644
index 000000000000..5e1b00c77da5
--- /dev/null
+++ b/arch/ppc/platforms/85xx/sbc8560.h
@@ -0,0 +1,49 @@
1/*
2 * arch/ppc/platforms/85xx/sbc8560.h
3 *
4 * Wind River SBC8560 board definitions
5 *
6 * Copyright 2003 Motorola Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 */
14
15#ifndef __MACH_SBC8560_H__
16#define __MACH_SBC8560_H__
17
18#include <linux/config.h>
19#include <platforms/85xx/sbc85xx.h>
20
21#define CPM_MAP_ADDR (CCSRBAR + MPC85xx_CPM_OFFSET)
22
23#ifdef CONFIG_SERIAL_MANY_PORTS
24#define RS_TABLE_SIZE 64
25#else
26#define RS_TABLE_SIZE 2
27#endif
28
29/* Rate for the 1.8432 Mhz clock for the onboard serial chip */
30#define BASE_BAUD ( 1843200 / 16 )
31
32#ifdef CONFIG_SERIAL_DETECT_IRQ
33#define STD_COM_FLAGS (ASYNC_SKIP_TEST|ASYNC_AUTO_IRQ)
34#else
35#define STD_COM_FLAGS (ASYNC_SKIP_TEST)
36#endif
37
38#define STD_SERIAL_PORT_DFNS \
39 { 0, BASE_BAUD, UARTA_ADDR, MPC85xx_IRQ_EXT9, STD_COM_FLAGS, /* ttyS0 */ \
40 iomem_base: (u8 *)UARTA_ADDR, \
41 io_type: SERIAL_IO_MEM }, \
42 { 0, BASE_BAUD, UARTB_ADDR, MPC85xx_IRQ_EXT10, STD_COM_FLAGS, /* ttyS1 */ \
43 iomem_base: (u8 *)UARTB_ADDR, \
44 io_type: SERIAL_IO_MEM },
45
46#define SERIAL_PORT_DFNS \
47 STD_SERIAL_PORT_DFNS
48
49#endif /* __MACH_SBC8560_H__ */
diff --git a/arch/ppc/platforms/85xx/sbc85xx.c b/arch/ppc/platforms/85xx/sbc85xx.c
new file mode 100644
index 000000000000..2d638c1c1bd6
--- /dev/null
+++ b/arch/ppc/platforms/85xx/sbc85xx.c
@@ -0,0 +1,203 @@
1/*
2 * arch/ppc/platform/85xx/sbc85xx.c
3 *
4 * WindRiver PowerQUICC III SBC85xx board common routines
5 *
6 * Copyright 2002, 2003 Motorola Inc.
7 * Copyright 2004 Red Hat, Inc.
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 */
14
15#include <linux/config.h>
16#include <linux/stddef.h>
17#include <linux/kernel.h>
18#include <linux/init.h>
19#include <linux/errno.h>
20#include <linux/reboot.h>
21#include <linux/pci.h>
22#include <linux/kdev_t.h>
23#include <linux/major.h>
24#include <linux/console.h>
25#include <linux/delay.h>
26#include <linux/irq.h>
27#include <linux/seq_file.h>
28#include <linux/serial.h>
29#include <linux/module.h>
30
31#include <asm/system.h>
32#include <asm/pgtable.h>
33#include <asm/page.h>
34#include <asm/atomic.h>
35#include <asm/time.h>
36#include <asm/io.h>
37#include <asm/machdep.h>
38#include <asm/prom.h>
39#include <asm/open_pic.h>
40#include <asm/bootinfo.h>
41#include <asm/pci-bridge.h>
42#include <asm/mpc85xx.h>
43#include <asm/irq.h>
44#include <asm/immap_85xx.h>
45#include <asm/ppc_sys.h>
46
47#include <mm/mmu_decl.h>
48
49#include <platforms/85xx/sbc85xx.h>
50
51unsigned char __res[sizeof (bd_t)];
52
53#ifndef CONFIG_PCI
54unsigned long isa_io_base = 0;
55unsigned long isa_mem_base = 0;
56unsigned long pci_dram_offset = 0;
57#endif
58
59extern unsigned long total_memory; /* in mm/init */
60
61/* Internal interrupts are all Level Sensitive, and Positive Polarity */
62
63static u_char sbc8560_openpic_initsenses[] __initdata = {
64 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 0: L2 Cache */
65 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 1: ECM */
66 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 2: DDR DRAM */
67 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 3: LBIU */
68 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 4: DMA 0 */
69 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 5: DMA 1 */
70 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 6: DMA 2 */
71 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 7: DMA 3 */
72 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 8: PCI/PCI-X */
73 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 9: RIO Inbound Port Write Error */
74 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 10: RIO Doorbell Inbound */
75 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 11: RIO Outbound Message */
76 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 12: RIO Inbound Message */
77 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 13: TSEC 0 Transmit */
78 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 14: TSEC 0 Receive */
79 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 15: Unused */
80 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 16: Unused */
81 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 17: Unused */
82 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 18: TSEC 0 Receive/Transmit Error */
83 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 19: TSEC 1 Transmit */
84 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 20: TSEC 1 Receive */
85 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 21: Unused */
86 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 22: Unused */
87 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 23: Unused */
88 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 24: TSEC 1 Receive/Transmit Error */
89 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 25: Fast Ethernet */
90 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 26: DUART */
91 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 27: I2C */
92 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 28: Performance Monitor */
93 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 29: Unused */
94 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 30: CPM */
95 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 31: Unused */
96 0x0, /* External 0: */
97 0x0, /* External 1: */
98#if defined(CONFIG_PCI)
99 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 2: PCI slot 0 */
100 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 3: PCI slot 1 */
101 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 4: PCI slot 2 */
102 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 5: PCI slot 3 */
103#else
104 0x0, /* External 2: */
105 0x0, /* External 3: */
106 0x0, /* External 4: */
107 0x0, /* External 5: */
108#endif
109 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 6: PHY */
110 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 7: PHY */
111 0x0, /* External 8: */
112 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* External 9: PHY */
113 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* External 10: PHY */
114 0x0, /* External 11: */
115};
116
117/* ************************************************************************ */
118int
119sbc8560_show_cpuinfo(struct seq_file *m)
120{
121 uint pvid, svid, phid1;
122 uint memsize = total_memory;
123 bd_t *binfo = (bd_t *) __res;
124 unsigned int freq;
125
126 /* get the core frequency */
127 freq = binfo->bi_intfreq;
128
129 pvid = mfspr(SPRN_PVR);
130 svid = mfspr(SPRN_SVR);
131
132 seq_printf(m, "Vendor\t\t: Wind River\n");
133 seq_printf(m, "Machine\t\t: SBC%s\n", cur_ppc_sys_spec->ppc_sys_name);
134 seq_printf(m, "clock\t\t: %dMHz\n", freq / 1000000);
135 seq_printf(m, "PVR\t\t: 0x%x\n", pvid);
136 seq_printf(m, "SVR\t\t: 0x%x\n", svid);
137
138 /* Display cpu Pll setting */
139 phid1 = mfspr(SPRN_HID1);
140 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
141
142 /* Display the amount of memory */
143 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
144
145 return 0;
146}
147
148void __init
149sbc8560_init_IRQ(void)
150{
151 bd_t *binfo = (bd_t *) __res;
152 /* Determine the Physical Address of the OpenPIC regs */
153 phys_addr_t OpenPIC_PAddr =
154 binfo->bi_immr_base + MPC85xx_OPENPIC_OFFSET;
155 OpenPIC_Addr = ioremap(OpenPIC_PAddr, MPC85xx_OPENPIC_SIZE);
156 OpenPIC_InitSenses = sbc8560_openpic_initsenses;
157 OpenPIC_NumInitSenses = sizeof (sbc8560_openpic_initsenses);
158
159 /* Skip reserved space and internal sources */
160 openpic_set_sources(0, 32, OpenPIC_Addr + 0x10200);
161 /* Map PIC IRQs 0-11 */
162 openpic_set_sources(32, 12, OpenPIC_Addr + 0x10000);
163
164 /* we let openpic interrupts starting from an offset, to
165 * leave space for cascading interrupts underneath.
166 */
167 openpic_init(MPC85xx_OPENPIC_IRQ_OFFSET);
168
169 return;
170}
171
172/*
173 * interrupt routing
174 */
175
176#ifdef CONFIG_PCI
177int mpc85xx_map_irq(struct pci_dev *dev, unsigned char idsel,
178 unsigned char pin)
179{
180 static char pci_irq_table[][4] =
181 /*
182 * PCI IDSEL/INTPIN->INTLINE
183 * A B C D
184 */
185 {
186 {PIRQA, PIRQB, PIRQC, PIRQD},
187 {PIRQD, PIRQA, PIRQB, PIRQC},
188 {PIRQC, PIRQD, PIRQA, PIRQB},
189 {PIRQB, PIRQC, PIRQD, PIRQA},
190 };
191
192 const long min_idsel = 12, max_idsel = 15, irqs_per_slot = 4;
193 return PCI_IRQ_TABLE_LOOKUP;
194}
195
196int mpc85xx_exclude_device(u_char bus, u_char devfn)
197{
198 if (bus == 0 && PCI_SLOT(devfn) == 0)
199 return PCIBIOS_DEVICE_NOT_FOUND;
200 else
201 return PCIBIOS_SUCCESSFUL;
202}
203#endif /* CONFIG_PCI */
diff --git a/arch/ppc/platforms/85xx/sbc85xx.h b/arch/ppc/platforms/85xx/sbc85xx.h
new file mode 100644
index 000000000000..7af93c691a6b
--- /dev/null
+++ b/arch/ppc/platforms/85xx/sbc85xx.h
@@ -0,0 +1,55 @@
1/*
2 * arch/ppc/platforms/85xx/sbc85xx.h
3 *
4 * WindRiver PowerQUICC III SBC85xx common board definitions
5 *
6 * Copyright 2003 Motorola Inc.
7 * Copyright 2004 Red Hat, Inc.
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 */
15
16#ifndef __PLATFORMS_85XX_SBC85XX_H__
17#define __PLATFORMS_85XX_SBC85XX_H__
18
19#include <linux/config.h>
20#include <linux/init.h>
21#include <linux/seq_file.h>
22#include <asm/ppcboot.h>
23
24#define BOARD_CCSRBAR ((uint)0xff700000)
25#define CCSRBAR_SIZE ((uint)1024*1024)
26
27#define BCSR_ADDR ((uint)0xfc000000)
28#define BCSR_SIZE ((uint)(16 * 1024 * 1024))
29
30#define UARTA_ADDR (BCSR_ADDR + 0x00700000)
31#define UARTB_ADDR (BCSR_ADDR + 0x00800000)
32#define RTC_DEVICE_ADDR (BCSR_ADDR + 0x00900000)
33#define EEPROM_ADDR (BCSR_ADDR + 0x00b00000)
34
35extern int sbc8560_show_cpuinfo(struct seq_file *m);
36extern void sbc8560_init_IRQ(void) __init;
37
38/* PCI interrupt controller */
39#define PIRQA MPC85xx_IRQ_EXT1
40#define PIRQB MPC85xx_IRQ_EXT2
41#define PIRQC MPC85xx_IRQ_EXT3
42#define PIRQD MPC85xx_IRQ_EXT4
43
44#define MPC85XX_PCI1_LOWER_IO 0x00000000
45#define MPC85XX_PCI1_UPPER_IO 0x00ffffff
46
47#define MPC85XX_PCI1_LOWER_MEM 0x80000000
48#define MPC85XX_PCI1_UPPER_MEM 0x9fffffff
49
50#define MPC85XX_PCI1_IO_BASE 0xe2000000
51#define MPC85XX_PCI1_MEM_OFFSET 0x00000000
52
53#define MPC85XX_PCI1_IO_SIZE 0x01000000
54
55#endif /* __PLATFORMS_85XX_SBC85XX_H__ */
diff --git a/arch/ppc/platforms/85xx/stx_gp3.c b/arch/ppc/platforms/85xx/stx_gp3.c
new file mode 100644
index 000000000000..bc95836e417c
--- /dev/null
+++ b/arch/ppc/platforms/85xx/stx_gp3.c
@@ -0,0 +1,355 @@
1/*
2 * arch/ppc/platforms/85xx/stx_gp3.c
3 *
4 * STx GP3 board specific routines
5 *
6 * Dan Malek <dan@embeddededge.com>
7 * Copyright 2004 Embedded Edge, LLC
8 *
9 * Copied from mpc8560_ads.c
10 * Copyright 2002, 2003 Motorola Inc.
11 *
12 * Ported to 2.6, Matt Porter <mporter@kernel.crashing.org>
13 * Copyright 2004-2005 MontaVista Software, Inc.
14 *
15 * This program is free software; you can redistribute it and/or modify it
16 * under the terms of the GNU General Public License as published by the
17 * Free Software Foundation; either version 2 of the License, or (at your
18 * option) any later version.
19 */
20
21#include <linux/config.h>
22#include <linux/stddef.h>
23#include <linux/kernel.h>
24#include <linux/init.h>
25#include <linux/errno.h>
26#include <linux/reboot.h>
27#include <linux/pci.h>
28#include <linux/kdev_t.h>
29#include <linux/major.h>
30#include <linux/blkdev.h>
31#include <linux/console.h>
32#include <linux/delay.h>
33#include <linux/irq.h>
34#include <linux/root_dev.h>
35#include <linux/seq_file.h>
36#include <linux/serial.h>
37#include <linux/initrd.h>
38#include <linux/module.h>
39#include <linux/fsl_devices.h>
40#include <linux/interrupt.h>
41
42#include <asm/system.h>
43#include <asm/pgtable.h>
44#include <asm/page.h>
45#include <asm/atomic.h>
46#include <asm/time.h>
47#include <asm/io.h>
48#include <asm/machdep.h>
49#include <asm/prom.h>
50#include <asm/open_pic.h>
51#include <asm/bootinfo.h>
52#include <asm/pci-bridge.h>
53#include <asm/mpc85xx.h>
54#include <asm/irq.h>
55#include <asm/immap_85xx.h>
56#include <asm/immap_cpm2.h>
57#include <asm/mpc85xx.h>
58#include <asm/ppc_sys.h>
59
60#include <syslib/cpm2_pic.h>
61#include <syslib/ppc85xx_common.h>
62
63extern void cpm2_reset(void);
64
65unsigned char __res[sizeof(bd_t)];
66
67#ifndef CONFIG_PCI
68unsigned long isa_io_base = 0;
69unsigned long isa_mem_base = 0;
70unsigned long pci_dram_offset = 0;
71#endif
72
73/* Internal interrupts are all Level Sensitive, and Positive Polarity */
74static u8 gp3_openpic_initsenses[] __initdata = {
75 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 0: L2 Cache */
76 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 1: ECM */
77 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 2: DDR DRAM */
78 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 3: LBIU */
79 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 4: DMA 0 */
80 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 5: DMA 1 */
81 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 6: DMA 2 */
82 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 7: DMA 3 */
83 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 8: PCI/PCI-X */
84 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 9: RIO Inbound Port Write Error */
85 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 10: RIO Doorbell Inbound */
86 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 11: RIO Outbound Message */
87 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 12: RIO Inbound Message */
88 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 13: TSEC 0 Transmit */
89 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 14: TSEC 0 Receive */
90 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 15: Unused */
91 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 16: Unused */
92 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 17: Unused */
93 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 18: TSEC 0 Receive/Transmit Error */
94 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 19: TSEC 1 Transmit */
95 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 20: TSEC 1 Receive */
96 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 21: Unused */
97 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 22: Unused */
98 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 23: Unused */
99 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 24: TSEC 1 Receive/Transmit Error */
100 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 25: Fast Ethernet */
101 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 26: DUART */
102 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 27: I2C */
103 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 28: Performance Monitor */
104 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 29: Unused */
105 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 30: CPM */
106 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 31: Unused */
107 0x0, /* External 0: */
108#if defined(CONFIG_PCI)
109 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 1: PCI slot 0 */
110 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 2: PCI slot 1 */
111 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 3: PCI slot 2 */
112 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 4: PCI slot 3 */
113#else
114 0x0, /* External 1: */
115 0x0, /* External 2: */
116 0x0, /* External 3: */
117 0x0, /* External 4: */
118#endif
119 0x0, /* External 5: */
120 0x0, /* External 6: */
121 0x0, /* External 7: */
122 0x0, /* External 8: */
123 0x0, /* External 9: */
124 0x0, /* External 10: */
125 0x0, /* External 11: */
126};
127
128/*
129 * Setup the architecture
130 */
131static void __init
132gp3_setup_arch(void)
133{
134 bd_t *binfo = (bd_t *) __res;
135 unsigned int freq;
136 struct gianfar_platform_data *pdata;
137
138 cpm2_reset();
139
140 /* get the core frequency */
141 freq = binfo->bi_intfreq;
142
143 if (ppc_md.progress)
144 ppc_md.progress("gp3_setup_arch()", 0);
145
146 /* Set loops_per_jiffy to a half-way reasonable value,
147 for use until calibrate_delay gets called. */
148 loops_per_jiffy = freq / HZ;
149
150#ifdef CONFIG_PCI
151 /* setup PCI host bridges */
152 mpc85xx_setup_hose();
153#endif
154
155 /* setup the board related information for the enet controllers */
156 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1);
157/* pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; */
158 pdata->interruptPHY = MPC85xx_IRQ_EXT5;
159 pdata->phyid = 2;
160 pdata->phy_reg_addr += binfo->bi_immr_base;
161 memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6);
162
163 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC2);
164/* pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; */
165 pdata->interruptPHY = MPC85xx_IRQ_EXT5;
166 pdata->phyid = 4;
167 /* fixup phy address */
168 pdata->phy_reg_addr += binfo->bi_immr_base;
169 memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6);
170
171#ifdef CONFIG_BLK_DEV_INITRD
172 if (initrd_start)
173 ROOT_DEV = Root_RAM0;
174 else
175#endif
176#ifdef CONFIG_ROOT_NFS
177 ROOT_DEV = Root_NFS;
178#else
179 ROOT_DEV = Root_HDA1;
180#endif
181
182 printk ("bi_immr_base = %8.8lx\n", binfo->bi_immr_base);
183}
184
185static irqreturn_t cpm2_cascade(int irq, void *dev_id, struct pt_regs *regs)
186{
187 while ((irq = cpm2_get_irq(regs)) >= 0)
188 __do_IRQ(irq, regs);
189
190 return IRQ_HANDLED;
191}
192
193static struct irqaction cpm2_irqaction = {
194 .handler = cpm2_cascade,
195 .flags = SA_INTERRUPT,
196 .mask = CPU_MASK_NONE,
197 .name = "cpm2_cascade",
198};
199
200static void __init
201gp3_init_IRQ(void)
202{
203 int i;
204 bd_t *binfo = (bd_t *) __res;
205
206 /*
207 * Setup OpenPIC
208 */
209
210 /* Determine the Physical Address of the OpenPIC regs */
211 phys_addr_t OpenPIC_PAddr =
212 binfo->bi_immr_base + MPC85xx_OPENPIC_OFFSET;
213 OpenPIC_Addr = ioremap(OpenPIC_PAddr, MPC85xx_OPENPIC_SIZE);
214 OpenPIC_InitSenses = gp3_openpic_initsenses;
215 OpenPIC_NumInitSenses = sizeof (gp3_openpic_initsenses);
216
217 /* Skip reserved space and internal sources */
218 openpic_set_sources(0, 32, OpenPIC_Addr + 0x10200);
219
220 /* Map PIC IRQs 0-11 */
221 openpic_set_sources(32, 12, OpenPIC_Addr + 0x10000);
222
223 /*
224 * Let openpic interrupts starting from an offset, to
225 * leave space for cascading interrupts underneath.
226 */
227 openpic_init(MPC85xx_OPENPIC_IRQ_OFFSET);
228
229 /* Setup CPM2 PIC */
230 cpm2_init_IRQ();
231
232 setup_irq(MPC85xx_IRQ_CPM, &cpm2_irqaction);
233
234 return;
235}
236
237static int
238gp3_show_cpuinfo(struct seq_file *m)
239{
240 uint pvid, svid, phid1;
241 bd_t *binfo = (bd_t *) __res;
242 uint memsize;
243 unsigned int freq;
244 extern unsigned long total_memory; /* in mm/init */
245
246 /* get the core frequency */
247 freq = binfo->bi_intfreq;
248
249 pvid = mfspr(SPRN_PVR);
250 svid = mfspr(SPRN_SVR);
251
252 memsize = total_memory;
253
254 seq_printf(m, "Vendor\t\t: RPC Electronics STx \n");
255 seq_printf(m, "Machine\t\t: GP3 - MPC%s\n", cur_ppc_sys_spec->ppc_sys_name);
256 seq_printf(m, "bus freq\t: %u.%.6u MHz\n", freq / 1000000,
257 freq % 1000000);
258 seq_printf(m, "PVR\t\t: 0x%x\n", pvid);
259 seq_printf(m, "SVR\t\t: 0x%x\n", svid);
260
261 /* Display cpu Pll setting */
262 phid1 = mfspr(SPRN_HID1);
263 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
264
265 /* Display the amount of memory */
266 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
267
268 return 0;
269}
270
271#ifdef CONFIG_PCI
272int mpc85xx_map_irq(struct pci_dev *dev, unsigned char idsel,
273 unsigned char pin)
274{
275 static char pci_irq_table[][4] =
276 /*
277 * PCI IDSEL/INTPIN->INTLINE
278 * A B C D
279 */
280 {
281 {PIRQA, PIRQB, PIRQC, PIRQD},
282 {PIRQD, PIRQA, PIRQB, PIRQC},
283 {PIRQC, PIRQD, PIRQA, PIRQB},
284 {PIRQB, PIRQC, PIRQD, PIRQA},
285 };
286
287 const long min_idsel = 12, max_idsel = 15, irqs_per_slot = 4;
288 return PCI_IRQ_TABLE_LOOKUP;
289}
290
291int mpc85xx_exclude_device(u_char bus, u_char devfn)
292{
293 if (bus == 0 && PCI_SLOT(devfn) == 0)
294 return PCIBIOS_DEVICE_NOT_FOUND;
295 else
296 return PCIBIOS_SUCCESSFUL;
297}
298#endif /* CONFIG_PCI */
299
300void __init
301platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
302 unsigned long r6, unsigned long r7)
303{
304 /* parse_bootinfo must always be called first */
305 parse_bootinfo(find_bootinfo());
306
307 /*
308 * If we were passed in a board information, copy it into the
309 * residual data area.
310 */
311 if (r3) {
312 memcpy((void *) __res, (void *) (r3 + KERNELBASE),
313 sizeof (bd_t));
314
315 }
316#if defined(CONFIG_BLK_DEV_INITRD)
317 /*
318 * If the init RAM disk has been configured in, and there's a valid
319 * starting address for it, set it up.
320 */
321 if (r4) {
322 initrd_start = r4 + KERNELBASE;
323 initrd_end = r5 + KERNELBASE;
324 }
325#endif /* CONFIG_BLK_DEV_INITRD */
326
327 /* Copy the kernel command line arguments to a safe place. */
328
329 if (r6) {
330 *(char *) (r7 + KERNELBASE) = 0;
331 strcpy(cmd_line, (char *) (r6 + KERNELBASE));
332 }
333
334 identify_ppc_sys_by_id(mfspr(SPRN_SVR));
335
336 /* setup the PowerPC module struct */
337 ppc_md.setup_arch = gp3_setup_arch;
338 ppc_md.show_cpuinfo = gp3_show_cpuinfo;
339
340 ppc_md.init_IRQ = gp3_init_IRQ;
341 ppc_md.get_irq = openpic_get_irq;
342
343 ppc_md.restart = mpc85xx_restart;
344 ppc_md.power_off = mpc85xx_power_off;
345 ppc_md.halt = mpc85xx_halt;
346
347 ppc_md.find_end_of_memory = mpc85xx_find_end_of_memory;
348
349 ppc_md.calibrate_decr = mpc85xx_calibrate_decr;
350
351 if (ppc_md.progress)
352 ppc_md.progress("platform_init(): exit", 0);
353
354 return;
355}
diff --git a/arch/ppc/platforms/85xx/stx_gp3.h b/arch/ppc/platforms/85xx/stx_gp3.h
new file mode 100644
index 000000000000..7bcc6c35a417
--- /dev/null
+++ b/arch/ppc/platforms/85xx/stx_gp3.h
@@ -0,0 +1,74 @@
1/*
2 * arch/ppc/platforms/stx8560_gp3.h
3 *
4 * STx GP3 board definitions
5 *
6 * Dan Malek (dan@embeddededge.com)
7 * Copyright 2004 Embedded Edge, LLC
8 *
9 * Ported to 2.6, Matt Porter <mporter@kernel.crashing.org>
10 * Copyright 2004-2005 MontaVista Software, Inc.
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 *
17 */
18
19#ifndef __MACH_STX_GP3_H
20#define __MACH_STX_GP3_H
21
22#include <linux/config.h>
23#include <linux/init.h>
24#include <linux/seq_file.h>
25#include <asm/ppcboot.h>
26
27#define BOARD_CCSRBAR ((uint)0xe0000000)
28#define CCSRBAR_SIZE ((uint)1024*1024)
29
30#define CPM_MAP_ADDR (CCSRBAR + MPC85xx_CPM_OFFSET)
31
32#define BCSR_ADDR ((uint)0xfc000000)
33#define BCSR_SIZE ((uint)(16 * 1024))
34
35#define BCSR_TSEC1_RESET 0x00000080
36#define BCSR_TSEC2_RESET 0x00000040
37#define BCSR_LED1 0x00000008
38#define BCSR_LED2 0x00000004
39#define BCSR_LED3 0x00000002
40#define BCSR_LED4 0x00000001
41
42extern void mpc85xx_setup_hose(void) __init;
43extern void mpc85xx_restart(char *cmd);
44extern void mpc85xx_power_off(void);
45extern void mpc85xx_halt(void);
46extern int mpc85xx_show_cpuinfo(struct seq_file *m);
47extern void mpc85xx_init_IRQ(void) __init;
48extern unsigned long mpc85xx_find_end_of_memory(void) __init;
49extern void mpc85xx_calibrate_decr(void) __init;
50
51#define PCI_CFG_ADDR_OFFSET (0x8000)
52#define PCI_CFG_DATA_OFFSET (0x8004)
53
54/* PCI interrupt controller */
55#define PIRQA MPC85xx_IRQ_EXT1
56#define PIRQB MPC85xx_IRQ_EXT2
57#define PIRQC MPC85xx_IRQ_EXT3
58#define PIRQD MPC85xx_IRQ_EXT4
59#define PCI_MIN_IDSEL 16
60#define PCI_MAX_IDSEL 19
61#define PCI_IRQ_SLOT 4
62
63#define MPC85XX_PCI1_LOWER_IO 0x00000000
64#define MPC85XX_PCI1_UPPER_IO 0x00ffffff
65
66#define MPC85XX_PCI1_LOWER_MEM 0x80000000
67#define MPC85XX_PCI1_UPPER_MEM 0x9fffffff
68
69#define MPC85XX_PCI1_IO_BASE 0xe2000000
70#define MPC85XX_PCI1_MEM_OFFSET 0x00000000
71
72#define MPC85XX_PCI1_IO_SIZE 0x01000000
73
74#endif /* __MACH_STX_GP3_H */
diff --git a/arch/ppc/platforms/Makefile b/arch/ppc/platforms/Makefile
new file mode 100644
index 000000000000..5488a053f415
--- /dev/null
+++ b/arch/ppc/platforms/Makefile
@@ -0,0 +1,53 @@
1#
2# Makefile for the linux kernel.
3#
4
5# Extra CFLAGS so we don't have to do relative includes
6CFLAGS_pmac_setup.o += -Iarch/$(ARCH)/mm
7
8obj-$(CONFIG_APUS) += apus_setup.o
9ifeq ($(CONFIG_APUS),y)
10obj-$(CONFIG_PCI) += apus_pci.o
11endif
12obj-$(CONFIG_PPC_PMAC) += pmac_pic.o pmac_setup.o pmac_time.o \
13 pmac_feature.o pmac_pci.o pmac_sleep.o \
14 pmac_low_i2c.o pmac_cache.o
15obj-$(CONFIG_PPC_CHRP) += chrp_setup.o chrp_time.o chrp_pci.o \
16 chrp_pegasos_eth.o
17obj-$(CONFIG_PPC_PREP) += prep_pci.o prep_setup.o
18ifeq ($(CONFIG_PPC_PMAC),y)
19obj-$(CONFIG_NVRAM) += pmac_nvram.o
20obj-$(CONFIG_CPU_FREQ_PMAC) += pmac_cpufreq.o
21endif
22obj-$(CONFIG_PMAC_BACKLIGHT) += pmac_backlight.o
23obj-$(CONFIG_PREP_RESIDUAL) += residual.o
24obj-$(CONFIG_ADIR) += adir_setup.o adir_pic.o adir_pci.o
25obj-$(CONFIG_PQ2ADS) += pq2ads.o
26obj-$(CONFIG_TQM8260) += tqm8260_setup.o
27obj-$(CONFIG_CPCI690) += cpci690.o
28obj-$(CONFIG_EV64260) += ev64260.o
29obj-$(CONFIG_CHESTNUT) += chestnut.o
30obj-$(CONFIG_GEMINI) += gemini_pci.o gemini_setup.o gemini_prom.o
31obj-$(CONFIG_K2) += k2.o
32obj-$(CONFIG_LOPEC) += lopec.o
33obj-$(CONFIG_KATANA) += katana.o
34obj-$(CONFIG_HDPU) += hdpu.o
35obj-$(CONFIG_MCPN765) += mcpn765.o
36obj-$(CONFIG_MENF1) += menf1_setup.o menf1_pci.o
37obj-$(CONFIG_MVME5100) += mvme5100.o
38obj-$(CONFIG_PAL4) += pal4_setup.o pal4_pci.o
39obj-$(CONFIG_PCORE) += pcore.o
40obj-$(CONFIG_POWERPMC250) += powerpmc250.o
41obj-$(CONFIG_PPLUS) += pplus.o
42obj-$(CONFIG_PRPMC750) += prpmc750.o
43obj-$(CONFIG_PRPMC800) += prpmc800.o
44obj-$(CONFIG_RADSTONE_PPC7D) += radstone_ppc7d.o
45obj-$(CONFIG_SANDPOINT) += sandpoint.o
46obj-$(CONFIG_SBC82xx) += sbc82xx.o
47obj-$(CONFIG_SPRUCE) += spruce.o
48obj-$(CONFIG_LITE5200) += lite5200.o
49
50ifeq ($(CONFIG_SMP),y)
51obj-$(CONFIG_PPC_PMAC) += pmac_smp.o
52obj-$(CONFIG_PPC_CHRP) += chrp_smp.o
53endif
diff --git a/arch/ppc/platforms/adir.h b/arch/ppc/platforms/adir.h
new file mode 100644
index 000000000000..13a748b46956
--- /dev/null
+++ b/arch/ppc/platforms/adir.h
@@ -0,0 +1,95 @@
1/*
2 * arch/ppc/platforms/adir.h
3 *
4 * Definitions for SBS Adirondack board support
5 *
6 * By Michael Sokolov <msokolov@ivan.Harhan.ORG>
7 */
8
9#ifndef __PPC_PLATFORMS_ADIR_H
10#define __PPC_PLATFORMS_ADIR_H
11
12/*
13 * SBS Adirondack definitions
14 */
15
16/* PPC physical address space layout. We use the one set up by the firmware. */
17#define ADIR_PCI32_MEM_BASE 0x80000000
18#define ADIR_PCI32_MEM_SIZE 0x20000000
19#define ADIR_PCI64_MEM_BASE 0xA0000000
20#define ADIR_PCI64_MEM_SIZE 0x20000000
21#define ADIR_PCI32_IO_BASE 0xC0000000
22#define ADIR_PCI32_IO_SIZE 0x10000000
23#define ADIR_PCI64_IO_BASE 0xD0000000
24#define ADIR_PCI64_IO_SIZE 0x10000000
25#define ADIR_PCI64_PHB 0xFF400000
26#define ADIR_PCI32_PHB 0xFF500000
27
28#define ADIR_PCI64_CONFIG_ADDR (ADIR_PCI64_PHB + 0x000f8000)
29#define ADIR_PCI64_CONFIG_DATA (ADIR_PCI64_PHB + 0x000f8010)
30
31#define ADIR_PCI32_CONFIG_ADDR (ADIR_PCI32_PHB + 0x000f8000)
32#define ADIR_PCI32_CONFIG_DATA (ADIR_PCI32_PHB + 0x000f8010)
33
34/* System memory as seen from PCI */
35#define ADIR_PCI_SYS_MEM_BASE 0x80000000
36
37/* Static virtual mapping of PCI I/O */
38#define ADIR_PCI32_VIRT_IO_BASE 0xFE000000
39#define ADIR_PCI32_VIRT_IO_SIZE 0x01000000
40#define ADIR_PCI64_VIRT_IO_BASE 0xFF000000
41#define ADIR_PCI64_VIRT_IO_SIZE 0x01000000
42
43/* Registers */
44#define ADIR_NVRAM_RTC_ADDR 0x74
45#define ADIR_NVRAM_RTC_DATA 0x75
46
47#define ADIR_BOARD_ID_REG (ADIR_PCI32_VIRT_IO_BASE + 0x08FFF0)
48#define ADIR_CPLD1REV_REG (ADIR_PCI32_VIRT_IO_BASE + 0x08FFF1)
49#define ADIR_CPLD2REV_REG (ADIR_PCI32_VIRT_IO_BASE + 0x08FFF2)
50#define ADIR_FLASHCTL_REG (ADIR_PCI32_VIRT_IO_BASE + 0x08FFF3)
51#define ADIR_CPC710_STAT_REG (ADIR_PCI32_VIRT_IO_BASE + 0x08FFF4)
52#define ADIR_CLOCK_REG (ADIR_PCI32_VIRT_IO_BASE + 0x08FFF5)
53#define ADIR_GPIO_REG (ADIR_PCI32_VIRT_IO_BASE + 0x08FFF8)
54#define ADIR_MISC_REG (ADIR_PCI32_VIRT_IO_BASE + 0x08FFF9)
55#define ADIR_LED_REG (ADIR_PCI32_VIRT_IO_BASE + 0x08FFFA)
56
57#define ADIR_CLOCK_REG_PD 0x10
58#define ADIR_CLOCK_REG_SPREAD 0x08
59#define ADIR_CLOCK_REG_SEL133 0x04
60#define ADIR_CLOCK_REG_SEL1 0x02
61#define ADIR_CLOCK_REG_SEL0 0x01
62
63#define ADIR_PROCA_INT_MASK (ADIR_PCI32_VIRT_IO_BASE + 0x0EFFF0)
64#define ADIR_PROCB_INT_MASK (ADIR_PCI32_VIRT_IO_BASE + 0x0EFFF2)
65#define ADIR_PROCA_INT_STAT (ADIR_PCI32_VIRT_IO_BASE + 0x0EFFF4)
66#define ADIR_PROCB_INT_STAT (ADIR_PCI32_VIRT_IO_BASE + 0x0EFFF6)
67
68/* Linux IRQ numbers */
69#define ADIR_IRQ_NONE -1
70#define ADIR_IRQ_SERIAL2 3
71#define ADIR_IRQ_SERIAL1 4
72#define ADIR_IRQ_FDC 6
73#define ADIR_IRQ_PARALLEL 7
74#define ADIR_IRQ_VIA_AUDIO 10
75#define ADIR_IRQ_VIA_USB 11
76#define ADIR_IRQ_IDE0 14
77#define ADIR_IRQ_IDE1 15
78#define ADIR_IRQ_PCI0_INTA 16
79#define ADIR_IRQ_PCI0_INTB 17
80#define ADIR_IRQ_PCI0_INTC 18
81#define ADIR_IRQ_PCI0_INTD 19
82#define ADIR_IRQ_PCI1_INTA 20
83#define ADIR_IRQ_PCI1_INTB 21
84#define ADIR_IRQ_PCI1_INTC 22
85#define ADIR_IRQ_PCI1_INTD 23
86#define ADIR_IRQ_MBSCSI 24 /* motherboard SCSI */
87#define ADIR_IRQ_MBETH1 25 /* motherboard Ethernet 1 */
88#define ADIR_IRQ_MBETH0 26 /* motherboard Ethernet 0 */
89#define ADIR_IRQ_CPC710_INT1 27
90#define ADIR_IRQ_CPC710_INT2 28
91#define ADIR_IRQ_VT82C686_NMI 29
92#define ADIR_IRQ_VT82C686_INTR 30
93#define ADIR_IRQ_INTERPROC 31
94
95#endif /* __PPC_PLATFORMS_ADIR_H */
diff --git a/arch/ppc/platforms/adir_pci.c b/arch/ppc/platforms/adir_pci.c
new file mode 100644
index 000000000000..f94ac53e0711
--- /dev/null
+++ b/arch/ppc/platforms/adir_pci.c
@@ -0,0 +1,247 @@
1/*
2 * arch/ppc/platforms/adir_pci.c
3 *
4 * PCI support for SBS Adirondack
5 *
6 * By Michael Sokolov <msokolov@ivan.Harhan.ORG>
7 * based on the K2 version by Matt Porter <mporter@mvista.com>
8 */
9
10#include <linux/kernel.h>
11#include <linux/init.h>
12#include <linux/pci.h>
13#include <linux/slab.h>
14
15#include <asm/byteorder.h>
16#include <asm/io.h>
17#include <asm/uaccess.h>
18#include <asm/machdep.h>
19#include <asm/pci-bridge.h>
20
21#include <syslib/cpc710.h>
22#include "adir.h"
23
24#undef DEBUG
25#ifdef DEBUG
26#define DBG(x...) printk(x)
27#else
28#define DBG(x...)
29#endif /* DEBUG */
30
31static inline int __init
32adir_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
33{
34#define PCIIRQ(a,b,c,d) {ADIR_IRQ_##a,ADIR_IRQ_##b,ADIR_IRQ_##c,ADIR_IRQ_##d},
35 struct pci_controller *hose = pci_bus_to_hose(dev->bus->number);
36 /*
37 * The three PCI devices on the motherboard have dedicated lines to the
38 * CPLD interrupt controller, bypassing the standard PCI INTA-D and the
39 * PC interrupt controller. All other PCI devices (slots) have usual
40 * staggered INTA-D lines, resulting in 8 lines total (PCI0 INTA-D and
41 * PCI1 INTA-D). All 8 go to the CPLD interrupt controller. PCI0 INTA-D
42 * also go to the south bridge, so we have the option of taking them
43 * via the CPLD interrupt controller or via the south bridge 8259
44 * 8258 thingy. PCI1 INTA-D can only be taken via the CPLD interrupt
45 * controller. We take all PCI interrupts via the CPLD interrupt
46 * controller as recommended by SBS.
47 *
48 * We also have some monkey business with the PCI devices within the
49 * VT82C686B south bridge itself. This chip actually has 7 functions on
50 * its IDSEL. Function 0 is the actual south bridge, function 1 is IDE,
51 * and function 4 is some special stuff. The other 4 functions are just
52 * regular PCI devices bundled in the chip. 2 and 3 are USB UHCIs and 5
53 * and 6 are audio (not supported on the Adirondack).
54 *
55 * This is where the monkey business begins. PCI devices are supposed
56 * to signal normal PCI interrupts. But the 4 functions in question are
57 * located in the south bridge chip, which is designed with the
58 * assumption that it will be fielding PCI INTA-D interrupts rather
59 * than generating them. Here's what it does. Each of the functions in
60 * question routes its interrupt to one of the IRQs on the 8259 thingy.
61 * Which one? It looks at the Interrupt Line register in the PCI config
62 * space, even though the PCI spec says it's for BIOS/OS interaction
63 * only.
64 *
65 * How do we deal with this? We take these interrupts via 8259 IRQs as
66 * we have to. We return the desired IRQ numbers from this routine when
67 * called for the functions in question. The PCI scan code will then
68 * stick our return value into the Interrupt Line register in the PCI
69 * config space, and the interrupt will actually go there. We identify
70 * these functions within the south bridge IDSEL by their interrupt pin
71 * numbers, as the VT82C686B has 04 in the Interrupt Pin register for
72 * USB and 03 for audio.
73 */
74 if (!hose->index) {
75 static char pci_irq_table[][4] =
76 /*
77 * PCI IDSEL/INTPIN->INTLINE
78 * A B C D
79 */
80 {
81 /* south bridge */ PCIIRQ(IDE0, NONE, VIA_AUDIO, VIA_USB)
82 /* Ethernet 0 */ PCIIRQ(MBETH0, MBETH0, MBETH0, MBETH0)
83 /* PCI0 slot 1 */ PCIIRQ(PCI0_INTB, PCI0_INTC, PCI0_INTD, PCI0_INTA)
84 /* PCI0 slot 2 */ PCIIRQ(PCI0_INTC, PCI0_INTD, PCI0_INTA, PCI0_INTB)
85 /* PCI0 slot 3 */ PCIIRQ(PCI0_INTD, PCI0_INTA, PCI0_INTB, PCI0_INTC)
86 };
87 const long min_idsel = 3, max_idsel = 7, irqs_per_slot = 4;
88 return PCI_IRQ_TABLE_LOOKUP;
89 } else {
90 static char pci_irq_table[][4] =
91 /*
92 * PCI IDSEL/INTPIN->INTLINE
93 * A B C D
94 */
95 {
96 /* Ethernet 1 */ PCIIRQ(MBETH1, MBETH1, MBETH1, MBETH1)
97 /* SCSI */ PCIIRQ(MBSCSI, MBSCSI, MBSCSI, MBSCSI)
98 /* PCI1 slot 1 */ PCIIRQ(PCI1_INTB, PCI1_INTC, PCI1_INTD, PCI1_INTA)
99 /* PCI1 slot 2 */ PCIIRQ(PCI1_INTC, PCI1_INTD, PCI1_INTA, PCI1_INTB)
100 /* PCI1 slot 3 */ PCIIRQ(PCI1_INTD, PCI1_INTA, PCI1_INTB, PCI1_INTC)
101 };
102 const long min_idsel = 3, max_idsel = 7, irqs_per_slot = 4;
103 return PCI_IRQ_TABLE_LOOKUP;
104 }
105#undef PCIIRQ
106}
107
108static void
109adir_pcibios_fixup_resources(struct pci_dev *dev)
110{
111 int i;
112
113 if ((dev->vendor == PCI_VENDOR_ID_IBM) &&
114 (dev->device == PCI_DEVICE_ID_IBM_CPC710_PCI64))
115 {
116 DBG("Fixup CPC710 resources\n");
117 for (i=0; i<DEVICE_COUNT_RESOURCE; i++)
118 {
119 dev->resource[i].start = 0;
120 dev->resource[i].end = 0;
121 }
122 }
123}
124
125/*
126 * CPC710 DD3 has an errata causing it to hang the system if a type 0 config
127 * cycle is attempted on its PCI32 interface with a device number > 21.
128 * CPC710's PCI bridges map device numbers 1 through 21 to AD11 through AD31.
129 * Per the PCI spec it MUST accept all other device numbers and do nothing, and
130 * software MUST scan all device numbers without assuming how IDSELs are
131 * mapped. However, as the CPC710 DD3's errata causes such correct scanning
132 * procedure to hang the system, we have no choice but to introduce this hack
133 * of knowingly avoiding device numbers > 21 on PCI0,
134 */
135static int
136adir_exclude_device(u_char bus, u_char devfn)
137{
138 if ((bus == 0) && (PCI_SLOT(devfn) > 21))
139 return PCIBIOS_DEVICE_NOT_FOUND;
140 else
141 return PCIBIOS_SUCCESSFUL;
142}
143
144void adir_find_bridges(void)
145{
146 struct pci_controller *hose_a, *hose_b;
147
148 /* Setup PCI32 hose */
149 hose_a = pcibios_alloc_controller();
150 if (!hose_a)
151 return;
152
153 hose_a->first_busno = 0;
154 hose_a->last_busno = 0xff;
155 hose_a->pci_mem_offset = ADIR_PCI32_MEM_BASE;
156 hose_a->io_space.start = 0;
157 hose_a->io_space.end = ADIR_PCI32_VIRT_IO_SIZE - 1;
158 hose_a->mem_space.start = 0;
159 hose_a->mem_space.end = ADIR_PCI32_MEM_SIZE - 1;
160 hose_a->io_resource.start = 0;
161 hose_a->io_resource.end = ADIR_PCI32_VIRT_IO_SIZE - 1;
162 hose_a->io_resource.flags = IORESOURCE_IO;
163 hose_a->mem_resources[0].start = ADIR_PCI32_MEM_BASE;
164 hose_a->mem_resources[0].end = ADIR_PCI32_MEM_BASE +
165 ADIR_PCI32_MEM_SIZE - 1;
166 hose_a->mem_resources[0].flags = IORESOURCE_MEM;
167 hose_a->io_base_phys = ADIR_PCI32_IO_BASE;
168 hose_a->io_base_virt = (void *) ADIR_PCI32_VIRT_IO_BASE;
169
170 ppc_md.pci_exclude_device = adir_exclude_device;
171 setup_indirect_pci(hose_a, ADIR_PCI32_CONFIG_ADDR,
172 ADIR_PCI32_CONFIG_DATA);
173
174 /* Initialize PCI32 bus registers */
175 early_write_config_byte(hose_a,
176 hose_a->first_busno,
177 PCI_DEVFN(0, 0),
178 CPC710_BUS_NUMBER,
179 hose_a->first_busno);
180 early_write_config_byte(hose_a,
181 hose_a->first_busno,
182 PCI_DEVFN(0, 0),
183 CPC710_SUB_BUS_NUMBER,
184 hose_a->last_busno);
185
186 hose_a->last_busno = pciauto_bus_scan(hose_a, hose_a->first_busno);
187
188 /* Write out correct max subordinate bus number for hose A */
189 early_write_config_byte(hose_a,
190 hose_a->first_busno,
191 PCI_DEVFN(0, 0),
192 CPC710_SUB_BUS_NUMBER,
193 hose_a->last_busno);
194
195 /* Setup PCI64 hose */
196 hose_b = pcibios_alloc_controller();
197 if (!hose_b)
198 return;
199
200 hose_b->first_busno = hose_a->last_busno + 1;
201 hose_b->last_busno = 0xff;
202 hose_b->pci_mem_offset = ADIR_PCI64_MEM_BASE;
203 hose_b->io_space.start = 0;
204 hose_b->io_space.end = ADIR_PCI64_VIRT_IO_SIZE - 1;
205 hose_b->mem_space.start = 0;
206 hose_b->mem_space.end = ADIR_PCI64_MEM_SIZE - 1;
207 hose_b->io_resource.start = 0;
208 hose_b->io_resource.end = ADIR_PCI64_VIRT_IO_SIZE - 1;
209 hose_b->io_resource.flags = IORESOURCE_IO;
210 hose_b->mem_resources[0].start = ADIR_PCI64_MEM_BASE;
211 hose_b->mem_resources[0].end = ADIR_PCI64_MEM_BASE +
212 ADIR_PCI64_MEM_SIZE - 1;
213 hose_b->mem_resources[0].flags = IORESOURCE_MEM;
214 hose_b->io_base_phys = ADIR_PCI64_IO_BASE;
215 hose_b->io_base_virt = (void *) ADIR_PCI64_VIRT_IO_BASE;
216
217 setup_indirect_pci(hose_b, ADIR_PCI64_CONFIG_ADDR,
218 ADIR_PCI64_CONFIG_DATA);
219
220 /* Initialize PCI64 bus registers */
221 early_write_config_byte(hose_b,
222 0,
223 PCI_DEVFN(0, 0),
224 CPC710_SUB_BUS_NUMBER,
225 0xff);
226
227 early_write_config_byte(hose_b,
228 0,
229 PCI_DEVFN(0, 0),
230 CPC710_BUS_NUMBER,
231 hose_b->first_busno);
232
233 hose_b->last_busno = pciauto_bus_scan(hose_b,
234 hose_b->first_busno);
235
236 /* Write out correct max subordinate bus number for hose B */
237 early_write_config_byte(hose_b,
238 hose_b->first_busno,
239 PCI_DEVFN(0, 0),
240 CPC710_SUB_BUS_NUMBER,
241 hose_b->last_busno);
242
243 ppc_md.pcibios_fixup = NULL;
244 ppc_md.pcibios_fixup_resources = adir_pcibios_fixup_resources;
245 ppc_md.pci_swizzle = common_swizzle;
246 ppc_md.pci_map_irq = adir_map_irq;
247}
diff --git a/arch/ppc/platforms/adir_pic.c b/arch/ppc/platforms/adir_pic.c
new file mode 100644
index 000000000000..9947cba52af5
--- /dev/null
+++ b/arch/ppc/platforms/adir_pic.c
@@ -0,0 +1,130 @@
1/*
2 * arch/ppc/platforms/adir_pic.c
3 *
4 * Interrupt controller support for SBS Adirondack
5 *
6 * By Michael Sokolov <msokolov@ivan.Harhan.ORG>
7 * based on the K2 and SCM versions by Matt Porter <mporter@mvista.com>
8 */
9
10#include <linux/stddef.h>
11#include <linux/init.h>
12#include <linux/sched.h>
13#include <linux/pci.h>
14#include <linux/interrupt.h>
15
16#include <asm/io.h>
17#include <asm/i8259.h>
18#include "adir.h"
19
20static void adir_onboard_pic_enable(unsigned int irq);
21static void adir_onboard_pic_disable(unsigned int irq);
22
23__init static void
24adir_onboard_pic_init(void)
25{
26 volatile u_short *maskreg = (volatile u_short *) ADIR_PROCA_INT_MASK;
27
28 /* Disable all Adirondack onboard interrupts */
29 out_be16(maskreg, 0xFFFF);
30}
31
32static int
33adir_onboard_pic_get_irq(void)
34{
35 volatile u_short *statreg = (volatile u_short *) ADIR_PROCA_INT_STAT;
36 int irq;
37 u_short int_status, int_test;
38
39 int_status = in_be16(statreg);
40 for (irq = 0, int_test = 1; irq < 16; irq++, int_test <<= 1) {
41 if (int_status & int_test)
42 break;
43 }
44
45 if (irq == 16)
46 return -1;
47
48 return (irq+16);
49}
50
51static void
52adir_onboard_pic_enable(unsigned int irq)
53{
54 volatile u_short *maskreg = (volatile u_short *) ADIR_PROCA_INT_MASK;
55
56 /* Change irq to Adirondack onboard native value */
57 irq -= 16;
58
59 /* Enable requested irq number */
60 out_be16(maskreg, in_be16(maskreg) & ~(1 << irq));
61}
62
63static void
64adir_onboard_pic_disable(unsigned int irq)
65{
66 volatile u_short *maskreg = (volatile u_short *) ADIR_PROCA_INT_MASK;
67
68 /* Change irq to Adirondack onboard native value */
69 irq -= 16;
70
71 /* Disable requested irq number */
72 out_be16(maskreg, in_be16(maskreg) | (1 << irq));
73}
74
75static struct hw_interrupt_type adir_onboard_pic = {
76 " ADIR PIC ",
77 NULL,
78 NULL,
79 adir_onboard_pic_enable, /* unmask */
80 adir_onboard_pic_disable, /* mask */
81 adir_onboard_pic_disable, /* mask and ack */
82 NULL,
83 NULL
84};
85
86static struct irqaction noop_action = {
87 .handler = no_action,
88 .flags = SA_INTERRUPT,
89 .mask = CPU_MASK_NONE,
90 .name = "82c59 primary cascade",
91};
92
93/*
94 * Linux interrupt values are assigned as follows:
95 *
96 * 0-15 VT82C686 8259 interrupts
97 * 16-31 Adirondack CPLD interrupts
98 */
99__init void
100adir_init_IRQ(void)
101{
102 int i;
103
104 /* Initialize the cascaded 8259's on the VT82C686 */
105 for (i=0; i<16; i++)
106 irq_desc[i].handler = &i8259_pic;
107 i8259_init(NULL);
108
109 /* Initialize Adirondack CPLD PIC and enable 8259 interrupt cascade */
110 for (i=16; i<32; i++)
111 irq_desc[i].handler = &adir_onboard_pic;
112 adir_onboard_pic_init();
113
114 /* Enable 8259 interrupt cascade */
115 setup_irq(ADIR_IRQ_VT82C686_INTR, &noop_action);
116}
117
118int
119adir_get_irq(struct pt_regs *regs)
120{
121 int irq;
122
123 if ((irq = adir_onboard_pic_get_irq()) < 0)
124 return irq;
125
126 if (irq == ADIR_IRQ_VT82C686_INTR)
127 irq = i8259_irq(regs);
128
129 return irq;
130}
diff --git a/arch/ppc/platforms/adir_setup.c b/arch/ppc/platforms/adir_setup.c
new file mode 100644
index 000000000000..6a6754ee0617
--- /dev/null
+++ b/arch/ppc/platforms/adir_setup.c
@@ -0,0 +1,210 @@
1/*
2 * arch/ppc/platforms/adir_setup.c
3 *
4 * Board setup routines for SBS Adirondack
5 *
6 * By Michael Sokolov <msokolov@ivan.Harhan.ORG>
7 * based on the K2 version by Matt Porter <mporter@mvista.com>
8 */
9
10#include <linux/config.h>
11#include <linux/stddef.h>
12#include <linux/kernel.h>
13#include <linux/init.h>
14#include <linux/errno.h>
15#include <linux/reboot.h>
16#include <linux/pci.h>
17#include <linux/kdev_t.h>
18#include <linux/types.h>
19#include <linux/major.h>
20#include <linux/initrd.h>
21#include <linux/console.h>
22#include <linux/delay.h>
23#include <linux/ide.h>
24#include <linux/seq_file.h>
25#include <linux/root_dev.h>
26
27#include <asm/system.h>
28#include <asm/pgtable.h>
29#include <asm/page.h>
30#include <asm/dma.h>
31#include <asm/io.h>
32#include <asm/machdep.h>
33#include <asm/time.h>
34#include <asm/todc.h>
35#include <asm/bootinfo.h>
36
37#include "adir.h"
38
39extern void adir_init_IRQ(void);
40extern int adir_get_irq(struct pt_regs *);
41extern void adir_find_bridges(void);
42extern unsigned long loops_per_jiffy;
43
44static unsigned int cpu_750cx[16] = {
45 5, 15, 14, 0, 4, 13, 0, 9, 6, 11, 8, 10, 16, 12, 7, 0
46};
47
48static int
49adir_get_bus_speed(void)
50{
51 if (!(*((u_char *) ADIR_CLOCK_REG) & ADIR_CLOCK_REG_SEL133))
52 return 100000000;
53 else
54 return 133333333;
55}
56
57static int
58adir_get_cpu_speed(void)
59{
60 unsigned long hid1;
61 int cpu_speed;
62
63 hid1 = mfspr(SPRN_HID1) >> 28;
64
65 hid1 = cpu_750cx[hid1];
66
67 cpu_speed = adir_get_bus_speed()*hid1/2;
68 return cpu_speed;
69}
70
71static void __init
72adir_calibrate_decr(void)
73{
74 int freq, divisor = 4;
75
76 /* determine processor bus speed */
77 freq = adir_get_bus_speed();
78 tb_ticks_per_jiffy = freq / HZ / divisor;
79 tb_to_us = mulhwu_scale_factor(freq/divisor, 1000000);
80}
81
82static int
83adir_show_cpuinfo(struct seq_file *m)
84{
85 seq_printf(m, "vendor\t\t: SBS\n");
86 seq_printf(m, "machine\t\t: Adirondack\n");
87 seq_printf(m, "cpu speed\t: %dMhz\n", adir_get_cpu_speed()/1000000);
88 seq_printf(m, "bus speed\t: %dMhz\n", adir_get_bus_speed()/1000000);
89 seq_printf(m, "memory type\t: SDRAM\n");
90
91 return 0;
92}
93
94extern char cmd_line[];
95
96TODC_ALLOC();
97
98static void __init
99adir_setup_arch(void)
100{
101 unsigned int cpu;
102
103 /* Setup TODC access */
104 TODC_INIT(TODC_TYPE_MC146818, ADIR_NVRAM_RTC_ADDR, 0,
105 ADIR_NVRAM_RTC_DATA, 8);
106
107 /* init to some ~sane value until calibrate_delay() runs */
108 loops_per_jiffy = 50000000/HZ;
109
110 /* Setup PCI host bridges */
111 adir_find_bridges();
112
113#ifdef CONFIG_BLK_DEV_INITRD
114 if (initrd_start)
115 ROOT_DEV = Root_RAM0;
116 else
117#endif
118#ifdef CONFIG_ROOT_NFS
119 ROOT_DEV = Root_NFS;
120#else
121 ROOT_DEV = Root_SDA1;
122#endif
123
124 /* Identify the system */
125 printk("System Identification: SBS Adirondack - PowerPC 750CXe @ %d Mhz\n", adir_get_cpu_speed()/1000000);
126 printk("SBS Adirondack port (C) 2001 SBS Technologies, Inc.\n");
127
128 /* Identify the CPU manufacturer */
129 cpu = mfspr(SPRN_PVR);
130 printk("CPU manufacturer: IBM [rev=%04x]\n", (cpu & 0xffff));
131}
132
133static void
134adir_restart(char *cmd)
135{
136 local_irq_disable();
137 /* SRR0 has system reset vector, SRR1 has default MSR value */
138 /* rfi restores MSR from SRR1 and sets the PC to the SRR0 value */
139 __asm__ __volatile__
140 ("lis 3,0xfff0\n\t"
141 "ori 3,3,0x0100\n\t"
142 "mtspr 26,3\n\t"
143 "li 3,0\n\t"
144 "mtspr 27,3\n\t"
145 "rfi\n\t");
146 for(;;);
147}
148
149static void
150adir_power_off(void)
151{
152 for(;;);
153}
154
155static void
156adir_halt(void)
157{
158 adir_restart(NULL);
159}
160
161static unsigned long __init
162adir_find_end_of_memory(void)
163{
164 return boot_mem_size;
165}
166
167static void __init
168adir_map_io(void)
169{
170 io_block_mapping(ADIR_PCI32_VIRT_IO_BASE, ADIR_PCI32_IO_BASE,
171 ADIR_PCI32_VIRT_IO_SIZE, _PAGE_IO);
172 io_block_mapping(ADIR_PCI64_VIRT_IO_BASE, ADIR_PCI64_IO_BASE,
173 ADIR_PCI64_VIRT_IO_SIZE, _PAGE_IO);
174}
175
176void __init
177platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
178 unsigned long r6, unsigned long r7)
179{
180 /*
181 * On the Adirondack we use bi_recs and pass the pointer to them in R3.
182 */
183 parse_bootinfo((struct bi_record *) (r3 + KERNELBASE));
184
185 /* Remember, isa_io_base is virtual but isa_mem_base is physical! */
186 isa_io_base = ADIR_PCI32_VIRT_IO_BASE;
187 isa_mem_base = ADIR_PCI32_MEM_BASE;
188 pci_dram_offset = ADIR_PCI_SYS_MEM_BASE;
189
190 ppc_md.setup_arch = adir_setup_arch;
191 ppc_md.show_cpuinfo = adir_show_cpuinfo;
192 ppc_md.irq_canonicalize = NULL;
193 ppc_md.init_IRQ = adir_init_IRQ;
194 ppc_md.get_irq = adir_get_irq;
195 ppc_md.init = NULL;
196
197 ppc_md.find_end_of_memory = adir_find_end_of_memory;
198 ppc_md.setup_io_mappings = adir_map_io;
199
200 ppc_md.restart = adir_restart;
201 ppc_md.power_off = adir_power_off;
202 ppc_md.halt = adir_halt;
203
204 ppc_md.time_init = todc_time_init;
205 ppc_md.set_rtc_time = todc_set_rtc_time;
206 ppc_md.get_rtc_time = todc_get_rtc_time;
207 ppc_md.nvram_read_val = todc_mc146818_read_val;
208 ppc_md.nvram_write_val = todc_mc146818_write_val;
209 ppc_md.calibrate_decr = adir_calibrate_decr;
210}
diff --git a/arch/ppc/platforms/apus_pci.c b/arch/ppc/platforms/apus_pci.c
new file mode 100644
index 000000000000..33dad6db8243
--- /dev/null
+++ b/arch/ppc/platforms/apus_pci.c
@@ -0,0 +1,208 @@
1/*
2 * Copyright (C) Michel Dänzer <michdaen@iiic.ethz.ch>
3 *
4 * APUS PCI routines.
5 *
6 * Currently, only B/CVisionPPC cards (Permedia2) are supported.
7 *
8 * Thanks to Geert Uytterhoeven for the idea:
9 * Read values from given config space(s) for the first devices, -1 otherwise
10 *
11 */
12
13#include <linux/config.h>
14#ifdef CONFIG_AMIGA
15
16#include <linux/kernel.h>
17#include <linux/pci.h>
18#include <linux/delay.h>
19#include <linux/string.h>
20#include <linux/init.h>
21
22#include <asm/io.h>
23#include <asm/pci-bridge.h>
24#include <asm/machdep.h>
25
26#include "apus_pci.h"
27
28
29/* These definitions are mostly adapted from pm2fb.c */
30
31#undef APUS_PCI_MASTER_DEBUG
32#ifdef APUS_PCI_MASTER_DEBUG
33#define DPRINTK(a,b...) printk(KERN_DEBUG "apus_pci: %s: " a, __FUNCTION__ , ## b)
34#else
35#define DPRINTK(a,b...)
36#endif
37
38/*
39 * The _DEFINITIVE_ memory mapping/unmapping functions.
40 * This is due to the fact that they're changing soooo often...
41 */
42#define DEFW() wmb()
43#define DEFR() rmb()
44#define DEFRW() mb()
45
46#define DEVNO(d) ((d)>>3)
47#define FNNO(d) ((d)&7)
48
49
50extern unsigned long powerup_PCI_present;
51
52static struct pci_controller *apus_hose;
53
54
55void *pci_io_base(unsigned int bus)
56{
57 return 0;
58}
59
60
61int
62apus_pcibios_read_config(struct pci_bus *bus, int devfn, int offset,
63 int len, u32 *val)
64{
65 int fnno = FNNO(devfn);
66 int devno = DEVNO(devfn);
67 volatile unsigned char *cfg_data;
68
69 if (bus->number > 0 || devno != 1) {
70 *val = ~0;
71 return PCIBIOS_DEVICE_NOT_FOUND;
72 }
73 /* base address + function offset + offset ^ endianness conversion */
74 /* XXX the fnno<<5 bit seems wacky -- paulus */
75 cfg_data = apus_hose->cfg_data + (fnno<<5) + (offset ^ (len - 1));
76 switch (len) {
77 case 1:
78 *val = readb(cfg_data);
79 break;
80 case 2:
81 *val = readw(cfg_data);
82 break;
83 default:
84 *val = readl(cfg_data);
85 break;
86 }
87
88 DPRINTK("read b: 0x%x, d: 0x%x, f: 0x%x, o: 0x%x, l: %d, v: 0x%x\n",
89 bus->number, devfn>>3, devfn&7, offset, len, *val);
90 return PCIBIOS_SUCCESSFUL;
91}
92
93int
94apus_pcibios_write_config(struct pci_bus *bus, int devfn, int offset,
95 int len, u32 *val)
96{
97 int fnno = FNNO(devfn);
98 int devno = DEVNO(devfn);
99 volatile unsigned char *cfg_data;
100
101 if (bus->number > 0 || devno != 1) {
102 return PCIBIOS_DEVICE_NOT_FOUND;
103 }
104 /* base address + function offset + offset ^ endianness conversion */
105 /* XXX the fnno<<5 bit seems wacky -- paulus */
106 cfg_data = apus_hose->cfg_data + (fnno<<5) + (offset ^ (len - 1));
107 switch (len) {
108 case 1:
109 writeb(val, cfg_data); DEFW();
110 break;
111 case 2:
112 writew(val, cfg_data); DEFW();
113 break;
114 default:
115 writel(val, cfg_data); DEFW();
116 break;
117 }
118
119 DPRINTK("write b: 0x%x, d: 0x%x, f: 0x%x, o: 0x%x, l: %d, v: 0x%x\n",
120 bus->number, devfn>>3, devfn&7, offset, len, val);
121 return PCIBIOS_SUCCESSFUL;
122}
123
124static struct pci_ops apus_pci_ops = {
125 apus_pcibios_read_config,
126 apus_pcibios_write_config
127};
128
129static struct resource pci_mem = { "B/CVisionPPC PCI mem", CVPPC_FB_APERTURE_ONE, CVPPC_PCI_CONFIG, IORESOURCE_MEM };
130
131void __init
132apus_pcibios_fixup(void)
133{
134/* struct pci_dev *dev = pci_find_slot(0, 1<<3);
135 unsigned int reg, val, offset;*/
136
137 /* FIXME: interrupt? */
138 /*dev->interrupt = xxx;*/
139
140 request_resource(&iomem_resource, &pci_mem);
141 printk("%s: PCI mem resource requested\n", __FUNCTION__);
142}
143
144static void __init apus_pcibios_fixup_bus(struct pci_bus *bus)
145{
146 bus->resource[1] = &pci_mem;
147}
148
149
150/*
151 * This is from pm2fb.c again
152 *
153 * Check if PCI (B/CVisionPPC) is available, initialize it and set up
154 * the pcibios_* pointers
155 */
156
157
158void __init
159apus_setup_pci_ptrs(void)
160{
161 if (!powerup_PCI_present) {
162 DPRINTK("no PCI bridge detected\n");
163 return;
164 }
165 DPRINTK("Phase5 B/CVisionPPC PCI bridge detected.\n");
166
167 apus_hose = pcibios_alloc_controller();
168 if (!apus_hose) {
169 printk("apus_pci: Can't allocate PCI controller structure\n");
170 return;
171 }
172
173 if (!(apus_hose->cfg_data = ioremap(CVPPC_PCI_CONFIG, 256))) {
174 printk("apus_pci: unable to map PCI config region\n");
175 return;
176 }
177
178 if (!(apus_hose->cfg_addr = ioremap(CSPPC_PCI_BRIDGE, 256))) {
179 printk("apus_pci: unable to map PCI bridge\n");
180 return;
181 }
182
183 writel(CSPPCF_BRIDGE_BIG_ENDIAN, apus_hose->cfg_addr + CSPPC_BRIDGE_ENDIAN);
184 DEFW();
185
186 writel(CVPPC_REGS_REGION, apus_hose->cfg_data+ PCI_BASE_ADDRESS_0);
187 DEFW();
188 writel(CVPPC_FB_APERTURE_ONE, apus_hose->cfg_data + PCI_BASE_ADDRESS_1);
189 DEFW();
190 writel(CVPPC_FB_APERTURE_TWO, apus_hose->cfg_data + PCI_BASE_ADDRESS_2);
191 DEFW();
192 writel(CVPPC_ROM_ADDRESS, apus_hose->cfg_data + PCI_ROM_ADDRESS);
193 DEFW();
194
195 writel(0xef000000 | PCI_COMMAND_IO | PCI_COMMAND_MEMORY |
196 PCI_COMMAND_MASTER, apus_hose->cfg_data + PCI_COMMAND);
197 DEFW();
198
199 apus_hose->first_busno = 0;
200 apus_hose->last_busno = 0;
201 apus_hose->ops = &apus_pci_ops;
202 ppc_md.pcibios_fixup = apus_pcibios_fixup;
203 ppc_md.pcibios_fixup_bus = apus_pcibios_fixup_bus;
204
205 return;
206}
207
208#endif /* CONFIG_AMIGA */
diff --git a/arch/ppc/platforms/apus_pci.h b/arch/ppc/platforms/apus_pci.h
new file mode 100644
index 000000000000..f15974ae0189
--- /dev/null
+++ b/arch/ppc/platforms/apus_pci.h
@@ -0,0 +1,34 @@
1/*
2 * Phase5 CybervisionPPC (TVP4020) definitions for the Permedia2 framebuffer
3 * driver.
4 *
5 * Copyright (c) 1998-1999 Ilario Nardinocchi (nardinoc@CS.UniBO.IT)
6 * --------------------------------------------------------------------------
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file README.legal in the main directory of this archive
9 * for more details.
10 */
11
12#ifndef APUS_PCI_H
13#define APUS_PCI_H
14
15
16#define CSPPC_PCI_BRIDGE 0xfffe0000
17#define CSPPC_BRIDGE_ENDIAN 0x0000
18#define CSPPC_BRIDGE_INT 0x0010
19
20#define CVPPC_PCI_CONFIG 0xfffc0000
21#define CVPPC_ROM_ADDRESS 0xe2000001
22#define CVPPC_REGS_REGION 0xef000000
23#define CVPPC_FB_APERTURE_ONE 0xe0000000
24#define CVPPC_FB_APERTURE_TWO 0xe1000000
25#define CVPPC_FB_SIZE 0x00800000
26
27/* CVPPC_BRIDGE_ENDIAN */
28#define CSPPCF_BRIDGE_BIG_ENDIAN 0x02
29
30/* CVPPC_BRIDGE_INT */
31#define CSPPCF_BRIDGE_ACTIVE_INT2 0x01
32
33
34#endif /* APUS_PCI_H */
diff --git a/arch/ppc/platforms/apus_setup.c b/arch/ppc/platforms/apus_setup.c
new file mode 100644
index 000000000000..2f74fde98ebc
--- /dev/null
+++ b/arch/ppc/platforms/apus_setup.c
@@ -0,0 +1,815 @@
1/*
2 * arch/ppc/platforms/apus_setup.c
3 *
4 * Copyright (C) 1998, 1999 Jesper Skov
5 *
6 * Basically what is needed to replace functionality found in
7 * arch/m68k allowing Amiga drivers to work under APUS.
8 * Bits of code and/or ideas from arch/m68k and arch/ppc files.
9 *
10 * TODO:
11 * This file needs a *really* good cleanup. Restructure and optimize.
12 * Make sure it can be compiled for non-APUS configs. Begin to move
13 * Amiga specific stuff into mach/amiga.
14 */
15
16#include <linux/config.h>
17#include <linux/kernel.h>
18#include <linux/sched.h>
19#include <linux/init.h>
20#include <linux/initrd.h>
21#include <linux/seq_file.h>
22
23/* Needs INITSERIAL call in head.S! */
24#undef APUS_DEBUG
25
26#include <asm/bootinfo.h>
27#include <asm/setup.h>
28#include <asm/amigahw.h>
29#include <asm/amigaints.h>
30#include <asm/amigappc.h>
31#include <asm/pgtable.h>
32#include <asm/dma.h>
33#include <asm/machdep.h>
34#include <asm/time.h>
35
36unsigned long m68k_machtype;
37char debug_device[6] = "";
38
39extern void amiga_init_IRQ(void);
40
41extern void apus_setup_pci_ptrs(void);
42
43void (*mach_sched_init) (void (*handler)(int, void *, struct pt_regs *)) __initdata = NULL;
44/* machine dependent irq functions */
45void (*mach_init_IRQ) (void) __initdata = NULL;
46void (*(*mach_default_handler)[]) (int, void *, struct pt_regs *) = NULL;
47void (*mach_get_model) (char *model) = NULL;
48int (*mach_get_hardware_list) (char *buffer) = NULL;
49int (*mach_get_irq_list) (struct seq_file *, void *) = NULL;
50void (*mach_process_int) (int, struct pt_regs *) = NULL;
51/* machine dependent timer functions */
52unsigned long (*mach_gettimeoffset) (void);
53void (*mach_gettod) (int*, int*, int*, int*, int*, int*);
54int (*mach_hwclk) (int, struct hwclk_time*) = NULL;
55int (*mach_set_clock_mmss) (unsigned long) = NULL;
56void (*mach_reset)( void );
57long mach_max_dma_address = 0x00ffffff; /* default set to the lower 16MB */
58#if defined(CONFIG_AMIGA_FLOPPY)
59void (*mach_floppy_setup) (char *, int *) __initdata = NULL;
60#endif
61#ifdef CONFIG_HEARTBEAT
62void (*mach_heartbeat) (int) = NULL;
63extern void apus_heartbeat (void);
64#endif
65
66extern unsigned long amiga_model;
67extern unsigned decrementer_count;/* count value for 1e6/HZ microseconds */
68extern unsigned count_period_num; /* 1 decrementer count equals */
69extern unsigned count_period_den; /* count_period_num / count_period_den us */
70
71int num_memory = 0;
72struct mem_info memory[NUM_MEMINFO];/* memory description */
73/* FIXME: Duplicate memory data to avoid conflicts with m68k shared code. */
74int m68k_realnum_memory = 0;
75struct mem_info m68k_memory[NUM_MEMINFO];/* memory description */
76
77struct mem_info ramdisk;
78
79extern void amiga_floppy_setup(char *, int *);
80extern void config_amiga(void);
81
82static int __60nsram = 0;
83
84/* for cpuinfo */
85static int __bus_speed = 0;
86static int __speed_test_failed = 0;
87
88/********************************************** COMPILE PROTECTION */
89/* Provide some stubs that links to Amiga specific functions.
90 * This allows CONFIG_APUS to be removed from generic PPC files while
91 * preventing link errors for other PPC targets.
92 */
93unsigned long apus_get_rtc_time(void)
94{
95#ifdef CONFIG_APUS
96 extern unsigned long m68k_get_rtc_time(void);
97
98 return m68k_get_rtc_time ();
99#else
100 return 0;
101#endif
102}
103
104int apus_set_rtc_time(unsigned long nowtime)
105{
106#ifdef CONFIG_APUS
107 extern int m68k_set_rtc_time(unsigned long nowtime);
108
109 return m68k_set_rtc_time (nowtime);
110#else
111 return 0;
112#endif
113}
114
115/*********************************************************** SETUP */
116/* From arch/m68k/kernel/setup.c. */
117void __init apus_setup_arch(void)
118{
119#ifdef CONFIG_APUS
120 extern char cmd_line[];
121 int i;
122 char *p, *q;
123
124 /* Let m68k-shared code know it should do the Amiga thing. */
125 m68k_machtype = MACH_AMIGA;
126
127 /* Parse the command line for arch-specific options.
128 * For the m68k, this is currently only "debug=xxx" to enable printing
129 * certain kernel messages to some machine-specific device. */
130 for( p = cmd_line; p && *p; ) {
131 i = 0;
132 if (!strncmp( p, "debug=", 6 )) {
133 strlcpy( debug_device, p+6, sizeof(debug_device) );
134 if ((q = strchr( debug_device, ' ' ))) *q = 0;
135 i = 1;
136 } else if (!strncmp( p, "60nsram", 7 )) {
137 APUS_WRITE (APUS_REG_WAITSTATE,
138 REGWAITSTATE_SETRESET
139 |REGWAITSTATE_PPCR
140 |REGWAITSTATE_PPCW);
141 __60nsram = 1;
142 i = 1;
143 }
144
145 if (i) {
146 /* option processed, delete it */
147 if ((q = strchr( p, ' ' )))
148 strcpy( p, q+1 );
149 else
150 *p = 0;
151 } else {
152 if ((p = strchr( p, ' ' ))) ++p;
153 }
154 }
155
156 config_amiga();
157
158#if 0 /* Enable for logging - also include logging.o in Makefile rule */
159 {
160#define LOG_SIZE 4096
161 void* base;
162
163 /* Throw away some memory - the P5 firmare stomps on top
164 * of CHIP memory during bootup.
165 */
166 amiga_chip_alloc(0x1000);
167
168 base = amiga_chip_alloc(LOG_SIZE+sizeof(klog_data_t));
169 LOG_INIT(base, base+sizeof(klog_data_t), LOG_SIZE);
170 }
171#endif
172#endif
173}
174
175int
176apus_show_cpuinfo(struct seq_file *m)
177{
178 extern int __map_without_bats;
179 extern unsigned long powerup_PCI_present;
180
181 seq_printf(m, "machine\t\t: Amiga\n");
182 seq_printf(m, "bus speed\t: %d%s", __bus_speed,
183 (__speed_test_failed) ? " [failed]\n" : "\n");
184 seq_printf(m, "using BATs\t: %s\n",
185 (__map_without_bats) ? "No" : "Yes");
186 seq_printf(m, "ram speed\t: %dns\n", (__60nsram) ? 60 : 70);
187 seq_printf(m, "PCI bridge\t: %s\n",
188 (powerup_PCI_present) ? "Yes" : "No");
189 return 0;
190}
191
192static void get_current_tb(unsigned long long *time)
193{
194 __asm __volatile ("1:mftbu 4 \n\t"
195 " mftb 5 \n\t"
196 " mftbu 6 \n\t"
197 " cmpw 4,6 \n\t"
198 " bne 1b \n\t"
199 " stw 4,0(%0)\n\t"
200 " stw 5,4(%0)\n\t"
201 :
202 : "r" (time)
203 : "r4", "r5", "r6");
204}
205
206
207void apus_calibrate_decr(void)
208{
209#ifdef CONFIG_APUS
210 unsigned long freq;
211
212 /* This algorithm for determining the bus speed was
213 contributed by Ralph Schmidt. */
214 unsigned long long start, stop;
215 int bus_speed;
216 int speed_test_failed = 0;
217
218 {
219 unsigned long loop = amiga_eclock / 10;
220
221 get_current_tb (&start);
222 while (loop--) {
223 unsigned char tmp;
224
225 tmp = ciaa.pra;
226 }
227 get_current_tb (&stop);
228 }
229
230 bus_speed = (((unsigned long)(stop-start))*10*4) / 1000000;
231 if (AMI_1200 == amiga_model)
232 bus_speed /= 2;
233
234 if ((bus_speed >= 47) && (bus_speed < 53)) {
235 bus_speed = 50;
236 freq = 12500000;
237 } else if ((bus_speed >= 57) && (bus_speed < 63)) {
238 bus_speed = 60;
239 freq = 15000000;
240 } else if ((bus_speed >= 63) && (bus_speed < 69)) {
241 bus_speed = 67;
242 freq = 16666667;
243 } else {
244 printk ("APUS: Unable to determine bus speed (%d). "
245 "Defaulting to 50MHz", bus_speed);
246 bus_speed = 50;
247 freq = 12500000;
248 speed_test_failed = 1;
249 }
250
251 /* Ease diagnostics... */
252 {
253 extern int __map_without_bats;
254 extern unsigned long powerup_PCI_present;
255
256 printk ("APUS: BATs=%d, BUS=%dMHz",
257 (__map_without_bats) ? 0 : 1,
258 bus_speed);
259 if (speed_test_failed)
260 printk ("[FAILED - please report]");
261
262 printk (", RAM=%dns, PCI bridge=%d\n",
263 (__60nsram) ? 60 : 70,
264 (powerup_PCI_present) ? 1 : 0);
265
266 /* print a bit more if asked politely... */
267 if (!(ciaa.pra & 0x40)){
268 extern unsigned int bat_addrs[4][3];
269 int b;
270 for (b = 0; b < 4; ++b) {
271 printk ("APUS: BAT%d ", b);
272 printk ("%08x-%08x -> %08x\n",
273 bat_addrs[b][0],
274 bat_addrs[b][1],
275 bat_addrs[b][2]);
276 }
277 }
278
279 }
280
281 printk("time_init: decrementer frequency = %lu.%.6lu MHz\n",
282 freq/1000000, freq%1000000);
283 tb_ticks_per_jiffy = freq / HZ;
284 tb_to_us = mulhwu_scale_factor(freq, 1000000);
285
286 __bus_speed = bus_speed;
287 __speed_test_failed = speed_test_failed;
288#endif
289}
290
291void arch_gettod(int *year, int *mon, int *day, int *hour,
292 int *min, int *sec)
293{
294#ifdef CONFIG_APUS
295 if (mach_gettod)
296 mach_gettod(year, mon, day, hour, min, sec);
297 else
298 *year = *mon = *day = *hour = *min = *sec = 0;
299#endif
300}
301
302/* for "kbd-reset" cmdline param */
303__init
304void kbd_reset_setup(char *str, int *ints)
305{
306}
307
308/*********************************************************** FLOPPY */
309#if defined(CONFIG_AMIGA_FLOPPY)
310__init
311void floppy_setup(char *str, int *ints)
312{
313 if (mach_floppy_setup)
314 mach_floppy_setup (str, ints);
315}
316#endif
317
318/*********************************************************** MEMORY */
319#define KMAP_MAX 32
320unsigned long kmap_chunks[KMAP_MAX*3];
321int kmap_chunk_count = 0;
322
323/* From pgtable.h */
324static __inline__ pte_t *my_find_pte(struct mm_struct *mm,unsigned long va)
325{
326 pgd_t *dir = 0;
327 pmd_t *pmd = 0;
328 pte_t *pte = 0;
329
330 va &= PAGE_MASK;
331
332 dir = pgd_offset( mm, va );
333 if (dir)
334 {
335 pmd = pmd_offset(dir, va & PAGE_MASK);
336 if (pmd && pmd_present(*pmd))
337 {
338 pte = pte_offset(pmd, va);
339 }
340 }
341 return pte;
342}
343
344
345/* Again simulating an m68k/mm/kmap.c function. */
346void kernel_set_cachemode( unsigned long address, unsigned long size,
347 unsigned int cmode )
348{
349 unsigned long mask, flags;
350
351 switch (cmode)
352 {
353 case IOMAP_FULL_CACHING:
354 mask = ~(_PAGE_NO_CACHE | _PAGE_GUARDED);
355 flags = 0;
356 break;
357 case IOMAP_NOCACHE_SER:
358 mask = ~0;
359 flags = (_PAGE_NO_CACHE | _PAGE_GUARDED);
360 break;
361 default:
362 panic ("kernel_set_cachemode() doesn't support mode %d\n",
363 cmode);
364 break;
365 }
366
367 size /= PAGE_SIZE;
368 address &= PAGE_MASK;
369 while (size--)
370 {
371 pte_t *pte;
372
373 pte = my_find_pte(&init_mm, address);
374 if ( !pte )
375 {
376 printk("pte NULL in kernel_set_cachemode()\n");
377 return;
378 }
379
380 pte_val (*pte) &= mask;
381 pte_val (*pte) |= flags;
382 flush_tlb_page(find_vma(&init_mm,address),address);
383
384 address += PAGE_SIZE;
385 }
386}
387
388unsigned long mm_ptov (unsigned long paddr)
389{
390 unsigned long ret;
391 if (paddr < 16*1024*1024)
392 ret = ZTWO_VADDR(paddr);
393 else {
394 int i;
395
396 for (i = 0; i < kmap_chunk_count;){
397 unsigned long phys = kmap_chunks[i++];
398 unsigned long size = kmap_chunks[i++];
399 unsigned long virt = kmap_chunks[i++];
400 if (paddr >= phys
401 && paddr < (phys + size)){
402 ret = virt + paddr - phys;
403 goto exit;
404 }
405 }
406
407 ret = (unsigned long) __va(paddr);
408 }
409exit:
410#ifdef DEBUGPV
411 printk ("PTOV(%lx)=%lx\n", paddr, ret);
412#endif
413 return ret;
414}
415
416int mm_end_of_chunk (unsigned long addr, int len)
417{
418 if (memory[0].addr + memory[0].size == addr + len)
419 return 1;
420 return 0;
421}
422
423/*********************************************************** CACHE */
424
425#define L1_CACHE_BYTES 32
426#define MAX_CACHE_SIZE 8192
427void cache_push(__u32 addr, int length)
428{
429 addr = mm_ptov(addr);
430
431 if (MAX_CACHE_SIZE < length)
432 length = MAX_CACHE_SIZE;
433
434 while(length > 0){
435 __asm ("dcbf 0,%0\n\t"
436 : : "r" (addr));
437 addr += L1_CACHE_BYTES;
438 length -= L1_CACHE_BYTES;
439 }
440 /* Also flush trailing block */
441 __asm ("dcbf 0,%0\n\t"
442 "sync \n\t"
443 : : "r" (addr));
444}
445
446void cache_clear(__u32 addr, int length)
447{
448 if (MAX_CACHE_SIZE < length)
449 length = MAX_CACHE_SIZE;
450
451 addr = mm_ptov(addr);
452
453 __asm ("dcbf 0,%0\n\t"
454 "sync \n\t"
455 "icbi 0,%0 \n\t"
456 "isync \n\t"
457 : : "r" (addr));
458
459 addr += L1_CACHE_BYTES;
460 length -= L1_CACHE_BYTES;
461
462 while(length > 0){
463 __asm ("dcbf 0,%0\n\t"
464 "sync \n\t"
465 "icbi 0,%0 \n\t"
466 "isync \n\t"
467 : : "r" (addr));
468 addr += L1_CACHE_BYTES;
469 length -= L1_CACHE_BYTES;
470 }
471
472 __asm ("dcbf 0,%0\n\t"
473 "sync \n\t"
474 "icbi 0,%0 \n\t"
475 "isync \n\t"
476 : : "r" (addr));
477}
478
479/****************************************************** from setup.c */
480void
481apus_restart(char *cmd)
482{
483 local_irq_disable();
484
485 APUS_WRITE(APUS_REG_LOCK,
486 REGLOCK_BLACKMAGICK1|REGLOCK_BLACKMAGICK2);
487 APUS_WRITE(APUS_REG_LOCK,
488 REGLOCK_BLACKMAGICK1|REGLOCK_BLACKMAGICK3);
489 APUS_WRITE(APUS_REG_LOCK,
490 REGLOCK_BLACKMAGICK2|REGLOCK_BLACKMAGICK3);
491 APUS_WRITE(APUS_REG_SHADOW, REGSHADOW_SELFRESET);
492 APUS_WRITE(APUS_REG_RESET, REGRESET_AMIGARESET);
493 for(;;);
494}
495
496void
497apus_power_off(void)
498{
499 for (;;);
500}
501
502void
503apus_halt(void)
504{
505 apus_restart(NULL);
506}
507
508/****************************************************** IRQ stuff */
509
510static unsigned char last_ipl[8];
511
512int apus_get_irq(struct pt_regs* regs)
513{
514 unsigned char ipl_emu, mask;
515 unsigned int level;
516
517 APUS_READ(APUS_IPL_EMU, ipl_emu);
518 level = (ipl_emu >> 3) & IPLEMU_IPLMASK;
519 mask = IPLEMU_SETRESET|IPLEMU_DISABLEINT|level;
520 level ^= 7;
521
522 /* Save previous IPL value */
523 if (last_ipl[level])
524 return -2;
525 last_ipl[level] = ipl_emu;
526
527 /* Set to current IPL value */
528 APUS_WRITE(APUS_IPL_EMU, mask);
529 APUS_WRITE(APUS_IPL_EMU, IPLEMU_DISABLEINT|level);
530
531
532#ifdef __INTERRUPT_DEBUG
533 printk("<%d:%d>", level, ~ipl_emu & IPLEMU_IPLMASK);
534#endif
535 return level + IRQ_AMIGA_AUTO;
536}
537
538void apus_end_irq(unsigned int irq)
539{
540 unsigned char ipl_emu;
541 unsigned int level = irq - IRQ_AMIGA_AUTO;
542#ifdef __INTERRUPT_DEBUG
543 printk("{%d}", ~last_ipl[level] & IPLEMU_IPLMASK);
544#endif
545 /* Restore IPL to the previous value */
546 ipl_emu = last_ipl[level] & IPLEMU_IPLMASK;
547 APUS_WRITE(APUS_IPL_EMU, IPLEMU_SETRESET|IPLEMU_DISABLEINT|ipl_emu);
548 last_ipl[level] = 0;
549 ipl_emu ^= 7;
550 APUS_WRITE(APUS_IPL_EMU, IPLEMU_DISABLEINT|ipl_emu);
551}
552
553/****************************************************** debugging */
554
555/* some serial hardware definitions */
556#define SDR_OVRUN (1<<15)
557#define SDR_RBF (1<<14)
558#define SDR_TBE (1<<13)
559#define SDR_TSRE (1<<12)
560
561#define AC_SETCLR (1<<15)
562#define AC_UARTBRK (1<<11)
563
564#define SER_DTR (1<<7)
565#define SER_RTS (1<<6)
566#define SER_DCD (1<<5)
567#define SER_CTS (1<<4)
568#define SER_DSR (1<<3)
569
570static __inline__ void ser_RTSon(void)
571{
572 ciab.pra &= ~SER_RTS; /* active low */
573}
574
575int __debug_ser_out( unsigned char c )
576{
577 custom.serdat = c | 0x100;
578 mb();
579 while (!(custom.serdatr & 0x2000))
580 barrier();
581 return 1;
582}
583
584unsigned char __debug_ser_in( void )
585{
586 unsigned char c;
587
588 /* XXX: is that ok?? derived from amiga_ser.c... */
589 while( !(custom.intreqr & IF_RBF) )
590 barrier();
591 c = custom.serdatr;
592 /* clear the interrupt, so that another character can be read */
593 custom.intreq = IF_RBF;
594 return c;
595}
596
597int __debug_serinit( void )
598{
599 unsigned long flags;
600
601 local_irq_save(flags);
602
603 /* turn off Rx and Tx interrupts */
604 custom.intena = IF_RBF | IF_TBE;
605
606 /* clear any pending interrupt */
607 custom.intreq = IF_RBF | IF_TBE;
608
609 local_irq_restore(flags);
610
611 /*
612 * set the appropriate directions for the modem control flags,
613 * and clear RTS and DTR
614 */
615 ciab.ddra |= (SER_DTR | SER_RTS); /* outputs */
616 ciab.ddra &= ~(SER_DCD | SER_CTS | SER_DSR); /* inputs */
617
618#ifdef CONFIG_KGDB
619 /* turn Rx interrupts on for GDB */
620 custom.intena = IF_SETCLR | IF_RBF;
621 ser_RTSon();
622#endif
623
624 return 0;
625}
626
627void __debug_print_hex(unsigned long x)
628{
629 int i;
630 char hexchars[] = "0123456789ABCDEF";
631
632 for (i = 0; i < 8; i++) {
633 __debug_ser_out(hexchars[(x >> 28) & 15]);
634 x <<= 4;
635 }
636 __debug_ser_out('\n');
637 __debug_ser_out('\r');
638}
639
640void __debug_print_string(char* s)
641{
642 unsigned char c;
643 while((c = *s++))
644 __debug_ser_out(c);
645 __debug_ser_out('\n');
646 __debug_ser_out('\r');
647}
648
649static void apus_progress(char *s, unsigned short value)
650{
651 __debug_print_string(s);
652}
653
654/****************************************************** init */
655
656/* The number of spurious interrupts */
657volatile unsigned int num_spurious;
658
659extern struct irqaction amiga_sys_irqaction[AUTO_IRQS];
660
661
662extern void amiga_enable_irq(unsigned int irq);
663extern void amiga_disable_irq(unsigned int irq);
664
665struct hw_interrupt_type amiga_sys_irqctrl = {
666 .typename = "Amiga IPL",
667 .end = apus_end_irq,
668};
669
670struct hw_interrupt_type amiga_irqctrl = {
671 .typename = "Amiga ",
672 .enable = amiga_enable_irq,
673 .disable = amiga_disable_irq,
674};
675
676#define HARDWARE_MAPPED_SIZE (512*1024)
677unsigned long __init apus_find_end_of_memory(void)
678{
679 int shadow = 0;
680 unsigned long total;
681
682 /* The memory size reported by ADOS excludes the 512KB
683 reserved for PPC exception registers and possibly 512KB
684 containing a shadow of the ADOS ROM. */
685 {
686 unsigned long size = memory[0].size;
687
688 /* If 2MB aligned, size was probably user
689 specified. We can't tell anything about shadowing
690 in this case so skip shadow assignment. */
691 if (0 != (size & 0x1fffff)){
692 /* Align to 512KB to ensure correct handling
693 of both memfile and system specified
694 sizes. */
695 size = ((size+0x0007ffff) & 0xfff80000);
696 /* If memory is 1MB aligned, assume
697 shadowing. */
698 shadow = !(size & 0x80000);
699 }
700
701 /* Add the chunk that ADOS does not see. by aligning
702 the size to the nearest 2MB limit upwards. */
703 memory[0].size = ((size+0x001fffff) & 0xffe00000);
704 }
705
706 ppc_memstart = memory[0].addr;
707 ppc_memoffset = PAGE_OFFSET - PPC_MEMSTART;
708 total = memory[0].size;
709
710 /* Remove the memory chunks that are controlled by special
711 Phase5 hardware. */
712
713 /* Remove the upper 512KB if it contains a shadow of
714 the ADOS ROM. FIXME: It might be possible to
715 disable this shadow HW. Check the booter
716 (ppc_boot.c) */
717 if (shadow)
718 total -= HARDWARE_MAPPED_SIZE;
719
720 /* Remove the upper 512KB where the PPC exception
721 vectors are mapped. */
722 total -= HARDWARE_MAPPED_SIZE;
723
724 /* Linux/APUS only handles one block of memory -- the one on
725 the PowerUP board. Other system memory is horrible slow in
726 comparison. The user can use other memory for swapping
727 using the z2ram device. */
728 return total;
729}
730
731static void __init
732apus_map_io(void)
733{
734 /* Map PPC exception vectors. */
735 io_block_mapping(0xfff00000, 0xfff00000, 0x00020000, _PAGE_KERNEL);
736 /* Map chip and ZorroII memory */
737 io_block_mapping(zTwoBase, 0x00000000, 0x01000000, _PAGE_IO);
738}
739
740__init
741void apus_init_IRQ(void)
742{
743 struct irqaction *action;
744 int i;
745
746#ifdef CONFIG_PCI
747 apus_setup_pci_ptrs();
748#endif
749
750 for ( i = 0 ; i < AMI_IRQS; i++ ) {
751 irq_desc[i].status = IRQ_LEVEL;
752 if (i < IRQ_AMIGA_AUTO) {
753 irq_desc[i].handler = &amiga_irqctrl;
754 } else {
755 irq_desc[i].handler = &amiga_sys_irqctrl;
756 action = &amiga_sys_irqaction[i-IRQ_AMIGA_AUTO];
757 if (action->name)
758 setup_irq(i, action);
759 }
760 }
761
762 amiga_init_IRQ();
763
764}
765
766__init
767void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
768 unsigned long r6, unsigned long r7)
769{
770 extern int parse_bootinfo(const struct bi_record *);
771 extern char _end[];
772
773 /* Parse bootinfo. The bootinfo is located right after
774 the kernel bss */
775 parse_bootinfo((const struct bi_record *)&_end);
776#ifdef CONFIG_BLK_DEV_INITRD
777 /* Take care of initrd if we have one. Use data from
778 bootinfo to avoid the need to initialize PPC
779 registers when kernel is booted via a PPC reset. */
780 if ( ramdisk.addr ) {
781 initrd_start = (unsigned long) __va(ramdisk.addr);
782 initrd_end = (unsigned long)
783 __va(ramdisk.size + ramdisk.addr);
784 }
785#endif /* CONFIG_BLK_DEV_INITRD */
786
787 ISA_DMA_THRESHOLD = 0x00ffffff;
788
789 ppc_md.setup_arch = apus_setup_arch;
790 ppc_md.show_cpuinfo = apus_show_cpuinfo;
791 ppc_md.init_IRQ = apus_init_IRQ;
792 ppc_md.get_irq = apus_get_irq;
793
794#ifdef CONFIG_HEARTBEAT
795 ppc_md.heartbeat = apus_heartbeat;
796 ppc_md.heartbeat_count = 1;
797#endif
798#ifdef APUS_DEBUG
799 __debug_serinit();
800 ppc_md.progress = apus_progress;
801#endif
802 ppc_md.init = NULL;
803
804 ppc_md.restart = apus_restart;
805 ppc_md.power_off = apus_power_off;
806 ppc_md.halt = apus_halt;
807
808 ppc_md.time_init = NULL;
809 ppc_md.set_rtc_time = apus_set_rtc_time;
810 ppc_md.get_rtc_time = apus_get_rtc_time;
811 ppc_md.calibrate_decr = apus_calibrate_decr;
812
813 ppc_md.find_end_of_memory = apus_find_end_of_memory;
814 ppc_md.setup_io_mappings = apus_map_io;
815}
diff --git a/arch/ppc/platforms/bseip.h b/arch/ppc/platforms/bseip.h
new file mode 100644
index 000000000000..691f4a52b0a5
--- /dev/null
+++ b/arch/ppc/platforms/bseip.h
@@ -0,0 +1,38 @@
1/*
2 * A collection of structures, addresses, and values associated with
3 * the Bright Star Engineering ip-Engine board. Copied from the MBX stuff.
4 *
5 * Copyright (c) 1998 Dan Malek (dmalek@jlc.net)
6 */
7#ifndef __MACH_BSEIP_DEFS
8#define __MACH_BSEIP_DEFS
9
10#ifndef __ASSEMBLY__
11/* A Board Information structure that is given to a program when
12 * prom starts it up.
13 */
14typedef struct bd_info {
15 unsigned int bi_memstart; /* Memory start address */
16 unsigned int bi_memsize; /* Memory (end) size in bytes */
17 unsigned int bi_intfreq; /* Internal Freq, in Hz */
18 unsigned int bi_busfreq; /* Bus Freq, in Hz */
19 unsigned char bi_enetaddr[6];
20 unsigned int bi_baudrate;
21} bd_t;
22
23extern bd_t m8xx_board_info;
24
25/* Memory map is configured by the PROM startup.
26 * All we need to get started is the IMMR.
27 */
28#define IMAP_ADDR ((uint)0xff000000)
29#define IMAP_SIZE ((uint)(64 * 1024))
30#define PCMCIA_MEM_ADDR ((uint)0x04000000)
31#define PCMCIA_MEM_SIZE ((uint)(64 * 1024))
32#endif /* !__ASSEMBLY__ */
33
34/* We don't use the 8259.
35*/
36#define NR_8259_INTS 0
37
38#endif
diff --git a/arch/ppc/platforms/ccm.h b/arch/ppc/platforms/ccm.h
new file mode 100644
index 000000000000..edb87b573831
--- /dev/null
+++ b/arch/ppc/platforms/ccm.h
@@ -0,0 +1,28 @@
1/*
2 * Siemens Card Controller Module specific definitions
3 *
4 * Copyright (C) 2001-2002 Wolfgang Denk (wd@denx.de)
5 */
6
7#ifndef __MACH_CCM_H
8#define __MACH_CCM_H
9
10#include <linux/config.h>
11
12#include <asm/ppcboot.h>
13
14#define CCM_IMMR_BASE 0xF0000000 /* phys. addr of IMMR */
15#define CCM_IMAP_SIZE (64 * 1024) /* size of mapped area */
16
17#define IMAP_ADDR CCM_IMMR_BASE /* physical base address of IMMR area */
18#define IMAP_SIZE CCM_IMAP_SIZE /* mapped size of IMMR area */
19
20#define FEC_INTERRUPT 13 /* = SIU_LEVEL6 */
21#define DEC_INTERRUPT 11 /* = SIU_LEVEL5 */
22#define CPM_INTERRUPT 9 /* = SIU_LEVEL4 */
23
24/* We don't use the 8259.
25*/
26#define NR_8259_INTS 0
27
28#endif /* __MACH_CCM_H */
diff --git a/arch/ppc/platforms/chestnut.c b/arch/ppc/platforms/chestnut.c
new file mode 100644
index 000000000000..7786818bd9d0
--- /dev/null
+++ b/arch/ppc/platforms/chestnut.c
@@ -0,0 +1,580 @@
1/*
2 * arch/ppc/platforms/chestnut.c
3 *
4 * Board setup routines for IBM Chestnut
5 *
6 * Author: <source@mvista.com>
7 *
8 * <2004> (c) MontaVista Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
11 * or implied.
12 */
13
14#include <linux/config.h>
15#include <linux/stddef.h>
16#include <linux/kernel.h>
17#include <linux/init.h>
18#include <linux/errno.h>
19#include <linux/reboot.h>
20#include <linux/kdev_t.h>
21#include <linux/major.h>
22#include <linux/blkdev.h>
23#include <linux/console.h>
24#include <linux/root_dev.h>
25#include <linux/initrd.h>
26#include <linux/delay.h>
27#include <linux/seq_file.h>
28#include <linux/ide.h>
29#include <linux/serial.h>
30#include <linux/serial_core.h>
31#include <linux/mtd/physmap.h>
32#include <asm/system.h>
33#include <asm/pgtable.h>
34#include <asm/page.h>
35#include <asm/time.h>
36#include <asm/dma.h>
37#include <asm/io.h>
38#include <linux/irq.h>
39#include <asm/hw_irq.h>
40#include <asm/machdep.h>
41#include <asm/kgdb.h>
42#include <asm/bootinfo.h>
43#include <asm/mv64x60.h>
44#include <platforms/chestnut.h>
45
46static void __iomem *sram_base; /* Virtual addr of Internal SRAM */
47static void __iomem *cpld_base; /* Virtual addr of CPLD Regs */
48
49static mv64x60_handle_t bh;
50
51extern void gen550_progress(char *, unsigned short);
52extern void gen550_init(int, struct uart_port *);
53extern void mv64360_pcibios_fixup(mv64x60_handle_t *bh);
54
55#define BIT(x) (1<<x)
56#define CHESTNUT_PRESERVE_MASK (BIT(MV64x60_CPU2DEV_0_WIN) | \
57 BIT(MV64x60_CPU2DEV_1_WIN) | \
58 BIT(MV64x60_CPU2DEV_2_WIN) | \
59 BIT(MV64x60_CPU2DEV_3_WIN) | \
60 BIT(MV64x60_CPU2BOOT_WIN))
61/**************************************************************************
62 * FUNCTION: chestnut_calibrate_decr
63 *
64 * DESCRIPTION: initialize decrementer interrupt frequency (used as system
65 * timer)
66 *
67 ****/
68static void __init
69chestnut_calibrate_decr(void)
70{
71 ulong freq;
72
73 freq = CHESTNUT_BUS_SPEED / 4;
74
75 printk("time_init: decrementer frequency = %lu.%.6lu MHz\n",
76 freq/1000000, freq%1000000);
77
78 tb_ticks_per_jiffy = freq / HZ;
79 tb_to_us = mulhwu_scale_factor(freq, 1000000);
80}
81
82static int
83chestnut_show_cpuinfo(struct seq_file *m)
84{
85 seq_printf(m, "vendor\t\t: IBM\n");
86 seq_printf(m, "machine\t\t: 750FX/GX Eval Board (Chestnut/Buckeye)\n");
87
88 return 0;
89}
90
91/**************************************************************************
92 * FUNCTION: chestnut_find_end_of_memory
93 *
94 * DESCRIPTION: ppc_md memory size callback
95 *
96 ****/
97unsigned long __init
98chestnut_find_end_of_memory(void)
99{
100 static int mem_size = 0;
101
102 if (mem_size == 0) {
103 mem_size = mv64x60_get_mem_size(CONFIG_MV64X60_NEW_BASE,
104 MV64x60_TYPE_MV64460);
105 }
106 return mem_size;
107}
108
109#if defined(CONFIG_SERIAL_8250)
110static void __init
111chestnut_early_serial_map(void)
112{
113 struct uart_port port;
114
115 /* Setup serial port access */
116 memset(&port, 0, sizeof(port));
117 port.uartclk = BASE_BAUD * 16;
118 port.irq = UART0_INT;
119 port.flags = STD_COM_FLAGS | UPF_IOREMAP;
120 port.iotype = SERIAL_IO_MEM;
121 port.mapbase = CHESTNUT_UART0_IO_BASE;
122 port.regshift = 0;
123
124 if (early_serial_setup(&port) != 0)
125 printk("Early serial init of port 0 failed\n");
126
127 /* Assume early_serial_setup() doesn't modify serial_req */
128 port.line = 1;
129 port.irq = UART1_INT;
130 port.mapbase = CHESTNUT_UART1_IO_BASE;
131
132 if (early_serial_setup(&port) != 0)
133 printk("Early serial init of port 1 failed\n");
134}
135#endif
136
137/**************************************************************************
138 * FUNCTION: chestnut_map_irq
139 *
140 * DESCRIPTION: 0 return since PCI IRQs not needed
141 *
142 ****/
143static int __init
144chestnut_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
145{
146 static char pci_irq_table[][4] = {
147 {CHESTNUT_PCI_SLOT0_IRQ, CHESTNUT_PCI_SLOT0_IRQ,
148 CHESTNUT_PCI_SLOT0_IRQ, CHESTNUT_PCI_SLOT0_IRQ},
149 {CHESTNUT_PCI_SLOT1_IRQ, CHESTNUT_PCI_SLOT1_IRQ,
150 CHESTNUT_PCI_SLOT1_IRQ, CHESTNUT_PCI_SLOT1_IRQ},
151 {CHESTNUT_PCI_SLOT2_IRQ, CHESTNUT_PCI_SLOT2_IRQ,
152 CHESTNUT_PCI_SLOT2_IRQ, CHESTNUT_PCI_SLOT2_IRQ},
153 {CHESTNUT_PCI_SLOT3_IRQ, CHESTNUT_PCI_SLOT3_IRQ,
154 CHESTNUT_PCI_SLOT3_IRQ, CHESTNUT_PCI_SLOT3_IRQ},
155 };
156 const long min_idsel = 1, max_idsel = 4, irqs_per_slot = 4;
157
158 return PCI_IRQ_TABLE_LOOKUP;
159}
160
161
162/**************************************************************************
163 * FUNCTION: chestnut_setup_bridge
164 *
165 * DESCRIPTION: initalize board-specific settings on the MV64360
166 *
167 ****/
168static void __init
169chestnut_setup_bridge(void)
170{
171 struct mv64x60_setup_info si;
172 int i;
173
174 if ( ppc_md.progress )
175 ppc_md.progress("chestnut_setup_bridge: enter", 0);
176
177 memset(&si, 0, sizeof(si));
178
179 si.phys_reg_base = CONFIG_MV64X60_NEW_BASE;
180
181 /* setup only PCI bus 0 (bus 1 not used) */
182 si.pci_0.enable_bus = 1;
183 si.pci_0.pci_io.cpu_base = CHESTNUT_PCI0_IO_PROC_ADDR;
184 si.pci_0.pci_io.pci_base_hi = 0;
185 si.pci_0.pci_io.pci_base_lo = CHESTNUT_PCI0_IO_PCI_ADDR;
186 si.pci_0.pci_io.size = CHESTNUT_PCI0_IO_SIZE;
187 si.pci_0.pci_io.swap = MV64x60_CPU2PCI_SWAP_NONE; /* no swapping */
188 si.pci_0.pci_mem[0].cpu_base = CHESTNUT_PCI0_MEM_PROC_ADDR;
189 si.pci_0.pci_mem[0].pci_base_hi = CHESTNUT_PCI0_MEM_PCI_HI_ADDR;
190 si.pci_0.pci_mem[0].pci_base_lo = CHESTNUT_PCI0_MEM_PCI_LO_ADDR;
191 si.pci_0.pci_mem[0].size = CHESTNUT_PCI0_MEM_SIZE;
192 si.pci_0.pci_mem[0].swap = MV64x60_CPU2PCI_SWAP_NONE; /* no swapping */
193 si.pci_0.pci_cmd_bits = 0;
194 si.pci_0.latency_timer = 0x80;
195
196 for (i=0; i<MV64x60_CPU2MEM_WINDOWS; i++) {
197#if defined(CONFIG_NOT_COHERENT_CACHE)
198 si.cpu_prot_options[i] = 0;
199 si.enet_options[i] = MV64360_ENET2MEM_SNOOP_NONE;
200 si.mpsc_options[i] = MV64360_MPSC2MEM_SNOOP_NONE;
201 si.idma_options[i] = MV64360_IDMA2MEM_SNOOP_NONE;
202
203 si.pci_1.acc_cntl_options[i] =
204 MV64360_PCI_ACC_CNTL_SNOOP_NONE |
205 MV64360_PCI_ACC_CNTL_SWAP_NONE |
206 MV64360_PCI_ACC_CNTL_MBURST_128_BYTES |
207 MV64360_PCI_ACC_CNTL_RDSIZE_256_BYTES;
208#else
209 si.cpu_prot_options[i] = 0;
210 si.enet_options[i] = MV64360_ENET2MEM_SNOOP_NONE; /* errata */
211 si.mpsc_options[i] = MV64360_MPSC2MEM_SNOOP_NONE; /* errata */
212 si.idma_options[i] = MV64360_IDMA2MEM_SNOOP_NONE; /* errata */
213
214 si.pci_1.acc_cntl_options[i] =
215 MV64360_PCI_ACC_CNTL_SNOOP_WB |
216 MV64360_PCI_ACC_CNTL_SWAP_NONE |
217 MV64360_PCI_ACC_CNTL_MBURST_32_BYTES |
218 MV64360_PCI_ACC_CNTL_RDSIZE_32_BYTES;
219#endif
220 }
221
222 /* Lookup host bridge - on CPU 0 - no SMP support */
223 if (mv64x60_init(&bh, &si)) {
224 printk("\n\nPCI Bridge initialization failed!\n");
225 }
226
227 pci_dram_offset = 0;
228 ppc_md.pci_swizzle = common_swizzle;
229 ppc_md.pci_map_irq = chestnut_map_irq;
230 ppc_md.pci_exclude_device = mv64x60_pci_exclude_device;
231
232 mv64x60_set_bus(&bh, 0, 0);
233 bh.hose_a->first_busno = 0;
234 bh.hose_a->last_busno = 0xff;
235 bh.hose_a->last_busno = pciauto_bus_scan(bh.hose_a, 0);
236}
237
238void __init
239chestnut_setup_peripherals(void)
240{
241 mv64x60_set_32bit_window(&bh, MV64x60_CPU2BOOT_WIN,
242 CHESTNUT_BOOT_8BIT_BASE, CHESTNUT_BOOT_8BIT_SIZE, 0);
243 bh.ci->enable_window_32bit(&bh, MV64x60_CPU2BOOT_WIN);
244
245 mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_0_WIN,
246 CHESTNUT_32BIT_BASE, CHESTNUT_32BIT_SIZE, 0);
247 bh.ci->enable_window_32bit(&bh, MV64x60_CPU2DEV_0_WIN);
248
249 mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_1_WIN,
250 CHESTNUT_CPLD_BASE, CHESTNUT_CPLD_SIZE, 0);
251 bh.ci->enable_window_32bit(&bh, MV64x60_CPU2DEV_1_WIN);
252 cpld_base = ioremap(CHESTNUT_CPLD_BASE, CHESTNUT_CPLD_SIZE);
253
254 mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_2_WIN,
255 CHESTNUT_UART_BASE, CHESTNUT_UART_SIZE, 0);
256 bh.ci->enable_window_32bit(&bh, MV64x60_CPU2DEV_2_WIN);
257
258 mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_3_WIN,
259 CHESTNUT_FRAM_BASE, CHESTNUT_FRAM_SIZE, 0);
260 bh.ci->enable_window_32bit(&bh, MV64x60_CPU2DEV_3_WIN);
261
262 mv64x60_set_32bit_window(&bh, MV64x60_CPU2SRAM_WIN,
263 CHESTNUT_INTERNAL_SRAM_BASE, MV64360_SRAM_SIZE, 0);
264 bh.ci->enable_window_32bit(&bh, MV64x60_CPU2SRAM_WIN);
265
266#ifdef CONFIG_NOT_COHERENT_CACHE
267 mv64x60_write(&bh, MV64360_SRAM_CONFIG, 0x001600b0);
268#else
269 mv64x60_write(&bh, MV64360_SRAM_CONFIG, 0x001600b2);
270#endif
271 sram_base = ioremap(CHESTNUT_INTERNAL_SRAM_BASE, MV64360_SRAM_SIZE);
272 memset(sram_base, 0, MV64360_SRAM_SIZE);
273
274 /*
275 * Configure MPP pins for PCI DMA
276 *
277 * PCI Slot GNT pin REQ pin
278 * 0 MPP16 MPP17
279 * 1 MPP18 MPP19
280 * 2 MPP20 MPP21
281 * 3 MPP22 MPP23
282 */
283 mv64x60_write(&bh, MV64x60_MPP_CNTL_2,
284 (0x1 << 0) | /* MPPSel16 PCI0_GNT[0] */
285 (0x1 << 4) | /* MPPSel17 PCI0_REQ[0] */
286 (0x1 << 8) | /* MPPSel18 PCI0_GNT[1] */
287 (0x1 << 12) | /* MPPSel19 PCI0_REQ[1] */
288 (0x1 << 16) | /* MPPSel20 PCI0_GNT[2] */
289 (0x1 << 20) | /* MPPSel21 PCI0_REQ[2] */
290 (0x1 << 24) | /* MPPSel22 PCI0_GNT[3] */
291 (0x1 << 28)); /* MPPSel23 PCI0_REQ[3] */
292 /*
293 * Set unused MPP pins for output, as per schematic note
294 *
295 * Unused Pins: MPP01, MPP02, MPP04, MPP05, MPP06
296 * MPP09, MPP10, MPP13, MPP14, MPP15
297 */
298 mv64x60_clr_bits(&bh, MV64x60_MPP_CNTL_0,
299 (0xf << 4) | /* MPPSel01 GPIO[1] */
300 (0xf << 8) | /* MPPSel02 GPIO[2] */
301 (0xf << 16) | /* MPPSel04 GPIO[4] */
302 (0xf << 20) | /* MPPSel05 GPIO[5] */
303 (0xf << 24)); /* MPPSel06 GPIO[6] */
304 mv64x60_clr_bits(&bh, MV64x60_MPP_CNTL_1,
305 (0xf << 4) | /* MPPSel09 GPIO[9] */
306 (0xf << 8) | /* MPPSel10 GPIO[10] */
307 (0xf << 20) | /* MPPSel13 GPIO[13] */
308 (0xf << 24) | /* MPPSel14 GPIO[14] */
309 (0xf << 28)); /* MPPSel15 GPIO[15] */
310 mv64x60_set_bits(&bh, MV64x60_GPP_IO_CNTL, /* Output */
311 BIT(1) | BIT(2) | BIT(4) | BIT(5) | BIT(6) |
312 BIT(9) | BIT(10) | BIT(13) | BIT(14) | BIT(15));
313
314 /*
315 * Configure the following MPP pins to indicate a level
316 * triggered interrupt
317 *
318 * MPP24 - Board Reset (just map the MPP & GPP for chestnut_reset)
319 * MPP25 - UART A (high)
320 * MPP26 - UART B (high)
321 * MPP28 - PCI Slot 3 (low)
322 * MPP29 - PCI Slot 2 (low)
323 * MPP30 - PCI Slot 1 (low)
324 * MPP31 - PCI Slot 0 (low)
325 */
326 mv64x60_clr_bits(&bh, MV64x60_MPP_CNTL_3,
327 BIT(3) | BIT(2) | BIT(1) | BIT(0) | /* MPP 24 */
328 BIT(7) | BIT(6) | BIT(5) | BIT(4) | /* MPP 25 */
329 BIT(11) | BIT(10) | BIT(9) | BIT(8) | /* MPP 26 */
330 BIT(19) | BIT(18) | BIT(17) | BIT(16) | /* MPP 28 */
331 BIT(23) | BIT(22) | BIT(21) | BIT(20) | /* MPP 29 */
332 BIT(27) | BIT(26) | BIT(25) | BIT(24) | /* MPP 30 */
333 BIT(31) | BIT(30) | BIT(29) | BIT(28)); /* MPP 31 */
334
335 /*
336 * Define GPP 25 (high), 26 (high), 28 (low), 29 (low), 30 (low),
337 * 31 (low) interrupt polarity input signal and level triggered
338 */
339 mv64x60_clr_bits(&bh, MV64x60_GPP_LEVEL_CNTL, BIT(25) | BIT(26));
340 mv64x60_set_bits(&bh, MV64x60_GPP_LEVEL_CNTL,
341 BIT(28) | BIT(29) | BIT(30) | BIT(31));
342 mv64x60_clr_bits(&bh, MV64x60_GPP_IO_CNTL,
343 BIT(25) | BIT(26) | BIT(28) | BIT(29) | BIT(30) |
344 BIT(31));
345
346 /* Config GPP interrupt controller to respond to level trigger */
347 mv64x60_set_bits(&bh, MV64360_COMM_ARBITER_CNTL, BIT(10));
348
349 /*
350 * Dismiss and then enable interrupt on GPP interrupt cause for CPU #0
351 */
352 mv64x60_write(&bh, MV64x60_GPP_INTR_CAUSE,
353 ~(BIT(25) | BIT(26) | BIT(28) | BIT(29) | BIT(30) |
354 BIT(31)));
355 mv64x60_set_bits(&bh, MV64x60_GPP_INTR_MASK,
356 BIT(25) | BIT(26) | BIT(28) | BIT(29) | BIT(30) |
357 BIT(31));
358
359 /*
360 * Dismiss and then enable interrupt on CPU #0 high cause register
361 * BIT27 summarizes GPP interrupts 24-31
362 */
363 mv64x60_set_bits(&bh, MV64360_IC_CPU0_INTR_MASK_HI, BIT(27));
364
365 if (ppc_md.progress)
366 ppc_md.progress("chestnut_setup_bridge: exit", 0);
367}
368
369/**************************************************************************
370 * FUNCTION: chestnut_setup_arch
371 *
372 * DESCRIPTION: ppc_md machine configuration callback
373 *
374 ****/
375static void __init
376chestnut_setup_arch(void)
377{
378 if (ppc_md.progress)
379 ppc_md.progress("chestnut_setup_arch: enter", 0);
380
381 /* init to some ~sane value until calibrate_delay() runs */
382 loops_per_jiffy = 50000000 / HZ;
383
384 /* if the time base value is greater than bus freq/4 (the TB and
385 * decrementer tick rate) + signed integer rollover value, we
386 * can spend a fair amount of time waiting for the rollover to
387 * happen. To get around this, initialize the time base register
388 * to a "safe" value.
389 */
390 set_tb(0, 0);
391
392#ifdef CONFIG_BLK_DEV_INITRD
393 if (initrd_start)
394 ROOT_DEV = Root_RAM0;
395 else
396#endif
397#ifdef CONFIG_ROOT_NFS
398 ROOT_DEV = Root_NFS;
399#else
400 ROOT_DEV = Root_SDA2;
401#endif
402
403 /*
404 * Set up the L2CR register.
405 */
406 _set_L2CR(_get_L2CR() | L2CR_L2E);
407
408 chestnut_setup_bridge();
409 chestnut_setup_peripherals();
410
411#ifdef CONFIG_DUMMY_CONSOLE
412 conswitchp = &dummy_con;
413#endif
414
415#if defined(CONFIG_SERIAL_8250)
416 chestnut_early_serial_map();
417#endif
418
419 /* Identify the system */
420 printk(KERN_INFO "System Identification: IBM 750FX/GX Eval Board\n");
421 printk(KERN_INFO "IBM 750FX/GX port (C) 2004 MontaVista Software, Inc."
422 " (source@mvista.com)\n");
423
424 if (ppc_md.progress)
425 ppc_md.progress("chestnut_setup_arch: exit", 0);
426}
427
428#ifdef CONFIG_MTD_PHYSMAP
429static struct mtd_partition ptbl;
430
431static int __init
432chestnut_setup_mtd(void)
433{
434 memset(&ptbl, 0, sizeof(ptbl));
435
436 ptbl.name = "User FS";
437 ptbl.size = CHESTNUT_32BIT_SIZE;
438
439 physmap_map.size = CHESTNUT_32BIT_SIZE;
440 physmap_set_partitions(&ptbl, 1);
441 return 0;
442}
443
444arch_initcall(chestnut_setup_mtd);
445#endif
446
447/**************************************************************************
448 * FUNCTION: chestnut_restart
449 *
450 * DESCRIPTION: ppc_md machine reset callback
451 * reset the board via the CPLD command register
452 *
453 ****/
454static void
455chestnut_restart(char *cmd)
456{
457 volatile ulong i = 10000000;
458
459 local_irq_disable();
460
461 /*
462 * Set CPLD Reg 3 bit 0 to 1 to allow MPP signals on reset to work
463 *
464 * MPP24 - board reset
465 */
466 writeb(0x1, cpld_base + 3);
467
468 /* GPP pin tied to MPP earlier */
469 mv64x60_set_bits(&bh, MV64x60_GPP_VALUE_SET, BIT(24));
470
471 while (i-- > 0);
472 panic("restart failed\n");
473}
474
475static void
476chestnut_halt(void)
477{
478 local_irq_disable();
479 for (;;);
480 /* NOTREACHED */
481}
482
483static void
484chestnut_power_off(void)
485{
486 chestnut_halt();
487 /* NOTREACHED */
488}
489
490/**************************************************************************
491 * FUNCTION: chestnut_map_io
492 *
493 * DESCRIPTION: configure fixed memory-mapped IO
494 *
495 ****/
496static void __init
497chestnut_map_io(void)
498{
499#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
500 io_block_mapping(CHESTNUT_UART_BASE, CHESTNUT_UART_BASE, 0x100000,
501 _PAGE_IO);
502#endif
503}
504
505/**************************************************************************
506 * FUNCTION: chestnut_set_bat
507 *
508 * DESCRIPTION: configures a (temporary) bat mapping for early access to
509 * device I/O
510 *
511 ****/
512static __inline__ void
513chestnut_set_bat(void)
514{
515 mb();
516 mtspr(SPRN_DBAT3U, 0xf0001ffe);
517 mtspr(SPRN_DBAT3L, 0xf000002a);
518 mb();
519}
520
521/**************************************************************************
522 * FUNCTION: platform_init
523 *
524 * DESCRIPTION: main entry point for configuring board-specific machine
525 * callbacks
526 *
527 ****/
528void __init
529platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
530 unsigned long r6, unsigned long r7)
531{
532 parse_bootinfo(find_bootinfo());
533
534 /* Copy the kernel command line arguments to a safe place. */
535
536 if (r6) {
537 *(char *) (r7 + KERNELBASE) = 0;
538 strcpy(cmd_line, (char *) (r6 + KERNELBASE));
539 }
540
541 isa_mem_base = 0;
542
543 ppc_md.setup_arch = chestnut_setup_arch;
544 ppc_md.show_cpuinfo = chestnut_show_cpuinfo;
545 ppc_md.irq_canonicalize = NULL;
546 ppc_md.init_IRQ = mv64360_init_irq;
547 ppc_md.get_irq = mv64360_get_irq;
548 ppc_md.init = NULL;
549
550 ppc_md.find_end_of_memory = chestnut_find_end_of_memory;
551 ppc_md.setup_io_mappings = chestnut_map_io;
552
553 ppc_md.restart = chestnut_restart;
554 ppc_md.power_off = chestnut_power_off;
555 ppc_md.halt = chestnut_halt;
556
557 ppc_md.time_init = NULL;
558 ppc_md.set_rtc_time = NULL;
559 ppc_md.get_rtc_time = NULL;
560 ppc_md.calibrate_decr = chestnut_calibrate_decr;
561
562 ppc_md.nvram_read_val = NULL;
563 ppc_md.nvram_write_val = NULL;
564
565 ppc_md.heartbeat = NULL;
566
567 bh.p_base = CONFIG_MV64X60_NEW_BASE;
568
569 chestnut_set_bat();
570
571#if defined(CONFIG_SERIAL_TEXT_DEBUG)
572 ppc_md.progress = gen550_progress;
573#endif
574#if defined(CONFIG_KGDB)
575 ppc_md.kgdb_map_scc = gen550_kgdb_map_scc;
576#endif
577
578 if (ppc_md.progress)
579 ppc_md.progress("chestnut_init(): exit", 0);
580}
diff --git a/arch/ppc/platforms/chestnut.h b/arch/ppc/platforms/chestnut.h
new file mode 100644
index 000000000000..0400b2be40ab
--- /dev/null
+++ b/arch/ppc/platforms/chestnut.h
@@ -0,0 +1,129 @@
1/*
2 * arch/ppc/platforms/chestnut.h
3 *
4 * Definitions for IBM 750FXGX Eval (Chestnut)
5 *
6 * Author: <source@mvista.com>
7 *
8 * Based on Artesyn Katana code done by Tim Montgomery <timm@artesyncp.com>
9 * Based on code done by Rabeeh Khoury - rabeeh@galileo.co.il
10 * Based on code done by Mark A. Greer <mgreer@mvista.com>
11 *
12 * <2004> (c) MontaVista Software, Inc. This file is licensed under
13 * the terms of the GNU General Public License version 2. This program
14 * is licensed "as is" without any warranty of any kind, whether express
15 * or implied.
16 */
17
18/*
19 * This is the CPU physical memory map (windows must be at least 1MB and start
20 * on a boundary that is a multiple of the window size):
21 *
22 * Seems on the IBM 750FXGX Eval board, the MV64460 Registers can be in
23 * only 2 places per switch U17 0x14000000 or 0xf1000000 easily - chose to
24 * implement at 0xf1000000 only at this time
25 *
26 * 0xfff00000-0xffffffff - 8 Flash
27 * 0xffe00000-0xffefffff - BOOT SRAM
28 * 0xffd00000-0xffd00004 - CPLD
29 * 0xffc00000-0xffc0000f - UART
30 * 0xffb00000-0xffb07fff - FRAM
31 * 0xff840000-0xffafffff - *** HOLE ***
32 * 0xff800000-0xff83ffff - MV64460 Integrated SRAM
33 * 0xfe000000-0xff8fffff - *** HOLE ***
34 * 0xfc000000-0xfdffffff - 32bit Flash
35 * 0xf1010000-0xfbffffff - *** HOLE ***
36 * 0xf1000000-0xf100ffff - MV64460 Registers
37 */
38
39#ifndef __PPC_PLATFORMS_CHESTNUT_H__
40#define __PPC_PLATFORMS_CHESTNUT_H__
41
42#define CHESTNUT_BOOT_8BIT_BASE 0xfff00000
43#define CHESTNUT_BOOT_8BIT_SIZE_ACTUAL (1024*1024)
44#define CHESTNUT_BOOT_SRAM_BASE 0xffe00000
45#define CHESTNUT_BOOT_SRAM_SIZE_ACTUAL (1024*1024)
46#define CHESTNUT_CPLD_BASE 0xffd00000
47#define CHESTNUT_CPLD_SIZE_ACTUAL 5
48#define CHESTNUT_CPLD_REG3 (CHESTNUT_CPLD_BASE+3)
49#define CHESTNUT_UART_BASE 0xffc00000
50#define CHESTNUT_UART_SIZE_ACTUAL 16
51#define CHESTNUT_FRAM_BASE 0xffb00000
52#define CHESTNUT_FRAM_SIZE_ACTUAL (32*1024)
53#define CHESTNUT_INTERNAL_SRAM_BASE 0xff800000
54#define CHESTNUT_32BIT_BASE 0xfc000000
55#define CHESTNUT_32BIT_SIZE (32*1024*1024)
56
57#define CHESTNUT_BOOT_8BIT_SIZE max(MV64360_WINDOW_SIZE_MIN, \
58 CHESTNUT_BOOT_8BIT_SIZE_ACTUAL)
59#define CHESTNUT_BOOT_SRAM_SIZE max(MV64360_WINDOW_SIZE_MIN, \
60 CHESTNUT_BOOT_SRAM_SIZE_ACTUAL)
61#define CHESTNUT_CPLD_SIZE max(MV64360_WINDOW_SIZE_MIN, \
62 CHESTNUT_CPLD_SIZE_ACTUAL)
63#define CHESTNUT_UART_SIZE max(MV64360_WINDOW_SIZE_MIN, \
64 CHESTNUT_UART_SIZE_ACTUAL)
65#define CHESTNUT_FRAM_SIZE max(MV64360_WINDOW_SIZE_MIN, \
66 CHESTNUT_FRAM_SIZE_ACTUAL)
67
68#define CHESTNUT_BUS_SPEED 200000000
69#define CHESTNUT_PIBS_DATABASE 0xf0000 /* from PIBS src code */
70
71#define KATANA_ETH0_PHY_ADDR 12
72#define KATANA_ETH1_PHY_ADDR 11
73#define KATANA_ETH2_PHY_ADDR 4
74
75#define CHESTNUT_ETH_TX_QUEUE_SIZE 800
76#define CHESTNUT_ETH_RX_QUEUE_SIZE 400
77
78/*
79 * PCI windows
80 */
81
82#define CHESTNUT_PCI0_MEM_PROC_ADDR 0x80000000
83#define CHESTNUT_PCI0_MEM_PCI_HI_ADDR 0x00000000
84#define CHESTNUT_PCI0_MEM_PCI_LO_ADDR 0x80000000
85#define CHESTNUT_PCI0_MEM_SIZE 0x10000000
86#define CHESTNUT_PCI0_IO_PROC_ADDR 0xa0000000
87#define CHESTNUT_PCI0_IO_PCI_ADDR 0x00000000
88#define CHESTNUT_PCI0_IO_SIZE 0x01000000
89
90/*
91 * Board-specific IRQ info
92 */
93#define CHESTNUT_PCI_SLOT0_IRQ (64 + 31)
94#define CHESTNUT_PCI_SLOT1_IRQ (64 + 30)
95#define CHESTNUT_PCI_SLOT2_IRQ (64 + 29)
96#define CHESTNUT_PCI_SLOT3_IRQ (64 + 28)
97
98/* serial port definitions */
99#define CHESTNUT_UART0_IO_BASE (CHESTNUT_UART_BASE + 8)
100#define CHESTNUT_UART1_IO_BASE CHESTNUT_UART_BASE
101
102#define UART0_INT (64 + 25)
103#define UART1_INT (64 + 26)
104
105#ifdef CONFIG_SERIAL_MANY_PORTS
106#define RS_TABLE_SIZE 64
107#else
108#define RS_TABLE_SIZE 2
109#endif
110
111/* Rate for the 3.6864 Mhz clock for the onboard serial chip */
112#define BASE_BAUD (3686400 / 16)
113
114#ifdef CONFIG_SERIAL_DETECT_IRQ
115#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_SKIP_TEST|ASYNC_AUTO_IRQ)
116#else
117#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_SKIP_TEST)
118#endif
119
120#define STD_UART_OP(num) \
121 { 0, BASE_BAUD, 0, UART##num##_INT, STD_COM_FLAGS, \
122 iomem_base: (u8 *)CHESTNUT_UART##num##_IO_BASE, \
123 io_type: SERIAL_IO_MEM},
124
125#define SERIAL_PORT_DFNS \
126 STD_UART_OP(0) \
127 STD_UART_OP(1)
128
129#endif /* __PPC_PLATFORMS_CHESTNUT_H__ */
diff --git a/arch/ppc/platforms/chrp_pci.c b/arch/ppc/platforms/chrp_pci.c
new file mode 100644
index 000000000000..5bb6492ecf8c
--- /dev/null
+++ b/arch/ppc/platforms/chrp_pci.c
@@ -0,0 +1,309 @@
1/*
2 * CHRP pci routines.
3 */
4
5#include <linux/config.h>
6#include <linux/kernel.h>
7#include <linux/pci.h>
8#include <linux/delay.h>
9#include <linux/string.h>
10#include <linux/init.h>
11#include <linux/ide.h>
12#include <linux/bootmem.h>
13
14#include <asm/io.h>
15#include <asm/pgtable.h>
16#include <asm/irq.h>
17#include <asm/hydra.h>
18#include <asm/prom.h>
19#include <asm/gg2.h>
20#include <asm/machdep.h>
21#include <asm/sections.h>
22#include <asm/pci-bridge.h>
23#include <asm/open_pic.h>
24
25/* LongTrail */
26void __iomem *gg2_pci_config_base;
27
28/*
29 * The VLSI Golden Gate II has only 512K of PCI configuration space, so we
30 * limit the bus number to 3 bits
31 */
32
33int __chrp gg2_read_config(struct pci_bus *bus, unsigned int devfn, int off,
34 int len, u32 *val)
35{
36 volatile void __iomem *cfg_data;
37 struct pci_controller *hose = bus->sysdata;
38
39 if (bus->number > 7)
40 return PCIBIOS_DEVICE_NOT_FOUND;
41 /*
42 * Note: the caller has already checked that off is
43 * suitably aligned and that len is 1, 2 or 4.
44 */
45 cfg_data = hose->cfg_data + ((bus->number<<16) | (devfn<<8) | off);
46 switch (len) {
47 case 1:
48 *val = in_8(cfg_data);
49 break;
50 case 2:
51 *val = in_le16(cfg_data);
52 break;
53 default:
54 *val = in_le32(cfg_data);
55 break;
56 }
57 return PCIBIOS_SUCCESSFUL;
58}
59
60int __chrp gg2_write_config(struct pci_bus *bus, unsigned int devfn, int off,
61 int len, u32 val)
62{
63 volatile void __iomem *cfg_data;
64 struct pci_controller *hose = bus->sysdata;
65
66 if (bus->number > 7)
67 return PCIBIOS_DEVICE_NOT_FOUND;
68 /*
69 * Note: the caller has already checked that off is
70 * suitably aligned and that len is 1, 2 or 4.
71 */
72 cfg_data = hose->cfg_data + ((bus->number<<16) | (devfn<<8) | off);
73 switch (len) {
74 case 1:
75 out_8(cfg_data, val);
76 break;
77 case 2:
78 out_le16(cfg_data, val);
79 break;
80 default:
81 out_le32(cfg_data, val);
82 break;
83 }
84 return PCIBIOS_SUCCESSFUL;
85}
86
87static struct pci_ops gg2_pci_ops =
88{
89 gg2_read_config,
90 gg2_write_config
91};
92
93/*
94 * Access functions for PCI config space using RTAS calls.
95 */
96int __chrp
97rtas_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
98 int len, u32 *val)
99{
100 struct pci_controller *hose = bus->sysdata;
101 unsigned long addr = (offset & 0xff) | ((devfn & 0xff) << 8)
102 | (((bus->number - hose->first_busno) & 0xff) << 16)
103 | (hose->index << 24);
104 unsigned long ret = ~0UL;
105 int rval;
106
107 rval = call_rtas("read-pci-config", 2, 2, &ret, addr, len);
108 *val = ret;
109 return rval? PCIBIOS_DEVICE_NOT_FOUND: PCIBIOS_SUCCESSFUL;
110}
111
112int __chrp
113rtas_write_config(struct pci_bus *bus, unsigned int devfn, int offset,
114 int len, u32 val)
115{
116 struct pci_controller *hose = bus->sysdata;
117 unsigned long addr = (offset & 0xff) | ((devfn & 0xff) << 8)
118 | (((bus->number - hose->first_busno) & 0xff) << 16)
119 | (hose->index << 24);
120 int rval;
121
122 rval = call_rtas("write-pci-config", 3, 1, NULL, addr, len, val);
123 return rval? PCIBIOS_DEVICE_NOT_FOUND: PCIBIOS_SUCCESSFUL;
124}
125
126static struct pci_ops rtas_pci_ops =
127{
128 rtas_read_config,
129 rtas_write_config
130};
131
132volatile struct Hydra *Hydra = NULL;
133
134int __init
135hydra_init(void)
136{
137 struct device_node *np;
138
139 np = find_devices("mac-io");
140 if (np == NULL || np->n_addrs == 0)
141 return 0;
142 Hydra = ioremap(np->addrs[0].address, np->addrs[0].size);
143 printk("Hydra Mac I/O at %x\n", np->addrs[0].address);
144 printk("Hydra Feature_Control was %x",
145 in_le32(&Hydra->Feature_Control));
146 out_le32(&Hydra->Feature_Control, (HYDRA_FC_SCC_CELL_EN |
147 HYDRA_FC_SCSI_CELL_EN |
148 HYDRA_FC_SCCA_ENABLE |
149 HYDRA_FC_SCCB_ENABLE |
150 HYDRA_FC_ARB_BYPASS |
151 HYDRA_FC_MPIC_ENABLE |
152 HYDRA_FC_SLOW_SCC_PCLK |
153 HYDRA_FC_MPIC_IS_MASTER));
154 printk(", now %x\n", in_le32(&Hydra->Feature_Control));
155 return 1;
156}
157
158void __init
159chrp_pcibios_fixup(void)
160{
161 struct pci_dev *dev = NULL;
162 struct device_node *np;
163
164 /* PCI interrupts are controlled by the OpenPIC */
165 for_each_pci_dev(dev) {
166 np = pci_device_to_OF_node(dev);
167 if ((np != 0) && (np->n_intrs > 0) && (np->intrs[0].line != 0))
168 dev->irq = np->intrs[0].line;
169 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
170 }
171}
172
173#define PRG_CL_RESET_VALID 0x00010000
174
175static void __init
176setup_python(struct pci_controller *hose, struct device_node *dev)
177{
178 u32 *reg, val;
179 unsigned long addr = dev->addrs[0].address;
180
181 setup_indirect_pci(hose, addr + 0xf8000, addr + 0xf8010);
182
183 /* Clear the magic go-slow bit */
184 reg = (u32 *) ioremap(dev->addrs[0].address + 0xf6000, 0x40);
185 val = in_be32(&reg[12]);
186 if (val & PRG_CL_RESET_VALID) {
187 out_be32(&reg[12], val & ~PRG_CL_RESET_VALID);
188 in_be32(&reg[12]);
189 }
190 iounmap(reg);
191}
192
193/* Marvell Discovery II based Pegasos 2 */
194static void __init setup_peg2(struct pci_controller *hose, struct device_node *dev)
195{
196 struct device_node *root = find_path_device("/");
197 struct device_node *rtas;
198
199 rtas = of_find_node_by_name (root, "rtas");
200 if (rtas) {
201 hose->ops = &rtas_pci_ops;
202 } else {
203 printk ("RTAS supporting Pegasos OF not found, please upgrade"
204 " your firmware\n");
205 }
206 pci_assign_all_busses = 1;
207}
208
209void __init
210chrp_find_bridges(void)
211{
212 struct device_node *dev;
213 int *bus_range;
214 int len, index = -1;
215 struct pci_controller *hose;
216 unsigned int *dma;
217 char *model, *machine;
218 int is_longtrail = 0, is_mot = 0, is_pegasos = 0;
219 struct device_node *root = find_path_device("/");
220
221 /*
222 * The PCI host bridge nodes on some machines don't have
223 * properties to adequately identify them, so we have to
224 * look at what sort of machine this is as well.
225 */
226 machine = get_property(root, "model", NULL);
227 if (machine != NULL) {
228 is_longtrail = strncmp(machine, "IBM,LongTrail", 13) == 0;
229 is_mot = strncmp(machine, "MOT", 3) == 0;
230 if (strncmp(machine, "Pegasos2", 8) == 0)
231 is_pegasos = 2;
232 else if (strncmp(machine, "Pegasos", 7) == 0)
233 is_pegasos = 1;
234 }
235 for (dev = root->child; dev != NULL; dev = dev->sibling) {
236 if (dev->type == NULL || strcmp(dev->type, "pci") != 0)
237 continue;
238 ++index;
239 /* The GG2 bridge on the LongTrail doesn't have an address */
240 if (dev->n_addrs < 1 && !is_longtrail) {
241 printk(KERN_WARNING "Can't use %s: no address\n",
242 dev->full_name);
243 continue;
244 }
245 bus_range = (int *) get_property(dev, "bus-range", &len);
246 if (bus_range == NULL || len < 2 * sizeof(int)) {
247 printk(KERN_WARNING "Can't get bus-range for %s\n",
248 dev->full_name);
249 continue;
250 }
251 if (bus_range[1] == bus_range[0])
252 printk(KERN_INFO "PCI bus %d", bus_range[0]);
253 else
254 printk(KERN_INFO "PCI buses %d..%d",
255 bus_range[0], bus_range[1]);
256 printk(" controlled by %s", dev->type);
257 if (dev->n_addrs > 0)
258 printk(" at %x", dev->addrs[0].address);
259 printk("\n");
260
261 hose = pcibios_alloc_controller();
262 if (!hose) {
263 printk("Can't allocate PCI controller structure for %s\n",
264 dev->full_name);
265 continue;
266 }
267 hose->arch_data = dev;
268 hose->first_busno = bus_range[0];
269 hose->last_busno = bus_range[1];
270
271 model = get_property(dev, "model", NULL);
272 if (model == NULL)
273 model = "<none>";
274 if (device_is_compatible(dev, "IBM,python")) {
275 setup_python(hose, dev);
276 } else if (is_mot
277 || strncmp(model, "Motorola, Grackle", 17) == 0) {
278 setup_grackle(hose);
279 } else if (is_longtrail) {
280 void __iomem *p = ioremap(GG2_PCI_CONFIG_BASE, 0x80000);
281 hose->ops = &gg2_pci_ops;
282 hose->cfg_data = p;
283 gg2_pci_config_base = p;
284 } else if (is_pegasos == 1) {
285 setup_indirect_pci(hose, 0xfec00cf8, 0xfee00cfc);
286 } else if (is_pegasos == 2) {
287 setup_peg2(hose, dev);
288 } else {
289 printk("No methods for %s (model %s), using RTAS\n",
290 dev->full_name, model);
291 hose->ops = &rtas_pci_ops;
292 }
293
294 pci_process_bridge_OF_ranges(hose, dev, index == 0);
295
296 /* check the first bridge for a property that we can
297 use to set pci_dram_offset */
298 dma = (unsigned int *)
299 get_property(dev, "ibm,dma-ranges", &len);
300 if (index == 0 && dma != NULL && len >= 6 * sizeof(*dma)) {
301 pci_dram_offset = dma[2] - dma[3];
302 printk("pci_dram_offset = %lx\n", pci_dram_offset);
303 }
304 }
305
306 /* Do not fixup interrupts from OF tree on pegasos */
307 if (is_pegasos == 0)
308 ppc_md.pcibios_fixup = chrp_pcibios_fixup;
309}
diff --git a/arch/ppc/platforms/chrp_pegasos_eth.c b/arch/ppc/platforms/chrp_pegasos_eth.c
new file mode 100644
index 000000000000..cad5bfa153b2
--- /dev/null
+++ b/arch/ppc/platforms/chrp_pegasos_eth.c
@@ -0,0 +1,101 @@
1/*
2 * arch/ppc/platforms/chrp_pegasos_eth.c
3 *
4 * Copyright (C) 2005 Sven Luther <sl@bplan-gmbh.de>
5 * Thanks to :
6 * Dale Farnsworth <dale@farnsworth.org>
7 * Mark A. Greer <mgreer@mvista.com>
8 * Nicolas DET <nd@bplan-gmbh.de>
9 * Benjamin Herrenschmidt <benh@kernel.crashing.org>
10 * And anyone else who helped me on this.
11 */
12
13#include <linux/types.h>
14#include <linux/init.h>
15#include <linux/ioport.h>
16#include <linux/device.h>
17#include <linux/mv643xx.h>
18#include <linux/pci.h>
19
20/* Pegasos 2 specific Marvell MV 64361 gigabit ethernet port setup */
21static struct resource mv643xx_eth_shared_resources[] = {
22 [0] = {
23 .name = "ethernet shared base",
24 .start = 0xf1000000 + MV643XX_ETH_SHARED_REGS,
25 .end = 0xf1000000 + MV643XX_ETH_SHARED_REGS +
26 MV643XX_ETH_SHARED_REGS_SIZE - 1,
27 .flags = IORESOURCE_MEM,
28 },
29};
30
31static struct platform_device mv643xx_eth_shared_device = {
32 .name = MV643XX_ETH_SHARED_NAME,
33 .id = 0,
34 .num_resources = ARRAY_SIZE(mv643xx_eth_shared_resources),
35 .resource = mv643xx_eth_shared_resources,
36};
37
38static struct resource mv643xx_eth0_resources[] = {
39 [0] = {
40 .name = "eth0 irq",
41 .start = 9,
42 .end = 9,
43 .flags = IORESOURCE_IRQ,
44 },
45};
46
47static struct mv643xx_eth_platform_data eth0_pd;
48
49static struct platform_device eth0_device = {
50 .name = MV643XX_ETH_NAME,
51 .id = 0,
52 .num_resources = ARRAY_SIZE(mv643xx_eth0_resources),
53 .resource = mv643xx_eth0_resources,
54 .dev = {
55 .platform_data = &eth0_pd,
56 },
57};
58
59static struct resource mv643xx_eth1_resources[] = {
60 [0] = {
61 .name = "eth1 irq",
62 .start = 9,
63 .end = 9,
64 .flags = IORESOURCE_IRQ,
65 },
66};
67
68static struct mv643xx_eth_platform_data eth1_pd;
69
70static struct platform_device eth1_device = {
71 .name = MV643XX_ETH_NAME,
72 .id = 1,
73 .num_resources = ARRAY_SIZE(mv643xx_eth1_resources),
74 .resource = mv643xx_eth1_resources,
75 .dev = {
76 .platform_data = &eth1_pd,
77 },
78};
79
80static struct platform_device *mv643xx_eth_pd_devs[] __initdata = {
81 &mv643xx_eth_shared_device,
82 &eth0_device,
83 &eth1_device,
84};
85
86
87int
88mv643xx_eth_add_pds(void)
89{
90 int ret = 0;
91 static struct pci_device_id pci_marvell_mv64360[] = {
92 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, PCI_DEVICE_ID_MARVELL_MV64360) },
93 { }
94 };
95
96 if (pci_dev_present(pci_marvell_mv64360)) {
97 ret = platform_add_devices(mv643xx_eth_pd_devs, ARRAY_SIZE(mv643xx_eth_pd_devs));
98 }
99 return ret;
100}
101device_initcall(mv643xx_eth_add_pds);
diff --git a/arch/ppc/platforms/chrp_setup.c b/arch/ppc/platforms/chrp_setup.c
new file mode 100644
index 000000000000..f23c4f320760
--- /dev/null
+++ b/arch/ppc/platforms/chrp_setup.c
@@ -0,0 +1,615 @@
1/*
2 * arch/ppc/platforms/setup.c
3 *
4 * Copyright (C) 1995 Linus Torvalds
5 * Adapted from 'alpha' version by Gary Thomas
6 * Modified by Cort Dougan (cort@cs.nmt.edu)
7 */
8
9/*
10 * bootup setup stuff..
11 */
12
13#include <linux/config.h>
14#include <linux/errno.h>
15#include <linux/sched.h>
16#include <linux/kernel.h>
17#include <linux/mm.h>
18#include <linux/stddef.h>
19#include <linux/unistd.h>
20#include <linux/ptrace.h>
21#include <linux/slab.h>
22#include <linux/user.h>
23#include <linux/a.out.h>
24#include <linux/tty.h>
25#include <linux/major.h>
26#include <linux/interrupt.h>
27#include <linux/reboot.h>
28#include <linux/init.h>
29#include <linux/pci.h>
30#include <linux/version.h>
31#include <linux/adb.h>
32#include <linux/module.h>
33#include <linux/delay.h>
34#include <linux/ide.h>
35#include <linux/irq.h>
36#include <linux/console.h>
37#include <linux/seq_file.h>
38#include <linux/root_dev.h>
39#include <linux/initrd.h>
40#include <linux/module.h>
41
42#include <asm/io.h>
43#include <asm/pgtable.h>
44#include <asm/prom.h>
45#include <asm/gg2.h>
46#include <asm/pci-bridge.h>
47#include <asm/dma.h>
48#include <asm/machdep.h>
49#include <asm/irq.h>
50#include <asm/hydra.h>
51#include <asm/sections.h>
52#include <asm/time.h>
53#include <asm/btext.h>
54#include <asm/i8259.h>
55#include <asm/open_pic.h>
56#include <asm/xmon.h>
57
58unsigned long chrp_get_rtc_time(void);
59int chrp_set_rtc_time(unsigned long nowtime);
60void chrp_calibrate_decr(void);
61long chrp_time_init(void);
62
63void chrp_find_bridges(void);
64void chrp_event_scan(void);
65void rtas_display_progress(char *, unsigned short);
66void rtas_indicator_progress(char *, unsigned short);
67void btext_progress(char *, unsigned short);
68
69extern unsigned long pmac_find_end_of_memory(void);
70extern int of_show_percpuinfo(struct seq_file *, int);
71
72int _chrp_type;
73EXPORT_SYMBOL(_chrp_type);
74
75/*
76 * XXX this should be in xmon.h, but putting it there means xmon.h
77 * has to include <linux/interrupt.h> (to get irqreturn_t), which
78 * causes all sorts of problems. -- paulus
79 */
80extern irqreturn_t xmon_irq(int, void *, struct pt_regs *);
81
82extern dev_t boot_dev;
83
84extern PTE *Hash, *Hash_end;
85extern unsigned long Hash_size, Hash_mask;
86extern int probingmem;
87extern unsigned long loops_per_jiffy;
88static int max_width;
89
90#ifdef CONFIG_SMP
91extern struct smp_ops_t chrp_smp_ops;
92#endif
93
94static const char *gg2_memtypes[4] = {
95 "FPM", "SDRAM", "EDO", "BEDO"
96};
97static const char *gg2_cachesizes[4] = {
98 "256 KB", "512 KB", "1 MB", "Reserved"
99};
100static const char *gg2_cachetypes[4] = {
101 "Asynchronous", "Reserved", "Flow-Through Synchronous",
102 "Pipelined Synchronous"
103};
104static const char *gg2_cachemodes[4] = {
105 "Disabled", "Write-Through", "Copy-Back", "Transparent Mode"
106};
107
108int __chrp
109chrp_show_cpuinfo(struct seq_file *m)
110{
111 int i, sdramen;
112 unsigned int t;
113 struct device_node *root;
114 const char *model = "";
115
116 root = find_path_device("/");
117 if (root)
118 model = get_property(root, "model", NULL);
119 seq_printf(m, "machine\t\t: CHRP %s\n", model);
120
121 /* longtrail (goldengate) stuff */
122 if (!strncmp(model, "IBM,LongTrail", 13)) {
123 /* VLSI VAS96011/12 `Golden Gate 2' */
124 /* Memory banks */
125 sdramen = (in_le32(gg2_pci_config_base + GG2_PCI_DRAM_CTRL)
126 >>31) & 1;
127 for (i = 0; i < (sdramen ? 4 : 6); i++) {
128 t = in_le32(gg2_pci_config_base+
129 GG2_PCI_DRAM_BANK0+
130 i*4);
131 if (!(t & 1))
132 continue;
133 switch ((t>>8) & 0x1f) {
134 case 0x1f:
135 model = "4 MB";
136 break;
137 case 0x1e:
138 model = "8 MB";
139 break;
140 case 0x1c:
141 model = "16 MB";
142 break;
143 case 0x18:
144 model = "32 MB";
145 break;
146 case 0x10:
147 model = "64 MB";
148 break;
149 case 0x00:
150 model = "128 MB";
151 break;
152 default:
153 model = "Reserved";
154 break;
155 }
156 seq_printf(m, "memory bank %d\t: %s %s\n", i, model,
157 gg2_memtypes[sdramen ? 1 : ((t>>1) & 3)]);
158 }
159 /* L2 cache */
160 t = in_le32(gg2_pci_config_base+GG2_PCI_CC_CTRL);
161 seq_printf(m, "board l2\t: %s %s (%s)\n",
162 gg2_cachesizes[(t>>7) & 3],
163 gg2_cachetypes[(t>>2) & 3],
164 gg2_cachemodes[t & 3]);
165 }
166 return 0;
167}
168
169/*
170 * Fixes for the National Semiconductor PC78308VUL SuperI/O
171 *
172 * Some versions of Open Firmware incorrectly initialize the IRQ settings
173 * for keyboard and mouse
174 */
175static inline void __init sio_write(u8 val, u8 index)
176{
177 outb(index, 0x15c);
178 outb(val, 0x15d);
179}
180
181static inline u8 __init sio_read(u8 index)
182{
183 outb(index, 0x15c);
184 return inb(0x15d);
185}
186
187static void __init sio_fixup_irq(const char *name, u8 device, u8 level,
188 u8 type)
189{
190 u8 level0, type0, active;
191
192 /* select logical device */
193 sio_write(device, 0x07);
194 active = sio_read(0x30);
195 level0 = sio_read(0x70);
196 type0 = sio_read(0x71);
197 if (level0 != level || type0 != type || !active) {
198 printk(KERN_WARNING "sio: %s irq level %d, type %d, %sactive: "
199 "remapping to level %d, type %d, active\n",
200 name, level0, type0, !active ? "in" : "", level, type);
201 sio_write(0x01, 0x30);
202 sio_write(level, 0x70);
203 sio_write(type, 0x71);
204 }
205}
206
207static void __init sio_init(void)
208{
209 struct device_node *root;
210
211 if ((root = find_path_device("/")) &&
212 !strncmp(get_property(root, "model", NULL), "IBM,LongTrail", 13)) {
213 /* logical device 0 (KBC/Keyboard) */
214 sio_fixup_irq("keyboard", 0, 1, 2);
215 /* select logical device 1 (KBC/Mouse) */
216 sio_fixup_irq("mouse", 1, 12, 2);
217 }
218}
219
220
221static void __init pegasos_set_l2cr(void)
222{
223 struct device_node *np;
224
225 /* On Pegasos, enable the l2 cache if needed, as the OF forgets it */
226 if (_chrp_type != _CHRP_Pegasos)
227 return;
228
229 /* Enable L2 cache if needed */
230 np = find_type_devices("cpu");
231 if (np != NULL) {
232 unsigned int *l2cr = (unsigned int *)
233 get_property (np, "l2cr", NULL);
234 if (l2cr == NULL) {
235 printk ("Pegasos l2cr : no cpu l2cr property found\n");
236 return;
237 }
238 if (!((*l2cr) & 0x80000000)) {
239 printk ("Pegasos l2cr : L2 cache was not active, "
240 "activating\n");
241 _set_L2CR(0);
242 _set_L2CR((*l2cr) | 0x80000000);
243 }
244 }
245}
246
247void __init chrp_setup_arch(void)
248{
249 struct device_node *device;
250
251 /* init to some ~sane value until calibrate_delay() runs */
252 loops_per_jiffy = 50000000/HZ;
253
254#ifdef CONFIG_BLK_DEV_INITRD
255 /* this is fine for chrp */
256 initrd_below_start_ok = 1;
257
258 if (initrd_start)
259 ROOT_DEV = Root_RAM0;
260 else
261#endif
262 ROOT_DEV = Root_SDA2; /* sda2 (sda1 is for the kernel) */
263
264 /* On pegasos, enable the L2 cache if not already done by OF */
265 pegasos_set_l2cr();
266
267 /* Lookup PCI host bridges */
268 chrp_find_bridges();
269
270#ifndef CONFIG_PPC64BRIDGE
271 /*
272 * Temporary fixes for PCI devices.
273 * -- Geert
274 */
275 hydra_init(); /* Mac I/O */
276
277#endif /* CONFIG_PPC64BRIDGE */
278
279 /*
280 * Fix the Super I/O configuration
281 */
282 sio_init();
283
284 /* Get the event scan rate for the rtas so we know how
285 * often it expects a heartbeat. -- Cort
286 */
287 if ( rtas_data ) {
288 struct property *p;
289 device = find_devices("rtas");
290 for ( p = device->properties;
291 p && strncmp(p->name, "rtas-event-scan-rate", 20);
292 p = p->next )
293 /* nothing */ ;
294 if ( p && *(unsigned long *)p->value ) {
295 ppc_md.heartbeat = chrp_event_scan;
296 ppc_md.heartbeat_reset = (HZ/(*(unsigned long *)p->value)*30)-1;
297 ppc_md.heartbeat_count = 1;
298 printk("RTAS Event Scan Rate: %lu (%lu jiffies)\n",
299 *(unsigned long *)p->value, ppc_md.heartbeat_reset );
300 }
301 }
302
303 pci_create_OF_bus_map();
304}
305
306void __chrp
307chrp_event_scan(void)
308{
309 unsigned char log[1024];
310 unsigned long ret = 0;
311 /* XXX: we should loop until the hardware says no more error logs -- Cort */
312 call_rtas( "event-scan", 4, 1, &ret, 0xffffffff, 0,
313 __pa(log), 1024 );
314 ppc_md.heartbeat_count = ppc_md.heartbeat_reset;
315}
316
317void __chrp
318chrp_restart(char *cmd)
319{
320 printk("RTAS system-reboot returned %d\n",
321 call_rtas("system-reboot", 0, 1, NULL));
322 for (;;);
323}
324
325void __chrp
326chrp_power_off(void)
327{
328 /* allow power on only with power button press */
329 printk("RTAS power-off returned %d\n",
330 call_rtas("power-off", 2, 1, NULL,0xffffffff,0xffffffff));
331 for (;;);
332}
333
334void __chrp
335chrp_halt(void)
336{
337 chrp_power_off();
338}
339
340u_int __chrp
341chrp_irq_canonicalize(u_int irq)
342{
343 if (irq == 2)
344 return 9;
345 return irq;
346}
347
348/*
349 * Finds the open-pic node and sets OpenPIC_Addr based on its reg property.
350 * Then checks if it has an interrupt-ranges property. If it does then
351 * we have a distributed open-pic, so call openpic_set_sources to tell
352 * the openpic code where to find the interrupt source registers.
353 */
354static void __init chrp_find_openpic(void)
355{
356 struct device_node *np;
357 int len, i;
358 unsigned int *iranges;
359 void *isu;
360
361 np = find_type_devices("open-pic");
362 if (np == NULL || np->n_addrs == 0)
363 return;
364 printk(KERN_INFO "OpenPIC at %x (size %x)\n",
365 np->addrs[0].address, np->addrs[0].size);
366 OpenPIC_Addr = ioremap(np->addrs[0].address, 0x40000);
367 if (OpenPIC_Addr == NULL) {
368 printk(KERN_ERR "Failed to map OpenPIC!\n");
369 return;
370 }
371
372 iranges = (unsigned int *) get_property(np, "interrupt-ranges", &len);
373 if (iranges == NULL || len < 2 * sizeof(unsigned int))
374 return; /* not distributed */
375
376 /*
377 * The first pair of cells in interrupt-ranges refers to the
378 * IDU; subsequent pairs refer to the ISUs.
379 */
380 len /= 2 * sizeof(unsigned int);
381 if (np->n_addrs < len) {
382 printk(KERN_ERR "Insufficient addresses for distributed"
383 " OpenPIC (%d < %d)\n", np->n_addrs, len);
384 return;
385 }
386 if (iranges[1] != 0) {
387 printk(KERN_INFO "OpenPIC irqs %d..%d in IDU\n",
388 iranges[0], iranges[0] + iranges[1] - 1);
389 openpic_set_sources(iranges[0], iranges[1], NULL);
390 }
391 for (i = 1; i < len; ++i) {
392 iranges += 2;
393 printk(KERN_INFO "OpenPIC irqs %d..%d in ISU at %x (%x)\n",
394 iranges[0], iranges[0] + iranges[1] - 1,
395 np->addrs[i].address, np->addrs[i].size);
396 isu = ioremap(np->addrs[i].address, np->addrs[i].size);
397 if (isu != NULL)
398 openpic_set_sources(iranges[0], iranges[1], isu);
399 else
400 printk(KERN_ERR "Failed to map OpenPIC ISU at %x!\n",
401 np->addrs[i].address);
402 }
403}
404
405#if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(XMON)
406static struct irqaction xmon_irqaction = {
407 .handler = xmon_irq,
408 .mask = CPU_MASK_NONE,
409 .name = "XMON break",
410};
411#endif
412
413void __init chrp_init_IRQ(void)
414{
415 struct device_node *np;
416 int i;
417 unsigned long chrp_int_ack = 0;
418 unsigned char init_senses[NR_IRQS - NUM_8259_INTERRUPTS];
419#if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(XMON)
420 struct device_node *kbd;
421#endif
422
423 for (np = find_devices("pci"); np != NULL; np = np->next) {
424 unsigned int *addrp = (unsigned int *)
425 get_property(np, "8259-interrupt-acknowledge", NULL);
426
427 if (addrp == NULL)
428 continue;
429 chrp_int_ack = addrp[prom_n_addr_cells(np)-1];
430 break;
431 }
432 if (np == NULL)
433 printk(KERN_ERR "Cannot find PCI interrupt acknowledge address\n");
434
435 chrp_find_openpic();
436
437 if (OpenPIC_Addr) {
438 prom_get_irq_senses(init_senses, NUM_8259_INTERRUPTS, NR_IRQS);
439 OpenPIC_InitSenses = init_senses;
440 OpenPIC_NumInitSenses = NR_IRQS - NUM_8259_INTERRUPTS;
441
442 openpic_init(NUM_8259_INTERRUPTS);
443 /* We have a cascade on OpenPIC IRQ 0, Linux IRQ 16 */
444 openpic_hookup_cascade(NUM_8259_INTERRUPTS, "82c59 cascade",
445 i8259_irq);
446
447 }
448 for (i = 0; i < NUM_8259_INTERRUPTS; i++)
449 irq_desc[i].handler = &i8259_pic;
450 i8259_init(chrp_int_ack);
451
452#if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(XMON)
453 /* see if there is a keyboard in the device tree
454 with a parent of type "adb" */
455 for (kbd = find_devices("keyboard"); kbd; kbd = kbd->next)
456 if (kbd->parent && kbd->parent->type
457 && strcmp(kbd->parent->type, "adb") == 0)
458 break;
459 if (kbd)
460 setup_irq(HYDRA_INT_ADB_NMI, &xmon_irqaction);
461#endif
462}
463
464void __init
465chrp_init2(void)
466{
467#ifdef CONFIG_NVRAM
468// XX replace this in a more saner way
469// pmac_nvram_init();
470#endif
471
472 request_region(0x20,0x20,"pic1");
473 request_region(0xa0,0x20,"pic2");
474 request_region(0x00,0x20,"dma1");
475 request_region(0x40,0x20,"timer");
476 request_region(0x80,0x10,"dma page reg");
477 request_region(0xc0,0x20,"dma2");
478
479 if (ppc_md.progress)
480 ppc_md.progress(" Have fun! ", 0x7777);
481}
482
483void __init
484chrp_init(unsigned long r3, unsigned long r4, unsigned long r5,
485 unsigned long r6, unsigned long r7)
486{
487 struct device_node *root = find_path_device ("/");
488 char *machine = NULL;
489
490#ifdef CONFIG_BLK_DEV_INITRD
491 /* take care of initrd if we have one */
492 if ( r6 )
493 {
494 initrd_start = r6 + KERNELBASE;
495 initrd_end = r6 + r7 + KERNELBASE;
496 }
497#endif /* CONFIG_BLK_DEV_INITRD */
498
499 ISA_DMA_THRESHOLD = ~0L;
500 DMA_MODE_READ = 0x44;
501 DMA_MODE_WRITE = 0x48;
502 isa_io_base = CHRP_ISA_IO_BASE; /* default value */
503
504 if (root)
505 machine = get_property(root, "model", NULL);
506 if (machine && strncmp(machine, "Pegasos", 7) == 0) {
507 _chrp_type = _CHRP_Pegasos;
508 } else if (machine && strncmp(machine, "IBM", 3) == 0) {
509 _chrp_type = _CHRP_IBM;
510 } else if (machine && strncmp(machine, "MOT", 3) == 0) {
511 _chrp_type = _CHRP_Motorola;
512 } else {
513 /* Let's assume it is an IBM chrp if all else fails */
514 _chrp_type = _CHRP_IBM;
515 }
516
517 ppc_md.setup_arch = chrp_setup_arch;
518 ppc_md.show_percpuinfo = of_show_percpuinfo;
519 ppc_md.show_cpuinfo = chrp_show_cpuinfo;
520
521 ppc_md.irq_canonicalize = chrp_irq_canonicalize;
522 ppc_md.init_IRQ = chrp_init_IRQ;
523 if (_chrp_type == _CHRP_Pegasos)
524 ppc_md.get_irq = i8259_irq;
525 else
526 ppc_md.get_irq = openpic_get_irq;
527
528 ppc_md.init = chrp_init2;
529
530 ppc_md.phys_mem_access_prot = pci_phys_mem_access_prot;
531
532 ppc_md.restart = chrp_restart;
533 ppc_md.power_off = chrp_power_off;
534 ppc_md.halt = chrp_halt;
535
536 ppc_md.time_init = chrp_time_init;
537 ppc_md.set_rtc_time = chrp_set_rtc_time;
538 ppc_md.get_rtc_time = chrp_get_rtc_time;
539 ppc_md.calibrate_decr = chrp_calibrate_decr;
540
541 ppc_md.find_end_of_memory = pmac_find_end_of_memory;
542
543 if (rtas_data) {
544 struct device_node *rtas;
545 unsigned int *p;
546
547 rtas = find_devices("rtas");
548 if (rtas != NULL) {
549 if (get_property(rtas, "display-character", NULL)) {
550 ppc_md.progress = rtas_display_progress;
551 p = (unsigned int *) get_property
552 (rtas, "ibm,display-line-length", NULL);
553 if (p)
554 max_width = *p;
555 } else if (get_property(rtas, "set-indicator", NULL))
556 ppc_md.progress = rtas_indicator_progress;
557 }
558 }
559#ifdef CONFIG_BOOTX_TEXT
560 if (ppc_md.progress == NULL && boot_text_mapped)
561 ppc_md.progress = btext_progress;
562#endif
563
564#ifdef CONFIG_SMP
565 ppc_md.smp_ops = &chrp_smp_ops;
566#endif /* CONFIG_SMP */
567
568 /*
569 * Print the banner, then scroll down so boot progress
570 * can be printed. -- Cort
571 */
572 if (ppc_md.progress) ppc_md.progress("Linux/PPC "UTS_RELEASE"\n", 0x0);
573}
574
575void __chrp
576rtas_display_progress(char *s, unsigned short hex)
577{
578 int width;
579 char *os = s;
580
581 if ( call_rtas( "display-character", 1, 1, NULL, '\r' ) )
582 return;
583
584 width = max_width;
585 while ( *os )
586 {
587 if ( (*os == '\n') || (*os == '\r') )
588 width = max_width;
589 else
590 width--;
591 call_rtas( "display-character", 1, 1, NULL, *os++ );
592 /* if we overwrite the screen length */
593 if ( width == 0 )
594 while ( (*os != 0) && (*os != '\n') && (*os != '\r') )
595 os++;
596 }
597
598 /*while ( width-- > 0 )*/
599 call_rtas( "display-character", 1, 1, NULL, ' ' );
600}
601
602void __chrp
603rtas_indicator_progress(char *s, unsigned short hex)
604{
605 call_rtas("set-indicator", 3, 1, NULL, 6, 0, hex);
606}
607
608#ifdef CONFIG_BOOTX_TEXT
609void
610btext_progress(char *s, unsigned short hex)
611{
612 prom_print(s);
613 prom_print("\n");
614}
615#endif /* CONFIG_BOOTX_TEXT */
diff --git a/arch/ppc/platforms/chrp_smp.c b/arch/ppc/platforms/chrp_smp.c
new file mode 100644
index 000000000000..0ea1f7d9e46a
--- /dev/null
+++ b/arch/ppc/platforms/chrp_smp.c
@@ -0,0 +1,98 @@
1/*
2 * Smp support for CHRP machines.
3 *
4 * Written by Cort Dougan (cort@cs.nmt.edu) borrowing a great
5 * deal of code from the sparc and intel versions.
6 *
7 * Copyright (C) 1999 Cort Dougan <cort@cs.nmt.edu>
8 *
9 */
10
11#include <linux/config.h>
12#include <linux/kernel.h>
13#include <linux/sched.h>
14#include <linux/smp.h>
15#include <linux/smp_lock.h>
16#include <linux/interrupt.h>
17#include <linux/kernel_stat.h>
18#include <linux/delay.h>
19#include <linux/init.h>
20#include <linux/spinlock.h>
21
22#include <asm/ptrace.h>
23#include <asm/atomic.h>
24#include <asm/irq.h>
25#include <asm/page.h>
26#include <asm/pgtable.h>
27#include <asm/sections.h>
28#include <asm/io.h>
29#include <asm/prom.h>
30#include <asm/smp.h>
31#include <asm/residual.h>
32#include <asm/time.h>
33#include <asm/open_pic.h>
34
35extern unsigned long smp_chrp_cpu_nr;
36
37static int __init
38smp_chrp_probe(void)
39{
40 if (smp_chrp_cpu_nr > 1)
41 openpic_request_IPIs();
42
43 return smp_chrp_cpu_nr;
44}
45
46static void __devinit
47smp_chrp_kick_cpu(int nr)
48{
49 *(unsigned long *)KERNELBASE = nr;
50 asm volatile("dcbf 0,%0"::"r"(KERNELBASE):"memory");
51}
52
53static void __devinit
54smp_chrp_setup_cpu(int cpu_nr)
55{
56 if (OpenPIC_Addr)
57 do_openpic_setup_cpu();
58}
59
60static DEFINE_SPINLOCK(timebase_lock);
61static unsigned int timebase_upper = 0, timebase_lower = 0;
62
63void __devinit
64smp_chrp_give_timebase(void)
65{
66 spin_lock(&timebase_lock);
67 call_rtas("freeze-time-base", 0, 1, NULL);
68 timebase_upper = get_tbu();
69 timebase_lower = get_tbl();
70 spin_unlock(&timebase_lock);
71
72 while (timebase_upper || timebase_lower)
73 barrier();
74 call_rtas("thaw-time-base", 0, 1, NULL);
75}
76
77void __devinit
78smp_chrp_take_timebase(void)
79{
80 while (!(timebase_upper || timebase_lower))
81 barrier();
82 spin_lock(&timebase_lock);
83 set_tb(timebase_upper, timebase_lower);
84 timebase_upper = 0;
85 timebase_lower = 0;
86 spin_unlock(&timebase_lock);
87 printk("CPU %i taken timebase\n", smp_processor_id());
88}
89
90/* CHRP with openpic */
91struct smp_ops_t chrp_smp_ops __chrpdata = {
92 .message_pass = smp_openpic_message_pass,
93 .probe = smp_chrp_probe,
94 .kick_cpu = smp_chrp_kick_cpu,
95 .setup_cpu = smp_chrp_setup_cpu,
96 .give_timebase = smp_chrp_give_timebase,
97 .take_timebase = smp_chrp_take_timebase,
98};
diff --git a/arch/ppc/platforms/chrp_time.c b/arch/ppc/platforms/chrp_time.c
new file mode 100644
index 000000000000..e2be0c838d8a
--- /dev/null
+++ b/arch/ppc/platforms/chrp_time.c
@@ -0,0 +1,194 @@
1/*
2 * arch/ppc/platforms/chrp_time.c
3 *
4 * Copyright (C) 1991, 1992, 1995 Linus Torvalds
5 *
6 * Adapted for PowerPC (PReP) by Gary Thomas
7 * Modified by Cort Dougan (cort@cs.nmt.edu).
8 * Copied and modified from arch/i386/kernel/time.c
9 *
10 */
11#include <linux/errno.h>
12#include <linux/sched.h>
13#include <linux/kernel.h>
14#include <linux/param.h>
15#include <linux/string.h>
16#include <linux/mm.h>
17#include <linux/interrupt.h>
18#include <linux/time.h>
19#include <linux/timex.h>
20#include <linux/kernel_stat.h>
21#include <linux/mc146818rtc.h>
22#include <linux/init.h>
23#include <linux/bcd.h>
24
25#include <asm/segment.h>
26#include <asm/io.h>
27#include <asm/nvram.h>
28#include <asm/prom.h>
29#include <asm/sections.h>
30#include <asm/time.h>
31
32extern spinlock_t rtc_lock;
33
34static int nvram_as1 = NVRAM_AS1;
35static int nvram_as0 = NVRAM_AS0;
36static int nvram_data = NVRAM_DATA;
37
38long __init chrp_time_init(void)
39{
40 struct device_node *rtcs;
41 int base;
42
43 rtcs = find_compatible_devices("rtc", "pnpPNP,b00");
44 if (rtcs == NULL)
45 rtcs = find_compatible_devices("rtc", "ds1385-rtc");
46 if (rtcs == NULL || rtcs->addrs == NULL)
47 return 0;
48 base = rtcs->addrs[0].address;
49 nvram_as1 = 0;
50 nvram_as0 = base;
51 nvram_data = base + 1;
52
53 return 0;
54}
55
56int __chrp chrp_cmos_clock_read(int addr)
57{
58 if (nvram_as1 != 0)
59 outb(addr>>8, nvram_as1);
60 outb(addr, nvram_as0);
61 return (inb(nvram_data));
62}
63
64void __chrp chrp_cmos_clock_write(unsigned long val, int addr)
65{
66 if (nvram_as1 != 0)
67 outb(addr>>8, nvram_as1);
68 outb(addr, nvram_as0);
69 outb(val, nvram_data);
70 return;
71}
72
73/*
74 * Set the hardware clock. -- Cort
75 */
76int __chrp chrp_set_rtc_time(unsigned long nowtime)
77{
78 unsigned char save_control, save_freq_select;
79 struct rtc_time tm;
80
81 spin_lock(&rtc_lock);
82 to_tm(nowtime, &tm);
83
84 save_control = chrp_cmos_clock_read(RTC_CONTROL); /* tell the clock it's being set */
85
86 chrp_cmos_clock_write((save_control|RTC_SET), RTC_CONTROL);
87
88 save_freq_select = chrp_cmos_clock_read(RTC_FREQ_SELECT); /* stop and reset prescaler */
89
90 chrp_cmos_clock_write((save_freq_select|RTC_DIV_RESET2), RTC_FREQ_SELECT);
91
92 tm.tm_year -= 1900;
93 if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
94 BIN_TO_BCD(tm.tm_sec);
95 BIN_TO_BCD(tm.tm_min);
96 BIN_TO_BCD(tm.tm_hour);
97 BIN_TO_BCD(tm.tm_mon);
98 BIN_TO_BCD(tm.tm_mday);
99 BIN_TO_BCD(tm.tm_year);
100 }
101 chrp_cmos_clock_write(tm.tm_sec,RTC_SECONDS);
102 chrp_cmos_clock_write(tm.tm_min,RTC_MINUTES);
103 chrp_cmos_clock_write(tm.tm_hour,RTC_HOURS);
104 chrp_cmos_clock_write(tm.tm_mon,RTC_MONTH);
105 chrp_cmos_clock_write(tm.tm_mday,RTC_DAY_OF_MONTH);
106 chrp_cmos_clock_write(tm.tm_year,RTC_YEAR);
107
108 /* The following flags have to be released exactly in this order,
109 * otherwise the DS12887 (popular MC146818A clone with integrated
110 * battery and quartz) will not reset the oscillator and will not
111 * update precisely 500 ms later. You won't find this mentioned in
112 * the Dallas Semiconductor data sheets, but who believes data
113 * sheets anyway ... -- Markus Kuhn
114 */
115 chrp_cmos_clock_write(save_control, RTC_CONTROL);
116 chrp_cmos_clock_write(save_freq_select, RTC_FREQ_SELECT);
117
118 if ( (time_state == TIME_ERROR) || (time_state == TIME_BAD) )
119 time_state = TIME_OK;
120 spin_unlock(&rtc_lock);
121 return 0;
122}
123
124unsigned long __chrp chrp_get_rtc_time(void)
125{
126 unsigned int year, mon, day, hour, min, sec;
127 int uip, i;
128
129 /* The Linux interpretation of the CMOS clock register contents:
130 * When the Update-In-Progress (UIP) flag goes from 1 to 0, the
131 * RTC registers show the second which has precisely just started.
132 * Let's hope other operating systems interpret the RTC the same way.
133 */
134
135 /* Since the UIP flag is set for about 2.2 ms and the clock
136 * is typically written with a precision of 1 jiffy, trying
137 * to obtain a precision better than a few milliseconds is
138 * an illusion. Only consistency is interesting, this also
139 * allows to use the routine for /dev/rtc without a potential
140 * 1 second kernel busy loop triggered by any reader of /dev/rtc.
141 */
142
143 for ( i = 0; i<1000000; i++) {
144 uip = chrp_cmos_clock_read(RTC_FREQ_SELECT);
145 sec = chrp_cmos_clock_read(RTC_SECONDS);
146 min = chrp_cmos_clock_read(RTC_MINUTES);
147 hour = chrp_cmos_clock_read(RTC_HOURS);
148 day = chrp_cmos_clock_read(RTC_DAY_OF_MONTH);
149 mon = chrp_cmos_clock_read(RTC_MONTH);
150 year = chrp_cmos_clock_read(RTC_YEAR);
151 uip |= chrp_cmos_clock_read(RTC_FREQ_SELECT);
152 if ((uip & RTC_UIP)==0) break;
153 }
154
155 if (!(chrp_cmos_clock_read(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD)
156 {
157 BCD_TO_BIN(sec);
158 BCD_TO_BIN(min);
159 BCD_TO_BIN(hour);
160 BCD_TO_BIN(day);
161 BCD_TO_BIN(mon);
162 BCD_TO_BIN(year);
163 }
164 if ((year += 1900) < 1970)
165 year += 100;
166 return mktime(year, mon, day, hour, min, sec);
167}
168
169
170void __init chrp_calibrate_decr(void)
171{
172 struct device_node *cpu;
173 unsigned int freq, *fp;
174
175 if (via_calibrate_decr())
176 return;
177
178 /*
179 * The cpu node should have a timebase-frequency property
180 * to tell us the rate at which the decrementer counts.
181 */
182 freq = 16666000; /* hardcoded default */
183 cpu = find_type_devices("cpu");
184 if (cpu != 0) {
185 fp = (unsigned int *)
186 get_property(cpu, "timebase-frequency", NULL);
187 if (fp != 0)
188 freq = *fp;
189 }
190 printk("time_init: decrementer frequency = %u.%.6u MHz\n",
191 freq/1000000, freq%1000000);
192 tb_ticks_per_jiffy = freq / HZ;
193 tb_to_us = mulhwu_scale_factor(freq, 1000000);
194}
diff --git a/arch/ppc/platforms/cpci690.c b/arch/ppc/platforms/cpci690.c
new file mode 100644
index 000000000000..507870c9a97a
--- /dev/null
+++ b/arch/ppc/platforms/cpci690.c
@@ -0,0 +1,491 @@
1/*
2 * arch/ppc/platforms/cpci690.c
3 *
4 * Board setup routines for the Force CPCI690 board.
5 *
6 * Author: Mark A. Greer <mgreer@mvista.com>
7 *
8 * 2003 (c) MontaVista Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This programr
10 * is licensed "as is" without any warranty of any kind, whether express
11 * or implied.
12 */
13#include <linux/config.h>
14#include <linux/delay.h>
15#include <linux/pci.h>
16#include <linux/ide.h>
17#include <linux/irq.h>
18#include <linux/fs.h>
19#include <linux/seq_file.h>
20#include <linux/console.h>
21#include <linux/initrd.h>
22#include <linux/root_dev.h>
23#include <linux/mv643xx.h>
24#include <asm/bootinfo.h>
25#include <asm/machdep.h>
26#include <asm/todc.h>
27#include <asm/time.h>
28#include <asm/mv64x60.h>
29#include <platforms/cpci690.h>
30
31#define BOARD_VENDOR "Force"
32#define BOARD_MACHINE "CPCI690"
33
34/* Set IDE controllers into Native mode? */
35#define SET_PCI_IDE_NATIVE
36
37static struct mv64x60_handle bh;
38static u32 cpci690_br_base;
39
40static const unsigned int cpu_7xx[16] = { /* 7xx & 74xx (but not 745x) */
41 18, 15, 14, 2, 4, 13, 5, 9, 6, 11, 8, 10, 16, 12, 7, 0
42};
43
44TODC_ALLOC();
45
46static int __init
47cpci690_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
48{
49 struct pci_controller *hose = pci_bus_to_hose(dev->bus->number);
50
51 if (hose->index == 0) {
52 static char pci_irq_table[][4] =
53 /*
54 * PCI IDSEL/INTPIN->INTLINE
55 * A B C D
56 */
57 {
58 { 90, 91, 88, 89}, /* IDSEL 30/20 - Sentinel */
59 };
60
61 const long min_idsel = 20, max_idsel = 20, irqs_per_slot = 4;
62 return PCI_IRQ_TABLE_LOOKUP;
63 } else {
64 static char pci_irq_table[][4] =
65 /*
66 * PCI IDSEL/INTPIN->INTLINE
67 * A B C D
68 */
69 {
70 { 93, 94, 95, 92}, /* IDSEL 28/18 - PMC slot 2 */
71 { 0, 0, 0, 0}, /* IDSEL 29/19 - Not used */
72 { 94, 95, 92, 93}, /* IDSEL 30/20 - PMC slot 1 */
73 };
74
75 const long min_idsel = 18, max_idsel = 20, irqs_per_slot = 4;
76 return PCI_IRQ_TABLE_LOOKUP;
77 }
78}
79
80static int
81cpci690_get_cpu_speed(void)
82{
83 unsigned long hid1;
84
85 hid1 = mfspr(SPRN_HID1) >> 28;
86 return CPCI690_BUS_FREQ * cpu_7xx[hid1]/2;
87}
88
89#define KB (1024UL)
90#define MB (1024UL * KB)
91#define GB (1024UL * MB)
92
93unsigned long __init
94cpci690_find_end_of_memory(void)
95{
96 u32 mem_ctlr_size;
97 static u32 board_size;
98 static u8 first_time = 1;
99
100 if (first_time) {
101 /* Using cpci690_set_bat() mapping ==> virt addr == phys addr */
102 switch (in_8((u8 *) (cpci690_br_base +
103 CPCI690_BR_MEM_CTLR)) & 0x07) {
104 case 0x01:
105 board_size = 256*MB;
106 break;
107 case 0x02:
108 board_size = 512*MB;
109 break;
110 case 0x03:
111 board_size = 768*MB;
112 break;
113 case 0x04:
114 board_size = 1*GB;
115 break;
116 case 0x05:
117 board_size = 1*GB + 512*MB;
118 break;
119 case 0x06:
120 board_size = 2*GB;
121 break;
122 default:
123 board_size = 0xffffffff; /* use mem ctlr size */
124 } /* switch */
125
126 mem_ctlr_size = mv64x60_get_mem_size(CONFIG_MV64X60_NEW_BASE,
127 MV64x60_TYPE_GT64260A);
128
129 /* Check that mem ctlr & board reg agree. If not, pick MIN. */
130 if (board_size != mem_ctlr_size) {
131 printk(KERN_WARNING "Board register & memory controller"
132 "mem size disagree (board reg: 0x%lx, "
133 "mem ctlr: 0x%lx)\n",
134 (ulong)board_size, (ulong)mem_ctlr_size);
135 board_size = min(board_size, mem_ctlr_size);
136 }
137
138 first_time = 0;
139 } /* if */
140
141 return board_size;
142}
143
144static void __init
145cpci690_setup_bridge(void)
146{
147 struct mv64x60_setup_info si;
148 int i;
149
150 memset(&si, 0, sizeof(si));
151
152 si.phys_reg_base = CONFIG_MV64X60_NEW_BASE;
153
154 si.pci_0.enable_bus = 1;
155 si.pci_0.pci_io.cpu_base = CPCI690_PCI0_IO_START_PROC_ADDR;
156 si.pci_0.pci_io.pci_base_hi = 0;
157 si.pci_0.pci_io.pci_base_lo = CPCI690_PCI0_IO_START_PCI_ADDR;
158 si.pci_0.pci_io.size = CPCI690_PCI0_IO_SIZE;
159 si.pci_0.pci_io.swap = MV64x60_CPU2PCI_SWAP_NONE;
160 si.pci_0.pci_mem[0].cpu_base = CPCI690_PCI0_MEM_START_PROC_ADDR;
161 si.pci_0.pci_mem[0].pci_base_hi = CPCI690_PCI0_MEM_START_PCI_HI_ADDR;
162 si.pci_0.pci_mem[0].pci_base_lo = CPCI690_PCI0_MEM_START_PCI_LO_ADDR;
163 si.pci_0.pci_mem[0].size = CPCI690_PCI0_MEM_SIZE;
164 si.pci_0.pci_mem[0].swap = MV64x60_CPU2PCI_SWAP_NONE;
165 si.pci_0.pci_cmd_bits = 0;
166 si.pci_0.latency_timer = 0x80;
167
168 si.pci_1.enable_bus = 1;
169 si.pci_1.pci_io.cpu_base = CPCI690_PCI1_IO_START_PROC_ADDR;
170 si.pci_1.pci_io.pci_base_hi = 0;
171 si.pci_1.pci_io.pci_base_lo = CPCI690_PCI1_IO_START_PCI_ADDR;
172 si.pci_1.pci_io.size = CPCI690_PCI1_IO_SIZE;
173 si.pci_1.pci_io.swap = MV64x60_CPU2PCI_SWAP_NONE;
174 si.pci_1.pci_mem[0].cpu_base = CPCI690_PCI1_MEM_START_PROC_ADDR;
175 si.pci_1.pci_mem[0].pci_base_hi = CPCI690_PCI1_MEM_START_PCI_HI_ADDR;
176 si.pci_1.pci_mem[0].pci_base_lo = CPCI690_PCI1_MEM_START_PCI_LO_ADDR;
177 si.pci_1.pci_mem[0].size = CPCI690_PCI1_MEM_SIZE;
178 si.pci_1.pci_mem[0].swap = MV64x60_CPU2PCI_SWAP_NONE;
179 si.pci_1.pci_cmd_bits = 0;
180 si.pci_1.latency_timer = 0x80;
181
182 for (i=0; i<MV64x60_CPU2MEM_WINDOWS; i++) {
183 si.cpu_prot_options[i] = 0;
184 si.cpu_snoop_options[i] = GT64260_CPU_SNOOP_WB;
185 si.pci_0.acc_cntl_options[i] =
186 GT64260_PCI_ACC_CNTL_DREADEN |
187 GT64260_PCI_ACC_CNTL_RDPREFETCH |
188 GT64260_PCI_ACC_CNTL_RDLINEPREFETCH |
189 GT64260_PCI_ACC_CNTL_RDMULPREFETCH |
190 GT64260_PCI_ACC_CNTL_SWAP_NONE |
191 GT64260_PCI_ACC_CNTL_MBURST_32_BTYES;
192 si.pci_0.snoop_options[i] = GT64260_PCI_SNOOP_WB;
193 si.pci_1.acc_cntl_options[i] =
194 GT64260_PCI_ACC_CNTL_DREADEN |
195 GT64260_PCI_ACC_CNTL_RDPREFETCH |
196 GT64260_PCI_ACC_CNTL_RDLINEPREFETCH |
197 GT64260_PCI_ACC_CNTL_RDMULPREFETCH |
198 GT64260_PCI_ACC_CNTL_SWAP_NONE |
199 GT64260_PCI_ACC_CNTL_MBURST_32_BTYES;
200 si.pci_1.snoop_options[i] = GT64260_PCI_SNOOP_WB;
201 }
202
203 /* Lookup PCI host bridges */
204 if (mv64x60_init(&bh, &si))
205 printk(KERN_ERR "Bridge initialization failed.\n");
206
207 pci_dram_offset = 0; /* System mem at same addr on PCI & cpu bus */
208 ppc_md.pci_swizzle = common_swizzle;
209 ppc_md.pci_map_irq = cpci690_map_irq;
210 ppc_md.pci_exclude_device = mv64x60_pci_exclude_device;
211
212 mv64x60_set_bus(&bh, 0, 0);
213 bh.hose_a->first_busno = 0;
214 bh.hose_a->last_busno = 0xff;
215 bh.hose_a->last_busno = pciauto_bus_scan(bh.hose_a, 0);
216
217 bh.hose_b->first_busno = bh.hose_a->last_busno + 1;
218 mv64x60_set_bus(&bh, 1, bh.hose_b->first_busno);
219 bh.hose_b->last_busno = 0xff;
220 bh.hose_b->last_busno = pciauto_bus_scan(bh.hose_b,
221 bh.hose_b->first_busno);
222}
223
224static void __init
225cpci690_setup_peripherals(void)
226{
227 /* Set up windows to CPLD, RTC/TODC, IPMI. */
228 mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_0_WIN, CPCI690_BR_BASE,
229 CPCI690_BR_SIZE, 0);
230 bh.ci->enable_window_32bit(&bh, MV64x60_CPU2DEV_0_WIN);
231 cpci690_br_base = (u32)ioremap(CPCI690_BR_BASE, CPCI690_BR_SIZE);
232
233 mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_1_WIN, CPCI690_TODC_BASE,
234 CPCI690_TODC_SIZE, 0);
235 bh.ci->enable_window_32bit(&bh, MV64x60_CPU2DEV_1_WIN);
236 TODC_INIT(TODC_TYPE_MK48T35, 0, 0,
237 ioremap(CPCI690_TODC_BASE, CPCI690_TODC_SIZE), 8);
238
239 mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_2_WIN, CPCI690_IPMI_BASE,
240 CPCI690_IPMI_SIZE, 0);
241 bh.ci->enable_window_32bit(&bh, MV64x60_CPU2DEV_2_WIN);
242
243 mv64x60_set_bits(&bh, MV64x60_PCI0_ARBITER_CNTL, (1<<31));
244 mv64x60_set_bits(&bh, MV64x60_PCI1_ARBITER_CNTL, (1<<31));
245
246 mv64x60_set_bits(&bh, MV64x60_CPU_MASTER_CNTL, (1<<9)); /* Only 1 cpu */
247
248 /*
249 * Turn off timer/counters. Not turning off watchdog timer because
250 * can't read its reg on the 64260A so don't know if we'll be enabling
251 * or disabling.
252 */
253 mv64x60_clr_bits(&bh, MV64x60_TIMR_CNTR_0_3_CNTL,
254 ((1<<0) | (1<<8) | (1<<16) | (1<<24)));
255 mv64x60_clr_bits(&bh, GT64260_TIMR_CNTR_4_7_CNTL,
256 ((1<<0) | (1<<8) | (1<<16) | (1<<24)));
257
258 /*
259 * Set MPSC Multiplex RMII
260 * NOTE: ethernet driver modifies bit 0 and 1
261 */
262 mv64x60_write(&bh, GT64260_MPP_SERIAL_PORTS_MULTIPLEX, 0x00001102);
263
264#define GPP_EXTERNAL_INTERRUPTS \
265 ((1<<24) | (1<<25) | (1<<26) | (1<<27) | \
266 (1<<28) | (1<<29) | (1<<30) | (1<<31))
267 /* PCI interrupts are inputs */
268 mv64x60_clr_bits(&bh, MV64x60_GPP_IO_CNTL, GPP_EXTERNAL_INTERRUPTS);
269 /* PCI interrupts are active low */
270 mv64x60_set_bits(&bh, MV64x60_GPP_LEVEL_CNTL, GPP_EXTERNAL_INTERRUPTS);
271
272 /* Clear any pending interrupts for these inputs and enable them. */
273 mv64x60_write(&bh, MV64x60_GPP_INTR_CAUSE, ~GPP_EXTERNAL_INTERRUPTS);
274 mv64x60_set_bits(&bh, MV64x60_GPP_INTR_MASK, GPP_EXTERNAL_INTERRUPTS);
275
276 /* Route MPP interrupt inputs to GPP */
277 mv64x60_write(&bh, MV64x60_MPP_CNTL_2, 0x00000000);
278 mv64x60_write(&bh, MV64x60_MPP_CNTL_3, 0x00000000);
279}
280
281static void __init
282cpci690_setup_arch(void)
283{
284 if (ppc_md.progress)
285 ppc_md.progress("cpci690_setup_arch: enter", 0);
286#ifdef CONFIG_BLK_DEV_INITRD
287 if (initrd_start)
288 ROOT_DEV = Root_RAM0;
289 else
290#endif
291#ifdef CONFIG_ROOT_NFS
292 ROOT_DEV = Root_NFS;
293#else
294 ROOT_DEV = Root_SDA2;
295#endif
296
297 if (ppc_md.progress)
298 ppc_md.progress("cpci690_setup_arch: Enabling L2 cache", 0);
299
300 /* Enable L2 and L3 caches (if 745x) */
301 _set_L2CR(_get_L2CR() | L2CR_L2E);
302 _set_L3CR(_get_L3CR() | L3CR_L3E);
303
304 if (ppc_md.progress)
305 ppc_md.progress("cpci690_setup_arch: Initializing bridge", 0);
306
307 cpci690_setup_bridge(); /* set up PCI bridge(s) */
308 cpci690_setup_peripherals(); /* set up chip selects/GPP/MPP etc */
309
310 if (ppc_md.progress)
311 ppc_md.progress("cpci690_setup_arch: bridge init complete", 0);
312
313 printk(KERN_INFO "%s %s port (C) 2003 MontaVista Software, Inc. "
314 "(source@mvista.com)\n", BOARD_VENDOR, BOARD_MACHINE);
315
316 if (ppc_md.progress)
317 ppc_md.progress("cpci690_setup_arch: exit", 0);
318}
319
320/* Platform device data fixup routines. */
321#if defined(CONFIG_SERIAL_MPSC)
322static void __init
323cpci690_fixup_mpsc_pdata(struct platform_device *pdev)
324{
325 struct mpsc_pdata *pdata;
326
327 pdata = (struct mpsc_pdata *)pdev->dev.platform_data;
328
329 pdata->max_idle = 40;
330 pdata->default_baud = CPCI690_MPSC_BAUD;
331 pdata->brg_clk_src = CPCI690_MPSC_CLK_SRC;
332 pdata->brg_clk_freq = CPCI690_BUS_FREQ;
333}
334
335static int __init
336cpci690_platform_notify(struct device *dev)
337{
338 static struct {
339 char *bus_id;
340 void ((*rtn)(struct platform_device *pdev));
341 } dev_map[] = {
342 { MPSC_CTLR_NAME ".0", cpci690_fixup_mpsc_pdata },
343 { MPSC_CTLR_NAME ".1", cpci690_fixup_mpsc_pdata },
344 };
345 struct platform_device *pdev;
346 int i;
347
348 if (dev && dev->bus_id)
349 for (i=0; i<ARRAY_SIZE(dev_map); i++)
350 if (!strncmp(dev->bus_id, dev_map[i].bus_id,
351 BUS_ID_SIZE)) {
352
353 pdev = container_of(dev,
354 struct platform_device, dev);
355 dev_map[i].rtn(pdev);
356 }
357
358 return 0;
359}
360#endif
361
362static void
363cpci690_reset_board(void)
364{
365 u32 i = 10000;
366
367 local_irq_disable();
368 out_8((u8 *)(cpci690_br_base + CPCI690_BR_SW_RESET), 0x11);
369
370 while (i != 0) i++;
371 panic("restart failed\n");
372}
373
374static void
375cpci690_restart(char *cmd)
376{
377 cpci690_reset_board();
378}
379
380static void
381cpci690_halt(void)
382{
383 while (1);
384 /* NOTREACHED */
385}
386
387static void
388cpci690_power_off(void)
389{
390 cpci690_halt();
391 /* NOTREACHED */
392}
393
394static int
395cpci690_show_cpuinfo(struct seq_file *m)
396{
397 seq_printf(m, "vendor\t\t: " BOARD_VENDOR "\n");
398 seq_printf(m, "machine\t\t: " BOARD_MACHINE "\n");
399 seq_printf(m, "cpu MHz\t\t: %d\n", cpci690_get_cpu_speed()/1000/1000);
400 seq_printf(m, "bus MHz\t\t: %d\n", CPCI690_BUS_FREQ/1000/1000);
401
402 return 0;
403}
404
405static void __init
406cpci690_calibrate_decr(void)
407{
408 ulong freq;
409
410 freq = CPCI690_BUS_FREQ / 4;
411
412 printk(KERN_INFO "time_init: decrementer frequency = %lu.%.6lu MHz\n",
413 freq/1000000, freq%1000000);
414
415 tb_ticks_per_jiffy = freq / HZ;
416 tb_to_us = mulhwu_scale_factor(freq, 1000000);
417}
418
419static __inline__ void
420cpci690_set_bat(u32 addr, u32 size)
421{
422 addr &= 0xfffe0000;
423 size &= 0x1ffe0000;
424 size = ((size >> 17) - 1) << 2;
425
426 mb();
427 mtspr(SPRN_DBAT1U, addr | size | 0x2); /* Vs == 1; Vp == 0 */
428 mtspr(SPRN_DBAT1L, addr | 0x2a); /* WIMG bits == 0101; PP == r/w access */
429 mb();
430}
431
432#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
433static void __init
434cpci690_map_io(void)
435{
436 io_block_mapping(CONFIG_MV64X60_NEW_BASE, CONFIG_MV64X60_NEW_BASE,
437 128 * KB, _PAGE_IO);
438}
439#endif
440
441void __init
442platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
443 unsigned long r6, unsigned long r7)
444{
445#ifdef CONFIG_BLK_DEV_INITRD
446 initrd_start=initrd_end=0;
447 initrd_below_start_ok=0;
448#endif /* CONFIG_BLK_DEV_INITRD */
449
450 parse_bootinfo(find_bootinfo());
451
452 loops_per_jiffy = cpci690_get_cpu_speed() / HZ;
453
454 isa_mem_base = 0;
455
456 ppc_md.setup_arch = cpci690_setup_arch;
457 ppc_md.show_cpuinfo = cpci690_show_cpuinfo;
458 ppc_md.init_IRQ = gt64260_init_irq;
459 ppc_md.get_irq = gt64260_get_irq;
460 ppc_md.restart = cpci690_restart;
461 ppc_md.power_off = cpci690_power_off;
462 ppc_md.halt = cpci690_halt;
463 ppc_md.find_end_of_memory = cpci690_find_end_of_memory;
464 ppc_md.time_init = todc_time_init;
465 ppc_md.set_rtc_time = todc_set_rtc_time;
466 ppc_md.get_rtc_time = todc_get_rtc_time;
467 ppc_md.nvram_read_val = todc_direct_read_val;
468 ppc_md.nvram_write_val = todc_direct_write_val;
469 ppc_md.calibrate_decr = cpci690_calibrate_decr;
470
471 /*
472 * Need to map in board regs (used by cpci690_find_end_of_memory())
473 * and the bridge's regs (used by progress);
474 */
475 cpci690_set_bat(CPCI690_BR_BASE, 32 * MB);
476 cpci690_br_base = CPCI690_BR_BASE;
477
478#ifdef CONFIG_SERIAL_TEXT_DEBUG
479 ppc_md.setup_io_mappings = cpci690_map_io;
480 ppc_md.progress = mv64x60_mpsc_progress;
481 mv64x60_progress_init(CONFIG_MV64X60_NEW_BASE);
482#endif /* CONFIG_SERIAL_TEXT_DEBUG */
483#ifdef CONFIG_KGDB
484 ppc_md.setup_io_mappings = cpci690_map_io;
485 ppc_md.early_serial_map = cpci690_early_serial_map;
486#endif /* CONFIG_KGDB */
487
488#if defined(CONFIG_SERIAL_MPSC)
489 platform_notify = cpci690_platform_notify;
490#endif
491}
diff --git a/arch/ppc/platforms/cpci690.h b/arch/ppc/platforms/cpci690.h
new file mode 100644
index 000000000000..36cd2673c742
--- /dev/null
+++ b/arch/ppc/platforms/cpci690.h
@@ -0,0 +1,78 @@
1/*
2 * arch/ppc/platforms/cpci690.h
3 *
4 * Definitions for Force CPCI690
5 *
6 * Author: Mark A. Greer <mgreer@mvista.com>
7 *
8 * 2003 (c) MontaVista, Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
11 * or implied.
12 */
13
14/*
15 * The GT64260 has 2 PCI buses each with 1 window from the CPU bus to
16 * PCI I/O space and 4 windows from the CPU bus to PCI MEM space.
17 */
18
19#ifndef __PPC_PLATFORMS_CPCI690_H
20#define __PPC_PLATFORMS_CPCI690_H
21
22/*
23 * Define bd_t to pass in the MAC addresses used by the GT64260's enet ctlrs.
24 */
25#define CPCI690_BI_MAGIC 0xFE8765DC
26
27typedef struct board_info {
28 u32 bi_magic;
29 u8 bi_enetaddr[3][6];
30} bd_t;
31
32/* PCI bus Resource setup */
33#define CPCI690_PCI0_MEM_START_PROC_ADDR 0x80000000
34#define CPCI690_PCI0_MEM_START_PCI_HI_ADDR 0x00000000
35#define CPCI690_PCI0_MEM_START_PCI_LO_ADDR 0x80000000
36#define CPCI690_PCI0_MEM_SIZE 0x10000000
37#define CPCI690_PCI0_IO_START_PROC_ADDR 0xa0000000
38#define CPCI690_PCI0_IO_START_PCI_ADDR 0x00000000
39#define CPCI690_PCI0_IO_SIZE 0x01000000
40
41#define CPCI690_PCI1_MEM_START_PROC_ADDR 0x90000000
42#define CPCI690_PCI1_MEM_START_PCI_HI_ADDR 0x00000000
43#define CPCI690_PCI1_MEM_START_PCI_LO_ADDR 0x90000000
44#define CPCI690_PCI1_MEM_SIZE 0x10000000
45#define CPCI690_PCI1_IO_START_PROC_ADDR 0xa1000000
46#define CPCI690_PCI1_IO_START_PCI_ADDR 0x01000000
47#define CPCI690_PCI1_IO_SIZE 0x01000000
48
49/* Board Registers */
50#define CPCI690_BR_BASE 0xf0000000
51#define CPCI690_BR_SIZE_ACTUAL 0x8
52#define CPCI690_BR_SIZE max(GT64260_WINDOW_SIZE_MIN, \
53 CPCI690_BR_SIZE_ACTUAL)
54#define CPCI690_BR_LED_CNTL 0x00
55#define CPCI690_BR_SW_RESET 0x01
56#define CPCI690_BR_MISC_STATUS 0x02
57#define CPCI690_BR_SWITCH_STATUS 0x03
58#define CPCI690_BR_MEM_CTLR 0x04
59#define CPCI690_BR_LAST_RESET_1 0x05
60#define CPCI690_BR_LAST_RESET_2 0x06
61
62#define CPCI690_TODC_BASE 0xf0100000
63#define CPCI690_TODC_SIZE_ACTUAL 0x8000 /* Size or NVRAM + RTC */
64#define CPCI690_TODC_SIZE max(GT64260_WINDOW_SIZE_MIN, \
65 CPCI690_TODC_SIZE_ACTUAL)
66#define CPCI690_MAC_OFFSET 0x7c10 /* MAC in RTC NVRAM */
67
68#define CPCI690_IPMI_BASE 0xf0200000
69#define CPCI690_IPMI_SIZE_ACTUAL 0x10 /* 16 bytes of IPMI */
70#define CPCI690_IPMI_SIZE max(GT64260_WINDOW_SIZE_MIN, \
71 CPCI690_IPMI_SIZE_ACTUAL)
72
73#define CPCI690_MPSC_BAUD 9600
74#define CPCI690_MPSC_CLK_SRC 8 /* TCLK */
75
76#define CPCI690_BUS_FREQ 133333333
77
78#endif /* __PPC_PLATFORMS_CPCI690_H */
diff --git a/arch/ppc/platforms/est8260.h b/arch/ppc/platforms/est8260.h
new file mode 100644
index 000000000000..adba68ecf57b
--- /dev/null
+++ b/arch/ppc/platforms/est8260.h
@@ -0,0 +1,35 @@
1/* Board information for the EST8260, which should be generic for
2 * all 8260 boards. The IMMR is now given to us so the hard define
3 * will soon be removed. All of the clock values are computed from
4 * the configuration SCMR and the Power-On-Reset word.
5 */
6#ifndef __EST8260_PLATFORM
7#define __EST8260_PLATFORM
8
9#define CPM_MAP_ADDR ((uint)0xf0000000)
10
11#define BOOTROM_RESTART_ADDR ((uint)0xff000104)
12
13/* For our show_cpuinfo hooks. */
14#define CPUINFO_VENDOR "EST Corporation"
15#define CPUINFO_MACHINE "SBC8260 PowerPC"
16
17/* A Board Information structure that is given to a program when
18 * prom starts it up.
19 */
20typedef struct bd_info {
21 unsigned int bi_memstart; /* Memory start address */
22 unsigned int bi_memsize; /* Memory (end) size in bytes */
23 unsigned int bi_intfreq; /* Internal Freq, in Hz */
24 unsigned int bi_busfreq; /* Bus Freq, in MHz */
25 unsigned int bi_cpmfreq; /* CPM Freq, in MHz */
26 unsigned int bi_brgfreq; /* BRG Freq, in MHz */
27 unsigned int bi_vco; /* VCO Out from PLL */
28 unsigned int bi_baudrate; /* Default console baud rate */
29 unsigned int bi_immr; /* IMMR when called from boot rom */
30 unsigned char bi_enetaddr[6];
31} bd_t;
32
33extern bd_t m8xx_board_info;
34
35#endif /* __EST8260_PLATFORM */
diff --git a/arch/ppc/platforms/ev64260.c b/arch/ppc/platforms/ev64260.c
new file mode 100644
index 000000000000..aa50637a5cfb
--- /dev/null
+++ b/arch/ppc/platforms/ev64260.c
@@ -0,0 +1,651 @@
1/*
2 * arch/ppc/platforms/ev64260.c
3 *
4 * Board setup routines for the Marvell/Galileo EV-64260-BP Evaluation Board.
5 *
6 * Author: Mark A. Greer <mgreer@mvista.com>
7 *
8 * 2001-2003 (c) MontaVista, Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
11 * or implied.
12 */
13
14/*
15 * The EV-64260-BP port is the result of hard work from many people from
16 * many companies. In particular, employees of Marvell/Galileo, Mission
17 * Critical Linux, Xyterra, and MontaVista Software were heavily involved.
18 *
19 * Note: I have not been able to get *all* PCI slots to work reliably
20 * at 66 MHz. I recommend setting jumpers J15 & J16 to short pins 1&2
21 * so that 33 MHz is used. --MAG
22 * Note: The 750CXe and 7450 are not stable with a 125MHz or 133MHz TCLK/SYSCLK.
23 * At 100MHz, they are solid.
24 */
25#include <linux/config.h>
26
27#include <linux/delay.h>
28#include <linux/pci.h>
29#include <linux/ide.h>
30#include <linux/irq.h>
31#include <linux/fs.h>
32#include <linux/seq_file.h>
33#include <linux/console.h>
34#include <linux/initrd.h>
35#include <linux/root_dev.h>
36#if !defined(CONFIG_SERIAL_MPSC_CONSOLE)
37#include <linux/serial.h>
38#include <linux/tty.h>
39#include <linux/serial_core.h>
40#else
41#include <linux/mv643xx.h>
42#endif
43#include <asm/bootinfo.h>
44#include <asm/machdep.h>
45#include <asm/mv64x60.h>
46#include <asm/todc.h>
47#include <asm/time.h>
48
49#include <platforms/ev64260.h>
50
51#define BOARD_VENDOR "Marvell/Galileo"
52#define BOARD_MACHINE "EV-64260-BP"
53
54static struct mv64x60_handle bh;
55
56#if !defined(CONFIG_SERIAL_MPSC_CONSOLE)
57extern void gen550_progress(char *, unsigned short);
58extern void gen550_init(int, struct uart_port *);
59#endif
60
61static const unsigned int cpu_7xx[16] = { /* 7xx & 74xx (but not 745x) */
62 18, 15, 14, 2, 4, 13, 5, 9, 6, 11, 8, 10, 16, 12, 7, 0
63};
64static const unsigned int cpu_745x[2][16] = { /* PLL_EXT 0 & 1 */
65 { 1, 15, 14, 2, 4, 13, 5, 9, 6, 11, 8, 10, 16, 12, 7, 0 },
66 { 0, 30, 0, 2, 0, 26, 0, 18, 0, 22, 20, 24, 28, 32, 0, 0 }
67};
68
69
70TODC_ALLOC();
71
72static int
73ev64260_get_bus_speed(void)
74{
75 return 100000000;
76}
77
78static int
79ev64260_get_cpu_speed(void)
80{
81 unsigned long pvr, hid1, pll_ext;
82
83 pvr = PVR_VER(mfspr(SPRN_PVR));
84
85 if (pvr != PVR_VER(PVR_7450)) {
86 hid1 = mfspr(SPRN_HID1) >> 28;
87 return ev64260_get_bus_speed() * cpu_7xx[hid1]/2;
88 }
89 else {
90 hid1 = (mfspr(SPRN_HID1) & 0x0001e000) >> 13;
91 pll_ext = 0; /* No way to read; must get from schematic */
92 return ev64260_get_bus_speed() * cpu_745x[pll_ext][hid1]/2;
93 }
94}
95
96unsigned long __init
97ev64260_find_end_of_memory(void)
98{
99 return mv64x60_get_mem_size(CONFIG_MV64X60_NEW_BASE,
100 MV64x60_TYPE_GT64260A);
101}
102
103/*
104 * Marvell/Galileo EV-64260-BP Evaluation Board PCI interrupt routing.
105 * Note: By playing with J8 and JP1-4, you can get 2 IRQ's from the first
106 * PCI bus (in which cast, INTPIN B would be EV64260_PCI_1_IRQ).
107 * This is the most IRQs you can get from one bus with this board, though.
108 */
109static int __init
110ev64260_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
111{
112 struct pci_controller *hose = pci_bus_to_hose(dev->bus->number);
113
114 if (hose->index == 0) {
115 static char pci_irq_table[][4] =
116 /*
117 * PCI IDSEL/INTPIN->INTLINE
118 * A B C D
119 */
120 {
121 {EV64260_PCI_0_IRQ,0,0,0}, /* IDSEL 7 - PCI bus 0 */
122 {EV64260_PCI_0_IRQ,0,0,0}, /* IDSEL 8 - PCI bus 0 */
123 };
124
125 const long min_idsel = 7, max_idsel = 8, irqs_per_slot = 4;
126 return PCI_IRQ_TABLE_LOOKUP;
127 }
128 else {
129 static char pci_irq_table[][4] =
130 /*
131 * PCI IDSEL/INTPIN->INTLINE
132 * A B C D
133 */
134 {
135 { EV64260_PCI_1_IRQ,0,0,0}, /* IDSEL 7 - PCI bus 1 */
136 { EV64260_PCI_1_IRQ,0,0,0}, /* IDSEL 8 - PCI bus 1 */
137 };
138
139 const long min_idsel = 7, max_idsel = 8, irqs_per_slot = 4;
140 return PCI_IRQ_TABLE_LOOKUP;
141 }
142}
143
144static void __init
145ev64260_setup_peripherals(void)
146{
147 mv64x60_set_32bit_window(&bh, MV64x60_CPU2BOOT_WIN,
148 EV64260_EMB_FLASH_BASE, EV64260_EMB_FLASH_SIZE, 0);
149 bh.ci->enable_window_32bit(&bh, MV64x60_CPU2BOOT_WIN);
150 mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_0_WIN,
151 EV64260_EXT_SRAM_BASE, EV64260_EXT_SRAM_SIZE, 0);
152 bh.ci->enable_window_32bit(&bh, MV64x60_CPU2DEV_0_WIN);
153 mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_1_WIN,
154 EV64260_TODC_BASE, EV64260_TODC_SIZE, 0);
155 bh.ci->enable_window_32bit(&bh, MV64x60_CPU2DEV_1_WIN);
156 mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_2_WIN,
157 EV64260_UART_BASE, EV64260_UART_SIZE, 0);
158 bh.ci->enable_window_32bit(&bh, MV64x60_CPU2DEV_2_WIN);
159 mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_3_WIN,
160 EV64260_EXT_FLASH_BASE, EV64260_EXT_FLASH_SIZE, 0);
161 bh.ci->enable_window_32bit(&bh, MV64x60_CPU2DEV_3_WIN);
162
163 TODC_INIT(TODC_TYPE_DS1501, 0, 0,
164 ioremap(EV64260_TODC_BASE, EV64260_TODC_SIZE), 8);
165
166 mv64x60_clr_bits(&bh, MV64x60_CPU_CONFIG,((1<<12) | (1<<28) | (1<<29)));
167 mv64x60_set_bits(&bh, MV64x60_CPU_CONFIG, (1<<27));
168
169 if (ev64260_get_bus_speed() > 100000000)
170 mv64x60_set_bits(&bh, MV64x60_CPU_CONFIG, (1<<23));
171
172 mv64x60_set_bits(&bh, MV64x60_PCI0_PCI_DECODE_CNTL, ((1<<0) | (1<<3)));
173 mv64x60_set_bits(&bh, MV64x60_PCI1_PCI_DECODE_CNTL, ((1<<0) | (1<<3)));
174
175 /*
176 * Enabling of PCI internal-vs-external arbitration
177 * is a platform- and errata-dependent decision.
178 */
179 if (bh.type == MV64x60_TYPE_GT64260A ) {
180 mv64x60_set_bits(&bh, MV64x60_PCI0_ARBITER_CNTL, (1<<31));
181 mv64x60_set_bits(&bh, MV64x60_PCI1_ARBITER_CNTL, (1<<31));
182 }
183
184 mv64x60_set_bits(&bh, MV64x60_CPU_MASTER_CNTL, (1<<9)); /* Only 1 cpu */
185
186 /*
187 * Turn off timer/counters. Not turning off watchdog timer because
188 * can't read its reg on the 64260A so don't know if we'll be enabling
189 * or disabling.
190 */
191 mv64x60_clr_bits(&bh, MV64x60_TIMR_CNTR_0_3_CNTL,
192 ((1<<0) | (1<<8) | (1<<16) | (1<<24)));
193 mv64x60_clr_bits(&bh, GT64260_TIMR_CNTR_4_7_CNTL,
194 ((1<<0) | (1<<8) | (1<<16) | (1<<24)));
195
196 /*
197 * Set MPSC Multiplex RMII
198 * NOTE: ethernet driver modifies bit 0 and 1
199 */
200 mv64x60_write(&bh, GT64260_MPP_SERIAL_PORTS_MULTIPLEX, 0x00001102);
201
202 /*
203 * The EV-64260-BP uses several Multi-Purpose Pins (MPP) on the 64260
204 * bridge as interrupt inputs (via the General Purpose Ports (GPP)
205 * register). Need to route the MPP inputs to the GPP and set the
206 * polarity correctly.
207 *
208 * In MPP Control 2 Register
209 * MPP 21 -> GPP 21 (DUART channel A intr) bits 20-23 -> 0
210 * MPP 22 -> GPP 22 (DUART channel B intr) bits 24-27 -> 0
211 */
212 mv64x60_clr_bits(&bh, MV64x60_MPP_CNTL_2, (0xf<<20) | (0xf<<24) );
213
214 /*
215 * In MPP Control 3 Register
216 * MPP 26 -> GPP 26 (RTC INT) bits 8-11 -> 0
217 * MPP 27 -> GPP 27 (PCI 0 INTA) bits 12-15 -> 0
218 * MPP 29 -> GPP 29 (PCI 1 INTA) bits 20-23 -> 0
219 */
220 mv64x60_clr_bits(&bh, MV64x60_MPP_CNTL_3, (0xf<<8)|(0xf<<12)|(0xf<<20));
221
222#define GPP_EXTERNAL_INTERRUPTS \
223 ((1<<21) | (1<<22) | (1<<26) | (1<<27) | (1<<29))
224 /* DUART & PCI interrupts are inputs */
225 mv64x60_clr_bits(&bh, MV64x60_GPP_IO_CNTL, GPP_EXTERNAL_INTERRUPTS);
226 /* DUART & PCI interrupts are active low */
227 mv64x60_set_bits(&bh, MV64x60_GPP_LEVEL_CNTL, GPP_EXTERNAL_INTERRUPTS);
228
229 /* Clear any pending interrupts for these inputs and enable them. */
230 mv64x60_write(&bh, MV64x60_GPP_INTR_CAUSE, ~GPP_EXTERNAL_INTERRUPTS);
231 mv64x60_set_bits(&bh, MV64x60_GPP_INTR_MASK, GPP_EXTERNAL_INTERRUPTS);
232
233 return;
234}
235
236static void __init
237ev64260_setup_bridge(void)
238{
239 struct mv64x60_setup_info si;
240 int i;
241
242 memset(&si, 0, sizeof(si));
243
244 si.phys_reg_base = CONFIG_MV64X60_NEW_BASE;
245
246 si.pci_0.enable_bus = 1;
247 si.pci_0.pci_io.cpu_base = EV64260_PCI0_IO_CPU_BASE;
248 si.pci_0.pci_io.pci_base_hi = 0;
249 si.pci_0.pci_io.pci_base_lo = EV64260_PCI0_IO_PCI_BASE;
250 si.pci_0.pci_io.size = EV64260_PCI0_IO_SIZE;
251 si.pci_0.pci_io.swap = MV64x60_CPU2PCI_SWAP_NONE;
252 si.pci_0.pci_mem[0].cpu_base = EV64260_PCI0_MEM_CPU_BASE;
253 si.pci_0.pci_mem[0].pci_base_hi = 0;
254 si.pci_0.pci_mem[0].pci_base_lo = EV64260_PCI0_MEM_PCI_BASE;
255 si.pci_0.pci_mem[0].size = EV64260_PCI0_MEM_SIZE;
256 si.pci_0.pci_mem[0].swap = MV64x60_CPU2PCI_SWAP_NONE;
257 si.pci_0.pci_cmd_bits = 0;
258 si.pci_0.latency_timer = 0x8;
259
260 si.pci_1.enable_bus = 1;
261 si.pci_1.pci_io.cpu_base = EV64260_PCI1_IO_CPU_BASE;
262 si.pci_1.pci_io.pci_base_hi = 0;
263 si.pci_1.pci_io.pci_base_lo = EV64260_PCI1_IO_PCI_BASE;
264 si.pci_1.pci_io.size = EV64260_PCI1_IO_SIZE;
265 si.pci_1.pci_io.swap = MV64x60_CPU2PCI_SWAP_NONE;
266 si.pci_1.pci_mem[0].cpu_base = EV64260_PCI1_MEM_CPU_BASE;
267 si.pci_1.pci_mem[0].pci_base_hi = 0;
268 si.pci_1.pci_mem[0].pci_base_lo = EV64260_PCI1_MEM_PCI_BASE;
269 si.pci_1.pci_mem[0].size = EV64260_PCI1_MEM_SIZE;
270 si.pci_1.pci_mem[0].swap = MV64x60_CPU2PCI_SWAP_NONE;
271 si.pci_1.pci_cmd_bits = 0;
272 si.pci_1.latency_timer = 0x8;
273
274 for (i=0; i<MV64x60_CPU2MEM_WINDOWS; i++) {
275 si.cpu_prot_options[i] = 0;
276 si.cpu_snoop_options[i] = GT64260_CPU_SNOOP_WB;
277 si.pci_0.acc_cntl_options[i] =
278 GT64260_PCI_ACC_CNTL_DREADEN |
279 GT64260_PCI_ACC_CNTL_RDPREFETCH |
280 GT64260_PCI_ACC_CNTL_RDLINEPREFETCH |
281 GT64260_PCI_ACC_CNTL_RDMULPREFETCH |
282 GT64260_PCI_ACC_CNTL_SWAP_NONE |
283 GT64260_PCI_ACC_CNTL_MBURST_32_BTYES;
284 si.pci_0.snoop_options[i] = GT64260_PCI_SNOOP_WB;
285 si.pci_1.acc_cntl_options[i] =
286 GT64260_PCI_ACC_CNTL_DREADEN |
287 GT64260_PCI_ACC_CNTL_RDPREFETCH |
288 GT64260_PCI_ACC_CNTL_RDLINEPREFETCH |
289 GT64260_PCI_ACC_CNTL_RDMULPREFETCH |
290 GT64260_PCI_ACC_CNTL_SWAP_NONE |
291 GT64260_PCI_ACC_CNTL_MBURST_32_BTYES;
292 si.pci_1.snoop_options[i] = GT64260_PCI_SNOOP_WB;
293 }
294
295 /* Lookup PCI host bridges */
296 if (mv64x60_init(&bh, &si))
297 printk(KERN_ERR "Bridge initialization failed.\n");
298
299 pci_dram_offset = 0; /* System mem at same addr on PCI & cpu bus */
300 ppc_md.pci_swizzle = common_swizzle;
301 ppc_md.pci_map_irq = ev64260_map_irq;
302 ppc_md.pci_exclude_device = mv64x60_pci_exclude_device;
303
304 mv64x60_set_bus(&bh, 0, 0);
305 bh.hose_a->first_busno = 0;
306 bh.hose_a->last_busno = 0xff;
307 bh.hose_a->last_busno = pciauto_bus_scan(bh.hose_a, 0);
308
309 bh.hose_b->first_busno = bh.hose_a->last_busno + 1;
310 mv64x60_set_bus(&bh, 1, bh.hose_b->first_busno);
311 bh.hose_b->last_busno = 0xff;
312 bh.hose_b->last_busno = pciauto_bus_scan(bh.hose_b,
313 bh.hose_b->first_busno);
314
315 return;
316}
317
318#if defined(CONFIG_SERIAL_8250) && !defined(CONFIG_SERIAL_MPSC_CONSOLE)
319static void __init
320ev64260_early_serial_map(void)
321{
322 struct uart_port port;
323 static char first_time = 1;
324
325 if (first_time) {
326 memset(&port, 0, sizeof(port));
327
328 port.membase = ioremap(EV64260_SERIAL_0, EV64260_UART_SIZE);
329 port.irq = EV64260_UART_0_IRQ;
330 port.uartclk = BASE_BAUD * 16;
331 port.regshift = 2;
332 port.iotype = SERIAL_IO_MEM;
333 port.flags = STD_COM_FLAGS;
334
335#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
336 gen550_init(0, &port);
337#endif
338
339 if (early_serial_setup(&port) != 0)
340 printk(KERN_WARNING "Early serial init of port 0"
341 "failed\n");
342
343 first_time = 0;
344 }
345
346 return;
347}
348#elif defined(CONFIG_SERIAL_MPSC_CONSOLE)
349static void __init
350ev64260_early_serial_map(void)
351{
352}
353#endif
354
355static void __init
356ev64260_setup_arch(void)
357{
358 if (ppc_md.progress)
359 ppc_md.progress("ev64260_setup_arch: enter", 0);
360
361#ifdef CONFIG_BLK_DEV_INITRD
362 if (initrd_start)
363 ROOT_DEV = Root_RAM0;
364 else
365#endif
366#ifdef CONFIG_ROOT_NFS
367 ROOT_DEV = Root_NFS;
368#else
369 ROOT_DEV = Root_SDA2;
370#endif
371
372 if (ppc_md.progress)
373 ppc_md.progress("ev64260_setup_arch: Enabling L2 cache", 0);
374
375 /* Enable L2 and L3 caches (if 745x) */
376 _set_L2CR(_get_L2CR() | L2CR_L2E);
377 _set_L3CR(_get_L3CR() | L3CR_L3E);
378
379 if (ppc_md.progress)
380 ppc_md.progress("ev64260_setup_arch: Initializing bridge", 0);
381
382 ev64260_setup_bridge(); /* set up PCI bridge(s) */
383 ev64260_setup_peripherals(); /* set up chip selects/GPP/MPP etc */
384
385 if (ppc_md.progress)
386 ppc_md.progress("ev64260_setup_arch: bridge init complete", 0);
387
388#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_MPSC_CONSOLE)
389 ev64260_early_serial_map();
390#endif
391
392 printk(KERN_INFO "%s %s port (C) 2001 MontaVista Software, Inc."
393 "(source@mvista.com)\n", BOARD_VENDOR, BOARD_MACHINE);
394
395 if (ppc_md.progress)
396 ppc_md.progress("ev64260_setup_arch: exit", 0);
397
398 return;
399}
400
401/* Platform device data fixup routines. */
402#if defined(CONFIG_SERIAL_MPSC)
403static void __init
404ev64260_fixup_mpsc_pdata(struct platform_device *pdev)
405{
406 struct mpsc_pdata *pdata;
407
408 pdata = (struct mpsc_pdata *)pdev->dev.platform_data;
409
410 pdata->max_idle = 40;
411 pdata->default_baud = EV64260_DEFAULT_BAUD;
412 pdata->brg_clk_src = EV64260_MPSC_CLK_SRC;
413 pdata->brg_clk_freq = EV64260_MPSC_CLK_FREQ;
414
415 return;
416}
417
418static int __init
419ev64260_platform_notify(struct device *dev)
420{
421 static struct {
422 char *bus_id;
423 void ((*rtn)(struct platform_device *pdev));
424 } dev_map[] = {
425 { MPSC_CTLR_NAME ".0", ev64260_fixup_mpsc_pdata },
426 { MPSC_CTLR_NAME ".1", ev64260_fixup_mpsc_pdata },
427 };
428 struct platform_device *pdev;
429 int i;
430
431 if (dev && dev->bus_id)
432 for (i=0; i<ARRAY_SIZE(dev_map); i++)
433 if (!strncmp(dev->bus_id, dev_map[i].bus_id,
434 BUS_ID_SIZE)) {
435
436 pdev = container_of(dev,
437 struct platform_device, dev);
438 dev_map[i].rtn(pdev);
439 }
440
441 return 0;
442}
443#endif
444
445static void
446ev64260_reset_board(void *addr)
447{
448 local_irq_disable();
449
450 /* disable and invalidate the L2 cache */
451 _set_L2CR(0);
452 _set_L2CR(0x200000);
453
454 /* flush and disable L1 I/D cache */
455 __asm__ __volatile__
456 ("mfspr 3,1008\n\t"
457 "ori 5,5,0xcc00\n\t"
458 "ori 4,3,0xc00\n\t"
459 "andc 5,3,5\n\t"
460 "sync\n\t"
461 "mtspr 1008,4\n\t"
462 "isync\n\t"
463 "sync\n\t"
464 "mtspr 1008,5\n\t"
465 "isync\n\t"
466 "sync\n\t");
467
468 /* unmap any other random cs's that might overlap with bootcs */
469 mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_0_WIN, 0, 0, 0);
470 bh.ci->disable_window_32bit(&bh, MV64x60_CPU2DEV_0_WIN);
471 mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_1_WIN, 0, 0, 0);
472 bh.ci->disable_window_32bit(&bh, MV64x60_CPU2DEV_1_WIN);
473 mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_2_WIN, 0, 0, 0);
474 bh.ci->disable_window_32bit(&bh, MV64x60_CPU2DEV_2_WIN);
475 mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_3_WIN, 0, 0, 0);
476 bh.ci->disable_window_32bit(&bh, MV64x60_CPU2DEV_3_WIN);
477
478 /* map bootrom back in to gt @ reset defaults */
479 mv64x60_set_32bit_window(&bh, MV64x60_CPU2BOOT_WIN,
480 0xff800000, 8*1024*1024, 0);
481 bh.ci->enable_window_32bit(&bh, MV64x60_CPU2BOOT_WIN);
482
483 /* move reg base back to default, setup default pci0 */
484 mv64x60_write(&bh, MV64x60_INTERNAL_SPACE_DECODE,
485 (1<<24) | CONFIG_MV64X60_BASE >> 20);
486
487 /* NOTE: FROM NOW ON no more GT_REGS accesses.. 0x1 is not mapped
488 * via BAT or MMU, and MSR IR/DR is ON */
489 /* SRR0 has system reset vector, SRR1 has default MSR value */
490 /* rfi restores MSR from SRR1 and sets the PC to the SRR0 value */
491 /* NOTE: assumes reset vector is at 0xfff00100 */
492 __asm__ __volatile__
493 ("mtspr 26, %0\n\t"
494 "li 4,(1<<6)\n\t"
495 "mtspr 27,4\n\t"
496 "rfi\n\t"
497 :: "r" (addr):"r4");
498
499 return;
500}
501
502static void
503ev64260_restart(char *cmd)
504{
505 volatile ulong i = 10000000;
506
507 ev64260_reset_board((void *)0xfff00100);
508
509 while (i-- > 0);
510 panic("restart failed\n");
511}
512
513static void
514ev64260_halt(void)
515{
516 local_irq_disable();
517 while (1);
518 /* NOTREACHED */
519}
520
521static void
522ev64260_power_off(void)
523{
524 ev64260_halt();
525 /* NOTREACHED */
526}
527
528static int
529ev64260_show_cpuinfo(struct seq_file *m)
530{
531 uint pvid;
532
533 pvid = mfspr(SPRN_PVR);
534 seq_printf(m, "vendor\t\t: " BOARD_VENDOR "\n");
535 seq_printf(m, "machine\t\t: " BOARD_MACHINE "\n");
536 seq_printf(m, "cpu MHz\t\t: %d\n", ev64260_get_cpu_speed()/1000/1000);
537 seq_printf(m, "bus MHz\t\t: %d\n", ev64260_get_bus_speed()/1000/1000);
538
539 return 0;
540}
541
542/* DS1501 RTC has too much variation to use RTC for calibration */
543static void __init
544ev64260_calibrate_decr(void)
545{
546 ulong freq;
547
548 freq = ev64260_get_bus_speed()/4;
549
550 printk(KERN_INFO "time_init: decrementer frequency = %lu.%.6lu MHz\n",
551 freq/1000000, freq%1000000);
552
553 tb_ticks_per_jiffy = freq / HZ;
554 tb_to_us = mulhwu_scale_factor(freq, 1000000);
555
556 return;
557}
558
559/*
560 * Set BAT 3 to map 0xfb000000 to 0xfc000000 of physical memory space.
561 */
562static __inline__ void
563ev64260_set_bat(void)
564{
565 mb();
566 mtspr(SPRN_DBAT1U, 0xfb0001fe);
567 mtspr(SPRN_DBAT1L, 0xfb00002a);
568 mb();
569
570 return;
571}
572
573#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
574static void __init
575ev64260_map_io(void)
576{
577 io_block_mapping(0xfb000000, 0xfb000000, 0x01000000, _PAGE_IO);
578}
579#endif
580
581void __init
582platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
583 unsigned long r6, unsigned long r7)
584{
585#ifdef CONFIG_BLK_DEV_INITRD
586 extern int initrd_below_start_ok;
587
588 initrd_start=initrd_end=0;
589 initrd_below_start_ok=0;
590#endif /* CONFIG_BLK_DEV_INITRD */
591
592 parse_bootinfo(find_bootinfo());
593
594 isa_mem_base = 0;
595 isa_io_base = EV64260_PCI0_IO_CPU_BASE;
596 pci_dram_offset = EV64260_PCI0_MEM_CPU_BASE;
597
598 loops_per_jiffy = ev64260_get_cpu_speed() / HZ;
599
600 ppc_md.setup_arch = ev64260_setup_arch;
601 ppc_md.show_cpuinfo = ev64260_show_cpuinfo;
602 ppc_md.init_IRQ = gt64260_init_irq;
603 ppc_md.get_irq = gt64260_get_irq;
604
605 ppc_md.restart = ev64260_restart;
606 ppc_md.power_off = ev64260_power_off;
607 ppc_md.halt = ev64260_halt;
608
609 ppc_md.find_end_of_memory = ev64260_find_end_of_memory;
610
611 ppc_md.init = NULL;
612
613 ppc_md.time_init = todc_time_init;
614 ppc_md.set_rtc_time = todc_set_rtc_time;
615 ppc_md.get_rtc_time = todc_get_rtc_time;
616 ppc_md.nvram_read_val = todc_direct_read_val;
617 ppc_md.nvram_write_val = todc_direct_write_val;
618 ppc_md.calibrate_decr = ev64260_calibrate_decr;
619
620 bh.p_base = CONFIG_MV64X60_NEW_BASE;
621
622 ev64260_set_bat();
623
624#ifdef CONFIG_SERIAL_8250
625#if defined(CONFIG_SERIAL_TEXT_DEBUG)
626 ppc_md.setup_io_mappings = ev64260_map_io;
627 ppc_md.progress = gen550_progress;
628#endif
629#if defined(CONFIG_KGDB)
630 ppc_md.setup_io_mappings = ev64260_map_io;
631 ppc_md.early_serial_map = ev64260_early_serial_map;
632#endif
633#elif defined(CONFIG_SERIAL_MPSC_CONSOLE)
634#ifdef CONFIG_SERIAL_TEXT_DEBUG
635 ppc_md.setup_io_mappings = ev64260_map_io;
636 ppc_md.progress = mv64x60_mpsc_progress;
637 mv64x60_progress_init(CONFIG_MV64X60_NEW_BASE);
638#endif /* CONFIG_SERIAL_TEXT_DEBUG */
639#ifdef CONFIG_KGDB
640 ppc_md.setup_io_mappings = ev64260_map_io;
641 ppc_md.early_serial_map = ev64260_early_serial_map;
642#endif /* CONFIG_KGDB */
643
644#endif
645
646#if defined(CONFIG_SERIAL_MPSC)
647 platform_notify = ev64260_platform_notify;
648#endif
649
650 return;
651}
diff --git a/arch/ppc/platforms/ev64260.h b/arch/ppc/platforms/ev64260.h
new file mode 100644
index 000000000000..bedffced3a02
--- /dev/null
+++ b/arch/ppc/platforms/ev64260.h
@@ -0,0 +1,128 @@
1/*
2 * arch/ppc/platforms/ev64260.h
3 *
4 * Definitions for Marvell/Galileo EV-64260-BP Evaluation Board.
5 *
6 * Author: Mark A. Greer <mgreer@mvista.com>
7 *
8 * 2001-2002 (c) MontaVista, Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
11 * or implied.
12 */
13
14/*
15 * The MV64x60 has 2 PCI buses each with 1 window from the CPU bus to
16 * PCI I/O space and 4 windows from the CPU bus to PCI MEM space.
17 * We'll only use one PCI MEM window on each PCI bus.
18 *
19 * This is the CPU physical memory map (windows must be at least 1MB and start
20 * on a boundary that is a multiple of the window size):
21 *
22 * 0xfc000000-0xffffffff - External FLASH on device module
23 * 0xfbf00000-0xfbffffff - Embedded (on board) FLASH
24 * 0xfbe00000-0xfbefffff - GT64260 Registers (preferably)
25 * but really a config option
26 * 0xfbd00000-0xfbdfffff - External SRAM on device module
27 * 0xfbc00000-0xfbcfffff - TODC chip on device module
28 * 0xfbb00000-0xfbbfffff - External UART on device module
29 * 0xa2000000-0xfbafffff - <hole>
30 * 0xa1000000-0xa1ffffff - PCI 1 I/O (defined in gt64260.h)
31 * 0xa0000000-0xa0ffffff - PCI 0 I/O (defined in gt64260.h)
32 * 0x90000000-0x9fffffff - PCI 1 MEM (defined in gt64260.h)
33 * 0x80000000-0x8fffffff - PCI 0 MEM (defined in gt64260.h)
34 */
35
36#ifndef __PPC_PLATFORMS_EV64260_H
37#define __PPC_PLATFORMS_EV64260_H
38
39/* PCI mappings */
40#define EV64260_PCI0_IO_CPU_BASE 0xa0000000
41#define EV64260_PCI0_IO_PCI_BASE 0x00000000
42#define EV64260_PCI0_IO_SIZE 0x01000000
43
44#define EV64260_PCI0_MEM_CPU_BASE 0x80000000
45#define EV64260_PCI0_MEM_PCI_BASE 0x80000000
46#define EV64260_PCI0_MEM_SIZE 0x10000000
47
48#define EV64260_PCI1_IO_CPU_BASE (EV64260_PCI0_IO_CPU_BASE + \
49 EV64260_PCI0_IO_SIZE)
50#define EV64260_PCI1_IO_PCI_BASE (EV64260_PCI0_IO_PCI_BASE + \
51 EV64260_PCI0_IO_SIZE)
52#define EV64260_PCI1_IO_SIZE 0x01000000
53
54#define EV64260_PCI1_MEM_CPU_BASE (EV64260_PCI0_MEM_CPU_BASE + \
55 EV64260_PCI0_MEM_SIZE)
56#define EV64260_PCI1_MEM_PCI_BASE (EV64260_PCI0_MEM_PCI_BASE + \
57 EV64260_PCI0_MEM_SIZE)
58#define EV64260_PCI1_MEM_SIZE 0x10000000
59
60/* CPU Physical Memory Map setup (other than PCI) */
61#define EV64260_EXT_FLASH_BASE 0xfc000000
62#define EV64260_EMB_FLASH_BASE 0xfbf00000
63#define EV64260_EXT_SRAM_BASE 0xfbd00000
64#define EV64260_TODC_BASE 0xfbc00000
65#define EV64260_UART_BASE 0xfbb00000
66
67#define EV64260_EXT_FLASH_SIZE_ACTUAL 0x04000000 /* <= 64MB Extern FLASH */
68#define EV64260_EMB_FLASH_SIZE_ACTUAL 0x00080000 /* 512KB of Embed FLASH */
69#define EV64260_EXT_SRAM_SIZE_ACTUAL 0x00100000 /* 1MB SDRAM */
70#define EV64260_TODC_SIZE_ACTUAL 0x00000020 /* 32 bytes for TODC */
71#define EV64260_UART_SIZE_ACTUAL 0x00000040 /* 64 bytes for DUART */
72
73#define EV64260_EXT_FLASH_SIZE max(GT64260_WINDOW_SIZE_MIN, \
74 EV64260_EXT_FLASH_SIZE_ACTUAL)
75#define EV64260_EMB_FLASH_SIZE max(GT64260_WINDOW_SIZE_MIN, \
76 EV64260_EMB_FLASH_SIZE_ACTUAL)
77#define EV64260_EXT_SRAM_SIZE max(GT64260_WINDOW_SIZE_MIN, \
78 EV64260_EXT_SRAM_SIZE_ACTUAL)
79#define EV64260_TODC_SIZE max(GT64260_WINDOW_SIZE_MIN, \
80 EV64260_TODC_SIZE_ACTUAL)
81/* Assembler in bootwrapper blows up if 'max' is used */
82#define EV64260_UART_SIZE GT64260_WINDOW_SIZE_MIN
83#define EV64260_UART_END ((EV64260_UART_BASE + \
84 EV64260_UART_SIZE - 1) & 0xfff00000)
85
86/* Board-specific IRQ info */
87#define EV64260_UART_0_IRQ 85
88#define EV64260_UART_1_IRQ 86
89#define EV64260_PCI_0_IRQ 91
90#define EV64260_PCI_1_IRQ 93
91
92/* Serial port setup */
93#define EV64260_DEFAULT_BAUD 115200
94
95#if defined(CONFIG_SERIAL_MPSC_CONSOLE)
96#define SERIAL_PORT_DFNS
97
98#define EV64260_MPSC_CLK_SRC 8 /* TCLK */
99#define EV64260_MPSC_CLK_FREQ 100000000 /* 100MHz clk */
100#else
101#define EV64260_SERIAL_0 (EV64260_UART_BASE + 0x20)
102#define EV64260_SERIAL_1 EV64260_UART_BASE
103
104#define BASE_BAUD (EV64260_DEFAULT_BAUD * 2)
105
106#ifdef CONFIG_SERIAL_MANY_PORTS
107#define RS_TABLE_SIZE 64
108#else
109#define RS_TABLE_SIZE 2
110#endif
111
112#ifdef CONFIG_SERIAL_DETECT_IRQ
113#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_SKIP_TEST|ASYNC_AUTO_IRQ)
114#else
115#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_SKIP_TEST)
116#endif
117
118/* Required for bootloader's ns16550.c code */
119#define STD_SERIAL_PORT_DFNS \
120 { 0, BASE_BAUD, EV64260_SERIAL_0, EV64260_UART_0_IRQ, STD_COM_FLAGS, \
121 iomem_base: (u8 *)EV64260_SERIAL_0, /* ttyS0 */ \
122 iomem_reg_shift: 2, \
123 io_type: SERIAL_IO_MEM },
124
125#define SERIAL_PORT_DFNS \
126 STD_SERIAL_PORT_DFNS
127#endif
128#endif /* __PPC_PLATFORMS_EV64260_H */
diff --git a/arch/ppc/platforms/fads.h b/arch/ppc/platforms/fads.h
new file mode 100644
index 000000000000..632b8178ce66
--- /dev/null
+++ b/arch/ppc/platforms/fads.h
@@ -0,0 +1,57 @@
1/*
2 * A collection of structures, addresses, and values associated with
3 * the Motorola 860T FADS board. Copied from the MBX stuff.
4 *
5 * Copyright (c) 1998 Dan Malek (dmalek@jlc.net)
6 */
7#ifdef __KERNEL__
8#ifndef __ASM_FADS_H__
9#define __ASM_FADS_H__
10
11#include <linux/config.h>
12
13#include <asm/ppcboot.h>
14
15/* Memory map is configured by the PROM startup.
16 * I tried to follow the FADS manual, although the startup PROM
17 * dictates this and we simply have to move some of the physical
18 * addresses for Linux.
19 */
20#define BCSR_ADDR ((uint)0xff010000)
21#define BCSR_SIZE ((uint)(64 * 1024))
22#define BCSR0 ((uint)0xff010000)
23#define BCSR1 ((uint)0xff010004)
24#define BCSR2 ((uint)0xff010008)
25#define BCSR3 ((uint)0xff01000c)
26#define BCSR4 ((uint)0xff010010)
27
28#define IMAP_ADDR ((uint)0xff000000)
29#define IMAP_SIZE ((uint)(64 * 1024))
30
31#define PCMCIA_MEM_ADDR ((uint)0xff020000)
32#define PCMCIA_MEM_SIZE ((uint)(64 * 1024))
33
34/* Bits of interest in the BCSRs.
35 */
36#define BCSR1_ETHEN ((uint)0x20000000)
37#define BCSR1_RS232EN_1 ((uint)0x01000000)
38#define BCSR1_RS232EN_2 ((uint)0x00040000)
39#define BCSR4_ETHLOOP ((uint)0x80000000) /* EEST Loopback */
40#define BCSR4_EEFDX ((uint)0x40000000) /* EEST FDX enable */
41#define BCSR4_FETH_EN ((uint)0x08000000) /* PHY enable */
42#define BCSR4_FETHCFG0 ((uint)0x04000000) /* PHY autoneg mode */
43#define BCSR4_FETHCFG1 ((uint)0x00400000) /* PHY autoneg mode */
44#define BCSR4_FETHFDE ((uint)0x02000000) /* PHY FDX advertise */
45#define BCSR4_FETHRST ((uint)0x00200000) /* PHY Reset */
46
47/* Interrupt level assignments.
48 */
49#define FEC_INTERRUPT SIU_LEVEL1 /* FEC interrupt */
50#define PHY_INTERRUPT SIU_IRQ2 /* PHY link change interrupt */
51
52/* We don't use the 8259.
53 */
54#define NR_8259_INTS 0
55
56#endif /* __ASM_FADS_H__ */
57#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/gemini.h b/arch/ppc/platforms/gemini.h
new file mode 100644
index 000000000000..06de59248918
--- /dev/null
+++ b/arch/ppc/platforms/gemini.h
@@ -0,0 +1,168 @@
1/*
2 * arch/ppc/platforms/gemini.h
3 *
4 *
5 * Onboard registers and descriptions for Synergy Microsystems'
6 * "Gemini" boards.
7 *
8 */
9#ifdef __KERNEL__
10#ifndef __PPC_GEMINI_H
11#define __PPC_GEMINI_H
12
13/* Registers */
14
15#define GEMINI_SERIAL_B (0xffeffb00)
16#define GEMINI_SERIAL_A (0xffeffb08)
17#define GEMINI_USWITCH (0xffeffd00)
18#define GEMINI_BREV (0xffeffe00)
19#define GEMINI_BECO (0xffeffe08)
20#define GEMINI_FEAT (0xffeffe10)
21#define GEMINI_BSTAT (0xffeffe18)
22#define GEMINI_CPUSTAT (0xffeffe20)
23#define GEMINI_L2CFG (0xffeffe30)
24#define GEMINI_MEMCFG (0xffeffe38)
25#define GEMINI_FLROM (0xffeffe40)
26#define GEMINI_P0PCI (0xffeffe48)
27#define GEMINI_FLWIN (0xffeffe50)
28#define GEMINI_P0INTMASK (0xffeffe60)
29#define GEMINI_P0INTAP (0xffeffe68)
30#define GEMINI_PCIERR (0xffeffe70)
31#define GEMINI_LEDBASE (0xffeffe80)
32#define GEMINI_RTC (0xffe9fff8)
33#define GEMINI_LEDS 8
34#define GEMINI_SWITCHES 8
35
36
37/* Flash ROM bit definitions */
38#define GEMINI_FLS_WEN (1<<0)
39#define GEMINI_FLS_JMP (1<<6)
40#define GEMINI_FLS_BOOT (1<<7)
41
42/* Memory bit definitions */
43#define GEMINI_MEM_TYPE_MASK 0xc0
44#define GEMINI_MEM_SIZE_MASK 0x38
45#define GEMINI_MEM_BANK_MASK 0x07
46
47/* L2 cache bit definitions */
48#define GEMINI_L2_SIZE_MASK 0xc0
49#define GEMINI_L2_RATIO_MASK 0x03
50
51/* Timebase register bit definitons */
52#define GEMINI_TIMEB0_EN (1<<0)
53#define GEMINI_TIMEB1_EN (1<<1)
54#define GEMINI_TIMEB2_EN (1<<2)
55#define GEMINI_TIMEB3_EN (1<<3)
56
57/* CPU status bit definitions */
58#define GEMINI_CPU_ID_MASK 0x03
59#define GEMINI_CPU_COUNT_MASK 0x0c
60#define GEMINI_CPU0_HALTED (1<<4)
61#define GEMINI_CPU1_HALTED (1<<5)
62#define GEMINI_CPU2_HALTED (1<<6)
63#define GEMINI_CPU3_HALTED (1<<7)
64
65/* Board status bit definitions */
66#define GEMINI_BRD_FAIL (1<<0) /* FAIL led is lit */
67#define GEMINI_BRD_BUS_MASK 0x0c /* PowerPC bus speed */
68
69/* Board family/feature bit descriptions */
70#define GEMINI_FEAT_HAS_FLASH (1<<0)
71#define GEMINI_FEAT_HAS_ETH (1<<1)
72#define GEMINI_FEAT_HAS_SCSI (1<<2)
73#define GEMINI_FEAT_HAS_P0 (1<<3)
74#define GEMINI_FEAT_FAM_MASK 0xf0
75
76/* Mod/ECO bit definitions */
77#define GEMINI_ECO_LEVEL_MASK 0x0f
78#define GEMINI_MOD_MASK 0xf0
79
80/* Type/revision bit definitions */
81#define GEMINI_REV_MASK 0x0f
82#define GEMINI_TYPE_MASK 0xf0
83
84/* User switch definitions */
85#define GEMINI_SWITCH_VERBOSE 1 /* adds "debug" to boot cmd line */
86#define GEMINI_SWITCH_SINGLE_USER 7 /* boots into "single-user" mode */
87
88#define SGS_RTC_CONTROL 0
89#define SGS_RTC_SECONDS 1
90#define SGS_RTC_MINUTES 2
91#define SGS_RTC_HOURS 3
92#define SGS_RTC_DAY 4
93#define SGS_RTC_DAY_OF_MONTH 5
94#define SGS_RTC_MONTH 6
95#define SGS_RTC_YEAR 7
96
97#define SGS_RTC_SET 0x80
98#define SGS_RTC_IS_STOPPED 0x80
99
100#define GRACKLE_CONFIG_ADDR_ADDR (0xfec00000)
101#define GRACKLE_CONFIG_DATA_ADDR (0xfee00000)
102
103#define GEMINI_BOOT_INIT (0xfff00100)
104
105#ifndef __ASSEMBLY__
106
107static inline void grackle_write( unsigned long addr, unsigned long data )
108{
109 __asm__ __volatile__(
110 " stwbrx %1, 0, %0\n \
111 sync\n \
112 stwbrx %3, 0, %2\n \
113 sync "
114 : /* no output */
115 : "r" (GRACKLE_CONFIG_ADDR_ADDR), "r" (addr),
116 "r" (GRACKLE_CONFIG_DATA_ADDR), "r" (data));
117}
118
119static inline unsigned long grackle_read( unsigned long addr )
120{
121 unsigned long val;
122
123 __asm__ __volatile__(
124 " stwbrx %1, 0, %2\n \
125 sync\n \
126 lwbrx %0, 0, %3\n \
127 sync "
128 : "=r" (val)
129 : "r" (addr), "r" (GRACKLE_CONFIG_ADDR_ADDR),
130 "r" (GRACKLE_CONFIG_DATA_ADDR));
131
132 return val;
133}
134
135static inline void gemini_led_on( int led )
136{
137 if (led >= 0 && led < GEMINI_LEDS)
138 *(unsigned char *)(GEMINI_LEDBASE + (led<<3)) = 1;
139}
140
141static inline void gemini_led_off(int led)
142{
143 if (led >= 0 && led < GEMINI_LEDS)
144 *(unsigned char *)(GEMINI_LEDBASE + (led<<3)) = 0;
145}
146
147static inline int gemini_led_val(int led)
148{
149 int val = 0;
150 if (led >= 0 && led < GEMINI_LEDS)
151 val = *(unsigned char *)(GEMINI_LEDBASE + (led<<3));
152 return (val & 0x1);
153}
154
155/* returns processor id from the board */
156static inline int gemini_processor(void)
157{
158 unsigned char cpu = *(unsigned char *)(GEMINI_CPUSTAT);
159 return (int) ((cpu == 0) ? 4 : (cpu & GEMINI_CPU_ID_MASK));
160}
161
162
163extern void _gemini_reboot(void);
164extern void gemini_prom_init(void);
165extern void gemini_init_l2(void);
166#endif /* __ASSEMBLY__ */
167#endif
168#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/gemini_pci.c b/arch/ppc/platforms/gemini_pci.c
new file mode 100644
index 000000000000..95656091ba2b
--- /dev/null
+++ b/arch/ppc/platforms/gemini_pci.c
@@ -0,0 +1,41 @@
1#include <linux/kernel.h>
2#include <linux/init.h>
3#include <linux/pci.h>
4#include <linux/slab.h>
5
6#include <asm/machdep.h>
7#include <platforms/gemini.h>
8#include <asm/byteorder.h>
9#include <asm/io.h>
10#include <asm/uaccess.h>
11#include <asm/pci-bridge.h>
12
13void __init gemini_pcibios_fixup(void)
14{
15 int i;
16 struct pci_dev *dev = NULL;
17
18 for_each_pci_dev(dev) {
19 for(i = 0; i < 6; i++) {
20 if (dev->resource[i].flags & IORESOURCE_IO) {
21 dev->resource[i].start |= (0xfe << 24);
22 dev->resource[i].end |= (0xfe << 24);
23 }
24 }
25 }
26}
27
28
29/* The "bootloader" for Synergy boards does none of this for us, so we need to
30 lay it all out ourselves... --Dan */
31void __init gemini_find_bridges(void)
32{
33 struct pci_controller* hose;
34
35 ppc_md.pcibios_fixup = gemini_pcibios_fixup;
36
37 hose = pcibios_alloc_controller();
38 if (!hose)
39 return;
40 setup_indirect_pci(hose, 0xfec00000, 0xfee00000);
41}
diff --git a/arch/ppc/platforms/gemini_prom.S b/arch/ppc/platforms/gemini_prom.S
new file mode 100644
index 000000000000..8c5065d56505
--- /dev/null
+++ b/arch/ppc/platforms/gemini_prom.S
@@ -0,0 +1,93 @@
1/*
2 * arch/ppc/platforms/gemini_prom.S
3 *
4 * Not really prom support code (yet), but sort of anti-prom code. The current
5 * bootloader does a number of things it shouldn't and doesn't do things that it
6 * should. The stuff in here is mainly a hodge-podge collection of setup code
7 * to get the board up and running.
8 * ---Dan
9 */
10
11#include <linux/config.h>
12#include <asm/reg.h>
13#include <asm/page.h>
14#include <platforms/gemini.h>
15#include <asm/ppc_asm.h>
16
17/*
18 * On 750's the MMU is on when Linux is booted, so we need to clear out the
19 * bootloader's BAT settings, make sure we're in supervisor state (gotcha!),
20 * and turn off the MMU.
21 *
22 */
23
24_GLOBAL(gemini_prom_init)
25#ifdef CONFIG_SMP
26 /* Since the MMU's on, get stuff in rom space that we'll need */
27 lis r4,GEMINI_CPUSTAT@h
28 ori r4,r4,GEMINI_CPUSTAT@l
29 lbz r5,0(r4)
30 andi. r5,r5,3
31 mr r24,r5 /* cpu # used later on */
32#endif
33 mfmsr r4
34 li r3,MSR_PR /* ensure supervisor! */
35 ori r3,r3,MSR_IR|MSR_DR
36 andc r4,r4,r3
37 mtmsr r4
38 isync
39#if 0
40 /* zero out the bats now that the MMU is off */
41prom_no_mmu:
42 li r3,0
43 mtspr SPRN_IBAT0U,r3
44 mtspr SPRN_IBAT0L,r3
45 mtspr SPRN_IBAT1U,r3
46 mtspr SPRN_IBAT1L,r3
47 mtspr SPRN_IBAT2U,r3
48 mtspr SPRN_IBAT2L,r3
49 mtspr SPRN_IBAT3U,r3
50 mtspr SPRN_IBAT3L,r3
51
52 mtspr SPRN_DBAT0U,r3
53 mtspr SPRN_DBAT0L,r3
54 mtspr SPRN_DBAT1U,r3
55 mtspr SPRN_DBAT1L,r3
56 mtspr SPRN_DBAT2U,r3
57 mtspr SPRN_DBAT2L,r3
58 mtspr SPRN_DBAT3U,r3
59 mtspr SPRN_DBAT3L,r3
60#endif
61
62 /* the bootloader (as far as I'm currently aware) doesn't mess with page
63 tables, but since we're already here, might as well zap these, too */
64 li r4,0
65 mtspr SPRN_SDR1,r4
66
67 li r4,16
68 mtctr r4
69 li r3,0
70 li r4,0
713: mtsrin r3,r4
72 addi r3,r3,1
73 bdnz 3b
74
75#ifdef CONFIG_SMP
76 /* The 750 book (and Mot/IBM support) says that this will "assist" snooping
77 when in SMP. Not sure yet whether this should stay or leave... */
78 mfspr r4,SPRN_HID0
79 ori r4,r4,HID0_ABE
80 mtspr SPRN_HID0,r4
81 sync
82#endif /* CONFIG_SMP */
83 blr
84
85/* apparently, SMon doesn't pay attention to HID0[SRST]. Disable the MMU and
86 branch to 0xfff00100 */
87_GLOBAL(_gemini_reboot)
88 lis r5,GEMINI_BOOT_INIT@h
89 ori r5,r5,GEMINI_BOOT_INIT@l
90 li r6,MSR_IP
91 mtspr SPRN_SRR0,r5
92 mtspr SPRN_SRR1,r6
93 rfi
diff --git a/arch/ppc/platforms/gemini_serial.h b/arch/ppc/platforms/gemini_serial.h
new file mode 100644
index 000000000000..69855aeec888
--- /dev/null
+++ b/arch/ppc/platforms/gemini_serial.h
@@ -0,0 +1,41 @@
1#ifdef __KERNEL__
2#ifndef __ASMPPC_GEMINI_SERIAL_H
3#define __ASMPPC_GEMINI_SERIAL_H
4
5#include <linux/config.h>
6#include <platforms/gemini.h>
7
8#ifdef CONFIG_SERIAL_MANY_PORTS
9#define RS_TABLE_SIZE 64
10#else
11#define RS_TABLE_SIZE 4
12#endif
13
14/* Rate for the 24.576 Mhz clock for the onboard serial chip */
15#define BASE_BAUD (24576000 / 16)
16
17#ifdef CONFIG_SERIAL_DETECT_IRQ
18#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_SKIP_TEST|ASYNC_AUTO_IRQ)
19#define STD_COM4_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_AUTO_IRQ)
20#else
21#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_SKIP_TEST)
22#define STD_COM4_FLAGS (ASYNC_BOOT_AUTOCONF)
23#endif
24
25#define STD_SERIAL_PORT_DEFNS \
26 { 0, BASE_BAUD, GEMINI_SERIAL_A, 15, STD_COM_FLAGS }, /* ttyS0 */ \
27 { 0, BASE_BAUD, GEMINI_SERIAL_B, 14, STD_COM_FLAGS }, /* ttyS1 */ \
28
29#ifdef CONFIG_GEMINI_PU32
30#define PU32_SERIAL_PORT_DEFNS \
31 { 0, BASE_BAUD, NULL, 0, STD_COM_FLAGS },
32#else
33#define PU32_SERIAL_PORT_DEFNS
34#endif
35
36#define SERIAL_PORT_DFNS \
37 STD_SERIAL_PORT_DEFNS \
38 PU32_SERIAL_PORT_DEFNS
39
40#endif
41#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/gemini_setup.c b/arch/ppc/platforms/gemini_setup.c
new file mode 100644
index 000000000000..1a42cb9b1134
--- /dev/null
+++ b/arch/ppc/platforms/gemini_setup.c
@@ -0,0 +1,584 @@
1/*
2 * arch/ppc/platforms/gemini_setup.c
3 *
4 * Copyright (C) 1995 Linus Torvalds
5 * Adapted from 'alpha' version by Gary Thomas
6 * Modified by Cort Dougan (cort@cs.nmt.edu)
7 * Synergy Microsystems board support by Dan Cox (dan@synergymicro.com)
8 *
9 */
10
11#include <linux/config.h>
12#include <linux/stddef.h>
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/errno.h>
16#include <linux/reboot.h>
17#include <linux/pci.h>
18#include <linux/time.h>
19#include <linux/kdev_t.h>
20#include <linux/types.h>
21#include <linux/major.h>
22#include <linux/initrd.h>
23#include <linux/console.h>
24#include <linux/irq.h>
25#include <linux/seq_file.h>
26#include <linux/root_dev.h>
27#include <linux/bcd.h>
28
29#include <asm/system.h>
30#include <asm/pgtable.h>
31#include <asm/page.h>
32#include <asm/dma.h>
33#include <asm/io.h>
34#include <asm/m48t35.h>
35#include <platforms/gemini.h>
36#include <asm/time.h>
37#include <asm/open_pic.h>
38#include <asm/bootinfo.h>
39
40void gemini_find_bridges(void);
41static int gemini_get_clock_speed(void);
42extern void gemini_pcibios_fixup(void);
43
44static char *gemini_board_families[] = {
45 "VGM", "VSS", "KGM", "VGR", "VCM", "VCS", "KCM", "VCR"
46};
47static int gemini_board_count = sizeof(gemini_board_families) /
48 sizeof(gemini_board_families[0]);
49
50static unsigned int cpu_7xx[16] = {
51 0, 15, 14, 0, 0, 13, 5, 9, 6, 11, 8, 10, 16, 12, 7, 0
52};
53static unsigned int cpu_6xx[16] = {
54 0, 0, 14, 0, 0, 13, 5, 9, 6, 11, 8, 10, 0, 12, 7, 0
55};
56
57/*
58 * prom_init is the Gemini version of prom.c:prom_init. We only need
59 * the BSS clearing code, so I copied that out of prom.c. This is a
60 * lot simpler than hacking prom.c so it will build with Gemini. -VAL
61 */
62
63#define PTRRELOC(x) ((typeof(x))((unsigned long)(x) + offset))
64
65unsigned long
66prom_init(void)
67{
68 unsigned long offset = reloc_offset();
69 unsigned long phys;
70 extern char __bss_start, _end;
71
72 /* First zero the BSS -- use memset, some arches don't have
73 * caches on yet */
74 memset_io(PTRRELOC(&__bss_start),0 , &_end - &__bss_start);
75
76 /* Default */
77 phys = offset + KERNELBASE;
78
79 gemini_prom_init();
80
81 return phys;
82}
83
84int
85gemini_show_cpuinfo(struct seq_file *m)
86{
87 unsigned char reg, rev;
88 char *family;
89 unsigned int type;
90
91 reg = readb(GEMINI_FEAT);
92 family = gemini_board_families[((reg>>4) & 0xf)];
93 if (((reg>>4) & 0xf) > gemini_board_count)
94 printk(KERN_ERR "cpuinfo(): unable to determine board family\n");
95
96 reg = readb(GEMINI_BREV);
97 type = (reg>>4) & 0xf;
98 rev = reg & 0xf;
99
100 reg = readb(GEMINI_BECO);
101
102 seq_printf(m, "machine\t\t: Gemini %s%d, rev %c, eco %d\n",
103 family, type, (rev + 'A'), (reg & 0xf));
104
105 seq_printf(m, "board\t\t: Gemini %s", family);
106 if (type > 9)
107 seq_printf(m, "%c", (type - 10) + 'A');
108 else
109 seq_printf(m, "%d", type);
110
111 seq_printf(m, ", rev %c, eco %d\n", (rev + 'A'), (reg & 0xf));
112
113 seq_printf(m, "clock\t\t: %dMhz\n", gemini_get_clock_speed());
114
115 return 0;
116}
117
118static u_char gemini_openpic_initsenses[] = {
119 1,
120 1,
121 1,
122 1,
123 0,
124 0,
125 1, /* remainder are level-triggered */
126};
127
128#define GEMINI_MPIC_ADDR (0xfcfc0000)
129#define GEMINI_MPIC_PCI_CFG (0x80005800)
130
131void __init gemini_openpic_init(void)
132{
133
134 OpenPIC_Addr = (volatile struct OpenPIC *)
135 grackle_read(GEMINI_MPIC_PCI_CFG + 0x10);
136 OpenPIC_InitSenses = gemini_openpic_initsenses;
137 OpenPIC_NumInitSenses = sizeof( gemini_openpic_initsenses );
138
139 ioremap( GEMINI_MPIC_ADDR, OPENPIC_SIZE);
140}
141
142
143extern unsigned long loops_per_jiffy;
144extern int root_mountflags;
145extern char cmd_line[];
146
147void
148gemini_heartbeat(void)
149{
150 static unsigned long led = GEMINI_LEDBASE+(4*8);
151 static char direction = 8;
152
153
154 /* We only want to do this on 1 CPU */
155 if (smp_processor_id())
156 return;
157 *(char *)led = 0;
158 if ( (led + direction) > (GEMINI_LEDBASE+(7*8)) ||
159 (led + direction) < (GEMINI_LEDBASE+(4*8)) )
160 direction *= -1;
161 led += direction;
162 *(char *)led = 0xff;
163 ppc_md.heartbeat_count = ppc_md.heartbeat_reset;
164}
165
166void __init gemini_setup_arch(void)
167{
168 extern char cmd_line[];
169
170
171 loops_per_jiffy = 50000000/HZ;
172
173#ifdef CONFIG_BLK_DEV_INITRD
174 /* bootable off CDROM */
175 if (initrd_start)
176 ROOT_DEV = Root_SR0;
177 else
178#endif
179 ROOT_DEV = Root_SDA1;
180
181 /* nothing but serial consoles... */
182 sprintf(cmd_line, "%s console=ttyS0", cmd_line);
183
184 printk("Boot arguments: %s\n", cmd_line);
185
186 ppc_md.heartbeat = gemini_heartbeat;
187 ppc_md.heartbeat_reset = HZ/8;
188 ppc_md.heartbeat_count = 1;
189
190 /* Lookup PCI hosts */
191 gemini_find_bridges();
192 /* take special pains to map the MPIC, since it isn't mapped yet */
193 gemini_openpic_init();
194 /* start the L2 */
195 gemini_init_l2();
196}
197
198
199int
200gemini_get_clock_speed(void)
201{
202 unsigned long hid1, pvr;
203 int clock;
204
205 pvr = mfspr(SPRN_PVR);
206 hid1 = (mfspr(SPRN_HID1) >> 28) & 0xf;
207 if (PVR_VER(pvr) == 8 ||
208 PVR_VER(pvr) == 12)
209 hid1 = cpu_7xx[hid1];
210 else
211 hid1 = cpu_6xx[hid1];
212
213 switch((readb(GEMINI_BSTAT) & 0xc) >> 2) {
214
215 case 0:
216 default:
217 clock = (hid1*100)/3;
218 break;
219
220 case 1:
221 clock = (hid1*125)/3;
222 break;
223
224 case 2:
225 clock = (hid1*50);
226 break;
227 }
228
229 return clock;
230}
231
232void __init gemini_init_l2(void)
233{
234 unsigned char reg, brev, fam, creg;
235 unsigned long cache;
236 unsigned long pvr;
237
238 reg = readb(GEMINI_L2CFG);
239 brev = readb(GEMINI_BREV);
240 fam = readb(GEMINI_FEAT);
241 pvr = mfspr(SPRN_PVR);
242
243 switch(PVR_VER(pvr)) {
244
245 case 8:
246 if (reg & 0xc0)
247 cache = (((reg >> 6) & 0x3) << 28);
248 else
249 cache = 0x3 << 28;
250
251#ifdef CONFIG_SMP
252 /* Pre-3.0 processor revs had snooping errata. Leave
253 their L2's disabled with SMP. -- Dan */
254 if (PVR_CFG(pvr) < 3) {
255 printk("Pre-3.0 750; L2 left disabled!\n");
256 return;
257 }
258#endif /* CONFIG_SMP */
259
260 /* Special case: VGM5-B's came before L2 ratios were set on
261 the board. Processor speed shouldn't be too high, so
262 set L2 ratio to 1:1.5. */
263 if ((brev == 0x51) && ((fam & 0xa0) >> 4) == 0)
264 reg |= 1;
265
266 /* determine best cache ratio based upon what the board
267 tells us (which sometimes _may_ not be true) and
268 the processor speed. */
269 else {
270 if (gemini_get_clock_speed() > 250)
271 reg = 2;
272 }
273 break;
274 case 12:
275 {
276 static unsigned long l2_size_val = 0;
277
278 if (!l2_size_val)
279 l2_size_val = _get_L2CR();
280 cache = l2_size_val;
281 break;
282 }
283 case 4:
284 case 9:
285 creg = readb(GEMINI_CPUSTAT);
286 if (((creg & 0xc) >> 2) != 1)
287 printk("Dual-604 boards don't support the use of L2\n");
288 else
289 writeb(1, GEMINI_L2CFG);
290 return;
291 default:
292 printk("Unknown processor; L2 left disabled\n");
293 return;
294 }
295
296 cache |= ((1<<reg) << 25);
297 cache |= (L2CR_L2RAM_MASK|L2CR_L2CTL|L2CR_L2DO);
298 _set_L2CR(0);
299 _set_L2CR(cache | L2CR_L2E);
300
301}
302
303void
304gemini_restart(char *cmd)
305{
306 local_irq_disable();
307 /* make a clean restart, not via the MPIC */
308 _gemini_reboot();
309 for(;;);
310}
311
312void
313gemini_power_off(void)
314{
315 for(;;);
316}
317
318void
319gemini_halt(void)
320{
321 gemini_restart(NULL);
322}
323
324void __init gemini_init_IRQ(void)
325{
326 /* gemini has no 8259 */
327 openpic_init(1, 0, 0, -1);
328}
329
330#define gemini_rtc_read(x) (readb(GEMINI_RTC+(x)))
331#define gemini_rtc_write(val,x) (writeb((val),(GEMINI_RTC+(x))))
332
333/* ensure that the RTC is up and running */
334long __init gemini_time_init(void)
335{
336 unsigned char reg;
337
338 reg = gemini_rtc_read(M48T35_RTC_CONTROL);
339
340 if ( reg & M48T35_RTC_STOPPED ) {
341 printk(KERN_INFO "M48T35 real-time-clock was stopped. Now starting...\n");
342 gemini_rtc_write((reg & ~(M48T35_RTC_STOPPED)), M48T35_RTC_CONTROL);
343 gemini_rtc_write((reg | M48T35_RTC_SET), M48T35_RTC_CONTROL);
344 }
345 return 0;
346}
347
348#undef DEBUG_RTC
349
350unsigned long
351gemini_get_rtc_time(void)
352{
353 unsigned int year, mon, day, hour, min, sec;
354 unsigned char reg;
355
356 reg = gemini_rtc_read(M48T35_RTC_CONTROL);
357 gemini_rtc_write((reg|M48T35_RTC_READ), M48T35_RTC_CONTROL);
358#ifdef DEBUG_RTC
359 printk("get rtc: reg = %x\n", reg);
360#endif
361
362 do {
363 sec = gemini_rtc_read(M48T35_RTC_SECONDS);
364 min = gemini_rtc_read(M48T35_RTC_MINUTES);
365 hour = gemini_rtc_read(M48T35_RTC_HOURS);
366 day = gemini_rtc_read(M48T35_RTC_DOM);
367 mon = gemini_rtc_read(M48T35_RTC_MONTH);
368 year = gemini_rtc_read(M48T35_RTC_YEAR);
369 } while( sec != gemini_rtc_read(M48T35_RTC_SECONDS));
370#ifdef DEBUG_RTC
371 printk("get rtc: sec=%x, min=%x, hour=%x, day=%x, mon=%x, year=%x\n",
372 sec, min, hour, day, mon, year);
373#endif
374
375 gemini_rtc_write(reg, M48T35_RTC_CONTROL);
376
377 BCD_TO_BIN(sec);
378 BCD_TO_BIN(min);
379 BCD_TO_BIN(hour);
380 BCD_TO_BIN(day);
381 BCD_TO_BIN(mon);
382 BCD_TO_BIN(year);
383
384 if ((year += 1900) < 1970)
385 year += 100;
386#ifdef DEBUG_RTC
387 printk("get rtc: sec=%x, min=%x, hour=%x, day=%x, mon=%x, year=%x\n",
388 sec, min, hour, day, mon, year);
389#endif
390
391 return mktime( year, mon, day, hour, min, sec );
392}
393
394
395int
396gemini_set_rtc_time( unsigned long now )
397{
398 unsigned char reg;
399 struct rtc_time tm;
400
401 to_tm( now, &tm );
402
403 reg = gemini_rtc_read(M48T35_RTC_CONTROL);
404#ifdef DEBUG_RTC
405 printk("set rtc: reg = %x\n", reg);
406#endif
407
408 gemini_rtc_write((reg|M48T35_RTC_SET), M48T35_RTC_CONTROL);
409#ifdef DEBUG_RTC
410 printk("set rtc: tm vals - sec=%x, min=%x, hour=%x, mon=%x, mday=%x, year=%x\n",
411 tm.tm_sec, tm.tm_min, tm.tm_hour, tm.tm_mon, tm.tm_mday, tm.tm_year);
412#endif
413
414 tm.tm_year -= 1900;
415 BIN_TO_BCD(tm.tm_sec);
416 BIN_TO_BCD(tm.tm_min);
417 BIN_TO_BCD(tm.tm_hour);
418 BIN_TO_BCD(tm.tm_mon);
419 BIN_TO_BCD(tm.tm_mday);
420 BIN_TO_BCD(tm.tm_year);
421#ifdef DEBUG_RTC
422 printk("set rtc: tm vals - sec=%x, min=%x, hour=%x, mon=%x, mday=%x, year=%x\n",
423 tm.tm_sec, tm.tm_min, tm.tm_hour, tm.tm_mon, tm.tm_mday, tm.tm_year);
424#endif
425
426 gemini_rtc_write(tm.tm_sec, M48T35_RTC_SECONDS);
427 gemini_rtc_write(tm.tm_min, M48T35_RTC_MINUTES);
428 gemini_rtc_write(tm.tm_hour, M48T35_RTC_HOURS);
429 gemini_rtc_write(tm.tm_mday, M48T35_RTC_DOM);
430 gemini_rtc_write(tm.tm_mon, M48T35_RTC_MONTH);
431 gemini_rtc_write(tm.tm_year, M48T35_RTC_YEAR);
432
433 /* done writing */
434 gemini_rtc_write(reg, M48T35_RTC_CONTROL);
435
436 if ((time_state == TIME_ERROR) || (time_state == TIME_BAD))
437 time_state = TIME_OK;
438
439 return 0;
440}
441
442/* use the RTC to determine the decrementer count */
443void __init gemini_calibrate_decr(void)
444{
445 int freq, divisor;
446 unsigned char reg;
447
448 /* determine processor bus speed */
449 reg = readb(GEMINI_BSTAT);
450
451 switch(((reg & 0x0c)>>2)&0x3) {
452 case 0:
453 default:
454 freq = 66667;
455 break;
456 case 1:
457 freq = 83000;
458 break;
459 case 2:
460 freq = 100000;
461 break;
462 }
463
464 freq *= 1000;
465 divisor = 4;
466 tb_ticks_per_jiffy = freq / HZ / divisor;
467 tb_to_us = mulhwu_scale_factor(freq/divisor, 1000000);
468}
469
470unsigned long __init gemini_find_end_of_memory(void)
471{
472 unsigned long total;
473 unsigned char reg;
474
475 reg = readb(GEMINI_MEMCFG);
476 total = ((1<<((reg & 0x7) - 1)) *
477 (8<<((reg >> 3) & 0x7)));
478 total *= (1024*1024);
479 return total;
480}
481
482static void __init
483gemini_map_io(void)
484{
485 io_block_mapping(0xf0000000, 0xf0000000, 0x10000000, _PAGE_IO);
486 io_block_mapping(0x80000000, 0x80000000, 0x10000000, _PAGE_IO);
487}
488
489#ifdef CONFIG_SMP
490static int
491smp_gemini_probe(void)
492{
493 int i, nr;
494
495 nr = (readb(GEMINI_CPUSTAT) & GEMINI_CPU_COUNT_MASK) >> 2;
496 if (nr == 0)
497 nr = 4;
498
499 if (nr > 1) {
500 openpic_request_IPIs();
501 for (i = 1; i < nr; ++i)
502 smp_hw_index[i] = i;
503 }
504
505 return nr;
506}
507
508static void
509smp_gemini_kick_cpu(int nr)
510{
511 openpic_reset_processor_phys(1 << nr);
512 openpic_reset_processor_phys(0);
513}
514
515static void
516smp_gemini_setup_cpu(int cpu_nr)
517{
518 if (OpenPIC_Addr)
519 do_openpic_setup_cpu();
520 if (cpu_nr > 0)
521 gemini_init_l2();
522}
523
524static struct smp_ops_t gemini_smp_ops = {
525 smp_openpic_message_pass,
526 smp_gemini_probe,
527 smp_gemini_kick_cpu,
528 smp_gemini_setup_cpu,
529 .give_timebase = smp_generic_give_timebase,
530 .take_timebase = smp_generic_take_timebase,
531};
532#endif /* CONFIG_SMP */
533
534void __init platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
535 unsigned long r6, unsigned long r7)
536{
537 int i;
538
539 /* Restore BATs for now */
540 mtspr(SPRN_DBAT3U, 0xf0001fff);
541 mtspr(SPRN_DBAT3L, 0xf000002a);
542
543 parse_bootinfo(find_bootinfo());
544
545 for(i = 0; i < GEMINI_LEDS; i++)
546 gemini_led_off(i);
547
548 ISA_DMA_THRESHOLD = 0;
549 DMA_MODE_READ = 0;
550 DMA_MODE_WRITE = 0;
551
552#ifdef CONFIG_BLK_DEV_INITRD
553 if ( r4 )
554 {
555 initrd_start = r4 + KERNELBASE;
556 initrd_end = r5 + KERNELBASE;
557 }
558#endif
559
560 ppc_md.setup_arch = gemini_setup_arch;
561 ppc_md.show_cpuinfo = gemini_show_cpuinfo;
562 ppc_md.irq_canonicalize = NULL;
563 ppc_md.init_IRQ = gemini_init_IRQ;
564 ppc_md.get_irq = openpic_get_irq;
565 ppc_md.init = NULL;
566
567 ppc_md.restart = gemini_restart;
568 ppc_md.power_off = gemini_power_off;
569 ppc_md.halt = gemini_halt;
570
571 ppc_md.time_init = gemini_time_init;
572 ppc_md.set_rtc_time = gemini_set_rtc_time;
573 ppc_md.get_rtc_time = gemini_get_rtc_time;
574 ppc_md.calibrate_decr = gemini_calibrate_decr;
575
576 ppc_md.find_end_of_memory = gemini_find_end_of_memory;
577 ppc_md.setup_io_mappings = gemini_map_io;
578
579 ppc_md.pcibios_fixup_bus = gemini_pcibios_fixup;
580
581#ifdef CONFIG_SMP
582 ppc_md.smp_ops = &gemini_smp_ops;
583#endif /* CONFIG_SMP */
584}
diff --git a/arch/ppc/platforms/hdpu.c b/arch/ppc/platforms/hdpu.c
new file mode 100644
index 000000000000..b659d7b3d747
--- /dev/null
+++ b/arch/ppc/platforms/hdpu.c
@@ -0,0 +1,1062 @@
1
2/*
3 * arch/ppc/platforms/hdpu_setup.c
4 *
5 * Board setup routines for the Sky Computers HDPU Compute Blade.
6 *
7 * Written by Brian Waite <waite@skycomputers.com>
8 *
9 * Based on code done by - Mark A. Greer <mgreer@mvista.com>
10 * Rabeeh Khoury - rabeeh@galileo.co.il
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 */
17
18#include <linux/config.h>
19
20#include <linux/pci.h>
21#include <linux/delay.h>
22#include <linux/irq.h>
23#include <linux/ide.h>
24#include <linux/seq_file.h>
25
26#include <linux/initrd.h>
27#include <linux/root_dev.h>
28#include <linux/smp.h>
29
30#include <asm/time.h>
31#include <asm/machdep.h>
32#include <asm/todc.h>
33#include <asm/mv64x60.h>
34#include <asm/ppcboot.h>
35#include <platforms/hdpu.h>
36#include <linux/mv643xx.h>
37#include <linux/hdpu_features.h>
38#include <linux/device.h>
39#include <linux/mtd/physmap.h>
40
41#define BOARD_VENDOR "Sky Computers"
42#define BOARD_MACHINE "HDPU-CB-A"
43
44bd_t ppcboot_bd;
45int ppcboot_bd_valid = 0;
46
47static mv64x60_handle_t bh;
48
49extern char cmd_line[];
50
51unsigned long hdpu_find_end_of_memory(void);
52void hdpu_mpsc_progress(char *s, unsigned short hex);
53void hdpu_heartbeat(void);
54
55static void parse_bootinfo(unsigned long r3,
56 unsigned long r4, unsigned long r5,
57 unsigned long r6, unsigned long r7);
58static void hdpu_set_l1pe(void);
59static void hdpu_cpustate_set(unsigned char new_state);
60#ifdef CONFIG_SMP
61static spinlock_t timebase_lock = SPIN_LOCK_UNLOCKED;
62static unsigned int timebase_upper = 0, timebase_lower = 0;
63extern int smp_tb_synchronized;
64
65void __devinit hdpu_tben_give(void);
66void __devinit hdpu_tben_take(void);
67#endif
68
69static int __init
70hdpu_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
71{
72 struct pci_controller *hose = pci_bus_to_hose(dev->bus->number);
73
74 if (hose->index == 0) {
75 static char pci_irq_table[][4] = {
76 {HDPU_PCI_0_IRQ, 0, 0, 0},
77 {HDPU_PCI_0_IRQ, 0, 0, 0},
78 };
79
80 const long min_idsel = 1, max_idsel = 2, irqs_per_slot = 4;
81 return PCI_IRQ_TABLE_LOOKUP;
82 } else {
83 static char pci_irq_table[][4] = {
84 {HDPU_PCI_1_IRQ, 0, 0, 0},
85 };
86
87 const long min_idsel = 1, max_idsel = 1, irqs_per_slot = 4;
88 return PCI_IRQ_TABLE_LOOKUP;
89 }
90}
91
92static void __init hdpu_intr_setup(void)
93{
94 mv64x60_write(&bh, MV64x60_GPP_IO_CNTL,
95 (1 | (1 << 2) | (1 << 3) | (1 << 4) | (1 << 5) |
96 (1 << 6) | (1 << 7) | (1 << 12) | (1 << 16) |
97 (1 << 18) | (1 << 19) | (1 << 20) | (1 << 21) |
98 (1 << 22) | (1 << 23) | (1 << 24) | (1 << 25) |
99 (1 << 26) | (1 << 27) | (1 << 28) | (1 << 29)));
100
101 /* XXXX Erranum FEr PCI-#8 */
102 mv64x60_clr_bits(&bh, MV64x60_PCI0_CMD, (1 << 5) | (1 << 9));
103 mv64x60_clr_bits(&bh, MV64x60_PCI1_CMD, (1 << 5) | (1 << 9));
104
105 /*
106 * Dismiss and then enable interrupt on GPP interrupt cause
107 * for CPU #0
108 */
109 mv64x60_write(&bh, MV64x60_GPP_INTR_CAUSE, ~((1 << 8) | (1 << 13)));
110 mv64x60_set_bits(&bh, MV64x60_GPP_INTR_MASK, (1 << 8) | (1 << 13));
111
112 /*
113 * Dismiss and then enable interrupt on CPU #0 high cause reg
114 * BIT25 summarizes GPP interrupts 8-15
115 */
116 mv64x60_set_bits(&bh, MV64360_IC_CPU0_INTR_MASK_HI, (1 << 25));
117}
118
119static void __init hdpu_setup_peripherals(void)
120{
121 unsigned int val;
122
123 mv64x60_set_32bit_window(&bh, MV64x60_CPU2BOOT_WIN,
124 HDPU_EMB_FLASH_BASE, HDPU_EMB_FLASH_SIZE, 0);
125 bh.ci->enable_window_32bit(&bh, MV64x60_CPU2BOOT_WIN);
126
127 mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_0_WIN,
128 HDPU_TBEN_BASE, HDPU_TBEN_SIZE, 0);
129 bh.ci->enable_window_32bit(&bh, MV64x60_CPU2DEV_0_WIN);
130
131 mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_1_WIN,
132 HDPU_NEXUS_ID_BASE, HDPU_NEXUS_ID_SIZE, 0);
133 bh.ci->enable_window_32bit(&bh, MV64x60_CPU2DEV_1_WIN);
134
135 mv64x60_set_32bit_window(&bh, MV64x60_CPU2SRAM_WIN,
136 HDPU_INTERNAL_SRAM_BASE,
137 HDPU_INTERNAL_SRAM_SIZE, 0);
138 bh.ci->enable_window_32bit(&bh, MV64x60_CPU2SRAM_WIN);
139
140 bh.ci->disable_window_32bit(&bh, MV64x60_ENET2MEM_4_WIN);
141 mv64x60_set_32bit_window(&bh, MV64x60_ENET2MEM_4_WIN, 0, 0, 0);
142
143 mv64x60_clr_bits(&bh, MV64x60_PCI0_PCI_DECODE_CNTL, (1 << 3));
144 mv64x60_clr_bits(&bh, MV64x60_PCI1_PCI_DECODE_CNTL, (1 << 3));
145 mv64x60_clr_bits(&bh, MV64x60_TIMR_CNTR_0_3_CNTL,
146 ((1 << 0) | (1 << 8) | (1 << 16) | (1 << 24)));
147
148 /* Enable pipelining */
149 mv64x60_set_bits(&bh, MV64x60_CPU_CONFIG, (1 << 13));
150 /* Enable Snoop Pipelineing */
151 mv64x60_set_bits(&bh, MV64360_D_UNIT_CONTROL_HIGH, (1 << 24));
152
153 /*
154 * Change DRAM read buffer assignment.
155 * Assign read buffer 0 dedicated only for CPU,
156 * and the rest read buffer 1.
157 */
158 val = mv64x60_read(&bh, MV64360_SDRAM_CONFIG);
159 val = val & 0x03ffffff;
160 val = val | 0xf8000000;
161 mv64x60_write(&bh, MV64360_SDRAM_CONFIG, val);
162
163 /*
164 * Configure internal SRAM -
165 * Cache coherent write back, if CONFIG_MV64360_SRAM_CACHE_COHERENT set
166 * Parity enabled.
167 * Parity error propagation
168 * Arbitration not parked for CPU only
169 * Other bits are reserved.
170 */
171#ifdef CONFIG_MV64360_SRAM_CACHE_COHERENT
172 mv64x60_write(&bh, MV64360_SRAM_CONFIG, 0x001600b2);
173#else
174 mv64x60_write(&bh, MV64360_SRAM_CONFIG, 0x001600b0);
175#endif
176
177 hdpu_intr_setup();
178}
179
180static void __init hdpu_setup_bridge(void)
181{
182 struct mv64x60_setup_info si;
183 int i;
184
185 memset(&si, 0, sizeof(si));
186
187 si.phys_reg_base = HDPU_BRIDGE_REG_BASE;
188 si.pci_0.enable_bus = 1;
189 si.pci_0.pci_io.cpu_base = HDPU_PCI0_IO_START_PROC_ADDR;
190 si.pci_0.pci_io.pci_base_hi = 0;
191 si.pci_0.pci_io.pci_base_lo = HDPU_PCI0_IO_START_PCI_ADDR;
192 si.pci_0.pci_io.size = HDPU_PCI0_IO_SIZE;
193 si.pci_0.pci_io.swap = MV64x60_CPU2PCI_SWAP_NONE;
194 si.pci_0.pci_mem[0].cpu_base = HDPU_PCI0_MEM_START_PROC_ADDR;
195 si.pci_0.pci_mem[0].pci_base_hi = HDPU_PCI0_MEM_START_PCI_HI_ADDR;
196 si.pci_0.pci_mem[0].pci_base_lo = HDPU_PCI0_MEM_START_PCI_LO_ADDR;
197 si.pci_0.pci_mem[0].size = HDPU_PCI0_MEM_SIZE;
198 si.pci_0.pci_mem[0].swap = MV64x60_CPU2PCI_SWAP_NONE;
199 si.pci_0.pci_cmd_bits = 0;
200 si.pci_0.latency_timer = 0x80;
201
202 si.pci_1.enable_bus = 1;
203 si.pci_1.pci_io.cpu_base = HDPU_PCI1_IO_START_PROC_ADDR;
204 si.pci_1.pci_io.pci_base_hi = 0;
205 si.pci_1.pci_io.pci_base_lo = HDPU_PCI1_IO_START_PCI_ADDR;
206 si.pci_1.pci_io.size = HDPU_PCI1_IO_SIZE;
207 si.pci_1.pci_io.swap = MV64x60_CPU2PCI_SWAP_NONE;
208 si.pci_1.pci_mem[0].cpu_base = HDPU_PCI1_MEM_START_PROC_ADDR;
209 si.pci_1.pci_mem[0].pci_base_hi = HDPU_PCI1_MEM_START_PCI_HI_ADDR;
210 si.pci_1.pci_mem[0].pci_base_lo = HDPU_PCI1_MEM_START_PCI_LO_ADDR;
211 si.pci_1.pci_mem[0].size = HDPU_PCI1_MEM_SIZE;
212 si.pci_1.pci_mem[0].swap = MV64x60_CPU2PCI_SWAP_NONE;
213 si.pci_1.pci_cmd_bits = 0;
214 si.pci_1.latency_timer = 0x80;
215
216 for (i = 0; i < MV64x60_CPU2MEM_WINDOWS; i++) {
217#if defined(CONFIG_NOT_COHERENT_CACHE)
218 si.cpu_prot_options[i] = 0;
219 si.enet_options[i] = MV64360_ENET2MEM_SNOOP_NONE;
220 si.mpsc_options[i] = MV64360_MPSC2MEM_SNOOP_NONE;
221 si.idma_options[i] = MV64360_IDMA2MEM_SNOOP_NONE;
222
223 si.pci_1.acc_cntl_options[i] =
224 MV64360_PCI_ACC_CNTL_SNOOP_NONE |
225 MV64360_PCI_ACC_CNTL_SWAP_NONE |
226 MV64360_PCI_ACC_CNTL_MBURST_128_BYTES |
227 MV64360_PCI_ACC_CNTL_RDSIZE_256_BYTES;
228
229 si.pci_0.acc_cntl_options[i] =
230 MV64360_PCI_ACC_CNTL_SNOOP_NONE |
231 MV64360_PCI_ACC_CNTL_SWAP_NONE |
232 MV64360_PCI_ACC_CNTL_MBURST_128_BYTES |
233 MV64360_PCI_ACC_CNTL_RDSIZE_256_BYTES;
234
235#else
236 si.cpu_prot_options[i] = 0;
237 si.enet_options[i] = MV64360_ENET2MEM_SNOOP_WB; /* errata */
238 si.mpsc_options[i] = MV64360_MPSC2MEM_SNOOP_WB; /* errata */
239 si.idma_options[i] = MV64360_IDMA2MEM_SNOOP_WB; /* errata */
240
241 si.pci_0.acc_cntl_options[i] =
242 MV64360_PCI_ACC_CNTL_SNOOP_WB |
243 MV64360_PCI_ACC_CNTL_SWAP_NONE |
244 MV64360_PCI_ACC_CNTL_MBURST_32_BYTES |
245 MV64360_PCI_ACC_CNTL_RDSIZE_256_BYTES;
246
247 si.pci_1.acc_cntl_options[i] =
248 MV64360_PCI_ACC_CNTL_SNOOP_WB |
249 MV64360_PCI_ACC_CNTL_SWAP_NONE |
250 MV64360_PCI_ACC_CNTL_MBURST_32_BYTES |
251 MV64360_PCI_ACC_CNTL_RDSIZE_256_BYTES;
252#endif
253 }
254
255 hdpu_cpustate_set(CPUSTATE_KERNEL_MAJOR | CPUSTATE_KERNEL_INIT_PCI);
256
257 /* Lookup PCI host bridges */
258 mv64x60_init(&bh, &si);
259 pci_dram_offset = 0; /* System mem at same addr on PCI & cpu bus */
260 ppc_md.pci_swizzle = common_swizzle;
261 ppc_md.pci_map_irq = hdpu_map_irq;
262
263 mv64x60_set_bus(&bh, 0, 0);
264 bh.hose_a->first_busno = 0;
265 bh.hose_a->last_busno = 0xff;
266 bh.hose_a->last_busno = pciauto_bus_scan(bh.hose_a, 0);
267
268 bh.hose_b->first_busno = bh.hose_a->last_busno + 1;
269 mv64x60_set_bus(&bh, 1, bh.hose_b->first_busno);
270 bh.hose_b->last_busno = 0xff;
271 bh.hose_b->last_busno = pciauto_bus_scan(bh.hose_b,
272 bh.hose_b->first_busno);
273
274 ppc_md.pci_exclude_device = mv64x60_pci_exclude_device;
275
276 hdpu_cpustate_set(CPUSTATE_KERNEL_MAJOR | CPUSTATE_KERNEL_INIT_REG);
277 /*
278 * Enabling of PCI internal-vs-external arbitration
279 * is a platform- and errata-dependent decision.
280 */
281 return;
282}
283
284#if defined(CONFIG_SERIAL_MPSC_CONSOLE)
285static void __init hdpu_early_serial_map(void)
286{
287#ifdef CONFIG_KGDB
288 static char first_time = 1;
289
290#if defined(CONFIG_KGDB_TTYS0)
291#define KGDB_PORT 0
292#elif defined(CONFIG_KGDB_TTYS1)
293#define KGDB_PORT 1
294#else
295#error "Invalid kgdb_tty port"
296#endif
297
298 if (first_time) {
299 gt_early_mpsc_init(KGDB_PORT,
300 B9600 | CS8 | CREAD | HUPCL | CLOCAL);
301 first_time = 0;
302 }
303
304 return;
305#endif
306}
307#endif
308
309static void hdpu_init2(void)
310{
311 return;
312}
313
314#if defined(CONFIG_MV643XX_ETH)
315static void __init hdpu_fixup_eth_pdata(struct platform_device *pd)
316{
317
318 struct mv643xx_eth_platform_data *eth_pd;
319 eth_pd = pd->dev.platform_data;
320
321 eth_pd->port_serial_control =
322 mv64x60_read(&bh, MV643XX_ETH_PORT_SERIAL_CONTROL_REG(pd->id) & ~1);
323
324 eth_pd->force_phy_addr = 1;
325 eth_pd->phy_addr = pd->id;
326 eth_pd->tx_queue_size = 400;
327 eth_pd->rx_queue_size = 800;
328}
329#endif
330
331static void __init hdpu_fixup_mpsc_pdata(struct platform_device *pd)
332{
333
334 struct mpsc_pdata *pdata;
335
336 pdata = (struct mpsc_pdata *)pd->dev.platform_data;
337
338 pdata->max_idle = 40;
339 if (ppcboot_bd_valid)
340 pdata->default_baud = ppcboot_bd.bi_baudrate;
341 else
342 pdata->default_baud = HDPU_DEFAULT_BAUD;
343 pdata->brg_clk_src = HDPU_MPSC_CLK_SRC;
344 pdata->brg_clk_freq = HDPU_MPSC_CLK_FREQ;
345}
346
347#if defined(CONFIG_HDPU_FEATURES)
348static void __init hdpu_fixup_cpustate_pdata(struct platform_device *pd)
349{
350 struct platform_device *pds[1];
351 pds[0] = pd;
352 mv64x60_pd_fixup(&bh, pds, 1);
353}
354#endif
355
356static int __init hdpu_platform_notify(struct device *dev)
357{
358 static struct {
359 char *bus_id;
360 void ((*rtn) (struct platform_device * pdev));
361 } dev_map[] = {
362 {
363 MPSC_CTLR_NAME ".0", hdpu_fixup_mpsc_pdata},
364#if defined(CONFIG_MV643XX_ETH)
365 {
366 MV643XX_ETH_NAME ".0", hdpu_fixup_eth_pdata},
367#endif
368#if defined(CONFIG_HDPU_FEATURES)
369 {
370 HDPU_CPUSTATE_NAME ".0", hdpu_fixup_cpustate_pdata},
371#endif
372 };
373 struct platform_device *pdev;
374 int i;
375
376 if (dev && dev->bus_id)
377 for (i = 0; i < ARRAY_SIZE(dev_map); i++)
378 if (!strncmp(dev->bus_id, dev_map[i].bus_id,
379 BUS_ID_SIZE)) {
380
381 pdev = container_of(dev,
382 struct platform_device,
383 dev);
384 dev_map[i].rtn(pdev);
385 }
386
387 return 0;
388}
389
390static void __init hdpu_setup_arch(void)
391{
392 if (ppc_md.progress)
393 ppc_md.progress("hdpu_setup_arch: enter", 0);
394#ifdef CONFIG_BLK_DEV_INITRD
395 if (initrd_start)
396 ROOT_DEV = Root_RAM0;
397 else
398#endif
399#ifdef CONFIG_ROOT_NFS
400 ROOT_DEV = Root_NFS;
401#else
402 ROOT_DEV = Root_SDA2;
403#endif
404
405 ppc_md.heartbeat = hdpu_heartbeat;
406
407 ppc_md.heartbeat_reset = HZ;
408 ppc_md.heartbeat_count = 1;
409
410 if (ppc_md.progress)
411 ppc_md.progress("hdpu_setup_arch: Enabling L2 cache", 0);
412
413 /* Enable L1 Parity Bits */
414 hdpu_set_l1pe();
415
416 /* Enable L2 and L3 caches (if 745x) */
417 _set_L2CR(0x80080000);
418
419 if (ppc_md.progress)
420 ppc_md.progress("hdpu_setup_arch: enter", 0);
421
422 hdpu_setup_bridge();
423
424 hdpu_setup_peripherals();
425
426#ifdef CONFIG_SERIAL_MPSC_CONSOLE
427 hdpu_early_serial_map();
428#endif
429
430 printk("SKY HDPU Compute Blade \n");
431
432 if (ppc_md.progress)
433 ppc_md.progress("hdpu_setup_arch: exit", 0);
434
435 hdpu_cpustate_set(CPUSTATE_KERNEL_MAJOR | CPUSTATE_KERNEL_OK);
436 return;
437}
438static void __init hdpu_init_irq(void)
439{
440 mv64360_init_irq();
441}
442
443static void __init hdpu_set_l1pe()
444{
445 unsigned long ictrl;
446 asm volatile ("mfspr %0, 1011":"=r" (ictrl):);
447 ictrl |= ICTRL_EICE | ICTRL_EDC | ICTRL_EICP;
448 asm volatile ("mtspr 1011, %0"::"r" (ictrl));
449}
450
451/*
452 * Set BAT 1 to map 0xf1000000 to end of physical memory space.
453 */
454static __inline__ void hdpu_set_bat(void)
455{
456 mb();
457 mtspr(SPRN_DBAT1U, 0xf10001fe);
458 mtspr(SPRN_DBAT1L, 0xf100002a);
459 mb();
460
461 return;
462}
463
464unsigned long __init hdpu_find_end_of_memory(void)
465{
466 return mv64x60_get_mem_size(CONFIG_MV64X60_NEW_BASE,
467 MV64x60_TYPE_MV64360);
468}
469
470static void hdpu_reset_board(void)
471{
472 volatile int infinite = 1;
473
474 hdpu_cpustate_set(CPUSTATE_KERNEL_MAJOR | CPUSTATE_KERNEL_RESET);
475
476 local_irq_disable();
477
478 /* Clear all the LEDs */
479 mv64x60_write(&bh, MV64x60_GPP_VALUE_CLR, ((1 << 4) |
480 (1 << 5) | (1 << 6)));
481
482 /* disable and invalidate the L2 cache */
483 _set_L2CR(0);
484 _set_L2CR(0x200000);
485
486 /* flush and disable L1 I/D cache */
487 __asm__ __volatile__
488 ("\n"
489 "mfspr 3,1008\n"
490 "ori 5,5,0xcc00\n"
491 "ori 4,3,0xc00\n"
492 "andc 5,3,5\n"
493 "sync\n"
494 "mtspr 1008,4\n"
495 "isync\n" "sync\n" "mtspr 1008,5\n" "isync\n" "sync\n");
496
497 /* Hit the reset bit */
498 mv64x60_write(&bh, MV64x60_GPP_VALUE_CLR, (1 << 3));
499
500 while (infinite)
501 infinite = infinite;
502
503 return;
504}
505
506static void hdpu_restart(char *cmd)
507{
508 volatile ulong i = 10000000;
509
510 hdpu_reset_board();
511
512 while (i-- > 0) ;
513 panic("restart failed\n");
514}
515
516static void hdpu_halt(void)
517{
518 local_irq_disable();
519
520 hdpu_cpustate_set(CPUSTATE_KERNEL_MAJOR | CPUSTATE_KERNEL_HALT);
521
522 /* Clear all the LEDs */
523 mv64x60_write(&bh, MV64x60_GPP_VALUE_CLR, ((1 << 4) | (1 << 5) |
524 (1 << 6)));
525 while (1) ;
526 /* NOTREACHED */
527}
528
529static void hdpu_power_off(void)
530{
531 hdpu_halt();
532 /* NOTREACHED */
533}
534
535static int hdpu_show_cpuinfo(struct seq_file *m)
536{
537 uint pvid;
538
539 pvid = mfspr(SPRN_PVR);
540 seq_printf(m, "vendor\t\t: Sky Computers\n");
541 seq_printf(m, "machine\t\t: HDPU Compute Blade\n");
542 seq_printf(m, "PVID\t\t: 0x%x, vendor: %s\n",
543 pvid, (pvid & (1 << 15) ? "IBM" : "Motorola"));
544
545 return 0;
546}
547
548static void __init hdpu_calibrate_decr(void)
549{
550 ulong freq;
551
552 if (ppcboot_bd_valid)
553 freq = ppcboot_bd.bi_busfreq / 4;
554 else
555 freq = 133000000;
556
557 printk("time_init: decrementer frequency = %lu.%.6lu MHz\n",
558 freq / 1000000, freq % 1000000);
559
560 tb_ticks_per_jiffy = freq / HZ;
561 tb_to_us = mulhwu_scale_factor(freq, 1000000);
562
563 return;
564}
565
566static void parse_bootinfo(unsigned long r3,
567 unsigned long r4, unsigned long r5,
568 unsigned long r6, unsigned long r7)
569{
570 bd_t *bd = NULL;
571 char *cmdline_start = NULL;
572 int cmdline_len = 0;
573
574 if (r3) {
575 if ((r3 & 0xf0000000) == 0)
576 r3 += KERNELBASE;
577 if ((r3 & 0xf0000000) == KERNELBASE) {
578 bd = (void *)r3;
579
580 memcpy(&ppcboot_bd, bd, sizeof(ppcboot_bd));
581 ppcboot_bd_valid = 1;
582 }
583 }
584#ifdef CONFIG_BLK_DEV_INITRD
585 if (r4 && r5 && r5 > r4) {
586 if ((r4 & 0xf0000000) == 0)
587 r4 += KERNELBASE;
588 if ((r5 & 0xf0000000) == 0)
589 r5 += KERNELBASE;
590 if ((r4 & 0xf0000000) == KERNELBASE) {
591 initrd_start = r4;
592 initrd_end = r5;
593 initrd_below_start_ok = 1;
594 }
595 }
596#endif /* CONFIG_BLK_DEV_INITRD */
597
598 if (r6 && r7 && r7 > r6) {
599 if ((r6 & 0xf0000000) == 0)
600 r6 += KERNELBASE;
601 if ((r7 & 0xf0000000) == 0)
602 r7 += KERNELBASE;
603 if ((r6 & 0xf0000000) == KERNELBASE) {
604 cmdline_start = (void *)r6;
605 cmdline_len = (r7 - r6);
606 strncpy(cmd_line, cmdline_start, cmdline_len);
607 }
608 }
609}
610
611#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
612static int hdpu_ide_check_region(ide_ioreg_t from, unsigned int extent)
613{
614 return check_region(from, extent);
615}
616
617static void
618hdpu_ide_request_region(ide_ioreg_t from, unsigned int extent, const char *name)
619{
620 request_region(from, extent, name);
621 return;
622}
623
624static void hdpu_ide_release_region(ide_ioreg_t from, unsigned int extent)
625{
626 release_region(from, extent);
627 return;
628}
629
630static void __init
631hdpu_ide_pci_init_hwif_ports(hw_regs_t * hw, ide_ioreg_t data_port,
632 ide_ioreg_t ctrl_port, int *irq)
633{
634 struct pci_dev *dev;
635
636 pci_for_each_dev(dev) {
637 if (((dev->class >> 8) == PCI_CLASS_STORAGE_IDE) ||
638 ((dev->class >> 8) == PCI_CLASS_STORAGE_RAID)) {
639 hw->irq = dev->irq;
640
641 if (irq != NULL) {
642 *irq = dev->irq;
643 }
644 }
645 }
646
647 return;
648}
649#endif
650
651void hdpu_heartbeat(void)
652{
653 if (mv64x60_read(&bh, MV64x60_GPP_VALUE) & (1 << 5))
654 mv64x60_write(&bh, MV64x60_GPP_VALUE_CLR, (1 << 5));
655 else
656 mv64x60_write(&bh, MV64x60_GPP_VALUE_SET, (1 << 5));
657
658 ppc_md.heartbeat_count = ppc_md.heartbeat_reset;
659
660}
661
662static void __init hdpu_map_io(void)
663{
664 io_block_mapping(0xf1000000, 0xf1000000, 0x20000, _PAGE_IO);
665}
666
667#ifdef CONFIG_SMP
668char hdpu_smp0[] = "SMP Cpu #0";
669char hdpu_smp1[] = "SMP Cpu #1";
670
671static irqreturn_t hdpu_smp_cpu0_int_handler(int irq, void *dev_id,
672 struct pt_regs *regs)
673{
674 volatile unsigned int doorbell;
675
676 doorbell = mv64x60_read(&bh, MV64360_CPU0_DOORBELL);
677
678 /* Ack the doorbell interrupts */
679 mv64x60_write(&bh, MV64360_CPU0_DOORBELL_CLR, doorbell);
680
681 if (doorbell & 1) {
682 smp_message_recv(0, regs);
683 }
684 if (doorbell & 2) {
685 smp_message_recv(1, regs);
686 }
687 if (doorbell & 4) {
688 smp_message_recv(2, regs);
689 }
690 if (doorbell & 8) {
691 smp_message_recv(3, regs);
692 }
693 return IRQ_HANDLED;
694}
695
696static irqreturn_t hdpu_smp_cpu1_int_handler(int irq, void *dev_id,
697 struct pt_regs *regs)
698{
699 volatile unsigned int doorbell;
700
701 doorbell = mv64x60_read(&bh, MV64360_CPU1_DOORBELL);
702
703 /* Ack the doorbell interrupts */
704 mv64x60_write(&bh, MV64360_CPU1_DOORBELL_CLR, doorbell);
705
706 if (doorbell & 1) {
707 smp_message_recv(0, regs);
708 }
709 if (doorbell & 2) {
710 smp_message_recv(1, regs);
711 }
712 if (doorbell & 4) {
713 smp_message_recv(2, regs);
714 }
715 if (doorbell & 8) {
716 smp_message_recv(3, regs);
717 }
718 return IRQ_HANDLED;
719}
720
721static void smp_hdpu_CPU_two(void)
722{
723 __asm__ __volatile__
724 ("\n"
725 "lis 3,0x0000\n"
726 "ori 3,3,0x00c0\n"
727 "mtspr 26, 3\n" "li 4,0\n" "mtspr 27,4\n" "rfi");
728
729}
730
731static int smp_hdpu_probe(void)
732{
733 int *cpu_count_reg;
734 int num_cpus = 0;
735
736 cpu_count_reg = ioremap(HDPU_NEXUS_ID_BASE, HDPU_NEXUS_ID_SIZE);
737 if (cpu_count_reg) {
738 num_cpus = (*cpu_count_reg >> 20) & 0x3;
739 iounmap(cpu_count_reg);
740 }
741
742 /* Validate the bits in the CPLD. If we could not map the reg, return 2.
743 * If the register reported 0 or 3, return 2.
744 * Older CPLD revisions set these bits to all ones (val = 3).
745 */
746 if ((num_cpus < 1) || (num_cpus > 2)) {
747 printk
748 ("Unable to determine the number of processors %d . deafulting to 2.\n",
749 num_cpus);
750 num_cpus = 2;
751 }
752 return num_cpus;
753}
754
755static void
756smp_hdpu_message_pass(int target, int msg, unsigned long data, int wait)
757{
758 if (msg > 0x3) {
759 printk("SMP %d: smp_message_pass: unknown msg %d\n",
760 smp_processor_id(), msg);
761 return;
762 }
763 switch (target) {
764 case MSG_ALL:
765 mv64x60_write(&bh, MV64360_CPU0_DOORBELL, 1 << msg);
766 mv64x60_write(&bh, MV64360_CPU1_DOORBELL, 1 << msg);
767 break;
768 case MSG_ALL_BUT_SELF:
769 if (smp_processor_id())
770 mv64x60_write(&bh, MV64360_CPU0_DOORBELL, 1 << msg);
771 else
772 mv64x60_write(&bh, MV64360_CPU1_DOORBELL, 1 << msg);
773 break;
774 default:
775 if (target == 0)
776 mv64x60_write(&bh, MV64360_CPU0_DOORBELL, 1 << msg);
777 else
778 mv64x60_write(&bh, MV64360_CPU1_DOORBELL, 1 << msg);
779 break;
780 }
781}
782
783static void smp_hdpu_kick_cpu(int nr)
784{
785 volatile unsigned int *bootaddr;
786
787 if (ppc_md.progress)
788 ppc_md.progress("smp_hdpu_kick_cpu", 0);
789
790 hdpu_cpustate_set(CPUSTATE_KERNEL_MAJOR | CPUSTATE_KERNEL_CPU1_KICK);
791
792 /* Disable BootCS. Must also reduce the windows size to zero. */
793 bh.ci->disable_window_32bit(&bh, MV64x60_CPU2BOOT_WIN);
794 mv64x60_set_32bit_window(&bh, MV64x60_CPU2BOOT_WIN, 0, 0, 0);
795
796 bootaddr = ioremap(HDPU_INTERNAL_SRAM_BASE, HDPU_INTERNAL_SRAM_SIZE);
797 if (!bootaddr) {
798 if (ppc_md.progress)
799 ppc_md.progress("smp_hdpu_kick_cpu: ioremap failed", 0);
800 return;
801 }
802
803 memcpy((void *)(bootaddr + 0x40), (void *)&smp_hdpu_CPU_two, 0x20);
804
805 /* map SRAM to 0xfff00000 */
806 bh.ci->disable_window_32bit(&bh, MV64x60_CPU2SRAM_WIN);
807
808 mv64x60_set_32bit_window(&bh, MV64x60_CPU2SRAM_WIN,
809 0xfff00000, HDPU_INTERNAL_SRAM_SIZE, 0);
810 bh.ci->enable_window_32bit(&bh, MV64x60_CPU2SRAM_WIN);
811
812 /* Enable CPU1 arbitration */
813 mv64x60_clr_bits(&bh, MV64x60_CPU_MASTER_CNTL, (1 << 9));
814
815 /*
816 * Wait 100mSecond until other CPU has reached __secondary_start.
817 * When it reaches, it is permittable to rever the SRAM mapping etc...
818 */
819 mdelay(100);
820 *(unsigned long *)KERNELBASE = nr;
821 asm volatile ("dcbf 0,%0"::"r" (KERNELBASE):"memory");
822
823 iounmap(bootaddr);
824
825 /* Set up window for internal sram (256KByte insize) */
826 bh.ci->disable_window_32bit(&bh, MV64x60_CPU2SRAM_WIN);
827 mv64x60_set_32bit_window(&bh, MV64x60_CPU2SRAM_WIN,
828 HDPU_INTERNAL_SRAM_BASE,
829 HDPU_INTERNAL_SRAM_SIZE, 0);
830 bh.ci->enable_window_32bit(&bh, MV64x60_CPU2SRAM_WIN);
831 /*
832 * Set up windows for embedded FLASH (using boot CS window).
833 */
834
835 bh.ci->disable_window_32bit(&bh, MV64x60_CPU2BOOT_WIN);
836 mv64x60_set_32bit_window(&bh, MV64x60_CPU2BOOT_WIN,
837 HDPU_EMB_FLASH_BASE, HDPU_EMB_FLASH_SIZE, 0);
838 bh.ci->enable_window_32bit(&bh, MV64x60_CPU2BOOT_WIN);
839}
840
841static void smp_hdpu_setup_cpu(int cpu_nr)
842{
843 if (cpu_nr == 0) {
844 if (ppc_md.progress)
845 ppc_md.progress("smp_hdpu_setup_cpu 0", 0);
846 mv64x60_write(&bh, MV64360_CPU0_DOORBELL_CLR, 0xff);
847 mv64x60_write(&bh, MV64360_CPU0_DOORBELL_MASK, 0xff);
848 request_irq(60, hdpu_smp_cpu0_int_handler,
849 SA_INTERRUPT, hdpu_smp0, 0);
850 }
851
852 if (cpu_nr == 1) {
853 if (ppc_md.progress)
854 ppc_md.progress("smp_hdpu_setup_cpu 1", 0);
855
856 hdpu_cpustate_set(CPUSTATE_KERNEL_MAJOR |
857 CPUSTATE_KERNEL_CPU1_OK);
858
859 /* Enable L1 Parity Bits */
860 hdpu_set_l1pe();
861
862 /* Enable L2 cache */
863 _set_L2CR(0);
864 _set_L2CR(0x80080000);
865
866 mv64x60_write(&bh, MV64360_CPU1_DOORBELL_CLR, 0x0);
867 mv64x60_write(&bh, MV64360_CPU1_DOORBELL_MASK, 0xff);
868 request_irq(28, hdpu_smp_cpu1_int_handler,
869 SA_INTERRUPT, hdpu_smp1, 0);
870 }
871
872}
873
874void __devinit hdpu_tben_give()
875{
876 volatile unsigned long *val = 0;
877
878 /* By writing 0 to the TBEN_BASE, the timebases is frozen */
879 val = ioremap(HDPU_TBEN_BASE, 4);
880 *val = 0;
881 mb();
882
883 spin_lock(&timebase_lock);
884 timebase_upper = get_tbu();
885 timebase_lower = get_tbl();
886 spin_unlock(&timebase_lock);
887
888 while (timebase_upper || timebase_lower)
889 barrier();
890
891 /* By writing 1 to the TBEN_BASE, the timebases is thawed */
892 *val = 1;
893 mb();
894
895 iounmap(val);
896
897}
898
899void __devinit hdpu_tben_take()
900{
901 while (!(timebase_upper || timebase_lower))
902 barrier();
903
904 spin_lock(&timebase_lock);
905 set_tb(timebase_upper, timebase_lower);
906 timebase_upper = 0;
907 timebase_lower = 0;
908 spin_unlock(&timebase_lock);
909}
910
911static struct smp_ops_t hdpu_smp_ops = {
912 .message_pass = smp_hdpu_message_pass,
913 .probe = smp_hdpu_probe,
914 .kick_cpu = smp_hdpu_kick_cpu,
915 .setup_cpu = smp_hdpu_setup_cpu,
916 .give_timebase = hdpu_tben_give,
917 .take_timebase = hdpu_tben_take,
918};
919#endif /* CONFIG_SMP */
920
921void __init
922platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
923 unsigned long r6, unsigned long r7)
924{
925 parse_bootinfo(r3, r4, r5, r6, r7);
926
927 isa_mem_base = 0;
928
929 ppc_md.setup_arch = hdpu_setup_arch;
930 ppc_md.init = hdpu_init2;
931 ppc_md.show_cpuinfo = hdpu_show_cpuinfo;
932 ppc_md.init_IRQ = hdpu_init_irq;
933 ppc_md.get_irq = mv64360_get_irq;
934 ppc_md.restart = hdpu_restart;
935 ppc_md.power_off = hdpu_power_off;
936 ppc_md.halt = hdpu_halt;
937 ppc_md.find_end_of_memory = hdpu_find_end_of_memory;
938 ppc_md.calibrate_decr = hdpu_calibrate_decr;
939 ppc_md.setup_io_mappings = hdpu_map_io;
940
941 bh.p_base = CONFIG_MV64X60_NEW_BASE;
942 bh.v_base = (unsigned long *)bh.p_base;
943
944 hdpu_set_bat();
945
946#if defined(CONFIG_SERIAL_TEXT_DEBUG)
947 ppc_md.progress = hdpu_mpsc_progress; /* embedded UART */
948 mv64x60_progress_init(bh.p_base);
949#endif /* CONFIG_SERIAL_TEXT_DEBUG */
950
951#ifdef CONFIG_SMP
952 ppc_md.smp_ops = &hdpu_smp_ops;
953#endif /* CONFIG_SMP */
954
955#if defined(CONFIG_SERIAL_MPSC) || defined(CONFIG_MV643XX_ETH)
956 platform_notify = hdpu_platform_notify;
957#endif
958 return;
959}
960
961#if defined(CONFIG_SERIAL_TEXT_DEBUG) && defined(CONFIG_SERIAL_MPSC_CONSOLE)
962/* SMP safe version of the serial text debug routine. Uses Semaphore 0 */
963void hdpu_mpsc_progress(char *s, unsigned short hex)
964{
965 while (mv64x60_read(&bh, MV64360_WHO_AM_I) !=
966 mv64x60_read(&bh, MV64360_SEMAPHORE_0)) {
967 }
968 mv64x60_mpsc_progress(s, hex);
969 mv64x60_write(&bh, MV64360_SEMAPHORE_0, 0xff);
970}
971#endif
972
973static void hdpu_cpustate_set(unsigned char new_state)
974{
975 unsigned int state = (new_state << 21);
976 mv64x60_write(&bh, MV64x60_GPP_VALUE_CLR, (0xff << 21));
977 mv64x60_write(&bh, MV64x60_GPP_VALUE_CLR, state);
978}
979
980#ifdef CONFIG_MTD_PHYSMAP
981static struct mtd_partition hdpu_partitions[] = {
982 {
983 .name = "Root FS",
984 .size = 0x03400000,
985 .offset = 0,
986 .mask_flags = 0,
987 },{
988 .name = "User FS",
989 .size = 0x00800000,
990 .offset = 0x03400000,
991 .mask_flags = 0,
992 },{
993 .name = "Kernel Image",
994 .size = 0x002C0000,
995 .offset = 0x03C00000,
996 .mask_flags = 0,
997 },{
998 .name = "bootEnv",
999 .size = 0x00040000,
1000 .offset = 0x03EC0000,
1001 .mask_flags = 0,
1002 },{
1003 .name = "bootROM",
1004 .size = 0x00100000,
1005 .offset = 0x03F00000,
1006 .mask_flags = 0,
1007 }
1008};
1009
1010static int __init hdpu_setup_mtd(void)
1011{
1012
1013 physmap_set_partitions(hdpu_partitions, 5);
1014 return 0;
1015}
1016
1017arch_initcall(hdpu_setup_mtd);
1018#endif
1019
1020#ifdef CONFIG_HDPU_FEATURES
1021
1022static struct resource hdpu_cpustate_resources[] = {
1023 [0] = {
1024 .name = "addr base",
1025 .start = MV64x60_GPP_VALUE_SET,
1026 .end = MV64x60_GPP_VALUE_CLR + 1,
1027 .flags = IORESOURCE_MEM,
1028 },
1029};
1030
1031static struct resource hdpu_nexus_resources[] = {
1032 [0] = {
1033 .name = "nexus register",
1034 .start = HDPU_NEXUS_ID_BASE,
1035 .end = HDPU_NEXUS_ID_BASE + HDPU_NEXUS_ID_SIZE,
1036 .flags = IORESOURCE_MEM,
1037 },
1038};
1039
1040static struct platform_device hdpu_cpustate_device = {
1041 .name = HDPU_CPUSTATE_NAME,
1042 .id = 0,
1043 .num_resources = ARRAY_SIZE(hdpu_cpustate_resources),
1044 .resource = hdpu_cpustate_resources,
1045};
1046
1047static struct platform_device hdpu_nexus_device = {
1048 .name = HDPU_NEXUS_NAME,
1049 .id = 0,
1050 .num_resources = ARRAY_SIZE(hdpu_nexus_resources),
1051 .resource = hdpu_nexus_resources,
1052};
1053
1054static int __init hdpu_add_pds(void)
1055{
1056 platform_device_register(&hdpu_cpustate_device);
1057 platform_device_register(&hdpu_nexus_device);
1058 return 0;
1059}
1060
1061arch_initcall(hdpu_add_pds);
1062#endif
diff --git a/arch/ppc/platforms/hdpu.h b/arch/ppc/platforms/hdpu.h
new file mode 100644
index 000000000000..07c3cffb5c7b
--- /dev/null
+++ b/arch/ppc/platforms/hdpu.h
@@ -0,0 +1,82 @@
1/*
2 * arch/ppc/platforms/hdpu.h
3 *
4 * Definitions for Sky Computers HDPU board.
5 *
6 * Brian Waite <waite@skycomputers.com>
7 *
8 * Based on code done by Rabeeh Khoury - rabeeh@galileo.co.il
9 * Based on code done by Mark A. Greer <mgreer@mvista.com>
10 * Based on code done by Tim Montgomery <timm@artesyncp.com>
11 *
12 *
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the
15 * Free Software Foundation; either version 2 of the License, or (at your
16 * option) any later version.
17 */
18
19/*
20 * The MV64360 has 2 PCI buses each with 1 window from the CPU bus to
21 * PCI I/O space and 4 windows from the CPU bus to PCI MEM space.
22 * We'll only use one PCI MEM window on each PCI bus.
23 *
24 * This is the CPU physical memory map (windows must be at least 64K and start
25 * on a boundary that is a multiple of the window size):
26 *
27 * 0x80000000-0x8fffffff - PCI 0 MEM
28 * 0xa0000000-0xafffffff - PCI 1 MEM
29 * 0xc0000000-0xc0ffffff - PCI 0 I/O
30 * 0xc1000000-0xc1ffffff - PCI 1 I/O
31
32 * 0xf1000000-0xf100ffff - MV64360 Registers
33 * 0xf1010000-0xfb9fffff - HOLE
34 * 0xfbfa0000-0xfbfaffff - TBEN
35 * 0xfbf00000-0xfbfbffff - NEXUS
36 * 0xfbfc0000-0xfbffffff - Internal SRAM
37 * 0xfc000000-0xffffffff - Boot window
38 */
39
40#ifndef __PPC_PLATFORMS_HDPU_H
41#define __PPC_PLATFORMS_HDPU_H
42
43/* CPU Physical Memory Map setup. */
44#define HDPU_BRIDGE_REG_BASE 0xf1000000
45
46#define HDPU_TBEN_BASE 0xfbfa0000
47#define HDPU_TBEN_SIZE 0x00010000
48#define HDPU_NEXUS_ID_BASE 0xfbfb0000
49#define HDPU_NEXUS_ID_SIZE 0x00010000
50#define HDPU_INTERNAL_SRAM_BASE 0xfbfc0000
51#define HDPU_INTERNAL_SRAM_SIZE 0x00040000
52#define HDPU_EMB_FLASH_BASE 0xfc000000
53#define HDPU_EMB_FLASH_SIZE 0x04000000
54
55/* PCI Mappings */
56
57#define HDPU_PCI0_MEM_START_PROC_ADDR 0x80000000
58#define HDPU_PCI0_MEM_START_PCI_HI_ADDR 0x00000000
59#define HDPU_PCI0_MEM_START_PCI_LO_ADDR HDPU_PCI0_MEM_START_PROC_ADDR
60#define HDPU_PCI0_MEM_SIZE 0x10000000
61
62#define HDPU_PCI1_MEM_START_PROC_ADDR 0xc0000000
63#define HDPU_PCI1_MEM_START_PCI_HI_ADDR 0x00000000
64#define HDPU_PCI1_MEM_START_PCI_LO_ADDR HDPU_PCI1_MEM_START_PROC_ADDR
65#define HDPU_PCI1_MEM_SIZE 0x20000000
66
67#define HDPU_PCI0_IO_START_PROC_ADDR 0xc0000000
68#define HDPU_PCI0_IO_START_PCI_ADDR 0x00000000
69#define HDPU_PCI0_IO_SIZE 0x01000000
70
71#define HDPU_PCI1_IO_START_PROC_ADDR 0xc1000000
72#define HDPU_PCI1_IO_START_PCI_ADDR 0x01000000
73#define HDPU_PCI1_IO_SIZE 0x01000000
74
75#define HDPU_DEFAULT_BAUD 115200
76#define HDPU_MPSC_CLK_SRC 8 /* TCLK */
77#define HDPU_MPSC_CLK_FREQ 133000000 /* 133 Mhz */
78
79#define HDPU_PCI_0_IRQ (8+64)
80#define HDPU_PCI_1_IRQ (13+64)
81
82#endif /* __PPC_PLATFORMS_HDPU_H */
diff --git a/arch/ppc/platforms/hermes.h b/arch/ppc/platforms/hermes.h
new file mode 100644
index 000000000000..198fc590b9f5
--- /dev/null
+++ b/arch/ppc/platforms/hermes.h
@@ -0,0 +1,27 @@
1/*
2 * Multidata HERMES-PRO ( / SL ) board specific definitions
3 *
4 * Copyright (c) 2000, 2001 Wolfgang Denk (wd@denx.de)
5 */
6
7#ifndef __MACH_HERMES_H
8#define __MACH_HERMES_H
9
10#include <linux/config.h>
11
12#include <asm/ppcboot.h>
13
14#define HERMES_IMMR_BASE 0xFF000000 /* phys. addr of IMMR */
15#define HERMES_IMAP_SIZE (64 * 1024) /* size of mapped area */
16
17#define IMAP_ADDR HERMES_IMMR_BASE /* physical base address of IMMR area */
18#define IMAP_SIZE HERMES_IMAP_SIZE /* mapped size of IMMR area */
19
20#define FEC_INTERRUPT 9 /* = SIU_LEVEL4 */
21#define CPM_INTERRUPT 11 /* = SIU_LEVEL5 (was: SIU_LEVEL2) */
22
23/* We don't use the 8259.
24*/
25#define NR_8259_INTS 0
26
27#endif /* __MACH_HERMES_H */
diff --git a/arch/ppc/platforms/ip860.h b/arch/ppc/platforms/ip860.h
new file mode 100644
index 000000000000..8c3836c5f054
--- /dev/null
+++ b/arch/ppc/platforms/ip860.h
@@ -0,0 +1,36 @@
1/*
2 * MicroSys IP860 VMEBus board specific definitions
3 *
4 * Copyright (c) 2000, 2001 Wolfgang Denk (wd@denx.de)
5 */
6
7#ifndef __MACH_IP860_H
8#define __MACH_IP860_H
9
10#include <linux/config.h>
11
12#include <asm/ppcboot.h>
13
14#define IP860_IMMR_BASE 0xF1000000 /* phys. addr of IMMR */
15#define IP860_IMAP_SIZE (64 * 1024) /* size of mapped area */
16
17#define IMAP_ADDR IP860_IMMR_BASE /* physical base address of IMMR area */
18#define IMAP_SIZE IP860_IMAP_SIZE /* mapped size of IMMR area */
19
20/*
21 * MPC8xx Chip Select Usage
22 */
23#define IP860_BOOT_CS 0 /* Boot (VMEBus or Flash) Chip Select 0 */
24#define IP860_FLASH_CS 1 /* Flash is on Chip Select 1 */
25#define IP860_SDRAM_CS 2 /* SDRAM is on Chip Select 2 */
26#define IP860_SRAM_CS 3 /* SRAM is on Chip Select 3 */
27#define IP860_BCSR_CS 4 /* BCSR is on Chip Select 4 */
28#define IP860_IP_CS 5 /* IP Slots are on Chip Select 5 */
29#define IP860_VME_STD_CS 6 /* VME Standard I/O is on Chip Select 6 */
30#define IP860_VME_SHORT_CS 7 /* VME Short I/O is on Chip Select 7 */
31
32/* We don't use the 8259.
33*/
34#define NR_8259_INTS 0
35
36#endif /* __MACH_IP860_H */
diff --git a/arch/ppc/platforms/ivms8.h b/arch/ppc/platforms/ivms8.h
new file mode 100644
index 000000000000..d4be310f8084
--- /dev/null
+++ b/arch/ppc/platforms/ivms8.h
@@ -0,0 +1,56 @@
1/*
2 * Speech Design Integrated Voicemail board specific definitions
3 * - IVMS8 (small, 8 channels)
4 * - IVML24 (large, 24 channels)
5 *
6 * In 2.5 when we force a new bootloader, we can merge these two, and add
7 * in _MACH_'s for them. -- Tom
8 *
9 * Copyright (c) 2000, 2001 Wolfgang Denk (wd@denx.de)
10 */
11
12#ifdef __KERNEL__
13#ifndef __ASM_IVMS8_H__
14#define __ASM_IVMS8_H__
15
16#include <linux/config.h>
17
18#include <asm/ppcboot.h>
19
20#define IVMS_IMMR_BASE 0xFFF00000 /* phys. addr of IMMR */
21#define IVMS_IMAP_SIZE (64 * 1024) /* size of mapped area */
22
23#define IMAP_ADDR IVMS_IMMR_BASE /* phys. base address of IMMR area */
24#define IMAP_SIZE IVMS_IMAP_SIZE /* mapped size of IMMR area */
25
26#define PCMCIA_MEM_ADDR ((uint)0xFE100000)
27#define PCMCIA_MEM_SIZE ((uint)(64 * 1024))
28
29#define FEC_INTERRUPT 9 /* = SIU_LEVEL4 */
30#define IDE0_INTERRUPT 10 /* = IRQ5 */
31#define CPM_INTERRUPT 11 /* = SIU_LEVEL5 (was: SIU_LEVEL2) */
32#define PHY_INTERRUPT 12 /* = IRQ6 */
33
34/* override the default number of IDE hardware interfaces */
35#define MAX_HWIFS 1
36
37/*
38 * Definitions for IDE0 Interface
39 */
40#define IDE0_BASE_OFFSET 0x0000 /* Offset in PCMCIA memory */
41#define IDE0_DATA_REG_OFFSET 0x0000
42#define IDE0_ERROR_REG_OFFSET 0x0081
43#define IDE0_NSECTOR_REG_OFFSET 0x0082
44#define IDE0_SECTOR_REG_OFFSET 0x0083
45#define IDE0_LCYL_REG_OFFSET 0x0084
46#define IDE0_HCYL_REG_OFFSET 0x0085
47#define IDE0_SELECT_REG_OFFSET 0x0086
48#define IDE0_STATUS_REG_OFFSET 0x0087
49#define IDE0_CONTROL_REG_OFFSET 0x0106
50#define IDE0_IRQ_REG_OFFSET 0x000A /* not used */
51
52/* We don't use the 8259. */
53#define NR_8259_INTS 0
54
55#endif /* __ASM_IVMS8_H__ */
56#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/k2.c b/arch/ppc/platforms/k2.c
new file mode 100644
index 000000000000..aacb438708ff
--- /dev/null
+++ b/arch/ppc/platforms/k2.c
@@ -0,0 +1,613 @@
1/*
2 * arch/ppc/platforms/k2.c
3 *
4 * Board setup routines for SBS K2
5 *
6 * Author: Matt Porter <mporter@mvista.com>
7 *
8 * Updated by: Randy Vinson <rvinson@mvista.com.
9 *
10 * 2001-2004 (c) MontaVista, Software, Inc. This file is licensed under
11 * the terms of the GNU General Public License version 2. This program
12 * is licensed "as is" without any warranty of any kind, whether express
13 * or implied.
14 */
15
16#include <linux/config.h>
17#include <linux/stddef.h>
18#include <linux/kernel.h>
19#include <linux/init.h>
20#include <linux/errno.h>
21#include <linux/reboot.h>
22#include <linux/pci.h>
23#include <linux/kdev_t.h>
24#include <linux/types.h>
25#include <linux/major.h>
26#include <linux/initrd.h>
27#include <linux/console.h>
28#include <linux/delay.h>
29#include <linux/ide.h>
30#include <linux/irq.h>
31#include <linux/seq_file.h>
32#include <linux/root_dev.h>
33
34#include <asm/system.h>
35#include <asm/pgtable.h>
36#include <asm/page.h>
37#include <asm/dma.h>
38#include <asm/io.h>
39#include <asm/machdep.h>
40#include <asm/time.h>
41#include <asm/i8259.h>
42#include <asm/todc.h>
43#include <asm/bootinfo.h>
44
45#include <syslib/cpc710.h>
46#include "k2.h"
47
48extern unsigned long loops_per_jiffy;
49extern void gen550_progress(char *, unsigned short);
50
51static unsigned int cpu_7xx[16] = {
52 0, 15, 14, 0, 0, 13, 5, 9, 6, 11, 8, 10, 16, 12, 7, 0
53};
54static unsigned int cpu_6xx[16] = {
55 0, 0, 14, 0, 0, 13, 5, 9, 6, 11, 8, 10, 0, 12, 7, 0
56};
57
58static inline int __init
59k2_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
60{
61 struct pci_controller *hose = pci_bus_to_hose(dev->bus->number);
62 /*
63 * Check our hose index. If we are zero then we are on the
64 * local PCI hose, otherwise we are on the cPCI hose.
65 */
66 if (!hose->index) {
67 static char pci_irq_table[][4] =
68 /*
69 * PCI IDSEL/INTPIN->INTLINE
70 * A B C D
71 */
72 {
73 {1, 0, 0, 0}, /* Ethernet */
74 {5, 5, 5, 5}, /* PMC Site 1 */
75 {6, 6, 6, 6}, /* PMC Site 2 */
76 {0, 0, 0, 0}, /* unused */
77 {0, 0, 0, 0}, /* unused */
78 {0, 0, 0, 0}, /* PCI-ISA Bridge */
79 {0, 0, 0, 0}, /* unused */
80 {0, 0, 0, 0}, /* unused */
81 {0, 0, 0, 0}, /* unused */
82 {0, 0, 0, 0}, /* unused */
83 {0, 0, 0, 0}, /* unused */
84 {0, 0, 0, 0}, /* unused */
85 {0, 0, 0, 0}, /* unused */
86 {0, 0, 0, 0}, /* unused */
87 {15, 0, 0, 0}, /* M5229 IDE */
88 };
89 const long min_idsel = 3, max_idsel = 17, irqs_per_slot = 4;
90 return PCI_IRQ_TABLE_LOOKUP;
91 } else {
92 static char pci_irq_table[][4] =
93 /*
94 * PCI IDSEL/INTPIN->INTLINE
95 * A B C D
96 */
97 {
98 {10, 11, 12, 9}, /* cPCI slot 8 */
99 {11, 12, 9, 10}, /* cPCI slot 7 */
100 {12, 9, 10, 11}, /* cPCI slot 6 */
101 {9, 10, 11, 12}, /* cPCI slot 5 */
102 {10, 11, 12, 9}, /* cPCI slot 4 */
103 {11, 12, 9, 10}, /* cPCI slot 3 */
104 {12, 9, 10, 11}, /* cPCI slot 2 */
105 };
106 const long min_idsel = 15, max_idsel = 21, irqs_per_slot = 4;
107 return PCI_IRQ_TABLE_LOOKUP;
108 }
109}
110
111void k2_pcibios_fixup(void)
112{
113#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
114 struct pci_dev *ide_dev;
115
116 /*
117 * Enable DMA support on hdc
118 */
119 ide_dev = pci_get_device(PCI_VENDOR_ID_AL,
120 PCI_DEVICE_ID_AL_M5229, NULL);
121
122 if (ide_dev) {
123
124 unsigned long ide_dma_base;
125
126 ide_dma_base = pci_resource_start(ide_dev, 4);
127 outb(0x00, ide_dma_base + 0x2);
128 outb(0x20, ide_dma_base + 0xa);
129 pci_dev_put(ide_dev);
130 }
131#endif
132}
133
134void k2_pcibios_fixup_resources(struct pci_dev *dev)
135{
136 int i;
137
138 if ((dev->vendor == PCI_VENDOR_ID_IBM) &&
139 (dev->device == PCI_DEVICE_ID_IBM_CPC710_PCI64)) {
140 pr_debug("Fixup CPC710 resources\n");
141 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
142 dev->resource[i].start = 0;
143 dev->resource[i].end = 0;
144 }
145 }
146}
147
148void k2_setup_hoses(void)
149{
150 struct pci_controller *hose_a, *hose_b;
151
152 /*
153 * Reconfigure CPC710 memory map so
154 * we have some more PCI memory space.
155 */
156
157 /* Set FPHB mode */
158 __raw_writel(0x808000e0, PGCHP); /* Set FPHB mode */
159
160 /* PCI32 mappings */
161 __raw_writel(0x00000000, K2_PCI32_BAR + PIBAR); /* PCI I/O base */
162 __raw_writel(0x00000000, K2_PCI32_BAR + PMBAR); /* PCI Mem base */
163 __raw_writel(0xf0000000, K2_PCI32_BAR + MSIZE); /* 256MB */
164 __raw_writel(0xfff00000, K2_PCI32_BAR + IOSIZE); /* 1MB */
165 __raw_writel(0xc0000000, K2_PCI32_BAR + SMBAR); /* Base@0xc0000000 */
166 __raw_writel(0x80000000, K2_PCI32_BAR + SIBAR); /* Base@0x80000000 */
167 __raw_writel(0x000000c0, K2_PCI32_BAR + PSSIZE); /* 1GB space */
168 __raw_writel(0x000000c0, K2_PCI32_BAR + PPSIZE); /* 1GB space */
169 __raw_writel(0x00000000, K2_PCI32_BAR + BARPS); /* Base@0x00000000 */
170 __raw_writel(0x00000000, K2_PCI32_BAR + BARPP); /* Base@0x00000000 */
171 __raw_writel(0x00000080, K2_PCI32_BAR + PSBAR); /* Base@0x80 */
172 __raw_writel(0x00000000, K2_PCI32_BAR + PPBAR);
173
174 __raw_writel(0xc0000000, K2_PCI32_BAR + BPMDLK);
175 __raw_writel(0xd0000000, K2_PCI32_BAR + TPMDLK);
176 __raw_writel(0x80000000, K2_PCI32_BAR + BIODLK);
177 __raw_writel(0x80100000, K2_PCI32_BAR + TIODLK);
178 __raw_writel(0xe0008000, K2_PCI32_BAR + DLKCTRL);
179 __raw_writel(0xffffffff, K2_PCI32_BAR + DLKDEV);
180
181 /* PCI64 mappings */
182 __raw_writel(0x00100000, K2_PCI64_BAR + PIBAR); /* PCI I/O base */
183 __raw_writel(0x10000000, K2_PCI64_BAR + PMBAR); /* PCI Mem base */
184 __raw_writel(0xf0000000, K2_PCI64_BAR + MSIZE); /* 256MB */
185 __raw_writel(0xfff00000, K2_PCI64_BAR + IOSIZE); /* 1MB */
186 __raw_writel(0xd0000000, K2_PCI64_BAR + SMBAR); /* Base@0xd0000000 */
187 __raw_writel(0x80100000, K2_PCI64_BAR + SIBAR); /* Base@0x80100000 */
188 __raw_writel(0x000000c0, K2_PCI64_BAR + PSSIZE); /* 1GB space */
189 __raw_writel(0x000000c0, K2_PCI64_BAR + PPSIZE); /* 1GB space */
190 __raw_writel(0x00000000, K2_PCI64_BAR + BARPS); /* Base@0x00000000 */
191 __raw_writel(0x00000000, K2_PCI64_BAR + BARPP); /* Base@0x00000000 */
192
193 /* Setup PCI32 hose */
194 hose_a = pcibios_alloc_controller();
195 if (!hose_a)
196 return;
197
198 hose_a->first_busno = 0;
199 hose_a->last_busno = 0xff;
200 hose_a->pci_mem_offset = K2_PCI32_MEM_BASE;
201
202 pci_init_resource(&hose_a->io_resource,
203 K2_PCI32_LOWER_IO,
204 K2_PCI32_UPPER_IO,
205 IORESOURCE_IO, "PCI32 host bridge");
206
207 pci_init_resource(&hose_a->mem_resources[0],
208 K2_PCI32_LOWER_MEM + K2_PCI32_MEM_BASE,
209 K2_PCI32_UPPER_MEM + K2_PCI32_MEM_BASE,
210 IORESOURCE_MEM, "PCI32 host bridge");
211
212 hose_a->io_space.start = K2_PCI32_LOWER_IO;
213 hose_a->io_space.end = K2_PCI32_UPPER_IO;
214 hose_a->mem_space.start = K2_PCI32_LOWER_MEM;
215 hose_a->mem_space.end = K2_PCI32_UPPER_MEM;
216 hose_a->io_base_virt = (void *)K2_ISA_IO_BASE;
217
218 setup_indirect_pci(hose_a, K2_PCI32_CONFIG_ADDR, K2_PCI32_CONFIG_DATA);
219
220 /* Initialize PCI32 bus registers */
221 early_write_config_byte(hose_a,
222 hose_a->first_busno,
223 PCI_DEVFN(0, 0),
224 CPC710_BUS_NUMBER, hose_a->first_busno);
225
226 early_write_config_byte(hose_a,
227 hose_a->first_busno,
228 PCI_DEVFN(0, 0),
229 CPC710_SUB_BUS_NUMBER, hose_a->last_busno);
230
231 /* Enable PCI interrupt polling */
232 early_write_config_byte(hose_a,
233 hose_a->first_busno,
234 PCI_DEVFN(8, 0), 0x45, 0x80);
235
236 /* Route polled PCI interrupts */
237 early_write_config_byte(hose_a,
238 hose_a->first_busno,
239 PCI_DEVFN(8, 0), 0x48, 0x58);
240
241 early_write_config_byte(hose_a,
242 hose_a->first_busno,
243 PCI_DEVFN(8, 0), 0x49, 0x07);
244
245 early_write_config_byte(hose_a,
246 hose_a->first_busno,
247 PCI_DEVFN(8, 0), 0x4a, 0x31);
248
249 early_write_config_byte(hose_a,
250 hose_a->first_busno,
251 PCI_DEVFN(8, 0), 0x4b, 0xb9);
252
253 /* route secondary IDE channel interrupt to IRQ 15 */
254 early_write_config_byte(hose_a,
255 hose_a->first_busno,
256 PCI_DEVFN(8, 0), 0x75, 0x0f);
257
258 /* enable IDE controller IDSEL */
259 early_write_config_byte(hose_a,
260 hose_a->first_busno,
261 PCI_DEVFN(8, 0), 0x58, 0x48);
262
263 /* Enable IDE function */
264 early_write_config_byte(hose_a,
265 hose_a->first_busno,
266 PCI_DEVFN(17, 0), 0x50, 0x03);
267
268 /* Set M5229 IDE controller to native mode */
269 early_write_config_byte(hose_a,
270 hose_a->first_busno,
271 PCI_DEVFN(17, 0), PCI_CLASS_PROG, 0xdf);
272
273 hose_a->last_busno = pciauto_bus_scan(hose_a, hose_a->first_busno);
274
275 /* Write out correct max subordinate bus number for hose A */
276 early_write_config_byte(hose_a,
277 hose_a->first_busno,
278 PCI_DEVFN(0, 0),
279 CPC710_SUB_BUS_NUMBER, hose_a->last_busno);
280
281 /* Only setup PCI64 hose if we are in the system slot */
282 if (!(readb(K2_MISC_REG) & K2_SYS_SLOT_MASK)) {
283 /* Setup PCI64 hose */
284 hose_b = pcibios_alloc_controller();
285 if (!hose_b)
286 return;
287
288 hose_b->first_busno = hose_a->last_busno + 1;
289 hose_b->last_busno = 0xff;
290
291 /* Reminder: quit changing the following, it is correct. */
292 hose_b->pci_mem_offset = K2_PCI32_MEM_BASE;
293
294 pci_init_resource(&hose_b->io_resource,
295 K2_PCI64_LOWER_IO,
296 K2_PCI64_UPPER_IO,
297 IORESOURCE_IO, "PCI64 host bridge");
298
299 pci_init_resource(&hose_b->mem_resources[0],
300 K2_PCI64_LOWER_MEM + K2_PCI32_MEM_BASE,
301 K2_PCI64_UPPER_MEM + K2_PCI32_MEM_BASE,
302 IORESOURCE_MEM, "PCI64 host bridge");
303
304 hose_b->io_space.start = K2_PCI64_LOWER_IO;
305 hose_b->io_space.end = K2_PCI64_UPPER_IO;
306 hose_b->mem_space.start = K2_PCI64_LOWER_MEM;
307 hose_b->mem_space.end = K2_PCI64_UPPER_MEM;
308 hose_b->io_base_virt = (void *)K2_ISA_IO_BASE;
309
310 setup_indirect_pci(hose_b,
311 K2_PCI64_CONFIG_ADDR, K2_PCI64_CONFIG_DATA);
312
313 /* Initialize PCI64 bus registers */
314 early_write_config_byte(hose_b,
315 0,
316 PCI_DEVFN(0, 0),
317 CPC710_SUB_BUS_NUMBER, 0xff);
318
319 early_write_config_byte(hose_b,
320 0,
321 PCI_DEVFN(0, 0),
322 CPC710_BUS_NUMBER, hose_b->first_busno);
323
324 hose_b->last_busno = pciauto_bus_scan(hose_b,
325 hose_b->first_busno);
326
327 /* Write out correct max subordinate bus number for hose B */
328 early_write_config_byte(hose_b,
329 hose_b->first_busno,
330 PCI_DEVFN(0, 0),
331 CPC710_SUB_BUS_NUMBER,
332 hose_b->last_busno);
333
334 /* Configure PCI64 PSBAR */
335 early_write_config_dword(hose_b,
336 hose_b->first_busno,
337 PCI_DEVFN(0, 0),
338 PCI_BASE_ADDRESS_0,
339 K2_PCI64_SYS_MEM_BASE);
340 }
341
342 /* Configure i8259 level/edge settings */
343 outb(0x62, 0x4d0);
344 outb(0xde, 0x4d1);
345
346#ifdef CONFIG_CPC710_DATA_GATHERING
347 {
348 unsigned int tmp;
349 tmp = __raw_readl(ABCNTL);
350 /* Enable data gathering on both PCI interfaces */
351 __raw_writel(tmp | 0x05000000, ABCNTL);
352 }
353#endif
354
355 ppc_md.pcibios_fixup = k2_pcibios_fixup;
356 ppc_md.pcibios_fixup_resources = k2_pcibios_fixup_resources;
357 ppc_md.pci_swizzle = common_swizzle;
358 ppc_md.pci_map_irq = k2_map_irq;
359}
360
361static int k2_get_bus_speed(void)
362{
363 int bus_speed;
364 unsigned char board_id;
365
366 board_id = *(unsigned char *)K2_BOARD_ID_REG;
367
368 switch (K2_BUS_SPD(board_id)) {
369
370 case 0:
371 default:
372 bus_speed = 100000000;
373 break;
374
375 case 1:
376 bus_speed = 83333333;
377 break;
378
379 case 2:
380 bus_speed = 75000000;
381 break;
382
383 case 3:
384 bus_speed = 66666666;
385 break;
386 }
387 return bus_speed;
388}
389
390static int k2_get_cpu_speed(void)
391{
392 unsigned long hid1;
393 int cpu_speed;
394
395 hid1 = mfspr(SPRN_HID1) >> 28;
396
397 if ((mfspr(SPRN_PVR) >> 16) == 8)
398 hid1 = cpu_7xx[hid1];
399 else
400 hid1 = cpu_6xx[hid1];
401
402 cpu_speed = k2_get_bus_speed() * hid1 / 2;
403 return cpu_speed;
404}
405
406static void __init k2_calibrate_decr(void)
407{
408 int freq, divisor = 4;
409
410 /* determine processor bus speed */
411 freq = k2_get_bus_speed();
412 tb_ticks_per_jiffy = freq / HZ / divisor;
413 tb_to_us = mulhwu_scale_factor(freq / divisor, 1000000);
414}
415
416static int k2_show_cpuinfo(struct seq_file *m)
417{
418 unsigned char k2_geo_bits, k2_system_slot;
419
420 seq_printf(m, "vendor\t\t: SBS\n");
421 seq_printf(m, "machine\t\t: K2\n");
422 seq_printf(m, "cpu speed\t: %dMhz\n", k2_get_cpu_speed() / 1000000);
423 seq_printf(m, "bus speed\t: %dMhz\n", k2_get_bus_speed() / 1000000);
424 seq_printf(m, "memory type\t: SDRAM\n");
425
426 k2_geo_bits = readb(K2_MSIZ_GEO_REG) & K2_GEO_ADR_MASK;
427 k2_system_slot = !(readb(K2_MISC_REG) & K2_SYS_SLOT_MASK);
428 seq_printf(m, "backplane\t: %s slot board",
429 k2_system_slot ? "System" : "Non system");
430 seq_printf(m, "with geographical address %x\n", k2_geo_bits);
431
432 return 0;
433}
434
435TODC_ALLOC();
436
437static void __init k2_setup_arch(void)
438{
439 unsigned int cpu;
440
441 /* Setup TODC access */
442 TODC_INIT(TODC_TYPE_MK48T37, 0, 0,
443 ioremap(K2_RTC_BASE_ADDRESS, K2_RTC_SIZE), 8);
444
445 /* init to some ~sane value until calibrate_delay() runs */
446 loops_per_jiffy = 50000000 / HZ;
447
448 /* make FLASH transactions higher priority than PCI to avoid deadlock */
449 __raw_writel(__raw_readl(SIOC1) | 0x80000000, SIOC1);
450
451 /* Set hardware to access FLASH page 2 */
452 __raw_writel(1 << 29, GPOUT);
453
454 /* Setup PCI host bridges */
455 k2_setup_hoses();
456
457#ifdef CONFIG_BLK_DEV_INITRD
458 if (initrd_start)
459 ROOT_DEV = Root_RAM0;
460 else
461#endif
462#ifdef CONFIG_ROOT_NFS
463 ROOT_DEV = Root_NFS;
464#else
465 ROOT_DEV = Root_HDC1;
466#endif
467
468 /* Identify the system */
469 printk(KERN_INFO "System Identification: SBS K2 - PowerPC 750 @ "
470 "%d Mhz\n", k2_get_cpu_speed() / 1000000);
471 printk(KERN_INFO "Port by MontaVista Software, Inc. "
472 "(source@mvista.com)\n");
473
474 /* Identify the CPU manufacturer */
475 cpu = PVR_REV(mfspr(SPRN_PVR));
476 printk(KERN_INFO "CPU manufacturer: %s [rev=%04x]\n",
477 (cpu & (1 << 15)) ? "IBM" : "Motorola", cpu);
478}
479
480static void k2_restart(char *cmd)
481{
482 local_irq_disable();
483
484 /* Flip FLASH back to page 1 to access firmware image */
485 __raw_writel(0, GPOUT);
486
487 /* SRR0 has system reset vector, SRR1 has default MSR value */
488 /* rfi restores MSR from SRR1 and sets the PC to the SRR0 value */
489 mtspr(SPRN_SRR0, 0xfff00100);
490 mtspr(SPRN_SRR1, 0);
491 __asm__ __volatile__("rfi\n\t");
492
493 /* not reached */
494 for (;;) ;
495}
496
497static void k2_power_off(void)
498{
499 for (;;) ;
500}
501
502static void k2_halt(void)
503{
504 k2_restart(NULL);
505}
506
507/*
508 * Set BAT 3 to map PCI32 I/O space.
509 */
510static __inline__ void k2_set_bat(void)
511{
512 /* wait for all outstanding memory accesses to complete */
513 mb();
514
515 /* setup DBATs */
516 mtspr(SPRN_DBAT2U, 0x80001ffe);
517 mtspr(SPRN_DBAT2L, 0x8000002a);
518 mtspr(SPRN_DBAT3U, 0xf0001ffe);
519 mtspr(SPRN_DBAT3L, 0xf000002a);
520
521 /* wait for updates */
522 mb();
523}
524
525static unsigned long __init k2_find_end_of_memory(void)
526{
527 unsigned long total;
528 unsigned char msize = 7; /* Default to 128MB */
529
530 msize = K2_MEM_SIZE(readb(K2_MSIZ_GEO_REG));
531
532 switch (msize) {
533 case 2:
534 /*
535 * This will break without a lowered
536 * KERNELBASE or CONFIG_HIGHMEM on.
537 * It seems non 1GB builds exist yet,
538 * though.
539 */
540 total = K2_MEM_SIZE_1GB;
541 break;
542 case 3:
543 case 4:
544 total = K2_MEM_SIZE_512MB;
545 break;
546 case 5:
547 case 6:
548 total = K2_MEM_SIZE_256MB;
549 break;
550 case 7:
551 total = K2_MEM_SIZE_128MB;
552 break;
553 default:
554 printk
555 ("K2: Invalid memory size detected, defaulting to 128MB\n");
556 total = K2_MEM_SIZE_128MB;
557 break;
558 }
559 return total;
560}
561
562static void __init k2_map_io(void)
563{
564 io_block_mapping(K2_PCI32_IO_BASE,
565 K2_PCI32_IO_BASE, 0x00200000, _PAGE_IO);
566 io_block_mapping(0xff000000, 0xff000000, 0x01000000, _PAGE_IO);
567}
568
569static void __init k2_init_irq(void)
570{
571 int i;
572
573 for (i = 0; i < 16; i++)
574 irq_desc[i].handler = &i8259_pic;
575
576 i8259_init(0);
577}
578
579void __init platform_init(unsigned long r3, unsigned long r4,
580 unsigned long r5, unsigned long r6, unsigned long r7)
581{
582 parse_bootinfo((struct bi_record *)(r3 + KERNELBASE));
583
584 k2_set_bat();
585
586 isa_io_base = K2_ISA_IO_BASE;
587 isa_mem_base = K2_ISA_MEM_BASE;
588 pci_dram_offset = K2_PCI32_SYS_MEM_BASE;
589
590 ppc_md.setup_arch = k2_setup_arch;
591 ppc_md.show_cpuinfo = k2_show_cpuinfo;
592 ppc_md.init_IRQ = k2_init_irq;
593 ppc_md.get_irq = i8259_irq;
594
595 ppc_md.find_end_of_memory = k2_find_end_of_memory;
596 ppc_md.setup_io_mappings = k2_map_io;
597
598 ppc_md.restart = k2_restart;
599 ppc_md.power_off = k2_power_off;
600 ppc_md.halt = k2_halt;
601
602 ppc_md.time_init = todc_time_init;
603 ppc_md.set_rtc_time = todc_set_rtc_time;
604 ppc_md.get_rtc_time = todc_get_rtc_time;
605 ppc_md.calibrate_decr = k2_calibrate_decr;
606
607 ppc_md.nvram_read_val = todc_direct_read_val;
608 ppc_md.nvram_write_val = todc_direct_write_val;
609
610#ifdef CONFIG_SERIAL_TEXT_DEBUG
611 ppc_md.progress = gen550_progress;
612#endif
613}
diff --git a/arch/ppc/platforms/k2.h b/arch/ppc/platforms/k2.h
new file mode 100644
index 000000000000..78326aba1988
--- /dev/null
+++ b/arch/ppc/platforms/k2.h
@@ -0,0 +1,82 @@
1/*
2 * arch/ppc/platforms/k2.h
3 *
4 * Definitions for SBS K2 board support
5 *
6 * Author: Matt Porter <mporter@mvista.com>
7 *
8 * 2001 (c) MontaVista, Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
11 * or implied.
12 */
13
14#ifndef __PPC_PLATFORMS_K2_H
15#define __PPC_PLATFORMS_K2_H
16
17/*
18 * SBS K2 definitions
19 */
20
21#define K2_PCI64_BAR 0xff400000
22#define K2_PCI32_BAR 0xff500000
23
24#define K2_PCI64_CONFIG_ADDR (K2_PCI64_BAR + 0x000f8000)
25#define K2_PCI64_CONFIG_DATA (K2_PCI64_BAR + 0x000f8010)
26
27#define K2_PCI32_CONFIG_ADDR (K2_PCI32_BAR + 0x000f8000)
28#define K2_PCI32_CONFIG_DATA (K2_PCI32_BAR + 0x000f8010)
29
30#define K2_PCI64_MEM_BASE 0xd0000000
31#define K2_PCI64_IO_BASE 0x80100000
32
33#define K2_PCI32_MEM_BASE 0xc0000000
34#define K2_PCI32_IO_BASE 0x80000000
35
36#define K2_PCI32_SYS_MEM_BASE 0x80000000
37#define K2_PCI64_SYS_MEM_BASE K2_PCI32_SYS_MEM_BASE
38
39#define K2_PCI32_LOWER_MEM 0x00000000
40#define K2_PCI32_UPPER_MEM 0x0fffffff
41#define K2_PCI32_LOWER_IO 0x00000000
42#define K2_PCI32_UPPER_IO 0x000fffff
43
44#define K2_PCI64_LOWER_MEM 0x10000000
45#define K2_PCI64_UPPER_MEM 0x1fffffff
46#define K2_PCI64_LOWER_IO 0x00100000
47#define K2_PCI64_UPPER_IO 0x001fffff
48
49#define K2_ISA_IO_BASE K2_PCI32_IO_BASE
50#define K2_ISA_MEM_BASE K2_PCI32_MEM_BASE
51
52#define K2_BOARD_ID_REG (K2_ISA_IO_BASE + 0x800)
53#define K2_MISC_REG (K2_ISA_IO_BASE + 0x804)
54#define K2_MSIZ_GEO_REG (K2_ISA_IO_BASE + 0x808)
55#define K2_HOT_SWAP_REG (K2_ISA_IO_BASE + 0x80c)
56#define K2_PLD2_REG (K2_ISA_IO_BASE + 0x80e)
57#define K2_PLD3_REG (K2_ISA_IO_BASE + 0x80f)
58
59#define K2_BUS_SPD(board_id) (board_id >> 2) & 3
60
61#define K2_RTC_BASE_OFFSET 0x90000
62#define K2_RTC_BASE_ADDRESS (K2_PCI32_MEM_BASE + K2_RTC_BASE_OFFSET)
63#define K2_RTC_SIZE 0x8000
64
65#define K2_MEM_SIZE_MASK 0xe0
66#define K2_MEM_SIZE(size_reg) (size_reg & K2_MEM_SIZE_MASK) >> 5
67#define K2_MEM_SIZE_1GB 0x40000000
68#define K2_MEM_SIZE_512MB 0x20000000
69#define K2_MEM_SIZE_256MB 0x10000000
70#define K2_MEM_SIZE_128MB 0x08000000
71
72#define K2_L2CACHE_MASK 0x03 /* Mask for 2 L2 Cache bits */
73#define K2_L2CACHE_512KB 0x00 /* 512KB */
74#define K2_L2CACHE_256KB 0x01 /* 256KB */
75#define K2_L2CACHE_1MB 0x02 /* 1MB */
76#define K2_L2CACHE_NONE 0x03 /* None */
77
78#define K2_GEO_ADR_MASK 0x1f
79
80#define K2_SYS_SLOT_MASK 0x08
81
82#endif /* __PPC_PLATFORMS_K2_H */
diff --git a/arch/ppc/platforms/katana.c b/arch/ppc/platforms/katana.c
new file mode 100644
index 000000000000..eda922ac3167
--- /dev/null
+++ b/arch/ppc/platforms/katana.c
@@ -0,0 +1,795 @@
1/*
2 * arch/ppc/platforms/katana.c
3 *
4 * Board setup routines for the Artesyn Katana cPCI boards.
5 *
6 * Author: Tim Montgomery <timm@artesyncp.com>
7 * Maintained by: Mark A. Greer <mgreer@mvista.com>
8 *
9 * Based on code done by Rabeeh Khoury - rabeeh@galileo.co.il
10 * Based on code done by - Mark A. Greer <mgreer@mvista.com>
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 */
17/*
18 * Supports the Artesyn 750i, 752i, and 3750. The 752i is virtually identical
19 * to the 750i except that it has an mv64460 bridge.
20 */
21#include <linux/config.h>
22#include <linux/kernel.h>
23#include <linux/pci.h>
24#include <linux/kdev_t.h>
25#include <linux/console.h>
26#include <linux/initrd.h>
27#include <linux/root_dev.h>
28#include <linux/delay.h>
29#include <linux/seq_file.h>
30#include <linux/bootmem.h>
31#include <linux/mtd/physmap.h>
32#include <linux/mv643xx.h>
33#ifdef CONFIG_BOOTIMG
34#include <linux/bootimg.h>
35#endif
36#include <asm/page.h>
37#include <asm/time.h>
38#include <asm/smp.h>
39#include <asm/todc.h>
40#include <asm/bootinfo.h>
41#include <asm/ppcboot.h>
42#include <asm/mv64x60.h>
43#include <platforms/katana.h>
44
45static struct mv64x60_handle bh;
46static katana_id_t katana_id;
47static void __iomem *cpld_base;
48static void __iomem *sram_base;
49
50static u32 katana_flash_size_0;
51static u32 katana_flash_size_1;
52
53static u32 katana_bus_frequency;
54
55unsigned char __res[sizeof(bd_t)];
56
57/* PCI Interrupt routing */
58static int __init
59katana_irq_lookup_750i(unsigned char idsel, unsigned char pin)
60{
61 static char pci_irq_table[][4] = {
62 /*
63 * PCI IDSEL/INTPIN->INTLINE
64 * A B C D
65 */
66 /* IDSEL 4 (PMC 1) */
67 { KATANA_PCI_INTB_IRQ_750i, KATANA_PCI_INTC_IRQ_750i,
68 KATANA_PCI_INTD_IRQ_750i, KATANA_PCI_INTA_IRQ_750i },
69 /* IDSEL 5 (PMC 2) */
70 { KATANA_PCI_INTC_IRQ_750i, KATANA_PCI_INTD_IRQ_750i,
71 KATANA_PCI_INTA_IRQ_750i, KATANA_PCI_INTB_IRQ_750i },
72 /* IDSEL 6 (T8110) */
73 {KATANA_PCI_INTD_IRQ_750i, 0, 0, 0 },
74 };
75 const long min_idsel = 4, max_idsel = 6, irqs_per_slot = 4;
76
77 return PCI_IRQ_TABLE_LOOKUP;
78}
79
80static int __init
81katana_irq_lookup_3750(unsigned char idsel, unsigned char pin)
82{
83 static char pci_irq_table[][4] = {
84 /*
85 * PCI IDSEL/INTPIN->INTLINE
86 * A B C D
87 */
88 { KATANA_PCI_INTA_IRQ_3750, 0, 0, 0 }, /* IDSEL 3 (BCM5691) */
89 { KATANA_PCI_INTB_IRQ_3750, 0, 0, 0 }, /* IDSEL 4 (MV64360 #2)*/
90 { KATANA_PCI_INTC_IRQ_3750, 0, 0, 0 }, /* IDSEL 5 (MV64360 #3)*/
91 };
92 const long min_idsel = 3, max_idsel = 5, irqs_per_slot = 4;
93
94 return PCI_IRQ_TABLE_LOOKUP;
95}
96
97static int __init
98katana_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
99{
100 switch (katana_id) {
101 case KATANA_ID_750I:
102 case KATANA_ID_752I:
103 return katana_irq_lookup_750i(idsel, pin);
104
105 case KATANA_ID_3750:
106 return katana_irq_lookup_3750(idsel, pin);
107
108 default:
109 printk(KERN_ERR "Bogus board ID\n");
110 return 0;
111 }
112}
113
114/* Board info retrieval routines */
115void __init
116katana_get_board_id(void)
117{
118 switch (in_8(cpld_base + KATANA_CPLD_PRODUCT_ID)) {
119 case KATANA_PRODUCT_ID_3750:
120 katana_id = KATANA_ID_3750;
121 break;
122
123 case KATANA_PRODUCT_ID_750i:
124 katana_id = KATANA_ID_750I;
125 break;
126
127 case KATANA_PRODUCT_ID_752i:
128 katana_id = KATANA_ID_752I;
129 break;
130
131 default:
132 printk(KERN_ERR "Unsupported board\n");
133 }
134}
135
136int __init
137katana_get_proc_num(void)
138{
139 u16 val;
140 u8 save_exclude;
141 static int proc = -1;
142 static u8 first_time = 1;
143
144 if (first_time) {
145 if (katana_id != KATANA_ID_3750)
146 proc = 0;
147 else {
148 save_exclude = mv64x60_pci_exclude_bridge;
149 mv64x60_pci_exclude_bridge = 0;
150
151 early_read_config_word(bh.hose_a, 0,
152 PCI_DEVFN(0,0), PCI_DEVICE_ID, &val);
153
154 mv64x60_pci_exclude_bridge = save_exclude;
155
156 switch(val) {
157 case PCI_DEVICE_ID_KATANA_3750_PROC0:
158 proc = 0;
159 break;
160
161 case PCI_DEVICE_ID_KATANA_3750_PROC1:
162 proc = 1;
163 break;
164
165 case PCI_DEVICE_ID_KATANA_3750_PROC2:
166 proc = 2;
167 break;
168
169 default:
170 printk(KERN_ERR "Bogus Device ID\n");
171 }
172 }
173
174 first_time = 0;
175 }
176
177 return proc;
178}
179
180static inline int
181katana_is_monarch(void)
182{
183 return in_8(cpld_base + KATANA_CPLD_BD_CFG_3) &
184 KATANA_CPLD_BD_CFG_3_MONARCH;
185}
186
187static void __init
188katana_setup_bridge(void)
189{
190 struct pci_controller hose;
191 struct mv64x60_setup_info si;
192 void __iomem *vaddr;
193 int i;
194 u16 val;
195 u8 save_exclude;
196
197 /*
198 * Some versions of the Katana firmware mistakenly change the vendor
199 * & device id fields in the bridge's pci device (visible via pci
200 * config accesses). This breaks mv64x60_init() because those values
201 * are used to identify the type of bridge that's there. Artesyn
202 * claims that the subsystem vendor/device id's will have the correct
203 * Marvell values so this code puts back the correct values from there.
204 */
205 memset(&hose, 0, sizeof(hose));
206 vaddr = ioremap(CONFIG_MV64X60_NEW_BASE, MV64x60_INTERNAL_SPACE_SIZE);
207 setup_indirect_pci_nomap(&hose, vaddr + MV64x60_PCI0_CONFIG_ADDR,
208 vaddr + MV64x60_PCI0_CONFIG_DATA);
209 save_exclude = mv64x60_pci_exclude_bridge;
210 mv64x60_pci_exclude_bridge = 0;
211
212 early_read_config_word(&hose, 0, PCI_DEVFN(0, 0), PCI_VENDOR_ID, &val);
213
214 if (val != PCI_VENDOR_ID_MARVELL) {
215 early_read_config_word(&hose, 0, PCI_DEVFN(0, 0),
216 PCI_SUBSYSTEM_VENDOR_ID, &val);
217 early_write_config_word(&hose, 0, PCI_DEVFN(0, 0),
218 PCI_VENDOR_ID, val);
219 early_read_config_word(&hose, 0, PCI_DEVFN(0, 0),
220 PCI_SUBSYSTEM_ID, &val);
221 early_write_config_word(&hose, 0, PCI_DEVFN(0, 0),
222 PCI_DEVICE_ID, val);
223 }
224
225 mv64x60_pci_exclude_bridge = save_exclude;
226 iounmap(vaddr);
227
228 memset(&si, 0, sizeof(si));
229
230 si.phys_reg_base = CONFIG_MV64X60_NEW_BASE;
231
232 si.pci_1.enable_bus = 1;
233 si.pci_1.pci_io.cpu_base = KATANA_PCI1_IO_START_PROC_ADDR;
234 si.pci_1.pci_io.pci_base_hi = 0;
235 si.pci_1.pci_io.pci_base_lo = KATANA_PCI1_IO_START_PCI_ADDR;
236 si.pci_1.pci_io.size = KATANA_PCI1_IO_SIZE;
237 si.pci_1.pci_io.swap = MV64x60_CPU2PCI_SWAP_NONE;
238 si.pci_1.pci_mem[0].cpu_base = KATANA_PCI1_MEM_START_PROC_ADDR;
239 si.pci_1.pci_mem[0].pci_base_hi = KATANA_PCI1_MEM_START_PCI_HI_ADDR;
240 si.pci_1.pci_mem[0].pci_base_lo = KATANA_PCI1_MEM_START_PCI_LO_ADDR;
241 si.pci_1.pci_mem[0].size = KATANA_PCI1_MEM_SIZE;
242 si.pci_1.pci_mem[0].swap = MV64x60_CPU2PCI_SWAP_NONE;
243 si.pci_1.pci_cmd_bits = 0;
244 si.pci_1.latency_timer = 0x80;
245
246 for (i = 0; i < MV64x60_CPU2MEM_WINDOWS; i++) {
247#if defined(CONFIG_NOT_COHERENT_CACHE)
248 si.cpu_prot_options[i] = 0;
249 si.enet_options[i] = MV64360_ENET2MEM_SNOOP_NONE;
250 si.mpsc_options[i] = MV64360_MPSC2MEM_SNOOP_NONE;
251 si.idma_options[i] = MV64360_IDMA2MEM_SNOOP_NONE;
252
253 si.pci_1.acc_cntl_options[i] =
254 MV64360_PCI_ACC_CNTL_SNOOP_NONE |
255 MV64360_PCI_ACC_CNTL_SWAP_NONE |
256 MV64360_PCI_ACC_CNTL_MBURST_128_BYTES |
257 MV64360_PCI_ACC_CNTL_RDSIZE_256_BYTES;
258#else
259 si.cpu_prot_options[i] = 0;
260 si.enet_options[i] = MV64360_ENET2MEM_SNOOP_NONE; /* errata */
261 si.mpsc_options[i] = MV64360_MPSC2MEM_SNOOP_NONE; /* errata */
262 si.idma_options[i] = MV64360_IDMA2MEM_SNOOP_NONE; /* errata */
263
264 si.pci_1.acc_cntl_options[i] =
265 MV64360_PCI_ACC_CNTL_SNOOP_WB |
266 MV64360_PCI_ACC_CNTL_SWAP_NONE |
267 MV64360_PCI_ACC_CNTL_MBURST_32_BYTES |
268 MV64360_PCI_ACC_CNTL_RDSIZE_32_BYTES;
269#endif
270 }
271
272 /* Lookup PCI host bridges */
273 if (mv64x60_init(&bh, &si))
274 printk(KERN_WARNING "Bridge initialization failed.\n");
275
276 pci_dram_offset = 0; /* sys mem at same addr on PCI & cpu bus */
277 ppc_md.pci_swizzle = common_swizzle;
278 ppc_md.pci_map_irq = katana_map_irq;
279 ppc_md.pci_exclude_device = mv64x60_pci_exclude_device;
280
281 mv64x60_set_bus(&bh, 1, 0);
282 bh.hose_b->first_busno = 0;
283 bh.hose_b->last_busno = 0xff;
284}
285
286/* Bridge & platform setup routines */
287void __init
288katana_intr_setup(void)
289{
290 /* MPP 8, 9, and 10 */
291 mv64x60_clr_bits(&bh, MV64x60_MPP_CNTL_1, 0xfff);
292
293 /* MPP 14 */
294 if ((katana_id == KATANA_ID_750I) || (katana_id == KATANA_ID_752I))
295 mv64x60_clr_bits(&bh, MV64x60_MPP_CNTL_1, 0x0f000000);
296
297 /*
298 * Define GPP 8,9,and 10 interrupt polarity as active low
299 * input signal and level triggered
300 */
301 mv64x60_set_bits(&bh, MV64x60_GPP_LEVEL_CNTL, 0x700);
302 mv64x60_clr_bits(&bh, MV64x60_GPP_IO_CNTL, 0x700);
303
304 if ((katana_id == KATANA_ID_750I) || (katana_id == KATANA_ID_752I)) {
305 mv64x60_set_bits(&bh, MV64x60_GPP_LEVEL_CNTL, (1<<14));
306 mv64x60_clr_bits(&bh, MV64x60_GPP_IO_CNTL, (1<<14));
307 }
308
309 /* Config GPP intr ctlr to respond to level trigger */
310 mv64x60_set_bits(&bh, MV64x60_COMM_ARBITER_CNTL, (1<<10));
311
312 /* Erranum FEr PCI-#8 */
313 mv64x60_clr_bits(&bh, MV64x60_PCI0_CMD, (1<<5) | (1<<9));
314 mv64x60_clr_bits(&bh, MV64x60_PCI1_CMD, (1<<5) | (1<<9));
315
316 /*
317 * Dismiss and then enable interrupt on GPP interrupt cause
318 * for CPU #0
319 */
320 mv64x60_write(&bh, MV64x60_GPP_INTR_CAUSE, ~0x700);
321 mv64x60_set_bits(&bh, MV64x60_GPP_INTR_MASK, 0x700);
322
323 if ((katana_id == KATANA_ID_750I) || (katana_id == KATANA_ID_752I)) {
324 mv64x60_write(&bh, MV64x60_GPP_INTR_CAUSE, ~(1<<14));
325 mv64x60_set_bits(&bh, MV64x60_GPP_INTR_MASK, (1<<14));
326 }
327
328 /*
329 * Dismiss and then enable interrupt on CPU #0 high cause reg
330 * BIT25 summarizes GPP interrupts 8-15
331 */
332 mv64x60_set_bits(&bh, MV64360_IC_CPU0_INTR_MASK_HI, (1<<25));
333}
334
335void __init
336katana_setup_peripherals(void)
337{
338 u32 base;
339
340 /* Set up windows for boot CS, soldered & socketed flash, and CPLD */
341 mv64x60_set_32bit_window(&bh, MV64x60_CPU2BOOT_WIN,
342 KATANA_BOOT_WINDOW_BASE, KATANA_BOOT_WINDOW_SIZE, 0);
343 bh.ci->enable_window_32bit(&bh, MV64x60_CPU2BOOT_WIN);
344
345 /* Assume firmware set up window sizes correctly for dev 0 & 1 */
346 mv64x60_get_32bit_window(&bh, MV64x60_CPU2DEV_0_WIN, &base,
347 &katana_flash_size_0);
348
349 if (katana_flash_size_0 > 0) {
350 mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_0_WIN,
351 KATANA_SOLDERED_FLASH_BASE, katana_flash_size_0, 0);
352 bh.ci->enable_window_32bit(&bh, MV64x60_CPU2DEV_0_WIN);
353 }
354
355 mv64x60_get_32bit_window(&bh, MV64x60_CPU2DEV_1_WIN, &base,
356 &katana_flash_size_1);
357
358 if (katana_flash_size_1 > 0) {
359 mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_1_WIN,
360 (KATANA_SOLDERED_FLASH_BASE + katana_flash_size_0),
361 katana_flash_size_1, 0);
362 bh.ci->enable_window_32bit(&bh, MV64x60_CPU2DEV_1_WIN);
363 }
364
365 mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_2_WIN,
366 KATANA_SOCKET_BASE, KATANA_SOCKETED_FLASH_SIZE, 0);
367 bh.ci->enable_window_32bit(&bh, MV64x60_CPU2DEV_2_WIN);
368
369 mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_3_WIN,
370 KATANA_CPLD_BASE, KATANA_CPLD_SIZE, 0);
371 bh.ci->enable_window_32bit(&bh, MV64x60_CPU2DEV_3_WIN);
372 cpld_base = ioremap(KATANA_CPLD_BASE, KATANA_CPLD_SIZE);
373
374 mv64x60_set_32bit_window(&bh, MV64x60_CPU2SRAM_WIN,
375 KATANA_INTERNAL_SRAM_BASE, MV64360_SRAM_SIZE, 0);
376 bh.ci->enable_window_32bit(&bh, MV64x60_CPU2SRAM_WIN);
377 sram_base = ioremap(KATANA_INTERNAL_SRAM_BASE, MV64360_SRAM_SIZE);
378
379 /* Set up Enet->SRAM window */
380 mv64x60_set_32bit_window(&bh, MV64x60_ENET2MEM_4_WIN,
381 KATANA_INTERNAL_SRAM_BASE, MV64360_SRAM_SIZE, 0x2);
382 bh.ci->enable_window_32bit(&bh, MV64x60_ENET2MEM_4_WIN);
383
384 /* Give enet r/w access to memory region */
385 mv64x60_set_bits(&bh, MV64360_ENET2MEM_ACC_PROT_0, (0x3 << (4 << 1)));
386 mv64x60_set_bits(&bh, MV64360_ENET2MEM_ACC_PROT_1, (0x3 << (4 << 1)));
387 mv64x60_set_bits(&bh, MV64360_ENET2MEM_ACC_PROT_2, (0x3 << (4 << 1)));
388
389 mv64x60_clr_bits(&bh, MV64x60_PCI1_PCI_DECODE_CNTL, (1 << 3));
390 mv64x60_clr_bits(&bh, MV64x60_TIMR_CNTR_0_3_CNTL,
391 ((1 << 0) | (1 << 8) | (1 << 16) | (1 << 24)));
392
393 /* Must wait until window set up before retrieving board id */
394 katana_get_board_id();
395
396 /* Enumerate pci bus (must know board id before getting proc number) */
397 if (katana_get_proc_num() == 0)
398 bh.hose_b->last_busno = pciauto_bus_scan(bh.hose_b, 0);
399
400#if defined(CONFIG_NOT_COHERENT_CACHE)
401 mv64x60_write(&bh, MV64360_SRAM_CONFIG, 0x00160000);
402#else
403 mv64x60_write(&bh, MV64360_SRAM_CONFIG, 0x001600b2);
404#endif
405
406 /*
407 * Setting the SRAM to 0. Note that this generates parity errors on
408 * internal data path in SRAM since it's first time accessing it
409 * while after reset it's not configured.
410 */
411 memset(sram_base, 0, MV64360_SRAM_SIZE);
412
413 /* Only processor zero [on 3750] is an PCI interrupt controller */
414 if (katana_get_proc_num() == 0)
415 katana_intr_setup();
416}
417
418static void __init
419katana_enable_ipmi(void)
420{
421 u8 reset_out;
422
423 /* Enable access to IPMI ctlr by clearing IPMI PORTSEL bit in CPLD */
424 reset_out = in_8(cpld_base + KATANA_CPLD_RESET_OUT);
425 reset_out &= ~KATANA_CPLD_RESET_OUT_PORTSEL;
426 out_8(cpld_base + KATANA_CPLD_RESET_OUT, reset_out);
427}
428
429static void __init
430katana_setup_arch(void)
431{
432 if (ppc_md.progress)
433 ppc_md.progress("katana_setup_arch: enter", 0);
434
435 set_tb(0, 0);
436
437#ifdef CONFIG_BLK_DEV_INITRD
438 if (initrd_start)
439 ROOT_DEV = Root_RAM0;
440 else
441#endif
442#ifdef CONFIG_ROOT_NFS
443 ROOT_DEV = Root_NFS;
444#else
445 ROOT_DEV = Root_SDA2;
446#endif
447
448 /*
449 * Set up the L2CR register.
450 *
451 * 750FX has only L2E, L2PE (bits 2-8 are reserved)
452 * DD2.0 has bug that requires the L2 to be in WRT mode
453 * avoid dirty data in cache
454 */
455 if (PVR_REV(mfspr(SPRN_PVR)) == 0x0200) {
456 printk(KERN_INFO "DD2.0 detected. Setting L2 cache"
457 "to Writethrough mode\n");
458 _set_L2CR(L2CR_L2E | L2CR_L2PE | L2CR_L2WT);
459 } else
460 _set_L2CR(L2CR_L2E | L2CR_L2PE);
461
462 if (ppc_md.progress)
463 ppc_md.progress("katana_setup_arch: calling setup_bridge", 0);
464
465 katana_setup_bridge();
466 katana_setup_peripherals();
467 katana_enable_ipmi();
468
469 katana_bus_frequency = katana_bus_freq(cpld_base);
470
471 printk(KERN_INFO "Artesyn Communication Products, LLC - Katana(TM)\n");
472 if (ppc_md.progress)
473 ppc_md.progress("katana_setup_arch: exit", 0);
474}
475
476/* Platform device data fixup routines. */
477#if defined(CONFIG_SERIAL_MPSC)
478static void __init
479katana_fixup_mpsc_pdata(struct platform_device *pdev)
480{
481 struct mpsc_pdata *pdata;
482
483 pdata = (struct mpsc_pdata *)pdev->dev.platform_data;
484
485 pdata->max_idle = 40;
486 pdata->default_baud = KATANA_DEFAULT_BAUD;
487 pdata->brg_clk_src = KATANA_MPSC_CLK_SRC;
488 /*
489 * TCLK (not SysCLk) is routed to BRG, then to the MPSC. On most parts,
490 * TCLK == SysCLK but on 64460, they are separate pins.
491 * SysCLK can go up to 200 MHz but TCLK can only go up to 133 MHz.
492 */
493 pdata->brg_clk_freq = min(katana_bus_frequency, MV64x60_TCLK_FREQ_MAX);
494}
495#endif
496
497#if defined(CONFIG_MV643XX_ETH)
498static void __init
499katana_fixup_eth_pdata(struct platform_device *pdev)
500{
501 struct mv643xx_eth_platform_data *eth_pd;
502 static u16 phy_addr[] = {
503 KATANA_ETH0_PHY_ADDR,
504 KATANA_ETH1_PHY_ADDR,
505 KATANA_ETH2_PHY_ADDR,
506 };
507
508 eth_pd = pdev->dev.platform_data;
509 eth_pd->force_phy_addr = 1;
510 eth_pd->phy_addr = phy_addr[pdev->id];
511 eth_pd->tx_queue_size = KATANA_ETH_TX_QUEUE_SIZE;
512 eth_pd->rx_queue_size = KATANA_ETH_RX_QUEUE_SIZE;
513}
514#endif
515
516static int __init
517katana_platform_notify(struct device *dev)
518{
519 static struct {
520 char *bus_id;
521 void ((*rtn)(struct platform_device *pdev));
522 } dev_map[] = {
523#if defined(CONFIG_SERIAL_MPSC)
524 { MPSC_CTLR_NAME ".0", katana_fixup_mpsc_pdata },
525 { MPSC_CTLR_NAME ".1", katana_fixup_mpsc_pdata },
526#endif
527#if defined(CONFIG_MV643XX_ETH)
528 { MV643XX_ETH_NAME ".0", katana_fixup_eth_pdata },
529 { MV643XX_ETH_NAME ".1", katana_fixup_eth_pdata },
530 { MV643XX_ETH_NAME ".2", katana_fixup_eth_pdata },
531#endif
532 };
533 struct platform_device *pdev;
534 int i;
535
536 if (dev && dev->bus_id)
537 for (i=0; i<ARRAY_SIZE(dev_map); i++)
538 if (!strncmp(dev->bus_id, dev_map[i].bus_id,
539 BUS_ID_SIZE)) {
540
541 pdev = container_of(dev,
542 struct platform_device, dev);
543 dev_map[i].rtn(pdev);
544 }
545
546 return 0;
547}
548
549#ifdef CONFIG_MTD_PHYSMAP
550
551#ifndef MB
552#define MB (1 << 20)
553#endif
554
555/*
556 * MTD Layout depends on amount of soldered FLASH in system. Sizes in MB.
557 *
558 * FLASH Amount: 128 64 32 16
559 * ------------- --- -- -- --
560 * Monitor: 1 1 1 1
561 * Primary Kernel: 1.5 1.5 1.5 1.5
562 * Primary fs: 30 30 <end> <end>
563 * Secondary Kernel: 1.5 1.5 N/A N/A
564 * Secondary fs: <end> <end> N/A N/A
565 * User: <overlays entire FLASH except for "Monitor" section>
566 */
567static int __init
568katana_setup_mtd(void)
569{
570 u32 size;
571 int ptbl_entries;
572 static struct mtd_partition *ptbl;
573
574 size = katana_flash_size_0 + katana_flash_size_1;
575 if (!size)
576 return -ENOMEM;
577
578 ptbl_entries = (size >= (64*MB)) ? 6 : 4;
579
580 if ((ptbl = kmalloc(ptbl_entries * sizeof(struct mtd_partition),
581 GFP_KERNEL)) == NULL) {
582
583 printk(KERN_WARNING "Can't alloc MTD partition table\n");
584 return -ENOMEM;
585 }
586 memset(ptbl, 0, ptbl_entries * sizeof(struct mtd_partition));
587
588 ptbl[0].name = "Monitor";
589 ptbl[0].size = KATANA_MTD_MONITOR_SIZE;
590 ptbl[1].name = "Primary Kernel";
591 ptbl[1].offset = MTDPART_OFS_NXTBLK;
592 ptbl[1].size = 0x00180000; /* 1.5 MB */
593 ptbl[2].name = "Primary Filesystem";
594 ptbl[2].offset = MTDPART_OFS_APPEND;
595 ptbl[2].size = MTDPART_SIZ_FULL; /* Correct for 16 & 32 MB */
596 ptbl[ptbl_entries-1].name = "User FLASH";
597 ptbl[ptbl_entries-1].offset = KATANA_MTD_MONITOR_SIZE;
598 ptbl[ptbl_entries-1].size = MTDPART_SIZ_FULL;
599
600 if (size >= (64*MB)) {
601 ptbl[2].size = 30*MB;
602 ptbl[3].name = "Secondary Kernel";
603 ptbl[3].offset = MTDPART_OFS_NXTBLK;
604 ptbl[3].size = 0x00180000; /* 1.5 MB */
605 ptbl[4].name = "Secondary Filesystem";
606 ptbl[4].offset = MTDPART_OFS_APPEND;
607 ptbl[4].size = MTDPART_SIZ_FULL;
608 }
609
610 physmap_map.size = size;
611 physmap_set_partitions(ptbl, ptbl_entries);
612 return 0;
613}
614
615arch_initcall(katana_setup_mtd);
616#endif
617
618static void
619katana_restart(char *cmd)
620{
621 ulong i = 10000000;
622
623 /* issue hard reset to the reset command register */
624 out_8(cpld_base + KATANA_CPLD_RST_CMD, KATANA_CPLD_RST_CMD_HR);
625
626 while (i-- > 0) ;
627 panic("restart failed\n");
628}
629
630static void
631katana_halt(void)
632{
633 u8 v;
634
635 if (katana_id == KATANA_ID_752I) {
636 v = in_8(cpld_base + HSL_PLD_BASE + HSL_PLD_HOT_SWAP_OFF);
637 v |= HSL_PLD_HOT_SWAP_LED_BIT;
638 out_8(cpld_base + HSL_PLD_BASE + HSL_PLD_HOT_SWAP_OFF, v);
639 }
640
641 while (1) ;
642 /* NOTREACHED */
643}
644
645static void
646katana_power_off(void)
647{
648 katana_halt();
649 /* NOTREACHED */
650}
651
652static int
653katana_show_cpuinfo(struct seq_file *m)
654{
655 seq_printf(m, "vendor\t\t: Artesyn Communication Products, LLC\n");
656
657 seq_printf(m, "board\t\t: ");
658
659 switch (katana_id) {
660 case KATANA_ID_3750:
661 seq_printf(m, "Katana 3750\n");
662 break;
663
664 case KATANA_ID_750I:
665 seq_printf(m, "Katana 750i\n");
666 break;
667
668 case KATANA_ID_752I:
669 seq_printf(m, "Katana 752i\n");
670 break;
671
672 default:
673 seq_printf(m, "Unknown\n");
674 break;
675 }
676
677 seq_printf(m, "product ID\t: 0x%x\n",
678 in_8(cpld_base + KATANA_CPLD_PRODUCT_ID));
679 seq_printf(m, "hardware rev\t: 0x%x\n",
680 in_8(cpld_base+KATANA_CPLD_HARDWARE_VER));
681 seq_printf(m, "PLD rev\t\t: 0x%x\n",
682 in_8(cpld_base + KATANA_CPLD_PLD_VER));
683 seq_printf(m, "PLB freq\t: %ldMhz\n",
684 (long)katana_bus_frequency / 1000000);
685 seq_printf(m, "PCI\t\t: %sMonarch\n", katana_is_monarch()? "" : "Non-");
686
687 return 0;
688}
689
690static void __init
691katana_calibrate_decr(void)
692{
693 u32 freq;
694
695 freq = katana_bus_frequency / 4;
696
697 printk(KERN_INFO "time_init: decrementer frequency = %lu.%.6lu MHz\n",
698 (long)freq / 1000000, (long)freq % 1000000);
699
700 tb_ticks_per_jiffy = freq / HZ;
701 tb_to_us = mulhwu_scale_factor(freq, 1000000);
702}
703
704unsigned long __init
705katana_find_end_of_memory(void)
706{
707 return mv64x60_get_mem_size(CONFIG_MV64X60_NEW_BASE,
708 MV64x60_TYPE_MV64360);
709}
710
711#if defined(CONFIG_I2C_MV64XXX) && defined(CONFIG_SENSORS_M41T00)
712extern ulong m41t00_get_rtc_time(void);
713extern int m41t00_set_rtc_time(ulong);
714
715static int __init
716katana_rtc_hookup(void)
717{
718 struct timespec tv;
719
720 ppc_md.get_rtc_time = m41t00_get_rtc_time;
721 ppc_md.set_rtc_time = m41t00_set_rtc_time;
722
723 tv.tv_nsec = 0;
724 tv.tv_sec = (ppc_md.get_rtc_time)();
725 do_settimeofday(&tv);
726
727 return 0;
728}
729late_initcall(katana_rtc_hookup);
730#endif
731
732static inline void
733katana_set_bat(void)
734{
735 mb();
736 mtspr(SPRN_DBAT2U, 0xf0001ffe);
737 mtspr(SPRN_DBAT2L, 0xf000002a);
738 mb();
739}
740
741#if defined(CONFIG_SERIAL_TEXT_DEBUG) && defined(CONFIG_SERIAL_MPSC_CONSOLE)
742static void __init
743katana_map_io(void)
744{
745 io_block_mapping(0xf8100000, 0xf8100000, 0x00020000, _PAGE_IO);
746}
747#endif
748
749void __init
750platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
751 unsigned long r6, unsigned long r7)
752{
753 parse_bootinfo(find_bootinfo());
754
755 /* ASSUMPTION: If both r3 (bd_t pointer) and r6 (cmdline pointer)
756 * are non-zero, then we should use the board info from the bd_t
757 * structure and the cmdline pointed to by r6 instead of the
758 * information from birecs, if any. Otherwise, use the information
759 * from birecs as discovered by the preceeding call to
760 * parse_bootinfo(). This rule should work with both PPCBoot, which
761 * uses a bd_t board info structure, and the kernel boot wrapper,
762 * which uses birecs.
763 */
764 if (r3 && r6) {
765 /* copy board info structure */
766 memcpy( (void *)__res,(void *)(r3+KERNELBASE), sizeof(bd_t) );
767 /* copy command line */
768 *(char *)(r7+KERNELBASE) = 0;
769 strcpy(cmd_line, (char *)(r6+KERNELBASE));
770 }
771
772 isa_mem_base = 0;
773
774 ppc_md.setup_arch = katana_setup_arch;
775 ppc_md.show_cpuinfo = katana_show_cpuinfo;
776 ppc_md.init_IRQ = mv64360_init_irq;
777 ppc_md.get_irq = mv64360_get_irq;
778 ppc_md.restart = katana_restart;
779 ppc_md.power_off = katana_power_off;
780 ppc_md.halt = katana_halt;
781 ppc_md.find_end_of_memory = katana_find_end_of_memory;
782 ppc_md.calibrate_decr = katana_calibrate_decr;
783
784#if defined(CONFIG_SERIAL_TEXT_DEBUG) && defined(CONFIG_SERIAL_MPSC_CONSOLE)
785 ppc_md.setup_io_mappings = katana_map_io;
786 ppc_md.progress = mv64x60_mpsc_progress;
787 mv64x60_progress_init(CONFIG_MV64X60_NEW_BASE);
788#endif
789
790#if defined(CONFIG_SERIAL_MPSC) || defined(CONFIG_MV643XX_ETH)
791 platform_notify = katana_platform_notify;
792#endif
793
794 katana_set_bat(); /* Need for katana_find_end_of_memory and progress */
795}
diff --git a/arch/ppc/platforms/katana.h b/arch/ppc/platforms/katana.h
new file mode 100644
index 000000000000..b82ed81950f5
--- /dev/null
+++ b/arch/ppc/platforms/katana.h
@@ -0,0 +1,255 @@
1/*
2 * arch/ppc/platforms/katana.h
3 *
4 * Definitions for Artesyn Katana750i/3750 board.
5 *
6 * Author: Tim Montgomery <timm@artesyncp.com>
7 * Maintained by: Mark A. Greer <mgreer@mvista.com>
8 *
9 * Based on code done by Rabeeh Khoury - rabeeh@galileo.co.il
10 * Based on code done by Mark A. Greer <mgreer@mvista.com>
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 */
17
18/*
19 * The MV64360 has 2 PCI buses each with 1 window from the CPU bus to
20 * PCI I/O space and 4 windows from the CPU bus to PCI MEM space.
21 * We'll only use one PCI MEM window on each PCI bus.
22 *
23 * This is the CPU physical memory map (windows must be at least 64 KB and start
24 * on a boundary that is a multiple of the window size):
25 *
26 * 0xff800000-0xffffffff - Boot window
27 * 0xf8400000-0xf843ffff - Internal SRAM
28 * 0xf8200000-0xf83fffff - CPLD
29 * 0xf8100000-0xf810ffff - MV64360 Registers (CONFIG_MV64X60_NEW_BASE)
30 * 0xf8000000-0xf80fffff - Socketed FLASH
31 * 0xe0000000-0xefffffff - Soldered FLASH
32 * 0xc0000000-0xc3ffffff - PCI I/O (second hose)
33 * 0x80000000-0xbfffffff - PCI MEM (second hose)
34 */
35
36#ifndef __PPC_PLATFORMS_KATANA_H
37#define __PPC_PLATFORMS_KATANA_H
38
39/* CPU Physical Memory Map setup. */
40#define KATANA_BOOT_WINDOW_BASE 0xff800000
41#define KATANA_BOOT_WINDOW_SIZE 0x00800000 /* 8 MB */
42#define KATANA_INTERNAL_SRAM_BASE 0xf8400000
43#define KATANA_CPLD_BASE 0xf8200000
44#define KATANA_CPLD_SIZE 0x00200000 /* 2 MB */
45#define KATANA_SOCKET_BASE 0xf8000000
46#define KATANA_SOCKETED_FLASH_SIZE 0x00100000 /* 1 MB */
47#define KATANA_SOLDERED_FLASH_BASE 0xe0000000
48#define KATANA_SOLDERED_FLASH_SIZE 0x10000000 /* 256 MB */
49
50#define KATANA_PCI1_MEM_START_PROC_ADDR 0x80000000
51#define KATANA_PCI1_MEM_START_PCI_HI_ADDR 0x00000000
52#define KATANA_PCI1_MEM_START_PCI_LO_ADDR 0x80000000
53#define KATANA_PCI1_MEM_SIZE 0x40000000 /* 1 GB */
54#define KATANA_PCI1_IO_START_PROC_ADDR 0xc0000000
55#define KATANA_PCI1_IO_START_PCI_ADDR 0x00000000
56#define KATANA_PCI1_IO_SIZE 0x04000000 /* 64 MB */
57
58/* Board-specific IRQ info */
59#define KATANA_PCI_INTA_IRQ_3750 64+8
60#define KATANA_PCI_INTB_IRQ_3750 64+9
61#define KATANA_PCI_INTC_IRQ_3750 64+10
62
63#define KATANA_PCI_INTA_IRQ_750i 64+8
64#define KATANA_PCI_INTB_IRQ_750i 64+9
65#define KATANA_PCI_INTC_IRQ_750i 64+10
66#define KATANA_PCI_INTD_IRQ_750i 64+14
67
68#define KATANA_CPLD_RST_EVENT 0x00000000
69#define KATANA_CPLD_RST_CMD 0x00001000
70#define KATANA_CPLD_PCI_ERR_INT_EN 0x00002000
71#define KATANA_CPLD_PCI_ERR_INT_PEND 0x00003000
72#define KATANA_CPLD_PRODUCT_ID 0x00004000
73#define KATANA_CPLD_EREADY 0x00005000
74
75#define KATANA_CPLD_HARDWARE_VER 0x00007000
76#define KATANA_CPLD_PLD_VER 0x00008000
77#define KATANA_CPLD_BD_CFG_0 0x00009000
78#define KATANA_CPLD_BD_CFG_1 0x0000a000
79#define KATANA_CPLD_BD_CFG_3 0x0000c000
80#define KATANA_CPLD_LED 0x0000d000
81#define KATANA_CPLD_RESET_OUT 0x0000e000
82
83#define KATANA_CPLD_RST_EVENT_INITACT 0x80
84#define KATANA_CPLD_RST_EVENT_SW 0x40
85#define KATANA_CPLD_RST_EVENT_WD 0x20
86#define KATANA_CPLD_RST_EVENT_COPS 0x10
87#define KATANA_CPLD_RST_EVENT_COPH 0x08
88#define KATANA_CPLD_RST_EVENT_CPCI 0x02
89#define KATANA_CPLD_RST_EVENT_FP 0x01
90
91#define KATANA_CPLD_RST_CMD_SCL 0x80
92#define KATANA_CPLD_RST_CMD_SDA 0x40
93#define KATANA_CPLD_RST_CMD_I2C 0x10
94#define KATANA_CPLD_RST_CMD_FR 0x08
95#define KATANA_CPLD_RST_CMD_SR 0x04
96#define KATANA_CPLD_RST_CMD_HR 0x01
97
98#define KATANA_CPLD_BD_CFG_0_SYSCLK_MASK 0xc0
99#define KATANA_CPLD_BD_CFG_0_SYSCLK_200 0x00
100#define KATANA_CPLD_BD_CFG_0_SYSCLK_166 0x80
101#define KATANA_CPLD_BD_CFG_0_SYSCLK_133 0xc0
102#define KATANA_CPLD_BD_CFG_0_SYSCLK_100 0x40
103
104#define KATANA_CPLD_BD_CFG_1_FL_BANK_MASK 0x03
105#define KATANA_CPLD_BD_CFG_1_FL_BANK_16MB 0x00
106#define KATANA_CPLD_BD_CFG_1_FL_BANK_32MB 0x01
107#define KATANA_CPLD_BD_CFG_1_FL_BANK_64MB 0x02
108#define KATANA_CPLD_BD_CFG_1_FL_BANK_128MB 0x03
109
110#define KATANA_CPLD_BD_CFG_1_FL_NUM_BANKS_MASK 0x04
111#define KATANA_CPLD_BD_CFG_1_FL_NUM_BANKS_ONE 0x00
112#define KATANA_CPLD_BD_CFG_1_FL_NUM_BANKS_TWO 0x04
113
114#define KATANA_CPLD_BD_CFG_3_MONARCH 0x04
115
116#define KATANA_CPLD_RESET_OUT_PORTSEL 0x80
117#define KATANA_CPLD_RESET_OUT_WD 0x20
118#define KATANA_CPLD_RESET_OUT_COPH 0x08
119#define KATANA_CPLD_RESET_OUT_PCI_RST_PCI 0x02
120#define KATANA_CPLD_RESET_OUT_PCI_RST_FP 0x01
121
122#define KATANA_MBOX_RESET_REQUEST 0xC83A
123#define KATANA_MBOX_RESET_ACK 0xE430
124#define KATANA_MBOX_RESET_DONE 0x32E5
125
126#define HSL_PLD_BASE 0x00010000
127#define HSL_PLD_J4SGA_REG_OFF 0
128#define HSL_PLD_J4GA_REG_OFF 1
129#define HSL_PLD_J2GA_REG_OFF 2
130#define HSL_PLD_HOT_SWAP_OFF 6
131#define HSL_PLD_HOT_SWAP_LED_BIT 0x1
132#define GA_MASK 0x1f
133#define HSL_PLD_SIZE 0x1000
134#define K3750_GPP_GEO_ADDR_PINS 0xf8000000
135#define K3750_GPP_GEO_ADDR_SHIFT 27
136
137#define K3750_GPP_EVENT_PROC_0 (1 << 21)
138#define K3750_GPP_EVENT_PROC_1_2 (1 << 2)
139
140#define PCI_VENDOR_ID_ARTESYN 0x1223
141#define PCI_DEVICE_ID_KATANA_3750_PROC0 0x0041
142#define PCI_DEVICE_ID_KATANA_3750_PROC1 0x0042
143#define PCI_DEVICE_ID_KATANA_3750_PROC2 0x0043
144
145#define COPROC_MEM_FUNCTION 0
146#define COPROC_MEM_BAR 0
147#define COPROC_REGS_FUNCTION 0
148#define COPROC_REGS_BAR 4
149#define COPROC_FLASH_FUNCTION 2
150#define COPROC_FLASH_BAR 4
151
152#define KATANA_IPMB_LOCAL_I2C_ADDR 0x08
153
154#define KATANA_DEFAULT_BAUD 9600
155#define KATANA_MPSC_CLK_SRC 8 /* TCLK */
156
157#define KATANA_MTD_MONITOR_SIZE (1 << 20) /* 1 MB */
158
159#define KATANA_ETH0_PHY_ADDR 12
160#define KATANA_ETH1_PHY_ADDR 11
161#define KATANA_ETH2_PHY_ADDR 4
162
163#define KATANA_PRODUCT_ID_3750 0x01
164#define KATANA_PRODUCT_ID_750i 0x02
165#define KATANA_PRODUCT_ID_752i 0x04
166
167#define KATANA_ETH_TX_QUEUE_SIZE 800
168#define KATANA_ETH_RX_QUEUE_SIZE 400
169
170#define KATANA_ETH_PORT_CONFIG_VALUE \
171 ETH_UNICAST_NORMAL_MODE | \
172 ETH_DEFAULT_RX_QUEUE_0 | \
173 ETH_DEFAULT_RX_ARP_QUEUE_0 | \
174 ETH_RECEIVE_BC_IF_NOT_IP_OR_ARP | \
175 ETH_RECEIVE_BC_IF_IP | \
176 ETH_RECEIVE_BC_IF_ARP | \
177 ETH_CAPTURE_TCP_FRAMES_DIS | \
178 ETH_CAPTURE_UDP_FRAMES_DIS | \
179 ETH_DEFAULT_RX_TCP_QUEUE_0 | \
180 ETH_DEFAULT_RX_UDP_QUEUE_0 | \
181 ETH_DEFAULT_RX_BPDU_QUEUE_0
182
183#define KATANA_ETH_PORT_CONFIG_EXTEND_VALUE \
184 ETH_SPAN_BPDU_PACKETS_AS_NORMAL | \
185 ETH_PARTITION_DISABLE
186
187#define GT_ETH_IPG_INT_RX(value) \
188 ((value & 0x3fff) << 8)
189
190#define KATANA_ETH_PORT_SDMA_CONFIG_VALUE \
191 ETH_RX_BURST_SIZE_4_64BIT | \
192 GT_ETH_IPG_INT_RX(0) | \
193 ETH_TX_BURST_SIZE_4_64BIT
194
195#define KATANA_ETH_PORT_SERIAL_CONTROL_VALUE \
196 ETH_FORCE_LINK_PASS | \
197 ETH_ENABLE_AUTO_NEG_FOR_DUPLX | \
198 ETH_DISABLE_AUTO_NEG_FOR_FLOW_CTRL | \
199 ETH_ADV_SYMMETRIC_FLOW_CTRL | \
200 ETH_FORCE_FC_MODE_NO_PAUSE_DIS_TX | \
201 ETH_FORCE_BP_MODE_NO_JAM | \
202 BIT9 | \
203 ETH_DO_NOT_FORCE_LINK_FAIL | \
204 ETH_RETRANSMIT_16_ATTEMPTS | \
205 ETH_ENABLE_AUTO_NEG_SPEED_GMII | \
206 ETH_DTE_ADV_0 | \
207 ETH_DISABLE_AUTO_NEG_BYPASS | \
208 ETH_AUTO_NEG_NO_CHANGE | \
209 ETH_MAX_RX_PACKET_9700BYTE | \
210 ETH_CLR_EXT_LOOPBACK | \
211 ETH_SET_FULL_DUPLEX_MODE | \
212 ETH_ENABLE_FLOW_CTRL_TX_RX_IN_FULL_DUPLEX
213
214#ifndef __ASSEMBLY__
215
216typedef enum {
217 KATANA_ID_3750,
218 KATANA_ID_750I,
219 KATANA_ID_752I,
220 KATANA_ID_MAX
221} katana_id_t;
222
223#endif
224
225static inline u32
226katana_bus_freq(void __iomem *cpld_base)
227{
228 u8 bd_cfg_0;
229
230 bd_cfg_0 = in_8(cpld_base + KATANA_CPLD_BD_CFG_0);
231
232 switch (bd_cfg_0 & KATANA_CPLD_BD_CFG_0_SYSCLK_MASK) {
233 case KATANA_CPLD_BD_CFG_0_SYSCLK_200:
234 return 200000000;
235 break;
236
237 case KATANA_CPLD_BD_CFG_0_SYSCLK_166:
238 return 166666666;
239 break;
240
241 case KATANA_CPLD_BD_CFG_0_SYSCLK_133:
242 return 133333333;
243 break;
244
245 case KATANA_CPLD_BD_CFG_0_SYSCLK_100:
246 return 100000000;
247 break;
248
249 default:
250 return 133333333;
251 break;
252 }
253}
254
255#endif /* __PPC_PLATFORMS_KATANA_H */
diff --git a/arch/ppc/platforms/lantec.h b/arch/ppc/platforms/lantec.h
new file mode 100644
index 000000000000..8c87642c510f
--- /dev/null
+++ b/arch/ppc/platforms/lantec.h
@@ -0,0 +1,21 @@
1/*
2 * LANTEC board specific definitions
3 *
4 * Copyright (c) 2001 Wolfgang Denk (wd@denx.de)
5 */
6
7#ifndef __MACH_LANTEC_H
8#define __MACH_LANTEC_H
9
10#include <linux/config.h>
11
12#include <asm/ppcboot.h>
13
14#define IMAP_ADDR 0xFFF00000 /* physical base address of IMMR area */
15#define IMAP_SIZE (64 * 1024) /* mapped size of IMMR area */
16
17/* We don't use the 8259.
18*/
19#define NR_8259_INTS 0
20
21#endif /* __MACH_LANTEC_H */
diff --git a/arch/ppc/platforms/lite5200.c b/arch/ppc/platforms/lite5200.c
new file mode 100644
index 000000000000..b604cf8b3cae
--- /dev/null
+++ b/arch/ppc/platforms/lite5200.c
@@ -0,0 +1,236 @@
1/*
2 * arch/ppc/platforms/lite5200.c
3 *
4 * Platform support file for the Freescale LITE5200 based on MPC52xx.
5 * A maximum of this file should be moved to syslib/mpc52xx_?????
6 * so that new platform based on MPC52xx need a minimal platform file
7 * ( avoid code duplication )
8 *
9 *
10 * Maintainer : Sylvain Munaut <tnt@246tNt.com>
11 *
12 * Based on the 2.4 code written by Kent Borg,
13 * Dale Farnsworth <dale.farnsworth@mvista.com> and
14 * Wolfgang Denk <wd@denx.de>
15 *
16 * Copyright 2004-2005 Sylvain Munaut <tnt@246tNt.com>
17 * Copyright 2003 Motorola Inc.
18 * Copyright 2003 MontaVista Software Inc.
19 * Copyright 2003 DENX Software Engineering (wd@denx.de)
20 *
21 * This file is licensed under the terms of the GNU General Public License
22 * version 2. This program is licensed "as is" without any warranty of any
23 * kind, whether express or implied.
24 */
25
26#include <linux/config.h>
27#include <linux/initrd.h>
28#include <linux/seq_file.h>
29#include <linux/kdev_t.h>
30#include <linux/root_dev.h>
31#include <linux/console.h>
32#include <linux/module.h>
33
34#include <asm/bootinfo.h>
35#include <asm/io.h>
36#include <asm/mpc52xx.h>
37#include <asm/ppc_sys.h>
38
39#include <syslib/mpc52xx_pci.h>
40
41
42extern int powersave_nap;
43
44/* Board data given by U-Boot */
45bd_t __res;
46EXPORT_SYMBOL(__res); /* For modules */
47
48
49/* ======================================================================== */
50/* Platform specific code */
51/* ======================================================================== */
52
53/* Supported PSC function in "preference" order */
54struct mpc52xx_psc_func mpc52xx_psc_functions[] = {
55 { .id = 0,
56 .func = "uart",
57 },
58 { .id = -1, /* End entry */
59 .func = NULL,
60 }
61 };
62
63
64static int
65lite5200_show_cpuinfo(struct seq_file *m)
66{
67 seq_printf(m, "machine\t\t: Freescale LITE5200\n");
68 return 0;
69}
70
71#ifdef CONFIG_PCI
72static int
73lite5200_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
74{
75 return (pin == 1) && (idsel==24) ? MPC52xx_IRQ0 : -1;
76}
77#endif
78
79static void __init
80lite5200_setup_cpu(void)
81{
82 struct mpc52xx_cdm __iomem *cdm;
83 struct mpc52xx_gpio __iomem *gpio;
84 struct mpc52xx_intr __iomem *intr;
85 struct mpc52xx_xlb __iomem *xlb;
86
87 u32 port_config;
88 u32 intr_ctrl;
89
90 /* Map zones */
91 cdm = ioremap(MPC52xx_PA(MPC52xx_CDM_OFFSET), MPC52xx_CDM_SIZE);
92 gpio = ioremap(MPC52xx_PA(MPC52xx_GPIO_OFFSET), MPC52xx_GPIO_SIZE);
93 xlb = ioremap(MPC52xx_PA(MPC52xx_XLB_OFFSET), MPC52xx_XLB_SIZE);
94 intr = ioremap(MPC52xx_PA(MPC52xx_INTR_OFFSET), MPC52xx_INTR_SIZE);
95
96 if (!cdm || !gpio || !xlb || !intr) {
97 printk("lite5200.c: Error while mapping CDM/GPIO/XLB/INTR during"
98 "lite5200_setup_cpu\n");
99 goto unmap_regs;
100 }
101
102 /* Use internal 48 Mhz */
103 out_8(&cdm->ext_48mhz_en, 0x00);
104 out_8(&cdm->fd_enable, 0x01);
105 if (in_be32(&cdm->rstcfg) & 0x40) /* Assumes 33Mhz clock */
106 out_be16(&cdm->fd_counters, 0x0001);
107 else
108 out_be16(&cdm->fd_counters, 0x5555);
109
110 /* Get port mux config */
111 port_config = in_be32(&gpio->port_config);
112
113 /* 48Mhz internal, pin is GPIO */
114 port_config &= ~0x00800000;
115
116 /* USB port */
117 port_config &= ~0x00007000; /* Differential mode - USB1 only */
118 port_config |= 0x00001000;
119
120 /* Commit port config */
121 out_be32(&gpio->port_config, port_config);
122
123 /* Configure the XLB Arbiter */
124 out_be32(&xlb->master_pri_enable, 0xff);
125 out_be32(&xlb->master_priority, 0x11111111);
126
127 /* Enable ram snooping for 1GB window */
128 out_be32(&xlb->config, in_be32(&xlb->config) | MPC52xx_XLB_CFG_SNOOP);
129 out_be32(&xlb->snoop_window, MPC52xx_PCI_TARGET_MEM | 0x1d);
130
131 /* IRQ[0-3] setup : IRQ0 - Level Active Low */
132 /* IRQ[1-3] - Level Active High */
133 intr_ctrl = in_be32(&intr->ctrl);
134 intr_ctrl &= ~0x00ff0000;
135 intr_ctrl |= 0x00c00000;
136 out_be32(&intr->ctrl, intr_ctrl);
137
138 /* Unmap reg zone */
139unmap_regs:
140 if (cdm) iounmap(cdm);
141 if (gpio) iounmap(gpio);
142 if (xlb) iounmap(xlb);
143 if (intr) iounmap(intr);
144}
145
146static void __init
147lite5200_setup_arch(void)
148{
149 /* CPU & Port mux setup */
150 lite5200_setup_cpu();
151
152#ifdef CONFIG_PCI
153 /* PCI Bridge setup */
154 mpc52xx_find_bridges();
155#endif
156}
157
158void __init
159platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
160 unsigned long r6, unsigned long r7)
161{
162 /* Generic MPC52xx platform initialization */
163 /* TODO Create one and move a max of stuff in it.
164 Put this init in the syslib */
165
166 struct bi_record *bootinfo = find_bootinfo();
167
168 if (bootinfo)
169 parse_bootinfo(bootinfo);
170 else {
171 /* Load the bd_t board info structure */
172 if (r3)
173 memcpy((void*)&__res,(void*)(r3+KERNELBASE),
174 sizeof(bd_t));
175
176#ifdef CONFIG_BLK_DEV_INITRD
177 /* Load the initrd */
178 if (r4) {
179 initrd_start = r4 + KERNELBASE;
180 initrd_end = r5 + KERNELBASE;
181 }
182#endif
183
184 /* Load the command line */
185 if (r6) {
186 *(char *)(r7+KERNELBASE) = 0;
187 strcpy(cmd_line, (char *)(r6+KERNELBASE));
188 }
189 }
190
191 /* PPC Sys identification */
192 identify_ppc_sys_by_id(mfspr(SPRN_SVR));
193
194 /* BAT setup */
195 mpc52xx_set_bat();
196
197 /* No ISA bus by default */
198 isa_io_base = 0;
199 isa_mem_base = 0;
200
201 /* Powersave */
202 /* This is provided as an example on how to do it. But you
203 need to be aware that NAP disable bus snoop and that may
204 be required for some devices to work properly, like USB ... */
205 /* powersave_nap = 1; */
206
207
208 /* Setup the ppc_md struct */
209 ppc_md.setup_arch = lite5200_setup_arch;
210 ppc_md.show_cpuinfo = lite5200_show_cpuinfo;
211 ppc_md.show_percpuinfo = NULL;
212 ppc_md.init_IRQ = mpc52xx_init_irq;
213 ppc_md.get_irq = mpc52xx_get_irq;
214
215#ifdef CONFIG_PCI
216 ppc_md.pci_map_irq = lite5200_map_irq;
217#endif
218
219 ppc_md.find_end_of_memory = mpc52xx_find_end_of_memory;
220 ppc_md.setup_io_mappings = mpc52xx_map_io;
221
222 ppc_md.restart = mpc52xx_restart;
223 ppc_md.power_off = mpc52xx_power_off;
224 ppc_md.halt = mpc52xx_halt;
225
226 /* No time keeper on the LITE5200 */
227 ppc_md.time_init = NULL;
228 ppc_md.get_rtc_time = NULL;
229 ppc_md.set_rtc_time = NULL;
230
231 ppc_md.calibrate_decr = mpc52xx_calibrate_decr;
232#ifdef CONFIG_SERIAL_TEXT_DEBUG
233 ppc_md.progress = mpc52xx_progress;
234#endif
235}
236
diff --git a/arch/ppc/platforms/lite5200.h b/arch/ppc/platforms/lite5200.h
new file mode 100644
index 000000000000..c1de2aa47175
--- /dev/null
+++ b/arch/ppc/platforms/lite5200.h
@@ -0,0 +1,23 @@
1/*
2 * arch/ppc/platforms/lite5200.h
3 *
4 * Definitions for Freescale LITE5200 : MPC52xx Standard Development
5 * Platform board support
6 *
7 * Maintainer : Sylvain Munaut <tnt@246tNt.com>
8 *
9 * Copyright (C) 2004 Sylvain Munaut <tnt@246tNt.com>
10 *
11 * This file is licensed under the terms of the GNU General Public License
12 * version 2. This program is licensed "as is" without any warranty of any
13 * kind, whether express or implied.
14 */
15
16#ifndef __PLATFORMS_LITE5200_H__
17#define __PLATFORMS_LITE5200_H__
18
19/* Serial port used for low-level debug */
20#define MPC52xx_PF_CONSOLE_PORT 1 /* PSC1 */
21
22
23#endif /* __PLATFORMS_LITE5200_H__ */
diff --git a/arch/ppc/platforms/lopec.c b/arch/ppc/platforms/lopec.c
new file mode 100644
index 000000000000..a5569525e0af
--- /dev/null
+++ b/arch/ppc/platforms/lopec.c
@@ -0,0 +1,411 @@
1/*
2 * arch/ppc/platforms/lopec.c
3 *
4 * Setup routines for the Motorola LoPEC.
5 *
6 * Author: Dan Cox
7 * Maintainer: Tom Rini <trini@kernel.crashing.org>
8 *
9 * 2001-2004 (c) MontaVista, Software, Inc. This file is licensed under
10 * the terms of the GNU General Public License version 2. This program
11 * is licensed "as is" without any warranty of any kind, whether express
12 * or implied.
13 */
14
15#include <linux/config.h>
16#include <linux/types.h>
17#include <linux/delay.h>
18#include <linux/pci_ids.h>
19#include <linux/ioport.h>
20#include <linux/init.h>
21#include <linux/ide.h>
22#include <linux/seq_file.h>
23#include <linux/initrd.h>
24#include <linux/console.h>
25#include <linux/root_dev.h>
26#include <linux/pci.h>
27
28#include <asm/machdep.h>
29#include <asm/pci-bridge.h>
30#include <asm/io.h>
31#include <asm/open_pic.h>
32#include <asm/i8259.h>
33#include <asm/todc.h>
34#include <asm/bootinfo.h>
35#include <asm/mpc10x.h>
36#include <asm/hw_irq.h>
37#include <asm/prep_nvram.h>
38#include <asm/kgdb.h>
39
40/*
41 * Define all of the IRQ senses and polarities. Taken from the
42 * LoPEC Programmer's Reference Guide.
43 */
44static u_char lopec_openpic_initsenses[16] __initdata = {
45 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* IRQ 0 */
46 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* IRQ 1 */
47 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* IRQ 2 */
48 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* IRQ 3 */
49 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* IRQ 4 */
50 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* IRQ 5 */
51 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* IRQ 6 */
52 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* IRQ 7 */
53 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* IRQ 8 */
54 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* IRQ 9 */
55 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* IRQ 10 */
56 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* IRQ 11 */
57 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* IRQ 12 */
58 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* IRQ 13 */
59 (IRQ_SENSE_EDGE | IRQ_POLARITY_NEGATIVE), /* IRQ 14 */
60 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE) /* IRQ 15 */
61};
62
63static inline int __init
64lopec_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
65{
66 int irq;
67 static char pci_irq_table[][4] = {
68 {16, 0, 0, 0}, /* ID 11 - Winbond */
69 {22, 0, 0, 0}, /* ID 12 - SCSI */
70 {0, 0, 0, 0}, /* ID 13 - nothing */
71 {17, 0, 0, 0}, /* ID 14 - 82559 Ethernet */
72 {27, 0, 0, 0}, /* ID 15 - USB */
73 {23, 0, 0, 0}, /* ID 16 - PMC slot 1 */
74 {24, 0, 0, 0}, /* ID 17 - PMC slot 2 */
75 {25, 0, 0, 0}, /* ID 18 - PCI slot */
76 {0, 0, 0, 0}, /* ID 19 - nothing */
77 {0, 0, 0, 0}, /* ID 20 - nothing */
78 {0, 0, 0, 0}, /* ID 21 - nothing */
79 {0, 0, 0, 0}, /* ID 22 - nothing */
80 {0, 0, 0, 0}, /* ID 23 - nothing */
81 {0, 0, 0, 0}, /* ID 24 - PMC slot 1b */
82 {0, 0, 0, 0}, /* ID 25 - nothing */
83 {0, 0, 0, 0} /* ID 26 - PMC Slot 2b */
84 };
85 const long min_idsel = 11, max_idsel = 26, irqs_per_slot = 4;
86
87 irq = PCI_IRQ_TABLE_LOOKUP;
88 if (!irq)
89 return 0;
90
91 return irq;
92}
93
94static void __init
95lopec_setup_winbond_83553(struct pci_controller *hose)
96{
97 int devfn;
98
99 devfn = PCI_DEVFN(11,0);
100
101 /* IDE interrupt routing (primary 14, secondary 15) */
102 early_write_config_byte(hose, 0, devfn, 0x43, 0xef);
103 /* PCI interrupt routing */
104 early_write_config_word(hose, 0, devfn, 0x44, 0x0000);
105
106 /* ISA-PCI address decoder */
107 early_write_config_byte(hose, 0, devfn, 0x48, 0xf0);
108
109 /* RTC, kb, not used in PPC */
110 early_write_config_byte(hose, 0, devfn, 0x4d, 0x00);
111 early_write_config_byte(hose, 0, devfn, 0x4e, 0x04);
112 devfn = PCI_DEVFN(11, 1);
113 early_write_config_byte(hose, 0, devfn, 0x09, 0x8f);
114 early_write_config_dword(hose, 0, devfn, 0x40, 0x00ff0011);
115}
116
117static void __init
118lopec_find_bridges(void)
119{
120 struct pci_controller *hose;
121
122 hose = pcibios_alloc_controller();
123 if (!hose)
124 return;
125
126 hose->first_busno = 0;
127 hose->last_busno = 0xff;
128
129 if (mpc10x_bridge_init(hose, MPC10X_MEM_MAP_B, MPC10X_MEM_MAP_B,
130 MPC10X_MAPB_EUMB_BASE) == 0) {
131
132 hose->mem_resources[0].end = 0xffffffff;
133 lopec_setup_winbond_83553(hose);
134 hose->last_busno = pciauto_bus_scan(hose, hose->first_busno);
135 ppc_md.pci_swizzle = common_swizzle;
136 ppc_md.pci_map_irq = lopec_map_irq;
137 }
138}
139
140static int
141lopec_show_cpuinfo(struct seq_file *m)
142{
143 seq_printf(m, "machine\t\t: Motorola LoPEC\n");
144 return 0;
145}
146
147static u32
148lopec_irq_canonicalize(u32 irq)
149{
150 if (irq == 2)
151 return 9;
152 else
153 return irq;
154}
155
156static void
157lopec_restart(char *cmd)
158{
159#define LOPEC_SYSSTAT1 0xffe00000
160 /* force a hard reset, if possible */
161 unsigned char reg = *((unsigned char *) LOPEC_SYSSTAT1);
162 reg |= 0x80;
163 *((unsigned char *) LOPEC_SYSSTAT1) = reg;
164
165 local_irq_disable();
166 while(1);
167#undef LOPEC_SYSSTAT1
168}
169
170static void
171lopec_halt(void)
172{
173 local_irq_disable();
174 while(1);
175}
176
177static void
178lopec_power_off(void)
179{
180 lopec_halt();
181}
182
183#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
184int lopec_ide_ports_known = 0;
185static unsigned long lopec_ide_regbase[MAX_HWIFS];
186static unsigned long lopec_ide_ctl_regbase[MAX_HWIFS];
187static unsigned long lopec_idedma_regbase;
188
189static void
190lopec_ide_probe(void)
191{
192 struct pci_dev *dev = pci_get_device(PCI_VENDOR_ID_WINBOND,
193 PCI_DEVICE_ID_WINBOND_82C105,
194 NULL);
195 lopec_ide_ports_known = 1;
196
197 if (dev) {
198 lopec_ide_regbase[0] = dev->resource[0].start;
199 lopec_ide_regbase[1] = dev->resource[2].start;
200 lopec_ide_ctl_regbase[0] = dev->resource[1].start;
201 lopec_ide_ctl_regbase[1] = dev->resource[3].start;
202 lopec_idedma_regbase = dev->resource[4].start;
203 pci_dev_put(dev);
204 }
205}
206
207static int
208lopec_ide_default_irq(unsigned long base)
209{
210 if (lopec_ide_ports_known == 0)
211 lopec_ide_probe();
212
213 if (base == lopec_ide_regbase[0])
214 return 14;
215 else if (base == lopec_ide_regbase[1])
216 return 15;
217 else
218 return 0;
219}
220
221static unsigned long
222lopec_ide_default_io_base(int index)
223{
224 if (lopec_ide_ports_known == 0)
225 lopec_ide_probe();
226 return lopec_ide_regbase[index];
227}
228
229static void __init
230lopec_ide_init_hwif_ports(hw_regs_t *hw, unsigned long data,
231 unsigned long ctl, int *irq)
232{
233 unsigned long reg = data;
234 uint alt_status_base;
235 int i;
236
237 for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++)
238 hw->io_ports[i] = reg++;
239
240 if (data == lopec_ide_regbase[0]) {
241 alt_status_base = lopec_ide_ctl_regbase[0] + 2;
242 hw->irq = 14;
243 } else if (data == lopec_ide_regbase[1]) {
244 alt_status_base = lopec_ide_ctl_regbase[1] + 2;
245 hw->irq = 15;
246 } else {
247 alt_status_base = 0;
248 hw->irq = 0;
249 }
250
251 if (ctl)
252 hw->io_ports[IDE_CONTROL_OFFSET] = ctl;
253 else
254 hw->io_ports[IDE_CONTROL_OFFSET] = alt_status_base;
255
256 if (irq != NULL)
257 *irq = hw->irq;
258
259}
260#endif /* BLK_DEV_IDE */
261
262static void __init
263lopec_init_IRQ(void)
264{
265 int i;
266
267 /*
268 * Provide the open_pic code with the correct table of interrupts.
269 */
270 OpenPIC_InitSenses = lopec_openpic_initsenses;
271 OpenPIC_NumInitSenses = sizeof(lopec_openpic_initsenses);
272
273 mpc10x_set_openpic();
274
275 /* We have a cascade on OpenPIC IRQ 0, Linux IRQ 16 */
276 openpic_hookup_cascade(NUM_8259_INTERRUPTS, "82c59 cascade",
277 &i8259_irq);
278
279 /* Map i8259 interrupts */
280 for(i = 0; i < NUM_8259_INTERRUPTS; i++)
281 irq_desc[i].handler = &i8259_pic;
282
283 /*
284 * The EPIC allows for a read in the range of 0xFEF00000 ->
285 * 0xFEFFFFFF to generate a PCI interrupt-acknowledge transaction.
286 */
287 i8259_init(0xfef00000);
288}
289
290static int __init
291lopec_request_io(void)
292{
293 outb(0x00, 0x4d0);
294 outb(0xc0, 0x4d1);
295
296 request_region(0x00, 0x20, "dma1");
297 request_region(0x20, 0x20, "pic1");
298 request_region(0x40, 0x20, "timer");
299 request_region(0x80, 0x10, "dma page reg");
300 request_region(0xa0, 0x20, "pic2");
301 request_region(0xc0, 0x20, "dma2");
302
303 return 0;
304}
305
306device_initcall(lopec_request_io);
307
308static void __init
309lopec_map_io(void)
310{
311 io_block_mapping(0xf0000000, 0xf0000000, 0x10000000, _PAGE_IO);
312 io_block_mapping(0xb0000000, 0xb0000000, 0x10000000, _PAGE_IO);
313}
314
315/*
316 * Set BAT 3 to map 0xf8000000 to end of physical memory space 1-to-1.
317 */
318static __inline__ void
319lopec_set_bat(void)
320{
321 mb();
322 mtspr(SPRN_DBAT1U, 0xf8000ffe);
323 mtspr(SPRN_DBAT1L, 0xf800002a);
324 mb();
325}
326
327TODC_ALLOC();
328
329static void __init
330lopec_setup_arch(void)
331{
332
333 TODC_INIT(TODC_TYPE_MK48T37, 0, 0,
334 ioremap(0xffe80000, 0x8000), 8);
335
336 loops_per_jiffy = 100000000/HZ;
337
338 lopec_find_bridges();
339
340#ifdef CONFIG_BLK_DEV_INITRD
341 if (initrd_start)
342 ROOT_DEV = Root_RAM0;
343 else
344#elif defined(CONFIG_ROOT_NFS)
345 ROOT_DEV = Root_NFS;
346#elif defined(CONFIG_BLK_DEV_IDEDISK)
347 ROOT_DEV = Root_HDA1;
348#else
349 ROOT_DEV = Root_SDA1;
350#endif
351
352#ifdef CONFIG_PPCBUG_NVRAM
353 /* Read in NVRAM data */
354 init_prep_nvram();
355
356 /* if no bootargs, look in NVRAM */
357 if ( cmd_line[0] == '\0' ) {
358 char *bootargs;
359 bootargs = prep_nvram_get_var("bootargs");
360 if (bootargs != NULL) {
361 strcpy(cmd_line, bootargs);
362 /* again.. */
363 strcpy(saved_command_line, cmd_line);
364 }
365 }
366#endif
367}
368
369void __init
370platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
371 unsigned long r6, unsigned long r7)
372{
373 parse_bootinfo(find_bootinfo());
374 lopec_set_bat();
375
376 isa_io_base = MPC10X_MAPB_ISA_IO_BASE;
377 isa_mem_base = MPC10X_MAPB_ISA_MEM_BASE;
378 pci_dram_offset = MPC10X_MAPB_DRAM_OFFSET;
379 ISA_DMA_THRESHOLD = 0x00ffffff;
380 DMA_MODE_READ = 0x44;
381 DMA_MODE_WRITE = 0x48;
382
383 ppc_md.setup_arch = lopec_setup_arch;
384 ppc_md.show_cpuinfo = lopec_show_cpuinfo;
385 ppc_md.irq_canonicalize = lopec_irq_canonicalize;
386 ppc_md.init_IRQ = lopec_init_IRQ;
387 ppc_md.get_irq = openpic_get_irq;
388
389 ppc_md.restart = lopec_restart;
390 ppc_md.power_off = lopec_power_off;
391 ppc_md.halt = lopec_halt;
392
393 ppc_md.setup_io_mappings = lopec_map_io;
394
395 ppc_md.time_init = todc_time_init;
396 ppc_md.set_rtc_time = todc_set_rtc_time;
397 ppc_md.get_rtc_time = todc_get_rtc_time;
398 ppc_md.calibrate_decr = todc_calibrate_decr;
399
400 ppc_md.nvram_read_val = todc_direct_read_val;
401 ppc_md.nvram_write_val = todc_direct_write_val;
402
403#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
404 ppc_ide_md.default_irq = lopec_ide_default_irq;
405 ppc_ide_md.default_io_base = lopec_ide_default_io_base;
406 ppc_ide_md.ide_init_hwif = lopec_ide_init_hwif_ports;
407#endif
408#ifdef CONFIG_SERIAL_TEXT_DEBUG
409 ppc_md.progress = gen550_progress;
410#endif
411}
diff --git a/arch/ppc/platforms/lopec.h b/arch/ppc/platforms/lopec.h
new file mode 100644
index 000000000000..5490edb2d263
--- /dev/null
+++ b/arch/ppc/platforms/lopec.h
@@ -0,0 +1,39 @@
1/*
2 * include/asm-ppc/lopec_serial.h
3 *
4 * Definitions for Motorola LoPEC board.
5 *
6 * Author: Dan Cox
7 * danc@mvista.com (or, alternately, source@mvista.com)
8 *
9 * 2001 (c) MontaVista, Software, Inc. This file is licensed under
10 * the terms of the GNU General Public License version 2. This program
11 * is licensed "as is" without any warranty of any kind, whether express
12 * or implied.
13 */
14
15#ifndef __H_LOPEC_SERIAL
16#define __H_LOPEC_SERIAL
17
18#define RS_TABLE_SIZE 3
19
20#define BASE_BAUD (1843200 / 16)
21
22#ifdef CONFIG_SERIAL_DETECT_IRQ
23#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_SKIP_TEST|ASYNC_AUTO_IRQ)
24#else
25#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_SKIP_TEST)
26#endif
27
28#define SERIAL_PORT_DFNS \
29 { 0, BASE_BAUD, 0xffe10000, 29, STD_COM_FLAGS, \
30 iomem_base: (u8 *) 0xffe10000, \
31 io_type: SERIAL_IO_MEM }, \
32 { 0, BASE_BAUD, 0xffe11000, 20, STD_COM_FLAGS, \
33 iomem_base: (u8 *) 0xffe11000, \
34 io_type: SERIAL_IO_MEM }, \
35 { 0, BASE_BAUD, 0xffe12000, 21, STD_COM_FLAGS, \
36 iomem_base: (u8 *) 0xffe12000, \
37 io_type: SERIAL_IO_MEM }
38
39#endif
diff --git a/arch/ppc/platforms/lwmon.h b/arch/ppc/platforms/lwmon.h
new file mode 100644
index 000000000000..995bf5112df0
--- /dev/null
+++ b/arch/ppc/platforms/lwmon.h
@@ -0,0 +1,60 @@
1/*
2 * Liebherr LWMON board specific definitions
3 *
4 * Copyright (c) 2001 Wolfgang Denk (wd@denx.de)
5 */
6
7#ifndef __MACH_LWMON_H
8#define __MACH_LWMON_H
9
10#include <linux/config.h>
11
12#include <asm/ppcboot.h>
13
14#define IMAP_ADDR 0xFFF00000 /* physical base address of IMMR area */
15#define IMAP_SIZE (64 * 1024) /* mapped size of IMMR area */
16
17/*-----------------------------------------------------------------------
18 * PCMCIA stuff
19 *-----------------------------------------------------------------------
20 *
21 */
22#define PCMCIA_MEM_SIZE ( 64 << 20 )
23
24#define MAX_HWIFS 1 /* overwrite default in include/asm-ppc/ide.h */
25
26/*
27 * Definitions for IDE0 Interface
28 */
29#define IDE0_BASE_OFFSET 0
30#define IDE0_DATA_REG_OFFSET (PCMCIA_MEM_SIZE + 0x320)
31#define IDE0_ERROR_REG_OFFSET (2 * PCMCIA_MEM_SIZE + 0x320 + 1)
32#define IDE0_NSECTOR_REG_OFFSET (2 * PCMCIA_MEM_SIZE + 0x320 + 2)
33#define IDE0_SECTOR_REG_OFFSET (2 * PCMCIA_MEM_SIZE + 0x320 + 3)
34#define IDE0_LCYL_REG_OFFSET (2 * PCMCIA_MEM_SIZE + 0x320 + 4)
35#define IDE0_HCYL_REG_OFFSET (2 * PCMCIA_MEM_SIZE + 0x320 + 5)
36#define IDE0_SELECT_REG_OFFSET (2 * PCMCIA_MEM_SIZE + 0x320 + 6)
37#define IDE0_STATUS_REG_OFFSET (2 * PCMCIA_MEM_SIZE + 0x320 + 7)
38#define IDE0_CONTROL_REG_OFFSET 0x0106
39#define IDE0_IRQ_REG_OFFSET 0x000A /* not used */
40
41#define IDE0_INTERRUPT 13
42
43/*
44 * Definitions for I2C devices
45 */
46#define I2C_ADDR_AUDIO 0x28 /* Audio volume control */
47#define I2C_ADDR_SYSMON 0x2E /* LM87 System Monitor */
48#define I2C_ADDR_RTC 0x51 /* PCF8563 RTC */
49#define I2C_ADDR_POWER_A 0x52 /* PCMCIA/USB power switch, channel A */
50#define I2C_ADDR_POWER_B 0x53 /* PCMCIA/USB power switch, channel B */
51#define I2C_ADDR_KEYBD 0x56 /* PIC LWE keyboard */
52#define I2C_ADDR_PICIO 0x57 /* PIC IO Expander */
53#define I2C_ADDR_EEPROM 0x58 /* EEPROM AT24C164 */
54
55
56/* We don't use the 8259.
57*/
58#define NR_8259_INTS 0
59
60#endif /* __MACH_LWMON_H */
diff --git a/arch/ppc/platforms/mbx.h b/arch/ppc/platforms/mbx.h
new file mode 100644
index 000000000000..fe81ca4ea0a2
--- /dev/null
+++ b/arch/ppc/platforms/mbx.h
@@ -0,0 +1,117 @@
1/*
2 * A collection of structures, addresses, and values associated with
3 * the Motorola MBX boards. This was originally created for the
4 * MBX860, and probably needs revisions for other boards (like the 821).
5 * When this file gets out of control, we can split it up into more
6 * meaningful pieces.
7 *
8 * Copyright (c) 1997 Dan Malek (dmalek@jlc.net)
9 */
10#ifdef __KERNEL__
11#ifndef __MACH_MBX_DEFS
12#define __MACH_MBX_DEFS
13
14#ifndef __ASSEMBLY__
15/* A Board Information structure that is given to a program when
16 * EPPC-Bug starts it up.
17 */
18typedef struct bd_info {
19 unsigned int bi_tag; /* Should be 0x42444944 "BDID" */
20 unsigned int bi_size; /* Size of this structure */
21 unsigned int bi_revision; /* revision of this structure */
22 unsigned int bi_bdate; /* EPPCbug date, i.e. 0x11061997 */
23 unsigned int bi_memstart; /* Memory start address */
24 unsigned int bi_memsize; /* Memory (end) size in bytes */
25 unsigned int bi_intfreq; /* Internal Freq, in Hz */
26 unsigned int bi_busfreq; /* Bus Freq, in Hz */
27 unsigned int bi_clun; /* Boot device controller */
28 unsigned int bi_dlun; /* Boot device logical dev */
29
30 /* These fields are not part of the board information structure
31 * provided by the boot rom. They are filled in by embed_config.c
32 * so we have the information consistent with other platforms.
33 */
34 unsigned char bi_enetaddr[6];
35 unsigned int bi_baudrate;
36} bd_t;
37
38/* Memory map for the MBX as configured by EPPC-Bug. We could reprogram
39 * The SIU and PCI bridge, and try to use larger MMU pages, but the
40 * performance gain is not measureable and it certainly complicates the
41 * generic MMU model.
42 *
43 * In a effort to minimize memory usage for embedded applications, any
44 * PCI driver or ISA driver must request or map the region required by
45 * the device. For convenience (and since we can map up to 4 Mbytes with
46 * a single page table page), the MMU initialization will map the
47 * NVRAM, Status/Control registers, CPM Dual Port RAM, and the PCI
48 * Bridge CSRs 1:1 into the kernel address space.
49 */
50#define PCI_ISA_IO_ADDR ((unsigned)0x80000000)
51#define PCI_ISA_IO_SIZE ((uint)(512 * 1024 * 1024))
52#define PCI_IDE_ADDR ((unsigned)0x81000000)
53#define PCI_ISA_MEM_ADDR ((unsigned)0xc0000000)
54#define PCI_ISA_MEM_SIZE ((uint)(512 * 1024 * 1024))
55#define PCMCIA_MEM_ADDR ((uint)0xe0000000)
56#define PCMCIA_MEM_SIZE ((uint)(64 * 1024 * 1024))
57#define PCMCIA_DMA_ADDR ((uint)0xe4000000)
58#define PCMCIA_DMA_SIZE ((uint)(64 * 1024 * 1024))
59#define PCMCIA_ATTRB_ADDR ((uint)0xe8000000)
60#define PCMCIA_ATTRB_SIZE ((uint)(64 * 1024 * 1024))
61#define PCMCIA_IO_ADDR ((uint)0xec000000)
62#define PCMCIA_IO_SIZE ((uint)(64 * 1024 * 1024))
63#define NVRAM_ADDR ((uint)0xfa000000)
64#define NVRAM_SIZE ((uint)(1 * 1024 * 1024))
65#define MBX_CSR_ADDR ((uint)0xfa100000)
66#define MBX_CSR_SIZE ((uint)(1 * 1024 * 1024))
67#define IMAP_ADDR ((uint)0xfa200000)
68#define IMAP_SIZE ((uint)(64 * 1024))
69#define PCI_CSR_ADDR ((uint)0xfa210000)
70#define PCI_CSR_SIZE ((uint)(64 * 1024))
71
72/* Map additional physical space into well known virtual addresses. Due
73 * to virtual address mapping, these physical addresses are not accessible
74 * in a 1:1 virtual to physical mapping.
75 */
76#define ISA_IO_VIRT_ADDR ((uint)0xfa220000)
77#define ISA_IO_VIRT_SIZE ((uint)64 * 1024)
78
79/* Interrupt assignments.
80 * These are defined (and fixed) by the MBX hardware implementation.
81 */
82#define POWER_FAIL_INT SIU_IRQ0 /* Power fail */
83#define TEMP_HILO_INT SIU_IRQ1 /* Temperature sensor */
84#define QSPAN_INT SIU_IRQ2 /* PCI Bridge (DMA CTLR?) */
85#define ISA_BRIDGE_INT SIU_IRQ3 /* All those PC things */
86#define COMM_L_INT SIU_IRQ6 /* MBX Comm expansion connector pin */
87#define STOP_ABRT_INT SIU_IRQ7 /* Stop/Abort header pin */
88
89/* CPM Ethernet through SCCx.
90 *
91 * Bits in parallel I/O port registers that have to be set/cleared
92 * to configure the pins for SCC1 use. The TCLK and RCLK seem unique
93 * to the MBX860 board. Any two of the four available clocks could be
94 * used, and the MPC860 cookbook manual has an example using different
95 * clock pins.
96 */
97#define PA_ENET_RXD ((ushort)0x0001)
98#define PA_ENET_TXD ((ushort)0x0002)
99#define PA_ENET_TCLK ((ushort)0x0200)
100#define PA_ENET_RCLK ((ushort)0x0800)
101#define PC_ENET_TENA ((ushort)0x0001)
102#define PC_ENET_CLSN ((ushort)0x0010)
103#define PC_ENET_RENA ((ushort)0x0020)
104
105/* Control bits in the SICR to route TCLK (CLK2) and RCLK (CLK4) to
106 * SCC1. Also, make sure GR1 (bit 24) and SC1 (bit 25) are zero.
107 */
108#define SICR_ENET_MASK ((uint)0x000000ff)
109#define SICR_ENET_CLKRT ((uint)0x0000003d)
110
111/* The MBX uses the 8259.
112*/
113#define NR_8259_INTS 16
114
115#endif /* !__ASSEMBLY__ */
116#endif /* __MACH_MBX_DEFS */
117#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/mcpn765.c b/arch/ppc/platforms/mcpn765.c
new file mode 100644
index 000000000000..e88d294ea593
--- /dev/null
+++ b/arch/ppc/platforms/mcpn765.c
@@ -0,0 +1,527 @@
1/*
2 * arch/ppc/platforms/mcpn765.c
3 *
4 * Board setup routines for the Motorola MCG MCPN765 cPCI Board.
5 *
6 * Author: Mark A. Greer
7 * mgreer@mvista.com
8 *
9 * Modified by Randy Vinson (rvinson@mvista.com)
10 *
11 * 2001-2002 (c) MontaVista, Software, Inc. This file is licensed under
12 * the terms of the GNU General Public License version 2. This program
13 * is licensed "as is" without any warranty of any kind, whether express
14 * or implied.
15 */
16
17/*
18 * This file adds support for the Motorola MCG MCPN765.
19 */
20#include <linux/config.h>
21#include <linux/stddef.h>
22#include <linux/kernel.h>
23#include <linux/init.h>
24#include <linux/errno.h>
25#include <linux/reboot.h>
26#include <linux/pci.h>
27#include <linux/kdev_t.h>
28#include <linux/major.h>
29#include <linux/initrd.h>
30#include <linux/console.h>
31#include <linux/delay.h>
32#include <linux/irq.h>
33#include <linux/seq_file.h>
34#include <linux/root_dev.h>
35#include <linux/serial.h>
36#include <linux/tty.h> /* for linux/serial_core.h */
37#include <linux/serial_core.h>
38#include <linux/slab.h>
39
40#include <asm/system.h>
41#include <asm/pgtable.h>
42#include <asm/page.h>
43#include <asm/time.h>
44#include <asm/dma.h>
45#include <asm/byteorder.h>
46#include <asm/io.h>
47#include <asm/machdep.h>
48#include <asm/prom.h>
49#include <asm/smp.h>
50#include <asm/open_pic.h>
51#include <asm/i8259.h>
52#include <asm/todc.h>
53#include <asm/pci-bridge.h>
54#include <asm/irq.h>
55#include <asm/uaccess.h>
56#include <asm/bootinfo.h>
57#include <asm/hawk.h>
58#include <asm/kgdb.h>
59
60#include "mcpn765.h"
61
62static u_char mcpn765_openpic_initsenses[] __initdata = {
63 (IRQ_SENSE_EDGE | IRQ_POLARITY_POSITIVE),/* 16: i8259 cascade */
64 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 17: COM1,2,3,4 */
65 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 18: Enet 1 (front) */
66 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 19: HAWK WDT XXXX */
67 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 20: 21554 bridge */
68 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 21: cPCI INTA# */
69 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 22: cPCI INTB# */
70 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 23: cPCI INTC# */
71 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 24: cPCI INTD# */
72 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 25: PMC1 INTA#,PMC2 INTB#*/
73 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 26: PMC1 INTB#,PMC2 INTC#*/
74 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 27: PMC1 INTC#,PMC2 INTD#*/
75 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 28: PMC1 INTD#,PMC2 INTA#*/
76 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 29: Enet 2 (J3) */
77 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 30: Abort Switch */
78 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 31: RTC Alarm */
79};
80
81extern void mcpn765_set_VIA_IDE_native(void);
82
83extern u_int openpic_irq(void);
84extern char cmd_line[];
85
86extern void gen550_progress(char *, unsigned short);
87extern void gen550_init(int, struct uart_port *);
88
89int use_of_interrupt_tree = 0;
90
91static void mcpn765_halt(void);
92
93TODC_ALLOC();
94
95/*
96 * Motorola MCG MCPN765 interrupt routing.
97 */
98static inline int
99mcpn765_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
100{
101 static char pci_irq_table[][4] =
102 /*
103 * PCI IDSEL/INTPIN->INTLINE
104 * A B C D
105 */
106 {
107 { 14, 0, 0, 0 }, /* IDSEL 11 - have to manually set */
108 { 0, 0, 0, 0 }, /* IDSEL 12 - unused */
109 { 0, 0, 0, 0 }, /* IDSEL 13 - unused */
110 { 18, 0, 0, 0 }, /* IDSEL 14 - Enet 0 */
111 { 0, 0, 0, 0 }, /* IDSEL 15 - unused */
112 { 25, 26, 27, 28 }, /* IDSEL 16 - PMC Slot 1 */
113 { 28, 25, 26, 27 }, /* IDSEL 17 - PMC Slot 2 */
114 { 0, 0, 0, 0 }, /* IDSEL 18 - PMC 2B Connector XXXX */
115 { 29, 0, 0, 0 }, /* IDSEL 19 - Enet 1 */
116 { 20, 0, 0, 0 }, /* IDSEL 20 - 21554 cPCI bridge */
117 };
118
119 const long min_idsel = 11, max_idsel = 20, irqs_per_slot = 4;
120 return PCI_IRQ_TABLE_LOOKUP;
121}
122
123void __init
124mcpn765_set_VIA_IDE_legacy(void)
125{
126 unsigned short vend, dev;
127
128 early_read_config_word(0, 0, PCI_DEVFN(0xb, 1), PCI_VENDOR_ID, &vend);
129 early_read_config_word(0, 0, PCI_DEVFN(0xb, 1), PCI_DEVICE_ID, &dev);
130
131 if ((vend == PCI_VENDOR_ID_VIA) &&
132 (dev == PCI_DEVICE_ID_VIA_82C586_1)) {
133
134 unsigned char temp;
135
136 /* put back original "standard" port base addresses */
137 early_write_config_dword(0, 0, PCI_DEVFN(0xb, 1),
138 PCI_BASE_ADDRESS_0, 0x1f1);
139 early_write_config_dword(0, 0, PCI_DEVFN(0xb, 1),
140 PCI_BASE_ADDRESS_1, 0x3f5);
141 early_write_config_dword(0, 0, PCI_DEVFN(0xb, 1),
142 PCI_BASE_ADDRESS_2, 0x171);
143 early_write_config_dword(0, 0, PCI_DEVFN(0xb, 1),
144 PCI_BASE_ADDRESS_3, 0x375);
145 early_write_config_dword(0, 0, PCI_DEVFN(0xb, 1),
146 PCI_BASE_ADDRESS_4, 0xcc01);
147
148 /* put into legacy mode */
149 early_read_config_byte(0, 0, PCI_DEVFN(0xb, 1), PCI_CLASS_PROG,
150 &temp);
151 temp &= ~0x05;
152 early_write_config_byte(0, 0, PCI_DEVFN(0xb, 1), PCI_CLASS_PROG,
153 temp);
154 }
155}
156
157void
158mcpn765_set_VIA_IDE_native(void)
159{
160 unsigned short vend, dev;
161
162 early_read_config_word(0, 0, PCI_DEVFN(0xb, 1), PCI_VENDOR_ID, &vend);
163 early_read_config_word(0, 0, PCI_DEVFN(0xb, 1), PCI_DEVICE_ID, &dev);
164
165 if ((vend == PCI_VENDOR_ID_VIA) &&
166 (dev == PCI_DEVICE_ID_VIA_82C586_1)) {
167
168 unsigned char temp;
169
170 /* put into native mode */
171 early_read_config_byte(0, 0, PCI_DEVFN(0xb, 1), PCI_CLASS_PROG,
172 &temp);
173 temp |= 0x05;
174 early_write_config_byte(0, 0, PCI_DEVFN(0xb, 1), PCI_CLASS_PROG,
175 temp);
176 }
177}
178
179/*
180 * Initialize the VIA 82c586b.
181 */
182static void __init
183mcpn765_setup_via_82c586b(void)
184{
185 struct pci_dev *dev;
186 u_char c;
187
188 if ((dev = pci_get_device(PCI_VENDOR_ID_VIA,
189 PCI_DEVICE_ID_VIA_82C586_0,
190 NULL)) == NULL) {
191 printk("No VIA ISA bridge found\n");
192 mcpn765_halt();
193 /* NOTREACHED */
194 }
195
196 /*
197 * If the firmware left the EISA 4d0/4d1 ports enabled, make sure
198 * IRQ 14 is set for edge.
199 */
200 pci_read_config_byte(dev, 0x47, &c);
201
202 if (c & (1<<5)) {
203 c = inb(0x4d1);
204 c &= ~(1<<6);
205 outb(c, 0x4d1);
206 }
207
208 /* Disable PNP IRQ routing since we use the Hawk's MPIC */
209 pci_write_config_dword(dev, 0x54, 0);
210 pci_write_config_byte(dev, 0x58, 0);
211
212 pci_dev_put(dev);
213 if ((dev = pci_get_device(PCI_VENDOR_ID_VIA,
214 PCI_DEVICE_ID_VIA_82C586_1,
215 NULL)) == NULL) {
216 printk("No VIA ISA bridge found\n");
217 mcpn765_halt();
218 /* NOTREACHED */
219 }
220
221 /*
222 * PPCBug doesn't set the enable bits for the IDE device.
223 * Turn them on now.
224 */
225 pci_read_config_byte(dev, 0x40, &c);
226 c |= 0x03;
227 pci_write_config_byte(dev, 0x40, c);
228 pci_dev_put(dev);
229
230 return;
231}
232
233void __init
234mcpn765_pcibios_fixup(void)
235{
236 /* Do MCPN765 board specific initialization. */
237 mcpn765_setup_via_82c586b();
238}
239
240void __init
241mcpn765_find_bridges(void)
242{
243 struct pci_controller *hose;
244
245 hose = pcibios_alloc_controller();
246
247 if (!hose)
248 return;
249
250 hose->first_busno = 0;
251 hose->last_busno = 0xff;
252 hose->pci_mem_offset = MCPN765_PCI_PHY_MEM_OFFSET;
253
254 pci_init_resource(&hose->io_resource,
255 MCPN765_PCI_IO_START,
256 MCPN765_PCI_IO_END,
257 IORESOURCE_IO,
258 "PCI host bridge");
259
260 pci_init_resource(&hose->mem_resources[0],
261 MCPN765_PCI_MEM_START,
262 MCPN765_PCI_MEM_END,
263 IORESOURCE_MEM,
264 "PCI host bridge");
265
266 hose->io_space.start = MCPN765_PCI_IO_START;
267 hose->io_space.end = MCPN765_PCI_IO_END;
268 hose->mem_space.start = MCPN765_PCI_MEM_START;
269 hose->mem_space.end = MCPN765_PCI_MEM_END - HAWK_MPIC_SIZE;
270
271 if (hawk_init(hose,
272 MCPN765_HAWK_PPC_REG_BASE,
273 MCPN765_PROC_PCI_MEM_START,
274 MCPN765_PROC_PCI_MEM_END - HAWK_MPIC_SIZE,
275 MCPN765_PROC_PCI_IO_START,
276 MCPN765_PROC_PCI_IO_END,
277 MCPN765_PCI_MEM_END - HAWK_MPIC_SIZE + 1) != 0) {
278 printk("Could not initialize HAWK bridge\n");
279 }
280
281 /* VIA IDE BAR decoders are only 16-bits wide. PCI Auto Config
282 * will reassign the bars outside of 16-bit I/O space, which will
283 * "break" things. To prevent this, we'll set the IDE chip into
284 * legacy mode and seed the bars with their legacy addresses (in 16-bit
285 * I/O space). The Auto Config code will skip the IDE contoller in
286 * legacy mode, so our bar values will stick.
287 */
288 mcpn765_set_VIA_IDE_legacy();
289
290 hose->last_busno = pciauto_bus_scan(hose, hose->first_busno);
291
292 /* Now that we've got 16-bit addresses in the bars, we can switch the
293 * IDE controller back into native mode so we can do "modern" resource
294 * and interrupt management.
295 */
296 mcpn765_set_VIA_IDE_native();
297
298 ppc_md.pcibios_fixup = mcpn765_pcibios_fixup;
299 ppc_md.pcibios_fixup_bus = NULL;
300 ppc_md.pci_swizzle = common_swizzle;
301 ppc_md.pci_map_irq = mcpn765_map_irq;
302
303 return;
304}
305static void __init
306mcpn765_setup_arch(void)
307{
308 struct pci_controller *hose;
309
310 if ( ppc_md.progress )
311 ppc_md.progress("mcpn765_setup_arch: enter", 0);
312
313 loops_per_jiffy = 50000000 / HZ;
314
315#ifdef CONFIG_BLK_DEV_INITRD
316 if (initrd_start)
317 ROOT_DEV = Root_RAM0;
318 else
319#endif
320#ifdef CONFIG_ROOT_NFS
321 ROOT_DEV = Root_NFS;
322#else
323 ROOT_DEV = Root_SDA2;
324#endif
325
326 if ( ppc_md.progress )
327 ppc_md.progress("mcpn765_setup_arch: find_bridges", 0);
328
329 /* Lookup PCI host bridges */
330 mcpn765_find_bridges();
331
332 hose = pci_bus_to_hose(0);
333 isa_io_base = (ulong)hose->io_base_virt;
334
335 TODC_INIT(TODC_TYPE_MK48T37,
336 (MCPN765_PHYS_NVRAM_AS0 - isa_io_base),
337 (MCPN765_PHYS_NVRAM_AS1 - isa_io_base),
338 (MCPN765_PHYS_NVRAM_DATA - isa_io_base),
339 8);
340
341 OpenPIC_InitSenses = mcpn765_openpic_initsenses;
342 OpenPIC_NumInitSenses = sizeof(mcpn765_openpic_initsenses);
343
344 printk("Motorola MCG MCPN765 cPCI Non-System Board\n");
345 printk("MCPN765 port (MontaVista Software, Inc. (source@mvista.com))\n");
346
347 if ( ppc_md.progress )
348 ppc_md.progress("mcpn765_setup_arch: exit", 0);
349
350 return;
351}
352
353static void __init
354mcpn765_init2(void)
355{
356
357 request_region(0x00,0x20,"dma1");
358 request_region(0x20,0x20,"pic1");
359 request_region(0x40,0x20,"timer");
360 request_region(0x80,0x10,"dma page reg");
361 request_region(0xa0,0x20,"pic2");
362 request_region(0xc0,0x20,"dma2");
363
364 return;
365}
366
367/*
368 * Interrupt setup and service.
369 * Have MPIC on HAWK and cascaded 8259s on VIA 82586 cascaded to MPIC.
370 */
371static void __init
372mcpn765_init_IRQ(void)
373{
374 int i;
375
376 if ( ppc_md.progress )
377 ppc_md.progress("init_irq: enter", 0);
378
379 openpic_init(NUM_8259_INTERRUPTS);
380 openpic_hookup_cascade(NUM_8259_INTERRUPTS, "82c59 cascade",
381 i8259_irq);
382
383 for(i=0; i < NUM_8259_INTERRUPTS; i++)
384 irq_desc[i].handler = &i8259_pic;
385
386 i8259_init(0);
387
388 if ( ppc_md.progress )
389 ppc_md.progress("init_irq: exit", 0);
390
391 return;
392}
393
394static u32
395mcpn765_irq_canonicalize(u32 irq)
396{
397 if (irq == 2)
398 return 9;
399 else
400 return irq;
401}
402
403static unsigned long __init
404mcpn765_find_end_of_memory(void)
405{
406 return hawk_get_mem_size(MCPN765_HAWK_SMC_BASE);
407}
408
409static void __init
410mcpn765_map_io(void)
411{
412 io_block_mapping(0xfe800000, 0xfe800000, 0x00800000, _PAGE_IO);
413}
414
415static void
416mcpn765_reset_board(void)
417{
418 local_irq_disable();
419
420 /* set VIA IDE controller into native mode */
421 mcpn765_set_VIA_IDE_native();
422
423 /* Set exception prefix high - to the firmware */
424 _nmask_and_or_msr(0, MSR_IP);
425
426 out_8((u_char *)MCPN765_BOARD_MODRST_REG, 0x01);
427
428 return;
429}
430
431static void
432mcpn765_restart(char *cmd)
433{
434 volatile ulong i = 10000000;
435
436 mcpn765_reset_board();
437
438 while (i-- > 0);
439 panic("restart failed\n");
440}
441
442static void
443mcpn765_power_off(void)
444{
445 mcpn765_halt();
446 /* NOTREACHED */
447}
448
449static void
450mcpn765_halt(void)
451{
452 local_irq_disable();
453 while (1);
454 /* NOTREACHED */
455}
456
457static int
458mcpn765_show_cpuinfo(struct seq_file *m)
459{
460 seq_printf(m, "vendor\t\t: Motorola MCG\n");
461 seq_printf(m, "machine\t\t: MCPN765\n");
462
463 return 0;
464}
465
466/*
467 * Set BAT 3 to map 0xf0000000 to end of physical memory space.
468 */
469static __inline__ void
470mcpn765_set_bat(void)
471{
472 mb();
473 mtspr(SPRN_DBAT1U, 0xfe8000fe);
474 mtspr(SPRN_DBAT1L, 0xfe80002a);
475 mb();
476}
477
478void __init
479platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
480 unsigned long r6, unsigned long r7)
481{
482 parse_bootinfo(find_bootinfo());
483
484 /* Map in board regs, etc. */
485 mcpn765_set_bat();
486
487 isa_mem_base = MCPN765_ISA_MEM_BASE;
488 pci_dram_offset = MCPN765_PCI_DRAM_OFFSET;
489 ISA_DMA_THRESHOLD = 0x00ffffff;
490 DMA_MODE_READ = 0x44;
491 DMA_MODE_WRITE = 0x48;
492
493 ppc_md.setup_arch = mcpn765_setup_arch;
494 ppc_md.show_cpuinfo = mcpn765_show_cpuinfo;
495 ppc_md.irq_canonicalize = mcpn765_irq_canonicalize;
496 ppc_md.init_IRQ = mcpn765_init_IRQ;
497 ppc_md.get_irq = openpic_get_irq;
498 ppc_md.init = mcpn765_init2;
499
500 ppc_md.restart = mcpn765_restart;
501 ppc_md.power_off = mcpn765_power_off;
502 ppc_md.halt = mcpn765_halt;
503
504 ppc_md.find_end_of_memory = mcpn765_find_end_of_memory;
505 ppc_md.setup_io_mappings = mcpn765_map_io;
506
507 ppc_md.time_init = todc_time_init;
508 ppc_md.set_rtc_time = todc_set_rtc_time;
509 ppc_md.get_rtc_time = todc_get_rtc_time;
510 ppc_md.calibrate_decr = todc_calibrate_decr;
511
512 ppc_md.nvram_read_val = todc_m48txx_read_val;
513 ppc_md.nvram_write_val = todc_m48txx_write_val;
514
515 ppc_md.heartbeat = NULL;
516 ppc_md.heartbeat_reset = 0;
517 ppc_md.heartbeat_count = 0;
518
519#ifdef CONFIG_SERIAL_TEXT_DEBUG
520 ppc_md.progress = gen550_progress;
521#endif
522#ifdef CONFIG_KGDB
523 ppc_md.kgdb_map_scc = gen550_kgdb_map_scc;
524#endif
525
526 return;
527}
diff --git a/arch/ppc/platforms/mcpn765.h b/arch/ppc/platforms/mcpn765.h
new file mode 100644
index 000000000000..4d35ecad097b
--- /dev/null
+++ b/arch/ppc/platforms/mcpn765.h
@@ -0,0 +1,122 @@
1/*
2 * arch/ppc/platforms/mcpn765.h
3 *
4 * Definitions for Motorola MCG MCPN765 cPCI Board.
5 *
6 * Author: Mark A. Greer
7 * mgreer@mvista.com
8 *
9 * 2001-2004 (c) MontaVista, Software, Inc. This file is licensed under
10 * the terms of the GNU General Public License version 2. This program
11 * is licensed "as is" without any warranty of any kind, whether express
12 * or implied.
13 */
14
15/*
16 * From Processor to PCI:
17 * PCI Mem Space: 0x80000000 - 0xc0000000 -> 0x80000000 - 0xc0000000 (1 GB)
18 * PCI I/O Space: 0xfd800000 - 0xfe000000 -> 0x00000000 - 0x00800000 (8 MB)
19 * Note: Must skip 0xfe000000-0xfe400000 for CONFIG_HIGHMEM/PKMAP area
20 * MPIC in PCI Mem Space: 0xfe800000 - 0xfe830000 (not all used by MPIC)
21 *
22 * From PCI to Processor:
23 * System Memory: 0x00000000 -> 0x00000000
24 */
25
26#ifndef __PPC_PLATFORMS_MCPN765_H
27#define __PPC_PLATFORMS_MCPN765_H
28#include <linux/config.h>
29
30/* PCI Memory space mapping info */
31#define MCPN765_PCI_MEM_SIZE 0x40000000U
32#define MCPN765_PROC_PCI_MEM_START 0x80000000U
33#define MCPN765_PROC_PCI_MEM_END (MCPN765_PROC_PCI_MEM_START + \
34 MCPN765_PCI_MEM_SIZE - 1)
35#define MCPN765_PCI_MEM_START 0x80000000U
36#define MCPN765_PCI_MEM_END (MCPN765_PCI_MEM_START + \
37 MCPN765_PCI_MEM_SIZE - 1)
38
39/* PCI I/O space mapping info */
40#define MCPN765_PCI_IO_SIZE 0x00800000U
41#define MCPN765_PROC_PCI_IO_START 0xfd800000U
42#define MCPN765_PROC_PCI_IO_END (MCPN765_PROC_PCI_IO_START + \
43 MCPN765_PCI_IO_SIZE - 1)
44#define MCPN765_PCI_IO_START 0x00000000U
45#define MCPN765_PCI_IO_END (MCPN765_PCI_IO_START + \
46 MCPN765_PCI_IO_SIZE - 1)
47
48/* System memory mapping info */
49#define MCPN765_PCI_DRAM_OFFSET 0x00000000U
50#define MCPN765_PCI_PHY_MEM_OFFSET 0x00000000U
51
52#define MCPN765_ISA_MEM_BASE 0x00000000U
53#define MCPN765_ISA_IO_BASE MCPN765_PROC_PCI_IO_START
54
55/* Define base addresses for important sets of registers */
56#define MCPN765_HAWK_MPIC_BASE 0xfe800000U
57#define MCPN765_HAWK_SMC_BASE 0xfef80000U
58#define MCPN765_HAWK_PPC_REG_BASE 0xfeff0000U
59
60/* Define MCPN765 board register addresses. */
61#define MCPN765_BOARD_STATUS_REG 0xfef88080U
62#define MCPN765_BOARD_MODFAIL_REG 0xfef88090U
63#define MCPN765_BOARD_MODRST_REG 0xfef880a0U
64#define MCPN765_BOARD_TBEN_REG 0xfef880c0U
65#define MCPN765_BOARD_GEOGRAPHICAL_REG 0xfef880e8U
66#define MCPN765_BOARD_EXT_FEATURE_REG 0xfef880f0U
67#define MCPN765_BOARD_LAST_RESET_REG 0xfef880f8U
68
69/* Defines for UART */
70
71/* Define the UART base addresses */
72#define MCPN765_SERIAL_1 0xfef88000
73#define MCPN765_SERIAL_2 0xfef88200
74#define MCPN765_SERIAL_3 0xfef88400
75#define MCPN765_SERIAL_4 0xfef88600
76
77#ifdef CONFIG_SERIAL_MANY_PORTS
78#define RS_TABLE_SIZE 64
79#else
80#define RS_TABLE_SIZE 4
81#endif
82
83/* Rate for the 1.8432 Mhz clock for the onboard serial chip */
84#define BASE_BAUD ( 1843200 / 16 )
85#define UART_CLK 1843200
86
87#ifdef CONFIG_SERIAL_DETECT_IRQ
88#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_SKIP_TEST|ASYNC_AUTO_IRQ)
89#else
90#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_SKIP_TEST)
91#endif
92
93/* All UART IRQ's are wire-OR'd to IRQ 17 */
94#define STD_SERIAL_PORT_DFNS \
95 { 0, BASE_BAUD, MCPN765_SERIAL_1, 17, STD_COM_FLAGS, /* ttyS0 */\
96 iomem_base: (u8 *)MCPN765_SERIAL_1, \
97 iomem_reg_shift: 4, \
98 io_type: SERIAL_IO_MEM }, \
99 { 0, BASE_BAUD, MCPN765_SERIAL_2, 17, STD_COM_FLAGS, /* ttyS1 */\
100 iomem_base: (u8 *)MCPN765_SERIAL_2, \
101 iomem_reg_shift: 4, \
102 io_type: SERIAL_IO_MEM }, \
103 { 0, BASE_BAUD, MCPN765_SERIAL_3, 17, STD_COM_FLAGS, /* ttyS2 */\
104 iomem_base: (u8 *)MCPN765_SERIAL_3, \
105 iomem_reg_shift: 4, \
106 io_type: SERIAL_IO_MEM }, \
107 { 0, BASE_BAUD, MCPN765_SERIAL_4, 17, STD_COM_FLAGS, /* ttyS3 */\
108 iomem_base: (u8 *)MCPN765_SERIAL_4, \
109 iomem_reg_shift: 4, \
110 io_type: SERIAL_IO_MEM },
111
112#define SERIAL_PORT_DFNS \
113 STD_SERIAL_PORT_DFNS
114
115/* Define the NVRAM/RTC address strobe & data registers */
116#define MCPN765_PHYS_NVRAM_AS0 0xfef880c8U
117#define MCPN765_PHYS_NVRAM_AS1 0xfef880d0U
118#define MCPN765_PHYS_NVRAM_DATA 0xfef880d8U
119
120extern void mcpn765_find_bridges(void);
121
122#endif /* __PPC_PLATFORMS_MCPN765_H */
diff --git a/arch/ppc/platforms/mpc5200.c b/arch/ppc/platforms/mpc5200.c
new file mode 100644
index 000000000000..a58db438c162
--- /dev/null
+++ b/arch/ppc/platforms/mpc5200.c
@@ -0,0 +1,53 @@
1/*
2 * arch/ppc/platforms/mpc5200.c
3 *
4 * OCP Definitions for the boards based on MPC5200 processor. Contains
5 * definitions for every common peripherals. (Mostly all but PSCs)
6 *
7 * Maintainer : Sylvain Munaut <tnt@246tNt.com>
8 *
9 * Copyright 2004 Sylvain Munaut <tnt@246tNt.com>
10 *
11 * This file is licensed under the terms of the GNU General Public License
12 * version 2. This program is licensed "as is" without any warranty of any
13 * kind, whether express or implied.
14 */
15
16#include <asm/ocp.h>
17#include <asm/mpc52xx.h>
18
19
20static struct ocp_fs_i2c_data mpc5200_i2c_def = {
21 .flags = FS_I2C_CLOCK_5200,
22};
23
24
25/* Here is the core_ocp struct.
26 * With all the devices common to all board. Even if port multiplexing is
27 * not setup for them (if the user don't want them, just don't select the
28 * config option). The potentially conflicting devices (like PSCs) goes in
29 * board specific file.
30 */
31struct ocp_def core_ocp[] = {
32 {
33 .vendor = OCP_VENDOR_FREESCALE,
34 .function = OCP_FUNC_IIC,
35 .index = 0,
36 .paddr = MPC52xx_I2C1,
37 .irq = OCP_IRQ_NA, /* MPC52xx_IRQ_I2C1 - Buggy */
38 .pm = OCP_CPM_NA,
39 .additions = &mpc5200_i2c_def,
40 },
41 {
42 .vendor = OCP_VENDOR_FREESCALE,
43 .function = OCP_FUNC_IIC,
44 .index = 1,
45 .paddr = MPC52xx_I2C2,
46 .irq = OCP_IRQ_NA, /* MPC52xx_IRQ_I2C2 - Buggy */
47 .pm = OCP_CPM_NA,
48 .additions = &mpc5200_i2c_def,
49 },
50 { /* Terminating entry */
51 .vendor = OCP_VENDOR_INVALID
52 }
53};
diff --git a/arch/ppc/platforms/mvme5100.c b/arch/ppc/platforms/mvme5100.c
new file mode 100644
index 000000000000..b292b44b760c
--- /dev/null
+++ b/arch/ppc/platforms/mvme5100.c
@@ -0,0 +1,349 @@
1/*
2 * arch/ppc/platforms/mvme5100.c
3 *
4 * Board setup routines for the Motorola MVME5100.
5 *
6 * Author: Matt Porter <mporter@mvista.com>
7 *
8 * 2001-2004 (c) MontaVista, Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
11 * or implied.
12 */
13
14#include <linux/config.h>
15#include <linux/stddef.h>
16#include <linux/kernel.h>
17#include <linux/init.h>
18#include <linux/errno.h>
19#include <linux/pci.h>
20#include <linux/initrd.h>
21#include <linux/console.h>
22#include <linux/delay.h>
23#include <linux/irq.h>
24#include <linux/ide.h>
25#include <linux/seq_file.h>
26#include <linux/kdev_t.h>
27#include <linux/root_dev.h>
28
29#include <asm/system.h>
30#include <asm/pgtable.h>
31#include <asm/page.h>
32#include <asm/dma.h>
33#include <asm/io.h>
34#include <asm/machdep.h>
35#include <asm/open_pic.h>
36#include <asm/i8259.h>
37#include <asm/todc.h>
38#include <asm/pci-bridge.h>
39#include <asm/bootinfo.h>
40#include <asm/hawk.h>
41
42#include <platforms/pplus.h>
43#include <platforms/mvme5100.h>
44
45static u_char mvme5100_openpic_initsenses[16] __initdata = {
46 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* i8259 cascade */
47 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* TL16C550 UART 1,2 */
48 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Enet1 front panel or P2 */
49 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Hawk Watchdog 1,2 */
50 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* DS1621 thermal alarm */
51 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Universe II LINT0# */
52 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Universe II LINT1# */
53 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Universe II LINT2# */
54 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Universe II LINT3# */
55 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PMC1 INTA#, PMC2 INTB# */
56 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PMC1 INTB#, PMC2 INTC# */
57 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PMC1 INTC#, PMC2 INTD# */
58 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PMC1 INTD#, PMC2 INTA# */
59 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Enet 2 (front panel) */
60 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Abort Switch */
61 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* RTC Alarm */
62};
63
64static inline int
65mvme5100_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
66{
67 int irq;
68
69 static char pci_irq_table[][4] =
70 /*
71 * PCI IDSEL/INTPIN->INTLINE
72 * A B C D
73 */
74 {
75 { 0, 0, 0, 0 }, /* IDSEL 11 - Winbond */
76 { 0, 0, 0, 0 }, /* IDSEL 12 - unused */
77 { 21, 22, 23, 24 }, /* IDSEL 13 - Universe II */
78 { 18, 0, 0, 0 }, /* IDSEL 14 - Enet 1 */
79 { 0, 0, 0, 0 }, /* IDSEL 15 - unused */
80 { 25, 26, 27, 28 }, /* IDSEL 16 - PMC Slot 1 */
81 { 28, 25, 26, 27 }, /* IDSEL 17 - PMC Slot 2 */
82 { 0, 0, 0, 0 }, /* IDSEL 18 - unused */
83 { 29, 0, 0, 0 }, /* IDSEL 19 - Enet 2 */
84 { 0, 0, 0, 0 }, /* IDSEL 20 - PMCSPAN */
85 };
86
87 const long min_idsel = 11, max_idsel = 20, irqs_per_slot = 4;
88 irq = PCI_IRQ_TABLE_LOOKUP;
89 /* If lookup is zero, always return 0 */
90 if (!irq)
91 return 0;
92 else
93#ifdef CONFIG_MVME5100_IPMC761_PRESENT
94 /* If IPMC761 present, return table value */
95 return irq;
96#else
97 /* If IPMC761 not present, we don't have an i8259 so adjust */
98 return (irq - NUM_8259_INTERRUPTS);
99#endif
100}
101
102static void
103mvme5100_pcibios_fixup_resources(struct pci_dev *dev)
104{
105 int i;
106
107 if ((dev->vendor == PCI_VENDOR_ID_MOTOROLA) &&
108 (dev->device == PCI_DEVICE_ID_MOTOROLA_HAWK))
109 for (i=0; i<DEVICE_COUNT_RESOURCE; i++)
110 {
111 dev->resource[i].start = 0;
112 dev->resource[i].end = 0;
113 }
114}
115
116static void __init
117mvme5100_setup_bridge(void)
118{
119 struct pci_controller* hose;
120
121 hose = pcibios_alloc_controller();
122
123 if (!hose)
124 return;
125
126 hose->first_busno = 0;
127 hose->last_busno = 0xff;
128 hose->pci_mem_offset = MVME5100_PCI_MEM_OFFSET;
129
130 pci_init_resource(&hose->io_resource, MVME5100_PCI_LOWER_IO,
131 MVME5100_PCI_UPPER_IO, IORESOURCE_IO,
132 "PCI host bridge");
133
134 pci_init_resource(&hose->mem_resources[0], MVME5100_PCI_LOWER_MEM,
135 MVME5100_PCI_UPPER_MEM, IORESOURCE_MEM,
136 "PCI host bridge");
137
138 hose->io_space.start = MVME5100_PCI_LOWER_IO;
139 hose->io_space.end = MVME5100_PCI_UPPER_IO;
140 hose->mem_space.start = MVME5100_PCI_LOWER_MEM;
141 hose->mem_space.end = MVME5100_PCI_UPPER_MEM;
142 hose->io_base_virt = (void *)MVME5100_ISA_IO_BASE;
143
144 /* Use indirect method of Hawk */
145 setup_indirect_pci(hose, MVME5100_PCI_CONFIG_ADDR,
146 MVME5100_PCI_CONFIG_DATA);
147
148 hose->last_busno = pciauto_bus_scan(hose, hose->first_busno);
149
150 ppc_md.pcibios_fixup_resources = mvme5100_pcibios_fixup_resources;
151 ppc_md.pci_swizzle = common_swizzle;
152 ppc_md.pci_map_irq = mvme5100_map_irq;
153}
154
155static void __init
156mvme5100_setup_arch(void)
157{
158 if ( ppc_md.progress )
159 ppc_md.progress("mvme5100_setup_arch: enter", 0);
160
161 loops_per_jiffy = 50000000 / HZ;
162
163#ifdef CONFIG_BLK_DEV_INITRD
164 if (initrd_start)
165 ROOT_DEV = Root_RAM0;
166 else
167#endif
168#ifdef CONFIG_ROOT_NFS
169 ROOT_DEV = Root_NFS;
170#else
171 ROOT_DEV = Root_SDA2;
172#endif
173
174 if ( ppc_md.progress )
175 ppc_md.progress("mvme5100_setup_arch: find_bridges", 0);
176
177 /* Setup PCI host bridge */
178 mvme5100_setup_bridge();
179
180 /* Find and map our OpenPIC */
181 hawk_mpic_init(MVME5100_PCI_MEM_OFFSET);
182 OpenPIC_InitSenses = mvme5100_openpic_initsenses;
183 OpenPIC_NumInitSenses = sizeof(mvme5100_openpic_initsenses);
184
185 printk("MVME5100 port (C) 2001 MontaVista Software, Inc. (source@mvista.com)\n");
186
187 if ( ppc_md.progress )
188 ppc_md.progress("mvme5100_setup_arch: exit", 0);
189
190 return;
191}
192
193static void __init
194mvme5100_init2(void)
195{
196#ifdef CONFIG_MVME5100_IPMC761_PRESENT
197 request_region(0x00,0x20,"dma1");
198 request_region(0x20,0x20,"pic1");
199 request_region(0x40,0x20,"timer");
200 request_region(0x80,0x10,"dma page reg");
201 request_region(0xa0,0x20,"pic2");
202 request_region(0xc0,0x20,"dma2");
203#endif
204 return;
205}
206
207/*
208 * Interrupt setup and service.
209 * Have MPIC on HAWK and cascaded 8259s on Winbond cascaded to MPIC.
210 */
211static void __init
212mvme5100_init_IRQ(void)
213{
214#ifdef CONFIG_MVME5100_IPMC761_PRESENT
215 int i;
216#endif
217
218 if ( ppc_md.progress )
219 ppc_md.progress("init_irq: enter", 0);
220
221 openpic_set_sources(0, 16, OpenPIC_Addr + 0x10000);
222#ifdef CONFIG_MVME5100_IPMC761_PRESENT
223 openpic_init(NUM_8259_INTERRUPTS);
224 openpic_hookup_cascade(NUM_8259_INTERRUPTS, "82c59 cascade",
225 &i8259_irq);
226
227 /* Map i8259 interrupts. */
228 for (i = 0; i < NUM_8259_INTERRUPTS; i++)
229 irq_desc[i].handler = &i8259_pic;
230
231 i8259_init(0);
232#else
233 openpic_init(0);
234#endif
235
236 if ( ppc_md.progress )
237 ppc_md.progress("init_irq: exit", 0);
238
239 return;
240}
241
242/*
243 * Set BAT 3 to map 0xf0000000 to end of physical memory space.
244 */
245static __inline__ void
246mvme5100_set_bat(void)
247{
248 mb();
249 mtspr(SPRN_DBAT1U, 0xf0001ffe);
250 mtspr(SPRN_DBAT1L, 0xf000002a);
251 mb();
252}
253
254static unsigned long __init
255mvme5100_find_end_of_memory(void)
256{
257 return hawk_get_mem_size(MVME5100_HAWK_SMC_BASE);
258}
259
260static void __init
261mvme5100_map_io(void)
262{
263 io_block_mapping(0xfe000000, 0xfe000000, 0x02000000, _PAGE_IO);
264 ioremap_base = 0xfe000000;
265}
266
267static void
268mvme5100_reset_board(void)
269{
270 local_irq_disable();
271
272 /* Set exception prefix high - to the firmware */
273 _nmask_and_or_msr(0, MSR_IP);
274
275 out_8((u_char *)MVME5100_BOARD_MODRST_REG, 0x01);
276
277 return;
278}
279
280static void
281mvme5100_restart(char *cmd)
282{
283 volatile ulong i = 10000000;
284
285 mvme5100_reset_board();
286
287 while (i-- > 0);
288 panic("restart failed\n");
289}
290
291static void
292mvme5100_halt(void)
293{
294 local_irq_disable();
295 while (1);
296}
297
298static void
299mvme5100_power_off(void)
300{
301 mvme5100_halt();
302}
303
304static int
305mvme5100_show_cpuinfo(struct seq_file *m)
306{
307 seq_printf(m, "vendor\t\t: Motorola\n");
308 seq_printf(m, "machine\t\t: MVME5100\n");
309
310 return 0;
311}
312
313TODC_ALLOC();
314
315void __init
316platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
317 unsigned long r6, unsigned long r7)
318{
319 parse_bootinfo(find_bootinfo());
320 mvme5100_set_bat();
321
322 isa_io_base = MVME5100_ISA_IO_BASE;
323 isa_mem_base = MVME5100_ISA_MEM_BASE;
324 pci_dram_offset = MVME5100_PCI_DRAM_OFFSET;
325
326 ppc_md.setup_arch = mvme5100_setup_arch;
327 ppc_md.show_cpuinfo = mvme5100_show_cpuinfo;
328 ppc_md.init_IRQ = mvme5100_init_IRQ;
329 ppc_md.get_irq = openpic_get_irq;
330 ppc_md.init = mvme5100_init2;
331
332 ppc_md.restart = mvme5100_restart;
333 ppc_md.power_off = mvme5100_power_off;
334 ppc_md.halt = mvme5100_halt;
335
336 ppc_md.find_end_of_memory = mvme5100_find_end_of_memory;
337 ppc_md.setup_io_mappings = mvme5100_map_io;
338
339 TODC_INIT(TODC_TYPE_MK48T37, MVME5100_NVRAM_AS0, MVME5100_NVRAM_AS1,
340 MVME5100_NVRAM_DATA, 8);
341
342 ppc_md.time_init = todc_time_init;
343 ppc_md.set_rtc_time = todc_set_rtc_time;
344 ppc_md.get_rtc_time = todc_get_rtc_time;
345 ppc_md.calibrate_decr = todc_calibrate_decr;
346
347 ppc_md.nvram_read_val = todc_m48txx_read_val;
348 ppc_md.nvram_write_val = todc_m48txx_write_val;
349}
diff --git a/arch/ppc/platforms/mvme5100.h b/arch/ppc/platforms/mvme5100.h
new file mode 100644
index 000000000000..edd479439a4e
--- /dev/null
+++ b/arch/ppc/platforms/mvme5100.h
@@ -0,0 +1,91 @@
1/*
2 * include/asm-ppc/platforms/mvme5100.h
3 *
4 * Definitions for Motorola MVME5100.
5 *
6 * Author: Matt Porter <mporter@mvista.com>
7 *
8 * 2001 (c) MontaVista, Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
11 * or implied.
12 */
13
14#ifdef __KERNEL__
15#ifndef __ASM_MVME5100_H__
16#define __ASM_MVME5100_H__
17
18#define MVME5100_HAWK_SMC_BASE 0xfef80000
19
20#define MVME5100_PCI_CONFIG_ADDR 0xfe000cf8
21#define MVME5100_PCI_CONFIG_DATA 0xfe000cfc
22
23#define MVME5100_PCI_IO_BASE 0xfe000000
24#define MVME5100_PCI_MEM_BASE 0x80000000
25
26#define MVME5100_PCI_MEM_OFFSET 0x00000000
27
28#define MVME5100_PCI_DRAM_OFFSET 0x00000000
29#define MVME5100_ISA_MEM_BASE 0x00000000
30#define MVME5100_ISA_IO_BASE MVME5100_PCI_IO_BASE
31
32#define MVME5100_PCI_LOWER_MEM 0x80000000
33#define MVME5100_PCI_UPPER_MEM 0xf3f7ffff
34#define MVME5100_PCI_LOWER_IO 0x00000000
35#define MVME5100_PCI_UPPER_IO 0x0077ffff
36
37/* MVME5100 board register addresses. */
38#define MVME5100_BOARD_STATUS_REG 0xfef88080
39#define MVME5100_BOARD_MODFAIL_REG 0xfef88090
40#define MVME5100_BOARD_MODRST_REG 0xfef880a0
41#define MVME5100_BOARD_TBEN_REG 0xfef880c0
42#define MVME5100_BOARD_SW_READ_REG 0xfef880e0
43#define MVME5100_BOARD_GEO_ADDR_REG 0xfef880e8
44#define MVME5100_BOARD_EXT_FEATURE1_REG 0xfef880f0
45#define MVME5100_BOARD_EXT_FEATURE2_REG 0xfef88100
46
47/* Define the NVRAM/RTC address strobe & data registers */
48#define MVME5100_PHYS_NVRAM_AS0 0xfef880c8
49#define MVME5100_PHYS_NVRAM_AS1 0xfef880d0
50#define MVME5100_PHYS_NVRAM_DATA 0xfef880d8
51
52#define MVME5100_NVRAM_AS0 (MVME5100_PHYS_NVRAM_AS0 - MVME5100_ISA_IO_BASE)
53#define MVME5100_NVRAM_AS1 (MVME5100_PHYS_NVRAM_AS1 - MVME5100_ISA_IO_BASE)
54#define MVME5100_NVRAM_DATA (MVME5100_PHYS_NVRAM_DATA - MVME5100_ISA_IO_BASE)
55
56/* UART clock, addresses, and irq */
57#define MVME5100_BASE_BAUD 1843200
58#define MVME5100_SERIAL_1 0xfef88000
59#define MVME5100_SERIAL_2 0xfef88200
60#ifdef CONFIG_MVME5100_IPMC761_PRESENT
61#define MVME5100_SERIAL_IRQ 17
62#else
63#define MVME5100_SERIAL_IRQ 1
64#endif
65
66#define RS_TABLE_SIZE 4
67
68#define BASE_BAUD ( MVME5100_BASE_BAUD / 16 )
69
70#define STD_COM_FLAGS ASYNC_BOOT_AUTOCONF
71
72/* All UART IRQ's are wire-OR'd to one MPIC IRQ */
73#define STD_SERIAL_PORT_DFNS \
74 { 0, BASE_BAUD, MVME5100_SERIAL_1, \
75 MVME5100_SERIAL_IRQ, \
76 STD_COM_FLAGS, /* ttyS0 */ \
77 iomem_base: (unsigned char *)MVME5100_SERIAL_1, \
78 iomem_reg_shift: 4, \
79 io_type: SERIAL_IO_MEM }, \
80 { 0, BASE_BAUD, MVME5100_SERIAL_2, \
81 MVME5100_SERIAL_IRQ, \
82 STD_COM_FLAGS, /* ttyS1 */ \
83 iomem_base: (unsigned char *)MVME5100_SERIAL_2, \
84 iomem_reg_shift: 4, \
85 io_type: SERIAL_IO_MEM },
86
87#define SERIAL_PORT_DFNS \
88 STD_SERIAL_PORT_DFNS
89
90#endif /* __ASM_MVME5100_H__ */
91#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/pal4.h b/arch/ppc/platforms/pal4.h
new file mode 100644
index 000000000000..641a11a31657
--- /dev/null
+++ b/arch/ppc/platforms/pal4.h
@@ -0,0 +1,42 @@
1/*
2 * arch/ppc/platforms/pal4.h
3 *
4 * Definitions for SBS Palomar IV board
5 *
6 * Author: Dan Cox
7 *
8 * 2002 (c) MontaVista, Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
11 * or implied.
12 */
13
14#ifndef __PPC_PLATFORMS_PAL4_H
15#define __PPC_PLATFORMS_PAL4_H
16
17#define PAL4_NVRAM 0xfffc0000
18#define PAL4_NVRAM_SIZE 0x8000
19
20#define PAL4_DRAM 0xfff80000
21#define PAL4_DRAM_BR_MASK 0xc0
22#define PAL4_DRAM_BR_SHIFT 6
23#define PAL4_DRAM_RESET 0x10
24#define PAL4_DRAM_EREADY 0x40
25
26#define PAL4_MISC 0xfff80004
27#define PAL4_MISC_FB_MASK 0xc0
28#define PAL4_MISC_FLASH 0x20 /* StratFlash mapping: 1->0xff80, 0->0xfff0 */
29#define PAL4_MISC_MISC 0x08
30#define PAL4_MISC_BITF 0x02
31#define PAL4_MISC_NVKS 0x01
32
33#define PAL4_L2 0xfff80008
34#define PAL4_L2_MASK 0x07
35
36#define PAL4_PLDR 0xfff8000c
37
38/* Only two Ethernet devices on the board... */
39#define PAL4_ETH 31
40#define PAL4_INTA 20
41
42#endif /* __PPC_PLATFORMS_PAL4_H */
diff --git a/arch/ppc/platforms/pal4_pci.c b/arch/ppc/platforms/pal4_pci.c
new file mode 100644
index 000000000000..c3b1b757a48b
--- /dev/null
+++ b/arch/ppc/platforms/pal4_pci.c
@@ -0,0 +1,77 @@
1/*
2 * arch/ppc/platforms/pal4_pci.c
3 *
4 * PCI support for SBS Palomar IV
5 *
6 * Author: Dan Cox
7 *
8 * 2002 (c) MontaVista, Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
11 * or implied.
12 */
13
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/pci.h>
17
18#include <asm/byteorder.h>
19#include <asm/machdep.h>
20#include <asm/io.h>
21#include <asm/pci-bridge.h>
22#include <asm/uaccess.h>
23
24#include <syslib/cpc700.h>
25
26#include "pal4.h"
27
28/* not much to this.... */
29static inline int __init
30pal4_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
31{
32 if (idsel == 9)
33 return PAL4_ETH;
34 else
35 return PAL4_INTA + (idsel - 3);
36}
37
38void __init
39pal4_find_bridges(void)
40{
41 struct pci_controller *hose;
42
43 hose = pcibios_alloc_controller();
44 if (!hose)
45 return;
46
47 hose->first_busno = 0;
48 hose->last_busno = 0xff;
49 hose->pci_mem_offset = 0;
50
51 /* Could snatch these from the CPC700.... */
52 pci_init_resource(&hose->io_resource,
53 0x0,
54 0x03ffffff,
55 IORESOURCE_IO,
56 "PCI host bridge");
57
58 pci_init_resource(&hose->mem_resources[0],
59 0x90000000,
60 0x9fffffff,
61 IORESOURCE_MEM,
62 "PCI host bridge");
63
64 hose->io_space.start = 0x00800000;
65 hose->io_space.end = 0x03ffffff;
66 hose->mem_space.start = 0x90000000;
67 hose->mem_space.end = 0x9fffffff;
68 hose->io_base_virt = (void *) 0xf8000000;
69
70 setup_indirect_pci(hose, CPC700_PCI_CONFIG_ADDR,
71 CPC700_PCI_CONFIG_DATA);
72
73 hose->last_busno = pciauto_bus_scan(hose, hose->first_busno);
74
75 ppc_md.pci_swizzle = common_swizzle;
76 ppc_md.pci_map_irq = pal4_map_irq;
77}
diff --git a/arch/ppc/platforms/pal4_serial.h b/arch/ppc/platforms/pal4_serial.h
new file mode 100644
index 000000000000..a715c66e1adf
--- /dev/null
+++ b/arch/ppc/platforms/pal4_serial.h
@@ -0,0 +1,39 @@
1/*
2 * arch/ppc/platforms/pal4_serial.h
3 *
4 * Definitions for SBS PalomarIV serial support
5 *
6 * Author: Dan Cox
7 *
8 * 2002 (c) MontaVista, Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
11 * or implied.
12 */
13
14#ifndef __PPC_PAL4_SERIAL_H
15#define __PPC_PAL4_SERIAL_H
16
17#define CPC700_SERIAL_1 0xff600300
18#define CPC700_SERIAL_2 0xff600400
19
20#define RS_TABLE_SIZE 2
21#define BASE_BAUD (33333333 / 4 / 16)
22
23#ifdef CONFIG_SERIAL_DETECT_IRQ
24#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_SKIP_TEST|ASYNC_AUTO_IRQ)
25#define STD_COM4_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_AUTO_IRQ)
26#else
27#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_SKIP_TEST)
28#define STD_COM4_FLAGS (ASYNC_BOOT_AUTOCONF)
29#endif
30
31#define SERIAL_PORT_DFNS \
32 {0, BASE_BAUD, CPC700_SERIAL_1, 3, STD_COM_FLAGS, \
33 iomem_base: (unsigned char *) CPC700_SERIAL_1, \
34 io_type: SERIAL_IO_MEM}, /* ttyS0 */ \
35 {0, BASE_BAUD, CPC700_SERIAL_2, 4, STD_COM_FLAGS, \
36 iomem_base: (unsigned char *) CPC700_SERIAL_2, \
37 io_type: SERIAL_IO_MEM}
38
39#endif
diff --git a/arch/ppc/platforms/pal4_setup.c b/arch/ppc/platforms/pal4_setup.c
new file mode 100644
index 000000000000..12446b93e38c
--- /dev/null
+++ b/arch/ppc/platforms/pal4_setup.c
@@ -0,0 +1,175 @@
1/*
2 * arch/ppc/platforms/pal4_setup.c
3 *
4 * Board setup routines for the SBS PalomarIV.
5 *
6 * Author: Dan Cox
7 *
8 * 2002 (c) MontaVista, Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
11 * or implied.
12 */
13
14#include <linux/config.h>
15#include <linux/kernel.h>
16#include <linux/init.h>
17#include <linux/types.h>
18#include <linux/errno.h>
19#include <linux/reboot.h>
20#include <linux/time.h>
21#include <linux/irq.h>
22#include <linux/kdev_t.h>
23#include <linux/initrd.h>
24#include <linux/console.h>
25#include <linux/seq_file.h>
26#include <linux/root_dev.h>
27
28#include <asm/io.h>
29#include <asm/todc.h>
30#include <asm/bootinfo.h>
31
32#include <syslib/cpc700.h>
33
34#include "pal4.h"
35
36extern void pal4_find_bridges(void);
37
38unsigned int cpc700_irq_assigns[][2] = {
39 {1, 1}, /* IRQ 0: ECC correctable error */
40 {1, 1}, /* IRQ 1: PCI write to memory range */
41 {0, 1}, /* IRQ 2: PCI write to command register */
42 {0, 1}, /* IRQ 3: UART 0 */
43 {0, 1}, /* IRQ 4: UART 1 */
44 {0, 1}, /* IRQ 5: ICC 0 */
45 {0, 1}, /* IRQ 6: ICC 1 */
46 {0, 1}, /* IRQ 7: GPT compare 0 */
47 {0, 1}, /* IRQ 8: GPT compare 1 */
48 {0, 1}, /* IRQ 9: GPT compare 2 */
49 {0, 1}, /* IRQ 10: GPT compare 3 */
50 {0, 1}, /* IRQ 11: GPT compare 4 */
51 {0, 1}, /* IRQ 12: GPT capture 0 */
52 {0, 1}, /* IRQ 13: GPT capture 1 */
53 {0, 1}, /* IRQ 14: GPT capture 2 */
54 {0, 1}, /* IRQ 15: GPT capture 3 */
55 {0, 1}, /* IRQ 16: GPT capture 4 */
56 {0, 0}, /* IRQ 17: reserved */
57 {0, 0}, /* IRQ 18: reserved */
58 {0, 0}, /* IRQ 19: reserved */
59 {0, 0}, /* IRQ 20: reserved */
60 {0, 1}, /* IRQ 21: Ethernet */
61 {0, 0}, /* IRQ 22: reserved */
62 {0, 0}, /* IRQ 23: reserved */
63 {0, 0}, /* IRQ 24: resreved */
64 {0, 0}, /* IRQ 25: reserved */
65 {0, 0}, /* IRQ 26: reserved */
66 {0, 0}, /* IRQ 27: reserved */
67 {0, 0}, /* IRQ 28: reserved */
68 {0, 0}, /* IRQ 29: reserved */
69 {0, 0}, /* IRQ 30: reserved */
70 {0, 0}, /* IRQ 31: reserved */
71};
72
73static int
74pal4_show_cpuinfo(struct seq_file *m)
75{
76 seq_printf(m, "board\t\t: SBS Palomar IV\n");
77
78 return 0;
79}
80
81static void
82pal4_restart(char *cmd)
83{
84 local_irq_disable();
85 __asm__ __volatile__("lis 3,0xfff0\n \
86 ori 3,3,0x100\n \
87 mtspr 26,3\n \
88 li 3,0\n \
89 mtspr 27,3\n \
90 rfi");
91
92 for(;;);
93}
94
95static void
96pal4_power_off(void)
97{
98 local_irq_disable();
99 for(;;);
100}
101
102static void
103pal4_halt(void)
104{
105 pal4_power_off();
106}
107
108TODC_ALLOC();
109
110static void __init
111pal4_setup_arch(void)
112{
113 unsigned long l2;
114
115 TODC_INIT(TODC_TYPE_MK48T37, 0, 0,
116 ioremap(PAL4_NVRAM, PAL4_NVRAM_SIZE), 8);
117
118 pal4_find_bridges();
119
120#ifdef CONFIG_BLK_DEV_INITRD
121 if (initrd_start)
122 ROOT_DEV = Root_RAM0;
123 else
124#endif
125 ROOT_DEV = Root_NFS;
126
127 /* The L2 gets disabled in the bootloader, but all the proper
128 bits should be present from the fw, so just re-enable it */
129 l2 = _get_L2CR();
130 if (!(l2 & L2CR_L2E)) {
131 /* presume that it was initially set if the size is
132 still present. */
133 if (l2 ^ L2CR_L2SIZ_MASK)
134 _set_L2CR(l2 | L2CR_L2E);
135 else
136 printk("L2 not set by firmware; left disabled.\n");
137 }
138}
139
140static void __init
141pal4_map_io(void)
142{
143 io_block_mapping(0xf0000000, 0xf0000000, 0x10000000, _PAGE_IO);
144}
145
146void __init
147platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
148 unsigned long r6, unsigned long r7)
149{
150 parse_bootinfo(find_bootinfo());
151
152 isa_io_base = 0 /*PAL4_ISA_IO_BASE*/;
153 pci_dram_offset = 0 /*PAL4_PCI_SYS_MEM_BASE*/;
154
155 ppc_md.setup_arch = pal4_setup_arch;
156 ppc_md.show_cpuinfo = pal4_show_cpuinfo;
157
158 ppc_md.setup_io_mappings = pal4_map_io;
159
160 ppc_md.init_IRQ = cpc700_init_IRQ;
161 ppc_md.get_irq = cpc700_get_irq;
162
163 ppc_md.restart = pal4_restart;
164 ppc_md.halt = pal4_halt;
165 ppc_md.power_off = pal4_power_off;
166
167 ppc_md.time_init = todc_time_init;
168 ppc_md.set_rtc_time = todc_set_rtc_time;
169 ppc_md.get_rtc_time = todc_get_rtc_time;
170 ppc_md.calibrate_decr = todc_calibrate_decr;
171
172 ppc_md.nvram_read_val = todc_direct_read_val;
173 ppc_md.nvram_write_val = todc_direct_write_val;
174}
175
diff --git a/arch/ppc/platforms/pcore.c b/arch/ppc/platforms/pcore.c
new file mode 100644
index 000000000000..d7191630a650
--- /dev/null
+++ b/arch/ppc/platforms/pcore.c
@@ -0,0 +1,352 @@
1/*
2 * arch/ppc/platforms/pcore_setup.c
3 *
4 * Setup routines for Force PCORE boards
5 *
6 * Author: Matt Porter <mporter@mvista.com>
7 *
8 * 2001 (c) MontaVista, Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
11 * or implied.
12 */
13
14#include <linux/config.h>
15#include <linux/stddef.h>
16#include <linux/kernel.h>
17#include <linux/init.h>
18#include <linux/errno.h>
19#include <linux/reboot.h>
20#include <linux/pci.h>
21#include <linux/kdev_t.h>
22#include <linux/types.h>
23#include <linux/major.h>
24#include <linux/initrd.h>
25#include <linux/console.h>
26#include <linux/irq.h>
27#include <linux/seq_file.h>
28#include <linux/root_dev.h>
29
30#include <asm/io.h>
31#include <asm/machdep.h>
32#include <asm/time.h>
33#include <asm/i8259.h>
34#include <asm/mpc10x.h>
35#include <asm/todc.h>
36#include <asm/bootinfo.h>
37#include <asm/kgdb.h>
38
39#include "pcore.h"
40
41extern unsigned long loops_per_jiffy;
42
43static int board_type;
44
45static inline int __init
46pcore_6750_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
47{
48 static char pci_irq_table[][4] =
49 /*
50 * PCI IDSEL/INTPIN->INTLINE
51 * A B C D
52 */
53 {
54 {9, 10, 11, 12}, /* IDSEL 24 - DEC 21554 */
55 {10, 0, 0, 0}, /* IDSEL 25 - DEC 21143 */
56 {11, 12, 9, 10}, /* IDSEL 26 - PMC I */
57 {12, 9, 10, 11}, /* IDSEL 27 - PMC II */
58 {0, 0, 0, 0}, /* IDSEL 28 - unused */
59 {0, 0, 9, 0}, /* IDSEL 29 - unused */
60 {0, 0, 0, 0}, /* IDSEL 30 - Winbond */
61 };
62 const long min_idsel = 24, max_idsel = 30, irqs_per_slot = 4;
63 return PCI_IRQ_TABLE_LOOKUP;
64};
65
66static inline int __init
67pcore_680_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
68{
69 static char pci_irq_table[][4] =
70 /*
71 * PCI IDSEL/INTPIN->INTLINE
72 * A B C D
73 */
74 {
75 {9, 10, 11, 12}, /* IDSEL 24 - Sentinel */
76 {10, 0, 0, 0}, /* IDSEL 25 - i82559 #1 */
77 {11, 12, 9, 10}, /* IDSEL 26 - PMC I */
78 {12, 9, 10, 11}, /* IDSEL 27 - PMC II */
79 {9, 0, 0, 0}, /* IDSEL 28 - i82559 #2 */
80 {0, 0, 0, 0}, /* IDSEL 29 - unused */
81 {0, 0, 0, 0}, /* IDSEL 30 - Winbond */
82 };
83 const long min_idsel = 24, max_idsel = 30, irqs_per_slot = 4;
84 return PCI_IRQ_TABLE_LOOKUP;
85};
86
87void __init
88pcore_pcibios_fixup(void)
89{
90 struct pci_dev *dev;
91
92 if ((dev = pci_get_device(PCI_VENDOR_ID_WINBOND,
93 PCI_DEVICE_ID_WINBOND_83C553,
94 0)))
95 {
96 /* Reroute interrupts both IDE channels to 15 */
97 pci_write_config_byte(dev,
98 PCORE_WINBOND_IDE_INT,
99 0xff);
100
101 /* Route INTA-D to IRQ9-12, respectively */
102 pci_write_config_word(dev,
103 PCORE_WINBOND_PCI_INT,
104 0x9abc);
105
106 /*
107 * Set up 8259 edge/level triggering
108 */
109 outb(0x00, PCORE_WINBOND_PRI_EDG_LVL);
110 outb(0x1e, PCORE_WINBOND_SEC_EDG_LVL);
111 pci_dev_put(dev);
112 }
113}
114
115int __init
116pcore_find_bridges(void)
117{
118 struct pci_controller* hose;
119 int host_bridge, board_type;
120
121 hose = pcibios_alloc_controller();
122 if (!hose)
123 return 0;
124
125 mpc10x_bridge_init(hose,
126 MPC10X_MEM_MAP_B,
127 MPC10X_MEM_MAP_B,
128 MPC10X_MAPB_EUMB_BASE);
129
130 /* Determine board type */
131 early_read_config_dword(hose,
132 0,
133 PCI_DEVFN(0,0),
134 PCI_VENDOR_ID,
135 &host_bridge);
136 if (host_bridge == MPC10X_BRIDGE_106)
137 board_type = PCORE_TYPE_6750;
138 else /* MPC10X_BRIDGE_107 */
139 board_type = PCORE_TYPE_680;
140
141 hose->last_busno = pciauto_bus_scan(hose, hose->first_busno);
142
143 ppc_md.pcibios_fixup = pcore_pcibios_fixup;
144 ppc_md.pci_swizzle = common_swizzle;
145
146 if (board_type == PCORE_TYPE_6750)
147 ppc_md.pci_map_irq = pcore_6750_map_irq;
148 else /* PCORE_TYPE_680 */
149 ppc_md.pci_map_irq = pcore_680_map_irq;
150
151 return board_type;
152}
153
154/* Dummy variable to satisfy mpc10x_common.o */
155void *OpenPIC_Addr;
156
157static int
158pcore_show_cpuinfo(struct seq_file *m)
159{
160 seq_printf(m, "vendor\t\t: Force Computers\n");
161
162 if (board_type == PCORE_TYPE_6750)
163 seq_printf(m, "machine\t\t: PowerCore 6750\n");
164 else /* PCORE_TYPE_680 */
165 seq_printf(m, "machine\t\t: PowerCore 680\n");
166
167 seq_printf(m, "L2\t\t: " );
168 if (board_type == PCORE_TYPE_6750)
169 switch (readb(PCORE_DCCR_REG) & PCORE_DCCR_L2_MASK)
170 {
171 case PCORE_DCCR_L2_0KB:
172 seq_printf(m, "nocache");
173 break;
174 case PCORE_DCCR_L2_256KB:
175 seq_printf(m, "256KB");
176 break;
177 case PCORE_DCCR_L2_1MB:
178 seq_printf(m, "1MB");
179 break;
180 case PCORE_DCCR_L2_512KB:
181 seq_printf(m, "512KB");
182 break;
183 default:
184 seq_printf(m, "error");
185 break;
186 }
187 else /* PCORE_TYPE_680 */
188 switch (readb(PCORE_DCCR_REG) & PCORE_DCCR_L2_MASK)
189 {
190 case PCORE_DCCR_L2_2MB:
191 seq_printf(m, "2MB");
192 break;
193 case PCORE_DCCR_L2_256KB:
194 seq_printf(m, "reserved");
195 break;
196 case PCORE_DCCR_L2_1MB:
197 seq_printf(m, "1MB");
198 break;
199 case PCORE_DCCR_L2_512KB:
200 seq_printf(m, "512KB");
201 break;
202 default:
203 seq_printf(m, "error");
204 break;
205 }
206
207 seq_printf(m, "\n");
208
209 return 0;
210}
211
212static void __init
213pcore_setup_arch(void)
214{
215 /* init to some ~sane value until calibrate_delay() runs */
216 loops_per_jiffy = 50000000/HZ;
217
218 /* Lookup PCI host bridges */
219 board_type = pcore_find_bridges();
220
221#ifdef CONFIG_BLK_DEV_INITRD
222 if (initrd_start)
223 ROOT_DEV = Root_RAM0;
224 else
225#endif
226#ifdef CONFIG_ROOT_NFS
227 ROOT_DEV = Root_NFS;
228#else
229 ROOT_DEV = Root_SDA2;
230#endif
231
232 printk(KERN_INFO "Force PowerCore ");
233 if (board_type == PCORE_TYPE_6750)
234 printk("6750\n");
235 else
236 printk("680\n");
237 printk(KERN_INFO "Port by MontaVista Software, Inc. (source@mvista.com)\n");
238 _set_L2CR(L2CR_L2E | _get_L2CR());
239
240}
241
242static void
243pcore_restart(char *cmd)
244{
245 local_irq_disable();
246 /* Hard reset */
247 writeb(0x11, 0xfe000332);
248 while(1);
249}
250
251static void
252pcore_halt(void)
253{
254 local_irq_disable();
255 /* Turn off user LEDs */
256 writeb(0x00, 0xfe000300);
257 while (1);
258}
259
260static void
261pcore_power_off(void)
262{
263 pcore_halt();
264}
265
266
267static void __init
268pcore_init_IRQ(void)
269{
270 int i;
271
272 for ( i = 0 ; i < 16 ; i++ )
273 irq_desc[i].handler = &i8259_pic;
274
275 i8259_init(0);
276}
277
278/*
279 * Set BAT 3 to map 0xf0000000 to end of physical memory space.
280 */
281static __inline__ void
282pcore_set_bat(void)
283{
284 mb();
285 mtspr(SPRN_DBAT3U, 0xf0001ffe);
286 mtspr(SPRN_DBAT3L, 0xfe80002a);
287 mb();
288
289}
290
291static unsigned long __init
292pcore_find_end_of_memory(void)
293{
294
295 return mpc10x_get_mem_size(MPC10X_MEM_MAP_B);
296}
297
298static void __init
299pcore_map_io(void)
300{
301 io_block_mapping(0xfe000000, 0xfe000000, 0x02000000, _PAGE_IO);
302}
303
304TODC_ALLOC();
305
306void __init
307platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
308 unsigned long r6, unsigned long r7)
309{
310 parse_bootinfo(find_bootinfo());
311
312 /* Cover I/O space with a BAT */
313 /* yuck, better hope your ram size is a power of 2 -- paulus */
314 pcore_set_bat();
315
316 isa_io_base = MPC10X_MAPB_ISA_IO_BASE;
317 isa_mem_base = MPC10X_MAPB_ISA_MEM_BASE;
318 pci_dram_offset = MPC10X_MAPB_DRAM_OFFSET;
319
320 ppc_md.setup_arch = pcore_setup_arch;
321 ppc_md.show_cpuinfo = pcore_show_cpuinfo;
322 ppc_md.init_IRQ = pcore_init_IRQ;
323 ppc_md.get_irq = i8259_irq;
324
325 ppc_md.find_end_of_memory = pcore_find_end_of_memory;
326 ppc_md.setup_io_mappings = pcore_map_io;
327
328 ppc_md.restart = pcore_restart;
329 ppc_md.power_off = pcore_power_off;
330 ppc_md.halt = pcore_halt;
331
332 TODC_INIT(TODC_TYPE_MK48T59,
333 PCORE_NVRAM_AS0,
334 PCORE_NVRAM_AS1,
335 PCORE_NVRAM_DATA,
336 8);
337
338 ppc_md.time_init = todc_time_init;
339 ppc_md.get_rtc_time = todc_get_rtc_time;
340 ppc_md.set_rtc_time = todc_set_rtc_time;
341 ppc_md.calibrate_decr = todc_calibrate_decr;
342
343 ppc_md.nvram_read_val = todc_m48txx_read_val;
344 ppc_md.nvram_write_val = todc_m48txx_write_val;
345
346#ifdef CONFIG_SERIAL_TEXT_DEBUG
347 ppc_md.progress = gen550_progress;
348#endif
349#ifdef CONFIG_KGDB
350 ppc_md.kgdb_map_scc = gen550_kgdb_map_scc;
351#endif
352}
diff --git a/arch/ppc/platforms/pcore.h b/arch/ppc/platforms/pcore.h
new file mode 100644
index 000000000000..c6a26e764926
--- /dev/null
+++ b/arch/ppc/platforms/pcore.h
@@ -0,0 +1,39 @@
1/*
2 * arch/ppc/platforms/pcore.h
3 *
4 * Definitions for Force PowerCore board support
5 *
6 * Author: Matt Porter <mporter@mvista.com>
7 *
8 * 2001 (c) MontaVista, Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
11 * or implied.
12 */
13
14#ifndef __PPC_PLATFORMS_PCORE_H
15#define __PPC_PLATFORMS_PCORE_H
16
17#include <asm/mpc10x.h>
18
19#define PCORE_TYPE_6750 1
20#define PCORE_TYPE_680 2
21
22#define PCORE_NVRAM_AS0 0x73
23#define PCORE_NVRAM_AS1 0x75
24#define PCORE_NVRAM_DATA 0x77
25
26#define PCORE_DCCR_REG (MPC10X_MAPB_ISA_IO_BASE + 0x308)
27#define PCORE_DCCR_L2_MASK 0xc0
28#define PCORE_DCCR_L2_0KB 0x00
29#define PCORE_DCCR_L2_256KB 0x40
30#define PCORE_DCCR_L2_512KB 0xc0
31#define PCORE_DCCR_L2_1MB 0x80
32#define PCORE_DCCR_L2_2MB 0x00
33
34#define PCORE_WINBOND_IDE_INT 0x43
35#define PCORE_WINBOND_PCI_INT 0x44
36#define PCORE_WINBOND_PRI_EDG_LVL 0x4d0
37#define PCORE_WINBOND_SEC_EDG_LVL 0x4d1
38
39#endif /* __PPC_PLATFORMS_PCORE_H */
diff --git a/arch/ppc/platforms/pcu_e.h b/arch/ppc/platforms/pcu_e.h
new file mode 100644
index 000000000000..91a820a6fbc4
--- /dev/null
+++ b/arch/ppc/platforms/pcu_e.h
@@ -0,0 +1,28 @@
1/*
2 * Siemens PCU E board specific definitions
3 *
4 * Copyright (c) 2001 Wolfgang Denk (wd@denx.de)
5 */
6
7#ifndef __MACH_PCU_E_H
8#define __MACH_PCU_E_H
9
10#include <linux/config.h>
11
12#include <asm/ppcboot.h>
13
14#define PCU_E_IMMR_BASE 0xFE000000 /* phys. addr of IMMR */
15#define PCU_E_IMAP_SIZE (64 * 1024) /* size of mapped area */
16
17#define IMAP_ADDR PCU_E_IMMR_BASE /* physical base address of IMMR area */
18#define IMAP_SIZE PCU_E_IMAP_SIZE /* mapped size of IMMR area */
19
20#define FEC_INTERRUPT 15 /* = SIU_LEVEL7 */
21#define DEC_INTERRUPT 13 /* = SIU_LEVEL6 */
22#define CPM_INTERRUPT 11 /* = SIU_LEVEL5 (was: SIU_LEVEL2) */
23
24/* We don't use the 8259.
25*/
26#define NR_8259_INTS 0
27
28#endif /* __MACH_PCU_E_H */
diff --git a/arch/ppc/platforms/pmac_backlight.c b/arch/ppc/platforms/pmac_backlight.c
new file mode 100644
index 000000000000..ed2b1cebc19a
--- /dev/null
+++ b/arch/ppc/platforms/pmac_backlight.c
@@ -0,0 +1,202 @@
1/*
2 * Miscellaneous procedures for dealing with the PowerMac hardware.
3 * Contains support for the backlight.
4 *
5 * Copyright (C) 2000 Benjamin Herrenschmidt
6 *
7 */
8
9#include <linux/config.h>
10#include <linux/kernel.h>
11#include <linux/module.h>
12#include <linux/stddef.h>
13#include <linux/reboot.h>
14#include <linux/nvram.h>
15#include <linux/console.h>
16#include <asm/sections.h>
17#include <asm/ptrace.h>
18#include <asm/io.h>
19#include <asm/pgtable.h>
20#include <asm/system.h>
21#include <asm/prom.h>
22#include <asm/machdep.h>
23#include <asm/nvram.h>
24#include <asm/backlight.h>
25
26#include <linux/adb.h>
27#include <linux/pmu.h>
28
29static struct backlight_controller *backlighter;
30static void* backlighter_data;
31static int backlight_autosave;
32static int backlight_level = BACKLIGHT_MAX;
33static int backlight_enabled = 1;
34static int backlight_req_level = -1;
35static int backlight_req_enable = -1;
36
37static void backlight_callback(void *);
38static DECLARE_WORK(backlight_work, backlight_callback, NULL);
39
40void __pmac register_backlight_controller(struct backlight_controller *ctrler,
41 void *data, char *type)
42{
43 struct device_node* bk_node;
44 char *prop;
45 int valid = 0;
46
47 /* There's already a matching controller, bail out */
48 if (backlighter != NULL)
49 return;
50
51 bk_node = find_devices("backlight");
52
53#ifdef CONFIG_ADB_PMU
54 /* Special case for the old PowerBook since I can't test on it */
55 backlight_autosave = machine_is_compatible("AAPL,3400/2400")
56 || machine_is_compatible("AAPL,3500");
57 if ((backlight_autosave
58 || machine_is_compatible("AAPL,PowerBook1998")
59 || machine_is_compatible("PowerBook1,1"))
60 && !strcmp(type, "pmu"))
61 valid = 1;
62#endif
63 if (bk_node) {
64 prop = get_property(bk_node, "backlight-control", NULL);
65 if (prop && !strncmp(prop, type, strlen(type)))
66 valid = 1;
67 }
68 if (!valid)
69 return;
70 backlighter = ctrler;
71 backlighter_data = data;
72
73 if (bk_node && !backlight_autosave)
74 prop = get_property(bk_node, "bklt", NULL);
75 else
76 prop = NULL;
77 if (prop) {
78 backlight_level = ((*prop)+1) >> 1;
79 if (backlight_level > BACKLIGHT_MAX)
80 backlight_level = BACKLIGHT_MAX;
81 }
82
83#ifdef CONFIG_ADB_PMU
84 if (backlight_autosave) {
85 struct adb_request req;
86 pmu_request(&req, NULL, 2, 0xd9, 0);
87 while (!req.complete)
88 pmu_poll();
89 backlight_level = req.reply[0] >> 4;
90 }
91#endif
92 acquire_console_sem();
93 if (!backlighter->set_enable(1, backlight_level, data))
94 backlight_enabled = 1;
95 release_console_sem();
96
97 printk(KERN_INFO "Registered \"%s\" backlight controller,"
98 "level: %d/15\n", type, backlight_level);
99}
100EXPORT_SYMBOL(register_backlight_controller);
101
102void __pmac unregister_backlight_controller(struct backlight_controller
103 *ctrler, void *data)
104{
105 /* We keep the current backlight level (for now) */
106 if (ctrler == backlighter && data == backlighter_data)
107 backlighter = NULL;
108}
109EXPORT_SYMBOL(unregister_backlight_controller);
110
111static int __pmac __set_backlight_enable(int enable)
112{
113 int rc;
114
115 if (!backlighter)
116 return -ENODEV;
117 acquire_console_sem();
118 rc = backlighter->set_enable(enable, backlight_level,
119 backlighter_data);
120 if (!rc)
121 backlight_enabled = enable;
122 release_console_sem();
123 return rc;
124}
125int __pmac set_backlight_enable(int enable)
126{
127 if (!backlighter)
128 return -ENODEV;
129 backlight_req_enable = enable;
130 schedule_work(&backlight_work);
131 return 0;
132}
133
134EXPORT_SYMBOL(set_backlight_enable);
135
136int __pmac get_backlight_enable(void)
137{
138 if (!backlighter)
139 return -ENODEV;
140 return backlight_enabled;
141}
142EXPORT_SYMBOL(get_backlight_enable);
143
144static int __pmac __set_backlight_level(int level)
145{
146 int rc = 0;
147
148 if (!backlighter)
149 return -ENODEV;
150 if (level < BACKLIGHT_MIN)
151 level = BACKLIGHT_OFF;
152 if (level > BACKLIGHT_MAX)
153 level = BACKLIGHT_MAX;
154 acquire_console_sem();
155 if (backlight_enabled)
156 rc = backlighter->set_level(level, backlighter_data);
157 if (!rc)
158 backlight_level = level;
159 release_console_sem();
160 if (!rc && !backlight_autosave) {
161 level <<=1;
162 if (level & 0x10)
163 level |= 0x01;
164 // -- todo: save to property "bklt"
165 }
166 return rc;
167}
168int __pmac set_backlight_level(int level)
169{
170 if (!backlighter)
171 return -ENODEV;
172 backlight_req_level = level;
173 schedule_work(&backlight_work);
174 return 0;
175}
176
177EXPORT_SYMBOL(set_backlight_level);
178
179int __pmac get_backlight_level(void)
180{
181 if (!backlighter)
182 return -ENODEV;
183 return backlight_level;
184}
185EXPORT_SYMBOL(get_backlight_level);
186
187static void backlight_callback(void *dummy)
188{
189 int level, enable;
190
191 do {
192 level = backlight_req_level;
193 enable = backlight_req_enable;
194 mb();
195
196 if (level >= 0)
197 __set_backlight_level(level);
198 if (enable >= 0)
199 __set_backlight_enable(enable);
200 } while(cmpxchg(&backlight_req_level, level, -1) != level ||
201 cmpxchg(&backlight_req_enable, enable, -1) != enable);
202}
diff --git a/arch/ppc/platforms/pmac_cache.S b/arch/ppc/platforms/pmac_cache.S
new file mode 100644
index 000000000000..c00e0352044d
--- /dev/null
+++ b/arch/ppc/platforms/pmac_cache.S
@@ -0,0 +1,325 @@
1/*
2 * This file contains low-level cache management functions
3 * used for sleep and CPU speed changes on Apple machines.
4 * (In fact the only thing that is Apple-specific is that we assume
5 * that we can read from ROM at physical address 0xfff00000.)
6 *
7 * Copyright (C) 2004 Paul Mackerras (paulus@samba.org) and
8 * Benjamin Herrenschmidt (benh@kernel.crashing.org)
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version
13 * 2 of the License, or (at your option) any later version.
14 *
15 */
16
17#include <linux/config.h>
18#include <asm/processor.h>
19#include <asm/ppc_asm.h>
20#include <asm/cputable.h>
21
22/*
23 * Flush and disable all data caches (dL1, L2, L3). This is used
24 * when going to sleep, when doing a PMU based cpufreq transition,
25 * or when "offlining" a CPU on SMP machines. This code is over
26 * paranoid, but I've had enough issues with various CPU revs and
27 * bugs that I decided it was worth beeing over cautious
28 */
29
30_GLOBAL(flush_disable_caches)
31BEGIN_FTR_SECTION
32 b flush_disable_745x
33END_FTR_SECTION_IFSET(CPU_FTR_SPEC7450)
34BEGIN_FTR_SECTION
35 b flush_disable_75x
36END_FTR_SECTION_IFSET(CPU_FTR_L2CR)
37 b __flush_disable_L1
38
39/* This is the code for G3 and 74[01]0 */
40flush_disable_75x:
41 mflr r10
42
43 /* Turn off EE and DR in MSR */
44 mfmsr r11
45 rlwinm r0,r11,0,~MSR_EE
46 rlwinm r0,r0,0,~MSR_DR
47 sync
48 mtmsr r0
49 isync
50
51 /* Stop DST streams */
52BEGIN_FTR_SECTION
53 DSSALL
54 sync
55END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
56
57 /* Stop DPM */
58 mfspr r8,SPRN_HID0 /* Save SPRN_HID0 in r8 */
59 rlwinm r4,r8,0,12,10 /* Turn off HID0[DPM] */
60 sync
61 mtspr SPRN_HID0,r4 /* Disable DPM */
62 sync
63
64 /* disp-flush L1 */
65 li r4,0x4000
66 mtctr r4
67 lis r4,0xfff0
681: lwzx r0,r0,r4
69 addi r4,r4,32
70 bdnz 1b
71 sync
72 isync
73
74 /* disable / invalidate / enable L1 data */
75 mfspr r3,SPRN_HID0
76 rlwinm r0,r0,0,~HID0_DCE
77 mtspr SPRN_HID0,r3
78 sync
79 isync
80 ori r3,r3,HID0_DCE|HID0_DCI
81 sync
82 isync
83 mtspr SPRN_HID0,r3
84 xori r3,r3,HID0_DCI
85 mtspr SPRN_HID0,r3
86 sync
87
88 /* Get the current enable bit of the L2CR into r4 */
89 mfspr r5,SPRN_L2CR
90 /* Set to data-only (pre-745x bit) */
91 oris r3,r5,L2CR_L2DO@h
92 b 2f
93 /* When disabling L2, code must be in L1 */
94 .balign 32
951: mtspr SPRN_L2CR,r3
963: sync
97 isync
98 b 1f
992: b 3f
1003: sync
101 isync
102 b 1b
1031: /* disp-flush L2. The interesting thing here is that the L2 can be
104 * up to 2Mb ... so using the ROM, we'll end up wrapping back to memory
105 * but that is probbaly fine. We disp-flush over 4Mb to be safe
106 */
107 lis r4,2
108 mtctr r4
109 lis r4,0xfff0
1101: lwzx r0,r0,r4
111 addi r4,r4,32
112 bdnz 1b
113 sync
114 isync
115 /* now disable L2 */
116 rlwinm r5,r5,0,~L2CR_L2E
117 b 2f
118 /* When disabling L2, code must be in L1 */
119 .balign 32
1201: mtspr SPRN_L2CR,r5
1213: sync
122 isync
123 b 1f
1242: b 3f
1253: sync
126 isync
127 b 1b
1281: sync
129 isync
130 /* Invalidate L2. This is pre-745x, we clear the L2I bit ourselves */
131 oris r4,r5,L2CR_L2I@h
132 mtspr SPRN_L2CR,r4
133 sync
134 isync
135 xoris r4,r4,L2CR_L2I@h
136 sync
137 mtspr SPRN_L2CR,r4
138 sync
139
140 /* now disable the L1 data cache */
141 mfspr r0,SPRN_HID0
142 rlwinm r0,r0,0,~HID0_DCE
143 mtspr SPRN_HID0,r0
144 sync
145 isync
146
147 /* Restore HID0[DPM] to whatever it was before */
148 sync
149 mtspr SPRN_HID0,r8
150 sync
151
152 /* restore DR and EE */
153 sync
154 mtmsr r11
155 isync
156
157 mtlr r10
158 blr
159
160/* This code is for 745x processors */
161flush_disable_745x:
162 /* Turn off EE and DR in MSR */
163 mfmsr r11
164 rlwinm r0,r11,0,~MSR_EE
165 rlwinm r0,r0,0,~MSR_DR
166 sync
167 mtmsr r0
168 isync
169
170 /* Stop prefetch streams */
171 DSSALL
172 sync
173
174 /* Disable L2 prefetching */
175 mfspr r0,SPRN_MSSCR0
176 rlwinm r0,r0,0,0,29
177 mtspr SPRN_MSSCR0,r0
178 sync
179 isync
180 lis r4,0
181 dcbf 0,r4
182 dcbf 0,r4
183 dcbf 0,r4
184 dcbf 0,r4
185 dcbf 0,r4
186 dcbf 0,r4
187 dcbf 0,r4
188 dcbf 0,r4
189
190 /* Due to a bug with the HW flush on some CPU revs, we occasionally
191 * experience data corruption. I'm adding a displacement flush along
192 * with a dcbf loop over a few Mb to "help". The problem isn't totally
193 * fixed by this in theory, but at least, in practice, I couldn't reproduce
194 * it even with a big hammer...
195 */
196
197 lis r4,0x0002
198 mtctr r4
199 li r4,0
2001:
201 lwzx r0,r0,r4
202 addi r4,r4,32 /* Go to start of next cache line */
203 bdnz 1b
204 isync
205
206 /* Now, flush the first 4MB of memory */
207 lis r4,0x0002
208 mtctr r4
209 li r4,0
210 sync
2111:
212 dcbf 0,r4
213 addi r4,r4,32 /* Go to start of next cache line */
214 bdnz 1b
215
216 /* Flush and disable the L1 data cache */
217 mfspr r6,SPRN_LDSTCR
218 lis r3,0xfff0 /* read from ROM for displacement flush */
219 li r4,0xfe /* start with only way 0 unlocked */
220 li r5,128 /* 128 lines in each way */
2211: mtctr r5
222 rlwimi r6,r4,0,24,31
223 mtspr SPRN_LDSTCR,r6
224 sync
225 isync
2262: lwz r0,0(r3) /* touch each cache line */
227 addi r3,r3,32
228 bdnz 2b
229 rlwinm r4,r4,1,24,30 /* move on to the next way */
230 ori r4,r4,1
231 cmpwi r4,0xff /* all done? */
232 bne 1b
233 /* now unlock the L1 data cache */
234 li r4,0
235 rlwimi r6,r4,0,24,31
236 sync
237 mtspr SPRN_LDSTCR,r6
238 sync
239 isync
240
241 /* Flush the L2 cache using the hardware assist */
242 mfspr r3,SPRN_L2CR
243 cmpwi r3,0 /* check if it is enabled first */
244 bge 4f
245 oris r0,r3,(L2CR_L2IO_745x|L2CR_L2DO_745x)@h
246 b 2f
247 /* When disabling/locking L2, code must be in L1 */
248 .balign 32
2491: mtspr SPRN_L2CR,r0 /* lock the L2 cache */
2503: sync
251 isync
252 b 1f
2532: b 3f
2543: sync
255 isync
256 b 1b
2571: sync
258 isync
259 ori r0,r3,L2CR_L2HWF_745x
260 sync
261 mtspr SPRN_L2CR,r0 /* set the hardware flush bit */
2623: mfspr r0,SPRN_L2CR /* wait for it to go to 0 */
263 andi. r0,r0,L2CR_L2HWF_745x
264 bne 3b
265 sync
266 rlwinm r3,r3,0,~L2CR_L2E
267 b 2f
268 /* When disabling L2, code must be in L1 */
269 .balign 32
2701: mtspr SPRN_L2CR,r3 /* disable the L2 cache */
2713: sync
272 isync
273 b 1f
2742: b 3f
2753: sync
276 isync
277 b 1b
2781: sync
279 isync
280 oris r4,r3,L2CR_L2I@h
281 mtspr SPRN_L2CR,r4
282 sync
283 isync
2841: mfspr r4,SPRN_L2CR
285 andis. r0,r4,L2CR_L2I@h
286 bne 1b
287 sync
288
289BEGIN_FTR_SECTION
290 /* Flush the L3 cache using the hardware assist */
2914: mfspr r3,SPRN_L3CR
292 cmpwi r3,0 /* check if it is enabled */
293 bge 6f
294 oris r0,r3,L3CR_L3IO@h
295 ori r0,r0,L3CR_L3DO
296 sync
297 mtspr SPRN_L3CR,r0 /* lock the L3 cache */
298 sync
299 isync
300 ori r0,r0,L3CR_L3HWF
301 sync
302 mtspr SPRN_L3CR,r0 /* set the hardware flush bit */
3035: mfspr r0,SPRN_L3CR /* wait for it to go to zero */
304 andi. r0,r0,L3CR_L3HWF
305 bne 5b
306 rlwinm r3,r3,0,~L3CR_L3E
307 sync
308 mtspr SPRN_L3CR,r3 /* disable the L3 cache */
309 sync
310 ori r4,r3,L3CR_L3I
311 mtspr SPRN_L3CR,r4
3121: mfspr r4,SPRN_L3CR
313 andi. r0,r4,L3CR_L3I
314 bne 1b
315 sync
316END_FTR_SECTION_IFSET(CPU_FTR_L3CR)
317
3186: mfspr r0,SPRN_HID0 /* now disable the L1 data cache */
319 rlwinm r0,r0,0,~HID0_DCE
320 mtspr SPRN_HID0,r0
321 sync
322 isync
323 mtmsr r11 /* restore DR and EE */
324 isync
325 blr
diff --git a/arch/ppc/platforms/pmac_cpufreq.c b/arch/ppc/platforms/pmac_cpufreq.c
new file mode 100644
index 000000000000..9c85f9ca1cfb
--- /dev/null
+++ b/arch/ppc/platforms/pmac_cpufreq.c
@@ -0,0 +1,571 @@
1/*
2 * arch/ppc/platforms/pmac_cpufreq.c
3 *
4 * Copyright (C) 2002 - 2004 Benjamin Herrenschmidt <benh@kernel.crashing.org>
5 * Copyright (C) 2004 John Steele Scott <toojays@toojays.net>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 */
12
13#include <linux/config.h>
14#include <linux/module.h>
15#include <linux/types.h>
16#include <linux/errno.h>
17#include <linux/kernel.h>
18#include <linux/delay.h>
19#include <linux/sched.h>
20#include <linux/adb.h>
21#include <linux/pmu.h>
22#include <linux/slab.h>
23#include <linux/cpufreq.h>
24#include <linux/init.h>
25#include <linux/sysdev.h>
26#include <linux/i2c.h>
27#include <linux/hardirq.h>
28#include <asm/prom.h>
29#include <asm/machdep.h>
30#include <asm/irq.h>
31#include <asm/pmac_feature.h>
32#include <asm/mmu_context.h>
33#include <asm/sections.h>
34#include <asm/cputable.h>
35#include <asm/time.h>
36#include <asm/system.h>
37#include <asm/open_pic.h>
38
39/* WARNING !!! This will cause calibrate_delay() to be called,
40 * but this is an __init function ! So you MUST go edit
41 * init/main.c to make it non-init before enabling DEBUG_FREQ
42 */
43#undef DEBUG_FREQ
44
45/*
46 * There is a problem with the core cpufreq code on SMP kernels,
47 * it won't recalculate the Bogomips properly
48 */
49#ifdef CONFIG_SMP
50#warning "WARNING, CPUFREQ not recommended on SMP kernels"
51#endif
52
53extern void low_choose_7447a_dfs(int dfs);
54extern void low_choose_750fx_pll(int pll);
55extern void low_sleep_handler(void);
56
57/*
58 * Currently, PowerMac cpufreq supports only high & low frequencies
59 * that are set by the firmware
60 */
61static unsigned int low_freq;
62static unsigned int hi_freq;
63static unsigned int cur_freq;
64
65/*
66 * Different models uses different mecanisms to switch the frequency
67 */
68static int (*set_speed_proc)(int low_speed);
69
70/*
71 * Some definitions used by the various speedprocs
72 */
73static u32 voltage_gpio;
74static u32 frequency_gpio;
75static u32 slew_done_gpio;
76
77
78#define PMAC_CPU_LOW_SPEED 1
79#define PMAC_CPU_HIGH_SPEED 0
80
81/* There are only two frequency states for each processor. Values
82 * are in kHz for the time being.
83 */
84#define CPUFREQ_HIGH PMAC_CPU_HIGH_SPEED
85#define CPUFREQ_LOW PMAC_CPU_LOW_SPEED
86
87static struct cpufreq_frequency_table pmac_cpu_freqs[] = {
88 {CPUFREQ_HIGH, 0},
89 {CPUFREQ_LOW, 0},
90 {0, CPUFREQ_TABLE_END},
91};
92
93static inline void wakeup_decrementer(void)
94{
95 set_dec(tb_ticks_per_jiffy);
96 /* No currently-supported powerbook has a 601,
97 * so use get_tbl, not native
98 */
99 last_jiffy_stamp(0) = tb_last_stamp = get_tbl();
100}
101
102#ifdef DEBUG_FREQ
103static inline void debug_calc_bogomips(void)
104{
105 /* This will cause a recalc of bogomips and display the
106 * result. We backup/restore the value to avoid affecting the
107 * core cpufreq framework's own calculation.
108 */
109 extern void calibrate_delay(void);
110
111 unsigned long save_lpj = loops_per_jiffy;
112 calibrate_delay();
113 loops_per_jiffy = save_lpj;
114}
115#endif /* DEBUG_FREQ */
116
117/* Switch CPU speed under 750FX CPU control
118 */
119static int __pmac cpu_750fx_cpu_speed(int low_speed)
120{
121#ifdef DEBUG_FREQ
122 printk(KERN_DEBUG "HID1, before: %x\n", mfspr(SPRN_HID1));
123#endif
124#ifdef CONFIG_6xx
125 low_choose_750fx_pll(low_speed);
126#endif
127#ifdef DEBUG_FREQ
128 printk(KERN_DEBUG "HID1, after: %x\n", mfspr(SPRN_HID1));
129 debug_calc_bogomips();
130#endif
131
132 return 0;
133}
134
135/* Switch CPU speed using DFS */
136static int __pmac dfs_set_cpu_speed(int low_speed)
137{
138 if (low_speed == 0) {
139 /* ramping up, set voltage first */
140 pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, voltage_gpio, 0x05);
141 /* Make sure we sleep for at least 1ms */
142 msleep(1);
143 }
144
145 /* set frequency */
146 low_choose_7447a_dfs(low_speed);
147
148 if (low_speed == 1) {
149 /* ramping down, set voltage last */
150 pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, voltage_gpio, 0x04);
151 msleep(1);
152 }
153
154 return 0;
155}
156
157static unsigned int __pmac dfs_get_cpu_speed(unsigned int cpu)
158{
159 if (mfspr(SPRN_HID1) & HID1_DFS)
160 return low_freq;
161 else
162 return hi_freq;
163}
164
165
166/* Switch CPU speed using slewing GPIOs
167 */
168static int __pmac gpios_set_cpu_speed(int low_speed)
169{
170 int gpio;
171
172 /* If ramping up, set voltage first */
173 if (low_speed == 0) {
174 pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, voltage_gpio, 0x05);
175 /* Delay is way too big but it's ok, we schedule */
176 msleep(10);
177 }
178
179 /* Set frequency */
180 pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, frequency_gpio,
181 low_speed ? 0x04 : 0x05);
182 udelay(200);
183 do {
184 set_current_state(TASK_UNINTERRUPTIBLE);
185 schedule_timeout(1);
186 gpio = pmac_call_feature(PMAC_FTR_READ_GPIO, NULL, slew_done_gpio, 0);
187 } while((gpio & 0x02) == 0);
188
189 /* If ramping down, set voltage last */
190 if (low_speed == 1) {
191 pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, voltage_gpio, 0x04);
192 /* Delay is way too big but it's ok, we schedule */
193 msleep(10);
194 }
195
196#ifdef DEBUG_FREQ
197 debug_calc_bogomips();
198#endif
199
200 return 0;
201}
202
203/* Switch CPU speed under PMU control
204 */
205static int __pmac pmu_set_cpu_speed(int low_speed)
206{
207 struct adb_request req;
208 unsigned long save_l2cr;
209 unsigned long save_l3cr;
210
211 preempt_disable();
212
213#ifdef DEBUG_FREQ
214 printk(KERN_DEBUG "HID1, before: %x\n", mfspr(SPRN_HID1));
215#endif
216 /* Disable all interrupt sources on openpic */
217 openpic_set_priority(0xf);
218
219 /* Make sure the decrementer won't interrupt us */
220 asm volatile("mtdec %0" : : "r" (0x7fffffff));
221 /* Make sure any pending DEC interrupt occuring while we did
222 * the above didn't re-enable the DEC */
223 mb();
224 asm volatile("mtdec %0" : : "r" (0x7fffffff));
225
226 /* We can now disable MSR_EE */
227 local_irq_disable();
228
229 /* Giveup the FPU & vec */
230 enable_kernel_fp();
231
232#ifdef CONFIG_ALTIVEC
233 if (cpu_has_feature(CPU_FTR_ALTIVEC))
234 enable_kernel_altivec();
235#endif /* CONFIG_ALTIVEC */
236
237 /* Save & disable L2 and L3 caches */
238 save_l3cr = _get_L3CR(); /* (returns -1 if not available) */
239 save_l2cr = _get_L2CR(); /* (returns -1 if not available) */
240
241 /* Send the new speed command. My assumption is that this command
242 * will cause PLL_CFG[0..3] to be changed next time CPU goes to sleep
243 */
244 pmu_request(&req, NULL, 6, PMU_CPU_SPEED, 'W', 'O', 'O', 'F', low_speed);
245 while (!req.complete)
246 pmu_poll();
247
248 /* Prepare the northbridge for the speed transition */
249 pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,1,1);
250
251 /* Call low level code to backup CPU state and recover from
252 * hardware reset
253 */
254 low_sleep_handler();
255
256 /* Restore the northbridge */
257 pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,1,0);
258
259 /* Restore L2 cache */
260 if (save_l2cr != 0xffffffff && (save_l2cr & L2CR_L2E) != 0)
261 _set_L2CR(save_l2cr);
262 /* Restore L3 cache */
263 if (save_l3cr != 0xffffffff && (save_l3cr & L3CR_L3E) != 0)
264 _set_L3CR(save_l3cr);
265
266 /* Restore userland MMU context */
267 set_context(current->active_mm->context, current->active_mm->pgd);
268
269#ifdef DEBUG_FREQ
270 printk(KERN_DEBUG "HID1, after: %x\n", mfspr(SPRN_HID1));
271#endif
272
273 /* Restore low level PMU operations */
274 pmu_unlock();
275
276 /* Restore decrementer */
277 wakeup_decrementer();
278
279 /* Restore interrupts */
280 openpic_set_priority(0);
281
282 /* Let interrupts flow again ... */
283 local_irq_enable();
284
285#ifdef DEBUG_FREQ
286 debug_calc_bogomips();
287#endif
288
289 preempt_enable();
290
291 return 0;
292}
293
294static int __pmac do_set_cpu_speed(int speed_mode)
295{
296 struct cpufreq_freqs freqs;
297
298 freqs.old = cur_freq;
299 freqs.new = (speed_mode == PMAC_CPU_HIGH_SPEED) ? hi_freq : low_freq;
300 freqs.cpu = smp_processor_id();
301
302 if (freqs.old == freqs.new)
303 return 0;
304
305 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
306 set_speed_proc(speed_mode == PMAC_CPU_LOW_SPEED);
307 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
308 cur_freq = (speed_mode == PMAC_CPU_HIGH_SPEED) ? hi_freq : low_freq;
309
310 return 0;
311}
312
313static int __pmac pmac_cpufreq_verify(struct cpufreq_policy *policy)
314{
315 return cpufreq_frequency_table_verify(policy, pmac_cpu_freqs);
316}
317
318static int __pmac pmac_cpufreq_target( struct cpufreq_policy *policy,
319 unsigned int target_freq,
320 unsigned int relation)
321{
322 unsigned int newstate = 0;
323
324 if (cpufreq_frequency_table_target(policy, pmac_cpu_freqs,
325 target_freq, relation, &newstate))
326 return -EINVAL;
327
328 return do_set_cpu_speed(newstate);
329}
330
331unsigned int __pmac pmac_get_one_cpufreq(int i)
332{
333 /* Supports only one CPU for now */
334 return (i == 0) ? cur_freq : 0;
335}
336
337static int __pmac pmac_cpufreq_cpu_init(struct cpufreq_policy *policy)
338{
339 if (policy->cpu != 0)
340 return -ENODEV;
341
342 policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
343 policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
344 policy->cur = cur_freq;
345
346 return cpufreq_frequency_table_cpuinfo(policy, &pmac_cpu_freqs[0]);
347}
348
349static u32 __pmac read_gpio(struct device_node *np)
350{
351 u32 *reg = (u32 *)get_property(np, "reg", NULL);
352
353 if (reg == NULL)
354 return 0;
355 /* That works for all keylargos but shall be fixed properly
356 * some day...
357 */
358 return 0x50 + (*reg);
359}
360
361static struct cpufreq_driver pmac_cpufreq_driver = {
362 .verify = pmac_cpufreq_verify,
363 .target = pmac_cpufreq_target,
364 .init = pmac_cpufreq_cpu_init,
365 .name = "powermac",
366 .owner = THIS_MODULE,
367};
368
369
370static int __pmac pmac_cpufreq_init_MacRISC3(struct device_node *cpunode)
371{
372 struct device_node *volt_gpio_np = of_find_node_by_name(NULL,
373 "voltage-gpio");
374 struct device_node *freq_gpio_np = of_find_node_by_name(NULL,
375 "frequency-gpio");
376 struct device_node *slew_done_gpio_np = of_find_node_by_name(NULL,
377 "slewing-done");
378 u32 *value;
379
380 /*
381 * Check to see if it's GPIO driven or PMU only
382 *
383 * The way we extract the GPIO address is slightly hackish, but it
384 * works well enough for now. We need to abstract the whole GPIO
385 * stuff sooner or later anyway
386 */
387
388 if (volt_gpio_np)
389 voltage_gpio = read_gpio(volt_gpio_np);
390 if (freq_gpio_np)
391 frequency_gpio = read_gpio(freq_gpio_np);
392 if (slew_done_gpio_np)
393 slew_done_gpio = read_gpio(slew_done_gpio_np);
394
395 /* If we use the frequency GPIOs, calculate the min/max speeds based
396 * on the bus frequencies
397 */
398 if (frequency_gpio && slew_done_gpio) {
399 int lenp, rc;
400 u32 *freqs, *ratio;
401
402 freqs = (u32 *)get_property(cpunode, "bus-frequencies", &lenp);
403 lenp /= sizeof(u32);
404 if (freqs == NULL || lenp != 2) {
405 printk(KERN_ERR "cpufreq: bus-frequencies incorrect or missing\n");
406 return 1;
407 }
408 ratio = (u32 *)get_property(cpunode, "processor-to-bus-ratio*2", NULL);
409 if (ratio == NULL) {
410 printk(KERN_ERR "cpufreq: processor-to-bus-ratio*2 missing\n");
411 return 1;
412 }
413
414 /* Get the min/max bus frequencies */
415 low_freq = min(freqs[0], freqs[1]);
416 hi_freq = max(freqs[0], freqs[1]);
417
418 /* Grrrr.. It _seems_ that the device-tree is lying on the low bus
419 * frequency, it claims it to be around 84Mhz on some models while
420 * it appears to be approx. 101Mhz on all. Let's hack around here...
421 * fortunately, we don't need to be too precise
422 */
423 if (low_freq < 98000000)
424 low_freq = 101000000;
425
426 /* Convert those to CPU core clocks */
427 low_freq = (low_freq * (*ratio)) / 2000;
428 hi_freq = (hi_freq * (*ratio)) / 2000;
429
430 /* Now we get the frequencies, we read the GPIO to see what is out current
431 * speed
432 */
433 rc = pmac_call_feature(PMAC_FTR_READ_GPIO, NULL, frequency_gpio, 0);
434 cur_freq = (rc & 0x01) ? hi_freq : low_freq;
435
436 set_speed_proc = gpios_set_cpu_speed;
437 return 1;
438 }
439
440 /* If we use the PMU, look for the min & max frequencies in the
441 * device-tree
442 */
443 value = (u32 *)get_property(cpunode, "min-clock-frequency", NULL);
444 if (!value)
445 return 1;
446 low_freq = (*value) / 1000;
447 /* The PowerBook G4 12" (PowerBook6,1) has an error in the device-tree
448 * here */
449 if (low_freq < 100000)
450 low_freq *= 10;
451
452 value = (u32 *)get_property(cpunode, "max-clock-frequency", NULL);
453 if (!value)
454 return 1;
455 hi_freq = (*value) / 1000;
456 set_speed_proc = pmu_set_cpu_speed;
457
458 return 0;
459}
460
461static int __pmac pmac_cpufreq_init_7447A(struct device_node *cpunode)
462{
463 struct device_node *volt_gpio_np;
464 u32 *reg;
465 struct cpufreq_driver *driver = &pmac_cpufreq_driver;
466
467 /* Look for voltage GPIO */
468 volt_gpio_np = of_find_node_by_name(NULL, "cpu-vcore-select");
469 reg = (u32 *)get_property(volt_gpio_np, "reg", NULL);
470 voltage_gpio = *reg;
471 if (!volt_gpio_np){
472 printk(KERN_ERR "cpufreq: missing cpu-vcore-select gpio\n");
473 return 1;
474 }
475
476 /* OF only reports the high frequency */
477 hi_freq = cur_freq;
478 low_freq = cur_freq/2;
479
480 /* Read actual frequency from CPU */
481 driver->get = dfs_get_cpu_speed;
482 cur_freq = driver->get(0);
483 set_speed_proc = dfs_set_cpu_speed;
484
485 return 0;
486}
487
488/* Currently, we support the following machines:
489 *
490 * - Titanium PowerBook 1Ghz (PMU based, 667Mhz & 1Ghz)
491 * - Titanium PowerBook 800 (PMU based, 667Mhz & 800Mhz)
492 * - Titanium PowerBook 400 (PMU based, 300Mhz & 400Mhz)
493 * - Titanium PowerBook 500 (PMU based, 300Mhz & 500Mhz)
494 * - iBook2 500/600 (PMU based, 400Mhz & 500/600Mhz)
495 * - iBook2 700 (CPU based, 400Mhz & 700Mhz, support low voltage)
496 * - Recent MacRISC3 laptops
497 * - All new machines with 7447A CPUs
498 */
499static int __init pmac_cpufreq_setup(void)
500{
501 struct device_node *cpunode;
502 u32 *value;
503
504 if (strstr(cmd_line, "nocpufreq"))
505 return 0;
506
507 /* Assume only one CPU */
508 cpunode = find_type_devices("cpu");
509 if (!cpunode)
510 goto out;
511
512 /* Get current cpu clock freq */
513 value = (u32 *)get_property(cpunode, "clock-frequency", NULL);
514 if (!value)
515 goto out;
516 cur_freq = (*value) / 1000;
517
518 /* Check for 7447A based MacRISC3 */
519 if (machine_is_compatible("MacRISC3") &&
520 get_property(cpunode, "dynamic-power-step", NULL) &&
521 PVR_VER(mfspr(SPRN_PVR)) == 0x8003) {
522 pmac_cpufreq_init_7447A(cpunode);
523 /* Check for other MacRISC3 machines */
524 } else if (machine_is_compatible("PowerBook3,4") ||
525 machine_is_compatible("PowerBook3,5") ||
526 machine_is_compatible("MacRISC3")) {
527 pmac_cpufreq_init_MacRISC3(cpunode);
528 /* Else check for iBook2 500/600 */
529 } else if (machine_is_compatible("PowerBook4,1")) {
530 hi_freq = cur_freq;
531 low_freq = 400000;
532 set_speed_proc = pmu_set_cpu_speed;
533 }
534 /* Else check for TiPb 400 & 500 */
535 else if (machine_is_compatible("PowerBook3,2")) {
536 /* We only know about the 400 MHz and the 500Mhz model
537 * they both have 300 MHz as low frequency
538 */
539 if (cur_freq < 350000 || cur_freq > 550000)
540 goto out;
541 hi_freq = cur_freq;
542 low_freq = 300000;
543 set_speed_proc = pmu_set_cpu_speed;
544 }
545 /* Else check for 750FX */
546 else if (PVR_VER(mfspr(SPRN_PVR)) == 0x7000) {
547 if (get_property(cpunode, "dynamic-power-step", NULL) == NULL)
548 goto out;
549 hi_freq = cur_freq;
550 value = (u32 *)get_property(cpunode, "reduced-clock-frequency", NULL);
551 if (!value)
552 goto out;
553 low_freq = (*value) / 1000;
554 set_speed_proc = cpu_750fx_cpu_speed;
555 }
556out:
557 if (set_speed_proc == NULL)
558 return -ENODEV;
559
560 pmac_cpu_freqs[CPUFREQ_LOW].frequency = low_freq;
561 pmac_cpu_freqs[CPUFREQ_HIGH].frequency = hi_freq;
562
563 printk(KERN_INFO "Registering PowerMac CPU frequency driver\n");
564 printk(KERN_INFO "Low: %d Mhz, High: %d Mhz, Boot: %d Mhz\n",
565 low_freq/1000, hi_freq/1000, cur_freq/1000);
566
567 return cpufreq_register_driver(&pmac_cpufreq_driver);
568}
569
570module_init(pmac_cpufreq_setup);
571
diff --git a/arch/ppc/platforms/pmac_feature.c b/arch/ppc/platforms/pmac_feature.c
new file mode 100644
index 000000000000..8e60550863a6
--- /dev/null
+++ b/arch/ppc/platforms/pmac_feature.c
@@ -0,0 +1,2972 @@
1/*
2 * arch/ppc/platforms/pmac_feature.c
3 *
4 * Copyright (C) 1996-2001 Paul Mackerras (paulus@cs.anu.edu.au)
5 * Ben. Herrenschmidt (benh@kernel.crashing.org)
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 *
12 * TODO:
13 *
14 * - Replace mdelay with some schedule loop if possible
15 * - Shorten some obfuscated delays on some routines (like modem
16 * power)
17 * - Refcount some clocks (see darwin)
18 * - Split split split...
19 *
20 */
21#include <linux/config.h>
22#include <linux/types.h>
23#include <linux/init.h>
24#include <linux/delay.h>
25#include <linux/kernel.h>
26#include <linux/sched.h>
27#include <linux/spinlock.h>
28#include <linux/adb.h>
29#include <linux/pmu.h>
30#include <linux/ioport.h>
31#include <linux/pci.h>
32#include <asm/sections.h>
33#include <asm/errno.h>
34#include <asm/ohare.h>
35#include <asm/heathrow.h>
36#include <asm/keylargo.h>
37#include <asm/uninorth.h>
38#include <asm/io.h>
39#include <asm/prom.h>
40#include <asm/machdep.h>
41#include <asm/pmac_feature.h>
42#include <asm/dbdma.h>
43#include <asm/pci-bridge.h>
44#include <asm/pmac_low_i2c.h>
45
46#undef DEBUG_FEATURE
47
48#ifdef DEBUG_FEATURE
49#define DBG(fmt,...) printk(KERN_DEBUG fmt)
50#else
51#define DBG(fmt,...)
52#endif
53
54#ifdef CONFIG_6xx
55extern int powersave_lowspeed;
56#endif
57
58extern int powersave_nap;
59extern struct device_node *k2_skiplist[2];
60
61
62/*
63 * We use a single global lock to protect accesses. Each driver has
64 * to take care of its own locking
65 */
66static DEFINE_SPINLOCK(feature_lock __pmacdata);
67
68#define LOCK(flags) spin_lock_irqsave(&feature_lock, flags);
69#define UNLOCK(flags) spin_unlock_irqrestore(&feature_lock, flags);
70
71
72/*
73 * Instance of some macio stuffs
74 */
75struct macio_chip macio_chips[MAX_MACIO_CHIPS] __pmacdata;
76
77struct macio_chip* __pmac
78macio_find(struct device_node* child, int type)
79{
80 while(child) {
81 int i;
82
83 for (i=0; i < MAX_MACIO_CHIPS && macio_chips[i].of_node; i++)
84 if (child == macio_chips[i].of_node &&
85 (!type || macio_chips[i].type == type))
86 return &macio_chips[i];
87 child = child->parent;
88 }
89 return NULL;
90}
91
92static const char* macio_names[] __pmacdata =
93{
94 "Unknown",
95 "Grand Central",
96 "OHare",
97 "OHareII",
98 "Heathrow",
99 "Gatwick",
100 "Paddington",
101 "Keylargo",
102 "Pangea",
103 "Intrepid",
104 "K2"
105};
106
107
108
109/*
110 * Uninorth reg. access. Note that Uni-N regs are big endian
111 */
112
113#define UN_REG(r) (uninorth_base + ((r) >> 2))
114#define UN_IN(r) (in_be32(UN_REG(r)))
115#define UN_OUT(r,v) (out_be32(UN_REG(r), (v)))
116#define UN_BIS(r,v) (UN_OUT((r), UN_IN(r) | (v)))
117#define UN_BIC(r,v) (UN_OUT((r), UN_IN(r) & ~(v)))
118
119static struct device_node* uninorth_node __pmacdata;
120static u32 __iomem * uninorth_base __pmacdata;
121static u32 uninorth_rev __pmacdata;
122static int uninorth_u3 __pmacdata;
123static void __iomem *u3_ht;
124
125/*
126 * For each motherboard family, we have a table of functions pointers
127 * that handle the various features.
128 */
129
130typedef long (*feature_call)(struct device_node* node, long param, long value);
131
132struct feature_table_entry {
133 unsigned int selector;
134 feature_call function;
135};
136
137struct pmac_mb_def
138{
139 const char* model_string;
140 const char* model_name;
141 int model_id;
142 struct feature_table_entry* features;
143 unsigned long board_flags;
144};
145static struct pmac_mb_def pmac_mb __pmacdata;
146
147/*
148 * Here are the chip specific feature functions
149 */
150
151static inline int __pmac
152simple_feature_tweak(struct device_node* node, int type, int reg, u32 mask, int value)
153{
154 struct macio_chip* macio;
155 unsigned long flags;
156
157 macio = macio_find(node, type);
158 if (!macio)
159 return -ENODEV;
160 LOCK(flags);
161 if (value)
162 MACIO_BIS(reg, mask);
163 else
164 MACIO_BIC(reg, mask);
165 (void)MACIO_IN32(reg);
166 UNLOCK(flags);
167
168 return 0;
169}
170
171#ifndef CONFIG_POWER4
172
173static long __pmac
174ohare_htw_scc_enable(struct device_node* node, long param, long value)
175{
176 struct macio_chip* macio;
177 unsigned long chan_mask;
178 unsigned long fcr;
179 unsigned long flags;
180 int htw, trans;
181 unsigned long rmask;
182
183 macio = macio_find(node, 0);
184 if (!macio)
185 return -ENODEV;
186 if (!strcmp(node->name, "ch-a"))
187 chan_mask = MACIO_FLAG_SCCA_ON;
188 else if (!strcmp(node->name, "ch-b"))
189 chan_mask = MACIO_FLAG_SCCB_ON;
190 else
191 return -ENODEV;
192
193 htw = (macio->type == macio_heathrow || macio->type == macio_paddington
194 || macio->type == macio_gatwick);
195 /* On these machines, the HRW_SCC_TRANS_EN_N bit mustn't be touched */
196 trans = (pmac_mb.model_id != PMAC_TYPE_YOSEMITE &&
197 pmac_mb.model_id != PMAC_TYPE_YIKES);
198 if (value) {
199#ifdef CONFIG_ADB_PMU
200 if ((param & 0xfff) == PMAC_SCC_IRDA)
201 pmu_enable_irled(1);
202#endif /* CONFIG_ADB_PMU */
203 LOCK(flags);
204 fcr = MACIO_IN32(OHARE_FCR);
205 /* Check if scc cell need enabling */
206 if (!(fcr & OH_SCC_ENABLE)) {
207 fcr |= OH_SCC_ENABLE;
208 if (htw) {
209 /* Side effect: this will also power up the
210 * modem, but it's too messy to figure out on which
211 * ports this controls the tranceiver and on which
212 * it controls the modem
213 */
214 if (trans)
215 fcr &= ~HRW_SCC_TRANS_EN_N;
216 MACIO_OUT32(OHARE_FCR, fcr);
217 fcr |= (rmask = HRW_RESET_SCC);
218 MACIO_OUT32(OHARE_FCR, fcr);
219 } else {
220 fcr |= (rmask = OH_SCC_RESET);
221 MACIO_OUT32(OHARE_FCR, fcr);
222 }
223 UNLOCK(flags);
224 (void)MACIO_IN32(OHARE_FCR);
225 mdelay(15);
226 LOCK(flags);
227 fcr &= ~rmask;
228 MACIO_OUT32(OHARE_FCR, fcr);
229 }
230 if (chan_mask & MACIO_FLAG_SCCA_ON)
231 fcr |= OH_SCCA_IO;
232 if (chan_mask & MACIO_FLAG_SCCB_ON)
233 fcr |= OH_SCCB_IO;
234 MACIO_OUT32(OHARE_FCR, fcr);
235 macio->flags |= chan_mask;
236 UNLOCK(flags);
237 if (param & PMAC_SCC_FLAG_XMON)
238 macio->flags |= MACIO_FLAG_SCC_LOCKED;
239 } else {
240 if (macio->flags & MACIO_FLAG_SCC_LOCKED)
241 return -EPERM;
242 LOCK(flags);
243 fcr = MACIO_IN32(OHARE_FCR);
244 if (chan_mask & MACIO_FLAG_SCCA_ON)
245 fcr &= ~OH_SCCA_IO;
246 if (chan_mask & MACIO_FLAG_SCCB_ON)
247 fcr &= ~OH_SCCB_IO;
248 MACIO_OUT32(OHARE_FCR, fcr);
249 if ((fcr & (OH_SCCA_IO | OH_SCCB_IO)) == 0) {
250 fcr &= ~OH_SCC_ENABLE;
251 if (htw && trans)
252 fcr |= HRW_SCC_TRANS_EN_N;
253 MACIO_OUT32(OHARE_FCR, fcr);
254 }
255 macio->flags &= ~(chan_mask);
256 UNLOCK(flags);
257 mdelay(10);
258#ifdef CONFIG_ADB_PMU
259 if ((param & 0xfff) == PMAC_SCC_IRDA)
260 pmu_enable_irled(0);
261#endif /* CONFIG_ADB_PMU */
262 }
263 return 0;
264}
265
266static long __pmac
267ohare_floppy_enable(struct device_node* node, long param, long value)
268{
269 return simple_feature_tweak(node, macio_ohare,
270 OHARE_FCR, OH_FLOPPY_ENABLE, value);
271}
272
273static long __pmac
274ohare_mesh_enable(struct device_node* node, long param, long value)
275{
276 return simple_feature_tweak(node, macio_ohare,
277 OHARE_FCR, OH_MESH_ENABLE, value);
278}
279
280static long __pmac
281ohare_ide_enable(struct device_node* node, long param, long value)
282{
283 switch(param) {
284 case 0:
285 /* For some reason, setting the bit in set_initial_features()
286 * doesn't stick. I'm still investigating... --BenH.
287 */
288 if (value)
289 simple_feature_tweak(node, macio_ohare,
290 OHARE_FCR, OH_IOBUS_ENABLE, 1);
291 return simple_feature_tweak(node, macio_ohare,
292 OHARE_FCR, OH_IDE0_ENABLE, value);
293 case 1:
294 return simple_feature_tweak(node, macio_ohare,
295 OHARE_FCR, OH_BAY_IDE_ENABLE, value);
296 default:
297 return -ENODEV;
298 }
299}
300
301static long __pmac
302ohare_ide_reset(struct device_node* node, long param, long value)
303{
304 switch(param) {
305 case 0:
306 return simple_feature_tweak(node, macio_ohare,
307 OHARE_FCR, OH_IDE0_RESET_N, !value);
308 case 1:
309 return simple_feature_tweak(node, macio_ohare,
310 OHARE_FCR, OH_IDE1_RESET_N, !value);
311 default:
312 return -ENODEV;
313 }
314}
315
316static long __pmac
317ohare_sleep_state(struct device_node* node, long param, long value)
318{
319 struct macio_chip* macio = &macio_chips[0];
320
321 if ((pmac_mb.board_flags & PMAC_MB_CAN_SLEEP) == 0)
322 return -EPERM;
323 if (value == 1) {
324 MACIO_BIC(OHARE_FCR, OH_IOBUS_ENABLE);
325 } else if (value == 0) {
326 MACIO_BIS(OHARE_FCR, OH_IOBUS_ENABLE);
327 }
328
329 return 0;
330}
331
332static long __pmac
333heathrow_modem_enable(struct device_node* node, long param, long value)
334{
335 struct macio_chip* macio;
336 u8 gpio;
337 unsigned long flags;
338
339 macio = macio_find(node, macio_unknown);
340 if (!macio)
341 return -ENODEV;
342 gpio = MACIO_IN8(HRW_GPIO_MODEM_RESET) & ~1;
343 if (!value) {
344 LOCK(flags);
345 MACIO_OUT8(HRW_GPIO_MODEM_RESET, gpio);
346 UNLOCK(flags);
347 (void)MACIO_IN8(HRW_GPIO_MODEM_RESET);
348 mdelay(250);
349 }
350 if (pmac_mb.model_id != PMAC_TYPE_YOSEMITE &&
351 pmac_mb.model_id != PMAC_TYPE_YIKES) {
352 LOCK(flags);
353 if (value)
354 MACIO_BIC(HEATHROW_FCR, HRW_SCC_TRANS_EN_N);
355 else
356 MACIO_BIS(HEATHROW_FCR, HRW_SCC_TRANS_EN_N);
357 UNLOCK(flags);
358 (void)MACIO_IN32(HEATHROW_FCR);
359 mdelay(250);
360 }
361 if (value) {
362 LOCK(flags);
363 MACIO_OUT8(HRW_GPIO_MODEM_RESET, gpio | 1);
364 (void)MACIO_IN8(HRW_GPIO_MODEM_RESET);
365 UNLOCK(flags); mdelay(250); LOCK(flags);
366 MACIO_OUT8(HRW_GPIO_MODEM_RESET, gpio);
367 (void)MACIO_IN8(HRW_GPIO_MODEM_RESET);
368 UNLOCK(flags); mdelay(250); LOCK(flags);
369 MACIO_OUT8(HRW_GPIO_MODEM_RESET, gpio | 1);
370 (void)MACIO_IN8(HRW_GPIO_MODEM_RESET);
371 UNLOCK(flags); mdelay(250);
372 }
373 return 0;
374}
375
376static long __pmac
377heathrow_floppy_enable(struct device_node* node, long param, long value)
378{
379 return simple_feature_tweak(node, macio_unknown,
380 HEATHROW_FCR,
381 HRW_SWIM_ENABLE|HRW_BAY_FLOPPY_ENABLE,
382 value);
383}
384
385static long __pmac
386heathrow_mesh_enable(struct device_node* node, long param, long value)
387{
388 struct macio_chip* macio;
389 unsigned long flags;
390
391 macio = macio_find(node, macio_unknown);
392 if (!macio)
393 return -ENODEV;
394 LOCK(flags);
395 /* Set clear mesh cell enable */
396 if (value)
397 MACIO_BIS(HEATHROW_FCR, HRW_MESH_ENABLE);
398 else
399 MACIO_BIC(HEATHROW_FCR, HRW_MESH_ENABLE);
400 (void)MACIO_IN32(HEATHROW_FCR);
401 udelay(10);
402 /* Set/Clear termination power */
403 if (value)
404 MACIO_BIC(HEATHROW_MBCR, 0x04000000);
405 else
406 MACIO_BIS(HEATHROW_MBCR, 0x04000000);
407 (void)MACIO_IN32(HEATHROW_MBCR);
408 udelay(10);
409 UNLOCK(flags);
410
411 return 0;
412}
413
414static long __pmac
415heathrow_ide_enable(struct device_node* node, long param, long value)
416{
417 switch(param) {
418 case 0:
419 return simple_feature_tweak(node, macio_unknown,
420 HEATHROW_FCR, HRW_IDE0_ENABLE, value);
421 case 1:
422 return simple_feature_tweak(node, macio_unknown,
423 HEATHROW_FCR, HRW_BAY_IDE_ENABLE, value);
424 default:
425 return -ENODEV;
426 }
427}
428
429static long __pmac
430heathrow_ide_reset(struct device_node* node, long param, long value)
431{
432 switch(param) {
433 case 0:
434 return simple_feature_tweak(node, macio_unknown,
435 HEATHROW_FCR, HRW_IDE0_RESET_N, !value);
436 case 1:
437 return simple_feature_tweak(node, macio_unknown,
438 HEATHROW_FCR, HRW_IDE1_RESET_N, !value);
439 default:
440 return -ENODEV;
441 }
442}
443
444static long __pmac
445heathrow_bmac_enable(struct device_node* node, long param, long value)
446{
447 struct macio_chip* macio;
448 unsigned long flags;
449
450 macio = macio_find(node, 0);
451 if (!macio)
452 return -ENODEV;
453 if (value) {
454 LOCK(flags);
455 MACIO_BIS(HEATHROW_FCR, HRW_BMAC_IO_ENABLE);
456 MACIO_BIS(HEATHROW_FCR, HRW_BMAC_RESET);
457 UNLOCK(flags);
458 (void)MACIO_IN32(HEATHROW_FCR);
459 mdelay(10);
460 LOCK(flags);
461 MACIO_BIC(HEATHROW_FCR, HRW_BMAC_RESET);
462 UNLOCK(flags);
463 (void)MACIO_IN32(HEATHROW_FCR);
464 mdelay(10);
465 } else {
466 LOCK(flags);
467 MACIO_BIC(HEATHROW_FCR, HRW_BMAC_IO_ENABLE);
468 UNLOCK(flags);
469 }
470 return 0;
471}
472
473static long __pmac
474heathrow_sound_enable(struct device_node* node, long param, long value)
475{
476 struct macio_chip* macio;
477 unsigned long flags;
478
479 /* B&W G3 and Yikes don't support that properly (the
480 * sound appear to never come back after beeing shut down).
481 */
482 if (pmac_mb.model_id == PMAC_TYPE_YOSEMITE ||
483 pmac_mb.model_id == PMAC_TYPE_YIKES)
484 return 0;
485
486 macio = macio_find(node, 0);
487 if (!macio)
488 return -ENODEV;
489 if (value) {
490 LOCK(flags);
491 MACIO_BIS(HEATHROW_FCR, HRW_SOUND_CLK_ENABLE);
492 MACIO_BIC(HEATHROW_FCR, HRW_SOUND_POWER_N);
493 UNLOCK(flags);
494 (void)MACIO_IN32(HEATHROW_FCR);
495 } else {
496 LOCK(flags);
497 MACIO_BIS(HEATHROW_FCR, HRW_SOUND_POWER_N);
498 MACIO_BIC(HEATHROW_FCR, HRW_SOUND_CLK_ENABLE);
499 UNLOCK(flags);
500 }
501 return 0;
502}
503
504static u32 save_fcr[6] __pmacdata;
505static u32 save_mbcr __pmacdata;
506static u32 save_gpio_levels[2] __pmacdata;
507static u8 save_gpio_extint[KEYLARGO_GPIO_EXTINT_CNT] __pmacdata;
508static u8 save_gpio_normal[KEYLARGO_GPIO_CNT] __pmacdata;
509static u32 save_unin_clock_ctl __pmacdata;
510static struct dbdma_regs save_dbdma[13] __pmacdata;
511static struct dbdma_regs save_alt_dbdma[13] __pmacdata;
512
513static void __pmac
514dbdma_save(struct macio_chip* macio, struct dbdma_regs* save)
515{
516 int i;
517
518 /* Save state & config of DBDMA channels */
519 for (i=0; i<13; i++) {
520 volatile struct dbdma_regs __iomem * chan = (void __iomem *)
521 (macio->base + ((0x8000+i*0x100)>>2));
522 save[i].cmdptr_hi = in_le32(&chan->cmdptr_hi);
523 save[i].cmdptr = in_le32(&chan->cmdptr);
524 save[i].intr_sel = in_le32(&chan->intr_sel);
525 save[i].br_sel = in_le32(&chan->br_sel);
526 save[i].wait_sel = in_le32(&chan->wait_sel);
527 }
528}
529
530static void __pmac
531dbdma_restore(struct macio_chip* macio, struct dbdma_regs* save)
532{
533 int i;
534
535 /* Save state & config of DBDMA channels */
536 for (i=0; i<13; i++) {
537 volatile struct dbdma_regs __iomem * chan = (void __iomem *)
538 (macio->base + ((0x8000+i*0x100)>>2));
539 out_le32(&chan->control, (ACTIVE|DEAD|WAKE|FLUSH|PAUSE|RUN)<<16);
540 while (in_le32(&chan->status) & ACTIVE)
541 mb();
542 out_le32(&chan->cmdptr_hi, save[i].cmdptr_hi);
543 out_le32(&chan->cmdptr, save[i].cmdptr);
544 out_le32(&chan->intr_sel, save[i].intr_sel);
545 out_le32(&chan->br_sel, save[i].br_sel);
546 out_le32(&chan->wait_sel, save[i].wait_sel);
547 }
548}
549
550static void __pmac
551heathrow_sleep(struct macio_chip* macio, int secondary)
552{
553 if (secondary) {
554 dbdma_save(macio, save_alt_dbdma);
555 save_fcr[2] = MACIO_IN32(0x38);
556 save_fcr[3] = MACIO_IN32(0x3c);
557 } else {
558 dbdma_save(macio, save_dbdma);
559 save_fcr[0] = MACIO_IN32(0x38);
560 save_fcr[1] = MACIO_IN32(0x3c);
561 save_mbcr = MACIO_IN32(0x34);
562 /* Make sure sound is shut down */
563 MACIO_BIS(HEATHROW_FCR, HRW_SOUND_POWER_N);
564 MACIO_BIC(HEATHROW_FCR, HRW_SOUND_CLK_ENABLE);
565 /* This seems to be necessary as well or the fan
566 * keeps coming up and battery drains fast */
567 MACIO_BIC(HEATHROW_FCR, HRW_IOBUS_ENABLE);
568 MACIO_BIC(HEATHROW_FCR, HRW_IDE0_RESET_N);
569 /* Make sure eth is down even if module or sleep
570 * won't work properly */
571 MACIO_BIC(HEATHROW_FCR, HRW_BMAC_IO_ENABLE | HRW_BMAC_RESET);
572 }
573 /* Make sure modem is shut down */
574 MACIO_OUT8(HRW_GPIO_MODEM_RESET,
575 MACIO_IN8(HRW_GPIO_MODEM_RESET) & ~1);
576 MACIO_BIS(HEATHROW_FCR, HRW_SCC_TRANS_EN_N);
577 MACIO_BIC(HEATHROW_FCR, OH_SCCA_IO|OH_SCCB_IO|HRW_SCC_ENABLE);
578
579 /* Let things settle */
580 (void)MACIO_IN32(HEATHROW_FCR);
581}
582
583static void __pmac
584heathrow_wakeup(struct macio_chip* macio, int secondary)
585{
586 if (secondary) {
587 MACIO_OUT32(0x38, save_fcr[2]);
588 (void)MACIO_IN32(0x38);
589 mdelay(1);
590 MACIO_OUT32(0x3c, save_fcr[3]);
591 (void)MACIO_IN32(0x38);
592 mdelay(10);
593 dbdma_restore(macio, save_alt_dbdma);
594 } else {
595 MACIO_OUT32(0x38, save_fcr[0] | HRW_IOBUS_ENABLE);
596 (void)MACIO_IN32(0x38);
597 mdelay(1);
598 MACIO_OUT32(0x3c, save_fcr[1]);
599 (void)MACIO_IN32(0x38);
600 mdelay(1);
601 MACIO_OUT32(0x34, save_mbcr);
602 (void)MACIO_IN32(0x38);
603 mdelay(10);
604 dbdma_restore(macio, save_dbdma);
605 }
606}
607
608static long __pmac
609heathrow_sleep_state(struct device_node* node, long param, long value)
610{
611 if ((pmac_mb.board_flags & PMAC_MB_CAN_SLEEP) == 0)
612 return -EPERM;
613 if (value == 1) {
614 if (macio_chips[1].type == macio_gatwick)
615 heathrow_sleep(&macio_chips[0], 1);
616 heathrow_sleep(&macio_chips[0], 0);
617 } else if (value == 0) {
618 heathrow_wakeup(&macio_chips[0], 0);
619 if (macio_chips[1].type == macio_gatwick)
620 heathrow_wakeup(&macio_chips[0], 1);
621 }
622 return 0;
623}
624
625static long __pmac
626core99_scc_enable(struct device_node* node, long param, long value)
627{
628 struct macio_chip* macio;
629 unsigned long flags;
630 unsigned long chan_mask;
631 u32 fcr;
632
633 macio = macio_find(node, 0);
634 if (!macio)
635 return -ENODEV;
636 if (!strcmp(node->name, "ch-a"))
637 chan_mask = MACIO_FLAG_SCCA_ON;
638 else if (!strcmp(node->name, "ch-b"))
639 chan_mask = MACIO_FLAG_SCCB_ON;
640 else
641 return -ENODEV;
642
643 if (value) {
644 int need_reset_scc = 0;
645 int need_reset_irda = 0;
646
647 LOCK(flags);
648 fcr = MACIO_IN32(KEYLARGO_FCR0);
649 /* Check if scc cell need enabling */
650 if (!(fcr & KL0_SCC_CELL_ENABLE)) {
651 fcr |= KL0_SCC_CELL_ENABLE;
652 need_reset_scc = 1;
653 }
654 if (chan_mask & MACIO_FLAG_SCCA_ON) {
655 fcr |= KL0_SCCA_ENABLE;
656 /* Don't enable line drivers for I2S modem */
657 if ((param & 0xfff) == PMAC_SCC_I2S1)
658 fcr &= ~KL0_SCC_A_INTF_ENABLE;
659 else
660 fcr |= KL0_SCC_A_INTF_ENABLE;
661 }
662 if (chan_mask & MACIO_FLAG_SCCB_ON) {
663 fcr |= KL0_SCCB_ENABLE;
664 /* Perform irda specific inits */
665 if ((param & 0xfff) == PMAC_SCC_IRDA) {
666 fcr &= ~KL0_SCC_B_INTF_ENABLE;
667 fcr |= KL0_IRDA_ENABLE;
668 fcr |= KL0_IRDA_CLK32_ENABLE | KL0_IRDA_CLK19_ENABLE;
669 fcr |= KL0_IRDA_SOURCE1_SEL;
670 fcr &= ~(KL0_IRDA_FAST_CONNECT|KL0_IRDA_DEFAULT1|KL0_IRDA_DEFAULT0);
671 fcr &= ~(KL0_IRDA_SOURCE2_SEL|KL0_IRDA_HIGH_BAND);
672 need_reset_irda = 1;
673 } else
674 fcr |= KL0_SCC_B_INTF_ENABLE;
675 }
676 MACIO_OUT32(KEYLARGO_FCR0, fcr);
677 macio->flags |= chan_mask;
678 if (need_reset_scc) {
679 MACIO_BIS(KEYLARGO_FCR0, KL0_SCC_RESET);
680 (void)MACIO_IN32(KEYLARGO_FCR0);
681 UNLOCK(flags);
682 mdelay(15);
683 LOCK(flags);
684 MACIO_BIC(KEYLARGO_FCR0, KL0_SCC_RESET);
685 }
686 if (need_reset_irda) {
687 MACIO_BIS(KEYLARGO_FCR0, KL0_IRDA_RESET);
688 (void)MACIO_IN32(KEYLARGO_FCR0);
689 UNLOCK(flags);
690 mdelay(15);
691 LOCK(flags);
692 MACIO_BIC(KEYLARGO_FCR0, KL0_IRDA_RESET);
693 }
694 UNLOCK(flags);
695 if (param & PMAC_SCC_FLAG_XMON)
696 macio->flags |= MACIO_FLAG_SCC_LOCKED;
697 } else {
698 if (macio->flags & MACIO_FLAG_SCC_LOCKED)
699 return -EPERM;
700 LOCK(flags);
701 fcr = MACIO_IN32(KEYLARGO_FCR0);
702 if (chan_mask & MACIO_FLAG_SCCA_ON)
703 fcr &= ~KL0_SCCA_ENABLE;
704 if (chan_mask & MACIO_FLAG_SCCB_ON) {
705 fcr &= ~KL0_SCCB_ENABLE;
706 /* Perform irda specific clears */
707 if ((param & 0xfff) == PMAC_SCC_IRDA) {
708 fcr &= ~KL0_IRDA_ENABLE;
709 fcr &= ~(KL0_IRDA_CLK32_ENABLE | KL0_IRDA_CLK19_ENABLE);
710 fcr &= ~(KL0_IRDA_FAST_CONNECT|KL0_IRDA_DEFAULT1|KL0_IRDA_DEFAULT0);
711 fcr &= ~(KL0_IRDA_SOURCE1_SEL|KL0_IRDA_SOURCE2_SEL|KL0_IRDA_HIGH_BAND);
712 }
713 }
714 MACIO_OUT32(KEYLARGO_FCR0, fcr);
715 if ((fcr & (KL0_SCCA_ENABLE | KL0_SCCB_ENABLE)) == 0) {
716 fcr &= ~KL0_SCC_CELL_ENABLE;
717 MACIO_OUT32(KEYLARGO_FCR0, fcr);
718 }
719 macio->flags &= ~(chan_mask);
720 UNLOCK(flags);
721 mdelay(10);
722 }
723 return 0;
724}
725
726static long __pmac
727core99_modem_enable(struct device_node* node, long param, long value)
728{
729 struct macio_chip* macio;
730 u8 gpio;
731 unsigned long flags;
732
733 /* Hack for internal USB modem */
734 if (node == NULL) {
735 if (macio_chips[0].type != macio_keylargo)
736 return -ENODEV;
737 node = macio_chips[0].of_node;
738 }
739 macio = macio_find(node, 0);
740 if (!macio)
741 return -ENODEV;
742 gpio = MACIO_IN8(KL_GPIO_MODEM_RESET);
743 gpio |= KEYLARGO_GPIO_OUTPUT_ENABLE;
744 gpio &= ~KEYLARGO_GPIO_OUTOUT_DATA;
745
746 if (!value) {
747 LOCK(flags);
748 MACIO_OUT8(KL_GPIO_MODEM_RESET, gpio);
749 UNLOCK(flags);
750 (void)MACIO_IN8(KL_GPIO_MODEM_RESET);
751 mdelay(250);
752 }
753 LOCK(flags);
754 if (value) {
755 MACIO_BIC(KEYLARGO_FCR2, KL2_ALT_DATA_OUT);
756 UNLOCK(flags);
757 (void)MACIO_IN32(KEYLARGO_FCR2);
758 mdelay(250);
759 } else {
760 MACIO_BIS(KEYLARGO_FCR2, KL2_ALT_DATA_OUT);
761 UNLOCK(flags);
762 }
763 if (value) {
764 LOCK(flags);
765 MACIO_OUT8(KL_GPIO_MODEM_RESET, gpio | KEYLARGO_GPIO_OUTOUT_DATA);
766 (void)MACIO_IN8(KL_GPIO_MODEM_RESET);
767 UNLOCK(flags); mdelay(250); LOCK(flags);
768 MACIO_OUT8(KL_GPIO_MODEM_RESET, gpio);
769 (void)MACIO_IN8(KL_GPIO_MODEM_RESET);
770 UNLOCK(flags); mdelay(250); LOCK(flags);
771 MACIO_OUT8(KL_GPIO_MODEM_RESET, gpio | KEYLARGO_GPIO_OUTOUT_DATA);
772 (void)MACIO_IN8(KL_GPIO_MODEM_RESET);
773 UNLOCK(flags); mdelay(250);
774 }
775 return 0;
776}
777
778static long __pmac
779pangea_modem_enable(struct device_node* node, long param, long value)
780{
781 struct macio_chip* macio;
782 u8 gpio;
783 unsigned long flags;
784
785 /* Hack for internal USB modem */
786 if (node == NULL) {
787 if (macio_chips[0].type != macio_pangea &&
788 macio_chips[0].type != macio_intrepid)
789 return -ENODEV;
790 node = macio_chips[0].of_node;
791 }
792 macio = macio_find(node, 0);
793 if (!macio)
794 return -ENODEV;
795 gpio = MACIO_IN8(KL_GPIO_MODEM_RESET);
796 gpio |= KEYLARGO_GPIO_OUTPUT_ENABLE;
797 gpio &= ~KEYLARGO_GPIO_OUTOUT_DATA;
798
799 if (!value) {
800 LOCK(flags);
801 MACIO_OUT8(KL_GPIO_MODEM_RESET, gpio);
802 UNLOCK(flags);
803 (void)MACIO_IN8(KL_GPIO_MODEM_RESET);
804 mdelay(250);
805 }
806 LOCK(flags);
807 if (value) {
808 MACIO_OUT8(KL_GPIO_MODEM_POWER,
809 KEYLARGO_GPIO_OUTPUT_ENABLE);
810 UNLOCK(flags);
811 (void)MACIO_IN32(KEYLARGO_FCR2);
812 mdelay(250);
813 } else {
814 MACIO_OUT8(KL_GPIO_MODEM_POWER,
815 KEYLARGO_GPIO_OUTPUT_ENABLE | KEYLARGO_GPIO_OUTOUT_DATA);
816 UNLOCK(flags);
817 }
818 if (value) {
819 LOCK(flags);
820 MACIO_OUT8(KL_GPIO_MODEM_RESET, gpio | KEYLARGO_GPIO_OUTOUT_DATA);
821 (void)MACIO_IN8(KL_GPIO_MODEM_RESET);
822 UNLOCK(flags); mdelay(250); LOCK(flags);
823 MACIO_OUT8(KL_GPIO_MODEM_RESET, gpio);
824 (void)MACIO_IN8(KL_GPIO_MODEM_RESET);
825 UNLOCK(flags); mdelay(250); LOCK(flags);
826 MACIO_OUT8(KL_GPIO_MODEM_RESET, gpio | KEYLARGO_GPIO_OUTOUT_DATA);
827 (void)MACIO_IN8(KL_GPIO_MODEM_RESET);
828 UNLOCK(flags); mdelay(250);
829 }
830 return 0;
831}
832
833static long __pmac
834core99_ata100_enable(struct device_node* node, long value)
835{
836 unsigned long flags;
837 struct pci_dev *pdev = NULL;
838 u8 pbus, pid;
839
840 if (uninorth_rev < 0x24)
841 return -ENODEV;
842
843 LOCK(flags);
844 if (value)
845 UN_BIS(UNI_N_CLOCK_CNTL, UNI_N_CLOCK_CNTL_ATA100);
846 else
847 UN_BIC(UNI_N_CLOCK_CNTL, UNI_N_CLOCK_CNTL_ATA100);
848 (void)UN_IN(UNI_N_CLOCK_CNTL);
849 UNLOCK(flags);
850 udelay(20);
851
852 if (value) {
853 if (pci_device_from_OF_node(node, &pbus, &pid) == 0)
854 pdev = pci_find_slot(pbus, pid);
855 if (pdev == NULL)
856 return 0;
857 pci_enable_device(pdev);
858 pci_set_master(pdev);
859 }
860 return 0;
861}
862
863static long __pmac
864core99_ide_enable(struct device_node* node, long param, long value)
865{
866 /* Bus ID 0 to 2 are KeyLargo based IDE, busID 3 is U2
867 * based ata-100
868 */
869 switch(param) {
870 case 0:
871 return simple_feature_tweak(node, macio_unknown,
872 KEYLARGO_FCR1, KL1_EIDE0_ENABLE, value);
873 case 1:
874 return simple_feature_tweak(node, macio_unknown,
875 KEYLARGO_FCR1, KL1_EIDE1_ENABLE, value);
876 case 2:
877 return simple_feature_tweak(node, macio_unknown,
878 KEYLARGO_FCR1, KL1_UIDE_ENABLE, value);
879 case 3:
880 return core99_ata100_enable(node, value);
881 default:
882 return -ENODEV;
883 }
884}
885
886static long __pmac
887core99_ide_reset(struct device_node* node, long param, long value)
888{
889 switch(param) {
890 case 0:
891 return simple_feature_tweak(node, macio_unknown,
892 KEYLARGO_FCR1, KL1_EIDE0_RESET_N, !value);
893 case 1:
894 return simple_feature_tweak(node, macio_unknown,
895 KEYLARGO_FCR1, KL1_EIDE1_RESET_N, !value);
896 case 2:
897 return simple_feature_tweak(node, macio_unknown,
898 KEYLARGO_FCR1, KL1_UIDE_RESET_N, !value);
899 default:
900 return -ENODEV;
901 }
902}
903
904static long __pmac
905core99_gmac_enable(struct device_node* node, long param, long value)
906{
907 unsigned long flags;
908
909 LOCK(flags);
910 if (value)
911 UN_BIS(UNI_N_CLOCK_CNTL, UNI_N_CLOCK_CNTL_GMAC);
912 else
913 UN_BIC(UNI_N_CLOCK_CNTL, UNI_N_CLOCK_CNTL_GMAC);
914 (void)UN_IN(UNI_N_CLOCK_CNTL);
915 UNLOCK(flags);
916 udelay(20);
917
918 return 0;
919}
920
921static long __pmac
922core99_gmac_phy_reset(struct device_node* node, long param, long value)
923{
924 unsigned long flags;
925 struct macio_chip* macio;
926
927 macio = &macio_chips[0];
928 if (macio->type != macio_keylargo && macio->type != macio_pangea &&
929 macio->type != macio_intrepid)
930 return -ENODEV;
931
932 LOCK(flags);
933 MACIO_OUT8(KL_GPIO_ETH_PHY_RESET, KEYLARGO_GPIO_OUTPUT_ENABLE);
934 (void)MACIO_IN8(KL_GPIO_ETH_PHY_RESET);
935 UNLOCK(flags);
936 mdelay(10);
937 LOCK(flags);
938 MACIO_OUT8(KL_GPIO_ETH_PHY_RESET, /*KEYLARGO_GPIO_OUTPUT_ENABLE | */
939 KEYLARGO_GPIO_OUTOUT_DATA);
940 UNLOCK(flags);
941 mdelay(10);
942
943 return 0;
944}
945
946static long __pmac
947core99_sound_chip_enable(struct device_node* node, long param, long value)
948{
949 struct macio_chip* macio;
950 unsigned long flags;
951
952 macio = macio_find(node, 0);
953 if (!macio)
954 return -ENODEV;
955
956 /* Do a better probe code, screamer G4 desktops &
957 * iMacs can do that too, add a recalibrate in
958 * the driver as well
959 */
960 if (pmac_mb.model_id == PMAC_TYPE_PISMO ||
961 pmac_mb.model_id == PMAC_TYPE_TITANIUM) {
962 LOCK(flags);
963 if (value)
964 MACIO_OUT8(KL_GPIO_SOUND_POWER,
965 KEYLARGO_GPIO_OUTPUT_ENABLE |
966 KEYLARGO_GPIO_OUTOUT_DATA);
967 else
968 MACIO_OUT8(KL_GPIO_SOUND_POWER,
969 KEYLARGO_GPIO_OUTPUT_ENABLE);
970 (void)MACIO_IN8(KL_GPIO_SOUND_POWER);
971 UNLOCK(flags);
972 }
973 return 0;
974}
975
976static long __pmac
977core99_airport_enable(struct device_node* node, long param, long value)
978{
979 struct macio_chip* macio;
980 unsigned long flags;
981 int state;
982
983 macio = macio_find(node, 0);
984 if (!macio)
985 return -ENODEV;
986
987 /* Hint: we allow passing of macio itself for the sake of the
988 * sleep code
989 */
990 if (node != macio->of_node &&
991 (!node->parent || node->parent != macio->of_node))
992 return -ENODEV;
993 state = (macio->flags & MACIO_FLAG_AIRPORT_ON) != 0;
994 if (value == state)
995 return 0;
996 if (value) {
997 /* This code is a reproduction of OF enable-cardslot
998 * and init-wireless methods, slightly hacked until
999 * I got it working.
1000 */
1001 LOCK(flags);
1002 MACIO_OUT8(KEYLARGO_GPIO_0+0xf, 5);
1003 (void)MACIO_IN8(KEYLARGO_GPIO_0+0xf);
1004 UNLOCK(flags);
1005 mdelay(10);
1006 LOCK(flags);
1007 MACIO_OUT8(KEYLARGO_GPIO_0+0xf, 4);
1008 (void)MACIO_IN8(KEYLARGO_GPIO_0+0xf);
1009 UNLOCK(flags);
1010
1011 mdelay(10);
1012
1013 LOCK(flags);
1014 MACIO_BIC(KEYLARGO_FCR2, KL2_CARDSEL_16);
1015 (void)MACIO_IN32(KEYLARGO_FCR2);
1016 udelay(10);
1017 MACIO_OUT8(KEYLARGO_GPIO_EXTINT_0+0xb, 0);
1018 (void)MACIO_IN8(KEYLARGO_GPIO_EXTINT_0+0xb);
1019 udelay(10);
1020 MACIO_OUT8(KEYLARGO_GPIO_EXTINT_0+0xa, 0x28);
1021 (void)MACIO_IN8(KEYLARGO_GPIO_EXTINT_0+0xa);
1022 udelay(10);
1023 MACIO_OUT8(KEYLARGO_GPIO_EXTINT_0+0xd, 0x28);
1024 (void)MACIO_IN8(KEYLARGO_GPIO_EXTINT_0+0xd);
1025 udelay(10);
1026 MACIO_OUT8(KEYLARGO_GPIO_0+0xd, 0x28);
1027 (void)MACIO_IN8(KEYLARGO_GPIO_0+0xd);
1028 udelay(10);
1029 MACIO_OUT8(KEYLARGO_GPIO_0+0xe, 0x28);
1030 (void)MACIO_IN8(KEYLARGO_GPIO_0+0xe);
1031 UNLOCK(flags);
1032 udelay(10);
1033 MACIO_OUT32(0x1c000, 0);
1034 mdelay(1);
1035 MACIO_OUT8(0x1a3e0, 0x41);
1036 (void)MACIO_IN8(0x1a3e0);
1037 udelay(10);
1038 LOCK(flags);
1039 MACIO_BIS(KEYLARGO_FCR2, KL2_CARDSEL_16);
1040 (void)MACIO_IN32(KEYLARGO_FCR2);
1041 UNLOCK(flags);
1042 mdelay(100);
1043
1044 macio->flags |= MACIO_FLAG_AIRPORT_ON;
1045 } else {
1046 LOCK(flags);
1047 MACIO_BIC(KEYLARGO_FCR2, KL2_CARDSEL_16);
1048 (void)MACIO_IN32(KEYLARGO_FCR2);
1049 MACIO_OUT8(KL_GPIO_AIRPORT_0, 0);
1050 MACIO_OUT8(KL_GPIO_AIRPORT_1, 0);
1051 MACIO_OUT8(KL_GPIO_AIRPORT_2, 0);
1052 MACIO_OUT8(KL_GPIO_AIRPORT_3, 0);
1053 MACIO_OUT8(KL_GPIO_AIRPORT_4, 0);
1054 (void)MACIO_IN8(KL_GPIO_AIRPORT_4);
1055 UNLOCK(flags);
1056
1057 macio->flags &= ~MACIO_FLAG_AIRPORT_ON;
1058 }
1059 return 0;
1060}
1061
1062#ifdef CONFIG_SMP
1063static long __pmac
1064core99_reset_cpu(struct device_node* node, long param, long value)
1065{
1066 unsigned int reset_io = 0;
1067 unsigned long flags;
1068 struct macio_chip* macio;
1069 struct device_node* np;
1070 const int dflt_reset_lines[] = { KL_GPIO_RESET_CPU0,
1071 KL_GPIO_RESET_CPU1,
1072 KL_GPIO_RESET_CPU2,
1073 KL_GPIO_RESET_CPU3 };
1074
1075 macio = &macio_chips[0];
1076 if (macio->type != macio_keylargo)
1077 return -ENODEV;
1078
1079 np = find_path_device("/cpus");
1080 if (np == NULL)
1081 return -ENODEV;
1082 for (np = np->child; np != NULL; np = np->sibling) {
1083 u32* num = (u32 *)get_property(np, "reg", NULL);
1084 u32* rst = (u32 *)get_property(np, "soft-reset", NULL);
1085 if (num == NULL || rst == NULL)
1086 continue;
1087 if (param == *num) {
1088 reset_io = *rst;
1089 break;
1090 }
1091 }
1092 if (np == NULL || reset_io == 0)
1093 reset_io = dflt_reset_lines[param];
1094
1095 LOCK(flags);
1096 MACIO_OUT8(reset_io, KEYLARGO_GPIO_OUTPUT_ENABLE);
1097 (void)MACIO_IN8(reset_io);
1098 udelay(1);
1099 MACIO_OUT8(reset_io, 0);
1100 (void)MACIO_IN8(reset_io);
1101 UNLOCK(flags);
1102
1103 return 0;
1104}
1105#endif /* CONFIG_SMP */
1106
1107static long __pmac
1108core99_usb_enable(struct device_node* node, long param, long value)
1109{
1110 struct macio_chip* macio;
1111 unsigned long flags;
1112 char* prop;
1113 int number;
1114 u32 reg;
1115
1116 macio = &macio_chips[0];
1117 if (macio->type != macio_keylargo && macio->type != macio_pangea &&
1118 macio->type != macio_intrepid)
1119 return -ENODEV;
1120
1121 prop = (char *)get_property(node, "AAPL,clock-id", NULL);
1122 if (!prop)
1123 return -ENODEV;
1124 if (strncmp(prop, "usb0u048", 8) == 0)
1125 number = 0;
1126 else if (strncmp(prop, "usb1u148", 8) == 0)
1127 number = 2;
1128 else if (strncmp(prop, "usb2u248", 8) == 0)
1129 number = 4;
1130 else
1131 return -ENODEV;
1132
1133 /* Sorry for the brute-force locking, but this is only used during
1134 * sleep and the timing seem to be critical
1135 */
1136 LOCK(flags);
1137 if (value) {
1138 /* Turn ON */
1139 if (number == 0) {
1140 MACIO_BIC(KEYLARGO_FCR0, (KL0_USB0_PAD_SUSPEND0 | KL0_USB0_PAD_SUSPEND1));
1141 (void)MACIO_IN32(KEYLARGO_FCR0);
1142 UNLOCK(flags);
1143 mdelay(1);
1144 LOCK(flags);
1145 MACIO_BIS(KEYLARGO_FCR0, KL0_USB0_CELL_ENABLE);
1146 } else if (number == 2) {
1147 MACIO_BIC(KEYLARGO_FCR0, (KL0_USB1_PAD_SUSPEND0 | KL0_USB1_PAD_SUSPEND1));
1148 UNLOCK(flags);
1149 (void)MACIO_IN32(KEYLARGO_FCR0);
1150 mdelay(1);
1151 LOCK(flags);
1152 MACIO_BIS(KEYLARGO_FCR0, KL0_USB1_CELL_ENABLE);
1153 } else if (number == 4) {
1154 MACIO_BIC(KEYLARGO_FCR1, (KL1_USB2_PAD_SUSPEND0 | KL1_USB2_PAD_SUSPEND1));
1155 UNLOCK(flags);
1156 (void)MACIO_IN32(KEYLARGO_FCR1);
1157 mdelay(1);
1158 LOCK(flags);
1159 MACIO_BIS(KEYLARGO_FCR1, KL1_USB2_CELL_ENABLE);
1160 }
1161 if (number < 4) {
1162 reg = MACIO_IN32(KEYLARGO_FCR4);
1163 reg &= ~(KL4_PORT_WAKEUP_ENABLE(number) | KL4_PORT_RESUME_WAKE_EN(number) |
1164 KL4_PORT_CONNECT_WAKE_EN(number) | KL4_PORT_DISCONNECT_WAKE_EN(number));
1165 reg &= ~(KL4_PORT_WAKEUP_ENABLE(number+1) | KL4_PORT_RESUME_WAKE_EN(number+1) |
1166 KL4_PORT_CONNECT_WAKE_EN(number+1) | KL4_PORT_DISCONNECT_WAKE_EN(number+1));
1167 MACIO_OUT32(KEYLARGO_FCR4, reg);
1168 (void)MACIO_IN32(KEYLARGO_FCR4);
1169 udelay(10);
1170 } else {
1171 reg = MACIO_IN32(KEYLARGO_FCR3);
1172 reg &= ~(KL3_IT_PORT_WAKEUP_ENABLE(0) | KL3_IT_PORT_RESUME_WAKE_EN(0) |
1173 KL3_IT_PORT_CONNECT_WAKE_EN(0) | KL3_IT_PORT_DISCONNECT_WAKE_EN(0));
1174 reg &= ~(KL3_IT_PORT_WAKEUP_ENABLE(1) | KL3_IT_PORT_RESUME_WAKE_EN(1) |
1175 KL3_IT_PORT_CONNECT_WAKE_EN(1) | KL3_IT_PORT_DISCONNECT_WAKE_EN(1));
1176 MACIO_OUT32(KEYLARGO_FCR3, reg);
1177 (void)MACIO_IN32(KEYLARGO_FCR3);
1178 udelay(10);
1179 }
1180 if (macio->type == macio_intrepid) {
1181 /* wait for clock stopped bits to clear */
1182 u32 test0 = 0, test1 = 0;
1183 u32 status0, status1;
1184 int timeout = 1000;
1185
1186 UNLOCK(flags);
1187 switch (number) {
1188 case 0:
1189 test0 = UNI_N_CLOCK_STOPPED_USB0;
1190 test1 = UNI_N_CLOCK_STOPPED_USB0PCI;
1191 break;
1192 case 2:
1193 test0 = UNI_N_CLOCK_STOPPED_USB1;
1194 test1 = UNI_N_CLOCK_STOPPED_USB1PCI;
1195 break;
1196 case 4:
1197 test0 = UNI_N_CLOCK_STOPPED_USB2;
1198 test1 = UNI_N_CLOCK_STOPPED_USB2PCI;
1199 break;
1200 }
1201 do {
1202 if (--timeout <= 0) {
1203 printk(KERN_ERR "core99_usb_enable: "
1204 "Timeout waiting for clocks\n");
1205 break;
1206 }
1207 mdelay(1);
1208 status0 = UN_IN(UNI_N_CLOCK_STOP_STATUS0);
1209 status1 = UN_IN(UNI_N_CLOCK_STOP_STATUS1);
1210 } while ((status0 & test0) | (status1 & test1));
1211 LOCK(flags);
1212 }
1213 } else {
1214 /* Turn OFF */
1215 if (number < 4) {
1216 reg = MACIO_IN32(KEYLARGO_FCR4);
1217 reg |= KL4_PORT_WAKEUP_ENABLE(number) | KL4_PORT_RESUME_WAKE_EN(number) |
1218 KL4_PORT_CONNECT_WAKE_EN(number) | KL4_PORT_DISCONNECT_WAKE_EN(number);
1219 reg |= KL4_PORT_WAKEUP_ENABLE(number+1) | KL4_PORT_RESUME_WAKE_EN(number+1) |
1220 KL4_PORT_CONNECT_WAKE_EN(number+1) | KL4_PORT_DISCONNECT_WAKE_EN(number+1);
1221 MACIO_OUT32(KEYLARGO_FCR4, reg);
1222 (void)MACIO_IN32(KEYLARGO_FCR4);
1223 udelay(1);
1224 } else {
1225 reg = MACIO_IN32(KEYLARGO_FCR3);
1226 reg |= KL3_IT_PORT_WAKEUP_ENABLE(0) | KL3_IT_PORT_RESUME_WAKE_EN(0) |
1227 KL3_IT_PORT_CONNECT_WAKE_EN(0) | KL3_IT_PORT_DISCONNECT_WAKE_EN(0);
1228 reg |= KL3_IT_PORT_WAKEUP_ENABLE(1) | KL3_IT_PORT_RESUME_WAKE_EN(1) |
1229 KL3_IT_PORT_CONNECT_WAKE_EN(1) | KL3_IT_PORT_DISCONNECT_WAKE_EN(1);
1230 MACIO_OUT32(KEYLARGO_FCR3, reg);
1231 (void)MACIO_IN32(KEYLARGO_FCR3);
1232 udelay(1);
1233 }
1234 if (number == 0) {
1235 if (macio->type != macio_intrepid)
1236 MACIO_BIC(KEYLARGO_FCR0, KL0_USB0_CELL_ENABLE);
1237 (void)MACIO_IN32(KEYLARGO_FCR0);
1238 udelay(1);
1239 MACIO_BIS(KEYLARGO_FCR0, (KL0_USB0_PAD_SUSPEND0 | KL0_USB0_PAD_SUSPEND1));
1240 (void)MACIO_IN32(KEYLARGO_FCR0);
1241 } else if (number == 2) {
1242 if (macio->type != macio_intrepid)
1243 MACIO_BIC(KEYLARGO_FCR0, KL0_USB1_CELL_ENABLE);
1244 (void)MACIO_IN32(KEYLARGO_FCR0);
1245 udelay(1);
1246 MACIO_BIS(KEYLARGO_FCR0, (KL0_USB1_PAD_SUSPEND0 | KL0_USB1_PAD_SUSPEND1));
1247 (void)MACIO_IN32(KEYLARGO_FCR0);
1248 } else if (number == 4) {
1249 udelay(1);
1250 MACIO_BIS(KEYLARGO_FCR1, (KL1_USB2_PAD_SUSPEND0 | KL1_USB2_PAD_SUSPEND1));
1251 (void)MACIO_IN32(KEYLARGO_FCR1);
1252 }
1253 udelay(1);
1254 }
1255 UNLOCK(flags);
1256
1257 return 0;
1258}
1259
1260static long __pmac
1261core99_firewire_enable(struct device_node* node, long param, long value)
1262{
1263 unsigned long flags;
1264 struct macio_chip* macio;
1265
1266 macio = &macio_chips[0];
1267 if (macio->type != macio_keylargo && macio->type != macio_pangea &&
1268 macio->type != macio_intrepid)
1269 return -ENODEV;
1270 if (!(macio->flags & MACIO_FLAG_FW_SUPPORTED))
1271 return -ENODEV;
1272
1273 LOCK(flags);
1274 if (value) {
1275 UN_BIS(UNI_N_CLOCK_CNTL, UNI_N_CLOCK_CNTL_FW);
1276 (void)UN_IN(UNI_N_CLOCK_CNTL);
1277 } else {
1278 UN_BIC(UNI_N_CLOCK_CNTL, UNI_N_CLOCK_CNTL_FW);
1279 (void)UN_IN(UNI_N_CLOCK_CNTL);
1280 }
1281 UNLOCK(flags);
1282 mdelay(1);
1283
1284 return 0;
1285}
1286
1287static long __pmac
1288core99_firewire_cable_power(struct device_node* node, long param, long value)
1289{
1290 unsigned long flags;
1291 struct macio_chip* macio;
1292
1293 /* Trick: we allow NULL node */
1294 if ((pmac_mb.board_flags & PMAC_MB_HAS_FW_POWER) == 0)
1295 return -ENODEV;
1296 macio = &macio_chips[0];
1297 if (macio->type != macio_keylargo && macio->type != macio_pangea &&
1298 macio->type != macio_intrepid)
1299 return -ENODEV;
1300 if (!(macio->flags & MACIO_FLAG_FW_SUPPORTED))
1301 return -ENODEV;
1302
1303 LOCK(flags);
1304 if (value) {
1305 MACIO_OUT8(KL_GPIO_FW_CABLE_POWER , 0);
1306 MACIO_IN8(KL_GPIO_FW_CABLE_POWER);
1307 udelay(10);
1308 } else {
1309 MACIO_OUT8(KL_GPIO_FW_CABLE_POWER , 4);
1310 MACIO_IN8(KL_GPIO_FW_CABLE_POWER); udelay(10);
1311 }
1312 UNLOCK(flags);
1313 mdelay(1);
1314
1315 return 0;
1316}
1317
1318static long __pmac
1319intrepid_aack_delay_enable(struct device_node* node, long param, long value)
1320{
1321 unsigned long flags;
1322
1323 if (uninorth_rev < 0xd2)
1324 return -ENODEV;
1325
1326 LOCK(flags);
1327 if (param)
1328 UN_BIS(UNI_N_AACK_DELAY, UNI_N_AACK_DELAY_ENABLE);
1329 else
1330 UN_BIC(UNI_N_AACK_DELAY, UNI_N_AACK_DELAY_ENABLE);
1331 UNLOCK(flags);
1332
1333 return 0;
1334}
1335
1336
1337#endif /* CONFIG_POWER4 */
1338
1339static long __pmac
1340core99_read_gpio(struct device_node* node, long param, long value)
1341{
1342 struct macio_chip* macio = &macio_chips[0];
1343
1344 return MACIO_IN8(param);
1345}
1346
1347
1348static long __pmac
1349core99_write_gpio(struct device_node* node, long param, long value)
1350{
1351 struct macio_chip* macio = &macio_chips[0];
1352
1353 MACIO_OUT8(param, (u8)(value & 0xff));
1354 return 0;
1355}
1356
1357#ifdef CONFIG_POWER4
1358
1359static long __pmac
1360g5_gmac_enable(struct device_node* node, long param, long value)
1361{
1362 struct macio_chip* macio = &macio_chips[0];
1363 unsigned long flags;
1364 u8 pbus, pid;
1365
1366 LOCK(flags);
1367 if (value) {
1368 MACIO_BIS(KEYLARGO_FCR1, K2_FCR1_GMAC_CLK_ENABLE);
1369 mb();
1370 k2_skiplist[0] = NULL;
1371 } else {
1372 k2_skiplist[0] = node;
1373 mb();
1374 MACIO_BIC(KEYLARGO_FCR1, K2_FCR1_GMAC_CLK_ENABLE);
1375 }
1376
1377 UNLOCK(flags);
1378 mdelay(1);
1379
1380 return 0;
1381}
1382
1383static long __pmac
1384g5_fw_enable(struct device_node* node, long param, long value)
1385{
1386 struct macio_chip* macio = &macio_chips[0];
1387 unsigned long flags;
1388
1389 LOCK(flags);
1390 if (value) {
1391 MACIO_BIS(KEYLARGO_FCR1, K2_FCR1_FW_CLK_ENABLE);
1392 mb();
1393 k2_skiplist[1] = NULL;
1394 } else {
1395 k2_skiplist[1] = node;
1396 mb();
1397 MACIO_BIC(KEYLARGO_FCR1, K2_FCR1_FW_CLK_ENABLE);
1398 }
1399
1400 UNLOCK(flags);
1401 mdelay(1);
1402
1403 return 0;
1404}
1405
1406static long __pmac
1407g5_mpic_enable(struct device_node* node, long param, long value)
1408{
1409 unsigned long flags;
1410
1411 if (node->parent == NULL || strcmp(node->parent->name, "u3"))
1412 return 0;
1413
1414 LOCK(flags);
1415 UN_BIS(U3_TOGGLE_REG, U3_MPIC_RESET | U3_MPIC_OUTPUT_ENABLE);
1416 UNLOCK(flags);
1417
1418 return 0;
1419}
1420
1421#ifdef CONFIG_SMP
1422static long __pmac
1423g5_reset_cpu(struct device_node* node, long param, long value)
1424{
1425 unsigned int reset_io = 0;
1426 unsigned long flags;
1427 struct macio_chip* macio;
1428 struct device_node* np;
1429
1430 macio = &macio_chips[0];
1431 if (macio->type != macio_keylargo2)
1432 return -ENODEV;
1433
1434 np = find_path_device("/cpus");
1435 if (np == NULL)
1436 return -ENODEV;
1437 for (np = np->child; np != NULL; np = np->sibling) {
1438 u32* num = (u32 *)get_property(np, "reg", NULL);
1439 u32* rst = (u32 *)get_property(np, "soft-reset", NULL);
1440 if (num == NULL || rst == NULL)
1441 continue;
1442 if (param == *num) {
1443 reset_io = *rst;
1444 break;
1445 }
1446 }
1447 if (np == NULL || reset_io == 0)
1448 return -ENODEV;
1449
1450 LOCK(flags);
1451 MACIO_OUT8(reset_io, KEYLARGO_GPIO_OUTPUT_ENABLE);
1452 (void)MACIO_IN8(reset_io);
1453 udelay(1);
1454 MACIO_OUT8(reset_io, 0);
1455 (void)MACIO_IN8(reset_io);
1456 UNLOCK(flags);
1457
1458 return 0;
1459}
1460#endif /* CONFIG_SMP */
1461
1462/*
1463 * This can be called from pmac_smp so isn't static
1464 *
1465 * This takes the second CPU off the bus on dual CPU machines
1466 * running UP
1467 */
1468void __pmac g5_phy_disable_cpu1(void)
1469{
1470 UN_OUT(U3_API_PHY_CONFIG_1, 0);
1471}
1472
1473#endif /* CONFIG_POWER4 */
1474
1475#ifndef CONFIG_POWER4
1476
1477static void __pmac
1478keylargo_shutdown(struct macio_chip* macio, int sleep_mode)
1479{
1480 u32 temp;
1481
1482 if (sleep_mode) {
1483 mdelay(1);
1484 MACIO_BIS(KEYLARGO_FCR0, KL0_USB_REF_SUSPEND);
1485 (void)MACIO_IN32(KEYLARGO_FCR0);
1486 mdelay(1);
1487 }
1488
1489 MACIO_BIC(KEYLARGO_FCR0,KL0_SCCA_ENABLE | KL0_SCCB_ENABLE |
1490 KL0_SCC_CELL_ENABLE |
1491 KL0_IRDA_ENABLE | KL0_IRDA_CLK32_ENABLE |
1492 KL0_IRDA_CLK19_ENABLE);
1493
1494 MACIO_BIC(KEYLARGO_MBCR, KL_MBCR_MB0_DEV_MASK);
1495 MACIO_BIS(KEYLARGO_MBCR, KL_MBCR_MB0_IDE_ENABLE);
1496
1497 MACIO_BIC(KEYLARGO_FCR1,
1498 KL1_AUDIO_SEL_22MCLK | KL1_AUDIO_CLK_ENABLE_BIT |
1499 KL1_AUDIO_CLK_OUT_ENABLE | KL1_AUDIO_CELL_ENABLE |
1500 KL1_I2S0_CELL_ENABLE | KL1_I2S0_CLK_ENABLE_BIT |
1501 KL1_I2S0_ENABLE | KL1_I2S1_CELL_ENABLE |
1502 KL1_I2S1_CLK_ENABLE_BIT | KL1_I2S1_ENABLE |
1503 KL1_EIDE0_ENABLE | KL1_EIDE0_RESET_N |
1504 KL1_EIDE1_ENABLE | KL1_EIDE1_RESET_N |
1505 KL1_UIDE_ENABLE);
1506
1507 MACIO_BIS(KEYLARGO_FCR2, KL2_ALT_DATA_OUT);
1508 MACIO_BIC(KEYLARGO_FCR2, KL2_IOBUS_ENABLE);
1509
1510 temp = MACIO_IN32(KEYLARGO_FCR3);
1511 if (macio->rev >= 2) {
1512 temp |= KL3_SHUTDOWN_PLL2X;
1513 if (sleep_mode)
1514 temp |= KL3_SHUTDOWN_PLL_TOTAL;
1515 }
1516
1517 temp |= KL3_SHUTDOWN_PLLKW6 | KL3_SHUTDOWN_PLLKW4 |
1518 KL3_SHUTDOWN_PLLKW35;
1519 if (sleep_mode)
1520 temp |= KL3_SHUTDOWN_PLLKW12;
1521 temp &= ~(KL3_CLK66_ENABLE | KL3_CLK49_ENABLE | KL3_CLK45_ENABLE
1522 | KL3_CLK31_ENABLE | KL3_I2S1_CLK18_ENABLE | KL3_I2S0_CLK18_ENABLE);
1523 if (sleep_mode)
1524 temp &= ~(KL3_TIMER_CLK18_ENABLE | KL3_VIA_CLK16_ENABLE);
1525 MACIO_OUT32(KEYLARGO_FCR3, temp);
1526
1527 /* Flush posted writes & wait a bit */
1528 (void)MACIO_IN32(KEYLARGO_FCR0); mdelay(1);
1529}
1530
1531static void __pmac
1532pangea_shutdown(struct macio_chip* macio, int sleep_mode)
1533{
1534 u32 temp;
1535
1536 MACIO_BIC(KEYLARGO_FCR0,KL0_SCCA_ENABLE | KL0_SCCB_ENABLE |
1537 KL0_SCC_CELL_ENABLE |
1538 KL0_USB0_CELL_ENABLE | KL0_USB1_CELL_ENABLE);
1539
1540 MACIO_BIC(KEYLARGO_FCR1,
1541 KL1_AUDIO_SEL_22MCLK | KL1_AUDIO_CLK_ENABLE_BIT |
1542 KL1_AUDIO_CLK_OUT_ENABLE | KL1_AUDIO_CELL_ENABLE |
1543 KL1_I2S0_CELL_ENABLE | KL1_I2S0_CLK_ENABLE_BIT |
1544 KL1_I2S0_ENABLE | KL1_I2S1_CELL_ENABLE |
1545 KL1_I2S1_CLK_ENABLE_BIT | KL1_I2S1_ENABLE |
1546 KL1_UIDE_ENABLE);
1547 if (pmac_mb.board_flags & PMAC_MB_MOBILE)
1548 MACIO_BIC(KEYLARGO_FCR1, KL1_UIDE_RESET_N);
1549
1550 MACIO_BIS(KEYLARGO_FCR2, KL2_ALT_DATA_OUT);
1551
1552 temp = MACIO_IN32(KEYLARGO_FCR3);
1553 temp |= KL3_SHUTDOWN_PLLKW6 | KL3_SHUTDOWN_PLLKW4 |
1554 KL3_SHUTDOWN_PLLKW35;
1555 temp &= ~(KL3_CLK49_ENABLE | KL3_CLK45_ENABLE | KL3_CLK31_ENABLE
1556 | KL3_I2S0_CLK18_ENABLE | KL3_I2S1_CLK18_ENABLE);
1557 if (sleep_mode)
1558 temp &= ~(KL3_VIA_CLK16_ENABLE | KL3_TIMER_CLK18_ENABLE);
1559 MACIO_OUT32(KEYLARGO_FCR3, temp);
1560
1561 /* Flush posted writes & wait a bit */
1562 (void)MACIO_IN32(KEYLARGO_FCR0); mdelay(1);
1563}
1564
1565static void __pmac
1566intrepid_shutdown(struct macio_chip* macio, int sleep_mode)
1567{
1568 u32 temp;
1569
1570 MACIO_BIC(KEYLARGO_FCR0,KL0_SCCA_ENABLE | KL0_SCCB_ENABLE |
1571 KL0_SCC_CELL_ENABLE);
1572
1573 MACIO_BIC(KEYLARGO_FCR1,
1574 /*KL1_USB2_CELL_ENABLE |*/
1575 KL1_I2S0_CELL_ENABLE | KL1_I2S0_CLK_ENABLE_BIT |
1576 KL1_I2S0_ENABLE | KL1_I2S1_CELL_ENABLE |
1577 KL1_I2S1_CLK_ENABLE_BIT | KL1_I2S1_ENABLE);
1578 if (pmac_mb.board_flags & PMAC_MB_MOBILE)
1579 MACIO_BIC(KEYLARGO_FCR1, KL1_UIDE_RESET_N);
1580
1581 temp = MACIO_IN32(KEYLARGO_FCR3);
1582 temp &= ~(KL3_CLK49_ENABLE | KL3_CLK45_ENABLE |
1583 KL3_I2S1_CLK18_ENABLE | KL3_I2S0_CLK18_ENABLE);
1584 if (sleep_mode)
1585 temp &= ~(KL3_TIMER_CLK18_ENABLE | KL3_IT_VIA_CLK32_ENABLE);
1586 MACIO_OUT32(KEYLARGO_FCR3, temp);
1587
1588 /* Flush posted writes & wait a bit */
1589 (void)MACIO_IN32(KEYLARGO_FCR0);
1590 mdelay(10);
1591}
1592
1593static int __pmac
1594core99_sleep(void)
1595{
1596 struct macio_chip* macio;
1597 int i;
1598
1599 macio = &macio_chips[0];
1600 if (macio->type != macio_keylargo && macio->type != macio_pangea &&
1601 macio->type != macio_intrepid)
1602 return -ENODEV;
1603
1604 /* The device-tree contains that in the hwclock node */
1605 if (macio->type == macio_intrepid) {
1606 UN_OUT(UNI_N_CLOCK_SPREADING, 0);
1607 mdelay(40);
1608 }
1609
1610 /* We power off the wireless slot in case it was not done
1611 * by the driver. We don't power it on automatically however
1612 */
1613 if (macio->flags & MACIO_FLAG_AIRPORT_ON)
1614 core99_airport_enable(macio->of_node, 0, 0);
1615
1616 /* We power off the FW cable. Should be done by the driver... */
1617 if (macio->flags & MACIO_FLAG_FW_SUPPORTED) {
1618 core99_firewire_enable(NULL, 0, 0);
1619 core99_firewire_cable_power(NULL, 0, 0);
1620 }
1621
1622 /* We make sure int. modem is off (in case driver lost it) */
1623 if (macio->type == macio_keylargo)
1624 core99_modem_enable(macio->of_node, 0, 0);
1625 else
1626 pangea_modem_enable(macio->of_node, 0, 0);
1627
1628 /* We make sure the sound is off as well */
1629 core99_sound_chip_enable(macio->of_node, 0, 0);
1630
1631 /*
1632 * Save various bits of KeyLargo
1633 */
1634
1635 /* Save the state of the various GPIOs */
1636 save_gpio_levels[0] = MACIO_IN32(KEYLARGO_GPIO_LEVELS0);
1637 save_gpio_levels[1] = MACIO_IN32(KEYLARGO_GPIO_LEVELS1);
1638 for (i=0; i<KEYLARGO_GPIO_EXTINT_CNT; i++)
1639 save_gpio_extint[i] = MACIO_IN8(KEYLARGO_GPIO_EXTINT_0+i);
1640 for (i=0; i<KEYLARGO_GPIO_CNT; i++)
1641 save_gpio_normal[i] = MACIO_IN8(KEYLARGO_GPIO_0+i);
1642
1643 /* Save the FCRs */
1644 if (macio->type == macio_keylargo)
1645 save_mbcr = MACIO_IN32(KEYLARGO_MBCR);
1646 save_fcr[0] = MACIO_IN32(KEYLARGO_FCR0);
1647 save_fcr[1] = MACIO_IN32(KEYLARGO_FCR1);
1648 save_fcr[2] = MACIO_IN32(KEYLARGO_FCR2);
1649 save_fcr[3] = MACIO_IN32(KEYLARGO_FCR3);
1650 save_fcr[4] = MACIO_IN32(KEYLARGO_FCR4);
1651 if (macio->type == macio_pangea || macio->type == macio_intrepid)
1652 save_fcr[5] = MACIO_IN32(KEYLARGO_FCR5);
1653
1654 /* Save state & config of DBDMA channels */
1655 dbdma_save(macio, save_dbdma);
1656
1657 /*
1658 * Turn off as much as we can
1659 */
1660 if (macio->type == macio_pangea)
1661 pangea_shutdown(macio, 1);
1662 else if (macio->type == macio_intrepid)
1663 intrepid_shutdown(macio, 1);
1664 else if (macio->type == macio_keylargo)
1665 keylargo_shutdown(macio, 1);
1666
1667 /*
1668 * Put the host bridge to sleep
1669 */
1670
1671 save_unin_clock_ctl = UN_IN(UNI_N_CLOCK_CNTL);
1672 /* Note: do not switch GMAC off, driver does it when necessary, WOL must keep it
1673 * enabled !
1674 */
1675 UN_OUT(UNI_N_CLOCK_CNTL, save_unin_clock_ctl &
1676 ~(/*UNI_N_CLOCK_CNTL_GMAC|*/UNI_N_CLOCK_CNTL_FW/*|UNI_N_CLOCK_CNTL_PCI*/));
1677 udelay(100);
1678 UN_OUT(UNI_N_HWINIT_STATE, UNI_N_HWINIT_STATE_SLEEPING);
1679 UN_OUT(UNI_N_POWER_MGT, UNI_N_POWER_MGT_SLEEP);
1680 mdelay(10);
1681
1682 /*
1683 * FIXME: A bit of black magic with OpenPIC (don't ask me why)
1684 */
1685 if (pmac_mb.model_id == PMAC_TYPE_SAWTOOTH) {
1686 MACIO_BIS(0x506e0, 0x00400000);
1687 MACIO_BIS(0x506e0, 0x80000000);
1688 }
1689 return 0;
1690}
1691
1692static int __pmac
1693core99_wake_up(void)
1694{
1695 struct macio_chip* macio;
1696 int i;
1697
1698 macio = &macio_chips[0];
1699 if (macio->type != macio_keylargo && macio->type != macio_pangea &&
1700 macio->type != macio_intrepid)
1701 return -ENODEV;
1702
1703 /*
1704 * Wakeup the host bridge
1705 */
1706 UN_OUT(UNI_N_POWER_MGT, UNI_N_POWER_MGT_NORMAL);
1707 udelay(10);
1708 UN_OUT(UNI_N_HWINIT_STATE, UNI_N_HWINIT_STATE_RUNNING);
1709 udelay(10);
1710
1711 /*
1712 * Restore KeyLargo
1713 */
1714
1715 if (macio->type == macio_keylargo) {
1716 MACIO_OUT32(KEYLARGO_MBCR, save_mbcr);
1717 (void)MACIO_IN32(KEYLARGO_MBCR); udelay(10);
1718 }
1719 MACIO_OUT32(KEYLARGO_FCR0, save_fcr[0]);
1720 (void)MACIO_IN32(KEYLARGO_FCR0); udelay(10);
1721 MACIO_OUT32(KEYLARGO_FCR1, save_fcr[1]);
1722 (void)MACIO_IN32(KEYLARGO_FCR1); udelay(10);
1723 MACIO_OUT32(KEYLARGO_FCR2, save_fcr[2]);
1724 (void)MACIO_IN32(KEYLARGO_FCR2); udelay(10);
1725 MACIO_OUT32(KEYLARGO_FCR3, save_fcr[3]);
1726 (void)MACIO_IN32(KEYLARGO_FCR3); udelay(10);
1727 MACIO_OUT32(KEYLARGO_FCR4, save_fcr[4]);
1728 (void)MACIO_IN32(KEYLARGO_FCR4); udelay(10);
1729 if (macio->type == macio_pangea || macio->type == macio_intrepid) {
1730 MACIO_OUT32(KEYLARGO_FCR5, save_fcr[5]);
1731 (void)MACIO_IN32(KEYLARGO_FCR5); udelay(10);
1732 }
1733
1734 dbdma_restore(macio, save_dbdma);
1735
1736 MACIO_OUT32(KEYLARGO_GPIO_LEVELS0, save_gpio_levels[0]);
1737 MACIO_OUT32(KEYLARGO_GPIO_LEVELS1, save_gpio_levels[1]);
1738 for (i=0; i<KEYLARGO_GPIO_EXTINT_CNT; i++)
1739 MACIO_OUT8(KEYLARGO_GPIO_EXTINT_0+i, save_gpio_extint[i]);
1740 for (i=0; i<KEYLARGO_GPIO_CNT; i++)
1741 MACIO_OUT8(KEYLARGO_GPIO_0+i, save_gpio_normal[i]);
1742
1743 /* FIXME more black magic with OpenPIC ... */
1744 if (pmac_mb.model_id == PMAC_TYPE_SAWTOOTH) {
1745 MACIO_BIC(0x506e0, 0x00400000);
1746 MACIO_BIC(0x506e0, 0x80000000);
1747 }
1748
1749 UN_OUT(UNI_N_CLOCK_CNTL, save_unin_clock_ctl);
1750 udelay(100);
1751
1752 /* Restore clock spreading */
1753 if (macio->type == macio_intrepid) {
1754 UN_OUT(UNI_N_CLOCK_SPREADING, 2);
1755 mdelay(40);
1756 }
1757
1758 return 0;
1759}
1760
1761static long __pmac
1762core99_sleep_state(struct device_node* node, long param, long value)
1763{
1764 /* Param == 1 means to enter the "fake sleep" mode that is
1765 * used for CPU speed switch
1766 */
1767 if (param == 1) {
1768 if (value == 1) {
1769 UN_OUT(UNI_N_HWINIT_STATE, UNI_N_HWINIT_STATE_SLEEPING);
1770 UN_OUT(UNI_N_POWER_MGT, UNI_N_POWER_MGT_IDLE2);
1771 } else {
1772 UN_OUT(UNI_N_POWER_MGT, UNI_N_POWER_MGT_NORMAL);
1773 udelay(10);
1774 UN_OUT(UNI_N_HWINIT_STATE, UNI_N_HWINIT_STATE_RUNNING);
1775 udelay(10);
1776 }
1777 return 0;
1778 }
1779 if ((pmac_mb.board_flags & PMAC_MB_CAN_SLEEP) == 0)
1780 return -EPERM;
1781
1782#ifdef CONFIG_CPU_FREQ_PMAC
1783 /* XXX should be elsewhere */
1784 if (machine_is_compatible("PowerBook6,5") ||
1785 machine_is_compatible("PowerBook6,4") ||
1786 machine_is_compatible("PowerBook5,5") ||
1787 machine_is_compatible("PowerBook5,4")) {
1788 struct device_node *volt_gpio_np;
1789 u32 *reg = NULL;
1790
1791 volt_gpio_np = of_find_node_by_name(NULL, "cpu-vcore-select");
1792 if (volt_gpio_np != NULL)
1793 reg = (u32 *)get_property(volt_gpio_np, "reg", NULL);
1794 if (reg != NULL) {
1795 /* Set the CPU voltage high if sleeping */
1796 if (value == 1) {
1797 pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL,
1798 *reg, 0x05);
1799 } else if (value == 0 && (mfspr(SPRN_HID1) & HID1_DFS)) {
1800 pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL,
1801 *reg, 0x04);
1802 }
1803 mdelay(2);
1804 }
1805 }
1806#endif /* CONFIG_CPU_FREQ_PMAC */
1807
1808 if (value == 1)
1809 return core99_sleep();
1810 else if (value == 0)
1811 return core99_wake_up();
1812 return 0;
1813}
1814
1815#endif /* CONFIG_POWER4 */
1816
1817static long __pmac
1818generic_dev_can_wake(struct device_node* node, long param, long value)
1819{
1820 /* Todo: eventually check we are really dealing with on-board
1821 * video device ...
1822 */
1823
1824 if (pmac_mb.board_flags & PMAC_MB_MAY_SLEEP)
1825 pmac_mb.board_flags |= PMAC_MB_CAN_SLEEP;
1826 return 0;
1827}
1828
1829static long __pmac
1830generic_get_mb_info(struct device_node* node, long param, long value)
1831{
1832 switch(param) {
1833 case PMAC_MB_INFO_MODEL:
1834 return pmac_mb.model_id;
1835 case PMAC_MB_INFO_FLAGS:
1836 return pmac_mb.board_flags;
1837 case PMAC_MB_INFO_NAME:
1838 /* hack hack hack... but should work */
1839 *((const char **)value) = pmac_mb.model_name;
1840 return 0;
1841 }
1842 return -EINVAL;
1843}
1844
1845
1846/*
1847 * Table definitions
1848 */
1849
1850/* Used on any machine
1851 */
1852static struct feature_table_entry any_features[] __pmacdata = {
1853 { PMAC_FTR_GET_MB_INFO, generic_get_mb_info },
1854 { PMAC_FTR_DEVICE_CAN_WAKE, generic_dev_can_wake },
1855 { 0, NULL }
1856};
1857
1858#ifndef CONFIG_POWER4
1859
1860/* OHare based motherboards. Currently, we only use these on the
1861 * 2400,3400 and 3500 series powerbooks. Some older desktops seem
1862 * to have issues with turning on/off those asic cells
1863 */
1864static struct feature_table_entry ohare_features[] __pmacdata = {
1865 { PMAC_FTR_SCC_ENABLE, ohare_htw_scc_enable },
1866 { PMAC_FTR_SWIM3_ENABLE, ohare_floppy_enable },
1867 { PMAC_FTR_MESH_ENABLE, ohare_mesh_enable },
1868 { PMAC_FTR_IDE_ENABLE, ohare_ide_enable},
1869 { PMAC_FTR_IDE_RESET, ohare_ide_reset},
1870 { PMAC_FTR_SLEEP_STATE, ohare_sleep_state },
1871 { 0, NULL }
1872};
1873
1874/* Heathrow desktop machines (Beige G3).
1875 * Separated as some features couldn't be properly tested
1876 * and the serial port control bits appear to confuse it.
1877 */
1878static struct feature_table_entry heathrow_desktop_features[] __pmacdata = {
1879 { PMAC_FTR_SWIM3_ENABLE, heathrow_floppy_enable },
1880 { PMAC_FTR_MESH_ENABLE, heathrow_mesh_enable },
1881 { PMAC_FTR_IDE_ENABLE, heathrow_ide_enable },
1882 { PMAC_FTR_IDE_RESET, heathrow_ide_reset },
1883 { PMAC_FTR_BMAC_ENABLE, heathrow_bmac_enable },
1884 { 0, NULL }
1885};
1886
1887/* Heathrow based laptop, that is the Wallstreet and mainstreet
1888 * powerbooks.
1889 */
1890static struct feature_table_entry heathrow_laptop_features[] __pmacdata = {
1891 { PMAC_FTR_SCC_ENABLE, ohare_htw_scc_enable },
1892 { PMAC_FTR_MODEM_ENABLE, heathrow_modem_enable },
1893 { PMAC_FTR_SWIM3_ENABLE, heathrow_floppy_enable },
1894 { PMAC_FTR_MESH_ENABLE, heathrow_mesh_enable },
1895 { PMAC_FTR_IDE_ENABLE, heathrow_ide_enable },
1896 { PMAC_FTR_IDE_RESET, heathrow_ide_reset },
1897 { PMAC_FTR_BMAC_ENABLE, heathrow_bmac_enable },
1898 { PMAC_FTR_SOUND_CHIP_ENABLE, heathrow_sound_enable },
1899 { PMAC_FTR_SLEEP_STATE, heathrow_sleep_state },
1900 { 0, NULL }
1901};
1902
1903/* Paddington based machines
1904 * The lombard (101) powerbook, first iMac models, B&W G3 and Yikes G4.
1905 */
1906static struct feature_table_entry paddington_features[] __pmacdata = {
1907 { PMAC_FTR_SCC_ENABLE, ohare_htw_scc_enable },
1908 { PMAC_FTR_MODEM_ENABLE, heathrow_modem_enable },
1909 { PMAC_FTR_SWIM3_ENABLE, heathrow_floppy_enable },
1910 { PMAC_FTR_MESH_ENABLE, heathrow_mesh_enable },
1911 { PMAC_FTR_IDE_ENABLE, heathrow_ide_enable },
1912 { PMAC_FTR_IDE_RESET, heathrow_ide_reset },
1913 { PMAC_FTR_BMAC_ENABLE, heathrow_bmac_enable },
1914 { PMAC_FTR_SOUND_CHIP_ENABLE, heathrow_sound_enable },
1915 { PMAC_FTR_SLEEP_STATE, heathrow_sleep_state },
1916 { 0, NULL }
1917};
1918
1919/* Core99 & MacRISC 2 machines (all machines released since the
1920 * iBook (included), that is all AGP machines, except pangea
1921 * chipset. The pangea chipset is the "combo" UniNorth/KeyLargo
1922 * used on iBook2 & iMac "flow power".
1923 */
1924static struct feature_table_entry core99_features[] __pmacdata = {
1925 { PMAC_FTR_SCC_ENABLE, core99_scc_enable },
1926 { PMAC_FTR_MODEM_ENABLE, core99_modem_enable },
1927 { PMAC_FTR_IDE_ENABLE, core99_ide_enable },
1928 { PMAC_FTR_IDE_RESET, core99_ide_reset },
1929 { PMAC_FTR_GMAC_ENABLE, core99_gmac_enable },
1930 { PMAC_FTR_GMAC_PHY_RESET, core99_gmac_phy_reset },
1931 { PMAC_FTR_SOUND_CHIP_ENABLE, core99_sound_chip_enable },
1932 { PMAC_FTR_AIRPORT_ENABLE, core99_airport_enable },
1933 { PMAC_FTR_USB_ENABLE, core99_usb_enable },
1934 { PMAC_FTR_1394_ENABLE, core99_firewire_enable },
1935 { PMAC_FTR_1394_CABLE_POWER, core99_firewire_cable_power },
1936 { PMAC_FTR_SLEEP_STATE, core99_sleep_state },
1937#ifdef CONFIG_SMP
1938 { PMAC_FTR_RESET_CPU, core99_reset_cpu },
1939#endif /* CONFIG_SMP */
1940 { PMAC_FTR_READ_GPIO, core99_read_gpio },
1941 { PMAC_FTR_WRITE_GPIO, core99_write_gpio },
1942 { 0, NULL }
1943};
1944
1945/* RackMac
1946 */
1947static struct feature_table_entry rackmac_features[] __pmacdata = {
1948 { PMAC_FTR_SCC_ENABLE, core99_scc_enable },
1949 { PMAC_FTR_IDE_ENABLE, core99_ide_enable },
1950 { PMAC_FTR_IDE_RESET, core99_ide_reset },
1951 { PMAC_FTR_GMAC_ENABLE, core99_gmac_enable },
1952 { PMAC_FTR_GMAC_PHY_RESET, core99_gmac_phy_reset },
1953 { PMAC_FTR_USB_ENABLE, core99_usb_enable },
1954 { PMAC_FTR_1394_ENABLE, core99_firewire_enable },
1955 { PMAC_FTR_1394_CABLE_POWER, core99_firewire_cable_power },
1956 { PMAC_FTR_SLEEP_STATE, core99_sleep_state },
1957#ifdef CONFIG_SMP
1958 { PMAC_FTR_RESET_CPU, core99_reset_cpu },
1959#endif /* CONFIG_SMP */
1960 { PMAC_FTR_READ_GPIO, core99_read_gpio },
1961 { PMAC_FTR_WRITE_GPIO, core99_write_gpio },
1962 { 0, NULL }
1963};
1964
1965/* Pangea features
1966 */
1967static struct feature_table_entry pangea_features[] __pmacdata = {
1968 { PMAC_FTR_SCC_ENABLE, core99_scc_enable },
1969 { PMAC_FTR_MODEM_ENABLE, pangea_modem_enable },
1970 { PMAC_FTR_IDE_ENABLE, core99_ide_enable },
1971 { PMAC_FTR_IDE_RESET, core99_ide_reset },
1972 { PMAC_FTR_GMAC_ENABLE, core99_gmac_enable },
1973 { PMAC_FTR_GMAC_PHY_RESET, core99_gmac_phy_reset },
1974 { PMAC_FTR_SOUND_CHIP_ENABLE, core99_sound_chip_enable },
1975 { PMAC_FTR_AIRPORT_ENABLE, core99_airport_enable },
1976 { PMAC_FTR_USB_ENABLE, core99_usb_enable },
1977 { PMAC_FTR_1394_ENABLE, core99_firewire_enable },
1978 { PMAC_FTR_1394_CABLE_POWER, core99_firewire_cable_power },
1979 { PMAC_FTR_SLEEP_STATE, core99_sleep_state },
1980 { PMAC_FTR_READ_GPIO, core99_read_gpio },
1981 { PMAC_FTR_WRITE_GPIO, core99_write_gpio },
1982 { 0, NULL }
1983};
1984
1985/* Intrepid features
1986 */
1987static struct feature_table_entry intrepid_features[] __pmacdata = {
1988 { PMAC_FTR_SCC_ENABLE, core99_scc_enable },
1989 { PMAC_FTR_MODEM_ENABLE, pangea_modem_enable },
1990 { PMAC_FTR_IDE_ENABLE, core99_ide_enable },
1991 { PMAC_FTR_IDE_RESET, core99_ide_reset },
1992 { PMAC_FTR_GMAC_ENABLE, core99_gmac_enable },
1993 { PMAC_FTR_GMAC_PHY_RESET, core99_gmac_phy_reset },
1994 { PMAC_FTR_SOUND_CHIP_ENABLE, core99_sound_chip_enable },
1995 { PMAC_FTR_AIRPORT_ENABLE, core99_airport_enable },
1996 { PMAC_FTR_USB_ENABLE, core99_usb_enable },
1997 { PMAC_FTR_1394_ENABLE, core99_firewire_enable },
1998 { PMAC_FTR_1394_CABLE_POWER, core99_firewire_cable_power },
1999 { PMAC_FTR_SLEEP_STATE, core99_sleep_state },
2000 { PMAC_FTR_READ_GPIO, core99_read_gpio },
2001 { PMAC_FTR_WRITE_GPIO, core99_write_gpio },
2002 { PMAC_FTR_AACK_DELAY_ENABLE, intrepid_aack_delay_enable },
2003 { 0, NULL }
2004};
2005
2006#else /* CONFIG_POWER4 */
2007
2008/* G5 features
2009 */
2010static struct feature_table_entry g5_features[] __pmacdata = {
2011 { PMAC_FTR_GMAC_ENABLE, g5_gmac_enable },
2012 { PMAC_FTR_1394_ENABLE, g5_fw_enable },
2013 { PMAC_FTR_ENABLE_MPIC, g5_mpic_enable },
2014#ifdef CONFIG_SMP
2015 { PMAC_FTR_RESET_CPU, g5_reset_cpu },
2016#endif /* CONFIG_SMP */
2017 { PMAC_FTR_READ_GPIO, core99_read_gpio },
2018 { PMAC_FTR_WRITE_GPIO, core99_write_gpio },
2019 { 0, NULL }
2020};
2021
2022#endif /* CONFIG_POWER4 */
2023
2024static struct pmac_mb_def pmac_mb_defs[] __pmacdata = {
2025#ifndef CONFIG_POWER4
2026 /*
2027 * Desktops
2028 */
2029
2030 { "AAPL,8500", "PowerMac 8500/8600",
2031 PMAC_TYPE_PSURGE, NULL,
2032 0
2033 },
2034 { "AAPL,9500", "PowerMac 9500/9600",
2035 PMAC_TYPE_PSURGE, NULL,
2036 0
2037 },
2038 { "AAPL,7200", "PowerMac 7200",
2039 PMAC_TYPE_PSURGE, NULL,
2040 0
2041 },
2042 { "AAPL,7300", "PowerMac 7200/7300",
2043 PMAC_TYPE_PSURGE, NULL,
2044 0
2045 },
2046 { "AAPL,7500", "PowerMac 7500",
2047 PMAC_TYPE_PSURGE, NULL,
2048 0
2049 },
2050 { "AAPL,ShinerESB", "Apple Network Server",
2051 PMAC_TYPE_ANS, NULL,
2052 0
2053 },
2054 { "AAPL,e407", "Alchemy",
2055 PMAC_TYPE_ALCHEMY, NULL,
2056 0
2057 },
2058 { "AAPL,e411", "Gazelle",
2059 PMAC_TYPE_GAZELLE, NULL,
2060 0
2061 },
2062 { "AAPL,Gossamer", "PowerMac G3 (Gossamer)",
2063 PMAC_TYPE_GOSSAMER, heathrow_desktop_features,
2064 0
2065 },
2066 { "AAPL,PowerMac G3", "PowerMac G3 (Silk)",
2067 PMAC_TYPE_SILK, heathrow_desktop_features,
2068 0
2069 },
2070 { "PowerMac1,1", "Blue&White G3",
2071 PMAC_TYPE_YOSEMITE, paddington_features,
2072 0
2073 },
2074 { "PowerMac1,2", "PowerMac G4 PCI Graphics",
2075 PMAC_TYPE_YIKES, paddington_features,
2076 0
2077 },
2078 { "PowerMac2,1", "iMac FireWire",
2079 PMAC_TYPE_FW_IMAC, core99_features,
2080 PMAC_MB_MAY_SLEEP | PMAC_MB_OLD_CORE99
2081 },
2082 { "PowerMac2,2", "iMac FireWire",
2083 PMAC_TYPE_FW_IMAC, core99_features,
2084 PMAC_MB_MAY_SLEEP | PMAC_MB_OLD_CORE99
2085 },
2086 { "PowerMac3,1", "PowerMac G4 AGP Graphics",
2087 PMAC_TYPE_SAWTOOTH, core99_features,
2088 PMAC_MB_OLD_CORE99
2089 },
2090 { "PowerMac3,2", "PowerMac G4 AGP Graphics",
2091 PMAC_TYPE_SAWTOOTH, core99_features,
2092 PMAC_MB_MAY_SLEEP | PMAC_MB_OLD_CORE99
2093 },
2094 { "PowerMac3,3", "PowerMac G4 AGP Graphics",
2095 PMAC_TYPE_SAWTOOTH, core99_features,
2096 PMAC_MB_MAY_SLEEP | PMAC_MB_OLD_CORE99
2097 },
2098 { "PowerMac3,4", "PowerMac G4 Silver",
2099 PMAC_TYPE_QUICKSILVER, core99_features,
2100 PMAC_MB_MAY_SLEEP
2101 },
2102 { "PowerMac3,5", "PowerMac G4 Silver",
2103 PMAC_TYPE_QUICKSILVER, core99_features,
2104 PMAC_MB_MAY_SLEEP
2105 },
2106 { "PowerMac3,6", "PowerMac G4 Windtunnel",
2107 PMAC_TYPE_WINDTUNNEL, core99_features,
2108 PMAC_MB_MAY_SLEEP,
2109 },
2110 { "PowerMac4,1", "iMac \"Flower Power\"",
2111 PMAC_TYPE_PANGEA_IMAC, pangea_features,
2112 PMAC_MB_MAY_SLEEP
2113 },
2114 { "PowerMac4,2", "Flat panel iMac",
2115 PMAC_TYPE_FLAT_PANEL_IMAC, pangea_features,
2116 PMAC_MB_CAN_SLEEP
2117 },
2118 { "PowerMac4,4", "eMac",
2119 PMAC_TYPE_EMAC, core99_features,
2120 PMAC_MB_MAY_SLEEP
2121 },
2122 { "PowerMac5,1", "PowerMac G4 Cube",
2123 PMAC_TYPE_CUBE, core99_features,
2124 PMAC_MB_MAY_SLEEP | PMAC_MB_OLD_CORE99
2125 },
2126 { "PowerMac6,1", "Flat panel iMac",
2127 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2128 PMAC_MB_MAY_SLEEP,
2129 },
2130 { "PowerMac6,3", "Flat panel iMac",
2131 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2132 PMAC_MB_MAY_SLEEP,
2133 },
2134 { "PowerMac6,4", "eMac",
2135 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2136 PMAC_MB_MAY_SLEEP,
2137 },
2138 { "PowerMac10,1", "Mac mini",
2139 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2140 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER,
2141 },
2142 { "iMac,1", "iMac (first generation)",
2143 PMAC_TYPE_ORIG_IMAC, paddington_features,
2144 0
2145 },
2146
2147 /*
2148 * Xserve's
2149 */
2150
2151 { "RackMac1,1", "XServe",
2152 PMAC_TYPE_RACKMAC, rackmac_features,
2153 0,
2154 },
2155 { "RackMac1,2", "XServe rev. 2",
2156 PMAC_TYPE_RACKMAC, rackmac_features,
2157 0,
2158 },
2159
2160 /*
2161 * Laptops
2162 */
2163
2164 { "AAPL,3400/2400", "PowerBook 3400",
2165 PMAC_TYPE_HOOPER, ohare_features,
2166 PMAC_MB_CAN_SLEEP | PMAC_MB_MOBILE
2167 },
2168 { "AAPL,3500", "PowerBook 3500",
2169 PMAC_TYPE_KANGA, ohare_features,
2170 PMAC_MB_CAN_SLEEP | PMAC_MB_MOBILE
2171 },
2172 { "AAPL,PowerBook1998", "PowerBook Wallstreet",
2173 PMAC_TYPE_WALLSTREET, heathrow_laptop_features,
2174 PMAC_MB_CAN_SLEEP | PMAC_MB_MOBILE
2175 },
2176 { "PowerBook1,1", "PowerBook 101 (Lombard)",
2177 PMAC_TYPE_101_PBOOK, paddington_features,
2178 PMAC_MB_MAY_SLEEP | PMAC_MB_MOBILE
2179 },
2180 { "PowerBook2,1", "iBook (first generation)",
2181 PMAC_TYPE_ORIG_IBOOK, core99_features,
2182 PMAC_MB_CAN_SLEEP | PMAC_MB_OLD_CORE99 | PMAC_MB_MOBILE
2183 },
2184 { "PowerBook2,2", "iBook FireWire",
2185 PMAC_TYPE_FW_IBOOK, core99_features,
2186 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER |
2187 PMAC_MB_OLD_CORE99 | PMAC_MB_MOBILE
2188 },
2189 { "PowerBook3,1", "PowerBook Pismo",
2190 PMAC_TYPE_PISMO, core99_features,
2191 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER |
2192 PMAC_MB_OLD_CORE99 | PMAC_MB_MOBILE
2193 },
2194 { "PowerBook3,2", "PowerBook Titanium",
2195 PMAC_TYPE_TITANIUM, core99_features,
2196 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE
2197 },
2198 { "PowerBook3,3", "PowerBook Titanium II",
2199 PMAC_TYPE_TITANIUM2, core99_features,
2200 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE
2201 },
2202 { "PowerBook3,4", "PowerBook Titanium III",
2203 PMAC_TYPE_TITANIUM3, core99_features,
2204 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE
2205 },
2206 { "PowerBook3,5", "PowerBook Titanium IV",
2207 PMAC_TYPE_TITANIUM4, core99_features,
2208 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE
2209 },
2210 { "PowerBook4,1", "iBook 2",
2211 PMAC_TYPE_IBOOK2, pangea_features,
2212 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE
2213 },
2214 { "PowerBook4,2", "iBook 2",
2215 PMAC_TYPE_IBOOK2, pangea_features,
2216 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE
2217 },
2218 { "PowerBook4,3", "iBook 2 rev. 2",
2219 PMAC_TYPE_IBOOK2, pangea_features,
2220 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE
2221 },
2222 { "PowerBook5,1", "PowerBook G4 17\"",
2223 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2224 PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
2225 },
2226 { "PowerBook5,2", "PowerBook G4 15\"",
2227 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2228 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
2229 },
2230 { "PowerBook5,3", "PowerBook G4 17\"",
2231 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2232 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
2233 },
2234 { "PowerBook5,4", "PowerBook G4 15\"",
2235 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2236 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
2237 },
2238 { "PowerBook5,5", "PowerBook G4 17\"",
2239 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2240 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
2241 },
2242 { "PowerBook5,6", "PowerBook G4 15\"",
2243 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2244 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
2245 },
2246 { "PowerBook5,7", "PowerBook G4 17\"",
2247 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2248 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
2249 },
2250 { "PowerBook6,1", "PowerBook G4 12\"",
2251 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2252 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
2253 },
2254 { "PowerBook6,2", "PowerBook G4",
2255 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2256 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
2257 },
2258 { "PowerBook6,3", "iBook G4",
2259 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2260 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
2261 },
2262 { "PowerBook6,4", "PowerBook G4 12\"",
2263 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2264 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
2265 },
2266 { "PowerBook6,5", "iBook G4",
2267 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2268 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
2269 },
2270 { "PowerBook6,8", "PowerBook G4 12\"",
2271 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2272 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
2273 },
2274#else /* CONFIG_POWER4 */
2275 { "PowerMac7,2", "PowerMac G5",
2276 PMAC_TYPE_POWERMAC_G5, g5_features,
2277 0,
2278 },
2279#endif /* CONFIG_POWER4 */
2280};
2281
2282/*
2283 * The toplevel feature_call callback
2284 */
2285long __pmac
2286pmac_do_feature_call(unsigned int selector, ...)
2287{
2288 struct device_node* node;
2289 long param, value;
2290 int i;
2291 feature_call func = NULL;
2292 va_list args;
2293
2294 if (pmac_mb.features)
2295 for (i=0; pmac_mb.features[i].function; i++)
2296 if (pmac_mb.features[i].selector == selector) {
2297 func = pmac_mb.features[i].function;
2298 break;
2299 }
2300 if (!func)
2301 for (i=0; any_features[i].function; i++)
2302 if (any_features[i].selector == selector) {
2303 func = any_features[i].function;
2304 break;
2305 }
2306 if (!func)
2307 return -ENODEV;
2308
2309 va_start(args, selector);
2310 node = (struct device_node*)va_arg(args, void*);
2311 param = va_arg(args, long);
2312 value = va_arg(args, long);
2313 va_end(args);
2314
2315 return func(node, param, value);
2316}
2317
2318static int __init
2319probe_motherboard(void)
2320{
2321 int i;
2322 struct macio_chip* macio = &macio_chips[0];
2323 const char* model = NULL;
2324 struct device_node *dt;
2325
2326 /* Lookup known motherboard type in device-tree. First try an
2327 * exact match on the "model" property, then try a "compatible"
2328 * match is none is found.
2329 */
2330 dt = find_devices("device-tree");
2331 if (dt != NULL)
2332 model = (const char *) get_property(dt, "model", NULL);
2333 for(i=0; model && i<(sizeof(pmac_mb_defs)/sizeof(struct pmac_mb_def)); i++) {
2334 if (strcmp(model, pmac_mb_defs[i].model_string) == 0) {
2335 pmac_mb = pmac_mb_defs[i];
2336 goto found;
2337 }
2338 }
2339 for(i=0; i<(sizeof(pmac_mb_defs)/sizeof(struct pmac_mb_def)); i++) {
2340 if (machine_is_compatible(pmac_mb_defs[i].model_string)) {
2341 pmac_mb = pmac_mb_defs[i];
2342 goto found;
2343 }
2344 }
2345
2346 /* Fallback to selection depending on mac-io chip type */
2347 switch(macio->type) {
2348#ifndef CONFIG_POWER4
2349 case macio_grand_central:
2350 pmac_mb.model_id = PMAC_TYPE_PSURGE;
2351 pmac_mb.model_name = "Unknown PowerSurge";
2352 break;
2353 case macio_ohare:
2354 pmac_mb.model_id = PMAC_TYPE_UNKNOWN_OHARE;
2355 pmac_mb.model_name = "Unknown OHare-based";
2356 break;
2357 case macio_heathrow:
2358 pmac_mb.model_id = PMAC_TYPE_UNKNOWN_HEATHROW;
2359 pmac_mb.model_name = "Unknown Heathrow-based";
2360 pmac_mb.features = heathrow_desktop_features;
2361 break;
2362 case macio_paddington:
2363 pmac_mb.model_id = PMAC_TYPE_UNKNOWN_PADDINGTON;
2364 pmac_mb.model_name = "Unknown Paddington-based";
2365 pmac_mb.features = paddington_features;
2366 break;
2367 case macio_keylargo:
2368 pmac_mb.model_id = PMAC_TYPE_UNKNOWN_CORE99;
2369 pmac_mb.model_name = "Unknown Keylargo-based";
2370 pmac_mb.features = core99_features;
2371 break;
2372 case macio_pangea:
2373 pmac_mb.model_id = PMAC_TYPE_UNKNOWN_PANGEA;
2374 pmac_mb.model_name = "Unknown Pangea-based";
2375 pmac_mb.features = pangea_features;
2376 break;
2377 case macio_intrepid:
2378 pmac_mb.model_id = PMAC_TYPE_UNKNOWN_INTREPID;
2379 pmac_mb.model_name = "Unknown Intrepid-based";
2380 pmac_mb.features = intrepid_features;
2381 break;
2382#else /* CONFIG_POWER4 */
2383 case macio_keylargo2:
2384 pmac_mb.model_id = PMAC_TYPE_UNKNOWN_K2;
2385 pmac_mb.model_name = "Unknown G5";
2386 pmac_mb.features = g5_features;
2387 break;
2388#endif /* CONFIG_POWER4 */
2389 default:
2390 return -ENODEV;
2391 }
2392found:
2393#ifndef CONFIG_POWER4
2394 /* Fixup Hooper vs. Comet */
2395 if (pmac_mb.model_id == PMAC_TYPE_HOOPER) {
2396 u32 __iomem * mach_id_ptr = ioremap(0xf3000034, 4);
2397 if (!mach_id_ptr)
2398 return -ENODEV;
2399 /* Here, I used to disable the media-bay on comet. It
2400 * appears this is wrong, the floppy connector is actually
2401 * a kind of media-bay and works with the current driver.
2402 */
2403 if (__raw_readl(mach_id_ptr) & 0x20000000UL)
2404 pmac_mb.model_id = PMAC_TYPE_COMET;
2405 iounmap(mach_id_ptr);
2406 }
2407#endif /* CONFIG_POWER4 */
2408
2409#ifdef CONFIG_6xx
2410 /* Set default value of powersave_nap on machines that support it.
2411 * It appears that uninorth rev 3 has a problem with it, we don't
2412 * enable it on those. In theory, the flush-on-lock property is
2413 * supposed to be set when not supported, but I'm not very confident
2414 * that all Apple OF revs did it properly, I do it the paranoid way.
2415 */
2416 while (uninorth_base && uninorth_rev > 3) {
2417 struct device_node* np = find_path_device("/cpus");
2418 if (!np || !np->child) {
2419 printk(KERN_WARNING "Can't find CPU(s) in device tree !\n");
2420 break;
2421 }
2422 np = np->child;
2423 /* Nap mode not supported on SMP */
2424 if (np->sibling)
2425 break;
2426 /* Nap mode not supported if flush-on-lock property is present */
2427 if (get_property(np, "flush-on-lock", NULL))
2428 break;
2429 powersave_nap = 1;
2430 printk(KERN_INFO "Processor NAP mode on idle enabled.\n");
2431 break;
2432 }
2433
2434 /* On CPUs that support it (750FX), lowspeed by default during
2435 * NAP mode
2436 */
2437 powersave_lowspeed = 1;
2438#endif /* CONFIG_6xx */
2439#ifdef CONFIG_POWER4
2440 powersave_nap = 1;
2441#endif
2442 /* Check for "mobile" machine */
2443 if (model && (strncmp(model, "PowerBook", 9) == 0
2444 || strncmp(model, "iBook", 5) == 0))
2445 pmac_mb.board_flags |= PMAC_MB_MOBILE;
2446
2447
2448 printk(KERN_INFO "PowerMac motherboard: %s\n", pmac_mb.model_name);
2449 return 0;
2450}
2451
2452/* Initialize the Core99 UniNorth host bridge and memory controller
2453 */
2454static void __init
2455probe_uninorth(void)
2456{
2457 unsigned long actrl;
2458
2459 /* Locate core99 Uni-N */
2460 uninorth_node = of_find_node_by_name(NULL, "uni-n");
2461 /* Locate G5 u3 */
2462 if (uninorth_node == NULL) {
2463 uninorth_node = of_find_node_by_name(NULL, "u3");
2464 uninorth_u3 = 1;
2465 }
2466 if (uninorth_node && uninorth_node->n_addrs > 0) {
2467 unsigned long address = uninorth_node->addrs[0].address;
2468 uninorth_base = ioremap(address, 0x40000);
2469 uninorth_rev = in_be32(UN_REG(UNI_N_VERSION));
2470 if (uninorth_u3)
2471 u3_ht = ioremap(address + U3_HT_CONFIG_BASE, 0x1000);
2472 } else
2473 uninorth_node = NULL;
2474
2475 if (!uninorth_node)
2476 return;
2477
2478 printk(KERN_INFO "Found %s memory controller & host bridge, revision: %d\n",
2479 uninorth_u3 ? "U3" : "UniNorth", uninorth_rev);
2480 printk(KERN_INFO "Mapped at 0x%08lx\n", (unsigned long)uninorth_base);
2481
2482 /* Set the arbitrer QAck delay according to what Apple does
2483 */
2484 if (uninorth_rev < 0x11) {
2485 actrl = UN_IN(UNI_N_ARB_CTRL) & ~UNI_N_ARB_CTRL_QACK_DELAY_MASK;
2486 actrl |= ((uninorth_rev < 3) ? UNI_N_ARB_CTRL_QACK_DELAY105 :
2487 UNI_N_ARB_CTRL_QACK_DELAY) << UNI_N_ARB_CTRL_QACK_DELAY_SHIFT;
2488 UN_OUT(UNI_N_ARB_CTRL, actrl);
2489 }
2490
2491 /* Some more magic as done by them in recent MacOS X on UniNorth
2492 * revs 1.5 to 2.O and Pangea. Seem to toggle the UniN Maxbus/PCI
2493 * memory timeout
2494 */
2495 if ((uninorth_rev >= 0x11 && uninorth_rev <= 0x24) || uninorth_rev == 0xc0)
2496 UN_OUT(0x2160, UN_IN(0x2160) & 0x00ffffff);
2497}
2498
2499static void __init
2500probe_one_macio(const char* name, const char* compat, int type)
2501{
2502 struct device_node* node;
2503 int i;
2504 volatile u32 __iomem * base;
2505 u32* revp;
2506
2507 node = find_devices(name);
2508 if (!node || !node->n_addrs)
2509 return;
2510 if (compat)
2511 do {
2512 if (device_is_compatible(node, compat))
2513 break;
2514 node = node->next;
2515 } while (node);
2516 if (!node)
2517 return;
2518 for(i=0; i<MAX_MACIO_CHIPS; i++) {
2519 if (!macio_chips[i].of_node)
2520 break;
2521 if (macio_chips[i].of_node == node)
2522 return;
2523 }
2524 if (i >= MAX_MACIO_CHIPS) {
2525 printk(KERN_ERR "pmac_feature: Please increase MAX_MACIO_CHIPS !\n");
2526 printk(KERN_ERR "pmac_feature: %s skipped\n", node->full_name);
2527 return;
2528 }
2529 base = ioremap(node->addrs[0].address, node->addrs[0].size);
2530 if (!base) {
2531 printk(KERN_ERR "pmac_feature: Can't map mac-io chip !\n");
2532 return;
2533 }
2534 if (type == macio_keylargo) {
2535 u32* did = (u32 *)get_property(node, "device-id", NULL);
2536 if (*did == 0x00000025)
2537 type = macio_pangea;
2538 if (*did == 0x0000003e)
2539 type = macio_intrepid;
2540 }
2541 macio_chips[i].of_node = node;
2542 macio_chips[i].type = type;
2543 macio_chips[i].base = base;
2544 macio_chips[i].flags = MACIO_FLAG_SCCB_ON | MACIO_FLAG_SCCB_ON;
2545 macio_chips[i].name = macio_names[type];
2546 revp = (u32 *)get_property(node, "revision-id", NULL);
2547 if (revp)
2548 macio_chips[i].rev = *revp;
2549 printk(KERN_INFO "Found a %s mac-io controller, rev: %d, mapped at 0x%p\n",
2550 macio_names[type], macio_chips[i].rev, macio_chips[i].base);
2551}
2552
2553static int __init
2554probe_macios(void)
2555{
2556 /* Warning, ordering is important */
2557 probe_one_macio("gc", NULL, macio_grand_central);
2558 probe_one_macio("ohare", NULL, macio_ohare);
2559 probe_one_macio("pci106b,7", NULL, macio_ohareII);
2560 probe_one_macio("mac-io", "keylargo", macio_keylargo);
2561 probe_one_macio("mac-io", "paddington", macio_paddington);
2562 probe_one_macio("mac-io", "gatwick", macio_gatwick);
2563 probe_one_macio("mac-io", "heathrow", macio_heathrow);
2564 probe_one_macio("mac-io", "K2-Keylargo", macio_keylargo2);
2565
2566 /* Make sure the "main" macio chip appear first */
2567 if (macio_chips[0].type == macio_gatwick
2568 && macio_chips[1].type == macio_heathrow) {
2569 struct macio_chip temp = macio_chips[0];
2570 macio_chips[0] = macio_chips[1];
2571 macio_chips[1] = temp;
2572 }
2573 if (macio_chips[0].type == macio_ohareII
2574 && macio_chips[1].type == macio_ohare) {
2575 struct macio_chip temp = macio_chips[0];
2576 macio_chips[0] = macio_chips[1];
2577 macio_chips[1] = temp;
2578 }
2579 macio_chips[0].lbus.index = 0;
2580 macio_chips[1].lbus.index = 1;
2581
2582 return (macio_chips[0].of_node == NULL) ? -ENODEV : 0;
2583}
2584
2585static void __init
2586initial_serial_shutdown(struct device_node* np)
2587{
2588 int len;
2589 struct slot_names_prop {
2590 int count;
2591 char name[1];
2592 } *slots;
2593 char *conn;
2594 int port_type = PMAC_SCC_ASYNC;
2595 int modem = 0;
2596
2597 slots = (struct slot_names_prop *)get_property(np, "slot-names", &len);
2598 conn = get_property(np, "AAPL,connector", &len);
2599 if (conn && (strcmp(conn, "infrared") == 0))
2600 port_type = PMAC_SCC_IRDA;
2601 else if (device_is_compatible(np, "cobalt"))
2602 modem = 1;
2603 else if (slots && slots->count > 0) {
2604 if (strcmp(slots->name, "IrDA") == 0)
2605 port_type = PMAC_SCC_IRDA;
2606 else if (strcmp(slots->name, "Modem") == 0)
2607 modem = 1;
2608 }
2609 if (modem)
2610 pmac_call_feature(PMAC_FTR_MODEM_ENABLE, np, 0, 0);
2611 pmac_call_feature(PMAC_FTR_SCC_ENABLE, np, port_type, 0);
2612}
2613
2614static void __init
2615set_initial_features(void)
2616{
2617 struct device_node* np;
2618
2619 /* That hack appears to be necessary for some StarMax motherboards
2620 * but I'm not too sure it was audited for side-effects on other
2621 * ohare based machines...
2622 * Since I still have difficulties figuring the right way to
2623 * differenciate them all and since that hack was there for a long
2624 * time, I'll keep it around
2625 */
2626 if (macio_chips[0].type == macio_ohare && !find_devices("via-pmu")) {
2627 struct macio_chip* macio = &macio_chips[0];
2628 MACIO_OUT32(OHARE_FCR, STARMAX_FEATURES);
2629 } else if (macio_chips[0].type == macio_ohare) {
2630 struct macio_chip* macio = &macio_chips[0];
2631 MACIO_BIS(OHARE_FCR, OH_IOBUS_ENABLE);
2632 } else if (macio_chips[1].type == macio_ohare) {
2633 struct macio_chip* macio = &macio_chips[1];
2634 MACIO_BIS(OHARE_FCR, OH_IOBUS_ENABLE);
2635 }
2636
2637#ifdef CONFIG_POWER4
2638 if (macio_chips[0].type == macio_keylargo2) {
2639#ifndef CONFIG_SMP
2640 /* On SMP machines running UP, we have the second CPU eating
2641 * bus cycles. We need to take it off the bus. This is done
2642 * from pmac_smp for SMP kernels running on one CPU
2643 */
2644 np = of_find_node_by_type(NULL, "cpu");
2645 if (np != NULL)
2646 np = of_find_node_by_type(np, "cpu");
2647 if (np != NULL) {
2648 g5_phy_disable_cpu1();
2649 of_node_put(np);
2650 }
2651#endif /* CONFIG_SMP */
2652 /* Enable GMAC for now for PCI probing. It will be disabled
2653 * later on after PCI probe
2654 */
2655 np = of_find_node_by_name(NULL, "ethernet");
2656 while(np) {
2657 if (device_is_compatible(np, "K2-GMAC"))
2658 g5_gmac_enable(np, 0, 1);
2659 np = of_find_node_by_name(np, "ethernet");
2660 }
2661
2662 /* Enable FW before PCI probe. Will be disabled later on
2663 * Note: We should have a batter way to check that we are
2664 * dealing with uninorth internal cell and not a PCI cell
2665 * on the external PCI. The code below works though.
2666 */
2667 np = of_find_node_by_name(NULL, "firewire");
2668 while(np) {
2669 if (device_is_compatible(np, "pci106b,5811")) {
2670 macio_chips[0].flags |= MACIO_FLAG_FW_SUPPORTED;
2671 g5_fw_enable(np, 0, 1);
2672 }
2673 np = of_find_node_by_name(np, "firewire");
2674 }
2675 }
2676#else /* CONFIG_POWER4 */
2677
2678 if (macio_chips[0].type == macio_keylargo ||
2679 macio_chips[0].type == macio_pangea ||
2680 macio_chips[0].type == macio_intrepid) {
2681 /* Enable GMAC for now for PCI probing. It will be disabled
2682 * later on after PCI probe
2683 */
2684 np = of_find_node_by_name(NULL, "ethernet");
2685 while(np) {
2686 if (np->parent
2687 && device_is_compatible(np->parent, "uni-north")
2688 && device_is_compatible(np, "gmac"))
2689 core99_gmac_enable(np, 0, 1);
2690 np = of_find_node_by_name(np, "ethernet");
2691 }
2692
2693 /* Enable FW before PCI probe. Will be disabled later on
2694 * Note: We should have a batter way to check that we are
2695 * dealing with uninorth internal cell and not a PCI cell
2696 * on the external PCI. The code below works though.
2697 */
2698 np = of_find_node_by_name(NULL, "firewire");
2699 while(np) {
2700 if (np->parent
2701 && device_is_compatible(np->parent, "uni-north")
2702 && (device_is_compatible(np, "pci106b,18") ||
2703 device_is_compatible(np, "pci106b,30") ||
2704 device_is_compatible(np, "pci11c1,5811"))) {
2705 macio_chips[0].flags |= MACIO_FLAG_FW_SUPPORTED;
2706 core99_firewire_enable(np, 0, 1);
2707 }
2708 np = of_find_node_by_name(np, "firewire");
2709 }
2710
2711 /* Enable ATA-100 before PCI probe. */
2712 np = of_find_node_by_name(NULL, "ata-6");
2713 while(np) {
2714 if (np->parent
2715 && device_is_compatible(np->parent, "uni-north")
2716 && device_is_compatible(np, "kauai-ata")) {
2717 core99_ata100_enable(np, 1);
2718 }
2719 np = of_find_node_by_name(np, "ata-6");
2720 }
2721
2722 /* Switch airport off */
2723 np = find_devices("radio");
2724 while(np) {
2725 if (np && np->parent == macio_chips[0].of_node) {
2726 macio_chips[0].flags |= MACIO_FLAG_AIRPORT_ON;
2727 core99_airport_enable(np, 0, 0);
2728 }
2729 np = np->next;
2730 }
2731 }
2732
2733 /* On all machines that support sound PM, switch sound off */
2734 if (macio_chips[0].of_node)
2735 pmac_do_feature_call(PMAC_FTR_SOUND_CHIP_ENABLE,
2736 macio_chips[0].of_node, 0, 0);
2737
2738 /* While on some desktop G3s, we turn it back on */
2739 if (macio_chips[0].of_node && macio_chips[0].type == macio_heathrow
2740 && (pmac_mb.model_id == PMAC_TYPE_GOSSAMER ||
2741 pmac_mb.model_id == PMAC_TYPE_SILK)) {
2742 struct macio_chip* macio = &macio_chips[0];
2743 MACIO_BIS(HEATHROW_FCR, HRW_SOUND_CLK_ENABLE);
2744 MACIO_BIC(HEATHROW_FCR, HRW_SOUND_POWER_N);
2745 }
2746
2747 /* Hack for bumping clock speed on the new PowerBooks and the
2748 * iBook G4. This implements the "platform-do-clockspreading" OF
2749 * property. For safety, we also check the product ID in the
2750 * device-tree to make reasonably sure we won't set wrong values
2751 * in the clock chip.
2752 *
2753 * Of course, ultimately, we have to implement a real parser for
2754 * the platform-do-* stuff...
2755 */
2756 while (machine_is_compatible("PowerBook5,2") ||
2757 machine_is_compatible("PowerBook5,3") ||
2758 machine_is_compatible("PowerBook6,2") ||
2759 machine_is_compatible("PowerBook6,3")) {
2760 struct device_node *ui2c = of_find_node_by_type(NULL, "i2c");
2761 struct device_node *dt = of_find_node_by_name(NULL, "device-tree");
2762 u8 buffer[9];
2763 u32 *productID;
2764 int i, rc, changed = 0;
2765
2766 if (dt == NULL)
2767 break;
2768 productID = (u32 *)get_property(dt, "pid#", NULL);
2769 if (productID == NULL)
2770 break;
2771 while(ui2c) {
2772 struct device_node *p = of_get_parent(ui2c);
2773 if (p && !strcmp(p->name, "uni-n"))
2774 break;
2775 ui2c = of_find_node_by_type(ui2c, "i2c");
2776 }
2777 if (ui2c == NULL)
2778 break;
2779 DBG("Trying to bump clock speed for PID: %08x...\n", *productID);
2780 rc = pmac_low_i2c_open(ui2c, 1);
2781 if (rc != 0)
2782 break;
2783 pmac_low_i2c_setmode(ui2c, pmac_low_i2c_mode_combined);
2784 rc = pmac_low_i2c_xfer(ui2c, 0xd2 | pmac_low_i2c_read, 0x80, buffer, 9);
2785 DBG("read result: %d,", rc);
2786 if (rc != 0) {
2787 pmac_low_i2c_close(ui2c);
2788 break;
2789 }
2790 for (i=0; i<9; i++)
2791 DBG(" %02x", buffer[i]);
2792 DBG("\n");
2793
2794 switch(*productID) {
2795 case 0x1182: /* AlBook 12" rev 2 */
2796 case 0x1183: /* iBook G4 12" */
2797 buffer[0] = (buffer[0] & 0x8f) | 0x70;
2798 buffer[2] = (buffer[2] & 0x7f) | 0x00;
2799 buffer[5] = (buffer[5] & 0x80) | 0x31;
2800 buffer[6] = (buffer[6] & 0x40) | 0xb0;
2801 buffer[7] = (buffer[7] & 0x00) | 0xc0;
2802 buffer[8] = (buffer[8] & 0x00) | 0x30;
2803 changed = 1;
2804 break;
2805 case 0x3142: /* AlBook 15" (ATI M10) */
2806 case 0x3143: /* AlBook 17" (ATI M10) */
2807 buffer[0] = (buffer[0] & 0xaf) | 0x50;
2808 buffer[2] = (buffer[2] & 0x7f) | 0x00;
2809 buffer[5] = (buffer[5] & 0x80) | 0x31;
2810 buffer[6] = (buffer[6] & 0x40) | 0xb0;
2811 buffer[7] = (buffer[7] & 0x00) | 0xd0;
2812 buffer[8] = (buffer[8] & 0x00) | 0x30;
2813 changed = 1;
2814 break;
2815 default:
2816 DBG("i2c-hwclock: Machine model not handled\n");
2817 break;
2818 }
2819 if (!changed) {
2820 pmac_low_i2c_close(ui2c);
2821 break;
2822 }
2823 pmac_low_i2c_setmode(ui2c, pmac_low_i2c_mode_stdsub);
2824 rc = pmac_low_i2c_xfer(ui2c, 0xd2 | pmac_low_i2c_write, 0x80, buffer, 9);
2825 DBG("write result: %d,", rc);
2826 pmac_low_i2c_setmode(ui2c, pmac_low_i2c_mode_combined);
2827 rc = pmac_low_i2c_xfer(ui2c, 0xd2 | pmac_low_i2c_read, 0x80, buffer, 9);
2828 DBG("read result: %d,", rc);
2829 if (rc != 0) {
2830 pmac_low_i2c_close(ui2c);
2831 break;
2832 }
2833 for (i=0; i<9; i++)
2834 DBG(" %02x", buffer[i]);
2835 pmac_low_i2c_close(ui2c);
2836 break;
2837 }
2838
2839#endif /* CONFIG_POWER4 */
2840
2841 /* On all machines, switch modem & serial ports off */
2842 np = find_devices("ch-a");
2843 while(np) {
2844 initial_serial_shutdown(np);
2845 np = np->next;
2846 }
2847 np = find_devices("ch-b");
2848 while(np) {
2849 initial_serial_shutdown(np);
2850 np = np->next;
2851 }
2852}
2853
2854void __init
2855pmac_feature_init(void)
2856{
2857 /* Detect the UniNorth memory controller */
2858 probe_uninorth();
2859
2860 /* Probe mac-io controllers */
2861 if (probe_macios()) {
2862 printk(KERN_WARNING "No mac-io chip found\n");
2863 return;
2864 }
2865
2866 /* Setup low-level i2c stuffs */
2867 pmac_init_low_i2c();
2868
2869 /* Probe machine type */
2870 if (probe_motherboard())
2871 printk(KERN_WARNING "Unknown PowerMac !\n");
2872
2873 /* Set some initial features (turn off some chips that will
2874 * be later turned on)
2875 */
2876 set_initial_features();
2877}
2878
2879int __init
2880pmac_feature_late_init(void)
2881{
2882 struct device_node* np;
2883
2884 /* Request some resources late */
2885 if (uninorth_node)
2886 request_OF_resource(uninorth_node, 0, NULL);
2887 np = find_devices("hammerhead");
2888 if (np)
2889 request_OF_resource(np, 0, NULL);
2890 np = find_devices("interrupt-controller");
2891 if (np)
2892 request_OF_resource(np, 0, NULL);
2893 return 0;
2894}
2895
2896device_initcall(pmac_feature_late_init);
2897
2898#ifdef CONFIG_POWER4
2899
2900static void dump_HT_speeds(char *name, u32 cfg, u32 frq)
2901{
2902 int freqs[16] = { 200,300,400,500,600,800,1000,0,0,0,0,0,0,0,0,0 };
2903 int bits[8] = { 8,16,0,32,2,4,0,0 };
2904 int freq = (frq >> 8) & 0xf;
2905
2906 if (freqs[freq] == 0)
2907 printk("%s: Unknown HT link frequency %x\n", name, freq);
2908 else
2909 printk("%s: %d MHz on main link, (%d in / %d out) bits width\n",
2910 name, freqs[freq],
2911 bits[(cfg >> 28) & 0x7], bits[(cfg >> 24) & 0x7]);
2912}
2913
2914void __init pmac_check_ht_link(void)
2915{
2916 u32 ufreq, freq, ucfg, cfg;
2917 struct device_node *pcix_node;
2918 u8 px_bus, px_devfn;
2919 struct pci_controller *px_hose;
2920
2921 (void)in_be32(u3_ht + U3_HT_LINK_COMMAND);
2922 ucfg = cfg = in_be32(u3_ht + U3_HT_LINK_CONFIG);
2923 ufreq = freq = in_be32(u3_ht + U3_HT_LINK_FREQ);
2924 dump_HT_speeds("U3 HyperTransport", cfg, freq);
2925
2926 pcix_node = of_find_compatible_node(NULL, "pci", "pci-x");
2927 if (pcix_node == NULL) {
2928 printk("No PCI-X bridge found\n");
2929 return;
2930 }
2931 if (pci_device_from_OF_node(pcix_node, &px_bus, &px_devfn) != 0) {
2932 printk("PCI-X bridge found but not matched to pci\n");
2933 return;
2934 }
2935 px_hose = pci_find_hose_for_OF_device(pcix_node);
2936 if (px_hose == NULL) {
2937 printk("PCI-X bridge found but not matched to host\n");
2938 return;
2939 }
2940 early_read_config_dword(px_hose, px_bus, px_devfn, 0xc4, &cfg);
2941 early_read_config_dword(px_hose, px_bus, px_devfn, 0xcc, &freq);
2942 dump_HT_speeds("PCI-X HT Uplink", cfg, freq);
2943 early_read_config_dword(px_hose, px_bus, px_devfn, 0xc8, &cfg);
2944 early_read_config_dword(px_hose, px_bus, px_devfn, 0xd0, &freq);
2945 dump_HT_speeds("PCI-X HT Downlink", cfg, freq);
2946}
2947
2948#endif /* CONFIG_POWER4 */
2949
2950/*
2951 * Early video resume hook
2952 */
2953
2954static void (*pmac_early_vresume_proc)(void *data) __pmacdata;
2955static void *pmac_early_vresume_data __pmacdata;
2956
2957void pmac_set_early_video_resume(void (*proc)(void *data), void *data)
2958{
2959 if (_machine != _MACH_Pmac)
2960 return;
2961 preempt_disable();
2962 pmac_early_vresume_proc = proc;
2963 pmac_early_vresume_data = data;
2964 preempt_enable();
2965}
2966EXPORT_SYMBOL(pmac_set_early_video_resume);
2967
2968void __pmac pmac_call_early_video_resume(void)
2969{
2970 if (pmac_early_vresume_proc)
2971 pmac_early_vresume_proc(pmac_early_vresume_data);
2972}
diff --git a/arch/ppc/platforms/pmac_low_i2c.c b/arch/ppc/platforms/pmac_low_i2c.c
new file mode 100644
index 000000000000..d07579f2b8b9
--- /dev/null
+++ b/arch/ppc/platforms/pmac_low_i2c.c
@@ -0,0 +1,513 @@
1/*
2 * arch/ppc/platforms/pmac_low_i2c.c
3 *
4 * Copyright (C) 2003 Ben. Herrenschmidt (benh@kernel.crashing.org)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 *
11 * This file contains some low-level i2c access routines that
12 * need to be used by various bits of the PowerMac platform code
13 * at times where the real asynchronous & interrupt driven driver
14 * cannot be used. The API borrows some semantics from the darwin
15 * driver in order to ease the implementation of the platform
16 * properties parser
17 */
18
19#include <linux/config.h>
20#include <linux/types.h>
21#include <linux/delay.h>
22#include <linux/sched.h>
23#include <linux/init.h>
24#include <linux/module.h>
25#include <linux/adb.h>
26#include <linux/pmu.h>
27#include <asm/keylargo.h>
28#include <asm/uninorth.h>
29#include <asm/io.h>
30#include <asm/prom.h>
31#include <asm/machdep.h>
32#include <asm/pmac_low_i2c.h>
33
34#define MAX_LOW_I2C_HOST 4
35
36#if 1
37#define DBG(x...) do {\
38 printk(KERN_DEBUG "KW:" x); \
39 } while(0)
40#else
41#define DBGG(x...)
42#endif
43
44struct low_i2c_host;
45
46typedef int (*low_i2c_func_t)(struct low_i2c_host *host, u8 addr, u8 sub, u8 *data, int len);
47
48struct low_i2c_host
49{
50 struct device_node *np; /* OF device node */
51 struct semaphore mutex; /* Access mutex for use by i2c-keywest */
52 low_i2c_func_t func; /* Access function */
53 int is_open : 1; /* Poor man's access control */
54 int mode; /* Current mode */
55 int channel; /* Current channel */
56 int num_channels; /* Number of channels */
57 unsigned long base; /* For keywest-i2c, base address */
58 int bsteps; /* And register stepping */
59 int speed; /* And speed */
60};
61
62static struct low_i2c_host low_i2c_hosts[MAX_LOW_I2C_HOST];
63
64/* No locking is necessary on allocation, we are running way before
65 * anything can race with us
66 */
67static struct low_i2c_host *find_low_i2c_host(struct device_node *np)
68{
69 int i;
70
71 for (i = 0; i < MAX_LOW_I2C_HOST; i++)
72 if (low_i2c_hosts[i].np == np)
73 return &low_i2c_hosts[i];
74 return NULL;
75}
76
77/*
78 *
79 * i2c-keywest implementation (UniNorth, U2, U3, Keylargo's)
80 *
81 */
82
83/*
84 * Keywest i2c definitions borrowed from drivers/i2c/i2c-keywest.h,
85 * should be moved somewhere in include/asm-ppc/
86 */
87/* Register indices */
88typedef enum {
89 reg_mode = 0,
90 reg_control,
91 reg_status,
92 reg_isr,
93 reg_ier,
94 reg_addr,
95 reg_subaddr,
96 reg_data
97} reg_t;
98
99
100/* Mode register */
101#define KW_I2C_MODE_100KHZ 0x00
102#define KW_I2C_MODE_50KHZ 0x01
103#define KW_I2C_MODE_25KHZ 0x02
104#define KW_I2C_MODE_DUMB 0x00
105#define KW_I2C_MODE_STANDARD 0x04
106#define KW_I2C_MODE_STANDARDSUB 0x08
107#define KW_I2C_MODE_COMBINED 0x0C
108#define KW_I2C_MODE_MODE_MASK 0x0C
109#define KW_I2C_MODE_CHAN_MASK 0xF0
110
111/* Control register */
112#define KW_I2C_CTL_AAK 0x01
113#define KW_I2C_CTL_XADDR 0x02
114#define KW_I2C_CTL_STOP 0x04
115#define KW_I2C_CTL_START 0x08
116
117/* Status register */
118#define KW_I2C_STAT_BUSY 0x01
119#define KW_I2C_STAT_LAST_AAK 0x02
120#define KW_I2C_STAT_LAST_RW 0x04
121#define KW_I2C_STAT_SDA 0x08
122#define KW_I2C_STAT_SCL 0x10
123
124/* IER & ISR registers */
125#define KW_I2C_IRQ_DATA 0x01
126#define KW_I2C_IRQ_ADDR 0x02
127#define KW_I2C_IRQ_STOP 0x04
128#define KW_I2C_IRQ_START 0x08
129#define KW_I2C_IRQ_MASK 0x0F
130
131/* State machine states */
132enum {
133 state_idle,
134 state_addr,
135 state_read,
136 state_write,
137 state_stop,
138 state_dead
139};
140
141#define WRONG_STATE(name) do {\
142 printk(KERN_DEBUG "KW: wrong state. Got %s, state: %s (isr: %02x)\n", \
143 name, __kw_state_names[state], isr); \
144 } while(0)
145
146static const char *__kw_state_names[] = {
147 "state_idle",
148 "state_addr",
149 "state_read",
150 "state_write",
151 "state_stop",
152 "state_dead"
153};
154
155static inline u8 __kw_read_reg(struct low_i2c_host *host, reg_t reg)
156{
157 return in_8(((volatile u8 *)host->base)
158 + (((unsigned)reg) << host->bsteps));
159}
160
161static inline void __kw_write_reg(struct low_i2c_host *host, reg_t reg, u8 val)
162{
163 out_8(((volatile u8 *)host->base)
164 + (((unsigned)reg) << host->bsteps), val);
165 (void)__kw_read_reg(host, reg_subaddr);
166}
167
168#define kw_write_reg(reg, val) __kw_write_reg(host, reg, val)
169#define kw_read_reg(reg) __kw_read_reg(host, reg)
170
171
172/* Don't schedule, the g5 fan controller is too
173 * timing sensitive
174 */
175static u8 kw_wait_interrupt(struct low_i2c_host* host)
176{
177 int i;
178 u8 isr;
179
180 for (i = 0; i < 200000; i++) {
181 isr = kw_read_reg(reg_isr) & KW_I2C_IRQ_MASK;
182 if (isr != 0)
183 return isr;
184 udelay(1);
185 }
186 return isr;
187}
188
189static int kw_handle_interrupt(struct low_i2c_host *host, int state, int rw, int *rc, u8 **data, int *len, u8 isr)
190{
191 u8 ack;
192
193 if (isr == 0) {
194 if (state != state_stop) {
195 DBG("KW: Timeout !\n");
196 *rc = -EIO;
197 goto stop;
198 }
199 if (state == state_stop) {
200 ack = kw_read_reg(reg_status);
201 if (!(ack & KW_I2C_STAT_BUSY)) {
202 state = state_idle;
203 kw_write_reg(reg_ier, 0x00);
204 }
205 }
206 return state;
207 }
208
209 if (isr & KW_I2C_IRQ_ADDR) {
210 ack = kw_read_reg(reg_status);
211 if (state != state_addr) {
212 kw_write_reg(reg_isr, KW_I2C_IRQ_ADDR);
213 WRONG_STATE("KW_I2C_IRQ_ADDR");
214 *rc = -EIO;
215 goto stop;
216 }
217 if ((ack & KW_I2C_STAT_LAST_AAK) == 0) {
218 *rc = -ENODEV;
219 DBG("KW: NAK on address\n");
220 return state_stop;
221 } else {
222 if (rw) {
223 state = state_read;
224 if (*len > 1)
225 kw_write_reg(reg_control, KW_I2C_CTL_AAK);
226 } else {
227 state = state_write;
228 kw_write_reg(reg_data, **data);
229 (*data)++; (*len)--;
230 }
231 }
232 kw_write_reg(reg_isr, KW_I2C_IRQ_ADDR);
233 }
234
235 if (isr & KW_I2C_IRQ_DATA) {
236 if (state == state_read) {
237 **data = kw_read_reg(reg_data);
238 (*data)++; (*len)--;
239 kw_write_reg(reg_isr, KW_I2C_IRQ_DATA);
240 if ((*len) == 0)
241 state = state_stop;
242 else if ((*len) == 1)
243 kw_write_reg(reg_control, 0);
244 } else if (state == state_write) {
245 ack = kw_read_reg(reg_status);
246 if ((ack & KW_I2C_STAT_LAST_AAK) == 0) {
247 DBG("KW: nack on data write\n");
248 *rc = -EIO;
249 goto stop;
250 } else if (*len) {
251 kw_write_reg(reg_data, **data);
252 (*data)++; (*len)--;
253 } else {
254 kw_write_reg(reg_control, KW_I2C_CTL_STOP);
255 state = state_stop;
256 *rc = 0;
257 }
258 kw_write_reg(reg_isr, KW_I2C_IRQ_DATA);
259 } else {
260 kw_write_reg(reg_isr, KW_I2C_IRQ_DATA);
261 WRONG_STATE("KW_I2C_IRQ_DATA");
262 if (state != state_stop) {
263 *rc = -EIO;
264 goto stop;
265 }
266 }
267 }
268
269 if (isr & KW_I2C_IRQ_STOP) {
270 kw_write_reg(reg_isr, KW_I2C_IRQ_STOP);
271 if (state != state_stop) {
272 WRONG_STATE("KW_I2C_IRQ_STOP");
273 *rc = -EIO;
274 }
275 return state_idle;
276 }
277
278 if (isr & KW_I2C_IRQ_START)
279 kw_write_reg(reg_isr, KW_I2C_IRQ_START);
280
281 return state;
282
283 stop:
284 kw_write_reg(reg_control, KW_I2C_CTL_STOP);
285 return state_stop;
286}
287
288static int keywest_low_i2c_func(struct low_i2c_host *host, u8 addr, u8 subaddr, u8 *data, int len)
289{
290 u8 mode_reg = host->speed;
291 int state = state_addr;
292 int rc = 0;
293
294 /* Setup mode & subaddress if any */
295 switch(host->mode) {
296 case pmac_low_i2c_mode_dumb:
297 printk(KERN_ERR "low_i2c: Dumb mode not supported !\n");
298 return -EINVAL;
299 case pmac_low_i2c_mode_std:
300 mode_reg |= KW_I2C_MODE_STANDARD;
301 break;
302 case pmac_low_i2c_mode_stdsub:
303 mode_reg |= KW_I2C_MODE_STANDARDSUB;
304 kw_write_reg(reg_subaddr, subaddr);
305 break;
306 case pmac_low_i2c_mode_combined:
307 mode_reg |= KW_I2C_MODE_COMBINED;
308 kw_write_reg(reg_subaddr, subaddr);
309 break;
310 }
311
312 /* Setup channel & clear pending irqs */
313 kw_write_reg(reg_isr, kw_read_reg(reg_isr));
314 kw_write_reg(reg_mode, mode_reg | (host->channel << 4));
315 kw_write_reg(reg_status, 0);
316
317 /* Set up address and r/w bit */
318 kw_write_reg(reg_addr, addr);
319
320 /* Start sending address & disable interrupt*/
321 kw_write_reg(reg_ier, 0 /*KW_I2C_IRQ_MASK*/);
322 kw_write_reg(reg_control, KW_I2C_CTL_XADDR);
323
324 /* State machine, to turn into an interrupt handler */
325 while(state != state_idle) {
326 u8 isr = kw_wait_interrupt(host);
327 state = kw_handle_interrupt(host, state, addr & 1, &rc, &data, &len, isr);
328 }
329
330 return rc;
331}
332
333static void keywest_low_i2c_add(struct device_node *np)
334{
335 struct low_i2c_host *host = find_low_i2c_host(NULL);
336 unsigned long *psteps, *prate, steps, aoffset = 0;
337 struct device_node *parent;
338
339 if (host == NULL) {
340 printk(KERN_ERR "low_i2c: Can't allocate host for %s\n",
341 np->full_name);
342 return;
343 }
344 memset(host, 0, sizeof(*host));
345
346 init_MUTEX(&host->mutex);
347 host->np = of_node_get(np);
348 psteps = (unsigned long *)get_property(np, "AAPL,address-step", NULL);
349 steps = psteps ? (*psteps) : 0x10;
350 for (host->bsteps = 0; (steps & 0x01) == 0; host->bsteps++)
351 steps >>= 1;
352 parent = of_get_parent(np);
353 host->num_channels = 1;
354 if (parent && parent->name[0] == 'u') {
355 host->num_channels = 2;
356 aoffset = 3;
357 }
358 /* Select interface rate */
359 host->speed = KW_I2C_MODE_100KHZ;
360 prate = (unsigned long *)get_property(np, "AAPL,i2c-rate", NULL);
361 if (prate) switch(*prate) {
362 case 100:
363 host->speed = KW_I2C_MODE_100KHZ;
364 break;
365 case 50:
366 host->speed = KW_I2C_MODE_50KHZ;
367 break;
368 case 25:
369 host->speed = KW_I2C_MODE_25KHZ;
370 break;
371 }
372 host->mode = pmac_low_i2c_mode_std;
373 host->base = (unsigned long)ioremap(np->addrs[0].address + aoffset,
374 np->addrs[0].size);
375 host->func = keywest_low_i2c_func;
376}
377
378/*
379 *
380 * PMU implementation
381 *
382 */
383
384
385#ifdef CONFIG_ADB_PMU
386
387static int pmu_low_i2c_func(struct low_i2c_host *host, u8 addr, u8 sub, u8 *data, int len)
388{
389 // TODO
390 return -ENODEV;
391}
392
393static void pmu_low_i2c_add(struct device_node *np)
394{
395 struct low_i2c_host *host = find_low_i2c_host(NULL);
396
397 if (host == NULL) {
398 printk(KERN_ERR "low_i2c: Can't allocate host for %s\n",
399 np->full_name);
400 return;
401 }
402 memset(host, 0, sizeof(*host));
403
404 init_MUTEX(&host->mutex);
405 host->np = of_node_get(np);
406 host->num_channels = 3;
407 host->mode = pmac_low_i2c_mode_std;
408 host->func = pmu_low_i2c_func;
409}
410
411#endif /* CONFIG_ADB_PMU */
412
413void __init pmac_init_low_i2c(void)
414{
415 struct device_node *np;
416
417 /* Probe keywest-i2c busses */
418 np = of_find_compatible_node(NULL, "i2c", "keywest-i2c");
419 while(np) {
420 keywest_low_i2c_add(np);
421 np = of_find_compatible_node(np, "i2c", "keywest-i2c");
422 }
423
424#ifdef CONFIG_ADB_PMU
425 /* Probe PMU busses */
426 np = of_find_node_by_name(NULL, "via-pmu");
427 if (np)
428 pmu_low_i2c_add(np);
429#endif /* CONFIG_ADB_PMU */
430
431 /* TODO: Add CUDA support as well */
432}
433
434int pmac_low_i2c_lock(struct device_node *np)
435{
436 struct low_i2c_host *host = find_low_i2c_host(np);
437
438 if (!host)
439 return -ENODEV;
440 down(&host->mutex);
441 return 0;
442}
443EXPORT_SYMBOL(pmac_low_i2c_lock);
444
445int pmac_low_i2c_unlock(struct device_node *np)
446{
447 struct low_i2c_host *host = find_low_i2c_host(np);
448
449 if (!host)
450 return -ENODEV;
451 up(&host->mutex);
452 return 0;
453}
454EXPORT_SYMBOL(pmac_low_i2c_unlock);
455
456
457int pmac_low_i2c_open(struct device_node *np, int channel)
458{
459 struct low_i2c_host *host = find_low_i2c_host(np);
460
461 if (!host)
462 return -ENODEV;
463
464 if (channel >= host->num_channels)
465 return -EINVAL;
466
467 down(&host->mutex);
468 host->is_open = 1;
469 host->channel = channel;
470
471 return 0;
472}
473EXPORT_SYMBOL(pmac_low_i2c_open);
474
475int pmac_low_i2c_close(struct device_node *np)
476{
477 struct low_i2c_host *host = find_low_i2c_host(np);
478
479 if (!host)
480 return -ENODEV;
481
482 host->is_open = 0;
483 up(&host->mutex);
484
485 return 0;
486}
487EXPORT_SYMBOL(pmac_low_i2c_close);
488
489int pmac_low_i2c_setmode(struct device_node *np, int mode)
490{
491 struct low_i2c_host *host = find_low_i2c_host(np);
492
493 if (!host)
494 return -ENODEV;
495 WARN_ON(!host->is_open);
496 host->mode = mode;
497
498 return 0;
499}
500EXPORT_SYMBOL(pmac_low_i2c_setmode);
501
502int pmac_low_i2c_xfer(struct device_node *np, u8 addrdir, u8 subaddr, u8 *data, int len)
503{
504 struct low_i2c_host *host = find_low_i2c_host(np);
505
506 if (!host)
507 return -ENODEV;
508 WARN_ON(!host->is_open);
509
510 return host->func(host, addrdir, subaddr, data, len);
511}
512EXPORT_SYMBOL(pmac_low_i2c_xfer);
513
diff --git a/arch/ppc/platforms/pmac_nvram.c b/arch/ppc/platforms/pmac_nvram.c
new file mode 100644
index 000000000000..c9de64205996
--- /dev/null
+++ b/arch/ppc/platforms/pmac_nvram.c
@@ -0,0 +1,584 @@
1/*
2 * arch/ppc/platforms/pmac_nvram.c
3 *
4 * Copyright (C) 2002 Benjamin Herrenschmidt (benh@kernel.crashing.org)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 *
11 * Todo: - add support for the OF persistent properties
12 */
13#include <linux/config.h>
14#include <linux/module.h>
15#include <linux/kernel.h>
16#include <linux/stddef.h>
17#include <linux/string.h>
18#include <linux/nvram.h>
19#include <linux/init.h>
20#include <linux/slab.h>
21#include <linux/delay.h>
22#include <linux/errno.h>
23#include <linux/adb.h>
24#include <linux/pmu.h>
25#include <linux/bootmem.h>
26#include <linux/completion.h>
27#include <linux/spinlock.h>
28#include <asm/sections.h>
29#include <asm/io.h>
30#include <asm/system.h>
31#include <asm/prom.h>
32#include <asm/machdep.h>
33#include <asm/nvram.h>
34
35#define DEBUG
36
37#ifdef DEBUG
38#define DBG(x...) printk(x)
39#else
40#define DBG(x...)
41#endif
42
43#define NVRAM_SIZE 0x2000 /* 8kB of non-volatile RAM */
44
45#define CORE99_SIGNATURE 0x5a
46#define CORE99_ADLER_START 0x14
47
48/* On Core99, nvram is either a sharp, a micron or an AMD flash */
49#define SM_FLASH_STATUS_DONE 0x80
50#define SM_FLASH_STATUS_ERR 0x38
51#define SM_FLASH_CMD_ERASE_CONFIRM 0xd0
52#define SM_FLASH_CMD_ERASE_SETUP 0x20
53#define SM_FLASH_CMD_RESET 0xff
54#define SM_FLASH_CMD_WRITE_SETUP 0x40
55#define SM_FLASH_CMD_CLEAR_STATUS 0x50
56#define SM_FLASH_CMD_READ_STATUS 0x70
57
58/* CHRP NVRAM header */
59struct chrp_header {
60 u8 signature;
61 u8 cksum;
62 u16 len;
63 char name[12];
64 u8 data[0];
65};
66
67struct core99_header {
68 struct chrp_header hdr;
69 u32 adler;
70 u32 generation;
71 u32 reserved[2];
72};
73
74/*
75 * Read and write the non-volatile RAM on PowerMacs and CHRP machines.
76 */
77static int nvram_naddrs;
78static volatile unsigned char *nvram_addr;
79static volatile unsigned char *nvram_data;
80static int nvram_mult, is_core_99;
81static int core99_bank = 0;
82static int nvram_partitions[3];
83static DEFINE_SPINLOCK(nv_lock);
84
85extern int pmac_newworld;
86extern int system_running;
87
88static int (*core99_write_bank)(int bank, u8* datas);
89static int (*core99_erase_bank)(int bank);
90
91static char *nvram_image __pmacdata;
92
93
94static unsigned char __pmac core99_nvram_read_byte(int addr)
95{
96 if (nvram_image == NULL)
97 return 0xff;
98 return nvram_image[addr];
99}
100
101static void __pmac core99_nvram_write_byte(int addr, unsigned char val)
102{
103 if (nvram_image == NULL)
104 return;
105 nvram_image[addr] = val;
106}
107
108
109static unsigned char __openfirmware direct_nvram_read_byte(int addr)
110{
111 return in_8(&nvram_data[(addr & (NVRAM_SIZE - 1)) * nvram_mult]);
112}
113
114static void __openfirmware direct_nvram_write_byte(int addr, unsigned char val)
115{
116 out_8(&nvram_data[(addr & (NVRAM_SIZE - 1)) * nvram_mult], val);
117}
118
119
120static unsigned char __pmac indirect_nvram_read_byte(int addr)
121{
122 unsigned char val;
123 unsigned long flags;
124
125 spin_lock_irqsave(&nv_lock, flags);
126 out_8(nvram_addr, addr >> 5);
127 val = in_8(&nvram_data[(addr & 0x1f) << 4]);
128 spin_unlock_irqrestore(&nv_lock, flags);
129
130 return val;
131}
132
133static void __pmac indirect_nvram_write_byte(int addr, unsigned char val)
134{
135 unsigned long flags;
136
137 spin_lock_irqsave(&nv_lock, flags);
138 out_8(nvram_addr, addr >> 5);
139 out_8(&nvram_data[(addr & 0x1f) << 4], val);
140 spin_unlock_irqrestore(&nv_lock, flags);
141}
142
143
144#ifdef CONFIG_ADB_PMU
145
146static void __pmac pmu_nvram_complete(struct adb_request *req)
147{
148 if (req->arg)
149 complete((struct completion *)req->arg);
150}
151
152static unsigned char __pmac pmu_nvram_read_byte(int addr)
153{
154 struct adb_request req;
155 DECLARE_COMPLETION(req_complete);
156
157 req.arg = system_state == SYSTEM_RUNNING ? &req_complete : NULL;
158 if (pmu_request(&req, pmu_nvram_complete, 3, PMU_READ_NVRAM,
159 (addr >> 8) & 0xff, addr & 0xff))
160 return 0xff;
161 if (system_state == SYSTEM_RUNNING)
162 wait_for_completion(&req_complete);
163 while (!req.complete)
164 pmu_poll();
165 return req.reply[0];
166}
167
168static void __pmac pmu_nvram_write_byte(int addr, unsigned char val)
169{
170 struct adb_request req;
171 DECLARE_COMPLETION(req_complete);
172
173 req.arg = system_state == SYSTEM_RUNNING ? &req_complete : NULL;
174 if (pmu_request(&req, pmu_nvram_complete, 4, PMU_WRITE_NVRAM,
175 (addr >> 8) & 0xff, addr & 0xff, val))
176 return;
177 if (system_state == SYSTEM_RUNNING)
178 wait_for_completion(&req_complete);
179 while (!req.complete)
180 pmu_poll();
181}
182
183#endif /* CONFIG_ADB_PMU */
184
185
186static u8 __pmac chrp_checksum(struct chrp_header* hdr)
187{
188 u8 *ptr;
189 u16 sum = hdr->signature;
190 for (ptr = (u8 *)&hdr->len; ptr < hdr->data; ptr++)
191 sum += *ptr;
192 while (sum > 0xFF)
193 sum = (sum & 0xFF) + (sum>>8);
194 return sum;
195}
196
197static u32 __pmac core99_calc_adler(u8 *buffer)
198{
199 int cnt;
200 u32 low, high;
201
202 buffer += CORE99_ADLER_START;
203 low = 1;
204 high = 0;
205 for (cnt=0; cnt<(NVRAM_SIZE-CORE99_ADLER_START); cnt++) {
206 if ((cnt % 5000) == 0) {
207 high %= 65521UL;
208 high %= 65521UL;
209 }
210 low += buffer[cnt];
211 high += low;
212 }
213 low %= 65521UL;
214 high %= 65521UL;
215
216 return (high << 16) | low;
217}
218
219static u32 __pmac core99_check(u8* datas)
220{
221 struct core99_header* hdr99 = (struct core99_header*)datas;
222
223 if (hdr99->hdr.signature != CORE99_SIGNATURE) {
224 DBG("Invalid signature\n");
225 return 0;
226 }
227 if (hdr99->hdr.cksum != chrp_checksum(&hdr99->hdr)) {
228 DBG("Invalid checksum\n");
229 return 0;
230 }
231 if (hdr99->adler != core99_calc_adler(datas)) {
232 DBG("Invalid adler\n");
233 return 0;
234 }
235 return hdr99->generation;
236}
237
238static int __pmac sm_erase_bank(int bank)
239{
240 int stat, i;
241 unsigned long timeout;
242
243 u8* base = (u8 *)nvram_data + core99_bank*NVRAM_SIZE;
244
245 DBG("nvram: Sharp/Micron Erasing bank %d...\n", bank);
246
247 out_8(base, SM_FLASH_CMD_ERASE_SETUP);
248 out_8(base, SM_FLASH_CMD_ERASE_CONFIRM);
249 timeout = 0;
250 do {
251 if (++timeout > 1000000) {
252 printk(KERN_ERR "nvram: Sharp/Miron flash erase timeout !\n");
253 break;
254 }
255 out_8(base, SM_FLASH_CMD_READ_STATUS);
256 stat = in_8(base);
257 } while (!(stat & SM_FLASH_STATUS_DONE));
258
259 out_8(base, SM_FLASH_CMD_CLEAR_STATUS);
260 out_8(base, SM_FLASH_CMD_RESET);
261
262 for (i=0; i<NVRAM_SIZE; i++)
263 if (base[i] != 0xff) {
264 printk(KERN_ERR "nvram: Sharp/Micron flash erase failed !\n");
265 return -ENXIO;
266 }
267 return 0;
268}
269
270static int __pmac sm_write_bank(int bank, u8* datas)
271{
272 int i, stat = 0;
273 unsigned long timeout;
274
275 u8* base = (u8 *)nvram_data + core99_bank*NVRAM_SIZE;
276
277 DBG("nvram: Sharp/Micron Writing bank %d...\n", bank);
278
279 for (i=0; i<NVRAM_SIZE; i++) {
280 out_8(base+i, SM_FLASH_CMD_WRITE_SETUP);
281 udelay(1);
282 out_8(base+i, datas[i]);
283 timeout = 0;
284 do {
285 if (++timeout > 1000000) {
286 printk(KERN_ERR "nvram: Sharp/Micron flash write timeout !\n");
287 break;
288 }
289 out_8(base, SM_FLASH_CMD_READ_STATUS);
290 stat = in_8(base);
291 } while (!(stat & SM_FLASH_STATUS_DONE));
292 if (!(stat & SM_FLASH_STATUS_DONE))
293 break;
294 }
295 out_8(base, SM_FLASH_CMD_CLEAR_STATUS);
296 out_8(base, SM_FLASH_CMD_RESET);
297 for (i=0; i<NVRAM_SIZE; i++)
298 if (base[i] != datas[i]) {
299 printk(KERN_ERR "nvram: Sharp/Micron flash write failed !\n");
300 return -ENXIO;
301 }
302 return 0;
303}
304
305static int __pmac amd_erase_bank(int bank)
306{
307 int i, stat = 0;
308 unsigned long timeout;
309
310 u8* base = (u8 *)nvram_data + core99_bank*NVRAM_SIZE;
311
312 DBG("nvram: AMD Erasing bank %d...\n", bank);
313
314 /* Unlock 1 */
315 out_8(base+0x555, 0xaa);
316 udelay(1);
317 /* Unlock 2 */
318 out_8(base+0x2aa, 0x55);
319 udelay(1);
320
321 /* Sector-Erase */
322 out_8(base+0x555, 0x80);
323 udelay(1);
324 out_8(base+0x555, 0xaa);
325 udelay(1);
326 out_8(base+0x2aa, 0x55);
327 udelay(1);
328 out_8(base, 0x30);
329 udelay(1);
330
331 timeout = 0;
332 do {
333 if (++timeout > 1000000) {
334 printk(KERN_ERR "nvram: AMD flash erase timeout !\n");
335 break;
336 }
337 stat = in_8(base) ^ in_8(base);
338 } while (stat != 0);
339
340 /* Reset */
341 out_8(base, 0xf0);
342 udelay(1);
343
344 for (i=0; i<NVRAM_SIZE; i++)
345 if (base[i] != 0xff) {
346 printk(KERN_ERR "nvram: AMD flash erase failed !\n");
347 return -ENXIO;
348 }
349 return 0;
350}
351
352static int __pmac amd_write_bank(int bank, u8* datas)
353{
354 int i, stat = 0;
355 unsigned long timeout;
356
357 u8* base = (u8 *)nvram_data + core99_bank*NVRAM_SIZE;
358
359 DBG("nvram: AMD Writing bank %d...\n", bank);
360
361 for (i=0; i<NVRAM_SIZE; i++) {
362 /* Unlock 1 */
363 out_8(base+0x555, 0xaa);
364 udelay(1);
365 /* Unlock 2 */
366 out_8(base+0x2aa, 0x55);
367 udelay(1);
368
369 /* Write single word */
370 out_8(base+0x555, 0xa0);
371 udelay(1);
372 out_8(base+i, datas[i]);
373
374 timeout = 0;
375 do {
376 if (++timeout > 1000000) {
377 printk(KERN_ERR "nvram: AMD flash write timeout !\n");
378 break;
379 }
380 stat = in_8(base) ^ in_8(base);
381 } while (stat != 0);
382 if (stat != 0)
383 break;
384 }
385
386 /* Reset */
387 out_8(base, 0xf0);
388 udelay(1);
389
390 for (i=0; i<NVRAM_SIZE; i++)
391 if (base[i] != datas[i]) {
392 printk(KERN_ERR "nvram: AMD flash write failed !\n");
393 return -ENXIO;
394 }
395 return 0;
396}
397
398static void __init lookup_partitions(void)
399{
400 u8 buffer[17];
401 int i, offset;
402 struct chrp_header* hdr;
403
404 if (pmac_newworld) {
405 nvram_partitions[pmac_nvram_OF] = -1;
406 nvram_partitions[pmac_nvram_XPRAM] = -1;
407 nvram_partitions[pmac_nvram_NR] = -1;
408 hdr = (struct chrp_header *)buffer;
409
410 offset = 0;
411 buffer[16] = 0;
412 do {
413 for (i=0;i<16;i++)
414 buffer[i] = nvram_read_byte(offset+i);
415 if (!strcmp(hdr->name, "common"))
416 nvram_partitions[pmac_nvram_OF] = offset + 0x10;
417 if (!strcmp(hdr->name, "APL,MacOS75")) {
418 nvram_partitions[pmac_nvram_XPRAM] = offset + 0x10;
419 nvram_partitions[pmac_nvram_NR] = offset + 0x110;
420 }
421 offset += (hdr->len * 0x10);
422 } while(offset < NVRAM_SIZE);
423 } else {
424 nvram_partitions[pmac_nvram_OF] = 0x1800;
425 nvram_partitions[pmac_nvram_XPRAM] = 0x1300;
426 nvram_partitions[pmac_nvram_NR] = 0x1400;
427 }
428 DBG("nvram: OF partition at 0x%x\n", nvram_partitions[pmac_nvram_OF]);
429 DBG("nvram: XP partition at 0x%x\n", nvram_partitions[pmac_nvram_XPRAM]);
430 DBG("nvram: NR partition at 0x%x\n", nvram_partitions[pmac_nvram_NR]);
431}
432
433static void __pmac core99_nvram_sync(void)
434{
435 struct core99_header* hdr99;
436 unsigned long flags;
437
438 if (!is_core_99 || !nvram_data || !nvram_image)
439 return;
440
441 spin_lock_irqsave(&nv_lock, flags);
442 if (!memcmp(nvram_image, (u8*)nvram_data + core99_bank*NVRAM_SIZE,
443 NVRAM_SIZE))
444 goto bail;
445
446 DBG("Updating nvram...\n");
447
448 hdr99 = (struct core99_header*)nvram_image;
449 hdr99->generation++;
450 hdr99->hdr.signature = CORE99_SIGNATURE;
451 hdr99->hdr.cksum = chrp_checksum(&hdr99->hdr);
452 hdr99->adler = core99_calc_adler(nvram_image);
453 core99_bank = core99_bank ? 0 : 1;
454 if (core99_erase_bank)
455 if (core99_erase_bank(core99_bank)) {
456 printk("nvram: Error erasing bank %d\n", core99_bank);
457 goto bail;
458 }
459 if (core99_write_bank)
460 if (core99_write_bank(core99_bank, nvram_image))
461 printk("nvram: Error writing bank %d\n", core99_bank);
462 bail:
463 spin_unlock_irqrestore(&nv_lock, flags);
464
465#ifdef DEBUG
466 mdelay(2000);
467#endif
468}
469
470void __init pmac_nvram_init(void)
471{
472 struct device_node *dp;
473
474 nvram_naddrs = 0;
475
476 dp = find_devices("nvram");
477 if (dp == NULL) {
478 printk(KERN_ERR "Can't find NVRAM device\n");
479 return;
480 }
481 nvram_naddrs = dp->n_addrs;
482 is_core_99 = device_is_compatible(dp, "nvram,flash");
483 if (is_core_99) {
484 int i;
485 u32 gen_bank0, gen_bank1;
486
487 if (nvram_naddrs < 1) {
488 printk(KERN_ERR "nvram: no address\n");
489 return;
490 }
491 nvram_image = alloc_bootmem(NVRAM_SIZE);
492 if (nvram_image == NULL) {
493 printk(KERN_ERR "nvram: can't allocate ram image\n");
494 return;
495 }
496 nvram_data = ioremap(dp->addrs[0].address, NVRAM_SIZE*2);
497 nvram_naddrs = 1; /* Make sure we get the correct case */
498
499 DBG("nvram: Checking bank 0...\n");
500
501 gen_bank0 = core99_check((u8 *)nvram_data);
502 gen_bank1 = core99_check((u8 *)nvram_data + NVRAM_SIZE);
503 core99_bank = (gen_bank0 < gen_bank1) ? 1 : 0;
504
505 DBG("nvram: gen0=%d, gen1=%d\n", gen_bank0, gen_bank1);
506 DBG("nvram: Active bank is: %d\n", core99_bank);
507
508 for (i=0; i<NVRAM_SIZE; i++)
509 nvram_image[i] = nvram_data[i + core99_bank*NVRAM_SIZE];
510
511 ppc_md.nvram_read_val = core99_nvram_read_byte;
512 ppc_md.nvram_write_val = core99_nvram_write_byte;
513 ppc_md.nvram_sync = core99_nvram_sync;
514 /*
515 * Maybe we could be smarter here though making an exclusive list
516 * of known flash chips is a bit nasty as older OF didn't provide us
517 * with a useful "compatible" entry. A solution would be to really
518 * identify the chip using flash id commands and base ourselves on
519 * a list of known chips IDs
520 */
521 if (device_is_compatible(dp, "amd-0137")) {
522 core99_erase_bank = amd_erase_bank;
523 core99_write_bank = amd_write_bank;
524 } else {
525 core99_erase_bank = sm_erase_bank;
526 core99_write_bank = sm_write_bank;
527 }
528 } else if (_machine == _MACH_chrp && nvram_naddrs == 1) {
529 nvram_data = ioremap(dp->addrs[0].address + isa_mem_base,
530 dp->addrs[0].size);
531 nvram_mult = 1;
532 ppc_md.nvram_read_val = direct_nvram_read_byte;
533 ppc_md.nvram_write_val = direct_nvram_write_byte;
534 } else if (nvram_naddrs == 1) {
535 nvram_data = ioremap(dp->addrs[0].address, dp->addrs[0].size);
536 nvram_mult = (dp->addrs[0].size + NVRAM_SIZE - 1) / NVRAM_SIZE;
537 ppc_md.nvram_read_val = direct_nvram_read_byte;
538 ppc_md.nvram_write_val = direct_nvram_write_byte;
539 } else if (nvram_naddrs == 2) {
540 nvram_addr = ioremap(dp->addrs[0].address, dp->addrs[0].size);
541 nvram_data = ioremap(dp->addrs[1].address, dp->addrs[1].size);
542 ppc_md.nvram_read_val = indirect_nvram_read_byte;
543 ppc_md.nvram_write_val = indirect_nvram_write_byte;
544 } else if (nvram_naddrs == 0 && sys_ctrler == SYS_CTRLER_PMU) {
545#ifdef CONFIG_ADB_PMU
546 nvram_naddrs = -1;
547 ppc_md.nvram_read_val = pmu_nvram_read_byte;
548 ppc_md.nvram_write_val = pmu_nvram_write_byte;
549#endif /* CONFIG_ADB_PMU */
550 } else {
551 printk(KERN_ERR "Don't know how to access NVRAM with %d addresses\n",
552 nvram_naddrs);
553 }
554 lookup_partitions();
555}
556
557int __pmac pmac_get_partition(int partition)
558{
559 return nvram_partitions[partition];
560}
561
562u8 __pmac pmac_xpram_read(int xpaddr)
563{
564 int offset = nvram_partitions[pmac_nvram_XPRAM];
565
566 if (offset < 0)
567 return 0xff;
568
569 return ppc_md.nvram_read_val(xpaddr + offset);
570}
571
572void __pmac pmac_xpram_write(int xpaddr, u8 data)
573{
574 int offset = nvram_partitions[pmac_nvram_XPRAM];
575
576 if (offset < 0)
577 return;
578
579 ppc_md.nvram_write_val(xpaddr + offset, data);
580}
581
582EXPORT_SYMBOL(pmac_get_partition);
583EXPORT_SYMBOL(pmac_xpram_read);
584EXPORT_SYMBOL(pmac_xpram_write);
diff --git a/arch/ppc/platforms/pmac_pci.c b/arch/ppc/platforms/pmac_pci.c
new file mode 100644
index 000000000000..f6ff51924061
--- /dev/null
+++ b/arch/ppc/platforms/pmac_pci.c
@@ -0,0 +1,1125 @@
1/*
2 * Support for PCI bridges found on Power Macintoshes.
3 * At present the "bandit" and "chaos" bridges are supported.
4 * Fortunately you access configuration space in the same
5 * way with either bridge.
6 *
7 * Copyright (C) 1997 Paul Mackerras (paulus@cs.anu.edu.au)
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
13 */
14
15#include <linux/kernel.h>
16#include <linux/pci.h>
17#include <linux/delay.h>
18#include <linux/string.h>
19#include <linux/init.h>
20#include <linux/bootmem.h>
21
22#include <asm/sections.h>
23#include <asm/io.h>
24#include <asm/prom.h>
25#include <asm/pci-bridge.h>
26#include <asm/machdep.h>
27#include <asm/pmac_feature.h>
28
29#undef DEBUG
30
31#ifdef DEBUG
32#ifdef CONFIG_XMON
33extern void xmon_printf(const char *fmt, ...);
34#define DBG(x...) xmon_printf(x)
35#else
36#define DBG(x...) printk(x)
37#endif
38#else
39#define DBG(x...)
40#endif
41
42static int add_bridge(struct device_node *dev);
43extern void pmac_check_ht_link(void);
44
45/* XXX Could be per-controller, but I don't think we risk anything by
46 * assuming we won't have both UniNorth and Bandit */
47static int has_uninorth;
48#ifdef CONFIG_POWER4
49static struct pci_controller *u3_agp;
50#endif /* CONFIG_POWER4 */
51
52extern u8 pci_cache_line_size;
53extern int pcibios_assign_bus_offset;
54
55struct device_node *k2_skiplist[2];
56
57/*
58 * Magic constants for enabling cache coherency in the bandit/PSX bridge.
59 */
60#define BANDIT_DEVID_2 8
61#define BANDIT_REVID 3
62
63#define BANDIT_DEVNUM 11
64#define BANDIT_MAGIC 0x50
65#define BANDIT_COHERENT 0x40
66
67static int __init
68fixup_one_level_bus_range(struct device_node *node, int higher)
69{
70 for (; node != 0;node = node->sibling) {
71 int * bus_range;
72 unsigned int *class_code;
73 int len;
74
75 /* For PCI<->PCI bridges or CardBus bridges, we go down */
76 class_code = (unsigned int *) get_property(node, "class-code", NULL);
77 if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI &&
78 (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS))
79 continue;
80 bus_range = (int *) get_property(node, "bus-range", &len);
81 if (bus_range != NULL && len > 2 * sizeof(int)) {
82 if (bus_range[1] > higher)
83 higher = bus_range[1];
84 }
85 higher = fixup_one_level_bus_range(node->child, higher);
86 }
87 return higher;
88}
89
90/* This routine fixes the "bus-range" property of all bridges in the
91 * system since they tend to have their "last" member wrong on macs
92 *
93 * Note that the bus numbers manipulated here are OF bus numbers, they
94 * are not Linux bus numbers.
95 */
96static void __init
97fixup_bus_range(struct device_node *bridge)
98{
99 int * bus_range;
100 int len;
101
102 /* Lookup the "bus-range" property for the hose */
103 bus_range = (int *) get_property(bridge, "bus-range", &len);
104 if (bus_range == NULL || len < 2 * sizeof(int)) {
105 printk(KERN_WARNING "Can't get bus-range for %s\n",
106 bridge->full_name);
107 return;
108 }
109 bus_range[1] = fixup_one_level_bus_range(bridge->child, bus_range[1]);
110}
111
112/*
113 * Apple MacRISC (U3, UniNorth, Bandit, Chaos) PCI controllers.
114 *
115 * The "Bandit" version is present in all early PCI PowerMacs,
116 * and up to the first ones using Grackle. Some machines may
117 * have 2 bandit controllers (2 PCI busses).
118 *
119 * "Chaos" is used in some "Bandit"-type machines as a bridge
120 * for the separate display bus. It is accessed the same
121 * way as bandit, but cannot be probed for devices. It therefore
122 * has its own config access functions.
123 *
124 * The "UniNorth" version is present in all Core99 machines
125 * (iBook, G4, new IMacs, and all the recent Apple machines).
126 * It contains 3 controllers in one ASIC.
127 *
128 * The U3 is the bridge used on G5 machines. It contains an
129 * AGP bus which is dealt with the old UniNorth access routines
130 * and a HyperTransport bus which uses its own set of access
131 * functions.
132 */
133
134#define MACRISC_CFA0(devfn, off) \
135 ((1 << (unsigned long)PCI_SLOT(dev_fn)) \
136 | (((unsigned long)PCI_FUNC(dev_fn)) << 8) \
137 | (((unsigned long)(off)) & 0xFCUL))
138
139#define MACRISC_CFA1(bus, devfn, off) \
140 ((((unsigned long)(bus)) << 16) \
141 |(((unsigned long)(devfn)) << 8) \
142 |(((unsigned long)(off)) & 0xFCUL) \
143 |1UL)
144
145static void volatile __iomem * __pmac
146macrisc_cfg_access(struct pci_controller* hose, u8 bus, u8 dev_fn, u8 offset)
147{
148 unsigned int caddr;
149
150 if (bus == hose->first_busno) {
151 if (dev_fn < (11 << 3))
152 return NULL;
153 caddr = MACRISC_CFA0(dev_fn, offset);
154 } else
155 caddr = MACRISC_CFA1(bus, dev_fn, offset);
156
157 /* Uninorth will return garbage if we don't read back the value ! */
158 do {
159 out_le32(hose->cfg_addr, caddr);
160 } while (in_le32(hose->cfg_addr) != caddr);
161
162 offset &= has_uninorth ? 0x07 : 0x03;
163 return hose->cfg_data + offset;
164}
165
166static int __pmac
167macrisc_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
168 int len, u32 *val)
169{
170 struct pci_controller *hose = bus->sysdata;
171 void volatile __iomem *addr;
172
173 addr = macrisc_cfg_access(hose, bus->number, devfn, offset);
174 if (!addr)
175 return PCIBIOS_DEVICE_NOT_FOUND;
176 /*
177 * Note: the caller has already checked that offset is
178 * suitably aligned and that len is 1, 2 or 4.
179 */
180 switch (len) {
181 case 1:
182 *val = in_8(addr);
183 break;
184 case 2:
185 *val = in_le16(addr);
186 break;
187 default:
188 *val = in_le32(addr);
189 break;
190 }
191 return PCIBIOS_SUCCESSFUL;
192}
193
194static int __pmac
195macrisc_write_config(struct pci_bus *bus, unsigned int devfn, int offset,
196 int len, u32 val)
197{
198 struct pci_controller *hose = bus->sysdata;
199 void volatile __iomem *addr;
200
201 addr = macrisc_cfg_access(hose, bus->number, devfn, offset);
202 if (!addr)
203 return PCIBIOS_DEVICE_NOT_FOUND;
204 /*
205 * Note: the caller has already checked that offset is
206 * suitably aligned and that len is 1, 2 or 4.
207 */
208 switch (len) {
209 case 1:
210 out_8(addr, val);
211 (void) in_8(addr);
212 break;
213 case 2:
214 out_le16(addr, val);
215 (void) in_le16(addr);
216 break;
217 default:
218 out_le32(addr, val);
219 (void) in_le32(addr);
220 break;
221 }
222 return PCIBIOS_SUCCESSFUL;
223}
224
225static struct pci_ops macrisc_pci_ops =
226{
227 macrisc_read_config,
228 macrisc_write_config
229};
230
231/*
232 * Verifiy that a specific (bus, dev_fn) exists on chaos
233 */
234static int __pmac
235chaos_validate_dev(struct pci_bus *bus, int devfn, int offset)
236{
237 struct device_node *np;
238 u32 *vendor, *device;
239
240 np = pci_busdev_to_OF_node(bus, devfn);
241 if (np == NULL)
242 return PCIBIOS_DEVICE_NOT_FOUND;
243
244 vendor = (u32 *)get_property(np, "vendor-id", NULL);
245 device = (u32 *)get_property(np, "device-id", NULL);
246 if (vendor == NULL || device == NULL)
247 return PCIBIOS_DEVICE_NOT_FOUND;
248
249 if ((*vendor == 0x106b) && (*device == 3) && (offset >= 0x10)
250 && (offset != 0x14) && (offset != 0x18) && (offset <= 0x24))
251 return PCIBIOS_BAD_REGISTER_NUMBER;
252
253 return PCIBIOS_SUCCESSFUL;
254}
255
256static int __pmac
257chaos_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
258 int len, u32 *val)
259{
260 int result = chaos_validate_dev(bus, devfn, offset);
261 if (result == PCIBIOS_BAD_REGISTER_NUMBER)
262 *val = ~0U;
263 if (result != PCIBIOS_SUCCESSFUL)
264 return result;
265 return macrisc_read_config(bus, devfn, offset, len, val);
266}
267
268static int __pmac
269chaos_write_config(struct pci_bus *bus, unsigned int devfn, int offset,
270 int len, u32 val)
271{
272 int result = chaos_validate_dev(bus, devfn, offset);
273 if (result != PCIBIOS_SUCCESSFUL)
274 return result;
275 return macrisc_write_config(bus, devfn, offset, len, val);
276}
277
278static struct pci_ops chaos_pci_ops =
279{
280 chaos_read_config,
281 chaos_write_config
282};
283
284#ifdef CONFIG_POWER4
285
286/*
287 * These versions of U3 HyperTransport config space access ops do not
288 * implement self-view of the HT host yet
289 */
290
291#define U3_HT_CFA0(devfn, off) \
292 ((((unsigned long)devfn) << 8) | offset)
293#define U3_HT_CFA1(bus, devfn, off) \
294 (U3_HT_CFA0(devfn, off) \
295 + (((unsigned long)bus) << 16) \
296 + 0x01000000UL)
297
298static void volatile __iomem * __pmac
299u3_ht_cfg_access(struct pci_controller* hose, u8 bus, u8 devfn, u8 offset)
300{
301 if (bus == hose->first_busno) {
302 /* For now, we don't self probe U3 HT bridge */
303 if (PCI_FUNC(devfn) != 0 || PCI_SLOT(devfn) > 7 ||
304 PCI_SLOT(devfn) < 1)
305 return 0;
306 return hose->cfg_data + U3_HT_CFA0(devfn, offset);
307 } else
308 return hose->cfg_data + U3_HT_CFA1(bus, devfn, offset);
309}
310
311static int __pmac
312u3_ht_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
313 int len, u32 *val)
314{
315 struct pci_controller *hose = bus->sysdata;
316 void volatile __iomem *addr;
317 int i;
318
319 struct device_node *np = pci_busdev_to_OF_node(bus, devfn);
320 if (np == NULL)
321 return PCIBIOS_DEVICE_NOT_FOUND;
322
323 /*
324 * When a device in K2 is powered down, we die on config
325 * cycle accesses. Fix that here.
326 */
327 for (i=0; i<2; i++)
328 if (k2_skiplist[i] == np) {
329 switch (len) {
330 case 1:
331 *val = 0xff; break;
332 case 2:
333 *val = 0xffff; break;
334 default:
335 *val = 0xfffffffful; break;
336 }
337 return PCIBIOS_SUCCESSFUL;
338 }
339
340 addr = u3_ht_cfg_access(hose, bus->number, devfn, offset);
341 if (!addr)
342 return PCIBIOS_DEVICE_NOT_FOUND;
343 /*
344 * Note: the caller has already checked that offset is
345 * suitably aligned and that len is 1, 2 or 4.
346 */
347 switch (len) {
348 case 1:
349 *val = in_8(addr);
350 break;
351 case 2:
352 *val = in_le16(addr);
353 break;
354 default:
355 *val = in_le32(addr);
356 break;
357 }
358 return PCIBIOS_SUCCESSFUL;
359}
360
361static int __pmac
362u3_ht_write_config(struct pci_bus *bus, unsigned int devfn, int offset,
363 int len, u32 val)
364{
365 struct pci_controller *hose = bus->sysdata;
366 void volatile __iomem *addr;
367 int i;
368
369 struct device_node *np = pci_busdev_to_OF_node(bus, devfn);
370 if (np == NULL)
371 return PCIBIOS_DEVICE_NOT_FOUND;
372 /*
373 * When a device in K2 is powered down, we die on config
374 * cycle accesses. Fix that here.
375 */
376 for (i=0; i<2; i++)
377 if (k2_skiplist[i] == np)
378 return PCIBIOS_SUCCESSFUL;
379
380 addr = u3_ht_cfg_access(hose, bus->number, devfn, offset);
381 if (!addr)
382 return PCIBIOS_DEVICE_NOT_FOUND;
383 /*
384 * Note: the caller has already checked that offset is
385 * suitably aligned and that len is 1, 2 or 4.
386 */
387 switch (len) {
388 case 1:
389 out_8(addr, val);
390 (void) in_8(addr);
391 break;
392 case 2:
393 out_le16(addr, val);
394 (void) in_le16(addr);
395 break;
396 default:
397 out_le32(addr, val);
398 (void) in_le32(addr);
399 break;
400 }
401 return PCIBIOS_SUCCESSFUL;
402}
403
404static struct pci_ops u3_ht_pci_ops =
405{
406 u3_ht_read_config,
407 u3_ht_write_config
408};
409
410#endif /* CONFIG_POWER4 */
411
412/*
413 * For a bandit bridge, turn on cache coherency if necessary.
414 * N.B. we could clean this up using the hose ops directly.
415 */
416static void __init
417init_bandit(struct pci_controller *bp)
418{
419 unsigned int vendev, magic;
420 int rev;
421
422 /* read the word at offset 0 in config space for device 11 */
423 out_le32(bp->cfg_addr, (1UL << BANDIT_DEVNUM) + PCI_VENDOR_ID);
424 udelay(2);
425 vendev = in_le32(bp->cfg_data);
426 if (vendev == (PCI_DEVICE_ID_APPLE_BANDIT << 16) +
427 PCI_VENDOR_ID_APPLE) {
428 /* read the revision id */
429 out_le32(bp->cfg_addr,
430 (1UL << BANDIT_DEVNUM) + PCI_REVISION_ID);
431 udelay(2);
432 rev = in_8(bp->cfg_data);
433 if (rev != BANDIT_REVID)
434 printk(KERN_WARNING
435 "Unknown revision %d for bandit\n", rev);
436 } else if (vendev != (BANDIT_DEVID_2 << 16) + PCI_VENDOR_ID_APPLE) {
437 printk(KERN_WARNING "bandit isn't? (%x)\n", vendev);
438 return;
439 }
440
441 /* read the word at offset 0x50 */
442 out_le32(bp->cfg_addr, (1UL << BANDIT_DEVNUM) + BANDIT_MAGIC);
443 udelay(2);
444 magic = in_le32(bp->cfg_data);
445 if ((magic & BANDIT_COHERENT) != 0)
446 return;
447 magic |= BANDIT_COHERENT;
448 udelay(2);
449 out_le32(bp->cfg_data, magic);
450 printk(KERN_INFO "Cache coherency enabled for bandit/PSX\n");
451}
452
453
454/*
455 * Tweak the PCI-PCI bridge chip on the blue & white G3s.
456 */
457static void __init
458init_p2pbridge(void)
459{
460 struct device_node *p2pbridge;
461 struct pci_controller* hose;
462 u8 bus, devfn;
463 u16 val;
464
465 /* XXX it would be better here to identify the specific
466 PCI-PCI bridge chip we have. */
467 if ((p2pbridge = find_devices("pci-bridge")) == 0
468 || p2pbridge->parent == NULL
469 || strcmp(p2pbridge->parent->name, "pci") != 0)
470 return;
471 if (pci_device_from_OF_node(p2pbridge, &bus, &devfn) < 0) {
472 DBG("Can't find PCI infos for PCI<->PCI bridge\n");
473 return;
474 }
475 /* Warning: At this point, we have not yet renumbered all busses.
476 * So we must use OF walking to find out hose
477 */
478 hose = pci_find_hose_for_OF_device(p2pbridge);
479 if (!hose) {
480 DBG("Can't find hose for PCI<->PCI bridge\n");
481 return;
482 }
483 if (early_read_config_word(hose, bus, devfn,
484 PCI_BRIDGE_CONTROL, &val) < 0) {
485 printk(KERN_ERR "init_p2pbridge: couldn't read bridge control\n");
486 return;
487 }
488 val &= ~PCI_BRIDGE_CTL_MASTER_ABORT;
489 early_write_config_word(hose, bus, devfn, PCI_BRIDGE_CONTROL, val);
490}
491
492/*
493 * Some Apple desktop machines have a NEC PD720100A USB2 controller
494 * on the motherboard. Open Firmware, on these, will disable the
495 * EHCI part of it so it behaves like a pair of OHCI's. This fixup
496 * code re-enables it ;)
497 */
498static void __init
499fixup_nec_usb2(void)
500{
501 struct device_node *nec;
502
503 for (nec = NULL; (nec = of_find_node_by_name(nec, "usb")) != NULL;) {
504 struct pci_controller *hose;
505 u32 data, *prop;
506 u8 bus, devfn;
507
508 prop = (u32 *)get_property(nec, "vendor-id", NULL);
509 if (prop == NULL)
510 continue;
511 if (0x1033 != *prop)
512 continue;
513 prop = (u32 *)get_property(nec, "device-id", NULL);
514 if (prop == NULL)
515 continue;
516 if (0x0035 != *prop)
517 continue;
518 prop = (u32 *)get_property(nec, "reg", NULL);
519 if (prop == NULL)
520 continue;
521 devfn = (prop[0] >> 8) & 0xff;
522 bus = (prop[0] >> 16) & 0xff;
523 if (PCI_FUNC(devfn) != 0)
524 continue;
525 hose = pci_find_hose_for_OF_device(nec);
526 if (!hose)
527 continue;
528 early_read_config_dword(hose, bus, devfn, 0xe4, &data);
529 if (data & 1UL) {
530 printk("Found NEC PD720100A USB2 chip with disabled EHCI, fixing up...\n");
531 data &= ~1UL;
532 early_write_config_dword(hose, bus, devfn, 0xe4, data);
533 early_write_config_byte(hose, bus, devfn | 2, PCI_INTERRUPT_LINE,
534 nec->intrs[0].line);
535 }
536 }
537}
538
539void __init
540pmac_find_bridges(void)
541{
542 struct device_node *np, *root;
543 struct device_node *ht = NULL;
544
545 root = of_find_node_by_path("/");
546 if (root == NULL) {
547 printk(KERN_CRIT "pmac_find_bridges: can't find root of device tree\n");
548 return;
549 }
550 for (np = NULL; (np = of_get_next_child(root, np)) != NULL;) {
551 if (np->name == NULL)
552 continue;
553 if (strcmp(np->name, "bandit") == 0
554 || strcmp(np->name, "chaos") == 0
555 || strcmp(np->name, "pci") == 0) {
556 if (add_bridge(np) == 0)
557 of_node_get(np);
558 }
559 if (strcmp(np->name, "ht") == 0) {
560 of_node_get(np);
561 ht = np;
562 }
563 }
564 of_node_put(root);
565
566 /* Probe HT last as it relies on the agp resources to be already
567 * setup
568 */
569 if (ht && add_bridge(ht) != 0)
570 of_node_put(ht);
571
572 init_p2pbridge();
573 fixup_nec_usb2();
574
575 /* We are still having some issues with the Xserve G4, enabling
576 * some offset between bus number and domains for now when we
577 * assign all busses should help for now
578 */
579 if (pci_assign_all_busses)
580 pcibios_assign_bus_offset = 0x10;
581
582#ifdef CONFIG_POWER4
583 /* There is something wrong with DMA on U3/HT. I haven't figured out
584 * the details yet, but if I set the cache line size to 128 bytes like
585 * it should, I'm getting memory corruption caused by devices like
586 * sungem (even without the MWI bit set, but maybe sungem doesn't
587 * care). Right now, it appears that setting up a 64 bytes line size
588 * works properly, 64 bytes beeing the max transfer size of HT, I
589 * suppose this is related the way HT/PCI are hooked together. I still
590 * need to dive into more specs though to be really sure of what's
591 * going on. --BenH.
592 *
593 * Ok, apparently, it's just that HT can't do more than 64 bytes
594 * transactions. MWI seem to be meaningless there as well, it may
595 * be worth nop'ing out pci_set_mwi too though I haven't done that
596 * yet.
597 *
598 * Note that it's a bit different for whatever is in the AGP slot.
599 * For now, I don't care, but this can become a real issue, we
600 * should probably hook pci_set_mwi anyway to make sure it sets
601 * the real cache line size in there.
602 */
603 if (machine_is_compatible("MacRISC4"))
604 pci_cache_line_size = 16; /* 64 bytes */
605
606 pmac_check_ht_link();
607#endif /* CONFIG_POWER4 */
608}
609
610#define GRACKLE_CFA(b, d, o) (0x80 | ((b) << 8) | ((d) << 16) \
611 | (((o) & ~3) << 24))
612
613#define GRACKLE_PICR1_STG 0x00000040
614#define GRACKLE_PICR1_LOOPSNOOP 0x00000010
615
616/* N.B. this is called before bridges is initialized, so we can't
617 use grackle_pcibios_{read,write}_config_dword. */
618static inline void grackle_set_stg(struct pci_controller* bp, int enable)
619{
620 unsigned int val;
621
622 out_be32(bp->cfg_addr, GRACKLE_CFA(0, 0, 0xa8));
623 val = in_le32(bp->cfg_data);
624 val = enable? (val | GRACKLE_PICR1_STG) :
625 (val & ~GRACKLE_PICR1_STG);
626 out_be32(bp->cfg_addr, GRACKLE_CFA(0, 0, 0xa8));
627 out_le32(bp->cfg_data, val);
628 (void)in_le32(bp->cfg_data);
629}
630
631static inline void grackle_set_loop_snoop(struct pci_controller *bp, int enable)
632{
633 unsigned int val;
634
635 out_be32(bp->cfg_addr, GRACKLE_CFA(0, 0, 0xa8));
636 val = in_le32(bp->cfg_data);
637 val = enable? (val | GRACKLE_PICR1_LOOPSNOOP) :
638 (val & ~GRACKLE_PICR1_LOOPSNOOP);
639 out_be32(bp->cfg_addr, GRACKLE_CFA(0, 0, 0xa8));
640 out_le32(bp->cfg_data, val);
641 (void)in_le32(bp->cfg_data);
642}
643
644static int __init
645setup_uninorth(struct pci_controller* hose, struct reg_property* addr)
646{
647 pci_assign_all_busses = 1;
648 has_uninorth = 1;
649 hose->ops = &macrisc_pci_ops;
650 hose->cfg_addr = ioremap(addr->address + 0x800000, 0x1000);
651 hose->cfg_data = ioremap(addr->address + 0xc00000, 0x1000);
652 /* We "know" that the bridge at f2000000 has the PCI slots. */
653 return addr->address == 0xf2000000;
654}
655
656static void __init
657setup_bandit(struct pci_controller* hose, struct reg_property* addr)
658{
659 hose->ops = &macrisc_pci_ops;
660 hose->cfg_addr = ioremap(addr->address + 0x800000, 0x1000);
661 hose->cfg_data = ioremap(addr->address + 0xc00000, 0x1000);
662 init_bandit(hose);
663}
664
665static void __init
666setup_chaos(struct pci_controller* hose, struct reg_property* addr)
667{
668 /* assume a `chaos' bridge */
669 hose->ops = &chaos_pci_ops;
670 hose->cfg_addr = ioremap(addr->address + 0x800000, 0x1000);
671 hose->cfg_data = ioremap(addr->address + 0xc00000, 0x1000);
672}
673
674#ifdef CONFIG_POWER4
675
676static void __init
677setup_u3_agp(struct pci_controller* hose, struct reg_property* addr)
678{
679 /* On G5, we move AGP up to high bus number so we don't need
680 * to reassign bus numbers for HT. If we ever have P2P bridges
681 * on AGP, we'll have to move pci_assign_all_busses to the
682 * pci_controller structure so we enable it for AGP and not for
683 * HT childs.
684 * We hard code the address because of the different size of
685 * the reg address cell, we shall fix that by killing struct
686 * reg_property and using some accessor functions instead
687 */
688 hose->first_busno = 0xf0;
689 hose->last_busno = 0xff;
690 has_uninorth = 1;
691 hose->ops = &macrisc_pci_ops;
692 hose->cfg_addr = ioremap(0xf0000000 + 0x800000, 0x1000);
693 hose->cfg_data = ioremap(0xf0000000 + 0xc00000, 0x1000);
694
695 u3_agp = hose;
696}
697
698static void __init
699setup_u3_ht(struct pci_controller* hose, struct reg_property *addr)
700{
701 struct device_node *np = (struct device_node *)hose->arch_data;
702 int i, cur;
703
704 hose->ops = &u3_ht_pci_ops;
705
706 /* We hard code the address because of the different size of
707 * the reg address cell, we shall fix that by killing struct
708 * reg_property and using some accessor functions instead
709 */
710 hose->cfg_data = ioremap(0xf2000000, 0x02000000);
711
712 /*
713 * /ht node doesn't expose a "ranges" property, so we "remove" regions that
714 * have been allocated to AGP. So far, this version of the code doesn't assign
715 * any of the 0xfxxxxxxx "fine" memory regions to /ht.
716 * We need to fix that sooner or later by either parsing all child "ranges"
717 * properties or figuring out the U3 address space decoding logic and
718 * then read its configuration register (if any).
719 */
720 hose->io_base_phys = 0xf4000000;
721 hose->io_base_virt = ioremap(hose->io_base_phys, 0x00400000);
722 isa_io_base = (unsigned long) hose->io_base_virt;
723 hose->io_resource.name = np->full_name;
724 hose->io_resource.start = 0;
725 hose->io_resource.end = 0x003fffff;
726 hose->io_resource.flags = IORESOURCE_IO;
727 hose->pci_mem_offset = 0;
728 hose->first_busno = 0;
729 hose->last_busno = 0xef;
730 hose->mem_resources[0].name = np->full_name;
731 hose->mem_resources[0].start = 0x80000000;
732 hose->mem_resources[0].end = 0xefffffff;
733 hose->mem_resources[0].flags = IORESOURCE_MEM;
734
735 if (u3_agp == NULL) {
736 DBG("U3 has no AGP, using full resource range\n");
737 return;
738 }
739
740 /* We "remove" the AGP resources from the resources allocated to HT, that
741 * is we create "holes". However, that code does assumptions that so far
742 * happen to be true (cross fingers...), typically that resources in the
743 * AGP node are properly ordered
744 */
745 cur = 0;
746 for (i=0; i<3; i++) {
747 struct resource *res = &u3_agp->mem_resources[i];
748 if (res->flags != IORESOURCE_MEM)
749 continue;
750 /* We don't care about "fine" resources */
751 if (res->start >= 0xf0000000)
752 continue;
753 /* Check if it's just a matter of "shrinking" us in one direction */
754 if (hose->mem_resources[cur].start == res->start) {
755 DBG("U3/HT: shrink start of %d, %08lx -> %08lx\n",
756 cur, hose->mem_resources[cur].start, res->end + 1);
757 hose->mem_resources[cur].start = res->end + 1;
758 continue;
759 }
760 if (hose->mem_resources[cur].end == res->end) {
761 DBG("U3/HT: shrink end of %d, %08lx -> %08lx\n",
762 cur, hose->mem_resources[cur].end, res->start - 1);
763 hose->mem_resources[cur].end = res->start - 1;
764 continue;
765 }
766 /* No, it's not the case, we need a hole */
767 if (cur == 2) {
768 /* not enough resources to make a hole, we drop part of the range */
769 printk(KERN_WARNING "Running out of resources for /ht host !\n");
770 hose->mem_resources[cur].end = res->start - 1;
771 continue;
772 }
773 cur++;
774 DBG("U3/HT: hole, %d end at %08lx, %d start at %08lx\n",
775 cur-1, res->start - 1, cur, res->end + 1);
776 hose->mem_resources[cur].name = np->full_name;
777 hose->mem_resources[cur].flags = IORESOURCE_MEM;
778 hose->mem_resources[cur].start = res->end + 1;
779 hose->mem_resources[cur].end = hose->mem_resources[cur-1].end;
780 hose->mem_resources[cur-1].end = res->start - 1;
781 }
782}
783
784#endif /* CONFIG_POWER4 */
785
786void __init
787setup_grackle(struct pci_controller *hose)
788{
789 setup_indirect_pci(hose, 0xfec00000, 0xfee00000);
790 if (machine_is_compatible("AAPL,PowerBook1998"))
791 grackle_set_loop_snoop(hose, 1);
792#if 0 /* Disabled for now, HW problems ??? */
793 grackle_set_stg(hose, 1);
794#endif
795}
796
797/*
798 * We assume that if we have a G3 powermac, we have one bridge called
799 * "pci" (a MPC106) and no bandit or chaos bridges, and contrariwise,
800 * if we have one or more bandit or chaos bridges, we don't have a MPC106.
801 */
802static int __init
803add_bridge(struct device_node *dev)
804{
805 int len;
806 struct pci_controller *hose;
807 struct reg_property *addr;
808 char* disp_name;
809 int *bus_range;
810 int primary = 1;
811
812 DBG("Adding PCI host bridge %s\n", dev->full_name);
813
814 addr = (struct reg_property *) get_property(dev, "reg", &len);
815 if (addr == NULL || len < sizeof(*addr)) {
816 printk(KERN_WARNING "Can't use %s: no address\n",
817 dev->full_name);
818 return -ENODEV;
819 }
820 bus_range = (int *) get_property(dev, "bus-range", &len);
821 if (bus_range == NULL || len < 2 * sizeof(int)) {
822 printk(KERN_WARNING "Can't get bus-range for %s, assume bus 0\n",
823 dev->full_name);
824 }
825
826 hose = pcibios_alloc_controller();
827 if (!hose)
828 return -ENOMEM;
829 hose->arch_data = dev;
830 hose->first_busno = bus_range ? bus_range[0] : 0;
831 hose->last_busno = bus_range ? bus_range[1] : 0xff;
832
833 disp_name = NULL;
834#ifdef CONFIG_POWER4
835 if (device_is_compatible(dev, "u3-agp")) {
836 setup_u3_agp(hose, addr);
837 disp_name = "U3-AGP";
838 primary = 0;
839 } else if (device_is_compatible(dev, "u3-ht")) {
840 setup_u3_ht(hose, addr);
841 disp_name = "U3-HT";
842 primary = 1;
843 } else
844#endif /* CONFIG_POWER4 */
845 if (device_is_compatible(dev, "uni-north")) {
846 primary = setup_uninorth(hose, addr);
847 disp_name = "UniNorth";
848 } else if (strcmp(dev->name, "pci") == 0) {
849 /* XXX assume this is a mpc106 (grackle) */
850 setup_grackle(hose);
851 disp_name = "Grackle (MPC106)";
852 } else if (strcmp(dev->name, "bandit") == 0) {
853 setup_bandit(hose, addr);
854 disp_name = "Bandit";
855 } else if (strcmp(dev->name, "chaos") == 0) {
856 setup_chaos(hose, addr);
857 disp_name = "Chaos";
858 primary = 0;
859 }
860 printk(KERN_INFO "Found %s PCI host bridge at 0x%08x. Firmware bus number: %d->%d\n",
861 disp_name, addr->address, hose->first_busno, hose->last_busno);
862 DBG(" ->Hose at 0x%p, cfg_addr=0x%p,cfg_data=0x%p\n",
863 hose, hose->cfg_addr, hose->cfg_data);
864
865 /* Interpret the "ranges" property */
866 /* This also maps the I/O region and sets isa_io/mem_base */
867 pci_process_bridge_OF_ranges(hose, dev, primary);
868
869 /* Fixup "bus-range" OF property */
870 fixup_bus_range(dev);
871
872 return 0;
873}
874
875static void __init
876pcibios_fixup_OF_interrupts(void)
877{
878 struct pci_dev* dev = NULL;
879
880 /*
881 * Open Firmware often doesn't initialize the
882 * PCI_INTERRUPT_LINE config register properly, so we
883 * should find the device node and apply the interrupt
884 * obtained from the OF device-tree
885 */
886 for_each_pci_dev(dev) {
887 struct device_node *node;
888 node = pci_device_to_OF_node(dev);
889 /* this is the node, see if it has interrupts */
890 if (node && node->n_intrs > 0)
891 dev->irq = node->intrs[0].line;
892 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
893 }
894}
895
896void __init
897pmac_pcibios_fixup(void)
898{
899 /* Fixup interrupts according to OF tree */
900 pcibios_fixup_OF_interrupts();
901}
902
903int __pmac
904pmac_pci_enable_device_hook(struct pci_dev *dev, int initial)
905{
906 struct device_node* node;
907 int updatecfg = 0;
908 int uninorth_child;
909
910 node = pci_device_to_OF_node(dev);
911
912 /* We don't want to enable USB controllers absent from the OF tree
913 * (iBook second controller)
914 */
915 if (dev->vendor == PCI_VENDOR_ID_APPLE
916 && (dev->class == ((PCI_CLASS_SERIAL_USB << 8) | 0x10))
917 && !node) {
918 printk(KERN_INFO "Apple USB OHCI %s disabled by firmware\n",
919 pci_name(dev));
920 return -EINVAL;
921 }
922
923 if (!node)
924 return 0;
925
926 uninorth_child = node->parent &&
927 device_is_compatible(node->parent, "uni-north");
928
929 /* Firewire & GMAC were disabled after PCI probe, the driver is
930 * claiming them, we must re-enable them now.
931 */
932 if (uninorth_child && !strcmp(node->name, "firewire") &&
933 (device_is_compatible(node, "pci106b,18") ||
934 device_is_compatible(node, "pci106b,30") ||
935 device_is_compatible(node, "pci11c1,5811"))) {
936 pmac_call_feature(PMAC_FTR_1394_CABLE_POWER, node, 0, 1);
937 pmac_call_feature(PMAC_FTR_1394_ENABLE, node, 0, 1);
938 updatecfg = 1;
939 }
940 if (uninorth_child && !strcmp(node->name, "ethernet") &&
941 device_is_compatible(node, "gmac")) {
942 pmac_call_feature(PMAC_FTR_GMAC_ENABLE, node, 0, 1);
943 updatecfg = 1;
944 }
945
946 if (updatecfg) {
947 u16 cmd;
948
949 /*
950 * Make sure PCI is correctly configured
951 *
952 * We use old pci_bios versions of the function since, by
953 * default, gmac is not powered up, and so will be absent
954 * from the kernel initial PCI lookup.
955 *
956 * Should be replaced by 2.4 new PCI mechanisms and really
957 * register the device.
958 */
959 pci_read_config_word(dev, PCI_COMMAND, &cmd);
960 cmd |= PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER | PCI_COMMAND_INVALIDATE;
961 pci_write_config_word(dev, PCI_COMMAND, cmd);
962 pci_write_config_byte(dev, PCI_LATENCY_TIMER, 16);
963 pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, pci_cache_line_size);
964 }
965
966 return 0;
967}
968
969/* We power down some devices after they have been probed. They'll
970 * be powered back on later on
971 */
972void __init
973pmac_pcibios_after_init(void)
974{
975 struct device_node* nd;
976
977#ifdef CONFIG_BLK_DEV_IDE
978 struct pci_dev *dev = NULL;
979
980 /* OF fails to initialize IDE controllers on macs
981 * (and maybe other machines)
982 *
983 * Ideally, this should be moved to the IDE layer, but we need
984 * to check specifically with Andre Hedrick how to do it cleanly
985 * since the common IDE code seem to care about the fact that the
986 * BIOS may have disabled a controller.
987 *
988 * -- BenH
989 */
990 for_each_pci_dev(dev) {
991 if ((dev->class >> 16) == PCI_BASE_CLASS_STORAGE)
992 pci_enable_device(dev);
993 }
994#endif /* CONFIG_BLK_DEV_IDE */
995
996 nd = find_devices("firewire");
997 while (nd) {
998 if (nd->parent && (device_is_compatible(nd, "pci106b,18") ||
999 device_is_compatible(nd, "pci106b,30") ||
1000 device_is_compatible(nd, "pci11c1,5811"))
1001 && device_is_compatible(nd->parent, "uni-north")) {
1002 pmac_call_feature(PMAC_FTR_1394_ENABLE, nd, 0, 0);
1003 pmac_call_feature(PMAC_FTR_1394_CABLE_POWER, nd, 0, 0);
1004 }
1005 nd = nd->next;
1006 }
1007 nd = find_devices("ethernet");
1008 while (nd) {
1009 if (nd->parent && device_is_compatible(nd, "gmac")
1010 && device_is_compatible(nd->parent, "uni-north"))
1011 pmac_call_feature(PMAC_FTR_GMAC_ENABLE, nd, 0, 0);
1012 nd = nd->next;
1013 }
1014}
1015
1016void pmac_pci_fixup_cardbus(struct pci_dev* dev)
1017{
1018 if (_machine != _MACH_Pmac)
1019 return;
1020 /*
1021 * Fix the interrupt routing on the various cardbus bridges
1022 * used on powerbooks
1023 */
1024 if (dev->vendor != PCI_VENDOR_ID_TI)
1025 return;
1026 if (dev->device == PCI_DEVICE_ID_TI_1130 ||
1027 dev->device == PCI_DEVICE_ID_TI_1131) {
1028 u8 val;
1029 /* Enable PCI interrupt */
1030 if (pci_read_config_byte(dev, 0x91, &val) == 0)
1031 pci_write_config_byte(dev, 0x91, val | 0x30);
1032 /* Disable ISA interrupt mode */
1033 if (pci_read_config_byte(dev, 0x92, &val) == 0)
1034 pci_write_config_byte(dev, 0x92, val & ~0x06);
1035 }
1036 if (dev->device == PCI_DEVICE_ID_TI_1210 ||
1037 dev->device == PCI_DEVICE_ID_TI_1211 ||
1038 dev->device == PCI_DEVICE_ID_TI_1410 ||
1039 dev->device == PCI_DEVICE_ID_TI_1510) {
1040 u8 val;
1041 /* 0x8c == TI122X_IRQMUX, 2 says to route the INTA
1042 signal out the MFUNC0 pin */
1043 if (pci_read_config_byte(dev, 0x8c, &val) == 0)
1044 pci_write_config_byte(dev, 0x8c, (val & ~0x0f) | 2);
1045 /* Disable ISA interrupt mode */
1046 if (pci_read_config_byte(dev, 0x92, &val) == 0)
1047 pci_write_config_byte(dev, 0x92, val & ~0x06);
1048 }
1049}
1050
1051DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_TI, PCI_ANY_ID, pmac_pci_fixup_cardbus);
1052
1053void pmac_pci_fixup_pciata(struct pci_dev* dev)
1054{
1055 u8 progif = 0;
1056
1057 /*
1058 * On PowerMacs, we try to switch any PCI ATA controller to
1059 * fully native mode
1060 */
1061 if (_machine != _MACH_Pmac)
1062 return;
1063 /* Some controllers don't have the class IDE */
1064 if (dev->vendor == PCI_VENDOR_ID_PROMISE)
1065 switch(dev->device) {
1066 case PCI_DEVICE_ID_PROMISE_20246:
1067 case PCI_DEVICE_ID_PROMISE_20262:
1068 case PCI_DEVICE_ID_PROMISE_20263:
1069 case PCI_DEVICE_ID_PROMISE_20265:
1070 case PCI_DEVICE_ID_PROMISE_20267:
1071 case PCI_DEVICE_ID_PROMISE_20268:
1072 case PCI_DEVICE_ID_PROMISE_20269:
1073 case PCI_DEVICE_ID_PROMISE_20270:
1074 case PCI_DEVICE_ID_PROMISE_20271:
1075 case PCI_DEVICE_ID_PROMISE_20275:
1076 case PCI_DEVICE_ID_PROMISE_20276:
1077 case PCI_DEVICE_ID_PROMISE_20277:
1078 goto good;
1079 }
1080 /* Others, check PCI class */
1081 if ((dev->class >> 8) != PCI_CLASS_STORAGE_IDE)
1082 return;
1083 good:
1084 pci_read_config_byte(dev, PCI_CLASS_PROG, &progif);
1085 if ((progif & 5) != 5) {
1086 printk(KERN_INFO "Forcing PCI IDE into native mode: %s\n", pci_name(dev));
1087 (void) pci_write_config_byte(dev, PCI_CLASS_PROG, progif|5);
1088 if (pci_read_config_byte(dev, PCI_CLASS_PROG, &progif) ||
1089 (progif & 5) != 5)
1090 printk(KERN_ERR "Rewrite of PROGIF failed !\n");
1091 }
1092}
1093DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, pmac_pci_fixup_pciata);
1094
1095
1096/*
1097 * Disable second function on K2-SATA, it's broken
1098 * and disable IO BARs on first one
1099 */
1100void __pmac pmac_pci_fixup_k2_sata(struct pci_dev* dev)
1101{
1102 int i;
1103 u16 cmd;
1104
1105 if (PCI_FUNC(dev->devfn) > 0) {
1106 pci_read_config_word(dev, PCI_COMMAND, &cmd);
1107 cmd &= ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY);
1108 pci_write_config_word(dev, PCI_COMMAND, cmd);
1109 for (i = 0; i < 6; i++) {
1110 dev->resource[i].start = dev->resource[i].end = 0;
1111 dev->resource[i].flags = 0;
1112 pci_write_config_dword(dev, PCI_BASE_ADDRESS_0 + 4 * i, 0);
1113 }
1114 } else {
1115 pci_read_config_word(dev, PCI_COMMAND, &cmd);
1116 cmd &= ~PCI_COMMAND_IO;
1117 pci_write_config_word(dev, PCI_COMMAND, cmd);
1118 for (i = 0; i < 5; i++) {
1119 dev->resource[i].start = dev->resource[i].end = 0;
1120 dev->resource[i].flags = 0;
1121 pci_write_config_dword(dev, PCI_BASE_ADDRESS_0 + 4 * i, 0);
1122 }
1123 }
1124}
1125DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SERVERWORKS, 0x0240, pmac_pci_fixup_k2_sata);
diff --git a/arch/ppc/platforms/pmac_pic.c b/arch/ppc/platforms/pmac_pic.c
new file mode 100644
index 000000000000..9f92e1bb7f34
--- /dev/null
+++ b/arch/ppc/platforms/pmac_pic.c
@@ -0,0 +1,689 @@
1/*
2 * Support for the interrupt controllers found on Power Macintosh,
3 * currently Apple's "Grand Central" interrupt controller in all
4 * it's incarnations. OpenPIC support used on newer machines is
5 * in a separate file
6 *
7 * Copyright (C) 1997 Paul Mackerras (paulus@cs.anu.edu.au)
8 *
9 * Maintained by Benjamin Herrenschmidt (benh@kernel.crashing.org)
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version
14 * 2 of the License, or (at your option) any later version.
15 *
16 */
17
18#include <linux/config.h>
19#include <linux/stddef.h>
20#include <linux/init.h>
21#include <linux/sched.h>
22#include <linux/signal.h>
23#include <linux/pci.h>
24#include <linux/interrupt.h>
25#include <linux/sysdev.h>
26#include <linux/adb.h>
27#include <linux/pmu.h>
28
29#include <asm/sections.h>
30#include <asm/io.h>
31#include <asm/smp.h>
32#include <asm/prom.h>
33#include <asm/pci-bridge.h>
34#include <asm/time.h>
35#include <asm/open_pic.h>
36#include <asm/xmon.h>
37#include <asm/pmac_feature.h>
38
39#include "pmac_pic.h"
40
41/*
42 * XXX this should be in xmon.h, but putting it there means xmon.h
43 * has to include <linux/interrupt.h> (to get irqreturn_t), which
44 * causes all sorts of problems. -- paulus
45 */
46extern irqreturn_t xmon_irq(int, void *, struct pt_regs *);
47
48struct pmac_irq_hw {
49 unsigned int event;
50 unsigned int enable;
51 unsigned int ack;
52 unsigned int level;
53};
54
55/* Default addresses */
56static volatile struct pmac_irq_hw *pmac_irq_hw[4] __pmacdata = {
57 (struct pmac_irq_hw *) 0xf3000020,
58 (struct pmac_irq_hw *) 0xf3000010,
59 (struct pmac_irq_hw *) 0xf4000020,
60 (struct pmac_irq_hw *) 0xf4000010,
61};
62
63#define GC_LEVEL_MASK 0x3ff00000
64#define OHARE_LEVEL_MASK 0x1ff00000
65#define HEATHROW_LEVEL_MASK 0x1ff00000
66
67static int max_irqs __pmacdata;
68static int max_real_irqs __pmacdata;
69static u32 level_mask[4] __pmacdata;
70
71static DEFINE_SPINLOCK(pmac_pic_lock __pmacdata);
72
73
74#define GATWICK_IRQ_POOL_SIZE 10
75static struct interrupt_info gatwick_int_pool[GATWICK_IRQ_POOL_SIZE] __pmacdata;
76
77/*
78 * Mark an irq as "lost". This is only used on the pmac
79 * since it can lose interrupts (see pmac_set_irq_mask).
80 * -- Cort
81 */
82void __pmac
83__set_lost(unsigned long irq_nr, int nokick)
84{
85 if (!test_and_set_bit(irq_nr, ppc_lost_interrupts)) {
86 atomic_inc(&ppc_n_lost_interrupts);
87 if (!nokick)
88 set_dec(1);
89 }
90}
91
92static void __pmac
93pmac_mask_and_ack_irq(unsigned int irq_nr)
94{
95 unsigned long bit = 1UL << (irq_nr & 0x1f);
96 int i = irq_nr >> 5;
97 unsigned long flags;
98
99 if ((unsigned)irq_nr >= max_irqs)
100 return;
101
102 clear_bit(irq_nr, ppc_cached_irq_mask);
103 if (test_and_clear_bit(irq_nr, ppc_lost_interrupts))
104 atomic_dec(&ppc_n_lost_interrupts);
105 spin_lock_irqsave(&pmac_pic_lock, flags);
106 out_le32(&pmac_irq_hw[i]->enable, ppc_cached_irq_mask[i]);
107 out_le32(&pmac_irq_hw[i]->ack, bit);
108 do {
109 /* make sure ack gets to controller before we enable
110 interrupts */
111 mb();
112 } while((in_le32(&pmac_irq_hw[i]->enable) & bit)
113 != (ppc_cached_irq_mask[i] & bit));
114 spin_unlock_irqrestore(&pmac_pic_lock, flags);
115}
116
117static void __pmac pmac_set_irq_mask(unsigned int irq_nr, int nokicklost)
118{
119 unsigned long bit = 1UL << (irq_nr & 0x1f);
120 int i = irq_nr >> 5;
121 unsigned long flags;
122
123 if ((unsigned)irq_nr >= max_irqs)
124 return;
125
126 spin_lock_irqsave(&pmac_pic_lock, flags);
127 /* enable unmasked interrupts */
128 out_le32(&pmac_irq_hw[i]->enable, ppc_cached_irq_mask[i]);
129
130 do {
131 /* make sure mask gets to controller before we
132 return to user */
133 mb();
134 } while((in_le32(&pmac_irq_hw[i]->enable) & bit)
135 != (ppc_cached_irq_mask[i] & bit));
136
137 /*
138 * Unfortunately, setting the bit in the enable register
139 * when the device interrupt is already on *doesn't* set
140 * the bit in the flag register or request another interrupt.
141 */
142 if (bit & ppc_cached_irq_mask[i] & in_le32(&pmac_irq_hw[i]->level))
143 __set_lost((ulong)irq_nr, nokicklost);
144 spin_unlock_irqrestore(&pmac_pic_lock, flags);
145}
146
147/* When an irq gets requested for the first client, if it's an
148 * edge interrupt, we clear any previous one on the controller
149 */
150static unsigned int __pmac pmac_startup_irq(unsigned int irq_nr)
151{
152 unsigned long bit = 1UL << (irq_nr & 0x1f);
153 int i = irq_nr >> 5;
154
155 if ((irq_desc[irq_nr].status & IRQ_LEVEL) == 0)
156 out_le32(&pmac_irq_hw[i]->ack, bit);
157 set_bit(irq_nr, ppc_cached_irq_mask);
158 pmac_set_irq_mask(irq_nr, 0);
159
160 return 0;
161}
162
163static void __pmac pmac_mask_irq(unsigned int irq_nr)
164{
165 clear_bit(irq_nr, ppc_cached_irq_mask);
166 pmac_set_irq_mask(irq_nr, 0);
167 mb();
168}
169
170static void __pmac pmac_unmask_irq(unsigned int irq_nr)
171{
172 set_bit(irq_nr, ppc_cached_irq_mask);
173 pmac_set_irq_mask(irq_nr, 0);
174}
175
176static void __pmac pmac_end_irq(unsigned int irq_nr)
177{
178 if (!(irq_desc[irq_nr].status & (IRQ_DISABLED|IRQ_INPROGRESS))
179 && irq_desc[irq_nr].action) {
180 set_bit(irq_nr, ppc_cached_irq_mask);
181 pmac_set_irq_mask(irq_nr, 1);
182 }
183}
184
185
186struct hw_interrupt_type pmac_pic = {
187 .typename = " PMAC-PIC ",
188 .startup = pmac_startup_irq,
189 .enable = pmac_unmask_irq,
190 .disable = pmac_mask_irq,
191 .ack = pmac_mask_and_ack_irq,
192 .end = pmac_end_irq,
193};
194
195struct hw_interrupt_type gatwick_pic = {
196 .typename = " GATWICK ",
197 .startup = pmac_startup_irq,
198 .enable = pmac_unmask_irq,
199 .disable = pmac_mask_irq,
200 .ack = pmac_mask_and_ack_irq,
201 .end = pmac_end_irq,
202};
203
204static irqreturn_t gatwick_action(int cpl, void *dev_id, struct pt_regs *regs)
205{
206 int irq, bits;
207
208 for (irq = max_irqs; (irq -= 32) >= max_real_irqs; ) {
209 int i = irq >> 5;
210 bits = in_le32(&pmac_irq_hw[i]->event) | ppc_lost_interrupts[i];
211 /* We must read level interrupts from the level register */
212 bits |= (in_le32(&pmac_irq_hw[i]->level) & level_mask[i]);
213 bits &= ppc_cached_irq_mask[i];
214 if (bits == 0)
215 continue;
216 irq += __ilog2(bits);
217 __do_IRQ(irq, regs);
218 return IRQ_HANDLED;
219 }
220 printk("gatwick irq not from gatwick pic\n");
221 return IRQ_NONE;
222}
223
224int
225pmac_get_irq(struct pt_regs *regs)
226{
227 int irq;
228 unsigned long bits = 0;
229
230#ifdef CONFIG_SMP
231 void psurge_smp_message_recv(struct pt_regs *);
232
233 /* IPI's are a hack on the powersurge -- Cort */
234 if ( smp_processor_id() != 0 ) {
235 psurge_smp_message_recv(regs);
236 return -2; /* ignore, already handled */
237 }
238#endif /* CONFIG_SMP */
239 for (irq = max_real_irqs; (irq -= 32) >= 0; ) {
240 int i = irq >> 5;
241 bits = in_le32(&pmac_irq_hw[i]->event) | ppc_lost_interrupts[i];
242 /* We must read level interrupts from the level register */
243 bits |= (in_le32(&pmac_irq_hw[i]->level) & level_mask[i]);
244 bits &= ppc_cached_irq_mask[i];
245 if (bits == 0)
246 continue;
247 irq += __ilog2(bits);
248 break;
249 }
250
251 return irq;
252}
253
254/* This routine will fix some missing interrupt values in the device tree
255 * on the gatwick mac-io controller used by some PowerBooks
256 */
257static void __init
258pmac_fix_gatwick_interrupts(struct device_node *gw, int irq_base)
259{
260 struct device_node *node;
261 int count;
262
263 memset(gatwick_int_pool, 0, sizeof(gatwick_int_pool));
264 node = gw->child;
265 count = 0;
266 while(node)
267 {
268 /* Fix SCC */
269 if (strcasecmp(node->name, "escc") == 0)
270 if (node->child) {
271 if (node->child->n_intrs < 3) {
272 node->child->intrs = &gatwick_int_pool[count];
273 count += 3;
274 }
275 node->child->n_intrs = 3;
276 node->child->intrs[0].line = 15+irq_base;
277 node->child->intrs[1].line = 4+irq_base;
278 node->child->intrs[2].line = 5+irq_base;
279 printk(KERN_INFO "irq: fixed SCC on second controller (%d,%d,%d)\n",
280 node->child->intrs[0].line,
281 node->child->intrs[1].line,
282 node->child->intrs[2].line);
283 }
284 /* Fix media-bay & left SWIM */
285 if (strcasecmp(node->name, "media-bay") == 0) {
286 struct device_node* ya_node;
287
288 if (node->n_intrs == 0)
289 node->intrs = &gatwick_int_pool[count++];
290 node->n_intrs = 1;
291 node->intrs[0].line = 29+irq_base;
292 printk(KERN_INFO "irq: fixed media-bay on second controller (%d)\n",
293 node->intrs[0].line);
294
295 ya_node = node->child;
296 while(ya_node)
297 {
298 if (strcasecmp(ya_node->name, "floppy") == 0) {
299 if (ya_node->n_intrs < 2) {
300 ya_node->intrs = &gatwick_int_pool[count];
301 count += 2;
302 }
303 ya_node->n_intrs = 2;
304 ya_node->intrs[0].line = 19+irq_base;
305 ya_node->intrs[1].line = 1+irq_base;
306 printk(KERN_INFO "irq: fixed floppy on second controller (%d,%d)\n",
307 ya_node->intrs[0].line, ya_node->intrs[1].line);
308 }
309 if (strcasecmp(ya_node->name, "ata4") == 0) {
310 if (ya_node->n_intrs < 2) {
311 ya_node->intrs = &gatwick_int_pool[count];
312 count += 2;
313 }
314 ya_node->n_intrs = 2;
315 ya_node->intrs[0].line = 14+irq_base;
316 ya_node->intrs[1].line = 3+irq_base;
317 printk(KERN_INFO "irq: fixed ide on second controller (%d,%d)\n",
318 ya_node->intrs[0].line, ya_node->intrs[1].line);
319 }
320 ya_node = ya_node->sibling;
321 }
322 }
323 node = node->sibling;
324 }
325 if (count > 10) {
326 printk("WARNING !! Gatwick interrupt pool overflow\n");
327 printk(" GATWICK_IRQ_POOL_SIZE = %d\n", GATWICK_IRQ_POOL_SIZE);
328 printk(" requested = %d\n", count);
329 }
330}
331
332/*
333 * The PowerBook 3400/2400/3500 can have a combo ethernet/modem
334 * card which includes an ohare chip that acts as a second interrupt
335 * controller. If we find this second ohare, set it up and fix the
336 * interrupt value in the device tree for the ethernet chip.
337 */
338static int __init enable_second_ohare(void)
339{
340 unsigned char bus, devfn;
341 unsigned short cmd;
342 unsigned long addr;
343 struct device_node *irqctrler = find_devices("pci106b,7");
344 struct device_node *ether;
345
346 if (irqctrler == NULL || irqctrler->n_addrs <= 0)
347 return -1;
348 addr = (unsigned long) ioremap(irqctrler->addrs[0].address, 0x40);
349 pmac_irq_hw[1] = (volatile struct pmac_irq_hw *)(addr + 0x20);
350 max_irqs = 64;
351 if (pci_device_from_OF_node(irqctrler, &bus, &devfn) == 0) {
352 struct pci_controller* hose = pci_find_hose_for_OF_device(irqctrler);
353 if (!hose)
354 printk(KERN_ERR "Can't find PCI hose for OHare2 !\n");
355 else {
356 early_read_config_word(hose, bus, devfn, PCI_COMMAND, &cmd);
357 cmd |= PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER;
358 cmd &= ~PCI_COMMAND_IO;
359 early_write_config_word(hose, bus, devfn, PCI_COMMAND, cmd);
360 }
361 }
362
363 /* Fix interrupt for the modem/ethernet combo controller. The number
364 in the device tree (27) is bogus (correct for the ethernet-only
365 board but not the combo ethernet/modem board).
366 The real interrupt is 28 on the second controller -> 28+32 = 60.
367 */
368 ether = find_devices("pci1011,14");
369 if (ether && ether->n_intrs > 0) {
370 ether->intrs[0].line = 60;
371 printk(KERN_INFO "irq: Fixed ethernet IRQ to %d\n",
372 ether->intrs[0].line);
373 }
374
375 /* Return the interrupt number of the cascade */
376 return irqctrler->intrs[0].line;
377}
378
379#ifdef CONFIG_POWER4
380static irqreturn_t k2u3_action(int cpl, void *dev_id, struct pt_regs *regs)
381{
382 int irq;
383
384 irq = openpic2_get_irq(regs);
385 if (irq != -1)
386 __do_IRQ(irq, regs);
387 return IRQ_HANDLED;
388}
389
390static struct irqaction k2u3_cascade_action = {
391 .handler = k2u3_action,
392 .flags = 0,
393 .mask = CPU_MASK_NONE,
394 .name = "U3->K2 Cascade",
395};
396#endif /* CONFIG_POWER4 */
397
398#ifdef CONFIG_XMON
399static struct irqaction xmon_action = {
400 .handler = xmon_irq,
401 .flags = 0,
402 .mask = CPU_MASK_NONE,
403 .name = "NMI - XMON"
404};
405#endif
406
407static struct irqaction gatwick_cascade_action = {
408 .handler = gatwick_action,
409 .flags = SA_INTERRUPT,
410 .mask = CPU_MASK_NONE,
411 .name = "cascade",
412};
413
414void __init pmac_pic_init(void)
415{
416 int i;
417 struct device_node *irqctrler = NULL;
418 struct device_node *irqctrler2 = NULL;
419 struct device_node *np;
420 unsigned long addr;
421 int irq_cascade = -1;
422
423 /* We first try to detect Apple's new Core99 chipset, since mac-io
424 * is quite different on those machines and contains an IBM MPIC2.
425 */
426 np = find_type_devices("open-pic");
427 while(np) {
428 if (np->parent && !strcmp(np->parent->name, "u3"))
429 irqctrler2 = np;
430 else
431 irqctrler = np;
432 np = np->next;
433 }
434 if (irqctrler != NULL)
435 {
436 if (irqctrler->n_addrs > 0)
437 {
438 unsigned char senses[128];
439
440 printk(KERN_INFO "PowerMac using OpenPIC irq controller at 0x%08x\n",
441 irqctrler->addrs[0].address);
442
443 prom_get_irq_senses(senses, 0, 128);
444 OpenPIC_InitSenses = senses;
445 OpenPIC_NumInitSenses = 128;
446 ppc_md.get_irq = openpic_get_irq;
447 pmac_call_feature(PMAC_FTR_ENABLE_MPIC, irqctrler, 0, 0);
448 OpenPIC_Addr = ioremap(irqctrler->addrs[0].address,
449 irqctrler->addrs[0].size);
450 openpic_init(0);
451
452#ifdef CONFIG_POWER4
453 if (irqctrler2 != NULL && irqctrler2->n_intrs > 0 &&
454 irqctrler2->n_addrs > 0) {
455 printk(KERN_INFO "Slave OpenPIC at 0x%08x hooked on IRQ %d\n",
456 irqctrler2->addrs[0].address,
457 irqctrler2->intrs[0].line);
458 pmac_call_feature(PMAC_FTR_ENABLE_MPIC, irqctrler2, 0, 0);
459 OpenPIC2_Addr = ioremap(irqctrler2->addrs[0].address,
460 irqctrler2->addrs[0].size);
461 prom_get_irq_senses(senses, PMAC_OPENPIC2_OFFSET,
462 PMAC_OPENPIC2_OFFSET+128);
463 OpenPIC_InitSenses = senses;
464 OpenPIC_NumInitSenses = 128;
465 openpic2_init(PMAC_OPENPIC2_OFFSET);
466
467 if (setup_irq(irqctrler2->intrs[0].line,
468 &k2u3_cascade_action))
469 printk("Unable to get OpenPIC IRQ for cascade\n");
470 }
471#endif /* CONFIG_POWER4 */
472
473#ifdef CONFIG_XMON
474 {
475 struct device_node* pswitch;
476 int nmi_irq;
477
478 pswitch = find_devices("programmer-switch");
479 if (pswitch && pswitch->n_intrs) {
480 nmi_irq = pswitch->intrs[0].line;
481 openpic_init_nmi_irq(nmi_irq);
482 setup_irq(nmi_irq, &xmon_action);
483 }
484 }
485#endif /* CONFIG_XMON */
486 return;
487 }
488 irqctrler = NULL;
489 }
490
491 /* Get the level/edge settings, assume if it's not
492 * a Grand Central nor an OHare, then it's an Heathrow
493 * (or Paddington).
494 */
495 if (find_devices("gc"))
496 level_mask[0] = GC_LEVEL_MASK;
497 else if (find_devices("ohare")) {
498 level_mask[0] = OHARE_LEVEL_MASK;
499 /* We might have a second cascaded ohare */
500 level_mask[1] = OHARE_LEVEL_MASK;
501 } else {
502 level_mask[0] = HEATHROW_LEVEL_MASK;
503 level_mask[1] = 0;
504 /* We might have a second cascaded heathrow */
505 level_mask[2] = HEATHROW_LEVEL_MASK;
506 level_mask[3] = 0;
507 }
508
509 /*
510 * G3 powermacs and 1999 G3 PowerBooks have 64 interrupts,
511 * 1998 G3 Series PowerBooks have 128,
512 * other powermacs have 32.
513 * The combo ethernet/modem card for the Powerstar powerbooks
514 * (2400/3400/3500, ohare based) has a second ohare chip
515 * effectively making a total of 64.
516 */
517 max_irqs = max_real_irqs = 32;
518 irqctrler = find_devices("mac-io");
519 if (irqctrler)
520 {
521 max_real_irqs = 64;
522 if (irqctrler->next)
523 max_irqs = 128;
524 else
525 max_irqs = 64;
526 }
527 for ( i = 0; i < max_real_irqs ; i++ )
528 irq_desc[i].handler = &pmac_pic;
529
530 /* get addresses of first controller */
531 if (irqctrler) {
532 if (irqctrler->n_addrs > 0) {
533 addr = (unsigned long)
534 ioremap(irqctrler->addrs[0].address, 0x40);
535 for (i = 0; i < 2; ++i)
536 pmac_irq_hw[i] = (volatile struct pmac_irq_hw*)
537 (addr + (2 - i) * 0x10);
538 }
539
540 /* get addresses of second controller */
541 irqctrler = irqctrler->next;
542 if (irqctrler && irqctrler->n_addrs > 0) {
543 addr = (unsigned long)
544 ioremap(irqctrler->addrs[0].address, 0x40);
545 for (i = 2; i < 4; ++i)
546 pmac_irq_hw[i] = (volatile struct pmac_irq_hw*)
547 (addr + (4 - i) * 0x10);
548 irq_cascade = irqctrler->intrs[0].line;
549 if (device_is_compatible(irqctrler, "gatwick"))
550 pmac_fix_gatwick_interrupts(irqctrler, max_real_irqs);
551 }
552 } else {
553 /* older powermacs have a GC (grand central) or ohare at
554 f3000000, with interrupt control registers at f3000020. */
555 addr = (unsigned long) ioremap(0xf3000000, 0x40);
556 pmac_irq_hw[0] = (volatile struct pmac_irq_hw *) (addr + 0x20);
557 }
558
559 /* PowerBooks 3400 and 3500 can have a second controller in a second
560 ohare chip, on the combo ethernet/modem card */
561 if (machine_is_compatible("AAPL,3400/2400")
562 || machine_is_compatible("AAPL,3500"))
563 irq_cascade = enable_second_ohare();
564
565 /* disable all interrupts in all controllers */
566 for (i = 0; i * 32 < max_irqs; ++i)
567 out_le32(&pmac_irq_hw[i]->enable, 0);
568 /* mark level interrupts */
569 for (i = 0; i < max_irqs; i++)
570 if (level_mask[i >> 5] & (1UL << (i & 0x1f)))
571 irq_desc[i].status = IRQ_LEVEL;
572
573 /* get interrupt line of secondary interrupt controller */
574 if (irq_cascade >= 0) {
575 printk(KERN_INFO "irq: secondary controller on irq %d\n",
576 (int)irq_cascade);
577 for ( i = max_real_irqs ; i < max_irqs ; i++ )
578 irq_desc[i].handler = &gatwick_pic;
579 setup_irq(irq_cascade, &gatwick_cascade_action);
580 }
581 printk("System has %d possible interrupts\n", max_irqs);
582 if (max_irqs != max_real_irqs)
583 printk(KERN_DEBUG "%d interrupts on main controller\n",
584 max_real_irqs);
585
586#ifdef CONFIG_XMON
587 setup_irq(20, &xmon_action);
588#endif /* CONFIG_XMON */
589}
590
591#ifdef CONFIG_PM
592/*
593 * These procedures are used in implementing sleep on the powerbooks.
594 * sleep_save_intrs() saves the states of all interrupt enables
595 * and disables all interrupts except for the nominated one.
596 * sleep_restore_intrs() restores the states of all interrupt enables.
597 */
598unsigned long sleep_save_mask[2];
599
600/* This used to be passed by the PMU driver but that link got
601 * broken with the new driver model. We use this tweak for now...
602 */
603static int pmacpic_find_viaint(void)
604{
605 int viaint = -1;
606
607#ifdef CONFIG_ADB_PMU
608 struct device_node *np;
609
610 if (pmu_get_model() != PMU_OHARE_BASED)
611 goto not_found;
612 np = of_find_node_by_name(NULL, "via-pmu");
613 if (np == NULL)
614 goto not_found;
615 viaint = np->intrs[0].line;
616#endif /* CONFIG_ADB_PMU */
617
618not_found:
619 return viaint;
620}
621
622static int pmacpic_suspend(struct sys_device *sysdev, u32 state)
623{
624 int viaint = pmacpic_find_viaint();
625
626 sleep_save_mask[0] = ppc_cached_irq_mask[0];
627 sleep_save_mask[1] = ppc_cached_irq_mask[1];
628 ppc_cached_irq_mask[0] = 0;
629 ppc_cached_irq_mask[1] = 0;
630 if (viaint > 0)
631 set_bit(viaint, ppc_cached_irq_mask);
632 out_le32(&pmac_irq_hw[0]->enable, ppc_cached_irq_mask[0]);
633 if (max_real_irqs > 32)
634 out_le32(&pmac_irq_hw[1]->enable, ppc_cached_irq_mask[1]);
635 (void)in_le32(&pmac_irq_hw[0]->event);
636 /* make sure mask gets to controller before we return to caller */
637 mb();
638 (void)in_le32(&pmac_irq_hw[0]->enable);
639
640 return 0;
641}
642
643static int pmacpic_resume(struct sys_device *sysdev)
644{
645 int i;
646
647 out_le32(&pmac_irq_hw[0]->enable, 0);
648 if (max_real_irqs > 32)
649 out_le32(&pmac_irq_hw[1]->enable, 0);
650 mb();
651 for (i = 0; i < max_real_irqs; ++i)
652 if (test_bit(i, sleep_save_mask))
653 pmac_unmask_irq(i);
654
655 return 0;
656}
657
658#endif /* CONFIG_PM */
659
660static struct sysdev_class pmacpic_sysclass = {
661 set_kset_name("pmac_pic"),
662};
663
664static struct sys_device device_pmacpic = {
665 .id = 0,
666 .cls = &pmacpic_sysclass,
667};
668
669static struct sysdev_driver driver_pmacpic = {
670#ifdef CONFIG_PM
671 .suspend = &pmacpic_suspend,
672 .resume = &pmacpic_resume,
673#endif /* CONFIG_PM */
674};
675
676static int __init init_pmacpic_sysfs(void)
677{
678 if (max_irqs == 0)
679 return -ENODEV;
680
681 printk(KERN_DEBUG "Registering pmac pic with sysfs...\n");
682 sysdev_class_register(&pmacpic_sysclass);
683 sysdev_register(&device_pmacpic);
684 sysdev_driver_register(&pmacpic_sysclass, &driver_pmacpic);
685 return 0;
686}
687
688subsys_initcall(init_pmacpic_sysfs);
689
diff --git a/arch/ppc/platforms/pmac_pic.h b/arch/ppc/platforms/pmac_pic.h
new file mode 100644
index 000000000000..664103dfeef9
--- /dev/null
+++ b/arch/ppc/platforms/pmac_pic.h
@@ -0,0 +1,11 @@
1#ifndef __PPC_PLATFORMS_PMAC_PIC_H
2#define __PPC_PLATFORMS_PMAC_PIC_H
3
4#include <linux/irq.h>
5
6extern struct hw_interrupt_type pmac_pic;
7
8void pmac_pic_init(void);
9int pmac_get_irq(struct pt_regs *regs);
10
11#endif /* __PPC_PLATFORMS_PMAC_PIC_H */
diff --git a/arch/ppc/platforms/pmac_setup.c b/arch/ppc/platforms/pmac_setup.c
new file mode 100644
index 000000000000..4d324b630f4f
--- /dev/null
+++ b/arch/ppc/platforms/pmac_setup.c
@@ -0,0 +1,745 @@
1/*
2 * arch/ppc/platforms/setup.c
3 *
4 * PowerPC version
5 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
6 *
7 * Adapted for Power Macintosh by Paul Mackerras
8 * Copyright (C) 1996 Paul Mackerras (paulus@cs.anu.edu.au)
9 *
10 * Derived from "arch/alpha/kernel/setup.c"
11 * Copyright (C) 1995 Linus Torvalds
12 *
13 * Maintained by Benjamin Herrenschmidt (benh@kernel.crashing.org)
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version
18 * 2 of the License, or (at your option) any later version.
19 *
20 */
21
22/*
23 * bootup setup stuff..
24 */
25
26#include <linux/config.h>
27#include <linux/init.h>
28#include <linux/errno.h>
29#include <linux/sched.h>
30#include <linux/kernel.h>
31#include <linux/mm.h>
32#include <linux/stddef.h>
33#include <linux/unistd.h>
34#include <linux/ptrace.h>
35#include <linux/slab.h>
36#include <linux/user.h>
37#include <linux/a.out.h>
38#include <linux/tty.h>
39#include <linux/string.h>
40#include <linux/delay.h>
41#include <linux/ioport.h>
42#include <linux/major.h>
43#include <linux/initrd.h>
44#include <linux/vt_kern.h>
45#include <linux/console.h>
46#include <linux/ide.h>
47#include <linux/pci.h>
48#include <linux/adb.h>
49#include <linux/cuda.h>
50#include <linux/pmu.h>
51#include <linux/irq.h>
52#include <linux/seq_file.h>
53#include <linux/root_dev.h>
54#include <linux/bitops.h>
55#include <linux/suspend.h>
56
57#include <asm/reg.h>
58#include <asm/sections.h>
59#include <asm/prom.h>
60#include <asm/system.h>
61#include <asm/pgtable.h>
62#include <asm/io.h>
63#include <asm/pci-bridge.h>
64#include <asm/ohare.h>
65#include <asm/mediabay.h>
66#include <asm/machdep.h>
67#include <asm/dma.h>
68#include <asm/bootx.h>
69#include <asm/cputable.h>
70#include <asm/btext.h>
71#include <asm/pmac_feature.h>
72#include <asm/time.h>
73#include <asm/of_device.h>
74#include <asm/mmu_context.h>
75
76#include "pmac_pic.h"
77#include "mem_pieces.h"
78
79#undef SHOW_GATWICK_IRQS
80
81extern long pmac_time_init(void);
82extern unsigned long pmac_get_rtc_time(void);
83extern int pmac_set_rtc_time(unsigned long nowtime);
84extern void pmac_read_rtc_time(void);
85extern void pmac_calibrate_decr(void);
86extern void pmac_pcibios_fixup(void);
87extern void pmac_find_bridges(void);
88extern unsigned long pmac_ide_get_base(int index);
89extern void pmac_ide_init_hwif_ports(hw_regs_t *hw,
90 unsigned long data_port, unsigned long ctrl_port, int *irq);
91
92extern void pmac_nvram_update(void);
93extern unsigned char pmac_nvram_read_byte(int addr);
94extern void pmac_nvram_write_byte(int addr, unsigned char val);
95extern int pmac_pci_enable_device_hook(struct pci_dev *dev, int initial);
96extern void pmac_pcibios_after_init(void);
97extern int of_show_percpuinfo(struct seq_file *m, int i);
98
99struct device_node *memory_node;
100
101unsigned char drive_info;
102
103int ppc_override_l2cr = 0;
104int ppc_override_l2cr_value;
105int has_l2cache = 0;
106
107static int current_root_goodness = -1;
108
109extern int pmac_newworld;
110
111#define DEFAULT_ROOT_DEVICE Root_SDA1 /* sda1 - slightly silly choice */
112
113extern void zs_kgdb_hook(int tty_num);
114static void ohare_init(void);
115#ifdef CONFIG_BOOTX_TEXT
116void pmac_progress(char *s, unsigned short hex);
117#endif
118
119sys_ctrler_t sys_ctrler = SYS_CTRLER_UNKNOWN;
120
121#ifdef CONFIG_SMP
122extern struct smp_ops_t psurge_smp_ops;
123extern struct smp_ops_t core99_smp_ops;
124#endif /* CONFIG_SMP */
125
126int __pmac
127pmac_show_cpuinfo(struct seq_file *m)
128{
129 struct device_node *np;
130 char *pp;
131 int plen;
132 int mbmodel = pmac_call_feature(PMAC_FTR_GET_MB_INFO,
133 NULL, PMAC_MB_INFO_MODEL, 0);
134 unsigned int mbflags = (unsigned int)pmac_call_feature(PMAC_FTR_GET_MB_INFO,
135 NULL, PMAC_MB_INFO_FLAGS, 0);
136 char* mbname;
137
138 if (pmac_call_feature(PMAC_FTR_GET_MB_INFO, NULL, PMAC_MB_INFO_NAME, (int)&mbname) != 0)
139 mbname = "Unknown";
140
141 /* find motherboard type */
142 seq_printf(m, "machine\t\t: ");
143 np = find_devices("device-tree");
144 if (np != NULL) {
145 pp = (char *) get_property(np, "model", NULL);
146 if (pp != NULL)
147 seq_printf(m, "%s\n", pp);
148 else
149 seq_printf(m, "PowerMac\n");
150 pp = (char *) get_property(np, "compatible", &plen);
151 if (pp != NULL) {
152 seq_printf(m, "motherboard\t:");
153 while (plen > 0) {
154 int l = strlen(pp) + 1;
155 seq_printf(m, " %s", pp);
156 plen -= l;
157 pp += l;
158 }
159 seq_printf(m, "\n");
160 }
161 } else
162 seq_printf(m, "PowerMac\n");
163
164 /* print parsed model */
165 seq_printf(m, "detected as\t: %d (%s)\n", mbmodel, mbname);
166 seq_printf(m, "pmac flags\t: %08x\n", mbflags);
167
168 /* find l2 cache info */
169 np = find_devices("l2-cache");
170 if (np == 0)
171 np = find_type_devices("cache");
172 if (np != 0) {
173 unsigned int *ic = (unsigned int *)
174 get_property(np, "i-cache-size", NULL);
175 unsigned int *dc = (unsigned int *)
176 get_property(np, "d-cache-size", NULL);
177 seq_printf(m, "L2 cache\t:");
178 has_l2cache = 1;
179 if (get_property(np, "cache-unified", NULL) != 0 && dc) {
180 seq_printf(m, " %dK unified", *dc / 1024);
181 } else {
182 if (ic)
183 seq_printf(m, " %dK instruction", *ic / 1024);
184 if (dc)
185 seq_printf(m, "%s %dK data",
186 (ic? " +": ""), *dc / 1024);
187 }
188 pp = get_property(np, "ram-type", NULL);
189 if (pp)
190 seq_printf(m, " %s", pp);
191 seq_printf(m, "\n");
192 }
193
194 /* find ram info */
195 np = find_devices("memory");
196 if (np != 0) {
197 int n;
198 struct reg_property *reg = (struct reg_property *)
199 get_property(np, "reg", &n);
200
201 if (reg != 0) {
202 unsigned long total = 0;
203
204 for (n /= sizeof(struct reg_property); n > 0; --n)
205 total += (reg++)->size;
206 seq_printf(m, "memory\t\t: %luMB\n", total >> 20);
207 }
208 }
209
210 /* Checks "l2cr-value" property in the registry */
211 np = find_devices("cpus");
212 if (np == 0)
213 np = find_type_devices("cpu");
214 if (np != 0) {
215 unsigned int *l2cr = (unsigned int *)
216 get_property(np, "l2cr-value", NULL);
217 if (l2cr != 0) {
218 seq_printf(m, "l2cr override\t: 0x%x\n", *l2cr);
219 }
220 }
221
222 /* Indicate newworld/oldworld */
223 seq_printf(m, "pmac-generation\t: %s\n",
224 pmac_newworld ? "NewWorld" : "OldWorld");
225
226
227 return 0;
228}
229
230int __openfirmware
231pmac_show_percpuinfo(struct seq_file *m, int i)
232{
233#ifdef CONFIG_CPU_FREQ_PMAC
234 extern unsigned int pmac_get_one_cpufreq(int i);
235 unsigned int freq = pmac_get_one_cpufreq(i);
236 if (freq != 0) {
237 seq_printf(m, "clock\t\t: %dMHz\n", freq/1000);
238 return 0;
239 }
240#endif /* CONFIG_CPU_FREQ_PMAC */
241 return of_show_percpuinfo(m, i);
242}
243
244static volatile u32 *sysctrl_regs;
245
246void __init
247pmac_setup_arch(void)
248{
249 struct device_node *cpu;
250 int *fp;
251 unsigned long pvr;
252
253 pvr = PVR_VER(mfspr(SPRN_PVR));
254
255 /* Set loops_per_jiffy to a half-way reasonable value,
256 for use until calibrate_delay gets called. */
257 cpu = find_type_devices("cpu");
258 if (cpu != 0) {
259 fp = (int *) get_property(cpu, "clock-frequency", NULL);
260 if (fp != 0) {
261 if (pvr == 4 || pvr >= 8)
262 /* 604, G3, G4 etc. */
263 loops_per_jiffy = *fp / HZ;
264 else
265 /* 601, 603, etc. */
266 loops_per_jiffy = *fp / (2*HZ);
267 } else
268 loops_per_jiffy = 50000000 / HZ;
269 }
270
271 /* this area has the CPU identification register
272 and some registers used by smp boards */
273 sysctrl_regs = (volatile u32 *) ioremap(0xf8000000, 0x1000);
274 ohare_init();
275
276 /* Lookup PCI hosts */
277 pmac_find_bridges();
278
279 /* Checks "l2cr-value" property in the registry */
280 if (cpu_has_feature(CPU_FTR_L2CR)) {
281 struct device_node *np = find_devices("cpus");
282 if (np == 0)
283 np = find_type_devices("cpu");
284 if (np != 0) {
285 unsigned int *l2cr = (unsigned int *)
286 get_property(np, "l2cr-value", NULL);
287 if (l2cr != 0) {
288 ppc_override_l2cr = 1;
289 ppc_override_l2cr_value = *l2cr;
290 _set_L2CR(0);
291 _set_L2CR(ppc_override_l2cr_value);
292 }
293 }
294 }
295
296 if (ppc_override_l2cr)
297 printk(KERN_INFO "L2CR overriden (0x%x), backside cache is %s\n",
298 ppc_override_l2cr_value, (ppc_override_l2cr_value & 0x80000000)
299 ? "enabled" : "disabled");
300
301#ifdef CONFIG_KGDB
302 zs_kgdb_hook(0);
303#endif
304
305#ifdef CONFIG_ADB_CUDA
306 find_via_cuda();
307#else
308 if (find_devices("via-cuda")) {
309 printk("WARNING ! Your machine is Cuda based but your kernel\n");
310 printk(" wasn't compiled with CONFIG_ADB_CUDA option !\n");
311 }
312#endif
313#ifdef CONFIG_ADB_PMU
314 find_via_pmu();
315#else
316 if (find_devices("via-pmu")) {
317 printk("WARNING ! Your machine is PMU based but your kernel\n");
318 printk(" wasn't compiled with CONFIG_ADB_PMU option !\n");
319 }
320#endif
321#ifdef CONFIG_NVRAM
322 pmac_nvram_init();
323#endif
324#ifdef CONFIG_BLK_DEV_INITRD
325 if (initrd_start)
326 ROOT_DEV = Root_RAM0;
327 else
328#endif
329 ROOT_DEV = DEFAULT_ROOT_DEVICE;
330
331#ifdef CONFIG_SMP
332 /* Check for Core99 */
333 if (find_devices("uni-n") || find_devices("u3"))
334 ppc_md.smp_ops = &core99_smp_ops;
335 else
336 ppc_md.smp_ops = &psurge_smp_ops;
337#endif /* CONFIG_SMP */
338
339 pci_create_OF_bus_map();
340}
341
342static void __init ohare_init(void)
343{
344 /*
345 * Turn on the L2 cache.
346 * We assume that we have a PSX memory controller iff
347 * we have an ohare I/O controller.
348 */
349 if (find_devices("ohare") != NULL) {
350 if (((sysctrl_regs[2] >> 24) & 0xf) >= 3) {
351 if (sysctrl_regs[4] & 0x10)
352 sysctrl_regs[4] |= 0x04000020;
353 else
354 sysctrl_regs[4] |= 0x04000000;
355 if(has_l2cache)
356 printk(KERN_INFO "Level 2 cache enabled\n");
357 }
358 }
359}
360
361extern char *bootpath;
362extern char *bootdevice;
363void *boot_host;
364int boot_target;
365int boot_part;
366extern dev_t boot_dev;
367
368#ifdef CONFIG_SCSI
369void __init
370note_scsi_host(struct device_node *node, void *host)
371{
372 int l;
373 char *p;
374
375 l = strlen(node->full_name);
376 if (bootpath != NULL && bootdevice != NULL
377 && strncmp(node->full_name, bootdevice, l) == 0
378 && (bootdevice[l] == '/' || bootdevice[l] == 0)) {
379 boot_host = host;
380 /*
381 * There's a bug in OF 1.0.5. (Why am I not surprised.)
382 * If you pass a path like scsi/sd@1:0 to canon, it returns
383 * something like /bandit@F2000000/gc@10/53c94@10000/sd@0,0
384 * That is, the scsi target number doesn't get preserved.
385 * So we pick the target number out of bootpath and use that.
386 */
387 p = strstr(bootpath, "/sd@");
388 if (p != NULL) {
389 p += 4;
390 boot_target = simple_strtoul(p, NULL, 10);
391 p = strchr(p, ':');
392 if (p != NULL)
393 boot_part = simple_strtoul(p + 1, NULL, 10);
394 }
395 }
396}
397#endif
398
399#if defined(CONFIG_BLK_DEV_IDE) && defined(CONFIG_BLK_DEV_IDE_PMAC)
400static dev_t __init
401find_ide_boot(void)
402{
403 char *p;
404 int n;
405 dev_t __init pmac_find_ide_boot(char *bootdevice, int n);
406
407 if (bootdevice == NULL)
408 return 0;
409 p = strrchr(bootdevice, '/');
410 if (p == NULL)
411 return 0;
412 n = p - bootdevice;
413
414 return pmac_find_ide_boot(bootdevice, n);
415}
416#endif /* CONFIG_BLK_DEV_IDE && CONFIG_BLK_DEV_IDE_PMAC */
417
418void __init
419find_boot_device(void)
420{
421#if defined(CONFIG_BLK_DEV_IDE) && defined(CONFIG_BLK_DEV_IDE_PMAC)
422 boot_dev = find_ide_boot();
423#endif
424}
425
426static int initializing = 1;
427/* TODO: Merge the suspend-to-ram with the common code !!!
428 * currently, this is a stub implementation for suspend-to-disk
429 * only
430 */
431
432#ifdef CONFIG_SOFTWARE_SUSPEND
433
434static int pmac_pm_prepare(suspend_state_t state)
435{
436 printk(KERN_DEBUG "%s(%d)\n", __FUNCTION__, state);
437
438 return 0;
439}
440
441static int pmac_pm_enter(suspend_state_t state)
442{
443 printk(KERN_DEBUG "%s(%d)\n", __FUNCTION__, state);
444
445 /* Giveup the lazy FPU & vec so we don't have to back them
446 * up from the low level code
447 */
448 enable_kernel_fp();
449
450#ifdef CONFIG_ALTIVEC
451 if (cur_cpu_spec[0]->cpu_features & CPU_FTR_ALTIVEC)
452 enable_kernel_altivec();
453#endif /* CONFIG_ALTIVEC */
454
455 return 0;
456}
457
458static int pmac_pm_finish(suspend_state_t state)
459{
460 printk(KERN_DEBUG "%s(%d)\n", __FUNCTION__, state);
461
462 /* Restore userland MMU context */
463 set_context(current->active_mm->context, current->active_mm->pgd);
464
465 return 0;
466}
467
468static struct pm_ops pmac_pm_ops = {
469 .pm_disk_mode = PM_DISK_SHUTDOWN,
470 .prepare = pmac_pm_prepare,
471 .enter = pmac_pm_enter,
472 .finish = pmac_pm_finish,
473};
474
475#endif /* CONFIG_SOFTWARE_SUSPEND */
476
477static int pmac_late_init(void)
478{
479 initializing = 0;
480#ifdef CONFIG_SOFTWARE_SUSPEND
481 pm_set_ops(&pmac_pm_ops);
482#endif /* CONFIG_SOFTWARE_SUSPEND */
483 return 0;
484}
485
486late_initcall(pmac_late_init);
487
488/* can't be __init - can be called whenever a disk is first accessed */
489void __pmac
490note_bootable_part(dev_t dev, int part, int goodness)
491{
492 static int found_boot = 0;
493 char *p;
494
495 if (!initializing)
496 return;
497 if ((goodness <= current_root_goodness) &&
498 ROOT_DEV != DEFAULT_ROOT_DEVICE)
499 return;
500 p = strstr(saved_command_line, "root=");
501 if (p != NULL && (p == saved_command_line || p[-1] == ' '))
502 return;
503
504 if (!found_boot) {
505 find_boot_device();
506 found_boot = 1;
507 }
508 if (!boot_dev || dev == boot_dev) {
509 ROOT_DEV = dev + part;
510 boot_dev = 0;
511 current_root_goodness = goodness;
512 }
513}
514
515void __pmac
516pmac_restart(char *cmd)
517{
518#ifdef CONFIG_ADB_CUDA
519 struct adb_request req;
520#endif /* CONFIG_ADB_CUDA */
521
522 switch (sys_ctrler) {
523#ifdef CONFIG_ADB_CUDA
524 case SYS_CTRLER_CUDA:
525 cuda_request(&req, NULL, 2, CUDA_PACKET,
526 CUDA_RESET_SYSTEM);
527 for (;;)
528 cuda_poll();
529 break;
530#endif /* CONFIG_ADB_CUDA */
531#ifdef CONFIG_ADB_PMU
532 case SYS_CTRLER_PMU:
533 pmu_restart();
534 break;
535#endif /* CONFIG_ADB_PMU */
536 default: ;
537 }
538}
539
540void __pmac
541pmac_power_off(void)
542{
543#ifdef CONFIG_ADB_CUDA
544 struct adb_request req;
545#endif /* CONFIG_ADB_CUDA */
546
547 switch (sys_ctrler) {
548#ifdef CONFIG_ADB_CUDA
549 case SYS_CTRLER_CUDA:
550 cuda_request(&req, NULL, 2, CUDA_PACKET,
551 CUDA_POWERDOWN);
552 for (;;)
553 cuda_poll();
554 break;
555#endif /* CONFIG_ADB_CUDA */
556#ifdef CONFIG_ADB_PMU
557 case SYS_CTRLER_PMU:
558 pmu_shutdown();
559 break;
560#endif /* CONFIG_ADB_PMU */
561 default: ;
562 }
563}
564
565void __pmac
566pmac_halt(void)
567{
568 pmac_power_off();
569}
570
571/*
572 * Read in a property describing some pieces of memory.
573 */
574
575static int __init
576get_mem_prop(char *name, struct mem_pieces *mp)
577{
578 struct reg_property *rp;
579 int i, s;
580 unsigned int *ip;
581 int nac = prom_n_addr_cells(memory_node);
582 int nsc = prom_n_size_cells(memory_node);
583
584 ip = (unsigned int *) get_property(memory_node, name, &s);
585 if (ip == NULL) {
586 printk(KERN_ERR "error: couldn't get %s property on /memory\n",
587 name);
588 return 0;
589 }
590 s /= (nsc + nac) * 4;
591 rp = mp->regions;
592 for (i = 0; i < s; ++i, ip += nac+nsc) {
593 if (nac >= 2 && ip[nac-2] != 0)
594 continue;
595 rp->address = ip[nac-1];
596 if (nsc >= 2 && ip[nac+nsc-2] != 0)
597 rp->size = ~0U;
598 else
599 rp->size = ip[nac+nsc-1];
600 ++rp;
601 }
602 mp->n_regions = rp - mp->regions;
603
604 /* Make sure the pieces are sorted. */
605 mem_pieces_sort(mp);
606 mem_pieces_coalesce(mp);
607 return 1;
608}
609
610/*
611 * On systems with Open Firmware, collect information about
612 * physical RAM and which pieces are already in use.
613 * At this point, we have (at least) the first 8MB mapped with a BAT.
614 * Our text, data, bss use something over 1MB, starting at 0.
615 * Open Firmware may be using 1MB at the 4MB point.
616 */
617unsigned long __init
618pmac_find_end_of_memory(void)
619{
620 unsigned long a, total;
621 struct mem_pieces phys_mem;
622
623 /*
624 * Find out where physical memory is, and check that it
625 * starts at 0 and is contiguous. It seems that RAM is
626 * always physically contiguous on Power Macintoshes.
627 *
628 * Supporting discontiguous physical memory isn't hard,
629 * it just makes the virtual <-> physical mapping functions
630 * more complicated (or else you end up wasting space
631 * in mem_map).
632 */
633 memory_node = find_devices("memory");
634 if (memory_node == NULL || !get_mem_prop("reg", &phys_mem)
635 || phys_mem.n_regions == 0)
636 panic("No RAM??");
637 a = phys_mem.regions[0].address;
638 if (a != 0)
639 panic("RAM doesn't start at physical address 0");
640 total = phys_mem.regions[0].size;
641
642 if (phys_mem.n_regions > 1) {
643 printk("RAM starting at 0x%x is not contiguous\n",
644 phys_mem.regions[1].address);
645 printk("Using RAM from 0 to 0x%lx\n", total-1);
646 }
647
648 return total;
649}
650
651void __init
652pmac_init(unsigned long r3, unsigned long r4, unsigned long r5,
653 unsigned long r6, unsigned long r7)
654{
655 /* isa_io_base gets set in pmac_find_bridges */
656 isa_mem_base = PMAC_ISA_MEM_BASE;
657 pci_dram_offset = PMAC_PCI_DRAM_OFFSET;
658 ISA_DMA_THRESHOLD = ~0L;
659 DMA_MODE_READ = 1;
660 DMA_MODE_WRITE = 2;
661
662 ppc_md.setup_arch = pmac_setup_arch;
663 ppc_md.show_cpuinfo = pmac_show_cpuinfo;
664 ppc_md.show_percpuinfo = pmac_show_percpuinfo;
665 ppc_md.irq_canonicalize = NULL;
666 ppc_md.init_IRQ = pmac_pic_init;
667 ppc_md.get_irq = pmac_get_irq; /* Changed later on ... */
668
669 ppc_md.pcibios_fixup = pmac_pcibios_fixup;
670 ppc_md.pcibios_enable_device_hook = pmac_pci_enable_device_hook;
671 ppc_md.pcibios_after_init = pmac_pcibios_after_init;
672 ppc_md.phys_mem_access_prot = pci_phys_mem_access_prot;
673
674 ppc_md.restart = pmac_restart;
675 ppc_md.power_off = pmac_power_off;
676 ppc_md.halt = pmac_halt;
677
678 ppc_md.time_init = pmac_time_init;
679 ppc_md.set_rtc_time = pmac_set_rtc_time;
680 ppc_md.get_rtc_time = pmac_get_rtc_time;
681 ppc_md.calibrate_decr = pmac_calibrate_decr;
682
683 ppc_md.find_end_of_memory = pmac_find_end_of_memory;
684
685 ppc_md.feature_call = pmac_do_feature_call;
686
687#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
688#ifdef CONFIG_BLK_DEV_IDE_PMAC
689 ppc_ide_md.ide_init_hwif = pmac_ide_init_hwif_ports;
690 ppc_ide_md.default_io_base = pmac_ide_get_base;
691#endif /* CONFIG_BLK_DEV_IDE_PMAC */
692#endif /* defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) */
693
694#ifdef CONFIG_BOOTX_TEXT
695 ppc_md.progress = pmac_progress;
696#endif /* CONFIG_BOOTX_TEXT */
697
698 if (ppc_md.progress) ppc_md.progress("pmac_init(): exit", 0);
699
700}
701
702#ifdef CONFIG_BOOTX_TEXT
703void __init
704pmac_progress(char *s, unsigned short hex)
705{
706 if (boot_text_mapped) {
707 btext_drawstring(s);
708 btext_drawchar('\n');
709 }
710}
711#endif /* CONFIG_BOOTX_TEXT */
712
713static int __init
714pmac_declare_of_platform_devices(void)
715{
716 struct device_node *np;
717
718 np = find_devices("uni-n");
719 if (np) {
720 for (np = np->child; np != NULL; np = np->sibling)
721 if (strncmp(np->name, "i2c", 3) == 0) {
722 of_platform_device_create(np, "uni-n-i2c");
723 break;
724 }
725 }
726 np = find_devices("u3");
727 if (np) {
728 for (np = np->child; np != NULL; np = np->sibling)
729 if (strncmp(np->name, "i2c", 3) == 0) {
730 of_platform_device_create(np, "u3-i2c");
731 break;
732 }
733 }
734
735 np = find_devices("valkyrie");
736 if (np)
737 of_platform_device_create(np, "valkyrie");
738 np = find_devices("platinum");
739 if (np)
740 of_platform_device_create(np, "platinum");
741
742 return 0;
743}
744
745device_initcall(pmac_declare_of_platform_devices);
diff --git a/arch/ppc/platforms/pmac_sleep.S b/arch/ppc/platforms/pmac_sleep.S
new file mode 100644
index 000000000000..3139b6766ad3
--- /dev/null
+++ b/arch/ppc/platforms/pmac_sleep.S
@@ -0,0 +1,390 @@
1/*
2 * This file contains sleep low-level functions for PowerBook G3.
3 * Copyright (C) 1999 Benjamin Herrenschmidt (benh@kernel.crashing.org)
4 * and Paul Mackerras (paulus@samba.org).
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 *
11 */
12
13#include <linux/config.h>
14#include <asm/processor.h>
15#include <asm/page.h>
16#include <asm/ppc_asm.h>
17#include <asm/cputable.h>
18#include <asm/cache.h>
19#include <asm/thread_info.h>
20#include <asm/offsets.h>
21
22#define MAGIC 0x4c617273 /* 'Lars' */
23
24/*
25 * Structure for storing CPU registers on the stack.
26 */
27#define SL_SP 0
28#define SL_PC 4
29#define SL_MSR 8
30#define SL_SDR1 0xc
31#define SL_SPRG0 0x10 /* 4 sprg's */
32#define SL_DBAT0 0x20
33#define SL_IBAT0 0x28
34#define SL_DBAT1 0x30
35#define SL_IBAT1 0x38
36#define SL_DBAT2 0x40
37#define SL_IBAT2 0x48
38#define SL_DBAT3 0x50
39#define SL_IBAT3 0x58
40#define SL_TB 0x60
41#define SL_R2 0x68
42#define SL_CR 0x6c
43#define SL_R12 0x70 /* r12 to r31 */
44#define SL_SIZE (SL_R12 + 80)
45
46 .section .text
47 .align 5
48
49#if defined(CONFIG_PMAC_PBOOK) || defined(CONFIG_CPU_FREQ_PMAC)
50
51/* This gets called by via-pmu.c late during the sleep process.
52 * The PMU was already send the sleep command and will shut us down
53 * soon. We need to save all that is needed and setup the wakeup
54 * vector that will be called by the ROM on wakeup
55 */
56_GLOBAL(low_sleep_handler)
57#ifndef CONFIG_6xx
58 blr
59#else
60 mflr r0
61 stw r0,4(r1)
62 stwu r1,-SL_SIZE(r1)
63 mfcr r0
64 stw r0,SL_CR(r1)
65 stw r2,SL_R2(r1)
66 stmw r12,SL_R12(r1)
67
68 /* Save MSR & SDR1 */
69 mfmsr r4
70 stw r4,SL_MSR(r1)
71 mfsdr1 r4
72 stw r4,SL_SDR1(r1)
73
74 /* Get a stable timebase and save it */
751: mftbu r4
76 stw r4,SL_TB(r1)
77 mftb r5
78 stw r5,SL_TB+4(r1)
79 mftbu r3
80 cmpw r3,r4
81 bne 1b
82
83 /* Save SPRGs */
84 mfsprg r4,0
85 stw r4,SL_SPRG0(r1)
86 mfsprg r4,1
87 stw r4,SL_SPRG0+4(r1)
88 mfsprg r4,2
89 stw r4,SL_SPRG0+8(r1)
90 mfsprg r4,3
91 stw r4,SL_SPRG0+12(r1)
92
93 /* Save BATs */
94 mfdbatu r4,0
95 stw r4,SL_DBAT0(r1)
96 mfdbatl r4,0
97 stw r4,SL_DBAT0+4(r1)
98 mfdbatu r4,1
99 stw r4,SL_DBAT1(r1)
100 mfdbatl r4,1
101 stw r4,SL_DBAT1+4(r1)
102 mfdbatu r4,2
103 stw r4,SL_DBAT2(r1)
104 mfdbatl r4,2
105 stw r4,SL_DBAT2+4(r1)
106 mfdbatu r4,3
107 stw r4,SL_DBAT3(r1)
108 mfdbatl r4,3
109 stw r4,SL_DBAT3+4(r1)
110 mfibatu r4,0
111 stw r4,SL_IBAT0(r1)
112 mfibatl r4,0
113 stw r4,SL_IBAT0+4(r1)
114 mfibatu r4,1
115 stw r4,SL_IBAT1(r1)
116 mfibatl r4,1
117 stw r4,SL_IBAT1+4(r1)
118 mfibatu r4,2
119 stw r4,SL_IBAT2(r1)
120 mfibatl r4,2
121 stw r4,SL_IBAT2+4(r1)
122 mfibatu r4,3
123 stw r4,SL_IBAT3(r1)
124 mfibatl r4,3
125 stw r4,SL_IBAT3+4(r1)
126
127 /* Backup various CPU config stuffs */
128 bl __save_cpu_setup
129
130 /* The ROM can wake us up via 2 different vectors:
131 * - On wallstreet & lombard, we must write a magic
132 * value 'Lars' at address 4 and a pointer to a
133 * memory location containing the PC to resume from
134 * at address 0.
135 * - On Core99, we must store the wakeup vector at
136 * address 0x80 and eventually it's parameters
137 * at address 0x84. I've have some trouble with those
138 * parameters however and I no longer use them.
139 */
140 lis r5,grackle_wake_up@ha
141 addi r5,r5,grackle_wake_up@l
142 tophys(r5,r5)
143 stw r5,SL_PC(r1)
144 lis r4,KERNELBASE@h
145 tophys(r5,r1)
146 addi r5,r5,SL_PC
147 lis r6,MAGIC@ha
148 addi r6,r6,MAGIC@l
149 stw r5,0(r4)
150 stw r6,4(r4)
151 /* Setup stuffs at 0x80-0x84 for Core99 */
152 lis r3,core99_wake_up@ha
153 addi r3,r3,core99_wake_up@l
154 tophys(r3,r3)
155 stw r3,0x80(r4)
156 stw r5,0x84(r4)
157 /* Store a pointer to our backup storage into
158 * a kernel global
159 */
160 lis r3,sleep_storage@ha
161 addi r3,r3,sleep_storage@l
162 stw r5,0(r3)
163
164 /* Flush & disable all caches */
165 bl flush_disable_caches
166
167 /* Turn off data relocation. */
168 mfmsr r3 /* Save MSR in r7 */
169 rlwinm r3,r3,0,28,26 /* Turn off DR bit */
170 sync
171 mtmsr r3
172 isync
173
174BEGIN_FTR_SECTION
175 /* Flush any pending L2 data prefetches to work around HW bug */
176 sync
177 lis r3,0xfff0
178 lwz r0,0(r3) /* perform cache-inhibited load to ROM */
179 sync /* (caches are disabled at this point) */
180END_FTR_SECTION_IFSET(CPU_FTR_SPEC7450)
181
182/*
183 * Set the HID0 and MSR for sleep.
184 */
185 mfspr r2,SPRN_HID0
186 rlwinm r2,r2,0,10,7 /* clear doze, nap */
187 oris r2,r2,HID0_SLEEP@h
188 sync
189 isync
190 mtspr SPRN_HID0,r2
191 sync
192
193/* This loop puts us back to sleep in case we have a spurrious
194 * wakeup so that the host bridge properly stays asleep. The
195 * CPU will be turned off, either after a known time (about 1
196 * second) on wallstreet & lombard, or as soon as the CPU enters
197 * SLEEP mode on core99
198 */
199 mfmsr r2
200 oris r2,r2,MSR_POW@h
2011: sync
202 mtmsr r2
203 isync
204 b 1b
205
206/*
207 * Here is the resume code.
208 */
209
210
211/*
212 * Core99 machines resume here
213 * r4 has the physical address of SL_PC(sp) (unused)
214 */
215_GLOBAL(core99_wake_up)
216 /* Make sure HID0 no longer contains any sleep bit and that data cache
217 * is disabled
218 */
219 mfspr r3,SPRN_HID0
220 rlwinm r3,r3,0,11,7 /* clear SLEEP, NAP, DOZE bits */
221 rlwinm 3,r3,0,18,15 /* clear DCE, ICE */
222 mtspr SPRN_HID0,r3
223 sync
224 isync
225
226 /* sanitize MSR */
227 mfmsr r3
228 ori r3,r3,MSR_EE|MSR_IP
229 xori r3,r3,MSR_EE|MSR_IP
230 sync
231 isync
232 mtmsr r3
233 sync
234 isync
235
236 /* Recover sleep storage */
237 lis r3,sleep_storage@ha
238 addi r3,r3,sleep_storage@l
239 tophys(r3,r3)
240 lwz r1,0(r3)
241
242 /* Pass thru to older resume code ... */
243/*
244 * Here is the resume code for older machines.
245 * r1 has the physical address of SL_PC(sp).
246 */
247
248grackle_wake_up:
249
250 /* Restore the kernel's segment registers before
251 * we do any r1 memory access as we are not sure they
252 * are in a sane state above the first 256Mb region
253 */
254 li r0,16 /* load up segment register values */
255 mtctr r0 /* for context 0 */
256 lis r3,0x2000 /* Ku = 1, VSID = 0 */
257 li r4,0
2583: mtsrin r3,r4
259 addi r3,r3,0x111 /* increment VSID */
260 addis r4,r4,0x1000 /* address of next segment */
261 bdnz 3b
262 sync
263 isync
264
265 subi r1,r1,SL_PC
266
267 /* Restore various CPU config stuffs */
268 bl __restore_cpu_setup
269
270 /* Invalidate & enable L1 cache, we don't care about
271 * whatever the ROM may have tried to write to memory
272 */
273 bl __inval_enable_L1
274
275 /* Restore the BATs, and SDR1. Then we can turn on the MMU. */
276 lwz r4,SL_SDR1(r1)
277 mtsdr1 r4
278 lwz r4,SL_SPRG0(r1)
279 mtsprg 0,r4
280 lwz r4,SL_SPRG0+4(r1)
281 mtsprg 1,r4
282 lwz r4,SL_SPRG0+8(r1)
283 mtsprg 2,r4
284 lwz r4,SL_SPRG0+12(r1)
285 mtsprg 3,r4
286
287 lwz r4,SL_DBAT0(r1)
288 mtdbatu 0,r4
289 lwz r4,SL_DBAT0+4(r1)
290 mtdbatl 0,r4
291 lwz r4,SL_DBAT1(r1)
292 mtdbatu 1,r4
293 lwz r4,SL_DBAT1+4(r1)
294 mtdbatl 1,r4
295 lwz r4,SL_DBAT2(r1)
296 mtdbatu 2,r4
297 lwz r4,SL_DBAT2+4(r1)
298 mtdbatl 2,r4
299 lwz r4,SL_DBAT3(r1)
300 mtdbatu 3,r4
301 lwz r4,SL_DBAT3+4(r1)
302 mtdbatl 3,r4
303 lwz r4,SL_IBAT0(r1)
304 mtibatu 0,r4
305 lwz r4,SL_IBAT0+4(r1)
306 mtibatl 0,r4
307 lwz r4,SL_IBAT1(r1)
308 mtibatu 1,r4
309 lwz r4,SL_IBAT1+4(r1)
310 mtibatl 1,r4
311 lwz r4,SL_IBAT2(r1)
312 mtibatu 2,r4
313 lwz r4,SL_IBAT2+4(r1)
314 mtibatl 2,r4
315 lwz r4,SL_IBAT3(r1)
316 mtibatu 3,r4
317 lwz r4,SL_IBAT3+4(r1)
318 mtibatl 3,r4
319
320BEGIN_FTR_SECTION
321 li r4,0
322 mtspr SPRN_DBAT4U,r4
323 mtspr SPRN_DBAT4L,r4
324 mtspr SPRN_DBAT5U,r4
325 mtspr SPRN_DBAT5L,r4
326 mtspr SPRN_DBAT6U,r4
327 mtspr SPRN_DBAT6L,r4
328 mtspr SPRN_DBAT7U,r4
329 mtspr SPRN_DBAT7L,r4
330 mtspr SPRN_IBAT4U,r4
331 mtspr SPRN_IBAT4L,r4
332 mtspr SPRN_IBAT5U,r4
333 mtspr SPRN_IBAT5L,r4
334 mtspr SPRN_IBAT6U,r4
335 mtspr SPRN_IBAT6L,r4
336 mtspr SPRN_IBAT7U,r4
337 mtspr SPRN_IBAT7L,r4
338END_FTR_SECTION_IFSET(CPU_FTR_HAS_HIGH_BATS)
339
340 /* Flush all TLBs */
341 lis r4,0x1000
3421: addic. r4,r4,-0x1000
343 tlbie r4
344 blt 1b
345 sync
346
347 /* restore the MSR and turn on the MMU */
348 lwz r3,SL_MSR(r1)
349 bl turn_on_mmu
350
351 /* get back the stack pointer */
352 tovirt(r1,r1)
353
354 /* Restore TB */
355 li r3,0
356 mttbl r3
357 lwz r3,SL_TB(r1)
358 lwz r4,SL_TB+4(r1)
359 mttbu r3
360 mttbl r4
361
362 /* Restore the callee-saved registers and return */
363 lwz r0,SL_CR(r1)
364 mtcr r0
365 lwz r2,SL_R2(r1)
366 lmw r12,SL_R12(r1)
367 addi r1,r1,SL_SIZE
368 lwz r0,4(r1)
369 mtlr r0
370 blr
371
372turn_on_mmu:
373 mflr r4
374 tovirt(r4,r4)
375 mtsrr0 r4
376 mtsrr1 r3
377 sync
378 isync
379 rfi
380
381#endif /* defined(CONFIG_PMAC_PBOOK) || defined(CONFIG_CPU_FREQ) */
382
383 .section .data
384 .balign L1_CACHE_LINE_SIZE
385sleep_storage:
386 .long 0
387 .balign L1_CACHE_LINE_SIZE, 0
388
389#endif /* CONFIG_6xx */
390 .section .text
diff --git a/arch/ppc/platforms/pmac_smp.c b/arch/ppc/platforms/pmac_smp.c
new file mode 100644
index 000000000000..2b88745576a0
--- /dev/null
+++ b/arch/ppc/platforms/pmac_smp.c
@@ -0,0 +1,640 @@
1/*
2 * SMP support for power macintosh.
3 *
4 * We support both the old "powersurge" SMP architecture
5 * and the current Core99 (G4 PowerMac) machines.
6 *
7 * Note that we don't support the very first rev. of
8 * Apple/DayStar 2 CPUs board, the one with the funky
9 * watchdog. Hopefully, none of these should be there except
10 * maybe internally to Apple. I should probably still add some
11 * code to detect this card though and disable SMP. --BenH.
12 *
13 * Support Macintosh G4 SMP by Troy Benjegerdes (hozer@drgw.net)
14 * and Ben Herrenschmidt <benh@kernel.crashing.org>.
15 *
16 * Support for DayStar quad CPU cards
17 * Copyright (C) XLR8, Inc. 1994-2000
18 *
19 * This program is free software; you can redistribute it and/or
20 * modify it under the terms of the GNU General Public License
21 * as published by the Free Software Foundation; either version
22 * 2 of the License, or (at your option) any later version.
23 */
24#include <linux/config.h>
25#include <linux/kernel.h>
26#include <linux/sched.h>
27#include <linux/smp.h>
28#include <linux/smp_lock.h>
29#include <linux/interrupt.h>
30#include <linux/kernel_stat.h>
31#include <linux/delay.h>
32#include <linux/init.h>
33#include <linux/spinlock.h>
34#include <linux/errno.h>
35#include <linux/hardirq.h>
36
37#include <asm/ptrace.h>
38#include <asm/atomic.h>
39#include <asm/irq.h>
40#include <asm/page.h>
41#include <asm/pgtable.h>
42#include <asm/sections.h>
43#include <asm/io.h>
44#include <asm/prom.h>
45#include <asm/smp.h>
46#include <asm/residual.h>
47#include <asm/machdep.h>
48#include <asm/pmac_feature.h>
49#include <asm/time.h>
50#include <asm/open_pic.h>
51#include <asm/cacheflush.h>
52#include <asm/keylargo.h>
53
54/*
55 * Powersurge (old powermac SMP) support.
56 */
57
58extern void __secondary_start_psurge(void);
59extern void __secondary_start_psurge2(void); /* Temporary horrible hack */
60extern void __secondary_start_psurge3(void); /* Temporary horrible hack */
61
62/* Addresses for powersurge registers */
63#define HAMMERHEAD_BASE 0xf8000000
64#define HHEAD_CONFIG 0x90
65#define HHEAD_SEC_INTR 0xc0
66
67/* register for interrupting the primary processor on the powersurge */
68/* N.B. this is actually the ethernet ROM! */
69#define PSURGE_PRI_INTR 0xf3019000
70
71/* register for storing the start address for the secondary processor */
72/* N.B. this is the PCI config space address register for the 1st bridge */
73#define PSURGE_START 0xf2800000
74
75/* Daystar/XLR8 4-CPU card */
76#define PSURGE_QUAD_REG_ADDR 0xf8800000
77
78#define PSURGE_QUAD_IRQ_SET 0
79#define PSURGE_QUAD_IRQ_CLR 1
80#define PSURGE_QUAD_IRQ_PRIMARY 2
81#define PSURGE_QUAD_CKSTOP_CTL 3
82#define PSURGE_QUAD_PRIMARY_ARB 4
83#define PSURGE_QUAD_BOARD_ID 6
84#define PSURGE_QUAD_WHICH_CPU 7
85#define PSURGE_QUAD_CKSTOP_RDBK 8
86#define PSURGE_QUAD_RESET_CTL 11
87
88#define PSURGE_QUAD_OUT(r, v) (out_8(quad_base + ((r) << 4) + 4, (v)))
89#define PSURGE_QUAD_IN(r) (in_8(quad_base + ((r) << 4) + 4) & 0x0f)
90#define PSURGE_QUAD_BIS(r, v) (PSURGE_QUAD_OUT((r), PSURGE_QUAD_IN(r) | (v)))
91#define PSURGE_QUAD_BIC(r, v) (PSURGE_QUAD_OUT((r), PSURGE_QUAD_IN(r) & ~(v)))
92
93/* virtual addresses for the above */
94static volatile u8 *hhead_base;
95static volatile u8 *quad_base;
96static volatile u32 *psurge_pri_intr;
97static volatile u8 *psurge_sec_intr;
98static volatile u32 *psurge_start;
99
100/* values for psurge_type */
101#define PSURGE_NONE -1
102#define PSURGE_DUAL 0
103#define PSURGE_QUAD_OKEE 1
104#define PSURGE_QUAD_COTTON 2
105#define PSURGE_QUAD_ICEGRASS 3
106
107/* what sort of powersurge board we have */
108static int psurge_type = PSURGE_NONE;
109
110/* L2 and L3 cache settings to pass from CPU0 to CPU1 */
111volatile static long int core99_l2_cache;
112volatile static long int core99_l3_cache;
113
114/* Timebase freeze GPIO */
115static unsigned int core99_tb_gpio;
116
117/* Sync flag for HW tb sync */
118static volatile int sec_tb_reset = 0;
119
120static void __init core99_init_caches(int cpu)
121{
122 if (!cpu_has_feature(CPU_FTR_L2CR))
123 return;
124
125 if (cpu == 0) {
126 core99_l2_cache = _get_L2CR();
127 printk("CPU0: L2CR is %lx\n", core99_l2_cache);
128 } else {
129 printk("CPU%d: L2CR was %lx\n", cpu, _get_L2CR());
130 _set_L2CR(0);
131 _set_L2CR(core99_l2_cache);
132 printk("CPU%d: L2CR set to %lx\n", cpu, core99_l2_cache);
133 }
134
135 if (!cpu_has_feature(CPU_FTR_L3CR))
136 return;
137
138 if (cpu == 0){
139 core99_l3_cache = _get_L3CR();
140 printk("CPU0: L3CR is %lx\n", core99_l3_cache);
141 } else {
142 printk("CPU%d: L3CR was %lx\n", cpu, _get_L3CR());
143 _set_L3CR(0);
144 _set_L3CR(core99_l3_cache);
145 printk("CPU%d: L3CR set to %lx\n", cpu, core99_l3_cache);
146 }
147}
148
149/*
150 * Set and clear IPIs for powersurge.
151 */
152static inline void psurge_set_ipi(int cpu)
153{
154 if (psurge_type == PSURGE_NONE)
155 return;
156 if (cpu == 0)
157 in_be32(psurge_pri_intr);
158 else if (psurge_type == PSURGE_DUAL)
159 out_8(psurge_sec_intr, 0);
160 else
161 PSURGE_QUAD_OUT(PSURGE_QUAD_IRQ_SET, 1 << cpu);
162}
163
164static inline void psurge_clr_ipi(int cpu)
165{
166 if (cpu > 0) {
167 switch(psurge_type) {
168 case PSURGE_DUAL:
169 out_8(psurge_sec_intr, ~0);
170 case PSURGE_NONE:
171 break;
172 default:
173 PSURGE_QUAD_OUT(PSURGE_QUAD_IRQ_CLR, 1 << cpu);
174 }
175 }
176}
177
178/*
179 * On powersurge (old SMP powermac architecture) we don't have
180 * separate IPIs for separate messages like openpic does. Instead
181 * we have a bitmap for each processor, where a 1 bit means that
182 * the corresponding message is pending for that processor.
183 * Ideally each cpu's entry would be in a different cache line.
184 * -- paulus.
185 */
186static unsigned long psurge_smp_message[NR_CPUS];
187
188void __pmac psurge_smp_message_recv(struct pt_regs *regs)
189{
190 int cpu = smp_processor_id();
191 int msg;
192
193 /* clear interrupt */
194 psurge_clr_ipi(cpu);
195
196 if (num_online_cpus() < 2)
197 return;
198
199 /* make sure there is a message there */
200 for (msg = 0; msg < 4; msg++)
201 if (test_and_clear_bit(msg, &psurge_smp_message[cpu]))
202 smp_message_recv(msg, regs);
203}
204
205irqreturn_t __pmac psurge_primary_intr(int irq, void *d, struct pt_regs *regs)
206{
207 psurge_smp_message_recv(regs);
208 return IRQ_HANDLED;
209}
210
211static void __pmac smp_psurge_message_pass(int target, int msg, unsigned long data,
212 int wait)
213{
214 int i;
215
216 if (num_online_cpus() < 2)
217 return;
218
219 for (i = 0; i < NR_CPUS; i++) {
220 if (!cpu_online(i))
221 continue;
222 if (target == MSG_ALL
223 || (target == MSG_ALL_BUT_SELF && i != smp_processor_id())
224 || target == i) {
225 set_bit(msg, &psurge_smp_message[i]);
226 psurge_set_ipi(i);
227 }
228 }
229}
230
231/*
232 * Determine a quad card presence. We read the board ID register, we
233 * force the data bus to change to something else, and we read it again.
234 * It it's stable, then the register probably exist (ugh !)
235 */
236static int __init psurge_quad_probe(void)
237{
238 int type;
239 unsigned int i;
240
241 type = PSURGE_QUAD_IN(PSURGE_QUAD_BOARD_ID);
242 if (type < PSURGE_QUAD_OKEE || type > PSURGE_QUAD_ICEGRASS
243 || type != PSURGE_QUAD_IN(PSURGE_QUAD_BOARD_ID))
244 return PSURGE_DUAL;
245
246 /* looks OK, try a slightly more rigorous test */
247 /* bogus is not necessarily cacheline-aligned,
248 though I don't suppose that really matters. -- paulus */
249 for (i = 0; i < 100; i++) {
250 volatile u32 bogus[8];
251 bogus[(0+i)%8] = 0x00000000;
252 bogus[(1+i)%8] = 0x55555555;
253 bogus[(2+i)%8] = 0xFFFFFFFF;
254 bogus[(3+i)%8] = 0xAAAAAAAA;
255 bogus[(4+i)%8] = 0x33333333;
256 bogus[(5+i)%8] = 0xCCCCCCCC;
257 bogus[(6+i)%8] = 0xCCCCCCCC;
258 bogus[(7+i)%8] = 0x33333333;
259 wmb();
260 asm volatile("dcbf 0,%0" : : "r" (bogus) : "memory");
261 mb();
262 if (type != PSURGE_QUAD_IN(PSURGE_QUAD_BOARD_ID))
263 return PSURGE_DUAL;
264 }
265 return type;
266}
267
268static void __init psurge_quad_init(void)
269{
270 int procbits;
271
272 if (ppc_md.progress) ppc_md.progress("psurge_quad_init", 0x351);
273 procbits = ~PSURGE_QUAD_IN(PSURGE_QUAD_WHICH_CPU);
274 if (psurge_type == PSURGE_QUAD_ICEGRASS)
275 PSURGE_QUAD_BIS(PSURGE_QUAD_RESET_CTL, procbits);
276 else
277 PSURGE_QUAD_BIC(PSURGE_QUAD_CKSTOP_CTL, procbits);
278 mdelay(33);
279 out_8(psurge_sec_intr, ~0);
280 PSURGE_QUAD_OUT(PSURGE_QUAD_IRQ_CLR, procbits);
281 PSURGE_QUAD_BIS(PSURGE_QUAD_RESET_CTL, procbits);
282 if (psurge_type != PSURGE_QUAD_ICEGRASS)
283 PSURGE_QUAD_BIS(PSURGE_QUAD_CKSTOP_CTL, procbits);
284 PSURGE_QUAD_BIC(PSURGE_QUAD_PRIMARY_ARB, procbits);
285 mdelay(33);
286 PSURGE_QUAD_BIC(PSURGE_QUAD_RESET_CTL, procbits);
287 mdelay(33);
288 PSURGE_QUAD_BIS(PSURGE_QUAD_PRIMARY_ARB, procbits);
289 mdelay(33);
290}
291
292static int __init smp_psurge_probe(void)
293{
294 int i, ncpus;
295
296 /* We don't do SMP on the PPC601 -- paulus */
297 if (PVR_VER(mfspr(SPRN_PVR)) == 1)
298 return 1;
299
300 /*
301 * The powersurge cpu board can be used in the generation
302 * of powermacs that have a socket for an upgradeable cpu card,
303 * including the 7500, 8500, 9500, 9600.
304 * The device tree doesn't tell you if you have 2 cpus because
305 * OF doesn't know anything about the 2nd processor.
306 * Instead we look for magic bits in magic registers,
307 * in the hammerhead memory controller in the case of the
308 * dual-cpu powersurge board. -- paulus.
309 */
310 if (find_devices("hammerhead") == NULL)
311 return 1;
312
313 hhead_base = ioremap(HAMMERHEAD_BASE, 0x800);
314 quad_base = ioremap(PSURGE_QUAD_REG_ADDR, 1024);
315 psurge_sec_intr = hhead_base + HHEAD_SEC_INTR;
316
317 psurge_type = psurge_quad_probe();
318 if (psurge_type != PSURGE_DUAL) {
319 psurge_quad_init();
320 /* All released cards using this HW design have 4 CPUs */
321 ncpus = 4;
322 } else {
323 iounmap((void *) quad_base);
324 if ((in_8(hhead_base + HHEAD_CONFIG) & 0x02) == 0) {
325 /* not a dual-cpu card */
326 iounmap((void *) hhead_base);
327 psurge_type = PSURGE_NONE;
328 return 1;
329 }
330 ncpus = 2;
331 }
332
333 psurge_start = ioremap(PSURGE_START, 4);
334 psurge_pri_intr = ioremap(PSURGE_PRI_INTR, 4);
335
336 /* this is not actually strictly necessary -- paulus. */
337 for (i = 1; i < ncpus; ++i)
338 smp_hw_index[i] = i;
339
340 if (ppc_md.progress) ppc_md.progress("smp_psurge_probe - done", 0x352);
341
342 return ncpus;
343}
344
345static void __init smp_psurge_kick_cpu(int nr)
346{
347 void (*start)(void) = __secondary_start_psurge;
348 unsigned long a;
349
350 /* may need to flush here if secondary bats aren't setup */
351 for (a = KERNELBASE; a < KERNELBASE + 0x800000; a += 32)
352 asm volatile("dcbf 0,%0" : : "r" (a) : "memory");
353 asm volatile("sync");
354
355 if (ppc_md.progress) ppc_md.progress("smp_psurge_kick_cpu", 0x353);
356
357 /* setup entry point of secondary processor */
358 switch (nr) {
359 case 2:
360 start = __secondary_start_psurge2;
361 break;
362 case 3:
363 start = __secondary_start_psurge3;
364 break;
365 }
366
367 out_be32(psurge_start, __pa(start));
368 mb();
369
370 psurge_set_ipi(nr);
371 udelay(10);
372 psurge_clr_ipi(nr);
373
374 if (ppc_md.progress) ppc_md.progress("smp_psurge_kick_cpu - done", 0x354);
375}
376
377/*
378 * With the dual-cpu powersurge board, the decrementers and timebases
379 * of both cpus are frozen after the secondary cpu is started up,
380 * until we give the secondary cpu another interrupt. This routine
381 * uses this to get the timebases synchronized.
382 * -- paulus.
383 */
384static void __init psurge_dual_sync_tb(int cpu_nr)
385{
386 int t;
387
388 set_dec(tb_ticks_per_jiffy);
389 set_tb(0, 0);
390 last_jiffy_stamp(cpu_nr) = 0;
391
392 if (cpu_nr > 0) {
393 mb();
394 sec_tb_reset = 1;
395 return;
396 }
397
398 /* wait for the secondary to have reset its TB before proceeding */
399 for (t = 10000000; t > 0 && !sec_tb_reset; --t)
400 ;
401
402 /* now interrupt the secondary, starting both TBs */
403 psurge_set_ipi(1);
404
405 smp_tb_synchronized = 1;
406}
407
408static struct irqaction psurge_irqaction = {
409 .handler = psurge_primary_intr,
410 .flags = SA_INTERRUPT,
411 .mask = CPU_MASK_NONE,
412 .name = "primary IPI",
413};
414
415static void __init smp_psurge_setup_cpu(int cpu_nr)
416{
417
418 if (cpu_nr == 0) {
419 /* If we failed to start the second CPU, we should still
420 * send it an IPI to start the timebase & DEC or we might
421 * have them stuck.
422 */
423 if (num_online_cpus() < 2) {
424 if (psurge_type == PSURGE_DUAL)
425 psurge_set_ipi(1);
426 return;
427 }
428 /* reset the entry point so if we get another intr we won't
429 * try to startup again */
430 out_be32(psurge_start, 0x100);
431 if (setup_irq(30, &psurge_irqaction))
432 printk(KERN_ERR "Couldn't get primary IPI interrupt");
433 }
434
435 if (psurge_type == PSURGE_DUAL)
436 psurge_dual_sync_tb(cpu_nr);
437}
438
439void __init smp_psurge_take_timebase(void)
440{
441 /* Dummy implementation */
442}
443
444void __init smp_psurge_give_timebase(void)
445{
446 /* Dummy implementation */
447}
448
449static int __init smp_core99_probe(void)
450{
451#ifdef CONFIG_6xx
452 extern int powersave_nap;
453#endif
454 struct device_node *cpus, *firstcpu;
455 int i, ncpus = 0, boot_cpu = -1;
456 u32 *tbprop;
457
458 if (ppc_md.progress) ppc_md.progress("smp_core99_probe", 0x345);
459 cpus = firstcpu = find_type_devices("cpu");
460 while(cpus != NULL) {
461 u32 *regprop = (u32 *)get_property(cpus, "reg", NULL);
462 char *stateprop = (char *)get_property(cpus, "state", NULL);
463 if (regprop != NULL && stateprop != NULL &&
464 !strncmp(stateprop, "running", 7))
465 boot_cpu = *regprop;
466 ++ncpus;
467 cpus = cpus->next;
468 }
469 if (boot_cpu == -1)
470 printk(KERN_WARNING "Couldn't detect boot CPU !\n");
471 if (boot_cpu != 0)
472 printk(KERN_WARNING "Boot CPU is %d, unsupported setup !\n", boot_cpu);
473
474 if (machine_is_compatible("MacRISC4")) {
475 extern struct smp_ops_t core99_smp_ops;
476
477 core99_smp_ops.take_timebase = smp_generic_take_timebase;
478 core99_smp_ops.give_timebase = smp_generic_give_timebase;
479 } else {
480 if (firstcpu != NULL)
481 tbprop = (u32 *)get_property(firstcpu, "timebase-enable", NULL);
482 if (tbprop)
483 core99_tb_gpio = *tbprop;
484 else
485 core99_tb_gpio = KL_GPIO_TB_ENABLE;
486 }
487
488 if (ncpus > 1) {
489 openpic_request_IPIs();
490 for (i = 1; i < ncpus; ++i)
491 smp_hw_index[i] = i;
492#ifdef CONFIG_6xx
493 powersave_nap = 0;
494#endif
495 core99_init_caches(0);
496 }
497
498 return ncpus;
499}
500
501static void __init smp_core99_kick_cpu(int nr)
502{
503 unsigned long save_vector, new_vector;
504 unsigned long flags;
505
506 volatile unsigned long *vector
507 = ((volatile unsigned long *)(KERNELBASE+0x100));
508 if (nr < 1 || nr > 3)
509 return;
510 if (ppc_md.progress) ppc_md.progress("smp_core99_kick_cpu", 0x346);
511
512 local_irq_save(flags);
513 local_irq_disable();
514
515 /* Save reset vector */
516 save_vector = *vector;
517
518 /* Setup fake reset vector that does
519 * b __secondary_start_psurge - KERNELBASE
520 */
521 switch(nr) {
522 case 1:
523 new_vector = (unsigned long)__secondary_start_psurge;
524 break;
525 case 2:
526 new_vector = (unsigned long)__secondary_start_psurge2;
527 break;
528 case 3:
529 new_vector = (unsigned long)__secondary_start_psurge3;
530 break;
531 }
532 *vector = 0x48000002 + new_vector - KERNELBASE;
533
534 /* flush data cache and inval instruction cache */
535 flush_icache_range((unsigned long) vector, (unsigned long) vector + 4);
536
537 /* Put some life in our friend */
538 pmac_call_feature(PMAC_FTR_RESET_CPU, NULL, nr, 0);
539
540 /* FIXME: We wait a bit for the CPU to take the exception, I should
541 * instead wait for the entry code to set something for me. Well,
542 * ideally, all that crap will be done in prom.c and the CPU left
543 * in a RAM-based wait loop like CHRP.
544 */
545 mdelay(1);
546
547 /* Restore our exception vector */
548 *vector = save_vector;
549 flush_icache_range((unsigned long) vector, (unsigned long) vector + 4);
550
551 local_irq_restore(flags);
552 if (ppc_md.progress) ppc_md.progress("smp_core99_kick_cpu done", 0x347);
553}
554
555static void __init smp_core99_setup_cpu(int cpu_nr)
556{
557 /* Setup L2/L3 */
558 if (cpu_nr != 0)
559 core99_init_caches(cpu_nr);
560
561 /* Setup openpic */
562 do_openpic_setup_cpu();
563
564 if (cpu_nr == 0) {
565#ifdef CONFIG_POWER4
566 extern void g5_phy_disable_cpu1(void);
567
568 /* If we didn't start the second CPU, we must take
569 * it off the bus
570 */
571 if (machine_is_compatible("MacRISC4") &&
572 num_online_cpus() < 2)
573 g5_phy_disable_cpu1();
574#endif /* CONFIG_POWER4 */
575 if (ppc_md.progress) ppc_md.progress("core99_setup_cpu 0 done", 0x349);
576 }
577}
578
579void __init smp_core99_take_timebase(void)
580{
581 /* Secondary processor "takes" the timebase by freezing
582 * it, resetting its local TB and telling CPU 0 to go on
583 */
584 pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, core99_tb_gpio, 4);
585 pmac_call_feature(PMAC_FTR_READ_GPIO, NULL, core99_tb_gpio, 0);
586 mb();
587
588 set_dec(tb_ticks_per_jiffy);
589 set_tb(0, 0);
590 last_jiffy_stamp(smp_processor_id()) = 0;
591
592 mb();
593 sec_tb_reset = 1;
594}
595
596void __init smp_core99_give_timebase(void)
597{
598 unsigned int t;
599
600 /* Primary processor waits for secondary to have frozen
601 * the timebase, resets local TB, and kick timebase again
602 */
603 /* wait for the secondary to have reset its TB before proceeding */
604 for (t = 1000; t > 0 && !sec_tb_reset; --t)
605 udelay(1000);
606 if (t == 0)
607 printk(KERN_WARNING "Timeout waiting sync on second CPU\n");
608
609 set_dec(tb_ticks_per_jiffy);
610 set_tb(0, 0);
611 last_jiffy_stamp(smp_processor_id()) = 0;
612 mb();
613
614 /* Now, restart the timebase by leaving the GPIO to an open collector */
615 pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, core99_tb_gpio, 0);
616 pmac_call_feature(PMAC_FTR_READ_GPIO, NULL, core99_tb_gpio, 0);
617
618 smp_tb_synchronized = 1;
619}
620
621
622/* PowerSurge-style Macs */
623struct smp_ops_t psurge_smp_ops __pmacdata = {
624 .message_pass = smp_psurge_message_pass,
625 .probe = smp_psurge_probe,
626 .kick_cpu = smp_psurge_kick_cpu,
627 .setup_cpu = smp_psurge_setup_cpu,
628 .give_timebase = smp_psurge_give_timebase,
629 .take_timebase = smp_psurge_take_timebase,
630};
631
632/* Core99 Macs (dual G4s) */
633struct smp_ops_t core99_smp_ops __pmacdata = {
634 .message_pass = smp_openpic_message_pass,
635 .probe = smp_core99_probe,
636 .kick_cpu = smp_core99_kick_cpu,
637 .setup_cpu = smp_core99_setup_cpu,
638 .give_timebase = smp_core99_give_timebase,
639 .take_timebase = smp_core99_take_timebase,
640};
diff --git a/arch/ppc/platforms/pmac_time.c b/arch/ppc/platforms/pmac_time.c
new file mode 100644
index 000000000000..09636546f44e
--- /dev/null
+++ b/arch/ppc/platforms/pmac_time.c
@@ -0,0 +1,292 @@
1/*
2 * Support for periodic interrupts (100 per second) and for getting
3 * the current time from the RTC on Power Macintoshes.
4 *
5 * We use the decrementer register for our periodic interrupts.
6 *
7 * Paul Mackerras August 1996.
8 * Copyright (C) 1996 Paul Mackerras.
9 */
10#include <linux/config.h>
11#include <linux/errno.h>
12#include <linux/sched.h>
13#include <linux/kernel.h>
14#include <linux/param.h>
15#include <linux/string.h>
16#include <linux/mm.h>
17#include <linux/init.h>
18#include <linux/time.h>
19#include <linux/adb.h>
20#include <linux/cuda.h>
21#include <linux/pmu.h>
22#include <linux/hardirq.h>
23
24#include <asm/sections.h>
25#include <asm/prom.h>
26#include <asm/system.h>
27#include <asm/io.h>
28#include <asm/pgtable.h>
29#include <asm/machdep.h>
30#include <asm/time.h>
31#include <asm/nvram.h>
32
33/* Apparently the RTC stores seconds since 1 Jan 1904 */
34#define RTC_OFFSET 2082844800
35
36/*
37 * Calibrate the decrementer frequency with the VIA timer 1.
38 */
39#define VIA_TIMER_FREQ_6 4700000 /* time 1 frequency * 6 */
40
41/* VIA registers */
42#define RS 0x200 /* skip between registers */
43#define T1CL (4*RS) /* Timer 1 ctr/latch (low 8 bits) */
44#define T1CH (5*RS) /* Timer 1 counter (high 8 bits) */
45#define T1LL (6*RS) /* Timer 1 latch (low 8 bits) */
46#define T1LH (7*RS) /* Timer 1 latch (high 8 bits) */
47#define ACR (11*RS) /* Auxiliary control register */
48#define IFR (13*RS) /* Interrupt flag register */
49
50/* Bits in ACR */
51#define T1MODE 0xc0 /* Timer 1 mode */
52#define T1MODE_CONT 0x40 /* continuous interrupts */
53
54/* Bits in IFR and IER */
55#define T1_INT 0x40 /* Timer 1 interrupt */
56
57extern struct timezone sys_tz;
58
59long __init
60pmac_time_init(void)
61{
62#ifdef CONFIG_NVRAM
63 s32 delta = 0;
64 int dst;
65
66 delta = ((s32)pmac_xpram_read(PMAC_XPRAM_MACHINE_LOC + 0x9)) << 16;
67 delta |= ((s32)pmac_xpram_read(PMAC_XPRAM_MACHINE_LOC + 0xa)) << 8;
68 delta |= pmac_xpram_read(PMAC_XPRAM_MACHINE_LOC + 0xb);
69 if (delta & 0x00800000UL)
70 delta |= 0xFF000000UL;
71 dst = ((pmac_xpram_read(PMAC_XPRAM_MACHINE_LOC + 0x8) & 0x80) != 0);
72 printk("GMT Delta read from XPRAM: %d minutes, DST: %s\n", delta/60,
73 dst ? "on" : "off");
74 return delta;
75#else
76 return 0;
77#endif
78}
79
80unsigned long __pmac
81pmac_get_rtc_time(void)
82{
83#if defined(CONFIG_ADB_CUDA) || defined(CONFIG_ADB_PMU)
84 struct adb_request req;
85 unsigned long now;
86#endif
87
88 /* Get the time from the RTC */
89 switch (sys_ctrler) {
90#ifdef CONFIG_ADB_CUDA
91 case SYS_CTRLER_CUDA:
92 if (cuda_request(&req, NULL, 2, CUDA_PACKET, CUDA_GET_TIME) < 0)
93 return 0;
94 while (!req.complete)
95 cuda_poll();
96 if (req.reply_len != 7)
97 printk(KERN_ERR "pmac_get_rtc_time: got %d byte reply\n",
98 req.reply_len);
99 now = (req.reply[3] << 24) + (req.reply[4] << 16)
100 + (req.reply[5] << 8) + req.reply[6];
101 return now - RTC_OFFSET;
102#endif /* CONFIG_ADB_CUDA */
103#ifdef CONFIG_ADB_PMU
104 case SYS_CTRLER_PMU:
105 if (pmu_request(&req, NULL, 1, PMU_READ_RTC) < 0)
106 return 0;
107 while (!req.complete)
108 pmu_poll();
109 if (req.reply_len != 4)
110 printk(KERN_ERR "pmac_get_rtc_time: got %d byte reply\n",
111 req.reply_len);
112 now = (req.reply[0] << 24) + (req.reply[1] << 16)
113 + (req.reply[2] << 8) + req.reply[3];
114 return now - RTC_OFFSET;
115#endif /* CONFIG_ADB_PMU */
116 default: ;
117 }
118 return 0;
119}
120
121int __pmac
122pmac_set_rtc_time(unsigned long nowtime)
123{
124#if defined(CONFIG_ADB_CUDA) || defined(CONFIG_ADB_PMU)
125 struct adb_request req;
126#endif
127
128 nowtime += RTC_OFFSET;
129
130 switch (sys_ctrler) {
131#ifdef CONFIG_ADB_CUDA
132 case SYS_CTRLER_CUDA:
133 if (cuda_request(&req, NULL, 6, CUDA_PACKET, CUDA_SET_TIME,
134 nowtime >> 24, nowtime >> 16, nowtime >> 8, nowtime) < 0)
135 return 0;
136 while (!req.complete)
137 cuda_poll();
138 if ((req.reply_len != 3) && (req.reply_len != 7))
139 printk(KERN_ERR "pmac_set_rtc_time: got %d byte reply\n",
140 req.reply_len);
141 return 1;
142#endif /* CONFIG_ADB_CUDA */
143#ifdef CONFIG_ADB_PMU
144 case SYS_CTRLER_PMU:
145 if (pmu_request(&req, NULL, 5, PMU_SET_RTC,
146 nowtime >> 24, nowtime >> 16, nowtime >> 8, nowtime) < 0)
147 return 0;
148 while (!req.complete)
149 pmu_poll();
150 if (req.reply_len != 0)
151 printk(KERN_ERR "pmac_set_rtc_time: got %d byte reply\n",
152 req.reply_len);
153 return 1;
154#endif /* CONFIG_ADB_PMU */
155 default:
156 return 0;
157 }
158}
159
160/*
161 * Calibrate the decrementer register using VIA timer 1.
162 * This is used both on powermacs and CHRP machines.
163 */
164int __init
165via_calibrate_decr(void)
166{
167 struct device_node *vias;
168 volatile unsigned char *via;
169 int count = VIA_TIMER_FREQ_6 / 100;
170 unsigned int dstart, dend;
171
172 vias = find_devices("via-cuda");
173 if (vias == 0)
174 vias = find_devices("via-pmu");
175 if (vias == 0)
176 vias = find_devices("via");
177 if (vias == 0 || vias->n_addrs == 0)
178 return 0;
179 via = (volatile unsigned char *)
180 ioremap(vias->addrs[0].address, vias->addrs[0].size);
181
182 /* set timer 1 for continuous interrupts */
183 out_8(&via[ACR], (via[ACR] & ~T1MODE) | T1MODE_CONT);
184 /* set the counter to a small value */
185 out_8(&via[T1CH], 2);
186 /* set the latch to `count' */
187 out_8(&via[T1LL], count);
188 out_8(&via[T1LH], count >> 8);
189 /* wait until it hits 0 */
190 while ((in_8(&via[IFR]) & T1_INT) == 0)
191 ;
192 dstart = get_dec();
193 /* clear the interrupt & wait until it hits 0 again */
194 in_8(&via[T1CL]);
195 while ((in_8(&via[IFR]) & T1_INT) == 0)
196 ;
197 dend = get_dec();
198
199 tb_ticks_per_jiffy = (dstart - dend) / (6 * (HZ/100));
200 tb_to_us = mulhwu_scale_factor(dstart - dend, 60000);
201
202 printk(KERN_INFO "via_calibrate_decr: ticks per jiffy = %u (%u ticks)\n",
203 tb_ticks_per_jiffy, dstart - dend);
204
205 iounmap((void*)via);
206
207 return 1;
208}
209
210#ifdef CONFIG_PMAC_PBOOK
211/*
212 * Reset the time after a sleep.
213 */
214static int __pmac
215time_sleep_notify(struct pmu_sleep_notifier *self, int when)
216{
217 static unsigned long time_diff;
218 unsigned long flags;
219 unsigned long seq;
220
221 switch (when) {
222 case PBOOK_SLEEP_NOW:
223 do {
224 seq = read_seqbegin_irqsave(&xtime_lock, flags);
225 time_diff = xtime.tv_sec - pmac_get_rtc_time();
226 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
227 break;
228 case PBOOK_WAKE:
229 write_seqlock_irqsave(&xtime_lock, flags);
230 xtime.tv_sec = pmac_get_rtc_time() + time_diff;
231 xtime.tv_nsec = 0;
232 last_rtc_update = xtime.tv_sec;
233 write_sequnlock_irqrestore(&xtime_lock, flags);
234 break;
235 }
236 return PBOOK_SLEEP_OK;
237}
238
239static struct pmu_sleep_notifier time_sleep_notifier __pmacdata = {
240 time_sleep_notify, SLEEP_LEVEL_MISC,
241};
242#endif /* CONFIG_PMAC_PBOOK */
243
244/*
245 * Query the OF and get the decr frequency.
246 * This was taken from the pmac time_init() when merging the prep/pmac
247 * time functions.
248 */
249void __init
250pmac_calibrate_decr(void)
251{
252 struct device_node *cpu;
253 unsigned int freq, *fp;
254
255#ifdef CONFIG_PMAC_PBOOK
256 pmu_register_sleep_notifier(&time_sleep_notifier);
257#endif /* CONFIG_PMAC_PBOOK */
258
259 /* We assume MacRISC2 machines have correct device-tree
260 * calibration. That's better since the VIA itself seems
261 * to be slightly off. --BenH
262 */
263 if (!machine_is_compatible("MacRISC2") &&
264 !machine_is_compatible("MacRISC3") &&
265 !machine_is_compatible("MacRISC4"))
266 if (via_calibrate_decr())
267 return;
268
269 /* Special case: QuickSilver G4s seem to have a badly calibrated
270 * timebase-frequency in OF, VIA is much better on these. We should
271 * probably implement calibration based on the KL timer on these
272 * machines anyway... -BenH
273 */
274 if (machine_is_compatible("PowerMac3,5"))
275 if (via_calibrate_decr())
276 return;
277 /*
278 * The cpu node should have a timebase-frequency property
279 * to tell us the rate at which the decrementer counts.
280 */
281 cpu = find_type_devices("cpu");
282 if (cpu == 0)
283 panic("can't find cpu node in time_init");
284 fp = (unsigned int *) get_property(cpu, "timebase-frequency", NULL);
285 if (fp == 0)
286 panic("can't get cpu timebase frequency");
287 freq = *fp;
288 printk("time_init: decrementer frequency = %u.%.6u MHz\n",
289 freq/1000000, freq%1000000);
290 tb_ticks_per_jiffy = freq / HZ;
291 tb_to_us = mulhwu_scale_factor(freq, 1000000);
292}
diff --git a/arch/ppc/platforms/powerpmc250.c b/arch/ppc/platforms/powerpmc250.c
new file mode 100644
index 000000000000..0abe15159e6c
--- /dev/null
+++ b/arch/ppc/platforms/powerpmc250.c
@@ -0,0 +1,383 @@
1/*
2 * arch/ppc/platforms/powerpmc250.c
3 *
4 * Board setup routines for Force PowerPMC-250 Processor PMC
5 *
6 * Author: Troy Benjegerdes <tbenjegerdes@mvista.com>
7 * Borrowed heavily from prpmc750_*.c by
8 * Matt Porter <mporter@mvista.com>
9 *
10 * 2001 (c) MontaVista, Software, Inc. This file is licensed under
11 * the terms of the GNU General Public License version 2. This program
12 * is licensed "as is" without any warranty of any kind, whether express
13 * or implied.
14 */
15
16#include <linux/config.h>
17#include <linux/stddef.h>
18#include <linux/kernel.h>
19#include <linux/init.h>
20#include <linux/errno.h>
21#include <linux/reboot.h>
22#include <linux/pci.h>
23#include <linux/kdev_t.h>
24#include <linux/types.h>
25#include <linux/major.h>
26#include <linux/initrd.h>
27#include <linux/console.h>
28#include <linux/delay.h>
29#include <linux/irq.h>
30#include <linux/slab.h>
31#include <linux/seq_file.h>
32#include <linux/ide.h>
33#include <linux/root_dev.h>
34
35#include <asm/byteorder.h>
36#include <asm/system.h>
37#include <asm/pgtable.h>
38#include <asm/page.h>
39#include <asm/dma.h>
40#include <asm/io.h>
41#include <asm/irq.h>
42#include <asm/machdep.h>
43#include <asm/time.h>
44#include <platforms/powerpmc250.h>
45#include <asm/open_pic.h>
46#include <asm/pci-bridge.h>
47#include <asm/mpc10x.h>
48#include <asm/uaccess.h>
49#include <asm/bootinfo.h>
50
51extern void powerpmc250_find_bridges(void);
52extern unsigned long loops_per_jiffy;
53
54static u_char powerpmc250_openpic_initsenses[] __initdata =
55{
56 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
57 1, /* PMC INTA (also MPC107 output interrupt INTA) */
58 1, /* PMC INTB (also I82559 Ethernet controller) */
59 1, /* PMC INTC */
60 1, /* PMC INTD */
61 0, /* DUART interrupt (active high) */
62};
63
64static int
65powerpmc250_show_cpuinfo(struct seq_file *m)
66{
67 seq_printf(m,"machine\t\t: Force PowerPMC250\n");
68
69 return 0;
70}
71
72static void __init
73powerpmc250_setup_arch(void)
74{
75 /* init to some ~sane value until calibrate_delay() runs */
76 loops_per_jiffy = 50000000/HZ;
77
78 /* Lookup PCI host bridges */
79 powerpmc250_find_bridges();
80
81#ifdef CONFIG_BLK_DEV_INITRD
82 if (initrd_start)
83 ROOT_DEV = Root_RAM0;
84 else
85#endif
86#ifdef CONFIG_ROOT_NFS
87 ROOT_DEV = Root_NFS;
88#else
89 ROOT_DEV = Root_SDA2;
90#endif
91
92 printk("Force PowerPMC250 port (C) 2001 MontaVista Software, Inc. (source@mvista.com)\n");
93}
94
95#if 0
96/*
97 * Compute the PrPMC750's bus speed using the baud clock as a
98 * reference.
99 */
100unsigned long __init powerpmc250_get_bus_speed(void)
101{
102 unsigned long tbl_start, tbl_end;
103 unsigned long current_state, old_state, bus_speed;
104 unsigned char lcr, dll, dlm;
105 int baud_divisor, count;
106
107 /* Read the UART's baud clock divisor */
108 lcr = readb(PRPMC750_SERIAL_0_LCR);
109 writeb(lcr | UART_LCR_DLAB, PRPMC750_SERIAL_0_LCR);
110 dll = readb(PRPMC750_SERIAL_0_DLL);
111 dlm = readb(PRPMC750_SERIAL_0_DLM);
112 writeb(lcr & ~UART_LCR_DLAB, PRPMC750_SERIAL_0_LCR);
113 baud_divisor = (dlm << 8) | dll;
114
115 /*
116 * Use the baud clock divisor and base baud clock
117 * to determine the baud rate and use that as
118 * the number of baud clock edges we use for
119 * the time base sample. Make it half the baud
120 * rate.
121 */
122 count = PRPMC750_BASE_BAUD / (baud_divisor * 16);
123
124 /* Find the first edge of the baud clock */
125 old_state = readb(PRPMC750_STATUS_REG) & PRPMC750_BAUDOUT_MASK;
126 do {
127 current_state = readb(PRPMC750_STATUS_REG) &
128 PRPMC750_BAUDOUT_MASK;
129 } while(old_state == current_state);
130
131 old_state = current_state;
132
133 /* Get the starting time base value */
134 tbl_start = get_tbl();
135
136 /*
137 * Loop until we have found a number of edges equal
138 * to half the count (half the baud rate)
139 */
140 do {
141 do {
142 current_state = readb(PRPMC750_STATUS_REG) &
143 PRPMC750_BAUDOUT_MASK;
144 } while(old_state == current_state);
145 old_state = current_state;
146 } while (--count);
147
148 /* Get the ending time base value */
149 tbl_end = get_tbl();
150
151 /* Compute bus speed */
152 bus_speed = (tbl_end-tbl_start)*128;
153
154 return bus_speed;
155}
156#endif
157
158static void __init
159powerpmc250_calibrate_decr(void)
160{
161 unsigned long freq;
162 int divisor = 4;
163
164 //freq = powerpmc250_get_bus_speed();
165#warning hardcoded bus freq
166 freq = 100000000;
167
168 tb_ticks_per_jiffy = freq / (HZ * divisor);
169 tb_to_us = mulhwu_scale_factor(freq/divisor, 1000000);
170}
171
172static void
173powerpmc250_restart(char *cmd)
174{
175 local_irq_disable();
176 /* Hard reset */
177 writeb(0x11, 0xfe000332);
178 while(1);
179}
180
181static void
182powerpmc250_halt(void)
183{
184 local_irq_disable();
185 while (1);
186}
187
188static void
189powerpmc250_power_off(void)
190{
191 powerpmc250_halt();
192}
193
194static void __init
195powerpmc250_init_IRQ(void)
196{
197
198 OpenPIC_InitSenses = powerpmc250_openpic_initsenses;
199 OpenPIC_NumInitSenses = sizeof(powerpmc250_openpic_initsenses);
200 mpc10x_set_openpic();
201}
202
203/*
204 * Set BAT 3 to map 0xf0000000 to end of physical memory space.
205 */
206static __inline__ void
207powerpmc250_set_bat(void)
208{
209 unsigned long bat3u, bat3l;
210 static int mapping_set = 0;
211
212 if (!mapping_set)
213 {
214 __asm__ __volatile__(
215 " lis %0,0xf000\n \
216 ori %1,%0,0x002a\n \
217 ori %0,%0,0x1ffe\n \
218 mtspr 0x21e,%0\n \
219 mtspr 0x21f,%1\n \
220 isync\n \
221 sync "
222 : "=r" (bat3u), "=r" (bat3l));
223
224 mapping_set = 1;
225 }
226 return;
227}
228
229static unsigned long __init
230powerpmc250_find_end_of_memory(void)
231{
232 /* Cover I/O space with a BAT */
233 /* yuck, better hope your ram size is a power of 2 -- paulus */
234 powerpmc250_set_bat();
235
236 return mpc10x_get_mem_size(MPC10X_MEM_MAP_B);
237}
238
239static void __init
240powerpmc250_map_io(void)
241{
242 io_block_mapping(0xfe000000, 0xfe000000, 0x02000000, _PAGE_IO);
243}
244
245void __init
246platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
247 unsigned long r6, unsigned long r7)
248{
249 parse_bootinfo(find_bootinfo());
250
251#ifdef CONFIG_BLK_DEV_INITRD
252 if ( r4 )
253 {
254 initrd_start = r4 + KERNELBASE;
255 initrd_end = r5 + KERNELBASE;
256 }
257#endif
258
259 /* Copy cmd_line parameters */
260 if ( r6)
261 {
262 *(char *)(r7 + KERNELBASE) = 0;
263 strcpy(cmd_line, (char *)(r6 + KERNELBASE));
264 }
265
266 isa_io_base = MPC10X_MAPB_ISA_IO_BASE;
267 isa_mem_base = MPC10X_MAPB_ISA_MEM_BASE;
268 pci_dram_offset = MPC10X_MAPB_DRAM_OFFSET;
269
270 ppc_md.setup_arch = powerpmc250_setup_arch;
271 ppc_md.show_cpuinfo = powerpmc250_show_cpuinfo;
272 ppc_md.init_IRQ = powerpmc250_init_IRQ;
273 ppc_md.get_irq = openpic_get_irq;
274
275 ppc_md.find_end_of_memory = powerpmc250_find_end_of_memory;
276 ppc_md.setup_io_mappings = powerpmc250_map_io;
277
278 ppc_md.restart = powerpmc250_restart;
279 ppc_md.power_off = powerpmc250_power_off;
280 ppc_md.halt = powerpmc250_halt;
281
282 /* PowerPMC250 has no timekeeper part */
283 ppc_md.time_init = NULL;
284 ppc_md.get_rtc_time = NULL;
285 ppc_md.set_rtc_time = NULL;
286 ppc_md.calibrate_decr = powerpmc250_calibrate_decr;
287}
288
289
290/*
291 * (This used to be arch/ppc/platforms/powerpmc250_pci.c)
292 *
293 * PCI support for Force PowerPMC250
294 *
295 */
296
297#undef DEBUG
298#ifdef DEBUG
299#define DBG(x...) printk(x)
300#else
301#define DBG(x...)
302#endif /* DEBUG */
303
304static inline int __init
305powerpmc250_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
306{
307 static char pci_irq_table[][4] =
308 /*
309 * PCI IDSEL/INTPIN->INTLINE
310 * A B C D
311 */
312 {
313 {17, 0, 0, 0}, /* Device 11 - 82559 */
314 {0, 0, 0, 0}, /* 12 */
315 {0, 0, 0, 0}, /* 13 */
316 {0, 0, 0, 0}, /* 14 */
317 {0, 0, 0, 0}, /* 15 */
318 {16, 17, 18, 19}, /* Device 16 - PMC A1?? */
319 };
320 const long min_idsel = 11, max_idsel = 16, irqs_per_slot = 4;
321 return PCI_IRQ_TABLE_LOOKUP;
322};
323
324static int
325powerpmc250_exclude_device(u_char bus, u_char devfn)
326{
327 /*
328 * While doing PCI Scan the MPC107 will 'detect' itself as
329 * device on the PCI Bus, will create an incorrect response and
330 * later will respond incorrectly to Configuration read coming
331 * from another device.
332 *
333 * The work around is that when doing a PCI Scan one
334 * should skip its own device number in the scan.
335 *
336 * The top IDsel is AD13 and the middle is AD14.
337 *
338 * -- Note from force
339 */
340
341 if ((bus == 0) && (PCI_SLOT(devfn) == 13 || PCI_SLOT(devfn) == 14)) {
342 return PCIBIOS_DEVICE_NOT_FOUND;
343 }
344 else {
345 return PCIBIOS_SUCCESSFUL;
346 }
347}
348
349void __init
350powerpmc250_find_bridges(void)
351{
352 struct pci_controller* hose;
353
354 hose = pcibios_alloc_controller();
355 if (!hose){
356 printk("Can't allocate PCI 'hose' structure!!!\n");
357 return;
358 }
359
360 hose->first_busno = 0;
361 hose->last_busno = 0xff;
362
363 if (mpc10x_bridge_init(hose,
364 MPC10X_MEM_MAP_B,
365 MPC10X_MEM_MAP_B,
366 MPC10X_MAPB_EUMB_BASE) == 0) {
367
368 hose->mem_resources[0].end = 0xffffffff;
369
370 hose->last_busno = pciauto_bus_scan(hose, hose->first_busno);
371
372 /* ppc_md.pcibios_fixup = pcore_pcibios_fixup; */
373 ppc_md.pci_swizzle = common_swizzle;
374
375 ppc_md.pci_exclude_device = powerpmc250_exclude_device;
376 ppc_md.pci_map_irq = powerpmc250_map_irq;
377 } else {
378 if (ppc_md.progress)
379 ppc_md.progress("Bridge init failed", 0x100);
380 printk("Host bridge init failed\n");
381 }
382
383}
diff --git a/arch/ppc/platforms/powerpmc250.h b/arch/ppc/platforms/powerpmc250.h
new file mode 100644
index 000000000000..41a6dc881911
--- /dev/null
+++ b/arch/ppc/platforms/powerpmc250.h
@@ -0,0 +1,52 @@
1/*
2 * include/asm-ppc/platforms/powerpmc250.h
3 *
4 * Definitions for Force PowerPMC-250 board support
5 *
6 * Author: Troy Benjegerdes <tbenjegerdes@mvista.com>
7 *
8 * Borrowed heavily from prpmc750.h by Matt Porter <mporter@mvista.com>
9 *
10 * 2001-2004 (c) MontaVista, Software, Inc. This file is licensed under
11 * the terms of the GNU General Public License version 2. This program
12 * is licensed "as is" without any warranty of any kind, whether express
13 * or implied.
14 */
15
16#ifndef __ASMPPC_POWERPMC250_H
17#define __ASMPPC_POWERPMC250_H
18
19#define POWERPMC250_PCI_CONFIG_ADDR 0x80000cf8
20#define POWERPMC250_PCI_CONFIG_DATA 0x80000cfc
21
22#define POWERPMC250_PCI_PHY_MEM_BASE 0xc0000000
23#define POWERPMC250_PCI_MEM_BASE 0xf0000000
24#define POWERPMC250_PCI_IO_BASE 0x80000000
25
26#define POWERPMC250_ISA_IO_BASE POWERPMC250_PCI_IO_BASE
27#define POWERPMC250_ISA_MEM_BASE POWERPMC250_PCI_MEM_BASE
28#define POWERPMC250_PCI_MEM_OFFSET POWERPMC250_PCI_PHY_MEM_BASE
29
30#define POWERPMC250_SYS_MEM_BASE 0x80000000
31
32#define POWERPMC250_HAWK_SMC_BASE 0xfef80000
33
34#define POWERPMC250_BASE_BAUD 12288000
35#define POWERPMC250_SERIAL 0xff000000
36#define POWERPMC250_SERIAL_IRQ 20
37
38/* UART Defines. */
39#define RS_TABLE_SIZE 1
40
41#define BASE_BAUD (POWERPMC250_BASE_BAUD / 16)
42
43#define STD_COM_FLAGS ASYNC_BOOT_AUTOCONF
44
45#define SERIAL_PORT_DFNS \
46 { 0, BASE_BAUD, POWERPMC250_SERIAL, POWERPMC250_SERIAL_IRQ, \
47 STD_COM_FLAGS, /* ttyS0 */ \
48 iomem_base: (u8 *)POWERPMC250_SERIAL, \
49 iomem_reg_shift: 0, \
50 io_type: SERIAL_IO_MEM }
51
52#endif /* __ASMPPC_POWERPMC250_H */
diff --git a/arch/ppc/platforms/pplus.c b/arch/ppc/platforms/pplus.c
new file mode 100644
index 000000000000..65705c911795
--- /dev/null
+++ b/arch/ppc/platforms/pplus.c
@@ -0,0 +1,917 @@
1/*
2 * arch/ppc/platforms/pplus.c
3 *
4 * Board and PCI setup routines for MCG PowerPlus
5 *
6 * Author: Randy Vinson <rvinson@mvista.com>
7 *
8 * Derived from original PowerPlus PReP work by
9 * Cort Dougan, Johnnie Peters, Matt Porter, and
10 * Troy Benjegerdes.
11 *
12 * 2001-2004 (c) MontaVista, Software, Inc. This file is licensed under
13 * the terms of the GNU General Public License version 2. This program
14 * is licensed "as is" without any warranty of any kind, whether express
15 * or implied.
16 */
17
18#include <linux/config.h>
19#include <linux/kernel.h>
20#include <linux/interrupt.h>
21#include <linux/init.h>
22#include <linux/ioport.h>
23#include <linux/console.h>
24#include <linux/pci.h>
25#include <linux/irq.h>
26#include <linux/ide.h>
27#include <linux/seq_file.h>
28#include <linux/root_dev.h>
29
30#include <asm/system.h>
31#include <asm/io.h>
32#include <asm/pgtable.h>
33#include <asm/dma.h>
34#include <asm/machdep.h>
35#include <asm/prep_nvram.h>
36#include <asm/vga.h>
37#include <asm/i8259.h>
38#include <asm/open_pic.h>
39#include <asm/hawk.h>
40#include <asm/todc.h>
41#include <asm/bootinfo.h>
42#include <asm/kgdb.h>
43#include <asm/reg.h>
44
45#include "pplus.h"
46
47#undef DUMP_DBATS
48
49TODC_ALLOC();
50
51extern void pplus_setup_hose(void);
52extern void pplus_set_VIA_IDE_native(void);
53
54extern unsigned long loops_per_jiffy;
55unsigned char *Motherboard_map_name;
56
57/* Tables for known hardware */
58
59/* Motorola Mesquite */
60static inline int
61mesquite_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
62{
63 static char pci_irq_table[][4] =
64 /*
65 * MPIC interrupts for various IDSEL values (MPIC IRQ0 =
66 * Linux IRQ16 (to leave room for ISA IRQs at 0-15).
67 * PCI IDSEL/INTPIN->INTLINE
68 * A B C D
69 */
70 {
71 {18, 0, 0, 0}, /* IDSEL 14 - Enet 0 */
72 { 0, 0, 0, 0}, /* IDSEL 15 - unused */
73 {19, 19, 19, 19}, /* IDSEL 16 - PMC Slot 1 */
74 { 0, 0, 0, 0}, /* IDSEL 17 - unused */
75 { 0, 0, 0, 0}, /* IDSEL 18 - unused */
76 { 0, 0, 0, 0}, /* IDSEL 19 - unused */
77 {24, 25, 26, 27}, /* IDSEL 20 - P2P bridge (to cPCI 1) */
78 { 0, 0, 0, 0}, /* IDSEL 21 - unused */
79 {28, 29, 30, 31} /* IDSEL 22 - P2P bridge (to cPCI 2) */
80 };
81
82 const long min_idsel = 14, max_idsel = 22, irqs_per_slot = 4;
83 return PCI_IRQ_TABLE_LOOKUP;
84}
85
86/* Motorola Sitka */
87static inline int
88sitka_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
89{
90 static char pci_irq_table[][4] =
91 /*
92 * MPIC interrupts for various IDSEL values (MPIC IRQ0 =
93 * Linux IRQ16 (to leave room for ISA IRQs at 0-15).
94 * PCI IDSEL/INTPIN->INTLINE
95 * A B C D
96 */
97 {
98 {18, 0, 0, 0}, /* IDSEL 14 - Enet 0 */
99 { 0, 0, 0, 0}, /* IDSEL 15 - unused */
100 {25, 26, 27, 28}, /* IDSEL 16 - PMC Slot 1 */
101 {28, 25, 26, 27}, /* IDSEL 17 - PMC Slot 2 */
102 { 0, 0, 0, 0}, /* IDSEL 18 - unused */
103 { 0, 0, 0, 0}, /* IDSEL 19 - unused */
104 {20, 0, 0, 0} /* IDSEL 20 - P2P bridge (to cPCI) */
105 };
106
107 const long min_idsel = 14, max_idsel = 20, irqs_per_slot = 4;
108 return PCI_IRQ_TABLE_LOOKUP;
109}
110
111/* Motorola MTX */
112static inline int
113MTX_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
114{
115 static char pci_irq_table[][4] =
116 /*
117 * MPIC interrupts for various IDSEL values (MPIC IRQ0 =
118 * Linux IRQ16 (to leave room for ISA IRQs at 0-15).
119 * PCI IDSEL/INTPIN->INTLINE
120 * A B C D
121 */
122 {
123 {19, 0, 0, 0}, /* IDSEL 12 - SCSI */
124 { 0, 0, 0, 0}, /* IDSEL 13 - unused */
125 {18, 0, 0, 0}, /* IDSEL 14 - Enet */
126 { 0, 0, 0, 0}, /* IDSEL 15 - unused */
127 {25, 26, 27, 28}, /* IDSEL 16 - PMC Slot 1 */
128 {26, 27, 28, 25}, /* IDSEL 17 - PMC Slot 2 */
129 {27, 28, 25, 26} /* IDSEL 18 - PCI Slot 3 */
130 };
131
132 const long min_idsel = 12, max_idsel = 18, irqs_per_slot = 4;
133 return PCI_IRQ_TABLE_LOOKUP;
134}
135
136/* Motorola MTX Plus */
137/* Secondary bus interrupt routing is not supported yet */
138static inline int
139MTXplus_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
140{
141 static char pci_irq_table[][4] =
142 /*
143 * MPIC interrupts for various IDSEL values (MPIC IRQ0 =
144 * Linux IRQ16 (to leave room for ISA IRQs at 0-15).
145 * PCI IDSEL/INTPIN->INTLINE
146 * A B C D
147 */
148 {
149 {19, 0, 0, 0}, /* IDSEL 12 - SCSI */
150 { 0, 0, 0, 0}, /* IDSEL 13 - unused */
151 {18, 0, 0, 0}, /* IDSEL 14 - Enet 1 */
152 { 0, 0, 0, 0}, /* IDSEL 15 - unused */
153 {25, 26, 27, 28}, /* IDSEL 16 - PCI Slot 1P */
154 {26, 27, 28, 25}, /* IDSEL 17 - PCI Slot 2P */
155 {27, 28, 25, 26}, /* IDSEL 18 - PCI Slot 3P */
156 {26, 0, 0, 0}, /* IDSEL 19 - Enet 2 */
157 { 0, 0, 0, 0} /* IDSEL 20 - P2P Bridge */
158 };
159
160 const long min_idsel = 12, max_idsel = 20, irqs_per_slot = 4;
161 return PCI_IRQ_TABLE_LOOKUP;
162}
163
164static inline int
165Genesis2_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
166{
167 /* 2600
168 * Raven 31
169 * ISA 11
170 * SCSI 12 - IRQ3
171 * Univ 13
172 * eth 14 - IRQ2
173 * VGA 15 - IRQ4
174 * PMC1 16 - IRQ9,10,11,12 = PMC1 A-D
175 * PMC2 17 - IRQ12,9,10,11 = A-D
176 * SCSI2 18 - IRQ11
177 * eth2 19 - IRQ10
178 * PCIX 20 - IRQ9,10,11,12 = PCI A-D
179 */
180
181 /* 2400
182 * Hawk 31
183 * ISA 11
184 * Univ 13
185 * eth 14 - IRQ2
186 * PMC1 16 - IRQ9,10,11,12 = PMC A-D
187 * PMC2 17 - IRQ12,9,10,11 = PMC A-D
188 * PCIX 20 - IRQ9,10,11,12 = PMC A-D
189 */
190
191 /* 2300
192 * Raven 31
193 * ISA 11
194 * Univ 13
195 * eth 14 - IRQ2
196 * PMC1 16 - 9,10,11,12 = A-D
197 * PMC2 17 - 9,10,11,12 = B,C,D,A
198 */
199
200 static char pci_irq_table[][4] =
201 /*
202 * MPIC interrupts for various IDSEL values (MPIC IRQ0 =
203 * Linux IRQ16 (to leave room for ISA IRQs at 0-15).
204 * PCI IDSEL/INTPIN->INTLINE
205 * A B C D
206 */
207 {
208 {19, 0, 0, 0}, /* IDSEL 12 - SCSI */
209 { 0, 0, 0, 0}, /* IDSEL 13 - Universe PCI - VME */
210 {18, 0, 0, 0}, /* IDSEL 14 - Enet 1 */
211 { 0, 0, 0, 0}, /* IDSEL 15 - unused */
212 {25, 26, 27, 28}, /* IDSEL 16 - PCI/PMC Slot 1P */
213 {28, 25, 26, 27}, /* IDSEL 17 - PCI/PMC Slot 2P */
214 {27, 28, 25, 26}, /* IDSEL 18 - PCI Slot 3P */
215 {26, 0, 0, 0}, /* IDSEL 19 - Enet 2 */
216 {25, 26, 27, 28} /* IDSEL 20 - P2P Bridge */
217 };
218
219 const long min_idsel = 12, max_idsel = 20, irqs_per_slot = 4;
220 return PCI_IRQ_TABLE_LOOKUP;
221}
222
223#define MOTOROLA_CPUTYPE_REG 0x800
224#define MOTOROLA_BASETYPE_REG 0x803
225#define MPIC_RAVEN_ID 0x48010000
226#define MPIC_HAWK_ID 0x48030000
227#define MOT_PROC2_BIT 0x800
228
229static u_char pplus_openpic_initsenses[] __initdata = {
230 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* MVME2600_INT_SIO */
231 (IRQ_SENSE_EDGE | IRQ_POLARITY_NEGATIVE),/*MVME2600_INT_FALCN_ECC_ERR */
232 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/*MVME2600_INT_PCI_ETHERNET */
233 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* MVME2600_INT_PCI_SCSI */
234 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/*MVME2600_INT_PCI_GRAPHICS */
235 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* MVME2600_INT_PCI_VME0 */
236 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* MVME2600_INT_PCI_VME1 */
237 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* MVME2600_INT_PCI_VME2 */
238 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* MVME2600_INT_PCI_VME3 */
239 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* MVME2600_INT_PCI_INTA */
240 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* MVME2600_INT_PCI_INTB */
241 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* MVME2600_INT_PCI_INTC */
242 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* MVME2600_INT_PCI_INTD */
243 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* MVME2600_INT_LM_SIG0 */
244 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* MVME2600_INT_LM_SIG1 */
245 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),
246};
247
248int mot_entry = -1;
249int prep_keybd_present = 1;
250int mot_multi = 0;
251
252struct brd_info {
253 /* 0x100 mask assumes for Raven and Hawk boards that the level/edge
254 * are set */
255 int cpu_type;
256 /* 0x200 if this board has a Hawk chip. */
257 int base_type;
258 /* or'ed with 0x80 if this board should be checked for multi CPU */
259 int max_cpu;
260 const char *name;
261 int (*map_irq) (struct pci_dev *, unsigned char, unsigned char);
262};
263struct brd_info mot_info[] = {
264 {0x300, 0x00, 0x00, "MVME 2400", Genesis2_map_irq},
265 {0x1E0, 0xE0, 0x00, "Mesquite cPCI (MCP750)", mesquite_map_irq},
266 {0x1E0, 0xE1, 0x00, "Sitka cPCI (MCPN750)", sitka_map_irq},
267 {0x1E0, 0xE2, 0x00, "Mesquite cPCI (MCP750) w/ HAC", mesquite_map_irq},
268 {0x1E0, 0xF6, 0x80, "MTX Plus", MTXplus_map_irq},
269 {0x1E0, 0xF6, 0x81, "Dual MTX Plus", MTXplus_map_irq},
270 {0x1E0, 0xF7, 0x80, "MTX wo/ Parallel Port", MTX_map_irq},
271 {0x1E0, 0xF7, 0x81, "Dual MTX wo/ Parallel Port", MTX_map_irq},
272 {0x1E0, 0xF8, 0x80, "MTX w/ Parallel Port", MTX_map_irq},
273 {0x1E0, 0xF8, 0x81, "Dual MTX w/ Parallel Port", MTX_map_irq},
274 {0x1E0, 0xF9, 0x00, "MVME 2300", Genesis2_map_irq},
275 {0x1E0, 0xFA, 0x00, "MVME 2300SC/2600", Genesis2_map_irq},
276 {0x1E0, 0xFB, 0x00, "MVME 2600 with MVME712M", Genesis2_map_irq},
277 {0x1E0, 0xFC, 0x00, "MVME 2600/2700 with MVME761", Genesis2_map_irq},
278 {0x1E0, 0xFD, 0x80, "MVME 3600 with MVME712M", Genesis2_map_irq},
279 {0x1E0, 0xFD, 0x81, "MVME 4600 with MVME712M", Genesis2_map_irq},
280 {0x1E0, 0xFE, 0x80, "MVME 3600 with MVME761", Genesis2_map_irq},
281 {0x1E0, 0xFE, 0x81, "MVME 4600 with MVME761", Genesis2_map_irq},
282 {0x000, 0x00, 0x00, "", NULL}
283};
284
285void __init pplus_set_board_type(void)
286{
287 unsigned char cpu_type;
288 unsigned char base_mod;
289 int entry;
290 unsigned short devid;
291 unsigned long *ProcInfo = NULL;
292
293 cpu_type = inb(MOTOROLA_CPUTYPE_REG) & 0xF0;
294 base_mod = inb(MOTOROLA_BASETYPE_REG);
295 early_read_config_word(0, 0, 0, PCI_VENDOR_ID, &devid);
296
297 for (entry = 0; mot_info[entry].cpu_type != 0; entry++) {
298 /* Check for Hawk chip */
299 if (mot_info[entry].cpu_type & 0x200) {
300 if (devid != PCI_DEVICE_ID_MOTOROLA_HAWK)
301 continue;
302 } else {
303 /* store the system config register for later use. */
304 ProcInfo =
305 (unsigned long *)ioremap(PPLUS_SYS_CONFIG_REG, 4);
306
307 /* Check non hawk boards */
308 if ((mot_info[entry].cpu_type & 0xff) != cpu_type)
309 continue;
310
311 if (mot_info[entry].base_type == 0) {
312 mot_entry = entry;
313 break;
314 }
315
316 if (mot_info[entry].base_type != base_mod)
317 continue;
318 }
319
320 if (!(mot_info[entry].max_cpu & 0x80)) {
321 mot_entry = entry;
322 break;
323 }
324
325 /* processor 1 not present and max processor zero indicated */
326 if ((*ProcInfo & MOT_PROC2_BIT)
327 && !(mot_info[entry].max_cpu & 0x7f)) {
328 mot_entry = entry;
329 break;
330 }
331
332 /* processor 1 present and max processor zero indicated */
333 if (!(*ProcInfo & MOT_PROC2_BIT)
334 && (mot_info[entry].max_cpu & 0x7f)) {
335 mot_entry = entry;
336 break;
337 }
338
339 /* Indicate to system if this is a multiprocessor board */
340 if (!(*ProcInfo & MOT_PROC2_BIT))
341 mot_multi = 1;
342 }
343
344 if (mot_entry == -1)
345 /* No particular cpu type found - assume Mesquite (MCP750) */
346 mot_entry = 1;
347
348 Motherboard_map_name = (unsigned char *)mot_info[mot_entry].name;
349 ppc_md.pci_map_irq = mot_info[mot_entry].map_irq;
350}
351void __init pplus_pib_init(void)
352{
353 unsigned char reg;
354 unsigned short short_reg;
355
356 struct pci_dev *dev = NULL;
357
358 /*
359 * Perform specific configuration for the Via Tech or
360 * or Winbond PCI-ISA-Bridge part.
361 */
362 if ((dev = pci_get_device(PCI_VENDOR_ID_VIA,
363 PCI_DEVICE_ID_VIA_82C586_1, dev))) {
364 /*
365 * PPCBUG does not set the enable bits
366 * for the IDE device. Force them on here.
367 */
368 pci_read_config_byte(dev, 0x40, &reg);
369
370 reg |= 0x03; /* IDE: Chip Enable Bits */
371 pci_write_config_byte(dev, 0x40, reg);
372 }
373
374 if ((dev = pci_get_device(PCI_VENDOR_ID_VIA,
375 PCI_DEVICE_ID_VIA_82C586_2,
376 dev)) && (dev->devfn = 0x5a)) {
377 /* Force correct USB interrupt */
378 dev->irq = 11;
379 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
380 }
381
382 if ((dev = pci_get_device(PCI_VENDOR_ID_WINBOND,
383 PCI_DEVICE_ID_WINBOND_83C553, dev))) {
384 /* Clear PCI Interrupt Routing Control Register. */
385 short_reg = 0x0000;
386 pci_write_config_word(dev, 0x44, short_reg);
387 /* Route IDE interrupts to IRQ 14 */
388 reg = 0xEE;
389 pci_write_config_byte(dev, 0x43, reg);
390 }
391
392 if ((dev = pci_get_device(PCI_VENDOR_ID_WINBOND,
393 PCI_DEVICE_ID_WINBOND_82C105, dev))) {
394 /*
395 * Disable LEGIRQ mode so PCI INTS are routed
396 * directly to the 8259 and enable both channels
397 */
398 pci_write_config_dword(dev, 0x40, 0x10ff0033);
399
400 /* Force correct IDE interrupt */
401 dev->irq = 14;
402 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
403 }
404 pci_dev_put(dev);
405}
406
407void __init pplus_set_VIA_IDE_legacy(void)
408{
409 unsigned short vend, dev;
410
411 early_read_config_word(0, 0, PCI_DEVFN(0xb, 1), PCI_VENDOR_ID, &vend);
412 early_read_config_word(0, 0, PCI_DEVFN(0xb, 1), PCI_DEVICE_ID, &dev);
413
414 if ((vend == PCI_VENDOR_ID_VIA) &&
415 (dev == PCI_DEVICE_ID_VIA_82C586_1)) {
416 unsigned char temp;
417
418 /* put back original "standard" port base addresses */
419 early_write_config_dword(0, 0, PCI_DEVFN(0xb, 1),
420 PCI_BASE_ADDRESS_0, 0x1f1);
421 early_write_config_dword(0, 0, PCI_DEVFN(0xb, 1),
422 PCI_BASE_ADDRESS_1, 0x3f5);
423 early_write_config_dword(0, 0, PCI_DEVFN(0xb, 1),
424 PCI_BASE_ADDRESS_2, 0x171);
425 early_write_config_dword(0, 0, PCI_DEVFN(0xb, 1),
426 PCI_BASE_ADDRESS_3, 0x375);
427 early_write_config_dword(0, 0, PCI_DEVFN(0xb, 1),
428 PCI_BASE_ADDRESS_4, 0xcc01);
429
430 /* put into legacy mode */
431 early_read_config_byte(0, 0, PCI_DEVFN(0xb, 1), PCI_CLASS_PROG,
432 &temp);
433 temp &= ~0x05;
434 early_write_config_byte(0, 0, PCI_DEVFN(0xb, 1), PCI_CLASS_PROG,
435 temp);
436 }
437}
438
439void pplus_set_VIA_IDE_native(void)
440{
441 unsigned short vend, dev;
442
443 early_read_config_word(0, 0, PCI_DEVFN(0xb, 1), PCI_VENDOR_ID, &vend);
444 early_read_config_word(0, 0, PCI_DEVFN(0xb, 1), PCI_DEVICE_ID, &dev);
445
446 if ((vend == PCI_VENDOR_ID_VIA) &&
447 (dev == PCI_DEVICE_ID_VIA_82C586_1)) {
448 unsigned char temp;
449
450 /* put into native mode */
451 early_read_config_byte(0, 0, PCI_DEVFN(0xb, 1), PCI_CLASS_PROG,
452 &temp);
453 temp |= 0x05;
454 early_write_config_byte(0, 0, PCI_DEVFN(0xb, 1), PCI_CLASS_PROG,
455 temp);
456 }
457}
458
459void __init pplus_pcibios_fixup(void)
460{
461
462 unsigned char reg;
463 unsigned short devid;
464 unsigned char base_mod;
465
466 printk(KERN_INFO "Setting PCI interrupts for a \"%s\"\n",
467 Motherboard_map_name);
468
469 /* Setup the Winbond or Via PIB */
470 pplus_pib_init();
471
472 /* Set up floppy in PS/2 mode */
473 outb(0x09, SIO_CONFIG_RA);
474 reg = inb(SIO_CONFIG_RD);
475 reg = (reg & 0x3F) | 0x40;
476 outb(reg, SIO_CONFIG_RD);
477 outb(reg, SIO_CONFIG_RD); /* Have to write twice to change! */
478
479 /* This is a hack. If this is a 2300 or 2400 mot board then there is
480 * no keyboard controller and we have to indicate that.
481 */
482
483 early_read_config_word(0, 0, 0, PCI_VENDOR_ID, &devid);
484 base_mod = inb(MOTOROLA_BASETYPE_REG);
485 if ((devid == PCI_DEVICE_ID_MOTOROLA_HAWK) ||
486 (base_mod == 0xF9) || (base_mod == 0xFA) || (base_mod == 0xE1))
487 prep_keybd_present = 0;
488}
489
490void __init pplus_find_bridges(void)
491{
492 struct pci_controller *hose;
493
494 hose = pcibios_alloc_controller();
495 if (!hose)
496 return;
497
498 hose->first_busno = 0;
499 hose->last_busno = 0xff;
500
501 hose->pci_mem_offset = PREP_ISA_MEM_BASE;
502 hose->io_base_virt = (void *)PREP_ISA_IO_BASE;
503
504 pci_init_resource(&hose->io_resource, PPLUS_PCI_IO_START,
505 PPLUS_PCI_IO_END, IORESOURCE_IO, "PCI host bridge");
506 pci_init_resource(&hose->mem_resources[0], PPLUS_PROC_PCI_MEM_START,
507 PPLUS_PROC_PCI_MEM_END, IORESOURCE_MEM,
508 "PCI host bridge");
509
510 hose->io_space.start = PPLUS_PCI_IO_START;
511 hose->io_space.end = PPLUS_PCI_IO_END;
512 hose->mem_space.start = PPLUS_PCI_MEM_START;
513 hose->mem_space.end = PPLUS_PCI_MEM_END - HAWK_MPIC_SIZE;
514
515 if (hawk_init(hose, PPLUS_HAWK_PPC_REG_BASE, PPLUS_PROC_PCI_MEM_START,
516 PPLUS_PROC_PCI_MEM_END - HAWK_MPIC_SIZE,
517 PPLUS_PROC_PCI_IO_START, PPLUS_PROC_PCI_IO_END,
518 PPLUS_PROC_PCI_MEM_END - HAWK_MPIC_SIZE + 1)
519 != 0) {
520 printk(KERN_CRIT "Could not initialize host bridge\n");
521
522 }
523
524 pplus_set_VIA_IDE_legacy();
525
526 hose->last_busno = pciauto_bus_scan(hose, hose->first_busno);
527
528 ppc_md.pcibios_fixup = pplus_pcibios_fixup;
529 ppc_md.pci_swizzle = common_swizzle;
530}
531
532static int pplus_show_cpuinfo(struct seq_file *m)
533{
534 seq_printf(m, "vendor\t\t: Motorola MCG\n");
535 seq_printf(m, "machine\t\t: %s\n", Motherboard_map_name);
536
537 return 0;
538}
539
540static void __init pplus_setup_arch(void)
541{
542 struct pci_controller *hose;
543
544 if (ppc_md.progress)
545 ppc_md.progress("pplus_setup_arch: enter", 0);
546
547 /* init to some ~sane value until calibrate_delay() runs */
548 loops_per_jiffy = 50000000;
549
550 if (ppc_md.progress)
551 ppc_md.progress("pplus_setup_arch: find_bridges", 0);
552
553 /* Setup PCI host bridge */
554 pplus_find_bridges();
555
556 hose = pci_bus_to_hose(0);
557 isa_io_base = (ulong) hose->io_base_virt;
558
559 if (ppc_md.progress)
560 ppc_md.progress("pplus_setup_arch: set_board_type", 0);
561
562 pplus_set_board_type();
563
564 /* Enable L2. Assume we don't need to flush -- Cort */
565 *(unsigned char *)(PPLUS_L2_CONTROL_REG) |= 3;
566
567#ifdef CONFIG_BLK_DEV_INITRD
568 if (initrd_start)
569 ROOT_DEV = Root_RAM0;
570 else
571#endif
572#ifdef CONFIG_ROOT_NFS
573 ROOT_DEV = Root_NFS;
574#else
575 ROOT_DEV = Root_SDA2;
576#endif
577
578 printk(KERN_INFO "Motorola PowerPlus Platform\n");
579 printk(KERN_INFO
580 "Port by MontaVista Software, Inc. (source@mvista.com)\n");
581
582#ifdef CONFIG_VGA_CONSOLE
583 /* remap the VGA memory */
584 vgacon_remap_base = (unsigned long)ioremap(PPLUS_ISA_MEM_BASE,
585 0x08000000);
586 conswitchp = &vga_con;
587#endif
588#ifdef CONFIG_PPCBUG_NVRAM
589 /* Read in NVRAM data */
590 init_prep_nvram();
591
592 /* if no bootargs, look in NVRAM */
593 if (cmd_line[0] == '\0') {
594 char *bootargs;
595 bootargs = prep_nvram_get_var("bootargs");
596 if (bootargs != NULL) {
597 strcpy(cmd_line, bootargs);
598 /* again.. */
599 strcpy(saved_command_line, cmd_line);
600 }
601 }
602#endif
603 if (ppc_md.progress)
604 ppc_md.progress("pplus_setup_arch: exit", 0);
605}
606
607static void pplus_restart(char *cmd)
608{
609 unsigned long i = 10000;
610
611 local_irq_disable();
612
613 /* set VIA IDE controller into native mode */
614 pplus_set_VIA_IDE_native();
615
616 /* set exception prefix high - to the prom */
617 _nmask_and_or_msr(0, MSR_IP);
618
619 /* make sure bit 0 (reset) is a 0 */
620 outb(inb(0x92) & ~1L, 0x92);
621 /* signal a reset to system control port A - soft reset */
622 outb(inb(0x92) | 1, 0x92);
623
624 while (i != 0)
625 i++;
626 panic("restart failed\n");
627}
628
629static void pplus_halt(void)
630{
631 /* set exception prefix high - to the prom */
632 _nmask_and_or_msr(MSR_EE, MSR_IP);
633
634 /* make sure bit 0 (reset) is a 0 */
635 outb(inb(0x92) & ~1L, 0x92);
636 /* signal a reset to system control port A - soft reset */
637 outb(inb(0x92) | 1, 0x92);
638
639 while (1) ;
640 /*
641 * Not reached
642 */
643}
644
645static void pplus_power_off(void)
646{
647 pplus_halt();
648}
649
650static unsigned int pplus_irq_canonicalize(u_int irq)
651{
652 if (irq == 2)
653 return 9;
654 else
655 return irq;
656}
657
658static void __init pplus_init_IRQ(void)
659{
660 int i;
661
662 if (ppc_md.progress)
663 ppc_md.progress("init_irq: enter", 0);
664
665 OpenPIC_InitSenses = pplus_openpic_initsenses;
666 OpenPIC_NumInitSenses = sizeof(pplus_openpic_initsenses);
667
668 if (OpenPIC_Addr != NULL) {
669
670 openpic_set_sources(0, 16, OpenPIC_Addr + 0x10000);
671 openpic_init(NUM_8259_INTERRUPTS);
672 openpic_hookup_cascade(NUM_8259_INTERRUPTS, "82c59 cascade",
673 i8259_irq);
674 ppc_md.get_irq = openpic_get_irq;
675 }
676
677 for (i = 0; i < NUM_8259_INTERRUPTS; i++)
678 irq_desc[i].handler = &i8259_pic;
679
680 i8259_init(0);
681
682 if (ppc_md.progress)
683 ppc_md.progress("init_irq: exit", 0);
684}
685
686#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
687/*
688 * IDE stuff.
689 */
690static int pplus_ide_default_irq(unsigned long base)
691{
692 switch (base) {
693 case 0x1f0:
694 return 14;
695 case 0x170:
696 return 15;
697 default:
698 return 0;
699 }
700}
701
702static unsigned long pplus_ide_default_io_base(int index)
703{
704 switch (index) {
705 case 0:
706 return 0x1f0;
707 case 1:
708 return 0x170;
709 default:
710 return 0;
711 }
712}
713
714static void __init
715pplus_ide_init_hwif_ports(hw_regs_t * hw, unsigned long data_port,
716 unsigned long ctrl_port, int *irq)
717{
718 unsigned long reg = data_port;
719 int i;
720
721 for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
722 hw->io_ports[i] = reg;
723 reg += 1;
724 }
725
726 if (ctrl_port)
727 hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
728 else
729 hw->io_ports[IDE_CONTROL_OFFSET] =
730 hw->io_ports[IDE_DATA_OFFSET] + 0x206;
731
732 if (irq != NULL)
733 *irq = pplus_ide_default_irq(data_port);
734}
735#endif
736
737#ifdef CONFIG_SMP
738/* PowerPlus (MTX) support */
739static int __init smp_pplus_probe(void)
740{
741 extern int mot_multi;
742
743 if (mot_multi) {
744 openpic_request_IPIs();
745 smp_hw_index[1] = 1;
746 return 2;
747 }
748
749 return 1;
750}
751
752static void __init smp_pplus_kick_cpu(int nr)
753{
754 *(unsigned long *)KERNELBASE = nr;
755 asm volatile ("dcbf 0,%0"::"r" (KERNELBASE):"memory");
756 printk(KERN_INFO "CPU1 reset, waiting\n");
757}
758
759static void __init smp_pplus_setup_cpu(int cpu_nr)
760{
761 if (OpenPIC_Addr)
762 do_openpic_setup_cpu();
763}
764
765static struct smp_ops_t pplus_smp_ops = {
766 smp_openpic_message_pass,
767 smp_pplus_probe,
768 smp_pplus_kick_cpu,
769 smp_pplus_setup_cpu,
770 .give_timebase = smp_generic_give_timebase,
771 .take_timebase = smp_generic_take_timebase,
772};
773#endif /* CONFIG_SMP */
774
775#ifdef DUMP_DBATS
776static void print_dbat(int idx, u32 bat)
777{
778
779 char str[64];
780
781 sprintf(str, "DBAT%c%c = 0x%08x\n",
782 (char)((idx - DBAT0U) / 2) + '0', (idx & 1) ? 'L' : 'U', bat);
783 ppc_md.progress(str, 0);
784}
785
786#define DUMP_DBAT(x) \
787 do { \
788 u32 __temp = mfspr(x);\
789 print_dbat(x, __temp); \
790 } while (0)
791
792static void dump_dbats(void)
793{
794 if (ppc_md.progress) {
795 DUMP_DBAT(DBAT0U);
796 DUMP_DBAT(DBAT0L);
797 DUMP_DBAT(DBAT1U);
798 DUMP_DBAT(DBAT1L);
799 DUMP_DBAT(DBAT2U);
800 DUMP_DBAT(DBAT2L);
801 DUMP_DBAT(DBAT3U);
802 DUMP_DBAT(DBAT3L);
803 }
804}
805#endif
806
807static unsigned long __init pplus_find_end_of_memory(void)
808{
809 unsigned long total;
810
811 if (ppc_md.progress)
812 ppc_md.progress("pplus_find_end_of_memory", 0);
813
814#ifdef DUMP_DBATS
815 dump_dbats();
816#endif
817
818 total = hawk_get_mem_size(PPLUS_HAWK_SMC_BASE);
819 return (total);
820}
821
822static void __init pplus_map_io(void)
823{
824 io_block_mapping(PPLUS_ISA_IO_BASE, PPLUS_ISA_IO_BASE, 0x10000000,
825 _PAGE_IO);
826 io_block_mapping(0xfef80000, 0xfef80000, 0x00080000, _PAGE_IO);
827}
828
829static void __init pplus_init2(void)
830{
831#ifdef CONFIG_NVRAM
832 request_region(PREP_NVRAM_AS0, 0x8, "nvram");
833#endif
834 request_region(0x20, 0x20, "pic1");
835 request_region(0xa0, 0x20, "pic2");
836 request_region(0x00, 0x20, "dma1");
837 request_region(0x40, 0x20, "timer");
838 request_region(0x80, 0x10, "dma page reg");
839 request_region(0xc0, 0x20, "dma2");
840}
841
842/*
843 * Set BAT 2 to access 0x8000000 so progress messages will work and set BAT 3
844 * to 0xf0000000 to access Falcon/Raven or Hawk registers
845 */
846static __inline__ void pplus_set_bat(void)
847{
848 /* wait for all outstanding memory accesses to complete */
849 mb();
850
851 /* setup DBATs */
852 mtspr(SPRN_DBAT2U, 0x80001ffe);
853 mtspr(SPRN_DBAT2L, 0x8000002a);
854 mtspr(SPRN_DBAT3U, 0xf0001ffe);
855 mtspr(SPRN_DBAT3L, 0xf000002a);
856
857 /* wait for updates */
858 mb();
859}
860
861void __init
862platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
863 unsigned long r6, unsigned long r7)
864{
865 parse_bootinfo(find_bootinfo());
866
867 /* Map in board regs, etc. */
868 pplus_set_bat();
869
870 isa_io_base = PREP_ISA_IO_BASE;
871 isa_mem_base = PREP_ISA_MEM_BASE;
872 pci_dram_offset = PREP_PCI_DRAM_OFFSET;
873 ISA_DMA_THRESHOLD = 0x00ffffff;
874 DMA_MODE_READ = 0x44;
875 DMA_MODE_WRITE = 0x48;
876
877 ppc_md.setup_arch = pplus_setup_arch;
878 ppc_md.show_cpuinfo = pplus_show_cpuinfo;
879 ppc_md.irq_canonicalize = pplus_irq_canonicalize;
880 ppc_md.init_IRQ = pplus_init_IRQ;
881 /* this gets changed later on if we have an OpenPIC -- Cort */
882 ppc_md.get_irq = i8259_irq;
883 ppc_md.init = pplus_init2;
884
885 ppc_md.restart = pplus_restart;
886 ppc_md.power_off = pplus_power_off;
887 ppc_md.halt = pplus_halt;
888
889 TODC_INIT(TODC_TYPE_MK48T59, PREP_NVRAM_AS0, PREP_NVRAM_AS1,
890 PREP_NVRAM_DATA, 8);
891
892 ppc_md.time_init = todc_time_init;
893 ppc_md.set_rtc_time = todc_set_rtc_time;
894 ppc_md.get_rtc_time = todc_get_rtc_time;
895 ppc_md.calibrate_decr = todc_calibrate_decr;
896 ppc_md.nvram_read_val = todc_m48txx_read_val;
897 ppc_md.nvram_write_val = todc_m48txx_write_val;
898
899 ppc_md.find_end_of_memory = pplus_find_end_of_memory;
900 ppc_md.setup_io_mappings = pplus_map_io;
901
902#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
903 ppc_ide_md.default_irq = pplus_ide_default_irq;
904 ppc_ide_md.default_io_base = pplus_ide_default_io_base;
905 ppc_ide_md.ide_init_hwif = pplus_ide_init_hwif_ports;
906#endif
907
908#ifdef CONFIG_SERIAL_TEXT_DEBUG
909 ppc_md.progress = gen550_progress;
910#endif /* CONFIG_SERIAL_TEXT_DEBUG */
911#ifdef CONFIG_KGDB
912 ppc_md.kgdb_map_scc = gen550_kgdb_map_scc;
913#endif
914#ifdef CONFIG_SMP
915 ppc_md.smp_ops = &pplus_smp_ops;
916#endif /* CONFIG_SMP */
917}
diff --git a/arch/ppc/platforms/pplus.h b/arch/ppc/platforms/pplus.h
new file mode 100644
index 000000000000..90f0cb2d409f
--- /dev/null
+++ b/arch/ppc/platforms/pplus.h
@@ -0,0 +1,67 @@
1/*
2 * arch/ppc/platforms/pplus.h
3 *
4 * Definitions for Motorola MCG Falcon/Raven & HAWK North Bridge & Memory ctlr.
5 *
6 * Author: Mark A. Greerinclude/asm-ppc/hawk.h
7 * mgreer@mvista.com
8 *
9 * Modified by Randy Vinson (rvinson@mvista.com)
10 *
11 * 2001-2004 (c) MontaVista, Software, Inc. This file is licensed under
12 * the terms of the GNU General Public License version 2. This program
13 * is licensed "as is" without any warranty of any kind, whether express
14 * or implied.
15 */
16
17#ifndef __PPC_PPLUS_H
18#define __PPC_PPLUS_H
19
20#include <asm/io.h>
21
22/*
23 * Due to limiations imposed by legacy hardware (primaryily IDE controllers),
24 * the PPLUS boards operate using a PReP address map.
25 *
26 * From Processor (physical) -> PCI:
27 * PCI Mem Space: 0xc0000000 - 0xfe000000 -> 0x00000000 - 0x3e000000 (768 MB)
28 * PCI I/O Space: 0x80000000 - 0x90000000 -> 0x00000000 - 0x10000000 (256 MB)
29 * Note: Must skip 0xfe000000-0xfe400000 for CONFIG_HIGHMEM/PKMAP area
30 *
31 * From PCI -> Processor (physical):
32 * System Memory: 0x80000000 -> 0x00000000
33 */
34
35#define PPLUS_ISA_MEM_BASE PREP_ISA_MEM_BASE
36#define PPLUS_ISA_IO_BASE PREP_ISA_IO_BASE
37
38/* PCI Memory space mapping info */
39#define PPLUS_PCI_MEM_SIZE 0x30000000U
40#define PPLUS_PROC_PCI_MEM_START PPLUS_ISA_MEM_BASE
41#define PPLUS_PROC_PCI_MEM_END (PPLUS_PROC_PCI_MEM_START + \
42 PPLUS_PCI_MEM_SIZE - 1)
43#define PPLUS_PCI_MEM_START 0x00000000U
44#define PPLUS_PCI_MEM_END (PPLUS_PCI_MEM_START + \
45 PPLUS_PCI_MEM_SIZE - 1)
46
47/* PCI I/O space mapping info */
48#define PPLUS_PCI_IO_SIZE 0x10000000U
49#define PPLUS_PROC_PCI_IO_START PPLUS_ISA_IO_BASE
50#define PPLUS_PROC_PCI_IO_END (PPLUS_PROC_PCI_IO_START + \
51 PPLUS_PCI_IO_SIZE - 1)
52#define PPLUS_PCI_IO_START 0x00000000U
53#define PPLUS_PCI_IO_END (PPLUS_PCI_IO_START + \
54 PPLUS_PCI_IO_SIZE - 1)
55/* System memory mapping info */
56#define PPLUS_PCI_DRAM_OFFSET PREP_PCI_DRAM_OFFSET
57#define PPLUS_PCI_PHY_MEM_OFFSET (PPLUS_ISA_MEM_BASE-PPLUS_PCI_MEM_START)
58
59/* Define base addresses for important sets of registers */
60#define PPLUS_HAWK_SMC_BASE 0xfef80000U
61#define PPLUS_HAWK_PPC_REG_BASE 0xfeff0000U
62#define PPLUS_SYS_CONFIG_REG 0xfef80400U
63#define PPLUS_L2_CONTROL_REG 0x8000081cU
64
65#define PPLUS_VGA_MEM_BASE 0xf0000000U
66
67#endif /* __PPC_PPLUS_H */
diff --git a/arch/ppc/platforms/pq2ads.c b/arch/ppc/platforms/pq2ads.c
new file mode 100644
index 000000000000..6a1475c1e128
--- /dev/null
+++ b/arch/ppc/platforms/pq2ads.c
@@ -0,0 +1,26 @@
1/*
2 * arch/ppc/platforms/pq2ads.c
3 *
4 * PQ2ADS platform support
5 *
6 * Author: Kumar Gala <kumar.gala@freescale.com>
7 * Derived from: est8260_setup.c by Allen Curtis
8 *
9 * Copyright 2004 Freescale Semiconductor, Inc.
10 *
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
15 */
16
17#include <linux/init.h>
18
19#include <asm/mpc8260.h>
20
21void __init
22m82xx_board_setup(void)
23{
24 /* Enable the 2nd UART port */
25 *(volatile uint *)(BCSR_ADDR + 4) &= ~BCSR1_RS232_EN2;
26}
diff --git a/arch/ppc/platforms/pq2ads.h b/arch/ppc/platforms/pq2ads.h
new file mode 100644
index 000000000000..cf5e5dd06d63
--- /dev/null
+++ b/arch/ppc/platforms/pq2ads.h
@@ -0,0 +1,96 @@
1/*
2 * A collection of structures, addresses, and values associated with
3 * the Motorola MPC8260ADS/MPC8266ADS-PCI boards.
4 * Copied from the RPX-Classic and SBS8260 stuff.
5 *
6 * Copyright (c) 2001 Dan Malek (dan@mvista.com)
7 */
8#ifdef __KERNEL__
9#ifndef __MACH_ADS8260_DEFS
10#define __MACH_ADS8260_DEFS
11
12#include <linux/config.h>
13
14#include <asm/ppcboot.h>
15
16/* Memory map is configured by the PROM startup.
17 * We just map a few things we need. The CSR is actually 4 byte-wide
18 * registers that can be accessed as 8-, 16-, or 32-bit values.
19 */
20#define CPM_MAP_ADDR ((uint)0xf0000000)
21#define BCSR_ADDR ((uint)0xf4500000)
22#define BCSR_SIZE ((uint)(32 * 1024))
23
24#define BOOTROM_RESTART_ADDR ((uint)0xff000104)
25
26/* For our show_cpuinfo hooks. */
27#define CPUINFO_VENDOR "Motorola"
28#define CPUINFO_MACHINE "PQ2 ADS PowerPC"
29
30/* The ADS8260 has 16, 32-bit wide control/status registers, accessed
31 * only on word boundaries.
32 * Not all are used (yet), or are interesting to us (yet).
33 */
34
35/* Things of interest in the CSR.
36*/
37#define BCSR0_LED0 ((uint)0x02000000) /* 0 == on */
38#define BCSR0_LED1 ((uint)0x01000000) /* 0 == on */
39#define BCSR1_FETHIEN ((uint)0x08000000) /* 0 == enable */
40#define BCSR1_FETH_RST ((uint)0x04000000) /* 0 == reset */
41#define BCSR1_RS232_EN1 ((uint)0x02000000) /* 0 == enable */
42#define BCSR1_RS232_EN2 ((uint)0x01000000) /* 0 == enable */
43#define BCSR3_FETHIEN2 ((uint)0x10000000) /* 0 == enable */
44#define BCSR3_FETH2_RST ((uint)0x80000000) /* 0 == reset */
45
46#define PHY_INTERRUPT SIU_INT_IRQ7
47
48#ifdef CONFIG_PCI
49/* PCI interrupt controller */
50#define PCI_INT_STAT_REG 0xF8200000
51#define PCI_INT_MASK_REG 0xF8200004
52#define PIRQA (NR_SIU_INTS + 0)
53#define PIRQB (NR_SIU_INTS + 1)
54#define PIRQC (NR_SIU_INTS + 2)
55#define PIRQD (NR_SIU_INTS + 3)
56
57/*
58 * PCI memory map definitions for MPC8266ADS-PCI.
59 *
60 * processor view
61 * local address PCI address target
62 * 0x80000000-0x9FFFFFFF 0x80000000-0x9FFFFFFF PCI mem with prefetch
63 * 0xA0000000-0xBFFFFFFF 0xA0000000-0xBFFFFFFF PCI mem w/o prefetch
64 * 0xF4000000-0xF7FFFFFF 0x00000000-0x03FFFFFF PCI IO
65 *
66 * PCI master view
67 * local address PCI address target
68 * 0x00000000-0x1FFFFFFF 0x00000000-0x1FFFFFFF MPC8266 local memory
69 */
70
71/* window for a PCI master to access MPC8266 memory */
72#define PCI_SLV_MEM_LOCAL 0x00000000 /* Local base */
73#define PCI_SLV_MEM_BUS 0x00000000 /* PCI base */
74
75/* window for the processor to access PCI memory with prefetching */
76#define PCI_MSTR_MEM_LOCAL 0x80000000 /* Local base */
77#define PCI_MSTR_MEM_BUS 0x80000000 /* PCI base */
78#define PCI_MSTR_MEM_SIZE 0x20000000 /* 512MB */
79
80/* window for the processor to access PCI memory without prefetching */
81#define PCI_MSTR_MEMIO_LOCAL 0xA0000000 /* Local base */
82#define PCI_MSTR_MEMIO_BUS 0xA0000000 /* PCI base */
83#define PCI_MSTR_MEMIO_SIZE 0x20000000 /* 512MB */
84
85/* window for the processor to access PCI I/O */
86#define PCI_MSTR_IO_LOCAL 0xF4000000 /* Local base */
87#define PCI_MSTR_IO_BUS 0x00000000 /* PCI base */
88#define PCI_MSTR_IO_SIZE 0x04000000 /* 64MB */
89
90#define _IO_BASE PCI_MSTR_IO_LOCAL
91#define _ISA_MEM_BASE PCI_MSTR_MEMIO_LOCAL
92#define PCI_DRAM_OFFSET PCI_SLV_MEM_BUS
93#endif /* CONFIG_PCI */
94
95#endif /* __MACH_ADS8260_DEFS */
96#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/prep_pci.c b/arch/ppc/platforms/prep_pci.c
new file mode 100644
index 000000000000..8cd80eb447bd
--- /dev/null
+++ b/arch/ppc/platforms/prep_pci.c
@@ -0,0 +1,1336 @@
1/*
2 * PReP pci functions.
3 * Originally by Gary Thomas
4 * rewritten and updated by Cort Dougan (cort@cs.nmt.edu)
5 *
6 * The motherboard routes/maps will disappear shortly. -- Cort
7 */
8
9#include <linux/config.h>
10#include <linux/types.h>
11#include <linux/pci.h>
12#include <linux/kernel.h>
13#include <linux/init.h>
14
15#include <asm/sections.h>
16#include <asm/byteorder.h>
17#include <asm/io.h>
18#include <asm/ptrace.h>
19#include <asm/prom.h>
20#include <asm/pci-bridge.h>
21#include <asm/residual.h>
22#include <asm/irq.h>
23#include <asm/machdep.h>
24#include <asm/open_pic.h>
25
26extern void (*setup_ibm_pci)(char *irq_lo, char *irq_hi);
27
28/* Which PCI interrupt line does a given device [slot] use? */
29/* Note: This really should be two dimensional based in slot/pin used */
30static unsigned char *Motherboard_map;
31unsigned char *Motherboard_map_name;
32
33/* How is the 82378 PIRQ mapping setup? */
34static unsigned char *Motherboard_routes;
35
36static void (*Motherboard_non0)(struct pci_dev *);
37
38static void Powerplus_Map_Non0(struct pci_dev *);
39
40/* Used for Motorola to store system config register */
41static unsigned long *ProcInfo;
42
43/* Tables for known hardware */
44
45/* Motorola PowerStackII - Utah */
46static char Utah_pci_IRQ_map[23] __prepdata =
47{
48 0, /* Slot 0 - unused */
49 0, /* Slot 1 - unused */
50 5, /* Slot 2 - SCSI - NCR825A */
51 0, /* Slot 3 - unused */
52 3, /* Slot 4 - Ethernet - DEC2114x */
53 0, /* Slot 5 - unused */
54 2, /* Slot 6 - PCI Card slot #1 */
55 3, /* Slot 7 - PCI Card slot #2 */
56 5, /* Slot 8 - PCI Card slot #3 */
57 5, /* Slot 9 - PCI Bridge */
58 /* added here in case we ever support PCI bridges */
59 /* Secondary PCI bus cards are at slot-9,6 & slot-9,7 */
60 0, /* Slot 10 - unused */
61 0, /* Slot 11 - unused */
62 5, /* Slot 12 - SCSI - NCR825A */
63 0, /* Slot 13 - unused */
64 3, /* Slot 14 - enet */
65 0, /* Slot 15 - unused */
66 2, /* Slot 16 - unused */
67 3, /* Slot 17 - unused */
68 5, /* Slot 18 - unused */
69 0, /* Slot 19 - unused */
70 0, /* Slot 20 - unused */
71 0, /* Slot 21 - unused */
72 0, /* Slot 22 - unused */
73};
74
75static char Utah_pci_IRQ_routes[] __prepdata =
76{
77 0, /* Line 0 - Unused */
78 9, /* Line 1 */
79 10, /* Line 2 */
80 11, /* Line 3 */
81 14, /* Line 4 */
82 15, /* Line 5 */
83};
84
85/* Motorola PowerStackII - Omaha */
86/* no integrated SCSI or ethernet */
87static char Omaha_pci_IRQ_map[23] __prepdata =
88{
89 0, /* Slot 0 - unused */
90 0, /* Slot 1 - unused */
91 3, /* Slot 2 - Winbond EIDE */
92 0, /* Slot 3 - unused */
93 0, /* Slot 4 - unused */
94 0, /* Slot 5 - unused */
95 1, /* Slot 6 - PCI slot 1 */
96 2, /* Slot 7 - PCI slot 2 */
97 3, /* Slot 8 - PCI slot 3 */
98 4, /* Slot 9 - PCI slot 4 */ /* needs indirect access */
99 0, /* Slot 10 - unused */
100 0, /* Slot 11 - unused */
101 0, /* Slot 12 - unused */
102 0, /* Slot 13 - unused */
103 0, /* Slot 14 - unused */
104 0, /* Slot 15 - unused */
105 1, /* Slot 16 - PCI slot 1 */
106 2, /* Slot 17 - PCI slot 2 */
107 3, /* Slot 18 - PCI slot 3 */
108 4, /* Slot 19 - PCI slot 4 */ /* needs indirect access */
109 0,
110 0,
111 0,
112};
113
114static char Omaha_pci_IRQ_routes[] __prepdata =
115{
116 0, /* Line 0 - Unused */
117 9, /* Line 1 */
118 11, /* Line 2 */
119 14, /* Line 3 */
120 15 /* Line 4 */
121};
122
123/* Motorola PowerStack */
124static char Blackhawk_pci_IRQ_map[19] __prepdata =
125{
126 0, /* Slot 0 - unused */
127 0, /* Slot 1 - unused */
128 0, /* Slot 2 - unused */
129 0, /* Slot 3 - unused */
130 0, /* Slot 4 - unused */
131 0, /* Slot 5 - unused */
132 0, /* Slot 6 - unused */
133 0, /* Slot 7 - unused */
134 0, /* Slot 8 - unused */
135 0, /* Slot 9 - unused */
136 0, /* Slot 10 - unused */
137 0, /* Slot 11 - unused */
138 3, /* Slot 12 - SCSI */
139 0, /* Slot 13 - unused */
140 1, /* Slot 14 - Ethernet */
141 0, /* Slot 15 - unused */
142 1, /* Slot P7 */
143 2, /* Slot P6 */
144 3, /* Slot P5 */
145};
146
147static char Blackhawk_pci_IRQ_routes[] __prepdata =
148{
149 0, /* Line 0 - Unused */
150 9, /* Line 1 */
151 11, /* Line 2 */
152 15, /* Line 3 */
153 15 /* Line 4 */
154};
155
156/* Motorola Mesquite */
157static char Mesquite_pci_IRQ_map[23] __prepdata =
158{
159 0, /* Slot 0 - unused */
160 0, /* Slot 1 - unused */
161 0, /* Slot 2 - unused */
162 0, /* Slot 3 - unused */
163 0, /* Slot 4 - unused */
164 0, /* Slot 5 - unused */
165 0, /* Slot 6 - unused */
166 0, /* Slot 7 - unused */
167 0, /* Slot 8 - unused */
168 0, /* Slot 9 - unused */
169 0, /* Slot 10 - unused */
170 0, /* Slot 11 - unused */
171 0, /* Slot 12 - unused */
172 0, /* Slot 13 - unused */
173 2, /* Slot 14 - Ethernet */
174 0, /* Slot 15 - unused */
175 3, /* Slot 16 - PMC */
176 0, /* Slot 17 - unused */
177 0, /* Slot 18 - unused */
178 0, /* Slot 19 - unused */
179 0, /* Slot 20 - unused */
180 0, /* Slot 21 - unused */
181 0, /* Slot 22 - unused */
182};
183
184/* Motorola Sitka */
185static char Sitka_pci_IRQ_map[21] __prepdata =
186{
187 0, /* Slot 0 - unused */
188 0, /* Slot 1 - unused */
189 0, /* Slot 2 - unused */
190 0, /* Slot 3 - unused */
191 0, /* Slot 4 - unused */
192 0, /* Slot 5 - unused */
193 0, /* Slot 6 - unused */
194 0, /* Slot 7 - unused */
195 0, /* Slot 8 - unused */
196 0, /* Slot 9 - unused */
197 0, /* Slot 10 - unused */
198 0, /* Slot 11 - unused */
199 0, /* Slot 12 - unused */
200 0, /* Slot 13 - unused */
201 2, /* Slot 14 - Ethernet */
202 0, /* Slot 15 - unused */
203 9, /* Slot 16 - PMC 1 */
204 12, /* Slot 17 - PMC 2 */
205 0, /* Slot 18 - unused */
206 0, /* Slot 19 - unused */
207 4, /* Slot 20 - NT P2P bridge */
208};
209
210/* Motorola MTX */
211static char MTX_pci_IRQ_map[23] __prepdata =
212{
213 0, /* Slot 0 - unused */
214 0, /* Slot 1 - unused */
215 0, /* Slot 2 - unused */
216 0, /* Slot 3 - unused */
217 0, /* Slot 4 - unused */
218 0, /* Slot 5 - unused */
219 0, /* Slot 6 - unused */
220 0, /* Slot 7 - unused */
221 0, /* Slot 8 - unused */
222 0, /* Slot 9 - unused */
223 0, /* Slot 10 - unused */
224 0, /* Slot 11 - unused */
225 3, /* Slot 12 - SCSI */
226 0, /* Slot 13 - unused */
227 2, /* Slot 14 - Ethernet */
228 0, /* Slot 15 - unused */
229 9, /* Slot 16 - PCI/PMC slot 1 */
230 10, /* Slot 17 - PCI/PMC slot 2 */
231 11, /* Slot 18 - PCI slot 3 */
232 0, /* Slot 19 - unused */
233 0, /* Slot 20 - unused */
234 0, /* Slot 21 - unused */
235 0, /* Slot 22 - unused */
236};
237
238/* Motorola MTX Plus */
239/* Secondary bus interrupt routing is not supported yet */
240static char MTXplus_pci_IRQ_map[23] __prepdata =
241{
242 0, /* Slot 0 - unused */
243 0, /* Slot 1 - unused */
244 0, /* Slot 2 - unused */
245 0, /* Slot 3 - unused */
246 0, /* Slot 4 - unused */
247 0, /* Slot 5 - unused */
248 0, /* Slot 6 - unused */
249 0, /* Slot 7 - unused */
250 0, /* Slot 8 - unused */
251 0, /* Slot 9 - unused */
252 0, /* Slot 10 - unused */
253 0, /* Slot 11 - unused */
254 3, /* Slot 12 - SCSI */
255 0, /* Slot 13 - unused */
256 2, /* Slot 14 - Ethernet 1 */
257 0, /* Slot 15 - unused */
258 9, /* Slot 16 - PCI slot 1P */
259 10, /* Slot 17 - PCI slot 2P */
260 11, /* Slot 18 - PCI slot 3P */
261 10, /* Slot 19 - Ethernet 2 */
262 0, /* Slot 20 - P2P Bridge */
263 0, /* Slot 21 - unused */
264 0, /* Slot 22 - unused */
265};
266
267static char Raven_pci_IRQ_routes[] __prepdata =
268{
269 0, /* This is a dummy structure */
270};
271
272/* Motorola MVME16xx */
273static char Genesis_pci_IRQ_map[16] __prepdata =
274{
275 0, /* Slot 0 - unused */
276 0, /* Slot 1 - unused */
277 0, /* Slot 2 - unused */
278 0, /* Slot 3 - unused */
279 0, /* Slot 4 - unused */
280 0, /* Slot 5 - unused */
281 0, /* Slot 6 - unused */
282 0, /* Slot 7 - unused */
283 0, /* Slot 8 - unused */
284 0, /* Slot 9 - unused */
285 0, /* Slot 10 - unused */
286 0, /* Slot 11 - unused */
287 3, /* Slot 12 - SCSI */
288 0, /* Slot 13 - unused */
289 1, /* Slot 14 - Ethernet */
290 0, /* Slot 15 - unused */
291};
292
293static char Genesis_pci_IRQ_routes[] __prepdata =
294{
295 0, /* Line 0 - Unused */
296 10, /* Line 1 */
297 11, /* Line 2 */
298 14, /* Line 3 */
299 15 /* Line 4 */
300};
301
302static char Genesis2_pci_IRQ_map[23] __prepdata =
303{
304 0, /* Slot 0 - unused */
305 0, /* Slot 1 - unused */
306 0, /* Slot 2 - unused */
307 0, /* Slot 3 - unused */
308 0, /* Slot 4 - unused */
309 0, /* Slot 5 - unused */
310 0, /* Slot 6 - unused */
311 0, /* Slot 7 - unused */
312 0, /* Slot 8 - unused */
313 0, /* Slot 9 - unused */
314 0, /* Slot 10 - unused */
315 0, /* Slot 11 - IDE */
316 3, /* Slot 12 - SCSI */
317 5, /* Slot 13 - Universe PCI - VME Bridge */
318 2, /* Slot 14 - Ethernet */
319 0, /* Slot 15 - unused */
320 9, /* Slot 16 - PMC 1 */
321 12, /* Slot 17 - pci */
322 11, /* Slot 18 - pci */
323 10, /* Slot 19 - pci */
324 0, /* Slot 20 - pci */
325 0, /* Slot 21 - unused */
326 0, /* Slot 22 - unused */
327};
328
329/* Motorola Series-E */
330static char Comet_pci_IRQ_map[23] __prepdata =
331{
332 0, /* Slot 0 - unused */
333 0, /* Slot 1 - unused */
334 0, /* Slot 2 - unused */
335 0, /* Slot 3 - unused */
336 0, /* Slot 4 - unused */
337 0, /* Slot 5 - unused */
338 0, /* Slot 6 - unused */
339 0, /* Slot 7 - unused */
340 0, /* Slot 8 - unused */
341 0, /* Slot 9 - unused */
342 0, /* Slot 10 - unused */
343 0, /* Slot 11 - unused */
344 3, /* Slot 12 - SCSI */
345 0, /* Slot 13 - unused */
346 1, /* Slot 14 - Ethernet */
347 0, /* Slot 15 - unused */
348 1, /* Slot 16 - PCI slot 1 */
349 2, /* Slot 17 - PCI slot 2 */
350 3, /* Slot 18 - PCI slot 3 */
351 4, /* Slot 19 - PCI bridge */
352 0,
353 0,
354 0,
355};
356
357static char Comet_pci_IRQ_routes[] __prepdata =
358{
359 0, /* Line 0 - Unused */
360 10, /* Line 1 */
361 11, /* Line 2 */
362 14, /* Line 3 */
363 15 /* Line 4 */
364};
365
366/* Motorola Series-EX */
367static char Comet2_pci_IRQ_map[23] __prepdata =
368{
369 0, /* Slot 0 - unused */
370 0, /* Slot 1 - unused */
371 3, /* Slot 2 - SCSI - NCR825A */
372 0, /* Slot 3 - unused */
373 1, /* Slot 4 - Ethernet - DEC2104X */
374 0, /* Slot 5 - unused */
375 1, /* Slot 6 - PCI slot 1 */
376 2, /* Slot 7 - PCI slot 2 */
377 3, /* Slot 8 - PCI slot 3 */
378 4, /* Slot 9 - PCI bridge */
379 0, /* Slot 10 - unused */
380 0, /* Slot 11 - unused */
381 3, /* Slot 12 - SCSI - NCR825A */
382 0, /* Slot 13 - unused */
383 1, /* Slot 14 - Ethernet - DEC2104X */
384 0, /* Slot 15 - unused */
385 1, /* Slot 16 - PCI slot 1 */
386 2, /* Slot 17 - PCI slot 2 */
387 3, /* Slot 18 - PCI slot 3 */
388 4, /* Slot 19 - PCI bridge */
389 0,
390 0,
391 0,
392};
393
394static char Comet2_pci_IRQ_routes[] __prepdata =
395{
396 0, /* Line 0 - Unused */
397 10, /* Line 1 */
398 11, /* Line 2 */
399 14, /* Line 3 */
400 15, /* Line 4 */
401};
402
403/*
404 * ibm 830 (and 850?).
405 * This is actually based on the Carolina motherboard
406 * -- Cort
407 */
408static char ibm8xx_pci_IRQ_map[23] __prepdata = {
409 0, /* Slot 0 - unused */
410 0, /* Slot 1 - unused */
411 0, /* Slot 2 - unused */
412 0, /* Slot 3 - unused */
413 0, /* Slot 4 - unused */
414 0, /* Slot 5 - unused */
415 0, /* Slot 6 - unused */
416 0, /* Slot 7 - unused */
417 0, /* Slot 8 - unused */
418 0, /* Slot 9 - unused */
419 0, /* Slot 10 - unused */
420 0, /* Slot 11 - FireCoral */
421 4, /* Slot 12 - Ethernet PCIINTD# */
422 2, /* Slot 13 - PCI Slot #2 */
423 2, /* Slot 14 - S3 Video PCIINTD# */
424 0, /* Slot 15 - onboard SCSI (INDI) [1] */
425 3, /* Slot 16 - NCR58C810 RS6000 Only PCIINTC# */
426 0, /* Slot 17 - unused */
427 2, /* Slot 18 - PCI Slot 2 PCIINTx# (See below) */
428 0, /* Slot 19 - unused */
429 0, /* Slot 20 - unused */
430 0, /* Slot 21 - unused */
431 2, /* Slot 22 - PCI slot 1 PCIINTx# (See below) */
432};
433
434static char ibm8xx_pci_IRQ_routes[] __prepdata = {
435 0, /* Line 0 - unused */
436 15, /* Line 1 */
437 15, /* Line 2 */
438 15, /* Line 3 */
439 15, /* Line 4 */
440};
441
442/*
443 * a 6015 ibm board
444 * -- Cort
445 */
446static char ibm6015_pci_IRQ_map[23] __prepdata = {
447 0, /* Slot 0 - unused */
448 0, /* Slot 1 - unused */
449 0, /* Slot 2 - unused */
450 0, /* Slot 3 - unused */
451 0, /* Slot 4 - unused */
452 0, /* Slot 5 - unused */
453 0, /* Slot 6 - unused */
454 0, /* Slot 7 - unused */
455 0, /* Slot 8 - unused */
456 0, /* Slot 9 - unused */
457 0, /* Slot 10 - unused */
458 0, /* Slot 11 - */
459 1, /* Slot 12 - SCSI */
460 2, /* Slot 13 - */
461 2, /* Slot 14 - */
462 1, /* Slot 15 - */
463 1, /* Slot 16 - */
464 0, /* Slot 17 - */
465 2, /* Slot 18 - */
466 0, /* Slot 19 - */
467 0, /* Slot 20 - */
468 0, /* Slot 21 - */
469 2, /* Slot 22 - */
470};
471
472static char ibm6015_pci_IRQ_routes[] __prepdata = {
473 0, /* Line 0 - unused */
474 13, /* Line 1 */
475 15, /* Line 2 */
476 15, /* Line 3 */
477 15, /* Line 4 */
478};
479
480
481/* IBM Nobis and Thinkpad 850 */
482static char Nobis_pci_IRQ_map[23] __prepdata ={
483 0, /* Slot 0 - unused */
484 0, /* Slot 1 - unused */
485 0, /* Slot 2 - unused */
486 0, /* Slot 3 - unused */
487 0, /* Slot 4 - unused */
488 0, /* Slot 5 - unused */
489 0, /* Slot 6 - unused */
490 0, /* Slot 7 - unused */
491 0, /* Slot 8 - unused */
492 0, /* Slot 9 - unused */
493 0, /* Slot 10 - unused */
494 0, /* Slot 11 - unused */
495 3, /* Slot 12 - SCSI */
496 0, /* Slot 13 - unused */
497 0, /* Slot 14 - unused */
498 0, /* Slot 15 - unused */
499};
500
501static char Nobis_pci_IRQ_routes[] __prepdata = {
502 0, /* Line 0 - Unused */
503 13, /* Line 1 */
504 13, /* Line 2 */
505 13, /* Line 3 */
506 13 /* Line 4 */
507};
508
509/*
510 * IBM RS/6000 43p/140 -- paulus
511 * XXX we should get all this from the residual data
512 */
513static char ibm43p_pci_IRQ_map[23] __prepdata = {
514 0, /* Slot 0 - unused */
515 0, /* Slot 1 - unused */
516 0, /* Slot 2 - unused */
517 0, /* Slot 3 - unused */
518 0, /* Slot 4 - unused */
519 0, /* Slot 5 - unused */
520 0, /* Slot 6 - unused */
521 0, /* Slot 7 - unused */
522 0, /* Slot 8 - unused */
523 0, /* Slot 9 - unused */
524 0, /* Slot 10 - unused */
525 0, /* Slot 11 - FireCoral ISA bridge */
526 6, /* Slot 12 - Ethernet */
527 0, /* Slot 13 - openpic */
528 0, /* Slot 14 - unused */
529 0, /* Slot 15 - unused */
530 7, /* Slot 16 - NCR58C825a onboard scsi */
531 0, /* Slot 17 - unused */
532 2, /* Slot 18 - PCI Slot 2 PCIINTx# (See below) */
533 0, /* Slot 19 - unused */
534 0, /* Slot 20 - unused */
535 0, /* Slot 21 - unused */
536 1, /* Slot 22 - PCI slot 1 PCIINTx# (See below) */
537};
538
539static char ibm43p_pci_IRQ_routes[] __prepdata = {
540 0, /* Line 0 - unused */
541 15, /* Line 1 */
542 15, /* Line 2 */
543 15, /* Line 3 */
544 15, /* Line 4 */
545};
546
547/* Motorola PowerPlus architecture PCI IRQ tables */
548/* Interrupt line values for INTA-D on primary/secondary MPIC inputs */
549
550struct powerplus_irq_list
551{
552 unsigned char primary[4]; /* INT A-D */
553 unsigned char secondary[4]; /* INT A-D */
554};
555
556/*
557 * For standard PowerPlus boards, bus 0 PCI INTs A-D are routed to
558 * OpenPIC inputs 9-12. PCI INTs A-D from the on board P2P bridge
559 * are routed to OpenPIC inputs 5-8. These values are offset by
560 * 16 in the table to reflect the Linux kernel interrupt value.
561 */
562struct powerplus_irq_list Powerplus_pci_IRQ_list __prepdata =
563{
564 {25, 26, 27, 28},
565 {21, 22, 23, 24}
566};
567
568/*
569 * For the MCP750 (system slot board), cPCI INTs A-D are routed to
570 * OpenPIC inputs 8-11 and the PMC INTs A-D are routed to OpenPIC
571 * input 3. On a hot swap MCP750, the companion card PCI INTs A-D
572 * are routed to OpenPIC inputs 12-15. These values are offset by
573 * 16 in the table to reflect the Linux kernel interrupt value.
574 */
575struct powerplus_irq_list Mesquite_pci_IRQ_list __prepdata =
576{
577 {24, 25, 26, 27},
578 {28, 29, 30, 31}
579};
580
581/*
582 * This table represents the standard PCI swizzle defined in the
583 * PCI bus specification.
584 */
585static unsigned char prep_pci_intpins[4][4] __prepdata =
586{
587 { 1, 2, 3, 4}, /* Buses 0, 4, 8, ... */
588 { 2, 3, 4, 1}, /* Buses 1, 5, 9, ... */
589 { 3, 4, 1, 2}, /* Buses 2, 6, 10 ... */
590 { 4, 1, 2, 3}, /* Buses 3, 7, 11 ... */
591};
592
593/* We have to turn on LEVEL mode for changed IRQ's */
594/* All PCI IRQ's need to be level mode, so this should be something
595 * other than hard-coded as well... IRQ's are individually mappable
596 * to either edge or level.
597 */
598
599/*
600 * 8259 edge/level control definitions
601 */
602#define ISA8259_M_ELCR 0x4d0
603#define ISA8259_S_ELCR 0x4d1
604
605#define ELCRS_INT15_LVL 0x80
606#define ELCRS_INT14_LVL 0x40
607#define ELCRS_INT12_LVL 0x10
608#define ELCRS_INT11_LVL 0x08
609#define ELCRS_INT10_LVL 0x04
610#define ELCRS_INT9_LVL 0x02
611#define ELCRS_INT8_LVL 0x01
612#define ELCRM_INT7_LVL 0x80
613#define ELCRM_INT5_LVL 0x20
614
615#if 0
616/*
617 * PCI config space access.
618 */
619#define CFGADDR(dev) ((1<<(dev>>3)) | ((dev&7)<<8))
620#define DEVNO(dev) (dev>>3)
621
622#define MIN_DEVNR 11
623#define MAX_DEVNR 22
624
625static int __prep
626prep_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
627 int len, u32 *val)
628{
629 struct pci_controller *hose = bus->sysdata;
630 volatile void __iomem *cfg_data;
631
632 if (bus->number != 0 || DEVNO(devfn) < MIN_DEVNR
633 || DEVNO(devfn) > MAX_DEVNR)
634 return PCIBIOS_DEVICE_NOT_FOUND;
635
636 /*
637 * Note: the caller has already checked that offset is
638 * suitably aligned and that len is 1, 2 or 4.
639 */
640 cfg_data = hose->cfg_data + CFGADDR(devfn) + offset;
641 switch (len) {
642 case 1:
643 *val = in_8(cfg_data);
644 break;
645 case 2:
646 *val = in_le16(cfg_data);
647 break;
648 default:
649 *val = in_le32(cfg_data);
650 break;
651 }
652 return PCIBIOS_SUCCESSFUL;
653}
654
655static int __prep
656prep_write_config(struct pci_bus *bus, unsigned int devfn, int offset,
657 int len, u32 val)
658{
659 struct pci_controller *hose = bus->sysdata;
660 volatile void __iomem *cfg_data;
661
662 if (bus->number != 0 || DEVNO(devfn) < MIN_DEVNR
663 || DEVNO(devfn) > MAX_DEVNR)
664 return PCIBIOS_DEVICE_NOT_FOUND;
665
666 /*
667 * Note: the caller has already checked that offset is
668 * suitably aligned and that len is 1, 2 or 4.
669 */
670 cfg_data = hose->cfg_data + CFGADDR(devfn) + offset;
671 switch (len) {
672 case 1:
673 out_8(cfg_data, val);
674 break;
675 case 2:
676 out_le16(cfg_data, val);
677 break;
678 default:
679 out_le32(cfg_data, val);
680 break;
681 }
682 return PCIBIOS_SUCCESSFUL;
683}
684
685static struct pci_ops prep_pci_ops =
686{
687 prep_read_config,
688 prep_write_config
689};
690#endif
691
692#define MOTOROLA_CPUTYPE_REG 0x800
693#define MOTOROLA_BASETYPE_REG 0x803
694#define MPIC_RAVEN_ID 0x48010000
695#define MPIC_HAWK_ID 0x48030000
696#define MOT_PROC2_BIT 0x800
697
698static u_char prep_openpic_initsenses[] __initdata = {
699 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* MVME2600_INT_SIO */
700 (IRQ_SENSE_EDGE | IRQ_POLARITY_NEGATIVE), /* MVME2600_INT_FALCN_ECC_ERR */
701 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* MVME2600_INT_PCI_ETHERNET */
702 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* MVME2600_INT_PCI_SCSI */
703 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* MVME2600_INT_PCI_GRAPHICS */
704 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* MVME2600_INT_PCI_VME0 */
705 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* MVME2600_INT_PCI_VME1 */
706 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* MVME2600_INT_PCI_VME2 */
707 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* MVME2600_INT_PCI_VME3 */
708 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* MVME2600_INT_PCI_INTA */
709 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* MVME2600_INT_PCI_INTB */
710 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* MVME2600_INT_PCI_INTC */
711 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* MVME2600_INT_PCI_INTD */
712 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* MVME2600_INT_LM_SIG0 */
713 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* MVME2600_INT_LM_SIG1 */
714};
715
716#define MOT_RAVEN_PRESENT 0x1
717#define MOT_HAWK_PRESENT 0x2
718
719int mot_entry = -1;
720int prep_keybd_present = 1;
721int MotMPIC;
722int mot_multi;
723
724int __init
725raven_init(void)
726{
727 unsigned int devid;
728 unsigned int pci_membase;
729 unsigned char base_mod;
730
731 /* Check to see if the Raven chip exists. */
732 if ( _prep_type != _PREP_Motorola) {
733 OpenPIC_Addr = NULL;
734 return 0;
735 }
736
737 /* Check to see if this board is a type that might have a Raven. */
738 if ((inb(MOTOROLA_CPUTYPE_REG) & 0xF0) != 0xE0) {
739 OpenPIC_Addr = NULL;
740 return 0;
741 }
742
743 /* Check the first PCI device to see if it is a Raven. */
744 early_read_config_dword(NULL, 0, 0, PCI_VENDOR_ID, &devid);
745
746 switch (devid & 0xffff0000) {
747 case MPIC_RAVEN_ID:
748 MotMPIC = MOT_RAVEN_PRESENT;
749 break;
750 case MPIC_HAWK_ID:
751 MotMPIC = MOT_HAWK_PRESENT;
752 break;
753 default:
754 OpenPIC_Addr = NULL;
755 return 0;
756 }
757
758
759 /* Read the memory base register. */
760 early_read_config_dword(NULL, 0, 0, PCI_BASE_ADDRESS_1, &pci_membase);
761
762 if (pci_membase == 0) {
763 OpenPIC_Addr = NULL;
764 return 0;
765 }
766
767 /* Map the Raven MPIC registers to virtual memory. */
768 OpenPIC_Addr = ioremap(pci_membase+0xC0000000, 0x22000);
769
770 OpenPIC_InitSenses = prep_openpic_initsenses;
771 OpenPIC_NumInitSenses = sizeof(prep_openpic_initsenses);
772
773 ppc_md.get_irq = openpic_get_irq;
774
775 /* If raven is present on Motorola store the system config register
776 * for later use.
777 */
778 ProcInfo = (unsigned long *)ioremap(0xfef80400, 4);
779
780 /* Indicate to system if this is a multiprocessor board */
781 if (!(*ProcInfo & MOT_PROC2_BIT)) {
782 mot_multi = 1;
783 }
784
785 /* This is a hack. If this is a 2300 or 2400 mot board then there is
786 * no keyboard controller and we have to indicate that.
787 */
788 base_mod = inb(MOTOROLA_BASETYPE_REG);
789 if ((MotMPIC == MOT_HAWK_PRESENT) || (base_mod == 0xF9) ||
790 (base_mod == 0xFA) || (base_mod == 0xE1))
791 prep_keybd_present = 0;
792
793 return 1;
794}
795
796struct mot_info {
797 int cpu_type; /* 0x100 mask assumes for Raven and Hawk boards that the level/edge are set */
798 /* 0x200 if this board has a Hawk chip. */
799 int base_type;
800 int max_cpu; /* ored with 0x80 if this board should be checked for multi CPU */
801 const char *name;
802 unsigned char *map;
803 unsigned char *routes;
804 void (*map_non0_bus)(struct pci_dev *); /* For boards with more than bus 0 devices. */
805 struct powerplus_irq_list *pci_irq_list; /* List of PCI MPIC inputs */
806 unsigned char secondary_bridge_devfn; /* devfn of secondary bus transparent bridge */
807} mot_info[] __prepdata = {
808 {0x300, 0x00, 0x00, "MVME 2400", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0xFF},
809 {0x010, 0x00, 0x00, "Genesis", Genesis_pci_IRQ_map, Genesis_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
810 {0x020, 0x00, 0x00, "Powerstack (Series E)", Comet_pci_IRQ_map, Comet_pci_IRQ_routes, NULL, NULL, 0x00},
811 {0x040, 0x00, 0x00, "Blackhawk (Powerstack)", Blackhawk_pci_IRQ_map, Blackhawk_pci_IRQ_routes, NULL, NULL, 0x00},
812 {0x050, 0x00, 0x00, "Omaha (PowerStack II Pro3000)", Omaha_pci_IRQ_map, Omaha_pci_IRQ_routes, NULL, NULL, 0x00},
813 {0x060, 0x00, 0x00, "Utah (Powerstack II Pro4000)", Utah_pci_IRQ_map, Utah_pci_IRQ_routes, NULL, NULL, 0x00},
814 {0x0A0, 0x00, 0x00, "Powerstack (Series EX)", Comet2_pci_IRQ_map, Comet2_pci_IRQ_routes, NULL, NULL, 0x00},
815 {0x1E0, 0xE0, 0x00, "Mesquite cPCI (MCP750)", Mesquite_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Mesquite_pci_IRQ_list, 0xFF},
816 {0x1E0, 0xE1, 0x00, "Sitka cPCI (MCPN750)", Sitka_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0xFF},
817 {0x1E0, 0xE2, 0x00, "Mesquite cPCI (MCP750) w/ HAC", Mesquite_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Mesquite_pci_IRQ_list, 0xC0},
818 {0x1E0, 0xF6, 0x80, "MTX Plus", MTXplus_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0xA0},
819 {0x1E0, 0xF6, 0x81, "Dual MTX Plus", MTXplus_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0xA0},
820 {0x1E0, 0xF7, 0x80, "MTX wo/ Parallel Port", MTX_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
821 {0x1E0, 0xF7, 0x81, "Dual MTX wo/ Parallel Port", MTX_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
822 {0x1E0, 0xF8, 0x80, "MTX w/ Parallel Port", MTX_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
823 {0x1E0, 0xF8, 0x81, "Dual MTX w/ Parallel Port", MTX_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
824 {0x1E0, 0xF9, 0x00, "MVME 2300", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0xFF},
825 {0x1E0, 0xFA, 0x00, "MVME 2300SC/2600", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0xFF},
826 {0x1E0, 0xFB, 0x00, "MVME 2600 with MVME712M", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0xFF},
827 {0x1E0, 0xFC, 0x00, "MVME 2600/2700 with MVME761", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0xFF},
828 {0x1E0, 0xFD, 0x80, "MVME 3600 with MVME712M", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
829 {0x1E0, 0xFD, 0x81, "MVME 4600 with MVME712M", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0xFF},
830 {0x1E0, 0xFE, 0x80, "MVME 3600 with MVME761", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0xFF},
831 {0x1E0, 0xFE, 0x81, "MVME 4600 with MVME761", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0xFF},
832 {0x1E0, 0xFF, 0x00, "MVME 1600-001 or 1600-011", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0xFF},
833 {0x000, 0x00, 0x00, "", NULL, NULL, NULL, NULL, 0x00}
834};
835
836void __init
837ibm_prep_init(void)
838{
839 if (have_residual_data) {
840 u32 addr, real_addr, len, offset;
841 PPC_DEVICE *mpic;
842 PnP_TAG_PACKET *pkt;
843
844 /* Use the PReP residual data to determine if an OpenPIC is
845 * present. If so, get the large vendor packet which will
846 * tell us the base address and length in memory.
847 * If we are successful, ioremap the memory area and set
848 * OpenPIC_Addr (this indicates that the OpenPIC was found).
849 */
850 mpic = residual_find_device(-1, NULL, SystemPeripheral,
851 ProgrammableInterruptController, MPIC, 0);
852 if (!mpic)
853 return;
854
855 pkt = PnP_find_large_vendor_packet(res->DevicePnPHeap +
856 mpic->AllocatedOffset, 9, 0);
857
858 if (!pkt)
859 return;
860
861#define p pkt->L4_Pack.L4_Data.L4_PPCPack
862 if (p.PPCData[1] == 32) {
863 switch (p.PPCData[0]) {
864 case 1: offset = PREP_ISA_IO_BASE; break;
865 case 2: offset = PREP_ISA_MEM_BASE; break;
866 default: return; /* Not I/O or memory?? */
867 }
868 }
869 else
870 return; /* Not a 32-bit address */
871
872 real_addr = ld_le32((unsigned int *) (p.PPCData + 4));
873 if (real_addr == 0xffffffff)
874 return;
875
876 /* Adjust address to be as seen by CPU */
877 addr = real_addr + offset;
878
879 len = ld_le32((unsigned int *) (p.PPCData + 12));
880 if (!len)
881 return;
882#undef p
883 OpenPIC_Addr = ioremap(addr, len);
884 ppc_md.get_irq = openpic_get_irq;
885
886 OpenPIC_InitSenses = prep_openpic_initsenses;
887 OpenPIC_NumInitSenses = sizeof(prep_openpic_initsenses);
888
889 printk(KERN_INFO "MPIC at 0x%08x (0x%08x), length 0x%08x "
890 "mapped to 0x%p\n", addr, real_addr, len, OpenPIC_Addr);
891 }
892}
893
894static void __init
895ibm43p_pci_map_non0(struct pci_dev *dev)
896{
897 unsigned char intpin;
898 static unsigned char bridge_intrs[4] = { 3, 4, 5, 8 };
899
900 if (dev == NULL)
901 return;
902 pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &intpin);
903 if (intpin < 1 || intpin > 4)
904 return;
905 intpin = (PCI_SLOT(dev->devfn) + intpin - 1) & 3;
906 dev->irq = openpic_to_irq(bridge_intrs[intpin]);
907 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
908}
909
910void __init
911prep_residual_setup_pci(char *irq_edge_mask_lo, char *irq_edge_mask_hi)
912{
913 if (have_residual_data) {
914 Motherboard_map_name = res->VitalProductData.PrintableModel;
915 Motherboard_map = NULL;
916 Motherboard_routes = NULL;
917 residual_irq_mask(irq_edge_mask_lo, irq_edge_mask_hi);
918 }
919}
920
921void __init
922prep_sandalfoot_setup_pci(char *irq_edge_mask_lo, char *irq_edge_mask_hi)
923{
924 Motherboard_map_name = "IBM 6015/7020 (Sandalfoot/Sandalbow)";
925 Motherboard_map = ibm6015_pci_IRQ_map;
926 Motherboard_routes = ibm6015_pci_IRQ_routes;
927 *irq_edge_mask_lo = 0x00; /* irq's 0-7 all edge-triggered */
928 *irq_edge_mask_hi = 0xA0; /* irq's 13, 15 level-triggered */
929}
930
931void __init
932prep_thinkpad_setup_pci(char *irq_edge_mask_lo, char *irq_edge_mask_hi)
933{
934 Motherboard_map_name = "IBM Thinkpad 850/860";
935 Motherboard_map = Nobis_pci_IRQ_map;
936 Motherboard_routes = Nobis_pci_IRQ_routes;
937 *irq_edge_mask_lo = 0x00; /* irq's 0-7 all edge-triggered */
938 *irq_edge_mask_hi = 0xA0; /* irq's 13, 15 level-triggered */
939}
940
941void __init
942prep_carolina_setup_pci(char *irq_edge_mask_lo, char *irq_edge_mask_hi)
943{
944 Motherboard_map_name = "IBM 7248, PowerSeries 830/850 (Carolina)";
945 Motherboard_map = ibm8xx_pci_IRQ_map;
946 Motherboard_routes = ibm8xx_pci_IRQ_routes;
947 *irq_edge_mask_lo = 0x00; /* irq's 0-7 all edge-triggered */
948 *irq_edge_mask_hi = 0xA4; /* irq's 10, 13, 15 level-triggered */
949}
950
951void __init
952prep_tiger1_setup_pci(char *irq_edge_mask_lo, char *irq_edge_mask_hi)
953{
954 Motherboard_map_name = "IBM 43P-140 (Tiger1)";
955 Motherboard_map = ibm43p_pci_IRQ_map;
956 Motherboard_routes = ibm43p_pci_IRQ_routes;
957 Motherboard_non0 = ibm43p_pci_map_non0;
958 *irq_edge_mask_lo = 0x00; /* irq's 0-7 all edge-triggered */
959 *irq_edge_mask_hi = 0xA0; /* irq's 13, 15 level-triggered */
960}
961
962void __init
963prep_route_pci_interrupts(void)
964{
965 unsigned char *ibc_pirq = (unsigned char *)0x80800860;
966 unsigned char *ibc_pcicon = (unsigned char *)0x80800840;
967 int i;
968
969 if ( _prep_type == _PREP_Motorola)
970 {
971 unsigned short irq_mode;
972 unsigned char cpu_type;
973 unsigned char base_mod;
974 int entry;
975
976 cpu_type = inb(MOTOROLA_CPUTYPE_REG) & 0xF0;
977 base_mod = inb(MOTOROLA_BASETYPE_REG);
978
979 for (entry = 0; mot_info[entry].cpu_type != 0; entry++) {
980 if (mot_info[entry].cpu_type & 0x200) { /* Check for Hawk chip */
981 if (!(MotMPIC & MOT_HAWK_PRESENT))
982 continue;
983 } else { /* Check non hawk boards */
984 if ((mot_info[entry].cpu_type & 0xff) != cpu_type)
985 continue;
986
987 if (mot_info[entry].base_type == 0) {
988 mot_entry = entry;
989 break;
990 }
991
992 if (mot_info[entry].base_type != base_mod)
993 continue;
994 }
995
996 if (!(mot_info[entry].max_cpu & 0x80)) {
997 mot_entry = entry;
998 break;
999 }
1000
1001 /* processor 1 not present and max processor zero indicated */
1002 if ((*ProcInfo & MOT_PROC2_BIT) && !(mot_info[entry].max_cpu & 0x7f)) {
1003 mot_entry = entry;
1004 break;
1005 }
1006
1007 /* processor 1 present and max processor zero indicated */
1008 if (!(*ProcInfo & MOT_PROC2_BIT) && (mot_info[entry].max_cpu & 0x7f)) {
1009 mot_entry = entry;
1010 break;
1011 }
1012 }
1013
1014 if (mot_entry == -1) /* No particular cpu type found - assume Blackhawk */
1015 mot_entry = 3;
1016
1017 Motherboard_map_name = (unsigned char *)mot_info[mot_entry].name;
1018 Motherboard_map = mot_info[mot_entry].map;
1019 Motherboard_routes = mot_info[mot_entry].routes;
1020 Motherboard_non0 = mot_info[mot_entry].map_non0_bus;
1021
1022 if (!(mot_info[entry].cpu_type & 0x100)) {
1023 /* AJF adjust level/edge control according to routes */
1024 irq_mode = 0;
1025 for (i = 1; i <= 4; i++)
1026 irq_mode |= ( 1 << Motherboard_routes[i] );
1027 outb( irq_mode & 0xff, 0x4d0 );
1028 outb( (irq_mode >> 8) & 0xff, 0x4d1 );
1029 }
1030 } else if ( _prep_type == _PREP_IBM ) {
1031 unsigned char irq_edge_mask_lo, irq_edge_mask_hi;
1032 unsigned short irq_edge_mask;
1033 int i;
1034
1035 setup_ibm_pci(&irq_edge_mask_lo, &irq_edge_mask_hi);
1036
1037 outb(inb(0x04d0)|irq_edge_mask_lo, 0x4d0); /* primary 8259 */
1038 outb(inb(0x04d1)|irq_edge_mask_hi, 0x4d1); /* cascaded 8259 */
1039
1040 irq_edge_mask = (irq_edge_mask_hi << 8) | irq_edge_mask_lo;
1041 for (i = 0; i < 16; ++i, irq_edge_mask >>= 1)
1042 if (irq_edge_mask & 1)
1043 irq_desc[i].status |= IRQ_LEVEL;
1044 } else {
1045 printk("No known machine pci routing!\n");
1046 return;
1047 }
1048
1049 /* Set up mapping from slots */
1050 if (Motherboard_routes) {
1051 for (i = 1; i <= 4; i++)
1052 ibc_pirq[i-1] = Motherboard_routes[i];
1053
1054 /* Enable PCI interrupts */
1055 *ibc_pcicon |= 0x20;
1056 }
1057}
1058
1059void __init
1060prep_pib_init(void)
1061{
1062 unsigned char reg;
1063 unsigned short short_reg;
1064
1065 struct pci_dev *dev = NULL;
1066
1067 if (( _prep_type == _PREP_Motorola) && (OpenPIC_Addr)) {
1068 /*
1069 * Perform specific configuration for the Via Tech or
1070 * or Winbond PCI-ISA-Bridge part.
1071 */
1072 if ((dev = pci_get_device(PCI_VENDOR_ID_VIA,
1073 PCI_DEVICE_ID_VIA_82C586_1, dev))) {
1074 /*
1075 * PPCBUG does not set the enable bits
1076 * for the IDE device. Force them on here.
1077 */
1078 pci_read_config_byte(dev, 0x40, &reg);
1079
1080 reg |= 0x03; /* IDE: Chip Enable Bits */
1081 pci_write_config_byte(dev, 0x40, reg);
1082 }
1083 if ((dev = pci_get_device(PCI_VENDOR_ID_VIA,
1084 PCI_DEVICE_ID_VIA_82C586_2,
1085 dev)) && (dev->devfn = 0x5a)) {
1086 /* Force correct USB interrupt */
1087 dev->irq = 11;
1088 pci_write_config_byte(dev,
1089 PCI_INTERRUPT_LINE,
1090 dev->irq);
1091 }
1092 if ((dev = pci_get_device(PCI_VENDOR_ID_WINBOND,
1093 PCI_DEVICE_ID_WINBOND_83C553, dev))) {
1094 /* Clear PCI Interrupt Routing Control Register. */
1095 short_reg = 0x0000;
1096 pci_write_config_word(dev, 0x44, short_reg);
1097 if (OpenPIC_Addr){
1098 /* Route IDE interrupts to IRQ 14 */
1099 reg = 0xEE;
1100 pci_write_config_byte(dev, 0x43, reg);
1101 }
1102 }
1103 pci_dev_put(dev);
1104 }
1105
1106 if ((dev = pci_get_device(PCI_VENDOR_ID_WINBOND,
1107 PCI_DEVICE_ID_WINBOND_82C105, dev))){
1108 if (OpenPIC_Addr){
1109 /*
1110 * Disable LEGIRQ mode so PCI INTS are routed
1111 * directly to the 8259 and enable both channels
1112 */
1113 pci_write_config_dword(dev, 0x40, 0x10ff0033);
1114
1115 /* Force correct IDE interrupt */
1116 dev->irq = 14;
1117 pci_write_config_byte(dev,
1118 PCI_INTERRUPT_LINE,
1119 dev->irq);
1120 } else {
1121 /* Enable LEGIRQ for PCI INT -> 8259 IRQ routing */
1122 pci_write_config_dword(dev, 0x40, 0x10ff08a1);
1123 }
1124 }
1125 pci_dev_put(dev);
1126}
1127
1128static void __init
1129Powerplus_Map_Non0(struct pci_dev *dev)
1130{
1131 struct pci_bus *pbus; /* Parent bus structure pointer */
1132 struct pci_dev *tdev = dev; /* Temporary device structure */
1133 unsigned int devnum; /* Accumulated device number */
1134 unsigned char intline; /* Linux interrupt value */
1135 unsigned char intpin; /* PCI interrupt pin */
1136
1137 /* Check for valid PCI dev pointer */
1138 if (dev == NULL) return;
1139
1140 /* Initialize bridge IDSEL variable */
1141 devnum = PCI_SLOT(tdev->devfn);
1142
1143 /* Read the interrupt pin of the device and adjust for indexing */
1144 pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &intpin);
1145
1146 /* If device doesn't request an interrupt, return */
1147 if ( (intpin < 1) || (intpin > 4) )
1148 return;
1149
1150 intpin--;
1151
1152 /*
1153 * Walk up to bus 0, adjusting the interrupt pin for the standard
1154 * PCI bus swizzle.
1155 */
1156 do {
1157 intpin = (prep_pci_intpins[devnum % 4][intpin]) - 1;
1158 pbus = tdev->bus; /* up one level */
1159 tdev = pbus->self;
1160 devnum = PCI_SLOT(tdev->devfn);
1161 } while(tdev->bus->number);
1162
1163 /* Use the primary interrupt inputs by default */
1164 intline = mot_info[mot_entry].pci_irq_list->primary[intpin];
1165
1166 /*
1167 * If the board has secondary interrupt inputs, walk the bus and
1168 * note the devfn of the bridge from bus 0. If it is the same as
1169 * the devfn of the bus bridge with secondary inputs, use those.
1170 * Otherwise, assume it's a PMC site and get the interrupt line
1171 * value from the interrupt routing table.
1172 */
1173 if (mot_info[mot_entry].secondary_bridge_devfn) {
1174 pbus = dev->bus;
1175
1176 while (pbus->primary != 0)
1177 pbus = pbus->parent;
1178
1179 if ((pbus->self)->devfn != 0xA0) {
1180 if ((pbus->self)->devfn == mot_info[mot_entry].secondary_bridge_devfn)
1181 intline = mot_info[mot_entry].pci_irq_list->secondary[intpin];
1182 else {
1183 if ((char *)(mot_info[mot_entry].map) == (char *)Mesquite_pci_IRQ_map)
1184 intline = mot_info[mot_entry].map[((pbus->self)->devfn)/8] + 16;
1185 else {
1186 int i;
1187 for (i=0;i<3;i++)
1188 intpin = (prep_pci_intpins[devnum % 4][intpin]) - 1;
1189 intline = mot_info[mot_entry].pci_irq_list->primary[intpin];
1190 }
1191 }
1192 }
1193 }
1194
1195 /* Write calculated interrupt value to header and device list */
1196 dev->irq = intline;
1197 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, (u8)dev->irq);
1198}
1199
1200void __init
1201prep_pcibios_fixup(void)
1202{
1203 struct pci_dev *dev = NULL;
1204 int irq;
1205 int have_openpic = (OpenPIC_Addr != NULL);
1206
1207 prep_route_pci_interrupts();
1208
1209 printk("Setting PCI interrupts for a \"%s\"\n", Motherboard_map_name);
1210
1211 /* Iterate through all the PCI devices, setting the IRQ */
1212 for_each_pci_dev(dev) {
1213 /*
1214 * If we have residual data, then this is easy: query the
1215 * residual data for the IRQ line allocated to the device.
1216 * This works the same whether we have an OpenPic or not.
1217 */
1218 if (have_residual_data) {
1219 irq = residual_pcidev_irq(dev);
1220 dev->irq = have_openpic ? openpic_to_irq(irq) : irq;
1221 }
1222 /*
1223 * If we don't have residual data, then we need to use
1224 * tables to determine the IRQ. The table organisation
1225 * is different depending on whether there is an OpenPIC
1226 * or not. The tables are only used for bus 0, so check
1227 * this first.
1228 */
1229 else if (dev->bus->number == 0) {
1230 irq = Motherboard_map[PCI_SLOT(dev->devfn)];
1231 dev->irq = have_openpic ? openpic_to_irq(irq)
1232 : Motherboard_routes[irq];
1233 }
1234 /*
1235 * Finally, if we don't have residual data and the bus is
1236 * non-zero, use the callback (if provided)
1237 */
1238 else {
1239 if (Motherboard_non0 != NULL)
1240 Motherboard_non0(dev);
1241
1242 continue;
1243 }
1244
1245 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
1246 }
1247
1248 /* Setup the Winbond or Via PIB */
1249 prep_pib_init();
1250}
1251
1252static void __init
1253prep_pcibios_after_init(void)
1254{
1255#if 0
1256 struct pci_dev *dev;
1257
1258 /* If there is a WD 90C, reset the IO BAR to 0x0 (it started that
1259 * way, but the PCI layer relocated it because it thought 0x0 was
1260 * invalid for a BAR).
1261 * If you don't do this, the card's VGA base will be <IO BAR>+0xc0000
1262 * instead of 0xc0000. vgacon.c (for example) is completely unaware of
1263 * this little quirk.
1264 */
1265 dev = pci_get_device(PCI_VENDOR_ID_WD, PCI_DEVICE_ID_WD_90C, NULL);
1266 if (dev) {
1267 dev->resource[1].end -= dev->resource[1].start;
1268 dev->resource[1].start = 0;
1269 /* tell the hardware */
1270 pci_write_config_dword(dev, PCI_BASE_ADDRESS_1, 0x0);
1271 pci_dev_put(dev);
1272 }
1273#endif
1274}
1275
1276static void __init
1277prep_init_resource(struct resource *res, unsigned long start,
1278 unsigned long end, int flags)
1279{
1280 res->flags = flags;
1281 res->start = start;
1282 res->end = end;
1283 res->name = "PCI host bridge";
1284 res->parent = NULL;
1285 res->sibling = NULL;
1286 res->child = NULL;
1287}
1288
1289void __init
1290prep_find_bridges(void)
1291{
1292 struct pci_controller* hose;
1293
1294 hose = pcibios_alloc_controller();
1295 if (!hose)
1296 return;
1297
1298 hose->first_busno = 0;
1299 hose->last_busno = 0xff;
1300 hose->pci_mem_offset = PREP_ISA_MEM_BASE;
1301 hose->io_base_phys = PREP_ISA_IO_BASE;
1302 hose->io_base_virt = ioremap(PREP_ISA_IO_BASE, 0x800000);
1303 prep_init_resource(&hose->io_resource, 0, 0x007fffff, IORESOURCE_IO);
1304 prep_init_resource(&hose->mem_resources[0], 0xc0000000, 0xfeffffff,
1305 IORESOURCE_MEM);
1306 setup_indirect_pci(hose, PREP_ISA_IO_BASE + 0xcf8,
1307 PREP_ISA_IO_BASE + 0xcfc);
1308
1309 printk("PReP architecture\n");
1310
1311 if (have_residual_data) {
1312 PPC_DEVICE *hostbridge;
1313
1314 hostbridge = residual_find_device(PROCESSORDEVICE, NULL,
1315 BridgeController, PCIBridge, -1, 0);
1316 if (hostbridge &&
1317 ((hostbridge->DeviceId.Interface == PCIBridgeIndirect) ||
1318 (hostbridge->DeviceId.Interface == PCIBridgeRS6K))) {
1319 PnP_TAG_PACKET * pkt;
1320 pkt = PnP_find_large_vendor_packet(
1321 res->DevicePnPHeap+hostbridge->AllocatedOffset,
1322 3, 0);
1323 if(pkt) {
1324#define p pkt->L4_Pack.L4_Data.L4_PPCPack
1325 setup_indirect_pci(hose,
1326 ld_le32((unsigned *) (p.PPCData)),
1327 ld_le32((unsigned *) (p.PPCData+8)));
1328#undef p
1329 } else
1330 setup_indirect_pci(hose, 0x80000cf8, 0x80000cfc);
1331 }
1332 }
1333
1334 ppc_md.pcibios_fixup = prep_pcibios_fixup;
1335 ppc_md.pcibios_after_init = prep_pcibios_after_init;
1336}
diff --git a/arch/ppc/platforms/prep_setup.c b/arch/ppc/platforms/prep_setup.c
new file mode 100644
index 000000000000..bc926be95472
--- /dev/null
+++ b/arch/ppc/platforms/prep_setup.c
@@ -0,0 +1,1181 @@
1/*
2 * arch/ppc/platforms/setup.c
3 *
4 * Copyright (C) 1995 Linus Torvalds
5 * Adapted from 'alpha' version by Gary Thomas
6 * Modified by Cort Dougan (cort@cs.nmt.edu)
7 *
8 * Support for PReP (Motorola MTX/MVME)
9 * by Troy Benjegerdes (hozer@drgw.net)
10 */
11
12/*
13 * bootup setup stuff..
14 */
15
16#include <linux/config.h>
17#include <linux/delay.h>
18#include <linux/module.h>
19#include <linux/errno.h>
20#include <linux/sched.h>
21#include <linux/kernel.h>
22#include <linux/mm.h>
23#include <linux/stddef.h>
24#include <linux/unistd.h>
25#include <linux/ptrace.h>
26#include <linux/slab.h>
27#include <linux/user.h>
28#include <linux/a.out.h>
29#include <linux/tty.h>
30#include <linux/major.h>
31#include <linux/interrupt.h>
32#include <linux/reboot.h>
33#include <linux/init.h>
34#include <linux/initrd.h>
35#include <linux/ioport.h>
36#include <linux/console.h>
37#include <linux/timex.h>
38#include <linux/pci.h>
39#include <linux/ide.h>
40#include <linux/seq_file.h>
41#include <linux/root_dev.h>
42
43#include <asm/sections.h>
44#include <asm/mmu.h>
45#include <asm/processor.h>
46#include <asm/residual.h>
47#include <asm/io.h>
48#include <asm/pgtable.h>
49#include <asm/cache.h>
50#include <asm/dma.h>
51#include <asm/machdep.h>
52#include <asm/mc146818rtc.h>
53#include <asm/mk48t59.h>
54#include <asm/prep_nvram.h>
55#include <asm/raven.h>
56#include <asm/vga.h>
57#include <asm/time.h>
58#include <asm/mpc10x.h>
59#include <asm/i8259.h>
60#include <asm/open_pic.h>
61#include <asm/pci-bridge.h>
62#include <asm/todc.h>
63
64TODC_ALLOC();
65
66unsigned char ucSystemType;
67unsigned char ucBoardRev;
68unsigned char ucBoardRevMaj, ucBoardRevMin;
69
70extern unsigned char prep_nvram_read_val(int addr);
71extern void prep_nvram_write_val(int addr,
72 unsigned char val);
73extern unsigned char rs_nvram_read_val(int addr);
74extern void rs_nvram_write_val(int addr,
75 unsigned char val);
76extern void ibm_prep_init(void);
77
78extern void prep_find_bridges(void);
79
80int _prep_type;
81
82extern void prep_residual_setup_pci(char *irq_edge_mask_lo, char *irq_edge_mask_hi);
83extern void prep_sandalfoot_setup_pci(char *irq_edge_mask_lo, char *irq_edge_mask_hi);
84extern void prep_thinkpad_setup_pci(char *irq_edge_mask_lo, char *irq_edge_mask_hi);
85extern void prep_carolina_setup_pci(char *irq_edge_mask_lo, char *irq_edge_mask_hi);
86extern void prep_tiger1_setup_pci(char *irq_edge_mask_lo, char *irq_edge_mask_hi);
87
88
89#define cached_21 (((char *)(ppc_cached_irq_mask))[3])
90#define cached_A1 (((char *)(ppc_cached_irq_mask))[2])
91
92/* for the mac fs */
93dev_t boot_dev;
94
95#ifdef CONFIG_SOUND_CS4232
96long ppc_cs4232_dma, ppc_cs4232_dma2;
97#endif
98
99extern PTE *Hash, *Hash_end;
100extern unsigned long Hash_size, Hash_mask;
101extern int probingmem;
102extern unsigned long loops_per_jiffy;
103
104#ifdef CONFIG_SOUND_CS4232
105EXPORT_SYMBOL(ppc_cs4232_dma);
106EXPORT_SYMBOL(ppc_cs4232_dma2);
107#endif
108
109/* useful ISA ports */
110#define PREP_SYSCTL 0x81c
111/* present in the IBM reference design; possibly identical in Mot boxes: */
112#define PREP_IBM_SIMM_ID 0x803 /* SIMM size: 32 or 8 MiB */
113#define PREP_IBM_SIMM_PRESENCE 0x804
114#define PREP_IBM_EQUIPMENT 0x80c
115#define PREP_IBM_L2INFO 0x80d
116#define PREP_IBM_PM1 0x82a /* power management register 1 */
117#define PREP_IBM_PLANAR 0x852 /* planar ID - identifies the motherboard */
118#define PREP_IBM_DISP 0x8c0 /* 4-digit LED display */
119
120/* Equipment Present Register masks: */
121#define PREP_IBM_EQUIPMENT_RESERVED 0x80
122#define PREP_IBM_EQUIPMENT_SCSIFUSE 0x40
123#define PREP_IBM_EQUIPMENT_L2_COPYBACK 0x08
124#define PREP_IBM_EQUIPMENT_L2_256 0x04
125#define PREP_IBM_EQUIPMENT_CPU 0x02
126#define PREP_IBM_EQUIPMENT_L2 0x01
127
128/* planar ID values: */
129/* Sandalfoot/Sandalbow (6015/7020) */
130#define PREP_IBM_SANDALFOOT 0xfc
131/* Woodfield, Thinkpad 850/860 (6042/7249) */
132#define PREP_IBM_THINKPAD 0xff /* planar ID unimplemented */
133/* PowerSeries 830/850 (6050/6070) */
134#define PREP_IBM_CAROLINA_IDE_0 0xf0
135#define PREP_IBM_CAROLINA_IDE_1 0xf1
136#define PREP_IBM_CAROLINA_IDE_2 0xf2
137#define PREP_IBM_CAROLINA_IDE_3 0xf3
138/* 7248-43P */
139#define PREP_IBM_CAROLINA_SCSI_0 0xf4
140#define PREP_IBM_CAROLINA_SCSI_1 0xf5
141#define PREP_IBM_CAROLINA_SCSI_2 0xf6
142#define PREP_IBM_CAROLINA_SCSI_3 0xf7 /* missing from Carolina Tech Spec */
143/* Tiger1 (7043-140) */
144#define PREP_IBM_TIGER1_133 0xd1
145#define PREP_IBM_TIGER1_166 0xd2
146#define PREP_IBM_TIGER1_180 0xd3
147#define PREP_IBM_TIGER1_xxx 0xd4 /* unknown, but probably exists */
148#define PREP_IBM_TIGER1_333 0xd5 /* missing from Tiger Tech Spec */
149
150/* setup_ibm_pci:
151 * set Motherboard_map_name, Motherboard_map, Motherboard_routes.
152 * return 8259 edge/level masks.
153 */
154void (*setup_ibm_pci)(char *irq_lo, char *irq_hi);
155
156extern char *Motherboard_map_name; /* for use in *_cpuinfo */
157
158/*
159 * As found in the PReP reference implementation.
160 * Used by Thinkpad, Sandalfoot (6015/7020), and all Motorola PReP.
161 */
162static void __init
163prep_gen_enable_l2(void)
164{
165 outb(inb(PREP_SYSCTL) | 0x3, PREP_SYSCTL);
166}
167
168/* Used by Carolina and Tiger1 */
169static void __init
170prep_carolina_enable_l2(void)
171{
172 outb(inb(PREP_SYSCTL) | 0xc0, PREP_SYSCTL);
173}
174
175/* cpuinfo code common to all IBM PReP */
176static void __prep
177prep_ibm_cpuinfo(struct seq_file *m)
178{
179 unsigned int equip_reg = inb(PREP_IBM_EQUIPMENT);
180
181 seq_printf(m, "machine\t\t: PReP %s\n", Motherboard_map_name);
182
183 seq_printf(m, "upgrade cpu\t: ");
184 if (equip_reg & PREP_IBM_EQUIPMENT_CPU) {
185 seq_printf(m, "not ");
186 }
187 seq_printf(m, "present\n");
188
189 /* print info about the SCSI fuse */
190 seq_printf(m, "scsi fuse\t: ");
191 if (equip_reg & PREP_IBM_EQUIPMENT_SCSIFUSE)
192 seq_printf(m, "ok");
193 else
194 seq_printf(m, "bad");
195 seq_printf(m, "\n");
196
197 /* print info about SIMMs */
198 if (have_residual_data) {
199 int i;
200 seq_printf(m, "simms\t\t: ");
201 for (i = 0; (res->ActualNumMemories) && (i < MAX_MEMS); i++) {
202 if (res->Memories[i].SIMMSize != 0)
203 seq_printf(m, "%d:%ldMiB ", i,
204 (res->Memories[i].SIMMSize > 1024) ?
205 res->Memories[i].SIMMSize>>20 :
206 res->Memories[i].SIMMSize);
207 }
208 seq_printf(m, "\n");
209 }
210}
211
212static int __prep
213prep_gen_cpuinfo(struct seq_file *m)
214{
215 prep_ibm_cpuinfo(m);
216 return 0;
217}
218
219static int __prep
220prep_sandalfoot_cpuinfo(struct seq_file *m)
221{
222 unsigned int equip_reg = inb(PREP_IBM_EQUIPMENT);
223
224 prep_ibm_cpuinfo(m);
225
226 /* report amount and type of L2 cache present */
227 seq_printf(m, "L2 cache\t: ");
228 if (equip_reg & PREP_IBM_EQUIPMENT_L2) {
229 seq_printf(m, "not present");
230 } else {
231 if (equip_reg & PREP_IBM_EQUIPMENT_L2_256)
232 seq_printf(m, "256KiB");
233 else
234 seq_printf(m, "unknown size");
235
236 if (equip_reg & PREP_IBM_EQUIPMENT_L2_COPYBACK)
237 seq_printf(m, ", copy-back");
238 else
239 seq_printf(m, ", write-through");
240 }
241 seq_printf(m, "\n");
242
243 return 0;
244}
245
246static int __prep
247prep_thinkpad_cpuinfo(struct seq_file *m)
248{
249 unsigned int equip_reg = inb(PREP_IBM_EQUIPMENT);
250 char *cpubus_speed, *pci_speed;
251
252 prep_ibm_cpuinfo(m);
253
254 /* report amount and type of L2 cache present */
255 seq_printf(m, "l2 cache\t: ");
256 if ((equip_reg & 0x1) == 0) {
257 switch ((equip_reg & 0xc) >> 2) {
258 case 0x0:
259 seq_printf(m, "128KiB look-aside 2-way write-through\n");
260 break;
261 case 0x1:
262 seq_printf(m, "512KiB look-aside direct-mapped write-back\n");
263 break;
264 case 0x2:
265 seq_printf(m, "256KiB look-aside 2-way write-through\n");
266 break;
267 case 0x3:
268 seq_printf(m, "256KiB look-aside direct-mapped write-back\n");
269 break;
270 }
271 } else {
272 seq_printf(m, "not present\n");
273 }
274
275 /* report bus speeds because we can */
276 if ((equip_reg & 0x80) == 0) {
277 switch ((equip_reg & 0x30) >> 4) {
278 case 0x1:
279 cpubus_speed = "50";
280 pci_speed = "25";
281 break;
282 case 0x3:
283 cpubus_speed = "66";
284 pci_speed = "33";
285 break;
286 default:
287 cpubus_speed = "unknown";
288 pci_speed = "unknown";
289 break;
290 }
291 } else {
292 switch ((equip_reg & 0x30) >> 4) {
293 case 0x1:
294 cpubus_speed = "25";
295 pci_speed = "25";
296 break;
297 case 0x2:
298 cpubus_speed = "60";
299 pci_speed = "30";
300 break;
301 case 0x3:
302 cpubus_speed = "33";
303 pci_speed = "33";
304 break;
305 default:
306 cpubus_speed = "unknown";
307 pci_speed = "unknown";
308 break;
309 }
310 }
311 seq_printf(m, "60x bus\t\t: %sMHz\n", cpubus_speed);
312 seq_printf(m, "pci bus\t\t: %sMHz\n", pci_speed);
313
314 return 0;
315}
316
317static int __prep
318prep_carolina_cpuinfo(struct seq_file *m)
319{
320 unsigned int equip_reg = inb(PREP_IBM_EQUIPMENT);
321
322 prep_ibm_cpuinfo(m);
323
324 /* report amount and type of L2 cache present */
325 seq_printf(m, "l2 cache\t: ");
326 if ((equip_reg & 0x1) == 0) {
327 unsigned int l2_reg = inb(PREP_IBM_L2INFO);
328
329 /* L2 size */
330 if ((l2_reg & 0x60) == 0)
331 seq_printf(m, "256KiB");
332 else if ((l2_reg & 0x60) == 0x20)
333 seq_printf(m, "512KiB");
334 else
335 seq_printf(m, "unknown size");
336
337 /* L2 type */
338 if ((l2_reg & 0x3) == 0)
339 seq_printf(m, ", async");
340 else if ((l2_reg & 0x3) == 1)
341 seq_printf(m, ", sync");
342 else
343 seq_printf(m, ", unknown type");
344
345 seq_printf(m, "\n");
346 } else {
347 seq_printf(m, "not present\n");
348 }
349
350 return 0;
351}
352
353static int __prep
354prep_tiger1_cpuinfo(struct seq_file *m)
355{
356 unsigned int l2_reg = inb(PREP_IBM_L2INFO);
357
358 prep_ibm_cpuinfo(m);
359
360 /* report amount and type of L2 cache present */
361 seq_printf(m, "l2 cache\t: ");
362 if ((l2_reg & 0xf) == 0xf) {
363 seq_printf(m, "not present\n");
364 } else {
365 if (l2_reg & 0x8)
366 seq_printf(m, "async, ");
367 else
368 seq_printf(m, "sync burst, ");
369
370 if (l2_reg & 0x4)
371 seq_printf(m, "parity, ");
372 else
373 seq_printf(m, "no parity, ");
374
375 switch (l2_reg & 0x3) {
376 case 0x0:
377 seq_printf(m, "256KiB\n");
378 break;
379 case 0x1:
380 seq_printf(m, "512KiB\n");
381 break;
382 case 0x2:
383 seq_printf(m, "1MiB\n");
384 break;
385 default:
386 seq_printf(m, "unknown size\n");
387 break;
388 }
389 }
390
391 return 0;
392}
393
394
395/* Used by all Motorola PReP */
396static int __prep
397prep_mot_cpuinfo(struct seq_file *m)
398{
399 unsigned int cachew = *((unsigned char *)CACHECRBA);
400
401 seq_printf(m, "machine\t\t: PReP %s\n", Motherboard_map_name);
402
403 /* report amount and type of L2 cache present */
404 seq_printf(m, "l2 cache\t: ");
405 switch (cachew & L2CACHE_MASK) {
406 case L2CACHE_512KB:
407 seq_printf(m, "512KiB");
408 break;
409 case L2CACHE_256KB:
410 seq_printf(m, "256KiB");
411 break;
412 case L2CACHE_1MB:
413 seq_printf(m, "1MiB");
414 break;
415 case L2CACHE_NONE:
416 seq_printf(m, "none\n");
417 goto no_l2;
418 break;
419 default:
420 seq_printf(m, "%x\n", cachew);
421 }
422
423 seq_printf(m, ", parity %s",
424 (cachew & L2CACHE_PARITY)? "enabled" : "disabled");
425
426 seq_printf(m, " SRAM:");
427
428 switch ( ((cachew & 0xf0) >> 4) & ~(0x3) ) {
429 case 1: seq_printf(m, "synchronous, parity, flow-through\n");
430 break;
431 case 2: seq_printf(m, "asynchronous, no parity\n");
432 break;
433 case 3: seq_printf(m, "asynchronous, parity\n");
434 break;
435 default:seq_printf(m, "synchronous, pipelined, no parity\n");
436 break;
437 }
438
439no_l2:
440 /* print info about SIMMs */
441 if (have_residual_data) {
442 int i;
443 seq_printf(m, "simms\t\t: ");
444 for (i = 0; (res->ActualNumMemories) && (i < MAX_MEMS); i++) {
445 if (res->Memories[i].SIMMSize != 0)
446 seq_printf(m, "%d:%ldM ", i,
447 (res->Memories[i].SIMMSize > 1024) ?
448 res->Memories[i].SIMMSize>>20 :
449 res->Memories[i].SIMMSize);
450 }
451 seq_printf(m, "\n");
452 }
453
454 return 0;
455}
456
457static void __prep
458prep_restart(char *cmd)
459{
460#define PREP_SP92 0x92 /* Special Port 92 */
461 local_irq_disable(); /* no interrupts */
462
463 /* set exception prefix high - to the prom */
464 _nmask_and_or_msr(0, MSR_IP);
465
466 /* make sure bit 0 (reset) is a 0 */
467 outb( inb(PREP_SP92) & ~1L , PREP_SP92);
468 /* signal a reset to system control port A - soft reset */
469 outb( inb(PREP_SP92) | 1 , PREP_SP92);
470
471 while ( 1 ) ;
472 /* not reached */
473#undef PREP_SP92
474}
475
476static void __prep
477prep_halt(void)
478{
479 local_irq_disable(); /* no interrupts */
480
481 /* set exception prefix high - to the prom */
482 _nmask_and_or_msr(0, MSR_IP);
483
484 while ( 1 ) ;
485 /* not reached */
486}
487
488/* Carrera is the power manager in the Thinkpads. Unfortunately not much is
489 * known about it, so we can't power down.
490 */
491static void __prep
492prep_carrera_poweroff(void)
493{
494 prep_halt();
495}
496
497/*
498 * On most IBM PReP's, power management is handled by a Signetics 87c750
499 * behind the Utah component on the ISA bus. To access the 750 you must write
500 * a series of nibbles to port 0x82a (decoded by the Utah). This is described
501 * somewhat in the IBM Carolina Technical Specification.
502 * -Hollis
503 */
504static void __prep
505utah_sig87c750_setbit(unsigned int bytenum, unsigned int bitnum, int value)
506{
507 /*
508 * byte1: 0 0 0 1 0 d a5 a4
509 * byte2: 0 0 0 1 a3 a2 a1 a0
510 *
511 * d = the bit's value, enabled or disabled
512 * (a5 a4 a3) = the byte number, minus 20
513 * (a2 a1 a0) = the bit number
514 *
515 * example: set the 5th bit of byte 21 (21.5)
516 * a5 a4 a3 = 001 (byte 1)
517 * a2 a1 a0 = 101 (bit 5)
518 *
519 * byte1 = 0001 0100 (0x14)
520 * byte2 = 0001 1101 (0x1d)
521 */
522 unsigned char byte1=0x10, byte2=0x10;
523
524 /* the 750's '20.0' is accessed as '0.0' through Utah (which adds 20) */
525 bytenum -= 20;
526
527 byte1 |= (!!value) << 2; /* set d */
528 byte1 |= (bytenum >> 1) & 0x3; /* set a5, a4 */
529
530 byte2 |= (bytenum & 0x1) << 3; /* set a3 */
531 byte2 |= bitnum & 0x7; /* set a2, a1, a0 */
532
533 outb(byte1, PREP_IBM_PM1); /* first nibble */
534 mb();
535 udelay(100); /* important: let controller recover */
536
537 outb(byte2, PREP_IBM_PM1); /* second nibble */
538 mb();
539 udelay(100); /* important: let controller recover */
540}
541
542static void __prep
543prep_sig750_poweroff(void)
544{
545 /* tweak the power manager found in most IBM PRePs (except Thinkpads) */
546
547 local_irq_disable();
548 /* set exception prefix high - to the prom */
549 _nmask_and_or_msr(0, MSR_IP);
550
551 utah_sig87c750_setbit(21, 5, 1); /* set bit 21.5, "PMEXEC_OFF" */
552
553 while (1) ;
554 /* not reached */
555}
556
557static int __prep
558prep_show_percpuinfo(struct seq_file *m, int i)
559{
560 /* PREP's without residual data will give incorrect values here */
561 seq_printf(m, "clock\t\t: ");
562 if (have_residual_data)
563 seq_printf(m, "%ldMHz\n",
564 (res->VitalProductData.ProcessorHz > 1024) ?
565 res->VitalProductData.ProcessorHz / 1000000 :
566 res->VitalProductData.ProcessorHz);
567 else
568 seq_printf(m, "???\n");
569
570 return 0;
571}
572
573#ifdef CONFIG_SOUND_CS4232
574static long __init masktoint(unsigned int i)
575{
576 int t = -1;
577 while (i >> ++t)
578 ;
579 return (t-1);
580}
581
582/*
583 * ppc_cs4232_dma and ppc_cs4232_dma2 are used in include/asm/dma.h
584 * to distinguish sound dma-channels from others. This is because
585 * blocksize on 16 bit dma-channels 5,6,7 is 128k, but
586 * the cs4232.c uses 64k like on 8 bit dma-channels 0,1,2,3
587 */
588
589static void __init prep_init_sound(void)
590{
591 PPC_DEVICE *audiodevice = NULL;
592
593 /*
594 * Get the needed resource informations from residual data.
595 *
596 */
597 if (have_residual_data)
598 audiodevice = residual_find_device(~0, NULL,
599 MultimediaController, AudioController, -1, 0);
600
601 if (audiodevice != NULL) {
602 PnP_TAG_PACKET *pkt;
603
604 pkt = PnP_find_packet((unsigned char *)&res->DevicePnPHeap[audiodevice->AllocatedOffset],
605 S5_Packet, 0);
606 if (pkt != NULL)
607 ppc_cs4232_dma = masktoint(pkt->S5_Pack.DMAMask);
608 pkt = PnP_find_packet((unsigned char*)&res->DevicePnPHeap[audiodevice->AllocatedOffset],
609 S5_Packet, 1);
610 if (pkt != NULL)
611 ppc_cs4232_dma2 = masktoint(pkt->S5_Pack.DMAMask);
612 }
613
614 /*
615 * These are the PReP specs' defaults for the cs4231. We use these
616 * as fallback incase we don't have residual data.
617 * At least the IBM Thinkpad 850 with IDE DMA Channels at 6 and 7
618 * will use the other values.
619 */
620 if (audiodevice == NULL) {
621 switch (_prep_type) {
622 case _PREP_IBM:
623 ppc_cs4232_dma = 1;
624 ppc_cs4232_dma2 = -1;
625 break;
626 default:
627 ppc_cs4232_dma = 6;
628 ppc_cs4232_dma2 = 7;
629 }
630 }
631
632 /*
633 * Find a way to push these informations to the cs4232 driver
634 * Give it out with printk, when not in cmd_line?
635 * Append it to cmd_line and saved_command_line?
636 * Format is cs4232=io,irq,dma,dma2
637 */
638}
639#endif /* CONFIG_SOUND_CS4232 */
640
641/*
642 * Fill out screen_info according to the residual data. This allows us to use
643 * at least vesafb.
644 */
645static void __init
646prep_init_vesa(void)
647{
648#if (defined(CONFIG_FB_VGA16) || defined(CONFIG_FB_VGA16_MODULE) || \
649 defined(CONFIG_FB_VESA))
650 PPC_DEVICE *vgadev = NULL;
651
652 if (have_residual_data)
653 vgadev = residual_find_device(~0, NULL, DisplayController,
654 SVGAController, -1, 0);
655
656 if (vgadev != NULL) {
657 PnP_TAG_PACKET *pkt;
658
659 pkt = PnP_find_large_vendor_packet(
660 (unsigned char *)&res->DevicePnPHeap[vgadev->AllocatedOffset],
661 0x04, 0); /* 0x04 = Display Tag */
662 if (pkt != NULL) {
663 unsigned char *ptr = (unsigned char *)pkt;
664
665 if (ptr[4]) {
666 /* graphics mode */
667 screen_info.orig_video_isVGA = VIDEO_TYPE_VLFB;
668
669 screen_info.lfb_depth = ptr[4] * 8;
670
671 screen_info.lfb_width = swab16(*(short *)(ptr+6));
672 screen_info.lfb_height = swab16(*(short *)(ptr+8));
673 screen_info.lfb_linelength = swab16(*(short *)(ptr+10));
674
675 screen_info.lfb_base = swab32(*(long *)(ptr+12));
676 screen_info.lfb_size = swab32(*(long *)(ptr+20)) / 65536;
677 }
678 }
679 }
680#endif
681}
682
683/*
684 * Set DBAT 2 to access 0x80000000 so early progress messages will work
685 */
686static __inline__ void
687prep_set_bat(void)
688{
689 /* wait for all outstanding memory access to complete */
690 mb();
691
692 /* setup DBATs */
693 mtspr(SPRN_DBAT2U, 0x80001ffe);
694 mtspr(SPRN_DBAT2L, 0x8000002a);
695
696 /* wait for updates */
697 mb();
698}
699
700/*
701 * IBM 3-digit status LED
702 */
703static unsigned int ibm_statusled_base __prepdata;
704
705static void __prep
706ibm_statusled_progress(char *s, unsigned short hex);
707
708static int __prep
709ibm_statusled_panic(struct notifier_block *dummy1, unsigned long dummy2,
710 void * dummy3)
711{
712 ibm_statusled_progress(NULL, 0x505); /* SOS */
713 return NOTIFY_DONE;
714}
715
716static struct notifier_block ibm_statusled_block __prepdata = {
717 ibm_statusled_panic,
718 NULL,
719 INT_MAX /* try to do it first */
720};
721
722static void __prep
723ibm_statusled_progress(char *s, unsigned short hex)
724{
725 static int notifier_installed;
726 /*
727 * Progress uses 4 digits and we have only 3. So, we map 0xffff to
728 * 0xfff for display switch off. Out of range values are mapped to
729 * 0xeff, as I'm told 0xf00 and above are reserved for hardware codes.
730 * Install the panic notifier when the display is first switched off.
731 */
732 if (hex == 0xffff) {
733 hex = 0xfff;
734 if (!notifier_installed) {
735 ++notifier_installed;
736 notifier_chain_register(&panic_notifier_list,
737 &ibm_statusled_block);
738 }
739 }
740 else
741 if (hex > 0xfff)
742 hex = 0xeff;
743
744 mb();
745 outw(hex, ibm_statusled_base);
746}
747
748static void __init
749ibm_statusled_init(void)
750{
751 /*
752 * The IBM 3-digit LED display is specified in the residual data
753 * as an operator panel device, type "System Status LED". Find
754 * that device and determine its address. We validate all the
755 * other parameters on the off-chance another, similar device
756 * exists.
757 */
758 if (have_residual_data) {
759 PPC_DEVICE *led;
760 PnP_TAG_PACKET *pkt;
761
762 led = residual_find_device(~0, NULL, SystemPeripheral,
763 OperatorPanel, SystemStatusLED, 0);
764 if (!led)
765 return;
766
767 pkt = PnP_find_packet((unsigned char *)
768 &res->DevicePnPHeap[led->AllocatedOffset], S8_Packet, 0);
769 if (!pkt)
770 return;
771
772 if (pkt->S8_Pack.IOInfo != ISAAddr16bit)
773 return;
774 if (*(unsigned short *)pkt->S8_Pack.RangeMin !=
775 *(unsigned short *)pkt->S8_Pack.RangeMax)
776 return;
777 if (pkt->S8_Pack.IOAlign != 2)
778 return;
779 if (pkt->S8_Pack.IONum != 2)
780 return;
781
782 ibm_statusled_base = ld_le16((unsigned short *)
783 (pkt->S8_Pack.RangeMin));
784 ppc_md.progress = ibm_statusled_progress;
785 }
786}
787
788static void __init
789prep_setup_arch(void)
790{
791 unsigned char reg;
792 int is_ide=0;
793
794 /* init to some ~sane value until calibrate_delay() runs */
795 loops_per_jiffy = 50000000;
796
797 /* Lookup PCI host bridges */
798 prep_find_bridges();
799
800 /* Set up floppy in PS/2 mode */
801 outb(0x09, SIO_CONFIG_RA);
802 reg = inb(SIO_CONFIG_RD);
803 reg = (reg & 0x3F) | 0x40;
804 outb(reg, SIO_CONFIG_RD);
805 outb(reg, SIO_CONFIG_RD); /* Have to write twice to change! */
806
807 switch ( _prep_type )
808 {
809 case _PREP_IBM:
810 reg = inb(PREP_IBM_PLANAR);
811 printk(KERN_INFO "IBM planar ID: %02x", reg);
812 switch (reg) {
813 case PREP_IBM_SANDALFOOT:
814 prep_gen_enable_l2();
815 setup_ibm_pci = prep_sandalfoot_setup_pci;
816 ppc_md.power_off = prep_sig750_poweroff;
817 ppc_md.show_cpuinfo = prep_sandalfoot_cpuinfo;
818 break;
819 case PREP_IBM_THINKPAD:
820 prep_gen_enable_l2();
821 setup_ibm_pci = prep_thinkpad_setup_pci;
822 ppc_md.power_off = prep_carrera_poweroff;
823 ppc_md.show_cpuinfo = prep_thinkpad_cpuinfo;
824 break;
825 default:
826 if (have_residual_data) {
827 prep_gen_enable_l2();
828 setup_ibm_pci = prep_residual_setup_pci;
829 ppc_md.power_off = prep_halt;
830 ppc_md.show_cpuinfo = prep_gen_cpuinfo;
831 break;
832 }
833 else
834 printk(" - unknown! Assuming Carolina");
835 /* fall through */
836 case PREP_IBM_CAROLINA_IDE_0:
837 case PREP_IBM_CAROLINA_IDE_1:
838 case PREP_IBM_CAROLINA_IDE_2:
839 case PREP_IBM_CAROLINA_IDE_3:
840 is_ide = 1;
841 case PREP_IBM_CAROLINA_SCSI_0:
842 case PREP_IBM_CAROLINA_SCSI_1:
843 case PREP_IBM_CAROLINA_SCSI_2:
844 case PREP_IBM_CAROLINA_SCSI_3:
845 prep_carolina_enable_l2();
846 setup_ibm_pci = prep_carolina_setup_pci;
847 ppc_md.power_off = prep_sig750_poweroff;
848 ppc_md.show_cpuinfo = prep_carolina_cpuinfo;
849 break;
850 case PREP_IBM_TIGER1_133:
851 case PREP_IBM_TIGER1_166:
852 case PREP_IBM_TIGER1_180:
853 case PREP_IBM_TIGER1_xxx:
854 case PREP_IBM_TIGER1_333:
855 prep_carolina_enable_l2();
856 setup_ibm_pci = prep_tiger1_setup_pci;
857 ppc_md.power_off = prep_sig750_poweroff;
858 ppc_md.show_cpuinfo = prep_tiger1_cpuinfo;
859 break;
860 }
861 printk("\n");
862
863 /* default root device */
864 if (is_ide)
865 ROOT_DEV = MKDEV(IDE0_MAJOR, 3);
866 else
867 ROOT_DEV = MKDEV(SCSI_DISK0_MAJOR, 3);
868
869 break;
870 case _PREP_Motorola:
871 prep_gen_enable_l2();
872 ppc_md.power_off = prep_halt;
873 ppc_md.show_cpuinfo = prep_mot_cpuinfo;
874
875#ifdef CONFIG_BLK_DEV_INITRD
876 if (initrd_start)
877 ROOT_DEV = Root_RAM0;
878 else
879#endif
880#ifdef CONFIG_ROOT_NFS
881 ROOT_DEV = Root_NFS;
882#else
883 ROOT_DEV = Root_SDA2;
884#endif
885 break;
886 }
887
888 /* Read in NVRAM data */
889 init_prep_nvram();
890
891 /* if no bootargs, look in NVRAM */
892 if ( cmd_line[0] == '\0' ) {
893 char *bootargs;
894 bootargs = prep_nvram_get_var("bootargs");
895 if (bootargs != NULL) {
896 strcpy(cmd_line, bootargs);
897 /* again.. */
898 strcpy(saved_command_line, cmd_line);
899 }
900 }
901
902#ifdef CONFIG_SOUND_CS4232
903 prep_init_sound();
904#endif /* CONFIG_SOUND_CS4232 */
905
906 prep_init_vesa();
907
908 switch (_prep_type) {
909 case _PREP_Motorola:
910 raven_init();
911 break;
912 case _PREP_IBM:
913 ibm_prep_init();
914 break;
915 }
916
917#ifdef CONFIG_VGA_CONSOLE
918 /* vgacon.c needs to know where we mapped IO memory in io_block_mapping() */
919 vgacon_remap_base = 0xf0000000;
920 conswitchp = &vga_con;
921#endif
922}
923
924/*
925 * First, see if we can get this information from the residual data.
926 * This is important on some IBM PReP systems. If we cannot, we let the
927 * TODC code handle doing this.
928 */
929static void __init
930prep_calibrate_decr(void)
931{
932 if (have_residual_data) {
933 unsigned long freq, divisor = 4;
934
935 if ( res->VitalProductData.ProcessorBusHz ) {
936 freq = res->VitalProductData.ProcessorBusHz;
937 printk("time_init: decrementer frequency = %lu.%.6lu MHz\n",
938 (freq/divisor)/1000000,
939 (freq/divisor)%1000000);
940 tb_to_us = mulhwu_scale_factor(freq/divisor, 1000000);
941 tb_ticks_per_jiffy = freq / HZ / divisor;
942 }
943 }
944 else
945 todc_calibrate_decr();
946}
947
948static unsigned int __prep
949prep_irq_canonicalize(u_int irq)
950{
951 if (irq == 2)
952 {
953 return 9;
954 }
955 else
956 {
957 return irq;
958 }
959}
960
961static void __init
962prep_init_IRQ(void)
963{
964 int i;
965 unsigned int pci_viddid, pci_did;
966
967 if (OpenPIC_Addr != NULL) {
968 openpic_init(NUM_8259_INTERRUPTS);
969 /* We have a cascade on OpenPIC IRQ 0, Linux IRQ 16 */
970 openpic_hookup_cascade(NUM_8259_INTERRUPTS, "82c59 cascade",
971 i8259_irq);
972 }
973 for ( i = 0 ; i < NUM_8259_INTERRUPTS ; i++ )
974 irq_desc[i].handler = &i8259_pic;
975
976 if (have_residual_data) {
977 i8259_init(residual_isapic_addr());
978 return;
979 }
980
981 /* If we have a Raven PCI bridge or a Hawk PCI bridge / Memory
982 * controller, we poll (as they have a different int-ack address). */
983 early_read_config_dword(NULL, 0, 0, PCI_VENDOR_ID, &pci_viddid);
984 pci_did = (pci_viddid & 0xffff0000) >> 16;
985 if (((pci_viddid & 0xffff) == PCI_VENDOR_ID_MOTOROLA)
986 && ((pci_did == PCI_DEVICE_ID_MOTOROLA_RAVEN)
987 || (pci_did == PCI_DEVICE_ID_MOTOROLA_HAWK)))
988 i8259_init(0);
989 else
990 /* PCI interrupt ack address given in section 6.1.8 of the
991 * PReP specification. */
992 i8259_init(MPC10X_MAPA_PCI_INTACK_ADDR);
993}
994
995#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
996/*
997 * IDE stuff.
998 */
999static int __prep
1000prep_ide_default_irq(unsigned long base)
1001{
1002 switch (base) {
1003 case 0x1f0: return 13;
1004 case 0x170: return 13;
1005 case 0x1e8: return 11;
1006 case 0x168: return 10;
1007 case 0xfff0: return 14; /* MCP(N)750 ide0 */
1008 case 0xffe0: return 15; /* MCP(N)750 ide1 */
1009 default: return 0;
1010 }
1011}
1012
1013static unsigned long __prep
1014prep_ide_default_io_base(int index)
1015{
1016 switch (index) {
1017 case 0: return 0x1f0;
1018 case 1: return 0x170;
1019 case 2: return 0x1e8;
1020 case 3: return 0x168;
1021 default:
1022 return 0;
1023 }
1024}
1025#endif
1026
1027#ifdef CONFIG_SMP
1028/* PReP (MTX) support */
1029static int __init
1030smp_prep_probe(void)
1031{
1032 extern int mot_multi;
1033
1034 if (mot_multi) {
1035 openpic_request_IPIs();
1036 smp_hw_index[1] = 1;
1037 return 2;
1038 }
1039
1040 return 1;
1041}
1042
1043static void __init
1044smp_prep_kick_cpu(int nr)
1045{
1046 *(unsigned long *)KERNELBASE = nr;
1047 asm volatile("dcbf 0,%0"::"r"(KERNELBASE):"memory");
1048 printk("CPU1 released, waiting\n");
1049}
1050
1051static void __init
1052smp_prep_setup_cpu(int cpu_nr)
1053{
1054 if (OpenPIC_Addr)
1055 do_openpic_setup_cpu();
1056}
1057
1058static struct smp_ops_t prep_smp_ops __prepdata = {
1059 smp_openpic_message_pass,
1060 smp_prep_probe,
1061 smp_prep_kick_cpu,
1062 smp_prep_setup_cpu,
1063 .give_timebase = smp_generic_give_timebase,
1064 .take_timebase = smp_generic_take_timebase,
1065};
1066#endif /* CONFIG_SMP */
1067
1068/*
1069 * Setup the bat mappings we're going to load that cover
1070 * the io areas. RAM was mapped by mapin_ram().
1071 * -- Cort
1072 */
1073static void __init
1074prep_map_io(void)
1075{
1076 io_block_mapping(0x80000000, PREP_ISA_IO_BASE, 0x10000000, _PAGE_IO);
1077 io_block_mapping(0xf0000000, PREP_ISA_MEM_BASE, 0x08000000, _PAGE_IO);
1078}
1079
1080static int __init
1081prep_request_io(void)
1082{
1083 if (_machine == _MACH_prep) {
1084#ifdef CONFIG_NVRAM
1085 request_region(PREP_NVRAM_AS0, 0x8, "nvram");
1086#endif
1087 request_region(0x00,0x20,"dma1");
1088 request_region(0x40,0x20,"timer");
1089 request_region(0x80,0x10,"dma page reg");
1090 request_region(0xc0,0x20,"dma2");
1091 }
1092
1093 return 0;
1094}
1095
1096device_initcall(prep_request_io);
1097
1098void __init
1099prep_init(unsigned long r3, unsigned long r4, unsigned long r5,
1100 unsigned long r6, unsigned long r7)
1101{
1102#ifdef CONFIG_PREP_RESIDUAL
1103 /* make a copy of residual data */
1104 if ( r3 ) {
1105 memcpy((void *)res,(void *)(r3+KERNELBASE),
1106 sizeof(RESIDUAL));
1107 }
1108#endif
1109
1110 isa_io_base = PREP_ISA_IO_BASE;
1111 isa_mem_base = PREP_ISA_MEM_BASE;
1112 pci_dram_offset = PREP_PCI_DRAM_OFFSET;
1113 ISA_DMA_THRESHOLD = 0x00ffffff;
1114 DMA_MODE_READ = 0x44;
1115 DMA_MODE_WRITE = 0x48;
1116
1117 /* figure out what kind of prep workstation we are */
1118 if (have_residual_data) {
1119 if ( !strncmp(res->VitalProductData.PrintableModel,"IBM",3) )
1120 _prep_type = _PREP_IBM;
1121 else
1122 _prep_type = _PREP_Motorola;
1123 }
1124 else {
1125 /* assume motorola if no residual (netboot?) */
1126 _prep_type = _PREP_Motorola;
1127 }
1128
1129#ifdef CONFIG_PREP_RESIDUAL
1130 /* Switch off all residual data processing if the user requests it */
1131 if (strstr(cmd_line, "noresidual") != NULL)
1132 res = NULL;
1133#endif
1134
1135 /* Initialise progress early to get maximum benefit */
1136 prep_set_bat();
1137 ibm_statusled_init();
1138
1139 ppc_md.setup_arch = prep_setup_arch;
1140 ppc_md.show_percpuinfo = prep_show_percpuinfo;
1141 ppc_md.show_cpuinfo = NULL; /* set in prep_setup_arch() */
1142 ppc_md.irq_canonicalize = prep_irq_canonicalize;
1143 ppc_md.init_IRQ = prep_init_IRQ;
1144 /* this gets changed later on if we have an OpenPIC -- Cort */
1145 ppc_md.get_irq = i8259_irq;
1146
1147 ppc_md.phys_mem_access_prot = pci_phys_mem_access_prot;
1148
1149 ppc_md.restart = prep_restart;
1150 ppc_md.power_off = NULL; /* set in prep_setup_arch() */
1151 ppc_md.halt = prep_halt;
1152
1153 ppc_md.nvram_read_val = prep_nvram_read_val;
1154 ppc_md.nvram_write_val = prep_nvram_write_val;
1155
1156 ppc_md.time_init = todc_time_init;
1157 if (_prep_type == _PREP_IBM) {
1158 ppc_md.rtc_read_val = todc_mc146818_read_val;
1159 ppc_md.rtc_write_val = todc_mc146818_write_val;
1160 TODC_INIT(TODC_TYPE_MC146818, RTC_PORT(0), NULL, RTC_PORT(1),
1161 8);
1162 } else {
1163 TODC_INIT(TODC_TYPE_MK48T59, PREP_NVRAM_AS0, PREP_NVRAM_AS1,
1164 PREP_NVRAM_DATA, 8);
1165 }
1166
1167 ppc_md.calibrate_decr = prep_calibrate_decr;
1168 ppc_md.set_rtc_time = todc_set_rtc_time;
1169 ppc_md.get_rtc_time = todc_get_rtc_time;
1170
1171 ppc_md.setup_io_mappings = prep_map_io;
1172
1173#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
1174 ppc_ide_md.default_irq = prep_ide_default_irq;
1175 ppc_ide_md.default_io_base = prep_ide_default_io_base;
1176#endif
1177
1178#ifdef CONFIG_SMP
1179 ppc_md.smp_ops = &prep_smp_ops;
1180#endif /* CONFIG_SMP */
1181}
diff --git a/arch/ppc/platforms/prpmc750.c b/arch/ppc/platforms/prpmc750.c
new file mode 100644
index 000000000000..c894e1ab5934
--- /dev/null
+++ b/arch/ppc/platforms/prpmc750.c
@@ -0,0 +1,364 @@
1/*
2 * arch/ppc/platforms/prpmc750_setup.c
3 *
4 * Board setup routines for Motorola PrPMC750
5 *
6 * Author: Matt Porter <mporter@mvista.com>
7 *
8 * 2001-2004 (c) MontaVista, Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
11 * or implied.
12 */
13
14#include <linux/config.h>
15#include <linux/stddef.h>
16#include <linux/kernel.h>
17#include <linux/init.h>
18#include <linux/errno.h>
19#include <linux/reboot.h>
20#include <linux/pci.h>
21#include <linux/kdev_t.h>
22#include <linux/types.h>
23#include <linux/major.h>
24#include <linux/initrd.h>
25#include <linux/console.h>
26#include <linux/delay.h>
27#include <linux/irq.h>
28#include <linux/seq_file.h>
29#include <linux/ide.h>
30#include <linux/root_dev.h>
31#include <linux/slab.h>
32
33#include <asm/byteorder.h>
34#include <asm/system.h>
35#include <asm/pgtable.h>
36#include <asm/page.h>
37#include <asm/dma.h>
38#include <asm/io.h>
39#include <asm/irq.h>
40#include <asm/machdep.h>
41#include <asm/pci-bridge.h>
42#include <asm/uaccess.h>
43#include <asm/time.h>
44#include <asm/open_pic.h>
45#include <asm/bootinfo.h>
46#include <asm/hawk.h>
47
48#include "prpmc750.h"
49
50extern unsigned long loops_per_jiffy;
51
52extern void gen550_progress(char *, unsigned short);
53
54static u_char prpmc750_openpic_initsenses[] __initdata =
55{
56 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC750_INT_HOSTINT0 */
57 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC750_INT_UART */
58 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC750_INT_DEBUGINT */
59 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC750_INT_HAWK_WDT */
60 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC750_INT_UNUSED */
61 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC750_INT_ABORT */
62 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC750_INT_HOSTINT1 */
63 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC750_INT_HOSTINT2 */
64 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC750_INT_HOSTINT3 */
65 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC750_INT_PMC_INTA */
66 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC750_INT_PMC_INTB */
67 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC750_INT_PMC_INTC */
68 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC750_INT_PMC_INTD */
69 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC750_INT_UNUSED */
70 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC750_INT_UNUSED */
71 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC750_INT_UNUSED */
72};
73
74/*
75 * Motorola PrPMC750/PrPMC800 in PrPMCBASE or PrPMC-Carrier
76 * Combined irq tables. Only Base has IDSEL 14, only Carrier has 21 and 22.
77 */
78static inline int
79prpmc_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
80{
81 static char pci_irq_table[][4] =
82 /*
83 * PCI IDSEL/INTPIN->INTLINE
84 * A B C D
85 */
86 {
87 {12, 0, 0, 0}, /* IDSEL 14 - Ethernet, base */
88 {0, 0, 0, 0}, /* IDSEL 15 - unused */
89 {10, 11, 12, 9}, /* IDSEL 16 - PMC A1, PMC1 */
90 {10, 11, 12, 9}, /* IDSEL 17 - PrPMC-A-B, PMC2-B */
91 {11, 12, 9, 10}, /* IDSEL 18 - PMC A1-B, PMC1-B */
92 {0, 0, 0, 0}, /* IDSEL 19 - unused */
93 {9, 10, 11, 12}, /* IDSEL 20 - P2P Bridge */
94 {11, 12, 9, 10}, /* IDSEL 21 - PMC A2, carrier */
95 {12, 9, 10, 11}, /* IDSEL 22 - PMC A2-B, carrier */
96 };
97 const long min_idsel = 14, max_idsel = 22, irqs_per_slot = 4;
98 return PCI_IRQ_TABLE_LOOKUP;
99};
100
101static void __init prpmc750_pcibios_fixup(void)
102{
103 struct pci_dev *dev;
104 unsigned short wtmp;
105
106 /*
107 * Kludge to clean up after PPC6BUG which doesn't
108 * configure the CL5446 VGA card. Also the
109 * resource subsystem doesn't fixup the
110 * PCI mem resources on the CL5446.
111 */
112 if ((dev = pci_get_device(PCI_VENDOR_ID_CIRRUS,
113 PCI_DEVICE_ID_CIRRUS_5446, 0))) {
114 dev->resource[0].start += PRPMC750_PCI_PHY_MEM_OFFSET;
115 dev->resource[0].end += PRPMC750_PCI_PHY_MEM_OFFSET;
116 pci_read_config_word(dev, PCI_COMMAND, &wtmp);
117 pci_write_config_word(dev, PCI_COMMAND, wtmp | 3);
118 /* Enable Color mode in MISC reg */
119 outb(0x03, 0x3c2);
120 /* Select DRAM config reg */
121 outb(0x0f, 0x3c4);
122 /* Set proper DRAM config */
123 outb(0xdf, 0x3c5);
124 pci_dev_put(dev);
125 }
126}
127
128void __init prpmc750_find_bridges(void)
129{
130 struct pci_controller *hose;
131
132 hose = pcibios_alloc_controller();
133 if (!hose)
134 return;
135
136 hose->first_busno = 0;
137 hose->last_busno = 0xff;
138 hose->io_base_virt = (void *)PRPMC750_ISA_IO_BASE;
139 hose->pci_mem_offset = PRPMC750_PCI_PHY_MEM_OFFSET;
140
141 pci_init_resource(&hose->io_resource,
142 PRPMC750_PCI_IO_START,
143 PRPMC750_PCI_IO_END,
144 IORESOURCE_IO, "PCI host bridge");
145
146 pci_init_resource(&hose->mem_resources[0],
147 PRPMC750_PROC_PCI_MEM_START,
148 PRPMC750_PROC_PCI_MEM_END,
149 IORESOURCE_MEM, "PCI host bridge");
150
151 hose->io_space.start = PRPMC750_PCI_IO_START;
152 hose->io_space.end = PRPMC750_PCI_IO_END;
153 hose->mem_space.start = PRPMC750_PCI_MEM_START;
154 hose->mem_space.end = PRPMC750_PCI_MEM_END - HAWK_MPIC_SIZE;
155
156 if (hawk_init(hose, PRPMC750_HAWK_PPC_REG_BASE,
157 PRPMC750_PROC_PCI_MEM_START,
158 PRPMC750_PROC_PCI_MEM_END - HAWK_MPIC_SIZE,
159 PRPMC750_PROC_PCI_IO_START, PRPMC750_PROC_PCI_IO_END,
160 PRPMC750_PROC_PCI_MEM_END - HAWK_MPIC_SIZE + 1)
161 != 0) {
162 printk(KERN_CRIT "Could not initialize host bridge\n");
163 }
164
165 hose->last_busno = pciauto_bus_scan(hose, hose->first_busno);
166
167 ppc_md.pcibios_fixup = prpmc750_pcibios_fixup;
168 ppc_md.pci_swizzle = common_swizzle;
169 ppc_md.pci_map_irq = prpmc_map_irq;
170}
171static int prpmc750_show_cpuinfo(struct seq_file *m)
172{
173 seq_printf(m, "machine\t\t: PrPMC750\n");
174
175 return 0;
176}
177
178static void __init prpmc750_setup_arch(void)
179{
180 /* init to some ~sane value until calibrate_delay() runs */
181 loops_per_jiffy = 50000000 / HZ;
182
183 /* Lookup PCI host bridges */
184 prpmc750_find_bridges();
185
186#ifdef CONFIG_BLK_DEV_INITRD
187 if (initrd_start)
188 ROOT_DEV = Root_RAM0;
189 else
190#endif
191#ifdef CONFIG_ROOT_NFS
192 ROOT_DEV = Root_NFS;
193#else
194 ROOT_DEV = Root_SDA2;
195#endif
196
197 OpenPIC_InitSenses = prpmc750_openpic_initsenses;
198 OpenPIC_NumInitSenses = sizeof(prpmc750_openpic_initsenses);
199
200 printk(KERN_INFO "Port by MontaVista Software, Inc. "
201 "(source@mvista.com)\n");
202}
203
204/*
205 * Compute the PrPMC750's bus speed using the baud clock as a
206 * reference.
207 */
208static unsigned long __init prpmc750_get_bus_speed(void)
209{
210 unsigned long tbl_start, tbl_end;
211 unsigned long current_state, old_state, bus_speed;
212 unsigned char lcr, dll, dlm;
213 int baud_divisor, count;
214
215 /* Read the UART's baud clock divisor */
216 lcr = readb(PRPMC750_SERIAL_0_LCR);
217 writeb(lcr | UART_LCR_DLAB, PRPMC750_SERIAL_0_LCR);
218 dll = readb(PRPMC750_SERIAL_0_DLL);
219 dlm = readb(PRPMC750_SERIAL_0_DLM);
220 writeb(lcr & ~UART_LCR_DLAB, PRPMC750_SERIAL_0_LCR);
221 baud_divisor = (dlm << 8) | dll;
222
223 /*
224 * Use the baud clock divisor and base baud clock
225 * to determine the baud rate and use that as
226 * the number of baud clock edges we use for
227 * the time base sample. Make it half the baud
228 * rate.
229 */
230 count = PRPMC750_BASE_BAUD / (baud_divisor * 16);
231
232 /* Find the first edge of the baud clock */
233 old_state = readb(PRPMC750_STATUS_REG) & PRPMC750_BAUDOUT_MASK;
234 do {
235 current_state = readb(PRPMC750_STATUS_REG) &
236 PRPMC750_BAUDOUT_MASK;
237 } while (old_state == current_state);
238
239 old_state = current_state;
240
241 /* Get the starting time base value */
242 tbl_start = get_tbl();
243
244 /*
245 * Loop until we have found a number of edges equal
246 * to half the count (half the baud rate)
247 */
248 do {
249 do {
250 current_state = readb(PRPMC750_STATUS_REG) &
251 PRPMC750_BAUDOUT_MASK;
252 } while (old_state == current_state);
253 old_state = current_state;
254 } while (--count);
255
256 /* Get the ending time base value */
257 tbl_end = get_tbl();
258
259 /* Compute bus speed */
260 bus_speed = (tbl_end - tbl_start) * 128;
261
262 return bus_speed;
263}
264
265static void __init prpmc750_calibrate_decr(void)
266{
267 unsigned long freq;
268 int divisor = 4;
269
270 freq = prpmc750_get_bus_speed();
271
272 tb_ticks_per_jiffy = freq / (HZ * divisor);
273 tb_to_us = mulhwu_scale_factor(freq / divisor, 1000000);
274}
275
276static void prpmc750_restart(char *cmd)
277{
278 local_irq_disable();
279 writeb(PRPMC750_MODRST_MASK, PRPMC750_MODRST_REG);
280 while (1) ;
281}
282
283static void prpmc750_halt(void)
284{
285 local_irq_disable();
286 while (1) ;
287}
288
289static void prpmc750_power_off(void)
290{
291 prpmc750_halt();
292}
293
294static void __init prpmc750_init_IRQ(void)
295{
296 openpic_init(0);
297}
298
299/*
300 * Set BAT 3 to map 0xf0000000 to end of physical memory space.
301 */
302static __inline__ void prpmc750_set_bat(void)
303{
304 mb();
305 mtspr(SPRN_DBAT1U, 0xf0001ffe);
306 mtspr(SPRN_DBAT1L, 0xf000002a);
307 mb();
308}
309
310/*
311 * We need to read the Falcon/Hawk memory controller
312 * to properly determine this value
313 */
314static unsigned long __init prpmc750_find_end_of_memory(void)
315{
316 /* Read the memory size from the Hawk SMC */
317 return hawk_get_mem_size(PRPMC750_HAWK_SMC_BASE);
318}
319
320static void __init prpmc750_map_io(void)
321{
322 io_block_mapping(PRPMC750_ISA_IO_BASE, PRPMC750_ISA_IO_BASE,
323 0x10000000, _PAGE_IO);
324#if 0
325 io_block_mapping(0xf0000000, 0xc0000000, 0x08000000, _PAGE_IO);
326#endif
327 io_block_mapping(0xf8000000, 0xf8000000, 0x08000000, _PAGE_IO);
328}
329
330void __init
331platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
332 unsigned long r6, unsigned long r7)
333{
334 parse_bootinfo(find_bootinfo());
335
336 /* Cover the Hawk registers with a BAT */
337 prpmc750_set_bat();
338
339 isa_io_base = PRPMC750_ISA_IO_BASE;
340 isa_mem_base = PRPMC750_ISA_MEM_BASE;
341 pci_dram_offset = PRPMC750_PCI_DRAM_OFFSET;
342
343 ppc_md.setup_arch = prpmc750_setup_arch;
344 ppc_md.show_cpuinfo = prpmc750_show_cpuinfo;
345 ppc_md.init_IRQ = prpmc750_init_IRQ;
346 ppc_md.get_irq = openpic_get_irq;
347
348 ppc_md.find_end_of_memory = prpmc750_find_end_of_memory;
349 ppc_md.setup_io_mappings = prpmc750_map_io;
350
351 ppc_md.restart = prpmc750_restart;
352 ppc_md.power_off = prpmc750_power_off;
353 ppc_md.halt = prpmc750_halt;
354
355 /* PrPMC750 has no timekeeper part */
356 ppc_md.time_init = NULL;
357 ppc_md.get_rtc_time = NULL;
358 ppc_md.set_rtc_time = NULL;
359 ppc_md.calibrate_decr = prpmc750_calibrate_decr;
360
361#ifdef CONFIG_SERIAL_TEXT_DEBUG
362 ppc_md.progress = gen550_progress;
363#endif /* CONFIG_SERIAL_TEXT_DEBUG */
364}
diff --git a/arch/ppc/platforms/prpmc750.h b/arch/ppc/platforms/prpmc750.h
new file mode 100644
index 000000000000..015b4f52c3eb
--- /dev/null
+++ b/arch/ppc/platforms/prpmc750.h
@@ -0,0 +1,95 @@
1/*
2 * include/asm-ppc/platforms/prpmc750.h
3 *
4 * Definitions for Motorola PrPMC750 board support
5 *
6 * Author: Matt Porter <mporter@mvista.com>
7 *
8 * 2001-2004 (c) MontaVista, Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
11 * or implied.
12 */
13
14#ifdef __KERNEL__
15#ifndef __ASM_PRPMC750_H__
16#define __ASM_PRPMC750_H__
17
18/*
19 * Due to limiations imposed by legacy hardware (primaryily IDE controllers),
20 * the PrPMC750 carrier board operates using a PReP address map.
21 *
22 * From Processor (physical) -> PCI:
23 * PCI Mem Space: 0xc0000000 - 0xfe000000 -> 0x00000000 - 0x3e000000 (768 MB)
24 * PCI I/O Space: 0x80000000 - 0x90000000 -> 0x00000000 - 0x10000000 (256 MB)
25 * Note: Must skip 0xfe000000-0xfe400000 for CONFIG_HIGHMEM/PKMAP area
26 *
27 * From PCI -> Processor (physical):
28 * System Memory: 0x80000000 -> 0x00000000
29 */
30
31#define PRPMC750_ISA_IO_BASE PREP_ISA_IO_BASE
32#define PRPMC750_ISA_MEM_BASE PREP_ISA_MEM_BASE
33
34/* PCI Memory space mapping info */
35#define PRPMC750_PCI_MEM_SIZE 0x30000000U
36#define PRPMC750_PROC_PCI_MEM_START PRPMC750_ISA_MEM_BASE
37#define PRPMC750_PROC_PCI_MEM_END (PRPMC750_PROC_PCI_MEM_START + \
38 PRPMC750_PCI_MEM_SIZE - 1)
39#define PRPMC750_PCI_MEM_START 0x00000000U
40#define PRPMC750_PCI_MEM_END (PRPMC750_PCI_MEM_START + \
41 PRPMC750_PCI_MEM_SIZE - 1)
42
43/* PCI I/O space mapping info */
44#define PRPMC750_PCI_IO_SIZE 0x10000000U
45#define PRPMC750_PROC_PCI_IO_START PRPMC750_ISA_IO_BASE
46#define PRPMC750_PROC_PCI_IO_END (PRPMC750_PROC_PCI_IO_START + \
47 PRPMC750_PCI_IO_SIZE - 1)
48#define PRPMC750_PCI_IO_START 0x00000000U
49#define PRPMC750_PCI_IO_END (PRPMC750_PCI_IO_START + \
50 PRPMC750_PCI_IO_SIZE - 1)
51
52/* System memory mapping info */
53#define PRPMC750_PCI_DRAM_OFFSET PREP_PCI_DRAM_OFFSET
54#define PRPMC750_PCI_PHY_MEM_OFFSET (PRPMC750_ISA_MEM_BASE-PRPMC750_PCI_MEM_START)
55
56/* Register address definitions */
57#define PRPMC750_HAWK_SMC_BASE 0xfef80000U
58#define PRPMC750_HAWK_PPC_REG_BASE 0xfeff0000U
59
60#define PRPMC750_BASE_BAUD 1843200
61#define PRPMC750_SERIAL_0 0xfef88000
62#define PRPMC750_SERIAL_0_DLL (PRPMC750_SERIAL_0 + (UART_DLL << 4))
63#define PRPMC750_SERIAL_0_DLM (PRPMC750_SERIAL_0 + (UART_DLM << 4))
64#define PRPMC750_SERIAL_0_LCR (PRPMC750_SERIAL_0 + (UART_LCR << 4))
65
66#define PRPMC750_STATUS_REG 0xfef88080
67#define PRPMC750_BAUDOUT_MASK 0x02
68#define PRPMC750_MONARCH_MASK 0x01
69
70#define PRPMC750_MODRST_REG 0xfef880a0
71#define PRPMC750_MODRST_MASK 0x01
72
73#define PRPMC750_PIRQ_REG 0xfef880b0
74#define PRPMC750_SEL1_MASK 0x02
75#define PRPMC750_SEL0_MASK 0x01
76
77#define PRPMC750_TBEN_REG 0xfef880c0
78#define PRPMC750_TBEN_MASK 0x01
79
80/* UART Defines. */
81#define RS_TABLE_SIZE 4
82
83/* Rate for the 1.8432 Mhz clock for the onboard serial chip */
84#define BASE_BAUD (PRPMC750_BASE_BAUD / 16)
85
86#define STD_COM_FLAGS ASYNC_BOOT_AUTOCONF
87
88#define SERIAL_PORT_DFNS \
89 { 0, BASE_BAUD, PRPMC750_SERIAL_0, 1, STD_COM_FLAGS, \
90 iomem_base: (unsigned char *)PRPMC750_SERIAL_0, \
91 iomem_reg_shift: 4, \
92 io_type: SERIAL_IO_MEM } /* ttyS0 */
93
94#endif /* __ASM_PRPMC750_H__ */
95#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/prpmc800.c b/arch/ppc/platforms/prpmc800.c
new file mode 100644
index 000000000000..8b09fa69b35b
--- /dev/null
+++ b/arch/ppc/platforms/prpmc800.c
@@ -0,0 +1,477 @@
1/*
2 * arch/ppc/platforms/prpmc800.c
3 *
4 * Author: Dale Farnsworth <dale.farnsworth@mvista.com>
5 *
6 * 2001-2004 (c) MontaVista, Software, Inc. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10 */
11
12#include <linux/config.h>
13#include <linux/stddef.h>
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/errno.h>
17#include <linux/reboot.h>
18#include <linux/pci.h>
19#include <linux/kdev_t.h>
20#include <linux/types.h>
21#include <linux/major.h>
22#include <linux/initrd.h>
23#include <linux/console.h>
24#include <linux/delay.h>
25#include <linux/irq.h>
26#include <linux/seq_file.h>
27#include <linux/ide.h>
28#include <linux/root_dev.h>
29#include <linux/harrier_defs.h>
30
31#include <asm/byteorder.h>
32#include <asm/system.h>
33#include <asm/pgtable.h>
34#include <asm/page.h>
35#include <asm/dma.h>
36#include <asm/io.h>
37#include <asm/irq.h>
38#include <asm/machdep.h>
39#include <asm/time.h>
40#include <asm/pci-bridge.h>
41#include <asm/open_pic.h>
42#include <asm/bootinfo.h>
43#include <asm/harrier.h>
44
45#include "prpmc800.h"
46
47#define HARRIER_REVI_REG (PRPMC800_HARRIER_XCSR_BASE+HARRIER_REVI_OFF)
48#define HARRIER_UCTL_REG (PRPMC800_HARRIER_XCSR_BASE+HARRIER_UCTL_OFF)
49#define HARRIER_MISC_CSR_REG (PRPMC800_HARRIER_XCSR_BASE+HARRIER_MISC_CSR_OFF)
50#define HARRIER_IFEVP_REG (PRPMC800_HARRIER_MPIC_BASE+HARRIER_MPIC_IFEVP_OFF)
51#define HARRIER_IFEDE_REG (PRPMC800_HARRIER_MPIC_BASE+HARRIER_MPIC_IFEDE_OFF)
52#define HARRIER_FEEN_REG (PRPMC800_HARRIER_XCSR_BASE+HARRIER_FEEN_OFF)
53#define HARRIER_FEMA_REG (PRPMC800_HARRIER_XCSR_BASE+HARRIER_FEMA_OFF)
54
55#define HARRIER_VENI_REG (PRPMC800_HARRIER_XCSR_BASE + HARRIER_VENI_OFF)
56#define HARRIER_MISC_CSR (PRPMC800_HARRIER_XCSR_BASE + \
57 HARRIER_MISC_CSR_OFF)
58
59#define MONARCH (monarch != 0)
60#define NON_MONARCH (monarch == 0)
61
62extern int mpic_init(void);
63extern unsigned long loops_per_jiffy;
64extern void gen550_progress(char *, unsigned short);
65
66static int monarch = 0;
67static int found_self = 0;
68static int self = 0;
69
70static u_char prpmc800_openpic_initsenses[] __initdata =
71{
72 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC800_INT_HOSTINT0 */
73 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC800_INT_UNUSED */
74 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC800_INT_DEBUGINT */
75 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC800_INT_HARRIER_WDT */
76 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC800_INT_UNUSED */
77 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC800_INT_UNUSED */
78 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC800_INT_HOSTINT1 */
79 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC800_INT_HOSTINT2 */
80 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC800_INT_HOSTINT3 */
81 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC800_INT_PMC_INTA */
82 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC800_INT_PMC_INTB */
83 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC800_INT_PMC_INTC */
84 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC800_INT_PMC_INTD */
85 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC800_INT_UNUSED */
86 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC800_INT_UNUSED */
87 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC800_INT_UNUSED */
88 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC800_INT_HARRIER_INT (UARTS, ABORT, DMA) */
89};
90
91/*
92 * Motorola PrPMC750/PrPMC800 in PrPMCBASE or PrPMC-Carrier
93 * Combined irq tables. Only Base has IDSEL 14, only Carrier has 21 and 22.
94 */
95static inline int
96prpmc_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
97{
98 static char pci_irq_table[][4] =
99 /*
100 * PCI IDSEL/INTPIN->INTLINE
101 * A B C D
102 */
103 {
104 {12, 0, 0, 0}, /* IDSEL 14 - Ethernet, base */
105 {0, 0, 0, 0}, /* IDSEL 15 - unused */
106 {10, 11, 12, 9}, /* IDSEL 16 - PMC A1, PMC1 */
107 {10, 11, 12, 9}, /* IDSEL 17 - PrPMC-A-B, PMC2-B */
108 {11, 12, 9, 10}, /* IDSEL 18 - PMC A1-B, PMC1-B */
109 {0, 0, 0, 0}, /* IDSEL 19 - unused */
110 {9, 10, 11, 12}, /* IDSEL 20 - P2P Bridge */
111 {11, 12, 9, 10}, /* IDSEL 21 - PMC A2, carrier */
112 {12, 9, 10, 11}, /* IDSEL 22 - PMC A2-B, carrier */
113 };
114 const long min_idsel = 14, max_idsel = 22, irqs_per_slot = 4;
115 return PCI_IRQ_TABLE_LOOKUP;
116};
117
118static int
119prpmc_read_config_dword(struct pci_controller *hose, u8 bus, u8 devfn,
120 int offset, u32 * val)
121{
122 /* paranoia */
123 if ((hose == NULL) ||
124 (hose->cfg_addr == NULL) || (hose->cfg_data == NULL))
125 return PCIBIOS_DEVICE_NOT_FOUND;
126
127 out_be32(hose->cfg_addr, ((offset & 0xfc) << 24) | (devfn << 16)
128 | ((bus - hose->bus_offset) << 8) | 0x80);
129 *val = in_le32((u32 *) (hose->cfg_data + (offset & 3)));
130
131 return PCIBIOS_SUCCESSFUL;
132}
133
134#define HARRIER_PCI_VEND_DEV_ID (PCI_VENDOR_ID_MOTOROLA | \
135 (PCI_DEVICE_ID_MOTOROLA_HARRIER << 16))
136static int prpmc_self(u8 bus, u8 devfn)
137{
138 /*
139 * Harriers always view themselves as being on bus 0. If we're not
140 * looking at bus 0, we're not going to find ourselves.
141 */
142 if (bus != 0)
143 return PCIBIOS_DEVICE_NOT_FOUND;
144 else {
145 int result;
146 int val;
147 struct pci_controller *hose;
148
149 hose = pci_bus_to_hose(bus);
150
151 /* See if target device is a Harrier */
152 result = prpmc_read_config_dword(hose, bus, devfn,
153 PCI_VENDOR_ID, &val);
154 if ((result != PCIBIOS_SUCCESSFUL) ||
155 (val != HARRIER_PCI_VEND_DEV_ID))
156 return PCIBIOS_DEVICE_NOT_FOUND;
157
158 /*
159 * LBA bit is set if target Harrier == initiating Harrier
160 * (i.e. if we are reading our own PCI header).
161 */
162 result = prpmc_read_config_dword(hose, bus, devfn,
163 HARRIER_LBA_OFF, &val);
164 if ((result != PCIBIOS_SUCCESSFUL) ||
165 ((val & HARRIER_LBA_MSK) != HARRIER_LBA_MSK))
166 return PCIBIOS_DEVICE_NOT_FOUND;
167
168 /* It's us, save our location for later */
169 self = devfn;
170 found_self = 1;
171 return PCIBIOS_SUCCESSFUL;
172 }
173}
174
175static int prpmc_exclude_device(u8 bus, u8 devfn)
176{
177 /*
178 * Monarch is allowed to access all PCI devices. Non-monarch is
179 * only allowed to access its own Harrier.
180 */
181
182 if (MONARCH)
183 return PCIBIOS_SUCCESSFUL;
184 if (found_self)
185 if ((bus == 0) && (devfn == self))
186 return PCIBIOS_SUCCESSFUL;
187 else
188 return PCIBIOS_DEVICE_NOT_FOUND;
189 else
190 return prpmc_self(bus, devfn);
191}
192
193void __init prpmc800_find_bridges(void)
194{
195 struct pci_controller *hose;
196 int host_bridge;
197
198 hose = pcibios_alloc_controller();
199 if (!hose)
200 return;
201
202 hose->first_busno = 0;
203 hose->last_busno = 0xff;
204
205 ppc_md.pci_exclude_device = prpmc_exclude_device;
206 ppc_md.pcibios_fixup = NULL;
207 ppc_md.pcibios_fixup_bus = NULL;
208 ppc_md.pci_swizzle = common_swizzle;
209 ppc_md.pci_map_irq = prpmc_map_irq;
210
211 setup_indirect_pci(hose,
212 PRPMC800_PCI_CONFIG_ADDR, PRPMC800_PCI_CONFIG_DATA);
213
214 /* Get host bridge vendor/dev id */
215
216 host_bridge = in_be32((uint *) (HARRIER_VENI_REG));
217
218 if (host_bridge != HARRIER_VEND_DEV_ID) {
219 printk(KERN_CRIT "Host bridge 0x%x not supported\n",
220 host_bridge);
221 return;
222 }
223
224 monarch = in_be32((uint *) HARRIER_MISC_CSR) & HARRIER_SYSCON;
225
226 printk(KERN_INFO "Running as %s.\n",
227 MONARCH ? "Monarch" : "Non-Monarch");
228
229 hose->io_space.start = PRPMC800_PCI_IO_START;
230 hose->io_space.end = PRPMC800_PCI_IO_END;
231 hose->io_base_virt = (void *)PRPMC800_ISA_IO_BASE;
232 hose->pci_mem_offset = PRPMC800_PCI_PHY_MEM_OFFSET;
233
234 pci_init_resource(&hose->io_resource,
235 PRPMC800_PCI_IO_START, PRPMC800_PCI_IO_END,
236 IORESOURCE_IO, "PCI host bridge");
237
238 if (MONARCH) {
239 hose->mem_space.start = PRPMC800_PCI_MEM_START;
240 hose->mem_space.end = PRPMC800_PCI_MEM_END;
241
242 pci_init_resource(&hose->mem_resources[0],
243 PRPMC800_PCI_MEM_START,
244 PRPMC800_PCI_MEM_END,
245 IORESOURCE_MEM, "PCI host bridge");
246
247 if (harrier_init(hose,
248 PRPMC800_HARRIER_XCSR_BASE,
249 PRPMC800_PROC_PCI_MEM_START,
250 PRPMC800_PROC_PCI_MEM_END,
251 PRPMC800_PROC_PCI_IO_START,
252 PRPMC800_PROC_PCI_IO_END,
253 PRPMC800_HARRIER_MPIC_BASE) != 0)
254 printk(KERN_CRIT "Could not initialize HARRIER "
255 "bridge\n");
256
257 harrier_release_eready(PRPMC800_HARRIER_XCSR_BASE);
258 harrier_wait_eready(PRPMC800_HARRIER_XCSR_BASE);
259 hose->last_busno = pciauto_bus_scan(hose, hose->first_busno);
260
261 } else {
262 pci_init_resource(&hose->mem_resources[0],
263 PRPMC800_NM_PCI_MEM_START,
264 PRPMC800_NM_PCI_MEM_END,
265 IORESOURCE_MEM, "PCI host bridge");
266
267 hose->mem_space.start = PRPMC800_NM_PCI_MEM_START;
268 hose->mem_space.end = PRPMC800_NM_PCI_MEM_END;
269
270 if (harrier_init(hose,
271 PRPMC800_HARRIER_XCSR_BASE,
272 PRPMC800_NM_PROC_PCI_MEM_START,
273 PRPMC800_NM_PROC_PCI_MEM_END,
274 PRPMC800_PROC_PCI_IO_START,
275 PRPMC800_PROC_PCI_IO_END,
276 PRPMC800_HARRIER_MPIC_BASE) != 0)
277 printk(KERN_CRIT "Could not initialize HARRIER "
278 "bridge\n");
279
280 harrier_setup_nonmonarch(PRPMC800_HARRIER_XCSR_BASE,
281 HARRIER_ITSZ_1MB);
282 harrier_release_eready(PRPMC800_HARRIER_XCSR_BASE);
283 }
284}
285
286static int prpmc800_show_cpuinfo(struct seq_file *m)
287{
288 seq_printf(m, "machine\t\t: PrPMC800\n");
289
290 return 0;
291}
292
293static void __init prpmc800_setup_arch(void)
294{
295 /* init to some ~sane value until calibrate_delay() runs */
296 loops_per_jiffy = 50000000 / HZ;
297
298 /* Lookup PCI host bridges */
299 prpmc800_find_bridges();
300
301#ifdef CONFIG_BLK_DEV_INITRD
302 if (initrd_start)
303 ROOT_DEV = Root_RAM0;
304 else
305#endif
306#ifdef CONFIG_ROOT_NFS
307 ROOT_DEV = Root_NFS;
308#else
309 ROOT_DEV = Root_SDA2;
310#endif
311
312 printk(KERN_INFO "Port by MontaVista Software, Inc. "
313 "(source@mvista.com)\n");
314}
315
316/*
317 * Compute the PrPMC800's tbl frequency using the baud clock as a reference.
318 */
319static void __init prpmc800_calibrate_decr(void)
320{
321 unsigned long tbl_start, tbl_end;
322 unsigned long current_state, old_state, tb_ticks_per_second;
323 unsigned int count;
324 unsigned int harrier_revision;
325
326 harrier_revision = readb(HARRIER_REVI_REG);
327 if (harrier_revision < 2) {
328 /* XTAL64 was broken in harrier revision 1 */
329 printk(KERN_INFO "time_init: Harrier revision %d, assuming "
330 "100 Mhz bus\n", harrier_revision);
331 tb_ticks_per_second = 100000000 / 4;
332 tb_ticks_per_jiffy = tb_ticks_per_second / HZ;
333 tb_to_us = mulhwu_scale_factor(tb_ticks_per_second, 1000000);
334 return;
335 }
336
337 /*
338 * The XTAL64 bit oscillates at the 1/64 the base baud clock
339 * Set count to XTAL64 cycles per second. Since we'll count
340 * half-cycles, we'll reach the count in half a second.
341 */
342 count = PRPMC800_BASE_BAUD / 64;
343
344 /* Find the first edge of the baud clock */
345 old_state = readb(HARRIER_UCTL_REG) & HARRIER_XTAL64_MASK;
346 do {
347 current_state = readb(HARRIER_UCTL_REG) & HARRIER_XTAL64_MASK;
348 } while (old_state == current_state);
349
350 old_state = current_state;
351
352 /* Get the starting time base value */
353 tbl_start = get_tbl();
354
355 /*
356 * Loop until we have found a number of edges (half-cycles)
357 * equal to the count (half a second)
358 */
359 do {
360 do {
361 current_state = readb(HARRIER_UCTL_REG) &
362 HARRIER_XTAL64_MASK;
363 } while (old_state == current_state);
364 old_state = current_state;
365 } while (--count);
366
367 /* Get the ending time base value */
368 tbl_end = get_tbl();
369
370 /* We only counted for half a second, so double to get ticks/second */
371 tb_ticks_per_second = (tbl_end - tbl_start) * 2;
372 tb_ticks_per_jiffy = tb_ticks_per_second / HZ;
373 tb_to_us = mulhwu_scale_factor(tb_ticks_per_second, 1000000);
374}
375
376static void prpmc800_restart(char *cmd)
377{
378 ulong temp;
379
380 local_irq_disable();
381 temp = in_be32((uint *) HARRIER_MISC_CSR_REG);
382 temp |= HARRIER_RSTOUT;
383 out_be32((uint *) HARRIER_MISC_CSR_REG, temp);
384 while (1) ;
385}
386
387static void prpmc800_halt(void)
388{
389 local_irq_disable();
390 while (1) ;
391}
392
393static void prpmc800_power_off(void)
394{
395 prpmc800_halt();
396}
397
398static void __init prpmc800_init_IRQ(void)
399{
400 OpenPIC_InitSenses = prpmc800_openpic_initsenses;
401 OpenPIC_NumInitSenses = sizeof(prpmc800_openpic_initsenses);
402
403 /* Setup external interrupt sources. */
404 openpic_set_sources(0, 16, OpenPIC_Addr + 0x10000);
405 /* Setup internal UART interrupt source. */
406 openpic_set_sources(16, 1, OpenPIC_Addr + 0x10200);
407
408 /* Do the MPIC initialization based on the above settings. */
409 openpic_init(0);
410
411 /* enable functional exceptions for uarts and abort */
412 out_8((u8 *) HARRIER_FEEN_REG, (HARRIER_FE_UA0 | HARRIER_FE_UA1));
413 out_8((u8 *) HARRIER_FEMA_REG, ~(HARRIER_FE_UA0 | HARRIER_FE_UA1));
414}
415
416/*
417 * Set BAT 3 to map 0xf0000000 to end of physical memory space.
418 */
419static __inline__ void prpmc800_set_bat(void)
420{
421 mb();
422 mtspr(SPRN_DBAT1U, 0xf0001ffe);
423 mtspr(SPRN_DBAT1L, 0xf000002a);
424 mb();
425}
426
427/*
428 * We need to read the Harrier memory controller
429 * to properly determine this value
430 */
431static unsigned long __init prpmc800_find_end_of_memory(void)
432{
433 /* Read the memory size from the Harrier XCSR */
434 return harrier_get_mem_size(PRPMC800_HARRIER_XCSR_BASE);
435}
436
437static void __init prpmc800_map_io(void)
438{
439 io_block_mapping(0x80000000, 0x80000000, 0x10000000, _PAGE_IO);
440 io_block_mapping(0xf0000000, 0xf0000000, 0x10000000, _PAGE_IO);
441}
442
443void __init
444platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
445 unsigned long r6, unsigned long r7)
446{
447 parse_bootinfo(find_bootinfo());
448
449 prpmc800_set_bat();
450
451 isa_io_base = PRPMC800_ISA_IO_BASE;
452 isa_mem_base = PRPMC800_ISA_MEM_BASE;
453 pci_dram_offset = PRPMC800_PCI_DRAM_OFFSET;
454
455 ppc_md.setup_arch = prpmc800_setup_arch;
456 ppc_md.show_cpuinfo = prpmc800_show_cpuinfo;
457 ppc_md.init_IRQ = prpmc800_init_IRQ;
458 ppc_md.get_irq = openpic_get_irq;
459
460 ppc_md.find_end_of_memory = prpmc800_find_end_of_memory;
461 ppc_md.setup_io_mappings = prpmc800_map_io;
462
463 ppc_md.restart = prpmc800_restart;
464 ppc_md.power_off = prpmc800_power_off;
465 ppc_md.halt = prpmc800_halt;
466
467 /* PrPMC800 has no timekeeper part */
468 ppc_md.time_init = NULL;
469 ppc_md.get_rtc_time = NULL;
470 ppc_md.set_rtc_time = NULL;
471 ppc_md.calibrate_decr = prpmc800_calibrate_decr;
472#ifdef CONFIG_SERIAL_TEXT_DEBUG
473 ppc_md.progress = gen550_progress;
474#else /* !CONFIG_SERIAL_TEXT_DEBUG */
475 ppc_md.progress = NULL;
476#endif /* CONFIG_SERIAL_TEXT_DEBUG */
477}
diff --git a/arch/ppc/platforms/prpmc800.h b/arch/ppc/platforms/prpmc800.h
new file mode 100644
index 000000000000..e53ec9b42a35
--- /dev/null
+++ b/arch/ppc/platforms/prpmc800.h
@@ -0,0 +1,82 @@
1/*
2 * include/asm-ppc/platforms/prpmc800.h
3 *
4 * Definitions for Motorola PrPMC800 board support
5 *
6 * Author: Dale Farnsworth <dale.farnsworth@mvista.com>
7 *
8 * 2001-2004 (c) MontaVista, Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
11 * or implied.
12 */
13 /*
14 * From Processor to PCI:
15 * PCI Mem Space: 0x80000000 - 0xa0000000 -> 0x80000000 - 0xa0000000 (512 MB)
16 * PCI I/O Space: 0xfe400000 - 0xfeef0000 -> 0x00000000 - 0x00b00000 (11 MB)
17 * Note: Must skip 0xfe000000-0xfe400000 for CONFIG_HIGHMEM/PKMAP area
18 *
19 * From PCI to Processor:
20 * System Memory: 0x00000000 -> 0x00000000
21 */
22
23#ifndef __ASMPPC_PRPMC800_H
24#define __ASMPPC_PRPMC800_H
25
26#define PRPMC800_PCI_CONFIG_ADDR 0xfe000cf8
27#define PRPMC800_PCI_CONFIG_DATA 0xfe000cfc
28
29#define PRPMC800_PROC_PCI_IO_START 0xfe400000U
30#define PRPMC800_PROC_PCI_IO_END 0xfeefffffU
31#define PRPMC800_PCI_IO_START 0x00000000U
32#define PRPMC800_PCI_IO_END 0x00afffffU
33
34#define PRPMC800_PROC_PCI_MEM_START 0x80000000U
35#define PRPMC800_PROC_PCI_MEM_END 0x9fffffffU
36#define PRPMC800_PCI_MEM_START 0x80000000U
37#define PRPMC800_PCI_MEM_END 0x9fffffffU
38
39#define PRPMC800_NM_PROC_PCI_MEM_START 0x40000000U
40#define PRPMC800_NM_PROC_PCI_MEM_END 0xdfffffffU
41#define PRPMC800_NM_PCI_MEM_START 0x40000000U
42#define PRPMC800_NM_PCI_MEM_END 0xdfffffffU
43
44#define PRPMC800_PCI_DRAM_OFFSET 0x00000000U
45#define PRPMC800_PCI_PHY_MEM_OFFSET 0x00000000U
46
47#define PRPMC800_ISA_IO_BASE PRPMC800_PROC_PCI_IO_START
48#define PRPMC800_ISA_MEM_BASE 0x00000000U
49
50#define PRPMC800_HARRIER_XCSR_BASE HARRIER_DEFAULT_XCSR_BASE
51#define PRPMC800_HARRIER_MPIC_BASE 0xff000000
52
53#define PRPMC800_SERIAL_1 0xfeff00c0
54
55#define PRPMC800_BASE_BAUD 1843200
56
57/*
58 * interrupt vector number and priority for harrier internal interrupt
59 * sources
60 */
61#define PRPMC800_INT_IRQ 16
62#define PRPMC800_INT_PRI 15
63
64/* UART Defines. */
65#define RS_TABLE_SIZE 4
66
67/* Rate for the 1.8432 Mhz clock for the onboard serial chip */
68#define BASE_BAUD (PRPMC800_BASE_BAUD / 16)
69
70#define STD_COM_FLAGS ASYNC_BOOT_AUTOCONF
71
72/* UARTS are at IRQ 16 */
73#define STD_SERIAL_PORT_DFNS \
74 { 0, BASE_BAUD, PRPMC800_SERIAL_1, 16, STD_COM_FLAGS, /* ttyS0 */\
75 iomem_base: (unsigned char *)PRPMC800_SERIAL_1, \
76 iomem_reg_shift: 0, \
77 io_type: SERIAL_IO_MEM },
78
79#define SERIAL_PORT_DFNS \
80 STD_SERIAL_PORT_DFNS
81
82#endif /* __ASMPPC_PRPMC800_H */
diff --git a/arch/ppc/platforms/radstone_ppc7d.c b/arch/ppc/platforms/radstone_ppc7d.c
new file mode 100644
index 000000000000..2a99b43737a8
--- /dev/null
+++ b/arch/ppc/platforms/radstone_ppc7d.c
@@ -0,0 +1,1452 @@
1/*
2 * arch/ppc/platforms/radstone_ppc7d.c
3 *
4 * Board setup routines for the Radstone PPC7D boards.
5 *
6 * Author: James Chapman <jchapman@katalix.com>
7 *
8 * Based on code done by Rabeeh Khoury - rabeeh@galileo.co.il
9 * Based on code done by - Mark A. Greer <mgreer@mvista.com>
10 *
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
15 */
16
17/* Radstone PPC7D boards are rugged VME boards with PPC 7447A CPUs,
18 * Discovery-II, dual gigabit ethernet, dual PMC, USB, keyboard/mouse,
19 * 4 serial ports, 2 high speed serial ports (MPSCs) and optional
20 * SCSI / VGA.
21 */
22
23#include <linux/config.h>
24#include <linux/stddef.h>
25#include <linux/kernel.h>
26#include <linux/init.h>
27#include <linux/errno.h>
28#include <linux/reboot.h>
29#include <linux/pci.h>
30#include <linux/kdev_t.h>
31#include <linux/major.h>
32#include <linux/initrd.h>
33#include <linux/console.h>
34#include <linux/delay.h>
35#include <linux/irq.h>
36#include <linux/ide.h>
37#include <linux/seq_file.h>
38#include <linux/root_dev.h>
39#include <linux/serial.h>
40#include <linux/tty.h> /* for linux/serial_core.h */
41#include <linux/serial_core.h>
42#include <linux/mv643xx.h>
43#include <linux/netdevice.h>
44
45#include <asm/system.h>
46#include <asm/pgtable.h>
47#include <asm/page.h>
48#include <asm/time.h>
49#include <asm/dma.h>
50#include <asm/io.h>
51#include <asm/machdep.h>
52#include <asm/prom.h>
53#include <asm/smp.h>
54#include <asm/vga.h>
55#include <asm/open_pic.h>
56#include <asm/i8259.h>
57#include <asm/todc.h>
58#include <asm/bootinfo.h>
59#include <asm/mpc10x.h>
60#include <asm/pci-bridge.h>
61#include <asm/mv64x60.h>
62#include <asm/i8259.h>
63
64#include "radstone_ppc7d.h"
65
66#undef DEBUG
67
68#define PPC7D_RST_PIN 17 /* GPP17 */
69
70extern u32 mv64360_irq_base;
71
72static struct mv64x60_handle bh;
73static int ppc7d_has_alma;
74
75extern void gen550_progress(char *, unsigned short);
76extern void gen550_init(int, struct uart_port *);
77
78/* residual data */
79unsigned char __res[sizeof(bd_t)];
80
81/*****************************************************************************
82 * Serial port code
83 *****************************************************************************/
84
85#if defined(CONFIG_KGDB) || defined(CONFIG_SERIAL_TEXT_DEBUG)
86static void __init ppc7d_early_serial_map(void)
87{
88#if defined(CONFIG_SERIAL_MPSC_CONSOLE)
89 mv64x60_progress_init(CONFIG_MV64X60_NEW_BASE);
90#elif defined(CONFIG_SERIAL_8250)
91 struct uart_port serial_req;
92
93 /* Setup serial port access */
94 memset(&serial_req, 0, sizeof(serial_req));
95 serial_req.uartclk = UART_CLK;
96 serial_req.irq = 4;
97 serial_req.flags = STD_COM_FLAGS;
98 serial_req.iotype = SERIAL_IO_MEM;
99 serial_req.membase = (u_char *) PPC7D_SERIAL_0;
100
101 gen550_init(0, &serial_req);
102 if (early_serial_setup(&serial_req) != 0)
103 printk(KERN_ERR "Early serial init of port 0 failed\n");
104
105 /* Assume early_serial_setup() doesn't modify serial_req */
106 serial_req.line = 1;
107 serial_req.irq = 3;
108 serial_req.membase = (u_char *) PPC7D_SERIAL_1;
109
110 gen550_init(1, &serial_req);
111 if (early_serial_setup(&serial_req) != 0)
112 printk(KERN_ERR "Early serial init of port 1 failed\n");
113#else
114#error CONFIG_KGDB || CONFIG_SERIAL_TEXT_DEBUG has no supported CONFIG_SERIAL_XXX
115#endif
116}
117#endif /* CONFIG_KGDB || CONFIG_SERIAL_TEXT_DEBUG */
118
119/*****************************************************************************
120 * Low-level board support code
121 *****************************************************************************/
122
123static unsigned long __init ppc7d_find_end_of_memory(void)
124{
125 bd_t *bp = (bd_t *) __res;
126
127 if (bp->bi_memsize)
128 return bp->bi_memsize;
129
130 return (256 * 1024 * 1024);
131}
132
133static void __init ppc7d_map_io(void)
134{
135 /* remove temporary mapping */
136 mtspr(SPRN_DBAT3U, 0x00000000);
137 mtspr(SPRN_DBAT3L, 0x00000000);
138
139 io_block_mapping(0xe8000000, 0xe8000000, 0x08000000, _PAGE_IO);
140 io_block_mapping(0xfe000000, 0xfe000000, 0x02000000, _PAGE_IO);
141}
142
143static void ppc7d_restart(char *cmd)
144{
145 u32 data;
146
147 /* Disable GPP17 interrupt */
148 data = mv64x60_read(&bh, MV64x60_GPP_INTR_MASK);
149 data &= ~(1 << PPC7D_RST_PIN);
150 mv64x60_write(&bh, MV64x60_GPP_INTR_MASK, data);
151
152 /* Configure MPP17 as GPP */
153 data = mv64x60_read(&bh, MV64x60_MPP_CNTL_2);
154 data &= ~(0x0000000f << 4);
155 mv64x60_write(&bh, MV64x60_MPP_CNTL_2, data);
156
157 /* Enable pin GPP17 for output */
158 data = mv64x60_read(&bh, MV64x60_GPP_IO_CNTL);
159 data |= (1 << PPC7D_RST_PIN);
160 mv64x60_write(&bh, MV64x60_GPP_IO_CNTL, data);
161
162 /* Toggle GPP9 pin to reset the board */
163 mv64x60_write(&bh, MV64x60_GPP_VALUE_CLR, 1 << PPC7D_RST_PIN);
164 mv64x60_write(&bh, MV64x60_GPP_VALUE_SET, 1 << PPC7D_RST_PIN);
165
166 for (;;) ; /* Spin until reset happens */
167 /* NOTREACHED */
168}
169
170static void ppc7d_power_off(void)
171{
172 u32 data;
173
174 local_irq_disable();
175
176 /* Ensure that internal MV643XX watchdog is disabled.
177 * The Disco watchdog uses MPP17 on this hardware.
178 */
179 data = mv64x60_read(&bh, MV64x60_MPP_CNTL_2);
180 data &= ~(0x0000000f << 4);
181 mv64x60_write(&bh, MV64x60_MPP_CNTL_2, data);
182
183 data = mv64x60_read(&bh, MV64x60_WDT_WDC);
184 if (data & 0x80000000) {
185 mv64x60_write(&bh, MV64x60_WDT_WDC, 1 << 24);
186 mv64x60_write(&bh, MV64x60_WDT_WDC, 2 << 24);
187 }
188
189 for (;;) ; /* No way to shut power off with software */
190 /* NOTREACHED */
191}
192
193static void ppc7d_halt(void)
194{
195 ppc7d_power_off();
196 /* NOTREACHED */
197}
198
199static unsigned long ppc7d_led_no_pulse;
200
201static int __init ppc7d_led_pulse_disable(char *str)
202{
203 ppc7d_led_no_pulse = 1;
204 return 1;
205}
206
207/* This kernel option disables the heartbeat pulsing of a board LED */
208__setup("ledoff", ppc7d_led_pulse_disable);
209
210static void ppc7d_heartbeat(void)
211{
212 u32 data32;
213 u8 data8;
214 static int max706_wdog = 0;
215
216 /* Unfortunately we can't access the LED control registers
217 * during early init because they're on the CPLD which is the
218 * other side of a PCI bridge which goes unreachable during
219 * PCI scan. So write the LEDs only if the MV64360 watchdog is
220 * enabled (i.e. userspace apps are running so kernel is up)..
221 */
222 data32 = mv64x60_read(&bh, MV64x60_WDT_WDC);
223 if (data32 & 0x80000000) {
224 /* Enable MAX706 watchdog if not done already */
225 if (!max706_wdog) {
226 outb(3, PPC7D_CPLD_RESET);
227 max706_wdog = 1;
228 }
229
230 /* Hit the MAX706 watchdog */
231 outb(0, PPC7D_CPLD_WATCHDOG_TRIG);
232
233 /* Pulse LED DS219 if not disabled */
234 if (!ppc7d_led_no_pulse) {
235 static int led_on = 0;
236
237 data8 = inb(PPC7D_CPLD_LEDS);
238 if (led_on)
239 data8 &= ~PPC7D_CPLD_LEDS_DS219_MASK;
240 else
241 data8 |= PPC7D_CPLD_LEDS_DS219_MASK;
242
243 outb(data8, PPC7D_CPLD_LEDS);
244 led_on = !led_on;
245 }
246 }
247 ppc_md.heartbeat_count = ppc_md.heartbeat_reset;
248}
249
250static int ppc7d_show_cpuinfo(struct seq_file *m)
251{
252 u8 val;
253 u8 val1, val2;
254 static int flash_sizes[4] = { 64, 32, 0, 16 };
255 static int flash_banks[4] = { 4, 3, 2, 1 };
256 static char *pci_modes[] = { "PCI33", "PCI66",
257 "Unknown", "Unknown",
258 "PCIX33", "PCIX66",
259 "PCIX100", "PCIX133"
260 };
261
262 seq_printf(m, "vendor\t\t: Radstone Technology\n");
263 seq_printf(m, "machine\t\t: PPC7D\n");
264
265 val = inb(PPC7D_CPLD_BOARD_REVISION);
266 val1 = (val & PPC7D_CPLD_BOARD_REVISION_NUMBER_MASK) >> 5;
267 val2 = (val & PPC7D_CPLD_BOARD_REVISION_LETTER_MASK);
268 seq_printf(m, "revision\t: %hd%c%c\n",
269 val1,
270 (val2 <= 0x18) ? 'A' + val2 : 'Y',
271 (val2 > 0x18) ? 'A' + (val2 - 0x19) : ' ');
272
273 val = inb(PPC7D_CPLD_MOTHERBOARD_TYPE);
274 val1 = val & PPC7D_CPLD_MB_TYPE_PLL_MASK;
275 val2 = val & (PPC7D_CPLD_MB_TYPE_ECC_FITTED_MASK |
276 PPC7D_CPLD_MB_TYPE_ECC_ENABLE_MASK);
277 seq_printf(m, "bus speed\t: %dMHz\n",
278 (val1 == PPC7D_CPLD_MB_TYPE_PLL_133) ? 133 :
279 (val1 == PPC7D_CPLD_MB_TYPE_PLL_100) ? 100 :
280 (val1 == PPC7D_CPLD_MB_TYPE_PLL_64) ? 64 : 0);
281
282 val = inb(PPC7D_CPLD_MEM_CONFIG_EXTEND);
283 val1 = val & PPC7D_CPLD_SDRAM_BANK_SIZE_MASK;
284 seq_printf(m, "SDRAM\t\t: %d%c",
285 (val1 == PPC7D_CPLD_SDRAM_BANK_SIZE_128M) ? 128 :
286 (val1 == PPC7D_CPLD_SDRAM_BANK_SIZE_256M) ? 256 :
287 (val1 == PPC7D_CPLD_SDRAM_BANK_SIZE_512M) ? 512 : 1,
288 (val1 == PPC7D_CPLD_SDRAM_BANK_SIZE_1G) ? 'G' : 'M');
289 if (val2 & PPC7D_CPLD_MB_TYPE_ECC_FITTED_MASK) {
290 seq_printf(m, " [ECC %sabled]",
291 (val2 & PPC7D_CPLD_MB_TYPE_ECC_ENABLE_MASK) ? "en" :
292 "dis");
293 }
294 seq_printf(m, "\n");
295
296 val1 = (val & PPC7D_CPLD_FLASH_DEV_SIZE_MASK);
297 val2 = (val & PPC7D_CPLD_FLASH_BANK_NUM_MASK) >> 2;
298 seq_printf(m, "FLASH\t\t: %d banks of %dM, total %dM\n",
299 flash_banks[val2], flash_sizes[val1],
300 flash_banks[val2] * flash_sizes[val1]);
301
302 val = inb(PPC7D_CPLD_FLASH_WRITE_CNTL);
303 val1 = inb(PPC7D_CPLD_SW_FLASH_WRITE_PROTECT);
304 seq_printf(m, " write links\t: %s%s%s%s\n",
305 (val & PPD7D_CPLD_FLASH_CNTL_WR_LINK_MASK) ? "WRITE " : "",
306 (val & PPD7D_CPLD_FLASH_CNTL_BOOT_LINK_MASK) ? "BOOT " : "",
307 (val & PPD7D_CPLD_FLASH_CNTL_USER_LINK_MASK) ? "USER " : "",
308 (val & (PPD7D_CPLD_FLASH_CNTL_WR_LINK_MASK |
309 PPD7D_CPLD_FLASH_CNTL_BOOT_LINK_MASK |
310 PPD7D_CPLD_FLASH_CNTL_USER_LINK_MASK)) ==
311 0 ? "NONE" : "");
312 seq_printf(m, " write sector h/w enables: %s%s%s%s%s\n",
313 (val & PPD7D_CPLD_FLASH_CNTL_RECO_WR_MASK) ? "RECOVERY " :
314 "",
315 (val & PPD7D_CPLD_FLASH_CNTL_BOOT_WR_MASK) ? "BOOT " : "",
316 (val & PPD7D_CPLD_FLASH_CNTL_USER_WR_MASK) ? "USER " : "",
317 (val1 & PPC7D_CPLD_FLASH_CNTL_NVRAM_PROT_MASK) ? "NVRAM " :
318 "",
319 (((val &
320 (PPD7D_CPLD_FLASH_CNTL_RECO_WR_MASK |
321 PPD7D_CPLD_FLASH_CNTL_BOOT_WR_MASK |
322 PPD7D_CPLD_FLASH_CNTL_BOOT_WR_MASK)) == 0)
323 && ((val1 & PPC7D_CPLD_FLASH_CNTL_NVRAM_PROT_MASK) ==
324 0)) ? "NONE" : "");
325 val1 =
326 inb(PPC7D_CPLD_SW_FLASH_WRITE_PROTECT) &
327 (PPC7D_CPLD_SW_FLASH_WRPROT_SYSBOOT_MASK |
328 PPC7D_CPLD_SW_FLASH_WRPROT_USER_MASK);
329 seq_printf(m, " software sector enables: %s%s%s\n",
330 (val1 & PPC7D_CPLD_SW_FLASH_WRPROT_SYSBOOT_MASK) ? "SYSBOOT "
331 : "",
332 (val1 & PPC7D_CPLD_SW_FLASH_WRPROT_USER_MASK) ? "USER " : "",
333 (val1 == 0) ? "NONE " : "");
334
335 seq_printf(m, "Boot options\t: %s%s%s%s\n",
336 (val & PPC7D_CPLD_FLASH_CNTL_ALTBOOT_LINK_MASK) ?
337 "ALTERNATE " : "",
338 (val & PPC7D_CPLD_FLASH_CNTL_VMEBOOT_LINK_MASK) ? "VME " :
339 "",
340 (val & PPC7D_CPLD_FLASH_CNTL_RECBOOT_LINK_MASK) ? "RECOVERY "
341 : "",
342 ((val &
343 (PPC7D_CPLD_FLASH_CNTL_ALTBOOT_LINK_MASK |
344 PPC7D_CPLD_FLASH_CNTL_VMEBOOT_LINK_MASK |
345 PPC7D_CPLD_FLASH_CNTL_RECBOOT_LINK_MASK)) ==
346 0) ? "NONE" : "");
347
348 val = inb(PPC7D_CPLD_EQUIPMENT_PRESENT_1);
349 seq_printf(m, "Fitted modules\t: %s%s%s%s\n",
350 (val & PPC7D_CPLD_EQPT_PRES_1_PMC1_MASK) ? "" : "PMC1 ",
351 (val & PPC7D_CPLD_EQPT_PRES_1_PMC2_MASK) ? "" : "PMC2 ",
352 (val & PPC7D_CPLD_EQPT_PRES_1_AFIX_MASK) ? "AFIX " : "",
353 ((val & (PPC7D_CPLD_EQPT_PRES_1_PMC1_MASK |
354 PPC7D_CPLD_EQPT_PRES_1_PMC2_MASK |
355 PPC7D_CPLD_EQPT_PRES_1_AFIX_MASK)) ==
356 (PPC7D_CPLD_EQPT_PRES_1_PMC1_MASK |
357 PPC7D_CPLD_EQPT_PRES_1_PMC2_MASK)) ? "NONE" : "");
358
359 if (val & PPC7D_CPLD_EQPT_PRES_1_AFIX_MASK) {
360 static const char *ids[] = {
361 "unknown",
362 "1553 (Dual Channel)",
363 "1553 (Single Channel)",
364 "8-bit SCSI + VGA",
365 "16-bit SCSI + VGA",
366 "1553 (Single Channel with sideband)",
367 "1553 (Dual Channel with sideband)",
368 NULL
369 };
370 u8 id = __raw_readb((void *)PPC7D_AFIX_REG_BASE + 0x03);
371 seq_printf(m, "AFIX module\t: 0x%hx [%s]\n", id,
372 id < 7 ? ids[id] : "unknown");
373 }
374
375 val = inb(PPC7D_CPLD_PCI_CONFIG);
376 val1 = (val & PPC7D_CPLD_PCI_CONFIG_PCI0_MASK) >> 4;
377 val2 = (val & PPC7D_CPLD_PCI_CONFIG_PCI1_MASK);
378 seq_printf(m, "PCI#0\t\t: %s\nPCI#1\t\t: %s\n",
379 pci_modes[val1], pci_modes[val2]);
380
381 val = inb(PPC7D_CPLD_EQUIPMENT_PRESENT_2);
382 seq_printf(m, "PMC1\t\t: %s\nPMC2\t\t: %s\n",
383 (val & PPC7D_CPLD_EQPT_PRES_3_PMC1_V_MASK) ? "3.3v" : "5v",
384 (val & PPC7D_CPLD_EQPT_PRES_3_PMC2_V_MASK) ? "3.3v" : "5v");
385 seq_printf(m, "PMC power source: %s\n",
386 (val & PPC7D_CPLD_EQPT_PRES_3_PMC_POWER_MASK) ? "VME" :
387 "internal");
388
389 val = inb(PPC7D_CPLD_EQUIPMENT_PRESENT_4);
390 val2 = inb(PPC7D_CPLD_EQUIPMENT_PRESENT_2);
391 seq_printf(m, "Fit options\t: %s%s%s%s%s%s%s\n",
392 (val & PPC7D_CPLD_EQPT_PRES_4_LPT_MASK) ? "LPT " : "",
393 (val & PPC7D_CPLD_EQPT_PRES_4_PS2_FITTED) ? "PS2 " : "",
394 (val & PPC7D_CPLD_EQPT_PRES_4_USB2_FITTED) ? "USB2 " : "",
395 (val2 & PPC7D_CPLD_EQPT_PRES_2_UNIVERSE_MASK) ? "VME " : "",
396 (val2 & PPC7D_CPLD_EQPT_PRES_2_COM36_MASK) ? "COM3-6 " : "",
397 (val2 & PPC7D_CPLD_EQPT_PRES_2_GIGE_MASK) ? "eth0 " : "",
398 (val2 & PPC7D_CPLD_EQPT_PRES_2_DUALGIGE_MASK) ? "eth1 " :
399 "");
400
401 val = inb(PPC7D_CPLD_ID_LINK);
402 val1 = val & (PPC7D_CPLD_ID_LINK_E6_MASK |
403 PPC7D_CPLD_ID_LINK_E7_MASK |
404 PPC7D_CPLD_ID_LINK_E12_MASK |
405 PPC7D_CPLD_ID_LINK_E13_MASK);
406
407 val = inb(PPC7D_CPLD_FLASH_WRITE_CNTL) &
408 (PPD7D_CPLD_FLASH_CNTL_WR_LINK_MASK |
409 PPD7D_CPLD_FLASH_CNTL_BOOT_LINK_MASK |
410 PPD7D_CPLD_FLASH_CNTL_USER_LINK_MASK);
411
412 seq_printf(m, "Board links present: %s%s%s%s%s%s%s%s\n",
413 (val1 & PPC7D_CPLD_ID_LINK_E6_MASK) ? "E6 " : "",
414 (val1 & PPC7D_CPLD_ID_LINK_E7_MASK) ? "E7 " : "",
415 (val & PPD7D_CPLD_FLASH_CNTL_WR_LINK_MASK) ? "E9 " : "",
416 (val & PPD7D_CPLD_FLASH_CNTL_BOOT_LINK_MASK) ? "E10 " : "",
417 (val & PPD7D_CPLD_FLASH_CNTL_USER_LINK_MASK) ? "E11 " : "",
418 (val1 & PPC7D_CPLD_ID_LINK_E12_MASK) ? "E12 " : "",
419 (val1 & PPC7D_CPLD_ID_LINK_E13_MASK) ? "E13 " : "",
420 ((val == 0) && (val1 == 0)) ? "NONE" : "");
421
422 val = inb(PPC7D_CPLD_WDOG_RESETSW_MASK);
423 seq_printf(m, "Front panel reset switch: %sabled\n",
424 (val & PPC7D_CPLD_WDOG_RESETSW_MASK) ? "dis" : "en");
425
426 return 0;
427}
428
429static void __init ppc7d_calibrate_decr(void)
430{
431 ulong freq;
432
433 freq = 100000000 / 4;
434
435 pr_debug("time_init: decrementer frequency = %lu.%.6lu MHz\n",
436 freq / 1000000, freq % 1000000);
437
438 tb_ticks_per_jiffy = freq / HZ;
439 tb_to_us = mulhwu_scale_factor(freq, 1000000);
440}
441
442/*****************************************************************************
443 * Interrupt stuff
444 *****************************************************************************/
445
446static irqreturn_t ppc7d_i8259_intr(int irq, void *dev_id, struct pt_regs *regs)
447{
448 u32 temp = mv64x60_read(&bh, MV64x60_GPP_INTR_CAUSE);
449 if (temp & (1 << 28)) {
450 i8259_irq(regs);
451 mv64x60_write(&bh, MV64x60_GPP_INTR_CAUSE, temp & (~(1 << 28)));
452 return IRQ_HANDLED;
453 }
454
455 return IRQ_NONE;
456}
457
458/*
459 * Each interrupt cause is assigned an IRQ number.
460 * Southbridge has 16*2 (two 8259's) interrupts.
461 * Discovery-II has 96 interrupts (cause-hi, cause-lo, gpp x 32).
462 * If multiple interrupts are pending, get_irq() returns the
463 * lowest pending irq number first.
464 *
465 *
466 * IRQ # Source Trig Active
467 * =============================================================
468 *
469 * Southbridge
470 * -----------
471 * IRQ # Source Trig
472 * =============================================================
473 * 0 ISA High Resolution Counter Edge
474 * 1 Keyboard Edge
475 * 2 Cascade From (IRQ 8-15) Edge
476 * 3 Com 2 (Uart 2) Edge
477 * 4 Com 1 (Uart 1) Edge
478 * 5 PCI Int D/AFIX IRQZ ID4 (2,7) Level
479 * 6 GPIO Level
480 * 7 LPT Edge
481 * 8 RTC Alarm Edge
482 * 9 PCI Int A/PMC 2/AFIX IRQW ID1 (2,0) Level
483 * 10 PCI Int B/PMC 1/AFIX IRQX ID2 (2,1) Level
484 * 11 USB2 Level
485 * 12 Mouse Edge
486 * 13 Reserved internally by Ali M1535+
487 * 14 PCI Int C/VME/AFIX IRQY ID3 (2,6) Level
488 * 15 COM 5/6 Level
489 *
490 * 16..112 Discovery-II...
491 *
492 * MPP28 Southbridge Edge High
493 *
494 *
495 * Interrupts are cascaded through to the Discovery-II.
496 *
497 * PCI ---
498 * \
499 * CPLD --> ALI1535 -------> DISCOVERY-II
500 * INTF MPP28
501 */
502static void __init ppc7d_init_irq(void)
503{
504 int irq;
505
506 pr_debug("%s\n", __FUNCTION__);
507 i8259_init(0);
508 mv64360_init_irq();
509
510 /* IRQ 0..15 are handled by the cascaded 8259's of the Ali1535 */
511 for (irq = 0; irq < 16; irq++) {
512 irq_desc[irq].handler = &i8259_pic;
513 }
514 /* IRQs 5,6,9,10,11,14,15 are level sensitive */
515 irq_desc[5].status |= IRQ_LEVEL;
516 irq_desc[6].status |= IRQ_LEVEL;
517 irq_desc[9].status |= IRQ_LEVEL;
518 irq_desc[10].status |= IRQ_LEVEL;
519 irq_desc[11].status |= IRQ_LEVEL;
520 irq_desc[14].status |= IRQ_LEVEL;
521 irq_desc[15].status |= IRQ_LEVEL;
522
523 /* GPP28 is edge triggered */
524 irq_desc[mv64360_irq_base + MV64x60_IRQ_GPP28].status &= ~IRQ_LEVEL;
525}
526
527static u32 ppc7d_irq_canonicalize(u32 irq)
528{
529 if ((irq >= 16) && (irq < (16 + 96)))
530 irq -= 16;
531
532 return irq;
533}
534
535static int ppc7d_get_irq(struct pt_regs *regs)
536{
537 int irq;
538
539 irq = mv64360_get_irq(regs);
540 if (irq == (mv64360_irq_base + MV64x60_IRQ_GPP28))
541 irq = i8259_irq(regs);
542 return irq;
543}
544
545/*
546 * 9 PCI Int A/PMC 2/AFIX IRQW ID1 (2,0) Level
547 * 10 PCI Int B/PMC 1/AFIX IRQX ID2 (2,1) Level
548 * 14 PCI Int C/VME/AFIX IRQY ID3 (2,6) Level
549 * 5 PCI Int D/AFIX IRQZ ID4 (2,7) Level
550 */
551static int __init ppc7d_map_irq(struct pci_dev *dev, unsigned char idsel,
552 unsigned char pin)
553{
554 static const char pci_irq_table[][4] =
555 /*
556 * PCI IDSEL/INTPIN->INTLINE
557 * A B C D
558 */
559 {
560 {10, 14, 5, 9}, /* IDSEL 10 - PMC2 / AFIX IRQW */
561 {9, 10, 14, 5}, /* IDSEL 11 - PMC1 / AFIX IRQX */
562 {5, 9, 10, 14}, /* IDSEL 12 - AFIX IRQY */
563 {14, 5, 9, 10}, /* IDSEL 13 - AFIX IRQZ */
564 };
565 const long min_idsel = 10, max_idsel = 14, irqs_per_slot = 4;
566
567 pr_debug("%s: %04x/%04x/%x: idsel=%hx pin=%hu\n", __FUNCTION__,
568 dev->vendor, dev->device, PCI_FUNC(dev->devfn), idsel, pin);
569
570 return PCI_IRQ_TABLE_LOOKUP;
571}
572
573void __init ppc7d_intr_setup(void)
574{
575 u32 data;
576
577 /*
578 * Define GPP 28 interrupt polarity as active high
579 * input signal and level triggered
580 */
581 data = mv64x60_read(&bh, MV64x60_GPP_LEVEL_CNTL);
582 data &= ~(1 << 28);
583 mv64x60_write(&bh, MV64x60_GPP_LEVEL_CNTL, data);
584 data = mv64x60_read(&bh, MV64x60_GPP_IO_CNTL);
585 data &= ~(1 << 28);
586 mv64x60_write(&bh, MV64x60_GPP_IO_CNTL, data);
587
588 /* Config GPP intr ctlr to respond to level trigger */
589 data = mv64x60_read(&bh, MV64x60_COMM_ARBITER_CNTL);
590 data |= (1 << 10);
591 mv64x60_write(&bh, MV64x60_COMM_ARBITER_CNTL, data);
592
593 /* XXXX Erranum FEr PCI-#8 */
594 data = mv64x60_read(&bh, MV64x60_PCI0_CMD);
595 data &= ~((1 << 5) | (1 << 9));
596 mv64x60_write(&bh, MV64x60_PCI0_CMD, data);
597 data = mv64x60_read(&bh, MV64x60_PCI1_CMD);
598 data &= ~((1 << 5) | (1 << 9));
599 mv64x60_write(&bh, MV64x60_PCI1_CMD, data);
600
601 /*
602 * Dismiss and then enable interrupt on GPP interrupt cause
603 * for CPU #0
604 */
605 mv64x60_write(&bh, MV64x60_GPP_INTR_CAUSE, ~(1 << 28));
606 data = mv64x60_read(&bh, MV64x60_GPP_INTR_MASK);
607 data |= (1 << 28);
608 mv64x60_write(&bh, MV64x60_GPP_INTR_MASK, data);
609
610 /*
611 * Dismiss and then enable interrupt on CPU #0 high cause reg
612 * BIT27 summarizes GPP interrupts 23-31
613 */
614 mv64x60_write(&bh, MV64360_IC_MAIN_CAUSE_HI, ~(1 << 27));
615 data = mv64x60_read(&bh, MV64360_IC_CPU0_INTR_MASK_HI);
616 data |= (1 << 27);
617 mv64x60_write(&bh, MV64360_IC_CPU0_INTR_MASK_HI, data);
618}
619
620/*****************************************************************************
621 * Platform device data fixup routines.
622 *****************************************************************************/
623
624#if defined(CONFIG_SERIAL_MPSC)
625static void __init ppc7d_fixup_mpsc_pdata(struct platform_device *pdev)
626{
627 struct mpsc_pdata *pdata;
628
629 pdata = (struct mpsc_pdata *)pdev->dev.platform_data;
630
631 pdata->max_idle = 40;
632 pdata->default_baud = PPC7D_DEFAULT_BAUD;
633 pdata->brg_clk_src = PPC7D_MPSC_CLK_SRC;
634 pdata->brg_clk_freq = PPC7D_MPSC_CLK_FREQ;
635
636 return;
637}
638#endif
639
640#if defined(CONFIG_MV643XX_ETH)
641static void __init ppc7d_fixup_eth_pdata(struct platform_device *pdev)
642{
643 struct mv643xx_eth_platform_data *eth_pd;
644 static u16 phy_addr[] = {
645 PPC7D_ETH0_PHY_ADDR,
646 PPC7D_ETH1_PHY_ADDR,
647 PPC7D_ETH2_PHY_ADDR,
648 };
649 int i;
650
651 eth_pd = pdev->dev.platform_data;
652 eth_pd->force_phy_addr = 1;
653 eth_pd->phy_addr = phy_addr[pdev->id];
654 eth_pd->tx_queue_size = PPC7D_ETH_TX_QUEUE_SIZE;
655 eth_pd->rx_queue_size = PPC7D_ETH_RX_QUEUE_SIZE;
656
657 /* Adjust IRQ by mv64360_irq_base */
658 for (i = 0; i < pdev->num_resources; i++) {
659 struct resource *r = &pdev->resource[i];
660
661 if (r->flags & IORESOURCE_IRQ) {
662 r->start += mv64360_irq_base;
663 r->end += mv64360_irq_base;
664 pr_debug("%s, uses IRQ %d\n", pdev->name,
665 (int)r->start);
666 }
667 }
668
669}
670#endif
671
672#if defined(CONFIG_I2C_MV64XXX)
673static void __init
674ppc7d_fixup_i2c_pdata(struct platform_device *pdev)
675{
676 struct mv64xxx_i2c_pdata *pdata;
677 int i;
678
679 pdata = pdev->dev.platform_data;
680 if (pdata == NULL) {
681 pdata = kmalloc(sizeof(*pdata), GFP_KERNEL);
682 if (pdata == NULL)
683 return;
684
685 memset(pdata, 0, sizeof(*pdata));
686 pdev->dev.platform_data = pdata;
687 }
688
689 /* divisors M=8, N=3 for 100kHz I2C from 133MHz system clock */
690 pdata->freq_m = 8;
691 pdata->freq_n = 3;
692 pdata->timeout = 500;
693 pdata->retries = 3;
694
695 /* Adjust IRQ by mv64360_irq_base */
696 for (i = 0; i < pdev->num_resources; i++) {
697 struct resource *r = &pdev->resource[i];
698
699 if (r->flags & IORESOURCE_IRQ) {
700 r->start += mv64360_irq_base;
701 r->end += mv64360_irq_base;
702 pr_debug("%s, uses IRQ %d\n", pdev->name, (int) r->start);
703 }
704 }
705}
706#endif
707
708static int __init ppc7d_platform_notify(struct device *dev)
709{
710 static struct {
711 char *bus_id;
712 void ((*rtn) (struct platform_device * pdev));
713 } dev_map[] = {
714#if defined(CONFIG_SERIAL_MPSC)
715 { MPSC_CTLR_NAME ".0", ppc7d_fixup_mpsc_pdata },
716 { MPSC_CTLR_NAME ".1", ppc7d_fixup_mpsc_pdata },
717#endif
718#if defined(CONFIG_MV643XX_ETH)
719 { MV643XX_ETH_NAME ".0", ppc7d_fixup_eth_pdata },
720 { MV643XX_ETH_NAME ".1", ppc7d_fixup_eth_pdata },
721 { MV643XX_ETH_NAME ".2", ppc7d_fixup_eth_pdata },
722#endif
723#if defined(CONFIG_I2C_MV64XXX)
724 { MV64XXX_I2C_CTLR_NAME ".0", ppc7d_fixup_i2c_pdata },
725#endif
726 };
727 struct platform_device *pdev;
728 int i;
729
730 if (dev && dev->bus_id)
731 for (i = 0; i < ARRAY_SIZE(dev_map); i++)
732 if (!strncmp(dev->bus_id, dev_map[i].bus_id,
733 BUS_ID_SIZE)) {
734
735 pdev = container_of(dev,
736 struct platform_device,
737 dev);
738 dev_map[i].rtn(pdev);
739 }
740
741 return 0;
742}
743
744/*****************************************************************************
745 * PCI device fixups.
746 * These aren't really fixups per se. They are used to init devices as they
747 * are found during PCI scan.
748 *
749 * The PPC7D has an HB8 PCI-X bridge which must be set up during a PCI
750 * scan in order to find other devices on its secondary side.
751 *****************************************************************************/
752
753static void __init ppc7d_fixup_hb8(struct pci_dev *dev)
754{
755 u16 val16;
756
757 if (dev->bus->number == 0) {
758 pr_debug("PCI: HB8 init\n");
759
760 pci_write_config_byte(dev, 0x1c,
761 ((PPC7D_PCI0_IO_START_PCI_ADDR & 0xf000)
762 >> 8) | 0x01);
763 pci_write_config_byte(dev, 0x1d,
764 (((PPC7D_PCI0_IO_START_PCI_ADDR +
765 PPC7D_PCI0_IO_SIZE -
766 1) & 0xf000) >> 8) | 0x01);
767 pci_write_config_word(dev, 0x30,
768 PPC7D_PCI0_IO_START_PCI_ADDR >> 16);
769 pci_write_config_word(dev, 0x32,
770 ((PPC7D_PCI0_IO_START_PCI_ADDR +
771 PPC7D_PCI0_IO_SIZE -
772 1) >> 16) & 0xffff);
773
774 pci_write_config_word(dev, 0x20,
775 PPC7D_PCI0_MEM0_START_PCI_LO_ADDR >> 16);
776 pci_write_config_word(dev, 0x22,
777 ((PPC7D_PCI0_MEM0_START_PCI_LO_ADDR +
778 PPC7D_PCI0_MEM0_SIZE -
779 1) >> 16) & 0xffff);
780 pci_write_config_word(dev, 0x24, 0);
781 pci_write_config_word(dev, 0x26, 0);
782 pci_write_config_dword(dev, 0x28, 0);
783 pci_write_config_dword(dev, 0x2c, 0);
784
785 pci_read_config_word(dev, 0x3e, &val16);
786 val16 |= ((1 << 5) | (1 << 1)); /* signal master aborts and
787 * SERR to primary
788 */
789 val16 &= ~(1 << 2); /* ISA disable, so all ISA
790 * ports forwarded to secondary
791 */
792 pci_write_config_word(dev, 0x3e, val16);
793 }
794}
795
796DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_HINT, 0x0028, ppc7d_fixup_hb8);
797
798/* This should perhaps be a separate driver as we're actually initializing
799 * the chip for this board here. It's hardly a fixup...
800 */
801static void __init ppc7d_fixup_ali1535(struct pci_dev *dev)
802{
803 pr_debug("PCI: ALI1535 init\n");
804
805 if (dev->bus->number == 1) {
806 /* Configure the ISA Port Settings */
807 pci_write_config_byte(dev, 0x43, 0x00);
808
809 /* Disable PCI Interrupt polling mode */
810 pci_write_config_byte(dev, 0x45, 0x00);
811
812 /* Multifunction pin select INTFJ -> INTF */
813 pci_write_config_byte(dev, 0x78, 0x00);
814
815 /* Set PCI INT -> IRQ Routing control in for external
816 * pins south bridge.
817 */
818 pci_write_config_byte(dev, 0x48, 0x31); /* [7-4] INT B -> IRQ10
819 * [3-0] INT A -> IRQ9
820 */
821 pci_write_config_byte(dev, 0x49, 0x5D); /* [7-4] INT D -> IRQ5
822 * [3-0] INT C -> IRQ14
823 */
824
825 /* PPC7D setup */
826 /* NEC USB device on IRQ 11 (INTE) - INTF disabled */
827 pci_write_config_byte(dev, 0x4A, 0x09);
828
829 /* GPIO on IRQ 6 */
830 pci_write_config_byte(dev, 0x76, 0x07);
831
832 /* SIRQ I (COMS 5/6) use IRQ line 15.
833 * Positive (not subtractive) address decode.
834 */
835 pci_write_config_byte(dev, 0x44, 0x0f);
836
837 /* SIRQ II disabled */
838 pci_write_config_byte(dev, 0x75, 0x0);
839
840 /* On board USB and RTC disabled */
841 pci_write_config_word(dev, 0x52, (1 << 14));
842 pci_write_config_byte(dev, 0x74, 0x00);
843
844 /* On board IDE disabled */
845 pci_write_config_byte(dev, 0x58, 0x00);
846
847 /* Decode 32-bit addresses */
848 pci_write_config_byte(dev, 0x5b, 0);
849
850 /* Disable docking IO */
851 pci_write_config_word(dev, 0x5c, 0x0000);
852
853 /* Disable modem, enable sound */
854 pci_write_config_byte(dev, 0x77, (1 << 6));
855
856 /* Disable hot-docking mode */
857 pci_write_config_byte(dev, 0x7d, 0x00);
858 }
859}
860
861DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x1533, ppc7d_fixup_ali1535);
862
863static int ppc7d_pci_exclude_device(u8 bus, u8 devfn)
864{
865 /* Early versions of this board were fitted with IBM ALMA
866 * PCI-VME bridge chips. The PCI config space of these devices
867 * was not set up correctly and causes PCI scan problems.
868 */
869 if ((bus == 1) && (PCI_SLOT(devfn) == 4) && ppc7d_has_alma)
870 return PCIBIOS_DEVICE_NOT_FOUND;
871
872 return mv64x60_pci_exclude_device(bus, devfn);
873}
874
875/* This hook is called when each PCI bus is probed.
876 */
877static void ppc7d_pci_fixup_bus(struct pci_bus *bus)
878{
879 pr_debug("PCI BUS %hu: %lx/%lx %lx/%lx %lx/%lx %lx/%lx\n",
880 bus->number,
881 bus->resource[0] ? bus->resource[0]->start : 0,
882 bus->resource[0] ? bus->resource[0]->end : 0,
883 bus->resource[1] ? bus->resource[1]->start : 0,
884 bus->resource[1] ? bus->resource[1]->end : 0,
885 bus->resource[2] ? bus->resource[2]->start : 0,
886 bus->resource[2] ? bus->resource[2]->end : 0,
887 bus->resource[3] ? bus->resource[3]->start : 0,
888 bus->resource[3] ? bus->resource[3]->end : 0);
889
890 if ((bus->number == 1) && (bus->resource[2] != NULL)) {
891 /* Hide PCI window 2 of Bus 1 which is used only to
892 * map legacy ISA memory space.
893 */
894 bus->resource[2]->start = 0;
895 bus->resource[2]->end = 0;
896 bus->resource[2]->flags = 0;
897 }
898}
899
900/*****************************************************************************
901 * Board device setup code
902 *****************************************************************************/
903
904void __init ppc7d_setup_peripherals(void)
905{
906 u32 val32;
907
908 /* Set up windows for boot CS */
909 mv64x60_set_32bit_window(&bh, MV64x60_CPU2BOOT_WIN,
910 PPC7D_BOOT_WINDOW_BASE, PPC7D_BOOT_WINDOW_SIZE,
911 0);
912 bh.ci->enable_window_32bit(&bh, MV64x60_CPU2BOOT_WIN);
913
914 /* Boot firmware configures the following DevCS addresses.
915 * DevCS0 - board control/status
916 * DevCS1 - test registers
917 * DevCS2 - AFIX port/address registers (for identifying)
918 * DevCS3 - FLASH
919 *
920 * We don't use DevCS0, DevCS1.
921 */
922 val32 = mv64x60_read(&bh, MV64360_CPU_BAR_ENABLE);
923 val32 |= ((1 << 4) | (1 << 5));
924 mv64x60_write(&bh, MV64360_CPU_BAR_ENABLE, val32);
925 mv64x60_write(&bh, MV64x60_CPU2DEV_0_BASE, 0);
926 mv64x60_write(&bh, MV64x60_CPU2DEV_0_SIZE, 0);
927 mv64x60_write(&bh, MV64x60_CPU2DEV_1_BASE, 0);
928 mv64x60_write(&bh, MV64x60_CPU2DEV_1_SIZE, 0);
929
930 mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_2_WIN,
931 PPC7D_AFIX_REG_BASE, PPC7D_AFIX_REG_SIZE, 0);
932 bh.ci->enable_window_32bit(&bh, MV64x60_CPU2DEV_2_WIN);
933
934 mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_3_WIN,
935 PPC7D_FLASH_BASE, PPC7D_FLASH_SIZE_ACTUAL, 0);
936 bh.ci->enable_window_32bit(&bh, MV64x60_CPU2DEV_3_WIN);
937
938 mv64x60_set_32bit_window(&bh, MV64x60_CPU2SRAM_WIN,
939 PPC7D_INTERNAL_SRAM_BASE, MV64360_SRAM_SIZE,
940 0);
941 bh.ci->enable_window_32bit(&bh, MV64x60_CPU2SRAM_WIN);
942
943 /* Set up Enet->SRAM window */
944 mv64x60_set_32bit_window(&bh, MV64x60_ENET2MEM_4_WIN,
945 PPC7D_INTERNAL_SRAM_BASE, MV64360_SRAM_SIZE,
946 0x2);
947 bh.ci->enable_window_32bit(&bh, MV64x60_ENET2MEM_4_WIN);
948
949 /* Give enet r/w access to memory region */
950 val32 = mv64x60_read(&bh, MV64360_ENET2MEM_ACC_PROT_0);
951 val32 |= (0x3 << (4 << 1));
952 mv64x60_write(&bh, MV64360_ENET2MEM_ACC_PROT_0, val32);
953 val32 = mv64x60_read(&bh, MV64360_ENET2MEM_ACC_PROT_1);
954 val32 |= (0x3 << (4 << 1));
955 mv64x60_write(&bh, MV64360_ENET2MEM_ACC_PROT_1, val32);
956 val32 = mv64x60_read(&bh, MV64360_ENET2MEM_ACC_PROT_2);
957 val32 |= (0x3 << (4 << 1));
958 mv64x60_write(&bh, MV64360_ENET2MEM_ACC_PROT_2, val32);
959
960 val32 = mv64x60_read(&bh, MV64x60_TIMR_CNTR_0_3_CNTL);
961 val32 &= ~((1 << 0) | (1 << 8) | (1 << 16) | (1 << 24));
962 mv64x60_write(&bh, MV64x60_TIMR_CNTR_0_3_CNTL, val32);
963
964 /* Enumerate pci bus.
965 *
966 * We scan PCI#0 first (the bus with the HB8 and other
967 * on-board peripherals). We must configure the 64360 before
968 * each scan, according to the bus number assignments. Busses
969 * are assigned incrementally, starting at 0. PCI#0 is
970 * usually assigned bus#0, the secondary side of the HB8 gets
971 * bus#1 and PCI#1 (second PMC site) gets bus#2. However, if
972 * any PMC card has a PCI bridge, these bus assignments will
973 * change.
974 */
975
976 /* Turn off PCI retries */
977 val32 = mv64x60_read(&bh, MV64x60_CPU_CONFIG);
978 val32 |= (1 << 17);
979 mv64x60_write(&bh, MV64x60_CPU_CONFIG, val32);
980
981 /* Scan PCI#0 */
982 mv64x60_set_bus(&bh, 0, 0);
983 bh.hose_a->first_busno = 0;
984 bh.hose_a->last_busno = 0xff;
985 bh.hose_a->last_busno = pciauto_bus_scan(bh.hose_a, 0);
986 printk(KERN_INFO "PCI#0: first=%d last=%d\n",
987 bh.hose_a->first_busno, bh.hose_a->last_busno);
988
989 /* Scan PCI#1 */
990 bh.hose_b->first_busno = bh.hose_a->last_busno + 1;
991 mv64x60_set_bus(&bh, 1, bh.hose_b->first_busno);
992 bh.hose_b->last_busno = 0xff;
993 bh.hose_b->last_busno = pciauto_bus_scan(bh.hose_b,
994 bh.hose_b->first_busno);
995 printk(KERN_INFO "PCI#1: first=%d last=%d\n",
996 bh.hose_b->first_busno, bh.hose_b->last_busno);
997
998 /* Turn on PCI retries */
999 val32 = mv64x60_read(&bh, MV64x60_CPU_CONFIG);
1000 val32 &= ~(1 << 17);
1001 mv64x60_write(&bh, MV64x60_CPU_CONFIG, val32);
1002
1003 /* Setup interrupts */
1004 ppc7d_intr_setup();
1005}
1006
1007static void __init ppc7d_setup_bridge(void)
1008{
1009 struct mv64x60_setup_info si;
1010 int i;
1011 u32 temp;
1012
1013 mv64360_irq_base = 16; /* first 16 intrs are 2 x 8259's */
1014
1015 memset(&si, 0, sizeof(si));
1016
1017 si.phys_reg_base = CONFIG_MV64X60_NEW_BASE;
1018
1019 si.pci_0.enable_bus = 1;
1020 si.pci_0.pci_io.cpu_base = PPC7D_PCI0_IO_START_PROC_ADDR;
1021 si.pci_0.pci_io.pci_base_hi = 0;
1022 si.pci_0.pci_io.pci_base_lo = PPC7D_PCI0_IO_START_PCI_ADDR;
1023 si.pci_0.pci_io.size = PPC7D_PCI0_IO_SIZE;
1024 si.pci_0.pci_io.swap = MV64x60_CPU2PCI_SWAP_NONE;
1025 si.pci_0.pci_mem[0].cpu_base = PPC7D_PCI0_MEM0_START_PROC_ADDR;
1026 si.pci_0.pci_mem[0].pci_base_hi = PPC7D_PCI0_MEM0_START_PCI_HI_ADDR;
1027 si.pci_0.pci_mem[0].pci_base_lo = PPC7D_PCI0_MEM0_START_PCI_LO_ADDR;
1028 si.pci_0.pci_mem[0].size = PPC7D_PCI0_MEM0_SIZE;
1029 si.pci_0.pci_mem[0].swap = MV64x60_CPU2PCI_SWAP_NONE;
1030 si.pci_0.pci_mem[1].cpu_base = PPC7D_PCI0_MEM1_START_PROC_ADDR;
1031 si.pci_0.pci_mem[1].pci_base_hi = PPC7D_PCI0_MEM1_START_PCI_HI_ADDR;
1032 si.pci_0.pci_mem[1].pci_base_lo = PPC7D_PCI0_MEM1_START_PCI_LO_ADDR;
1033 si.pci_0.pci_mem[1].size = PPC7D_PCI0_MEM1_SIZE;
1034 si.pci_0.pci_mem[1].swap = MV64x60_CPU2PCI_SWAP_NONE;
1035 si.pci_0.pci_cmd_bits = 0;
1036 si.pci_0.latency_timer = 0x80;
1037
1038 si.pci_1.enable_bus = 1;
1039 si.pci_1.pci_io.cpu_base = PPC7D_PCI1_IO_START_PROC_ADDR;
1040 si.pci_1.pci_io.pci_base_hi = 0;
1041 si.pci_1.pci_io.pci_base_lo = PPC7D_PCI1_IO_START_PCI_ADDR;
1042 si.pci_1.pci_io.size = PPC7D_PCI1_IO_SIZE;
1043 si.pci_1.pci_io.swap = MV64x60_CPU2PCI_SWAP_NONE;
1044 si.pci_1.pci_mem[0].cpu_base = PPC7D_PCI1_MEM0_START_PROC_ADDR;
1045 si.pci_1.pci_mem[0].pci_base_hi = PPC7D_PCI1_MEM0_START_PCI_HI_ADDR;
1046 si.pci_1.pci_mem[0].pci_base_lo = PPC7D_PCI1_MEM0_START_PCI_LO_ADDR;
1047 si.pci_1.pci_mem[0].size = PPC7D_PCI1_MEM0_SIZE;
1048 si.pci_1.pci_mem[0].swap = MV64x60_CPU2PCI_SWAP_NONE;
1049 si.pci_1.pci_mem[1].cpu_base = PPC7D_PCI1_MEM1_START_PROC_ADDR;
1050 si.pci_1.pci_mem[1].pci_base_hi = PPC7D_PCI1_MEM1_START_PCI_HI_ADDR;
1051 si.pci_1.pci_mem[1].pci_base_lo = PPC7D_PCI1_MEM1_START_PCI_LO_ADDR;
1052 si.pci_1.pci_mem[1].size = PPC7D_PCI1_MEM1_SIZE;
1053 si.pci_1.pci_mem[1].swap = MV64x60_CPU2PCI_SWAP_NONE;
1054 si.pci_1.pci_cmd_bits = 0;
1055 si.pci_1.latency_timer = 0x80;
1056
1057 /* Don't clear the SRAM window since we use it for debug */
1058 si.window_preserve_mask_32_lo = (1 << MV64x60_CPU2SRAM_WIN);
1059
1060 printk(KERN_INFO "PCI: MV64360 PCI#0 IO at %x, size %x\n",
1061 si.pci_0.pci_io.cpu_base, si.pci_0.pci_io.size);
1062 printk(KERN_INFO "PCI: MV64360 PCI#1 IO at %x, size %x\n",
1063 si.pci_1.pci_io.cpu_base, si.pci_1.pci_io.size);
1064
1065 for (i = 0; i < MV64x60_CPU2MEM_WINDOWS; i++) {
1066#if defined(CONFIG_NOT_COHERENT_CACHE)
1067 si.cpu_prot_options[i] = 0;
1068 si.enet_options[i] = MV64360_ENET2MEM_SNOOP_NONE;
1069 si.mpsc_options[i] = MV64360_MPSC2MEM_SNOOP_NONE;
1070 si.idma_options[i] = MV64360_IDMA2MEM_SNOOP_NONE;
1071
1072 si.pci_0.acc_cntl_options[i] =
1073 MV64360_PCI_ACC_CNTL_SNOOP_NONE |
1074 MV64360_PCI_ACC_CNTL_SWAP_NONE |
1075 MV64360_PCI_ACC_CNTL_MBURST_128_BYTES |
1076 MV64360_PCI_ACC_CNTL_RDSIZE_256_BYTES;
1077
1078 si.pci_1.acc_cntl_options[i] =
1079 MV64360_PCI_ACC_CNTL_SNOOP_NONE |
1080 MV64360_PCI_ACC_CNTL_SWAP_NONE |
1081 MV64360_PCI_ACC_CNTL_MBURST_128_BYTES |
1082 MV64360_PCI_ACC_CNTL_RDSIZE_256_BYTES;
1083#else
1084 si.cpu_prot_options[i] = 0;
1085 /* All PPC7D hardware uses B0 or newer MV64360 silicon which
1086 * does not have snoop bugs.
1087 */
1088 si.enet_options[i] = MV64360_ENET2MEM_SNOOP_WB;
1089 si.mpsc_options[i] = MV64360_MPSC2MEM_SNOOP_WB;
1090 si.idma_options[i] = MV64360_IDMA2MEM_SNOOP_WB;
1091
1092 si.pci_0.acc_cntl_options[i] =
1093 MV64360_PCI_ACC_CNTL_SNOOP_WB |
1094 MV64360_PCI_ACC_CNTL_SWAP_NONE |
1095 MV64360_PCI_ACC_CNTL_MBURST_32_BYTES |
1096 MV64360_PCI_ACC_CNTL_RDSIZE_32_BYTES;
1097
1098 si.pci_1.acc_cntl_options[i] =
1099 MV64360_PCI_ACC_CNTL_SNOOP_WB |
1100 MV64360_PCI_ACC_CNTL_SWAP_NONE |
1101 MV64360_PCI_ACC_CNTL_MBURST_32_BYTES |
1102 MV64360_PCI_ACC_CNTL_RDSIZE_32_BYTES;
1103#endif
1104 }
1105
1106 /* Lookup PCI host bridges */
1107 if (mv64x60_init(&bh, &si))
1108 printk(KERN_ERR "MV64360 initialization failed.\n");
1109
1110 pr_debug("MV64360 regs @ %lx/%p\n", bh.p_base, bh.v_base);
1111
1112 /* Enable WB Cache coherency on SRAM */
1113 temp = mv64x60_read(&bh, MV64360_SRAM_CONFIG);
1114 pr_debug("SRAM_CONFIG: %x\n", temp);
1115#if defined(CONFIG_NOT_COHERENT_CACHE)
1116 mv64x60_write(&bh, MV64360_SRAM_CONFIG, temp & ~0x2);
1117#else
1118 mv64x60_write(&bh, MV64360_SRAM_CONFIG, temp | 0x2);
1119#endif
1120 /* If system operates with internal bus arbiter (CPU master
1121 * control bit8) clear AACK Delay bit [25] in CPU
1122 * configuration register.
1123 */
1124 temp = mv64x60_read(&bh, MV64x60_CPU_MASTER_CNTL);
1125 if (temp & (1 << 8)) {
1126 temp = mv64x60_read(&bh, MV64x60_CPU_CONFIG);
1127 mv64x60_write(&bh, MV64x60_CPU_CONFIG, (temp & ~(1 << 25)));
1128 }
1129
1130 /* Data and address parity is enabled */
1131 temp = mv64x60_read(&bh, MV64x60_CPU_CONFIG);
1132 mv64x60_write(&bh, MV64x60_CPU_CONFIG,
1133 (temp | (1 << 26) | (1 << 19)));
1134
1135 pci_dram_offset = 0; /* sys mem at same addr on PCI & cpu bus */
1136 ppc_md.pci_swizzle = common_swizzle;
1137 ppc_md.pci_map_irq = ppc7d_map_irq;
1138 ppc_md.pci_exclude_device = ppc7d_pci_exclude_device;
1139
1140 mv64x60_set_bus(&bh, 0, 0);
1141 bh.hose_a->first_busno = 0;
1142 bh.hose_a->last_busno = 0xff;
1143 bh.hose_a->mem_space.start = PPC7D_PCI0_MEM0_START_PCI_LO_ADDR;
1144 bh.hose_a->mem_space.end =
1145 PPC7D_PCI0_MEM0_START_PCI_LO_ADDR + PPC7D_PCI0_MEM0_SIZE;
1146
1147 /* These will be set later, as a result of PCI0 scan */
1148 bh.hose_b->first_busno = 0;
1149 bh.hose_b->last_busno = 0xff;
1150 bh.hose_b->mem_space.start = PPC7D_PCI1_MEM0_START_PCI_LO_ADDR;
1151 bh.hose_b->mem_space.end =
1152 PPC7D_PCI1_MEM0_START_PCI_LO_ADDR + PPC7D_PCI1_MEM0_SIZE;
1153
1154 pr_debug("MV64360: PCI#0 IO decode %08x/%08x IO remap %08x\n",
1155 mv64x60_read(&bh, 0x48), mv64x60_read(&bh, 0x50),
1156 mv64x60_read(&bh, 0xf0));
1157}
1158
1159static void __init ppc7d_setup_arch(void)
1160{
1161 int port;
1162
1163 loops_per_jiffy = 100000000 / HZ;
1164
1165#ifdef CONFIG_BLK_DEV_INITRD
1166 if (initrd_start)
1167 ROOT_DEV = Root_RAM0;
1168 else
1169#endif
1170#ifdef CONFIG_ROOT_NFS
1171 ROOT_DEV = Root_NFS;
1172#else
1173 ROOT_DEV = Root_HDA1;
1174#endif
1175
1176 if ((cur_cpu_spec[0]->cpu_features & CPU_FTR_SPEC7450) ||
1177 (cur_cpu_spec[0]->cpu_features & CPU_FTR_L3CR))
1178 /* 745x is different. We only want to pass along enable. */
1179 _set_L2CR(L2CR_L2E);
1180 else if (cur_cpu_spec[0]->cpu_features & CPU_FTR_L2CR)
1181 /* All modules have 1MB of L2. We also assume that an
1182 * L2 divisor of 3 will work.
1183 */
1184 _set_L2CR(L2CR_L2E | L2CR_L2SIZ_1MB | L2CR_L2CLK_DIV3
1185 | L2CR_L2RAM_PIPE | L2CR_L2OH_1_0 | L2CR_L2DF);
1186
1187 if (cur_cpu_spec[0]->cpu_features & CPU_FTR_L3CR)
1188 /* No L3 cache */
1189 _set_L3CR(0);
1190
1191#ifdef CONFIG_DUMMY_CONSOLE
1192 conswitchp = &dummy_con;
1193#endif
1194
1195 /* Lookup PCI host bridges */
1196 if (ppc_md.progress)
1197 ppc_md.progress("ppc7d_setup_arch: calling setup_bridge", 0);
1198
1199 ppc7d_setup_bridge();
1200 ppc7d_setup_peripherals();
1201
1202 /* Disable ethernet. It might have been setup by the bootrom */
1203 for (port = 0; port < 3; port++)
1204 mv64x60_write(&bh, MV643XX_ETH_RECEIVE_QUEUE_COMMAND_REG(port),
1205 0x0000ff00);
1206
1207 /* Clear queue pointers to ensure they are all initialized,
1208 * otherwise since queues 1-7 are unused, they have random
1209 * pointers which look strange in register dumps. Don't bother
1210 * with queue 0 since it will be initialized later.
1211 */
1212 for (port = 0; port < 3; port++) {
1213 mv64x60_write(&bh,
1214 MV643XX_ETH_RX_CURRENT_QUEUE_DESC_PTR_1(port),
1215 0x00000000);
1216 mv64x60_write(&bh,
1217 MV643XX_ETH_RX_CURRENT_QUEUE_DESC_PTR_2(port),
1218 0x00000000);
1219 mv64x60_write(&bh,
1220 MV643XX_ETH_RX_CURRENT_QUEUE_DESC_PTR_3(port),
1221 0x00000000);
1222 mv64x60_write(&bh,
1223 MV643XX_ETH_RX_CURRENT_QUEUE_DESC_PTR_4(port),
1224 0x00000000);
1225 mv64x60_write(&bh,
1226 MV643XX_ETH_RX_CURRENT_QUEUE_DESC_PTR_5(port),
1227 0x00000000);
1228 mv64x60_write(&bh,
1229 MV643XX_ETH_RX_CURRENT_QUEUE_DESC_PTR_6(port),
1230 0x00000000);
1231 mv64x60_write(&bh,
1232 MV643XX_ETH_RX_CURRENT_QUEUE_DESC_PTR_7(port),
1233 0x00000000);
1234 }
1235
1236 printk(KERN_INFO "Radstone Technology PPC7D\n");
1237 if (ppc_md.progress)
1238 ppc_md.progress("ppc7d_setup_arch: exit", 0);
1239}
1240
1241/* This kernel command line parameter can be used to have the target
1242 * wait for a JTAG debugger to attach. Of course, a JTAG debugger
1243 * with hardware breakpoint support can have the target stop at any
1244 * location during init, but this is a convenience feature that makes
1245 * it easier in the common case of loading the code using the ppcboot
1246 * bootloader..
1247 */
1248static unsigned long ppc7d_wait_debugger;
1249
1250static int __init ppc7d_waitdbg(char *str)
1251{
1252 ppc7d_wait_debugger = 1;
1253 return 1;
1254}
1255
1256__setup("waitdbg", ppc7d_waitdbg);
1257
1258/* Second phase board init, called after other (architecture common)
1259 * low-level services have been initialized.
1260 */
1261static void ppc7d_init2(void)
1262{
1263 unsigned long flags;
1264 u32 data;
1265 u8 data8;
1266
1267 pr_debug("%s: enter\n", __FUNCTION__);
1268
1269 /* Wait for debugger? */
1270 if (ppc7d_wait_debugger) {
1271 printk("Waiting for debugger...\n");
1272
1273 while (readl(&ppc7d_wait_debugger)) ;
1274 }
1275
1276 /* Hook up i8259 interrupt which is connected to GPP28 */
1277 request_irq(mv64360_irq_base + MV64x60_IRQ_GPP28, ppc7d_i8259_intr,
1278 SA_INTERRUPT, "I8259 (GPP28) interrupt", (void *)0);
1279
1280 /* Configure MPP16 as watchdog NMI, MPP17 as watchdog WDE */
1281 spin_lock_irqsave(&mv64x60_lock, flags);
1282 data = mv64x60_read(&bh, MV64x60_MPP_CNTL_2);
1283 data &= ~(0x0000000f << 0);
1284 data |= (0x00000004 << 0);
1285 data &= ~(0x0000000f << 4);
1286 data |= (0x00000004 << 4);
1287 mv64x60_write(&bh, MV64x60_MPP_CNTL_2, data);
1288 spin_unlock_irqrestore(&mv64x60_lock, flags);
1289
1290 /* All LEDs off */
1291 data8 = inb(PPC7D_CPLD_LEDS);
1292 data8 &= ~0x08;
1293 data8 |= 0x07;
1294 outb(data8, PPC7D_CPLD_LEDS);
1295
1296 pr_debug("%s: exit\n", __FUNCTION__);
1297}
1298
1299/* Called from machine_init(), early, before any of the __init functions
1300 * have run. We must init software-configurable pins before other functions
1301 * such as interrupt controllers are initialised.
1302 */
1303void __init platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
1304 unsigned long r6, unsigned long r7)
1305{
1306 u8 val8;
1307 u8 rev_num;
1308
1309 /* Map 0xe0000000-0xffffffff early because we need access to SRAM
1310 * and the ISA memory space (for serial port) here. This mapping
1311 * is redone properly in ppc7d_map_io() later.
1312 */
1313 mtspr(SPRN_DBAT3U, 0xe0003fff);
1314 mtspr(SPRN_DBAT3L, 0xe000002a);
1315
1316 /*
1317 * Zero SRAM. Note that this generates parity errors on
1318 * internal data path in SRAM if it's first time accessing it
1319 * after reset.
1320 *
1321 * We do this ASAP to avoid parity errors when reading
1322 * uninitialized SRAM.
1323 */
1324 memset((void *)PPC7D_INTERNAL_SRAM_BASE, 0, MV64360_SRAM_SIZE);
1325
1326 pr_debug("platform_init: r3-r7: %lx %lx %lx %lx %lx\n",
1327 r3, r4, r5, r6, r7);
1328
1329 parse_bootinfo(find_bootinfo());
1330
1331 /* ASSUMPTION: If both r3 (bd_t pointer) and r6 (cmdline pointer)
1332 * are non-zero, then we should use the board info from the bd_t
1333 * structure and the cmdline pointed to by r6 instead of the
1334 * information from birecs, if any. Otherwise, use the information
1335 * from birecs as discovered by the preceeding call to
1336 * parse_bootinfo(). This rule should work with both PPCBoot, which
1337 * uses a bd_t board info structure, and the kernel boot wrapper,
1338 * which uses birecs.
1339 */
1340 if (r3 && r6) {
1341 bd_t *bp = (bd_t *) __res;
1342
1343 /* copy board info structure */
1344 memcpy((void *)__res, (void *)(r3 + KERNELBASE), sizeof(bd_t));
1345 /* copy command line */
1346 *(char *)(r7 + KERNELBASE) = 0;
1347 strcpy(cmd_line, (char *)(r6 + KERNELBASE));
1348
1349 printk(KERN_INFO "Board info data:-\n");
1350 printk(KERN_INFO " Internal freq: %lu MHz, bus freq: %lu MHz\n",
1351 bp->bi_intfreq, bp->bi_busfreq);
1352 printk(KERN_INFO " Memory: %lx, size %lx\n", bp->bi_memstart,
1353 bp->bi_memsize);
1354 printk(KERN_INFO " Console baudrate: %lu\n", bp->bi_baudrate);
1355 printk(KERN_INFO " Ethernet address: "
1356 "%02x:%02x:%02x:%02x:%02x:%02x\n",
1357 bp->bi_enetaddr[0], bp->bi_enetaddr[1],
1358 bp->bi_enetaddr[2], bp->bi_enetaddr[3],
1359 bp->bi_enetaddr[4], bp->bi_enetaddr[5]);
1360 }
1361#ifdef CONFIG_BLK_DEV_INITRD
1362 /* take care of initrd if we have one */
1363 if (r4) {
1364 initrd_start = r4 + KERNELBASE;
1365 initrd_end = r5 + KERNELBASE;
1366 printk(KERN_INFO "INITRD @ %lx/%lx\n", initrd_start, initrd_end);
1367 }
1368#endif /* CONFIG_BLK_DEV_INITRD */
1369
1370 /* Map in board regs, etc. */
1371 isa_io_base = 0xe8000000;
1372 isa_mem_base = 0xe8000000;
1373 pci_dram_offset = 0x00000000;
1374 ISA_DMA_THRESHOLD = 0x00ffffff;
1375 DMA_MODE_READ = 0x44;
1376 DMA_MODE_WRITE = 0x48;
1377
1378 ppc_md.setup_arch = ppc7d_setup_arch;
1379 ppc_md.init = ppc7d_init2;
1380 ppc_md.show_cpuinfo = ppc7d_show_cpuinfo;
1381 ppc_md.irq_canonicalize = ppc7d_irq_canonicalize;
1382 ppc_md.init_IRQ = ppc7d_init_irq;
1383 ppc_md.get_irq = ppc7d_get_irq;
1384
1385 ppc_md.restart = ppc7d_restart;
1386 ppc_md.power_off = ppc7d_power_off;
1387 ppc_md.halt = ppc7d_halt;
1388
1389 ppc_md.find_end_of_memory = ppc7d_find_end_of_memory;
1390 ppc_md.setup_io_mappings = ppc7d_map_io;
1391
1392 ppc_md.time_init = NULL;
1393 ppc_md.set_rtc_time = NULL;
1394 ppc_md.get_rtc_time = NULL;
1395 ppc_md.calibrate_decr = ppc7d_calibrate_decr;
1396 ppc_md.nvram_read_val = NULL;
1397 ppc_md.nvram_write_val = NULL;
1398
1399 ppc_md.heartbeat = ppc7d_heartbeat;
1400 ppc_md.heartbeat_reset = HZ;
1401 ppc_md.heartbeat_count = ppc_md.heartbeat_reset;
1402
1403 ppc_md.pcibios_fixup_bus = ppc7d_pci_fixup_bus;
1404
1405#if defined(CONFIG_SERIAL_MPSC) || defined(CONFIG_MV643XX_ETH) || \
1406 defined(CONFIG_I2C_MV64XXX)
1407 platform_notify = ppc7d_platform_notify;
1408#endif
1409
1410#ifdef CONFIG_SERIAL_MPSC
1411 /* On PPC7D, we must configure MPSC support via CPLD control
1412 * registers.
1413 */
1414 outb(PPC7D_CPLD_RTS_COM4_SCLK |
1415 PPC7D_CPLD_RTS_COM56_ENABLED, PPC7D_CPLD_RTS);
1416 outb(PPC7D_CPLD_COMS_COM3_TCLKEN |
1417 PPC7D_CPLD_COMS_COM3_TXEN |
1418 PPC7D_CPLD_COMS_COM4_TCLKEN |
1419 PPC7D_CPLD_COMS_COM4_TXEN, PPC7D_CPLD_COMS);
1420#endif /* CONFIG_SERIAL_MPSC */
1421
1422#if defined(CONFIG_KGDB) || defined(CONFIG_SERIAL_TEXT_DEBUG)
1423 ppc7d_early_serial_map();
1424#ifdef CONFIG_SERIAL_TEXT_DEBUG
1425#if defined(CONFIG_SERIAL_MPSC_CONSOLE)
1426 ppc_md.progress = mv64x60_mpsc_progress;
1427#elif defined(CONFIG_SERIAL_8250)
1428 ppc_md.progress = gen550_progress;
1429#else
1430#error CONFIG_KGDB || CONFIG_SERIAL_TEXT_DEBUG has no supported CONFIG_SERIAL_XXX
1431#endif /* CONFIG_SERIAL_8250 */
1432#endif /* CONFIG_SERIAL_TEXT_DEBUG */
1433#endif /* CONFIG_KGDB || CONFIG_SERIAL_TEXT_DEBUG */
1434
1435 /* Enable write access to user flash. This is necessary for
1436 * flash probe.
1437 */
1438 val8 = readb((void *)isa_io_base + PPC7D_CPLD_SW_FLASH_WRITE_PROTECT);
1439 writeb(val8 | (PPC7D_CPLD_SW_FLASH_WRPROT_ENABLED &
1440 PPC7D_CPLD_SW_FLASH_WRPROT_USER_MASK),
1441 (void *)isa_io_base + PPC7D_CPLD_SW_FLASH_WRITE_PROTECT);
1442
1443 /* Determine if this board has IBM ALMA VME devices */
1444 val8 = readb((void *)isa_io_base + PPC7D_CPLD_BOARD_REVISION);
1445 rev_num = (val8 & PPC7D_CPLD_BOARD_REVISION_NUMBER_MASK) >> 5;
1446 if (rev_num <= 1)
1447 ppc7d_has_alma = 1;
1448
1449#ifdef DEBUG
1450 console_printk[0] = 8;
1451#endif
1452}
diff --git a/arch/ppc/platforms/radstone_ppc7d.h b/arch/ppc/platforms/radstone_ppc7d.h
new file mode 100644
index 000000000000..4546fff2b0c3
--- /dev/null
+++ b/arch/ppc/platforms/radstone_ppc7d.h
@@ -0,0 +1,434 @@
1/*
2 * arch/ppc/platforms/radstone_ppc7d.h
3 *
4 * Board definitions for the Radstone PPC7D boards.
5 *
6 * Author: James Chapman <jchapman@katalix.com>
7 *
8 * Based on code done by Rabeeh Khoury - rabeeh@galileo.co.il
9 * Based on code done by - Mark A. Greer <mgreer@mvista.com>
10 *
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
15 */
16
17/*
18 * The MV64360 has 2 PCI buses each with 1 window from the CPU bus to
19 * PCI I/O space and 4 windows from the CPU bus to PCI MEM space.
20 * We'll only use one PCI MEM window on each PCI bus.
21 *
22 * This is the CPU physical memory map (windows must be at least 1MB
23 * and start on a boundary that is a multiple of the window size):
24 *
25 * 0xff800000-0xffffffff - Boot window
26 * 0xff000000-0xff000fff - AFIX registers (DevCS2)
27 * 0xfef00000-0xfef0ffff - Internal MV64x60 registers
28 * 0xfef40000-0xfef7ffff - Internal SRAM
29 * 0xfef00000-0xfef0ffff - MV64360 Registers
30 * 0x70000000-0x7fffffff - soldered flash (DevCS3)
31 * 0xe8000000-0xe9ffffff - PCI I/O
32 * 0x80000000-0xbfffffff - PCI MEM
33 */
34
35#ifndef __PPC_PLATFORMS_PPC7D_H
36#define __PPC_PLATFORMS_PPC7D_H
37
38#include <asm/ppcboot.h>
39
40/*****************************************************************************
41 * CPU Physical Memory Map setup.
42 *****************************************************************************/
43
44#define PPC7D_BOOT_WINDOW_BASE 0xff800000
45#define PPC7D_AFIX_REG_BASE 0xff000000
46#define PPC7D_INTERNAL_SRAM_BASE 0xfef40000
47#define PPC7D_FLASH_BASE 0x70000000
48
49#define PPC7D_BOOT_WINDOW_SIZE_ACTUAL 0x00800000 /* 8MB */
50#define PPC7D_FLASH_SIZE_ACTUAL 0x10000000 /* 256MB */
51
52#define PPC7D_BOOT_WINDOW_SIZE max(MV64360_WINDOW_SIZE_MIN, \
53 PPC7D_BOOT_WINDOW_SIZE_ACTUAL)
54#define PPC7D_FLASH_SIZE max(MV64360_WINDOW_SIZE_MIN, \
55 PPC7D_FLASH_SIZE_ACTUAL)
56#define PPC7D_AFIX_REG_SIZE max(MV64360_WINDOW_SIZE_MIN, 0xff)
57
58
59#define PPC7D_PCI0_MEM0_START_PROC_ADDR 0x80000000UL
60#define PPC7D_PCI0_MEM0_START_PCI_HI_ADDR 0x00000000UL
61#define PPC7D_PCI0_MEM0_START_PCI_LO_ADDR 0x80000000UL
62#define PPC7D_PCI0_MEM0_SIZE 0x20000000UL
63#define PPC7D_PCI0_MEM1_START_PROC_ADDR 0xe8010000UL
64#define PPC7D_PCI0_MEM1_START_PCI_HI_ADDR 0x00000000UL
65#define PPC7D_PCI0_MEM1_START_PCI_LO_ADDR 0x00000000UL
66#define PPC7D_PCI0_MEM1_SIZE 0x000f0000UL
67#define PPC7D_PCI0_IO_START_PROC_ADDR 0xe8000000UL
68#define PPC7D_PCI0_IO_START_PCI_ADDR 0x00000000UL
69#define PPC7D_PCI0_IO_SIZE 0x00010000UL
70
71#define PPC7D_PCI1_MEM0_START_PROC_ADDR 0xa0000000UL
72#define PPC7D_PCI1_MEM0_START_PCI_HI_ADDR 0x00000000UL
73#define PPC7D_PCI1_MEM0_START_PCI_LO_ADDR 0xa0000000UL
74#define PPC7D_PCI1_MEM0_SIZE 0x20000000UL
75#define PPC7D_PCI1_MEM1_START_PROC_ADDR 0xe9800000UL
76#define PPC7D_PCI1_MEM1_START_PCI_HI_ADDR 0x00000000UL
77#define PPC7D_PCI1_MEM1_START_PCI_LO_ADDR 0x00000000UL
78#define PPC7D_PCI1_MEM1_SIZE 0x00800000UL
79#define PPC7D_PCI1_IO_START_PROC_ADDR 0xe9000000UL
80#define PPC7D_PCI1_IO_START_PCI_ADDR 0x00000000UL
81#define PPC7D_PCI1_IO_SIZE 0x00010000UL
82
83#define PPC7D_DEFAULT_BAUD 9600
84#define PPC7D_MPSC_CLK_SRC 8 /* TCLK */
85#define PPC7D_MPSC_CLK_FREQ 133333333 /* 133.3333... MHz */
86
87#define PPC7D_ETH0_PHY_ADDR 8
88#define PPC7D_ETH1_PHY_ADDR 9
89#define PPC7D_ETH2_PHY_ADDR 0
90
91#define PPC7D_ETH_TX_QUEUE_SIZE 400
92#define PPC7D_ETH_RX_QUEUE_SIZE 400
93
94#define PPC7D_ETH_PORT_CONFIG_VALUE \
95 MV64340_ETH_UNICAST_NORMAL_MODE | \
96 MV64340_ETH_DEFAULT_RX_QUEUE_0 | \
97 MV64340_ETH_DEFAULT_RX_ARP_QUEUE_0 | \
98 MV64340_ETH_RECEIVE_BC_IF_NOT_IP_OR_ARP | \
99 MV64340_ETH_RECEIVE_BC_IF_IP | \
100 MV64340_ETH_RECEIVE_BC_IF_ARP | \
101 MV64340_ETH_CAPTURE_TCP_FRAMES_DIS | \
102 MV64340_ETH_CAPTURE_UDP_FRAMES_DIS | \
103 MV64340_ETH_DEFAULT_RX_TCP_QUEUE_0 | \
104 MV64340_ETH_DEFAULT_RX_UDP_QUEUE_0 | \
105 MV64340_ETH_DEFAULT_RX_BPDU_QUEUE_0
106
107#define PPC7D_ETH_PORT_CONFIG_EXTEND_VALUE \
108 MV64340_ETH_SPAN_BPDU_PACKETS_AS_NORMAL | \
109 MV64340_ETH_PARTITION_DISABLE
110
111#define GT_ETH_IPG_INT_RX(value) \
112 ((value & 0x3fff) << 8)
113
114#define PPC7D_ETH_PORT_SDMA_CONFIG_VALUE \
115 MV64340_ETH_RX_BURST_SIZE_4_64BIT | \
116 GT_ETH_IPG_INT_RX(0) | \
117 MV64340_ETH_TX_BURST_SIZE_4_64BIT
118
119#define PPC7D_ETH_PORT_SERIAL_CONTROL_VALUE \
120 MV64340_ETH_ENABLE_AUTO_NEG_FOR_DUPLX | \
121 MV64340_ETH_DISABLE_AUTO_NEG_FOR_FLOW_CTRL | \
122 MV64340_ETH_ADV_SYMMETRIC_FLOW_CTRL | \
123 MV64340_ETH_FORCE_FC_MODE_NO_PAUSE_DIS_TX | \
124 MV64340_ETH_FORCE_BP_MODE_NO_JAM | \
125 (1 << 9) | \
126 MV64340_ETH_DO_NOT_FORCE_LINK_FAIL | \
127 MV64340_ETH_RETRANSMIT_16_ATTEMPTS | \
128 MV64340_ETH_ENABLE_AUTO_NEG_SPEED_GMII | \
129 MV64340_ETH_DTE_ADV_0 | \
130 MV64340_ETH_DISABLE_AUTO_NEG_BYPASS | \
131 MV64340_ETH_AUTO_NEG_NO_CHANGE | \
132 MV64340_ETH_MAX_RX_PACKET_9700BYTE | \
133 MV64340_ETH_CLR_EXT_LOOPBACK | \
134 MV64340_ETH_SET_FULL_DUPLEX_MODE | \
135 MV64340_ETH_ENABLE_FLOW_CTRL_TX_RX_IN_FULL_DUPLEX
136
137/*****************************************************************************
138 * Serial defines.
139 *****************************************************************************/
140
141#define PPC7D_SERIAL_0 0xe80003f8
142#define PPC7D_SERIAL_1 0xe80002f8
143
144#define RS_TABLE_SIZE 2
145
146/* Rate for the 1.8432 Mhz clock for the onboard serial chip */
147#define UART_CLK 1843200
148#define BASE_BAUD ( UART_CLK / 16 )
149
150#ifdef CONFIG_SERIAL_DETECT_IRQ
151#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_AUTO_IRQ)
152#else
153#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF)
154#endif
155
156#define STD_SERIAL_PORT_DFNS \
157 { 0, BASE_BAUD, PPC7D_SERIAL_0, 4, STD_COM_FLAGS, /* ttyS0 */ \
158 iomem_base: (u8 *)PPC7D_SERIAL_0, \
159 io_type: SERIAL_IO_MEM, }, \
160 { 0, BASE_BAUD, PPC7D_SERIAL_1, 3, STD_COM_FLAGS, /* ttyS1 */ \
161 iomem_base: (u8 *)PPC7D_SERIAL_1, \
162 io_type: SERIAL_IO_MEM },
163
164#define SERIAL_PORT_DFNS \
165 STD_SERIAL_PORT_DFNS
166
167/*****************************************************************************
168 * CPLD defines.
169 *
170 * Register map:-
171 *
172 * 0000 to 000F South Bridge DMA 1 Control
173 * 0020 and 0021 South Bridge Interrupt 1 Control
174 * 0040 to 0043 South Bridge Counter Control
175 * 0060 Keyboard
176 * 0061 South Bridge NMI Status and Control
177 * 0064 Keyboard
178 * 0071 and 0072 RTC R/W
179 * 0078 to 007B South Bridge BIOS Timer
180 * 0080 to 0090 South Bridge DMA Pages
181 * 00A0 and 00A1 South Bridge Interrupt 2 Control
182 * 00C0 to 00DE South Bridge DMA 2 Control
183 * 02E8 to 02EF COM6 R/W
184 * 02F8 to 02FF South Bridge COM2 R/W
185 * 03E8 to 03EF COM5 R/W
186 * 03F8 to 03FF South Bridge COM1 R/W
187 * 040A South Bridge DMA Scatter/Gather RO
188 * 040B DMA 1 Extended Mode WO
189 * 0410 to 043F South Bridge DMA Scatter/Gather
190 * 0481 to 048B South Bridge DMA High Pages
191 * 04D0 and 04D1 South Bridge Edge/Level Control
192 * 04D6 DMA 2 Extended Mode WO
193 * 0804 Memory Configuration RO
194 * 0806 Memory Configuration Extend RO
195 * 0808 SCSI Activity LED R/W
196 * 080C Equipment Present 1 RO
197 * 080E Equipment Present 2 RO
198 * 0810 Equipment Present 3 RO
199 * 0812 Equipment Present 4 RO
200 * 0818 Key Lock RO
201 * 0820 LEDS R/W
202 * 0824 COMs R/W
203 * 0826 RTS R/W
204 * 0828 Reset R/W
205 * 082C Watchdog Trig R/W
206 * 082E Interrupt R/W
207 * 0830 Interrupt Status RO
208 * 0832 PCI configuration RO
209 * 0854 Board Revision RO
210 * 0858 Extended ID RO
211 * 0864 ID Link RO
212 * 0866 Motherboard Type RO
213 * 0868 FLASH Write control RO
214 * 086A Software FLASH write protect R/W
215 * 086E FLASH Control R/W
216 *****************************************************************************/
217
218#define PPC7D_CPLD_MEM_CONFIG 0x0804
219#define PPC7D_CPLD_MEM_CONFIG_EXTEND 0x0806
220#define PPC7D_CPLD_SCSI_ACTIVITY_LED 0x0808
221#define PPC7D_CPLD_EQUIPMENT_PRESENT_1 0x080C
222#define PPC7D_CPLD_EQUIPMENT_PRESENT_2 0x080E
223#define PPC7D_CPLD_EQUIPMENT_PRESENT_3 0x0810
224#define PPC7D_CPLD_EQUIPMENT_PRESENT_4 0x0812
225#define PPC7D_CPLD_KEY_LOCK 0x0818
226#define PPC7D_CPLD_LEDS 0x0820
227#define PPC7D_CPLD_COMS 0x0824
228#define PPC7D_CPLD_RTS 0x0826
229#define PPC7D_CPLD_RESET 0x0828
230#define PPC7D_CPLD_WATCHDOG_TRIG 0x082C
231#define PPC7D_CPLD_INTR 0x082E
232#define PPC7D_CPLD_INTR_STATUS 0x0830
233#define PPC7D_CPLD_PCI_CONFIG 0x0832
234#define PPC7D_CPLD_BOARD_REVISION 0x0854
235#define PPC7D_CPLD_EXTENDED_ID 0x0858
236#define PPC7D_CPLD_ID_LINK 0x0864
237#define PPC7D_CPLD_MOTHERBOARD_TYPE 0x0866
238#define PPC7D_CPLD_FLASH_WRITE_CNTL 0x0868
239#define PPC7D_CPLD_SW_FLASH_WRITE_PROTECT 0x086A
240#define PPC7D_CPLD_FLASH_CNTL 0x086E
241
242/* MEMORY_CONFIG_EXTEND */
243#define PPC7D_CPLD_SDRAM_BANK_SIZE_MASK 0xc0
244#define PPC7D_CPLD_SDRAM_BANK_SIZE_128M 0
245#define PPC7D_CPLD_SDRAM_BANK_SIZE_256M 0x40
246#define PPC7D_CPLD_SDRAM_BANK_SIZE_512M 0x80
247#define PPC7D_CPLD_SDRAM_BANK_SIZE_1G 0xc0
248#define PPC7D_CPLD_FLASH_DEV_SIZE_MASK 0x03
249#define PPC7D_CPLD_FLASH_BANK_NUM_MASK 0x0c
250#define PPC7D_CPLD_FLASH_DEV_SIZE_64M 0
251#define PPC7D_CPLD_FLASH_DEV_SIZE_32M 1
252#define PPC7D_CPLD_FLASH_DEV_SIZE_16M 3
253#define PPC7D_CPLD_FLASH_BANK_NUM_4 0x00
254#define PPC7D_CPLD_FLASH_BANK_NUM_3 0x04
255#define PPC7D_CPLD_FLASH_BANK_NUM_2 0x08
256#define PPC7D_CPLD_FLASH_BANK_NUM_1 0x0c
257
258/* SCSI_LED */
259#define PPC7D_CPLD_SCSI_ACTIVITY_LED_OFF 0
260#define PPC7D_CPLD_SCSI_ACTIVITY_LED_ON 1
261
262/* EQUIPMENT_PRESENT_1 */
263#define PPC7D_CPLD_EQPT_PRES_1_FITTED 0
264#define PPC7D_CPLD_EQPT_PRES_1_PMC2_MASK (0x80 >> 2)
265#define PPC7D_CPLD_EQPT_PRES_1_PMC1_MASK (0x80 >> 3)
266#define PPC7D_CPLD_EQPT_PRES_1_AFIX_MASK (0x80 >> 4)
267
268/* EQUIPMENT_PRESENT_2 */
269#define PPC7D_CPLD_EQPT_PRES_2_FITTED !0
270#define PPC7D_CPLD_EQPT_PRES_2_UNIVERSE_MASK (0x80 >> 0)
271#define PPC7D_CPLD_EQPT_PRES_2_COM36_MASK (0x80 >> 2)
272#define PPC7D_CPLD_EQPT_PRES_2_GIGE_MASK (0x80 >> 3)
273#define PPC7D_CPLD_EQPT_PRES_2_DUALGIGE_MASK (0x80 >> 4)
274
275/* EQUIPMENT_PRESENT_3 */
276#define PPC7D_CPLD_EQPT_PRES_3_PMC2_V_MASK (0x80 >> 3)
277#define PPC7D_CPLD_EQPT_PRES_3_PMC2_5V (0 >> 3)
278#define PPC7D_CPLD_EQPT_PRES_3_PMC2_3V (0x80 >> 3)
279#define PPC7D_CPLD_EQPT_PRES_3_PMC1_V_MASK (0x80 >> 4)
280#define PPC7D_CPLD_EQPT_PRES_3_PMC1_5V (0 >> 4)
281#define PPC7D_CPLD_EQPT_PRES_3_PMC1_3V (0x80 >> 4)
282#define PPC7D_CPLD_EQPT_PRES_3_PMC_POWER_MASK (0x80 >> 5)
283#define PPC7D_CPLD_EQPT_PRES_3_PMC_POWER_INTER (0 >> 5)
284#define PPC7D_CPLD_EQPT_PRES_3_PMC_POWER_VME (0x80 >> 5)
285
286/* EQUIPMENT_PRESENT_4 */
287#define PPC7D_CPLD_EQPT_PRES_4_LPT_MASK (0x80 >> 2)
288#define PPC7D_CPLD_EQPT_PRES_4_LPT_FITTED (0x80 >> 2)
289#define PPC7D_CPLD_EQPT_PRES_4_PS2_USB2_MASK (0xc0 >> 6)
290#define PPC7D_CPLD_EQPT_PRES_4_PS2_FITTED (0x40 >> 6)
291#define PPC7D_CPLD_EQPT_PRES_4_USB2_FITTED (0x80 >> 6)
292
293/* CPLD_LEDS */
294#define PPC7D_CPLD_LEDS_ON (!0)
295#define PPC7D_CPLD_LEDS_OFF (0)
296#define PPC7D_CPLD_LEDS_NVRAM_PAGE_MASK (0xc0 >> 2)
297#define PPC7D_CPLD_LEDS_DS201_MASK (0x80 >> 4)
298#define PPC7D_CPLD_LEDS_DS219_MASK (0x80 >> 5)
299#define PPC7D_CPLD_LEDS_DS220_MASK (0x80 >> 6)
300#define PPC7D_CPLD_LEDS_DS221_MASK (0x80 >> 7)
301
302/* CPLD_COMS */
303#define PPC7D_CPLD_COMS_COM3_TCLKEN (0x80 >> 0)
304#define PPC7D_CPLD_COMS_COM3_RTCLKEN (0x80 >> 1)
305#define PPC7D_CPLD_COMS_COM3_MODE_MASK (0x80 >> 2)
306#define PPC7D_CPLD_COMS_COM3_MODE_RS232 (0)
307#define PPC7D_CPLD_COMS_COM3_MODE_RS422 (0x80 >> 2)
308#define PPC7D_CPLD_COMS_COM3_TXEN (0x80 >> 3)
309#define PPC7D_CPLD_COMS_COM4_TCLKEN (0x80 >> 4)
310#define PPC7D_CPLD_COMS_COM4_RTCLKEN (0x80 >> 5)
311#define PPC7D_CPLD_COMS_COM4_MODE_MASK (0x80 >> 6)
312#define PPC7D_CPLD_COMS_COM4_MODE_RS232 (0)
313#define PPC7D_CPLD_COMS_COM4_MODE_RS422 (0x80 >> 6)
314#define PPC7D_CPLD_COMS_COM4_TXEN (0x80 >> 7)
315
316/* CPLD_RTS */
317#define PPC7D_CPLD_RTS_COM36_LOOPBACK (0x80 >> 0)
318#define PPC7D_CPLD_RTS_COM4_SCLK (0x80 >> 1)
319#define PPC7D_CPLD_RTS_COM3_TXFUNC_MASK (0xc0 >> 2)
320#define PPC7D_CPLD_RTS_COM3_TXFUNC_DISABLED (0 >> 2)
321#define PPC7D_CPLD_RTS_COM3_TXFUNC_ENABLED (0x80 >> 2)
322#define PPC7D_CPLD_RTS_COM3_TXFUNC_ENABLED_RTG3 (0xc0 >> 2)
323#define PPC7D_CPLD_RTS_COM3_TXFUNC_ENABLED_RTG3S (0xc0 >> 2)
324#define PPC7D_CPLD_RTS_COM56_MODE_MASK (0x80 >> 4)
325#define PPC7D_CPLD_RTS_COM56_MODE_RS232 (0)
326#define PPC7D_CPLD_RTS_COM56_MODE_RS422 (0x80 >> 4)
327#define PPC7D_CPLD_RTS_COM56_ENABLE_MASK (0x80 >> 5)
328#define PPC7D_CPLD_RTS_COM56_DISABLED (0)
329#define PPC7D_CPLD_RTS_COM56_ENABLED (0x80 >> 5)
330#define PPC7D_CPLD_RTS_COM4_TXFUNC_MASK (0xc0 >> 6)
331#define PPC7D_CPLD_RTS_COM4_TXFUNC_DISABLED (0 >> 6)
332#define PPC7D_CPLD_RTS_COM4_TXFUNC_ENABLED (0x80 >> 6)
333#define PPC7D_CPLD_RTS_COM4_TXFUNC_ENABLED_RTG3 (0x40 >> 6)
334#define PPC7D_CPLD_RTS_COM4_TXFUNC_ENABLED_RTG3S (0x40 >> 6)
335
336/* WATCHDOG_TRIG */
337#define PPC7D_CPLD_WDOG_CAUSE_MASK (0x80 >> 0)
338#define PPC7D_CPLD_WDOG_CAUSE_NORMAL_RESET (0 >> 0)
339#define PPC7D_CPLD_WDOG_CAUSE_WATCHDOG (0x80 >> 0)
340#define PPC7D_CPLD_WDOG_ENABLE_MASK (0x80 >> 6)
341#define PPC7D_CPLD_WDOG_ENABLE_OFF (0 >> 6)
342#define PPC7D_CPLD_WDOG_ENABLE_ON (0x80 >> 6)
343#define PPC7D_CPLD_WDOG_RESETSW_MASK (0x80 >> 7)
344#define PPC7D_CPLD_WDOG_RESETSW_OFF (0 >> 7)
345#define PPC7D_CPLD_WDOG_RESETSW_ON (0x80 >> 7)
346
347/* Interrupt mask and status bits */
348#define PPC7D_CPLD_INTR_TEMP_MASK (0x80 >> 0)
349#define PPC7D_CPLD_INTR_HB8_MASK (0x80 >> 1)
350#define PPC7D_CPLD_INTR_PHY1_MASK (0x80 >> 2)
351#define PPC7D_CPLD_INTR_PHY0_MASK (0x80 >> 3)
352#define PPC7D_CPLD_INTR_ISANMI_MASK (0x80 >> 5)
353#define PPC7D_CPLD_INTR_CRITTEMP_MASK (0x80 >> 6)
354
355/* CPLD_INTR */
356#define PPC7D_CPLD_INTR_ENABLE_OFF (0)
357#define PPC7D_CPLD_INTR_ENABLE_ON (!0)
358
359/* CPLD_INTR_STATUS */
360#define PPC7D_CPLD_INTR_STATUS_OFF (0)
361#define PPC7D_CPLD_INTR_STATUS_ON (!0)
362
363/* CPLD_PCI_CONFIG */
364#define PPC7D_CPLD_PCI_CONFIG_PCI0_MASK 0x70
365#define PPC7D_CPLD_PCI_CONFIG_PCI0_PCI33 0x00
366#define PPC7D_CPLD_PCI_CONFIG_PCI0_PCI66 0x10
367#define PPC7D_CPLD_PCI_CONFIG_PCI0_PCIX33 0x40
368#define PPC7D_CPLD_PCI_CONFIG_PCI0_PCIX66 0x50
369#define PPC7D_CPLD_PCI_CONFIG_PCI0_PCIX100 0x60
370#define PPC7D_CPLD_PCI_CONFIG_PCI0_PCIX133 0x70
371#define PPC7D_CPLD_PCI_CONFIG_PCI1_MASK 0x07
372#define PPC7D_CPLD_PCI_CONFIG_PCI1_PCI33 0x00
373#define PPC7D_CPLD_PCI_CONFIG_PCI1_PCI66 0x01
374#define PPC7D_CPLD_PCI_CONFIG_PCI1_PCIX33 0x04
375#define PPC7D_CPLD_PCI_CONFIG_PCI1_PCIX66 0x05
376#define PPC7D_CPLD_PCI_CONFIG_PCI1_PCIX100 0x06
377#define PPC7D_CPLD_PCI_CONFIG_PCI1_PCIX133 0x07
378
379/* CPLD_BOARD_REVISION */
380#define PPC7D_CPLD_BOARD_REVISION_NUMBER_MASK 0xe0
381#define PPC7D_CPLD_BOARD_REVISION_LETTER_MASK 0x1f
382
383/* CPLD_EXTENDED_ID */
384#define PPC7D_CPLD_EXTENDED_ID_PPC7D 0x18
385
386/* CPLD_ID_LINK */
387#define PPC7D_CPLD_ID_LINK_VME64_GAP_MASK (0x80 >> 2)
388#define PPC7D_CPLD_ID_LINK_VME64_GA4_MASK (0x80 >> 3)
389#define PPC7D_CPLD_ID_LINK_E13_MASK (0x80 >> 4)
390#define PPC7D_CPLD_ID_LINK_E12_MASK (0x80 >> 5)
391#define PPC7D_CPLD_ID_LINK_E7_MASK (0x80 >> 6)
392#define PPC7D_CPLD_ID_LINK_E6_MASK (0x80 >> 7)
393
394/* CPLD_MOTHERBOARD_TYPE */
395#define PPC7D_CPLD_MB_TYPE_ECC_ENABLE_MASK (0x80 >> 0)
396#define PPC7D_CPLD_MB_TYPE_ECC_ENABLED (0x80 >> 0)
397#define PPC7D_CPLD_MB_TYPE_ECC_DISABLED (0 >> 0)
398#define PPC7D_CPLD_MB_TYPE_ECC_FITTED_MASK (0x80 >> 3)
399#define PPC7D_CPLD_MB_TYPE_PLL_MASK 0x0c
400#define PPC7D_CPLD_MB_TYPE_PLL_133 0x00
401#define PPC7D_CPLD_MB_TYPE_PLL_100 0x08
402#define PPC7D_CPLD_MB_TYPE_PLL_64 0x04
403#define PPC7D_CPLD_MB_TYPE_HW_ID_MASK 0x03
404
405/* CPLD_FLASH_WRITE_CNTL */
406#define PPD7D_CPLD_FLASH_CNTL_WR_LINK_MASK (0x80 >> 0)
407#define PPD7D_CPLD_FLASH_CNTL_WR_LINK_FITTED (0x80 >> 0)
408#define PPD7D_CPLD_FLASH_CNTL_BOOT_LINK_MASK (0x80 >> 2)
409#define PPD7D_CPLD_FLASH_CNTL_BOOT_LINK_FITTED (0x80 >> 2)
410#define PPD7D_CPLD_FLASH_CNTL_USER_LINK_MASK (0x80 >> 3)
411#define PPD7D_CPLD_FLASH_CNTL_USER_LINK_FITTED (0x80 >> 3)
412#define PPD7D_CPLD_FLASH_CNTL_RECO_WR_MASK (0x80 >> 5)
413#define PPD7D_CPLD_FLASH_CNTL_RECO_WR_ENABLED (0x80 >> 5)
414#define PPD7D_CPLD_FLASH_CNTL_BOOT_WR_MASK (0x80 >> 6)
415#define PPD7D_CPLD_FLASH_CNTL_BOOT_WR_ENABLED (0x80 >> 6)
416#define PPD7D_CPLD_FLASH_CNTL_USER_WR_MASK (0x80 >> 7)
417#define PPD7D_CPLD_FLASH_CNTL_USER_WR_ENABLED (0x80 >> 7)
418
419/* CPLD_SW_FLASH_WRITE_PROTECT */
420#define PPC7D_CPLD_SW_FLASH_WRPROT_ENABLED (!0)
421#define PPC7D_CPLD_SW_FLASH_WRPROT_DISABLED (0)
422#define PPC7D_CPLD_SW_FLASH_WRPROT_SYSBOOT_MASK (0x80 >> 6)
423#define PPC7D_CPLD_SW_FLASH_WRPROT_USER_MASK (0x80 >> 7)
424
425/* CPLD_FLASH_WRITE_CNTL */
426#define PPC7D_CPLD_FLASH_CNTL_NVRAM_PROT_MASK (0x80 >> 0)
427#define PPC7D_CPLD_FLASH_CNTL_NVRAM_DISABLED (0 >> 0)
428#define PPC7D_CPLD_FLASH_CNTL_NVRAM_ENABLED (0x80 >> 0)
429#define PPC7D_CPLD_FLASH_CNTL_ALTBOOT_LINK_MASK (0x80 >> 1)
430#define PPC7D_CPLD_FLASH_CNTL_VMEBOOT_LINK_MASK (0x80 >> 2)
431#define PPC7D_CPLD_FLASH_CNTL_RECBOOT_LINK_MASK (0x80 >> 3)
432
433
434#endif /* __PPC_PLATFORMS_PPC7D_H */
diff --git a/arch/ppc/platforms/residual.c b/arch/ppc/platforms/residual.c
new file mode 100644
index 000000000000..0f84ca603612
--- /dev/null
+++ b/arch/ppc/platforms/residual.c
@@ -0,0 +1,1034 @@
1/*
2 * Code to deal with the PReP residual data.
3 *
4 * Written by: Cort Dougan (cort@cs.nmt.edu)
5 * Improved _greatly_ and rewritten by Gabriel Paubert (paubert@iram.es)
6 *
7 * This file is based on the following documentation:
8 *
9 * IBM Power Personal Systems Architecture
10 * Residual Data
11 * Document Number: PPS-AR-FW0001
12 *
13 * This file is subject to the terms and conditions of the GNU General Public
14 * License. See the file COPYING in the main directory of this archive
15 * for more details.
16 *
17 */
18
19#include <linux/string.h>
20#include <asm/residual.h>
21#include <asm/pnp.h>
22#include <asm/byteorder.h>
23
24#include <linux/errno.h>
25#include <linux/sched.h>
26#include <linux/kernel.h>
27#include <linux/mm.h>
28#include <linux/stddef.h>
29#include <linux/unistd.h>
30#include <linux/ptrace.h>
31#include <linux/slab.h>
32#include <linux/user.h>
33#include <linux/a.out.h>
34#include <linux/tty.h>
35#include <linux/major.h>
36#include <linux/interrupt.h>
37#include <linux/reboot.h>
38#include <linux/init.h>
39#include <linux/ioport.h>
40#include <linux/pci.h>
41#include <linux/ide.h>
42
43#include <asm/sections.h>
44#include <asm/mmu.h>
45#include <asm/io.h>
46#include <asm/pgtable.h>
47#include <asm/ide.h>
48
49
50unsigned char __res[sizeof(RESIDUAL)] __prepdata = {0,};
51RESIDUAL *res = (RESIDUAL *)&__res;
52
53char * PnP_BASE_TYPES[] __initdata = {
54 "Reserved",
55 "MassStorageDevice",
56 "NetworkInterfaceController",
57 "DisplayController",
58 "MultimediaController",
59 "MemoryController",
60 "BridgeController",
61 "CommunicationsDevice",
62 "SystemPeripheral",
63 "InputDevice",
64 "ServiceProcessor"
65 };
66
67/* Device Sub Type Codes */
68
69unsigned char * PnP_SUB_TYPES[] __initdata = {
70 "\001\000SCSIController",
71 "\001\001IDEController",
72 "\001\002FloppyController",
73 "\001\003IPIController",
74 "\001\200OtherMassStorageController",
75 "\002\000EthernetController",
76 "\002\001TokenRingController",
77 "\002\002FDDIController",
78 "\002\0x80OtherNetworkController",
79 "\003\000VGAController",
80 "\003\001SVGAController",
81 "\003\002XGAController",
82 "\003\200OtherDisplayController",
83 "\004\000VideoController",
84 "\004\001AudioController",
85 "\004\200OtherMultimediaController",
86 "\005\000RAM",
87 "\005\001FLASH",
88 "\005\200OtherMemoryDevice",
89 "\006\000HostProcessorBridge",
90 "\006\001ISABridge",
91 "\006\002EISABridge",
92 "\006\003MicroChannelBridge",
93 "\006\004PCIBridge",
94 "\006\005PCMCIABridge",
95 "\006\006VMEBridge",
96 "\006\200OtherBridgeDevice",
97 "\007\000RS232Device",
98 "\007\001ATCompatibleParallelPort",
99 "\007\200OtherCommunicationsDevice",
100 "\010\000ProgrammableInterruptController",
101 "\010\001DMAController",
102 "\010\002SystemTimer",
103 "\010\003RealTimeClock",
104 "\010\004L2Cache",
105 "\010\005NVRAM",
106 "\010\006PowerManagement",
107 "\010\007CMOS",
108 "\010\010OperatorPanel",
109 "\010\011ServiceProcessorClass1",
110 "\010\012ServiceProcessorClass2",
111 "\010\013ServiceProcessorClass3",
112 "\010\014GraphicAssist",
113 "\010\017SystemPlanar",
114 "\010\200OtherSystemPeripheral",
115 "\011\000KeyboardController",
116 "\011\001Digitizer",
117 "\011\002MouseController",
118 "\011\003TabletController",
119 "\011\0x80OtherInputController",
120 "\012\000GeneralMemoryController",
121 NULL
122};
123
124/* Device Interface Type Codes */
125
126unsigned char * PnP_INTERFACES[] __initdata = {
127 "\000\000\000General",
128 "\001\000\000GeneralSCSI",
129 "\001\001\000GeneralIDE",
130 "\001\001\001ATACompatible",
131
132 "\001\002\000GeneralFloppy",
133 "\001\002\001Compatible765",
134 "\001\002\002NS398_Floppy", /* NS Super I/O wired to use index
135 register at port 398 and data
136 register at port 399 */
137 "\001\002\003NS26E_Floppy", /* Ports 26E and 26F */
138 "\001\002\004NS15C_Floppy", /* Ports 15C and 15D */
139 "\001\002\005NS2E_Floppy", /* Ports 2E and 2F */
140 "\001\002\006CHRP_Floppy", /* CHRP Floppy in PR*P system */
141
142 "\001\003\000GeneralIPI",
143
144 "\002\000\000GeneralEther",
145 "\002\001\000GeneralToken",
146 "\002\002\000GeneralFDDI",
147
148 "\003\000\000GeneralVGA",
149 "\003\001\000GeneralSVGA",
150 "\003\002\000GeneralXGA",
151
152 "\004\000\000GeneralVideo",
153 "\004\001\000GeneralAudio",
154 "\004\001\001CS4232Audio", /* CS 4232 Plug 'n Play Configured */
155
156 "\005\000\000GeneralRAM",
157 /* This one is obviously wrong ! */
158 "\005\000\000PCIMemoryController", /* PCI Config Method */
159 "\005\000\001RS6KMemoryController", /* RS6K Config Method */
160 "\005\001\000GeneralFLASH",
161
162 "\006\000\000GeneralHostBridge",
163 "\006\001\000GeneralISABridge",
164 "\006\002\000GeneralEISABridge",
165 "\006\003\000GeneralMCABridge",
166 /* GeneralPCIBridge = 0, */
167 "\006\004\000PCIBridgeDirect",
168 "\006\004\001PCIBridgeIndirect",
169 "\006\004\002PCIBridgeRS6K",
170 "\006\005\000GeneralPCMCIABridge",
171 "\006\006\000GeneralVMEBridge",
172
173 "\007\000\000GeneralRS232",
174 "\007\000\001COMx",
175 "\007\000\002Compatible16450",
176 "\007\000\003Compatible16550",
177 "\007\000\004NS398SerPort", /* NS Super I/O wired to use index
178 register at port 398 and data
179 register at port 399 */
180 "\007\000\005NS26ESerPort", /* Ports 26E and 26F */
181 "\007\000\006NS15CSerPort", /* Ports 15C and 15D */
182 "\007\000\007NS2ESerPort", /* Ports 2E and 2F */
183
184 "\007\001\000GeneralParPort",
185 "\007\001\001LPTx",
186 "\007\001\002NS398ParPort", /* NS Super I/O wired to use index
187 register at port 398 and data
188 register at port 399 */
189 "\007\001\003NS26EParPort", /* Ports 26E and 26F */
190 "\007\001\004NS15CParPort", /* Ports 15C and 15D */
191 "\007\001\005NS2EParPort", /* Ports 2E and 2F */
192
193 "\010\000\000GeneralPIC",
194 "\010\000\001ISA_PIC",
195 "\010\000\002EISA_PIC",
196 "\010\000\003MPIC",
197 "\010\000\004RS6K_PIC",
198
199 "\010\001\000GeneralDMA",
200 "\010\001\001ISA_DMA",
201 "\010\001\002EISA_DMA",
202
203 "\010\002\000GeneralTimer",
204 "\010\002\001ISA_Timer",
205 "\010\002\002EISA_Timer",
206 "\010\003\000GeneralRTC",
207 "\010\003\001ISA_RTC",
208
209 "\010\004\001StoreThruOnly",
210 "\010\004\002StoreInEnabled",
211 "\010\004\003RS6KL2Cache",
212
213 "\010\005\000IndirectNVRAM", /* Indirectly addressed */
214 "\010\005\001DirectNVRAM", /* Memory Mapped */
215 "\010\005\002IndirectNVRAM24", /* Indirectly addressed - 24 bit */
216
217 "\010\006\000GeneralPowerManagement",
218 "\010\006\001EPOWPowerManagement",
219 "\010\006\002PowerControl", // d1378
220
221 "\010\007\000GeneralCMOS",
222
223 "\010\010\000GeneralOPPanel",
224 "\010\010\001HarddiskLight",
225 "\010\010\002CDROMLight",
226 "\010\010\003PowerLight",
227 "\010\010\004KeyLock",
228 "\010\010\005ANDisplay", /* AlphaNumeric Display */
229 "\010\010\006SystemStatusLED", /* 3 digit 7 segment LED */
230 "\010\010\007CHRP_SystemStatusLED", /* CHRP LEDs in PR*P system */
231
232 "\010\011\000GeneralServiceProcessor",
233 "\010\012\000GeneralServiceProcessor",
234 "\010\013\000GeneralServiceProcessor",
235
236 "\010\014\001TransferData",
237 "\010\014\002IGMC32",
238 "\010\014\003IGMC64",
239
240 "\010\017\000GeneralSystemPlanar", /* 10/5/95 */
241 NULL
242 };
243
244static const unsigned char __init *PnP_SUB_TYPE_STR(unsigned char BaseType,
245 unsigned char SubType) {
246 unsigned char ** s=PnP_SUB_TYPES;
247 while (*s && !((*s)[0]==BaseType
248 && (*s)[1]==SubType)) s++;
249 if (*s) return *s+2;
250 else return("Unknown !");
251};
252
253static const unsigned char __init *PnP_INTERFACE_STR(unsigned char BaseType,
254 unsigned char SubType,
255 unsigned char Interface) {
256 unsigned char ** s=PnP_INTERFACES;
257 while (*s && !((*s)[0]==BaseType
258 && (*s)[1]==SubType
259 && (*s)[2]==Interface)) s++;
260 if (*s) return *s+3;
261 else return NULL;
262};
263
264static void __init printsmallvendor(PnP_TAG_PACKET *pkt, int size) {
265 int i, c;
266 char decomp[4];
267#define p pkt->S14_Pack.S14_Data.S14_PPCPack
268 switch(p.Type) {
269 case 1:
270 /* Decompress first 3 chars */
271 c = *(unsigned short *)p.PPCData;
272 decomp[0]='A'-1+((c>>10)&0x1F);
273 decomp[1]='A'-1+((c>>5)&0x1F);
274 decomp[2]='A'-1+(c&0x1F);
275 decomp[3]=0;
276 printk(" Chip identification: %s%4.4X\n",
277 decomp, ld_le16((unsigned short *)(p.PPCData+2)));
278 break;
279 default:
280 printk(" Small vendor item type 0x%2.2x, data (hex): ",
281 p.Type);
282 for(i=0; i<size-2; i++) printk("%2.2x ", p.PPCData[i]);
283 printk("\n");
284 break;
285 }
286#undef p
287}
288
289static void __init printsmallpacket(PnP_TAG_PACKET * pkt, int size) {
290 static const unsigned char * intlevel[] = {"high", "low"};
291 static const unsigned char * intsense[] = {"edge", "level"};
292
293 switch (tag_small_item_name(pkt->S1_Pack.Tag)) {
294 case PnPVersion:
295 printk(" PnPversion 0x%x.%x\n",
296 pkt->S1_Pack.Version[0], /* How to interpret version ? */
297 pkt->S1_Pack.Version[1]);
298 break;
299// case Logicaldevice:
300 break;
301// case CompatibleDevice:
302 break;
303 case IRQFormat:
304#define p pkt->S4_Pack
305 printk(" IRQ Mask 0x%4.4x, %s %s sensitive\n",
306 ld_le16((unsigned short *)p.IRQMask),
307 intlevel[(size>3) ? !(p.IRQInfo&0x05) : 0],
308 intsense[(size>3) ? !(p.IRQInfo&0x03) : 0]);
309#undef p
310 break;
311 case DMAFormat:
312#define p pkt->S5_Pack
313 printk(" DMA channel mask 0x%2.2x, info 0x%2.2x\n",
314 p.DMAMask, p.DMAInfo);
315#undef p
316 break;
317 case StartDepFunc:
318 printk("Start dependent function:\n");
319 break;
320 case EndDepFunc:
321 printk("End dependent function\n");
322 break;
323 case IOPort:
324#define p pkt->S8_Pack
325 printk(" Variable (%d decoded bits) I/O port\n"
326 " from 0x%4.4x to 0x%4.4x, alignment %d, %d ports\n",
327 p.IOInfo&ISAAddr16bit?16:10,
328 ld_le16((unsigned short *)p.RangeMin),
329 ld_le16((unsigned short *)p.RangeMax),
330 p.IOAlign, p.IONum);
331#undef p
332 break;
333 case FixedIOPort:
334#define p pkt->S9_Pack
335 printk(" Fixed (10 decoded bits) I/O port from %3.3x to %3.3x\n",
336 (p.Range[1]<<8)|p.Range[0],
337 ((p.Range[1]<<8)|p.Range[0])+p.IONum-1);
338#undef p
339 break;
340 case Res1:
341 case Res2:
342 case Res3:
343 printk(" Undefined packet type %d!\n",
344 tag_small_item_name(pkt->S1_Pack.Tag));
345 break;
346 case SmallVendorItem:
347 printsmallvendor(pkt,size);
348 break;
349 default:
350 printk(" Type 0x2.2x%d, size=%d\n",
351 pkt->S1_Pack.Tag, size);
352 break;
353 }
354}
355
356static void __init printlargevendor(PnP_TAG_PACKET * pkt, int size) {
357 static const unsigned char * addrtype[] = {"I/O", "Memory", "System"};
358 static const unsigned char * inttype[] = {"8259", "MPIC", "RS6k BUID %d"};
359 static const unsigned char * convtype[] = {"Bus Memory", "Bus I/O", "DMA"};
360 static const unsigned char * transtype[] = {"direct", "mapped", "direct-store segment"};
361 static const unsigned char * L2type[] = {"WriteThru", "CopyBack"};
362 static const unsigned char * L2assoc[] = {"DirectMapped", "2-way set"};
363
364 int i;
365 char tmpstr[30], *t;
366#define p pkt->L4_Pack.L4_Data.L4_PPCPack
367 switch(p.Type) {
368 case 2:
369 printk(" %d K %s %s L2 cache, %d/%d bytes line/sector size\n",
370 ld_le32((unsigned int *)p.PPCData),
371 L2type[p.PPCData[10]-1],
372 L2assoc[p.PPCData[4]-1],
373 ld_le16((unsigned short *)p.PPCData+3),
374 ld_le16((unsigned short *)p.PPCData+4));
375 break;
376 case 3:
377 printk(" PCI Bridge parameters\n"
378 " ConfigBaseAddress %0x\n"
379 " ConfigBaseData %0x\n"
380 " Bus number %d\n",
381 ld_le32((unsigned int *)p.PPCData),
382 ld_le32((unsigned int *)(p.PPCData+8)),
383 p.PPCData[16]);
384 for(i=20; i<size-4; i+=12) {
385 int j, first;
386 if(p.PPCData[i]) printk(" PCI Slot %d", p.PPCData[i]);
387 else printk (" Integrated PCI device");
388 for(j=0, first=1, t=tmpstr; j<4; j++) {
389 int line=ld_le16((unsigned short *)(p.PPCData+i+4)+j);
390 if(line!=0xffff){
391 if(first) first=0; else *t++='/';
392 *t++='A'+j;
393 }
394 }
395 *t='\0';
396 printk(" DevFunc 0x%x interrupt line(s) %s routed to",
397 p.PPCData[i+1],tmpstr);
398 sprintf(tmpstr,
399 inttype[p.PPCData[i+2]-1],
400 p.PPCData[i+3]);
401 printk(" %s line(s) ",
402 tmpstr);
403 for(j=0, first=1, t=tmpstr; j<4; j++) {
404 int line=ld_le16((unsigned short *)(p.PPCData+i+4)+j);
405 if(line!=0xffff){
406 if(first) first=0; else *t++='/';
407 t+=sprintf(t,"%d(%c)",
408 line&0x7fff,
409 line&0x8000?'E':'L');
410 }
411 }
412 printk("%s\n",tmpstr);
413 }
414 break;
415 case 5:
416 printk(" Bridge address translation, %s decoding:\n"
417 " Processor Bus Size Conversion Translation\n"
418 " 0x%8.8x 0x%8.8x 0x%8.8x %s %s\n",
419 p.PPCData[0]&1 ? "positive" : "subtractive",
420 ld_le32((unsigned int *)p.PPCData+1),
421 ld_le32((unsigned int *)p.PPCData+3),
422 ld_le32((unsigned int *)p.PPCData+5),
423 convtype[p.PPCData[2]-1],
424 transtype[p.PPCData[1]-1]);
425 break;
426 case 6:
427 printk(" Bus speed %d Hz, %d slot(s)\n",
428 ld_le32((unsigned int *)p.PPCData),
429 p.PPCData[4]);
430 break;
431 case 7:
432 printk(" SCSI buses: %d, id(s):", p.PPCData[0]);
433 for(i=1; i<=p.PPCData[0]; i++)
434 printk(" %d%c", p.PPCData[i], i==p.PPCData[0] ? '\n' : ',');
435 break;
436 case 9:
437 printk(" %s address (%d bits), at 0x%x size 0x%x bytes\n",
438 addrtype[p.PPCData[0]-1],
439 p.PPCData[1],
440 ld_le32((unsigned int *)(p.PPCData+4)),
441 ld_le32((unsigned int *)(p.PPCData+12)));
442 break;
443 case 10:
444 sprintf(tmpstr,
445 inttype[p.PPCData[0]-1],
446 p.PPCData[1]);
447
448 printk(" ISA interrupts routed to %s\n"
449 " lines",
450 tmpstr);
451 for(i=0; i<16; i++) {
452 int line=ld_le16((unsigned short *)p.PPCData+i+1);
453 if (line!=0xffff) printk(" %d(IRQ%d)", line, i);
454 }
455 printk("\n");
456 break;
457 default:
458 printk(" Large vendor item type 0x%2.2x\n Data (hex):",
459 p.Type);
460 for(i=0; i<size-4; i++) printk(" %2.2x", p.PPCData[i]);
461 printk("\n");
462#undef p
463 }
464}
465
466static void __init printlargepacket(PnP_TAG_PACKET * pkt, int size) {
467 switch (tag_large_item_name(pkt->S1_Pack.Tag)) {
468 case LargeVendorItem:
469 printlargevendor(pkt, size);
470 break;
471 default:
472 printk(" Type 0x2.2x%d, size=%d\n",
473 pkt->S1_Pack.Tag, size);
474 break;
475 }
476}
477
478static void __init printpackets(PnP_TAG_PACKET * pkt, const char * cat)
479{
480 if (pkt->S1_Pack.Tag== END_TAG) {
481 printk(" No packets describing %s resources.\n", cat);
482 return;
483 }
484 printk( " Packets describing %s resources:\n",cat);
485 do {
486 int size;
487 if (tag_type(pkt->S1_Pack.Tag)) {
488 size= 3 +
489 pkt->L1_Pack.Count0 +
490 pkt->L1_Pack.Count1*256;
491 printlargepacket(pkt, size);
492 } else {
493 size=tag_small_count(pkt->S1_Pack.Tag)+1;
494 printsmallpacket(pkt, size);
495 }
496 pkt = (PnP_TAG_PACKET *)((unsigned char *) pkt + size);
497 } while (pkt->S1_Pack.Tag != END_TAG);
498}
499
500void __init print_residual_device_info(void)
501{
502 int i;
503 PPC_DEVICE *dev;
504#define did dev->DeviceId
505
506 /* make sure we have residual data first */
507 if (!have_residual_data)
508 return;
509
510 printk("Residual: %ld devices\n", res->ActualNumDevices);
511 for ( i = 0;
512 i < res->ActualNumDevices ;
513 i++)
514 {
515 char decomp[4], sn[20];
516 const char * s;
517 dev = &res->Devices[i];
518 s = PnP_INTERFACE_STR(did.BaseType, did.SubType,
519 did.Interface);
520 if(!s) {
521 sprintf(sn, "interface %d", did.Interface);
522 s=sn;
523 }
524 if ( did.BusId & PCIDEVICE )
525 printk("PCI Device, Bus %d, DevFunc 0x%x:",
526 dev->BusAccess.PCIAccess.BusNumber,
527 dev->BusAccess.PCIAccess.DevFuncNumber);
528 if ( did.BusId & PNPISADEVICE ) printk("PNPISA Device:");
529 if ( did.BusId & ISADEVICE )
530 printk("ISA Device, Slot %d, LogicalDev %d:",
531 dev->BusAccess.ISAAccess.SlotNumber,
532 dev->BusAccess.ISAAccess.LogicalDevNumber);
533 if ( did.BusId & EISADEVICE ) printk("EISA Device:");
534 if ( did.BusId & PROCESSORDEVICE )
535 printk("ProcBus Device, Bus %d, BUID %d: ",
536 dev->BusAccess.ProcBusAccess.BusNumber,
537 dev->BusAccess.ProcBusAccess.BUID);
538 if ( did.BusId & PCMCIADEVICE ) printk("PCMCIA ");
539 if ( did.BusId & VMEDEVICE ) printk("VME ");
540 if ( did.BusId & MCADEVICE ) printk("MCA ");
541 if ( did.BusId & MXDEVICE ) printk("MX ");
542 /* Decompress first 3 chars */
543 decomp[0]='A'-1+((did.DevId>>26)&0x1F);
544 decomp[1]='A'-1+((did.DevId>>21)&0x1F);
545 decomp[2]='A'-1+((did.DevId>>16)&0x1F);
546 decomp[3]=0;
547 printk(" %s%4.4lX, %s, %s, %s\n",
548 decomp, did.DevId&0xffff,
549 PnP_BASE_TYPES[did.BaseType],
550 PnP_SUB_TYPE_STR(did.BaseType,did.SubType),
551 s);
552 if ( dev->AllocatedOffset )
553 printpackets( (union _PnP_TAG_PACKET *)
554 &res->DevicePnPHeap[dev->AllocatedOffset],
555 "allocated");
556 if ( dev->PossibleOffset )
557 printpackets( (union _PnP_TAG_PACKET *)
558 &res->DevicePnPHeap[dev->PossibleOffset],
559 "possible");
560 if ( dev->CompatibleOffset )
561 printpackets( (union _PnP_TAG_PACKET *)
562 &res->DevicePnPHeap[dev->CompatibleOffset],
563 "compatible");
564 }
565}
566
567
568#if 0
569static void __init printVPD(void) {
570#define vpd res->VitalProductData
571 int ps=vpd.PageSize, i, j;
572 static const char* Usage[]={
573 "FirmwareStack", "FirmwareHeap", "FirmwareCode", "BootImage",
574 "Free", "Unpopulated", "ISAAddr", "PCIConfig",
575 "IOMemory", "SystemIO", "SystemRegs", "PCIAddr",
576 "UnPopSystemRom", "SystemROM", "ResumeBlock", "Other"
577 };
578 static const unsigned char *FWMan[]={
579 "IBM", "Motorola", "FirmWorks", "Bull"
580 };
581 static const unsigned char *FWFlags[]={
582 "Conventional", "OpenFirmware", "Diagnostics", "LowDebug",
583 "MultiBoot", "LowClient", "Hex41", "FAT",
584 "ISO9660", "SCSI_ID_Override", "Tape_Boot", "FW_Boot_Path"
585 };
586 static const unsigned char *ESM[]={
587 "Port92", "PCIConfigA8", "FF001030", "????????"
588 };
589 static const unsigned char *SIOM[]={
590 "Port850", "????????", "PCIConfigA8", "????????"
591 };
592
593 printk("Model: %s\n",vpd.PrintableModel);
594 printk("Serial: %s\n", vpd.Serial);
595 printk("FirmwareSupplier: %s\n", FWMan[vpd.FirmwareSupplier]);
596 printk("FirmwareFlags:");
597 for(j=0; j<12; j++) {
598 if (vpd.FirmwareSupports & (1<<j)) {
599 printk(" %s%c", FWFlags[j],
600 vpd.FirmwareSupports&(-2<<j) ? ',' : '\n');
601 }
602 }
603 printk("NVRamSize: %ld\n", vpd.NvramSize);
604 printk("SIMMslots: %ld\n", vpd.NumSIMMSlots);
605 printk("EndianSwitchMethod: %s\n",
606 ESM[vpd.EndianSwitchMethod>2 ? 2 : vpd.EndianSwitchMethod]);
607 printk("SpreadIOMethod: %s\n",
608 SIOM[vpd.SpreadIOMethod>3 ? 3 : vpd.SpreadIOMethod]);
609 printk("Processor/Bus frequencies (Hz): %ld/%ld\n",
610 vpd.ProcessorHz, vpd.ProcessorBusHz);
611 printk("Time Base Divisor: %ld\n", vpd.TimeBaseDivisor);
612 printk("WordWidth, PageSize: %ld, %d\n", vpd.WordWidth, ps);
613 printk("Cache sector size, Lock granularity: %ld, %ld\n",
614 vpd.CoherenceBlockSize, vpd.GranuleSize);
615 for (i=0; i<res->ActualNumMemSegs; i++) {
616 int mask=res->Segs[i].Usage, first, j;
617 printk("%8.8lx-%8.8lx ",
618 res->Segs[i].BasePage*ps,
619 (res->Segs[i].PageCount+res->Segs[i].BasePage)*ps-1);
620 for(j=15, first=1; j>=0; j--) {
621 if (mask&(1<<j)) {
622 if (first) first=0;
623 else printk(", ");
624 printk("%s", Usage[j]);
625 }
626 }
627 printk("\n");
628 }
629}
630
631/*
632 * Spit out some info about residual data
633 */
634void print_residual_device_info(void)
635{
636 int i;
637 union _PnP_TAG_PACKET *pkt;
638 PPC_DEVICE *dev;
639#define did dev->DeviceId
640
641 /* make sure we have residual data first */
642 if (!have_residual_data)
643 return;
644 printk("Residual: %ld devices\n", res->ActualNumDevices);
645 for ( i = 0;
646 i < res->ActualNumDevices ;
647 i++)
648 {
649 dev = &res->Devices[i];
650 /*
651 * pci devices
652 */
653 if ( did.BusId & PCIDEVICE )
654 {
655 printk("PCI Device:");
656 /* unknown vendor */
657 if ( !strncmp( "Unknown", pci_strvendor(did.DevId>>16), 7) )
658 printk(" id %08lx types %d/%d", did.DevId,
659 did.BaseType, did.SubType);
660 /* known vendor */
661 else
662 printk(" %s %s",
663 pci_strvendor(did.DevId>>16),
664 pci_strdev(did.DevId>>16,
665 did.DevId&0xffff)
666 );
667
668 if ( did.BusId & PNPISADEVICE )
669 {
670 printk(" pnp:");
671 /* get pnp info on the device */
672 pkt = (union _PnP_TAG_PACKET *)
673 &res->DevicePnPHeap[dev->AllocatedOffset];
674 for (; pkt->S1_Pack.Tag != DF_END_TAG;
675 pkt++ )
676 {
677 if ( (pkt->S1_Pack.Tag == S4_Packet) ||
678 (pkt->S1_Pack.Tag == S4_Packet_flags) )
679 printk(" irq %02x%02x",
680 pkt->S4_Pack.IRQMask[0],
681 pkt->S4_Pack.IRQMask[1]);
682 }
683 }
684 printk("\n");
685 continue;
686 }
687 /*
688 * isa devices
689 */
690 if ( did.BusId & ISADEVICE )
691 {
692 printk("ISA Device: basetype: %d subtype: %d",
693 did.BaseType, did.SubType);
694 printk("\n");
695 continue;
696 }
697 /*
698 * eisa devices
699 */
700 if ( did.BusId & EISADEVICE )
701 {
702 printk("EISA Device: basetype: %d subtype: %d",
703 did.BaseType, did.SubType);
704 printk("\n");
705 continue;
706 }
707 /*
708 * proc bus devices
709 */
710 if ( did.BusId & PROCESSORDEVICE )
711 {
712 printk("ProcBus Device: basetype: %d subtype: %d",
713 did.BaseType, did.SubType);
714 printk("\n");
715 continue;
716 }
717 /*
718 * pcmcia devices
719 */
720 if ( did.BusId & PCMCIADEVICE )
721 {
722 printk("PCMCIA Device: basetype: %d subtype: %d",
723 did.BaseType, did.SubType);
724 printk("\n");
725 continue;
726 }
727 printk("Unknown bus access device: busid %lx\n",
728 did.BusId);
729 }
730}
731#endif
732
733/* Returns the device index in the residual data,
734 any of the search items may be set as -1 for wildcard,
735 DevID number field (second halfword) is big endian !
736
737 Examples:
738 - search for the Interrupt controller (8259 type), 2 methods:
739 1) i8259 = residual_find_device(~0,
740 NULL,
741 SystemPeripheral,
742 ProgrammableInterruptController,
743 ISA_PIC,
744 0);
745 2) i8259 = residual_find_device(~0, "PNP0000", -1, -1, -1, 0)
746
747 - search for the first two serial devices, whatever their type)
748 iserial1 = residual_find_device(~0,NULL,
749 CommunicationsDevice,
750 RS232Device,
751 -1, 0)
752 iserial2 = residual_find_device(~0,NULL,
753 CommunicationsDevice,
754 RS232Device,
755 -1, 1)
756 - but search for typical COM1 and COM2 is not easy due to the
757 fact that the interface may be anything and the name "PNP0500" or
758 "PNP0501". Quite bad.
759
760*/
761
762/* devid are easier to uncompress than to compress, so to minimize bloat
763in this rarely used area we unencode and compare */
764
765/* in residual data number is big endian in the device table and
766little endian in the heap, so we use two parameters to avoid writing
767two very similar functions */
768
769static int __init same_DevID(unsigned short vendor,
770 unsigned short Number,
771 char * str)
772{
773 static unsigned const char hexdigit[]="0123456789ABCDEF";
774 if (strlen(str)!=7) return 0;
775 if ( ( ((vendor>>10)&0x1f)+'A'-1 == str[0]) &&
776 ( ((vendor>>5)&0x1f)+'A'-1 == str[1]) &&
777 ( (vendor&0x1f)+'A'-1 == str[2]) &&
778 (hexdigit[(Number>>12)&0x0f] == str[3]) &&
779 (hexdigit[(Number>>8)&0x0f] == str[4]) &&
780 (hexdigit[(Number>>4)&0x0f] == str[5]) &&
781 (hexdigit[Number&0x0f] == str[6]) ) return 1;
782 return 0;
783}
784
785PPC_DEVICE __init *residual_find_device(unsigned long BusMask,
786 unsigned char * DevID,
787 int BaseType,
788 int SubType,
789 int Interface,
790 int n)
791{
792 int i;
793 if (!have_residual_data) return NULL;
794 for (i=0; i<res->ActualNumDevices; i++) {
795#define Dev res->Devices[i].DeviceId
796 if ( (Dev.BusId&BusMask) &&
797 (BaseType==-1 || Dev.BaseType==BaseType) &&
798 (SubType==-1 || Dev.SubType==SubType) &&
799 (Interface==-1 || Dev.Interface==Interface) &&
800 (DevID==NULL || same_DevID((Dev.DevId>>16)&0xffff,
801 Dev.DevId&0xffff, DevID)) &&
802 !(n--) ) return res->Devices+i;
803#undef Dev
804 }
805 return NULL;
806}
807
808PPC_DEVICE __init *residual_find_device_id(unsigned long BusMask,
809 unsigned short DevID,
810 int BaseType,
811 int SubType,
812 int Interface,
813 int n)
814{
815 int i;
816 if (!have_residual_data) return NULL;
817 for (i=0; i<res->ActualNumDevices; i++) {
818#define Dev res->Devices[i].DeviceId
819 if ( (Dev.BusId&BusMask) &&
820 (BaseType==-1 || Dev.BaseType==BaseType) &&
821 (SubType==-1 || Dev.SubType==SubType) &&
822 (Interface==-1 || Dev.Interface==Interface) &&
823 (DevID==0xffff || (Dev.DevId&0xffff) == DevID) &&
824 !(n--) ) return res->Devices+i;
825#undef Dev
826 }
827 return NULL;
828}
829
830static int __init
831residual_scan_pcibridge(PnP_TAG_PACKET * pkt, struct pci_dev *dev)
832{
833 int irq = -1;
834
835#define data pkt->L4_Pack.L4_Data.L4_PPCPack.PPCData
836 if (dev->bus->number == data[16]) {
837 int i, size;
838
839 size = 3 + ld_le16((u_short *) (&pkt->L4_Pack.Count0));
840 for (i = 20; i < size - 4; i += 12) {
841 unsigned char pin;
842 int line_irq;
843
844 if (dev->devfn != data[i + 1])
845 continue;
846
847 pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
848 if (pin) {
849 line_irq = ld_le16((unsigned short *)
850 (&data[i + 4 + 2 * (pin - 1)]));
851 irq = (line_irq == 0xffff) ? 0
852 : line_irq & 0x7fff;
853 } else
854 irq = 0;
855
856 break;
857 }
858 }
859#undef data
860
861 return irq;
862}
863
864int __init
865residual_pcidev_irq(struct pci_dev *dev)
866{
867 int i = 0;
868 int irq = -1;
869 PPC_DEVICE *bridge;
870
871 while ((bridge = residual_find_device
872 (-1, NULL, BridgeController, PCIBridge, -1, i++))) {
873
874 PnP_TAG_PACKET *pkt;
875 if (bridge->AllocatedOffset) {
876 pkt = PnP_find_large_vendor_packet(res->DevicePnPHeap +
877 bridge->AllocatedOffset, 3, 0);
878 if (!pkt)
879 continue;
880
881 irq = residual_scan_pcibridge(pkt, dev);
882 if (irq != -1)
883 break;
884 }
885 }
886
887 return (irq < 0) ? 0 : irq;
888}
889
890void __init residual_irq_mask(char *irq_edge_mask_lo, char *irq_edge_mask_hi)
891{
892 PPC_DEVICE *dev;
893 int i = 0;
894 unsigned short irq_mask = 0x000; /* default to edge */
895
896 while ((dev = residual_find_device(-1, NULL, -1, -1, -1, i++))) {
897 PnP_TAG_PACKET *pkt;
898 unsigned short mask;
899 int size;
900 int offset = dev->AllocatedOffset;
901
902 if (!offset)
903 continue;
904
905 pkt = PnP_find_packet(res->DevicePnPHeap + offset,
906 IRQFormat, 0);
907 if (!pkt)
908 continue;
909
910 size = tag_small_count(pkt->S1_Pack.Tag) + 1;
911 mask = ld_le16((unsigned short *)pkt->S4_Pack.IRQMask);
912 if (size > 3 && (pkt->S4_Pack.IRQInfo & 0x0c))
913 irq_mask |= mask;
914 }
915
916 *irq_edge_mask_lo = irq_mask & 0xff;
917 *irq_edge_mask_hi = irq_mask >> 8;
918}
919
920unsigned int __init residual_isapic_addr(void)
921{
922 PPC_DEVICE *isapic;
923 PnP_TAG_PACKET *pkt;
924 unsigned int addr;
925
926 isapic = residual_find_device(~0, NULL, SystemPeripheral,
927 ProgrammableInterruptController,
928 ISA_PIC, 0);
929 if (!isapic)
930 goto unknown;
931
932 pkt = PnP_find_large_vendor_packet(res->DevicePnPHeap +
933 isapic->AllocatedOffset, 9, 0);
934 if (!pkt)
935 goto unknown;
936
937#define p pkt->L4_Pack.L4_Data.L4_PPCPack
938 /* Must be 32-bit system address */
939 if (!((p.PPCData[0] == 3) && (p.PPCData[1] == 32)))
940 goto unknown;
941
942 /* It doesn't seem to work where length != 1 (what can I say? :-/ ) */
943 if (ld_le32((unsigned int *)(p.PPCData + 12)) != 1)
944 goto unknown;
945
946 addr = ld_le32((unsigned int *) (p.PPCData + 4));
947#undef p
948 return addr;
949unknown:
950 return 0;
951}
952
953PnP_TAG_PACKET *PnP_find_packet(unsigned char *p,
954 unsigned packet_tag,
955 int n)
956{
957 unsigned mask, masked_tag, size;
958 if(!p) return NULL;
959 if (tag_type(packet_tag)) mask=0xff; else mask=0xF8;
960 masked_tag = packet_tag&mask;
961 for(; *p != END_TAG; p+=size) {
962 if ((*p & mask) == masked_tag && !(n--))
963 return (PnP_TAG_PACKET *) p;
964 if (tag_type(*p))
965 size=ld_le16((unsigned short *)(p+1))+3;
966 else
967 size=tag_small_count(*p)+1;
968 }
969 return NULL; /* not found */
970}
971
972PnP_TAG_PACKET __init *PnP_find_small_vendor_packet(unsigned char *p,
973 unsigned packet_type,
974 int n)
975{
976 int next=0;
977 while (p) {
978 p = (unsigned char *) PnP_find_packet(p, 0x70, next);
979 if (p && p[1]==packet_type && !(n--))
980 return (PnP_TAG_PACKET *) p;
981 next = 1;
982 };
983 return NULL; /* not found */
984}
985
986PnP_TAG_PACKET __init *PnP_find_large_vendor_packet(unsigned char *p,
987 unsigned packet_type,
988 int n)
989{
990 int next=0;
991 while (p) {
992 p = (unsigned char *) PnP_find_packet(p, 0x84, next);
993 if (p && p[3]==packet_type && !(n--))
994 return (PnP_TAG_PACKET *) p;
995 next = 1;
996 };
997 return NULL; /* not found */
998}
999
1000#ifdef CONFIG_PROC_PREPRESIDUAL
1001static int proc_prep_residual_read(char * buf, char ** start, off_t off,
1002 int count, int *eof, void *data)
1003{
1004 int n;
1005
1006 n = res->ResidualLength - off;
1007 if (n < 0) {
1008 *eof = 1;
1009 n = 0;
1010 }
1011 else {
1012 if (n > count)
1013 n = count;
1014 else
1015 *eof = 1;
1016
1017 memcpy(buf, (char *)res + off, n);
1018 *start = buf;
1019 }
1020
1021 return n;
1022}
1023
1024int __init
1025proc_prep_residual_init(void)
1026{
1027 if (have_residual_data)
1028 create_proc_read_entry("residual", S_IRUGO, NULL,
1029 proc_prep_residual_read, NULL);
1030 return 0;
1031}
1032
1033__initcall(proc_prep_residual_init);
1034#endif
diff --git a/arch/ppc/platforms/rpx8260.h b/arch/ppc/platforms/rpx8260.h
new file mode 100644
index 000000000000..843494a50ef3
--- /dev/null
+++ b/arch/ppc/platforms/rpx8260.h
@@ -0,0 +1,81 @@
1/*
2 * A collection of structures, addresses, and values associated with
3 * the Embedded Planet RPX6 (or RPX Super) MPC8260 board.
4 * Copied from the RPX-Classic and SBS8260 stuff.
5 *
6 * Copyright (c) 2001 Dan Malek <dan@embeddededge.com>
7 */
8#ifdef __KERNEL__
9#ifndef __ASM_PLATFORMS_RPX8260_H__
10#define __ASM_PLATFORMS_RPX8260_H__
11
12/* A Board Information structure that is given to a program when
13 * prom starts it up.
14 */
15typedef struct bd_info {
16 unsigned int bi_memstart; /* Memory start address */
17 unsigned int bi_memsize; /* Memory (end) size in bytes */
18 unsigned int bi_nvsize; /* NVRAM size in bytes (can be 0) */
19 unsigned int bi_intfreq; /* Internal Freq, in Hz */
20 unsigned int bi_busfreq; /* Bus Freq, in MHz */
21 unsigned int bi_cpmfreq; /* CPM Freq, in MHz */
22 unsigned int bi_brgfreq; /* BRG Freq, in MHz */
23 unsigned int bi_vco; /* VCO Out from PLL */
24 unsigned int bi_baudrate; /* Default console baud rate */
25 unsigned int bi_immr; /* IMMR when called from boot rom */
26 unsigned char bi_enetaddr[6];
27} bd_t;
28
29extern bd_t m8xx_board_info;
30
31/* Memory map is configured by the PROM startup.
32 * We just map a few things we need. The CSR is actually 4 byte-wide
33 * registers that can be accessed as 8-, 16-, or 32-bit values.
34 */
35#define CPM_MAP_ADDR ((uint)0xf0000000)
36#define RPX_CSR_ADDR ((uint)0xfa000000)
37#define RPX_CSR_SIZE ((uint)(512 * 1024))
38#define RPX_NVRTC_ADDR ((uint)0xfa080000)
39#define RPX_NVRTC_SIZE ((uint)(512 * 1024))
40
41/* The RPX6 has 16, byte wide control/status registers.
42 * Not all are used (yet).
43 */
44extern volatile u_char *rpx6_csr_addr;
45
46/* Things of interest in the CSR.
47*/
48#define BCSR0_ID_MASK ((u_char)0xf0) /* Read only */
49#define BCSR0_SWITCH_MASK ((u_char)0x0f) /* Read only */
50#define BCSR1_XCVR_SMC1 ((u_char)0x80)
51#define BCSR1_XCVR_SMC2 ((u_char)0x40)
52#define BCSR2_FLASH_WENABLE ((u_char)0x20)
53#define BCSR2_NVRAM_ENABLE ((u_char)0x10)
54#define BCSR2_ALT_IRQ2 ((u_char)0x08)
55#define BCSR2_ALT_IRQ3 ((u_char)0x04)
56#define BCSR2_PRST ((u_char)0x02) /* Force reset */
57#define BCSR2_ENPRST ((u_char)0x01) /* Enable POR */
58#define BCSR3_MODCLK_MASK ((u_char)0xe0)
59#define BCSR3_ENCLKHDR ((u_char)0x10)
60#define BCSR3_LED5 ((u_char)0x04) /* 0 == on */
61#define BCSR3_LED6 ((u_char)0x02) /* 0 == on */
62#define BCSR3_LED7 ((u_char)0x01) /* 0 == on */
63#define BCSR4_EN_PHY ((u_char)0x80) /* Enable PHY */
64#define BCSR4_EN_MII ((u_char)0x40) /* Enable PHY */
65#define BCSR4_MII_READ ((u_char)0x04)
66#define BCSR4_MII_MDC ((u_char)0x02)
67#define BCSR4_MII_MDIO ((u_char)0x01)
68#define BCSR13_FETH_IRQMASK ((u_char)0xf0)
69#define BCSR15_FETH_IRQ ((u_char)0x20)
70
71#define PHY_INTERRUPT SIU_INT_IRQ7
72
73/* For our show_cpuinfo hooks. */
74#define CPUINFO_VENDOR "Embedded Planet"
75#define CPUINFO_MACHINE "EP8260 PowerPC"
76
77/* Warm reset vector. */
78#define BOOTROM_RESTART_ADDR ((uint)0xfff00104)
79
80#endif /* __ASM_PLATFORMS_RPX8260_H__ */
81#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/rpxclassic.h b/arch/ppc/platforms/rpxclassic.h
new file mode 100644
index 000000000000..6daa109491c4
--- /dev/null
+++ b/arch/ppc/platforms/rpxclassic.h
@@ -0,0 +1,119 @@
1/*
2 * A collection of structures, addresses, and values associated with
3 * the RPCG RPX-Classic board. Copied from the RPX-Lite stuff.
4 *
5 * Copyright (c) 1998 Dan Malek (dmalek@jlc.net)
6 */
7#ifdef __KERNEL__
8#ifndef __MACH_RPX_DEFS
9#define __MACH_RPX_DEFS
10
11#include <linux/config.h>
12
13#ifndef __ASSEMBLY__
14/* A Board Information structure that is given to a program when
15 * prom starts it up.
16 */
17typedef struct bd_info {
18 unsigned int bi_memstart; /* Memory start address */
19 unsigned int bi_memsize; /* Memory (end) size in bytes */
20 unsigned int bi_intfreq; /* Internal Freq, in Hz */
21 unsigned int bi_busfreq; /* Bus Freq, in Hz */
22 unsigned char bi_enetaddr[6];
23 unsigned int bi_baudrate;
24} bd_t;
25
26extern bd_t m8xx_board_info;
27
28/* Memory map is configured by the PROM startup.
29 * We just map a few things we need. The CSR is actually 4 byte-wide
30 * registers that can be accessed as 8-, 16-, or 32-bit values.
31 */
32#define PCI_ISA_IO_ADDR ((unsigned)0x80000000)
33#define PCI_ISA_IO_SIZE ((uint)(512 * 1024 * 1024))
34#define PCI_ISA_MEM_ADDR ((unsigned)0xc0000000)
35#define PCI_ISA_MEM_SIZE ((uint)(512 * 1024 * 1024))
36#define RPX_CSR_ADDR ((uint)0xfa400000)
37#define RPX_CSR_SIZE ((uint)(4 * 1024))
38#define IMAP_ADDR ((uint)0xfa200000)
39#define IMAP_SIZE ((uint)(64 * 1024))
40#define PCI_CSR_ADDR ((uint)0x80000000)
41#define PCI_CSR_SIZE ((uint)(64 * 1024))
42#define PCMCIA_MEM_ADDR ((uint)0xe0000000)
43#define PCMCIA_MEM_SIZE ((uint)(64 * 1024))
44#define PCMCIA_IO_ADDR ((uint)0xe4000000)
45#define PCMCIA_IO_SIZE ((uint)(4 * 1024))
46#define PCMCIA_ATTRB_ADDR ((uint)0xe8000000)
47#define PCMCIA_ATTRB_SIZE ((uint)(4 * 1024))
48
49/* Things of interest in the CSR.
50*/
51#define BCSR0_ETHEN ((uint)0x80000000)
52#define BCSR0_ETHLPBK ((uint)0x40000000)
53#define BCSR0_COLTESTDIS ((uint)0x20000000)
54#define BCSR0_FULLDPLXDIS ((uint)0x10000000)
55#define BCSR0_ENFLSHSEL ((uint)0x04000000)
56#define BCSR0_FLASH_SEL ((uint)0x02000000)
57#define BCSR0_ENMONXCVR ((uint)0x01000000)
58
59#define BCSR0_PCMCIAVOLT ((uint)0x000f0000) /* CLLF */
60#define BCSR0_PCMCIA3VOLT ((uint)0x000a0000) /* CLLF */
61#define BCSR0_PCMCIA5VOLT ((uint)0x00060000) /* CLLF */
62
63#define BCSR1_IPB5SEL ((uint)0x00100000)
64#define BCSR1_PCVCTL4 ((uint)0x00080000)
65#define BCSR1_PCVCTL5 ((uint)0x00040000)
66#define BCSR1_PCVCTL6 ((uint)0x00020000)
67#define BCSR1_PCVCTL7 ((uint)0x00010000)
68
69#define BCSR2_EN232XCVR ((uint)0x00008000)
70#define BCSR2_QSPACESEL ((uint)0x00004000)
71#define BCSR2_FETHLEDMODE ((uint)0x00000800) /* CLLF */
72
73#if defined(CONFIG_HTDMSOUND)
74#include <platforms/rpxhiox.h>
75#endif
76
77/* define IO_BASE for pcmcia, CLLF only */
78#if !defined(CONFIG_PCI)
79#define _IO_BASE 0x80000000
80#define _IO_BASE_SIZE 0x1000
81
82/* for pcmcia sandisk */
83#ifdef CONFIG_IDE
84# define MAX_HWIFS 1
85#endif
86#endif
87
88/* Interrupt level assignments.
89*/
90#define FEC_INTERRUPT SIU_LEVEL1 /* FEC interrupt */
91
92
93/* CPM Ethernet through SCCx.
94 *
95 * Bits in parallel I/O port registers that have to be set/cleared
96 * to configure the pins for SCC1 use.
97 */
98#define PA_ENET_RXD ((ushort)0x0001)
99#define PA_ENET_TXD ((ushort)0x0002)
100#define PA_ENET_TCLK ((ushort)0x0200)
101#define PA_ENET_RCLK ((ushort)0x0800)
102#define PB_ENET_TENA ((uint)0x00001000)
103#define PC_ENET_CLSN ((ushort)0x0010)
104#define PC_ENET_RENA ((ushort)0x0020)
105
106/* Control bits in the SICR to route TCLK (CLK2) and RCLK (CLK4) to
107 * SCC1. Also, make sure GR1 (bit 24) and SC1 (bit 25) are zero.
108 */
109#define SICR_ENET_MASK ((uint)0x000000ff)
110#define SICR_ENET_CLKRT ((uint)0x0000003d)
111
112/* We don't use the 8259.
113*/
114
115#define NR_8259_INTS 0
116
117#endif /* !__ASSEMBLY__ */
118#endif /* __MACH_RPX_DEFS */
119#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/rpxhiox.h b/arch/ppc/platforms/rpxhiox.h
new file mode 100644
index 000000000000..c3fa5a653762
--- /dev/null
+++ b/arch/ppc/platforms/rpxhiox.h
@@ -0,0 +1,41 @@
1/*
2 * The Embedded Planet HIOX expansion card definitions.
3 * There were a few different versions of these cards, but only
4 * the one that escaped real production is defined here.
5 *
6 * Copyright (c) 2000 Dan Malek (dmalek@jlc.net)
7 */
8#ifndef __MACH_RPX_HIOX_DEFS
9#define __MACH_RPX_HIOX_DEFS
10
11#define HIOX_CSR_ADDR ((uint)0xfac00000)
12#define HIOX_CSR_SIZE ((uint)(4 * 1024))
13#define HIOX_CSR0_ADDR HIOX_CSR_ADDR
14#define HIOX_CSR4_ADDR ((uint)0xfac00004)
15
16#define HIOX_CSR0_DEFAULT ((uint)0x380f3c00)
17#define HIOX_CSR0_ENSCC2 ((uint)0x80000000)
18#define HIOX_CSR0_ENSMC2 ((uint)0x04000000)
19#define HIOX_CSR0_ENVDOCLK ((uint)0x02000000)
20#define HIOX_CSR0_VDORST_HL ((uint)0x01000000)
21#define HIOX_CSR0_RS232SEL ((uint)0x0000c000)
22#define HIOX_CSR0_SCC3SEL ((uint)0x0000c000)
23#define HIOX_CSR0_SMC1SEL ((uint)0x00008000)
24#define HIOX_CSR0_SCC1SEL ((uint)0x00004000)
25#define HIOX_CSR0_ENTOUCH ((uint)0x00000080)
26#define HIOX_CSR0_PDOWN100 ((uint)0x00000060)
27#define HIOX_CSR0_PDOWN10 ((uint)0x00000040)
28#define HIOX_CSR0_PDOWN1 ((uint)0x00000020)
29#define HIOX_CSR0_TSELSPI ((uint)0x00000010)
30#define HIOX_CSR0_TIRQSTAT ((uint)0x00000008)
31#define HIOX_CSR4_DEFAULT ((uint)0x00000000)
32#define HIOX_CSR4_ENTIRQ2 ((uint)0x20000000)
33#define HIOX_CSR4_ENTIRQ3 ((uint)0x10000000)
34#define HIOX_CSR4_ENAUDIO ((uint)0x00000080)
35#define HIOX_CSR4_RSTAUDIO ((uint)0x00000040) /* 0 == reset */
36#define HIOX_CSR4_AUDCLKHI ((uint)0x00000020)
37#define HIOX_CSR4_AUDSPISEL ((uint)0x00000010)
38#define HIOX_CSR4_AUDIRQSTAT ((uint)0x00000008)
39#define HIOX_CSR4_AUDCLKSEL ((uint)0x00000007)
40
41#endif
diff --git a/arch/ppc/platforms/rpxlite.h b/arch/ppc/platforms/rpxlite.h
new file mode 100644
index 000000000000..deee5bd36aa8
--- /dev/null
+++ b/arch/ppc/platforms/rpxlite.h
@@ -0,0 +1,96 @@
1/*
2 * A collection of structures, addresses, and values associated with
3 * the RPCG RPX-Lite board. Copied from the MBX stuff.
4 *
5 * Copyright (c) 1998 Dan Malek (dmalek@jlc.net)
6 */
7#ifdef __KERNEL__
8#ifndef __MACH_RPX_DEFS
9#define __MACH_RPX_DEFS
10
11#include <linux/config.h>
12
13#ifndef __ASSEMBLY__
14/* A Board Information structure that is given to a program when
15 * prom starts it up.
16 */
17typedef struct bd_info {
18 unsigned int bi_memstart; /* Memory start address */
19 unsigned int bi_memsize; /* Memory (end) size in bytes */
20 unsigned int bi_intfreq; /* Internal Freq, in Hz */
21 unsigned int bi_busfreq; /* Bus Freq, in Hz */
22 unsigned char bi_enetaddr[6];
23 unsigned int bi_baudrate;
24} bd_t;
25
26extern bd_t m8xx_board_info;
27
28/* Memory map is configured by the PROM startup.
29 * We just map a few things we need. The CSR is actually 4 byte-wide
30 * registers that can be accessed as 8-, 16-, or 32-bit values.
31 */
32#define RPX_CSR_ADDR ((uint)0xfa400000)
33#define RPX_CSR_SIZE ((uint)(4 * 1024))
34#define IMAP_ADDR ((uint)0xfa200000)
35#define IMAP_SIZE ((uint)(64 * 1024))
36#define PCMCIA_MEM_ADDR ((uint)0x04000000)
37#define PCMCIA_MEM_SIZE ((uint)(64 * 1024))
38#define PCMCIA_IO_ADDR ((uint)0x04400000)
39#define PCMCIA_IO_SIZE ((uint)(4 * 1024))
40
41/* Things of interest in the CSR.
42*/
43#define BCSR0_ETHEN ((uint)0x80000000)
44#define BCSR0_ETHLPBK ((uint)0x40000000)
45#define BCSR0_COLTESTDIS ((uint)0x20000000)
46#define BCSR0_FULLDPLXDIS ((uint)0x10000000)
47#define BCSR0_LEDOFF ((uint)0x08000000)
48#define BCSR0_USBDISABLE ((uint)0x04000000)
49#define BCSR0_USBHISPEED ((uint)0x02000000)
50#define BCSR0_USBPWREN ((uint)0x01000000)
51#define BCSR0_PCMCIAVOLT ((uint)0x000f0000)
52#define BCSR0_PCMCIA3VOLT ((uint)0x000a0000)
53#define BCSR0_PCMCIA5VOLT ((uint)0x00060000)
54
55#define BCSR1_IPB5SEL ((uint)0x00100000)
56#define BCSR1_PCVCTL4 ((uint)0x00080000)
57#define BCSR1_PCVCTL5 ((uint)0x00040000)
58#define BCSR1_PCVCTL6 ((uint)0x00020000)
59#define BCSR1_PCVCTL7 ((uint)0x00010000)
60
61#if defined(CONFIG_HTDMSOUND)
62#include <platforms/rpxhiox.h>
63#endif
64
65/* define IO_BASE for pcmcia */
66#define _IO_BASE 0x80000000
67#define _IO_BASE_SIZE 0x1000
68
69#ifdef CONFIG_IDE
70# define MAX_HWIFS 1
71#endif
72
73/* CPM Ethernet through SCCx.
74 *
75 * This ENET stuff is for the MPC850 with ethernet on SCC2. Some of
76 * this may be unique to the RPX-Lite configuration.
77 * Note TENA is on Port B.
78 */
79#define PA_ENET_RXD ((ushort)0x0004)
80#define PA_ENET_TXD ((ushort)0x0008)
81#define PA_ENET_TCLK ((ushort)0x0200)
82#define PA_ENET_RCLK ((ushort)0x0800)
83#define PB_ENET_TENA ((uint)0x00002000)
84#define PC_ENET_CLSN ((ushort)0x0040)
85#define PC_ENET_RENA ((ushort)0x0080)
86
87#define SICR_ENET_MASK ((uint)0x0000ff00)
88#define SICR_ENET_CLKRT ((uint)0x00003d00)
89
90/* We don't use the 8259.
91*/
92#define NR_8259_INTS 0
93
94#endif /* !__ASSEMBLY__ */
95#endif /* __MACH_RPX_DEFS */
96#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/sandpoint.c b/arch/ppc/platforms/sandpoint.c
new file mode 100644
index 000000000000..531bfa0e4512
--- /dev/null
+++ b/arch/ppc/platforms/sandpoint.c
@@ -0,0 +1,742 @@
1/*
2 * arch/ppc/platforms/sandpoint_setup.c
3 *
4 * Board setup routines for the Motorola SPS Sandpoint Test Platform.
5 *
6 * Author: Mark A. Greer
7 * mgreer@mvista.com
8 *
9 * 2000-2003 (c) MontaVista Software, Inc. This file is licensed under
10 * the terms of the GNU General Public License version 2. This program
11 * is licensed "as is" without any warranty of any kind, whether express
12 * or implied.
13 */
14
15/*
16 * This file adds support for the Motorola SPS Sandpoint Test Platform.
17 * These boards have a PPMC slot for the processor so any combination
18 * of cpu and host bridge can be attached. This port is for an 8240 PPMC
19 * module from Motorola SPS and other closely related cpu/host bridge
20 * combinations (e.g., 750/755/7400 with MPC107 host bridge).
21 * The sandpoint itself has a Windbond 83c553 (PCI-ISA bridge, 2 DMA ctlrs, 2
22 * cascaded 8259 interrupt ctlrs, 8254 Timer/Counter, and an IDE ctlr), a
23 * National 87308 (RTC, 2 UARTs, Keyboard & mouse ctlrs, and a floppy ctlr),
24 * and 4 PCI slots (only 2 of which are usable; the other 2 are keyed for 3.3V
25 * but are really 5V).
26 *
27 * The firmware on the sandpoint is called DINK (not my acronym :). This port
28 * depends on DINK to do some basic initialization (e.g., initialize the memory
29 * ctlr) and to ensure that the processor is using MAP B (CHRP map).
30 *
31 * The switch settings for the Sandpoint board MUST be as follows:
32 * S3: down
33 * S4: up
34 * S5: up
35 * S6: down
36 *
37 * 'down' is in the direction from the PCI slots towards the PPMC slot;
38 * 'up' is in the direction from the PPMC slot towards the PCI slots.
39 * Be careful, the way the sandpoint board is installed in XT chasses will
40 * make the directions reversed.
41 *
42 * Since Motorola listened to our suggestions for improvement, we now have
43 * the Sandpoint X3 board. All of the PCI slots are available, it uses
44 * the serial interrupt interface (just a hardware thing we need to
45 * configure properly).
46 *
47 * Use the default X3 switch settings. The interrupts are then:
48 * EPIC Source
49 * 0 SIOINT (8259, active low)
50 * 1 PCI #1
51 * 2 PCI #2
52 * 3 PCI #3
53 * 4 PCI #4
54 * 7 Winbond INTC (IDE interrupt)
55 * 8 Winbond INTD (IDE interrupt)
56 *
57 *
58 * Motorola has finally released a version of DINK32 that correctly
59 * (seemingly) initalizes the memory controller correctly, regardless
60 * of the amount of memory in the system. Once a method of determining
61 * what version of DINK initializes the system for us, if applicable, is
62 * found, we can hopefully stop hardcoding 32MB of RAM.
63 */
64
65#include <linux/config.h>
66#include <linux/stddef.h>
67#include <linux/kernel.h>
68#include <linux/init.h>
69#include <linux/errno.h>
70#include <linux/reboot.h>
71#include <linux/pci.h>
72#include <linux/kdev_t.h>
73#include <linux/major.h>
74#include <linux/initrd.h>
75#include <linux/console.h>
76#include <linux/delay.h>
77#include <linux/irq.h>
78#include <linux/ide.h>
79#include <linux/seq_file.h>
80#include <linux/root_dev.h>
81#include <linux/serial.h>
82#include <linux/tty.h> /* for linux/serial_core.h */
83#include <linux/serial_core.h>
84
85#include <asm/system.h>
86#include <asm/pgtable.h>
87#include <asm/page.h>
88#include <asm/time.h>
89#include <asm/dma.h>
90#include <asm/io.h>
91#include <asm/machdep.h>
92#include <asm/prom.h>
93#include <asm/smp.h>
94#include <asm/vga.h>
95#include <asm/open_pic.h>
96#include <asm/i8259.h>
97#include <asm/todc.h>
98#include <asm/bootinfo.h>
99#include <asm/mpc10x.h>
100#include <asm/pci-bridge.h>
101#include <asm/kgdb.h>
102
103#include "sandpoint.h"
104
105/* Set non-zero if an X2 Sandpoint detected. */
106static int sandpoint_is_x2;
107
108unsigned char __res[sizeof(bd_t)];
109
110static void sandpoint_halt(void);
111static void sandpoint_probe_type(void);
112
113/*
114 * Define all of the IRQ senses and polarities. Taken from the
115 * Sandpoint X3 User's manual.
116 */
117static u_char sandpoint_openpic_initsenses[] __initdata = {
118 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* 0: SIOINT */
119 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* 2: PCI Slot 1 */
120 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* 3: PCI Slot 2 */
121 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* 4: PCI Slot 3 */
122 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* 5: PCI Slot 4 */
123 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* 8: IDE (INT C) */
124 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE) /* 9: IDE (INT D) */
125};
126
127/*
128 * Motorola SPS Sandpoint interrupt routing.
129 */
130static inline int
131x3_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
132{
133 static char pci_irq_table[][4] =
134 /*
135 * PCI IDSEL/INTPIN->INTLINE
136 * A B C D
137 */
138 {
139 { 16, 0, 0, 0 }, /* IDSEL 11 - i8259 on Winbond */
140 { 0, 0, 0, 0 }, /* IDSEL 12 - unused */
141 { 18, 21, 20, 19 }, /* IDSEL 13 - PCI slot 1 */
142 { 19, 18, 21, 20 }, /* IDSEL 14 - PCI slot 2 */
143 { 20, 19, 18, 21 }, /* IDSEL 15 - PCI slot 3 */
144 { 21, 20, 19, 18 }, /* IDSEL 16 - PCI slot 4 */
145 };
146
147 const long min_idsel = 11, max_idsel = 16, irqs_per_slot = 4;
148 return PCI_IRQ_TABLE_LOOKUP;
149}
150
151static inline int
152x2_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
153{
154 static char pci_irq_table[][4] =
155 /*
156 * PCI IDSEL/INTPIN->INTLINE
157 * A B C D
158 */
159 {
160 { 18, 0, 0, 0 }, /* IDSEL 11 - i8259 on Windbond */
161 { 0, 0, 0, 0 }, /* IDSEL 12 - unused */
162 { 16, 17, 18, 19 }, /* IDSEL 13 - PCI slot 1 */
163 { 17, 18, 19, 16 }, /* IDSEL 14 - PCI slot 2 */
164 { 18, 19, 16, 17 }, /* IDSEL 15 - PCI slot 3 */
165 { 19, 16, 17, 18 }, /* IDSEL 16 - PCI slot 4 */
166 };
167
168 const long min_idsel = 11, max_idsel = 16, irqs_per_slot = 4;
169 return PCI_IRQ_TABLE_LOOKUP;
170}
171
172static void __init
173sandpoint_setup_winbond_83553(struct pci_controller *hose)
174{
175 int devfn;
176
177 /*
178 * Route IDE interrupts directly to the 8259's IRQ 14 & 15.
179 * We can't route the IDE interrupt to PCI INTC# or INTD# because those
180 * woule interfere with the PMC's INTC# and INTD# lines.
181 */
182 /*
183 * Winbond Fcn 0
184 */
185 devfn = PCI_DEVFN(11,0);
186
187 early_write_config_byte(hose,
188 0,
189 devfn,
190 0x43, /* IDE Interrupt Routing Control */
191 0xef);
192 early_write_config_word(hose,
193 0,
194 devfn,
195 0x44, /* PCI Interrupt Routing Control */
196 0x0000);
197
198 /* Want ISA memory cycles to be forwarded to PCI bus */
199 early_write_config_byte(hose,
200 0,
201 devfn,
202 0x48, /* ISA-to-PCI Addr Decoder Control */
203 0xf0);
204
205 /* Enable Port 92. */
206 early_write_config_byte(hose,
207 0,
208 devfn,
209 0x4e, /* AT System Control Register */
210 0x06);
211 /*
212 * Winbond Fcn 1
213 */
214 devfn = PCI_DEVFN(11,1);
215
216 /* Put IDE controller into native mode. */
217 early_write_config_byte(hose,
218 0,
219 devfn,
220 0x09, /* Programming interface Register */
221 0x8f);
222
223 /* Init IRQ routing, enable both ports, disable fast 16 */
224 early_write_config_dword(hose,
225 0,
226 devfn,
227 0x40, /* IDE Control/Status Register */
228 0x00ff0011);
229 return;
230}
231
232/* On the sandpoint X2, we must avoid sending configuration cycles to
233 * device #12 (IDSEL addr = AD12).
234 */
235static int
236x2_exclude_device(u_char bus, u_char devfn)
237{
238 if ((bus == 0) && (PCI_SLOT(devfn) == SANDPOINT_HOST_BRIDGE_IDSEL))
239 return PCIBIOS_DEVICE_NOT_FOUND;
240 else
241 return PCIBIOS_SUCCESSFUL;
242}
243
244static void __init
245sandpoint_find_bridges(void)
246{
247 struct pci_controller *hose;
248
249 hose = pcibios_alloc_controller();
250
251 if (!hose)
252 return;
253
254 hose->first_busno = 0;
255 hose->last_busno = 0xff;
256
257 if (mpc10x_bridge_init(hose,
258 MPC10X_MEM_MAP_B,
259 MPC10X_MEM_MAP_B,
260 MPC10X_MAPB_EUMB_BASE) == 0) {
261
262 /* Do early winbond init, then scan PCI bus */
263 sandpoint_setup_winbond_83553(hose);
264 hose->last_busno = pciauto_bus_scan(hose, hose->first_busno);
265
266 ppc_md.pcibios_fixup = NULL;
267 ppc_md.pcibios_fixup_bus = NULL;
268 ppc_md.pci_swizzle = common_swizzle;
269 if (sandpoint_is_x2) {
270 ppc_md.pci_map_irq = x2_map_irq;
271 ppc_md.pci_exclude_device = x2_exclude_device;
272 } else
273 ppc_md.pci_map_irq = x3_map_irq;
274 }
275 else {
276 if (ppc_md.progress)
277 ppc_md.progress("Bridge init failed", 0x100);
278 printk("Host bridge init failed\n");
279 }
280
281 return;
282}
283
284static void __init
285sandpoint_setup_arch(void)
286{
287 /* Probe for Sandpoint model */
288 sandpoint_probe_type();
289 if (sandpoint_is_x2)
290 epic_serial_mode = 0;
291
292 loops_per_jiffy = 100000000 / HZ;
293
294#ifdef CONFIG_BLK_DEV_INITRD
295 if (initrd_start)
296 ROOT_DEV = Root_RAM0;
297 else
298#endif
299#ifdef CONFIG_ROOT_NFS
300 ROOT_DEV = Root_NFS;
301#else
302 ROOT_DEV = Root_HDA1;
303#endif
304
305 /* Lookup PCI host bridges */
306 sandpoint_find_bridges();
307
308 printk(KERN_INFO "Motorola SPS Sandpoint Test Platform\n");
309 printk(KERN_INFO "Port by MontaVista Software, Inc. (source@mvista.com)\n");
310
311 /* DINK32 12.3 and below do not correctly enable any caches.
312 * We will do this now with good known values. Future versions
313 * of DINK32 are supposed to get this correct.
314 */
315 if (cpu_has_feature(CPU_FTR_SPEC7450))
316 /* 745x is different. We only want to pass along enable. */
317 _set_L2CR(L2CR_L2E);
318 else if (cpu_has_feature(CPU_FTR_L2CR))
319 /* All modules have 1MB of L2. We also assume that an
320 * L2 divisor of 3 will work.
321 */
322 _set_L2CR(L2CR_L2E | L2CR_L2SIZ_1MB | L2CR_L2CLK_DIV3
323 | L2CR_L2RAM_PIPE | L2CR_L2OH_1_0 | L2CR_L2DF);
324#if 0
325 /* Untested right now. */
326 if (cpu_has_feature(CPU_FTR_L3CR)) {
327 /* Magic value. */
328 _set_L3CR(0x8f032000);
329 }
330#endif
331}
332
333#define SANDPOINT_87308_CFG_ADDR 0x15c
334#define SANDPOINT_87308_CFG_DATA 0x15d
335
336#define SANDPOINT_87308_CFG_INB(addr, byte) { \
337 outb((addr), SANDPOINT_87308_CFG_ADDR); \
338 (byte) = inb(SANDPOINT_87308_CFG_DATA); \
339}
340
341#define SANDPOINT_87308_CFG_OUTB(addr, byte) { \
342 outb((addr), SANDPOINT_87308_CFG_ADDR); \
343 outb((byte), SANDPOINT_87308_CFG_DATA); \
344}
345
346#define SANDPOINT_87308_SELECT_DEV(dev_num) { \
347 SANDPOINT_87308_CFG_OUTB(0x07, (dev_num)); \
348}
349
350#define SANDPOINT_87308_DEV_ENABLE(dev_num) { \
351 SANDPOINT_87308_SELECT_DEV(dev_num); \
352 SANDPOINT_87308_CFG_OUTB(0x30, 0x01); \
353}
354
355/*
356 * To probe the Sandpoint type, we need to check for a connection between GPIO
357 * pins 6 and 7 on the NS87308 SuperIO.
358 */
359static void __init sandpoint_probe_type(void)
360{
361 u8 x;
362 /* First, ensure that the GPIO pins are enabled. */
363 SANDPOINT_87308_SELECT_DEV(0x07); /* Select GPIO logical device */
364 SANDPOINT_87308_CFG_OUTB(0x60, 0x07); /* Base address 0x700 */
365 SANDPOINT_87308_CFG_OUTB(0x61, 0x00);
366 SANDPOINT_87308_CFG_OUTB(0x30, 0x01); /* Enable */
367
368 /* Now, set pin 7 to output and pin 6 to input. */
369 outb((inb(0x701) | 0x80) & 0xbf, 0x701);
370 /* Set push-pull output */
371 outb(inb(0x702) | 0x80, 0x702);
372 /* Set pull-up on input */
373 outb(inb(0x703) | 0x40, 0x703);
374 /* Set output high and check */
375 x = inb(0x700);
376 outb(x | 0x80, 0x700);
377 x = inb(0x700);
378 sandpoint_is_x2 = ! (x & 0x40);
379 if (ppc_md.progress && sandpoint_is_x2)
380 ppc_md.progress("High output says X2", 0);
381 /* Set output low and check */
382 outb(x & 0x7f, 0x700);
383 sandpoint_is_x2 |= inb(0x700) & 0x40;
384 if (ppc_md.progress && sandpoint_is_x2)
385 ppc_md.progress("Low output says X2", 0);
386 if (ppc_md.progress && ! sandpoint_is_x2)
387 ppc_md.progress("Sandpoint is X3", 0);
388}
389
390/*
391 * Fix IDE interrupts.
392 */
393static int __init
394sandpoint_fix_winbond_83553(void)
395{
396 /* Make some 8259 interrupt level sensitive */
397 outb(0xe0, 0x4d0);
398 outb(0xde, 0x4d1);
399
400 return 0;
401}
402
403arch_initcall(sandpoint_fix_winbond_83553);
404
405/*
406 * Initialize the ISA devices on the Nat'l PC87308VUL SuperIO chip.
407 */
408static int __init
409sandpoint_setup_natl_87308(void)
410{
411 u_char reg;
412
413 /*
414 * Enable all the devices on the Super I/O chip.
415 */
416 SANDPOINT_87308_SELECT_DEV(0x00); /* Select kbd logical device */
417 SANDPOINT_87308_CFG_OUTB(0xf0, 0x00); /* Set KBC clock to 8 Mhz */
418 SANDPOINT_87308_DEV_ENABLE(0x00); /* Enable keyboard */
419 SANDPOINT_87308_DEV_ENABLE(0x01); /* Enable mouse */
420 SANDPOINT_87308_DEV_ENABLE(0x02); /* Enable rtc */
421 SANDPOINT_87308_DEV_ENABLE(0x03); /* Enable fdc (floppy) */
422 SANDPOINT_87308_DEV_ENABLE(0x04); /* Enable parallel */
423 SANDPOINT_87308_DEV_ENABLE(0x05); /* Enable UART 2 */
424 SANDPOINT_87308_CFG_OUTB(0xf0, 0x82); /* Enable bank select regs */
425 SANDPOINT_87308_DEV_ENABLE(0x06); /* Enable UART 1 */
426 SANDPOINT_87308_CFG_OUTB(0xf0, 0x82); /* Enable bank select regs */
427
428 /* Set up floppy in PS/2 mode */
429 outb(0x09, SIO_CONFIG_RA);
430 reg = inb(SIO_CONFIG_RD);
431 reg = (reg & 0x3F) | 0x40;
432 outb(reg, SIO_CONFIG_RD);
433 outb(reg, SIO_CONFIG_RD); /* Have to write twice to change! */
434
435 return 0;
436}
437
438arch_initcall(sandpoint_setup_natl_87308);
439
440static int __init
441sandpoint_request_io(void)
442{
443 request_region(0x00,0x20,"dma1");
444 request_region(0x20,0x20,"pic1");
445 request_region(0x40,0x20,"timer");
446 request_region(0x80,0x10,"dma page reg");
447 request_region(0xa0,0x20,"pic2");
448 request_region(0xc0,0x20,"dma2");
449
450 return 0;
451}
452
453arch_initcall(sandpoint_request_io);
454
455/*
456 * Interrupt setup and service. Interrrupts on the Sandpoint come
457 * from the four PCI slots plus the 8259 in the Winbond Super I/O (SIO).
458 * The 8259 is cascaded from EPIC IRQ0, IRQ1-4 map to PCI slots 1-4,
459 * IDE is on EPIC 7 and 8.
460 */
461static void __init
462sandpoint_init_IRQ(void)
463{
464 int i;
465
466 OpenPIC_InitSenses = sandpoint_openpic_initsenses;
467 OpenPIC_NumInitSenses = sizeof(sandpoint_openpic_initsenses);
468
469 mpc10x_set_openpic();
470 openpic_hookup_cascade(sandpoint_is_x2 ? 17 : NUM_8259_INTERRUPTS, "82c59 cascade",
471 i8259_irq);
472
473 /*
474 * openpic_init() has set up irq_desc[16-31] to be openpic
475 * interrupts. We need to set irq_desc[0-15] to be i8259
476 * interrupts.
477 */
478 for(i=0; i < NUM_8259_INTERRUPTS; i++)
479 irq_desc[i].handler = &i8259_pic;
480
481 /*
482 * The EPIC allows for a read in the range of 0xFEF00000 ->
483 * 0xFEFFFFFF to generate a PCI interrupt-acknowledge transaction.
484 */
485 i8259_init(0xfef00000);
486}
487
488static u32
489sandpoint_irq_canonicalize(u32 irq)
490{
491 if (irq == 2)
492 return 9;
493 else
494 return irq;
495}
496
497static unsigned long __init
498sandpoint_find_end_of_memory(void)
499{
500 bd_t *bp = (bd_t *)__res;
501
502 if (bp->bi_memsize)
503 return bp->bi_memsize;
504
505 /* DINK32 13.0 correctly initalizes things, so iff you use
506 * this you _should_ be able to change this instead of a
507 * hardcoded value. */
508#if 0
509 return mpc10x_get_mem_size(MPC10X_MEM_MAP_B);
510#else
511 return 32*1024*1024;
512#endif
513}
514
515static void __init
516sandpoint_map_io(void)
517{
518 io_block_mapping(0xfe000000, 0xfe000000, 0x02000000, _PAGE_IO);
519}
520
521static void
522sandpoint_restart(char *cmd)
523{
524 local_irq_disable();
525
526 /* Set exception prefix high - to the firmware */
527 _nmask_and_or_msr(0, MSR_IP);
528
529 /* Reset system via Port 92 */
530 outb(0x00, 0x92);
531 outb(0x01, 0x92);
532 for(;;); /* Spin until reset happens */
533}
534
535static void
536sandpoint_power_off(void)
537{
538 local_irq_disable();
539 for(;;); /* No way to shut power off with software */
540 /* NOTREACHED */
541}
542
543static void
544sandpoint_halt(void)
545{
546 sandpoint_power_off();
547 /* NOTREACHED */
548}
549
550static int
551sandpoint_show_cpuinfo(struct seq_file *m)
552{
553 seq_printf(m, "vendor\t\t: Motorola SPS\n");
554 seq_printf(m, "machine\t\t: Sandpoint\n");
555
556 return 0;
557}
558
559#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
560/*
561 * IDE support.
562 */
563static int sandpoint_ide_ports_known = 0;
564static unsigned long sandpoint_ide_regbase[MAX_HWIFS];
565static unsigned long sandpoint_ide_ctl_regbase[MAX_HWIFS];
566static unsigned long sandpoint_idedma_regbase;
567
568static void
569sandpoint_ide_probe(void)
570{
571 struct pci_dev *pdev = pci_get_device(PCI_VENDOR_ID_WINBOND,
572 PCI_DEVICE_ID_WINBOND_82C105, NULL);
573
574 if (pdev) {
575 sandpoint_ide_regbase[0]=pdev->resource[0].start;
576 sandpoint_ide_regbase[1]=pdev->resource[2].start;
577 sandpoint_ide_ctl_regbase[0]=pdev->resource[1].start;
578 sandpoint_ide_ctl_regbase[1]=pdev->resource[3].start;
579 sandpoint_idedma_regbase=pdev->resource[4].start;
580 pci_dev_put(pdev);
581 }
582
583 sandpoint_ide_ports_known = 1;
584}
585
586static int
587sandpoint_ide_default_irq(unsigned long base)
588{
589 if (sandpoint_ide_ports_known == 0)
590 sandpoint_ide_probe();
591
592 if (base == sandpoint_ide_regbase[0])
593 return SANDPOINT_IDE_INT0;
594 else if (base == sandpoint_ide_regbase[1])
595 return SANDPOINT_IDE_INT1;
596 else
597 return 0;
598}
599
600static unsigned long
601sandpoint_ide_default_io_base(int index)
602{
603 if (sandpoint_ide_ports_known == 0)
604 sandpoint_ide_probe();
605
606 return sandpoint_ide_regbase[index];
607}
608
609static void __init
610sandpoint_ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port,
611 unsigned long ctrl_port, int *irq)
612{
613 unsigned long reg = data_port;
614 uint alt_status_base;
615 int i;
616
617 for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
618 hw->io_ports[i] = reg++;
619 }
620
621 if (data_port == sandpoint_ide_regbase[0]) {
622 alt_status_base = sandpoint_ide_ctl_regbase[0] + 2;
623 hw->irq = 14;
624 }
625 else if (data_port == sandpoint_ide_regbase[1]) {
626 alt_status_base = sandpoint_ide_ctl_regbase[1] + 2;
627 hw->irq = 15;
628 }
629 else {
630 alt_status_base = 0;
631 hw->irq = 0;
632 }
633
634 if (ctrl_port) {
635 hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
636 } else {
637 hw->io_ports[IDE_CONTROL_OFFSET] = alt_status_base;
638 }
639
640 if (irq != NULL) {
641 *irq = hw->irq;
642 }
643}
644#endif
645
646/*
647 * Set BAT 3 to map 0xf8000000 to end of physical memory space 1-to-1.
648 */
649static __inline__ void
650sandpoint_set_bat(void)
651{
652 unsigned long bat3u, bat3l;
653
654 __asm__ __volatile__(
655 " lis %0,0xf800\n \
656 ori %1,%0,0x002a\n \
657 ori %0,%0,0x0ffe\n \
658 mtspr 0x21e,%0\n \
659 mtspr 0x21f,%1\n \
660 isync\n \
661 sync "
662 : "=r" (bat3u), "=r" (bat3l));
663}
664
665TODC_ALLOC();
666
667void __init
668platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
669 unsigned long r6, unsigned long r7)
670{
671 parse_bootinfo(find_bootinfo());
672
673 /* ASSUMPTION: If both r3 (bd_t pointer) and r6 (cmdline pointer)
674 * are non-zero, then we should use the board info from the bd_t
675 * structure and the cmdline pointed to by r6 instead of the
676 * information from birecs, if any. Otherwise, use the information
677 * from birecs as discovered by the preceeding call to
678 * parse_bootinfo(). This rule should work with both PPCBoot, which
679 * uses a bd_t board info structure, and the kernel boot wrapper,
680 * which uses birecs.
681 */
682 if (r3 && r6) {
683 /* copy board info structure */
684 memcpy( (void *)__res,(void *)(r3+KERNELBASE), sizeof(bd_t) );
685 /* copy command line */
686 *(char *)(r7+KERNELBASE) = 0;
687 strcpy(cmd_line, (char *)(r6+KERNELBASE));
688 }
689
690#ifdef CONFIG_BLK_DEV_INITRD
691 /* take care of initrd if we have one */
692 if (r4) {
693 initrd_start = r4 + KERNELBASE;
694 initrd_end = r5 + KERNELBASE;
695 }
696#endif /* CONFIG_BLK_DEV_INITRD */
697
698 /* Map in board regs, etc. */
699 sandpoint_set_bat();
700
701 isa_io_base = MPC10X_MAPB_ISA_IO_BASE;
702 isa_mem_base = MPC10X_MAPB_ISA_MEM_BASE;
703 pci_dram_offset = MPC10X_MAPB_DRAM_OFFSET;
704 ISA_DMA_THRESHOLD = 0x00ffffff;
705 DMA_MODE_READ = 0x44;
706 DMA_MODE_WRITE = 0x48;
707
708 ppc_md.setup_arch = sandpoint_setup_arch;
709 ppc_md.show_cpuinfo = sandpoint_show_cpuinfo;
710 ppc_md.irq_canonicalize = sandpoint_irq_canonicalize;
711 ppc_md.init_IRQ = sandpoint_init_IRQ;
712 ppc_md.get_irq = openpic_get_irq;
713
714 ppc_md.restart = sandpoint_restart;
715 ppc_md.power_off = sandpoint_power_off;
716 ppc_md.halt = sandpoint_halt;
717
718 ppc_md.find_end_of_memory = sandpoint_find_end_of_memory;
719 ppc_md.setup_io_mappings = sandpoint_map_io;
720
721 TODC_INIT(TODC_TYPE_PC97307, 0x70, 0x00, 0x71, 8);
722 ppc_md.time_init = todc_time_init;
723 ppc_md.set_rtc_time = todc_set_rtc_time;
724 ppc_md.get_rtc_time = todc_get_rtc_time;
725 ppc_md.calibrate_decr = todc_calibrate_decr;
726
727 ppc_md.nvram_read_val = todc_mc146818_read_val;
728 ppc_md.nvram_write_val = todc_mc146818_write_val;
729
730#ifdef CONFIG_KGDB
731 ppc_md.kgdb_map_scc = gen550_kgdb_map_scc;
732#endif
733#ifdef CONFIG_SERIAL_TEXT_DEBUG
734 ppc_md.progress = gen550_progress;
735#endif
736
737#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
738 ppc_ide_md.default_irq = sandpoint_ide_default_irq;
739 ppc_ide_md.default_io_base = sandpoint_ide_default_io_base;
740 ppc_ide_md.ide_init_hwif = sandpoint_ide_init_hwif_ports;
741#endif
742}
diff --git a/arch/ppc/platforms/sandpoint.h b/arch/ppc/platforms/sandpoint.h
new file mode 100644
index 000000000000..f4e982cb69df
--- /dev/null
+++ b/arch/ppc/platforms/sandpoint.h
@@ -0,0 +1,80 @@
1/*
2 * arch/ppc/platforms/sandpoint.h
3 *
4 * Definitions for Motorola SPS Sandpoint Test Platform
5 *
6 * Author: Mark A. Greer
7 * mgreer@mvista.com
8 *
9 * 2000-2003 (c) MontaVista, Software, Inc. This file is licensed under
10 * the terms of the GNU General Public License version 2. This program
11 * is licensed "as is" without any warranty of any kind, whether express
12 * or implied.
13 */
14
15/*
16 * Sandpoint uses the CHRP map (Map B).
17 */
18
19#ifndef __PPC_PLATFORMS_SANDPOINT_H
20#define __PPC_PLATFORMS_SANDPOINT_H
21
22#include <asm/ppcboot.h>
23
24#if 0
25/* The Sandpoint X3 allows the IDE interrupt to be directly connected
26 * from the Windbond (PCI INTC or INTD) to the serial EPIC. Someday
27 * we should try this, but it was easier to use the existing 83c553
28 * initialization than change it to route the different interrupts :-).
29 * -- Dan
30 */
31#define SANDPOINT_IDE_INT0 23 /* EPIC 7 */
32#define SANDPOINT_IDE_INT1 24 /* EPIC 8 */
33#else
34#define SANDPOINT_IDE_INT0 14 /* 8259 Test */
35#define SANDPOINT_IDE_INT1 15 /* 8259 Test */
36#endif
37
38/*
39 * The sandpoint boards have processor modules that either have an 8240 or
40 * an MPC107 host bridge on them. These bridges have an IDSEL line that allows
41 * them to respond to PCI transactions as if they were a normal PCI devices.
42 * However, the processor on the processor side of the bridge can not reach
43 * out onto the PCI bus and then select the bridge or bad things will happen
44 * (documented in the 8240 and 107 manuals).
45 * Because of this, we always skip the bridge PCI device when accessing the
46 * PCI bus. The PCI slot that the bridge occupies is defined by the macro
47 * below.
48 */
49#define SANDPOINT_HOST_BRIDGE_IDSEL 12
50
51/*
52 * Serial defines.
53 */
54#define SANDPOINT_SERIAL_0 0xfe0003f8
55#define SANDPOINT_SERIAL_1 0xfe0002f8
56
57#define RS_TABLE_SIZE 2
58
59/* Rate for the 1.8432 Mhz clock for the onboard serial chip */
60#define BASE_BAUD ( 1843200 / 16 )
61#define UART_CLK 1843200
62
63#ifdef CONFIG_SERIAL_DETECT_IRQ
64#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_AUTO_IRQ)
65#else
66#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF)
67#endif
68
69#define STD_SERIAL_PORT_DFNS \
70 { 0, BASE_BAUD, SANDPOINT_SERIAL_0, 4, STD_COM_FLAGS, /* ttyS0 */ \
71 iomem_base: (u8 *)SANDPOINT_SERIAL_0, \
72 io_type: SERIAL_IO_MEM }, \
73 { 0, BASE_BAUD, SANDPOINT_SERIAL_1, 3, STD_COM_FLAGS, /* ttyS1 */ \
74 iomem_base: (u8 *)SANDPOINT_SERIAL_1, \
75 io_type: SERIAL_IO_MEM },
76
77#define SERIAL_PORT_DFNS \
78 STD_SERIAL_PORT_DFNS
79
80#endif /* __PPC_PLATFORMS_SANDPOINT_H */
diff --git a/arch/ppc/platforms/sbc82xx.c b/arch/ppc/platforms/sbc82xx.c
new file mode 100644
index 000000000000..74c9ff72c3dd
--- /dev/null
+++ b/arch/ppc/platforms/sbc82xx.c
@@ -0,0 +1,259 @@
1/*
2 * arch/ppc/platforms/sbc82xx.c
3 *
4 * SBC82XX platform support
5 *
6 * Author: Guy Streeter <streeter@redhat.com>
7 *
8 * Derived from: est8260_setup.c by Allen Curtis, ONZ
9 *
10 * Copyright 2004 Red Hat, Inc.
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 */
17
18#include <linux/config.h>
19#include <linux/stddef.h>
20#include <linux/interrupt.h>
21#include <linux/irq.h>
22#include <linux/init.h>
23#include <linux/pci.h>
24
25#include <asm/mpc8260.h>
26#include <asm/machdep.h>
27#include <asm/io.h>
28#include <asm/todc.h>
29#include <asm/immap_cpm2.h>
30#include <asm/pci.h>
31
32static void (*callback_init_IRQ)(void);
33
34extern unsigned char __res[sizeof(bd_t)];
35
36extern void (*late_time_init)(void);
37
38#ifdef CONFIG_GEN_RTC
39TODC_ALLOC();
40
41/*
42 * Timer init happens before mem_init but after paging init, so we cannot
43 * directly use ioremap() at that time.
44 * late_time_init() is call after paging init.
45 */
46
47static void sbc82xx_time_init(void)
48{
49 volatile memctl_cpm2_t *mc = &cpm2_immr->im_memctl;
50
51 /* Set up CS11 for RTC chip */
52 mc->memc_br11=0;
53 mc->memc_or11=0xffff0836;
54 mc->memc_br11=SBC82xx_TODC_NVRAM_ADDR | 0x0801;
55
56 TODC_INIT(TODC_TYPE_MK48T59, 0, 0, SBC82xx_TODC_NVRAM_ADDR, 0);
57
58 todc_info->nvram_data =
59 (unsigned int)ioremap(todc_info->nvram_data, 0x2000);
60 BUG_ON(!todc_info->nvram_data);
61 ppc_md.get_rtc_time = todc_get_rtc_time;
62 ppc_md.set_rtc_time = todc_set_rtc_time;
63 ppc_md.nvram_read_val = todc_direct_read_val;
64 ppc_md.nvram_write_val = todc_direct_write_val;
65 todc_time_init();
66}
67#endif /* CONFIG_GEN_RTC */
68
69static volatile char *sbc82xx_i8259_map;
70static char sbc82xx_i8259_mask = 0xff;
71static DEFINE_SPINLOCK(sbc82xx_i8259_lock);
72
73static void sbc82xx_i8259_mask_and_ack_irq(unsigned int irq_nr)
74{
75 unsigned long flags;
76
77 irq_nr -= NR_SIU_INTS;
78
79 spin_lock_irqsave(&sbc82xx_i8259_lock, flags);
80 sbc82xx_i8259_mask |= 1 << irq_nr;
81 (void) sbc82xx_i8259_map[1]; /* Dummy read */
82 sbc82xx_i8259_map[1] = sbc82xx_i8259_mask;
83 sbc82xx_i8259_map[0] = 0x20; /* OCW2: Non-specific EOI */
84 spin_unlock_irqrestore(&sbc82xx_i8259_lock, flags);
85}
86
87static void sbc82xx_i8259_mask_irq(unsigned int irq_nr)
88{
89 unsigned long flags;
90
91 irq_nr -= NR_SIU_INTS;
92
93 spin_lock_irqsave(&sbc82xx_i8259_lock, flags);
94 sbc82xx_i8259_mask |= 1 << irq_nr;
95 sbc82xx_i8259_map[1] = sbc82xx_i8259_mask;
96 spin_unlock_irqrestore(&sbc82xx_i8259_lock, flags);
97}
98
99static void sbc82xx_i8259_unmask_irq(unsigned int irq_nr)
100{
101 unsigned long flags;
102
103 irq_nr -= NR_SIU_INTS;
104
105 spin_lock_irqsave(&sbc82xx_i8259_lock, flags);
106 sbc82xx_i8259_mask &= ~(1 << irq_nr);
107 sbc82xx_i8259_map[1] = sbc82xx_i8259_mask;
108 spin_unlock_irqrestore(&sbc82xx_i8259_lock, flags);
109}
110
111static void sbc82xx_i8259_end_irq(unsigned int irq)
112{
113 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))
114 && irq_desc[irq].action)
115 sbc82xx_i8259_unmask_irq(irq);
116}
117
118
119struct hw_interrupt_type sbc82xx_i8259_ic = {
120 .typename = " i8259 ",
121 .enable = sbc82xx_i8259_unmask_irq,
122 .disable = sbc82xx_i8259_mask_irq,
123 .ack = sbc82xx_i8259_mask_and_ack_irq,
124 .end = sbc82xx_i8259_end_irq,
125};
126
127static irqreturn_t sbc82xx_i8259_demux(int irq, void *dev_id, struct pt_regs *regs)
128{
129 spin_lock(&sbc82xx_i8259_lock);
130
131 sbc82xx_i8259_map[0] = 0x0c; /* OCW3: Read IR register on RD# pulse */
132 irq = sbc82xx_i8259_map[0] & 7; /* Read IRR */
133
134 if (irq == 7) {
135 /* Possible spurious interrupt */
136 int isr;
137 sbc82xx_i8259_map[0] = 0x0b; /* OCW3: Read IS register on RD# pulse */
138 isr = sbc82xx_i8259_map[0]; /* Read ISR */
139
140 if (!(isr & 0x80)) {
141 printk(KERN_INFO "Spurious i8259 interrupt\n");
142 return IRQ_HANDLED;
143 }
144 }
145 __do_IRQ(NR_SIU_INTS + irq, regs);
146 return IRQ_HANDLED;
147}
148
149static struct irqaction sbc82xx_i8259_irqaction = {
150 .handler = sbc82xx_i8259_demux,
151 .flags = SA_INTERRUPT,
152 .mask = CPU_MASK_NONE,
153 .name = "i8259 demux",
154};
155
156void __init sbc82xx_init_IRQ(void)
157{
158 volatile memctl_cpm2_t *mc = &cpm2_immr->im_memctl;
159 volatile intctl_cpm2_t *ic = &cpm2_immr->im_intctl;
160 int i;
161
162 callback_init_IRQ();
163
164 /* u-boot doesn't always set the board up correctly */
165 mc->memc_br5 = 0;
166 mc->memc_or5 = 0xfff00856;
167 mc->memc_br5 = 0x22000801;
168
169 sbc82xx_i8259_map = ioremap(0x22008000, 2);
170 if (!sbc82xx_i8259_map) {
171 printk(KERN_CRIT "Mapping i8259 interrupt controller failed\n");
172 return;
173 }
174
175 /* Set up the interrupt handlers for the i8259 IRQs */
176 for (i = NR_SIU_INTS; i < NR_SIU_INTS + 8; i++) {
177 irq_desc[i].handler = &sbc82xx_i8259_ic;
178 irq_desc[i].status |= IRQ_LEVEL;
179 }
180
181 /* make IRQ6 level sensitive */
182 ic->ic_siexr &= ~(1 << (14 - (SIU_INT_IRQ6 - SIU_INT_IRQ1)));
183 irq_desc[SIU_INT_IRQ6].status |= IRQ_LEVEL;
184
185 /* Initialise the i8259 */
186 sbc82xx_i8259_map[0] = 0x1b; /* ICW1: Level, no cascade, ICW4 */
187 sbc82xx_i8259_map[1] = 0x00; /* ICW2: vector base */
188 /* No ICW3 (no cascade) */
189 sbc82xx_i8259_map[1] = 0x01; /* ICW4: 8086 mode, normal EOI */
190
191 sbc82xx_i8259_map[0] = 0x0b; /* OCW3: Read IS register on RD# pulse */
192
193 sbc82xx_i8259_map[1] = sbc82xx_i8259_mask; /* Set interrupt mask */
194
195 /* Request cascade IRQ */
196 if (setup_irq(SIU_INT_IRQ6, &sbc82xx_i8259_irqaction)) {
197 printk("Installation of i8259 IRQ demultiplexer failed.\n");
198 }
199}
200
201static int sbc82xx_pci_map_irq(struct pci_dev *dev, unsigned char idsel,
202 unsigned char pin)
203{
204 static char pci_irq_table[][4] = {
205 /*
206 * PCI IDSEL/INTPIN->INTLINE
207 * A B C D
208 */
209 { SBC82xx_PIRQA, SBC82xx_PIRQB, SBC82xx_PIRQC, SBC82xx_PIRQD }, /* IDSEL 16 - PMC slot */
210 { SBC82xx_PC_IRQA, SBC82xx_PC_IRQB, -1, -1 }, /* IDSEL 17 - CardBus */
211 { SBC82xx_PIRQA, SBC82xx_PIRQB, SBC82xx_PIRQC, SBC82xx_PIRQD }, /* IDSEL 18 - PCI-X bridge */
212 };
213
214 const long min_idsel = 16, max_idsel = 18, irqs_per_slot = 4;
215
216 return PCI_IRQ_TABLE_LOOKUP;
217}
218
219static void __devinit quirk_sbc8260_cardbus(struct pci_dev *pdev)
220{
221 uint32_t ctrl;
222
223 if (pdev->bus->number != 0 || pdev->devfn != PCI_DEVFN(17, 0))
224 return;
225
226 printk(KERN_INFO "Setting up CardBus controller\n");
227
228 /* Set P2CCLK bit in System Control Register */
229 pci_read_config_dword(pdev, 0x80, &ctrl);
230 ctrl |= (1<<27);
231 pci_write_config_dword(pdev, 0x80, ctrl);
232
233 /* Set MFUNC up for PCI IRQ routing via INTA and INTB, and LEDs. */
234 pci_write_config_dword(pdev, 0x8c, 0x00c01d22);
235
236}
237DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1420, quirk_sbc8260_cardbus);
238
239void __init
240m82xx_board_init(void)
241{
242 /* u-boot may be using one of the FCC Ethernet devices.
243 Use the MAC address to the SCC. */
244 __res[offsetof(bd_t, bi_enetaddr[5])] &= ~3;
245
246 /* Anything special for this platform */
247 callback_init_IRQ = ppc_md.init_IRQ;
248
249 ppc_md.init_IRQ = sbc82xx_init_IRQ;
250 ppc_md.pci_map_irq = sbc82xx_pci_map_irq;
251#ifdef CONFIG_GEN_RTC
252 ppc_md.time_init = NULL;
253 ppc_md.get_rtc_time = NULL;
254 ppc_md.set_rtc_time = NULL;
255 ppc_md.nvram_read_val = NULL;
256 ppc_md.nvram_write_val = NULL;
257 late_time_init = sbc82xx_time_init;
258#endif /* CONFIG_GEN_RTC */
259}
diff --git a/arch/ppc/platforms/sbc82xx.h b/arch/ppc/platforms/sbc82xx.h
new file mode 100644
index 000000000000..e4042d4995f6
--- /dev/null
+++ b/arch/ppc/platforms/sbc82xx.h
@@ -0,0 +1,36 @@
1/* Board information for the SBCPowerQUICCII, which should be generic for
2 * all 8260 boards. The IMMR is now given to us so the hard define
3 * will soon be removed. All of the clock values are computed from
4 * the configuration SCMR and the Power-On-Reset word.
5 */
6
7#ifndef __PPC_SBC82xx_H__
8#define __PPC_SBC82xx_H__
9
10#include <asm/ppcboot.h>
11
12#define CPM_MAP_ADDR 0xf0000000
13
14#define SBC82xx_TODC_NVRAM_ADDR 0xd0000000
15
16#define SBC82xx_MACADDR_NVRAM_FCC1 0x220000c9 /* JP6B */
17#define SBC82xx_MACADDR_NVRAM_SCC1 0x220000cf /* JP6A */
18#define SBC82xx_MACADDR_NVRAM_FCC2 0x220000d5 /* JP7A */
19#define SBC82xx_MACADDR_NVRAM_FCC3 0x220000db /* JP7B */
20
21/* For our show_cpuinfo hooks. */
22#define CPUINFO_VENDOR "Wind River"
23#define CPUINFO_MACHINE "SBC PowerQUICC II"
24
25#define BOOTROM_RESTART_ADDR ((uint)0x40000104)
26
27#define SBC82xx_PC_IRQA (NR_SIU_INTS+0)
28#define SBC82xx_PC_IRQB (NR_SIU_INTS+1)
29#define SBC82xx_MPC185_IRQ (NR_SIU_INTS+2)
30#define SBC82xx_ATM_IRQ (NR_SIU_INTS+3)
31#define SBC82xx_PIRQA (NR_SIU_INTS+4)
32#define SBC82xx_PIRQB (NR_SIU_INTS+5)
33#define SBC82xx_PIRQC (NR_SIU_INTS+6)
34#define SBC82xx_PIRQD (NR_SIU_INTS+7)
35
36#endif /* __PPC_SBC82xx_H__ */
diff --git a/arch/ppc/platforms/sbs8260.h b/arch/ppc/platforms/sbs8260.h
new file mode 100644
index 000000000000..d51427a0f0d4
--- /dev/null
+++ b/arch/ppc/platforms/sbs8260.h
@@ -0,0 +1,28 @@
1#ifndef __ASSEMBLY__
2/* Board information for various SBS 8260 cards, which should be generic for
3 * all 8260 boards. The IMMR is now given to us so the hard define
4 * will soon be removed. All of the clock values are computed from
5 * the configuration SCMR and the Power-On-Reset word.
6 */
7
8#define CPM_MAP_ADDR ((uint)0xfe000000)
9
10
11/* A Board Information structure that is given to a program when
12 * prom starts it up.
13 */
14typedef struct bd_info {
15 unsigned int bi_memstart; /* Memory start address */
16 unsigned int bi_memsize; /* Memory (end) size in bytes */
17 unsigned int bi_intfreq; /* Internal Freq, in Hz */
18 unsigned int bi_busfreq; /* Bus Freq, in MHz */
19 unsigned int bi_cpmfreq; /* CPM Freq, in MHz */
20 unsigned int bi_brgfreq; /* BRG Freq, in MHz */
21 unsigned int bi_vco; /* VCO Out from PLL */
22 unsigned int bi_baudrate; /* Default console baud rate */
23 unsigned int bi_immr; /* IMMR when called from boot rom */
24 unsigned char bi_enetaddr[6];
25} bd_t;
26
27extern bd_t m8xx_board_info;
28#endif /* !__ASSEMBLY__ */
diff --git a/arch/ppc/platforms/spd8xx.h b/arch/ppc/platforms/spd8xx.h
new file mode 100644
index 000000000000..ed48d144f415
--- /dev/null
+++ b/arch/ppc/platforms/spd8xx.h
@@ -0,0 +1,92 @@
1/*
2 * Speech Design SPD8xxTS board specific definitions
3 *
4 * Copyright (c) 2000,2001 Wolfgang Denk (wd@denx.de)
5 */
6
7#ifdef __KERNEL__
8#ifndef __ASM_SPD8XX_H__
9#define __ASM_SPD8XX_H__
10
11#include <linux/config.h>
12
13#include <asm/ppcboot.h>
14
15#ifndef __ASSEMBLY__
16#define SPD_IMMR_BASE 0xFFF00000 /* phys. addr of IMMR */
17#define SPD_IMAP_SIZE (64 * 1024) /* size of mapped area */
18
19#define IMAP_ADDR SPD_IMMR_BASE /* physical base address of IMMR area */
20#define IMAP_SIZE SPD_IMAP_SIZE /* mapped size of IMMR area */
21
22#define PCMCIA_MEM_ADDR ((uint)0xFE100000)
23#define PCMCIA_MEM_SIZE ((uint)(64 * 1024))
24
25#define IDE0_INTERRUPT 10 /* = IRQ5 */
26#define IDE1_INTERRUPT 12 /* = IRQ6 */
27#define CPM_INTERRUPT 13 /* = SIU_LEVEL6 (was: SIU_LEVEL2) */
28
29/* override the default number of IDE hardware interfaces */
30#define MAX_HWIFS 2
31
32/*
33 * Definitions for IDE0 Interface
34 */
35#define IDE0_BASE_OFFSET 0x0000 /* Offset in PCMCIA memory */
36#define IDE0_DATA_REG_OFFSET 0x0000
37#define IDE0_ERROR_REG_OFFSET 0x0081
38#define IDE0_NSECTOR_REG_OFFSET 0x0082
39#define IDE0_SECTOR_REG_OFFSET 0x0083
40#define IDE0_LCYL_REG_OFFSET 0x0084
41#define IDE0_HCYL_REG_OFFSET 0x0085
42#define IDE0_SELECT_REG_OFFSET 0x0086
43#define IDE0_STATUS_REG_OFFSET 0x0087
44#define IDE0_CONTROL_REG_OFFSET 0x0106
45#define IDE0_IRQ_REG_OFFSET 0x000A /* not used */
46
47/*
48 * Definitions for IDE1 Interface
49 */
50#define IDE1_BASE_OFFSET 0x0C00 /* Offset in PCMCIA memory */
51#define IDE1_DATA_REG_OFFSET 0x0000
52#define IDE1_ERROR_REG_OFFSET 0x0081
53#define IDE1_NSECTOR_REG_OFFSET 0x0082
54#define IDE1_SECTOR_REG_OFFSET 0x0083
55#define IDE1_LCYL_REG_OFFSET 0x0084
56#define IDE1_HCYL_REG_OFFSET 0x0085
57#define IDE1_SELECT_REG_OFFSET 0x0086
58#define IDE1_STATUS_REG_OFFSET 0x0087
59#define IDE1_CONTROL_REG_OFFSET 0x0106
60#define IDE1_IRQ_REG_OFFSET 0x000A /* not used */
61
62/* CPM Ethernet through SCCx.
63 *
64 * Bits in parallel I/O port registers that have to be set/cleared
65 * to configure the pins for SCC2 use.
66 */
67#define PA_ENET_MDC ((ushort)0x0001) /* PA 15 !!! */
68#define PA_ENET_MDIO ((ushort)0x0002) /* PA 14 !!! */
69#define PA_ENET_RXD ((ushort)0x0004) /* PA 13 */
70#define PA_ENET_TXD ((ushort)0x0008) /* PA 12 */
71#define PA_ENET_RCLK ((ushort)0x0200) /* PA 6 */
72#define PA_ENET_TCLK ((ushort)0x0400) /* PA 5 */
73
74#define PB_ENET_TENA ((uint)0x00002000) /* PB 18 */
75
76#define PC_ENET_CLSN ((ushort)0x0040) /* PC 9 */
77#define PC_ENET_RENA ((ushort)0x0080) /* PC 8 */
78#define PC_ENET_RESET ((ushort)0x0100) /* PC 7 !!! */
79
80/* Control bits in the SICR to route TCLK (CLK3) and RCLK (CLK2) to
81 * SCC2. Also, make sure GR2 (bit 16) and SC2 (bit 17) are zero.
82 */
83#define SICR_ENET_MASK ((uint)0x0000ff00)
84#define SICR_ENET_CLKRT ((uint)0x00002E00)
85
86/* We don't use the 8259.
87*/
88#define NR_8259_INTS 0
89
90#endif /* !__ASSEMBLY__ */
91#endif /* __ASM_SPD8XX_H__ */
92#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/spruce.c b/arch/ppc/platforms/spruce.c
new file mode 100644
index 000000000000..5ad70d357cb9
--- /dev/null
+++ b/arch/ppc/platforms/spruce.c
@@ -0,0 +1,325 @@
1/*
2 * arch/ppc/platforms/spruce.c
3 *
4 * Board and PCI setup routines for IBM Spruce
5 *
6 * Author: MontaVista Software <source@mvista.com>
7 *
8 * 2000-2004 (c) MontaVista, Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
11 * or implied.
12 */
13
14#include <linux/config.h>
15#include <linux/stddef.h>
16#include <linux/kernel.h>
17#include <linux/init.h>
18#include <linux/errno.h>
19#include <linux/reboot.h>
20#include <linux/pci.h>
21#include <linux/kdev_t.h>
22#include <linux/types.h>
23#include <linux/major.h>
24#include <linux/initrd.h>
25#include <linux/console.h>
26#include <linux/delay.h>
27#include <linux/seq_file.h>
28#include <linux/ide.h>
29#include <linux/root_dev.h>
30#include <linux/serial.h>
31#include <linux/tty.h>
32#include <linux/serial_core.h>
33
34#include <asm/system.h>
35#include <asm/pgtable.h>
36#include <asm/page.h>
37#include <asm/dma.h>
38#include <asm/io.h>
39#include <asm/machdep.h>
40#include <asm/time.h>
41#include <asm/todc.h>
42#include <asm/bootinfo.h>
43#include <asm/kgdb.h>
44
45#include <syslib/cpc700.h>
46
47#include "spruce.h"
48
49static inline int
50spruce_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
51{
52 static char pci_irq_table[][4] =
53 /*
54 * PCI IDSEL/INTPIN->INTLINE
55 * A B C D
56 */
57 {
58 {23, 24, 25, 26}, /* IDSEL 1 - PCI slot 3 */
59 {24, 25, 26, 23}, /* IDSEL 2 - PCI slot 2 */
60 {25, 26, 23, 24}, /* IDSEL 3 - PCI slot 1 */
61 {26, 23, 24, 25}, /* IDSEL 4 - PCI slot 0 */
62 };
63
64 const long min_idsel = 1, max_idsel = 4, irqs_per_slot = 4;
65 return PCI_IRQ_TABLE_LOOKUP;
66}
67
68static void __init
69spruce_setup_hose(void)
70{
71 struct pci_controller *hose;
72
73 /* Setup hose */
74 hose = pcibios_alloc_controller();
75 if (!hose)
76 return;
77
78 hose->first_busno = 0;
79 hose->last_busno = 0xff;
80
81 pci_init_resource(&hose->io_resource,
82 SPRUCE_PCI_LOWER_IO,
83 SPRUCE_PCI_UPPER_IO,
84 IORESOURCE_IO,
85 "PCI host bridge");
86
87 pci_init_resource(&hose->mem_resources[0],
88 SPRUCE_PCI_LOWER_MEM,
89 SPRUCE_PCI_UPPER_MEM,
90 IORESOURCE_MEM,
91 "PCI host bridge");
92
93 hose->io_space.start = SPRUCE_PCI_LOWER_IO;
94 hose->io_space.end = SPRUCE_PCI_UPPER_IO;
95 hose->mem_space.start = SPRUCE_PCI_LOWER_MEM;
96 hose->mem_space.end = SPRUCE_PCI_UPPER_MEM;
97 hose->io_base_virt = (void *)SPRUCE_ISA_IO_BASE;
98
99 setup_indirect_pci(hose,
100 SPRUCE_PCI_CONFIG_ADDR,
101 SPRUCE_PCI_CONFIG_DATA);
102
103 hose->last_busno = pciauto_bus_scan(hose, hose->first_busno);
104
105 ppc_md.pci_swizzle = common_swizzle;
106 ppc_md.pci_map_irq = spruce_map_irq;
107}
108
109/*
110 * CPC700 PIC interrupt programming table
111 *
112 * First entry is the sensitivity (level/edge), second is the polarity.
113 */
114unsigned int cpc700_irq_assigns[32][2] = {
115 { 1, 1 }, /* IRQ 0: ECC Correctable Error - rising edge */
116 { 1, 1 }, /* IRQ 1: PCI Write Mem Range - rising edge */
117 { 0, 1 }, /* IRQ 2: PCI Write Command Reg - active high */
118 { 0, 1 }, /* IRQ 3: UART 0 - active high */
119 { 0, 1 }, /* IRQ 4: UART 1 - active high */
120 { 0, 1 }, /* IRQ 5: ICC 0 - active high */
121 { 0, 1 }, /* IRQ 6: ICC 1 - active high */
122 { 0, 1 }, /* IRQ 7: GPT Compare 0 - active high */
123 { 0, 1 }, /* IRQ 8: GPT Compare 1 - active high */
124 { 0, 1 }, /* IRQ 9: GPT Compare 2 - active high */
125 { 0, 1 }, /* IRQ 10: GPT Compare 3 - active high */
126 { 0, 1 }, /* IRQ 11: GPT Compare 4 - active high */
127 { 0, 1 }, /* IRQ 12: GPT Capture 0 - active high */
128 { 0, 1 }, /* IRQ 13: GPT Capture 1 - active high */
129 { 0, 1 }, /* IRQ 14: GPT Capture 2 - active high */
130 { 0, 1 }, /* IRQ 15: GPT Capture 3 - active high */
131 { 0, 1 }, /* IRQ 16: GPT Capture 4 - active high */
132 { 0, 0 }, /* IRQ 17: Reserved */
133 { 0, 0 }, /* IRQ 18: Reserved */
134 { 0, 0 }, /* IRQ 19: Reserved */
135 { 0, 1 }, /* IRQ 20: FPGA EXT_IRQ0 - active high */
136 { 1, 1 }, /* IRQ 21: Mouse - rising edge */
137 { 1, 1 }, /* IRQ 22: Keyboard - rising edge */
138 { 0, 0 }, /* IRQ 23: PCI Slot 3 - active low */
139 { 0, 0 }, /* IRQ 24: PCI Slot 2 - active low */
140 { 0, 0 }, /* IRQ 25: PCI Slot 1 - active low */
141 { 0, 0 }, /* IRQ 26: PCI Slot 0 - active low */
142};
143
144static void __init
145spruce_calibrate_decr(void)
146{
147 int freq, divisor = 4;
148
149 /* determine processor bus speed */
150 freq = SPRUCE_BUS_SPEED;
151 tb_ticks_per_jiffy = freq / HZ / divisor;
152 tb_to_us = mulhwu_scale_factor(freq/divisor, 1000000);
153}
154
155static int
156spruce_show_cpuinfo(struct seq_file *m)
157{
158 seq_printf(m, "vendor\t\t: IBM\n");
159 seq_printf(m, "machine\t\t: Spruce\n");
160
161 return 0;
162}
163
164static void __init
165spruce_early_serial_map(void)
166{
167 u32 uart_clk;
168 struct uart_port serial_req;
169
170 if (SPRUCE_UARTCLK_IS_33M(readb(SPRUCE_FPGA_REG_A)))
171 uart_clk = SPRUCE_BAUD_33M * 16;
172 else
173 uart_clk = SPRUCE_BAUD_30M * 16;
174
175 /* Setup serial port access */
176 memset(&serial_req, 0, sizeof(serial_req));
177 serial_req.uartclk = uart_clk;
178 serial_req.irq = UART0_INT;
179 serial_req.flags = ASYNC_BOOT_AUTOCONF;
180 serial_req.iotype = SERIAL_IO_MEM;
181 serial_req.membase = (u_char *)UART0_IO_BASE;
182 serial_req.regshift = 0;
183
184#if defined(CONFIG_KGDB) || defined(CONFIG_SERIAL_TEXT_DEBUG)
185 gen550_init(0, &serial_req);
186#endif
187#ifdef CONFIG_SERIAL_8250
188 if (early_serial_setup(&serial_req) != 0)
189 printk("Early serial init of port 0 failed\n");
190#endif
191
192 /* Assume early_serial_setup() doesn't modify serial_req */
193 serial_req.line = 1;
194 serial_req.irq = UART1_INT;
195 serial_req.membase = (u_char *)UART1_IO_BASE;
196
197#if defined(CONFIG_KGDB) || defined(CONFIG_SERIAL_TEXT_DEBUG)
198 gen550_init(1, &serial_req);
199#endif
200#ifdef CONFIG_SERIAL_8250
201 if (early_serial_setup(&serial_req) != 0)
202 printk("Early serial init of port 1 failed\n");
203#endif
204}
205
206TODC_ALLOC();
207
208static void __init
209spruce_setup_arch(void)
210{
211 /* Setup TODC access */
212 TODC_INIT(TODC_TYPE_DS1643, 0, 0, SPRUCE_RTC_BASE_ADDR, 8);
213
214 /* init to some ~sane value until calibrate_delay() runs */
215 loops_per_jiffy = 50000000 / HZ;
216
217 /* Setup PCI host bridge */
218 spruce_setup_hose();
219
220#ifdef CONFIG_BLK_DEV_INITRD
221 if (initrd_start)
222 ROOT_DEV = Root_RAM0;
223 else
224#endif
225#ifdef CONFIG_ROOT_NFS
226 ROOT_DEV = Root_NFS;
227#else
228 ROOT_DEV = Root_SDA1;
229#endif
230
231 /* Identify the system */
232 printk(KERN_INFO "System Identification: IBM Spruce\n");
233 printk(KERN_INFO "Port by MontaVista Software, Inc. (source@mvista.com)\n");
234}
235
236static void
237spruce_restart(char *cmd)
238{
239 local_irq_disable();
240
241 /* SRR0 has system reset vector, SRR1 has default MSR value */
242 /* rfi restores MSR from SRR1 and sets the PC to the SRR0 value */
243 __asm__ __volatile__
244 ("\n\
245 lis 3,0xfff0 \n\
246 ori 3,3,0x0100 \n\
247 mtspr 26,3 \n\
248 li 3,0 \n\
249 mtspr 27,3 \n\
250 rfi \n\
251 ");
252 for(;;);
253}
254
255static void
256spruce_power_off(void)
257{
258 for(;;);
259}
260
261static void
262spruce_halt(void)
263{
264 spruce_restart(NULL);
265}
266
267static void __init
268spruce_map_io(void)
269{
270 io_block_mapping(SPRUCE_PCI_IO_BASE, SPRUCE_PCI_PHY_IO_BASE,
271 0x08000000, _PAGE_IO);
272}
273
274/*
275 * Set BAT 3 to map 0xf8000000 to end of physical memory space 1-to-1.
276 */
277static __inline__ void
278spruce_set_bat(void)
279{
280 mb();
281 mtspr(SPRN_DBAT1U, 0xf8000ffe);
282 mtspr(SPRN_DBAT1L, 0xf800002a);
283 mb();
284}
285
286void __init
287platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
288 unsigned long r6, unsigned long r7)
289{
290 parse_bootinfo(find_bootinfo());
291
292 /* Map in board regs, etc. */
293 spruce_set_bat();
294
295 isa_io_base = SPRUCE_ISA_IO_BASE;
296 pci_dram_offset = SPRUCE_PCI_SYS_MEM_BASE;
297
298 ppc_md.setup_arch = spruce_setup_arch;
299 ppc_md.show_cpuinfo = spruce_show_cpuinfo;
300 ppc_md.init_IRQ = cpc700_init_IRQ;
301 ppc_md.get_irq = cpc700_get_irq;
302
303 ppc_md.setup_io_mappings = spruce_map_io;
304
305 ppc_md.restart = spruce_restart;
306 ppc_md.power_off = spruce_power_off;
307 ppc_md.halt = spruce_halt;
308
309 ppc_md.time_init = todc_time_init;
310 ppc_md.set_rtc_time = todc_set_rtc_time;
311 ppc_md.get_rtc_time = todc_get_rtc_time;
312 ppc_md.calibrate_decr = spruce_calibrate_decr;
313
314 ppc_md.nvram_read_val = todc_direct_read_val;
315 ppc_md.nvram_write_val = todc_direct_write_val;
316
317 spruce_early_serial_map();
318
319#ifdef CONFIG_SERIAL_TEXT_DEBUG
320 ppc_md.progress = gen550_progress;
321#endif /* CONFIG_SERIAL_TEXT_DEBUG */
322#ifdef CONFIG_KGDB
323 ppc_md.kgdb_map_scc = gen550_kgdb_map_scc;
324#endif
325}
diff --git a/arch/ppc/platforms/spruce.h b/arch/ppc/platforms/spruce.h
new file mode 100644
index 000000000000..a31ff7ee698f
--- /dev/null
+++ b/arch/ppc/platforms/spruce.h
@@ -0,0 +1,71 @@
1/*
2 * include/asm-ppc/platforms/spruce.h
3 *
4 * Definitions for IBM Spruce reference board support
5 *
6 * Authors: Matt Porter and Johnnie Peters
7 * mporter@mvista.com
8 * jpeters@mvista.com
9 *
10 * 2001 (c) MontaVista, Software, Inc. This file is licensed under
11 * the terms of the GNU General Public License version 2. This program
12 * is licensed "as is" without any warranty of any kind, whether express
13 * or implied.
14 */
15
16#ifdef __KERNEL__
17#ifndef __ASM_SPRUCE_H__
18#define __ASM_SPRUCE_H__
19
20#define SPRUCE_PCI_CONFIG_ADDR 0xfec00000
21#define SPRUCE_PCI_CONFIG_DATA 0xfec00004
22
23#define SPRUCE_PCI_PHY_IO_BASE 0xf8000000
24#define SPRUCE_PCI_IO_BASE SPRUCE_PCI_PHY_IO_BASE
25
26#define SPRUCE_PCI_SYS_MEM_BASE 0x00000000
27
28#define SPRUCE_PCI_LOWER_MEM 0x80000000
29#define SPRUCE_PCI_UPPER_MEM 0x9fffffff
30#define SPRUCE_PCI_LOWER_IO 0x00000000
31#define SPRUCE_PCI_UPPER_IO 0x03ffffff
32
33#define SPRUCE_ISA_IO_BASE SPRUCE_PCI_IO_BASE
34
35#define SPRUCE_MEM_SIZE 0x04000000
36#define SPRUCE_BUS_SPEED 66666667
37
38#define SPRUCE_NVRAM_BASE_ADDR 0xff800000
39#define SPRUCE_RTC_BASE_ADDR SPRUCE_NVRAM_BASE_ADDR
40
41/*
42 * Serial port defines
43 */
44#define SPRUCE_FPGA_REG_A 0xff820000
45#define SPRUCE_UARTCLK_33M 0x02
46#define SPRUCE_UARTCLK_IS_33M(reg) (reg & SPRUCE_UARTCLK_33M)
47
48#define UART0_IO_BASE 0xff600300
49#define UART1_IO_BASE 0xff600400
50
51#define RS_TABLE_SIZE 2
52
53#define SPRUCE_BAUD_33M (33000000/64)
54#define SPRUCE_BAUD_30M (30000000/64)
55#define BASE_BAUD SPRUCE_BAUD_33M
56
57#define UART0_INT 3
58#define UART1_INT 4
59
60#define STD_UART_OP(num) \
61 { 0, BASE_BAUD, 0, UART##num##_INT, \
62 ASYNC_BOOT_AUTOCONF, \
63 iomem_base: (unsigned char *) UART##num##_IO_BASE, \
64 io_type: SERIAL_IO_MEM},
65
66#define SERIAL_PORT_DFNS \
67 STD_UART_OP(0) \
68 STD_UART_OP(1)
69
70#endif /* __ASM_SPRUCE_H__ */
71#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/tqm8260.h b/arch/ppc/platforms/tqm8260.h
new file mode 100644
index 000000000000..c7a78a646c66
--- /dev/null
+++ b/arch/ppc/platforms/tqm8260.h
@@ -0,0 +1,23 @@
1/*
2 * TQM8260 board specific definitions
3 *
4 * Copyright (c) 2001 Wolfgang Denk (wd@denx.de)
5 */
6
7#ifndef __TQM8260_PLATFORM
8#define __TQM8260_PLATFORM
9
10#include <linux/config.h>
11
12#include <asm/ppcboot.h>
13
14#define CPM_MAP_ADDR ((uint)0xFFF00000)
15#define PHY_INTERRUPT 25
16
17/* For our show_cpuinfo hooks. */
18#define CPUINFO_VENDOR "IN2 Systems"
19#define CPUINFO_MACHINE "TQM8260 PowerPC"
20
21#define BOOTROM_RESTART_ADDR ((uint)0x40000104)
22
23#endif /* __TQM8260_PLATFORM */
diff --git a/arch/ppc/platforms/tqm8260_setup.c b/arch/ppc/platforms/tqm8260_setup.c
new file mode 100644
index 000000000000..a8880bfc034b
--- /dev/null
+++ b/arch/ppc/platforms/tqm8260_setup.c
@@ -0,0 +1,44 @@
1/*
2 * arch/ppc/platforms/tqm8260_setup.c
3 *
4 * TQM8260 platform support
5 *
6 * Author: Allen Curtis <acurtis@onz.com>
7 * Derived from: m8260_setup.c by Dan Malek, MVista
8 *
9 * Copyright 2002 Ones and Zeros, Inc.
10 *
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
15 */
16
17#include <linux/init.h>
18
19#include <asm/immap_cpm2.h>
20#include <asm/mpc8260.h>
21#include <asm/machdep.h>
22
23static int
24tqm8260_set_rtc_time(unsigned long time)
25{
26 ((cpm2_map_t *)CPM_MAP_ADDR)->im_sit.sit_tmcnt = time;
27 ((cpm2_map_t *)CPM_MAP_ADDR)->im_sit.sit_tmcntsc = 0x3;
28
29 return(0);
30}
31
32static unsigned long
33tqm8260_get_rtc_time(void)
34{
35 return ((cpm2_map_t *)CPM_MAP_ADDR)->im_sit.sit_tmcnt;
36}
37
38void __init
39m82xx_board_init(void)
40{
41 /* Anything special for this platform */
42 ppc_md.set_rtc_time = tqm8260_set_rtc_time;
43 ppc_md.get_rtc_time = tqm8260_get_rtc_time;
44}
diff --git a/arch/ppc/platforms/tqm8xx.h b/arch/ppc/platforms/tqm8xx.h
new file mode 100644
index 000000000000..2150dc87b18f
--- /dev/null
+++ b/arch/ppc/platforms/tqm8xx.h
@@ -0,0 +1,179 @@
1/*
2 * TQM8xx(L) board specific definitions
3 *
4 * Copyright (c) 1999-2002 Wolfgang Denk (wd@denx.de)
5 */
6
7#ifdef __KERNEL__
8#ifndef __MACH_TQM8xx_H
9#define __MACH_TQM8xx_H
10
11#include <linux/config.h>
12
13#include <asm/ppcboot.h>
14
15#ifndef __ASSEMBLY__
16#define TQM_IMMR_BASE 0xFFF00000 /* phys. addr of IMMR */
17#define TQM_IMAP_SIZE (64 * 1024) /* size of mapped area */
18
19#define IMAP_ADDR TQM_IMMR_BASE /* physical base address of IMMR area */
20#define IMAP_SIZE TQM_IMAP_SIZE /* mapped size of IMMR area */
21
22/*-----------------------------------------------------------------------
23 * PCMCIA stuff
24 *-----------------------------------------------------------------------
25 *
26 */
27#define PCMCIA_MEM_SIZE ( 64 << 20 )
28
29#ifndef CONFIG_KUP4K
30# define MAX_HWIFS 1 /* overwrite default in include/asm-ppc/ide.h */
31
32#else /* CONFIG_KUP4K */
33
34# define MAX_HWIFS 2 /* overwrite default in include/asm-ppc/ide.h */
35# ifndef __ASSEMBLY__
36# include <asm/8xx_immap.h>
37static __inline__ void ide_led(int on)
38{
39 volatile immap_t *immap = (immap_t *)IMAP_ADDR;
40
41 if (on) {
42 immap->im_ioport.iop_padat &= ~0x80;
43 } else {
44 immap->im_ioport.iop_padat |= 0x80;
45 }
46}
47# endif /* __ASSEMBLY__ */
48# define IDE_LED(x) ide_led((x))
49#endif /* CONFIG_KUP4K */
50
51/*
52 * Definitions for IDE0 Interface
53 */
54#define IDE0_BASE_OFFSET 0
55#define IDE0_DATA_REG_OFFSET (PCMCIA_MEM_SIZE + 0x320)
56#define IDE0_ERROR_REG_OFFSET (2 * PCMCIA_MEM_SIZE + 0x320 + 1)
57#define IDE0_NSECTOR_REG_OFFSET (2 * PCMCIA_MEM_SIZE + 0x320 + 2)
58#define IDE0_SECTOR_REG_OFFSET (2 * PCMCIA_MEM_SIZE + 0x320 + 3)
59#define IDE0_LCYL_REG_OFFSET (2 * PCMCIA_MEM_SIZE + 0x320 + 4)
60#define IDE0_HCYL_REG_OFFSET (2 * PCMCIA_MEM_SIZE + 0x320 + 5)
61#define IDE0_SELECT_REG_OFFSET (2 * PCMCIA_MEM_SIZE + 0x320 + 6)
62#define IDE0_STATUS_REG_OFFSET (2 * PCMCIA_MEM_SIZE + 0x320 + 7)
63#define IDE0_CONTROL_REG_OFFSET 0x0106
64#define IDE0_IRQ_REG_OFFSET 0x000A /* not used */
65
66/* define IO_BASE for PCMCIA */
67#define _IO_BASE 0x80000000
68#define _IO_BASE_SIZE (64<<10)
69
70#define FEC_INTERRUPT 9 /* = SIU_LEVEL4 */
71#define PHY_INTERRUPT 12 /* = IRQ6 */
72#define IDE0_INTERRUPT 13
73
74#ifdef CONFIG_IDE
75#endif
76
77/*-----------------------------------------------------------------------
78 * CPM Ethernet through SCCx.
79 *-----------------------------------------------------------------------
80 *
81 */
82
83/*** TQM823L, TQM850L ***********************************************/
84
85#if defined(CONFIG_TQM823L) || defined(CONFIG_TQM850L)
86/* Bits in parallel I/O port registers that have to be set/cleared
87 * to configure the pins for SCC1 use.
88 */
89#define PA_ENET_RXD ((ushort)0x0004) /* PA 13 */
90#define PA_ENET_TXD ((ushort)0x0008) /* PA 12 */
91#define PA_ENET_RCLK ((ushort)0x0100) /* PA 7 */
92#define PA_ENET_TCLK ((ushort)0x0400) /* PA 5 */
93
94#define PB_ENET_TENA ((uint)0x00002000) /* PB 18 */
95
96#define PC_ENET_CLSN ((ushort)0x0040) /* PC 9 */
97#define PC_ENET_RENA ((ushort)0x0080) /* PC 8 */
98
99/* Control bits in the SICR to route TCLK (CLK3) and RCLK (CLK1) to
100 * SCC2. Also, make sure GR2 (bit 16) and SC2 (bit 17) are zero.
101 */
102#define SICR_ENET_MASK ((uint)0x0000ff00)
103#define SICR_ENET_CLKRT ((uint)0x00002600)
104#endif /* CONFIG_TQM823L, CONFIG_TQM850L */
105
106/*** TQM860L ********************************************************/
107
108#ifdef CONFIG_TQM860L
109/* Bits in parallel I/O port registers that have to be set/cleared
110 * to configure the pins for SCC1 use.
111 */
112#define PA_ENET_RXD ((ushort)0x0001) /* PA 15 */
113#define PA_ENET_TXD ((ushort)0x0002) /* PA 14 */
114#define PA_ENET_RCLK ((ushort)0x0100) /* PA 7 */
115#define PA_ENET_TCLK ((ushort)0x0400) /* PA 5 */
116
117#define PC_ENET_TENA ((ushort)0x0001) /* PC 15 */
118#define PC_ENET_CLSN ((ushort)0x0010) /* PC 11 */
119#define PC_ENET_RENA ((ushort)0x0020) /* PC 10 */
120
121/* Control bits in the SICR to route TCLK (CLK3) and RCLK (CLK1) to
122 * SCC1. Also, make sure GR1 (bit 24) and SC1 (bit 25) are zero.
123 */
124#define SICR_ENET_MASK ((uint)0x000000ff)
125#define SICR_ENET_CLKRT ((uint)0x00000026)
126#endif /* CONFIG_TQM860L */
127
128/*** FPS850L *********************************************************/
129
130#ifdef CONFIG_FPS850L
131/* Bits in parallel I/O port registers that have to be set/cleared
132 * to configure the pins for SCC1 use.
133 */
134#define PA_ENET_RXD ((ushort)0x0004) /* PA 13 */
135#define PA_ENET_TXD ((ushort)0x0008) /* PA 12 */
136#define PA_ENET_RCLK ((ushort)0x0100) /* PA 7 */
137#define PA_ENET_TCLK ((ushort)0x0400) /* PA 5 */
138
139#define PC_ENET_TENA ((ushort)0x0002) /* PC 14 */
140#define PC_ENET_CLSN ((ushort)0x0040) /* PC 9 */
141#define PC_ENET_RENA ((ushort)0x0080) /* PC 8 */
142
143/* Control bits in the SICR to route TCLK (CLK2) and RCLK (CLK4) to
144 * SCC2. Also, make sure GR2 (bit 16) and SC2 (bit 17) are zero.
145 */
146#define SICR_ENET_MASK ((uint)0x0000ff00)
147#define SICR_ENET_CLKRT ((uint)0x00002600)
148#endif /* CONFIG_FPS850L */
149
150/*** SM850 *********************************************************/
151
152/* The SM850 Service Module uses SCC2 for IrDA and SCC3 for Ethernet */
153
154#ifdef CONFIG_SM850
155#define PB_ENET_RXD ((uint)0x00000004) /* PB 29 */
156#define PB_ENET_TXD ((uint)0x00000002) /* PB 30 */
157#define PA_ENET_RCLK ((ushort)0x0100) /* PA 7 */
158#define PA_ENET_TCLK ((ushort)0x0400) /* PA 5 */
159
160#define PC_ENET_LBK ((ushort)0x0008) /* PC 12 */
161#define PC_ENET_TENA ((ushort)0x0004) /* PC 13 */
162
163#define PC_ENET_RENA ((ushort)0x0800) /* PC 4 */
164#define PC_ENET_CLSN ((ushort)0x0400) /* PC 5 */
165
166/* Control bits in the SICR to route TCLK (CLK3) and RCLK (CLK1) to
167 * SCC3. Also, make sure GR3 (bit 8) and SC3 (bit 9) are zero.
168 */
169#define SICR_ENET_MASK ((uint)0x00FF0000)
170#define SICR_ENET_CLKRT ((uint)0x00260000)
171#endif /* CONFIG_SM850 */
172
173/* We don't use the 8259.
174*/
175#define NR_8259_INTS 0
176
177#endif /* !__ASSEMBLY__ */
178#endif /* __MACH_TQM8xx_H */
179#endif /* __KERNEL__ */
diff --git a/arch/ppc/syslib/Makefile b/arch/ppc/syslib/Makefile
new file mode 100644
index 000000000000..dd418ea3426c
--- /dev/null
+++ b/arch/ppc/syslib/Makefile
@@ -0,0 +1,115 @@
1#
2# Makefile for the linux kernel.
3#
4
5CFLAGS_prom_init.o += -fPIC
6CFLAGS_btext.o += -fPIC
7
8wdt-mpc8xx-$(CONFIG_8xx_WDT) += m8xx_wdt.o
9
10obj-$(CONFIG_PPCBUG_NVRAM) += prep_nvram.o
11obj-$(CONFIG_PPC_OCP) += ocp.o
12obj-$(CONFIG_IBM_OCP) += ibm_ocp.o
13obj-$(CONFIG_44x) += ibm44x_common.o
14obj-$(CONFIG_440GP) += ibm440gp_common.o
15obj-$(CONFIG_440GX) += ibm440gx_common.o
16obj-$(CONFIG_440SP) += ibm440gx_common.o ibm440sp_common.o
17ifeq ($(CONFIG_4xx),y)
18ifeq ($(CONFIG_VIRTEX_II_PRO),y)
19obj-$(CONFIG_40x) += xilinx_pic.o
20else
21ifeq ($(CONFIG_403),y)
22obj-$(CONFIG_40x) += ppc403_pic.o
23else
24obj-$(CONFIG_40x) += ppc4xx_pic.o
25endif
26endif
27obj-$(CONFIG_44x) += ppc4xx_pic.o
28obj-$(CONFIG_40x) += ppc4xx_setup.o
29obj-$(CONFIG_GEN_RTC) += todc_time.o
30obj-$(CONFIG_PPC4xx_DMA) += ppc4xx_dma.o
31obj-$(CONFIG_PPC4xx_EDMA) += ppc4xx_sgdma.o
32ifeq ($(CONFIG_40x),y)
33obj-$(CONFIG_PCI) += indirect_pci.o pci_auto.o ppc405_pci.o
34endif
35endif
36obj-$(CONFIG_8xx) += m8xx_setup.o ppc8xx_pic.o $(wdt-mpc8xx-y)
37ifeq ($(CONFIG_8xx),y)
38obj-$(CONFIG_PCI) += qspan_pci.o i8259.o
39endif
40obj-$(CONFIG_PPC_OF) += prom_init.o prom.o of_device.o
41obj-$(CONFIG_PPC_PMAC) += open_pic.o indirect_pci.o
42obj-$(CONFIG_POWER4) += open_pic2.o
43obj-$(CONFIG_PPC_CHRP) += open_pic.o indirect_pci.o i8259.o
44obj-$(CONFIG_PPC_PREP) += open_pic.o indirect_pci.o i8259.o todc_time.o
45obj-$(CONFIG_ADIR) += i8259.o indirect_pci.o pci_auto.o \
46 todc_time.o
47obj-$(CONFIG_CPCI690) += todc_time.o pci_auto.o
48obj-$(CONFIG_EBONY) += indirect_pci.o pci_auto.o todc_time.o
49obj-$(CONFIG_EV64260) += todc_time.o pci_auto.o
50obj-$(CONFIG_CHESTNUT) += mv64360_pic.o pci_auto.o
51obj-$(CONFIG_GEMINI) += open_pic.o indirect_pci.o
52obj-$(CONFIG_GT64260) += gt64260_pic.o
53obj-$(CONFIG_K2) += i8259.o indirect_pci.o todc_time.o \
54 pci_auto.o
55obj-$(CONFIG_LOPEC) += i8259.o pci_auto.o todc_time.o
56obj-$(CONFIG_HDPU) += pci_auto.o
57obj-$(CONFIG_LUAN) += indirect_pci.o pci_auto.o todc_time.o
58obj-$(CONFIG_KATANA) += pci_auto.o
59obj-$(CONFIG_MCPN765) += todc_time.o indirect_pci.o pci_auto.o \
60 open_pic.o i8259.o hawk_common.o
61obj-$(CONFIG_MENF1) += todc_time.o i8259.o mpc10x_common.o \
62 pci_auto.o indirect_pci.o
63obj-$(CONFIG_MV64360) += mv64360_pic.o
64obj-$(CONFIG_MV64X60) += mv64x60.o mv64x60_win.o indirect_pci.o
65obj-$(CONFIG_MVME5100) += open_pic.o todc_time.o indirect_pci.o \
66 pci_auto.o hawk_common.o
67obj-$(CONFIG_MVME5100_IPMC761_PRESENT) += i8259.o
68obj-$(CONFIG_OCOTEA) += indirect_pci.o pci_auto.o todc_time.o
69obj-$(CONFIG_PAL4) += cpc700_pic.o
70obj-$(CONFIG_PCORE) += todc_time.o i8259.o pci_auto.o
71obj-$(CONFIG_POWERPMC250) += pci_auto.o
72obj-$(CONFIG_PPLUS) += hawk_common.o open_pic.o i8259.o \
73 indirect_pci.o todc_time.o pci_auto.o
74obj-$(CONFIG_PRPMC750) += open_pic.o indirect_pci.o pci_auto.o \
75 hawk_common.o
76obj-$(CONFIG_HARRIER) += harrier.o
77obj-$(CONFIG_PRPMC800) += open_pic.o indirect_pci.o pci_auto.o
78obj-$(CONFIG_RADSTONE_PPC7D) += i8259.o pci_auto.o
79obj-$(CONFIG_SANDPOINT) += i8259.o pci_auto.o todc_time.o
80obj-$(CONFIG_SBC82xx) += todc_time.o
81obj-$(CONFIG_SPRUCE) += cpc700_pic.o indirect_pci.o pci_auto.o \
82 todc_time.o
83obj-$(CONFIG_8260) += m8260_setup.o
84obj-$(CONFIG_PCI_8260) += m8260_pci.o indirect_pci.o
85obj-$(CONFIG_8260_PCI9) += m8260_pci_erratum9.o
86obj-$(CONFIG_CPM2) += cpm2_common.o cpm2_pic.o
87ifeq ($(CONFIG_PPC_GEN550),y)
88obj-$(CONFIG_KGDB) += gen550_kgdb.o gen550_dbg.o
89obj-$(CONFIG_SERIAL_TEXT_DEBUG) += gen550_dbg.o
90endif
91ifeq ($(CONFIG_SERIAL_MPSC_CONSOLE),y)
92obj-$(CONFIG_SERIAL_TEXT_DEBUG) += mv64x60_dbg.o
93endif
94obj-$(CONFIG_BOOTX_TEXT) += btext.o
95obj-$(CONFIG_MPC10X_BRIDGE) += mpc10x_common.o indirect_pci.o
96obj-$(CONFIG_MPC10X_OPENPIC) += open_pic.o
97obj-$(CONFIG_40x) += dcr.o
98obj-$(CONFIG_BOOKE) += dcr.o
99obj-$(CONFIG_85xx) += open_pic.o ppc85xx_common.o ppc85xx_setup.o \
100 ppc_sys.o mpc85xx_sys.o \
101 mpc85xx_devices.o
102ifeq ($(CONFIG_85xx),y)
103obj-$(CONFIG_PCI) += indirect_pci.o pci_auto.o
104endif
105obj-$(CONFIG_83xx) += ipic.o ppc83xx_setup.o ppc_sys.o \
106 mpc83xx_sys.o mpc83xx_devices.o
107ifeq ($(CONFIG_83xx),y)
108obj-$(CONFIG_PCI) += indirect_pci.o pci_auto.o
109endif
110obj-$(CONFIG_MPC8555_CDS) += todc_time.o
111obj-$(CONFIG_PPC_MPC52xx) += mpc52xx_setup.o mpc52xx_pic.o \
112 mpc52xx_sys.o mpc52xx_devices.o ppc_sys.o
113ifeq ($(CONFIG_PPC_MPC52xx),y)
114obj-$(CONFIG_PCI) += mpc52xx_pci.o
115endif
diff --git a/arch/ppc/syslib/btext.c b/arch/ppc/syslib/btext.c
new file mode 100644
index 000000000000..7734f6836174
--- /dev/null
+++ b/arch/ppc/syslib/btext.c
@@ -0,0 +1,861 @@
1/*
2 * Procedures for drawing on the screen early on in the boot process.
3 *
4 * Benjamin Herrenschmidt <benh@kernel.crashing.org>
5 */
6#include <linux/config.h>
7#include <linux/kernel.h>
8#include <linux/string.h>
9#include <linux/init.h>
10#include <linux/version.h>
11
12#include <asm/sections.h>
13#include <asm/bootx.h>
14#include <asm/btext.h>
15#include <asm/prom.h>
16#include <asm/page.h>
17#include <asm/mmu.h>
18#include <asm/pgtable.h>
19#include <asm/io.h>
20#include <asm/reg.h>
21
22#define NO_SCROLL
23
24#ifndef NO_SCROLL
25static void scrollscreen(void);
26#endif
27
28static void draw_byte(unsigned char c, long locX, long locY);
29static void draw_byte_32(unsigned char *bits, unsigned long *base, int rb);
30static void draw_byte_16(unsigned char *bits, unsigned long *base, int rb);
31static void draw_byte_8(unsigned char *bits, unsigned long *base, int rb);
32
33static int g_loc_X;
34static int g_loc_Y;
35static int g_max_loc_X;
36static int g_max_loc_Y;
37
38unsigned long disp_BAT[2] __initdata = {0, 0};
39
40#define cmapsz (16*256)
41
42static unsigned char vga_font[cmapsz];
43
44int boot_text_mapped;
45int force_printk_to_btext = 0;
46
47boot_infos_t disp_bi;
48
49extern char *klimit;
50
51/*
52 * Powermac can use btext_* after boot for xmon,
53 * chrp only uses it during early boot.
54 */
55#ifdef CONFIG_XMON
56#define BTEXT __pmac
57#define BTDATA __pmacdata
58#else
59#define BTEXT __init
60#define BTDATA __initdata
61#endif /* CONFIG_XMON */
62
63/*
64 * This is called only when we are booted via BootX.
65 */
66void __init
67btext_init(boot_infos_t *bi)
68{
69 g_loc_X = 0;
70 g_loc_Y = 0;
71 g_max_loc_X = (bi->dispDeviceRect[2] - bi->dispDeviceRect[0]) / 8;
72 g_max_loc_Y = (bi->dispDeviceRect[3] - bi->dispDeviceRect[1]) / 16;
73 disp_bi = *bi;
74 boot_text_mapped = 1;
75}
76
77void __init
78btext_welcome(void)
79{
80 unsigned long flags;
81 unsigned long pvr;
82 boot_infos_t* bi = &disp_bi;
83
84 btext_drawstring("Welcome to Linux, kernel " UTS_RELEASE "\n");
85 btext_drawstring("\nlinked at : 0x");
86 btext_drawhex(KERNELBASE);
87 btext_drawstring("\nframe buffer at : 0x");
88 btext_drawhex((unsigned long)bi->dispDeviceBase);
89 btext_drawstring(" (phys), 0x");
90 btext_drawhex((unsigned long)bi->logicalDisplayBase);
91 btext_drawstring(" (log)");
92 btext_drawstring("\nklimit : 0x");
93 btext_drawhex((unsigned long)klimit);
94 btext_drawstring("\nMSR : 0x");
95 __asm__ __volatile__ ("mfmsr %0" : "=r" (flags));
96 btext_drawhex(flags);
97 __asm__ __volatile__ ("mfspr %0, 287" : "=r" (pvr));
98 pvr >>= 16;
99 if (pvr > 1) {
100 btext_drawstring("\nHID0 : 0x");
101 __asm__ __volatile__ ("mfspr %0, 1008" : "=r" (flags));
102 btext_drawhex(flags);
103 }
104 if (pvr == 8 || pvr == 12 || pvr == 0x800c) {
105 btext_drawstring("\nICTC : 0x");
106 __asm__ __volatile__ ("mfspr %0, 1019" : "=r" (flags));
107 btext_drawhex(flags);
108 }
109 btext_drawstring("\n\n");
110}
111
112/* Calc BAT values for mapping the display and store them
113 * in disp_BAT. Those values are then used from head.S to map
114 * the display during identify_machine() and MMU_Init()
115 *
116 * The display is mapped to virtual address 0xD0000000, rather
117 * than 1:1, because some some CHRP machines put the frame buffer
118 * in the region starting at 0xC0000000 (KERNELBASE).
119 * This mapping is temporary and will disappear as soon as the
120 * setup done by MMU_Init() is applied.
121 *
122 * For now, we align the BAT and then map 8Mb on 601 and 16Mb
123 * on other PPCs. This may cause trouble if the framebuffer
124 * is really badly aligned, but I didn't encounter this case
125 * yet.
126 */
127void __init
128btext_prepare_BAT(void)
129{
130 boot_infos_t* bi = &disp_bi;
131 unsigned long vaddr = KERNELBASE + 0x10000000;
132 unsigned long addr;
133 unsigned long lowbits;
134
135 addr = (unsigned long)bi->dispDeviceBase;
136 if (!addr) {
137 boot_text_mapped = 0;
138 return;
139 }
140 if (PVR_VER(mfspr(SPRN_PVR)) != 1) {
141 /* 603, 604, G3, G4, ... */
142 lowbits = addr & ~0xFF000000UL;
143 addr &= 0xFF000000UL;
144 disp_BAT[0] = vaddr | (BL_16M<<2) | 2;
145 disp_BAT[1] = addr | (_PAGE_NO_CACHE | _PAGE_GUARDED | BPP_RW);
146 } else {
147 /* 601 */
148 lowbits = addr & ~0xFF800000UL;
149 addr &= 0xFF800000UL;
150 disp_BAT[0] = vaddr | (_PAGE_NO_CACHE | PP_RWXX) | 4;
151 disp_BAT[1] = addr | BL_8M | 0x40;
152 }
153 bi->logicalDisplayBase = (void *) (vaddr + lowbits);
154}
155
156/* This function will enable the early boot text when doing OF booting. This
157 * way, xmon output should work too
158 */
159void __init
160btext_setup_display(int width, int height, int depth, int pitch,
161 unsigned long address)
162{
163 boot_infos_t* bi = &disp_bi;
164
165 g_loc_X = 0;
166 g_loc_Y = 0;
167 g_max_loc_X = width / 8;
168 g_max_loc_Y = height / 16;
169 bi->logicalDisplayBase = (unsigned char *)address;
170 bi->dispDeviceBase = (unsigned char *)address;
171 bi->dispDeviceRowBytes = pitch;
172 bi->dispDeviceDepth = depth;
173 bi->dispDeviceRect[0] = bi->dispDeviceRect[1] = 0;
174 bi->dispDeviceRect[2] = width;
175 bi->dispDeviceRect[3] = height;
176 boot_text_mapped = 1;
177}
178
179/* Here's a small text engine to use during early boot
180 * or for debugging purposes
181 *
182 * todo:
183 *
184 * - build some kind of vgacon with it to enable early printk
185 * - move to a separate file
186 * - add a few video driver hooks to keep in sync with display
187 * changes.
188 */
189
190void __openfirmware
191map_boot_text(void)
192{
193 unsigned long base, offset, size;
194 boot_infos_t *bi = &disp_bi;
195 unsigned char *vbase;
196
197 /* By default, we are no longer mapped */
198 boot_text_mapped = 0;
199 if (bi->dispDeviceBase == 0)
200 return;
201 base = ((unsigned long) bi->dispDeviceBase) & 0xFFFFF000UL;
202 offset = ((unsigned long) bi->dispDeviceBase) - base;
203 size = bi->dispDeviceRowBytes * bi->dispDeviceRect[3] + offset
204 + bi->dispDeviceRect[0];
205 vbase = ioremap(base, size);
206 if (vbase == 0)
207 return;
208 bi->logicalDisplayBase = vbase + offset;
209 boot_text_mapped = 1;
210}
211
212/* Calc the base address of a given point (x,y) */
213static unsigned char * BTEXT
214calc_base(boot_infos_t *bi, int x, int y)
215{
216 unsigned char *base;
217
218 base = bi->logicalDisplayBase;
219 if (base == 0)
220 base = bi->dispDeviceBase;
221 base += (x + bi->dispDeviceRect[0]) * (bi->dispDeviceDepth >> 3);
222 base += (y + bi->dispDeviceRect[1]) * bi->dispDeviceRowBytes;
223 return base;
224}
225
226/* Adjust the display to a new resolution */
227void
228btext_update_display(unsigned long phys, int width, int height,
229 int depth, int pitch)
230{
231 boot_infos_t *bi = &disp_bi;
232
233 if (bi->dispDeviceBase == 0)
234 return;
235
236 /* check it's the same frame buffer (within 256MB) */
237 if ((phys ^ (unsigned long)bi->dispDeviceBase) & 0xf0000000)
238 return;
239
240 bi->dispDeviceBase = (__u8 *) phys;
241 bi->dispDeviceRect[0] = 0;
242 bi->dispDeviceRect[1] = 0;
243 bi->dispDeviceRect[2] = width;
244 bi->dispDeviceRect[3] = height;
245 bi->dispDeviceDepth = depth;
246 bi->dispDeviceRowBytes = pitch;
247 if (boot_text_mapped) {
248 iounmap(bi->logicalDisplayBase);
249 boot_text_mapped = 0;
250 }
251 map_boot_text();
252 g_loc_X = 0;
253 g_loc_Y = 0;
254 g_max_loc_X = width / 8;
255 g_max_loc_Y = height / 16;
256}
257
258void BTEXT btext_clearscreen(void)
259{
260 boot_infos_t* bi = &disp_bi;
261 unsigned long *base = (unsigned long *)calc_base(bi, 0, 0);
262 unsigned long width = ((bi->dispDeviceRect[2] - bi->dispDeviceRect[0]) *
263 (bi->dispDeviceDepth >> 3)) >> 2;
264 int i,j;
265
266 for (i=0; i<(bi->dispDeviceRect[3] - bi->dispDeviceRect[1]); i++)
267 {
268 unsigned long *ptr = base;
269 for(j=width; j; --j)
270 *(ptr++) = 0;
271 base += (bi->dispDeviceRowBytes >> 2);
272 }
273}
274
275__inline__ void dcbst(const void* addr)
276{
277 __asm__ __volatile__ ("dcbst 0,%0" :: "r" (addr));
278}
279
280void BTEXT btext_flushscreen(void)
281{
282 boot_infos_t* bi = &disp_bi;
283 unsigned long *base = (unsigned long *)calc_base(bi, 0, 0);
284 unsigned long width = ((bi->dispDeviceRect[2] - bi->dispDeviceRect[0]) *
285 (bi->dispDeviceDepth >> 3)) >> 2;
286 int i,j;
287
288 for (i=0; i<(bi->dispDeviceRect[3] - bi->dispDeviceRect[1]); i++)
289 {
290 unsigned long *ptr = base;
291 for(j=width; j>0; j-=8) {
292 dcbst(ptr);
293 ptr += 8;
294 }
295 base += (bi->dispDeviceRowBytes >> 2);
296 }
297}
298
299#ifndef NO_SCROLL
300static BTEXT void
301scrollscreen(void)
302{
303 boot_infos_t* bi = &disp_bi;
304 unsigned long *src = (unsigned long *)calc_base(bi,0,16);
305 unsigned long *dst = (unsigned long *)calc_base(bi,0,0);
306 unsigned long width = ((bi->dispDeviceRect[2] - bi->dispDeviceRect[0]) *
307 (bi->dispDeviceDepth >> 3)) >> 2;
308 int i,j;
309
310#ifdef CONFIG_ADB_PMU
311 pmu_suspend(); /* PMU will not shut us down ! */
312#endif
313 for (i=0; i<(bi->dispDeviceRect[3] - bi->dispDeviceRect[1] - 16); i++)
314 {
315 unsigned long *src_ptr = src;
316 unsigned long *dst_ptr = dst;
317 for(j=width; j; --j)
318 *(dst_ptr++) = *(src_ptr++);
319 src += (bi->dispDeviceRowBytes >> 2);
320 dst += (bi->dispDeviceRowBytes >> 2);
321 }
322 for (i=0; i<16; i++)
323 {
324 unsigned long *dst_ptr = dst;
325 for(j=width; j; --j)
326 *(dst_ptr++) = 0;
327 dst += (bi->dispDeviceRowBytes >> 2);
328 }
329#ifdef CONFIG_ADB_PMU
330 pmu_resume(); /* PMU will not shut us down ! */
331#endif
332}
333#endif /* ndef NO_SCROLL */
334
335void BTEXT btext_drawchar(char c)
336{
337 int cline = 0, x;
338
339 if (!boot_text_mapped)
340 return;
341
342 switch (c) {
343 case '\b':
344 if (g_loc_X > 0)
345 --g_loc_X;
346 break;
347 case '\t':
348 g_loc_X = (g_loc_X & -8) + 8;
349 break;
350 case '\r':
351 g_loc_X = 0;
352 break;
353 case '\n':
354 g_loc_X = 0;
355 g_loc_Y++;
356 cline = 1;
357 break;
358 default:
359 draw_byte(c, g_loc_X++, g_loc_Y);
360 }
361 if (g_loc_X >= g_max_loc_X) {
362 g_loc_X = 0;
363 g_loc_Y++;
364 cline = 1;
365 }
366#ifndef NO_SCROLL
367 while (g_loc_Y >= g_max_loc_Y) {
368 scrollscreen();
369 g_loc_Y--;
370 }
371#else
372 /* wrap around from bottom to top of screen so we don't
373 waste time scrolling each line. -- paulus. */
374 if (g_loc_Y >= g_max_loc_Y)
375 g_loc_Y = 0;
376 if (cline) {
377 for (x = 0; x < g_max_loc_X; ++x)
378 draw_byte(' ', x, g_loc_Y);
379 }
380#endif
381}
382
383void BTEXT
384btext_drawstring(const char *c)
385{
386 if (!boot_text_mapped)
387 return;
388 while (*c)
389 btext_drawchar(*c++);
390}
391
392void BTEXT
393btext_drawhex(unsigned long v)
394{
395 static char hex_table[] = "0123456789abcdef";
396
397 if (!boot_text_mapped)
398 return;
399 btext_drawchar(hex_table[(v >> 28) & 0x0000000FUL]);
400 btext_drawchar(hex_table[(v >> 24) & 0x0000000FUL]);
401 btext_drawchar(hex_table[(v >> 20) & 0x0000000FUL]);
402 btext_drawchar(hex_table[(v >> 16) & 0x0000000FUL]);
403 btext_drawchar(hex_table[(v >> 12) & 0x0000000FUL]);
404 btext_drawchar(hex_table[(v >> 8) & 0x0000000FUL]);
405 btext_drawchar(hex_table[(v >> 4) & 0x0000000FUL]);
406 btext_drawchar(hex_table[(v >> 0) & 0x0000000FUL]);
407 btext_drawchar(' ');
408}
409
410static void BTEXT
411draw_byte(unsigned char c, long locX, long locY)
412{
413 boot_infos_t* bi = &disp_bi;
414 unsigned char *base = calc_base(bi, locX << 3, locY << 4);
415 unsigned char *font = &vga_font[((unsigned long)c) * 16];
416 int rb = bi->dispDeviceRowBytes;
417
418 switch(bi->dispDeviceDepth) {
419 case 24:
420 case 32:
421 draw_byte_32(font, (unsigned long *)base, rb);
422 break;
423 case 15:
424 case 16:
425 draw_byte_16(font, (unsigned long *)base, rb);
426 break;
427 case 8:
428 draw_byte_8(font, (unsigned long *)base, rb);
429 break;
430 }
431}
432
433static unsigned long expand_bits_8[16] BTDATA = {
434 0x00000000,
435 0x000000ff,
436 0x0000ff00,
437 0x0000ffff,
438 0x00ff0000,
439 0x00ff00ff,
440 0x00ffff00,
441 0x00ffffff,
442 0xff000000,
443 0xff0000ff,
444 0xff00ff00,
445 0xff00ffff,
446 0xffff0000,
447 0xffff00ff,
448 0xffffff00,
449 0xffffffff
450};
451
452static unsigned long expand_bits_16[4] BTDATA = {
453 0x00000000,
454 0x0000ffff,
455 0xffff0000,
456 0xffffffff
457};
458
459
460static void BTEXT
461draw_byte_32(unsigned char *font, unsigned long *base, int rb)
462{
463 int l, bits;
464 int fg = 0xFFFFFFFFUL;
465 int bg = 0x00000000UL;
466
467 for (l = 0; l < 16; ++l)
468 {
469 bits = *font++;
470 base[0] = (-(bits >> 7) & fg) ^ bg;
471 base[1] = (-((bits >> 6) & 1) & fg) ^ bg;
472 base[2] = (-((bits >> 5) & 1) & fg) ^ bg;
473 base[3] = (-((bits >> 4) & 1) & fg) ^ bg;
474 base[4] = (-((bits >> 3) & 1) & fg) ^ bg;
475 base[5] = (-((bits >> 2) & 1) & fg) ^ bg;
476 base[6] = (-((bits >> 1) & 1) & fg) ^ bg;
477 base[7] = (-(bits & 1) & fg) ^ bg;
478 base = (unsigned long *) ((char *)base + rb);
479 }
480}
481
482static void BTEXT
483draw_byte_16(unsigned char *font, unsigned long *base, int rb)
484{
485 int l, bits;
486 int fg = 0xFFFFFFFFUL;
487 int bg = 0x00000000UL;
488 unsigned long *eb = expand_bits_16;
489
490 for (l = 0; l < 16; ++l)
491 {
492 bits = *font++;
493 base[0] = (eb[bits >> 6] & fg) ^ bg;
494 base[1] = (eb[(bits >> 4) & 3] & fg) ^ bg;
495 base[2] = (eb[(bits >> 2) & 3] & fg) ^ bg;
496 base[3] = (eb[bits & 3] & fg) ^ bg;
497 base = (unsigned long *) ((char *)base + rb);
498 }
499}
500
501static void BTEXT
502draw_byte_8(unsigned char *font, unsigned long *base, int rb)
503{
504 int l, bits;
505 int fg = 0x0F0F0F0FUL;
506 int bg = 0x00000000UL;
507 unsigned long *eb = expand_bits_8;
508
509 for (l = 0; l < 16; ++l)
510 {
511 bits = *font++;
512 base[0] = (eb[bits >> 4] & fg) ^ bg;
513 base[1] = (eb[bits & 0xf] & fg) ^ bg;
514 base = (unsigned long *) ((char *)base + rb);
515 }
516}
517
518static unsigned char vga_font[cmapsz] BTDATA = {
5190x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
5200x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x81, 0xa5, 0x81, 0x81, 0xbd,
5210x99, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xff,
5220xdb, 0xff, 0xff, 0xc3, 0xe7, 0xff, 0xff, 0x7e, 0x00, 0x00, 0x00, 0x00,
5230x00, 0x00, 0x00, 0x00, 0x6c, 0xfe, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x10,
5240x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x7c, 0xfe,
5250x7c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18,
5260x3c, 0x3c, 0xe7, 0xe7, 0xe7, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
5270x00, 0x00, 0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x7e, 0x18, 0x18, 0x3c,
5280x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c,
5290x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
5300xff, 0xff, 0xe7, 0xc3, 0xc3, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5310x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x42, 0x42, 0x66, 0x3c, 0x00,
5320x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc3, 0x99, 0xbd,
5330xbd, 0x99, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x1e, 0x0e,
5340x1a, 0x32, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00,
5350x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18, 0x18,
5360x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x33, 0x3f, 0x30, 0x30, 0x30,
5370x30, 0x70, 0xf0, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x63,
5380x7f, 0x63, 0x63, 0x63, 0x63, 0x67, 0xe7, 0xe6, 0xc0, 0x00, 0x00, 0x00,
5390x00, 0x00, 0x00, 0x18, 0x18, 0xdb, 0x3c, 0xe7, 0x3c, 0xdb, 0x18, 0x18,
5400x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfe, 0xf8,
5410xf0, 0xe0, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x0e,
5420x1e, 0x3e, 0xfe, 0x3e, 0x1e, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00,
5430x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00,
5440x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
5450x66, 0x00, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xdb,
5460xdb, 0xdb, 0x7b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x00, 0x00, 0x00, 0x00,
5470x00, 0x7c, 0xc6, 0x60, 0x38, 0x6c, 0xc6, 0xc6, 0x6c, 0x38, 0x0c, 0xc6,
5480x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
5490xfe, 0xfe, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c,
5500x7e, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00,
5510x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
5520x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
5530x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
5540x00, 0x18, 0x0c, 0xfe, 0x0c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
5550x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x60, 0xfe, 0x60, 0x30, 0x00, 0x00,
5560x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0,
5570xc0, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
5580x00, 0x24, 0x66, 0xff, 0x66, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
5590x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x38, 0x7c, 0x7c, 0xfe, 0xfe, 0x00,
5600x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0x7c, 0x7c,
5610x38, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
5620x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
5630x00, 0x00, 0x18, 0x3c, 0x3c, 0x3c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18,
5640x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x24, 0x00, 0x00, 0x00,
5650x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c,
5660x6c, 0xfe, 0x6c, 0x6c, 0x6c, 0xfe, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00,
5670x18, 0x18, 0x7c, 0xc6, 0xc2, 0xc0, 0x7c, 0x06, 0x06, 0x86, 0xc6, 0x7c,
5680x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc2, 0xc6, 0x0c, 0x18,
5690x30, 0x60, 0xc6, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x6c,
5700x6c, 0x38, 0x76, 0xdc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
5710x00, 0x30, 0x30, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
5720x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30,
5730x30, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x18,
5740x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00,
5750x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3c, 0xff, 0x3c, 0x66, 0x00, 0x00,
5760x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e,
5770x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
5780x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00,
5790x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00,
5800x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
5810x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
5820x02, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00,
5830x00, 0x00, 0x7c, 0xc6, 0xc6, 0xce, 0xde, 0xf6, 0xe6, 0xc6, 0xc6, 0x7c,
5840x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x38, 0x78, 0x18, 0x18, 0x18,
5850x18, 0x18, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6,
5860x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00,
5870x00, 0x00, 0x7c, 0xc6, 0x06, 0x06, 0x3c, 0x06, 0x06, 0x06, 0xc6, 0x7c,
5880x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x1c, 0x3c, 0x6c, 0xcc, 0xfe,
5890x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc0,
5900xc0, 0xc0, 0xfc, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
5910x00, 0x00, 0x38, 0x60, 0xc0, 0xc0, 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c,
5920x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc6, 0x06, 0x06, 0x0c, 0x18,
5930x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6,
5940xc6, 0xc6, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
5950x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0x06, 0x0c, 0x78,
5960x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00,
5970x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
5980x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00,
5990x00, 0x00, 0x00, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x06,
6000x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00,
6010x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
6020x30, 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00,
6030x00, 0x00, 0x7c, 0xc6, 0xc6, 0x0c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18,
6040x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xde, 0xde,
6050xde, 0xdc, 0xc0, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38,
6060x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
6070x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x66, 0x66, 0xfc,
6080x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0,
6090xc0, 0xc2, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x6c,
6100x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x00, 0x00, 0x00, 0x00,
6110x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x62, 0x66, 0xfe,
6120x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68,
6130x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66,
6140xc2, 0xc0, 0xc0, 0xde, 0xc6, 0xc6, 0x66, 0x3a, 0x00, 0x00, 0x00, 0x00,
6150x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6,
6160x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18,
6170x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x0c,
6180x0c, 0x0c, 0x0c, 0x0c, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00,
6190x00, 0x00, 0xe6, 0x66, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0x66, 0xe6,
6200x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x60, 0x60, 0x60, 0x60, 0x60,
6210x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xe7,
6220xff, 0xff, 0xdb, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0x00, 0x00, 0x00, 0x00,
6230x00, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0xc6,
6240x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6,
6250xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x66,
6260x66, 0x66, 0x7c, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00,
6270x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0xde, 0x7c,
6280x0c, 0x0e, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x6c,
6290x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6,
6300xc6, 0x60, 0x38, 0x0c, 0x06, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
6310x00, 0x00, 0xff, 0xdb, 0x99, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c,
6320x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6,
6330xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xc3,
6340xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00,
6350x00, 0x00, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xdb, 0xdb, 0xff, 0x66, 0x66,
6360x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xc3, 0x66, 0x3c, 0x18, 0x18,
6370x3c, 0x66, 0xc3, 0xc3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xc3,
6380xc3, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
6390x00, 0x00, 0xff, 0xc3, 0x86, 0x0c, 0x18, 0x30, 0x60, 0xc1, 0xc3, 0xff,
6400x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30,
6410x30, 0x30, 0x30, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
6420xc0, 0xe0, 0x70, 0x38, 0x1c, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00,
6430x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c,
6440x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00,
6450x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
6460x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00,
6470x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
6480x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x0c, 0x7c,
6490xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x60,
6500x60, 0x78, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00,
6510x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c,
6520x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x0c, 0x0c, 0x3c, 0x6c, 0xcc,
6530xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
6540x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
6550x00, 0x00, 0x38, 0x6c, 0x64, 0x60, 0xf0, 0x60, 0x60, 0x60, 0x60, 0xf0,
6560x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc,
6570xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xcc, 0x78, 0x00, 0x00, 0x00, 0xe0, 0x60,
6580x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00,
6590x00, 0x00, 0x18, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c,
6600x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x00, 0x0e, 0x06, 0x06,
6610x06, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0xe0, 0x60,
6620x60, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00,
6630x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c,
6640x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe6, 0xff, 0xdb,
6650xdb, 0xdb, 0xdb, 0xdb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
6660x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
6670x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c,
6680x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66,
6690x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00,
6700x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0x0c, 0x1e, 0x00,
6710x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x76, 0x66, 0x60, 0x60, 0x60, 0xf0,
6720x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x60,
6730x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x30,
6740x30, 0xfc, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00,
6750x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76,
6760x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xc3, 0xc3,
6770xc3, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
6780x00, 0xc3, 0xc3, 0xc3, 0xdb, 0xdb, 0xff, 0x66, 0x00, 0x00, 0x00, 0x00,
6790x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0xc3,
6800x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6,
6810xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00,
6820x00, 0xfe, 0xcc, 0x18, 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00,
6830x00, 0x00, 0x0e, 0x18, 0x18, 0x18, 0x70, 0x18, 0x18, 0x18, 0x18, 0x0e,
6840x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18,
6850x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x18,
6860x18, 0x18, 0x0e, 0x18, 0x18, 0x18, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00,
6870x00, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
6880x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6,
6890xc6, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66,
6900xc2, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x0c, 0x06, 0x7c, 0x00, 0x00,
6910x00, 0x00, 0xcc, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76,
6920x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x30, 0x00, 0x7c, 0xc6, 0xfe,
6930xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c,
6940x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
6950x00, 0x00, 0xcc, 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76,
6960x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x00, 0x78, 0x0c, 0x7c,
6970xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x6c, 0x38,
6980x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
6990x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x60, 0x60, 0x66, 0x3c, 0x0c, 0x06,
7000x3c, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xfe,
7010xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x00,
7020x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
7030x00, 0x60, 0x30, 0x18, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c,
7040x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, 0x38, 0x18, 0x18,
7050x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x66,
7060x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
7070x00, 0x60, 0x30, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c,
7080x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6,
7090xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x38, 0x6c, 0x38, 0x00,
7100x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
7110x18, 0x30, 0x60, 0x00, 0xfe, 0x66, 0x60, 0x7c, 0x60, 0x60, 0x66, 0xfe,
7120x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6e, 0x3b, 0x1b,
7130x7e, 0xd8, 0xdc, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x6c,
7140xcc, 0xcc, 0xfe, 0xcc, 0xcc, 0xcc, 0xcc, 0xce, 0x00, 0x00, 0x00, 0x00,
7150x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c,
7160x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x00, 0x00, 0x7c, 0xc6, 0xc6,
7170xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x30, 0x18,
7180x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
7190x00, 0x30, 0x78, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76,
7200x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x00, 0xcc, 0xcc, 0xcc,
7210xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x00,
7220x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0x78, 0x00,
7230x00, 0xc6, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c,
7240x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6,
7250xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e,
7260xc3, 0xc0, 0xc0, 0xc0, 0xc3, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
7270x00, 0x38, 0x6c, 0x64, 0x60, 0xf0, 0x60, 0x60, 0x60, 0x60, 0xe6, 0xfc,
7280x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0x66, 0x3c, 0x18, 0xff, 0x18,
7290xff, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x66, 0x66,
7300x7c, 0x62, 0x66, 0x6f, 0x66, 0x66, 0x66, 0xf3, 0x00, 0x00, 0x00, 0x00,
7310x00, 0x0e, 0x1b, 0x18, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18,
7320xd8, 0x70, 0x00, 0x00, 0x00, 0x18, 0x30, 0x60, 0x00, 0x78, 0x0c, 0x7c,
7330xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x30,
7340x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
7350x00, 0x18, 0x30, 0x60, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c,
7360x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x30, 0x60, 0x00, 0xcc, 0xcc, 0xcc,
7370xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc,
7380x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
7390x76, 0xdc, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6,
7400x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x6c, 0x6c, 0x3e, 0x00, 0x7e, 0x00,
7410x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x6c, 0x6c,
7420x38, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7430x00, 0x00, 0x30, 0x30, 0x00, 0x30, 0x30, 0x60, 0xc0, 0xc6, 0xc6, 0x7c,
7440x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc0,
7450xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7460x00, 0x00, 0xfe, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00,
7470x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30, 0x60, 0xce, 0x9b, 0x06,
7480x0c, 0x1f, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30,
7490x66, 0xce, 0x96, 0x3e, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18,
7500x00, 0x18, 0x18, 0x18, 0x3c, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00,
7510x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x6c, 0xd8, 0x6c, 0x36, 0x00, 0x00,
7520x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, 0x6c, 0x36,
7530x6c, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x44, 0x11, 0x44,
7540x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44,
7550x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa,
7560x55, 0xaa, 0x55, 0xaa, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77,
7570xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0x18, 0x18, 0x18, 0x18,
7580x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
7590x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18,
7600x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0xf8,
7610x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x36, 0x36, 0x36, 0x36,
7620x36, 0x36, 0x36, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
7630x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x36, 0x36, 0x36, 0x36,
7640x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0xf8,
7650x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x36, 0x36, 0x36, 0x36,
7660x36, 0xf6, 0x06, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
7670x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
7680x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, 0xf6,
7690x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
7700x36, 0xf6, 0x06, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7710x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xfe, 0x00, 0x00, 0x00, 0x00,
7720x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0xf8,
7730x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7740x00, 0x00, 0x00, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
7750x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00,
7760x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff,
7770x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7780x00, 0x00, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
7790x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18,
7800x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
7810x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18,
7820x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
7830x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18,
7840x18, 0x18, 0x18, 0x18, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x37,
7850x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
7860x36, 0x37, 0x30, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7870x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36,
7880x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xf7, 0x00, 0xff,
7890x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7900x00, 0xff, 0x00, 0xf7, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
7910x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36,
7920x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff,
7930x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x36, 0x36, 0x36,
7940x36, 0xf7, 0x00, 0xf7, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
7950x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
7960x00, 0x00, 0x00, 0x00, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xff,
7970x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7980x00, 0xff, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
7990x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x36, 0x36, 0x36, 0x36,
8000x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x3f,
8010x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18,
8020x18, 0x1f, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
8030x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18,
8040x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f,
8050x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
8060x36, 0x36, 0x36, 0xff, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
8070x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18,
8080x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8,
8090x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
8100x00, 0x00, 0x00, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
8110xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
8120xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
8130xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xf0, 0xf0, 0xf0,
8140xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0,
8150x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
8160x0f, 0x0f, 0x0f, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
8170x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
8180x00, 0x76, 0xdc, 0xd8, 0xd8, 0xd8, 0xdc, 0x76, 0x00, 0x00, 0x00, 0x00,
8190x00, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0xd8, 0xcc, 0xc6, 0xc6, 0xc6, 0xcc,
8200x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc6, 0xc6, 0xc0, 0xc0, 0xc0,
8210xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
8220xfe, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00,
8230x00, 0x00, 0x00, 0xfe, 0xc6, 0x60, 0x30, 0x18, 0x30, 0x60, 0xc6, 0xfe,
8240x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xd8, 0xd8,
8250xd8, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
8260x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xc0, 0x00, 0x00, 0x00,
8270x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
8280x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x18, 0x3c, 0x66, 0x66,
8290x66, 0x3c, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38,
8300x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00,
8310x00, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0x6c, 0x6c, 0x6c, 0x6c, 0xee,
8320x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x30, 0x18, 0x0c, 0x3e, 0x66,
8330x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
8340x00, 0x7e, 0xdb, 0xdb, 0xdb, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
8350x00, 0x00, 0x00, 0x03, 0x06, 0x7e, 0xdb, 0xdb, 0xf3, 0x7e, 0x60, 0xc0,
8360x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x30, 0x60, 0x60, 0x7c, 0x60,
8370x60, 0x60, 0x30, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c,
8380xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
8390x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00,
8400x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18,
8410x18, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30,
8420x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00,
8430x00, 0x00, 0x00, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x00, 0x7e,
8440x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x1b, 0x1b, 0x1b, 0x18, 0x18,
8450x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
8460x18, 0x18, 0x18, 0x18, 0xd8, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00,
8470x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x7e, 0x00, 0x18, 0x18, 0x00,
8480x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x00,
8490x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x6c, 0x6c,
8500x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
8510x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00,
8520x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
8530x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x0c, 0x0c,
8540x0c, 0x0c, 0x0c, 0xec, 0x6c, 0x6c, 0x3c, 0x1c, 0x00, 0x00, 0x00, 0x00,
8550x00, 0xd8, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00,
8560x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xd8, 0x30, 0x60, 0xc8, 0xf8, 0x00,
8570x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
8580x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00,
8590x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
8600x00, 0x00, 0x00, 0x00,
861};
diff --git a/arch/ppc/syslib/cpc700.h b/arch/ppc/syslib/cpc700.h
new file mode 100644
index 000000000000..f2c002531019
--- /dev/null
+++ b/arch/ppc/syslib/cpc700.h
@@ -0,0 +1,98 @@
1/*
2 * arch/ppc/syslib/cpc700.h
3 *
4 * Header file for IBM CPC700 Host Bridge, et. al.
5 *
6 * Author: Mark A. Greer
7 * mgreer@mvista.com
8 *
9 * 2000-2002 (c) MontaVista, Software, Inc. This file is licensed under
10 * the terms of the GNU General Public License version 2. This program
11 * is licensed "as is" without any warranty of any kind, whether express
12 * or implied.
13 */
14
15/*
16 * This file contains the defines and macros for the IBM CPC700 host bridge,
17 * memory controller, PIC, UARTs, IIC, and Timers.
18 */
19
20#ifndef __PPC_SYSLIB_CPC700_H__
21#define __PPC_SYSLIB_CPC700_H__
22
23#include <linux/stddef.h>
24#include <linux/types.h>
25#include <linux/init.h>
26
27/* XXX no barriers? not even any volatiles? -- paulus */
28#define CPC700_OUT_32(a,d) (*(u_int *)a = d)
29#define CPC700_IN_32(a) (*(u_int *)a)
30
31/*
32 * PCI Section
33 */
34#define CPC700_PCI_CONFIG_ADDR 0xfec00000
35#define CPC700_PCI_CONFIG_DATA 0xfec00004
36
37/* CPU -> PCI memory window 0 */
38#define CPC700_PMM0_LOCAL 0xff400000 /* CPU physical addr */
39#define CPC700_PMM0_MASK_ATTR 0xff400004 /* size and attrs */
40#define CPC700_PMM0_PCI_LOW 0xff400008 /* PCI addr, low word */
41#define CPC700_PMM0_PCI_HIGH 0xff40000c /* PCI addr, high wd */
42/* CPU -> PCI memory window 1 */
43#define CPC700_PMM1_LOCAL 0xff400010
44#define CPC700_PMM1_MASK_ATTR 0xff400014
45#define CPC700_PMM1_PCI_LOW 0xff400018
46#define CPC700_PMM1_PCI_HIGH 0xff40001c
47/* CPU -> PCI memory window 2 */
48#define CPC700_PMM2_LOCAL 0xff400020
49#define CPC700_PMM2_MASK_ATTR 0xff400024
50#define CPC700_PMM2_PCI_LOW 0xff400028
51#define CPC700_PMM2_PCI_HIGH 0xff40002c
52/* PCI memory -> CPU window 1 */
53#define CPC700_PTM1_MEMSIZE 0xff400030 /* window size */
54#define CPC700_PTM1_LOCAL 0xff400034 /* CPU phys addr */
55/* PCI memory -> CPU window 2 */
56#define CPC700_PTM2_MEMSIZE 0xff400038 /* size and enable */
57#define CPC700_PTM2_LOCAL 0xff40003c
58
59/*
60 * PIC Section
61 *
62 * IBM calls the CPC700's programmable interrupt controller the Universal
63 * Interrupt Controller or UIC.
64 */
65
66/*
67 * UIC Register Addresses.
68 */
69#define CPC700_UIC_UICSR 0xff500880 /* Status Reg (Rd/Clr)*/
70#define CPC700_UIC_UICSRS 0xff500884 /* Status Reg (Set) */
71#define CPC700_UIC_UICER 0xff500888 /* Enable Reg */
72#define CPC700_UIC_UICCR 0xff50088c /* Critical Reg */
73#define CPC700_UIC_UICPR 0xff500890 /* Polarity Reg */
74#define CPC700_UIC_UICTR 0xff500894 /* Trigger Reg */
75#define CPC700_UIC_UICMSR 0xff500898 /* Masked Status Reg */
76#define CPC700_UIC_UICVR 0xff50089c /* Vector Reg */
77#define CPC700_UIC_UICVCR 0xff5008a0 /* Vector Config Reg */
78
79#define CPC700_UIC_UICER_ENABLE 0x00000001 /* Enable an IRQ */
80
81#define CPC700_UIC_UICVCR_31_HI 0x00000000 /* IRQ 31 hi priority */
82#define CPC700_UIC_UICVCR_0_HI 0x00000001 /* IRQ 0 hi priority */
83#define CPC700_UIC_UICVCR_BASE_MASK 0xfffffffc
84#define CPC700_UIC_UICVCR_ORDER_MASK 0x00000001
85
86/* Specify value of a bit for an IRQ. */
87#define CPC700_UIC_IRQ_BIT(i) ((0x00000001) << (31 - (i)))
88
89/*
90 * UIC Exports...
91 */
92extern struct hw_interrupt_type cpc700_pic;
93extern unsigned int cpc700_irq_assigns[32][2];
94
95extern void __init cpc700_init_IRQ(void);
96extern int cpc700_get_irq(struct pt_regs *);
97
98#endif /* __PPC_SYSLIB_CPC700_H__ */
diff --git a/arch/ppc/syslib/cpc700_pic.c b/arch/ppc/syslib/cpc700_pic.c
new file mode 100644
index 000000000000..774709807538
--- /dev/null
+++ b/arch/ppc/syslib/cpc700_pic.c
@@ -0,0 +1,187 @@
1/*
2 * arch/ppc/syslib/cpc700_pic.c
3 *
4 * Interrupt controller support for IBM Spruce
5 *
6 * Authors: Mark Greer, Matt Porter, and Johnnie Peters
7 * mgreer@mvista.com
8 * mporter@mvista.com
9 * jpeters@mvista.com
10 *
11 * 2001-2002 (c) MontaVista, Software, Inc. This file is licensed under
12 * the terms of the GNU General Public License version 2. This program
13 * is licensed "as is" without any warranty of any kind, whether express
14 * or implied.
15 */
16
17#include <linux/stddef.h>
18#include <linux/init.h>
19#include <linux/sched.h>
20#include <linux/signal.h>
21#include <linux/irq.h>
22
23#include <asm/io.h>
24#include <asm/system.h>
25#include <asm/irq.h>
26
27#include "cpc700.h"
28
29static void
30cpc700_unmask_irq(unsigned int irq)
31{
32 unsigned int tr_bits;
33
34 /*
35 * IRQ 31 is largest IRQ supported.
36 * IRQs 17-19 are reserved.
37 */
38 if ((irq <= 31) && ((irq < 17) || (irq > 19))) {
39 tr_bits = CPC700_IN_32(CPC700_UIC_UICTR);
40
41 if ((tr_bits & (1 << (31 - irq))) == 0) {
42 /* level trigger interrupt, clear bit in status
43 * register */
44 CPC700_OUT_32(CPC700_UIC_UICSR, 1 << (31 - irq));
45 }
46
47 /* Know IRQ fits in entry 0 of ppc_cached_irq_mask[] */
48 ppc_cached_irq_mask[0] |= CPC700_UIC_IRQ_BIT(irq);
49
50 CPC700_OUT_32(CPC700_UIC_UICER, ppc_cached_irq_mask[0]);
51 }
52 return;
53}
54
55static void
56cpc700_mask_irq(unsigned int irq)
57{
58 /*
59 * IRQ 31 is largest IRQ supported.
60 * IRQs 17-19 are reserved.
61 */
62 if ((irq <= 31) && ((irq < 17) || (irq > 19))) {
63 /* Know IRQ fits in entry 0 of ppc_cached_irq_mask[] */
64 ppc_cached_irq_mask[0] &=
65 ~CPC700_UIC_IRQ_BIT(irq);
66
67 CPC700_OUT_32(CPC700_UIC_UICER, ppc_cached_irq_mask[0]);
68 }
69 return;
70}
71
72static void
73cpc700_mask_and_ack_irq(unsigned int irq)
74{
75 u_int bit;
76
77 /*
78 * IRQ 31 is largest IRQ supported.
79 * IRQs 17-19 are reserved.
80 */
81 if ((irq <= 31) && ((irq < 17) || (irq > 19))) {
82 /* Know IRQ fits in entry 0 of ppc_cached_irq_mask[] */
83 bit = CPC700_UIC_IRQ_BIT(irq);
84
85 ppc_cached_irq_mask[0] &= ~bit;
86 CPC700_OUT_32(CPC700_UIC_UICER, ppc_cached_irq_mask[0]);
87 CPC700_OUT_32(CPC700_UIC_UICSR, bit); /* Write 1 clears IRQ */
88 }
89 return;
90}
91
92static struct hw_interrupt_type cpc700_pic = {
93 "CPC700 PIC",
94 NULL,
95 NULL,
96 cpc700_unmask_irq,
97 cpc700_mask_irq,
98 cpc700_mask_and_ack_irq,
99 NULL,
100 NULL
101};
102
103__init static void
104cpc700_pic_init_irq(unsigned int irq)
105{
106 unsigned int tmp;
107
108 /* Set interrupt sense */
109 tmp = CPC700_IN_32(CPC700_UIC_UICTR);
110 if (cpc700_irq_assigns[irq][0] == 0) {
111 tmp &= ~CPC700_UIC_IRQ_BIT(irq);
112 } else {
113 tmp |= CPC700_UIC_IRQ_BIT(irq);
114 }
115 CPC700_OUT_32(CPC700_UIC_UICTR, tmp);
116
117 /* Set interrupt polarity */
118 tmp = CPC700_IN_32(CPC700_UIC_UICPR);
119 if (cpc700_irq_assigns[irq][1]) {
120 tmp |= CPC700_UIC_IRQ_BIT(irq);
121 } else {
122 tmp &= ~CPC700_UIC_IRQ_BIT(irq);
123 }
124 CPC700_OUT_32(CPC700_UIC_UICPR, tmp);
125
126 /* Set interrupt critical */
127 tmp = CPC700_IN_32(CPC700_UIC_UICCR);
128 tmp |= CPC700_UIC_IRQ_BIT(irq);
129 CPC700_OUT_32(CPC700_UIC_UICCR, tmp);
130
131 return;
132}
133
134__init void
135cpc700_init_IRQ(void)
136{
137 int i;
138
139 ppc_cached_irq_mask[0] = 0;
140 CPC700_OUT_32(CPC700_UIC_UICER, 0x00000000); /* Disable all irq's */
141 CPC700_OUT_32(CPC700_UIC_UICSR, 0xffffffff); /* Clear cur intrs */
142 CPC700_OUT_32(CPC700_UIC_UICCR, 0xffffffff); /* Gen INT not MCP */
143 CPC700_OUT_32(CPC700_UIC_UICPR, 0x00000000); /* Active low */
144 CPC700_OUT_32(CPC700_UIC_UICTR, 0x00000000); /* Level Sensitive */
145 CPC700_OUT_32(CPC700_UIC_UICVR, CPC700_UIC_UICVCR_0_HI);
146 /* IRQ 0 is highest */
147
148 for (i = 0; i < 17; i++) {
149 irq_desc[i].handler = &cpc700_pic;
150 cpc700_pic_init_irq(i);
151 }
152
153 for (i = 20; i < 32; i++) {
154 irq_desc[i].handler = &cpc700_pic;
155 cpc700_pic_init_irq(i);
156 }
157
158 return;
159}
160
161
162
163/*
164 * Find the highest IRQ that generating an interrupt, if any.
165 */
166int
167cpc700_get_irq(struct pt_regs *regs)
168{
169 int irq = 0;
170 u_int irq_status, irq_test = 1;
171
172 irq_status = CPC700_IN_32(CPC700_UIC_UICMSR);
173
174 do
175 {
176 if (irq_status & irq_test)
177 break;
178 irq++;
179 irq_test <<= 1;
180 } while (irq < NR_IRQS);
181
182
183 if (irq == NR_IRQS)
184 irq = 33;
185
186 return (31 - irq);
187}
diff --git a/arch/ppc/syslib/cpc710.h b/arch/ppc/syslib/cpc710.h
new file mode 100644
index 000000000000..cc0afd804029
--- /dev/null
+++ b/arch/ppc/syslib/cpc710.h
@@ -0,0 +1,83 @@
1/*
2 * arch/ppc/syslib/cpc710.h
3 *
4 * Definitions for the IBM CPC710 PCI Host Bridge
5 *
6 * Author: Matt Porter <mporter@mvista.com>
7 *
8 * 2001 (c) MontaVista, Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
11 * or implied.
12 */
13
14#ifndef __PPC_PLATFORMS_CPC710_H
15#define __PPC_PLATFORMS_CPC710_H
16
17/* General bridge and memory controller registers */
18#define PIDR 0xff000008
19#define CNFR 0xff00000c
20#define RSTR 0xff000010
21#define UCTL 0xff001000
22#define MPSR 0xff001010
23#define SIOC 0xff001020
24#define ABCNTL 0xff001030
25#define SRST 0xff001040
26#define ERRC 0xff001050
27#define SESR 0xff001060
28#define SEAR 0xff001070
29#define SIOC1 0xff001090
30#define PGCHP 0xff001100
31#define GPDIR 0xff001130
32#define GPOUT 0xff001150
33#define ATAS 0xff001160
34#define AVDG 0xff001170
35#define MCCR 0xff001200
36#define MESR 0xff001220
37#define MEAR 0xff001230
38#define MCER0 0xff001300
39#define MCER1 0xff001310
40#define MCER2 0xff001320
41#define MCER3 0xff001330
42#define MCER4 0xff001340
43#define MCER5 0xff001350
44#define MCER6 0xff001360
45#define MCER7 0xff001370
46
47/*
48 * PCI32/64 configuration registers
49 * Given as offsets from their
50 * respective physical segment BAR
51 */
52#define PIBAR 0x000f7800
53#define PMBAR 0x000f7810
54#define MSIZE 0x000f7f40
55#define IOSIZE 0x000f7f60
56#define SMBAR 0x000f7f80
57#define SIBAR 0x000f7fc0
58#define PSSIZE 0x000f8100
59#define PPSIZE 0x000f8110
60#define BARPS 0x000f8120
61#define BARPP 0x000f8130
62#define PSBAR 0x000f8140
63#define PPBAR 0x000f8150
64#define BPMDLK 0x000f8200 /* Bottom of Peripheral Memory Space */
65#define TPMDLK 0x000f8210 /* Top of Peripheral Memory Space */
66#define BIODLK 0x000f8220 /* Bottom of Peripheral I/O Space */
67#define TIODLK 0x000f8230 /* Top of Perioheral I/O Space */
68#define DLKCTRL 0x000f8240 /* Deadlock control */
69#define DLKDEV 0x000f8250 /* Deadlock device */
70
71/* System standard configuration registers space */
72#define DCR 0xff200000
73#define DID 0xff200004
74#define BAR 0xff200018
75
76/* Device specific configuration space */
77#define PCIENB 0xff201000
78
79/* Configuration space registers */
80#define CPC710_BUS_NUMBER 0x40
81#define CPC710_SUB_BUS_NUMBER 0x41
82
83#endif /* __PPC_PLATFORMS_CPC710_H */
diff --git a/arch/ppc/syslib/cpm2_common.c b/arch/ppc/syslib/cpm2_common.c
new file mode 100644
index 000000000000..ea5e77080e8d
--- /dev/null
+++ b/arch/ppc/syslib/cpm2_common.c
@@ -0,0 +1,198 @@
1/*
2 * General Purpose functions for the global management of the
3 * 8260 Communication Processor Module.
4 * Copyright (c) 1999 Dan Malek (dmalek@jlc.net)
5 * Copyright (c) 2000 MontaVista Software, Inc (source@mvista.com)
6 * 2.3.99 Updates
7 *
8 * In addition to the individual control of the communication
9 * channels, there are a few functions that globally affect the
10 * communication processor.
11 *
12 * Buffer descriptors must be allocated from the dual ported memory
13 * space. The allocator for that is here. When the communication
14 * process is reset, we reclaim the memory available. There is
15 * currently no deallocator for this memory.
16 */
17#include <linux/errno.h>
18#include <linux/sched.h>
19#include <linux/kernel.h>
20#include <linux/param.h>
21#include <linux/string.h>
22#include <linux/mm.h>
23#include <linux/interrupt.h>
24#include <linux/bootmem.h>
25#include <linux/module.h>
26#include <asm/irq.h>
27#include <asm/mpc8260.h>
28#include <asm/page.h>
29#include <asm/pgtable.h>
30#include <asm/immap_cpm2.h>
31#include <asm/cpm2.h>
32#include <asm/rheap.h>
33
34static void cpm2_dpinit(void);
35cpm_cpm2_t *cpmp; /* Pointer to comm processor space */
36
37/* We allocate this here because it is used almost exclusively for
38 * the communication processor devices.
39 */
40cpm2_map_t *cpm2_immr;
41
42#define CPM_MAP_SIZE (0x40000) /* 256k - the PQ3 reserve this amount
43 of space for CPM as it is larger
44 than on PQ2 */
45
46void
47cpm2_reset(void)
48{
49 cpm2_immr = (cpm2_map_t *)ioremap(CPM_MAP_ADDR, CPM_MAP_SIZE);
50
51 /* Reclaim the DP memory for our use.
52 */
53 cpm2_dpinit();
54
55 /* Tell everyone where the comm processor resides.
56 */
57 cpmp = &cpm2_immr->im_cpm;
58}
59
60/* Set a baud rate generator. This needs lots of work. There are
61 * eight BRGs, which can be connected to the CPM channels or output
62 * as clocks. The BRGs are in two different block of internal
63 * memory mapped space.
64 * The baud rate clock is the system clock divided by something.
65 * It was set up long ago during the initial boot phase and is
66 * is given to us.
67 * Baud rate clocks are zero-based in the driver code (as that maps
68 * to port numbers). Documentation uses 1-based numbering.
69 */
70#define BRG_INT_CLK (((bd_t *)__res)->bi_brgfreq)
71#define BRG_UART_CLK (BRG_INT_CLK/16)
72
73/* This function is used by UARTS, or anything else that uses a 16x
74 * oversampled clock.
75 */
76void
77cpm_setbrg(uint brg, uint rate)
78{
79 volatile uint *bp;
80
81 /* This is good enough to get SMCs running.....
82 */
83 if (brg < 4) {
84 bp = (uint *)&cpm2_immr->im_brgc1;
85 }
86 else {
87 bp = (uint *)&cpm2_immr->im_brgc5;
88 brg -= 4;
89 }
90 bp += brg;
91 *bp = ((BRG_UART_CLK / rate) << 1) | CPM_BRG_EN;
92}
93
94/* This function is used to set high speed synchronous baud rate
95 * clocks.
96 */
97void
98cpm2_fastbrg(uint brg, uint rate, int div16)
99{
100 volatile uint *bp;
101
102 if (brg < 4) {
103 bp = (uint *)&cpm2_immr->im_brgc1;
104 }
105 else {
106 bp = (uint *)&cpm2_immr->im_brgc5;
107 brg -= 4;
108 }
109 bp += brg;
110 *bp = ((BRG_INT_CLK / rate) << 1) | CPM_BRG_EN;
111 if (div16)
112 *bp |= CPM_BRG_DIV16;
113}
114
115/*
116 * dpalloc / dpfree bits.
117 */
118static spinlock_t cpm_dpmem_lock;
119/* 16 blocks should be enough to satisfy all requests
120 * until the memory subsystem goes up... */
121static rh_block_t cpm_boot_dpmem_rh_block[16];
122static rh_info_t cpm_dpmem_info;
123
124static void cpm2_dpinit(void)
125{
126 spin_lock_init(&cpm_dpmem_lock);
127
128 /* initialize the info header */
129 rh_init(&cpm_dpmem_info, 1,
130 sizeof(cpm_boot_dpmem_rh_block) /
131 sizeof(cpm_boot_dpmem_rh_block[0]),
132 cpm_boot_dpmem_rh_block);
133
134 /* Attach the usable dpmem area */
135 /* XXX: This is actually crap. CPM_DATAONLY_BASE and
136 * CPM_DATAONLY_SIZE is only a subset of the available dpram. It
137 * varies with the processor and the microcode patches activated.
138 * But the following should be at least safe.
139 */
140 rh_attach_region(&cpm_dpmem_info, (void *)CPM_DATAONLY_BASE,
141 CPM_DATAONLY_SIZE);
142}
143
144/* This function returns an index into the DPRAM area.
145 */
146uint cpm_dpalloc(uint size, uint align)
147{
148 void *start;
149 unsigned long flags;
150
151 spin_lock_irqsave(&cpm_dpmem_lock, flags);
152 cpm_dpmem_info.alignment = align;
153 start = rh_alloc(&cpm_dpmem_info, size, "commproc");
154 spin_unlock_irqrestore(&cpm_dpmem_lock, flags);
155
156 return (uint)start;
157}
158EXPORT_SYMBOL(cpm_dpalloc);
159
160int cpm_dpfree(uint offset)
161{
162 int ret;
163 unsigned long flags;
164
165 spin_lock_irqsave(&cpm_dpmem_lock, flags);
166 ret = rh_free(&cpm_dpmem_info, (void *)offset);
167 spin_unlock_irqrestore(&cpm_dpmem_lock, flags);
168
169 return ret;
170}
171EXPORT_SYMBOL(cpm_dpfree);
172
173/* not sure if this is ever needed */
174uint cpm_dpalloc_fixed(uint offset, uint size, uint align)
175{
176 void *start;
177 unsigned long flags;
178
179 spin_lock_irqsave(&cpm_dpmem_lock, flags);
180 cpm_dpmem_info.alignment = align;
181 start = rh_alloc_fixed(&cpm_dpmem_info, (void *)offset, size, "commproc");
182 spin_unlock_irqrestore(&cpm_dpmem_lock, flags);
183
184 return (uint)start;
185}
186EXPORT_SYMBOL(cpm_dpalloc_fixed);
187
188void cpm_dpdump(void)
189{
190 rh_dump(&cpm_dpmem_info);
191}
192EXPORT_SYMBOL(cpm_dpdump);
193
194void *cpm_dpram_addr(uint offset)
195{
196 return (void *)&cpm2_immr->im_dprambase[offset];
197}
198EXPORT_SYMBOL(cpm_dpram_addr);
diff --git a/arch/ppc/syslib/cpm2_pic.c b/arch/ppc/syslib/cpm2_pic.c
new file mode 100644
index 000000000000..954b07fc1df3
--- /dev/null
+++ b/arch/ppc/syslib/cpm2_pic.c
@@ -0,0 +1,172 @@
1/* The CPM2 internal interrupt controller. It is usually
2 * the only interrupt controller.
3 * There are two 32-bit registers (high/low) for up to 64
4 * possible interrupts.
5 *
6 * Now, the fun starts.....Interrupt Numbers DO NOT MAP
7 * in a simple arithmetic fashion to mask or pending registers.
8 * That is, interrupt 4 does not map to bit position 4.
9 * We create two tables, indexed by vector number, to indicate
10 * which register to use and which bit in the register to use.
11 */
12
13#include <linux/stddef.h>
14#include <linux/init.h>
15#include <linux/sched.h>
16#include <linux/signal.h>
17#include <linux/irq.h>
18
19#include <asm/immap_cpm2.h>
20#include <asm/mpc8260.h>
21
22#include "cpm2_pic.h"
23
24static u_char irq_to_siureg[] = {
25 1, 1, 1, 1, 1, 1, 1, 1,
26 1, 1, 1, 1, 1, 1, 1, 1,
27 0, 0, 0, 0, 0, 0, 0, 0,
28 0, 0, 0, 0, 0, 0, 0, 0,
29 1, 1, 1, 1, 1, 1, 1, 1,
30 1, 1, 1, 1, 1, 1, 1, 1,
31 0, 0, 0, 0, 0, 0, 0, 0,
32 0, 0, 0, 0, 0, 0, 0, 0
33};
34
35/* bit numbers do not match the docs, these are precomputed so the bit for
36 * a given irq is (1 << irq_to_siubit[irq]) */
37static u_char irq_to_siubit[] = {
38 0, 15, 14, 13, 12, 11, 10, 9,
39 8, 7, 6, 5, 4, 3, 2, 1,
40 2, 1, 15, 14, 13, 12, 11, 10,
41 9, 8, 7, 6, 5, 4, 3, 0,
42 31, 30, 29, 28, 27, 26, 25, 24,
43 23, 22, 21, 20, 19, 18, 17, 16,
44 16, 17, 18, 19, 20, 21, 22, 23,
45 24, 25, 26, 27, 28, 29, 30, 31,
46};
47
48static void cpm2_mask_irq(unsigned int irq_nr)
49{
50 int bit, word;
51 volatile uint *simr;
52
53 irq_nr -= CPM_IRQ_OFFSET;
54
55 bit = irq_to_siubit[irq_nr];
56 word = irq_to_siureg[irq_nr];
57
58 simr = &(cpm2_immr->im_intctl.ic_simrh);
59 ppc_cached_irq_mask[word] &= ~(1 << bit);
60 simr[word] = ppc_cached_irq_mask[word];
61}
62
63static void cpm2_unmask_irq(unsigned int irq_nr)
64{
65 int bit, word;
66 volatile uint *simr;
67
68 irq_nr -= CPM_IRQ_OFFSET;
69
70 bit = irq_to_siubit[irq_nr];
71 word = irq_to_siureg[irq_nr];
72
73 simr = &(cpm2_immr->im_intctl.ic_simrh);
74 ppc_cached_irq_mask[word] |= 1 << bit;
75 simr[word] = ppc_cached_irq_mask[word];
76}
77
78static void cpm2_mask_and_ack(unsigned int irq_nr)
79{
80 int bit, word;
81 volatile uint *simr, *sipnr;
82
83 irq_nr -= CPM_IRQ_OFFSET;
84
85 bit = irq_to_siubit[irq_nr];
86 word = irq_to_siureg[irq_nr];
87
88 simr = &(cpm2_immr->im_intctl.ic_simrh);
89 sipnr = &(cpm2_immr->im_intctl.ic_sipnrh);
90 ppc_cached_irq_mask[word] &= ~(1 << bit);
91 simr[word] = ppc_cached_irq_mask[word];
92 sipnr[word] = 1 << bit;
93}
94
95static void cpm2_end_irq(unsigned int irq_nr)
96{
97 int bit, word;
98 volatile uint *simr;
99
100 if (!(irq_desc[irq_nr].status & (IRQ_DISABLED|IRQ_INPROGRESS))
101 && irq_desc[irq_nr].action) {
102
103 irq_nr -= CPM_IRQ_OFFSET;
104 bit = irq_to_siubit[irq_nr];
105 word = irq_to_siureg[irq_nr];
106
107 simr = &(cpm2_immr->im_intctl.ic_simrh);
108 ppc_cached_irq_mask[word] |= 1 << bit;
109 simr[word] = ppc_cached_irq_mask[word];
110 }
111}
112
113static struct hw_interrupt_type cpm2_pic = {
114 .typename = " CPM2 SIU ",
115 .enable = cpm2_unmask_irq,
116 .disable = cpm2_mask_irq,
117 .ack = cpm2_mask_and_ack,
118 .end = cpm2_end_irq,
119};
120
121int cpm2_get_irq(struct pt_regs *regs)
122{
123 int irq;
124 unsigned long bits;
125
126 /* For CPM2, read the SIVEC register and shift the bits down
127 * to get the irq number. */
128 bits = cpm2_immr->im_intctl.ic_sivec;
129 irq = bits >> 26;
130
131 if (irq == 0)
132 return(-1);
133 return irq+CPM_IRQ_OFFSET;
134}
135
136void cpm2_init_IRQ(void)
137{
138 int i;
139
140 /* Clear the CPM IRQ controller, in case it has any bits set
141 * from the bootloader
142 */
143
144 /* Mask out everything */
145 cpm2_immr->im_intctl.ic_simrh = 0x00000000;
146 cpm2_immr->im_intctl.ic_simrl = 0x00000000;
147 wmb();
148
149 /* Ack everything */
150 cpm2_immr->im_intctl.ic_sipnrh = 0xffffffff;
151 cpm2_immr->im_intctl.ic_sipnrl = 0xffffffff;
152 wmb();
153
154 /* Dummy read of the vector */
155 i = cpm2_immr->im_intctl.ic_sivec;
156 rmb();
157
158 /* Initialize the default interrupt mapping priorities,
159 * in case the boot rom changed something on us.
160 */
161 cpm2_immr->im_intctl.ic_sicr = 0;
162 cpm2_immr->im_intctl.ic_scprrh = 0x05309770;
163 cpm2_immr->im_intctl.ic_scprrl = 0x05309770;
164
165
166 /* Enable chaining to OpenPIC, and make everything level
167 */
168 for (i = 0; i < NR_CPM_INTS; i++) {
169 irq_desc[i+CPM_IRQ_OFFSET].handler = &cpm2_pic;
170 irq_desc[i+CPM_IRQ_OFFSET].status |= IRQ_LEVEL;
171 }
172}
diff --git a/arch/ppc/syslib/cpm2_pic.h b/arch/ppc/syslib/cpm2_pic.h
new file mode 100644
index 000000000000..97cab8f13a1a
--- /dev/null
+++ b/arch/ppc/syslib/cpm2_pic.h
@@ -0,0 +1,8 @@
1#ifndef _PPC_KERNEL_CPM2_H
2#define _PPC_KERNEL_CPM2_H
3
4extern int cpm2_get_irq(struct pt_regs *regs);
5
6extern void cpm2_init_IRQ(void);
7
8#endif /* _PPC_KERNEL_CPM2_H */
diff --git a/arch/ppc/syslib/dcr.S b/arch/ppc/syslib/dcr.S
new file mode 100644
index 000000000000..895f10243a43
--- /dev/null
+++ b/arch/ppc/syslib/dcr.S
@@ -0,0 +1,41 @@
1/*
2 * arch/ppc/syslib/dcr.S
3 *
4 * "Indirect" DCR access
5 *
6 * Copyright (c) 2004 Eugene Surovegin <ebs@ebshome.net>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14#include <asm/ppc_asm.h>
15#include <asm/processor.h>
16
17#define DCR_ACCESS_PROLOG(table) \
18 rlwinm r3,r3,4,18,27; \
19 lis r5,table@h; \
20 ori r5,r5,table@l; \
21 add r3,r3,r5; \
22 mtctr r3; \
23 bctr
24
25_GLOBAL(__mfdcr)
26 DCR_ACCESS_PROLOG(__mfdcr_table)
27
28_GLOBAL(__mtdcr)
29 DCR_ACCESS_PROLOG(__mtdcr_table)
30
31__mfdcr_table:
32 mfdcr r3,0; blr
33__mtdcr_table:
34 mtdcr 0,r4; blr
35
36dcr = 1
37 .rept 1023
38 mfdcr r3,dcr; blr
39 mtdcr dcr,r4; blr
40 dcr = dcr + 1
41 .endr
diff --git a/arch/ppc/syslib/gen550.h b/arch/ppc/syslib/gen550.h
new file mode 100644
index 000000000000..039d249e19a8
--- /dev/null
+++ b/arch/ppc/syslib/gen550.h
@@ -0,0 +1,16 @@
1/*
2 * arch/ppc/syslib/gen550.h
3 *
4 * gen550 prototypes
5 *
6 * Matt Porter <mporter@kernel.crashing.org>
7 *
8 * 2004 (c) MontaVista Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
11 * or implied.
12 */
13
14extern void gen550_progress(char *, unsigned short);
15extern void gen550_init(int, struct uart_port *);
16extern void gen550_kgdb_map_scc(void);
diff --git a/arch/ppc/syslib/gen550_dbg.c b/arch/ppc/syslib/gen550_dbg.c
new file mode 100644
index 000000000000..9ef0113c83d1
--- /dev/null
+++ b/arch/ppc/syslib/gen550_dbg.c
@@ -0,0 +1,182 @@
1/*
2 * arch/ppc/syslib/gen550_dbg.c
3 *
4 * A library of polled 16550 serial routines. These are intended to
5 * be used to support progress messages, xmon, kgdb, etc. on a
6 * variety of platforms.
7 *
8 * Adapted from lots of code ripped from the arch/ppc/boot/ polled
9 * 16550 support.
10 *
11 * Author: Matt Porter <mporter@mvista.com>
12 *
13 * 2002-2003 (c) MontaVista Software, Inc. This file is licensed under
14 * the terms of the GNU General Public License version 2. This program
15 * is licensed "as is" without any warranty of any kind, whether express
16 * or implied.
17 */
18
19#include <linux/config.h>
20#include <linux/types.h>
21#include <linux/serial.h>
22#include <linux/tty.h> /* For linux/serial_core.h */
23#include <linux/serial_core.h>
24#include <linux/serialP.h>
25#include <linux/serial_reg.h>
26#include <asm/machdep.h>
27#include <asm/serial.h>
28#include <asm/io.h>
29
30#define SERIAL_BAUD 9600
31
32/* SERIAL_PORT_DFNS is defined in <asm/serial.h> */
33#ifndef SERIAL_PORT_DFNS
34#define SERIAL_PORT_DFNS
35#endif
36
37static struct serial_state rs_table[RS_TABLE_SIZE] = {
38 SERIAL_PORT_DFNS /* defined in <asm/serial.h> */
39};
40
41static void (*serial_outb)(unsigned long, unsigned char);
42static unsigned long (*serial_inb)(unsigned long);
43
44static int shift;
45
46unsigned long direct_inb(unsigned long addr)
47{
48 return readb((void __iomem *)addr);
49}
50
51void direct_outb(unsigned long addr, unsigned char val)
52{
53 writeb(val, (void __iomem *)addr);
54}
55
56unsigned long io_inb(unsigned long port)
57{
58 return inb(port);
59}
60
61void io_outb(unsigned long port, unsigned char val)
62{
63 outb(val, port);
64}
65
66unsigned long serial_init(int chan, void *ignored)
67{
68 unsigned long com_port;
69 unsigned char lcr, dlm;
70
71 /* We need to find out which type io we're expecting. If it's
72 * 'SERIAL_IO_PORT', we get an offset from the isa_io_base.
73 * If it's 'SERIAL_IO_MEM', we can the exact location. -- Tom */
74 switch (rs_table[chan].io_type) {
75 case SERIAL_IO_PORT:
76 com_port = rs_table[chan].port;
77 serial_outb = io_outb;
78 serial_inb = io_inb;
79 break;
80 case SERIAL_IO_MEM:
81 com_port = (unsigned long)rs_table[chan].iomem_base;
82 serial_outb = direct_outb;
83 serial_inb = direct_inb;
84 break;
85 default:
86 /* We can't deal with it. */
87 return -1;
88 }
89
90 /* How far apart the registers are. */
91 shift = rs_table[chan].iomem_reg_shift;
92
93 /* save the LCR */
94 lcr = serial_inb(com_port + (UART_LCR << shift));
95
96 /* Access baud rate */
97 serial_outb(com_port + (UART_LCR << shift), UART_LCR_DLAB);
98 dlm = serial_inb(com_port + (UART_DLM << shift));
99
100 /*
101 * Test if serial port is unconfigured
102 * We assume that no-one uses less than 110 baud or
103 * less than 7 bits per character these days.
104 * -- paulus.
105 */
106 if ((dlm <= 4) && (lcr & 2)) {
107 /* port is configured, put the old LCR back */
108 serial_outb(com_port + (UART_LCR << shift), lcr);
109 }
110 else {
111 /* Input clock. */
112 serial_outb(com_port + (UART_DLL << shift),
113 (rs_table[chan].baud_base / SERIAL_BAUD) & 0xFF);
114 serial_outb(com_port + (UART_DLM << shift),
115 (rs_table[chan].baud_base / SERIAL_BAUD) >> 8);
116 /* 8 data, 1 stop, no parity */
117 serial_outb(com_port + (UART_LCR << shift), 0x03);
118 /* RTS/DTR */
119 serial_outb(com_port + (UART_MCR << shift), 0x03);
120
121 /* Clear & enable FIFOs */
122 serial_outb(com_port + (UART_FCR << shift), 0x07);
123 }
124
125 return (com_port);
126}
127
128void
129serial_putc(unsigned long com_port, unsigned char c)
130{
131 while ((serial_inb(com_port + (UART_LSR << shift)) & UART_LSR_THRE) == 0)
132 ;
133 serial_outb(com_port, c);
134}
135
136unsigned char
137serial_getc(unsigned long com_port)
138{
139 while ((serial_inb(com_port + (UART_LSR << shift)) & UART_LSR_DR) == 0)
140 ;
141 return serial_inb(com_port);
142}
143
144int
145serial_tstc(unsigned long com_port)
146{
147 return ((serial_inb(com_port + (UART_LSR << shift)) & UART_LSR_DR) != 0);
148}
149
150void
151serial_close(unsigned long com_port)
152{
153}
154
155void
156gen550_init(int i, struct uart_port *serial_req)
157{
158 rs_table[i].io_type = serial_req->iotype;
159 rs_table[i].port = serial_req->iobase;
160 rs_table[i].iomem_base = serial_req->membase;
161 rs_table[i].iomem_reg_shift = serial_req->regshift;
162 rs_table[i].baud_base = serial_req->uartclk ? serial_req->uartclk / 16 : BASE_BAUD;
163}
164
165#ifdef CONFIG_SERIAL_TEXT_DEBUG
166void
167gen550_progress(char *s, unsigned short hex)
168{
169 volatile unsigned int progress_debugport;
170 volatile char c;
171
172 progress_debugport = serial_init(0, NULL);
173
174 serial_putc(progress_debugport, '\r');
175
176 while ((c = *s++) != 0)
177 serial_putc(progress_debugport, c);
178
179 serial_putc(progress_debugport, '\n');
180 serial_putc(progress_debugport, '\r');
181}
182#endif /* CONFIG_SERIAL_TEXT_DEBUG */
diff --git a/arch/ppc/syslib/gen550_kgdb.c b/arch/ppc/syslib/gen550_kgdb.c
new file mode 100644
index 000000000000..7239d5d7ddcd
--- /dev/null
+++ b/arch/ppc/syslib/gen550_kgdb.c
@@ -0,0 +1,86 @@
1/*
2 * arch/ppc/syslib/gen550_kgdb.c
3 *
4 * Generic 16550 kgdb support intended to be useful on a variety
5 * of platforms. To enable this support, it is necessary to set
6 * the CONFIG_GEN550 option. Any virtual mapping of the serial
7 * port(s) to be used can be accomplished by setting
8 * ppc_md.early_serial_map to a platform-specific mapping function.
9 *
10 * Adapted from ppc4xx_kgdb.c.
11 *
12 * Author: Matt Porter <mporter@kernel.crashing.org>
13 *
14 * 2002-2004 (c) MontaVista Software, Inc. This file is licensed under
15 * the terms of the GNU General Public License version 2. This program
16 * is licensed "as is" without any warranty of any kind, whether express
17 * or implied.
18 */
19
20#include <linux/config.h>
21#include <linux/types.h>
22#include <linux/kernel.h>
23
24#include <asm/machdep.h>
25
26extern unsigned long serial_init(int, void *);
27extern unsigned long serial_getc(unsigned long);
28extern unsigned long serial_putc(unsigned long, unsigned char);
29
30#if defined(CONFIG_KGDB_TTYS0)
31#define KGDB_PORT 0
32#elif defined(CONFIG_KGDB_TTYS1)
33#define KGDB_PORT 1
34#elif defined(CONFIG_KGDB_TTYS2)
35#define KGDB_PORT 2
36#elif defined(CONFIG_KGDB_TTYS3)
37#define KGDB_PORT 3
38#else
39#error "invalid kgdb_tty port"
40#endif
41
42static volatile unsigned int kgdb_debugport;
43
44void putDebugChar(unsigned char c)
45{
46 if (kgdb_debugport == 0)
47 kgdb_debugport = serial_init(KGDB_PORT, NULL);
48
49 serial_putc(kgdb_debugport, c);
50}
51
52int getDebugChar(void)
53{
54 if (kgdb_debugport == 0)
55 kgdb_debugport = serial_init(KGDB_PORT, NULL);
56
57 return(serial_getc(kgdb_debugport));
58}
59
60void kgdb_interruptible(int enable)
61{
62 return;
63}
64
65void putDebugString(char* str)
66{
67 while (*str != '\0') {
68 putDebugChar(*str);
69 str++;
70 }
71 putDebugChar('\r');
72 return;
73}
74
75/*
76 * Note: gen550_init() must be called already on the port we are going
77 * to use.
78 */
79void
80gen550_kgdb_map_scc(void)
81{
82 printk(KERN_DEBUG "kgdb init\n");
83 if (ppc_md.early_serial_map)
84 ppc_md.early_serial_map();
85 kgdb_debugport = serial_init(KGDB_PORT, NULL);
86}
diff --git a/arch/ppc/syslib/gt64260_pic.c b/arch/ppc/syslib/gt64260_pic.c
new file mode 100644
index 000000000000..44aa87385451
--- /dev/null
+++ b/arch/ppc/syslib/gt64260_pic.c
@@ -0,0 +1,328 @@
1/*
2 * arch/ppc/syslib/gt64260_pic.c
3 *
4 * Interrupt controller support for Galileo's GT64260.
5 *
6 * Author: Chris Zankel <source@mvista.com>
7 * Modified by: Mark A. Greer <mgreer@mvista.com>
8 *
9 * Based on sources from Rabeeh Khoury / Galileo Technology
10 *
11 * 2001 (c) MontaVista, Software, Inc. This file is licensed under
12 * the terms of the GNU General Public License version 2. This program
13 * is licensed "as is" without any warranty of any kind, whether express
14 * or implied.
15 */
16
17/*
18 * This file contains the specific functions to support the GT64260
19 * interrupt controller.
20 *
21 * The GT64260 has two main interrupt registers (high and low) that
22 * summarizes the interrupts generated by the units of the GT64260.
23 * Each bit is assigned to an interrupt number, where the low register
24 * are assigned from IRQ0 to IRQ31 and the high cause register
25 * from IRQ32 to IRQ63
26 * The GPP (General Purpose Port) interrupts are assigned from IRQ64 (GPP0)
27 * to IRQ95 (GPP31).
28 * get_irq() returns the lowest interrupt number that is currently asserted.
29 *
30 * Note:
31 * - This driver does not initialize the GPP when used as an interrupt
32 * input.
33 */
34
35#include <linux/stddef.h>
36#include <linux/init.h>
37#include <linux/interrupt.h>
38#include <linux/sched.h>
39#include <linux/signal.h>
40#include <linux/stddef.h>
41#include <linux/delay.h>
42#include <linux/irq.h>
43
44#include <asm/io.h>
45#include <asm/system.h>
46#include <asm/irq.h>
47#include <asm/mv64x60.h>
48
49#define CPU_INTR_STR "gt64260 cpu interface error"
50#define PCI0_INTR_STR "gt64260 pci 0 error"
51#define PCI1_INTR_STR "gt64260 pci 1 error"
52
53/* ========================== forward declaration ========================== */
54
55static void gt64260_unmask_irq(unsigned int);
56static void gt64260_mask_irq(unsigned int);
57
58/* ========================== local declarations =========================== */
59
60struct hw_interrupt_type gt64260_pic = {
61 .typename = " gt64260_pic ",
62 .enable = gt64260_unmask_irq,
63 .disable = gt64260_mask_irq,
64 .ack = gt64260_mask_irq,
65 .end = gt64260_unmask_irq,
66};
67
68u32 gt64260_irq_base = 0; /* GT64260 handles the next 96 IRQs from here */
69
70static struct mv64x60_handle bh;
71
72/* gt64260_init_irq()
73 *
74 * This function initializes the interrupt controller. It assigns
75 * all interrupts from IRQ0 to IRQ95 to the gt64260 interrupt controller.
76 *
77 * Note:
78 * We register all GPP inputs as interrupt source, but disable them.
79 */
80void __init
81gt64260_init_irq(void)
82{
83 int i;
84
85 if (ppc_md.progress)
86 ppc_md.progress("gt64260_init_irq: enter", 0x0);
87
88 bh.v_base = mv64x60_get_bridge_vbase();
89
90 ppc_cached_irq_mask[0] = 0;
91 ppc_cached_irq_mask[1] = 0x0f000000; /* Enable GPP intrs */
92 ppc_cached_irq_mask[2] = 0;
93
94 /* disable all interrupts and clear current interrupts */
95 mv64x60_write(&bh, MV64x60_GPP_INTR_MASK, ppc_cached_irq_mask[2]);
96 mv64x60_write(&bh, MV64x60_GPP_INTR_CAUSE, 0);
97 mv64x60_write(&bh, GT64260_IC_CPU_INTR_MASK_LO, ppc_cached_irq_mask[0]);
98 mv64x60_write(&bh, GT64260_IC_CPU_INTR_MASK_HI, ppc_cached_irq_mask[1]);
99
100 /* use the gt64260 for all (possible) interrupt sources */
101 for (i = gt64260_irq_base; i < (gt64260_irq_base + 96); i++)
102 irq_desc[i].handler = &gt64260_pic;
103
104 if (ppc_md.progress)
105 ppc_md.progress("gt64260_init_irq: exit", 0x0);
106}
107
108/*
109 * gt64260_get_irq()
110 *
111 * This function returns the lowest interrupt number of all interrupts that
112 * are currently asserted.
113 *
114 * Input Variable(s):
115 * struct pt_regs* not used
116 *
117 * Output Variable(s):
118 * None.
119 *
120 * Returns:
121 * int <interrupt number> or -2 (bogus interrupt)
122 */
123int
124gt64260_get_irq(struct pt_regs *regs)
125{
126 int irq;
127 int irq_gpp;
128
129 irq = mv64x60_read(&bh, GT64260_IC_MAIN_CAUSE_LO);
130 irq = __ilog2((irq & 0x3dfffffe) & ppc_cached_irq_mask[0]);
131
132 if (irq == -1) {
133 irq = mv64x60_read(&bh, GT64260_IC_MAIN_CAUSE_HI);
134 irq = __ilog2((irq & 0x0f000db7) & ppc_cached_irq_mask[1]);
135
136 if (irq == -1)
137 irq = -2; /* bogus interrupt, should never happen */
138 else {
139 if (irq >= 24) {
140 irq_gpp = mv64x60_read(&bh,
141 MV64x60_GPP_INTR_CAUSE);
142 irq_gpp = __ilog2(irq_gpp &
143 ppc_cached_irq_mask[2]);
144
145 if (irq_gpp == -1)
146 irq = -2;
147 else {
148 irq = irq_gpp + 64;
149 mv64x60_write(&bh,
150 MV64x60_GPP_INTR_CAUSE,
151 ~(1 << (irq - 64)));
152 }
153 } else
154 irq += 32;
155 }
156 }
157
158 (void)mv64x60_read(&bh, MV64x60_GPP_INTR_CAUSE);
159
160 if (irq < 0)
161 return (irq);
162 else
163 return (gt64260_irq_base + irq);
164}
165
166/* gt64260_unmask_irq()
167 *
168 * This function enables an interrupt.
169 *
170 * Input Variable(s):
171 * unsigned int interrupt number (IRQ0...IRQ95).
172 *
173 * Output Variable(s):
174 * None.
175 *
176 * Returns:
177 * void
178 */
179static void
180gt64260_unmask_irq(unsigned int irq)
181{
182 irq -= gt64260_irq_base;
183
184 if (irq > 31)
185 if (irq > 63) /* unmask GPP irq */
186 mv64x60_write(&bh, MV64x60_GPP_INTR_MASK,
187 ppc_cached_irq_mask[2] |= (1 << (irq - 64)));
188 else /* mask high interrupt register */
189 mv64x60_write(&bh, GT64260_IC_CPU_INTR_MASK_HI,
190 ppc_cached_irq_mask[1] |= (1 << (irq - 32)));
191 else /* mask low interrupt register */
192 mv64x60_write(&bh, GT64260_IC_CPU_INTR_MASK_LO,
193 ppc_cached_irq_mask[0] |= (1 << irq));
194
195 (void)mv64x60_read(&bh, MV64x60_GPP_INTR_MASK);
196 return;
197}
198
199/* gt64260_mask_irq()
200 *
201 * This function disables the requested interrupt.
202 *
203 * Input Variable(s):
204 * unsigned int interrupt number (IRQ0...IRQ95).
205 *
206 * Output Variable(s):
207 * None.
208 *
209 * Returns:
210 * void
211 */
212static void
213gt64260_mask_irq(unsigned int irq)
214{
215 irq -= gt64260_irq_base;
216
217 if (irq > 31)
218 if (irq > 63) /* mask GPP irq */
219 mv64x60_write(&bh, MV64x60_GPP_INTR_MASK,
220 ppc_cached_irq_mask[2] &= ~(1 << (irq - 64)));
221 else /* mask high interrupt register */
222 mv64x60_write(&bh, GT64260_IC_CPU_INTR_MASK_HI,
223 ppc_cached_irq_mask[1] &= ~(1 << (irq - 32)));
224 else /* mask low interrupt register */
225 mv64x60_write(&bh, GT64260_IC_CPU_INTR_MASK_LO,
226 ppc_cached_irq_mask[0] &= ~(1 << irq));
227
228 (void)mv64x60_read(&bh, MV64x60_GPP_INTR_MASK);
229 return;
230}
231
232static irqreturn_t
233gt64260_cpu_error_int_handler(int irq, void *dev_id, struct pt_regs *regs)
234{
235 printk(KERN_ERR "gt64260_cpu_error_int_handler: %s 0x%08x\n",
236 "Error on CPU interface - Cause regiser",
237 mv64x60_read(&bh, MV64x60_CPU_ERR_CAUSE));
238 printk(KERN_ERR "\tCPU error register dump:\n");
239 printk(KERN_ERR "\tAddress low 0x%08x\n",
240 mv64x60_read(&bh, MV64x60_CPU_ERR_ADDR_LO));
241 printk(KERN_ERR "\tAddress high 0x%08x\n",
242 mv64x60_read(&bh, MV64x60_CPU_ERR_ADDR_HI));
243 printk(KERN_ERR "\tData low 0x%08x\n",
244 mv64x60_read(&bh, MV64x60_CPU_ERR_DATA_LO));
245 printk(KERN_ERR "\tData high 0x%08x\n",
246 mv64x60_read(&bh, MV64x60_CPU_ERR_DATA_HI));
247 printk(KERN_ERR "\tParity 0x%08x\n",
248 mv64x60_read(&bh, MV64x60_CPU_ERR_PARITY));
249 mv64x60_write(&bh, MV64x60_CPU_ERR_CAUSE, 0);
250 return IRQ_HANDLED;
251}
252
253static irqreturn_t
254gt64260_pci_error_int_handler(int irq, void *dev_id, struct pt_regs *regs)
255{
256 u32 val;
257 unsigned int pci_bus = (unsigned int)dev_id;
258
259 if (pci_bus == 0) { /* Error on PCI 0 */
260 val = mv64x60_read(&bh, MV64x60_PCI0_ERR_CAUSE);
261 printk(KERN_ERR "%s: Error in PCI %d Interface\n",
262 "gt64260_pci_error_int_handler", pci_bus);
263 printk(KERN_ERR "\tPCI %d error register dump:\n", pci_bus);
264 printk(KERN_ERR "\tCause register 0x%08x\n", val);
265 printk(KERN_ERR "\tAddress Low 0x%08x\n",
266 mv64x60_read(&bh, MV64x60_PCI0_ERR_ADDR_LO));
267 printk(KERN_ERR "\tAddress High 0x%08x\n",
268 mv64x60_read(&bh, MV64x60_PCI0_ERR_ADDR_HI));
269 printk(KERN_ERR "\tAttribute 0x%08x\n",
270 mv64x60_read(&bh, MV64x60_PCI0_ERR_DATA_LO));
271 printk(KERN_ERR "\tCommand 0x%08x\n",
272 mv64x60_read(&bh, MV64x60_PCI0_ERR_CMD));
273 mv64x60_write(&bh, MV64x60_PCI0_ERR_CAUSE, ~val);
274 }
275 if (pci_bus == 1) { /* Error on PCI 1 */
276 val = mv64x60_read(&bh, MV64x60_PCI1_ERR_CAUSE);
277 printk(KERN_ERR "%s: Error in PCI %d Interface\n",
278 "gt64260_pci_error_int_handler", pci_bus);
279 printk(KERN_ERR "\tPCI %d error register dump:\n", pci_bus);
280 printk(KERN_ERR "\tCause register 0x%08x\n", val);
281 printk(KERN_ERR "\tAddress Low 0x%08x\n",
282 mv64x60_read(&bh, MV64x60_PCI1_ERR_ADDR_LO));
283 printk(KERN_ERR "\tAddress High 0x%08x\n",
284 mv64x60_read(&bh, MV64x60_PCI1_ERR_ADDR_HI));
285 printk(KERN_ERR "\tAttribute 0x%08x\n",
286 mv64x60_read(&bh, MV64x60_PCI1_ERR_DATA_LO));
287 printk(KERN_ERR "\tCommand 0x%08x\n",
288 mv64x60_read(&bh, MV64x60_PCI1_ERR_CMD));
289 mv64x60_write(&bh, MV64x60_PCI1_ERR_CAUSE, ~val);
290 }
291 return IRQ_HANDLED;
292}
293
294static int __init
295gt64260_register_hdlrs(void)
296{
297 int rc;
298
299 /* Register CPU interface error interrupt handler */
300 if ((rc = request_irq(MV64x60_IRQ_CPU_ERR,
301 gt64260_cpu_error_int_handler, SA_INTERRUPT, CPU_INTR_STR, 0)))
302 printk(KERN_WARNING "Can't register cpu error handler: %d", rc);
303
304 mv64x60_write(&bh, MV64x60_CPU_ERR_MASK, 0);
305 mv64x60_write(&bh, MV64x60_CPU_ERR_MASK, 0x000000fe);
306
307 /* Register PCI 0 error interrupt handler */
308 if ((rc = request_irq(MV64360_IRQ_PCI0, gt64260_pci_error_int_handler,
309 SA_INTERRUPT, PCI0_INTR_STR, (void *)0)))
310 printk(KERN_WARNING "Can't register pci 0 error handler: %d",
311 rc);
312
313 mv64x60_write(&bh, MV64x60_PCI0_ERR_MASK, 0);
314 mv64x60_write(&bh, MV64x60_PCI0_ERR_MASK, 0x003c0c24);
315
316 /* Register PCI 1 error interrupt handler */
317 if ((rc = request_irq(MV64360_IRQ_PCI1, gt64260_pci_error_int_handler,
318 SA_INTERRUPT, PCI1_INTR_STR, (void *)1)))
319 printk(KERN_WARNING "Can't register pci 1 error handler: %d",
320 rc);
321
322 mv64x60_write(&bh, MV64x60_PCI1_ERR_MASK, 0);
323 mv64x60_write(&bh, MV64x60_PCI1_ERR_MASK, 0x003c0c24);
324
325 return 0;
326}
327
328arch_initcall(gt64260_register_hdlrs);
diff --git a/arch/ppc/syslib/harrier.c b/arch/ppc/syslib/harrier.c
new file mode 100644
index 000000000000..a6b3f8645793
--- /dev/null
+++ b/arch/ppc/syslib/harrier.c
@@ -0,0 +1,302 @@
1/*
2 * arch/ppc/syslib/harrier.c
3 *
4 * Motorola MCG Harrier northbridge/memory controller support
5 *
6 * Author: Dale Farnsworth
7 * dale.farnsworth@mvista.com
8 *
9 * 2001 (c) MontaVista, Software, Inc. This file is licensed under
10 * the terms of the GNU General Public License version 2. This program
11 * is licensed "as is" without any warranty of any kind, whether express
12 * or implied.
13 */
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/pci.h>
17#include <linux/harrier_defs.h>
18
19#include <asm/byteorder.h>
20#include <asm/io.h>
21#include <asm/irq.h>
22#include <asm/pci.h>
23#include <asm/pci-bridge.h>
24#include <asm/open_pic.h>
25#include <asm/harrier.h>
26
27/* define defaults for inbound windows */
28#define HARRIER_ITAT_DEFAULT (HARRIER_ITAT_ENA | \
29 HARRIER_ITAT_MEM | \
30 HARRIER_ITAT_WPE | \
31 HARRIER_ITAT_GBL)
32
33#define HARRIER_MPAT_DEFAULT (HARRIER_ITAT_ENA | \
34 HARRIER_ITAT_MEM | \
35 HARRIER_ITAT_WPE | \
36 HARRIER_ITAT_GBL)
37
38/*
39 * Initialize the inbound window size on a non-monarch harrier.
40 */
41void __init harrier_setup_nonmonarch(uint ppc_reg_base, uint in0_size)
42{
43 u16 temps;
44 u32 temp;
45
46 if (in0_size > HARRIER_ITSZ_2GB) {
47 printk
48 ("harrier_setup_nonmonarch: Invalid window size code %d\n",
49 in0_size);
50 return;
51 }
52
53 /* Clear the PCI memory enable bit. If we don't, then when the
54 * inbound windows are enabled below, the corresponding BARs will be
55 * "live" and start answering to PCI memory reads from their default
56 * addresses (0x0), which overlap with system RAM.
57 */
58 temps = in_le16((u16 *) (ppc_reg_base +
59 HARRIER_XCSR_CONFIG(PCI_COMMAND)));
60 temps &= ~(PCI_COMMAND_MEMORY);
61 out_le16((u16 *) (ppc_reg_base + HARRIER_XCSR_CONFIG(PCI_COMMAND)),
62 temps);
63
64 /* Setup a non-prefetchable inbound window */
65 out_le32((u32 *) (ppc_reg_base +
66 HARRIER_XCSR_CONFIG(HARRIER_ITSZ0_OFF)), in0_size);
67
68 temp = in_le32((u32 *) (ppc_reg_base +
69 HARRIER_XCSR_CONFIG(HARRIER_ITAT0_OFF)));
70 temp &= ~HARRIER_ITAT_PRE;
71 temp |= HARRIER_ITAT_DEFAULT;
72 out_le32((u32 *) (ppc_reg_base +
73 HARRIER_XCSR_CONFIG(HARRIER_ITAT0_OFF)), temp);
74
75 /* Enable the message passing block */
76 temp = in_le32((u32 *) (ppc_reg_base +
77 HARRIER_XCSR_CONFIG(HARRIER_MPAT_OFF)));
78 temp |= HARRIER_MPAT_DEFAULT;
79 out_le32((u32 *) (ppc_reg_base +
80 HARRIER_XCSR_CONFIG(HARRIER_MPAT_OFF)), temp);
81}
82
83void __init harrier_release_eready(uint ppc_reg_base)
84{
85 ulong temp;
86
87 /*
88 * Set EREADY to allow the line to be pulled up after everyone is
89 * ready.
90 */
91 temp = in_be32((uint *) (ppc_reg_base + HARRIER_MISC_CSR_OFF));
92 temp |= HARRIER_EREADY;
93 out_be32((uint *) (ppc_reg_base + HARRIER_MISC_CSR_OFF), temp);
94}
95
96void __init harrier_wait_eready(uint ppc_reg_base)
97{
98 ulong temp;
99
100 /*
101 * Poll the ERDYS line until it goes high to indicate that all
102 * non-monarch PrPMCs are ready for bus enumeration (or that there are
103 * no PrPMCs present).
104 */
105
106 /* FIXME: Add a timeout of some kind to prevent endless waits. */
107 do {
108
109 temp = in_be32((uint *) (ppc_reg_base + HARRIER_MISC_CSR_OFF));
110
111 } while (!(temp & HARRIER_ERDYS));
112}
113
114/*
115 * Initialize the Motorola MCG Harrier host bridge.
116 *
117 * This means setting up the PPC bus to PCI memory and I/O space mappings,
118 * setting the PCI memory space address of the MPIC (mapped straight
119 * through), and ioremap'ing the mpic registers.
120 * 'OpenPIC_Addr' will be set correctly by this routine.
121 * This routine will not change the PCI_CONFIG_ADDR or PCI_CONFIG_DATA
122 * addresses and assumes that the mapping of PCI memory space back to system
123 * memory is set up correctly by PPCBug.
124 */
125int __init
126harrier_init(struct pci_controller *hose,
127 uint ppc_reg_base,
128 ulong processor_pci_mem_start,
129 ulong processor_pci_mem_end,
130 ulong processor_pci_io_start,
131 ulong processor_pci_io_end, ulong processor_mpic_base)
132{
133 uint addr, offset;
134
135 /*
136 * Some sanity checks...
137 */
138 if (((processor_pci_mem_start & 0xffff0000) != processor_pci_mem_start)
139 || ((processor_pci_io_start & 0xffff0000) !=
140 processor_pci_io_start)) {
141 printk("harrier_init: %s\n",
142 "PPC to PCI mappings must start on 64 KB boundaries");
143 return -1;
144 }
145
146 if (((processor_pci_mem_end & 0x0000ffff) != 0x0000ffff) ||
147 ((processor_pci_io_end & 0x0000ffff) != 0x0000ffff)) {
148 printk("harrier_init: PPC to PCI mappings %s\n",
149 "must end just before a 64 KB boundaries");
150 return -1;
151 }
152
153 if (((processor_pci_mem_end - processor_pci_mem_start) !=
154 (hose->mem_space.end - hose->mem_space.start)) ||
155 ((processor_pci_io_end - processor_pci_io_start) !=
156 (hose->io_space.end - hose->io_space.start))) {
157 printk("harrier_init: %s\n",
158 "PPC and PCI memory or I/O space sizes don't match");
159 return -1;
160 }
161
162 if ((processor_mpic_base & 0xfffc0000) != processor_mpic_base) {
163 printk("harrier_init: %s\n",
164 "MPIC address must start on 256 KB boundary");
165 return -1;
166 }
167
168 if ((pci_dram_offset & 0xffff0000) != pci_dram_offset) {
169 printk("harrier_init: %s\n",
170 "pci_dram_offset must be multiple of 64 KB");
171 return -1;
172 }
173
174 /*
175 * Program the OTAD/OTOF registers to set up the PCI Mem & I/O
176 * space mappings. These are the mappings going from the processor to
177 * the PCI bus.
178 *
179 * Note: Don't need to 'AND' start/end addresses with 0xffff0000
180 * because sanity check above ensures that they are properly
181 * aligned.
182 */
183
184 /* Set up PPC->PCI Mem mapping */
185 addr = processor_pci_mem_start | (processor_pci_mem_end >> 16);
186#ifdef CONFIG_HARRIER_STORE_GATHERING
187 offset = (hose->mem_space.start - processor_pci_mem_start) | 0x9a;
188#else
189 offset = (hose->mem_space.start - processor_pci_mem_start) | 0x92;
190#endif
191 out_be32((uint *) (ppc_reg_base + HARRIER_OTAD0_OFF), addr);
192 out_be32((uint *) (ppc_reg_base + HARRIER_OTOF0_OFF), offset);
193
194 /* Set up PPC->PCI I/O mapping -- Contiguous I/O space */
195 addr = processor_pci_io_start | (processor_pci_io_end >> 16);
196 offset = (hose->io_space.start - processor_pci_io_start) | 0x80;
197 out_be32((uint *) (ppc_reg_base + HARRIER_OTAD1_OFF), addr);
198 out_be32((uint *) (ppc_reg_base + HARRIER_OTOF1_OFF), offset);
199
200 /* Enable MPIC */
201 OpenPIC_Addr = (void *)processor_mpic_base;
202 addr = (processor_mpic_base >> 16) | 1;
203 out_be16((ushort *) (ppc_reg_base + HARRIER_MBAR_OFF), addr);
204 out_8((u_char *) (ppc_reg_base + HARRIER_MPIC_CSR_OFF),
205 HARRIER_MPIC_OPI_ENABLE);
206
207 return 0;
208}
209
210/*
211 * Find the amount of RAM present.
212 * This assumes that PPCBug has initialized the memory controller (SMC)
213 * on the Harrier correctly (i.e., it does no sanity checking).
214 * It also assumes that the memory base registers are set to configure the
215 * memory as contigous starting with "RAM A BASE", "RAM B BASE", etc.
216 * however, RAM base registers can be skipped (e.g. A, B, C are set,
217 * D is skipped but E is set is okay).
218 */
219#define MB (1024*1024UL)
220
221static uint harrier_size_table[] __initdata = {
222 0 * MB, /* 0 ==> 0 MB */
223 32 * MB, /* 1 ==> 32 MB */
224 64 * MB, /* 2 ==> 64 MB */
225 64 * MB, /* 3 ==> 64 MB */
226 128 * MB, /* 4 ==> 128 MB */
227 128 * MB, /* 5 ==> 128 MB */
228 128 * MB, /* 6 ==> 128 MB */
229 256 * MB, /* 7 ==> 256 MB */
230 256 * MB, /* 8 ==> 256 MB */
231 256 * MB, /* 9 ==> 256 MB */
232 512 * MB, /* a ==> 512 MB */
233 512 * MB, /* b ==> 512 MB */
234 512 * MB, /* c ==> 512 MB */
235 1024 * MB, /* d ==> 1024 MB */
236 1024 * MB, /* e ==> 1024 MB */
237 2048 * MB, /* f ==> 2048 MB */
238};
239
240/*
241 * *** WARNING: You MUST have a BAT set up to map in the XCSR regs ***
242 *
243 * Read the memory controller's registers to determine the amount of system
244 * memory. Assumes that the memory controller registers are already mapped
245 * into virtual memory--too early to use ioremap().
246 */
247unsigned long __init harrier_get_mem_size(uint xcsr_base)
248{
249 ulong last_addr;
250 int i;
251 uint vend_dev_id;
252 uint *size_table;
253 uint val;
254 uint *csrp;
255 uint size;
256 int size_table_entries;
257
258 vend_dev_id = in_be32((uint *) xcsr_base + PCI_VENDOR_ID);
259
260 if (((vend_dev_id & 0xffff0000) >> 16) != PCI_VENDOR_ID_MOTOROLA) {
261 printk("harrier_get_mem_size: %s (0x%x)\n",
262 "Not a Motorola Memory Controller", vend_dev_id);
263 return 0;
264 }
265
266 vend_dev_id &= 0x0000ffff;
267
268 if (vend_dev_id == PCI_DEVICE_ID_MOTOROLA_HARRIER) {
269 size_table = harrier_size_table;
270 size_table_entries = sizeof(harrier_size_table) /
271 sizeof(harrier_size_table[0]);
272 } else {
273 printk("harrier_get_mem_size: %s (0x%x)\n",
274 "Not a Harrier", vend_dev_id);
275 return 0;
276 }
277
278 last_addr = 0;
279
280 csrp = (uint *) (xcsr_base + HARRIER_SDBA_OFF);
281 for (i = 0; i < 8; i++) {
282 val = in_be32(csrp++);
283
284 if (val & 0x100) { /* If enabled */
285 size = val >> HARRIER_SDB_SIZE_SHIFT;
286 size &= HARRIER_SDB_SIZE_MASK;
287 if (size >= size_table_entries) {
288 break; /* Register not set correctly */
289 }
290 size = size_table[size];
291
292 val &= ~(size - 1);
293 val += size;
294
295 if (val > last_addr) {
296 last_addr = val;
297 }
298 }
299 }
300
301 return last_addr;
302}
diff --git a/arch/ppc/syslib/hawk_common.c b/arch/ppc/syslib/hawk_common.c
new file mode 100644
index 000000000000..a9911dc3a82f
--- /dev/null
+++ b/arch/ppc/syslib/hawk_common.c
@@ -0,0 +1,319 @@
1/*
2 * arch/ppc/syslib/hawk_common.c
3 *
4 * Common Motorola PowerPlus Platform--really Falcon/Raven or HAWK.
5 *
6 * Author: Mark A. Greer
7 * mgreer@mvista.com
8 *
9 * 2001 (c) MontaVista, Software, Inc. This file is licensed under
10 * the terms of the GNU General Public License version 2. This program
11 * is licensed "as is" without any warranty of any kind, whether express
12 * or implied.
13 */
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/pci.h>
17
18#include <asm/byteorder.h>
19#include <asm/io.h>
20#include <asm/irq.h>
21#include <asm/pci.h>
22#include <asm/pci-bridge.h>
23#include <asm/open_pic.h>
24#include <asm/hawk.h>
25
26/*
27 * The Falcon/Raven and HAWK has 4 sets of registers:
28 * 1) PPC Registers which define the mappings from PPC bus to PCI bus,
29 * etc.
30 * 2) PCI Registers which define the mappings from PCI bus to PPC bus and the
31 * MPIC base address.
32 * 3) MPIC registers.
33 * 4) System Memory Controller (SMC) registers.
34 */
35
36/*
37 * Initialize the Motorola MCG Raven or HAWK host bridge.
38 *
39 * This means setting up the PPC bus to PCI memory and I/O space mappings,
40 * setting the PCI memory space address of the MPIC (mapped straight
41 * through), and ioremap'ing the mpic registers.
42 * This routine will set the PCI_CONFIG_ADDR or PCI_CONFIG_DATA
43 * addresses based on the PCI I/O address that is passed in.
44 * 'OpenPIC_Addr' will be set correctly by this routine.
45 */
46int __init
47hawk_init(struct pci_controller *hose,
48 uint ppc_reg_base,
49 ulong processor_pci_mem_start,
50 ulong processor_pci_mem_end,
51 ulong processor_pci_io_start,
52 ulong processor_pci_io_end,
53 ulong processor_mpic_base)
54{
55 uint addr, offset;
56
57 /*
58 * Some sanity checks...
59 */
60 if (((processor_pci_mem_start&0xffff0000) != processor_pci_mem_start) ||
61 ((processor_pci_io_start &0xffff0000) != processor_pci_io_start)) {
62 printk("hawk_init: %s\n",
63 "PPC to PCI mappings must start on 64 KB boundaries");
64 return -1;
65 }
66
67 if (((processor_pci_mem_end &0x0000ffff) != 0x0000ffff) ||
68 ((processor_pci_io_end &0x0000ffff) != 0x0000ffff)) {
69 printk("hawk_init: PPC to PCI mappings %s\n",
70 "must end just before a 64 KB boundaries");
71 return -1;
72 }
73
74 if (((processor_pci_mem_end - processor_pci_mem_start) !=
75 (hose->mem_space.end - hose->mem_space.start)) ||
76 ((processor_pci_io_end - processor_pci_io_start) !=
77 (hose->io_space.end - hose->io_space.start))) {
78 printk("hawk_init: %s\n",
79 "PPC and PCI memory or I/O space sizes don't match");
80 return -1;
81 }
82
83 if ((processor_mpic_base & 0xfffc0000) != processor_mpic_base) {
84 printk("hawk_init: %s\n",
85 "MPIC address must start on 256 MB boundary");
86 return -1;
87 }
88
89 if ((pci_dram_offset & 0xffff0000) != pci_dram_offset) {
90 printk("hawk_init: %s\n",
91 "pci_dram_offset must be multiple of 64 KB");
92 return -1;
93 }
94
95 /*
96 * Disable previous PPC->PCI mappings.
97 */
98 out_be32((uint *)(ppc_reg_base + HAWK_PPC_XSOFF0_OFF), 0x00000000);
99 out_be32((uint *)(ppc_reg_base + HAWK_PPC_XSOFF1_OFF), 0x00000000);
100 out_be32((uint *)(ppc_reg_base + HAWK_PPC_XSOFF2_OFF), 0x00000000);
101 out_be32((uint *)(ppc_reg_base + HAWK_PPC_XSOFF3_OFF), 0x00000000);
102
103 /*
104 * Program the XSADD/XSOFF registers to set up the PCI Mem & I/O
105 * space mappings. These are the mappings going from the processor to
106 * the PCI bus.
107 *
108 * Note: Don't need to 'AND' start/end addresses with 0xffff0000
109 * because sanity check above ensures that they are properly
110 * aligned.
111 */
112
113 /* Set up PPC->PCI Mem mapping */
114 addr = processor_pci_mem_start | (processor_pci_mem_end >> 16);
115 offset = (hose->mem_space.start - processor_pci_mem_start) | 0xd2;
116 out_be32((uint *)(ppc_reg_base + HAWK_PPC_XSADD0_OFF), addr);
117 out_be32((uint *)(ppc_reg_base + HAWK_PPC_XSOFF0_OFF), offset);
118
119 /* Set up PPC->MPIC mapping on the bridge */
120 addr = processor_mpic_base |
121 (((processor_mpic_base + HAWK_MPIC_SIZE) >> 16) - 1);
122 /* No write posting for this PCI Mem space */
123 offset = (hose->mem_space.start - processor_pci_mem_start) | 0xc2;
124
125 out_be32((uint *)(ppc_reg_base + HAWK_PPC_XSADD1_OFF), addr);
126 out_be32((uint *)(ppc_reg_base + HAWK_PPC_XSOFF1_OFF), offset);
127
128 /* Set up PPC->PCI I/O mapping -- Contiguous I/O space */
129 addr = processor_pci_io_start | (processor_pci_io_end >> 16);
130 offset = (hose->io_space.start - processor_pci_io_start) | 0xc0;
131 out_be32((uint *)(ppc_reg_base + HAWK_PPC_XSADD3_OFF), addr);
132 out_be32((uint *)(ppc_reg_base + HAWK_PPC_XSOFF3_OFF), offset);
133
134 hose->io_base_virt = (void *)ioremap(processor_pci_io_start,
135 (processor_pci_io_end - processor_pci_io_start + 1));
136
137 /*
138 * Set up the indirect method of accessing PCI config space.
139 * The PCI config addr/data pair based on start addr of PCI I/O space.
140 */
141 setup_indirect_pci(hose,
142 processor_pci_io_start + HAWK_PCI_CONFIG_ADDR_OFF,
143 processor_pci_io_start + HAWK_PCI_CONFIG_DATA_OFF);
144
145 /*
146 * Disable previous PCI->PPC mappings.
147 */
148
149 /* XXXX Put in mappings from PCI bus to processor bus XXXX */
150
151 /*
152 * Disable MPIC response to PCI I/O space (BAR 0).
153 * Make MPIC respond to PCI Mem space at specified address.
154 * (BAR 1).
155 */
156 early_write_config_dword(hose,
157 0,
158 PCI_DEVFN(0,0),
159 PCI_BASE_ADDRESS_0,
160 0x00000000 | 0x1);
161
162 early_write_config_dword(hose,
163 0,
164 PCI_DEVFN(0,0),
165 PCI_BASE_ADDRESS_1,
166 (processor_mpic_base -
167 processor_pci_mem_start +
168 hose->mem_space.start) | 0x0);
169
170 /* Map MPIC into vitual memory */
171 OpenPIC_Addr = ioremap(processor_mpic_base, HAWK_MPIC_SIZE);
172
173 return 0;
174}
175
176/*
177 * Find the amount of RAM present.
178 * This assumes that PPCBug has initialized the memory controller (SMC)
179 * on the Falcon/HAWK correctly (i.e., it does no sanity checking).
180 * It also assumes that the memory base registers are set to configure the
181 * memory as contigous starting with "RAM A BASE", "RAM B BASE", etc.
182 * however, RAM base registers can be skipped (e.g. A, B, C are set,
183 * D is skipped but E is set is okay).
184 */
185#define MB (1024*1024)
186
187static uint reg_offset_table[] __initdata = {
188 HAWK_SMC_RAM_A_SIZE_REG_OFF,
189 HAWK_SMC_RAM_B_SIZE_REG_OFF,
190 HAWK_SMC_RAM_C_SIZE_REG_OFF,
191 HAWK_SMC_RAM_D_SIZE_REG_OFF,
192 HAWK_SMC_RAM_E_SIZE_REG_OFF,
193 HAWK_SMC_RAM_F_SIZE_REG_OFF,
194 HAWK_SMC_RAM_G_SIZE_REG_OFF,
195 HAWK_SMC_RAM_H_SIZE_REG_OFF
196};
197
198static uint falcon_size_table[] __initdata = {
199 0 * MB, /* 0 ==> 0 MB */
200 16 * MB, /* 1 ==> 16 MB */
201 32 * MB, /* 2 ==> 32 MB */
202 64 * MB, /* 3 ==> 64 MB */
203 128 * MB, /* 4 ==> 128 MB */
204 256 * MB, /* 5 ==> 256 MB */
205 1024 * MB, /* 6 ==> 1024 MB (1 GB) */
206};
207
208static uint hawk_size_table[] __initdata = {
209 0 * MB, /* 0 ==> 0 MB */
210 32 * MB, /* 1 ==> 32 MB */
211 64 * MB, /* 2 ==> 64 MB */
212 64 * MB, /* 3 ==> 64 MB */
213 128 * MB, /* 4 ==> 128 MB */
214 128 * MB, /* 5 ==> 128 MB */
215 128 * MB, /* 6 ==> 128 MB */
216 256 * MB, /* 7 ==> 256 MB */
217 256 * MB, /* 8 ==> 256 MB */
218 512 * MB, /* 9 ==> 512 MB */
219};
220
221/*
222 * *** WARNING: You MUST have a BAT set up to map in the SMC regs ***
223 *
224 * Read the memory controller's registers to determine the amount of system
225 * memory. Assumes that the memory controller registers are already mapped
226 * into virtual memory--too early to use ioremap().
227 */
228unsigned long __init
229hawk_get_mem_size(uint smc_base)
230{
231 unsigned long total;
232 int i, size_table_entries, reg_limit;
233 uint vend_dev_id;
234 uint *size_table;
235 u_char val;
236
237
238 vend_dev_id = in_be32((uint *)smc_base + PCI_VENDOR_ID);
239
240 if (((vend_dev_id & 0xffff0000) >> 16) != PCI_VENDOR_ID_MOTOROLA) {
241 printk("hawk_get_mem_size: %s (0x%x)\n",
242 "Not a Motorola Memory Controller", vend_dev_id);
243 return 0;
244 }
245
246 vend_dev_id &= 0x0000ffff;
247
248 if (vend_dev_id == PCI_DEVICE_ID_MOTOROLA_FALCON) {
249 size_table = falcon_size_table;
250 size_table_entries = sizeof(falcon_size_table) /
251 sizeof(falcon_size_table[0]);
252
253 reg_limit = FALCON_SMC_REG_COUNT;
254 }
255 else if (vend_dev_id == PCI_DEVICE_ID_MOTOROLA_HAWK) {
256 size_table = hawk_size_table;
257 size_table_entries = sizeof(hawk_size_table) /
258 sizeof(hawk_size_table[0]);
259 reg_limit = HAWK_SMC_REG_COUNT;
260 }
261 else {
262 printk("hawk_get_mem_size: %s (0x%x)\n",
263 "Not a Falcon or HAWK", vend_dev_id);
264 return 0;
265 }
266
267 total = 0;
268
269 /* Check every reg because PPCBug may skip some */
270 for (i=0; i<reg_limit; i++) {
271 val = in_8((u_char *)(smc_base + reg_offset_table[i]));
272
273 if (val & 0x80) { /* If enabled */
274 val &= 0x0f;
275
276 /* Don't go past end of size_table */
277 if (val < size_table_entries) {
278 total += size_table[val];
279 }
280 else { /* Register not set correctly */
281 break;
282 }
283 }
284 }
285
286 return total;
287}
288
289int __init
290hawk_mpic_init(unsigned int pci_mem_offset)
291{
292 unsigned short devid;
293 unsigned int pci_membase;
294
295 /* Check the first PCI device to see if it is a Raven or Hawk. */
296 early_read_config_word(0, 0, 0, PCI_DEVICE_ID, &devid);
297
298 switch (devid) {
299 case PCI_DEVICE_ID_MOTOROLA_RAVEN:
300 case PCI_DEVICE_ID_MOTOROLA_HAWK:
301 break;
302 default:
303 OpenPIC_Addr = NULL;
304 return 1;
305 }
306
307 /* Read the memory base register. */
308 early_read_config_dword(0, 0, 0, PCI_BASE_ADDRESS_1, &pci_membase);
309
310 if (pci_membase == 0) {
311 OpenPIC_Addr = NULL;
312 return 1;
313 }
314
315 /* Map the MPIC registers to virtual memory. */
316 OpenPIC_Addr = ioremap(pci_membase + pci_mem_offset, 0x22000);
317
318 return 0;
319}
diff --git a/arch/ppc/syslib/i8259.c b/arch/ppc/syslib/i8259.c
new file mode 100644
index 000000000000..b9391e650141
--- /dev/null
+++ b/arch/ppc/syslib/i8259.c
@@ -0,0 +1,211 @@
1#include <linux/init.h>
2#include <linux/ioport.h>
3#include <linux/interrupt.h>
4#include <asm/io.h>
5#include <asm/i8259.h>
6
7static volatile unsigned char *pci_intack; /* RO, gives us the irq vector */
8
9unsigned char cached_8259[2] = { 0xff, 0xff };
10#define cached_A1 (cached_8259[0])
11#define cached_21 (cached_8259[1])
12
13static DEFINE_SPINLOCK(i8259_lock);
14
15int i8259_pic_irq_offset;
16
17/*
18 * Acknowledge the IRQ using either the PCI host bridge's interrupt
19 * acknowledge feature or poll. How i8259_init() is called determines
20 * which is called. It should be noted that polling is broken on some
21 * IBM and Motorola PReP boxes so we must use the int-ack feature on them.
22 */
23int
24i8259_irq(struct pt_regs *regs)
25{
26 int irq;
27
28 spin_lock(&i8259_lock);
29
30 /* Either int-ack or poll for the IRQ */
31 if (pci_intack)
32 irq = *pci_intack;
33 else {
34 /* Perform an interrupt acknowledge cycle on controller 1. */
35 outb(0x0C, 0x20); /* prepare for poll */
36 irq = inb(0x20) & 7;
37 if (irq == 2 ) {
38 /*
39 * Interrupt is cascaded so perform interrupt
40 * acknowledge on controller 2.
41 */
42 outb(0x0C, 0xA0); /* prepare for poll */
43 irq = (inb(0xA0) & 7) + 8;
44 }
45 }
46
47 if (irq == 7) {
48 /*
49 * This may be a spurious interrupt.
50 *
51 * Read the interrupt status register (ISR). If the most
52 * significant bit is not set then there is no valid
53 * interrupt.
54 */
55 if (!pci_intack)
56 outb(0x0B, 0x20); /* ISR register */
57 if(~inb(0x20) & 0x80)
58 irq = -1;
59 }
60
61 spin_unlock(&i8259_lock);
62 return irq;
63}
64
65static void i8259_mask_and_ack_irq(unsigned int irq_nr)
66{
67 unsigned long flags;
68
69 spin_lock_irqsave(&i8259_lock, flags);
70 if ( irq_nr >= i8259_pic_irq_offset )
71 irq_nr -= i8259_pic_irq_offset;
72
73 if (irq_nr > 7) {
74 cached_A1 |= 1 << (irq_nr-8);
75 inb(0xA1); /* DUMMY */
76 outb(cached_A1,0xA1);
77 outb(0x20,0xA0); /* Non-specific EOI */
78 outb(0x20,0x20); /* Non-specific EOI to cascade */
79 } else {
80 cached_21 |= 1 << irq_nr;
81 inb(0x21); /* DUMMY */
82 outb(cached_21,0x21);
83 outb(0x20,0x20); /* Non-specific EOI */
84 }
85 spin_unlock_irqrestore(&i8259_lock, flags);
86}
87
88static void i8259_set_irq_mask(int irq_nr)
89{
90 outb(cached_A1,0xA1);
91 outb(cached_21,0x21);
92}
93
94static void i8259_mask_irq(unsigned int irq_nr)
95{
96 unsigned long flags;
97
98 spin_lock_irqsave(&i8259_lock, flags);
99 if ( irq_nr >= i8259_pic_irq_offset )
100 irq_nr -= i8259_pic_irq_offset;
101 if ( irq_nr < 8 )
102 cached_21 |= 1 << irq_nr;
103 else
104 cached_A1 |= 1 << (irq_nr-8);
105 i8259_set_irq_mask(irq_nr);
106 spin_unlock_irqrestore(&i8259_lock, flags);
107}
108
109static void i8259_unmask_irq(unsigned int irq_nr)
110{
111 unsigned long flags;
112
113 spin_lock_irqsave(&i8259_lock, flags);
114 if ( irq_nr >= i8259_pic_irq_offset )
115 irq_nr -= i8259_pic_irq_offset;
116 if ( irq_nr < 8 )
117 cached_21 &= ~(1 << irq_nr);
118 else
119 cached_A1 &= ~(1 << (irq_nr-8));
120 i8259_set_irq_mask(irq_nr);
121 spin_unlock_irqrestore(&i8259_lock, flags);
122}
123
124static void i8259_end_irq(unsigned int irq)
125{
126 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))
127 && irq_desc[irq].action)
128 i8259_unmask_irq(irq);
129}
130
131struct hw_interrupt_type i8259_pic = {
132 " i8259 ",
133 NULL,
134 NULL,
135 i8259_unmask_irq,
136 i8259_mask_irq,
137 i8259_mask_and_ack_irq,
138 i8259_end_irq,
139 NULL
140};
141
142static struct resource pic1_iores = {
143 .name = "8259 (master)",
144 .start = 0x20,
145 .end = 0x21,
146 .flags = IORESOURCE_BUSY,
147};
148
149static struct resource pic2_iores = {
150 .name = "8259 (slave)",
151 .start = 0xa0,
152 .end = 0xa1,
153 .flags = IORESOURCE_BUSY,
154};
155
156static struct resource pic_edgectrl_iores = {
157 .name = "8259 edge control",
158 .start = 0x4d0,
159 .end = 0x4d1,
160 .flags = IORESOURCE_BUSY,
161};
162
163static struct irqaction i8259_irqaction = {
164 .handler = no_action,
165 .flags = SA_INTERRUPT,
166 .mask = CPU_MASK_NONE,
167 .name = "82c59 secondary cascade",
168};
169
170/*
171 * i8259_init()
172 * intack_addr - PCI interrupt acknowledge (real) address which will return
173 * the active irq from the 8259
174 */
175void __init
176i8259_init(long intack_addr)
177{
178 unsigned long flags;
179
180 spin_lock_irqsave(&i8259_lock, flags);
181 /* init master interrupt controller */
182 outb(0x11, 0x20); /* Start init sequence */
183 outb(0x00, 0x21); /* Vector base */
184 outb(0x04, 0x21); /* edge tiggered, Cascade (slave) on IRQ2 */
185 outb(0x01, 0x21); /* Select 8086 mode */
186
187 /* init slave interrupt controller */
188 outb(0x11, 0xA0); /* Start init sequence */
189 outb(0x08, 0xA1); /* Vector base */
190 outb(0x02, 0xA1); /* edge triggered, Cascade (slave) on IRQ2 */
191 outb(0x01, 0xA1); /* Select 8086 mode */
192
193 /* always read ISR */
194 outb(0x0B, 0x20);
195 outb(0x0B, 0xA0);
196
197 /* Mask all interrupts */
198 outb(cached_A1, 0xA1);
199 outb(cached_21, 0x21);
200
201 spin_unlock_irqrestore(&i8259_lock, flags);
202
203 /* reserve our resources */
204 setup_irq( i8259_pic_irq_offset + 2, &i8259_irqaction);
205 request_resource(&ioport_resource, &pic1_iores);
206 request_resource(&ioport_resource, &pic2_iores);
207 request_resource(&ioport_resource, &pic_edgectrl_iores);
208
209 if (intack_addr != 0)
210 pci_intack = ioremap(intack_addr, 1);
211}
diff --git a/arch/ppc/syslib/ibm440gp_common.c b/arch/ppc/syslib/ibm440gp_common.c
new file mode 100644
index 000000000000..0d6be2d6dd67
--- /dev/null
+++ b/arch/ppc/syslib/ibm440gp_common.c
@@ -0,0 +1,76 @@
1/*
2 * arch/ppc/syslib/ibm440gp_common.c
3 *
4 * PPC440GP system library
5 *
6 * Matt Porter <mporter@mvista.com>
7 * Copyright 2002-2003 MontaVista Software Inc.
8 *
9 * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
10 * Copyright (c) 2003 Zultys Technologies
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 *
17 */
18#include <linux/config.h>
19#include <linux/types.h>
20#include <asm/reg.h>
21#include <asm/ibm44x.h>
22#include <asm/mmu.h>
23
24/*
25 * Calculate 440GP clocks
26 */
27void __init ibm440gp_get_clocks(struct ibm44x_clocks* p,
28 unsigned int sys_clk,
29 unsigned int ser_clk)
30{
31 u32 cpc0_sys0 = mfdcr(DCRN_CPC0_SYS0);
32 u32 cpc0_cr0 = mfdcr(DCRN_CPC0_CR0);
33 u32 opdv = ((cpc0_sys0 >> 10) & 0x3) + 1;
34 u32 epdv = ((cpc0_sys0 >> 8) & 0x3) + 1;
35
36 if (cpc0_sys0 & 0x2){
37 /* Bypass system PLL */
38 p->cpu = p->plb = sys_clk;
39 }
40 else {
41 u32 fbdv, fwdva, fwdvb, m, vco;
42
43 fbdv = (cpc0_sys0 >> 18) & 0x0f;
44 if (!fbdv)
45 fbdv = 16;
46
47 fwdva = 8 - ((cpc0_sys0 >> 15) & 0x7);
48 fwdvb = 8 - ((cpc0_sys0 >> 12) & 0x7);
49
50 /* Feedback path */
51 if (cpc0_sys0 & 0x00000080){
52 /* PerClk */
53 m = fwdvb * opdv * epdv;
54 }
55 else {
56 /* CPU clock */
57 m = fbdv * fwdva;
58 }
59 vco = sys_clk * m;
60 p->cpu = vco / fwdva;
61 p->plb = vco / fwdvb;
62 }
63
64 p->opb = p->plb / opdv;
65 p->ebc = p->opb / epdv;
66
67 if (cpc0_cr0 & 0x00400000){
68 /* External UART clock */
69 p->uart0 = p->uart1 = ser_clk;
70 }
71 else {
72 /* Internal UART clock */
73 u32 uart_div = ((cpc0_cr0 >> 16) & 0x1f) + 1;
74 p->uart0 = p->uart1 = p->plb / uart_div;
75 }
76}
diff --git a/arch/ppc/syslib/ibm440gp_common.h b/arch/ppc/syslib/ibm440gp_common.h
new file mode 100644
index 000000000000..a054d83cb1ac
--- /dev/null
+++ b/arch/ppc/syslib/ibm440gp_common.h
@@ -0,0 +1,35 @@
1/*
2 * arch/ppc/kernel/ibm440gp_common.h
3 *
4 * PPC440GP system library
5 *
6 * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
7 * Copyright (c) 2003 Zultys Technologies
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 */
15#ifdef __KERNEL__
16#ifndef __PPC_SYSLIB_IBM440GP_COMMON_H
17#define __PPC_SYSLIB_IBM440GP_COMMON_H
18
19#ifndef __ASSEMBLY__
20
21#include <linux/config.h>
22#include <linux/init.h>
23#include <syslib/ibm44x_common.h>
24
25/*
26 * Please, refer to the Figure 13.1 in 440GP user manual
27 *
28 * if internal UART clock is used, ser_clk is ignored
29 */
30void ibm440gp_get_clocks(struct ibm44x_clocks*, unsigned int sys_clk,
31 unsigned int ser_clk) __init;
32
33#endif /* __ASSEMBLY__ */
34#endif /* __PPC_SYSLIB_IBM440GP_COMMON_H */
35#endif /* __KERNEL__ */
diff --git a/arch/ppc/syslib/ibm440gx_common.c b/arch/ppc/syslib/ibm440gx_common.c
new file mode 100644
index 000000000000..4ad85e0e0234
--- /dev/null
+++ b/arch/ppc/syslib/ibm440gx_common.c
@@ -0,0 +1,270 @@
1/*
2 * arch/ppc/kernel/ibm440gx_common.c
3 *
4 * PPC440GX system library
5 *
6 * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
7 * Copyright (c) 2003, 2004 Zultys Technologies
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 */
15#include <linux/config.h>
16#include <linux/kernel.h>
17#include <linux/interrupt.h>
18#include <asm/ibm44x.h>
19#include <asm/mmu.h>
20#include <asm/processor.h>
21#include <syslib/ibm440gx_common.h>
22
23/*
24 * Calculate 440GX clocks
25 */
26static inline u32 __fix_zero(u32 v, u32 def){
27 return v ? v : def;
28}
29
30void __init ibm440gx_get_clocks(struct ibm44x_clocks* p, unsigned int sys_clk,
31 unsigned int ser_clk)
32{
33 u32 pllc = CPR_READ(DCRN_CPR_PLLC);
34 u32 plld = CPR_READ(DCRN_CPR_PLLD);
35 u32 uart0 = SDR_READ(DCRN_SDR_UART0);
36 u32 uart1 = SDR_READ(DCRN_SDR_UART1);
37
38 /* Dividers */
39 u32 fbdv = __fix_zero((plld >> 24) & 0x1f, 32);
40 u32 fwdva = __fix_zero((plld >> 16) & 0xf, 16);
41 u32 fwdvb = __fix_zero((plld >> 8) & 7, 8);
42 u32 lfbdv = __fix_zero(plld & 0x3f, 64);
43 u32 pradv0 = __fix_zero((CPR_READ(DCRN_CPR_PRIMAD) >> 24) & 7, 8);
44 u32 prbdv0 = __fix_zero((CPR_READ(DCRN_CPR_PRIMBD) >> 24) & 7, 8);
45 u32 opbdv0 = __fix_zero((CPR_READ(DCRN_CPR_OPBD) >> 24) & 3, 4);
46 u32 perdv0 = __fix_zero((CPR_READ(DCRN_CPR_PERD) >> 24) & 3, 4);
47
48 /* Input clocks for primary dividers */
49 u32 clk_a, clk_b;
50
51 if (pllc & 0x40000000){
52 u32 m;
53
54 /* Feedback path */
55 switch ((pllc >> 24) & 7){
56 case 0:
57 /* PLLOUTx */
58 m = ((pllc & 0x20000000) ? fwdvb : fwdva) * lfbdv;
59 break;
60 case 1:
61 /* CPU */
62 m = fwdva * pradv0;
63 break;
64 case 5:
65 /* PERClk */
66 m = fwdvb * prbdv0 * opbdv0 * perdv0;
67 break;
68 default:
69 printk(KERN_EMERG "invalid PLL feedback source\n");
70 goto bypass;
71 }
72 m *= fbdv;
73 p->vco = sys_clk * m;
74 clk_a = p->vco / fwdva;
75 clk_b = p->vco / fwdvb;
76 }
77 else {
78bypass:
79 /* Bypass system PLL */
80 p->vco = 0;
81 clk_a = clk_b = sys_clk;
82 }
83
84 p->cpu = clk_a / pradv0;
85 p->plb = clk_b / prbdv0;
86 p->opb = p->plb / opbdv0;
87 p->ebc = p->opb / perdv0;
88
89 /* UARTs clock */
90 if (uart0 & 0x00800000)
91 p->uart0 = ser_clk;
92 else
93 p->uart0 = p->plb / __fix_zero(uart0 & 0xff, 256);
94
95 if (uart1 & 0x00800000)
96 p->uart1 = ser_clk;
97 else
98 p->uart1 = p->plb / __fix_zero(uart1 & 0xff, 256);
99}
100
101/* Issue L2C diagnostic command */
102static inline u32 l2c_diag(u32 addr)
103{
104 mtdcr(DCRN_L2C0_ADDR, addr);
105 mtdcr(DCRN_L2C0_CMD, L2C_CMD_DIAG);
106 while (!(mfdcr(DCRN_L2C0_SR) & L2C_SR_CC)) ;
107 return mfdcr(DCRN_L2C0_DATA);
108}
109
110static irqreturn_t l2c_error_handler(int irq, void* dev, struct pt_regs* regs)
111{
112 u32 sr = mfdcr(DCRN_L2C0_SR);
113 if (sr & L2C_SR_CPE){
114 /* Read cache trapped address */
115 u32 addr = l2c_diag(0x42000000);
116 printk(KERN_EMERG "L2C: Cache Parity Error, addr[16:26] = 0x%08x\n", addr);
117 }
118 if (sr & L2C_SR_TPE){
119 /* Read tag trapped address */
120 u32 addr = l2c_diag(0x82000000) >> 16;
121 printk(KERN_EMERG "L2C: Tag Parity Error, addr[16:26] = 0x%08x\n", addr);
122 }
123
124 /* Clear parity errors */
125 if (sr & (L2C_SR_CPE | L2C_SR_TPE)){
126 mtdcr(DCRN_L2C0_ADDR, 0);
127 mtdcr(DCRN_L2C0_CMD, L2C_CMD_CCP | L2C_CMD_CTE);
128 } else
129 printk(KERN_EMERG "L2C: LRU error\n");
130
131 return IRQ_HANDLED;
132}
133
134/* Enable L2 cache */
135void __init ibm440gx_l2c_enable(void){
136 u32 r;
137 unsigned long flags;
138
139 /* Install error handler */
140 if (request_irq(87, l2c_error_handler, SA_INTERRUPT, "L2C", 0) < 0){
141 printk(KERN_ERR "Cannot install L2C error handler, cache is not enabled\n");
142 return;
143 }
144
145 local_irq_save(flags);
146 asm volatile ("sync" ::: "memory");
147
148 /* Disable SRAM */
149 mtdcr(DCRN_SRAM0_DPC, mfdcr(DCRN_SRAM0_DPC) & ~SRAM_DPC_ENABLE);
150 mtdcr(DCRN_SRAM0_SB0CR, mfdcr(DCRN_SRAM0_SB0CR) & ~SRAM_SBCR_BU_MASK);
151 mtdcr(DCRN_SRAM0_SB1CR, mfdcr(DCRN_SRAM0_SB1CR) & ~SRAM_SBCR_BU_MASK);
152 mtdcr(DCRN_SRAM0_SB2CR, mfdcr(DCRN_SRAM0_SB2CR) & ~SRAM_SBCR_BU_MASK);
153 mtdcr(DCRN_SRAM0_SB3CR, mfdcr(DCRN_SRAM0_SB3CR) & ~SRAM_SBCR_BU_MASK);
154
155 /* Enable L2_MODE without ICU/DCU */
156 r = mfdcr(DCRN_L2C0_CFG) & ~(L2C_CFG_ICU | L2C_CFG_DCU | L2C_CFG_SS_MASK);
157 r |= L2C_CFG_L2M | L2C_CFG_SS_256;
158 mtdcr(DCRN_L2C0_CFG, r);
159
160 mtdcr(DCRN_L2C0_ADDR, 0);
161
162 /* Hardware Clear Command */
163 mtdcr(DCRN_L2C0_CMD, L2C_CMD_HCC);
164 while (!(mfdcr(DCRN_L2C0_SR) & L2C_SR_CC)) ;
165
166 /* Clear Cache Parity and Tag Errors */
167 mtdcr(DCRN_L2C0_CMD, L2C_CMD_CCP | L2C_CMD_CTE);
168
169 /* Enable 64G snoop region starting at 0 */
170 r = mfdcr(DCRN_L2C0_SNP0) & ~(L2C_SNP_BA_MASK | L2C_SNP_SSR_MASK);
171 r |= L2C_SNP_SSR_32G | L2C_SNP_ESR;
172 mtdcr(DCRN_L2C0_SNP0, r);
173
174 r = mfdcr(DCRN_L2C0_SNP1) & ~(L2C_SNP_BA_MASK | L2C_SNP_SSR_MASK);
175 r |= 0x80000000 | L2C_SNP_SSR_32G | L2C_SNP_ESR;
176 mtdcr(DCRN_L2C0_SNP1, r);
177
178 asm volatile ("sync" ::: "memory");
179
180 /* Enable ICU/DCU ports */
181 r = mfdcr(DCRN_L2C0_CFG);
182 r &= ~(L2C_CFG_DCW_MASK | L2C_CFG_PMUX_MASK | L2C_CFG_PMIM | L2C_CFG_TPEI
183 | L2C_CFG_CPEI | L2C_CFG_NAM | L2C_CFG_NBRM);
184 r |= L2C_CFG_ICU | L2C_CFG_DCU | L2C_CFG_TPC | L2C_CFG_CPC | L2C_CFG_FRAN
185 | L2C_CFG_CPIM | L2C_CFG_TPIM | L2C_CFG_LIM | L2C_CFG_SMCM;
186 mtdcr(DCRN_L2C0_CFG, r);
187
188 asm volatile ("sync; isync" ::: "memory");
189 local_irq_restore(flags);
190}
191
192/* Disable L2 cache */
193void __init ibm440gx_l2c_disable(void){
194 u32 r;
195 unsigned long flags;
196
197 local_irq_save(flags);
198 asm volatile ("sync" ::: "memory");
199
200 /* Disable L2C mode */
201 r = mfdcr(DCRN_L2C0_CFG) & ~(L2C_CFG_L2M | L2C_CFG_ICU | L2C_CFG_DCU);
202 mtdcr(DCRN_L2C0_CFG, r);
203
204 /* Enable SRAM */
205 mtdcr(DCRN_SRAM0_DPC, mfdcr(DCRN_SRAM0_DPC) | SRAM_DPC_ENABLE);
206 mtdcr(DCRN_SRAM0_SB0CR,
207 SRAM_SBCR_BAS0 | SRAM_SBCR_BS_64KB | SRAM_SBCR_BU_RW);
208 mtdcr(DCRN_SRAM0_SB1CR,
209 SRAM_SBCR_BAS1 | SRAM_SBCR_BS_64KB | SRAM_SBCR_BU_RW);
210 mtdcr(DCRN_SRAM0_SB2CR,
211 SRAM_SBCR_BAS2 | SRAM_SBCR_BS_64KB | SRAM_SBCR_BU_RW);
212 mtdcr(DCRN_SRAM0_SB3CR,
213 SRAM_SBCR_BAS3 | SRAM_SBCR_BS_64KB | SRAM_SBCR_BU_RW);
214
215 asm volatile ("sync; isync" ::: "memory");
216 local_irq_restore(flags);
217}
218
219void __init ibm440gx_l2c_setup(struct ibm44x_clocks* p)
220{
221 /* Disable L2C on rev.A, rev.B and 800MHz version of rev.C,
222 enable it on all other revisions
223 */
224 u32 pvr = mfspr(SPRN_PVR);
225 if (pvr == PVR_440GX_RA || pvr == PVR_440GX_RB ||
226 (pvr == PVR_440GX_RC && p->cpu > 667000000))
227 ibm440gx_l2c_disable();
228 else
229 ibm440gx_l2c_enable();
230}
231
232int __init ibm440gx_get_eth_grp(void)
233{
234 return (SDR_READ(DCRN_SDR_PFC1) & DCRN_SDR_PFC1_EPS) >> DCRN_SDR_PFC1_EPS_SHIFT;
235}
236
237void __init ibm440gx_set_eth_grp(int group)
238{
239 SDR_WRITE(DCRN_SDR_PFC1, (SDR_READ(DCRN_SDR_PFC1) & ~DCRN_SDR_PFC1_EPS) | (group << DCRN_SDR_PFC1_EPS_SHIFT));
240}
241
242void __init ibm440gx_tah_enable(void)
243{
244 /* Enable TAH0 and TAH1 */
245 SDR_WRITE(DCRN_SDR_MFR,SDR_READ(DCRN_SDR_MFR) &
246 ~DCRN_SDR_MFR_TAH0);
247 SDR_WRITE(DCRN_SDR_MFR,SDR_READ(DCRN_SDR_MFR) &
248 ~DCRN_SDR_MFR_TAH1);
249}
250
251int ibm440gx_show_cpuinfo(struct seq_file *m){
252
253 u32 l2c_cfg = mfdcr(DCRN_L2C0_CFG);
254 const char* s;
255 if (l2c_cfg & L2C_CFG_L2M){
256 switch (l2c_cfg & (L2C_CFG_ICU | L2C_CFG_DCU)){
257 case L2C_CFG_ICU: s = "I-Cache only"; break;
258 case L2C_CFG_DCU: s = "D-Cache only"; break;
259 default: s = "I-Cache/D-Cache"; break;
260 }
261 }
262 else
263 s = "disabled";
264
265 seq_printf(m, "L2-Cache\t: %s (0x%08x 0x%08x)\n", s,
266 l2c_cfg, mfdcr(DCRN_L2C0_SR));
267
268 return 0;
269}
270
diff --git a/arch/ppc/syslib/ibm440gx_common.h b/arch/ppc/syslib/ibm440gx_common.h
new file mode 100644
index 000000000000..e73aa0411d35
--- /dev/null
+++ b/arch/ppc/syslib/ibm440gx_common.h
@@ -0,0 +1,57 @@
1/*
2 * arch/ppc/kernel/ibm440gx_common.h
3 *
4 * PPC440GX system library
5 *
6 * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
7 * Copyright (c) 2003, 2004 Zultys Technologies
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 */
15#ifdef __KERNEL__
16#ifndef __PPC_SYSLIB_IBM440GX_COMMON_H
17#define __PPC_SYSLIB_IBM440GX_COMMON_H
18
19#ifndef __ASSEMBLY__
20
21#include <linux/config.h>
22#include <linux/init.h>
23#include <linux/seq_file.h>
24#include <syslib/ibm44x_common.h>
25
26/*
27 * Please, refer to the Figure 14.1 in 440GX user manual
28 *
29 * if internal UART clock is used, ser_clk is ignored
30 */
31void ibm440gx_get_clocks(struct ibm44x_clocks*, unsigned int sys_clk,
32 unsigned int ser_clk) __init;
33
34/* Enable L2 cache */
35void ibm440gx_l2c_enable(void) __init;
36
37/* Disable L2 cache */
38void ibm440gx_l2c_disable(void) __init;
39
40/* Enable/disable L2 cache for a particular chip revision */
41void ibm440gx_l2c_setup(struct ibm44x_clocks*) __init;
42
43/* Get Ethernet Group */
44int ibm440gx_get_eth_grp(void) __init;
45
46/* Set Ethernet Group */
47void ibm440gx_set_eth_grp(int group) __init;
48
49/* Enable TAH devices */
50void ibm440gx_tah_enable(void) __init;
51
52/* Add L2C info to /proc/cpuinfo */
53int ibm440gx_show_cpuinfo(struct seq_file*);
54
55#endif /* __ASSEMBLY__ */
56#endif /* __PPC_SYSLIB_IBM440GX_COMMON_H */
57#endif /* __KERNEL__ */
diff --git a/arch/ppc/syslib/ibm440sp_common.c b/arch/ppc/syslib/ibm440sp_common.c
new file mode 100644
index 000000000000..417d4cff77a0
--- /dev/null
+++ b/arch/ppc/syslib/ibm440sp_common.c
@@ -0,0 +1,71 @@
1/*
2 * arch/ppc/syslib/ibm440sp_common.c
3 *
4 * PPC440SP system library
5 *
6 * Matt Porter <mporter@kernel.crashing.org>
7 * Copyright 2002-2005 MontaVista Software Inc.
8 *
9 * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
10 * Copyright (c) 2003, 2004 Zultys Technologies
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 *
17 */
18#include <linux/config.h>
19#include <linux/types.h>
20#include <linux/serial.h>
21
22#include <asm/param.h>
23#include <asm/ibm44x.h>
24#include <asm/mmu.h>
25#include <asm/machdep.h>
26#include <asm/time.h>
27#include <asm/ppc4xx_pic.h>
28
29/*
30 * Read the 440SP memory controller to get size of system memory.
31 */
32unsigned long __init ibm440sp_find_end_of_memory(void)
33{
34 u32 i;
35 u32 mem_size = 0;
36
37 /* Read two bank sizes and sum */
38 for (i=0; i<2; i++)
39 switch (mfdcr(DCRN_MQ0_BS0BAS + i) & MQ0_CONFIG_SIZE_MASK) {
40 case MQ0_CONFIG_SIZE_8M:
41 mem_size += PPC44x_MEM_SIZE_8M;
42 break;
43 case MQ0_CONFIG_SIZE_16M:
44 mem_size += PPC44x_MEM_SIZE_16M;
45 break;
46 case MQ0_CONFIG_SIZE_32M:
47 mem_size += PPC44x_MEM_SIZE_32M;
48 break;
49 case MQ0_CONFIG_SIZE_64M:
50 mem_size += PPC44x_MEM_SIZE_64M;
51 break;
52 case MQ0_CONFIG_SIZE_128M:
53 mem_size += PPC44x_MEM_SIZE_128M;
54 break;
55 case MQ0_CONFIG_SIZE_256M:
56 mem_size += PPC44x_MEM_SIZE_256M;
57 break;
58 case MQ0_CONFIG_SIZE_512M:
59 mem_size += PPC44x_MEM_SIZE_512M;
60 break;
61 case MQ0_CONFIG_SIZE_1G:
62 mem_size += PPC44x_MEM_SIZE_1G;
63 break;
64 case MQ0_CONFIG_SIZE_2G:
65 mem_size += PPC44x_MEM_SIZE_2G;
66 break;
67 default:
68 break;
69 }
70 return mem_size;
71}
diff --git a/arch/ppc/syslib/ibm440sp_common.h b/arch/ppc/syslib/ibm440sp_common.h
new file mode 100644
index 000000000000..a21a9906dcc9
--- /dev/null
+++ b/arch/ppc/syslib/ibm440sp_common.h
@@ -0,0 +1,25 @@
1/*
2 * arch/ppc/syslib/ibm440sp_common.h
3 *
4 * PPC440SP system library
5 *
6 * Matt Porter <mporter@kernel.crashing.org>
7 * Copyright 2004-2005 MontaVista Software, Inc.
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 */
15#ifdef __KERNEL__
16#ifndef __PPC_SYSLIB_IBM440SP_COMMON_H
17#define __PPC_SYSLIB_IBM440SP_COMMON_H
18
19#ifndef __ASSEMBLY__
20
21extern unsigned long __init ibm440sp_find_end_of_memory(void);
22
23#endif /* __ASSEMBLY__ */
24#endif /* __PPC_SYSLIB_IBM440SP_COMMON_H */
25#endif /* __KERNEL__ */
diff --git a/arch/ppc/syslib/ibm44x_common.c b/arch/ppc/syslib/ibm44x_common.c
new file mode 100644
index 000000000000..7612e0623f99
--- /dev/null
+++ b/arch/ppc/syslib/ibm44x_common.c
@@ -0,0 +1,193 @@
1/*
2 * arch/ppc/syslib/ibm44x_common.c
3 *
4 * PPC44x system library
5 *
6 * Matt Porter <mporter@kernel.crashing.org>
7 * Copyright 2002-2005 MontaVista Software Inc.
8 *
9 * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
10 * Copyright (c) 2003, 2004 Zultys Technologies
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 *
17 */
18#include <linux/config.h>
19#include <linux/time.h>
20#include <linux/types.h>
21#include <linux/serial.h>
22#include <linux/module.h>
23
24#include <asm/ibm44x.h>
25#include <asm/mmu.h>
26#include <asm/machdep.h>
27#include <asm/time.h>
28#include <asm/ppc4xx_pic.h>
29#include <asm/param.h>
30
31#include <syslib/gen550.h>
32
33phys_addr_t fixup_bigphys_addr(phys_addr_t addr, phys_addr_t size)
34{
35 phys_addr_t page_4gb = 0;
36
37 /*
38 * Trap the least significant 32-bit portions of an
39 * address in the 440's 36-bit address space. Fix
40 * them up with the appropriate ERPN
41 */
42 if ((addr >= PPC44x_IO_LO) && (addr <= PPC44x_IO_HI))
43 page_4gb = PPC44x_IO_PAGE;
44 else if ((addr >= PPC44x_PCI0CFG_LO) && (addr <= PPC44x_PCI0CFG_HI))
45 page_4gb = PPC44x_PCICFG_PAGE;
46#ifdef CONFIG_440SP
47 else if ((addr >= PPC44x_PCI1CFG_LO) && (addr <= PPC44x_PCI1CFG_HI))
48 page_4gb = PPC44x_PCICFG_PAGE;
49 else if ((addr >= PPC44x_PCI2CFG_LO) && (addr <= PPC44x_PCI2CFG_HI))
50 page_4gb = PPC44x_PCICFG_PAGE;
51#endif
52 else if ((addr >= PPC44x_PCIMEM_LO) && (addr <= PPC44x_PCIMEM_HI))
53 page_4gb = PPC44x_PCIMEM_PAGE;
54
55 return (page_4gb | addr);
56};
57EXPORT_SYMBOL(fixup_bigphys_addr);
58
59void __init ibm44x_calibrate_decr(unsigned int freq)
60{
61 tb_ticks_per_jiffy = freq / HZ;
62 tb_to_us = mulhwu_scale_factor(freq, 1000000);
63
64 /* Set the time base to zero */
65 mtspr(SPRN_TBWL, 0);
66 mtspr(SPRN_TBWU, 0);
67
68 /* Clear any pending timer interrupts */
69 mtspr(SPRN_TSR, TSR_ENW | TSR_WIS | TSR_DIS | TSR_FIS);
70
71 /* Enable decrementer interrupt */
72 mtspr(SPRN_TCR, TCR_DIE);
73}
74
75extern void abort(void);
76
77static void ibm44x_restart(char *cmd)
78{
79 local_irq_disable();
80 abort();
81}
82
83static void ibm44x_power_off(void)
84{
85 local_irq_disable();
86 for(;;);
87}
88
89static void ibm44x_halt(void)
90{
91 local_irq_disable();
92 for(;;);
93}
94
95/*
96 * Read the 44x memory controller to get size of system memory.
97 */
98static unsigned long __init ibm44x_find_end_of_memory(void)
99{
100 u32 i, bank_config;
101 u32 mem_size = 0;
102
103 for (i=0; i<4; i++)
104 {
105 switch (i)
106 {
107 case 0:
108 mtdcr(DCRN_SDRAM0_CFGADDR, SDRAM0_B0CR);
109 break;
110 case 1:
111 mtdcr(DCRN_SDRAM0_CFGADDR, SDRAM0_B1CR);
112 break;
113 case 2:
114 mtdcr(DCRN_SDRAM0_CFGADDR, SDRAM0_B2CR);
115 break;
116 case 3:
117 mtdcr(DCRN_SDRAM0_CFGADDR, SDRAM0_B3CR);
118 break;
119 }
120
121 bank_config = mfdcr(DCRN_SDRAM0_CFGDATA);
122
123 if (!(bank_config & SDRAM_CONFIG_BANK_ENABLE))
124 continue;
125 switch (SDRAM_CONFIG_BANK_SIZE(bank_config))
126 {
127 case SDRAM_CONFIG_SIZE_8M:
128 mem_size += PPC44x_MEM_SIZE_8M;
129 break;
130 case SDRAM_CONFIG_SIZE_16M:
131 mem_size += PPC44x_MEM_SIZE_16M;
132 break;
133 case SDRAM_CONFIG_SIZE_32M:
134 mem_size += PPC44x_MEM_SIZE_32M;
135 break;
136 case SDRAM_CONFIG_SIZE_64M:
137 mem_size += PPC44x_MEM_SIZE_64M;
138 break;
139 case SDRAM_CONFIG_SIZE_128M:
140 mem_size += PPC44x_MEM_SIZE_128M;
141 break;
142 case SDRAM_CONFIG_SIZE_256M:
143 mem_size += PPC44x_MEM_SIZE_256M;
144 break;
145 case SDRAM_CONFIG_SIZE_512M:
146 mem_size += PPC44x_MEM_SIZE_512M;
147 break;
148 }
149 }
150 return mem_size;
151}
152
153void __init ibm44x_platform_init(void)
154{
155 ppc_md.init_IRQ = ppc4xx_pic_init;
156 ppc_md.find_end_of_memory = ibm44x_find_end_of_memory;
157 ppc_md.restart = ibm44x_restart;
158 ppc_md.power_off = ibm44x_power_off;
159 ppc_md.halt = ibm44x_halt;
160
161#ifdef CONFIG_SERIAL_TEXT_DEBUG
162 ppc_md.progress = gen550_progress;
163#endif /* CONFIG_SERIAL_TEXT_DEBUG */
164#ifdef CONFIG_KGDB
165 ppc_md.kgdb_map_scc = gen550_kgdb_map_scc;
166#endif
167
168 /*
169 * The Abatron BDI JTAG debugger does not tolerate others
170 * mucking with the debug registers.
171 */
172#if !defined(CONFIG_BDI_SWITCH)
173 /* Enable internal debug mode */
174 mtspr(SPRN_DBCR0, (DBCR0_IDM));
175
176 /* Clear any residual debug events */
177 mtspr(SPRN_DBSR, 0xffffffff);
178#endif
179}
180
181/* Called from MachineCheckException */
182void platform_machine_check(struct pt_regs *regs)
183{
184 printk("PLB0: BEAR=0x%08x%08x ACR= 0x%08x BESR= 0x%08x\n",
185 mfdcr(DCRN_PLB0_BEARH), mfdcr(DCRN_PLB0_BEARL),
186 mfdcr(DCRN_PLB0_ACR), mfdcr(DCRN_PLB0_BESR));
187 printk("POB0: BEAR=0x%08x%08x BESR0=0x%08x BESR1=0x%08x\n",
188 mfdcr(DCRN_POB0_BEARH), mfdcr(DCRN_POB0_BEARL),
189 mfdcr(DCRN_POB0_BESR0), mfdcr(DCRN_POB0_BESR1));
190 printk("OPB0: BEAR=0x%08x%08x BSTAT=0x%08x\n",
191 mfdcr(DCRN_OPB0_BEARH), mfdcr(DCRN_OPB0_BEARL),
192 mfdcr(DCRN_OPB0_BSTAT));
193}
diff --git a/arch/ppc/syslib/ibm44x_common.h b/arch/ppc/syslib/ibm44x_common.h
new file mode 100644
index 000000000000..b14eb603ce01
--- /dev/null
+++ b/arch/ppc/syslib/ibm44x_common.h
@@ -0,0 +1,42 @@
1/*
2 * arch/ppc/kernel/ibm44x_common.h
3 *
4 * PPC44x system library
5 *
6 * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
7 * Copyright (c) 2003, 2004 Zultys Technologies
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 */
15#ifdef __KERNEL__
16#ifndef __PPC_SYSLIB_IBM44x_COMMON_H
17#define __PPC_SYSLIB_IBM44x_COMMON_H
18
19#ifndef __ASSEMBLY__
20
21/*
22 * All clocks are in Hz
23 */
24struct ibm44x_clocks {
25 unsigned int vco; /* VCO, 0 if system PLL is bypassed */
26 unsigned int cpu; /* CPUCoreClk */
27 unsigned int plb; /* PLBClk */
28 unsigned int opb; /* OPBClk */
29 unsigned int ebc; /* PerClk */
30 unsigned int uart0;
31 unsigned int uart1;
32};
33
34/* common 44x platform init */
35void ibm44x_platform_init(void) __init;
36
37/* initialize decrementer and tick-related variables */
38void ibm44x_calibrate_decr(unsigned int freq) __init;
39
40#endif /* __ASSEMBLY__ */
41#endif /* __PPC_SYSLIB_IBM44x_COMMON_H */
42#endif /* __KERNEL__ */
diff --git a/arch/ppc/syslib/ibm_ocp.c b/arch/ppc/syslib/ibm_ocp.c
new file mode 100644
index 000000000000..3f6e55c79181
--- /dev/null
+++ b/arch/ppc/syslib/ibm_ocp.c
@@ -0,0 +1,9 @@
1#include <linux/module.h>
2#include <asm/ocp.h>
3
4struct ocp_sys_info_data ocp_sys_info = {
5 .opb_bus_freq = 50000000, /* OPB Bus Frequency (Hz) */
6 .ebc_bus_freq = 33333333, /* EBC Bus Frequency (Hz) */
7};
8
9EXPORT_SYMBOL(ocp_sys_info);
diff --git a/arch/ppc/syslib/indirect_pci.c b/arch/ppc/syslib/indirect_pci.c
new file mode 100644
index 000000000000..a5a752609e2c
--- /dev/null
+++ b/arch/ppc/syslib/indirect_pci.c
@@ -0,0 +1,135 @@
1/*
2 * Support for indirect PCI bridges.
3 *
4 * Copyright (C) 1998 Gabriel Paubert.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#include <linux/kernel.h>
13#include <linux/pci.h>
14#include <linux/delay.h>
15#include <linux/string.h>
16#include <linux/init.h>
17#include <linux/bootmem.h>
18
19#include <asm/io.h>
20#include <asm/prom.h>
21#include <asm/pci-bridge.h>
22#include <asm/machdep.h>
23
24#ifdef CONFIG_PPC_INDIRECT_PCI_BE
25#define PCI_CFG_OUT out_be32
26#else
27#define PCI_CFG_OUT out_le32
28#endif
29
30static int
31indirect_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
32 int len, u32 *val)
33{
34 struct pci_controller *hose = bus->sysdata;
35 volatile void __iomem *cfg_data;
36 u8 cfg_type = 0;
37
38 if (ppc_md.pci_exclude_device)
39 if (ppc_md.pci_exclude_device(bus->number, devfn))
40 return PCIBIOS_DEVICE_NOT_FOUND;
41
42 if (hose->set_cfg_type)
43 if (bus->number != hose->first_busno)
44 cfg_type = 1;
45
46 PCI_CFG_OUT(hose->cfg_addr,
47 (0x80000000 | ((bus->number - hose->bus_offset) << 16)
48 | (devfn << 8) | ((offset & 0xfc) | cfg_type)));
49
50 /*
51 * Note: the caller has already checked that offset is
52 * suitably aligned and that len is 1, 2 or 4.
53 */
54 cfg_data = hose->cfg_data + (offset & 3);
55 switch (len) {
56 case 1:
57 *val = in_8(cfg_data);
58 break;
59 case 2:
60 *val = in_le16(cfg_data);
61 break;
62 default:
63 *val = in_le32(cfg_data);
64 break;
65 }
66 return PCIBIOS_SUCCESSFUL;
67}
68
69static int
70indirect_write_config(struct pci_bus *bus, unsigned int devfn, int offset,
71 int len, u32 val)
72{
73 struct pci_controller *hose = bus->sysdata;
74 volatile void __iomem *cfg_data;
75 u8 cfg_type = 0;
76
77 if (ppc_md.pci_exclude_device)
78 if (ppc_md.pci_exclude_device(bus->number, devfn))
79 return PCIBIOS_DEVICE_NOT_FOUND;
80
81 if (hose->set_cfg_type)
82 if (bus->number != hose->first_busno)
83 cfg_type = 1;
84
85 PCI_CFG_OUT(hose->cfg_addr,
86 (0x80000000 | ((bus->number - hose->bus_offset) << 16)
87 | (devfn << 8) | ((offset & 0xfc) | cfg_type)));
88
89 /*
90 * Note: the caller has already checked that offset is
91 * suitably aligned and that len is 1, 2 or 4.
92 */
93 cfg_data = hose->cfg_data + (offset & 3);
94 switch (len) {
95 case 1:
96 out_8(cfg_data, val);
97 break;
98 case 2:
99 out_le16(cfg_data, val);
100 break;
101 default:
102 out_le32(cfg_data, val);
103 break;
104 }
105 return PCIBIOS_SUCCESSFUL;
106}
107
108static struct pci_ops indirect_pci_ops =
109{
110 indirect_read_config,
111 indirect_write_config
112};
113
114void __init
115setup_indirect_pci_nomap(struct pci_controller* hose, void __iomem * cfg_addr,
116 void __iomem * cfg_data)
117{
118 hose->cfg_addr = cfg_addr;
119 hose->cfg_data = cfg_data;
120 hose->ops = &indirect_pci_ops;
121}
122
123void __init
124setup_indirect_pci(struct pci_controller* hose, u32 cfg_addr, u32 cfg_data)
125{
126 unsigned long base = cfg_addr & PAGE_MASK;
127 void __iomem *mbase, *addr, *data;
128
129 mbase = ioremap(base, PAGE_SIZE);
130 addr = mbase + (cfg_addr & ~PAGE_MASK);
131 if ((cfg_data & PAGE_MASK) != base)
132 mbase = ioremap(cfg_data & PAGE_MASK, PAGE_SIZE);
133 data = mbase + (cfg_data & ~PAGE_MASK);
134 setup_indirect_pci_nomap(hose, addr, data);
135}
diff --git a/arch/ppc/syslib/ipic.c b/arch/ppc/syslib/ipic.c
new file mode 100644
index 000000000000..acb2cde3171f
--- /dev/null
+++ b/arch/ppc/syslib/ipic.c
@@ -0,0 +1,646 @@
1/*
2 * include/asm-ppc/ipic.c
3 *
4 * IPIC routines implementations.
5 *
6 * Copyright 2005 Freescale Semiconductor, Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/errno.h>
16#include <linux/reboot.h>
17#include <linux/slab.h>
18#include <linux/stddef.h>
19#include <linux/sched.h>
20#include <linux/signal.h>
21#include <linux/sysdev.h>
22#include <asm/irq.h>
23#include <asm/io.h>
24#include <asm/ipic.h>
25#include <asm/mpc83xx.h>
26
27#include "ipic.h"
28
29static struct ipic p_ipic;
30static struct ipic * primary_ipic;
31
32static struct ipic_info ipic_info[] = {
33 [9] = {
34 .pend = IPIC_SIPNR_H,
35 .mask = IPIC_SIMSR_H,
36 .prio = IPIC_SIPRR_D,
37 .force = IPIC_SIFCR_H,
38 .bit = 24,
39 .prio_mask = 0,
40 },
41 [10] = {
42 .pend = IPIC_SIPNR_H,
43 .mask = IPIC_SIMSR_H,
44 .prio = IPIC_SIPRR_D,
45 .force = IPIC_SIFCR_H,
46 .bit = 25,
47 .prio_mask = 1,
48 },
49 [11] = {
50 .pend = IPIC_SIPNR_H,
51 .mask = IPIC_SIMSR_H,
52 .prio = IPIC_SIPRR_D,
53 .force = IPIC_SIFCR_H,
54 .bit = 26,
55 .prio_mask = 2,
56 },
57 [14] = {
58 .pend = IPIC_SIPNR_H,
59 .mask = IPIC_SIMSR_H,
60 .prio = IPIC_SIPRR_D,
61 .force = IPIC_SIFCR_H,
62 .bit = 29,
63 .prio_mask = 5,
64 },
65 [15] = {
66 .pend = IPIC_SIPNR_H,
67 .mask = IPIC_SIMSR_H,
68 .prio = IPIC_SIPRR_D,
69 .force = IPIC_SIFCR_H,
70 .bit = 30,
71 .prio_mask = 6,
72 },
73 [16] = {
74 .pend = IPIC_SIPNR_H,
75 .mask = IPIC_SIMSR_H,
76 .prio = IPIC_SIPRR_D,
77 .force = IPIC_SIFCR_H,
78 .bit = 31,
79 .prio_mask = 7,
80 },
81 [17] = {
82 .pend = IPIC_SIPNR_H,
83 .mask = IPIC_SEMSR,
84 .prio = IPIC_SMPRR_A,
85 .force = IPIC_SEFCR,
86 .bit = 1,
87 .prio_mask = 5,
88 },
89 [18] = {
90 .pend = IPIC_SIPNR_H,
91 .mask = IPIC_SEMSR,
92 .prio = IPIC_SMPRR_A,
93 .force = IPIC_SEFCR,
94 .bit = 2,
95 .prio_mask = 6,
96 },
97 [19] = {
98 .pend = IPIC_SIPNR_H,
99 .mask = IPIC_SEMSR,
100 .prio = IPIC_SMPRR_A,
101 .force = IPIC_SEFCR,
102 .bit = 3,
103 .prio_mask = 7,
104 },
105 [20] = {
106 .pend = IPIC_SIPNR_H,
107 .mask = IPIC_SEMSR,
108 .prio = IPIC_SMPRR_B,
109 .force = IPIC_SEFCR,
110 .bit = 4,
111 .prio_mask = 4,
112 },
113 [21] = {
114 .pend = IPIC_SIPNR_H,
115 .mask = IPIC_SEMSR,
116 .prio = IPIC_SMPRR_B,
117 .force = IPIC_SEFCR,
118 .bit = 5,
119 .prio_mask = 5,
120 },
121 [22] = {
122 .pend = IPIC_SIPNR_H,
123 .mask = IPIC_SEMSR,
124 .prio = IPIC_SMPRR_B,
125 .force = IPIC_SEFCR,
126 .bit = 6,
127 .prio_mask = 6,
128 },
129 [23] = {
130 .pend = IPIC_SIPNR_H,
131 .mask = IPIC_SEMSR,
132 .prio = IPIC_SMPRR_B,
133 .force = IPIC_SEFCR,
134 .bit = 7,
135 .prio_mask = 7,
136 },
137 [32] = {
138 .pend = IPIC_SIPNR_H,
139 .mask = IPIC_SIMSR_H,
140 .prio = IPIC_SIPRR_A,
141 .force = IPIC_SIFCR_H,
142 .bit = 0,
143 .prio_mask = 0,
144 },
145 [33] = {
146 .pend = IPIC_SIPNR_H,
147 .mask = IPIC_SIMSR_H,
148 .prio = IPIC_SIPRR_A,
149 .force = IPIC_SIFCR_H,
150 .bit = 1,
151 .prio_mask = 1,
152 },
153 [34] = {
154 .pend = IPIC_SIPNR_H,
155 .mask = IPIC_SIMSR_H,
156 .prio = IPIC_SIPRR_A,
157 .force = IPIC_SIFCR_H,
158 .bit = 2,
159 .prio_mask = 2,
160 },
161 [35] = {
162 .pend = IPIC_SIPNR_H,
163 .mask = IPIC_SIMSR_H,
164 .prio = IPIC_SIPRR_A,
165 .force = IPIC_SIFCR_H,
166 .bit = 3,
167 .prio_mask = 3,
168 },
169 [36] = {
170 .pend = IPIC_SIPNR_H,
171 .mask = IPIC_SIMSR_H,
172 .prio = IPIC_SIPRR_A,
173 .force = IPIC_SIFCR_H,
174 .bit = 4,
175 .prio_mask = 4,
176 },
177 [37] = {
178 .pend = IPIC_SIPNR_H,
179 .mask = IPIC_SIMSR_H,
180 .prio = IPIC_SIPRR_A,
181 .force = IPIC_SIFCR_H,
182 .bit = 5,
183 .prio_mask = 5,
184 },
185 [38] = {
186 .pend = IPIC_SIPNR_H,
187 .mask = IPIC_SIMSR_H,
188 .prio = IPIC_SIPRR_A,
189 .force = IPIC_SIFCR_H,
190 .bit = 6,
191 .prio_mask = 6,
192 },
193 [39] = {
194 .pend = IPIC_SIPNR_H,
195 .mask = IPIC_SIMSR_H,
196 .prio = IPIC_SIPRR_A,
197 .force = IPIC_SIFCR_H,
198 .bit = 7,
199 .prio_mask = 7,
200 },
201 [48] = {
202 .pend = IPIC_SEPNR,
203 .mask = IPIC_SEMSR,
204 .prio = IPIC_SMPRR_A,
205 .force = IPIC_SEFCR,
206 .bit = 0,
207 .prio_mask = 4,
208 },
209 [64] = {
210 .pend = IPIC_SIPNR_H,
211 .mask = IPIC_SIMSR_L,
212 .prio = IPIC_SMPRR_A,
213 .force = IPIC_SIFCR_L,
214 .bit = 0,
215 .prio_mask = 0,
216 },
217 [65] = {
218 .pend = IPIC_SIPNR_H,
219 .mask = IPIC_SIMSR_L,
220 .prio = IPIC_SMPRR_A,
221 .force = IPIC_SIFCR_L,
222 .bit = 1,
223 .prio_mask = 1,
224 },
225 [66] = {
226 .pend = IPIC_SIPNR_H,
227 .mask = IPIC_SIMSR_L,
228 .prio = IPIC_SMPRR_A,
229 .force = IPIC_SIFCR_L,
230 .bit = 2,
231 .prio_mask = 2,
232 },
233 [67] = {
234 .pend = IPIC_SIPNR_H,
235 .mask = IPIC_SIMSR_L,
236 .prio = IPIC_SMPRR_A,
237 .force = IPIC_SIFCR_L,
238 .bit = 3,
239 .prio_mask = 3,
240 },
241 [68] = {
242 .pend = IPIC_SIPNR_H,
243 .mask = IPIC_SIMSR_L,
244 .prio = IPIC_SMPRR_B,
245 .force = IPIC_SIFCR_L,
246 .bit = 4,
247 .prio_mask = 0,
248 },
249 [69] = {
250 .pend = IPIC_SIPNR_H,
251 .mask = IPIC_SIMSR_L,
252 .prio = IPIC_SMPRR_B,
253 .force = IPIC_SIFCR_L,
254 .bit = 5,
255 .prio_mask = 1,
256 },
257 [70] = {
258 .pend = IPIC_SIPNR_H,
259 .mask = IPIC_SIMSR_L,
260 .prio = IPIC_SMPRR_B,
261 .force = IPIC_SIFCR_L,
262 .bit = 6,
263 .prio_mask = 2,
264 },
265 [71] = {
266 .pend = IPIC_SIPNR_H,
267 .mask = IPIC_SIMSR_L,
268 .prio = IPIC_SMPRR_B,
269 .force = IPIC_SIFCR_L,
270 .bit = 7,
271 .prio_mask = 3,
272 },
273 [72] = {
274 .pend = IPIC_SIPNR_H,
275 .mask = IPIC_SIMSR_L,
276 .prio = 0,
277 .force = IPIC_SIFCR_L,
278 .bit = 8,
279 },
280 [73] = {
281 .pend = IPIC_SIPNR_H,
282 .mask = IPIC_SIMSR_L,
283 .prio = 0,
284 .force = IPIC_SIFCR_L,
285 .bit = 9,
286 },
287 [74] = {
288 .pend = IPIC_SIPNR_H,
289 .mask = IPIC_SIMSR_L,
290 .prio = 0,
291 .force = IPIC_SIFCR_L,
292 .bit = 10,
293 },
294 [75] = {
295 .pend = IPIC_SIPNR_H,
296 .mask = IPIC_SIMSR_L,
297 .prio = 0,
298 .force = IPIC_SIFCR_L,
299 .bit = 11,
300 },
301 [76] = {
302 .pend = IPIC_SIPNR_H,
303 .mask = IPIC_SIMSR_L,
304 .prio = 0,
305 .force = IPIC_SIFCR_L,
306 .bit = 12,
307 },
308 [77] = {
309 .pend = IPIC_SIPNR_H,
310 .mask = IPIC_SIMSR_L,
311 .prio = 0,
312 .force = IPIC_SIFCR_L,
313 .bit = 13,
314 },
315 [78] = {
316 .pend = IPIC_SIPNR_H,
317 .mask = IPIC_SIMSR_L,
318 .prio = 0,
319 .force = IPIC_SIFCR_L,
320 .bit = 14,
321 },
322 [79] = {
323 .pend = IPIC_SIPNR_H,
324 .mask = IPIC_SIMSR_L,
325 .prio = 0,
326 .force = IPIC_SIFCR_L,
327 .bit = 15,
328 },
329 [80] = {
330 .pend = IPIC_SIPNR_H,
331 .mask = IPIC_SIMSR_L,
332 .prio = 0,
333 .force = IPIC_SIFCR_L,
334 .bit = 16,
335 },
336 [84] = {
337 .pend = IPIC_SIPNR_H,
338 .mask = IPIC_SIMSR_L,
339 .prio = 0,
340 .force = IPIC_SIFCR_L,
341 .bit = 20,
342 },
343 [85] = {
344 .pend = IPIC_SIPNR_H,
345 .mask = IPIC_SIMSR_L,
346 .prio = 0,
347 .force = IPIC_SIFCR_L,
348 .bit = 21,
349 },
350 [90] = {
351 .pend = IPIC_SIPNR_H,
352 .mask = IPIC_SIMSR_L,
353 .prio = 0,
354 .force = IPIC_SIFCR_L,
355 .bit = 26,
356 },
357 [91] = {
358 .pend = IPIC_SIPNR_H,
359 .mask = IPIC_SIMSR_L,
360 .prio = 0,
361 .force = IPIC_SIFCR_L,
362 .bit = 27,
363 },
364};
365
366static inline u32 ipic_read(volatile u32 __iomem *base, unsigned int reg)
367{
368 return in_be32(base + (reg >> 2));
369}
370
371static inline void ipic_write(volatile u32 __iomem *base, unsigned int reg, u32 value)
372{
373 out_be32(base + (reg >> 2), value);
374}
375
376static inline struct ipic * ipic_from_irq(unsigned int irq)
377{
378 return primary_ipic;
379}
380
381static void ipic_enable_irq(unsigned int irq)
382{
383 struct ipic *ipic = ipic_from_irq(irq);
384 unsigned int src = irq - ipic->irq_offset;
385 u32 temp;
386
387 temp = ipic_read(ipic->regs, ipic_info[src].mask);
388 temp |= (1 << (31 - ipic_info[src].bit));
389 ipic_write(ipic->regs, ipic_info[src].mask, temp);
390}
391
392static void ipic_disable_irq(unsigned int irq)
393{
394 struct ipic *ipic = ipic_from_irq(irq);
395 unsigned int src = irq - ipic->irq_offset;
396 u32 temp;
397
398 temp = ipic_read(ipic->regs, ipic_info[src].mask);
399 temp &= ~(1 << (31 - ipic_info[src].bit));
400 ipic_write(ipic->regs, ipic_info[src].mask, temp);
401}
402
403static void ipic_disable_irq_and_ack(unsigned int irq)
404{
405 struct ipic *ipic = ipic_from_irq(irq);
406 unsigned int src = irq - ipic->irq_offset;
407 u32 temp;
408
409 ipic_disable_irq(irq);
410
411 temp = ipic_read(ipic->regs, ipic_info[src].pend);
412 temp |= (1 << (31 - ipic_info[src].bit));
413 ipic_write(ipic->regs, ipic_info[src].pend, temp);
414}
415
416static void ipic_end_irq(unsigned int irq)
417{
418 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
419 ipic_enable_irq(irq);
420}
421
422struct hw_interrupt_type ipic = {
423 .typename = " IPIC ",
424 .enable = ipic_enable_irq,
425 .disable = ipic_disable_irq,
426 .ack = ipic_disable_irq_and_ack,
427 .end = ipic_end_irq,
428};
429
430void __init ipic_init(phys_addr_t phys_addr,
431 unsigned int flags,
432 unsigned int irq_offset,
433 unsigned char *senses,
434 unsigned int senses_count)
435{
436 u32 i, temp = 0;
437
438 primary_ipic = &p_ipic;
439 primary_ipic->regs = ioremap(phys_addr, MPC83xx_IPIC_SIZE);
440
441 primary_ipic->irq_offset = irq_offset;
442
443 ipic_write(primary_ipic->regs, IPIC_SICNR, 0x0);
444
445 /* default priority scheme is grouped. If spread mode is required
446 * configure SICFR accordingly */
447 if (flags & IPIC_SPREADMODE_GRP_A)
448 temp |= SICFR_IPSA;
449 if (flags & IPIC_SPREADMODE_GRP_D)
450 temp |= SICFR_IPSD;
451 if (flags & IPIC_SPREADMODE_MIX_A)
452 temp |= SICFR_MPSA;
453 if (flags & IPIC_SPREADMODE_MIX_B)
454 temp |= SICFR_MPSB;
455
456 ipic_write(primary_ipic->regs, IPIC_SICNR, temp);
457
458 /* handle MCP route */
459 temp = 0;
460 if (flags & IPIC_DISABLE_MCP_OUT)
461 temp = SERCR_MCPR;
462 ipic_write(primary_ipic->regs, IPIC_SERCR, temp);
463
464 /* handle routing of IRQ0 to MCP */
465 temp = ipic_read(primary_ipic->regs, IPIC_SEMSR);
466
467 if (flags & IPIC_IRQ0_MCP)
468 temp |= SEMSR_SIRQ0;
469 else
470 temp &= ~SEMSR_SIRQ0;
471
472 ipic_write(primary_ipic->regs, IPIC_SEMSR, temp);
473
474 for (i = 0 ; i < NR_IPIC_INTS ; i++) {
475 irq_desc[i+irq_offset].handler = &ipic;
476 irq_desc[i+irq_offset].status = IRQ_LEVEL;
477 }
478
479 temp = 0;
480 for (i = 0 ; i < senses_count ; i++) {
481 if ((senses[i] & IRQ_SENSE_MASK) == IRQ_SENSE_EDGE) {
482 temp |= 1 << (16 - i);
483 if (i != 0)
484 irq_desc[i + irq_offset + MPC83xx_IRQ_EXT1 - 1].status = 0;
485 else
486 irq_desc[irq_offset + MPC83xx_IRQ_EXT0].status = 0;
487 }
488 }
489 ipic_write(primary_ipic->regs, IPIC_SECNR, temp);
490
491 printk ("IPIC (%d IRQ sources, %d External IRQs) at %p\n", NR_IPIC_INTS,
492 senses_count, primary_ipic->regs);
493}
494
495int ipic_set_priority(unsigned int irq, unsigned int priority)
496{
497 struct ipic *ipic = ipic_from_irq(irq);
498 unsigned int src = irq - ipic->irq_offset;
499 u32 temp;
500
501 if (priority > 7)
502 return -EINVAL;
503 if (src > 127)
504 return -EINVAL;
505 if (ipic_info[src].prio == 0)
506 return -EINVAL;
507
508 temp = ipic_read(ipic->regs, ipic_info[src].prio);
509
510 if (priority < 4) {
511 temp &= ~(0x7 << (20 + (3 - priority) * 3));
512 temp |= ipic_info[src].prio_mask << (20 + (3 - priority) * 3);
513 } else {
514 temp &= ~(0x7 << (4 + (7 - priority) * 3));
515 temp |= ipic_info[src].prio_mask << (4 + (7 - priority) * 3);
516 }
517
518 ipic_write(ipic->regs, ipic_info[src].prio, temp);
519
520 return 0;
521}
522
523void ipic_set_highest_priority(unsigned int irq)
524{
525 struct ipic *ipic = ipic_from_irq(irq);
526 unsigned int src = irq - ipic->irq_offset;
527 u32 temp;
528
529 temp = ipic_read(ipic->regs, IPIC_SICFR);
530
531 /* clear and set HPI */
532 temp &= 0x7f000000;
533 temp |= (src & 0x7f) << 24;
534
535 ipic_write(ipic->regs, IPIC_SICFR, temp);
536}
537
538void ipic_set_default_priority(void)
539{
540 ipic_set_priority(MPC83xx_IRQ_TSEC1_TX, 0);
541 ipic_set_priority(MPC83xx_IRQ_TSEC1_RX, 1);
542 ipic_set_priority(MPC83xx_IRQ_TSEC1_ERROR, 2);
543 ipic_set_priority(MPC83xx_IRQ_TSEC2_TX, 3);
544 ipic_set_priority(MPC83xx_IRQ_TSEC2_RX, 4);
545 ipic_set_priority(MPC83xx_IRQ_TSEC2_ERROR, 5);
546 ipic_set_priority(MPC83xx_IRQ_USB2_DR, 6);
547 ipic_set_priority(MPC83xx_IRQ_USB2_MPH, 7);
548
549 ipic_set_priority(MPC83xx_IRQ_UART1, 0);
550 ipic_set_priority(MPC83xx_IRQ_UART2, 1);
551 ipic_set_priority(MPC83xx_IRQ_SEC2, 2);
552 ipic_set_priority(MPC83xx_IRQ_IIC1, 5);
553 ipic_set_priority(MPC83xx_IRQ_IIC2, 6);
554 ipic_set_priority(MPC83xx_IRQ_SPI, 7);
555 ipic_set_priority(MPC83xx_IRQ_RTC_SEC, 0);
556 ipic_set_priority(MPC83xx_IRQ_PIT, 1);
557 ipic_set_priority(MPC83xx_IRQ_PCI1, 2);
558 ipic_set_priority(MPC83xx_IRQ_PCI2, 3);
559 ipic_set_priority(MPC83xx_IRQ_EXT0, 4);
560 ipic_set_priority(MPC83xx_IRQ_EXT1, 5);
561 ipic_set_priority(MPC83xx_IRQ_EXT2, 6);
562 ipic_set_priority(MPC83xx_IRQ_EXT3, 7);
563 ipic_set_priority(MPC83xx_IRQ_RTC_ALR, 0);
564 ipic_set_priority(MPC83xx_IRQ_MU, 1);
565 ipic_set_priority(MPC83xx_IRQ_SBA, 2);
566 ipic_set_priority(MPC83xx_IRQ_DMA, 3);
567 ipic_set_priority(MPC83xx_IRQ_EXT4, 4);
568 ipic_set_priority(MPC83xx_IRQ_EXT5, 5);
569 ipic_set_priority(MPC83xx_IRQ_EXT6, 6);
570 ipic_set_priority(MPC83xx_IRQ_EXT7, 7);
571}
572
573void ipic_enable_mcp(enum ipic_mcp_irq mcp_irq)
574{
575 struct ipic *ipic = primary_ipic;
576 u32 temp;
577
578 temp = ipic_read(ipic->regs, IPIC_SERMR);
579 temp |= (1 << (31 - mcp_irq));
580 ipic_write(ipic->regs, IPIC_SERMR, temp);
581}
582
583void ipic_disable_mcp(enum ipic_mcp_irq mcp_irq)
584{
585 struct ipic *ipic = primary_ipic;
586 u32 temp;
587
588 temp = ipic_read(ipic->regs, IPIC_SERMR);
589 temp &= (1 << (31 - mcp_irq));
590 ipic_write(ipic->regs, IPIC_SERMR, temp);
591}
592
593u32 ipic_get_mcp_status(void)
594{
595 return ipic_read(primary_ipic->regs, IPIC_SERMR);
596}
597
598void ipic_clear_mcp_status(u32 mask)
599{
600 ipic_write(primary_ipic->regs, IPIC_SERMR, mask);
601}
602
603/* Return an interrupt vector or -1 if no interrupt is pending. */
604int ipic_get_irq(struct pt_regs *regs)
605{
606 int irq;
607
608 irq = ipic_read(primary_ipic->regs, IPIC_SIVCR) & 0x7f;
609
610 if (irq == 0) /* 0 --> no irq is pending */
611 irq = -1;
612
613 return irq;
614}
615
616static struct sysdev_class ipic_sysclass = {
617 set_kset_name("ipic"),
618};
619
620static struct sys_device device_ipic = {
621 .id = 0,
622 .cls = &ipic_sysclass,
623};
624
625static int __init init_ipic_sysfs(void)
626{
627 int rc;
628
629 if (!primary_ipic->regs)
630 return -ENODEV;
631 printk(KERN_DEBUG "Registering ipic with sysfs...\n");
632
633 rc = sysdev_class_register(&ipic_sysclass);
634 if (rc) {
635 printk(KERN_ERR "Failed registering ipic sys class\n");
636 return -ENODEV;
637 }
638 rc = sysdev_register(&device_ipic);
639 if (rc) {
640 printk(KERN_ERR "Failed registering ipic sys device\n");
641 return -ENODEV;
642 }
643 return 0;
644}
645
646subsys_initcall(init_ipic_sysfs);
diff --git a/arch/ppc/syslib/ipic.h b/arch/ppc/syslib/ipic.h
new file mode 100644
index 000000000000..2b56a4fcf373
--- /dev/null
+++ b/arch/ppc/syslib/ipic.h
@@ -0,0 +1,49 @@
1/*
2 * arch/ppc/kernel/ipic.h
3 *
4 * IPIC private definitions and structure.
5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com>
7 *
8 * Copyright 2005 Freescale Semiconductor, Inc
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15#ifndef __IPIC_H__
16#define __IPIC_H__
17
18#include <asm/ipic.h>
19
20#define MPC83xx_IPIC_SIZE (0x00100)
21
22/* System Global Interrupt Configuration Register */
23#define SICFR_IPSA 0x00010000
24#define SICFR_IPSD 0x00080000
25#define SICFR_MPSA 0x00200000
26#define SICFR_MPSB 0x00400000
27
28/* System External Interrupt Mask Register */
29#define SEMSR_SIRQ0 0x00008000
30
31/* System Error Control Register */
32#define SERCR_MCPR 0x00000001
33
34struct ipic {
35 volatile u32 __iomem *regs;
36 unsigned int irq_offset;
37};
38
39struct ipic_info {
40 u8 pend; /* pending register offset from base */
41 u8 mask; /* mask register offset from base */
42 u8 prio; /* priority register offset from base */
43 u8 force; /* force register offset from base */
44 u8 bit; /* register bit position (as per doc)
45 bit mask = 1 << (31 - bit) */
46 u8 prio_mask; /* priority mask value */
47};
48
49#endif /* __IPIC_H__ */
diff --git a/arch/ppc/syslib/m8260_pci.c b/arch/ppc/syslib/m8260_pci.c
new file mode 100644
index 000000000000..bd564fb35ab6
--- /dev/null
+++ b/arch/ppc/syslib/m8260_pci.c
@@ -0,0 +1,194 @@
1/*
2 * (C) Copyright 2003
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 *
5 * (C) Copyright 2004 Red Hat, Inc.
6 *
7 * See file CREDITS for list of people who contributed to this
8 * project.
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation; either version 2 of
13 * the License, or (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
23 * MA 02111-1307 USA
24 */
25
26#include <linux/kernel.h>
27#include <linux/init.h>
28#include <linux/pci.h>
29#include <linux/slab.h>
30#include <linux/delay.h>
31
32#include <asm/byteorder.h>
33#include <asm/io.h>
34#include <asm/irq.h>
35#include <asm/uaccess.h>
36#include <asm/machdep.h>
37#include <asm/pci-bridge.h>
38#include <asm/immap_cpm2.h>
39#include <asm/mpc8260.h>
40
41#include "m8260_pci.h"
42
43
44/* PCI bus configuration registers.
45 */
46
47static void __init m8260_setup_pci(struct pci_controller *hose)
48{
49 volatile cpm2_map_t *immap = cpm2_immr;
50 unsigned long pocmr;
51 u16 tempShort;
52
53#ifndef CONFIG_ATC /* already done in U-Boot */
54 /*
55 * Setting required to enable IRQ1-IRQ7 (SIUMCR [DPPC]),
56 * and local bus for PCI (SIUMCR [LBPC]).
57 */
58 immap->im_siu_conf.siu_82xx.sc_siumcr = 0x00640000;
59#endif
60
61 /* Make PCI lowest priority */
62 /* Each 4 bits is a device bus request and the MS 4bits
63 is highest priority */
64 /* Bus 4bit value
65 --- ----------
66 CPM high 0b0000
67 CPM middle 0b0001
68 CPM low 0b0010
69 PCI reguest 0b0011
70 Reserved 0b0100
71 Reserved 0b0101
72 Internal Core 0b0110
73 External Master 1 0b0111
74 External Master 2 0b1000
75 External Master 3 0b1001
76 The rest are reserved */
77 immap->im_siu_conf.siu_82xx.sc_ppc_alrh = 0x61207893;
78
79 /* Park bus on core while modifying PCI Bus accesses */
80 immap->im_siu_conf.siu_82xx.sc_ppc_acr = 0x6;
81
82 /*
83 * Set up master window that allows the CPU to access PCI space. This
84 * window is set up using the first SIU PCIBR registers.
85 */
86 immap->im_memctl.memc_pcimsk0 = MPC826x_PCI_MASK;
87 immap->im_memctl.memc_pcibr0 = MPC826x_PCI_BASE | PCIBR_ENABLE;
88
89 /* Disable machine check on no response or target abort */
90 immap->im_pci.pci_emr = cpu_to_le32(0x1fe7);
91 /* Release PCI RST (by default the PCI RST signal is held low) */
92 immap->im_pci.pci_gcr = cpu_to_le32(PCIGCR_PCI_BUS_EN);
93
94 /* give it some time */
95 mdelay(1);
96
97 /*
98 * Set up master window that allows the CPU to access PCI Memory (prefetch)
99 * space. This window is set up using the first set of Outbound ATU registers.
100 */
101 immap->im_pci.pci_potar0 = cpu_to_le32(MPC826x_PCI_LOWER_MEM >> 12);
102 immap->im_pci.pci_pobar0 = cpu_to_le32((MPC826x_PCI_LOWER_MEM - MPC826x_PCI_MEM_OFFSET) >> 12);
103 pocmr = ((MPC826x_PCI_UPPER_MEM - MPC826x_PCI_LOWER_MEM) >> 12) ^ 0xfffff;
104 immap->im_pci.pci_pocmr0 = cpu_to_le32(pocmr | POCMR_ENABLE | POCMR_PREFETCH_EN);
105
106 /*
107 * Set up master window that allows the CPU to access PCI Memory (non-prefetch)
108 * space. This window is set up using the second set of Outbound ATU registers.
109 */
110 immap->im_pci.pci_potar1 = cpu_to_le32(MPC826x_PCI_LOWER_MMIO >> 12);
111 immap->im_pci.pci_pobar1 = cpu_to_le32((MPC826x_PCI_LOWER_MMIO - MPC826x_PCI_MMIO_OFFSET) >> 12);
112 pocmr = ((MPC826x_PCI_UPPER_MMIO - MPC826x_PCI_LOWER_MMIO) >> 12) ^ 0xfffff;
113 immap->im_pci.pci_pocmr1 = cpu_to_le32(pocmr | POCMR_ENABLE);
114
115 /*
116 * Set up master window that allows the CPU to access PCI IO space. This window
117 * is set up using the third set of Outbound ATU registers.
118 */
119 immap->im_pci.pci_potar2 = cpu_to_le32(MPC826x_PCI_IO_BASE >> 12);
120 immap->im_pci.pci_pobar2 = cpu_to_le32(MPC826x_PCI_LOWER_IO >> 12);
121 pocmr = ((MPC826x_PCI_UPPER_IO - MPC826x_PCI_LOWER_IO) >> 12) ^ 0xfffff;
122 immap->im_pci.pci_pocmr2 = cpu_to_le32(pocmr | POCMR_ENABLE | POCMR_PCI_IO);
123
124 /*
125 * Set up slave window that allows PCI masters to access MPC826x local memory.
126 * This window is set up using the first set of Inbound ATU registers
127 */
128
129 immap->im_pci.pci_pitar0 = cpu_to_le32(MPC826x_PCI_SLAVE_MEM_LOCAL >> 12);
130 immap->im_pci.pci_pibar0 = cpu_to_le32(MPC826x_PCI_SLAVE_MEM_BUS >> 12);
131 pocmr = ((MPC826x_PCI_SLAVE_MEM_SIZE-1) >> 12) ^ 0xfffff;
132 immap->im_pci.pci_picmr0 = cpu_to_le32(pocmr | PICMR_ENABLE | PICMR_PREFETCH_EN);
133
134 /* See above for description - puts PCI request as highest priority */
135 immap->im_siu_conf.siu_82xx.sc_ppc_alrh = 0x03124567;
136
137 /* Park the bus on the PCI */
138 immap->im_siu_conf.siu_82xx.sc_ppc_acr = PPC_ACR_BUS_PARK_PCI;
139
140 /* Host mode - specify the bridge as a host-PCI bridge */
141 early_write_config_word(hose, 0, 0, PCI_CLASS_DEVICE, PCI_CLASS_BRIDGE_HOST);
142
143 /* Enable the host bridge to be a master on the PCI bus, and to act as a PCI memory target */
144 early_read_config_word(hose, 0, 0, PCI_COMMAND, &tempShort);
145 early_write_config_word(hose, 0, 0, PCI_COMMAND,
146 tempShort | PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY);
147}
148
149void __init m8260_find_bridges(void)
150{
151 extern int pci_assign_all_busses;
152 struct pci_controller * hose;
153
154 pci_assign_all_busses = 1;
155
156 hose = pcibios_alloc_controller();
157
158 if (!hose)
159 return;
160
161 ppc_md.pci_swizzle = common_swizzle;
162
163 hose->first_busno = 0;
164 hose->bus_offset = 0;
165 hose->last_busno = 0xff;
166
167 setup_m8260_indirect_pci(hose,
168 (unsigned long)&cpm2_immr->im_pci.pci_cfg_addr,
169 (unsigned long)&cpm2_immr->im_pci.pci_cfg_data);
170
171 m8260_setup_pci(hose);
172 hose->pci_mem_offset = MPC826x_PCI_MEM_OFFSET;
173
174 isa_io_base =
175 (unsigned long) ioremap(MPC826x_PCI_IO_BASE,
176 MPC826x_PCI_IO_SIZE);
177 hose->io_base_virt = (void *) isa_io_base;
178
179 /* setup resources */
180 pci_init_resource(&hose->mem_resources[0],
181 MPC826x_PCI_LOWER_MEM,
182 MPC826x_PCI_UPPER_MEM,
183 IORESOURCE_MEM|IORESOURCE_PREFETCH, "PCI prefetchable memory");
184
185 pci_init_resource(&hose->mem_resources[1],
186 MPC826x_PCI_LOWER_MMIO,
187 MPC826x_PCI_UPPER_MMIO,
188 IORESOURCE_MEM, "PCI memory");
189
190 pci_init_resource(&hose->io_resource,
191 MPC826x_PCI_LOWER_IO,
192 MPC826x_PCI_UPPER_IO,
193 IORESOURCE_IO, "PCI I/O");
194}
diff --git a/arch/ppc/syslib/m8260_pci.h b/arch/ppc/syslib/m8260_pci.h
new file mode 100644
index 000000000000..d1352120acd7
--- /dev/null
+++ b/arch/ppc/syslib/m8260_pci.h
@@ -0,0 +1,76 @@
1
2#ifndef _PPC_KERNEL_M8260_PCI_H
3#define _PPC_KERNEL_M8260_PCI_H
4
5#include <asm/m8260_pci.h>
6
7/*
8 * Local->PCI map (from CPU) controlled by
9 * MPC826x master window
10 *
11 * 0x80000000 - 0xBFFFFFFF Total CPU2PCI space PCIBR0
12 *
13 * 0x80000000 - 0x9FFFFFFF PCI Mem with prefetch (Outbound ATU #1)
14 * 0xA0000000 - 0xAFFFFFFF PCI Mem w/o prefetch (Outbound ATU #2)
15 * 0xB0000000 - 0xB0FFFFFF 32-bit PCI IO (Outbound ATU #3)
16 *
17 * PCI->Local map (from PCI)
18 * MPC826x slave window controlled by
19 *
20 * 0x00000000 - 0x07FFFFFF MPC826x local memory (Inbound ATU #1)
21 */
22
23/*
24 * Slave window that allows PCI masters to access MPC826x local memory.
25 * This window is set up using the first set of Inbound ATU registers
26 */
27
28#ifndef MPC826x_PCI_SLAVE_MEM_LOCAL
29#define MPC826x_PCI_SLAVE_MEM_LOCAL (((struct bd_info *)__res)->bi_memstart)
30#define MPC826x_PCI_SLAVE_MEM_BUS (((struct bd_info *)__res)->bi_memstart)
31#define MPC826x_PCI_SLAVE_MEM_SIZE (((struct bd_info *)__res)->bi_memsize)
32#endif
33
34/*
35 * This is the window that allows the CPU to access PCI address space.
36 * It will be setup with the SIU PCIBR0 register. All three PCI master
37 * windows, which allow the CPU to access PCI prefetch, non prefetch,
38 * and IO space (see below), must all fit within this window.
39 */
40#ifndef MPC826x_PCI_BASE
41#define MPC826x_PCI_BASE 0x80000000
42#define MPC826x_PCI_MASK 0xc0000000
43#endif
44
45#ifndef MPC826x_PCI_LOWER_MEM
46#define MPC826x_PCI_LOWER_MEM 0x80000000
47#define MPC826x_PCI_UPPER_MEM 0x9fffffff
48#define MPC826x_PCI_MEM_OFFSET 0x00000000
49#endif
50
51#ifndef MPC826x_PCI_LOWER_MMIO
52#define MPC826x_PCI_LOWER_MMIO 0xa0000000
53#define MPC826x_PCI_UPPER_MMIO 0xafffffff
54#define MPC826x_PCI_MMIO_OFFSET 0x00000000
55#endif
56
57#ifndef MPC826x_PCI_LOWER_IO
58#define MPC826x_PCI_LOWER_IO 0x00000000
59#define MPC826x_PCI_UPPER_IO 0x00ffffff
60#define MPC826x_PCI_IO_BASE 0xb0000000
61#define MPC826x_PCI_IO_SIZE 0x01000000
62#endif
63
64#ifndef _IO_BASE
65#define _IO_BASE isa_io_base
66#endif
67
68#ifdef CONFIG_8260_PCI9
69struct pci_controller;
70extern void setup_m8260_indirect_pci(struct pci_controller* hose,
71 u32 cfg_addr, u32 cfg_data);
72#else
73#define setup_m8260_indirect_pci setup_indirect_pci
74#endif
75
76#endif /* _PPC_KERNEL_M8260_PCI_H */
diff --git a/arch/ppc/syslib/m8260_pci_erratum9.c b/arch/ppc/syslib/m8260_pci_erratum9.c
new file mode 100644
index 000000000000..9c0582d639e0
--- /dev/null
+++ b/arch/ppc/syslib/m8260_pci_erratum9.c
@@ -0,0 +1,473 @@
1/*
2 * arch/ppc/platforms/mpc8260_pci9.c
3 *
4 * Workaround for device erratum PCI 9.
5 * See Motorola's "XPC826xA Family Device Errata Reference."
6 * The erratum applies to all 8260 family Hip4 processors. It is scheduled
7 * to be fixed in HiP4 Rev C. Erratum PCI 9 states that a simultaneous PCI
8 * inbound write transaction and PCI outbound read transaction can result in a
9 * bus deadlock. The suggested workaround is to use the IDMA controller to
10 * perform all reads from PCI configuration, memory, and I/O space.
11 *
12 * Author: andy_lowe@mvista.com
13 *
14 * 2003 (c) MontaVista Software, Inc. This file is licensed under
15 * the terms of the GNU General Public License version 2. This program
16 * is licensed "as is" without any warranty of any kind, whether express
17 * or implied.
18 */
19#include <linux/kernel.h>
20#include <linux/config.h>
21#include <linux/module.h>
22#include <linux/pci.h>
23#include <linux/types.h>
24#include <linux/string.h>
25
26#include <asm/io.h>
27#include <asm/pci-bridge.h>
28#include <asm/machdep.h>
29#include <asm/byteorder.h>
30#include <asm/mpc8260.h>
31#include <asm/immap_cpm2.h>
32#include <asm/cpm2.h>
33
34#include "m8260_pci.h"
35
36#ifdef CONFIG_8260_PCI9
37/*#include <asm/mpc8260_pci9.h>*/ /* included in asm/io.h */
38
39#define IDMA_XFER_BUF_SIZE 64 /* size of the IDMA transfer buffer */
40
41/* define a structure for the IDMA dpram usage */
42typedef struct idma_dpram_s {
43 idma_t pram; /* IDMA parameter RAM */
44 u_char xfer_buf[IDMA_XFER_BUF_SIZE]; /* IDMA transfer buffer */
45 idma_bd_t bd; /* buffer descriptor */
46} idma_dpram_t;
47
48/* define offsets relative to start of IDMA dpram */
49#define IDMA_XFER_BUF_OFFSET (sizeof(idma_t))
50#define IDMA_BD_OFFSET (sizeof(idma_t) + IDMA_XFER_BUF_SIZE)
51
52/* define globals */
53static volatile idma_dpram_t *idma_dpram;
54
55/* Exactly one of CONFIG_8260_PCI9_IDMAn must be defined,
56 * where n is 1, 2, 3, or 4. This selects the IDMA channel used for
57 * the PCI9 workaround.
58 */
59#ifdef CONFIG_8260_PCI9_IDMA1
60#define IDMA_CHAN 0
61#define PROFF_IDMA PROFF_IDMA1_BASE
62#define IDMA_PAGE CPM_CR_IDMA1_PAGE
63#define IDMA_SBLOCK CPM_CR_IDMA1_SBLOCK
64#endif
65#ifdef CONFIG_8260_PCI9_IDMA2
66#define IDMA_CHAN 1
67#define PROFF_IDMA PROFF_IDMA2_BASE
68#define IDMA_PAGE CPM_CR_IDMA2_PAGE
69#define IDMA_SBLOCK CPM_CR_IDMA2_SBLOCK
70#endif
71#ifdef CONFIG_8260_PCI9_IDMA3
72#define IDMA_CHAN 2
73#define PROFF_IDMA PROFF_IDMA3_BASE
74#define IDMA_PAGE CPM_CR_IDMA3_PAGE
75#define IDMA_SBLOCK CPM_CR_IDMA3_SBLOCK
76#endif
77#ifdef CONFIG_8260_PCI9_IDMA4
78#define IDMA_CHAN 3
79#define PROFF_IDMA PROFF_IDMA4_BASE
80#define IDMA_PAGE CPM_CR_IDMA4_PAGE
81#define IDMA_SBLOCK CPM_CR_IDMA4_SBLOCK
82#endif
83
84void idma_pci9_init(void)
85{
86 uint dpram_offset;
87 volatile idma_t *pram;
88 volatile im_idma_t *idma_reg;
89 volatile cpm2_map_t *immap = cpm2_immr;
90
91 /* allocate IDMA dpram */
92 dpram_offset = cpm_dpalloc(sizeof(idma_dpram_t), 64);
93 idma_dpram = cpm_dpram_addr(dpram_offset);
94
95 /* initialize the IDMA parameter RAM */
96 memset((void *)idma_dpram, 0, sizeof(idma_dpram_t));
97 pram = &idma_dpram->pram;
98 pram->ibase = dpram_offset + IDMA_BD_OFFSET;
99 pram->dpr_buf = dpram_offset + IDMA_XFER_BUF_OFFSET;
100 pram->ss_max = 32;
101 pram->dts = 32;
102
103 /* initialize the IDMA_BASE pointer to the IDMA parameter RAM */
104 *((ushort *) &immap->im_dprambase[PROFF_IDMA]) = dpram_offset;
105
106 /* initialize the IDMA registers */
107 idma_reg = (volatile im_idma_t *) &immap->im_sdma.sdma_idsr1;
108 idma_reg[IDMA_CHAN].idmr = 0; /* mask all IDMA interrupts */
109 idma_reg[IDMA_CHAN].idsr = 0xff; /* clear all event flags */
110
111 printk("<4>Using IDMA%d for MPC8260 device erratum PCI 9 workaround\n",
112 IDMA_CHAN + 1);
113
114 return;
115}
116
117/* Use the IDMA controller to transfer data from I/O memory to local RAM.
118 * The src address must be a physical address suitable for use by the DMA
119 * controller with no translation. The dst address must be a kernel virtual
120 * address. The dst address is translated to a physical address via
121 * virt_to_phys().
122 * The sinc argument specifies whether or not the source address is incremented
123 * by the DMA controller. The source address is incremented if and only if sinc
124 * is non-zero. The destination address is always incremented since the
125 * destination is always host RAM.
126 */
127static void
128idma_pci9_read(u8 *dst, u8 *src, int bytes, int unit_size, int sinc)
129{
130 unsigned long flags;
131 volatile idma_t *pram = &idma_dpram->pram;
132 volatile idma_bd_t *bd = &idma_dpram->bd;
133 volatile cpm2_map_t *immap = cpm2_immr;
134
135 local_irq_save(flags);
136
137 /* initialize IDMA parameter RAM for this transfer */
138 if (sinc)
139 pram->dcm = IDMA_DCM_DMA_WRAP_64 | IDMA_DCM_SINC
140 | IDMA_DCM_DINC | IDMA_DCM_SD_MEM2MEM;
141 else
142 pram->dcm = IDMA_DCM_DMA_WRAP_64 | IDMA_DCM_DINC
143 | IDMA_DCM_SD_MEM2MEM;
144 pram->ibdptr = pram->ibase;
145 pram->sts = unit_size;
146 pram->istate = 0;
147
148 /* initialize the buffer descriptor */
149 bd->dst = virt_to_phys(dst);
150 bd->src = (uint) src;
151 bd->len = bytes;
152 bd->flags = IDMA_BD_V | IDMA_BD_W | IDMA_BD_I | IDMA_BD_L | IDMA_BD_DGBL
153 | IDMA_BD_DBO_BE | IDMA_BD_SBO_BE | IDMA_BD_SDTB;
154
155 /* issue the START_IDMA command to the CP */
156 while (immap->im_cpm.cp_cpcr & CPM_CR_FLG);
157 immap->im_cpm.cp_cpcr = mk_cr_cmd(IDMA_PAGE, IDMA_SBLOCK, 0,
158 CPM_CR_START_IDMA) | CPM_CR_FLG;
159 while (immap->im_cpm.cp_cpcr & CPM_CR_FLG);
160
161 /* wait for transfer to complete */
162 while(bd->flags & IDMA_BD_V);
163
164 local_irq_restore(flags);
165
166 return;
167}
168
169/* Use the IDMA controller to transfer data from I/O memory to local RAM.
170 * The dst address must be a physical address suitable for use by the DMA
171 * controller with no translation. The src address must be a kernel virtual
172 * address. The src address is translated to a physical address via
173 * virt_to_phys().
174 * The dinc argument specifies whether or not the dest address is incremented
175 * by the DMA controller. The source address is incremented if and only if sinc
176 * is non-zero. The source address is always incremented since the
177 * source is always host RAM.
178 */
179static void
180idma_pci9_write(u8 *dst, u8 *src, int bytes, int unit_size, int dinc)
181{
182 unsigned long flags;
183 volatile idma_t *pram = &idma_dpram->pram;
184 volatile idma_bd_t *bd = &idma_dpram->bd;
185 volatile cpm2_map_t *immap = cpm2_immr;
186
187 local_irq_save(flags);
188
189 /* initialize IDMA parameter RAM for this transfer */
190 if (dinc)
191 pram->dcm = IDMA_DCM_DMA_WRAP_64 | IDMA_DCM_SINC
192 | IDMA_DCM_DINC | IDMA_DCM_SD_MEM2MEM;
193 else
194 pram->dcm = IDMA_DCM_DMA_WRAP_64 | IDMA_DCM_SINC
195 | IDMA_DCM_SD_MEM2MEM;
196 pram->ibdptr = pram->ibase;
197 pram->sts = unit_size;
198 pram->istate = 0;
199
200 /* initialize the buffer descriptor */
201 bd->dst = (uint) dst;
202 bd->src = virt_to_phys(src);
203 bd->len = bytes;
204 bd->flags = IDMA_BD_V | IDMA_BD_W | IDMA_BD_I | IDMA_BD_L | IDMA_BD_DGBL
205 | IDMA_BD_DBO_BE | IDMA_BD_SBO_BE | IDMA_BD_SDTB;
206
207 /* issue the START_IDMA command to the CP */
208 while (immap->im_cpm.cp_cpcr & CPM_CR_FLG);
209 immap->im_cpm.cp_cpcr = mk_cr_cmd(IDMA_PAGE, IDMA_SBLOCK, 0,
210 CPM_CR_START_IDMA) | CPM_CR_FLG;
211 while (immap->im_cpm.cp_cpcr & CPM_CR_FLG);
212
213 /* wait for transfer to complete */
214 while(bd->flags & IDMA_BD_V);
215
216 local_irq_restore(flags);
217
218 return;
219}
220
221/* Same as idma_pci9_read, but 16-bit little-endian byte swapping is performed
222 * if the unit_size is 2, and 32-bit little-endian byte swapping is performed if
223 * the unit_size is 4.
224 */
225static void
226idma_pci9_read_le(u8 *dst, u8 *src, int bytes, int unit_size, int sinc)
227{
228 int i;
229 u8 *p;
230
231 idma_pci9_read(dst, src, bytes, unit_size, sinc);
232 switch(unit_size) {
233 case 2:
234 for (i = 0, p = dst; i < bytes; i += 2, p += 2)
235 swab16s((u16 *) p);
236 break;
237 case 4:
238 for (i = 0, p = dst; i < bytes; i += 4, p += 4)
239 swab32s((u32 *) p);
240 break;
241 default:
242 break;
243 }
244}
245EXPORT_SYMBOL(idma_pci9_init);
246EXPORT_SYMBOL(idma_pci9_read);
247EXPORT_SYMBOL(idma_pci9_read_le);
248
249static inline int is_pci_mem(unsigned long addr)
250{
251 if (addr >= MPC826x_PCI_LOWER_MMIO &&
252 addr <= MPC826x_PCI_UPPER_MMIO)
253 return 1;
254 if (addr >= MPC826x_PCI_LOWER_MEM &&
255 addr <= MPC826x_PCI_UPPER_MEM)
256 return 1;
257 return 0;
258}
259
260#define is_pci_mem(pa) ( (pa > 0x80000000) && (pa < 0xc0000000))
261int readb(volatile unsigned char *addr)
262{
263 u8 val;
264 unsigned long pa = iopa((unsigned long) addr);
265
266 if (!is_pci_mem(pa))
267 return in_8(addr);
268
269 idma_pci9_read((u8 *)&val, (u8 *)pa, sizeof(val), sizeof(val), 0);
270 return val;
271}
272
273int readw(volatile unsigned short *addr)
274{
275 u16 val;
276 unsigned long pa = iopa((unsigned long) addr);
277
278 if (!is_pci_mem(pa))
279 return in_le16(addr);
280
281 idma_pci9_read((u8 *)&val, (u8 *)pa, sizeof(val), sizeof(val), 0);
282 return swab16(val);
283}
284
285unsigned readl(volatile unsigned *addr)
286{
287 u32 val;
288 unsigned long pa = iopa((unsigned long) addr);
289
290 if (!is_pci_mem(pa))
291 return in_le32(addr);
292
293 idma_pci9_read((u8 *)&val, (u8 *)pa, sizeof(val), sizeof(val), 0);
294 return swab32(val);
295}
296
297int inb(unsigned port)
298{
299 u8 val;
300 u8 *addr = (u8 *)(port + _IO_BASE);
301
302 idma_pci9_read((u8 *)&val, (u8 *)addr, sizeof(val), sizeof(val), 0);
303 return val;
304}
305
306int inw(unsigned port)
307{
308 u16 val;
309 u8 *addr = (u8 *)(port + _IO_BASE);
310
311 idma_pci9_read((u8 *)&val, (u8 *)addr, sizeof(val), sizeof(val), 0);
312 return swab16(val);
313}
314
315unsigned inl(unsigned port)
316{
317 u32 val;
318 u8 *addr = (u8 *)(port + _IO_BASE);
319
320 idma_pci9_read((u8 *)&val, (u8 *)addr, sizeof(val), sizeof(val), 0);
321 return swab32(val);
322}
323
324void insb(unsigned port, void *buf, int ns)
325{
326 u8 *addr = (u8 *)(port + _IO_BASE);
327
328 idma_pci9_read((u8 *)buf, (u8 *)addr, ns*sizeof(u8), sizeof(u8), 0);
329}
330
331void insw(unsigned port, void *buf, int ns)
332{
333 u8 *addr = (u8 *)(port + _IO_BASE);
334
335 idma_pci9_read((u8 *)buf, (u8 *)addr, ns*sizeof(u16), sizeof(u16), 0);
336}
337
338void insl(unsigned port, void *buf, int nl)
339{
340 u8 *addr = (u8 *)(port + _IO_BASE);
341
342 idma_pci9_read((u8 *)buf, (u8 *)addr, nl*sizeof(u32), sizeof(u32), 0);
343}
344
345void insw_ns(unsigned port, void *buf, int ns)
346{
347 u8 *addr = (u8 *)(port + _IO_BASE);
348
349 idma_pci9_read((u8 *)buf, (u8 *)addr, ns*sizeof(u16), sizeof(u16), 0);
350}
351
352void insl_ns(unsigned port, void *buf, int nl)
353{
354 u8 *addr = (u8 *)(port + _IO_BASE);
355
356 idma_pci9_read((u8 *)buf, (u8 *)addr, nl*sizeof(u32), sizeof(u32), 0);
357}
358
359void *memcpy_fromio(void *dest, unsigned long src, size_t count)
360{
361 unsigned long pa = iopa((unsigned long) src);
362
363 if (is_pci_mem(pa))
364 idma_pci9_read((u8 *)dest, (u8 *)pa, count, 32, 1);
365 else
366 memcpy(dest, (void *)src, count);
367 return dest;
368}
369
370EXPORT_SYMBOL(readb);
371EXPORT_SYMBOL(readw);
372EXPORT_SYMBOL(readl);
373EXPORT_SYMBOL(inb);
374EXPORT_SYMBOL(inw);
375EXPORT_SYMBOL(inl);
376EXPORT_SYMBOL(insb);
377EXPORT_SYMBOL(insw);
378EXPORT_SYMBOL(insl);
379EXPORT_SYMBOL(insw_ns);
380EXPORT_SYMBOL(insl_ns);
381EXPORT_SYMBOL(memcpy_fromio);
382
383#endif /* ifdef CONFIG_8260_PCI9 */
384
385/* Indirect PCI routines adapted from arch/ppc/kernel/indirect_pci.c.
386 * Copyright (C) 1998 Gabriel Paubert.
387 */
388#ifndef CONFIG_8260_PCI9
389#define cfg_read(val, addr, type, op) *val = op((type)(addr))
390#else
391#define cfg_read(val, addr, type, op) \
392 idma_pci9_read_le((u8*)(val),(u8*)(addr),sizeof(*(val)),sizeof(*(val)),0)
393#endif
394
395#define cfg_write(val, addr, type, op) op((type *)(addr), (val))
396
397static int indirect_write_config(struct pci_bus *pbus, unsigned int devfn, int where,
398 int size, u32 value)
399{
400 struct pci_controller *hose = pbus->sysdata;
401 u8 cfg_type = 0;
402 if (ppc_md.pci_exclude_device)
403 if (ppc_md.pci_exclude_device(pbus->number, devfn))
404 return PCIBIOS_DEVICE_NOT_FOUND;
405
406 if (hose->set_cfg_type)
407 if (pbus->number != hose->first_busno)
408 cfg_type = 1;
409
410 out_be32(hose->cfg_addr,
411 (((where & 0xfc) | cfg_type) << 24) | (devfn << 16)
412 | ((pbus->number - hose->bus_offset) << 8) | 0x80);
413
414 switch (size)
415 {
416 case 1:
417 cfg_write(value, hose->cfg_data + (where & 3), u8, out_8);
418 break;
419 case 2:
420 cfg_write(value, hose->cfg_data + (where & 2), u16, out_le16);
421 break;
422 case 4:
423 cfg_write(value, hose->cfg_data + (where & 0), u32, out_le32);
424 break;
425 }
426 return PCIBIOS_SUCCESSFUL;
427}
428
429static int indirect_read_config(struct pci_bus *pbus, unsigned int devfn, int where,
430 int size, u32 *value)
431{
432 struct pci_controller *hose = pbus->sysdata;
433 u8 cfg_type = 0;
434 if (ppc_md.pci_exclude_device)
435 if (ppc_md.pci_exclude_device(pbus->number, devfn))
436 return PCIBIOS_DEVICE_NOT_FOUND;
437
438 if (hose->set_cfg_type)
439 if (pbus->number != hose->first_busno)
440 cfg_type = 1;
441
442 out_be32(hose->cfg_addr,
443 (((where & 0xfc) | cfg_type) << 24) | (devfn << 16)
444 | ((pbus->number - hose->bus_offset) << 8) | 0x80);
445
446 switch (size)
447 {
448 case 1:
449 cfg_read(value, hose->cfg_data + (where & 3), u8 *, in_8);
450 break;
451 case 2:
452 cfg_read(value, hose->cfg_data + (where & 2), u16 *, in_le16);
453 break;
454 case 4:
455 cfg_read(value, hose->cfg_data + (where & 0), u32 *, in_le32);
456 break;
457 }
458 return PCIBIOS_SUCCESSFUL;
459}
460
461static struct pci_ops indirect_pci_ops =
462{
463 .read = indirect_read_config,
464 .write = indirect_write_config,
465};
466
467void
468setup_m8260_indirect_pci(struct pci_controller* hose, u32 cfg_addr, u32 cfg_data)
469{
470 hose->ops = &indirect_pci_ops;
471 hose->cfg_addr = (unsigned int *) ioremap(cfg_addr, 4);
472 hose->cfg_data = (unsigned char *) ioremap(cfg_data, 4);
473}
diff --git a/arch/ppc/syslib/m8260_setup.c b/arch/ppc/syslib/m8260_setup.c
new file mode 100644
index 000000000000..23ea3f694de2
--- /dev/null
+++ b/arch/ppc/syslib/m8260_setup.c
@@ -0,0 +1,264 @@
1/*
2 * arch/ppc/syslib/m8260_setup.c
3 *
4 * Copyright (C) 1995 Linus Torvalds
5 * Adapted from 'alpha' version by Gary Thomas
6 * Modified by Cort Dougan (cort@cs.nmt.edu)
7 * Modified for MBX using prep/chrp/pmac functions by Dan (dmalek@jlc.net)
8 * Further modified for generic 8xx and 8260 by Dan.
9 */
10
11#include <linux/config.h>
12#include <linux/sched.h>
13#include <linux/kernel.h>
14#include <linux/mm.h>
15#include <linux/stddef.h>
16#include <linux/slab.h>
17#include <linux/init.h>
18#include <linux/initrd.h>
19#include <linux/root_dev.h>
20#include <linux/seq_file.h>
21#include <linux/irq.h>
22
23#include <asm/mmu.h>
24#include <asm/io.h>
25#include <asm/pgtable.h>
26#include <asm/mpc8260.h>
27#include <asm/immap_cpm2.h>
28#include <asm/machdep.h>
29#include <asm/bootinfo.h>
30#include <asm/time.h>
31
32#include "cpm2_pic.h"
33
34unsigned char __res[sizeof(bd_t)];
35
36extern void cpm2_reset(void);
37extern void m8260_find_bridges(void);
38extern void idma_pci9_init(void);
39
40/* Place-holder for board-specific init */
41void __attribute__ ((weak)) __init
42m82xx_board_setup(void)
43{
44}
45
46static void __init
47m8260_setup_arch(void)
48{
49 /* Print out Vendor and Machine info. */
50 printk(KERN_INFO "%s %s port\n", CPUINFO_VENDOR, CPUINFO_MACHINE);
51
52 /* Reset the Communication Processor Module. */
53 cpm2_reset();
54#ifdef CONFIG_8260_PCI9
55 /* Initialise IDMA for PCI erratum workaround */
56 idma_pci9_init();
57#endif
58#ifdef CONFIG_PCI_8260
59 m8260_find_bridges();
60#endif
61#ifdef CONFIG_BLK_DEV_INITRD
62 if (initrd_start)
63 ROOT_DEV = Root_RAM0;
64#endif
65 m82xx_board_setup();
66}
67
68/* The decrementer counts at the system (internal) clock frequency
69 * divided by four.
70 */
71static void __init
72m8260_calibrate_decr(void)
73{
74 bd_t *binfo = (bd_t *)__res;
75 int freq, divisor;
76
77 freq = binfo->bi_busfreq;
78 divisor = 4;
79 tb_ticks_per_jiffy = freq / HZ / divisor;
80 tb_to_us = mulhwu_scale_factor(freq / divisor, 1000000);
81}
82
83/* The 8260 has an internal 1-second timer update register that
84 * we should use for this purpose.
85 */
86static uint rtc_time;
87
88static int
89m8260_set_rtc_time(unsigned long time)
90{
91 rtc_time = time;
92
93 return(0);
94}
95
96static unsigned long
97m8260_get_rtc_time(void)
98{
99 /* Get time from the RTC.
100 */
101 return((unsigned long)rtc_time);
102}
103
104#ifndef BOOTROM_RESTART_ADDR
105#warning "Using default BOOTROM_RESTART_ADDR!"
106#define BOOTROM_RESTART_ADDR 0xff000104
107#endif
108
109static void
110m8260_restart(char *cmd)
111{
112 extern void m8260_gorom(bd_t *bi, uint addr);
113 uint startaddr;
114
115 /* Most boot roms have a warmstart as the second instruction
116 * of the reset vector. If that doesn't work for you, change this
117 * or the reboot program to send a proper address.
118 */
119 startaddr = BOOTROM_RESTART_ADDR;
120 if (cmd != NULL) {
121 if (!strncmp(cmd, "startaddr=", 10))
122 startaddr = simple_strtoul(&cmd[10], NULL, 0);
123 }
124
125 m8260_gorom((void*)__pa(__res), startaddr);
126}
127
128static void
129m8260_halt(void)
130{
131 local_irq_disable();
132 while (1);
133}
134
135static void
136m8260_power_off(void)
137{
138 m8260_halt();
139}
140
141static int
142m8260_show_cpuinfo(struct seq_file *m)
143{
144 bd_t *bp = (bd_t *)__res;
145
146 seq_printf(m, "vendor\t\t: %s\n"
147 "machine\t\t: %s\n"
148 "\n"
149 "mem size\t\t: 0x%08x\n"
150 "console baud\t\t: %d\n"
151 "\n"
152 "core clock\t: %u MHz\n"
153 "CPM clock\t: %u MHz\n"
154 "bus clock\t: %u MHz\n",
155 CPUINFO_VENDOR, CPUINFO_MACHINE, bp->bi_memsize,
156 bp->bi_baudrate, bp->bi_intfreq / 1000000,
157 bp->bi_cpmfreq / 1000000, bp->bi_busfreq / 1000000);
158 return 0;
159}
160
161/* Initialize the internal interrupt controller. The number of
162 * interrupts supported can vary with the processor type, and the
163 * 8260 family can have up to 64.
164 * External interrupts can be either edge or level triggered, and
165 * need to be initialized by the appropriate driver.
166 */
167static void __init
168m8260_init_IRQ(void)
169{
170 cpm2_init_IRQ();
171
172 /* Initialize the default interrupt mapping priorities,
173 * in case the boot rom changed something on us.
174 */
175 cpm2_immr->im_intctl.ic_siprr = 0x05309770;
176}
177
178/*
179 * Same hack as 8xx
180 */
181static unsigned long __init
182m8260_find_end_of_memory(void)
183{
184 bd_t *binfo = (bd_t *)__res;
185
186 return binfo->bi_memsize;
187}
188
189/* Map the IMMR, plus anything else we can cover
190 * in that upper space according to the memory controller
191 * chip select mapping. Grab another bunch of space
192 * below that for stuff we can't cover in the upper.
193 */
194static void __init
195m8260_map_io(void)
196{
197 uint addr;
198
199 /* Map IMMR region to a 256MB BAT */
200 addr = (cpm2_immr != NULL) ? (uint)cpm2_immr : CPM_MAP_ADDR;
201 io_block_mapping(addr, addr, 0x10000000, _PAGE_IO);
202
203 /* Map I/O region to a 256MB BAT */
204 io_block_mapping(IO_VIRT_ADDR, IO_PHYS_ADDR, 0x10000000, _PAGE_IO);
205}
206
207/* Place-holder for board-specific ppc_md hooking */
208void __attribute__ ((weak)) __init
209m82xx_board_init(void)
210{
211}
212
213/* Inputs:
214 * r3 - Optional pointer to a board information structure.
215 * r4 - Optional pointer to the physical starting address of the init RAM
216 * disk.
217 * r5 - Optional pointer to the physical ending address of the init RAM
218 * disk.
219 * r6 - Optional pointer to the physical starting address of any kernel
220 * command-line parameters.
221 * r7 - Optional pointer to the physical ending address of any kernel
222 * command-line parameters.
223 */
224void __init
225platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
226 unsigned long r6, unsigned long r7)
227{
228 parse_bootinfo(find_bootinfo());
229
230 if ( r3 )
231 memcpy( (void *)__res,(void *)(r3+KERNELBASE), sizeof(bd_t) );
232
233#ifdef CONFIG_BLK_DEV_INITRD
234 /* take care of initrd if we have one */
235 if ( r4 ) {
236 initrd_start = r4 + KERNELBASE;
237 initrd_end = r5 + KERNELBASE;
238 }
239#endif /* CONFIG_BLK_DEV_INITRD */
240 /* take care of cmd line */
241 if ( r6 ) {
242 *(char *)(r7+KERNELBASE) = 0;
243 strcpy(cmd_line, (char *)(r6+KERNELBASE));
244 }
245
246 ppc_md.setup_arch = m8260_setup_arch;
247 ppc_md.show_cpuinfo = m8260_show_cpuinfo;
248 ppc_md.init_IRQ = m8260_init_IRQ;
249 ppc_md.get_irq = cpm2_get_irq;
250
251 ppc_md.restart = m8260_restart;
252 ppc_md.power_off = m8260_power_off;
253 ppc_md.halt = m8260_halt;
254
255 ppc_md.set_rtc_time = m8260_set_rtc_time;
256 ppc_md.get_rtc_time = m8260_get_rtc_time;
257 ppc_md.calibrate_decr = m8260_calibrate_decr;
258
259 ppc_md.find_end_of_memory = m8260_find_end_of_memory;
260 ppc_md.setup_io_mappings = m8260_map_io;
261
262 /* Call back for board-specific settings and overrides. */
263 m82xx_board_init();
264}
diff --git a/arch/ppc/syslib/m8xx_setup.c b/arch/ppc/syslib/m8xx_setup.c
new file mode 100644
index 000000000000..c1db2ab1d154
--- /dev/null
+++ b/arch/ppc/syslib/m8xx_setup.c
@@ -0,0 +1,433 @@
1/*
2 * arch/ppc/kernel/setup.c
3 *
4 * Copyright (C) 1995 Linus Torvalds
5 * Adapted from 'alpha' version by Gary Thomas
6 * Modified by Cort Dougan (cort@cs.nmt.edu)
7 * Modified for MBX using prep/chrp/pmac functions by Dan (dmalek@jlc.net)
8 * Further modified for generic 8xx by Dan.
9 */
10
11/*
12 * bootup setup stuff..
13 */
14
15#include <linux/config.h>
16#include <linux/errno.h>
17#include <linux/sched.h>
18#include <linux/kernel.h>
19#include <linux/mm.h>
20#include <linux/stddef.h>
21#include <linux/unistd.h>
22#include <linux/ptrace.h>
23#include <linux/slab.h>
24#include <linux/user.h>
25#include <linux/a.out.h>
26#include <linux/tty.h>
27#include <linux/major.h>
28#include <linux/interrupt.h>
29#include <linux/reboot.h>
30#include <linux/init.h>
31#include <linux/initrd.h>
32#include <linux/ioport.h>
33#include <linux/bootmem.h>
34#include <linux/seq_file.h>
35#include <linux/root_dev.h>
36
37#include <asm/mmu.h>
38#include <asm/reg.h>
39#include <asm/residual.h>
40#include <asm/io.h>
41#include <asm/pgtable.h>
42#include <asm/mpc8xx.h>
43#include <asm/8xx_immap.h>
44#include <asm/machdep.h>
45#include <asm/bootinfo.h>
46#include <asm/time.h>
47#include <asm/xmon.h>
48
49#include "ppc8xx_pic.h"
50
51static int m8xx_set_rtc_time(unsigned long time);
52static unsigned long m8xx_get_rtc_time(void);
53void m8xx_calibrate_decr(void);
54
55unsigned char __res[sizeof(bd_t)];
56
57extern void m8xx_ide_init(void);
58
59extern unsigned long find_available_memory(void);
60extern void m8xx_cpm_reset(uint cpm_page);
61extern void m8xx_wdt_handler_install(bd_t *bp);
62extern void rpxfb_alloc_pages(void);
63extern void cpm_interrupt_init(void);
64
65void __attribute__ ((weak))
66board_init(void)
67{
68}
69
70void __init
71m8xx_setup_arch(void)
72{
73 int cpm_page;
74
75 cpm_page = (int) alloc_bootmem_pages(PAGE_SIZE);
76
77 /* Reset the Communication Processor Module.
78 */
79 m8xx_cpm_reset(cpm_page);
80
81#ifdef CONFIG_FB_RPX
82 rpxfb_alloc_pages();
83#endif
84
85#ifdef notdef
86 ROOT_DEV = Root_HDA1; /* hda1 */
87#endif
88
89#ifdef CONFIG_BLK_DEV_INITRD
90#if 0
91 ROOT_DEV = Root_FD0; /* floppy */
92 rd_prompt = 1;
93 rd_doload = 1;
94 rd_image_start = 0;
95#endif
96#if 0 /* XXX this may need to be updated for the new bootmem stuff,
97 or possibly just deleted (see set_phys_avail() in init.c).
98 - paulus. */
99 /* initrd_start and size are setup by boot/head.S and kernel/head.S */
100 if ( initrd_start )
101 {
102 if (initrd_end > *memory_end_p)
103 {
104 printk("initrd extends beyond end of memory "
105 "(0x%08lx > 0x%08lx)\ndisabling initrd\n",
106 initrd_end,*memory_end_p);
107 initrd_start = 0;
108 }
109 }
110#endif
111#endif
112 board_init();
113}
114
115void
116abort(void)
117{
118#ifdef CONFIG_XMON
119 xmon(0);
120#endif
121 machine_restart(NULL);
122
123 /* not reached */
124 for (;;);
125}
126
127/* A place holder for time base interrupts, if they are ever enabled. */
128irqreturn_t timebase_interrupt(int irq, void * dev, struct pt_regs * regs)
129{
130 printk ("timebase_interrupt()\n");
131
132 return IRQ_HANDLED;
133}
134
135static struct irqaction tbint_irqaction = {
136 .handler = timebase_interrupt,
137 .mask = CPU_MASK_NONE,
138 .name = "tbint",
139};
140
141/* The decrementer counts at the system (internal) clock frequency divided by
142 * sixteen, or external oscillator divided by four. We force the processor
143 * to use system clock divided by sixteen.
144 */
145void __init m8xx_calibrate_decr(void)
146{
147 bd_t *binfo = (bd_t *)__res;
148 int freq, fp, divisor;
149
150 /* Unlock the SCCR. */
151 ((volatile immap_t *)IMAP_ADDR)->im_clkrstk.cark_sccrk = ~KAPWR_KEY;
152 ((volatile immap_t *)IMAP_ADDR)->im_clkrstk.cark_sccrk = KAPWR_KEY;
153
154 /* Force all 8xx processors to use divide by 16 processor clock. */
155 ((volatile immap_t *)IMAP_ADDR)->im_clkrst.car_sccr |= 0x02000000;
156
157 /* Processor frequency is MHz.
158 * The value 'fp' is the number of decrementer ticks per second.
159 */
160 fp = binfo->bi_intfreq / 16;
161 freq = fp*60; /* try to make freq/1e6 an integer */
162 divisor = 60;
163 printk("Decrementer Frequency = %d/%d\n", freq, divisor);
164 tb_ticks_per_jiffy = freq / HZ / divisor;
165 tb_to_us = mulhwu_scale_factor(freq / divisor, 1000000);
166
167 /* Perform some more timer/timebase initialization. This used
168 * to be done elsewhere, but other changes caused it to get
169 * called more than once....that is a bad thing.
170 *
171 * First, unlock all of the registers we are going to modify.
172 * To protect them from corruption during power down, registers
173 * that are maintained by keep alive power are "locked". To
174 * modify these registers we have to write the key value to
175 * the key location associated with the register.
176 * Some boards power up with these unlocked, while others
177 * are locked. Writing anything (including the unlock code?)
178 * to the unlocked registers will lock them again. So, here
179 * we guarantee the registers are locked, then we unlock them
180 * for our use.
181 */
182 ((volatile immap_t *)IMAP_ADDR)->im_sitk.sitk_tbscrk = ~KAPWR_KEY;
183 ((volatile immap_t *)IMAP_ADDR)->im_sitk.sitk_rtcsck = ~KAPWR_KEY;
184 ((volatile immap_t *)IMAP_ADDR)->im_sitk.sitk_tbk = ~KAPWR_KEY;
185 ((volatile immap_t *)IMAP_ADDR)->im_sitk.sitk_tbscrk = KAPWR_KEY;
186 ((volatile immap_t *)IMAP_ADDR)->im_sitk.sitk_rtcsck = KAPWR_KEY;
187 ((volatile immap_t *)IMAP_ADDR)->im_sitk.sitk_tbk = KAPWR_KEY;
188
189 /* Disable the RTC one second and alarm interrupts. */
190 ((volatile immap_t *)IMAP_ADDR)->im_sit.sit_rtcsc &=
191 ~(RTCSC_SIE | RTCSC_ALE);
192 /* Enable the RTC */
193 ((volatile immap_t *)IMAP_ADDR)->im_sit.sit_rtcsc |=
194 (RTCSC_RTF | RTCSC_RTE);
195
196 /* Enabling the decrementer also enables the timebase interrupts
197 * (or from the other point of view, to get decrementer interrupts
198 * we have to enable the timebase). The decrementer interrupt
199 * is wired into the vector table, nothing to do here for that.
200 */
201 ((volatile immap_t *)IMAP_ADDR)->im_sit.sit_tbscr =
202 ((mk_int_int_mask(DEC_INTERRUPT) << 8) |
203 (TBSCR_TBF | TBSCR_TBE));
204
205 if (setup_irq(DEC_INTERRUPT, &tbint_irqaction))
206 panic("Could not allocate timer IRQ!");
207
208#ifdef CONFIG_8xx_WDT
209 /* Install watchdog timer handler early because it might be
210 * already enabled by the bootloader
211 */
212 m8xx_wdt_handler_install(binfo);
213#endif
214}
215
216/* The RTC on the MPC8xx is an internal register.
217 * We want to protect this during power down, so we need to unlock,
218 * modify, and re-lock.
219 */
220static int
221m8xx_set_rtc_time(unsigned long time)
222{
223 ((volatile immap_t *)IMAP_ADDR)->im_sitk.sitk_rtck = KAPWR_KEY;
224 ((volatile immap_t *)IMAP_ADDR)->im_sit.sit_rtc = time;
225 ((volatile immap_t *)IMAP_ADDR)->im_sitk.sitk_rtck = ~KAPWR_KEY;
226 return(0);
227}
228
229static unsigned long
230m8xx_get_rtc_time(void)
231{
232 /* Get time from the RTC. */
233 return((unsigned long)(((immap_t *)IMAP_ADDR)->im_sit.sit_rtc));
234}
235
236static void
237m8xx_restart(char *cmd)
238{
239 __volatile__ unsigned char dummy;
240
241 local_irq_disable();
242 ((immap_t *)IMAP_ADDR)->im_clkrst.car_plprcr |= 0x00000080;
243
244 /* Clear the ME bit in MSR to cause checkstop on machine check
245 */
246 mtmsr(mfmsr() & ~0x1000);
247
248 dummy = ((immap_t *)IMAP_ADDR)->im_clkrst.res[0];
249 printk("Restart failed\n");
250 while(1);
251}
252
253static void
254m8xx_power_off(void)
255{
256 m8xx_restart(NULL);
257}
258
259static void
260m8xx_halt(void)
261{
262 m8xx_restart(NULL);
263}
264
265
266static int
267m8xx_show_percpuinfo(struct seq_file *m, int i)
268{
269 bd_t *bp;
270
271 bp = (bd_t *)__res;
272
273 seq_printf(m, "clock\t\t: %ldMHz\n"
274 "bus clock\t: %ldMHz\n",
275 bp->bi_intfreq / 1000000,
276 bp->bi_busfreq / 1000000);
277
278 return 0;
279}
280
281#ifdef CONFIG_PCI
282static struct irqaction mbx_i8259_irqaction = {
283 .handler = mbx_i8259_action,
284 .mask = CPU_MASK_NONE,
285 .name = "i8259 cascade",
286};
287#endif
288
289/* Initialize the internal interrupt controller. The number of
290 * interrupts supported can vary with the processor type, and the
291 * 82xx family can have up to 64.
292 * External interrupts can be either edge or level triggered, and
293 * need to be initialized by the appropriate driver.
294 */
295static void __init
296m8xx_init_IRQ(void)
297{
298 int i;
299
300 for (i = SIU_IRQ_OFFSET ; i < SIU_IRQ_OFFSET + NR_SIU_INTS ; i++)
301 irq_desc[i].handler = &ppc8xx_pic;
302
303 cpm_interrupt_init();
304
305#if defined(CONFIG_PCI)
306 for (i = I8259_IRQ_OFFSET ; i < I8259_IRQ_OFFSET + NR_8259_INTS ; i++)
307 irq_desc[i].handler = &i8259_pic;
308
309 i8259_pic_irq_offset = I8259_IRQ_OFFSET;
310 i8259_init(0);
311
312 /* The i8259 cascade interrupt must be level sensitive. */
313 ((immap_t *)IMAP_ADDR)->im_siu_conf.sc_siel &=
314 ~(0x80000000 >> ISA_BRIDGE_INT);
315
316 if (setup_irq(ISA_BRIDGE_INT, &mbx_i8259_irqaction))
317 enable_irq(ISA_BRIDGE_INT);
318#endif /* CONFIG_PCI */
319}
320
321/* -------------------------------------------------------------------- */
322
323/*
324 * This is a big hack right now, but it may turn into something real
325 * someday.
326 *
327 * For the 8xx boards (at this time anyway), there is nothing to initialize
328 * associated the PROM. Rather than include all of the prom.c
329 * functions in the image just to get prom_init, all we really need right
330 * now is the initialization of the physical memory region.
331 */
332static unsigned long __init
333m8xx_find_end_of_memory(void)
334{
335 bd_t *binfo;
336 extern unsigned char __res[];
337
338 binfo = (bd_t *)__res;
339
340 return binfo->bi_memsize;
341}
342
343/*
344 * Now map in some of the I/O space that is generically needed
345 * or shared with multiple devices.
346 * All of this fits into the same 4Mbyte region, so it only
347 * requires one page table page. (or at least it used to -- paulus)
348 */
349static void __init
350m8xx_map_io(void)
351{
352 io_block_mapping(IMAP_ADDR, IMAP_ADDR, IMAP_SIZE, _PAGE_IO);
353#ifdef CONFIG_MBX
354 io_block_mapping(NVRAM_ADDR, NVRAM_ADDR, NVRAM_SIZE, _PAGE_IO);
355 io_block_mapping(MBX_CSR_ADDR, MBX_CSR_ADDR, MBX_CSR_SIZE, _PAGE_IO);
356 io_block_mapping(PCI_CSR_ADDR, PCI_CSR_ADDR, PCI_CSR_SIZE, _PAGE_IO);
357
358 /* Map some of the PCI/ISA I/O space to get the IDE interface.
359 */
360 io_block_mapping(PCI_ISA_IO_ADDR, PCI_ISA_IO_ADDR, 0x4000, _PAGE_IO);
361 io_block_mapping(PCI_IDE_ADDR, PCI_IDE_ADDR, 0x4000, _PAGE_IO);
362#endif
363#if defined(CONFIG_RPXLITE) || defined(CONFIG_RPXCLASSIC)
364 io_block_mapping(RPX_CSR_ADDR, RPX_CSR_ADDR, RPX_CSR_SIZE, _PAGE_IO);
365#if !defined(CONFIG_PCI)
366 io_block_mapping(_IO_BASE,_IO_BASE,_IO_BASE_SIZE, _PAGE_IO);
367#endif
368#endif
369#if defined(CONFIG_HTDMSOUND) || defined(CONFIG_RPXTOUCH) || defined(CONFIG_FB_RPX)
370 io_block_mapping(HIOX_CSR_ADDR, HIOX_CSR_ADDR, HIOX_CSR_SIZE, _PAGE_IO);
371#endif
372#ifdef CONFIG_FADS
373 io_block_mapping(BCSR_ADDR, BCSR_ADDR, BCSR_SIZE, _PAGE_IO);
374#endif
375#ifdef CONFIG_PCI
376 io_block_mapping(PCI_CSR_ADDR, PCI_CSR_ADDR, PCI_CSR_SIZE, _PAGE_IO);
377#endif
378#if defined(CONFIG_NETTA)
379 io_block_mapping(_IO_BASE,_IO_BASE,_IO_BASE_SIZE, _PAGE_IO);
380#endif
381}
382
383void __init
384platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
385 unsigned long r6, unsigned long r7)
386{
387 parse_bootinfo(find_bootinfo());
388
389 if ( r3 )
390 memcpy( (void *)__res,(void *)(r3+KERNELBASE), sizeof(bd_t) );
391
392#ifdef CONFIG_PCI
393 m8xx_setup_pci_ptrs();
394#endif
395
396#ifdef CONFIG_BLK_DEV_INITRD
397 /* take care of initrd if we have one */
398 if ( r4 )
399 {
400 initrd_start = r4 + KERNELBASE;
401 initrd_end = r5 + KERNELBASE;
402 }
403#endif /* CONFIG_BLK_DEV_INITRD */
404 /* take care of cmd line */
405 if ( r6 )
406 {
407 *(char *)(r7+KERNELBASE) = 0;
408 strcpy(cmd_line, (char *)(r6+KERNELBASE));
409 }
410
411 ppc_md.setup_arch = m8xx_setup_arch;
412 ppc_md.show_percpuinfo = m8xx_show_percpuinfo;
413 ppc_md.irq_canonicalize = NULL;
414 ppc_md.init_IRQ = m8xx_init_IRQ;
415 ppc_md.get_irq = m8xx_get_irq;
416 ppc_md.init = NULL;
417
418 ppc_md.restart = m8xx_restart;
419 ppc_md.power_off = m8xx_power_off;
420 ppc_md.halt = m8xx_halt;
421
422 ppc_md.time_init = NULL;
423 ppc_md.set_rtc_time = m8xx_set_rtc_time;
424 ppc_md.get_rtc_time = m8xx_get_rtc_time;
425 ppc_md.calibrate_decr = m8xx_calibrate_decr;
426
427 ppc_md.find_end_of_memory = m8xx_find_end_of_memory;
428 ppc_md.setup_io_mappings = m8xx_map_io;
429
430#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
431 m8xx_ide_init();
432#endif
433}
diff --git a/arch/ppc/syslib/m8xx_wdt.c b/arch/ppc/syslib/m8xx_wdt.c
new file mode 100644
index 000000000000..7838a44bfd1d
--- /dev/null
+++ b/arch/ppc/syslib/m8xx_wdt.c
@@ -0,0 +1,99 @@
1/*
2 * m8xx_wdt.c - MPC8xx watchdog driver
3 *
4 * Author: Florian Schirmer <jolt@tuxbox.org>
5 *
6 * 2002 (c) Florian Schirmer <jolt@tuxbox.org> This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10 */
11
12#include <linux/init.h>
13#include <linux/interrupt.h>
14#include <linux/kernel.h>
15#include <linux/sched.h>
16#include <asm/8xx_immap.h>
17#include <syslib/m8xx_wdt.h>
18
19static int wdt_timeout;
20
21void m8xx_wdt_reset(void)
22{
23 volatile immap_t *imap = (volatile immap_t *)IMAP_ADDR;
24
25 imap->im_siu_conf.sc_swsr = 0x556c; /* write magic1 */
26 imap->im_siu_conf.sc_swsr = 0xaa39; /* write magic2 */
27}
28
29static irqreturn_t m8xx_wdt_interrupt(int irq, void *dev, struct pt_regs *regs)
30{
31 volatile immap_t *imap = (volatile immap_t *)IMAP_ADDR;
32
33 m8xx_wdt_reset();
34
35 imap->im_sit.sit_piscr |= PISCR_PS; /* clear irq */
36
37 return IRQ_HANDLED;
38}
39
40void __init m8xx_wdt_handler_install(bd_t * binfo)
41{
42 volatile immap_t *imap = (volatile immap_t *)IMAP_ADDR;
43 u32 pitc;
44 u32 sypcr;
45 u32 pitrtclk;
46
47 sypcr = imap->im_siu_conf.sc_sypcr;
48
49 if (!(sypcr & 0x04)) {
50 printk(KERN_NOTICE "m8xx_wdt: wdt disabled (SYPCR: 0x%08X)\n",
51 sypcr);
52 return;
53 }
54
55 m8xx_wdt_reset();
56
57 printk(KERN_NOTICE
58 "m8xx_wdt: active wdt found (SWTC: 0x%04X, SWP: 0x%01X)\n",
59 (sypcr >> 16), sypcr & 0x01);
60
61 wdt_timeout = (sypcr >> 16) & 0xFFFF;
62
63 if (!wdt_timeout)
64 wdt_timeout = 0xFFFF;
65
66 if (sypcr & 0x01)
67 wdt_timeout *= 2048;
68
69 /*
70 * Fire trigger if half of the wdt ticked down
71 */
72
73 if (imap->im_sit.sit_rtcsc & RTCSC_38K)
74 pitrtclk = 9600;
75 else
76 pitrtclk = 8192;
77
78 if ((wdt_timeout) > (UINT_MAX / pitrtclk))
79 pitc = wdt_timeout / binfo->bi_intfreq * pitrtclk / 2;
80 else
81 pitc = pitrtclk * wdt_timeout / binfo->bi_intfreq / 2;
82
83 imap->im_sit.sit_pitc = pitc << 16;
84 imap->im_sit.sit_piscr =
85 (mk_int_int_mask(PIT_INTERRUPT) << 8) | PISCR_PIE | PISCR_PTE;
86
87 if (request_irq(PIT_INTERRUPT, m8xx_wdt_interrupt, 0, "watchdog", NULL))
88 panic("m8xx_wdt: could not allocate watchdog irq!");
89
90 printk(KERN_NOTICE
91 "m8xx_wdt: keep-alive trigger installed (PITC: 0x%04X)\n", pitc);
92
93 wdt_timeout /= binfo->bi_intfreq;
94}
95
96int m8xx_wdt_get_timeout(void)
97{
98 return wdt_timeout;
99}
diff --git a/arch/ppc/syslib/m8xx_wdt.h b/arch/ppc/syslib/m8xx_wdt.h
new file mode 100644
index 000000000000..0d81a9f8155f
--- /dev/null
+++ b/arch/ppc/syslib/m8xx_wdt.h
@@ -0,0 +1,16 @@
1/*
2 * Author: Florian Schirmer <jolt@tuxbox.org>
3 *
4 * 2002 (c) Florian Schirmer <jolt@tuxbox.org> This file is licensed under
5 * the terms of the GNU General Public License version 2. This program
6 * is licensed "as is" without any warranty of any kind, whether express
7 * or implied.
8 */
9#ifndef _PPC_SYSLIB_M8XX_WDT_H
10#define _PPC_SYSLIB_M8XX_WDT_H
11
12extern void m8xx_wdt_handler_install(bd_t * binfo);
13extern int m8xx_wdt_get_timeout(void);
14extern void m8xx_wdt_reset(void);
15
16#endif /* _PPC_SYSLIB_M8XX_WDT_H */
diff --git a/arch/ppc/syslib/mpc10x_common.c b/arch/ppc/syslib/mpc10x_common.c
new file mode 100644
index 000000000000..fd93adfd464c
--- /dev/null
+++ b/arch/ppc/syslib/mpc10x_common.c
@@ -0,0 +1,510 @@
1/*
2 * arch/ppc/syslib/mpc10x_common.c
3 *
4 * Common routines for the Motorola SPS MPC106, MPC107 and MPC8240 Host bridge,
5 * Mem ctlr, EPIC, etc.
6 *
7 * Author: Mark A. Greer
8 * mgreer@mvista.com
9 *
10 * 2001 (c) MontaVista, Software, Inc. This file is licensed under
11 * the terms of the GNU General Public License version 2. This program
12 * is licensed "as is" without any warranty of any kind, whether express
13 * or implied.
14 */
15
16/*
17 * *** WARNING - A BAT MUST be set to access the PCI config addr/data regs ***
18 */
19
20#include <linux/kernel.h>
21#include <linux/init.h>
22#include <linux/pci.h>
23#include <linux/slab.h>
24
25#include <asm/byteorder.h>
26#include <asm/io.h>
27#include <asm/irq.h>
28#include <asm/uaccess.h>
29#include <asm/machdep.h>
30#include <asm/pci-bridge.h>
31#include <asm/open_pic.h>
32#include <asm/mpc10x.h>
33#include <asm/ocp.h>
34
35/* The OCP structure is fixed by code below, before OCP initialises.
36 paddr depends on where the board places the EUMB.
37 - fixed in mpc10x_bridge_init().
38 irq depends on two things:
39 > does the board use the EPIC at all? (PCORE does not).
40 > is the EPIC in serial or parallel mode?
41 - fixed in mpc10x_set_openpic().
42*/
43
44#ifdef CONFIG_MPC10X_OPENPIC
45#ifdef CONFIG_EPIC_SERIAL_MODE
46#define EPIC_IRQ_BASE (epic_serial_mode ? 16 : 5)
47#else
48#define EPIC_IRQ_BASE 5
49#endif
50#define MPC10X_I2C_IRQ (EPIC_IRQ_BASE + NUM_8259_INTERRUPTS)
51#define MPC10X_DMA0_IRQ (EPIC_IRQ_BASE + 1 + NUM_8259_INTERRUPTS)
52#define MPC10X_DMA1_IRQ (EPIC_IRQ_BASE + 2 + NUM_8259_INTERRUPTS)
53#else
54#define MPC10X_I2C_IRQ OCP_IRQ_NA
55#define MPC10X_DMA0_IRQ OCP_IRQ_NA
56#define MPC10X_DMA1_IRQ OCP_IRQ_NA
57#endif
58
59
60struct ocp_def core_ocp[] = {
61 { .vendor = OCP_VENDOR_INVALID
62 }
63};
64
65static struct ocp_fs_i2c_data mpc10x_i2c_data = {
66 .flags = 0
67};
68static struct ocp_def mpc10x_i2c_ocp = {
69 .vendor = OCP_VENDOR_MOTOROLA,
70 .function = OCP_FUNC_IIC,
71 .index = 0,
72 .additions = &mpc10x_i2c_data
73};
74
75static struct ocp_def mpc10x_dma_ocp[2] = {
76{ .vendor = OCP_VENDOR_MOTOROLA,
77 .function = OCP_FUNC_DMA,
78 .index = 0 },
79{ .vendor = OCP_VENDOR_MOTOROLA,
80 .function = OCP_FUNC_DMA,
81 .index = 1 }
82};
83
84/* Set resources to match bridge memory map */
85void __init
86mpc10x_bridge_set_resources(int map, struct pci_controller *hose)
87{
88
89 switch (map) {
90 case MPC10X_MEM_MAP_A:
91 pci_init_resource(&hose->io_resource,
92 0x00000000,
93 0x3f7fffff,
94 IORESOURCE_IO,
95 "PCI host bridge");
96
97 pci_init_resource (&hose->mem_resources[0],
98 0xc0000000,
99 0xfeffffff,
100 IORESOURCE_MEM,
101 "PCI host bridge");
102 break;
103 case MPC10X_MEM_MAP_B:
104 pci_init_resource(&hose->io_resource,
105 0x00000000,
106 0x00bfffff,
107 IORESOURCE_IO,
108 "PCI host bridge");
109
110 pci_init_resource (&hose->mem_resources[0],
111 0x80000000,
112 0xfcffffff,
113 IORESOURCE_MEM,
114 "PCI host bridge");
115 break;
116 default:
117 printk("mpc10x_bridge_set_resources: "
118 "Invalid map specified\n");
119 if (ppc_md.progress)
120 ppc_md.progress("mpc10x:exit1", 0x100);
121 }
122}
123/*
124 * Do some initialization and put the EUMB registers at the specified address
125 * (also map the EPIC registers into virtual space--OpenPIC_Addr will be set).
126 *
127 * The EPIC is not on the 106, only the 8240 and 107.
128 */
129int __init
130mpc10x_bridge_init(struct pci_controller *hose,
131 uint current_map,
132 uint new_map,
133 uint phys_eumb_base)
134{
135 int host_bridge, picr1, picr1_bit;
136 ulong pci_config_addr, pci_config_data;
137 u_char pir, byte;
138
139 if (ppc_md.progress) ppc_md.progress("mpc10x:enter", 0x100);
140
141 /* Set up for current map so we can get at config regs */
142 switch (current_map) {
143 case MPC10X_MEM_MAP_A:
144 setup_indirect_pci(hose,
145 MPC10X_MAPA_CNFG_ADDR,
146 MPC10X_MAPA_CNFG_DATA);
147 break;
148 case MPC10X_MEM_MAP_B:
149 setup_indirect_pci(hose,
150 MPC10X_MAPB_CNFG_ADDR,
151 MPC10X_MAPB_CNFG_DATA);
152 break;
153 default:
154 printk("mpc10x_bridge_init: %s\n",
155 "Invalid current map specified");
156 if (ppc_md.progress)
157 ppc_md.progress("mpc10x:exit1", 0x100);
158 return -1;
159 }
160
161 /* Make sure it's a supported bridge */
162 early_read_config_dword(hose,
163 0,
164 PCI_DEVFN(0,0),
165 PCI_VENDOR_ID,
166 &host_bridge);
167
168 switch (host_bridge) {
169 case MPC10X_BRIDGE_106:
170 case MPC10X_BRIDGE_8240:
171 case MPC10X_BRIDGE_107:
172 case MPC10X_BRIDGE_8245:
173 break;
174 default:
175 if (ppc_md.progress)
176 ppc_md.progress("mpc10x:exit2", 0x100);
177 return -1;
178 }
179
180 switch (new_map) {
181 case MPC10X_MEM_MAP_A:
182 MPC10X_SETUP_HOSE(hose, A);
183 pci_config_addr = MPC10X_MAPA_CNFG_ADDR;
184 pci_config_data = MPC10X_MAPA_CNFG_DATA;
185 picr1_bit = MPC10X_CFG_PICR1_ADDR_MAP_A;
186 break;
187 case MPC10X_MEM_MAP_B:
188 MPC10X_SETUP_HOSE(hose, B);
189 pci_config_addr = MPC10X_MAPB_CNFG_ADDR;
190 pci_config_data = MPC10X_MAPB_CNFG_DATA;
191 picr1_bit = MPC10X_CFG_PICR1_ADDR_MAP_B;
192 break;
193 default:
194 printk("mpc10x_bridge_init: %s\n",
195 "Invalid new map specified");
196 if (ppc_md.progress)
197 ppc_md.progress("mpc10x:exit3", 0x100);
198 return -1;
199 }
200
201 /* Make bridge use the 'new_map', if not already usng it */
202 if (current_map != new_map) {
203 early_read_config_dword(hose,
204 0,
205 PCI_DEVFN(0,0),
206 MPC10X_CFG_PICR1_REG,
207 &picr1);
208
209 picr1 = (picr1 & ~MPC10X_CFG_PICR1_ADDR_MAP_MASK) |
210 picr1_bit;
211
212 early_write_config_dword(hose,
213 0,
214 PCI_DEVFN(0,0),
215 MPC10X_CFG_PICR1_REG,
216 picr1);
217
218 asm volatile("sync");
219
220 /* Undo old mappings & map in new cfg data/addr regs */
221 iounmap((void *)hose->cfg_addr);
222 iounmap((void *)hose->cfg_data);
223
224 setup_indirect_pci(hose,
225 pci_config_addr,
226 pci_config_data);
227 }
228
229 /* Setup resources to match map */
230 mpc10x_bridge_set_resources(new_map, hose);
231
232 /*
233 * Want processor accesses of 0xFDxxxxxx to be mapped
234 * to PCI memory space at 0x00000000. Do not want
235 * host bridge to respond to PCI memory accesses of
236 * 0xFDxxxxxx. Do not want host bridge to respond
237 * to PCI memory addresses 0xFD000000-0xFDFFFFFF;
238 * want processor accesses from 0x000A0000-0x000BFFFF
239 * to be forwarded to system memory.
240 *
241 * Only valid if not in agent mode and using MAP B.
242 */
243 if (new_map == MPC10X_MEM_MAP_B) {
244 early_read_config_byte(hose,
245 0,
246 PCI_DEVFN(0,0),
247 MPC10X_CFG_MAPB_OPTIONS_REG,
248 &byte);
249
250 byte &= ~(MPC10X_CFG_MAPB_OPTIONS_PFAE |
251 MPC10X_CFG_MAPB_OPTIONS_PCICH |
252 MPC10X_CFG_MAPB_OPTIONS_PROCCH);
253
254 if (host_bridge != MPC10X_BRIDGE_106) {
255 byte |= MPC10X_CFG_MAPB_OPTIONS_CFAE;
256 }
257
258 early_write_config_byte(hose,
259 0,
260 PCI_DEVFN(0,0),
261 MPC10X_CFG_MAPB_OPTIONS_REG,
262 byte);
263 }
264
265 if (host_bridge != MPC10X_BRIDGE_106) {
266 early_read_config_byte(hose,
267 0,
268 PCI_DEVFN(0,0),
269 MPC10X_CFG_PIR_REG,
270 &pir);
271
272 if (pir != MPC10X_CFG_PIR_HOST_BRIDGE) {
273 printk("Host bridge in Agent mode\n");
274 /* Read or Set LMBAR & PCSRBAR? */
275 }
276
277 /* Set base addr of the 8240/107 EUMB. */
278 early_write_config_dword(hose,
279 0,
280 PCI_DEVFN(0,0),
281 MPC10X_CFG_EUMBBAR,
282 phys_eumb_base);
283#ifdef CONFIG_MPC10X_OPENPIC
284 /* Map EPIC register part of EUMB into vitual memory - PCORE
285 uses an i8259 instead of EPIC. */
286 OpenPIC_Addr =
287 ioremap(phys_eumb_base + MPC10X_EUMB_EPIC_OFFSET,
288 MPC10X_EUMB_EPIC_SIZE);
289#endif
290 mpc10x_i2c_ocp.paddr = phys_eumb_base + MPC10X_EUMB_I2C_OFFSET;
291 mpc10x_i2c_ocp.irq = MPC10X_I2C_IRQ;
292 ocp_add_one_device(&mpc10x_i2c_ocp);
293 mpc10x_dma_ocp[0].paddr = phys_eumb_base +
294 MPC10X_EUMB_DMA_OFFSET + 0x100;
295 mpc10x_dma_ocp[0].irq = MPC10X_DMA0_IRQ;
296 ocp_add_one_device(&mpc10x_dma_ocp[0]);
297 mpc10x_dma_ocp[1].paddr = phys_eumb_base +
298 MPC10X_EUMB_DMA_OFFSET + 0x200;
299 mpc10x_dma_ocp[1].irq = MPC10X_DMA1_IRQ;
300 ocp_add_one_device(&mpc10x_dma_ocp[1]);
301 }
302
303#ifdef CONFIG_MPC10X_STORE_GATHERING
304 mpc10x_enable_store_gathering(hose);
305#else
306 mpc10x_disable_store_gathering(hose);
307#endif
308
309 /*
310 * 8240 erratum 26, 8241/8245 erratum 29, 107 erratum 23: speculative
311 * PCI reads may return stale data so turn off.
312 */
313 if ((host_bridge == MPC10X_BRIDGE_8240)
314 || (host_bridge == MPC10X_BRIDGE_8245)
315 || (host_bridge == MPC10X_BRIDGE_107)) {
316
317 early_read_config_dword(hose, 0, PCI_DEVFN(0,0),
318 MPC10X_CFG_PICR1_REG, &picr1);
319
320 picr1 &= ~MPC10X_CFG_PICR1_SPEC_PCI_RD;
321
322 early_write_config_dword(hose, 0, PCI_DEVFN(0,0),
323 MPC10X_CFG_PICR1_REG, picr1);
324 }
325
326 /*
327 * 8241/8245 erratum 28: PCI reads from local memory may return
328 * stale data. Workaround by setting PICR2[0] to disable copyback
329 * optimization. Oddly, the latest available user manual for the
330 * 8245 (Rev 2., dated 10/2003) says PICR2[0] is reserverd.
331 */
332 if (host_bridge == MPC10X_BRIDGE_8245) {
333 ulong picr2;
334
335 early_read_config_dword(hose, 0, PCI_DEVFN(0,0),
336 MPC10X_CFG_PICR2_REG, &picr2);
337
338 picr2 |= MPC10X_CFG_PICR2_COPYBACK_OPT;
339
340 early_write_config_dword(hose, 0, PCI_DEVFN(0,0),
341 MPC10X_CFG_PICR2_REG, picr2);
342 }
343
344 if (ppc_md.progress) ppc_md.progress("mpc10x:exit", 0x100);
345 return 0;
346}
347
348/*
349 * Need to make our own PCI config space access macros because
350 * mpc10x_get_mem_size() is called before the data structures are set up for
351 * the 'early_xxx' and 'indirect_xxx' routines to work.
352 * Assumes bus 0.
353 */
354#define MPC10X_CFG_read(val, addr, type, op) *val = op((type)(addr))
355#define MPC10X_CFG_write(val, addr, type, op) op((type *)(addr), (val))
356
357#define MPC10X_PCI_OP(rw, size, type, op, mask) \
358static void \
359mpc10x_##rw##_config_##size(uint *cfg_addr, uint *cfg_data, int devfn, int offset, type val) \
360{ \
361 out_be32(cfg_addr, \
362 ((offset & 0xfc) << 24) | (devfn << 16) \
363 | (0 << 8) | 0x80); \
364 MPC10X_CFG_##rw(val, cfg_data + (offset & mask), type, op); \
365 return; \
366}
367
368MPC10X_PCI_OP(read, byte, u8 *, in_8, 3)
369MPC10X_PCI_OP(read, dword, u32 *, in_le32, 0)
370#if 0 /* Not used */
371MPC10X_PCI_OP(write, byte, u8, out_8, 3)
372MPC10X_PCI_OP(read, word, u16 *, in_le16, 2)
373MPC10X_PCI_OP(write, word, u16, out_le16, 2)
374MPC10X_PCI_OP(write, dword, u32, out_le32, 0)
375#endif
376
377/*
378 * Read the memory controller registers to determine the amount of memory in
379 * the system. This assumes that the firmware has correctly set up the memory
380 * controller registers.
381 */
382unsigned long __init
383mpc10x_get_mem_size(uint mem_map)
384{
385 uint *config_addr, *config_data, val;
386 ulong start, end, total, offset;
387 int i;
388 u_char bank_enables;
389
390 switch (mem_map) {
391 case MPC10X_MEM_MAP_A:
392 config_addr = (uint *)MPC10X_MAPA_CNFG_ADDR;
393 config_data = (uint *)MPC10X_MAPA_CNFG_DATA;
394 break;
395 case MPC10X_MEM_MAP_B:
396 config_addr = (uint *)MPC10X_MAPB_CNFG_ADDR;
397 config_data = (uint *)MPC10X_MAPB_CNFG_DATA;
398 break;
399 default:
400 return 0;
401 }
402
403 mpc10x_read_config_byte(config_addr,
404 config_data,
405 PCI_DEVFN(0,0),
406 MPC10X_MCTLR_MEM_BANK_ENABLES,
407 &bank_enables);
408
409 total = 0;
410
411 for (i=0; i<8; i++) {
412 if (bank_enables & (1 << i)) {
413 offset = MPC10X_MCTLR_MEM_START_1 + ((i > 3) ? 4 : 0);
414 mpc10x_read_config_dword(config_addr,
415 config_data,
416 PCI_DEVFN(0,0),
417 offset,
418 &val);
419 start = (val >> ((i & 3) << 3)) & 0xff;
420
421 offset = MPC10X_MCTLR_EXT_MEM_START_1 + ((i>3) ? 4 : 0);
422 mpc10x_read_config_dword(config_addr,
423 config_data,
424 PCI_DEVFN(0,0),
425 offset,
426 &val);
427 val = (val >> ((i & 3) << 3)) & 0x03;
428 start = (val << 28) | (start << 20);
429
430 offset = MPC10X_MCTLR_MEM_END_1 + ((i > 3) ? 4 : 0);
431 mpc10x_read_config_dword(config_addr,
432 config_data,
433 PCI_DEVFN(0,0),
434 offset,
435 &val);
436 end = (val >> ((i & 3) << 3)) & 0xff;
437
438 offset = MPC10X_MCTLR_EXT_MEM_END_1 + ((i > 3) ? 4 : 0);
439 mpc10x_read_config_dword(config_addr,
440 config_data,
441 PCI_DEVFN(0,0),
442 offset,
443 &val);
444 val = (val >> ((i & 3) << 3)) & 0x03;
445 end = (val << 28) | (end << 20) | 0xfffff;
446
447 total += (end - start + 1);
448 }
449 }
450
451 return total;
452}
453
454int __init
455mpc10x_enable_store_gathering(struct pci_controller *hose)
456{
457 uint picr1;
458
459 early_read_config_dword(hose,
460 0,
461 PCI_DEVFN(0,0),
462 MPC10X_CFG_PICR1_REG,
463 &picr1);
464
465 picr1 |= MPC10X_CFG_PICR1_ST_GATH_EN;
466
467 early_write_config_dword(hose,
468 0,
469 PCI_DEVFN(0,0),
470 MPC10X_CFG_PICR1_REG,
471 picr1);
472
473 return 0;
474}
475
476int __init
477mpc10x_disable_store_gathering(struct pci_controller *hose)
478{
479 uint picr1;
480
481 early_read_config_dword(hose,
482 0,
483 PCI_DEVFN(0,0),
484 MPC10X_CFG_PICR1_REG,
485 &picr1);
486
487 picr1 &= ~MPC10X_CFG_PICR1_ST_GATH_EN;
488
489 early_write_config_dword(hose,
490 0,
491 PCI_DEVFN(0,0),
492 MPC10X_CFG_PICR1_REG,
493 picr1);
494
495 return 0;
496}
497
498#ifdef CONFIG_MPC10X_OPENPIC
499void __init mpc10x_set_openpic(void)
500{
501 /* Map external IRQs */
502 openpic_set_sources(0, EPIC_IRQ_BASE, OpenPIC_Addr + 0x10200);
503 /* Skip reserved space and map i2c and DMA Ch[01] */
504 openpic_set_sources(EPIC_IRQ_BASE, 3, OpenPIC_Addr + 0x11020);
505 /* Skip reserved space and map Message Unit Interrupt (I2O) */
506 openpic_set_sources(EPIC_IRQ_BASE + 3, 1, OpenPIC_Addr + 0x110C0);
507
508 openpic_init(NUM_8259_INTERRUPTS);
509}
510#endif
diff --git a/arch/ppc/syslib/mpc52xx_devices.c b/arch/ppc/syslib/mpc52xx_devices.c
new file mode 100644
index 000000000000..ad5182efca1d
--- /dev/null
+++ b/arch/ppc/syslib/mpc52xx_devices.c
@@ -0,0 +1,318 @@
1/*
2 * arch/ppc/syslib/mpc52xx_devices.c
3 *
4 * Freescale MPC52xx device descriptions
5 *
6 *
7 * Maintainer : Sylvain Munaut <tnt@246tNt.com>
8 *
9 * Copyright (C) 2005 Sylvain Munaut <tnt@246tNt.com>
10 *
11 * This file is licensed under the terms of the GNU General Public License
12 * version 2. This program is licensed "as is" without any warranty of any
13 * kind, whether express or implied.
14 */
15
16#include <linux/fsl_devices.h>
17#include <linux/resource.h>
18#include <asm/mpc52xx.h>
19#include <asm/ppc_sys.h>
20
21
22static u64 mpc52xx_dma_mask = 0xffffffffULL;
23
24static struct fsl_i2c_platform_data mpc52xx_fsl_i2c_pdata = {
25 .device_flags = FSL_I2C_DEV_CLOCK_5200,
26};
27
28
29/* We use relative offsets for IORESOURCE_MEM to be independent from the
30 * MBAR location at compile time
31 */
32
33/* TODO Add the BestComm initiator channel to the device definitions,
34 possibly using IORESOURCE_DMA. But that's when BestComm is ready ... */
35
36struct platform_device ppc_sys_platform_devices[] = {
37 [MPC52xx_MSCAN1] = {
38 .name = "mpc52xx-mscan",
39 .id = 0,
40 .num_resources = 2,
41 .resource = (struct resource[]) {
42 {
43 .start = 0x0900,
44 .end = 0x097f,
45 .flags = IORESOURCE_MEM,
46 },
47 {
48 .start = MPC52xx_MSCAN1_IRQ,
49 .end = MPC52xx_MSCAN1_IRQ,
50 .flags = IORESOURCE_IRQ,
51 },
52 },
53 },
54 [MPC52xx_MSCAN2] = {
55 .name = "mpc52xx-mscan",
56 .id = 1,
57 .num_resources = 2,
58 .resource = (struct resource[]) {
59 {
60 .start = 0x0980,
61 .end = 0x09ff,
62 .flags = IORESOURCE_MEM,
63 },
64 {
65 .start = MPC52xx_MSCAN2_IRQ,
66 .end = MPC52xx_MSCAN2_IRQ,
67 .flags = IORESOURCE_IRQ,
68 },
69 },
70 },
71 [MPC52xx_SPI] = {
72 .name = "mpc52xx-spi",
73 .id = -1,
74 .num_resources = 3,
75 .resource = (struct resource[]) {
76 {
77 .start = 0x0f00,
78 .end = 0x0f1f,
79 .flags = IORESOURCE_MEM,
80 },
81 {
82 .name = "modf",
83 .start = MPC52xx_SPI_MODF_IRQ,
84 .end = MPC52xx_SPI_MODF_IRQ,
85 .flags = IORESOURCE_IRQ,
86 },
87 {
88 .name = "spif",
89 .start = MPC52xx_SPI_SPIF_IRQ,
90 .end = MPC52xx_SPI_SPIF_IRQ,
91 .flags = IORESOURCE_IRQ,
92 },
93 },
94 },
95 [MPC52xx_USB] = {
96 .name = "ppc-soc-ohci",
97 .id = -1,
98 .num_resources = 2,
99 .dev.dma_mask = &mpc52xx_dma_mask,
100 .dev.coherent_dma_mask = 0xffffffffULL,
101 .resource = (struct resource[]) {
102 {
103 .start = 0x1000,
104 .end = 0x10ff,
105 .flags = IORESOURCE_MEM,
106 },
107 {
108 .start = MPC52xx_USB_IRQ,
109 .end = MPC52xx_USB_IRQ,
110 .flags = IORESOURCE_IRQ,
111 },
112 },
113 },
114 [MPC52xx_BDLC] = {
115 .name = "mpc52xx-bdlc",
116 .id = -1,
117 .num_resources = 2,
118 .resource = (struct resource[]) {
119 {
120 .start = 0x1300,
121 .end = 0x130f,
122 .flags = IORESOURCE_MEM,
123 },
124 {
125 .start = MPC52xx_BDLC_IRQ,
126 .end = MPC52xx_BDLC_IRQ,
127 .flags = IORESOURCE_IRQ,
128 },
129 },
130 },
131 [MPC52xx_PSC1] = {
132 .name = "mpc52xx-psc",
133 .id = 0,
134 .num_resources = 2,
135 .resource = (struct resource[]) {
136 {
137 .start = 0x2000,
138 .end = 0x209f,
139 .flags = IORESOURCE_MEM,
140 },
141 {
142 .start = MPC52xx_PSC1_IRQ,
143 .end = MPC52xx_PSC1_IRQ,
144 .flags = IORESOURCE_IRQ,
145 },
146 },
147 },
148 [MPC52xx_PSC2] = {
149 .name = "mpc52xx-psc",
150 .id = 1,
151 .num_resources = 2,
152 .resource = (struct resource[]) {
153 {
154 .start = 0x2200,
155 .end = 0x229f,
156 .flags = IORESOURCE_MEM,
157 },
158 {
159 .start = MPC52xx_PSC2_IRQ,
160 .end = MPC52xx_PSC2_IRQ,
161 .flags = IORESOURCE_IRQ,
162 },
163 },
164 },
165 [MPC52xx_PSC3] = {
166 .name = "mpc52xx-psc",
167 .id = 2,
168 .num_resources = 2,
169 .resource = (struct resource[]) {
170 {
171 .start = 0x2400,
172 .end = 0x249f,
173 .flags = IORESOURCE_MEM,
174 },
175 {
176 .start = MPC52xx_PSC3_IRQ,
177 .end = MPC52xx_PSC3_IRQ,
178 .flags = IORESOURCE_IRQ,
179 },
180 },
181 },
182 [MPC52xx_PSC4] = {
183 .name = "mpc52xx-psc",
184 .id = 3,
185 .num_resources = 2,
186 .resource = (struct resource[]) {
187 {
188 .start = 0x2600,
189 .end = 0x269f,
190 .flags = IORESOURCE_MEM,
191 },
192 {
193 .start = MPC52xx_PSC4_IRQ,
194 .end = MPC52xx_PSC4_IRQ,
195 .flags = IORESOURCE_IRQ,
196 },
197 },
198 },
199 [MPC52xx_PSC5] = {
200 .name = "mpc52xx-psc",
201 .id = 4,
202 .num_resources = 2,
203 .resource = (struct resource[]) {
204 {
205 .start = 0x2800,
206 .end = 0x289f,
207 .flags = IORESOURCE_MEM,
208 },
209 {
210 .start = MPC52xx_PSC5_IRQ,
211 .end = MPC52xx_PSC5_IRQ,
212 .flags = IORESOURCE_IRQ,
213 },
214 },
215 },
216 [MPC52xx_PSC6] = {
217 .name = "mpc52xx-psc",
218 .id = 5,
219 .num_resources = 2,
220 .resource = (struct resource[]) {
221 {
222 .start = 0x2c00,
223 .end = 0x2c9f,
224 .flags = IORESOURCE_MEM,
225 },
226 {
227 .start = MPC52xx_PSC6_IRQ,
228 .end = MPC52xx_PSC6_IRQ,
229 .flags = IORESOURCE_IRQ,
230 },
231 },
232 },
233 [MPC52xx_FEC] = {
234 .name = "mpc52xx-fec",
235 .id = -1,
236 .num_resources = 2,
237 .resource = (struct resource[]) {
238 {
239 .start = 0x3000,
240 .end = 0x33ff,
241 .flags = IORESOURCE_MEM,
242 },
243 {
244 .start = MPC52xx_FEC_IRQ,
245 .end = MPC52xx_FEC_IRQ,
246 .flags = IORESOURCE_IRQ,
247 },
248 },
249 },
250 [MPC52xx_ATA] = {
251 .name = "mpc52xx-ata",
252 .id = -1,
253 .num_resources = 2,
254 .resource = (struct resource[]) {
255 {
256 .start = 0x3a00,
257 .end = 0x3aff,
258 .flags = IORESOURCE_MEM,
259 },
260 {
261 .start = MPC52xx_ATA_IRQ,
262 .end = MPC52xx_ATA_IRQ,
263 .flags = IORESOURCE_IRQ,
264 },
265 },
266 },
267 [MPC52xx_I2C1] = {
268 .name = "fsl-i2c",
269 .id = 0,
270 .dev.platform_data = &mpc52xx_fsl_i2c_pdata,
271 .num_resources = 2,
272 .resource = (struct resource[]) {
273 {
274 .start = 0x3d00,
275 .end = 0x3d1f,
276 .flags = IORESOURCE_MEM,
277 },
278 {
279 .start = MPC52xx_I2C1_IRQ,
280 .end = MPC52xx_I2C1_IRQ,
281 .flags = IORESOURCE_IRQ,
282 },
283 },
284 },
285 [MPC52xx_I2C2] = {
286 .name = "fsl-i2c",
287 .id = 1,
288 .dev.platform_data = &mpc52xx_fsl_i2c_pdata,
289 .num_resources = 2,
290 .resource = (struct resource[]) {
291 {
292 .start = 0x3d40,
293 .end = 0x3d5f,
294 .flags = IORESOURCE_MEM,
295 },
296 {
297 .start = MPC52xx_I2C2_IRQ,
298 .end = MPC52xx_I2C2_IRQ,
299 .flags = IORESOURCE_IRQ,
300 },
301 },
302 },
303};
304
305
306static int __init mach_mpc52xx_fixup(struct platform_device *pdev)
307{
308 ppc_sys_fixup_mem_resource(pdev, MPC52xx_MBAR);
309 return 0;
310}
311
312static int __init mach_mpc52xx_init(void)
313{
314 ppc_sys_device_fixup = mach_mpc52xx_fixup;
315 return 0;
316}
317
318postcore_initcall(mach_mpc52xx_init);
diff --git a/arch/ppc/syslib/mpc52xx_pci.c b/arch/ppc/syslib/mpc52xx_pci.c
new file mode 100644
index 000000000000..c723efd954a6
--- /dev/null
+++ b/arch/ppc/syslib/mpc52xx_pci.c
@@ -0,0 +1,235 @@
1/*
2 * arch/ppc/syslib/mpc52xx_pci.c
3 *
4 * PCI code for the Freescale MPC52xx embedded CPU.
5 *
6 *
7 * Maintainer : Sylvain Munaut <tnt@246tNt.com>
8 *
9 * Copyright (C) 2004 Sylvain Munaut <tnt@246tNt.com>
10 *
11 * This file is licensed under the terms of the GNU General Public License
12 * version 2. This program is licensed "as is" without any warranty of any
13 * kind, whether express or implied.
14 */
15
16#include <linux/config.h>
17
18#include <asm/pci.h>
19
20#include <asm/mpc52xx.h>
21#include "mpc52xx_pci.h"
22
23#include <asm/delay.h>
24
25
26static int
27mpc52xx_pci_read_config(struct pci_bus *bus, unsigned int devfn,
28 int offset, int len, u32 *val)
29{
30 struct pci_controller *hose = bus->sysdata;
31 u32 value;
32
33 if (ppc_md.pci_exclude_device)
34 if (ppc_md.pci_exclude_device(bus->number, devfn))
35 return PCIBIOS_DEVICE_NOT_FOUND;
36
37 out_be32(hose->cfg_addr,
38 (1 << 31) |
39 ((bus->number - hose->bus_offset) << 16) |
40 (devfn << 8) |
41 (offset & 0xfc));
42
43 value = in_le32(hose->cfg_data);
44
45 if (len != 4) {
46 value >>= ((offset & 0x3) << 3);
47 value &= 0xffffffff >> (32 - (len << 3));
48 }
49
50 *val = value;
51
52 out_be32(hose->cfg_addr, 0);
53
54 return PCIBIOS_SUCCESSFUL;
55}
56
57static int
58mpc52xx_pci_write_config(struct pci_bus *bus, unsigned int devfn,
59 int offset, int len, u32 val)
60{
61 struct pci_controller *hose = bus->sysdata;
62 u32 value, mask;
63
64 if (ppc_md.pci_exclude_device)
65 if (ppc_md.pci_exclude_device(bus->number, devfn))
66 return PCIBIOS_DEVICE_NOT_FOUND;
67
68 out_be32(hose->cfg_addr,
69 (1 << 31) |
70 ((bus->number - hose->bus_offset) << 16) |
71 (devfn << 8) |
72 (offset & 0xfc));
73
74 if (len != 4) {
75 value = in_le32(hose->cfg_data);
76
77 offset = (offset & 0x3) << 3;
78 mask = (0xffffffff >> (32 - (len << 3)));
79 mask <<= offset;
80
81 value &= ~mask;
82 val = value | ((val << offset) & mask);
83 }
84
85 out_le32(hose->cfg_data, val);
86
87 out_be32(hose->cfg_addr, 0);
88
89 return PCIBIOS_SUCCESSFUL;
90}
91
92static struct pci_ops mpc52xx_pci_ops = {
93 .read = mpc52xx_pci_read_config,
94 .write = mpc52xx_pci_write_config
95};
96
97
98static void __init
99mpc52xx_pci_setup(struct mpc52xx_pci __iomem *pci_regs)
100{
101
102 /* Setup control regs */
103 /* Nothing to do afaik */
104
105 /* Setup windows */
106 out_be32(&pci_regs->iw0btar, MPC52xx_PCI_IWBTAR_TRANSLATION(
107 MPC52xx_PCI_MEM_START + MPC52xx_PCI_MEM_OFFSET,
108 MPC52xx_PCI_MEM_START,
109 MPC52xx_PCI_MEM_SIZE ));
110
111 out_be32(&pci_regs->iw1btar, MPC52xx_PCI_IWBTAR_TRANSLATION(
112 MPC52xx_PCI_MMIO_START + MPC52xx_PCI_MEM_OFFSET,
113 MPC52xx_PCI_MMIO_START,
114 MPC52xx_PCI_MMIO_SIZE ));
115
116 out_be32(&pci_regs->iw2btar, MPC52xx_PCI_IWBTAR_TRANSLATION(
117 MPC52xx_PCI_IO_BASE,
118 MPC52xx_PCI_IO_START,
119 MPC52xx_PCI_IO_SIZE ));
120
121 out_be32(&pci_regs->iwcr, MPC52xx_PCI_IWCR_PACK(
122 ( MPC52xx_PCI_IWCR_ENABLE | /* iw0btar */
123 MPC52xx_PCI_IWCR_READ_MULTI |
124 MPC52xx_PCI_IWCR_MEM ),
125 ( MPC52xx_PCI_IWCR_ENABLE | /* iw1btar */
126 MPC52xx_PCI_IWCR_READ |
127 MPC52xx_PCI_IWCR_MEM ),
128 ( MPC52xx_PCI_IWCR_ENABLE | /* iw2btar */
129 MPC52xx_PCI_IWCR_IO )
130 ));
131
132
133 out_be32(&pci_regs->tbatr0,
134 MPC52xx_PCI_TBATR_ENABLE | MPC52xx_PCI_TARGET_IO );
135 out_be32(&pci_regs->tbatr1,
136 MPC52xx_PCI_TBATR_ENABLE | MPC52xx_PCI_TARGET_MEM );
137
138 out_be32(&pci_regs->tcr, MPC52xx_PCI_TCR_LD);
139
140 /* Reset the exteral bus ( internal PCI controller is NOT resetted ) */
141 /* Not necessary and can be a bad thing if for example the bootloader
142 is displaying a splash screen or ... Just left here for
143 documentation purpose if anyone need it */
144#if 0
145 u32 tmp;
146 tmp = in_be32(&pci_regs->gscr);
147 out_be32(&pci_regs->gscr, tmp | MPC52xx_PCI_GSCR_PR);
148 udelay(50);
149 out_be32(&pci_regs->gscr, tmp);
150#endif
151}
152
153static void __init
154mpc52xx_pci_fixup_resources(struct pci_dev *dev)
155{
156 int i;
157
158 /* We don't rely on boot loader for PCI and resets all
159 devices */
160 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
161 struct resource *res = &dev->resource[i];
162 if (res->end > res->start) { /* Only valid resources */
163 res->end -= res->start;
164 res->start = 0;
165 res->flags |= IORESOURCE_UNSET;
166 }
167 }
168
169 /* The PCI Host bridge of MPC52xx has a prefetch memory resource
170 fixed to 1Gb. Doesn't fit in the resource system so we remove it */
171 if ( (dev->vendor == PCI_VENDOR_ID_MOTOROLA) &&
172 (dev->device == PCI_DEVICE_ID_MOTOROLA_MPC5200) ) {
173 struct resource *res = &dev->resource[1];
174 res->start = res->end = res->flags = 0;
175 }
176}
177
178void __init
179mpc52xx_find_bridges(void)
180{
181 struct mpc52xx_pci __iomem *pci_regs;
182 struct pci_controller *hose;
183
184 pci_assign_all_busses = 1;
185
186 pci_regs = ioremap(MPC52xx_PA(MPC52xx_PCI_OFFSET), MPC52xx_PCI_SIZE);
187 if (!pci_regs)
188 return;
189
190 hose = pcibios_alloc_controller();
191 if (!hose) {
192 iounmap(pci_regs);
193 return;
194 }
195
196 ppc_md.pci_swizzle = common_swizzle;
197 ppc_md.pcibios_fixup_resources = mpc52xx_pci_fixup_resources;
198
199 hose->first_busno = 0;
200 hose->last_busno = 0xff;
201 hose->bus_offset = 0;
202 hose->ops = &mpc52xx_pci_ops;
203
204 mpc52xx_pci_setup(pci_regs);
205
206 hose->pci_mem_offset = MPC52xx_PCI_MEM_OFFSET;
207
208 isa_io_base =
209 (unsigned long) ioremap(MPC52xx_PCI_IO_BASE,
210 MPC52xx_PCI_IO_SIZE);
211 hose->io_base_virt = (void *) isa_io_base;
212
213 hose->cfg_addr = &pci_regs->car;
214 hose->cfg_data = (void __iomem *) isa_io_base;
215
216 /* Setup resources */
217 pci_init_resource(&hose->mem_resources[0],
218 MPC52xx_PCI_MEM_START,
219 MPC52xx_PCI_MEM_STOP,
220 IORESOURCE_MEM|IORESOURCE_PREFETCH,
221 "PCI prefetchable memory");
222
223 pci_init_resource(&hose->mem_resources[1],
224 MPC52xx_PCI_MMIO_START,
225 MPC52xx_PCI_MMIO_STOP,
226 IORESOURCE_MEM,
227 "PCI memory");
228
229 pci_init_resource(&hose->io_resource,
230 MPC52xx_PCI_IO_START,
231 MPC52xx_PCI_IO_STOP,
232 IORESOURCE_IO,
233 "PCI I/O");
234
235}
diff --git a/arch/ppc/syslib/mpc52xx_pci.h b/arch/ppc/syslib/mpc52xx_pci.h
new file mode 100644
index 000000000000..04b509a02530
--- /dev/null
+++ b/arch/ppc/syslib/mpc52xx_pci.h
@@ -0,0 +1,139 @@
1/*
2 * arch/ppc/syslib/mpc52xx_pci.h
3 *
4 * PCI Include file the Freescale MPC52xx embedded cpu chips
5 *
6 *
7 * Maintainer : Sylvain Munaut <tnt@246tNt.com>
8 *
9 * Inspired from code written by Dale Farnsworth <dfarnsworth@mvista.com>
10 * for the 2.4 kernel.
11 *
12 * Copyright (C) 2004 Sylvain Munaut <tnt@246tNt.com>
13 * Copyright (C) 2003 MontaVista, Software, Inc.
14 *
15 * This file is licensed under the terms of the GNU General Public License
16 * version 2. This program is licensed "as is" without any warranty of any
17 * kind, whether express or implied.
18 */
19
20#ifndef __SYSLIB_MPC52xx_PCI_H__
21#define __SYSLIB_MPC52xx_PCI_H__
22
23/* ======================================================================== */
24/* PCI windows config */
25/* ======================================================================== */
26
27/*
28 * Master windows : MPC52xx -> PCI
29 *
30 * 0x80000000 -> 0x9FFFFFFF PCI Mem prefetchable IW0BTAR
31 * 0xA0000000 -> 0xAFFFFFFF PCI Mem IW1BTAR
32 * 0xB0000000 -> 0xB0FFFFFF PCI IO IW2BTAR
33 *
34 * Slave windows : PCI -> MPC52xx
35 *
36 * 0xF0000000 -> 0xF003FFFF MPC52xx MBAR TBATR0
37 * 0x00000000 -> 0x3FFFFFFF MPC52xx local memory TBATR1
38 */
39
40#define MPC52xx_PCI_MEM_OFFSET 0x00000000 /* Offset for MEM MMIO */
41
42#define MPC52xx_PCI_MEM_START 0x80000000
43#define MPC52xx_PCI_MEM_SIZE 0x20000000
44#define MPC52xx_PCI_MEM_STOP (MPC52xx_PCI_MEM_START+MPC52xx_PCI_MEM_SIZE-1)
45
46#define MPC52xx_PCI_MMIO_START 0xa0000000
47#define MPC52xx_PCI_MMIO_SIZE 0x10000000
48#define MPC52xx_PCI_MMIO_STOP (MPC52xx_PCI_MMIO_START+MPC52xx_PCI_MMIO_SIZE-1)
49
50#define MPC52xx_PCI_IO_BASE 0xb0000000
51
52#define MPC52xx_PCI_IO_START 0x00000000
53#define MPC52xx_PCI_IO_SIZE 0x01000000
54#define MPC52xx_PCI_IO_STOP (MPC52xx_PCI_IO_START+MPC52xx_PCI_IO_SIZE-1)
55
56
57#define MPC52xx_PCI_TARGET_IO MPC52xx_MBAR
58#define MPC52xx_PCI_TARGET_MEM 0x00000000
59
60
61/* ======================================================================== */
62/* Structures mapping & Defines for PCI Unit */
63/* ======================================================================== */
64
65#define MPC52xx_PCI_GSCR_BM 0x40000000
66#define MPC52xx_PCI_GSCR_PE 0x20000000
67#define MPC52xx_PCI_GSCR_SE 0x10000000
68#define MPC52xx_PCI_GSCR_XLB2PCI_MASK 0x07000000
69#define MPC52xx_PCI_GSCR_XLB2PCI_SHIFT 24
70#define MPC52xx_PCI_GSCR_IPG2PCI_MASK 0x00070000
71#define MPC52xx_PCI_GSCR_IPG2PCI_SHIFT 16
72#define MPC52xx_PCI_GSCR_BME 0x00004000
73#define MPC52xx_PCI_GSCR_PEE 0x00002000
74#define MPC52xx_PCI_GSCR_SEE 0x00001000
75#define MPC52xx_PCI_GSCR_PR 0x00000001
76
77
78#define MPC52xx_PCI_IWBTAR_TRANSLATION(proc_ad,pci_ad,size) \
79 ( ( (proc_ad) & 0xff000000 ) | \
80 ( (((size) - 1) >> 8) & 0x00ff0000 ) | \
81 ( ((pci_ad) >> 16) & 0x0000ff00 ) )
82
83#define MPC52xx_PCI_IWCR_PACK(win0,win1,win2) (((win0) << 24) | \
84 ((win1) << 16) | \
85 ((win2) << 8))
86
87#define MPC52xx_PCI_IWCR_DISABLE 0x0
88#define MPC52xx_PCI_IWCR_ENABLE 0x1
89#define MPC52xx_PCI_IWCR_READ 0x0
90#define MPC52xx_PCI_IWCR_READ_LINE 0x2
91#define MPC52xx_PCI_IWCR_READ_MULTI 0x4
92#define MPC52xx_PCI_IWCR_MEM 0x0
93#define MPC52xx_PCI_IWCR_IO 0x8
94
95#define MPC52xx_PCI_TCR_P 0x01000000
96#define MPC52xx_PCI_TCR_LD 0x00010000
97
98#define MPC52xx_PCI_TBATR_DISABLE 0x0
99#define MPC52xx_PCI_TBATR_ENABLE 0x1
100
101
102#ifndef __ASSEMBLY__
103
104struct mpc52xx_pci {
105 u32 idr; /* PCI + 0x00 */
106 u32 scr; /* PCI + 0x04 */
107 u32 ccrir; /* PCI + 0x08 */
108 u32 cr1; /* PCI + 0x0C */
109 u32 bar0; /* PCI + 0x10 */
110 u32 bar1; /* PCI + 0x14 */
111 u8 reserved1[16]; /* PCI + 0x18 */
112 u32 ccpr; /* PCI + 0x28 */
113 u32 sid; /* PCI + 0x2C */
114 u32 erbar; /* PCI + 0x30 */
115 u32 cpr; /* PCI + 0x34 */
116 u8 reserved2[4]; /* PCI + 0x38 */
117 u32 cr2; /* PCI + 0x3C */
118 u8 reserved3[32]; /* PCI + 0x40 */
119 u32 gscr; /* PCI + 0x60 */
120 u32 tbatr0; /* PCI + 0x64 */
121 u32 tbatr1; /* PCI + 0x68 */
122 u32 tcr; /* PCI + 0x6C */
123 u32 iw0btar; /* PCI + 0x70 */
124 u32 iw1btar; /* PCI + 0x74 */
125 u32 iw2btar; /* PCI + 0x78 */
126 u8 reserved4[4]; /* PCI + 0x7C */
127 u32 iwcr; /* PCI + 0x80 */
128 u32 icr; /* PCI + 0x84 */
129 u32 isr; /* PCI + 0x88 */
130 u32 arb; /* PCI + 0x8C */
131 u8 reserved5[104]; /* PCI + 0x90 */
132 u32 car; /* PCI + 0xF8 */
133 u8 reserved6[4]; /* PCI + 0xFC */
134};
135
136#endif /* __ASSEMBLY__ */
137
138
139#endif /* __SYSLIB_MPC52xx_PCI_H__ */
diff --git a/arch/ppc/syslib/mpc52xx_pic.c b/arch/ppc/syslib/mpc52xx_pic.c
new file mode 100644
index 000000000000..4c4497e62517
--- /dev/null
+++ b/arch/ppc/syslib/mpc52xx_pic.c
@@ -0,0 +1,257 @@
1/*
2 * arch/ppc/syslib/mpc52xx_pic.c
3 *
4 * Programmable Interrupt Controller functions for the Freescale MPC52xx
5 * embedded CPU.
6 *
7 *
8 * Maintainer : Sylvain Munaut <tnt@246tNt.com>
9 *
10 * Based on (well, mostly copied from) the code from the 2.4 kernel by
11 * Dale Farnsworth <dfarnsworth@mvista.com> and Kent Borg.
12 *
13 * Copyright (C) 2004 Sylvain Munaut <tnt@246tNt.com>
14 * Copyright (C) 2003 Montavista Software, Inc
15 *
16 * This file is licensed under the terms of the GNU General Public License
17 * version 2. This program is licensed "as is" without any warranty of any
18 * kind, whether express or implied.
19 */
20
21#include <linux/stddef.h>
22#include <linux/init.h>
23#include <linux/sched.h>
24#include <linux/signal.h>
25#include <linux/stddef.h>
26#include <linux/delay.h>
27#include <linux/irq.h>
28
29#include <asm/io.h>
30#include <asm/processor.h>
31#include <asm/system.h>
32#include <asm/irq.h>
33#include <asm/mpc52xx.h>
34
35
36static struct mpc52xx_intr __iomem *intr;
37static struct mpc52xx_sdma __iomem *sdma;
38
39static void
40mpc52xx_ic_disable(unsigned int irq)
41{
42 u32 val;
43
44 if (irq == MPC52xx_IRQ0) {
45 val = in_be32(&intr->ctrl);
46 val &= ~(1 << 11);
47 out_be32(&intr->ctrl, val);
48 }
49 else if (irq < MPC52xx_IRQ1) {
50 BUG();
51 }
52 else if (irq <= MPC52xx_IRQ3) {
53 val = in_be32(&intr->ctrl);
54 val &= ~(1 << (10 - (irq - MPC52xx_IRQ1)));
55 out_be32(&intr->ctrl, val);
56 }
57 else if (irq < MPC52xx_SDMA_IRQ_BASE) {
58 val = in_be32(&intr->main_mask);
59 val |= 1 << (16 - (irq - MPC52xx_MAIN_IRQ_BASE));
60 out_be32(&intr->main_mask, val);
61 }
62 else if (irq < MPC52xx_PERP_IRQ_BASE) {
63 val = in_be32(&sdma->IntMask);
64 val |= 1 << (irq - MPC52xx_SDMA_IRQ_BASE);
65 out_be32(&sdma->IntMask, val);
66 }
67 else {
68 val = in_be32(&intr->per_mask);
69 val |= 1 << (31 - (irq - MPC52xx_PERP_IRQ_BASE));
70 out_be32(&intr->per_mask, val);
71 }
72}
73
74static void
75mpc52xx_ic_enable(unsigned int irq)
76{
77 u32 val;
78
79 if (irq == MPC52xx_IRQ0) {
80 val = in_be32(&intr->ctrl);
81 val |= 1 << 11;
82 out_be32(&intr->ctrl, val);
83 }
84 else if (irq < MPC52xx_IRQ1) {
85 BUG();
86 }
87 else if (irq <= MPC52xx_IRQ3) {
88 val = in_be32(&intr->ctrl);
89 val |= 1 << (10 - (irq - MPC52xx_IRQ1));
90 out_be32(&intr->ctrl, val);
91 }
92 else if (irq < MPC52xx_SDMA_IRQ_BASE) {
93 val = in_be32(&intr->main_mask);
94 val &= ~(1 << (16 - (irq - MPC52xx_MAIN_IRQ_BASE)));
95 out_be32(&intr->main_mask, val);
96 }
97 else if (irq < MPC52xx_PERP_IRQ_BASE) {
98 val = in_be32(&sdma->IntMask);
99 val &= ~(1 << (irq - MPC52xx_SDMA_IRQ_BASE));
100 out_be32(&sdma->IntMask, val);
101 }
102 else {
103 val = in_be32(&intr->per_mask);
104 val &= ~(1 << (31 - (irq - MPC52xx_PERP_IRQ_BASE)));
105 out_be32(&intr->per_mask, val);
106 }
107}
108
109static void
110mpc52xx_ic_ack(unsigned int irq)
111{
112 u32 val;
113
114 /*
115 * Only some irqs are reset here, others in interrupting hardware.
116 */
117
118 switch (irq) {
119 case MPC52xx_IRQ0:
120 val = in_be32(&intr->ctrl);
121 val |= 0x08000000;
122 out_be32(&intr->ctrl, val);
123 break;
124 case MPC52xx_CCS_IRQ:
125 val = in_be32(&intr->enc_status);
126 val |= 0x00000400;
127 out_be32(&intr->enc_status, val);
128 break;
129 case MPC52xx_IRQ1:
130 val = in_be32(&intr->ctrl);
131 val |= 0x04000000;
132 out_be32(&intr->ctrl, val);
133 break;
134 case MPC52xx_IRQ2:
135 val = in_be32(&intr->ctrl);
136 val |= 0x02000000;
137 out_be32(&intr->ctrl, val);
138 break;
139 case MPC52xx_IRQ3:
140 val = in_be32(&intr->ctrl);
141 val |= 0x01000000;
142 out_be32(&intr->ctrl, val);
143 break;
144 default:
145 if (irq >= MPC52xx_SDMA_IRQ_BASE
146 && irq < (MPC52xx_SDMA_IRQ_BASE + MPC52xx_SDMA_IRQ_NUM)) {
147 out_be32(&sdma->IntPend,
148 1 << (irq - MPC52xx_SDMA_IRQ_BASE));
149 }
150 break;
151 }
152}
153
154static void
155mpc52xx_ic_disable_and_ack(unsigned int irq)
156{
157 mpc52xx_ic_disable(irq);
158 mpc52xx_ic_ack(irq);
159}
160
161static void
162mpc52xx_ic_end(unsigned int irq)
163{
164 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
165 mpc52xx_ic_enable(irq);
166}
167
168static struct hw_interrupt_type mpc52xx_ic = {
169 .typename = " MPC52xx ",
170 .enable = mpc52xx_ic_enable,
171 .disable = mpc52xx_ic_disable,
172 .ack = mpc52xx_ic_disable_and_ack,
173 .end = mpc52xx_ic_end,
174};
175
176void __init
177mpc52xx_init_irq(void)
178{
179 int i;
180 u32 intr_ctrl;
181
182 /* Remap the necessary zones */
183 intr = ioremap(MPC52xx_PA(MPC52xx_INTR_OFFSET), MPC52xx_INTR_SIZE);
184 sdma = ioremap(MPC52xx_PA(MPC52xx_SDMA_OFFSET), MPC52xx_SDMA_SIZE);
185
186 if ((intr==NULL) || (sdma==NULL))
187 panic("Can't ioremap PIC/SDMA register for init_irq !");
188
189 /* Disable all interrupt sources. */
190 out_be32(&sdma->IntPend, 0xffffffff); /* 1 means clear pending */
191 out_be32(&sdma->IntMask, 0xffffffff); /* 1 means disabled */
192 out_be32(&intr->per_mask, 0x7ffffc00); /* 1 means disabled */
193 out_be32(&intr->main_mask, 0x00010fff); /* 1 means disabled */
194 intr_ctrl = in_be32(&intr->ctrl);
195 intr_ctrl &= 0x00ff0000; /* Keeps IRQ[0-3] config */
196 intr_ctrl |= 0x0f000000 | /* clear IRQ 0-3 */
197 0x00001000 | /* MEE master external enable */
198 0x00000000 | /* 0 means disable IRQ 0-3 */
199 0x00000001; /* CEb route critical normally */
200 out_be32(&intr->ctrl, intr_ctrl);
201
202 /* Zero a bunch of the priority settings. */
203 out_be32(&intr->per_pri1, 0);
204 out_be32(&intr->per_pri2, 0);
205 out_be32(&intr->per_pri3, 0);
206 out_be32(&intr->main_pri1, 0);
207 out_be32(&intr->main_pri2, 0);
208
209 /* Initialize irq_desc[i].handler's with mpc52xx_ic. */
210 for (i = 0; i < NR_IRQS; i++) {
211 irq_desc[i].handler = &mpc52xx_ic;
212 irq_desc[i].status = IRQ_LEVEL;
213 }
214
215 #define IRQn_MODE(intr_ctrl,irq) (((intr_ctrl) >> (22-(i<<1))) & 0x03)
216 for (i=0 ; i<4 ; i++) {
217 int mode;
218 mode = IRQn_MODE(intr_ctrl,i);
219 if ((mode == 0x1) || (mode == 0x2))
220 irq_desc[i?MPC52xx_IRQ1+i-1:MPC52xx_IRQ0].status = 0;
221 }
222}
223
224int
225mpc52xx_get_irq(struct pt_regs *regs)
226{
227 u32 status;
228 int irq = -1;
229
230 status = in_be32(&intr->enc_status);
231
232 if (status & 0x00000400) { /* critical */
233 irq = (status >> 8) & 0x3;
234 if (irq == 2) /* high priority peripheral */
235 goto peripheral;
236 irq += MPC52xx_CRIT_IRQ_BASE;
237 }
238 else if (status & 0x00200000) { /* main */
239 irq = (status >> 16) & 0x1f;
240 if (irq == 4) /* low priority peripheral */
241 goto peripheral;
242 irq += MPC52xx_MAIN_IRQ_BASE;
243 }
244 else if (status & 0x20000000) { /* peripheral */
245peripheral:
246 irq = (status >> 24) & 0x1f;
247 if (irq == 0) { /* bestcomm */
248 status = in_be32(&sdma->IntPend);
249 irq = ffs(status) + MPC52xx_SDMA_IRQ_BASE-1;
250 }
251 else
252 irq += MPC52xx_PERP_IRQ_BASE;
253 }
254
255 return irq;
256}
257
diff --git a/arch/ppc/syslib/mpc52xx_setup.c b/arch/ppc/syslib/mpc52xx_setup.c
new file mode 100644
index 000000000000..bb2374585a7b
--- /dev/null
+++ b/arch/ppc/syslib/mpc52xx_setup.c
@@ -0,0 +1,230 @@
1/*
2 * arch/ppc/syslib/mpc52xx_setup.c
3 *
4 * Common code for the boards based on Freescale MPC52xx embedded CPU.
5 *
6 *
7 * Maintainer : Sylvain Munaut <tnt@246tNt.com>
8 *
9 * Support for other bootloaders than UBoot by Dale Farnsworth
10 * <dfarnsworth@mvista.com>
11 *
12 * Copyright (C) 2004 Sylvain Munaut <tnt@246tNt.com>
13 * Copyright (C) 2003 Montavista Software, Inc
14 *
15 * This file is licensed under the terms of the GNU General Public License
16 * version 2. This program is licensed "as is" without any warranty of any
17 * kind, whether express or implied.
18 */
19
20#include <linux/config.h>
21
22#include <asm/io.h>
23#include <asm/time.h>
24#include <asm/mpc52xx.h>
25#include <asm/mpc52xx_psc.h>
26#include <asm/pgtable.h>
27#include <asm/ppcboot.h>
28
29extern bd_t __res;
30
31static int core_mult[] = { /* CPU Frequency multiplier, taken */
32 0, 0, 0, 10, 20, 20, 25, 45, /* from the datasheet used to compute */
33 30, 55, 40, 50, 0, 60, 35, 0, /* CPU frequency from XLB freq and */
34 30, 25, 65, 10, 70, 20, 75, 45, /* external jumper config */
35 0, 55, 40, 50, 80, 60, 35, 0
36};
37
38void
39mpc52xx_restart(char *cmd)
40{
41 struct mpc52xx_gpt __iomem *gpt0 = MPC52xx_VA(MPC52xx_GPTx_OFFSET(0));
42
43 local_irq_disable();
44
45 /* Turn on the watchdog and wait for it to expire. It effectively
46 does a reset */
47 out_be32(&gpt0->count, 0x000000ff);
48 out_be32(&gpt0->mode, 0x00009004);
49
50 while (1);
51}
52
53void
54mpc52xx_halt(void)
55{
56 local_irq_disable();
57
58 while (1);
59}
60
61void
62mpc52xx_power_off(void)
63{
64 /* By default we don't have any way of shut down.
65 If a specific board wants to, it can set the power down
66 code to any hardware implementation dependent code */
67 mpc52xx_halt();
68}
69
70
71void __init
72mpc52xx_set_bat(void)
73{
74 /* Set BAT 2 to map the 0xf0000000 area */
75 /* This mapping is used during mpc52xx_progress,
76 * mpc52xx_find_end_of_memory, and UARTs/GPIO access for debug
77 */
78 mb();
79 mtspr(SPRN_DBAT2U, 0xf0001ffe);
80 mtspr(SPRN_DBAT2L, 0xf000002a);
81 mb();
82}
83
84void __init
85mpc52xx_map_io(void)
86{
87 /* Here we only map the MBAR */
88 io_block_mapping(
89 MPC52xx_MBAR_VIRT, MPC52xx_MBAR, MPC52xx_MBAR_SIZE, _PAGE_IO);
90}
91
92
93#ifdef CONFIG_SERIAL_TEXT_DEBUG
94#ifndef MPC52xx_PF_CONSOLE_PORT
95#error "mpc52xx PSC for console not selected"
96#endif
97
98static void
99mpc52xx_psc_putc(struct mpc52xx_psc __iomem *psc, unsigned char c)
100{
101 while (!(in_be16(&psc->mpc52xx_psc_status) &
102 MPC52xx_PSC_SR_TXRDY));
103 out_8(&psc->mpc52xx_psc_buffer_8, c);
104}
105
106void
107mpc52xx_progress(char *s, unsigned short hex)
108{
109 char c;
110 struct mpc52xx_psc __iomem *psc;
111
112 psc = MPC52xx_VA(MPC52xx_PSCx_OFFSET(MPC52xx_PF_CONSOLE_PORT));
113
114 while ((c = *s++) != 0) {
115 if (c == '\n')
116 mpc52xx_psc_putc(psc, '\r');
117 mpc52xx_psc_putc(psc, c);
118 }
119
120 mpc52xx_psc_putc(psc, '\r');
121 mpc52xx_psc_putc(psc, '\n');
122}
123
124#endif /* CONFIG_SERIAL_TEXT_DEBUG */
125
126
127unsigned long __init
128mpc52xx_find_end_of_memory(void)
129{
130 u32 ramsize = __res.bi_memsize;
131
132 /*
133 * if bootloader passed a memsize, just use it
134 * else get size from sdram config registers
135 */
136 if (ramsize == 0) {
137 struct mpc52xx_mmap_ctl __iomem *mmap_ctl;
138 u32 sdram_config_0, sdram_config_1;
139
140 /* Temp BAT2 mapping active when this is called ! */
141 mmap_ctl = MPC52xx_VA(MPC52xx_MMAP_CTL_OFFSET);
142
143 sdram_config_0 = in_be32(&mmap_ctl->sdram0);
144 sdram_config_1 = in_be32(&mmap_ctl->sdram1);
145
146 if ((sdram_config_0 & 0x1f) >= 0x13)
147 ramsize = 1 << ((sdram_config_0 & 0xf) + 17);
148
149 if (((sdram_config_1 & 0x1f) >= 0x13) &&
150 ((sdram_config_1 & 0xfff00000) == ramsize))
151 ramsize += 1 << ((sdram_config_1 & 0xf) + 17);
152 }
153
154 return ramsize;
155}
156
157void __init
158mpc52xx_calibrate_decr(void)
159{
160 int current_time, previous_time;
161 int tbl_start, tbl_end;
162 unsigned int xlbfreq, cpufreq, ipbfreq, pcifreq, divisor;
163
164 xlbfreq = __res.bi_busfreq;
165 /* if bootloader didn't pass bus frequencies, calculate them */
166 if (xlbfreq == 0) {
167 /* Get RTC & Clock manager modules */
168 struct mpc52xx_rtc __iomem *rtc;
169 struct mpc52xx_cdm __iomem *cdm;
170
171 rtc = ioremap(MPC52xx_PA(MPC52xx_RTC_OFFSET), MPC52xx_RTC_SIZE);
172 cdm = ioremap(MPC52xx_PA(MPC52xx_CDM_OFFSET), MPC52xx_CDM_SIZE);
173
174 if ((rtc==NULL) || (cdm==NULL))
175 panic("Can't ioremap RTC/CDM while computing bus freq");
176
177 /* Count bus clock during 1/64 sec */
178 out_be32(&rtc->dividers, 0x8f1f0000); /* Set RTC 64x faster */
179 previous_time = in_be32(&rtc->time);
180 while ((current_time = in_be32(&rtc->time)) == previous_time) ;
181 tbl_start = get_tbl();
182 previous_time = current_time;
183 while ((current_time = in_be32(&rtc->time)) == previous_time) ;
184 tbl_end = get_tbl();
185 out_be32(&rtc->dividers, 0xffff0000); /* Restore RTC */
186
187 /* Compute all frequency from that & CDM settings */
188 xlbfreq = (tbl_end - tbl_start) << 8;
189 cpufreq = (xlbfreq * core_mult[in_be32(&cdm->rstcfg)&0x1f])/10;
190 ipbfreq = (in_8(&cdm->ipb_clk_sel) & 1) ?
191 xlbfreq / 2 : xlbfreq;
192 switch (in_8(&cdm->pci_clk_sel) & 3) {
193 case 0:
194 pcifreq = ipbfreq;
195 break;
196 case 1:
197 pcifreq = ipbfreq / 2;
198 break;
199 default:
200 pcifreq = xlbfreq / 4;
201 break;
202 }
203 __res.bi_busfreq = xlbfreq;
204 __res.bi_intfreq = cpufreq;
205 __res.bi_ipbfreq = ipbfreq;
206 __res.bi_pcifreq = pcifreq;
207
208 /* Release mapping */
209 iounmap(rtc);
210 iounmap(cdm);
211 }
212
213 divisor = 4;
214
215 tb_ticks_per_jiffy = xlbfreq / HZ / divisor;
216 tb_to_us = mulhwu_scale_factor(xlbfreq / divisor, 1000000);
217}
218
219int mpc52xx_match_psc_function(int psc_idx, const char *func)
220{
221 struct mpc52xx_psc_func *cf = mpc52xx_psc_functions;
222
223 while ((cf->id != -1) && (cf->func != NULL)) {
224 if ((cf->id == psc_idx) && !strcmp(cf->func,func))
225 return 1;
226 cf++;
227 }
228
229 return 0;
230}
diff --git a/arch/ppc/syslib/mpc52xx_sys.c b/arch/ppc/syslib/mpc52xx_sys.c
new file mode 100644
index 000000000000..9a0f90aa8aac
--- /dev/null
+++ b/arch/ppc/syslib/mpc52xx_sys.c
@@ -0,0 +1,38 @@
1/*
2 * arch/ppc/syslib/mpc52xx_sys.c
3 *
4 * Freescale MPC52xx system descriptions
5 *
6 *
7 * Maintainer : Sylvain Munaut <tnt@246tNt.com>
8 *
9 * Copyright (C) 2005 Sylvain Munaut <tnt@246tNt.com>
10 *
11 * This file is licensed under the terms of the GNU General Public License
12 * version 2. This program is licensed "as is" without any warranty of any
13 * kind, whether express or implied.
14 */
15
16#include <asm/ppc_sys.h>
17
18struct ppc_sys_spec *cur_ppc_sys_spec;
19struct ppc_sys_spec ppc_sys_specs[] = {
20 {
21 .ppc_sys_name = "5200",
22 .mask = 0xffff0000,
23 .value = 0x80110000,
24 .num_devices = 15,
25 .device_list = (enum ppc_sys_devices[])
26 {
27 MPC52xx_MSCAN1, MPC52xx_MSCAN2, MPC52xx_SPI,
28 MPC52xx_USB, MPC52xx_BDLC, MPC52xx_PSC1, MPC52xx_PSC2,
29 MPC52xx_PSC3, MPC52xx_PSC4, MPC52xx_PSC5, MPC52xx_PSC6,
30 MPC52xx_FEC, MPC52xx_ATA, MPC52xx_I2C1, MPC52xx_I2C2,
31 },
32 },
33 { /* default match */
34 .ppc_sys_name = "",
35 .mask = 0x00000000,
36 .value = 0x00000000,
37 },
38};
diff --git a/arch/ppc/syslib/mpc83xx_devices.c b/arch/ppc/syslib/mpc83xx_devices.c
new file mode 100644
index 000000000000..5c1a919eaabf
--- /dev/null
+++ b/arch/ppc/syslib/mpc83xx_devices.c
@@ -0,0 +1,237 @@
1/*
2 * arch/ppc/platforms/83xx/mpc83xx_devices.c
3 *
4 * MPC83xx Device descriptions
5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com>
7 *
8 * Copyright 2005 Freescale Semiconductor Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15
16#include <linux/init.h>
17#include <linux/module.h>
18#include <linux/device.h>
19#include <linux/serial_8250.h>
20#include <linux/fsl_devices.h>
21#include <asm/mpc83xx.h>
22#include <asm/irq.h>
23#include <asm/ppc_sys.h>
24
25/* We use offsets for IORESOURCE_MEM since we do not know at compile time
26 * what IMMRBAR is, will get fixed up by mach_mpc83xx_fixup
27 */
28
29static struct gianfar_platform_data mpc83xx_tsec1_pdata = {
30 .device_flags = FSL_GIANFAR_DEV_HAS_GIGABIT |
31 FSL_GIANFAR_DEV_HAS_COALESCE | FSL_GIANFAR_DEV_HAS_RMON |
32 FSL_GIANFAR_DEV_HAS_MULTI_INTR,
33 .phy_reg_addr = 0x24000,
34};
35
36static struct gianfar_platform_data mpc83xx_tsec2_pdata = {
37 .device_flags = FSL_GIANFAR_DEV_HAS_GIGABIT |
38 FSL_GIANFAR_DEV_HAS_COALESCE | FSL_GIANFAR_DEV_HAS_RMON |
39 FSL_GIANFAR_DEV_HAS_MULTI_INTR,
40 .phy_reg_addr = 0x24000,
41};
42
43static struct fsl_i2c_platform_data mpc83xx_fsl_i2c1_pdata = {
44 .device_flags = FSL_I2C_DEV_SEPARATE_DFSRR,
45};
46
47static struct fsl_i2c_platform_data mpc83xx_fsl_i2c2_pdata = {
48 .device_flags = FSL_I2C_DEV_SEPARATE_DFSRR,
49};
50
51static struct plat_serial8250_port serial_platform_data[] = {
52 [0] = {
53 .mapbase = 0x4500,
54 .irq = MPC83xx_IRQ_UART1,
55 .iotype = UPIO_MEM,
56 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
57 },
58 [1] = {
59 .mapbase = 0x4600,
60 .irq = MPC83xx_IRQ_UART2,
61 .iotype = UPIO_MEM,
62 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
63 },
64};
65
66struct platform_device ppc_sys_platform_devices[] = {
67 [MPC83xx_TSEC1] = {
68 .name = "fsl-gianfar",
69 .id = 1,
70 .dev.platform_data = &mpc83xx_tsec1_pdata,
71 .num_resources = 4,
72 .resource = (struct resource[]) {
73 {
74 .start = 0x24000,
75 .end = 0x24fff,
76 .flags = IORESOURCE_MEM,
77 },
78 {
79 .name = "tx",
80 .start = MPC83xx_IRQ_TSEC1_TX,
81 .end = MPC83xx_IRQ_TSEC1_TX,
82 .flags = IORESOURCE_IRQ,
83 },
84 {
85 .name = "rx",
86 .start = MPC83xx_IRQ_TSEC1_RX,
87 .end = MPC83xx_IRQ_TSEC1_RX,
88 .flags = IORESOURCE_IRQ,
89 },
90 {
91 .name = "error",
92 .start = MPC83xx_IRQ_TSEC1_ERROR,
93 .end = MPC83xx_IRQ_TSEC1_ERROR,
94 .flags = IORESOURCE_IRQ,
95 },
96 },
97 },
98 [MPC83xx_TSEC2] = {
99 .name = "fsl-gianfar",
100 .id = 2,
101 .dev.platform_data = &mpc83xx_tsec2_pdata,
102 .num_resources = 4,
103 .resource = (struct resource[]) {
104 {
105 .start = 0x25000,
106 .end = 0x25fff,
107 .flags = IORESOURCE_MEM,
108 },
109 {
110 .name = "tx",
111 .start = MPC83xx_IRQ_TSEC2_TX,
112 .end = MPC83xx_IRQ_TSEC2_TX,
113 .flags = IORESOURCE_IRQ,
114 },
115 {
116 .name = "rx",
117 .start = MPC83xx_IRQ_TSEC2_RX,
118 .end = MPC83xx_IRQ_TSEC2_RX,
119 .flags = IORESOURCE_IRQ,
120 },
121 {
122 .name = "error",
123 .start = MPC83xx_IRQ_TSEC2_ERROR,
124 .end = MPC83xx_IRQ_TSEC2_ERROR,
125 .flags = IORESOURCE_IRQ,
126 },
127 },
128 },
129 [MPC83xx_IIC1] = {
130 .name = "fsl-i2c",
131 .id = 1,
132 .dev.platform_data = &mpc83xx_fsl_i2c1_pdata,
133 .num_resources = 2,
134 .resource = (struct resource[]) {
135 {
136 .start = 0x3000,
137 .end = 0x30ff,
138 .flags = IORESOURCE_MEM,
139 },
140 {
141 .start = MPC83xx_IRQ_IIC1,
142 .end = MPC83xx_IRQ_IIC1,
143 .flags = IORESOURCE_IRQ,
144 },
145 },
146 },
147 [MPC83xx_IIC2] = {
148 .name = "fsl-i2c",
149 .id = 2,
150 .dev.platform_data = &mpc83xx_fsl_i2c2_pdata,
151 .num_resources = 2,
152 .resource = (struct resource[]) {
153 {
154 .start = 0x3100,
155 .end = 0x31ff,
156 .flags = IORESOURCE_MEM,
157 },
158 {
159 .start = MPC83xx_IRQ_IIC2,
160 .end = MPC83xx_IRQ_IIC2,
161 .flags = IORESOURCE_IRQ,
162 },
163 },
164 },
165 [MPC83xx_DUART] = {
166 .name = "serial8250",
167 .id = 0,
168 .dev.platform_data = serial_platform_data,
169 },
170 [MPC83xx_SEC2] = {
171 .name = "fsl-sec2",
172 .id = 1,
173 .num_resources = 2,
174 .resource = (struct resource[]) {
175 {
176 .start = 0x30000,
177 .end = 0x3ffff,
178 .flags = IORESOURCE_MEM,
179 },
180 {
181 .start = MPC83xx_IRQ_SEC2,
182 .end = MPC83xx_IRQ_SEC2,
183 .flags = IORESOURCE_IRQ,
184 },
185 },
186 },
187 [MPC83xx_USB2_DR] = {
188 .name = "fsl-usb2-dr",
189 .id = 1,
190 .num_resources = 2,
191 .resource = (struct resource[]) {
192 {
193 .start = 0x22000,
194 .end = 0x22fff,
195 .flags = IORESOURCE_MEM,
196 },
197 {
198 .start = MPC83xx_IRQ_USB2_DR,
199 .end = MPC83xx_IRQ_USB2_DR,
200 .flags = IORESOURCE_IRQ,
201 },
202 },
203 },
204 [MPC83xx_USB2_MPH] = {
205 .name = "fsl-usb2-mph",
206 .id = 1,
207 .num_resources = 2,
208 .resource = (struct resource[]) {
209 {
210 .start = 0x23000,
211 .end = 0x23fff,
212 .flags = IORESOURCE_MEM,
213 },
214 {
215 .start = MPC83xx_IRQ_USB2_MPH,
216 .end = MPC83xx_IRQ_USB2_MPH,
217 .flags = IORESOURCE_IRQ,
218 },
219 },
220 },
221};
222
223static int __init mach_mpc83xx_fixup(struct platform_device *pdev)
224{
225 ppc_sys_fixup_mem_resource(pdev, immrbar);
226 return 0;
227}
228
229static int __init mach_mpc83xx_init(void)
230{
231 if (ppc_md.progress)
232 ppc_md.progress("mach_mpc83xx_init:enter", 0);
233 ppc_sys_device_fixup = mach_mpc83xx_fixup;
234 return 0;
235}
236
237postcore_initcall(mach_mpc83xx_init);
diff --git a/arch/ppc/syslib/mpc83xx_sys.c b/arch/ppc/syslib/mpc83xx_sys.c
new file mode 100644
index 000000000000..29aa63350025
--- /dev/null
+++ b/arch/ppc/syslib/mpc83xx_sys.c
@@ -0,0 +1,100 @@
1/*
2 * arch/ppc/platforms/83xx/mpc83xx_sys.c
3 *
4 * MPC83xx System descriptions
5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com>
7 *
8 * Copyright 2005 Freescale Semiconductor Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15
16#include <linux/init.h>
17#include <linux/module.h>
18#include <linux/device.h>
19#include <asm/ppc_sys.h>
20
21struct ppc_sys_spec *cur_ppc_sys_spec;
22struct ppc_sys_spec ppc_sys_specs[] = {
23 {
24 .ppc_sys_name = "8349E",
25 .mask = 0xFFFF0000,
26 .value = 0x80500000,
27 .num_devices = 8,
28 .device_list = (enum ppc_sys_devices[])
29 {
30 MPC83xx_TSEC1, MPC83xx_TSEC2, MPC83xx_IIC1,
31 MPC83xx_IIC2, MPC83xx_DUART, MPC83xx_SEC2,
32 MPC83xx_USB2_DR, MPC83xx_USB2_MPH
33 },
34 },
35 {
36 .ppc_sys_name = "8349",
37 .mask = 0xFFFF0000,
38 .value = 0x80510000,
39 .num_devices = 7,
40 .device_list = (enum ppc_sys_devices[])
41 {
42 MPC83xx_TSEC1, MPC83xx_TSEC2, MPC83xx_IIC1,
43 MPC83xx_IIC2, MPC83xx_DUART,
44 MPC83xx_USB2_DR, MPC83xx_USB2_MPH
45 },
46 },
47 {
48 .ppc_sys_name = "8347E",
49 .mask = 0xFFFF0000,
50 .value = 0x80520000,
51 .num_devices = 8,
52 .device_list = (enum ppc_sys_devices[])
53 {
54 MPC83xx_TSEC1, MPC83xx_TSEC2, MPC83xx_IIC1,
55 MPC83xx_IIC2, MPC83xx_DUART, MPC83xx_SEC2,
56 MPC83xx_USB2_DR, MPC83xx_USB2_MPH
57 },
58 },
59 {
60 .ppc_sys_name = "8347",
61 .mask = 0xFFFF0000,
62 .value = 0x80530000,
63 .num_devices = 7,
64 .device_list = (enum ppc_sys_devices[])
65 {
66 MPC83xx_TSEC1, MPC83xx_TSEC2, MPC83xx_IIC1,
67 MPC83xx_IIC2, MPC83xx_DUART,
68 MPC83xx_USB2_DR, MPC83xx_USB2_MPH
69 },
70 },
71 {
72 .ppc_sys_name = "8343E",
73 .mask = 0xFFFF0000,
74 .value = 0x80540000,
75 .num_devices = 7,
76 .device_list = (enum ppc_sys_devices[])
77 {
78 MPC83xx_TSEC1, MPC83xx_TSEC2, MPC83xx_IIC1,
79 MPC83xx_IIC2, MPC83xx_DUART, MPC83xx_SEC2,
80 MPC83xx_USB2_DR,
81 },
82 },
83 {
84 .ppc_sys_name = "8343",
85 .mask = 0xFFFF0000,
86 .value = 0x80550000,
87 .num_devices = 6,
88 .device_list = (enum ppc_sys_devices[])
89 {
90 MPC83xx_TSEC1, MPC83xx_TSEC2, MPC83xx_IIC1,
91 MPC83xx_IIC2, MPC83xx_DUART,
92 MPC83xx_USB2_DR,
93 },
94 },
95 { /* default match */
96 .ppc_sys_name = "",
97 .mask = 0x00000000,
98 .value = 0x00000000,
99 },
100};
diff --git a/arch/ppc/syslib/mpc85xx_devices.c b/arch/ppc/syslib/mpc85xx_devices.c
new file mode 100644
index 000000000000..a231795ee26f
--- /dev/null
+++ b/arch/ppc/syslib/mpc85xx_devices.c
@@ -0,0 +1,552 @@
1/*
2 * arch/ppc/platforms/85xx/mpc85xx_devices.c
3 *
4 * MPC85xx Device descriptions
5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com>
7 *
8 * Copyright 2005 Freescale Semiconductor Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15
16#include <linux/init.h>
17#include <linux/module.h>
18#include <linux/device.h>
19#include <linux/serial_8250.h>
20#include <linux/fsl_devices.h>
21#include <asm/mpc85xx.h>
22#include <asm/irq.h>
23#include <asm/ppc_sys.h>
24
25/* We use offsets for IORESOURCE_MEM since we do not know at compile time
26 * what CCSRBAR is, will get fixed up by mach_mpc85xx_fixup
27 */
28
29static struct gianfar_platform_data mpc85xx_tsec1_pdata = {
30 .device_flags = FSL_GIANFAR_DEV_HAS_GIGABIT |
31 FSL_GIANFAR_DEV_HAS_COALESCE | FSL_GIANFAR_DEV_HAS_RMON |
32 FSL_GIANFAR_DEV_HAS_MULTI_INTR,
33 .phy_reg_addr = MPC85xx_ENET1_OFFSET,
34};
35
36static struct gianfar_platform_data mpc85xx_tsec2_pdata = {
37 .device_flags = FSL_GIANFAR_DEV_HAS_GIGABIT |
38 FSL_GIANFAR_DEV_HAS_COALESCE | FSL_GIANFAR_DEV_HAS_RMON |
39 FSL_GIANFAR_DEV_HAS_MULTI_INTR,
40 .phy_reg_addr = MPC85xx_ENET1_OFFSET,
41};
42
43static struct gianfar_platform_data mpc85xx_fec_pdata = {
44 .phy_reg_addr = MPC85xx_ENET1_OFFSET,
45};
46
47static struct fsl_i2c_platform_data mpc85xx_fsl_i2c_pdata = {
48 .device_flags = FSL_I2C_DEV_SEPARATE_DFSRR,
49};
50
51static struct plat_serial8250_port serial_platform_data[] = {
52 [0] = {
53 .mapbase = 0x4500,
54 .irq = MPC85xx_IRQ_DUART,
55 .iotype = UPIO_MEM,
56 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_SHARE_IRQ,
57 },
58 [1] = {
59 .mapbase = 0x4600,
60 .irq = MPC85xx_IRQ_DUART,
61 .iotype = UPIO_MEM,
62 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_SHARE_IRQ,
63 },
64};
65
66struct platform_device ppc_sys_platform_devices[] = {
67 [MPC85xx_TSEC1] = {
68 .name = "fsl-gianfar",
69 .id = 1,
70 .dev.platform_data = &mpc85xx_tsec1_pdata,
71 .num_resources = 4,
72 .resource = (struct resource[]) {
73 {
74 .start = MPC85xx_ENET1_OFFSET,
75 .end = MPC85xx_ENET1_OFFSET +
76 MPC85xx_ENET1_SIZE - 1,
77 .flags = IORESOURCE_MEM,
78 },
79 {
80 .name = "tx",
81 .start = MPC85xx_IRQ_TSEC1_TX,
82 .end = MPC85xx_IRQ_TSEC1_TX,
83 .flags = IORESOURCE_IRQ,
84 },
85 {
86 .name = "rx",
87 .start = MPC85xx_IRQ_TSEC1_RX,
88 .end = MPC85xx_IRQ_TSEC1_RX,
89 .flags = IORESOURCE_IRQ,
90 },
91 {
92 .name = "error",
93 .start = MPC85xx_IRQ_TSEC1_ERROR,
94 .end = MPC85xx_IRQ_TSEC1_ERROR,
95 .flags = IORESOURCE_IRQ,
96 },
97 },
98 },
99 [MPC85xx_TSEC2] = {
100 .name = "fsl-gianfar",
101 .id = 2,
102 .dev.platform_data = &mpc85xx_tsec2_pdata,
103 .num_resources = 4,
104 .resource = (struct resource[]) {
105 {
106 .start = MPC85xx_ENET2_OFFSET,
107 .end = MPC85xx_ENET2_OFFSET +
108 MPC85xx_ENET2_SIZE - 1,
109 .flags = IORESOURCE_MEM,
110 },
111 {
112 .name = "tx",
113 .start = MPC85xx_IRQ_TSEC2_TX,
114 .end = MPC85xx_IRQ_TSEC2_TX,
115 .flags = IORESOURCE_IRQ,
116 },
117 {
118 .name = "rx",
119 .start = MPC85xx_IRQ_TSEC2_RX,
120 .end = MPC85xx_IRQ_TSEC2_RX,
121 .flags = IORESOURCE_IRQ,
122 },
123 {
124 .name = "error",
125 .start = MPC85xx_IRQ_TSEC2_ERROR,
126 .end = MPC85xx_IRQ_TSEC2_ERROR,
127 .flags = IORESOURCE_IRQ,
128 },
129 },
130 },
131 [MPC85xx_FEC] = {
132 .name = "fsl-gianfar",
133 .id = 3,
134 .dev.platform_data = &mpc85xx_fec_pdata,
135 .num_resources = 2,
136 .resource = (struct resource[]) {
137 {
138 .start = MPC85xx_ENET3_OFFSET,
139 .end = MPC85xx_ENET3_OFFSET +
140 MPC85xx_ENET3_SIZE - 1,
141 .flags = IORESOURCE_MEM,
142
143 },
144 {
145 .start = MPC85xx_IRQ_FEC,
146 .end = MPC85xx_IRQ_FEC,
147 .flags = IORESOURCE_IRQ,
148 },
149 },
150 },
151 [MPC85xx_IIC1] = {
152 .name = "fsl-i2c",
153 .id = 1,
154 .dev.platform_data = &mpc85xx_fsl_i2c_pdata,
155 .num_resources = 2,
156 .resource = (struct resource[]) {
157 {
158 .start = MPC85xx_IIC1_OFFSET,
159 .end = MPC85xx_IIC1_OFFSET +
160 MPC85xx_IIC1_SIZE - 1,
161 .flags = IORESOURCE_MEM,
162 },
163 {
164 .start = MPC85xx_IRQ_IIC1,
165 .end = MPC85xx_IRQ_IIC1,
166 .flags = IORESOURCE_IRQ,
167 },
168 },
169 },
170 [MPC85xx_DMA0] = {
171 .name = "fsl-dma",
172 .id = 0,
173 .num_resources = 2,
174 .resource = (struct resource[]) {
175 {
176 .start = MPC85xx_DMA0_OFFSET,
177 .end = MPC85xx_DMA0_OFFSET +
178 MPC85xx_DMA0_SIZE - 1,
179 .flags = IORESOURCE_MEM,
180 },
181 {
182 .start = MPC85xx_IRQ_DMA0,
183 .end = MPC85xx_IRQ_DMA0,
184 .flags = IORESOURCE_IRQ,
185 },
186 },
187 },
188 [MPC85xx_DMA1] = {
189 .name = "fsl-dma",
190 .id = 1,
191 .num_resources = 2,
192 .resource = (struct resource[]) {
193 {
194 .start = MPC85xx_DMA1_OFFSET,
195 .end = MPC85xx_DMA1_OFFSET +
196 MPC85xx_DMA1_SIZE - 1,
197 .flags = IORESOURCE_MEM,
198 },
199 {
200 .start = MPC85xx_IRQ_DMA1,
201 .end = MPC85xx_IRQ_DMA1,
202 .flags = IORESOURCE_IRQ,
203 },
204 },
205 },
206 [MPC85xx_DMA2] = {
207 .name = "fsl-dma",
208 .id = 2,
209 .num_resources = 2,
210 .resource = (struct resource[]) {
211 {
212 .start = MPC85xx_DMA2_OFFSET,
213 .end = MPC85xx_DMA2_OFFSET +
214 MPC85xx_DMA2_SIZE - 1,
215 .flags = IORESOURCE_MEM,
216 },
217 {
218 .start = MPC85xx_IRQ_DMA2,
219 .end = MPC85xx_IRQ_DMA2,
220 .flags = IORESOURCE_IRQ,
221 },
222 },
223 },
224 [MPC85xx_DMA3] = {
225 .name = "fsl-dma",
226 .id = 3,
227 .num_resources = 2,
228 .resource = (struct resource[]) {
229 {
230 .start = MPC85xx_DMA3_OFFSET,
231 .end = MPC85xx_DMA3_OFFSET +
232 MPC85xx_DMA3_SIZE - 1,
233 .flags = IORESOURCE_MEM,
234 },
235 {
236 .start = MPC85xx_IRQ_DMA3,
237 .end = MPC85xx_IRQ_DMA3,
238 .flags = IORESOURCE_IRQ,
239 },
240 },
241 },
242 [MPC85xx_DUART] = {
243 .name = "serial8250",
244 .id = 0,
245 .dev.platform_data = serial_platform_data,
246 },
247 [MPC85xx_PERFMON] = {
248 .name = "fsl-perfmon",
249 .id = 1,
250 .num_resources = 2,
251 .resource = (struct resource[]) {
252 {
253 .start = MPC85xx_PERFMON_OFFSET,
254 .end = MPC85xx_PERFMON_OFFSET +
255 MPC85xx_PERFMON_SIZE - 1,
256 .flags = IORESOURCE_MEM,
257 },
258 {
259 .start = MPC85xx_IRQ_PERFMON,
260 .end = MPC85xx_IRQ_PERFMON,
261 .flags = IORESOURCE_IRQ,
262 },
263 },
264 },
265 [MPC85xx_SEC2] = {
266 .name = "fsl-sec2",
267 .id = 1,
268 .num_resources = 2,
269 .resource = (struct resource[]) {
270 {
271 .start = MPC85xx_SEC2_OFFSET,
272 .end = MPC85xx_SEC2_OFFSET +
273 MPC85xx_SEC2_SIZE - 1,
274 .flags = IORESOURCE_MEM,
275 },
276 {
277 .start = MPC85xx_IRQ_SEC2,
278 .end = MPC85xx_IRQ_SEC2,
279 .flags = IORESOURCE_IRQ,
280 },
281 },
282 },
283#ifdef CONFIG_CPM2
284 [MPC85xx_CPM_FCC1] = {
285 .name = "fsl-cpm-fcc",
286 .id = 1,
287 .num_resources = 3,
288 .resource = (struct resource[]) {
289 {
290 .start = 0x91300,
291 .end = 0x9131F,
292 .flags = IORESOURCE_MEM,
293 },
294 {
295 .start = 0x91380,
296 .end = 0x9139F,
297 .flags = IORESOURCE_MEM,
298 },
299 {
300 .start = SIU_INT_FCC1,
301 .end = SIU_INT_FCC1,
302 .flags = IORESOURCE_IRQ,
303 },
304 },
305 },
306 [MPC85xx_CPM_FCC2] = {
307 .name = "fsl-cpm-fcc",
308 .id = 2,
309 .num_resources = 3,
310 .resource = (struct resource[]) {
311 {
312 .start = 0x91320,
313 .end = 0x9133F,
314 .flags = IORESOURCE_MEM,
315 },
316 {
317 .start = 0x913A0,
318 .end = 0x913CF,
319 .flags = IORESOURCE_MEM,
320 },
321 {
322 .start = SIU_INT_FCC2,
323 .end = SIU_INT_FCC2,
324 .flags = IORESOURCE_IRQ,
325 },
326 },
327 },
328 [MPC85xx_CPM_FCC3] = {
329 .name = "fsl-cpm-fcc",
330 .id = 3,
331 .num_resources = 3,
332 .resource = (struct resource[]) {
333 {
334 .start = 0x91340,
335 .end = 0x9135F,
336 .flags = IORESOURCE_MEM,
337 },
338 {
339 .start = 0x913D0,
340 .end = 0x913FF,
341 .flags = IORESOURCE_MEM,
342 },
343 {
344 .start = SIU_INT_FCC3,
345 .end = SIU_INT_FCC3,
346 .flags = IORESOURCE_IRQ,
347 },
348 },
349 },
350 [MPC85xx_CPM_I2C] = {
351 .name = "fsl-cpm-i2c",
352 .id = 1,
353 .num_resources = 2,
354 .resource = (struct resource[]) {
355 {
356 .start = 0x91860,
357 .end = 0x918BF,
358 .flags = IORESOURCE_MEM,
359 },
360 {
361 .start = SIU_INT_I2C,
362 .end = SIU_INT_I2C,
363 .flags = IORESOURCE_IRQ,
364 },
365 },
366 },
367 [MPC85xx_CPM_SCC1] = {
368 .name = "fsl-cpm-scc",
369 .id = 1,
370 .num_resources = 2,
371 .resource = (struct resource[]) {
372 {
373 .start = 0x91A00,
374 .end = 0x91A1F,
375 .flags = IORESOURCE_MEM,
376 },
377 {
378 .start = SIU_INT_SCC1,
379 .end = SIU_INT_SCC1,
380 .flags = IORESOURCE_IRQ,
381 },
382 },
383 },
384 [MPC85xx_CPM_SCC2] = {
385 .name = "fsl-cpm-scc",
386 .id = 2,
387 .num_resources = 2,
388 .resource = (struct resource[]) {
389 {
390 .start = 0x91A20,
391 .end = 0x91A3F,
392 .flags = IORESOURCE_MEM,
393 },
394 {
395 .start = SIU_INT_SCC2,
396 .end = SIU_INT_SCC2,
397 .flags = IORESOURCE_IRQ,
398 },
399 },
400 },
401 [MPC85xx_CPM_SCC3] = {
402 .name = "fsl-cpm-scc",
403 .id = 3,
404 .num_resources = 2,
405 .resource = (struct resource[]) {
406 {
407 .start = 0x91A40,
408 .end = 0x91A5F,
409 .flags = IORESOURCE_MEM,
410 },
411 {
412 .start = SIU_INT_SCC3,
413 .end = SIU_INT_SCC3,
414 .flags = IORESOURCE_IRQ,
415 },
416 },
417 },
418 [MPC85xx_CPM_SCC4] = {
419 .name = "fsl-cpm-scc",
420 .id = 4,
421 .num_resources = 2,
422 .resource = (struct resource[]) {
423 {
424 .start = 0x91A60,
425 .end = 0x91A7F,
426 .flags = IORESOURCE_MEM,
427 },
428 {
429 .start = SIU_INT_SCC4,
430 .end = SIU_INT_SCC4,
431 .flags = IORESOURCE_IRQ,
432 },
433 },
434 },
435 [MPC85xx_CPM_SPI] = {
436 .name = "fsl-cpm-spi",
437 .id = 1,
438 .num_resources = 2,
439 .resource = (struct resource[]) {
440 {
441 .start = 0x91AA0,
442 .end = 0x91AFF,
443 .flags = IORESOURCE_MEM,
444 },
445 {
446 .start = SIU_INT_SPI,
447 .end = SIU_INT_SPI,
448 .flags = IORESOURCE_IRQ,
449 },
450 },
451 },
452 [MPC85xx_CPM_MCC1] = {
453 .name = "fsl-cpm-mcc",
454 .id = 1,
455 .num_resources = 2,
456 .resource = (struct resource[]) {
457 {
458 .start = 0x91B30,
459 .end = 0x91B3F,
460 .flags = IORESOURCE_MEM,
461 },
462 {
463 .start = SIU_INT_MCC1,
464 .end = SIU_INT_MCC1,
465 .flags = IORESOURCE_IRQ,
466 },
467 },
468 },
469 [MPC85xx_CPM_MCC2] = {
470 .name = "fsl-cpm-mcc",
471 .id = 2,
472 .num_resources = 2,
473 .resource = (struct resource[]) {
474 {
475 .start = 0x91B50,
476 .end = 0x91B5F,
477 .flags = IORESOURCE_MEM,
478 },
479 {
480 .start = SIU_INT_MCC2,
481 .end = SIU_INT_MCC2,
482 .flags = IORESOURCE_IRQ,
483 },
484 },
485 },
486 [MPC85xx_CPM_SMC1] = {
487 .name = "fsl-cpm-smc",
488 .id = 1,
489 .num_resources = 2,
490 .resource = (struct resource[]) {
491 {
492 .start = 0x91A80,
493 .end = 0x91A8F,
494 .flags = IORESOURCE_MEM,
495 },
496 {
497 .start = SIU_INT_SMC1,
498 .end = SIU_INT_SMC1,
499 .flags = IORESOURCE_IRQ,
500 },
501 },
502 },
503 [MPC85xx_CPM_SMC2] = {
504 .name = "fsl-cpm-smc",
505 .id = 2,
506 .num_resources = 2,
507 .resource = (struct resource[]) {
508 {
509 .start = 0x91A90,
510 .end = 0x91A9F,
511 .flags = IORESOURCE_MEM,
512 },
513 {
514 .start = SIU_INT_SMC2,
515 .end = SIU_INT_SMC2,
516 .flags = IORESOURCE_IRQ,
517 },
518 },
519 },
520 [MPC85xx_CPM_USB] = {
521 .name = "fsl-cpm-usb",
522 .id = 2,
523 .num_resources = 2,
524 .resource = (struct resource[]) {
525 {
526 .start = 0x91B60,
527 .end = 0x91B7F,
528 .flags = IORESOURCE_MEM,
529 },
530 {
531 .start = SIU_INT_USB,
532 .end = SIU_INT_USB,
533 .flags = IORESOURCE_IRQ,
534 },
535 },
536 },
537#endif /* CONFIG_CPM2 */
538};
539
540static int __init mach_mpc85xx_fixup(struct platform_device *pdev)
541{
542 ppc_sys_fixup_mem_resource(pdev, CCSRBAR);
543 return 0;
544}
545
546static int __init mach_mpc85xx_init(void)
547{
548 ppc_sys_device_fixup = mach_mpc85xx_fixup;
549 return 0;
550}
551
552postcore_initcall(mach_mpc85xx_init);
diff --git a/arch/ppc/syslib/mpc85xx_sys.c b/arch/ppc/syslib/mpc85xx_sys.c
new file mode 100644
index 000000000000..d806a92a9401
--- /dev/null
+++ b/arch/ppc/syslib/mpc85xx_sys.c
@@ -0,0 +1,118 @@
1/*
2 * arch/ppc/platforms/85xx/mpc85xx_sys.c
3 *
4 * MPC85xx System descriptions
5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com>
7 *
8 * Copyright 2005 Freescale Semiconductor Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15
16#include <linux/init.h>
17#include <linux/module.h>
18#include <linux/device.h>
19#include <asm/ppc_sys.h>
20
21struct ppc_sys_spec *cur_ppc_sys_spec;
22struct ppc_sys_spec ppc_sys_specs[] = {
23 {
24 .ppc_sys_name = "8540",
25 .mask = 0xFFFF0000,
26 .value = 0x80300000,
27 .num_devices = 10,
28 .device_list = (enum ppc_sys_devices[])
29 {
30 MPC85xx_TSEC1, MPC85xx_TSEC2, MPC85xx_FEC, MPC85xx_IIC1,
31 MPC85xx_DMA0, MPC85xx_DMA1, MPC85xx_DMA2, MPC85xx_DMA3,
32 MPC85xx_PERFMON, MPC85xx_DUART,
33 },
34 },
35 {
36 .ppc_sys_name = "8560",
37 .mask = 0xFFFF0000,
38 .value = 0x80700000,
39 .num_devices = 19,
40 .device_list = (enum ppc_sys_devices[])
41 {
42 MPC85xx_TSEC1, MPC85xx_TSEC2, MPC85xx_IIC1,
43 MPC85xx_DMA0, MPC85xx_DMA1, MPC85xx_DMA2, MPC85xx_DMA3,
44 MPC85xx_PERFMON,
45 MPC85xx_CPM_SPI, MPC85xx_CPM_I2C, MPC85xx_CPM_SCC1,
46 MPC85xx_CPM_SCC2, MPC85xx_CPM_SCC3, MPC85xx_CPM_SCC4,
47 MPC85xx_CPM_FCC1, MPC85xx_CPM_FCC2, MPC85xx_CPM_FCC3,
48 MPC85xx_CPM_MCC1, MPC85xx_CPM_MCC2,
49 },
50 },
51 {
52 .ppc_sys_name = "8541",
53 .mask = 0xFFFF0000,
54 .value = 0x80720000,
55 .num_devices = 13,
56 .device_list = (enum ppc_sys_devices[])
57 {
58 MPC85xx_TSEC1, MPC85xx_TSEC2, MPC85xx_IIC1,
59 MPC85xx_DMA0, MPC85xx_DMA1, MPC85xx_DMA2, MPC85xx_DMA3,
60 MPC85xx_PERFMON, MPC85xx_DUART,
61 MPC85xx_CPM_SPI, MPC85xx_CPM_I2C,
62 MPC85xx_CPM_FCC1, MPC85xx_CPM_FCC2,
63 },
64 },
65 {
66 .ppc_sys_name = "8541E",
67 .mask = 0xFFFF0000,
68 .value = 0x807A0000,
69 .num_devices = 14,
70 .device_list = (enum ppc_sys_devices[])
71 {
72 MPC85xx_TSEC1, MPC85xx_TSEC2, MPC85xx_IIC1,
73 MPC85xx_DMA0, MPC85xx_DMA1, MPC85xx_DMA2, MPC85xx_DMA3,
74 MPC85xx_PERFMON, MPC85xx_DUART, MPC85xx_SEC2,
75 MPC85xx_CPM_SPI, MPC85xx_CPM_I2C,
76 MPC85xx_CPM_FCC1, MPC85xx_CPM_FCC2,
77 },
78 },
79 {
80 .ppc_sys_name = "8555",
81 .mask = 0xFFFF0000,
82 .value = 0x80710000,
83 .num_devices = 19,
84 .device_list = (enum ppc_sys_devices[])
85 {
86 MPC85xx_TSEC1, MPC85xx_TSEC2, MPC85xx_IIC1,
87 MPC85xx_DMA0, MPC85xx_DMA1, MPC85xx_DMA2, MPC85xx_DMA3,
88 MPC85xx_PERFMON, MPC85xx_DUART,
89 MPC85xx_CPM_SPI, MPC85xx_CPM_I2C, MPC85xx_CPM_SCC1,
90 MPC85xx_CPM_SCC2, MPC85xx_CPM_SCC3,
91 MPC85xx_CPM_FCC1, MPC85xx_CPM_FCC2,
92 MPC85xx_CPM_SMC1, MPC85xx_CPM_SMC2,
93 MPC85xx_CPM_USB,
94 },
95 },
96 {
97 .ppc_sys_name = "8555E",
98 .mask = 0xFFFF0000,
99 .value = 0x80790000,
100 .num_devices = 20,
101 .device_list = (enum ppc_sys_devices[])
102 {
103 MPC85xx_TSEC1, MPC85xx_TSEC2, MPC85xx_IIC1,
104 MPC85xx_DMA0, MPC85xx_DMA1, MPC85xx_DMA2, MPC85xx_DMA3,
105 MPC85xx_PERFMON, MPC85xx_DUART, MPC85xx_SEC2,
106 MPC85xx_CPM_SPI, MPC85xx_CPM_I2C, MPC85xx_CPM_SCC1,
107 MPC85xx_CPM_SCC2, MPC85xx_CPM_SCC3,
108 MPC85xx_CPM_FCC1, MPC85xx_CPM_FCC2,
109 MPC85xx_CPM_SMC1, MPC85xx_CPM_SMC2,
110 MPC85xx_CPM_USB,
111 },
112 },
113 { /* default match */
114 .ppc_sys_name = "",
115 .mask = 0x00000000,
116 .value = 0x00000000,
117 },
118};
diff --git a/arch/ppc/syslib/mv64360_pic.c b/arch/ppc/syslib/mv64360_pic.c
new file mode 100644
index 000000000000..74d8996418e9
--- /dev/null
+++ b/arch/ppc/syslib/mv64360_pic.c
@@ -0,0 +1,426 @@
1/*
2 * arch/ppc/kernel/mv64360_pic.c
3 *
4 * Interrupt controller support for Marvell's MV64360.
5 *
6 * Author: Rabeeh Khoury <rabeeh@galileo.co.il>
7 * Based on MV64360 PIC written by
8 * Chris Zankel <chris@mvista.com>
9 * Mark A. Greer <mgreer@mvista.com>
10 *
11 * Copyright 2004 MontaVista Software, Inc.
12 *
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the
15 * Free Software Foundation; either version 2 of the License, or (at your
16 * option) any later version.
17 */
18
19/*
20 * This file contains the specific functions to support the MV64360
21 * interrupt controller.
22 *
23 * The MV64360 has two main interrupt registers (high and low) that
24 * summarizes the interrupts generated by the units of the MV64360.
25 * Each bit is assigned to an interrupt number, where the low register
26 * are assigned from IRQ0 to IRQ31 and the high cause register
27 * from IRQ32 to IRQ63
28 * The GPP (General Purpose Pins) interrupts are assigned from IRQ64 (GPP0)
29 * to IRQ95 (GPP31).
30 * get_irq() returns the lowest interrupt number that is currently asserted.
31 *
32 * Note:
33 * - This driver does not initialize the GPP when used as an interrupt
34 * input.
35 */
36
37#include <linux/stddef.h>
38#include <linux/init.h>
39#include <linux/sched.h>
40#include <linux/signal.h>
41#include <linux/stddef.h>
42#include <linux/delay.h>
43#include <linux/irq.h>
44#include <linux/interrupt.h>
45
46#include <asm/io.h>
47#include <asm/processor.h>
48#include <asm/system.h>
49#include <asm/irq.h>
50#include <asm/mv64x60.h>
51
52#ifdef CONFIG_IRQ_ALL_CPUS
53#error "The mv64360 does not support distribution of IRQs on all CPUs"
54#endif
55/* ========================== forward declaration ========================== */
56
57static void mv64360_unmask_irq(unsigned int);
58static void mv64360_mask_irq(unsigned int);
59static irqreturn_t mv64360_cpu_error_int_handler(int, void *, struct pt_regs *);
60static irqreturn_t mv64360_sram_error_int_handler(int, void *,
61 struct pt_regs *);
62static irqreturn_t mv64360_pci_error_int_handler(int, void *, struct pt_regs *);
63
64/* ========================== local declarations =========================== */
65
66struct hw_interrupt_type mv64360_pic = {
67 .typename = " mv64360 ",
68 .enable = mv64360_unmask_irq,
69 .disable = mv64360_mask_irq,
70 .ack = mv64360_mask_irq,
71 .end = mv64360_unmask_irq,
72};
73
74#define CPU_INTR_STR "mv64360 cpu interface error"
75#define SRAM_INTR_STR "mv64360 internal sram error"
76#define PCI0_INTR_STR "mv64360 pci 0 error"
77#define PCI1_INTR_STR "mv64360 pci 1 error"
78
79static struct mv64x60_handle bh;
80
81u32 mv64360_irq_base = 0; /* MV64360 handles the next 96 IRQs from here */
82
83/* mv64360_init_irq()
84 *
85 * This function initializes the interrupt controller. It assigns
86 * all interrupts from IRQ0 to IRQ95 to the mv64360 interrupt controller.
87 *
88 * Input Variable(s):
89 * None.
90 *
91 * Outpu. Variable(s):
92 * None.
93 *
94 * Returns:
95 * void
96 *
97 * Note:
98 * We register all GPP inputs as interrupt source, but disable them.
99 */
100void __init
101mv64360_init_irq(void)
102{
103 int i;
104
105 if (ppc_md.progress)
106 ppc_md.progress("mv64360_init_irq: enter", 0x0);
107
108 bh.v_base = mv64x60_get_bridge_vbase();
109
110 ppc_cached_irq_mask[0] = 0;
111 ppc_cached_irq_mask[1] = 0x0f000000; /* Enable GPP intrs */
112 ppc_cached_irq_mask[2] = 0;
113
114 /* disable all interrupts and clear current interrupts */
115 mv64x60_write(&bh, MV64x60_GPP_INTR_CAUSE, 0);
116 mv64x60_write(&bh, MV64x60_GPP_INTR_MASK, ppc_cached_irq_mask[2]);
117 mv64x60_write(&bh, MV64360_IC_CPU0_INTR_MASK_LO,ppc_cached_irq_mask[0]);
118 mv64x60_write(&bh, MV64360_IC_CPU0_INTR_MASK_HI,ppc_cached_irq_mask[1]);
119
120 /* All interrupts are level interrupts */
121 for (i = mv64360_irq_base; i < (mv64360_irq_base + 96); i++) {
122 irq_desc[i].status |= IRQ_LEVEL;
123 irq_desc[i].handler = &mv64360_pic;
124 }
125
126 if (ppc_md.progress)
127 ppc_md.progress("mv64360_init_irq: exit", 0x0);
128}
129
130/* mv64360_get_irq()
131 *
132 * This function returns the lowest interrupt number of all interrupts that
133 * are currently asserted.
134 *
135 * Input Variable(s):
136 * struct pt_regs* not used
137 *
138 * Output Variable(s):
139 * None.
140 *
141 * Returns:
142 * int <interrupt number> or -2 (bogus interrupt)
143 *
144 */
145int
146mv64360_get_irq(struct pt_regs *regs)
147{
148 int irq;
149 int irq_gpp;
150
151#ifdef CONFIG_SMP
152 /*
153 * Second CPU gets only doorbell (message) interrupts.
154 * The doorbell interrupt is BIT28 in the main interrupt low cause reg.
155 */
156 int cpu_nr = smp_processor_id();
157 if (cpu_nr == 1) {
158 if (!(mv64x60_read(&bh, MV64360_IC_MAIN_CAUSE_LO) &
159 (1 << MV64x60_IRQ_DOORBELL)))
160 return -1;
161 return mv64360_irq_base + MV64x60_IRQ_DOORBELL;
162 }
163#endif
164
165 irq = mv64x60_read(&bh, MV64360_IC_MAIN_CAUSE_LO);
166 irq = __ilog2((irq & 0x3dfffffe) & ppc_cached_irq_mask[0]);
167
168 if (irq == -1) {
169 irq = mv64x60_read(&bh, MV64360_IC_MAIN_CAUSE_HI);
170 irq = __ilog2((irq & 0x1f0003f7) & ppc_cached_irq_mask[1]);
171
172 if (irq == -1)
173 irq = -2; /* bogus interrupt, should never happen */
174 else {
175 if ((irq >= 24) && (irq < MV64x60_IRQ_DOORBELL)) {
176 irq_gpp = mv64x60_read(&bh,
177 MV64x60_GPP_INTR_CAUSE);
178 irq_gpp = __ilog2(irq_gpp &
179 ppc_cached_irq_mask[2]);
180
181 if (irq_gpp == -1)
182 irq = -2;
183 else {
184 irq = irq_gpp + 64;
185 mv64x60_write(&bh,
186 MV64x60_GPP_INTR_CAUSE,
187 ~(1 << (irq - 64)));
188 }
189 }
190 else
191 irq += 32;
192 }
193 }
194
195 (void)mv64x60_read(&bh, MV64x60_GPP_INTR_CAUSE);
196
197 if (irq < 0)
198 return (irq);
199 else
200 return (mv64360_irq_base + irq);
201}
202
203/* mv64360_unmask_irq()
204 *
205 * This function enables an interrupt.
206 *
207 * Input Variable(s):
208 * unsigned int interrupt number (IRQ0...IRQ95).
209 *
210 * Output Variable(s):
211 * None.
212 *
213 * Returns:
214 * void
215 */
216static void
217mv64360_unmask_irq(unsigned int irq)
218{
219#ifdef CONFIG_SMP
220 /* second CPU gets only doorbell interrupts */
221 if ((irq - mv64360_irq_base) == MV64x60_IRQ_DOORBELL) {
222 mv64x60_set_bits(&bh, MV64360_IC_CPU1_INTR_MASK_LO,
223 (1 << MV64x60_IRQ_DOORBELL));
224 return;
225 }
226#endif
227 irq -= mv64360_irq_base;
228
229 if (irq > 31) {
230 if (irq > 63) /* unmask GPP irq */
231 mv64x60_write(&bh, MV64x60_GPP_INTR_MASK,
232 ppc_cached_irq_mask[2] |= (1 << (irq - 64)));
233 else /* mask high interrupt register */
234 mv64x60_write(&bh, MV64360_IC_CPU0_INTR_MASK_HI,
235 ppc_cached_irq_mask[1] |= (1 << (irq - 32)));
236 }
237 else /* mask low interrupt register */
238 mv64x60_write(&bh, MV64360_IC_CPU0_INTR_MASK_LO,
239 ppc_cached_irq_mask[0] |= (1 << irq));
240
241 (void)mv64x60_read(&bh, MV64x60_GPP_INTR_MASK);
242 return;
243}
244
245/* mv64360_mask_irq()
246 *
247 * This function disables the requested interrupt.
248 *
249 * Input Variable(s):
250 * unsigned int interrupt number (IRQ0...IRQ95).
251 *
252 * Output Variable(s):
253 * None.
254 *
255 * Returns:
256 * void
257 */
258static void
259mv64360_mask_irq(unsigned int irq)
260{
261#ifdef CONFIG_SMP
262 if ((irq - mv64360_irq_base) == MV64x60_IRQ_DOORBELL) {
263 mv64x60_clr_bits(&bh, MV64360_IC_CPU1_INTR_MASK_LO,
264 (1 << MV64x60_IRQ_DOORBELL));
265 return;
266 }
267#endif
268 irq -= mv64360_irq_base;
269
270 if (irq > 31) {
271 if (irq > 63) /* mask GPP irq */
272 mv64x60_write(&bh, MV64x60_GPP_INTR_MASK,
273 ppc_cached_irq_mask[2] &= ~(1 << (irq - 64)));
274 else /* mask high interrupt register */
275 mv64x60_write(&bh, MV64360_IC_CPU0_INTR_MASK_HI,
276 ppc_cached_irq_mask[1] &= ~(1 << (irq - 32)));
277 }
278 else /* mask low interrupt register */
279 mv64x60_write(&bh, MV64360_IC_CPU0_INTR_MASK_LO,
280 ppc_cached_irq_mask[0] &= ~(1 << irq));
281
282 (void)mv64x60_read(&bh, MV64x60_GPP_INTR_MASK);
283 return;
284}
285
286static irqreturn_t
287mv64360_cpu_error_int_handler(int irq, void *dev_id, struct pt_regs *regs)
288{
289 printk(KERN_ERR "mv64360_cpu_error_int_handler: %s 0x%08x\n",
290 "Error on CPU interface - Cause regiser",
291 mv64x60_read(&bh, MV64x60_CPU_ERR_CAUSE));
292 printk(KERN_ERR "\tCPU error register dump:\n");
293 printk(KERN_ERR "\tAddress low 0x%08x\n",
294 mv64x60_read(&bh, MV64x60_CPU_ERR_ADDR_LO));
295 printk(KERN_ERR "\tAddress high 0x%08x\n",
296 mv64x60_read(&bh, MV64x60_CPU_ERR_ADDR_HI));
297 printk(KERN_ERR "\tData low 0x%08x\n",
298 mv64x60_read(&bh, MV64x60_CPU_ERR_DATA_LO));
299 printk(KERN_ERR "\tData high 0x%08x\n",
300 mv64x60_read(&bh, MV64x60_CPU_ERR_DATA_HI));
301 printk(KERN_ERR "\tParity 0x%08x\n",
302 mv64x60_read(&bh, MV64x60_CPU_ERR_PARITY));
303 mv64x60_write(&bh, MV64x60_CPU_ERR_CAUSE, 0);
304 return IRQ_HANDLED;
305}
306
307static irqreturn_t
308mv64360_sram_error_int_handler(int irq, void *dev_id, struct pt_regs *regs)
309{
310 printk(KERN_ERR "mv64360_sram_error_int_handler: %s 0x%08x\n",
311 "Error in internal SRAM - Cause register",
312 mv64x60_read(&bh, MV64360_SRAM_ERR_CAUSE));
313 printk(KERN_ERR "\tSRAM error register dump:\n");
314 printk(KERN_ERR "\tAddress Low 0x%08x\n",
315 mv64x60_read(&bh, MV64360_SRAM_ERR_ADDR_LO));
316 printk(KERN_ERR "\tAddress High 0x%08x\n",
317 mv64x60_read(&bh, MV64360_SRAM_ERR_ADDR_HI));
318 printk(KERN_ERR "\tData Low 0x%08x\n",
319 mv64x60_read(&bh, MV64360_SRAM_ERR_DATA_LO));
320 printk(KERN_ERR "\tData High 0x%08x\n",
321 mv64x60_read(&bh, MV64360_SRAM_ERR_DATA_HI));
322 printk(KERN_ERR "\tParity 0x%08x\n",
323 mv64x60_read(&bh, MV64360_SRAM_ERR_PARITY));
324 mv64x60_write(&bh, MV64360_SRAM_ERR_CAUSE, 0);
325 return IRQ_HANDLED;
326}
327
328static irqreturn_t
329mv64360_pci_error_int_handler(int irq, void *dev_id, struct pt_regs *regs)
330{
331 u32 val;
332 unsigned int pci_bus = (unsigned int)dev_id;
333
334 if (pci_bus == 0) { /* Error on PCI 0 */
335 val = mv64x60_read(&bh, MV64x60_PCI0_ERR_CAUSE);
336 printk(KERN_ERR "%s: Error in PCI %d Interface\n",
337 "mv64360_pci_error_int_handler", pci_bus);
338 printk(KERN_ERR "\tPCI %d error register dump:\n", pci_bus);
339 printk(KERN_ERR "\tCause register 0x%08x\n", val);
340 printk(KERN_ERR "\tAddress Low 0x%08x\n",
341 mv64x60_read(&bh, MV64x60_PCI0_ERR_ADDR_LO));
342 printk(KERN_ERR "\tAddress High 0x%08x\n",
343 mv64x60_read(&bh, MV64x60_PCI0_ERR_ADDR_HI));
344 printk(KERN_ERR "\tAttribute 0x%08x\n",
345 mv64x60_read(&bh, MV64x60_PCI0_ERR_DATA_LO));
346 printk(KERN_ERR "\tCommand 0x%08x\n",
347 mv64x60_read(&bh, MV64x60_PCI0_ERR_CMD));
348 mv64x60_write(&bh, MV64x60_PCI0_ERR_CAUSE, ~val);
349 }
350 if (pci_bus == 1) { /* Error on PCI 1 */
351 val = mv64x60_read(&bh, MV64x60_PCI1_ERR_CAUSE);
352 printk(KERN_ERR "%s: Error in PCI %d Interface\n",
353 "mv64360_pci_error_int_handler", pci_bus);
354 printk(KERN_ERR "\tPCI %d error register dump:\n", pci_bus);
355 printk(KERN_ERR "\tCause register 0x%08x\n", val);
356 printk(KERN_ERR "\tAddress Low 0x%08x\n",
357 mv64x60_read(&bh, MV64x60_PCI1_ERR_ADDR_LO));
358 printk(KERN_ERR "\tAddress High 0x%08x\n",
359 mv64x60_read(&bh, MV64x60_PCI1_ERR_ADDR_HI));
360 printk(KERN_ERR "\tAttribute 0x%08x\n",
361 mv64x60_read(&bh, MV64x60_PCI1_ERR_DATA_LO));
362 printk(KERN_ERR "\tCommand 0x%08x\n",
363 mv64x60_read(&bh, MV64x60_PCI1_ERR_CMD));
364 mv64x60_write(&bh, MV64x60_PCI1_ERR_CAUSE, ~val);
365 }
366 return IRQ_HANDLED;
367}
368
369static int __init
370mv64360_register_hdlrs(void)
371{
372 u32 mask;
373 int rc;
374
375 /* Clear old errors and register CPU interface error intr handler */
376 mv64x60_write(&bh, MV64x60_CPU_ERR_CAUSE, 0);
377 if ((rc = request_irq(MV64x60_IRQ_CPU_ERR + mv64360_irq_base,
378 mv64360_cpu_error_int_handler, SA_INTERRUPT, CPU_INTR_STR, 0)))
379 printk(KERN_WARNING "Can't register cpu error handler: %d", rc);
380
381 mv64x60_write(&bh, MV64x60_CPU_ERR_MASK, 0);
382 mv64x60_write(&bh, MV64x60_CPU_ERR_MASK, 0x000000ff);
383
384 /* Clear old errors and register internal SRAM error intr handler */
385 mv64x60_write(&bh, MV64360_SRAM_ERR_CAUSE, 0);
386 if ((rc = request_irq(MV64360_IRQ_SRAM_PAR_ERR + mv64360_irq_base,
387 mv64360_sram_error_int_handler,SA_INTERRUPT,SRAM_INTR_STR, 0)))
388 printk(KERN_WARNING "Can't register SRAM error handler: %d",rc);
389
390 /*
391 * Bit 0 reserved on 64360 and erratum FEr PCI-#11 (PCI internal
392 * data parity error set incorrectly) on rev 0 & 1 of 64460 requires
393 * bit 0 to be cleared.
394 */
395 mask = 0x00a50c24;
396
397 if ((mv64x60_get_bridge_type() == MV64x60_TYPE_MV64460) &&
398 (mv64x60_get_bridge_rev() > 1))
399 mask |= 0x1; /* enable DPErr on 64460 */
400
401 /* Clear old errors and register PCI 0 error intr handler */
402 mv64x60_write(&bh, MV64x60_PCI0_ERR_CAUSE, 0);
403 if ((rc = request_irq(MV64360_IRQ_PCI0 + mv64360_irq_base,
404 mv64360_pci_error_int_handler,
405 SA_INTERRUPT, PCI0_INTR_STR, (void *)0)))
406 printk(KERN_WARNING "Can't register pci 0 error handler: %d",
407 rc);
408
409 mv64x60_write(&bh, MV64x60_PCI0_ERR_MASK, 0);
410 mv64x60_write(&bh, MV64x60_PCI0_ERR_MASK, mask);
411
412 /* Clear old errors and register PCI 1 error intr handler */
413 mv64x60_write(&bh, MV64x60_PCI1_ERR_CAUSE, 0);
414 if ((rc = request_irq(MV64360_IRQ_PCI1 + mv64360_irq_base,
415 mv64360_pci_error_int_handler,
416 SA_INTERRUPT, PCI1_INTR_STR, (void *)1)))
417 printk(KERN_WARNING "Can't register pci 1 error handler: %d",
418 rc);
419
420 mv64x60_write(&bh, MV64x60_PCI1_ERR_MASK, 0);
421 mv64x60_write(&bh, MV64x60_PCI1_ERR_MASK, mask);
422
423 return 0;
424}
425
426arch_initcall(mv64360_register_hdlrs);
diff --git a/arch/ppc/syslib/mv64x60.c b/arch/ppc/syslib/mv64x60.c
new file mode 100644
index 000000000000..7b241e7876bd
--- /dev/null
+++ b/arch/ppc/syslib/mv64x60.c
@@ -0,0 +1,2392 @@
1/*
2 * arch/ppc/syslib/mv64x60.c
3 *
4 * Common routines for the Marvell/Galileo Discovery line of host bridges
5 * (gt64260, mv64360, mv64460, ...).
6 *
7 * Author: Mark A. Greer <mgreer@mvista.com>
8 *
9 * 2004 (c) MontaVista, Software, Inc. This file is licensed under
10 * the terms of the GNU General Public License version 2. This program
11 * is licensed "as is" without any warranty of any kind, whether express
12 * or implied.
13 */
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/pci.h>
17#include <linux/slab.h>
18#include <linux/module.h>
19#include <linux/string.h>
20#include <linux/bootmem.h>
21#include <linux/spinlock.h>
22#include <linux/mv643xx.h>
23
24#include <asm/byteorder.h>
25#include <asm/io.h>
26#include <asm/irq.h>
27#include <asm/uaccess.h>
28#include <asm/machdep.h>
29#include <asm/pci-bridge.h>
30#include <asm/delay.h>
31#include <asm/mv64x60.h>
32
33
34u8 mv64x60_pci_exclude_bridge = 1;
35spinlock_t mv64x60_lock = SPIN_LOCK_UNLOCKED;
36
37static phys_addr_t mv64x60_bridge_pbase = 0;
38static void *mv64x60_bridge_vbase = 0;
39static u32 mv64x60_bridge_type = MV64x60_TYPE_INVALID;
40static u32 mv64x60_bridge_rev = 0;
41
42static u32 gt64260_translate_size(u32 base, u32 size, u32 num_bits);
43static u32 gt64260_untranslate_size(u32 base, u32 size, u32 num_bits);
44static void gt64260_set_pci2mem_window(struct pci_controller *hose, u32 bus,
45 u32 window, u32 base);
46static void gt64260_set_pci2regs_window(struct mv64x60_handle *bh,
47 struct pci_controller *hose, u32 bus, u32 base);
48static u32 gt64260_is_enabled_32bit(struct mv64x60_handle *bh, u32 window);
49static void gt64260_enable_window_32bit(struct mv64x60_handle *bh, u32 window);
50static void gt64260_disable_window_32bit(struct mv64x60_handle *bh, u32 window);
51static void gt64260_enable_window_64bit(struct mv64x60_handle *bh, u32 window);
52static void gt64260_disable_window_64bit(struct mv64x60_handle *bh, u32 window);
53static void gt64260_disable_all_windows(struct mv64x60_handle *bh,
54 struct mv64x60_setup_info *si);
55static void gt64260a_chip_specific_init(struct mv64x60_handle *bh,
56 struct mv64x60_setup_info *si);
57static void gt64260b_chip_specific_init(struct mv64x60_handle *bh,
58 struct mv64x60_setup_info *si);
59
60static u32 mv64360_translate_size(u32 base, u32 size, u32 num_bits);
61static u32 mv64360_untranslate_size(u32 base, u32 size, u32 num_bits);
62static void mv64360_set_pci2mem_window(struct pci_controller *hose, u32 bus,
63 u32 window, u32 base);
64static void mv64360_set_pci2regs_window(struct mv64x60_handle *bh,
65 struct pci_controller *hose, u32 bus, u32 base);
66static u32 mv64360_is_enabled_32bit(struct mv64x60_handle *bh, u32 window);
67static void mv64360_enable_window_32bit(struct mv64x60_handle *bh, u32 window);
68static void mv64360_disable_window_32bit(struct mv64x60_handle *bh, u32 window);
69static void mv64360_enable_window_64bit(struct mv64x60_handle *bh, u32 window);
70static void mv64360_disable_window_64bit(struct mv64x60_handle *bh, u32 window);
71static void mv64360_disable_all_windows(struct mv64x60_handle *bh,
72 struct mv64x60_setup_info *si);
73static void mv64360_config_io2mem_windows(struct mv64x60_handle *bh,
74 struct mv64x60_setup_info *si,
75 u32 mem_windows[MV64x60_CPU2MEM_WINDOWS][2]);
76static void mv64360_set_mpsc2regs_window(struct mv64x60_handle *bh, u32 base);
77static void mv64360_chip_specific_init(struct mv64x60_handle *bh,
78 struct mv64x60_setup_info *si);
79static void mv64460_chip_specific_init(struct mv64x60_handle *bh,
80 struct mv64x60_setup_info *si);
81
82
83/*
84 * Define tables that have the chip-specific info for each type of
85 * Marvell bridge chip.
86 */
87static struct mv64x60_chip_info gt64260a_ci __initdata = { /* GT64260A */
88 .translate_size = gt64260_translate_size,
89 .untranslate_size = gt64260_untranslate_size,
90 .set_pci2mem_window = gt64260_set_pci2mem_window,
91 .set_pci2regs_window = gt64260_set_pci2regs_window,
92 .is_enabled_32bit = gt64260_is_enabled_32bit,
93 .enable_window_32bit = gt64260_enable_window_32bit,
94 .disable_window_32bit = gt64260_disable_window_32bit,
95 .enable_window_64bit = gt64260_enable_window_64bit,
96 .disable_window_64bit = gt64260_disable_window_64bit,
97 .disable_all_windows = gt64260_disable_all_windows,
98 .chip_specific_init = gt64260a_chip_specific_init,
99 .window_tab_32bit = gt64260_32bit_windows,
100 .window_tab_64bit = gt64260_64bit_windows,
101};
102
103static struct mv64x60_chip_info gt64260b_ci __initdata = { /* GT64260B */
104 .translate_size = gt64260_translate_size,
105 .untranslate_size = gt64260_untranslate_size,
106 .set_pci2mem_window = gt64260_set_pci2mem_window,
107 .set_pci2regs_window = gt64260_set_pci2regs_window,
108 .is_enabled_32bit = gt64260_is_enabled_32bit,
109 .enable_window_32bit = gt64260_enable_window_32bit,
110 .disable_window_32bit = gt64260_disable_window_32bit,
111 .enable_window_64bit = gt64260_enable_window_64bit,
112 .disable_window_64bit = gt64260_disable_window_64bit,
113 .disable_all_windows = gt64260_disable_all_windows,
114 .chip_specific_init = gt64260b_chip_specific_init,
115 .window_tab_32bit = gt64260_32bit_windows,
116 .window_tab_64bit = gt64260_64bit_windows,
117};
118
119static struct mv64x60_chip_info mv64360_ci __initdata = { /* MV64360 */
120 .translate_size = mv64360_translate_size,
121 .untranslate_size = mv64360_untranslate_size,
122 .set_pci2mem_window = mv64360_set_pci2mem_window,
123 .set_pci2regs_window = mv64360_set_pci2regs_window,
124 .is_enabled_32bit = mv64360_is_enabled_32bit,
125 .enable_window_32bit = mv64360_enable_window_32bit,
126 .disable_window_32bit = mv64360_disable_window_32bit,
127 .enable_window_64bit = mv64360_enable_window_64bit,
128 .disable_window_64bit = mv64360_disable_window_64bit,
129 .disable_all_windows = mv64360_disable_all_windows,
130 .config_io2mem_windows = mv64360_config_io2mem_windows,
131 .set_mpsc2regs_window = mv64360_set_mpsc2regs_window,
132 .chip_specific_init = mv64360_chip_specific_init,
133 .window_tab_32bit = mv64360_32bit_windows,
134 .window_tab_64bit = mv64360_64bit_windows,
135};
136
137static struct mv64x60_chip_info mv64460_ci __initdata = { /* MV64460 */
138 .translate_size = mv64360_translate_size,
139 .untranslate_size = mv64360_untranslate_size,
140 .set_pci2mem_window = mv64360_set_pci2mem_window,
141 .set_pci2regs_window = mv64360_set_pci2regs_window,
142 .is_enabled_32bit = mv64360_is_enabled_32bit,
143 .enable_window_32bit = mv64360_enable_window_32bit,
144 .disable_window_32bit = mv64360_disable_window_32bit,
145 .enable_window_64bit = mv64360_enable_window_64bit,
146 .disable_window_64bit = mv64360_disable_window_64bit,
147 .disable_all_windows = mv64360_disable_all_windows,
148 .config_io2mem_windows = mv64360_config_io2mem_windows,
149 .set_mpsc2regs_window = mv64360_set_mpsc2regs_window,
150 .chip_specific_init = mv64460_chip_specific_init,
151 .window_tab_32bit = mv64360_32bit_windows,
152 .window_tab_64bit = mv64360_64bit_windows,
153};
154
155/*
156 *****************************************************************************
157 *
158 * Platform Device Definitions
159 *
160 *****************************************************************************
161 */
162#ifdef CONFIG_SERIAL_MPSC
163static struct mpsc_shared_pdata mv64x60_mpsc_shared_pdata = {
164 .mrr_val = 0x3ffffe38,
165 .rcrr_val = 0,
166 .tcrr_val = 0,
167 .intr_cause_val = 0,
168 .intr_mask_val = 0,
169};
170
171static struct resource mv64x60_mpsc_shared_resources[] = {
172 /* Do not change the order of the IORESOURCE_MEM resources */
173 [0] = {
174 .name = "mpsc routing base",
175 .start = MV64x60_MPSC_ROUTING_OFFSET,
176 .end = MV64x60_MPSC_ROUTING_OFFSET +
177 MPSC_ROUTING_REG_BLOCK_SIZE - 1,
178 .flags = IORESOURCE_MEM,
179 },
180 [1] = {
181 .name = "sdma intr base",
182 .start = MV64x60_SDMA_INTR_OFFSET,
183 .end = MV64x60_SDMA_INTR_OFFSET +
184 MPSC_SDMA_INTR_REG_BLOCK_SIZE - 1,
185 .flags = IORESOURCE_MEM,
186 },
187};
188
189static struct platform_device mpsc_shared_device = { /* Shared device */
190 .name = MPSC_SHARED_NAME,
191 .id = 0,
192 .num_resources = ARRAY_SIZE(mv64x60_mpsc_shared_resources),
193 .resource = mv64x60_mpsc_shared_resources,
194 .dev = {
195 .platform_data = &mv64x60_mpsc_shared_pdata,
196 },
197};
198
199static struct mpsc_pdata mv64x60_mpsc0_pdata = {
200 .mirror_regs = 0,
201 .cache_mgmt = 0,
202 .max_idle = 0,
203 .default_baud = 9600,
204 .default_bits = 8,
205 .default_parity = 'n',
206 .default_flow = 'n',
207 .chr_1_val = 0x00000000,
208 .chr_2_val = 0x00000000,
209 .chr_10_val = 0x00000003,
210 .mpcr_val = 0,
211 .bcr_val = 0,
212 .brg_can_tune = 0,
213 .brg_clk_src = 8, /* Default to TCLK */
214 .brg_clk_freq = 100000000, /* Default to 100 MHz */
215};
216
217static struct resource mv64x60_mpsc0_resources[] = {
218 /* Do not change the order of the IORESOURCE_MEM resources */
219 [0] = {
220 .name = "mpsc 0 base",
221 .start = MV64x60_MPSC_0_OFFSET,
222 .end = MV64x60_MPSC_0_OFFSET + MPSC_REG_BLOCK_SIZE - 1,
223 .flags = IORESOURCE_MEM,
224 },
225 [1] = {
226 .name = "sdma 0 base",
227 .start = MV64x60_SDMA_0_OFFSET,
228 .end = MV64x60_SDMA_0_OFFSET + MPSC_SDMA_REG_BLOCK_SIZE - 1,
229 .flags = IORESOURCE_MEM,
230 },
231 [2] = {
232 .name = "brg 0 base",
233 .start = MV64x60_BRG_0_OFFSET,
234 .end = MV64x60_BRG_0_OFFSET + MPSC_BRG_REG_BLOCK_SIZE - 1,
235 .flags = IORESOURCE_MEM,
236 },
237 [3] = {
238 .name = "sdma 0 irq",
239 .start = MV64x60_IRQ_SDMA_0,
240 .end = MV64x60_IRQ_SDMA_0,
241 .flags = IORESOURCE_IRQ,
242 },
243};
244
245static struct platform_device mpsc0_device = {
246 .name = MPSC_CTLR_NAME,
247 .id = 0,
248 .num_resources = ARRAY_SIZE(mv64x60_mpsc0_resources),
249 .resource = mv64x60_mpsc0_resources,
250 .dev = {
251 .platform_data = &mv64x60_mpsc0_pdata,
252 },
253};
254
255static struct mpsc_pdata mv64x60_mpsc1_pdata = {
256 .mirror_regs = 0,
257 .cache_mgmt = 0,
258 .max_idle = 0,
259 .default_baud = 9600,
260 .default_bits = 8,
261 .default_parity = 'n',
262 .default_flow = 'n',
263 .chr_1_val = 0x00000000,
264 .chr_1_val = 0x00000000,
265 .chr_2_val = 0x00000000,
266 .chr_10_val = 0x00000003,
267 .mpcr_val = 0,
268 .bcr_val = 0,
269 .brg_can_tune = 0,
270 .brg_clk_src = 8, /* Default to TCLK */
271 .brg_clk_freq = 100000000, /* Default to 100 MHz */
272};
273
274static struct resource mv64x60_mpsc1_resources[] = {
275 /* Do not change the order of the IORESOURCE_MEM resources */
276 [0] = {
277 .name = "mpsc 1 base",
278 .start = MV64x60_MPSC_1_OFFSET,
279 .end = MV64x60_MPSC_1_OFFSET + MPSC_REG_BLOCK_SIZE - 1,
280 .flags = IORESOURCE_MEM,
281 },
282 [1] = {
283 .name = "sdma 1 base",
284 .start = MV64x60_SDMA_1_OFFSET,
285 .end = MV64x60_SDMA_1_OFFSET + MPSC_SDMA_REG_BLOCK_SIZE - 1,
286 .flags = IORESOURCE_MEM,
287 },
288 [2] = {
289 .name = "brg 1 base",
290 .start = MV64x60_BRG_1_OFFSET,
291 .end = MV64x60_BRG_1_OFFSET + MPSC_BRG_REG_BLOCK_SIZE - 1,
292 .flags = IORESOURCE_MEM,
293 },
294 [3] = {
295 .name = "sdma 1 irq",
296 .start = MV64360_IRQ_SDMA_1,
297 .end = MV64360_IRQ_SDMA_1,
298 .flags = IORESOURCE_IRQ,
299 },
300};
301
302static struct platform_device mpsc1_device = {
303 .name = MPSC_CTLR_NAME,
304 .id = 1,
305 .num_resources = ARRAY_SIZE(mv64x60_mpsc1_resources),
306 .resource = mv64x60_mpsc1_resources,
307 .dev = {
308 .platform_data = &mv64x60_mpsc1_pdata,
309 },
310};
311#endif
312
313#ifdef CONFIG_MV643XX_ETH
314static struct resource mv64x60_eth_shared_resources[] = {
315 [0] = {
316 .name = "ethernet shared base",
317 .start = MV643XX_ETH_SHARED_REGS,
318 .end = MV643XX_ETH_SHARED_REGS +
319 MV643XX_ETH_SHARED_REGS_SIZE - 1,
320 .flags = IORESOURCE_MEM,
321 },
322};
323
324static struct platform_device mv64x60_eth_shared_device = {
325 .name = MV643XX_ETH_SHARED_NAME,
326 .id = 0,
327 .num_resources = ARRAY_SIZE(mv64x60_eth_shared_resources),
328 .resource = mv64x60_eth_shared_resources,
329};
330
331#ifdef CONFIG_MV643XX_ETH_0
332static struct resource mv64x60_eth0_resources[] = {
333 [0] = {
334 .name = "eth0 irq",
335 .start = MV64x60_IRQ_ETH_0,
336 .end = MV64x60_IRQ_ETH_0,
337 .flags = IORESOURCE_IRQ,
338 },
339};
340
341static struct mv643xx_eth_platform_data eth0_pd;
342
343static struct platform_device eth0_device = {
344 .name = MV643XX_ETH_NAME,
345 .id = 0,
346 .num_resources = ARRAY_SIZE(mv64x60_eth0_resources),
347 .resource = mv64x60_eth0_resources,
348 .dev = {
349 .platform_data = &eth0_pd,
350 },
351};
352#endif
353
354#ifdef CONFIG_MV643XX_ETH_1
355static struct resource mv64x60_eth1_resources[] = {
356 [0] = {
357 .name = "eth1 irq",
358 .start = MV64x60_IRQ_ETH_1,
359 .end = MV64x60_IRQ_ETH_1,
360 .flags = IORESOURCE_IRQ,
361 },
362};
363
364static struct mv643xx_eth_platform_data eth1_pd;
365
366static struct platform_device eth1_device = {
367 .name = MV643XX_ETH_NAME,
368 .id = 1,
369 .num_resources = ARRAY_SIZE(mv64x60_eth1_resources),
370 .resource = mv64x60_eth1_resources,
371 .dev = {
372 .platform_data = &eth1_pd,
373 },
374};
375#endif
376
377#ifdef CONFIG_MV643XX_ETH_2
378static struct resource mv64x60_eth2_resources[] = {
379 [0] = {
380 .name = "eth2 irq",
381 .start = MV64x60_IRQ_ETH_2,
382 .end = MV64x60_IRQ_ETH_2,
383 .flags = IORESOURCE_IRQ,
384 },
385};
386
387static struct mv643xx_eth_platform_data eth2_pd;
388
389static struct platform_device eth2_device = {
390 .name = MV643XX_ETH_NAME,
391 .id = 2,
392 .num_resources = ARRAY_SIZE(mv64x60_eth2_resources),
393 .resource = mv64x60_eth2_resources,
394 .dev = {
395 .platform_data = &eth2_pd,
396 },
397};
398#endif
399#endif
400
401#ifdef CONFIG_I2C_MV64XXX
402static struct mv64xxx_i2c_pdata mv64xxx_i2c_pdata = {
403 .freq_m = 8,
404 .freq_n = 3,
405 .timeout = 1000, /* Default timeout of 1 second */
406 .retries = 1,
407};
408
409static struct resource mv64xxx_i2c_resources[] = {
410 /* Do not change the order of the IORESOURCE_MEM resources */
411 [0] = {
412 .name = "mv64xxx i2c base",
413 .start = MV64XXX_I2C_OFFSET,
414 .end = MV64XXX_I2C_OFFSET + MV64XXX_I2C_REG_BLOCK_SIZE - 1,
415 .flags = IORESOURCE_MEM,
416 },
417 [1] = {
418 .name = "mv64xxx i2c irq",
419 .start = MV64x60_IRQ_I2C,
420 .end = MV64x60_IRQ_I2C,
421 .flags = IORESOURCE_IRQ,
422 },
423};
424
425static struct platform_device i2c_device = {
426 .name = MV64XXX_I2C_CTLR_NAME,
427 .id = 0,
428 .num_resources = ARRAY_SIZE(mv64xxx_i2c_resources),
429 .resource = mv64xxx_i2c_resources,
430 .dev = {
431 .platform_data = &mv64xxx_i2c_pdata,
432 },
433};
434#endif
435
436static struct platform_device *mv64x60_pd_devs[] __initdata = {
437#ifdef CONFIG_SERIAL_MPSC
438 &mpsc_shared_device,
439 &mpsc0_device,
440 &mpsc1_device,
441#endif
442#ifdef CONFIG_MV643XX_ETH
443 &mv64x60_eth_shared_device,
444#endif
445#ifdef CONFIG_MV643XX_ETH_0
446 &eth0_device,
447#endif
448#ifdef CONFIG_MV643XX_ETH_1
449 &eth1_device,
450#endif
451#ifdef CONFIG_MV643XX_ETH_2
452 &eth2_device,
453#endif
454#ifdef CONFIG_I2C_MV64XXX
455 &i2c_device,
456#endif
457};
458
459/*
460 *****************************************************************************
461 *
462 * Bridge Initialization Routines
463 *
464 *****************************************************************************
465 */
466/*
467 * mv64x60_init()
468 *
469 * Initialze the bridge based on setting passed in via 'si'. The bridge
470 * handle, 'bh', will be set so that it can be used to make subsequent
471 * calls to routines in this file.
472 */
473int __init
474mv64x60_init(struct mv64x60_handle *bh, struct mv64x60_setup_info *si)
475{
476 u32 mem_windows[MV64x60_CPU2MEM_WINDOWS][2];
477
478 if (ppc_md.progress)
479 ppc_md.progress("mv64x60 initialization", 0x0);
480
481 spin_lock_init(&mv64x60_lock);
482 mv64x60_early_init(bh, si);
483
484 if (mv64x60_get_type(bh) || mv64x60_setup_for_chip(bh)) {
485 iounmap(bh->v_base);
486 bh->v_base = 0;
487 if (ppc_md.progress)
488 ppc_md.progress("mv64x60_init: Can't determine chip",0);
489 return -1;
490 }
491
492 bh->ci->disable_all_windows(bh, si);
493 mv64x60_get_mem_windows(bh, mem_windows);
494 mv64x60_config_cpu2mem_windows(bh, si, mem_windows);
495
496 if (bh->ci->config_io2mem_windows)
497 bh->ci->config_io2mem_windows(bh, si, mem_windows);
498 if (bh->ci->set_mpsc2regs_window)
499 bh->ci->set_mpsc2regs_window(bh, si->phys_reg_base);
500
501 if (si->pci_1.enable_bus) {
502 bh->io_base_b = (u32)ioremap(si->pci_1.pci_io.cpu_base,
503 si->pci_1.pci_io.size);
504 isa_io_base = bh->io_base_b;
505 }
506
507 if (si->pci_0.enable_bus) {
508 bh->io_base_a = (u32)ioremap(si->pci_0.pci_io.cpu_base,
509 si->pci_0.pci_io.size);
510 isa_io_base = bh->io_base_a;
511
512 mv64x60_alloc_hose(bh, MV64x60_PCI0_CONFIG_ADDR,
513 MV64x60_PCI0_CONFIG_DATA, &bh->hose_a);
514 mv64x60_config_resources(bh->hose_a, &si->pci_0, bh->io_base_a);
515 mv64x60_config_pci_params(bh->hose_a, &si->pci_0);
516
517 mv64x60_config_cpu2pci_windows(bh, &si->pci_0, 0);
518 mv64x60_config_pci2mem_windows(bh, bh->hose_a, &si->pci_0, 0,
519 mem_windows);
520 bh->ci->set_pci2regs_window(bh, bh->hose_a, 0,
521 si->phys_reg_base);
522 }
523
524 if (si->pci_1.enable_bus) {
525 mv64x60_alloc_hose(bh, MV64x60_PCI1_CONFIG_ADDR,
526 MV64x60_PCI1_CONFIG_DATA, &bh->hose_b);
527 mv64x60_config_resources(bh->hose_b, &si->pci_1, bh->io_base_b);
528 mv64x60_config_pci_params(bh->hose_b, &si->pci_1);
529
530 mv64x60_config_cpu2pci_windows(bh, &si->pci_1, 1);
531 mv64x60_config_pci2mem_windows(bh, bh->hose_b, &si->pci_1, 1,
532 mem_windows);
533 bh->ci->set_pci2regs_window(bh, bh->hose_b, 1,
534 si->phys_reg_base);
535 }
536
537 bh->ci->chip_specific_init(bh, si);
538 mv64x60_pd_fixup(bh, mv64x60_pd_devs, ARRAY_SIZE(mv64x60_pd_devs));
539
540 return 0;
541}
542
543/*
544 * mv64x60_early_init()
545 *
546 * Do some bridge work that must take place before we start messing with
547 * the bridge for real.
548 */
549void __init
550mv64x60_early_init(struct mv64x60_handle *bh, struct mv64x60_setup_info *si)
551{
552 struct pci_controller hose_a, hose_b;
553
554 memset(bh, 0, sizeof(*bh));
555
556 bh->p_base = si->phys_reg_base;
557 bh->v_base = ioremap(bh->p_base, MV64x60_INTERNAL_SPACE_SIZE);
558
559 mv64x60_bridge_pbase = bh->p_base;
560 mv64x60_bridge_vbase = bh->v_base;
561
562 /* Assuming pci mode [reserved] bits 4:5 on 64260 are 0 */
563 bh->pci_mode_a = mv64x60_read(bh, MV64x60_PCI0_MODE) &
564 MV64x60_PCIMODE_MASK;
565 bh->pci_mode_b = mv64x60_read(bh, MV64x60_PCI1_MODE) &
566 MV64x60_PCIMODE_MASK;
567
568 /* Need temporary hose structs to call mv64x60_set_bus() */
569 memset(&hose_a, 0, sizeof(hose_a));
570 memset(&hose_b, 0, sizeof(hose_b));
571 setup_indirect_pci_nomap(&hose_a, bh->v_base + MV64x60_PCI0_CONFIG_ADDR,
572 bh->v_base + MV64x60_PCI0_CONFIG_DATA);
573 setup_indirect_pci_nomap(&hose_b, bh->v_base + MV64x60_PCI1_CONFIG_ADDR,
574 bh->v_base + MV64x60_PCI1_CONFIG_DATA);
575 bh->hose_a = &hose_a;
576 bh->hose_b = &hose_b;
577
578 mv64x60_set_bus(bh, 0, 0);
579 mv64x60_set_bus(bh, 1, 0);
580
581 bh->hose_a = NULL;
582 bh->hose_b = NULL;
583
584 /* Clear bit 0 of PCI addr decode control so PCI->CPU remap 1:1 */
585 mv64x60_clr_bits(bh, MV64x60_PCI0_PCI_DECODE_CNTL, 0x00000001);
586 mv64x60_clr_bits(bh, MV64x60_PCI1_PCI_DECODE_CNTL, 0x00000001);
587
588 /* Bit 12 MUST be 0; set bit 27--don't auto-update cpu remap regs */
589 mv64x60_clr_bits(bh, MV64x60_CPU_CONFIG, (1<<12));
590 mv64x60_set_bits(bh, MV64x60_CPU_CONFIG, (1<<27));
591
592 mv64x60_set_bits(bh, MV64x60_PCI0_TO_RETRY, 0xffff);
593 mv64x60_set_bits(bh, MV64x60_PCI1_TO_RETRY, 0xffff);
594
595 return;
596}
597
598/*
599 *****************************************************************************
600 *
601 * Window Config Routines
602 *
603 *****************************************************************************
604 */
605/*
606 * mv64x60_get_32bit_window()
607 *
608 * Determine the base address and size of a 32-bit window on the bridge.
609 */
610void __init
611mv64x60_get_32bit_window(struct mv64x60_handle *bh, u32 window,
612 u32 *base, u32 *size)
613{
614 u32 val, base_reg, size_reg, base_bits, size_bits;
615 u32 (*get_from_field)(u32 val, u32 num_bits);
616
617 base_reg = bh->ci->window_tab_32bit[window].base_reg;
618
619 if (base_reg != 0) {
620 size_reg = bh->ci->window_tab_32bit[window].size_reg;
621 base_bits = bh->ci->window_tab_32bit[window].base_bits;
622 size_bits = bh->ci->window_tab_32bit[window].size_bits;
623 get_from_field= bh->ci->window_tab_32bit[window].get_from_field;
624
625 val = mv64x60_read(bh, base_reg);
626 *base = get_from_field(val, base_bits);
627
628 if (size_reg != 0) {
629 val = mv64x60_read(bh, size_reg);
630 val = get_from_field(val, size_bits);
631 *size = bh->ci->untranslate_size(*base, val, size_bits);
632 }
633 else
634 *size = 0;
635 }
636 else {
637 *base = 0;
638 *size = 0;
639 }
640
641 pr_debug("get 32bit window: %d, base: 0x%x, size: 0x%x\n",
642 window, *base, *size);
643
644 return;
645}
646
647/*
648 * mv64x60_set_32bit_window()
649 *
650 * Set the base address and size of a 32-bit window on the bridge.
651 */
652void __init
653mv64x60_set_32bit_window(struct mv64x60_handle *bh, u32 window,
654 u32 base, u32 size, u32 other_bits)
655{
656 u32 val, base_reg, size_reg, base_bits, size_bits;
657 u32 (*map_to_field)(u32 val, u32 num_bits);
658
659 pr_debug("set 32bit window: %d, base: 0x%x, size: 0x%x, other: 0x%x\n",
660 window, base, size, other_bits);
661
662 base_reg = bh->ci->window_tab_32bit[window].base_reg;
663
664 if (base_reg != 0) {
665 size_reg = bh->ci->window_tab_32bit[window].size_reg;
666 base_bits = bh->ci->window_tab_32bit[window].base_bits;
667 size_bits = bh->ci->window_tab_32bit[window].size_bits;
668 map_to_field = bh->ci->window_tab_32bit[window].map_to_field;
669
670 val = map_to_field(base, base_bits) | other_bits;
671 mv64x60_write(bh, base_reg, val);
672
673 if (size_reg != 0) {
674 val = bh->ci->translate_size(base, size, size_bits);
675 val = map_to_field(val, size_bits);
676 mv64x60_write(bh, size_reg, val);
677 }
678
679 (void)mv64x60_read(bh, base_reg); /* Flush FIFO */
680 }
681
682 return;
683}
684
685/*
686 * mv64x60_get_64bit_window()
687 *
688 * Determine the base address and size of a 64-bit window on the bridge.
689 */
690void __init
691mv64x60_get_64bit_window(struct mv64x60_handle *bh, u32 window,
692 u32 *base_hi, u32 *base_lo, u32 *size)
693{
694 u32 val, base_lo_reg, size_reg, base_lo_bits, size_bits;
695 u32 (*get_from_field)(u32 val, u32 num_bits);
696
697 base_lo_reg = bh->ci->window_tab_64bit[window].base_lo_reg;
698
699 if (base_lo_reg != 0) {
700 size_reg = bh->ci->window_tab_64bit[window].size_reg;
701 base_lo_bits = bh->ci->window_tab_64bit[window].base_lo_bits;
702 size_bits = bh->ci->window_tab_64bit[window].size_bits;
703 get_from_field= bh->ci->window_tab_64bit[window].get_from_field;
704
705 *base_hi = mv64x60_read(bh,
706 bh->ci->window_tab_64bit[window].base_hi_reg);
707
708 val = mv64x60_read(bh, base_lo_reg);
709 *base_lo = get_from_field(val, base_lo_bits);
710
711 if (size_reg != 0) {
712 val = mv64x60_read(bh, size_reg);
713 val = get_from_field(val, size_bits);
714 *size = bh->ci->untranslate_size(*base_lo, val,
715 size_bits);
716 }
717 else
718 *size = 0;
719 }
720 else {
721 *base_hi = 0;
722 *base_lo = 0;
723 *size = 0;
724 }
725
726 pr_debug("get 64bit window: %d, base hi: 0x%x, base lo: 0x%x, "
727 "size: 0x%x\n", window, *base_hi, *base_lo, *size);
728
729 return;
730}
731
732/*
733 * mv64x60_set_64bit_window()
734 *
735 * Set the base address and size of a 64-bit window on the bridge.
736 */
737void __init
738mv64x60_set_64bit_window(struct mv64x60_handle *bh, u32 window,
739 u32 base_hi, u32 base_lo, u32 size, u32 other_bits)
740{
741 u32 val, base_lo_reg, size_reg, base_lo_bits, size_bits;
742 u32 (*map_to_field)(u32 val, u32 num_bits);
743
744 pr_debug("set 64bit window: %d, base hi: 0x%x, base lo: 0x%x, "
745 "size: 0x%x, other: 0x%x\n",
746 window, base_hi, base_lo, size, other_bits);
747
748 base_lo_reg = bh->ci->window_tab_64bit[window].base_lo_reg;
749
750 if (base_lo_reg != 0) {
751 size_reg = bh->ci->window_tab_64bit[window].size_reg;
752 base_lo_bits = bh->ci->window_tab_64bit[window].base_lo_bits;
753 size_bits = bh->ci->window_tab_64bit[window].size_bits;
754 map_to_field = bh->ci->window_tab_64bit[window].map_to_field;
755
756 mv64x60_write(bh, bh->ci->window_tab_64bit[window].base_hi_reg,
757 base_hi);
758
759 val = map_to_field(base_lo, base_lo_bits) | other_bits;
760 mv64x60_write(bh, base_lo_reg, val);
761
762 if (size_reg != 0) {
763 val = bh->ci->translate_size(base_lo, size, size_bits);
764 val = map_to_field(val, size_bits);
765 mv64x60_write(bh, size_reg, val);
766 }
767
768 (void)mv64x60_read(bh, base_lo_reg); /* Flush FIFO */
769 }
770
771 return;
772}
773
774/*
775 * mv64x60_mask()
776 *
777 * Take the high-order 'num_bits' of 'val' & mask off low bits.
778 */
779u32 __init
780mv64x60_mask(u32 val, u32 num_bits)
781{
782 return val & (0xffffffff << (32 - num_bits));
783}
784
785/*
786 * mv64x60_shift_left()
787 *
788 * Take the low-order 'num_bits' of 'val', shift left to align at bit 31 (MSB).
789 */
790u32 __init
791mv64x60_shift_left(u32 val, u32 num_bits)
792{
793 return val << (32 - num_bits);
794}
795
796/*
797 * mv64x60_shift_right()
798 *
799 * Take the high-order 'num_bits' of 'val', shift right to align at bit 0 (LSB).
800 */
801u32 __init
802mv64x60_shift_right(u32 val, u32 num_bits)
803{
804 return val >> (32 - num_bits);
805}
806
807/*
808 *****************************************************************************
809 *
810 * Chip Identification Routines
811 *
812 *****************************************************************************
813 */
814/*
815 * mv64x60_get_type()
816 *
817 * Determine the type of bridge chip we have.
818 */
819int __init
820mv64x60_get_type(struct mv64x60_handle *bh)
821{
822 struct pci_controller hose;
823 u16 val;
824 u8 save_exclude;
825
826 memset(&hose, 0, sizeof(hose));
827 setup_indirect_pci_nomap(&hose, bh->v_base + MV64x60_PCI0_CONFIG_ADDR,
828 bh->v_base + MV64x60_PCI0_CONFIG_DATA);
829
830 save_exclude = mv64x60_pci_exclude_bridge;
831 mv64x60_pci_exclude_bridge = 0;
832 /* Sanity check of bridge's Vendor ID */
833 early_read_config_word(&hose, 0, PCI_DEVFN(0, 0), PCI_VENDOR_ID, &val);
834
835 if (val != PCI_VENDOR_ID_MARVELL) {
836 mv64x60_pci_exclude_bridge = save_exclude;
837 return -1;
838 }
839
840 /* Get the revision of the chip */
841 early_read_config_word(&hose, 0, PCI_DEVFN(0, 0), PCI_CLASS_REVISION,
842 &val);
843 bh->rev = (u32)(val & 0xff);
844
845 /* Figure out the type of Marvell bridge it is */
846 early_read_config_word(&hose, 0, PCI_DEVFN(0, 0), PCI_DEVICE_ID, &val);
847 mv64x60_pci_exclude_bridge = save_exclude;
848
849 switch (val) {
850 case PCI_DEVICE_ID_MARVELL_GT64260:
851 switch (bh->rev) {
852 case GT64260_REV_A:
853 bh->type = MV64x60_TYPE_GT64260A;
854 break;
855
856 default:
857 printk(KERN_WARNING "Unsupported GT64260 rev %04x\n",
858 bh->rev);
859 /* Assume its similar to a 'B' rev and fallthru */
860 case GT64260_REV_B:
861 bh->type = MV64x60_TYPE_GT64260B;
862 break;
863 }
864 break;
865
866 case PCI_DEVICE_ID_MARVELL_MV64360:
867 /* Marvell won't tell me how to distinguish a 64361 & 64362 */
868 bh->type = MV64x60_TYPE_MV64360;
869 break;
870
871 case PCI_DEVICE_ID_MARVELL_MV64460:
872 bh->type = MV64x60_TYPE_MV64460;
873 break;
874
875 default:
876 printk(KERN_ERR "Unknown Marvell bridge type %04x\n", val);
877 return -1;
878 }
879
880 /* Hang onto bridge type & rev for PIC code */
881 mv64x60_bridge_type = bh->type;
882 mv64x60_bridge_rev = bh->rev;
883
884 return 0;
885}
886
887/*
888 * mv64x60_setup_for_chip()
889 *
890 * Set 'bh' to use the proper set of routine for the bridge chip that we have.
891 */
892int __init
893mv64x60_setup_for_chip(struct mv64x60_handle *bh)
894{
895 int rc = 0;
896
897 /* Set up chip-specific info based on the chip/bridge type */
898 switch(bh->type) {
899 case MV64x60_TYPE_GT64260A:
900 bh->ci = &gt64260a_ci;
901 break;
902
903 case MV64x60_TYPE_GT64260B:
904 bh->ci = &gt64260b_ci;
905 break;
906
907 case MV64x60_TYPE_MV64360:
908 bh->ci = &mv64360_ci;
909 break;
910
911 case MV64x60_TYPE_MV64460:
912 bh->ci = &mv64460_ci;
913 break;
914
915 case MV64x60_TYPE_INVALID:
916 default:
917 if (ppc_md.progress)
918 ppc_md.progress("mv64x60: Unsupported bridge", 0x0);
919 printk(KERN_ERR "mv64x60: Unsupported bridge\n");
920 rc = -1;
921 }
922
923 return rc;
924}
925
926/*
927 * mv64x60_get_bridge_vbase()
928 *
929 * Return the virtual address of the bridge's registers.
930 */
931void *
932mv64x60_get_bridge_vbase(void)
933{
934 return mv64x60_bridge_vbase;
935}
936
937/*
938 * mv64x60_get_bridge_type()
939 *
940 * Return the type of bridge on the platform.
941 */
942u32
943mv64x60_get_bridge_type(void)
944{
945 return mv64x60_bridge_type;
946}
947
948/*
949 * mv64x60_get_bridge_rev()
950 *
951 * Return the revision of the bridge on the platform.
952 */
953u32
954mv64x60_get_bridge_rev(void)
955{
956 return mv64x60_bridge_rev;
957}
958
959/*
960 *****************************************************************************
961 *
962 * System Memory Window Related Routines
963 *
964 *****************************************************************************
965 */
966/*
967 * mv64x60_get_mem_size()
968 *
969 * Calculate the amount of memory that the memory controller is set up for.
970 * This should only be used by board-specific code if there is no other
971 * way to determine the amount of memory in the system.
972 */
973u32 __init
974mv64x60_get_mem_size(u32 bridge_base, u32 chip_type)
975{
976 struct mv64x60_handle bh;
977 u32 mem_windows[MV64x60_CPU2MEM_WINDOWS][2];
978 u32 rc = 0;
979
980 memset(&bh, 0, sizeof(bh));
981
982 bh.type = chip_type;
983 bh.v_base = (void *)bridge_base;
984
985 if (!mv64x60_setup_for_chip(&bh)) {
986 mv64x60_get_mem_windows(&bh, mem_windows);
987 rc = mv64x60_calc_mem_size(&bh, mem_windows);
988 }
989
990 return rc;
991}
992
993/*
994 * mv64x60_get_mem_windows()
995 *
996 * Get the values in the memory controller & return in the 'mem_windows' array.
997 */
998void __init
999mv64x60_get_mem_windows(struct mv64x60_handle *bh,
1000 u32 mem_windows[MV64x60_CPU2MEM_WINDOWS][2])
1001{
1002 u32 i, win;
1003
1004 for (win=MV64x60_CPU2MEM_0_WIN,i=0;win<=MV64x60_CPU2MEM_3_WIN;win++,i++)
1005 if (bh->ci->is_enabled_32bit(bh, win))
1006 mv64x60_get_32bit_window(bh, win,
1007 &mem_windows[i][0], &mem_windows[i][1]);
1008 else {
1009 mem_windows[i][0] = 0;
1010 mem_windows[i][1] = 0;
1011 }
1012
1013 return;
1014}
1015
1016/*
1017 * mv64x60_calc_mem_size()
1018 *
1019 * Using the memory controller register values in 'mem_windows', determine
1020 * how much memory it is set up for.
1021 */
1022u32 __init
1023mv64x60_calc_mem_size(struct mv64x60_handle *bh,
1024 u32 mem_windows[MV64x60_CPU2MEM_WINDOWS][2])
1025{
1026 u32 i, total = 0;
1027
1028 for (i=0; i<MV64x60_CPU2MEM_WINDOWS; i++)
1029 total += mem_windows[i][1];
1030
1031 return total;
1032}
1033
1034/*
1035 *****************************************************************************
1036 *
1037 * CPU->System MEM, PCI Config Routines
1038 *
1039 *****************************************************************************
1040 */
1041/*
1042 * mv64x60_config_cpu2mem_windows()
1043 *
1044 * Configure CPU->Memory windows on the bridge.
1045 */
1046static u32 prot_tab[] __initdata = {
1047 MV64x60_CPU_PROT_0_WIN, MV64x60_CPU_PROT_1_WIN,
1048 MV64x60_CPU_PROT_2_WIN, MV64x60_CPU_PROT_3_WIN
1049};
1050
1051static u32 cpu_snoop_tab[] __initdata = {
1052 MV64x60_CPU_SNOOP_0_WIN, MV64x60_CPU_SNOOP_1_WIN,
1053 MV64x60_CPU_SNOOP_2_WIN, MV64x60_CPU_SNOOP_3_WIN
1054};
1055
1056void __init
1057mv64x60_config_cpu2mem_windows(struct mv64x60_handle *bh,
1058 struct mv64x60_setup_info *si,
1059 u32 mem_windows[MV64x60_CPU2MEM_WINDOWS][2])
1060{
1061 u32 i, win;
1062
1063 /* Set CPU protection & snoop windows */
1064 for (win=MV64x60_CPU2MEM_0_WIN,i=0;win<=MV64x60_CPU2MEM_3_WIN;win++,i++)
1065 if (bh->ci->is_enabled_32bit(bh, win)) {
1066 mv64x60_set_32bit_window(bh, prot_tab[i],
1067 mem_windows[i][0], mem_windows[i][1],
1068 si->cpu_prot_options[i]);
1069 bh->ci->enable_window_32bit(bh, prot_tab[i]);
1070
1071 if (bh->ci->window_tab_32bit[cpu_snoop_tab[i]].
1072 base_reg != 0) {
1073 mv64x60_set_32bit_window(bh, cpu_snoop_tab[i],
1074 mem_windows[i][0], mem_windows[i][1],
1075 si->cpu_snoop_options[i]);
1076 bh->ci->enable_window_32bit(bh,
1077 cpu_snoop_tab[i]);
1078 }
1079
1080 }
1081
1082 return;
1083}
1084
1085/*
1086 * mv64x60_config_cpu2pci_windows()
1087 *
1088 * Configure the CPU->PCI windows for one of the PCI buses.
1089 */
1090static u32 win_tab[2][4] __initdata = {
1091 { MV64x60_CPU2PCI0_IO_WIN, MV64x60_CPU2PCI0_MEM_0_WIN,
1092 MV64x60_CPU2PCI0_MEM_1_WIN, MV64x60_CPU2PCI0_MEM_2_WIN },
1093 { MV64x60_CPU2PCI1_IO_WIN, MV64x60_CPU2PCI1_MEM_0_WIN,
1094 MV64x60_CPU2PCI1_MEM_1_WIN, MV64x60_CPU2PCI1_MEM_2_WIN },
1095};
1096
1097static u32 remap_tab[2][4] __initdata = {
1098 { MV64x60_CPU2PCI0_IO_REMAP_WIN, MV64x60_CPU2PCI0_MEM_0_REMAP_WIN,
1099 MV64x60_CPU2PCI0_MEM_1_REMAP_WIN, MV64x60_CPU2PCI0_MEM_2_REMAP_WIN },
1100 { MV64x60_CPU2PCI1_IO_REMAP_WIN, MV64x60_CPU2PCI1_MEM_0_REMAP_WIN,
1101 MV64x60_CPU2PCI1_MEM_1_REMAP_WIN, MV64x60_CPU2PCI1_MEM_2_REMAP_WIN }
1102};
1103
1104void __init
1105mv64x60_config_cpu2pci_windows(struct mv64x60_handle *bh,
1106 struct mv64x60_pci_info *pi, u32 bus)
1107{
1108 int i;
1109
1110 if (pi->pci_io.size > 0) {
1111 mv64x60_set_32bit_window(bh, win_tab[bus][0],
1112 pi->pci_io.cpu_base, pi->pci_io.size, pi->pci_io.swap);
1113 mv64x60_set_32bit_window(bh, remap_tab[bus][0],
1114 pi->pci_io.pci_base_lo, 0, 0);
1115 bh->ci->enable_window_32bit(bh, win_tab[bus][0]);
1116 }
1117 else /* Actually, the window should already be disabled */
1118 bh->ci->disable_window_32bit(bh, win_tab[bus][0]);
1119
1120 for (i=0; i<3; i++)
1121 if (pi->pci_mem[i].size > 0) {
1122 mv64x60_set_32bit_window(bh, win_tab[bus][i+1],
1123 pi->pci_mem[i].cpu_base, pi->pci_mem[i].size,
1124 pi->pci_mem[i].swap);
1125 mv64x60_set_64bit_window(bh, remap_tab[bus][i+1],
1126 pi->pci_mem[i].pci_base_hi,
1127 pi->pci_mem[i].pci_base_lo, 0, 0);
1128 bh->ci->enable_window_32bit(bh, win_tab[bus][i+1]);
1129 }
1130 else /* Actually, the window should already be disabled */
1131 bh->ci->disable_window_32bit(bh, win_tab[bus][i+1]);
1132
1133 return;
1134}
1135
1136/*
1137 *****************************************************************************
1138 *
1139 * PCI->System MEM Config Routines
1140 *
1141 *****************************************************************************
1142 */
1143/*
1144 * mv64x60_config_pci2mem_windows()
1145 *
1146 * Configure the PCI->Memory windows on the bridge.
1147 */
1148static u32 pci_acc_tab[2][4] __initdata = {
1149 { MV64x60_PCI02MEM_ACC_CNTL_0_WIN, MV64x60_PCI02MEM_ACC_CNTL_1_WIN,
1150 MV64x60_PCI02MEM_ACC_CNTL_2_WIN, MV64x60_PCI02MEM_ACC_CNTL_3_WIN },
1151 { MV64x60_PCI12MEM_ACC_CNTL_0_WIN, MV64x60_PCI12MEM_ACC_CNTL_1_WIN,
1152 MV64x60_PCI12MEM_ACC_CNTL_2_WIN, MV64x60_PCI12MEM_ACC_CNTL_3_WIN }
1153};
1154
1155static u32 pci_snoop_tab[2][4] __initdata = {
1156 { MV64x60_PCI02MEM_SNOOP_0_WIN, MV64x60_PCI02MEM_SNOOP_1_WIN,
1157 MV64x60_PCI02MEM_SNOOP_2_WIN, MV64x60_PCI02MEM_SNOOP_3_WIN },
1158 { MV64x60_PCI12MEM_SNOOP_0_WIN, MV64x60_PCI12MEM_SNOOP_1_WIN,
1159 MV64x60_PCI12MEM_SNOOP_2_WIN, MV64x60_PCI12MEM_SNOOP_3_WIN }
1160};
1161
1162static u32 pci_size_tab[2][4] __initdata = {
1163 { MV64x60_PCI0_MEM_0_SIZE, MV64x60_PCI0_MEM_1_SIZE,
1164 MV64x60_PCI0_MEM_2_SIZE, MV64x60_PCI0_MEM_3_SIZE },
1165 { MV64x60_PCI1_MEM_0_SIZE, MV64x60_PCI1_MEM_1_SIZE,
1166 MV64x60_PCI1_MEM_2_SIZE, MV64x60_PCI1_MEM_3_SIZE }
1167};
1168
1169void __init
1170mv64x60_config_pci2mem_windows(struct mv64x60_handle *bh,
1171 struct pci_controller *hose, struct mv64x60_pci_info *pi,
1172 u32 bus, u32 mem_windows[MV64x60_CPU2MEM_WINDOWS][2])
1173{
1174 u32 i, win;
1175
1176 /*
1177 * Set the access control, snoop, BAR size, and window base addresses.
1178 * PCI->MEM windows base addresses will match exactly what the
1179 * CPU->MEM windows are.
1180 */
1181 for (win=MV64x60_CPU2MEM_0_WIN,i=0;win<=MV64x60_CPU2MEM_3_WIN;win++,i++)
1182 if (bh->ci->is_enabled_32bit(bh, win)) {
1183 mv64x60_set_64bit_window(bh,
1184 pci_acc_tab[bus][i], 0,
1185 mem_windows[i][0], mem_windows[i][1],
1186 pi->acc_cntl_options[i]);
1187 bh->ci->enable_window_64bit(bh, pci_acc_tab[bus][i]);
1188
1189 if (bh->ci->window_tab_64bit[
1190 pci_snoop_tab[bus][i]].base_lo_reg != 0) {
1191
1192 mv64x60_set_64bit_window(bh,
1193 pci_snoop_tab[bus][i], 0,
1194 mem_windows[i][0], mem_windows[i][1],
1195 pi->snoop_options[i]);
1196 bh->ci->enable_window_64bit(bh,
1197 pci_snoop_tab[bus][i]);
1198 }
1199
1200 bh->ci->set_pci2mem_window(hose, bus, i,
1201 mem_windows[i][0]);
1202 mv64x60_write(bh, pci_size_tab[bus][i],
1203 mv64x60_mask(mem_windows[i][1] - 1, 20));
1204
1205 /* Enable the window */
1206 mv64x60_clr_bits(bh, ((bus == 0) ?
1207 MV64x60_PCI0_BAR_ENABLE :
1208 MV64x60_PCI1_BAR_ENABLE), (1 << i));
1209 }
1210
1211 return;
1212}
1213
1214/*
1215 *****************************************************************************
1216 *
1217 * Hose & Resource Alloc/Init Routines
1218 *
1219 *****************************************************************************
1220 */
1221/*
1222 * mv64x60_alloc_hoses()
1223 *
1224 * Allocate the PCI hose structures for the bridge's PCI buses.
1225 */
1226void __init
1227mv64x60_alloc_hose(struct mv64x60_handle *bh, u32 cfg_addr, u32 cfg_data,
1228 struct pci_controller **hose)
1229{
1230 *hose = pcibios_alloc_controller();
1231 setup_indirect_pci_nomap(*hose, bh->v_base + cfg_addr,
1232 bh->v_base + cfg_data);
1233 return;
1234}
1235
1236/*
1237 * mv64x60_config_resources()
1238 *
1239 * Calculate the offsets, etc. for the hose structures to reflect all of
1240 * the address remapping that happens as you go from CPU->PCI and PCI->MEM.
1241 */
1242void __init
1243mv64x60_config_resources(struct pci_controller *hose,
1244 struct mv64x60_pci_info *pi, u32 io_base)
1245{
1246 int i;
1247 /* 2 hoses; 4 resources/hose; string <= 64 bytes */
1248 static char s[2][4][64];
1249
1250 if (pi->pci_io.size != 0) {
1251 sprintf(s[hose->index][0], "PCI hose %d I/O Space",
1252 hose->index);
1253 pci_init_resource(&hose->io_resource, io_base - isa_io_base,
1254 io_base - isa_io_base + pi->pci_io.size - 1,
1255 IORESOURCE_IO, s[hose->index][0]);
1256 hose->io_space.start = pi->pci_io.pci_base_lo;
1257 hose->io_space.end = pi->pci_io.pci_base_lo + pi->pci_io.size-1;
1258 hose->io_base_phys = pi->pci_io.cpu_base;
1259 hose->io_base_virt = (void *)isa_io_base;
1260 }
1261
1262 for (i=0; i<3; i++)
1263 if (pi->pci_mem[i].size != 0) {
1264 sprintf(s[hose->index][i+1], "PCI hose %d MEM Space %d",
1265 hose->index, i);
1266 pci_init_resource(&hose->mem_resources[i],
1267 pi->pci_mem[i].cpu_base,
1268 pi->pci_mem[i].cpu_base + pi->pci_mem[i].size-1,
1269 IORESOURCE_MEM, s[hose->index][i+1]);
1270 }
1271
1272 hose->mem_space.end = pi->pci_mem[0].pci_base_lo +
1273 pi->pci_mem[0].size - 1;
1274 hose->pci_mem_offset = pi->pci_mem[0].cpu_base -
1275 pi->pci_mem[0].pci_base_lo;
1276 return;
1277}
1278
1279/*
1280 * mv64x60_config_pci_params()
1281 *
1282 * Configure a hose's PCI config space parameters.
1283 */
1284void __init
1285mv64x60_config_pci_params(struct pci_controller *hose,
1286 struct mv64x60_pci_info *pi)
1287{
1288 u32 devfn;
1289 u16 u16_val;
1290 u8 save_exclude;
1291
1292 devfn = PCI_DEVFN(0,0);
1293
1294 save_exclude = mv64x60_pci_exclude_bridge;
1295 mv64x60_pci_exclude_bridge = 0;
1296
1297 /* Set class code to indicate host bridge */
1298 u16_val = PCI_CLASS_BRIDGE_HOST; /* 0x0600 (host bridge) */
1299 early_write_config_word(hose, 0, devfn, PCI_CLASS_DEVICE, u16_val);
1300
1301 /* Enable bridge to be PCI master & respond to PCI MEM cycles */
1302 early_read_config_word(hose, 0, devfn, PCI_COMMAND, &u16_val);
1303 u16_val &= ~(PCI_COMMAND_IO | PCI_COMMAND_INVALIDATE |
1304 PCI_COMMAND_PARITY | PCI_COMMAND_SERR | PCI_COMMAND_FAST_BACK);
1305 u16_val |= pi->pci_cmd_bits | PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY;
1306 early_write_config_word(hose, 0, devfn, PCI_COMMAND, u16_val);
1307
1308 /* Set latency timer, cache line size, clear BIST */
1309 u16_val = (pi->latency_timer << 8) | (L1_CACHE_LINE_SIZE >> 2);
1310 early_write_config_word(hose, 0, devfn, PCI_CACHE_LINE_SIZE, u16_val);
1311
1312 mv64x60_pci_exclude_bridge = save_exclude;
1313 return;
1314}
1315
1316/*
1317 *****************************************************************************
1318 *
1319 * PCI Related Routine
1320 *
1321 *****************************************************************************
1322 */
1323/*
1324 * mv64x60_set_bus()
1325 *
1326 * Set the bus number for the hose directly under the bridge.
1327 */
1328void __init
1329mv64x60_set_bus(struct mv64x60_handle *bh, u32 bus, u32 child_bus)
1330{
1331 struct pci_controller *hose;
1332 u32 pci_mode, p2p_cfg, pci_cfg_offset, val;
1333 u8 save_exclude;
1334
1335 if (bus == 0) {
1336 pci_mode = bh->pci_mode_a;
1337 p2p_cfg = MV64x60_PCI0_P2P_CONFIG;
1338 pci_cfg_offset = 0x64;
1339 hose = bh->hose_a;
1340 }
1341 else {
1342 pci_mode = bh->pci_mode_b;
1343 p2p_cfg = MV64x60_PCI1_P2P_CONFIG;
1344 pci_cfg_offset = 0xe4;
1345 hose = bh->hose_b;
1346 }
1347
1348 child_bus &= 0xff;
1349 val = mv64x60_read(bh, p2p_cfg);
1350
1351 if (pci_mode == MV64x60_PCIMODE_CONVENTIONAL) {
1352 val &= 0xe0000000; /* Force dev num to 0, turn off P2P bridge */
1353 val |= (child_bus << 16) | 0xff;
1354 mv64x60_write(bh, p2p_cfg, val);
1355 (void)mv64x60_read(bh, p2p_cfg); /* Flush FIFO */
1356 }
1357 else { /* PCI-X */
1358 /*
1359 * Need to use the current bus/dev number (that's in the
1360 * P2P CONFIG reg) to access the bridge's pci config space.
1361 */
1362 save_exclude = mv64x60_pci_exclude_bridge;
1363 mv64x60_pci_exclude_bridge = 0;
1364 early_write_config_dword(hose, (val & 0x00ff0000) >> 16,
1365 PCI_DEVFN(((val & 0x1f000000) >> 24), 0),
1366 pci_cfg_offset, child_bus << 8);
1367 mv64x60_pci_exclude_bridge = save_exclude;
1368 }
1369
1370 return;
1371}
1372
1373/*
1374 * mv64x60_pci_exclude_device()
1375 *
1376 * This routine is used to make the bridge not appear when the
1377 * PCI subsystem is accessing PCI devices (in PCI config space).
1378 */
1379int
1380mv64x60_pci_exclude_device(u8 bus, u8 devfn)
1381{
1382 struct pci_controller *hose;
1383
1384 hose = pci_bus_to_hose(bus);
1385
1386 /* Skip slot 0 on both hoses */
1387 if ((mv64x60_pci_exclude_bridge == 1) && (PCI_SLOT(devfn) == 0) &&
1388 (hose->first_busno == bus))
1389
1390 return PCIBIOS_DEVICE_NOT_FOUND;
1391 else
1392 return PCIBIOS_SUCCESSFUL;
1393} /* mv64x60_pci_exclude_device() */
1394
1395/*
1396 *****************************************************************************
1397 *
1398 * Platform Device Routines
1399 *
1400 *****************************************************************************
1401 */
1402
1403/*
1404 * mv64x60_pd_fixup()
1405 *
1406 * Need to add the base addr of where the bridge's regs are mapped in the
1407 * physical addr space so drivers can ioremap() them.
1408 */
1409void __init
1410mv64x60_pd_fixup(struct mv64x60_handle *bh, struct platform_device *pd_devs[],
1411 u32 entries)
1412{
1413 struct resource *r;
1414 u32 i, j;
1415
1416 for (i=0; i<entries; i++) {
1417 j = 0;
1418
1419 while ((r = platform_get_resource(pd_devs[i],IORESOURCE_MEM,j))
1420 != NULL) {
1421
1422 r->start += bh->p_base;
1423 r->end += bh->p_base;
1424 j++;
1425 }
1426 }
1427
1428 return;
1429}
1430
1431/*
1432 * mv64x60_add_pds()
1433 *
1434 * Add the mv64x60 platform devices to the list of platform devices.
1435 */
1436static int __init
1437mv64x60_add_pds(void)
1438{
1439 return platform_add_devices(mv64x60_pd_devs,
1440 ARRAY_SIZE(mv64x60_pd_devs));
1441}
1442arch_initcall(mv64x60_add_pds);
1443
1444/*
1445 *****************************************************************************
1446 *
1447 * GT64260-Specific Routines
1448 *
1449 *****************************************************************************
1450 */
1451/*
1452 * gt64260_translate_size()
1453 *
1454 * On the GT64260, the size register is really the "top" address of the window.
1455 */
1456static u32 __init
1457gt64260_translate_size(u32 base, u32 size, u32 num_bits)
1458{
1459 return base + mv64x60_mask(size - 1, num_bits);
1460}
1461
1462/*
1463 * gt64260_untranslate_size()
1464 *
1465 * Translate the top address of a window into a window size.
1466 */
1467static u32 __init
1468gt64260_untranslate_size(u32 base, u32 size, u32 num_bits)
1469{
1470 if (size >= base)
1471 size = size - base + (1 << (32 - num_bits));
1472 else
1473 size = 0;
1474
1475 return size;
1476}
1477
1478/*
1479 * gt64260_set_pci2mem_window()
1480 *
1481 * The PCI->MEM window registers are actually in PCI config space so need
1482 * to set them by setting the correct config space BARs.
1483 */
1484static u32 gt64260_reg_addrs[2][4] __initdata = {
1485 { 0x10, 0x14, 0x18, 0x1c }, { 0x90, 0x94, 0x98, 0x9c }
1486};
1487
1488static void __init
1489gt64260_set_pci2mem_window(struct pci_controller *hose, u32 bus, u32 window,
1490 u32 base)
1491{
1492 u8 save_exclude;
1493
1494 pr_debug("set pci->mem window: %d, hose: %d, base: 0x%x\n", window,
1495 hose->index, base);
1496
1497 save_exclude = mv64x60_pci_exclude_bridge;
1498 mv64x60_pci_exclude_bridge = 0;
1499 early_write_config_dword(hose, 0, PCI_DEVFN(0, 0),
1500 gt64260_reg_addrs[bus][window], mv64x60_mask(base, 20) | 0x8);
1501 mv64x60_pci_exclude_bridge = save_exclude;
1502
1503 return;
1504}
1505
1506/*
1507 * gt64260_set_pci2regs_window()
1508 *
1509 * Set where the bridge's registers appear in PCI MEM space.
1510 */
1511static u32 gt64260_offset[2] __initdata = {0x20, 0xa0};
1512
1513static void __init
1514gt64260_set_pci2regs_window(struct mv64x60_handle *bh,
1515 struct pci_controller *hose, u32 bus, u32 base)
1516{
1517 u8 save_exclude;
1518
1519 pr_debug("set pci->internal regs hose: %d, base: 0x%x\n", hose->index,
1520 base);
1521
1522 save_exclude = mv64x60_pci_exclude_bridge;
1523 mv64x60_pci_exclude_bridge = 0;
1524 early_write_config_dword(hose, 0, PCI_DEVFN(0,0), gt64260_offset[bus],
1525 (base << 16));
1526 mv64x60_pci_exclude_bridge = save_exclude;
1527
1528 return;
1529}
1530
1531/*
1532 * gt64260_is_enabled_32bit()
1533 *
1534 * On a GT64260, a window is enabled iff its top address is >= to its base
1535 * address.
1536 */
1537static u32 __init
1538gt64260_is_enabled_32bit(struct mv64x60_handle *bh, u32 window)
1539{
1540 u32 rc = 0;
1541
1542 if ((gt64260_32bit_windows[window].base_reg != 0) &&
1543 (gt64260_32bit_windows[window].size_reg != 0) &&
1544 ((mv64x60_read(bh, gt64260_32bit_windows[window].size_reg) &
1545 ((1 << gt64260_32bit_windows[window].size_bits) - 1)) >=
1546 (mv64x60_read(bh, gt64260_32bit_windows[window].base_reg) &
1547 ((1 << gt64260_32bit_windows[window].base_bits) - 1))))
1548
1549 rc = 1;
1550
1551 return rc;
1552}
1553
1554/*
1555 * gt64260_enable_window_32bit()
1556 *
1557 * On the GT64260, a window is enabled iff the top address is >= to the base
1558 * address of the window. Since the window has already been configured by
1559 * the time this routine is called, we have nothing to do here.
1560 */
1561static void __init
1562gt64260_enable_window_32bit(struct mv64x60_handle *bh, u32 window)
1563{
1564 pr_debug("enable 32bit window: %d\n", window);
1565 return;
1566}
1567
1568/*
1569 * gt64260_disable_window_32bit()
1570 *
1571 * On a GT64260, you disable a window by setting its top address to be less
1572 * than its base address.
1573 */
1574static void __init
1575gt64260_disable_window_32bit(struct mv64x60_handle *bh, u32 window)
1576{
1577 pr_debug("disable 32bit window: %d, base_reg: 0x%x, size_reg: 0x%x\n",
1578 window, gt64260_32bit_windows[window].base_reg,
1579 gt64260_32bit_windows[window].size_reg);
1580
1581 if ((gt64260_32bit_windows[window].base_reg != 0) &&
1582 (gt64260_32bit_windows[window].size_reg != 0)) {
1583
1584 /* To disable, make bottom reg higher than top reg */
1585 mv64x60_write(bh, gt64260_32bit_windows[window].base_reg,0xfff);
1586 mv64x60_write(bh, gt64260_32bit_windows[window].size_reg, 0);
1587 }
1588
1589 return;
1590}
1591
1592/*
1593 * gt64260_enable_window_64bit()
1594 *
1595 * On the GT64260, a window is enabled iff the top address is >= to the base
1596 * address of the window. Since the window has already been configured by
1597 * the time this routine is called, we have nothing to do here.
1598 */
1599static void __init
1600gt64260_enable_window_64bit(struct mv64x60_handle *bh, u32 window)
1601{
1602 pr_debug("enable 64bit window: %d\n", window);
1603 return; /* Enabled when window configured (i.e., when top >= base) */
1604}
1605
1606/*
1607 * gt64260_disable_window_64bit()
1608 *
1609 * On a GT64260, you disable a window by setting its top address to be less
1610 * than its base address.
1611 */
1612static void __init
1613gt64260_disable_window_64bit(struct mv64x60_handle *bh, u32 window)
1614{
1615 pr_debug("disable 64bit window: %d, base_reg: 0x%x, size_reg: 0x%x\n",
1616 window, gt64260_64bit_windows[window].base_lo_reg,
1617 gt64260_64bit_windows[window].size_reg);
1618
1619 if ((gt64260_64bit_windows[window].base_lo_reg != 0) &&
1620 (gt64260_64bit_windows[window].size_reg != 0)) {
1621
1622 /* To disable, make bottom reg higher than top reg */
1623 mv64x60_write(bh, gt64260_64bit_windows[window].base_lo_reg,
1624 0xfff);
1625 mv64x60_write(bh, gt64260_64bit_windows[window].base_hi_reg, 0);
1626 mv64x60_write(bh, gt64260_64bit_windows[window].size_reg, 0);
1627 }
1628
1629 return;
1630}
1631
1632/*
1633 * gt64260_disable_all_windows()
1634 *
1635 * The GT64260 has several windows that aren't represented in the table of
1636 * windows at the top of this file. This routine turns all of them off
1637 * except for the memory controller windows, of course.
1638 */
1639static void __init
1640gt64260_disable_all_windows(struct mv64x60_handle *bh,
1641 struct mv64x60_setup_info *si)
1642{
1643 u32 i, preserve;
1644
1645 /* Disable 32bit windows (don't disable cpu->mem windows) */
1646 for (i=MV64x60_CPU2DEV_0_WIN; i<MV64x60_32BIT_WIN_COUNT; i++) {
1647 if (i < 32)
1648 preserve = si->window_preserve_mask_32_lo & (1 << i);
1649 else
1650 preserve = si->window_preserve_mask_32_hi & (1<<(i-32));
1651
1652 if (!preserve)
1653 gt64260_disable_window_32bit(bh, i);
1654 }
1655
1656 /* Disable 64bit windows */
1657 for (i=0; i<MV64x60_64BIT_WIN_COUNT; i++)
1658 if (!(si->window_preserve_mask_64 & (1<<i)))
1659 gt64260_disable_window_64bit(bh, i);
1660
1661 /* Turn off cpu protection windows not in gt64260_32bit_windows[] */
1662 mv64x60_write(bh, GT64260_CPU_PROT_BASE_4, 0xfff);
1663 mv64x60_write(bh, GT64260_CPU_PROT_SIZE_4, 0);
1664 mv64x60_write(bh, GT64260_CPU_PROT_BASE_5, 0xfff);
1665 mv64x60_write(bh, GT64260_CPU_PROT_SIZE_5, 0);
1666 mv64x60_write(bh, GT64260_CPU_PROT_BASE_6, 0xfff);
1667 mv64x60_write(bh, GT64260_CPU_PROT_SIZE_6, 0);
1668 mv64x60_write(bh, GT64260_CPU_PROT_BASE_7, 0xfff);
1669 mv64x60_write(bh, GT64260_CPU_PROT_SIZE_7, 0);
1670
1671 /* Turn off PCI->MEM access cntl wins not in gt64260_64bit_windows[] */
1672 mv64x60_write(bh, MV64x60_PCI0_ACC_CNTL_4_BASE_LO, 0xfff);
1673 mv64x60_write(bh, MV64x60_PCI0_ACC_CNTL_4_BASE_HI, 0);
1674 mv64x60_write(bh, MV64x60_PCI0_ACC_CNTL_4_SIZE, 0);
1675 mv64x60_write(bh, MV64x60_PCI0_ACC_CNTL_5_BASE_LO, 0xfff);
1676 mv64x60_write(bh, MV64x60_PCI0_ACC_CNTL_5_BASE_HI, 0);
1677 mv64x60_write(bh, MV64x60_PCI0_ACC_CNTL_5_SIZE, 0);
1678 mv64x60_write(bh, GT64260_PCI0_ACC_CNTL_6_BASE_LO, 0xfff);
1679 mv64x60_write(bh, GT64260_PCI0_ACC_CNTL_6_BASE_HI, 0);
1680 mv64x60_write(bh, GT64260_PCI0_ACC_CNTL_6_SIZE, 0);
1681 mv64x60_write(bh, GT64260_PCI0_ACC_CNTL_7_BASE_LO, 0xfff);
1682 mv64x60_write(bh, GT64260_PCI0_ACC_CNTL_7_BASE_HI, 0);
1683 mv64x60_write(bh, GT64260_PCI0_ACC_CNTL_7_SIZE, 0);
1684
1685 mv64x60_write(bh, MV64x60_PCI1_ACC_CNTL_4_BASE_LO, 0xfff);
1686 mv64x60_write(bh, MV64x60_PCI1_ACC_CNTL_4_BASE_HI, 0);
1687 mv64x60_write(bh, MV64x60_PCI1_ACC_CNTL_4_SIZE, 0);
1688 mv64x60_write(bh, MV64x60_PCI1_ACC_CNTL_5_BASE_LO, 0xfff);
1689 mv64x60_write(bh, MV64x60_PCI1_ACC_CNTL_5_BASE_HI, 0);
1690 mv64x60_write(bh, MV64x60_PCI1_ACC_CNTL_5_SIZE, 0);
1691 mv64x60_write(bh, GT64260_PCI1_ACC_CNTL_6_BASE_LO, 0xfff);
1692 mv64x60_write(bh, GT64260_PCI1_ACC_CNTL_6_BASE_HI, 0);
1693 mv64x60_write(bh, GT64260_PCI1_ACC_CNTL_6_SIZE, 0);
1694 mv64x60_write(bh, GT64260_PCI1_ACC_CNTL_7_BASE_LO, 0xfff);
1695 mv64x60_write(bh, GT64260_PCI1_ACC_CNTL_7_BASE_HI, 0);
1696 mv64x60_write(bh, GT64260_PCI1_ACC_CNTL_7_SIZE, 0);
1697
1698 /* Disable all PCI-><whatever> windows */
1699 mv64x60_set_bits(bh, MV64x60_PCI0_BAR_ENABLE, 0x07fffdff);
1700 mv64x60_set_bits(bh, MV64x60_PCI1_BAR_ENABLE, 0x07fffdff);
1701
1702 /*
1703 * Some firmwares enable a bunch of intr sources
1704 * for the PCI INT output pins.
1705 */
1706 mv64x60_write(bh, GT64260_IC_CPU_INTR_MASK_LO, 0);
1707 mv64x60_write(bh, GT64260_IC_CPU_INTR_MASK_HI, 0);
1708 mv64x60_write(bh, GT64260_IC_PCI0_INTR_MASK_LO, 0);
1709 mv64x60_write(bh, GT64260_IC_PCI0_INTR_MASK_HI, 0);
1710 mv64x60_write(bh, GT64260_IC_PCI1_INTR_MASK_LO, 0);
1711 mv64x60_write(bh, GT64260_IC_PCI1_INTR_MASK_HI, 0);
1712 mv64x60_write(bh, GT64260_IC_CPU_INT_0_MASK, 0);
1713 mv64x60_write(bh, GT64260_IC_CPU_INT_1_MASK, 0);
1714 mv64x60_write(bh, GT64260_IC_CPU_INT_2_MASK, 0);
1715 mv64x60_write(bh, GT64260_IC_CPU_INT_3_MASK, 0);
1716
1717 return;
1718}
1719
1720/*
1721 * gt64260a_chip_specific_init()
1722 *
1723 * Implement errata work arounds for the GT64260A.
1724 */
1725static void __init
1726gt64260a_chip_specific_init(struct mv64x60_handle *bh,
1727 struct mv64x60_setup_info *si)
1728{
1729#ifdef CONFIG_SERIAL_MPSC
1730 struct resource *r;
1731#endif
1732#if !defined(CONFIG_NOT_COHERENT_CACHE)
1733 u32 val;
1734 u8 save_exclude;
1735#endif
1736
1737 if (si->pci_0.enable_bus)
1738 mv64x60_set_bits(bh, MV64x60_PCI0_CMD,
1739 ((1<<4) | (1<<5) | (1<<9) | (1<<13)));
1740
1741 if (si->pci_1.enable_bus)
1742 mv64x60_set_bits(bh, MV64x60_PCI1_CMD,
1743 ((1<<4) | (1<<5) | (1<<9) | (1<<13)));
1744
1745 /*
1746 * Dave Wilhardt found that bit 4 in the PCI Command registers must
1747 * be set if you are using cache coherency.
1748 */
1749#if !defined(CONFIG_NOT_COHERENT_CACHE)
1750 /* Res #MEM-4 -- cpu read buffer to buffer 1 */
1751 if ((mv64x60_read(bh, MV64x60_CPU_MODE) & 0xf0) == 0x40)
1752 mv64x60_set_bits(bh, GT64260_SDRAM_CONFIG, (1<<26));
1753
1754 save_exclude = mv64x60_pci_exclude_bridge;
1755 mv64x60_pci_exclude_bridge = 0;
1756 if (si->pci_0.enable_bus) {
1757 early_read_config_dword(bh->hose_a, 0, PCI_DEVFN(0,0),
1758 PCI_COMMAND, &val);
1759 val |= PCI_COMMAND_INVALIDATE;
1760 early_write_config_dword(bh->hose_a, 0, PCI_DEVFN(0,0),
1761 PCI_COMMAND, val);
1762 }
1763
1764 if (si->pci_1.enable_bus) {
1765 early_read_config_dword(bh->hose_b, 0, PCI_DEVFN(0,0),
1766 PCI_COMMAND, &val);
1767 val |= PCI_COMMAND_INVALIDATE;
1768 early_write_config_dword(bh->hose_b, 0, PCI_DEVFN(0,0),
1769 PCI_COMMAND, val);
1770 }
1771 mv64x60_pci_exclude_bridge = save_exclude;
1772#endif
1773
1774 /* Disable buffer/descriptor snooping */
1775 mv64x60_clr_bits(bh, 0xf280, (1<< 6) | (1<<14) | (1<<22) | (1<<30));
1776 mv64x60_clr_bits(bh, 0xf2c0, (1<< 6) | (1<<14) | (1<<22) | (1<<30));
1777
1778#ifdef CONFIG_SERIAL_MPSC
1779 mv64x60_mpsc0_pdata.mirror_regs = 1;
1780 mv64x60_mpsc0_pdata.cache_mgmt = 1;
1781 mv64x60_mpsc1_pdata.mirror_regs = 1;
1782 mv64x60_mpsc1_pdata.cache_mgmt = 1;
1783
1784 if ((r = platform_get_resource(&mpsc1_device, IORESOURCE_IRQ, 0))
1785 != NULL) {
1786
1787 r->start = MV64x60_IRQ_SDMA_0;
1788 r->end = MV64x60_IRQ_SDMA_0;
1789 }
1790#endif
1791
1792 return;
1793}
1794
1795/*
1796 * gt64260b_chip_specific_init()
1797 *
1798 * Implement errata work arounds for the GT64260B.
1799 */
1800static void __init
1801gt64260b_chip_specific_init(struct mv64x60_handle *bh,
1802 struct mv64x60_setup_info *si)
1803{
1804#ifdef CONFIG_SERIAL_MPSC
1805 struct resource *r;
1806#endif
1807#if !defined(CONFIG_NOT_COHERENT_CACHE)
1808 u32 val;
1809 u8 save_exclude;
1810#endif
1811
1812 if (si->pci_0.enable_bus)
1813 mv64x60_set_bits(bh, MV64x60_PCI0_CMD,
1814 ((1<<4) | (1<<5) | (1<<9) | (1<<13)));
1815
1816 if (si->pci_1.enable_bus)
1817 mv64x60_set_bits(bh, MV64x60_PCI1_CMD,
1818 ((1<<4) | (1<<5) | (1<<9) | (1<<13)));
1819
1820 /*
1821 * Dave Wilhardt found that bit 4 in the PCI Command registers must
1822 * be set if you are using cache coherency.
1823 */
1824#if !defined(CONFIG_NOT_COHERENT_CACHE)
1825 mv64x60_set_bits(bh, GT64260_CPU_WB_PRIORITY_BUFFER_DEPTH, 0xf);
1826
1827 /* Res #MEM-4 -- cpu read buffer to buffer 1 */
1828 if ((mv64x60_read(bh, MV64x60_CPU_MODE) & 0xf0) == 0x40)
1829 mv64x60_set_bits(bh, GT64260_SDRAM_CONFIG, (1<<26));
1830
1831 save_exclude = mv64x60_pci_exclude_bridge;
1832 mv64x60_pci_exclude_bridge = 0;
1833 if (si->pci_0.enable_bus) {
1834 early_read_config_dword(bh->hose_a, 0, PCI_DEVFN(0,0),
1835 PCI_COMMAND, &val);
1836 val |= PCI_COMMAND_INVALIDATE;
1837 early_write_config_dword(bh->hose_a, 0, PCI_DEVFN(0,0),
1838 PCI_COMMAND, val);
1839 }
1840
1841 if (si->pci_1.enable_bus) {
1842 early_read_config_dword(bh->hose_b, 0, PCI_DEVFN(0,0),
1843 PCI_COMMAND, &val);
1844 val |= PCI_COMMAND_INVALIDATE;
1845 early_write_config_dword(bh->hose_b, 0, PCI_DEVFN(0,0),
1846 PCI_COMMAND, val);
1847 }
1848 mv64x60_pci_exclude_bridge = save_exclude;
1849#endif
1850
1851 /* Disable buffer/descriptor snooping */
1852 mv64x60_clr_bits(bh, 0xf280, (1<< 6) | (1<<14) | (1<<22) | (1<<30));
1853 mv64x60_clr_bits(bh, 0xf2c0, (1<< 6) | (1<<14) | (1<<22) | (1<<30));
1854
1855#ifdef CONFIG_SERIAL_MPSC
1856 /*
1857 * The 64260B is not supposed to have the bug where the MPSC & ENET
1858 * can't access cache coherent regions. However, testing has shown
1859 * that the MPSC, at least, still has this bug.
1860 */
1861 mv64x60_mpsc0_pdata.cache_mgmt = 1;
1862 mv64x60_mpsc1_pdata.cache_mgmt = 1;
1863
1864 if ((r = platform_get_resource(&mpsc1_device, IORESOURCE_IRQ, 0))
1865 != NULL) {
1866
1867 r->start = MV64x60_IRQ_SDMA_0;
1868 r->end = MV64x60_IRQ_SDMA_0;
1869 }
1870#endif
1871
1872 return;
1873}
1874
1875/*
1876 *****************************************************************************
1877 *
1878 * MV64360-Specific Routines
1879 *
1880 *****************************************************************************
1881 */
1882/*
1883 * mv64360_translate_size()
1884 *
1885 * On the MV64360, the size register is set similar to the size you get
1886 * from a pci config space BAR register. That is, programmed from LSB to MSB
1887 * as a sequence of 1's followed by a sequence of 0's. IOW, "size -1" with the
1888 * assumption that the size is a power of 2.
1889 */
1890static u32 __init
1891mv64360_translate_size(u32 base_addr, u32 size, u32 num_bits)
1892{
1893 return mv64x60_mask(size - 1, num_bits);
1894}
1895
1896/*
1897 * mv64360_untranslate_size()
1898 *
1899 * Translate the size register value of a window into a window size.
1900 */
1901static u32 __init
1902mv64360_untranslate_size(u32 base_addr, u32 size, u32 num_bits)
1903{
1904 if (size > 0) {
1905 size >>= (32 - num_bits);
1906 size++;
1907 size <<= (32 - num_bits);
1908 }
1909
1910 return size;
1911}
1912
1913/*
1914 * mv64360_set_pci2mem_window()
1915 *
1916 * The PCI->MEM window registers are actually in PCI config space so need
1917 * to set them by setting the correct config space BARs.
1918 */
1919struct {
1920 u32 fcn;
1921 u32 base_hi_bar;
1922 u32 base_lo_bar;
1923} static mv64360_reg_addrs[2][4] __initdata = {
1924 {{ 0, 0x14, 0x10 }, { 0, 0x1c, 0x18 },
1925 { 1, 0x14, 0x10 }, { 1, 0x1c, 0x18 }},
1926 {{ 0, 0x94, 0x90 }, { 0, 0x9c, 0x98 },
1927 { 1, 0x94, 0x90 }, { 1, 0x9c, 0x98 }}
1928};
1929
1930static void __init
1931mv64360_set_pci2mem_window(struct pci_controller *hose, u32 bus, u32 window,
1932 u32 base)
1933{
1934 u8 save_exclude;
1935
1936 pr_debug("set pci->mem window: %d, hose: %d, base: 0x%x\n", window,
1937 hose->index, base);
1938
1939 save_exclude = mv64x60_pci_exclude_bridge;
1940 mv64x60_pci_exclude_bridge = 0;
1941 early_write_config_dword(hose, 0,
1942 PCI_DEVFN(0, mv64360_reg_addrs[bus][window].fcn),
1943 mv64360_reg_addrs[bus][window].base_hi_bar, 0);
1944 early_write_config_dword(hose, 0,
1945 PCI_DEVFN(0, mv64360_reg_addrs[bus][window].fcn),
1946 mv64360_reg_addrs[bus][window].base_lo_bar,
1947 mv64x60_mask(base,20) | 0xc);
1948 mv64x60_pci_exclude_bridge = save_exclude;
1949
1950 return;
1951}
1952
1953/*
1954 * mv64360_set_pci2regs_window()
1955 *
1956 * Set where the bridge's registers appear in PCI MEM space.
1957 */
1958static u32 mv64360_offset[2][2] __initdata = {{0x20, 0x24}, {0xa0, 0xa4}};
1959
1960static void __init
1961mv64360_set_pci2regs_window(struct mv64x60_handle *bh,
1962 struct pci_controller *hose, u32 bus, u32 base)
1963{
1964 u8 save_exclude;
1965
1966 pr_debug("set pci->internal regs hose: %d, base: 0x%x\n", hose->index,
1967 base);
1968
1969 save_exclude = mv64x60_pci_exclude_bridge;
1970 mv64x60_pci_exclude_bridge = 0;
1971 early_write_config_dword(hose, 0, PCI_DEVFN(0,0),
1972 mv64360_offset[bus][0], (base << 16));
1973 early_write_config_dword(hose, 0, PCI_DEVFN(0,0),
1974 mv64360_offset[bus][1], 0);
1975 mv64x60_pci_exclude_bridge = save_exclude;
1976
1977 return;
1978}
1979
1980/*
1981 * mv64360_is_enabled_32bit()
1982 *
1983 * On a MV64360, a window is enabled by either clearing a bit in the
1984 * CPU BAR Enable reg or setting a bit in the window's base reg.
1985 * Note that this doesn't work for windows on the PCI slave side but we don't
1986 * check those so its okay.
1987 */
1988static u32 __init
1989mv64360_is_enabled_32bit(struct mv64x60_handle *bh, u32 window)
1990{
1991 u32 extra, rc = 0;
1992
1993 if (((mv64360_32bit_windows[window].base_reg != 0) &&
1994 (mv64360_32bit_windows[window].size_reg != 0)) ||
1995 (window == MV64x60_CPU2SRAM_WIN)) {
1996
1997 extra = mv64360_32bit_windows[window].extra;
1998
1999 switch (extra & MV64x60_EXTRA_MASK) {
2000 case MV64x60_EXTRA_CPUWIN_ENAB:
2001 rc = (mv64x60_read(bh, MV64360_CPU_BAR_ENABLE) &
2002 (1 << (extra & 0x1f))) == 0;
2003 break;
2004
2005 case MV64x60_EXTRA_CPUPROT_ENAB:
2006 rc = (mv64x60_read(bh,
2007 mv64360_32bit_windows[window].base_reg) &
2008 (1 << (extra & 0x1f))) != 0;
2009 break;
2010
2011 case MV64x60_EXTRA_ENET_ENAB:
2012 rc = (mv64x60_read(bh, MV64360_ENET2MEM_BAR_ENABLE) &
2013 (1 << (extra & 0x7))) == 0;
2014 break;
2015
2016 case MV64x60_EXTRA_MPSC_ENAB:
2017 rc = (mv64x60_read(bh, MV64360_MPSC2MEM_BAR_ENABLE) &
2018 (1 << (extra & 0x3))) == 0;
2019 break;
2020
2021 case MV64x60_EXTRA_IDMA_ENAB:
2022 rc = (mv64x60_read(bh, MV64360_IDMA2MEM_BAR_ENABLE) &
2023 (1 << (extra & 0x7))) == 0;
2024 break;
2025
2026 default:
2027 printk(KERN_ERR "mv64360_is_enabled: %s\n",
2028 "32bit table corrupted");
2029 }
2030 }
2031
2032 return rc;
2033}
2034
2035/*
2036 * mv64360_enable_window_32bit()
2037 *
2038 * On a MV64360, a window is enabled by either clearing a bit in the
2039 * CPU BAR Enable reg or setting a bit in the window's base reg.
2040 */
2041static void __init
2042mv64360_enable_window_32bit(struct mv64x60_handle *bh, u32 window)
2043{
2044 u32 extra;
2045
2046 pr_debug("enable 32bit window: %d\n", window);
2047
2048 if (((mv64360_32bit_windows[window].base_reg != 0) &&
2049 (mv64360_32bit_windows[window].size_reg != 0)) ||
2050 (window == MV64x60_CPU2SRAM_WIN)) {
2051
2052 extra = mv64360_32bit_windows[window].extra;
2053
2054 switch (extra & MV64x60_EXTRA_MASK) {
2055 case MV64x60_EXTRA_CPUWIN_ENAB:
2056 mv64x60_clr_bits(bh, MV64360_CPU_BAR_ENABLE,
2057 (1 << (extra & 0x1f)));
2058 break;
2059
2060 case MV64x60_EXTRA_CPUPROT_ENAB:
2061 mv64x60_set_bits(bh,
2062 mv64360_32bit_windows[window].base_reg,
2063 (1 << (extra & 0x1f)));
2064 break;
2065
2066 case MV64x60_EXTRA_ENET_ENAB:
2067 mv64x60_clr_bits(bh, MV64360_ENET2MEM_BAR_ENABLE,
2068 (1 << (extra & 0x7)));
2069 break;
2070
2071 case MV64x60_EXTRA_MPSC_ENAB:
2072 mv64x60_clr_bits(bh, MV64360_MPSC2MEM_BAR_ENABLE,
2073 (1 << (extra & 0x3)));
2074 break;
2075
2076 case MV64x60_EXTRA_IDMA_ENAB:
2077 mv64x60_clr_bits(bh, MV64360_IDMA2MEM_BAR_ENABLE,
2078 (1 << (extra & 0x7)));
2079 break;
2080
2081 default:
2082 printk(KERN_ERR "mv64360_enable: %s\n",
2083 "32bit table corrupted");
2084 }
2085 }
2086
2087 return;
2088}
2089
2090/*
2091 * mv64360_disable_window_32bit()
2092 *
2093 * On a MV64360, a window is disabled by either setting a bit in the
2094 * CPU BAR Enable reg or clearing a bit in the window's base reg.
2095 */
2096static void __init
2097mv64360_disable_window_32bit(struct mv64x60_handle *bh, u32 window)
2098{
2099 u32 extra;
2100
2101 pr_debug("disable 32bit window: %d, base_reg: 0x%x, size_reg: 0x%x\n",
2102 window, mv64360_32bit_windows[window].base_reg,
2103 mv64360_32bit_windows[window].size_reg);
2104
2105 if (((mv64360_32bit_windows[window].base_reg != 0) &&
2106 (mv64360_32bit_windows[window].size_reg != 0)) ||
2107 (window == MV64x60_CPU2SRAM_WIN)) {
2108
2109 extra = mv64360_32bit_windows[window].extra;
2110
2111 switch (extra & MV64x60_EXTRA_MASK) {
2112 case MV64x60_EXTRA_CPUWIN_ENAB:
2113 mv64x60_set_bits(bh, MV64360_CPU_BAR_ENABLE,
2114 (1 << (extra & 0x1f)));
2115 break;
2116
2117 case MV64x60_EXTRA_CPUPROT_ENAB:
2118 mv64x60_clr_bits(bh,
2119 mv64360_32bit_windows[window].base_reg,
2120 (1 << (extra & 0x1f)));
2121 break;
2122
2123 case MV64x60_EXTRA_ENET_ENAB:
2124 mv64x60_set_bits(bh, MV64360_ENET2MEM_BAR_ENABLE,
2125 (1 << (extra & 0x7)));
2126 break;
2127
2128 case MV64x60_EXTRA_MPSC_ENAB:
2129 mv64x60_set_bits(bh, MV64360_MPSC2MEM_BAR_ENABLE,
2130 (1 << (extra & 0x3)));
2131 break;
2132
2133 case MV64x60_EXTRA_IDMA_ENAB:
2134 mv64x60_set_bits(bh, MV64360_IDMA2MEM_BAR_ENABLE,
2135 (1 << (extra & 0x7)));
2136 break;
2137
2138 default:
2139 printk(KERN_ERR "mv64360_disable: %s\n",
2140 "32bit table corrupted");
2141 }
2142 }
2143
2144 return;
2145}
2146
2147/*
2148 * mv64360_enable_window_64bit()
2149 *
2150 * On the MV64360, a 64-bit window is enabled by setting a bit in the window's
2151 * base reg.
2152 */
2153static void __init
2154mv64360_enable_window_64bit(struct mv64x60_handle *bh, u32 window)
2155{
2156 pr_debug("enable 64bit window: %d\n", window);
2157
2158 if ((mv64360_64bit_windows[window].base_lo_reg!= 0) &&
2159 (mv64360_64bit_windows[window].size_reg != 0)) {
2160
2161 if ((mv64360_64bit_windows[window].extra & MV64x60_EXTRA_MASK)
2162 == MV64x60_EXTRA_PCIACC_ENAB)
2163
2164 mv64x60_set_bits(bh,
2165 mv64360_64bit_windows[window].base_lo_reg,
2166 (1 << (mv64360_64bit_windows[window].extra &
2167 0x1f)));
2168 else
2169 printk(KERN_ERR "mv64360_enable: %s\n",
2170 "64bit table corrupted");
2171 }
2172
2173 return;
2174}
2175
2176/*
2177 * mv64360_disable_window_64bit()
2178 *
2179 * On a MV64360, a 64-bit window is disabled by clearing a bit in the window's
2180 * base reg.
2181 */
2182static void __init
2183mv64360_disable_window_64bit(struct mv64x60_handle *bh, u32 window)
2184{
2185 pr_debug("disable 64bit window: %d, base_reg: 0x%x, size_reg: 0x%x\n",
2186 window, mv64360_64bit_windows[window].base_lo_reg,
2187 mv64360_64bit_windows[window].size_reg);
2188
2189 if ((mv64360_64bit_windows[window].base_lo_reg != 0) &&
2190 (mv64360_64bit_windows[window].size_reg != 0)) {
2191
2192 if ((mv64360_64bit_windows[window].extra & MV64x60_EXTRA_MASK)
2193 == MV64x60_EXTRA_PCIACC_ENAB)
2194
2195 mv64x60_clr_bits(bh,
2196 mv64360_64bit_windows[window].base_lo_reg,
2197 (1 << (mv64360_64bit_windows[window].extra &
2198 0x1f)));
2199 else
2200 printk(KERN_ERR "mv64360_disable: %s\n",
2201 "64bit table corrupted");
2202 }
2203
2204 return;
2205}
2206
2207/*
2208 * mv64360_disable_all_windows()
2209 *
2210 * The MV64360 has a few windows that aren't represented in the table of
2211 * windows at the top of this file. This routine turns all of them off
2212 * except for the memory controller windows, of course.
2213 */
2214static void __init
2215mv64360_disable_all_windows(struct mv64x60_handle *bh,
2216 struct mv64x60_setup_info *si)
2217{
2218 u32 preserve, i;
2219
2220 /* Disable 32bit windows (don't disable cpu->mem windows) */
2221 for (i=MV64x60_CPU2DEV_0_WIN; i<MV64x60_32BIT_WIN_COUNT; i++) {
2222 if (i < 32)
2223 preserve = si->window_preserve_mask_32_lo & (1 << i);
2224 else
2225 preserve = si->window_preserve_mask_32_hi & (1<<(i-32));
2226
2227 if (!preserve)
2228 mv64360_disable_window_32bit(bh, i);
2229 }
2230
2231 /* Disable 64bit windows */
2232 for (i=0; i<MV64x60_64BIT_WIN_COUNT; i++)
2233 if (!(si->window_preserve_mask_64 & (1<<i)))
2234 mv64360_disable_window_64bit(bh, i);
2235
2236 /* Turn off PCI->MEM access cntl wins not in mv64360_64bit_windows[] */
2237 mv64x60_clr_bits(bh, MV64x60_PCI0_ACC_CNTL_4_BASE_LO, 0);
2238 mv64x60_clr_bits(bh, MV64x60_PCI0_ACC_CNTL_5_BASE_LO, 0);
2239 mv64x60_clr_bits(bh, MV64x60_PCI1_ACC_CNTL_4_BASE_LO, 0);
2240 mv64x60_clr_bits(bh, MV64x60_PCI1_ACC_CNTL_5_BASE_LO, 0);
2241
2242 /* Disable all PCI-><whatever> windows */
2243 mv64x60_set_bits(bh, MV64x60_PCI0_BAR_ENABLE, 0x0000f9ff);
2244 mv64x60_set_bits(bh, MV64x60_PCI1_BAR_ENABLE, 0x0000f9ff);
2245
2246 return;
2247}
2248
2249/*
2250 * mv64360_config_io2mem_windows()
2251 *
2252 * ENET, MPSC, and IDMA ctlrs on the MV64[34]60 have separate windows that
2253 * must be set up so that the respective ctlr can access system memory.
2254 */
2255static u32 enet_tab[MV64x60_CPU2MEM_WINDOWS] __initdata = {
2256 MV64x60_ENET2MEM_0_WIN, MV64x60_ENET2MEM_1_WIN,
2257 MV64x60_ENET2MEM_2_WIN, MV64x60_ENET2MEM_3_WIN,
2258};
2259
2260static u32 mpsc_tab[MV64x60_CPU2MEM_WINDOWS] __initdata = {
2261 MV64x60_MPSC2MEM_0_WIN, MV64x60_MPSC2MEM_1_WIN,
2262 MV64x60_MPSC2MEM_2_WIN, MV64x60_MPSC2MEM_3_WIN,
2263};
2264
2265static u32 idma_tab[MV64x60_CPU2MEM_WINDOWS] __initdata = {
2266 MV64x60_IDMA2MEM_0_WIN, MV64x60_IDMA2MEM_1_WIN,
2267 MV64x60_IDMA2MEM_2_WIN, MV64x60_IDMA2MEM_3_WIN,
2268};
2269
2270static u32 dram_selects[MV64x60_CPU2MEM_WINDOWS] __initdata =
2271 { 0xe, 0xd, 0xb, 0x7 };
2272
2273static void __init
2274mv64360_config_io2mem_windows(struct mv64x60_handle *bh,
2275 struct mv64x60_setup_info *si,
2276 u32 mem_windows[MV64x60_CPU2MEM_WINDOWS][2])
2277{
2278 u32 i, win;
2279
2280 pr_debug("config_io2regs_windows: enet, mpsc, idma -> bridge regs\n");
2281
2282 mv64x60_write(bh, MV64360_ENET2MEM_ACC_PROT_0, 0);
2283 mv64x60_write(bh, MV64360_ENET2MEM_ACC_PROT_1, 0);
2284 mv64x60_write(bh, MV64360_ENET2MEM_ACC_PROT_2, 0);
2285
2286 mv64x60_write(bh, MV64360_MPSC2MEM_ACC_PROT_0, 0);
2287 mv64x60_write(bh, MV64360_MPSC2MEM_ACC_PROT_1, 0);
2288
2289 mv64x60_write(bh, MV64360_IDMA2MEM_ACC_PROT_0, 0);
2290 mv64x60_write(bh, MV64360_IDMA2MEM_ACC_PROT_1, 0);
2291 mv64x60_write(bh, MV64360_IDMA2MEM_ACC_PROT_2, 0);
2292 mv64x60_write(bh, MV64360_IDMA2MEM_ACC_PROT_3, 0);
2293
2294 /* Assume that mem ctlr has no more windows than embedded I/O ctlr */
2295 for (win=MV64x60_CPU2MEM_0_WIN,i=0;win<=MV64x60_CPU2MEM_3_WIN;win++,i++)
2296 if (bh->ci->is_enabled_32bit(bh, win)) {
2297 mv64x60_set_32bit_window(bh, enet_tab[i],
2298 mem_windows[i][0], mem_windows[i][1],
2299 (dram_selects[i] << 8) |
2300 (si->enet_options[i] & 0x3000));
2301 bh->ci->enable_window_32bit(bh, enet_tab[i]);
2302
2303 /* Give enet r/w access to memory region */
2304 mv64x60_set_bits(bh, MV64360_ENET2MEM_ACC_PROT_0,
2305 (0x3 << (i << 1)));
2306 mv64x60_set_bits(bh, MV64360_ENET2MEM_ACC_PROT_1,
2307 (0x3 << (i << 1)));
2308 mv64x60_set_bits(bh, MV64360_ENET2MEM_ACC_PROT_2,
2309 (0x3 << (i << 1)));
2310
2311 mv64x60_set_32bit_window(bh, mpsc_tab[i],
2312 mem_windows[i][0], mem_windows[i][1],
2313 (dram_selects[i] << 8) |
2314 (si->mpsc_options[i] & 0x3000));
2315 bh->ci->enable_window_32bit(bh, mpsc_tab[i]);
2316
2317 /* Give mpsc r/w access to memory region */
2318 mv64x60_set_bits(bh, MV64360_MPSC2MEM_ACC_PROT_0,
2319 (0x3 << (i << 1)));
2320 mv64x60_set_bits(bh, MV64360_MPSC2MEM_ACC_PROT_1,
2321 (0x3 << (i << 1)));
2322
2323 mv64x60_set_32bit_window(bh, idma_tab[i],
2324 mem_windows[i][0], mem_windows[i][1],
2325 (dram_selects[i] << 8) |
2326 (si->idma_options[i] & 0x3000));
2327 bh->ci->enable_window_32bit(bh, idma_tab[i]);
2328
2329 /* Give idma r/w access to memory region */
2330 mv64x60_set_bits(bh, MV64360_IDMA2MEM_ACC_PROT_0,
2331 (0x3 << (i << 1)));
2332 mv64x60_set_bits(bh, MV64360_IDMA2MEM_ACC_PROT_1,
2333 (0x3 << (i << 1)));
2334 mv64x60_set_bits(bh, MV64360_IDMA2MEM_ACC_PROT_2,
2335 (0x3 << (i << 1)));
2336 mv64x60_set_bits(bh, MV64360_IDMA2MEM_ACC_PROT_3,
2337 (0x3 << (i << 1)));
2338 }
2339
2340 return;
2341}
2342
2343/*
2344 * mv64360_set_mpsc2regs_window()
2345 *
2346 * MPSC has a window to the bridge's internal registers. Call this routine
2347 * to change that window so it doesn't conflict with the windows mapping the
2348 * mpsc to system memory.
2349 */
2350static void __init
2351mv64360_set_mpsc2regs_window(struct mv64x60_handle *bh, u32 base)
2352{
2353 pr_debug("set mpsc->internal regs, base: 0x%x\n", base);
2354
2355 mv64x60_write(bh, MV64360_MPSC2REGS_BASE, base & 0xffff0000);
2356 return;
2357}
2358
2359/*
2360 * mv64360_chip_specific_init()
2361 *
2362 * No errata work arounds for the MV64360 implemented at this point.
2363 */
2364static void __init
2365mv64360_chip_specific_init(struct mv64x60_handle *bh,
2366 struct mv64x60_setup_info *si)
2367{
2368#ifdef CONFIG_SERIAL_MPSC
2369 mv64x60_mpsc0_pdata.brg_can_tune = 1;
2370 mv64x60_mpsc0_pdata.cache_mgmt = 1;
2371 mv64x60_mpsc1_pdata.brg_can_tune = 1;
2372 mv64x60_mpsc1_pdata.cache_mgmt = 1;
2373#endif
2374
2375 return;
2376}
2377
2378/*
2379 * mv64460_chip_specific_init()
2380 *
2381 * No errata work arounds for the MV64460 implemented at this point.
2382 */
2383static void __init
2384mv64460_chip_specific_init(struct mv64x60_handle *bh,
2385 struct mv64x60_setup_info *si)
2386{
2387#ifdef CONFIG_SERIAL_MPSC
2388 mv64x60_mpsc0_pdata.brg_can_tune = 1;
2389 mv64x60_mpsc1_pdata.brg_can_tune = 1;
2390#endif
2391 return;
2392}
diff --git a/arch/ppc/syslib/mv64x60_dbg.c b/arch/ppc/syslib/mv64x60_dbg.c
new file mode 100644
index 000000000000..2927c7adf5e5
--- /dev/null
+++ b/arch/ppc/syslib/mv64x60_dbg.c
@@ -0,0 +1,123 @@
1/*
2 * arch/ppc/syslib/mv64x60_dbg.c
3 *
4 * KGDB and progress routines for the Marvell/Galileo MV64x60 (Discovery).
5 *
6 * Author: Mark A. Greer <mgreer@mvista.com>
7 *
8 * 2003 (c) MontaVista Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
11 * or implied.
12 */
13
14/*
15 *****************************************************************************
16 *
17 * Low-level MPSC/UART I/O routines
18 *
19 *****************************************************************************
20 */
21
22
23#include <linux/config.h>
24#include <linux/irq.h>
25#include <asm/delay.h>
26#include <asm/mv64x60.h>
27
28
29#if defined(CONFIG_SERIAL_TEXT_DEBUG)
30
31#define MPSC_CHR_1 0x000c
32#define MPSC_CHR_2 0x0010
33
34static struct mv64x60_handle mv64x60_dbg_bh;
35
36void
37mv64x60_progress_init(u32 base)
38{
39 mv64x60_dbg_bh.v_base = base;
40 return;
41}
42
43static void
44mv64x60_polled_putc(int chan, char c)
45{
46 u32 offset;
47
48 if (chan == 0)
49 offset = 0x8000;
50 else
51 offset = 0x9000;
52
53 mv64x60_write(&mv64x60_dbg_bh, offset + MPSC_CHR_1, (u32)c);
54 mv64x60_write(&mv64x60_dbg_bh, offset + MPSC_CHR_2, 0x200);
55 udelay(2000);
56}
57
58void
59mv64x60_mpsc_progress(char *s, unsigned short hex)
60{
61 volatile char c;
62
63 mv64x60_polled_putc(0, '\r');
64
65 while ((c = *s++) != 0)
66 mv64x60_polled_putc(0, c);
67
68 mv64x60_polled_putc(0, '\n');
69 mv64x60_polled_putc(0, '\r');
70
71 return;
72}
73#endif /* CONFIG_SERIAL_TEXT_DEBUG */
74
75
76#if defined(CONFIG_KGDB)
77
78#if defined(CONFIG_KGDB_TTYS0)
79#define KGDB_PORT 0
80#elif defined(CONFIG_KGDB_TTYS1)
81#define KGDB_PORT 1
82#else
83#error "Invalid kgdb_tty port"
84#endif
85
86void
87putDebugChar(unsigned char c)
88{
89 mv64x60_polled_putc(KGDB_PORT, (char)c);
90}
91
92int
93getDebugChar(void)
94{
95 unsigned char c;
96
97 while (!mv64x60_polled_getc(KGDB_PORT, &c));
98 return (int)c;
99}
100
101void
102putDebugString(char* str)
103{
104 while (*str != '\0') {
105 putDebugChar(*str);
106 str++;
107 }
108 putDebugChar('\r');
109 return;
110}
111
112void
113kgdb_interruptible(int enable)
114{
115}
116
117void
118kgdb_map_scc(void)
119{
120 if (ppc_md.early_serial_map)
121 ppc_md.early_serial_map();
122}
123#endif /* CONFIG_KGDB */
diff --git a/arch/ppc/syslib/mv64x60_win.c b/arch/ppc/syslib/mv64x60_win.c
new file mode 100644
index 000000000000..b6f0f5dcf6ee
--- /dev/null
+++ b/arch/ppc/syslib/mv64x60_win.c
@@ -0,0 +1,1168 @@
1/*
2 * arch/ppc/syslib/mv64x60_win.c
3 *
4 * Tables with info on how to manipulate the 32 & 64 bit windows on the
5 * various types of Marvell bridge chips.
6 *
7 * Author: Mark A. Greer <mgreer@mvista.com>
8 *
9 * 2004 (c) MontaVista, Software, Inc. This file is licensed under
10 * the terms of the GNU General Public License version 2. This program
11 * is licensed "as is" without any warranty of any kind, whether express
12 * or implied.
13 */
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/pci.h>
17#include <linux/slab.h>
18#include <linux/module.h>
19#include <linux/string.h>
20#include <linux/bootmem.h>
21#include <linux/mv643xx.h>
22
23#include <asm/byteorder.h>
24#include <asm/io.h>
25#include <asm/irq.h>
26#include <asm/uaccess.h>
27#include <asm/machdep.h>
28#include <asm/pci-bridge.h>
29#include <asm/delay.h>
30#include <asm/mv64x60.h>
31
32
33/*
34 *****************************************************************************
35 *
36 * Tables describing how to set up windows on each type of bridge
37 *
38 *****************************************************************************
39 */
40struct mv64x60_32bit_window
41 gt64260_32bit_windows[MV64x60_32BIT_WIN_COUNT] __initdata = {
42 /* CPU->MEM Windows */
43 [MV64x60_CPU2MEM_0_WIN] = {
44 .base_reg = MV64x60_CPU2MEM_0_BASE,
45 .size_reg = MV64x60_CPU2MEM_0_SIZE,
46 .base_bits = 12,
47 .size_bits = 12,
48 .get_from_field = mv64x60_shift_left,
49 .map_to_field = mv64x60_shift_right,
50 .extra = 0 },
51 [MV64x60_CPU2MEM_1_WIN] = {
52 .base_reg = MV64x60_CPU2MEM_1_BASE,
53 .size_reg = MV64x60_CPU2MEM_1_SIZE,
54 .base_bits = 12,
55 .size_bits = 12,
56 .get_from_field = mv64x60_shift_left,
57 .map_to_field = mv64x60_shift_right,
58 .extra = 0 },
59 [MV64x60_CPU2MEM_2_WIN] = {
60 .base_reg = MV64x60_CPU2MEM_2_BASE,
61 .size_reg = MV64x60_CPU2MEM_2_SIZE,
62 .base_bits = 12,
63 .size_bits = 12,
64 .get_from_field = mv64x60_shift_left,
65 .map_to_field = mv64x60_shift_right,
66 .extra = 0 },
67 [MV64x60_CPU2MEM_3_WIN] = {
68 .base_reg = MV64x60_CPU2MEM_3_BASE,
69 .size_reg = MV64x60_CPU2MEM_3_SIZE,
70 .base_bits = 12,
71 .size_bits = 12,
72 .get_from_field = mv64x60_shift_left,
73 .map_to_field = mv64x60_shift_right,
74 .extra = 0 },
75 /* CPU->Device Windows */
76 [MV64x60_CPU2DEV_0_WIN] = {
77 .base_reg = MV64x60_CPU2DEV_0_BASE,
78 .size_reg = MV64x60_CPU2DEV_0_SIZE,
79 .base_bits = 12,
80 .size_bits = 12,
81 .get_from_field = mv64x60_shift_left,
82 .map_to_field = mv64x60_shift_right,
83 .extra = 0 },
84 [MV64x60_CPU2DEV_1_WIN] = {
85 .base_reg = MV64x60_CPU2DEV_1_BASE,
86 .size_reg = MV64x60_CPU2DEV_1_SIZE,
87 .base_bits = 12,
88 .size_bits = 12,
89 .get_from_field = mv64x60_shift_left,
90 .map_to_field = mv64x60_shift_right,
91 .extra = 0 },
92 [MV64x60_CPU2DEV_2_WIN] = {
93 .base_reg = MV64x60_CPU2DEV_2_BASE,
94 .size_reg = MV64x60_CPU2DEV_2_SIZE,
95 .base_bits = 12,
96 .size_bits = 12,
97 .get_from_field = mv64x60_shift_left,
98 .map_to_field = mv64x60_shift_right,
99 .extra = 0 },
100 [MV64x60_CPU2DEV_3_WIN] = {
101 .base_reg = MV64x60_CPU2DEV_3_BASE,
102 .size_reg = MV64x60_CPU2DEV_3_SIZE,
103 .base_bits = 12,
104 .size_bits = 12,
105 .get_from_field = mv64x60_shift_left,
106 .map_to_field = mv64x60_shift_right,
107 .extra = 0 },
108 /* CPU->Boot Window */
109 [MV64x60_CPU2BOOT_WIN] = {
110 .base_reg = MV64x60_CPU2BOOT_0_BASE,
111 .size_reg = MV64x60_CPU2BOOT_0_SIZE,
112 .base_bits = 12,
113 .size_bits = 12,
114 .get_from_field = mv64x60_shift_left,
115 .map_to_field = mv64x60_shift_right,
116 .extra = 0 },
117 /* CPU->PCI 0 Windows */
118 [MV64x60_CPU2PCI0_IO_WIN] = {
119 .base_reg = MV64x60_CPU2PCI0_IO_BASE,
120 .size_reg = MV64x60_CPU2PCI0_IO_SIZE,
121 .base_bits = 12,
122 .size_bits = 12,
123 .get_from_field = mv64x60_shift_left,
124 .map_to_field = mv64x60_shift_right,
125 .extra = 0 },
126 [MV64x60_CPU2PCI0_MEM_0_WIN] = {
127 .base_reg = MV64x60_CPU2PCI0_MEM_0_BASE,
128 .size_reg = MV64x60_CPU2PCI0_MEM_0_SIZE,
129 .base_bits = 12,
130 .size_bits = 12,
131 .get_from_field = mv64x60_shift_left,
132 .map_to_field = mv64x60_shift_right,
133 .extra = 0 },
134 [MV64x60_CPU2PCI0_MEM_1_WIN] = {
135 .base_reg = MV64x60_CPU2PCI0_MEM_1_BASE,
136 .size_reg = MV64x60_CPU2PCI0_MEM_1_SIZE,
137 .base_bits = 12,
138 .size_bits = 12,
139 .get_from_field = mv64x60_shift_left,
140 .map_to_field = mv64x60_shift_right,
141 .extra = 0 },
142 [MV64x60_CPU2PCI0_MEM_2_WIN] = {
143 .base_reg = MV64x60_CPU2PCI0_MEM_2_BASE,
144 .size_reg = MV64x60_CPU2PCI0_MEM_2_SIZE,
145 .base_bits = 12,
146 .size_bits = 12,
147 .get_from_field = mv64x60_shift_left,
148 .map_to_field = mv64x60_shift_right,
149 .extra = 0 },
150 [MV64x60_CPU2PCI0_MEM_3_WIN] = {
151 .base_reg = MV64x60_CPU2PCI0_MEM_3_BASE,
152 .size_reg = MV64x60_CPU2PCI0_MEM_3_SIZE,
153 .base_bits = 12,
154 .size_bits = 12,
155 .get_from_field = mv64x60_shift_left,
156 .map_to_field = mv64x60_shift_right,
157 .extra = 0 },
158 /* CPU->PCI 1 Windows */
159 [MV64x60_CPU2PCI1_IO_WIN] = {
160 .base_reg = MV64x60_CPU2PCI1_IO_BASE,
161 .size_reg = MV64x60_CPU2PCI1_IO_SIZE,
162 .base_bits = 12,
163 .size_bits = 12,
164 .get_from_field = mv64x60_shift_left,
165 .map_to_field = mv64x60_shift_right,
166 .extra = 0 },
167 [MV64x60_CPU2PCI1_MEM_0_WIN] = {
168 .base_reg = MV64x60_CPU2PCI1_MEM_0_BASE,
169 .size_reg = MV64x60_CPU2PCI1_MEM_0_SIZE,
170 .base_bits = 12,
171 .size_bits = 12,
172 .get_from_field = mv64x60_shift_left,
173 .map_to_field = mv64x60_shift_right,
174 .extra = 0 },
175 [MV64x60_CPU2PCI1_MEM_1_WIN] = {
176 .base_reg = MV64x60_CPU2PCI1_MEM_1_BASE,
177 .size_reg = MV64x60_CPU2PCI1_MEM_1_SIZE,
178 .base_bits = 12,
179 .size_bits = 12,
180 .get_from_field = mv64x60_shift_left,
181 .map_to_field = mv64x60_shift_right,
182 .extra = 0 },
183 [MV64x60_CPU2PCI1_MEM_2_WIN] = {
184 .base_reg = MV64x60_CPU2PCI1_MEM_2_BASE,
185 .size_reg = MV64x60_CPU2PCI1_MEM_2_SIZE,
186 .base_bits = 12,
187 .size_bits = 12,
188 .get_from_field = mv64x60_shift_left,
189 .map_to_field = mv64x60_shift_right,
190 .extra = 0 },
191 [MV64x60_CPU2PCI1_MEM_3_WIN] = {
192 .base_reg = MV64x60_CPU2PCI1_MEM_3_BASE,
193 .size_reg = MV64x60_CPU2PCI1_MEM_3_SIZE,
194 .base_bits = 12,
195 .size_bits = 12,
196 .get_from_field = mv64x60_shift_left,
197 .map_to_field = mv64x60_shift_right,
198 .extra = 0 },
199 /* CPU->SRAM Window (64260 has no integrated SRAM) */
200 /* CPU->PCI 0 Remap I/O Window */
201 [MV64x60_CPU2PCI0_IO_REMAP_WIN] = {
202 .base_reg = MV64x60_CPU2PCI0_IO_REMAP,
203 .size_reg = 0,
204 .base_bits = 12,
205 .size_bits = 0,
206 .get_from_field = mv64x60_shift_left,
207 .map_to_field = mv64x60_shift_right,
208 .extra = 0 },
209 /* CPU->PCI 1 Remap I/O Window */
210 [MV64x60_CPU2PCI1_IO_REMAP_WIN] = {
211 .base_reg = MV64x60_CPU2PCI1_IO_REMAP,
212 .size_reg = 0,
213 .base_bits = 12,
214 .size_bits = 0,
215 .get_from_field = mv64x60_shift_left,
216 .map_to_field = mv64x60_shift_right,
217 .extra = 0 },
218 /* CPU Memory Protection Windows */
219 [MV64x60_CPU_PROT_0_WIN] = {
220 .base_reg = MV64x60_CPU_PROT_BASE_0,
221 .size_reg = MV64x60_CPU_PROT_SIZE_0,
222 .base_bits = 12,
223 .size_bits = 12,
224 .get_from_field = mv64x60_shift_left,
225 .map_to_field = mv64x60_shift_right,
226 .extra = 0 },
227 [MV64x60_CPU_PROT_1_WIN] = {
228 .base_reg = MV64x60_CPU_PROT_BASE_1,
229 .size_reg = MV64x60_CPU_PROT_SIZE_1,
230 .base_bits = 12,
231 .size_bits = 12,
232 .get_from_field = mv64x60_shift_left,
233 .map_to_field = mv64x60_shift_right,
234 .extra = 0 },
235 [MV64x60_CPU_PROT_2_WIN] = {
236 .base_reg = MV64x60_CPU_PROT_BASE_2,
237 .size_reg = MV64x60_CPU_PROT_SIZE_2,
238 .base_bits = 12,
239 .size_bits = 12,
240 .get_from_field = mv64x60_shift_left,
241 .map_to_field = mv64x60_shift_right,
242 .extra = 0 },
243 [MV64x60_CPU_PROT_3_WIN] = {
244 .base_reg = MV64x60_CPU_PROT_BASE_3,
245 .size_reg = MV64x60_CPU_PROT_SIZE_3,
246 .base_bits = 12,
247 .size_bits = 12,
248 .get_from_field = mv64x60_shift_left,
249 .map_to_field = mv64x60_shift_right,
250 .extra = 0 },
251 /* CPU Snoop Windows */
252 [MV64x60_CPU_SNOOP_0_WIN] = {
253 .base_reg = GT64260_CPU_SNOOP_BASE_0,
254 .size_reg = GT64260_CPU_SNOOP_SIZE_0,
255 .base_bits = 12,
256 .size_bits = 12,
257 .get_from_field = mv64x60_shift_left,
258 .map_to_field = mv64x60_shift_right,
259 .extra = 0 },
260 [MV64x60_CPU_SNOOP_1_WIN] = {
261 .base_reg = GT64260_CPU_SNOOP_BASE_1,
262 .size_reg = GT64260_CPU_SNOOP_SIZE_1,
263 .base_bits = 12,
264 .size_bits = 12,
265 .get_from_field = mv64x60_shift_left,
266 .map_to_field = mv64x60_shift_right,
267 .extra = 0 },
268 [MV64x60_CPU_SNOOP_2_WIN] = {
269 .base_reg = GT64260_CPU_SNOOP_BASE_2,
270 .size_reg = GT64260_CPU_SNOOP_SIZE_2,
271 .base_bits = 12,
272 .size_bits = 12,
273 .get_from_field = mv64x60_shift_left,
274 .map_to_field = mv64x60_shift_right,
275 .extra = 0 },
276 [MV64x60_CPU_SNOOP_3_WIN] = {
277 .base_reg = GT64260_CPU_SNOOP_BASE_3,
278 .size_reg = GT64260_CPU_SNOOP_SIZE_3,
279 .base_bits = 12,
280 .size_bits = 12,
281 .get_from_field = mv64x60_shift_left,
282 .map_to_field = mv64x60_shift_right,
283 .extra = 0 },
284 /* PCI 0->System Memory Remap Windows */
285 [MV64x60_PCI02MEM_REMAP_0_WIN] = {
286 .base_reg = MV64x60_PCI0_SLAVE_MEM_0_REMAP,
287 .size_reg = 0,
288 .base_bits = 20,
289 .size_bits = 0,
290 .get_from_field = mv64x60_mask,
291 .map_to_field = mv64x60_mask,
292 .extra = 0 },
293 [MV64x60_PCI02MEM_REMAP_1_WIN] = {
294 .base_reg = MV64x60_PCI0_SLAVE_MEM_1_REMAP,
295 .size_reg = 0,
296 .base_bits = 20,
297 .size_bits = 0,
298 .get_from_field = mv64x60_mask,
299 .map_to_field = mv64x60_mask,
300 .extra = 0 },
301 [MV64x60_PCI02MEM_REMAP_2_WIN] = {
302 .base_reg = MV64x60_PCI0_SLAVE_MEM_1_REMAP,
303 .size_reg = 0,
304 .base_bits = 20,
305 .size_bits = 0,
306 .get_from_field = mv64x60_mask,
307 .map_to_field = mv64x60_mask,
308 .extra = 0 },
309 [MV64x60_PCI02MEM_REMAP_3_WIN] = {
310 .base_reg = MV64x60_PCI0_SLAVE_MEM_1_REMAP,
311 .size_reg = 0,
312 .base_bits = 20,
313 .size_bits = 0,
314 .get_from_field = mv64x60_mask,
315 .map_to_field = mv64x60_mask,
316 .extra = 0 },
317 /* PCI 1->System Memory Remap Windows */
318 [MV64x60_PCI12MEM_REMAP_0_WIN] = {
319 .base_reg = MV64x60_PCI1_SLAVE_MEM_0_REMAP,
320 .size_reg = 0,
321 .base_bits = 20,
322 .size_bits = 0,
323 .get_from_field = mv64x60_mask,
324 .map_to_field = mv64x60_mask,
325 .extra = 0 },
326 [MV64x60_PCI12MEM_REMAP_1_WIN] = {
327 .base_reg = MV64x60_PCI1_SLAVE_MEM_1_REMAP,
328 .size_reg = 0,
329 .base_bits = 20,
330 .size_bits = 0,
331 .get_from_field = mv64x60_mask,
332 .map_to_field = mv64x60_mask,
333 .extra = 0 },
334 [MV64x60_PCI12MEM_REMAP_2_WIN] = {
335 .base_reg = MV64x60_PCI1_SLAVE_MEM_1_REMAP,
336 .size_reg = 0,
337 .base_bits = 20,
338 .size_bits = 0,
339 .get_from_field = mv64x60_mask,
340 .map_to_field = mv64x60_mask,
341 .extra = 0 },
342 [MV64x60_PCI12MEM_REMAP_3_WIN] = {
343 .base_reg = MV64x60_PCI1_SLAVE_MEM_1_REMAP,
344 .size_reg = 0,
345 .base_bits = 20,
346 .size_bits = 0,
347 .get_from_field = mv64x60_mask,
348 .map_to_field = mv64x60_mask,
349 .extra = 0 },
350 /* ENET->SRAM Window (64260 doesn't have separate windows) */
351 /* MPSC->SRAM Window (64260 doesn't have separate windows) */
352 /* IDMA->SRAM Window (64260 doesn't have separate windows) */
353};
354
355struct mv64x60_64bit_window
356 gt64260_64bit_windows[MV64x60_64BIT_WIN_COUNT] __initdata = {
357 /* CPU->PCI 0 MEM Remap Windows */
358 [MV64x60_CPU2PCI0_MEM_0_REMAP_WIN] = {
359 .base_hi_reg = MV64x60_CPU2PCI0_MEM_0_REMAP_HI,
360 .base_lo_reg = MV64x60_CPU2PCI0_MEM_0_REMAP_LO,
361 .size_reg = 0,
362 .base_lo_bits = 12,
363 .size_bits = 0,
364 .get_from_field = mv64x60_shift_left,
365 .map_to_field = mv64x60_shift_right,
366 .extra = 0 },
367 [MV64x60_CPU2PCI0_MEM_1_REMAP_WIN] = {
368 .base_hi_reg = MV64x60_CPU2PCI0_MEM_1_REMAP_HI,
369 .base_lo_reg = MV64x60_CPU2PCI0_MEM_1_REMAP_LO,
370 .size_reg = 0,
371 .base_lo_bits = 12,
372 .size_bits = 0,
373 .get_from_field = mv64x60_shift_left,
374 .map_to_field = mv64x60_shift_right,
375 .extra = 0 },
376 [MV64x60_CPU2PCI0_MEM_2_REMAP_WIN] = {
377 .base_hi_reg = MV64x60_CPU2PCI0_MEM_2_REMAP_HI,
378 .base_lo_reg = MV64x60_CPU2PCI0_MEM_2_REMAP_LO,
379 .size_reg = 0,
380 .base_lo_bits = 12,
381 .size_bits = 0,
382 .get_from_field = mv64x60_shift_left,
383 .map_to_field = mv64x60_shift_right,
384 .extra = 0 },
385 [MV64x60_CPU2PCI0_MEM_3_REMAP_WIN] = {
386 .base_hi_reg = MV64x60_CPU2PCI0_MEM_3_REMAP_HI,
387 .base_lo_reg = MV64x60_CPU2PCI0_MEM_3_REMAP_LO,
388 .size_reg = 0,
389 .base_lo_bits = 12,
390 .size_bits = 0,
391 .get_from_field = mv64x60_shift_left,
392 .map_to_field = mv64x60_shift_right,
393 .extra = 0 },
394 /* CPU->PCI 1 MEM Remap Windows */
395 [MV64x60_CPU2PCI1_MEM_0_REMAP_WIN] = {
396 .base_hi_reg = MV64x60_CPU2PCI1_MEM_0_REMAP_HI,
397 .base_lo_reg = MV64x60_CPU2PCI1_MEM_0_REMAP_LO,
398 .size_reg = 0,
399 .base_lo_bits = 12,
400 .size_bits = 0,
401 .get_from_field = mv64x60_shift_left,
402 .map_to_field = mv64x60_shift_right,
403 .extra = 0 },
404 [MV64x60_CPU2PCI1_MEM_1_REMAP_WIN] = {
405 .base_hi_reg = MV64x60_CPU2PCI1_MEM_1_REMAP_HI,
406 .base_lo_reg = MV64x60_CPU2PCI1_MEM_1_REMAP_LO,
407 .size_reg = 0,
408 .base_lo_bits = 12,
409 .size_bits = 0,
410 .get_from_field = mv64x60_shift_left,
411 .map_to_field = mv64x60_shift_right,
412 .extra = 0 },
413 [MV64x60_CPU2PCI1_MEM_2_REMAP_WIN] = {
414 .base_hi_reg = MV64x60_CPU2PCI1_MEM_2_REMAP_HI,
415 .base_lo_reg = MV64x60_CPU2PCI1_MEM_2_REMAP_LO,
416 .size_reg = 0,
417 .base_lo_bits = 12,
418 .size_bits = 0,
419 .get_from_field = mv64x60_shift_left,
420 .map_to_field = mv64x60_shift_right,
421 .extra = 0 },
422 [MV64x60_CPU2PCI1_MEM_3_REMAP_WIN] = {
423 .base_hi_reg = MV64x60_CPU2PCI1_MEM_3_REMAP_HI,
424 .base_lo_reg = MV64x60_CPU2PCI1_MEM_3_REMAP_LO,
425 .size_reg = 0,
426 .base_lo_bits = 12,
427 .size_bits = 0,
428 .get_from_field = mv64x60_shift_left,
429 .map_to_field = mv64x60_shift_right,
430 .extra = 0 },
431 /* PCI 0->MEM Access Control Windows */
432 [MV64x60_PCI02MEM_ACC_CNTL_0_WIN] = {
433 .base_hi_reg = MV64x60_PCI0_ACC_CNTL_0_BASE_HI,
434 .base_lo_reg = MV64x60_PCI0_ACC_CNTL_0_BASE_LO,
435 .size_reg = MV64x60_PCI0_ACC_CNTL_0_SIZE,
436 .base_lo_bits = 12,
437 .size_bits = 12,
438 .get_from_field = mv64x60_shift_left,
439 .map_to_field = mv64x60_shift_right,
440 .extra = 0 },
441 [MV64x60_PCI02MEM_ACC_CNTL_1_WIN] = {
442 .base_hi_reg = MV64x60_PCI0_ACC_CNTL_1_BASE_HI,
443 .base_lo_reg = MV64x60_PCI0_ACC_CNTL_1_BASE_LO,
444 .size_reg = MV64x60_PCI0_ACC_CNTL_1_SIZE,
445 .base_lo_bits = 12,
446 .size_bits = 12,
447 .get_from_field = mv64x60_shift_left,
448 .map_to_field = mv64x60_shift_right,
449 .extra = 0 },
450 [MV64x60_PCI02MEM_ACC_CNTL_2_WIN] = {
451 .base_hi_reg = MV64x60_PCI0_ACC_CNTL_2_BASE_HI,
452 .base_lo_reg = MV64x60_PCI0_ACC_CNTL_2_BASE_LO,
453 .size_reg = MV64x60_PCI0_ACC_CNTL_2_SIZE,
454 .base_lo_bits = 12,
455 .size_bits = 12,
456 .get_from_field = mv64x60_shift_left,
457 .map_to_field = mv64x60_shift_right,
458 .extra = 0 },
459 [MV64x60_PCI02MEM_ACC_CNTL_3_WIN] = {
460 .base_hi_reg = MV64x60_PCI0_ACC_CNTL_3_BASE_HI,
461 .base_lo_reg = MV64x60_PCI0_ACC_CNTL_3_BASE_LO,
462 .size_reg = MV64x60_PCI0_ACC_CNTL_3_SIZE,
463 .base_lo_bits = 12,
464 .size_bits = 12,
465 .get_from_field = mv64x60_shift_left,
466 .map_to_field = mv64x60_shift_right,
467 .extra = 0 },
468 /* PCI 1->MEM Access Control Windows */
469 [MV64x60_PCI12MEM_ACC_CNTL_0_WIN] = {
470 .base_hi_reg = MV64x60_PCI1_ACC_CNTL_0_BASE_HI,
471 .base_lo_reg = MV64x60_PCI1_ACC_CNTL_0_BASE_LO,
472 .size_reg = MV64x60_PCI1_ACC_CNTL_0_SIZE,
473 .base_lo_bits = 12,
474 .size_bits = 12,
475 .get_from_field = mv64x60_shift_left,
476 .map_to_field = mv64x60_shift_right,
477 .extra = 0 },
478 [MV64x60_PCI12MEM_ACC_CNTL_1_WIN] = {
479 .base_hi_reg = MV64x60_PCI1_ACC_CNTL_1_BASE_HI,
480 .base_lo_reg = MV64x60_PCI1_ACC_CNTL_1_BASE_LO,
481 .size_reg = MV64x60_PCI1_ACC_CNTL_1_SIZE,
482 .base_lo_bits = 12,
483 .size_bits = 12,
484 .get_from_field = mv64x60_shift_left,
485 .map_to_field = mv64x60_shift_right,
486 .extra = 0 },
487 [MV64x60_PCI12MEM_ACC_CNTL_2_WIN] = {
488 .base_hi_reg = MV64x60_PCI1_ACC_CNTL_2_BASE_HI,
489 .base_lo_reg = MV64x60_PCI1_ACC_CNTL_2_BASE_LO,
490 .size_reg = MV64x60_PCI1_ACC_CNTL_2_SIZE,
491 .base_lo_bits = 12,
492 .size_bits = 12,
493 .get_from_field = mv64x60_shift_left,
494 .map_to_field = mv64x60_shift_right,
495 .extra = 0 },
496 [MV64x60_PCI12MEM_ACC_CNTL_3_WIN] = {
497 .base_hi_reg = MV64x60_PCI1_ACC_CNTL_3_BASE_HI,
498 .base_lo_reg = MV64x60_PCI1_ACC_CNTL_3_BASE_LO,
499 .size_reg = MV64x60_PCI1_ACC_CNTL_3_SIZE,
500 .base_lo_bits = 12,
501 .size_bits = 12,
502 .get_from_field = mv64x60_shift_left,
503 .map_to_field = mv64x60_shift_right,
504 .extra = 0 },
505 /* PCI 0->MEM Snoop Windows */
506 [MV64x60_PCI02MEM_SNOOP_0_WIN] = {
507 .base_hi_reg = GT64260_PCI0_SNOOP_0_BASE_HI,
508 .base_lo_reg = GT64260_PCI0_SNOOP_0_BASE_LO,
509 .size_reg = GT64260_PCI0_SNOOP_0_SIZE,
510 .base_lo_bits = 12,
511 .size_bits = 12,
512 .get_from_field = mv64x60_shift_left,
513 .map_to_field = mv64x60_shift_right,
514 .extra = 0 },
515 [MV64x60_PCI02MEM_SNOOP_1_WIN] = {
516 .base_hi_reg = GT64260_PCI0_SNOOP_1_BASE_HI,
517 .base_lo_reg = GT64260_PCI0_SNOOP_1_BASE_LO,
518 .size_reg = GT64260_PCI0_SNOOP_1_SIZE,
519 .base_lo_bits = 12,
520 .size_bits = 12,
521 .get_from_field = mv64x60_shift_left,
522 .map_to_field = mv64x60_shift_right,
523 .extra = 0 },
524 [MV64x60_PCI02MEM_SNOOP_2_WIN] = {
525 .base_hi_reg = GT64260_PCI0_SNOOP_2_BASE_HI,
526 .base_lo_reg = GT64260_PCI0_SNOOP_2_BASE_LO,
527 .size_reg = GT64260_PCI0_SNOOP_2_SIZE,
528 .base_lo_bits = 12,
529 .size_bits = 12,
530 .get_from_field = mv64x60_shift_left,
531 .map_to_field = mv64x60_shift_right,
532 .extra = 0 },
533 [MV64x60_PCI02MEM_SNOOP_3_WIN] = {
534 .base_hi_reg = GT64260_PCI0_SNOOP_3_BASE_HI,
535 .base_lo_reg = GT64260_PCI0_SNOOP_3_BASE_LO,
536 .size_reg = GT64260_PCI0_SNOOP_3_SIZE,
537 .base_lo_bits = 12,
538 .size_bits = 12,
539 .get_from_field = mv64x60_shift_left,
540 .map_to_field = mv64x60_shift_right,
541 .extra = 0 },
542 /* PCI 1->MEM Snoop Windows */
543 [MV64x60_PCI12MEM_SNOOP_0_WIN] = {
544 .base_hi_reg = GT64260_PCI1_SNOOP_0_BASE_HI,
545 .base_lo_reg = GT64260_PCI1_SNOOP_0_BASE_LO,
546 .size_reg = GT64260_PCI1_SNOOP_0_SIZE,
547 .base_lo_bits = 12,
548 .size_bits = 12,
549 .get_from_field = mv64x60_shift_left,
550 .map_to_field = mv64x60_shift_right,
551 .extra = 0 },
552 [MV64x60_PCI12MEM_SNOOP_1_WIN] = {
553 .base_hi_reg = GT64260_PCI1_SNOOP_1_BASE_HI,
554 .base_lo_reg = GT64260_PCI1_SNOOP_1_BASE_LO,
555 .size_reg = GT64260_PCI1_SNOOP_1_SIZE,
556 .base_lo_bits = 12,
557 .size_bits = 12,
558 .get_from_field = mv64x60_shift_left,
559 .map_to_field = mv64x60_shift_right,
560 .extra = 0 },
561 [MV64x60_PCI12MEM_SNOOP_2_WIN] = {
562 .base_hi_reg = GT64260_PCI1_SNOOP_2_BASE_HI,
563 .base_lo_reg = GT64260_PCI1_SNOOP_2_BASE_LO,
564 .size_reg = GT64260_PCI1_SNOOP_2_SIZE,
565 .base_lo_bits = 12,
566 .size_bits = 12,
567 .get_from_field = mv64x60_shift_left,
568 .map_to_field = mv64x60_shift_right,
569 .extra = 0 },
570 [MV64x60_PCI12MEM_SNOOP_3_WIN] = {
571 .base_hi_reg = GT64260_PCI1_SNOOP_3_BASE_HI,
572 .base_lo_reg = GT64260_PCI1_SNOOP_3_BASE_LO,
573 .size_reg = GT64260_PCI1_SNOOP_3_SIZE,
574 .base_lo_bits = 12,
575 .size_bits = 12,
576 .get_from_field = mv64x60_shift_left,
577 .map_to_field = mv64x60_shift_right,
578 .extra = 0 },
579};
580
581struct mv64x60_32bit_window
582 mv64360_32bit_windows[MV64x60_32BIT_WIN_COUNT] __initdata = {
583 /* CPU->MEM Windows */
584 [MV64x60_CPU2MEM_0_WIN] = {
585 .base_reg = MV64x60_CPU2MEM_0_BASE,
586 .size_reg = MV64x60_CPU2MEM_0_SIZE,
587 .base_bits = 16,
588 .size_bits = 16,
589 .get_from_field = mv64x60_shift_left,
590 .map_to_field = mv64x60_shift_right,
591 .extra = MV64x60_EXTRA_CPUWIN_ENAB | 0 },
592 [MV64x60_CPU2MEM_1_WIN] = {
593 .base_reg = MV64x60_CPU2MEM_1_BASE,
594 .size_reg = MV64x60_CPU2MEM_1_SIZE,
595 .base_bits = 16,
596 .size_bits = 16,
597 .get_from_field = mv64x60_shift_left,
598 .map_to_field = mv64x60_shift_right,
599 .extra = MV64x60_EXTRA_CPUWIN_ENAB | 1 },
600 [MV64x60_CPU2MEM_2_WIN] = {
601 .base_reg = MV64x60_CPU2MEM_2_BASE,
602 .size_reg = MV64x60_CPU2MEM_2_SIZE,
603 .base_bits = 16,
604 .size_bits = 16,
605 .get_from_field = mv64x60_shift_left,
606 .map_to_field = mv64x60_shift_right,
607 .extra = MV64x60_EXTRA_CPUWIN_ENAB | 2 },
608 [MV64x60_CPU2MEM_3_WIN] = {
609 .base_reg = MV64x60_CPU2MEM_3_BASE,
610 .size_reg = MV64x60_CPU2MEM_3_SIZE,
611 .base_bits = 16,
612 .size_bits = 16,
613 .get_from_field = mv64x60_shift_left,
614 .map_to_field = mv64x60_shift_right,
615 .extra = MV64x60_EXTRA_CPUWIN_ENAB | 3 },
616 /* CPU->Device Windows */
617 [MV64x60_CPU2DEV_0_WIN] = {
618 .base_reg = MV64x60_CPU2DEV_0_BASE,
619 .size_reg = MV64x60_CPU2DEV_0_SIZE,
620 .base_bits = 16,
621 .size_bits = 16,
622 .get_from_field = mv64x60_shift_left,
623 .map_to_field = mv64x60_shift_right,
624 .extra = MV64x60_EXTRA_CPUWIN_ENAB | 4 },
625 [MV64x60_CPU2DEV_1_WIN] = {
626 .base_reg = MV64x60_CPU2DEV_1_BASE,
627 .size_reg = MV64x60_CPU2DEV_1_SIZE,
628 .base_bits = 16,
629 .size_bits = 16,
630 .get_from_field = mv64x60_shift_left,
631 .map_to_field = mv64x60_shift_right,
632 .extra = MV64x60_EXTRA_CPUWIN_ENAB | 5 },
633 [MV64x60_CPU2DEV_2_WIN] = {
634 .base_reg = MV64x60_CPU2DEV_2_BASE,
635 .size_reg = MV64x60_CPU2DEV_2_SIZE,
636 .base_bits = 16,
637 .size_bits = 16,
638 .get_from_field = mv64x60_shift_left,
639 .map_to_field = mv64x60_shift_right,
640 .extra = MV64x60_EXTRA_CPUWIN_ENAB | 6 },
641 [MV64x60_CPU2DEV_3_WIN] = {
642 .base_reg = MV64x60_CPU2DEV_3_BASE,
643 .size_reg = MV64x60_CPU2DEV_3_SIZE,
644 .base_bits = 16,
645 .size_bits = 16,
646 .get_from_field = mv64x60_shift_left,
647 .map_to_field = mv64x60_shift_right,
648 .extra = MV64x60_EXTRA_CPUWIN_ENAB | 7 },
649 /* CPU->Boot Window */
650 [MV64x60_CPU2BOOT_WIN] = {
651 .base_reg = MV64x60_CPU2BOOT_0_BASE,
652 .size_reg = MV64x60_CPU2BOOT_0_SIZE,
653 .base_bits = 16,
654 .size_bits = 16,
655 .get_from_field = mv64x60_shift_left,
656 .map_to_field = mv64x60_shift_right,
657 .extra = MV64x60_EXTRA_CPUWIN_ENAB | 8 },
658 /* CPU->PCI 0 Windows */
659 [MV64x60_CPU2PCI0_IO_WIN] = {
660 .base_reg = MV64x60_CPU2PCI0_IO_BASE,
661 .size_reg = MV64x60_CPU2PCI0_IO_SIZE,
662 .base_bits = 16,
663 .size_bits = 16,
664 .get_from_field = mv64x60_shift_left,
665 .map_to_field = mv64x60_shift_right,
666 .extra = MV64x60_EXTRA_CPUWIN_ENAB | 9 },
667 [MV64x60_CPU2PCI0_MEM_0_WIN] = {
668 .base_reg = MV64x60_CPU2PCI0_MEM_0_BASE,
669 .size_reg = MV64x60_CPU2PCI0_MEM_0_SIZE,
670 .base_bits = 16,
671 .size_bits = 16,
672 .get_from_field = mv64x60_shift_left,
673 .map_to_field = mv64x60_shift_right,
674 .extra = MV64x60_EXTRA_CPUWIN_ENAB | 10 },
675 [MV64x60_CPU2PCI0_MEM_1_WIN] = {
676 .base_reg = MV64x60_CPU2PCI0_MEM_1_BASE,
677 .size_reg = MV64x60_CPU2PCI0_MEM_1_SIZE,
678 .base_bits = 16,
679 .size_bits = 16,
680 .get_from_field = mv64x60_shift_left,
681 .map_to_field = mv64x60_shift_right,
682 .extra = MV64x60_EXTRA_CPUWIN_ENAB | 11 },
683 [MV64x60_CPU2PCI0_MEM_2_WIN] = {
684 .base_reg = MV64x60_CPU2PCI0_MEM_2_BASE,
685 .size_reg = MV64x60_CPU2PCI0_MEM_2_SIZE,
686 .base_bits = 16,
687 .size_bits = 16,
688 .get_from_field = mv64x60_shift_left,
689 .map_to_field = mv64x60_shift_right,
690 .extra = MV64x60_EXTRA_CPUWIN_ENAB | 12 },
691 [MV64x60_CPU2PCI0_MEM_3_WIN] = {
692 .base_reg = MV64x60_CPU2PCI0_MEM_3_BASE,
693 .size_reg = MV64x60_CPU2PCI0_MEM_3_SIZE,
694 .base_bits = 16,
695 .size_bits = 16,
696 .get_from_field = mv64x60_shift_left,
697 .map_to_field = mv64x60_shift_right,
698 .extra = MV64x60_EXTRA_CPUWIN_ENAB | 13 },
699 /* CPU->PCI 1 Windows */
700 [MV64x60_CPU2PCI1_IO_WIN] = {
701 .base_reg = MV64x60_CPU2PCI1_IO_BASE,
702 .size_reg = MV64x60_CPU2PCI1_IO_SIZE,
703 .base_bits = 16,
704 .size_bits = 16,
705 .get_from_field = mv64x60_shift_left,
706 .map_to_field = mv64x60_shift_right,
707 .extra = MV64x60_EXTRA_CPUWIN_ENAB | 14 },
708 [MV64x60_CPU2PCI1_MEM_0_WIN] = {
709 .base_reg = MV64x60_CPU2PCI1_MEM_0_BASE,
710 .size_reg = MV64x60_CPU2PCI1_MEM_0_SIZE,
711 .base_bits = 16,
712 .size_bits = 16,
713 .get_from_field = mv64x60_shift_left,
714 .map_to_field = mv64x60_shift_right,
715 .extra = MV64x60_EXTRA_CPUWIN_ENAB | 15 },
716 [MV64x60_CPU2PCI1_MEM_1_WIN] = {
717 .base_reg = MV64x60_CPU2PCI1_MEM_1_BASE,
718 .size_reg = MV64x60_CPU2PCI1_MEM_1_SIZE,
719 .base_bits = 16,
720 .size_bits = 16,
721 .get_from_field = mv64x60_shift_left,
722 .map_to_field = mv64x60_shift_right,
723 .extra = MV64x60_EXTRA_CPUWIN_ENAB | 16 },
724 [MV64x60_CPU2PCI1_MEM_2_WIN] = {
725 .base_reg = MV64x60_CPU2PCI1_MEM_2_BASE,
726 .size_reg = MV64x60_CPU2PCI1_MEM_2_SIZE,
727 .base_bits = 16,
728 .size_bits = 16,
729 .get_from_field = mv64x60_shift_left,
730 .map_to_field = mv64x60_shift_right,
731 .extra = MV64x60_EXTRA_CPUWIN_ENAB | 17 },
732 [MV64x60_CPU2PCI1_MEM_3_WIN] = {
733 .base_reg = MV64x60_CPU2PCI1_MEM_3_BASE,
734 .size_reg = MV64x60_CPU2PCI1_MEM_3_SIZE,
735 .base_bits = 16,
736 .size_bits = 16,
737 .get_from_field = mv64x60_shift_left,
738 .map_to_field = mv64x60_shift_right,
739 .extra = MV64x60_EXTRA_CPUWIN_ENAB | 18 },
740 /* CPU->SRAM Window */
741 [MV64x60_CPU2SRAM_WIN] = {
742 .base_reg = MV64360_CPU2SRAM_BASE,
743 .size_reg = 0,
744 .base_bits = 16,
745 .size_bits = 0,
746 .get_from_field = mv64x60_shift_left,
747 .map_to_field = mv64x60_shift_right,
748 .extra = MV64x60_EXTRA_CPUWIN_ENAB | 19 },
749 /* CPU->PCI 0 Remap I/O Window */
750 [MV64x60_CPU2PCI0_IO_REMAP_WIN] = {
751 .base_reg = MV64x60_CPU2PCI0_IO_REMAP,
752 .size_reg = 0,
753 .base_bits = 16,
754 .size_bits = 0,
755 .get_from_field = mv64x60_shift_left,
756 .map_to_field = mv64x60_shift_right,
757 .extra = 0 },
758 /* CPU->PCI 1 Remap I/O Window */
759 [MV64x60_CPU2PCI1_IO_REMAP_WIN] = {
760 .base_reg = MV64x60_CPU2PCI1_IO_REMAP,
761 .size_reg = 0,
762 .base_bits = 16,
763 .size_bits = 0,
764 .get_from_field = mv64x60_shift_left,
765 .map_to_field = mv64x60_shift_right,
766 .extra = 0 },
767 /* CPU Memory Protection Windows */
768 [MV64x60_CPU_PROT_0_WIN] = {
769 .base_reg = MV64x60_CPU_PROT_BASE_0,
770 .size_reg = MV64x60_CPU_PROT_SIZE_0,
771 .base_bits = 16,
772 .size_bits = 16,
773 .get_from_field = mv64x60_shift_left,
774 .map_to_field = mv64x60_shift_right,
775 .extra = MV64x60_EXTRA_CPUPROT_ENAB | 31 },
776 [MV64x60_CPU_PROT_1_WIN] = {
777 .base_reg = MV64x60_CPU_PROT_BASE_1,
778 .size_reg = MV64x60_CPU_PROT_SIZE_1,
779 .base_bits = 16,
780 .size_bits = 16,
781 .get_from_field = mv64x60_shift_left,
782 .map_to_field = mv64x60_shift_right,
783 .extra = MV64x60_EXTRA_CPUPROT_ENAB | 31 },
784 [MV64x60_CPU_PROT_2_WIN] = {
785 .base_reg = MV64x60_CPU_PROT_BASE_2,
786 .size_reg = MV64x60_CPU_PROT_SIZE_2,
787 .base_bits = 16,
788 .size_bits = 16,
789 .get_from_field = mv64x60_shift_left,
790 .map_to_field = mv64x60_shift_right,
791 .extra = MV64x60_EXTRA_CPUPROT_ENAB | 31 },
792 [MV64x60_CPU_PROT_3_WIN] = {
793 .base_reg = MV64x60_CPU_PROT_BASE_3,
794 .size_reg = MV64x60_CPU_PROT_SIZE_3,
795 .base_bits = 16,
796 .size_bits = 16,
797 .get_from_field = mv64x60_shift_left,
798 .map_to_field = mv64x60_shift_right,
799 .extra = MV64x60_EXTRA_CPUPROT_ENAB | 31 },
800 /* CPU Snoop Windows -- don't exist on 64360 */
801 /* PCI 0->System Memory Remap Windows */
802 [MV64x60_PCI02MEM_REMAP_0_WIN] = {
803 .base_reg = MV64x60_PCI0_SLAVE_MEM_0_REMAP,
804 .size_reg = 0,
805 .base_bits = 20,
806 .size_bits = 0,
807 .get_from_field = mv64x60_mask,
808 .map_to_field = mv64x60_mask,
809 .extra = 0 },
810 [MV64x60_PCI02MEM_REMAP_1_WIN] = {
811 .base_reg = MV64x60_PCI0_SLAVE_MEM_1_REMAP,
812 .size_reg = 0,
813 .base_bits = 20,
814 .size_bits = 0,
815 .get_from_field = mv64x60_mask,
816 .map_to_field = mv64x60_mask,
817 .extra = 0 },
818 [MV64x60_PCI02MEM_REMAP_2_WIN] = {
819 .base_reg = MV64x60_PCI0_SLAVE_MEM_1_REMAP,
820 .size_reg = 0,
821 .base_bits = 20,
822 .size_bits = 0,
823 .get_from_field = mv64x60_mask,
824 .map_to_field = mv64x60_mask,
825 .extra = 0 },
826 [MV64x60_PCI02MEM_REMAP_3_WIN] = {
827 .base_reg = MV64x60_PCI0_SLAVE_MEM_1_REMAP,
828 .size_reg = 0,
829 .base_bits = 20,
830 .size_bits = 0,
831 .get_from_field = mv64x60_mask,
832 .map_to_field = mv64x60_mask,
833 .extra = 0 },
834 /* PCI 1->System Memory Remap Windows */
835 [MV64x60_PCI12MEM_REMAP_0_WIN] = {
836 .base_reg = MV64x60_PCI1_SLAVE_MEM_0_REMAP,
837 .size_reg = 0,
838 .base_bits = 20,
839 .size_bits = 0,
840 .get_from_field = mv64x60_mask,
841 .map_to_field = mv64x60_mask,
842 .extra = 0 },
843 [MV64x60_PCI12MEM_REMAP_1_WIN] = {
844 .base_reg = MV64x60_PCI1_SLAVE_MEM_1_REMAP,
845 .size_reg = 0,
846 .base_bits = 20,
847 .size_bits = 0,
848 .get_from_field = mv64x60_mask,
849 .map_to_field = mv64x60_mask,
850 .extra = 0 },
851 [MV64x60_PCI12MEM_REMAP_2_WIN] = {
852 .base_reg = MV64x60_PCI1_SLAVE_MEM_1_REMAP,
853 .size_reg = 0,
854 .base_bits = 20,
855 .size_bits = 0,
856 .get_from_field = mv64x60_mask,
857 .map_to_field = mv64x60_mask,
858 .extra = 0 },
859 [MV64x60_PCI12MEM_REMAP_3_WIN] = {
860 .base_reg = MV64x60_PCI1_SLAVE_MEM_1_REMAP,
861 .size_reg = 0,
862 .base_bits = 20,
863 .size_bits = 0,
864 .get_from_field = mv64x60_mask,
865 .map_to_field = mv64x60_mask,
866 .extra = 0 },
867 /* ENET->System Memory Windows */
868 [MV64x60_ENET2MEM_0_WIN] = {
869 .base_reg = MV64360_ENET2MEM_0_BASE,
870 .size_reg = MV64360_ENET2MEM_0_SIZE,
871 .base_bits = 16,
872 .size_bits = 16,
873 .get_from_field = mv64x60_mask,
874 .map_to_field = mv64x60_mask,
875 .extra = MV64x60_EXTRA_ENET_ENAB | 0 },
876 [MV64x60_ENET2MEM_1_WIN] = {
877 .base_reg = MV64360_ENET2MEM_1_BASE,
878 .size_reg = MV64360_ENET2MEM_1_SIZE,
879 .base_bits = 16,
880 .size_bits = 16,
881 .get_from_field = mv64x60_mask,
882 .map_to_field = mv64x60_mask,
883 .extra = MV64x60_EXTRA_ENET_ENAB | 1 },
884 [MV64x60_ENET2MEM_2_WIN] = {
885 .base_reg = MV64360_ENET2MEM_2_BASE,
886 .size_reg = MV64360_ENET2MEM_2_SIZE,
887 .base_bits = 16,
888 .size_bits = 16,
889 .get_from_field = mv64x60_mask,
890 .map_to_field = mv64x60_mask,
891 .extra = MV64x60_EXTRA_ENET_ENAB | 2 },
892 [MV64x60_ENET2MEM_3_WIN] = {
893 .base_reg = MV64360_ENET2MEM_3_BASE,
894 .size_reg = MV64360_ENET2MEM_3_SIZE,
895 .base_bits = 16,
896 .size_bits = 16,
897 .get_from_field = mv64x60_mask,
898 .map_to_field = mv64x60_mask,
899 .extra = MV64x60_EXTRA_ENET_ENAB | 3 },
900 [MV64x60_ENET2MEM_4_WIN] = {
901 .base_reg = MV64360_ENET2MEM_4_BASE,
902 .size_reg = MV64360_ENET2MEM_4_SIZE,
903 .base_bits = 16,
904 .size_bits = 16,
905 .get_from_field = mv64x60_mask,
906 .map_to_field = mv64x60_mask,
907 .extra = MV64x60_EXTRA_ENET_ENAB | 4 },
908 [MV64x60_ENET2MEM_5_WIN] = {
909 .base_reg = MV64360_ENET2MEM_5_BASE,
910 .size_reg = MV64360_ENET2MEM_5_SIZE,
911 .base_bits = 16,
912 .size_bits = 16,
913 .get_from_field = mv64x60_mask,
914 .map_to_field = mv64x60_mask,
915 .extra = MV64x60_EXTRA_ENET_ENAB | 5 },
916 /* MPSC->System Memory Windows */
917 [MV64x60_MPSC2MEM_0_WIN] = {
918 .base_reg = MV64360_MPSC2MEM_0_BASE,
919 .size_reg = MV64360_MPSC2MEM_0_SIZE,
920 .base_bits = 16,
921 .size_bits = 16,
922 .get_from_field = mv64x60_mask,
923 .map_to_field = mv64x60_mask,
924 .extra = MV64x60_EXTRA_MPSC_ENAB | 0 },
925 [MV64x60_MPSC2MEM_1_WIN] = {
926 .base_reg = MV64360_MPSC2MEM_1_BASE,
927 .size_reg = MV64360_MPSC2MEM_1_SIZE,
928 .base_bits = 16,
929 .size_bits = 16,
930 .get_from_field = mv64x60_mask,
931 .map_to_field = mv64x60_mask,
932 .extra = MV64x60_EXTRA_MPSC_ENAB | 1 },
933 [MV64x60_MPSC2MEM_2_WIN] = {
934 .base_reg = MV64360_MPSC2MEM_2_BASE,
935 .size_reg = MV64360_MPSC2MEM_2_SIZE,
936 .base_bits = 16,
937 .size_bits = 16,
938 .get_from_field = mv64x60_mask,
939 .map_to_field = mv64x60_mask,
940 .extra = MV64x60_EXTRA_MPSC_ENAB | 2 },
941 [MV64x60_MPSC2MEM_3_WIN] = {
942 .base_reg = MV64360_MPSC2MEM_3_BASE,
943 .size_reg = MV64360_MPSC2MEM_3_SIZE,
944 .base_bits = 16,
945 .size_bits = 16,
946 .get_from_field = mv64x60_mask,
947 .map_to_field = mv64x60_mask,
948 .extra = MV64x60_EXTRA_MPSC_ENAB | 3 },
949 /* IDMA->System Memory Windows */
950 [MV64x60_IDMA2MEM_0_WIN] = {
951 .base_reg = MV64360_IDMA2MEM_0_BASE,
952 .size_reg = MV64360_IDMA2MEM_0_SIZE,
953 .base_bits = 16,
954 .size_bits = 16,
955 .get_from_field = mv64x60_mask,
956 .map_to_field = mv64x60_mask,
957 .extra = MV64x60_EXTRA_IDMA_ENAB | 0 },
958 [MV64x60_IDMA2MEM_1_WIN] = {
959 .base_reg = MV64360_IDMA2MEM_1_BASE,
960 .size_reg = MV64360_IDMA2MEM_1_SIZE,
961 .base_bits = 16,
962 .size_bits = 16,
963 .get_from_field = mv64x60_mask,
964 .map_to_field = mv64x60_mask,
965 .extra = MV64x60_EXTRA_IDMA_ENAB | 1 },
966 [MV64x60_IDMA2MEM_2_WIN] = {
967 .base_reg = MV64360_IDMA2MEM_2_BASE,
968 .size_reg = MV64360_IDMA2MEM_2_SIZE,
969 .base_bits = 16,
970 .size_bits = 16,
971 .get_from_field = mv64x60_mask,
972 .map_to_field = mv64x60_mask,
973 .extra = MV64x60_EXTRA_IDMA_ENAB | 2 },
974 [MV64x60_IDMA2MEM_3_WIN] = {
975 .base_reg = MV64360_IDMA2MEM_3_BASE,
976 .size_reg = MV64360_IDMA2MEM_3_SIZE,
977 .base_bits = 16,
978 .size_bits = 16,
979 .get_from_field = mv64x60_mask,
980 .map_to_field = mv64x60_mask,
981 .extra = MV64x60_EXTRA_IDMA_ENAB | 3 },
982 [MV64x60_IDMA2MEM_4_WIN] = {
983 .base_reg = MV64360_IDMA2MEM_4_BASE,
984 .size_reg = MV64360_IDMA2MEM_4_SIZE,
985 .base_bits = 16,
986 .size_bits = 16,
987 .get_from_field = mv64x60_mask,
988 .map_to_field = mv64x60_mask,
989 .extra = MV64x60_EXTRA_IDMA_ENAB | 4 },
990 [MV64x60_IDMA2MEM_5_WIN] = {
991 .base_reg = MV64360_IDMA2MEM_5_BASE,
992 .size_reg = MV64360_IDMA2MEM_5_SIZE,
993 .base_bits = 16,
994 .size_bits = 16,
995 .get_from_field = mv64x60_mask,
996 .map_to_field = mv64x60_mask,
997 .extra = MV64x60_EXTRA_IDMA_ENAB | 5 },
998 [MV64x60_IDMA2MEM_6_WIN] = {
999 .base_reg = MV64360_IDMA2MEM_6_BASE,
1000 .size_reg = MV64360_IDMA2MEM_6_SIZE,
1001 .base_bits = 16,
1002 .size_bits = 16,
1003 .get_from_field = mv64x60_mask,
1004 .map_to_field = mv64x60_mask,
1005 .extra = MV64x60_EXTRA_IDMA_ENAB | 6 },
1006 [MV64x60_IDMA2MEM_7_WIN] = {
1007 .base_reg = MV64360_IDMA2MEM_7_BASE,
1008 .size_reg = MV64360_IDMA2MEM_7_SIZE,
1009 .base_bits = 16,
1010 .size_bits = 16,
1011 .get_from_field = mv64x60_mask,
1012 .map_to_field = mv64x60_mask,
1013 .extra = MV64x60_EXTRA_IDMA_ENAB | 7 },
1014};
1015
1016struct mv64x60_64bit_window
1017 mv64360_64bit_windows[MV64x60_64BIT_WIN_COUNT] __initdata = {
1018 /* CPU->PCI 0 MEM Remap Windows */
1019 [MV64x60_CPU2PCI0_MEM_0_REMAP_WIN] = {
1020 .base_hi_reg = MV64x60_CPU2PCI0_MEM_0_REMAP_HI,
1021 .base_lo_reg = MV64x60_CPU2PCI0_MEM_0_REMAP_LO,
1022 .size_reg = 0,
1023 .base_lo_bits = 16,
1024 .size_bits = 0,
1025 .get_from_field = mv64x60_shift_left,
1026 .map_to_field = mv64x60_shift_right,
1027 .extra = 0 },
1028 [MV64x60_CPU2PCI0_MEM_1_REMAP_WIN] = {
1029 .base_hi_reg = MV64x60_CPU2PCI0_MEM_1_REMAP_HI,
1030 .base_lo_reg = MV64x60_CPU2PCI0_MEM_1_REMAP_LO,
1031 .size_reg = 0,
1032 .base_lo_bits = 16,
1033 .size_bits = 0,
1034 .get_from_field = mv64x60_shift_left,
1035 .map_to_field = mv64x60_shift_right,
1036 .extra = 0 },
1037 [MV64x60_CPU2PCI0_MEM_2_REMAP_WIN] = {
1038 .base_hi_reg = MV64x60_CPU2PCI0_MEM_2_REMAP_HI,
1039 .base_lo_reg = MV64x60_CPU2PCI0_MEM_2_REMAP_LO,
1040 .size_reg = 0,
1041 .base_lo_bits = 16,
1042 .size_bits = 0,
1043 .get_from_field = mv64x60_shift_left,
1044 .map_to_field = mv64x60_shift_right,
1045 .extra = 0 },
1046 [MV64x60_CPU2PCI0_MEM_3_REMAP_WIN] = {
1047 .base_hi_reg = MV64x60_CPU2PCI0_MEM_3_REMAP_HI,
1048 .base_lo_reg = MV64x60_CPU2PCI0_MEM_3_REMAP_LO,
1049 .size_reg = 0,
1050 .base_lo_bits = 16,
1051 .size_bits = 0,
1052 .get_from_field = mv64x60_shift_left,
1053 .map_to_field = mv64x60_shift_right,
1054 .extra = 0 },
1055 /* CPU->PCI 1 MEM Remap Windows */
1056 [MV64x60_CPU2PCI1_MEM_0_REMAP_WIN] = {
1057 .base_hi_reg = MV64x60_CPU2PCI1_MEM_0_REMAP_HI,
1058 .base_lo_reg = MV64x60_CPU2PCI1_MEM_0_REMAP_LO,
1059 .size_reg = 0,
1060 .base_lo_bits = 16,
1061 .size_bits = 0,
1062 .get_from_field = mv64x60_shift_left,
1063 .map_to_field = mv64x60_shift_right,
1064 .extra = 0 },
1065 [MV64x60_CPU2PCI1_MEM_1_REMAP_WIN] = {
1066 .base_hi_reg = MV64x60_CPU2PCI1_MEM_1_REMAP_HI,
1067 .base_lo_reg = MV64x60_CPU2PCI1_MEM_1_REMAP_LO,
1068 .size_reg = 0,
1069 .base_lo_bits = 16,
1070 .size_bits = 0,
1071 .get_from_field = mv64x60_shift_left,
1072 .map_to_field = mv64x60_shift_right,
1073 .extra = 0 },
1074 [MV64x60_CPU2PCI1_MEM_2_REMAP_WIN] = {
1075 .base_hi_reg = MV64x60_CPU2PCI1_MEM_2_REMAP_HI,
1076 .base_lo_reg = MV64x60_CPU2PCI1_MEM_2_REMAP_LO,
1077 .size_reg = 0,
1078 .base_lo_bits = 16,
1079 .size_bits = 0,
1080 .get_from_field = mv64x60_shift_left,
1081 .map_to_field = mv64x60_shift_right,
1082 .extra = 0 },
1083 [MV64x60_CPU2PCI1_MEM_3_REMAP_WIN] = {
1084 .base_hi_reg = MV64x60_CPU2PCI1_MEM_3_REMAP_HI,
1085 .base_lo_reg = MV64x60_CPU2PCI1_MEM_3_REMAP_LO,
1086 .size_reg = 0,
1087 .base_lo_bits = 16,
1088 .size_bits = 0,
1089 .get_from_field = mv64x60_shift_left,
1090 .map_to_field = mv64x60_shift_right,
1091 .extra = 0 },
1092 /* PCI 0->MEM Access Control Windows */
1093 [MV64x60_PCI02MEM_ACC_CNTL_0_WIN] = {
1094 .base_hi_reg = MV64x60_PCI0_ACC_CNTL_0_BASE_HI,
1095 .base_lo_reg = MV64x60_PCI0_ACC_CNTL_0_BASE_LO,
1096 .size_reg = MV64x60_PCI0_ACC_CNTL_0_SIZE,
1097 .base_lo_bits = 20,
1098 .size_bits = 20,
1099 .get_from_field = mv64x60_mask,
1100 .map_to_field = mv64x60_mask,
1101 .extra = MV64x60_EXTRA_PCIACC_ENAB | 0 },
1102 [MV64x60_PCI02MEM_ACC_CNTL_1_WIN] = {
1103 .base_hi_reg = MV64x60_PCI0_ACC_CNTL_1_BASE_HI,
1104 .base_lo_reg = MV64x60_PCI0_ACC_CNTL_1_BASE_LO,
1105 .size_reg = MV64x60_PCI0_ACC_CNTL_1_SIZE,
1106 .base_lo_bits = 20,
1107 .size_bits = 20,
1108 .get_from_field = mv64x60_mask,
1109 .map_to_field = mv64x60_mask,
1110 .extra = MV64x60_EXTRA_PCIACC_ENAB | 0 },
1111 [MV64x60_PCI02MEM_ACC_CNTL_2_WIN] = {
1112 .base_hi_reg = MV64x60_PCI0_ACC_CNTL_2_BASE_HI,
1113 .base_lo_reg = MV64x60_PCI0_ACC_CNTL_2_BASE_LO,
1114 .size_reg = MV64x60_PCI0_ACC_CNTL_2_SIZE,
1115 .base_lo_bits = 20,
1116 .size_bits = 20,
1117 .get_from_field = mv64x60_mask,
1118 .map_to_field = mv64x60_mask,
1119 .extra = MV64x60_EXTRA_PCIACC_ENAB | 0 },
1120 [MV64x60_PCI02MEM_ACC_CNTL_3_WIN] = {
1121 .base_hi_reg = MV64x60_PCI0_ACC_CNTL_3_BASE_HI,
1122 .base_lo_reg = MV64x60_PCI0_ACC_CNTL_3_BASE_LO,
1123 .size_reg = MV64x60_PCI0_ACC_CNTL_3_SIZE,
1124 .base_lo_bits = 20,
1125 .size_bits = 20,
1126 .get_from_field = mv64x60_mask,
1127 .map_to_field = mv64x60_mask,
1128 .extra = MV64x60_EXTRA_PCIACC_ENAB | 0 },
1129 /* PCI 1->MEM Access Control Windows */
1130 [MV64x60_PCI12MEM_ACC_CNTL_0_WIN] = {
1131 .base_hi_reg = MV64x60_PCI1_ACC_CNTL_0_BASE_HI,
1132 .base_lo_reg = MV64x60_PCI1_ACC_CNTL_0_BASE_LO,
1133 .size_reg = MV64x60_PCI1_ACC_CNTL_0_SIZE,
1134 .base_lo_bits = 20,
1135 .size_bits = 20,
1136 .get_from_field = mv64x60_mask,
1137 .map_to_field = mv64x60_mask,
1138 .extra = MV64x60_EXTRA_PCIACC_ENAB | 0 },
1139 [MV64x60_PCI12MEM_ACC_CNTL_1_WIN] = {
1140 .base_hi_reg = MV64x60_PCI1_ACC_CNTL_1_BASE_HI,
1141 .base_lo_reg = MV64x60_PCI1_ACC_CNTL_1_BASE_LO,
1142 .size_reg = MV64x60_PCI1_ACC_CNTL_1_SIZE,
1143 .base_lo_bits = 20,
1144 .size_bits = 20,
1145 .get_from_field = mv64x60_mask,
1146 .map_to_field = mv64x60_mask,
1147 .extra = MV64x60_EXTRA_PCIACC_ENAB | 0 },
1148 [MV64x60_PCI12MEM_ACC_CNTL_2_WIN] = {
1149 .base_hi_reg = MV64x60_PCI1_ACC_CNTL_2_BASE_HI,
1150 .base_lo_reg = MV64x60_PCI1_ACC_CNTL_2_BASE_LO,
1151 .size_reg = MV64x60_PCI1_ACC_CNTL_2_SIZE,
1152 .base_lo_bits = 20,
1153 .size_bits = 20,
1154 .get_from_field = mv64x60_mask,
1155 .map_to_field = mv64x60_mask,
1156 .extra = MV64x60_EXTRA_PCIACC_ENAB | 0 },
1157 [MV64x60_PCI12MEM_ACC_CNTL_3_WIN] = {
1158 .base_hi_reg = MV64x60_PCI1_ACC_CNTL_3_BASE_HI,
1159 .base_lo_reg = MV64x60_PCI1_ACC_CNTL_3_BASE_LO,
1160 .size_reg = MV64x60_PCI1_ACC_CNTL_3_SIZE,
1161 .base_lo_bits = 20,
1162 .size_bits = 20,
1163 .get_from_field = mv64x60_mask,
1164 .map_to_field = mv64x60_mask,
1165 .extra = MV64x60_EXTRA_PCIACC_ENAB | 0 },
1166 /* PCI 0->MEM Snoop Windows -- don't exist on 64360 */
1167 /* PCI 1->MEM Snoop Windows -- don't exist on 64360 */
1168};
diff --git a/arch/ppc/syslib/ocp.c b/arch/ppc/syslib/ocp.c
new file mode 100644
index 000000000000..a5156c5179a6
--- /dev/null
+++ b/arch/ppc/syslib/ocp.c
@@ -0,0 +1,485 @@
1/*
2 * ocp.c
3 *
4 * (c) Benjamin Herrenschmidt (benh@kernel.crashing.org)
5 * Mipsys - France
6 *
7 * Derived from work (c) Armin Kuster akuster@pacbell.net
8 *
9 * Additional support and port to 2.6 LDM/sysfs by
10 * Matt Porter <mporter@kernel.crashing.org>
11 * Copyright 2004 MontaVista Software, Inc.
12 *
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the
15 * Free Software Foundation; either version 2 of the License, or (at your
16 * option) any later version.
17 *
18 * OCP (On Chip Peripheral) is a software emulated "bus" with a
19 * pseudo discovery method for dumb peripherals. Usually these type
20 * of peripherals are found on embedded SoC (System On a Chip)
21 * processors or highly integrated system controllers that have
22 * a host bridge and many peripherals. Common examples where
23 * this is already used include the PPC4xx, PPC85xx, MPC52xx,
24 * and MV64xxx parts.
25 *
26 * This subsystem creates a standard OCP bus type within the
27 * device model. The devices on the OCP bus are seeded by an
28 * an initial OCP device array created by the arch-specific
29 * Device entries can be added/removed/modified through OCP
30 * helper functions to accomodate system and board-specific
31 * parameters commonly found in embedded systems. OCP also
32 * provides a standard method for devices to describe extended
33 * attributes about themselves to the system. A standard access
34 * method allows OCP drivers to obtain the information, both
35 * SoC-specific and system/board-specific, needed for operation.
36 */
37
38#include <linux/module.h>
39#include <linux/config.h>
40#include <linux/list.h>
41#include <linux/miscdevice.h>
42#include <linux/slab.h>
43#include <linux/types.h>
44#include <linux/init.h>
45#include <linux/pm.h>
46#include <linux/bootmem.h>
47#include <linux/device.h>
48
49#include <asm/io.h>
50#include <asm/ocp.h>
51#include <asm/errno.h>
52#include <asm/rwsem.h>
53#include <asm/semaphore.h>
54
55//#define DBG(x) printk x
56#define DBG(x)
57
58extern int mem_init_done;
59
60extern struct ocp_def core_ocp[]; /* Static list of devices, provided by
61 CPU core */
62
63LIST_HEAD(ocp_devices); /* List of all OCP devices */
64DECLARE_RWSEM(ocp_devices_sem); /* Global semaphores for those lists */
65
66static int ocp_inited;
67
68/* Sysfs support */
69#define OCP_DEF_ATTR(field, format_string) \
70static ssize_t \
71show_##field(struct device *dev, char *buf) \
72{ \
73 struct ocp_device *odev = to_ocp_dev(dev); \
74 \
75 return sprintf(buf, format_string, odev->def->field); \
76} \
77static DEVICE_ATTR(field, S_IRUGO, show_##field, NULL);
78
79OCP_DEF_ATTR(vendor, "0x%04x\n");
80OCP_DEF_ATTR(function, "0x%04x\n");
81OCP_DEF_ATTR(index, "0x%04x\n");
82#ifdef CONFIG_PTE_64BIT
83OCP_DEF_ATTR(paddr, "0x%016Lx\n");
84#else
85OCP_DEF_ATTR(paddr, "0x%08lx\n");
86#endif
87OCP_DEF_ATTR(irq, "%d\n");
88OCP_DEF_ATTR(pm, "%lu\n");
89
90void ocp_create_sysfs_dev_files(struct ocp_device *odev)
91{
92 struct device *dev = &odev->dev;
93
94 /* Current OCP device def attributes */
95 device_create_file(dev, &dev_attr_vendor);
96 device_create_file(dev, &dev_attr_function);
97 device_create_file(dev, &dev_attr_index);
98 device_create_file(dev, &dev_attr_paddr);
99 device_create_file(dev, &dev_attr_irq);
100 device_create_file(dev, &dev_attr_pm);
101 /* Current OCP device additions attributes */
102 if (odev->def->additions && odev->def->show)
103 odev->def->show(dev);
104}
105
106/**
107 * ocp_device_match - Match one driver to one device
108 * @drv: driver to match
109 * @dev: device to match
110 *
111 * This function returns 0 if the driver and device don't match
112 */
113static int
114ocp_device_match(struct device *dev, struct device_driver *drv)
115{
116 struct ocp_device *ocp_dev = to_ocp_dev(dev);
117 struct ocp_driver *ocp_drv = to_ocp_drv(drv);
118 const struct ocp_device_id *ids = ocp_drv->id_table;
119
120 if (!ids)
121 return 0;
122
123 while (ids->vendor || ids->function) {
124 if ((ids->vendor == OCP_ANY_ID
125 || ids->vendor == ocp_dev->def->vendor)
126 && (ids->function == OCP_ANY_ID
127 || ids->function == ocp_dev->def->function))
128 return 1;
129 ids++;
130 }
131 return 0;
132}
133
134static int
135ocp_device_probe(struct device *dev)
136{
137 int error = 0;
138 struct ocp_driver *drv;
139 struct ocp_device *ocp_dev;
140
141 drv = to_ocp_drv(dev->driver);
142 ocp_dev = to_ocp_dev(dev);
143
144 if (drv->probe) {
145 error = drv->probe(ocp_dev);
146 if (error >= 0) {
147 ocp_dev->driver = drv;
148 error = 0;
149 }
150 }
151 return error;
152}
153
154static int
155ocp_device_remove(struct device *dev)
156{
157 struct ocp_device *ocp_dev = to_ocp_dev(dev);
158
159 if (ocp_dev->driver) {
160 if (ocp_dev->driver->remove)
161 ocp_dev->driver->remove(ocp_dev);
162 ocp_dev->driver = NULL;
163 }
164 return 0;
165}
166
167static int
168ocp_device_suspend(struct device *dev, u32 state)
169{
170 struct ocp_device *ocp_dev = to_ocp_dev(dev);
171 struct ocp_driver *ocp_drv = to_ocp_drv(dev->driver);
172
173 if (dev->driver && ocp_drv->suspend)
174 return ocp_drv->suspend(ocp_dev, state);
175 return 0;
176}
177
178static int
179ocp_device_resume(struct device *dev)
180{
181 struct ocp_device *ocp_dev = to_ocp_dev(dev);
182 struct ocp_driver *ocp_drv = to_ocp_drv(dev->driver);
183
184 if (dev->driver && ocp_drv->resume)
185 return ocp_drv->resume(ocp_dev);
186 return 0;
187}
188
189struct bus_type ocp_bus_type = {
190 .name = "ocp",
191 .match = ocp_device_match,
192 .suspend = ocp_device_suspend,
193 .resume = ocp_device_resume,
194};
195
196/**
197 * ocp_register_driver - Register an OCP driver
198 * @drv: pointer to statically defined ocp_driver structure
199 *
200 * The driver's probe() callback is called either recursively
201 * by this function or upon later call of ocp_driver_init
202 *
203 * NOTE: Detection of devices is a 2 pass step on this implementation,
204 * hotswap isn't supported. First, all OCP devices are put in the device
205 * list, _then_ all drivers are probed on each match.
206 */
207int
208ocp_register_driver(struct ocp_driver *drv)
209{
210 /* initialize common driver fields */
211 drv->driver.name = drv->name;
212 drv->driver.bus = &ocp_bus_type;
213 drv->driver.probe = ocp_device_probe;
214 drv->driver.remove = ocp_device_remove;
215
216 /* register with core */
217 return driver_register(&drv->driver);
218}
219
220/**
221 * ocp_unregister_driver - Unregister an OCP driver
222 * @drv: pointer to statically defined ocp_driver structure
223 *
224 * The driver's remove() callback is called recursively
225 * by this function for any device already registered
226 */
227void
228ocp_unregister_driver(struct ocp_driver *drv)
229{
230 DBG(("ocp: ocp_unregister_driver(%s)...\n", drv->name));
231
232 driver_unregister(&drv->driver);
233
234 DBG(("ocp: ocp_unregister_driver(%s)... done.\n", drv->name));
235}
236
237/* Core of ocp_find_device(). Caller must hold ocp_devices_sem */
238static struct ocp_device *
239__ocp_find_device(unsigned int vendor, unsigned int function, int index)
240{
241 struct list_head *entry;
242 struct ocp_device *dev, *found = NULL;
243
244 DBG(("ocp: __ocp_find_device(vendor: %x, function: %x, index: %d)...\n", vendor, function, index));
245
246 list_for_each(entry, &ocp_devices) {
247 dev = list_entry(entry, struct ocp_device, link);
248 if (vendor != OCP_ANY_ID && vendor != dev->def->vendor)
249 continue;
250 if (function != OCP_ANY_ID && function != dev->def->function)
251 continue;
252 if (index != OCP_ANY_INDEX && index != dev->def->index)
253 continue;
254 found = dev;
255 break;
256 }
257
258 DBG(("ocp: __ocp_find_device(vendor: %x, function: %x, index: %d)... done\n", vendor, function, index));
259
260 return found;
261}
262
263/**
264 * ocp_find_device - Find a device by function & index
265 * @vendor: vendor ID of the device (or OCP_ANY_ID)
266 * @function: function code of the device (or OCP_ANY_ID)
267 * @idx: index of the device (or OCP_ANY_INDEX)
268 *
269 * This function allows a lookup of a given function by it's
270 * index, it's typically used to find the MAL or ZMII associated
271 * with an EMAC or similar horrors.
272 * You can pass vendor, though you usually want OCP_ANY_ID there...
273 */
274struct ocp_device *
275ocp_find_device(unsigned int vendor, unsigned int function, int index)
276{
277 struct ocp_device *dev;
278
279 down_read(&ocp_devices_sem);
280 dev = __ocp_find_device(vendor, function, index);
281 up_read(&ocp_devices_sem);
282
283 return dev;
284}
285
286/**
287 * ocp_get_one_device - Find a def by function & index
288 * @vendor: vendor ID of the device (or OCP_ANY_ID)
289 * @function: function code of the device (or OCP_ANY_ID)
290 * @idx: index of the device (or OCP_ANY_INDEX)
291 *
292 * This function allows a lookup of a given ocp_def by it's
293 * vendor, function, and index. The main purpose for is to
294 * allow modification of the def before binding to the driver
295 */
296struct ocp_def *
297ocp_get_one_device(unsigned int vendor, unsigned int function, int index)
298{
299 struct ocp_device *dev;
300 struct ocp_def *found = NULL;
301
302 DBG(("ocp: ocp_get_one_device(vendor: %x, function: %x, index: %d)...\n",
303 vendor, function, index));
304
305 dev = ocp_find_device(vendor, function, index);
306
307 if (dev)
308 found = dev->def;
309
310 DBG(("ocp: ocp_get_one_device(vendor: %x, function: %x, index: %d)... done.\n",
311 vendor, function, index));
312
313 return found;
314}
315
316/**
317 * ocp_add_one_device - Add a device
318 * @def: static device definition structure
319 *
320 * This function adds a device definition to the
321 * device list. It may only be called before
322 * ocp_driver_init() and will return an error
323 * otherwise.
324 */
325int
326ocp_add_one_device(struct ocp_def *def)
327{
328 struct ocp_device *dev;
329
330 DBG(("ocp: ocp_add_one_device()...\n"));
331
332 /* Can't be called after ocp driver init */
333 if (ocp_inited)
334 return 1;
335
336 if (mem_init_done)
337 dev = kmalloc(sizeof(*dev), GFP_KERNEL);
338 else
339 dev = alloc_bootmem(sizeof(*dev));
340
341 if (dev == NULL)
342 return 1;
343 memset(dev, 0, sizeof(*dev));
344 dev->def = def;
345 dev->current_state = 4;
346 sprintf(dev->name, "OCP device %04x:%04x:%04x",
347 dev->def->vendor, dev->def->function, dev->def->index);
348 down_write(&ocp_devices_sem);
349 list_add_tail(&dev->link, &ocp_devices);
350 up_write(&ocp_devices_sem);
351
352 DBG(("ocp: ocp_add_one_device()...done\n"));
353
354 return 0;
355}
356
357/**
358 * ocp_remove_one_device - Remove a device by function & index
359 * @vendor: vendor ID of the device (or OCP_ANY_ID)
360 * @function: function code of the device (or OCP_ANY_ID)
361 * @idx: index of the device (or OCP_ANY_INDEX)
362 *
363 * This function allows removal of a given function by its
364 * index. It may only be called before ocp_driver_init()
365 * and will return an error otherwise.
366 */
367int
368ocp_remove_one_device(unsigned int vendor, unsigned int function, int index)
369{
370 struct ocp_device *dev;
371
372 DBG(("ocp: ocp_remove_one_device(vendor: %x, function: %x, index: %d)...\n", vendor, function, index));
373
374 /* Can't be called after ocp driver init */
375 if (ocp_inited)
376 return 1;
377
378 down_write(&ocp_devices_sem);
379 dev = __ocp_find_device(vendor, function, index);
380 list_del((struct list_head *)dev);
381 up_write(&ocp_devices_sem);
382
383 DBG(("ocp: ocp_remove_one_device(vendor: %x, function: %x, index: %d)... done.\n", vendor, function, index));
384
385 return 0;
386}
387
388/**
389 * ocp_for_each_device - Iterate over OCP devices
390 * @callback: routine to execute for each ocp device.
391 * @arg: user data to be passed to callback routine.
392 *
393 * This routine holds the ocp_device semaphore, so the
394 * callback routine cannot modify the ocp_device list.
395 */
396void
397ocp_for_each_device(void(*callback)(struct ocp_device *, void *arg), void *arg)
398{
399 struct list_head *entry;
400
401 if (callback) {
402 down_read(&ocp_devices_sem);
403 list_for_each(entry, &ocp_devices)
404 callback(list_entry(entry, struct ocp_device, link),
405 arg);
406 up_read(&ocp_devices_sem);
407 }
408}
409
410/**
411 * ocp_early_init - Init OCP device management
412 *
413 * This function builds the list of devices before setup_arch.
414 * This allows platform code to modify the device lists before
415 * they are bound to drivers (changes to paddr, removing devices
416 * etc)
417 */
418int __init
419ocp_early_init(void)
420{
421 struct ocp_def *def;
422
423 DBG(("ocp: ocp_early_init()...\n"));
424
425 /* Fill the devices list */
426 for (def = core_ocp; def->vendor != OCP_VENDOR_INVALID; def++)
427 ocp_add_one_device(def);
428
429 DBG(("ocp: ocp_early_init()... done.\n"));
430
431 return 0;
432}
433
434/**
435 * ocp_driver_init - Init OCP device management
436 *
437 * This function is meant to be called via OCP bus registration.
438 */
439static int __init
440ocp_driver_init(void)
441{
442 int ret = 0, index = 0;
443 struct device *ocp_bus;
444 struct list_head *entry;
445 struct ocp_device *dev;
446
447 if (ocp_inited)
448 return ret;
449 ocp_inited = 1;
450
451 DBG(("ocp: ocp_driver_init()...\n"));
452
453 /* Allocate/register primary OCP bus */
454 ocp_bus = kmalloc(sizeof(struct device), GFP_KERNEL);
455 if (ocp_bus == NULL)
456 return 1;
457 memset(ocp_bus, 0, sizeof(struct device));
458 strcpy(ocp_bus->bus_id, "ocp");
459
460 bus_register(&ocp_bus_type);
461
462 device_register(ocp_bus);
463
464 /* Put each OCP device into global device list */
465 list_for_each(entry, &ocp_devices) {
466 dev = list_entry(entry, struct ocp_device, link);
467 sprintf(dev->dev.bus_id, "%2.2x", index);
468 dev->dev.parent = ocp_bus;
469 dev->dev.bus = &ocp_bus_type;
470 device_register(&dev->dev);
471 ocp_create_sysfs_dev_files(dev);
472 index++;
473 }
474
475 DBG(("ocp: ocp_driver_init()... done.\n"));
476
477 return 0;
478}
479
480postcore_initcall(ocp_driver_init);
481
482EXPORT_SYMBOL(ocp_bus_type);
483EXPORT_SYMBOL(ocp_find_device);
484EXPORT_SYMBOL(ocp_register_driver);
485EXPORT_SYMBOL(ocp_unregister_driver);
diff --git a/arch/ppc/syslib/of_device.c b/arch/ppc/syslib/of_device.c
new file mode 100644
index 000000000000..46269ed21aee
--- /dev/null
+++ b/arch/ppc/syslib/of_device.c
@@ -0,0 +1,273 @@
1#include <linux/config.h>
2#include <linux/string.h>
3#include <linux/kernel.h>
4#include <linux/init.h>
5#include <linux/module.h>
6#include <asm/errno.h>
7#include <asm/of_device.h>
8
9/**
10 * of_match_device - Tell if an of_device structure has a matching
11 * of_match structure
12 * @ids: array of of device match structures to search in
13 * @dev: the of device structure to match against
14 *
15 * Used by a driver to check whether an of_device present in the
16 * system is in its list of supported devices.
17 */
18const struct of_match * of_match_device(const struct of_match *matches,
19 const struct of_device *dev)
20{
21 if (!dev->node)
22 return NULL;
23 while (matches->name || matches->type || matches->compatible) {
24 int match = 1;
25 if (matches->name && matches->name != OF_ANY_MATCH)
26 match &= dev->node->name
27 && !strcmp(matches->name, dev->node->name);
28 if (matches->type && matches->type != OF_ANY_MATCH)
29 match &= dev->node->type
30 && !strcmp(matches->type, dev->node->type);
31 if (matches->compatible && matches->compatible != OF_ANY_MATCH)
32 match &= device_is_compatible(dev->node,
33 matches->compatible);
34 if (match)
35 return matches;
36 matches++;
37 }
38 return NULL;
39}
40
41static int of_platform_bus_match(struct device *dev, struct device_driver *drv)
42{
43 struct of_device * of_dev = to_of_device(dev);
44 struct of_platform_driver * of_drv = to_of_platform_driver(drv);
45 const struct of_match * matches = of_drv->match_table;
46
47 if (!matches)
48 return 0;
49
50 return of_match_device(matches, of_dev) != NULL;
51}
52
53struct of_device *of_dev_get(struct of_device *dev)
54{
55 struct device *tmp;
56
57 if (!dev)
58 return NULL;
59 tmp = get_device(&dev->dev);
60 if (tmp)
61 return to_of_device(tmp);
62 else
63 return NULL;
64}
65
66void of_dev_put(struct of_device *dev)
67{
68 if (dev)
69 put_device(&dev->dev);
70}
71
72
73static int of_device_probe(struct device *dev)
74{
75 int error = -ENODEV;
76 struct of_platform_driver *drv;
77 struct of_device *of_dev;
78 const struct of_match *match;
79
80 drv = to_of_platform_driver(dev->driver);
81 of_dev = to_of_device(dev);
82
83 if (!drv->probe)
84 return error;
85
86 of_dev_get(of_dev);
87
88 match = of_match_device(drv->match_table, of_dev);
89 if (match)
90 error = drv->probe(of_dev, match);
91 if (error)
92 of_dev_put(of_dev);
93
94 return error;
95}
96
97static int of_device_remove(struct device *dev)
98{
99 struct of_device * of_dev = to_of_device(dev);
100 struct of_platform_driver * drv = to_of_platform_driver(dev->driver);
101
102 if (dev->driver && drv->remove)
103 drv->remove(of_dev);
104 return 0;
105}
106
107static int of_device_suspend(struct device *dev, u32 state)
108{
109 struct of_device * of_dev = to_of_device(dev);
110 struct of_platform_driver * drv = to_of_platform_driver(dev->driver);
111 int error = 0;
112
113 if (dev->driver && drv->suspend)
114 error = drv->suspend(of_dev, state);
115 return error;
116}
117
118static int of_device_resume(struct device * dev)
119{
120 struct of_device * of_dev = to_of_device(dev);
121 struct of_platform_driver * drv = to_of_platform_driver(dev->driver);
122 int error = 0;
123
124 if (dev->driver && drv->resume)
125 error = drv->resume(of_dev);
126 return error;
127}
128
129struct bus_type of_platform_bus_type = {
130 .name = "of_platform",
131 .match = of_platform_bus_match,
132 .suspend = of_device_suspend,
133 .resume = of_device_resume,
134};
135
136static int __init of_bus_driver_init(void)
137{
138 return bus_register(&of_platform_bus_type);
139}
140
141postcore_initcall(of_bus_driver_init);
142
143int of_register_driver(struct of_platform_driver *drv)
144{
145 int count = 0;
146
147 /* initialize common driver fields */
148 drv->driver.name = drv->name;
149 drv->driver.bus = &of_platform_bus_type;
150 drv->driver.probe = of_device_probe;
151 drv->driver.remove = of_device_remove;
152
153 /* register with core */
154 count = driver_register(&drv->driver);
155 return count ? count : 1;
156}
157
158void of_unregister_driver(struct of_platform_driver *drv)
159{
160 driver_unregister(&drv->driver);
161}
162
163
164static ssize_t dev_show_devspec(struct device *dev, char *buf)
165{
166 struct of_device *ofdev;
167
168 ofdev = to_of_device(dev);
169 return sprintf(buf, "%s", ofdev->node->full_name);
170}
171
172static DEVICE_ATTR(devspec, S_IRUGO, dev_show_devspec, NULL);
173
174/**
175 * of_release_dev - free an of device structure when all users of it are finished.
176 * @dev: device that's been disconnected
177 *
178 * Will be called only by the device core when all users of this of device are
179 * done.
180 */
181void of_release_dev(struct device *dev)
182{
183 struct of_device *ofdev;
184
185 ofdev = to_of_device(dev);
186 of_node_put(ofdev->node);
187 kfree(ofdev);
188}
189
190int of_device_register(struct of_device *ofdev)
191{
192 int rc;
193 struct of_device **odprop;
194
195 BUG_ON(ofdev->node == NULL);
196
197 odprop = (struct of_device **)get_property(ofdev->node, "linux,device", NULL);
198 if (!odprop) {
199 struct property *new_prop;
200
201 new_prop = kmalloc(sizeof(struct property) + sizeof(struct of_device *),
202 GFP_KERNEL);
203 if (new_prop == NULL)
204 return -ENOMEM;
205 new_prop->name = "linux,device";
206 new_prop->length = sizeof(sizeof(struct of_device *));
207 new_prop->value = (unsigned char *)&new_prop[1];
208 odprop = (struct of_device **)new_prop->value;
209 *odprop = NULL;
210 prom_add_property(ofdev->node, new_prop);
211 }
212 *odprop = ofdev;
213
214 rc = device_register(&ofdev->dev);
215 if (rc)
216 return rc;
217
218 device_create_file(&ofdev->dev, &dev_attr_devspec);
219
220 return 0;
221}
222
223void of_device_unregister(struct of_device *ofdev)
224{
225 struct of_device **odprop;
226
227 device_remove_file(&ofdev->dev, &dev_attr_devspec);
228
229 odprop = (struct of_device **)get_property(ofdev->node, "linux,device", NULL);
230 if (odprop)
231 *odprop = NULL;
232
233 device_unregister(&ofdev->dev);
234}
235
236struct of_device* of_platform_device_create(struct device_node *np, const char *bus_id)
237{
238 struct of_device *dev;
239 u32 *reg;
240
241 dev = kmalloc(sizeof(*dev), GFP_KERNEL);
242 if (!dev)
243 return NULL;
244 memset(dev, 0, sizeof(*dev));
245
246 dev->node = of_node_get(np);
247 dev->dma_mask = 0xffffffffUL;
248 dev->dev.dma_mask = &dev->dma_mask;
249 dev->dev.parent = NULL;
250 dev->dev.bus = &of_platform_bus_type;
251 dev->dev.release = of_release_dev;
252
253 reg = (u32 *)get_property(np, "reg", NULL);
254 strlcpy(dev->dev.bus_id, bus_id, BUS_ID_SIZE);
255
256 if (of_device_register(dev) != 0) {
257 kfree(dev);
258 return NULL;
259 }
260
261 return dev;
262}
263
264EXPORT_SYMBOL(of_match_device);
265EXPORT_SYMBOL(of_platform_bus_type);
266EXPORT_SYMBOL(of_register_driver);
267EXPORT_SYMBOL(of_unregister_driver);
268EXPORT_SYMBOL(of_device_register);
269EXPORT_SYMBOL(of_device_unregister);
270EXPORT_SYMBOL(of_dev_get);
271EXPORT_SYMBOL(of_dev_put);
272EXPORT_SYMBOL(of_platform_device_create);
273EXPORT_SYMBOL(of_release_dev);
diff --git a/arch/ppc/syslib/open_pic.c b/arch/ppc/syslib/open_pic.c
new file mode 100644
index 000000000000..406f36a8a681
--- /dev/null
+++ b/arch/ppc/syslib/open_pic.c
@@ -0,0 +1,1083 @@
1/*
2 * arch/ppc/kernel/open_pic.c -- OpenPIC Interrupt Handling
3 *
4 * Copyright (C) 1997 Geert Uytterhoeven
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file COPYING in the main directory of this archive
8 * for more details.
9 */
10
11#include <linux/config.h>
12#include <linux/types.h>
13#include <linux/kernel.h>
14#include <linux/sched.h>
15#include <linux/init.h>
16#include <linux/irq.h>
17#include <linux/interrupt.h>
18#include <linux/sysdev.h>
19#include <linux/errno.h>
20#include <asm/ptrace.h>
21#include <asm/signal.h>
22#include <asm/io.h>
23#include <asm/irq.h>
24#include <asm/prom.h>
25#include <asm/sections.h>
26#include <asm/open_pic.h>
27#include <asm/i8259.h>
28
29#include "open_pic_defs.h"
30
31#if defined(CONFIG_PRPMC800) || defined(CONFIG_85xx)
32#define OPENPIC_BIG_ENDIAN
33#endif
34
35void __iomem *OpenPIC_Addr;
36static volatile struct OpenPIC __iomem *OpenPIC = NULL;
37
38/*
39 * We define OpenPIC_InitSenses table thusly:
40 * bit 0x1: sense, 0 for edge and 1 for level.
41 * bit 0x2: polarity, 0 for negative, 1 for positive.
42 */
43u_int OpenPIC_NumInitSenses __initdata = 0;
44u_char *OpenPIC_InitSenses __initdata = NULL;
45extern int use_of_interrupt_tree;
46
47static u_int NumProcessors;
48static u_int NumSources;
49static int open_pic_irq_offset;
50static volatile OpenPIC_Source __iomem *ISR[NR_IRQS];
51static int openpic_cascade_irq = -1;
52static int (*openpic_cascade_fn)(struct pt_regs *);
53
54/* Global Operations */
55static void openpic_disable_8259_pass_through(void);
56static void openpic_set_spurious(u_int vector);
57
58#ifdef CONFIG_SMP
59/* Interprocessor Interrupts */
60static void openpic_initipi(u_int ipi, u_int pri, u_int vector);
61static irqreturn_t openpic_ipi_action(int cpl, void *dev_id, struct pt_regs *);
62#endif
63
64/* Timer Interrupts */
65static void openpic_inittimer(u_int timer, u_int pri, u_int vector);
66static void openpic_maptimer(u_int timer, cpumask_t cpumask);
67
68/* Interrupt Sources */
69static void openpic_enable_irq(u_int irq);
70static void openpic_disable_irq(u_int irq);
71static void openpic_initirq(u_int irq, u_int pri, u_int vector, int polarity,
72 int is_level);
73static void openpic_mapirq(u_int irq, cpumask_t cpumask, cpumask_t keepmask);
74
75/*
76 * These functions are not used but the code is kept here
77 * for completeness and future reference.
78 */
79#ifdef notused
80static void openpic_enable_8259_pass_through(void);
81static u_int openpic_get_priority(void);
82static u_int openpic_get_spurious(void);
83static void openpic_set_sense(u_int irq, int sense);
84#endif /* notused */
85
86/*
87 * Description of the openpic for the higher-level irq code
88 */
89static void openpic_end_irq(unsigned int irq_nr);
90static void openpic_ack_irq(unsigned int irq_nr);
91static void openpic_set_affinity(unsigned int irq_nr, cpumask_t cpumask);
92
93struct hw_interrupt_type open_pic = {
94 .typename = " OpenPIC ",
95 .enable = openpic_enable_irq,
96 .disable = openpic_disable_irq,
97 .ack = openpic_ack_irq,
98 .end = openpic_end_irq,
99 .set_affinity = openpic_set_affinity,
100};
101
102#ifdef CONFIG_SMP
103static void openpic_end_ipi(unsigned int irq_nr);
104static void openpic_ack_ipi(unsigned int irq_nr);
105static void openpic_enable_ipi(unsigned int irq_nr);
106static void openpic_disable_ipi(unsigned int irq_nr);
107
108struct hw_interrupt_type open_pic_ipi = {
109 .typename = " OpenPIC ",
110 .enable = openpic_enable_ipi,
111 .disable = openpic_disable_ipi,
112 .ack = openpic_ack_ipi,
113 .end = openpic_end_ipi,
114};
115#endif /* CONFIG_SMP */
116
117/*
118 * Accesses to the current processor's openpic registers
119 */
120#ifdef CONFIG_SMP
121#define THIS_CPU Processor[cpu]
122#define DECL_THIS_CPU int cpu = smp_hw_index[smp_processor_id()]
123#define CHECK_THIS_CPU check_arg_cpu(cpu)
124#else
125#define THIS_CPU Processor[0]
126#define DECL_THIS_CPU
127#define CHECK_THIS_CPU
128#endif /* CONFIG_SMP */
129
130#if 1
131#define check_arg_ipi(ipi) \
132 if (ipi < 0 || ipi >= OPENPIC_NUM_IPI) \
133 printk("open_pic.c:%d: invalid ipi %d\n", __LINE__, ipi);
134#define check_arg_timer(timer) \
135 if (timer < 0 || timer >= OPENPIC_NUM_TIMERS) \
136 printk("open_pic.c:%d: invalid timer %d\n", __LINE__, timer);
137#define check_arg_vec(vec) \
138 if (vec < 0 || vec >= OPENPIC_NUM_VECTORS) \
139 printk("open_pic.c:%d: invalid vector %d\n", __LINE__, vec);
140#define check_arg_pri(pri) \
141 if (pri < 0 || pri >= OPENPIC_NUM_PRI) \
142 printk("open_pic.c:%d: invalid priority %d\n", __LINE__, pri);
143/*
144 * Print out a backtrace if it's out of range, since if it's larger than NR_IRQ's
145 * data has probably been corrupted and we're going to panic or deadlock later
146 * anyway --Troy
147 */
148#define check_arg_irq(irq) \
149 if (irq < open_pic_irq_offset || irq >= NumSources+open_pic_irq_offset \
150 || ISR[irq - open_pic_irq_offset] == 0) { \
151 printk("open_pic.c:%d: invalid irq %d\n", __LINE__, irq); \
152 dump_stack(); }
153#define check_arg_cpu(cpu) \
154 if (cpu < 0 || cpu >= NumProcessors){ \
155 printk("open_pic.c:%d: invalid cpu %d\n", __LINE__, cpu); \
156 dump_stack(); }
157#else
158#define check_arg_ipi(ipi) do {} while (0)
159#define check_arg_timer(timer) do {} while (0)
160#define check_arg_vec(vec) do {} while (0)
161#define check_arg_pri(pri) do {} while (0)
162#define check_arg_irq(irq) do {} while (0)
163#define check_arg_cpu(cpu) do {} while (0)
164#endif
165
166u_int openpic_read(volatile u_int __iomem *addr)
167{
168 u_int val;
169
170#ifdef OPENPIC_BIG_ENDIAN
171 val = in_be32(addr);
172#else
173 val = in_le32(addr);
174#endif
175 return val;
176}
177
178static inline void openpic_write(volatile u_int __iomem *addr, u_int val)
179{
180#ifdef OPENPIC_BIG_ENDIAN
181 out_be32(addr, val);
182#else
183 out_le32(addr, val);
184#endif
185}
186
187static inline u_int openpic_readfield(volatile u_int __iomem *addr, u_int mask)
188{
189 u_int val = openpic_read(addr);
190 return val & mask;
191}
192
193inline void openpic_writefield(volatile u_int __iomem *addr, u_int mask,
194 u_int field)
195{
196 u_int val = openpic_read(addr);
197 openpic_write(addr, (val & ~mask) | (field & mask));
198}
199
200static inline void openpic_clearfield(volatile u_int __iomem *addr, u_int mask)
201{
202 openpic_writefield(addr, mask, 0);
203}
204
205static inline void openpic_setfield(volatile u_int __iomem *addr, u_int mask)
206{
207 openpic_writefield(addr, mask, mask);
208}
209
210static void openpic_safe_writefield(volatile u_int __iomem *addr, u_int mask,
211 u_int field)
212{
213 openpic_setfield(addr, OPENPIC_MASK);
214 while (openpic_read(addr) & OPENPIC_ACTIVITY);
215 openpic_writefield(addr, mask | OPENPIC_MASK, field | OPENPIC_MASK);
216}
217
218#ifdef CONFIG_SMP
219/* yes this is right ... bug, feature, you decide! -- tgall */
220u_int openpic_read_IPI(volatile u_int __iomem * addr)
221{
222 u_int val = 0;
223#if defined(OPENPIC_BIG_ENDIAN) || defined(CONFIG_POWER3)
224 val = in_be32(addr);
225#else
226 val = in_le32(addr);
227#endif
228 return val;
229}
230
231/* because of the power3 be / le above, this is needed */
232inline void openpic_writefield_IPI(volatile u_int __iomem * addr, u_int mask, u_int field)
233{
234 u_int val = openpic_read_IPI(addr);
235 openpic_write(addr, (val & ~mask) | (field & mask));
236}
237
238static inline void openpic_clearfield_IPI(volatile u_int __iomem *addr, u_int mask)
239{
240 openpic_writefield_IPI(addr, mask, 0);
241}
242
243static inline void openpic_setfield_IPI(volatile u_int __iomem *addr, u_int mask)
244{
245 openpic_writefield_IPI(addr, mask, mask);
246}
247
248static void openpic_safe_writefield_IPI(volatile u_int __iomem *addr, u_int mask, u_int field)
249{
250 openpic_setfield_IPI(addr, OPENPIC_MASK);
251
252 /* wait until it's not in use */
253 /* BenH: Is this code really enough ? I would rather check the result
254 * and eventually retry ...
255 */
256 while(openpic_read_IPI(addr) & OPENPIC_ACTIVITY);
257
258 openpic_writefield_IPI(addr, mask | OPENPIC_MASK, field | OPENPIC_MASK);
259}
260#endif /* CONFIG_SMP */
261
262#ifdef CONFIG_EPIC_SERIAL_MODE
263/* On platforms that may use EPIC serial mode, the default is enabled. */
264int epic_serial_mode = 1;
265
266static void __init openpic_eicr_set_clk(u_int clkval)
267{
268 openpic_writefield(&OpenPIC->Global.Global_Configuration1,
269 OPENPIC_EICR_S_CLK_MASK, (clkval << 28));
270}
271
272static void __init openpic_enable_sie(void)
273{
274 openpic_setfield(&OpenPIC->Global.Global_Configuration1,
275 OPENPIC_EICR_SIE);
276}
277#endif
278
279#if defined(CONFIG_EPIC_SERIAL_MODE) || defined(CONFIG_PM)
280static void openpic_reset(void)
281{
282 openpic_setfield(&OpenPIC->Global.Global_Configuration0,
283 OPENPIC_CONFIG_RESET);
284 while (openpic_readfield(&OpenPIC->Global.Global_Configuration0,
285 OPENPIC_CONFIG_RESET))
286 mb();
287}
288#endif
289
290void __init openpic_set_sources(int first_irq, int num_irqs, void __iomem *first_ISR)
291{
292 volatile OpenPIC_Source __iomem *src = first_ISR;
293 int i, last_irq;
294
295 last_irq = first_irq + num_irqs;
296 if (last_irq > NumSources)
297 NumSources = last_irq;
298 if (src == 0)
299 src = &((struct OpenPIC __iomem *)OpenPIC_Addr)->Source[first_irq];
300 for (i = first_irq; i < last_irq; ++i, ++src)
301 ISR[i] = src;
302}
303
304/*
305 * The `offset' parameter defines where the interrupts handled by the
306 * OpenPIC start in the space of interrupt numbers that the kernel knows
307 * about. In other words, the OpenPIC's IRQ0 is numbered `offset' in the
308 * kernel's interrupt numbering scheme.
309 * We assume there is only one OpenPIC.
310 */
311void __init openpic_init(int offset)
312{
313 u_int t, i;
314 u_int timerfreq;
315 const char *version;
316
317 if (!OpenPIC_Addr) {
318 printk("No OpenPIC found !\n");
319 return;
320 }
321 OpenPIC = (volatile struct OpenPIC __iomem *)OpenPIC_Addr;
322
323#ifdef CONFIG_EPIC_SERIAL_MODE
324 /* Have to start from ground zero.
325 */
326 openpic_reset();
327#endif
328
329 if (ppc_md.progress) ppc_md.progress("openpic: enter", 0x122);
330
331 t = openpic_read(&OpenPIC->Global.Feature_Reporting0);
332 switch (t & OPENPIC_FEATURE_VERSION_MASK) {
333 case 1:
334 version = "1.0";
335 break;
336 case 2:
337 version = "1.2";
338 break;
339 case 3:
340 version = "1.3";
341 break;
342 default:
343 version = "?";
344 break;
345 }
346 NumProcessors = ((t & OPENPIC_FEATURE_LAST_PROCESSOR_MASK) >>
347 OPENPIC_FEATURE_LAST_PROCESSOR_SHIFT) + 1;
348 if (NumSources == 0)
349 openpic_set_sources(0,
350 ((t & OPENPIC_FEATURE_LAST_SOURCE_MASK) >>
351 OPENPIC_FEATURE_LAST_SOURCE_SHIFT) + 1,
352 NULL);
353 printk("OpenPIC Version %s (%d CPUs and %d IRQ sources) at %p\n",
354 version, NumProcessors, NumSources, OpenPIC);
355 timerfreq = openpic_read(&OpenPIC->Global.Timer_Frequency);
356 if (timerfreq)
357 printk("OpenPIC timer frequency is %d.%06d MHz\n",
358 timerfreq / 1000000, timerfreq % 1000000);
359
360 open_pic_irq_offset = offset;
361
362 /* Initialize timer interrupts */
363 if ( ppc_md.progress ) ppc_md.progress("openpic: timer",0x3ba);
364 for (i = 0; i < OPENPIC_NUM_TIMERS; i++) {
365 /* Disabled, Priority 0 */
366 openpic_inittimer(i, 0, OPENPIC_VEC_TIMER+i+offset);
367 /* No processor */
368 openpic_maptimer(i, CPU_MASK_NONE);
369 }
370
371#ifdef CONFIG_SMP
372 /* Initialize IPI interrupts */
373 if ( ppc_md.progress ) ppc_md.progress("openpic: ipi",0x3bb);
374 for (i = 0; i < OPENPIC_NUM_IPI; i++) {
375 /* Disabled, Priority 10..13 */
376 openpic_initipi(i, 10+i, OPENPIC_VEC_IPI+i+offset);
377 /* IPIs are per-CPU */
378 irq_desc[OPENPIC_VEC_IPI+i+offset].status |= IRQ_PER_CPU;
379 irq_desc[OPENPIC_VEC_IPI+i+offset].handler = &open_pic_ipi;
380 }
381#endif
382
383 /* Initialize external interrupts */
384 if (ppc_md.progress) ppc_md.progress("openpic: external",0x3bc);
385
386 openpic_set_priority(0xf);
387
388 /* Init all external sources, including possibly the cascade. */
389 for (i = 0; i < NumSources; i++) {
390 int sense;
391
392 if (ISR[i] == 0)
393 continue;
394
395 /* the bootloader may have left it enabled (bad !) */
396 openpic_disable_irq(i+offset);
397
398 sense = (i < OpenPIC_NumInitSenses)? OpenPIC_InitSenses[i]: \
399 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE);
400
401 if (sense & IRQ_SENSE_MASK)
402 irq_desc[i+offset].status = IRQ_LEVEL;
403
404 /* Enabled, Priority 8 */
405 openpic_initirq(i, 8, i+offset, (sense & IRQ_POLARITY_MASK),
406 (sense & IRQ_SENSE_MASK));
407 /* Processor 0 */
408 openpic_mapirq(i, CPU_MASK_CPU0, CPU_MASK_NONE);
409 }
410
411 /* Init descriptors */
412 for (i = offset; i < NumSources + offset; i++)
413 irq_desc[i].handler = &open_pic;
414
415 /* Initialize the spurious interrupt */
416 if (ppc_md.progress) ppc_md.progress("openpic: spurious",0x3bd);
417 openpic_set_spurious(OPENPIC_VEC_SPURIOUS);
418 openpic_disable_8259_pass_through();
419#ifdef CONFIG_EPIC_SERIAL_MODE
420 if (epic_serial_mode) {
421 openpic_eicr_set_clk(7); /* Slowest value until we know better */
422 openpic_enable_sie();
423 }
424#endif
425 openpic_set_priority(0);
426
427 if (ppc_md.progress) ppc_md.progress("openpic: exit",0x222);
428}
429
430#ifdef notused
431static void openpic_enable_8259_pass_through(void)
432{
433 openpic_clearfield(&OpenPIC->Global.Global_Configuration0,
434 OPENPIC_CONFIG_8259_PASSTHROUGH_DISABLE);
435}
436#endif /* notused */
437
438static void openpic_disable_8259_pass_through(void)
439{
440 openpic_setfield(&OpenPIC->Global.Global_Configuration0,
441 OPENPIC_CONFIG_8259_PASSTHROUGH_DISABLE);
442}
443
444/*
445 * Find out the current interrupt
446 */
447u_int openpic_irq(void)
448{
449 u_int vec;
450 DECL_THIS_CPU;
451
452 CHECK_THIS_CPU;
453 vec = openpic_readfield(&OpenPIC->THIS_CPU.Interrupt_Acknowledge,
454 OPENPIC_VECTOR_MASK);
455 return vec;
456}
457
458void openpic_eoi(void)
459{
460 DECL_THIS_CPU;
461
462 CHECK_THIS_CPU;
463 openpic_write(&OpenPIC->THIS_CPU.EOI, 0);
464 /* Handle PCI write posting */
465 (void)openpic_read(&OpenPIC->THIS_CPU.EOI);
466}
467
468#ifdef notused
469static u_int openpic_get_priority(void)
470{
471 DECL_THIS_CPU;
472
473 CHECK_THIS_CPU;
474 return openpic_readfield(&OpenPIC->THIS_CPU.Current_Task_Priority,
475 OPENPIC_CURRENT_TASK_PRIORITY_MASK);
476}
477#endif /* notused */
478
479void openpic_set_priority(u_int pri)
480{
481 DECL_THIS_CPU;
482
483 CHECK_THIS_CPU;
484 check_arg_pri(pri);
485 openpic_writefield(&OpenPIC->THIS_CPU.Current_Task_Priority,
486 OPENPIC_CURRENT_TASK_PRIORITY_MASK, pri);
487}
488
489/*
490 * Get/set the spurious vector
491 */
492#ifdef notused
493static u_int openpic_get_spurious(void)
494{
495 return openpic_readfield(&OpenPIC->Global.Spurious_Vector,
496 OPENPIC_VECTOR_MASK);
497}
498#endif /* notused */
499
500static void openpic_set_spurious(u_int vec)
501{
502 check_arg_vec(vec);
503 openpic_writefield(&OpenPIC->Global.Spurious_Vector, OPENPIC_VECTOR_MASK,
504 vec);
505}
506
507#ifdef CONFIG_SMP
508/*
509 * Convert a cpu mask from logical to physical cpu numbers.
510 */
511static inline cpumask_t physmask(cpumask_t cpumask)
512{
513 int i;
514 cpumask_t mask = CPU_MASK_NONE;
515
516 cpus_and(cpumask, cpu_online_map, cpumask);
517
518 for (i = 0; i < NR_CPUS; i++)
519 if (cpu_isset(i, cpumask))
520 cpu_set(smp_hw_index[i], mask);
521
522 return mask;
523}
524#else
525#define physmask(cpumask) (cpumask)
526#endif
527
528void openpic_reset_processor_phys(u_int mask)
529{
530 openpic_write(&OpenPIC->Global.Processor_Initialization, mask);
531}
532
533#if defined(CONFIG_SMP) || defined(CONFIG_PM)
534static DEFINE_SPINLOCK(openpic_setup_lock);
535#endif
536
537#ifdef CONFIG_SMP
538/*
539 * Initialize an interprocessor interrupt (and disable it)
540 *
541 * ipi: OpenPIC interprocessor interrupt number
542 * pri: interrupt source priority
543 * vec: the vector it will produce
544 */
545static void __init openpic_initipi(u_int ipi, u_int pri, u_int vec)
546{
547 check_arg_ipi(ipi);
548 check_arg_pri(pri);
549 check_arg_vec(vec);
550 openpic_safe_writefield_IPI(&OpenPIC->Global.IPI_Vector_Priority(ipi),
551 OPENPIC_PRIORITY_MASK | OPENPIC_VECTOR_MASK,
552 (pri << OPENPIC_PRIORITY_SHIFT) | vec);
553}
554
555/*
556 * Send an IPI to one or more CPUs
557 *
558 * Externally called, however, it takes an IPI number (0...OPENPIC_NUM_IPI)
559 * and not a system-wide interrupt number
560 */
561void openpic_cause_IPI(u_int ipi, cpumask_t cpumask)
562{
563 cpumask_t phys;
564 DECL_THIS_CPU;
565
566 CHECK_THIS_CPU;
567 check_arg_ipi(ipi);
568 phys = physmask(cpumask);
569 openpic_write(&OpenPIC->THIS_CPU.IPI_Dispatch(ipi),
570 cpus_addr(physmask(cpumask))[0]);
571}
572
573void openpic_request_IPIs(void)
574{
575 int i;
576
577 /*
578 * Make sure this matches what is defined in smp.c for
579 * smp_message_{pass|recv}() or what shows up in
580 * /proc/interrupts will be wrong!!! --Troy */
581
582 if (OpenPIC == NULL)
583 return;
584
585 /* IPIs are marked SA_INTERRUPT as they must run with irqs disabled */
586 request_irq(OPENPIC_VEC_IPI+open_pic_irq_offset,
587 openpic_ipi_action, SA_INTERRUPT,
588 "IPI0 (call function)", NULL);
589 request_irq(OPENPIC_VEC_IPI+open_pic_irq_offset+1,
590 openpic_ipi_action, SA_INTERRUPT,
591 "IPI1 (reschedule)", NULL);
592 request_irq(OPENPIC_VEC_IPI+open_pic_irq_offset+2,
593 openpic_ipi_action, SA_INTERRUPT,
594 "IPI2 (invalidate tlb)", NULL);
595 request_irq(OPENPIC_VEC_IPI+open_pic_irq_offset+3,
596 openpic_ipi_action, SA_INTERRUPT,
597 "IPI3 (xmon break)", NULL);
598
599 for ( i = 0; i < OPENPIC_NUM_IPI ; i++ )
600 openpic_enable_ipi(OPENPIC_VEC_IPI+open_pic_irq_offset+i);
601}
602
603/*
604 * Do per-cpu setup for SMP systems.
605 *
606 * Get IPI's working and start taking interrupts.
607 * -- Cort
608 */
609
610void __devinit do_openpic_setup_cpu(void)
611{
612#ifdef CONFIG_IRQ_ALL_CPUS
613 int i;
614 cpumask_t msk = CPU_MASK_NONE;
615#endif
616 spin_lock(&openpic_setup_lock);
617
618#ifdef CONFIG_IRQ_ALL_CPUS
619 cpu_set(smp_hw_index[smp_processor_id()], msk);
620
621 /* let the openpic know we want intrs. default affinity
622 * is 0xffffffff until changed via /proc
623 * That's how it's done on x86. If we want it differently, then
624 * we should make sure we also change the default values of irq_affinity
625 * in irq.c.
626 */
627 for (i = 0; i < NumSources; i++)
628 openpic_mapirq(i, msk, CPU_MASK_ALL);
629#endif /* CONFIG_IRQ_ALL_CPUS */
630 openpic_set_priority(0);
631
632 spin_unlock(&openpic_setup_lock);
633}
634#endif /* CONFIG_SMP */
635
636/*
637 * Initialize a timer interrupt (and disable it)
638 *
639 * timer: OpenPIC timer number
640 * pri: interrupt source priority
641 * vec: the vector it will produce
642 */
643static void __init openpic_inittimer(u_int timer, u_int pri, u_int vec)
644{
645 check_arg_timer(timer);
646 check_arg_pri(pri);
647 check_arg_vec(vec);
648 openpic_safe_writefield(&OpenPIC->Global.Timer[timer].Vector_Priority,
649 OPENPIC_PRIORITY_MASK | OPENPIC_VECTOR_MASK,
650 (pri << OPENPIC_PRIORITY_SHIFT) | vec);
651}
652
653/*
654 * Map a timer interrupt to one or more CPUs
655 */
656static void __init openpic_maptimer(u_int timer, cpumask_t cpumask)
657{
658 cpumask_t phys = physmask(cpumask);
659 check_arg_timer(timer);
660 openpic_write(&OpenPIC->Global.Timer[timer].Destination,
661 cpus_addr(phys)[0]);
662}
663
664/*
665 * Initalize the interrupt source which will generate an NMI.
666 * This raises the interrupt's priority from 8 to 9.
667 *
668 * irq: The logical IRQ which generates an NMI.
669 */
670void __init
671openpic_init_nmi_irq(u_int irq)
672{
673 check_arg_irq(irq);
674 openpic_safe_writefield(&ISR[irq - open_pic_irq_offset]->Vector_Priority,
675 OPENPIC_PRIORITY_MASK,
676 9 << OPENPIC_PRIORITY_SHIFT);
677}
678
679/*
680 *
681 * All functions below take an offset'ed irq argument
682 *
683 */
684
685/*
686 * Hookup a cascade to the OpenPIC.
687 */
688
689static struct irqaction openpic_cascade_irqaction = {
690 .handler = no_action,
691 .flags = SA_INTERRUPT,
692 .mask = CPU_MASK_NONE,
693};
694
695void __init
696openpic_hookup_cascade(u_int irq, char *name,
697 int (*cascade_fn)(struct pt_regs *))
698{
699 openpic_cascade_irq = irq;
700 openpic_cascade_fn = cascade_fn;
701
702 if (setup_irq(irq, &openpic_cascade_irqaction))
703 printk("Unable to get OpenPIC IRQ %d for cascade\n",
704 irq - open_pic_irq_offset);
705}
706
707/*
708 * Enable/disable an external interrupt source
709 *
710 * Externally called, irq is an offseted system-wide interrupt number
711 */
712static void openpic_enable_irq(u_int irq)
713{
714 volatile u_int __iomem *vpp;
715
716 check_arg_irq(irq);
717 vpp = &ISR[irq - open_pic_irq_offset]->Vector_Priority;
718 openpic_clearfield(vpp, OPENPIC_MASK);
719 /* make sure mask gets to controller before we return to user */
720 do {
721 mb(); /* sync is probably useless here */
722 } while (openpic_readfield(vpp, OPENPIC_MASK));
723}
724
725static void openpic_disable_irq(u_int irq)
726{
727 volatile u_int __iomem *vpp;
728 u32 vp;
729
730 check_arg_irq(irq);
731 vpp = &ISR[irq - open_pic_irq_offset]->Vector_Priority;
732 openpic_setfield(vpp, OPENPIC_MASK);
733 /* make sure mask gets to controller before we return to user */
734 do {
735 mb(); /* sync is probably useless here */
736 vp = openpic_readfield(vpp, OPENPIC_MASK | OPENPIC_ACTIVITY);
737 } while((vp & OPENPIC_ACTIVITY) && !(vp & OPENPIC_MASK));
738}
739
740#ifdef CONFIG_SMP
741/*
742 * Enable/disable an IPI interrupt source
743 *
744 * Externally called, irq is an offseted system-wide interrupt number
745 */
746void openpic_enable_ipi(u_int irq)
747{
748 irq -= (OPENPIC_VEC_IPI+open_pic_irq_offset);
749 check_arg_ipi(irq);
750 openpic_clearfield_IPI(&OpenPIC->Global.IPI_Vector_Priority(irq), OPENPIC_MASK);
751
752}
753
754void openpic_disable_ipi(u_int irq)
755{
756 irq -= (OPENPIC_VEC_IPI+open_pic_irq_offset);
757 check_arg_ipi(irq);
758 openpic_setfield_IPI(&OpenPIC->Global.IPI_Vector_Priority(irq), OPENPIC_MASK);
759}
760#endif
761
762/*
763 * Initialize an interrupt source (and disable it!)
764 *
765 * irq: OpenPIC interrupt number
766 * pri: interrupt source priority
767 * vec: the vector it will produce
768 * pol: polarity (1 for positive, 0 for negative)
769 * sense: 1 for level, 0 for edge
770 */
771static void __init
772openpic_initirq(u_int irq, u_int pri, u_int vec, int pol, int sense)
773{
774 openpic_safe_writefield(&ISR[irq]->Vector_Priority,
775 OPENPIC_PRIORITY_MASK | OPENPIC_VECTOR_MASK |
776 OPENPIC_SENSE_MASK | OPENPIC_POLARITY_MASK,
777 (pri << OPENPIC_PRIORITY_SHIFT) | vec |
778 (pol ? OPENPIC_POLARITY_POSITIVE :
779 OPENPIC_POLARITY_NEGATIVE) |
780 (sense ? OPENPIC_SENSE_LEVEL : OPENPIC_SENSE_EDGE));
781}
782
783/*
784 * Map an interrupt source to one or more CPUs
785 */
786static void openpic_mapirq(u_int irq, cpumask_t physmask, cpumask_t keepmask)
787{
788 if (ISR[irq] == 0)
789 return;
790 if (!cpus_empty(keepmask)) {
791 cpumask_t irqdest = { .bits[0] = openpic_read(&ISR[irq]->Destination) };
792 cpus_and(irqdest, irqdest, keepmask);
793 cpus_or(physmask, physmask, irqdest);
794 }
795 openpic_write(&ISR[irq]->Destination, cpus_addr(physmask)[0]);
796}
797
798#ifdef notused
799/*
800 * Set the sense for an interrupt source (and disable it!)
801 *
802 * sense: 1 for level, 0 for edge
803 */
804static void openpic_set_sense(u_int irq, int sense)
805{
806 if (ISR[irq] != 0)
807 openpic_safe_writefield(&ISR[irq]->Vector_Priority,
808 OPENPIC_SENSE_LEVEL,
809 (sense ? OPENPIC_SENSE_LEVEL : 0));
810}
811#endif /* notused */
812
813/* No spinlocks, should not be necessary with the OpenPIC
814 * (1 register = 1 interrupt and we have the desc lock).
815 */
816static void openpic_ack_irq(unsigned int irq_nr)
817{
818#ifdef __SLOW_VERSION__
819 openpic_disable_irq(irq_nr);
820 openpic_eoi();
821#else
822 if ((irq_desc[irq_nr].status & IRQ_LEVEL) == 0)
823 openpic_eoi();
824#endif
825}
826
827static void openpic_end_irq(unsigned int irq_nr)
828{
829#ifdef __SLOW_VERSION__
830 if (!(irq_desc[irq_nr].status & (IRQ_DISABLED|IRQ_INPROGRESS))
831 && irq_desc[irq_nr].action)
832 openpic_enable_irq(irq_nr);
833#else
834 if ((irq_desc[irq_nr].status & IRQ_LEVEL) != 0)
835 openpic_eoi();
836#endif
837}
838
839static void openpic_set_affinity(unsigned int irq_nr, cpumask_t cpumask)
840{
841 openpic_mapirq(irq_nr - open_pic_irq_offset, physmask(cpumask), CPU_MASK_NONE);
842}
843
844#ifdef CONFIG_SMP
845static void openpic_ack_ipi(unsigned int irq_nr)
846{
847 openpic_eoi();
848}
849
850static void openpic_end_ipi(unsigned int irq_nr)
851{
852}
853
854static irqreturn_t openpic_ipi_action(int cpl, void *dev_id, struct pt_regs *regs)
855{
856 smp_message_recv(cpl-OPENPIC_VEC_IPI-open_pic_irq_offset, regs);
857 return IRQ_HANDLED;
858}
859
860#endif /* CONFIG_SMP */
861
862int
863openpic_get_irq(struct pt_regs *regs)
864{
865 int irq = openpic_irq();
866
867 /*
868 * Check for the cascade interrupt and call the cascaded
869 * interrupt controller function (usually i8259_irq) if so.
870 * This should move to irq.c eventually. -- paulus
871 */
872 if (irq == openpic_cascade_irq && openpic_cascade_fn != NULL) {
873 int cirq = openpic_cascade_fn(regs);
874
875 /* Allow for the cascade being shared with other devices */
876 if (cirq != -1) {
877 irq = cirq;
878 openpic_eoi();
879 }
880 } else if (irq == OPENPIC_VEC_SPURIOUS)
881 irq = -1;
882 return irq;
883}
884
885#ifdef CONFIG_SMP
886void
887smp_openpic_message_pass(int target, int msg, unsigned long data, int wait)
888{
889 cpumask_t mask = CPU_MASK_ALL;
890 /* make sure we're sending something that translates to an IPI */
891 if (msg > 0x3) {
892 printk("SMP %d: smp_message_pass: unknown msg %d\n",
893 smp_processor_id(), msg);
894 return;
895 }
896 switch (target) {
897 case MSG_ALL:
898 openpic_cause_IPI(msg, mask);
899 break;
900 case MSG_ALL_BUT_SELF:
901 cpu_clear(smp_processor_id(), mask);
902 openpic_cause_IPI(msg, mask);
903 break;
904 default:
905 openpic_cause_IPI(msg, cpumask_of_cpu(target));
906 break;
907 }
908}
909#endif /* CONFIG_SMP */
910
911#ifdef CONFIG_PM
912
913/*
914 * We implement the IRQ controller as a sysdev and put it
915 * to sleep at powerdown stage (the callback is named suspend,
916 * but it's old semantics, for the Device Model, it's really
917 * powerdown). The possible problem is that another sysdev that
918 * happens to be suspend after this one will have interrupts off,
919 * that may be an issue... For now, this isn't an issue on pmac
920 * though...
921 */
922
923static u32 save_ipi_vp[OPENPIC_NUM_IPI];
924static u32 save_irq_src_vp[OPENPIC_MAX_SOURCES];
925static u32 save_irq_src_dest[OPENPIC_MAX_SOURCES];
926static u32 save_cpu_task_pri[OPENPIC_MAX_PROCESSORS];
927static int openpic_suspend_count;
928
929static void openpic_cached_enable_irq(u_int irq)
930{
931 check_arg_irq(irq);
932 save_irq_src_vp[irq - open_pic_irq_offset] &= ~OPENPIC_MASK;
933}
934
935static void openpic_cached_disable_irq(u_int irq)
936{
937 check_arg_irq(irq);
938 save_irq_src_vp[irq - open_pic_irq_offset] |= OPENPIC_MASK;
939}
940
941/* WARNING: Can be called directly by the cpufreq code with NULL parameter,
942 * we need something better to deal with that... Maybe switch to S1 for
943 * cpufreq changes
944 */
945int openpic_suspend(struct sys_device *sysdev, u32 state)
946{
947 int i;
948 unsigned long flags;
949
950 spin_lock_irqsave(&openpic_setup_lock, flags);
951
952 if (openpic_suspend_count++ > 0) {
953 spin_unlock_irqrestore(&openpic_setup_lock, flags);
954 return 0;
955 }
956
957 openpic_set_priority(0xf);
958
959 open_pic.enable = openpic_cached_enable_irq;
960 open_pic.disable = openpic_cached_disable_irq;
961
962 for (i=0; i<NumProcessors; i++) {
963 save_cpu_task_pri[i] = openpic_read(&OpenPIC->Processor[i].Current_Task_Priority);
964 openpic_writefield(&OpenPIC->Processor[i].Current_Task_Priority,
965 OPENPIC_CURRENT_TASK_PRIORITY_MASK, 0xf);
966 }
967
968 for (i=0; i<OPENPIC_NUM_IPI; i++)
969 save_ipi_vp[i] = openpic_read(&OpenPIC->Global.IPI_Vector_Priority(i));
970 for (i=0; i<NumSources; i++) {
971 if (ISR[i] == 0)
972 continue;
973 save_irq_src_vp[i] = openpic_read(&ISR[i]->Vector_Priority) & ~OPENPIC_ACTIVITY;
974 save_irq_src_dest[i] = openpic_read(&ISR[i]->Destination);
975 }
976
977 spin_unlock_irqrestore(&openpic_setup_lock, flags);
978
979 return 0;
980}
981
982/* WARNING: Can be called directly by the cpufreq code with NULL parameter,
983 * we need something better to deal with that... Maybe switch to S1 for
984 * cpufreq changes
985 */
986int openpic_resume(struct sys_device *sysdev)
987{
988 int i;
989 unsigned long flags;
990 u32 vppmask = OPENPIC_PRIORITY_MASK | OPENPIC_VECTOR_MASK |
991 OPENPIC_SENSE_MASK | OPENPIC_POLARITY_MASK |
992 OPENPIC_MASK;
993
994 spin_lock_irqsave(&openpic_setup_lock, flags);
995
996 if ((--openpic_suspend_count) > 0) {
997 spin_unlock_irqrestore(&openpic_setup_lock, flags);
998 return 0;
999 }
1000
1001 openpic_reset();
1002
1003 /* OpenPIC sometimes seem to need some time to be fully back up... */
1004 do {
1005 openpic_set_spurious(OPENPIC_VEC_SPURIOUS);
1006 } while(openpic_readfield(&OpenPIC->Global.Spurious_Vector, OPENPIC_VECTOR_MASK)
1007 != OPENPIC_VEC_SPURIOUS);
1008
1009 openpic_disable_8259_pass_through();
1010
1011 for (i=0; i<OPENPIC_NUM_IPI; i++)
1012 openpic_write(&OpenPIC->Global.IPI_Vector_Priority(i),
1013 save_ipi_vp[i]);
1014 for (i=0; i<NumSources; i++) {
1015 if (ISR[i] == 0)
1016 continue;
1017 openpic_write(&ISR[i]->Destination, save_irq_src_dest[i]);
1018 openpic_write(&ISR[i]->Vector_Priority, save_irq_src_vp[i]);
1019 /* make sure mask gets to controller before we return to user */
1020 do {
1021 openpic_write(&ISR[i]->Vector_Priority, save_irq_src_vp[i]);
1022 } while (openpic_readfield(&ISR[i]->Vector_Priority, vppmask)
1023 != (save_irq_src_vp[i] & vppmask));
1024 }
1025 for (i=0; i<NumProcessors; i++)
1026 openpic_write(&OpenPIC->Processor[i].Current_Task_Priority,
1027 save_cpu_task_pri[i]);
1028
1029 open_pic.enable = openpic_enable_irq;
1030 open_pic.disable = openpic_disable_irq;
1031
1032 openpic_set_priority(0);
1033
1034 spin_unlock_irqrestore(&openpic_setup_lock, flags);
1035
1036 return 0;
1037}
1038
1039#endif /* CONFIG_PM */
1040
1041static struct sysdev_class openpic_sysclass = {
1042 set_kset_name("openpic"),
1043};
1044
1045static struct sys_device device_openpic = {
1046 .id = 0,
1047 .cls = &openpic_sysclass,
1048};
1049
1050static struct sysdev_driver driver_openpic = {
1051#ifdef CONFIG_PM
1052 .suspend = &openpic_suspend,
1053 .resume = &openpic_resume,
1054#endif /* CONFIG_PM */
1055};
1056
1057static int __init init_openpic_sysfs(void)
1058{
1059 int rc;
1060
1061 if (!OpenPIC_Addr)
1062 return -ENODEV;
1063 printk(KERN_DEBUG "Registering openpic with sysfs...\n");
1064 rc = sysdev_class_register(&openpic_sysclass);
1065 if (rc) {
1066 printk(KERN_ERR "Failed registering openpic sys class\n");
1067 return -ENODEV;
1068 }
1069 rc = sysdev_register(&device_openpic);
1070 if (rc) {
1071 printk(KERN_ERR "Failed registering openpic sys device\n");
1072 return -ENODEV;
1073 }
1074 rc = sysdev_driver_register(&openpic_sysclass, &driver_openpic);
1075 if (rc) {
1076 printk(KERN_ERR "Failed registering openpic sys driver\n");
1077 return -ENODEV;
1078 }
1079 return 0;
1080}
1081
1082subsys_initcall(init_openpic_sysfs);
1083
diff --git a/arch/ppc/syslib/open_pic2.c b/arch/ppc/syslib/open_pic2.c
new file mode 100644
index 000000000000..ea26da0d8b6b
--- /dev/null
+++ b/arch/ppc/syslib/open_pic2.c
@@ -0,0 +1,716 @@
1/*
2 * arch/ppc/kernel/open_pic.c -- OpenPIC Interrupt Handling
3 *
4 * Copyright (C) 1997 Geert Uytterhoeven
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file COPYING in the main directory of this archive
8 * for more details.
9 *
10 * This is a duplicate of open_pic.c that deals with U3s MPIC on
11 * G5 PowerMacs. It's the same file except it's using big endian
12 * register accesses
13 */
14
15#include <linux/config.h>
16#include <linux/types.h>
17#include <linux/kernel.h>
18#include <linux/sched.h>
19#include <linux/init.h>
20#include <linux/irq.h>
21#include <linux/interrupt.h>
22#include <linux/sysdev.h>
23#include <linux/errno.h>
24#include <asm/ptrace.h>
25#include <asm/signal.h>
26#include <asm/io.h>
27#include <asm/irq.h>
28#include <asm/prom.h>
29#include <asm/sections.h>
30#include <asm/open_pic.h>
31#include <asm/i8259.h>
32
33#include "open_pic_defs.h"
34
35void *OpenPIC2_Addr;
36static volatile struct OpenPIC *OpenPIC2 = NULL;
37/*
38 * We define OpenPIC_InitSenses table thusly:
39 * bit 0x1: sense, 0 for edge and 1 for level.
40 * bit 0x2: polarity, 0 for negative, 1 for positive.
41 */
42extern u_int OpenPIC_NumInitSenses;
43extern u_char *OpenPIC_InitSenses;
44extern int use_of_interrupt_tree;
45
46static u_int NumProcessors;
47static u_int NumSources;
48static int open_pic2_irq_offset;
49static volatile OpenPIC_Source *ISR[NR_IRQS];
50
51/* Global Operations */
52static void openpic2_disable_8259_pass_through(void);
53static void openpic2_set_priority(u_int pri);
54static void openpic2_set_spurious(u_int vector);
55
56/* Timer Interrupts */
57static void openpic2_inittimer(u_int timer, u_int pri, u_int vector);
58static void openpic2_maptimer(u_int timer, u_int cpumask);
59
60/* Interrupt Sources */
61static void openpic2_enable_irq(u_int irq);
62static void openpic2_disable_irq(u_int irq);
63static void openpic2_initirq(u_int irq, u_int pri, u_int vector, int polarity,
64 int is_level);
65static void openpic2_mapirq(u_int irq, u_int cpumask, u_int keepmask);
66
67/*
68 * These functions are not used but the code is kept here
69 * for completeness and future reference.
70 */
71static void openpic2_reset(void);
72#ifdef notused
73static void openpic2_enable_8259_pass_through(void);
74static u_int openpic2_get_priority(void);
75static u_int openpic2_get_spurious(void);
76static void openpic2_set_sense(u_int irq, int sense);
77#endif /* notused */
78
79/*
80 * Description of the openpic for the higher-level irq code
81 */
82static void openpic2_end_irq(unsigned int irq_nr);
83static void openpic2_ack_irq(unsigned int irq_nr);
84
85struct hw_interrupt_type open_pic2 = {
86 " OpenPIC2 ",
87 NULL,
88 NULL,
89 openpic2_enable_irq,
90 openpic2_disable_irq,
91 openpic2_ack_irq,
92 openpic2_end_irq,
93};
94
95/*
96 * Accesses to the current processor's openpic registers
97 * On cascaded controller, this is only CPU 0
98 */
99#define THIS_CPU Processor[0]
100#define DECL_THIS_CPU
101#define CHECK_THIS_CPU
102
103#if 1
104#define check_arg_ipi(ipi) \
105 if (ipi < 0 || ipi >= OPENPIC_NUM_IPI) \
106 printk("open_pic.c:%d: illegal ipi %d\n", __LINE__, ipi);
107#define check_arg_timer(timer) \
108 if (timer < 0 || timer >= OPENPIC_NUM_TIMERS) \
109 printk("open_pic.c:%d: illegal timer %d\n", __LINE__, timer);
110#define check_arg_vec(vec) \
111 if (vec < 0 || vec >= OPENPIC_NUM_VECTORS) \
112 printk("open_pic.c:%d: illegal vector %d\n", __LINE__, vec);
113#define check_arg_pri(pri) \
114 if (pri < 0 || pri >= OPENPIC_NUM_PRI) \
115 printk("open_pic.c:%d: illegal priority %d\n", __LINE__, pri);
116/*
117 * Print out a backtrace if it's out of range, since if it's larger than NR_IRQ's
118 * data has probably been corrupted and we're going to panic or deadlock later
119 * anyway --Troy
120 */
121extern unsigned long* _get_SP(void);
122#define check_arg_irq(irq) \
123 if (irq < open_pic2_irq_offset || irq >= NumSources+open_pic2_irq_offset \
124 || ISR[irq - open_pic2_irq_offset] == 0) { \
125 printk("open_pic.c:%d: illegal irq %d\n", __LINE__, irq); \
126 /*print_backtrace(_get_SP());*/ }
127#define check_arg_cpu(cpu) \
128 if (cpu < 0 || cpu >= NumProcessors){ \
129 printk("open_pic2.c:%d: illegal cpu %d\n", __LINE__, cpu); \
130 /*print_backtrace(_get_SP());*/ }
131#else
132#define check_arg_ipi(ipi) do {} while (0)
133#define check_arg_timer(timer) do {} while (0)
134#define check_arg_vec(vec) do {} while (0)
135#define check_arg_pri(pri) do {} while (0)
136#define check_arg_irq(irq) do {} while (0)
137#define check_arg_cpu(cpu) do {} while (0)
138#endif
139
140static u_int openpic2_read(volatile u_int *addr)
141{
142 u_int val;
143
144 val = in_be32(addr);
145 return val;
146}
147
148static inline void openpic2_write(volatile u_int *addr, u_int val)
149{
150 out_be32(addr, val);
151}
152
153static inline u_int openpic2_readfield(volatile u_int *addr, u_int mask)
154{
155 u_int val = openpic2_read(addr);
156 return val & mask;
157}
158
159inline void openpic2_writefield(volatile u_int *addr, u_int mask,
160 u_int field)
161{
162 u_int val = openpic2_read(addr);
163 openpic2_write(addr, (val & ~mask) | (field & mask));
164}
165
166static inline void openpic2_clearfield(volatile u_int *addr, u_int mask)
167{
168 openpic2_writefield(addr, mask, 0);
169}
170
171static inline void openpic2_setfield(volatile u_int *addr, u_int mask)
172{
173 openpic2_writefield(addr, mask, mask);
174}
175
176static void openpic2_safe_writefield(volatile u_int *addr, u_int mask,
177 u_int field)
178{
179 openpic2_setfield(addr, OPENPIC_MASK);
180 while (openpic2_read(addr) & OPENPIC_ACTIVITY);
181 openpic2_writefield(addr, mask | OPENPIC_MASK, field | OPENPIC_MASK);
182}
183
184static void openpic2_reset(void)
185{
186 openpic2_setfield(&OpenPIC2->Global.Global_Configuration0,
187 OPENPIC_CONFIG_RESET);
188 while (openpic2_readfield(&OpenPIC2->Global.Global_Configuration0,
189 OPENPIC_CONFIG_RESET))
190 mb();
191}
192
193void __init openpic2_set_sources(int first_irq, int num_irqs, void *first_ISR)
194{
195 volatile OpenPIC_Source *src = first_ISR;
196 int i, last_irq;
197
198 last_irq = first_irq + num_irqs;
199 if (last_irq > NumSources)
200 NumSources = last_irq;
201 if (src == 0)
202 src = &((struct OpenPIC *)OpenPIC2_Addr)->Source[first_irq];
203 for (i = first_irq; i < last_irq; ++i, ++src)
204 ISR[i] = src;
205}
206
207/*
208 * The `offset' parameter defines where the interrupts handled by the
209 * OpenPIC start in the space of interrupt numbers that the kernel knows
210 * about. In other words, the OpenPIC's IRQ0 is numbered `offset' in the
211 * kernel's interrupt numbering scheme.
212 * We assume there is only one OpenPIC.
213 */
214void __init openpic2_init(int offset)
215{
216 u_int t, i;
217 u_int timerfreq;
218 const char *version;
219
220 if (!OpenPIC2_Addr) {
221 printk("No OpenPIC2 found !\n");
222 return;
223 }
224 OpenPIC2 = (volatile struct OpenPIC *)OpenPIC2_Addr;
225
226 if (ppc_md.progress) ppc_md.progress("openpic: enter", 0x122);
227
228 t = openpic2_read(&OpenPIC2->Global.Feature_Reporting0);
229 switch (t & OPENPIC_FEATURE_VERSION_MASK) {
230 case 1:
231 version = "1.0";
232 break;
233 case 2:
234 version = "1.2";
235 break;
236 case 3:
237 version = "1.3";
238 break;
239 default:
240 version = "?";
241 break;
242 }
243 NumProcessors = ((t & OPENPIC_FEATURE_LAST_PROCESSOR_MASK) >>
244 OPENPIC_FEATURE_LAST_PROCESSOR_SHIFT) + 1;
245 if (NumSources == 0)
246 openpic2_set_sources(0,
247 ((t & OPENPIC_FEATURE_LAST_SOURCE_MASK) >>
248 OPENPIC_FEATURE_LAST_SOURCE_SHIFT) + 1,
249 NULL);
250 printk("OpenPIC (2) Version %s (%d CPUs and %d IRQ sources) at %p\n",
251 version, NumProcessors, NumSources, OpenPIC2);
252 timerfreq = openpic2_read(&OpenPIC2->Global.Timer_Frequency);
253 if (timerfreq)
254 printk("OpenPIC timer frequency is %d.%06d MHz\n",
255 timerfreq / 1000000, timerfreq % 1000000);
256
257 open_pic2_irq_offset = offset;
258
259 /* Initialize timer interrupts */
260 if ( ppc_md.progress ) ppc_md.progress("openpic2: timer",0x3ba);
261 for (i = 0; i < OPENPIC_NUM_TIMERS; i++) {
262 /* Disabled, Priority 0 */
263 openpic2_inittimer(i, 0, OPENPIC2_VEC_TIMER+i+offset);
264 /* No processor */
265 openpic2_maptimer(i, 0);
266 }
267
268 /* Initialize external interrupts */
269 if (ppc_md.progress) ppc_md.progress("openpic2: external",0x3bc);
270
271 openpic2_set_priority(0xf);
272
273 /* Init all external sources, including possibly the cascade. */
274 for (i = 0; i < NumSources; i++) {
275 int sense;
276
277 if (ISR[i] == 0)
278 continue;
279
280 /* the bootloader may have left it enabled (bad !) */
281 openpic2_disable_irq(i+offset);
282
283 sense = (i < OpenPIC_NumInitSenses)? OpenPIC_InitSenses[i]: \
284 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE);
285
286 if (sense & IRQ_SENSE_MASK)
287 irq_desc[i+offset].status = IRQ_LEVEL;
288
289 /* Enabled, Priority 8 */
290 openpic2_initirq(i, 8, i+offset, (sense & IRQ_POLARITY_MASK),
291 (sense & IRQ_SENSE_MASK));
292 /* Processor 0 */
293 openpic2_mapirq(i, 1<<0, 0);
294 }
295
296 /* Init descriptors */
297 for (i = offset; i < NumSources + offset; i++)
298 irq_desc[i].handler = &open_pic2;
299
300 /* Initialize the spurious interrupt */
301 if (ppc_md.progress) ppc_md.progress("openpic2: spurious",0x3bd);
302 openpic2_set_spurious(OPENPIC2_VEC_SPURIOUS+offset);
303
304 openpic2_disable_8259_pass_through();
305 openpic2_set_priority(0);
306
307 if (ppc_md.progress) ppc_md.progress("openpic2: exit",0x222);
308}
309
310#ifdef notused
311static void openpic2_enable_8259_pass_through(void)
312{
313 openpic2_clearfield(&OpenPIC2->Global.Global_Configuration0,
314 OPENPIC_CONFIG_8259_PASSTHROUGH_DISABLE);
315}
316#endif /* notused */
317
318/* This can't be __init, it is used in openpic_sleep_restore_intrs */
319static void openpic2_disable_8259_pass_through(void)
320{
321 openpic2_setfield(&OpenPIC2->Global.Global_Configuration0,
322 OPENPIC_CONFIG_8259_PASSTHROUGH_DISABLE);
323}
324
325/*
326 * Find out the current interrupt
327 */
328u_int openpic2_irq(void)
329{
330 u_int vec;
331 DECL_THIS_CPU;
332
333 CHECK_THIS_CPU;
334 vec = openpic2_readfield(&OpenPIC2->THIS_CPU.Interrupt_Acknowledge,
335 OPENPIC_VECTOR_MASK);
336 return vec;
337}
338
339void openpic2_eoi(void)
340{
341 DECL_THIS_CPU;
342
343 CHECK_THIS_CPU;
344 openpic2_write(&OpenPIC2->THIS_CPU.EOI, 0);
345 /* Handle PCI write posting */
346 (void)openpic2_read(&OpenPIC2->THIS_CPU.EOI);
347}
348
349#ifdef notused
350static u_int openpic2_get_priority(void)
351{
352 DECL_THIS_CPU;
353
354 CHECK_THIS_CPU;
355 return openpic2_readfield(&OpenPIC2->THIS_CPU.Current_Task_Priority,
356 OPENPIC_CURRENT_TASK_PRIORITY_MASK);
357}
358#endif /* notused */
359
360static void __init openpic2_set_priority(u_int pri)
361{
362 DECL_THIS_CPU;
363
364 CHECK_THIS_CPU;
365 check_arg_pri(pri);
366 openpic2_writefield(&OpenPIC2->THIS_CPU.Current_Task_Priority,
367 OPENPIC_CURRENT_TASK_PRIORITY_MASK, pri);
368}
369
370/*
371 * Get/set the spurious vector
372 */
373#ifdef notused
374static u_int openpic2_get_spurious(void)
375{
376 return openpic2_readfield(&OpenPIC2->Global.Spurious_Vector,
377 OPENPIC_VECTOR_MASK);
378}
379#endif /* notused */
380
381/* This can't be __init, it is used in openpic_sleep_restore_intrs */
382static void openpic2_set_spurious(u_int vec)
383{
384 check_arg_vec(vec);
385 openpic2_writefield(&OpenPIC2->Global.Spurious_Vector, OPENPIC_VECTOR_MASK,
386 vec);
387}
388
389static DEFINE_SPINLOCK(openpic2_setup_lock);
390
391/*
392 * Initialize a timer interrupt (and disable it)
393 *
394 * timer: OpenPIC timer number
395 * pri: interrupt source priority
396 * vec: the vector it will produce
397 */
398static void __init openpic2_inittimer(u_int timer, u_int pri, u_int vec)
399{
400 check_arg_timer(timer);
401 check_arg_pri(pri);
402 check_arg_vec(vec);
403 openpic2_safe_writefield(&OpenPIC2->Global.Timer[timer].Vector_Priority,
404 OPENPIC_PRIORITY_MASK | OPENPIC_VECTOR_MASK,
405 (pri << OPENPIC_PRIORITY_SHIFT) | vec);
406}
407
408/*
409 * Map a timer interrupt to one or more CPUs
410 */
411static void __init openpic2_maptimer(u_int timer, u_int cpumask)
412{
413 check_arg_timer(timer);
414 openpic2_write(&OpenPIC2->Global.Timer[timer].Destination,
415 cpumask);
416}
417
418/*
419 * Initalize the interrupt source which will generate an NMI.
420 * This raises the interrupt's priority from 8 to 9.
421 *
422 * irq: The logical IRQ which generates an NMI.
423 */
424void __init
425openpic2_init_nmi_irq(u_int irq)
426{
427 check_arg_irq(irq);
428 openpic2_safe_writefield(&ISR[irq - open_pic2_irq_offset]->Vector_Priority,
429 OPENPIC_PRIORITY_MASK,
430 9 << OPENPIC_PRIORITY_SHIFT);
431}
432
433/*
434 *
435 * All functions below take an offset'ed irq argument
436 *
437 */
438
439
440/*
441 * Enable/disable an external interrupt source
442 *
443 * Externally called, irq is an offseted system-wide interrupt number
444 */
445static void openpic2_enable_irq(u_int irq)
446{
447 volatile u_int *vpp;
448
449 check_arg_irq(irq);
450 vpp = &ISR[irq - open_pic2_irq_offset]->Vector_Priority;
451 openpic2_clearfield(vpp, OPENPIC_MASK);
452 /* make sure mask gets to controller before we return to user */
453 do {
454 mb(); /* sync is probably useless here */
455 } while (openpic2_readfield(vpp, OPENPIC_MASK));
456}
457
458static void openpic2_disable_irq(u_int irq)
459{
460 volatile u_int *vpp;
461 u32 vp;
462
463 check_arg_irq(irq);
464 vpp = &ISR[irq - open_pic2_irq_offset]->Vector_Priority;
465 openpic2_setfield(vpp, OPENPIC_MASK);
466 /* make sure mask gets to controller before we return to user */
467 do {
468 mb(); /* sync is probably useless here */
469 vp = openpic2_readfield(vpp, OPENPIC_MASK | OPENPIC_ACTIVITY);
470 } while((vp & OPENPIC_ACTIVITY) && !(vp & OPENPIC_MASK));
471}
472
473
474/*
475 * Initialize an interrupt source (and disable it!)
476 *
477 * irq: OpenPIC interrupt number
478 * pri: interrupt source priority
479 * vec: the vector it will produce
480 * pol: polarity (1 for positive, 0 for negative)
481 * sense: 1 for level, 0 for edge
482 */
483static void __init
484openpic2_initirq(u_int irq, u_int pri, u_int vec, int pol, int sense)
485{
486 openpic2_safe_writefield(&ISR[irq]->Vector_Priority,
487 OPENPIC_PRIORITY_MASK | OPENPIC_VECTOR_MASK |
488 OPENPIC_SENSE_MASK | OPENPIC_POLARITY_MASK,
489 (pri << OPENPIC_PRIORITY_SHIFT) | vec |
490 (pol ? OPENPIC_POLARITY_POSITIVE :
491 OPENPIC_POLARITY_NEGATIVE) |
492 (sense ? OPENPIC_SENSE_LEVEL : OPENPIC_SENSE_EDGE));
493}
494
495/*
496 * Map an interrupt source to one or more CPUs
497 */
498static void openpic2_mapirq(u_int irq, u_int physmask, u_int keepmask)
499{
500 if (ISR[irq] == 0)
501 return;
502 if (keepmask != 0)
503 physmask |= openpic2_read(&ISR[irq]->Destination) & keepmask;
504 openpic2_write(&ISR[irq]->Destination, physmask);
505}
506
507#ifdef notused
508/*
509 * Set the sense for an interrupt source (and disable it!)
510 *
511 * sense: 1 for level, 0 for edge
512 */
513static void openpic2_set_sense(u_int irq, int sense)
514{
515 if (ISR[irq] != 0)
516 openpic2_safe_writefield(&ISR[irq]->Vector_Priority,
517 OPENPIC_SENSE_LEVEL,
518 (sense ? OPENPIC_SENSE_LEVEL : 0));
519}
520#endif /* notused */
521
522/* No spinlocks, should not be necessary with the OpenPIC
523 * (1 register = 1 interrupt and we have the desc lock).
524 */
525static void openpic2_ack_irq(unsigned int irq_nr)
526{
527 openpic2_disable_irq(irq_nr);
528 openpic2_eoi();
529}
530
531static void openpic2_end_irq(unsigned int irq_nr)
532{
533 if (!(irq_desc[irq_nr].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
534 openpic2_enable_irq(irq_nr);
535}
536
537int
538openpic2_get_irq(struct pt_regs *regs)
539{
540 int irq = openpic2_irq();
541
542 if (irq == (OPENPIC2_VEC_SPURIOUS + open_pic2_irq_offset))
543 irq = -1;
544 return irq;
545}
546
547#ifdef CONFIG_PM
548
549/*
550 * We implement the IRQ controller as a sysdev and put it
551 * to sleep at powerdown stage (the callback is named suspend,
552 * but it's old semantics, for the Device Model, it's really
553 * powerdown). The possible problem is that another sysdev that
554 * happens to be suspend after this one will have interrupts off,
555 * that may be an issue... For now, this isn't an issue on pmac
556 * though...
557 */
558
559static u32 save_ipi_vp[OPENPIC_NUM_IPI];
560static u32 save_irq_src_vp[OPENPIC_MAX_SOURCES];
561static u32 save_irq_src_dest[OPENPIC_MAX_SOURCES];
562static u32 save_cpu_task_pri[OPENPIC_MAX_PROCESSORS];
563static int openpic_suspend_count;
564
565static void openpic2_cached_enable_irq(u_int irq)
566{
567 check_arg_irq(irq);
568 save_irq_src_vp[irq - open_pic2_irq_offset] &= ~OPENPIC_MASK;
569}
570
571static void openpic2_cached_disable_irq(u_int irq)
572{
573 check_arg_irq(irq);
574 save_irq_src_vp[irq - open_pic2_irq_offset] |= OPENPIC_MASK;
575}
576
577/* WARNING: Can be called directly by the cpufreq code with NULL parameter,
578 * we need something better to deal with that... Maybe switch to S1 for
579 * cpufreq changes
580 */
581int openpic2_suspend(struct sys_device *sysdev, u32 state)
582{
583 int i;
584 unsigned long flags;
585
586 spin_lock_irqsave(&openpic2_setup_lock, flags);
587
588 if (openpic_suspend_count++ > 0) {
589 spin_unlock_irqrestore(&openpic2_setup_lock, flags);
590 return 0;
591 }
592
593 open_pic2.enable = openpic2_cached_enable_irq;
594 open_pic2.disable = openpic2_cached_disable_irq;
595
596 for (i=0; i<NumProcessors; i++) {
597 save_cpu_task_pri[i] = openpic2_read(&OpenPIC2->Processor[i].Current_Task_Priority);
598 openpic2_writefield(&OpenPIC2->Processor[i].Current_Task_Priority,
599 OPENPIC_CURRENT_TASK_PRIORITY_MASK, 0xf);
600 }
601
602 for (i=0; i<OPENPIC_NUM_IPI; i++)
603 save_ipi_vp[i] = openpic2_read(&OpenPIC2->Global.IPI_Vector_Priority(i));
604 for (i=0; i<NumSources; i++) {
605 if (ISR[i] == 0)
606 continue;
607 save_irq_src_vp[i] = openpic2_read(&ISR[i]->Vector_Priority) & ~OPENPIC_ACTIVITY;
608 save_irq_src_dest[i] = openpic2_read(&ISR[i]->Destination);
609 }
610
611 spin_unlock_irqrestore(&openpic2_setup_lock, flags);
612
613 return 0;
614}
615
616/* WARNING: Can be called directly by the cpufreq code with NULL parameter,
617 * we need something better to deal with that... Maybe switch to S1 for
618 * cpufreq changes
619 */
620int openpic2_resume(struct sys_device *sysdev)
621{
622 int i;
623 unsigned long flags;
624 u32 vppmask = OPENPIC_PRIORITY_MASK | OPENPIC_VECTOR_MASK |
625 OPENPIC_SENSE_MASK | OPENPIC_POLARITY_MASK |
626 OPENPIC_MASK;
627
628 spin_lock_irqsave(&openpic2_setup_lock, flags);
629
630 if ((--openpic_suspend_count) > 0) {
631 spin_unlock_irqrestore(&openpic2_setup_lock, flags);
632 return 0;
633 }
634
635 openpic2_reset();
636
637 /* OpenPIC sometimes seem to need some time to be fully back up... */
638 do {
639 openpic2_set_spurious(OPENPIC2_VEC_SPURIOUS+open_pic2_irq_offset);
640 } while(openpic2_readfield(&OpenPIC2->Global.Spurious_Vector, OPENPIC_VECTOR_MASK)
641 != (OPENPIC2_VEC_SPURIOUS + open_pic2_irq_offset));
642
643 openpic2_disable_8259_pass_through();
644
645 for (i=0; i<OPENPIC_NUM_IPI; i++)
646 openpic2_write(&OpenPIC2->Global.IPI_Vector_Priority(i),
647 save_ipi_vp[i]);
648 for (i=0; i<NumSources; i++) {
649 if (ISR[i] == 0)
650 continue;
651 openpic2_write(&ISR[i]->Destination, save_irq_src_dest[i]);
652 openpic2_write(&ISR[i]->Vector_Priority, save_irq_src_vp[i]);
653 /* make sure mask gets to controller before we return to user */
654 do {
655 openpic2_write(&ISR[i]->Vector_Priority, save_irq_src_vp[i]);
656 } while (openpic2_readfield(&ISR[i]->Vector_Priority, vppmask)
657 != (save_irq_src_vp[i] & vppmask));
658 }
659 for (i=0; i<NumProcessors; i++)
660 openpic2_write(&OpenPIC2->Processor[i].Current_Task_Priority,
661 save_cpu_task_pri[i]);
662
663 open_pic2.enable = openpic2_enable_irq;
664 open_pic2.disable = openpic2_disable_irq;
665
666 spin_unlock_irqrestore(&openpic2_setup_lock, flags);
667
668 return 0;
669}
670
671#endif /* CONFIG_PM */
672
673/* HACK ALERT */
674static struct sysdev_class openpic2_sysclass = {
675 set_kset_name("openpic2"),
676};
677
678static struct sys_device device_openpic2 = {
679 .id = 0,
680 .cls = &openpic2_sysclass,
681};
682
683static struct sysdev_driver driver_openpic2 = {
684#ifdef CONFIG_PM
685 .suspend = &openpic2_suspend,
686 .resume = &openpic2_resume,
687#endif /* CONFIG_PM */
688};
689
690static int __init init_openpic2_sysfs(void)
691{
692 int rc;
693
694 if (!OpenPIC2_Addr)
695 return -ENODEV;
696 printk(KERN_DEBUG "Registering openpic2 with sysfs...\n");
697 rc = sysdev_class_register(&openpic2_sysclass);
698 if (rc) {
699 printk(KERN_ERR "Failed registering openpic sys class\n");
700 return -ENODEV;
701 }
702 rc = sysdev_register(&device_openpic2);
703 if (rc) {
704 printk(KERN_ERR "Failed registering openpic sys device\n");
705 return -ENODEV;
706 }
707 rc = sysdev_driver_register(&openpic2_sysclass, &driver_openpic2);
708 if (rc) {
709 printk(KERN_ERR "Failed registering openpic sys driver\n");
710 return -ENODEV;
711 }
712 return 0;
713}
714
715subsys_initcall(init_openpic2_sysfs);
716
diff --git a/arch/ppc/syslib/open_pic_defs.h b/arch/ppc/syslib/open_pic_defs.h
new file mode 100644
index 000000000000..4f05624b249e
--- /dev/null
+++ b/arch/ppc/syslib/open_pic_defs.h
@@ -0,0 +1,292 @@
1/*
2 * arch/ppc/kernel/open_pic_defs.h -- OpenPIC definitions
3 *
4 * Copyright (C) 1997 Geert Uytterhoeven
5 *
6 * This file is based on the following documentation:
7 *
8 * The Open Programmable Interrupt Controller (PIC)
9 * Register Interface Specification Revision 1.2
10 *
11 * Issue Date: October 1995
12 *
13 * Issued jointly by Advanced Micro Devices and Cyrix Corporation
14 *
15 * AMD is a registered trademark of Advanced Micro Devices, Inc.
16 * Copyright (C) 1995, Advanced Micro Devices, Inc. and Cyrix, Inc.
17 * All Rights Reserved.
18 *
19 * To receive a copy of this documentation, send an email to openpic@amd.com.
20 *
21 * This file is subject to the terms and conditions of the GNU General Public
22 * License. See the file COPYING in the main directory of this archive
23 * for more details.
24 */
25
26#ifndef _LINUX_OPENPIC_H
27#define _LINUX_OPENPIC_H
28
29#ifdef __KERNEL__
30
31 /*
32 * OpenPIC supports up to 2048 interrupt sources and up to 32 processors
33 */
34
35#define OPENPIC_MAX_SOURCES 2048
36#define OPENPIC_MAX_PROCESSORS 32
37#define OPENPIC_MAX_ISU 16
38
39#define OPENPIC_NUM_TIMERS 4
40#define OPENPIC_NUM_IPI 4
41#define OPENPIC_NUM_PRI 16
42#define OPENPIC_NUM_VECTORS 256
43
44
45
46 /*
47 * OpenPIC Registers are 32 bits and aligned on 128 bit boundaries
48 */
49
50typedef struct _OpenPIC_Reg {
51 u_int Reg; /* Little endian! */
52 char Pad[0xc];
53} OpenPIC_Reg;
54
55
56 /*
57 * Per Processor Registers
58 */
59
60typedef struct _OpenPIC_Processor {
61 /*
62 * Private Shadow Registers (for SLiC backwards compatibility)
63 */
64 u_int IPI0_Dispatch_Shadow; /* Write Only */
65 char Pad1[0x4];
66 u_int IPI0_Vector_Priority_Shadow; /* Read/Write */
67 char Pad2[0x34];
68 /*
69 * Interprocessor Interrupt Command Ports
70 */
71 OpenPIC_Reg _IPI_Dispatch[OPENPIC_NUM_IPI]; /* Write Only */
72 /*
73 * Current Task Priority Register
74 */
75 OpenPIC_Reg _Current_Task_Priority; /* Read/Write */
76 char Pad3[0x10];
77 /*
78 * Interrupt Acknowledge Register
79 */
80 OpenPIC_Reg _Interrupt_Acknowledge; /* Read Only */
81 /*
82 * End of Interrupt (EOI) Register
83 */
84 OpenPIC_Reg _EOI; /* Read/Write */
85 char Pad5[0xf40];
86} OpenPIC_Processor;
87
88
89 /*
90 * Timer Registers
91 */
92
93typedef struct _OpenPIC_Timer {
94 OpenPIC_Reg _Current_Count; /* Read Only */
95 OpenPIC_Reg _Base_Count; /* Read/Write */
96 OpenPIC_Reg _Vector_Priority; /* Read/Write */
97 OpenPIC_Reg _Destination; /* Read/Write */
98} OpenPIC_Timer;
99
100
101 /*
102 * Global Registers
103 */
104
105typedef struct _OpenPIC_Global {
106 /*
107 * Feature Reporting Registers
108 */
109 OpenPIC_Reg _Feature_Reporting0; /* Read Only */
110 OpenPIC_Reg _Feature_Reporting1; /* Future Expansion */
111 /*
112 * Global Configuration Registers
113 */
114 OpenPIC_Reg _Global_Configuration0; /* Read/Write */
115 OpenPIC_Reg _Global_Configuration1; /* Future Expansion */
116 /*
117 * Vendor Specific Registers
118 */
119 OpenPIC_Reg _Vendor_Specific[4];
120 /*
121 * Vendor Identification Register
122 */
123 OpenPIC_Reg _Vendor_Identification; /* Read Only */
124 /*
125 * Processor Initialization Register
126 */
127 OpenPIC_Reg _Processor_Initialization; /* Read/Write */
128 /*
129 * IPI Vector/Priority Registers
130 */
131 OpenPIC_Reg _IPI_Vector_Priority[OPENPIC_NUM_IPI]; /* Read/Write */
132 /*
133 * Spurious Vector Register
134 */
135 OpenPIC_Reg _Spurious_Vector; /* Read/Write */
136 /*
137 * Global Timer Registers
138 */
139 OpenPIC_Reg _Timer_Frequency; /* Read/Write */
140 OpenPIC_Timer Timer[OPENPIC_NUM_TIMERS];
141 char Pad1[0xee00];
142} OpenPIC_Global;
143
144
145 /*
146 * Interrupt Source Registers
147 */
148
149typedef struct _OpenPIC_Source {
150 OpenPIC_Reg _Vector_Priority; /* Read/Write */
151 OpenPIC_Reg _Destination; /* Read/Write */
152} OpenPIC_Source, *OpenPIC_SourcePtr;
153
154
155 /*
156 * OpenPIC Register Map
157 */
158
159struct OpenPIC {
160 char Pad1[0x1000];
161 /*
162 * Global Registers
163 */
164 OpenPIC_Global Global;
165 /*
166 * Interrupt Source Configuration Registers
167 */
168 OpenPIC_Source Source[OPENPIC_MAX_SOURCES];
169 /*
170 * Per Processor Registers
171 */
172 OpenPIC_Processor Processor[OPENPIC_MAX_PROCESSORS];
173};
174
175extern volatile struct OpenPIC __iomem *OpenPIC;
176
177
178 /*
179 * Current Task Priority Register
180 */
181
182#define OPENPIC_CURRENT_TASK_PRIORITY_MASK 0x0000000f
183
184 /*
185 * Who Am I Register
186 */
187
188#define OPENPIC_WHO_AM_I_ID_MASK 0x0000001f
189
190 /*
191 * Feature Reporting Register 0
192 */
193
194#define OPENPIC_FEATURE_LAST_SOURCE_MASK 0x07ff0000
195#define OPENPIC_FEATURE_LAST_SOURCE_SHIFT 16
196#define OPENPIC_FEATURE_LAST_PROCESSOR_MASK 0x00001f00
197#define OPENPIC_FEATURE_LAST_PROCESSOR_SHIFT 8
198#define OPENPIC_FEATURE_VERSION_MASK 0x000000ff
199
200 /*
201 * Global Configuration Register 0
202 */
203
204#define OPENPIC_CONFIG_RESET 0x80000000
205#define OPENPIC_CONFIG_8259_PASSTHROUGH_DISABLE 0x20000000
206#define OPENPIC_CONFIG_BASE_MASK 0x000fffff
207
208 /*
209 * Global Configuration Register 1
210 * This is the EICR on EPICs.
211 */
212
213#define OPENPIC_EICR_S_CLK_MASK 0x70000000
214#define OPENPIC_EICR_SIE 0x08000000
215
216 /*
217 * Vendor Identification Register
218 */
219
220#define OPENPIC_VENDOR_ID_STEPPING_MASK 0x00ff0000
221#define OPENPIC_VENDOR_ID_STEPPING_SHIFT 16
222#define OPENPIC_VENDOR_ID_DEVICE_ID_MASK 0x0000ff00
223#define OPENPIC_VENDOR_ID_DEVICE_ID_SHIFT 8
224#define OPENPIC_VENDOR_ID_VENDOR_ID_MASK 0x000000ff
225
226 /*
227 * Vector/Priority Registers
228 */
229
230#define OPENPIC_MASK 0x80000000
231#define OPENPIC_ACTIVITY 0x40000000 /* Read Only */
232#define OPENPIC_PRIORITY_MASK 0x000f0000
233#define OPENPIC_PRIORITY_SHIFT 16
234#define OPENPIC_VECTOR_MASK 0x000000ff
235
236
237 /*
238 * Interrupt Source Registers
239 */
240
241#define OPENPIC_POLARITY_POSITIVE 0x00800000
242#define OPENPIC_POLARITY_NEGATIVE 0x00000000
243#define OPENPIC_POLARITY_MASK 0x00800000
244#define OPENPIC_SENSE_LEVEL 0x00400000
245#define OPENPIC_SENSE_EDGE 0x00000000
246#define OPENPIC_SENSE_MASK 0x00400000
247
248
249 /*
250 * Timer Registers
251 */
252
253#define OPENPIC_COUNT_MASK 0x7fffffff
254#define OPENPIC_TIMER_TOGGLE 0x80000000
255#define OPENPIC_TIMER_COUNT_INHIBIT 0x80000000
256
257
258 /*
259 * Aliases to make life simpler
260 */
261
262/* Per Processor Registers */
263#define IPI_Dispatch(i) _IPI_Dispatch[i].Reg
264#define Current_Task_Priority _Current_Task_Priority.Reg
265#define Interrupt_Acknowledge _Interrupt_Acknowledge.Reg
266#define EOI _EOI.Reg
267
268/* Global Registers */
269#define Feature_Reporting0 _Feature_Reporting0.Reg
270#define Feature_Reporting1 _Feature_Reporting1.Reg
271#define Global_Configuration0 _Global_Configuration0.Reg
272#define Global_Configuration1 _Global_Configuration1.Reg
273#define Vendor_Specific(i) _Vendor_Specific[i].Reg
274#define Vendor_Identification _Vendor_Identification.Reg
275#define Processor_Initialization _Processor_Initialization.Reg
276#define IPI_Vector_Priority(i) _IPI_Vector_Priority[i].Reg
277#define Spurious_Vector _Spurious_Vector.Reg
278#define Timer_Frequency _Timer_Frequency.Reg
279
280/* Timer Registers */
281#define Current_Count _Current_Count.Reg
282#define Base_Count _Base_Count.Reg
283#define Vector_Priority _Vector_Priority.Reg
284#define Destination _Destination.Reg
285
286/* Interrupt Source Registers */
287#define Vector_Priority _Vector_Priority.Reg
288#define Destination _Destination.Reg
289
290#endif /* __KERNEL__ */
291
292#endif /* _LINUX_OPENPIC_H */
diff --git a/arch/ppc/syslib/pci_auto.c b/arch/ppc/syslib/pci_auto.c
new file mode 100644
index 000000000000..d64207c2a972
--- /dev/null
+++ b/arch/ppc/syslib/pci_auto.c
@@ -0,0 +1,517 @@
1/*
2 * arch/ppc/syslib/pci_auto.c
3 *
4 * PCI autoconfiguration library
5 *
6 * Author: Matt Porter <mporter@mvista.com>
7 *
8 * 2001 (c) MontaVista, Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
11 * or implied.
12 */
13
14/*
15 * The CardBus support is very preliminary. Preallocating space is
16 * the way to go but will require some change in card services to
17 * make it useful. Eventually this will ensure that we can put
18 * multiple CB bridges behind multiple P2P bridges. For now, at
19 * least it ensures that we place the CB bridge BAR and assigned
20 * initial bus numbers. I definitely need to do something about
21 * the lack of 16-bit I/O support. -MDP
22 */
23
24#include <linux/kernel.h>
25#include <linux/init.h>
26#include <linux/pci.h>
27
28#include <asm/pci-bridge.h>
29
30#define PCIAUTO_IDE_MODE_MASK 0x05
31
32#undef DEBUG
33
34#ifdef DEBUG
35#define DBG(x...) printk(x)
36#else
37#define DBG(x...)
38#endif /* DEBUG */
39
40static int pciauto_upper_iospc;
41static int pciauto_upper_memspc;
42
43void __init pciauto_setup_bars(struct pci_controller *hose,
44 int current_bus,
45 int pci_devfn,
46 int bar_limit)
47{
48 int bar_response, bar_size, bar_value;
49 int bar, addr_mask;
50 int * upper_limit;
51 int found_mem64 = 0;
52
53 DBG("PCI Autoconfig: Found Bus %d, Device %d, Function %d\n",
54 current_bus, PCI_SLOT(pci_devfn), PCI_FUNC(pci_devfn) );
55
56 for (bar = PCI_BASE_ADDRESS_0; bar <= bar_limit; bar+=4) {
57 /* Tickle the BAR and get the response */
58 early_write_config_dword(hose,
59 current_bus,
60 pci_devfn,
61 bar,
62 0xffffffff);
63 early_read_config_dword(hose,
64 current_bus,
65 pci_devfn,
66 bar,
67 &bar_response);
68
69 /* If BAR is not implemented go to the next BAR */
70 if (!bar_response)
71 continue;
72
73 /* Check the BAR type and set our address mask */
74 if (bar_response & PCI_BASE_ADDRESS_SPACE) {
75 addr_mask = PCI_BASE_ADDRESS_IO_MASK;
76 upper_limit = &pciauto_upper_iospc;
77 DBG("PCI Autoconfig: BAR 0x%x, I/O, ", bar);
78 } else {
79 if ( (bar_response & PCI_BASE_ADDRESS_MEM_TYPE_MASK) ==
80 PCI_BASE_ADDRESS_MEM_TYPE_64)
81 found_mem64 = 1;
82
83 addr_mask = PCI_BASE_ADDRESS_MEM_MASK;
84 upper_limit = &pciauto_upper_memspc;
85 DBG("PCI Autoconfig: BAR 0x%x, Mem ", bar);
86 }
87
88 /* Calculate requested size */
89 bar_size = ~(bar_response & addr_mask) + 1;
90
91 /* Allocate a base address */
92 bar_value = (*upper_limit - bar_size) & ~(bar_size - 1);
93
94 /* Write it out and update our limit */
95 early_write_config_dword(hose,
96 current_bus,
97 pci_devfn,
98 bar,
99 bar_value);
100
101 *upper_limit = bar_value;
102
103 /*
104 * If we are a 64-bit decoder then increment to the
105 * upper 32 bits of the bar and force it to locate
106 * in the lower 4GB of memory.
107 */
108 if (found_mem64) {
109 bar += 4;
110 early_write_config_dword(hose,
111 current_bus,
112 pci_devfn,
113 bar,
114 0x00000000);
115 found_mem64 = 0;
116 }
117
118 DBG("size=0x%x, address=0x%x\n",
119 bar_size, bar_value);
120 }
121
122}
123
124void __init pciauto_prescan_setup_bridge(struct pci_controller *hose,
125 int current_bus,
126 int pci_devfn,
127 int sub_bus,
128 int *iosave,
129 int *memsave)
130{
131 /* Configure bus number registers */
132 early_write_config_byte(hose,
133 current_bus,
134 pci_devfn,
135 PCI_PRIMARY_BUS,
136 current_bus);
137 early_write_config_byte(hose,
138 current_bus,
139 pci_devfn,
140 PCI_SECONDARY_BUS,
141 sub_bus + 1);
142 early_write_config_byte(hose,
143 current_bus,
144 pci_devfn,
145 PCI_SUBORDINATE_BUS,
146 0xff);
147
148 /* Round memory allocator to 1MB boundary */
149 pciauto_upper_memspc &= ~(0x100000 - 1);
150 *memsave = pciauto_upper_memspc;
151
152 /* Round I/O allocator to 4KB boundary */
153 pciauto_upper_iospc &= ~(0x1000 - 1);
154 *iosave = pciauto_upper_iospc;
155
156 /* Set up memory and I/O filter limits, assume 32-bit I/O space */
157 early_write_config_word(hose,
158 current_bus,
159 pci_devfn,
160 PCI_MEMORY_LIMIT,
161 ((pciauto_upper_memspc - 1) & 0xfff00000) >> 16);
162 early_write_config_byte(hose,
163 current_bus,
164 pci_devfn,
165 PCI_IO_LIMIT,
166 ((pciauto_upper_iospc - 1) & 0x0000f000) >> 8);
167 early_write_config_word(hose,
168 current_bus,
169 pci_devfn,
170 PCI_IO_LIMIT_UPPER16,
171 ((pciauto_upper_iospc - 1) & 0xffff0000) >> 16);
172
173 /* Zero upper 32 bits of prefetchable base/limit */
174 early_write_config_dword(hose,
175 current_bus,
176 pci_devfn,
177 PCI_PREF_BASE_UPPER32,
178 0);
179 early_write_config_dword(hose,
180 current_bus,
181 pci_devfn,
182 PCI_PREF_LIMIT_UPPER32,
183 0);
184}
185
186void __init pciauto_postscan_setup_bridge(struct pci_controller *hose,
187 int current_bus,
188 int pci_devfn,
189 int sub_bus,
190 int *iosave,
191 int *memsave)
192{
193 int cmdstat;
194
195 /* Configure bus number registers */
196 early_write_config_byte(hose,
197 current_bus,
198 pci_devfn,
199 PCI_SUBORDINATE_BUS,
200 sub_bus);
201
202 /*
203 * Round memory allocator to 1MB boundary.
204 * If no space used, allocate minimum.
205 */
206 pciauto_upper_memspc &= ~(0x100000 - 1);
207 if (*memsave == pciauto_upper_memspc)
208 pciauto_upper_memspc -= 0x00100000;
209
210 early_write_config_word(hose,
211 current_bus,
212 pci_devfn,
213 PCI_MEMORY_BASE,
214 pciauto_upper_memspc >> 16);
215
216 /* Allocate 1MB for pre-fretch */
217 early_write_config_word(hose,
218 current_bus,
219 pci_devfn,
220 PCI_PREF_MEMORY_LIMIT,
221 ((pciauto_upper_memspc - 1) & 0xfff00000) >> 16);
222
223 pciauto_upper_memspc -= 0x100000;
224
225 early_write_config_word(hose,
226 current_bus,
227 pci_devfn,
228 PCI_PREF_MEMORY_BASE,
229 pciauto_upper_memspc >> 16);
230
231 /* Round I/O allocator to 4KB boundary */
232 pciauto_upper_iospc &= ~(0x1000 - 1);
233 if (*iosave == pciauto_upper_iospc)
234 pciauto_upper_iospc -= 0x1000;
235
236 early_write_config_byte(hose,
237 current_bus,
238 pci_devfn,
239 PCI_IO_BASE,
240 (pciauto_upper_iospc & 0x0000f000) >> 8);
241 early_write_config_word(hose,
242 current_bus,
243 pci_devfn,
244 PCI_IO_BASE_UPPER16,
245 pciauto_upper_iospc >> 16);
246
247 /* Enable memory and I/O accesses, enable bus master */
248 early_read_config_dword(hose,
249 current_bus,
250 pci_devfn,
251 PCI_COMMAND,
252 &cmdstat);
253 early_write_config_dword(hose,
254 current_bus,
255 pci_devfn,
256 PCI_COMMAND,
257 cmdstat |
258 PCI_COMMAND_IO |
259 PCI_COMMAND_MEMORY |
260 PCI_COMMAND_MASTER);
261}
262
263void __init pciauto_prescan_setup_cardbus_bridge(struct pci_controller *hose,
264 int current_bus,
265 int pci_devfn,
266 int sub_bus,
267 int *iosave,
268 int *memsave)
269{
270 /* Configure bus number registers */
271 early_write_config_byte(hose,
272 current_bus,
273 pci_devfn,
274 PCI_PRIMARY_BUS,
275 current_bus);
276 early_write_config_byte(hose,
277 current_bus,
278 pci_devfn,
279 PCI_SECONDARY_BUS,
280 sub_bus + 1);
281 early_write_config_byte(hose,
282 current_bus,
283 pci_devfn,
284 PCI_SUBORDINATE_BUS,
285 0xff);
286
287 /* Round memory allocator to 4KB boundary */
288 pciauto_upper_memspc &= ~(0x1000 - 1);
289 *memsave = pciauto_upper_memspc;
290
291 /* Round I/O allocator to 4 byte boundary */
292 pciauto_upper_iospc &= ~(0x4 - 1);
293 *iosave = pciauto_upper_iospc;
294
295 /* Set up memory and I/O filter limits, assume 32-bit I/O space */
296 early_write_config_dword(hose,
297 current_bus,
298 pci_devfn,
299 0x20,
300 pciauto_upper_memspc - 1);
301 early_write_config_dword(hose,
302 current_bus,
303 pci_devfn,
304 0x30,
305 pciauto_upper_iospc - 1);
306}
307
308void __init pciauto_postscan_setup_cardbus_bridge(struct pci_controller *hose,
309 int current_bus,
310 int pci_devfn,
311 int sub_bus,
312 int *iosave,
313 int *memsave)
314{
315 int cmdstat;
316
317 /*
318 * Configure subordinate bus number. The PCI subsystem
319 * bus scan will renumber buses (reserving three additional
320 * for this PCI<->CardBus bridge for the case where a CardBus
321 * adapter contains a P2P or CB2CB bridge.
322 */
323 early_write_config_byte(hose,
324 current_bus,
325 pci_devfn,
326 PCI_SUBORDINATE_BUS,
327 sub_bus);
328
329 /*
330 * Reserve an additional 4MB for mem space and 16KB for
331 * I/O space. This should cover any additional space
332 * requirement of unusual CardBus devices with
333 * additional bridges that can consume more address space.
334 *
335 * Although pcmcia-cs currently will reprogram bridge
336 * windows, the goal is to add an option to leave them
337 * alone and use the bridge window ranges as the regions
338 * that are searched for free resources upon hot-insertion
339 * of a device. This will allow a PCI<->CardBus bridge
340 * configured by this routine to happily live behind a
341 * P2P bridge in a system.
342 */
343 pciauto_upper_memspc -= 0x00400000;
344 pciauto_upper_iospc -= 0x00004000;
345
346 /* Round memory allocator to 4KB boundary */
347 pciauto_upper_memspc &= ~(0x1000 - 1);
348
349 early_write_config_dword(hose,
350 current_bus,
351 pci_devfn,
352 0x1c,
353 pciauto_upper_memspc);
354
355 /* Round I/O allocator to 4 byte boundary */
356 pciauto_upper_iospc &= ~(0x4 - 1);
357 early_write_config_dword(hose,
358 current_bus,
359 pci_devfn,
360 0x2c,
361 pciauto_upper_iospc);
362
363 /* Enable memory and I/O accesses, enable bus master */
364 early_read_config_dword(hose,
365 current_bus,
366 pci_devfn,
367 PCI_COMMAND,
368 &cmdstat);
369 early_write_config_dword(hose,
370 current_bus,
371 pci_devfn,
372 PCI_COMMAND,
373 cmdstat |
374 PCI_COMMAND_IO |
375 PCI_COMMAND_MEMORY |
376 PCI_COMMAND_MASTER);
377}
378
379int __init pciauto_bus_scan(struct pci_controller *hose, int current_bus)
380{
381 int sub_bus, pci_devfn, pci_class, cmdstat, found_multi = 0;
382 unsigned short vid;
383 unsigned char header_type;
384
385 /*
386 * Fetch our I/O and memory space upper boundaries used
387 * to allocated base addresses on this hose.
388 */
389 if (current_bus == hose->first_busno) {
390 pciauto_upper_iospc = hose->io_space.end + 1;
391 pciauto_upper_memspc = hose->mem_space.end + 1;
392 }
393
394 sub_bus = current_bus;
395
396 for (pci_devfn = 0; pci_devfn < 0xff; pci_devfn++) {
397 /* Skip our host bridge */
398 if ( (current_bus == hose->first_busno) && (pci_devfn == 0) )
399 continue;
400
401 if (PCI_FUNC(pci_devfn) && !found_multi)
402 continue;
403
404 /* If config space read fails from this device, move on */
405 if (early_read_config_byte(hose,
406 current_bus,
407 pci_devfn,
408 PCI_HEADER_TYPE,
409 &header_type))
410 continue;
411
412 if (!PCI_FUNC(pci_devfn))
413 found_multi = header_type & 0x80;
414
415 early_read_config_word(hose,
416 current_bus,
417 pci_devfn,
418 PCI_VENDOR_ID,
419 &vid);
420
421 if (vid != 0xffff) {
422 early_read_config_dword(hose,
423 current_bus,
424 pci_devfn,
425 PCI_CLASS_REVISION, &pci_class);
426 if ( (pci_class >> 16) == PCI_CLASS_BRIDGE_PCI ) {
427 int iosave, memsave;
428
429 DBG("PCI Autoconfig: Found P2P bridge, device %d\n", PCI_SLOT(pci_devfn));
430 /* Allocate PCI I/O and/or memory space */
431 pciauto_setup_bars(hose,
432 current_bus,
433 pci_devfn,
434 PCI_BASE_ADDRESS_1);
435
436 pciauto_prescan_setup_bridge(hose,
437 current_bus,
438 pci_devfn,
439 sub_bus,
440 &iosave,
441 &memsave);
442 sub_bus = pciauto_bus_scan(hose, sub_bus+1);
443 pciauto_postscan_setup_bridge(hose,
444 current_bus,
445 pci_devfn,
446 sub_bus,
447 &iosave,
448 &memsave);
449 } else if ((pci_class >> 16) == PCI_CLASS_BRIDGE_CARDBUS) {
450 int iosave, memsave;
451
452 DBG("PCI Autoconfig: Found CardBus bridge, device %d function %d\n", PCI_SLOT(pci_devfn), PCI_FUNC(pci_devfn));
453 /* Place CardBus Socket/ExCA registers */
454 pciauto_setup_bars(hose,
455 current_bus,
456 pci_devfn,
457 PCI_BASE_ADDRESS_0);
458
459 pciauto_prescan_setup_cardbus_bridge(hose,
460 current_bus,
461 pci_devfn,
462 sub_bus,
463 &iosave,
464 &memsave);
465 sub_bus = pciauto_bus_scan(hose, sub_bus+1);
466 pciauto_postscan_setup_cardbus_bridge(hose,
467 current_bus,
468 pci_devfn,
469 sub_bus,
470 &iosave,
471 &memsave);
472 } else {
473 if ((pci_class >> 16) == PCI_CLASS_STORAGE_IDE) {
474 unsigned char prg_iface;
475
476 early_read_config_byte(hose,
477 current_bus,
478 pci_devfn,
479 PCI_CLASS_PROG,
480 &prg_iface);
481 if (!(prg_iface & PCIAUTO_IDE_MODE_MASK)) {
482 DBG("PCI Autoconfig: Skipping legacy mode IDE controller\n");
483 continue;
484 }
485 }
486 /* Allocate PCI I/O and/or memory space */
487 pciauto_setup_bars(hose,
488 current_bus,
489 pci_devfn,
490 PCI_BASE_ADDRESS_5);
491
492 /*
493 * Enable some standard settings
494 */
495 early_read_config_dword(hose,
496 current_bus,
497 pci_devfn,
498 PCI_COMMAND,
499 &cmdstat);
500 early_write_config_dword(hose,
501 current_bus,
502 pci_devfn,
503 PCI_COMMAND,
504 cmdstat |
505 PCI_COMMAND_IO |
506 PCI_COMMAND_MEMORY |
507 PCI_COMMAND_MASTER);
508 early_write_config_byte(hose,
509 current_bus,
510 pci_devfn,
511 PCI_LATENCY_TIMER,
512 0x80);
513 }
514 }
515 }
516 return sub_bus;
517}
diff --git a/arch/ppc/syslib/ppc403_pic.c b/arch/ppc/syslib/ppc403_pic.c
new file mode 100644
index 000000000000..06cb0af2a58d
--- /dev/null
+++ b/arch/ppc/syslib/ppc403_pic.c
@@ -0,0 +1,127 @@
1/*
2 *
3 * Copyright (c) 1999 Grant Erickson <grant@lcse.umn.edu>
4 *
5 * Module name: ppc403_pic.c
6 *
7 * Description:
8 * Interrupt controller driver for PowerPC 403-based processors.
9 */
10
11/*
12 * The PowerPC 403 cores' Asynchronous Interrupt Controller (AIC) has
13 * 32 possible interrupts, a majority of which are not implemented on
14 * all cores. There are six configurable, external interrupt pins and
15 * there are eight internal interrupts for the on-chip serial port
16 * (SPU), DMA controller, and JTAG controller.
17 *
18 */
19
20#include <linux/init.h>
21#include <linux/sched.h>
22#include <linux/signal.h>
23#include <linux/stddef.h>
24
25#include <asm/processor.h>
26#include <asm/system.h>
27#include <asm/irq.h>
28#include <asm/ppc4xx_pic.h>
29
30/* Function Prototypes */
31
32static void ppc403_aic_enable(unsigned int irq);
33static void ppc403_aic_disable(unsigned int irq);
34static void ppc403_aic_disable_and_ack(unsigned int irq);
35
36static struct hw_interrupt_type ppc403_aic = {
37 "403GC AIC",
38 NULL,
39 NULL,
40 ppc403_aic_enable,
41 ppc403_aic_disable,
42 ppc403_aic_disable_and_ack,
43 0
44};
45
46int
47ppc403_pic_get_irq(struct pt_regs *regs)
48{
49 int irq;
50 unsigned long bits;
51
52 /*
53 * Only report the status of those interrupts that are actually
54 * enabled.
55 */
56
57 bits = mfdcr(DCRN_EXISR) & mfdcr(DCRN_EXIER);
58
59 /*
60 * Walk through the interrupts from highest priority to lowest, and
61 * report the first pending interrupt found.
62 * We want PPC, not C bit numbering, so just subtract the ffs()
63 * result from 32.
64 */
65 irq = 32 - ffs(bits);
66
67 if (irq == NR_AIC_IRQS)
68 irq = -1;
69
70 return (irq);
71}
72
73static void
74ppc403_aic_enable(unsigned int irq)
75{
76 int bit, word;
77
78 bit = irq & 0x1f;
79 word = irq >> 5;
80
81 ppc_cached_irq_mask[word] |= (1 << (31 - bit));
82 mtdcr(DCRN_EXIER, ppc_cached_irq_mask[word]);
83}
84
85static void
86ppc403_aic_disable(unsigned int irq)
87{
88 int bit, word;
89
90 bit = irq & 0x1f;
91 word = irq >> 5;
92
93 ppc_cached_irq_mask[word] &= ~(1 << (31 - bit));
94 mtdcr(DCRN_EXIER, ppc_cached_irq_mask[word]);
95}
96
97static void
98ppc403_aic_disable_and_ack(unsigned int irq)
99{
100 int bit, word;
101
102 bit = irq & 0x1f;
103 word = irq >> 5;
104
105 ppc_cached_irq_mask[word] &= ~(1 << (31 - bit));
106 mtdcr(DCRN_EXIER, ppc_cached_irq_mask[word]);
107 mtdcr(DCRN_EXISR, (1 << (31 - bit)));
108}
109
110void __init
111ppc4xx_pic_init(void)
112{
113 int i;
114
115 /*
116 * Disable all external interrupts until they are
117 * explicity requested.
118 */
119 ppc_cached_irq_mask[0] = 0;
120
121 mtdcr(DCRN_EXIER, ppc_cached_irq_mask[0]);
122
123 ppc_md.get_irq = ppc403_pic_get_irq;
124
125 for (i = 0; i < NR_IRQS; i++)
126 irq_desc[i].handler = &ppc403_aic;
127}
diff --git a/arch/ppc/syslib/ppc405_pci.c b/arch/ppc/syslib/ppc405_pci.c
new file mode 100644
index 000000000000..81c83bf98df4
--- /dev/null
+++ b/arch/ppc/syslib/ppc405_pci.c
@@ -0,0 +1,177 @@
1/*
2 * Authors: Frank Rowand <frank_rowand@mvista.com>,
3 * Debbie Chu <debbie_chu@mvista.com>, or source@mvista.com
4 * Further modifications by Armin Kuster <akuster@mvista.com>
5 *
6 * 2000 (c) MontaVista, Software, Inc. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10 *
11 * Based on arch/ppc/kernel/indirect.c, Copyright (C) 1998 Gabriel Paubert.
12 */
13
14#include <linux/pci.h>
15#include <asm/io.h>
16#include <asm/system.h>
17#include <asm/machdep.h>
18#include <linux/init.h>
19#include <linux/errno.h>
20#include <asm/ocp.h>
21#include <asm/ibm4xx.h>
22#include <asm/pci-bridge.h>
23#include <asm/ibm_ocp_pci.h>
24
25
26extern void bios_fixup(struct pci_controller *, struct pcil0_regs *);
27extern int ppc405_map_irq(struct pci_dev *dev, unsigned char idsel,
28 unsigned char pin);
29
30void
31ppc405_pcibios_fixup_resources(struct pci_dev *dev)
32{
33 int i;
34 unsigned long max_host_addr;
35 unsigned long min_host_addr;
36 struct resource *res;
37
38 /*
39 * openbios puts some graphics cards in the same range as the host
40 * controller uses to map to SDRAM. Fix it.
41 */
42
43 min_host_addr = 0;
44 max_host_addr = PPC405_PCI_MEM_BASE - 1;
45
46 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
47 res = dev->resource + i;
48 if (!res->start)
49 continue;
50 if ((res->flags & IORESOURCE_MEM) &&
51 (((res->start >= min_host_addr)
52 && (res->start <= max_host_addr))
53 || ((res->end >= min_host_addr)
54 && (res->end <= max_host_addr))
55 || ((res->start < min_host_addr)
56 && (res->end > max_host_addr))
57 )
58 ) {
59
60 /* force pcibios_assign_resources() to assign a new address */
61 res->end -= res->start;
62 res->start = 0;
63 }
64 }
65}
66
67static int
68ppc4xx_exclude_device(unsigned char bus, unsigned char devfn)
69{
70 /* We prevent us from seeing ourselves to avoid having
71 * the kernel try to remap our BAR #1 and fuck up bus
72 * master from external PCI devices
73 */
74 return (bus == 0 && devfn == 0);
75}
76
77void
78ppc4xx_find_bridges(void)
79{
80 struct pci_controller *hose_a;
81 struct pcil0_regs *pcip;
82 unsigned int tmp_addr;
83 unsigned int tmp_size;
84 unsigned int reg_index;
85 unsigned int new_pmm_max = 0;
86 unsigned int new_pmm_min = 0;
87
88 isa_io_base = 0;
89 isa_mem_base = 0;
90 pci_dram_offset = 0;
91
92#if (PSR_PCI_ARBIT_EN > 1)
93 /* Check if running in slave mode */
94 if ((mfdcr(DCRN_CHPSR) & PSR_PCI_ARBIT_EN) == 0) {
95 printk("Running as PCI slave, kernel PCI disabled !\n");
96 return;
97 }
98#endif
99 /* Setup PCI32 hose */
100 hose_a = pcibios_alloc_controller();
101 if (!hose_a)
102 return;
103 setup_indirect_pci(hose_a, PPC405_PCI_CONFIG_ADDR,
104 PPC405_PCI_CONFIG_DATA);
105
106 pcip = ioremap(PPC4xx_PCI_LCFG_PADDR, PAGE_SIZE);
107 if (pcip != NULL) {
108
109#if defined(CONFIG_BIOS_FIXUP)
110 bios_fixup(hose_a, pcip);
111#endif
112 new_pmm_min = 0xffffffff;
113 for (reg_index = 0; reg_index < 3; reg_index++) {
114 tmp_size = in_le32(&pcip->pmm[reg_index].ma); // mask & attrs
115 /* test the enable bit */
116 if ((tmp_size & 0x1) == 0)
117 continue;
118 tmp_addr = in_le32(&pcip->pmm[reg_index].pcila); // PCI addr
119 if (tmp_addr < PPC405_PCI_PHY_MEM_BASE) {
120 printk(KERN_DEBUG
121 "Disabling mapping to PCI mem addr 0x%8.8x\n",
122 tmp_addr);
123 out_le32(&pcip->pmm[reg_index].ma, tmp_size & ~1); // *_PMMOMA
124 continue;
125 }
126 tmp_addr = in_le32(&pcip->pmm[reg_index].la); // *_PMMOLA
127 if (tmp_addr < new_pmm_min)
128 new_pmm_min = tmp_addr;
129 tmp_addr = tmp_addr +
130 (0xffffffff - (tmp_size & 0xffffc000));
131 if (tmp_addr > PPC405_PCI_UPPER_MEM) {
132 new_pmm_max = tmp_addr; // PPC405_PCI_UPPER_MEM
133 } else {
134 new_pmm_max = PPC405_PCI_UPPER_MEM;
135 }
136
137 } // for
138
139 iounmap(pcip);
140 }
141
142 hose_a->first_busno = 0;
143 hose_a->last_busno = 0xff;
144 hose_a->pci_mem_offset = 0;
145
146 /* Setup bridge memory/IO ranges & resources
147 * TODO: Handle firmwares setting up a legacy ISA mem base
148 */
149 hose_a->io_space.start = PPC405_PCI_LOWER_IO;
150 hose_a->io_space.end = PPC405_PCI_UPPER_IO;
151 hose_a->mem_space.start = new_pmm_min;
152 hose_a->mem_space.end = new_pmm_max;
153 hose_a->io_base_phys = PPC405_PCI_PHY_IO_BASE;
154 hose_a->io_base_virt = ioremap(hose_a->io_base_phys, 0x10000);
155 hose_a->io_resource.start = 0;
156 hose_a->io_resource.end = PPC405_PCI_UPPER_IO - PPC405_PCI_LOWER_IO;
157 hose_a->io_resource.flags = IORESOURCE_IO;
158 hose_a->io_resource.name = "PCI I/O";
159 hose_a->mem_resources[0].start = new_pmm_min;
160 hose_a->mem_resources[0].end = new_pmm_max;
161 hose_a->mem_resources[0].flags = IORESOURCE_MEM;
162 hose_a->mem_resources[0].name = "PCI Memory";
163 isa_io_base = (int) hose_a->io_base_virt;
164 isa_mem_base = 0; /* ISA not implemented */
165 ISA_DMA_THRESHOLD = 0x00ffffff; /* ??? ISA not implemented */
166
167 /* Scan busses & initial setup by pci_auto */
168 hose_a->last_busno = pciauto_bus_scan(hose_a, hose_a->first_busno);
169 hose_a->last_busno = 0;
170
171 /* Setup ppc_md */
172 ppc_md.pcibios_fixup = NULL;
173 ppc_md.pci_exclude_device = ppc4xx_exclude_device;
174 ppc_md.pcibios_fixup_resources = ppc405_pcibios_fixup_resources;
175 ppc_md.pci_swizzle = common_swizzle;
176 ppc_md.pci_map_irq = ppc405_map_irq;
177}
diff --git a/arch/ppc/syslib/ppc4xx_dma.c b/arch/ppc/syslib/ppc4xx_dma.c
new file mode 100644
index 000000000000..5015ab99afd2
--- /dev/null
+++ b/arch/ppc/syslib/ppc4xx_dma.c
@@ -0,0 +1,708 @@
1/*
2 * arch/ppc/kernel/ppc4xx_dma.c
3 *
4 * IBM PPC4xx DMA engine core library
5 *
6 * Copyright 2000-2004 MontaVista Software Inc.
7 *
8 * Cleaned up and converted to new DCR access
9 * Matt Porter <mporter@kernel.crashing.org>
10 *
11 * Original code by Armin Kuster <akuster@mvista.com>
12 * and Pete Popov <ppopov@mvista.com>
13 *
14 * This program is free software; you can redistribute it and/or modify it
15 * under the terms of the GNU General Public License as published by the
16 * Free Software Foundation; either version 2 of the License, or (at your
17 * option) any later version.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23
24#include <linux/config.h>
25#include <linux/kernel.h>
26#include <linux/mm.h>
27#include <linux/miscdevice.h>
28#include <linux/init.h>
29#include <linux/module.h>
30
31#include <asm/system.h>
32#include <asm/io.h>
33#include <asm/ppc4xx_dma.h>
34
35ppc_dma_ch_t dma_channels[MAX_PPC4xx_DMA_CHANNELS];
36
37int
38ppc4xx_get_dma_status(void)
39{
40 return (mfdcr(DCRN_DMASR));
41}
42
43void
44ppc4xx_set_src_addr(int dmanr, phys_addr_t src_addr)
45{
46 if (dmanr >= MAX_PPC4xx_DMA_CHANNELS) {
47 printk("set_src_addr: bad channel: %d\n", dmanr);
48 return;
49 }
50
51#ifdef PPC4xx_DMA_64BIT
52 mtdcr(DCRN_DMASAH0 + dmanr*2, (u32)(src_addr >> 32));
53#else
54 mtdcr(DCRN_DMASA0 + dmanr*2, (u32)src_addr);
55#endif
56}
57
58void
59ppc4xx_set_dst_addr(int dmanr, phys_addr_t dst_addr)
60{
61 if (dmanr >= MAX_PPC4xx_DMA_CHANNELS) {
62 printk("set_dst_addr: bad channel: %d\n", dmanr);
63 return;
64 }
65
66#ifdef PPC4xx_DMA_64BIT
67 mtdcr(DCRN_DMADAH0 + dmanr*2, (u32)(dst_addr >> 32));
68#else
69 mtdcr(DCRN_DMADA0 + dmanr*2, (u32)dst_addr);
70#endif
71}
72
73void
74ppc4xx_enable_dma(unsigned int dmanr)
75{
76 unsigned int control;
77 ppc_dma_ch_t *p_dma_ch = &dma_channels[dmanr];
78 unsigned int status_bits[] = { DMA_CS0 | DMA_TS0 | DMA_CH0_ERR,
79 DMA_CS1 | DMA_TS1 | DMA_CH1_ERR,
80 DMA_CS2 | DMA_TS2 | DMA_CH2_ERR,
81 DMA_CS3 | DMA_TS3 | DMA_CH3_ERR};
82
83 if (p_dma_ch->in_use) {
84 printk("enable_dma: channel %d in use\n", dmanr);
85 return;
86 }
87
88 if (dmanr >= MAX_PPC4xx_DMA_CHANNELS) {
89 printk("enable_dma: bad channel: %d\n", dmanr);
90 return;
91 }
92
93 if (p_dma_ch->mode == DMA_MODE_READ) {
94 /* peripheral to memory */
95 ppc4xx_set_src_addr(dmanr, 0);
96 ppc4xx_set_dst_addr(dmanr, p_dma_ch->addr);
97 } else if (p_dma_ch->mode == DMA_MODE_WRITE) {
98 /* memory to peripheral */
99 ppc4xx_set_src_addr(dmanr, p_dma_ch->addr);
100 ppc4xx_set_dst_addr(dmanr, 0);
101 }
102
103 /* for other xfer modes, the addresses are already set */
104 control = mfdcr(DCRN_DMACR0 + (dmanr * 0x8));
105
106 control &= ~(DMA_TM_MASK | DMA_TD); /* clear all mode bits */
107 if (p_dma_ch->mode == DMA_MODE_MM) {
108 /* software initiated memory to memory */
109 control |= DMA_ETD_OUTPUT | DMA_TCE_ENABLE;
110 }
111
112 mtdcr(DCRN_DMACR0 + (dmanr * 0x8), control);
113
114 /*
115 * Clear the CS, TS, RI bits for the channel from DMASR. This
116 * has been observed to happen correctly only after the mode and
117 * ETD/DCE bits in DMACRx are set above. Must do this before
118 * enabling the channel.
119 */
120
121 mtdcr(DCRN_DMASR, status_bits[dmanr]);
122
123 /*
124 * For device-paced transfers, Terminal Count Enable apparently
125 * must be on, and this must be turned on after the mode, etc.
126 * bits are cleared above (at least on Redwood-6).
127 */
128
129 if ((p_dma_ch->mode == DMA_MODE_MM_DEVATDST) ||
130 (p_dma_ch->mode == DMA_MODE_MM_DEVATSRC))
131 control |= DMA_TCE_ENABLE;
132
133 /*
134 * Now enable the channel.
135 */
136
137 control |= (p_dma_ch->mode | DMA_CE_ENABLE);
138
139 mtdcr(DCRN_DMACR0 + (dmanr * 0x8), control);
140
141 p_dma_ch->in_use = 1;
142}
143
144void
145ppc4xx_disable_dma(unsigned int dmanr)
146{
147 unsigned int control;
148 ppc_dma_ch_t *p_dma_ch = &dma_channels[dmanr];
149
150 if (!p_dma_ch->in_use) {
151 printk("disable_dma: channel %d not in use\n", dmanr);
152 return;
153 }
154
155 if (dmanr >= MAX_PPC4xx_DMA_CHANNELS) {
156 printk("disable_dma: bad channel: %d\n", dmanr);
157 return;
158 }
159
160 control = mfdcr(DCRN_DMACR0 + (dmanr * 0x8));
161 control &= ~DMA_CE_ENABLE;
162 mtdcr(DCRN_DMACR0 + (dmanr * 0x8), control);
163
164 p_dma_ch->in_use = 0;
165}
166
167/*
168 * Sets the dma mode for single DMA transfers only.
169 * For scatter/gather transfers, the mode is passed to the
170 * alloc_dma_handle() function as one of the parameters.
171 *
172 * The mode is simply saved and used later. This allows
173 * the driver to call set_dma_mode() and set_dma_addr() in
174 * any order.
175 *
176 * Valid mode values are:
177 *
178 * DMA_MODE_READ peripheral to memory
179 * DMA_MODE_WRITE memory to peripheral
180 * DMA_MODE_MM memory to memory
181 * DMA_MODE_MM_DEVATSRC device-paced memory to memory, device at src
182 * DMA_MODE_MM_DEVATDST device-paced memory to memory, device at dst
183 */
184int
185ppc4xx_set_dma_mode(unsigned int dmanr, unsigned int mode)
186{
187 ppc_dma_ch_t *p_dma_ch = &dma_channels[dmanr];
188
189 if (dmanr >= MAX_PPC4xx_DMA_CHANNELS) {
190 printk("set_dma_mode: bad channel 0x%x\n", dmanr);
191 return DMA_STATUS_BAD_CHANNEL;
192 }
193
194 p_dma_ch->mode = mode;
195
196 return DMA_STATUS_GOOD;
197}
198
199/*
200 * Sets the DMA Count register. Note that 'count' is in bytes.
201 * However, the DMA Count register counts the number of "transfers",
202 * where each transfer is equal to the bus width. Thus, count
203 * MUST be a multiple of the bus width.
204 */
205void
206ppc4xx_set_dma_count(unsigned int dmanr, unsigned int count)
207{
208 ppc_dma_ch_t *p_dma_ch = &dma_channels[dmanr];
209
210#ifdef DEBUG_4xxDMA
211 {
212 int error = 0;
213 switch (p_dma_ch->pwidth) {
214 case PW_8:
215 break;
216 case PW_16:
217 if (count & 0x1)
218 error = 1;
219 break;
220 case PW_32:
221 if (count & 0x3)
222 error = 1;
223 break;
224 case PW_64:
225 if (count & 0x7)
226 error = 1;
227 break;
228 default:
229 printk("set_dma_count: invalid bus width: 0x%x\n",
230 p_dma_ch->pwidth);
231 return;
232 }
233 if (error)
234 printk
235 ("Warning: set_dma_count count 0x%x bus width %d\n",
236 count, p_dma_ch->pwidth);
237 }
238#endif
239
240 count = count >> p_dma_ch->shift;
241
242 mtdcr(DCRN_DMACT0 + (dmanr * 0x8), count);
243}
244
245/*
246 * Returns the number of bytes left to be transfered.
247 * After a DMA transfer, this should return zero.
248 * Reading this while a DMA transfer is still in progress will return
249 * unpredictable results.
250 */
251int
252ppc4xx_get_dma_residue(unsigned int dmanr)
253{
254 unsigned int count;
255 ppc_dma_ch_t *p_dma_ch = &dma_channels[dmanr];
256
257 if (dmanr >= MAX_PPC4xx_DMA_CHANNELS) {
258 printk("ppc4xx_get_dma_residue: bad channel 0x%x\n", dmanr);
259 return DMA_STATUS_BAD_CHANNEL;
260 }
261
262 count = mfdcr(DCRN_DMACT0 + (dmanr * 0x8));
263
264 return (count << p_dma_ch->shift);
265}
266
267/*
268 * Sets the DMA address for a memory to peripheral or peripheral
269 * to memory transfer. The address is just saved in the channel
270 * structure for now and used later in enable_dma().
271 */
272void
273ppc4xx_set_dma_addr(unsigned int dmanr, phys_addr_t addr)
274{
275 ppc_dma_ch_t *p_dma_ch = &dma_channels[dmanr];
276
277 if (dmanr >= MAX_PPC4xx_DMA_CHANNELS) {
278 printk("ppc4xx_set_dma_addr: bad channel: %d\n", dmanr);
279 return;
280 }
281
282#ifdef DEBUG_4xxDMA
283 {
284 int error = 0;
285 switch (p_dma_ch->pwidth) {
286 case PW_8:
287 break;
288 case PW_16:
289 if ((unsigned) addr & 0x1)
290 error = 1;
291 break;
292 case PW_32:
293 if ((unsigned) addr & 0x3)
294 error = 1;
295 break;
296 case PW_64:
297 if ((unsigned) addr & 0x7)
298 error = 1;
299 break;
300 default:
301 printk("ppc4xx_set_dma_addr: invalid bus width: 0x%x\n",
302 p_dma_ch->pwidth);
303 return;
304 }
305 if (error)
306 printk("Warning: ppc4xx_set_dma_addr addr 0x%x bus width %d\n",
307 addr, p_dma_ch->pwidth);
308 }
309#endif
310
311 /* save dma address and program it later after we know the xfer mode */
312 p_dma_ch->addr = addr;
313}
314
315/*
316 * Sets both DMA addresses for a memory to memory transfer.
317 * For memory to peripheral or peripheral to memory transfers
318 * the function set_dma_addr() should be used instead.
319 */
320void
321ppc4xx_set_dma_addr2(unsigned int dmanr, phys_addr_t src_dma_addr,
322 phys_addr_t dst_dma_addr)
323{
324 if (dmanr >= MAX_PPC4xx_DMA_CHANNELS) {
325 printk("ppc4xx_set_dma_addr2: bad channel: %d\n", dmanr);
326 return;
327 }
328
329#ifdef DEBUG_4xxDMA
330 {
331 ppc_dma_ch_t *p_dma_ch = &dma_channels[dmanr];
332 int error = 0;
333 switch (p_dma_ch->pwidth) {
334 case PW_8:
335 break;
336 case PW_16:
337 if (((unsigned) src_dma_addr & 0x1) ||
338 ((unsigned) dst_dma_addr & 0x1)
339 )
340 error = 1;
341 break;
342 case PW_32:
343 if (((unsigned) src_dma_addr & 0x3) ||
344 ((unsigned) dst_dma_addr & 0x3)
345 )
346 error = 1;
347 break;
348 case PW_64:
349 if (((unsigned) src_dma_addr & 0x7) ||
350 ((unsigned) dst_dma_addr & 0x7)
351 )
352 error = 1;
353 break;
354 default:
355 printk("ppc4xx_set_dma_addr2: invalid bus width: 0x%x\n",
356 p_dma_ch->pwidth);
357 return;
358 }
359 if (error)
360 printk
361 ("Warning: ppc4xx_set_dma_addr2 src 0x%x dst 0x%x bus width %d\n",
362 src_dma_addr, dst_dma_addr, p_dma_ch->pwidth);
363 }
364#endif
365
366 ppc4xx_set_src_addr(dmanr, src_dma_addr);
367 ppc4xx_set_dst_addr(dmanr, dst_dma_addr);
368}
369
370/*
371 * Enables the channel interrupt.
372 *
373 * If performing a scatter/gatter transfer, this function
374 * MUST be called before calling alloc_dma_handle() and building
375 * the sgl list. Otherwise, interrupts will not be enabled, if
376 * they were previously disabled.
377 */
378int
379ppc4xx_enable_dma_interrupt(unsigned int dmanr)
380{
381 unsigned int control;
382 ppc_dma_ch_t *p_dma_ch = &dma_channels[dmanr];
383
384 if (dmanr >= MAX_PPC4xx_DMA_CHANNELS) {
385 printk("ppc4xx_enable_dma_interrupt: bad channel: %d\n", dmanr);
386 return DMA_STATUS_BAD_CHANNEL;
387 }
388
389 p_dma_ch->int_enable = 1;
390
391 control = mfdcr(DCRN_DMACR0 + (dmanr * 0x8));
392 control |= DMA_CIE_ENABLE; /* Channel Interrupt Enable */
393 mtdcr(DCRN_DMACR0 + (dmanr * 0x8), control);
394
395 return DMA_STATUS_GOOD;
396}
397
398/*
399 * Disables the channel interrupt.
400 *
401 * If performing a scatter/gatter transfer, this function
402 * MUST be called before calling alloc_dma_handle() and building
403 * the sgl list. Otherwise, interrupts will not be disabled, if
404 * they were previously enabled.
405 */
406int
407ppc4xx_disable_dma_interrupt(unsigned int dmanr)
408{
409 unsigned int control;
410 ppc_dma_ch_t *p_dma_ch = &dma_channels[dmanr];
411
412 if (dmanr >= MAX_PPC4xx_DMA_CHANNELS) {
413 printk("ppc4xx_disable_dma_interrupt: bad channel: %d\n", dmanr);
414 return DMA_STATUS_BAD_CHANNEL;
415 }
416
417 p_dma_ch->int_enable = 0;
418
419 control = mfdcr(DCRN_DMACR0 + (dmanr * 0x8));
420 control &= ~DMA_CIE_ENABLE; /* Channel Interrupt Enable */
421 mtdcr(DCRN_DMACR0 + (dmanr * 0x8), control);
422
423 return DMA_STATUS_GOOD;
424}
425
426/*
427 * Configures a DMA channel, including the peripheral bus width, if a
428 * peripheral is attached to the channel, the polarity of the DMAReq and
429 * DMAAck signals, etc. This information should really be setup by the boot
430 * code, since most likely the configuration won't change dynamically.
431 * If the kernel has to call this function, it's recommended that it's
432 * called from platform specific init code. The driver should not need to
433 * call this function.
434 */
435int
436ppc4xx_init_dma_channel(unsigned int dmanr, ppc_dma_ch_t * p_init)
437{
438 unsigned int polarity;
439 uint32_t control = 0;
440 ppc_dma_ch_t *p_dma_ch = &dma_channels[dmanr];
441
442 DMA_MODE_READ = (unsigned long) DMA_TD; /* Peripheral to Memory */
443 DMA_MODE_WRITE = 0; /* Memory to Peripheral */
444
445 if (!p_init) {
446 printk("ppc4xx_init_dma_channel: NULL p_init\n");
447 return DMA_STATUS_NULL_POINTER;
448 }
449
450 if (dmanr >= MAX_PPC4xx_DMA_CHANNELS) {
451 printk("ppc4xx_init_dma_channel: bad channel %d\n", dmanr);
452 return DMA_STATUS_BAD_CHANNEL;
453 }
454
455#if DCRN_POL > 0
456 polarity = mfdcr(DCRN_POL);
457#else
458 polarity = 0;
459#endif
460
461 /* Setup the control register based on the values passed to
462 * us in p_init. Then, over-write the control register with this
463 * new value.
464 */
465 control |= SET_DMA_CONTROL;
466
467 /* clear all polarity signals and then "or" in new signal levels */
468 polarity &= ~GET_DMA_POLARITY(dmanr);
469 polarity |= p_init->polarity;
470#if DCRN_POL > 0
471 mtdcr(DCRN_POL, polarity);
472#endif
473 mtdcr(DCRN_DMACR0 + (dmanr * 0x8), control);
474
475 /* save these values in our dma channel structure */
476 memcpy(p_dma_ch, p_init, sizeof (ppc_dma_ch_t));
477
478 /*
479 * The peripheral width values written in the control register are:
480 * PW_8 0
481 * PW_16 1
482 * PW_32 2
483 * PW_64 3
484 *
485 * Since the DMA count register takes the number of "transfers",
486 * we need to divide the count sent to us in certain
487 * functions by the appropriate number. It so happens that our
488 * right shift value is equal to the peripheral width value.
489 */
490 p_dma_ch->shift = p_init->pwidth;
491
492 /*
493 * Save the control word for easy access.
494 */
495 p_dma_ch->control = control;
496
497 mtdcr(DCRN_DMASR, 0xffffffff); /* clear status register */
498 return DMA_STATUS_GOOD;
499}
500
501/*
502 * This function returns the channel configuration.
503 */
504int
505ppc4xx_get_channel_config(unsigned int dmanr, ppc_dma_ch_t * p_dma_ch)
506{
507 unsigned int polarity;
508 unsigned int control;
509
510 if (dmanr >= MAX_PPC4xx_DMA_CHANNELS) {
511 printk("ppc4xx_get_channel_config: bad channel %d\n", dmanr);
512 return DMA_STATUS_BAD_CHANNEL;
513 }
514
515 memcpy(p_dma_ch, &dma_channels[dmanr], sizeof (ppc_dma_ch_t));
516
517#if DCRN_POL > 0
518 polarity = mfdcr(DCRN_POL);
519#else
520 polarity = 0;
521#endif
522
523 p_dma_ch->polarity = polarity & GET_DMA_POLARITY(dmanr);
524 control = mfdcr(DCRN_DMACR0 + (dmanr * 0x8));
525
526 p_dma_ch->cp = GET_DMA_PRIORITY(control);
527 p_dma_ch->pwidth = GET_DMA_PW(control);
528 p_dma_ch->psc = GET_DMA_PSC(control);
529 p_dma_ch->pwc = GET_DMA_PWC(control);
530 p_dma_ch->phc = GET_DMA_PHC(control);
531 p_dma_ch->ce = GET_DMA_CE_ENABLE(control);
532 p_dma_ch->int_enable = GET_DMA_CIE_ENABLE(control);
533 p_dma_ch->shift = GET_DMA_PW(control);
534
535#ifdef CONFIG_PPC4xx_EDMA
536 p_dma_ch->pf = GET_DMA_PREFETCH(control);
537#else
538 p_dma_ch->ch_enable = GET_DMA_CH(control);
539 p_dma_ch->ece_enable = GET_DMA_ECE(control);
540 p_dma_ch->tcd_disable = GET_DMA_TCD(control);
541#endif
542 return DMA_STATUS_GOOD;
543}
544
545/*
546 * Sets the priority for the DMA channel dmanr.
547 * Since this is setup by the hardware init function, this function
548 * can be used to dynamically change the priority of a channel.
549 *
550 * Acceptable priorities:
551 *
552 * PRIORITY_LOW
553 * PRIORITY_MID_LOW
554 * PRIORITY_MID_HIGH
555 * PRIORITY_HIGH
556 *
557 */
558int
559ppc4xx_set_channel_priority(unsigned int dmanr, unsigned int priority)
560{
561 unsigned int control;
562
563 if (dmanr >= MAX_PPC4xx_DMA_CHANNELS) {
564 printk("ppc4xx_set_channel_priority: bad channel %d\n", dmanr);
565 return DMA_STATUS_BAD_CHANNEL;
566 }
567
568 if ((priority != PRIORITY_LOW) &&
569 (priority != PRIORITY_MID_LOW) &&
570 (priority != PRIORITY_MID_HIGH) && (priority != PRIORITY_HIGH)) {
571 printk("ppc4xx_set_channel_priority: bad priority: 0x%x\n", priority);
572 }
573
574 control = mfdcr(DCRN_DMACR0 + (dmanr * 0x8));
575 control |= SET_DMA_PRIORITY(priority);
576 mtdcr(DCRN_DMACR0 + (dmanr * 0x8), control);
577
578 return DMA_STATUS_GOOD;
579}
580
581/*
582 * Returns the width of the peripheral attached to this channel. This assumes
583 * that someone who knows the hardware configuration, boot code or some other
584 * init code, already set the width.
585 *
586 * The return value is one of:
587 * PW_8
588 * PW_16
589 * PW_32
590 * PW_64
591 *
592 * The function returns 0 on error.
593 */
594unsigned int
595ppc4xx_get_peripheral_width(unsigned int dmanr)
596{
597 unsigned int control;
598
599 if (dmanr >= MAX_PPC4xx_DMA_CHANNELS) {
600 printk("ppc4xx_get_peripheral_width: bad channel %d\n", dmanr);
601 return DMA_STATUS_BAD_CHANNEL;
602 }
603
604 control = mfdcr(DCRN_DMACR0 + (dmanr * 0x8));
605
606 return (GET_DMA_PW(control));
607}
608
609/*
610 * Clears the channel status bits
611 */
612int
613ppc4xx_clr_dma_status(unsigned int dmanr)
614{
615 if (dmanr >= MAX_PPC4xx_DMA_CHANNELS) {
616 printk(KERN_ERR "ppc4xx_clr_dma_status: bad channel: %d\n", dmanr);
617 return DMA_STATUS_BAD_CHANNEL;
618 }
619 mtdcr(DCRN_DMASR, ((u32)DMA_CH0_ERR | (u32)DMA_CS0 | (u32)DMA_TS0) >> dmanr);
620 return DMA_STATUS_GOOD;
621}
622
623/*
624 * Enables the burst on the channel (BTEN bit in the control/count register)
625 * Note:
626 * For scatter/gather dma, this function MUST be called before the
627 * ppc4xx_alloc_dma_handle() func as the chan count register is copied into the
628 * sgl list and used as each sgl element is added.
629 */
630int
631ppc4xx_enable_burst(unsigned int dmanr)
632{
633 unsigned int ctc;
634 if (dmanr >= MAX_PPC4xx_DMA_CHANNELS) {
635 printk(KERN_ERR "ppc4xx_enable_burst: bad channel: %d\n", dmanr);
636 return DMA_STATUS_BAD_CHANNEL;
637 }
638 ctc = mfdcr(DCRN_DMACT0 + (dmanr * 0x8)) | DMA_CTC_BTEN;
639 mtdcr(DCRN_DMACT0 + (dmanr * 0x8), ctc);
640 return DMA_STATUS_GOOD;
641}
642/*
643 * Disables the burst on the channel (BTEN bit in the control/count register)
644 * Note:
645 * For scatter/gather dma, this function MUST be called before the
646 * ppc4xx_alloc_dma_handle() func as the chan count register is copied into the
647 * sgl list and used as each sgl element is added.
648 */
649int
650ppc4xx_disable_burst(unsigned int dmanr)
651{
652 unsigned int ctc;
653 if (dmanr >= MAX_PPC4xx_DMA_CHANNELS) {
654 printk(KERN_ERR "ppc4xx_disable_burst: bad channel: %d\n", dmanr);
655 return DMA_STATUS_BAD_CHANNEL;
656 }
657 ctc = mfdcr(DCRN_DMACT0 + (dmanr * 0x8)) &~ DMA_CTC_BTEN;
658 mtdcr(DCRN_DMACT0 + (dmanr * 0x8), ctc);
659 return DMA_STATUS_GOOD;
660}
661/*
662 * Sets the burst size (number of peripheral widths) for the channel
663 * (BSIZ bits in the control/count register))
664 * must be one of:
665 * DMA_CTC_BSIZ_2
666 * DMA_CTC_BSIZ_4
667 * DMA_CTC_BSIZ_8
668 * DMA_CTC_BSIZ_16
669 * Note:
670 * For scatter/gather dma, this function MUST be called before the
671 * ppc4xx_alloc_dma_handle() func as the chan count register is copied into the
672 * sgl list and used as each sgl element is added.
673 */
674int
675ppc4xx_set_burst_size(unsigned int dmanr, unsigned int bsize)
676{
677 unsigned int ctc;
678 if (dmanr >= MAX_PPC4xx_DMA_CHANNELS) {
679 printk(KERN_ERR "ppc4xx_set_burst_size: bad channel: %d\n", dmanr);
680 return DMA_STATUS_BAD_CHANNEL;
681 }
682 ctc = mfdcr(DCRN_DMACT0 + (dmanr * 0x8)) &~ DMA_CTC_BSIZ_MSK;
683 ctc |= (bsize & DMA_CTC_BSIZ_MSK);
684 mtdcr(DCRN_DMACT0 + (dmanr * 0x8), ctc);
685 return DMA_STATUS_GOOD;
686}
687
688EXPORT_SYMBOL(ppc4xx_init_dma_channel);
689EXPORT_SYMBOL(ppc4xx_get_channel_config);
690EXPORT_SYMBOL(ppc4xx_set_channel_priority);
691EXPORT_SYMBOL(ppc4xx_get_peripheral_width);
692EXPORT_SYMBOL(dma_channels);
693EXPORT_SYMBOL(ppc4xx_set_src_addr);
694EXPORT_SYMBOL(ppc4xx_set_dst_addr);
695EXPORT_SYMBOL(ppc4xx_set_dma_addr);
696EXPORT_SYMBOL(ppc4xx_set_dma_addr2);
697EXPORT_SYMBOL(ppc4xx_enable_dma);
698EXPORT_SYMBOL(ppc4xx_disable_dma);
699EXPORT_SYMBOL(ppc4xx_set_dma_mode);
700EXPORT_SYMBOL(ppc4xx_set_dma_count);
701EXPORT_SYMBOL(ppc4xx_get_dma_residue);
702EXPORT_SYMBOL(ppc4xx_enable_dma_interrupt);
703EXPORT_SYMBOL(ppc4xx_disable_dma_interrupt);
704EXPORT_SYMBOL(ppc4xx_get_dma_status);
705EXPORT_SYMBOL(ppc4xx_clr_dma_status);
706EXPORT_SYMBOL(ppc4xx_enable_burst);
707EXPORT_SYMBOL(ppc4xx_disable_burst);
708EXPORT_SYMBOL(ppc4xx_set_burst_size);
diff --git a/arch/ppc/syslib/ppc4xx_kgdb.c b/arch/ppc/syslib/ppc4xx_kgdb.c
new file mode 100644
index 000000000000..fe8668bf8137
--- /dev/null
+++ b/arch/ppc/syslib/ppc4xx_kgdb.c
@@ -0,0 +1,124 @@
1#include <linux/config.h>
2#include <linux/types.h>
3#include <asm/ibm4xx.h>
4#include <linux/kernel.h>
5
6
7
8#define LSR_DR 0x01 /* Data ready */
9#define LSR_OE 0x02 /* Overrun */
10#define LSR_PE 0x04 /* Parity error */
11#define LSR_FE 0x08 /* Framing error */
12#define LSR_BI 0x10 /* Break */
13#define LSR_THRE 0x20 /* Xmit holding register empty */
14#define LSR_TEMT 0x40 /* Xmitter empty */
15#define LSR_ERR 0x80 /* Error */
16
17#include <platforms/4xx/ibm_ocp.h>
18
19extern struct NS16550* COM_PORTS[];
20#ifndef NULL
21#define NULL 0x00
22#endif
23
24static volatile struct NS16550 *kgdb_debugport = NULL;
25
26volatile struct NS16550 *
27NS16550_init(int chan)
28{
29 volatile struct NS16550 *com_port;
30 int quot;
31#ifdef BASE_BAUD
32 quot = BASE_BAUD / 9600;
33#else
34 quot = 0x000c; /* 0xc = 9600 baud (on a pc) */
35#endif
36
37 com_port = (struct NS16550 *) COM_PORTS[chan];
38
39 com_port->lcr = 0x00;
40 com_port->ier = 0xFF;
41 com_port->ier = 0x00;
42 com_port->lcr = com_port->lcr | 0x80; /* Access baud rate */
43 com_port->dll = ( quot & 0x00ff ); /* 0xc = 9600 baud */
44 com_port->dlm = ( quot & 0xff00 ) >> 8;
45 com_port->lcr = 0x03; /* 8 data, 1 stop, no parity */
46 com_port->mcr = 0x00; /* RTS/DTR */
47 com_port->fcr = 0x07; /* Clear & enable FIFOs */
48
49 return( com_port );
50}
51
52
53void
54NS16550_putc(volatile struct NS16550 *com_port, unsigned char c)
55{
56 while ((com_port->lsr & LSR_THRE) == 0)
57 ;
58 com_port->thr = c;
59 return;
60}
61
62unsigned char
63NS16550_getc(volatile struct NS16550 *com_port)
64{
65 while ((com_port->lsr & LSR_DR) == 0)
66 ;
67 return (com_port->rbr);
68}
69
70unsigned char
71NS16550_tstc(volatile struct NS16550 *com_port)
72{
73 return ((com_port->lsr & LSR_DR) != 0);
74}
75
76
77#if defined(CONFIG_KGDB_TTYS0)
78#define KGDB_PORT 0
79#elif defined(CONFIG_KGDB_TTYS1)
80#define KGDB_PORT 1
81#elif defined(CONFIG_KGDB_TTYS2)
82#define KGDB_PORT 2
83#elif defined(CONFIG_KGDB_TTYS3)
84#define KGDB_PORT 3
85#else
86#error "invalid kgdb_tty port"
87#endif
88
89void putDebugChar( unsigned char c )
90{
91 if ( kgdb_debugport == NULL )
92 kgdb_debugport = NS16550_init(KGDB_PORT);
93 NS16550_putc( kgdb_debugport, c );
94}
95
96int getDebugChar( void )
97{
98 if (kgdb_debugport == NULL)
99 kgdb_debugport = NS16550_init(KGDB_PORT);
100
101 return(NS16550_getc(kgdb_debugport));
102}
103
104void kgdb_interruptible(int enable)
105{
106 return;
107}
108
109void putDebugString(char* str)
110{
111 while (*str != '\0') {
112 putDebugChar(*str);
113 str++;
114 }
115 putDebugChar('\r');
116 return;
117}
118
119void
120kgdb_map_scc(void)
121{
122 printk("kgdb init \n");
123 kgdb_debugport = NS16550_init(KGDB_PORT);
124}
diff --git a/arch/ppc/syslib/ppc4xx_pic.c b/arch/ppc/syslib/ppc4xx_pic.c
new file mode 100644
index 000000000000..08f06dd17e7b
--- /dev/null
+++ b/arch/ppc/syslib/ppc4xx_pic.c
@@ -0,0 +1,244 @@
1/*
2 * arch/ppc/syslib/ppc4xx_pic.c
3 *
4 * Interrupt controller driver for PowerPC 4xx-based processors.
5 *
6 * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
7 * Copyright (c) 2004, 2005 Zultys Technologies
8 *
9 * Based on original code by
10 * Copyright (c) 1999 Grant Erickson <grant@lcse.umn.edu>
11 * Armin Custer <akuster@mvista.com>
12 *
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the
15 * Free Software Foundation; either version 2 of the License, or (at your
16 * option) any later version.
17*/
18#include <linux/config.h>
19#include <linux/init.h>
20#include <linux/sched.h>
21#include <linux/signal.h>
22#include <linux/stddef.h>
23
24#include <asm/processor.h>
25#include <asm/system.h>
26#include <asm/irq.h>
27#include <asm/ppc4xx_pic.h>
28
29/* See comment in include/arch-ppc/ppc4xx_pic.h
30 * for more info about these two variables
31 */
32extern struct ppc4xx_uic_settings ppc4xx_core_uic_cfg[NR_UICS]
33 __attribute__ ((weak));
34extern unsigned char ppc4xx_uic_ext_irq_cfg[] __attribute__ ((weak));
35
36#define IRQ_MASK_UIC0(irq) (1 << (31 - (irq)))
37#define IRQ_MASK_UICx(irq) (1 << (31 - ((irq) & 0x1f)))
38#define IRQ_MASK_UIC1(irq) IRQ_MASK_UICx(irq)
39#define IRQ_MASK_UIC2(irq) IRQ_MASK_UICx(irq)
40
41#define UIC_HANDLERS(n) \
42static void ppc4xx_uic##n##_enable(unsigned int irq) \
43{ \
44 ppc_cached_irq_mask[n] |= IRQ_MASK_UIC##n(irq); \
45 mtdcr(DCRN_UIC_ER(UIC##n), ppc_cached_irq_mask[n]); \
46} \
47 \
48static void ppc4xx_uic##n##_disable(unsigned int irq) \
49{ \
50 ppc_cached_irq_mask[n] &= ~IRQ_MASK_UIC##n(irq); \
51 mtdcr(DCRN_UIC_ER(UIC##n), ppc_cached_irq_mask[n]); \
52 ACK_UIC##n##_PARENT \
53} \
54 \
55static void ppc4xx_uic##n##_ack(unsigned int irq) \
56{ \
57 u32 mask = IRQ_MASK_UIC##n(irq); \
58 ppc_cached_irq_mask[n] &= ~mask; \
59 mtdcr(DCRN_UIC_ER(UIC##n), ppc_cached_irq_mask[n]); \
60 mtdcr(DCRN_UIC_SR(UIC##n), mask); \
61 ACK_UIC##n##_PARENT \
62} \
63 \
64static void ppc4xx_uic##n##_end(unsigned int irq) \
65{ \
66 unsigned int status = irq_desc[irq].status; \
67 u32 mask = IRQ_MASK_UIC##n(irq); \
68 if (status & IRQ_LEVEL) { \
69 mtdcr(DCRN_UIC_SR(UIC##n), mask); \
70 ACK_UIC##n##_PARENT \
71 } \
72 if (!(status & (IRQ_DISABLED | IRQ_INPROGRESS))) { \
73 ppc_cached_irq_mask[n] |= mask; \
74 mtdcr(DCRN_UIC_ER(UIC##n), ppc_cached_irq_mask[n]); \
75 } \
76}
77
78#define DECLARE_UIC(n) \
79{ \
80 .typename = "UIC"#n, \
81 .enable = ppc4xx_uic##n##_enable, \
82 .disable = ppc4xx_uic##n##_disable, \
83 .ack = ppc4xx_uic##n##_ack, \
84 .end = ppc4xx_uic##n##_end, \
85} \
86
87#if NR_UICS == 3
88#define ACK_UIC0_PARENT mtdcr(DCRN_UIC_SR(UICB), UICB_UIC0NC);
89#define ACK_UIC1_PARENT mtdcr(DCRN_UIC_SR(UICB), UICB_UIC1NC);
90#define ACK_UIC2_PARENT mtdcr(DCRN_UIC_SR(UICB), UICB_UIC2NC);
91UIC_HANDLERS(0);
92UIC_HANDLERS(1);
93UIC_HANDLERS(2);
94
95static int ppc4xx_pic_get_irq(struct pt_regs *regs)
96{
97 u32 uicb = mfdcr(DCRN_UIC_MSR(UICB));
98 if (uicb & UICB_UIC0NC)
99 return 32 - ffs(mfdcr(DCRN_UIC_MSR(UIC0)));
100 else if (uicb & UICB_UIC1NC)
101 return 64 - ffs(mfdcr(DCRN_UIC_MSR(UIC1)));
102 else if (uicb & UICB_UIC2NC)
103 return 96 - ffs(mfdcr(DCRN_UIC_MSR(UIC2)));
104 else
105 return -1;
106}
107
108static void __init ppc4xx_pic_impl_init(void)
109{
110 /* Configure Base UIC */
111 mtdcr(DCRN_UIC_CR(UICB), 0);
112 mtdcr(DCRN_UIC_TR(UICB), 0);
113 mtdcr(DCRN_UIC_PR(UICB), 0xffffffff);
114 mtdcr(DCRN_UIC_SR(UICB), 0xffffffff);
115 mtdcr(DCRN_UIC_ER(UICB), UICB_UIC0NC | UICB_UIC1NC | UICB_UIC2NC);
116}
117
118#elif NR_UICS == 2
119#define ACK_UIC0_PARENT
120#define ACK_UIC1_PARENT mtdcr(DCRN_UIC_SR(UIC0), UIC0_UIC1NC);
121UIC_HANDLERS(0);
122UIC_HANDLERS(1);
123
124static int ppc4xx_pic_get_irq(struct pt_regs *regs)
125{
126 u32 uic0 = mfdcr(DCRN_UIC_MSR(UIC0));
127 if (uic0 & UIC0_UIC1NC)
128 return 64 - ffs(mfdcr(DCRN_UIC_MSR(UIC1)));
129 else
130 return uic0 ? 32 - ffs(uic0) : -1;
131}
132
133static void __init ppc4xx_pic_impl_init(void)
134{
135 /* Enable cascade interrupt in UIC0 */
136 ppc_cached_irq_mask[0] |= UIC0_UIC1NC;
137 mtdcr(DCRN_UIC_SR(UIC0), UIC0_UIC1NC);
138 mtdcr(DCRN_UIC_ER(UIC0), ppc_cached_irq_mask[0]);
139}
140
141#elif NR_UICS == 1
142#define ACK_UIC0_PARENT
143UIC_HANDLERS(0);
144
145static int ppc4xx_pic_get_irq(struct pt_regs *regs)
146{
147 u32 uic0 = mfdcr(DCRN_UIC_MSR(UIC0));
148 return uic0 ? 32 - ffs(uic0) : -1;
149}
150
151static inline void ppc4xx_pic_impl_init(void)
152{
153}
154#endif
155
156static struct ppc4xx_uic_impl {
157 struct hw_interrupt_type decl;
158 int base; /* Base DCR number */
159} __uic[] = {
160 { .decl = DECLARE_UIC(0), .base = UIC0 },
161#if NR_UICS > 1
162 { .decl = DECLARE_UIC(1), .base = UIC1 },
163#if NR_UICS > 2
164 { .decl = DECLARE_UIC(2), .base = UIC2 },
165#endif
166#endif
167};
168
169static inline int is_level_sensitive(int irq)
170{
171 u32 tr = mfdcr(DCRN_UIC_TR(__uic[irq >> 5].base));
172 return (tr & IRQ_MASK_UICx(irq)) == 0;
173}
174
175void __init ppc4xx_pic_init(void)
176{
177 int i;
178 unsigned char *eirqs = ppc4xx_uic_ext_irq_cfg;
179
180 for (i = 0; i < NR_UICS; ++i) {
181 int base = __uic[i].base;
182
183 /* Disable everything by default */
184 ppc_cached_irq_mask[i] = 0;
185 mtdcr(DCRN_UIC_ER(base), 0);
186
187 /* We don't use critical interrupts */
188 mtdcr(DCRN_UIC_CR(base), 0);
189
190 /* Configure polarity and triggering */
191 if (ppc4xx_core_uic_cfg) {
192 struct ppc4xx_uic_settings *p = ppc4xx_core_uic_cfg + i;
193 u32 mask = p->ext_irq_mask;
194 u32 pr = mfdcr(DCRN_UIC_PR(base)) & mask;
195 u32 tr = mfdcr(DCRN_UIC_TR(base)) & mask;
196
197 /* "Fixed" interrupts (on-chip devices) */
198 pr |= p->polarity & ~mask;
199 tr |= p->triggering & ~mask;
200
201 /* Merge external IRQs settings if board port
202 * provided them
203 */
204 if (eirqs && mask) {
205 pr &= ~mask;
206 tr &= ~mask;
207 while (mask) {
208 /* Extract current external IRQ mask */
209 u32 eirq_mask = 1 << __ilog2(mask);
210
211 if (!(*eirqs & IRQ_SENSE_LEVEL))
212 tr |= eirq_mask;
213
214 if (*eirqs & IRQ_POLARITY_POSITIVE)
215 pr |= eirq_mask;
216
217 mask &= ~eirq_mask;
218 ++eirqs;
219 }
220 }
221 mtdcr(DCRN_UIC_PR(base), pr);
222 mtdcr(DCRN_UIC_TR(base), tr);
223 }
224
225 /* ACK any pending interrupts to prevent false
226 * triggering after first enable
227 */
228 mtdcr(DCRN_UIC_SR(base), 0xffffffff);
229 }
230
231 /* Perform optional implementation specific setup
232 * (e.g. enable cascade interrupts for multi-UIC configurations)
233 */
234 ppc4xx_pic_impl_init();
235
236 /* Attach low-level handlers */
237 for (i = 0; i < (NR_UICS << 5); ++i) {
238 irq_desc[i].handler = &__uic[i >> 5].decl;
239 if (is_level_sensitive(i))
240 irq_desc[i].status |= IRQ_LEVEL;
241 }
242
243 ppc_md.get_irq = ppc4xx_pic_get_irq;
244}
diff --git a/arch/ppc/syslib/ppc4xx_pm.c b/arch/ppc/syslib/ppc4xx_pm.c
new file mode 100644
index 000000000000..60a479204885
--- /dev/null
+++ b/arch/ppc/syslib/ppc4xx_pm.c
@@ -0,0 +1,47 @@
1/*
2 * Author: Armin Kuster <akuster@mvista.com>
3 *
4 * 2002 (c) MontaVista, Software, Inc. This file is licensed under
5 * the terms of the GNU General Public License version 2. This program
6 * is licensed "as is" without any warranty of any kind, whether express
7 * or implied.
8 *
9 * This an attempt to get Power Management going for the IBM 4xx processor.
10 * This was derived from the ppc4xx._setup.c file
11 */
12
13#include <linux/config.h>
14#include <linux/init.h>
15
16#include <asm/ibm4xx.h>
17
18void __init
19ppc4xx_pm_init(void)
20{
21
22 unsigned int value = 0;
23
24 /* turn off unused hardware to save power */
25#ifdef CONFIG_405GP
26 value |= CPM_DCP; /* CodePack */
27#endif
28
29#if !defined(CONFIG_IBM_OCP_GPIO)
30 value |= CPM_GPIO0;
31#endif
32
33#if !defined(CONFIG_PPC405_I2C_ADAP)
34 value |= CPM_IIC0;
35#ifdef CONFIG_STB03xxx
36 value |= CPM_IIC1;
37#endif
38#endif
39
40
41#if !defined(CONFIG_405_DMA)
42 value |= CPM_DMA;
43#endif
44
45 mtdcr(DCRN_CPMFR, value);
46
47}
diff --git a/arch/ppc/syslib/ppc4xx_setup.c b/arch/ppc/syslib/ppc4xx_setup.c
new file mode 100644
index 000000000000..e170aebeb69b
--- /dev/null
+++ b/arch/ppc/syslib/ppc4xx_setup.c
@@ -0,0 +1,321 @@
1/*
2 *
3 * Copyright (c) 1999-2000 Grant Erickson <grant@lcse.umn.edu>
4 *
5 * Copyright 2000-2001 MontaVista Software Inc.
6 * Completed implementation.
7 * Author: MontaVista Software, Inc. <source@mvista.com>
8 * Frank Rowand <frank_rowand@mvista.com>
9 * Debbie Chu <debbie_chu@mvista.com>
10 * Further modifications by Armin Kuster
11 *
12 * Module name: ppc4xx_setup.c
13 *
14 */
15
16#include <linux/config.h>
17#include <linux/init.h>
18#include <linux/smp.h>
19#include <linux/threads.h>
20#include <linux/spinlock.h>
21#include <linux/irq.h>
22#include <linux/reboot.h>
23#include <linux/param.h>
24#include <linux/string.h>
25#include <linux/initrd.h>
26#include <linux/pci.h>
27#include <linux/rtc.h>
28#include <linux/console.h>
29#include <linux/ide.h>
30#include <linux/serial_reg.h>
31#include <linux/seq_file.h>
32
33#include <asm/system.h>
34#include <asm/processor.h>
35#include <asm/machdep.h>
36#include <asm/page.h>
37#include <asm/kgdb.h>
38#include <asm/ibm4xx.h>
39#include <asm/time.h>
40#include <asm/todc.h>
41#include <asm/ppc4xx_pic.h>
42#include <asm/pci-bridge.h>
43#include <asm/bootinfo.h>
44
45#include <syslib/gen550.h>
46
47/* Function Prototypes */
48extern void abort(void);
49extern void ppc4xx_find_bridges(void);
50
51extern void ppc4xx_wdt_heartbeat(void);
52extern int wdt_enable;
53extern unsigned long wdt_period;
54
55/* Global Variables */
56bd_t __res;
57
58void __init
59ppc4xx_setup_arch(void)
60{
61#if !defined(CONFIG_BDI_SWITCH)
62 /*
63 * The Abatron BDI JTAG debugger does not tolerate others
64 * mucking with the debug registers.
65 */
66 mtspr(SPRN_DBCR0, (DBCR0_IDM));
67 mtspr(SPRN_DBSR, 0xffffffff);
68#endif
69
70 /* Setup PCI host bridges */
71#ifdef CONFIG_PCI
72 ppc4xx_find_bridges();
73#endif
74}
75
76/*
77 * This routine pretty-prints the platform's internal CPU clock
78 * frequencies into the buffer for usage in /proc/cpuinfo.
79 */
80
81static int
82ppc4xx_show_percpuinfo(struct seq_file *m, int i)
83{
84 seq_printf(m, "clock\t\t: %ldMHz\n", (long)__res.bi_intfreq / 1000000);
85
86 return 0;
87}
88
89/*
90 * This routine pretty-prints the platform's internal bus clock
91 * frequencies into the buffer for usage in /proc/cpuinfo.
92 */
93static int
94ppc4xx_show_cpuinfo(struct seq_file *m)
95{
96 bd_t *bip = &__res;
97
98 seq_printf(m, "machine\t\t: %s\n", PPC4xx_MACHINE_NAME);
99 seq_printf(m, "plb bus clock\t: %ldMHz\n",
100 (long) bip->bi_busfreq / 1000000);
101#ifdef CONFIG_PCI
102 seq_printf(m, "pci bus clock\t: %dMHz\n",
103 bip->bi_pci_busfreq / 1000000);
104#endif
105
106 return 0;
107}
108
109/*
110 * Return the virtual address representing the top of physical RAM.
111 */
112static unsigned long __init
113ppc4xx_find_end_of_memory(void)
114{
115 return ((unsigned long) __res.bi_memsize);
116}
117
118void __init
119ppc4xx_map_io(void)
120{
121 io_block_mapping(PPC4xx_ONB_IO_VADDR,
122 PPC4xx_ONB_IO_PADDR, PPC4xx_ONB_IO_SIZE, _PAGE_IO);
123#ifdef CONFIG_PCI
124 io_block_mapping(PPC4xx_PCI_IO_VADDR,
125 PPC4xx_PCI_IO_PADDR, PPC4xx_PCI_IO_SIZE, _PAGE_IO);
126 io_block_mapping(PPC4xx_PCI_CFG_VADDR,
127 PPC4xx_PCI_CFG_PADDR, PPC4xx_PCI_CFG_SIZE, _PAGE_IO);
128 io_block_mapping(PPC4xx_PCI_LCFG_VADDR,
129 PPC4xx_PCI_LCFG_PADDR, PPC4xx_PCI_LCFG_SIZE, _PAGE_IO);
130#endif
131}
132
133void __init
134ppc4xx_init_IRQ(void)
135{
136 ppc4xx_pic_init();
137}
138
139static void
140ppc4xx_restart(char *cmd)
141{
142 printk("%s\n", cmd);
143 abort();
144}
145
146static void
147ppc4xx_power_off(void)
148{
149 printk("System Halted\n");
150 local_irq_disable();
151 while (1) ;
152}
153
154static void
155ppc4xx_halt(void)
156{
157 printk("System Halted\n");
158 local_irq_disable();
159 while (1) ;
160}
161
162/*
163 * This routine retrieves the internal processor frequency from the board
164 * information structure, sets up the kernel timer decrementer based on
165 * that value, enables the 4xx programmable interval timer (PIT) and sets
166 * it up for auto-reload.
167 */
168static void __init
169ppc4xx_calibrate_decr(void)
170{
171 unsigned int freq;
172 bd_t *bip = &__res;
173
174#if defined(CONFIG_WALNUT) || defined(CONFIG_ASH) || defined(CONFIG_SYCAMORE)
175 /* Walnut boot rom sets DCR CHCR1 (aka CPC0_CR1) bit CETE to 1 */
176 mtdcr(DCRN_CHCR1, mfdcr(DCRN_CHCR1) & ~CHR1_CETE);
177#endif
178 freq = bip->bi_tbfreq;
179 tb_ticks_per_jiffy = freq / HZ;
180 tb_to_us = mulhwu_scale_factor(freq, 1000000);
181
182 /* Set the time base to zero.
183 ** At 200 Mhz, time base will rollover in ~2925 years.
184 */
185
186 mtspr(SPRN_TBWL, 0);
187 mtspr(SPRN_TBWU, 0);
188
189 /* Clear any pending timer interrupts */
190
191 mtspr(SPRN_TSR, TSR_ENW | TSR_WIS | TSR_PIS | TSR_FIS);
192 mtspr(SPRN_TCR, TCR_PIE | TCR_ARE);
193
194 /* Set the PIT reload value and just let it run. */
195 mtspr(SPRN_PIT, tb_ticks_per_jiffy);
196}
197
198/*
199 * IDE stuff.
200 * should be generic for every IDE PCI chipset
201 */
202#if defined(CONFIG_PCI) && defined(CONFIG_IDE)
203static void
204ppc4xx_ide_init_hwif_ports(hw_regs_t * hw, unsigned long data_port,
205 unsigned long ctrl_port, int *irq)
206{
207 int i;
208
209 for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; ++i)
210 hw->io_ports[i] = data_port + i - IDE_DATA_OFFSET;
211
212 hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
213}
214#endif /* defined(CONFIG_PCI) && defined(CONFIG_IDE) */
215
216TODC_ALLOC();
217
218/*
219 * Input(s):
220 * r3 - Optional pointer to a board information structure.
221 * r4 - Optional pointer to the physical starting address of the init RAM
222 * disk.
223 * r5 - Optional pointer to the physical ending address of the init RAM
224 * disk.
225 * r6 - Optional pointer to the physical starting address of any kernel
226 * command-line parameters.
227 * r7 - Optional pointer to the physical ending address of any kernel
228 * command-line parameters.
229 */
230void __init
231ppc4xx_init(unsigned long r3, unsigned long r4, unsigned long r5,
232 unsigned long r6, unsigned long r7)
233{
234 parse_bootinfo(find_bootinfo());
235
236 /*
237 * If we were passed in a board information, copy it into the
238 * residual data area.
239 */
240 if (r3)
241 __res = *(bd_t *)(r3 + KERNELBASE);
242
243#if defined(CONFIG_BLK_DEV_INITRD)
244 /*
245 * If the init RAM disk has been configured in, and there's a valid
246 * starting address for it, set it up.
247 */
248 if (r4) {
249 initrd_start = r4 + KERNELBASE;
250 initrd_end = r5 + KERNELBASE;
251 }
252#endif /* CONFIG_BLK_DEV_INITRD */
253
254 /* Copy the kernel command line arguments to a safe place. */
255
256 if (r6) {
257 *(char *) (r7 + KERNELBASE) = 0;
258 strcpy(cmd_line, (char *) (r6 + KERNELBASE));
259 }
260#if defined(CONFIG_PPC405_WDT)
261/* Look for wdt= option on command line */
262 if (strstr(cmd_line, "wdt=")) {
263 int valid_wdt = 0;
264 char *p, *q;
265 for (q = cmd_line; (p = strstr(q, "wdt=")) != 0;) {
266 q = p + 4;
267 if (p > cmd_line && p[-1] != ' ')
268 continue;
269 wdt_period = simple_strtoul(q, &q, 0);
270 valid_wdt = 1;
271 ++q;
272 }
273 wdt_enable = valid_wdt;
274 }
275#endif
276
277 /* Initialize machine-dependent vectors */
278
279 ppc_md.setup_arch = ppc4xx_setup_arch;
280 ppc_md.show_percpuinfo = ppc4xx_show_percpuinfo;
281 ppc_md.show_cpuinfo = ppc4xx_show_cpuinfo;
282 ppc_md.init_IRQ = ppc4xx_init_IRQ;
283
284 ppc_md.restart = ppc4xx_restart;
285 ppc_md.power_off = ppc4xx_power_off;
286 ppc_md.halt = ppc4xx_halt;
287
288 ppc_md.calibrate_decr = ppc4xx_calibrate_decr;
289
290#ifdef CONFIG_PPC405_WDT
291 ppc_md.heartbeat = ppc4xx_wdt_heartbeat;
292#endif
293 ppc_md.heartbeat_count = 0;
294
295 ppc_md.find_end_of_memory = ppc4xx_find_end_of_memory;
296 ppc_md.setup_io_mappings = ppc4xx_map_io;
297
298#ifdef CONFIG_SERIAL_TEXT_DEBUG
299 ppc_md.progress = gen550_progress;
300#endif
301
302#if defined(CONFIG_PCI) && defined(CONFIG_IDE)
303 ppc_ide_md.ide_init_hwif = ppc4xx_ide_init_hwif_ports;
304#endif /* defined(CONFIG_PCI) && defined(CONFIG_IDE) */
305}
306
307/* Called from MachineCheckException */
308void platform_machine_check(struct pt_regs *regs)
309{
310#if defined(DCRN_PLB0_BEAR)
311 printk("PLB0: BEAR= 0x%08x ACR= 0x%08x BESR= 0x%08x\n",
312 mfdcr(DCRN_PLB0_BEAR), mfdcr(DCRN_PLB0_ACR),
313 mfdcr(DCRN_PLB0_BESR));
314#endif
315#if defined(DCRN_POB0_BEAR)
316 printk("PLB0 to OPB: BEAR= 0x%08x BESR0= 0x%08x BESR1= 0x%08x\n",
317 mfdcr(DCRN_POB0_BEAR), mfdcr(DCRN_POB0_BESR0),
318 mfdcr(DCRN_POB0_BESR1));
319#endif
320
321}
diff --git a/arch/ppc/syslib/ppc4xx_sgdma.c b/arch/ppc/syslib/ppc4xx_sgdma.c
new file mode 100644
index 000000000000..9f76e8ee39ed
--- /dev/null
+++ b/arch/ppc/syslib/ppc4xx_sgdma.c
@@ -0,0 +1,467 @@
1/*
2 * arch/ppc/kernel/ppc4xx_sgdma.c
3 *
4 * IBM PPC4xx DMA engine scatter/gather library
5 *
6 * Copyright 2002-2003 MontaVista Software Inc.
7 *
8 * Cleaned up and converted to new DCR access
9 * Matt Porter <mporter@kernel.crashing.org>
10 *
11 * Original code by Armin Kuster <akuster@mvista.com>
12 * and Pete Popov <ppopov@mvista.com>
13 *
14 * This program is free software; you can redistribute it and/or modify it
15 * under the terms of the GNU General Public License as published by the
16 * Free Software Foundation; either version 2 of the License, or (at your
17 * option) any later version.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23
24#include <linux/config.h>
25#include <linux/kernel.h>
26#include <linux/mm.h>
27#include <linux/init.h>
28#include <linux/module.h>
29#include <linux/pci.h>
30
31#include <asm/system.h>
32#include <asm/io.h>
33#include <asm/ppc4xx_dma.h>
34
35void
36ppc4xx_set_sg_addr(int dmanr, phys_addr_t sg_addr)
37{
38 if (dmanr >= MAX_PPC4xx_DMA_CHANNELS) {
39 printk("ppc4xx_set_sg_addr: bad channel: %d\n", dmanr);
40 return;
41 }
42
43#ifdef PPC4xx_DMA_64BIT
44 mtdcr(DCRN_ASGH0 + (dmanr * 0x8), (u32)(sg_addr >> 32));
45#endif
46 mtdcr(DCRN_ASG0 + (dmanr * 0x8), (u32)sg_addr);
47}
48
49/*
50 * Add a new sgl descriptor to the end of a scatter/gather list
51 * which was created by alloc_dma_handle().
52 *
53 * For a memory to memory transfer, both dma addresses must be
54 * valid. For a peripheral to memory transfer, one of the addresses
55 * must be set to NULL, depending on the direction of the transfer:
56 * memory to peripheral: set dst_addr to NULL,
57 * peripheral to memory: set src_addr to NULL.
58 */
59int
60ppc4xx_add_dma_sgl(sgl_handle_t handle, phys_addr_t src_addr, phys_addr_t dst_addr,
61 unsigned int count)
62{
63 sgl_list_info_t *psgl = (sgl_list_info_t *) handle;
64 ppc_dma_ch_t *p_dma_ch;
65
66 if (!handle) {
67 printk("ppc4xx_add_dma_sgl: null handle\n");
68 return DMA_STATUS_BAD_HANDLE;
69 }
70
71 if (psgl->dmanr >= MAX_PPC4xx_DMA_CHANNELS) {
72 printk("ppc4xx_add_dma_sgl: bad channel: %d\n", psgl->dmanr);
73 return DMA_STATUS_BAD_CHANNEL;
74 }
75
76 p_dma_ch = &dma_channels[psgl->dmanr];
77
78#ifdef DEBUG_4xxDMA
79 {
80 int error = 0;
81 unsigned int aligned =
82 (unsigned) src_addr | (unsigned) dst_addr | count;
83 switch (p_dma_ch->pwidth) {
84 case PW_8:
85 break;
86 case PW_16:
87 if (aligned & 0x1)
88 error = 1;
89 break;
90 case PW_32:
91 if (aligned & 0x3)
92 error = 1;
93 break;
94 case PW_64:
95 if (aligned & 0x7)
96 error = 1;
97 break;
98 default:
99 printk("ppc4xx_add_dma_sgl: invalid bus width: 0x%x\n",
100 p_dma_ch->pwidth);
101 return DMA_STATUS_GENERAL_ERROR;
102 }
103 if (error)
104 printk
105 ("Alignment warning: ppc4xx_add_dma_sgl src 0x%x dst 0x%x count 0x%x bus width var %d\n",
106 src_addr, dst_addr, count, p_dma_ch->pwidth);
107
108 }
109#endif
110
111 if ((unsigned) (psgl->ptail + 1) >= ((unsigned) psgl + SGL_LIST_SIZE)) {
112 printk("sgl handle out of memory \n");
113 return DMA_STATUS_OUT_OF_MEMORY;
114 }
115
116 if (!psgl->ptail) {
117 psgl->phead = (ppc_sgl_t *)
118 ((unsigned) psgl + sizeof (sgl_list_info_t));
119 psgl->phead_dma = psgl->dma_addr + sizeof(sgl_list_info_t);
120 psgl->ptail = psgl->phead;
121 psgl->ptail_dma = psgl->phead_dma;
122 } else {
123 if(p_dma_ch->int_on_final_sg) {
124 /* mask out all dma interrupts, except error, on tail
125 before adding new tail. */
126 psgl->ptail->control_count &=
127 ~(SG_TCI_ENABLE | SG_ETI_ENABLE);
128 }
129 psgl->ptail->next = psgl->ptail_dma + sizeof(ppc_sgl_t);
130 psgl->ptail++;
131 psgl->ptail_dma += sizeof(ppc_sgl_t);
132 }
133
134 psgl->ptail->control = psgl->control;
135 psgl->ptail->src_addr = src_addr;
136 psgl->ptail->dst_addr = dst_addr;
137 psgl->ptail->control_count = (count >> p_dma_ch->shift) |
138 psgl->sgl_control;
139 psgl->ptail->next = (uint32_t) NULL;
140
141 return DMA_STATUS_GOOD;
142}
143
144/*
145 * Enable (start) the DMA described by the sgl handle.
146 */
147void
148ppc4xx_enable_dma_sgl(sgl_handle_t handle)
149{
150 sgl_list_info_t *psgl = (sgl_list_info_t *) handle;
151 ppc_dma_ch_t *p_dma_ch;
152 uint32_t sg_command;
153
154 if (!handle) {
155 printk("ppc4xx_enable_dma_sgl: null handle\n");
156 return;
157 } else if (psgl->dmanr > (MAX_PPC4xx_DMA_CHANNELS - 1)) {
158 printk("ppc4xx_enable_dma_sgl: bad channel in handle %d\n",
159 psgl->dmanr);
160 return;
161 } else if (!psgl->phead) {
162 printk("ppc4xx_enable_dma_sgl: sg list empty\n");
163 return;
164 }
165
166 p_dma_ch = &dma_channels[psgl->dmanr];
167 psgl->ptail->control_count &= ~SG_LINK; /* make this the last dscrptr */
168 sg_command = mfdcr(DCRN_ASGC);
169
170 ppc4xx_set_sg_addr(psgl->dmanr, psgl->phead_dma);
171
172 sg_command |= SSG_ENABLE(psgl->dmanr);
173
174 mtdcr(DCRN_ASGC, sg_command); /* start transfer */
175}
176
177/*
178 * Halt an active scatter/gather DMA operation.
179 */
180void
181ppc4xx_disable_dma_sgl(sgl_handle_t handle)
182{
183 sgl_list_info_t *psgl = (sgl_list_info_t *) handle;
184 uint32_t sg_command;
185
186 if (!handle) {
187 printk("ppc4xx_enable_dma_sgl: null handle\n");
188 return;
189 } else if (psgl->dmanr > (MAX_PPC4xx_DMA_CHANNELS - 1)) {
190 printk("ppc4xx_enable_dma_sgl: bad channel in handle %d\n",
191 psgl->dmanr);
192 return;
193 }
194
195 sg_command = mfdcr(DCRN_ASGC);
196 sg_command &= ~SSG_ENABLE(psgl->dmanr);
197 mtdcr(DCRN_ASGC, sg_command); /* stop transfer */
198}
199
200/*
201 * Returns number of bytes left to be transferred from the entire sgl list.
202 * *src_addr and *dst_addr get set to the source/destination address of
203 * the sgl descriptor where the DMA stopped.
204 *
205 * An sgl transfer must NOT be active when this function is called.
206 */
207int
208ppc4xx_get_dma_sgl_residue(sgl_handle_t handle, phys_addr_t * src_addr,
209 phys_addr_t * dst_addr)
210{
211 sgl_list_info_t *psgl = (sgl_list_info_t *) handle;
212 ppc_dma_ch_t *p_dma_ch;
213 ppc_sgl_t *pnext, *sgl_addr;
214 uint32_t count_left;
215
216 if (!handle) {
217 printk("ppc4xx_get_dma_sgl_residue: null handle\n");
218 return DMA_STATUS_BAD_HANDLE;
219 } else if (psgl->dmanr > (MAX_PPC4xx_DMA_CHANNELS - 1)) {
220 printk("ppc4xx_get_dma_sgl_residue: bad channel in handle %d\n",
221 psgl->dmanr);
222 return DMA_STATUS_BAD_CHANNEL;
223 }
224
225 sgl_addr = (ppc_sgl_t *) __va(mfdcr(DCRN_ASG0 + (psgl->dmanr * 0x8)));
226 count_left = mfdcr(DCRN_DMACT0 + (psgl->dmanr * 0x8)) & SG_COUNT_MASK;
227
228 if (!sgl_addr) {
229 printk("ppc4xx_get_dma_sgl_residue: sgl addr register is null\n");
230 goto error;
231 }
232
233 pnext = psgl->phead;
234 while (pnext &&
235 ((unsigned) pnext < ((unsigned) psgl + SGL_LIST_SIZE) &&
236 (pnext != sgl_addr))
237 ) {
238 pnext++;
239 }
240
241 if (pnext == sgl_addr) { /* found the sgl descriptor */
242
243 *src_addr = pnext->src_addr;
244 *dst_addr = pnext->dst_addr;
245
246 /*
247 * Now search the remaining descriptors and add their count.
248 * We already have the remaining count from this descriptor in
249 * count_left.
250 */
251 pnext++;
252
253 while ((pnext != psgl->ptail) &&
254 ((unsigned) pnext < ((unsigned) psgl + SGL_LIST_SIZE))
255 ) {
256 count_left += pnext->control_count & SG_COUNT_MASK;
257 }
258
259 if (pnext != psgl->ptail) { /* should never happen */
260 printk
261 ("ppc4xx_get_dma_sgl_residue error (1) psgl->ptail 0x%x handle 0x%x\n",
262 (unsigned int) psgl->ptail, (unsigned int) handle);
263 goto error;
264 }
265
266 /* success */
267 p_dma_ch = &dma_channels[psgl->dmanr];
268 return (count_left << p_dma_ch->shift); /* count in bytes */
269
270 } else {
271 /* this shouldn't happen */
272 printk
273 ("get_dma_sgl_residue, unable to match current address 0x%x, handle 0x%x\n",
274 (unsigned int) sgl_addr, (unsigned int) handle);
275
276 }
277
278 error:
279 *src_addr = (phys_addr_t) NULL;
280 *dst_addr = (phys_addr_t) NULL;
281 return 0;
282}
283
284/*
285 * Returns the address(es) of the buffer(s) contained in the head element of
286 * the scatter/gather list. The element is removed from the scatter/gather
287 * list and the next element becomes the head.
288 *
289 * This function should only be called when the DMA is not active.
290 */
291int
292ppc4xx_delete_dma_sgl_element(sgl_handle_t handle, phys_addr_t * src_dma_addr,
293 phys_addr_t * dst_dma_addr)
294{
295 sgl_list_info_t *psgl = (sgl_list_info_t *) handle;
296
297 if (!handle) {
298 printk("ppc4xx_delete_sgl_element: null handle\n");
299 return DMA_STATUS_BAD_HANDLE;
300 } else if (psgl->dmanr > (MAX_PPC4xx_DMA_CHANNELS - 1)) {
301 printk("ppc4xx_delete_sgl_element: bad channel in handle %d\n",
302 psgl->dmanr);
303 return DMA_STATUS_BAD_CHANNEL;
304 }
305
306 if (!psgl->phead) {
307 printk("ppc4xx_delete_sgl_element: sgl list empty\n");
308 *src_dma_addr = (phys_addr_t) NULL;
309 *dst_dma_addr = (phys_addr_t) NULL;
310 return DMA_STATUS_SGL_LIST_EMPTY;
311 }
312
313 *src_dma_addr = (phys_addr_t) psgl->phead->src_addr;
314 *dst_dma_addr = (phys_addr_t) psgl->phead->dst_addr;
315
316 if (psgl->phead == psgl->ptail) {
317 /* last descriptor on the list */
318 psgl->phead = NULL;
319 psgl->ptail = NULL;
320 } else {
321 psgl->phead++;
322 psgl->phead_dma += sizeof(ppc_sgl_t);
323 }
324
325 return DMA_STATUS_GOOD;
326}
327
328
329/*
330 * Create a scatter/gather list handle. This is simply a structure which
331 * describes a scatter/gather list.
332 *
333 * A handle is returned in "handle" which the driver should save in order to
334 * be able to access this list later. A chunk of memory will be allocated
335 * to be used by the API for internal management purposes, including managing
336 * the sg list and allocating memory for the sgl descriptors. One page should
337 * be more than enough for that purpose. Perhaps it's a bit wasteful to use
338 * a whole page for a single sg list, but most likely there will be only one
339 * sg list per channel.
340 *
341 * Interrupt notes:
342 * Each sgl descriptor has a copy of the DMA control word which the DMA engine
343 * loads in the control register. The control word has a "global" interrupt
344 * enable bit for that channel. Interrupts are further qualified by a few bits
345 * in the sgl descriptor count register. In order to setup an sgl, we have to
346 * know ahead of time whether or not interrupts will be enabled at the completion
347 * of the transfers. Thus, enable_dma_interrupt()/disable_dma_interrupt() MUST
348 * be called before calling alloc_dma_handle(). If the interrupt mode will never
349 * change after powerup, then enable_dma_interrupt()/disable_dma_interrupt()
350 * do not have to be called -- interrupts will be enabled or disabled based
351 * on how the channel was configured after powerup by the hw_init_dma_channel()
352 * function. Each sgl descriptor will be setup to interrupt if an error occurs;
353 * however, only the last descriptor will be setup to interrupt. Thus, an
354 * interrupt will occur (if interrupts are enabled) only after the complete
355 * sgl transfer is done.
356 */
357int
358ppc4xx_alloc_dma_handle(sgl_handle_t * phandle, unsigned int mode, unsigned int dmanr)
359{
360 sgl_list_info_t *psgl=NULL;
361 dma_addr_t dma_addr;
362 ppc_dma_ch_t *p_dma_ch = &dma_channels[dmanr];
363 uint32_t sg_command;
364 uint32_t ctc_settings;
365 void *ret;
366
367 if (dmanr >= MAX_PPC4xx_DMA_CHANNELS) {
368 printk("ppc4xx_alloc_dma_handle: invalid channel 0x%x\n", dmanr);
369 return DMA_STATUS_BAD_CHANNEL;
370 }
371
372 if (!phandle) {
373 printk("ppc4xx_alloc_dma_handle: null handle pointer\n");
374 return DMA_STATUS_NULL_POINTER;
375 }
376
377 /* Get a page of memory, which is zeroed out by consistent_alloc() */
378 ret = dma_alloc_coherent(NULL, DMA_PPC4xx_SIZE, &dma_addr, GFP_KERNEL);
379 if (ret != NULL) {
380 memset(ret, 0, DMA_PPC4xx_SIZE);
381 psgl = (sgl_list_info_t *) ret;
382 }
383
384 if (psgl == NULL) {
385 *phandle = (sgl_handle_t) NULL;
386 return DMA_STATUS_OUT_OF_MEMORY;
387 }
388
389 psgl->dma_addr = dma_addr;
390 psgl->dmanr = dmanr;
391
392 /*
393 * Modify and save the control word. These words will be
394 * written to each sgl descriptor. The DMA engine then
395 * loads this control word into the control register
396 * every time it reads a new descriptor.
397 */
398 psgl->control = p_dma_ch->control;
399 /* Clear all mode bits */
400 psgl->control &= ~(DMA_TM_MASK | DMA_TD);
401 /* Save control word and mode */
402 psgl->control |= (mode | DMA_CE_ENABLE);
403
404 /* In MM mode, we must set ETD/TCE */
405 if (mode == DMA_MODE_MM)
406 psgl->control |= DMA_ETD_OUTPUT | DMA_TCE_ENABLE;
407
408 if (p_dma_ch->int_enable) {
409 /* Enable channel interrupt */
410 psgl->control |= DMA_CIE_ENABLE;
411 } else {
412 psgl->control &= ~DMA_CIE_ENABLE;
413 }
414
415 sg_command = mfdcr(DCRN_ASGC);
416 sg_command |= SSG_MASK_ENABLE(dmanr);
417
418 /* Enable SGL control access */
419 mtdcr(DCRN_ASGC, sg_command);
420 psgl->sgl_control = SG_ERI_ENABLE | SG_LINK;
421
422 /* keep control count register settings */
423 ctc_settings = mfdcr(DCRN_DMACT0 + (dmanr * 0x8))
424 & (DMA_CTC_BSIZ_MSK | DMA_CTC_BTEN); /*burst mode settings*/
425 psgl->sgl_control |= ctc_settings;
426
427 if (p_dma_ch->int_enable) {
428 if (p_dma_ch->tce_enable)
429 psgl->sgl_control |= SG_TCI_ENABLE;
430 else
431 psgl->sgl_control |= SG_ETI_ENABLE;
432 }
433
434 *phandle = (sgl_handle_t) psgl;
435 return DMA_STATUS_GOOD;
436}
437
438/*
439 * Destroy a scatter/gather list handle that was created by alloc_dma_handle().
440 * The list must be empty (contain no elements).
441 */
442void
443ppc4xx_free_dma_handle(sgl_handle_t handle)
444{
445 sgl_list_info_t *psgl = (sgl_list_info_t *) handle;
446
447 if (!handle) {
448 printk("ppc4xx_free_dma_handle: got NULL\n");
449 return;
450 } else if (psgl->phead) {
451 printk("ppc4xx_free_dma_handle: list not empty\n");
452 return;
453 } else if (!psgl->dma_addr) { /* should never happen */
454 printk("ppc4xx_free_dma_handle: no dma address\n");
455 return;
456 }
457
458 dma_free_coherent(NULL, DMA_PPC4xx_SIZE, (void *) psgl, 0);
459}
460
461EXPORT_SYMBOL(ppc4xx_alloc_dma_handle);
462EXPORT_SYMBOL(ppc4xx_free_dma_handle);
463EXPORT_SYMBOL(ppc4xx_add_dma_sgl);
464EXPORT_SYMBOL(ppc4xx_delete_dma_sgl_element);
465EXPORT_SYMBOL(ppc4xx_enable_dma_sgl);
466EXPORT_SYMBOL(ppc4xx_disable_dma_sgl);
467EXPORT_SYMBOL(ppc4xx_get_dma_sgl_residue);
diff --git a/arch/ppc/syslib/ppc83xx_setup.c b/arch/ppc/syslib/ppc83xx_setup.c
new file mode 100644
index 000000000000..c28f9d679484
--- /dev/null
+++ b/arch/ppc/syslib/ppc83xx_setup.c
@@ -0,0 +1,138 @@
1/*
2 * arch/ppc/syslib/ppc83xx_setup.c
3 *
4 * MPC83XX common board code
5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com>
7 *
8 * Copyright 2005 Freescale Semiconductor Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15
16#include <linux/config.h>
17#include <linux/types.h>
18#include <linux/module.h>
19#include <linux/init.h>
20#include <linux/pci.h>
21#include <linux/serial.h>
22#include <linux/tty.h> /* for linux/serial_core.h */
23#include <linux/serial_core.h>
24#include <linux/serial_8250.h>
25
26#include <asm/prom.h>
27#include <asm/time.h>
28#include <asm/mpc83xx.h>
29#include <asm/mmu.h>
30#include <asm/ppc_sys.h>
31#include <asm/kgdb.h>
32
33#include <syslib/ppc83xx_setup.h>
34
35phys_addr_t immrbar;
36
37/* Return the amount of memory */
38unsigned long __init
39mpc83xx_find_end_of_memory(void)
40{
41 bd_t *binfo;
42
43 binfo = (bd_t *) __res;
44
45 return binfo->bi_memsize;
46}
47
48long __init
49mpc83xx_time_init(void)
50{
51#define SPCR_OFFS 0x00000110
52#define SPCR_TBEN 0x00400000
53
54 bd_t *binfo = (bd_t *)__res;
55 u32 *spcr = ioremap(binfo->bi_immr_base + SPCR_OFFS, 4);
56
57 *spcr |= SPCR_TBEN;
58
59 iounmap(spcr);
60
61 return 0;
62}
63
64/* The decrementer counts at the system (internal) clock freq divided by 4 */
65void __init
66mpc83xx_calibrate_decr(void)
67{
68 bd_t *binfo = (bd_t *) __res;
69 unsigned int freq, divisor;
70
71 freq = binfo->bi_busfreq;
72 divisor = 4;
73 tb_ticks_per_jiffy = freq / HZ / divisor;
74 tb_to_us = mulhwu_scale_factor(freq / divisor, 1000000);
75}
76
77#ifdef CONFIG_SERIAL_8250
78void __init
79mpc83xx_early_serial_map(void)
80{
81#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
82 struct uart_port serial_req;
83#endif
84 struct plat_serial8250_port *pdata;
85 bd_t *binfo = (bd_t *) __res;
86 pdata = (struct plat_serial8250_port *) ppc_sys_get_pdata(MPC83xx_DUART);
87
88 /* Setup serial port access */
89 pdata[0].uartclk = binfo->bi_busfreq;
90 pdata[0].mapbase += binfo->bi_immr_base;
91 pdata[0].membase = ioremap(pdata[0].mapbase, 0x100);
92
93#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
94 memset(&serial_req, 0, sizeof (serial_req));
95 serial_req.iotype = SERIAL_IO_MEM;
96 serial_req.mapbase = pdata[0].mapbase;
97 serial_req.membase = pdata[0].membase;
98 serial_req.regshift = 0;
99
100 gen550_init(0, &serial_req);
101#endif
102
103 pdata[1].uartclk = binfo->bi_busfreq;
104 pdata[1].mapbase += binfo->bi_immr_base;
105 pdata[1].membase = ioremap(pdata[1].mapbase, 0x100);
106
107#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
108 /* Assume gen550_init() doesn't modify serial_req */
109 serial_req.mapbase = pdata[1].mapbase;
110 serial_req.membase = pdata[1].membase;
111
112 gen550_init(1, &serial_req);
113#endif
114}
115#endif
116
117void
118mpc83xx_restart(char *cmd)
119{
120 local_irq_disable();
121 for(;;);
122}
123
124void
125mpc83xx_power_off(void)
126{
127 local_irq_disable();
128 for(;;);
129}
130
131void
132mpc83xx_halt(void)
133{
134 local_irq_disable();
135 for(;;);
136}
137
138/* PCI SUPPORT DOES NOT EXIT, MODEL after ppc85xx_setup.c */
diff --git a/arch/ppc/syslib/ppc83xx_setup.h b/arch/ppc/syslib/ppc83xx_setup.h
new file mode 100644
index 000000000000..683f179b746c
--- /dev/null
+++ b/arch/ppc/syslib/ppc83xx_setup.h
@@ -0,0 +1,53 @@
1/*
2 * arch/ppc/syslib/ppc83xx_setup.h
3 *
4 * MPC83XX common board definitions
5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com>
7 *
8 * Copyright 2005 Freescale Semiconductor Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 */
16
17#ifndef __PPC_SYSLIB_PPC83XX_SETUP_H
18#define __PPC_SYSLIB_PPC83XX_SETUP_H
19
20#include <linux/config.h>
21#include <linux/init.h>
22#include <asm/ppcboot.h>
23
24extern unsigned long mpc83xx_find_end_of_memory(void) __init;
25extern long mpc83xx_time_init(void) __init;
26extern void mpc83xx_calibrate_decr(void) __init;
27extern void mpc83xx_early_serial_map(void) __init;
28extern void mpc83xx_restart(char *cmd);
29extern void mpc83xx_power_off(void);
30extern void mpc83xx_halt(void);
31extern void mpc83xx_setup_hose(void) __init;
32
33/* PCI config */
34#if 0
35#define PCI1_CFG_ADDR_OFFSET (FIXME)
36#define PCI1_CFG_DATA_OFFSET (FIXME)
37
38#define PCI2_CFG_ADDR_OFFSET (FIXME)
39#define PCI2_CFG_DATA_OFFSET (FIXME)
40#endif
41
42/* Serial Config */
43#ifdef CONFIG_SERIAL_MANY_PORTS
44#define RS_TABLE_SIZE 64
45#else
46#define RS_TABLE_SIZE 2
47#endif
48
49#ifndef BASE_BAUD
50#define BASE_BAUD 115200
51#endif
52
53#endif /* __PPC_SYSLIB_PPC83XX_SETUP_H */
diff --git a/arch/ppc/syslib/ppc85xx_common.c b/arch/ppc/syslib/ppc85xx_common.c
new file mode 100644
index 000000000000..e83f2f8686d3
--- /dev/null
+++ b/arch/ppc/syslib/ppc85xx_common.c
@@ -0,0 +1,33 @@
1/*
2 * arch/ppc/syslib/ppc85xx_common.c
3 *
4 * MPC85xx support routines
5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com>
7 *
8 * Copyright 2004 Freescale Semiconductor Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15
16#include <linux/config.h>
17#include <linux/types.h>
18#include <linux/module.h>
19#include <linux/init.h>
20
21#include <asm/mpc85xx.h>
22#include <asm/mmu.h>
23
24/* ************************************************************************ */
25/* Return the value of CCSRBAR for the current board */
26
27phys_addr_t
28get_ccsrbar(void)
29{
30 return BOARD_CCSRBAR;
31}
32
33EXPORT_SYMBOL(get_ccsrbar);
diff --git a/arch/ppc/syslib/ppc85xx_common.h b/arch/ppc/syslib/ppc85xx_common.h
new file mode 100644
index 000000000000..2c8f304441bf
--- /dev/null
+++ b/arch/ppc/syslib/ppc85xx_common.h
@@ -0,0 +1,25 @@
1/*
2 * arch/ppc/syslib/ppc85xx_common.h
3 *
4 * MPC85xx support routines
5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com>
7 *
8 * Copyright 2004 Freescale Semiconductor Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15
16#ifndef __PPC_SYSLIB_PPC85XX_COMMON_H
17#define __PPC_SYSLIB_PPC85XX_COMMON_H
18
19#include <linux/config.h>
20#include <linux/init.h>
21
22/* Provide access to ccsrbar for any modules, etc */
23phys_addr_t get_ccsrbar(void);
24
25#endif /* __PPC_SYSLIB_PPC85XX_COMMON_H */
diff --git a/arch/ppc/syslib/ppc85xx_setup.c b/arch/ppc/syslib/ppc85xx_setup.c
new file mode 100644
index 000000000000..81f1968c3269
--- /dev/null
+++ b/arch/ppc/syslib/ppc85xx_setup.c
@@ -0,0 +1,354 @@
1/*
2 * arch/ppc/syslib/ppc85xx_setup.c
3 *
4 * MPC85XX common board code
5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com>
7 *
8 * Copyright 2004 Freescale Semiconductor Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15
16#include <linux/config.h>
17#include <linux/types.h>
18#include <linux/module.h>
19#include <linux/init.h>
20#include <linux/pci.h>
21#include <linux/serial.h>
22#include <linux/tty.h> /* for linux/serial_core.h */
23#include <linux/serial_core.h>
24#include <linux/serial_8250.h>
25
26#include <asm/prom.h>
27#include <asm/time.h>
28#include <asm/mpc85xx.h>
29#include <asm/immap_85xx.h>
30#include <asm/mmu.h>
31#include <asm/ppc_sys.h>
32#include <asm/kgdb.h>
33
34#include <syslib/ppc85xx_setup.h>
35
36/* Return the amount of memory */
37unsigned long __init
38mpc85xx_find_end_of_memory(void)
39{
40 bd_t *binfo;
41
42 binfo = (bd_t *) __res;
43
44 return binfo->bi_memsize;
45}
46
47/* The decrementer counts at the system (internal) clock freq divided by 8 */
48void __init
49mpc85xx_calibrate_decr(void)
50{
51 bd_t *binfo = (bd_t *) __res;
52 unsigned int freq, divisor;
53
54 /* get the core frequency */
55 freq = binfo->bi_busfreq;
56
57 /* The timebase is updated every 8 bus clocks, HID0[SEL_TBCLK] = 0 */
58 divisor = 8;
59 tb_ticks_per_jiffy = freq / divisor / HZ;
60 tb_to_us = mulhwu_scale_factor(freq / divisor, 1000000);
61
62 /* Set the time base to zero */
63 mtspr(SPRN_TBWL, 0);
64 mtspr(SPRN_TBWU, 0);
65
66 /* Clear any pending timer interrupts */
67 mtspr(SPRN_TSR, TSR_ENW | TSR_WIS | TSR_DIS | TSR_FIS);
68
69 /* Enable decrementer interrupt */
70 mtspr(SPRN_TCR, TCR_DIE);
71}
72
73#ifdef CONFIG_SERIAL_8250
74void __init
75mpc85xx_early_serial_map(void)
76{
77#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
78 struct uart_port serial_req;
79#endif
80 struct plat_serial8250_port *pdata;
81 bd_t *binfo = (bd_t *) __res;
82 pdata = (struct plat_serial8250_port *) ppc_sys_get_pdata(MPC85xx_DUART);
83
84 /* Setup serial port access */
85 pdata[0].uartclk = binfo->bi_busfreq;
86 pdata[0].mapbase += binfo->bi_immr_base;
87 pdata[0].membase = ioremap(pdata[0].mapbase, MPC85xx_UART0_SIZE);
88
89#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
90 memset(&serial_req, 0, sizeof (serial_req));
91 serial_req.iotype = SERIAL_IO_MEM;
92 serial_req.mapbase = pdata[0].mapbase;
93 serial_req.membase = pdata[0].membase;
94 serial_req.regshift = 0;
95
96 gen550_init(0, &serial_req);
97#endif
98
99 pdata[1].uartclk = binfo->bi_busfreq;
100 pdata[1].mapbase += binfo->bi_immr_base;
101 pdata[1].membase = ioremap(pdata[1].mapbase, MPC85xx_UART0_SIZE);
102
103#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
104 /* Assume gen550_init() doesn't modify serial_req */
105 serial_req.mapbase = pdata[1].mapbase;
106 serial_req.membase = pdata[1].membase;
107
108 gen550_init(1, &serial_req);
109#endif
110}
111#endif
112
113void
114mpc85xx_restart(char *cmd)
115{
116 local_irq_disable();
117 abort();
118}
119
120void
121mpc85xx_power_off(void)
122{
123 local_irq_disable();
124 for(;;);
125}
126
127void
128mpc85xx_halt(void)
129{
130 local_irq_disable();
131 for(;;);
132}
133
134#ifdef CONFIG_PCI
135static void __init
136mpc85xx_setup_pci1(struct pci_controller *hose)
137{
138 volatile struct ccsr_pci *pci;
139 volatile struct ccsr_guts *guts;
140 unsigned short temps;
141 bd_t *binfo = (bd_t *) __res;
142
143 pci = ioremap(binfo->bi_immr_base + MPC85xx_PCI1_OFFSET,
144 MPC85xx_PCI1_SIZE);
145
146 guts = ioremap(binfo->bi_immr_base + MPC85xx_GUTS_OFFSET,
147 MPC85xx_GUTS_SIZE);
148
149 early_read_config_word(hose, 0, 0, PCI_COMMAND, &temps);
150 temps |= PCI_COMMAND_SERR | PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY;
151 early_write_config_word(hose, 0, 0, PCI_COMMAND, temps);
152
153#define PORDEVSR_PCI (0x00800000) /* PCI Mode */
154 if (guts->pordevsr & PORDEVSR_PCI) {
155 early_write_config_byte(hose, 0, 0, PCI_LATENCY_TIMER, 0x80);
156 } else {
157 /* PCI-X init */
158 temps = PCI_X_CMD_MAX_SPLIT | PCI_X_CMD_MAX_READ
159 | PCI_X_CMD_ERO | PCI_X_CMD_DPERR_E;
160 early_write_config_word(hose, 0, 0, PCIX_COMMAND, temps);
161 }
162
163 /* Disable all windows (except powar0 since its ignored) */
164 pci->powar1 = 0;
165 pci->powar2 = 0;
166 pci->powar3 = 0;
167 pci->powar4 = 0;
168 pci->piwar1 = 0;
169 pci->piwar2 = 0;
170 pci->piwar3 = 0;
171
172 /* Setup Phys:PCI 1:1 outbound mem window @ MPC85XX_PCI1_LOWER_MEM */
173 pci->potar1 = (MPC85XX_PCI1_LOWER_MEM >> 12) & 0x000fffff;
174 pci->potear1 = 0x00000000;
175 pci->powbar1 = (MPC85XX_PCI1_LOWER_MEM >> 12) & 0x000fffff;
176 /* Enable, Mem R/W */
177 pci->powar1 = 0x80044000 |
178 (__ilog2(MPC85XX_PCI1_UPPER_MEM - MPC85XX_PCI1_LOWER_MEM + 1) - 1);
179
180 /* Setup outboud IO windows @ MPC85XX_PCI1_IO_BASE */
181 pci->potar2 = 0x00000000;
182 pci->potear2 = 0x00000000;
183 pci->powbar2 = (MPC85XX_PCI1_IO_BASE >> 12) & 0x000fffff;
184 /* Enable, IO R/W */
185 pci->powar2 = 0x80088000 | (__ilog2(MPC85XX_PCI1_IO_SIZE) - 1);
186
187 /* Setup 2G inbound Memory Window @ 0 */
188 pci->pitar1 = 0x00000000;
189 pci->piwbar1 = 0x00000000;
190 pci->piwar1 = 0xa0f5501e; /* Enable, Prefetch, Local
191 Mem, Snoop R/W, 2G */
192}
193
194
195extern int mpc85xx_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin);
196extern int mpc85xx_exclude_device(u_char bus, u_char devfn);
197
198#ifdef CONFIG_85xx_PCI2
199static void __init
200mpc85xx_setup_pci2(struct pci_controller *hose)
201{
202 volatile struct ccsr_pci *pci;
203 unsigned short temps;
204 bd_t *binfo = (bd_t *) __res;
205
206 pci = ioremap(binfo->bi_immr_base + MPC85xx_PCI2_OFFSET,
207 MPC85xx_PCI2_SIZE);
208
209 early_read_config_word(hose, hose->bus_offset, 0, PCI_COMMAND, &temps);
210 temps |= PCI_COMMAND_SERR | PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY;
211 early_write_config_word(hose, hose->bus_offset, 0, PCI_COMMAND, temps);
212 early_write_config_byte(hose, hose->bus_offset, 0, PCI_LATENCY_TIMER, 0x80);
213
214 /* Disable all windows (except powar0 since its ignored) */
215 pci->powar1 = 0;
216 pci->powar2 = 0;
217 pci->powar3 = 0;
218 pci->powar4 = 0;
219 pci->piwar1 = 0;
220 pci->piwar2 = 0;
221 pci->piwar3 = 0;
222
223 /* Setup Phys:PCI 1:1 outbound mem window @ MPC85XX_PCI2_LOWER_MEM */
224 pci->potar1 = (MPC85XX_PCI2_LOWER_MEM >> 12) & 0x000fffff;
225 pci->potear1 = 0x00000000;
226 pci->powbar1 = (MPC85XX_PCI2_LOWER_MEM >> 12) & 0x000fffff;
227 /* Enable, Mem R/W */
228 pci->powar1 = 0x80044000 |
229 (__ilog2(MPC85XX_PCI1_UPPER_MEM - MPC85XX_PCI1_LOWER_MEM + 1) - 1);
230
231 /* Setup outboud IO windows @ MPC85XX_PCI2_IO_BASE */
232 pci->potar2 = 0x00000000;
233 pci->potear2 = 0x00000000;
234 pci->powbar2 = (MPC85XX_PCI2_IO_BASE >> 12) & 0x000fffff;
235 /* Enable, IO R/W */
236 pci->powar2 = 0x80088000 | (__ilog2(MPC85XX_PCI1_IO_SIZE) - 1);
237
238 /* Setup 2G inbound Memory Window @ 0 */
239 pci->pitar1 = 0x00000000;
240 pci->piwbar1 = 0x00000000;
241 pci->piwar1 = 0xa0f5501e; /* Enable, Prefetch, Local
242 Mem, Snoop R/W, 2G */
243}
244#endif /* CONFIG_85xx_PCI2 */
245
246int mpc85xx_pci1_last_busno = 0;
247
248void __init
249mpc85xx_setup_hose(void)
250{
251 struct pci_controller *hose_a;
252#ifdef CONFIG_85xx_PCI2
253 struct pci_controller *hose_b;
254#endif
255 bd_t *binfo = (bd_t *) __res;
256
257 hose_a = pcibios_alloc_controller();
258
259 if (!hose_a)
260 return;
261
262 ppc_md.pci_swizzle = common_swizzle;
263 ppc_md.pci_map_irq = mpc85xx_map_irq;
264
265 hose_a->first_busno = 0;
266 hose_a->bus_offset = 0;
267 hose_a->last_busno = 0xff;
268
269 setup_indirect_pci(hose_a, binfo->bi_immr_base + PCI1_CFG_ADDR_OFFSET,
270 binfo->bi_immr_base + PCI1_CFG_DATA_OFFSET);
271 hose_a->set_cfg_type = 1;
272
273 mpc85xx_setup_pci1(hose_a);
274
275 hose_a->pci_mem_offset = MPC85XX_PCI1_MEM_OFFSET;
276 hose_a->mem_space.start = MPC85XX_PCI1_LOWER_MEM;
277 hose_a->mem_space.end = MPC85XX_PCI1_UPPER_MEM;
278
279 hose_a->io_space.start = MPC85XX_PCI1_LOWER_IO;
280 hose_a->io_space.end = MPC85XX_PCI1_UPPER_IO;
281 hose_a->io_base_phys = MPC85XX_PCI1_IO_BASE;
282#ifdef CONFIG_85xx_PCI2
283 isa_io_base =
284 (unsigned long) ioremap(MPC85XX_PCI1_IO_BASE,
285 MPC85XX_PCI1_IO_SIZE +
286 MPC85XX_PCI2_IO_SIZE);
287#else
288 isa_io_base =
289 (unsigned long) ioremap(MPC85XX_PCI1_IO_BASE,
290 MPC85XX_PCI1_IO_SIZE);
291#endif
292 hose_a->io_base_virt = (void *) isa_io_base;
293
294 /* setup resources */
295 pci_init_resource(&hose_a->mem_resources[0],
296 MPC85XX_PCI1_LOWER_MEM,
297 MPC85XX_PCI1_UPPER_MEM,
298 IORESOURCE_MEM, "PCI1 host bridge");
299
300 pci_init_resource(&hose_a->io_resource,
301 MPC85XX_PCI1_LOWER_IO,
302 MPC85XX_PCI1_UPPER_IO,
303 IORESOURCE_IO, "PCI1 host bridge");
304
305 ppc_md.pci_exclude_device = mpc85xx_exclude_device;
306
307 hose_a->last_busno = pciauto_bus_scan(hose_a, hose_a->first_busno);
308
309#ifdef CONFIG_85xx_PCI2
310 hose_b = pcibios_alloc_controller();
311
312 if (!hose_b)
313 return;
314
315 hose_b->bus_offset = hose_a->last_busno + 1;
316 hose_b->first_busno = hose_a->last_busno + 1;
317 hose_b->last_busno = 0xff;
318
319 setup_indirect_pci(hose_b, binfo->bi_immr_base + PCI2_CFG_ADDR_OFFSET,
320 binfo->bi_immr_base + PCI2_CFG_DATA_OFFSET);
321 hose_b->set_cfg_type = 1;
322
323 mpc85xx_setup_pci2(hose_b);
324
325 hose_b->pci_mem_offset = MPC85XX_PCI2_MEM_OFFSET;
326 hose_b->mem_space.start = MPC85XX_PCI2_LOWER_MEM;
327 hose_b->mem_space.end = MPC85XX_PCI2_UPPER_MEM;
328
329 hose_b->io_space.start = MPC85XX_PCI2_LOWER_IO;
330 hose_b->io_space.end = MPC85XX_PCI2_UPPER_IO;
331 hose_b->io_base_phys = MPC85XX_PCI2_IO_BASE;
332 hose_b->io_base_virt = (void *) isa_io_base + MPC85XX_PCI1_IO_SIZE;
333
334 /* setup resources */
335 pci_init_resource(&hose_b->mem_resources[0],
336 MPC85XX_PCI2_LOWER_MEM,
337 MPC85XX_PCI2_UPPER_MEM,
338 IORESOURCE_MEM, "PCI2 host bridge");
339
340 pci_init_resource(&hose_b->io_resource,
341 MPC85XX_PCI2_LOWER_IO,
342 MPC85XX_PCI2_UPPER_IO,
343 IORESOURCE_IO, "PCI2 host bridge");
344
345 hose_b->last_busno = pciauto_bus_scan(hose_b, hose_b->first_busno);
346
347 /* let board code know what the last bus number was on PCI1 */
348 mpc85xx_pci1_last_busno = hose_a->last_busno;
349#endif
350 return;
351}
352#endif /* CONFIG_PCI */
353
354
diff --git a/arch/ppc/syslib/ppc85xx_setup.h b/arch/ppc/syslib/ppc85xx_setup.h
new file mode 100644
index 000000000000..6e6cfe162faf
--- /dev/null
+++ b/arch/ppc/syslib/ppc85xx_setup.h
@@ -0,0 +1,59 @@
1/*
2 * arch/ppc/syslib/ppc85xx_setup.h
3 *
4 * MPC85XX common board definitions
5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com>
7 *
8 * Copyright 2004 Freescale Semiconductor Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 */
16
17#ifndef __PPC_SYSLIB_PPC85XX_SETUP_H
18#define __PPC_SYSLIB_PPC85XX_SETUP_H
19
20#include <linux/config.h>
21#include <linux/init.h>
22#include <asm/ppcboot.h>
23
24extern unsigned long mpc85xx_find_end_of_memory(void) __init;
25extern void mpc85xx_calibrate_decr(void) __init;
26extern void mpc85xx_early_serial_map(void) __init;
27extern void mpc85xx_restart(char *cmd);
28extern void mpc85xx_power_off(void);
29extern void mpc85xx_halt(void);
30extern void mpc85xx_setup_hose(void) __init;
31
32/* PCI config */
33#define PCI1_CFG_ADDR_OFFSET (0x8000)
34#define PCI1_CFG_DATA_OFFSET (0x8004)
35
36#define PCI2_CFG_ADDR_OFFSET (0x9000)
37#define PCI2_CFG_DATA_OFFSET (0x9004)
38
39/* Additional register for PCI-X configuration */
40#define PCIX_NEXT_CAP 0x60
41#define PCIX_CAP_ID 0x61
42#define PCIX_COMMAND 0x62
43#define PCIX_STATUS 0x64
44
45/* Serial Config */
46#ifdef CONFIG_SERIAL_MANY_PORTS
47#define RS_TABLE_SIZE 64
48#else
49#define RS_TABLE_SIZE 2
50#endif
51
52#ifndef BASE_BAUD
53#define BASE_BAUD 115200
54#endif
55
56/* Offset of CPM register space */
57#define CPM_MAP_ADDR (CCSRBAR + MPC85xx_CPM_OFFSET)
58
59#endif /* __PPC_SYSLIB_PPC85XX_SETUP_H */
diff --git a/arch/ppc/syslib/ppc8xx_pic.c b/arch/ppc/syslib/ppc8xx_pic.c
new file mode 100644
index 000000000000..d3b01c6c97de
--- /dev/null
+++ b/arch/ppc/syslib/ppc8xx_pic.c
@@ -0,0 +1,130 @@
1#include <linux/config.h>
2#include <linux/module.h>
3#include <linux/stddef.h>
4#include <linux/init.h>
5#include <linux/sched.h>
6#include <linux/signal.h>
7#include <linux/interrupt.h>
8#include <asm/irq.h>
9#include <asm/8xx_immap.h>
10#include <asm/mpc8xx.h>
11#include "ppc8xx_pic.h"
12
13extern int cpm_get_irq(struct pt_regs *regs);
14
15/* The 8xx internal interrupt controller. It is usually
16 * the only interrupt controller. Some boards, like the MBX and
17 * Sandpoint have the 8259 as a secondary controller. Depending
18 * upon the processor type, the internal controller can have as
19 * few as 16 interrups or as many as 64. We could use the
20 * "clear_bit()" and "set_bit()" functions like other platforms,
21 * but they are overkill for us.
22 */
23
24static void m8xx_mask_irq(unsigned int irq_nr)
25{
26 int bit, word;
27
28 bit = irq_nr & 0x1f;
29 word = irq_nr >> 5;
30
31 ppc_cached_irq_mask[word] &= ~(1 << (31-bit));
32 ((immap_t *)IMAP_ADDR)->im_siu_conf.sc_simask =
33 ppc_cached_irq_mask[word];
34}
35
36static void m8xx_unmask_irq(unsigned int irq_nr)
37{
38 int bit, word;
39
40 bit = irq_nr & 0x1f;
41 word = irq_nr >> 5;
42
43 ppc_cached_irq_mask[word] |= (1 << (31-bit));
44 ((immap_t *)IMAP_ADDR)->im_siu_conf.sc_simask =
45 ppc_cached_irq_mask[word];
46}
47
48static void m8xx_end_irq(unsigned int irq_nr)
49{
50 if (!(irq_desc[irq_nr].status & (IRQ_DISABLED|IRQ_INPROGRESS))
51 && irq_desc[irq_nr].action) {
52 int bit, word;
53
54 bit = irq_nr & 0x1f;
55 word = irq_nr >> 5;
56
57 ppc_cached_irq_mask[word] |= (1 << (31-bit));
58 ((immap_t *)IMAP_ADDR)->im_siu_conf.sc_simask =
59 ppc_cached_irq_mask[word];
60 }
61}
62
63
64static void m8xx_mask_and_ack(unsigned int irq_nr)
65{
66 int bit, word;
67
68 bit = irq_nr & 0x1f;
69 word = irq_nr >> 5;
70
71 ppc_cached_irq_mask[word] &= ~(1 << (31-bit));
72 ((immap_t *)IMAP_ADDR)->im_siu_conf.sc_simask =
73 ppc_cached_irq_mask[word];
74 ((immap_t *)IMAP_ADDR)->im_siu_conf.sc_sipend = 1 << (31-bit);
75}
76
77struct hw_interrupt_type ppc8xx_pic = {
78 .typename = " 8xx SIU ",
79 .enable = m8xx_unmask_irq,
80 .disable = m8xx_mask_irq,
81 .ack = m8xx_mask_and_ack,
82 .end = m8xx_end_irq,
83};
84
85/*
86 * We either return a valid interrupt or -1 if there is nothing pending
87 */
88int
89m8xx_get_irq(struct pt_regs *regs)
90{
91 int irq;
92
93 /* For MPC8xx, read the SIVEC register and shift the bits down
94 * to get the irq number.
95 */
96 irq = ((immap_t *)IMAP_ADDR)->im_siu_conf.sc_sivec >> 26;
97
98 /*
99 * When we read the sivec without an interrupt to process, we will
100 * get back SIU_LEVEL7. In this case, return -1
101 */
102 if (irq == CPM_INTERRUPT)
103 irq = CPM_IRQ_OFFSET + cpm_get_irq(regs);
104#if defined(CONFIG_PCI)
105 else if (irq == ISA_BRIDGE_INT) {
106 int isa_irq;
107
108 if ((isa_irq = i8259_poll(regs)) >= 0)
109 irq = I8259_IRQ_OFFSET + isa_irq;
110 }
111#endif /* CONFIG_PCI */
112 else if (irq == SIU_LEVEL7)
113 irq = -1;
114
115 return irq;
116}
117
118#if defined(CONFIG_MBX) && defined(CONFIG_PCI)
119/* Only the MBX uses the external 8259. This allows us to catch standard
120 * drivers that may mess up the internal interrupt controllers, and also
121 * allow them to run without modification on the MBX.
122 */
123void mbx_i8259_action(int irq, void *dev_id, struct pt_regs *regs)
124{
125 /* This interrupt handler never actually gets called. It is
126 * installed only to unmask the 8259 cascade interrupt in the SIU
127 * and to make the 8259 cascade interrupt visible in /proc/interrupts.
128 */
129}
130#endif /* CONFIG_PCI */
diff --git a/arch/ppc/syslib/ppc8xx_pic.h b/arch/ppc/syslib/ppc8xx_pic.h
new file mode 100644
index 000000000000..784935eac365
--- /dev/null
+++ b/arch/ppc/syslib/ppc8xx_pic.h
@@ -0,0 +1,21 @@
1#ifndef _PPC_KERNEL_PPC8xx_H
2#define _PPC_KERNEL_PPC8xx_H
3
4#include <linux/config.h>
5#include <linux/irq.h>
6#include <linux/interrupt.h>
7
8extern struct hw_interrupt_type ppc8xx_pic;
9
10void m8xx_pic_init(void);
11void m8xx_do_IRQ(struct pt_regs *regs,
12 int cpu);
13int m8xx_get_irq(struct pt_regs *regs);
14
15#ifdef CONFIG_MBX
16#include <asm/i8259.h>
17#include <asm/io.h>
18void mbx_i8259_action(int cpl, void *dev_id, struct pt_regs *regs);
19#endif
20
21#endif /* _PPC_KERNEL_PPC8xx_H */
diff --git a/arch/ppc/syslib/ppc_sys.c b/arch/ppc/syslib/ppc_sys.c
new file mode 100644
index 000000000000..879202352560
--- /dev/null
+++ b/arch/ppc/syslib/ppc_sys.c
@@ -0,0 +1,103 @@
1/*
2 * arch/ppc/syslib/ppc_sys.c
3 *
4 * PPC System library functions
5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com>
7 *
8 * Copyright 2005 Freescale Semiconductor Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15
16#include <asm/ppc_sys.h>
17
18int (*ppc_sys_device_fixup) (struct platform_device * pdev);
19
20static int ppc_sys_inited;
21
22void __init identify_ppc_sys_by_id(u32 id)
23{
24 unsigned int i = 0;
25 while (1) {
26 if ((ppc_sys_specs[i].mask & id) == ppc_sys_specs[i].value)
27 break;
28 i++;
29 }
30
31 cur_ppc_sys_spec = &ppc_sys_specs[i];
32
33 return;
34}
35
36void __init identify_ppc_sys_by_name(char *name)
37{
38 /* TODO */
39 return;
40}
41
42/* Update all memory resources by paddr, call before platform_device_register */
43void __init
44ppc_sys_fixup_mem_resource(struct platform_device *pdev, phys_addr_t paddr)
45{
46 int i;
47 for (i = 0; i < pdev->num_resources; i++) {
48 struct resource *r = &pdev->resource[i];
49 if ((r->flags & IORESOURCE_MEM) == IORESOURCE_MEM) {
50 r->start += paddr;
51 r->end += paddr;
52 }
53 }
54}
55
56/* Get platform_data pointer out of platform device, call before platform_device_register */
57void *__init ppc_sys_get_pdata(enum ppc_sys_devices dev)
58{
59 return ppc_sys_platform_devices[dev].dev.platform_data;
60}
61
62void ppc_sys_device_remove(enum ppc_sys_devices dev)
63{
64 unsigned int i;
65
66 if (ppc_sys_inited) {
67 platform_device_unregister(&ppc_sys_platform_devices[dev]);
68 } else {
69 if (cur_ppc_sys_spec == NULL)
70 return;
71 for (i = 0; i < cur_ppc_sys_spec->num_devices; i++)
72 if (cur_ppc_sys_spec->device_list[i] == dev)
73 cur_ppc_sys_spec->device_list[i] = -1;
74 }
75}
76
77static int __init ppc_sys_init(void)
78{
79 unsigned int i, dev_id, ret = 0;
80
81 BUG_ON(cur_ppc_sys_spec == NULL);
82
83 for (i = 0; i < cur_ppc_sys_spec->num_devices; i++) {
84 dev_id = cur_ppc_sys_spec->device_list[i];
85 if (dev_id != -1) {
86 if (ppc_sys_device_fixup != NULL)
87 ppc_sys_device_fixup(&ppc_sys_platform_devices
88 [dev_id]);
89 if (platform_device_register
90 (&ppc_sys_platform_devices[dev_id])) {
91 ret = 1;
92 printk(KERN_ERR
93 "unable to register device %d\n",
94 dev_id);
95 }
96 }
97 }
98
99 ppc_sys_inited = 1;
100 return ret;
101}
102
103subsys_initcall(ppc_sys_init);
diff --git a/arch/ppc/syslib/prep_nvram.c b/arch/ppc/syslib/prep_nvram.c
new file mode 100644
index 000000000000..2bcf8a16d1c9
--- /dev/null
+++ b/arch/ppc/syslib/prep_nvram.c
@@ -0,0 +1,141 @@
1/*
2 * arch/ppc/kernel/prep_nvram.c
3 *
4 * Copyright (C) 1998 Corey Minyard
5 *
6 * This reads the NvRAM on PReP compliant machines (generally from IBM or
7 * Motorola). Motorola kept the format of NvRAM in their ROM, PPCBUG, the
8 * same, long after they had stopped producing PReP compliant machines. So
9 * this code is useful in those cases as well.
10 *
11 */
12#include <linux/init.h>
13#include <linux/delay.h>
14#include <linux/slab.h>
15#include <linux/ioport.h>
16
17#include <asm/sections.h>
18#include <asm/segment.h>
19#include <asm/io.h>
20#include <asm/machdep.h>
21#include <asm/prep_nvram.h>
22
23static char nvramData[MAX_PREP_NVRAM];
24static NVRAM_MAP *nvram=(NVRAM_MAP *)&nvramData[0];
25
26unsigned char __prep prep_nvram_read_val(int addr)
27{
28 outb(addr, PREP_NVRAM_AS0);
29 outb(addr>>8, PREP_NVRAM_AS1);
30 return inb(PREP_NVRAM_DATA);
31}
32
33void __prep prep_nvram_write_val(int addr,
34 unsigned char val)
35{
36 outb(addr, PREP_NVRAM_AS0);
37 outb(addr>>8, PREP_NVRAM_AS1);
38 outb(val, PREP_NVRAM_DATA);
39}
40
41void __init init_prep_nvram(void)
42{
43 unsigned char *nvp;
44 int i;
45 int nvramSize;
46
47 /*
48 * The following could fail if the NvRAM were corrupt but
49 * we expect the boot firmware to have checked its checksum
50 * before boot
51 */
52 nvp = (char *) &nvram->Header;
53 for (i=0; i<sizeof(HEADER); i++)
54 {
55 *nvp = ppc_md.nvram_read_val(i);
56 nvp++;
57 }
58
59 /*
60 * The PReP NvRAM may be any size so read in the header to
61 * determine how much we must read in order to get the complete
62 * GE area
63 */
64 nvramSize=(int)nvram->Header.GEAddress+nvram->Header.GELength;
65 if(nvramSize>MAX_PREP_NVRAM)
66 {
67 /*
68 * NvRAM is too large
69 */
70 nvram->Header.GELength=0;
71 return;
72 }
73
74 /*
75 * Read the remainder of the PReP NvRAM
76 */
77 nvp = (char *) &nvram->GEArea[0];
78 for (i=sizeof(HEADER); i<nvramSize; i++)
79 {
80 *nvp = ppc_md.nvram_read_val(i);
81 nvp++;
82 }
83}
84
85__prep
86char __prep *prep_nvram_get_var(const char *name)
87{
88 char *cp;
89 int namelen;
90
91 namelen = strlen(name);
92 cp = prep_nvram_first_var();
93 while (cp != NULL) {
94 if ((strncmp(name, cp, namelen) == 0)
95 && (cp[namelen] == '='))
96 {
97 return cp+namelen+1;
98 }
99 cp = prep_nvram_next_var(cp);
100 }
101
102 return NULL;
103}
104
105__prep
106char __prep *prep_nvram_first_var(void)
107{
108 if (nvram->Header.GELength == 0) {
109 return NULL;
110 } else {
111 return (((char *)nvram)
112 + ((unsigned int) nvram->Header.GEAddress));
113 }
114}
115
116__prep
117char __prep *prep_nvram_next_var(char *name)
118{
119 char *cp;
120
121
122 cp = name;
123 while (((cp - ((char *) nvram->GEArea)) < nvram->Header.GELength)
124 && (*cp != '\0'))
125 {
126 cp++;
127 }
128
129 /* Skip over any null characters. */
130 while (((cp - ((char *) nvram->GEArea)) < nvram->Header.GELength)
131 && (*cp == '\0'))
132 {
133 cp++;
134 }
135
136 if ((cp - ((char *) nvram->GEArea)) < nvram->Header.GELength) {
137 return cp;
138 } else {
139 return NULL;
140 }
141}
diff --git a/arch/ppc/syslib/prom.c b/arch/ppc/syslib/prom.c
new file mode 100644
index 000000000000..2c64ed627475
--- /dev/null
+++ b/arch/ppc/syslib/prom.c
@@ -0,0 +1,1447 @@
1/*
2 * Procedures for interfacing to the Open Firmware PROM on
3 * Power Macintosh computers.
4 *
5 * In particular, we are interested in the device tree
6 * and in using some of its services (exit, write to stdout).
7 *
8 * Paul Mackerras August 1996.
9 * Copyright (C) 1996 Paul Mackerras.
10 */
11#include <stdarg.h>
12#include <linux/config.h>
13#include <linux/kernel.h>
14#include <linux/string.h>
15#include <linux/init.h>
16#include <linux/version.h>
17#include <linux/threads.h>
18#include <linux/spinlock.h>
19#include <linux/ioport.h>
20#include <linux/pci.h>
21#include <linux/slab.h>
22#include <linux/bitops.h>
23
24#include <asm/sections.h>
25#include <asm/prom.h>
26#include <asm/page.h>
27#include <asm/processor.h>
28#include <asm/irq.h>
29#include <asm/io.h>
30#include <asm/smp.h>
31#include <asm/bootx.h>
32#include <asm/system.h>
33#include <asm/mmu.h>
34#include <asm/pgtable.h>
35#include <asm/bootinfo.h>
36#include <asm/btext.h>
37#include <asm/pci-bridge.h>
38#include <asm/open_pic.h>
39
40
41struct pci_address {
42 unsigned a_hi;
43 unsigned a_mid;
44 unsigned a_lo;
45};
46
47struct pci_reg_property {
48 struct pci_address addr;
49 unsigned size_hi;
50 unsigned size_lo;
51};
52
53struct isa_reg_property {
54 unsigned space;
55 unsigned address;
56 unsigned size;
57};
58
59typedef unsigned long interpret_func(struct device_node *, unsigned long,
60 int, int);
61static interpret_func interpret_pci_props;
62static interpret_func interpret_dbdma_props;
63static interpret_func interpret_isa_props;
64static interpret_func interpret_macio_props;
65static interpret_func interpret_root_props;
66
67extern char *klimit;
68
69/* Set for a newworld or CHRP machine */
70int use_of_interrupt_tree;
71struct device_node *dflt_interrupt_controller;
72int num_interrupt_controllers;
73
74int pmac_newworld;
75
76extern unsigned int rtas_entry; /* physical pointer */
77
78extern struct device_node *allnodes;
79
80static unsigned long finish_node(struct device_node *, unsigned long,
81 interpret_func *, int, int);
82static unsigned long finish_node_interrupts(struct device_node *, unsigned long);
83static struct device_node *find_phandle(phandle);
84
85extern void enter_rtas(void *);
86void phys_call_rtas(int, int, int, ...);
87
88extern char cmd_line[512]; /* XXX */
89extern boot_infos_t *boot_infos;
90unsigned long dev_tree_size;
91
92void __openfirmware
93phys_call_rtas(int service, int nargs, int nret, ...)
94{
95 va_list list;
96 union {
97 unsigned long words[16];
98 double align;
99 } u;
100 void (*rtas)(void *, unsigned long);
101 int i;
102
103 u.words[0] = service;
104 u.words[1] = nargs;
105 u.words[2] = nret;
106 va_start(list, nret);
107 for (i = 0; i < nargs; ++i)
108 u.words[i+3] = va_arg(list, unsigned long);
109 va_end(list);
110
111 rtas = (void (*)(void *, unsigned long)) rtas_entry;
112 rtas(&u, rtas_data);
113}
114
115/*
116 * finish_device_tree is called once things are running normally
117 * (i.e. with text and data mapped to the address they were linked at).
118 * It traverses the device tree and fills in the name, type,
119 * {n_}addrs and {n_}intrs fields of each node.
120 */
121void __init
122finish_device_tree(void)
123{
124 unsigned long mem = (unsigned long) klimit;
125 struct device_node *np;
126
127 /* All newworld pmac machines and CHRPs now use the interrupt tree */
128 for (np = allnodes; np != NULL; np = np->allnext) {
129 if (get_property(np, "interrupt-parent", NULL)) {
130 use_of_interrupt_tree = 1;
131 break;
132 }
133 }
134 if (_machine == _MACH_Pmac && use_of_interrupt_tree)
135 pmac_newworld = 1;
136
137#ifdef CONFIG_BOOTX_TEXT
138 if (boot_infos && pmac_newworld) {
139 prom_print("WARNING ! BootX/miBoot booting is not supported on this machine\n");
140 prom_print(" You should use an Open Firmware bootloader\n");
141 }
142#endif /* CONFIG_BOOTX_TEXT */
143
144 if (use_of_interrupt_tree) {
145 /*
146 * We want to find out here how many interrupt-controller
147 * nodes there are, and if we are booted from BootX,
148 * we need a pointer to the first (and hopefully only)
149 * such node. But we can't use find_devices here since
150 * np->name has not been set yet. -- paulus
151 */
152 int n = 0;
153 char *name, *ic;
154 int iclen;
155
156 for (np = allnodes; np != NULL; np = np->allnext) {
157 ic = get_property(np, "interrupt-controller", &iclen);
158 name = get_property(np, "name", NULL);
159 /* checking iclen makes sure we don't get a false
160 match on /chosen.interrupt_controller */
161 if ((name != NULL
162 && strcmp(name, "interrupt-controller") == 0)
163 || (ic != NULL && iclen == 0 && strcmp(name, "AppleKiwi"))) {
164 if (n == 0)
165 dflt_interrupt_controller = np;
166 ++n;
167 }
168 }
169 num_interrupt_controllers = n;
170 }
171
172 mem = finish_node(allnodes, mem, NULL, 1, 1);
173 dev_tree_size = mem - (unsigned long) allnodes;
174 klimit = (char *) mem;
175}
176
177static unsigned long __init
178finish_node(struct device_node *np, unsigned long mem_start,
179 interpret_func *ifunc, int naddrc, int nsizec)
180{
181 struct device_node *child;
182 int *ip;
183
184 np->name = get_property(np, "name", NULL);
185 np->type = get_property(np, "device_type", NULL);
186
187 if (!np->name)
188 np->name = "<NULL>";
189 if (!np->type)
190 np->type = "<NULL>";
191
192 /* get the device addresses and interrupts */
193 if (ifunc != NULL)
194 mem_start = ifunc(np, mem_start, naddrc, nsizec);
195
196 if (use_of_interrupt_tree)
197 mem_start = finish_node_interrupts(np, mem_start);
198
199 /* Look for #address-cells and #size-cells properties. */
200 ip = (int *) get_property(np, "#address-cells", NULL);
201 if (ip != NULL)
202 naddrc = *ip;
203 ip = (int *) get_property(np, "#size-cells", NULL);
204 if (ip != NULL)
205 nsizec = *ip;
206
207 if (np->parent == NULL)
208 ifunc = interpret_root_props;
209 else if (np->type == 0)
210 ifunc = NULL;
211 else if (!strcmp(np->type, "pci") || !strcmp(np->type, "vci"))
212 ifunc = interpret_pci_props;
213 else if (!strcmp(np->type, "dbdma"))
214 ifunc = interpret_dbdma_props;
215 else if (!strcmp(np->type, "mac-io")
216 || ifunc == interpret_macio_props)
217 ifunc = interpret_macio_props;
218 else if (!strcmp(np->type, "isa"))
219 ifunc = interpret_isa_props;
220 else if (!strcmp(np->name, "uni-n") || !strcmp(np->name, "u3"))
221 ifunc = interpret_root_props;
222 else if (!((ifunc == interpret_dbdma_props
223 || ifunc == interpret_macio_props)
224 && (!strcmp(np->type, "escc")
225 || !strcmp(np->type, "media-bay"))))
226 ifunc = NULL;
227
228 /* if we were booted from BootX, convert the full name */
229 if (boot_infos
230 && strncmp(np->full_name, "Devices:device-tree", 19) == 0) {
231 if (np->full_name[19] == 0) {
232 strcpy(np->full_name, "/");
233 } else if (np->full_name[19] == ':') {
234 char *p = np->full_name + 19;
235 np->full_name = p;
236 for (; *p; ++p)
237 if (*p == ':')
238 *p = '/';
239 }
240 }
241
242 for (child = np->child; child != NULL; child = child->sibling)
243 mem_start = finish_node(child, mem_start, ifunc,
244 naddrc, nsizec);
245
246 return mem_start;
247}
248
249/*
250 * Find the interrupt parent of a node.
251 */
252static struct device_node * __init
253intr_parent(struct device_node *p)
254{
255 phandle *parp;
256
257 parp = (phandle *) get_property(p, "interrupt-parent", NULL);
258 if (parp == NULL)
259 return p->parent;
260 p = find_phandle(*parp);
261 if (p != NULL)
262 return p;
263 /*
264 * On a powermac booted with BootX, we don't get to know the
265 * phandles for any nodes, so find_phandle will return NULL.
266 * Fortunately these machines only have one interrupt controller
267 * so there isn't in fact any ambiguity. -- paulus
268 */
269 if (num_interrupt_controllers == 1)
270 p = dflt_interrupt_controller;
271 return p;
272}
273
274/*
275 * Find out the size of each entry of the interrupts property
276 * for a node.
277 */
278static int __init
279prom_n_intr_cells(struct device_node *np)
280{
281 struct device_node *p;
282 unsigned int *icp;
283
284 for (p = np; (p = intr_parent(p)) != NULL; ) {
285 icp = (unsigned int *)
286 get_property(p, "#interrupt-cells", NULL);
287 if (icp != NULL)
288 return *icp;
289 if (get_property(p, "interrupt-controller", NULL) != NULL
290 || get_property(p, "interrupt-map", NULL) != NULL) {
291 printk("oops, node %s doesn't have #interrupt-cells\n",
292 p->full_name);
293 return 1;
294 }
295 }
296 printk("prom_n_intr_cells failed for %s\n", np->full_name);
297 return 1;
298}
299
300/*
301 * Map an interrupt from a device up to the platform interrupt
302 * descriptor.
303 */
304static int __init
305map_interrupt(unsigned int **irq, struct device_node **ictrler,
306 struct device_node *np, unsigned int *ints, int nintrc)
307{
308 struct device_node *p, *ipar;
309 unsigned int *imap, *imask, *ip;
310 int i, imaplen, match;
311 int newintrc = 1, newaddrc = 1;
312 unsigned int *reg;
313 int naddrc;
314
315 reg = (unsigned int *) get_property(np, "reg", NULL);
316 naddrc = prom_n_addr_cells(np);
317 p = intr_parent(np);
318 while (p != NULL) {
319 if (get_property(p, "interrupt-controller", NULL) != NULL)
320 /* this node is an interrupt controller, stop here */
321 break;
322 imap = (unsigned int *)
323 get_property(p, "interrupt-map", &imaplen);
324 if (imap == NULL) {
325 p = intr_parent(p);
326 continue;
327 }
328 imask = (unsigned int *)
329 get_property(p, "interrupt-map-mask", NULL);
330 if (imask == NULL) {
331 printk("oops, %s has interrupt-map but no mask\n",
332 p->full_name);
333 return 0;
334 }
335 imaplen /= sizeof(unsigned int);
336 match = 0;
337 ipar = NULL;
338 while (imaplen > 0 && !match) {
339 /* check the child-interrupt field */
340 match = 1;
341 for (i = 0; i < naddrc && match; ++i)
342 match = ((reg[i] ^ imap[i]) & imask[i]) == 0;
343 for (; i < naddrc + nintrc && match; ++i)
344 match = ((ints[i-naddrc] ^ imap[i]) & imask[i]) == 0;
345 imap += naddrc + nintrc;
346 imaplen -= naddrc + nintrc;
347 /* grab the interrupt parent */
348 ipar = find_phandle((phandle) *imap++);
349 --imaplen;
350 if (ipar == NULL && num_interrupt_controllers == 1)
351 /* cope with BootX not giving us phandles */
352 ipar = dflt_interrupt_controller;
353 if (ipar == NULL) {
354 printk("oops, no int parent %x in map of %s\n",
355 imap[-1], p->full_name);
356 return 0;
357 }
358 /* find the parent's # addr and intr cells */
359 ip = (unsigned int *)
360 get_property(ipar, "#interrupt-cells", NULL);
361 if (ip == NULL) {
362 printk("oops, no #interrupt-cells on %s\n",
363 ipar->full_name);
364 return 0;
365 }
366 newintrc = *ip;
367 ip = (unsigned int *)
368 get_property(ipar, "#address-cells", NULL);
369 newaddrc = (ip == NULL)? 0: *ip;
370 imap += newaddrc + newintrc;
371 imaplen -= newaddrc + newintrc;
372 }
373 if (imaplen < 0) {
374 printk("oops, error decoding int-map on %s, len=%d\n",
375 p->full_name, imaplen);
376 return 0;
377 }
378 if (!match) {
379 printk("oops, no match in %s int-map for %s\n",
380 p->full_name, np->full_name);
381 return 0;
382 }
383 p = ipar;
384 naddrc = newaddrc;
385 nintrc = newintrc;
386 ints = imap - nintrc;
387 reg = ints - naddrc;
388 }
389 if (p == NULL)
390 printk("hmmm, int tree for %s doesn't have ctrler\n",
391 np->full_name);
392 *irq = ints;
393 *ictrler = p;
394 return nintrc;
395}
396
397/*
398 * New version of finish_node_interrupts.
399 */
400static unsigned long __init
401finish_node_interrupts(struct device_node *np, unsigned long mem_start)
402{
403 unsigned int *ints;
404 int intlen, intrcells;
405 int i, j, n, offset;
406 unsigned int *irq;
407 struct device_node *ic;
408
409 ints = (unsigned int *) get_property(np, "interrupts", &intlen);
410 if (ints == NULL)
411 return mem_start;
412 intrcells = prom_n_intr_cells(np);
413 intlen /= intrcells * sizeof(unsigned int);
414 np->n_intrs = intlen;
415 np->intrs = (struct interrupt_info *) mem_start;
416 mem_start += intlen * sizeof(struct interrupt_info);
417
418 for (i = 0; i < intlen; ++i) {
419 np->intrs[i].line = 0;
420 np->intrs[i].sense = 1;
421 n = map_interrupt(&irq, &ic, np, ints, intrcells);
422 if (n <= 0)
423 continue;
424 offset = 0;
425 /*
426 * On a CHRP we have an 8259 which is subordinate to
427 * the openpic in the interrupt tree, but we want the
428 * openpic's interrupt numbers offsetted, not the 8259's.
429 * So we apply the offset if the controller is at the
430 * root of the interrupt tree, i.e. has no interrupt-parent.
431 * This doesn't cope with the general case of multiple
432 * cascaded interrupt controllers, but then neither will
433 * irq.c at the moment either. -- paulus
434 * The G5 triggers that code, I add a machine test. On
435 * those machines, we want to offset interrupts from the
436 * second openpic by 128 -- BenH
437 */
438 if (_machine != _MACH_Pmac && num_interrupt_controllers > 1
439 && ic != NULL
440 && get_property(ic, "interrupt-parent", NULL) == NULL)
441 offset = 16;
442 else if (_machine == _MACH_Pmac && num_interrupt_controllers > 1
443 && ic != NULL && ic->parent != NULL) {
444 char *name = get_property(ic->parent, "name", NULL);
445 if (name && !strcmp(name, "u3"))
446 offset = 128;
447 }
448
449 np->intrs[i].line = irq[0] + offset;
450 if (n > 1)
451 np->intrs[i].sense = irq[1];
452 if (n > 2) {
453 printk("hmmm, got %d intr cells for %s:", n,
454 np->full_name);
455 for (j = 0; j < n; ++j)
456 printk(" %d", irq[j]);
457 printk("\n");
458 }
459 ints += intrcells;
460 }
461
462 return mem_start;
463}
464
465/*
466 * When BootX makes a copy of the device tree from the MacOS
467 * Name Registry, it is in the format we use but all of the pointers
468 * are offsets from the start of the tree.
469 * This procedure updates the pointers.
470 */
471void __init
472relocate_nodes(void)
473{
474 unsigned long base;
475 struct device_node *np;
476 struct property *pp;
477
478#define ADDBASE(x) (x = (typeof (x))((x)? ((unsigned long)(x) + base): 0))
479
480 base = (unsigned long) boot_infos + boot_infos->deviceTreeOffset;
481 allnodes = (struct device_node *)(base + 4);
482 for (np = allnodes; np != 0; np = np->allnext) {
483 ADDBASE(np->full_name);
484 ADDBASE(np->properties);
485 ADDBASE(np->parent);
486 ADDBASE(np->child);
487 ADDBASE(np->sibling);
488 ADDBASE(np->allnext);
489 for (pp = np->properties; pp != 0; pp = pp->next) {
490 ADDBASE(pp->name);
491 ADDBASE(pp->value);
492 ADDBASE(pp->next);
493 }
494 }
495}
496
497int
498prom_n_addr_cells(struct device_node* np)
499{
500 int* ip;
501 do {
502 if (np->parent)
503 np = np->parent;
504 ip = (int *) get_property(np, "#address-cells", NULL);
505 if (ip != NULL)
506 return *ip;
507 } while (np->parent);
508 /* No #address-cells property for the root node, default to 1 */
509 return 1;
510}
511
512int
513prom_n_size_cells(struct device_node* np)
514{
515 int* ip;
516 do {
517 if (np->parent)
518 np = np->parent;
519 ip = (int *) get_property(np, "#size-cells", NULL);
520 if (ip != NULL)
521 return *ip;
522 } while (np->parent);
523 /* No #size-cells property for the root node, default to 1 */
524 return 1;
525}
526
527static unsigned long __init
528map_addr(struct device_node *np, unsigned long space, unsigned long addr)
529{
530 int na;
531 unsigned int *ranges;
532 int rlen = 0;
533 unsigned int type;
534
535 type = (space >> 24) & 3;
536 if (type == 0)
537 return addr;
538
539 while ((np = np->parent) != NULL) {
540 if (strcmp(np->type, "pci") != 0)
541 continue;
542 /* PCI bridge: map the address through the ranges property */
543 na = prom_n_addr_cells(np);
544 ranges = (unsigned int *) get_property(np, "ranges", &rlen);
545 while ((rlen -= (na + 5) * sizeof(unsigned int)) >= 0) {
546 if (((ranges[0] >> 24) & 3) == type
547 && ranges[2] <= addr
548 && addr - ranges[2] < ranges[na+4]) {
549 /* ok, this matches, translate it */
550 addr += ranges[na+2] - ranges[2];
551 break;
552 }
553 ranges += na + 5;
554 }
555 }
556 return addr;
557}
558
559static unsigned long __init
560interpret_pci_props(struct device_node *np, unsigned long mem_start,
561 int naddrc, int nsizec)
562{
563 struct address_range *adr;
564 struct pci_reg_property *pci_addrs;
565 int i, l, *ip;
566
567 pci_addrs = (struct pci_reg_property *)
568 get_property(np, "assigned-addresses", &l);
569 if (pci_addrs != 0 && l >= sizeof(struct pci_reg_property)) {
570 i = 0;
571 adr = (struct address_range *) mem_start;
572 while ((l -= sizeof(struct pci_reg_property)) >= 0) {
573 adr[i].space = pci_addrs[i].addr.a_hi;
574 adr[i].address = map_addr(np, pci_addrs[i].addr.a_hi,
575 pci_addrs[i].addr.a_lo);
576 adr[i].size = pci_addrs[i].size_lo;
577 ++i;
578 }
579 np->addrs = adr;
580 np->n_addrs = i;
581 mem_start += i * sizeof(struct address_range);
582 }
583
584 if (use_of_interrupt_tree)
585 return mem_start;
586
587 ip = (int *) get_property(np, "AAPL,interrupts", &l);
588 if (ip == 0 && np->parent)
589 ip = (int *) get_property(np->parent, "AAPL,interrupts", &l);
590 if (ip == 0)
591 ip = (int *) get_property(np, "interrupts", &l);
592 if (ip != 0) {
593 np->intrs = (struct interrupt_info *) mem_start;
594 np->n_intrs = l / sizeof(int);
595 mem_start += np->n_intrs * sizeof(struct interrupt_info);
596 for (i = 0; i < np->n_intrs; ++i) {
597 np->intrs[i].line = *ip++;
598 np->intrs[i].sense = 1;
599 }
600 }
601
602 return mem_start;
603}
604
605static unsigned long __init
606interpret_dbdma_props(struct device_node *np, unsigned long mem_start,
607 int naddrc, int nsizec)
608{
609 struct reg_property *rp;
610 struct address_range *adr;
611 unsigned long base_address;
612 int i, l, *ip;
613 struct device_node *db;
614
615 base_address = 0;
616 for (db = np->parent; db != NULL; db = db->parent) {
617 if (!strcmp(db->type, "dbdma") && db->n_addrs != 0) {
618 base_address = db->addrs[0].address;
619 break;
620 }
621 }
622
623 rp = (struct reg_property *) get_property(np, "reg", &l);
624 if (rp != 0 && l >= sizeof(struct reg_property)) {
625 i = 0;
626 adr = (struct address_range *) mem_start;
627 while ((l -= sizeof(struct reg_property)) >= 0) {
628 adr[i].space = 2;
629 adr[i].address = rp[i].address + base_address;
630 adr[i].size = rp[i].size;
631 ++i;
632 }
633 np->addrs = adr;
634 np->n_addrs = i;
635 mem_start += i * sizeof(struct address_range);
636 }
637
638 if (use_of_interrupt_tree)
639 return mem_start;
640
641 ip = (int *) get_property(np, "AAPL,interrupts", &l);
642 if (ip == 0)
643 ip = (int *) get_property(np, "interrupts", &l);
644 if (ip != 0) {
645 np->intrs = (struct interrupt_info *) mem_start;
646 np->n_intrs = l / sizeof(int);
647 mem_start += np->n_intrs * sizeof(struct interrupt_info);
648 for (i = 0; i < np->n_intrs; ++i) {
649 np->intrs[i].line = *ip++;
650 np->intrs[i].sense = 1;
651 }
652 }
653
654 return mem_start;
655}
656
657static unsigned long __init
658interpret_macio_props(struct device_node *np, unsigned long mem_start,
659 int naddrc, int nsizec)
660{
661 struct reg_property *rp;
662 struct address_range *adr;
663 unsigned long base_address;
664 int i, l, *ip;
665 struct device_node *db;
666
667 base_address = 0;
668 for (db = np->parent; db != NULL; db = db->parent) {
669 if (!strcmp(db->type, "mac-io") && db->n_addrs != 0) {
670 base_address = db->addrs[0].address;
671 break;
672 }
673 }
674
675 rp = (struct reg_property *) get_property(np, "reg", &l);
676 if (rp != 0 && l >= sizeof(struct reg_property)) {
677 i = 0;
678 adr = (struct address_range *) mem_start;
679 while ((l -= sizeof(struct reg_property)) >= 0) {
680 adr[i].space = 2;
681 adr[i].address = rp[i].address + base_address;
682 adr[i].size = rp[i].size;
683 ++i;
684 }
685 np->addrs = adr;
686 np->n_addrs = i;
687 mem_start += i * sizeof(struct address_range);
688 }
689
690 if (use_of_interrupt_tree)
691 return mem_start;
692
693 ip = (int *) get_property(np, "interrupts", &l);
694 if (ip == 0)
695 ip = (int *) get_property(np, "AAPL,interrupts", &l);
696 if (ip != 0) {
697 np->intrs = (struct interrupt_info *) mem_start;
698 np->n_intrs = l / sizeof(int);
699 for (i = 0; i < np->n_intrs; ++i) {
700 np->intrs[i].line = *ip++;
701 np->intrs[i].sense = 1;
702 }
703 mem_start += np->n_intrs * sizeof(struct interrupt_info);
704 }
705
706 return mem_start;
707}
708
709static unsigned long __init
710interpret_isa_props(struct device_node *np, unsigned long mem_start,
711 int naddrc, int nsizec)
712{
713 struct isa_reg_property *rp;
714 struct address_range *adr;
715 int i, l, *ip;
716
717 rp = (struct isa_reg_property *) get_property(np, "reg", &l);
718 if (rp != 0 && l >= sizeof(struct isa_reg_property)) {
719 i = 0;
720 adr = (struct address_range *) mem_start;
721 while ((l -= sizeof(struct reg_property)) >= 0) {
722 adr[i].space = rp[i].space;
723 adr[i].address = rp[i].address
724 + (adr[i].space? 0: _ISA_MEM_BASE);
725 adr[i].size = rp[i].size;
726 ++i;
727 }
728 np->addrs = adr;
729 np->n_addrs = i;
730 mem_start += i * sizeof(struct address_range);
731 }
732
733 if (use_of_interrupt_tree)
734 return mem_start;
735
736 ip = (int *) get_property(np, "interrupts", &l);
737 if (ip != 0) {
738 np->intrs = (struct interrupt_info *) mem_start;
739 np->n_intrs = l / (2 * sizeof(int));
740 mem_start += np->n_intrs * sizeof(struct interrupt_info);
741 for (i = 0; i < np->n_intrs; ++i) {
742 np->intrs[i].line = *ip++;
743 np->intrs[i].sense = *ip++;
744 }
745 }
746
747 return mem_start;
748}
749
750static unsigned long __init
751interpret_root_props(struct device_node *np, unsigned long mem_start,
752 int naddrc, int nsizec)
753{
754 struct address_range *adr;
755 int i, l, *ip;
756 unsigned int *rp;
757 int rpsize = (naddrc + nsizec) * sizeof(unsigned int);
758
759 rp = (unsigned int *) get_property(np, "reg", &l);
760 if (rp != 0 && l >= rpsize) {
761 i = 0;
762 adr = (struct address_range *) mem_start;
763 while ((l -= rpsize) >= 0) {
764 adr[i].space = (naddrc >= 2? rp[naddrc-2]: 2);
765 adr[i].address = rp[naddrc - 1];
766 adr[i].size = rp[naddrc + nsizec - 1];
767 ++i;
768 rp += naddrc + nsizec;
769 }
770 np->addrs = adr;
771 np->n_addrs = i;
772 mem_start += i * sizeof(struct address_range);
773 }
774
775 if (use_of_interrupt_tree)
776 return mem_start;
777
778 ip = (int *) get_property(np, "AAPL,interrupts", &l);
779 if (ip == 0)
780 ip = (int *) get_property(np, "interrupts", &l);
781 if (ip != 0) {
782 np->intrs = (struct interrupt_info *) mem_start;
783 np->n_intrs = l / sizeof(int);
784 mem_start += np->n_intrs * sizeof(struct interrupt_info);
785 for (i = 0; i < np->n_intrs; ++i) {
786 np->intrs[i].line = *ip++;
787 np->intrs[i].sense = 1;
788 }
789 }
790
791 return mem_start;
792}
793
794/*
795 * Work out the sense (active-low level / active-high edge)
796 * of each interrupt from the device tree.
797 */
798void __init
799prom_get_irq_senses(unsigned char *senses, int off, int max)
800{
801 struct device_node *np;
802 int i, j;
803
804 /* default to level-triggered */
805 memset(senses, 1, max - off);
806 if (!use_of_interrupt_tree)
807 return;
808
809 for (np = allnodes; np != 0; np = np->allnext) {
810 for (j = 0; j < np->n_intrs; j++) {
811 i = np->intrs[j].line;
812 if (i >= off && i < max) {
813 if (np->intrs[j].sense == 1)
814 senses[i-off] = (IRQ_SENSE_LEVEL
815 | IRQ_POLARITY_NEGATIVE);
816 else
817 senses[i-off] = (IRQ_SENSE_EDGE
818 | IRQ_POLARITY_POSITIVE);
819 }
820 }
821 }
822}
823
824/*
825 * Construct and return a list of the device_nodes with a given name.
826 */
827struct device_node *
828find_devices(const char *name)
829{
830 struct device_node *head, **prevp, *np;
831
832 prevp = &head;
833 for (np = allnodes; np != 0; np = np->allnext) {
834 if (np->name != 0 && strcasecmp(np->name, name) == 0) {
835 *prevp = np;
836 prevp = &np->next;
837 }
838 }
839 *prevp = NULL;
840 return head;
841}
842
843/*
844 * Construct and return a list of the device_nodes with a given type.
845 */
846struct device_node *
847find_type_devices(const char *type)
848{
849 struct device_node *head, **prevp, *np;
850
851 prevp = &head;
852 for (np = allnodes; np != 0; np = np->allnext) {
853 if (np->type != 0 && strcasecmp(np->type, type) == 0) {
854 *prevp = np;
855 prevp = &np->next;
856 }
857 }
858 *prevp = NULL;
859 return head;
860}
861
862/*
863 * Returns all nodes linked together
864 */
865struct device_node * __openfirmware
866find_all_nodes(void)
867{
868 struct device_node *head, **prevp, *np;
869
870 prevp = &head;
871 for (np = allnodes; np != 0; np = np->allnext) {
872 *prevp = np;
873 prevp = &np->next;
874 }
875 *prevp = NULL;
876 return head;
877}
878
879/* Checks if the given "compat" string matches one of the strings in
880 * the device's "compatible" property
881 */
882int
883device_is_compatible(struct device_node *device, const char *compat)
884{
885 const char* cp;
886 int cplen, l;
887
888 cp = (char *) get_property(device, "compatible", &cplen);
889 if (cp == NULL)
890 return 0;
891 while (cplen > 0) {
892 if (strncasecmp(cp, compat, strlen(compat)) == 0)
893 return 1;
894 l = strlen(cp) + 1;
895 cp += l;
896 cplen -= l;
897 }
898
899 return 0;
900}
901
902
903/*
904 * Indicates whether the root node has a given value in its
905 * compatible property.
906 */
907int
908machine_is_compatible(const char *compat)
909{
910 struct device_node *root;
911
912 root = find_path_device("/");
913 if (root == 0)
914 return 0;
915 return device_is_compatible(root, compat);
916}
917
918/*
919 * Construct and return a list of the device_nodes with a given type
920 * and compatible property.
921 */
922struct device_node *
923find_compatible_devices(const char *type, const char *compat)
924{
925 struct device_node *head, **prevp, *np;
926
927 prevp = &head;
928 for (np = allnodes; np != 0; np = np->allnext) {
929 if (type != NULL
930 && !(np->type != 0 && strcasecmp(np->type, type) == 0))
931 continue;
932 if (device_is_compatible(np, compat)) {
933 *prevp = np;
934 prevp = &np->next;
935 }
936 }
937 *prevp = NULL;
938 return head;
939}
940
941/*
942 * Find the device_node with a given full_name.
943 */
944struct device_node *
945find_path_device(const char *path)
946{
947 struct device_node *np;
948
949 for (np = allnodes; np != 0; np = np->allnext)
950 if (np->full_name != 0 && strcasecmp(np->full_name, path) == 0)
951 return np;
952 return NULL;
953}
954
955/*******
956 *
957 * New implementation of the OF "find" APIs, return a refcounted
958 * object, call of_node_put() when done. Currently, still lacks
959 * locking as old implementation, this is beeing done for ppc64.
960 *
961 * Note that property management will need some locking as well,
962 * this isn't dealt with yet
963 *
964 *******/
965
966/**
967 * of_find_node_by_name - Find a node by it's "name" property
968 * @from: The node to start searching from or NULL, the node
969 * you pass will not be searched, only the next one
970 * will; typically, you pass what the previous call
971 * returned. of_node_put() will be called on it
972 * @name: The name string to match against
973 *
974 * Returns a node pointer with refcount incremented, use
975 * of_node_put() on it when done.
976 */
977struct device_node *of_find_node_by_name(struct device_node *from,
978 const char *name)
979{
980 struct device_node *np = from ? from->allnext : allnodes;
981
982 for (; np != 0; np = np->allnext)
983 if (np->name != 0 && strcasecmp(np->name, name) == 0)
984 break;
985 if (from)
986 of_node_put(from);
987 return of_node_get(np);
988}
989
990/**
991 * of_find_node_by_type - Find a node by it's "device_type" property
992 * @from: The node to start searching from or NULL, the node
993 * you pass will not be searched, only the next one
994 * will; typically, you pass what the previous call
995 * returned. of_node_put() will be called on it
996 * @name: The type string to match against
997 *
998 * Returns a node pointer with refcount incremented, use
999 * of_node_put() on it when done.
1000 */
1001struct device_node *of_find_node_by_type(struct device_node *from,
1002 const char *type)
1003{
1004 struct device_node *np = from ? from->allnext : allnodes;
1005
1006 for (; np != 0; np = np->allnext)
1007 if (np->type != 0 && strcasecmp(np->type, type) == 0)
1008 break;
1009 if (from)
1010 of_node_put(from);
1011 return of_node_get(np);
1012}
1013
1014/**
1015 * of_find_compatible_node - Find a node based on type and one of the
1016 * tokens in it's "compatible" property
1017 * @from: The node to start searching from or NULL, the node
1018 * you pass will not be searched, only the next one
1019 * will; typically, you pass what the previous call
1020 * returned. of_node_put() will be called on it
1021 * @type: The type string to match "device_type" or NULL to ignore
1022 * @compatible: The string to match to one of the tokens in the device
1023 * "compatible" list.
1024 *
1025 * Returns a node pointer with refcount incremented, use
1026 * of_node_put() on it when done.
1027 */
1028struct device_node *of_find_compatible_node(struct device_node *from,
1029 const char *type, const char *compatible)
1030{
1031 struct device_node *np = from ? from->allnext : allnodes;
1032
1033 for (; np != 0; np = np->allnext) {
1034 if (type != NULL
1035 && !(np->type != 0 && strcasecmp(np->type, type) == 0))
1036 continue;
1037 if (device_is_compatible(np, compatible))
1038 break;
1039 }
1040 if (from)
1041 of_node_put(from);
1042 return of_node_get(np);
1043}
1044
1045/**
1046 * of_find_node_by_path - Find a node matching a full OF path
1047 * @path: The full path to match
1048 *
1049 * Returns a node pointer with refcount incremented, use
1050 * of_node_put() on it when done.
1051 */
1052struct device_node *of_find_node_by_path(const char *path)
1053{
1054 struct device_node *np = allnodes;
1055
1056 for (; np != 0; np = np->allnext)
1057 if (np->full_name != 0 && strcasecmp(np->full_name, path) == 0)
1058 break;
1059 return of_node_get(np);
1060}
1061
1062/**
1063 * of_find_all_nodes - Get next node in global list
1064 * @prev: Previous node or NULL to start iteration
1065 * of_node_put() will be called on it
1066 *
1067 * Returns a node pointer with refcount incremented, use
1068 * of_node_put() on it when done.
1069 */
1070struct device_node *of_find_all_nodes(struct device_node *prev)
1071{
1072 return of_node_get(prev ? prev->allnext : allnodes);
1073}
1074
1075/**
1076 * of_get_parent - Get a node's parent if any
1077 * @node: Node to get parent
1078 *
1079 * Returns a node pointer with refcount incremented, use
1080 * of_node_put() on it when done.
1081 */
1082struct device_node *of_get_parent(const struct device_node *node)
1083{
1084 return node ? of_node_get(node->parent) : NULL;
1085}
1086
1087/**
1088 * of_get_next_child - Iterate a node childs
1089 * @node: parent node
1090 * @prev: previous child of the parent node, or NULL to get first
1091 *
1092 * Returns a node pointer with refcount incremented, use
1093 * of_node_put() on it when done.
1094 */
1095struct device_node *of_get_next_child(const struct device_node *node,
1096 struct device_node *prev)
1097{
1098 struct device_node *next = prev ? prev->sibling : node->child;
1099
1100 for (; next != 0; next = next->sibling)
1101 if (of_node_get(next))
1102 break;
1103 if (prev)
1104 of_node_put(prev);
1105 return next;
1106}
1107
1108/**
1109 * of_node_get - Increment refcount of a node
1110 * @node: Node to inc refcount, NULL is supported to
1111 * simplify writing of callers
1112 *
1113 * Returns the node itself or NULL if gone. Current implementation
1114 * does nothing as we don't yet do dynamic node allocation on ppc32
1115 */
1116struct device_node *of_node_get(struct device_node *node)
1117{
1118 return node;
1119}
1120
1121/**
1122 * of_node_put - Decrement refcount of a node
1123 * @node: Node to dec refcount, NULL is supported to
1124 * simplify writing of callers
1125 *
1126 * Current implementation does nothing as we don't yet do dynamic node
1127 * allocation on ppc32
1128 */
1129void of_node_put(struct device_node *node)
1130{
1131}
1132
1133/*
1134 * Find the device_node with a given phandle.
1135 */
1136static struct device_node * __init
1137find_phandle(phandle ph)
1138{
1139 struct device_node *np;
1140
1141 for (np = allnodes; np != 0; np = np->allnext)
1142 if (np->node == ph)
1143 return np;
1144 return NULL;
1145}
1146
1147/*
1148 * Find a property with a given name for a given node
1149 * and return the value.
1150 */
1151unsigned char *
1152get_property(struct device_node *np, const char *name, int *lenp)
1153{
1154 struct property *pp;
1155
1156 for (pp = np->properties; pp != 0; pp = pp->next)
1157 if (pp->name != NULL && strcmp(pp->name, name) == 0) {
1158 if (lenp != 0)
1159 *lenp = pp->length;
1160 return pp->value;
1161 }
1162 return NULL;
1163}
1164
1165/*
1166 * Add a property to a node
1167 */
1168void __openfirmware
1169prom_add_property(struct device_node* np, struct property* prop)
1170{
1171 struct property **next = &np->properties;
1172
1173 prop->next = NULL;
1174 while (*next)
1175 next = &(*next)->next;
1176 *next = prop;
1177}
1178
1179/* I quickly hacked that one, check against spec ! */
1180static inline unsigned long __openfirmware
1181bus_space_to_resource_flags(unsigned int bus_space)
1182{
1183 u8 space = (bus_space >> 24) & 0xf;
1184 if (space == 0)
1185 space = 0x02;
1186 if (space == 0x02)
1187 return IORESOURCE_MEM;
1188 else if (space == 0x01)
1189 return IORESOURCE_IO;
1190 else {
1191 printk(KERN_WARNING "prom.c: bus_space_to_resource_flags(), space: %x\n",
1192 bus_space);
1193 return 0;
1194 }
1195}
1196
1197static struct resource* __openfirmware
1198find_parent_pci_resource(struct pci_dev* pdev, struct address_range *range)
1199{
1200 unsigned long mask;
1201 int i;
1202
1203 /* Check this one */
1204 mask = bus_space_to_resource_flags(range->space);
1205 for (i=0; i<DEVICE_COUNT_RESOURCE; i++) {
1206 if ((pdev->resource[i].flags & mask) == mask &&
1207 pdev->resource[i].start <= range->address &&
1208 pdev->resource[i].end > range->address) {
1209 if ((range->address + range->size - 1) > pdev->resource[i].end) {
1210 /* Add better message */
1211 printk(KERN_WARNING "PCI/OF resource overlap !\n");
1212 return NULL;
1213 }
1214 break;
1215 }
1216 }
1217 if (i == DEVICE_COUNT_RESOURCE)
1218 return NULL;
1219 return &pdev->resource[i];
1220}
1221
1222/*
1223 * Request an OF device resource. Currently handles child of PCI devices,
1224 * or other nodes attached to the root node. Ultimately, put some
1225 * link to resources in the OF node.
1226 */
1227struct resource* __openfirmware
1228request_OF_resource(struct device_node* node, int index, const char* name_postfix)
1229{
1230 struct pci_dev* pcidev;
1231 u8 pci_bus, pci_devfn;
1232 unsigned long iomask;
1233 struct device_node* nd;
1234 struct resource* parent;
1235 struct resource *res = NULL;
1236 int nlen, plen;
1237
1238 if (index >= node->n_addrs)
1239 goto fail;
1240
1241 /* Sanity check on bus space */
1242 iomask = bus_space_to_resource_flags(node->addrs[index].space);
1243 if (iomask & IORESOURCE_MEM)
1244 parent = &iomem_resource;
1245 else if (iomask & IORESOURCE_IO)
1246 parent = &ioport_resource;
1247 else
1248 goto fail;
1249
1250 /* Find a PCI parent if any */
1251 nd = node;
1252 pcidev = NULL;
1253 while(nd) {
1254 if (!pci_device_from_OF_node(nd, &pci_bus, &pci_devfn))
1255 pcidev = pci_find_slot(pci_bus, pci_devfn);
1256 if (pcidev) break;
1257 nd = nd->parent;
1258 }
1259 if (pcidev)
1260 parent = find_parent_pci_resource(pcidev, &node->addrs[index]);
1261 if (!parent) {
1262 printk(KERN_WARNING "request_OF_resource(%s), parent not found\n",
1263 node->name);
1264 goto fail;
1265 }
1266
1267 res = __request_region(parent, node->addrs[index].address, node->addrs[index].size, NULL);
1268 if (!res)
1269 goto fail;
1270 nlen = strlen(node->name);
1271 plen = name_postfix ? strlen(name_postfix) : 0;
1272 res->name = (const char *)kmalloc(nlen+plen+1, GFP_KERNEL);
1273 if (res->name) {
1274 strcpy((char *)res->name, node->name);
1275 if (plen)
1276 strcpy((char *)res->name+nlen, name_postfix);
1277 }
1278 return res;
1279fail:
1280 return NULL;
1281}
1282
1283int __openfirmware
1284release_OF_resource(struct device_node* node, int index)
1285{
1286 struct pci_dev* pcidev;
1287 u8 pci_bus, pci_devfn;
1288 unsigned long iomask, start, end;
1289 struct device_node* nd;
1290 struct resource* parent;
1291 struct resource *res = NULL;
1292
1293 if (index >= node->n_addrs)
1294 return -EINVAL;
1295
1296 /* Sanity check on bus space */
1297 iomask = bus_space_to_resource_flags(node->addrs[index].space);
1298 if (iomask & IORESOURCE_MEM)
1299 parent = &iomem_resource;
1300 else if (iomask & IORESOURCE_IO)
1301 parent = &ioport_resource;
1302 else
1303 return -EINVAL;
1304
1305 /* Find a PCI parent if any */
1306 nd = node;
1307 pcidev = NULL;
1308 while(nd) {
1309 if (!pci_device_from_OF_node(nd, &pci_bus, &pci_devfn))
1310 pcidev = pci_find_slot(pci_bus, pci_devfn);
1311 if (pcidev) break;
1312 nd = nd->parent;
1313 }
1314 if (pcidev)
1315 parent = find_parent_pci_resource(pcidev, &node->addrs[index]);
1316 if (!parent) {
1317 printk(KERN_WARNING "release_OF_resource(%s), parent not found\n",
1318 node->name);
1319 return -ENODEV;
1320 }
1321
1322 /* Find us in the parent and its childs */
1323 res = parent->child;
1324 start = node->addrs[index].address;
1325 end = start + node->addrs[index].size - 1;
1326 while (res) {
1327 if (res->start == start && res->end == end &&
1328 (res->flags & IORESOURCE_BUSY))
1329 break;
1330 if (res->start <= start && res->end >= end)
1331 res = res->child;
1332 else
1333 res = res->sibling;
1334 }
1335 if (!res)
1336 return -ENODEV;
1337
1338 if (res->name) {
1339 kfree(res->name);
1340 res->name = NULL;
1341 }
1342 release_resource(res);
1343 kfree(res);
1344
1345 return 0;
1346}
1347
1348#if 0
1349void __openfirmware
1350print_properties(struct device_node *np)
1351{
1352 struct property *pp;
1353 char *cp;
1354 int i, n;
1355
1356 for (pp = np->properties; pp != 0; pp = pp->next) {
1357 printk(KERN_INFO "%s", pp->name);
1358 for (i = strlen(pp->name); i < 16; ++i)
1359 printk(" ");
1360 cp = (char *) pp->value;
1361 for (i = pp->length; i > 0; --i, ++cp)
1362 if ((i > 1 && (*cp < 0x20 || *cp > 0x7e))
1363 || (i == 1 && *cp != 0))
1364 break;
1365 if (i == 0 && pp->length > 1) {
1366 /* looks like a string */
1367 printk(" %s\n", (char *) pp->value);
1368 } else {
1369 /* dump it in hex */
1370 n = pp->length;
1371 if (n > 64)
1372 n = 64;
1373 if (pp->length % 4 == 0) {
1374 unsigned int *p = (unsigned int *) pp->value;
1375
1376 n /= 4;
1377 for (i = 0; i < n; ++i) {
1378 if (i != 0 && (i % 4) == 0)
1379 printk("\n ");
1380 printk(" %08x", *p++);
1381 }
1382 } else {
1383 unsigned char *bp = pp->value;
1384
1385 for (i = 0; i < n; ++i) {
1386 if (i != 0 && (i % 16) == 0)
1387 printk("\n ");
1388 printk(" %02x", *bp++);
1389 }
1390 }
1391 printk("\n");
1392 if (pp->length > 64)
1393 printk(" ... (length = %d)\n",
1394 pp->length);
1395 }
1396 }
1397}
1398#endif
1399
1400static DEFINE_SPINLOCK(rtas_lock);
1401
1402/* this can be called after setup -- Cort */
1403int __openfirmware
1404call_rtas(const char *service, int nargs, int nret,
1405 unsigned long *outputs, ...)
1406{
1407 va_list list;
1408 int i;
1409 unsigned long s;
1410 struct device_node *rtas;
1411 int *tokp;
1412 union {
1413 unsigned long words[16];
1414 double align;
1415 } u;
1416
1417 rtas = find_devices("rtas");
1418 if (rtas == NULL)
1419 return -1;
1420 tokp = (int *) get_property(rtas, service, NULL);
1421 if (tokp == NULL) {
1422 printk(KERN_ERR "No RTAS service called %s\n", service);
1423 return -1;
1424 }
1425 u.words[0] = *tokp;
1426 u.words[1] = nargs;
1427 u.words[2] = nret;
1428 va_start(list, outputs);
1429 for (i = 0; i < nargs; ++i)
1430 u.words[i+3] = va_arg(list, unsigned long);
1431 va_end(list);
1432
1433 /*
1434 * RTAS doesn't use floating point.
1435 * Or at least, according to the CHRP spec we enter RTAS
1436 * with FP disabled, and it doesn't change the FP registers.
1437 * -- paulus.
1438 */
1439 spin_lock_irqsave(&rtas_lock, s);
1440 enter_rtas((void *)__pa(&u));
1441 spin_unlock_irqrestore(&rtas_lock, s);
1442
1443 if (nret > 1 && outputs != NULL)
1444 for (i = 0; i < nret-1; ++i)
1445 outputs[i] = u.words[i+nargs+4];
1446 return u.words[nargs+3];
1447}
diff --git a/arch/ppc/syslib/prom_init.c b/arch/ppc/syslib/prom_init.c
new file mode 100644
index 000000000000..2cee87137f2e
--- /dev/null
+++ b/arch/ppc/syslib/prom_init.c
@@ -0,0 +1,1002 @@
1/*
2 * Note that prom_init() and anything called from prom_init()
3 * may be running at an address that is different from the address
4 * that it was linked at. References to static data items are
5 * handled by compiling this file with -mrelocatable-lib.
6 */
7
8#include <linux/config.h>
9#include <linux/kernel.h>
10#include <linux/string.h>
11#include <linux/init.h>
12#include <linux/version.h>
13#include <linux/threads.h>
14#include <linux/spinlock.h>
15#include <linux/ioport.h>
16#include <linux/pci.h>
17#include <linux/slab.h>
18#include <linux/bitops.h>
19
20#include <asm/sections.h>
21#include <asm/prom.h>
22#include <asm/page.h>
23#include <asm/irq.h>
24#include <asm/io.h>
25#include <asm/smp.h>
26#include <asm/bootx.h>
27#include <asm/system.h>
28#include <asm/mmu.h>
29#include <asm/pgtable.h>
30#include <asm/bootinfo.h>
31#include <asm/btext.h>
32#include <asm/pci-bridge.h>
33#include <asm/open_pic.h>
34#include <asm/cacheflush.h>
35
36#ifdef CONFIG_LOGO_LINUX_CLUT224
37#include <linux/linux_logo.h>
38extern const struct linux_logo logo_linux_clut224;
39#endif
40
41/*
42 * Properties whose value is longer than this get excluded from our
43 * copy of the device tree. This way we don't waste space storing
44 * things like "driver,AAPL,MacOS,PowerPC" properties. But this value
45 * does need to be big enough to ensure that we don't lose things
46 * like the interrupt-map property on a PCI-PCI bridge.
47 */
48#define MAX_PROPERTY_LENGTH 4096
49
50#ifndef FB_MAX /* avoid pulling in all of the fb stuff */
51#define FB_MAX 8
52#endif
53
54#define ALIGNUL(x) (((x) + sizeof(unsigned long)-1) & -sizeof(unsigned long))
55
56typedef u32 prom_arg_t;
57
58struct prom_args {
59 const char *service;
60 int nargs;
61 int nret;
62 prom_arg_t args[10];
63};
64
65struct pci_address {
66 unsigned a_hi;
67 unsigned a_mid;
68 unsigned a_lo;
69};
70
71struct pci_reg_property {
72 struct pci_address addr;
73 unsigned size_hi;
74 unsigned size_lo;
75};
76
77struct pci_range {
78 struct pci_address addr;
79 unsigned phys;
80 unsigned size_hi;
81 unsigned size_lo;
82};
83
84struct isa_reg_property {
85 unsigned space;
86 unsigned address;
87 unsigned size;
88};
89
90struct pci_intr_map {
91 struct pci_address addr;
92 unsigned dunno;
93 phandle int_ctrler;
94 unsigned intr;
95};
96
97static void prom_exit(void);
98static int call_prom(const char *service, int nargs, int nret, ...);
99static int call_prom_ret(const char *service, int nargs, int nret,
100 prom_arg_t *rets, ...);
101static void prom_print_hex(unsigned int v);
102static int prom_set_color(ihandle ih, int i, int r, int g, int b);
103static int prom_next_node(phandle *nodep);
104static unsigned long check_display(unsigned long mem);
105static void setup_disp_fake_bi(ihandle dp);
106static unsigned long copy_device_tree(unsigned long mem_start,
107 unsigned long mem_end);
108static unsigned long inspect_node(phandle node, struct device_node *dad,
109 unsigned long mem_start, unsigned long mem_end,
110 struct device_node ***allnextpp);
111static void prom_hold_cpus(unsigned long mem);
112static void prom_instantiate_rtas(void);
113static void * early_get_property(unsigned long base, unsigned long node,
114 char *prop);
115
116prom_entry prom __initdata;
117ihandle prom_chosen __initdata;
118ihandle prom_stdout __initdata;
119
120static char *prom_display_paths[FB_MAX] __initdata;
121static phandle prom_display_nodes[FB_MAX] __initdata;
122static unsigned int prom_num_displays __initdata;
123static ihandle prom_disp_node __initdata;
124char *of_stdout_device __initdata;
125
126unsigned int rtas_data; /* physical pointer */
127unsigned int rtas_entry; /* physical pointer */
128unsigned int rtas_size;
129unsigned int old_rtas;
130
131boot_infos_t *boot_infos;
132char *bootpath;
133char *bootdevice;
134struct device_node *allnodes;
135
136extern char *klimit;
137
138static void __init
139prom_exit(void)
140{
141 struct prom_args args;
142
143 args.service = "exit";
144 args.nargs = 0;
145 args.nret = 0;
146 prom(&args);
147 for (;;) /* should never get here */
148 ;
149}
150
151static int __init
152call_prom(const char *service, int nargs, int nret, ...)
153{
154 va_list list;
155 int i;
156 struct prom_args prom_args;
157
158 prom_args.service = service;
159 prom_args.nargs = nargs;
160 prom_args.nret = nret;
161 va_start(list, nret);
162 for (i = 0; i < nargs; ++i)
163 prom_args.args[i] = va_arg(list, prom_arg_t);
164 va_end(list);
165 for (i = 0; i < nret; ++i)
166 prom_args.args[i + nargs] = 0;
167 prom(&prom_args);
168 return prom_args.args[nargs];
169}
170
171static int __init
172call_prom_ret(const char *service, int nargs, int nret, prom_arg_t *rets, ...)
173{
174 va_list list;
175 int i;
176 struct prom_args prom_args;
177
178 prom_args.service = service;
179 prom_args.nargs = nargs;
180 prom_args.nret = nret;
181 va_start(list, rets);
182 for (i = 0; i < nargs; ++i)
183 prom_args.args[i] = va_arg(list, int);
184 va_end(list);
185 for (i = 0; i < nret; ++i)
186 prom_args.args[i + nargs] = 0;
187 prom(&prom_args);
188 for (i = 1; i < nret; ++i)
189 rets[i-1] = prom_args.args[nargs + i];
190 return prom_args.args[nargs];
191}
192
193void __init
194prom_print(const char *msg)
195{
196 const char *p, *q;
197
198 if (prom_stdout == 0)
199 return;
200
201 for (p = msg; *p != 0; p = q) {
202 for (q = p; *q != 0 && *q != '\n'; ++q)
203 ;
204 if (q > p)
205 call_prom("write", 3, 1, prom_stdout, p, q - p);
206 if (*q != 0) {
207 ++q;
208 call_prom("write", 3, 1, prom_stdout, "\r\n", 2);
209 }
210 }
211}
212
213static void __init
214prom_print_hex(unsigned int v)
215{
216 char buf[16];
217 int i, c;
218
219 for (i = 0; i < 8; ++i) {
220 c = (v >> ((7-i)*4)) & 0xf;
221 c += (c >= 10)? ('a' - 10): '0';
222 buf[i] = c;
223 }
224 buf[i] = ' ';
225 buf[i+1] = 0;
226 prom_print(buf);
227}
228
229static int __init
230prom_set_color(ihandle ih, int i, int r, int g, int b)
231{
232 return call_prom("call-method", 6, 1, "color!", ih, i, b, g, r);
233}
234
235static int __init
236prom_next_node(phandle *nodep)
237{
238 phandle node;
239
240 if ((node = *nodep) != 0
241 && (*nodep = call_prom("child", 1, 1, node)) != 0)
242 return 1;
243 if ((*nodep = call_prom("peer", 1, 1, node)) != 0)
244 return 1;
245 for (;;) {
246 if ((node = call_prom("parent", 1, 1, node)) == 0)
247 return 0;
248 if ((*nodep = call_prom("peer", 1, 1, node)) != 0)
249 return 1;
250 }
251}
252
253#ifdef CONFIG_POWER4
254/*
255 * Set up a hash table with a set of entries in it to map the
256 * first 64MB of RAM. This is used on 64-bit machines since
257 * some of them don't have BATs.
258 */
259
260static inline void make_pte(unsigned long htab, unsigned int hsize,
261 unsigned int va, unsigned int pa, int mode)
262{
263 unsigned int *pteg;
264 unsigned int hash, i, vsid;
265
266 vsid = ((va >> 28) * 0x111) << 12;
267 hash = ((va ^ vsid) >> 5) & 0x7fff80;
268 pteg = (unsigned int *)(htab + (hash & (hsize - 1)));
269 for (i = 0; i < 8; ++i, pteg += 4) {
270 if ((pteg[1] & 1) == 0) {
271 pteg[1] = vsid | ((va >> 16) & 0xf80) | 1;
272 pteg[3] = pa | mode;
273 break;
274 }
275 }
276}
277
278extern unsigned long _SDR1;
279extern PTE *Hash;
280extern unsigned long Hash_size;
281
282static void __init
283prom_alloc_htab(void)
284{
285 unsigned int hsize;
286 unsigned long htab;
287 unsigned int addr;
288
289 /*
290 * Because of OF bugs we can't use the "claim" client
291 * interface to allocate memory for the hash table.
292 * This code is only used on 64-bit PPCs, and the only
293 * 64-bit PPCs at the moment are RS/6000s, and their
294 * OF is based at 0xc00000 (the 12M point), so we just
295 * arbitrarily use the 0x800000 - 0xc00000 region for the
296 * hash table.
297 * -- paulus.
298 */
299 hsize = 4 << 20; /* POWER4 has no BATs */
300 htab = (8 << 20);
301 call_prom("claim", 3, 1, htab, hsize, 0);
302 Hash = (void *)(htab + KERNELBASE);
303 Hash_size = hsize;
304 _SDR1 = htab + __ilog2(hsize) - 18;
305
306 /*
307 * Put in PTEs for the first 64MB of RAM
308 */
309 memset((void *)htab, 0, hsize);
310 for (addr = 0; addr < 0x4000000; addr += 0x1000)
311 make_pte(htab, hsize, addr + KERNELBASE, addr,
312 _PAGE_ACCESSED | _PAGE_COHERENT | PP_RWXX);
313#if 0 /* DEBUG stuff mapping the SCC */
314 make_pte(htab, hsize, 0x80013000, 0x80013000,
315 _PAGE_ACCESSED | _PAGE_NO_CACHE | _PAGE_GUARDED | PP_RWXX);
316#endif
317}
318#endif /* CONFIG_POWER4 */
319
320
321/*
322 * If we have a display that we don't know how to drive,
323 * we will want to try to execute OF's open method for it
324 * later. However, OF will probably fall over if we do that
325 * we've taken over the MMU.
326 * So we check whether we will need to open the display,
327 * and if so, open it now.
328 */
329static unsigned long __init
330check_display(unsigned long mem)
331{
332 phandle node;
333 ihandle ih;
334 int i, j;
335 char type[16], *path;
336 static unsigned char default_colors[] = {
337 0x00, 0x00, 0x00,
338 0x00, 0x00, 0xaa,
339 0x00, 0xaa, 0x00,
340 0x00, 0xaa, 0xaa,
341 0xaa, 0x00, 0x00,
342 0xaa, 0x00, 0xaa,
343 0xaa, 0xaa, 0x00,
344 0xaa, 0xaa, 0xaa,
345 0x55, 0x55, 0x55,
346 0x55, 0x55, 0xff,
347 0x55, 0xff, 0x55,
348 0x55, 0xff, 0xff,
349 0xff, 0x55, 0x55,
350 0xff, 0x55, 0xff,
351 0xff, 0xff, 0x55,
352 0xff, 0xff, 0xff
353 };
354 const unsigned char *clut;
355
356 prom_disp_node = 0;
357
358 for (node = 0; prom_next_node(&node); ) {
359 type[0] = 0;
360 call_prom("getprop", 4, 1, node, "device_type",
361 type, sizeof(type));
362 if (strcmp(type, "display") != 0)
363 continue;
364 /* It seems OF doesn't null-terminate the path :-( */
365 path = (char *) mem;
366 memset(path, 0, 256);
367 if (call_prom("package-to-path", 3, 1, node, path, 255) < 0)
368 continue;
369
370 /*
371 * If this display is the device that OF is using for stdout,
372 * move it to the front of the list.
373 */
374 mem += strlen(path) + 1;
375 i = prom_num_displays++;
376 if (of_stdout_device != 0 && i > 0
377 && strcmp(of_stdout_device, path) == 0) {
378 for (; i > 0; --i) {
379 prom_display_paths[i]
380 = prom_display_paths[i-1];
381 prom_display_nodes[i]
382 = prom_display_nodes[i-1];
383 }
384 }
385 prom_display_paths[i] = path;
386 prom_display_nodes[i] = node;
387 if (i == 0)
388 prom_disp_node = node;
389 if (prom_num_displays >= FB_MAX)
390 break;
391 }
392
393 for (j=0; j<prom_num_displays; j++) {
394 path = prom_display_paths[j];
395 node = prom_display_nodes[j];
396 prom_print("opening display ");
397 prom_print(path);
398 ih = call_prom("open", 1, 1, path);
399 if (ih == 0 || ih == (ihandle) -1) {
400 prom_print("... failed\n");
401 for (i=j+1; i<prom_num_displays; i++) {
402 prom_display_paths[i-1] = prom_display_paths[i];
403 prom_display_nodes[i-1] = prom_display_nodes[i];
404 }
405 if (--prom_num_displays > 0) {
406 prom_disp_node = prom_display_nodes[j];
407 j--;
408 } else
409 prom_disp_node = 0;
410 continue;
411 } else {
412 prom_print("... ok\n");
413 call_prom("setprop", 4, 1, node, "linux,opened", 0, 0);
414
415 /*
416 * Setup a usable color table when the appropriate
417 * method is available.
418 * Should update this to use set-colors.
419 */
420 clut = default_colors;
421 for (i = 0; i < 32; i++, clut += 3)
422 if (prom_set_color(ih, i, clut[0], clut[1],
423 clut[2]) != 0)
424 break;
425
426#ifdef CONFIG_LOGO_LINUX_CLUT224
427 clut = PTRRELOC(logo_linux_clut224.clut);
428 for (i = 0; i < logo_linux_clut224.clutsize;
429 i++, clut += 3)
430 if (prom_set_color(ih, i + 32, clut[0],
431 clut[1], clut[2]) != 0)
432 break;
433#endif /* CONFIG_LOGO_LINUX_CLUT224 */
434 }
435 }
436
437 if (prom_stdout) {
438 phandle p;
439 p = call_prom("instance-to-package", 1, 1, prom_stdout);
440 if (p && p != -1) {
441 type[0] = 0;
442 call_prom("getprop", 4, 1, p, "device_type",
443 type, sizeof(type));
444 if (strcmp(type, "display") == 0)
445 call_prom("setprop", 4, 1, p, "linux,boot-display",
446 0, 0);
447 }
448 }
449
450 return ALIGNUL(mem);
451}
452
453/* This function will enable the early boot text when doing OF booting. This
454 * way, xmon output should work too
455 */
456static void __init
457setup_disp_fake_bi(ihandle dp)
458{
459#ifdef CONFIG_BOOTX_TEXT
460 int width = 640, height = 480, depth = 8, pitch;
461 unsigned address;
462 struct pci_reg_property addrs[8];
463 int i, naddrs;
464 char name[32];
465 char *getprop = "getprop";
466
467 prom_print("Initializing fake screen: ");
468
469 memset(name, 0, sizeof(name));
470 call_prom(getprop, 4, 1, dp, "name", name, sizeof(name));
471 name[sizeof(name)-1] = 0;
472 prom_print(name);
473 prom_print("\n");
474 call_prom(getprop, 4, 1, dp, "width", &width, sizeof(width));
475 call_prom(getprop, 4, 1, dp, "height", &height, sizeof(height));
476 call_prom(getprop, 4, 1, dp, "depth", &depth, sizeof(depth));
477 pitch = width * ((depth + 7) / 8);
478 call_prom(getprop, 4, 1, dp, "linebytes",
479 &pitch, sizeof(pitch));
480 if (pitch == 1)
481 pitch = 0x1000; /* for strange IBM display */
482 address = 0;
483 call_prom(getprop, 4, 1, dp, "address",
484 &address, sizeof(address));
485 if (address == 0) {
486 /* look for an assigned address with a size of >= 1MB */
487 naddrs = call_prom(getprop, 4, 1, dp, "assigned-addresses",
488 addrs, sizeof(addrs));
489 naddrs /= sizeof(struct pci_reg_property);
490 for (i = 0; i < naddrs; ++i) {
491 if (addrs[i].size_lo >= (1 << 20)) {
492 address = addrs[i].addr.a_lo;
493 /* use the BE aperture if possible */
494 if (addrs[i].size_lo >= (16 << 20))
495 address += (8 << 20);
496 break;
497 }
498 }
499 if (address == 0) {
500 prom_print("Failed to get address\n");
501 return;
502 }
503 }
504 /* kludge for valkyrie */
505 if (strcmp(name, "valkyrie") == 0)
506 address += 0x1000;
507
508#ifdef CONFIG_POWER4
509#if CONFIG_TASK_SIZE > 0x80000000
510#error CONFIG_TASK_SIZE cannot be above 0x80000000 with BOOTX_TEXT on G5
511#endif
512 {
513 extern boot_infos_t disp_bi;
514 unsigned long va, pa, i, offset;
515 va = 0x90000000;
516 pa = address & 0xfffff000ul;
517 offset = address & 0x00000fff;
518
519 for (i=0; i<0x4000; i++) {
520 make_pte((unsigned long)Hash - KERNELBASE, Hash_size, va, pa,
521 _PAGE_ACCESSED | _PAGE_NO_CACHE |
522 _PAGE_GUARDED | PP_RWXX);
523 va += 0x1000;
524 pa += 0x1000;
525 }
526 btext_setup_display(width, height, depth, pitch, 0x90000000 | offset);
527 disp_bi.dispDeviceBase = (u8 *)address;
528 }
529#else /* CONFIG_POWER4 */
530 btext_setup_display(width, height, depth, pitch, address);
531 btext_prepare_BAT();
532#endif /* CONFIG_POWER4 */
533#endif /* CONFIG_BOOTX_TEXT */
534}
535
536/*
537 * Make a copy of the device tree from the PROM.
538 */
539static unsigned long __init
540copy_device_tree(unsigned long mem_start, unsigned long mem_end)
541{
542 phandle root;
543 unsigned long new_start;
544 struct device_node **allnextp;
545
546 root = call_prom("peer", 1, 1, (phandle)0);
547 if (root == (phandle)0) {
548 prom_print("couldn't get device tree root\n");
549 prom_exit();
550 }
551 allnextp = &allnodes;
552 mem_start = ALIGNUL(mem_start);
553 new_start = inspect_node(root, NULL, mem_start, mem_end, &allnextp);
554 *allnextp = NULL;
555 return new_start;
556}
557
558static unsigned long __init
559inspect_node(phandle node, struct device_node *dad,
560 unsigned long mem_start, unsigned long mem_end,
561 struct device_node ***allnextpp)
562{
563 int l;
564 phandle child;
565 struct device_node *np;
566 struct property *pp, **prev_propp;
567 char *prev_name, *namep;
568 unsigned char *valp;
569
570 np = (struct device_node *) mem_start;
571 mem_start += sizeof(struct device_node);
572 memset(np, 0, sizeof(*np));
573 np->node = node;
574 **allnextpp = PTRUNRELOC(np);
575 *allnextpp = &np->allnext;
576 if (dad != 0) {
577 np->parent = PTRUNRELOC(dad);
578 /* we temporarily use the `next' field as `last_child'. */
579 if (dad->next == 0)
580 dad->child = PTRUNRELOC(np);
581 else
582 dad->next->sibling = PTRUNRELOC(np);
583 dad->next = np;
584 }
585
586 /* get and store all properties */
587 prev_propp = &np->properties;
588 prev_name = "";
589 for (;;) {
590 pp = (struct property *) mem_start;
591 namep = (char *) (pp + 1);
592 pp->name = PTRUNRELOC(namep);
593 if (call_prom("nextprop", 3, 1, node, prev_name, namep) <= 0)
594 break;
595 mem_start = ALIGNUL((unsigned long)namep + strlen(namep) + 1);
596 prev_name = namep;
597 valp = (unsigned char *) mem_start;
598 pp->value = PTRUNRELOC(valp);
599 pp->length = call_prom("getprop", 4, 1, node, namep,
600 valp, mem_end - mem_start);
601 if (pp->length < 0)
602 continue;
603#ifdef MAX_PROPERTY_LENGTH
604 if (pp->length > MAX_PROPERTY_LENGTH)
605 continue; /* ignore this property */
606#endif
607 mem_start = ALIGNUL(mem_start + pp->length);
608 *prev_propp = PTRUNRELOC(pp);
609 prev_propp = &pp->next;
610 }
611 if (np->node != 0) {
612 /* Add a "linux,phandle" property" */
613 pp = (struct property *) mem_start;
614 *prev_propp = PTRUNRELOC(pp);
615 prev_propp = &pp->next;
616 namep = (char *) (pp + 1);
617 pp->name = PTRUNRELOC(namep);
618 strcpy(namep, "linux,phandle");
619 mem_start = ALIGNUL((unsigned long)namep + strlen(namep) + 1);
620 pp->value = (unsigned char *) PTRUNRELOC(&np->node);
621 pp->length = sizeof(np->node);
622 }
623 *prev_propp = NULL;
624
625 /* get the node's full name */
626 l = call_prom("package-to-path", 3, 1, node,
627 mem_start, mem_end - mem_start);
628 if (l >= 0) {
629 np->full_name = PTRUNRELOC((char *) mem_start);
630 *(char *)(mem_start + l) = 0;
631 mem_start = ALIGNUL(mem_start + l + 1);
632 }
633
634 /* do all our children */
635 child = call_prom("child", 1, 1, node);
636 while (child != 0) {
637 mem_start = inspect_node(child, np, mem_start, mem_end,
638 allnextpp);
639 child = call_prom("peer", 1, 1, child);
640 }
641
642 return mem_start;
643}
644
645unsigned long smp_chrp_cpu_nr __initdata = 0;
646
647/*
648 * With CHRP SMP we need to use the OF to start the other
649 * processors so we can't wait until smp_boot_cpus (the OF is
650 * trashed by then) so we have to put the processors into
651 * a holding pattern controlled by the kernel (not OF) before
652 * we destroy the OF.
653 *
654 * This uses a chunk of high memory, puts some holding pattern
655 * code there and sends the other processors off to there until
656 * smp_boot_cpus tells them to do something. We do that by using
657 * physical address 0x0. The holding pattern checks that address
658 * until its cpu # is there, when it is that cpu jumps to
659 * __secondary_start(). smp_boot_cpus() takes care of setting those
660 * values.
661 *
662 * We also use physical address 0x4 here to tell when a cpu
663 * is in its holding pattern code.
664 *
665 * -- Cort
666 *
667 * Note that we have to do this if we have more than one CPU,
668 * even if this is a UP kernel. Otherwise when we trash OF
669 * the other CPUs will start executing some random instructions
670 * and crash the system. -- paulus
671 */
672static void __init
673prom_hold_cpus(unsigned long mem)
674{
675 extern void __secondary_hold(void);
676 unsigned long i;
677 int cpu;
678 phandle node;
679 char type[16], *path;
680 unsigned int reg;
681
682 /*
683 * XXX: hack to make sure we're chrp, assume that if we're
684 * chrp we have a device_type property -- Cort
685 */
686 node = call_prom("finddevice", 1, 1, "/");
687 if (call_prom("getprop", 4, 1, node,
688 "device_type", type, sizeof(type)) <= 0)
689 return;
690
691 /* copy the holding pattern code to someplace safe (0) */
692 /* the holding pattern is now within the first 0x100
693 bytes of the kernel image -- paulus */
694 memcpy((void *)0, _stext, 0x100);
695 flush_icache_range(0, 0x100);
696
697 /* look for cpus */
698 *(unsigned long *)(0x0) = 0;
699 asm volatile("dcbf 0,%0": : "r" (0) : "memory");
700 for (node = 0; prom_next_node(&node); ) {
701 type[0] = 0;
702 call_prom("getprop", 4, 1, node, "device_type",
703 type, sizeof(type));
704 if (strcmp(type, "cpu") != 0)
705 continue;
706 path = (char *) mem;
707 memset(path, 0, 256);
708 if (call_prom("package-to-path", 3, 1, node, path, 255) < 0)
709 continue;
710 reg = -1;
711 call_prom("getprop", 4, 1, node, "reg", &reg, sizeof(reg));
712 cpu = smp_chrp_cpu_nr++;
713#ifdef CONFIG_SMP
714 smp_hw_index[cpu] = reg;
715#endif /* CONFIG_SMP */
716 /* XXX: hack - don't start cpu 0, this cpu -- Cort */
717 if (cpu == 0)
718 continue;
719 prom_print("starting cpu ");
720 prom_print(path);
721 *(ulong *)(0x4) = 0;
722 call_prom("start-cpu", 3, 0, node,
723 (char *)__secondary_hold - _stext, cpu);
724 prom_print("...");
725 for ( i = 0 ; (i < 10000) && (*(ulong *)(0x4) == 0); i++ )
726 ;
727 if (*(ulong *)(0x4) == cpu)
728 prom_print("ok\n");
729 else {
730 prom_print("failed: ");
731 prom_print_hex(*(ulong *)0x4);
732 prom_print("\n");
733 }
734 }
735}
736
737static void __init
738prom_instantiate_rtas(void)
739{
740 ihandle prom_rtas;
741 prom_arg_t result;
742
743 prom_rtas = call_prom("finddevice", 1, 1, "/rtas");
744 if (prom_rtas == -1)
745 return;
746
747 rtas_size = 0;
748 call_prom("getprop", 4, 1, prom_rtas,
749 "rtas-size", &rtas_size, sizeof(rtas_size));
750 prom_print("instantiating rtas");
751 if (rtas_size == 0) {
752 rtas_data = 0;
753 } else {
754 /*
755 * Ask OF for some space for RTAS.
756 * Actually OF has bugs so we just arbitrarily
757 * use memory at the 6MB point.
758 */
759 rtas_data = 6 << 20;
760 prom_print(" at ");
761 prom_print_hex(rtas_data);
762 }
763
764 prom_rtas = call_prom("open", 1, 1, "/rtas");
765 prom_print("...");
766 rtas_entry = 0;
767 if (call_prom_ret("call-method", 3, 2, &result,
768 "instantiate-rtas", prom_rtas, rtas_data) == 0)
769 rtas_entry = result;
770 if ((rtas_entry == -1) || (rtas_entry == 0))
771 prom_print(" failed\n");
772 else
773 prom_print(" done\n");
774}
775
776/*
777 * We enter here early on, when the Open Firmware prom is still
778 * handling exceptions and the MMU hash table for us.
779 */
780unsigned long __init
781prom_init(int r3, int r4, prom_entry pp)
782{
783 unsigned long mem;
784 ihandle prom_mmu;
785 unsigned long offset = reloc_offset();
786 int i, l;
787 char *p, *d;
788 unsigned long phys;
789 prom_arg_t result[3];
790 char model[32];
791 phandle node;
792 int rc;
793
794 /* Default */
795 phys = (unsigned long) &_stext;
796
797 /* First get a handle for the stdout device */
798 prom = pp;
799 prom_chosen = call_prom("finddevice", 1, 1, "/chosen");
800 if (prom_chosen == -1)
801 prom_exit();
802 if (call_prom("getprop", 4, 1, prom_chosen, "stdout",
803 &prom_stdout, sizeof(prom_stdout)) <= 0)
804 prom_exit();
805
806 /* Get the full OF pathname of the stdout device */
807 mem = (unsigned long) klimit + offset;
808 p = (char *) mem;
809 memset(p, 0, 256);
810 call_prom("instance-to-path", 3, 1, prom_stdout, p, 255);
811 of_stdout_device = p;
812 mem += strlen(p) + 1;
813
814 /* Get the boot device and translate it to a full OF pathname. */
815 p = (char *) mem;
816 l = call_prom("getprop", 4, 1, prom_chosen, "bootpath", p, 1<<20);
817 if (l > 0) {
818 p[l] = 0; /* should already be null-terminated */
819 bootpath = PTRUNRELOC(p);
820 mem += l + 1;
821 d = (char *) mem;
822 *d = 0;
823 call_prom("canon", 3, 1, p, d, 1<<20);
824 bootdevice = PTRUNRELOC(d);
825 mem = ALIGNUL(mem + strlen(d) + 1);
826 }
827
828 prom_instantiate_rtas();
829
830#ifdef CONFIG_POWER4
831 /*
832 * Find out how much memory we have and allocate a
833 * suitably-sized hash table.
834 */
835 prom_alloc_htab();
836#endif
837 mem = check_display(mem);
838
839 prom_print("copying OF device tree...");
840 mem = copy_device_tree(mem, mem + (1<<20));
841 prom_print("done\n");
842
843 prom_hold_cpus(mem);
844
845 klimit = (char *) (mem - offset);
846
847 node = call_prom("finddevice", 1, 1, "/");
848 rc = call_prom("getprop", 4, 1, node, "model", model, sizeof(model));
849 if (rc > 0 && !strncmp (model, "Pegasos", 7)
850 && strncmp (model, "Pegasos2", 8)) {
851 /* Pegasos 1 has a broken translate method in the OF,
852 * and furthermore the BATs are mapped 1:1 so the phys
853 * address calculated above is correct, so let's use
854 * it directly.
855 */
856 } else if (offset == 0) {
857 /* If we are already running at 0xc0000000, we assume we were
858 * loaded by an OF bootloader which did set a BAT for us.
859 * This breaks OF translate so we force phys to be 0.
860 */
861 prom_print("(already at 0xc0000000) phys=0\n");
862 phys = 0;
863 } else if (call_prom("getprop", 4, 1, prom_chosen, "mmu",
864 &prom_mmu, sizeof(prom_mmu)) <= 0) {
865 prom_print(" no MMU found\n");
866 } else if (call_prom_ret("call-method", 4, 4, result, "translate",
867 prom_mmu, &_stext, 1) != 0) {
868 prom_print(" (translate failed)\n");
869 } else {
870 /* We assume the phys. address size is 3 cells */
871 phys = result[2];
872 }
873
874 if (prom_disp_node != 0)
875 setup_disp_fake_bi(prom_disp_node);
876
877 /* Use quiesce call to get OF to shut down any devices it's using */
878 prom_print("Calling quiesce ...\n");
879 call_prom("quiesce", 0, 0);
880
881 /* Relocate various pointers which will be used once the
882 kernel is running at the address it was linked at. */
883 for (i = 0; i < prom_num_displays; ++i)
884 prom_display_paths[i] = PTRUNRELOC(prom_display_paths[i]);
885
886#ifdef CONFIG_SERIAL_CORE_CONSOLE
887 /* Relocate the of stdout for console autodetection */
888 of_stdout_device = PTRUNRELOC(of_stdout_device);
889#endif
890
891 prom_print("returning 0x");
892 prom_print_hex(phys);
893 prom_print("from prom_init\n");
894 prom_stdout = 0;
895
896 return phys;
897}
898
899/*
900 * early_get_property is used to access the device tree image prepared
901 * by BootX very early on, before the pointers in it have been relocated.
902 */
903static void * __init
904early_get_property(unsigned long base, unsigned long node, char *prop)
905{
906 struct device_node *np = (struct device_node *)(base + node);
907 struct property *pp;
908
909 for (pp = np->properties; pp != 0; pp = pp->next) {
910 pp = (struct property *) (base + (unsigned long)pp);
911 if (strcmp((char *)((unsigned long)pp->name + base),
912 prop) == 0) {
913 return (void *)((unsigned long)pp->value + base);
914 }
915 }
916 return NULL;
917}
918
919/* Is boot-info compatible ? */
920#define BOOT_INFO_IS_COMPATIBLE(bi) ((bi)->compatible_version <= BOOT_INFO_VERSION)
921#define BOOT_INFO_IS_V2_COMPATIBLE(bi) ((bi)->version >= 2)
922#define BOOT_INFO_IS_V4_COMPATIBLE(bi) ((bi)->version >= 4)
923
924void __init
925bootx_init(unsigned long r4, unsigned long phys)
926{
927 boot_infos_t *bi = (boot_infos_t *) r4;
928 unsigned long space;
929 unsigned long ptr, x;
930 char *model;
931
932 boot_infos = PTRUNRELOC(bi);
933 if (!BOOT_INFO_IS_V2_COMPATIBLE(bi))
934 bi->logicalDisplayBase = NULL;
935
936#ifdef CONFIG_BOOTX_TEXT
937 btext_init(bi);
938
939 /*
940 * Test if boot-info is compatible. Done only in config
941 * CONFIG_BOOTX_TEXT since there is nothing much we can do
942 * with an incompatible version, except display a message
943 * and eventually hang the processor...
944 *
945 * I'll try to keep enough of boot-info compatible in the
946 * future to always allow display of this message;
947 */
948 if (!BOOT_INFO_IS_COMPATIBLE(bi)) {
949 btext_drawstring(" !!! WARNING - Incompatible version of BootX !!!\n\n\n");
950 btext_flushscreen();
951 }
952#endif /* CONFIG_BOOTX_TEXT */
953
954 /* New BootX enters kernel with MMU off, i/os are not allowed
955 here. This hack will have been done by the boostrap anyway.
956 */
957 if (bi->version < 4) {
958 /*
959 * XXX If this is an iMac, turn off the USB controller.
960 */
961 model = (char *) early_get_property
962 (r4 + bi->deviceTreeOffset, 4, "model");
963 if (model
964 && (strcmp(model, "iMac,1") == 0
965 || strcmp(model, "PowerMac1,1") == 0)) {
966 out_le32((unsigned *)0x80880008, 1); /* XXX */
967 }
968 }
969
970 /* Move klimit to enclose device tree, args, ramdisk, etc... */
971 if (bi->version < 5) {
972 space = bi->deviceTreeOffset + bi->deviceTreeSize;
973 if (bi->ramDisk)
974 space = bi->ramDisk + bi->ramDiskSize;
975 } else
976 space = bi->totalParamsSize;
977 klimit = PTRUNRELOC((char *) bi + space);
978
979 /* New BootX will have flushed all TLBs and enters kernel with
980 MMU switched OFF, so this should not be useful anymore.
981 */
982 if (bi->version < 4) {
983 /*
984 * Touch each page to make sure the PTEs for them
985 * are in the hash table - the aim is to try to avoid
986 * getting DSI exceptions while copying the kernel image.
987 */
988 for (ptr = ((unsigned long) &_stext) & PAGE_MASK;
989 ptr < (unsigned long)bi + space; ptr += PAGE_SIZE)
990 x = *(volatile unsigned long *)ptr;
991 }
992
993#ifdef CONFIG_BOOTX_TEXT
994 /*
995 * Note that after we call btext_prepare_BAT, we can't do
996 * prom_draw*, flushscreen or clearscreen until we turn the MMU
997 * on, since btext_prepare_BAT sets disp_bi.logicalDisplayBase
998 * to a virtual address.
999 */
1000 btext_prepare_BAT();
1001#endif
1002}
diff --git a/arch/ppc/syslib/qspan_pci.c b/arch/ppc/syslib/qspan_pci.c
new file mode 100644
index 000000000000..57f4ed5e5ae1
--- /dev/null
+++ b/arch/ppc/syslib/qspan_pci.c
@@ -0,0 +1,381 @@
1/*
2 * QSpan pci routines.
3 * Most 8xx boards use the QSpan PCI bridge. The config address register
4 * is located 0x500 from the base of the bridge control/status registers.
5 * The data register is located at 0x504.
6 * This is a two step operation. First, the address register is written,
7 * then the data register is read/written as required.
8 * I don't know what to do about interrupts (yet).
9 *
10 * The RPX Classic implementation shares a chip select for normal
11 * PCI access and QSpan control register addresses. The selection is
12 * further selected by a bit setting in a board control register.
13 * Although it should happen, we disable interrupts during this operation
14 * to make sure some driver doesn't accidentally access the PCI while
15 * we have switched the chip select.
16 */
17
18#include <linux/config.h>
19#include <linux/kernel.h>
20#include <linux/pci.h>
21#include <linux/delay.h>
22#include <linux/string.h>
23#include <linux/init.h>
24
25#include <asm/io.h>
26#include <asm/mpc8xx.h>
27#include <asm/system.h>
28#include <asm/machdep.h>
29#include <asm/pci-bridge.h>
30
31
32/*
33 * This blows......
34 * When reading the configuration space, if something does not respond
35 * the bus times out and we get a machine check interrupt. So, the
36 * good ol' exception tables come to mind to trap it and return some
37 * value.
38 *
39 * On an error we just return a -1, since that is what the caller wants
40 * returned if nothing is present. I copied this from __get_user_asm,
41 * with the only difference of returning -1 instead of EFAULT.
42 * There is an associated hack in the machine check trap code.
43 *
44 * The QSPAN is also a big endian device, that is it makes the PCI
45 * look big endian to us. This presents a problem for the Linux PCI
46 * functions, which assume little endian. For example, we see the
47 * first 32-bit word like this:
48 * ------------------------
49 * | Device ID | Vendor ID |
50 * ------------------------
51 * If we read/write as a double word, that's OK. But in our world,
52 * when read as a word, device ID is at location 0, not location 2 as
53 * the little endian PCI would believe. We have to switch bits in
54 * the PCI addresses given to us to get the data to/from the correct
55 * byte lanes.
56 *
57 * The QSPAN only supports 4 bits of "slot" in the dev_fn instead of 5.
58 * It always forces the MS bit to zero. Therefore, dev_fn values
59 * greater than 128 are returned as "no device found" errors.
60 *
61 * The QSPAN can only perform long word (32-bit) configuration cycles.
62 * The "offset" must have the two LS bits set to zero. Read operations
63 * require we read the entire word and then sort out what should be
64 * returned. Write operations other than long word require that we
65 * read the long word, update the proper word or byte, then write the
66 * entire long word back.
67 *
68 * PCI Bridge hack. We assume (correctly) that bus 0 is the primary
69 * PCI bus from the QSPAN. If we are called with a bus number other
70 * than zero, we create a Type 1 configuration access that a downstream
71 * PCI bridge will interpret.
72 */
73
74#define __get_qspan_pci_config(x, addr, op) \
75 __asm__ __volatile__( \
76 "1: "op" %0,0(%1)\n" \
77 " eieio\n" \
78 "2:\n" \
79 ".section .fixup,\"ax\"\n" \
80 "3: li %0,-1\n" \
81 " b 2b\n" \
82 ".section __ex_table,\"a\"\n" \
83 " .align 2\n" \
84 " .long 1b,3b\n" \
85 ".text" \
86 : "=r"(x) : "r"(addr) : " %0")
87
88#define QS_CONFIG_ADDR ((volatile uint *)(PCI_CSR_ADDR + 0x500))
89#define QS_CONFIG_DATA ((volatile uint *)(PCI_CSR_ADDR + 0x504))
90
91#define mk_config_addr(bus, dev, offset) \
92 (((bus)<<16) | ((dev)<<8) | (offset & 0xfc))
93
94#define mk_config_type1(bus, dev, offset) \
95 mk_config_addr(bus, dev, offset) | 1;
96
97static spinlock_t pcibios_lock = SPIN_LOCK_UNLOCKED;
98
99int qspan_pcibios_read_config_byte(unsigned char bus, unsigned char dev_fn,
100 unsigned char offset, unsigned char *val)
101{
102 uint temp;
103 u_char *cp;
104#ifdef CONFIG_RPXCLASSIC
105 unsigned long flags;
106#endif
107
108 if ((bus > 7) || (dev_fn > 127)) {
109 *val = 0xff;
110 return PCIBIOS_DEVICE_NOT_FOUND;
111 }
112
113#ifdef CONFIG_RPXCLASSIC
114 /* disable interrupts */
115 spin_lock_irqsave(&pcibios_lock, flags);
116 *((uint *)RPX_CSR_ADDR) &= ~BCSR2_QSPACESEL;
117 eieio();
118#endif
119
120 if (bus == 0)
121 *QS_CONFIG_ADDR = mk_config_addr(bus, dev_fn, offset);
122 else
123 *QS_CONFIG_ADDR = mk_config_type1(bus, dev_fn, offset);
124 __get_qspan_pci_config(temp, QS_CONFIG_DATA, "lwz");
125
126#ifdef CONFIG_RPXCLASSIC
127 *((uint *)RPX_CSR_ADDR) |= BCSR2_QSPACESEL;
128 eieio();
129 spin_unlock_irqrestore(&pcibios_lock, flags);
130#endif
131
132 offset ^= 0x03;
133 cp = ((u_char *)&temp) + (offset & 0x03);
134 *val = *cp;
135 return PCIBIOS_SUCCESSFUL;
136}
137
138int qspan_pcibios_read_config_word(unsigned char bus, unsigned char dev_fn,
139 unsigned char offset, unsigned short *val)
140{
141 uint temp;
142 ushort *sp;
143#ifdef CONFIG_RPXCLASSIC
144 unsigned long flags;
145#endif
146
147 if ((bus > 7) || (dev_fn > 127)) {
148 *val = 0xffff;
149 return PCIBIOS_DEVICE_NOT_FOUND;
150 }
151
152#ifdef CONFIG_RPXCLASSIC
153 /* disable interrupts */
154 spin_lock_irqsave(&pcibios_lock, flags);
155 *((uint *)RPX_CSR_ADDR) &= ~BCSR2_QSPACESEL;
156 eieio();
157#endif
158
159 if (bus == 0)
160 *QS_CONFIG_ADDR = mk_config_addr(bus, dev_fn, offset);
161 else
162 *QS_CONFIG_ADDR = mk_config_type1(bus, dev_fn, offset);
163 __get_qspan_pci_config(temp, QS_CONFIG_DATA, "lwz");
164 offset ^= 0x02;
165
166#ifdef CONFIG_RPXCLASSIC
167 *((uint *)RPX_CSR_ADDR) |= BCSR2_QSPACESEL;
168 eieio();
169 spin_unlock_irqrestore(&pcibios_lock, flags);
170#endif
171
172 sp = ((ushort *)&temp) + ((offset >> 1) & 1);
173 *val = *sp;
174 return PCIBIOS_SUCCESSFUL;
175}
176
177int qspan_pcibios_read_config_dword(unsigned char bus, unsigned char dev_fn,
178 unsigned char offset, unsigned int *val)
179{
180#ifdef CONFIG_RPXCLASSIC
181 unsigned long flags;
182#endif
183
184 if ((bus > 7) || (dev_fn > 127)) {
185 *val = 0xffffffff;
186 return PCIBIOS_DEVICE_NOT_FOUND;
187 }
188
189#ifdef CONFIG_RPXCLASSIC
190 /* disable interrupts */
191 spin_lock_irqsave(&pcibios_lock, flags);
192 *((uint *)RPX_CSR_ADDR) &= ~BCSR2_QSPACESEL;
193 eieio();
194#endif
195
196 if (bus == 0)
197 *QS_CONFIG_ADDR = mk_config_addr(bus, dev_fn, offset);
198 else
199 *QS_CONFIG_ADDR = mk_config_type1(bus, dev_fn, offset);
200 __get_qspan_pci_config(*val, QS_CONFIG_DATA, "lwz");
201
202#ifdef CONFIG_RPXCLASSIC
203 *((uint *)RPX_CSR_ADDR) |= BCSR2_QSPACESEL;
204 eieio();
205 spin_unlock_irqrestore(&pcibios_lock, flags);
206#endif
207
208 return PCIBIOS_SUCCESSFUL;
209}
210
211int qspan_pcibios_write_config_byte(unsigned char bus, unsigned char dev_fn,
212 unsigned char offset, unsigned char val)
213{
214 uint temp;
215 u_char *cp;
216#ifdef CONFIG_RPXCLASSIC
217 unsigned long flags;
218#endif
219
220 if ((bus > 7) || (dev_fn > 127))
221 return PCIBIOS_DEVICE_NOT_FOUND;
222
223 qspan_pcibios_read_config_dword(bus, dev_fn, offset, &temp);
224
225 offset ^= 0x03;
226 cp = ((u_char *)&temp) + (offset & 0x03);
227 *cp = val;
228
229#ifdef CONFIG_RPXCLASSIC
230 /* disable interrupts */
231 spin_lock_irqsave(&pcibios_lock, flags);
232 *((uint *)RPX_CSR_ADDR) &= ~BCSR2_QSPACESEL;
233 eieio();
234#endif
235
236 if (bus == 0)
237 *QS_CONFIG_ADDR = mk_config_addr(bus, dev_fn, offset);
238 else
239 *QS_CONFIG_ADDR = mk_config_type1(bus, dev_fn, offset);
240 *QS_CONFIG_DATA = temp;
241
242#ifdef CONFIG_RPXCLASSIC
243 *((uint *)RPX_CSR_ADDR) |= BCSR2_QSPACESEL;
244 eieio();
245 spin_unlock_irqrestore(&pcibios_lock, flags);
246#endif
247
248 return PCIBIOS_SUCCESSFUL;
249}
250
251int qspan_pcibios_write_config_word(unsigned char bus, unsigned char dev_fn,
252 unsigned char offset, unsigned short val)
253{
254 uint temp;
255 ushort *sp;
256#ifdef CONFIG_RPXCLASSIC
257 unsigned long flags;
258#endif
259
260 if ((bus > 7) || (dev_fn > 127))
261 return PCIBIOS_DEVICE_NOT_FOUND;
262
263 qspan_pcibios_read_config_dword(bus, dev_fn, offset, &temp);
264
265 offset ^= 0x02;
266 sp = ((ushort *)&temp) + ((offset >> 1) & 1);
267 *sp = val;
268
269#ifdef CONFIG_RPXCLASSIC
270 /* disable interrupts */
271 spin_lock_irqsave(&pcibios_lock, flags);
272 *((uint *)RPX_CSR_ADDR) &= ~BCSR2_QSPACESEL;
273 eieio();
274#endif
275
276 if (bus == 0)
277 *QS_CONFIG_ADDR = mk_config_addr(bus, dev_fn, offset);
278 else
279 *QS_CONFIG_ADDR = mk_config_type1(bus, dev_fn, offset);
280 *QS_CONFIG_DATA = temp;
281
282#ifdef CONFIG_RPXCLASSIC
283 *((uint *)RPX_CSR_ADDR) |= BCSR2_QSPACESEL;
284 eieio();
285 spin_unlock_irqrestore(&pcibios_lock, flags);
286#endif
287
288 return PCIBIOS_SUCCESSFUL;
289}
290
291int qspan_pcibios_write_config_dword(unsigned char bus, unsigned char dev_fn,
292 unsigned char offset, unsigned int val)
293{
294#ifdef CONFIG_RPXCLASSIC
295 unsigned long flags;
296#endif
297
298 if ((bus > 7) || (dev_fn > 127))
299 return PCIBIOS_DEVICE_NOT_FOUND;
300
301#ifdef CONFIG_RPXCLASSIC
302 /* disable interrupts */
303 spin_lock_irqsave(&pcibios_lock, flags);
304 *((uint *)RPX_CSR_ADDR) &= ~BCSR2_QSPACESEL;
305 eieio();
306#endif
307
308 if (bus == 0)
309 *QS_CONFIG_ADDR = mk_config_addr(bus, dev_fn, offset);
310 else
311 *QS_CONFIG_ADDR = mk_config_type1(bus, dev_fn, offset);
312 *(unsigned int *)QS_CONFIG_DATA = val;
313
314#ifdef CONFIG_RPXCLASSIC
315 *((uint *)RPX_CSR_ADDR) |= BCSR2_QSPACESEL;
316 eieio();
317 spin_unlock_irqrestore(&pcibios_lock, flags);
318#endif
319
320 return PCIBIOS_SUCCESSFUL;
321}
322
323int qspan_pcibios_find_device(unsigned short vendor, unsigned short dev_id,
324 unsigned short index, unsigned char *bus_ptr,
325 unsigned char *dev_fn_ptr)
326{
327 int num, devfn;
328 unsigned int x, vendev;
329
330 if (vendor == 0xffff)
331 return PCIBIOS_BAD_VENDOR_ID;
332 vendev = (dev_id << 16) + vendor;
333 num = 0;
334 for (devfn = 0; devfn < 32; devfn++) {
335 qspan_pcibios_read_config_dword(0, devfn<<3, PCI_VENDOR_ID, &x);
336 if (x == vendev) {
337 if (index == num) {
338 *bus_ptr = 0;
339 *dev_fn_ptr = devfn<<3;
340 return PCIBIOS_SUCCESSFUL;
341 }
342 ++num;
343 }
344 }
345 return PCIBIOS_DEVICE_NOT_FOUND;
346}
347
348int qspan_pcibios_find_class(unsigned int class_code, unsigned short index,
349 unsigned char *bus_ptr, unsigned char *dev_fn_ptr)
350{
351 int devnr, x, num;
352
353 num = 0;
354 for (devnr = 0; devnr < 32; devnr++) {
355 qspan_pcibios_read_config_dword(0, devnr<<3, PCI_CLASS_REVISION, &x);
356 if ((x>>8) == class_code) {
357 if (index == num) {
358 *bus_ptr = 0;
359 *dev_fn_ptr = devnr<<3;
360 return PCIBIOS_SUCCESSFUL;
361 }
362 ++num;
363 }
364 }
365 return PCIBIOS_DEVICE_NOT_FOUND;
366}
367
368void __init
369m8xx_pcibios_fixup(void))
370{
371 /* Lots to do here, all board and configuration specific. */
372}
373
374void __init
375m8xx_setup_pci_ptrs(void))
376{
377 set_config_access_method(qspan);
378
379 ppc_md.pcibios_fixup = m8xx_pcibios_fixup;
380}
381
diff --git a/arch/ppc/syslib/todc_time.c b/arch/ppc/syslib/todc_time.c
new file mode 100644
index 000000000000..1323c641c19d
--- /dev/null
+++ b/arch/ppc/syslib/todc_time.c
@@ -0,0 +1,513 @@
1/*
2 * arch/ppc/syslib/todc_time.c
3 *
4 * Time of Day Clock support for the M48T35, M48T37, M48T59, and MC146818
5 * Real Time Clocks/Timekeepers.
6 *
7 * Author: Mark A. Greer
8 * mgreer@mvista.com
9 *
10 * 2001-2004 (c) MontaVista, Software, Inc. This file is licensed under
11 * the terms of the GNU General Public License version 2. This program
12 * is licensed "as is" without any warranty of any kind, whether express
13 * or implied.
14 */
15#include <linux/errno.h>
16#include <linux/init.h>
17#include <linux/kernel.h>
18#include <linux/time.h>
19#include <linux/timex.h>
20#include <linux/bcd.h>
21#include <linux/mc146818rtc.h>
22
23#include <asm/machdep.h>
24#include <asm/io.h>
25#include <asm/time.h>
26#include <asm/todc.h>
27
28/*
29 * Depending on the hardware on your board and your board design, the
30 * RTC/NVRAM may be accessed either directly (like normal memory) or via
31 * address/data registers. If your board uses the direct method, set
32 * 'nvram_data' to the base address of your nvram and leave 'nvram_as0' and
33 * 'nvram_as1' NULL. If your board uses address/data regs to access nvram,
34 * set 'nvram_as0' to the address of the lower byte, set 'nvram_as1' to the
35 * address of the upper byte (leave NULL if using mc146818), and set
36 * 'nvram_data' to the address of the 8-bit data register.
37 *
38 * In order to break the assumption that the RTC and NVRAM are accessed by
39 * the same mechanism, you need to explicitly set 'ppc_md.rtc_read_val' and
40 * 'ppc_md.rtc_write_val', otherwise the values of 'ppc_md.rtc_read_val'
41 * and 'ppc_md.rtc_write_val' will be used.
42 *
43 * Note: Even though the documentation for the various RTC chips say that it
44 * take up to a second before it starts updating once the 'R' bit is
45 * cleared, they always seem to update even though we bang on it many
46 * times a second. This is true, except for the Dallas Semi 1746/1747
47 * (possibly others). Those chips seem to have a real problem whenever
48 * we set the 'R' bit before reading them, they basically stop counting.
49 * --MAG
50 */
51
52/*
53 * 'todc_info' should be initialized in your *_setup.c file to
54 * point to a fully initialized 'todc_info_t' structure.
55 * This structure holds all the register offsets for your particular
56 * TODC/RTC chip.
57 * TODC_ALLOC()/TODC_INIT() will allocate and initialize this table for you.
58 */
59
60#ifdef RTC_FREQ_SELECT
61#undef RTC_FREQ_SELECT
62#define RTC_FREQ_SELECT control_b /* Register A */
63#endif
64
65#ifdef RTC_CONTROL
66#undef RTC_CONTROL
67#define RTC_CONTROL control_a /* Register B */
68#endif
69
70#ifdef RTC_INTR_FLAGS
71#undef RTC_INTR_FLAGS
72#define RTC_INTR_FLAGS watchdog /* Register C */
73#endif
74
75#ifdef RTC_VALID
76#undef RTC_VALID
77#define RTC_VALID interrupts /* Register D */
78#endif
79
80/* Access routines when RTC accessed directly (like normal memory) */
81u_char
82todc_direct_read_val(int addr)
83{
84 return readb((void __iomem *)(todc_info->nvram_data + addr));
85}
86
87void
88todc_direct_write_val(int addr, unsigned char val)
89{
90 writeb(val, (void __iomem *)(todc_info->nvram_data + addr));
91 return;
92}
93
94/* Access routines for accessing m48txx type chips via addr/data regs */
95u_char
96todc_m48txx_read_val(int addr)
97{
98 outb(addr, todc_info->nvram_as0);
99 outb(addr>>todc_info->as0_bits, todc_info->nvram_as1);
100 return inb(todc_info->nvram_data);
101}
102
103void
104todc_m48txx_write_val(int addr, unsigned char val)
105{
106 outb(addr, todc_info->nvram_as0);
107 outb(addr>>todc_info->as0_bits, todc_info->nvram_as1);
108 outb(val, todc_info->nvram_data);
109 return;
110}
111
112/* Access routines for accessing mc146818 type chips via addr/data regs */
113u_char
114todc_mc146818_read_val(int addr)
115{
116 outb_p(addr, todc_info->nvram_as0);
117 return inb_p(todc_info->nvram_data);
118}
119
120void
121todc_mc146818_write_val(int addr, unsigned char val)
122{
123 outb_p(addr, todc_info->nvram_as0);
124 outb_p(val, todc_info->nvram_data);
125}
126
127
128/*
129 * Routines to make RTC chips with NVRAM buried behind an addr/data pair
130 * have the NVRAM and clock regs appear at the same level.
131 * The NVRAM will appear to start at addr 0 and the clock regs will appear
132 * to start immediately after the NVRAM (actually, start at offset
133 * todc_info->nvram_size).
134 */
135static inline u_char
136todc_read_val(int addr)
137{
138 u_char val;
139
140 if (todc_info->sw_flags & TODC_FLAG_2_LEVEL_NVRAM) {
141 if (addr < todc_info->nvram_size) { /* NVRAM */
142 ppc_md.rtc_write_val(todc_info->nvram_addr_reg, addr);
143 val = ppc_md.rtc_read_val(todc_info->nvram_data_reg);
144 }
145 else { /* Clock Reg */
146 addr -= todc_info->nvram_size;
147 val = ppc_md.rtc_read_val(addr);
148 }
149 }
150 else {
151 val = ppc_md.rtc_read_val(addr);
152 }
153
154 return val;
155}
156
157static inline void
158todc_write_val(int addr, u_char val)
159{
160 if (todc_info->sw_flags & TODC_FLAG_2_LEVEL_NVRAM) {
161 if (addr < todc_info->nvram_size) { /* NVRAM */
162 ppc_md.rtc_write_val(todc_info->nvram_addr_reg, addr);
163 ppc_md.rtc_write_val(todc_info->nvram_data_reg, val);
164 }
165 else { /* Clock Reg */
166 addr -= todc_info->nvram_size;
167 ppc_md.rtc_write_val(addr, val);
168 }
169 }
170 else {
171 ppc_md.rtc_write_val(addr, val);
172 }
173}
174
175/*
176 * TODC routines
177 *
178 * There is some ugly stuff in that there are assumptions for the mc146818.
179 *
180 * Assumptions:
181 * - todc_info->control_a has the offset as mc146818 Register B reg
182 * - todc_info->control_b has the offset as mc146818 Register A reg
183 * - m48txx control reg's write enable or 'W' bit is same as
184 * mc146818 Register B 'SET' bit (i.e., 0x80)
185 *
186 * These assumptions were made to make the code simpler.
187 */
188long __init
189todc_time_init(void)
190{
191 u_char cntl_b;
192
193 if (!ppc_md.rtc_read_val)
194 ppc_md.rtc_read_val = ppc_md.nvram_read_val;
195 if (!ppc_md.rtc_write_val)
196 ppc_md.rtc_write_val = ppc_md.nvram_write_val;
197
198 cntl_b = todc_read_val(todc_info->control_b);
199
200 if (todc_info->rtc_type == TODC_TYPE_MC146818) {
201 if ((cntl_b & 0x70) != 0x20) {
202 printk(KERN_INFO "TODC %s %s\n",
203 "real-time-clock was stopped.",
204 "Now starting...");
205 cntl_b &= ~0x70;
206 cntl_b |= 0x20;
207 }
208
209 todc_write_val(todc_info->control_b, cntl_b);
210 } else if (todc_info->rtc_type == TODC_TYPE_DS17285) {
211 u_char mode;
212
213 mode = todc_read_val(TODC_TYPE_DS17285_CNTL_A);
214 /* Make sure countdown clear is not set */
215 mode &= ~0x40;
216 /* Enable oscillator, extended register set */
217 mode |= 0x30;
218 todc_write_val(TODC_TYPE_DS17285_CNTL_A, mode);
219
220 } else if (todc_info->rtc_type == TODC_TYPE_DS1501) {
221 u_char month;
222
223 todc_info->enable_read = TODC_DS1501_CNTL_B_TE;
224 todc_info->enable_write = TODC_DS1501_CNTL_B_TE;
225
226 month = todc_read_val(todc_info->month);
227
228 if ((month & 0x80) == 0x80) {
229 printk(KERN_INFO "TODC %s %s\n",
230 "real-time-clock was stopped.",
231 "Now starting...");
232 month &= ~0x80;
233 todc_write_val(todc_info->month, month);
234 }
235
236 cntl_b &= ~TODC_DS1501_CNTL_B_TE;
237 todc_write_val(todc_info->control_b, cntl_b);
238 } else { /* must be a m48txx type */
239 u_char cntl_a;
240
241 todc_info->enable_read = TODC_MK48TXX_CNTL_A_R;
242 todc_info->enable_write = TODC_MK48TXX_CNTL_A_W;
243
244 cntl_a = todc_read_val(todc_info->control_a);
245
246 /* Check & clear STOP bit in control B register */
247 if (cntl_b & TODC_MK48TXX_DAY_CB) {
248 printk(KERN_INFO "TODC %s %s\n",
249 "real-time-clock was stopped.",
250 "Now starting...");
251
252 cntl_a |= todc_info->enable_write;
253 cntl_b &= ~TODC_MK48TXX_DAY_CB;/* Start Oscil */
254
255 todc_write_val(todc_info->control_a, cntl_a);
256 todc_write_val(todc_info->control_b, cntl_b);
257 }
258
259 /* Make sure READ & WRITE bits are cleared. */
260 cntl_a &= ~(todc_info->enable_write |
261 todc_info->enable_read);
262 todc_write_val(todc_info->control_a, cntl_a);
263 }
264
265 return 0;
266}
267
268/*
269 * There is some ugly stuff in that there are assumptions that for a mc146818,
270 * the todc_info->control_a has the offset of the mc146818 Register B reg and
271 * that the register'ss 'SET' bit is the same as the m48txx's write enable
272 * bit in the control register of the m48txx (i.e., 0x80).
273 *
274 * It was done to make the code look simpler.
275 */
276ulong
277todc_get_rtc_time(void)
278{
279 uint year = 0, mon = 0, day = 0, hour = 0, min = 0, sec = 0;
280 uint limit, i;
281 u_char save_control, uip = 0;
282
283 spin_lock(&rtc_lock);
284 save_control = todc_read_val(todc_info->control_a);
285
286 if (todc_info->rtc_type != TODC_TYPE_MC146818) {
287 limit = 1;
288
289 switch (todc_info->rtc_type) {
290 case TODC_TYPE_DS1553:
291 case TODC_TYPE_DS1557:
292 case TODC_TYPE_DS1743:
293 case TODC_TYPE_DS1746: /* XXXX BAD HACK -> FIX */
294 case TODC_TYPE_DS1747:
295 case TODC_TYPE_DS17285:
296 break;
297 default:
298 todc_write_val(todc_info->control_a,
299 (save_control | todc_info->enable_read));
300 }
301 }
302 else {
303 limit = 100000000;
304 }
305
306 for (i=0; i<limit; i++) {
307 if (todc_info->rtc_type == TODC_TYPE_MC146818) {
308 uip = todc_read_val(todc_info->RTC_FREQ_SELECT);
309 }
310
311 sec = todc_read_val(todc_info->seconds) & 0x7f;
312 min = todc_read_val(todc_info->minutes) & 0x7f;
313 hour = todc_read_val(todc_info->hours) & 0x3f;
314 day = todc_read_val(todc_info->day_of_month) & 0x3f;
315 mon = todc_read_val(todc_info->month) & 0x1f;
316 year = todc_read_val(todc_info->year) & 0xff;
317
318 if (todc_info->rtc_type == TODC_TYPE_MC146818) {
319 uip |= todc_read_val(todc_info->RTC_FREQ_SELECT);
320 if ((uip & RTC_UIP) == 0) break;
321 }
322 }
323
324 if (todc_info->rtc_type != TODC_TYPE_MC146818) {
325 switch (todc_info->rtc_type) {
326 case TODC_TYPE_DS1553:
327 case TODC_TYPE_DS1557:
328 case TODC_TYPE_DS1743:
329 case TODC_TYPE_DS1746: /* XXXX BAD HACK -> FIX */
330 case TODC_TYPE_DS1747:
331 case TODC_TYPE_DS17285:
332 break;
333 default:
334 save_control &= ~(todc_info->enable_read);
335 todc_write_val(todc_info->control_a,
336 save_control);
337 }
338 }
339 spin_unlock(&rtc_lock);
340
341 if ((todc_info->rtc_type != TODC_TYPE_MC146818) ||
342 ((save_control & RTC_DM_BINARY) == 0) ||
343 RTC_ALWAYS_BCD) {
344
345 BCD_TO_BIN(sec);
346 BCD_TO_BIN(min);
347 BCD_TO_BIN(hour);
348 BCD_TO_BIN(day);
349 BCD_TO_BIN(mon);
350 BCD_TO_BIN(year);
351 }
352
353 year = year + 1900;
354 if (year < 1970) {
355 year += 100;
356 }
357
358 return mktime(year, mon, day, hour, min, sec);
359}
360
361int
362todc_set_rtc_time(unsigned long nowtime)
363{
364 struct rtc_time tm;
365 u_char save_control, save_freq_select = 0;
366
367 spin_lock(&rtc_lock);
368 to_tm(nowtime, &tm);
369
370 save_control = todc_read_val(todc_info->control_a);
371
372 /* Assuming MK48T59_RTC_CA_WRITE & RTC_SET are equal */
373 todc_write_val(todc_info->control_a,
374 (save_control | todc_info->enable_write));
375 save_control &= ~(todc_info->enable_write); /* in case it was set */
376
377 if (todc_info->rtc_type == TODC_TYPE_MC146818) {
378 save_freq_select = todc_read_val(todc_info->RTC_FREQ_SELECT);
379 todc_write_val(todc_info->RTC_FREQ_SELECT,
380 save_freq_select | RTC_DIV_RESET2);
381 }
382
383
384 tm.tm_year = (tm.tm_year - 1900) % 100;
385
386 if ((todc_info->rtc_type != TODC_TYPE_MC146818) ||
387 ((save_control & RTC_DM_BINARY) == 0) ||
388 RTC_ALWAYS_BCD) {
389
390 BIN_TO_BCD(tm.tm_sec);
391 BIN_TO_BCD(tm.tm_min);
392 BIN_TO_BCD(tm.tm_hour);
393 BIN_TO_BCD(tm.tm_mon);
394 BIN_TO_BCD(tm.tm_mday);
395 BIN_TO_BCD(tm.tm_year);
396 }
397
398 todc_write_val(todc_info->seconds, tm.tm_sec);
399 todc_write_val(todc_info->minutes, tm.tm_min);
400 todc_write_val(todc_info->hours, tm.tm_hour);
401 todc_write_val(todc_info->month, tm.tm_mon);
402 todc_write_val(todc_info->day_of_month, tm.tm_mday);
403 todc_write_val(todc_info->year, tm.tm_year);
404
405 todc_write_val(todc_info->control_a, save_control);
406
407 if (todc_info->rtc_type == TODC_TYPE_MC146818) {
408 todc_write_val(todc_info->RTC_FREQ_SELECT, save_freq_select);
409 }
410 spin_unlock(&rtc_lock);
411
412 return 0;
413}
414
415/*
416 * Manipulates read bit to reliably read seconds at a high rate.
417 */
418static unsigned char __init todc_read_timereg(int addr)
419{
420 unsigned char save_control = 0, val;
421
422 switch (todc_info->rtc_type) {
423 case TODC_TYPE_DS1553:
424 case TODC_TYPE_DS1557:
425 case TODC_TYPE_DS1746: /* XXXX BAD HACK -> FIX */
426 case TODC_TYPE_DS1747:
427 case TODC_TYPE_DS17285:
428 case TODC_TYPE_MC146818:
429 break;
430 default:
431 save_control = todc_read_val(todc_info->control_a);
432 todc_write_val(todc_info->control_a,
433 (save_control | todc_info->enable_read));
434 }
435 val = todc_read_val(addr);
436
437 switch (todc_info->rtc_type) {
438 case TODC_TYPE_DS1553:
439 case TODC_TYPE_DS1557:
440 case TODC_TYPE_DS1746: /* XXXX BAD HACK -> FIX */
441 case TODC_TYPE_DS1747:
442 case TODC_TYPE_DS17285:
443 case TODC_TYPE_MC146818:
444 break;
445 default:
446 save_control &= ~(todc_info->enable_read);
447 todc_write_val(todc_info->control_a, save_control);
448 }
449
450 return val;
451}
452
453/*
454 * This was taken from prep_setup.c
455 * Use the NVRAM RTC to time a second to calibrate the decrementer.
456 */
457void __init
458todc_calibrate_decr(void)
459{
460 ulong freq;
461 ulong tbl, tbu;
462 long i, loop_count;
463 u_char sec;
464
465 todc_time_init();
466
467 /*
468 * Actually this is bad for precision, we should have a loop in
469 * which we only read the seconds counter. todc_read_val writes
470 * the address bytes on every call and this takes a lot of time.
471 * Perhaps an nvram_wait_change method returning a time
472 * stamp with a loop count as parameter would be the solution.
473 */
474 /*
475 * Need to make sure the tbl doesn't roll over so if tbu increments
476 * during this test, we need to do it again.
477 */
478 loop_count = 0;
479
480 sec = todc_read_timereg(todc_info->seconds) & 0x7f;
481
482 do {
483 tbu = get_tbu();
484
485 for (i = 0 ; i < 10000000 ; i++) {/* may take up to 1 second */
486 tbl = get_tbl();
487
488 if ((todc_read_timereg(todc_info->seconds) & 0x7f) != sec) {
489 break;
490 }
491 }
492
493 sec = todc_read_timereg(todc_info->seconds) & 0x7f;
494
495 for (i = 0 ; i < 10000000 ; i++) { /* Should take 1 second */
496 freq = get_tbl();
497
498 if ((todc_read_timereg(todc_info->seconds) & 0x7f) != sec) {
499 break;
500 }
501 }
502
503 freq -= tbl;
504 } while ((get_tbu() != tbu) && (++loop_count < 2));
505
506 printk("time_init: decrementer frequency = %lu.%.6lu MHz\n",
507 freq/1000000, freq%1000000);
508
509 tb_ticks_per_jiffy = freq / HZ;
510 tb_to_us = mulhwu_scale_factor(freq, 1000000);
511
512 return;
513}
diff --git a/arch/ppc/syslib/xilinx_pic.c b/arch/ppc/syslib/xilinx_pic.c
new file mode 100644
index 000000000000..e0bd66f0847a
--- /dev/null
+++ b/arch/ppc/syslib/xilinx_pic.c
@@ -0,0 +1,157 @@
1/*
2 * arch/ppc/syslib/xilinx_pic.c
3 *
4 * Interrupt controller driver for Xilinx Virtex-II Pro.
5 *
6 * Author: MontaVista Software, Inc.
7 * source@mvista.com
8 *
9 * 2002-2004 (c) MontaVista Software, Inc. This file is licensed under
10 * the terms of the GNU General Public License version 2. This program
11 * is licensed "as is" without any warranty of any kind, whether express
12 * or implied.
13 */
14
15#include <linux/init.h>
16#include <linux/irq.h>
17#include <asm/io.h>
18#include <asm/xparameters.h>
19#include <asm/ibm4xx.h>
20
21/* No one else should require these constants, so define them locally here. */
22#define ISR 0 /* Interrupt Status Register */
23#define IPR 1 /* Interrupt Pending Register */
24#define IER 2 /* Interrupt Enable Register */
25#define IAR 3 /* Interrupt Acknowledge Register */
26#define SIE 4 /* Set Interrupt Enable bits */
27#define CIE 5 /* Clear Interrupt Enable bits */
28#define IVR 6 /* Interrupt Vector Register */
29#define MER 7 /* Master Enable Register */
30
31#if XPAR_XINTC_USE_DCR == 0
32static volatile u32 *intc;
33#define intc_out_be32(addr, mask) out_be32((addr), (mask))
34#define intc_in_be32(addr) in_be32((addr))
35#else
36#define intc XPAR_INTC_0_BASEADDR
37#define intc_out_be32(addr, mask) mtdcr((addr), (mask))
38#define intc_in_be32(addr) mfdcr((addr))
39#endif
40
41static void
42xilinx_intc_enable(unsigned int irq)
43{
44 unsigned long mask = (0x00000001 << (irq & 31));
45 pr_debug("enable: %d\n", irq);
46 intc_out_be32(intc + SIE, mask);
47}
48
49static void
50xilinx_intc_disable(unsigned int irq)
51{
52 unsigned long mask = (0x00000001 << (irq & 31));
53 pr_debug("disable: %d\n", irq);
54 intc_out_be32(intc + CIE, mask);
55}
56
57static void
58xilinx_intc_disable_and_ack(unsigned int irq)
59{
60 unsigned long mask = (0x00000001 << (irq & 31));
61 pr_debug("disable_and_ack: %d\n", irq);
62 intc_out_be32(intc + CIE, mask);
63 if (!(irq_desc[irq].status & IRQ_LEVEL))
64 intc_out_be32(intc + IAR, mask); /* ack edge triggered intr */
65}
66
67static void
68xilinx_intc_end(unsigned int irq)
69{
70 unsigned long mask = (0x00000001 << (irq & 31));
71
72 pr_debug("end: %d\n", irq);
73 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) {
74 intc_out_be32(intc + SIE, mask);
75 /* ack level sensitive intr */
76 if (irq_desc[irq].status & IRQ_LEVEL)
77 intc_out_be32(intc + IAR, mask);
78 }
79}
80
81static struct hw_interrupt_type xilinx_intc = {
82 "Xilinx Interrupt Controller",
83 NULL,
84 NULL,
85 xilinx_intc_enable,
86 xilinx_intc_disable,
87 xilinx_intc_disable_and_ack,
88 xilinx_intc_end,
89 0
90};
91
92int
93xilinx_pic_get_irq(struct pt_regs *regs)
94{
95 int irq;
96
97 /*
98 * NOTE: This function is the one that needs to be improved in
99 * order to handle multiple interrupt controllers. It currently
100 * is hardcoded to check for interrupts only on the first INTC.
101 */
102
103 irq = intc_in_be32(intc + IVR);
104 if (irq != -1)
105 irq = irq;
106
107 pr_debug("get_irq: %d\n", irq);
108
109 return (irq);
110}
111
112void __init
113ppc4xx_pic_init(void)
114{
115 int i;
116
117 /*
118 * NOTE: The assumption here is that NR_IRQS is 32 or less
119 * (NR_IRQS is 32 for PowerPC 405 cores by default).
120 */
121#if (NR_IRQS > 32)
122#error NR_IRQS > 32 not supported
123#endif
124
125#if XPAR_XINTC_USE_DCR == 0
126 intc = ioremap(XPAR_INTC_0_BASEADDR, 32);
127
128 printk(KERN_INFO "Xilinx INTC #0 at 0x%08lX mapped to 0x%08lX\n",
129 (unsigned long) XPAR_INTC_0_BASEADDR, (unsigned long) intc);
130#else
131 printk(KERN_INFO "Xilinx INTC #0 at 0x%08lX (DCR)\n",
132 (unsigned long) XPAR_INTC_0_BASEADDR);
133#endif
134
135 /*
136 * Disable all external interrupts until they are
137 * explicity requested.
138 */
139 intc_out_be32(intc + IER, 0);
140
141 /* Acknowledge any pending interrupts just in case. */
142 intc_out_be32(intc + IAR, ~(u32) 0);
143
144 /* Turn on the Master Enable. */
145 intc_out_be32(intc + MER, 0x3UL);
146
147 ppc_md.get_irq = xilinx_pic_get_irq;
148
149 for (i = 0; i < NR_IRQS; ++i) {
150 irq_desc[i].handler = &xilinx_intc;
151
152 if (XPAR_INTC_0_KIND_OF_INTR & (0x00000001 << i))
153 irq_desc[i].status &= ~IRQ_LEVEL;
154 else
155 irq_desc[i].status |= IRQ_LEVEL;
156 }
157}
diff --git a/arch/ppc/xmon/Makefile b/arch/ppc/xmon/Makefile
new file mode 100644
index 000000000000..9aa260b926f5
--- /dev/null
+++ b/arch/ppc/xmon/Makefile
@@ -0,0 +1,8 @@
1# Makefile for xmon
2
3ifdef CONFIG_8xx
4obj-y := start_8xx.o
5else
6obj-y := start.o
7endif
8obj-y += xmon.o ppc-dis.o ppc-opc.o subr_prf.o setjmp.o
diff --git a/arch/ppc/xmon/adb.c b/arch/ppc/xmon/adb.c
new file mode 100644
index 000000000000..e91384dcccac
--- /dev/null
+++ b/arch/ppc/xmon/adb.c
@@ -0,0 +1,212 @@
1/*
2 * Copyright (C) 1996 Paul Mackerras.
3 */
4#include "nonstdio.h"
5#include "privinst.h"
6
7#define scanhex xmon_scanhex
8#define skipbl xmon_skipbl
9
10#define ADB_B (*(volatile unsigned char *)0xf3016000)
11#define ADB_SR (*(volatile unsigned char *)0xf3017400)
12#define ADB_ACR (*(volatile unsigned char *)0xf3017600)
13#define ADB_IFR (*(volatile unsigned char *)0xf3017a00)
14
15static inline void eieio(void) { asm volatile ("eieio" : :); }
16
17#define N_ADB_LOG 1000
18struct adb_log {
19 unsigned char b;
20 unsigned char ifr;
21 unsigned char acr;
22 unsigned int time;
23} adb_log[N_ADB_LOG];
24int n_adb_log;
25
26void
27init_adb_log(void)
28{
29 adb_log[0].b = ADB_B;
30 adb_log[0].ifr = ADB_IFR;
31 adb_log[0].acr = ADB_ACR;
32 adb_log[0].time = get_dec();
33 n_adb_log = 0;
34}
35
36void
37dump_adb_log(void)
38{
39 unsigned t, t0;
40 struct adb_log *ap;
41 int i;
42
43 ap = adb_log;
44 t0 = ap->time;
45 for (i = 0; i <= n_adb_log; ++i, ++ap) {
46 t = t0 - ap->time;
47 printf("b=%x ifr=%x acr=%x at %d.%.7d\n", ap->b, ap->ifr, ap->acr,
48 t / 1000000000, (t % 1000000000) / 100);
49 }
50}
51
52void
53adb_chklog(void)
54{
55 struct adb_log *ap = &adb_log[n_adb_log + 1];
56
57 ap->b = ADB_B;
58 ap->ifr = ADB_IFR;
59 ap->acr = ADB_ACR;
60 if (ap->b != ap[-1].b || (ap->ifr & 4) != (ap[-1].ifr & 4)
61 || ap->acr != ap[-1].acr) {
62 ap->time = get_dec();
63 ++n_adb_log;
64 }
65}
66
67int
68adb_bitwait(int bmask, int bval, int fmask, int fval)
69{
70 int i;
71 struct adb_log *ap;
72
73 for (i = 10000; i > 0; --i) {
74 adb_chklog();
75 ap = &adb_log[n_adb_log];
76 if ((ap->b & bmask) == bval && (ap->ifr & fmask) == fval)
77 return 0;
78 }
79 return -1;
80}
81
82int
83adb_wait(void)
84{
85 if (adb_bitwait(0, 0, 4, 4) < 0) {
86 printf("adb: ready wait timeout\n");
87 return -1;
88 }
89 return 0;
90}
91
92void
93adb_readin(void)
94{
95 int i, j;
96 unsigned char d[64];
97
98 if (ADB_B & 8) {
99 printf("ADB_B: %x\n", ADB_B);
100 return;
101 }
102 i = 0;
103 adb_wait();
104 j = ADB_SR;
105 eieio();
106 ADB_B &= ~0x20;
107 eieio();
108 for (;;) {
109 if (adb_wait() < 0)
110 break;
111 d[i++] = ADB_SR;
112 eieio();
113 if (ADB_B & 8)
114 break;
115 ADB_B ^= 0x10;
116 eieio();
117 }
118 ADB_B |= 0x30;
119 if (adb_wait() == 0)
120 j = ADB_SR;
121 for (j = 0; j < i; ++j)
122 printf("%.2x ", d[j]);
123 printf("\n");
124}
125
126int
127adb_write(unsigned char *d, int i)
128{
129 int j;
130 unsigned x;
131
132 if ((ADB_B & 8) == 0) {
133 printf("r: ");
134 adb_readin();
135 }
136 for (;;) {
137 ADB_ACR = 0x1c;
138 eieio();
139 ADB_SR = d[0];
140 eieio();
141 ADB_B &= ~0x20;
142 eieio();
143 if (ADB_B & 8)
144 break;
145 ADB_ACR = 0xc;
146 eieio();
147 ADB_B |= 0x20;
148 eieio();
149 adb_readin();
150 }
151 adb_wait();
152 for (j = 1; j < i; ++j) {
153 ADB_SR = d[j];
154 eieio();
155 ADB_B ^= 0x10;
156 eieio();
157 if (adb_wait() < 0)
158 break;
159 }
160 ADB_ACR = 0xc;
161 eieio();
162 x = ADB_SR;
163 eieio();
164 ADB_B |= 0x30;
165 return j;
166}
167
168void
169adbcmds(void)
170{
171 char cmd;
172 unsigned rtcu, rtcl, dec, pdec, x;
173 int i, j;
174 unsigned char d[64];
175
176 cmd = skipbl();
177 switch (cmd) {
178 case 't':
179 for (;;) {
180 rtcl = get_rtcl();
181 rtcu = get_rtcu();
182 dec = get_dec();
183 printf("rtc u=%u l=%u dec=%x (%d = %d.%.7d)\n",
184 rtcu, rtcl, dec, pdec - dec, (pdec - dec) / 1000000000,
185 ((pdec - dec) % 1000000000) / 100);
186 pdec = dec;
187 if (cmd == 'x')
188 break;
189 while (xmon_read(stdin, &cmd, 1) != 1)
190 ;
191 }
192 break;
193 case 'r':
194 init_adb_log();
195 while (adb_bitwait(8, 0, 0, 0) == 0)
196 adb_readin();
197 break;
198 case 'w':
199 i = 0;
200 while (scanhex(&x))
201 d[i++] = x;
202 init_adb_log();
203 j = adb_write(d, i);
204 printf("sent %d bytes\n", j);
205 while (adb_bitwait(8, 0, 0, 0) == 0)
206 adb_readin();
207 break;
208 case 'l':
209 dump_adb_log();
210 break;
211 }
212}
diff --git a/arch/ppc/xmon/ansidecl.h b/arch/ppc/xmon/ansidecl.h
new file mode 100644
index 000000000000..c9b9f0929e9e
--- /dev/null
+++ b/arch/ppc/xmon/ansidecl.h
@@ -0,0 +1,141 @@
1/* ANSI and traditional C compatibility macros
2 Copyright 1991, 1992 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5This program is free software; you can redistribute it and/or modify
6it under the terms of the GNU General Public License as published by
7the Free Software Foundation; either version 2 of the License, or
8(at your option) any later version.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program; if not, write to the Free Software
17Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
18
19/* ANSI and traditional C compatibility macros
20
21 ANSI C is assumed if __STDC__ is #defined.
22
23 Macro ANSI C definition Traditional C definition
24 ----- ---- - ---------- ----------- - ----------
25 PTR `void *' `char *'
26 LONG_DOUBLE `long double' `double'
27 VOLATILE `volatile' `'
28 SIGNED `signed' `'
29 PTRCONST `void *const' `char *'
30 ANSI_PROTOTYPES 1 not defined
31
32 CONST is also defined, but is obsolete. Just use const.
33
34 DEFUN (name, arglist, args)
35
36 Defines function NAME.
37
38 ARGLIST lists the arguments, separated by commas and enclosed in
39 parentheses. ARGLIST becomes the argument list in traditional C.
40
41 ARGS list the arguments with their types. It becomes a prototype in
42 ANSI C, and the type declarations in traditional C. Arguments should
43 be separated with `AND'. For functions with a variable number of
44 arguments, the last thing listed should be `DOTS'.
45
46 DEFUN_VOID (name)
47
48 Defines a function NAME, which takes no arguments.
49
50 obsolete -- EXFUN (name, (prototype)) -- obsolete.
51
52 Replaced by PARAMS. Do not use; will disappear someday soon.
53 Was used in external function declarations.
54 In ANSI C it is `NAME PROTOTYPE' (so PROTOTYPE should be enclosed in
55 parentheses). In traditional C it is `NAME()'.
56 For a function that takes no arguments, PROTOTYPE should be `(void)'.
57
58 PARAMS ((args))
59
60 We could use the EXFUN macro to handle prototype declarations, but
61 the name is misleading and the result is ugly. So we just define a
62 simple macro to handle the parameter lists, as in:
63
64 static int foo PARAMS ((int, char));
65
66 This produces: `static int foo();' or `static int foo (int, char);'
67
68 EXFUN would have done it like this:
69
70 static int EXFUN (foo, (int, char));
71
72 but the function is not external...and it's hard to visually parse
73 the function name out of the mess. EXFUN should be considered
74 obsolete; new code should be written to use PARAMS.
75
76 For example:
77 extern int printf PARAMS ((CONST char *format DOTS));
78 int DEFUN(fprintf, (stream, format),
79 FILE *stream AND CONST char *format DOTS) { ... }
80 void DEFUN_VOID(abort) { ... }
81*/
82
83#ifndef _ANSIDECL_H
84
85#define _ANSIDECL_H 1
86
87
88/* Every source file includes this file,
89 so they will all get the switch for lint. */
90/* LINTLIBRARY */
91
92
93#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(WIN32)
94/* All known AIX compilers implement these things (but don't always
95 define __STDC__). The RISC/OS MIPS compiler defines these things
96 in SVR4 mode, but does not define __STDC__. */
97
98#define PTR void *
99#define PTRCONST void *CONST
100#define LONG_DOUBLE long double
101
102#define AND ,
103#define NOARGS void
104#define CONST const
105#define VOLATILE volatile
106#define SIGNED signed
107#define DOTS , ...
108
109#define EXFUN(name, proto) name proto
110#define DEFUN(name, arglist, args) name(args)
111#define DEFUN_VOID(name) name(void)
112
113#define PROTO(type, name, arglist) type name arglist
114#define PARAMS(paramlist) paramlist
115#define ANSI_PROTOTYPES 1
116
117#else /* Not ANSI C. */
118
119#define PTR char *
120#define PTRCONST PTR
121#define LONG_DOUBLE double
122
123#define AND ;
124#define NOARGS
125#define CONST
126#ifndef const /* some systems define it in header files for non-ansi mode */
127#define const
128#endif
129#define VOLATILE
130#define SIGNED
131#define DOTS
132
133#define EXFUN(name, proto) name()
134#define DEFUN(name, arglist, args) name arglist args;
135#define DEFUN_VOID(name) name()
136#define PROTO(type, name, arglist) type name ()
137#define PARAMS(paramlist) ()
138
139#endif /* ANSI C. */
140
141#endif /* ansidecl.h */
diff --git a/arch/ppc/xmon/nonstdio.h b/arch/ppc/xmon/nonstdio.h
new file mode 100644
index 000000000000..0240bc573c96
--- /dev/null
+++ b/arch/ppc/xmon/nonstdio.h
@@ -0,0 +1,22 @@
1typedef int FILE;
2extern FILE *xmon_stdin, *xmon_stdout;
3#define EOF (-1)
4#define stdin xmon_stdin
5#define stdout xmon_stdout
6#define printf xmon_printf
7#define fprintf xmon_fprintf
8#define fputs xmon_fputs
9#define fgets xmon_fgets
10#define putchar xmon_putchar
11#define getchar xmon_getchar
12#define putc xmon_putc
13#define getc xmon_getc
14#define fopen(n, m) NULL
15#define fflush(f) do {} while (0)
16#define fclose(f) do {} while (0)
17extern char *fgets(char *, int, void *);
18extern void xmon_fprintf(void *, const char *, ...);
19extern void xmon_sprintf(char *, const char *, ...);
20extern void xmon_puts(char*);
21
22#define perror(s) printf("%s: no files!\n", (s))
diff --git a/arch/ppc/xmon/ppc-dis.c b/arch/ppc/xmon/ppc-dis.c
new file mode 100644
index 000000000000..798ac1a677f6
--- /dev/null
+++ b/arch/ppc/xmon/ppc-dis.c
@@ -0,0 +1,190 @@
1/* ppc-dis.c -- Disassemble PowerPC instructions
2 Copyright 1994 Free Software Foundation, Inc.
3 Written by Ian Lance Taylor, Cygnus Support
4
5This file is part of GDB, GAS, and the GNU binutils.
6
7GDB, GAS, and the GNU binutils are free software; you can redistribute
8them and/or modify them under the terms of the GNU General Public
9License as published by the Free Software Foundation; either version
102, or (at your option) any later version.
11
12GDB, GAS, and the GNU binutils are distributed in the hope that they
13will be useful, but WITHOUT ANY WARRANTY; without even the implied
14warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
15the GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with this file; see the file COPYING. If not, write to the Free
19Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
20
21#include "nonstdio.h"
22#include "ansidecl.h"
23#include "ppc.h"
24
25static int print_insn_powerpc PARAMS ((FILE *, unsigned long insn,
26 unsigned memaddr, int dialect));
27
28extern void print_address PARAMS((unsigned memaddr));
29
30/* Print a big endian PowerPC instruction. For convenience, also
31 disassemble instructions supported by the Motorola PowerPC 601. */
32
33int
34print_insn_big_powerpc (FILE *out, unsigned long insn, unsigned memaddr)
35{
36 return print_insn_powerpc (out, insn, memaddr,
37 PPC_OPCODE_PPC | PPC_OPCODE_601);
38}
39
40/* Print a PowerPC or POWER instruction. */
41
42static int
43print_insn_powerpc (FILE *out, unsigned long insn, unsigned memaddr,
44 int dialect)
45{
46 const struct powerpc_opcode *opcode;
47 const struct powerpc_opcode *opcode_end;
48 unsigned long op;
49
50 /* Get the major opcode of the instruction. */
51 op = PPC_OP (insn);
52
53 /* Find the first match in the opcode table. We could speed this up
54 a bit by doing a binary search on the major opcode. */
55 opcode_end = powerpc_opcodes + powerpc_num_opcodes;
56 for (opcode = powerpc_opcodes; opcode < opcode_end; opcode++)
57 {
58 unsigned long table_op;
59 const unsigned char *opindex;
60 const struct powerpc_operand *operand;
61 int invalid;
62 int need_comma;
63 int need_paren;
64
65 table_op = PPC_OP (opcode->opcode);
66 if (op < table_op)
67 break;
68 if (op > table_op)
69 continue;
70
71 if ((insn & opcode->mask) != opcode->opcode
72 || (opcode->flags & dialect) == 0)
73 continue;
74
75 /* Make two passes over the operands. First see if any of them
76 have extraction functions, and, if they do, make sure the
77 instruction is valid. */
78 invalid = 0;
79 for (opindex = opcode->operands; *opindex != 0; opindex++)
80 {
81 operand = powerpc_operands + *opindex;
82 if (operand->extract)
83 (*operand->extract) (insn, &invalid);
84 }
85 if (invalid)
86 continue;
87
88 /* The instruction is valid. */
89 fprintf(out, "%s", opcode->name);
90 if (opcode->operands[0] != 0)
91 fprintf(out, "\t");
92
93 /* Now extract and print the operands. */
94 need_comma = 0;
95 need_paren = 0;
96 for (opindex = opcode->operands; *opindex != 0; opindex++)
97 {
98 long value;
99
100 operand = powerpc_operands + *opindex;
101
102 /* Operands that are marked FAKE are simply ignored. We
103 already made sure that the extract function considered
104 the instruction to be valid. */
105 if ((operand->flags & PPC_OPERAND_FAKE) != 0)
106 continue;
107
108 /* Extract the value from the instruction. */
109 if (operand->extract)
110 value = (*operand->extract) (insn, (int *) 0);
111 else
112 {
113 value = (insn >> operand->shift) & ((1 << operand->bits) - 1);
114 if ((operand->flags & PPC_OPERAND_SIGNED) != 0
115 && (value & (1 << (operand->bits - 1))) != 0)
116 value -= 1 << operand->bits;
117 }
118
119 /* If the operand is optional, and the value is zero, don't
120 print anything. */
121 if ((operand->flags & PPC_OPERAND_OPTIONAL) != 0
122 && (operand->flags & PPC_OPERAND_NEXT) == 0
123 && value == 0)
124 continue;
125
126 if (need_comma)
127 {
128 fprintf(out, ",");
129 need_comma = 0;
130 }
131
132 /* Print the operand as directed by the flags. */
133 if ((operand->flags & PPC_OPERAND_GPR) != 0)
134 fprintf(out, "r%ld", value);
135 else if ((operand->flags & PPC_OPERAND_FPR) != 0)
136 fprintf(out, "f%ld", value);
137 else if ((operand->flags & PPC_OPERAND_RELATIVE) != 0)
138 print_address (memaddr + value);
139 else if ((operand->flags & PPC_OPERAND_ABSOLUTE) != 0)
140 print_address (value & 0xffffffff);
141 else if ((operand->flags & PPC_OPERAND_CR) == 0
142 || (dialect & PPC_OPCODE_PPC) == 0)
143 fprintf(out, "%ld", value);
144 else
145 {
146 if (operand->bits == 3)
147 fprintf(out, "cr%d", value);
148 else
149 {
150 static const char *cbnames[4] = { "lt", "gt", "eq", "so" };
151 int cr;
152 int cc;
153
154 cr = value >> 2;
155 if (cr != 0)
156 fprintf(out, "4*cr%d", cr);
157 cc = value & 3;
158 if (cc != 0)
159 {
160 if (cr != 0)
161 fprintf(out, "+");
162 fprintf(out, "%s", cbnames[cc]);
163 }
164 }
165 }
166
167 if (need_paren)
168 {
169 fprintf(out, ")");
170 need_paren = 0;
171 }
172
173 if ((operand->flags & PPC_OPERAND_PARENS) == 0)
174 need_comma = 1;
175 else
176 {
177 fprintf(out, "(");
178 need_paren = 1;
179 }
180 }
181
182 /* We have found and printed an instruction; return. */
183 return 4;
184 }
185
186 /* We could not find a match. */
187 fprintf(out, ".long 0x%lx", insn);
188
189 return 4;
190}
diff --git a/arch/ppc/xmon/ppc-opc.c b/arch/ppc/xmon/ppc-opc.c
new file mode 100644
index 000000000000..533a6c9973d4
--- /dev/null
+++ b/arch/ppc/xmon/ppc-opc.c
@@ -0,0 +1,2721 @@
1/* ppc-opc.c -- PowerPC opcode list
2 Copyright 1994 Free Software Foundation, Inc.
3 Written by Ian Lance Taylor, Cygnus Support
4
5This file is part of GDB, GAS, and the GNU binutils.
6
7GDB, GAS, and the GNU binutils are free software; you can redistribute
8them and/or modify them under the terms of the GNU General Public
9License as published by the Free Software Foundation; either version
102, or (at your option) any later version.
11
12GDB, GAS, and the GNU binutils are distributed in the hope that they
13will be useful, but WITHOUT ANY WARRANTY; without even the implied
14warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
15the GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with this file; see the file COPYING. If not, write to the Free
19Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
20
21#include <linux/posix_types.h>
22#include "ansidecl.h"
23#include "ppc.h"
24
25/* This file holds the PowerPC opcode table. The opcode table
26 includes almost all of the extended instruction mnemonics. This
27 permits the disassembler to use them, and simplifies the assembler
28 logic, at the cost of increasing the table size. The table is
29 strictly constant data, so the compiler should be able to put it in
30 the .text section.
31
32 This file also holds the operand table. All knowledge about
33 inserting operands into instructions and vice-versa is kept in this
34 file. */
35
36/* Local insertion and extraction functions. */
37
38static unsigned long insert_bat PARAMS ((unsigned long, long, const char **));
39static long extract_bat PARAMS ((unsigned long, int *));
40static unsigned long insert_bba PARAMS ((unsigned long, long, const char **));
41static long extract_bba PARAMS ((unsigned long, int *));
42static unsigned long insert_bd PARAMS ((unsigned long, long, const char **));
43static long extract_bd PARAMS ((unsigned long, int *));
44static unsigned long insert_bdm PARAMS ((unsigned long, long, const char **));
45static long extract_bdm PARAMS ((unsigned long, int *));
46static unsigned long insert_bdp PARAMS ((unsigned long, long, const char **));
47static long extract_bdp PARAMS ((unsigned long, int *));
48static unsigned long insert_bo PARAMS ((unsigned long, long, const char **));
49static long extract_bo PARAMS ((unsigned long, int *));
50static unsigned long insert_boe PARAMS ((unsigned long, long, const char **));
51static long extract_boe PARAMS ((unsigned long, int *));
52static unsigned long insert_ds PARAMS ((unsigned long, long, const char **));
53static long extract_ds PARAMS ((unsigned long, int *));
54static unsigned long insert_li PARAMS ((unsigned long, long, const char **));
55static long extract_li PARAMS ((unsigned long, int *));
56static unsigned long insert_mbe PARAMS ((unsigned long, long, const char **));
57static long extract_mbe PARAMS ((unsigned long, int *));
58static unsigned long insert_mb6 PARAMS ((unsigned long, long, const char **));
59static long extract_mb6 PARAMS ((unsigned long, int *));
60static unsigned long insert_nb PARAMS ((unsigned long, long, const char **));
61static long extract_nb PARAMS ((unsigned long, int *));
62static unsigned long insert_nsi PARAMS ((unsigned long, long, const char **));
63static long extract_nsi PARAMS ((unsigned long, int *));
64static unsigned long insert_ral PARAMS ((unsigned long, long, const char **));
65static unsigned long insert_ram PARAMS ((unsigned long, long, const char **));
66static unsigned long insert_ras PARAMS ((unsigned long, long, const char **));
67static unsigned long insert_rbs PARAMS ((unsigned long, long, const char **));
68static long extract_rbs PARAMS ((unsigned long, int *));
69static unsigned long insert_sh6 PARAMS ((unsigned long, long, const char **));
70static long extract_sh6 PARAMS ((unsigned long, int *));
71static unsigned long insert_spr PARAMS ((unsigned long, long, const char **));
72static long extract_spr PARAMS ((unsigned long, int *));
73static unsigned long insert_tbr PARAMS ((unsigned long, long, const char **));
74static long extract_tbr PARAMS ((unsigned long, int *));
75
76/* The operands table.
77
78 The fields are bits, shift, signed, insert, extract, flags. */
79
80const struct powerpc_operand powerpc_operands[] =
81{
82 /* The zero index is used to indicate the end of the list of
83 operands. */
84#define UNUSED (0)
85 { 0, 0, NULL, NULL, 0 },
86
87 /* The BA field in an XL form instruction. */
88#define BA (1)
89#define BA_MASK (0x1f << 16)
90 { 5, 16, NULL, NULL, PPC_OPERAND_CR },
91
92 /* The BA field in an XL form instruction when it must be the same
93 as the BT field in the same instruction. */
94#define BAT (2)
95 { 5, 16, insert_bat, extract_bat, PPC_OPERAND_FAKE },
96
97 /* The BB field in an XL form instruction. */
98#define BB (3)
99#define BB_MASK (0x1f << 11)
100 { 5, 11, NULL, NULL, PPC_OPERAND_CR },
101
102 /* The BB field in an XL form instruction when it must be the same
103 as the BA field in the same instruction. */
104#define BBA (4)
105 { 5, 11, insert_bba, extract_bba, PPC_OPERAND_FAKE },
106
107 /* The BD field in a B form instruction. The lower two bits are
108 forced to zero. */
109#define BD (5)
110 { 16, 0, insert_bd, extract_bd, PPC_OPERAND_RELATIVE | PPC_OPERAND_SIGNED },
111
112 /* The BD field in a B form instruction when absolute addressing is
113 used. */
114#define BDA (6)
115 { 16, 0, insert_bd, extract_bd, PPC_OPERAND_ABSOLUTE | PPC_OPERAND_SIGNED },
116
117 /* The BD field in a B form instruction when the - modifier is used.
118 This sets the y bit of the BO field appropriately. */
119#define BDM (7)
120 { 16, 0, insert_bdm, extract_bdm,
121 PPC_OPERAND_RELATIVE | PPC_OPERAND_SIGNED },
122
123 /* The BD field in a B form instruction when the - modifier is used
124 and absolute address is used. */
125#define BDMA (8)
126 { 16, 0, insert_bdm, extract_bdm,
127 PPC_OPERAND_ABSOLUTE | PPC_OPERAND_SIGNED },
128
129 /* The BD field in a B form instruction when the + modifier is used.
130 This sets the y bit of the BO field appropriately. */
131#define BDP (9)
132 { 16, 0, insert_bdp, extract_bdp,
133 PPC_OPERAND_RELATIVE | PPC_OPERAND_SIGNED },
134
135 /* The BD field in a B form instruction when the + modifier is used
136 and absolute addressing is used. */
137#define BDPA (10)
138 { 16, 0, insert_bdp, extract_bdp,
139 PPC_OPERAND_ABSOLUTE | PPC_OPERAND_SIGNED },
140
141 /* The BF field in an X or XL form instruction. */
142#define BF (11)
143 { 3, 23, NULL, NULL, PPC_OPERAND_CR },
144
145 /* An optional BF field. This is used for comparison instructions,
146 in which an omitted BF field is taken as zero. */
147#define OBF (12)
148 { 3, 23, NULL, NULL, PPC_OPERAND_CR | PPC_OPERAND_OPTIONAL },
149
150 /* The BFA field in an X or XL form instruction. */
151#define BFA (13)
152 { 3, 18, NULL, NULL, PPC_OPERAND_CR },
153
154 /* The BI field in a B form or XL form instruction. */
155#define BI (14)
156#define BI_MASK (0x1f << 16)
157 { 5, 16, NULL, NULL, PPC_OPERAND_CR },
158
159 /* The BO field in a B form instruction. Certain values are
160 illegal. */
161#define BO (15)
162#define BO_MASK (0x1f << 21)
163 { 5, 21, insert_bo, extract_bo, 0 },
164
165 /* The BO field in a B form instruction when the + or - modifier is
166 used. This is like the BO field, but it must be even. */
167#define BOE (16)
168 { 5, 21, insert_boe, extract_boe, 0 },
169
170 /* The BT field in an X or XL form instruction. */
171#define BT (17)
172 { 5, 21, NULL, NULL, PPC_OPERAND_CR },
173
174 /* The condition register number portion of the BI field in a B form
175 or XL form instruction. This is used for the extended
176 conditional branch mnemonics, which set the lower two bits of the
177 BI field. This field is optional. */
178#define CR (18)
179 { 3, 18, NULL, NULL, PPC_OPERAND_CR | PPC_OPERAND_OPTIONAL },
180
181 /* The D field in a D form instruction. This is a displacement off
182 a register, and implies that the next operand is a register in
183 parentheses. */
184#define D (19)
185 { 16, 0, NULL, NULL, PPC_OPERAND_PARENS | PPC_OPERAND_SIGNED },
186
187 /* The DS field in a DS form instruction. This is like D, but the
188 lower two bits are forced to zero. */
189#define DS (20)
190 { 16, 0, insert_ds, extract_ds, PPC_OPERAND_PARENS | PPC_OPERAND_SIGNED },
191
192 /* The FL1 field in a POWER SC form instruction. */
193#define FL1 (21)
194 { 4, 12, NULL, NULL, 0 },
195
196 /* The FL2 field in a POWER SC form instruction. */
197#define FL2 (22)
198 { 3, 2, NULL, NULL, 0 },
199
200 /* The FLM field in an XFL form instruction. */
201#define FLM (23)
202 { 8, 17, NULL, NULL, 0 },
203
204 /* The FRA field in an X or A form instruction. */
205#define FRA (24)
206#define FRA_MASK (0x1f << 16)
207 { 5, 16, NULL, NULL, PPC_OPERAND_FPR },
208
209 /* The FRB field in an X or A form instruction. */
210#define FRB (25)
211#define FRB_MASK (0x1f << 11)
212 { 5, 11, NULL, NULL, PPC_OPERAND_FPR },
213
214 /* The FRC field in an A form instruction. */
215#define FRC (26)
216#define FRC_MASK (0x1f << 6)
217 { 5, 6, NULL, NULL, PPC_OPERAND_FPR },
218
219 /* The FRS field in an X form instruction or the FRT field in a D, X
220 or A form instruction. */
221#define FRS (27)
222#define FRT (FRS)
223 { 5, 21, NULL, NULL, PPC_OPERAND_FPR },
224
225 /* The FXM field in an XFX instruction. */
226#define FXM (28)
227#define FXM_MASK (0xff << 12)
228 { 8, 12, NULL, NULL, 0 },
229
230 /* The L field in a D or X form instruction. */
231#define L (29)
232 { 1, 21, NULL, NULL, PPC_OPERAND_OPTIONAL },
233
234 /* The LEV field in a POWER SC form instruction. */
235#define LEV (30)
236 { 7, 5, NULL, NULL, 0 },
237
238 /* The LI field in an I form instruction. The lower two bits are
239 forced to zero. */
240#define LI (31)
241 { 26, 0, insert_li, extract_li, PPC_OPERAND_RELATIVE | PPC_OPERAND_SIGNED },
242
243 /* The LI field in an I form instruction when used as an absolute
244 address. */
245#define LIA (32)
246 { 26, 0, insert_li, extract_li, PPC_OPERAND_ABSOLUTE | PPC_OPERAND_SIGNED },
247
248 /* The MB field in an M form instruction. */
249#define MB (33)
250#define MB_MASK (0x1f << 6)
251 { 5, 6, NULL, NULL, 0 },
252
253 /* The ME field in an M form instruction. */
254#define ME (34)
255#define ME_MASK (0x1f << 1)
256 { 5, 1, NULL, NULL, 0 },
257
258 /* The MB and ME fields in an M form instruction expressed a single
259 operand which is a bitmask indicating which bits to select. This
260 is a two operand form using PPC_OPERAND_NEXT. See the
261 description in opcode/ppc.h for what this means. */
262#define MBE (35)
263 { 5, 6, NULL, NULL, PPC_OPERAND_OPTIONAL | PPC_OPERAND_NEXT },
264 { 32, 0, insert_mbe, extract_mbe, 0 },
265
266 /* The MB or ME field in an MD or MDS form instruction. The high
267 bit is wrapped to the low end. */
268#define MB6 (37)
269#define ME6 (MB6)
270#define MB6_MASK (0x3f << 5)
271 { 6, 5, insert_mb6, extract_mb6, 0 },
272
273 /* The NB field in an X form instruction. The value 32 is stored as
274 0. */
275#define NB (38)
276 { 6, 11, insert_nb, extract_nb, 0 },
277
278 /* The NSI field in a D form instruction. This is the same as the
279 SI field, only negated. */
280#define NSI (39)
281 { 16, 0, insert_nsi, extract_nsi,
282 PPC_OPERAND_NEGATIVE | PPC_OPERAND_SIGNED },
283
284 /* The RA field in an D, DS, X, XO, M, or MDS form instruction. */
285#define RA (40)
286#define RA_MASK (0x1f << 16)
287 { 5, 16, NULL, NULL, PPC_OPERAND_GPR },
288
289 /* The RA field in a D or X form instruction which is an updating
290 load, which means that the RA field may not be zero and may not
291 equal the RT field. */
292#define RAL (41)
293 { 5, 16, insert_ral, NULL, PPC_OPERAND_GPR },
294
295 /* The RA field in an lmw instruction, which has special value
296 restrictions. */
297#define RAM (42)
298 { 5, 16, insert_ram, NULL, PPC_OPERAND_GPR },
299
300 /* The RA field in a D or X form instruction which is an updating
301 store or an updating floating point load, which means that the RA
302 field may not be zero. */
303#define RAS (43)
304 { 5, 16, insert_ras, NULL, PPC_OPERAND_GPR },
305
306 /* The RB field in an X, XO, M, or MDS form instruction. */
307#define RB (44)
308#define RB_MASK (0x1f << 11)
309 { 5, 11, NULL, NULL, PPC_OPERAND_GPR },
310
311 /* The RB field in an X form instruction when it must be the same as
312 the RS field in the instruction. This is used for extended
313 mnemonics like mr. */
314#define RBS (45)
315 { 5, 1, insert_rbs, extract_rbs, PPC_OPERAND_FAKE },
316
317 /* The RS field in a D, DS, X, XFX, XS, M, MD or MDS form
318 instruction or the RT field in a D, DS, X, XFX or XO form
319 instruction. */
320#define RS (46)
321#define RT (RS)
322#define RT_MASK (0x1f << 21)
323 { 5, 21, NULL, NULL, PPC_OPERAND_GPR },
324
325 /* The SH field in an X or M form instruction. */
326#define SH (47)
327#define SH_MASK (0x1f << 11)
328 { 5, 11, NULL, NULL, 0 },
329
330 /* The SH field in an MD form instruction. This is split. */
331#define SH6 (48)
332#define SH6_MASK ((0x1f << 11) | (1 << 1))
333 { 6, 1, insert_sh6, extract_sh6, 0 },
334
335 /* The SI field in a D form instruction. */
336#define SI (49)
337 { 16, 0, NULL, NULL, PPC_OPERAND_SIGNED },
338
339 /* The SI field in a D form instruction when we accept a wide range
340 of positive values. */
341#define SISIGNOPT (50)
342 { 16, 0, NULL, NULL, PPC_OPERAND_SIGNED | PPC_OPERAND_SIGNOPT },
343
344 /* The SPR field in an XFX form instruction. This is flipped--the
345 lower 5 bits are stored in the upper 5 and vice- versa. */
346#define SPR (51)
347#define SPR_MASK (0x3ff << 11)
348 { 10, 11, insert_spr, extract_spr, 0 },
349
350 /* The BAT index number in an XFX form m[ft]ibat[lu] instruction. */
351#define SPRBAT (52)
352#define SPRBAT_MASK (0x3 << 17)
353 { 2, 17, NULL, NULL, 0 },
354
355 /* The SPRG register number in an XFX form m[ft]sprg instruction. */
356#define SPRG (53)
357#define SPRG_MASK (0x3 << 16)
358 { 2, 16, NULL, NULL, 0 },
359
360 /* The SR field in an X form instruction. */
361#define SR (54)
362 { 4, 16, NULL, NULL, 0 },
363
364 /* The SV field in a POWER SC form instruction. */
365#define SV (55)
366 { 14, 2, NULL, NULL, 0 },
367
368 /* The TBR field in an XFX form instruction. This is like the SPR
369 field, but it is optional. */
370#define TBR (56)
371 { 10, 11, insert_tbr, extract_tbr, PPC_OPERAND_OPTIONAL },
372
373 /* The TO field in a D or X form instruction. */
374#define TO (57)
375#define TO_MASK (0x1f << 21)
376 { 5, 21, NULL, NULL, 0 },
377
378 /* The U field in an X form instruction. */
379#define U (58)
380 { 4, 12, NULL, NULL, 0 },
381
382 /* The UI field in a D form instruction. */
383#define UI (59)
384 { 16, 0, NULL, NULL, 0 },
385};
386
387/* The functions used to insert and extract complicated operands. */
388
389/* The BA field in an XL form instruction when it must be the same as
390 the BT field in the same instruction. This operand is marked FAKE.
391 The insertion function just copies the BT field into the BA field,
392 and the extraction function just checks that the fields are the
393 same. */
394
395/*ARGSUSED*/
396static unsigned long
397insert_bat(unsigned long insn, long value, const char **errmsg)
398{
399 return insn | (((insn >> 21) & 0x1f) << 16);
400}
401
402static long
403extract_bat(unsigned long insn, int *invalid)
404{
405 if (invalid != (int *) NULL
406 && ((insn >> 21) & 0x1f) != ((insn >> 16) & 0x1f))
407 *invalid = 1;
408 return 0;
409}
410
411/* The BB field in an XL form instruction when it must be the same as
412 the BA field in the same instruction. This operand is marked FAKE.
413 The insertion function just copies the BA field into the BB field,
414 and the extraction function just checks that the fields are the
415 same. */
416
417/*ARGSUSED*/
418static unsigned long
419insert_bba(unsigned long insn, long value, const char **errmsg)
420{
421 return insn | (((insn >> 16) & 0x1f) << 11);
422}
423
424static long
425extract_bba(unsigned long insn, int *invalid)
426{
427 if (invalid != (int *) NULL
428 && ((insn >> 16) & 0x1f) != ((insn >> 11) & 0x1f))
429 *invalid = 1;
430 return 0;
431}
432
433/* The BD field in a B form instruction. The lower two bits are
434 forced to zero. */
435
436/*ARGSUSED*/
437static unsigned long
438insert_bd(unsigned long insn, long value, const char **errmsg)
439{
440 return insn | (value & 0xfffc);
441}
442
443/*ARGSUSED*/
444static long
445extract_bd(unsigned long insn, int *invalid)
446{
447 if ((insn & 0x8000) != 0)
448 return (insn & 0xfffc) - 0x10000;
449 else
450 return insn & 0xfffc;
451}
452
453/* The BD field in a B form instruction when the - modifier is used.
454 This modifier means that the branch is not expected to be taken.
455 We must set the y bit of the BO field to 1 if the offset is
456 negative. When extracting, we require that the y bit be 1 and that
457 the offset be positive, since if the y bit is 0 we just want to
458 print the normal form of the instruction. */
459
460/*ARGSUSED*/
461static unsigned long
462insert_bdm(unsigned long insn, long value, const char **errmsg)
463{
464 if ((value & 0x8000) != 0)
465 insn |= 1 << 21;
466 return insn | (value & 0xfffc);
467}
468
469static long
470extract_bdm(unsigned long insn, int *invalid)
471{
472 if (invalid != (int *) NULL
473 && ((insn & (1 << 21)) == 0
474 || (insn & (1 << 15)) == 0))
475 *invalid = 1;
476 if ((insn & 0x8000) != 0)
477 return (insn & 0xfffc) - 0x10000;
478 else
479 return insn & 0xfffc;
480}
481
482/* The BD field in a B form instruction when the + modifier is used.
483 This is like BDM, above, except that the branch is expected to be
484 taken. */
485
486/*ARGSUSED*/
487static unsigned long
488insert_bdp(unsigned long insn, long value, const char **errmsg)
489{
490 if ((value & 0x8000) == 0)
491 insn |= 1 << 21;
492 return insn | (value & 0xfffc);
493}
494
495static long
496extract_bdp(unsigned long insn, int *invalid)
497{
498 if (invalid != (int *) NULL
499 && ((insn & (1 << 21)) == 0
500 || (insn & (1 << 15)) != 0))
501 *invalid = 1;
502 if ((insn & 0x8000) != 0)
503 return (insn & 0xfffc) - 0x10000;
504 else
505 return insn & 0xfffc;
506}
507
508/* Check for legal values of a BO field. */
509
510static int
511valid_bo (long value)
512{
513 /* Certain encodings have bits that are required to be zero. These
514 are (z must be zero, y may be anything):
515 001zy
516 011zy
517 1z00y
518 1z01y
519 1z1zz
520 */
521 switch (value & 0x14)
522 {
523 default:
524 case 0:
525 return 1;
526 case 0x4:
527 return (value & 0x2) == 0;
528 case 0x10:
529 return (value & 0x8) == 0;
530 case 0x14:
531 return value == 0x14;
532 }
533}
534
535/* The BO field in a B form instruction. Warn about attempts to set
536 the field to an illegal value. */
537
538static unsigned long
539insert_bo(unsigned long insn, long value, const char **errmsg)
540{
541 if (errmsg != (const char **) NULL
542 && ! valid_bo (value))
543 *errmsg = "invalid conditional option";
544 return insn | ((value & 0x1f) << 21);
545}
546
547static long
548extract_bo(unsigned long insn, int *invalid)
549{
550 long value;
551
552 value = (insn >> 21) & 0x1f;
553 if (invalid != (int *) NULL
554 && ! valid_bo (value))
555 *invalid = 1;
556 return value;
557}
558
559/* The BO field in a B form instruction when the + or - modifier is
560 used. This is like the BO field, but it must be even. When
561 extracting it, we force it to be even. */
562
563static unsigned long
564insert_boe(unsigned long insn, long value, const char **errmsg)
565{
566 if (errmsg != (const char **) NULL)
567 {
568 if (! valid_bo (value))
569 *errmsg = "invalid conditional option";
570 else if ((value & 1) != 0)
571 *errmsg = "attempt to set y bit when using + or - modifier";
572 }
573 return insn | ((value & 0x1f) << 21);
574}
575
576static long
577extract_boe(unsigned long insn, int *invalid)
578{
579 long value;
580
581 value = (insn >> 21) & 0x1f;
582 if (invalid != (int *) NULL
583 && ! valid_bo (value))
584 *invalid = 1;
585 return value & 0x1e;
586}
587
588/* The DS field in a DS form instruction. This is like D, but the
589 lower two bits are forced to zero. */
590
591/*ARGSUSED*/
592static unsigned long
593insert_ds(unsigned long insn, long value, const char **errmsg)
594{
595 return insn | (value & 0xfffc);
596}
597
598/*ARGSUSED*/
599static long
600extract_ds(unsigned long insn, int *invalid)
601{
602 if ((insn & 0x8000) != 0)
603 return (insn & 0xfffc) - 0x10000;
604 else
605 return insn & 0xfffc;
606}
607
608/* The LI field in an I form instruction. The lower two bits are
609 forced to zero. */
610
611/*ARGSUSED*/
612static unsigned long
613insert_li(unsigned long insn, long value, const char **errmsg)
614{
615 return insn | (value & 0x3fffffc);
616}
617
618/*ARGSUSED*/
619static long
620extract_li(unsigned long insn, int *invalid)
621{
622 if ((insn & 0x2000000) != 0)
623 return (insn & 0x3fffffc) - 0x4000000;
624 else
625 return insn & 0x3fffffc;
626}
627
628/* The MB and ME fields in an M form instruction expressed as a single
629 operand which is itself a bitmask. The extraction function always
630 marks it as invalid, since we never want to recognize an
631 instruction which uses a field of this type. */
632
633static unsigned long
634insert_mbe(unsigned long insn, long value, const char **errmsg)
635{
636 unsigned long uval;
637 int mb, me;
638
639 uval = value;
640
641 if (uval == 0)
642 {
643 if (errmsg != (const char **) NULL)
644 *errmsg = "illegal bitmask";
645 return insn;
646 }
647
648 me = 31;
649 while ((uval & 1) == 0)
650 {
651 uval >>= 1;
652 --me;
653 }
654
655 mb = me;
656 uval >>= 1;
657 while ((uval & 1) != 0)
658 {
659 uval >>= 1;
660 --mb;
661 }
662
663 if (uval != 0)
664 {
665 if (errmsg != (const char **) NULL)
666 *errmsg = "illegal bitmask";
667 }
668
669 return insn | (mb << 6) | (me << 1);
670}
671
672static long
673extract_mbe(unsigned long insn, int *invalid)
674{
675 long ret;
676 int mb, me;
677 int i;
678
679 if (invalid != (int *) NULL)
680 *invalid = 1;
681
682 ret = 0;
683 mb = (insn >> 6) & 0x1f;
684 me = (insn >> 1) & 0x1f;
685 for (i = mb; i < me; i++)
686 ret |= 1 << (31 - i);
687 return ret;
688}
689
690/* The MB or ME field in an MD or MDS form instruction. The high bit
691 is wrapped to the low end. */
692
693/*ARGSUSED*/
694static unsigned long
695insert_mb6(unsigned long insn, long value, const char **errmsg)
696{
697 return insn | ((value & 0x1f) << 6) | (value & 0x20);
698}
699
700/*ARGSUSED*/
701static long
702extract_mb6(unsigned long insn, int *invalid)
703{
704 return ((insn >> 6) & 0x1f) | (insn & 0x20);
705}
706
707/* The NB field in an X form instruction. The value 32 is stored as
708 0. */
709
710static unsigned long
711insert_nb(unsigned long insn, long value, const char **errmsg)
712{
713 if (value < 0 || value > 32)
714 *errmsg = "value out of range";
715 if (value == 32)
716 value = 0;
717 return insn | ((value & 0x1f) << 11);
718}
719
720/*ARGSUSED*/
721static long
722extract_nb(unsigned long insn, int *invalid)
723{
724 long ret;
725
726 ret = (insn >> 11) & 0x1f;
727 if (ret == 0)
728 ret = 32;
729 return ret;
730}
731
732/* The NSI field in a D form instruction. This is the same as the SI
733 field, only negated. The extraction function always marks it as
734 invalid, since we never want to recognize an instruction which uses
735 a field of this type. */
736
737/*ARGSUSED*/
738static unsigned long
739insert_nsi(unsigned long insn, long value, const char **errmsg)
740{
741 return insn | ((- value) & 0xffff);
742}
743
744static long
745extract_nsi(unsigned long insn, int *invalid)
746{
747 if (invalid != (int *) NULL)
748 *invalid = 1;
749 if ((insn & 0x8000) != 0)
750 return - ((insn & 0xffff) - 0x10000);
751 else
752 return - (insn & 0xffff);
753}
754
755/* The RA field in a D or X form instruction which is an updating
756 load, which means that the RA field may not be zero and may not
757 equal the RT field. */
758
759static unsigned long
760insert_ral(unsigned long insn, long value, const char **errmsg)
761{
762 if (value == 0
763 || value == ((insn >> 21) & 0x1f))
764 *errmsg = "invalid register operand when updating";
765 return insn | ((value & 0x1f) << 16);
766}
767
768/* The RA field in an lmw instruction, which has special value
769 restrictions. */
770
771static unsigned long
772insert_ram(unsigned long insn, long value, const char **errmsg)
773{
774 if (value >= ((insn >> 21) & 0x1f))
775 *errmsg = "index register in load range";
776 return insn | ((value & 0x1f) << 16);
777}
778
779/* The RA field in a D or X form instruction which is an updating
780 store or an updating floating point load, which means that the RA
781 field may not be zero. */
782
783static unsigned long
784insert_ras(unsigned long insn, long value, const char **errmsg)
785{
786 if (value == 0)
787 *errmsg = "invalid register operand when updating";
788 return insn | ((value & 0x1f) << 16);
789}
790
791/* The RB field in an X form instruction when it must be the same as
792 the RS field in the instruction. This is used for extended
793 mnemonics like mr. This operand is marked FAKE. The insertion
794 function just copies the BT field into the BA field, and the
795 extraction function just checks that the fields are the same. */
796
797/*ARGSUSED*/
798static unsigned long
799insert_rbs(unsigned long insn, long value, const char **errmsg)
800{
801 return insn | (((insn >> 21) & 0x1f) << 11);
802}
803
804static long
805extract_rbs(unsigned long insn, int *invalid)
806{
807 if (invalid != (int *) NULL
808 && ((insn >> 21) & 0x1f) != ((insn >> 11) & 0x1f))
809 *invalid = 1;
810 return 0;
811}
812
813/* The SH field in an MD form instruction. This is split. */
814
815/*ARGSUSED*/
816static unsigned long
817insert_sh6(unsigned long insn, long value, const char **errmsg)
818{
819 return insn | ((value & 0x1f) << 11) | ((value & 0x20) >> 4);
820}
821
822/*ARGSUSED*/
823static long
824extract_sh6(unsigned long insn, int *invalid)
825{
826 return ((insn >> 11) & 0x1f) | ((insn << 4) & 0x20);
827}
828
829/* The SPR field in an XFX form instruction. This is flipped--the
830 lower 5 bits are stored in the upper 5 and vice- versa. */
831
832static unsigned long
833insert_spr(unsigned long insn, long value, const char **errmsg)
834{
835 return insn | ((value & 0x1f) << 16) | ((value & 0x3e0) << 6);
836}
837
838static long
839extract_spr(unsigned long insn, int *invalid)
840{
841 return ((insn >> 16) & 0x1f) | ((insn >> 6) & 0x3e0);
842}
843
844/* The TBR field in an XFX instruction. This is just like SPR, but it
845 is optional. When TBR is omitted, it must be inserted as 268 (the
846 magic number of the TB register). These functions treat 0
847 (indicating an omitted optional operand) as 268. This means that
848 ``mftb 4,0'' is not handled correctly. This does not matter very
849 much, since the architecture manual does not define mftb as
850 accepting any values other than 268 or 269. */
851
852#define TB (268)
853
854static unsigned long
855insert_tbr(unsigned long insn, long value, const char **errmsg)
856{
857 if (value == 0)
858 value = TB;
859 return insn | ((value & 0x1f) << 16) | ((value & 0x3e0) << 6);
860}
861
862static long
863extract_tbr(unsigned long insn, int *invalid)
864{
865 long ret;
866
867 ret = ((insn >> 16) & 0x1f) | ((insn >> 6) & 0x3e0);
868 if (ret == TB)
869 ret = 0;
870 return ret;
871}
872
873/* Macros used to form opcodes. */
874
875/* The main opcode. */
876#define OP(x) (((x) & 0x3f) << 26)
877#define OP_MASK OP (0x3f)
878
879/* The main opcode combined with a trap code in the TO field of a D
880 form instruction. Used for extended mnemonics for the trap
881 instructions. */
882#define OPTO(x,to) (OP (x) | (((to) & 0x1f) << 21))
883#define OPTO_MASK (OP_MASK | TO_MASK)
884
885/* The main opcode combined with a comparison size bit in the L field
886 of a D form or X form instruction. Used for extended mnemonics for
887 the comparison instructions. */
888#define OPL(x,l) (OP (x) | (((l) & 1) << 21))
889#define OPL_MASK OPL (0x3f,1)
890
891/* An A form instruction. */
892#define A(op, xop, rc) (OP (op) | (((xop) & 0x1f) << 1) | ((rc) & 1))
893#define A_MASK A (0x3f, 0x1f, 1)
894
895/* An A_MASK with the FRB field fixed. */
896#define AFRB_MASK (A_MASK | FRB_MASK)
897
898/* An A_MASK with the FRC field fixed. */
899#define AFRC_MASK (A_MASK | FRC_MASK)
900
901/* An A_MASK with the FRA and FRC fields fixed. */
902#define AFRAFRC_MASK (A_MASK | FRA_MASK | FRC_MASK)
903
904/* A B form instruction. */
905#define B(op, aa, lk) (OP (op) | (((aa) & 1) << 1) | ((lk) & 1))
906#define B_MASK B (0x3f, 1, 1)
907
908/* A B form instruction setting the BO field. */
909#define BBO(op, bo, aa, lk) (B ((op), (aa), (lk)) | (((bo) & 0x1f) << 21))
910#define BBO_MASK BBO (0x3f, 0x1f, 1, 1)
911
912/* A BBO_MASK with the y bit of the BO field removed. This permits
913 matching a conditional branch regardless of the setting of the y
914 bit. */
915#define Y_MASK (1 << 21)
916#define BBOY_MASK (BBO_MASK &~ Y_MASK)
917
918/* A B form instruction setting the BO field and the condition bits of
919 the BI field. */
920#define BBOCB(op, bo, cb, aa, lk) \
921 (BBO ((op), (bo), (aa), (lk)) | (((cb) & 0x3) << 16))
922#define BBOCB_MASK BBOCB (0x3f, 0x1f, 0x3, 1, 1)
923
924/* A BBOCB_MASK with the y bit of the BO field removed. */
925#define BBOYCB_MASK (BBOCB_MASK &~ Y_MASK)
926
927/* A BBOYCB_MASK in which the BI field is fixed. */
928#define BBOYBI_MASK (BBOYCB_MASK | BI_MASK)
929
930/* The main opcode mask with the RA field clear. */
931#define DRA_MASK (OP_MASK | RA_MASK)
932
933/* A DS form instruction. */
934#define DSO(op, xop) (OP (op) | ((xop) & 0x3))
935#define DS_MASK DSO (0x3f, 3)
936
937/* An M form instruction. */
938#define M(op, rc) (OP (op) | ((rc) & 1))
939#define M_MASK M (0x3f, 1)
940
941/* An M form instruction with the ME field specified. */
942#define MME(op, me, rc) (M ((op), (rc)) | (((me) & 0x1f) << 1))
943
944/* An M_MASK with the MB and ME fields fixed. */
945#define MMBME_MASK (M_MASK | MB_MASK | ME_MASK)
946
947/* An M_MASK with the SH and ME fields fixed. */
948#define MSHME_MASK (M_MASK | SH_MASK | ME_MASK)
949
950/* An MD form instruction. */
951#define MD(op, xop, rc) (OP (op) | (((xop) & 0x7) << 2) | ((rc) & 1))
952#define MD_MASK MD (0x3f, 0x7, 1)
953
954/* An MD_MASK with the MB field fixed. */
955#define MDMB_MASK (MD_MASK | MB6_MASK)
956
957/* An MD_MASK with the SH field fixed. */
958#define MDSH_MASK (MD_MASK | SH6_MASK)
959
960/* An MDS form instruction. */
961#define MDS(op, xop, rc) (OP (op) | (((xop) & 0xf) << 1) | ((rc) & 1))
962#define MDS_MASK MDS (0x3f, 0xf, 1)
963
964/* An MDS_MASK with the MB field fixed. */
965#define MDSMB_MASK (MDS_MASK | MB6_MASK)
966
967/* An SC form instruction. */
968#define SC(op, sa, lk) (OP (op) | (((sa) & 1) << 1) | ((lk) & 1))
969#define SC_MASK (OP_MASK | (0x3ff << 16) | (1 << 1) | 1)
970
971/* An X form instruction. */
972#define X(op, xop) (OP (op) | (((xop) & 0x3ff) << 1))
973
974/* An X form instruction with the RC bit specified. */
975#define XRC(op, xop, rc) (X ((op), (xop)) | ((rc) & 1))
976
977/* The mask for an X form instruction. */
978#define X_MASK XRC (0x3f, 0x3ff, 1)
979
980/* An X_MASK with the RA field fixed. */
981#define XRA_MASK (X_MASK | RA_MASK)
982
983/* An X_MASK with the RB field fixed. */
984#define XRB_MASK (X_MASK | RB_MASK)
985
986/* An X_MASK with the RT field fixed. */
987#define XRT_MASK (X_MASK | RT_MASK)
988
989/* An X_MASK with the RA and RB fields fixed. */
990#define XRARB_MASK (X_MASK | RA_MASK | RB_MASK)
991
992/* An X_MASK with the RT and RA fields fixed. */
993#define XRTRA_MASK (X_MASK | RT_MASK | RA_MASK)
994
995/* An X form comparison instruction. */
996#define XCMPL(op, xop, l) (X ((op), (xop)) | (((l) & 1) << 21))
997
998/* The mask for an X form comparison instruction. */
999#define XCMP_MASK (X_MASK | (1 << 22))
1000
1001/* The mask for an X form comparison instruction with the L field
1002 fixed. */
1003#define XCMPL_MASK (XCMP_MASK | (1 << 21))
1004
1005/* An X form trap instruction with the TO field specified. */
1006#define XTO(op, xop, to) (X ((op), (xop)) | (((to) & 0x1f) << 21))
1007#define XTO_MASK (X_MASK | TO_MASK)
1008
1009/* An XFL form instruction. */
1010#define XFL(op, xop, rc) (OP (op) | (((xop) & 0x3ff) << 1) | ((rc) & 1))
1011#define XFL_MASK (XFL (0x3f, 0x3ff, 1) | (1 << 25) | (1 << 16))
1012
1013/* An XL form instruction with the LK field set to 0. */
1014#define XL(op, xop) (OP (op) | (((xop) & 0x3ff) << 1))
1015
1016/* An XL form instruction which uses the LK field. */
1017#define XLLK(op, xop, lk) (XL ((op), (xop)) | ((lk) & 1))
1018
1019/* The mask for an XL form instruction. */
1020#define XL_MASK XLLK (0x3f, 0x3ff, 1)
1021
1022/* An XL form instruction which explicitly sets the BO field. */
1023#define XLO(op, bo, xop, lk) \
1024 (XLLK ((op), (xop), (lk)) | (((bo) & 0x1f) << 21))
1025#define XLO_MASK (XL_MASK | BO_MASK)
1026
1027/* An XL form instruction which explicitly sets the y bit of the BO
1028 field. */
1029#define XLYLK(op, xop, y, lk) (XLLK ((op), (xop), (lk)) | (((y) & 1) << 21))
1030#define XLYLK_MASK (XL_MASK | Y_MASK)
1031
1032/* An XL form instruction which sets the BO field and the condition
1033 bits of the BI field. */
1034#define XLOCB(op, bo, cb, xop, lk) \
1035 (XLO ((op), (bo), (xop), (lk)) | (((cb) & 3) << 16))
1036#define XLOCB_MASK XLOCB (0x3f, 0x1f, 0x3, 0x3ff, 1)
1037
1038/* An XL_MASK or XLYLK_MASK or XLOCB_MASK with the BB field fixed. */
1039#define XLBB_MASK (XL_MASK | BB_MASK)
1040#define XLYBB_MASK (XLYLK_MASK | BB_MASK)
1041#define XLBOCBBB_MASK (XLOCB_MASK | BB_MASK)
1042
1043/* An XL_MASK with the BO and BB fields fixed. */
1044#define XLBOBB_MASK (XL_MASK | BO_MASK | BB_MASK)
1045
1046/* An XL_MASK with the BO, BI and BB fields fixed. */
1047#define XLBOBIBB_MASK (XL_MASK | BO_MASK | BI_MASK | BB_MASK)
1048
1049/* An XO form instruction. */
1050#define XO(op, xop, oe, rc) \
1051 (OP (op) | (((xop) & 0x1ff) << 1) | (((oe) & 1) << 10) | ((rc) & 1))
1052#define XO_MASK XO (0x3f, 0x1ff, 1, 1)
1053
1054/* An XO_MASK with the RB field fixed. */
1055#define XORB_MASK (XO_MASK | RB_MASK)
1056
1057/* An XS form instruction. */
1058#define XS(op, xop, rc) (OP (op) | (((xop) & 0x1ff) << 2) | ((rc) & 1))
1059#define XS_MASK XS (0x3f, 0x1ff, 1)
1060
1061/* A mask for the FXM version of an XFX form instruction. */
1062#define XFXFXM_MASK (X_MASK | (1 << 20) | (1 << 11))
1063
1064/* An XFX form instruction with the FXM field filled in. */
1065#define XFXM(op, xop, fxm) \
1066 (X ((op), (xop)) | (((fxm) & 0xff) << 12))
1067
1068/* An XFX form instruction with the SPR field filled in. */
1069#define XSPR(op, xop, spr) \
1070 (X ((op), (xop)) | (((spr) & 0x1f) << 16) | (((spr) & 0x3e0) << 6))
1071#define XSPR_MASK (X_MASK | SPR_MASK)
1072
1073/* An XFX form instruction with the SPR field filled in except for the
1074 SPRBAT field. */
1075#define XSPRBAT_MASK (XSPR_MASK &~ SPRBAT_MASK)
1076
1077/* An XFX form instruction with the SPR field filled in except for the
1078 SPRG field. */
1079#define XSPRG_MASK (XSPR_MASK &~ SPRG_MASK)
1080
1081/* The BO encodings used in extended conditional branch mnemonics. */
1082#define BODNZF (0x0)
1083#define BODNZFP (0x1)
1084#define BODZF (0x2)
1085#define BODZFP (0x3)
1086#define BOF (0x4)
1087#define BOFP (0x5)
1088#define BODNZT (0x8)
1089#define BODNZTP (0x9)
1090#define BODZT (0xa)
1091#define BODZTP (0xb)
1092#define BOT (0xc)
1093#define BOTP (0xd)
1094#define BODNZ (0x10)
1095#define BODNZP (0x11)
1096#define BODZ (0x12)
1097#define BODZP (0x13)
1098#define BOU (0x14)
1099
1100/* The BI condition bit encodings used in extended conditional branch
1101 mnemonics. */
1102#define CBLT (0)
1103#define CBGT (1)
1104#define CBEQ (2)
1105#define CBSO (3)
1106
1107/* The TO encodings used in extended trap mnemonics. */
1108#define TOLGT (0x1)
1109#define TOLLT (0x2)
1110#define TOEQ (0x4)
1111#define TOLGE (0x5)
1112#define TOLNL (0x5)
1113#define TOLLE (0x6)
1114#define TOLNG (0x6)
1115#define TOGT (0x8)
1116#define TOGE (0xc)
1117#define TONL (0xc)
1118#define TOLT (0x10)
1119#define TOLE (0x14)
1120#define TONG (0x14)
1121#define TONE (0x18)
1122#define TOU (0x1f)
1123
1124/* Smaller names for the flags so each entry in the opcodes table will
1125 fit on a single line. */
1126#undef PPC
1127#define PPC PPC_OPCODE_PPC
1128#define POWER PPC_OPCODE_POWER
1129#define POWER2 PPC_OPCODE_POWER2
1130#define B32 PPC_OPCODE_32
1131#define B64 PPC_OPCODE_64
1132#define M601 PPC_OPCODE_601
1133
1134/* The opcode table.
1135
1136 The format of the opcode table is:
1137
1138 NAME OPCODE MASK FLAGS { OPERANDS }
1139
1140 NAME is the name of the instruction.
1141 OPCODE is the instruction opcode.
1142 MASK is the opcode mask; this is used to tell the disassembler
1143 which bits in the actual opcode must match OPCODE.
1144 FLAGS are flags indicated what processors support the instruction.
1145 OPERANDS is the list of operands.
1146
1147 The disassembler reads the table in order and prints the first
1148 instruction which matches, so this table is sorted to put more
1149 specific instructions before more general instructions. It is also
1150 sorted by major opcode. */
1151
1152const struct powerpc_opcode powerpc_opcodes[] = {
1153{ "tdlgti", OPTO(2,TOLGT), OPTO_MASK, PPC|B64, { RA, SI } },
1154{ "tdllti", OPTO(2,TOLLT), OPTO_MASK, PPC|B64, { RA, SI } },
1155{ "tdeqi", OPTO(2,TOEQ), OPTO_MASK, PPC|B64, { RA, SI } },
1156{ "tdlgei", OPTO(2,TOLGE), OPTO_MASK, PPC|B64, { RA, SI } },
1157{ "tdlnli", OPTO(2,TOLNL), OPTO_MASK, PPC|B64, { RA, SI } },
1158{ "tdllei", OPTO(2,TOLLE), OPTO_MASK, PPC|B64, { RA, SI } },
1159{ "tdlngi", OPTO(2,TOLNG), OPTO_MASK, PPC|B64, { RA, SI } },
1160{ "tdgti", OPTO(2,TOGT), OPTO_MASK, PPC|B64, { RA, SI } },
1161{ "tdgei", OPTO(2,TOGE), OPTO_MASK, PPC|B64, { RA, SI } },
1162{ "tdnli", OPTO(2,TONL), OPTO_MASK, PPC|B64, { RA, SI } },
1163{ "tdlti", OPTO(2,TOLT), OPTO_MASK, PPC|B64, { RA, SI } },
1164{ "tdlei", OPTO(2,TOLE), OPTO_MASK, PPC|B64, { RA, SI } },
1165{ "tdngi", OPTO(2,TONG), OPTO_MASK, PPC|B64, { RA, SI } },
1166{ "tdnei", OPTO(2,TONE), OPTO_MASK, PPC|B64, { RA, SI } },
1167{ "tdi", OP(2), OP_MASK, PPC|B64, { TO, RA, SI } },
1168
1169{ "twlgti", OPTO(3,TOLGT), OPTO_MASK, PPC, { RA, SI } },
1170{ "tlgti", OPTO(3,TOLGT), OPTO_MASK, POWER, { RA, SI } },
1171{ "twllti", OPTO(3,TOLLT), OPTO_MASK, PPC, { RA, SI } },
1172{ "tllti", OPTO(3,TOLLT), OPTO_MASK, POWER, { RA, SI } },
1173{ "tweqi", OPTO(3,TOEQ), OPTO_MASK, PPC, { RA, SI } },
1174{ "teqi", OPTO(3,TOEQ), OPTO_MASK, POWER, { RA, SI } },
1175{ "twlgei", OPTO(3,TOLGE), OPTO_MASK, PPC, { RA, SI } },
1176{ "tlgei", OPTO(3,TOLGE), OPTO_MASK, POWER, { RA, SI } },
1177{ "twlnli", OPTO(3,TOLNL), OPTO_MASK, PPC, { RA, SI } },
1178{ "tlnli", OPTO(3,TOLNL), OPTO_MASK, POWER, { RA, SI } },
1179{ "twllei", OPTO(3,TOLLE), OPTO_MASK, PPC, { RA, SI } },
1180{ "tllei", OPTO(3,TOLLE), OPTO_MASK, POWER, { RA, SI } },
1181{ "twlngi", OPTO(3,TOLNG), OPTO_MASK, PPC, { RA, SI } },
1182{ "tlngi", OPTO(3,TOLNG), OPTO_MASK, POWER, { RA, SI } },
1183{ "twgti", OPTO(3,TOGT), OPTO_MASK, PPC, { RA, SI } },
1184{ "tgti", OPTO(3,TOGT), OPTO_MASK, POWER, { RA, SI } },
1185{ "twgei", OPTO(3,TOGE), OPTO_MASK, PPC, { RA, SI } },
1186{ "tgei", OPTO(3,TOGE), OPTO_MASK, POWER, { RA, SI } },
1187{ "twnli", OPTO(3,TONL), OPTO_MASK, PPC, { RA, SI } },
1188{ "tnli", OPTO(3,TONL), OPTO_MASK, POWER, { RA, SI } },
1189{ "twlti", OPTO(3,TOLT), OPTO_MASK, PPC, { RA, SI } },
1190{ "tlti", OPTO(3,TOLT), OPTO_MASK, POWER, { RA, SI } },
1191{ "twlei", OPTO(3,TOLE), OPTO_MASK, PPC, { RA, SI } },
1192{ "tlei", OPTO(3,TOLE), OPTO_MASK, POWER, { RA, SI } },
1193{ "twngi", OPTO(3,TONG), OPTO_MASK, PPC, { RA, SI } },
1194{ "tngi", OPTO(3,TONG), OPTO_MASK, POWER, { RA, SI } },
1195{ "twnei", OPTO(3,TONE), OPTO_MASK, PPC, { RA, SI } },
1196{ "tnei", OPTO(3,TONE), OPTO_MASK, POWER, { RA, SI } },
1197{ "twi", OP(3), OP_MASK, PPC, { TO, RA, SI } },
1198{ "ti", OP(3), OP_MASK, POWER, { TO, RA, SI } },
1199
1200{ "mulli", OP(7), OP_MASK, PPC, { RT, RA, SI } },
1201{ "muli", OP(7), OP_MASK, POWER, { RT, RA, SI } },
1202
1203{ "subfic", OP(8), OP_MASK, PPC, { RT, RA, SI } },
1204{ "sfi", OP(8), OP_MASK, POWER, { RT, RA, SI } },
1205
1206{ "dozi", OP(9), OP_MASK, POWER|M601, { RT, RA, SI } },
1207
1208{ "cmplwi", OPL(10,0), OPL_MASK, PPC, { OBF, RA, UI } },
1209{ "cmpldi", OPL(10,1), OPL_MASK, PPC|B64, { OBF, RA, UI } },
1210{ "cmpli", OP(10), OP_MASK, PPC, { BF, L, RA, UI } },
1211{ "cmpli", OP(10), OP_MASK, POWER, { BF, RA, UI } },
1212
1213{ "cmpwi", OPL(11,0), OPL_MASK, PPC, { OBF, RA, SI } },
1214{ "cmpdi", OPL(11,1), OPL_MASK, PPC|B64, { OBF, RA, SI } },
1215{ "cmpi", OP(11), OP_MASK, PPC, { BF, L, RA, SI } },
1216{ "cmpi", OP(11), OP_MASK, POWER, { BF, RA, SI } },
1217
1218{ "addic", OP(12), OP_MASK, PPC, { RT, RA, SI } },
1219{ "ai", OP(12), OP_MASK, POWER, { RT, RA, SI } },
1220{ "subic", OP(12), OP_MASK, PPC, { RT, RA, NSI } },
1221
1222{ "addic.", OP(13), OP_MASK, PPC, { RT, RA, SI } },
1223{ "ai.", OP(13), OP_MASK, POWER, { RT, RA, SI } },
1224{ "subic.", OP(13), OP_MASK, PPC, { RT, RA, NSI } },
1225
1226{ "li", OP(14), DRA_MASK, PPC, { RT, SI } },
1227{ "lil", OP(14), DRA_MASK, POWER, { RT, SI } },
1228{ "addi", OP(14), OP_MASK, PPC, { RT, RA, SI } },
1229{ "cal", OP(14), OP_MASK, POWER, { RT, D, RA } },
1230{ "subi", OP(14), OP_MASK, PPC, { RT, RA, NSI } },
1231{ "la", OP(14), OP_MASK, PPC, { RT, D, RA } },
1232
1233{ "lis", OP(15), DRA_MASK, PPC, { RT, SISIGNOPT } },
1234{ "liu", OP(15), DRA_MASK, POWER, { RT, SISIGNOPT } },
1235{ "addis", OP(15), OP_MASK, PPC, { RT,RA,SISIGNOPT } },
1236{ "cau", OP(15), OP_MASK, POWER, { RT,RA,SISIGNOPT } },
1237{ "subis", OP(15), OP_MASK, PPC, { RT, RA, NSI } },
1238
1239{ "bdnz-", BBO(16,BODNZ,0,0), BBOYBI_MASK, PPC, { BDM } },
1240{ "bdnz+", BBO(16,BODNZ,0,0), BBOYBI_MASK, PPC, { BDP } },
1241{ "bdnz", BBO(16,BODNZ,0,0), BBOYBI_MASK, PPC, { BD } },
1242{ "bdn", BBO(16,BODNZ,0,0), BBOYBI_MASK, POWER, { BD } },
1243{ "bdnzl-", BBO(16,BODNZ,0,1), BBOYBI_MASK, PPC, { BDM } },
1244{ "bdnzl+", BBO(16,BODNZ,0,1), BBOYBI_MASK, PPC, { BDP } },
1245{ "bdnzl", BBO(16,BODNZ,0,1), BBOYBI_MASK, PPC, { BD } },
1246{ "bdnl", BBO(16,BODNZ,0,1), BBOYBI_MASK, POWER, { BD } },
1247{ "bdnza-", BBO(16,BODNZ,1,0), BBOYBI_MASK, PPC, { BDMA } },
1248{ "bdnza+", BBO(16,BODNZ,1,0), BBOYBI_MASK, PPC, { BDPA } },
1249{ "bdnza", BBO(16,BODNZ,1,0), BBOYBI_MASK, PPC, { BDA } },
1250{ "bdna", BBO(16,BODNZ,1,0), BBOYBI_MASK, POWER, { BDA } },
1251{ "bdnzla-", BBO(16,BODNZ,1,1), BBOYBI_MASK, PPC, { BDMA } },
1252{ "bdnzla+", BBO(16,BODNZ,1,1), BBOYBI_MASK, PPC, { BDPA } },
1253{ "bdnzla", BBO(16,BODNZ,1,1), BBOYBI_MASK, PPC, { BDA } },
1254{ "bdnla", BBO(16,BODNZ,1,1), BBOYBI_MASK, POWER, { BDA } },
1255{ "bdz-", BBO(16,BODZ,0,0), BBOYBI_MASK, PPC, { BDM } },
1256{ "bdz+", BBO(16,BODZ,0,0), BBOYBI_MASK, PPC, { BDP } },
1257{ "bdz", BBO(16,BODZ,0,0), BBOYBI_MASK, PPC|POWER, { BD } },
1258{ "bdzl-", BBO(16,BODZ,0,1), BBOYBI_MASK, PPC, { BDM } },
1259{ "bdzl+", BBO(16,BODZ,0,1), BBOYBI_MASK, PPC, { BDP } },
1260{ "bdzl", BBO(16,BODZ,0,1), BBOYBI_MASK, PPC|POWER, { BD } },
1261{ "bdza-", BBO(16,BODZ,1,0), BBOYBI_MASK, PPC, { BDMA } },
1262{ "bdza+", BBO(16,BODZ,1,0), BBOYBI_MASK, PPC, { BDPA } },
1263{ "bdza", BBO(16,BODZ,1,0), BBOYBI_MASK, PPC|POWER, { BDA } },
1264{ "bdzla-", BBO(16,BODZ,1,1), BBOYBI_MASK, PPC, { BDMA } },
1265{ "bdzla+", BBO(16,BODZ,1,1), BBOYBI_MASK, PPC, { BDPA } },
1266{ "bdzla", BBO(16,BODZ,1,1), BBOYBI_MASK, PPC|POWER, { BDA } },
1267{ "blt-", BBOCB(16,BOT,CBLT,0,0), BBOYCB_MASK, PPC, { CR, BDM } },
1268{ "blt+", BBOCB(16,BOT,CBLT,0,0), BBOYCB_MASK, PPC, { CR, BDP } },
1269{ "blt", BBOCB(16,BOT,CBLT,0,0), BBOYCB_MASK, PPC|POWER, { CR, BD } },
1270{ "bltl-", BBOCB(16,BOT,CBLT,0,1), BBOYCB_MASK, PPC, { CR, BDM } },
1271{ "bltl+", BBOCB(16,BOT,CBLT,0,1), BBOYCB_MASK, PPC, { CR, BDP } },
1272{ "bltl", BBOCB(16,BOT,CBLT,0,1), BBOYCB_MASK, PPC|POWER, { CR, BD } },
1273{ "blta-", BBOCB(16,BOT,CBLT,1,0), BBOYCB_MASK, PPC, { CR, BDMA } },
1274{ "blta+", BBOCB(16,BOT,CBLT,1,0), BBOYCB_MASK, PPC, { CR, BDPA } },
1275{ "blta", BBOCB(16,BOT,CBLT,1,0), BBOYCB_MASK, PPC|POWER, { CR, BDA } },
1276{ "bltla-", BBOCB(16,BOT,CBLT,1,1), BBOYCB_MASK, PPC, { CR, BDMA } },
1277{ "bltla+", BBOCB(16,BOT,CBLT,1,1), BBOYCB_MASK, PPC, { CR, BDPA } },
1278{ "bltla", BBOCB(16,BOT,CBLT,1,1), BBOYCB_MASK, PPC|POWER, { CR, BDA } },
1279{ "bgt-", BBOCB(16,BOT,CBGT,0,0), BBOYCB_MASK, PPC, { CR, BDM } },
1280{ "bgt+", BBOCB(16,BOT,CBGT,0,0), BBOYCB_MASK, PPC, { CR, BDP } },
1281{ "bgt", BBOCB(16,BOT,CBGT,0,0), BBOYCB_MASK, PPC|POWER, { CR, BD } },
1282{ "bgtl-", BBOCB(16,BOT,CBGT,0,1), BBOYCB_MASK, PPC, { CR, BDM } },
1283{ "bgtl+", BBOCB(16,BOT,CBGT,0,1), BBOYCB_MASK, PPC, { CR, BDP } },
1284{ "bgtl", BBOCB(16,BOT,CBGT,0,1), BBOYCB_MASK, PPC|POWER, { CR, BD } },
1285{ "bgta-", BBOCB(16,BOT,CBGT,1,0), BBOYCB_MASK, PPC, { CR, BDMA } },
1286{ "bgta+", BBOCB(16,BOT,CBGT,1,0), BBOYCB_MASK, PPC, { CR, BDPA } },
1287{ "bgta", BBOCB(16,BOT,CBGT,1,0), BBOYCB_MASK, PPC|POWER, { CR, BDA } },
1288{ "bgtla-", BBOCB(16,BOT,CBGT,1,1), BBOYCB_MASK, PPC, { CR, BDMA } },
1289{ "bgtla+", BBOCB(16,BOT,CBGT,1,1), BBOYCB_MASK, PPC, { CR, BDPA } },
1290{ "bgtla", BBOCB(16,BOT,CBGT,1,1), BBOYCB_MASK, PPC|POWER, { CR, BDA } },
1291{ "beq-", BBOCB(16,BOT,CBEQ,0,0), BBOYCB_MASK, PPC, { CR, BDM } },
1292{ "beq+", BBOCB(16,BOT,CBEQ,0,0), BBOYCB_MASK, PPC, { CR, BDP } },
1293{ "beq", BBOCB(16,BOT,CBEQ,0,0), BBOYCB_MASK, PPC|POWER, { CR, BD } },
1294{ "beql-", BBOCB(16,BOT,CBEQ,0,1), BBOYCB_MASK, PPC, { CR, BDM } },
1295{ "beql+", BBOCB(16,BOT,CBEQ,0,1), BBOYCB_MASK, PPC, { CR, BDP } },
1296{ "beql", BBOCB(16,BOT,CBEQ,0,1), BBOYCB_MASK, PPC|POWER, { CR, BD } },
1297{ "beqa-", BBOCB(16,BOT,CBEQ,1,0), BBOYCB_MASK, PPC, { CR, BDMA } },
1298{ "beqa+", BBOCB(16,BOT,CBEQ,1,0), BBOYCB_MASK, PPC, { CR, BDPA } },
1299{ "beqa", BBOCB(16,BOT,CBEQ,1,0), BBOYCB_MASK, PPC|POWER, { CR, BDA } },
1300{ "beqla-", BBOCB(16,BOT,CBEQ,1,1), BBOYCB_MASK, PPC, { CR, BDMA } },
1301{ "beqla+", BBOCB(16,BOT,CBEQ,1,1), BBOYCB_MASK, PPC, { CR, BDPA } },
1302{ "beqla", BBOCB(16,BOT,CBEQ,1,1), BBOYCB_MASK, PPC|POWER, { CR, BDA } },
1303{ "bso-", BBOCB(16,BOT,CBSO,0,0), BBOYCB_MASK, PPC, { CR, BDM } },
1304{ "bso+", BBOCB(16,BOT,CBSO,0,0), BBOYCB_MASK, PPC, { CR, BDP } },
1305{ "bso", BBOCB(16,BOT,CBSO,0,0), BBOYCB_MASK, PPC|POWER, { CR, BD } },
1306{ "bsol-", BBOCB(16,BOT,CBSO,0,1), BBOYCB_MASK, PPC, { CR, BDM } },
1307{ "bsol+", BBOCB(16,BOT,CBSO,0,1), BBOYCB_MASK, PPC, { CR, BDP } },
1308{ "bsol", BBOCB(16,BOT,CBSO,0,1), BBOYCB_MASK, PPC|POWER, { CR, BD } },
1309{ "bsoa-", BBOCB(16,BOT,CBSO,1,0), BBOYCB_MASK, PPC, { CR, BDMA } },
1310{ "bsoa+", BBOCB(16,BOT,CBSO,1,0), BBOYCB_MASK, PPC, { CR, BDPA } },
1311{ "bsoa", BBOCB(16,BOT,CBSO,1,0), BBOYCB_MASK, PPC|POWER, { CR, BDA } },
1312{ "bsola-", BBOCB(16,BOT,CBSO,1,1), BBOYCB_MASK, PPC, { CR, BDMA } },
1313{ "bsola+", BBOCB(16,BOT,CBSO,1,1), BBOYCB_MASK, PPC, { CR, BDPA } },
1314{ "bsola", BBOCB(16,BOT,CBSO,1,1), BBOYCB_MASK, PPC|POWER, { CR, BDA } },
1315{ "bun-", BBOCB(16,BOT,CBSO,0,0), BBOYCB_MASK, PPC, { CR, BDM } },
1316{ "bun+", BBOCB(16,BOT,CBSO,0,0), BBOYCB_MASK, PPC, { CR, BDP } },
1317{ "bun", BBOCB(16,BOT,CBSO,0,0), BBOYCB_MASK, PPC, { CR, BD } },
1318{ "bunl-", BBOCB(16,BOT,CBSO,0,1), BBOYCB_MASK, PPC, { CR, BDM } },
1319{ "bunl+", BBOCB(16,BOT,CBSO,0,1), BBOYCB_MASK, PPC, { CR, BDP } },
1320{ "bunl", BBOCB(16,BOT,CBSO,0,1), BBOYCB_MASK, PPC, { CR, BD } },
1321{ "buna-", BBOCB(16,BOT,CBSO,1,0), BBOYCB_MASK, PPC, { CR, BDMA } },
1322{ "buna+", BBOCB(16,BOT,CBSO,1,0), BBOYCB_MASK, PPC, { CR, BDPA } },
1323{ "buna", BBOCB(16,BOT,CBSO,1,0), BBOYCB_MASK, PPC, { CR, BDA } },
1324{ "bunla-", BBOCB(16,BOT,CBSO,1,1), BBOYCB_MASK, PPC, { CR, BDMA } },
1325{ "bunla+", BBOCB(16,BOT,CBSO,1,1), BBOYCB_MASK, PPC, { CR, BDPA } },
1326{ "bunla", BBOCB(16,BOT,CBSO,1,1), BBOYCB_MASK, PPC, { CR, BDA } },
1327{ "bge-", BBOCB(16,BOF,CBLT,0,0), BBOYCB_MASK, PPC, { CR, BDM } },
1328{ "bge+", BBOCB(16,BOF,CBLT,0,0), BBOYCB_MASK, PPC, { CR, BDP } },
1329{ "bge", BBOCB(16,BOF,CBLT,0,0), BBOYCB_MASK, PPC|POWER, { CR, BD } },
1330{ "bgel-", BBOCB(16,BOF,CBLT,0,1), BBOYCB_MASK, PPC, { CR, BDM } },
1331{ "bgel+", BBOCB(16,BOF,CBLT,0,1), BBOYCB_MASK, PPC, { CR, BDP } },
1332{ "bgel", BBOCB(16,BOF,CBLT,0,1), BBOYCB_MASK, PPC|POWER, { CR, BD } },
1333{ "bgea-", BBOCB(16,BOF,CBLT,1,0), BBOYCB_MASK, PPC, { CR, BDMA } },
1334{ "bgea+", BBOCB(16,BOF,CBLT,1,0), BBOYCB_MASK, PPC, { CR, BDPA } },
1335{ "bgea", BBOCB(16,BOF,CBLT,1,0), BBOYCB_MASK, PPC|POWER, { CR, BDA } },
1336{ "bgela-", BBOCB(16,BOF,CBLT,1,1), BBOYCB_MASK, PPC, { CR, BDMA } },
1337{ "bgela+", BBOCB(16,BOF,CBLT,1,1), BBOYCB_MASK, PPC, { CR, BDPA } },
1338{ "bgela", BBOCB(16,BOF,CBLT,1,1), BBOYCB_MASK, PPC|POWER, { CR, BDA } },
1339{ "bnl-", BBOCB(16,BOF,CBLT,0,0), BBOYCB_MASK, PPC, { CR, BDM } },
1340{ "bnl+", BBOCB(16,BOF,CBLT,0,0), BBOYCB_MASK, PPC, { CR, BDP } },
1341{ "bnl", BBOCB(16,BOF,CBLT,0,0), BBOYCB_MASK, PPC|POWER, { CR, BD } },
1342{ "bnll-", BBOCB(16,BOF,CBLT,0,1), BBOYCB_MASK, PPC, { CR, BDM } },
1343{ "bnll+", BBOCB(16,BOF,CBLT,0,1), BBOYCB_MASK, PPC, { CR, BDP } },
1344{ "bnll", BBOCB(16,BOF,CBLT,0,1), BBOYCB_MASK, PPC|POWER, { CR, BD } },
1345{ "bnla-", BBOCB(16,BOF,CBLT,1,0), BBOYCB_MASK, PPC, { CR, BDMA } },
1346{ "bnla+", BBOCB(16,BOF,CBLT,1,0), BBOYCB_MASK, PPC, { CR, BDPA } },
1347{ "bnla", BBOCB(16,BOF,CBLT,1,0), BBOYCB_MASK, PPC|POWER, { CR, BDA } },
1348{ "bnlla-", BBOCB(16,BOF,CBLT,1,1), BBOYCB_MASK, PPC, { CR, BDMA } },
1349{ "bnlla+", BBOCB(16,BOF,CBLT,1,1), BBOYCB_MASK, PPC, { CR, BDPA } },
1350{ "bnlla", BBOCB(16,BOF,CBLT,1,1), BBOYCB_MASK, PPC|POWER, { CR, BDA } },
1351{ "ble-", BBOCB(16,BOF,CBGT,0,0), BBOYCB_MASK, PPC, { CR, BDM } },
1352{ "ble+", BBOCB(16,BOF,CBGT,0,0), BBOYCB_MASK, PPC, { CR, BDP } },
1353{ "ble", BBOCB(16,BOF,CBGT,0,0), BBOYCB_MASK, PPC|POWER, { CR, BD } },
1354{ "blel-", BBOCB(16,BOF,CBGT,0,1), BBOYCB_MASK, PPC, { CR, BDM } },
1355{ "blel+", BBOCB(16,BOF,CBGT,0,1), BBOYCB_MASK, PPC, { CR, BDP } },
1356{ "blel", BBOCB(16,BOF,CBGT,0,1), BBOYCB_MASK, PPC|POWER, { CR, BD } },
1357{ "blea-", BBOCB(16,BOF,CBGT,1,0), BBOYCB_MASK, PPC, { CR, BDMA } },
1358{ "blea+", BBOCB(16,BOF,CBGT,1,0), BBOYCB_MASK, PPC, { CR, BDPA } },
1359{ "blea", BBOCB(16,BOF,CBGT,1,0), BBOYCB_MASK, PPC|POWER, { CR, BDA } },
1360{ "blela-", BBOCB(16,BOF,CBGT,1,1), BBOYCB_MASK, PPC, { CR, BDMA } },
1361{ "blela+", BBOCB(16,BOF,CBGT,1,1), BBOYCB_MASK, PPC, { CR, BDPA } },
1362{ "blela", BBOCB(16,BOF,CBGT,1,1), BBOYCB_MASK, PPC|POWER, { CR, BDA } },
1363{ "bng-", BBOCB(16,BOF,CBGT,0,0), BBOYCB_MASK, PPC, { CR, BDM } },
1364{ "bng+", BBOCB(16,BOF,CBGT,0,0), BBOYCB_MASK, PPC, { CR, BDP } },
1365{ "bng", BBOCB(16,BOF,CBGT,0,0), BBOYCB_MASK, PPC|POWER, { CR, BD } },
1366{ "bngl-", BBOCB(16,BOF,CBGT,0,1), BBOYCB_MASK, PPC, { CR, BDM } },
1367{ "bngl+", BBOCB(16,BOF,CBGT,0,1), BBOYCB_MASK, PPC, { CR, BDP } },
1368{ "bngl", BBOCB(16,BOF,CBGT,0,1), BBOYCB_MASK, PPC|POWER, { CR, BD } },
1369{ "bnga-", BBOCB(16,BOF,CBGT,1,0), BBOYCB_MASK, PPC, { CR, BDMA } },
1370{ "bnga+", BBOCB(16,BOF,CBGT,1,0), BBOYCB_MASK, PPC, { CR, BDPA } },
1371{ "bnga", BBOCB(16,BOF,CBGT,1,0), BBOYCB_MASK, PPC|POWER, { CR, BDA } },
1372{ "bngla-", BBOCB(16,BOF,CBGT,1,1), BBOYCB_MASK, PPC, { CR, BDMA } },
1373{ "bngla+", BBOCB(16,BOF,CBGT,1,1), BBOYCB_MASK, PPC, { CR, BDPA } },
1374{ "bngla", BBOCB(16,BOF,CBGT,1,1), BBOYCB_MASK, PPC|POWER, { CR, BDA } },
1375{ "bne-", BBOCB(16,BOF,CBEQ,0,0), BBOYCB_MASK, PPC, { CR, BDM } },
1376{ "bne+", BBOCB(16,BOF,CBEQ,0,0), BBOYCB_MASK, PPC, { CR, BDP } },
1377{ "bne", BBOCB(16,BOF,CBEQ,0,0), BBOYCB_MASK, PPC|POWER, { CR, BD } },
1378{ "bnel-", BBOCB(16,BOF,CBEQ,0,1), BBOYCB_MASK, PPC, { CR, BDM } },
1379{ "bnel+", BBOCB(16,BOF,CBEQ,0,1), BBOYCB_MASK, PPC, { CR, BDP } },
1380{ "bnel", BBOCB(16,BOF,CBEQ,0,1), BBOYCB_MASK, PPC|POWER, { CR, BD } },
1381{ "bnea-", BBOCB(16,BOF,CBEQ,1,0), BBOYCB_MASK, PPC, { CR, BDMA } },
1382{ "bnea+", BBOCB(16,BOF,CBEQ,1,0), BBOYCB_MASK, PPC, { CR, BDPA } },
1383{ "bnea", BBOCB(16,BOF,CBEQ,1,0), BBOYCB_MASK, PPC|POWER, { CR, BDA } },
1384{ "bnela-", BBOCB(16,BOF,CBEQ,1,1), BBOYCB_MASK, PPC, { CR, BDMA } },
1385{ "bnela+", BBOCB(16,BOF,CBEQ,1,1), BBOYCB_MASK, PPC, { CR, BDPA } },
1386{ "bnela", BBOCB(16,BOF,CBEQ,1,1), BBOYCB_MASK, PPC|POWER, { CR, BDA } },
1387{ "bns-", BBOCB(16,BOF,CBSO,0,0), BBOYCB_MASK, PPC, { CR, BDM } },
1388{ "bns+", BBOCB(16,BOF,CBSO,0,0), BBOYCB_MASK, PPC, { CR, BDP } },
1389{ "bns", BBOCB(16,BOF,CBSO,0,0), BBOYCB_MASK, PPC|POWER, { CR, BD } },
1390{ "bnsl-", BBOCB(16,BOF,CBSO,0,1), BBOYCB_MASK, PPC, { CR, BDM } },
1391{ "bnsl+", BBOCB(16,BOF,CBSO,0,1), BBOYCB_MASK, PPC, { CR, BDP } },
1392{ "bnsl", BBOCB(16,BOF,CBSO,0,1), BBOYCB_MASK, PPC|POWER, { CR, BD } },
1393{ "bnsa-", BBOCB(16,BOF,CBSO,1,0), BBOYCB_MASK, PPC, { CR, BDMA } },
1394{ "bnsa+", BBOCB(16,BOF,CBSO,1,0), BBOYCB_MASK, PPC, { CR, BDPA } },
1395{ "bnsa", BBOCB(16,BOF,CBSO,1,0), BBOYCB_MASK, PPC|POWER, { CR, BDA } },
1396{ "bnsla-", BBOCB(16,BOF,CBSO,1,1), BBOYCB_MASK, PPC, { CR, BDMA } },
1397{ "bnsla+", BBOCB(16,BOF,CBSO,1,1), BBOYCB_MASK, PPC, { CR, BDPA } },
1398{ "bnsla", BBOCB(16,BOF,CBSO,1,1), BBOYCB_MASK, PPC|POWER, { CR, BDA } },
1399{ "bnu-", BBOCB(16,BOF,CBSO,0,0), BBOYCB_MASK, PPC, { CR, BDM } },
1400{ "bnu+", BBOCB(16,BOF,CBSO,0,0), BBOYCB_MASK, PPC, { CR, BDP } },
1401{ "bnu", BBOCB(16,BOF,CBSO,0,0), BBOYCB_MASK, PPC, { CR, BD } },
1402{ "bnul-", BBOCB(16,BOF,CBSO,0,1), BBOYCB_MASK, PPC, { CR, BDM } },
1403{ "bnul+", BBOCB(16,BOF,CBSO,0,1), BBOYCB_MASK, PPC, { CR, BDP } },
1404{ "bnul", BBOCB(16,BOF,CBSO,0,1), BBOYCB_MASK, PPC, { CR, BD } },
1405{ "bnua-", BBOCB(16,BOF,CBSO,1,0), BBOYCB_MASK, PPC, { CR, BDMA } },
1406{ "bnua+", BBOCB(16,BOF,CBSO,1,0), BBOYCB_MASK, PPC, { CR, BDPA } },
1407{ "bnua", BBOCB(16,BOF,CBSO,1,0), BBOYCB_MASK, PPC, { CR, BDA } },
1408{ "bnula-", BBOCB(16,BOF,CBSO,1,1), BBOYCB_MASK, PPC, { CR, BDMA } },
1409{ "bnula+", BBOCB(16,BOF,CBSO,1,1), BBOYCB_MASK, PPC, { CR, BDPA } },
1410{ "bnula", BBOCB(16,BOF,CBSO,1,1), BBOYCB_MASK, PPC, { CR, BDA } },
1411{ "bdnzt-", BBO(16,BODNZT,0,0), BBOY_MASK, PPC, { BI, BDM } },
1412{ "bdnzt+", BBO(16,BODNZT,0,0), BBOY_MASK, PPC, { BI, BDP } },
1413{ "bdnzt", BBO(16,BODNZT,0,0), BBOY_MASK, PPC, { BI, BD } },
1414{ "bdnztl-", BBO(16,BODNZT,0,1), BBOY_MASK, PPC, { BI, BDM } },
1415{ "bdnztl+", BBO(16,BODNZT,0,1), BBOY_MASK, PPC, { BI, BDP } },
1416{ "bdnztl", BBO(16,BODNZT,0,1), BBOY_MASK, PPC, { BI, BD } },
1417{ "bdnzta-", BBO(16,BODNZT,1,0), BBOY_MASK, PPC, { BI, BDMA } },
1418{ "bdnzta+", BBO(16,BODNZT,1,0), BBOY_MASK, PPC, { BI, BDPA } },
1419{ "bdnzta", BBO(16,BODNZT,1,0), BBOY_MASK, PPC, { BI, BDA } },
1420{ "bdnztla-",BBO(16,BODNZT,1,1), BBOY_MASK, PPC, { BI, BDMA } },
1421{ "bdnztla+",BBO(16,BODNZT,1,1), BBOY_MASK, PPC, { BI, BDPA } },
1422{ "bdnztla", BBO(16,BODNZT,1,1), BBOY_MASK, PPC, { BI, BDA } },
1423{ "bdnzf-", BBO(16,BODNZF,0,0), BBOY_MASK, PPC, { BI, BDM } },
1424{ "bdnzf+", BBO(16,BODNZF,0,0), BBOY_MASK, PPC, { BI, BDP } },
1425{ "bdnzf", BBO(16,BODNZF,0,0), BBOY_MASK, PPC, { BI, BD } },
1426{ "bdnzfl-", BBO(16,BODNZF,0,1), BBOY_MASK, PPC, { BI, BDM } },
1427{ "bdnzfl+", BBO(16,BODNZF,0,1), BBOY_MASK, PPC, { BI, BDP } },
1428{ "bdnzfl", BBO(16,BODNZF,0,1), BBOY_MASK, PPC, { BI, BD } },
1429{ "bdnzfa-", BBO(16,BODNZF,1,0), BBOY_MASK, PPC, { BI, BDMA } },
1430{ "bdnzfa+", BBO(16,BODNZF,1,0), BBOY_MASK, PPC, { BI, BDPA } },
1431{ "bdnzfa", BBO(16,BODNZF,1,0), BBOY_MASK, PPC, { BI, BDA } },
1432{ "bdnzfla-",BBO(16,BODNZF,1,1), BBOY_MASK, PPC, { BI, BDMA } },
1433{ "bdnzfla+",BBO(16,BODNZF,1,1), BBOY_MASK, PPC, { BI, BDPA } },
1434{ "bdnzfla", BBO(16,BODNZF,1,1), BBOY_MASK, PPC, { BI, BDA } },
1435{ "bt-", BBO(16,BOT,0,0), BBOY_MASK, PPC, { BI, BDM } },
1436{ "bt+", BBO(16,BOT,0,0), BBOY_MASK, PPC, { BI, BDP } },
1437{ "bt", BBO(16,BOT,0,0), BBOY_MASK, PPC, { BI, BD } },
1438{ "bbt", BBO(16,BOT,0,0), BBOY_MASK, POWER, { BI, BD } },
1439{ "btl-", BBO(16,BOT,0,1), BBOY_MASK, PPC, { BI, BDM } },
1440{ "btl+", BBO(16,BOT,0,1), BBOY_MASK, PPC, { BI, BDP } },
1441{ "btl", BBO(16,BOT,0,1), BBOY_MASK, PPC, { BI, BD } },
1442{ "bbtl", BBO(16,BOT,0,1), BBOY_MASK, POWER, { BI, BD } },
1443{ "bta-", BBO(16,BOT,1,0), BBOY_MASK, PPC, { BI, BDMA } },
1444{ "bta+", BBO(16,BOT,1,0), BBOY_MASK, PPC, { BI, BDPA } },
1445{ "bta", BBO(16,BOT,1,0), BBOY_MASK, PPC, { BI, BDA } },
1446{ "bbta", BBO(16,BOT,1,0), BBOY_MASK, POWER, { BI, BDA } },
1447{ "btla-", BBO(16,BOT,1,1), BBOY_MASK, PPC, { BI, BDMA } },
1448{ "btla+", BBO(16,BOT,1,1), BBOY_MASK, PPC, { BI, BDPA } },
1449{ "btla", BBO(16,BOT,1,1), BBOY_MASK, PPC, { BI, BDA } },
1450{ "bbtla", BBO(16,BOT,1,1), BBOY_MASK, POWER, { BI, BDA } },
1451{ "bf-", BBO(16,BOF,0,0), BBOY_MASK, PPC, { BI, BDM } },
1452{ "bf+", BBO(16,BOF,0,0), BBOY_MASK, PPC, { BI, BDP } },
1453{ "bf", BBO(16,BOF,0,0), BBOY_MASK, PPC, { BI, BD } },
1454{ "bbf", BBO(16,BOF,0,0), BBOY_MASK, POWER, { BI, BD } },
1455{ "bfl-", BBO(16,BOF,0,1), BBOY_MASK, PPC, { BI, BDM } },
1456{ "bfl+", BBO(16,BOF,0,1), BBOY_MASK, PPC, { BI, BDP } },
1457{ "bfl", BBO(16,BOF,0,1), BBOY_MASK, PPC, { BI, BD } },
1458{ "bbfl", BBO(16,BOF,0,1), BBOY_MASK, POWER, { BI, BD } },
1459{ "bfa-", BBO(16,BOF,1,0), BBOY_MASK, PPC, { BI, BDMA } },
1460{ "bfa+", BBO(16,BOF,1,0), BBOY_MASK, PPC, { BI, BDPA } },
1461{ "bfa", BBO(16,BOF,1,0), BBOY_MASK, PPC, { BI, BDA } },
1462{ "bbfa", BBO(16,BOF,1,0), BBOY_MASK, POWER, { BI, BDA } },
1463{ "bfla-", BBO(16,BOF,1,1), BBOY_MASK, PPC, { BI, BDMA } },
1464{ "bfla+", BBO(16,BOF,1,1), BBOY_MASK, PPC, { BI, BDPA } },
1465{ "bfla", BBO(16,BOF,1,1), BBOY_MASK, PPC, { BI, BDA } },
1466{ "bbfla", BBO(16,BOF,1,1), BBOY_MASK, POWER, { BI, BDA } },
1467{ "bdzt-", BBO(16,BODZT,0,0), BBOY_MASK, PPC, { BI, BDM } },
1468{ "bdzt+", BBO(16,BODZT,0,0), BBOY_MASK, PPC, { BI, BDP } },
1469{ "bdzt", BBO(16,BODZT,0,0), BBOY_MASK, PPC, { BI, BD } },
1470{ "bdztl-", BBO(16,BODZT,0,1), BBOY_MASK, PPC, { BI, BDM } },
1471{ "bdztl+", BBO(16,BODZT,0,1), BBOY_MASK, PPC, { BI, BDP } },
1472{ "bdztl", BBO(16,BODZT,0,1), BBOY_MASK, PPC, { BI, BD } },
1473{ "bdzta-", BBO(16,BODZT,1,0), BBOY_MASK, PPC, { BI, BDMA } },
1474{ "bdzta+", BBO(16,BODZT,1,0), BBOY_MASK, PPC, { BI, BDPA } },
1475{ "bdzta", BBO(16,BODZT,1,0), BBOY_MASK, PPC, { BI, BDA } },
1476{ "bdztla-", BBO(16,BODZT,1,1), BBOY_MASK, PPC, { BI, BDMA } },
1477{ "bdztla+", BBO(16,BODZT,1,1), BBOY_MASK, PPC, { BI, BDPA } },
1478{ "bdztla", BBO(16,BODZT,1,1), BBOY_MASK, PPC, { BI, BDA } },
1479{ "bdzf-", BBO(16,BODZF,0,0), BBOY_MASK, PPC, { BI, BDM } },
1480{ "bdzf+", BBO(16,BODZF,0,0), BBOY_MASK, PPC, { BI, BDP } },
1481{ "bdzf", BBO(16,BODZF,0,0), BBOY_MASK, PPC, { BI, BD } },
1482{ "bdzfl-", BBO(16,BODZF,0,1), BBOY_MASK, PPC, { BI, BDM } },
1483{ "bdzfl+", BBO(16,BODZF,0,1), BBOY_MASK, PPC, { BI, BDP } },
1484{ "bdzfl", BBO(16,BODZF,0,1), BBOY_MASK, PPC, { BI, BD } },
1485{ "bdzfa-", BBO(16,BODZF,1,0), BBOY_MASK, PPC, { BI, BDMA } },
1486{ "bdzfa+", BBO(16,BODZF,1,0), BBOY_MASK, PPC, { BI, BDPA } },
1487{ "bdzfa", BBO(16,BODZF,1,0), BBOY_MASK, PPC, { BI, BDA } },
1488{ "bdzfla-", BBO(16,BODZF,1,1), BBOY_MASK, PPC, { BI, BDMA } },
1489{ "bdzfla+", BBO(16,BODZF,1,1), BBOY_MASK, PPC, { BI, BDPA } },
1490{ "bdzfla", BBO(16,BODZF,1,1), BBOY_MASK, PPC, { BI, BDA } },
1491{ "bc-", B(16,0,0), B_MASK, PPC, { BOE, BI, BDM } },
1492{ "bc+", B(16,0,0), B_MASK, PPC, { BOE, BI, BDP } },
1493{ "bc", B(16,0,0), B_MASK, PPC|POWER, { BO, BI, BD } },
1494{ "bcl-", B(16,0,1), B_MASK, PPC, { BOE, BI, BDM } },
1495{ "bcl+", B(16,0,1), B_MASK, PPC, { BOE, BI, BDP } },
1496{ "bcl", B(16,0,1), B_MASK, PPC|POWER, { BO, BI, BD } },
1497{ "bca-", B(16,1,0), B_MASK, PPC, { BOE, BI, BDMA } },
1498{ "bca+", B(16,1,0), B_MASK, PPC, { BOE, BI, BDPA } },
1499{ "bca", B(16,1,0), B_MASK, PPC|POWER, { BO, BI, BDA } },
1500{ "bcla-", B(16,1,1), B_MASK, PPC, { BOE, BI, BDMA } },
1501{ "bcla+", B(16,1,1), B_MASK, PPC, { BOE, BI, BDPA } },
1502{ "bcla", B(16,1,1), B_MASK, PPC|POWER, { BO, BI, BDA } },
1503
1504{ "sc", SC(17,1,0), 0xffffffff, PPC, { 0 } },
1505{ "svc", SC(17,0,0), SC_MASK, POWER, { LEV, FL1, FL2 } },
1506{ "svcl", SC(17,0,1), SC_MASK, POWER, { LEV, FL1, FL2 } },
1507{ "svca", SC(17,1,0), SC_MASK, POWER, { SV } },
1508{ "svcla", SC(17,1,1), SC_MASK, POWER, { SV } },
1509
1510{ "b", B(18,0,0), B_MASK, PPC|POWER, { LI } },
1511{ "bl", B(18,0,1), B_MASK, PPC|POWER, { LI } },
1512{ "ba", B(18,1,0), B_MASK, PPC|POWER, { LIA } },
1513{ "bla", B(18,1,1), B_MASK, PPC|POWER, { LIA } },
1514
1515{ "mcrf", XL(19,0), XLBB_MASK|(3<<21)|(3<<16), PPC|POWER, { BF, BFA } },
1516
1517{ "blr", XLO(19,BOU,16,0), XLBOBIBB_MASK, PPC, { 0 } },
1518{ "br", XLO(19,BOU,16,0), XLBOBIBB_MASK, POWER, { 0 } },
1519{ "blrl", XLO(19,BOU,16,1), XLBOBIBB_MASK, PPC, { 0 } },
1520{ "brl", XLO(19,BOU,16,1), XLBOBIBB_MASK, POWER, { 0 } },
1521{ "bdnzlr", XLO(19,BODNZ,16,0), XLBOBIBB_MASK, PPC, { 0 } },
1522{ "bdnzlr-", XLO(19,BODNZ,16,0), XLBOBIBB_MASK, PPC, { 0 } },
1523{ "bdnzlr+", XLO(19,BODNZP,16,0), XLBOBIBB_MASK, PPC, { 0 } },
1524{ "bdnzlrl", XLO(19,BODNZ,16,1), XLBOBIBB_MASK, PPC, { 0 } },
1525{ "bdnzlrl-",XLO(19,BODNZ,16,1), XLBOBIBB_MASK, PPC, { 0 } },
1526{ "bdnzlrl+",XLO(19,BODNZP,16,1), XLBOBIBB_MASK, PPC, { 0 } },
1527{ "bdzlr", XLO(19,BODZ,16,0), XLBOBIBB_MASK, PPC, { 0 } },
1528{ "bdzlr-", XLO(19,BODZ,16,0), XLBOBIBB_MASK, PPC, { 0 } },
1529{ "bdzlr+", XLO(19,BODZP,16,0), XLBOBIBB_MASK, PPC, { 0 } },
1530{ "bdzlrl", XLO(19,BODZ,16,1), XLBOBIBB_MASK, PPC, { 0 } },
1531{ "bdzlrl-", XLO(19,BODZ,16,1), XLBOBIBB_MASK, PPC, { 0 } },
1532{ "bdzlrl+", XLO(19,BODZP,16,1), XLBOBIBB_MASK, PPC, { 0 } },
1533{ "bltlr", XLOCB(19,BOT,CBLT,16,0), XLBOCBBB_MASK, PPC, { CR } },
1534{ "bltlr-", XLOCB(19,BOT,CBLT,16,0), XLBOCBBB_MASK, PPC, { CR } },
1535{ "bltlr+", XLOCB(19,BOTP,CBLT,16,0), XLBOCBBB_MASK, PPC, { CR } },
1536{ "bltr", XLOCB(19,BOT,CBLT,16,0), XLBOCBBB_MASK, POWER, { CR } },
1537{ "bltlrl", XLOCB(19,BOT,CBLT,16,1), XLBOCBBB_MASK, PPC, { CR } },
1538{ "bltlrl-", XLOCB(19,BOT,CBLT,16,1), XLBOCBBB_MASK, PPC, { CR } },
1539{ "bltlrl+", XLOCB(19,BOTP,CBLT,16,1), XLBOCBBB_MASK, PPC, { CR } },
1540{ "bltrl", XLOCB(19,BOT,CBLT,16,1), XLBOCBBB_MASK, POWER, { CR } },
1541{ "bgtlr", XLOCB(19,BOT,CBGT,16,0), XLBOCBBB_MASK, PPC, { CR } },
1542{ "bgtlr-", XLOCB(19,BOT,CBGT,16,0), XLBOCBBB_MASK, PPC, { CR } },
1543{ "bgtlr+", XLOCB(19,BOTP,CBGT,16,0), XLBOCBBB_MASK, PPC, { CR } },
1544{ "bgtr", XLOCB(19,BOT,CBGT,16,0), XLBOCBBB_MASK, POWER, { CR } },
1545{ "bgtlrl", XLOCB(19,BOT,CBGT,16,1), XLBOCBBB_MASK, PPC, { CR } },
1546{ "bgtlrl-", XLOCB(19,BOT,CBGT,16,1), XLBOCBBB_MASK, PPC, { CR } },
1547{ "bgtlrl+", XLOCB(19,BOTP,CBGT,16,1), XLBOCBBB_MASK, PPC, { CR } },
1548{ "bgtrl", XLOCB(19,BOT,CBGT,16,1), XLBOCBBB_MASK, POWER, { CR } },
1549{ "beqlr", XLOCB(19,BOT,CBEQ,16,0), XLBOCBBB_MASK, PPC, { CR } },
1550{ "beqlr-", XLOCB(19,BOT,CBEQ,16,0), XLBOCBBB_MASK, PPC, { CR } },
1551{ "beqlr+", XLOCB(19,BOTP,CBEQ,16,0), XLBOCBBB_MASK, PPC, { CR } },
1552{ "beqr", XLOCB(19,BOT,CBEQ,16,0), XLBOCBBB_MASK, POWER, { CR } },
1553{ "beqlrl", XLOCB(19,BOT,CBEQ,16,1), XLBOCBBB_MASK, PPC, { CR } },
1554{ "beqlrl-", XLOCB(19,BOT,CBEQ,16,1), XLBOCBBB_MASK, PPC, { CR } },
1555{ "beqlrl+", XLOCB(19,BOTP,CBEQ,16,1), XLBOCBBB_MASK, PPC, { CR } },
1556{ "beqrl", XLOCB(19,BOT,CBEQ,16,1), XLBOCBBB_MASK, POWER, { CR } },
1557{ "bsolr", XLOCB(19,BOT,CBSO,16,0), XLBOCBBB_MASK, PPC, { CR } },
1558{ "bsolr-", XLOCB(19,BOT,CBSO,16,0), XLBOCBBB_MASK, PPC, { CR } },
1559{ "bsolr+", XLOCB(19,BOTP,CBSO,16,0), XLBOCBBB_MASK, PPC, { CR } },
1560{ "bsor", XLOCB(19,BOT,CBSO,16,0), XLBOCBBB_MASK, POWER, { CR } },
1561{ "bsolrl", XLOCB(19,BOT,CBSO,16,1), XLBOCBBB_MASK, PPC, { CR } },
1562{ "bsolrl-", XLOCB(19,BOT,CBSO,16,1), XLBOCBBB_MASK, PPC, { CR } },
1563{ "bsolrl+", XLOCB(19,BOTP,CBSO,16,1), XLBOCBBB_MASK, PPC, { CR } },
1564{ "bsorl", XLOCB(19,BOT,CBSO,16,1), XLBOCBBB_MASK, POWER, { CR } },
1565{ "bunlr", XLOCB(19,BOT,CBSO,16,0), XLBOCBBB_MASK, PPC, { CR } },
1566{ "bunlr-", XLOCB(19,BOT,CBSO,16,0), XLBOCBBB_MASK, PPC, { CR } },
1567{ "bunlr+", XLOCB(19,BOTP,CBSO,16,0), XLBOCBBB_MASK, PPC, { CR } },
1568{ "bunlrl", XLOCB(19,BOT,CBSO,16,1), XLBOCBBB_MASK, PPC, { CR } },
1569{ "bunlrl-", XLOCB(19,BOT,CBSO,16,1), XLBOCBBB_MASK, PPC, { CR } },
1570{ "bunlrl+", XLOCB(19,BOTP,CBSO,16,1), XLBOCBBB_MASK, PPC, { CR } },
1571{ "bgelr", XLOCB(19,BOF,CBLT,16,0), XLBOCBBB_MASK, PPC, { CR } },
1572{ "bgelr-", XLOCB(19,BOF,CBLT,16,0), XLBOCBBB_MASK, PPC, { CR } },
1573{ "bgelr+", XLOCB(19,BOFP,CBLT,16,0), XLBOCBBB_MASK, PPC, { CR } },
1574{ "bger", XLOCB(19,BOF,CBLT,16,0), XLBOCBBB_MASK, POWER, { CR } },
1575{ "bgelrl", XLOCB(19,BOF,CBLT,16,1), XLBOCBBB_MASK, PPC, { CR } },
1576{ "bgelrl-", XLOCB(19,BOF,CBLT,16,1), XLBOCBBB_MASK, PPC, { CR } },
1577{ "bgelrl+", XLOCB(19,BOFP,CBLT,16,1), XLBOCBBB_MASK, PPC, { CR } },
1578{ "bgerl", XLOCB(19,BOF,CBLT,16,1), XLBOCBBB_MASK, POWER, { CR } },
1579{ "bnllr", XLOCB(19,BOF,CBLT,16,0), XLBOCBBB_MASK, PPC, { CR } },
1580{ "bnllr-", XLOCB(19,BOF,CBLT,16,0), XLBOCBBB_MASK, PPC, { CR } },
1581{ "bnllr+", XLOCB(19,BOFP,CBLT,16,0), XLBOCBBB_MASK, PPC, { CR } },
1582{ "bnlr", XLOCB(19,BOF,CBLT,16,0), XLBOCBBB_MASK, POWER, { CR } },
1583{ "bnllrl", XLOCB(19,BOF,CBLT,16,1), XLBOCBBB_MASK, PPC, { CR } },
1584{ "bnllrl-", XLOCB(19,BOF,CBLT,16,1), XLBOCBBB_MASK, PPC, { CR } },
1585{ "bnllrl+", XLOCB(19,BOFP,CBLT,16,1), XLBOCBBB_MASK, PPC, { CR } },
1586{ "bnlrl", XLOCB(19,BOF,CBLT,16,1), XLBOCBBB_MASK, POWER, { CR } },
1587{ "blelr", XLOCB(19,BOF,CBGT,16,0), XLBOCBBB_MASK, PPC, { CR } },
1588{ "blelr-", XLOCB(19,BOF,CBGT,16,0), XLBOCBBB_MASK, PPC, { CR } },
1589{ "blelr+", XLOCB(19,BOFP,CBGT,16,0), XLBOCBBB_MASK, PPC, { CR } },
1590{ "bler", XLOCB(19,BOF,CBGT,16,0), XLBOCBBB_MASK, POWER, { CR } },
1591{ "blelrl", XLOCB(19,BOF,CBGT,16,1), XLBOCBBB_MASK, PPC, { CR } },
1592{ "blelrl-", XLOCB(19,BOF,CBGT,16,1), XLBOCBBB_MASK, PPC, { CR } },
1593{ "blelrl+", XLOCB(19,BOFP,CBGT,16,1), XLBOCBBB_MASK, PPC, { CR } },
1594{ "blerl", XLOCB(19,BOF,CBGT,16,1), XLBOCBBB_MASK, POWER, { CR } },
1595{ "bnglr", XLOCB(19,BOF,CBGT,16,0), XLBOCBBB_MASK, PPC, { CR } },
1596{ "bnglr-", XLOCB(19,BOF,CBGT,16,0), XLBOCBBB_MASK, PPC, { CR } },
1597{ "bnglr+", XLOCB(19,BOFP,CBGT,16,0), XLBOCBBB_MASK, PPC, { CR } },
1598{ "bngr", XLOCB(19,BOF,CBGT,16,0), XLBOCBBB_MASK, POWER, { CR } },
1599{ "bnglrl", XLOCB(19,BOF,CBGT,16,1), XLBOCBBB_MASK, PPC, { CR } },
1600{ "bnglrl-", XLOCB(19,BOF,CBGT,16,1), XLBOCBBB_MASK, PPC, { CR } },
1601{ "bnglrl+", XLOCB(19,BOFP,CBGT,16,1), XLBOCBBB_MASK, PPC, { CR } },
1602{ "bngrl", XLOCB(19,BOF,CBGT,16,1), XLBOCBBB_MASK, POWER, { CR } },
1603{ "bnelr", XLOCB(19,BOF,CBEQ,16,0), XLBOCBBB_MASK, PPC, { CR } },
1604{ "bnelr-", XLOCB(19,BOF,CBEQ,16,0), XLBOCBBB_MASK, PPC, { CR } },
1605{ "bnelr+", XLOCB(19,BOFP,CBEQ,16,0), XLBOCBBB_MASK, PPC, { CR } },
1606{ "bner", XLOCB(19,BOF,CBEQ,16,0), XLBOCBBB_MASK, POWER, { CR } },
1607{ "bnelrl", XLOCB(19,BOF,CBEQ,16,1), XLBOCBBB_MASK, PPC, { CR } },
1608{ "bnelrl-", XLOCB(19,BOF,CBEQ,16,1), XLBOCBBB_MASK, PPC, { CR } },
1609{ "bnelrl+", XLOCB(19,BOFP,CBEQ,16,1), XLBOCBBB_MASK, PPC, { CR } },
1610{ "bnerl", XLOCB(19,BOF,CBEQ,16,1), XLBOCBBB_MASK, POWER, { CR } },
1611{ "bnslr", XLOCB(19,BOF,CBSO,16,0), XLBOCBBB_MASK, PPC, { CR } },
1612{ "bnslr-", XLOCB(19,BOF,CBSO,16,0), XLBOCBBB_MASK, PPC, { CR } },
1613{ "bnslr+", XLOCB(19,BOFP,CBSO,16,0), XLBOCBBB_MASK, PPC, { CR } },
1614{ "bnsr", XLOCB(19,BOF,CBSO,16,0), XLBOCBBB_MASK, POWER, { CR } },
1615{ "bnslrl", XLOCB(19,BOF,CBSO,16,1), XLBOCBBB_MASK, PPC, { CR } },
1616{ "bnslrl-", XLOCB(19,BOF,CBSO,16,1), XLBOCBBB_MASK, PPC, { CR } },
1617{ "bnslrl+", XLOCB(19,BOFP,CBSO,16,1), XLBOCBBB_MASK, PPC, { CR } },
1618{ "bnsrl", XLOCB(19,BOF,CBSO,16,1), XLBOCBBB_MASK, POWER, { CR } },
1619{ "bnulr", XLOCB(19,BOF,CBSO,16,0), XLBOCBBB_MASK, PPC, { CR } },
1620{ "bnulr-", XLOCB(19,BOF,CBSO,16,0), XLBOCBBB_MASK, PPC, { CR } },
1621{ "bnulr+", XLOCB(19,BOFP,CBSO,16,0), XLBOCBBB_MASK, PPC, { CR } },
1622{ "bnulrl", XLOCB(19,BOF,CBSO,16,1), XLBOCBBB_MASK, PPC, { CR } },
1623{ "bnulrl-", XLOCB(19,BOF,CBSO,16,1), XLBOCBBB_MASK, PPC, { CR } },
1624{ "bnulrl+", XLOCB(19,BOFP,CBSO,16,1), XLBOCBBB_MASK, PPC, { CR } },
1625{ "btlr", XLO(19,BOT,16,0), XLBOBB_MASK, PPC, { BI } },
1626{ "btlr-", XLO(19,BOT,16,0), XLBOBB_MASK, PPC, { BI } },
1627{ "btlr+", XLO(19,BOTP,16,0), XLBOBB_MASK, PPC, { BI } },
1628{ "bbtr", XLO(19,BOT,16,0), XLBOBB_MASK, POWER, { BI } },
1629{ "btlrl", XLO(19,BOT,16,1), XLBOBB_MASK, PPC, { BI } },
1630{ "btlrl-", XLO(19,BOT,16,1), XLBOBB_MASK, PPC, { BI } },
1631{ "btlrl+", XLO(19,BOTP,16,1), XLBOBB_MASK, PPC, { BI } },
1632{ "bbtrl", XLO(19,BOT,16,1), XLBOBB_MASK, POWER, { BI } },
1633{ "bflr", XLO(19,BOF,16,0), XLBOBB_MASK, PPC, { BI } },
1634{ "bflr-", XLO(19,BOF,16,0), XLBOBB_MASK, PPC, { BI } },
1635{ "bflr+", XLO(19,BOFP,16,0), XLBOBB_MASK, PPC, { BI } },
1636{ "bbfr", XLO(19,BOF,16,0), XLBOBB_MASK, POWER, { BI } },
1637{ "bflrl", XLO(19,BOF,16,1), XLBOBB_MASK, PPC, { BI } },
1638{ "bflrl-", XLO(19,BOF,16,1), XLBOBB_MASK, PPC, { BI } },
1639{ "bflrl+", XLO(19,BOFP,16,1), XLBOBB_MASK, PPC, { BI } },
1640{ "bbfrl", XLO(19,BOF,16,1), XLBOBB_MASK, POWER, { BI } },
1641{ "bdnztlr", XLO(19,BODNZT,16,0), XLBOBB_MASK, PPC, { BI } },
1642{ "bdnztlr-",XLO(19,BODNZT,16,0), XLBOBB_MASK, PPC, { BI } },
1643{ "bdnztlr+",XLO(19,BODNZTP,16,0), XLBOBB_MASK, PPC, { BI } },
1644{ "bdnztlrl",XLO(19,BODNZT,16,1), XLBOBB_MASK, PPC, { BI } },
1645{ "bdnztlrl-",XLO(19,BODNZT,16,1), XLBOBB_MASK, PPC, { BI } },
1646{ "bdnztlrl+",XLO(19,BODNZTP,16,1), XLBOBB_MASK, PPC, { BI } },
1647{ "bdnzflr", XLO(19,BODNZF,16,0), XLBOBB_MASK, PPC, { BI } },
1648{ "bdnzflr-",XLO(19,BODNZF,16,0), XLBOBB_MASK, PPC, { BI } },
1649{ "bdnzflr+",XLO(19,BODNZFP,16,0), XLBOBB_MASK, PPC, { BI } },
1650{ "bdnzflrl",XLO(19,BODNZF,16,1), XLBOBB_MASK, PPC, { BI } },
1651{ "bdnzflrl-",XLO(19,BODNZF,16,1), XLBOBB_MASK, PPC, { BI } },
1652{ "bdnzflrl+",XLO(19,BODNZFP,16,1), XLBOBB_MASK, PPC, { BI } },
1653{ "bdztlr", XLO(19,BODZT,16,0), XLBOBB_MASK, PPC, { BI } },
1654{ "bdztlr-", XLO(19,BODZT,16,0), XLBOBB_MASK, PPC, { BI } },
1655{ "bdztlr+", XLO(19,BODZTP,16,0), XLBOBB_MASK, PPC, { BI } },
1656{ "bdztlrl", XLO(19,BODZT,16,1), XLBOBB_MASK, PPC, { BI } },
1657{ "bdztlrl-",XLO(19,BODZT,16,1), XLBOBB_MASK, PPC, { BI } },
1658{ "bdztlrl+",XLO(19,BODZTP,16,1), XLBOBB_MASK, PPC, { BI } },
1659{ "bdzflr", XLO(19,BODZF,16,0), XLBOBB_MASK, PPC, { BI } },
1660{ "bdzflr-", XLO(19,BODZF,16,0), XLBOBB_MASK, PPC, { BI } },
1661{ "bdzflr+", XLO(19,BODZFP,16,0), XLBOBB_MASK, PPC, { BI } },
1662{ "bdzflrl", XLO(19,BODZF,16,1), XLBOBB_MASK, PPC, { BI } },
1663{ "bdzflrl-",XLO(19,BODZF,16,1), XLBOBB_MASK, PPC, { BI } },
1664{ "bdzflrl+",XLO(19,BODZFP,16,1), XLBOBB_MASK, PPC, { BI } },
1665{ "bclr", XLLK(19,16,0), XLYBB_MASK, PPC, { BO, BI } },
1666{ "bclrl", XLLK(19,16,1), XLYBB_MASK, PPC, { BO, BI } },
1667{ "bclr+", XLYLK(19,16,1,0), XLYBB_MASK, PPC, { BOE, BI } },
1668{ "bclrl+", XLYLK(19,16,1,1), XLYBB_MASK, PPC, { BOE, BI } },
1669{ "bclr-", XLYLK(19,16,0,0), XLYBB_MASK, PPC, { BOE, BI } },
1670{ "bclrl-", XLYLK(19,16,0,1), XLYBB_MASK, PPC, { BOE, BI } },
1671{ "bcr", XLLK(19,16,0), XLBB_MASK, POWER, { BO, BI } },
1672{ "bcrl", XLLK(19,16,1), XLBB_MASK, POWER, { BO, BI } },
1673
1674{ "crnot", XL(19,33), XL_MASK, PPC, { BT, BA, BBA } },
1675{ "crnor", XL(19,33), XL_MASK, PPC|POWER, { BT, BA, BB } },
1676
1677{ "rfi", XL(19,50), 0xffffffff, PPC|POWER, { 0 } },
1678{ "rfci", XL(19,51), 0xffffffff, PPC, { 0 } },
1679
1680{ "rfsvc", XL(19,82), 0xffffffff, POWER, { 0 } },
1681
1682{ "crandc", XL(19,129), XL_MASK, PPC|POWER, { BT, BA, BB } },
1683
1684{ "isync", XL(19,150), 0xffffffff, PPC, { 0 } },
1685{ "ics", XL(19,150), 0xffffffff, POWER, { 0 } },
1686
1687{ "crclr", XL(19,193), XL_MASK, PPC, { BT, BAT, BBA } },
1688{ "crxor", XL(19,193), XL_MASK, PPC|POWER, { BT, BA, BB } },
1689
1690{ "crnand", XL(19,225), XL_MASK, PPC|POWER, { BT, BA, BB } },
1691
1692{ "crand", XL(19,257), XL_MASK, PPC|POWER, { BT, BA, BB } },
1693
1694{ "crset", XL(19,289), XL_MASK, PPC, { BT, BAT, BBA } },
1695{ "creqv", XL(19,289), XL_MASK, PPC|POWER, { BT, BA, BB } },
1696
1697{ "crorc", XL(19,417), XL_MASK, PPC|POWER, { BT, BA, BB } },
1698
1699{ "crmove", XL(19,449), XL_MASK, PPC, { BT, BA, BBA } },
1700{ "cror", XL(19,449), XL_MASK, PPC|POWER, { BT, BA, BB } },
1701
1702{ "bctr", XLO(19,BOU,528,0), XLBOBIBB_MASK, PPC|POWER, { 0 } },
1703{ "bctrl", XLO(19,BOU,528,1), XLBOBIBB_MASK, PPC|POWER, { 0 } },
1704{ "bltctr", XLOCB(19,BOT,CBLT,528,0), XLBOCBBB_MASK, PPC, { CR } },
1705{ "bltctr-", XLOCB(19,BOT,CBLT,528,0), XLBOCBBB_MASK, PPC, { CR } },
1706{ "bltctr+", XLOCB(19,BOTP,CBLT,528,0), XLBOCBBB_MASK, PPC, { CR } },
1707{ "bltctrl", XLOCB(19,BOT,CBLT,528,1), XLBOCBBB_MASK, PPC, { CR } },
1708{ "bltctrl-",XLOCB(19,BOT,CBLT,528,1), XLBOCBBB_MASK, PPC, { CR } },
1709{ "bltctrl+",XLOCB(19,BOTP,CBLT,528,1), XLBOCBBB_MASK, PPC, { CR } },
1710{ "bgtctr", XLOCB(19,BOT,CBGT,528,0), XLBOCBBB_MASK, PPC, { CR } },
1711{ "bgtctr-", XLOCB(19,BOT,CBGT,528,0), XLBOCBBB_MASK, PPC, { CR } },
1712{ "bgtctr+", XLOCB(19,BOTP,CBGT,528,0), XLBOCBBB_MASK, PPC, { CR } },
1713{ "bgtctrl", XLOCB(19,BOT,CBGT,528,1), XLBOCBBB_MASK, PPC, { CR } },
1714{ "bgtctrl-",XLOCB(19,BOT,CBGT,528,1), XLBOCBBB_MASK, PPC, { CR } },
1715{ "bgtctrl+",XLOCB(19,BOTP,CBGT,528,1), XLBOCBBB_MASK, PPC, { CR } },
1716{ "beqctr", XLOCB(19,BOT,CBEQ,528,0), XLBOCBBB_MASK, PPC, { CR } },
1717{ "beqctr-", XLOCB(19,BOT,CBEQ,528,0), XLBOCBBB_MASK, PPC, { CR } },
1718{ "beqctr+", XLOCB(19,BOTP,CBEQ,528,0), XLBOCBBB_MASK, PPC, { CR } },
1719{ "beqctrl", XLOCB(19,BOT,CBEQ,528,1), XLBOCBBB_MASK, PPC, { CR } },
1720{ "beqctrl-",XLOCB(19,BOT,CBEQ,528,1), XLBOCBBB_MASK, PPC, { CR } },
1721{ "beqctrl+",XLOCB(19,BOTP,CBEQ,528,1), XLBOCBBB_MASK, PPC, { CR } },
1722{ "bsoctr", XLOCB(19,BOT,CBSO,528,0), XLBOCBBB_MASK, PPC, { CR } },
1723{ "bsoctr-", XLOCB(19,BOT,CBSO,528,0), XLBOCBBB_MASK, PPC, { CR } },
1724{ "bsoctr+", XLOCB(19,BOTP,CBSO,528,0), XLBOCBBB_MASK, PPC, { CR } },
1725{ "bsoctrl", XLOCB(19,BOT,CBSO,528,1), XLBOCBBB_MASK, PPC, { CR } },
1726{ "bsoctrl-",XLOCB(19,BOT,CBSO,528,1), XLBOCBBB_MASK, PPC, { CR } },
1727{ "bsoctrl+",XLOCB(19,BOTP,CBSO,528,1), XLBOCBBB_MASK, PPC, { CR } },
1728{ "bunctr", XLOCB(19,BOT,CBSO,528,0), XLBOCBBB_MASK, PPC, { CR } },
1729{ "bunctr-", XLOCB(19,BOT,CBSO,528,0), XLBOCBBB_MASK, PPC, { CR } },
1730{ "bunctr+", XLOCB(19,BOTP,CBSO,528,0), XLBOCBBB_MASK, PPC, { CR } },
1731{ "bunctrl", XLOCB(19,BOT,CBSO,528,1), XLBOCBBB_MASK, PPC, { CR } },
1732{ "bunctrl-",XLOCB(19,BOT,CBSO,528,1), XLBOCBBB_MASK, PPC, { CR } },
1733{ "bunctrl+",XLOCB(19,BOTP,CBSO,528,1), XLBOCBBB_MASK, PPC, { CR } },
1734{ "bgectr", XLOCB(19,BOF,CBLT,528,0), XLBOCBBB_MASK, PPC, { CR } },
1735{ "bgectr-", XLOCB(19,BOF,CBLT,528,0), XLBOCBBB_MASK, PPC, { CR } },
1736{ "bgectr+", XLOCB(19,BOFP,CBLT,528,0), XLBOCBBB_MASK, PPC, { CR } },
1737{ "bgectrl", XLOCB(19,BOF,CBLT,528,1), XLBOCBBB_MASK, PPC, { CR } },
1738{ "bgectrl-",XLOCB(19,BOF,CBLT,528,1), XLBOCBBB_MASK, PPC, { CR } },
1739{ "bgectrl+",XLOCB(19,BOFP,CBLT,528,1), XLBOCBBB_MASK, PPC, { CR } },
1740{ "bnlctr", XLOCB(19,BOF,CBLT,528,0), XLBOCBBB_MASK, PPC, { CR } },
1741{ "bnlctr-", XLOCB(19,BOF,CBLT,528,0), XLBOCBBB_MASK, PPC, { CR } },
1742{ "bnlctr+", XLOCB(19,BOFP,CBLT,528,0), XLBOCBBB_MASK, PPC, { CR } },
1743{ "bnlctrl", XLOCB(19,BOF,CBLT,528,1), XLBOCBBB_MASK, PPC, { CR } },
1744{ "bnlctrl-",XLOCB(19,BOF,CBLT,528,1), XLBOCBBB_MASK, PPC, { CR } },
1745{ "bnlctrl+",XLOCB(19,BOFP,CBLT,528,1), XLBOCBBB_MASK, PPC, { CR } },
1746{ "blectr", XLOCB(19,BOF,CBGT,528,0), XLBOCBBB_MASK, PPC, { CR } },
1747{ "blectr-", XLOCB(19,BOF,CBGT,528,0), XLBOCBBB_MASK, PPC, { CR } },
1748{ "blectr+", XLOCB(19,BOFP,CBGT,528,0), XLBOCBBB_MASK, PPC, { CR } },
1749{ "blectrl", XLOCB(19,BOF,CBGT,528,1), XLBOCBBB_MASK, PPC, { CR } },
1750{ "blectrl-",XLOCB(19,BOF,CBGT,528,1), XLBOCBBB_MASK, PPC, { CR } },
1751{ "blectrl+",XLOCB(19,BOFP,CBGT,528,1), XLBOCBBB_MASK, PPC, { CR } },
1752{ "bngctr", XLOCB(19,BOF,CBGT,528,0), XLBOCBBB_MASK, PPC, { CR } },
1753{ "bngctr-", XLOCB(19,BOF,CBGT,528,0), XLBOCBBB_MASK, PPC, { CR } },
1754{ "bngctr+", XLOCB(19,BOFP,CBGT,528,0), XLBOCBBB_MASK, PPC, { CR } },
1755{ "bngctrl", XLOCB(19,BOF,CBGT,528,1), XLBOCBBB_MASK, PPC, { CR } },
1756{ "bngctrl-",XLOCB(19,BOF,CBGT,528,1), XLBOCBBB_MASK, PPC, { CR } },
1757{ "bngctrl+",XLOCB(19,BOFP,CBGT,528,1), XLBOCBBB_MASK, PPC, { CR } },
1758{ "bnectr", XLOCB(19,BOF,CBEQ,528,0), XLBOCBBB_MASK, PPC, { CR } },
1759{ "bnectr-", XLOCB(19,BOF,CBEQ,528,0), XLBOCBBB_MASK, PPC, { CR } },
1760{ "bnectr+", XLOCB(19,BOFP,CBEQ,528,0), XLBOCBBB_MASK, PPC, { CR } },
1761{ "bnectrl", XLOCB(19,BOF,CBEQ,528,1), XLBOCBBB_MASK, PPC, { CR } },
1762{ "bnectrl-",XLOCB(19,BOF,CBEQ,528,1), XLBOCBBB_MASK, PPC, { CR } },
1763{ "bnectrl+",XLOCB(19,BOFP,CBEQ,528,1), XLBOCBBB_MASK, PPC, { CR } },
1764{ "bnsctr", XLOCB(19,BOF,CBSO,528,0), XLBOCBBB_MASK, PPC, { CR } },
1765{ "bnsctr-", XLOCB(19,BOF,CBSO,528,0), XLBOCBBB_MASK, PPC, { CR } },
1766{ "bnsctr+", XLOCB(19,BOFP,CBSO,528,0), XLBOCBBB_MASK, PPC, { CR } },
1767{ "bnsctrl", XLOCB(19,BOF,CBSO,528,1), XLBOCBBB_MASK, PPC, { CR } },
1768{ "bnsctrl-",XLOCB(19,BOF,CBSO,528,1), XLBOCBBB_MASK, PPC, { CR } },
1769{ "bnsctrl+",XLOCB(19,BOFP,CBSO,528,1), XLBOCBBB_MASK, PPC, { CR } },
1770{ "bnuctr", XLOCB(19,BOF,CBSO,528,0), XLBOCBBB_MASK, PPC, { CR } },
1771{ "bnuctr-", XLOCB(19,BOF,CBSO,528,0), XLBOCBBB_MASK, PPC, { CR } },
1772{ "bnuctr+", XLOCB(19,BOFP,CBSO,528,0), XLBOCBBB_MASK, PPC, { CR } },
1773{ "bnuctrl", XLOCB(19,BOF,CBSO,528,1), XLBOCBBB_MASK, PPC, { CR } },
1774{ "bnuctrl-",XLOCB(19,BOF,CBSO,528,1), XLBOCBBB_MASK, PPC, { CR } },
1775{ "bnuctrl+",XLOCB(19,BOFP,CBSO,528,1), XLBOCBBB_MASK, PPC, { CR } },
1776{ "btctr", XLO(19,BOT,528,0), XLBOBB_MASK, PPC, { BI } },
1777{ "btctr-", XLO(19,BOT,528,0), XLBOBB_MASK, PPC, { BI } },
1778{ "btctr+", XLO(19,BOTP,528,0), XLBOBB_MASK, PPC, { BI } },
1779{ "btctrl", XLO(19,BOT,528,1), XLBOBB_MASK, PPC, { BI } },
1780{ "btctrl-", XLO(19,BOT,528,1), XLBOBB_MASK, PPC, { BI } },
1781{ "btctrl+", XLO(19,BOTP,528,1), XLBOBB_MASK, PPC, { BI } },
1782{ "bfctr", XLO(19,BOF,528,0), XLBOBB_MASK, PPC, { BI } },
1783{ "bfctr-", XLO(19,BOF,528,0), XLBOBB_MASK, PPC, { BI } },
1784{ "bfctr+", XLO(19,BOFP,528,0), XLBOBB_MASK, PPC, { BI } },
1785{ "bfctrl", XLO(19,BOF,528,1), XLBOBB_MASK, PPC, { BI } },
1786{ "bfctrl-", XLO(19,BOF,528,1), XLBOBB_MASK, PPC, { BI } },
1787{ "bfctrl+", XLO(19,BOFP,528,1), XLBOBB_MASK, PPC, { BI } },
1788{ "bcctr", XLLK(19,528,0), XLYBB_MASK, PPC, { BO, BI } },
1789{ "bcctr-", XLYLK(19,528,0,0), XLYBB_MASK, PPC, { BOE, BI } },
1790{ "bcctr+", XLYLK(19,528,1,0), XLYBB_MASK, PPC, { BOE, BI } },
1791{ "bcctrl", XLLK(19,528,1), XLYBB_MASK, PPC, { BO, BI } },
1792{ "bcctrl-", XLYLK(19,528,0,1), XLYBB_MASK, PPC, { BOE, BI } },
1793{ "bcctrl+", XLYLK(19,528,1,1), XLYBB_MASK, PPC, { BOE, BI } },
1794{ "bcc", XLLK(19,528,0), XLBB_MASK, POWER, { BO, BI } },
1795{ "bccl", XLLK(19,528,1), XLBB_MASK, POWER, { BO, BI } },
1796
1797{ "rlwimi", M(20,0), M_MASK, PPC, { RA,RS,SH,MBE,ME } },
1798{ "rlimi", M(20,0), M_MASK, POWER, { RA,RS,SH,MBE,ME } },
1799
1800{ "rlwimi.", M(20,1), M_MASK, PPC, { RA,RS,SH,MBE,ME } },
1801{ "rlimi.", M(20,1), M_MASK, POWER, { RA,RS,SH,MBE,ME } },
1802
1803{ "rotlwi", MME(21,31,0), MMBME_MASK, PPC, { RA, RS, SH } },
1804{ "clrlwi", MME(21,31,0), MSHME_MASK, PPC, { RA, RS, MB } },
1805{ "rlwinm", M(21,0), M_MASK, PPC, { RA,RS,SH,MBE,ME } },
1806{ "rlinm", M(21,0), M_MASK, POWER, { RA,RS,SH,MBE,ME } },
1807{ "rotlwi.", MME(21,31,1), MMBME_MASK, PPC, { RA,RS,SH } },
1808{ "clrlwi.", MME(21,31,1), MSHME_MASK, PPC, { RA, RS, MB } },
1809{ "rlwinm.", M(21,1), M_MASK, PPC, { RA,RS,SH,MBE,ME } },
1810{ "rlinm.", M(21,1), M_MASK, POWER, { RA,RS,SH,MBE,ME } },
1811
1812{ "rlmi", M(22,0), M_MASK, POWER|M601, { RA,RS,RB,MBE,ME } },
1813{ "rlmi.", M(22,1), M_MASK, POWER|M601, { RA,RS,RB,MBE,ME } },
1814
1815{ "rotlw", MME(23,31,0), MMBME_MASK, PPC, { RA, RS, RB } },
1816{ "rlwnm", M(23,0), M_MASK, PPC, { RA,RS,RB,MBE,ME } },
1817{ "rlnm", M(23,0), M_MASK, POWER, { RA,RS,RB,MBE,ME } },
1818{ "rotlw.", MME(23,31,1), MMBME_MASK, PPC, { RA, RS, RB } },
1819{ "rlwnm.", M(23,1), M_MASK, PPC, { RA,RS,RB,MBE,ME } },
1820{ "rlnm.", M(23,1), M_MASK, POWER, { RA,RS,RB,MBE,ME } },
1821
1822{ "nop", OP(24), 0xffffffff, PPC, { 0 } },
1823{ "ori", OP(24), OP_MASK, PPC, { RA, RS, UI } },
1824{ "oril", OP(24), OP_MASK, POWER, { RA, RS, UI } },
1825
1826{ "oris", OP(25), OP_MASK, PPC, { RA, RS, UI } },
1827{ "oriu", OP(25), OP_MASK, POWER, { RA, RS, UI } },
1828
1829{ "xori", OP(26), OP_MASK, PPC, { RA, RS, UI } },
1830{ "xoril", OP(26), OP_MASK, POWER, { RA, RS, UI } },
1831
1832{ "xoris", OP(27), OP_MASK, PPC, { RA, RS, UI } },
1833{ "xoriu", OP(27), OP_MASK, POWER, { RA, RS, UI } },
1834
1835{ "andi.", OP(28), OP_MASK, PPC, { RA, RS, UI } },
1836{ "andil.", OP(28), OP_MASK, POWER, { RA, RS, UI } },
1837
1838{ "andis.", OP(29), OP_MASK, PPC, { RA, RS, UI } },
1839{ "andiu.", OP(29), OP_MASK, POWER, { RA, RS, UI } },
1840
1841{ "rotldi", MD(30,0,0), MDMB_MASK, PPC|B64, { RA, RS, SH6 } },
1842{ "clrldi", MD(30,0,0), MDSH_MASK, PPC|B64, { RA, RS, MB6 } },
1843{ "rldicl", MD(30,0,0), MD_MASK, PPC|B64, { RA, RS, SH6, MB6 } },
1844{ "rotldi.", MD(30,0,1), MDMB_MASK, PPC|B64, { RA, RS, SH6 } },
1845{ "clrldi.", MD(30,0,1), MDSH_MASK, PPC|B64, { RA, RS, MB6 } },
1846{ "rldicl.", MD(30,0,1), MD_MASK, PPC|B64, { RA, RS, SH6, MB6 } },
1847
1848{ "rldicr", MD(30,1,0), MD_MASK, PPC|B64, { RA, RS, SH6, ME6 } },
1849{ "rldicr.", MD(30,1,1), MD_MASK, PPC|B64, { RA, RS, SH6, ME6 } },
1850
1851{ "rldic", MD(30,2,0), MD_MASK, PPC|B64, { RA, RS, SH6, MB6 } },
1852{ "rldic.", MD(30,2,1), MD_MASK, PPC|B64, { RA, RS, SH6, MB6 } },
1853
1854{ "rldimi", MD(30,3,0), MD_MASK, PPC|B64, { RA, RS, SH6, MB6 } },
1855{ "rldimi.", MD(30,3,1), MD_MASK, PPC|B64, { RA, RS, SH6, MB6 } },
1856
1857{ "rotld", MDS(30,8,0), MDSMB_MASK, PPC|B64, { RA, RS, RB } },
1858{ "rldcl", MDS(30,8,0), MDS_MASK, PPC|B64, { RA, RS, RB, MB6 } },
1859{ "rotld.", MDS(30,8,1), MDSMB_MASK, PPC|B64, { RA, RS, RB } },
1860{ "rldcl.", MDS(30,8,1), MDS_MASK, PPC|B64, { RA, RS, RB, MB6 } },
1861
1862{ "rldcr", MDS(30,9,0), MDS_MASK, PPC|B64, { RA, RS, RB, ME6 } },
1863{ "rldcr.", MDS(30,9,1), MDS_MASK, PPC|B64, { RA, RS, RB, ME6 } },
1864
1865{ "cmpw", XCMPL(31,0,0), XCMPL_MASK, PPC, { OBF, RA, RB } },
1866{ "cmpd", XCMPL(31,0,1), XCMPL_MASK, PPC|B64, { OBF, RA, RB } },
1867{ "cmp", X(31,0), XCMP_MASK, PPC, { BF, L, RA, RB } },
1868{ "cmp", X(31,0), XCMPL_MASK, POWER, { BF, RA, RB } },
1869
1870{ "twlgt", XTO(31,4,TOLGT), XTO_MASK, PPC, { RA, RB } },
1871{ "tlgt", XTO(31,4,TOLGT), XTO_MASK, POWER, { RA, RB } },
1872{ "twllt", XTO(31,4,TOLLT), XTO_MASK, PPC, { RA, RB } },
1873{ "tllt", XTO(31,4,TOLLT), XTO_MASK, POWER, { RA, RB } },
1874{ "tweq", XTO(31,4,TOEQ), XTO_MASK, PPC, { RA, RB } },
1875{ "teq", XTO(31,4,TOEQ), XTO_MASK, POWER, { RA, RB } },
1876{ "twlge", XTO(31,4,TOLGE), XTO_MASK, PPC, { RA, RB } },
1877{ "tlge", XTO(31,4,TOLGE), XTO_MASK, POWER, { RA, RB } },
1878{ "twlnl", XTO(31,4,TOLNL), XTO_MASK, PPC, { RA, RB } },
1879{ "tlnl", XTO(31,4,TOLNL), XTO_MASK, POWER, { RA, RB } },
1880{ "twlle", XTO(31,4,TOLLE), XTO_MASK, PPC, { RA, RB } },
1881{ "tlle", XTO(31,4,TOLLE), XTO_MASK, POWER, { RA, RB } },
1882{ "twlng", XTO(31,4,TOLNG), XTO_MASK, PPC, { RA, RB } },
1883{ "tlng", XTO(31,4,TOLNG), XTO_MASK, POWER, { RA, RB } },
1884{ "twgt", XTO(31,4,TOGT), XTO_MASK, PPC, { RA, RB } },
1885{ "tgt", XTO(31,4,TOGT), XTO_MASK, POWER, { RA, RB } },
1886{ "twge", XTO(31,4,TOGE), XTO_MASK, PPC, { RA, RB } },
1887{ "tge", XTO(31,4,TOGE), XTO_MASK, POWER, { RA, RB } },
1888{ "twnl", XTO(31,4,TONL), XTO_MASK, PPC, { RA, RB } },
1889{ "tnl", XTO(31,4,TONL), XTO_MASK, POWER, { RA, RB } },
1890{ "twlt", XTO(31,4,TOLT), XTO_MASK, PPC, { RA, RB } },
1891{ "tlt", XTO(31,4,TOLT), XTO_MASK, POWER, { RA, RB } },
1892{ "twle", XTO(31,4,TOLE), XTO_MASK, PPC, { RA, RB } },
1893{ "tle", XTO(31,4,TOLE), XTO_MASK, POWER, { RA, RB } },
1894{ "twng", XTO(31,4,TONG), XTO_MASK, PPC, { RA, RB } },
1895{ "tng", XTO(31,4,TONG), XTO_MASK, POWER, { RA, RB } },
1896{ "twne", XTO(31,4,TONE), XTO_MASK, PPC, { RA, RB } },
1897{ "tne", XTO(31,4,TONE), XTO_MASK, POWER, { RA, RB } },
1898{ "trap", XTO(31,4,TOU), 0xffffffff, PPC, { 0 } },
1899{ "tw", X(31,4), X_MASK, PPC, { TO, RA, RB } },
1900{ "t", X(31,4), X_MASK, POWER, { TO, RA, RB } },
1901
1902{ "subfc", XO(31,8,0,0), XO_MASK, PPC, { RT, RA, RB } },
1903{ "sf", XO(31,8,0,0), XO_MASK, POWER, { RT, RA, RB } },
1904{ "subc", XO(31,8,0,0), XO_MASK, PPC, { RT, RB, RA } },
1905{ "subfc.", XO(31,8,0,1), XO_MASK, PPC, { RT, RA, RB } },
1906{ "sf.", XO(31,8,0,1), XO_MASK, POWER, { RT, RA, RB } },
1907{ "subc.", XO(31,8,0,1), XO_MASK, PPC, { RT, RB, RA } },
1908{ "subfco", XO(31,8,1,0), XO_MASK, PPC, { RT, RA, RB } },
1909{ "sfo", XO(31,8,1,0), XO_MASK, POWER, { RT, RA, RB } },
1910{ "subco", XO(31,8,1,0), XO_MASK, PPC, { RT, RB, RA } },
1911{ "subfco.", XO(31,8,1,1), XO_MASK, PPC, { RT, RA, RB } },
1912{ "sfo.", XO(31,8,1,1), XO_MASK, POWER, { RT, RA, RB } },
1913{ "subco.", XO(31,8,1,1), XO_MASK, PPC, { RT, RB, RA } },
1914
1915{ "mulhdu", XO(31,9,0,0), XO_MASK, PPC|B64, { RT, RA, RB } },
1916{ "mulhdu.", XO(31,9,0,1), XO_MASK, PPC|B64, { RT, RA, RB } },
1917
1918{ "addc", XO(31,10,0,0), XO_MASK, PPC, { RT, RA, RB } },
1919{ "a", XO(31,10,0,0), XO_MASK, POWER, { RT, RA, RB } },
1920{ "addc.", XO(31,10,0,1), XO_MASK, PPC, { RT, RA, RB } },
1921{ "a.", XO(31,10,0,1), XO_MASK, POWER, { RT, RA, RB } },
1922{ "addco", XO(31,10,1,0), XO_MASK, PPC, { RT, RA, RB } },
1923{ "ao", XO(31,10,1,0), XO_MASK, POWER, { RT, RA, RB } },
1924{ "addco.", XO(31,10,1,1), XO_MASK, PPC, { RT, RA, RB } },
1925{ "ao.", XO(31,10,1,1), XO_MASK, POWER, { RT, RA, RB } },
1926
1927{ "mulhwu", XO(31,11,0,0), XO_MASK, PPC, { RT, RA, RB } },
1928{ "mulhwu.", XO(31,11,0,1), XO_MASK, PPC, { RT, RA, RB } },
1929
1930{ "mfcr", X(31,19), XRARB_MASK, POWER|PPC, { RT } },
1931
1932{ "lwarx", X(31,20), X_MASK, PPC, { RT, RA, RB } },
1933
1934{ "ldx", X(31,21), X_MASK, PPC|B64, { RT, RA, RB } },
1935
1936{ "lwzx", X(31,23), X_MASK, PPC, { RT, RA, RB } },
1937{ "lx", X(31,23), X_MASK, POWER, { RT, RA, RB } },
1938
1939{ "slw", XRC(31,24,0), X_MASK, PPC, { RA, RS, RB } },
1940{ "sl", XRC(31,24,0), X_MASK, POWER, { RA, RS, RB } },
1941{ "slw.", XRC(31,24,1), X_MASK, PPC, { RA, RS, RB } },
1942{ "sl.", XRC(31,24,1), X_MASK, POWER, { RA, RS, RB } },
1943
1944{ "cntlzw", XRC(31,26,0), XRB_MASK, PPC, { RA, RS } },
1945{ "cntlz", XRC(31,26,0), XRB_MASK, POWER, { RA, RS } },
1946{ "cntlzw.", XRC(31,26,1), XRB_MASK, PPC, { RA, RS } },
1947{ "cntlz.", XRC(31,26,1), XRB_MASK, POWER, { RA, RS } },
1948
1949{ "sld", XRC(31,27,0), X_MASK, PPC|B64, { RA, RS, RB } },
1950{ "sld.", XRC(31,27,1), X_MASK, PPC|B64, { RA, RS, RB } },
1951
1952{ "and", XRC(31,28,0), X_MASK, PPC|POWER, { RA, RS, RB } },
1953{ "and.", XRC(31,28,1), X_MASK, PPC|POWER, { RA, RS, RB } },
1954
1955{ "maskg", XRC(31,29,0), X_MASK, POWER|M601, { RA, RS, RB } },
1956{ "maskg.", XRC(31,29,1), X_MASK, POWER|M601, { RA, RS, RB } },
1957
1958{ "cmplw", XCMPL(31,32,0), XCMPL_MASK, PPC, { OBF, RA, RB } },
1959{ "cmpld", XCMPL(31,32,1), XCMPL_MASK, PPC|B64, { OBF, RA, RB } },
1960{ "cmpl", X(31,32), XCMP_MASK, PPC, { BF, L, RA, RB } },
1961{ "cmpl", X(31,32), XCMPL_MASK, POWER, { BF, RA, RB } },
1962
1963{ "subf", XO(31,40,0,0), XO_MASK, PPC, { RT, RA, RB } },
1964{ "sub", XO(31,40,0,0), XO_MASK, PPC, { RT, RB, RA } },
1965{ "subf.", XO(31,40,0,1), XO_MASK, PPC, { RT, RA, RB } },
1966{ "sub.", XO(31,40,0,1), XO_MASK, PPC, { RT, RB, RA } },
1967{ "subfo", XO(31,40,1,0), XO_MASK, PPC, { RT, RA, RB } },
1968{ "subo", XO(31,40,1,0), XO_MASK, PPC, { RT, RB, RA } },
1969{ "subfo.", XO(31,40,1,1), XO_MASK, PPC, { RT, RA, RB } },
1970{ "subo.", XO(31,40,1,1), XO_MASK, PPC, { RT, RB, RA } },
1971
1972{ "ldux", X(31,53), X_MASK, PPC|B64, { RT, RAL, RB } },
1973
1974{ "dcbst", X(31,54), XRT_MASK, PPC, { RA, RB } },
1975
1976{ "lwzux", X(31,55), X_MASK, PPC, { RT, RAL, RB } },
1977{ "lux", X(31,55), X_MASK, POWER, { RT, RA, RB } },
1978
1979{ "cntlzd", XRC(31,58,0), XRB_MASK, PPC|B64, { RA, RS } },
1980{ "cntlzd.", XRC(31,58,1), XRB_MASK, PPC|B64, { RA, RS } },
1981
1982{ "andc", XRC(31,60,0), X_MASK, PPC|POWER, { RA, RS, RB } },
1983{ "andc.", XRC(31,60,1), X_MASK, PPC|POWER, { RA, RS, RB } },
1984
1985{ "tdlgt", XTO(31,68,TOLGT), XTO_MASK, PPC|B64, { RA, RB } },
1986{ "tdllt", XTO(31,68,TOLLT), XTO_MASK, PPC|B64, { RA, RB } },
1987{ "tdeq", XTO(31,68,TOEQ), XTO_MASK, PPC|B64, { RA, RB } },
1988{ "tdlge", XTO(31,68,TOLGE), XTO_MASK, PPC|B64, { RA, RB } },
1989{ "tdlnl", XTO(31,68,TOLNL), XTO_MASK, PPC|B64, { RA, RB } },
1990{ "tdlle", XTO(31,68,TOLLE), XTO_MASK, PPC|B64, { RA, RB } },
1991{ "tdlng", XTO(31,68,TOLNG), XTO_MASK, PPC|B64, { RA, RB } },
1992{ "tdgt", XTO(31,68,TOGT), XTO_MASK, PPC|B64, { RA, RB } },
1993{ "tdge", XTO(31,68,TOGE), XTO_MASK, PPC|B64, { RA, RB } },
1994{ "tdnl", XTO(31,68,TONL), XTO_MASK, PPC|B64, { RA, RB } },
1995{ "tdlt", XTO(31,68,TOLT), XTO_MASK, PPC|B64, { RA, RB } },
1996{ "tdle", XTO(31,68,TOLE), XTO_MASK, PPC|B64, { RA, RB } },
1997{ "tdng", XTO(31,68,TONG), XTO_MASK, PPC|B64, { RA, RB } },
1998{ "tdne", XTO(31,68,TONE), XTO_MASK, PPC|B64, { RA, RB } },
1999{ "td", X(31,68), X_MASK, PPC|B64, { TO, RA, RB } },
2000
2001{ "mulhd", XO(31,73,0,0), XO_MASK, PPC|B64, { RT, RA, RB } },
2002{ "mulhd.", XO(31,73,0,1), XO_MASK, PPC|B64, { RT, RA, RB } },
2003
2004{ "mulhw", XO(31,75,0,0), XO_MASK, PPC, { RT, RA, RB } },
2005{ "mulhw.", XO(31,75,0,1), XO_MASK, PPC, { RT, RA, RB } },
2006
2007{ "mfmsr", X(31,83), XRARB_MASK, PPC|POWER, { RT } },
2008
2009{ "ldarx", X(31,84), X_MASK, PPC|B64, { RT, RA, RB } },
2010
2011{ "dcbf", X(31,86), XRT_MASK, PPC, { RA, RB } },
2012
2013{ "lbzx", X(31,87), X_MASK, PPC|POWER, { RT, RA, RB } },
2014
2015{ "neg", XO(31,104,0,0), XORB_MASK, PPC|POWER, { RT, RA } },
2016{ "neg.", XO(31,104,0,1), XORB_MASK, PPC|POWER, { RT, RA } },
2017{ "nego", XO(31,104,1,0), XORB_MASK, PPC|POWER, { RT, RA } },
2018{ "nego.", XO(31,104,1,1), XORB_MASK, PPC|POWER, { RT, RA } },
2019
2020{ "mul", XO(31,107,0,0), XO_MASK, POWER|M601, { RT, RA, RB } },
2021{ "mul.", XO(31,107,0,1), XO_MASK, POWER|M601, { RT, RA, RB } },
2022{ "mulo", XO(31,107,1,0), XO_MASK, POWER|M601, { RT, RA, RB } },
2023{ "mulo.", XO(31,107,1,1), XO_MASK, POWER|M601, { RT, RA, RB } },
2024
2025{ "clf", X(31,118), XRB_MASK, POWER, { RT, RA } },
2026
2027{ "lbzux", X(31,119), X_MASK, PPC|POWER, { RT, RAL, RB } },
2028
2029{ "not", XRC(31,124,0), X_MASK, PPC|POWER, { RA, RS, RBS } },
2030{ "nor", XRC(31,124,0), X_MASK, PPC|POWER, { RA, RS, RB } },
2031{ "not.", XRC(31,124,1), X_MASK, PPC|POWER, { RA, RS, RBS } },
2032{ "nor.", XRC(31,124,1), X_MASK, PPC|POWER, { RA, RS, RB } },
2033
2034{ "subfe", XO(31,136,0,0), XO_MASK, PPC, { RT, RA, RB } },
2035{ "sfe", XO(31,136,0,0), XO_MASK, POWER, { RT, RA, RB } },
2036{ "subfe.", XO(31,136,0,1), XO_MASK, PPC, { RT, RA, RB } },
2037{ "sfe.", XO(31,136,0,1), XO_MASK, POWER, { RT, RA, RB } },
2038{ "subfeo", XO(31,136,1,0), XO_MASK, PPC, { RT, RA, RB } },
2039{ "sfeo", XO(31,136,1,0), XO_MASK, POWER, { RT, RA, RB } },
2040{ "subfeo.", XO(31,136,1,1), XO_MASK, PPC, { RT, RA, RB } },
2041{ "sfeo.", XO(31,136,1,1), XO_MASK, POWER, { RT, RA, RB } },
2042
2043{ "adde", XO(31,138,0,0), XO_MASK, PPC, { RT, RA, RB } },
2044{ "ae", XO(31,138,0,0), XO_MASK, POWER, { RT, RA, RB } },
2045{ "adde.", XO(31,138,0,1), XO_MASK, PPC, { RT, RA, RB } },
2046{ "ae.", XO(31,138,0,1), XO_MASK, POWER, { RT, RA, RB } },
2047{ "addeo", XO(31,138,1,0), XO_MASK, PPC, { RT, RA, RB } },
2048{ "aeo", XO(31,138,1,0), XO_MASK, POWER, { RT, RA, RB } },
2049{ "addeo.", XO(31,138,1,1), XO_MASK, PPC, { RT, RA, RB } },
2050{ "aeo.", XO(31,138,1,1), XO_MASK, POWER, { RT, RA, RB } },
2051
2052{ "mtcr", XFXM(31,144,0xff), XFXFXM_MASK|FXM_MASK, PPC|POWER, { RS }},
2053{ "mtcrf", X(31,144), XFXFXM_MASK, PPC|POWER, { FXM, RS } },
2054
2055{ "mtmsr", X(31,146), XRARB_MASK, PPC|POWER, { RS } },
2056
2057{ "stdx", X(31,149), X_MASK, PPC|B64, { RS, RA, RB } },
2058
2059{ "stwcx.", XRC(31,150,1), X_MASK, PPC, { RS, RA, RB } },
2060
2061{ "stwx", X(31,151), X_MASK, PPC, { RS, RA, RB } },
2062{ "stx", X(31,151), X_MASK, POWER, { RS, RA, RB } },
2063
2064{ "slq", XRC(31,152,0), X_MASK, POWER|M601, { RA, RS, RB } },
2065{ "slq.", XRC(31,152,1), X_MASK, POWER|M601, { RA, RS, RB } },
2066
2067{ "sle", XRC(31,153,0), X_MASK, POWER|M601, { RA, RS, RB } },
2068{ "sle.", XRC(31,153,1), X_MASK, POWER|M601, { RA, RS, RB } },
2069
2070{ "stdux", X(31,181), X_MASK, PPC|B64, { RS, RAS, RB } },
2071
2072{ "stwux", X(31,183), X_MASK, PPC, { RS, RAS, RB } },
2073{ "stux", X(31,183), X_MASK, POWER, { RS, RA, RB } },
2074
2075{ "sliq", XRC(31,184,0), X_MASK, POWER|M601, { RA, RS, SH } },
2076{ "sliq.", XRC(31,184,1), X_MASK, POWER|M601, { RA, RS, SH } },
2077
2078{ "subfze", XO(31,200,0,0), XORB_MASK, PPC, { RT, RA } },
2079{ "sfze", XO(31,200,0,0), XORB_MASK, POWER, { RT, RA } },
2080{ "subfze.", XO(31,200,0,1), XORB_MASK, PPC, { RT, RA } },
2081{ "sfze.", XO(31,200,0,1), XORB_MASK, POWER, { RT, RA } },
2082{ "subfzeo", XO(31,200,1,0), XORB_MASK, PPC, { RT, RA } },
2083{ "sfzeo", XO(31,200,1,0), XORB_MASK, POWER, { RT, RA } },
2084{ "subfzeo.",XO(31,200,1,1), XORB_MASK, PPC, { RT, RA } },
2085{ "sfzeo.", XO(31,200,1,1), XORB_MASK, POWER, { RT, RA } },
2086
2087{ "addze", XO(31,202,0,0), XORB_MASK, PPC, { RT, RA } },
2088{ "aze", XO(31,202,0,0), XORB_MASK, POWER, { RT, RA } },
2089{ "addze.", XO(31,202,0,1), XORB_MASK, PPC, { RT, RA } },
2090{ "aze.", XO(31,202,0,1), XORB_MASK, POWER, { RT, RA } },
2091{ "addzeo", XO(31,202,1,0), XORB_MASK, PPC, { RT, RA } },
2092{ "azeo", XO(31,202,1,0), XORB_MASK, POWER, { RT, RA } },
2093{ "addzeo.", XO(31,202,1,1), XORB_MASK, PPC, { RT, RA } },
2094{ "azeo.", XO(31,202,1,1), XORB_MASK, POWER, { RT, RA } },
2095
2096{ "mtsr", X(31,210), XRB_MASK|(1<<20), PPC|POWER|B32, { SR, RS } },
2097
2098{ "stdcx.", XRC(31,214,1), X_MASK, PPC|B64, { RS, RA, RB } },
2099
2100{ "stbx", X(31,215), X_MASK, PPC|POWER, { RS, RA, RB } },
2101
2102{ "sllq", XRC(31,216,0), X_MASK, POWER|M601, { RA, RS, RB } },
2103{ "sllq.", XRC(31,216,1), X_MASK, POWER|M601, { RA, RS, RB } },
2104
2105{ "sleq", XRC(31,217,0), X_MASK, POWER|M601, { RA, RS, RB } },
2106{ "sleq.", XRC(31,217,1), X_MASK, POWER|M601, { RA, RS, RB } },
2107
2108{ "subfme", XO(31,232,0,0), XORB_MASK, PPC, { RT, RA } },
2109{ "sfme", XO(31,232,0,0), XORB_MASK, POWER, { RT, RA } },
2110{ "subfme.", XO(31,232,0,1), XORB_MASK, PPC, { RT, RA } },
2111{ "sfme.", XO(31,232,0,1), XORB_MASK, POWER, { RT, RA } },
2112{ "subfmeo", XO(31,232,1,0), XORB_MASK, PPC, { RT, RA } },
2113{ "sfmeo", XO(31,232,1,0), XORB_MASK, POWER, { RT, RA } },
2114{ "subfmeo.",XO(31,232,1,1), XORB_MASK, PPC, { RT, RA } },
2115{ "sfmeo.", XO(31,232,1,1), XORB_MASK, POWER, { RT, RA } },
2116
2117{ "mulld", XO(31,233,0,0), XO_MASK, PPC|B64, { RT, RA, RB } },
2118{ "mulld.", XO(31,233,0,1), XO_MASK, PPC|B64, { RT, RA, RB } },
2119{ "mulldo", XO(31,233,1,0), XO_MASK, PPC|B64, { RT, RA, RB } },
2120{ "mulldo.", XO(31,233,1,1), XO_MASK, PPC|B64, { RT, RA, RB } },
2121
2122{ "addme", XO(31,234,0,0), XORB_MASK, PPC, { RT, RA } },
2123{ "ame", XO(31,234,0,0), XORB_MASK, POWER, { RT, RA } },
2124{ "addme.", XO(31,234,0,1), XORB_MASK, PPC, { RT, RA } },
2125{ "ame.", XO(31,234,0,1), XORB_MASK, POWER, { RT, RA } },
2126{ "addmeo", XO(31,234,1,0), XORB_MASK, PPC, { RT, RA } },
2127{ "ameo", XO(31,234,1,0), XORB_MASK, POWER, { RT, RA } },
2128{ "addmeo.", XO(31,234,1,1), XORB_MASK, PPC, { RT, RA } },
2129{ "ameo.", XO(31,234,1,1), XORB_MASK, POWER, { RT, RA } },
2130
2131{ "mullw", XO(31,235,0,0), XO_MASK, PPC, { RT, RA, RB } },
2132{ "muls", XO(31,235,0,0), XO_MASK, POWER, { RT, RA, RB } },
2133{ "mullw.", XO(31,235,0,1), XO_MASK, PPC, { RT, RA, RB } },
2134{ "muls.", XO(31,235,0,1), XO_MASK, POWER, { RT, RA, RB } },
2135{ "mullwo", XO(31,235,1,0), XO_MASK, PPC, { RT, RA, RB } },
2136{ "mulso", XO(31,235,1,0), XO_MASK, POWER, { RT, RA, RB } },
2137{ "mullwo.", XO(31,235,1,1), XO_MASK, PPC, { RT, RA, RB } },
2138{ "mulso.", XO(31,235,1,1), XO_MASK, POWER, { RT, RA, RB } },
2139
2140{ "mtsrin", X(31,242), XRA_MASK, PPC|B32, { RS, RB } },
2141{ "mtsri", X(31,242), XRA_MASK, POWER|B32, { RS, RB } },
2142
2143{ "dcbtst", X(31,246), XRT_MASK, PPC, { RA, RB } },
2144
2145{ "stbux", X(31,247), X_MASK, PPC|POWER, { RS, RAS, RB } },
2146
2147{ "slliq", XRC(31,248,0), X_MASK, POWER|M601, { RA, RS, SH } },
2148{ "slliq.", XRC(31,248,1), X_MASK, POWER|M601, { RA, RS, SH } },
2149
2150{ "doz", XO(31,264,0,0), XO_MASK, POWER|M601, { RT, RA, RB } },
2151{ "doz.", XO(31,264,0,1), XO_MASK, POWER|M601, { RT, RA, RB } },
2152{ "dozo", XO(31,264,1,0), XO_MASK, POWER|M601, { RT, RA, RB } },
2153{ "dozo.", XO(31,264,1,1), XO_MASK, POWER|M601, { RT, RA, RB } },
2154
2155{ "add", XO(31,266,0,0), XO_MASK, PPC, { RT, RA, RB } },
2156{ "cax", XO(31,266,0,0), XO_MASK, POWER, { RT, RA, RB } },
2157{ "add.", XO(31,266,0,1), XO_MASK, PPC, { RT, RA, RB } },
2158{ "cax.", XO(31,266,0,1), XO_MASK, POWER, { RT, RA, RB } },
2159{ "addo", XO(31,266,1,0), XO_MASK, PPC, { RT, RA, RB } },
2160{ "caxo", XO(31,266,1,0), XO_MASK, POWER, { RT, RA, RB } },
2161{ "addo.", XO(31,266,1,1), XO_MASK, PPC, { RT, RA, RB } },
2162{ "caxo.", XO(31,266,1,1), XO_MASK, POWER, { RT, RA, RB } },
2163
2164{ "lscbx", XRC(31,277,0), X_MASK, POWER|M601, { RT, RA, RB } },
2165{ "lscbx.", XRC(31,277,1), X_MASK, POWER|M601, { RT, RA, RB } },
2166
2167{ "dcbt", X(31,278), XRT_MASK, PPC, { RA, RB } },
2168
2169{ "lhzx", X(31,279), X_MASK, PPC|POWER, { RT, RA, RB } },
2170
2171{ "icbt", X(31,262), XRT_MASK, PPC, { RA, RB } },
2172
2173{ "eqv", XRC(31,284,0), X_MASK, PPC|POWER, { RA, RS, RB } },
2174{ "eqv.", XRC(31,284,1), X_MASK, PPC|POWER, { RA, RS, RB } },
2175
2176{ "tlbie", X(31,306), XRTRA_MASK, PPC, { RB } },
2177{ "tlbi", X(31,306), XRTRA_MASK, POWER, { RB } },
2178
2179{ "eciwx", X(31,310), X_MASK, PPC, { RT, RA, RB } },
2180
2181{ "lhzux", X(31,311), X_MASK, PPC|POWER, { RT, RAL, RB } },
2182
2183{ "xor", XRC(31,316,0), X_MASK, PPC|POWER, { RA, RS, RB } },
2184{ "xor.", XRC(31,316,1), X_MASK, PPC|POWER, { RA, RS, RB } },
2185
2186{ "mfdcr", X(31,323), X_MASK, PPC, { RT, SPR } },
2187
2188{ "div", XO(31,331,0,0), XO_MASK, POWER|M601, { RT, RA, RB } },
2189{ "div.", XO(31,331,0,1), XO_MASK, POWER|M601, { RT, RA, RB } },
2190{ "divo", XO(31,331,1,0), XO_MASK, POWER|M601, { RT, RA, RB } },
2191{ "divo.", XO(31,331,1,1), XO_MASK, POWER|M601, { RT, RA, RB } },
2192
2193{ "mfmq", XSPR(31,339,0), XSPR_MASK, POWER|M601, { RT } },
2194{ "mfxer", XSPR(31,339,1), XSPR_MASK, PPC|POWER, { RT } },
2195{ "mfrtcu", XSPR(31,339,4), XSPR_MASK, PPC|POWER, { RT } },
2196{ "mfrtcl", XSPR(31,339,5), XSPR_MASK, PPC|POWER, { RT } },
2197{ "mfdec", XSPR(31,339,6), XSPR_MASK, POWER|M601, { RT } },
2198{ "mflr", XSPR(31,339,8), XSPR_MASK, PPC|POWER, { RT } },
2199{ "mfctr", XSPR(31,339,9), XSPR_MASK, PPC|POWER, { RT } },
2200{ "mftid", XSPR(31,339,17), XSPR_MASK, POWER, { RT } },
2201{ "mfdsisr", XSPR(31,339,18), XSPR_MASK, PPC|POWER, { RT } },
2202{ "mfdar", XSPR(31,339,19), XSPR_MASK, PPC|POWER, { RT } },
2203{ "mfdec", XSPR(31,339,22), XSPR_MASK, PPC, { RT } },
2204{ "mfsdr0", XSPR(31,339,24), XSPR_MASK, POWER, { RT } },
2205{ "mfsdr1", XSPR(31,339,25), XSPR_MASK, PPC|POWER, { RT } },
2206{ "mfsrr0", XSPR(31,339,26), XSPR_MASK, PPC|POWER, { RT } },
2207{ "mfsrr1", XSPR(31,339,27), XSPR_MASK, PPC|POWER, { RT } },
2208{ "mfsprg", XSPR(31,339,272), XSPRG_MASK, PPC, { RT, SPRG } },
2209{ "mfasr", XSPR(31,339,280), XSPR_MASK, PPC|B64, { RT } },
2210{ "mfear", XSPR(31,339,282), XSPR_MASK, PPC, { RT } },
2211{ "mfpvr", XSPR(31,339,287), XSPR_MASK, PPC, { RT } },
2212{ "mfibatu", XSPR(31,339,528), XSPRBAT_MASK, PPC, { RT, SPRBAT } },
2213{ "mfibatl", XSPR(31,339,529), XSPRBAT_MASK, PPC, { RT, SPRBAT } },
2214{ "mfdbatu", XSPR(31,339,536), XSPRBAT_MASK, PPC, { RT, SPRBAT } },
2215{ "mfdbatl", XSPR(31,339,537), XSPRBAT_MASK, PPC, { RT, SPRBAT } },
2216{ "mfspr", X(31,339), X_MASK, PPC|POWER, { RT, SPR } },
2217
2218{ "lwax", X(31,341), X_MASK, PPC|B64, { RT, RA, RB } },
2219
2220{ "lhax", X(31,343), X_MASK, PPC|POWER, { RT, RA, RB } },
2221
2222{ "dccci", X(31,454), XRT_MASK, PPC, { RA, RB } },
2223
2224{ "abs", XO(31,360,0,0), XORB_MASK, POWER|M601, { RT, RA } },
2225{ "abs.", XO(31,360,0,1), XORB_MASK, POWER|M601, { RT, RA } },
2226{ "abso", XO(31,360,1,0), XORB_MASK, POWER|M601, { RT, RA } },
2227{ "abso.", XO(31,360,1,1), XORB_MASK, POWER|M601, { RT, RA } },
2228
2229{ "divs", XO(31,363,0,0), XO_MASK, POWER|M601, { RT, RA, RB } },
2230{ "divs.", XO(31,363,0,1), XO_MASK, POWER|M601, { RT, RA, RB } },
2231{ "divso", XO(31,363,1,0), XO_MASK, POWER|M601, { RT, RA, RB } },
2232{ "divso.", XO(31,363,1,1), XO_MASK, POWER|M601, { RT, RA, RB } },
2233
2234{ "tlbia", X(31,370), 0xffffffff, PPC, { 0 } },
2235
2236{ "mftbu", XSPR(31,371,269), XSPR_MASK, PPC, { RT } },
2237{ "mftb", X(31,371), X_MASK, PPC, { RT, TBR } },
2238
2239{ "lwaux", X(31,373), X_MASK, PPC|B64, { RT, RAL, RB } },
2240
2241{ "lhaux", X(31,375), X_MASK, PPC|POWER, { RT, RAL, RB } },
2242
2243{ "sthx", X(31,407), X_MASK, PPC|POWER, { RS, RA, RB } },
2244
2245{ "lfqx", X(31,791), X_MASK, POWER2, { FRT, RA, RB } },
2246
2247{ "lfqux", X(31,823), X_MASK, POWER2, { FRT, RA, RB } },
2248
2249{ "stfqx", X(31,919), X_MASK, POWER2, { FRS, RA, RB } },
2250
2251{ "stfqux", X(31,951), X_MASK, POWER2, { FRS, RA, RB } },
2252
2253{ "orc", XRC(31,412,0), X_MASK, PPC|POWER, { RA, RS, RB } },
2254{ "orc.", XRC(31,412,1), X_MASK, PPC|POWER, { RA, RS, RB } },
2255
2256{ "sradi", XS(31,413,0), XS_MASK, PPC|B64, { RA, RS, SH6 } },
2257{ "sradi.", XS(31,413,1), XS_MASK, PPC|B64, { RA, RS, SH6 } },
2258
2259{ "slbie", X(31,434), XRTRA_MASK, PPC|B64, { RB } },
2260
2261{ "ecowx", X(31,438), X_MASK, PPC, { RT, RA, RB } },
2262
2263{ "sthux", X(31,439), X_MASK, PPC|POWER, { RS, RAS, RB } },
2264
2265{ "mr", XRC(31,444,0), X_MASK, PPC|POWER, { RA, RS, RBS } },
2266{ "or", XRC(31,444,0), X_MASK, PPC|POWER, { RA, RS, RB } },
2267{ "mr.", XRC(31,444,1), X_MASK, PPC|POWER, { RA, RS, RBS } },
2268{ "or.", XRC(31,444,1), X_MASK, PPC|POWER, { RA, RS, RB } },
2269
2270{ "mtdcr", X(31,451), X_MASK, PPC, { SPR, RS } },
2271
2272{ "divdu", XO(31,457,0,0), XO_MASK, PPC|B64, { RT, RA, RB } },
2273{ "divdu.", XO(31,457,0,1), XO_MASK, PPC|B64, { RT, RA, RB } },
2274{ "divduo", XO(31,457,1,0), XO_MASK, PPC|B64, { RT, RA, RB } },
2275{ "divduo.", XO(31,457,1,1), XO_MASK, PPC|B64, { RT, RA, RB } },
2276
2277{ "divwu", XO(31,459,0,0), XO_MASK, PPC, { RT, RA, RB } },
2278{ "divwu.", XO(31,459,0,1), XO_MASK, PPC, { RT, RA, RB } },
2279{ "divwuo", XO(31,459,1,0), XO_MASK, PPC, { RT, RA, RB } },
2280{ "divwuo.", XO(31,459,1,1), XO_MASK, PPC, { RT, RA, RB } },
2281
2282{ "mtmq", XSPR(31,467,0), XSPR_MASK, POWER|M601, { RS } },
2283{ "mtxer", XSPR(31,467,1), XSPR_MASK, PPC|POWER, { RS } },
2284{ "mtlr", XSPR(31,467,8), XSPR_MASK, PPC|POWER, { RS } },
2285{ "mtctr", XSPR(31,467,9), XSPR_MASK, PPC|POWER, { RS } },
2286{ "mttid", XSPR(31,467,17), XSPR_MASK, POWER, { RS } },
2287{ "mtdsisr", XSPR(31,467,18), XSPR_MASK, PPC|POWER, { RS } },
2288{ "mtdar", XSPR(31,467,19), XSPR_MASK, PPC|POWER, { RS } },
2289{ "mtrtcu", XSPR(31,467,20), XSPR_MASK, PPC|POWER, { RS } },
2290{ "mtrtcl", XSPR(31,467,21), XSPR_MASK, PPC|POWER, { RS } },
2291{ "mtdec", XSPR(31,467,22), XSPR_MASK, PPC|POWER, { RS } },
2292{ "mtsdr0", XSPR(31,467,24), XSPR_MASK, POWER, { RS } },
2293{ "mtsdr1", XSPR(31,467,25), XSPR_MASK, PPC|POWER, { RS } },
2294{ "mtsrr0", XSPR(31,467,26), XSPR_MASK, PPC|POWER, { RS } },
2295{ "mtsrr1", XSPR(31,467,27), XSPR_MASK, PPC|POWER, { RS } },
2296{ "mtsprg", XSPR(31,467,272), XSPRG_MASK, PPC, { SPRG, RS } },
2297{ "mtasr", XSPR(31,467,280), XSPR_MASK, PPC|B64, { RS } },
2298{ "mtear", XSPR(31,467,282), XSPR_MASK, PPC, { RS } },
2299{ "mttbl", XSPR(31,467,284), XSPR_MASK, PPC, { RS } },
2300{ "mttbu", XSPR(31,467,285), XSPR_MASK, PPC, { RS } },
2301{ "mtibatu", XSPR(31,467,528), XSPRBAT_MASK, PPC, { SPRBAT, RS } },
2302{ "mtibatl", XSPR(31,467,529), XSPRBAT_MASK, PPC, { SPRBAT, RS } },
2303{ "mtdbatu", XSPR(31,467,536), XSPRBAT_MASK, PPC, { SPRBAT, RS } },
2304{ "mtdbatl", XSPR(31,467,537), XSPRBAT_MASK, PPC, { SPRBAT, RS } },
2305{ "mtspr", X(31,467), X_MASK, PPC|POWER, { SPR, RS } },
2306
2307{ "dcbi", X(31,470), XRT_MASK, PPC, { RA, RB } },
2308
2309{ "nand", XRC(31,476,0), X_MASK, PPC|POWER, { RA, RS, RB } },
2310{ "nand.", XRC(31,476,1), X_MASK, PPC|POWER, { RA, RS, RB } },
2311
2312{ "nabs", XO(31,488,0,0), XORB_MASK, POWER|M601, { RT, RA } },
2313{ "nabs.", XO(31,488,0,1), XORB_MASK, POWER|M601, { RT, RA } },
2314{ "nabso", XO(31,488,1,0), XORB_MASK, POWER|M601, { RT, RA } },
2315{ "nabso.", XO(31,488,1,1), XORB_MASK, POWER|M601, { RT, RA } },
2316
2317{ "divd", XO(31,489,0,0), XO_MASK, PPC|B64, { RT, RA, RB } },
2318{ "divd.", XO(31,489,0,1), XO_MASK, PPC|B64, { RT, RA, RB } },
2319{ "divdo", XO(31,489,1,0), XO_MASK, PPC|B64, { RT, RA, RB } },
2320{ "divdo.", XO(31,489,1,1), XO_MASK, PPC|B64, { RT, RA, RB } },
2321
2322{ "divw", XO(31,491,0,0), XO_MASK, PPC, { RT, RA, RB } },
2323{ "divw.", XO(31,491,0,1), XO_MASK, PPC, { RT, RA, RB } },
2324{ "divwo", XO(31,491,1,0), XO_MASK, PPC, { RT, RA, RB } },
2325{ "divwo.", XO(31,491,1,1), XO_MASK, PPC, { RT, RA, RB } },
2326
2327{ "slbia", X(31,498), 0xffffffff, PPC|B64, { 0 } },
2328
2329{ "cli", X(31,502), XRB_MASK, POWER, { RT, RA } },
2330
2331{ "mcrxr", X(31,512), XRARB_MASK|(3<<21), PPC|POWER, { BF } },
2332
2333{ "clcs", X(31,531), XRB_MASK, POWER|M601, { RT, RA } },
2334
2335{ "lswx", X(31,533), X_MASK, PPC, { RT, RA, RB } },
2336{ "lsx", X(31,533), X_MASK, POWER, { RT, RA, RB } },
2337
2338{ "lwbrx", X(31,534), X_MASK, PPC, { RT, RA, RB } },
2339{ "lbrx", X(31,534), X_MASK, POWER, { RT, RA, RB } },
2340
2341{ "lfsx", X(31,535), X_MASK, PPC|POWER, { FRT, RA, RB } },
2342
2343{ "srw", XRC(31,536,0), X_MASK, PPC, { RA, RS, RB } },
2344{ "sr", XRC(31,536,0), X_MASK, POWER, { RA, RS, RB } },
2345{ "srw.", XRC(31,536,1), X_MASK, PPC, { RA, RS, RB } },
2346{ "sr.", XRC(31,536,1), X_MASK, POWER, { RA, RS, RB } },
2347
2348{ "rrib", XRC(31,537,0), X_MASK, POWER|M601, { RA, RS, RB } },
2349{ "rrib.", XRC(31,537,1), X_MASK, POWER|M601, { RA, RS, RB } },
2350
2351{ "srd", XRC(31,539,0), X_MASK, PPC|B64, { RA, RS, RB } },
2352{ "srd.", XRC(31,539,1), X_MASK, PPC|B64, { RA, RS, RB } },
2353
2354{ "maskir", XRC(31,541,0), X_MASK, POWER|M601, { RA, RS, RB } },
2355{ "maskir.", XRC(31,541,1), X_MASK, POWER|M601, { RA, RS, RB } },
2356
2357{ "tlbsync", X(31,566), 0xffffffff, PPC, { 0 } },
2358
2359{ "lfsux", X(31,567), X_MASK, PPC|POWER, { FRT, RAS, RB } },
2360
2361{ "mfsr", X(31,595), XRB_MASK|(1<<20), PPC|POWER|B32, { RT, SR } },
2362
2363{ "lswi", X(31,597), X_MASK, PPC, { RT, RA, NB } },
2364{ "lsi", X(31,597), X_MASK, POWER, { RT, RA, NB } },
2365
2366{ "sync", X(31,598), 0xffffffff, PPC, { 0 } },
2367{ "dcs", X(31,598), 0xffffffff, POWER, { 0 } },
2368
2369{ "lfdx", X(31,599), X_MASK, PPC|POWER, { FRT, RA, RB } },
2370
2371{ "mfsri", X(31,627), X_MASK, POWER, { RT, RA, RB } },
2372
2373{ "dclst", X(31,630), XRB_MASK, POWER, { RS, RA } },
2374
2375{ "lfdux", X(31,631), X_MASK, PPC|POWER, { FRT, RAS, RB } },
2376
2377{ "mfsrin", X(31,659), XRA_MASK, PPC|B32, { RT, RB } },
2378
2379{ "stswx", X(31,661), X_MASK, PPC, { RS, RA, RB } },
2380{ "stsx", X(31,661), X_MASK, POWER, { RS, RA, RB } },
2381
2382{ "stwbrx", X(31,662), X_MASK, PPC, { RS, RA, RB } },
2383{ "stbrx", X(31,662), X_MASK, POWER, { RS, RA, RB } },
2384
2385{ "stfsx", X(31,663), X_MASK, PPC|POWER, { FRS, RA, RB } },
2386
2387{ "srq", XRC(31,664,0), X_MASK, POWER|M601, { RA, RS, RB } },
2388{ "srq.", XRC(31,664,1), X_MASK, POWER|M601, { RA, RS, RB } },
2389
2390{ "sre", XRC(31,665,0), X_MASK, POWER|M601, { RA, RS, RB } },
2391{ "sre.", XRC(31,665,1), X_MASK, POWER|M601, { RA, RS, RB } },
2392
2393{ "stfsux", X(31,695), X_MASK, PPC|POWER, { FRS, RAS, RB } },
2394
2395{ "sriq", XRC(31,696,0), X_MASK, POWER|M601, { RA, RS, SH } },
2396{ "sriq.", XRC(31,696,1), X_MASK, POWER|M601, { RA, RS, SH } },
2397
2398{ "stswi", X(31,725), X_MASK, PPC, { RS, RA, NB } },
2399{ "stsi", X(31,725), X_MASK, POWER, { RS, RA, NB } },
2400
2401{ "stfdx", X(31,727), X_MASK, PPC|POWER, { FRS, RA, RB } },
2402
2403{ "srlq", XRC(31,728,0), X_MASK, POWER|M601, { RA, RS, RB } },
2404{ "srlq.", XRC(31,728,1), X_MASK, POWER|M601, { RA, RS, RB } },
2405
2406{ "sreq", XRC(31,729,0), X_MASK, POWER|M601, { RA, RS, RB } },
2407{ "sreq.", XRC(31,729,1), X_MASK, POWER|M601, { RA, RS, RB } },
2408
2409{ "stfdux", X(31,759), X_MASK, PPC|POWER, { FRS, RAS, RB } },
2410
2411{ "srliq", XRC(31,760,0), X_MASK, POWER|M601, { RA, RS, SH } },
2412{ "srliq.", XRC(31,760,1), X_MASK, POWER|M601, { RA, RS, SH } },
2413
2414{ "lhbrx", X(31,790), X_MASK, PPC|POWER, { RT, RA, RB } },
2415
2416{ "sraw", XRC(31,792,0), X_MASK, PPC, { RA, RS, RB } },
2417{ "sra", XRC(31,792,0), X_MASK, POWER, { RA, RS, RB } },
2418{ "sraw.", XRC(31,792,1), X_MASK, PPC, { RA, RS, RB } },
2419{ "sra.", XRC(31,792,1), X_MASK, POWER, { RA, RS, RB } },
2420
2421{ "srad", XRC(31,794,0), X_MASK, PPC|B64, { RA, RS, RB } },
2422{ "srad.", XRC(31,794,1), X_MASK, PPC|B64, { RA, RS, RB } },
2423
2424{ "rac", X(31,818), X_MASK, POWER, { RT, RA, RB } },
2425
2426{ "srawi", XRC(31,824,0), X_MASK, PPC, { RA, RS, SH } },
2427{ "srai", XRC(31,824,0), X_MASK, POWER, { RA, RS, SH } },
2428{ "srawi.", XRC(31,824,1), X_MASK, PPC, { RA, RS, SH } },
2429{ "srai.", XRC(31,824,1), X_MASK, POWER, { RA, RS, SH } },
2430
2431{ "eieio", X(31,854), 0xffffffff, PPC, { 0 } },
2432
2433{ "sthbrx", X(31,918), X_MASK, PPC|POWER, { RS, RA, RB } },
2434
2435{ "sraq", XRC(31,920,0), X_MASK, POWER|M601, { RA, RS, RB } },
2436{ "sraq.", XRC(31,920,1), X_MASK, POWER|M601, { RA, RS, RB } },
2437
2438{ "srea", XRC(31,921,0), X_MASK, POWER|M601, { RA, RS, RB } },
2439{ "srea.", XRC(31,921,1), X_MASK, POWER|M601, { RA, RS, RB } },
2440
2441{ "extsh", XRC(31,922,0), XRB_MASK, PPC, { RA, RS } },
2442{ "exts", XRC(31,922,0), XRB_MASK, POWER, { RA, RS } },
2443{ "extsh.", XRC(31,922,1), XRB_MASK, PPC, { RA, RS } },
2444{ "exts.", XRC(31,922,1), XRB_MASK, POWER, { RA, RS } },
2445
2446{ "sraiq", XRC(31,952,0), X_MASK, POWER|M601, { RA, RS, SH } },
2447{ "sraiq.", XRC(31,952,1), X_MASK, POWER|M601, { RA, RS, SH } },
2448
2449{ "extsb", XRC(31,954,0), XRB_MASK, PPC, { RA, RS} },
2450{ "extsb.", XRC(31,954,1), XRB_MASK, PPC, { RA, RS} },
2451
2452{ "iccci", X(31,966), XRT_MASK, PPC, { RA, RB } },
2453
2454{ "icbi", X(31,982), XRT_MASK, PPC, { RA, RB } },
2455
2456{ "stfiwx", X(31,983), X_MASK, PPC, { FRS, RA, RB } },
2457
2458{ "extsw", XRC(31,986,0), XRB_MASK, PPC, { RA, RS } },
2459{ "extsw.", XRC(31,986,1), XRB_MASK, PPC, { RA, RS } },
2460
2461{ "dcbz", X(31,1014), XRT_MASK, PPC, { RA, RB } },
2462{ "dclz", X(31,1014), XRT_MASK, PPC, { RA, RB } },
2463
2464{ "lwz", OP(32), OP_MASK, PPC, { RT, D, RA } },
2465{ "l", OP(32), OP_MASK, POWER, { RT, D, RA } },
2466
2467{ "lwzu", OP(33), OP_MASK, PPC, { RT, D, RAL } },
2468{ "lu", OP(33), OP_MASK, POWER, { RT, D, RA } },
2469
2470{ "lbz", OP(34), OP_MASK, PPC|POWER, { RT, D, RA } },
2471
2472{ "lbzu", OP(35), OP_MASK, PPC|POWER, { RT, D, RAL } },
2473
2474{ "stw", OP(36), OP_MASK, PPC, { RS, D, RA } },
2475{ "st", OP(36), OP_MASK, POWER, { RS, D, RA } },
2476
2477{ "stwu", OP(37), OP_MASK, PPC, { RS, D, RAS } },
2478{ "stu", OP(37), OP_MASK, POWER, { RS, D, RA } },
2479
2480{ "stb", OP(38), OP_MASK, PPC|POWER, { RS, D, RA } },
2481
2482{ "stbu", OP(39), OP_MASK, PPC|POWER, { RS, D, RAS } },
2483
2484{ "lhz", OP(40), OP_MASK, PPC|POWER, { RT, D, RA } },
2485
2486{ "lhzu", OP(41), OP_MASK, PPC|POWER, { RT, D, RAL } },
2487
2488{ "lha", OP(42), OP_MASK, PPC|POWER, { RT, D, RA } },
2489
2490{ "lhau", OP(43), OP_MASK, PPC|POWER, { RT, D, RAL } },
2491
2492{ "sth", OP(44), OP_MASK, PPC|POWER, { RS, D, RA } },
2493
2494{ "sthu", OP(45), OP_MASK, PPC|POWER, { RS, D, RAS } },
2495
2496{ "lmw", OP(46), OP_MASK, PPC, { RT, D, RAM } },
2497{ "lm", OP(46), OP_MASK, POWER, { RT, D, RA } },
2498
2499{ "stmw", OP(47), OP_MASK, PPC, { RS, D, RA } },
2500{ "stm", OP(47), OP_MASK, POWER, { RS, D, RA } },
2501
2502{ "lfs", OP(48), OP_MASK, PPC|POWER, { FRT, D, RA } },
2503
2504{ "lfsu", OP(49), OP_MASK, PPC|POWER, { FRT, D, RAS } },
2505
2506{ "lfd", OP(50), OP_MASK, PPC|POWER, { FRT, D, RA } },
2507
2508{ "lfdu", OP(51), OP_MASK, PPC|POWER, { FRT, D, RAS } },
2509
2510{ "stfs", OP(52), OP_MASK, PPC|POWER, { FRS, D, RA } },
2511
2512{ "stfsu", OP(53), OP_MASK, PPC|POWER, { FRS, D, RAS } },
2513
2514{ "stfd", OP(54), OP_MASK, PPC|POWER, { FRS, D, RA } },
2515
2516{ "stfdu", OP(55), OP_MASK, PPC|POWER, { FRS, D, RAS } },
2517
2518{ "lfq", OP(56), OP_MASK, POWER2, { FRT, D, RA } },
2519
2520{ "lfqu", OP(57), OP_MASK, POWER2, { FRT, D, RA } },
2521
2522{ "ld", DSO(58,0), DS_MASK, PPC|B64, { RT, DS, RA } },
2523
2524{ "ldu", DSO(58,1), DS_MASK, PPC|B64, { RT, DS, RAL } },
2525
2526{ "lwa", DSO(58,2), DS_MASK, PPC|B64, { RT, DS, RA } },
2527
2528{ "fdivs", A(59,18,0), AFRC_MASK, PPC, { FRT, FRA, FRB } },
2529{ "fdivs.", A(59,18,1), AFRC_MASK, PPC, { FRT, FRA, FRB } },
2530
2531{ "fsubs", A(59,20,0), AFRC_MASK, PPC, { FRT, FRA, FRB } },
2532{ "fsubs.", A(59,20,1), AFRC_MASK, PPC, { FRT, FRA, FRB } },
2533
2534{ "fadds", A(59,21,0), AFRC_MASK, PPC, { FRT, FRA, FRB } },
2535{ "fadds.", A(59,21,1), AFRC_MASK, PPC, { FRT, FRA, FRB } },
2536
2537{ "fsqrts", A(59,22,0), AFRAFRC_MASK, PPC, { FRT, FRB } },
2538{ "fsqrts.", A(59,22,1), AFRAFRC_MASK, PPC, { FRT, FRB } },
2539
2540{ "fres", A(59,24,0), AFRAFRC_MASK, PPC, { FRT, FRB } },
2541{ "fres.", A(59,24,1), AFRAFRC_MASK, PPC, { FRT, FRB } },
2542
2543{ "fmuls", A(59,25,0), AFRB_MASK, PPC, { FRT, FRA, FRC } },
2544{ "fmuls.", A(59,25,1), AFRB_MASK, PPC, { FRT, FRA, FRC } },
2545
2546{ "fmsubs", A(59,28,0), A_MASK, PPC, { FRT,FRA,FRC,FRB } },
2547{ "fmsubs.", A(59,28,1), A_MASK, PPC, { FRT,FRA,FRC,FRB } },
2548
2549{ "fmadds", A(59,29,0), A_MASK, PPC, { FRT,FRA,FRC,FRB } },
2550{ "fmadds.", A(59,29,1), A_MASK, PPC, { FRT,FRA,FRC,FRB } },
2551
2552{ "fnmsubs", A(59,30,0), A_MASK, PPC, { FRT,FRA,FRC,FRB } },
2553{ "fnmsubs.",A(59,30,1), A_MASK, PPC, { FRT,FRA,FRC,FRB } },
2554
2555{ "fnmadds", A(59,31,0), A_MASK, PPC, { FRT,FRA,FRC,FRB } },
2556{ "fnmadds.",A(59,31,1), A_MASK, PPC, { FRT,FRA,FRC,FRB } },
2557
2558{ "stfq", OP(60), OP_MASK, POWER2, { FRS, D, RA } },
2559
2560{ "stfqu", OP(61), OP_MASK, POWER2, { FRS, D, RA } },
2561
2562{ "std", DSO(62,0), DS_MASK, PPC|B64, { RS, DS, RA } },
2563
2564{ "stdu", DSO(62,1), DS_MASK, PPC|B64, { RS, DS, RAS } },
2565
2566{ "fcmpu", X(63,0), X_MASK|(3<<21), PPC|POWER, { BF, FRA, FRB } },
2567
2568{ "frsp", XRC(63,12,0), XRA_MASK, PPC|POWER, { FRT, FRB } },
2569{ "frsp.", XRC(63,12,1), XRA_MASK, PPC|POWER, { FRT, FRB } },
2570
2571{ "fctiw", XRC(63,14,0), XRA_MASK, PPC, { FRT, FRB } },
2572{ "fcir", XRC(63,14,0), XRA_MASK, POWER2, { FRT, FRB } },
2573{ "fctiw.", XRC(63,14,1), XRA_MASK, PPC, { FRT, FRB } },
2574{ "fcir.", XRC(63,14,1), XRA_MASK, POWER2, { FRT, FRB } },
2575
2576{ "fctiwz", XRC(63,15,0), XRA_MASK, PPC, { FRT, FRB } },
2577{ "fcirz", XRC(63,15,0), XRA_MASK, POWER2, { FRT, FRB } },
2578{ "fctiwz.", XRC(63,15,1), XRA_MASK, PPC, { FRT, FRB } },
2579{ "fcirz.", XRC(63,15,1), XRA_MASK, POWER2, { FRT, FRB } },
2580
2581{ "fdiv", A(63,18,0), AFRC_MASK, PPC, { FRT, FRA, FRB } },
2582{ "fd", A(63,18,0), AFRC_MASK, POWER, { FRT, FRA, FRB } },
2583{ "fdiv.", A(63,18,1), AFRC_MASK, PPC, { FRT, FRA, FRB } },
2584{ "fd.", A(63,18,1), AFRC_MASK, POWER, { FRT, FRA, FRB } },
2585
2586{ "fsub", A(63,20,0), AFRC_MASK, PPC, { FRT, FRA, FRB } },
2587{ "fs", A(63,20,0), AFRC_MASK, POWER, { FRT, FRA, FRB } },
2588{ "fsub.", A(63,20,1), AFRC_MASK, PPC, { FRT, FRA, FRB } },
2589{ "fs.", A(63,20,1), AFRC_MASK, POWER, { FRT, FRA, FRB } },
2590
2591{ "fadd", A(63,21,0), AFRC_MASK, PPC, { FRT, FRA, FRB } },
2592{ "fa", A(63,21,0), AFRC_MASK, POWER, { FRT, FRA, FRB } },
2593{ "fadd.", A(63,21,1), AFRC_MASK, PPC, { FRT, FRA, FRB } },
2594{ "fa.", A(63,21,1), AFRC_MASK, POWER, { FRT, FRA, FRB } },
2595
2596{ "fsqrt", A(63,22,0), AFRAFRC_MASK, PPC|POWER2, { FRT, FRB } },
2597{ "fsqrt.", A(63,22,1), AFRAFRC_MASK, PPC|POWER2, { FRT, FRB } },
2598
2599{ "fsel", A(63,23,0), A_MASK, PPC, { FRT,FRA,FRC,FRB } },
2600{ "fsel.", A(63,23,1), A_MASK, PPC, { FRT,FRA,FRC,FRB } },
2601
2602{ "fmul", A(63,25,0), AFRB_MASK, PPC, { FRT, FRA, FRC } },
2603{ "fm", A(63,25,0), AFRB_MASK, POWER, { FRT, FRA, FRC } },
2604{ "fmul.", A(63,25,1), AFRB_MASK, PPC, { FRT, FRA, FRC } },
2605{ "fm.", A(63,25,1), AFRB_MASK, POWER, { FRT, FRA, FRC } },
2606
2607{ "frsqrte", A(63,26,0), AFRAFRC_MASK, PPC, { FRT, FRB } },
2608{ "frsqrte.",A(63,26,1), AFRAFRC_MASK, PPC, { FRT, FRB } },
2609
2610{ "fmsub", A(63,28,0), A_MASK, PPC, { FRT,FRA,FRC,FRB } },
2611{ "fms", A(63,28,0), A_MASK, POWER, { FRT,FRA,FRC,FRB } },
2612{ "fmsub.", A(63,28,1), A_MASK, PPC, { FRT,FRA,FRC,FRB } },
2613{ "fms.", A(63,28,1), A_MASK, POWER, { FRT,FRA,FRC,FRB } },
2614
2615{ "fmadd", A(63,29,0), A_MASK, PPC, { FRT,FRA,FRC,FRB } },
2616{ "fma", A(63,29,0), A_MASK, POWER, { FRT,FRA,FRC,FRB } },
2617{ "fmadd.", A(63,29,1), A_MASK, PPC, { FRT,FRA,FRC,FRB } },
2618{ "fma.", A(63,29,1), A_MASK, POWER, { FRT,FRA,FRC,FRB } },
2619
2620{ "fnmsub", A(63,30,0), A_MASK, PPC, { FRT,FRA,FRC,FRB } },
2621{ "fnms", A(63,30,0), A_MASK, POWER, { FRT,FRA,FRC,FRB } },
2622{ "fnmsub.", A(63,30,1), A_MASK, PPC, { FRT,FRA,FRC,FRB } },
2623{ "fnms.", A(63,30,1), A_MASK, POWER, { FRT,FRA,FRC,FRB } },
2624
2625{ "fnmadd", A(63,31,0), A_MASK, PPC, { FRT,FRA,FRC,FRB } },
2626{ "fnma", A(63,31,0), A_MASK, POWER, { FRT,FRA,FRC,FRB } },
2627{ "fnmadd.", A(63,31,1), A_MASK, PPC, { FRT,FRA,FRC,FRB } },
2628{ "fnma.", A(63,31,1), A_MASK, POWER, { FRT,FRA,FRC,FRB } },
2629
2630{ "fcmpo", X(63,30), X_MASK|(3<<21), PPC|POWER, { BF, FRA, FRB } },
2631
2632{ "mtfsb1", XRC(63,38,0), XRARB_MASK, PPC|POWER, { BT } },
2633{ "mtfsb1.", XRC(63,38,1), XRARB_MASK, PPC|POWER, { BT } },
2634
2635{ "fneg", XRC(63,40,0), XRA_MASK, PPC|POWER, { FRT, FRB } },
2636{ "fneg.", XRC(63,40,1), XRA_MASK, PPC|POWER, { FRT, FRB } },
2637
2638{ "mcrfs", X(63,64), XRB_MASK|(3<<21)|(3<<16), PPC|POWER, { BF, BFA } },
2639
2640{ "mtfsb0", XRC(63,70,0), XRARB_MASK, PPC|POWER, { BT } },
2641{ "mtfsb0.", XRC(63,70,1), XRARB_MASK, PPC|POWER, { BT } },
2642
2643{ "fmr", XRC(63,72,0), XRA_MASK, PPC|POWER, { FRT, FRB } },
2644{ "fmr.", XRC(63,72,1), XRA_MASK, PPC|POWER, { FRT, FRB } },
2645
2646{ "mtfsfi", XRC(63,134,0), XRA_MASK|(3<<21)|(1<<11), PPC|POWER, { BF, U } },
2647{ "mtfsfi.", XRC(63,134,1), XRA_MASK|(3<<21)|(1<<11), PPC|POWER, { BF, U } },
2648
2649{ "fnabs", XRC(63,136,0), XRA_MASK, PPC|POWER, { FRT, FRB } },
2650{ "fnabs.", XRC(63,136,1), XRA_MASK, PPC|POWER, { FRT, FRB } },
2651
2652{ "fabs", XRC(63,264,0), XRA_MASK, PPC|POWER, { FRT, FRB } },
2653{ "fabs.", XRC(63,264,1), XRA_MASK, PPC|POWER, { FRT, FRB } },
2654
2655{ "mffs", XRC(63,583,0), XRARB_MASK, PPC|POWER, { FRT } },
2656{ "mffs.", XRC(63,583,1), XRARB_MASK, PPC|POWER, { FRT } },
2657
2658{ "mtfsf", XFL(63,711,0), XFL_MASK, PPC|POWER, { FLM, FRB } },
2659{ "mtfsf.", XFL(63,711,1), XFL_MASK, PPC|POWER, { FLM, FRB } },
2660
2661{ "fctid", XRC(63,814,0), XRA_MASK, PPC|B64, { FRT, FRB } },
2662{ "fctid.", XRC(63,814,1), XRA_MASK, PPC|B64, { FRT, FRB } },
2663
2664{ "fctidz", XRC(63,815,0), XRA_MASK, PPC|B64, { FRT, FRB } },
2665{ "fctidz.", XRC(63,815,1), XRA_MASK, PPC|B64, { FRT, FRB } },
2666
2667{ "fcfid", XRC(63,846,0), XRA_MASK, PPC|B64, { FRT, FRB } },
2668{ "fcfid.", XRC(63,846,1), XRA_MASK, PPC|B64, { FRT, FRB } },
2669
2670};
2671
2672const int powerpc_num_opcodes =
2673 sizeof (powerpc_opcodes) / sizeof (powerpc_opcodes[0]);
2674
2675/* The macro table. This is only used by the assembler. */
2676
2677const struct powerpc_macro powerpc_macros[] = {
2678{ "extldi", 4, PPC|B64, "rldicr %0,%1,%3,(%2)-1" },
2679{ "extldi.", 4, PPC|B64, "rldicr. %0,%1,%3,(%2)-1" },
2680{ "extrdi", 4, PPC|B64, "rldicl %0,%1,(%2)+(%3),64-(%2)" },
2681{ "extrdi.", 4, PPC|B64, "rldicl. %0,%1,(%2)+(%3),64-(%2)" },
2682{ "insrdi", 4, PPC|B64, "rldimi %0,%1,64-((%2)+(%3)),%3" },
2683{ "insrdi.", 4, PPC|B64, "rldimi. %0,%1,64-((%2)+(%3)),%3" },
2684{ "rotrdi", 3, PPC|B64, "rldicl %0,%1,64-(%2),0" },
2685{ "rotrdi.", 3, PPC|B64, "rldicl. %0,%1,64-(%2),0" },
2686{ "sldi", 3, PPC|B64, "rldicr %0,%1,%2,63-(%2)" },
2687{ "sldi.", 3, PPC|B64, "rldicr. %0,%1,%2,63-(%2)" },
2688{ "srdi", 3, PPC|B64, "rldicl %0,%1,64-(%2),%2" },
2689{ "srdi.", 3, PPC|B64, "rldicl. %0,%1,64-(%2),%2" },
2690{ "clrrdi", 3, PPC|B64, "rldicr %0,%1,0,63-(%2)" },
2691{ "clrrdi.", 3, PPC|B64, "rldicr. %0,%1,0,63-(%2)" },
2692{ "clrlsldi",4, PPC|B64, "rldic %0,%1,%3,(%2)-(%3)" },
2693{ "clrlsldi.",4, PPC|B64, "rldic. %0,%1,%3,(%2)-(%3)" },
2694
2695{ "extlwi", 4, PPC, "rlwinm %0,%1,%3,0,(%2)-1" },
2696{ "extlwi.", 4, PPC, "rlwinm. %0,%1,%3,0,(%2)-1" },
2697{ "extrwi", 4, PPC, "rlwinm %0,%1,(%2)+(%3),32-(%2),31" },
2698{ "extrwi.", 4, PPC, "rlwinm. %0,%1,(%2)+(%3),32-(%2),31" },
2699{ "inslwi", 4, PPC, "rlwimi %0,%1,32-(%3),%3,(%2)+(%3)-1" },
2700{ "inslwi.", 4, PPC, "rlwimi. %0,%1,32-(%3),%3,(%2)+(%3)-1" },
2701{ "insrwi", 4, PPC, "rlwimi %0,%1,32-((%2)+(%3)),%3,(%2)+(%3)-1" },
2702{ "insrwi.", 4, PPC, "rlwimi. %0,%1,32-((%2)+(%3)),%3,(%2)+(%3)-1"},
2703{ "rotrwi", 3, PPC, "rlwinm %0,%1,32-(%2),0,31" },
2704{ "rotrwi.", 3, PPC, "rlwinm. %0,%1,32-(%2),0,31" },
2705{ "slwi", 3, PPC, "rlwinm %0,%1,%2,0,31-(%2)" },
2706{ "sli", 3, POWER, "rlinm %0,%1,%2,0,31-(%2)" },
2707{ "slwi.", 3, PPC, "rlwinm. %0,%1,%2,0,31-(%2)" },
2708{ "sli.", 3, POWER, "rlinm. %0,%1,%2,0,31-(%2)" },
2709{ "srwi", 3, PPC, "rlwinm %0,%1,32-(%2),%2,31" },
2710{ "sri", 3, POWER, "rlinm %0,%1,32-(%2),%2,31" },
2711{ "srwi.", 3, PPC, "rlwinm. %0,%1,32-(%2),%2,31" },
2712{ "sri.", 3, POWER, "rlinm. %0,%1,32-(%2),%2,31" },
2713{ "clrrwi", 3, PPC, "rlwinm %0,%1,0,0,31-(%2)" },
2714{ "clrrwi.", 3, PPC, "rlwinm. %0,%1,0,0,31-(%2)" },
2715{ "clrlslwi",4, PPC, "rlwinm %0,%1,%3,(%2)-(%3),31-(%3)" },
2716{ "clrlslwi.",4, PPC, "rlwinm. %0,%1,%3,(%2)-(%3),31-(%3)" },
2717
2718};
2719
2720const int powerpc_num_macros =
2721 sizeof (powerpc_macros) / sizeof (powerpc_macros[0]);
diff --git a/arch/ppc/xmon/ppc.h b/arch/ppc/xmon/ppc.h
new file mode 100644
index 000000000000..2345ecba1fe9
--- /dev/null
+++ b/arch/ppc/xmon/ppc.h
@@ -0,0 +1,240 @@
1/* ppc.h -- Header file for PowerPC opcode table
2 Copyright 1994 Free Software Foundation, Inc.
3 Written by Ian Lance Taylor, Cygnus Support
4
5This file is part of GDB, GAS, and the GNU binutils.
6
7GDB, GAS, and the GNU binutils are free software; you can redistribute
8them and/or modify them under the terms of the GNU General Public
9License as published by the Free Software Foundation; either version
101, or (at your option) any later version.
11
12GDB, GAS, and the GNU binutils are distributed in the hope that they
13will be useful, but WITHOUT ANY WARRANTY; without even the implied
14warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
15the GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with this file; see the file COPYING. If not, write to the Free
19Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
20
21#ifndef PPC_H
22#define PPC_H
23
24/* The opcode table is an array of struct powerpc_opcode. */
25
26struct powerpc_opcode
27{
28 /* The opcode name. */
29 const char *name;
30
31 /* The opcode itself. Those bits which will be filled in with
32 operands are zeroes. */
33 unsigned long opcode;
34
35 /* The opcode mask. This is used by the disassembler. This is a
36 mask containing ones indicating those bits which must match the
37 opcode field, and zeroes indicating those bits which need not
38 match (and are presumably filled in by operands). */
39 unsigned long mask;
40
41 /* One bit flags for the opcode. These are used to indicate which
42 specific processors support the instructions. The defined values
43 are listed below. */
44 unsigned long flags;
45
46 /* An array of operand codes. Each code is an index into the
47 operand table. They appear in the order which the operands must
48 appear in assembly code, and are terminated by a zero. */
49 unsigned char operands[8];
50};
51
52/* The table itself is sorted by major opcode number, and is otherwise
53 in the order in which the disassembler should consider
54 instructions. */
55extern const struct powerpc_opcode powerpc_opcodes[];
56extern const int powerpc_num_opcodes;
57
58/* Values defined for the flags field of a struct powerpc_opcode. */
59
60/* Opcode is defined for the PowerPC architecture. */
61#define PPC_OPCODE_PPC (01)
62
63/* Opcode is defined for the POWER (RS/6000) architecture. */
64#define PPC_OPCODE_POWER (02)
65
66/* Opcode is defined for the POWER2 (Rios 2) architecture. */
67#define PPC_OPCODE_POWER2 (04)
68
69/* Opcode is only defined on 32 bit architectures. */
70#define PPC_OPCODE_32 (010)
71
72/* Opcode is only defined on 64 bit architectures. */
73#define PPC_OPCODE_64 (020)
74
75/* Opcode is supported by the Motorola PowerPC 601 processor. The 601
76 is assumed to support all PowerPC (PPC_OPCODE_PPC) instructions,
77 but it also supports many additional POWER instructions. */
78#define PPC_OPCODE_601 (040)
79
80/* A macro to extract the major opcode from an instruction. */
81#define PPC_OP(i) (((i) >> 26) & 0x3f)
82
83/* The operands table is an array of struct powerpc_operand. */
84
85struct powerpc_operand
86{
87 /* The number of bits in the operand. */
88 int bits;
89
90 /* How far the operand is left shifted in the instruction. */
91 int shift;
92
93 /* Insertion function. This is used by the assembler. To insert an
94 operand value into an instruction, check this field.
95
96 If it is NULL, execute
97 i |= (op & ((1 << o->bits) - 1)) << o->shift;
98 (i is the instruction which we are filling in, o is a pointer to
99 this structure, and op is the opcode value; this assumes twos
100 complement arithmetic).
101
102 If this field is not NULL, then simply call it with the
103 instruction and the operand value. It will return the new value
104 of the instruction. If the ERRMSG argument is not NULL, then if
105 the operand value is illegal, *ERRMSG will be set to a warning
106 string (the operand will be inserted in any case). If the
107 operand value is legal, *ERRMSG will be unchanged (most operands
108 can accept any value). */
109 unsigned long (*insert) PARAMS ((unsigned long instruction, long op,
110 const char **errmsg));
111
112 /* Extraction function. This is used by the disassembler. To
113 extract this operand type from an instruction, check this field.
114
115 If it is NULL, compute
116 op = ((i) >> o->shift) & ((1 << o->bits) - 1);
117 if ((o->flags & PPC_OPERAND_SIGNED) != 0
118 && (op & (1 << (o->bits - 1))) != 0)
119 op -= 1 << o->bits;
120 (i is the instruction, o is a pointer to this structure, and op
121 is the result; this assumes twos complement arithmetic).
122
123 If this field is not NULL, then simply call it with the
124 instruction value. It will return the value of the operand. If
125 the INVALID argument is not NULL, *INVALID will be set to
126 non-zero if this operand type can not actually be extracted from
127 this operand (i.e., the instruction does not match). If the
128 operand is valid, *INVALID will not be changed. */
129 long (*extract) PARAMS ((unsigned long instruction, int *invalid));
130
131 /* One bit syntax flags. */
132 unsigned long flags;
133};
134
135/* Elements in the table are retrieved by indexing with values from
136 the operands field of the powerpc_opcodes table. */
137
138extern const struct powerpc_operand powerpc_operands[];
139
140/* Values defined for the flags field of a struct powerpc_operand. */
141
142/* This operand takes signed values. */
143#define PPC_OPERAND_SIGNED (01)
144
145/* This operand takes signed values, but also accepts a full positive
146 range of values when running in 32 bit mode. That is, if bits is
147 16, it takes any value from -0x8000 to 0xffff. In 64 bit mode,
148 this flag is ignored. */
149#define PPC_OPERAND_SIGNOPT (02)
150
151/* This operand does not actually exist in the assembler input. This
152 is used to support extended mnemonics such as mr, for which two
153 operands fields are identical. The assembler should call the
154 insert function with any op value. The disassembler should call
155 the extract function, ignore the return value, and check the value
156 placed in the valid argument. */
157#define PPC_OPERAND_FAKE (04)
158
159/* The next operand should be wrapped in parentheses rather than
160 separated from this one by a comma. This is used for the load and
161 store instructions which want their operands to look like
162 reg,displacement(reg)
163 */
164#define PPC_OPERAND_PARENS (010)
165
166/* This operand may use the symbolic names for the CR fields, which
167 are
168 lt 0 gt 1 eq 2 so 3 un 3
169 cr0 0 cr1 1 cr2 2 cr3 3
170 cr4 4 cr5 5 cr6 6 cr7 7
171 These may be combined arithmetically, as in cr2*4+gt. These are
172 only supported on the PowerPC, not the POWER. */
173#define PPC_OPERAND_CR (020)
174
175/* This operand names a register. The disassembler uses this to print
176 register names with a leading 'r'. */
177#define PPC_OPERAND_GPR (040)
178
179/* This operand names a floating point register. The disassembler
180 prints these with a leading 'f'. */
181#define PPC_OPERAND_FPR (0100)
182
183/* This operand is a relative branch displacement. The disassembler
184 prints these symbolically if possible. */
185#define PPC_OPERAND_RELATIVE (0200)
186
187/* This operand is an absolute branch address. The disassembler
188 prints these symbolically if possible. */
189#define PPC_OPERAND_ABSOLUTE (0400)
190
191/* This operand is optional, and is zero if omitted. This is used for
192 the optional BF and L fields in the comparison instructions. The
193 assembler must count the number of operands remaining on the line,
194 and the number of operands remaining for the opcode, and decide
195 whether this operand is present or not. The disassembler should
196 print this operand out only if it is not zero. */
197#define PPC_OPERAND_OPTIONAL (01000)
198
199/* This flag is only used with PPC_OPERAND_OPTIONAL. If this operand
200 is omitted, then for the next operand use this operand value plus
201 1, ignoring the next operand field for the opcode. This wretched
202 hack is needed because the Power rotate instructions can take
203 either 4 or 5 operands. The disassembler should print this operand
204 out regardless of the PPC_OPERAND_OPTIONAL field. */
205#define PPC_OPERAND_NEXT (02000)
206
207/* This operand should be regarded as a negative number for the
208 purposes of overflow checking (i.e., the normal most negative
209 number is disallowed and one more than the normal most positive
210 number is allowed). This flag will only be set for a signed
211 operand. */
212#define PPC_OPERAND_NEGATIVE (04000)
213
214/* The POWER and PowerPC assemblers use a few macros. We keep them
215 with the operands table for simplicity. The macro table is an
216 array of struct powerpc_macro. */
217
218struct powerpc_macro
219{
220 /* The macro name. */
221 const char *name;
222
223 /* The number of operands the macro takes. */
224 unsigned int operands;
225
226 /* One bit flags for the opcode. These are used to indicate which
227 specific processors support the instructions. The values are the
228 same as those for the struct powerpc_opcode flags field. */
229 unsigned long flags;
230
231 /* A format string to turn the macro into a normal instruction.
232 Each %N in the string is replaced with operand number N (zero
233 based). */
234 const char *format;
235};
236
237extern const struct powerpc_macro powerpc_macros[];
238extern const int powerpc_num_macros;
239
240#endif /* PPC_H */
diff --git a/arch/ppc/xmon/privinst.h b/arch/ppc/xmon/privinst.h
new file mode 100644
index 000000000000..93978c027ca0
--- /dev/null
+++ b/arch/ppc/xmon/privinst.h
@@ -0,0 +1,91 @@
1/*
2 * Copyright (C) 1996 Paul Mackerras.
3 */
4#include <linux/config.h>
5
6#define GETREG(reg) \
7 static inline int get_ ## reg (void) \
8 { int ret; asm volatile ("mf" #reg " %0" : "=r" (ret) :); return ret; }
9
10#define SETREG(reg) \
11 static inline void set_ ## reg (int val) \
12 { asm volatile ("mt" #reg " %0" : : "r" (val)); }
13
14GETREG(msr)
15SETREG(msr)
16GETREG(cr)
17
18#define GSETSPR(n, name) \
19 static inline int get_ ## name (void) \
20 { int ret; asm volatile ("mfspr %0," #n : "=r" (ret) : ); return ret; } \
21 static inline void set_ ## name (int val) \
22 { asm volatile ("mtspr " #n ",%0" : : "r" (val)); }
23
24GSETSPR(0, mq)
25GSETSPR(1, xer)
26GSETSPR(4, rtcu)
27GSETSPR(5, rtcl)
28GSETSPR(8, lr)
29GSETSPR(9, ctr)
30GSETSPR(18, dsisr)
31GSETSPR(19, dar)
32GSETSPR(22, dec)
33GSETSPR(25, sdr1)
34GSETSPR(26, srr0)
35GSETSPR(27, srr1)
36GSETSPR(272, sprg0)
37GSETSPR(273, sprg1)
38GSETSPR(274, sprg2)
39GSETSPR(275, sprg3)
40GSETSPR(282, ear)
41GSETSPR(287, pvr)
42#ifndef CONFIG_8xx
43GSETSPR(528, bat0u)
44GSETSPR(529, bat0l)
45GSETSPR(530, bat1u)
46GSETSPR(531, bat1l)
47GSETSPR(532, bat2u)
48GSETSPR(533, bat2l)
49GSETSPR(534, bat3u)
50GSETSPR(535, bat3l)
51GSETSPR(1008, hid0)
52GSETSPR(1009, hid1)
53GSETSPR(1010, iabr)
54GSETSPR(1013, dabr)
55GSETSPR(1023, pir)
56#else
57GSETSPR(144, cmpa)
58GSETSPR(145, cmpb)
59GSETSPR(146, cmpc)
60GSETSPR(147, cmpd)
61GSETSPR(158, ictrl)
62#endif
63
64static inline int get_sr(int n)
65{
66 int ret;
67
68 asm (" mfsrin %0,%1" : "=r" (ret) : "r" (n << 28));
69 return ret;
70}
71
72static inline void set_sr(int n, int val)
73{
74 asm ("mtsrin %0,%1" : : "r" (val), "r" (n << 28));
75}
76
77static inline void store_inst(void *p)
78{
79 asm volatile ("dcbst 0,%0; sync; icbi 0,%0; isync" : : "r" (p));
80}
81
82static inline void cflush(void *p)
83{
84 asm volatile ("dcbf 0,%0; icbi 0,%0" : : "r" (p));
85}
86
87static inline void cinval(void *p)
88{
89 asm volatile ("dcbi 0,%0; icbi 0,%0" : : "r" (p));
90}
91
diff --git a/arch/ppc/xmon/setjmp.c b/arch/ppc/xmon/setjmp.c
new file mode 100644
index 000000000000..28352bac2ae6
--- /dev/null
+++ b/arch/ppc/xmon/setjmp.c
@@ -0,0 +1,29 @@
1/*
2 * Copyright (C) 1996 Paul Mackerras.
3 *
4 * NB this file must be compiled with -O2.
5 */
6
7int
8xmon_setjmp(long *buf)
9{
10 asm ("mflr 0; stw 0,0(%0);"
11 "stw 1,4(%0); stw 2,8(%0);"
12 "mfcr 0; stw 0,12(%0);"
13 "stmw 13,16(%0)"
14 : : "r" (buf));
15 /* XXX should save fp regs as well */
16 return 0;
17}
18
19void
20xmon_longjmp(long *buf, int val)
21{
22 if (val == 0)
23 val = 1;
24 asm ("lmw 13,16(%0);"
25 "lwz 0,12(%0); mtcrf 0x38,0;"
26 "lwz 0,0(%0); lwz 1,4(%0); lwz 2,8(%0);"
27 "mtlr 0; mr 3,%1"
28 : : "r" (buf), "r" (val));
29}
diff --git a/arch/ppc/xmon/start.c b/arch/ppc/xmon/start.c
new file mode 100644
index 000000000000..507d4eeffe07
--- /dev/null
+++ b/arch/ppc/xmon/start.c
@@ -0,0 +1,646 @@
1/*
2 * Copyright (C) 1996 Paul Mackerras.
3 */
4#include <linux/config.h>
5#include <linux/string.h>
6#include <asm/machdep.h>
7#include <asm/io.h>
8#include <asm/page.h>
9#include <linux/adb.h>
10#include <linux/pmu.h>
11#include <linux/cuda.h>
12#include <linux/kernel.h>
13#include <linux/errno.h>
14#include <linux/sysrq.h>
15#include <linux/bitops.h>
16#include <asm/xmon.h>
17#include <asm/prom.h>
18#include <asm/bootx.h>
19#include <asm/machdep.h>
20#include <asm/errno.h>
21#include <asm/pmac_feature.h>
22#include <asm/processor.h>
23#include <asm/delay.h>
24#include <asm/btext.h>
25
26static volatile unsigned char *sccc, *sccd;
27unsigned int TXRDY, RXRDY, DLAB;
28static int xmon_expect(const char *str, unsigned int timeout);
29
30static int use_serial;
31static int use_screen;
32static int via_modem;
33static int xmon_use_sccb;
34static struct device_node *channel_node;
35
36#define TB_SPEED 25000000
37
38static inline unsigned int readtb(void)
39{
40 unsigned int ret;
41
42 asm volatile("mftb %0" : "=r" (ret) :);
43 return ret;
44}
45
46void buf_access(void)
47{
48 if (DLAB)
49 sccd[3] &= ~DLAB; /* reset DLAB */
50}
51
52extern int adb_init(void);
53
54#ifdef CONFIG_PPC_CHRP
55/*
56 * This looks in the "ranges" property for the primary PCI host bridge
57 * to find the physical address of the start of PCI/ISA I/O space.
58 * It is basically a cut-down version of pci_process_bridge_OF_ranges.
59 */
60static unsigned long chrp_find_phys_io_base(void)
61{
62 struct device_node *node;
63 unsigned int *ranges;
64 unsigned long base = CHRP_ISA_IO_BASE;
65 int rlen = 0;
66 int np;
67
68 node = find_devices("isa");
69 if (node != NULL) {
70 node = node->parent;
71 if (node == NULL || node->type == NULL
72 || strcmp(node->type, "pci") != 0)
73 node = NULL;
74 }
75 if (node == NULL)
76 node = find_devices("pci");
77 if (node == NULL)
78 return base;
79
80 ranges = (unsigned int *) get_property(node, "ranges", &rlen);
81 np = prom_n_addr_cells(node) + 5;
82 while ((rlen -= np * sizeof(unsigned int)) >= 0) {
83 if ((ranges[0] >> 24) == 1 && ranges[2] == 0) {
84 /* I/O space starting at 0, grab the phys base */
85 base = ranges[np - 3];
86 break;
87 }
88 ranges += np;
89 }
90 return base;
91}
92#endif /* CONFIG_PPC_CHRP */
93
94#ifdef CONFIG_MAGIC_SYSRQ
95static void sysrq_handle_xmon(int key, struct pt_regs *regs,
96 struct tty_struct *tty)
97{
98 xmon(regs);
99}
100
101static struct sysrq_key_op sysrq_xmon_op =
102{
103 .handler = sysrq_handle_xmon,
104 .help_msg = "Xmon",
105 .action_msg = "Entering xmon",
106};
107#endif
108
109void
110xmon_map_scc(void)
111{
112#ifdef CONFIG_PPC_MULTIPLATFORM
113 volatile unsigned char *base;
114
115 if (_machine == _MACH_Pmac) {
116 struct device_node *np;
117 unsigned long addr;
118#ifdef CONFIG_BOOTX_TEXT
119 if (!use_screen && !use_serial
120 && !machine_is_compatible("iMac")) {
121 /* see if there is a keyboard in the device tree
122 with a parent of type "adb" */
123 for (np = find_devices("keyboard"); np; np = np->next)
124 if (np->parent && np->parent->type
125 && strcmp(np->parent->type, "adb") == 0)
126 break;
127
128 /* needs to be hacked if xmon_printk is to be used
129 from within find_via_pmu() */
130#ifdef CONFIG_ADB_PMU
131 if (np != NULL && boot_text_mapped && find_via_pmu())
132 use_screen = 1;
133#endif
134#ifdef CONFIG_ADB_CUDA
135 if (np != NULL && boot_text_mapped && find_via_cuda())
136 use_screen = 1;
137#endif
138 }
139 if (!use_screen && (np = find_devices("escc")) != NULL) {
140 /*
141 * look for the device node for the serial port
142 * we're using and see if it says it has a modem
143 */
144 char *name = xmon_use_sccb? "ch-b": "ch-a";
145 char *slots;
146 int l;
147
148 np = np->child;
149 while (np != NULL && strcmp(np->name, name) != 0)
150 np = np->sibling;
151 if (np != NULL) {
152 /* XXX should parse this properly */
153 channel_node = np;
154 slots = get_property(np, "slot-names", &l);
155 if (slots != NULL && l >= 10
156 && strcmp(slots+4, "Modem") == 0)
157 via_modem = 1;
158 }
159 }
160 btext_drawstring("xmon uses ");
161 if (use_screen)
162 btext_drawstring("screen and keyboard\n");
163 else {
164 if (via_modem)
165 btext_drawstring("modem on ");
166 btext_drawstring(xmon_use_sccb? "printer": "modem");
167 btext_drawstring(" port\n");
168 }
169
170#endif /* CONFIG_BOOTX_TEXT */
171
172#ifdef CHRP_ESCC
173 addr = 0xc1013020;
174#else
175 addr = 0xf3013020;
176#endif
177 TXRDY = 4;
178 RXRDY = 1;
179
180 np = find_devices("mac-io");
181 if (np && np->n_addrs)
182 addr = np->addrs[0].address + 0x13020;
183 base = (volatile unsigned char *) ioremap(addr & PAGE_MASK, PAGE_SIZE);
184 sccc = base + (addr & ~PAGE_MASK);
185 sccd = sccc + 0x10;
186
187 } else {
188 base = (volatile unsigned char *) isa_io_base;
189 if (_machine == _MACH_chrp)
190 base = (volatile unsigned char *)
191 ioremap(chrp_find_phys_io_base(), 0x1000);
192
193 sccc = base + 0x3fd;
194 sccd = base + 0x3f8;
195 if (xmon_use_sccb) {
196 sccc -= 0x100;
197 sccd -= 0x100;
198 }
199 TXRDY = 0x20;
200 RXRDY = 1;
201 DLAB = 0x80;
202 }
203#elif defined(CONFIG_GEMINI)
204 /* should already be mapped by the kernel boot */
205 sccc = (volatile unsigned char *) 0xffeffb0d;
206 sccd = (volatile unsigned char *) 0xffeffb08;
207 TXRDY = 0x20;
208 RXRDY = 1;
209 DLAB = 0x80;
210#elif defined(CONFIG_405GP)
211 sccc = (volatile unsigned char *)0xef600305;
212 sccd = (volatile unsigned char *)0xef600300;
213 TXRDY = 0x20;
214 RXRDY = 1;
215 DLAB = 0x80;
216#endif /* platform */
217
218 register_sysrq_key('x', &sysrq_xmon_op);
219}
220
221static int scc_initialized = 0;
222
223void xmon_init_scc(void);
224extern void cuda_poll(void);
225
226static inline void do_poll_adb(void)
227{
228#ifdef CONFIG_ADB_PMU
229 if (sys_ctrler == SYS_CTRLER_PMU)
230 pmu_poll_adb();
231#endif /* CONFIG_ADB_PMU */
232#ifdef CONFIG_ADB_CUDA
233 if (sys_ctrler == SYS_CTRLER_CUDA)
234 cuda_poll();
235#endif /* CONFIG_ADB_CUDA */
236}
237
238int
239xmon_write(void *handle, void *ptr, int nb)
240{
241 char *p = ptr;
242 int i, c, ct;
243
244#ifdef CONFIG_SMP
245 static unsigned long xmon_write_lock;
246 int lock_wait = 1000000;
247 int locked;
248
249 while ((locked = test_and_set_bit(0, &xmon_write_lock)) != 0)
250 if (--lock_wait == 0)
251 break;
252#endif
253
254#ifdef CONFIG_BOOTX_TEXT
255 if (use_screen) {
256 /* write it on the screen */
257 for (i = 0; i < nb; ++i)
258 btext_drawchar(*p++);
259 goto out;
260 }
261#endif
262 if (!scc_initialized)
263 xmon_init_scc();
264 ct = 0;
265 for (i = 0; i < nb; ++i) {
266 while ((*sccc & TXRDY) == 0)
267 do_poll_adb();
268 c = p[i];
269 if (c == '\n' && !ct) {
270 c = '\r';
271 ct = 1;
272 --i;
273 } else {
274 ct = 0;
275 }
276 buf_access();
277 *sccd = c;
278 eieio();
279 }
280
281 out:
282#ifdef CONFIG_SMP
283 if (!locked)
284 clear_bit(0, &xmon_write_lock);
285#endif
286 return nb;
287}
288
289int xmon_wants_key;
290int xmon_adb_keycode;
291
292#ifdef CONFIG_BOOTX_TEXT
293static int xmon_adb_shiftstate;
294
295static unsigned char xmon_keytab[128] =
296 "asdfhgzxcv\000bqwer" /* 0x00 - 0x0f */
297 "yt123465=97-80]o" /* 0x10 - 0x1f */
298 "u[ip\rlj'k;\\,/nm." /* 0x20 - 0x2f */
299 "\t `\177\0\033\0\0\0\0\0\0\0\0\0\0" /* 0x30 - 0x3f */
300 "\0.\0*\0+\0\0\0\0\0/\r\0-\0" /* 0x40 - 0x4f */
301 "\0\0000123456789\0\0\0"; /* 0x50 - 0x5f */
302
303static unsigned char xmon_shift_keytab[128] =
304 "ASDFHGZXCV\000BQWER" /* 0x00 - 0x0f */
305 "YT!@#$^%+(&_*)}O" /* 0x10 - 0x1f */
306 "U{IP\rLJ\"K:|<?NM>" /* 0x20 - 0x2f */
307 "\t ~\177\0\033\0\0\0\0\0\0\0\0\0\0" /* 0x30 - 0x3f */
308 "\0.\0*\0+\0\0\0\0\0/\r\0-\0" /* 0x40 - 0x4f */
309 "\0\0000123456789\0\0\0"; /* 0x50 - 0x5f */
310
311static int
312xmon_get_adb_key(void)
313{
314 int k, t, on;
315
316 xmon_wants_key = 1;
317 for (;;) {
318 xmon_adb_keycode = -1;
319 t = 0;
320 on = 0;
321 do {
322 if (--t < 0) {
323 on = 1 - on;
324 btext_drawchar(on? 0xdb: 0x20);
325 btext_drawchar('\b');
326 t = 200000;
327 }
328 do_poll_adb();
329 } while (xmon_adb_keycode == -1);
330 k = xmon_adb_keycode;
331 if (on)
332 btext_drawstring(" \b");
333
334 /* test for shift keys */
335 if ((k & 0x7f) == 0x38 || (k & 0x7f) == 0x7b) {
336 xmon_adb_shiftstate = (k & 0x80) == 0;
337 continue;
338 }
339 if (k >= 0x80)
340 continue; /* ignore up transitions */
341 k = (xmon_adb_shiftstate? xmon_shift_keytab: xmon_keytab)[k];
342 if (k != 0)
343 break;
344 }
345 xmon_wants_key = 0;
346 return k;
347}
348#endif /* CONFIG_BOOTX_TEXT */
349
350int
351xmon_read(void *handle, void *ptr, int nb)
352{
353 char *p = ptr;
354 int i;
355
356#ifdef CONFIG_BOOTX_TEXT
357 if (use_screen) {
358 for (i = 0; i < nb; ++i)
359 *p++ = xmon_get_adb_key();
360 return i;
361 }
362#endif
363 if (!scc_initialized)
364 xmon_init_scc();
365 for (i = 0; i < nb; ++i) {
366 while ((*sccc & RXRDY) == 0)
367 do_poll_adb();
368 buf_access();
369 *p++ = *sccd;
370 }
371 return i;
372}
373
374int
375xmon_read_poll(void)
376{
377 if ((*sccc & RXRDY) == 0) {
378 do_poll_adb();
379 return -1;
380 }
381 buf_access();
382 return *sccd;
383}
384
385static unsigned char scc_inittab[] = {
386 13, 0, /* set baud rate divisor */
387 12, 1,
388 14, 1, /* baud rate gen enable, src=rtxc */
389 11, 0x50, /* clocks = br gen */
390 5, 0xea, /* tx 8 bits, assert DTR & RTS */
391 4, 0x46, /* x16 clock, 1 stop */
392 3, 0xc1, /* rx enable, 8 bits */
393};
394
395void
396xmon_init_scc(void)
397{
398 if ( _machine == _MACH_chrp )
399 {
400 sccd[3] = 0x83; eieio(); /* LCR = 8N1 + DLAB */
401 sccd[0] = 12; eieio(); /* DLL = 9600 baud */
402 sccd[1] = 0; eieio();
403 sccd[2] = 0; eieio(); /* FCR = 0 */
404 sccd[3] = 3; eieio(); /* LCR = 8N1 */
405 sccd[1] = 0; eieio(); /* IER = 0 */
406 }
407 else if ( _machine == _MACH_Pmac )
408 {
409 int i, x;
410
411 if (channel_node != 0)
412 pmac_call_feature(
413 PMAC_FTR_SCC_ENABLE,
414 channel_node,
415 PMAC_SCC_ASYNC | PMAC_SCC_FLAG_XMON, 1);
416 printk(KERN_INFO "Serial port locked ON by debugger !\n");
417 if (via_modem && channel_node != 0) {
418 unsigned int t0;
419
420 pmac_call_feature(
421 PMAC_FTR_MODEM_ENABLE,
422 channel_node, 0, 1);
423 printk(KERN_INFO "Modem powered up by debugger !\n");
424 t0 = readtb();
425 while (readtb() - t0 < 3*TB_SPEED)
426 eieio();
427 }
428 /* use the B channel if requested */
429 if (xmon_use_sccb) {
430 sccc = (volatile unsigned char *)
431 ((unsigned long)sccc & ~0x20);
432 sccd = sccc + 0x10;
433 }
434 for (i = 20000; i != 0; --i) {
435 x = *sccc; eieio();
436 }
437 *sccc = 9; eieio(); /* reset A or B side */
438 *sccc = ((unsigned long)sccc & 0x20)? 0x80: 0x40; eieio();
439 for (i = 0; i < sizeof(scc_inittab); ++i) {
440 *sccc = scc_inittab[i];
441 eieio();
442 }
443 }
444 scc_initialized = 1;
445 if (via_modem) {
446 for (;;) {
447 xmon_write(NULL, "ATE1V1\r", 7);
448 if (xmon_expect("OK", 5)) {
449 xmon_write(NULL, "ATA\r", 4);
450 if (xmon_expect("CONNECT", 40))
451 break;
452 }
453 xmon_write(NULL, "+++", 3);
454 xmon_expect("OK", 3);
455 }
456 }
457}
458
459#if 0
460extern int (*prom_entry)(void *);
461
462int
463xmon_exit(void)
464{
465 struct prom_args {
466 char *service;
467 } args;
468
469 for (;;) {
470 args.service = "exit";
471 (*prom_entry)(&args);
472 }
473}
474#endif
475
476void *xmon_stdin;
477void *xmon_stdout;
478void *xmon_stderr;
479
480void
481xmon_init(void)
482{
483}
484
485int
486xmon_putc(int c, void *f)
487{
488 char ch = c;
489
490 if (c == '\n')
491 xmon_putc('\r', f);
492 return xmon_write(f, &ch, 1) == 1? c: -1;
493}
494
495int
496xmon_putchar(int c)
497{
498 return xmon_putc(c, xmon_stdout);
499}
500
501int
502xmon_fputs(char *str, void *f)
503{
504 int n = strlen(str);
505
506 return xmon_write(f, str, n) == n? 0: -1;
507}
508
509int
510xmon_readchar(void)
511{
512 char ch;
513
514 for (;;) {
515 switch (xmon_read(xmon_stdin, &ch, 1)) {
516 case 1:
517 return ch;
518 case -1:
519 xmon_printf("read(stdin) returned -1\r\n", 0, 0);
520 return -1;
521 }
522 }
523}
524
525static char line[256];
526static char *lineptr;
527static int lineleft;
528
529int xmon_expect(const char *str, unsigned int timeout)
530{
531 int c;
532 unsigned int t0;
533
534 timeout *= TB_SPEED;
535 t0 = readtb();
536 do {
537 lineptr = line;
538 for (;;) {
539 c = xmon_read_poll();
540 if (c == -1) {
541 if (readtb() - t0 > timeout)
542 return 0;
543 continue;
544 }
545 if (c == '\n')
546 break;
547 if (c != '\r' && lineptr < &line[sizeof(line) - 1])
548 *lineptr++ = c;
549 }
550 *lineptr = 0;
551 } while (strstr(line, str) == NULL);
552 return 1;
553}
554
555int
556xmon_getchar(void)
557{
558 int c;
559
560 if (lineleft == 0) {
561 lineptr = line;
562 for (;;) {
563 c = xmon_readchar();
564 if (c == -1 || c == 4)
565 break;
566 if (c == '\r' || c == '\n') {
567 *lineptr++ = '\n';
568 xmon_putchar('\n');
569 break;
570 }
571 switch (c) {
572 case 0177:
573 case '\b':
574 if (lineptr > line) {
575 xmon_putchar('\b');
576 xmon_putchar(' ');
577 xmon_putchar('\b');
578 --lineptr;
579 }
580 break;
581 case 'U' & 0x1F:
582 while (lineptr > line) {
583 xmon_putchar('\b');
584 xmon_putchar(' ');
585 xmon_putchar('\b');
586 --lineptr;
587 }
588 break;
589 default:
590 if (lineptr >= &line[sizeof(line) - 1])
591 xmon_putchar('\a');
592 else {
593 xmon_putchar(c);
594 *lineptr++ = c;
595 }
596 }
597 }
598 lineleft = lineptr - line;
599 lineptr = line;
600 }
601 if (lineleft == 0)
602 return -1;
603 --lineleft;
604 return *lineptr++;
605}
606
607char *
608xmon_fgets(char *str, int nb, void *f)
609{
610 char *p;
611 int c;
612
613 for (p = str; p < str + nb - 1; ) {
614 c = xmon_getchar();
615 if (c == -1) {
616 if (p == str)
617 return NULL;
618 break;
619 }
620 *p++ = c;
621 if (c == '\n')
622 break;
623 }
624 *p = 0;
625 return str;
626}
627
628void
629xmon_enter(void)
630{
631#ifdef CONFIG_ADB_PMU
632 if (_machine == _MACH_Pmac) {
633 pmu_suspend();
634 }
635#endif
636}
637
638void
639xmon_leave(void)
640{
641#ifdef CONFIG_ADB_PMU
642 if (_machine == _MACH_Pmac) {
643 pmu_resume();
644 }
645#endif
646}
diff --git a/arch/ppc/xmon/start_8xx.c b/arch/ppc/xmon/start_8xx.c
new file mode 100644
index 000000000000..a48bd594cf61
--- /dev/null
+++ b/arch/ppc/xmon/start_8xx.c
@@ -0,0 +1,287 @@
1/*
2 * Copyright (C) 1996 Paul Mackerras.
3 * Copyright (C) 2000 Dan Malek.
4 * Quick hack of Paul's code to make XMON work on 8xx processors. Lots
5 * of assumptions, like the SMC1 is used, it has been initialized by the
6 * loader at some point, and we can just stuff and suck bytes.
7 * We rely upon the 8xx uart driver to support us, as the interface
8 * changes between boot up and operational phases of the kernel.
9 */
10#include <linux/string.h>
11#include <asm/machdep.h>
12#include <asm/io.h>
13#include <asm/page.h>
14#include <linux/kernel.h>
15#include <asm/8xx_immap.h>
16#include <asm/mpc8xx.h>
17#include <asm/commproc.h>
18
19extern void xmon_printf(const char *fmt, ...);
20extern int xmon_8xx_write(char *str, int nb);
21extern int xmon_8xx_read_poll(void);
22extern int xmon_8xx_read_char(void);
23void prom_drawhex(uint);
24void prom_drawstring(const char *str);
25
26static int use_screen = 1; /* default */
27
28#define TB_SPEED 25000000
29
30static inline unsigned int readtb(void)
31{
32 unsigned int ret;
33
34 asm volatile("mftb %0" : "=r" (ret) :);
35 return ret;
36}
37
38void buf_access(void)
39{
40}
41
42void
43xmon_map_scc(void)
44{
45
46 cpmp = (cpm8xx_t *)&(((immap_t *)IMAP_ADDR)->im_cpm);
47 use_screen = 0;
48
49 prom_drawstring("xmon uses serial port\n");
50}
51
52static int scc_initialized = 0;
53
54void xmon_init_scc(void);
55
56int
57xmon_write(void *handle, void *ptr, int nb)
58{
59 char *p = ptr;
60 int i, c, ct;
61
62 if (!scc_initialized)
63 xmon_init_scc();
64
65 return(xmon_8xx_write(ptr, nb));
66}
67
68int xmon_wants_key;
69
70int
71xmon_read(void *handle, void *ptr, int nb)
72{
73 char *p = ptr;
74 int i;
75
76 if (!scc_initialized)
77 xmon_init_scc();
78
79 for (i = 0; i < nb; ++i) {
80 *p++ = xmon_8xx_read_char();
81 }
82 return i;
83}
84
85int
86xmon_read_poll(void)
87{
88 return(xmon_8xx_read_poll());
89}
90
91void
92xmon_init_scc()
93{
94 scc_initialized = 1;
95}
96
97#if 0
98extern int (*prom_entry)(void *);
99
100int
101xmon_exit(void)
102{
103 struct prom_args {
104 char *service;
105 } args;
106
107 for (;;) {
108 args.service = "exit";
109 (*prom_entry)(&args);
110 }
111}
112#endif
113
114void *xmon_stdin;
115void *xmon_stdout;
116void *xmon_stderr;
117
118void
119xmon_init(void)
120{
121}
122
123int
124xmon_putc(int c, void *f)
125{
126 char ch = c;
127
128 if (c == '\n')
129 xmon_putc('\r', f);
130 return xmon_write(f, &ch, 1) == 1? c: -1;
131}
132
133int
134xmon_putchar(int c)
135{
136 return xmon_putc(c, xmon_stdout);
137}
138
139int
140xmon_fputs(char *str, void *f)
141{
142 int n = strlen(str);
143
144 return xmon_write(f, str, n) == n? 0: -1;
145}
146
147int
148xmon_readchar(void)
149{
150 char ch;
151
152 for (;;) {
153 switch (xmon_read(xmon_stdin, &ch, 1)) {
154 case 1:
155 return ch;
156 case -1:
157 xmon_printf("read(stdin) returned -1\r\n", 0, 0);
158 return -1;
159 }
160 }
161}
162
163static char line[256];
164static char *lineptr;
165static int lineleft;
166
167#if 0
168int xmon_expect(const char *str, unsigned int timeout)
169{
170 int c;
171 unsigned int t0;
172
173 timeout *= TB_SPEED;
174 t0 = readtb();
175 do {
176 lineptr = line;
177 for (;;) {
178 c = xmon_read_poll();
179 if (c == -1) {
180 if (readtb() - t0 > timeout)
181 return 0;
182 continue;
183 }
184 if (c == '\n')
185 break;
186 if (c != '\r' && lineptr < &line[sizeof(line) - 1])
187 *lineptr++ = c;
188 }
189 *lineptr = 0;
190 } while (strstr(line, str) == NULL);
191 return 1;
192}
193#endif
194
195int
196xmon_getchar(void)
197{
198 int c;
199
200 if (lineleft == 0) {
201 lineptr = line;
202 for (;;) {
203 c = xmon_readchar();
204 if (c == -1 || c == 4)
205 break;
206 if (c == '\r' || c == '\n') {
207 *lineptr++ = '\n';
208 xmon_putchar('\n');
209 break;
210 }
211 switch (c) {
212 case 0177:
213 case '\b':
214 if (lineptr > line) {
215 xmon_putchar('\b');
216 xmon_putchar(' ');
217 xmon_putchar('\b');
218 --lineptr;
219 }
220 break;
221 case 'U' & 0x1F:
222 while (lineptr > line) {
223 xmon_putchar('\b');
224 xmon_putchar(' ');
225 xmon_putchar('\b');
226 --lineptr;
227 }
228 break;
229 default:
230 if (lineptr >= &line[sizeof(line) - 1])
231 xmon_putchar('\a');
232 else {
233 xmon_putchar(c);
234 *lineptr++ = c;
235 }
236 }
237 }
238 lineleft = lineptr - line;
239 lineptr = line;
240 }
241 if (lineleft == 0)
242 return -1;
243 --lineleft;
244 return *lineptr++;
245}
246
247char *
248xmon_fgets(char *str, int nb, void *f)
249{
250 char *p;
251 int c;
252
253 for (p = str; p < str + nb - 1; ) {
254 c = xmon_getchar();
255 if (c == -1) {
256 if (p == str)
257 return 0;
258 break;
259 }
260 *p++ = c;
261 if (c == '\n')
262 break;
263 }
264 *p = 0;
265 return str;
266}
267
268void
269prom_drawhex(uint val)
270{
271 unsigned char buf[10];
272
273 int i;
274 for (i = 7; i >= 0; i--)
275 {
276 buf[i] = "0123456789abcdef"[val & 0x0f];
277 val >>= 4;
278 }
279 buf[8] = '\0';
280 xmon_fputs(buf, xmon_stdout);
281}
282
283void
284prom_drawstring(const char *str)
285{
286 xmon_fputs(str, xmon_stdout);
287}
diff --git a/arch/ppc/xmon/subr_prf.c b/arch/ppc/xmon/subr_prf.c
new file mode 100644
index 000000000000..126624f3f2ed
--- /dev/null
+++ b/arch/ppc/xmon/subr_prf.c
@@ -0,0 +1,55 @@
1/*
2 * Written by Cort Dougan to replace the version originally used
3 * by Paul Mackerras, which came from NetBSD and thus had copyright
4 * conflicts with Linux.
5 *
6 * This file makes liberal use of the standard linux utility
7 * routines to reduce the size of the binary. We assume we can
8 * trust some parts of Linux inside the debugger.
9 * -- Cort (cort@cs.nmt.edu)
10 *
11 * Copyright (C) 1999 Cort Dougan.
12 */
13
14#include <linux/kernel.h>
15#include <linux/string.h>
16#include <stdarg.h>
17#include "nonstdio.h"
18
19extern int xmon_write(void *, void *, int);
20
21void
22xmon_vfprintf(void *f, const char *fmt, va_list ap)
23{
24 static char xmon_buf[2048];
25 int n;
26
27 n = vsprintf(xmon_buf, fmt, ap);
28 xmon_write(f, xmon_buf, n);
29}
30
31void
32xmon_printf(const char *fmt, ...)
33{
34 va_list ap;
35
36 va_start(ap, fmt);
37 xmon_vfprintf(stdout, fmt, ap);
38 va_end(ap);
39}
40
41void
42xmon_fprintf(void *f, const char *fmt, ...)
43{
44 va_list ap;
45
46 va_start(ap, fmt);
47 xmon_vfprintf(f, fmt, ap);
48 va_end(ap);
49}
50
51void
52xmon_puts(char *s)
53{
54 xmon_write(stdout, s, strlen(s));
55}
diff --git a/arch/ppc/xmon/xmon.c b/arch/ppc/xmon/xmon.c
new file mode 100644
index 000000000000..8565f49b8b0b
--- /dev/null
+++ b/arch/ppc/xmon/xmon.c
@@ -0,0 +1,2008 @@
1/*
2 * Routines providing a simple monitor for use on the PowerMac.
3 *
4 * Copyright (C) 1996 Paul Mackerras.
5 */
6#include <linux/config.h>
7#include <linux/errno.h>
8#include <linux/sched.h>
9#include <linux/smp.h>
10#include <linux/interrupt.h>
11#include <linux/bitops.h>
12#include <asm/ptrace.h>
13#include <asm/string.h>
14#include <asm/prom.h>
15#include <asm/bootx.h>
16#include <asm/machdep.h>
17#include <asm/xmon.h>
18#ifdef CONFIG_PMAC_BACKLIGHT
19#include <asm/backlight.h>
20#endif
21#include "nonstdio.h"
22#include "privinst.h"
23
24#define scanhex xmon_scanhex
25#define skipbl xmon_skipbl
26
27#ifdef CONFIG_SMP
28static unsigned long cpus_in_xmon = 0;
29static unsigned long got_xmon = 0;
30static volatile int take_xmon = -1;
31#endif /* CONFIG_SMP */
32
33static unsigned adrs;
34static int size = 1;
35static unsigned ndump = 64;
36static unsigned nidump = 16;
37static unsigned ncsum = 4096;
38static int termch;
39
40static u_int bus_error_jmp[100];
41#define setjmp xmon_setjmp
42#define longjmp xmon_longjmp
43
44/* Breakpoint stuff */
45struct bpt {
46 unsigned address;
47 unsigned instr;
48 unsigned count;
49 unsigned char enabled;
50};
51
52#define NBPTS 16
53static struct bpt bpts[NBPTS];
54static struct bpt dabr;
55static struct bpt iabr;
56static unsigned bpinstr = 0x7fe00008; /* trap */
57
58/* Prototypes */
59extern void (*debugger_fault_handler)(struct pt_regs *);
60static int cmds(struct pt_regs *);
61static int mread(unsigned, void *, int);
62static int mwrite(unsigned, void *, int);
63static void handle_fault(struct pt_regs *);
64static void byterev(unsigned char *, int);
65static void memex(void);
66static int bsesc(void);
67static void dump(void);
68static void prdump(unsigned, int);
69#ifdef __MWERKS__
70static void prndump(unsigned, int);
71static int nvreadb(unsigned);
72#endif
73static int ppc_inst_dump(unsigned, int);
74void print_address(unsigned);
75static int getsp(void);
76static void dump_hash_table(void);
77static void backtrace(struct pt_regs *);
78static void excprint(struct pt_regs *);
79static void prregs(struct pt_regs *);
80static void memops(int);
81static void memlocate(void);
82static void memzcan(void);
83static void memdiffs(unsigned char *, unsigned char *, unsigned, unsigned);
84int skipbl(void);
85int scanhex(unsigned *valp);
86static void scannl(void);
87static int hexdigit(int);
88void getstring(char *, int);
89static void flush_input(void);
90static int inchar(void);
91static void take_input(char *);
92/* static void openforth(void); */
93static unsigned read_spr(int);
94static void write_spr(int, unsigned);
95static void super_regs(void);
96static void print_sysmap(void);
97static void sysmap_lookup(void);
98static void remove_bpts(void);
99static void insert_bpts(void);
100static struct bpt *at_breakpoint(unsigned pc);
101static void bpt_cmds(void);
102static void cacheflush(void);
103#ifdef CONFIG_SMP
104static void cpu_cmd(void);
105#endif /* CONFIG_SMP */
106static int pretty_print_addr(unsigned long addr);
107static void csum(void);
108#ifdef CONFIG_BOOTX_TEXT
109static void vidcmds(void);
110#endif
111static void bootcmds(void);
112static void proccall(void);
113static void printtime(void);
114
115extern int print_insn_big_powerpc(FILE *, unsigned long, unsigned);
116extern void printf(const char *fmt, ...);
117extern int putchar(int ch);
118extern int setjmp(u_int *);
119extern void longjmp(u_int *, int);
120
121extern void xmon_enter(void);
122extern void xmon_leave(void);
123extern char* xmon_find_symbol(unsigned long addr, unsigned long* saddr);
124extern unsigned long xmon_symbol_to_addr(char* symbol);
125
126static unsigned start_tb[NR_CPUS][2];
127static unsigned stop_tb[NR_CPUS][2];
128
129#define GETWORD(v) (((v)[0] << 24) + ((v)[1] << 16) + ((v)[2] << 8) + (v)[3])
130
131#define isxdigit(c) (('0' <= (c) && (c) <= '9') \
132 || ('a' <= (c) && (c) <= 'f') \
133 || ('A' <= (c) && (c) <= 'F'))
134#define isalnum(c) (('0' <= (c) && (c) <= '9') \
135 || ('a' <= (c) && (c) <= 'z') \
136 || ('A' <= (c) && (c) <= 'Z'))
137#define isspace(c) (c == ' ' || c == '\t' || c == 10 || c == 13 || c == 0)
138
139static char *help_string = "\
140Commands:\n\
141 d dump bytes\n\
142 di dump instructions\n\
143 df dump float values\n\
144 dd dump double values\n\
145 e print exception information\n\
146 h dump hash table\n\
147 m examine/change memory\n\
148 mm move a block of memory\n\
149 ms set a block of memory\n\
150 md compare two blocks of memory\n\
151 M print System.map\n\
152 r print registers\n\
153 S print special registers\n\
154 t print backtrace\n\
155 la lookup address in system.map\n\
156 ls lookup symbol in system.map\n\
157 x exit monitor\n\
158";
159
160static int xmon_trace[NR_CPUS];
161#define SSTEP 1 /* stepping because of 's' command */
162#define BRSTEP 2 /* stepping over breakpoint */
163
164static struct pt_regs *xmon_regs[NR_CPUS];
165
166extern inline void sync(void)
167{
168 asm volatile("sync; isync");
169}
170
171extern inline void __delay(unsigned int loops)
172{
173 if (loops != 0)
174 __asm__ __volatile__("mtctr %0; 1: bdnz 1b" : :
175 "r" (loops) : "ctr");
176}
177
178static void get_tb(unsigned *p)
179{
180 unsigned hi, lo, hiagain;
181
182 if ((get_pvr() >> 16) == 1)
183 return;
184
185 do {
186 asm volatile("mftbu %0; mftb %1; mftbu %2"
187 : "=r" (hi), "=r" (lo), "=r" (hiagain));
188 } while (hi != hiagain);
189 p[0] = hi;
190 p[1] = lo;
191}
192
193void
194xmon(struct pt_regs *excp)
195{
196 struct pt_regs regs;
197 int msr, cmd;
198
199 get_tb(stop_tb[smp_processor_id()]);
200 if (excp == NULL) {
201 asm volatile ("stw 0,0(%0)\n\
202 lwz 0,0(1)\n\
203 stw 0,4(%0)\n\
204 stmw 2,8(%0)" : : "b" (&regs));
205 regs.nip = regs.link = ((unsigned long *)regs.gpr[1])[1];
206 regs.msr = get_msr();
207 regs.ctr = get_ctr();
208 regs.xer = get_xer();
209 regs.ccr = get_cr();
210 regs.trap = 0;
211 excp = &regs;
212 }
213
214 msr = get_msr();
215 set_msr(msr & ~0x8000); /* disable interrupts */
216 xmon_regs[smp_processor_id()] = excp;
217 xmon_enter();
218 excprint(excp);
219#ifdef CONFIG_SMP
220 if (test_and_set_bit(smp_processor_id(), &cpus_in_xmon))
221 for (;;)
222 ;
223 while (test_and_set_bit(0, &got_xmon)) {
224 if (take_xmon == smp_processor_id()) {
225 take_xmon = -1;
226 break;
227 }
228 }
229 /*
230 * XXX: breakpoints are removed while any cpu is in xmon
231 */
232#endif /* CONFIG_SMP */
233 remove_bpts();
234#ifdef CONFIG_PMAC_BACKLIGHT
235 if( setjmp(bus_error_jmp) == 0 ) {
236 debugger_fault_handler = handle_fault;
237 sync();
238 set_backlight_enable(1);
239 set_backlight_level(BACKLIGHT_MAX);
240 sync();
241 }
242 debugger_fault_handler = NULL;
243#endif /* CONFIG_PMAC_BACKLIGHT */
244 cmd = cmds(excp);
245 if (cmd == 's') {
246 xmon_trace[smp_processor_id()] = SSTEP;
247 excp->msr |= 0x400;
248 } else if (at_breakpoint(excp->nip)) {
249 xmon_trace[smp_processor_id()] = BRSTEP;
250 excp->msr |= 0x400;
251 } else {
252 xmon_trace[smp_processor_id()] = 0;
253 insert_bpts();
254 }
255 xmon_leave();
256 xmon_regs[smp_processor_id()] = NULL;
257#ifdef CONFIG_SMP
258 clear_bit(0, &got_xmon);
259 clear_bit(smp_processor_id(), &cpus_in_xmon);
260#endif /* CONFIG_SMP */
261 set_msr(msr); /* restore interrupt enable */
262 get_tb(start_tb[smp_processor_id()]);
263}
264
265irqreturn_t
266xmon_irq(int irq, void *d, struct pt_regs *regs)
267{
268 unsigned long flags;
269 local_irq_save(flags);
270 printf("Keyboard interrupt\n");
271 xmon(regs);
272 local_irq_restore(flags);
273 return IRQ_HANDLED;
274}
275
276int
277xmon_bpt(struct pt_regs *regs)
278{
279 struct bpt *bp;
280
281 bp = at_breakpoint(regs->nip);
282 if (!bp)
283 return 0;
284 if (bp->count) {
285 --bp->count;
286 remove_bpts();
287 excprint(regs);
288 xmon_trace[smp_processor_id()] = BRSTEP;
289 regs->msr |= 0x400;
290 } else {
291 xmon(regs);
292 }
293 return 1;
294}
295
296int
297xmon_sstep(struct pt_regs *regs)
298{
299 if (!xmon_trace[smp_processor_id()])
300 return 0;
301 if (xmon_trace[smp_processor_id()] == BRSTEP) {
302 xmon_trace[smp_processor_id()] = 0;
303 insert_bpts();
304 } else {
305 xmon(regs);
306 }
307 return 1;
308}
309
310int
311xmon_dabr_match(struct pt_regs *regs)
312{
313 if (dabr.enabled && dabr.count) {
314 --dabr.count;
315 remove_bpts();
316 excprint(regs);
317 xmon_trace[smp_processor_id()] = BRSTEP;
318 regs->msr |= 0x400;
319 } else {
320 dabr.instr = regs->nip;
321 xmon(regs);
322 }
323 return 1;
324}
325
326int
327xmon_iabr_match(struct pt_regs *regs)
328{
329 if (iabr.enabled && iabr.count) {
330 --iabr.count;
331 remove_bpts();
332 excprint(regs);
333 xmon_trace[smp_processor_id()] = BRSTEP;
334 regs->msr |= 0x400;
335 } else {
336 xmon(regs);
337 }
338 return 1;
339}
340
341static struct bpt *
342at_breakpoint(unsigned pc)
343{
344 int i;
345 struct bpt *bp;
346
347 if (dabr.enabled && pc == dabr.instr)
348 return &dabr;
349 if (iabr.enabled && pc == iabr.address)
350 return &iabr;
351 bp = bpts;
352 for (i = 0; i < NBPTS; ++i, ++bp)
353 if (bp->enabled && pc == bp->address)
354 return bp;
355 return NULL;
356}
357
358static void
359insert_bpts(void)
360{
361 int i;
362 struct bpt *bp;
363
364 bp = bpts;
365 for (i = 0; i < NBPTS; ++i, ++bp) {
366 if (!bp->enabled)
367 continue;
368 if (mread(bp->address, &bp->instr, 4) != 4
369 || mwrite(bp->address, &bpinstr, 4) != 4) {
370 printf("Couldn't insert breakpoint at %x, disabling\n",
371 bp->address);
372 bp->enabled = 0;
373 }
374 store_inst((void *) bp->address);
375 }
376#if !defined(CONFIG_8xx)
377 if (dabr.enabled)
378 set_dabr(dabr.address);
379 if (iabr.enabled)
380 set_iabr(iabr.address);
381#endif
382}
383
384static void
385remove_bpts(void)
386{
387 int i;
388 struct bpt *bp;
389 unsigned instr;
390
391#if !defined(CONFIG_8xx)
392 set_dabr(0);
393 set_iabr(0);
394#endif
395 bp = bpts;
396 for (i = 0; i < NBPTS; ++i, ++bp) {
397 if (!bp->enabled)
398 continue;
399 if (mread(bp->address, &instr, 4) == 4
400 && instr == bpinstr
401 && mwrite(bp->address, &bp->instr, 4) != 4)
402 printf("Couldn't remove breakpoint at %x\n",
403 bp->address);
404 store_inst((void *) bp->address);
405 }
406}
407
408static char *last_cmd;
409
410/* Command interpreting routine */
411static int
412cmds(struct pt_regs *excp)
413{
414 int cmd;
415
416 last_cmd = NULL;
417 for(;;) {
418#ifdef CONFIG_SMP
419 printf("%d:", smp_processor_id());
420#endif /* CONFIG_SMP */
421 printf("mon> ");
422 fflush(stdout);
423 flush_input();
424 termch = 0;
425 cmd = skipbl();
426 if( cmd == '\n' ) {
427 if (last_cmd == NULL)
428 continue;
429 take_input(last_cmd);
430 last_cmd = NULL;
431 cmd = inchar();
432 }
433 switch (cmd) {
434 case 'm':
435 cmd = inchar();
436 switch (cmd) {
437 case 'm':
438 case 's':
439 case 'd':
440 memops(cmd);
441 break;
442 case 'l':
443 memlocate();
444 break;
445 case 'z':
446 memzcan();
447 break;
448 default:
449 termch = cmd;
450 memex();
451 }
452 break;
453 case 'd':
454 dump();
455 break;
456 case 'l':
457 sysmap_lookup();
458 break;
459 case 'r':
460 if (excp != NULL)
461 prregs(excp); /* print regs */
462 break;
463 case 'e':
464 if (excp == NULL)
465 printf("No exception information\n");
466 else
467 excprint(excp);
468 break;
469 case 'M':
470 print_sysmap();
471 break;
472 case 'S':
473 super_regs();
474 break;
475 case 't':
476 backtrace(excp);
477 break;
478 case 'f':
479 cacheflush();
480 break;
481 case 'h':
482 dump_hash_table();
483 break;
484 case 's':
485 case 'x':
486 case EOF:
487 return cmd;
488 case '?':
489 printf(help_string);
490 break;
491 default:
492 printf("Unrecognized command: ");
493 if( ' ' < cmd && cmd <= '~' )
494 putchar(cmd);
495 else
496 printf("\\x%x", cmd);
497 printf(" (type ? for help)\n");
498 break;
499 case 'b':
500 bpt_cmds();
501 break;
502 case 'C':
503 csum();
504 break;
505#ifdef CONFIG_SMP
506 case 'c':
507 cpu_cmd();
508 break;
509#endif /* CONFIG_SMP */
510#ifdef CONFIG_BOOTX_TEXT
511 case 'v':
512 vidcmds();
513 break;
514#endif
515 case 'z':
516 bootcmds();
517 break;
518 case 'p':
519 proccall();
520 break;
521 case 'T':
522 printtime();
523 break;
524 }
525 }
526}
527
528extern unsigned tb_to_us;
529
530#define mulhwu(x,y) \
531({unsigned z; asm ("mulhwu %0,%1,%2" : "=r" (z) : "r" (x), "r" (y)); z;})
532
533static void printtime(void)
534{
535 unsigned int delta;
536
537 delta = stop_tb[smp_processor_id()][1]
538 - start_tb[smp_processor_id()][1];
539 delta = mulhwu(tb_to_us, delta);
540 printf("%u.%06u seconds\n", delta / 1000000, delta % 1000000);
541}
542
543static void bootcmds(void)
544{
545 int cmd;
546
547 cmd = inchar();
548 if (cmd == 'r')
549 ppc_md.restart(NULL);
550 else if (cmd == 'h')
551 ppc_md.halt();
552 else if (cmd == 'p')
553 ppc_md.power_off();
554}
555
556#ifdef CONFIG_SMP
557static void cpu_cmd(void)
558{
559 unsigned cpu;
560 int timeout;
561 int cmd;
562
563 cmd = inchar();
564 if (cmd == 'i') {
565 /* interrupt other cpu(s) */
566 cpu = MSG_ALL_BUT_SELF;
567 if (scanhex(&cpu))
568 smp_send_xmon_break(cpu);
569 return;
570 }
571 termch = cmd;
572 if (!scanhex(&cpu)) {
573 /* print cpus waiting or in xmon */
574 printf("cpus stopped:");
575 for (cpu = 0; cpu < NR_CPUS; ++cpu) {
576 if (test_bit(cpu, &cpus_in_xmon)) {
577 printf(" %d", cpu);
578 if (cpu == smp_processor_id())
579 printf("*", cpu);
580 }
581 }
582 printf("\n");
583 return;
584 }
585 /* try to switch to cpu specified */
586 take_xmon = cpu;
587 timeout = 10000000;
588 while (take_xmon >= 0) {
589 if (--timeout == 0) {
590 /* yes there's a race here */
591 take_xmon = -1;
592 printf("cpu %u didn't take control\n", cpu);
593 return;
594 }
595 }
596 /* now have to wait to be given control back */
597 while (test_and_set_bit(0, &got_xmon)) {
598 if (take_xmon == smp_processor_id()) {
599 take_xmon = -1;
600 break;
601 }
602 }
603}
604#endif /* CONFIG_SMP */
605
606#ifdef CONFIG_BOOTX_TEXT
607extern boot_infos_t disp_bi;
608
609static void vidcmds(void)
610{
611 int c = inchar();
612 unsigned int val, w;
613 extern int boot_text_mapped;
614
615 if (!boot_text_mapped)
616 return;
617 if (c != '\n' && scanhex(&val)) {
618 switch (c) {
619 case 'd':
620 w = disp_bi.dispDeviceRowBytes
621 / (disp_bi.dispDeviceDepth >> 3);
622 disp_bi.dispDeviceDepth = val;
623 disp_bi.dispDeviceRowBytes = w * (val >> 3);
624 return;
625 case 'p':
626 disp_bi.dispDeviceRowBytes = val;
627 return;
628 case 'w':
629 disp_bi.dispDeviceRect[2] = val;
630 return;
631 case 'h':
632 disp_bi.dispDeviceRect[3] = val;
633 return;
634 }
635 }
636 printf("W = %d (0x%x) H = %d (0x%x) D = %d (0x%x) P = %d (0x%x)\n",
637 disp_bi.dispDeviceRect[2], disp_bi.dispDeviceRect[2],
638 disp_bi.dispDeviceRect[3], disp_bi.dispDeviceRect[3],
639 disp_bi.dispDeviceDepth, disp_bi.dispDeviceDepth,
640 disp_bi.dispDeviceRowBytes, disp_bi.dispDeviceRowBytes);
641}
642#endif /* CONFIG_BOOTX_TEXT */
643
644static unsigned short fcstab[256] = {
645 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf,
646 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7,
647 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e,
648 0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876,
649 0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd,
650 0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5,
651 0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c,
652 0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974,
653 0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb,
654 0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3,
655 0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a,
656 0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72,
657 0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9,
658 0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1,
659 0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738,
660 0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70,
661 0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7,
662 0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff,
663 0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036,
664 0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e,
665 0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5,
666 0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd,
667 0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134,
668 0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c,
669 0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3,
670 0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb,
671 0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232,
672 0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a,
673 0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1,
674 0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9,
675 0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330,
676 0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78
677};
678
679#define FCS(fcs, c) (((fcs) >> 8) ^ fcstab[((fcs) ^ (c)) & 0xff])
680
681static void
682csum(void)
683{
684 unsigned int i;
685 unsigned short fcs;
686 unsigned char v;
687
688 if (!scanhex(&adrs))
689 return;
690 if (!scanhex(&ncsum))
691 return;
692 fcs = 0xffff;
693 for (i = 0; i < ncsum; ++i) {
694 if (mread(adrs+i, &v, 1) == 0) {
695 printf("csum stopped at %x\n", adrs+i);
696 break;
697 }
698 fcs = FCS(fcs, v);
699 }
700 printf("%x\n", fcs);
701}
702
703static void
704bpt_cmds(void)
705{
706 int cmd;
707 unsigned a;
708 int mode, i;
709 struct bpt *bp;
710
711 cmd = inchar();
712 switch (cmd) {
713#if !defined(CONFIG_8xx)
714 case 'd':
715 mode = 7;
716 cmd = inchar();
717 if (cmd == 'r')
718 mode = 5;
719 else if (cmd == 'w')
720 mode = 6;
721 else
722 termch = cmd;
723 cmd = inchar();
724 if (cmd == 'p')
725 mode &= ~4;
726 else
727 termch = cmd;
728 dabr.address = 0;
729 dabr.count = 0;
730 dabr.enabled = scanhex(&dabr.address);
731 scanhex(&dabr.count);
732 if (dabr.enabled)
733 dabr.address = (dabr.address & ~7) | mode;
734 break;
735 case 'i':
736 cmd = inchar();
737 if (cmd == 'p')
738 mode = 2;
739 else
740 mode = 3;
741 iabr.address = 0;
742 iabr.count = 0;
743 iabr.enabled = scanhex(&iabr.address);
744 if (iabr.enabled)
745 iabr.address |= mode;
746 scanhex(&iabr.count);
747 break;
748#endif
749 case 'c':
750 if (!scanhex(&a)) {
751 /* clear all breakpoints */
752 for (i = 0; i < NBPTS; ++i)
753 bpts[i].enabled = 0;
754 iabr.enabled = 0;
755 dabr.enabled = 0;
756 printf("All breakpoints cleared\n");
757 } else {
758 bp = at_breakpoint(a);
759 if (bp == 0) {
760 printf("No breakpoint at %x\n", a);
761 } else {
762 bp->enabled = 0;
763 }
764 }
765 break;
766 default:
767 termch = cmd;
768 if (!scanhex(&a)) {
769 /* print all breakpoints */
770 printf("type address count\n");
771 if (dabr.enabled) {
772 printf("data %.8x %8x [", dabr.address & ~7,
773 dabr.count);
774 if (dabr.address & 1)
775 printf("r");
776 if (dabr.address & 2)
777 printf("w");
778 if (!(dabr.address & 4))
779 printf("p");
780 printf("]\n");
781 }
782 if (iabr.enabled)
783 printf("inst %.8x %8x\n", iabr.address & ~3,
784 iabr.count);
785 for (bp = bpts; bp < &bpts[NBPTS]; ++bp)
786 if (bp->enabled)
787 printf("trap %.8x %8x\n", bp->address,
788 bp->count);
789 break;
790 }
791 bp = at_breakpoint(a);
792 if (bp == 0) {
793 for (bp = bpts; bp < &bpts[NBPTS]; ++bp)
794 if (!bp->enabled)
795 break;
796 if (bp >= &bpts[NBPTS]) {
797 printf("Sorry, no free breakpoints\n");
798 break;
799 }
800 }
801 bp->enabled = 1;
802 bp->address = a;
803 bp->count = 0;
804 scanhex(&bp->count);
805 break;
806 }
807}
808
809static void
810backtrace(struct pt_regs *excp)
811{
812 unsigned sp;
813 unsigned stack[2];
814 struct pt_regs regs;
815 extern char ret_from_except, ret_from_except_full, ret_from_syscall;
816
817 printf("backtrace:\n");
818
819 if (excp != NULL)
820 sp = excp->gpr[1];
821 else
822 sp = getsp();
823 scanhex(&sp);
824 scannl();
825 for (; sp != 0; sp = stack[0]) {
826 if (mread(sp, stack, sizeof(stack)) != sizeof(stack))
827 break;
828 pretty_print_addr(stack[1]);
829 printf(" ");
830 if (stack[1] == (unsigned) &ret_from_except
831 || stack[1] == (unsigned) &ret_from_except_full
832 || stack[1] == (unsigned) &ret_from_syscall) {
833 if (mread(sp+16, &regs, sizeof(regs)) != sizeof(regs))
834 break;
835 printf("\nexception:%x [%x] %x ", regs.trap, sp+16,
836 regs.nip);
837 sp = regs.gpr[1];
838 if (mread(sp, stack, sizeof(stack)) != sizeof(stack))
839 break;
840 }
841 printf("\n");
842 }
843}
844
845int
846getsp(void)
847{
848 int x;
849
850 asm("mr %0,1" : "=r" (x) :);
851 return x;
852}
853
854void
855excprint(struct pt_regs *fp)
856{
857 int trap;
858
859#ifdef CONFIG_SMP
860 printf("cpu %d: ", smp_processor_id());
861#endif /* CONFIG_SMP */
862 printf("vector: %x at pc = ", fp->trap);
863 pretty_print_addr(fp->nip);
864 printf(", lr = ");
865 pretty_print_addr(fp->link);
866 printf("\nmsr = %x, sp = %x [%x]\n", fp->msr, fp->gpr[1], fp);
867 trap = TRAP(fp);
868 if (trap == 0x300 || trap == 0x600)
869 printf("dar = %x, dsisr = %x\n", fp->dar, fp->dsisr);
870 if (current)
871 printf("current = %x, pid = %d, comm = %s\n",
872 current, current->pid, current->comm);
873}
874
875void
876prregs(struct pt_regs *fp)
877{
878 int n;
879 unsigned base;
880
881 if (scanhex(&base))
882 fp = (struct pt_regs *) base;
883 for (n = 0; n < 32; ++n) {
884 printf("R%.2d = %.8x%s", n, fp->gpr[n],
885 (n & 3) == 3? "\n": " ");
886 if (n == 12 && !FULL_REGS(fp)) {
887 printf("\n");
888 break;
889 }
890 }
891 printf("pc = %.8x msr = %.8x lr = %.8x cr = %.8x\n",
892 fp->nip, fp->msr, fp->link, fp->ccr);
893 printf("ctr = %.8x xer = %.8x trap = %4x\n",
894 fp->ctr, fp->xer, fp->trap);
895}
896
897void
898cacheflush(void)
899{
900 int cmd;
901 unsigned nflush;
902
903 cmd = inchar();
904 if (cmd != 'i')
905 termch = cmd;
906 scanhex(&adrs);
907 if (termch != '\n')
908 termch = 0;
909 nflush = 1;
910 scanhex(&nflush);
911 nflush = (nflush + 31) / 32;
912 if (cmd != 'i') {
913 for (; nflush > 0; --nflush, adrs += 0x20)
914 cflush((void *) adrs);
915 } else {
916 for (; nflush > 0; --nflush, adrs += 0x20)
917 cinval((void *) adrs);
918 }
919}
920
921unsigned int
922read_spr(int n)
923{
924 unsigned int instrs[2];
925 int (*code)(void);
926
927 instrs[0] = 0x7c6002a6 + ((n & 0x1F) << 16) + ((n & 0x3e0) << 6);
928 instrs[1] = 0x4e800020;
929 store_inst(instrs);
930 store_inst(instrs+1);
931 code = (int (*)(void)) instrs;
932 return code();
933}
934
935void
936write_spr(int n, unsigned int val)
937{
938 unsigned int instrs[2];
939 int (*code)(unsigned int);
940
941 instrs[0] = 0x7c6003a6 + ((n & 0x1F) << 16) + ((n & 0x3e0) << 6);
942 instrs[1] = 0x4e800020;
943 store_inst(instrs);
944 store_inst(instrs+1);
945 code = (int (*)(unsigned int)) instrs;
946 code(val);
947}
948
949static unsigned int regno;
950extern char exc_prolog;
951extern char dec_exc;
952
953void
954print_sysmap(void)
955{
956 extern char *sysmap;
957 if ( sysmap ) {
958 printf("System.map: \n");
959 if( setjmp(bus_error_jmp) == 0 ) {
960 debugger_fault_handler = handle_fault;
961 sync();
962 xmon_puts(sysmap);
963 sync();
964 }
965 debugger_fault_handler = NULL;
966 }
967 else
968 printf("No System.map\n");
969}
970
971void
972super_regs(void)
973{
974 int i, cmd;
975 unsigned val;
976
977 cmd = skipbl();
978 if (cmd == '\n') {
979 printf("msr = %x, pvr = %x\n", get_msr(), get_pvr());
980 printf("sprg0-3 = %x %x %x %x\n", get_sprg0(), get_sprg1(),
981 get_sprg2(), get_sprg3());
982 printf("srr0 = %x, srr1 = %x\n", get_srr0(), get_srr1());
983#ifdef CONFIG_PPC_STD_MMU
984 printf("sr0-15 =");
985 for (i = 0; i < 16; ++i)
986 printf(" %x", get_sr(i));
987 printf("\n");
988#endif
989 asm("mr %0,1" : "=r" (i) :);
990 printf("sp = %x ", i);
991 asm("mr %0,2" : "=r" (i) :);
992 printf("toc = %x\n", i);
993 return;
994 }
995
996 scanhex(&regno);
997 switch (cmd) {
998 case 'w':
999 val = read_spr(regno);
1000 scanhex(&val);
1001 write_spr(regno, val);
1002 /* fall through */
1003 case 'r':
1004 printf("spr %x = %x\n", regno, read_spr(regno));
1005 break;
1006 case 's':
1007 val = get_sr(regno);
1008 scanhex(&val);
1009 set_sr(regno, val);
1010 break;
1011 case 'm':
1012 val = get_msr();
1013 scanhex(&val);
1014 set_msr(val);
1015 break;
1016 }
1017 scannl();
1018}
1019
1020#ifndef CONFIG_PPC_STD_MMU
1021static void
1022dump_hash_table(void)
1023{
1024 printf("This CPU doesn't have a hash table.\n");
1025}
1026#else
1027
1028#ifndef CONFIG_PPC64BRIDGE
1029static void
1030dump_hash_table_seg(unsigned seg, unsigned start, unsigned end)
1031{
1032 extern void *Hash;
1033 extern unsigned long Hash_size;
1034 unsigned *htab = Hash;
1035 unsigned hsize = Hash_size;
1036 unsigned v, hmask, va, last_va = 0;
1037 int found, last_found, i;
1038 unsigned *hg, w1, last_w2 = 0, last_va0 = 0;
1039
1040 last_found = 0;
1041 hmask = hsize / 64 - 1;
1042 va = start;
1043 start = (start >> 12) & 0xffff;
1044 end = (end >> 12) & 0xffff;
1045 for (v = start; v < end; ++v) {
1046 found = 0;
1047 hg = htab + (((v ^ seg) & hmask) * 16);
1048 w1 = 0x80000000 | (seg << 7) | (v >> 10);
1049 for (i = 0; i < 8; ++i, hg += 2) {
1050 if (*hg == w1) {
1051 found = 1;
1052 break;
1053 }
1054 }
1055 if (!found) {
1056 w1 ^= 0x40;
1057 hg = htab + ((~(v ^ seg) & hmask) * 16);
1058 for (i = 0; i < 8; ++i, hg += 2) {
1059 if (*hg == w1) {
1060 found = 1;
1061 break;
1062 }
1063 }
1064 }
1065 if (!(last_found && found && (hg[1] & ~0x180) == last_w2 + 4096)) {
1066 if (last_found) {
1067 if (last_va != last_va0)
1068 printf(" ... %x", last_va);
1069 printf("\n");
1070 }
1071 if (found) {
1072 printf("%x to %x", va, hg[1]);
1073 last_va0 = va;
1074 }
1075 last_found = found;
1076 }
1077 if (found) {
1078 last_w2 = hg[1] & ~0x180;
1079 last_va = va;
1080 }
1081 va += 4096;
1082 }
1083 if (last_found)
1084 printf(" ... %x\n", last_va);
1085}
1086
1087#else /* CONFIG_PPC64BRIDGE */
1088static void
1089dump_hash_table_seg(unsigned seg, unsigned start, unsigned end)
1090{
1091 extern void *Hash;
1092 extern unsigned long Hash_size;
1093 unsigned *htab = Hash;
1094 unsigned hsize = Hash_size;
1095 unsigned v, hmask, va, last_va;
1096 int found, last_found, i;
1097 unsigned *hg, w1, last_w2, last_va0;
1098
1099 last_found = 0;
1100 hmask = hsize / 128 - 1;
1101 va = start;
1102 start = (start >> 12) & 0xffff;
1103 end = (end >> 12) & 0xffff;
1104 for (v = start; v < end; ++v) {
1105 found = 0;
1106 hg = htab + (((v ^ seg) & hmask) * 32);
1107 w1 = 1 | (seg << 12) | ((v & 0xf800) >> 4);
1108 for (i = 0; i < 8; ++i, hg += 4) {
1109 if (hg[1] == w1) {
1110 found = 1;
1111 break;
1112 }
1113 }
1114 if (!found) {
1115 w1 ^= 2;
1116 hg = htab + ((~(v ^ seg) & hmask) * 32);
1117 for (i = 0; i < 8; ++i, hg += 4) {
1118 if (hg[1] == w1) {
1119 found = 1;
1120 break;
1121 }
1122 }
1123 }
1124 if (!(last_found && found && (hg[3] & ~0x180) == last_w2 + 4096)) {
1125 if (last_found) {
1126 if (last_va != last_va0)
1127 printf(" ... %x", last_va);
1128 printf("\n");
1129 }
1130 if (found) {
1131 printf("%x to %x", va, hg[3]);
1132 last_va0 = va;
1133 }
1134 last_found = found;
1135 }
1136 if (found) {
1137 last_w2 = hg[3] & ~0x180;
1138 last_va = va;
1139 }
1140 va += 4096;
1141 }
1142 if (last_found)
1143 printf(" ... %x\n", last_va);
1144}
1145#endif /* CONFIG_PPC64BRIDGE */
1146
1147static unsigned hash_ctx;
1148static unsigned hash_start;
1149static unsigned hash_end;
1150
1151static void
1152dump_hash_table(void)
1153{
1154 int seg;
1155 unsigned seg_start, seg_end;
1156
1157 hash_ctx = 0;
1158 hash_start = 0;
1159 hash_end = 0xfffff000;
1160 scanhex(&hash_ctx);
1161 scanhex(&hash_start);
1162 scanhex(&hash_end);
1163 printf("Mappings for context %x\n", hash_ctx);
1164 seg_start = hash_start;
1165 for (seg = hash_start >> 28; seg <= hash_end >> 28; ++seg) {
1166 seg_end = (seg << 28) | 0x0ffff000;
1167 if (seg_end > hash_end)
1168 seg_end = hash_end;
1169 dump_hash_table_seg((hash_ctx << 4) + (seg * 0x111),
1170 seg_start, seg_end);
1171 seg_start = seg_end + 0x1000;
1172 }
1173}
1174#endif /* CONFIG_PPC_STD_MMU */
1175
1176/*
1177 * Stuff for reading and writing memory safely
1178 */
1179
1180int
1181mread(unsigned adrs, void *buf, int size)
1182{
1183 volatile int n;
1184 char *p, *q;
1185
1186 n = 0;
1187 if( setjmp(bus_error_jmp) == 0 ){
1188 debugger_fault_handler = handle_fault;
1189 sync();
1190 p = (char *) adrs;
1191 q = (char *) buf;
1192 switch (size) {
1193 case 2: *(short *)q = *(short *)p; break;
1194 case 4: *(int *)q = *(int *)p; break;
1195 default:
1196 for( ; n < size; ++n ) {
1197 *q++ = *p++;
1198 sync();
1199 }
1200 }
1201 sync();
1202 /* wait a little while to see if we get a machine check */
1203 __delay(200);
1204 n = size;
1205 }
1206 debugger_fault_handler = NULL;
1207 return n;
1208}
1209
1210int
1211mwrite(unsigned adrs, void *buf, int size)
1212{
1213 volatile int n;
1214 char *p, *q;
1215
1216 n = 0;
1217 if( setjmp(bus_error_jmp) == 0 ){
1218 debugger_fault_handler = handle_fault;
1219 sync();
1220 p = (char *) adrs;
1221 q = (char *) buf;
1222 switch (size) {
1223 case 2: *(short *)p = *(short *)q; break;
1224 case 4: *(int *)p = *(int *)q; break;
1225 default:
1226 for( ; n < size; ++n ) {
1227 *p++ = *q++;
1228 sync();
1229 }
1230 }
1231 sync();
1232 n = size;
1233 } else {
1234 printf("*** Error writing address %x\n", adrs + n);
1235 }
1236 debugger_fault_handler = NULL;
1237 return n;
1238}
1239
1240static int fault_type;
1241static int fault_except;
1242static char *fault_chars[] = { "--", "**", "##" };
1243
1244static void
1245handle_fault(struct pt_regs *regs)
1246{
1247 fault_except = TRAP(regs);
1248 fault_type = TRAP(regs) == 0x200? 0: TRAP(regs) == 0x300? 1: 2;
1249 longjmp(bus_error_jmp, 1);
1250}
1251
1252#define SWAP(a, b, t) ((t) = (a), (a) = (b), (b) = (t))
1253
1254void
1255byterev(unsigned char *val, int size)
1256{
1257 int t;
1258
1259 switch (size) {
1260 case 2:
1261 SWAP(val[0], val[1], t);
1262 break;
1263 case 4:
1264 SWAP(val[0], val[3], t);
1265 SWAP(val[1], val[2], t);
1266 break;
1267 }
1268}
1269
1270static int brev;
1271static int mnoread;
1272
1273void
1274memex(void)
1275{
1276 int cmd, inc, i, nslash;
1277 unsigned n;
1278 unsigned char val[4];
1279
1280 last_cmd = "m\n";
1281 scanhex(&adrs);
1282 while ((cmd = skipbl()) != '\n') {
1283 switch( cmd ){
1284 case 'b': size = 1; break;
1285 case 'w': size = 2; break;
1286 case 'l': size = 4; break;
1287 case 'r': brev = !brev; break;
1288 case 'n': mnoread = 1; break;
1289 case '.': mnoread = 0; break;
1290 }
1291 }
1292 if( size <= 0 )
1293 size = 1;
1294 else if( size > 4 )
1295 size = 4;
1296 for(;;){
1297 if (!mnoread)
1298 n = mread(adrs, val, size);
1299 printf("%.8x%c", adrs, brev? 'r': ' ');
1300 if (!mnoread) {
1301 if (brev)
1302 byterev(val, size);
1303 putchar(' ');
1304 for (i = 0; i < n; ++i)
1305 printf("%.2x", val[i]);
1306 for (; i < size; ++i)
1307 printf("%s", fault_chars[fault_type]);
1308 }
1309 putchar(' ');
1310 inc = size;
1311 nslash = 0;
1312 for(;;){
1313 if( scanhex(&n) ){
1314 for (i = 0; i < size; ++i)
1315 val[i] = n >> (i * 8);
1316 if (!brev)
1317 byterev(val, size);
1318 mwrite(adrs, val, size);
1319 inc = size;
1320 }
1321 cmd = skipbl();
1322 if (cmd == '\n')
1323 break;
1324 inc = 0;
1325 switch (cmd) {
1326 case '\'':
1327 for(;;){
1328 n = inchar();
1329 if( n == '\\' )
1330 n = bsesc();
1331 else if( n == '\'' )
1332 break;
1333 for (i = 0; i < size; ++i)
1334 val[i] = n >> (i * 8);
1335 if (!brev)
1336 byterev(val, size);
1337 mwrite(adrs, val, size);
1338 adrs += size;
1339 }
1340 adrs -= size;
1341 inc = size;
1342 break;
1343 case ',':
1344 adrs += size;
1345 break;
1346 case '.':
1347 mnoread = 0;
1348 break;
1349 case ';':
1350 break;
1351 case 'x':
1352 case EOF:
1353 scannl();
1354 return;
1355 case 'b':
1356 case 'v':
1357 size = 1;
1358 break;
1359 case 'w':
1360 size = 2;
1361 break;
1362 case 'l':
1363 size = 4;
1364 break;
1365 case '^':
1366 adrs -= size;
1367 break;
1368 break;
1369 case '/':
1370 if (nslash > 0)
1371 adrs -= 1 << nslash;
1372 else
1373 nslash = 0;
1374 nslash += 4;
1375 adrs += 1 << nslash;
1376 break;
1377 case '\\':
1378 if (nslash < 0)
1379 adrs += 1 << -nslash;
1380 else
1381 nslash = 0;
1382 nslash -= 4;
1383 adrs -= 1 << -nslash;
1384 break;
1385 case 'm':
1386 scanhex(&adrs);
1387 break;
1388 case 'n':
1389 mnoread = 1;
1390 break;
1391 case 'r':
1392 brev = !brev;
1393 break;
1394 case '<':
1395 n = size;
1396 scanhex(&n);
1397 adrs -= n;
1398 break;
1399 case '>':
1400 n = size;
1401 scanhex(&n);
1402 adrs += n;
1403 break;
1404 }
1405 }
1406 adrs += inc;
1407 }
1408}
1409
1410int
1411bsesc(void)
1412{
1413 int c;
1414
1415 c = inchar();
1416 switch( c ){
1417 case 'n': c = '\n'; break;
1418 case 'r': c = '\r'; break;
1419 case 'b': c = '\b'; break;
1420 case 't': c = '\t'; break;
1421 }
1422 return c;
1423}
1424
1425void
1426dump(void)
1427{
1428 int c;
1429
1430 c = inchar();
1431 if ((isxdigit(c) && c != 'f' && c != 'd') || c == '\n')
1432 termch = c;
1433 scanhex(&adrs);
1434 if( termch != '\n')
1435 termch = 0;
1436 if( c == 'i' ){
1437 scanhex(&nidump);
1438 if( nidump == 0 )
1439 nidump = 16;
1440 adrs += ppc_inst_dump(adrs, nidump);
1441 last_cmd = "di\n";
1442 } else {
1443 scanhex(&ndump);
1444 if( ndump == 0 )
1445 ndump = 64;
1446 prdump(adrs, ndump);
1447 adrs += ndump;
1448 last_cmd = "d\n";
1449 }
1450}
1451
1452void
1453prdump(unsigned adrs, int ndump)
1454{
1455 register int n, m, c, r, nr;
1456 unsigned char temp[16];
1457
1458 for( n = ndump; n > 0; ){
1459 printf("%.8x", adrs);
1460 putchar(' ');
1461 r = n < 16? n: 16;
1462 nr = mread(adrs, temp, r);
1463 adrs += nr;
1464 for( m = 0; m < r; ++m ){
1465 putchar((m & 3) == 0 && m > 0? '.': ' ');
1466 if( m < nr )
1467 printf("%.2x", temp[m]);
1468 else
1469 printf("%s", fault_chars[fault_type]);
1470 }
1471 for(; m < 16; ++m )
1472 printf(" ");
1473 printf(" |");
1474 for( m = 0; m < r; ++m ){
1475 if( m < nr ){
1476 c = temp[m];
1477 putchar(' ' <= c && c <= '~'? c: '.');
1478 } else
1479 putchar(' ');
1480 }
1481 n -= r;
1482 for(; m < 16; ++m )
1483 putchar(' ');
1484 printf("|\n");
1485 if( nr < r )
1486 break;
1487 }
1488}
1489
1490int
1491ppc_inst_dump(unsigned adr, int count)
1492{
1493 int nr, dotted;
1494 unsigned first_adr;
1495 unsigned long inst, last_inst = 0;
1496 unsigned char val[4];
1497
1498 dotted = 0;
1499 for (first_adr = adr; count > 0; --count, adr += 4){
1500 nr = mread(adr, val, 4);
1501 if( nr == 0 ){
1502 const char *x = fault_chars[fault_type];
1503 printf("%.8x %s%s%s%s\n", adr, x, x, x, x);
1504 break;
1505 }
1506 inst = GETWORD(val);
1507 if (adr > first_adr && inst == last_inst) {
1508 if (!dotted) {
1509 printf(" ...\n");
1510 dotted = 1;
1511 }
1512 continue;
1513 }
1514 dotted = 0;
1515 last_inst = inst;
1516 printf("%.8x ", adr);
1517 printf("%.8x\t", inst);
1518 print_insn_big_powerpc(stdout, inst, adr); /* always returns 4 */
1519 printf("\n");
1520 }
1521 return adr - first_adr;
1522}
1523
1524void
1525print_address(unsigned addr)
1526{
1527 printf("0x%x", addr);
1528}
1529
1530/*
1531 * Memory operations - move, set, print differences
1532 */
1533static unsigned mdest; /* destination address */
1534static unsigned msrc; /* source address */
1535static unsigned mval; /* byte value to set memory to */
1536static unsigned mcount; /* # bytes to affect */
1537static unsigned mdiffs; /* max # differences to print */
1538
1539void
1540memops(int cmd)
1541{
1542 scanhex(&mdest);
1543 if( termch != '\n' )
1544 termch = 0;
1545 scanhex(cmd == 's'? &mval: &msrc);
1546 if( termch != '\n' )
1547 termch = 0;
1548 scanhex(&mcount);
1549 switch( cmd ){
1550 case 'm':
1551 memmove((void *)mdest, (void *)msrc, mcount);
1552 break;
1553 case 's':
1554 memset((void *)mdest, mval, mcount);
1555 break;
1556 case 'd':
1557 if( termch != '\n' )
1558 termch = 0;
1559 scanhex(&mdiffs);
1560 memdiffs((unsigned char *)mdest, (unsigned char *)msrc, mcount, mdiffs);
1561 break;
1562 }
1563}
1564
1565void
1566memdiffs(unsigned char *p1, unsigned char *p2, unsigned nb, unsigned maxpr)
1567{
1568 unsigned n, prt;
1569
1570 prt = 0;
1571 for( n = nb; n > 0; --n )
1572 if( *p1++ != *p2++ )
1573 if( ++prt <= maxpr )
1574 printf("%.8x %.2x # %.8x %.2x\n", (unsigned)p1 - 1,
1575 p1[-1], (unsigned)p2 - 1, p2[-1]);
1576 if( prt > maxpr )
1577 printf("Total of %d differences\n", prt);
1578}
1579
1580static unsigned mend;
1581static unsigned mask;
1582
1583void
1584memlocate(void)
1585{
1586 unsigned a, n;
1587 unsigned char val[4];
1588
1589 last_cmd = "ml";
1590 scanhex(&mdest);
1591 if (termch != '\n') {
1592 termch = 0;
1593 scanhex(&mend);
1594 if (termch != '\n') {
1595 termch = 0;
1596 scanhex(&mval);
1597 mask = ~0;
1598 if (termch != '\n') termch = 0;
1599 scanhex(&mask);
1600 }
1601 }
1602 n = 0;
1603 for (a = mdest; a < mend; a += 4) {
1604 if (mread(a, val, 4) == 4
1605 && ((GETWORD(val) ^ mval) & mask) == 0) {
1606 printf("%.8x: %.8x\n", a, GETWORD(val));
1607 if (++n >= 10)
1608 break;
1609 }
1610 }
1611}
1612
1613static unsigned mskip = 0x1000;
1614static unsigned mlim = 0xffffffff;
1615
1616void
1617memzcan(void)
1618{
1619 unsigned char v;
1620 unsigned a;
1621 int ok, ook;
1622
1623 scanhex(&mdest);
1624 if (termch != '\n') termch = 0;
1625 scanhex(&mskip);
1626 if (termch != '\n') termch = 0;
1627 scanhex(&mlim);
1628 ook = 0;
1629 for (a = mdest; a < mlim; a += mskip) {
1630 ok = mread(a, &v, 1);
1631 if (ok && !ook) {
1632 printf("%.8x .. ", a);
1633 fflush(stdout);
1634 } else if (!ok && ook)
1635 printf("%.8x\n", a - mskip);
1636 ook = ok;
1637 if (a + mskip < a)
1638 break;
1639 }
1640 if (ook)
1641 printf("%.8x\n", a - mskip);
1642}
1643
1644void proccall(void)
1645{
1646 unsigned int args[8];
1647 unsigned int ret;
1648 int i;
1649 typedef unsigned int (*callfunc_t)(unsigned int, unsigned int,
1650 unsigned int, unsigned int, unsigned int,
1651 unsigned int, unsigned int, unsigned int);
1652 callfunc_t func;
1653
1654 scanhex(&adrs);
1655 if (termch != '\n')
1656 termch = 0;
1657 for (i = 0; i < 8; ++i)
1658 args[i] = 0;
1659 for (i = 0; i < 8; ++i) {
1660 if (!scanhex(&args[i]) || termch == '\n')
1661 break;
1662 termch = 0;
1663 }
1664 func = (callfunc_t) adrs;
1665 ret = 0;
1666 if (setjmp(bus_error_jmp) == 0) {
1667 debugger_fault_handler = handle_fault;
1668 sync();
1669 ret = func(args[0], args[1], args[2], args[3],
1670 args[4], args[5], args[6], args[7]);
1671 sync();
1672 printf("return value is %x\n", ret);
1673 } else {
1674 printf("*** %x exception occurred\n", fault_except);
1675 }
1676 debugger_fault_handler = NULL;
1677}
1678
1679/* Input scanning routines */
1680int
1681skipbl(void)
1682{
1683 int c;
1684
1685 if( termch != 0 ){
1686 c = termch;
1687 termch = 0;
1688 } else
1689 c = inchar();
1690 while( c == ' ' || c == '\t' )
1691 c = inchar();
1692 return c;
1693}
1694
1695#define N_PTREGS 44
1696static char *regnames[N_PTREGS] = {
1697 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
1698 "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
1699 "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
1700 "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",
1701 "pc", "msr", "or3", "ctr", "lr", "xer", "ccr", "mq",
1702 "trap", "dar", "dsisr", "res"
1703};
1704
1705int
1706scanhex(unsigned *vp)
1707{
1708 int c, d;
1709 unsigned v;
1710
1711 c = skipbl();
1712 if (c == '%') {
1713 /* parse register name */
1714 char regname[8];
1715 int i;
1716
1717 for (i = 0; i < sizeof(regname) - 1; ++i) {
1718 c = inchar();
1719 if (!isalnum(c)) {
1720 termch = c;
1721 break;
1722 }
1723 regname[i] = c;
1724 }
1725 regname[i] = 0;
1726 for (i = 0; i < N_PTREGS; ++i) {
1727 if (strcmp(regnames[i], regname) == 0) {
1728 unsigned *rp = (unsigned *)
1729 xmon_regs[smp_processor_id()];
1730 if (rp == NULL) {
1731 printf("regs not available\n");
1732 return 0;
1733 }
1734 *vp = rp[i];
1735 return 1;
1736 }
1737 }
1738 printf("invalid register name '%%%s'\n", regname);
1739 return 0;
1740 } else if (c == '$') {
1741 static char symname[64];
1742 int i;
1743 for (i=0; i<63; i++) {
1744 c = inchar();
1745 if (isspace(c)) {
1746 termch = c;
1747 break;
1748 }
1749 symname[i] = c;
1750 }
1751 symname[i++] = 0;
1752 *vp = xmon_symbol_to_addr(symname);
1753 if (!(*vp)) {
1754 printf("unknown symbol\n");
1755 return 0;
1756 }
1757 return 1;
1758 }
1759
1760 d = hexdigit(c);
1761 if( d == EOF ){
1762 termch = c;
1763 return 0;
1764 }
1765 v = 0;
1766 do {
1767 v = (v << 4) + d;
1768 c = inchar();
1769 d = hexdigit(c);
1770 } while( d != EOF );
1771 termch = c;
1772 *vp = v;
1773 return 1;
1774}
1775
1776void
1777scannl(void)
1778{
1779 int c;
1780
1781 c = termch;
1782 termch = 0;
1783 while( c != '\n' )
1784 c = inchar();
1785}
1786
1787int hexdigit(int c)
1788{
1789 if( '0' <= c && c <= '9' )
1790 return c - '0';
1791 if( 'A' <= c && c <= 'F' )
1792 return c - ('A' - 10);
1793 if( 'a' <= c && c <= 'f' )
1794 return c - ('a' - 10);
1795 return EOF;
1796}
1797
1798void
1799getstring(char *s, int size)
1800{
1801 int c;
1802
1803 c = skipbl();
1804 do {
1805 if( size > 1 ){
1806 *s++ = c;
1807 --size;
1808 }
1809 c = inchar();
1810 } while( c != ' ' && c != '\t' && c != '\n' );
1811 termch = c;
1812 *s = 0;
1813}
1814
1815static char line[256];
1816static char *lineptr;
1817
1818void
1819flush_input(void)
1820{
1821 lineptr = NULL;
1822}
1823
1824int
1825inchar(void)
1826{
1827 if (lineptr == NULL || *lineptr == 0) {
1828 if (fgets(line, sizeof(line), stdin) == NULL) {
1829 lineptr = NULL;
1830 return EOF;
1831 }
1832 lineptr = line;
1833 }
1834 return *lineptr++;
1835}
1836
1837void
1838take_input(char *str)
1839{
1840 lineptr = str;
1841}
1842
1843void
1844sysmap_lookup(void)
1845{
1846 int type = inchar();
1847 unsigned addr;
1848 static char tmp[64];
1849 char* cur;
1850
1851 extern char *sysmap;
1852 extern unsigned long sysmap_size;
1853 if ( !sysmap || !sysmap_size )
1854 return;
1855
1856 switch(type) {
1857 case 'a':
1858 if (scanhex(&addr)) {
1859 pretty_print_addr(addr);
1860 printf("\n");
1861 }
1862 termch = 0;
1863 break;
1864 case 's':
1865 getstring(tmp, 64);
1866 if( setjmp(bus_error_jmp) == 0 ) {
1867 debugger_fault_handler = handle_fault;
1868 sync();
1869 cur = sysmap;
1870 do {
1871 cur = strstr(cur, tmp);
1872 if (cur) {
1873 static char res[64];
1874 char *p, *d;
1875 p = cur;
1876 while(p > sysmap && *p != 10)
1877 p--;
1878 if (*p == 10) p++;
1879 d = res;
1880 while(*p && p < (sysmap + sysmap_size) && *p != 10)
1881 *(d++) = *(p++);
1882 *(d++) = 0;
1883 printf("%s\n", res);
1884 cur++;
1885 }
1886 } while (cur);
1887 sync();
1888 }
1889 debugger_fault_handler = NULL;
1890 termch = 0;
1891 break;
1892 }
1893}
1894
1895static int
1896pretty_print_addr(unsigned long addr)
1897{
1898 char *sym;
1899 unsigned long saddr;
1900
1901 printf("%08x", addr);
1902 sym = xmon_find_symbol(addr, &saddr);
1903 if (sym)
1904 printf(" (%s+0x%x)", sym, addr-saddr);
1905 return (sym != 0);
1906}
1907
1908char*
1909xmon_find_symbol(unsigned long addr, unsigned long* saddr)
1910{
1911 static char rbuffer[64];
1912 char *p, *ep, *limit;
1913 unsigned long prev, next;
1914 char* psym;
1915
1916 extern char *sysmap;
1917 extern unsigned long sysmap_size;
1918 if ( !sysmap || !sysmap_size )
1919 return NULL;
1920
1921 prev = 0;
1922 psym = NULL;
1923 p = sysmap;
1924 limit = p + sysmap_size;
1925 if( setjmp(bus_error_jmp) == 0 ) {
1926 debugger_fault_handler = handle_fault;
1927 sync();
1928 do {
1929 next = simple_strtoul(p, &p, 16);
1930 if (next > addr && prev <= addr) {
1931 if (!psym)
1932 goto bail;
1933 ep = rbuffer;
1934 p = psym;
1935 while(*p && p < limit && *p == 32)
1936 p++;
1937 while(*p && p < limit && *p != 10 && (ep - rbuffer) < 63)
1938 *(ep++) = *(p++);
1939 *(ep++) = 0;
1940 if (saddr)
1941 *saddr = prev;
1942 debugger_fault_handler = NULL;
1943 return rbuffer;
1944 }
1945 prev = next;
1946 psym = p;
1947 while(*p && p < limit && *p != 10)
1948 p++;
1949 if (*p) p++;
1950 } while(*p && p < limit && next);
1951bail:
1952 sync();
1953 }
1954 debugger_fault_handler = NULL;
1955 return NULL;
1956}
1957
1958unsigned long
1959xmon_symbol_to_addr(char* symbol)
1960{
1961 char *p, *cur;
1962 char *match = NULL;
1963 int goodness = 0;
1964 int result = 0;
1965
1966 extern char *sysmap;
1967 extern unsigned long sysmap_size;
1968 if ( !sysmap || !sysmap_size )
1969 return 0;
1970
1971 if( setjmp(bus_error_jmp) == 0 ) {
1972 debugger_fault_handler = handle_fault;
1973 sync();
1974 cur = sysmap;
1975 while(cur) {
1976 cur = strstr(cur, symbol);
1977 if (cur) {
1978 int gd = 1;
1979
1980 /* best match if equal, better match if
1981 * begins with
1982 */
1983 if (cur == sysmap || *(cur-1) == ' ') {
1984 gd++;
1985 if (cur[strlen(symbol)] == 10)
1986 gd++;
1987 }
1988 if (gd > goodness) {
1989 match = cur;
1990 goodness = gd;
1991 if (gd == 3)
1992 break;
1993 }
1994 cur++;
1995 }
1996 }
1997 if (goodness) {
1998 p = match;
1999 while(p > sysmap && *p != 10)
2000 p--;
2001 if (*p == 10) p++;
2002 result = simple_strtoul(p, &p, 16);
2003 }
2004 sync();
2005 }
2006 debugger_fault_handler = NULL;
2007 return result;
2008}