aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@petra>2005-06-22 06:19:24 -0400
committerJaroslav Kysela <perex@petra>2005-06-22 06:19:24 -0400
commitda04b128cf0d74dd4cab270c53d9264e70f9203e (patch)
tree095355c32dfd709236a85b497d3bd461d7cdfe8a
parentfae6ec69c84d71b1d5bda9ede1a262c1681684aa (diff)
parent2a5a68b840cbab31baab2d9b2e1e6de3b289ae1e (diff)
Merge with rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
-rw-r--r--CREDITS7
-rw-r--r--Documentation/fb/intelfb.txt135
-rw-r--r--Documentation/filesystems/isofs.txt6
-rw-r--r--Documentation/filesystems/tmpfs.txt6
-rw-r--r--Documentation/s390/CommonIO16
-rw-r--r--Documentation/sgi-ioc4.txt45
-rw-r--r--MAINTAINERS5
-rw-r--r--arch/arm/mm/mmap.c10
-rw-r--r--arch/frv/mm/init.c1
-rw-r--r--arch/i386/boot/Makefile2
-rw-r--r--arch/i386/kernel/syscall_table.S2
-rw-r--r--arch/i386/kernel/traps.c2
-rw-r--r--arch/i386/lib/delay.c2
-rw-r--r--arch/i386/mm/hugetlbpage.c204
-rw-r--r--arch/i386/mm/init.c1
-rw-r--r--arch/ia64/Kconfig6
-rw-r--r--arch/ia64/configs/sn2_defconfig6
-rw-r--r--arch/ia64/defconfig6
-rw-r--r--arch/ia64/kernel/Makefile1
-rw-r--r--arch/ia64/kernel/efi.c32
-rw-r--r--arch/ia64/kernel/entry.S2
-rw-r--r--arch/ia64/kernel/uncached.c246
-rw-r--r--arch/ia64/mm/hugetlbpage.c158
-rw-r--r--arch/ia64/sn/kernel/xpc_partition.c6
-rw-r--r--arch/m32r/Kconfig7
-rw-r--r--arch/m32r/boot/compressed/m32r_sio.c19
-rw-r--r--arch/m32r/defconfig52
-rw-r--r--arch/m32r/kernel/Makefile2
-rw-r--r--arch/m32r/kernel/io_m32700ut.c92
-rw-r--r--arch/m32r/kernel/io_mappi.c74
-rw-r--r--arch/m32r/kernel/io_mappi2.c92
-rw-r--r--arch/m32r/kernel/io_mappi3.c378
-rw-r--r--arch/m32r/kernel/io_oaks32r.c36
-rw-r--r--arch/m32r/kernel/io_opsput.c79
-rw-r--r--arch/m32r/kernel/io_usrv.c51
-rw-r--r--arch/m32r/kernel/setup.c2
-rw-r--r--arch/m32r/kernel/setup_m32700ut.c56
-rw-r--r--arch/m32r/kernel/setup_mappi.c14
-rw-r--r--arch/m32r/kernel/setup_mappi2.c20
-rw-r--r--arch/m32r/kernel/setup_mappi3.c208
-rw-r--r--arch/m32r/kernel/setup_oaks32r.c14
-rw-r--r--arch/m32r/kernel/setup_opsput.c28
-rw-r--r--arch/m32r/kernel/setup_usrv.c28
-rw-r--r--arch/m32r/m32700ut/defconfig.m32700ut.smp53
-rw-r--r--arch/m32r/m32700ut/defconfig.m32700ut.up52
-rw-r--r--arch/m32r/mappi/defconfig.nommu46
-rw-r--r--arch/m32r/mappi/defconfig.smp49
-rw-r--r--arch/m32r/mappi/defconfig.up48
-rw-r--r--arch/m32r/mappi2/defconfig.vdec246
-rw-r--r--arch/m32r/mappi3/defconfig.smp751
-rw-r--r--arch/m32r/mappi3/dot.gdbinit224
-rw-r--r--arch/m32r/mm/extable.c5
-rw-r--r--arch/m32r/oaks32r/defconfig.nommu50
-rw-r--r--arch/m32r/opsput/defconfig.opsput45
-rw-r--r--arch/mips/mm/init.c1
-rw-r--r--arch/ppc/Kconfig5
-rw-r--r--arch/ppc/boot/ld.script3
-rw-r--r--arch/ppc/boot/openfirmware/Makefile5
-rw-r--r--arch/ppc/boot/openfirmware/common.c16
-rw-r--r--arch/ppc/boot/simple/Makefile4
-rw-r--r--arch/ppc/boot/utils/addSystemMap.c186
-rw-r--r--arch/ppc/configs/mpc8548_cds_defconfig659
-rw-r--r--arch/ppc/kernel/cputable.c14
-rw-r--r--arch/ppc/kernel/entry.S164
-rw-r--r--arch/ppc/kernel/head_4xx.S15
-rw-r--r--arch/ppc/kernel/head_booke.h94
-rw-r--r--arch/ppc/kernel/setup.c11
-rw-r--r--arch/ppc/kernel/traps.c6
-rw-r--r--arch/ppc/lib/locks.c4
-rw-r--r--arch/ppc/mm/fsl_booke_mmu.c2
-rw-r--r--arch/ppc/mm/init.c17
-rw-r--r--arch/ppc/mm/mmu_decl.h2
-rw-r--r--arch/ppc/mm/pgtable.c1
-rw-r--r--arch/ppc/platforms/83xx/mpc834x_sys.c1
-rw-r--r--arch/ppc/platforms/85xx/Kconfig10
-rw-r--r--arch/ppc/platforms/85xx/Makefile1
-rw-r--r--arch/ppc/platforms/85xx/mpc8540_ads.c5
-rw-r--r--arch/ppc/platforms/85xx/mpc8560_ads.c1
-rw-r--r--arch/ppc/platforms/85xx/mpc85xx_ads_common.c37
-rw-r--r--arch/ppc/platforms/85xx/mpc85xx_cds_common.c96
-rw-r--r--arch/ppc/platforms/85xx/sbc8560.c5
-rw-r--r--arch/ppc/platforms/85xx/sbc85xx.c37
-rw-r--r--arch/ppc/platforms/85xx/stx_gp3.c37
-rw-r--r--arch/ppc/platforms/sandpoint.c20
-rw-r--r--arch/ppc/syslib/Makefile3
-rw-r--r--arch/ppc/syslib/mpc10x_common.c203
-rw-r--r--arch/ppc/syslib/mpc85xx_devices.c187
-rw-r--r--arch/ppc/syslib/mpc85xx_sys.c105
-rw-r--r--arch/ppc/syslib/open_pic.c1
-rw-r--r--arch/ppc/syslib/open_pic2.c1
-rw-r--r--arch/ppc/syslib/ppc4xx_kgdb.c124
-rw-r--r--arch/ppc/syslib/ppc83xx_setup.c1
-rw-r--r--arch/ppc/syslib/ppc85xx_setup.c9
-rw-r--r--arch/ppc/xmon/xmon.c270
-rw-r--r--arch/ppc64/Kconfig2
-rw-r--r--arch/ppc64/Makefile6
-rw-r--r--arch/ppc64/kernel/HvLpEvent.c2
-rw-r--r--arch/ppc64/kernel/ItLpQueue.c1
-rw-r--r--arch/ppc64/kernel/Makefile7
-rw-r--r--arch/ppc64/kernel/XmPciLpEvent.c190
-rw-r--r--arch/ppc64/kernel/asm-offsets.c1
-rw-r--r--arch/ppc64/kernel/dma.c4
-rw-r--r--arch/ppc64/kernel/eeh.c2
-rw-r--r--arch/ppc64/kernel/head.S4
-rw-r--r--arch/ppc64/kernel/iSeries_VpdInfo.c220
-rw-r--r--arch/ppc64/kernel/iSeries_iommu.c3
-rw-r--r--arch/ppc64/kernel/iSeries_irq.c312
-rw-r--r--arch/ppc64/kernel/iSeries_pci.c45
-rw-r--r--arch/ppc64/kernel/iSeries_pci_reset.c104
-rw-r--r--arch/ppc64/kernel/iSeries_proc.c3
-rw-r--r--arch/ppc64/kernel/iSeries_setup.c14
-rw-r--r--arch/ppc64/kernel/iSeries_smp.c2
-rw-r--r--arch/ppc64/kernel/idle.c7
-rw-r--r--arch/ppc64/kernel/irq.c2
-rw-r--r--arch/ppc64/kernel/lparcfg.c2
-rw-r--r--arch/ppc64/kernel/mf.c1
-rw-r--r--arch/ppc64/kernel/process.c8
-rw-r--r--arch/ppc64/kernel/prom.c12
-rw-r--r--arch/ppc64/kernel/ras.c1
-rw-r--r--arch/ppc64/kernel/rtc.c2
-rw-r--r--arch/ppc64/kernel/setup.c3
-rw-r--r--arch/ppc64/kernel/sys_ppc32.c3
-rw-r--r--arch/ppc64/kernel/vio.c37
-rw-r--r--arch/ppc64/kernel/viopath.c10
-rw-r--r--arch/ppc64/lib/Makefile2
-rw-r--r--arch/ppc64/mm/hash_utils.c6
-rw-r--r--arch/ppc64/mm/hugetlbpage.c214
-rw-r--r--arch/ppc64/mm/imalloc.c20
-rw-r--r--arch/ppc64/mm/init.c93
-rw-r--r--arch/ppc64/xmon/xmon.c9
-rw-r--r--arch/s390/kernel/compat_ioctl.c6
-rw-r--r--arch/s390/kernel/head.S27
-rw-r--r--arch/s390/kernel/head64.S25
-rw-r--r--arch/s390/kernel/traps.c5
-rw-r--r--arch/s390/mm/cmm.c2
-rw-r--r--arch/sh/kernel/sys_sh.c8
-rw-r--r--arch/sh/lib/delay.c2
-rw-r--r--arch/sh/mm/hugetlbpage.c196
-rw-r--r--arch/sh64/mm/hugetlbpage.c18
-rw-r--r--arch/sparc/mm/init.c1
-rw-r--r--arch/sparc64/kernel/sys_sparc.c8
-rw-r--r--arch/sparc64/lib/delay.c2
-rw-r--r--arch/sparc64/mm/hugetlbpage.c195
-rw-r--r--arch/sparc64/solaris/socket.c6
-rw-r--r--arch/um/Kconfig5
-rw-r--r--arch/um/Makefile2
-rw-r--r--arch/um/drivers/line.c3
-rw-r--r--arch/um/drivers/net_kern.c1
-rw-r--r--arch/um/drivers/port_kern.c1
-rw-r--r--arch/um/drivers/xterm_kern.c1
-rw-r--r--arch/um/kernel/irq.c11
-rw-r--r--arch/um/kernel/irq_user.c2
-rw-r--r--arch/um/kernel/mem.c1
-rw-r--r--arch/um/kernel/tt/Makefile15
-rw-r--r--arch/um/kernel/tt/unmap.c31
-rw-r--r--arch/um/kernel/uml.lds.S15
-rw-r--r--arch/um/scripts/Makefile.rules6
-rw-r--r--arch/um/scripts/Makefile.unmap22
-rw-r--r--arch/um/sys-i386/Makefile2
-rw-r--r--arch/um/sys-i386/unmap.c25
-rw-r--r--arch/um/sys-x86_64/Makefile2
-rw-r--r--arch/um/sys-x86_64/unmap.c25
-rw-r--r--arch/x86_64/ia32/ia32_aout.c1
-rw-r--r--arch/x86_64/ia32/ia32_binfmt.c5
-rw-r--r--arch/x86_64/kernel/process.c4
-rw-r--r--arch/x86_64/kernel/ptrace.c17
-rw-r--r--arch/x86_64/kernel/sys_x86_64.c23
-rw-r--r--arch/x86_64/lib/delay.c2
-rw-r--r--arch/x86_64/mm/fault.c2
-rw-r--r--drivers/Kconfig2
-rw-r--r--drivers/Makefile2
-rw-r--r--drivers/acpi/processor_idle.c2
-rw-r--r--drivers/base/node.c2
-rw-r--r--drivers/char/Kconfig4
-rw-r--r--drivers/char/Makefile1
-rw-r--r--drivers/char/ipmi/ipmi_msghandler.c2
-rw-r--r--drivers/char/mem.c8
-rw-r--r--drivers/char/vr41xx_giu.c743
-rw-r--r--drivers/ide/Kconfig4
-rw-r--r--drivers/ide/pci/sgiioc4.c30
-rw-r--r--drivers/input/gameport/gameport.c2
-rw-r--r--drivers/md/Makefile3
-rw-r--r--drivers/md/bitmap.c1586
-rw-r--r--drivers/md/dm-crypt.c3
-rw-r--r--drivers/md/linear.c3
-rw-r--r--drivers/md/md.c525
-rw-r--r--drivers/md/multipath.c3
-rw-r--r--drivers/md/raid0.c12
-rw-r--r--drivers/md/raid1.c242
-rw-r--r--drivers/md/raid10.c30
-rw-r--r--drivers/md/raid5.c12
-rw-r--r--drivers/md/raid6main.c12
-rw-r--r--drivers/misc/ibmasm/command.c30
-rw-r--r--drivers/misc/ibmasm/dot_command.c10
-rw-r--r--drivers/misc/ibmasm/event.c18
-rw-r--r--drivers/misc/ibmasm/heartbeat.c13
-rw-r--r--drivers/misc/ibmasm/ibmasm.h76
-rw-r--r--drivers/misc/ibmasm/ibmasmfs.c125
-rw-r--r--drivers/misc/ibmasm/lowlevel.c18
-rw-r--r--drivers/misc/ibmasm/module.c69
-rw-r--r--drivers/misc/ibmasm/r_heartbeat.c2
-rw-r--r--drivers/misc/ibmasm/remote.c304
-rw-r--r--drivers/misc/ibmasm/remote.h173
-rw-r--r--drivers/net/3c59x.c5
-rw-r--r--drivers/net/8390.c4
-rw-r--r--drivers/oprofile/buffer_sync.c4
-rw-r--r--drivers/pcmcia/Kconfig6
-rw-r--r--drivers/pcmcia/m32r_cfc.c57
-rw-r--r--drivers/pcmcia/m32r_cfc.h8
-rw-r--r--drivers/s390/cio/blacklist.c6
-rw-r--r--drivers/scsi/megaraid.c2
-rw-r--r--drivers/serial/Kconfig11
-rw-r--r--drivers/serial/Makefile2
-rw-r--r--drivers/serial/cpm_uart/cpm_uart_cpm2.c9
-rw-r--r--drivers/serial/ioc4_serial.c336
-rw-r--r--drivers/sn/Kconfig20
-rw-r--r--drivers/sn/Makefile2
-rw-r--r--drivers/sn/ioc4.c418
-rw-r--r--drivers/video/Kconfig16
-rw-r--r--drivers/video/Makefile1
-rw-r--r--drivers/video/arcfb.c684
-rw-r--r--drivers/video/chipsfb.c3
-rw-r--r--drivers/video/console/Kconfig17
-rw-r--r--drivers/video/console/Makefile2
-rw-r--r--drivers/video/console/bitblit.c23
-rw-r--r--drivers/video/console/font_10x18.c5146
-rw-r--r--drivers/video/console/font_7x14.c4118
-rw-r--r--drivers/video/console/font_sun12x22.c1579
-rw-r--r--drivers/video/console/fonts.c8
-rw-r--r--drivers/video/console/vgacon.c17
-rw-r--r--drivers/video/fbmem.c67
-rw-r--r--drivers/video/i810/i810_main.c1
-rw-r--r--drivers/video/intelfb/intelfbdrv.c23
-rw-r--r--drivers/video/nvidia/nvidia.c18
-rw-r--r--drivers/video/pm3fb.c2
-rw-r--r--drivers/video/riva/fbdev.c19
-rw-r--r--drivers/video/s1d13xxxfb.c2
-rw-r--r--drivers/video/savage/savagefb_driver.c2
-rw-r--r--drivers/video/softcursor.c9
-rw-r--r--drivers/video/vesafb.c8
-rw-r--r--fs/Kconfig50
-rw-r--r--fs/autofs4/autofs_i.h13
-rw-r--r--fs/autofs4/expire.c5
-rw-r--r--fs/autofs4/root.c15
-rw-r--r--fs/autofs4/waitq.c7
-rw-r--r--fs/binfmt_aout.c1
-rw-r--r--fs/binfmt_elf.c1
-rw-r--r--fs/buffer.c2
-rw-r--r--fs/hugetlbfs/inode.c3
-rw-r--r--fs/isofs/dir.c17
-rw-r--r--fs/isofs/inode.c128
-rw-r--r--fs/isofs/isofs.h2
-rw-r--r--fs/isofs/namei.c16
-rw-r--r--fs/isofs/rock.c962
-rw-r--r--fs/isofs/rock.h183
-rw-r--r--fs/jfs/acl.c6
-rw-r--r--fs/jfs/file.c9
-rw-r--r--fs/jfs/inode.c11
-rw-r--r--fs/jfs/jfs_debug.c10
-rw-r--r--fs/jfs/jfs_debug.h15
-rw-r--r--fs/jfs/jfs_dmap.c9
-rw-r--r--fs/jfs/jfs_dtree.c3
-rw-r--r--fs/jfs/jfs_extent.c7
-rw-r--r--fs/jfs/jfs_imap.c6
-rw-r--r--fs/jfs/jfs_inode.c1
-rw-r--r--fs/jfs/jfs_inode.h19
-rw-r--r--fs/jfs/jfs_logmgr.c14
-rw-r--r--fs/jfs/jfs_logmgr.h2
-rw-r--r--fs/jfs/jfs_metapage.c6
-rw-r--r--fs/jfs/jfs_metapage.h6
-rw-r--r--fs/jfs/jfs_superblock.h11
-rw-r--r--fs/jfs/jfs_txnmgr.c40
-rw-r--r--fs/jfs/jfs_txnmgr.h52
-rw-r--r--fs/jfs/namei.c28
-rw-r--r--fs/jfs/super.c37
-rw-r--r--fs/jfs/symlink.c3
-rw-r--r--fs/jfs/xattr.c6
-rw-r--r--fs/proc/proc_misc.c14
-rw-r--r--fs/super.c1
-rw-r--r--fs/xfs/linux-2.6/xfs_buf.c153
-rw-r--r--fs/xfs/linux-2.6/xfs_buf.h1
-rw-r--r--fs/xfs/linux-2.6/xfs_file.c27
-rw-r--r--fs/xfs/linux-2.6/xfs_ioctl.c11
-rw-r--r--fs/xfs/linux-2.6/xfs_linux.h12
-rw-r--r--fs/xfs/linux-2.6/xfs_lrw.c34
-rw-r--r--fs/xfs/linux-2.6/xfs_lrw.h2
-rw-r--r--fs/xfs/linux-2.6/xfs_super.c12
-rw-r--r--fs/xfs/linux-2.6/xfs_vfs.h1
-rw-r--r--fs/xfs/linux-2.6/xfs_vnode.c4
-rw-r--r--fs/xfs/linux-2.6/xfs_vnode.h2
-rw-r--r--fs/xfs/quota/xfs_dquot.c105
-rw-r--r--fs/xfs/quota/xfs_dquot.h30
-rw-r--r--fs/xfs/quota/xfs_dquot_item.c6
-rw-r--r--fs/xfs/quota/xfs_qm.c202
-rw-r--r--fs/xfs/quota/xfs_qm.h16
-rw-r--r--fs/xfs/quota/xfs_qm_bhv.c43
-rw-r--r--fs/xfs/quota/xfs_qm_syscalls.c175
-rw-r--r--fs/xfs/quota/xfs_quota_priv.h15
-rw-r--r--fs/xfs/quota/xfs_trans_dquot.c60
-rw-r--r--fs/xfs/support/debug.c1
-rw-r--r--fs/xfs/support/debug.h7
-rw-r--r--fs/xfs/xfs_alloc.c4
-rw-r--r--fs/xfs/xfs_attr.c17
-rw-r--r--fs/xfs/xfs_attr.h7
-rw-r--r--fs/xfs/xfs_attr_leaf.c28
-rw-r--r--fs/xfs/xfs_attr_leaf.h12
-rw-r--r--fs/xfs/xfs_bit.c2
-rw-r--r--fs/xfs/xfs_bmap.c127
-rw-r--r--fs/xfs/xfs_bmap.h13
-rw-r--r--fs/xfs/xfs_bmap_btree.c14
-rw-r--r--fs/xfs/xfs_bmap_btree.h8
-rw-r--r--fs/xfs/xfs_btree.c12
-rw-r--r--fs/xfs/xfs_btree.h10
-rw-r--r--fs/xfs/xfs_buf_item.c24
-rw-r--r--fs/xfs/xfs_buf_item.h2
-rw-r--r--fs/xfs/xfs_da_btree.c9
-rw-r--r--fs/xfs/xfs_da_btree.h3
-rw-r--r--fs/xfs/xfs_dfrag.c7
-rw-r--r--fs/xfs/xfs_dir2_data.c2
-rw-r--r--fs/xfs/xfs_dir2_data.h4
-rw-r--r--fs/xfs/xfs_dir2_leaf.c8
-rw-r--r--fs/xfs/xfs_dir2_leaf.h7
-rw-r--r--fs/xfs/xfs_dir_leaf.c6
-rw-r--r--fs/xfs/xfs_dir_leaf.h2
-rw-r--r--fs/xfs/xfs_dmapi.h19
-rw-r--r--fs/xfs/xfs_error.c2
-rw-r--r--fs/xfs/xfs_error.h3
-rw-r--r--fs/xfs/xfs_extfree_item.c126
-rw-r--r--fs/xfs/xfs_extfree_item.h2
-rw-r--r--fs/xfs/xfs_fs.h3
-rw-r--r--fs/xfs/xfs_fsops.c26
-rw-r--r--fs/xfs/xfs_ialloc_btree.h8
-rw-r--r--fs/xfs/xfs_inode.c185
-rw-r--r--fs/xfs/xfs_inode.h9
-rw-r--r--fs/xfs/xfs_inode_item.c2
-rw-r--r--fs/xfs/xfs_iomap.c65
-rw-r--r--fs/xfs/xfs_log.c6
-rw-r--r--fs/xfs/xfs_log_priv.h2
-rw-r--r--fs/xfs/xfs_log_recover.c31
-rw-r--r--fs/xfs/xfs_macros.c5
-rw-r--r--fs/xfs/xfs_mount.c16
-rw-r--r--fs/xfs/xfs_mount.h7
-rw-r--r--fs/xfs/xfs_quota.h72
-rw-r--r--fs/xfs/xfs_rename.c18
-rw-r--r--fs/xfs/xfs_trans.c21
-rw-r--r--fs/xfs/xfs_trans.h3
-rw-r--r--fs/xfs/xfs_trans_buf.c1
-rw-r--r--fs/xfs/xfs_trans_inode.c18
-rw-r--r--fs/xfs/xfs_types.h2
-rw-r--r--fs/xfs/xfs_utils.c2
-rw-r--r--fs/xfs/xfs_vfsops.c74
-rw-r--r--fs/xfs/xfs_vnodeops.c95
-rw-r--r--include/asm-alpha/smp.h2
-rw-r--r--include/asm-arm/smp.h2
-rw-r--r--include/asm-arm/system.h2
-rw-r--r--include/asm-generic/pgtable.h3
-rw-r--r--include/asm-i386/page.h1
-rw-r--r--include/asm-i386/pgtable.h2
-rw-r--r--include/asm-i386/smp.h2
-rw-r--r--include/asm-i386/unistd.h2
-rw-r--r--include/asm-ia64/mmzone.h14
-rw-r--r--include/asm-ia64/pgtable.h1
-rw-r--r--include/asm-ia64/smp.h2
-rw-r--r--include/asm-ia64/sn/mspec.h59
-rw-r--r--include/asm-ia64/uncached.h12
-rw-r--r--include/asm-ia64/unistd.h1
-rw-r--r--include/asm-m32r/div64.h39
-rw-r--r--include/asm-m32r/ide.h2
-rw-r--r--include/asm-m32r/m32102.h1
-rw-r--r--include/asm-m32r/m32102peri.h468
-rw-r--r--include/asm-m32r/m32r.h5
-rw-r--r--include/asm-m32r/mappi3/mappi3_pld.h143
-rw-r--r--include/asm-m32r/smp.h2
-rw-r--r--include/asm-mips/smp.h2
-rw-r--r--include/asm-mips/vr41xx/giu.h69
-rw-r--r--include/asm-mips/vr41xx/vr41xx.h35
-rw-r--r--include/asm-parisc/smp.h2
-rw-r--r--include/asm-ppc/irq.h34
-rw-r--r--include/asm-ppc/mpc10x.h6
-rw-r--r--include/asm-ppc/mpc85xx.h60
-rw-r--r--include/asm-ppc/pgtable.h2
-rw-r--r--include/asm-ppc/ppc_sys.h2
-rw-r--r--include/asm-ppc/smp.h2
-rw-r--r--include/asm-ppc64/dma.h3
-rw-r--r--include/asm-ppc64/iSeries/HvCall.h156
-rw-r--r--include/asm-ppc64/iSeries/HvCallCfg.h213
-rw-r--r--include/asm-ppc64/iSeries/HvCallEvent.h94
-rw-r--r--include/asm-ppc64/iSeries/HvCallHpt.h112
-rw-r--r--include/asm-ppc64/iSeries/HvCallPci.h486
-rw-r--r--include/asm-ppc64/iSeries/HvCallSc.h40
-rw-r--r--include/asm-ppc64/iSeries/HvCallSm.h36
-rw-r--r--include/asm-ppc64/iSeries/HvCallXm.h113
-rw-r--r--include/asm-ppc64/iSeries/HvLpConfig.h300
-rw-r--r--include/asm-ppc64/iSeries/HvLpEvent.h116
-rw-r--r--include/asm-ppc64/iSeries/HvReleaseData.h78
-rw-r--r--include/asm-ppc64/iSeries/HvTypes.h108
-rw-r--r--include/asm-ppc64/iSeries/IoHriMainStore.h33
-rw-r--r--include/asm-ppc64/iSeries/IoHriProcessorVpd.h32
-rw-r--r--include/asm-ppc64/iSeries/ItExtVpdPanel.h54
-rw-r--r--include/asm-ppc64/iSeries/ItIplParmsReal.h99
-rw-r--r--include/asm-ppc64/iSeries/ItLpNaca.h44
-rw-r--r--include/asm-ppc64/iSeries/ItLpQueue.h84
-rw-r--r--include/asm-ppc64/iSeries/ItLpRegSave.h41
-rw-r--r--include/asm-ppc64/iSeries/ItSpCommArea.h10
-rw-r--r--include/asm-ppc64/iSeries/ItVpdAreas.h125
-rw-r--r--include/asm-ppc64/iSeries/LparData.h49
-rw-r--r--include/asm-ppc64/iSeries/LparMap.h44
-rw-r--r--include/asm-ppc64/iSeries/XmPciLpEvent.h18
-rw-r--r--include/asm-ppc64/iSeries/iSeries_io.h59
-rw-r--r--include/asm-ppc64/iSeries/iSeries_irq.h17
-rw-r--r--include/asm-ppc64/iSeries/iSeries_pci.h142
-rw-r--r--include/asm-ppc64/iSeries/iSeries_proc.h24
-rw-r--r--include/asm-ppc64/iSeries/mf.h5
-rw-r--r--include/asm-ppc64/iSeries/vio.h57
-rw-r--r--include/asm-ppc64/imalloc.h12
-rw-r--r--include/asm-ppc64/iommu.h25
-rw-r--r--include/asm-ppc64/paca.h2
-rw-r--r--include/asm-ppc64/page.h2
-rw-r--r--include/asm-ppc64/pgtable.h9
-rw-r--r--include/asm-ppc64/processor.h10
-rw-r--r--include/asm-ppc64/smp.h2
-rw-r--r--include/asm-s390/smp.h2
-rw-r--r--include/asm-sh/page.h1
-rw-r--r--include/asm-sh/pgtable.h1
-rw-r--r--include/asm-sh/smp.h2
-rw-r--r--include/asm-sh64/page.h1
-rw-r--r--include/asm-sh64/pgtable.h2
-rw-r--r--include/asm-sparc/smp.h2
-rw-r--r--include/asm-sparc64/page.h2
-rw-r--r--include/asm-sparc64/pgtable.h1
-rw-r--r--include/asm-sparc64/processor.h34
-rw-r--r--include/asm-sparc64/smp.h2
-rw-r--r--include/asm-um/smp.h3
-rw-r--r--include/asm-x86_64/a.out.h2
-rw-r--r--include/asm-x86_64/page.h1
-rw-r--r--include/asm-x86_64/pgtable.h3
-rw-r--r--include/asm-x86_64/processor.h11
-rw-r--r--include/asm-x86_64/smp.h2
-rw-r--r--include/linux/arcfb.h8
-rw-r--r--include/linux/auto_fs4.h2
-rw-r--r--include/linux/fb.h19
-rw-r--r--include/linux/font.h26
-rw-r--r--include/linux/fsl_devices.h8
-rw-r--r--include/linux/genalloc.h40
-rw-r--r--include/linux/gfp.h8
-rw-r--r--include/linux/hugetlb.h40
-rw-r--r--include/linux/ioc4.h179
-rw-r--r--include/linux/ioc4_common.h21
-rw-r--r--include/linux/irq.h4
-rw-r--r--include/linux/mm.h6
-rw-r--r--include/linux/mmzone.h21
-rw-r--r--include/linux/netfilter_ipv4.h6
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_core.h3
-rw-r--r--include/linux/netfilter_ipv4/ip_nat.h3
-rw-r--r--include/linux/netfilter_ipv4/listhelp.h1
-rw-r--r--include/linux/netfilter_ipv4/lockhelp.h129
-rw-r--r--include/linux/netlink.h2
-rw-r--r--include/linux/page-flags.h35
-rw-r--r--include/linux/pagemap.h4
-rw-r--r--include/linux/pci_ids.h1
-rw-r--r--include/linux/raid/bitmap.h273
-rw-r--r--include/linux/raid/md.h17
-rw-r--r--include/linux/raid/md_k.h22
-rw-r--r--include/linux/raid/md_p.h9
-rw-r--r--include/linux/raid/md_u.h7
-rw-r--r--include/linux/raid/raid1.h16
-rw-r--r--include/linux/sched.h11
-rw-r--r--include/linux/skbuff.h13
-rw-r--r--include/linux/smp.h40
-rw-r--r--include/linux/swap.h3
-rw-r--r--include/net/ip6_fib.h9
-rw-r--r--include/net/ip6_route.h9
-rw-r--r--include/net/route.h2
-rw-r--r--include/net/snmp.h14
-rw-r--r--init/main.c1
-rw-r--r--kernel/fork.c7
-rw-r--r--kernel/irq/manage.c8
-rw-r--r--kernel/module.c2
-rw-r--r--kernel/power/smp.c4
-rw-r--r--kernel/sched.c4
-rw-r--r--kernel/stop_machine.c4
-rw-r--r--kernel/sys_ni.c1
-rw-r--r--lib/Kconfig6
-rw-r--r--lib/Makefile2
-rw-r--r--lib/genalloc.c188
-rw-r--r--lib/idr.c2
-rw-r--r--lib/kernel_lock.c55
-rw-r--r--lib/smp_processor_id.c55
-rw-r--r--mm/hugetlb.c177
-rw-r--r--mm/madvise.c103
-rw-r--r--mm/memory.c57
-rw-r--r--mm/mempolicy.c110
-rw-r--r--mm/mmap.c57
-rw-r--r--mm/msync.c2
-rw-r--r--mm/nommu.c2
-rw-r--r--mm/oom_kill.c7
-rw-r--r--mm/page_alloc.c423
-rw-r--r--mm/rmap.c21
-rw-r--r--mm/shmem.c143
-rw-r--r--mm/slab.c1
-rw-r--r--mm/swapfile.c55
-rw-r--r--mm/vmscan.c103
-rw-r--r--net/bridge/br_forward.c3
-rw-r--r--net/bridge/br_input.c4
-rw-r--r--net/bridge/br_netfilter.c38
-rw-r--r--net/core/netfilter.c138
-rw-r--r--net/core/skbuff.c6
-rw-r--r--net/ipv4/Kconfig26
-rw-r--r--net/ipv4/Makefile4
-rw-r--r--net/ipv4/af_inet.c12
-rw-r--r--net/ipv4/fib_trie.c2454
-rw-r--r--net/ipv4/ip_input.c5
-rw-r--r--net/ipv4/ip_output.c11
-rw-r--r--net/ipv4/ipmr.c1
-rw-r--r--net/ipv4/ipvs/ip_vs_xmit.c1
-rw-r--r--net/ipv4/netfilter/arp_tables.c1
-rw-r--r--net/ipv4/netfilter/ip_conntrack_amanda.c7
-rw-r--r--net/ipv4/netfilter/ip_conntrack_core.c107
-rw-r--r--net/ipv4/netfilter/ip_conntrack_ftp.c7
-rw-r--r--net/ipv4/netfilter/ip_conntrack_irc.c7
-rw-r--r--net/ipv4/netfilter/ip_conntrack_proto_sctp.c23
-rw-r--r--net/ipv4/netfilter/ip_conntrack_proto_tcp.c27
-rw-r--r--net/ipv4/netfilter/ip_conntrack_proto_udp.c1
-rw-r--r--net/ipv4/netfilter/ip_conntrack_standalone.c22
-rw-r--r--net/ipv4/netfilter/ip_nat_core.c32
-rw-r--r--net/ipv4/netfilter/ip_nat_helper.c13
-rw-r--r--net/ipv4/netfilter/ip_nat_rule.c4
-rw-r--r--net/ipv4/netfilter/ip_nat_standalone.c5
-rw-r--r--net/ipv4/netfilter/ip_tables.c1
-rw-r--r--net/ipv4/netfilter/ipt_CLUSTERIP.c49
-rw-r--r--net/ipv4/netfilter/ipt_MASQUERADE.c10
-rw-r--r--net/ipv4/netfilter/ipt_REJECT.c13
-rw-r--r--net/ipv4/netfilter/ipt_ULOG.c15
-rw-r--r--net/ipv4/netfilter/ipt_hashlimit.c17
-rw-r--r--net/ipv4/netfilter/ipt_helper.c4
-rw-r--r--net/ipv6/addrconf.c14
-rw-r--r--net/ipv6/anycast.c4
-rw-r--r--net/ipv6/ip6_fib.c19
-rw-r--r--net/ipv6/ip6_output.c3
-rw-r--r--net/ipv6/ipv6_sockglue.c5
-rw-r--r--net/ipv6/mcast.c68
-rw-r--r--net/ipv6/ndisc.c4
-rw-r--r--net/ipv6/netfilter/ip6_tables.c1
-rw-r--r--net/ipv6/netfilter/ip6t_LOG.c54
-rw-r--r--net/ipv6/netfilter/ip6table_raw.c6
-rw-r--r--net/ipv6/route.c78
-rw-r--r--security/selinux/hooks.c1
-rw-r--r--sound/oss/rme96xx.c2
548 files changed, 27679 insertions, 10651 deletions
diff --git a/CREDITS b/CREDITS
index d65ffe5a4d08..2993348ce6ce 100644
--- a/CREDITS
+++ b/CREDITS
@@ -1880,6 +1880,13 @@ S: Schlehenweg 9
1880S: D-91080 Uttenreuth 1880S: D-91080 Uttenreuth
1881S: Germany 1881S: Germany
1882 1882
1883N: Jaya Kumar
1884E: jayalk@intworks.biz
1885W: http://www.intworks.biz
1886D: Arc monochrome LCD framebuffer driver, x86 reboot fixups
1887S: Gurgaon, India
1888S: Kuala Lumpur, Malaysia
1889
1883N: Gabor Kuti 1890N: Gabor Kuti
1884M: seasons@falcon.sch.bme.hu 1891M: seasons@falcon.sch.bme.hu
1885M: seasons@makosteszta.sote.hu 1892M: seasons@makosteszta.sote.hu
diff --git a/Documentation/fb/intelfb.txt b/Documentation/fb/intelfb.txt
new file mode 100644
index 000000000000..c12d39a23c3d
--- /dev/null
+++ b/Documentation/fb/intelfb.txt
@@ -0,0 +1,135 @@
1Intel 830M/845G/852GM/855GM/865G/915G Framebuffer driver
2================================================================
3
4A. Introduction
5 This is a framebuffer driver for various Intel 810/815 compatible
6graphics devices. These would include:
7
8 Intel 830M
9 Intel 810E845G
10 Intel 852GM
11 Intel 855GM
12 Intel 865G
13 Intel 915G
14
15B. List of available options
16
17 a. "video=intelfb"
18 enables the intelfb driver
19
20 Recommendation: required
21
22 b. "mode=<xres>x<yres>[-<bpp>][@<refresh>]"
23 select mode
24
25 Recommendation: user preference
26 (default = 1024x768-32@70)
27
28 c. "vram=<value>"
29 select amount of system RAM in MB to allocate for the video memory
30 if not enough RAM was already allocated by the BIOS.
31
32 Recommendation: 1 - 4 MB.
33 (default = 4 MB)
34
35 d. "voffset=<value>"
36 select at what offset in MB of the logical memory to allocate the
37 framebuffer memory. The intent is to avoid the memory blocks
38 used by standard graphics applications (XFree86). Depending on your
39 usage, adjust the value up or down, (0 for maximum usage, 63/127 MB
40 for the least amount). Note, an arbitrary setting may conflict
41 with XFree86.
42
43 Recommendation: do not set
44 (default = 48 MB)
45
46 e. "accel"
47 enable text acceleration. This can be enabled/reenabled anytime
48 by using 'fbset -accel true/false'.
49
50 Recommendation: enable
51 (default = set)
52
53 f. "hwcursor"
54 enable cursor acceleration.
55
56 Recommendation: enable
57 (default = set)
58
59 g. "mtrr"
60 enable MTRR. This allows data transfers to the framebuffer memory
61 to occur in bursts which can significantly increase performance.
62 Not very helpful with the intel chips because of 'shared memory'.
63
64 Recommendation: set
65 (default = set)
66
67 h. "fixed"
68 disable mode switching.
69
70 Recommendation: do not set
71 (default = not set)
72
73 The binary parameters can be unset with a "no" prefix, example "noaccel".
74 The default parameter (not named) is the mode.
75
76C. Kernel booting
77
78Separate each option/option-pair by commas (,) and the option from its value
79with an equals sign (=) as in the following:
80
81video=i810fb:option1,option2=value2
82
83Sample Usage
84------------
85
86In /etc/lilo.conf, add the line:
87
88append="video=intelfb:800x600-32@75,accel,hwcursor,vram=8"
89
90This will initialize the framebuffer to 800x600 at 32bpp and 75Hz. The
91framebuffer will use 8 MB of System RAM. hw acceleration of text and cursor
92will be enabled.
93
94D. Module options
95
96 The module parameters are essentially similar to the kernel
97parameters. The main difference is that you need to include a Boolean value
98(1 for TRUE, and 0 for FALSE) for those options which don't need a value.
99
100Example, to enable MTRR, include "mtrr=1".
101
102Sample Usage
103------------
104
105Using the same setup as described above, load the module like this:
106
107 modprobe intelfb mode=800x600-32@75 vram=8 accel=1 hwcursor=1
108
109Or just add the following to /etc/modprobe.conf
110
111 options intelfb mode=800x600-32@75 vram=8 accel=1 hwcursor=1
112
113and just do a
114
115 modprobe intelfb
116
117
118E. Acknowledgment:
119
120 1. Geert Uytterhoeven - his excellent howto and the virtual
121 framebuffer driver code made this possible.
122
123 2. Jeff Hartmann for his agpgart code.
124
125 3. David Dawes for his original kernel 2.4 code.
126
127 4. The X developers. Insights were provided just by reading the
128 XFree86 source code.
129
130 5. Antonino A. Daplas for his inspiring i810fb driver.
131
132 6. Andrew Morton for his kernel patches maintenance.
133
134###########################
135Sylvain
diff --git a/Documentation/filesystems/isofs.txt b/Documentation/filesystems/isofs.txt
index f64a10506689..424585ff6ea1 100644
--- a/Documentation/filesystems/isofs.txt
+++ b/Documentation/filesystems/isofs.txt
@@ -26,7 +26,11 @@ Mount options unique to the isofs filesystem.
26 mode=xxx Sets the permissions on files to xxx 26 mode=xxx Sets the permissions on files to xxx
27 nojoliet Ignore Joliet extensions if they are present. 27 nojoliet Ignore Joliet extensions if they are present.
28 norock Ignore Rock Ridge extensions if they are present. 28 norock Ignore Rock Ridge extensions if they are present.
29 unhide Show hidden files. 29 hide Completely strip hidden files from the file system.
30 showassoc Show files marked with the 'associated' bit
31 unhide Deprecated; showing hidden files is now default;
32 If given, it is a synonym for 'showassoc' which will
33 recreate previous unhide behavior
30 session=x Select number of session on multisession CD 34 session=x Select number of session on multisession CD
31 sbsector=xxx Session begins from sector xxx 35 sbsector=xxx Session begins from sector xxx
32 36
diff --git a/Documentation/filesystems/tmpfs.txt b/Documentation/filesystems/tmpfs.txt
index 417e3095fe39..0d783c504ead 100644
--- a/Documentation/filesystems/tmpfs.txt
+++ b/Documentation/filesystems/tmpfs.txt
@@ -71,8 +71,8 @@ can be changed on remount. The size parameter also accepts a suffix %
71to limit this tmpfs instance to that percentage of your physical RAM: 71to limit this tmpfs instance to that percentage of your physical RAM:
72the default, when neither size nor nr_blocks is specified, is size=50% 72the default, when neither size nor nr_blocks is specified, is size=50%
73 73
74If both nr_blocks (or size) and nr_inodes are set to 0, neither blocks 74If nr_blocks=0 (or size=0), blocks will not be limited in that instance;
75nor inodes will be limited in that instance. It is generally unwise to 75if nr_inodes=0, inodes will not be limited. It is generally unwise to
76mount with such options, since it allows any user with write access to 76mount with such options, since it allows any user with write access to
77use up all the memory on the machine; but enhances the scalability of 77use up all the memory on the machine; but enhances the scalability of
78that instance in a system with many cpus making intensive use of it. 78that instance in a system with many cpus making intensive use of it.
@@ -97,4 +97,4 @@ RAM/SWAP in 10240 inodes and it is only accessible by root.
97Author: 97Author:
98 Christoph Rohland <cr@sap.com>, 1.12.01 98 Christoph Rohland <cr@sap.com>, 1.12.01
99Updated: 99Updated:
100 Hugh Dickins <hugh@veritas.com>, 01 September 2004 100 Hugh Dickins <hugh@veritas.com>, 13 March 2005
diff --git a/Documentation/s390/CommonIO b/Documentation/s390/CommonIO
index a831d9ae5a5e..59d1166d41ee 100644
--- a/Documentation/s390/CommonIO
+++ b/Documentation/s390/CommonIO
@@ -30,7 +30,7 @@ Command line parameters
30 device numbers (0xabcd or abcd, for 2.4 backward compatibility). 30 device numbers (0xabcd or abcd, for 2.4 backward compatibility).
31 You can use the 'all' keyword to ignore all devices. 31 You can use the 'all' keyword to ignore all devices.
32 The '!' operator will cause the I/O-layer to _not_ ignore a device. 32 The '!' operator will cause the I/O-layer to _not_ ignore a device.
33 The order on the command line is not important. 33 The command line is parsed from left to right.
34 34
35 For example, 35 For example,
36 cio_ignore=0.0.0023-0.0.0042,0.0.4711 36 cio_ignore=0.0.0023-0.0.0042,0.0.4711
@@ -72,13 +72,14 @@ Command line parameters
72 /proc/cio_ignore; "add <device range>, <device range>, ..." will ignore the 72 /proc/cio_ignore; "add <device range>, <device range>, ..." will ignore the
73 specified devices. 73 specified devices.
74 74
75 Note: Already known devices cannot be ignored. 75 Note: While already known devices can be added to the list of devices to be
76 ignored, there will be no effect on then. However, if such a device
77 disappears and then reappeares, it will then be ignored.
76 78
77 For example, if device 0.0.abcd is already known and all other devices 79 For example,
78 0.0.a000-0.0.afff are not known,
79 "echo add 0.0.a000-0.0.accc, 0.0.af00-0.0.afff > /proc/cio_ignore" 80 "echo add 0.0.a000-0.0.accc, 0.0.af00-0.0.afff > /proc/cio_ignore"
80 will add 0.0.a000-0.0.abcc, 0.0.abce-0.0.accc and 0.0.af00-0.0.afff to the 81 will add 0.0.a000-0.0.accc and 0.0.af00-0.0.afff to the list of ignored
81 list of ignored devices and skip 0.0.abcd. 82 devices.
82 83
83 The devices can be specified either by bus id (0.0.abcd) or, for 2.4 backward 84 The devices can be specified either by bus id (0.0.abcd) or, for 2.4 backward
84 compatibilty, by the device number in hexadecimal (0xabcd or abcd). 85 compatibilty, by the device number in hexadecimal (0xabcd or abcd).
@@ -98,7 +99,8 @@ Command line parameters
98 99
99 - /proc/s390dbf/cio_trace/hex_ascii 100 - /proc/s390dbf/cio_trace/hex_ascii
100 Logs the calling of functions in the common I/O-layer and, if applicable, 101 Logs the calling of functions in the common I/O-layer and, if applicable,
101 which subchannel they were called for. 102 which subchannel they were called for, as well as dumps of some data
103 structures (like irb in an error case).
102 104
103 The level of logging can be changed to be more or less verbose by piping to 105 The level of logging can be changed to be more or less verbose by piping to
104 /proc/s390dbf/cio_*/level a number between 0 and 6; see the documentation on 106 /proc/s390dbf/cio_*/level a number between 0 and 6; see the documentation on
diff --git a/Documentation/sgi-ioc4.txt b/Documentation/sgi-ioc4.txt
new file mode 100644
index 000000000000..876c96ae38db
--- /dev/null
+++ b/Documentation/sgi-ioc4.txt
@@ -0,0 +1,45 @@
1The SGI IOC4 PCI device is a bit of a strange beast, so some notes on
2it are in order.
3
4First, even though the IOC4 performs multiple functions, such as an
5IDE controller, a serial controller, a PS/2 keyboard/mouse controller,
6and an external interrupt mechanism, it's not implemented as a
7multifunction device. The consequence of this from a software
8standpoint is that all these functions share a single IRQ, and
9they can't all register to own the same PCI device ID. To make
10matters a bit worse, some of the register blocks (and even registers
11themselves) present in IOC4 are mixed-purpose between these several
12functions, meaning that there's no clear "owning" device driver.
13
14The solution is to organize the IOC4 driver into several independent
15drivers, "ioc4", "sgiioc4", and "ioc4_serial". Note that there is no
16PS/2 controller driver as this functionality has never been wired up
17on a shipping IO card.
18
19ioc4
20====
21This is the core (or shim) driver for IOC4. It is responsible for
22initializing the basic functionality of the chip, and allocating
23the PCI resources that are shared between the IOC4 functions.
24
25This driver also provides registration functions that the other
26IOC4 drivers can call to make their presence known. Each driver
27needs to provide a probe and remove function, which are invoked
28by the core driver at appropriate times. The interface of these
29IOC4 function probe and remove operations isn't precisely the same
30as PCI device probe and remove operations, but is logically the
31same operation.
32
33sgiioc4
34=======
35This is the IDE driver for IOC4. Its name isn't very descriptive
36simply for historical reasons (it used to be the only IOC4 driver
37component). There's not much to say about it other than it hooks
38up to the ioc4 driver via the appropriate registration, probe, and
39remove functions.
40
41ioc4_serial
42===========
43This is the serial driver for IOC4. There's not much to say about it
44other than it hooks up to the ioc4 driver via the appropriate registration,
45probe, and remove functions.
diff --git a/MAINTAINERS b/MAINTAINERS
index e3f0f3f157c9..0f88a70a15d8 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -265,6 +265,11 @@ P: Arnaldo Carvalho de Melo
265M: acme@conectiva.com.br 265M: acme@conectiva.com.br
266S: Maintained 266S: Maintained
267 267
268ARC FRAMEBUFFER DRIVER
269P: Jaya Kumar
270M: jayalk@intworks.biz
271S: Maintained
272
268ARM26 ARCHITECTURE 273ARM26 ARCHITECTURE
269P: Ian Molton 274P: Ian Molton
270M: spyro@f2s.com 275M: spyro@f2s.com
diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c
index 32c4b0e35b37..3de7f84b53c2 100644
--- a/arch/arm/mm/mmap.c
+++ b/arch/arm/mm/mmap.c
@@ -73,7 +73,12 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
73 (!vma || addr + len <= vma->vm_start)) 73 (!vma || addr + len <= vma->vm_start))
74 return addr; 74 return addr;
75 } 75 }
76 start_addr = addr = mm->free_area_cache; 76 if (len > mm->cached_hole_size) {
77 start_addr = addr = mm->free_area_cache;
78 } else {
79 start_addr = addr = TASK_UNMAPPED_BASE;
80 mm->cached_hole_size = 0;
81 }
77 82
78full_search: 83full_search:
79 if (do_align) 84 if (do_align)
@@ -90,6 +95,7 @@ full_search:
90 */ 95 */
91 if (start_addr != TASK_UNMAPPED_BASE) { 96 if (start_addr != TASK_UNMAPPED_BASE) {
92 start_addr = addr = TASK_UNMAPPED_BASE; 97 start_addr = addr = TASK_UNMAPPED_BASE;
98 mm->cached_hole_size = 0;
93 goto full_search; 99 goto full_search;
94 } 100 }
95 return -ENOMEM; 101 return -ENOMEM;
@@ -101,6 +107,8 @@ full_search:
101 mm->free_area_cache = addr + len; 107 mm->free_area_cache = addr + len;
102 return addr; 108 return addr;
103 } 109 }
110 if (addr + mm->cached_hole_size < vma->vm_start)
111 mm->cached_hole_size = vma->vm_start - addr;
104 addr = vma->vm_end; 112 addr = vma->vm_end;
105 if (do_align) 113 if (do_align)
106 addr = COLOUR_ALIGN(addr, pgoff); 114 addr = COLOUR_ALIGN(addr, pgoff);
diff --git a/arch/frv/mm/init.c b/arch/frv/mm/init.c
index 41958f57c838..79433159b5f0 100644
--- a/arch/frv/mm/init.c
+++ b/arch/frv/mm/init.c
@@ -169,7 +169,6 @@ void __init mem_init(void)
169 struct page *page = &mem_map[pfn]; 169 struct page *page = &mem_map[pfn];
170 170
171 ClearPageReserved(page); 171 ClearPageReserved(page);
172 set_bit(PG_highmem, &page->flags);
173 set_page_count(page, 1); 172 set_page_count(page, 1);
174 __free_page(page); 173 __free_page(page);
175 totalram_pages++; 174 totalram_pages++;
diff --git a/arch/i386/boot/Makefile b/arch/i386/boot/Makefile
index aa7064a75ee6..43cd6220ee49 100644
--- a/arch/i386/boot/Makefile
+++ b/arch/i386/boot/Makefile
@@ -48,7 +48,7 @@ cmd_image = $(obj)/tools/build $(BUILDFLAGS) $(obj)/bootsect $(obj)/setup \
48$(obj)/zImage $(obj)/bzImage: $(obj)/bootsect $(obj)/setup \ 48$(obj)/zImage $(obj)/bzImage: $(obj)/bootsect $(obj)/setup \
49 $(obj)/vmlinux.bin $(obj)/tools/build FORCE 49 $(obj)/vmlinux.bin $(obj)/tools/build FORCE
50 $(call if_changed,image) 50 $(call if_changed,image)
51 @echo 'Kernel: $@ is ready' 51 @echo 'Kernel: $@ is ready' ' (#'`cat .version`')'
52 52
53$(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE 53$(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE
54 $(call if_changed,objcopy) 54 $(call if_changed,objcopy)
diff --git a/arch/i386/kernel/syscall_table.S b/arch/i386/kernel/syscall_table.S
index 6cd1ed311f02..d408afaf6495 100644
--- a/arch/i386/kernel/syscall_table.S
+++ b/arch/i386/kernel/syscall_table.S
@@ -251,7 +251,7 @@ ENTRY(sys_call_table)
251 .long sys_io_submit 251 .long sys_io_submit
252 .long sys_io_cancel 252 .long sys_io_cancel
253 .long sys_fadvise64 /* 250 */ 253 .long sys_fadvise64 /* 250 */
254 .long sys_ni_syscall 254 .long sys_set_zone_reclaim
255 .long sys_exit_group 255 .long sys_exit_group
256 .long sys_lookup_dcookie 256 .long sys_lookup_dcookie
257 .long sys_epoll_create 257 .long sys_epoll_create
diff --git a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c
index 00c63419c06f..83c579e82a81 100644
--- a/arch/i386/kernel/traps.c
+++ b/arch/i386/kernel/traps.c
@@ -306,7 +306,7 @@ void die(const char * str, struct pt_regs * regs, long err)
306 }; 306 };
307 static int die_counter; 307 static int die_counter;
308 308
309 if (die.lock_owner != _smp_processor_id()) { 309 if (die.lock_owner != raw_smp_processor_id()) {
310 console_verbose(); 310 console_verbose();
311 spin_lock_irq(&die.lock); 311 spin_lock_irq(&die.lock);
312 die.lock_owner = smp_processor_id(); 312 die.lock_owner = smp_processor_id();
diff --git a/arch/i386/lib/delay.c b/arch/i386/lib/delay.c
index 080639f262b1..eb0cdfe9280f 100644
--- a/arch/i386/lib/delay.c
+++ b/arch/i386/lib/delay.c
@@ -34,7 +34,7 @@ inline void __const_udelay(unsigned long xloops)
34 xloops *= 4; 34 xloops *= 4;
35 __asm__("mull %0" 35 __asm__("mull %0"
36 :"=d" (xloops), "=&a" (d0) 36 :"=d" (xloops), "=&a" (d0)
37 :"1" (xloops),"0" (cpu_data[_smp_processor_id()].loops_per_jiffy * (HZ/4))); 37 :"1" (xloops),"0" (cpu_data[raw_smp_processor_id()].loops_per_jiffy * (HZ/4)));
38 __delay(++xloops); 38 __delay(++xloops);
39} 39}
40 40
diff --git a/arch/i386/mm/hugetlbpage.c b/arch/i386/mm/hugetlbpage.c
index 171fc925e1e4..3b099f32b948 100644
--- a/arch/i386/mm/hugetlbpage.c
+++ b/arch/i386/mm/hugetlbpage.c
@@ -18,7 +18,7 @@
18#include <asm/tlb.h> 18#include <asm/tlb.h>
19#include <asm/tlbflush.h> 19#include <asm/tlbflush.h>
20 20
21static pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr) 21pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr)
22{ 22{
23 pgd_t *pgd; 23 pgd_t *pgd;
24 pud_t *pud; 24 pud_t *pud;
@@ -30,7 +30,7 @@ static pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr)
30 return (pte_t *) pmd; 30 return (pte_t *) pmd;
31} 31}
32 32
33static pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr) 33pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
34{ 34{
35 pgd_t *pgd; 35 pgd_t *pgd;
36 pud_t *pud; 36 pud_t *pud;
@@ -42,21 +42,6 @@ static pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
42 return (pte_t *) pmd; 42 return (pte_t *) pmd;
43} 43}
44 44
45static void set_huge_pte(struct mm_struct *mm, struct vm_area_struct *vma, struct page *page, pte_t * page_table, int write_access)
46{
47 pte_t entry;
48
49 add_mm_counter(mm, rss, HPAGE_SIZE / PAGE_SIZE);
50 if (write_access) {
51 entry =
52 pte_mkwrite(pte_mkdirty(mk_pte(page, vma->vm_page_prot)));
53 } else
54 entry = pte_wrprotect(mk_pte(page, vma->vm_page_prot));
55 entry = pte_mkyoung(entry);
56 mk_pte_huge(entry);
57 set_pte(page_table, entry);
58}
59
60/* 45/*
61 * This function checks for proper alignment of input addr and len parameters. 46 * This function checks for proper alignment of input addr and len parameters.
62 */ 47 */
@@ -69,77 +54,6 @@ int is_aligned_hugepage_range(unsigned long addr, unsigned long len)
69 return 0; 54 return 0;
70} 55}
71 56
72int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src,
73 struct vm_area_struct *vma)
74{
75 pte_t *src_pte, *dst_pte, entry;
76 struct page *ptepage;
77 unsigned long addr = vma->vm_start;
78 unsigned long end = vma->vm_end;
79
80 while (addr < end) {
81 dst_pte = huge_pte_alloc(dst, addr);
82 if (!dst_pte)
83 goto nomem;
84 src_pte = huge_pte_offset(src, addr);
85 entry = *src_pte;
86 ptepage = pte_page(entry);
87 get_page(ptepage);
88 set_pte(dst_pte, entry);
89 add_mm_counter(dst, rss, HPAGE_SIZE / PAGE_SIZE);
90 addr += HPAGE_SIZE;
91 }
92 return 0;
93
94nomem:
95 return -ENOMEM;
96}
97
98int
99follow_hugetlb_page(struct mm_struct *mm, struct vm_area_struct *vma,
100 struct page **pages, struct vm_area_struct **vmas,
101 unsigned long *position, int *length, int i)
102{
103 unsigned long vpfn, vaddr = *position;
104 int remainder = *length;
105
106 WARN_ON(!is_vm_hugetlb_page(vma));
107
108 vpfn = vaddr/PAGE_SIZE;
109 while (vaddr < vma->vm_end && remainder) {
110
111 if (pages) {
112 pte_t *pte;
113 struct page *page;
114
115 pte = huge_pte_offset(mm, vaddr);
116
117 /* hugetlb should be locked, and hence, prefaulted */
118 WARN_ON(!pte || pte_none(*pte));
119
120 page = &pte_page(*pte)[vpfn % (HPAGE_SIZE/PAGE_SIZE)];
121
122 WARN_ON(!PageCompound(page));
123
124 get_page(page);
125 pages[i] = page;
126 }
127
128 if (vmas)
129 vmas[i] = vma;
130
131 vaddr += PAGE_SIZE;
132 ++vpfn;
133 --remainder;
134 ++i;
135 }
136
137 *length = remainder;
138 *position = vaddr;
139
140 return i;
141}
142
143#if 0 /* This is just for testing */ 57#if 0 /* This is just for testing */
144struct page * 58struct page *
145follow_huge_addr(struct mm_struct *mm, unsigned long address, int write) 59follow_huge_addr(struct mm_struct *mm, unsigned long address, int write)
@@ -204,83 +118,15 @@ follow_huge_pmd(struct mm_struct *mm, unsigned long address,
204} 118}
205#endif 119#endif
206 120
207void unmap_hugepage_range(struct vm_area_struct *vma, 121void hugetlb_clean_stale_pgtable(pte_t *pte)
208 unsigned long start, unsigned long end)
209{ 122{
210 struct mm_struct *mm = vma->vm_mm; 123 pmd_t *pmd = (pmd_t *) pte;
211 unsigned long address;
212 pte_t pte, *ptep;
213 struct page *page; 124 struct page *page;
214 125
215 BUG_ON(start & (HPAGE_SIZE - 1)); 126 page = pmd_page(*pmd);
216 BUG_ON(end & (HPAGE_SIZE - 1)); 127 pmd_clear(pmd);
217 128 dec_page_state(nr_page_table_pages);
218 for (address = start; address < end; address += HPAGE_SIZE) { 129 page_cache_release(page);
219 ptep = huge_pte_offset(mm, address);
220 if (!ptep)
221 continue;
222 pte = ptep_get_and_clear(mm, address, ptep);
223 if (pte_none(pte))
224 continue;
225 page = pte_page(pte);
226 put_page(page);
227 }
228 add_mm_counter(mm ,rss, -((end - start) >> PAGE_SHIFT));
229 flush_tlb_range(vma, start, end);
230}
231
232int hugetlb_prefault(struct address_space *mapping, struct vm_area_struct *vma)
233{
234 struct mm_struct *mm = current->mm;
235 unsigned long addr;
236 int ret = 0;
237
238 BUG_ON(vma->vm_start & ~HPAGE_MASK);
239 BUG_ON(vma->vm_end & ~HPAGE_MASK);
240
241 spin_lock(&mm->page_table_lock);
242 for (addr = vma->vm_start; addr < vma->vm_end; addr += HPAGE_SIZE) {
243 unsigned long idx;
244 pte_t *pte = huge_pte_alloc(mm, addr);
245 struct page *page;
246
247 if (!pte) {
248 ret = -ENOMEM;
249 goto out;
250 }
251
252 if (!pte_none(*pte))
253 continue;
254
255 idx = ((addr - vma->vm_start) >> HPAGE_SHIFT)
256 + (vma->vm_pgoff >> (HPAGE_SHIFT - PAGE_SHIFT));
257 page = find_get_page(mapping, idx);
258 if (!page) {
259 /* charge the fs quota first */
260 if (hugetlb_get_quota(mapping)) {
261 ret = -ENOMEM;
262 goto out;
263 }
264 page = alloc_huge_page();
265 if (!page) {
266 hugetlb_put_quota(mapping);
267 ret = -ENOMEM;
268 goto out;
269 }
270 ret = add_to_page_cache(page, mapping, idx, GFP_ATOMIC);
271 if (! ret) {
272 unlock_page(page);
273 } else {
274 hugetlb_put_quota(mapping);
275 free_huge_page(page);
276 goto out;
277 }
278 }
279 set_huge_pte(mm, vma, page, pte, vma->vm_flags & VM_WRITE);
280 }
281out:
282 spin_unlock(&mm->page_table_lock);
283 return ret;
284} 130}
285 131
286/* x86_64 also uses this file */ 132/* x86_64 also uses this file */
@@ -294,7 +140,12 @@ static unsigned long hugetlb_get_unmapped_area_bottomup(struct file *file,
294 struct vm_area_struct *vma; 140 struct vm_area_struct *vma;
295 unsigned long start_addr; 141 unsigned long start_addr;
296 142
297 start_addr = mm->free_area_cache; 143 if (len > mm->cached_hole_size) {
144 start_addr = mm->free_area_cache;
145 } else {
146 start_addr = TASK_UNMAPPED_BASE;
147 mm->cached_hole_size = 0;
148 }
298 149
299full_search: 150full_search:
300 addr = ALIGN(start_addr, HPAGE_SIZE); 151 addr = ALIGN(start_addr, HPAGE_SIZE);
@@ -308,6 +159,7 @@ full_search:
308 */ 159 */
309 if (start_addr != TASK_UNMAPPED_BASE) { 160 if (start_addr != TASK_UNMAPPED_BASE) {
310 start_addr = TASK_UNMAPPED_BASE; 161 start_addr = TASK_UNMAPPED_BASE;
162 mm->cached_hole_size = 0;
311 goto full_search; 163 goto full_search;
312 } 164 }
313 return -ENOMEM; 165 return -ENOMEM;
@@ -316,6 +168,8 @@ full_search:
316 mm->free_area_cache = addr + len; 168 mm->free_area_cache = addr + len;
317 return addr; 169 return addr;
318 } 170 }
171 if (addr + mm->cached_hole_size < vma->vm_start)
172 mm->cached_hole_size = vma->vm_start - addr;
319 addr = ALIGN(vma->vm_end, HPAGE_SIZE); 173 addr = ALIGN(vma->vm_end, HPAGE_SIZE);
320 } 174 }
321} 175}
@@ -327,12 +181,17 @@ static unsigned long hugetlb_get_unmapped_area_topdown(struct file *file,
327 struct mm_struct *mm = current->mm; 181 struct mm_struct *mm = current->mm;
328 struct vm_area_struct *vma, *prev_vma; 182 struct vm_area_struct *vma, *prev_vma;
329 unsigned long base = mm->mmap_base, addr = addr0; 183 unsigned long base = mm->mmap_base, addr = addr0;
184 unsigned long largest_hole = mm->cached_hole_size;
330 int first_time = 1; 185 int first_time = 1;
331 186
332 /* don't allow allocations above current base */ 187 /* don't allow allocations above current base */
333 if (mm->free_area_cache > base) 188 if (mm->free_area_cache > base)
334 mm->free_area_cache = base; 189 mm->free_area_cache = base;
335 190
191 if (len <= largest_hole) {
192 largest_hole = 0;
193 mm->free_area_cache = base;
194 }
336try_again: 195try_again:
337 /* make sure it can fit in the remaining address space */ 196 /* make sure it can fit in the remaining address space */
338 if (mm->free_area_cache < len) 197 if (mm->free_area_cache < len)
@@ -353,13 +212,21 @@ try_again:
353 * vma->vm_start, use it: 212 * vma->vm_start, use it:
354 */ 213 */
355 if (addr + len <= vma->vm_start && 214 if (addr + len <= vma->vm_start &&
356 (!prev_vma || (addr >= prev_vma->vm_end))) 215 (!prev_vma || (addr >= prev_vma->vm_end))) {
357 /* remember the address as a hint for next time */ 216 /* remember the address as a hint for next time */
358 return (mm->free_area_cache = addr); 217 mm->cached_hole_size = largest_hole;
359 else 218 return (mm->free_area_cache = addr);
219 } else {
360 /* pull free_area_cache down to the first hole */ 220 /* pull free_area_cache down to the first hole */
361 if (mm->free_area_cache == vma->vm_end) 221 if (mm->free_area_cache == vma->vm_end) {
362 mm->free_area_cache = vma->vm_start; 222 mm->free_area_cache = vma->vm_start;
223 mm->cached_hole_size = largest_hole;
224 }
225 }
226
227 /* remember the largest hole we saw so far */
228 if (addr + largest_hole < vma->vm_start)
229 largest_hole = vma->vm_start - addr;
363 230
364 /* try just below the current vma->vm_start */ 231 /* try just below the current vma->vm_start */
365 addr = (vma->vm_start - len) & HPAGE_MASK; 232 addr = (vma->vm_start - len) & HPAGE_MASK;
@@ -372,6 +239,7 @@ fail:
372 */ 239 */
373 if (first_time) { 240 if (first_time) {
374 mm->free_area_cache = base; 241 mm->free_area_cache = base;
242 largest_hole = 0;
375 first_time = 0; 243 first_time = 0;
376 goto try_again; 244 goto try_again;
377 } 245 }
@@ -382,6 +250,7 @@ fail:
382 * allocations. 250 * allocations.
383 */ 251 */
384 mm->free_area_cache = TASK_UNMAPPED_BASE; 252 mm->free_area_cache = TASK_UNMAPPED_BASE;
253 mm->cached_hole_size = ~0UL;
385 addr = hugetlb_get_unmapped_area_bottomup(file, addr0, 254 addr = hugetlb_get_unmapped_area_bottomup(file, addr0,
386 len, pgoff, flags); 255 len, pgoff, flags);
387 256
@@ -389,6 +258,7 @@ fail:
389 * Restore the topdown base: 258 * Restore the topdown base:
390 */ 259 */
391 mm->free_area_cache = base; 260 mm->free_area_cache = base;
261 mm->cached_hole_size = ~0UL;
392 262
393 return addr; 263 return addr;
394} 264}
diff --git a/arch/i386/mm/init.c b/arch/i386/mm/init.c
index 7a7ea3737265..8766c771bb45 100644
--- a/arch/i386/mm/init.c
+++ b/arch/i386/mm/init.c
@@ -269,7 +269,6 @@ void __init one_highpage_init(struct page *page, int pfn, int bad_ppro)
269{ 269{
270 if (page_is_ram(pfn) && !(bad_ppro && page_kills_ppro(pfn))) { 270 if (page_is_ram(pfn) && !(bad_ppro && page_kills_ppro(pfn))) {
271 ClearPageReserved(page); 271 ClearPageReserved(page);
272 set_bit(PG_highmem, &page->flags);
273 set_page_count(page, 1); 272 set_page_count(page, 1);
274 __free_page(page); 273 __free_page(page);
275 totalhigh_pages++; 274 totalhigh_pages++;
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 3ad2c4af099c..34e603cc1716 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -50,6 +50,10 @@ config SCHED_NO_NO_OMIT_FRAME_POINTER
50 bool 50 bool
51 default y 51 default y
52 52
53config IA64_UNCACHED_ALLOCATOR
54 bool
55 select GENERIC_ALLOCATOR
56
53choice 57choice
54 prompt "System type" 58 prompt "System type"
55 default IA64_GENERIC 59 default IA64_GENERIC
@@ -223,7 +227,7 @@ config IA64_SGI_SN_SIM
223 227
224config IA64_SGI_SN_XP 228config IA64_SGI_SN_XP
225 tristate "Support communication between SGI SSIs" 229 tristate "Support communication between SGI SSIs"
226 depends on MSPEC 230 select IA64_UNCACHED_ALLOCATOR
227 help 231 help
228 An SGI machine can be divided into multiple Single System 232 An SGI machine can be divided into multiple Single System
229 Images which act independently of each other and have 233 Images which act independently of each other and have
diff --git a/arch/ia64/configs/sn2_defconfig b/arch/ia64/configs/sn2_defconfig
index 6ff7107fee4d..a01bb02d074d 100644
--- a/arch/ia64/configs/sn2_defconfig
+++ b/arch/ia64/configs/sn2_defconfig
@@ -588,6 +588,7 @@ CONFIG_SGI_MBCS=m
588CONFIG_SERIAL_CORE=y 588CONFIG_SERIAL_CORE=y
589CONFIG_SERIAL_CORE_CONSOLE=y 589CONFIG_SERIAL_CORE_CONSOLE=y
590CONFIG_SERIAL_SGI_L1_CONSOLE=y 590CONFIG_SERIAL_SGI_L1_CONSOLE=y
591CONFIG_SERIAL_SGI_IOC4=y
591CONFIG_UNIX98_PTYS=y 592CONFIG_UNIX98_PTYS=y
592CONFIG_LEGACY_PTYS=y 593CONFIG_LEGACY_PTYS=y
593CONFIG_LEGACY_PTY_COUNT=256 594CONFIG_LEGACY_PTY_COUNT=256
@@ -788,6 +789,11 @@ CONFIG_INFINIBAND_IPOIB=m
788# CONFIG_INFINIBAND_IPOIB_DEBUG is not set 789# CONFIG_INFINIBAND_IPOIB_DEBUG is not set
789 790
790# 791#
792# SN Devices
793#
794CONFIG_SGI_IOC4=y
795
796#
791# File systems 797# File systems
792# 798#
793CONFIG_EXT2_FS=y 799CONFIG_EXT2_FS=y
diff --git a/arch/ia64/defconfig b/arch/ia64/defconfig
index 7539e83bf054..9997ef45ab23 100644
--- a/arch/ia64/defconfig
+++ b/arch/ia64/defconfig
@@ -638,6 +638,7 @@ CONFIG_SERIAL_8250_SHARE_IRQ=y
638CONFIG_SERIAL_CORE=y 638CONFIG_SERIAL_CORE=y
639CONFIG_SERIAL_CORE_CONSOLE=y 639CONFIG_SERIAL_CORE_CONSOLE=y
640CONFIG_SERIAL_SGI_L1_CONSOLE=y 640CONFIG_SERIAL_SGI_L1_CONSOLE=y
641CONFIG_SERIAL_SGI_IOC4=y
641CONFIG_UNIX98_PTYS=y 642CONFIG_UNIX98_PTYS=y
642CONFIG_LEGACY_PTYS=y 643CONFIG_LEGACY_PTYS=y
643CONFIG_LEGACY_PTY_COUNT=256 644CONFIG_LEGACY_PTY_COUNT=256
@@ -943,6 +944,11 @@ CONFIG_INFINIBAND_IPOIB=m
943# CONFIG_INFINIBAND_IPOIB_DEBUG is not set 944# CONFIG_INFINIBAND_IPOIB_DEBUG is not set
944 945
945# 946#
947# SN Devices
948#
949CONFIG_SGI_IOC4=y
950
951#
946# File systems 952# File systems
947# 953#
948CONFIG_EXT2_FS=y 954CONFIG_EXT2_FS=y
diff --git a/arch/ia64/kernel/Makefile b/arch/ia64/kernel/Makefile
index c1a02bbc252c..4c73d8ba2e3d 100644
--- a/arch/ia64/kernel/Makefile
+++ b/arch/ia64/kernel/Makefile
@@ -20,6 +20,7 @@ obj-$(CONFIG_SMP) += smp.o smpboot.o domain.o
20obj-$(CONFIG_PERFMON) += perfmon_default_smpl.o 20obj-$(CONFIG_PERFMON) += perfmon_default_smpl.o
21obj-$(CONFIG_IA64_CYCLONE) += cyclone.o 21obj-$(CONFIG_IA64_CYCLONE) += cyclone.o
22obj-$(CONFIG_IA64_MCA_RECOVERY) += mca_recovery.o 22obj-$(CONFIG_IA64_MCA_RECOVERY) += mca_recovery.o
23obj-$(CONFIG_IA64_UNCACHED_ALLOCATOR) += uncached.o
23mca_recovery-y += mca_drv.o mca_drv_asm.o 24mca_recovery-y += mca_drv.o mca_drv_asm.o
24 25
25# The gate DSO image is built using a special linker script. 26# The gate DSO image is built using a special linker script.
diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c
index 4a3b1aac43e7..179f230816ed 100644
--- a/arch/ia64/kernel/efi.c
+++ b/arch/ia64/kernel/efi.c
@@ -410,6 +410,38 @@ efi_memmap_walk (efi_freemem_callback_t callback, void *arg)
410} 410}
411 411
412/* 412/*
413 * Walk the EFI memory map to pull out leftover pages in the lower
414 * memory regions which do not end up in the regular memory map and
415 * stick them into the uncached allocator
416 *
417 * The regular walk function is significantly more complex than the
418 * uncached walk which means it really doesn't make sense to try and
419 * marge the two.
420 */
421void __init
422efi_memmap_walk_uc (efi_freemem_callback_t callback)
423{
424 void *efi_map_start, *efi_map_end, *p;
425 efi_memory_desc_t *md;
426 u64 efi_desc_size, start, end;
427
428 efi_map_start = __va(ia64_boot_param->efi_memmap);
429 efi_map_end = efi_map_start + ia64_boot_param->efi_memmap_size;
430 efi_desc_size = ia64_boot_param->efi_memdesc_size;
431
432 for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) {
433 md = p;
434 if (md->attribute == EFI_MEMORY_UC) {
435 start = PAGE_ALIGN(md->phys_addr);
436 end = PAGE_ALIGN((md->phys_addr+(md->num_pages << EFI_PAGE_SHIFT)) & PAGE_MASK);
437 if ((*callback)(start, end, NULL) < 0)
438 return;
439 }
440 }
441}
442
443
444/*
413 * Look for the PAL_CODE region reported by EFI and maps it using an 445 * Look for the PAL_CODE region reported by EFI and maps it using an
414 * ITR to enable safe PAL calls in virtual mode. See IA-64 Processor 446 * ITR to enable safe PAL calls in virtual mode. See IA-64 Processor
415 * Abstraction Layer chapter 11 in ADAG 447 * Abstraction Layer chapter 11 in ADAG
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
index d99316c9be28..b1d5d3d5276c 100644
--- a/arch/ia64/kernel/entry.S
+++ b/arch/ia64/kernel/entry.S
@@ -1579,7 +1579,7 @@ sys_call_table:
1579 data8 sys_keyctl 1579 data8 sys_keyctl
1580 data8 sys_ni_syscall 1580 data8 sys_ni_syscall
1581 data8 sys_ni_syscall // 1275 1581 data8 sys_ni_syscall // 1275
1582 data8 sys_ni_syscall 1582 data8 sys_set_zone_reclaim
1583 data8 sys_ni_syscall 1583 data8 sys_ni_syscall
1584 data8 sys_ni_syscall 1584 data8 sys_ni_syscall
1585 data8 sys_ni_syscall 1585 data8 sys_ni_syscall
diff --git a/arch/ia64/kernel/uncached.c b/arch/ia64/kernel/uncached.c
new file mode 100644
index 000000000000..490dfc9ab47f
--- /dev/null
+++ b/arch/ia64/kernel/uncached.c
@@ -0,0 +1,246 @@
1/*
2 * Copyright (C) 2001-2005 Silicon Graphics, Inc. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License
6 * as published by the Free Software Foundation.
7 *
8 * A simple uncached page allocator using the generic allocator. This
9 * allocator first utilizes the spare (spill) pages found in the EFI
10 * memmap and will then start converting cached pages to uncached ones
11 * at a granule at a time. Node awareness is implemented by having a
12 * pool of pages per node.
13 */
14
15#include <linux/types.h>
16#include <linux/kernel.h>
17#include <linux/module.h>
18#include <linux/init.h>
19#include <linux/errno.h>
20#include <linux/string.h>
21#include <linux/slab.h>
22#include <linux/efi.h>
23#include <linux/genalloc.h>
24#include <asm/page.h>
25#include <asm/pal.h>
26#include <asm/system.h>
27#include <asm/pgtable.h>
28#include <asm/atomic.h>
29#include <asm/tlbflush.h>
30#include <asm/sn/arch.h>
31
32#define DEBUG 0
33
34#if DEBUG
35#define dprintk printk
36#else
37#define dprintk(x...) do { } while (0)
38#endif
39
40void __init efi_memmap_walk_uc (efi_freemem_callback_t callback);
41
42#define MAX_UNCACHED_GRANULES 5
43static int allocated_granules;
44
45struct gen_pool *uncached_pool[MAX_NUMNODES];
46
47
48static void uncached_ipi_visibility(void *data)
49{
50 int status;
51
52 status = ia64_pal_prefetch_visibility(PAL_VISIBILITY_PHYSICAL);
53 if ((status != PAL_VISIBILITY_OK) &&
54 (status != PAL_VISIBILITY_OK_REMOTE_NEEDED))
55 printk(KERN_DEBUG "pal_prefetch_visibility() returns %i on "
56 "CPU %i\n", status, get_cpu());
57}
58
59
60static void uncached_ipi_mc_drain(void *data)
61{
62 int status;
63 status = ia64_pal_mc_drain();
64 if (status)
65 printk(KERN_WARNING "ia64_pal_mc_drain() failed with %i on "
66 "CPU %i\n", status, get_cpu());
67}
68
69
70static unsigned long
71uncached_get_new_chunk(struct gen_pool *poolp)
72{
73 struct page *page;
74 void *tmp;
75 int status, i;
76 unsigned long addr, node;
77
78 if (allocated_granules >= MAX_UNCACHED_GRANULES)
79 return 0;
80
81 node = poolp->private;
82 page = alloc_pages_node(node, GFP_KERNEL | __GFP_ZERO,
83 IA64_GRANULE_SHIFT-PAGE_SHIFT);
84
85 dprintk(KERN_INFO "get_new_chunk page %p, addr %lx\n",
86 page, (unsigned long)(page-vmem_map) << PAGE_SHIFT);
87
88 /*
89 * Do magic if no mem on local node! XXX
90 */
91 if (!page)
92 return 0;
93 tmp = page_address(page);
94
95 /*
96 * There's a small race here where it's possible for someone to
97 * access the page through /dev/mem halfway through the conversion
98 * to uncached - not sure it's really worth bothering about
99 */
100 for (i = 0; i < (IA64_GRANULE_SIZE / PAGE_SIZE); i++)
101 SetPageUncached(&page[i]);
102
103 flush_tlb_kernel_range(tmp, tmp + IA64_GRANULE_SIZE);
104
105 status = ia64_pal_prefetch_visibility(PAL_VISIBILITY_PHYSICAL);
106
107 dprintk(KERN_INFO "pal_prefetch_visibility() returns %i on cpu %i\n",
108 status, get_cpu());
109
110 if (!status) {
111 status = smp_call_function(uncached_ipi_visibility, NULL, 0, 1);
112 if (status)
113 printk(KERN_WARNING "smp_call_function failed for "
114 "uncached_ipi_visibility! (%i)\n", status);
115 }
116
117 if (ia64_platform_is("sn2"))
118 sn_flush_all_caches((unsigned long)tmp, IA64_GRANULE_SIZE);
119 else
120 flush_icache_range((unsigned long)tmp,
121 (unsigned long)tmp+IA64_GRANULE_SIZE);
122
123 ia64_pal_mc_drain();
124 status = smp_call_function(uncached_ipi_mc_drain, NULL, 0, 1);
125 if (status)
126 printk(KERN_WARNING "smp_call_function failed for "
127 "uncached_ipi_mc_drain! (%i)\n", status);
128
129 addr = (unsigned long)tmp - PAGE_OFFSET + __IA64_UNCACHED_OFFSET;
130
131 allocated_granules++;
132 return addr;
133}
134
135
136/*
137 * uncached_alloc_page
138 *
139 * Allocate 1 uncached page. Allocates on the requested node. If no
140 * uncached pages are available on the requested node, roundrobin starting
141 * with higher nodes.
142 */
143unsigned long
144uncached_alloc_page(int nid)
145{
146 unsigned long maddr;
147
148 maddr = gen_pool_alloc(uncached_pool[nid], PAGE_SIZE);
149
150 dprintk(KERN_DEBUG "uncached_alloc_page returns %lx on node %i\n",
151 maddr, nid);
152
153 /*
154 * If no memory is availble on our local node, try the
155 * remaining nodes in the system.
156 */
157 if (!maddr) {
158 int i;
159
160 for (i = MAX_NUMNODES - 1; i >= 0; i--) {
161 if (i == nid || !node_online(i))
162 continue;
163 maddr = gen_pool_alloc(uncached_pool[i], PAGE_SIZE);
164 dprintk(KERN_DEBUG "uncached_alloc_page alternate search "
165 "returns %lx on node %i\n", maddr, i);
166 if (maddr) {
167 break;
168 }
169 }
170 }
171
172 return maddr;
173}
174EXPORT_SYMBOL(uncached_alloc_page);
175
176
177/*
178 * uncached_free_page
179 *
180 * Free a single uncached page.
181 */
182void
183uncached_free_page(unsigned long maddr)
184{
185 int node;
186
187 node = nasid_to_cnodeid(NASID_GET(maddr));
188
189 dprintk(KERN_DEBUG "uncached_free_page(%lx) on node %i\n", maddr, node);
190
191 if ((maddr & (0XFUL << 60)) != __IA64_UNCACHED_OFFSET)
192 panic("uncached_free_page invalid address %lx\n", maddr);
193
194 gen_pool_free(uncached_pool[node], maddr, PAGE_SIZE);
195}
196EXPORT_SYMBOL(uncached_free_page);
197
198
199/*
200 * uncached_build_memmap,
201 *
202 * Called at boot time to build a map of pages that can be used for
203 * memory special operations.
204 */
205static int __init
206uncached_build_memmap(unsigned long start, unsigned long end, void *arg)
207{
208 long length;
209 unsigned long vstart, vend;
210 int node;
211
212 length = end - start;
213 vstart = start + __IA64_UNCACHED_OFFSET;
214 vend = end + __IA64_UNCACHED_OFFSET;
215
216 dprintk(KERN_ERR "uncached_build_memmap(%lx %lx)\n", start, end);
217
218 memset((char *)vstart, 0, length);
219
220 node = nasid_to_cnodeid(NASID_GET(start));
221
222 for (; vstart < vend ; vstart += PAGE_SIZE) {
223 dprintk(KERN_INFO "sticking %lx into the pool!\n", vstart);
224 gen_pool_free(uncached_pool[node], vstart, PAGE_SIZE);
225 }
226
227 return 0;
228}
229
230
231static int __init uncached_init(void) {
232 int i;
233
234 for (i = 0; i < MAX_NUMNODES; i++) {
235 if (!node_online(i))
236 continue;
237 uncached_pool[i] = gen_pool_create(0, IA64_GRANULE_SHIFT,
238 &uncached_get_new_chunk, i);
239 }
240
241 efi_memmap_walk_uc(uncached_build_memmap);
242
243 return 0;
244}
245
246__initcall(uncached_init);
diff --git a/arch/ia64/mm/hugetlbpage.c b/arch/ia64/mm/hugetlbpage.c
index df08ae7634b6..e0a776a3044c 100644
--- a/arch/ia64/mm/hugetlbpage.c
+++ b/arch/ia64/mm/hugetlbpage.c
@@ -24,7 +24,7 @@
24 24
25unsigned int hpage_shift=HPAGE_SHIFT_DEFAULT; 25unsigned int hpage_shift=HPAGE_SHIFT_DEFAULT;
26 26
27static pte_t * 27pte_t *
28huge_pte_alloc (struct mm_struct *mm, unsigned long addr) 28huge_pte_alloc (struct mm_struct *mm, unsigned long addr)
29{ 29{
30 unsigned long taddr = htlbpage_to_page(addr); 30 unsigned long taddr = htlbpage_to_page(addr);
@@ -43,7 +43,7 @@ huge_pte_alloc (struct mm_struct *mm, unsigned long addr)
43 return pte; 43 return pte;
44} 44}
45 45
46static pte_t * 46pte_t *
47huge_pte_offset (struct mm_struct *mm, unsigned long addr) 47huge_pte_offset (struct mm_struct *mm, unsigned long addr)
48{ 48{
49 unsigned long taddr = htlbpage_to_page(addr); 49 unsigned long taddr = htlbpage_to_page(addr);
@@ -67,23 +67,6 @@ huge_pte_offset (struct mm_struct *mm, unsigned long addr)
67 67
68#define mk_pte_huge(entry) { pte_val(entry) |= _PAGE_P; } 68#define mk_pte_huge(entry) { pte_val(entry) |= _PAGE_P; }
69 69
70static void
71set_huge_pte (struct mm_struct *mm, struct vm_area_struct *vma,
72 struct page *page, pte_t * page_table, int write_access)
73{
74 pte_t entry;
75
76 add_mm_counter(mm, rss, HPAGE_SIZE / PAGE_SIZE);
77 if (write_access) {
78 entry =
79 pte_mkwrite(pte_mkdirty(mk_pte(page, vma->vm_page_prot)));
80 } else
81 entry = pte_wrprotect(mk_pte(page, vma->vm_page_prot));
82 entry = pte_mkyoung(entry);
83 mk_pte_huge(entry);
84 set_pte(page_table, entry);
85 return;
86}
87/* 70/*
88 * This function checks for proper alignment of input addr and len parameters. 71 * This function checks for proper alignment of input addr and len parameters.
89 */ 72 */
@@ -99,68 +82,6 @@ int is_aligned_hugepage_range(unsigned long addr, unsigned long len)
99 return 0; 82 return 0;
100} 83}
101 84
102int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src,
103 struct vm_area_struct *vma)
104{
105 pte_t *src_pte, *dst_pte, entry;
106 struct page *ptepage;
107 unsigned long addr = vma->vm_start;
108 unsigned long end = vma->vm_end;
109
110 while (addr < end) {
111 dst_pte = huge_pte_alloc(dst, addr);
112 if (!dst_pte)
113 goto nomem;
114 src_pte = huge_pte_offset(src, addr);
115 entry = *src_pte;
116 ptepage = pte_page(entry);
117 get_page(ptepage);
118 set_pte(dst_pte, entry);
119 add_mm_counter(dst, rss, HPAGE_SIZE / PAGE_SIZE);
120 addr += HPAGE_SIZE;
121 }
122 return 0;
123nomem:
124 return -ENOMEM;
125}
126
127int
128follow_hugetlb_page(struct mm_struct *mm, struct vm_area_struct *vma,
129 struct page **pages, struct vm_area_struct **vmas,
130 unsigned long *st, int *length, int i)
131{
132 pte_t *ptep, pte;
133 unsigned long start = *st;
134 unsigned long pstart;
135 int len = *length;
136 struct page *page;
137
138 do {
139 pstart = start & HPAGE_MASK;
140 ptep = huge_pte_offset(mm, start);
141 pte = *ptep;
142
143back1:
144 page = pte_page(pte);
145 if (pages) {
146 page += ((start & ~HPAGE_MASK) >> PAGE_SHIFT);
147 get_page(page);
148 pages[i] = page;
149 }
150 if (vmas)
151 vmas[i] = vma;
152 i++;
153 len--;
154 start += PAGE_SIZE;
155 if (((start & HPAGE_MASK) == pstart) && len &&
156 (start < vma->vm_end))
157 goto back1;
158 } while (len && start < vma->vm_end);
159 *length = len;
160 *st = start;
161 return i;
162}
163
164struct page *follow_huge_addr(struct mm_struct *mm, unsigned long addr, int write) 85struct page *follow_huge_addr(struct mm_struct *mm, unsigned long addr, int write)
165{ 86{
166 struct page *page; 87 struct page *page;
@@ -212,81 +133,6 @@ void hugetlb_free_pgd_range(struct mmu_gather **tlb,
212 free_pgd_range(tlb, addr, end, floor, ceiling); 133 free_pgd_range(tlb, addr, end, floor, ceiling);
213} 134}
214 135
215void unmap_hugepage_range(struct vm_area_struct *vma, unsigned long start, unsigned long end)
216{
217 struct mm_struct *mm = vma->vm_mm;
218 unsigned long address;
219 pte_t *pte;
220 struct page *page;
221
222 BUG_ON(start & (HPAGE_SIZE - 1));
223 BUG_ON(end & (HPAGE_SIZE - 1));
224
225 for (address = start; address < end; address += HPAGE_SIZE) {
226 pte = huge_pte_offset(mm, address);
227 if (pte_none(*pte))
228 continue;
229 page = pte_page(*pte);
230 put_page(page);
231 pte_clear(mm, address, pte);
232 }
233 add_mm_counter(mm, rss, - ((end - start) >> PAGE_SHIFT));
234 flush_tlb_range(vma, start, end);
235}
236
237int hugetlb_prefault(struct address_space *mapping, struct vm_area_struct *vma)
238{
239 struct mm_struct *mm = current->mm;
240 unsigned long addr;
241 int ret = 0;
242
243 BUG_ON(vma->vm_start & ~HPAGE_MASK);
244 BUG_ON(vma->vm_end & ~HPAGE_MASK);
245
246 spin_lock(&mm->page_table_lock);
247 for (addr = vma->vm_start; addr < vma->vm_end; addr += HPAGE_SIZE) {
248 unsigned long idx;
249 pte_t *pte = huge_pte_alloc(mm, addr);
250 struct page *page;
251
252 if (!pte) {
253 ret = -ENOMEM;
254 goto out;
255 }
256 if (!pte_none(*pte))
257 continue;
258
259 idx = ((addr - vma->vm_start) >> HPAGE_SHIFT)
260 + (vma->vm_pgoff >> (HPAGE_SHIFT - PAGE_SHIFT));
261 page = find_get_page(mapping, idx);
262 if (!page) {
263 /* charge the fs quota first */
264 if (hugetlb_get_quota(mapping)) {
265 ret = -ENOMEM;
266 goto out;
267 }
268 page = alloc_huge_page();
269 if (!page) {
270 hugetlb_put_quota(mapping);
271 ret = -ENOMEM;
272 goto out;
273 }
274 ret = add_to_page_cache(page, mapping, idx, GFP_ATOMIC);
275 if (! ret) {
276 unlock_page(page);
277 } else {
278 hugetlb_put_quota(mapping);
279 page_cache_release(page);
280 goto out;
281 }
282 }
283 set_huge_pte(mm, vma, page, pte, vma->vm_flags & VM_WRITE);
284 }
285out:
286 spin_unlock(&mm->page_table_lock);
287 return ret;
288}
289
290unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr, unsigned long len, 136unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr, unsigned long len,
291 unsigned long pgoff, unsigned long flags) 137 unsigned long pgoff, unsigned long flags)
292{ 138{
diff --git a/arch/ia64/sn/kernel/xpc_partition.c b/arch/ia64/sn/kernel/xpc_partition.c
index 2c3c4a8af553..cd7ed73f0e7a 100644
--- a/arch/ia64/sn/kernel/xpc_partition.c
+++ b/arch/ia64/sn/kernel/xpc_partition.c
@@ -22,6 +22,7 @@
22#include <linux/cache.h> 22#include <linux/cache.h>
23#include <linux/mmzone.h> 23#include <linux/mmzone.h>
24#include <linux/nodemask.h> 24#include <linux/nodemask.h>
25#include <asm/uncached.h>
25#include <asm/sn/bte.h> 26#include <asm/sn/bte.h>
26#include <asm/sn/intr.h> 27#include <asm/sn/intr.h>
27#include <asm/sn/sn_sal.h> 28#include <asm/sn/sn_sal.h>
@@ -183,7 +184,7 @@ xpc_rsvd_page_init(void)
183 * memory protections are never restricted. 184 * memory protections are never restricted.
184 */ 185 */
185 if ((amos_page = xpc_vars->amos_page) == NULL) { 186 if ((amos_page = xpc_vars->amos_page) == NULL) {
186 amos_page = (AMO_t *) mspec_kalloc_page(0); 187 amos_page = (AMO_t *) TO_AMO(uncached_alloc_page(0));
187 if (amos_page == NULL) { 188 if (amos_page == NULL) {
188 dev_err(xpc_part, "can't allocate page of AMOs\n"); 189 dev_err(xpc_part, "can't allocate page of AMOs\n");
189 return NULL; 190 return NULL;
@@ -200,7 +201,8 @@ xpc_rsvd_page_init(void)
200 if (ret != 0) { 201 if (ret != 0) {
201 dev_err(xpc_part, "can't change memory " 202 dev_err(xpc_part, "can't change memory "
202 "protections\n"); 203 "protections\n");
203 mspec_kfree_page((unsigned long) amos_page); 204 uncached_free_page(__IA64_UNCACHED_OFFSET |
205 TO_PHYS((u64) amos_page));
204 return NULL; 206 return NULL;
205 } 207 }
206 } 208 }
diff --git a/arch/m32r/Kconfig b/arch/m32r/Kconfig
index 0d90ea58a0cb..64c133344afe 100644
--- a/arch/m32r/Kconfig
+++ b/arch/m32r/Kconfig
@@ -78,6 +78,9 @@ config PLAT_OAKS32R
78config PLAT_MAPPI2 78config PLAT_MAPPI2
79 bool "Mappi-II(M3A-ZA36/M3A-ZA52)" 79 bool "Mappi-II(M3A-ZA36/M3A-ZA52)"
80 80
81config PLAT_MAPPI3
82 bool "Mappi-III(M3A-2170)"
83
81endchoice 84endchoice
82 85
83choice 86choice
@@ -134,6 +137,7 @@ config BUS_CLOCK
134 int "Bus Clock [Hz] (integer)" 137 int "Bus Clock [Hz] (integer)"
135 default "70000000" if PLAT_MAPPI 138 default "70000000" if PLAT_MAPPI
136 default "25000000" if PLAT_USRV 139 default "25000000" if PLAT_USRV
140 default "50000000" if PLAT_MAPPI3
137 default "50000000" if PLAT_M32700UT 141 default "50000000" if PLAT_M32700UT
138 default "50000000" if PLAT_OPSPUT 142 default "50000000" if PLAT_OPSPUT
139 default "33333333" if PLAT_OAKS32R 143 default "33333333" if PLAT_OAKS32R
@@ -149,7 +153,7 @@ config CPU_LITTLE_ENDIAN
149 153
150config MEMORY_START 154config MEMORY_START
151 hex "Physical memory start address (hex)" 155 hex "Physical memory start address (hex)"
152 default "08000000" if PLAT_MAPPI || PLAT_MAPPI2 156 default "08000000" if PLAT_MAPPI || PLAT_MAPPI2 || PLAT_MAPPI3
153 default "08000000" if PLAT_USRV 157 default "08000000" if PLAT_USRV
154 default "08000000" if PLAT_M32700UT 158 default "08000000" if PLAT_M32700UT
155 default "08000000" if PLAT_OPSPUT 159 default "08000000" if PLAT_OPSPUT
@@ -157,6 +161,7 @@ config MEMORY_START
157 161
158config MEMORY_SIZE 162config MEMORY_SIZE
159 hex "Physical memory size (hex)" 163 hex "Physical memory size (hex)"
164 default "08000000" if PLAT_MAPPI3
160 default "04000000" if PLAT_MAPPI || PLAT_MAPPI2 165 default "04000000" if PLAT_MAPPI || PLAT_MAPPI2
161 default "02000000" if PLAT_USRV 166 default "02000000" if PLAT_USRV
162 default "01000000" if PLAT_M32700UT 167 default "01000000" if PLAT_M32700UT
diff --git a/arch/m32r/boot/compressed/m32r_sio.c b/arch/m32r/boot/compressed/m32r_sio.c
index bad5475eff90..8f9a57271f83 100644
--- a/arch/m32r/boot/compressed/m32r_sio.c
+++ b/arch/m32r/boot/compressed/m32r_sio.c
@@ -6,6 +6,7 @@
6 */ 6 */
7 7
8#include <linux/config.h> 8#include <linux/config.h>
9#include <asm/processor.h>
9 10
10static void putc(char c); 11static void putc(char c);
11 12
@@ -38,16 +39,17 @@ static int puts(const char *s)
38 39
39static void putc(char c) 40static void putc(char c)
40{ 41{
41 42 while ((*BOOT_SIO0STS & 0x3) != 0x3)
42 while ((*BOOT_SIO0STS & 0x3) != 0x3) ; 43 cpu_relax();
43 if (c == '\n') { 44 if (c == '\n') {
44 *BOOT_SIO0TXB = '\r'; 45 *BOOT_SIO0TXB = '\r';
45 while ((*BOOT_SIO0STS & 0x3) != 0x3) ; 46 while ((*BOOT_SIO0STS & 0x3) != 0x3)
47 cpu_relax();
46 } 48 }
47 *BOOT_SIO0TXB = c; 49 *BOOT_SIO0TXB = c;
48} 50}
49#else /* defined(CONFIG_PLAT_M32700UT_Alpha) || defined(CONFIG_PLAT_M32700UT) */ 51#else /* !(CONFIG_PLAT_M32700UT_Alpha) && !(CONFIG_PLAT_M32700UT) */
50#ifdef CONFIG_MMU 52#if defined(CONFIG_PLAT_MAPPI2)
51#define SIO0STS (volatile unsigned short *)(0xa0efd000 + 14) 53#define SIO0STS (volatile unsigned short *)(0xa0efd000 + 14)
52#define SIO0TXB (volatile unsigned short *)(0xa0efd000 + 30) 54#define SIO0TXB (volatile unsigned short *)(0xa0efd000 + 30)
53#else 55#else
@@ -57,11 +59,12 @@ static void putc(char c)
57 59
58static void putc(char c) 60static void putc(char c)
59{ 61{
60 62 while ((*SIO0STS & 0x1) == 0)
61 while ((*SIO0STS & 0x1) == 0) ; 63 cpu_relax();
62 if (c == '\n') { 64 if (c == '\n') {
63 *SIO0TXB = '\r'; 65 *SIO0TXB = '\r';
64 while ((*SIO0STS & 0x1) == 0) ; 66 while ((*SIO0STS & 0x1) == 0)
67 cpu_relax();
65 } 68 }
66 *SIO0TXB = c; 69 *SIO0TXB = c;
67} 70}
diff --git a/arch/m32r/defconfig b/arch/m32r/defconfig
index 417c95ba87e9..853093093168 100644
--- a/arch/m32r/defconfig
+++ b/arch/m32r/defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc4 3# Linux kernel version: 2.6.12-rc5
4# Wed Feb 16 21:10:44 2005 4# Fri Jun 3 16:20:11 2005
5# 5#
6CONFIG_M32R=y 6CONFIG_M32R=y
7# CONFIG_UID16 is not set 7# CONFIG_UID16 is not set
@@ -16,6 +16,7 @@ CONFIG_EXPERIMENTAL=y
16CONFIG_CLEAN_COMPILE=y 16CONFIG_CLEAN_COMPILE=y
17CONFIG_BROKEN_ON_SMP=y 17CONFIG_BROKEN_ON_SMP=y
18CONFIG_LOCK_KERNEL=y 18CONFIG_LOCK_KERNEL=y
19CONFIG_INIT_ENV_ARG_LIMIT=32
19 20
20# 21#
21# General setup 22# General setup
@@ -28,13 +29,15 @@ CONFIG_BSD_PROCESS_ACCT=y
28# CONFIG_BSD_PROCESS_ACCT_V3 is not set 29# CONFIG_BSD_PROCESS_ACCT_V3 is not set
29CONFIG_SYSCTL=y 30CONFIG_SYSCTL=y
30# CONFIG_AUDIT is not set 31# CONFIG_AUDIT is not set
31CONFIG_LOG_BUF_SHIFT=14
32CONFIG_HOTPLUG=y 32CONFIG_HOTPLUG=y
33CONFIG_KOBJECT_UEVENT=y 33CONFIG_KOBJECT_UEVENT=y
34CONFIG_IKCONFIG=y 34CONFIG_IKCONFIG=y
35# CONFIG_IKCONFIG_PROC is not set 35# CONFIG_IKCONFIG_PROC is not set
36CONFIG_EMBEDDED=y 36CONFIG_EMBEDDED=y
37# CONFIG_KALLSYMS is not set 37# CONFIG_KALLSYMS is not set
38CONFIG_PRINTK=y
39CONFIG_BUG=y
40CONFIG_BASE_FULL=y
38# CONFIG_FUTEX is not set 41# CONFIG_FUTEX is not set
39# CONFIG_EPOLL is not set 42# CONFIG_EPOLL is not set
40# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 43# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
@@ -44,6 +47,7 @@ CONFIG_CC_ALIGN_LABELS=0
44CONFIG_CC_ALIGN_LOOPS=0 47CONFIG_CC_ALIGN_LOOPS=0
45CONFIG_CC_ALIGN_JUMPS=0 48CONFIG_CC_ALIGN_JUMPS=0
46# CONFIG_TINY_SHMEM is not set 49# CONFIG_TINY_SHMEM is not set
50CONFIG_BASE_SMALL=0
47 51
48# 52#
49# Loadable module support 53# Loadable module support
@@ -65,6 +69,7 @@ CONFIG_PLAT_M32700UT=y
65# CONFIG_PLAT_OPSPUT is not set 69# CONFIG_PLAT_OPSPUT is not set
66# CONFIG_PLAT_OAKS32R is not set 70# CONFIG_PLAT_OAKS32R is not set
67# CONFIG_PLAT_MAPPI2 is not set 71# CONFIG_PLAT_MAPPI2 is not set
72# CONFIG_PLAT_MAPPI3 is not set
68CONFIG_CHIP_M32700=y 73CONFIG_CHIP_M32700=y
69# CONFIG_CHIP_M32102 is not set 74# CONFIG_CHIP_M32102 is not set
70# CONFIG_CHIP_VDEC2 is not set 75# CONFIG_CHIP_VDEC2 is not set
@@ -268,7 +273,6 @@ CONFIG_NET=y
268# 273#
269CONFIG_PACKET=y 274CONFIG_PACKET=y
270# CONFIG_PACKET_MMAP is not set 275# CONFIG_PACKET_MMAP is not set
271# CONFIG_NETLINK_DEV is not set
272CONFIG_UNIX=y 276CONFIG_UNIX=y
273# CONFIG_NET_KEY is not set 277# CONFIG_NET_KEY is not set
274CONFIG_INET=y 278CONFIG_INET=y
@@ -393,18 +397,6 @@ CONFIG_INPUT=y
393# CONFIG_INPUT_EVBUG is not set 397# CONFIG_INPUT_EVBUG is not set
394 398
395# 399#
396# Input I/O drivers
397#
398# CONFIG_GAMEPORT is not set
399CONFIG_SOUND_GAMEPORT=y
400CONFIG_SERIO=y
401# CONFIG_SERIO_I8042 is not set
402CONFIG_SERIO_SERPORT=y
403# CONFIG_SERIO_CT82C710 is not set
404# CONFIG_SERIO_LIBPS2 is not set
405# CONFIG_SERIO_RAW is not set
406
407#
408# Input Device Drivers 400# Input Device Drivers
409# 401#
410# CONFIG_INPUT_KEYBOARD is not set 402# CONFIG_INPUT_KEYBOARD is not set
@@ -414,6 +406,17 @@ CONFIG_SERIO_SERPORT=y
414# CONFIG_INPUT_MISC is not set 406# CONFIG_INPUT_MISC is not set
415 407
416# 408#
409# Hardware I/O ports
410#
411CONFIG_SERIO=y
412# CONFIG_SERIO_I8042 is not set
413CONFIG_SERIO_SERPORT=y
414# CONFIG_SERIO_LIBPS2 is not set
415# CONFIG_SERIO_RAW is not set
416# CONFIG_GAMEPORT is not set
417CONFIG_SOUND_GAMEPORT=y
418
419#
417# Character devices 420# Character devices
418# 421#
419CONFIG_VT=y 422CONFIG_VT=y
@@ -465,6 +468,10 @@ CONFIG_DS1302=y
465# CONFIG_RAW_DRIVER is not set 468# CONFIG_RAW_DRIVER is not set
466 469
467# 470#
471# TPM devices
472#
473
474#
468# I2C support 475# I2C support
469# 476#
470# CONFIG_I2C is not set 477# CONFIG_I2C is not set
@@ -508,8 +515,14 @@ CONFIG_VIDEO_M32R_AR_M64278=y
508# Graphics support 515# Graphics support
509# 516#
510CONFIG_FB=y 517CONFIG_FB=y
518# CONFIG_FB_CFB_FILLRECT is not set
519# CONFIG_FB_CFB_COPYAREA is not set
520# CONFIG_FB_CFB_IMAGEBLIT is not set
521# CONFIG_FB_SOFT_CURSOR is not set
522# CONFIG_FB_MACMODES is not set
511# CONFIG_FB_MODE_HELPERS is not set 523# CONFIG_FB_MODE_HELPERS is not set
512# CONFIG_FB_TILEBLITTING is not set 524# CONFIG_FB_TILEBLITTING is not set
525# CONFIG_FB_S1D13XXX is not set
513# CONFIG_FB_VIRTUAL is not set 526# CONFIG_FB_VIRTUAL is not set
514 527
515# 528#
@@ -543,10 +556,6 @@ CONFIG_LOGO_LINUX_CLUT224=y
543# CONFIG_USB_ARCH_HAS_OHCI is not set 556# CONFIG_USB_ARCH_HAS_OHCI is not set
544 557
545# 558#
546# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
547#
548
549#
550# USB Gadget Support 559# USB Gadget Support
551# 560#
552# CONFIG_USB_GADGET is not set 561# CONFIG_USB_GADGET is not set
@@ -719,8 +728,9 @@ CONFIG_NLS_DEFAULT="iso8859-1"
719# 728#
720# Kernel hacking 729# Kernel hacking
721# 730#
731# CONFIG_PRINTK_TIME is not set
722# CONFIG_DEBUG_KERNEL is not set 732# CONFIG_DEBUG_KERNEL is not set
723CONFIG_DEBUG_PREEMPT=y 733CONFIG_LOG_BUF_SHIFT=14
724# CONFIG_DEBUG_BUGVERBOSE is not set 734# CONFIG_DEBUG_BUGVERBOSE is not set
725# CONFIG_FRAME_POINTER is not set 735# CONFIG_FRAME_POINTER is not set
726 736
diff --git a/arch/m32r/kernel/Makefile b/arch/m32r/kernel/Makefile
index cfd690bf6d8a..6c6b6c376638 100644
--- a/arch/m32r/kernel/Makefile
+++ b/arch/m32r/kernel/Makefile
@@ -10,6 +10,7 @@ obj-y := process.o entry.o traps.o align.o irq.o setup.o time.o \
10obj-$(CONFIG_SMP) += smp.o smpboot.o 10obj-$(CONFIG_SMP) += smp.o smpboot.o
11obj-$(CONFIG_PLAT_MAPPI) += setup_mappi.o io_mappi.o 11obj-$(CONFIG_PLAT_MAPPI) += setup_mappi.o io_mappi.o
12obj-$(CONFIG_PLAT_MAPPI2) += setup_mappi2.o io_mappi2.o 12obj-$(CONFIG_PLAT_MAPPI2) += setup_mappi2.o io_mappi2.o
13obj-$(CONFIG_PLAT_MAPPI3) += setup_mappi3.o io_mappi3.o
13obj-$(CONFIG_PLAT_USRV) += setup_usrv.o io_usrv.o 14obj-$(CONFIG_PLAT_USRV) += setup_usrv.o io_usrv.o
14obj-$(CONFIG_PLAT_M32700UT) += setup_m32700ut.o io_m32700ut.o 15obj-$(CONFIG_PLAT_M32700UT) += setup_m32700ut.o io_m32700ut.o
15obj-$(CONFIG_PLAT_OPSPUT) += setup_opsput.o io_opsput.o 16obj-$(CONFIG_PLAT_OPSPUT) += setup_opsput.o io_opsput.o
@@ -17,4 +18,3 @@ obj-$(CONFIG_MODULES) += module.o
17obj-$(CONFIG_PLAT_OAKS32R) += setup_oaks32r.o io_oaks32r.o 18obj-$(CONFIG_PLAT_OAKS32R) += setup_oaks32r.o io_oaks32r.o
18 19
19EXTRA_AFLAGS := -traditional 20EXTRA_AFLAGS := -traditional
20
diff --git a/arch/m32r/kernel/io_m32700ut.c b/arch/m32r/kernel/io_m32700ut.c
index 371ba904e968..e545b065f7e9 100644
--- a/arch/m32r/kernel/io_m32700ut.c
+++ b/arch/m32r/kernel/io_m32700ut.c
@@ -3,8 +3,8 @@
3 * 3 *
4 * Typical I/O routines for M32700UT board. 4 * Typical I/O routines for M32700UT board.
5 * 5 *
6 * Copyright (c) 2001, 2002 Hiroyuki Kondo, Hirokazu Takata, 6 * Copyright (c) 2001-2005 Hiroyuki Kondo, Hirokazu Takata,
7 * Hitoshi Yamamoto, Takeo Takahashi 7 * Hitoshi Yamamoto, Takeo Takahashi
8 * 8 *
9 * This file is subject to the terms and conditions of the GNU General 9 * This file is subject to the terms and conditions of the GNU General
10 * Public License. See the file "COPYING" in the main directory of this 10 * Public License. See the file "COPYING" in the main directory of this
@@ -172,64 +172,21 @@ unsigned long _inl(unsigned long port)
172 172
173unsigned char _inb_p(unsigned long port) 173unsigned char _inb_p(unsigned long port)
174{ 174{
175 unsigned char v; 175 unsigned char v = _inb(port);
176
177 if (port >= LAN_IOSTART && port < LAN_IOEND)
178 v = _ne_inb(PORT2ADDR_NE(port));
179 else
180#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC)
181 if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) {
182 return *(volatile unsigned char *)__port2addr_ata(port);
183 } else
184#endif
185#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC)
186 if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) {
187 unsigned char b;
188 pcc_ioread_byte(0, port, &b, sizeof(b), 1, 0);
189 return b;
190 } else
191#endif
192 v = *(volatile unsigned char *)PORT2ADDR(port);
193
194 delay(); 176 delay();
195 return (v); 177 return (v);
196} 178}
197 179
198unsigned short _inw_p(unsigned long port) 180unsigned short _inw_p(unsigned long port)
199{ 181{
200 unsigned short v; 182 unsigned short v = _inw(port);
201
202 if (port >= LAN_IOSTART && port < LAN_IOEND)
203 v = _ne_inw(PORT2ADDR_NE(port));
204 else
205#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC)
206 if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) {
207 return *(volatile unsigned short *)__port2addr_ata(port);
208 } else
209#endif
210#if defined(CONFIG_USB)
211 if(port >= 0x340 && port < 0x3a0)
212 return *(volatile unsigned short *)PORT2ADDR_USB(port);
213 else
214#endif
215#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC)
216 if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) {
217 unsigned short w;
218 pcc_ioread_word(0, port, &w, sizeof(w), 1, 0);
219 return w;
220 } else
221#endif
222 v = *(volatile unsigned short *)PORT2ADDR(port);
223
224 delay(); 183 delay();
225 return (v); 184 return (v);
226} 185}
227 186
228unsigned long _inl_p(unsigned long port) 187unsigned long _inl_p(unsigned long port)
229{ 188{
230 unsigned long v; 189 unsigned long v = _inl(port);
231
232 v = *(volatile unsigned long *)PORT2ADDR(port);
233 delay(); 190 delay();
234 return (v); 191 return (v);
235} 192}
@@ -287,52 +244,19 @@ void _outl(unsigned long l, unsigned long port)
287 244
288void _outb_p(unsigned char b, unsigned long port) 245void _outb_p(unsigned char b, unsigned long port)
289{ 246{
290 if (port >= LAN_IOSTART && port < LAN_IOEND) 247 _outb(b, port);
291 _ne_outb(b, PORT2ADDR_NE(port));
292 else
293#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC)
294 if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) {
295 *(volatile unsigned char *)__port2addr_ata(port) = b;
296 } else
297#endif
298#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC)
299 if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) {
300 pcc_iowrite_byte(0, port, &b, sizeof(b), 1, 0);
301 } else
302#endif
303 *(volatile unsigned char *)PORT2ADDR(port) = b;
304
305 delay(); 248 delay();
306} 249}
307 250
308void _outw_p(unsigned short w, unsigned long port) 251void _outw_p(unsigned short w, unsigned long port)
309{ 252{
310 if (port >= LAN_IOSTART && port < LAN_IOEND) 253 _outw(w, port);
311 _ne_outw(w, PORT2ADDR_NE(port));
312 else
313#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC)
314 if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) {
315 *(volatile unsigned short *)__port2addr_ata(port) = w;
316 } else
317#endif
318#if defined(CONFIG_USB)
319 if(port >= 0x340 && port < 0x3a0)
320 *(volatile unsigned short *)PORT2ADDR_USB(port) = w;
321 else
322#endif
323#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC)
324 if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) {
325 pcc_iowrite_word(0, port, &w, sizeof(w), 1, 0);
326 } else
327#endif
328 *(volatile unsigned short *)PORT2ADDR(port) = w;
329
330 delay(); 254 delay();
331} 255}
332 256
333void _outl_p(unsigned long l, unsigned long port) 257void _outl_p(unsigned long l, unsigned long port)
334{ 258{
335 *(volatile unsigned long *)PORT2ADDR(port) = l; 259 _outl(l, port);
336 delay(); 260 delay();
337} 261}
338 262
diff --git a/arch/m32r/kernel/io_mappi.c b/arch/m32r/kernel/io_mappi.c
index 85688ffb52f9..78033165fb5c 100644
--- a/arch/m32r/kernel/io_mappi.c
+++ b/arch/m32r/kernel/io_mappi.c
@@ -3,8 +3,8 @@
3 * 3 *
4 * Typical I/O routines for Mappi board. 4 * Typical I/O routines for Mappi board.
5 * 5 *
6 * Copyright (c) 2001, 2002 Hiroyuki Kondo, Hirokazu Takata, 6 * Copyright (c) 2001-2005 Hiroyuki Kondo, Hirokazu Takata,
7 * Hitoshi Yamamoto 7 * Hitoshi Yamamoto
8 */ 8 */
9 9
10#include <linux/config.h> 10#include <linux/config.h>
@@ -130,57 +130,21 @@ unsigned long _inl(unsigned long port)
130 130
131unsigned char _inb_p(unsigned long port) 131unsigned char _inb_p(unsigned long port)
132{ 132{
133 unsigned char v; 133 unsigned char v = _inb(port);
134
135 if (port >= 0x300 && port < 0x320)
136 v = _ne_inb(PORT2ADDR_NE(port));
137 else
138#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_PCC)
139 if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) {
140 unsigned char b;
141 pcc_ioread(0, port, &b, sizeof(b), 1, 0);
142 return b;
143 } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) {
144 unsigned char b;
145 pcc_ioread(1, port, &b, sizeof(b), 1, 0);
146 return b;
147 } else
148#endif
149 v = *(volatile unsigned char *)PORT2ADDR(port);
150
151 delay(); 134 delay();
152 return (v); 135 return (v);
153} 136}
154 137
155unsigned short _inw_p(unsigned long port) 138unsigned short _inw_p(unsigned long port)
156{ 139{
157 unsigned short v; 140 unsigned short v = _inw(port);
158
159 if (port >= 0x300 && port < 0x320)
160 v = _ne_inw(PORT2ADDR_NE(port));
161 else
162#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_PCC)
163 if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) {
164 unsigned short w;
165 pcc_ioread(0, port, &w, sizeof(w), 1, 0);
166 return w;
167 } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) {
168 unsigned short w;
169 pcc_ioread(1, port, &w, sizeof(w), 1, 0);
170 return w;
171 } else
172#endif
173 v = *(volatile unsigned short *)PORT2ADDR(port);
174
175 delay(); 141 delay();
176 return (v); 142 return (v);
177} 143}
178 144
179unsigned long _inl_p(unsigned long port) 145unsigned long _inl_p(unsigned long port)
180{ 146{
181 unsigned long v; 147 unsigned long v = _inl(port);
182
183 v = *(volatile unsigned long *)PORT2ADDR(port);
184 delay(); 148 delay();
185 return (v); 149 return (v);
186} 150}
@@ -229,41 +193,19 @@ void _outl(unsigned long l, unsigned long port)
229 193
230void _outb_p(unsigned char b, unsigned long port) 194void _outb_p(unsigned char b, unsigned long port)
231{ 195{
232 if (port >= 0x300 && port < 0x320) 196 _outb(b, port);
233 _ne_outb(b, PORT2ADDR_NE(port));
234 else
235#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_PCC)
236 if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) {
237 pcc_iowrite(0, port, &b, sizeof(b), 1, 0);
238 } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) {
239 pcc_iowrite(1, port, &b, sizeof(b), 1, 0);
240 } else
241#endif
242 *(volatile unsigned char *)PORT2ADDR(port) = b;
243
244 delay(); 197 delay();
245} 198}
246 199
247void _outw_p(unsigned short w, unsigned long port) 200void _outw_p(unsigned short w, unsigned long port)
248{ 201{
249 if (port >= 0x300 && port < 0x320) 202 _outw(w, port);
250 _ne_outw(w, PORT2ADDR_NE(port));
251 else
252#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_PCC)
253 if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) {
254 pcc_iowrite(0, port, &w, sizeof(w), 1, 0);
255 } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) {
256 pcc_iowrite(1, port, &w, sizeof(w), 1, 0);
257 } else
258#endif
259 *(volatile unsigned short *)PORT2ADDR(port) = w;
260
261 delay(); 203 delay();
262} 204}
263 205
264void _outl_p(unsigned long l, unsigned long port) 206void _outl_p(unsigned long l, unsigned long port)
265{ 207{
266 *(volatile unsigned long *)PORT2ADDR(port) = l; 208 _outl(l, port);
267 delay(); 209 delay();
268} 210}
269 211
diff --git a/arch/m32r/kernel/io_mappi2.c b/arch/m32r/kernel/io_mappi2.c
index 4182cd4f97c8..5c03504bf653 100644
--- a/arch/m32r/kernel/io_mappi2.c
+++ b/arch/m32r/kernel/io_mappi2.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Typical I/O routines for Mappi2 board. 4 * Typical I/O routines for Mappi2 board.
5 * 5 *
6 * Copyright (c) 2001-2003 Hiroyuki Kondo, Hirokazu Takata, 6 * Copyright (c) 2001-2005 Hiroyuki Kondo, Hirokazu Takata,
7 * Hitoshi Yamamoto, Mamoru Sakugawa 7 * Hitoshi Yamamoto, Mamoru Sakugawa
8 */ 8 */
9 9
@@ -25,7 +25,7 @@ extern void pcc_ioread_byte(int, unsigned long, void *, size_t, size_t, int);
25extern void pcc_ioread_word(int, unsigned long, void *, size_t, size_t, int); 25extern void pcc_ioread_word(int, unsigned long, void *, size_t, size_t, int);
26extern void pcc_iowrite_byte(int, unsigned long, void *, size_t, size_t, int); 26extern void pcc_iowrite_byte(int, unsigned long, void *, size_t, size_t, int);
27extern void pcc_iowrite_word(int, unsigned long, void *, size_t, size_t, int); 27extern void pcc_iowrite_word(int, unsigned long, void *, size_t, size_t, int);
28#endif /* CONFIG_PCMCIA && CONFIG_MAPPI2_CFC */ 28#endif /* CONFIG_PCMCIA && CONFIG_M32R_CFC */
29 29
30#define PORT2ADDR(port) _port2addr(port) 30#define PORT2ADDR(port) _port2addr(port)
31#define PORT2ADDR_NE(port) _port2addr_ne(port) 31#define PORT2ADDR_NE(port) _port2addr_ne(port)
@@ -169,64 +169,21 @@ unsigned long _inl(unsigned long port)
169 169
170unsigned char _inb_p(unsigned long port) 170unsigned char _inb_p(unsigned long port)
171{ 171{
172 unsigned char v; 172 unsigned char v = _inb(port);
173
174 if (port >= LAN_IOSTART && port < LAN_IOEND)
175 v = _ne_inb(PORT2ADDR_NE(port));
176 else
177#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC)
178 if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) {
179 return *(volatile unsigned char *)__port2addr_ata(port);
180 } else
181#endif
182#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC)
183 if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) {
184 unsigned char b;
185 pcc_ioread_byte(0, port, &b, sizeof(b), 1, 0);
186 return b;
187 } else
188#endif
189 v = *(volatile unsigned char *)PORT2ADDR(port);
190
191 delay(); 173 delay();
192 return (v); 174 return (v);
193} 175}
194 176
195unsigned short _inw_p(unsigned long port) 177unsigned short _inw_p(unsigned long port)
196{ 178{
197 unsigned short v; 179 unsigned short v = _inw(port);
198
199 if (port >= LAN_IOSTART && port < LAN_IOEND)
200 v = _ne_inw(PORT2ADDR_NE(port));
201 else
202#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC)
203 if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) {
204 return *(volatile unsigned short *)__port2addr_ata(port);
205 } else
206#endif
207#if defined(CONFIG_USB)
208 if (port >= 0x340 && port < 0x3a0)
209 v = *(volatile unsigned short *)PORT2ADDR_USB(port);
210 else
211#endif
212#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC)
213 if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) {
214 unsigned short w;
215 pcc_ioread_word(0, port, &w, sizeof(w), 1, 0);
216 return w;
217 } else
218#endif
219 v = *(volatile unsigned short *)PORT2ADDR(port);
220
221 delay(); 180 delay();
222 return (v); 181 return (v);
223} 182}
224 183
225unsigned long _inl_p(unsigned long port) 184unsigned long _inl_p(unsigned long port)
226{ 185{
227 unsigned long v; 186 unsigned long v = _inl(port);
228
229 v = *(volatile unsigned long *)PORT2ADDR(port);
230 delay(); 187 delay();
231 return (v); 188 return (v);
232} 189}
@@ -284,52 +241,19 @@ void _outl(unsigned long l, unsigned long port)
284 241
285void _outb_p(unsigned char b, unsigned long port) 242void _outb_p(unsigned char b, unsigned long port)
286{ 243{
287 if (port >= LAN_IOSTART && port < LAN_IOEND) 244 _outb(b, port);
288 _ne_outb(b, PORT2ADDR_NE(port));
289 else
290#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC)
291 if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) {
292 *(volatile unsigned char *)__port2addr_ata(port) = b;
293 } else
294#endif
295#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC)
296 if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) {
297 pcc_iowrite_byte(0, port, &b, sizeof(b), 1, 0);
298 } else
299#endif
300 *(volatile unsigned char *)PORT2ADDR(port) = b;
301
302 delay(); 245 delay();
303} 246}
304 247
305void _outw_p(unsigned short w, unsigned long port) 248void _outw_p(unsigned short w, unsigned long port)
306{ 249{
307 if (port >= LAN_IOSTART && port < LAN_IOEND) 250 _outw(w, port);
308 _ne_outw(w, PORT2ADDR_NE(port));
309 else
310#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC)
311 if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) {
312 *(volatile unsigned short *)__port2addr_ata(port) = w;
313 } else
314#endif
315#if defined(CONFIG_USB)
316 if (port >= 0x340 && port < 0x3a0)
317 *(volatile unsigned short *)PORT2ADDR_USB(port) = w;
318 else
319#endif
320#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC)
321 if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) {
322 pcc_iowrite_word(0, port, &w, sizeof(w), 1, 0);
323 } else
324#endif
325 *(volatile unsigned short *)PORT2ADDR(port) = w;
326
327 delay(); 251 delay();
328} 252}
329 253
330void _outl_p(unsigned long l, unsigned long port) 254void _outl_p(unsigned long l, unsigned long port)
331{ 255{
332 *(volatile unsigned long *)PORT2ADDR(port) = l; 256 _outl(l, port);
333 delay(); 257 delay();
334} 258}
335 259
diff --git a/arch/m32r/kernel/io_mappi3.c b/arch/m32r/kernel/io_mappi3.c
new file mode 100644
index 000000000000..c80bde657854
--- /dev/null
+++ b/arch/m32r/kernel/io_mappi3.c
@@ -0,0 +1,378 @@
1/*
2 * linux/arch/m32r/kernel/io_mappi3.c
3 *
4 * Typical I/O routines for Mappi3 board.
5 *
6 * Copyright (c) 2001-2005 Hiroyuki Kondo, Hirokazu Takata,
7 * Hitoshi Yamamoto, Mamoru Sakugawa
8 */
9
10#include <linux/config.h>
11#include <asm/m32r.h>
12#include <asm/page.h>
13#include <asm/io.h>
14#include <asm/byteorder.h>
15
16#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC)
17#include <linux/types.h>
18
19#define M32R_PCC_IOMAP_SIZE 0x1000
20
21#define M32R_PCC_IOSTART0 0x1000
22#define M32R_PCC_IOEND0 (M32R_PCC_IOSTART0 + M32R_PCC_IOMAP_SIZE - 1)
23
24extern void pcc_ioread_byte(int, unsigned long, void *, size_t, size_t, int);
25extern void pcc_ioread_word(int, unsigned long, void *, size_t, size_t, int);
26extern void pcc_iowrite_byte(int, unsigned long, void *, size_t, size_t, int);
27extern void pcc_iowrite_word(int, unsigned long, void *, size_t, size_t, int);
28#endif /* CONFIG_PCMCIA && CONFIG_M32R_CFC */
29
30#define PORT2ADDR(port) _port2addr(port)
31#define PORT2ADDR_NE(port) _port2addr_ne(port)
32#define PORT2ADDR_USB(port) _port2addr_usb(port)
33
34static inline void *_port2addr(unsigned long port)
35{
36 return (void *)(port + NONCACHE_OFFSET);
37}
38
39#define LAN_IOSTART 0x300
40#define LAN_IOEND 0x320
41
42#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC)
43static inline void *__port2addr_ata(unsigned long port)
44{
45 static int dummy_reg;
46
47 switch (port) {
48 case 0x1f0: return (void *)0xb4002000;
49 case 0x1f1: return (void *)0xb4012800;
50 case 0x1f2: return (void *)0xb4012002;
51 case 0x1f3: return (void *)0xb4012802;
52 case 0x1f4: return (void *)0xb4012004;
53 case 0x1f5: return (void *)0xb4012804;
54 case 0x1f6: return (void *)0xb4012006;
55 case 0x1f7: return (void *)0xb4012806;
56 case 0x3f6: return (void *)0xb401200e;
57 default: return (void *)&dummy_reg;
58 }
59}
60#endif
61
62static inline void *_port2addr_ne(unsigned long port)
63{
64 return (void *)(port + NONCACHE_OFFSET + 0x10000000);
65}
66
67static inline void *_port2addr_usb(unsigned long port)
68{
69 return (void *)(port + NONCACHE_OFFSET + 0x12000000);
70}
71static inline void delay(void)
72{
73 __asm__ __volatile__ ("push r0; \n\t pop r0;" : : :"memory");
74}
75
76/*
77 * NIC I/O function
78 */
79
80static inline unsigned char _ne_inb(void *portp)
81{
82 return (unsigned char) *(volatile unsigned char *)portp;
83}
84
85static inline unsigned short _ne_inw(void *portp)
86{
87 return (unsigned short)le16_to_cpu(*(volatile unsigned short *)portp);
88}
89
90static inline void _ne_insb(void *portp, void * addr, unsigned long count)
91{
92 unsigned char *buf = addr;
93
94 while (count--)
95 *buf++ = *(volatile unsigned char *)portp;
96}
97
98static inline void _ne_outb(unsigned char b, void *portp)
99{
100 *(volatile unsigned char *)portp = (unsigned char)b;
101}
102
103static inline void _ne_outw(unsigned short w, void *portp)
104{
105 *(volatile unsigned short *)portp = cpu_to_le16(w);
106}
107
108unsigned char _inb(unsigned long port)
109{
110 if (port >= LAN_IOSTART && port < LAN_IOEND)
111 return _ne_inb(PORT2ADDR_NE(port));
112#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC)
113 else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) {
114 return *(volatile unsigned char *)__port2addr_ata(port);
115 }
116#endif
117#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC)
118 else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) {
119 unsigned char b;
120 pcc_ioread_byte(0, port, &b, sizeof(b), 1, 0);
121 return b;
122 } else
123#endif
124 return *(volatile unsigned char *)PORT2ADDR(port);
125}
126
127unsigned short _inw(unsigned long port)
128{
129 if (port >= LAN_IOSTART && port < LAN_IOEND)
130 return _ne_inw(PORT2ADDR_NE(port));
131#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC)
132 else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) {
133 return *(volatile unsigned short *)__port2addr_ata(port);
134 }
135#endif
136#if defined(CONFIG_USB)
137 else if (port >= 0x340 && port < 0x3a0)
138 return *(volatile unsigned short *)PORT2ADDR_USB(port);
139#endif
140
141#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC)
142 else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) {
143 unsigned short w;
144 pcc_ioread_word(0, port, &w, sizeof(w), 1, 0);
145 return w;
146 } else
147#endif
148 return *(volatile unsigned short *)PORT2ADDR(port);
149}
150
151unsigned long _inl(unsigned long port)
152{
153#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC)
154 if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) {
155 unsigned long l;
156 pcc_ioread_word(0, port, &l, sizeof(l), 1, 0);
157 return l;
158 } else
159#endif
160 return *(volatile unsigned long *)PORT2ADDR(port);
161}
162
163unsigned char _inb_p(unsigned long port)
164{
165 unsigned char v = _inb(port);
166 delay();
167 return (v);
168}
169
170unsigned short _inw_p(unsigned long port)
171{
172 unsigned short v = _inw(port);
173 delay();
174 return (v);
175}
176
177unsigned long _inl_p(unsigned long port)
178{
179 unsigned long v = _inl(port);
180 delay();
181 return (v);
182}
183
184void _outb(unsigned char b, unsigned long port)
185{
186 if (port >= LAN_IOSTART && port < LAN_IOEND)
187 _ne_outb(b, PORT2ADDR_NE(port));
188 else
189#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC)
190 if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) {
191 *(volatile unsigned char *)__port2addr_ata(port) = b;
192 } else
193#endif
194#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC)
195 if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) {
196 pcc_iowrite_byte(0, port, &b, sizeof(b), 1, 0);
197 } else
198#endif
199 *(volatile unsigned char *)PORT2ADDR(port) = b;
200}
201
202void _outw(unsigned short w, unsigned long port)
203{
204 if (port >= LAN_IOSTART && port < LAN_IOEND)
205 _ne_outw(w, PORT2ADDR_NE(port));
206 else
207#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC)
208 if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) {
209 *(volatile unsigned short *)__port2addr_ata(port) = w;
210 } else
211#endif
212#if defined(CONFIG_USB)
213 if (port >= 0x340 && port < 0x3a0)
214 *(volatile unsigned short *)PORT2ADDR_USB(port) = w;
215 else
216#endif
217#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC)
218 if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) {
219 pcc_iowrite_word(0, port, &w, sizeof(w), 1, 0);
220 } else
221#endif
222 *(volatile unsigned short *)PORT2ADDR(port) = w;
223}
224
225void _outl(unsigned long l, unsigned long port)
226{
227#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC)
228 if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) {
229 pcc_iowrite_word(0, port, &l, sizeof(l), 1, 0);
230 } else
231#endif
232 *(volatile unsigned long *)PORT2ADDR(port) = l;
233}
234
235void _outb_p(unsigned char b, unsigned long port)
236{
237 _outb(b, port);
238 delay();
239}
240
241void _outw_p(unsigned short w, unsigned long port)
242{
243 _outw(w, port);
244 delay();
245}
246
247void _outl_p(unsigned long l, unsigned long port)
248{
249 _outl(l, port);
250 delay();
251}
252
253void _insb(unsigned int port, void * addr, unsigned long count)
254{
255 if (port >= LAN_IOSTART && port < LAN_IOEND)
256 _ne_insb(PORT2ADDR_NE(port), addr, count);
257#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC)
258 else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) {
259 unsigned char *buf = addr;
260 unsigned char *portp = __port2addr_ata(port);
261 while (count--)
262 *buf++ = *(volatile unsigned char *)portp;
263 }
264#endif
265#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC)
266 else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) {
267 pcc_ioread_byte(0, port, (void *)addr, sizeof(unsigned char),
268 count, 1);
269 }
270#endif
271 else {
272 unsigned char *buf = addr;
273 unsigned char *portp = PORT2ADDR(port);
274 while (count--)
275 *buf++ = *(volatile unsigned char *)portp;
276 }
277}
278
279void _insw(unsigned int port, void * addr, unsigned long count)
280{
281 unsigned short *buf = addr;
282 unsigned short *portp;
283
284 if (port >= LAN_IOSTART && port < LAN_IOEND) {
285 portp = PORT2ADDR_NE(port);
286 while (count--)
287 *buf++ = *(volatile unsigned short *)portp;
288#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC)
289 } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) {
290 pcc_ioread_word(9, port, (void *)addr, sizeof(unsigned short),
291 count, 1);
292#endif
293#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC)
294 } else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) {
295 portp = __port2addr_ata(port);
296 while (count--)
297 *buf++ = *(volatile unsigned short *)portp;
298#endif
299 } else {
300 portp = PORT2ADDR(port);
301 while (count--)
302 *buf++ = *(volatile unsigned short *)portp;
303 }
304}
305
306void _insl(unsigned int port, void * addr, unsigned long count)
307{
308 unsigned long *buf = addr;
309 unsigned long *portp;
310
311 portp = PORT2ADDR(port);
312 while (count--)
313 *buf++ = *(volatile unsigned long *)portp;
314}
315
316void _outsb(unsigned int port, const void * addr, unsigned long count)
317{
318 const unsigned char *buf = addr;
319 unsigned char *portp;
320
321 if (port >= LAN_IOSTART && port < LAN_IOEND) {
322 portp = PORT2ADDR_NE(port);
323 while (count--)
324 _ne_outb(*buf++, portp);
325#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC)
326 } else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) {
327 portp = __port2addr_ata(port);
328 while (count--)
329 *(volatile unsigned char *)portp = *buf++;
330#endif
331#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC)
332 } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) {
333 pcc_iowrite_byte(0, port, (void *)addr, sizeof(unsigned char),
334 count, 1);
335#endif
336 } else {
337 portp = PORT2ADDR(port);
338 while (count--)
339 *(volatile unsigned char *)portp = *buf++;
340 }
341}
342
343void _outsw(unsigned int port, const void * addr, unsigned long count)
344{
345 const unsigned short *buf = addr;
346 unsigned short *portp;
347
348 if (port >= LAN_IOSTART && port < LAN_IOEND) {
349 portp = PORT2ADDR_NE(port);
350 while (count--)
351 *(volatile unsigned short *)portp = *buf++;
352#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC)
353 } else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) {
354 portp = __port2addr_ata(port);
355 while (count--)
356 *(volatile unsigned short *)portp = *buf++;
357#endif
358#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC)
359 } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) {
360 pcc_iowrite_word(9, port, (void *)addr, sizeof(unsigned short),
361 count, 1);
362#endif
363 } else {
364 portp = PORT2ADDR(port);
365 while (count--)
366 *(volatile unsigned short *)portp = *buf++;
367 }
368}
369
370void _outsl(unsigned int port, const void * addr, unsigned long count)
371{
372 const unsigned long *buf = addr;
373 unsigned char *portp;
374
375 portp = PORT2ADDR(port);
376 while (count--)
377 *(volatile unsigned long *)portp = *buf++;
378}
diff --git a/arch/m32r/kernel/io_oaks32r.c b/arch/m32r/kernel/io_oaks32r.c
index 286964794d51..9997dddd24d7 100644
--- a/arch/m32r/kernel/io_oaks32r.c
+++ b/arch/m32r/kernel/io_oaks32r.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Typical I/O routines for OAKS32R board. 4 * Typical I/O routines for OAKS32R board.
5 * 5 *
6 * Copyright (c) 2001-2004 Hiroyuki Kondo, Hirokazu Takata, 6 * Copyright (c) 2001-2005 Hiroyuki Kondo, Hirokazu Takata,
7 * Hitoshi Yamamoto, Mamoru Sakugawa 7 * Hitoshi Yamamoto, Mamoru Sakugawa
8 */ 8 */
9 9
@@ -90,35 +90,21 @@ unsigned long _inl(unsigned long port)
90 90
91unsigned char _inb_p(unsigned long port) 91unsigned char _inb_p(unsigned long port)
92{ 92{
93 unsigned char v; 93 unsigned char v = _inb(port);
94
95 if (port >= 0x300 && port < 0x320)
96 v = _ne_inb(PORT2ADDR_NE(port));
97 else
98 v = *(volatile unsigned char *)PORT2ADDR(port);
99
100 delay(); 94 delay();
101 return (v); 95 return (v);
102} 96}
103 97
104unsigned short _inw_p(unsigned long port) 98unsigned short _inw_p(unsigned long port)
105{ 99{
106 unsigned short v; 100 unsigned short v = _inw(port);
107
108 if (port >= 0x300 && port < 0x320)
109 v = _ne_inw(PORT2ADDR_NE(port));
110 else
111 v = *(volatile unsigned short *)PORT2ADDR(port);
112
113 delay(); 101 delay();
114 return (v); 102 return (v);
115} 103}
116 104
117unsigned long _inl_p(unsigned long port) 105unsigned long _inl_p(unsigned long port)
118{ 106{
119 unsigned long v; 107 unsigned long v = _inl(port);
120
121 v = *(volatile unsigned long *)PORT2ADDR(port);
122 delay(); 108 delay();
123 return (v); 109 return (v);
124} 110}
@@ -146,27 +132,19 @@ void _outl(unsigned long l, unsigned long port)
146 132
147void _outb_p(unsigned char b, unsigned long port) 133void _outb_p(unsigned char b, unsigned long port)
148{ 134{
149 if (port >= 0x300 && port < 0x320) 135 _outb(b, port);
150 _ne_outb(b, PORT2ADDR_NE(port));
151 else
152 *(volatile unsigned char *)PORT2ADDR(port) = b;
153
154 delay(); 136 delay();
155} 137}
156 138
157void _outw_p(unsigned short w, unsigned long port) 139void _outw_p(unsigned short w, unsigned long port)
158{ 140{
159 if (port >= 0x300 && port < 0x320) 141 _outw(w, port);
160 _ne_outw(w, PORT2ADDR_NE(port));
161 else
162 *(volatile unsigned short *)PORT2ADDR(port) = w;
163
164 delay(); 142 delay();
165} 143}
166 144
167void _outl_p(unsigned long l, unsigned long port) 145void _outl_p(unsigned long l, unsigned long port)
168{ 146{
169 *(volatile unsigned long *)PORT2ADDR(port) = l; 147 _outl(l, port);
170 delay(); 148 delay();
171} 149}
172 150
diff --git a/arch/m32r/kernel/io_opsput.c b/arch/m32r/kernel/io_opsput.c
index aaf42f9f76da..e34951e8156f 100644
--- a/arch/m32r/kernel/io_opsput.c
+++ b/arch/m32r/kernel/io_opsput.c
@@ -1,10 +1,10 @@
1/* 1/*
2 * linux/arch/m32r/kernel/io_mappi.c 2 * linux/arch/m32r/kernel/io_opsput.c
3 * 3 *
4 * Typical I/O routines for OPSPUT board. 4 * Typical I/O routines for OPSPUT board.
5 * 5 *
6 * Copyright (c) 2001, 2002 Hiroyuki Kondo, Hirokazu Takata, 6 * Copyright (c) 2001-2005 Hiroyuki Kondo, Hirokazu Takata,
7 * Hitoshi Yamamoto, Takeo Takahashi 7 * Hitoshi Yamamoto, Takeo Takahashi
8 * 8 *
9 * This file is subject to the terms and conditions of the GNU General 9 * This file is subject to the terms and conditions of the GNU General
10 * Public License. See the file "COPYING" in the main directory of this 10 * Public License. See the file "COPYING" in the main directory of this
@@ -98,7 +98,6 @@ unsigned char _inb(unsigned long port)
98{ 98{
99 if (port >= LAN_IOSTART && port < LAN_IOEND) 99 if (port >= LAN_IOSTART && port < LAN_IOEND)
100 return _ne_inb(PORT2ADDR_NE(port)); 100 return _ne_inb(PORT2ADDR_NE(port));
101
102#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) 101#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC)
103 else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { 102 else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) {
104 unsigned char b; 103 unsigned char b;
@@ -118,7 +117,6 @@ unsigned short _inw(unsigned long port)
118 else if(port >= 0x340 && port < 0x3a0) 117 else if(port >= 0x340 && port < 0x3a0)
119 return *(volatile unsigned short *)PORT2ADDR_USB(port); 118 return *(volatile unsigned short *)PORT2ADDR_USB(port);
120#endif 119#endif
121
122#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) 120#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC)
123 else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { 121 else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) {
124 unsigned short w; 122 unsigned short w;
@@ -143,55 +141,21 @@ unsigned long _inl(unsigned long port)
143 141
144unsigned char _inb_p(unsigned long port) 142unsigned char _inb_p(unsigned long port)
145{ 143{
146 unsigned char v; 144 unsigned char v = _inb(port);
147
148 if (port >= LAN_IOSTART && port < LAN_IOEND)
149 v = _ne_inb(PORT2ADDR_NE(port));
150 else
151#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC)
152 if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) {
153 unsigned char b;
154 pcc_ioread_byte(0, port, &b, sizeof(b), 1, 0);
155 return b;
156 } else
157#endif
158 v = *(volatile unsigned char *)PORT2ADDR(port);
159
160 delay(); 145 delay();
161 return (v); 146 return (v);
162} 147}
163 148
164unsigned short _inw_p(unsigned long port) 149unsigned short _inw_p(unsigned long port)
165{ 150{
166 unsigned short v; 151 unsigned short v = _inw(port);
167
168 if (port >= LAN_IOSTART && port < LAN_IOEND)
169 v = _ne_inw(PORT2ADDR_NE(port));
170 else
171#if defined(CONFIG_USB)
172 if(port >= 0x340 && port < 0x3a0)
173 return *(volatile unsigned short *)PORT2ADDR_USB(port);
174 else
175#endif
176
177#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC)
178 if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) {
179 unsigned short w;
180 pcc_ioread_word(0, port, &w, sizeof(w), 1, 0);
181 return w;
182 } else
183#endif
184 v = *(volatile unsigned short *)PORT2ADDR(port);
185
186 delay(); 152 delay();
187 return (v); 153 return (v);
188} 154}
189 155
190unsigned long _inl_p(unsigned long port) 156unsigned long _inl_p(unsigned long port)
191{ 157{
192 unsigned long v; 158 unsigned long v = _inl(port);
193
194 v = *(volatile unsigned long *)PORT2ADDR(port);
195 delay(); 159 delay();
196 return (v); 160 return (v);
197} 161}
@@ -219,7 +183,6 @@ void _outw(unsigned short w, unsigned long port)
219 *(volatile unsigned short *)PORT2ADDR_USB(port) = w; 183 *(volatile unsigned short *)PORT2ADDR_USB(port) = w;
220 else 184 else
221#endif 185#endif
222
223#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) 186#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC)
224 if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { 187 if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) {
225 pcc_iowrite_word(0, port, &w, sizeof(w), 1, 0); 188 pcc_iowrite_word(0, port, &w, sizeof(w), 1, 0);
@@ -240,43 +203,19 @@ void _outl(unsigned long l, unsigned long port)
240 203
241void _outb_p(unsigned char b, unsigned long port) 204void _outb_p(unsigned char b, unsigned long port)
242{ 205{
243 if (port >= LAN_IOSTART && port < LAN_IOEND) 206 _outb(b, port);
244 _ne_outb(b, PORT2ADDR_NE(port));
245 else
246#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC)
247 if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) {
248 pcc_iowrite_byte(0, port, &b, sizeof(b), 1, 0);
249 } else
250#endif
251 *(volatile unsigned char *)PORT2ADDR(port) = b;
252
253 delay(); 207 delay();
254} 208}
255 209
256void _outw_p(unsigned short w, unsigned long port) 210void _outw_p(unsigned short w, unsigned long port)
257{ 211{
258 if (port >= LAN_IOSTART && port < LAN_IOEND) 212 _outw(w, port);
259 _ne_outw(w, PORT2ADDR_NE(port));
260 else
261#if defined(CONFIG_USB)
262 if(port >= 0x340 && port < 0x3a0)
263 *(volatile unsigned short *)PORT2ADDR_USB(port) = w;
264 else
265#endif
266
267#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC)
268 if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) {
269 pcc_iowrite_word(0, port, &w, sizeof(w), 1, 0);
270 } else
271#endif
272 *(volatile unsigned short *)PORT2ADDR(port) = w;
273
274 delay(); 213 delay();
275} 214}
276 215
277void _outl_p(unsigned long l, unsigned long port) 216void _outl_p(unsigned long l, unsigned long port)
278{ 217{
279 *(volatile unsigned long *)PORT2ADDR(port) = l; 218 _outl(l, port);
280 delay(); 219 delay();
281} 220}
282 221
diff --git a/arch/m32r/kernel/io_usrv.c b/arch/m32r/kernel/io_usrv.c
index 27928a0b99ed..9eb161dcc104 100644
--- a/arch/m32r/kernel/io_usrv.c
+++ b/arch/m32r/kernel/io_usrv.c
@@ -3,8 +3,8 @@
3 * 3 *
4 * Typical I/O routines for uServer board. 4 * Typical I/O routines for uServer board.
5 * 5 *
6 * Copyright (c) 2001 - 2003 Hiroyuki Kondo, Hirokazu Takata, 6 * Copyright (c) 2001-2005 Hiroyuki Kondo, Hirokazu Takata,
7 * Hitoshi Yamamoto, Takeo Takahashi 7 * Hitoshi Yamamoto, Takeo Takahashi
8 * 8 *
9 * This file is subject to the terms and conditions of the GNU General 9 * This file is subject to the terms and conditions of the GNU General
10 * Public License. See the file "COPYING" in the main directory of this 10 * Public License. See the file "COPYING" in the main directory of this
@@ -39,7 +39,7 @@ extern void pcc_iowrite_word(int, unsigned long, void *, size_t, size_t, int);
39 39
40#define PORT2ADDR(port) _port2addr(port) 40#define PORT2ADDR(port) _port2addr(port)
41 41
42static __inline__ void *_port2addr(unsigned long port) 42static inline void *_port2addr(unsigned long port)
43{ 43{
44#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE) 44#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
45 if (port >= UART0_IOSTART && port <= UART0_IOEND) 45 if (port >= UART0_IOSTART && port <= UART0_IOEND)
@@ -50,7 +50,7 @@ static __inline__ void *_port2addr(unsigned long port)
50 return (void *)(port + NONCACHE_OFFSET); 50 return (void *)(port + NONCACHE_OFFSET);
51} 51}
52 52
53static __inline__ void delay(void) 53static inline void delay(void)
54{ 54{
55 __asm__ __volatile__ ("push r0; \n\t pop r0;" : : :"memory"); 55 __asm__ __volatile__ ("push r0; \n\t pop r0;" : : :"memory");
56} 56}
@@ -87,39 +87,22 @@ unsigned long _inl(unsigned long port)
87 87
88unsigned char _inb_p(unsigned long port) 88unsigned char _inb_p(unsigned long port)
89{ 89{
90 unsigned char b; 90 unsigned char v = _inb(port);
91 91 delay();
92 if (port >= CFC_IOSTART && port <= CFC_IOEND) { 92 return v;
93 pcc_ioread_byte(0, port, &b, sizeof(b), 1, 0);
94 return b;
95 } else {
96 b = *(volatile unsigned char *)PORT2ADDR(port);
97 delay();
98 return b;
99 }
100} 93}
101 94
102unsigned short _inw_p(unsigned long port) 95unsigned short _inw_p(unsigned long port)
103{ 96{
104 unsigned short w; 97 unsigned short v = _inw(port);
105 98 delay();
106 if (port >= CFC_IOSTART && port <= CFC_IOEND) { 99 return v;
107 pcc_ioread_word(0, port, &w, sizeof(w), 1, 0);
108 return w;
109 } else {
110 w = *(volatile unsigned short *)PORT2ADDR(port);
111 delay();
112 return w;
113 }
114} 100}
115 101
116unsigned long _inl_p(unsigned long port) 102unsigned long _inl_p(unsigned long port)
117{ 103{
118 unsigned long v; 104 unsigned long v = _inl(port);
119
120 v = *(volatile unsigned long *)PORT2ADDR(port);
121 delay(); 105 delay();
122
123 return v; 106 return v;
124} 107}
125 108
@@ -149,25 +132,19 @@ void _outl(unsigned long l, unsigned long port)
149 132
150void _outb_p(unsigned char b, unsigned long port) 133void _outb_p(unsigned char b, unsigned long port)
151{ 134{
152 if (port >= CFC_IOSTART && port <= CFC_IOEND) 135 _outb(b, port);
153 pcc_iowrite_byte(0, port, &b, sizeof(b), 1, 0);
154 else
155 *(volatile unsigned char *)PORT2ADDR(port) = b;
156 delay(); 136 delay();
157} 137}
158 138
159void _outw_p(unsigned short w, unsigned long port) 139void _outw_p(unsigned short w, unsigned long port)
160{ 140{
161 if (port >= CFC_IOSTART && port <= CFC_IOEND) 141 _outw(w, port);
162 pcc_iowrite_word(0, port, &w, sizeof(w), 1, 0);
163 else
164 *(volatile unsigned short *)PORT2ADDR(port) = w;
165 delay(); 142 delay();
166} 143}
167 144
168void _outl_p(unsigned long l, unsigned long port) 145void _outl_p(unsigned long l, unsigned long port)
169{ 146{
170 *(volatile unsigned long *)PORT2ADDR(port) = l; 147 _outl(l, port);
171 delay(); 148 delay();
172} 149}
173 150
diff --git a/arch/m32r/kernel/setup.c b/arch/m32r/kernel/setup.c
index 4826cd6e40e8..ec5674727e7f 100644
--- a/arch/m32r/kernel/setup.c
+++ b/arch/m32r/kernel/setup.c
@@ -330,6 +330,8 @@ static int show_cpuinfo(struct seq_file *m, void *v)
330 seq_printf(m, "Machine\t\t: Mappi Evaluation board\n"); 330 seq_printf(m, "Machine\t\t: Mappi Evaluation board\n");
331#elif CONFIG_PLAT_MAPPI2 331#elif CONFIG_PLAT_MAPPI2
332 seq_printf(m, "Machine\t\t: Mappi-II Evaluation board\n"); 332 seq_printf(m, "Machine\t\t: Mappi-II Evaluation board\n");
333#elif CONFIG_PLAT_MAPPI3
334 seq_printf(m, "Machine\t\t: Mappi-III Evaluation board\n");
333#elif CONFIG_PLAT_M32700UT 335#elif CONFIG_PLAT_M32700UT
334 seq_printf(m, "Machine\t\t: M32700UT Evaluation board\n"); 336 seq_printf(m, "Machine\t\t: M32700UT Evaluation board\n");
335#elif CONFIG_PLAT_OPSPUT 337#elif CONFIG_PLAT_OPSPUT
diff --git a/arch/m32r/kernel/setup_m32700ut.c b/arch/m32r/kernel/setup_m32700ut.c
index 488aa87bab76..b014e2c1e524 100644
--- a/arch/m32r/kernel/setup_m32700ut.c
+++ b/arch/m32r/kernel/setup_m32700ut.c
@@ -78,13 +78,13 @@ static void shutdown_m32700ut_irq(unsigned int irq)
78 78
79static struct hw_interrupt_type m32700ut_irq_type = 79static struct hw_interrupt_type m32700ut_irq_type =
80{ 80{
81 "M32700UT-IRQ", 81 .typename = "M32700UT-IRQ",
82 startup_m32700ut_irq, 82 .startup = startup_m32700ut_irq,
83 shutdown_m32700ut_irq, 83 .shutdown = shutdown_m32700ut_irq,
84 enable_m32700ut_irq, 84 .enable = enable_m32700ut_irq,
85 disable_m32700ut_irq, 85 .disable = disable_m32700ut_irq,
86 mask_and_ack_m32700ut, 86 .ack = mask_and_ack_m32700ut,
87 end_m32700ut_irq 87 .end = end_m32700ut_irq
88}; 88};
89 89
90/* 90/*
@@ -155,13 +155,13 @@ static void shutdown_m32700ut_pld_irq(unsigned int irq)
155 155
156static struct hw_interrupt_type m32700ut_pld_irq_type = 156static struct hw_interrupt_type m32700ut_pld_irq_type =
157{ 157{
158 "M32700UT-PLD-IRQ", 158 .typename = "M32700UT-PLD-IRQ",
159 startup_m32700ut_pld_irq, 159 .startup = startup_m32700ut_pld_irq,
160 shutdown_m32700ut_pld_irq, 160 .shutdown = shutdown_m32700ut_pld_irq,
161 enable_m32700ut_pld_irq, 161 .enable = enable_m32700ut_pld_irq,
162 disable_m32700ut_pld_irq, 162 .disable = disable_m32700ut_pld_irq,
163 mask_and_ack_m32700ut_pld, 163 .ack = mask_and_ack_m32700ut_pld,
164 end_m32700ut_pld_irq 164 .end = end_m32700ut_pld_irq
165}; 165};
166 166
167/* 167/*
@@ -224,13 +224,13 @@ static void shutdown_m32700ut_lanpld_irq(unsigned int irq)
224 224
225static struct hw_interrupt_type m32700ut_lanpld_irq_type = 225static struct hw_interrupt_type m32700ut_lanpld_irq_type =
226{ 226{
227 "M32700UT-PLD-LAN-IRQ", 227 .typename = "M32700UT-PLD-LAN-IRQ",
228 startup_m32700ut_lanpld_irq, 228 .startup = startup_m32700ut_lanpld_irq,
229 shutdown_m32700ut_lanpld_irq, 229 .shutdown = shutdown_m32700ut_lanpld_irq,
230 enable_m32700ut_lanpld_irq, 230 .enable = enable_m32700ut_lanpld_irq,
231 disable_m32700ut_lanpld_irq, 231 .disable = disable_m32700ut_lanpld_irq,
232 mask_and_ack_m32700ut_lanpld, 232 .ack = mask_and_ack_m32700ut_lanpld,
233 end_m32700ut_lanpld_irq 233 .end = end_m32700ut_lanpld_irq
234}; 234};
235 235
236/* 236/*
@@ -293,13 +293,13 @@ static void shutdown_m32700ut_lcdpld_irq(unsigned int irq)
293 293
294static struct hw_interrupt_type m32700ut_lcdpld_irq_type = 294static struct hw_interrupt_type m32700ut_lcdpld_irq_type =
295{ 295{
296 "M32700UT-PLD-LCD-IRQ", 296 .typename = "M32700UT-PLD-LCD-IRQ",
297 startup_m32700ut_lcdpld_irq, 297 .startup = startup_m32700ut_lcdpld_irq,
298 shutdown_m32700ut_lcdpld_irq, 298 .shutdown = shutdown_m32700ut_lcdpld_irq,
299 enable_m32700ut_lcdpld_irq, 299 .enable = enable_m32700ut_lcdpld_irq,
300 disable_m32700ut_lcdpld_irq, 300 .disable = disable_m32700ut_lcdpld_irq,
301 mask_and_ack_m32700ut_lcdpld, 301 .ack = mask_and_ack_m32700ut_lcdpld,
302 end_m32700ut_lcdpld_irq 302 .end = end_m32700ut_lcdpld_irq
303}; 303};
304 304
305void __init init_IRQ(void) 305void __init init_IRQ(void)
diff --git a/arch/m32r/kernel/setup_mappi.c b/arch/m32r/kernel/setup_mappi.c
index 1e74110f0670..aaf8e569b930 100644
--- a/arch/m32r/kernel/setup_mappi.c
+++ b/arch/m32r/kernel/setup_mappi.c
@@ -70,13 +70,13 @@ static void shutdown_mappi_irq(unsigned int irq)
70 70
71static struct hw_interrupt_type mappi_irq_type = 71static struct hw_interrupt_type mappi_irq_type =
72{ 72{
73 "MAPPI-IRQ", 73 .typename = "MAPPI-IRQ",
74 startup_mappi_irq, 74 .startup = startup_mappi_irq,
75 shutdown_mappi_irq, 75 .shutdown = shutdown_mappi_irq,
76 enable_mappi_irq, 76 .enable = enable_mappi_irq,
77 disable_mappi_irq, 77 .disable = disable_mappi_irq,
78 mask_and_ack_mappi, 78 .ack = mask_and_ack_mappi,
79 end_mappi_irq 79 .end = end_mappi_irq
80}; 80};
81 81
82void __init init_IRQ(void) 82void __init init_IRQ(void)
diff --git a/arch/m32r/kernel/setup_mappi2.c b/arch/m32r/kernel/setup_mappi2.c
index 1904d465a507..38d5e9a41427 100644
--- a/arch/m32r/kernel/setup_mappi2.c
+++ b/arch/m32r/kernel/setup_mappi2.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/m32r/kernel/setup_mappi.c 2 * linux/arch/m32r/kernel/setup_mappi2.c
3 * 3 *
4 * Setup routines for Renesas MAPPI-II(M3A-ZA36) Board 4 * Setup routines for Renesas MAPPI-II(M3A-ZA36) Board
5 * 5 *
@@ -79,13 +79,13 @@ static void shutdown_mappi2_irq(unsigned int irq)
79 79
80static struct hw_interrupt_type mappi2_irq_type = 80static struct hw_interrupt_type mappi2_irq_type =
81{ 81{
82 "MAPPI2-IRQ", 82 .typename = "MAPPI2-IRQ",
83 startup_mappi2_irq, 83 .startup = startup_mappi2_irq,
84 shutdown_mappi2_irq, 84 .shutdown = shutdown_mappi2_irq,
85 enable_mappi2_irq, 85 .enable = enable_mappi2_irq,
86 disable_mappi2_irq, 86 .disable = disable_mappi2_irq,
87 mask_and_ack_mappi2, 87 .ack = mask_and_ack_mappi2,
88 end_mappi2_irq 88 .end = end_mappi2_irq
89}; 89};
90 90
91void __init init_IRQ(void) 91void __init init_IRQ(void)
@@ -156,7 +156,6 @@ void __init init_IRQ(void)
156 irq_desc[PLD_IRQ_CFIREQ].handler = &mappi2_irq_type; 156 irq_desc[PLD_IRQ_CFIREQ].handler = &mappi2_irq_type;
157 irq_desc[PLD_IRQ_CFIREQ].action = 0; 157 irq_desc[PLD_IRQ_CFIREQ].action = 0;
158 irq_desc[PLD_IRQ_CFIREQ].depth = 1; /* disable nested irq */ 158 irq_desc[PLD_IRQ_CFIREQ].depth = 1; /* disable nested irq */
159// icu_data[PLD_IRQ_CFIREQ].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD00;
160 icu_data[PLD_IRQ_CFIREQ].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD01; 159 icu_data[PLD_IRQ_CFIREQ].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD01;
161 disable_mappi2_irq(PLD_IRQ_CFIREQ); 160 disable_mappi2_irq(PLD_IRQ_CFIREQ);
162 161
@@ -167,7 +166,6 @@ void __init init_IRQ(void)
167 irq_desc[PLD_IRQ_CFC_INSERT].action = 0; 166 irq_desc[PLD_IRQ_CFC_INSERT].action = 0;
168 irq_desc[PLD_IRQ_CFC_INSERT].depth = 1; /* disable nested irq */ 167 irq_desc[PLD_IRQ_CFC_INSERT].depth = 1; /* disable nested irq */
169 icu_data[PLD_IRQ_CFC_INSERT].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD00; 168 icu_data[PLD_IRQ_CFC_INSERT].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD00;
170// icu_data[PLD_IRQ_CFC_INSERT].icucr = 0;
171 disable_mappi2_irq(PLD_IRQ_CFC_INSERT); 169 disable_mappi2_irq(PLD_IRQ_CFC_INSERT);
172 170
173 /* ICUCR42: CFC Eject */ 171 /* ICUCR42: CFC Eject */
@@ -176,9 +174,7 @@ void __init init_IRQ(void)
176 irq_desc[PLD_IRQ_CFC_EJECT].action = 0; 174 irq_desc[PLD_IRQ_CFC_EJECT].action = 0;
177 irq_desc[PLD_IRQ_CFC_EJECT].depth = 1; /* disable nested irq */ 175 irq_desc[PLD_IRQ_CFC_EJECT].depth = 1; /* disable nested irq */
178 icu_data[PLD_IRQ_CFC_EJECT].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10; 176 icu_data[PLD_IRQ_CFC_EJECT].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10;
179// icu_data[PLD_IRQ_CFC_EJECT].icucr = 0;
180 disable_mappi2_irq(PLD_IRQ_CFC_EJECT); 177 disable_mappi2_irq(PLD_IRQ_CFC_EJECT);
181
182#endif /* CONFIG_MAPPI2_CFC */ 178#endif /* CONFIG_MAPPI2_CFC */
183} 179}
184 180
diff --git a/arch/m32r/kernel/setup_mappi3.c b/arch/m32r/kernel/setup_mappi3.c
new file mode 100644
index 000000000000..3d60a85aaec5
--- /dev/null
+++ b/arch/m32r/kernel/setup_mappi3.c
@@ -0,0 +1,208 @@
1/*
2 * linux/arch/m32r/kernel/setup_mappi3.c
3 *
4 * Setup routines for Renesas MAPPI-III(M3A-2170) Board
5 *
6 * Copyright (c) 2001-2005 Hiroyuki Kondo, Hirokazu Takata,
7 * Hitoshi Yamamoto, Mamoru Sakugawa
8 */
9
10#include <linux/config.h>
11#include <linux/irq.h>
12#include <linux/kernel.h>
13#include <linux/init.h>
14#include <linux/device.h>
15
16#include <asm/system.h>
17#include <asm/m32r.h>
18#include <asm/io.h>
19
20#define irq2port(x) (M32R_ICU_CR1_PORTL + ((x - 1) * sizeof(unsigned long)))
21
22#ifndef CONFIG_SMP
23typedef struct {
24 unsigned long icucr; /* ICU Control Register */
25} icu_data_t;
26#endif /* CONFIG_SMP */
27
28icu_data_t icu_data[NR_IRQS];
29
30static void disable_mappi3_irq(unsigned int irq)
31{
32 unsigned long port, data;
33
34 if ((irq == 0) ||(irq >= NR_IRQS)) {
35 printk("bad irq 0x%08x\n", irq);
36 return;
37 }
38 port = irq2port(irq);
39 data = icu_data[irq].icucr|M32R_ICUCR_ILEVEL7;
40 outl(data, port);
41}
42
43static void enable_mappi3_irq(unsigned int irq)
44{
45 unsigned long port, data;
46
47 if ((irq == 0) ||(irq >= NR_IRQS)) {
48 printk("bad irq 0x%08x\n", irq);
49 return;
50 }
51 port = irq2port(irq);
52 data = icu_data[irq].icucr|M32R_ICUCR_IEN|M32R_ICUCR_ILEVEL6;
53 outl(data, port);
54}
55
56static void mask_and_ack_mappi3(unsigned int irq)
57{
58 disable_mappi3_irq(irq);
59}
60
61static void end_mappi3_irq(unsigned int irq)
62{
63 enable_mappi3_irq(irq);
64}
65
66static unsigned int startup_mappi3_irq(unsigned int irq)
67{
68 enable_mappi3_irq(irq);
69 return (0);
70}
71
72static void shutdown_mappi3_irq(unsigned int irq)
73{
74 unsigned long port;
75
76 port = irq2port(irq);
77 outl(M32R_ICUCR_ILEVEL7, port);
78}
79
80static struct hw_interrupt_type mappi3_irq_type =
81{
82 .typename = "MAPPI3-IRQ",
83 .startup = startup_mappi3_irq,
84 .shutdown = shutdown_mappi3_irq,
85 .enable = enable_mappi3_irq,
86 .disable = disable_mappi3_irq,
87 .ack = mask_and_ack_mappi3,
88 .end = end_mappi3_irq
89};
90
91void __init init_IRQ(void)
92{
93#if defined(CONFIG_SMC91X)
94 /* INT0 : LAN controller (SMC91111) */
95 irq_desc[M32R_IRQ_INT0].status = IRQ_DISABLED;
96 irq_desc[M32R_IRQ_INT0].handler = &mappi3_irq_type;
97 irq_desc[M32R_IRQ_INT0].action = 0;
98 irq_desc[M32R_IRQ_INT0].depth = 1;
99 icu_data[M32R_IRQ_INT0].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10;
100 disable_mappi3_irq(M32R_IRQ_INT0);
101#endif /* CONFIG_SMC91X */
102
103 /* MFT2 : system timer */
104 irq_desc[M32R_IRQ_MFT2].status = IRQ_DISABLED;
105 irq_desc[M32R_IRQ_MFT2].handler = &mappi3_irq_type;
106 irq_desc[M32R_IRQ_MFT2].action = 0;
107 irq_desc[M32R_IRQ_MFT2].depth = 1;
108 icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN;
109 disable_mappi3_irq(M32R_IRQ_MFT2);
110
111#ifdef CONFIG_SERIAL_M32R_SIO
112 /* SIO0_R : uart receive data */
113 irq_desc[M32R_IRQ_SIO0_R].status = IRQ_DISABLED;
114 irq_desc[M32R_IRQ_SIO0_R].handler = &mappi3_irq_type;
115 irq_desc[M32R_IRQ_SIO0_R].action = 0;
116 irq_desc[M32R_IRQ_SIO0_R].depth = 1;
117 icu_data[M32R_IRQ_SIO0_R].icucr = 0;
118 disable_mappi3_irq(M32R_IRQ_SIO0_R);
119
120 /* SIO0_S : uart send data */
121 irq_desc[M32R_IRQ_SIO0_S].status = IRQ_DISABLED;
122 irq_desc[M32R_IRQ_SIO0_S].handler = &mappi3_irq_type;
123 irq_desc[M32R_IRQ_SIO0_S].action = 0;
124 irq_desc[M32R_IRQ_SIO0_S].depth = 1;
125 icu_data[M32R_IRQ_SIO0_S].icucr = 0;
126 disable_mappi3_irq(M32R_IRQ_SIO0_S);
127 /* SIO1_R : uart receive data */
128 irq_desc[M32R_IRQ_SIO1_R].status = IRQ_DISABLED;
129 irq_desc[M32R_IRQ_SIO1_R].handler = &mappi3_irq_type;
130 irq_desc[M32R_IRQ_SIO1_R].action = 0;
131 irq_desc[M32R_IRQ_SIO1_R].depth = 1;
132 icu_data[M32R_IRQ_SIO1_R].icucr = 0;
133 disable_mappi3_irq(M32R_IRQ_SIO1_R);
134
135 /* SIO1_S : uart send data */
136 irq_desc[M32R_IRQ_SIO1_S].status = IRQ_DISABLED;
137 irq_desc[M32R_IRQ_SIO1_S].handler = &mappi3_irq_type;
138 irq_desc[M32R_IRQ_SIO1_S].action = 0;
139 irq_desc[M32R_IRQ_SIO1_S].depth = 1;
140 icu_data[M32R_IRQ_SIO1_S].icucr = 0;
141 disable_mappi3_irq(M32R_IRQ_SIO1_S);
142#endif /* CONFIG_M32R_USE_DBG_CONSOLE */
143
144#if defined(CONFIG_USB)
145 /* INT1 : USB Host controller interrupt */
146 irq_desc[M32R_IRQ_INT1].status = IRQ_DISABLED;
147 irq_desc[M32R_IRQ_INT1].handler = &mappi3_irq_type;
148 irq_desc[M32R_IRQ_INT1].action = 0;
149 irq_desc[M32R_IRQ_INT1].depth = 1;
150 icu_data[M32R_IRQ_INT1].icucr = M32R_ICUCR_ISMOD01;
151 disable_mappi3_irq(M32R_IRQ_INT1);
152#endif /* CONFIG_USB */
153
154 /* ICUCR40: CFC IREQ */
155 irq_desc[PLD_IRQ_CFIREQ].status = IRQ_DISABLED;
156 irq_desc[PLD_IRQ_CFIREQ].handler = &mappi3_irq_type;
157 irq_desc[PLD_IRQ_CFIREQ].action = 0;
158 irq_desc[PLD_IRQ_CFIREQ].depth = 1; /* disable nested irq */
159 icu_data[PLD_IRQ_CFIREQ].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD01;
160 disable_mappi3_irq(PLD_IRQ_CFIREQ);
161
162#if defined(CONFIG_M32R_CFC)
163 /* ICUCR41: CFC Insert */
164 irq_desc[PLD_IRQ_CFC_INSERT].status = IRQ_DISABLED;
165 irq_desc[PLD_IRQ_CFC_INSERT].handler = &mappi3_irq_type;
166 irq_desc[PLD_IRQ_CFC_INSERT].action = 0;
167 irq_desc[PLD_IRQ_CFC_INSERT].depth = 1; /* disable nested irq */
168 icu_data[PLD_IRQ_CFC_INSERT].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD00;
169 disable_mappi3_irq(PLD_IRQ_CFC_INSERT);
170
171 /* ICUCR42: CFC Eject */
172 irq_desc[PLD_IRQ_CFC_EJECT].status = IRQ_DISABLED;
173 irq_desc[PLD_IRQ_CFC_EJECT].handler = &mappi3_irq_type;
174 irq_desc[PLD_IRQ_CFC_EJECT].action = 0;
175 irq_desc[PLD_IRQ_CFC_EJECT].depth = 1; /* disable nested irq */
176 icu_data[PLD_IRQ_CFC_EJECT].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10;
177 disable_mappi3_irq(PLD_IRQ_CFC_EJECT);
178#endif /* CONFIG_M32R_CFC */
179}
180
181#define LAN_IOSTART 0x300
182#define LAN_IOEND 0x320
183static struct resource smc91x_resources[] = {
184 [0] = {
185 .start = (LAN_IOSTART),
186 .end = (LAN_IOEND),
187 .flags = IORESOURCE_MEM,
188 },
189 [1] = {
190 .start = M32R_IRQ_INT0,
191 .end = M32R_IRQ_INT0,
192 .flags = IORESOURCE_IRQ,
193 }
194};
195
196static struct platform_device smc91x_device = {
197 .name = "smc91x",
198 .id = 0,
199 .num_resources = ARRAY_SIZE(smc91x_resources),
200 .resource = smc91x_resources,
201};
202
203static int __init platform_init(void)
204{
205 platform_device_register(&smc91x_device);
206 return 0;
207}
208arch_initcall(platform_init);
diff --git a/arch/m32r/kernel/setup_oaks32r.c b/arch/m32r/kernel/setup_oaks32r.c
index b04834526c9a..d656640badc9 100644
--- a/arch/m32r/kernel/setup_oaks32r.c
+++ b/arch/m32r/kernel/setup_oaks32r.c
@@ -70,13 +70,13 @@ static void shutdown_oaks32r_irq(unsigned int irq)
70 70
71static struct hw_interrupt_type oaks32r_irq_type = 71static struct hw_interrupt_type oaks32r_irq_type =
72{ 72{
73 "OAKS32R-IRQ", 73 .typename = "OAKS32R-IRQ",
74 startup_oaks32r_irq, 74 .startup = startup_oaks32r_irq,
75 shutdown_oaks32r_irq, 75 .shutdown = shutdown_oaks32r_irq,
76 enable_oaks32r_irq, 76 .enable = enable_oaks32r_irq,
77 disable_oaks32r_irq, 77 .disable = disable_oaks32r_irq,
78 mask_and_ack_mappi, 78 .ack = mask_and_ack_mappi,
79 end_oaks32r_irq 79 .end = end_oaks32r_irq
80}; 80};
81 81
82void __init init_IRQ(void) 82void __init init_IRQ(void)
diff --git a/arch/m32r/kernel/setup_opsput.c b/arch/m32r/kernel/setup_opsput.c
index 84315e344c58..86f4cf2a86c3 100644
--- a/arch/m32r/kernel/setup_opsput.c
+++ b/arch/m32r/kernel/setup_opsput.c
@@ -79,13 +79,13 @@ static void shutdown_opsput_irq(unsigned int irq)
79 79
80static struct hw_interrupt_type opsput_irq_type = 80static struct hw_interrupt_type opsput_irq_type =
81{ 81{
82 "OPSPUT-IRQ", 82 .typename = "OPSPUT-IRQ",
83 startup_opsput_irq, 83 .startup = startup_opsput_irq,
84 shutdown_opsput_irq, 84 .shutdown = shutdown_opsput_irq,
85 enable_opsput_irq, 85 .enable = enable_opsput_irq,
86 disable_opsput_irq, 86 .disable = disable_opsput_irq,
87 mask_and_ack_opsput, 87 .ack = mask_and_ack_opsput,
88 end_opsput_irq 88 .end = end_opsput_irq
89}; 89};
90 90
91/* 91/*
@@ -156,13 +156,13 @@ static void shutdown_opsput_pld_irq(unsigned int irq)
156 156
157static struct hw_interrupt_type opsput_pld_irq_type = 157static struct hw_interrupt_type opsput_pld_irq_type =
158{ 158{
159 "OPSPUT-PLD-IRQ", 159 .typename = "OPSPUT-PLD-IRQ",
160 startup_opsput_pld_irq, 160 .startup = startup_opsput_pld_irq,
161 shutdown_opsput_pld_irq, 161 .shutdown = shutdown_opsput_pld_irq,
162 enable_opsput_pld_irq, 162 .enable = enable_opsput_pld_irq,
163 disable_opsput_pld_irq, 163 .disable = disable_opsput_pld_irq,
164 mask_and_ack_opsput_pld, 164 .ack = mask_and_ack_opsput_pld,
165 end_opsput_pld_irq 165 .end = end_opsput_pld_irq
166}; 166};
167 167
168/* 168/*
diff --git a/arch/m32r/kernel/setup_usrv.c b/arch/m32r/kernel/setup_usrv.c
index fe417be5e3e9..634741bf9d35 100644
--- a/arch/m32r/kernel/setup_usrv.c
+++ b/arch/m32r/kernel/setup_usrv.c
@@ -70,13 +70,13 @@ static void shutdown_mappi_irq(unsigned int irq)
70 70
71static struct hw_interrupt_type mappi_irq_type = 71static struct hw_interrupt_type mappi_irq_type =
72{ 72{
73 "M32700-IRQ", 73 .typename = "M32700-IRQ",
74 startup_mappi_irq, 74 .startup = startup_mappi_irq,
75 shutdown_mappi_irq, 75 .shutdown = shutdown_mappi_irq,
76 enable_mappi_irq, 76 .enable = enable_mappi_irq,
77 disable_mappi_irq, 77 .disable = disable_mappi_irq,
78 mask_and_ack_mappi, 78 .ack = mask_and_ack_mappi,
79 end_mappi_irq 79 .end = end_mappi_irq
80}; 80};
81 81
82/* 82/*
@@ -143,13 +143,13 @@ static void shutdown_m32700ut_pld_irq(unsigned int irq)
143 143
144static struct hw_interrupt_type m32700ut_pld_irq_type = 144static struct hw_interrupt_type m32700ut_pld_irq_type =
145{ 145{
146 "USRV-PLD-IRQ", 146 .typename = "USRV-PLD-IRQ",
147 startup_m32700ut_pld_irq, 147 .startup = startup_m32700ut_pld_irq,
148 shutdown_m32700ut_pld_irq, 148 .shutdown = shutdown_m32700ut_pld_irq,
149 enable_m32700ut_pld_irq, 149 .enable = enable_m32700ut_pld_irq,
150 disable_m32700ut_pld_irq, 150 .disable = disable_m32700ut_pld_irq,
151 mask_and_ack_m32700ut_pld, 151 .ack = mask_and_ack_m32700ut_pld,
152 end_m32700ut_pld_irq 152 .end = end_m32700ut_pld_irq
153}; 153};
154 154
155void __init init_IRQ(void) 155void __init init_IRQ(void)
diff --git a/arch/m32r/m32700ut/defconfig.m32700ut.smp b/arch/m32r/m32700ut/defconfig.m32700ut.smp
index 1c002181df7f..3e607d90b5f4 100644
--- a/arch/m32r/m32700ut/defconfig.m32700ut.smp
+++ b/arch/m32r/m32700ut/defconfig.m32700ut.smp
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc4 3# Linux kernel version: 2.6.12-rc5
4# Wed Feb 16 21:10:50 2005 4# Fri Jun 3 16:20:58 2005
5# 5#
6CONFIG_M32R=y 6CONFIG_M32R=y
7# CONFIG_UID16 is not set 7# CONFIG_UID16 is not set
@@ -15,6 +15,7 @@ CONFIG_GENERIC_IRQ_PROBE=y
15CONFIG_EXPERIMENTAL=y 15CONFIG_EXPERIMENTAL=y
16CONFIG_CLEAN_COMPILE=y 16CONFIG_CLEAN_COMPILE=y
17CONFIG_LOCK_KERNEL=y 17CONFIG_LOCK_KERNEL=y
18CONFIG_INIT_ENV_ARG_LIMIT=32
18 19
19# 20#
20# General setup 21# General setup
@@ -27,13 +28,16 @@ CONFIG_BSD_PROCESS_ACCT=y
27# CONFIG_BSD_PROCESS_ACCT_V3 is not set 28# CONFIG_BSD_PROCESS_ACCT_V3 is not set
28CONFIG_SYSCTL=y 29CONFIG_SYSCTL=y
29# CONFIG_AUDIT is not set 30# CONFIG_AUDIT is not set
30CONFIG_LOG_BUF_SHIFT=15
31CONFIG_HOTPLUG=y 31CONFIG_HOTPLUG=y
32CONFIG_KOBJECT_UEVENT=y 32CONFIG_KOBJECT_UEVENT=y
33CONFIG_IKCONFIG=y 33CONFIG_IKCONFIG=y
34# CONFIG_IKCONFIG_PROC is not set 34# CONFIG_IKCONFIG_PROC is not set
35# CONFIG_CPUSETS is not set
35CONFIG_EMBEDDED=y 36CONFIG_EMBEDDED=y
36# CONFIG_KALLSYMS is not set 37# CONFIG_KALLSYMS is not set
38CONFIG_PRINTK=y
39CONFIG_BUG=y
40CONFIG_BASE_FULL=y
37# CONFIG_FUTEX is not set 41# CONFIG_FUTEX is not set
38# CONFIG_EPOLL is not set 42# CONFIG_EPOLL is not set
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 43# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
@@ -43,6 +47,7 @@ CONFIG_CC_ALIGN_LABELS=0
43CONFIG_CC_ALIGN_LOOPS=0 47CONFIG_CC_ALIGN_LOOPS=0
44CONFIG_CC_ALIGN_JUMPS=0 48CONFIG_CC_ALIGN_JUMPS=0
45# CONFIG_TINY_SHMEM is not set 49# CONFIG_TINY_SHMEM is not set
50CONFIG_BASE_SMALL=0
46 51
47# 52#
48# Loadable module support 53# Loadable module support
@@ -65,6 +70,7 @@ CONFIG_PLAT_M32700UT=y
65# CONFIG_PLAT_OPSPUT is not set 70# CONFIG_PLAT_OPSPUT is not set
66# CONFIG_PLAT_OAKS32R is not set 71# CONFIG_PLAT_OAKS32R is not set
67# CONFIG_PLAT_MAPPI2 is not set 72# CONFIG_PLAT_MAPPI2 is not set
73# CONFIG_PLAT_MAPPI3 is not set
68CONFIG_CHIP_M32700=y 74CONFIG_CHIP_M32700=y
69# CONFIG_CHIP_M32102 is not set 75# CONFIG_CHIP_M32102 is not set
70# CONFIG_CHIP_VDEC2 is not set 76# CONFIG_CHIP_VDEC2 is not set
@@ -271,7 +277,6 @@ CONFIG_NET=y
271# 277#
272CONFIG_PACKET=y 278CONFIG_PACKET=y
273# CONFIG_PACKET_MMAP is not set 279# CONFIG_PACKET_MMAP is not set
274# CONFIG_NETLINK_DEV is not set
275CONFIG_UNIX=y 280CONFIG_UNIX=y
276# CONFIG_NET_KEY is not set 281# CONFIG_NET_KEY is not set
277CONFIG_INET=y 282CONFIG_INET=y
@@ -396,18 +401,6 @@ CONFIG_INPUT=y
396# CONFIG_INPUT_EVBUG is not set 401# CONFIG_INPUT_EVBUG is not set
397 402
398# 403#
399# Input I/O drivers
400#
401# CONFIG_GAMEPORT is not set
402CONFIG_SOUND_GAMEPORT=y
403CONFIG_SERIO=y
404# CONFIG_SERIO_I8042 is not set
405CONFIG_SERIO_SERPORT=y
406# CONFIG_SERIO_CT82C710 is not set
407# CONFIG_SERIO_LIBPS2 is not set
408# CONFIG_SERIO_RAW is not set
409
410#
411# Input Device Drivers 404# Input Device Drivers
412# 405#
413# CONFIG_INPUT_KEYBOARD is not set 406# CONFIG_INPUT_KEYBOARD is not set
@@ -417,6 +410,17 @@ CONFIG_SERIO_SERPORT=y
417# CONFIG_INPUT_MISC is not set 410# CONFIG_INPUT_MISC is not set
418 411
419# 412#
413# Hardware I/O ports
414#
415CONFIG_SERIO=y
416# CONFIG_SERIO_I8042 is not set
417CONFIG_SERIO_SERPORT=y
418# CONFIG_SERIO_LIBPS2 is not set
419# CONFIG_SERIO_RAW is not set
420# CONFIG_GAMEPORT is not set
421CONFIG_SOUND_GAMEPORT=y
422
423#
420# Character devices 424# Character devices
421# 425#
422CONFIG_VT=y 426CONFIG_VT=y
@@ -468,6 +472,10 @@ CONFIG_DS1302=y
468# CONFIG_RAW_DRIVER is not set 472# CONFIG_RAW_DRIVER is not set
469 473
470# 474#
475# TPM devices
476#
477
478#
471# I2C support 479# I2C support
472# 480#
473# CONFIG_I2C is not set 481# CONFIG_I2C is not set
@@ -511,8 +519,14 @@ CONFIG_VIDEO_M32R_AR_M64278=y
511# Graphics support 519# Graphics support
512# 520#
513CONFIG_FB=y 521CONFIG_FB=y
522# CONFIG_FB_CFB_FILLRECT is not set
523# CONFIG_FB_CFB_COPYAREA is not set
524# CONFIG_FB_CFB_IMAGEBLIT is not set
525# CONFIG_FB_SOFT_CURSOR is not set
526# CONFIG_FB_MACMODES is not set
514# CONFIG_FB_MODE_HELPERS is not set 527# CONFIG_FB_MODE_HELPERS is not set
515# CONFIG_FB_TILEBLITTING is not set 528# CONFIG_FB_TILEBLITTING is not set
529# CONFIG_FB_S1D13XXX is not set
516# CONFIG_FB_VIRTUAL is not set 530# CONFIG_FB_VIRTUAL is not set
517 531
518# 532#
@@ -546,10 +560,6 @@ CONFIG_LOGO_LINUX_CLUT224=y
546# CONFIG_USB_ARCH_HAS_OHCI is not set 560# CONFIG_USB_ARCH_HAS_OHCI is not set
547 561
548# 562#
549# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
550#
551
552#
553# USB Gadget Support 563# USB Gadget Support
554# 564#
555# CONFIG_USB_GADGET is not set 565# CONFIG_USB_GADGET is not set
@@ -722,8 +732,9 @@ CONFIG_NLS_DEFAULT="iso8859-1"
722# 732#
723# Kernel hacking 733# Kernel hacking
724# 734#
735# CONFIG_PRINTK_TIME is not set
725# CONFIG_DEBUG_KERNEL is not set 736# CONFIG_DEBUG_KERNEL is not set
726CONFIG_DEBUG_PREEMPT=y 737CONFIG_LOG_BUF_SHIFT=15
727# CONFIG_DEBUG_BUGVERBOSE is not set 738# CONFIG_DEBUG_BUGVERBOSE is not set
728# CONFIG_FRAME_POINTER is not set 739# CONFIG_FRAME_POINTER is not set
729 740
diff --git a/arch/m32r/m32700ut/defconfig.m32700ut.up b/arch/m32r/m32700ut/defconfig.m32700ut.up
index 805357f7bda1..2d3e7cda8f46 100644
--- a/arch/m32r/m32700ut/defconfig.m32700ut.up
+++ b/arch/m32r/m32700ut/defconfig.m32700ut.up
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc4 3# Linux kernel version: 2.6.12-rc5
4# Wed Feb 16 21:10:54 2005 4# Fri Jun 3 16:21:34 2005
5# 5#
6CONFIG_M32R=y 6CONFIG_M32R=y
7# CONFIG_UID16 is not set 7# CONFIG_UID16 is not set
@@ -16,6 +16,7 @@ CONFIG_EXPERIMENTAL=y
16CONFIG_CLEAN_COMPILE=y 16CONFIG_CLEAN_COMPILE=y
17CONFIG_BROKEN_ON_SMP=y 17CONFIG_BROKEN_ON_SMP=y
18CONFIG_LOCK_KERNEL=y 18CONFIG_LOCK_KERNEL=y
19CONFIG_INIT_ENV_ARG_LIMIT=32
19 20
20# 21#
21# General setup 22# General setup
@@ -28,13 +29,15 @@ CONFIG_BSD_PROCESS_ACCT=y
28# CONFIG_BSD_PROCESS_ACCT_V3 is not set 29# CONFIG_BSD_PROCESS_ACCT_V3 is not set
29CONFIG_SYSCTL=y 30CONFIG_SYSCTL=y
30# CONFIG_AUDIT is not set 31# CONFIG_AUDIT is not set
31CONFIG_LOG_BUF_SHIFT=14
32CONFIG_HOTPLUG=y 32CONFIG_HOTPLUG=y
33CONFIG_KOBJECT_UEVENT=y 33CONFIG_KOBJECT_UEVENT=y
34CONFIG_IKCONFIG=y 34CONFIG_IKCONFIG=y
35# CONFIG_IKCONFIG_PROC is not set 35# CONFIG_IKCONFIG_PROC is not set
36CONFIG_EMBEDDED=y 36CONFIG_EMBEDDED=y
37# CONFIG_KALLSYMS is not set 37# CONFIG_KALLSYMS is not set
38CONFIG_PRINTK=y
39CONFIG_BUG=y
40CONFIG_BASE_FULL=y
38# CONFIG_FUTEX is not set 41# CONFIG_FUTEX is not set
39# CONFIG_EPOLL is not set 42# CONFIG_EPOLL is not set
40# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 43# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
@@ -44,6 +47,7 @@ CONFIG_CC_ALIGN_LABELS=0
44CONFIG_CC_ALIGN_LOOPS=0 47CONFIG_CC_ALIGN_LOOPS=0
45CONFIG_CC_ALIGN_JUMPS=0 48CONFIG_CC_ALIGN_JUMPS=0
46# CONFIG_TINY_SHMEM is not set 49# CONFIG_TINY_SHMEM is not set
50CONFIG_BASE_SMALL=0
47 51
48# 52#
49# Loadable module support 53# Loadable module support
@@ -65,6 +69,7 @@ CONFIG_PLAT_M32700UT=y
65# CONFIG_PLAT_OPSPUT is not set 69# CONFIG_PLAT_OPSPUT is not set
66# CONFIG_PLAT_OAKS32R is not set 70# CONFIG_PLAT_OAKS32R is not set
67# CONFIG_PLAT_MAPPI2 is not set 71# CONFIG_PLAT_MAPPI2 is not set
72# CONFIG_PLAT_MAPPI3 is not set
68CONFIG_CHIP_M32700=y 73CONFIG_CHIP_M32700=y
69# CONFIG_CHIP_M32102 is not set 74# CONFIG_CHIP_M32102 is not set
70# CONFIG_CHIP_VDEC2 is not set 75# CONFIG_CHIP_VDEC2 is not set
@@ -268,7 +273,6 @@ CONFIG_NET=y
268# 273#
269CONFIG_PACKET=y 274CONFIG_PACKET=y
270# CONFIG_PACKET_MMAP is not set 275# CONFIG_PACKET_MMAP is not set
271# CONFIG_NETLINK_DEV is not set
272CONFIG_UNIX=y 276CONFIG_UNIX=y
273# CONFIG_NET_KEY is not set 277# CONFIG_NET_KEY is not set
274CONFIG_INET=y 278CONFIG_INET=y
@@ -393,18 +397,6 @@ CONFIG_INPUT=y
393# CONFIG_INPUT_EVBUG is not set 397# CONFIG_INPUT_EVBUG is not set
394 398
395# 399#
396# Input I/O drivers
397#
398# CONFIG_GAMEPORT is not set
399CONFIG_SOUND_GAMEPORT=y
400CONFIG_SERIO=y
401# CONFIG_SERIO_I8042 is not set
402CONFIG_SERIO_SERPORT=y
403# CONFIG_SERIO_CT82C710 is not set
404# CONFIG_SERIO_LIBPS2 is not set
405# CONFIG_SERIO_RAW is not set
406
407#
408# Input Device Drivers 400# Input Device Drivers
409# 401#
410# CONFIG_INPUT_KEYBOARD is not set 402# CONFIG_INPUT_KEYBOARD is not set
@@ -414,6 +406,17 @@ CONFIG_SERIO_SERPORT=y
414# CONFIG_INPUT_MISC is not set 406# CONFIG_INPUT_MISC is not set
415 407
416# 408#
409# Hardware I/O ports
410#
411CONFIG_SERIO=y
412# CONFIG_SERIO_I8042 is not set
413CONFIG_SERIO_SERPORT=y
414# CONFIG_SERIO_LIBPS2 is not set
415# CONFIG_SERIO_RAW is not set
416# CONFIG_GAMEPORT is not set
417CONFIG_SOUND_GAMEPORT=y
418
419#
417# Character devices 420# Character devices
418# 421#
419CONFIG_VT=y 422CONFIG_VT=y
@@ -465,6 +468,10 @@ CONFIG_DS1302=y
465# CONFIG_RAW_DRIVER is not set 468# CONFIG_RAW_DRIVER is not set
466 469
467# 470#
471# TPM devices
472#
473
474#
468# I2C support 475# I2C support
469# 476#
470# CONFIG_I2C is not set 477# CONFIG_I2C is not set
@@ -508,8 +515,14 @@ CONFIG_VIDEO_M32R_AR_M64278=y
508# Graphics support 515# Graphics support
509# 516#
510CONFIG_FB=y 517CONFIG_FB=y
518# CONFIG_FB_CFB_FILLRECT is not set
519# CONFIG_FB_CFB_COPYAREA is not set
520# CONFIG_FB_CFB_IMAGEBLIT is not set
521# CONFIG_FB_SOFT_CURSOR is not set
522# CONFIG_FB_MACMODES is not set
511# CONFIG_FB_MODE_HELPERS is not set 523# CONFIG_FB_MODE_HELPERS is not set
512# CONFIG_FB_TILEBLITTING is not set 524# CONFIG_FB_TILEBLITTING is not set
525# CONFIG_FB_S1D13XXX is not set
513# CONFIG_FB_VIRTUAL is not set 526# CONFIG_FB_VIRTUAL is not set
514 527
515# 528#
@@ -543,10 +556,6 @@ CONFIG_LOGO_LINUX_CLUT224=y
543# CONFIG_USB_ARCH_HAS_OHCI is not set 556# CONFIG_USB_ARCH_HAS_OHCI is not set
544 557
545# 558#
546# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
547#
548
549#
550# USB Gadget Support 559# USB Gadget Support
551# 560#
552# CONFIG_USB_GADGET is not set 561# CONFIG_USB_GADGET is not set
@@ -719,8 +728,9 @@ CONFIG_NLS_DEFAULT="iso8859-1"
719# 728#
720# Kernel hacking 729# Kernel hacking
721# 730#
731# CONFIG_PRINTK_TIME is not set
722# CONFIG_DEBUG_KERNEL is not set 732# CONFIG_DEBUG_KERNEL is not set
723CONFIG_DEBUG_PREEMPT=y 733CONFIG_LOG_BUF_SHIFT=14
724# CONFIG_DEBUG_BUGVERBOSE is not set 734# CONFIG_DEBUG_BUGVERBOSE is not set
725# CONFIG_FRAME_POINTER is not set 735# CONFIG_FRAME_POINTER is not set
726 736
diff --git a/arch/m32r/mappi/defconfig.nommu b/arch/m32r/mappi/defconfig.nommu
index 714aa6e7034c..a8425fba340b 100644
--- a/arch/m32r/mappi/defconfig.nommu
+++ b/arch/m32r/mappi/defconfig.nommu
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc4 3# Linux kernel version: 2.6.12-rc5
4# Wed Feb 16 21:10:57 2005 4# Fri Jun 3 16:21:46 2005
5# 5#
6CONFIG_M32R=y 6CONFIG_M32R=y
7# CONFIG_UID16 is not set 7# CONFIG_UID16 is not set
@@ -16,6 +16,7 @@ CONFIG_EXPERIMENTAL=y
16CONFIG_CLEAN_COMPILE=y 16CONFIG_CLEAN_COMPILE=y
17CONFIG_BROKEN_ON_SMP=y 17CONFIG_BROKEN_ON_SMP=y
18CONFIG_LOCK_KERNEL=y 18CONFIG_LOCK_KERNEL=y
19CONFIG_INIT_ENV_ARG_LIMIT=32
19 20
20# 21#
21# General setup 22# General setup
@@ -26,13 +27,15 @@ CONFIG_BSD_PROCESS_ACCT=y
26# CONFIG_BSD_PROCESS_ACCT_V3 is not set 27# CONFIG_BSD_PROCESS_ACCT_V3 is not set
27CONFIG_SYSCTL=y 28CONFIG_SYSCTL=y
28# CONFIG_AUDIT is not set 29# CONFIG_AUDIT is not set
29CONFIG_LOG_BUF_SHIFT=14
30CONFIG_HOTPLUG=y 30CONFIG_HOTPLUG=y
31CONFIG_KOBJECT_UEVENT=y 31CONFIG_KOBJECT_UEVENT=y
32CONFIG_IKCONFIG=y 32CONFIG_IKCONFIG=y
33# CONFIG_IKCONFIG_PROC is not set 33# CONFIG_IKCONFIG_PROC is not set
34CONFIG_EMBEDDED=y 34CONFIG_EMBEDDED=y
35# CONFIG_KALLSYMS is not set 35# CONFIG_KALLSYMS is not set
36CONFIG_PRINTK=y
37CONFIG_BUG=y
38CONFIG_BASE_FULL=y
36# CONFIG_FUTEX is not set 39# CONFIG_FUTEX is not set
37# CONFIG_EPOLL is not set 40# CONFIG_EPOLL is not set
38# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 41# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
@@ -41,6 +44,7 @@ CONFIG_CC_ALIGN_LABELS=0
41CONFIG_CC_ALIGN_LOOPS=0 44CONFIG_CC_ALIGN_LOOPS=0
42CONFIG_CC_ALIGN_JUMPS=0 45CONFIG_CC_ALIGN_JUMPS=0
43CONFIG_TINY_SHMEM=y 46CONFIG_TINY_SHMEM=y
47CONFIG_BASE_SMALL=0
44 48
45# 49#
46# Loadable module support 50# Loadable module support
@@ -62,6 +66,7 @@ CONFIG_PLAT_MAPPI=y
62# CONFIG_PLAT_OPSPUT is not set 66# CONFIG_PLAT_OPSPUT is not set
63# CONFIG_PLAT_OAKS32R is not set 67# CONFIG_PLAT_OAKS32R is not set
64# CONFIG_PLAT_MAPPI2 is not set 68# CONFIG_PLAT_MAPPI2 is not set
69# CONFIG_PLAT_MAPPI3 is not set
65CONFIG_CHIP_M32700=y 70CONFIG_CHIP_M32700=y
66# CONFIG_CHIP_M32102 is not set 71# CONFIG_CHIP_M32102 is not set
67# CONFIG_CHIP_VDEC2 is not set 72# CONFIG_CHIP_VDEC2 is not set
@@ -202,7 +207,6 @@ CONFIG_NET=y
202# 207#
203CONFIG_PACKET=y 208CONFIG_PACKET=y
204# CONFIG_PACKET_MMAP is not set 209# CONFIG_PACKET_MMAP is not set
205# CONFIG_NETLINK_DEV is not set
206CONFIG_UNIX=y 210CONFIG_UNIX=y
207# CONFIG_NET_KEY is not set 211# CONFIG_NET_KEY is not set
208CONFIG_INET=y 212CONFIG_INET=y
@@ -325,18 +329,6 @@ CONFIG_INPUT=y
325# CONFIG_INPUT_EVBUG is not set 329# CONFIG_INPUT_EVBUG is not set
326 330
327# 331#
328# Input I/O drivers
329#
330# CONFIG_GAMEPORT is not set
331CONFIG_SOUND_GAMEPORT=y
332CONFIG_SERIO=y
333# CONFIG_SERIO_I8042 is not set
334CONFIG_SERIO_SERPORT=y
335# CONFIG_SERIO_CT82C710 is not set
336# CONFIG_SERIO_LIBPS2 is not set
337# CONFIG_SERIO_RAW is not set
338
339#
340# Input Device Drivers 332# Input Device Drivers
341# 333#
342# CONFIG_INPUT_KEYBOARD is not set 334# CONFIG_INPUT_KEYBOARD is not set
@@ -346,6 +338,17 @@ CONFIG_SERIO_SERPORT=y
346# CONFIG_INPUT_MISC is not set 338# CONFIG_INPUT_MISC is not set
347 339
348# 340#
341# Hardware I/O ports
342#
343CONFIG_SERIO=y
344# CONFIG_SERIO_I8042 is not set
345CONFIG_SERIO_SERPORT=y
346# CONFIG_SERIO_LIBPS2 is not set
347# CONFIG_SERIO_RAW is not set
348# CONFIG_GAMEPORT is not set
349CONFIG_SOUND_GAMEPORT=y
350
351#
349# Character devices 352# Character devices
350# 353#
351# CONFIG_VT is not set 354# CONFIG_VT is not set
@@ -394,6 +397,10 @@ CONFIG_LEGACY_PTY_COUNT=256
394# CONFIG_RAW_DRIVER is not set 397# CONFIG_RAW_DRIVER is not set
395 398
396# 399#
400# TPM devices
401#
402
403#
397# I2C support 404# I2C support
398# 405#
399# CONFIG_I2C is not set 406# CONFIG_I2C is not set
@@ -434,10 +441,6 @@ CONFIG_LEGACY_PTY_COUNT=256
434# CONFIG_USB_ARCH_HAS_OHCI is not set 441# CONFIG_USB_ARCH_HAS_OHCI is not set
435 442
436# 443#
437# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
438#
439
440#
441# USB Gadget Support 444# USB Gadget Support
442# 445#
443# CONFIG_USB_GADGET is not set 446# CONFIG_USB_GADGET is not set
@@ -595,8 +598,9 @@ CONFIG_NLS_DEFAULT="iso8859-1"
595# 598#
596# Kernel hacking 599# Kernel hacking
597# 600#
601# CONFIG_PRINTK_TIME is not set
598# CONFIG_DEBUG_KERNEL is not set 602# CONFIG_DEBUG_KERNEL is not set
599CONFIG_DEBUG_PREEMPT=y 603CONFIG_LOG_BUF_SHIFT=14
600# CONFIG_DEBUG_BUGVERBOSE is not set 604# CONFIG_DEBUG_BUGVERBOSE is not set
601# CONFIG_FRAME_POINTER is not set 605# CONFIG_FRAME_POINTER is not set
602 606
diff --git a/arch/m32r/mappi/defconfig.smp b/arch/m32r/mappi/defconfig.smp
index 956a8e2f98d6..1a7f3cd42246 100644
--- a/arch/m32r/mappi/defconfig.smp
+++ b/arch/m32r/mappi/defconfig.smp
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc4 3# Linux kernel version: 2.6.12-rc5
4# Wed Feb 16 21:11:02 2005 4# Fri Jun 3 16:21:52 2005
5# 5#
6CONFIG_M32R=y 6CONFIG_M32R=y
7# CONFIG_UID16 is not set 7# CONFIG_UID16 is not set
@@ -17,6 +17,7 @@ CONFIG_EXPERIMENTAL=y
17CONFIG_BROKEN=y 17CONFIG_BROKEN=y
18CONFIG_BROKEN_ON_SMP=y 18CONFIG_BROKEN_ON_SMP=y
19CONFIG_LOCK_KERNEL=y 19CONFIG_LOCK_KERNEL=y
20CONFIG_INIT_ENV_ARG_LIMIT=32
20 21
21# 22#
22# General setup 23# General setup
@@ -28,13 +29,16 @@ CONFIG_SYSVIPC=y
28# CONFIG_BSD_PROCESS_ACCT is not set 29# CONFIG_BSD_PROCESS_ACCT is not set
29CONFIG_SYSCTL=y 30CONFIG_SYSCTL=y
30# CONFIG_AUDIT is not set 31# CONFIG_AUDIT is not set
31CONFIG_LOG_BUF_SHIFT=15
32CONFIG_HOTPLUG=y 32CONFIG_HOTPLUG=y
33CONFIG_KOBJECT_UEVENT=y 33CONFIG_KOBJECT_UEVENT=y
34CONFIG_IKCONFIG=y 34CONFIG_IKCONFIG=y
35CONFIG_IKCONFIG_PROC=y 35CONFIG_IKCONFIG_PROC=y
36# CONFIG_CPUSETS is not set
36CONFIG_EMBEDDED=y 37CONFIG_EMBEDDED=y
37# CONFIG_KALLSYMS is not set 38# CONFIG_KALLSYMS is not set
39CONFIG_PRINTK=y
40CONFIG_BUG=y
41CONFIG_BASE_FULL=y
38# CONFIG_FUTEX is not set 42# CONFIG_FUTEX is not set
39# CONFIG_EPOLL is not set 43# CONFIG_EPOLL is not set
40# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 44# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
@@ -44,6 +48,7 @@ CONFIG_CC_ALIGN_LABELS=0
44CONFIG_CC_ALIGN_LOOPS=0 48CONFIG_CC_ALIGN_LOOPS=0
45CONFIG_CC_ALIGN_JUMPS=0 49CONFIG_CC_ALIGN_JUMPS=0
46# CONFIG_TINY_SHMEM is not set 50# CONFIG_TINY_SHMEM is not set
51CONFIG_BASE_SMALL=0
47 52
48# 53#
49# Loadable module support 54# Loadable module support
@@ -66,6 +71,7 @@ CONFIG_PLAT_MAPPI=y
66# CONFIG_PLAT_OPSPUT is not set 71# CONFIG_PLAT_OPSPUT is not set
67# CONFIG_PLAT_OAKS32R is not set 72# CONFIG_PLAT_OAKS32R is not set
68# CONFIG_PLAT_MAPPI2 is not set 73# CONFIG_PLAT_MAPPI2 is not set
74# CONFIG_PLAT_MAPPI3 is not set
69CONFIG_CHIP_M32700=y 75CONFIG_CHIP_M32700=y
70# CONFIG_CHIP_M32102 is not set 76# CONFIG_CHIP_M32102 is not set
71# CONFIG_CHIP_VDEC2 is not set 77# CONFIG_CHIP_VDEC2 is not set
@@ -139,8 +145,8 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
139# 145#
140CONFIG_MTD=y 146CONFIG_MTD=y
141# CONFIG_MTD_DEBUG is not set 147# CONFIG_MTD_DEBUG is not set
142CONFIG_MTD_PARTITIONS=y
143# CONFIG_MTD_CONCAT is not set 148# CONFIG_MTD_CONCAT is not set
149CONFIG_MTD_PARTITIONS=y
144CONFIG_MTD_REDBOOT_PARTS=y 150CONFIG_MTD_REDBOOT_PARTS=y
145CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1 151CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1
146# CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set 152# CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set
@@ -294,7 +300,6 @@ CONFIG_NET=y
294# Networking options 300# Networking options
295# 301#
296# CONFIG_PACKET is not set 302# CONFIG_PACKET is not set
297# CONFIG_NETLINK_DEV is not set
298CONFIG_UNIX=y 303CONFIG_UNIX=y
299# CONFIG_NET_KEY is not set 304# CONFIG_NET_KEY is not set
300CONFIG_INET=y 305CONFIG_INET=y
@@ -420,18 +425,6 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
420# CONFIG_INPUT_EVBUG is not set 425# CONFIG_INPUT_EVBUG is not set
421 426
422# 427#
423# Input I/O drivers
424#
425# CONFIG_GAMEPORT is not set
426CONFIG_SOUND_GAMEPORT=y
427CONFIG_SERIO=y
428# CONFIG_SERIO_I8042 is not set
429# CONFIG_SERIO_SERPORT is not set
430# CONFIG_SERIO_CT82C710 is not set
431# CONFIG_SERIO_LIBPS2 is not set
432# CONFIG_SERIO_RAW is not set
433
434#
435# Input Device Drivers 428# Input Device Drivers
436# 429#
437# CONFIG_INPUT_KEYBOARD is not set 430# CONFIG_INPUT_KEYBOARD is not set
@@ -441,6 +434,17 @@ CONFIG_SERIO=y
441# CONFIG_INPUT_MISC is not set 434# CONFIG_INPUT_MISC is not set
442 435
443# 436#
437# Hardware I/O ports
438#
439CONFIG_SERIO=y
440# CONFIG_SERIO_I8042 is not set
441# CONFIG_SERIO_SERPORT is not set
442# CONFIG_SERIO_LIBPS2 is not set
443# CONFIG_SERIO_RAW is not set
444# CONFIG_GAMEPORT is not set
445CONFIG_SOUND_GAMEPORT=y
446
447#
444# Character devices 448# Character devices
445# 449#
446# CONFIG_VT is not set 450# CONFIG_VT is not set
@@ -489,6 +493,10 @@ CONFIG_LEGACY_PTY_COUNT=256
489# CONFIG_RAW_DRIVER is not set 493# CONFIG_RAW_DRIVER is not set
490 494
491# 495#
496# TPM devices
497#
498
499#
492# I2C support 500# I2C support
493# 501#
494# CONFIG_I2C is not set 502# CONFIG_I2C is not set
@@ -529,10 +537,6 @@ CONFIG_LEGACY_PTY_COUNT=256
529# CONFIG_USB_ARCH_HAS_OHCI is not set 537# CONFIG_USB_ARCH_HAS_OHCI is not set
530 538
531# 539#
532# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
533#
534
535#
536# USB Gadget Support 540# USB Gadget Support
537# 541#
538# CONFIG_USB_GADGET is not set 542# CONFIG_USB_GADGET is not set
@@ -708,8 +712,9 @@ CONFIG_NLS_DEFAULT="iso8859-1"
708# 712#
709# Kernel hacking 713# Kernel hacking
710# 714#
715# CONFIG_PRINTK_TIME is not set
711# CONFIG_DEBUG_KERNEL is not set 716# CONFIG_DEBUG_KERNEL is not set
712CONFIG_DEBUG_PREEMPT=y 717CONFIG_LOG_BUF_SHIFT=15
713# CONFIG_DEBUG_BUGVERBOSE is not set 718# CONFIG_DEBUG_BUGVERBOSE is not set
714# CONFIG_FRAME_POINTER is not set 719# CONFIG_FRAME_POINTER is not set
715 720
diff --git a/arch/m32r/mappi/defconfig.up b/arch/m32r/mappi/defconfig.up
index c9253e94efbd..38910fb76692 100644
--- a/arch/m32r/mappi/defconfig.up
+++ b/arch/m32r/mappi/defconfig.up
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc4 3# Linux kernel version: 2.6.12-rc5
4# Wed Feb 16 21:11:07 2005 4# Fri Jun 3 16:21:59 2005
5# 5#
6CONFIG_M32R=y 6CONFIG_M32R=y
7# CONFIG_UID16 is not set 7# CONFIG_UID16 is not set
@@ -17,6 +17,7 @@ CONFIG_EXPERIMENTAL=y
17CONFIG_BROKEN=y 17CONFIG_BROKEN=y
18CONFIG_BROKEN_ON_SMP=y 18CONFIG_BROKEN_ON_SMP=y
19CONFIG_LOCK_KERNEL=y 19CONFIG_LOCK_KERNEL=y
20CONFIG_INIT_ENV_ARG_LIMIT=32
20 21
21# 22#
22# General setup 23# General setup
@@ -28,13 +29,15 @@ CONFIG_SYSVIPC=y
28# CONFIG_BSD_PROCESS_ACCT is not set 29# CONFIG_BSD_PROCESS_ACCT is not set
29CONFIG_SYSCTL=y 30CONFIG_SYSCTL=y
30# CONFIG_AUDIT is not set 31# CONFIG_AUDIT is not set
31CONFIG_LOG_BUF_SHIFT=14
32CONFIG_HOTPLUG=y 32CONFIG_HOTPLUG=y
33CONFIG_KOBJECT_UEVENT=y 33CONFIG_KOBJECT_UEVENT=y
34CONFIG_IKCONFIG=y 34CONFIG_IKCONFIG=y
35CONFIG_IKCONFIG_PROC=y 35CONFIG_IKCONFIG_PROC=y
36CONFIG_EMBEDDED=y 36CONFIG_EMBEDDED=y
37# CONFIG_KALLSYMS is not set 37# CONFIG_KALLSYMS is not set
38CONFIG_PRINTK=y
39CONFIG_BUG=y
40CONFIG_BASE_FULL=y
38# CONFIG_FUTEX is not set 41# CONFIG_FUTEX is not set
39# CONFIG_EPOLL is not set 42# CONFIG_EPOLL is not set
40# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 43# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
@@ -44,6 +47,7 @@ CONFIG_CC_ALIGN_LABELS=0
44CONFIG_CC_ALIGN_LOOPS=0 47CONFIG_CC_ALIGN_LOOPS=0
45CONFIG_CC_ALIGN_JUMPS=0 48CONFIG_CC_ALIGN_JUMPS=0
46# CONFIG_TINY_SHMEM is not set 49# CONFIG_TINY_SHMEM is not set
50CONFIG_BASE_SMALL=0
47 51
48# 52#
49# Loadable module support 53# Loadable module support
@@ -65,6 +69,7 @@ CONFIG_PLAT_MAPPI=y
65# CONFIG_PLAT_OPSPUT is not set 69# CONFIG_PLAT_OPSPUT is not set
66# CONFIG_PLAT_OAKS32R is not set 70# CONFIG_PLAT_OAKS32R is not set
67# CONFIG_PLAT_MAPPI2 is not set 71# CONFIG_PLAT_MAPPI2 is not set
72# CONFIG_PLAT_MAPPI3 is not set
68CONFIG_CHIP_M32700=y 73CONFIG_CHIP_M32700=y
69# CONFIG_CHIP_M32102 is not set 74# CONFIG_CHIP_M32102 is not set
70# CONFIG_CHIP_VDEC2 is not set 75# CONFIG_CHIP_VDEC2 is not set
@@ -135,8 +140,8 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
135# 140#
136CONFIG_MTD=y 141CONFIG_MTD=y
137# CONFIG_MTD_DEBUG is not set 142# CONFIG_MTD_DEBUG is not set
138CONFIG_MTD_PARTITIONS=y
139# CONFIG_MTD_CONCAT is not set 143# CONFIG_MTD_CONCAT is not set
144CONFIG_MTD_PARTITIONS=y
140CONFIG_MTD_REDBOOT_PARTS=y 145CONFIG_MTD_REDBOOT_PARTS=y
141CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1 146CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1
142# CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set 147# CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set
@@ -290,7 +295,6 @@ CONFIG_NET=y
290# Networking options 295# Networking options
291# 296#
292# CONFIG_PACKET is not set 297# CONFIG_PACKET is not set
293# CONFIG_NETLINK_DEV is not set
294CONFIG_UNIX=y 298CONFIG_UNIX=y
295# CONFIG_NET_KEY is not set 299# CONFIG_NET_KEY is not set
296CONFIG_INET=y 300CONFIG_INET=y
@@ -416,18 +420,6 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
416# CONFIG_INPUT_EVBUG is not set 420# CONFIG_INPUT_EVBUG is not set
417 421
418# 422#
419# Input I/O drivers
420#
421# CONFIG_GAMEPORT is not set
422CONFIG_SOUND_GAMEPORT=y
423CONFIG_SERIO=y
424# CONFIG_SERIO_I8042 is not set
425# CONFIG_SERIO_SERPORT is not set
426# CONFIG_SERIO_CT82C710 is not set
427# CONFIG_SERIO_LIBPS2 is not set
428# CONFIG_SERIO_RAW is not set
429
430#
431# Input Device Drivers 423# Input Device Drivers
432# 424#
433# CONFIG_INPUT_KEYBOARD is not set 425# CONFIG_INPUT_KEYBOARD is not set
@@ -437,6 +429,17 @@ CONFIG_SERIO=y
437# CONFIG_INPUT_MISC is not set 429# CONFIG_INPUT_MISC is not set
438 430
439# 431#
432# Hardware I/O ports
433#
434CONFIG_SERIO=y
435# CONFIG_SERIO_I8042 is not set
436# CONFIG_SERIO_SERPORT is not set
437# CONFIG_SERIO_LIBPS2 is not set
438# CONFIG_SERIO_RAW is not set
439# CONFIG_GAMEPORT is not set
440CONFIG_SOUND_GAMEPORT=y
441
442#
440# Character devices 443# Character devices
441# 444#
442# CONFIG_VT is not set 445# CONFIG_VT is not set
@@ -485,6 +488,10 @@ CONFIG_LEGACY_PTY_COUNT=256
485# CONFIG_RAW_DRIVER is not set 488# CONFIG_RAW_DRIVER is not set
486 489
487# 490#
491# TPM devices
492#
493
494#
488# I2C support 495# I2C support
489# 496#
490# CONFIG_I2C is not set 497# CONFIG_I2C is not set
@@ -525,10 +532,6 @@ CONFIG_LEGACY_PTY_COUNT=256
525# CONFIG_USB_ARCH_HAS_OHCI is not set 532# CONFIG_USB_ARCH_HAS_OHCI is not set
526 533
527# 534#
528# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
529#
530
531#
532# USB Gadget Support 535# USB Gadget Support
533# 536#
534# CONFIG_USB_GADGET is not set 537# CONFIG_USB_GADGET is not set
@@ -704,8 +707,9 @@ CONFIG_NLS_DEFAULT="iso8859-1"
704# 707#
705# Kernel hacking 708# Kernel hacking
706# 709#
710# CONFIG_PRINTK_TIME is not set
707# CONFIG_DEBUG_KERNEL is not set 711# CONFIG_DEBUG_KERNEL is not set
708CONFIG_DEBUG_PREEMPT=y 712CONFIG_LOG_BUF_SHIFT=14
709# CONFIG_DEBUG_BUGVERBOSE is not set 713# CONFIG_DEBUG_BUGVERBOSE is not set
710# CONFIG_FRAME_POINTER is not set 714# CONFIG_FRAME_POINTER is not set
711 715
diff --git a/arch/m32r/mappi2/defconfig.vdec2 b/arch/m32r/mappi2/defconfig.vdec2
index c14791d27300..56f287b65898 100644
--- a/arch/m32r/mappi2/defconfig.vdec2
+++ b/arch/m32r/mappi2/defconfig.vdec2
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc4 3# Linux kernel version: 2.6.12-rc5
4# Wed Feb 16 21:11:10 2005 4# Fri Jun 3 16:22:02 2005
5# 5#
6CONFIG_M32R=y 6CONFIG_M32R=y
7# CONFIG_UID16 is not set 7# CONFIG_UID16 is not set
@@ -16,6 +16,7 @@ CONFIG_EXPERIMENTAL=y
16CONFIG_CLEAN_COMPILE=y 16CONFIG_CLEAN_COMPILE=y
17CONFIG_BROKEN_ON_SMP=y 17CONFIG_BROKEN_ON_SMP=y
18CONFIG_LOCK_KERNEL=y 18CONFIG_LOCK_KERNEL=y
19CONFIG_INIT_ENV_ARG_LIMIT=32
19 20
20# 21#
21# General setup 22# General setup
@@ -28,13 +29,15 @@ CONFIG_BSD_PROCESS_ACCT=y
28# CONFIG_BSD_PROCESS_ACCT_V3 is not set 29# CONFIG_BSD_PROCESS_ACCT_V3 is not set
29CONFIG_SYSCTL=y 30CONFIG_SYSCTL=y
30# CONFIG_AUDIT is not set 31# CONFIG_AUDIT is not set
31CONFIG_LOG_BUF_SHIFT=14
32CONFIG_HOTPLUG=y 32CONFIG_HOTPLUG=y
33CONFIG_KOBJECT_UEVENT=y 33CONFIG_KOBJECT_UEVENT=y
34CONFIG_IKCONFIG=y 34CONFIG_IKCONFIG=y
35# CONFIG_IKCONFIG_PROC is not set 35# CONFIG_IKCONFIG_PROC is not set
36CONFIG_EMBEDDED=y 36CONFIG_EMBEDDED=y
37# CONFIG_KALLSYMS is not set 37# CONFIG_KALLSYMS is not set
38CONFIG_PRINTK=y
39CONFIG_BUG=y
40CONFIG_BASE_FULL=y
38# CONFIG_FUTEX is not set 41# CONFIG_FUTEX is not set
39# CONFIG_EPOLL is not set 42# CONFIG_EPOLL is not set
40# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 43# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
@@ -44,6 +47,7 @@ CONFIG_CC_ALIGN_LABELS=0
44CONFIG_CC_ALIGN_LOOPS=0 47CONFIG_CC_ALIGN_LOOPS=0
45CONFIG_CC_ALIGN_JUMPS=0 48CONFIG_CC_ALIGN_JUMPS=0
46# CONFIG_TINY_SHMEM is not set 49# CONFIG_TINY_SHMEM is not set
50CONFIG_BASE_SMALL=0
47 51
48# 52#
49# Loadable module support 53# Loadable module support
@@ -65,6 +69,7 @@ CONFIG_KMOD=y
65# CONFIG_PLAT_OPSPUT is not set 69# CONFIG_PLAT_OPSPUT is not set
66# CONFIG_PLAT_OAKS32R is not set 70# CONFIG_PLAT_OAKS32R is not set
67CONFIG_PLAT_MAPPI2=y 71CONFIG_PLAT_MAPPI2=y
72# CONFIG_PLAT_MAPPI3 is not set
68# CONFIG_CHIP_M32700 is not set 73# CONFIG_CHIP_M32700 is not set
69# CONFIG_CHIP_M32102 is not set 74# CONFIG_CHIP_M32102 is not set
70CONFIG_CHIP_VDEC2=y 75CONFIG_CHIP_VDEC2=y
@@ -264,7 +269,6 @@ CONFIG_NET=y
264# 269#
265CONFIG_PACKET=y 270CONFIG_PACKET=y
266# CONFIG_PACKET_MMAP is not set 271# CONFIG_PACKET_MMAP is not set
267# CONFIG_NETLINK_DEV is not set
268CONFIG_UNIX=y 272CONFIG_UNIX=y
269# CONFIG_NET_KEY is not set 273# CONFIG_NET_KEY is not set
270CONFIG_INET=y 274CONFIG_INET=y
@@ -389,18 +393,6 @@ CONFIG_INPUT=y
389# CONFIG_INPUT_EVBUG is not set 393# CONFIG_INPUT_EVBUG is not set
390 394
391# 395#
392# Input I/O drivers
393#
394# CONFIG_GAMEPORT is not set
395CONFIG_SOUND_GAMEPORT=y
396CONFIG_SERIO=y
397# CONFIG_SERIO_I8042 is not set
398CONFIG_SERIO_SERPORT=y
399# CONFIG_SERIO_CT82C710 is not set
400# CONFIG_SERIO_LIBPS2 is not set
401# CONFIG_SERIO_RAW is not set
402
403#
404# Input Device Drivers 396# Input Device Drivers
405# 397#
406# CONFIG_INPUT_KEYBOARD is not set 398# CONFIG_INPUT_KEYBOARD is not set
@@ -410,6 +402,17 @@ CONFIG_SERIO_SERPORT=y
410# CONFIG_INPUT_MISC is not set 402# CONFIG_INPUT_MISC is not set
411 403
412# 404#
405# Hardware I/O ports
406#
407CONFIG_SERIO=y
408# CONFIG_SERIO_I8042 is not set
409CONFIG_SERIO_SERPORT=y
410# CONFIG_SERIO_LIBPS2 is not set
411# CONFIG_SERIO_RAW is not set
412# CONFIG_GAMEPORT is not set
413CONFIG_SOUND_GAMEPORT=y
414
415#
413# Character devices 416# Character devices
414# 417#
415CONFIG_VT=y 418CONFIG_VT=y
@@ -460,6 +463,10 @@ CONFIG_LEGACY_PTY_COUNT=256
460# CONFIG_RAW_DRIVER is not set 463# CONFIG_RAW_DRIVER is not set
461 464
462# 465#
466# TPM devices
467#
468
469#
463# I2C support 470# I2C support
464# 471#
465# CONFIG_I2C is not set 472# CONFIG_I2C is not set
@@ -521,10 +528,6 @@ CONFIG_DUMMY_CONSOLE=y
521# CONFIG_USB_ARCH_HAS_OHCI is not set 528# CONFIG_USB_ARCH_HAS_OHCI is not set
522 529
523# 530#
524# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
525#
526
527#
528# USB Gadget Support 531# USB Gadget Support
529# 532#
530# CONFIG_USB_GADGET is not set 533# CONFIG_USB_GADGET is not set
@@ -697,8 +700,9 @@ CONFIG_NLS_DEFAULT="iso8859-1"
697# 700#
698# Kernel hacking 701# Kernel hacking
699# 702#
703# CONFIG_PRINTK_TIME is not set
700# CONFIG_DEBUG_KERNEL is not set 704# CONFIG_DEBUG_KERNEL is not set
701CONFIG_DEBUG_PREEMPT=y 705CONFIG_LOG_BUF_SHIFT=14
702# CONFIG_DEBUG_BUGVERBOSE is not set 706# CONFIG_DEBUG_BUGVERBOSE is not set
703# CONFIG_FRAME_POINTER is not set 707# CONFIG_FRAME_POINTER is not set
704 708
diff --git a/arch/m32r/mappi3/defconfig.smp b/arch/m32r/mappi3/defconfig.smp
new file mode 100644
index 000000000000..2eebe75fc071
--- /dev/null
+++ b/arch/m32r/mappi3/defconfig.smp
@@ -0,0 +1,751 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.12-rc5
4# Tue May 31 17:55:34 2005
5#
6CONFIG_M32R=y
7# CONFIG_UID16 is not set
8CONFIG_GENERIC_ISA_DMA=y
9CONFIG_GENERIC_HARDIRQS=y
10CONFIG_GENERIC_IRQ_PROBE=y
11
12#
13# Code maturity level options
14#
15CONFIG_EXPERIMENTAL=y
16# CONFIG_CLEAN_COMPILE is not set
17CONFIG_BROKEN=y
18CONFIG_BROKEN_ON_SMP=y
19CONFIG_LOCK_KERNEL=y
20CONFIG_INIT_ENV_ARG_LIMIT=32
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
34CONFIG_IKCONFIG=y
35CONFIG_IKCONFIG_PROC=y
36# CONFIG_CPUSETS is not set
37CONFIG_EMBEDDED=y
38# CONFIG_KALLSYMS is not set
39CONFIG_PRINTK=y
40CONFIG_BUG=y
41CONFIG_BASE_FULL=y
42# CONFIG_FUTEX is not set
43# CONFIG_EPOLL is not set
44# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
45CONFIG_SHMEM=y
46CONFIG_CC_ALIGN_FUNCTIONS=0
47CONFIG_CC_ALIGN_LABELS=0
48CONFIG_CC_ALIGN_LOOPS=0
49CONFIG_CC_ALIGN_JUMPS=0
50# CONFIG_TINY_SHMEM is not set
51CONFIG_BASE_SMALL=0
52
53#
54# Loadable module support
55#
56CONFIG_MODULES=y
57CONFIG_MODULE_UNLOAD=y
58# CONFIG_MODULE_FORCE_UNLOAD is not set
59CONFIG_OBSOLETE_MODPARM=y
60# CONFIG_MODVERSIONS is not set
61# CONFIG_MODULE_SRCVERSION_ALL is not set
62CONFIG_KMOD=y
63CONFIG_STOP_MACHINE=y
64
65#
66# Processor type and features
67#
68# CONFIG_PLAT_MAPPI is not set
69# CONFIG_PLAT_USRV is not set
70# CONFIG_PLAT_M32700UT is not set
71# CONFIG_PLAT_OPSPUT is not set
72# CONFIG_PLAT_OAKS32R is not set
73# CONFIG_PLAT_MAPPI2 is not set
74CONFIG_PLAT_MAPPI3=y
75CONFIG_CHIP_M32700=y
76# CONFIG_CHIP_M32102 is not set
77# CONFIG_CHIP_VDEC2 is not set
78# CONFIG_CHIP_OPSP is not set
79CONFIG_MMU=y
80CONFIG_TLB_ENTRIES=32
81CONFIG_ISA_M32R2=y
82CONFIG_ISA_DSP_LEVEL2=y
83CONFIG_ISA_DUAL_ISSUE=y
84CONFIG_BUS_CLOCK=10000000
85CONFIG_TIMER_DIVIDE=128
86# CONFIG_CPU_LITTLE_ENDIAN is not set
87CONFIG_MEMORY_START=0x08000000
88CONFIG_MEMORY_SIZE=0x08000000
89CONFIG_NOHIGHMEM=y
90CONFIG_DISCONTIGMEM=y
91CONFIG_IRAM_START=0x00f00000
92CONFIG_IRAM_SIZE=0x00080000
93CONFIG_RWSEM_GENERIC_SPINLOCK=y
94# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
95CONFIG_GENERIC_CALIBRATE_DELAY=y
96CONFIG_PREEMPT=y
97# CONFIG_HAVE_DEC_LOCK is not set
98CONFIG_SMP=y
99# CONFIG_CHIP_M32700_TS1 is not set
100CONFIG_NR_CPUS=2
101# CONFIG_NUMA is not set
102
103#
104# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
105#
106# CONFIG_PCI is not set
107# CONFIG_ISA is not set
108
109#
110# PCCARD (PCMCIA/CardBus) support
111#
112CONFIG_PCCARD=y
113# CONFIG_PCMCIA_DEBUG is not set
114CONFIG_PCMCIA=y
115
116#
117# PC-card bridges
118#
119# CONFIG_TCIC is not set
120# CONFIG_M32R_PCC is not set
121# CONFIG_M32R_CFC is not set
122
123#
124# PCI Hotplug Support
125#
126
127#
128# Executable file formats
129#
130CONFIG_BINFMT_ELF=y
131# CONFIG_BINFMT_MISC is not set
132
133#
134# Device Drivers
135#
136
137#
138# Generic Driver Options
139#
140CONFIG_STANDALONE=y
141CONFIG_PREVENT_FIRMWARE_BUILD=y
142CONFIG_FW_LOADER=y
143
144#
145# Memory Technology Devices (MTD)
146#
147CONFIG_MTD=y
148# CONFIG_MTD_DEBUG is not set
149# CONFIG_MTD_CONCAT is not set
150CONFIG_MTD_PARTITIONS=y
151CONFIG_MTD_REDBOOT_PARTS=y
152CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1
153# CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set
154# CONFIG_MTD_REDBOOT_PARTS_READONLY is not set
155# CONFIG_MTD_CMDLINE_PARTS is not set
156
157#
158# User Modules And Translation Layers
159#
160CONFIG_MTD_CHAR=y
161CONFIG_MTD_BLOCK=y
162# CONFIG_FTL is not set
163# CONFIG_NFTL is not set
164# CONFIG_INFTL is not set
165
166#
167# RAM/ROM/Flash chip drivers
168#
169# CONFIG_MTD_CFI is not set
170# CONFIG_MTD_JEDECPROBE is not set
171CONFIG_MTD_MAP_BANK_WIDTH_1=y
172CONFIG_MTD_MAP_BANK_WIDTH_2=y
173CONFIG_MTD_MAP_BANK_WIDTH_4=y
174# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
175# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
176# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
177CONFIG_MTD_CFI_I1=y
178CONFIG_MTD_CFI_I2=y
179# CONFIG_MTD_CFI_I4 is not set
180# CONFIG_MTD_CFI_I8 is not set
181# CONFIG_MTD_RAM is not set
182# CONFIG_MTD_ROM is not set
183# CONFIG_MTD_ABSENT is not set
184# CONFIG_MTD_OBSOLETE_CHIPS is not set
185
186#
187# Mapping drivers for chip access
188#
189# CONFIG_MTD_COMPLEX_MAPPINGS is not set
190
191#
192# Self-contained MTD device drivers
193#
194# CONFIG_MTD_SLRAM is not set
195# CONFIG_MTD_PHRAM is not set
196# CONFIG_MTD_MTDRAM is not set
197# CONFIG_MTD_BLKMTD is not set
198# CONFIG_MTD_BLOCK2MTD is not set
199
200#
201# Disk-On-Chip Device Drivers
202#
203# CONFIG_MTD_DOC2000 is not set
204# CONFIG_MTD_DOC2001 is not set
205# CONFIG_MTD_DOC2001PLUS is not set
206
207#
208# NAND Flash Device Drivers
209#
210# CONFIG_MTD_NAND is not set
211
212#
213# Parallel port support
214#
215# CONFIG_PARPORT is not set
216
217#
218# Plug and Play support
219#
220
221#
222# Block devices
223#
224# CONFIG_BLK_DEV_FD is not set
225# CONFIG_BLK_DEV_COW_COMMON is not set
226CONFIG_BLK_DEV_LOOP=y
227# CONFIG_BLK_DEV_CRYPTOLOOP is not set
228CONFIG_BLK_DEV_NBD=m
229CONFIG_BLK_DEV_RAM=y
230CONFIG_BLK_DEV_RAM_COUNT=16
231CONFIG_BLK_DEV_RAM_SIZE=4096
232CONFIG_BLK_DEV_INITRD=y
233CONFIG_INITRAMFS_SOURCE=""
234# CONFIG_CDROM_PKTCDVD is not set
235
236#
237# IO Schedulers
238#
239CONFIG_IOSCHED_NOOP=y
240# CONFIG_IOSCHED_AS is not set
241CONFIG_IOSCHED_DEADLINE=y
242CONFIG_IOSCHED_CFQ=y
243# CONFIG_ATA_OVER_ETH is not set
244
245#
246# ATA/ATAPI/MFM/RLL support
247#
248CONFIG_IDE=y
249CONFIG_BLK_DEV_IDE=y
250
251#
252# Please see Documentation/ide.txt for help/info on IDE drives
253#
254# CONFIG_BLK_DEV_IDE_SATA is not set
255CONFIG_BLK_DEV_IDEDISK=y
256# CONFIG_IDEDISK_MULTI_MODE is not set
257CONFIG_BLK_DEV_IDECS=y
258CONFIG_BLK_DEV_IDECD=m
259# CONFIG_BLK_DEV_IDETAPE is not set
260# CONFIG_BLK_DEV_IDEFLOPPY is not set
261# CONFIG_IDE_TASK_IOCTL is not set
262
263#
264# IDE chipset support/bugfixes
265#
266CONFIG_IDE_GENERIC=y
267# CONFIG_IDE_ARM is not set
268# CONFIG_BLK_DEV_IDEDMA is not set
269# CONFIG_IDEDMA_AUTO is not set
270# CONFIG_BLK_DEV_HD is not set
271
272#
273# SCSI device support
274#
275# CONFIG_SCSI is not set
276
277#
278# Multi-device support (RAID and LVM)
279#
280# CONFIG_MD is not set
281
282#
283# Fusion MPT device support
284#
285
286#
287# IEEE 1394 (FireWire) support
288#
289# CONFIG_IEEE1394 is not set
290
291#
292# I2O device support
293#
294
295#
296# Networking support
297#
298CONFIG_NET=y
299
300#
301# Networking options
302#
303# CONFIG_PACKET is not set
304CONFIG_UNIX=y
305# CONFIG_NET_KEY is not set
306CONFIG_INET=y
307# CONFIG_IP_MULTICAST is not set
308# CONFIG_IP_ADVANCED_ROUTER is not set
309CONFIG_IP_PNP=y
310CONFIG_IP_PNP_DHCP=y
311# CONFIG_IP_PNP_BOOTP is not set
312# CONFIG_IP_PNP_RARP is not set
313# CONFIG_NET_IPIP is not set
314# CONFIG_NET_IPGRE is not set
315# CONFIG_ARPD is not set
316# CONFIG_SYN_COOKIES is not set
317# CONFIG_INET_AH is not set
318# CONFIG_INET_ESP is not set
319# CONFIG_INET_IPCOMP is not set
320# CONFIG_INET_TUNNEL is not set
321CONFIG_IP_TCPDIAG=y
322# CONFIG_IP_TCPDIAG_IPV6 is not set
323# CONFIG_IPV6 is not set
324# CONFIG_NETFILTER is not set
325
326#
327# SCTP Configuration (EXPERIMENTAL)
328#
329# CONFIG_IP_SCTP is not set
330# CONFIG_ATM is not set
331# CONFIG_BRIDGE is not set
332# CONFIG_VLAN_8021Q is not set
333# CONFIG_DECNET is not set
334# CONFIG_LLC2 is not set
335# CONFIG_IPX is not set
336# CONFIG_ATALK is not set
337# CONFIG_X25 is not set
338# CONFIG_LAPB is not set
339# CONFIG_NET_DIVERT is not set
340# CONFIG_ECONET is not set
341# CONFIG_WAN_ROUTER is not set
342
343#
344# QoS and/or fair queueing
345#
346# CONFIG_NET_SCHED is not set
347# CONFIG_NET_CLS_ROUTE is not set
348
349#
350# Network testing
351#
352# CONFIG_NET_PKTGEN is not set
353# CONFIG_NETPOLL is not set
354# CONFIG_NET_POLL_CONTROLLER is not set
355# CONFIG_HAMRADIO is not set
356# CONFIG_IRDA is not set
357# CONFIG_BT is not set
358CONFIG_NETDEVICES=y
359# CONFIG_DUMMY is not set
360# CONFIG_BONDING is not set
361# CONFIG_EQUALIZER is not set
362# CONFIG_TUN is not set
363
364#
365# Ethernet (10 or 100Mbit)
366#
367CONFIG_NET_ETHERNET=y
368CONFIG_MII=y
369CONFIG_SMC91X=y
370# CONFIG_NE2000 is not set
371
372#
373# Ethernet (1000 Mbit)
374#
375
376#
377# Ethernet (10000 Mbit)
378#
379
380#
381# Token Ring devices
382#
383
384#
385# Wireless LAN (non-hamradio)
386#
387# CONFIG_NET_RADIO is not set
388
389#
390# PCMCIA network device support
391#
392# CONFIG_NET_PCMCIA is not set
393
394#
395# Wan interfaces
396#
397# CONFIG_WAN is not set
398# CONFIG_PPP is not set
399# CONFIG_SLIP is not set
400# CONFIG_SHAPER is not set
401# CONFIG_NETCONSOLE is not set
402
403#
404# ISDN subsystem
405#
406# CONFIG_ISDN is not set
407
408#
409# Telephony Support
410#
411# CONFIG_PHONE is not set
412
413#
414# Input device support
415#
416CONFIG_INPUT=y
417
418#
419# Userland interfaces
420#
421CONFIG_INPUT_MOUSEDEV=y
422CONFIG_INPUT_MOUSEDEV_PSAUX=y
423CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
424CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
425# CONFIG_INPUT_JOYDEV is not set
426# CONFIG_INPUT_TSDEV is not set
427# CONFIG_INPUT_EVDEV is not set
428# CONFIG_INPUT_EVBUG is not set
429
430#
431# Input Device Drivers
432#
433# CONFIG_INPUT_KEYBOARD is not set
434# CONFIG_INPUT_MOUSE is not set
435# CONFIG_INPUT_JOYSTICK is not set
436# CONFIG_INPUT_TOUCHSCREEN is not set
437# CONFIG_INPUT_MISC is not set
438
439#
440# Hardware I/O ports
441#
442CONFIG_SERIO=y
443# CONFIG_SERIO_I8042 is not set
444# CONFIG_SERIO_SERPORT is not set
445# CONFIG_SERIO_LIBPS2 is not set
446# CONFIG_SERIO_RAW is not set
447# CONFIG_GAMEPORT is not set
448CONFIG_SOUND_GAMEPORT=y
449
450#
451# Character devices
452#
453# CONFIG_VT is not set
454# CONFIG_SERIAL_NONSTANDARD is not set
455
456#
457# Serial drivers
458#
459# CONFIG_SERIAL_8250 is not set
460
461#
462# Non-8250 serial port support
463#
464CONFIG_SERIAL_CORE=y
465CONFIG_SERIAL_CORE_CONSOLE=y
466CONFIG_SERIAL_M32R_SIO=y
467CONFIG_SERIAL_M32R_SIO_CONSOLE=y
468# CONFIG_SERIAL_M32R_PLDSIO is not set
469CONFIG_UNIX98_PTYS=y
470CONFIG_LEGACY_PTYS=y
471CONFIG_LEGACY_PTY_COUNT=256
472
473#
474# IPMI
475#
476# CONFIG_IPMI_HANDLER is not set
477
478#
479# Watchdog Cards
480#
481# CONFIG_WATCHDOG is not set
482# CONFIG_RTC is not set
483# CONFIG_GEN_RTC is not set
484# CONFIG_DTLK is not set
485# CONFIG_R3964 is not set
486
487#
488# Ftape, the floppy tape device driver
489#
490# CONFIG_DRM is not set
491
492#
493# PCMCIA character devices
494#
495# CONFIG_SYNCLINK_CS is not set
496# CONFIG_RAW_DRIVER is not set
497
498#
499# TPM devices
500#
501
502#
503# I2C support
504#
505# CONFIG_I2C is not set
506
507#
508# Dallas's 1-wire bus
509#
510# CONFIG_W1 is not set
511
512#
513# Misc devices
514#
515
516#
517# Multimedia devices
518#
519# CONFIG_VIDEO_DEV is not set
520
521#
522# Digital Video Broadcasting Devices
523#
524# CONFIG_DVB is not set
525
526#
527# Graphics support
528#
529# CONFIG_FB is not set
530
531#
532# Sound
533#
534# CONFIG_SOUND is not set
535
536#
537# USB support
538#
539# CONFIG_USB_ARCH_HAS_HCD is not set
540# CONFIG_USB_ARCH_HAS_OHCI is not set
541
542#
543# USB Gadget Support
544#
545# CONFIG_USB_GADGET is not set
546
547#
548# MMC/SD Card support
549#
550# CONFIG_MMC is not set
551
552#
553# InfiniBand support
554#
555# CONFIG_INFINIBAND is not set
556
557#
558# File systems
559#
560CONFIG_EXT2_FS=y
561# CONFIG_EXT2_FS_XATTR is not set
562CONFIG_EXT3_FS=y
563CONFIG_EXT3_FS_XATTR=y
564# CONFIG_EXT3_FS_POSIX_ACL is not set
565# CONFIG_EXT3_FS_SECURITY is not set
566CONFIG_JBD=y
567# CONFIG_JBD_DEBUG is not set
568CONFIG_FS_MBCACHE=y
569# CONFIG_REISERFS_FS is not set
570# CONFIG_JFS_FS is not set
571
572#
573# XFS support
574#
575# CONFIG_XFS_FS is not set
576# CONFIG_MINIX_FS is not set
577CONFIG_ROMFS_FS=y
578# CONFIG_QUOTA is not set
579CONFIG_DNOTIFY=y
580# CONFIG_AUTOFS_FS is not set
581# CONFIG_AUTOFS4_FS is not set
582
583#
584# CD-ROM/DVD Filesystems
585#
586CONFIG_ISO9660_FS=y
587# CONFIG_JOLIET is not set
588# CONFIG_ZISOFS is not set
589# CONFIG_UDF_FS is not set
590
591#
592# DOS/FAT/NT Filesystems
593#
594CONFIG_FAT_FS=m
595CONFIG_MSDOS_FS=m
596CONFIG_VFAT_FS=m
597CONFIG_FAT_DEFAULT_CODEPAGE=437
598CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
599# CONFIG_NTFS_FS is not set
600
601#
602# Pseudo filesystems
603#
604CONFIG_PROC_FS=y
605CONFIG_PROC_KCORE=y
606CONFIG_SYSFS=y
607CONFIG_DEVFS_FS=y
608CONFIG_DEVFS_MOUNT=y
609# CONFIG_DEVFS_DEBUG is not set
610# CONFIG_DEVPTS_FS_XATTR is not set
611CONFIG_TMPFS=y
612# CONFIG_TMPFS_XATTR is not set
613# CONFIG_HUGETLBFS is not set
614# CONFIG_HUGETLB_PAGE is not set
615CONFIG_RAMFS=y
616
617#
618# Miscellaneous filesystems
619#
620# CONFIG_ADFS_FS is not set
621# CONFIG_AFFS_FS is not set
622# CONFIG_HFS_FS is not set
623# CONFIG_HFSPLUS_FS is not set
624# CONFIG_BEFS_FS is not set
625# CONFIG_BFS_FS is not set
626# CONFIG_EFS_FS is not set
627CONFIG_JFFS_FS=y
628CONFIG_JFFS_FS_VERBOSE=0
629CONFIG_JFFS_PROC_FS=y
630CONFIG_JFFS2_FS=y
631CONFIG_JFFS2_FS_DEBUG=0
632# CONFIG_JFFS2_FS_NAND is not set
633# CONFIG_JFFS2_FS_NOR_ECC is not set
634# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
635CONFIG_JFFS2_ZLIB=y
636CONFIG_JFFS2_RTIME=y
637# CONFIG_JFFS2_RUBIN is not set
638# CONFIG_CRAMFS is not set
639# CONFIG_VXFS_FS is not set
640# CONFIG_HPFS_FS is not set
641# CONFIG_QNX4FS_FS is not set
642# CONFIG_SYSV_FS is not set
643# CONFIG_UFS_FS is not set
644
645#
646# Network File Systems
647#
648CONFIG_NFS_FS=y
649CONFIG_NFS_V3=y
650# CONFIG_NFS_V4 is not set
651# CONFIG_NFS_DIRECTIO is not set
652# CONFIG_NFSD is not set
653CONFIG_ROOT_NFS=y
654CONFIG_LOCKD=y
655CONFIG_LOCKD_V4=y
656CONFIG_SUNRPC=y
657# CONFIG_RPCSEC_GSS_KRB5 is not set
658# CONFIG_RPCSEC_GSS_SPKM3 is not set
659# CONFIG_SMB_FS is not set
660# CONFIG_CIFS is not set
661# CONFIG_NCP_FS is not set
662# CONFIG_CODA_FS is not set
663# CONFIG_AFS_FS is not set
664
665#
666# Partition Types
667#
668# CONFIG_PARTITION_ADVANCED is not set
669CONFIG_MSDOS_PARTITION=y
670
671#
672# Native Language Support
673#
674CONFIG_NLS=y
675CONFIG_NLS_DEFAULT="iso8859-1"
676# CONFIG_NLS_CODEPAGE_437 is not set
677# CONFIG_NLS_CODEPAGE_737 is not set
678# CONFIG_NLS_CODEPAGE_775 is not set
679# CONFIG_NLS_CODEPAGE_850 is not set
680# CONFIG_NLS_CODEPAGE_852 is not set
681# CONFIG_NLS_CODEPAGE_855 is not set
682# CONFIG_NLS_CODEPAGE_857 is not set
683# CONFIG_NLS_CODEPAGE_860 is not set
684# CONFIG_NLS_CODEPAGE_861 is not set
685# CONFIG_NLS_CODEPAGE_862 is not set
686# CONFIG_NLS_CODEPAGE_863 is not set
687# CONFIG_NLS_CODEPAGE_864 is not set
688# CONFIG_NLS_CODEPAGE_865 is not set
689# CONFIG_NLS_CODEPAGE_866 is not set
690# CONFIG_NLS_CODEPAGE_869 is not set
691# CONFIG_NLS_CODEPAGE_936 is not set
692# CONFIG_NLS_CODEPAGE_950 is not set
693# CONFIG_NLS_CODEPAGE_932 is not set
694# CONFIG_NLS_CODEPAGE_949 is not set
695# CONFIG_NLS_CODEPAGE_874 is not set
696# CONFIG_NLS_ISO8859_8 is not set
697# CONFIG_NLS_CODEPAGE_1250 is not set
698# CONFIG_NLS_CODEPAGE_1251 is not set
699# CONFIG_NLS_ASCII is not set
700# CONFIG_NLS_ISO8859_1 is not set
701# CONFIG_NLS_ISO8859_2 is not set
702# CONFIG_NLS_ISO8859_3 is not set
703# CONFIG_NLS_ISO8859_4 is not set
704# CONFIG_NLS_ISO8859_5 is not set
705# CONFIG_NLS_ISO8859_6 is not set
706# CONFIG_NLS_ISO8859_7 is not set
707# CONFIG_NLS_ISO8859_9 is not set
708# CONFIG_NLS_ISO8859_13 is not set
709# CONFIG_NLS_ISO8859_14 is not set
710# CONFIG_NLS_ISO8859_15 is not set
711# CONFIG_NLS_KOI8_R is not set
712# CONFIG_NLS_KOI8_U is not set
713# CONFIG_NLS_UTF8 is not set
714
715#
716# Profiling support
717#
718# CONFIG_PROFILING is not set
719
720#
721# Kernel hacking
722#
723# CONFIG_PRINTK_TIME is not set
724# CONFIG_DEBUG_KERNEL is not set
725CONFIG_LOG_BUF_SHIFT=15
726# CONFIG_DEBUG_BUGVERBOSE is not set
727# CONFIG_FRAME_POINTER is not set
728
729#
730# Security options
731#
732# CONFIG_KEYS is not set
733# CONFIG_SECURITY is not set
734
735#
736# Cryptographic options
737#
738# CONFIG_CRYPTO is not set
739
740#
741# Hardware crypto devices
742#
743
744#
745# Library routines
746#
747# CONFIG_CRC_CCITT is not set
748CONFIG_CRC32=y
749# CONFIG_LIBCRC32C is not set
750CONFIG_ZLIB_INFLATE=y
751CONFIG_ZLIB_DEFLATE=y
diff --git a/arch/m32r/mappi3/dot.gdbinit b/arch/m32r/mappi3/dot.gdbinit
new file mode 100644
index 000000000000..89c22184e139
--- /dev/null
+++ b/arch/m32r/mappi3/dot.gdbinit
@@ -0,0 +1,224 @@
1# .gdbinit file
2# $Id: dot.gdbinit,v 1.1 2005/04/11 02:21:08 sakugawa Exp $
3
4# setting
5set width 0d70
6set radix 0d16
7use_debug_dma
8
9# Initialize SDRAM controller for Mappi
10define sdram_init
11 # SDIR0
12 set *(unsigned long *)0x00ef6008 = 0x00000182
13 # SDIR1
14 set *(unsigned long *)0x00ef600c = 0x00000001
15 # Initialize wait
16 shell sleep 0.1
17 # MOD
18 set *(unsigned long *)0x00ef602c = 0x00000020
19 set *(unsigned long *)0x00ef604c = 0x00000020
20 # TR
21 set *(unsigned long *)0x00ef6028 = 0x00051502
22 set *(unsigned long *)0x00ef6048 = 0x00051502
23 # ADR
24 set *(unsigned long *)0x00ef6020 = 0x08000004
25 set *(unsigned long *)0x00ef6040 = 0x0c000004
26 # AutoRef On
27 set *(unsigned long *)0x00ef6004 = 0x00010517
28 # Access enable
29 set *(unsigned long *)0x00ef6024 = 0x00000001
30 set *(unsigned long *)0x00ef6044 = 0x00000001
31end
32
33# Initialize LAN controller for Mappi
34define lanc_init
35 # Set BSEL4
36 #set *(unsigned long *)0x00ef5004 = 0x0fff330f
37 #set *(unsigned long *)0x00ef5004 = 0x01113301
38
39# set *(unsigned long *)0x00ef5004 = 0x02011101
40# set *(unsigned long *)0x00ef5004 = 0x04441104
41end
42
43define clock_init
44 set *(unsigned long *)0x00ef4010 = 2
45 set *(unsigned long *)0x00ef4014 = 2
46 set *(unsigned long *)0x00ef4020 = 3
47 set *(unsigned long *)0x00ef4024 = 3
48 set *(unsigned long *)0x00ef4004 = 0x7
49# shell sleep 0.1
50# set *(unsigned long *)0x00ef4004 = 0x5
51 shell sleep 0.1
52 set *(unsigned long *)0x00ef4008 = 0x0200
53end
54
55define port_init
56 set $sfrbase = 0x00ef0000
57 set *(unsigned short *)0x00ef1060 = 0x5555
58 set *(unsigned short *)0x00ef1062 = 0x5555
59 set *(unsigned short *)0x00ef1064 = 0x5555
60 set *(unsigned short *)0x00ef1066 = 0x5555
61 set *(unsigned short *)0x00ef1068 = 0x5555
62 set *(unsigned short *)0x00ef106a = 0x0000
63 set *(unsigned short *)0x00ef106e = 0x5555
64 set *(unsigned short *)0x00ef1070 = 0x5555
65end
66
67# MMU enable
68define mmu_enable
69 set $evb=0x88000000
70 set *(unsigned long *)0xffff0024=1
71end
72
73# MMU disable
74define mmu_disable
75 set $evb=0
76 set *(unsigned long *)0xffff0024=0
77end
78
79# Show TLB entries
80define show_tlb_entries
81 set $i = 0
82 set $addr = $arg0
83 while ($i < 0d16 )
84 set $tlb_tag = *(unsigned long*)$addr
85 set $tlb_data = *(unsigned long*)($addr + 4)
86 printf " [%2d] 0x%08lx : 0x%08lx - 0x%08lx\n", $i, $addr, $tlb_tag, $tlb_data
87 set $i = $i + 1
88 set $addr = $addr + 8
89 end
90end
91define itlb
92 set $itlb=0xfe000000
93 show_tlb_entries $itlb
94end
95define dtlb
96 set $dtlb=0xfe000800
97 show_tlb_entries $dtlb
98end
99
100# Cache ON
101define set_cache_type
102 set $mctype = (void*)0xfffffff8
103# chaos
104# set *(unsigned long *)($mctype) = 0x0000c000
105# m32102 i-cache only
106 set *(unsigned long *)($mctype) = 0x00008000
107# m32102 d-cache only
108# set *(unsigned long *)($mctype) = 0x00004000
109end
110define cache_on
111 set $param = (void*)0x08001000
112 set *(unsigned long *)($param) = 0x60ff6102
113end
114
115
116# Show current task structure
117define show_current
118 set $current = $spi & 0xffffe000
119 printf "$current=0x%08lX\n",$current
120 print *(struct task_struct *)$current
121end
122
123# Show user assigned task structure
124define show_task
125 set $task = $arg0 & 0xffffe000
126 printf "$task=0x%08lX\n",$task
127 print *(struct task_struct *)$task
128end
129document show_task
130 Show user assigned task structure
131 arg0 : task structure address
132end
133
134# Show M32R registers
135define show_regs
136 printf " R0[0x%08lX] R1[0x%08lX] R2[0x%08lX] R3[0x%08lX]\n",$r0,$r1,$r2,$r3
137 printf " R4[0x%08lX] R5[0x%08lX] R6[0x%08lX] R7[0x%08lX]\n",$r4,$r5,$r6,$r7
138 printf " R8[0x%08lX] R9[0x%08lX] R10[0x%08lX] R11[0x%08lX]\n",$r8,$r9,$r10,$r11
139 printf "R12[0x%08lX] FP[0x%08lX] LR[0x%08lX] SP[0x%08lX]\n",$r12,$fp,$lr,$sp
140 printf "PSW[0x%08lX] CBR[0x%08lX] SPI[0x%08lX] SPU[0x%08lX]\n",$psw,$cbr,$spi,$spu
141 printf "BPC[0x%08lX] PC[0x%08lX] ACCL[0x%08lX] ACCH[0x%08lX]\n",$bpc,$pc,$accl,$acch
142 printf "EVB[0x%08lX]\n",$evb
143
144 set $mests = *(unsigned long *)0xffff000c
145 set $mdeva = *(unsigned long *)0xffff0010
146 printf "MESTS[0x%08lX] MDEVA[0x%08lX]\n",$mests,$mdeva
147end
148
149
150# Setup all
151define setup
152 clock_init
153 shell sleep 0.1
154 port_init
155 sdram_init
156# lanc_init
157# dispc_init
158# set $evb=0x08000000
159end
160
161# Load modules
162define load_modules
163 use_debug_dma
164 load
165# load busybox.mot
166end
167
168# Set kernel parameters
169define set_kernel_parameters
170 set $param = (void*)0x08001000
171
172 ## MOUNT_ROOT_RDONLY
173 set {long}($param+0x00)=0
174 ## RAMDISK_FLAGS
175 #set {long}($param+0x04)=0
176 ## ORIG_ROOT_DEV
177 #set {long}($param+0x08)=0x00000100
178 ## LOADER_TYPE
179 #set {long}($param+0x0C)=0
180 ## INITRD_START
181 set {long}($param+0x10)=0x082a0000
182 ## INITRD_SIZE
183 set {long}($param+0x14)=0d6200000
184
185 # M32R_CPUCLK
186 set *(unsigned long *)($param + 0x0018) = 0d100000000
187 # M32R_BUSCLK
188 set *(unsigned long *)($param + 0x001c) = 0d50000000
189 # M32R_TIMER_DIVIDE
190 set *(unsigned long *)($param + 0x0020) = 0d128
191
192
193 set {char[0x200]}($param + 0x100) = "console=ttyS0,115200n8x root=/dev/nfsroot nfsroot=192.168.0.1:/project/m32r-linux/export/root.2.6_04 nfsaddrs=192.168.0.102:192.168.0.1:192.168.0.1:255.255.255.0:mappi: \0"
194
195
196end
197
198# Boot
199define boot
200 set_kernel_parameters
201 debug_chaos
202 set *(unsigned long *)0x00f00000=0x08002000
203 set $pc=0x08002000
204 set $fp=0
205 del b
206 si
207end
208
209# Restart
210define restart
211 sdireset
212 sdireset
213 setup
214 load_modules
215 boot
216end
217
218sdireset
219sdireset
220file vmlinux
221target m32rsdi
222
223restart
224boot
diff --git a/arch/m32r/mm/extable.c b/arch/m32r/mm/extable.c
index 9a97363b6524..1743f23d49a3 100644
--- a/arch/m32r/mm/extable.c
+++ b/arch/m32r/mm/extable.c
@@ -1,10 +1,8 @@
1/* 1/*
2 * linux/arch/i386/mm/extable.c 2 * linux/arch/m32r/mm/extable.c
3 */ 3 */
4 4
5#include <linux/config.h>
6#include <linux/module.h> 5#include <linux/module.h>
7#include <linux/spinlock.h>
8#include <asm/uaccess.h> 6#include <asm/uaccess.h>
9 7
10int fixup_exception(struct pt_regs *regs) 8int fixup_exception(struct pt_regs *regs)
@@ -19,4 +17,3 @@ int fixup_exception(struct pt_regs *regs)
19 17
20 return 0; 18 return 0;
21} 19}
22
diff --git a/arch/m32r/oaks32r/defconfig.nommu b/arch/m32r/oaks32r/defconfig.nommu
index f2da9be726e5..3f9fe519acb2 100644
--- a/arch/m32r/oaks32r/defconfig.nommu
+++ b/arch/m32r/oaks32r/defconfig.nommu
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc4 3# Linux kernel version: 2.6.12-rc5
4# Wed Feb 16 21:11:13 2005 4# Fri Jun 3 16:22:04 2005
5# 5#
6CONFIG_M32R=y 6CONFIG_M32R=y
7# CONFIG_UID16 is not set 7# CONFIG_UID16 is not set
@@ -16,6 +16,7 @@ CONFIG_EXPERIMENTAL=y
16CONFIG_CLEAN_COMPILE=y 16CONFIG_CLEAN_COMPILE=y
17CONFIG_BROKEN_ON_SMP=y 17CONFIG_BROKEN_ON_SMP=y
18CONFIG_LOCK_KERNEL=y 18CONFIG_LOCK_KERNEL=y
19CONFIG_INIT_ENV_ARG_LIMIT=32
19 20
20# 21#
21# General setup 22# General setup
@@ -26,12 +27,14 @@ CONFIG_BSD_PROCESS_ACCT=y
26# CONFIG_BSD_PROCESS_ACCT_V3 is not set 27# CONFIG_BSD_PROCESS_ACCT_V3 is not set
27CONFIG_SYSCTL=y 28CONFIG_SYSCTL=y
28# CONFIG_AUDIT is not set 29# CONFIG_AUDIT is not set
29CONFIG_LOG_BUF_SHIFT=14
30CONFIG_HOTPLUG=y 30CONFIG_HOTPLUG=y
31CONFIG_KOBJECT_UEVENT=y 31CONFIG_KOBJECT_UEVENT=y
32# CONFIG_IKCONFIG is not set 32# CONFIG_IKCONFIG is not set
33CONFIG_EMBEDDED=y 33CONFIG_EMBEDDED=y
34# CONFIG_KALLSYMS is not set 34# CONFIG_KALLSYMS is not set
35CONFIG_PRINTK=y
36CONFIG_BUG=y
37CONFIG_BASE_FULL=y
35# CONFIG_FUTEX is not set 38# CONFIG_FUTEX is not set
36# CONFIG_EPOLL is not set 39# CONFIG_EPOLL is not set
37# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 40# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
@@ -40,6 +43,7 @@ CONFIG_CC_ALIGN_LABELS=0
40CONFIG_CC_ALIGN_LOOPS=0 43CONFIG_CC_ALIGN_LOOPS=0
41CONFIG_CC_ALIGN_JUMPS=0 44CONFIG_CC_ALIGN_JUMPS=0
42CONFIG_TINY_SHMEM=y 45CONFIG_TINY_SHMEM=y
46CONFIG_BASE_SMALL=0
43 47
44# 48#
45# Loadable module support 49# Loadable module support
@@ -61,6 +65,7 @@ CONFIG_KMOD=y
61# CONFIG_PLAT_OPSPUT is not set 65# CONFIG_PLAT_OPSPUT is not set
62CONFIG_PLAT_OAKS32R=y 66CONFIG_PLAT_OAKS32R=y
63# CONFIG_PLAT_MAPPI2 is not set 67# CONFIG_PLAT_MAPPI2 is not set
68# CONFIG_PLAT_MAPPI3 is not set
64# CONFIG_CHIP_M32700 is not set 69# CONFIG_CHIP_M32700 is not set
65CONFIG_CHIP_M32102=y 70CONFIG_CHIP_M32102=y
66# CONFIG_CHIP_VDEC2 is not set 71# CONFIG_CHIP_VDEC2 is not set
@@ -92,10 +97,6 @@ CONFIG_PREEMPT=y
92# CONFIG_PCCARD is not set 97# CONFIG_PCCARD is not set
93 98
94# 99#
95# PC-card bridges
96#
97
98#
99# PCI Hotplug Support 100# PCI Hotplug Support
100# 101#
101 102
@@ -193,7 +194,6 @@ CONFIG_NET=y
193# 194#
194CONFIG_PACKET=y 195CONFIG_PACKET=y
195# CONFIG_PACKET_MMAP is not set 196# CONFIG_PACKET_MMAP is not set
196# CONFIG_NETLINK_DEV is not set
197CONFIG_UNIX=y 197CONFIG_UNIX=y
198# CONFIG_NET_KEY is not set 198# CONFIG_NET_KEY is not set
199CONFIG_INET=y 199CONFIG_INET=y
@@ -311,18 +311,6 @@ CONFIG_INPUT=y
311# CONFIG_INPUT_EVBUG is not set 311# CONFIG_INPUT_EVBUG is not set
312 312
313# 313#
314# Input I/O drivers
315#
316# CONFIG_GAMEPORT is not set
317CONFIG_SOUND_GAMEPORT=y
318CONFIG_SERIO=y
319# CONFIG_SERIO_I8042 is not set
320CONFIG_SERIO_SERPORT=y
321# CONFIG_SERIO_CT82C710 is not set
322# CONFIG_SERIO_LIBPS2 is not set
323# CONFIG_SERIO_RAW is not set
324
325#
326# Input Device Drivers 314# Input Device Drivers
327# 315#
328# CONFIG_INPUT_KEYBOARD is not set 316# CONFIG_INPUT_KEYBOARD is not set
@@ -332,6 +320,17 @@ CONFIG_SERIO_SERPORT=y
332# CONFIG_INPUT_MISC is not set 320# CONFIG_INPUT_MISC is not set
333 321
334# 322#
323# Hardware I/O ports
324#
325CONFIG_SERIO=y
326# CONFIG_SERIO_I8042 is not set
327CONFIG_SERIO_SERPORT=y
328# CONFIG_SERIO_LIBPS2 is not set
329# CONFIG_SERIO_RAW is not set
330# CONFIG_GAMEPORT is not set
331CONFIG_SOUND_GAMEPORT=y
332
333#
335# Character devices 334# Character devices
336# 335#
337# CONFIG_VT is not set 336# CONFIG_VT is not set
@@ -375,6 +374,10 @@ CONFIG_LEGACY_PTY_COUNT=256
375# CONFIG_RAW_DRIVER is not set 374# CONFIG_RAW_DRIVER is not set
376 375
377# 376#
377# TPM devices
378#
379
380#
378# I2C support 381# I2C support
379# 382#
380# CONFIG_I2C is not set 383# CONFIG_I2C is not set
@@ -415,10 +418,6 @@ CONFIG_LEGACY_PTY_COUNT=256
415# CONFIG_USB_ARCH_HAS_OHCI is not set 418# CONFIG_USB_ARCH_HAS_OHCI is not set
416 419
417# 420#
418# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
419#
420
421#
422# USB Gadget Support 421# USB Gadget Support
423# 422#
424# CONFIG_USB_GADGET is not set 423# CONFIG_USB_GADGET is not set
@@ -574,8 +573,9 @@ CONFIG_NLS_DEFAULT="iso8859-1"
574# 573#
575# Kernel hacking 574# Kernel hacking
576# 575#
576# CONFIG_PRINTK_TIME is not set
577# CONFIG_DEBUG_KERNEL is not set 577# CONFIG_DEBUG_KERNEL is not set
578CONFIG_DEBUG_PREEMPT=y 578CONFIG_LOG_BUF_SHIFT=14
579# CONFIG_DEBUG_BUGVERBOSE is not set 579# CONFIG_DEBUG_BUGVERBOSE is not set
580# CONFIG_FRAME_POINTER is not set 580# CONFIG_FRAME_POINTER is not set
581 581
diff --git a/arch/m32r/opsput/defconfig.opsput b/arch/m32r/opsput/defconfig.opsput
index a87e1ea4c301..66adec6a701a 100644
--- a/arch/m32r/opsput/defconfig.opsput
+++ b/arch/m32r/opsput/defconfig.opsput
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc4 3# Linux kernel version: 2.6.12-rc5
4# Wed Feb 16 21:11:41 2005 4# Fri Jun 3 16:22:06 2005
5# 5#
6CONFIG_M32R=y 6CONFIG_M32R=y
7# CONFIG_UID16 is not set 7# CONFIG_UID16 is not set
@@ -15,6 +15,7 @@ CONFIG_GENERIC_IRQ_PROBE=y
15CONFIG_EXPERIMENTAL=y 15CONFIG_EXPERIMENTAL=y
16CONFIG_CLEAN_COMPILE=y 16CONFIG_CLEAN_COMPILE=y
17CONFIG_BROKEN_ON_SMP=y 17CONFIG_BROKEN_ON_SMP=y
18CONFIG_INIT_ENV_ARG_LIMIT=32
18 19
19# 20#
20# General setup 21# General setup
@@ -27,13 +28,15 @@ CONFIG_BSD_PROCESS_ACCT=y
27# CONFIG_BSD_PROCESS_ACCT_V3 is not set 28# CONFIG_BSD_PROCESS_ACCT_V3 is not set
28CONFIG_SYSCTL=y 29CONFIG_SYSCTL=y
29# CONFIG_AUDIT is not set 30# CONFIG_AUDIT is not set
30CONFIG_LOG_BUF_SHIFT=14
31CONFIG_HOTPLUG=y 31CONFIG_HOTPLUG=y
32CONFIG_KOBJECT_UEVENT=y 32CONFIG_KOBJECT_UEVENT=y
33CONFIG_IKCONFIG=y 33CONFIG_IKCONFIG=y
34# CONFIG_IKCONFIG_PROC is not set 34# CONFIG_IKCONFIG_PROC is not set
35CONFIG_EMBEDDED=y 35CONFIG_EMBEDDED=y
36# CONFIG_KALLSYMS is not set 36# CONFIG_KALLSYMS is not set
37CONFIG_PRINTK=y
38CONFIG_BUG=y
39CONFIG_BASE_FULL=y
37# CONFIG_FUTEX is not set 40# CONFIG_FUTEX is not set
38# CONFIG_EPOLL is not set 41# CONFIG_EPOLL is not set
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 42# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
@@ -43,6 +46,7 @@ CONFIG_CC_ALIGN_LABELS=0
43CONFIG_CC_ALIGN_LOOPS=0 46CONFIG_CC_ALIGN_LOOPS=0
44CONFIG_CC_ALIGN_JUMPS=0 47CONFIG_CC_ALIGN_JUMPS=0
45# CONFIG_TINY_SHMEM is not set 48# CONFIG_TINY_SHMEM is not set
49CONFIG_BASE_SMALL=0
46 50
47# 51#
48# Loadable module support 52# Loadable module support
@@ -64,6 +68,7 @@ CONFIG_KMOD=y
64CONFIG_PLAT_OPSPUT=y 68CONFIG_PLAT_OPSPUT=y
65# CONFIG_PLAT_OAKS32R is not set 69# CONFIG_PLAT_OAKS32R is not set
66# CONFIG_PLAT_MAPPI2 is not set 70# CONFIG_PLAT_MAPPI2 is not set
71# CONFIG_PLAT_MAPPI3 is not set
67# CONFIG_CHIP_M32700 is not set 72# CONFIG_CHIP_M32700 is not set
68# CONFIG_CHIP_M32102 is not set 73# CONFIG_CHIP_M32102 is not set
69# CONFIG_CHIP_VDEC2 is not set 74# CONFIG_CHIP_VDEC2 is not set
@@ -243,7 +248,6 @@ CONFIG_NET=y
243# 248#
244CONFIG_PACKET=y 249CONFIG_PACKET=y
245# CONFIG_PACKET_MMAP is not set 250# CONFIG_PACKET_MMAP is not set
246# CONFIG_NETLINK_DEV is not set
247CONFIG_UNIX=y 251CONFIG_UNIX=y
248# CONFIG_NET_KEY is not set 252# CONFIG_NET_KEY is not set
249CONFIG_INET=y 253CONFIG_INET=y
@@ -368,18 +372,6 @@ CONFIG_INPUT=y
368# CONFIG_INPUT_EVBUG is not set 372# CONFIG_INPUT_EVBUG is not set
369 373
370# 374#
371# Input I/O drivers
372#
373# CONFIG_GAMEPORT is not set
374CONFIG_SOUND_GAMEPORT=y
375CONFIG_SERIO=y
376# CONFIG_SERIO_I8042 is not set
377CONFIG_SERIO_SERPORT=y
378# CONFIG_SERIO_CT82C710 is not set
379# CONFIG_SERIO_LIBPS2 is not set
380# CONFIG_SERIO_RAW is not set
381
382#
383# Input Device Drivers 375# Input Device Drivers
384# 376#
385# CONFIG_INPUT_KEYBOARD is not set 377# CONFIG_INPUT_KEYBOARD is not set
@@ -389,6 +381,17 @@ CONFIG_SERIO_SERPORT=y
389# CONFIG_INPUT_MISC is not set 381# CONFIG_INPUT_MISC is not set
390 382
391# 383#
384# Hardware I/O ports
385#
386CONFIG_SERIO=y
387# CONFIG_SERIO_I8042 is not set
388CONFIG_SERIO_SERPORT=y
389# CONFIG_SERIO_LIBPS2 is not set
390# CONFIG_SERIO_RAW is not set
391# CONFIG_GAMEPORT is not set
392CONFIG_SOUND_GAMEPORT=y
393
394#
392# Character devices 395# Character devices
393# 396#
394# CONFIG_VT is not set 397# CONFIG_VT is not set
@@ -438,6 +441,10 @@ CONFIG_DS1302=y
438# CONFIG_RAW_DRIVER is not set 441# CONFIG_RAW_DRIVER is not set
439 442
440# 443#
444# TPM devices
445#
446
447#
441# I2C support 448# I2C support
442# 449#
443# CONFIG_I2C is not set 450# CONFIG_I2C is not set
@@ -478,10 +485,6 @@ CONFIG_DS1302=y
478# CONFIG_USB_ARCH_HAS_OHCI is not set 485# CONFIG_USB_ARCH_HAS_OHCI is not set
479 486
480# 487#
481# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
482#
483
484#
485# USB Gadget Support 488# USB Gadget Support
486# 489#
487# CONFIG_USB_GADGET is not set 490# CONFIG_USB_GADGET is not set
@@ -654,8 +657,10 @@ CONFIG_NLS_DEFAULT="iso8859-1"
654# 657#
655# Kernel hacking 658# Kernel hacking
656# 659#
660# CONFIG_PRINTK_TIME is not set
657CONFIG_DEBUG_KERNEL=y 661CONFIG_DEBUG_KERNEL=y
658# CONFIG_MAGIC_SYSRQ is not set 662# CONFIG_MAGIC_SYSRQ is not set
663CONFIG_LOG_BUF_SHIFT=14
659# CONFIG_SCHEDSTATS is not set 664# CONFIG_SCHEDSTATS is not set
660# CONFIG_DEBUG_SLAB is not set 665# CONFIG_DEBUG_SLAB is not set
661# CONFIG_DEBUG_SPINLOCK is not set 666# CONFIG_DEBUG_SPINLOCK is not set
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index b027ce7efbc6..73843c528778 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -232,7 +232,6 @@ void __init mem_init(void)
232#ifdef CONFIG_LIMITED_DMA 232#ifdef CONFIG_LIMITED_DMA
233 set_page_address(page, lowmem_page_address(page)); 233 set_page_address(page, lowmem_page_address(page));
234#endif 234#endif
235 set_bit(PG_highmem, &page->flags);
236 set_page_count(page, 1); 235 set_page_count(page, 1);
237 __free_page(page); 236 __free_page(page);
238 totalhigh_pages++; 237 totalhigh_pages++;
diff --git a/arch/ppc/Kconfig b/arch/ppc/Kconfig
index 54ce6da22644..10162b187bcf 100644
--- a/arch/ppc/Kconfig
+++ b/arch/ppc/Kconfig
@@ -826,11 +826,6 @@ config MPC10X_BRIDGE
826 depends on PCORE || POWERPMC250 || LOPEC || SANDPOINT 826 depends on PCORE || POWERPMC250 || LOPEC || SANDPOINT
827 default y 827 default y
828 828
829config FSL_OCP
830 bool
831 depends on MPC10X_BRIDGE
832 default y
833
834config MPC10X_OPENPIC 829config MPC10X_OPENPIC
835 bool 830 bool
836 depends on POWERPMC250 || LOPEC || SANDPOINT 831 depends on POWERPMC250 || LOPEC || SANDPOINT
diff --git a/arch/ppc/boot/ld.script b/arch/ppc/boot/ld.script
index 6ee602d8b6a0..9362193742ac 100644
--- a/arch/ppc/boot/ld.script
+++ b/arch/ppc/boot/ld.script
@@ -58,9 +58,6 @@ SECTIONS
58 *(.ramdisk) 58 *(.ramdisk)
59 __ramdisk_end = .; 59 __ramdisk_end = .;
60 . = ALIGN(4096); 60 . = ALIGN(4096);
61 __sysmap_begin = .;
62 *(.sysmap)
63 __sysmap_end = .;
64 CONSTRUCTORS 61 CONSTRUCTORS
65 } 62 }
66 _edata = .; 63 _edata = .;
diff --git a/arch/ppc/boot/openfirmware/Makefile b/arch/ppc/boot/openfirmware/Makefile
index 4eacbd8c772a..03415238fabf 100644
--- a/arch/ppc/boot/openfirmware/Makefile
+++ b/arch/ppc/boot/openfirmware/Makefile
@@ -54,13 +54,10 @@ $(images)/ramdisk.image.gz:
54 @echo ' RAM disk image must be provided separately' 54 @echo ' RAM disk image must be provided separately'
55 @/bin/false 55 @/bin/false
56 56
57objcpxmon-$(CONFIG_XMON) := --add-section=.sysmap=System.map \
58 --set-section-flags=.sysmap=contents,alloc,load,readonly,data
59quiet_cmd_genimage = GEN $@ 57quiet_cmd_genimage = GEN $@
60 cmd_genimage = $(OBJCOPY) -R .comment \ 58 cmd_genimage = $(OBJCOPY) -R .comment \
61 --add-section=.image=$(images)/vmlinux.gz \ 59 --add-section=.image=$(images)/vmlinux.gz \
62 --set-section-flags=.image=contents,alloc,load,readonly,data \ 60 --set-section-flags=.image=contents,alloc,load,readonly,data $< $@
63 $(objcpxmon-y) $< $@
64 61
65targets += image.o 62targets += image.o
66$(obj)/image.o: $(obj)/dummy.o $(images)/vmlinux.gz FORCE 63$(obj)/image.o: $(obj)/dummy.o $(images)/vmlinux.gz FORCE
diff --git a/arch/ppc/boot/openfirmware/common.c b/arch/ppc/boot/openfirmware/common.c
index 9e6952781f1f..0f46756a903e 100644
--- a/arch/ppc/boot/openfirmware/common.c
+++ b/arch/ppc/boot/openfirmware/common.c
@@ -15,7 +15,6 @@
15#include <asm/page.h> 15#include <asm/page.h>
16 16
17/* Information from the linker */ 17/* Information from the linker */
18extern char __sysmap_begin, __sysmap_end;
19 18
20extern int strcmp(const char *s1, const char *s2); 19extern int strcmp(const char *s1, const char *s2);
21extern char *avail_ram, *avail_high; 20extern char *avail_ram, *avail_high;
@@ -116,14 +115,8 @@ void gunzip(void *dst, int dstlen, unsigned char *src, int *lenp)
116void make_bi_recs(unsigned long addr, char *name, unsigned int mach, 115void make_bi_recs(unsigned long addr, char *name, unsigned int mach,
117 unsigned long progend) 116 unsigned long progend)
118{ 117{
119 unsigned long sysmap_size;
120 struct bi_record *rec; 118 struct bi_record *rec;
121 119
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 120
128 /* leave a 1MB gap then align to the next 1MB boundary */ 121 /* leave a 1MB gap then align to the next 1MB boundary */
129 addr = _ALIGN(addr+ (1<<20) - 1, (1<<20)); 122 addr = _ALIGN(addr+ (1<<20) - 1, (1<<20));
@@ -147,15 +140,6 @@ void make_bi_recs(unsigned long addr, char *name, unsigned int mach,
147 rec->size = sizeof(struct bi_record) + 2 * sizeof(unsigned long); 140 rec->size = sizeof(struct bi_record) + 2 * sizeof(unsigned long);
148 rec = (struct bi_record *)((unsigned long)rec + rec->size); 141 rec = (struct bi_record *)((unsigned long)rec + rec->size);
149 142
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; 143 rec->tag = BI_LAST;
160 rec->size = sizeof(struct bi_record); 144 rec->size = sizeof(struct bi_record);
161 rec = (struct bi_record *)((unsigned long)rec + rec->size); 145 rec = (struct bi_record *)((unsigned long)rec + rec->size);
diff --git a/arch/ppc/boot/simple/Makefile b/arch/ppc/boot/simple/Makefile
index c28061ad5982..991b4cbb83c8 100644
--- a/arch/ppc/boot/simple/Makefile
+++ b/arch/ppc/boot/simple/Makefile
@@ -203,7 +203,7 @@ $(obj)/zvmlinux: $(OBJS) $(LIBS) $(srctree)/$(boot)/ld.script \
203 $(obj)/dummy.o $(obj)/image.o 203 $(obj)/dummy.o $(obj)/image.o
204 $(LD) $(LD_ARGS) -o $@ $(OBJS) $(obj)/image.o $(LIBS) 204 $(LD) $(LD_ARGS) -o $@ $(OBJS) $(obj)/image.o $(LIBS)
205 $(OBJCOPY) $(OBJCOPY_ARGS) $@ $@ -R .comment -R .stab \ 205 $(OBJCOPY) $(OBJCOPY_ARGS) $@ $@ -R .comment -R .stab \
206 -R .stabstr -R .ramdisk -R .sysmap 206 -R .stabstr -R .ramdisk
207 207
208$(obj)/zvmlinux.initrd: $(OBJS) $(LIBS) $(srctree)/$(boot)/ld.script \ 208$(obj)/zvmlinux.initrd: $(OBJS) $(LIBS) $(srctree)/$(boot)/ld.script \
209 $(images)/vmlinux.gz $(obj)/dummy.o 209 $(images)/vmlinux.gz $(obj)/dummy.o
@@ -215,7 +215,7 @@ $(obj)/zvmlinux.initrd: $(OBJS) $(LIBS) $(srctree)/$(boot)/ld.script \
215 $(obj)/dummy.o $(obj)/image.o 215 $(obj)/dummy.o $(obj)/image.o
216 $(LD) $(LD_ARGS) -o $@ $(OBJS) $(obj)/image.o $(LIBS) 216 $(LD) $(LD_ARGS) -o $@ $(OBJS) $(obj)/image.o $(LIBS)
217 $(OBJCOPY) $(OBJCOPY_ARGS) $@ $@ -R .comment -R .stab \ 217 $(OBJCOPY) $(OBJCOPY_ARGS) $@ $@ -R .comment -R .stab \
218 -R .stabstr -R .sysmap 218 -R .stabstr
219 219
220# Sort-of dummy rules, that let us format the image we want. 220# Sort-of dummy rules, that let us format the image we want.
221zImage: $(images)/$(zimage-y) $(obj)/zvmlinux 221zImage: $(images)/$(zimage-y) $(obj)/zvmlinux
diff --git a/arch/ppc/boot/utils/addSystemMap.c b/arch/ppc/boot/utils/addSystemMap.c
deleted file mode 100644
index 4654f891b274..000000000000
--- a/arch/ppc/boot/utils/addSystemMap.c
+++ /dev/null
@@ -1,186 +0,0 @@
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/configs/mpc8548_cds_defconfig b/arch/ppc/configs/mpc8548_cds_defconfig
new file mode 100644
index 000000000000..abe034f24b83
--- /dev/null
+++ b/arch/ppc/configs/mpc8548_cds_defconfig
@@ -0,0 +1,659 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.12-rc4
4# Tue May 24 22:36:27 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
14CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
15
16#
17# Code maturity level options
18#
19CONFIG_EXPERIMENTAL=y
20CONFIG_CLEAN_COMPILE=y
21CONFIG_BROKEN_ON_SMP=y
22CONFIG_INIT_ENV_ARG_LIMIT=32
23
24#
25# General setup
26#
27CONFIG_LOCALVERSION=""
28CONFIG_SWAP=y
29CONFIG_SYSVIPC=y
30# CONFIG_POSIX_MQUEUE is not set
31# CONFIG_BSD_PROCESS_ACCT is not set
32CONFIG_SYSCTL=y
33# CONFIG_AUDIT is not set
34# CONFIG_HOTPLUG is not set
35CONFIG_KOBJECT_UEVENT=y
36# CONFIG_IKCONFIG is not set
37CONFIG_EMBEDDED=y
38# CONFIG_KALLSYMS is not set
39CONFIG_PRINTK=y
40CONFIG_BUG=y
41CONFIG_BASE_FULL=y
42CONFIG_FUTEX=y
43# CONFIG_EPOLL is not set
44# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
45CONFIG_SHMEM=y
46CONFIG_CC_ALIGN_FUNCTIONS=0
47CONFIG_CC_ALIGN_LABELS=0
48CONFIG_CC_ALIGN_LOOPS=0
49CONFIG_CC_ALIGN_JUMPS=0
50# CONFIG_TINY_SHMEM is not set
51CONFIG_BASE_SMALL=0
52
53#
54# Loadable module support
55#
56# CONFIG_MODULES is not set
57
58#
59# Processor
60#
61# CONFIG_6xx is not set
62# CONFIG_40x is not set
63# CONFIG_44x is not set
64# CONFIG_POWER3 is not set
65# CONFIG_POWER4 is not set
66# CONFIG_8xx is not set
67CONFIG_E500=y
68CONFIG_BOOKE=y
69CONFIG_FSL_BOOKE=y
70# CONFIG_PHYS_64BIT is not set
71CONFIG_SPE=y
72CONFIG_MATH_EMULATION=y
73# CONFIG_CPU_FREQ is not set
74# CONFIG_PM 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
82CONFIG_MPC8548_CDS=y
83# CONFIG_MPC8555_CDS is not set
84# CONFIG_MPC8560_ADS is not set
85# CONFIG_SBC8560 is not set
86# CONFIG_STX_GP3 is not set
87CONFIG_MPC8548=y
88
89#
90# Platform options
91#
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
98CONFIG_ISA_DMA_API=y
99
100#
101# Bus options
102#
103# CONFIG_PCI is not set
104# CONFIG_PCI_DOMAINS is not set
105
106#
107# PCCARD (PCMCIA/CardBus) support
108#
109# CONFIG_PCCARD is not set
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_DEV_COW_COMMON is not set
155CONFIG_BLK_DEV_LOOP=y
156# CONFIG_BLK_DEV_CRYPTOLOOP is not set
157# CONFIG_BLK_DEV_NBD is not set
158CONFIG_BLK_DEV_RAM=y
159CONFIG_BLK_DEV_RAM_COUNT=16
160CONFIG_BLK_DEV_RAM_SIZE=32768
161CONFIG_BLK_DEV_INITRD=y
162CONFIG_INITRAMFS_SOURCE=""
163# CONFIG_LBD is not set
164# CONFIG_CDROM_PKTCDVD is not set
165
166#
167# IO Schedulers
168#
169CONFIG_IOSCHED_NOOP=y
170CONFIG_IOSCHED_AS=y
171CONFIG_IOSCHED_DEADLINE=y
172CONFIG_IOSCHED_CFQ=y
173# CONFIG_ATA_OVER_ETH is not set
174
175#
176# ATA/ATAPI/MFM/RLL support
177#
178# CONFIG_IDE is not set
179
180#
181# SCSI device support
182#
183# CONFIG_SCSI is not set
184
185#
186# Multi-device support (RAID and LVM)
187#
188# CONFIG_MD is not set
189
190#
191# Fusion MPT device support
192#
193
194#
195# IEEE 1394 (FireWire) support
196#
197
198#
199# I2O device support
200#
201
202#
203# Macintosh device drivers
204#
205
206#
207# Networking support
208#
209CONFIG_NET=y
210
211#
212# Networking options
213#
214CONFIG_PACKET=y
215# CONFIG_PACKET_MMAP is not set
216CONFIG_UNIX=y
217# CONFIG_NET_KEY is not set
218CONFIG_INET=y
219CONFIG_IP_MULTICAST=y
220# CONFIG_IP_ADVANCED_ROUTER is not set
221CONFIG_IP_PNP=y
222CONFIG_IP_PNP_DHCP=y
223CONFIG_IP_PNP_BOOTP=y
224# CONFIG_IP_PNP_RARP is not set
225# CONFIG_NET_IPIP is not set
226# CONFIG_NET_IPGRE is not set
227# CONFIG_IP_MROUTE is not set
228# CONFIG_ARPD is not set
229CONFIG_SYN_COOKIES=y
230# CONFIG_INET_AH is not set
231# CONFIG_INET_ESP is not set
232# CONFIG_INET_IPCOMP is not set
233# CONFIG_INET_TUNNEL is not set
234CONFIG_IP_TCPDIAG=y
235# CONFIG_IP_TCPDIAG_IPV6 is not set
236# CONFIG_IPV6 is not set
237# CONFIG_NETFILTER is not set
238
239#
240# SCTP Configuration (EXPERIMENTAL)
241#
242# CONFIG_IP_SCTP is not set
243# CONFIG_ATM is not set
244# CONFIG_BRIDGE is not set
245# CONFIG_VLAN_8021Q is not set
246# CONFIG_DECNET is not set
247# CONFIG_LLC2 is not set
248# CONFIG_IPX is not set
249# CONFIG_ATALK is not set
250# CONFIG_X25 is not set
251# CONFIG_LAPB is not set
252# CONFIG_NET_DIVERT is not set
253# CONFIG_ECONET is not set
254# CONFIG_WAN_ROUTER is not set
255
256#
257# QoS and/or fair queueing
258#
259# CONFIG_NET_SCHED is not set
260# CONFIG_NET_CLS_ROUTE is not set
261
262#
263# Network testing
264#
265# CONFIG_NET_PKTGEN is not set
266# CONFIG_NETPOLL is not set
267# CONFIG_NET_POLL_CONTROLLER is not set
268# CONFIG_HAMRADIO is not set
269# CONFIG_IRDA is not set
270# CONFIG_BT is not set
271CONFIG_NETDEVICES=y
272# CONFIG_DUMMY is not set
273# CONFIG_BONDING is not set
274# CONFIG_EQUALIZER is not set
275# CONFIG_TUN is not set
276
277#
278# Ethernet (10 or 100Mbit)
279#
280CONFIG_NET_ETHERNET=y
281CONFIG_MII=y
282
283#
284# Ethernet (1000 Mbit)
285#
286CONFIG_GIANFAR=y
287CONFIG_GFAR_NAPI=y
288
289#
290# Ethernet (10000 Mbit)
291#
292
293#
294# Token Ring devices
295#
296
297#
298# Wireless LAN (non-hamradio)
299#
300# CONFIG_NET_RADIO is not set
301
302#
303# Wan interfaces
304#
305# CONFIG_WAN is not set
306# CONFIG_PPP is not set
307# CONFIG_SLIP is not set
308# CONFIG_SHAPER is not set
309# CONFIG_NETCONSOLE is not set
310
311#
312# ISDN subsystem
313#
314# CONFIG_ISDN is not set
315
316#
317# Telephony Support
318#
319# CONFIG_PHONE is not set
320
321#
322# Input device support
323#
324CONFIG_INPUT=y
325
326#
327# Userland interfaces
328#
329# CONFIG_INPUT_MOUSEDEV is not set
330# CONFIG_INPUT_JOYDEV is not set
331# CONFIG_INPUT_TSDEV is not set
332# CONFIG_INPUT_EVDEV is not set
333# CONFIG_INPUT_EVBUG is not set
334
335#
336# Input Device Drivers
337#
338# CONFIG_INPUT_KEYBOARD is not set
339# CONFIG_INPUT_MOUSE is not set
340# CONFIG_INPUT_JOYSTICK is not set
341# CONFIG_INPUT_TOUCHSCREEN is not set
342# CONFIG_INPUT_MISC is not set
343
344#
345# Hardware I/O ports
346#
347# CONFIG_SERIO is not set
348# CONFIG_GAMEPORT is not set
349CONFIG_SOUND_GAMEPORT=y
350
351#
352# Character devices
353#
354# CONFIG_VT is not set
355# CONFIG_SERIAL_NONSTANDARD is not set
356
357#
358# Serial drivers
359#
360CONFIG_SERIAL_8250=y
361CONFIG_SERIAL_8250_CONSOLE=y
362CONFIG_SERIAL_8250_NR_UARTS=4
363# CONFIG_SERIAL_8250_EXTENDED is not set
364
365#
366# Non-8250 serial port support
367#
368CONFIG_SERIAL_CORE=y
369CONFIG_SERIAL_CORE_CONSOLE=y
370CONFIG_UNIX98_PTYS=y
371CONFIG_LEGACY_PTYS=y
372CONFIG_LEGACY_PTY_COUNT=256
373
374#
375# IPMI
376#
377# CONFIG_IPMI_HANDLER is not set
378
379#
380# Watchdog Cards
381#
382# CONFIG_WATCHDOG is not set
383# CONFIG_NVRAM is not set
384CONFIG_GEN_RTC=y
385# CONFIG_GEN_RTC_X is not set
386# CONFIG_DTLK is not set
387# CONFIG_R3964 is not set
388
389#
390# Ftape, the floppy tape device driver
391#
392# CONFIG_AGP is not set
393# CONFIG_DRM is not set
394# CONFIG_RAW_DRIVER is not set
395
396#
397# TPM devices
398#
399
400#
401# I2C support
402#
403CONFIG_I2C=y
404CONFIG_I2C_CHARDEV=y
405
406#
407# I2C Algorithms
408#
409# CONFIG_I2C_ALGOBIT is not set
410# CONFIG_I2C_ALGOPCF is not set
411# CONFIG_I2C_ALGOPCA is not set
412
413#
414# I2C Hardware Bus support
415#
416# CONFIG_I2C_ISA is not set
417CONFIG_I2C_MPC=y
418# CONFIG_I2C_PARPORT_LIGHT is not set
419# CONFIG_I2C_PCA_ISA is not set
420
421#
422# Hardware Sensors Chip support
423#
424# CONFIG_I2C_SENSOR is not set
425# CONFIG_SENSORS_ADM1021 is not set
426# CONFIG_SENSORS_ADM1025 is not set
427# CONFIG_SENSORS_ADM1026 is not set
428# CONFIG_SENSORS_ADM1031 is not set
429# CONFIG_SENSORS_ASB100 is not set
430# CONFIG_SENSORS_DS1621 is not set
431# CONFIG_SENSORS_FSCHER is not set
432# CONFIG_SENSORS_FSCPOS is not set
433# CONFIG_SENSORS_GL518SM is not set
434# CONFIG_SENSORS_GL520SM is not set
435# CONFIG_SENSORS_IT87 is not set
436# CONFIG_SENSORS_LM63 is not set
437# CONFIG_SENSORS_LM75 is not set
438# CONFIG_SENSORS_LM77 is not set
439# CONFIG_SENSORS_LM78 is not set
440# CONFIG_SENSORS_LM80 is not set
441# CONFIG_SENSORS_LM83 is not set
442# CONFIG_SENSORS_LM85 is not set
443# CONFIG_SENSORS_LM87 is not set
444# CONFIG_SENSORS_LM90 is not set
445# CONFIG_SENSORS_LM92 is not set
446# CONFIG_SENSORS_MAX1619 is not set
447# CONFIG_SENSORS_PC87360 is not set
448# CONFIG_SENSORS_SMSC47B397 is not set
449# CONFIG_SENSORS_SMSC47M1 is not set
450# CONFIG_SENSORS_W83781D is not set
451# CONFIG_SENSORS_W83L785TS is not set
452# CONFIG_SENSORS_W83627HF is not set
453
454#
455# Other I2C Chip support
456#
457# CONFIG_SENSORS_DS1337 is not set
458# CONFIG_SENSORS_EEPROM is not set
459# CONFIG_SENSORS_PCF8574 is not set
460# CONFIG_SENSORS_PCF8591 is not set
461# CONFIG_SENSORS_RTC8564 is not set
462# CONFIG_SENSORS_M41T00 is not set
463# CONFIG_I2C_DEBUG_CORE is not set
464# CONFIG_I2C_DEBUG_ALGO is not set
465# CONFIG_I2C_DEBUG_BUS is not set
466# CONFIG_I2C_DEBUG_CHIP is not set
467
468#
469# Dallas's 1-wire bus
470#
471# CONFIG_W1 is not set
472
473#
474# Misc devices
475#
476
477#
478# Multimedia devices
479#
480# CONFIG_VIDEO_DEV is not set
481
482#
483# Digital Video Broadcasting Devices
484#
485# CONFIG_DVB is not set
486
487#
488# Graphics support
489#
490# CONFIG_FB is not set
491
492#
493# Sound
494#
495# CONFIG_SOUND is not set
496
497#
498# USB support
499#
500# CONFIG_USB_ARCH_HAS_HCD is not set
501# CONFIG_USB_ARCH_HAS_OHCI is not set
502
503#
504# USB Gadget Support
505#
506# CONFIG_USB_GADGET is not set
507
508#
509# MMC/SD Card support
510#
511# CONFIG_MMC is not set
512
513#
514# InfiniBand support
515#
516# CONFIG_INFINIBAND is not set
517
518#
519# File systems
520#
521CONFIG_EXT2_FS=y
522# CONFIG_EXT2_FS_XATTR is not set
523CONFIG_EXT3_FS=y
524CONFIG_EXT3_FS_XATTR=y
525# CONFIG_EXT3_FS_POSIX_ACL is not set
526# CONFIG_EXT3_FS_SECURITY is not set
527CONFIG_JBD=y
528# CONFIG_JBD_DEBUG is not set
529CONFIG_FS_MBCACHE=y
530# CONFIG_REISERFS_FS is not set
531# CONFIG_JFS_FS is not set
532
533#
534# XFS support
535#
536# CONFIG_XFS_FS is not set
537# CONFIG_MINIX_FS is not set
538# CONFIG_ROMFS_FS is not set
539# CONFIG_QUOTA is not set
540CONFIG_DNOTIFY=y
541# CONFIG_AUTOFS_FS is not set
542# CONFIG_AUTOFS4_FS is not set
543
544#
545# CD-ROM/DVD Filesystems
546#
547# CONFIG_ISO9660_FS is not set
548# CONFIG_UDF_FS is not set
549
550#
551# DOS/FAT/NT Filesystems
552#
553# CONFIG_MSDOS_FS is not set
554# CONFIG_VFAT_FS is not set
555# CONFIG_NTFS_FS is not set
556
557#
558# Pseudo filesystems
559#
560CONFIG_PROC_FS=y
561CONFIG_PROC_KCORE=y
562CONFIG_SYSFS=y
563# CONFIG_DEVFS_FS is not set
564# CONFIG_DEVPTS_FS_XATTR is not set
565CONFIG_TMPFS=y
566# CONFIG_TMPFS_XATTR is not set
567# CONFIG_HUGETLB_PAGE is not set
568CONFIG_RAMFS=y
569
570#
571# Miscellaneous filesystems
572#
573# CONFIG_ADFS_FS is not set
574# CONFIG_AFFS_FS is not set
575# CONFIG_HFS_FS is not set
576# CONFIG_HFSPLUS_FS is not set
577# CONFIG_BEFS_FS is not set
578# CONFIG_BFS_FS is not set
579# CONFIG_EFS_FS is not set
580# CONFIG_CRAMFS is not set
581# CONFIG_VXFS_FS is not set
582# CONFIG_HPFS_FS is not set
583# CONFIG_QNX4FS_FS is not set
584# CONFIG_SYSV_FS is not set
585# CONFIG_UFS_FS is not set
586
587#
588# Network File Systems
589#
590CONFIG_NFS_FS=y
591# CONFIG_NFS_V3 is not set
592# CONFIG_NFS_V4 is not set
593# CONFIG_NFS_DIRECTIO is not set
594# CONFIG_NFSD is not set
595CONFIG_ROOT_NFS=y
596CONFIG_LOCKD=y
597CONFIG_SUNRPC=y
598# CONFIG_RPCSEC_GSS_KRB5 is not set
599# CONFIG_RPCSEC_GSS_SPKM3 is not set
600# CONFIG_SMB_FS is not set
601# CONFIG_CIFS is not set
602# CONFIG_NCP_FS is not set
603# CONFIG_CODA_FS is not set
604# CONFIG_AFS_FS is not set
605
606#
607# Partition Types
608#
609CONFIG_PARTITION_ADVANCED=y
610# CONFIG_ACORN_PARTITION is not set
611# CONFIG_OSF_PARTITION is not set
612# CONFIG_AMIGA_PARTITION is not set
613# CONFIG_ATARI_PARTITION is not set
614# CONFIG_MAC_PARTITION is not set
615# CONFIG_MSDOS_PARTITION is not set
616# CONFIG_LDM_PARTITION is not set
617# CONFIG_SGI_PARTITION is not set
618# CONFIG_ULTRIX_PARTITION is not set
619# CONFIG_SUN_PARTITION is not set
620# CONFIG_EFI_PARTITION is not set
621
622#
623# Native Language Support
624#
625# CONFIG_NLS is not set
626
627#
628# Library routines
629#
630# CONFIG_CRC_CCITT is not set
631CONFIG_CRC32=y
632# CONFIG_LIBCRC32C is not set
633
634#
635# Profiling support
636#
637# CONFIG_PROFILING is not set
638
639#
640# Kernel hacking
641#
642# CONFIG_PRINTK_TIME is not set
643# CONFIG_DEBUG_KERNEL is not set
644CONFIG_LOG_BUF_SHIFT=14
645
646#
647# Security options
648#
649# CONFIG_KEYS is not set
650# CONFIG_SECURITY is not set
651
652#
653# Cryptographic options
654#
655# CONFIG_CRYPTO is not set
656
657#
658# Hardware crypto devices
659#
diff --git a/arch/ppc/kernel/cputable.c b/arch/ppc/kernel/cputable.c
index d44b7dc5390a..01c226008dbf 100644
--- a/arch/ppc/kernel/cputable.c
+++ b/arch/ppc/kernel/cputable.c
@@ -918,6 +918,20 @@ struct cpu_spec cpu_specs[] = {
918 .dcache_bsize = 32, 918 .dcache_bsize = 32,
919 .num_pmcs = 4, 919 .num_pmcs = 4,
920 }, 920 },
921 { /* e500v2 */
922 .pvr_mask = 0xffff0000,
923 .pvr_value = 0x80210000,
924 .cpu_name = "e500v2",
925 /* xxx - galak: add CPU_FTR_MAYBE_CAN_DOZE */
926 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
927 CPU_FTR_USE_TB | CPU_FTR_BIG_PHYS,
928 .cpu_user_features = PPC_FEATURE_32 |
929 PPC_FEATURE_HAS_MMU | PPC_FEATURE_SPE_COMP |
930 PPC_FEATURE_HAS_EFP_SINGLE | PPC_FEATURE_HAS_EFP_DOUBLE,
931 .icache_bsize = 32,
932 .dcache_bsize = 32,
933 .num_pmcs = 4,
934 },
921#endif 935#endif
922#if !CLASSIC_PPC 936#if !CLASSIC_PPC
923 { /* default match */ 937 { /* default match */
diff --git a/arch/ppc/kernel/entry.S b/arch/ppc/kernel/entry.S
index 661523707e8c..8377b6ca26da 100644
--- a/arch/ppc/kernel/entry.S
+++ b/arch/ppc/kernel/entry.S
@@ -46,26 +46,23 @@
46 46
47#ifdef CONFIG_BOOKE 47#ifdef CONFIG_BOOKE
48#include "head_booke.h" 48#include "head_booke.h"
49#define TRANSFER_TO_HANDLER_EXC_LEVEL(exc_level) \
50 mtspr exc_level##_SPRG,r8; \
51 BOOKE_LOAD_EXC_LEVEL_STACK(exc_level); \
52 lwz r0,GPR10-INT_FRAME_SIZE(r8); \
53 stw r0,GPR10(r11); \
54 lwz r0,GPR11-INT_FRAME_SIZE(r8); \
55 stw r0,GPR11(r11); \
56 mfspr r8,exc_level##_SPRG
57
49 .globl mcheck_transfer_to_handler 58 .globl mcheck_transfer_to_handler
50mcheck_transfer_to_handler: 59mcheck_transfer_to_handler:
51 mtspr MCHECK_SPRG,r8 60 TRANSFER_TO_HANDLER_EXC_LEVEL(MCHECK)
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 61 b transfer_to_handler_full
59 62
60 .globl crit_transfer_to_handler 63 .globl crit_transfer_to_handler
61crit_transfer_to_handler: 64crit_transfer_to_handler:
62 mtspr CRIT_SPRG,r8 65 TRANSFER_TO_HANDLER_EXC_LEVEL(CRIT)
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 */ 66 /* fall through */
70#endif 67#endif
71 68
@@ -783,99 +780,64 @@ exc_exit_restart_end:
783 * time of the critical interrupt. 780 * time of the critical interrupt.
784 * 781 *
785 */ 782 */
786 .globl ret_from_crit_exc
787ret_from_crit_exc:
788 REST_NVGPRS(r1)
789 lwz r3,_MSR(r1)
790 andi. r3,r3,MSR_PR
791 LOAD_MSR_KERNEL(r10,MSR_KERNEL)
792 bne user_exc_return
793
794 lwz r0,GPR0(r1)
795 lwz r2,GPR2(r1)
796 REST_4GPRS(3, r1)
797 REST_2GPRS(7, r1)
798
799 lwz r10,_XER(r1)
800 lwz r11,_CTR(r1)
801 mtspr SPRN_XER,r10
802 mtctr r11
803
804 PPC405_ERR77(0,r1)
805 stwcx. r0,0,r1 /* to clear the reservation */
806
807 lwz r11,_LINK(r1)
808 mtlr r11
809 lwz r10,_CCR(r1)
810 mtcrf 0xff,r10
811#ifdef CONFIG_40x 783#ifdef CONFIG_40x
812 /* avoid any possible TLB misses here by turning off MSR.DR, we 784#define PPC_40x_TURN_OFF_MSR_DR \
813 * assume the instructions here are mapped by a pinned TLB entry */ 785 /* avoid any possible TLB misses here by turning off MSR.DR, we \
814 li r10,MSR_IR 786 * assume the instructions here are mapped by a pinned TLB entry */ \
815 mtmsr r10 787 li r10,MSR_IR; \
816 isync 788 mtmsr r10; \
817 tophys(r1, r1) 789 isync; \
790 tophys(r1, r1);
791#else
792#define PPC_40x_TURN_OFF_MSR_DR
818#endif 793#endif
819 lwz r9,_DEAR(r1) 794
820 lwz r10,_ESR(r1) 795#define RET_FROM_EXC_LEVEL(exc_lvl_srr0, exc_lvl_srr1, exc_lvl_rfi) \
821 mtspr SPRN_DEAR,r9 796 REST_NVGPRS(r1); \
822 mtspr SPRN_ESR,r10 797 lwz r3,_MSR(r1); \
823 lwz r11,_NIP(r1) 798 andi. r3,r3,MSR_PR; \
824 lwz r12,_MSR(r1) 799 LOAD_MSR_KERNEL(r10,MSR_KERNEL); \
825 mtspr SPRN_CSRR0,r11 800 bne user_exc_return; \
826 mtspr SPRN_CSRR1,r12 801 lwz r0,GPR0(r1); \
827 lwz r9,GPR9(r1) 802 lwz r2,GPR2(r1); \
828 lwz r12,GPR12(r1) 803 REST_4GPRS(3, r1); \
829 lwz r10,GPR10(r1) 804 REST_2GPRS(7, r1); \
830 lwz r11,GPR11(r1) 805 lwz r10,_XER(r1); \
831 lwz r1,GPR1(r1) 806 lwz r11,_CTR(r1); \
832 PPC405_ERR77_SYNC 807 mtspr SPRN_XER,r10; \
833 rfci 808 mtctr r11; \
834 b . /* prevent prefetch past rfci */ 809 PPC405_ERR77(0,r1); \
810 stwcx. r0,0,r1; /* to clear the reservation */ \
811 lwz r11,_LINK(r1); \
812 mtlr r11; \
813 lwz r10,_CCR(r1); \
814 mtcrf 0xff,r10; \
815 PPC_40x_TURN_OFF_MSR_DR; \
816 lwz r9,_DEAR(r1); \
817 lwz r10,_ESR(r1); \
818 mtspr SPRN_DEAR,r9; \
819 mtspr SPRN_ESR,r10; \
820 lwz r11,_NIP(r1); \
821 lwz r12,_MSR(r1); \
822 mtspr exc_lvl_srr0,r11; \
823 mtspr exc_lvl_srr1,r12; \
824 lwz r9,GPR9(r1); \
825 lwz r12,GPR12(r1); \
826 lwz r10,GPR10(r1); \
827 lwz r11,GPR11(r1); \
828 lwz r1,GPR1(r1); \
829 PPC405_ERR77_SYNC; \
830 exc_lvl_rfi; \
831 b .; /* prevent prefetch past exc_lvl_rfi */
832
833 .globl ret_from_crit_exc
834ret_from_crit_exc:
835 RET_FROM_EXC_LEVEL(SPRN_CSRR0, SPRN_CSRR1, RFCI)
835 836
836#ifdef CONFIG_BOOKE 837#ifdef CONFIG_BOOKE
837/*
838 * Return from a machine check interrupt, similar to a critical
839 * interrupt.
840 */
841 .globl ret_from_mcheck_exc 838 .globl ret_from_mcheck_exc
842ret_from_mcheck_exc: 839ret_from_mcheck_exc:
843 REST_NVGPRS(r1) 840 RET_FROM_EXC_LEVEL(SPRN_MCSRR0, SPRN_MCSRR1, RFMCI)
844 lwz r3,_MSR(r1)
845 andi. r3,r3,MSR_PR
846 LOAD_MSR_KERNEL(r10,MSR_KERNEL)
847 bne user_exc_return
848
849 lwz r0,GPR0(r1)
850 lwz r2,GPR2(r1)
851 REST_4GPRS(3, r1)
852 REST_2GPRS(7, r1)
853
854 lwz r10,_XER(r1)
855 lwz r11,_CTR(r1)
856 mtspr SPRN_XER,r10
857 mtctr r11
858
859 stwcx. r0,0,r1 /* to clear the reservation */
860
861 lwz r11,_LINK(r1)
862 mtlr r11
863 lwz r10,_CCR(r1)
864 mtcrf 0xff,r10
865 lwz r9,_DEAR(r1)
866 lwz r10,_ESR(r1)
867 mtspr SPRN_DEAR,r9
868 mtspr SPRN_ESR,r10
869 lwz r11,_NIP(r1)
870 lwz r12,_MSR(r1)
871 mtspr SPRN_MCSRR0,r11
872 mtspr SPRN_MCSRR1,r12
873 lwz r9,GPR9(r1)
874 lwz r12,GPR12(r1)
875 lwz r10,GPR10(r1)
876 lwz r11,GPR11(r1)
877 lwz r1,GPR1(r1)
878 RFMCI
879#endif /* CONFIG_BOOKE */ 841#endif /* CONFIG_BOOKE */
880 842
881/* 843/*
diff --git a/arch/ppc/kernel/head_4xx.S b/arch/ppc/kernel/head_4xx.S
index 6f5d380e2345..23fb51819ba5 100644
--- a/arch/ppc/kernel/head_4xx.S
+++ b/arch/ppc/kernel/head_4xx.S
@@ -291,8 +291,9 @@ label:
291 /* If we are faulting a kernel address, we have to use the 291 /* If we are faulting a kernel address, we have to use the
292 * kernel page tables. 292 * kernel page tables.
293 */ 293 */
294 andis. r11, r10, 0x8000 294 lis r11, TASK_SIZE@h
295 beq 3f 295 cmplw r10, r11
296 blt+ 3f
296 lis r11, swapper_pg_dir@h 297 lis r11, swapper_pg_dir@h
297 ori r11, r11, swapper_pg_dir@l 298 ori r11, r11, swapper_pg_dir@l
298 li r9, 0 299 li r9, 0
@@ -479,8 +480,9 @@ label:
479 /* If we are faulting a kernel address, we have to use the 480 /* If we are faulting a kernel address, we have to use the
480 * kernel page tables. 481 * kernel page tables.
481 */ 482 */
482 andis. r11, r10, 0x8000 483 lis r11, TASK_SIZE@h
483 beq 3f 484 cmplw r10, r11
485 blt+ 3f
484 lis r11, swapper_pg_dir@h 486 lis r11, swapper_pg_dir@h
485 ori r11, r11, swapper_pg_dir@l 487 ori r11, r11, swapper_pg_dir@l
486 li r9, 0 488 li r9, 0
@@ -578,8 +580,9 @@ label:
578 /* If we are faulting a kernel address, we have to use the 580 /* If we are faulting a kernel address, we have to use the
579 * kernel page tables. 581 * kernel page tables.
580 */ 582 */
581 andis. r11, r10, 0x8000 583 lis r11, TASK_SIZE@h
582 beq 3f 584 cmplw r10, r11
585 blt+ 3f
583 lis r11, swapper_pg_dir@h 586 lis r11, swapper_pg_dir@h
584 ori r11, r11, swapper_pg_dir@l 587 ori r11, r11, swapper_pg_dir@l
585 li r9, 0 588 li r9, 0
diff --git a/arch/ppc/kernel/head_booke.h b/arch/ppc/kernel/head_booke.h
index f213d12eec08..9c50f9d2657c 100644
--- a/arch/ppc/kernel/head_booke.h
+++ b/arch/ppc/kernel/head_booke.h
@@ -67,46 +67,36 @@
67#define CRIT_STACK_TOP (exception_stack_top) 67#define CRIT_STACK_TOP (exception_stack_top)
68 68
69#ifdef CONFIG_SMP 69#ifdef CONFIG_SMP
70#define BOOKE_LOAD_CRIT_STACK \ 70#define BOOKE_LOAD_EXC_LEVEL_STACK(level) \
71 mfspr r8,SPRN_PIR; \ 71 mfspr r8,SPRN_PIR; \
72 mulli r8,r8,BOOKE_EXCEPTION_STACK_SIZE; \ 72 mulli r8,r8,BOOKE_EXCEPTION_STACK_SIZE; \
73 neg r8,r8; \ 73 neg r8,r8; \
74 addis r8,r8,CRIT_STACK_TOP@ha; \ 74 addis r8,r8,level##_STACK_TOP@ha; \
75 addi r8,r8,CRIT_STACK_TOP@l 75 addi r8,r8,level##_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 76#else
83#define BOOKE_LOAD_CRIT_STACK \ 77#define BOOKE_LOAD_EXC_LEVEL_STACK(level) \
84 lis r8,CRIT_STACK_TOP@h; \ 78 lis r8,level##_STACK_TOP@h; \
85 ori r8,r8,CRIT_STACK_TOP@l 79 ori r8,r8,level##_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 80#endif
90 81
91/* 82/*
92 * Exception prolog for critical exceptions. This is a little different 83 * Exception prolog for critical/machine check exceptions. This is a
93 * from the normal exception prolog above since a critical exception 84 * little different from the normal exception prolog above since a
94 * can potentially occur at any point during normal exception processing. 85 * critical/machine check exception can potentially occur at any point
95 * Thus we cannot use the same SPRG registers as the normal prolog above. 86 * during normal exception processing. Thus we cannot use the same SPRG
96 * Instead we use a portion of the critical exception stack at low physical 87 * registers as the normal prolog above. Instead we use a portion of the
97 * addresses. 88 * critical/machine check exception stack at low physical addresses.
98 */ 89 */
99 90#define EXC_LEVEL_EXCEPTION_PROLOG(exc_level, exc_level_srr0, exc_level_srr1) \
100#define CRITICAL_EXCEPTION_PROLOG \ 91 mtspr exc_level##_SPRG,r8; \
101 mtspr CRIT_SPRG,r8; \ 92 BOOKE_LOAD_EXC_LEVEL_STACK(exc_level);/* r8 points to the exc_level stack*/ \
102 BOOKE_LOAD_CRIT_STACK; /* r8 points to the crit stack */ \
103 stw r10,GPR10-INT_FRAME_SIZE(r8); \ 93 stw r10,GPR10-INT_FRAME_SIZE(r8); \
104 stw r11,GPR11-INT_FRAME_SIZE(r8); \ 94 stw r11,GPR11-INT_FRAME_SIZE(r8); \
105 mfcr r10; /* save CR in r10 for now */\ 95 mfcr r10; /* save CR in r10 for now */\
106 mfspr r11,SPRN_CSRR1; /* check whether user or kernel */\ 96 mfspr r11,exc_level_srr1; /* check whether user or kernel */\
107 andi. r11,r11,MSR_PR; \ 97 andi. r11,r11,MSR_PR; \
108 mr r11,r8; \ 98 mr r11,r8; \
109 mfspr r8,CRIT_SPRG; \ 99 mfspr r8,exc_level##_SPRG; \
110 beq 1f; \ 100 beq 1f; \
111 /* COMING FROM USER MODE */ \ 101 /* COMING FROM USER MODE */ \
112 mfspr r11,SPRN_SPRG3; /* if from user, start at top of */\ 102 mfspr r11,SPRN_SPRG3; /* if from user, start at top of */\
@@ -122,9 +112,9 @@
122 stw r12,_DEAR(r11); /* since they may have had stuff */\ 112 stw r12,_DEAR(r11); /* since they may have had stuff */\
123 mfspr r9,SPRN_ESR; /* in them at the point where the */\ 113 mfspr r9,SPRN_ESR; /* in them at the point where the */\
124 stw r9,_ESR(r11); /* exception was taken */\ 114 stw r9,_ESR(r11); /* exception was taken */\
125 mfspr r12,SPRN_CSRR0; \ 115 mfspr r12,exc_level_srr0; \
126 stw r1,GPR1(r11); \ 116 stw r1,GPR1(r11); \
127 mfspr r9,SPRN_CSRR1; \ 117 mfspr r9,exc_level_srr1; \
128 stw r1,0(r11); \ 118 stw r1,0(r11); \
129 mr r1,r11; \ 119 mr r1,r11; \
130 rlwinm r9,r9,0,14,12; /* clear MSR_WE (necessary?) */\ 120 rlwinm r9,r9,0,14,12; /* clear MSR_WE (necessary?) */\
@@ -132,45 +122,10 @@
132 SAVE_4GPRS(3, r11); \ 122 SAVE_4GPRS(3, r11); \
133 SAVE_2GPRS(7, r11) 123 SAVE_2GPRS(7, r11)
134 124
135/* 125#define CRITICAL_EXCEPTION_PROLOG \
136 * Exception prolog for machine check exceptions. This is similar to 126 EXC_LEVEL_EXCEPTION_PROLOG(CRIT, SPRN_CSRR0, SPRN_CSRR1)
137 * the critical exception prolog, except that machine check exceptions 127#define MCHECK_EXCEPTION_PROLOG \
138 * have their stack. 128 EXC_LEVEL_EXCEPTION_PROLOG(MCHECK, SPRN_MCSRR0, SPRN_MCSRR1)
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 129
175/* 130/*
176 * Exception vectors. 131 * Exception vectors.
@@ -237,7 +192,6 @@ label:
237 EXC_XFER_TEMPLATE(hdlr, n+1, MSR_KERNEL, COPY_EE, transfer_to_handler, \ 192 EXC_XFER_TEMPLATE(hdlr, n+1, MSR_KERNEL, COPY_EE, transfer_to_handler, \
238 ret_from_except) 193 ret_from_except)
239 194
240
241/* Check for a single step debug exception while in an exception 195/* Check for a single step debug exception while in an exception
242 * handler before state has been saved. This is to catch the case 196 * handler before state has been saved. This is to catch the case
243 * where an instruction that we are trying to single step causes 197 * where an instruction that we are trying to single step causes
@@ -291,7 +245,7 @@ label:
291 lwz r9,GPR9(r11); \ 245 lwz r9,GPR9(r11); \
292 lwz r12,GPR12(r11); \ 246 lwz r12,GPR12(r11); \
293 mtspr CRIT_SPRG,r8; \ 247 mtspr CRIT_SPRG,r8; \
294 BOOKE_LOAD_CRIT_STACK; /* r8 points to the crit stack */ \ 248 BOOKE_LOAD_EXC_LEVEL_STACK(CRIT); /* r8 points to the debug stack */ \
295 lwz r10,GPR10-INT_FRAME_SIZE(r8); \ 249 lwz r10,GPR10-INT_FRAME_SIZE(r8); \
296 lwz r11,GPR11-INT_FRAME_SIZE(r8); \ 250 lwz r11,GPR11-INT_FRAME_SIZE(r8); \
297 mfspr r8,CRIT_SPRG; \ 251 mfspr r8,CRIT_SPRG; \
diff --git a/arch/ppc/kernel/setup.c b/arch/ppc/kernel/setup.c
index 5c20266e3b1f..c42f75326939 100644
--- a/arch/ppc/kernel/setup.c
+++ b/arch/ppc/kernel/setup.c
@@ -41,7 +41,7 @@
41#include <asm/xmon.h> 41#include <asm/xmon.h>
42#include <asm/ocp.h> 42#include <asm/ocp.h>
43 43
44#if defined(CONFIG_85xx) || defined(CONFIG_83xx) 44#if defined(CONFIG_85xx) || defined(CONFIG_83xx) || defined(CONFIG_MPC10X_BRIDGE)
45#include <asm/ppc_sys.h> 45#include <asm/ppc_sys.h>
46#endif 46#endif
47 47
@@ -61,8 +61,6 @@ extern void power4_idle(void);
61 61
62extern boot_infos_t *boot_infos; 62extern boot_infos_t *boot_infos;
63struct ide_machdep_calls ppc_ide_md; 63struct ide_machdep_calls ppc_ide_md;
64char *sysmap;
65unsigned long sysmap_size;
66 64
67/* Used with the BI_MEMSIZE bootinfo parameter to store the memory 65/* Used with the BI_MEMSIZE bootinfo parameter to store the memory
68 size value reported by the boot loader. */ 66 size value reported by the boot loader. */
@@ -249,7 +247,7 @@ int show_cpuinfo(struct seq_file *m, void *v)
249 seq_printf(m, "bogomips\t: %lu.%02lu\n", 247 seq_printf(m, "bogomips\t: %lu.%02lu\n",
250 lpj / (500000/HZ), (lpj / (5000/HZ)) % 100); 248 lpj / (500000/HZ), (lpj / (5000/HZ)) % 100);
251 249
252#if defined(CONFIG_85xx) || defined(CONFIG_83xx) 250#if defined(CONFIG_85xx) || defined(CONFIG_83xx) || defined(CONFIG_MPC10X_BRIDGE)
253 if (cur_ppc_sys_spec->ppc_sys_name) 251 if (cur_ppc_sys_spec->ppc_sys_name)
254 seq_printf(m, "chipset\t\t: %s\n", 252 seq_printf(m, "chipset\t\t: %s\n",
255 cur_ppc_sys_spec->ppc_sys_name); 253 cur_ppc_sys_spec->ppc_sys_name);
@@ -578,11 +576,6 @@ void parse_bootinfo(struct bi_record *rec)
578 case BI_CMD_LINE: 576 case BI_CMD_LINE:
579 strlcpy(cmd_line, (void *)data, sizeof(cmd_line)); 577 strlcpy(cmd_line, (void *)data, sizeof(cmd_line));
580 break; 578 break;
581 case BI_SYSMAP:
582 sysmap = (char *)((data[0] >= (KERNELBASE)) ? data[0] :
583 (data[0]+KERNELBASE));
584 sysmap_size = data[1];
585 break;
586#ifdef CONFIG_BLK_DEV_INITRD 579#ifdef CONFIG_BLK_DEV_INITRD
587 case BI_INITRD: 580 case BI_INITRD:
588 initrd_start = data[0] + KERNELBASE; 581 initrd_start = data[0] + KERNELBASE;
diff --git a/arch/ppc/kernel/traps.c b/arch/ppc/kernel/traps.c
index c65731e8bc65..2ca8ecfeefd9 100644
--- a/arch/ppc/kernel/traps.c
+++ b/arch/ppc/kernel/traps.c
@@ -81,8 +81,10 @@ void die(const char * str, struct pt_regs * fp, long err)
81 console_verbose(); 81 console_verbose();
82 spin_lock_irq(&die_lock); 82 spin_lock_irq(&die_lock);
83#ifdef CONFIG_PMAC_BACKLIGHT 83#ifdef CONFIG_PMAC_BACKLIGHT
84 set_backlight_enable(1); 84 if (_machine == _MACH_Pmac) {
85 set_backlight_level(BACKLIGHT_MAX); 85 set_backlight_enable(1);
86 set_backlight_level(BACKLIGHT_MAX);
87 }
86#endif 88#endif
87 printk("Oops: %s, sig: %ld [#%d]\n", str, err, ++die_counter); 89 printk("Oops: %s, sig: %ld [#%d]\n", str, err, ++die_counter);
88#ifdef CONFIG_PREEMPT 90#ifdef CONFIG_PREEMPT
diff --git a/arch/ppc/lib/locks.c b/arch/ppc/lib/locks.c
index 694163d696d8..c450dc4b766e 100644
--- a/arch/ppc/lib/locks.c
+++ b/arch/ppc/lib/locks.c
@@ -130,7 +130,7 @@ void _raw_read_lock(rwlock_t *rw)
130 while (!read_can_lock(rw)) { 130 while (!read_can_lock(rw)) {
131 if (--stuck == 0) { 131 if (--stuck == 0) {
132 printk("_read_lock(%p) CPU#%d lock %d\n", 132 printk("_read_lock(%p) CPU#%d lock %d\n",
133 rw, _smp_processor_id(), rw->lock); 133 rw, raw_smp_processor_id(), rw->lock);
134 stuck = INIT_STUCK; 134 stuck = INIT_STUCK;
135 } 135 }
136 } 136 }
@@ -158,7 +158,7 @@ void _raw_write_lock(rwlock_t *rw)
158 while (!write_can_lock(rw)) { 158 while (!write_can_lock(rw)) {
159 if (--stuck == 0) { 159 if (--stuck == 0) {
160 printk("write_lock(%p) CPU#%d lock %d)\n", 160 printk("write_lock(%p) CPU#%d lock %d)\n",
161 rw, _smp_processor_id(), rw->lock); 161 rw, raw_smp_processor_id(), rw->lock);
162 stuck = INIT_STUCK; 162 stuck = INIT_STUCK;
163 } 163 }
164 } 164 }
diff --git a/arch/ppc/mm/fsl_booke_mmu.c b/arch/ppc/mm/fsl_booke_mmu.c
index 36233bdcdf8f..e07990efa046 100644
--- a/arch/ppc/mm/fsl_booke_mmu.c
+++ b/arch/ppc/mm/fsl_booke_mmu.c
@@ -64,6 +64,8 @@ extern unsigned long total_lowmem;
64extern unsigned long __max_low_memory; 64extern unsigned long __max_low_memory;
65#define MAX_LOW_MEM CONFIG_LOWMEM_SIZE 65#define MAX_LOW_MEM CONFIG_LOWMEM_SIZE
66 66
67#define NUM_TLBCAMS (16)
68
67struct tlbcam { 69struct tlbcam {
68 u32 MAS0; 70 u32 MAS0;
69 u32 MAS1; 71 u32 MAS1;
diff --git a/arch/ppc/mm/init.c b/arch/ppc/mm/init.c
index 363c157e3617..334ef4150d92 100644
--- a/arch/ppc/mm/init.c
+++ b/arch/ppc/mm/init.c
@@ -96,9 +96,6 @@ extern struct task_struct *current_set[NR_CPUS];
96char *klimit = _end; 96char *klimit = _end;
97struct mem_pieces phys_avail; 97struct mem_pieces phys_avail;
98 98
99extern char *sysmap;
100extern unsigned long sysmap_size;
101
102/* 99/*
103 * this tells the system to map all of ram with the segregs 100 * this tells the system to map all of ram with the segregs
104 * (i.e. page tables) instead of the bats. 101 * (i.e. page tables) instead of the bats.
@@ -442,12 +439,6 @@ void __init mem_init(void)
442 if (agp_special_page) 439 if (agp_special_page)
443 SetPageReserved(virt_to_page(agp_special_page)); 440 SetPageReserved(virt_to_page(agp_special_page));
444#endif 441#endif
445 if ( sysmap )
446 for (addr = (unsigned long)sysmap;
447 addr < PAGE_ALIGN((unsigned long)sysmap+sysmap_size) ;
448 addr += PAGE_SIZE)
449 SetPageReserved(virt_to_page(addr));
450
451 for (addr = PAGE_OFFSET; addr < (unsigned long)high_memory; 442 for (addr = PAGE_OFFSET; addr < (unsigned long)high_memory;
452 addr += PAGE_SIZE) { 443 addr += PAGE_SIZE) {
453 if (!PageReserved(virt_to_page(addr))) 444 if (!PageReserved(virt_to_page(addr)))
@@ -469,7 +460,6 @@ void __init mem_init(void)
469 struct page *page = mem_map + pfn; 460 struct page *page = mem_map + pfn;
470 461
471 ClearPageReserved(page); 462 ClearPageReserved(page);
472 set_bit(PG_highmem, &page->flags);
473 set_page_count(page, 1); 463 set_page_count(page, 1);
474 __free_page(page); 464 __free_page(page);
475 totalhigh_pages++; 465 totalhigh_pages++;
@@ -483,9 +473,7 @@ void __init mem_init(void)
483 codepages<< (PAGE_SHIFT-10), datapages<< (PAGE_SHIFT-10), 473 codepages<< (PAGE_SHIFT-10), datapages<< (PAGE_SHIFT-10),
484 initpages<< (PAGE_SHIFT-10), 474 initpages<< (PAGE_SHIFT-10),
485 (unsigned long) (totalhigh_pages << (PAGE_SHIFT-10))); 475 (unsigned long) (totalhigh_pages << (PAGE_SHIFT-10)));
486 if (sysmap) 476
487 printk("System.map loaded at 0x%08x for debugger, size: %ld bytes\n",
488 (unsigned int)sysmap, sysmap_size);
489#ifdef CONFIG_PPC_PMAC 477#ifdef CONFIG_PPC_PMAC
490 if (agp_special_page) 478 if (agp_special_page)
491 printk(KERN_INFO "AGP special page: 0x%08lx\n", agp_special_page); 479 printk(KERN_INFO "AGP special page: 0x%08lx\n", agp_special_page);
@@ -535,9 +523,6 @@ set_phys_avail(unsigned long total_memory)
535 if (rtas_data) 523 if (rtas_data)
536 mem_pieces_remove(&phys_avail, rtas_data, rtas_size, 1); 524 mem_pieces_remove(&phys_avail, rtas_data, rtas_size, 1);
537#endif 525#endif
538 /* remove the sysmap pages from the available memory */
539 if (sysmap)
540 mem_pieces_remove(&phys_avail, __pa(sysmap), sysmap_size, 1);
541#ifdef CONFIG_PPC_PMAC 526#ifdef CONFIG_PPC_PMAC
542 /* Because of some uninorth weirdness, we need a page of 527 /* Because of some uninorth weirdness, we need a page of
543 * memory as high as possible (it must be outside of the 528 * memory as high as possible (it must be outside of the
diff --git a/arch/ppc/mm/mmu_decl.h b/arch/ppc/mm/mmu_decl.h
index ffcdb46997dc..540f3292b229 100644
--- a/arch/ppc/mm/mmu_decl.h
+++ b/arch/ppc/mm/mmu_decl.h
@@ -43,6 +43,8 @@ extern int mem_init_done;
43extern PTE *Hash, *Hash_end; 43extern PTE *Hash, *Hash_end;
44extern unsigned long Hash_size, Hash_mask; 44extern unsigned long Hash_size, Hash_mask;
45 45
46extern unsigned int num_tlbcam_entries;
47
46/* ...and now those things that may be slightly different between processor 48/* ...and now those things that may be slightly different between processor
47 * architectures. -- Dan 49 * architectures. -- Dan
48 */ 50 */
diff --git a/arch/ppc/mm/pgtable.c b/arch/ppc/mm/pgtable.c
index 5d2f3f66aefa..81a3d7446d37 100644
--- a/arch/ppc/mm/pgtable.c
+++ b/arch/ppc/mm/pgtable.c
@@ -66,7 +66,6 @@ void setbat(int index, unsigned long virt, unsigned long phys,
66 66
67#ifdef HAVE_TLBCAM 67#ifdef HAVE_TLBCAM
68extern unsigned int tlbcam_index; 68extern unsigned int tlbcam_index;
69extern unsigned int num_tlbcam_entries;
70extern unsigned long v_mapped_by_tlbcam(unsigned long va); 69extern unsigned long v_mapped_by_tlbcam(unsigned long va);
71extern unsigned long p_mapped_by_tlbcam(unsigned long pa); 70extern unsigned long p_mapped_by_tlbcam(unsigned long pa);
72#else /* !HAVE_TLBCAM */ 71#else /* !HAVE_TLBCAM */
diff --git a/arch/ppc/platforms/83xx/mpc834x_sys.c b/arch/ppc/platforms/83xx/mpc834x_sys.c
index e6348b5a1ddc..86ca5cf81263 100644
--- a/arch/ppc/platforms/83xx/mpc834x_sys.c
+++ b/arch/ppc/platforms/83xx/mpc834x_sys.c
@@ -41,7 +41,6 @@
41#include <asm/time.h> 41#include <asm/time.h>
42#include <asm/io.h> 42#include <asm/io.h>
43#include <asm/machdep.h> 43#include <asm/machdep.h>
44#include <asm/prom.h>
45#include <asm/ipic.h> 44#include <asm/ipic.h>
46#include <asm/bootinfo.h> 45#include <asm/bootinfo.h>
47#include <asm/pci-bridge.h> 46#include <asm/pci-bridge.h>
diff --git a/arch/ppc/platforms/85xx/Kconfig b/arch/ppc/platforms/85xx/Kconfig
index ff92e38e7da1..c5bc2821d991 100644
--- a/arch/ppc/platforms/85xx/Kconfig
+++ b/arch/ppc/platforms/85xx/Kconfig
@@ -21,6 +21,11 @@ config MPC8540_ADS
21 help 21 help
22 This option enables support for the MPC 8540 ADS evaluation board. 22 This option enables support for the MPC 8540 ADS evaluation board.
23 23
24config MPC8548_CDS
25 bool "Freescale MPC8548 CDS"
26 help
27 This option enablese support for the MPC8548 CDS evaluation board.
28
24config MPC8555_CDS 29config MPC8555_CDS
25 bool "Freescale MPC8555 CDS" 30 bool "Freescale MPC8555 CDS"
26 help 31 help
@@ -53,6 +58,11 @@ config MPC8540
53 depends on MPC8540_ADS 58 depends on MPC8540_ADS
54 default y 59 default y
55 60
61config MPC8548
62 bool
63 depends on MPC8548_CDS
64 default y
65
56config MPC8555 66config MPC8555
57 bool 67 bool
58 depends on MPC8555_CDS 68 depends on MPC8555_CDS
diff --git a/arch/ppc/platforms/85xx/Makefile b/arch/ppc/platforms/85xx/Makefile
index 854fbd298ba2..efdf813108f2 100644
--- a/arch/ppc/platforms/85xx/Makefile
+++ b/arch/ppc/platforms/85xx/Makefile
@@ -2,6 +2,7 @@
2# Makefile for the PowerPC 85xx linux kernel. 2# Makefile for the PowerPC 85xx linux kernel.
3# 3#
4obj-$(CONFIG_MPC8540_ADS) += mpc85xx_ads_common.o mpc8540_ads.o 4obj-$(CONFIG_MPC8540_ADS) += mpc85xx_ads_common.o mpc8540_ads.o
5obj-$(CONFIG_MPC8548_CDS) += mpc85xx_cds_common.o
5obj-$(CONFIG_MPC8555_CDS) += mpc85xx_cds_common.o 6obj-$(CONFIG_MPC8555_CDS) += mpc85xx_cds_common.o
6obj-$(CONFIG_MPC8560_ADS) += mpc85xx_ads_common.o mpc8560_ads.o 7obj-$(CONFIG_MPC8560_ADS) += mpc85xx_ads_common.o mpc8560_ads.o
7obj-$(CONFIG_SBC8560) += sbc85xx.o sbc8560.o 8obj-$(CONFIG_SBC8560) += sbc85xx.o sbc8560.o
diff --git a/arch/ppc/platforms/85xx/mpc8540_ads.c b/arch/ppc/platforms/85xx/mpc8540_ads.c
index 583838ab02d8..a2ed611cd936 100644
--- a/arch/ppc/platforms/85xx/mpc8540_ads.c
+++ b/arch/ppc/platforms/85xx/mpc8540_ads.c
@@ -41,7 +41,6 @@
41#include <asm/time.h> 41#include <asm/time.h>
42#include <asm/io.h> 42#include <asm/io.h>
43#include <asm/machdep.h> 43#include <asm/machdep.h>
44#include <asm/prom.h>
45#include <asm/open_pic.h> 44#include <asm/open_pic.h>
46#include <asm/bootinfo.h> 45#include <asm/bootinfo.h>
47#include <asm/pci-bridge.h> 46#include <asm/pci-bridge.h>
@@ -88,7 +87,7 @@ mpc8540ads_setup_arch(void)
88#ifdef CONFIG_SERIAL_TEXT_DEBUG 87#ifdef CONFIG_SERIAL_TEXT_DEBUG
89 /* Invalidate the entry we stole earlier the serial ports 88 /* Invalidate the entry we stole earlier the serial ports
90 * should be properly mapped */ 89 * should be properly mapped */
91 invalidate_tlbcam_entry(NUM_TLBCAMS - 1); 90 invalidate_tlbcam_entry(num_tlbcam_entries - 1);
92#endif 91#endif
93 92
94 /* setup the board related information for the enet controllers */ 93 /* setup the board related information for the enet controllers */
@@ -150,7 +149,7 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
150 struct uart_port p; 149 struct uart_port p;
151 150
152 /* Use the last TLB entry to map CCSRBAR to allow access to DUART regs */ 151 /* Use the last TLB entry to map CCSRBAR to allow access to DUART regs */
153 settlbcam(NUM_TLBCAMS - 1, binfo->bi_immr_base, 152 settlbcam(num_tlbcam_entries - 1, binfo->bi_immr_base,
154 binfo->bi_immr_base, MPC85xx_CCSRBAR_SIZE, _PAGE_IO, 0); 153 binfo->bi_immr_base, MPC85xx_CCSRBAR_SIZE, _PAGE_IO, 0);
155 154
156 memset(&p, 0, sizeof (p)); 155 memset(&p, 0, sizeof (p));
diff --git a/arch/ppc/platforms/85xx/mpc8560_ads.c b/arch/ppc/platforms/85xx/mpc8560_ads.c
index 761b8c7b25d2..d87dfd5ce0a2 100644
--- a/arch/ppc/platforms/85xx/mpc8560_ads.c
+++ b/arch/ppc/platforms/85xx/mpc8560_ads.c
@@ -41,7 +41,6 @@
41#include <asm/time.h> 41#include <asm/time.h>
42#include <asm/io.h> 42#include <asm/io.h>
43#include <asm/machdep.h> 43#include <asm/machdep.h>
44#include <asm/prom.h>
45#include <asm/open_pic.h> 44#include <asm/open_pic.h>
46#include <asm/bootinfo.h> 45#include <asm/bootinfo.h>
47#include <asm/pci-bridge.h> 46#include <asm/pci-bridge.h>
diff --git a/arch/ppc/platforms/85xx/mpc85xx_ads_common.c b/arch/ppc/platforms/85xx/mpc85xx_ads_common.c
index ba9f9f562c45..18e952d1767c 100644
--- a/arch/ppc/platforms/85xx/mpc85xx_ads_common.c
+++ b/arch/ppc/platforms/85xx/mpc85xx_ads_common.c
@@ -36,7 +36,6 @@
36#include <asm/time.h> 36#include <asm/time.h>
37#include <asm/io.h> 37#include <asm/io.h>
38#include <asm/machdep.h> 38#include <asm/machdep.h>
39#include <asm/prom.h>
40#include <asm/open_pic.h> 39#include <asm/open_pic.h>
41#include <asm/bootinfo.h> 40#include <asm/bootinfo.h>
42#include <asm/pci-bridge.h> 41#include <asm/pci-bridge.h>
@@ -59,40 +58,8 @@ extern unsigned long total_memory; /* in mm/init */
59unsigned char __res[sizeof (bd_t)]; 58unsigned char __res[sizeof (bd_t)];
60 59
61/* Internal interrupts are all Level Sensitive, and Positive Polarity */ 60/* Internal interrupts are all Level Sensitive, and Positive Polarity */
62
63static u_char mpc85xx_ads_openpic_initsenses[] __initdata = { 61static u_char mpc85xx_ads_openpic_initsenses[] __initdata = {
64 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 0: L2 Cache */ 62 MPC85XX_INTERNAL_IRQ_SENSES,
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: */ 63 0x0, /* External 0: */
97#if defined(CONFIG_PCI) 64#if defined(CONFIG_PCI)
98 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 1: PCI slot 0 */ 65 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 1: PCI slot 0 */
@@ -159,7 +126,7 @@ mpc85xx_ads_init_IRQ(void)
159 /* Skip reserved space and internal sources */ 126 /* Skip reserved space and internal sources */
160 openpic_set_sources(0, 32, OpenPIC_Addr + 0x10200); 127 openpic_set_sources(0, 32, OpenPIC_Addr + 0x10200);
161 /* Map PIC IRQs 0-11 */ 128 /* Map PIC IRQs 0-11 */
162 openpic_set_sources(32, 12, OpenPIC_Addr + 0x10000); 129 openpic_set_sources(48, 12, OpenPIC_Addr + 0x10000);
163 130
164 /* we let openpic interrupts starting from an offset, to 131 /* we let openpic interrupts starting from an offset, to
165 * leave space for cascading interrupts underneath. 132 * leave space for cascading interrupts underneath.
diff --git a/arch/ppc/platforms/85xx/mpc85xx_cds_common.c b/arch/ppc/platforms/85xx/mpc85xx_cds_common.c
index e7cfa498568c..203b2ca61df8 100644
--- a/arch/ppc/platforms/85xx/mpc85xx_cds_common.c
+++ b/arch/ppc/platforms/85xx/mpc85xx_cds_common.c
@@ -42,7 +42,6 @@
42#include <asm/todc.h> 42#include <asm/todc.h>
43#include <asm/io.h> 43#include <asm/io.h>
44#include <asm/machdep.h> 44#include <asm/machdep.h>
45#include <asm/prom.h>
46#include <asm/open_pic.h> 45#include <asm/open_pic.h>
47#include <asm/i8259.h> 46#include <asm/i8259.h>
48#include <asm/bootinfo.h> 47#include <asm/bootinfo.h>
@@ -73,40 +72,8 @@ static int cds_pci_slot = 2;
73static volatile u8 * cadmus; 72static volatile u8 * cadmus;
74 73
75/* Internal interrupts are all Level Sensitive, and Positive Polarity */ 74/* Internal interrupts are all Level Sensitive, and Positive Polarity */
76
77static u_char mpc85xx_cds_openpic_initsenses[] __initdata = { 75static u_char mpc85xx_cds_openpic_initsenses[] __initdata = {
78 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 0: L2 Cache */ 76 MPC85XX_INTERNAL_IRQ_SENSES,
79 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 1: ECM */
80 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 2: DDR DRAM */
81 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 3: LBIU */
82 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 4: DMA 0 */
83 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 5: DMA 1 */
84 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 6: DMA 2 */
85 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 7: DMA 3 */
86 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 8: PCI/PCI-X */
87 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 9: RIO Inbound Port Write Error */
88 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 10: RIO Doorbell Inbound */
89 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 11: RIO Outbound Message */
90 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 12: RIO Inbound Message */
91 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 13: TSEC 0 Transmit */
92 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 14: TSEC 0 Receive */
93 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 15: Unused */
94 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 16: Unused */
95 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 17: Unused */
96 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 18: TSEC 0 Receive/Transmit Error */
97 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 19: TSEC 1 Transmit */
98 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 20: TSEC 1 Receive */
99 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 21: Unused */
100 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 22: Unused */
101 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 23: Unused */
102 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 24: TSEC 1 Receive/Transmit Error */
103 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 25: Fast Ethernet */
104 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 26: DUART */
105 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 27: I2C */
106 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 28: Performance Monitor */
107 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 29: Unused */
108 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 30: CPM */
109 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 31: Unused */
110#if defined(CONFIG_PCI) 77#if defined(CONFIG_PCI)
111 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 0: PCI1 slot */ 78 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 0: PCI1 slot */
112 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 1: PCI1 slot */ 79 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 1: PCI1 slot */
@@ -182,7 +149,6 @@ void __init
182mpc85xx_cds_init_IRQ(void) 149mpc85xx_cds_init_IRQ(void)
183{ 150{
184 bd_t *binfo = (bd_t *) __res; 151 bd_t *binfo = (bd_t *) __res;
185 int i;
186 152
187 /* Determine the Physical Address of the OpenPIC regs */ 153 /* Determine the Physical Address of the OpenPIC regs */
188 phys_addr_t OpenPIC_PAddr = binfo->bi_immr_base + MPC85xx_OPENPIC_OFFSET; 154 phys_addr_t OpenPIC_PAddr = binfo->bi_immr_base + MPC85xx_OPENPIC_OFFSET;
@@ -191,9 +157,13 @@ mpc85xx_cds_init_IRQ(void)
191 OpenPIC_NumInitSenses = sizeof (mpc85xx_cds_openpic_initsenses); 157 OpenPIC_NumInitSenses = sizeof (mpc85xx_cds_openpic_initsenses);
192 158
193 /* Skip reserved space and internal sources */ 159 /* Skip reserved space and internal sources */
160#ifdef CONFIG_MPC8548
161 openpic_set_sources(0, 48, OpenPIC_Addr + 0x10200);
162#else
194 openpic_set_sources(0, 32, OpenPIC_Addr + 0x10200); 163 openpic_set_sources(0, 32, OpenPIC_Addr + 0x10200);
164#endif
195 /* Map PIC IRQs 0-11 */ 165 /* Map PIC IRQs 0-11 */
196 openpic_set_sources(32, 12, OpenPIC_Addr + 0x10000); 166 openpic_set_sources(48, 12, OpenPIC_Addr + 0x10000);
197 167
198 /* we let openpic interrupts starting from an offset, to 168 /* we let openpic interrupts starting from an offset, to
199 * leave space for cascading interrupts underneath. 169 * leave space for cascading interrupts underneath.
@@ -475,26 +445,52 @@ mpc85xx_cds_setup_arch(void)
475#ifdef CONFIG_SERIAL_TEXT_DEBUG 445#ifdef CONFIG_SERIAL_TEXT_DEBUG
476 /* Invalidate the entry we stole earlier the serial ports 446 /* Invalidate the entry we stole earlier the serial ports
477 * should be properly mapped */ 447 * should be properly mapped */
478 invalidate_tlbcam_entry(NUM_TLBCAMS - 1); 448 invalidate_tlbcam_entry(num_tlbcam_entries - 1);
479#endif 449#endif
480 450
481 /* setup the board related information for the enet controllers */ 451 /* setup the board related information for the enet controllers */
482 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1); 452 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1);
483 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; 453 if (pdata) {
484 pdata->interruptPHY = MPC85xx_IRQ_EXT5; 454 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
485 pdata->phyid = 0; 455 pdata->interruptPHY = MPC85xx_IRQ_EXT5;
486 /* fixup phy address */ 456 pdata->phyid = 0;
487 pdata->phy_reg_addr += binfo->bi_immr_base; 457 /* fixup phy address */
488 memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6); 458 pdata->phy_reg_addr += binfo->bi_immr_base;
459 memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6);
460 }
489 461
490 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC2); 462 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC2);
491 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; 463 if (pdata) {
492 pdata->interruptPHY = MPC85xx_IRQ_EXT5; 464 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
493 pdata->phyid = 1; 465 pdata->interruptPHY = MPC85xx_IRQ_EXT5;
494 /* fixup phy address */ 466 pdata->phyid = 1;
495 pdata->phy_reg_addr += binfo->bi_immr_base; 467 /* fixup phy address */
496 memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6); 468 pdata->phy_reg_addr += binfo->bi_immr_base;
469 memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6);
470 }
471
472 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_eTSEC1);
473 if (pdata) {
474 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
475 pdata->interruptPHY = MPC85xx_IRQ_EXT5;
476 pdata->phyid = 0;
477 /* fixup phy address */
478 pdata->phy_reg_addr += binfo->bi_immr_base;
479 memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6);
480 }
481
482 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_eTSEC2);
483 if (pdata) {
484 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
485 pdata->interruptPHY = MPC85xx_IRQ_EXT5;
486 pdata->phyid = 1;
487 /* fixup phy address */
488 pdata->phy_reg_addr += binfo->bi_immr_base;
489 memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6);
490 }
497 491
492 ppc_sys_device_remove(MPC85xx_eTSEC3);
493 ppc_sys_device_remove(MPC85xx_eTSEC4);
498 494
499#ifdef CONFIG_BLK_DEV_INITRD 495#ifdef CONFIG_BLK_DEV_INITRD
500 if (initrd_start) 496 if (initrd_start)
@@ -531,7 +527,7 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
531 struct uart_port p; 527 struct uart_port p;
532 528
533 /* Use the last TLB entry to map CCSRBAR to allow access to DUART regs */ 529 /* Use the last TLB entry to map CCSRBAR to allow access to DUART regs */
534 settlbcam(NUM_TLBCAMS - 1, binfo->bi_immr_base, 530 settlbcam(num_tlbcam_entries - 1, binfo->bi_immr_base,
535 binfo->bi_immr_base, MPC85xx_CCSRBAR_SIZE, _PAGE_IO, 0); 531 binfo->bi_immr_base, MPC85xx_CCSRBAR_SIZE, _PAGE_IO, 0);
536 532
537 memset(&p, 0, sizeof (p)); 533 memset(&p, 0, sizeof (p));
diff --git a/arch/ppc/platforms/85xx/sbc8560.c b/arch/ppc/platforms/85xx/sbc8560.c
index 7b9e1543e175..3dbdd73618eb 100644
--- a/arch/ppc/platforms/85xx/sbc8560.c
+++ b/arch/ppc/platforms/85xx/sbc8560.c
@@ -41,7 +41,6 @@
41#include <asm/time.h> 41#include <asm/time.h>
42#include <asm/io.h> 42#include <asm/io.h>
43#include <asm/machdep.h> 43#include <asm/machdep.h>
44#include <asm/prom.h>
45#include <asm/open_pic.h> 44#include <asm/open_pic.h>
46#include <asm/bootinfo.h> 45#include <asm/bootinfo.h>
47#include <asm/pci-bridge.h> 46#include <asm/pci-bridge.h>
@@ -125,7 +124,7 @@ sbc8560_setup_arch(void)
125#ifdef CONFIG_SERIAL_TEXT_DEBUG 124#ifdef CONFIG_SERIAL_TEXT_DEBUG
126 /* Invalidate the entry we stole earlier the serial ports 125 /* Invalidate the entry we stole earlier the serial ports
127 * should be properly mapped */ 126 * should be properly mapped */
128 invalidate_tlbcam_entry(NUM_TLBCAMS - 1); 127 invalidate_tlbcam_entry(num_tlbcam_entries - 1);
129#endif 128#endif
130 129
131 /* setup the board related information for the enet controllers */ 130 /* setup the board related information for the enet controllers */
@@ -176,7 +175,7 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
176 175
177#ifdef CONFIG_SERIAL_TEXT_DEBUG 176#ifdef CONFIG_SERIAL_TEXT_DEBUG
178 /* Use the last TLB entry to map CCSRBAR to allow access to DUART regs */ 177 /* Use the last TLB entry to map CCSRBAR to allow access to DUART regs */
179 settlbcam(NUM_TLBCAMS - 1, UARTA_ADDR, 178 settlbcam(num_tlbcam_entries - 1, UARTA_ADDR,
180 UARTA_ADDR, 0x1000, _PAGE_IO, 0); 179 UARTA_ADDR, 0x1000, _PAGE_IO, 0);
181#endif 180#endif
182 181
diff --git a/arch/ppc/platforms/85xx/sbc85xx.c b/arch/ppc/platforms/85xx/sbc85xx.c
index 2d638c1c1bd6..4f6d1ddd6fb8 100644
--- a/arch/ppc/platforms/85xx/sbc85xx.c
+++ b/arch/ppc/platforms/85xx/sbc85xx.c
@@ -35,7 +35,6 @@
35#include <asm/time.h> 35#include <asm/time.h>
36#include <asm/io.h> 36#include <asm/io.h>
37#include <asm/machdep.h> 37#include <asm/machdep.h>
38#include <asm/prom.h>
39#include <asm/open_pic.h> 38#include <asm/open_pic.h>
40#include <asm/bootinfo.h> 39#include <asm/bootinfo.h>
41#include <asm/pci-bridge.h> 40#include <asm/pci-bridge.h>
@@ -59,40 +58,8 @@ unsigned long pci_dram_offset = 0;
59extern unsigned long total_memory; /* in mm/init */ 58extern unsigned long total_memory; /* in mm/init */
60 59
61/* Internal interrupts are all Level Sensitive, and Positive Polarity */ 60/* Internal interrupts are all Level Sensitive, and Positive Polarity */
62
63static u_char sbc8560_openpic_initsenses[] __initdata = { 61static u_char sbc8560_openpic_initsenses[] __initdata = {
64 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 0: L2 Cache */ 62 MPC85XX_INTERNAL_IRQ_SENSES,
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: */ 63 0x0, /* External 0: */
97 0x0, /* External 1: */ 64 0x0, /* External 1: */
98#if defined(CONFIG_PCI) 65#if defined(CONFIG_PCI)
@@ -159,7 +126,7 @@ sbc8560_init_IRQ(void)
159 /* Skip reserved space and internal sources */ 126 /* Skip reserved space and internal sources */
160 openpic_set_sources(0, 32, OpenPIC_Addr + 0x10200); 127 openpic_set_sources(0, 32, OpenPIC_Addr + 0x10200);
161 /* Map PIC IRQs 0-11 */ 128 /* Map PIC IRQs 0-11 */
162 openpic_set_sources(32, 12, OpenPIC_Addr + 0x10000); 129 openpic_set_sources(48, 12, OpenPIC_Addr + 0x10000);
163 130
164 /* we let openpic interrupts starting from an offset, to 131 /* we let openpic interrupts starting from an offset, to
165 * leave space for cascading interrupts underneath. 132 * leave space for cascading interrupts underneath.
diff --git a/arch/ppc/platforms/85xx/stx_gp3.c b/arch/ppc/platforms/85xx/stx_gp3.c
index bc95836e417c..9455bb6b45e9 100644
--- a/arch/ppc/platforms/85xx/stx_gp3.c
+++ b/arch/ppc/platforms/85xx/stx_gp3.c
@@ -46,7 +46,6 @@
46#include <asm/time.h> 46#include <asm/time.h>
47#include <asm/io.h> 47#include <asm/io.h>
48#include <asm/machdep.h> 48#include <asm/machdep.h>
49#include <asm/prom.h>
50#include <asm/open_pic.h> 49#include <asm/open_pic.h>
51#include <asm/bootinfo.h> 50#include <asm/bootinfo.h>
52#include <asm/pci-bridge.h> 51#include <asm/pci-bridge.h>
@@ -72,38 +71,7 @@ unsigned long pci_dram_offset = 0;
72 71
73/* Internal interrupts are all Level Sensitive, and Positive Polarity */ 72/* Internal interrupts are all Level Sensitive, and Positive Polarity */
74static u8 gp3_openpic_initsenses[] __initdata = { 73static u8 gp3_openpic_initsenses[] __initdata = {
75 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 0: L2 Cache */ 74 MPC85XX_INTERNAL_IRQ_SENSES,
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: */ 75 0x0, /* External 0: */
108#if defined(CONFIG_PCI) 76#if defined(CONFIG_PCI)
109 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 1: PCI slot 0 */ 77 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 1: PCI slot 0 */
@@ -200,7 +168,6 @@ static struct irqaction cpm2_irqaction = {
200static void __init 168static void __init
201gp3_init_IRQ(void) 169gp3_init_IRQ(void)
202{ 170{
203 int i;
204 bd_t *binfo = (bd_t *) __res; 171 bd_t *binfo = (bd_t *) __res;
205 172
206 /* 173 /*
@@ -218,7 +185,7 @@ gp3_init_IRQ(void)
218 openpic_set_sources(0, 32, OpenPIC_Addr + 0x10200); 185 openpic_set_sources(0, 32, OpenPIC_Addr + 0x10200);
219 186
220 /* Map PIC IRQs 0-11 */ 187 /* Map PIC IRQs 0-11 */
221 openpic_set_sources(32, 12, OpenPIC_Addr + 0x10000); 188 openpic_set_sources(48, 12, OpenPIC_Addr + 0x10000);
222 189
223 /* 190 /*
224 * Let openpic interrupts starting from an offset, to 191 * Let openpic interrupts starting from an offset, to
diff --git a/arch/ppc/platforms/sandpoint.c b/arch/ppc/platforms/sandpoint.c
index 531bfa0e4512..70e58f43f2b8 100644
--- a/arch/ppc/platforms/sandpoint.c
+++ b/arch/ppc/platforms/sandpoint.c
@@ -81,6 +81,7 @@
81#include <linux/serial.h> 81#include <linux/serial.h>
82#include <linux/tty.h> /* for linux/serial_core.h */ 82#include <linux/tty.h> /* for linux/serial_core.h */
83#include <linux/serial_core.h> 83#include <linux/serial_core.h>
84#include <linux/serial_8250.h>
84 85
85#include <asm/system.h> 86#include <asm/system.h>
86#include <asm/pgtable.h> 87#include <asm/pgtable.h>
@@ -99,6 +100,7 @@
99#include <asm/mpc10x.h> 100#include <asm/mpc10x.h>
100#include <asm/pci-bridge.h> 101#include <asm/pci-bridge.h>
101#include <asm/kgdb.h> 102#include <asm/kgdb.h>
103#include <asm/ppc_sys.h>
102 104
103#include "sandpoint.h" 105#include "sandpoint.h"
104 106
@@ -305,6 +307,24 @@ sandpoint_setup_arch(void)
305 /* Lookup PCI host bridges */ 307 /* Lookup PCI host bridges */
306 sandpoint_find_bridges(); 308 sandpoint_find_bridges();
307 309
310 if (strncmp (cur_ppc_sys_spec->ppc_sys_name, "8245", 4) == 0)
311 {
312 bd_t *bp = (bd_t *)__res;
313 struct plat_serial8250_port *pdata;
314 pdata = (struct plat_serial8250_port *) ppc_sys_get_pdata(MPC10X_DUART);
315
316 if (pdata)
317 {
318 pdata[0].uartclk = bp->bi_busfreq;
319 pdata[0].membase = ioremap(pdata[0].mapbase, 0x100);
320
321 /* this disables the 2nd serial port on the DUART
322 * since the sandpoint does not have it connected */
323 pdata[1].uartclk = 0;
324 pdata[1].irq = 0;
325 pdata[1].mapbase = 0;
326 }
327
308 printk(KERN_INFO "Motorola SPS Sandpoint Test Platform\n"); 328 printk(KERN_INFO "Motorola SPS Sandpoint Test Platform\n");
309 printk(KERN_INFO "Port by MontaVista Software, Inc. (source@mvista.com)\n"); 329 printk(KERN_INFO "Port by MontaVista Software, Inc. (source@mvista.com)\n");
310 330
diff --git a/arch/ppc/syslib/Makefile b/arch/ppc/syslib/Makefile
index 96acf85800d4..dec5bf4f6879 100644
--- a/arch/ppc/syslib/Makefile
+++ b/arch/ppc/syslib/Makefile
@@ -92,7 +92,7 @@ ifeq ($(CONFIG_SERIAL_MPSC_CONSOLE),y)
92obj-$(CONFIG_SERIAL_TEXT_DEBUG) += mv64x60_dbg.o 92obj-$(CONFIG_SERIAL_TEXT_DEBUG) += mv64x60_dbg.o
93endif 93endif
94obj-$(CONFIG_BOOTX_TEXT) += btext.o 94obj-$(CONFIG_BOOTX_TEXT) += btext.o
95obj-$(CONFIG_MPC10X_BRIDGE) += mpc10x_common.o indirect_pci.o 95obj-$(CONFIG_MPC10X_BRIDGE) += mpc10x_common.o indirect_pci.o ppc_sys.o
96obj-$(CONFIG_MPC10X_OPENPIC) += open_pic.o 96obj-$(CONFIG_MPC10X_OPENPIC) += open_pic.o
97obj-$(CONFIG_40x) += dcr.o 97obj-$(CONFIG_40x) += dcr.o
98obj-$(CONFIG_BOOKE) += dcr.o 98obj-$(CONFIG_BOOKE) += dcr.o
@@ -107,6 +107,7 @@ obj-$(CONFIG_83xx) += ipic.o ppc83xx_setup.o ppc_sys.o \
107ifeq ($(CONFIG_83xx),y) 107ifeq ($(CONFIG_83xx),y)
108obj-$(CONFIG_PCI) += indirect_pci.o pci_auto.o 108obj-$(CONFIG_PCI) += indirect_pci.o pci_auto.o
109endif 109endif
110obj-$(CONFIG_MPC8548_CDS) += todc_time.o
110obj-$(CONFIG_MPC8555_CDS) += todc_time.o 111obj-$(CONFIG_MPC8555_CDS) += todc_time.o
111obj-$(CONFIG_PPC_MPC52xx) += mpc52xx_setup.o mpc52xx_pic.o \ 112obj-$(CONFIG_PPC_MPC52xx) += mpc52xx_setup.o mpc52xx_pic.o \
112 mpc52xx_sys.o mpc52xx_devices.o ppc_sys.o 113 mpc52xx_sys.o mpc52xx_devices.o ppc_sys.o
diff --git a/arch/ppc/syslib/mpc10x_common.c b/arch/ppc/syslib/mpc10x_common.c
index fd93adfd464c..8fc5f4154521 100644
--- a/arch/ppc/syslib/mpc10x_common.c
+++ b/arch/ppc/syslib/mpc10x_common.c
@@ -21,6 +21,9 @@
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/pci.h> 22#include <linux/pci.h>
23#include <linux/slab.h> 23#include <linux/slab.h>
24#include <linux/serial_8250.h>
25#include <linux/fsl_devices.h>
26#include <linux/device.h>
24 27
25#include <asm/byteorder.h> 28#include <asm/byteorder.h>
26#include <asm/io.h> 29#include <asm/io.h>
@@ -30,16 +33,7 @@
30#include <asm/pci-bridge.h> 33#include <asm/pci-bridge.h>
31#include <asm/open_pic.h> 34#include <asm/open_pic.h>
32#include <asm/mpc10x.h> 35#include <asm/mpc10x.h>
33#include <asm/ocp.h> 36#include <asm/ppc_sys.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 37
44#ifdef CONFIG_MPC10X_OPENPIC 38#ifdef CONFIG_MPC10X_OPENPIC
45#ifdef CONFIG_EPIC_SERIAL_MODE 39#ifdef CONFIG_EPIC_SERIAL_MODE
@@ -50,35 +44,140 @@
50#define MPC10X_I2C_IRQ (EPIC_IRQ_BASE + NUM_8259_INTERRUPTS) 44#define MPC10X_I2C_IRQ (EPIC_IRQ_BASE + NUM_8259_INTERRUPTS)
51#define MPC10X_DMA0_IRQ (EPIC_IRQ_BASE + 1 + NUM_8259_INTERRUPTS) 45#define MPC10X_DMA0_IRQ (EPIC_IRQ_BASE + 1 + NUM_8259_INTERRUPTS)
52#define MPC10X_DMA1_IRQ (EPIC_IRQ_BASE + 2 + NUM_8259_INTERRUPTS) 46#define MPC10X_DMA1_IRQ (EPIC_IRQ_BASE + 2 + NUM_8259_INTERRUPTS)
47#define MPC10X_UART0_IRQ (EPIC_IRQ_BASE + 4 + NUM_8259_INTERRUPTS)
53#else 48#else
54#define MPC10X_I2C_IRQ OCP_IRQ_NA 49#define MPC10X_I2C_IRQ -1
55#define MPC10X_DMA0_IRQ OCP_IRQ_NA 50#define MPC10X_DMA0_IRQ -1
56#define MPC10X_DMA1_IRQ OCP_IRQ_NA 51#define MPC10X_DMA1_IRQ -1
52#define MPC10X_UART0_IRQ -1
57#endif 53#endif
58 54
59 55static struct fsl_i2c_platform_data mpc10x_i2c_pdata = {
60struct ocp_def core_ocp[] = { 56 .device_flags = 0,
61 { .vendor = OCP_VENDOR_INVALID
62 }
63}; 57};
64 58
65static struct ocp_fs_i2c_data mpc10x_i2c_data = { 59static struct plat_serial8250_port serial_platform_data[] = {
66 .flags = 0 60 [0] = {
61 .mapbase = 0x4500,
62 .iotype = UPIO_MEM,
63 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
64 },
65 [1] = {
66 .mapbase = 0x4600,
67 .iotype = UPIO_MEM,
68 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
69 },
70 { },
67}; 71};
68static struct ocp_def mpc10x_i2c_ocp = { 72
69 .vendor = OCP_VENDOR_MOTOROLA, 73struct platform_device ppc_sys_platform_devices[] = {
70 .function = OCP_FUNC_IIC, 74 [MPC10X_IIC1] = {
71 .index = 0, 75 .name = "fsl-i2c",
72 .additions = &mpc10x_i2c_data 76 .id = 1,
77 .dev.platform_data = &mpc10x_i2c_pdata,
78 .num_resources = 2,
79 .resource = (struct resource[]) {
80 {
81 .start = MPC10X_EUMB_I2C_OFFSET,
82 .end = MPC10X_EUMB_I2C_OFFSET +
83 MPC10X_EUMB_I2C_SIZE - 1,
84 .flags = IORESOURCE_MEM,
85 },
86 {
87 .flags = IORESOURCE_IRQ
88 },
89 },
90 },
91 [MPC10X_DMA0] = {
92 .name = "fsl-dma",
93 .id = 0,
94 .num_resources = 2,
95 .resource = (struct resource[]) {
96 {
97 .start = MPC10X_EUMB_DMA_OFFSET + 0x10,
98 .end = MPC10X_EUMB_DMA_OFFSET + 0x1f,
99 .flags = IORESOURCE_MEM,
100 },
101 {
102 .flags = IORESOURCE_IRQ,
103 },
104 },
105 },
106 [MPC10X_DMA1] = {
107 .name = "fsl-dma",
108 .id = 1,
109 .num_resources = 2,
110 .resource = (struct resource[]) {
111 {
112 .start = MPC10X_EUMB_DMA_OFFSET + 0x20,
113 .end = MPC10X_EUMB_DMA_OFFSET + 0x2f,
114 .flags = IORESOURCE_MEM,
115 },
116 {
117 .flags = IORESOURCE_IRQ,
118 },
119 },
120 },
121 [MPC10X_DMA1] = {
122 .name = "fsl-dma",
123 .id = 1,
124 .num_resources = 2,
125 .resource = (struct resource[]) {
126 {
127 .start = MPC10X_EUMB_DMA_OFFSET + 0x20,
128 .end = MPC10X_EUMB_DMA_OFFSET + 0x2f,
129 .flags = IORESOURCE_MEM,
130 },
131 {
132 .flags = IORESOURCE_IRQ,
133 },
134 },
135 },
136 [MPC10X_DUART] = {
137 .name = "serial8250",
138 .id = 0,
139 .dev.platform_data = serial_platform_data,
140 },
73}; 141};
74 142
75static struct ocp_def mpc10x_dma_ocp[2] = { 143/* We use the PCI ID to match on */
76{ .vendor = OCP_VENDOR_MOTOROLA, 144struct ppc_sys_spec *cur_ppc_sys_spec;
77 .function = OCP_FUNC_DMA, 145struct ppc_sys_spec ppc_sys_specs[] = {
78 .index = 0 }, 146 {
79{ .vendor = OCP_VENDOR_MOTOROLA, 147 .ppc_sys_name = "8245",
80 .function = OCP_FUNC_DMA, 148 .mask = 0xFFFFFFFF,
81 .index = 1 } 149 .value = MPC10X_BRIDGE_8245,
150 .num_devices = 4,
151 .device_list = (enum ppc_sys_devices[])
152 {
153 MPC10X_IIC1, MPC10X_DMA0, MPC10X_DMA1, MPC10X_DUART,
154 },
155 },
156 {
157 .ppc_sys_name = "8240",
158 .mask = 0xFFFFFFFF,
159 .value = MPC10X_BRIDGE_8240,
160 .num_devices = 3,
161 .device_list = (enum ppc_sys_devices[])
162 {
163 MPC10X_IIC1, MPC10X_DMA0, MPC10X_DMA1,
164 },
165 },
166 {
167 .ppc_sys_name = "107",
168 .mask = 0xFFFFFFFF,
169 .value = MPC10X_BRIDGE_107,
170 .num_devices = 3,
171 .device_list = (enum ppc_sys_devices[])
172 {
173 MPC10X_IIC1, MPC10X_DMA0, MPC10X_DMA1,
174 },
175 },
176 { /* default match */
177 .ppc_sys_name = "",
178 .mask = 0x00000000,
179 .value = 0x00000000,
180 },
82}; 181};
83 182
84/* Set resources to match bridge memory map */ 183/* Set resources to match bridge memory map */
@@ -132,7 +231,7 @@ mpc10x_bridge_init(struct pci_controller *hose,
132 uint new_map, 231 uint new_map,
133 uint phys_eumb_base) 232 uint phys_eumb_base)
134{ 233{
135 int host_bridge, picr1, picr1_bit; 234 int host_bridge, picr1, picr1_bit, i;
136 ulong pci_config_addr, pci_config_data; 235 ulong pci_config_addr, pci_config_data;
137 u_char pir, byte; 236 u_char pir, byte;
138 237
@@ -273,7 +372,7 @@ mpc10x_bridge_init(struct pci_controller *hose,
273 printk("Host bridge in Agent mode\n"); 372 printk("Host bridge in Agent mode\n");
274 /* Read or Set LMBAR & PCSRBAR? */ 373 /* Read or Set LMBAR & PCSRBAR? */
275 } 374 }
276 375
277 /* Set base addr of the 8240/107 EUMB. */ 376 /* Set base addr of the 8240/107 EUMB. */
278 early_write_config_dword(hose, 377 early_write_config_dword(hose,
279 0, 378 0,
@@ -287,17 +386,6 @@ mpc10x_bridge_init(struct pci_controller *hose,
287 ioremap(phys_eumb_base + MPC10X_EUMB_EPIC_OFFSET, 386 ioremap(phys_eumb_base + MPC10X_EUMB_EPIC_OFFSET,
288 MPC10X_EUMB_EPIC_SIZE); 387 MPC10X_EUMB_EPIC_SIZE);
289#endif 388#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 } 389 }
302 390
303#ifdef CONFIG_MPC10X_STORE_GATHERING 391#ifdef CONFIG_MPC10X_STORE_GATHERING
@@ -306,6 +394,29 @@ mpc10x_bridge_init(struct pci_controller *hose,
306 mpc10x_disable_store_gathering(hose); 394 mpc10x_disable_store_gathering(hose);
307#endif 395#endif
308 396
397 /* setup platform devices for MPC10x bridges */
398 identify_ppc_sys_by_id (host_bridge);
399
400 for (i = 0; i < cur_ppc_sys_spec->num_devices; i++) {
401 unsigned int dev_id = cur_ppc_sys_spec->device_list[i];
402 ppc_sys_fixup_mem_resource(&ppc_sys_platform_devices[dev_id],
403 phys_eumb_base);
404 }
405
406 /* IRQ's are determined at runtime */
407 ppc_sys_platform_devices[MPC10X_IIC1].resource[1].start = MPC10X_I2C_IRQ;
408 ppc_sys_platform_devices[MPC10X_IIC1].resource[1].end = MPC10X_I2C_IRQ;
409 ppc_sys_platform_devices[MPC10X_DMA0].resource[1].start = MPC10X_DMA0_IRQ;
410 ppc_sys_platform_devices[MPC10X_DMA0].resource[1].end = MPC10X_DMA0_IRQ;
411 ppc_sys_platform_devices[MPC10X_DMA1].resource[1].start = MPC10X_DMA1_IRQ;
412 ppc_sys_platform_devices[MPC10X_DMA1].resource[1].end = MPC10X_DMA1_IRQ;
413
414 serial_platform_data[0].mapbase += phys_eumb_base;
415 serial_platform_data[0].irq = MPC10X_UART0_IRQ;
416
417 serial_platform_data[1].mapbase += phys_eumb_base;
418 serial_platform_data[1].irq = MPC10X_UART0_IRQ + 1;
419
309 /* 420 /*
310 * 8240 erratum 26, 8241/8245 erratum 29, 107 erratum 23: speculative 421 * 8240 erratum 26, 8241/8245 erratum 29, 107 erratum 23: speculative
311 * PCI reads may return stale data so turn off. 422 * PCI reads may return stale data so turn off.
@@ -330,7 +441,7 @@ mpc10x_bridge_init(struct pci_controller *hose,
330 * 8245 (Rev 2., dated 10/2003) says PICR2[0] is reserverd. 441 * 8245 (Rev 2., dated 10/2003) says PICR2[0] is reserverd.
331 */ 442 */
332 if (host_bridge == MPC10X_BRIDGE_8245) { 443 if (host_bridge == MPC10X_BRIDGE_8245) {
333 ulong picr2; 444 u32 picr2;
334 445
335 early_read_config_dword(hose, 0, PCI_DEVFN(0,0), 446 early_read_config_dword(hose, 0, PCI_DEVFN(0,0),
336 MPC10X_CFG_PICR2_REG, &picr2); 447 MPC10X_CFG_PICR2_REG, &picr2);
@@ -504,6 +615,8 @@ void __init mpc10x_set_openpic(void)
504 openpic_set_sources(EPIC_IRQ_BASE, 3, OpenPIC_Addr + 0x11020); 615 openpic_set_sources(EPIC_IRQ_BASE, 3, OpenPIC_Addr + 0x11020);
505 /* Skip reserved space and map Message Unit Interrupt (I2O) */ 616 /* Skip reserved space and map Message Unit Interrupt (I2O) */
506 openpic_set_sources(EPIC_IRQ_BASE + 3, 1, OpenPIC_Addr + 0x110C0); 617 openpic_set_sources(EPIC_IRQ_BASE + 3, 1, OpenPIC_Addr + 0x110C0);
618 /* Skip reserved space and map Serial Interupts */
619 openpic_set_sources(EPIC_IRQ_BASE + 4, 2, OpenPIC_Addr + 0x11120);
507 620
508 openpic_init(NUM_8259_INTERRUPTS); 621 openpic_init(NUM_8259_INTERRUPTS);
509} 622}
diff --git a/arch/ppc/syslib/mpc85xx_devices.c b/arch/ppc/syslib/mpc85xx_devices.c
index 1e658ef57e75..8af322dd476a 100644
--- a/arch/ppc/syslib/mpc85xx_devices.c
+++ b/arch/ppc/syslib/mpc85xx_devices.c
@@ -40,6 +40,42 @@ static struct gianfar_platform_data mpc85xx_tsec2_pdata = {
40 .phy_reg_addr = MPC85xx_ENET1_OFFSET, 40 .phy_reg_addr = MPC85xx_ENET1_OFFSET,
41}; 41};
42 42
43static struct gianfar_platform_data mpc85xx_etsec1_pdata = {
44 .device_flags = FSL_GIANFAR_DEV_HAS_GIGABIT |
45 FSL_GIANFAR_DEV_HAS_COALESCE | FSL_GIANFAR_DEV_HAS_RMON |
46 FSL_GIANFAR_DEV_HAS_MULTI_INTR |
47 FSL_GIANFAR_DEV_HAS_CSUM | FSL_GIANFAR_DEV_HAS_VLAN |
48 FSL_GIANFAR_DEV_HAS_EXTENDED_HASH,
49 .phy_reg_addr = MPC85xx_ENET1_OFFSET,
50};
51
52static struct gianfar_platform_data mpc85xx_etsec2_pdata = {
53 .device_flags = FSL_GIANFAR_DEV_HAS_GIGABIT |
54 FSL_GIANFAR_DEV_HAS_COALESCE | FSL_GIANFAR_DEV_HAS_RMON |
55 FSL_GIANFAR_DEV_HAS_MULTI_INTR |
56 FSL_GIANFAR_DEV_HAS_CSUM | FSL_GIANFAR_DEV_HAS_VLAN |
57 FSL_GIANFAR_DEV_HAS_EXTENDED_HASH,
58 .phy_reg_addr = MPC85xx_ENET1_OFFSET,
59};
60
61static struct gianfar_platform_data mpc85xx_etsec3_pdata = {
62 .device_flags = FSL_GIANFAR_DEV_HAS_GIGABIT |
63 FSL_GIANFAR_DEV_HAS_COALESCE | FSL_GIANFAR_DEV_HAS_RMON |
64 FSL_GIANFAR_DEV_HAS_MULTI_INTR |
65 FSL_GIANFAR_DEV_HAS_CSUM | FSL_GIANFAR_DEV_HAS_VLAN |
66 FSL_GIANFAR_DEV_HAS_EXTENDED_HASH,
67 .phy_reg_addr = MPC85xx_ENET1_OFFSET,
68};
69
70static struct gianfar_platform_data mpc85xx_etsec4_pdata = {
71 .device_flags = FSL_GIANFAR_DEV_HAS_GIGABIT |
72 FSL_GIANFAR_DEV_HAS_COALESCE | FSL_GIANFAR_DEV_HAS_RMON |
73 FSL_GIANFAR_DEV_HAS_MULTI_INTR |
74 FSL_GIANFAR_DEV_HAS_CSUM | FSL_GIANFAR_DEV_HAS_VLAN |
75 FSL_GIANFAR_DEV_HAS_EXTENDED_HASH,
76 .phy_reg_addr = MPC85xx_ENET1_OFFSET,
77};
78
43static struct gianfar_platform_data mpc85xx_fec_pdata = { 79static struct gianfar_platform_data mpc85xx_fec_pdata = {
44 .phy_reg_addr = MPC85xx_ENET1_OFFSET, 80 .phy_reg_addr = MPC85xx_ENET1_OFFSET,
45}; 81};
@@ -48,6 +84,10 @@ static struct fsl_i2c_platform_data mpc85xx_fsl_i2c_pdata = {
48 .device_flags = FSL_I2C_DEV_SEPARATE_DFSRR, 84 .device_flags = FSL_I2C_DEV_SEPARATE_DFSRR,
49}; 85};
50 86
87static struct fsl_i2c_platform_data mpc85xx_fsl_i2c2_pdata = {
88 .device_flags = FSL_I2C_DEV_SEPARATE_DFSRR,
89};
90
51static struct plat_serial8250_port serial_platform_data[] = { 91static struct plat_serial8250_port serial_platform_data[] = {
52 [0] = { 92 [0] = {
53 .mapbase = 0x4500, 93 .mapbase = 0x4500,
@@ -281,7 +321,6 @@ struct platform_device ppc_sys_platform_devices[] = {
281 }, 321 },
282 }, 322 },
283 }, 323 },
284#ifdef CONFIG_CPM2
285 [MPC85xx_CPM_FCC1] = { 324 [MPC85xx_CPM_FCC1] = {
286 .name = "fsl-cpm-fcc", 325 .name = "fsl-cpm-fcc",
287 .id = 1, 326 .id = 1,
@@ -535,7 +574,151 @@ struct platform_device ppc_sys_platform_devices[] = {
535 }, 574 },
536 }, 575 },
537 }, 576 },
538#endif /* CONFIG_CPM2 */ 577 [MPC85xx_eTSEC1] = {
578 .name = "fsl-gianfar",
579 .id = 1,
580 .dev.platform_data = &mpc85xx_etsec1_pdata,
581 .num_resources = 4,
582 .resource = (struct resource[]) {
583 {
584 .start = MPC85xx_ENET1_OFFSET,
585 .end = MPC85xx_ENET1_OFFSET +
586 MPC85xx_ENET1_SIZE - 1,
587 .flags = IORESOURCE_MEM,
588 },
589 {
590 .name = "tx",
591 .start = MPC85xx_IRQ_TSEC1_TX,
592 .end = MPC85xx_IRQ_TSEC1_TX,
593 .flags = IORESOURCE_IRQ,
594 },
595 {
596 .name = "rx",
597 .start = MPC85xx_IRQ_TSEC1_RX,
598 .end = MPC85xx_IRQ_TSEC1_RX,
599 .flags = IORESOURCE_IRQ,
600 },
601 {
602 .name = "error",
603 .start = MPC85xx_IRQ_TSEC1_ERROR,
604 .end = MPC85xx_IRQ_TSEC1_ERROR,
605 .flags = IORESOURCE_IRQ,
606 },
607 },
608 },
609 [MPC85xx_eTSEC2] = {
610 .name = "fsl-gianfar",
611 .id = 2,
612 .dev.platform_data = &mpc85xx_etsec2_pdata,
613 .num_resources = 4,
614 .resource = (struct resource[]) {
615 {
616 .start = MPC85xx_ENET2_OFFSET,
617 .end = MPC85xx_ENET2_OFFSET +
618 MPC85xx_ENET2_SIZE - 1,
619 .flags = IORESOURCE_MEM,
620 },
621 {
622 .name = "tx",
623 .start = MPC85xx_IRQ_TSEC2_TX,
624 .end = MPC85xx_IRQ_TSEC2_TX,
625 .flags = IORESOURCE_IRQ,
626 },
627 {
628 .name = "rx",
629 .start = MPC85xx_IRQ_TSEC2_RX,
630 .end = MPC85xx_IRQ_TSEC2_RX,
631 .flags = IORESOURCE_IRQ,
632 },
633 {
634 .name = "error",
635 .start = MPC85xx_IRQ_TSEC2_ERROR,
636 .end = MPC85xx_IRQ_TSEC2_ERROR,
637 .flags = IORESOURCE_IRQ,
638 },
639 },
640 },
641 [MPC85xx_eTSEC3] = {
642 .name = "fsl-gianfar",
643 .id = 3,
644 .dev.platform_data = &mpc85xx_etsec3_pdata,
645 .num_resources = 4,
646 .resource = (struct resource[]) {
647 {
648 .start = MPC85xx_ENET3_OFFSET,
649 .end = MPC85xx_ENET3_OFFSET +
650 MPC85xx_ENET3_SIZE - 1,
651 .flags = IORESOURCE_MEM,
652 },
653 {
654 .name = "tx",
655 .start = MPC85xx_IRQ_TSEC3_TX,
656 .end = MPC85xx_IRQ_TSEC3_TX,
657 .flags = IORESOURCE_IRQ,
658 },
659 {
660 .name = "rx",
661 .start = MPC85xx_IRQ_TSEC3_RX,
662 .end = MPC85xx_IRQ_TSEC3_RX,
663 .flags = IORESOURCE_IRQ,
664 },
665 {
666 .name = "error",
667 .start = MPC85xx_IRQ_TSEC3_ERROR,
668 .end = MPC85xx_IRQ_TSEC3_ERROR,
669 .flags = IORESOURCE_IRQ,
670 },
671 },
672 },
673 [MPC85xx_eTSEC4] = {
674 .name = "fsl-gianfar",
675 .id = 4,
676 .dev.platform_data = &mpc85xx_etsec4_pdata,
677 .num_resources = 4,
678 .resource = (struct resource[]) {
679 {
680 .start = 0x27000,
681 .end = 0x27fff,
682 .flags = IORESOURCE_MEM,
683 },
684 {
685 .name = "tx",
686 .start = MPC85xx_IRQ_TSEC4_TX,
687 .end = MPC85xx_IRQ_TSEC4_TX,
688 .flags = IORESOURCE_IRQ,
689 },
690 {
691 .name = "rx",
692 .start = MPC85xx_IRQ_TSEC4_RX,
693 .end = MPC85xx_IRQ_TSEC4_RX,
694 .flags = IORESOURCE_IRQ,
695 },
696 {
697 .name = "error",
698 .start = MPC85xx_IRQ_TSEC4_ERROR,
699 .end = MPC85xx_IRQ_TSEC4_ERROR,
700 .flags = IORESOURCE_IRQ,
701 },
702 },
703 },
704 [MPC85xx_IIC2] = {
705 .name = "fsl-i2c",
706 .id = 2,
707 .dev.platform_data = &mpc85xx_fsl_i2c2_pdata,
708 .num_resources = 2,
709 .resource = (struct resource[]) {
710 {
711 .start = 0x03100,
712 .end = 0x031ff,
713 .flags = IORESOURCE_MEM,
714 },
715 {
716 .start = MPC85xx_IRQ_IIC1,
717 .end = MPC85xx_IRQ_IIC1,
718 .flags = IORESOURCE_IRQ,
719 },
720 },
721 },
539}; 722};
540 723
541static int __init mach_mpc85xx_fixup(struct platform_device *pdev) 724static int __init mach_mpc85xx_fixup(struct platform_device *pdev)
diff --git a/arch/ppc/syslib/mpc85xx_sys.c b/arch/ppc/syslib/mpc85xx_sys.c
index d806a92a9401..6e3184ab354f 100644
--- a/arch/ppc/syslib/mpc85xx_sys.c
+++ b/arch/ppc/syslib/mpc85xx_sys.c
@@ -110,6 +110,111 @@ struct ppc_sys_spec ppc_sys_specs[] = {
110 MPC85xx_CPM_USB, 110 MPC85xx_CPM_USB,
111 }, 111 },
112 }, 112 },
113 /* SVRs on 8548 rev1.0 matches for 8548/8547/8545 */
114 {
115 .ppc_sys_name = "8548E",
116 .mask = 0xFFFF00F0,
117 .value = 0x80390010,
118 .num_devices = 13,
119 .device_list = (enum ppc_sys_devices[])
120 {
121 MPC85xx_eTSEC1, MPC85xx_eTSEC2, MPC85xx_eTSEC3,
122 MPC85xx_eTSEC4, MPC85xx_IIC1, MPC85xx_IIC2,
123 MPC85xx_DMA0, MPC85xx_DMA1, MPC85xx_DMA2, MPC85xx_DMA3,
124 MPC85xx_PERFMON, MPC85xx_DUART, MPC85xx_SEC2,
125 },
126 },
127 {
128 .ppc_sys_name = "8548",
129 .mask = 0xFFFF00F0,
130 .value = 0x80310010,
131 .num_devices = 12,
132 .device_list = (enum ppc_sys_devices[])
133 {
134 MPC85xx_eTSEC1, MPC85xx_eTSEC2, MPC85xx_eTSEC3,
135 MPC85xx_eTSEC4, MPC85xx_IIC1, MPC85xx_IIC2,
136 MPC85xx_DMA0, MPC85xx_DMA1, MPC85xx_DMA2, MPC85xx_DMA3,
137 MPC85xx_PERFMON, MPC85xx_DUART,
138 },
139 },
140 {
141 .ppc_sys_name = "8547E",
142 .mask = 0xFFFF00F0,
143 .value = 0x80390010,
144 .num_devices = 13,
145 .device_list = (enum ppc_sys_devices[])
146 {
147 MPC85xx_eTSEC1, MPC85xx_eTSEC2, MPC85xx_eTSEC3,
148 MPC85xx_eTSEC4, MPC85xx_IIC1, MPC85xx_IIC2,
149 MPC85xx_DMA0, MPC85xx_DMA1, MPC85xx_DMA2, MPC85xx_DMA3,
150 MPC85xx_PERFMON, MPC85xx_DUART, MPC85xx_SEC2,
151 },
152 },
153 {
154 .ppc_sys_name = "8547",
155 .mask = 0xFFFF00F0,
156 .value = 0x80310010,
157 .num_devices = 12,
158 .device_list = (enum ppc_sys_devices[])
159 {
160 MPC85xx_eTSEC1, MPC85xx_eTSEC2, MPC85xx_eTSEC3,
161 MPC85xx_eTSEC4, MPC85xx_IIC1, MPC85xx_IIC2,
162 MPC85xx_DMA0, MPC85xx_DMA1, MPC85xx_DMA2, MPC85xx_DMA3,
163 MPC85xx_PERFMON, MPC85xx_DUART,
164 },
165 },
166 {
167 .ppc_sys_name = "8545E",
168 .mask = 0xFFFF00F0,
169 .value = 0x80390010,
170 .num_devices = 11,
171 .device_list = (enum ppc_sys_devices[])
172 {
173 MPC85xx_eTSEC1, MPC85xx_eTSEC2,
174 MPC85xx_IIC1, MPC85xx_IIC2,
175 MPC85xx_DMA0, MPC85xx_DMA1, MPC85xx_DMA2, MPC85xx_DMA3,
176 MPC85xx_PERFMON, MPC85xx_DUART, MPC85xx_SEC2,
177 },
178 },
179 {
180 .ppc_sys_name = "8545",
181 .mask = 0xFFFF00F0,
182 .value = 0x80310010,
183 .num_devices = 10,
184 .device_list = (enum ppc_sys_devices[])
185 {
186 MPC85xx_eTSEC1, MPC85xx_eTSEC2,
187 MPC85xx_IIC1, MPC85xx_IIC2,
188 MPC85xx_DMA0, MPC85xx_DMA1, MPC85xx_DMA2, MPC85xx_DMA3,
189 MPC85xx_PERFMON, MPC85xx_DUART,
190 },
191 },
192 {
193 .ppc_sys_name = "8543E",
194 .mask = 0xFFFF00F0,
195 .value = 0x803A0010,
196 .num_devices = 11,
197 .device_list = (enum ppc_sys_devices[])
198 {
199 MPC85xx_eTSEC1, MPC85xx_eTSEC2,
200 MPC85xx_IIC1, MPC85xx_IIC2,
201 MPC85xx_DMA0, MPC85xx_DMA1, MPC85xx_DMA2, MPC85xx_DMA3,
202 MPC85xx_PERFMON, MPC85xx_DUART, MPC85xx_SEC2,
203 },
204 },
205 {
206 .ppc_sys_name = "8543",
207 .mask = 0xFFFF00F0,
208 .value = 0x80320010,
209 .num_devices = 10,
210 .device_list = (enum ppc_sys_devices[])
211 {
212 MPC85xx_eTSEC1, MPC85xx_eTSEC2,
213 MPC85xx_IIC1, MPC85xx_IIC2,
214 MPC85xx_DMA0, MPC85xx_DMA1, MPC85xx_DMA2, MPC85xx_DMA3,
215 MPC85xx_PERFMON, MPC85xx_DUART,
216 },
217 },
113 { /* default match */ 218 { /* default match */
114 .ppc_sys_name = "", 219 .ppc_sys_name = "",
115 .mask = 0x00000000, 220 .mask = 0x00000000,
diff --git a/arch/ppc/syslib/open_pic.c b/arch/ppc/syslib/open_pic.c
index 000ba47c67cb..b45d8268bf93 100644
--- a/arch/ppc/syslib/open_pic.c
+++ b/arch/ppc/syslib/open_pic.c
@@ -21,7 +21,6 @@
21#include <asm/signal.h> 21#include <asm/signal.h>
22#include <asm/io.h> 22#include <asm/io.h>
23#include <asm/irq.h> 23#include <asm/irq.h>
24#include <asm/prom.h>
25#include <asm/sections.h> 24#include <asm/sections.h>
26#include <asm/open_pic.h> 25#include <asm/open_pic.h>
27#include <asm/i8259.h> 26#include <asm/i8259.h>
diff --git a/arch/ppc/syslib/open_pic2.c b/arch/ppc/syslib/open_pic2.c
index ea26da0d8b6b..7e272c51a497 100644
--- a/arch/ppc/syslib/open_pic2.c
+++ b/arch/ppc/syslib/open_pic2.c
@@ -25,7 +25,6 @@
25#include <asm/signal.h> 25#include <asm/signal.h>
26#include <asm/io.h> 26#include <asm/io.h>
27#include <asm/irq.h> 27#include <asm/irq.h>
28#include <asm/prom.h>
29#include <asm/sections.h> 28#include <asm/sections.h>
30#include <asm/open_pic.h> 29#include <asm/open_pic.h>
31#include <asm/i8259.h> 30#include <asm/i8259.h>
diff --git a/arch/ppc/syslib/ppc4xx_kgdb.c b/arch/ppc/syslib/ppc4xx_kgdb.c
deleted file mode 100644
index fe8668bf8137..000000000000
--- a/arch/ppc/syslib/ppc4xx_kgdb.c
+++ /dev/null
@@ -1,124 +0,0 @@
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/ppc83xx_setup.c b/arch/ppc/syslib/ppc83xx_setup.c
index 843cf8873e60..602a86891f7f 100644
--- a/arch/ppc/syslib/ppc83xx_setup.c
+++ b/arch/ppc/syslib/ppc83xx_setup.c
@@ -23,7 +23,6 @@
23#include <linux/serial_core.h> 23#include <linux/serial_core.h>
24#include <linux/serial_8250.h> 24#include <linux/serial_8250.h>
25 25
26#include <asm/prom.h>
27#include <asm/time.h> 26#include <asm/time.h>
28#include <asm/mpc83xx.h> 27#include <asm/mpc83xx.h>
29#include <asm/mmu.h> 28#include <asm/mmu.h>
diff --git a/arch/ppc/syslib/ppc85xx_setup.c b/arch/ppc/syslib/ppc85xx_setup.c
index f3277f469e78..ca95d79a704e 100644
--- a/arch/ppc/syslib/ppc85xx_setup.c
+++ b/arch/ppc/syslib/ppc85xx_setup.c
@@ -23,7 +23,6 @@
23#include <linux/serial_core.h> 23#include <linux/serial_core.h>
24#include <linux/serial_8250.h> 24#include <linux/serial_8250.h>
25 25
26#include <asm/prom.h>
27#include <asm/time.h> 26#include <asm/time.h>
28#include <asm/mpc85xx.h> 27#include <asm/mpc85xx.h>
29#include <asm/immap_85xx.h> 28#include <asm/immap_85xx.h>
@@ -33,6 +32,8 @@
33 32
34#include <syslib/ppc85xx_setup.h> 33#include <syslib/ppc85xx_setup.h>
35 34
35extern void abort(void);
36
36/* Return the amount of memory */ 37/* Return the amount of memory */
37unsigned long __init 38unsigned long __init
38mpc85xx_find_end_of_memory(void) 39mpc85xx_find_end_of_memory(void)
@@ -133,7 +134,7 @@ mpc85xx_halt(void)
133 134
134#ifdef CONFIG_PCI 135#ifdef CONFIG_PCI
135 136
136#if defined(CONFIG_MPC8555_CDS) 137#if defined(CONFIG_MPC8555_CDS) || defined(CONFIG_MPC8548_CDS)
137extern void mpc85xx_cds_enable_via(struct pci_controller *hose); 138extern void mpc85xx_cds_enable_via(struct pci_controller *hose);
138extern void mpc85xx_cds_fixup_via(struct pci_controller *hose); 139extern void mpc85xx_cds_fixup_via(struct pci_controller *hose);
139#endif 140#endif
@@ -308,14 +309,14 @@ mpc85xx_setup_hose(void)
308 309
309 ppc_md.pci_exclude_device = mpc85xx_exclude_device; 310 ppc_md.pci_exclude_device = mpc85xx_exclude_device;
310 311
311#if defined(CONFIG_MPC8555_CDS) 312#if defined(CONFIG_MPC8555_CDS) || defined(CONFIG_MPC8548_CDS)
312 /* Pre pciauto_bus_scan VIA init */ 313 /* Pre pciauto_bus_scan VIA init */
313 mpc85xx_cds_enable_via(hose_a); 314 mpc85xx_cds_enable_via(hose_a);
314#endif 315#endif
315 316
316 hose_a->last_busno = pciauto_bus_scan(hose_a, hose_a->first_busno); 317 hose_a->last_busno = pciauto_bus_scan(hose_a, hose_a->first_busno);
317 318
318#if defined(CONFIG_MPC8555_CDS) 319#if defined(CONFIG_MPC8555_CDS) || defined(CONFIG_MPC8548_CDS)
319 /* Post pciauto_bus_scan VIA fixup */ 320 /* Post pciauto_bus_scan VIA fixup */
320 mpc85xx_cds_fixup_via(hose_a); 321 mpc85xx_cds_fixup_via(hose_a);
321#endif 322#endif
diff --git a/arch/ppc/xmon/xmon.c b/arch/ppc/xmon/xmon.c
index 8565f49b8b0b..be7869e39465 100644
--- a/arch/ppc/xmon/xmon.c
+++ b/arch/ppc/xmon/xmon.c
@@ -9,6 +9,7 @@
9#include <linux/smp.h> 9#include <linux/smp.h>
10#include <linux/interrupt.h> 10#include <linux/interrupt.h>
11#include <linux/bitops.h> 11#include <linux/bitops.h>
12#include <linux/kallsyms.h>
12#include <asm/ptrace.h> 13#include <asm/ptrace.h>
13#include <asm/string.h> 14#include <asm/string.h>
14#include <asm/prom.h> 15#include <asm/prom.h>
@@ -93,8 +94,7 @@ static void take_input(char *);
93static unsigned read_spr(int); 94static unsigned read_spr(int);
94static void write_spr(int, unsigned); 95static void write_spr(int, unsigned);
95static void super_regs(void); 96static void super_regs(void);
96static void print_sysmap(void); 97static void symbol_lookup(void);
97static void sysmap_lookup(void);
98static void remove_bpts(void); 98static void remove_bpts(void);
99static void insert_bpts(void); 99static void insert_bpts(void);
100static struct bpt *at_breakpoint(unsigned pc); 100static struct bpt *at_breakpoint(unsigned pc);
@@ -103,7 +103,6 @@ static void cacheflush(void);
103#ifdef CONFIG_SMP 103#ifdef CONFIG_SMP
104static void cpu_cmd(void); 104static void cpu_cmd(void);
105#endif /* CONFIG_SMP */ 105#endif /* CONFIG_SMP */
106static int pretty_print_addr(unsigned long addr);
107static void csum(void); 106static void csum(void);
108#ifdef CONFIG_BOOTX_TEXT 107#ifdef CONFIG_BOOTX_TEXT
109static void vidcmds(void); 108static void vidcmds(void);
@@ -120,8 +119,6 @@ extern void longjmp(u_int *, int);
120 119
121extern void xmon_enter(void); 120extern void xmon_enter(void);
122extern void xmon_leave(void); 121extern 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 122
126static unsigned start_tb[NR_CPUS][2]; 123static unsigned start_tb[NR_CPUS][2];
127static unsigned stop_tb[NR_CPUS][2]; 124static unsigned stop_tb[NR_CPUS][2];
@@ -148,7 +145,6 @@ Commands:\n\
148 mm move a block of memory\n\ 145 mm move a block of memory\n\
149 ms set a block of memory\n\ 146 ms set a block of memory\n\
150 md compare two blocks of memory\n\ 147 md compare two blocks of memory\n\
151 M print System.map\n\
152 r print registers\n\ 148 r print registers\n\
153 S print special registers\n\ 149 S print special registers\n\
154 t print backtrace\n\ 150 t print backtrace\n\
@@ -175,6 +171,35 @@ extern inline void __delay(unsigned int loops)
175 "r" (loops) : "ctr"); 171 "r" (loops) : "ctr");
176} 172}
177 173
174/* Print an address in numeric and symbolic form (if possible) */
175static void xmon_print_symbol(unsigned long address, const char *mid,
176 const char *after)
177{
178 char *modname;
179 const char *name = NULL;
180 unsigned long offset, size;
181 static char tmpstr[128];
182
183 printf("%.8lx", address);
184 if (setjmp(bus_error_jmp) == 0) {
185 debugger_fault_handler = handle_fault;
186 sync();
187 name = kallsyms_lookup(address, &size, &offset, &modname,
188 tmpstr);
189 sync();
190 /* wait a little while to see if we get a machine check */
191 __delay(200);
192 }
193 debugger_fault_handler = NULL;
194
195 if (name) {
196 printf("%s%s+%#lx/%#lx", mid, name, offset, size);
197 if (modname)
198 printf(" [%s]", modname);
199 }
200 printf("%s", after);
201}
202
178static void get_tb(unsigned *p) 203static void get_tb(unsigned *p)
179{ 204{
180 unsigned hi, lo, hiagain; 205 unsigned hi, lo, hiagain;
@@ -454,7 +479,7 @@ cmds(struct pt_regs *excp)
454 dump(); 479 dump();
455 break; 480 break;
456 case 'l': 481 case 'l':
457 sysmap_lookup(); 482 symbol_lookup();
458 break; 483 break;
459 case 'r': 484 case 'r':
460 if (excp != NULL) 485 if (excp != NULL)
@@ -466,9 +491,6 @@ cmds(struct pt_regs *excp)
466 else 491 else
467 excprint(excp); 492 excprint(excp);
468 break; 493 break;
469 case 'M':
470 print_sysmap();
471 break;
472 case 'S': 494 case 'S':
473 super_regs(); 495 super_regs();
474 break; 496 break;
@@ -825,20 +847,19 @@ backtrace(struct pt_regs *excp)
825 for (; sp != 0; sp = stack[0]) { 847 for (; sp != 0; sp = stack[0]) {
826 if (mread(sp, stack, sizeof(stack)) != sizeof(stack)) 848 if (mread(sp, stack, sizeof(stack)) != sizeof(stack))
827 break; 849 break;
828 pretty_print_addr(stack[1]); 850 printf("[%.8lx] ", stack);
829 printf(" "); 851 xmon_print_symbol(stack[1], " ", "\n");
830 if (stack[1] == (unsigned) &ret_from_except 852 if (stack[1] == (unsigned) &ret_from_except
831 || stack[1] == (unsigned) &ret_from_except_full 853 || stack[1] == (unsigned) &ret_from_except_full
832 || stack[1] == (unsigned) &ret_from_syscall) { 854 || stack[1] == (unsigned) &ret_from_syscall) {
833 if (mread(sp+16, &regs, sizeof(regs)) != sizeof(regs)) 855 if (mread(sp+16, &regs, sizeof(regs)) != sizeof(regs))
834 break; 856 break;
835 printf("\nexception:%x [%x] %x ", regs.trap, sp+16, 857 printf("exception:%x [%x] %x\n", regs.trap, sp+16,
836 regs.nip); 858 regs.nip);
837 sp = regs.gpr[1]; 859 sp = regs.gpr[1];
838 if (mread(sp, stack, sizeof(stack)) != sizeof(stack)) 860 if (mread(sp, stack, sizeof(stack)) != sizeof(stack))
839 break; 861 break;
840 } 862 }
841 printf("\n");
842 } 863 }
843} 864}
844 865
@@ -859,11 +880,10 @@ excprint(struct pt_regs *fp)
859#ifdef CONFIG_SMP 880#ifdef CONFIG_SMP
860 printf("cpu %d: ", smp_processor_id()); 881 printf("cpu %d: ", smp_processor_id());
861#endif /* CONFIG_SMP */ 882#endif /* CONFIG_SMP */
862 printf("vector: %x at pc = ", fp->trap); 883 printf("vector: %x at pc=", fp->trap);
863 pretty_print_addr(fp->nip); 884 xmon_print_symbol(fp->nip, ": ", ", lr=");
864 printf(", lr = "); 885 xmon_print_symbol(fp->link, ": ", "\n");
865 pretty_print_addr(fp->link); 886 printf("msr = %x, sp = %x [%x]\n", fp->msr, fp->gpr[1], fp);
866 printf("\nmsr = %x, sp = %x [%x]\n", fp->msr, fp->gpr[1], fp);
867 trap = TRAP(fp); 887 trap = TRAP(fp);
868 if (trap == 0x300 || trap == 0x600) 888 if (trap == 0x300 || trap == 0x600)
869 printf("dar = %x, dsisr = %x\n", fp->dar, fp->dsisr); 889 printf("dar = %x, dsisr = %x\n", fp->dar, fp->dsisr);
@@ -951,24 +971,6 @@ extern char exc_prolog;
951extern char dec_exc; 971extern char dec_exc;
952 972
953void 973void
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) 974super_regs(void)
973{ 975{
974 int i, cmd; 976 int i, cmd;
@@ -1738,7 +1740,7 @@ scanhex(unsigned *vp)
1738 printf("invalid register name '%%%s'\n", regname); 1740 printf("invalid register name '%%%s'\n", regname);
1739 return 0; 1741 return 0;
1740 } else if (c == '$') { 1742 } else if (c == '$') {
1741 static char symname[64]; 1743 static char symname[128];
1742 int i; 1744 int i;
1743 for (i=0; i<63; i++) { 1745 for (i=0; i<63; i++) {
1744 c = inchar(); 1746 c = inchar();
@@ -1749,7 +1751,14 @@ scanhex(unsigned *vp)
1749 symname[i] = c; 1751 symname[i] = c;
1750 } 1752 }
1751 symname[i++] = 0; 1753 symname[i++] = 0;
1752 *vp = xmon_symbol_to_addr(symname); 1754 *vp = 0;
1755 if (setjmp(bus_error_jmp) == 0) {
1756 debugger_fault_handler = handle_fault;
1757 sync();
1758 *vp = kallsyms_lookup_name(symname);
1759 sync();
1760 }
1761 debugger_fault_handler = NULL;
1753 if (!(*vp)) { 1762 if (!(*vp)) {
1754 printf("unknown symbol\n"); 1763 printf("unknown symbol\n");
1755 return 0; 1764 return 0;
@@ -1840,169 +1849,34 @@ take_input(char *str)
1840 lineptr = str; 1849 lineptr = str;
1841} 1850}
1842 1851
1843void 1852static void
1844sysmap_lookup(void) 1853symbol_lookup(void)
1845{ 1854{
1846 int type = inchar(); 1855 int type = inchar();
1847 unsigned addr; 1856 unsigned addr;
1848 static char tmp[64]; 1857 static char tmp[128];
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 1858
1895static int 1859 switch (type) {
1896pretty_print_addr(unsigned long addr) 1860 case 'a':
1897{ 1861 if (scanhex(&addr))
1898 char *sym; 1862 xmon_print_symbol(addr, ": ", "\n");
1899 unsigned long saddr; 1863 termch = 0;
1900 1864 break;
1901 printf("%08x", addr); 1865 case 's':
1902 sym = xmon_find_symbol(addr, &saddr); 1866 getstring(tmp, 64);
1903 if (sym) 1867 if (setjmp(bus_error_jmp) == 0) {
1904 printf(" (%s+0x%x)", sym, addr-saddr); 1868 debugger_fault_handler = handle_fault;
1905 return (sym != 0); 1869 sync();
1906} 1870 addr = kallsyms_lookup_name(tmp);
1907 1871 if (addr)
1908char* 1872 printf("%s: %lx\n", tmp, addr);
1909xmon_find_symbol(unsigned long addr, unsigned long* saddr) 1873 else
1910{ 1874 printf("Symbol '%s' not found.\n", tmp);
1911 static char rbuffer[64]; 1875 sync();
1912 char *p, *ep, *limit; 1876 }
1913 unsigned long prev, next; 1877 debugger_fault_handler = NULL;
1914 char* psym; 1878 termch = 0;
1915 1879 break;
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 } 1880 }
1954 debugger_fault_handler = NULL;
1955 return NULL;
1956} 1881}
1957 1882
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}
diff --git a/arch/ppc64/Kconfig b/arch/ppc64/Kconfig
index 5cb343883e4d..0f1fa289744e 100644
--- a/arch/ppc64/Kconfig
+++ b/arch/ppc64/Kconfig
@@ -323,7 +323,7 @@ config EISA
323 bool 323 bool
324 324
325config PCI 325config PCI
326 bool 326 bool "support for PCI devices" if (EMBEDDED && PPC_ISERIES)
327 default y 327 default y
328 help 328 help
329 Find out whether your system includes a PCI bus. PCI is the name of 329 Find out whether your system includes a PCI bus. PCI is the name of
diff --git a/arch/ppc64/Makefile b/arch/ppc64/Makefile
index 691f3008e698..33c752ceca4b 100644
--- a/arch/ppc64/Makefile
+++ b/arch/ppc64/Makefile
@@ -35,9 +35,9 @@ CROSS32AS := $(AS) -a32
35CROSS32LD := $(LD) -m elf32ppc 35CROSS32LD := $(LD) -m elf32ppc
36CROSS32OBJCOPY := $(OBJCOPY) 36CROSS32OBJCOPY := $(OBJCOPY)
37endif 37endif
38AS := $(AS) -a64 38override AS += -a64
39LD := $(LD) -m elf64ppc 39override LD += -m elf64ppc
40CC := $(CC) -m64 40override CC += -m64
41endif 41endif
42 42
43export CROSS32CC CROSS32AS CROSS32LD CROSS32OBJCOPY 43export CROSS32CC CROSS32AS CROSS32LD CROSS32OBJCOPY
diff --git a/arch/ppc64/kernel/HvLpEvent.c b/arch/ppc64/kernel/HvLpEvent.c
index f8f19637f73f..90032b138902 100644
--- a/arch/ppc64/kernel/HvLpEvent.c
+++ b/arch/ppc64/kernel/HvLpEvent.c
@@ -12,7 +12,7 @@
12#include <asm/system.h> 12#include <asm/system.h>
13#include <asm/iSeries/HvLpEvent.h> 13#include <asm/iSeries/HvLpEvent.h>
14#include <asm/iSeries/HvCallEvent.h> 14#include <asm/iSeries/HvCallEvent.h>
15#include <asm/iSeries/LparData.h> 15#include <asm/iSeries/ItLpNaca.h>
16 16
17/* Array of LpEvent handler functions */ 17/* Array of LpEvent handler functions */
18LpEventHandler lpEventHandler[HvLpEvent_Type_NumTypes]; 18LpEventHandler lpEventHandler[HvLpEvent_Type_NumTypes];
diff --git a/arch/ppc64/kernel/ItLpQueue.c b/arch/ppc64/kernel/ItLpQueue.c
index c923a815760e..cdea00d7707f 100644
--- a/arch/ppc64/kernel/ItLpQueue.c
+++ b/arch/ppc64/kernel/ItLpQueue.c
@@ -16,7 +16,6 @@
16#include <asm/iSeries/ItLpQueue.h> 16#include <asm/iSeries/ItLpQueue.h>
17#include <asm/iSeries/HvLpEvent.h> 17#include <asm/iSeries/HvLpEvent.h>
18#include <asm/iSeries/HvCallEvent.h> 18#include <asm/iSeries/HvCallEvent.h>
19#include <asm/iSeries/LparData.h>
20 19
21static __inline__ int set_inUse( struct ItLpQueue * lpQueue ) 20static __inline__ int set_inUse( struct ItLpQueue * lpQueue )
22{ 21{
diff --git a/arch/ppc64/kernel/Makefile b/arch/ppc64/kernel/Makefile
index 96d90b0c5119..b5e167cf1a05 100644
--- a/arch/ppc64/kernel/Makefile
+++ b/arch/ppc64/kernel/Makefile
@@ -16,14 +16,13 @@ obj-y += vdso32/ vdso64/
16 16
17obj-$(CONFIG_PPC_OF) += of_device.o 17obj-$(CONFIG_PPC_OF) += of_device.o
18 18
19pci-obj-$(CONFIG_PPC_ISERIES) += iSeries_pci.o iSeries_pci_reset.o 19pci-obj-$(CONFIG_PPC_ISERIES) += iSeries_pci.o iSeries_irq.o \
20 iSeries_VpdInfo.o
20pci-obj-$(CONFIG_PPC_MULTIPLATFORM) += pci_dn.o pci_direct_iommu.o 21pci-obj-$(CONFIG_PPC_MULTIPLATFORM) += pci_dn.o pci_direct_iommu.o
21 22
22obj-$(CONFIG_PCI) += pci.o pci_iommu.o iomap.o $(pci-obj-y) 23obj-$(CONFIG_PCI) += pci.o pci_iommu.o iomap.o $(pci-obj-y)
23 24
24obj-$(CONFIG_PPC_ISERIES) += iSeries_irq.o \ 25obj-$(CONFIG_PPC_ISERIES) += HvCall.o HvLpConfig.o LparData.o \
25 iSeries_VpdInfo.o XmPciLpEvent.o \
26 HvCall.o HvLpConfig.o LparData.o \
27 iSeries_setup.o ItLpQueue.o hvCall.o \ 26 iSeries_setup.o ItLpQueue.o hvCall.o \
28 mf.o HvLpEvent.o iSeries_proc.o iSeries_htab.o \ 27 mf.o HvLpEvent.o iSeries_proc.o iSeries_htab.o \
29 iSeries_iommu.o 28 iSeries_iommu.o
diff --git a/arch/ppc64/kernel/XmPciLpEvent.c b/arch/ppc64/kernel/XmPciLpEvent.c
deleted file mode 100644
index 809c9bc6678b..000000000000
--- a/arch/ppc64/kernel/XmPciLpEvent.c
+++ /dev/null
@@ -1,190 +0,0 @@
1/*
2 * File XmPciLpEvent.h created by Wayne Holm on Mon Jan 15 2001.
3 *
4 * This module handles PCI interrupt events sent by the iSeries Hypervisor.
5*/
6
7#include <linux/config.h>
8#include <linux/pci.h>
9#include <linux/init.h>
10#include <linux/threads.h>
11#include <linux/smp.h>
12#include <linux/param.h>
13#include <linux/string.h>
14#include <linux/bootmem.h>
15#include <linux/ide.h>
16
17#include <asm/iSeries/HvTypes.h>
18#include <asm/iSeries/HvLpEvent.h>
19#include <asm/iSeries/HvCallPci.h>
20#include <asm/iSeries/XmPciLpEvent.h>
21#include <asm/ppcdebug.h>
22
23static long Pci_Interrupt_Count;
24static long Pci_Event_Count;
25
26enum XmPciLpEvent_Subtype {
27 XmPciLpEvent_BusCreated = 0, // PHB has been created
28 XmPciLpEvent_BusError = 1, // PHB has failed
29 XmPciLpEvent_BusFailed = 2, // Msg to Secondary, Primary failed bus
30 XmPciLpEvent_NodeFailed = 4, // Multi-adapter bridge has failed
31 XmPciLpEvent_NodeRecovered = 5, // Multi-adapter bridge has recovered
32 XmPciLpEvent_BusRecovered = 12, // PHB has been recovered
33 XmPciLpEvent_UnQuiesceBus = 18, // Secondary bus unqiescing
34 XmPciLpEvent_BridgeError = 21, // Bridge Error
35 XmPciLpEvent_SlotInterrupt = 22 // Slot interrupt
36};
37
38struct XmPciLpEvent_BusInterrupt {
39 HvBusNumber busNumber;
40 HvSubBusNumber subBusNumber;
41};
42
43struct XmPciLpEvent_NodeInterrupt {
44 HvBusNumber busNumber;
45 HvSubBusNumber subBusNumber;
46 HvAgentId deviceId;
47};
48
49struct XmPciLpEvent {
50 struct HvLpEvent hvLpEvent;
51
52 union {
53 u64 alignData; // Align on an 8-byte boundary
54
55 struct {
56 u32 fisr;
57 HvBusNumber busNumber;
58 HvSubBusNumber subBusNumber;
59 HvAgentId deviceId;
60 } slotInterrupt;
61
62 struct XmPciLpEvent_BusInterrupt busFailed;
63 struct XmPciLpEvent_BusInterrupt busRecovered;
64 struct XmPciLpEvent_BusInterrupt busCreated;
65
66 struct XmPciLpEvent_NodeInterrupt nodeFailed;
67 struct XmPciLpEvent_NodeInterrupt nodeRecovered;
68
69 } eventData;
70
71};
72
73static void intReceived(struct XmPciLpEvent *eventParm,
74 struct pt_regs *regsParm);
75
76static void XmPciLpEvent_handler(struct HvLpEvent *eventParm,
77 struct pt_regs *regsParm)
78{
79#ifdef CONFIG_PCI
80#if 0
81 PPCDBG(PPCDBG_BUSWALK, "XmPciLpEvent_handler, type 0x%x\n",
82 eventParm->xType);
83#endif
84 ++Pci_Event_Count;
85
86 if (eventParm && (eventParm->xType == HvLpEvent_Type_PciIo)) {
87 switch (eventParm->xFlags.xFunction) {
88 case HvLpEvent_Function_Int:
89 intReceived((struct XmPciLpEvent *)eventParm, regsParm);
90 break;
91 case HvLpEvent_Function_Ack:
92 printk(KERN_ERR
93 "XmPciLpEvent.c: unexpected ack received\n");
94 break;
95 default:
96 printk(KERN_ERR
97 "XmPciLpEvent.c: unexpected event function %d\n",
98 (int)eventParm->xFlags.xFunction);
99 break;
100 }
101 } else if (eventParm)
102 printk(KERN_ERR
103 "XmPciLpEvent.c: Unrecognized PCI event type 0x%x\n",
104 (int)eventParm->xType);
105 else
106 printk(KERN_ERR "XmPciLpEvent.c: NULL event received\n");
107#endif
108}
109
110static void intReceived(struct XmPciLpEvent *eventParm,
111 struct pt_regs *regsParm)
112{
113 int irq;
114
115 ++Pci_Interrupt_Count;
116#if 0
117 PPCDBG(PPCDBG_BUSWALK, "PCI: XmPciLpEvent.c: intReceived\n");
118#endif
119
120 switch (eventParm->hvLpEvent.xSubtype) {
121 case XmPciLpEvent_SlotInterrupt:
122 irq = eventParm->hvLpEvent.xCorrelationToken;
123 /* Dispatch the interrupt handlers for this irq */
124 ppc_irq_dispatch_handler(regsParm, irq);
125 HvCallPci_eoi(eventParm->eventData.slotInterrupt.busNumber,
126 eventParm->eventData.slotInterrupt.subBusNumber,
127 eventParm->eventData.slotInterrupt.deviceId);
128 break;
129 /* Ignore error recovery events for now */
130 case XmPciLpEvent_BusCreated:
131 printk(KERN_INFO "XmPciLpEvent.c: system bus %d created\n",
132 eventParm->eventData.busCreated.busNumber);
133 break;
134 case XmPciLpEvent_BusError:
135 case XmPciLpEvent_BusFailed:
136 printk(KERN_INFO "XmPciLpEvent.c: system bus %d failed\n",
137 eventParm->eventData.busFailed.busNumber);
138 break;
139 case XmPciLpEvent_BusRecovered:
140 case XmPciLpEvent_UnQuiesceBus:
141 printk(KERN_INFO "XmPciLpEvent.c: system bus %d recovered\n",
142 eventParm->eventData.busRecovered.busNumber);
143 break;
144 case XmPciLpEvent_NodeFailed:
145 case XmPciLpEvent_BridgeError:
146 printk(KERN_INFO
147 "XmPciLpEvent.c: multi-adapter bridge %d/%d/%d failed\n",
148 eventParm->eventData.nodeFailed.busNumber,
149 eventParm->eventData.nodeFailed.subBusNumber,
150 eventParm->eventData.nodeFailed.deviceId);
151 break;
152 case XmPciLpEvent_NodeRecovered:
153 printk(KERN_INFO
154 "XmPciLpEvent.c: multi-adapter bridge %d/%d/%d recovered\n",
155 eventParm->eventData.nodeRecovered.busNumber,
156 eventParm->eventData.nodeRecovered.subBusNumber,
157 eventParm->eventData.nodeRecovered.deviceId);
158 break;
159 default:
160 printk(KERN_ERR
161 "XmPciLpEvent.c: unrecognized event subtype 0x%x\n",
162 eventParm->hvLpEvent.xSubtype);
163 break;
164 }
165}
166
167
168/* This should be called sometime prior to buswalk (init_IRQ would be good) */
169int XmPciLpEvent_init()
170{
171 int xRc;
172
173 PPCDBG(PPCDBG_BUSWALK,
174 "XmPciLpEvent_init, Register Event type 0x%04X\n",
175 HvLpEvent_Type_PciIo);
176
177 xRc = HvLpEvent_registerHandler(HvLpEvent_Type_PciIo,
178 &XmPciLpEvent_handler);
179 if (xRc == 0) {
180 xRc = HvLpEvent_openPath(HvLpEvent_Type_PciIo, 0);
181 if (xRc != 0)
182 printk(KERN_ERR
183 "XmPciLpEvent.c: open event path failed with rc 0x%x\n",
184 xRc);
185 } else
186 printk(KERN_ERR
187 "XmPciLpEvent.c: register handler failed with rc 0x%x\n",
188 xRc);
189 return xRc;
190}
diff --git a/arch/ppc64/kernel/asm-offsets.c b/arch/ppc64/kernel/asm-offsets.c
index 0094ac79a18c..abb9e5b5da03 100644
--- a/arch/ppc64/kernel/asm-offsets.c
+++ b/arch/ppc64/kernel/asm-offsets.c
@@ -31,7 +31,6 @@
31 31
32#include <asm/paca.h> 32#include <asm/paca.h>
33#include <asm/lppaca.h> 33#include <asm/lppaca.h>
34#include <asm/iSeries/ItLpQueue.h>
35#include <asm/iSeries/HvLpEvent.h> 34#include <asm/iSeries/HvLpEvent.h>
36#include <asm/rtas.h> 35#include <asm/rtas.h>
37#include <asm/cputable.h> 36#include <asm/cputable.h>
diff --git a/arch/ppc64/kernel/dma.c b/arch/ppc64/kernel/dma.c
index ce714c927134..4da8e31b2b61 100644
--- a/arch/ppc64/kernel/dma.c
+++ b/arch/ppc64/kernel/dma.c
@@ -15,8 +15,10 @@
15 15
16static struct dma_mapping_ops *get_dma_ops(struct device *dev) 16static struct dma_mapping_ops *get_dma_ops(struct device *dev)
17{ 17{
18#ifdef CONFIG_PCI
18 if (dev->bus == &pci_bus_type) 19 if (dev->bus == &pci_bus_type)
19 return &pci_dma_ops; 20 return &pci_dma_ops;
21#endif
20#ifdef CONFIG_IBMVIO 22#ifdef CONFIG_IBMVIO
21 if (dev->bus == &vio_bus_type) 23 if (dev->bus == &vio_bus_type)
22 return &vio_dma_ops; 24 return &vio_dma_ops;
@@ -37,8 +39,10 @@ EXPORT_SYMBOL(dma_supported);
37 39
38int dma_set_mask(struct device *dev, u64 dma_mask) 40int dma_set_mask(struct device *dev, u64 dma_mask)
39{ 41{
42#ifdef CONFIG_PCI
40 if (dev->bus == &pci_bus_type) 43 if (dev->bus == &pci_bus_type)
41 return pci_set_dma_mask(to_pci_dev(dev), dma_mask); 44 return pci_set_dma_mask(to_pci_dev(dev), dma_mask);
45#endif
42#ifdef CONFIG_IBMVIO 46#ifdef CONFIG_IBMVIO
43 if (dev->bus == &vio_bus_type) 47 if (dev->bus == &vio_bus_type)
44 return -EIO; 48 return -EIO;
diff --git a/arch/ppc64/kernel/eeh.c b/arch/ppc64/kernel/eeh.c
index d63d41f3eecf..af5272fedadf 100644
--- a/arch/ppc64/kernel/eeh.c
+++ b/arch/ppc64/kernel/eeh.c
@@ -505,7 +505,7 @@ static inline unsigned long eeh_token_to_phys(unsigned long token)
505 pte_t *ptep; 505 pte_t *ptep;
506 unsigned long pa; 506 unsigned long pa;
507 507
508 ptep = find_linux_pte(ioremap_mm.pgd, token); 508 ptep = find_linux_pte(init_mm.pgd, token);
509 if (!ptep) 509 if (!ptep)
510 return token; 510 return token;
511 pa = pte_pfn(*ptep) << PAGE_SHIFT; 511 pa = pte_pfn(*ptep) << PAGE_SHIFT;
diff --git a/arch/ppc64/kernel/head.S b/arch/ppc64/kernel/head.S
index 346dbf606b5d..02c8f4e3e4bc 100644
--- a/arch/ppc64/kernel/head.S
+++ b/arch/ppc64/kernel/head.S
@@ -2121,10 +2121,6 @@ empty_zero_page:
2121swapper_pg_dir: 2121swapper_pg_dir:
2122 .space 4096 2122 .space 4096
2123 2123
2124 .globl ioremap_dir
2125ioremap_dir:
2126 .space 4096
2127
2128#ifdef CONFIG_SMP 2124#ifdef CONFIG_SMP
2129/* 1 page segment table per cpu (max 48, cpu0 allocated at STAB0_PHYS_ADDR) */ 2125/* 1 page segment table per cpu (max 48, cpu0 allocated at STAB0_PHYS_ADDR) */
2130 .globl stab_array 2126 .globl stab_array
diff --git a/arch/ppc64/kernel/iSeries_VpdInfo.c b/arch/ppc64/kernel/iSeries_VpdInfo.c
index a6f0ff2d0239..d11c732daf81 100644
--- a/arch/ppc64/kernel/iSeries_VpdInfo.c
+++ b/arch/ppc64/kernel/iSeries_VpdInfo.c
@@ -1,31 +1,31 @@
1/************************************************************************/ 1/*
2/* File iSeries_vpdInfo.c created by Allan Trautman on Fri Feb 2 2001. */ 2 * File iSeries_vpdInfo.c created by Allan Trautman on Fri Feb 2 2001.
3/************************************************************************/ 3 *
4/* This code gets the card location of the hardware */ 4 * This code gets the card location of the hardware
5/* Copyright (C) 20yy <Allan H Trautman> <IBM Corp> */ 5 * Copyright (C) 2001 <Allan H Trautman> <IBM Corp>
6/* */ 6 * Copyright (C) 2005 Stephen Rothwel, IBM Corp
7/* This program is free software; you can redistribute it and/or modify */ 7 *
8/* it under the terms of the GNU General Public License as published by */ 8 * This program is free software; you can redistribute it and/or modify
9/* the Free Software Foundation; either version 2 of the License, or */ 9 * it under the terms of the GNU General Public License as published by
10/* (at your option) any later version. */ 10 * the Free Software Foundation; either version 2 of the License, or
11/* */ 11 * (at your option) any later version.
12/* This program is distributed in the hope that it will be useful, */ 12 *
13/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ 13 * This program is distributed in the hope that it will be useful,
14/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15/* GNU General Public License for more details. */ 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16/* */ 16 * GNU General Public License for more details.
17/* You should have received a copy of the GNU General Public License */ 17 *
18/* along with this program; if not, write to the: */ 18 * You should have received a copy of the GNU General Public License
19/* Free Software Foundation, Inc., */ 19 * along with this program; if not, write to the:
20/* 59 Temple Place, Suite 330, */ 20 * Free Software Foundation, Inc.,
21/* Boston, MA 02111-1307 USA */ 21 * 59 Temple Place, Suite 330,
22/************************************************************************/ 22 * Boston, MA 02111-1307 USA
23/* Change Activity: */ 23 *
24/* Created, Feb 2, 2001 */ 24 * Change Activity:
25/* Ported to ppc64, August 20, 2001 */ 25 * Created, Feb 2, 2001
26/* End Change Activity */ 26 * Ported to ppc64, August 20, 2001
27/************************************************************************/ 27 * End Change Activity
28#include <linux/config.h> 28 */
29#include <linux/init.h> 29#include <linux/init.h>
30#include <linux/module.h> 30#include <linux/module.h>
31#include <linux/pci.h> 31#include <linux/pci.h>
@@ -34,30 +34,25 @@
34 34
35#include <asm/iSeries/HvCallPci.h> 35#include <asm/iSeries/HvCallPci.h>
36#include <asm/iSeries/HvTypes.h> 36#include <asm/iSeries/HvTypes.h>
37#include <asm/iSeries/mf.h>
38#include <asm/iSeries/LparData.h>
39#include <asm/iSeries/iSeries_pci.h> 37#include <asm/iSeries/iSeries_pci.h>
40#include "pci.h"
41 38
42/* 39/*
43 * Size of Bus VPD data 40 * Size of Bus VPD data
44 */ 41 */
45#define BUS_VPDSIZE 1024 42#define BUS_VPDSIZE 1024
43
46/* 44/*
47 * Bus Vpd Tags 45 * Bus Vpd Tags
48 */ 46 */
49#define VpdEndOfDataTag 0x78
50#define VpdEndOfAreaTag 0x79 47#define VpdEndOfAreaTag 0x79
51#define VpdIdStringTag 0x82 48#define VpdIdStringTag 0x82
52#define VpdVendorAreaTag 0x84 49#define VpdVendorAreaTag 0x84
50
53/* 51/*
54 * Mfg Area Tags 52 * Mfg Area Tags
55 */ 53 */
56#define VpdFruFlag 0x4647 // "FG"
57#define VpdFruFrameId 0x4649 // "FI" 54#define VpdFruFrameId 0x4649 // "FI"
58#define VpdSlotMapFormat 0x4D46 // "MF" 55#define VpdSlotMapFormat 0x4D46 // "MF"
59#define VpdAsmPartNumber 0x504E // "PN"
60#define VpdFruSerial 0x534E // "SN"
61#define VpdSlotMap 0x534D // "SM" 56#define VpdSlotMap 0x534D // "SM"
62 57
63/* 58/*
@@ -79,74 +74,33 @@ struct SlotMapStruct {
79 char CardLocation[3]; 74 char CardLocation[3];
80 char Parms[8]; 75 char Parms[8];
81 char Reserved[2]; 76 char Reserved[2];
82}; 77};
83typedef struct SlotMapStruct SlotMap; 78typedef struct SlotMapStruct SlotMap;
84#define SLOT_ENTRY_SIZE 16 79#define SLOT_ENTRY_SIZE 16
85 80
86/* 81/*
87 * Formats the device information.
88 * - Pass in pci_dev* pointer to the device.
89 * - Pass in buffer to place the data. Danger here is the buffer must
90 * be as big as the client says it is. Should be at least 128 bytes.
91 * Return will the length of the string data put in the buffer.
92 * Format:
93 * PCI: Bus 0, Device 26, Vendor 0x12AE Frame 1, Card C10 Ethernet
94 * controller
95 */
96int iSeries_Device_Information(struct pci_dev *PciDev, char *buffer,
97 int BufferSize)
98{
99 struct iSeries_Device_Node *DevNode =
100 (struct iSeries_Device_Node *)PciDev->sysdata;
101 int len;
102
103 if (DevNode == NULL)
104 return sprintf(buffer,
105 "PCI: iSeries_Device_Information DevNode is NULL");
106
107 if (BufferSize < 128)
108 return 0;
109
110 len = sprintf(buffer, "PCI: Bus%3d, Device%3d, Vendor %04X ",
111 ISERIES_BUS(DevNode), PCI_SLOT(PciDev->devfn),
112 PciDev->vendor);
113 len += sprintf(buffer + len, "Frame%3d, Card %4s ",
114 DevNode->FrameId, DevNode->CardLocation);
115#ifdef CONFIG_PCI
116 if (pci_class_name(PciDev->class >> 8) == 0)
117 len += sprintf(buffer + len, "0x%04X ",
118 (int)(PciDev->class >> 8));
119 else
120 len += sprintf(buffer + len, "%s",
121 pci_class_name(PciDev->class >> 8));
122#endif
123 return len;
124}
125
126/*
127 * Parse the Slot Area 82 * Parse the Slot Area
128 */ 83 */
129void iSeries_Parse_SlotArea(SlotMap *MapPtr, int MapLen, 84static void __init iSeries_Parse_SlotArea(SlotMap *MapPtr, int MapLen,
130 struct iSeries_Device_Node *DevNode) 85 HvAgentId agent, u8 *PhbId, char card[4])
131{ 86{
132 int SlotMapLen = MapLen; 87 int SlotMapLen = MapLen;
133 SlotMap *SlotMapPtr = MapPtr; 88 SlotMap *SlotMapPtr = MapPtr;
134 89
135 /* 90 /*
136 * Parse Slot label until we find the one requrested 91 * Parse Slot label until we find the one requested
137 */ 92 */
138 while (SlotMapLen > 0) { 93 while (SlotMapLen > 0) {
139 if (SlotMapPtr->AgentId == DevNode->AgentId ) { 94 if (SlotMapPtr->AgentId == agent) {
140 /* 95 /*
141 * If Phb wasn't found, grab the entry first one found. 96 * If Phb wasn't found, grab the entry first one found.
142 */ 97 */
143 if (DevNode->PhbId == 0xff) 98 if (*PhbId == 0xff)
144 DevNode->PhbId = SlotMapPtr->PhbId; 99 *PhbId = SlotMapPtr->PhbId;
145 /* Found it, extract the data. */ 100 /* Found it, extract the data. */
146 if (SlotMapPtr->PhbId == DevNode->PhbId ) { 101 if (SlotMapPtr->PhbId == *PhbId) {
147 memcpy(&DevNode->CardLocation, 102 memcpy(card, &SlotMapPtr->CardLocation, 3);
148 &SlotMapPtr->CardLocation, 3); 103 card[3] = 0;
149 DevNode->CardLocation[3] = 0;
150 break; 104 break;
151 } 105 }
152 } 106 }
@@ -159,8 +113,9 @@ void iSeries_Parse_SlotArea(SlotMap *MapPtr, int MapLen,
159/* 113/*
160 * Parse the Mfg Area 114 * Parse the Mfg Area
161 */ 115 */
162static void iSeries_Parse_MfgArea(u8 *AreaData, int AreaLen, 116static void __init iSeries_Parse_MfgArea(u8 *AreaData, int AreaLen,
163 struct iSeries_Device_Node *DevNode) 117 HvAgentId agent, u8 *PhbId,
118 u8 *frame, char card[4])
164{ 119{
165 MfgArea *MfgAreaPtr = (MfgArea *)AreaData; 120 MfgArea *MfgAreaPtr = (MfgArea *)AreaData;
166 int MfgAreaLen = AreaLen; 121 int MfgAreaLen = AreaLen;
@@ -171,7 +126,7 @@ static void iSeries_Parse_MfgArea(u8 *AreaData, int AreaLen,
171 int MfgTagLen = MfgAreaPtr->TagLength; 126 int MfgTagLen = MfgAreaPtr->TagLength;
172 /* Frame ID (FI 4649020310 ) */ 127 /* Frame ID (FI 4649020310 ) */
173 if (MfgAreaPtr->Tag == VpdFruFrameId) /* FI */ 128 if (MfgAreaPtr->Tag == VpdFruFrameId) /* FI */
174 DevNode->FrameId = MfgAreaPtr->AreaData1; 129 *frame = MfgAreaPtr->AreaData1;
175 /* Slot Map Format (MF 4D46020004 ) */ 130 /* Slot Map Format (MF 4D46020004 ) */
176 else if (MfgAreaPtr->Tag == VpdSlotMapFormat) /* MF */ 131 else if (MfgAreaPtr->Tag == VpdSlotMapFormat) /* MF */
177 SlotMapFmt = (MfgAreaPtr->AreaData1 * 256) 132 SlotMapFmt = (MfgAreaPtr->AreaData1 * 256)
@@ -183,10 +138,11 @@ static void iSeries_Parse_MfgArea(u8 *AreaData, int AreaLen,
183 if (SlotMapFmt == 0x1004) 138 if (SlotMapFmt == 0x1004)
184 SlotMapPtr = (SlotMap *)((char *)MfgAreaPtr 139 SlotMapPtr = (SlotMap *)((char *)MfgAreaPtr
185 + MFG_ENTRY_SIZE + 1); 140 + MFG_ENTRY_SIZE + 1);
186 else 141 else
187 SlotMapPtr = (SlotMap *)((char *)MfgAreaPtr 142 SlotMapPtr = (SlotMap *)((char *)MfgAreaPtr
188 + MFG_ENTRY_SIZE); 143 + MFG_ENTRY_SIZE);
189 iSeries_Parse_SlotArea(SlotMapPtr, MfgTagLen, DevNode); 144 iSeries_Parse_SlotArea(SlotMapPtr, MfgTagLen,
145 agent, PhbId, card);
190 } 146 }
191 /* 147 /*
192 * Point to the next Mfg Area 148 * Point to the next Mfg Area
@@ -194,19 +150,19 @@ static void iSeries_Parse_MfgArea(u8 *AreaData, int AreaLen,
194 */ 150 */
195 MfgAreaPtr = (MfgArea *)((char *)MfgAreaPtr + MfgTagLen 151 MfgAreaPtr = (MfgArea *)((char *)MfgAreaPtr + MfgTagLen
196 + MFG_ENTRY_SIZE); 152 + MFG_ENTRY_SIZE);
197 MfgAreaLen -= (MfgTagLen + MFG_ENTRY_SIZE); 153 MfgAreaLen -= (MfgTagLen + MFG_ENTRY_SIZE);
198 } 154 }
199} 155}
200 156
201/* 157/*
202 * Look for "BUS".. Data is not Null terminated. 158 * Look for "BUS".. Data is not Null terminated.
203 * PHBID of 0xFF indicates PHB was not found in VPD Data. 159 * PHBID of 0xFF indicates PHB was not found in VPD Data.
204 */ 160 */
205static int iSeries_Parse_PhbId(u8 *AreaPtr, int AreaLength) 161static int __init iSeries_Parse_PhbId(u8 *AreaPtr, int AreaLength)
206{ 162{
207 u8 *PhbPtr = AreaPtr; 163 u8 *PhbPtr = AreaPtr;
208 int DataLen = AreaLength; 164 int DataLen = AreaLength;
209 char PhbId = 0xFF; 165 char PhbId = 0xFF;
210 166
211 while (DataLen > 0) { 167 while (DataLen > 0) {
212 if ((*PhbPtr == 'B') && (*(PhbPtr + 1) == 'U') 168 if ((*PhbPtr == 'B') && (*(PhbPtr + 1) == 'U')
@@ -216,7 +172,7 @@ static int iSeries_Parse_PhbId(u8 *AreaPtr, int AreaLength)
216 ++PhbPtr; 172 ++PhbPtr;
217 PhbId = (*PhbPtr & 0x0F); 173 PhbId = (*PhbPtr & 0x0F);
218 break; 174 break;
219 } 175 }
220 ++PhbPtr; 176 ++PhbPtr;
221 --DataLen; 177 --DataLen;
222 } 178 }
@@ -226,52 +182,90 @@ static int iSeries_Parse_PhbId(u8 *AreaPtr, int AreaLength)
226/* 182/*
227 * Parse out the VPD Areas 183 * Parse out the VPD Areas
228 */ 184 */
229static void iSeries_Parse_Vpd(u8 *VpdData, int VpdDataLen, 185static void __init iSeries_Parse_Vpd(u8 *VpdData, int VpdDataLen,
230 struct iSeries_Device_Node *DevNode) 186 HvAgentId agent, u8 *frame, char card[4])
231{ 187{
232 u8 *TagPtr = VpdData; 188 u8 *TagPtr = VpdData;
233 int DataLen = VpdDataLen - 3; 189 int DataLen = VpdDataLen - 3;
190 u8 PhbId;
234 191
235 while ((*TagPtr != VpdEndOfAreaTag) && (DataLen > 0)) { 192 while ((*TagPtr != VpdEndOfAreaTag) && (DataLen > 0)) {
236 int AreaLen = *(TagPtr + 1) + (*(TagPtr + 2) * 256); 193 int AreaLen = *(TagPtr + 1) + (*(TagPtr + 2) * 256);
237 u8 *AreaData = TagPtr + 3; 194 u8 *AreaData = TagPtr + 3;
238 195
239 if (*TagPtr == VpdIdStringTag) 196 if (*TagPtr == VpdIdStringTag)
240 DevNode->PhbId = iSeries_Parse_PhbId(AreaData, AreaLen); 197 PhbId = iSeries_Parse_PhbId(AreaData, AreaLen);
241 else if (*TagPtr == VpdVendorAreaTag) 198 else if (*TagPtr == VpdVendorAreaTag)
242 iSeries_Parse_MfgArea(AreaData, AreaLen, DevNode); 199 iSeries_Parse_MfgArea(AreaData, AreaLen,
200 agent, &PhbId, frame, card);
243 /* Point to next Area. */ 201 /* Point to next Area. */
244 TagPtr = AreaData + AreaLen; 202 TagPtr = AreaData + AreaLen;
245 DataLen -= AreaLen; 203 DataLen -= AreaLen;
246 } 204 }
247} 205}
248 206
249void iSeries_Get_Location_Code(struct iSeries_Device_Node *DevNode) 207static void __init iSeries_Get_Location_Code(u16 bus, HvAgentId agent,
208 u8 *frame, char card[4])
250{ 209{
251 int BusVpdLen = 0; 210 int BusVpdLen = 0;
252 u8 *BusVpdPtr = (u8 *)kmalloc(BUS_VPDSIZE, GFP_KERNEL); 211 u8 *BusVpdPtr = kmalloc(BUS_VPDSIZE, GFP_KERNEL);
253 212
254 if (BusVpdPtr == NULL) { 213 if (BusVpdPtr == NULL) {
255 printk("PCI: Bus VPD Buffer allocation failure.\n"); 214 printk("PCI: Bus VPD Buffer allocation failure.\n");
256 return; 215 return;
257 } 216 }
258 BusVpdLen = HvCallPci_getBusVpd(ISERIES_BUS(DevNode), 217 BusVpdLen = HvCallPci_getBusVpd(bus, ISERIES_HV_ADDR(BusVpdPtr),
259 ISERIES_HV_ADDR(BusVpdPtr),
260 BUS_VPDSIZE); 218 BUS_VPDSIZE);
261 if (BusVpdLen == 0) { 219 if (BusVpdLen == 0) {
262 kfree(BusVpdPtr);
263 printk("PCI: Bus VPD Buffer zero length.\n"); 220 printk("PCI: Bus VPD Buffer zero length.\n");
264 return; 221 goto out_free;
265 } 222 }
266 /* printk("PCI: BusVpdPtr: %p, %d\n",BusVpdPtr, BusVpdLen); */ 223 /* printk("PCI: BusVpdPtr: %p, %d\n",BusVpdPtr, BusVpdLen); */
267 /* Make sure this is what I think it is */ 224 /* Make sure this is what I think it is */
268 if (*BusVpdPtr != VpdIdStringTag) { /* 0x82 */ 225 if (*BusVpdPtr != VpdIdStringTag) { /* 0x82 */
269 printk("PCI: Bus VPD Buffer missing starting tag.\n"); 226 printk("PCI: Bus VPD Buffer missing starting tag.\n");
270 kfree(BusVpdPtr); 227 goto out_free;
271 return;
272 } 228 }
273 iSeries_Parse_Vpd(BusVpdPtr,BusVpdLen, DevNode); 229 iSeries_Parse_Vpd(BusVpdPtr, BusVpdLen, agent, frame, card);
274 sprintf(DevNode->Location, "Frame%3d, Card %-4s", DevNode->FrameId, 230out_free:
275 DevNode->CardLocation);
276 kfree(BusVpdPtr); 231 kfree(BusVpdPtr);
277} 232}
233
234/*
235 * Prints the device information.
236 * - Pass in pci_dev* pointer to the device.
237 * - Pass in the device count
238 *
239 * Format:
240 * PCI: Bus 0, Device 26, Vendor 0x12AE Frame 1, Card C10 Ethernet
241 * controller
242 */
243void __init iSeries_Device_Information(struct pci_dev *PciDev, int count)
244{
245 struct iSeries_Device_Node *DevNode = PciDev->sysdata;
246 u16 bus;
247 u8 frame;
248 char card[4];
249 HvSubBusNumber subbus;
250 HvAgentId agent;
251
252 if (DevNode == NULL) {
253 printk("%d. PCI: iSeries_Device_Information DevNode is NULL\n",
254 count);
255 return;
256 }
257
258 bus = ISERIES_BUS(DevNode);
259 subbus = ISERIES_SUBBUS(DevNode);
260 agent = ISERIES_PCI_AGENTID(ISERIES_GET_DEVICE_FROM_SUBBUS(subbus),
261 ISERIES_GET_FUNCTION_FROM_SUBBUS(subbus));
262 iSeries_Get_Location_Code(bus, agent, &frame, card);
263
264 printk("%d. PCI: Bus%3d, Device%3d, Vendor %04X Frame%3d, Card %4s ",
265 count, bus, PCI_SLOT(PciDev->devfn), PciDev->vendor,
266 frame, card);
267 if (pci_class_name(PciDev->class >> 8) == 0)
268 printk("0x%04X\n", (int)(PciDev->class >> 8));
269 else
270 printk("%s\n", pci_class_name(PciDev->class >> 8));
271}
diff --git a/arch/ppc64/kernel/iSeries_iommu.c b/arch/ppc64/kernel/iSeries_iommu.c
index 4e1a47c8a802..f8ff1bb054dc 100644
--- a/arch/ppc64/kernel/iSeries_iommu.c
+++ b/arch/ppc64/kernel/iSeries_iommu.c
@@ -83,7 +83,7 @@ static void tce_free_iSeries(struct iommu_table *tbl, long index, long npages)
83 } 83 }
84} 84}
85 85
86 86#ifdef CONFIG_PCI
87/* 87/*
88 * This function compares the known tables to find an iommu_table 88 * This function compares the known tables to find an iommu_table
89 * that has already been built for hardware TCEs. 89 * that has already been built for hardware TCEs.
@@ -159,6 +159,7 @@ void iommu_devnode_init_iSeries(struct iSeries_Device_Node *dn)
159 else 159 else
160 kfree(tbl); 160 kfree(tbl);
161} 161}
162#endif
162 163
163static void iommu_dev_setup_iSeries(struct pci_dev *dev) { } 164static void iommu_dev_setup_iSeries(struct pci_dev *dev) { }
164static void iommu_bus_setup_iSeries(struct pci_bus *bus) { } 165static void iommu_bus_setup_iSeries(struct pci_bus *bus) { }
diff --git a/arch/ppc64/kernel/iSeries_irq.c b/arch/ppc64/kernel/iSeries_irq.c
index f831d259dbb7..77376c1bd611 100644
--- a/arch/ppc64/kernel/iSeries_irq.c
+++ b/arch/ppc64/kernel/iSeries_irq.c
@@ -1,27 +1,29 @@
1/************************************************************************/ 1/*
2/* This module supports the iSeries PCI bus interrupt handling */ 2 * This module supports the iSeries PCI bus interrupt handling
3/* Copyright (C) 20yy <Robert L Holtorf> <IBM Corp> */ 3 * Copyright (C) 20yy <Robert L Holtorf> <IBM Corp>
4/* */ 4 * Copyright (C) 2004-2005 IBM Corporation
5/* This program is free software; you can redistribute it and/or modify */ 5 *
6/* it under the terms of the GNU General Public License as published by */ 6 * This program is free software; you can redistribute it and/or modify
7/* the Free Software Foundation; either version 2 of the License, or */ 7 * it under the terms of the GNU General Public License as published by
8/* (at your option) any later version. */ 8 * the Free Software Foundation; either version 2 of the License, or
9/* */ 9 * (at your option) any later version.
10/* This program is distributed in the hope that it will be useful, */ 10 *
11/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ 11 * This program is distributed in the hope that it will be useful,
12/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13/* GNU General Public License for more details. */ 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14/* */ 14 * GNU General Public License for more details.
15/* You should have received a copy of the GNU General Public License */ 15 *
16/* along with this program; if not, write to the: */ 16 * You should have received a copy of the GNU General Public License
17/* Free Software Foundation, Inc., */ 17 * along with this program; if not, write to the:
18/* 59 Temple Place, Suite 330, */ 18 * Free Software Foundation, Inc.,
19/* Boston, MA 02111-1307 USA */ 19 * 59 Temple Place, Suite 330,
20/************************************************************************/ 20 * Boston, MA 02111-1307 USA
21/* Change Activity: */ 21 *
22/* Created, December 13, 2000 by Wayne Holm */ 22 * Change Activity:
23/* End Change Activity */ 23 * Created, December 13, 2000 by Wayne Holm
24/************************************************************************/ 24 * End Change Activity
25 */
26#include <linux/config.h>
25#include <linux/pci.h> 27#include <linux/pci.h>
26#include <linux/init.h> 28#include <linux/init.h>
27#include <linux/threads.h> 29#include <linux/threads.h>
@@ -30,30 +32,15 @@
30#include <linux/string.h> 32#include <linux/string.h>
31#include <linux/bootmem.h> 33#include <linux/bootmem.h>
32#include <linux/ide.h> 34#include <linux/ide.h>
33
34#include <linux/irq.h> 35#include <linux/irq.h>
35#include <linux/spinlock.h> 36#include <linux/spinlock.h>
36#include <asm/ppcdebug.h>
37 37
38#include <asm/ppcdebug.h>
39#include <asm/iSeries/HvTypes.h>
40#include <asm/iSeries/HvLpEvent.h>
38#include <asm/iSeries/HvCallPci.h> 41#include <asm/iSeries/HvCallPci.h>
39#include <asm/iSeries/HvCallXm.h> 42#include <asm/iSeries/HvCallXm.h>
40#include <asm/iSeries/iSeries_irq.h> 43#include <asm/iSeries/iSeries_irq.h>
41#include <asm/iSeries/XmPciLpEvent.h>
42
43static unsigned int iSeries_startup_IRQ(unsigned int irq);
44static void iSeries_shutdown_IRQ(unsigned int irq);
45static void iSeries_enable_IRQ(unsigned int irq);
46static void iSeries_disable_IRQ(unsigned int irq);
47static void iSeries_end_IRQ(unsigned int irq);
48
49static hw_irq_controller iSeries_IRQ_handler = {
50 .typename = "iSeries irq controller",
51 .startup = iSeries_startup_IRQ,
52 .shutdown = iSeries_shutdown_IRQ,
53 .enable = iSeries_enable_IRQ,
54 .disable = iSeries_disable_IRQ,
55 .end = iSeries_end_IRQ
56};
57 44
58/* This maps virtual irq numbers to real irqs */ 45/* This maps virtual irq numbers to real irqs */
59unsigned int virt_irq_to_real_map[NR_IRQS]; 46unsigned int virt_irq_to_real_map[NR_IRQS];
@@ -62,37 +49,187 @@ unsigned int virt_irq_to_real_map[NR_IRQS];
62/* Note: the pcnet32 driver assumes irq numbers < 2 aren't valid. :( */ 49/* Note: the pcnet32 driver assumes irq numbers < 2 aren't valid. :( */
63static int next_virtual_irq = 2; 50static int next_virtual_irq = 2;
64 51
65/* This is called by init_IRQ. set in ppc_md.init_IRQ by iSeries_setup.c */ 52static long Pci_Interrupt_Count;
66void __init iSeries_init_IRQ(void) 53static long Pci_Event_Count;
54
55enum XmPciLpEvent_Subtype {
56 XmPciLpEvent_BusCreated = 0, // PHB has been created
57 XmPciLpEvent_BusError = 1, // PHB has failed
58 XmPciLpEvent_BusFailed = 2, // Msg to Secondary, Primary failed bus
59 XmPciLpEvent_NodeFailed = 4, // Multi-adapter bridge has failed
60 XmPciLpEvent_NodeRecovered = 5, // Multi-adapter bridge has recovered
61 XmPciLpEvent_BusRecovered = 12, // PHB has been recovered
62 XmPciLpEvent_UnQuiesceBus = 18, // Secondary bus unqiescing
63 XmPciLpEvent_BridgeError = 21, // Bridge Error
64 XmPciLpEvent_SlotInterrupt = 22 // Slot interrupt
65};
66
67struct XmPciLpEvent_BusInterrupt {
68 HvBusNumber busNumber;
69 HvSubBusNumber subBusNumber;
70};
71
72struct XmPciLpEvent_NodeInterrupt {
73 HvBusNumber busNumber;
74 HvSubBusNumber subBusNumber;
75 HvAgentId deviceId;
76};
77
78struct XmPciLpEvent {
79 struct HvLpEvent hvLpEvent;
80
81 union {
82 u64 alignData; // Align on an 8-byte boundary
83
84 struct {
85 u32 fisr;
86 HvBusNumber busNumber;
87 HvSubBusNumber subBusNumber;
88 HvAgentId deviceId;
89 } slotInterrupt;
90
91 struct XmPciLpEvent_BusInterrupt busFailed;
92 struct XmPciLpEvent_BusInterrupt busRecovered;
93 struct XmPciLpEvent_BusInterrupt busCreated;
94
95 struct XmPciLpEvent_NodeInterrupt nodeFailed;
96 struct XmPciLpEvent_NodeInterrupt nodeRecovered;
97
98 } eventData;
99
100};
101
102static void intReceived(struct XmPciLpEvent *eventParm,
103 struct pt_regs *regsParm)
67{ 104{
68 /* Register PCI event handler and open an event path */ 105 int irq;
69 XmPciLpEvent_init(); 106
107 ++Pci_Interrupt_Count;
108
109 switch (eventParm->hvLpEvent.xSubtype) {
110 case XmPciLpEvent_SlotInterrupt:
111 irq = eventParm->hvLpEvent.xCorrelationToken;
112 /* Dispatch the interrupt handlers for this irq */
113 ppc_irq_dispatch_handler(regsParm, irq);
114 HvCallPci_eoi(eventParm->eventData.slotInterrupt.busNumber,
115 eventParm->eventData.slotInterrupt.subBusNumber,
116 eventParm->eventData.slotInterrupt.deviceId);
117 break;
118 /* Ignore error recovery events for now */
119 case XmPciLpEvent_BusCreated:
120 printk(KERN_INFO "intReceived: system bus %d created\n",
121 eventParm->eventData.busCreated.busNumber);
122 break;
123 case XmPciLpEvent_BusError:
124 case XmPciLpEvent_BusFailed:
125 printk(KERN_INFO "intReceived: system bus %d failed\n",
126 eventParm->eventData.busFailed.busNumber);
127 break;
128 case XmPciLpEvent_BusRecovered:
129 case XmPciLpEvent_UnQuiesceBus:
130 printk(KERN_INFO "intReceived: system bus %d recovered\n",
131 eventParm->eventData.busRecovered.busNumber);
132 break;
133 case XmPciLpEvent_NodeFailed:
134 case XmPciLpEvent_BridgeError:
135 printk(KERN_INFO
136 "intReceived: multi-adapter bridge %d/%d/%d failed\n",
137 eventParm->eventData.nodeFailed.busNumber,
138 eventParm->eventData.nodeFailed.subBusNumber,
139 eventParm->eventData.nodeFailed.deviceId);
140 break;
141 case XmPciLpEvent_NodeRecovered:
142 printk(KERN_INFO
143 "intReceived: multi-adapter bridge %d/%d/%d recovered\n",
144 eventParm->eventData.nodeRecovered.busNumber,
145 eventParm->eventData.nodeRecovered.subBusNumber,
146 eventParm->eventData.nodeRecovered.deviceId);
147 break;
148 default:
149 printk(KERN_ERR
150 "intReceived: unrecognized event subtype 0x%x\n",
151 eventParm->hvLpEvent.xSubtype);
152 break;
153 }
154}
155
156static void XmPciLpEvent_handler(struct HvLpEvent *eventParm,
157 struct pt_regs *regsParm)
158{
159#ifdef CONFIG_PCI
160 ++Pci_Event_Count;
161
162 if (eventParm && (eventParm->xType == HvLpEvent_Type_PciIo)) {
163 switch (eventParm->xFlags.xFunction) {
164 case HvLpEvent_Function_Int:
165 intReceived((struct XmPciLpEvent *)eventParm, regsParm);
166 break;
167 case HvLpEvent_Function_Ack:
168 printk(KERN_ERR
169 "XmPciLpEvent_handler: unexpected ack received\n");
170 break;
171 default:
172 printk(KERN_ERR
173 "XmPciLpEvent_handler: unexpected event function %d\n",
174 (int)eventParm->xFlags.xFunction);
175 break;
176 }
177 } else if (eventParm)
178 printk(KERN_ERR
179 "XmPciLpEvent_handler: Unrecognized PCI event type 0x%x\n",
180 (int)eventParm->xType);
181 else
182 printk(KERN_ERR "XmPciLpEvent_handler: NULL event received\n");
183#endif
70} 184}
71 185
72/* 186/*
73 * This is called out of iSeries_scan_slot to allocate an IRQ for an EADS slot 187 * This is called by init_IRQ. set in ppc_md.init_IRQ by iSeries_setup.c
74 * It calculates the irq value for the slot. 188 * It must be called before the bus walk.
75 * Note that subBusNumber is always 0 (at the moment at least).
76 */ 189 */
77int __init iSeries_allocate_IRQ(HvBusNumber busNumber, 190void __init iSeries_init_IRQ(void)
78 HvSubBusNumber subBusNumber, HvAgentId deviceId)
79{ 191{
80 unsigned int realirq, virtirq; 192 /* Register PCI event handler and open an event path */
81 u8 idsel = (deviceId >> 4); 193 int xRc;
82 u8 function = deviceId & 7;
83
84 virtirq = next_virtual_irq++;
85 realirq = ((busNumber - 1) << 6) + ((idsel - 1) << 3) + function;
86 virt_irq_to_real_map[virtirq] = realirq;
87 194
88 irq_desc[virtirq].handler = &iSeries_IRQ_handler; 195 xRc = HvLpEvent_registerHandler(HvLpEvent_Type_PciIo,
89 return virtirq; 196 &XmPciLpEvent_handler);
197 if (xRc == 0) {
198 xRc = HvLpEvent_openPath(HvLpEvent_Type_PciIo, 0);
199 if (xRc != 0)
200 printk(KERN_ERR "iSeries_init_IRQ: open event path "
201 "failed with rc 0x%x\n", xRc);
202 } else
203 printk(KERN_ERR "iSeries_init_IRQ: register handler "
204 "failed with rc 0x%x\n", xRc);
90} 205}
91 206
92#define REAL_IRQ_TO_BUS(irq) ((((irq) >> 6) & 0xff) + 1) 207#define REAL_IRQ_TO_BUS(irq) ((((irq) >> 6) & 0xff) + 1)
93#define REAL_IRQ_TO_IDSEL(irq) ((((irq) >> 3) & 7) + 1) 208#define REAL_IRQ_TO_IDSEL(irq) ((((irq) >> 3) & 7) + 1)
94#define REAL_IRQ_TO_FUNC(irq) ((irq) & 7) 209#define REAL_IRQ_TO_FUNC(irq) ((irq) & 7)
95 210
211/*
212 * This will be called by device drivers (via enable_IRQ)
213 * to enable INTA in the bridge interrupt status register.
214 */
215static void iSeries_enable_IRQ(unsigned int irq)
216{
217 u32 bus, deviceId, function, mask;
218 const u32 subBus = 0;
219 unsigned int rirq = virt_irq_to_real_map[irq];
220
221 /* The IRQ has already been locked by the caller */
222 bus = REAL_IRQ_TO_BUS(rirq);
223 function = REAL_IRQ_TO_FUNC(rirq);
224 deviceId = (REAL_IRQ_TO_IDSEL(rirq) << 4) + function;
225
226 /* Unmask secondary INTA */
227 mask = 0x80000000;
228 HvCallPci_unmaskInterrupts(bus, subBus, deviceId, mask);
229 PPCDBG(PPCDBG_BUSWALK, "iSeries_enable_IRQ 0x%02X.%02X.%02X 0x%04X\n",
230 bus, subBus, deviceId, irq);
231}
232
96/* This is called by iSeries_activate_IRQs */ 233/* This is called by iSeries_activate_IRQs */
97static unsigned int iSeries_startup_IRQ(unsigned int irq) 234static unsigned int iSeries_startup_IRQ(unsigned int irq)
98{ 235{
@@ -131,7 +268,7 @@ void __init iSeries_activate_IRQs()
131 desc->handler->startup(irq); 268 desc->handler->startup(irq);
132 spin_unlock_irqrestore(&desc->lock, flags); 269 spin_unlock_irqrestore(&desc->lock, flags);
133 } 270 }
134 } 271 }
135} 272}
136 273
137/* this is not called anywhere currently */ 274/* this is not called anywhere currently */
@@ -173,29 +310,7 @@ static void iSeries_disable_IRQ(unsigned int irq)
173 mask = 0x80000000; 310 mask = 0x80000000;
174 HvCallPci_maskInterrupts(bus, subBus, deviceId, mask); 311 HvCallPci_maskInterrupts(bus, subBus, deviceId, mask);
175 PPCDBG(PPCDBG_BUSWALK, "iSeries_disable_IRQ 0x%02X.%02X.%02X 0x%04X\n", 312 PPCDBG(PPCDBG_BUSWALK, "iSeries_disable_IRQ 0x%02X.%02X.%02X 0x%04X\n",
176 bus, subBus, deviceId, irq); 313 bus, subBus, deviceId, irq);
177}
178
179/*
180 * This will be called by device drivers (via enable_IRQ)
181 * to enable INTA in the bridge interrupt status register.
182 */
183static void iSeries_enable_IRQ(unsigned int irq)
184{
185 u32 bus, deviceId, function, mask;
186 const u32 subBus = 0;
187 unsigned int rirq = virt_irq_to_real_map[irq];
188
189 /* The IRQ has already been locked by the caller */
190 bus = REAL_IRQ_TO_BUS(rirq);
191 function = REAL_IRQ_TO_FUNC(rirq);
192 deviceId = (REAL_IRQ_TO_IDSEL(rirq) << 4) + function;
193
194 /* Unmask secondary INTA */
195 mask = 0x80000000;
196 HvCallPci_unmaskInterrupts(bus, subBus, deviceId, mask);
197 PPCDBG(PPCDBG_BUSWALK, "iSeries_enable_IRQ 0x%02X.%02X.%02X 0x%04X\n",
198 bus, subBus, deviceId, irq);
199} 314}
200 315
201/* 316/*
@@ -207,3 +322,32 @@ static void iSeries_enable_IRQ(unsigned int irq)
207static void iSeries_end_IRQ(unsigned int irq) 322static void iSeries_end_IRQ(unsigned int irq)
208{ 323{
209} 324}
325
326static hw_irq_controller iSeries_IRQ_handler = {
327 .typename = "iSeries irq controller",
328 .startup = iSeries_startup_IRQ,
329 .shutdown = iSeries_shutdown_IRQ,
330 .enable = iSeries_enable_IRQ,
331 .disable = iSeries_disable_IRQ,
332 .end = iSeries_end_IRQ
333};
334
335/*
336 * This is called out of iSeries_scan_slot to allocate an IRQ for an EADS slot
337 * It calculates the irq value for the slot.
338 * Note that subBusNumber is always 0 (at the moment at least).
339 */
340int __init iSeries_allocate_IRQ(HvBusNumber busNumber,
341 HvSubBusNumber subBusNumber, HvAgentId deviceId)
342{
343 unsigned int realirq, virtirq;
344 u8 idsel = (deviceId >> 4);
345 u8 function = deviceId & 7;
346
347 virtirq = next_virtual_irq++;
348 realirq = ((busNumber - 1) << 6) + ((idsel - 1) << 3) + function;
349 virt_irq_to_real_map[virtirq] = realirq;
350
351 irq_desc[virtirq].handler = &iSeries_IRQ_handler;
352 return virtirq;
353}
diff --git a/arch/ppc64/kernel/iSeries_pci.c b/arch/ppc64/kernel/iSeries_pci.c
index bd4c2554f1a0..356e4fd9a94f 100644
--- a/arch/ppc64/kernel/iSeries_pci.c
+++ b/arch/ppc64/kernel/iSeries_pci.c
@@ -38,9 +38,7 @@
38#include <asm/iommu.h> 38#include <asm/iommu.h>
39 39
40#include <asm/iSeries/HvCallPci.h> 40#include <asm/iSeries/HvCallPci.h>
41#include <asm/iSeries/HvCallSm.h>
42#include <asm/iSeries/HvCallXm.h> 41#include <asm/iSeries/HvCallXm.h>
43#include <asm/iSeries/LparData.h>
44#include <asm/iSeries/iSeries_irq.h> 42#include <asm/iSeries/iSeries_irq.h>
45#include <asm/iSeries/iSeries_pci.h> 43#include <asm/iSeries/iSeries_pci.h>
46#include <asm/iSeries/mf.h> 44#include <asm/iSeries/mf.h>
@@ -225,10 +223,7 @@ static struct iSeries_Device_Node *build_device_node(HvBusNumber Bus,
225 node->DsaAddr.Dsa.busNumber = Bus; 223 node->DsaAddr.Dsa.busNumber = Bus;
226 node->DsaAddr.Dsa.subBusNumber = SubBus; 224 node->DsaAddr.Dsa.subBusNumber = SubBus;
227 node->DsaAddr.Dsa.deviceId = 0x10; 225 node->DsaAddr.Dsa.deviceId = 0x10;
228 node->AgentId = AgentId;
229 node->DevFn = PCI_DEVFN(ISERIES_ENCODE_DEVICE(AgentId), Function); 226 node->DevFn = PCI_DEVFN(ISERIES_ENCODE_DEVICE(AgentId), Function);
230 node->IoRetry = 0;
231 iSeries_Get_Location_Code(node);
232 return node; 227 return node;
233} 228}
234 229
@@ -302,7 +297,6 @@ void __init iSeries_pci_final_fixup(void)
302{ 297{
303 struct pci_dev *pdev = NULL; 298 struct pci_dev *pdev = NULL;
304 struct iSeries_Device_Node *node; 299 struct iSeries_Device_Node *node;
305 char Buffer[256];
306 int DeviceCount = 0; 300 int DeviceCount = 0;
307 301
308 PPCDBG(PPCDBG_BUSWALK, "iSeries_pcibios_fixup Entry.\n"); 302 PPCDBG(PPCDBG_BUSWALK, "iSeries_pcibios_fixup Entry.\n");
@@ -324,9 +318,7 @@ void __init iSeries_pci_final_fixup(void)
324 "pdev 0x%p <==> DevNode 0x%p\n", 318 "pdev 0x%p <==> DevNode 0x%p\n",
325 pdev, node); 319 pdev, node);
326 allocate_device_bars(pdev); 320 allocate_device_bars(pdev);
327 iSeries_Device_Information(pdev, Buffer, 321 iSeries_Device_Information(pdev, DeviceCount);
328 sizeof(Buffer));
329 printk("%d. %s\n", DeviceCount, Buffer);
330 iommu_devnode_init_iSeries(node); 322 iommu_devnode_init_iSeries(node);
331 } else 323 } else
332 printk("PCI: Device Tree not found for 0x%016lX\n", 324 printk("PCI: Device Tree not found for 0x%016lX\n",
@@ -499,7 +491,6 @@ static int scan_bridge_slot(HvBusNumber Bus,
499 491
500 ++DeviceCount; 492 ++DeviceCount;
501 node = build_device_node(Bus, SubBus, EADsIdSel, Function); 493 node = build_device_node(Bus, SubBus, EADsIdSel, Function);
502 node->Vendor = VendorId;
503 node->Irq = Irq; 494 node->Irq = Irq;
504 node->LogicalSlot = BridgeInfo->logicalSlotNumber; 495 node->LogicalSlot = BridgeInfo->logicalSlotNumber;
505 496
@@ -661,38 +652,34 @@ static struct pci_ops iSeries_pci_ops = {
661 * Check Return Code 652 * Check Return Code
662 * -> On Failure, print and log information. 653 * -> On Failure, print and log information.
663 * Increment Retry Count, if exceeds max, panic partition. 654 * Increment Retry Count, if exceeds max, panic partition.
664 * -> If in retry, print and log success
665 * 655 *
666 * PCI: Device 23.90 ReadL I/O Error( 0): 0x1234 656 * PCI: Device 23.90 ReadL I/O Error( 0): 0x1234
667 * PCI: Device 23.90 ReadL Retry( 1) 657 * PCI: Device 23.90 ReadL Retry( 1)
668 * PCI: Device 23.90 ReadL Retry Successful(1) 658 * PCI: Device 23.90 ReadL Retry Successful(1)
669 */ 659 */
670static int CheckReturnCode(char *TextHdr, struct iSeries_Device_Node *DevNode, 660static int CheckReturnCode(char *TextHdr, struct iSeries_Device_Node *DevNode,
671 u64 ret) 661 int *retry, u64 ret)
672{ 662{
673 if (ret != 0) { 663 if (ret != 0) {
674 ++Pci_Error_Count; 664 ++Pci_Error_Count;
675 ++DevNode->IoRetry; 665 (*retry)++;
676 printk("PCI: %s: Device 0x%04X:%02X I/O Error(%2d): 0x%04X\n", 666 printk("PCI: %s: Device 0x%04X:%02X I/O Error(%2d): 0x%04X\n",
677 TextHdr, DevNode->DsaAddr.Dsa.busNumber, DevNode->DevFn, 667 TextHdr, DevNode->DsaAddr.Dsa.busNumber, DevNode->DevFn,
678 DevNode->IoRetry, (int)ret); 668 *retry, (int)ret);
679 /* 669 /*
680 * Bump the retry and check for retry count exceeded. 670 * Bump the retry and check for retry count exceeded.
681 * If, Exceeded, panic the system. 671 * If, Exceeded, panic the system.
682 */ 672 */
683 if ((DevNode->IoRetry > Pci_Retry_Max) && 673 if (((*retry) > Pci_Retry_Max) &&
684 (Pci_Error_Flag > 0)) { 674 (Pci_Error_Flag > 0)) {
685 mf_display_src(0xB6000103); 675 mf_display_src(0xB6000103);
686 panic_timeout = 0; 676 panic_timeout = 0;
687 panic("PCI: Hardware I/O Error, SRC B6000103, " 677 panic("PCI: Hardware I/O Error, SRC B6000103, "
688 "Automatic Reboot Disabled.\n"); 678 "Automatic Reboot Disabled.\n");
689 } 679 }
690 return -1; /* Retry Try */ 680 return -1; /* Retry Try */
691 } 681 }
692 /* If retry was in progress, log success and rest retry count */ 682 return 0;
693 if (DevNode->IoRetry > 0)
694 DevNode->IoRetry = 0;
695 return 0;
696} 683}
697 684
698/* 685/*
@@ -738,6 +725,7 @@ u8 iSeries_Read_Byte(const volatile void __iomem *IoAddress)
738{ 725{
739 u64 BarOffset; 726 u64 BarOffset;
740 u64 dsa; 727 u64 dsa;
728 int retry = 0;
741 struct HvCallPci_LoadReturn ret; 729 struct HvCallPci_LoadReturn ret;
742 struct iSeries_Device_Node *DevNode = 730 struct iSeries_Device_Node *DevNode =
743 xlate_iomm_address(IoAddress, &dsa, &BarOffset); 731 xlate_iomm_address(IoAddress, &dsa, &BarOffset);
@@ -757,7 +745,7 @@ u8 iSeries_Read_Byte(const volatile void __iomem *IoAddress)
757 do { 745 do {
758 ++Pci_Io_Read_Count; 746 ++Pci_Io_Read_Count;
759 HvCall3Ret16(HvCallPciBarLoad8, &ret, dsa, BarOffset, 0); 747 HvCall3Ret16(HvCallPciBarLoad8, &ret, dsa, BarOffset, 0);
760 } while (CheckReturnCode("RDB", DevNode, ret.rc) != 0); 748 } while (CheckReturnCode("RDB", DevNode, &retry, ret.rc) != 0);
761 749
762 return (u8)ret.value; 750 return (u8)ret.value;
763} 751}
@@ -767,6 +755,7 @@ u16 iSeries_Read_Word(const volatile void __iomem *IoAddress)
767{ 755{
768 u64 BarOffset; 756 u64 BarOffset;
769 u64 dsa; 757 u64 dsa;
758 int retry = 0;
770 struct HvCallPci_LoadReturn ret; 759 struct HvCallPci_LoadReturn ret;
771 struct iSeries_Device_Node *DevNode = 760 struct iSeries_Device_Node *DevNode =
772 xlate_iomm_address(IoAddress, &dsa, &BarOffset); 761 xlate_iomm_address(IoAddress, &dsa, &BarOffset);
@@ -787,7 +776,7 @@ u16 iSeries_Read_Word(const volatile void __iomem *IoAddress)
787 ++Pci_Io_Read_Count; 776 ++Pci_Io_Read_Count;
788 HvCall3Ret16(HvCallPciBarLoad16, &ret, dsa, 777 HvCall3Ret16(HvCallPciBarLoad16, &ret, dsa,
789 BarOffset, 0); 778 BarOffset, 0);
790 } while (CheckReturnCode("RDW", DevNode, ret.rc) != 0); 779 } while (CheckReturnCode("RDW", DevNode, &retry, ret.rc) != 0);
791 780
792 return swab16((u16)ret.value); 781 return swab16((u16)ret.value);
793} 782}
@@ -797,6 +786,7 @@ u32 iSeries_Read_Long(const volatile void __iomem *IoAddress)
797{ 786{
798 u64 BarOffset; 787 u64 BarOffset;
799 u64 dsa; 788 u64 dsa;
789 int retry = 0;
800 struct HvCallPci_LoadReturn ret; 790 struct HvCallPci_LoadReturn ret;
801 struct iSeries_Device_Node *DevNode = 791 struct iSeries_Device_Node *DevNode =
802 xlate_iomm_address(IoAddress, &dsa, &BarOffset); 792 xlate_iomm_address(IoAddress, &dsa, &BarOffset);
@@ -817,7 +807,7 @@ u32 iSeries_Read_Long(const volatile void __iomem *IoAddress)
817 ++Pci_Io_Read_Count; 807 ++Pci_Io_Read_Count;
818 HvCall3Ret16(HvCallPciBarLoad32, &ret, dsa, 808 HvCall3Ret16(HvCallPciBarLoad32, &ret, dsa,
819 BarOffset, 0); 809 BarOffset, 0);
820 } while (CheckReturnCode("RDL", DevNode, ret.rc) != 0); 810 } while (CheckReturnCode("RDL", DevNode, &retry, ret.rc) != 0);
821 811
822 return swab32((u32)ret.value); 812 return swab32((u32)ret.value);
823} 813}
@@ -834,6 +824,7 @@ void iSeries_Write_Byte(u8 data, volatile void __iomem *IoAddress)
834{ 824{
835 u64 BarOffset; 825 u64 BarOffset;
836 u64 dsa; 826 u64 dsa;
827 int retry = 0;
837 u64 rc; 828 u64 rc;
838 struct iSeries_Device_Node *DevNode = 829 struct iSeries_Device_Node *DevNode =
839 xlate_iomm_address(IoAddress, &dsa, &BarOffset); 830 xlate_iomm_address(IoAddress, &dsa, &BarOffset);
@@ -853,7 +844,7 @@ void iSeries_Write_Byte(u8 data, volatile void __iomem *IoAddress)
853 do { 844 do {
854 ++Pci_Io_Write_Count; 845 ++Pci_Io_Write_Count;
855 rc = HvCall4(HvCallPciBarStore8, dsa, BarOffset, data, 0); 846 rc = HvCall4(HvCallPciBarStore8, dsa, BarOffset, data, 0);
856 } while (CheckReturnCode("WWB", DevNode, rc) != 0); 847 } while (CheckReturnCode("WWB", DevNode, &retry, rc) != 0);
857} 848}
858EXPORT_SYMBOL(iSeries_Write_Byte); 849EXPORT_SYMBOL(iSeries_Write_Byte);
859 850
@@ -861,6 +852,7 @@ void iSeries_Write_Word(u16 data, volatile void __iomem *IoAddress)
861{ 852{
862 u64 BarOffset; 853 u64 BarOffset;
863 u64 dsa; 854 u64 dsa;
855 int retry = 0;
864 u64 rc; 856 u64 rc;
865 struct iSeries_Device_Node *DevNode = 857 struct iSeries_Device_Node *DevNode =
866 xlate_iomm_address(IoAddress, &dsa, &BarOffset); 858 xlate_iomm_address(IoAddress, &dsa, &BarOffset);
@@ -880,7 +872,7 @@ void iSeries_Write_Word(u16 data, volatile void __iomem *IoAddress)
880 do { 872 do {
881 ++Pci_Io_Write_Count; 873 ++Pci_Io_Write_Count;
882 rc = HvCall4(HvCallPciBarStore16, dsa, BarOffset, swab16(data), 0); 874 rc = HvCall4(HvCallPciBarStore16, dsa, BarOffset, swab16(data), 0);
883 } while (CheckReturnCode("WWW", DevNode, rc) != 0); 875 } while (CheckReturnCode("WWW", DevNode, &retry, rc) != 0);
884} 876}
885EXPORT_SYMBOL(iSeries_Write_Word); 877EXPORT_SYMBOL(iSeries_Write_Word);
886 878
@@ -888,6 +880,7 @@ void iSeries_Write_Long(u32 data, volatile void __iomem *IoAddress)
888{ 880{
889 u64 BarOffset; 881 u64 BarOffset;
890 u64 dsa; 882 u64 dsa;
883 int retry = 0;
891 u64 rc; 884 u64 rc;
892 struct iSeries_Device_Node *DevNode = 885 struct iSeries_Device_Node *DevNode =
893 xlate_iomm_address(IoAddress, &dsa, &BarOffset); 886 xlate_iomm_address(IoAddress, &dsa, &BarOffset);
@@ -907,6 +900,6 @@ void iSeries_Write_Long(u32 data, volatile void __iomem *IoAddress)
907 do { 900 do {
908 ++Pci_Io_Write_Count; 901 ++Pci_Io_Write_Count;
909 rc = HvCall4(HvCallPciBarStore32, dsa, BarOffset, swab32(data), 0); 902 rc = HvCall4(HvCallPciBarStore32, dsa, BarOffset, swab32(data), 0);
910 } while (CheckReturnCode("WWL", DevNode, rc) != 0); 903 } while (CheckReturnCode("WWL", DevNode, &retry, rc) != 0);
911} 904}
912EXPORT_SYMBOL(iSeries_Write_Long); 905EXPORT_SYMBOL(iSeries_Write_Long);
diff --git a/arch/ppc64/kernel/iSeries_pci_reset.c b/arch/ppc64/kernel/iSeries_pci_reset.c
deleted file mode 100644
index 0f785e4584f7..000000000000
--- a/arch/ppc64/kernel/iSeries_pci_reset.c
+++ /dev/null
@@ -1,104 +0,0 @@
1#define PCIFR(...)
2/************************************************************************/
3/* File iSeries_pci_reset.c created by Allan Trautman on Mar 21 2001. */
4/************************************************************************/
5/* This code supports the pci interface on the IBM iSeries systems. */
6/* Copyright (C) 20yy <Allan H Trautman> <IBM Corp> */
7/* */
8/* This program is free software; you can redistribute it and/or modify */
9/* it under the terms of the GNU General Public License as published by */
10/* the Free Software Foundation; either version 2 of the License, or */
11/* (at your option) any later version. */
12/* */
13/* This program is distributed in the hope that it will be useful, */
14/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
15/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
16/* GNU General Public License for more details. */
17/* */
18/* You should have received a copy of the GNU General Public License */
19/* along with this program; if not, write to the: */
20/* Free Software Foundation, Inc., */
21/* 59 Temple Place, Suite 330, */
22/* Boston, MA 02111-1307 USA */
23/************************************************************************/
24/* Change Activity: */
25/* Created, March 20, 2001 */
26/* April 30, 2001, Added return codes on functions. */
27/* September 10, 2001, Ported to ppc64. */
28/* End Change Activity */
29/************************************************************************/
30#include <linux/kernel.h>
31#include <linux/init.h>
32#include <linux/module.h>
33#include <linux/pci.h>
34#include <linux/irq.h>
35#include <linux/delay.h>
36
37#include <asm/io.h>
38#include <asm/iSeries/HvCallPci.h>
39#include <asm/iSeries/HvTypes.h>
40#include <asm/iSeries/mf.h>
41#include <asm/pci.h>
42
43#include <asm/iSeries/iSeries_pci.h>
44#include "pci.h"
45
46/*
47 * Interface to toggle the reset line
48 * Time is in .1 seconds, need for seconds.
49 */
50int iSeries_Device_ToggleReset(struct pci_dev *PciDev, int AssertTime,
51 int DelayTime)
52{
53 unsigned int AssertDelay, WaitDelay;
54 struct iSeries_Device_Node *DeviceNode =
55 (struct iSeries_Device_Node *)PciDev->sysdata;
56
57 if (DeviceNode == NULL) {
58 printk("PCI: Pci Reset Failed, Device Node not found for pci_dev %p\n",
59 PciDev);
60 return -1;
61 }
62 /*
63 * Set defaults, Assert is .5 second, Wait is 3 seconds.
64 */
65 if (AssertTime == 0)
66 AssertDelay = 500;
67 else
68 AssertDelay = AssertTime * 100;
69
70 if (DelayTime == 0)
71 WaitDelay = 3000;
72 else
73 WaitDelay = DelayTime * 100;
74
75 /*
76 * Assert reset
77 */
78 DeviceNode->ReturnCode = HvCallPci_setSlotReset(ISERIES_BUS(DeviceNode),
79 0x00, DeviceNode->AgentId, 1);
80 if (DeviceNode->ReturnCode == 0) {
81 msleep(AssertDelay); /* Sleep for the time */
82 DeviceNode->ReturnCode =
83 HvCallPci_setSlotReset(ISERIES_BUS(DeviceNode),
84 0x00, DeviceNode->AgentId, 0);
85
86 /*
87 * Wait for device to reset
88 */
89 msleep(WaitDelay);
90 }
91 if (DeviceNode->ReturnCode == 0)
92 PCIFR("Slot 0x%04X.%02 Reset\n", ISERIES_BUS(DeviceNode),
93 DeviceNode->AgentId);
94 else {
95 printk("PCI: Slot 0x%04X.%02X Reset Failed, RCode: %04X\n",
96 ISERIES_BUS(DeviceNode), DeviceNode->AgentId,
97 DeviceNode->ReturnCode);
98 PCIFR("Slot 0x%04X.%02X Reset Failed, RCode: %04X\n",
99 ISERIES_BUS(DeviceNode), DeviceNode->AgentId,
100 DeviceNode->ReturnCode);
101 }
102 return DeviceNode->ReturnCode;
103}
104EXPORT_SYMBOL(iSeries_Device_ToggleReset);
diff --git a/arch/ppc64/kernel/iSeries_proc.c b/arch/ppc64/kernel/iSeries_proc.c
index 0cc58ddf48de..356bd9931fcc 100644
--- a/arch/ppc64/kernel/iSeries_proc.c
+++ b/arch/ppc64/kernel/iSeries_proc.c
@@ -28,8 +28,7 @@
28#include <asm/iSeries/ItLpQueue.h> 28#include <asm/iSeries/ItLpQueue.h>
29#include <asm/iSeries/HvCallXm.h> 29#include <asm/iSeries/HvCallXm.h>
30#include <asm/iSeries/IoHriMainStore.h> 30#include <asm/iSeries/IoHriMainStore.h>
31#include <asm/iSeries/LparData.h> 31#include <asm/iSeries/IoHriProcessorVpd.h>
32#include <asm/iSeries/iSeries_proc.h>
33 32
34static int __init iseries_proc_create(void) 33static int __init iseries_proc_create(void)
35{ 34{
diff --git a/arch/ppc64/kernel/iSeries_setup.c b/arch/ppc64/kernel/iSeries_setup.c
index 6d06eb550a3f..b31962436fe3 100644
--- a/arch/ppc64/kernel/iSeries_setup.c
+++ b/arch/ppc64/kernel/iSeries_setup.c
@@ -47,7 +47,7 @@
47#include <asm/paca.h> 47#include <asm/paca.h>
48#include <asm/cache.h> 48#include <asm/cache.h>
49#include <asm/sections.h> 49#include <asm/sections.h>
50#include <asm/iSeries/LparData.h> 50#include <asm/abs_addr.h>
51#include <asm/iSeries/HvCallHpt.h> 51#include <asm/iSeries/HvCallHpt.h>
52#include <asm/iSeries/HvLpConfig.h> 52#include <asm/iSeries/HvLpConfig.h>
53#include <asm/iSeries/HvCallEvent.h> 53#include <asm/iSeries/HvCallEvent.h>
@@ -55,10 +55,12 @@
55#include <asm/iSeries/HvCallXm.h> 55#include <asm/iSeries/HvCallXm.h>
56#include <asm/iSeries/ItLpQueue.h> 56#include <asm/iSeries/ItLpQueue.h>
57#include <asm/iSeries/IoHriMainStore.h> 57#include <asm/iSeries/IoHriMainStore.h>
58#include <asm/iSeries/iSeries_proc.h>
59#include <asm/iSeries/mf.h> 58#include <asm/iSeries/mf.h>
60#include <asm/iSeries/HvLpEvent.h> 59#include <asm/iSeries/HvLpEvent.h>
61#include <asm/iSeries/iSeries_irq.h> 60#include <asm/iSeries/iSeries_irq.h>
61#include <asm/iSeries/IoHriProcessorVpd.h>
62#include <asm/iSeries/ItVpdAreas.h>
63#include <asm/iSeries/LparMap.h>
62 64
63extern void hvlog(char *fmt, ...); 65extern void hvlog(char *fmt, ...);
64 66
@@ -74,7 +76,11 @@ extern void ppcdbg_initialize(void);
74static void build_iSeries_Memory_Map(void); 76static void build_iSeries_Memory_Map(void);
75static void setup_iSeries_cache_sizes(void); 77static void setup_iSeries_cache_sizes(void);
76static void iSeries_bolt_kernel(unsigned long saddr, unsigned long eaddr); 78static void iSeries_bolt_kernel(unsigned long saddr, unsigned long eaddr);
79#ifdef CONFIG_PCI
77extern void iSeries_pci_final_fixup(void); 80extern void iSeries_pci_final_fixup(void);
81#else
82static void iSeries_pci_final_fixup(void) { }
83#endif
78 84
79/* Global Variables */ 85/* Global Variables */
80static unsigned long procFreqHz; 86static unsigned long procFreqHz;
@@ -874,6 +880,10 @@ static int set_spread_lpevents(char *str)
874} 880}
875__setup("spread_lpevents=", set_spread_lpevents); 881__setup("spread_lpevents=", set_spread_lpevents);
876 882
883#ifndef CONFIG_PCI
884void __init iSeries_init_IRQ(void) { }
885#endif
886
877void __init iSeries_early_setup(void) 887void __init iSeries_early_setup(void)
878{ 888{
879 iSeries_fixup_klimit(); 889 iSeries_fixup_klimit();
diff --git a/arch/ppc64/kernel/iSeries_smp.c b/arch/ppc64/kernel/iSeries_smp.c
index ba1f084d5462..f74386e31638 100644
--- a/arch/ppc64/kernel/iSeries_smp.c
+++ b/arch/ppc64/kernel/iSeries_smp.c
@@ -38,9 +38,7 @@
38#include <asm/io.h> 38#include <asm/io.h>
39#include <asm/smp.h> 39#include <asm/smp.h>
40#include <asm/paca.h> 40#include <asm/paca.h>
41#include <asm/iSeries/LparData.h>
42#include <asm/iSeries/HvCall.h> 41#include <asm/iSeries/HvCall.h>
43#include <asm/iSeries/HvCallCfg.h>
44#include <asm/time.h> 42#include <asm/time.h>
45#include <asm/ppcdebug.h> 43#include <asm/ppcdebug.h>
46#include <asm/machdep.h> 44#include <asm/machdep.h>
diff --git a/arch/ppc64/kernel/idle.c b/arch/ppc64/kernel/idle.c
index f24ce2b87200..bdf13b4dc1c8 100644
--- a/arch/ppc64/kernel/idle.c
+++ b/arch/ppc64/kernel/idle.c
@@ -42,6 +42,11 @@ static int (*idle_loop)(void);
42static unsigned long maxYieldTime = 0; 42static unsigned long maxYieldTime = 0;
43static unsigned long minYieldTime = 0xffffffffffffffffUL; 43static unsigned long minYieldTime = 0xffffffffffffffffUL;
44 44
45static inline void process_iSeries_events(void)
46{
47 asm volatile ("li 0,0x5555; sc" : : : "r0", "r3");
48}
49
45static void yield_shared_processor(void) 50static void yield_shared_processor(void)
46{ 51{
47 unsigned long tb; 52 unsigned long tb;
@@ -292,7 +297,7 @@ static int native_idle(void)
292 if (need_resched()) 297 if (need_resched())
293 schedule(); 298 schedule();
294 299
295 if (cpu_is_offline(_smp_processor_id()) && 300 if (cpu_is_offline(raw_smp_processor_id()) &&
296 system_state == SYSTEM_RUNNING) 301 system_state == SYSTEM_RUNNING)
297 cpu_die(); 302 cpu_die();
298 } 303 }
diff --git a/arch/ppc64/kernel/irq.c b/arch/ppc64/kernel/irq.c
index 4fd7f203c1e3..d860467b8f09 100644
--- a/arch/ppc64/kernel/irq.c
+++ b/arch/ppc64/kernel/irq.c
@@ -52,7 +52,7 @@
52#include <asm/cache.h> 52#include <asm/cache.h>
53#include <asm/prom.h> 53#include <asm/prom.h>
54#include <asm/ptrace.h> 54#include <asm/ptrace.h>
55#include <asm/iSeries/LparData.h> 55#include <asm/iSeries/ItLpQueue.h>
56#include <asm/machdep.h> 56#include <asm/machdep.h>
57#include <asm/paca.h> 57#include <asm/paca.h>
58 58
diff --git a/arch/ppc64/kernel/lparcfg.c b/arch/ppc64/kernel/lparcfg.c
index a8fd32df848b..387923fcf9b0 100644
--- a/arch/ppc64/kernel/lparcfg.c
+++ b/arch/ppc64/kernel/lparcfg.c
@@ -28,12 +28,12 @@
28#include <asm/uaccess.h> 28#include <asm/uaccess.h>
29#include <asm/iSeries/HvLpConfig.h> 29#include <asm/iSeries/HvLpConfig.h>
30#include <asm/lppaca.h> 30#include <asm/lppaca.h>
31#include <asm/iSeries/LparData.h>
32#include <asm/hvcall.h> 31#include <asm/hvcall.h>
33#include <asm/cputable.h> 32#include <asm/cputable.h>
34#include <asm/rtas.h> 33#include <asm/rtas.h>
35#include <asm/system.h> 34#include <asm/system.h>
36#include <asm/time.h> 35#include <asm/time.h>
36#include <asm/iSeries/ItExtVpdPanel.h>
37 37
38#define MODULE_VERS "1.6" 38#define MODULE_VERS "1.6"
39#define MODULE_NAME "lparcfg" 39#define MODULE_NAME "lparcfg"
diff --git a/arch/ppc64/kernel/mf.c b/arch/ppc64/kernel/mf.c
index 5aca7e8005a8..d98bebf7042f 100644
--- a/arch/ppc64/kernel/mf.c
+++ b/arch/ppc64/kernel/mf.c
@@ -40,7 +40,6 @@
40#include <asm/iSeries/vio.h> 40#include <asm/iSeries/vio.h>
41#include <asm/iSeries/mf.h> 41#include <asm/iSeries/mf.h>
42#include <asm/iSeries/HvLpConfig.h> 42#include <asm/iSeries/HvLpConfig.h>
43#include <asm/iSeries/ItSpCommArea.h>
44#include <asm/iSeries/ItLpQueue.h> 43#include <asm/iSeries/ItLpQueue.h>
45 44
46/* 45/*
diff --git a/arch/ppc64/kernel/process.c b/arch/ppc64/kernel/process.c
index cdfecbeb331f..aba89554d89d 100644
--- a/arch/ppc64/kernel/process.c
+++ b/arch/ppc64/kernel/process.c
@@ -58,14 +58,6 @@ struct task_struct *last_task_used_math = NULL;
58struct task_struct *last_task_used_altivec = NULL; 58struct task_struct *last_task_used_altivec = NULL;
59#endif 59#endif
60 60
61struct mm_struct ioremap_mm = {
62 .pgd = ioremap_dir,
63 .mm_users = ATOMIC_INIT(2),
64 .mm_count = ATOMIC_INIT(1),
65 .cpu_vm_mask = CPU_MASK_ALL,
66 .page_table_lock = SPIN_LOCK_UNLOCKED,
67};
68
69/* 61/*
70 * Make sure the floating-point register state in the 62 * Make sure the floating-point register state in the
71 * the thread_struct is up to date for task tsk. 63 * the thread_struct is up to date for task tsk.
diff --git a/arch/ppc64/kernel/prom.c b/arch/ppc64/kernel/prom.c
index eb6538b58008..47727a6f7346 100644
--- a/arch/ppc64/kernel/prom.c
+++ b/arch/ppc64/kernel/prom.c
@@ -884,6 +884,7 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
884{ 884{
885 char *type = get_flat_dt_prop(node, "device_type", NULL); 885 char *type = get_flat_dt_prop(node, "device_type", NULL);
886 u32 *prop; 886 u32 *prop;
887 unsigned long size;
887 888
888 /* We are scanning "cpu" nodes only */ 889 /* We are scanning "cpu" nodes only */
889 if (type == NULL || strcmp(type, "cpu") != 0) 890 if (type == NULL || strcmp(type, "cpu") != 0)
@@ -929,6 +930,17 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
929 cur_cpu_spec->cpu_user_features |= PPC_FEATURE_HAS_ALTIVEC; 930 cur_cpu_spec->cpu_user_features |= PPC_FEATURE_HAS_ALTIVEC;
930 } 931 }
931 932
933 /*
934 * Check for an SMT capable CPU and set the CPU feature. We do
935 * this by looking at the size of the ibm,ppc-interrupt-server#s
936 * property
937 */
938 prop = (u32 *)get_flat_dt_prop(node, "ibm,ppc-interrupt-server#s",
939 &size);
940 cur_cpu_spec->cpu_features &= ~CPU_FTR_SMT;
941 if (prop && ((size / sizeof(u32)) > 1))
942 cur_cpu_spec->cpu_features |= CPU_FTR_SMT;
943
932 return 0; 944 return 0;
933} 945}
934 946
diff --git a/arch/ppc64/kernel/ras.c b/arch/ppc64/kernel/ras.c
index 1c4c796b212b..3c00f7bfc1b5 100644
--- a/arch/ppc64/kernel/ras.c
+++ b/arch/ppc64/kernel/ras.c
@@ -47,7 +47,6 @@
47#include <asm/cache.h> 47#include <asm/cache.h>
48#include <asm/prom.h> 48#include <asm/prom.h>
49#include <asm/ptrace.h> 49#include <asm/ptrace.h>
50#include <asm/iSeries/LparData.h>
51#include <asm/machdep.h> 50#include <asm/machdep.h>
52#include <asm/rtas.h> 51#include <asm/rtas.h>
53#include <asm/ppcdebug.h> 52#include <asm/ppcdebug.h>
diff --git a/arch/ppc64/kernel/rtc.c b/arch/ppc64/kernel/rtc.c
index 67989055a9fe..de02aedbe080 100644
--- a/arch/ppc64/kernel/rtc.c
+++ b/arch/ppc64/kernel/rtc.c
@@ -42,10 +42,8 @@
42#include <asm/time.h> 42#include <asm/time.h>
43#include <asm/rtas.h> 43#include <asm/rtas.h>
44 44
45#include <asm/iSeries/LparData.h>
46#include <asm/iSeries/mf.h> 45#include <asm/iSeries/mf.h>
47#include <asm/machdep.h> 46#include <asm/machdep.h>
48#include <asm/iSeries/ItSpCommArea.h>
49 47
50extern int piranha_simulator; 48extern int piranha_simulator;
51 49
diff --git a/arch/ppc64/kernel/setup.c b/arch/ppc64/kernel/setup.c
index dce198d39328..8e439a817642 100644
--- a/arch/ppc64/kernel/setup.c
+++ b/arch/ppc64/kernel/setup.c
@@ -41,7 +41,6 @@
41#include <asm/smp.h> 41#include <asm/smp.h>
42#include <asm/elf.h> 42#include <asm/elf.h>
43#include <asm/machdep.h> 43#include <asm/machdep.h>
44#include <asm/iSeries/LparData.h>
45#include <asm/paca.h> 44#include <asm/paca.h>
46#include <asm/ppcdebug.h> 45#include <asm/ppcdebug.h>
47#include <asm/time.h> 46#include <asm/time.h>
@@ -57,6 +56,8 @@
57#include <asm/cache.h> 56#include <asm/cache.h>
58#include <asm/page.h> 57#include <asm/page.h>
59#include <asm/mmu.h> 58#include <asm/mmu.h>
59#include <asm/lmb.h>
60#include <asm/iSeries/ItLpNaca.h>
60 61
61#ifdef DEBUG 62#ifdef DEBUG
62#define DBG(fmt...) udbg_printf(fmt) 63#define DBG(fmt...) udbg_printf(fmt)
diff --git a/arch/ppc64/kernel/sys_ppc32.c b/arch/ppc64/kernel/sys_ppc32.c
index 9c8e317c598d..118436e8085a 100644
--- a/arch/ppc64/kernel/sys_ppc32.c
+++ b/arch/ppc64/kernel/sys_ppc32.c
@@ -741,6 +741,7 @@ asmlinkage int sys32_pciconfig_write(u32 bus, u32 dfn, u32 off, u32 len, u32 ubu
741 741
742asmlinkage int sys32_pciconfig_iobase(u32 which, u32 in_bus, u32 in_devfn) 742asmlinkage int sys32_pciconfig_iobase(u32 which, u32 in_bus, u32 in_devfn)
743{ 743{
744#ifdef CONFIG_PCI
744 struct pci_controller* hose; 745 struct pci_controller* hose;
745 struct list_head *ln; 746 struct list_head *ln;
746 struct pci_bus *bus = NULL; 747 struct pci_bus *bus = NULL;
@@ -786,7 +787,7 @@ asmlinkage int sys32_pciconfig_iobase(u32 which, u32 in_bus, u32 in_devfn)
786 case IOBASE_ISA_MEM: 787 case IOBASE_ISA_MEM:
787 return -EINVAL; 788 return -EINVAL;
788 } 789 }
789 790#endif /* CONFIG_PCI */
790 return -EOPNOTSUPP; 791 return -EOPNOTSUPP;
791} 792}
792 793
diff --git a/arch/ppc64/kernel/vio.c b/arch/ppc64/kernel/vio.c
index 79f2dc7a9833..0c0ba71ac0e8 100644
--- a/arch/ppc64/kernel/vio.c
+++ b/arch/ppc64/kernel/vio.c
@@ -41,20 +41,25 @@ static const struct vio_device_id *vio_match_device(
41static struct iommu_table *vio_build_iommu_table(struct vio_dev *); 41static struct iommu_table *vio_build_iommu_table(struct vio_dev *);
42static int vio_num_address_cells; 42static int vio_num_address_cells;
43#endif 43#endif
44static struct vio_dev *vio_bus_device; /* fake "parent" device */
45
46#ifdef CONFIG_PPC_ISERIES 44#ifdef CONFIG_PPC_ISERIES
47static struct vio_dev *__init vio_register_device_iseries(char *type,
48 uint32_t unit_num);
49
50static struct iommu_table veth_iommu_table; 45static struct iommu_table veth_iommu_table;
51static struct iommu_table vio_iommu_table; 46static struct iommu_table vio_iommu_table;
52 47#endif
53static struct vio_dev _vio_dev = { 48static struct vio_dev vio_bus_device = { /* fake "parent" device */
49 .name = vio_bus_device.dev.bus_id,
50 .type = "",
51#ifdef CONFIG_PPC_ISERIES
54 .iommu_table = &vio_iommu_table, 52 .iommu_table = &vio_iommu_table,
55 .dev.bus = &vio_bus_type 53#endif
54 .dev.bus_id = "vio",
55 .dev.bus = &vio_bus_type,
56}; 56};
57struct device *iSeries_vio_dev = &_vio_dev.dev; 57
58#ifdef CONFIG_PPC_ISERIES
59static struct vio_dev *__init vio_register_device_iseries(char *type,
60 uint32_t unit_num);
61
62struct device *iSeries_vio_dev = &vio_bus_device.dev;
58EXPORT_SYMBOL(iSeries_vio_dev); 63EXPORT_SYMBOL(iSeries_vio_dev);
59 64
60#define device_is_compatible(a, b) 1 65#define device_is_compatible(a, b) 1
@@ -260,18 +265,10 @@ static int __init vio_bus_init(void)
260 } 265 }
261 266
262 /* the fake parent of all vio devices, just to give us a nice directory */ 267 /* the fake parent of all vio devices, just to give us a nice directory */
263 vio_bus_device = kmalloc(sizeof(struct vio_dev), GFP_KERNEL); 268 err = device_register(&vio_bus_device.dev);
264 if (!vio_bus_device) {
265 return 1;
266 }
267 memset(vio_bus_device, 0, sizeof(struct vio_dev));
268 strcpy(vio_bus_device->dev.bus_id, "vio");
269
270 err = device_register(&vio_bus_device->dev);
271 if (err) { 269 if (err) {
272 printk(KERN_WARNING "%s: device_register returned %i\n", __FUNCTION__, 270 printk(KERN_WARNING "%s: device_register returned %i\n", __FUNCTION__,
273 err); 271 err);
274 kfree(vio_bus_device);
275 return err; 272 return err;
276 } 273 }
277 274
@@ -326,7 +323,7 @@ static struct vio_dev * __devinit vio_register_device_common(
326 viodev->unit_address = unit_address; 323 viodev->unit_address = unit_address;
327 viodev->iommu_table = iommu_table; 324 viodev->iommu_table = iommu_table;
328 /* init generic 'struct device' fields: */ 325 /* init generic 'struct device' fields: */
329 viodev->dev.parent = &vio_bus_device->dev; 326 viodev->dev.parent = &vio_bus_device.dev;
330 viodev->dev.bus = &vio_bus_type; 327 viodev->dev.bus = &vio_bus_type;
331 viodev->dev.release = vio_dev_release; 328 viodev->dev.release = vio_dev_release;
332 329
@@ -636,5 +633,3 @@ struct bus_type vio_bus_type = {
636 .name = "vio", 633 .name = "vio",
637 .match = vio_bus_match, 634 .match = vio_bus_match,
638}; 635};
639
640EXPORT_SYMBOL(vio_bus_type);
diff --git a/arch/ppc64/kernel/viopath.c b/arch/ppc64/kernel/viopath.c
index 2ed8ee075680..2a6c4f01c45e 100644
--- a/arch/ppc64/kernel/viopath.c
+++ b/arch/ppc64/kernel/viopath.c
@@ -43,12 +43,10 @@
43#include <asm/system.h> 43#include <asm/system.h>
44#include <asm/uaccess.h> 44#include <asm/uaccess.h>
45#include <asm/iSeries/HvTypes.h> 45#include <asm/iSeries/HvTypes.h>
46#include <asm/iSeries/LparData.h> 46#include <asm/iSeries/ItExtVpdPanel.h>
47#include <asm/iSeries/HvLpEvent.h> 47#include <asm/iSeries/HvLpEvent.h>
48#include <asm/iSeries/HvLpConfig.h> 48#include <asm/iSeries/HvLpConfig.h>
49#include <asm/iSeries/HvCallCfg.h>
50#include <asm/iSeries/mf.h> 49#include <asm/iSeries/mf.h>
51#include <asm/iSeries/iSeries_proc.h>
52#include <asm/iSeries/vio.h> 50#include <asm/iSeries/vio.h>
53 51
54/* Status of the path to each other partition in the system. 52/* Status of the path to each other partition in the system.
@@ -365,7 +363,7 @@ void vio_set_hostlp(void)
365 * while we're active 363 * while we're active
366 */ 364 */
367 viopath_ourLp = HvLpConfig_getLpIndex(); 365 viopath_ourLp = HvLpConfig_getLpIndex();
368 viopath_hostLp = HvCallCfg_getHostingLpIndex(viopath_ourLp); 366 viopath_hostLp = HvLpConfig_getHostingLpIndex(viopath_ourLp);
369 367
370 if (viopath_hostLp != HvLpIndexInvalid) 368 if (viopath_hostLp != HvLpIndexInvalid)
371 vio_setHandler(viomajorsubtype_config, handleConfig); 369 vio_setHandler(viomajorsubtype_config, handleConfig);
@@ -487,7 +485,7 @@ int viopath_open(HvLpIndex remoteLp, int subtype, int numReq)
487 unsigned long flags; 485 unsigned long flags;
488 int tempNumAllocated; 486 int tempNumAllocated;
489 487
490 if ((remoteLp >= HvMaxArchitectedLps) || (remoteLp == HvLpIndexInvalid)) 488 if ((remoteLp >= HVMAXARCHITECTEDLPS) || (remoteLp == HvLpIndexInvalid))
491 return -EINVAL; 489 return -EINVAL;
492 490
493 subtype = subtype >> VIOMAJOR_SUBTYPE_SHIFT; 491 subtype = subtype >> VIOMAJOR_SUBTYPE_SHIFT;
@@ -558,7 +556,7 @@ int viopath_close(HvLpIndex remoteLp, int subtype, int numReq)
558 int numOpen; 556 int numOpen;
559 struct alloc_parms parms; 557 struct alloc_parms parms;
560 558
561 if ((remoteLp >= HvMaxArchitectedLps) || (remoteLp == HvLpIndexInvalid)) 559 if ((remoteLp >= HVMAXARCHITECTEDLPS) || (remoteLp == HvLpIndexInvalid))
562 return -EINVAL; 560 return -EINVAL;
563 561
564 subtype = subtype >> VIOMAJOR_SUBTYPE_SHIFT; 562 subtype = subtype >> VIOMAJOR_SUBTYPE_SHIFT;
diff --git a/arch/ppc64/lib/Makefile b/arch/ppc64/lib/Makefile
index bf7b5bbfc04e..76fbfa9f706f 100644
--- a/arch/ppc64/lib/Makefile
+++ b/arch/ppc64/lib/Makefile
@@ -12,7 +12,7 @@ lib-$(CONFIG_SMP) += locks.o
12 12
13# e2a provides EBCDIC to ASCII conversions. 13# e2a provides EBCDIC to ASCII conversions.
14ifdef CONFIG_PPC_ISERIES 14ifdef CONFIG_PPC_ISERIES
15obj-$(CONFIG_PCI) += e2a.o 15obj-y += e2a.o
16endif 16endif
17 17
18lib-$(CONFIG_DEBUG_KERNEL) += sstep.o 18lib-$(CONFIG_DEBUG_KERNEL) += sstep.o
diff --git a/arch/ppc64/mm/hash_utils.c b/arch/ppc64/mm/hash_utils.c
index 0a0f97008d02..1647b1c6f28e 100644
--- a/arch/ppc64/mm/hash_utils.c
+++ b/arch/ppc64/mm/hash_utils.c
@@ -195,7 +195,7 @@ void __init htab_initialize(void)
195 memset((void *)table, 0, htab_size_bytes); 195 memset((void *)table, 0, htab_size_bytes);
196 } 196 }
197 197
198 mode_rw = _PAGE_ACCESSED | _PAGE_COHERENT | PP_RWXX; 198 mode_rw = _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_COHERENT | PP_RWXX;
199 199
200 /* On U3 based machines, we need to reserve the DART area and 200 /* On U3 based machines, we need to reserve the DART area and
201 * _NOT_ map it to avoid cache paradoxes as it's remapped non 201 * _NOT_ map it to avoid cache paradoxes as it's remapped non
@@ -310,10 +310,6 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
310 310
311 vsid = get_vsid(mm->context.id, ea); 311 vsid = get_vsid(mm->context.id, ea);
312 break; 312 break;
313 case IO_REGION_ID:
314 mm = &ioremap_mm;
315 vsid = get_kernel_vsid(ea);
316 break;
317 case VMALLOC_REGION_ID: 313 case VMALLOC_REGION_ID:
318 mm = &init_mm; 314 mm = &init_mm;
319 vsid = get_kernel_vsid(ea); 315 vsid = get_kernel_vsid(ea);
diff --git a/arch/ppc64/mm/hugetlbpage.c b/arch/ppc64/mm/hugetlbpage.c
index d3bf86a5c1ad..fdcfe97c75c1 100644
--- a/arch/ppc64/mm/hugetlbpage.c
+++ b/arch/ppc64/mm/hugetlbpage.c
@@ -121,7 +121,7 @@ static pte_t *hugepte_alloc(struct mm_struct *mm, pud_t *dir, unsigned long addr
121 return hugepte_offset(dir, addr); 121 return hugepte_offset(dir, addr);
122} 122}
123 123
124static pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr) 124pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
125{ 125{
126 pud_t *pud; 126 pud_t *pud;
127 127
@@ -134,7 +134,7 @@ static pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
134 return hugepte_offset(pud, addr); 134 return hugepte_offset(pud, addr);
135} 135}
136 136
137static pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr) 137pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr)
138{ 138{
139 pud_t *pud; 139 pud_t *pud;
140 140
@@ -147,25 +147,6 @@ static pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr)
147 return hugepte_alloc(mm, pud, addr); 147 return hugepte_alloc(mm, pud, addr);
148} 148}
149 149
150static void set_huge_pte(struct mm_struct *mm, struct vm_area_struct *vma,
151 unsigned long addr, struct page *page,
152 pte_t *ptep, int write_access)
153{
154 pte_t entry;
155
156 add_mm_counter(mm, rss, HPAGE_SIZE / PAGE_SIZE);
157 if (write_access) {
158 entry =
159 pte_mkwrite(pte_mkdirty(mk_pte(page, vma->vm_page_prot)));
160 } else {
161 entry = pte_wrprotect(mk_pte(page, vma->vm_page_prot));
162 }
163 entry = pte_mkyoung(entry);
164 entry = pte_mkhuge(entry);
165
166 set_pte_at(mm, addr, ptep, entry);
167}
168
169/* 150/*
170 * This function checks for proper alignment of input addr and len parameters. 151 * This function checks for proper alignment of input addr and len parameters.
171 */ 152 */
@@ -259,80 +240,6 @@ int prepare_hugepage_range(unsigned long addr, unsigned long len)
259 return -EINVAL; 240 return -EINVAL;
260} 241}
261 242
262int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src,
263 struct vm_area_struct *vma)
264{
265 pte_t *src_pte, *dst_pte, entry;
266 struct page *ptepage;
267 unsigned long addr = vma->vm_start;
268 unsigned long end = vma->vm_end;
269 int err = -ENOMEM;
270
271 while (addr < end) {
272 dst_pte = huge_pte_alloc(dst, addr);
273 if (!dst_pte)
274 goto out;
275
276 src_pte = huge_pte_offset(src, addr);
277 entry = *src_pte;
278
279 ptepage = pte_page(entry);
280 get_page(ptepage);
281 add_mm_counter(dst, rss, HPAGE_SIZE / PAGE_SIZE);
282 set_pte_at(dst, addr, dst_pte, entry);
283
284 addr += HPAGE_SIZE;
285 }
286
287 err = 0;
288 out:
289 return err;
290}
291
292int
293follow_hugetlb_page(struct mm_struct *mm, struct vm_area_struct *vma,
294 struct page **pages, struct vm_area_struct **vmas,
295 unsigned long *position, int *length, int i)
296{
297 unsigned long vpfn, vaddr = *position;
298 int remainder = *length;
299
300 WARN_ON(!is_vm_hugetlb_page(vma));
301
302 vpfn = vaddr/PAGE_SIZE;
303 while (vaddr < vma->vm_end && remainder) {
304 if (pages) {
305 pte_t *pte;
306 struct page *page;
307
308 pte = huge_pte_offset(mm, vaddr);
309
310 /* hugetlb should be locked, and hence, prefaulted */
311 WARN_ON(!pte || pte_none(*pte));
312
313 page = &pte_page(*pte)[vpfn % (HPAGE_SIZE/PAGE_SIZE)];
314
315 WARN_ON(!PageCompound(page));
316
317 get_page(page);
318 pages[i] = page;
319 }
320
321 if (vmas)
322 vmas[i] = vma;
323
324 vaddr += PAGE_SIZE;
325 ++vpfn;
326 --remainder;
327 ++i;
328 }
329
330 *length = remainder;
331 *position = vaddr;
332
333 return i;
334}
335
336struct page * 243struct page *
337follow_huge_addr(struct mm_struct *mm, unsigned long address, int write) 244follow_huge_addr(struct mm_struct *mm, unsigned long address, int write)
338{ 245{
@@ -363,89 +270,6 @@ follow_huge_pmd(struct mm_struct *mm, unsigned long address,
363 return NULL; 270 return NULL;
364} 271}
365 272
366void unmap_hugepage_range(struct vm_area_struct *vma,
367 unsigned long start, unsigned long end)
368{
369 struct mm_struct *mm = vma->vm_mm;
370 unsigned long addr;
371 pte_t *ptep;
372 struct page *page;
373
374 WARN_ON(!is_vm_hugetlb_page(vma));
375 BUG_ON((start % HPAGE_SIZE) != 0);
376 BUG_ON((end % HPAGE_SIZE) != 0);
377
378 for (addr = start; addr < end; addr += HPAGE_SIZE) {
379 pte_t pte;
380
381 ptep = huge_pte_offset(mm, addr);
382 if (!ptep || pte_none(*ptep))
383 continue;
384
385 pte = *ptep;
386 page = pte_page(pte);
387 pte_clear(mm, addr, ptep);
388
389 put_page(page);
390 }
391 add_mm_counter(mm, rss, -((end - start) >> PAGE_SHIFT));
392 flush_tlb_pending();
393}
394
395int hugetlb_prefault(struct address_space *mapping, struct vm_area_struct *vma)
396{
397 struct mm_struct *mm = current->mm;
398 unsigned long addr;
399 int ret = 0;
400
401 WARN_ON(!is_vm_hugetlb_page(vma));
402 BUG_ON((vma->vm_start % HPAGE_SIZE) != 0);
403 BUG_ON((vma->vm_end % HPAGE_SIZE) != 0);
404
405 spin_lock(&mm->page_table_lock);
406 for (addr = vma->vm_start; addr < vma->vm_end; addr += HPAGE_SIZE) {
407 unsigned long idx;
408 pte_t *pte = huge_pte_alloc(mm, addr);
409 struct page *page;
410
411 if (!pte) {
412 ret = -ENOMEM;
413 goto out;
414 }
415 if (! pte_none(*pte))
416 continue;
417
418 idx = ((addr - vma->vm_start) >> HPAGE_SHIFT)
419 + (vma->vm_pgoff >> (HPAGE_SHIFT - PAGE_SHIFT));
420 page = find_get_page(mapping, idx);
421 if (!page) {
422 /* charge the fs quota first */
423 if (hugetlb_get_quota(mapping)) {
424 ret = -ENOMEM;
425 goto out;
426 }
427 page = alloc_huge_page();
428 if (!page) {
429 hugetlb_put_quota(mapping);
430 ret = -ENOMEM;
431 goto out;
432 }
433 ret = add_to_page_cache(page, mapping, idx, GFP_ATOMIC);
434 if (! ret) {
435 unlock_page(page);
436 } else {
437 hugetlb_put_quota(mapping);
438 free_huge_page(page);
439 goto out;
440 }
441 }
442 set_huge_pte(mm, vma, addr, page, pte, vma->vm_flags & VM_WRITE);
443 }
444out:
445 spin_unlock(&mm->page_table_lock);
446 return ret;
447}
448
449/* Because we have an exclusive hugepage region which lies within the 273/* Because we have an exclusive hugepage region which lies within the
450 * normal user address space, we have to take special measures to make 274 * normal user address space, we have to take special measures to make
451 * non-huge mmap()s evade the hugepage reserved regions. */ 275 * non-huge mmap()s evade the hugepage reserved regions. */
@@ -468,7 +292,12 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
468 && !is_hugepage_only_range(mm, addr,len)) 292 && !is_hugepage_only_range(mm, addr,len))
469 return addr; 293 return addr;
470 } 294 }
471 start_addr = addr = mm->free_area_cache; 295 if (len > mm->cached_hole_size) {
296 start_addr = addr = mm->free_area_cache;
297 } else {
298 start_addr = addr = TASK_UNMAPPED_BASE;
299 mm->cached_hole_size = 0;
300 }
472 301
473full_search: 302full_search:
474 vma = find_vma(mm, addr); 303 vma = find_vma(mm, addr);
@@ -492,6 +321,8 @@ full_search:
492 mm->free_area_cache = addr + len; 321 mm->free_area_cache = addr + len;
493 return addr; 322 return addr;
494 } 323 }
324 if (addr + mm->cached_hole_size < vma->vm_start)
325 mm->cached_hole_size = vma->vm_start - addr;
495 addr = vma->vm_end; 326 addr = vma->vm_end;
496 vma = vma->vm_next; 327 vma = vma->vm_next;
497 } 328 }
@@ -499,6 +330,7 @@ full_search:
499 /* Make sure we didn't miss any holes */ 330 /* Make sure we didn't miss any holes */
500 if (start_addr != TASK_UNMAPPED_BASE) { 331 if (start_addr != TASK_UNMAPPED_BASE) {
501 start_addr = addr = TASK_UNMAPPED_BASE; 332 start_addr = addr = TASK_UNMAPPED_BASE;
333 mm->cached_hole_size = 0;
502 goto full_search; 334 goto full_search;
503 } 335 }
504 return -ENOMEM; 336 return -ENOMEM;
@@ -520,6 +352,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
520 struct vm_area_struct *vma, *prev_vma; 352 struct vm_area_struct *vma, *prev_vma;
521 struct mm_struct *mm = current->mm; 353 struct mm_struct *mm = current->mm;
522 unsigned long base = mm->mmap_base, addr = addr0; 354 unsigned long base = mm->mmap_base, addr = addr0;
355 unsigned long largest_hole = mm->cached_hole_size;
523 int first_time = 1; 356 int first_time = 1;
524 357
525 /* requested length too big for entire address space */ 358 /* requested length too big for entire address space */
@@ -540,6 +373,10 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
540 return addr; 373 return addr;
541 } 374 }
542 375
376 if (len <= largest_hole) {
377 largest_hole = 0;
378 mm->free_area_cache = base;
379 }
543try_again: 380try_again:
544 /* make sure it can fit in the remaining address space */ 381 /* make sure it can fit in the remaining address space */
545 if (mm->free_area_cache < len) 382 if (mm->free_area_cache < len)
@@ -568,13 +405,21 @@ hugepage_recheck:
568 * vma->vm_start, use it: 405 * vma->vm_start, use it:
569 */ 406 */
570 if (addr+len <= vma->vm_start && 407 if (addr+len <= vma->vm_start &&
571 (!prev_vma || (addr >= prev_vma->vm_end))) 408 (!prev_vma || (addr >= prev_vma->vm_end))) {
572 /* remember the address as a hint for next time */ 409 /* remember the address as a hint for next time */
573 return (mm->free_area_cache = addr); 410 mm->cached_hole_size = largest_hole;
574 else 411 return (mm->free_area_cache = addr);
412 } else {
575 /* pull free_area_cache down to the first hole */ 413 /* pull free_area_cache down to the first hole */
576 if (mm->free_area_cache == vma->vm_end) 414 if (mm->free_area_cache == vma->vm_end) {
577 mm->free_area_cache = vma->vm_start; 415 mm->free_area_cache = vma->vm_start;
416 mm->cached_hole_size = largest_hole;
417 }
418 }
419
420 /* remember the largest hole we saw so far */
421 if (addr + largest_hole < vma->vm_start)
422 largest_hole = vma->vm_start - addr;
578 423
579 /* try just below the current vma->vm_start */ 424 /* try just below the current vma->vm_start */
580 addr = vma->vm_start-len; 425 addr = vma->vm_start-len;
@@ -587,6 +432,7 @@ fail:
587 */ 432 */
588 if (first_time) { 433 if (first_time) {
589 mm->free_area_cache = base; 434 mm->free_area_cache = base;
435 largest_hole = 0;
590 first_time = 0; 436 first_time = 0;
591 goto try_again; 437 goto try_again;
592 } 438 }
@@ -597,11 +443,13 @@ fail:
597 * allocations. 443 * allocations.
598 */ 444 */
599 mm->free_area_cache = TASK_UNMAPPED_BASE; 445 mm->free_area_cache = TASK_UNMAPPED_BASE;
446 mm->cached_hole_size = ~0UL;
600 addr = arch_get_unmapped_area(filp, addr0, len, pgoff, flags); 447 addr = arch_get_unmapped_area(filp, addr0, len, pgoff, flags);
601 /* 448 /*
602 * Restore the topdown base: 449 * Restore the topdown base:
603 */ 450 */
604 mm->free_area_cache = base; 451 mm->free_area_cache = base;
452 mm->cached_hole_size = ~0UL;
605 453
606 return addr; 454 return addr;
607} 455}
diff --git a/arch/ppc64/mm/imalloc.c b/arch/ppc64/mm/imalloc.c
index cb8727f3267a..b6e75b891ac0 100644
--- a/arch/ppc64/mm/imalloc.c
+++ b/arch/ppc64/mm/imalloc.c
@@ -15,6 +15,7 @@
15#include <asm/pgtable.h> 15#include <asm/pgtable.h>
16#include <asm/semaphore.h> 16#include <asm/semaphore.h>
17#include <asm/imalloc.h> 17#include <asm/imalloc.h>
18#include <asm/cacheflush.h>
18 19
19static DECLARE_MUTEX(imlist_sem); 20static DECLARE_MUTEX(imlist_sem);
20struct vm_struct * imlist = NULL; 21struct vm_struct * imlist = NULL;
@@ -285,29 +286,32 @@ struct vm_struct * im_get_area(unsigned long v_addr, unsigned long size,
285 return area; 286 return area;
286} 287}
287 288
288unsigned long im_free(void * addr) 289void im_free(void * addr)
289{ 290{
290 struct vm_struct **p, *tmp; 291 struct vm_struct **p, *tmp;
291 unsigned long ret_size = 0;
292 292
293 if (!addr) 293 if (!addr)
294 return ret_size; 294 return;
295 if ((PAGE_SIZE-1) & (unsigned long) addr) { 295 if ((unsigned long) addr & ~PAGE_MASK) {
296 printk(KERN_ERR "Trying to %s bad address (%p)\n", __FUNCTION__, addr); 296 printk(KERN_ERR "Trying to %s bad address (%p)\n", __FUNCTION__, addr);
297 return ret_size; 297 return;
298 } 298 }
299 down(&imlist_sem); 299 down(&imlist_sem);
300 for (p = &imlist ; (tmp = *p) ; p = &tmp->next) { 300 for (p = &imlist ; (tmp = *p) ; p = &tmp->next) {
301 if (tmp->addr == addr) { 301 if (tmp->addr == addr) {
302 ret_size = tmp->size;
303 *p = tmp->next; 302 *p = tmp->next;
303
304 /* XXX: do we need the lock? */
305 spin_lock(&init_mm.page_table_lock);
306 unmap_vm_area(tmp);
307 spin_unlock(&init_mm.page_table_lock);
308
304 kfree(tmp); 309 kfree(tmp);
305 up(&imlist_sem); 310 up(&imlist_sem);
306 return ret_size; 311 return;
307 } 312 }
308 } 313 }
309 up(&imlist_sem); 314 up(&imlist_sem);
310 printk(KERN_ERR "Trying to %s nonexistent area (%p)\n", __FUNCTION__, 315 printk(KERN_ERR "Trying to %s nonexistent area (%p)\n", __FUNCTION__,
311 addr); 316 addr);
312 return ret_size;
313} 317}
diff --git a/arch/ppc64/mm/init.c b/arch/ppc64/mm/init.c
index 4b42aff74d73..6fa1e6490b57 100644
--- a/arch/ppc64/mm/init.c
+++ b/arch/ppc64/mm/init.c
@@ -73,9 +73,6 @@ static unsigned long phbs_io_bot = PHBS_IO_BASE;
73extern pgd_t swapper_pg_dir[]; 73extern pgd_t swapper_pg_dir[];
74extern struct task_struct *current_set[NR_CPUS]; 74extern struct task_struct *current_set[NR_CPUS];
75 75
76extern pgd_t ioremap_dir[];
77pgd_t * ioremap_pgd = (pgd_t *)&ioremap_dir;
78
79unsigned long klimit = (unsigned long)_end; 76unsigned long klimit = (unsigned long)_end;
80 77
81unsigned long _SDR1=0; 78unsigned long _SDR1=0;
@@ -137,69 +134,6 @@ void iounmap(volatile void __iomem *addr)
137 134
138#else 135#else
139 136
140static void unmap_im_area_pte(pmd_t *pmd, unsigned long addr,
141 unsigned long end)
142{
143 pte_t *pte;
144
145 pte = pte_offset_kernel(pmd, addr);
146 do {
147 pte_t ptent = ptep_get_and_clear(&ioremap_mm, addr, pte);
148 WARN_ON(!pte_none(ptent) && !pte_present(ptent));
149 } while (pte++, addr += PAGE_SIZE, addr != end);
150}
151
152static inline void unmap_im_area_pmd(pud_t *pud, unsigned long addr,
153 unsigned long end)
154{
155 pmd_t *pmd;
156 unsigned long next;
157
158 pmd = pmd_offset(pud, addr);
159 do {
160 next = pmd_addr_end(addr, end);
161 if (pmd_none_or_clear_bad(pmd))
162 continue;
163 unmap_im_area_pte(pmd, addr, next);
164 } while (pmd++, addr = next, addr != end);
165}
166
167static inline void unmap_im_area_pud(pgd_t *pgd, unsigned long addr,
168 unsigned long end)
169{
170 pud_t *pud;
171 unsigned long next;
172
173 pud = pud_offset(pgd, addr);
174 do {
175 next = pud_addr_end(addr, end);
176 if (pud_none_or_clear_bad(pud))
177 continue;
178 unmap_im_area_pmd(pud, addr, next);
179 } while (pud++, addr = next, addr != end);
180}
181
182static void unmap_im_area(unsigned long addr, unsigned long end)
183{
184 struct mm_struct *mm = &ioremap_mm;
185 unsigned long next;
186 pgd_t *pgd;
187
188 spin_lock(&mm->page_table_lock);
189
190 pgd = pgd_offset_i(addr);
191 flush_cache_vunmap(addr, end);
192 do {
193 next = pgd_addr_end(addr, end);
194 if (pgd_none_or_clear_bad(pgd))
195 continue;
196 unmap_im_area_pud(pgd, addr, next);
197 } while (pgd++, addr = next, addr != end);
198 flush_tlb_kernel_range(start, end);
199
200 spin_unlock(&mm->page_table_lock);
201}
202
203/* 137/*
204 * map_io_page currently only called by __ioremap 138 * map_io_page currently only called by __ioremap
205 * map_io_page adds an entry to the ioremap page table 139 * map_io_page adds an entry to the ioremap page table
@@ -214,21 +148,21 @@ static int map_io_page(unsigned long ea, unsigned long pa, int flags)
214 unsigned long vsid; 148 unsigned long vsid;
215 149
216 if (mem_init_done) { 150 if (mem_init_done) {
217 spin_lock(&ioremap_mm.page_table_lock); 151 spin_lock(&init_mm.page_table_lock);
218 pgdp = pgd_offset_i(ea); 152 pgdp = pgd_offset_k(ea);
219 pudp = pud_alloc(&ioremap_mm, pgdp, ea); 153 pudp = pud_alloc(&init_mm, pgdp, ea);
220 if (!pudp) 154 if (!pudp)
221 return -ENOMEM; 155 return -ENOMEM;
222 pmdp = pmd_alloc(&ioremap_mm, pudp, ea); 156 pmdp = pmd_alloc(&init_mm, pudp, ea);
223 if (!pmdp) 157 if (!pmdp)
224 return -ENOMEM; 158 return -ENOMEM;
225 ptep = pte_alloc_kernel(&ioremap_mm, pmdp, ea); 159 ptep = pte_alloc_kernel(&init_mm, pmdp, ea);
226 if (!ptep) 160 if (!ptep)
227 return -ENOMEM; 161 return -ENOMEM;
228 pa = abs_to_phys(pa); 162 pa = abs_to_phys(pa);
229 set_pte_at(&ioremap_mm, ea, ptep, pfn_pte(pa >> PAGE_SHIFT, 163 set_pte_at(&init_mm, ea, ptep, pfn_pte(pa >> PAGE_SHIFT,
230 __pgprot(flags))); 164 __pgprot(flags)));
231 spin_unlock(&ioremap_mm.page_table_lock); 165 spin_unlock(&init_mm.page_table_lock);
232 } else { 166 } else {
233 unsigned long va, vpn, hash, hpteg; 167 unsigned long va, vpn, hash, hpteg;
234 168
@@ -267,13 +201,9 @@ static void __iomem * __ioremap_com(unsigned long addr, unsigned long pa,
267 201
268 for (i = 0; i < size; i += PAGE_SIZE) 202 for (i = 0; i < size; i += PAGE_SIZE)
269 if (map_io_page(ea+i, pa+i, flags)) 203 if (map_io_page(ea+i, pa+i, flags))
270 goto failure; 204 return NULL;
271 205
272 return (void __iomem *) (ea + (addr & ~PAGE_MASK)); 206 return (void __iomem *) (ea + (addr & ~PAGE_MASK));
273 failure:
274 if (mem_init_done)
275 unmap_im_area(ea, ea + size);
276 return NULL;
277} 207}
278 208
279 209
@@ -381,19 +311,14 @@ int __ioremap_explicit(unsigned long pa, unsigned long ea,
381 */ 311 */
382void iounmap(volatile void __iomem *token) 312void iounmap(volatile void __iomem *token)
383{ 313{
384 unsigned long address, size;
385 void *addr; 314 void *addr;
386 315
387 if (!mem_init_done) 316 if (!mem_init_done)
388 return; 317 return;
389 318
390 addr = (void *) ((unsigned long __force) token & PAGE_MASK); 319 addr = (void *) ((unsigned long __force) token & PAGE_MASK);
391
392 if ((size = im_free(addr)) == 0)
393 return;
394 320
395 address = (unsigned long)addr; 321 im_free(addr);
396 unmap_im_area(address, address + size);
397} 322}
398 323
399static int iounmap_subset_regions(unsigned long addr, unsigned long size) 324static int iounmap_subset_regions(unsigned long addr, unsigned long size)
diff --git a/arch/ppc64/xmon/xmon.c b/arch/ppc64/xmon/xmon.c
index 3c0ccb2623ae..7f6e13a4b71e 100644
--- a/arch/ppc64/xmon/xmon.c
+++ b/arch/ppc64/xmon/xmon.c
@@ -2247,7 +2247,14 @@ scanhex(unsigned long *vp)
2247 tmpstr[i] = c; 2247 tmpstr[i] = c;
2248 } 2248 }
2249 tmpstr[i++] = 0; 2249 tmpstr[i++] = 0;
2250 *vp = kallsyms_lookup_name(tmpstr); 2250 *vp = 0;
2251 if (setjmp(bus_error_jmp) == 0) {
2252 catch_memory_errors = 1;
2253 sync();
2254 *vp = kallsyms_lookup_name(tmpstr);
2255 sync();
2256 }
2257 catch_memory_errors = 0;
2251 if (!(*vp)) { 2258 if (!(*vp)) {
2252 printf("unknown symbol '%s'\n", tmpstr); 2259 printf("unknown symbol '%s'\n", tmpstr);
2253 return 0; 2260 return 0;
diff --git a/arch/s390/kernel/compat_ioctl.c b/arch/s390/kernel/compat_ioctl.c
index 03d03c6d3cbb..24a1e9f069a7 100644
--- a/arch/s390/kernel/compat_ioctl.c
+++ b/arch/s390/kernel/compat_ioctl.c
@@ -42,7 +42,6 @@ struct ioctl_trans ioctl_start[] = {
42#include "../../../fs/compat_ioctl.c" 42#include "../../../fs/compat_ioctl.c"
43 43
44/* s390 only ioctls */ 44/* s390 only ioctls */
45#if defined(CONFIG_DASD) || defined(CONFIG_DASD_MODULE)
46COMPATIBLE_IOCTL(DASDAPIVER) 45COMPATIBLE_IOCTL(DASDAPIVER)
47COMPATIBLE_IOCTL(BIODASDDISABLE) 46COMPATIBLE_IOCTL(BIODASDDISABLE)
48COMPATIBLE_IOCTL(BIODASDENABLE) 47COMPATIBLE_IOCTL(BIODASDENABLE)
@@ -59,16 +58,11 @@ COMPATIBLE_IOCTL(BIODASDPRRD)
59COMPATIBLE_IOCTL(BIODASDPSRD) 58COMPATIBLE_IOCTL(BIODASDPSRD)
60COMPATIBLE_IOCTL(BIODASDGATTR) 59COMPATIBLE_IOCTL(BIODASDGATTR)
61COMPATIBLE_IOCTL(BIODASDSATTR) 60COMPATIBLE_IOCTL(BIODASDSATTR)
62#if defined(CONFIG_DASD_CMB) || defined(CONFIG_DASD_CMB_MODULE)
63COMPATIBLE_IOCTL(BIODASDCMFENABLE) 61COMPATIBLE_IOCTL(BIODASDCMFENABLE)
64COMPATIBLE_IOCTL(BIODASDCMFDISABLE) 62COMPATIBLE_IOCTL(BIODASDCMFDISABLE)
65COMPATIBLE_IOCTL(BIODASDREADALLCMB) 63COMPATIBLE_IOCTL(BIODASDREADALLCMB)
66#endif
67#endif
68 64
69#if defined(CONFIG_S390_TAPE) || defined(CONFIG_S390_TAPE_MODULE)
70COMPATIBLE_IOCTL(TAPE390_DISPLAY) 65COMPATIBLE_IOCTL(TAPE390_DISPLAY)
71#endif
72 66
73/* s390 doesn't need handlers here */ 67/* s390 doesn't need handlers here */
74COMPATIBLE_IOCTL(TIOCGSERIAL) 68COMPATIBLE_IOCTL(TIOCGSERIAL)
diff --git a/arch/s390/kernel/head.S b/arch/s390/kernel/head.S
index b804c55bd919..fc8bf5e285f6 100644
--- a/arch/s390/kernel/head.S
+++ b/arch/s390/kernel/head.S
@@ -345,10 +345,25 @@ iplstart:
345 bno .Lnoreset 345 bno .Lnoreset
346 la %r2,.Lreset 346 la %r2,.Lreset
347 lhi %r3,26 347 lhi %r3,26
348 .long 0x83230008 348 diag %r2,%r3,8
349 mvc 0x78(8),.Lrdrnewpsw # set up IO interrupt psw
350.Lwaitrdrirq:
351 lpsw .Lrdrwaitpsw
352.Lrdrint:
353 c %r1,0xb8 # compare subchannel number
354 bne .Lwaitrdrirq
355 la %r5,.Lirb
356 tsch 0(%r5)
349.Lnoreset: 357.Lnoreset:
358 b .Lnoload
359
360 .align 8
361.Lrdrnewpsw:
362 .long 0x00080000,0x80000000+.Lrdrint
363.Lrdrwaitpsw:
364 .long 0x020a0000,0x80000000+.Lrdrint
350#endif 365#endif
351 366
352# 367#
353# everything loaded, go for it 368# everything loaded, go for it
354# 369#
@@ -517,10 +532,10 @@ startup:basr %r13,0 # get base
517 l %r2, .Lrcp2-.LPG1(%r13) # try with Read SCP 532 l %r2, .Lrcp2-.LPG1(%r13) # try with Read SCP
518 b .Lservicecall-.LPG1(%r13) 533 b .Lservicecall-.LPG1(%r13)
519.Lprocsccb: 534.Lprocsccb:
520 lh %r1,.Lscpincr1-PARMAREA(%r4) # use this one if != 0 535 lhi %r1,0
521 chi %r1,0x00 536 icm %r1,3,.Lscpincr1-PARMAREA(%r4) # use this one if != 0
522 jne .Lscnd 537 jnz .Lscnd
523 l %r1,.Lscpincr2-PARMAREA(%r4) # otherwise use this one 538 l %r1,.Lscpincr2-PARMAREA+4(%r4) # otherwise use this one
524.Lscnd: 539.Lscnd:
525 xr %r3,%r3 # same logic 540 xr %r3,%r3 # same logic
526 ic %r3,.Lscpa1-PARMAREA(%r4) 541 ic %r3,.Lscpa1-PARMAREA(%r4)
diff --git a/arch/s390/kernel/head64.S b/arch/s390/kernel/head64.S
index 8366793bc371..f525c0c21250 100644
--- a/arch/s390/kernel/head64.S
+++ b/arch/s390/kernel/head64.S
@@ -344,10 +344,25 @@ iplstart:
344 bno .Lnoreset 344 bno .Lnoreset
345 la %r2,.Lreset 345 la %r2,.Lreset
346 lhi %r3,26 346 lhi %r3,26
347 .long 0x83230008 347 diag %r2,%r3,8
348 mvc 0x78(8),.Lrdrnewpsw # set up IO interrupt psw
349.Lwaitrdrirq:
350 lpsw .Lrdrwaitpsw
351.Lrdrint:
352 c %r1,0xb8 # compare subchannel number
353 bne .Lwaitrdrirq
354 la %r5,.Lirb
355 tsch 0(%r5)
348.Lnoreset: 356.Lnoreset:
357 b .Lnoload
358
359 .align 8
360.Lrdrnewpsw:
361 .long 0x00080000,0x80000000+.Lrdrint
362.Lrdrwaitpsw:
363 .long 0x020a0000,0x80000000+.Lrdrint
349#endif 364#endif
350 365
351# 366#
352# everything loaded, go for it 367# everything loaded, go for it
353# 368#
@@ -518,9 +533,9 @@ startup:basr %r13,0 # get base
518 l %r2,.Lrcp2-.LPG1(%r13) # try with Read SCP 533 l %r2,.Lrcp2-.LPG1(%r13) # try with Read SCP
519 b .Lservicecall-.LPG1(%r13) 534 b .Lservicecall-.LPG1(%r13)
520.Lprocsccb: 535.Lprocsccb:
521 lh %r1,.Lscpincr1-PARMAREA(%r4) # use this one if != 0 536 lghi %r1,0
522 chi %r1,0x00 537 icm %r1,3,.Lscpincr1-PARMAREA(%r4) # use this one if != 0
523 jne .Lscnd 538 jnz .Lscnd
524 lg %r1,.Lscpincr2-PARMAREA(%r4) # otherwise use this one 539 lg %r1,.Lscpincr2-PARMAREA(%r4) # otherwise use this one
525.Lscnd: 540.Lscnd:
526 xr %r3,%r3 # same logic 541 xr %r3,%r3 # same logic
diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c
index 8b90e9528b91..ca34b6f34b38 100644
--- a/arch/s390/kernel/traps.c
+++ b/arch/s390/kernel/traps.c
@@ -668,7 +668,10 @@ asmlinkage void space_switch_exception(struct pt_regs * regs, long int_code)
668 668
669asmlinkage void kernel_stack_overflow(struct pt_regs * regs) 669asmlinkage void kernel_stack_overflow(struct pt_regs * regs)
670{ 670{
671 die("Kernel stack overflow", regs, 0); 671 bust_spinlocks(1);
672 printk("Kernel stack overflow.\n");
673 show_regs(regs);
674 bust_spinlocks(0);
672 panic("Corrupt kernel stack, can't continue."); 675 panic("Corrupt kernel stack, can't continue.");
673} 676}
674 677
diff --git a/arch/s390/mm/cmm.c b/arch/s390/mm/cmm.c
index f5a5bc09b8fa..2d5cb1385753 100644
--- a/arch/s390/mm/cmm.c
+++ b/arch/s390/mm/cmm.c
@@ -21,7 +21,7 @@
21#include <asm/uaccess.h> 21#include <asm/uaccess.h>
22 22
23static char *sender = "VMRMSVM"; 23static char *sender = "VMRMSVM";
24module_param(sender, charp, 0); 24module_param(sender, charp, 0400);
25MODULE_PARM_DESC(sender, 25MODULE_PARM_DESC(sender,
26 "Guest name that may send SMSG messages (default VMRMSVM)"); 26 "Guest name that may send SMSG messages (default VMRMSVM)");
27 27
diff --git a/arch/sh/kernel/sys_sh.c b/arch/sh/kernel/sys_sh.c
index df5ac294c379..917b2f32f260 100644
--- a/arch/sh/kernel/sys_sh.c
+++ b/arch/sh/kernel/sys_sh.c
@@ -79,6 +79,10 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
79 (!vma || addr + len <= vma->vm_start)) 79 (!vma || addr + len <= vma->vm_start))
80 return addr; 80 return addr;
81 } 81 }
82 if (len <= mm->cached_hole_size) {
83 mm->cached_hole_size = 0;
84 mm->free_area_cache = TASK_UNMAPPED_BASE;
85 }
82 if (flags & MAP_PRIVATE) 86 if (flags & MAP_PRIVATE)
83 addr = PAGE_ALIGN(mm->free_area_cache); 87 addr = PAGE_ALIGN(mm->free_area_cache);
84 else 88 else
@@ -95,6 +99,7 @@ full_search:
95 */ 99 */
96 if (start_addr != TASK_UNMAPPED_BASE) { 100 if (start_addr != TASK_UNMAPPED_BASE) {
97 start_addr = addr = TASK_UNMAPPED_BASE; 101 start_addr = addr = TASK_UNMAPPED_BASE;
102 mm->cached_hole_size = 0;
98 goto full_search; 103 goto full_search;
99 } 104 }
100 return -ENOMEM; 105 return -ENOMEM;
@@ -106,6 +111,9 @@ full_search:
106 mm->free_area_cache = addr + len; 111 mm->free_area_cache = addr + len;
107 return addr; 112 return addr;
108 } 113 }
114 if (addr + mm->cached_hole_size < vma->vm_start)
115 mm->cached_hole_size = vma->vm_start - addr;
116
109 addr = vma->vm_end; 117 addr = vma->vm_end;
110 if (!(flags & MAP_PRIVATE)) 118 if (!(flags & MAP_PRIVATE))
111 addr = COLOUR_ALIGN(addr); 119 addr = COLOUR_ALIGN(addr);
diff --git a/arch/sh/lib/delay.c b/arch/sh/lib/delay.c
index 50b36037d86b..351714694d6d 100644
--- a/arch/sh/lib/delay.c
+++ b/arch/sh/lib/delay.c
@@ -24,7 +24,7 @@ inline void __const_udelay(unsigned long xloops)
24 __asm__("dmulu.l %0, %2\n\t" 24 __asm__("dmulu.l %0, %2\n\t"
25 "sts mach, %0" 25 "sts mach, %0"
26 : "=r" (xloops) 26 : "=r" (xloops)
27 : "0" (xloops), "r" (cpu_data[_smp_processor_id()].loops_per_jiffy) 27 : "0" (xloops), "r" (cpu_data[raw_smp_processor_id()].loops_per_jiffy)
28 : "macl", "mach"); 28 : "macl", "mach");
29 __delay(xloops * HZ); 29 __delay(xloops * HZ);
30} 30}
diff --git a/arch/sh/mm/hugetlbpage.c b/arch/sh/mm/hugetlbpage.c
index 1f897bab2318..95bb1a6c6060 100644
--- a/arch/sh/mm/hugetlbpage.c
+++ b/arch/sh/mm/hugetlbpage.c
@@ -24,7 +24,7 @@
24#include <asm/tlbflush.h> 24#include <asm/tlbflush.h>
25#include <asm/cacheflush.h> 25#include <asm/cacheflush.h>
26 26
27static pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr) 27pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr)
28{ 28{
29 pgd_t *pgd; 29 pgd_t *pgd;
30 pmd_t *pmd; 30 pmd_t *pmd;
@@ -39,7 +39,7 @@ static pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr)
39 return pte; 39 return pte;
40} 40}
41 41
42static pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr) 42pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
43{ 43{
44 pgd_t *pgd; 44 pgd_t *pgd;
45 pmd_t *pmd; 45 pmd_t *pmd;
@@ -56,28 +56,34 @@ static pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
56 56
57#define mk_pte_huge(entry) do { pte_val(entry) |= _PAGE_SZHUGE; } while (0) 57#define mk_pte_huge(entry) do { pte_val(entry) |= _PAGE_SZHUGE; } while (0)
58 58
59static void set_huge_pte(struct mm_struct *mm, struct vm_area_struct *vma, 59void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
60 struct page *page, pte_t * page_table, int write_access) 60 pte_t *ptep, pte_t entry)
61{ 61{
62 unsigned long i; 62 int i;
63 pte_t entry;
64 63
65 add_mm_counter(mm, rss, HPAGE_SIZE / PAGE_SIZE); 64 for (i = 0; i < (1 << HUGETLB_PAGE_ORDER); i++) {
65 set_pte_at(mm, addr, ptep, entry);
66 ptep++;
67 addr += PAGE_SIZE;
68 pte_val(entry) += PAGE_SIZE;
69 }
70}
66 71
67 if (write_access) 72pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
68 entry = pte_mkwrite(pte_mkdirty(mk_pte(page, 73 pte_t *ptep)
69 vma->vm_page_prot))); 74{
70 else 75 pte_t entry;
71 entry = pte_wrprotect(mk_pte(page, vma->vm_page_prot)); 76 int i;
72 entry = pte_mkyoung(entry);
73 mk_pte_huge(entry);
74 77
75 for (i = 0; i < (1 << HUGETLB_PAGE_ORDER); i++) { 78 entry = *ptep;
76 set_pte(page_table, entry);
77 page_table++;
78 79
79 pte_val(entry) += PAGE_SIZE; 80 for (i = 0; i < (1 << HUGETLB_PAGE_ORDER); i++) {
81 pte_clear(mm, addr, ptep);
82 addr += PAGE_SIZE;
83 ptep++;
80 } 84 }
85
86 return entry;
81} 87}
82 88
83/* 89/*
@@ -92,79 +98,6 @@ int is_aligned_hugepage_range(unsigned long addr, unsigned long len)
92 return 0; 98 return 0;
93} 99}
94 100
95int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src,
96 struct vm_area_struct *vma)
97{
98 pte_t *src_pte, *dst_pte, entry;
99 struct page *ptepage;
100 unsigned long addr = vma->vm_start;
101 unsigned long end = vma->vm_end;
102 int i;
103
104 while (addr < end) {
105 dst_pte = huge_pte_alloc(dst, addr);
106 if (!dst_pte)
107 goto nomem;
108 src_pte = huge_pte_offset(src, addr);
109 BUG_ON(!src_pte || pte_none(*src_pte));
110 entry = *src_pte;
111 ptepage = pte_page(entry);
112 get_page(ptepage);
113 for (i = 0; i < (1 << HUGETLB_PAGE_ORDER); i++) {
114 set_pte(dst_pte, entry);
115 pte_val(entry) += PAGE_SIZE;
116 dst_pte++;
117 }
118 add_mm_counter(dst, rss, HPAGE_SIZE / PAGE_SIZE);
119 addr += HPAGE_SIZE;
120 }
121 return 0;
122
123nomem:
124 return -ENOMEM;
125}
126
127int follow_hugetlb_page(struct mm_struct *mm, struct vm_area_struct *vma,
128 struct page **pages, struct vm_area_struct **vmas,
129 unsigned long *position, int *length, int i)
130{
131 unsigned long vaddr = *position;
132 int remainder = *length;
133
134 WARN_ON(!is_vm_hugetlb_page(vma));
135
136 while (vaddr < vma->vm_end && remainder) {
137 if (pages) {
138 pte_t *pte;
139 struct page *page;
140
141 pte = huge_pte_offset(mm, vaddr);
142
143 /* hugetlb should be locked, and hence, prefaulted */
144 BUG_ON(!pte || pte_none(*pte));
145
146 page = pte_page(*pte);
147
148 WARN_ON(!PageCompound(page));
149
150 get_page(page);
151 pages[i] = page;
152 }
153
154 if (vmas)
155 vmas[i] = vma;
156
157 vaddr += PAGE_SIZE;
158 --remainder;
159 ++i;
160 }
161
162 *length = remainder;
163 *position = vaddr;
164
165 return i;
166}
167
168struct page *follow_huge_addr(struct mm_struct *mm, 101struct page *follow_huge_addr(struct mm_struct *mm,
169 unsigned long address, int write) 102 unsigned long address, int write)
170{ 103{
@@ -181,84 +114,3 @@ struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address,
181{ 114{
182 return NULL; 115 return NULL;
183} 116}
184
185void unmap_hugepage_range(struct vm_area_struct *vma,
186 unsigned long start, unsigned long end)
187{
188 struct mm_struct *mm = vma->vm_mm;
189 unsigned long address;
190 pte_t *pte;
191 struct page *page;
192 int i;
193
194 BUG_ON(start & (HPAGE_SIZE - 1));
195 BUG_ON(end & (HPAGE_SIZE - 1));
196
197 for (address = start; address < end; address += HPAGE_SIZE) {
198 pte = huge_pte_offset(mm, address);
199 BUG_ON(!pte);
200 if (pte_none(*pte))
201 continue;
202 page = pte_page(*pte);
203 put_page(page);
204 for (i = 0; i < (1 << HUGETLB_PAGE_ORDER); i++) {
205 pte_clear(mm, address+(i*PAGE_SIZE), pte);
206 pte++;
207 }
208 }
209 add_mm_counter(mm, rss, -((end - start) >> PAGE_SHIFT));
210 flush_tlb_range(vma, start, end);
211}
212
213int hugetlb_prefault(struct address_space *mapping, struct vm_area_struct *vma)
214{
215 struct mm_struct *mm = current->mm;
216 unsigned long addr;
217 int ret = 0;
218
219 BUG_ON(vma->vm_start & ~HPAGE_MASK);
220 BUG_ON(vma->vm_end & ~HPAGE_MASK);
221
222 spin_lock(&mm->page_table_lock);
223 for (addr = vma->vm_start; addr < vma->vm_end; addr += HPAGE_SIZE) {
224 unsigned long idx;
225 pte_t *pte = huge_pte_alloc(mm, addr);
226 struct page *page;
227
228 if (!pte) {
229 ret = -ENOMEM;
230 goto out;
231 }
232 if (!pte_none(*pte))
233 continue;
234
235 idx = ((addr - vma->vm_start) >> HPAGE_SHIFT)
236 + (vma->vm_pgoff >> (HPAGE_SHIFT - PAGE_SHIFT));
237 page = find_get_page(mapping, idx);
238 if (!page) {
239 /* charge the fs quota first */
240 if (hugetlb_get_quota(mapping)) {
241 ret = -ENOMEM;
242 goto out;
243 }
244 page = alloc_huge_page();
245 if (!page) {
246 hugetlb_put_quota(mapping);
247 ret = -ENOMEM;
248 goto out;
249 }
250 ret = add_to_page_cache(page, mapping, idx, GFP_ATOMIC);
251 if (! ret) {
252 unlock_page(page);
253 } else {
254 hugetlb_put_quota(mapping);
255 free_huge_page(page);
256 goto out;
257 }
258 }
259 set_huge_pte(mm, vma, page, pte, vma->vm_flags & VM_WRITE);
260 }
261out:
262 spin_unlock(&mm->page_table_lock);
263 return ret;
264}
diff --git a/arch/sh64/mm/hugetlbpage.c b/arch/sh64/mm/hugetlbpage.c
index bcad2aefa4ee..dcd9c8a8baf8 100644
--- a/arch/sh64/mm/hugetlbpage.c
+++ b/arch/sh64/mm/hugetlbpage.c
@@ -24,7 +24,7 @@
24#include <asm/tlbflush.h> 24#include <asm/tlbflush.h>
25#include <asm/cacheflush.h> 25#include <asm/cacheflush.h>
26 26
27static pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr) 27pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr)
28{ 28{
29 pgd_t *pgd; 29 pgd_t *pgd;
30 pmd_t *pmd; 30 pmd_t *pmd;
@@ -39,7 +39,7 @@ static pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr)
39 return pte; 39 return pte;
40} 40}
41 41
42static pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr) 42pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
43{ 43{
44 pgd_t *pgd; 44 pgd_t *pgd;
45 pmd_t *pmd; 45 pmd_t *pmd;
@@ -80,6 +80,20 @@ static void set_huge_pte(struct mm_struct *mm, struct vm_area_struct *vma,
80 } 80 }
81} 81}
82 82
83pte_t huge_ptep_get_and_clear(pte_t *ptep)
84{
85 pte_t entry;
86
87 entry = *ptep;
88
89 for (i = 0; i < (1 << HUGETLB_PAGE_ORDER); i++) {
90 pte_clear(pte);
91 pte++;
92 }
93
94 return entry;
95}
96
83/* 97/*
84 * This function checks for proper alignment of input addr and len parameters. 98 * This function checks for proper alignment of input addr and len parameters.
85 */ 99 */
diff --git a/arch/sparc/mm/init.c b/arch/sparc/mm/init.c
index a2dea69b2f07..ec2e05028a10 100644
--- a/arch/sparc/mm/init.c
+++ b/arch/sparc/mm/init.c
@@ -384,7 +384,6 @@ void map_high_region(unsigned long start_pfn, unsigned long end_pfn)
384 struct page *page = pfn_to_page(tmp); 384 struct page *page = pfn_to_page(tmp);
385 385
386 ClearPageReserved(page); 386 ClearPageReserved(page);
387 set_bit(PG_highmem, &page->flags);
388 set_page_count(page, 1); 387 set_page_count(page, 1);
389 __free_page(page); 388 __free_page(page);
390 totalhigh_pages++; 389 totalhigh_pages++;
diff --git a/arch/sparc64/kernel/sys_sparc.c b/arch/sparc64/kernel/sys_sparc.c
index 0077f02f4b37..5f8c822a2b4a 100644
--- a/arch/sparc64/kernel/sys_sparc.c
+++ b/arch/sparc64/kernel/sys_sparc.c
@@ -84,6 +84,10 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi
84 return addr; 84 return addr;
85 } 85 }
86 86
87 if (len <= mm->cached_hole_size) {
88 mm->cached_hole_size = 0;
89 mm->free_area_cache = TASK_UNMAPPED_BASE;
90 }
87 start_addr = addr = mm->free_area_cache; 91 start_addr = addr = mm->free_area_cache;
88 92
89 task_size -= len; 93 task_size -= len;
@@ -103,6 +107,7 @@ full_search:
103 if (task_size < addr) { 107 if (task_size < addr) {
104 if (start_addr != TASK_UNMAPPED_BASE) { 108 if (start_addr != TASK_UNMAPPED_BASE) {
105 start_addr = addr = TASK_UNMAPPED_BASE; 109 start_addr = addr = TASK_UNMAPPED_BASE;
110 mm->cached_hole_size = 0;
106 goto full_search; 111 goto full_search;
107 } 112 }
108 return -ENOMEM; 113 return -ENOMEM;
@@ -114,6 +119,9 @@ full_search:
114 mm->free_area_cache = addr + len; 119 mm->free_area_cache = addr + len;
115 return addr; 120 return addr;
116 } 121 }
122 if (addr + mm->cached_hole_size < vma->vm_start)
123 mm->cached_hole_size = vma->vm_start - addr;
124
117 addr = vma->vm_end; 125 addr = vma->vm_end;
118 if (do_color_align) 126 if (do_color_align)
119 addr = COLOUR_ALIGN(addr, pgoff); 127 addr = COLOUR_ALIGN(addr, pgoff);
diff --git a/arch/sparc64/lib/delay.c b/arch/sparc64/lib/delay.c
index f6b4c784d53e..e8808727617a 100644
--- a/arch/sparc64/lib/delay.c
+++ b/arch/sparc64/lib/delay.c
@@ -31,7 +31,7 @@ void __const_udelay(unsigned long n)
31{ 31{
32 n *= 4; 32 n *= 4;
33 33
34 n *= (cpu_data(_smp_processor_id()).udelay_val * (HZ/4)); 34 n *= (cpu_data(raw_smp_processor_id()).udelay_val * (HZ/4));
35 n >>= 32; 35 n >>= 32;
36 36
37 __delay(n + 1); 37 __delay(n + 1);
diff --git a/arch/sparc64/mm/hugetlbpage.c b/arch/sparc64/mm/hugetlbpage.c
index 5a1f831b2de1..625cbb336a23 100644
--- a/arch/sparc64/mm/hugetlbpage.c
+++ b/arch/sparc64/mm/hugetlbpage.c
@@ -22,7 +22,7 @@
22#include <asm/cacheflush.h> 22#include <asm/cacheflush.h>
23#include <asm/mmu_context.h> 23#include <asm/mmu_context.h>
24 24
25static pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr) 25pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr)
26{ 26{
27 pgd_t *pgd; 27 pgd_t *pgd;
28 pud_t *pud; 28 pud_t *pud;
@@ -41,7 +41,7 @@ static pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr)
41 return pte; 41 return pte;
42} 42}
43 43
44static pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr) 44pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
45{ 45{
46 pgd_t *pgd; 46 pgd_t *pgd;
47 pud_t *pud; 47 pud_t *pud;
@@ -62,30 +62,34 @@ static pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
62 62
63#define mk_pte_huge(entry) do { pte_val(entry) |= _PAGE_SZHUGE; } while (0) 63#define mk_pte_huge(entry) do { pte_val(entry) |= _PAGE_SZHUGE; } while (0)
64 64
65static void set_huge_pte(struct mm_struct *mm, struct vm_area_struct *vma, 65void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
66 unsigned long addr, 66 pte_t *ptep, pte_t entry)
67 struct page *page, pte_t * page_table, int write_access)
68{ 67{
69 unsigned long i; 68 int i;
70 pte_t entry; 69
70 for (i = 0; i < (1 << HUGETLB_PAGE_ORDER); i++) {
71 set_pte_at(mm, addr, ptep, entry);
72 ptep++;
73 addr += PAGE_SIZE;
74 pte_val(entry) += PAGE_SIZE;
75 }
76}
71 77
72 add_mm_counter(mm, rss, HPAGE_SIZE / PAGE_SIZE); 78pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
79 pte_t *ptep)
80{
81 pte_t entry;
82 int i;
73 83
74 if (write_access) 84 entry = *ptep;
75 entry = pte_mkwrite(pte_mkdirty(mk_pte(page,
76 vma->vm_page_prot)));
77 else
78 entry = pte_wrprotect(mk_pte(page, vma->vm_page_prot));
79 entry = pte_mkyoung(entry);
80 mk_pte_huge(entry);
81 85
82 for (i = 0; i < (1 << HUGETLB_PAGE_ORDER); i++) { 86 for (i = 0; i < (1 << HUGETLB_PAGE_ORDER); i++) {
83 set_pte_at(mm, addr, page_table, entry); 87 pte_clear(mm, addr, ptep);
84 page_table++;
85 addr += PAGE_SIZE; 88 addr += PAGE_SIZE;
86 89 ptep++;
87 pte_val(entry) += PAGE_SIZE;
88 } 90 }
91
92 return entry;
89} 93}
90 94
91/* 95/*
@@ -100,79 +104,6 @@ int is_aligned_hugepage_range(unsigned long addr, unsigned long len)
100 return 0; 104 return 0;
101} 105}
102 106
103int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src,
104 struct vm_area_struct *vma)
105{
106 pte_t *src_pte, *dst_pte, entry;
107 struct page *ptepage;
108 unsigned long addr = vma->vm_start;
109 unsigned long end = vma->vm_end;
110 int i;
111
112 while (addr < end) {
113 dst_pte = huge_pte_alloc(dst, addr);
114 if (!dst_pte)
115 goto nomem;
116 src_pte = huge_pte_offset(src, addr);
117 BUG_ON(!src_pte || pte_none(*src_pte));
118 entry = *src_pte;
119 ptepage = pte_page(entry);
120 get_page(ptepage);
121 for (i = 0; i < (1 << HUGETLB_PAGE_ORDER); i++) {
122 set_pte_at(dst, addr, dst_pte, entry);
123 pte_val(entry) += PAGE_SIZE;
124 dst_pte++;
125 addr += PAGE_SIZE;
126 }
127 add_mm_counter(dst, rss, HPAGE_SIZE / PAGE_SIZE);
128 }
129 return 0;
130
131nomem:
132 return -ENOMEM;
133}
134
135int follow_hugetlb_page(struct mm_struct *mm, struct vm_area_struct *vma,
136 struct page **pages, struct vm_area_struct **vmas,
137 unsigned long *position, int *length, int i)
138{
139 unsigned long vaddr = *position;
140 int remainder = *length;
141
142 WARN_ON(!is_vm_hugetlb_page(vma));
143
144 while (vaddr < vma->vm_end && remainder) {
145 if (pages) {
146 pte_t *pte;
147 struct page *page;
148
149 pte = huge_pte_offset(mm, vaddr);
150
151 /* hugetlb should be locked, and hence, prefaulted */
152 BUG_ON(!pte || pte_none(*pte));
153
154 page = pte_page(*pte);
155
156 WARN_ON(!PageCompound(page));
157
158 get_page(page);
159 pages[i] = page;
160 }
161
162 if (vmas)
163 vmas[i] = vma;
164
165 vaddr += PAGE_SIZE;
166 --remainder;
167 ++i;
168 }
169
170 *length = remainder;
171 *position = vaddr;
172
173 return i;
174}
175
176struct page *follow_huge_addr(struct mm_struct *mm, 107struct page *follow_huge_addr(struct mm_struct *mm,
177 unsigned long address, int write) 108 unsigned long address, int write)
178{ 109{
@@ -190,34 +121,6 @@ struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address,
190 return NULL; 121 return NULL;
191} 122}
192 123
193void unmap_hugepage_range(struct vm_area_struct *vma,
194 unsigned long start, unsigned long end)
195{
196 struct mm_struct *mm = vma->vm_mm;
197 unsigned long address;
198 pte_t *pte;
199 struct page *page;
200 int i;
201
202 BUG_ON(start & (HPAGE_SIZE - 1));
203 BUG_ON(end & (HPAGE_SIZE - 1));
204
205 for (address = start; address < end; address += HPAGE_SIZE) {
206 pte = huge_pte_offset(mm, address);
207 BUG_ON(!pte);
208 if (pte_none(*pte))
209 continue;
210 page = pte_page(*pte);
211 put_page(page);
212 for (i = 0; i < (1 << HUGETLB_PAGE_ORDER); i++) {
213 pte_clear(mm, address+(i*PAGE_SIZE), pte);
214 pte++;
215 }
216 }
217 add_mm_counter(mm, rss, -((end - start) >> PAGE_SHIFT));
218 flush_tlb_range(vma, start, end);
219}
220
221static void context_reload(void *__data) 124static void context_reload(void *__data)
222{ 125{
223 struct mm_struct *mm = __data; 126 struct mm_struct *mm = __data;
@@ -226,12 +129,8 @@ static void context_reload(void *__data)
226 load_secondary_context(mm); 129 load_secondary_context(mm);
227} 130}
228 131
229int hugetlb_prefault(struct address_space *mapping, struct vm_area_struct *vma) 132void hugetlb_prefault_arch_hook(struct mm_struct *mm)
230{ 133{
231 struct mm_struct *mm = current->mm;
232 unsigned long addr;
233 int ret = 0;
234
235 /* On UltraSPARC-III+ and later, configure the second half of 134 /* On UltraSPARC-III+ and later, configure the second half of
236 * the Data-TLB for huge pages. 135 * the Data-TLB for huge pages.
237 */ 136 */
@@ -261,50 +160,4 @@ int hugetlb_prefault(struct address_space *mapping, struct vm_area_struct *vma)
261 } 160 }
262 spin_unlock(&ctx_alloc_lock); 161 spin_unlock(&ctx_alloc_lock);
263 } 162 }
264
265 BUG_ON(vma->vm_start & ~HPAGE_MASK);
266 BUG_ON(vma->vm_end & ~HPAGE_MASK);
267
268 spin_lock(&mm->page_table_lock);
269 for (addr = vma->vm_start; addr < vma->vm_end; addr += HPAGE_SIZE) {
270 unsigned long idx;
271 pte_t *pte = huge_pte_alloc(mm, addr);
272 struct page *page;
273
274 if (!pte) {
275 ret = -ENOMEM;
276 goto out;
277 }
278 if (!pte_none(*pte))
279 continue;
280
281 idx = ((addr - vma->vm_start) >> HPAGE_SHIFT)
282 + (vma->vm_pgoff >> (HPAGE_SHIFT - PAGE_SHIFT));
283 page = find_get_page(mapping, idx);
284 if (!page) {
285 /* charge the fs quota first */
286 if (hugetlb_get_quota(mapping)) {
287 ret = -ENOMEM;
288 goto out;
289 }
290 page = alloc_huge_page();
291 if (!page) {
292 hugetlb_put_quota(mapping);
293 ret = -ENOMEM;
294 goto out;
295 }
296 ret = add_to_page_cache(page, mapping, idx, GFP_ATOMIC);
297 if (! ret) {
298 unlock_page(page);
299 } else {
300 hugetlb_put_quota(mapping);
301 free_huge_page(page);
302 goto out;
303 }
304 }
305 set_huge_pte(mm, vma, addr, page, pte, vma->vm_flags & VM_WRITE);
306 }
307out:
308 spin_unlock(&mm->page_table_lock);
309 return ret;
310} 163}
diff --git a/arch/sparc64/solaris/socket.c b/arch/sparc64/solaris/socket.c
index ec8e074c4eac..06740582717e 100644
--- a/arch/sparc64/solaris/socket.c
+++ b/arch/sparc64/solaris/socket.c
@@ -317,8 +317,10 @@ asmlinkage int solaris_sendmsg(int fd, struct sol_nmsghdr __user *user_msg, unsi
317 unsigned long *kcmsg; 317 unsigned long *kcmsg;
318 compat_size_t cmlen; 318 compat_size_t cmlen;
319 319
320 if(kern_msg.msg_controllen > sizeof(ctl) && 320 if (kern_msg.msg_controllen <= sizeof(compat_size_t))
321 kern_msg.msg_controllen <= 256) { 321 return -EINVAL;
322
323 if(kern_msg.msg_controllen > sizeof(ctl)) {
322 err = -ENOBUFS; 324 err = -ENOBUFS;
323 ctl_buf = kmalloc(kern_msg.msg_controllen, GFP_KERNEL); 325 ctl_buf = kmalloc(kern_msg.msg_controllen, GFP_KERNEL);
324 if(!ctl_buf) 326 if(!ctl_buf)
diff --git a/arch/um/Kconfig b/arch/um/Kconfig
index c5292181a664..b8e952c88fd1 100644
--- a/arch/um/Kconfig
+++ b/arch/um/Kconfig
@@ -35,6 +35,11 @@ config GENERIC_CALIBRATE_DELAY
35 bool 35 bool
36 default y 36 default y
37 37
38# Used in kernel/irq/manage.c and include/linux/irq.h
39config IRQ_RELEASE_METHOD
40 bool
41 default y
42
38menu "UML-specific options" 43menu "UML-specific options"
39 44
40config MODE_TT 45config MODE_TT
diff --git a/arch/um/Makefile b/arch/um/Makefile
index f2a0c40a9204..3f073902351f 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -122,7 +122,7 @@ endif
122CPPFLAGS_vmlinux.lds = $(shell echo -U$(SUBARCH) \ 122CPPFLAGS_vmlinux.lds = $(shell echo -U$(SUBARCH) \
123 -DSTART=$(START) -DELF_ARCH=$(ELF_ARCH) \ 123 -DSTART=$(START) -DELF_ARCH=$(ELF_ARCH) \
124 -DELF_FORMAT=\"$(ELF_FORMAT)\" $(CPP_MODE-y) \ 124 -DELF_FORMAT=\"$(ELF_FORMAT)\" $(CPP_MODE-y) \
125 -DKERNEL_STACK_SIZE=$(STACK_SIZE)) 125 -DKERNEL_STACK_SIZE=$(STACK_SIZE) -DSUBARCH=$(SUBARCH))
126 126
127#The wrappers will select whether using "malloc" or the kernel allocator. 127#The wrappers will select whether using "malloc" or the kernel allocator.
128LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc 128LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc
diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
index 025d3be8aca4..0f59736db329 100644
--- a/arch/um/drivers/line.c
+++ b/arch/um/drivers/line.c
@@ -406,14 +406,12 @@ void line_disable(struct tty_struct *tty, int current_irq)
406 if(line->driver->read_irq == current_irq) 406 if(line->driver->read_irq == current_irq)
407 free_irq_later(line->driver->read_irq, tty); 407 free_irq_later(line->driver->read_irq, tty);
408 else { 408 else {
409 free_irq_by_irq_and_dev(line->driver->read_irq, tty);
410 free_irq(line->driver->read_irq, tty); 409 free_irq(line->driver->read_irq, tty);
411 } 410 }
412 411
413 if(line->driver->write_irq == current_irq) 412 if(line->driver->write_irq == current_irq)
414 free_irq_later(line->driver->write_irq, tty); 413 free_irq_later(line->driver->write_irq, tty);
415 else { 414 else {
416 free_irq_by_irq_and_dev(line->driver->write_irq, tty);
417 free_irq(line->driver->write_irq, tty); 415 free_irq(line->driver->write_irq, tty);
418 } 416 }
419 417
@@ -758,7 +756,6 @@ static void unregister_winch(struct tty_struct *tty)
758 if(winch->pid != -1) 756 if(winch->pid != -1)
759 os_kill_process(winch->pid, 1); 757 os_kill_process(winch->pid, 1);
760 758
761 free_irq_by_irq_and_dev(WINCH_IRQ, winch);
762 free_irq(WINCH_IRQ, winch); 759 free_irq(WINCH_IRQ, winch);
763 list_del(&winch->list); 760 list_del(&winch->list);
764 kfree(winch); 761 kfree(winch);
diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c
index 4eeaf88c1e97..5388a7428691 100644
--- a/arch/um/drivers/net_kern.c
+++ b/arch/um/drivers/net_kern.c
@@ -146,7 +146,6 @@ static int uml_net_close(struct net_device *dev)
146 netif_stop_queue(dev); 146 netif_stop_queue(dev);
147 spin_lock(&lp->lock); 147 spin_lock(&lp->lock);
148 148
149 free_irq_by_irq_and_dev(dev->irq, dev);
150 free_irq(dev->irq, dev); 149 free_irq(dev->irq, dev);
151 if(lp->close != NULL) 150 if(lp->close != NULL)
152 (*lp->close)(lp->fd, &lp->user); 151 (*lp->close)(lp->fd, &lp->user);
diff --git a/arch/um/drivers/port_kern.c b/arch/um/drivers/port_kern.c
index b5ee07472f79..c41efd207fcc 100644
--- a/arch/um/drivers/port_kern.c
+++ b/arch/um/drivers/port_kern.c
@@ -257,7 +257,6 @@ int port_wait(void *data)
257 * connection. Then we loop here throwing out failed 257 * connection. Then we loop here throwing out failed
258 * connections until a good one is found. 258 * connections until a good one is found.
259 */ 259 */
260 free_irq_by_irq_and_dev(TELNETD_IRQ, conn);
261 free_irq(TELNETD_IRQ, conn); 260 free_irq(TELNETD_IRQ, conn);
262 261
263 if(conn->fd >= 0) break; 262 if(conn->fd >= 0) break;
diff --git a/arch/um/drivers/xterm_kern.c b/arch/um/drivers/xterm_kern.c
index a4fdf3584ad2..d269a80f4b0c 100644
--- a/arch/um/drivers/xterm_kern.c
+++ b/arch/um/drivers/xterm_kern.c
@@ -69,7 +69,6 @@ int xterm_fd(int socket, int *pid_out)
69 * isn't set) this will hang... */ 69 * isn't set) this will hang... */
70 wait_for_completion(&data->ready); 70 wait_for_completion(&data->ready);
71 71
72 free_irq_by_irq_and_dev(XTERM_IRQ, data);
73 free_irq(XTERM_IRQ, data); 72 free_irq(XTERM_IRQ, data);
74 73
75 ret = data->new_fd; 74 ret = data->new_fd;
diff --git a/arch/um/kernel/irq.c b/arch/um/kernel/irq.c
index d44fb5282547..9f18061ef4c9 100644
--- a/arch/um/kernel/irq.c
+++ b/arch/um/kernel/irq.c
@@ -124,14 +124,16 @@ void irq_unlock(unsigned long flags)
124 spin_unlock_irqrestore(&irq_spinlock, flags); 124 spin_unlock_irqrestore(&irq_spinlock, flags);
125} 125}
126 126
127/* presently hw_interrupt_type must define (startup || enable) && 127/* hw_interrupt_type must define (startup || enable) &&
128 * disable && end */ 128 * (shutdown || disable) && end */
129static void dummy(unsigned int irq) 129static void dummy(unsigned int irq)
130{ 130{
131} 131}
132 132
133static struct hw_interrupt_type SIGIO_irq_type = { 133/* This is used for everything else than the timer. */
134static struct hw_interrupt_type normal_irq_type = {
134 .typename = "SIGIO", 135 .typename = "SIGIO",
136 .release = free_irq_by_irq_and_dev,
135 .disable = dummy, 137 .disable = dummy,
136 .enable = dummy, 138 .enable = dummy,
137 .ack = dummy, 139 .ack = dummy,
@@ -140,6 +142,7 @@ static struct hw_interrupt_type SIGIO_irq_type = {
140 142
141static struct hw_interrupt_type SIGVTALRM_irq_type = { 143static struct hw_interrupt_type SIGVTALRM_irq_type = {
142 .typename = "SIGVTALRM", 144 .typename = "SIGVTALRM",
145 .release = free_irq_by_irq_and_dev,
143 .shutdown = dummy, /* never called */ 146 .shutdown = dummy, /* never called */
144 .disable = dummy, 147 .disable = dummy,
145 .enable = dummy, 148 .enable = dummy,
@@ -160,7 +163,7 @@ void __init init_IRQ(void)
160 irq_desc[i].status = IRQ_DISABLED; 163 irq_desc[i].status = IRQ_DISABLED;
161 irq_desc[i].action = NULL; 164 irq_desc[i].action = NULL;
162 irq_desc[i].depth = 1; 165 irq_desc[i].depth = 1;
163 irq_desc[i].handler = &SIGIO_irq_type; 166 irq_desc[i].handler = &normal_irq_type;
164 enable_irq(i); 167 enable_irq(i);
165 } 168 }
166} 169}
diff --git a/arch/um/kernel/irq_user.c b/arch/um/kernel/irq_user.c
index b3074cbaa479..c3ccaf24f3e0 100644
--- a/arch/um/kernel/irq_user.c
+++ b/arch/um/kernel/irq_user.c
@@ -85,8 +85,6 @@ void sigio_handler(int sig, union uml_pt_regs *regs)
85 next = irq_fd->next; 85 next = irq_fd->next;
86 if(irq_fd->freed){ 86 if(irq_fd->freed){
87 free_irq(irq_fd->irq, irq_fd->id); 87 free_irq(irq_fd->irq, irq_fd->id);
88 free_irq_by_irq_and_dev(irq_fd->irq,
89 irq_fd->id);
90 } 88 }
91 } 89 }
92 } 90 }
diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c
index c22825f13e40..5597bd39e6b5 100644
--- a/arch/um/kernel/mem.c
+++ b/arch/um/kernel/mem.c
@@ -53,7 +53,6 @@ static void setup_highmem(unsigned long highmem_start,
53 for(i = 0; i < highmem_len >> PAGE_SHIFT; i++){ 53 for(i = 0; i < highmem_len >> PAGE_SHIFT; i++){
54 page = &mem_map[highmem_pfn + i]; 54 page = &mem_map[highmem_pfn + i];
55 ClearPageReserved(page); 55 ClearPageReserved(page);
56 set_bit(PG_highmem, &page->flags);
57 set_page_count(page, 1); 56 set_page_count(page, 1);
58 __free_page(page); 57 __free_page(page);
59 } 58 }
diff --git a/arch/um/kernel/tt/Makefile b/arch/um/kernel/tt/Makefile
index c3faea21a996..3fd2554e60b6 100644
--- a/arch/um/kernel/tt/Makefile
+++ b/arch/um/kernel/tt/Makefile
@@ -3,10 +3,6 @@
3# Licensed under the GPL 3# Licensed under the GPL
4# 4#
5 5
6extra-y := unmap_fin.o
7targets := unmap.o
8clean-files := unmap_tmp.o
9
10obj-y = exec_kern.o exec_user.o gdb.o ksyms.o mem.o mem_user.o process_kern.o \ 6obj-y = exec_kern.o exec_user.o gdb.o ksyms.o mem.o mem_user.o process_kern.o \
11 syscall_kern.o syscall_user.o time.o tlb.o tracer.o trap_user.o \ 7 syscall_kern.o syscall_user.o time.o tlb.o tracer.o trap_user.o \
12 uaccess.o uaccess_user.o 8 uaccess.o uaccess_user.o
@@ -16,14 +12,3 @@ obj-$(CONFIG_PT_PROXY) += gdb_kern.o ptproxy/
16USER_OBJS := gdb.o time.o tracer.o 12USER_OBJS := gdb.o time.o tracer.o
17 13
18include arch/um/scripts/Makefile.rules 14include arch/um/scripts/Makefile.rules
19
20UNMAP_CFLAGS := $(patsubst -pg -DPROFILING,,$(USER_CFLAGS))
21UNMAP_CFLAGS := $(patsubst -fprofile-arcs -ftest-coverage,,$(UNMAP_CFLAGS))
22
23#XXX: partially copied from arch/um/scripts/Makefile.rules
24$(obj)/unmap.o: c_flags = -Wp,-MD,$(depfile) $(UNMAP_CFLAGS)
25
26$(obj)/unmap_fin.o : $(obj)/unmap.o
27 $(LD) -r -o $(obj)/unmap_tmp.o $< $(shell $(CC) -print-file-name=libc.a)
28 $(OBJCOPY) $(obj)/unmap_tmp.o $@ -G switcheroo
29
diff --git a/arch/um/kernel/tt/unmap.c b/arch/um/kernel/tt/unmap.c
deleted file mode 100644
index 3f7aecdbe532..000000000000
--- a/arch/um/kernel/tt/unmap.c
+++ /dev/null
@@ -1,31 +0,0 @@
1/*
2 * Copyright (C) 2000 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#include <sys/mman.h>
7
8int switcheroo(int fd, int prot, void *from, void *to, int size)
9{
10 if(munmap(to, size) < 0){
11 return(-1);
12 }
13 if(mmap(to, size, prot, MAP_SHARED | MAP_FIXED, fd, 0) != to){
14 return(-1);
15 }
16 if(munmap(from, size) < 0){
17 return(-1);
18 }
19 return(0);
20}
21
22/*
23 * Overrides for Emacs so that we follow Linus's tabbing style.
24 * Emacs will notice this stuff at the end of the file and automatically
25 * adjust the settings for this buffer only. This must remain at the end
26 * of the file.
27 * ---------------------------------------------------------------------------
28 * Local variables:
29 * c-file-style: "linux"
30 * End:
31 */
diff --git a/arch/um/kernel/uml.lds.S b/arch/um/kernel/uml.lds.S
index dd5355500bdc..61dfd4fef752 100644
--- a/arch/um/kernel/uml.lds.S
+++ b/arch/um/kernel/uml.lds.S
@@ -14,19 +14,10 @@ SECTIONS
14 /* Used in arch/um/kernel/mem.c. Any memory between START and __binary_start 14 /* Used in arch/um/kernel/mem.c. Any memory between START and __binary_start
15 * is remapped.*/ 15 * is remapped.*/
16 __binary_start = .; 16 __binary_start = .;
17#ifdef MODE_TT
18 .thread_private : {
19 __start_thread_private = .;
20 errno = .;
21 . += 4;
22 arch/um/kernel/tt/unmap_fin.o (.data)
23 __end_thread_private = .;
24 }
25 . = ALIGN(4096);
26 .remap : { arch/um/kernel/tt/unmap_fin.o (.text) }
27 17
28 /* We want it only if we are in MODE_TT. In both cases, however, when MODE_TT 18#ifdef MODE_TT
29 * is off the resulting binary segfaults.*/ 19 .remap_data : { arch/um/sys-SUBARCH/unmap_fin.o (.data .bss) }
20 .remap : { arch/um/sys-SUBARCH/unmap_fin.o (.text) }
30 21
31 . = ALIGN(4096); /* Init code and data */ 22 . = ALIGN(4096); /* Init code and data */
32#endif 23#endif
diff --git a/arch/um/scripts/Makefile.rules b/arch/um/scripts/Makefile.rules
index 98346c711493..7459d09c233e 100644
--- a/arch/um/scripts/Makefile.rules
+++ b/arch/um/scripts/Makefile.rules
@@ -10,6 +10,12 @@ USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file))
10$(USER_OBJS) : c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) \ 10$(USER_OBJS) : c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) \
11 $(CFLAGS_$(notdir $@)) 11 $(CFLAGS_$(notdir $@))
12 12
13# The stubs and unmap.o can't try to call mcount or update basic block data
14define unprofile
15 $(patsubst -pg,,$(patsubst -fprofile-arcs -ftest-coverage,,$(1)))
16endef
17
18
13quiet_cmd_make_link = SYMLINK $@ 19quiet_cmd_make_link = SYMLINK $@
14cmd_make_link = ln -sf $(srctree)/arch/$(SUBARCH)/$($(notdir $@)-dir)/$(notdir $@) $@ 20cmd_make_link = ln -sf $(srctree)/arch/$(SUBARCH)/$($(notdir $@)-dir)/$(notdir $@) $@
15 21
diff --git a/arch/um/scripts/Makefile.unmap b/arch/um/scripts/Makefile.unmap
new file mode 100644
index 000000000000..37a8f9765295
--- /dev/null
+++ b/arch/um/scripts/Makefile.unmap
@@ -0,0 +1,22 @@
1clean-files += unmap_tmp.o unmap_fin.o unmap.o
2
3ifdef CONFIG_MODE_TT
4
5#Always build unmap_fin.o
6extra-y += unmap_fin.o
7#Do dependency tracking for unmap.o (it will be always built, but won't get the tracking unless we use this).
8targets += unmap.o
9
10#XXX: partially copied from arch/um/scripts/Makefile.rules
11$(obj)/unmap.o: _c_flags = $(call unprofile,$(CFLAGS))
12
13quiet_cmd_wrapld = LD $@
14define cmd_wrapld
15 $(LD) -r -o $(obj)/unmap_tmp.o $< $(shell $(CC) -print-file-name=libc.a); \
16 $(OBJCOPY) $(obj)/unmap_tmp.o $@ -G switcheroo
17endef
18
19$(obj)/unmap_fin.o : $(obj)/unmap.o FORCE
20 $(call if_changed,wrapld)
21
22endif
diff --git a/arch/um/sys-i386/Makefile b/arch/um/sys-i386/Makefile
index 4351e5605506..095bcdb0b9cc 100644
--- a/arch/um/sys-i386/Makefile
+++ b/arch/um/sys-i386/Makefile
@@ -17,3 +17,5 @@ highmem.c-dir = mm
17module.c-dir = kernel 17module.c-dir = kernel
18 18
19subdir- := util 19subdir- := util
20
21include arch/um/scripts/Makefile.unmap
diff --git a/arch/um/sys-i386/unmap.c b/arch/um/sys-i386/unmap.c
new file mode 100644
index 000000000000..136875263d27
--- /dev/null
+++ b/arch/um/sys-i386/unmap.c
@@ -0,0 +1,25 @@
1/*
2 * Copyright (C) 2000 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#include <linux/mman.h>
7#include <asm/unistd.h>
8
9static int errno;
10
11static inline _syscall2(int,munmap,void *,start,size_t,len)
12static inline _syscall6(void *,mmap2,void *,addr,size_t,len,int,prot,int,flags,int,fd,off_t,offset)
13int switcheroo(int fd, int prot, void *from, void *to, int size)
14{
15 if(munmap(to, size) < 0){
16 return(-1);
17 }
18 if(mmap2(to, size, prot, MAP_SHARED | MAP_FIXED, fd, 0) != to){
19 return(-1);
20 }
21 if(munmap(from, size) < 0){
22 return(-1);
23 }
24 return(0);
25}
diff --git a/arch/um/sys-x86_64/Makefile b/arch/um/sys-x86_64/Makefile
index 608466ad6b22..2bc6f6849010 100644
--- a/arch/um/sys-x86_64/Makefile
+++ b/arch/um/sys-x86_64/Makefile
@@ -29,3 +29,5 @@ thunk.S-dir = lib
29module.c-dir = kernel 29module.c-dir = kernel
30 30
31subdir- := util 31subdir- := util
32
33include arch/um/scripts/Makefile.unmap
diff --git a/arch/um/sys-x86_64/unmap.c b/arch/um/sys-x86_64/unmap.c
new file mode 100644
index 000000000000..bc7094cce47e
--- /dev/null
+++ b/arch/um/sys-x86_64/unmap.c
@@ -0,0 +1,25 @@
1/*
2 * Copyright (C) 2000 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#include <linux/mman.h>
7#include <asm/unistd.h>
8
9static int errno;
10
11static inline _syscall2(int,munmap,void *,start,size_t,len)
12static inline _syscall6(void *,mmap,void *,addr,size_t,len,int,prot,int,flags,int,fd,off_t,offset)
13int switcheroo(int fd, int prot, void *from, void *to, int size)
14{
15 if(munmap(to, size) < 0){
16 return(-1);
17 }
18 if(mmap(to, size, prot, MAP_SHARED | MAP_FIXED, fd, 0) != to){
19 return(-1);
20 }
21 if(munmap(from, size) < 0){
22 return(-1);
23 }
24 return(0);
25}
diff --git a/arch/x86_64/ia32/ia32_aout.c b/arch/x86_64/ia32/ia32_aout.c
index 1965efc974dc..c12edf5d97f0 100644
--- a/arch/x86_64/ia32/ia32_aout.c
+++ b/arch/x86_64/ia32/ia32_aout.c
@@ -312,6 +312,7 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs)
312 current->mm->brk = ex.a_bss + 312 current->mm->brk = ex.a_bss +
313 (current->mm->start_brk = N_BSSADDR(ex)); 313 (current->mm->start_brk = N_BSSADDR(ex));
314 current->mm->free_area_cache = TASK_UNMAPPED_BASE; 314 current->mm->free_area_cache = TASK_UNMAPPED_BASE;
315 current->mm->cached_hole_size = 0;
315 316
316 set_mm_counter(current->mm, rss, 0); 317 set_mm_counter(current->mm, rss, 0);
317 current->mm->mmap = NULL; 318 current->mm->mmap = NULL;
diff --git a/arch/x86_64/ia32/ia32_binfmt.c b/arch/x86_64/ia32/ia32_binfmt.c
index 99b522052d16..c8131f342cfc 100644
--- a/arch/x86_64/ia32/ia32_binfmt.c
+++ b/arch/x86_64/ia32/ia32_binfmt.c
@@ -46,7 +46,7 @@ struct elf_phdr;
46 46
47#define IA32_EMULATOR 1 47#define IA32_EMULATOR 1
48 48
49#define ELF_ET_DYN_BASE (TASK_UNMAPPED_32 + 0x1000000) 49#define ELF_ET_DYN_BASE (TASK_UNMAPPED_BASE + 0x1000000)
50 50
51#undef ELF_ARCH 51#undef ELF_ARCH
52#define ELF_ARCH EM_386 52#define ELF_ARCH EM_386
@@ -307,9 +307,6 @@ MODULE_AUTHOR("Eric Youngdale, Andi Kleen");
307 307
308#define elf_addr_t __u32 308#define elf_addr_t __u32
309 309
310#undef TASK_SIZE
311#define TASK_SIZE 0xffffffff
312
313static void elf32_init(struct pt_regs *); 310static void elf32_init(struct pt_regs *);
314 311
315#define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1 312#define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1
diff --git a/arch/x86_64/kernel/process.c b/arch/x86_64/kernel/process.c
index 761b6d35e338..dce8bab4306c 100644
--- a/arch/x86_64/kernel/process.c
+++ b/arch/x86_64/kernel/process.c
@@ -656,7 +656,7 @@ long do_arch_prctl(struct task_struct *task, int code, unsigned long addr)
656 656
657 switch (code) { 657 switch (code) {
658 case ARCH_SET_GS: 658 case ARCH_SET_GS:
659 if (addr >= TASK_SIZE) 659 if (addr >= TASK_SIZE_OF(task))
660 return -EPERM; 660 return -EPERM;
661 cpu = get_cpu(); 661 cpu = get_cpu();
662 /* handle small bases via the GDT because that's faster to 662 /* handle small bases via the GDT because that's faster to
@@ -682,7 +682,7 @@ long do_arch_prctl(struct task_struct *task, int code, unsigned long addr)
682 case ARCH_SET_FS: 682 case ARCH_SET_FS:
683 /* Not strictly needed for fs, but do it for symmetry 683 /* Not strictly needed for fs, but do it for symmetry
684 with gs */ 684 with gs */
685 if (addr >= TASK_SIZE) 685 if (addr >= TASK_SIZE_OF(task))
686 return -EPERM; 686 return -EPERM;
687 cpu = get_cpu(); 687 cpu = get_cpu();
688 /* handle small bases via the GDT because that's faster to 688 /* handle small bases via the GDT because that's faster to
diff --git a/arch/x86_64/kernel/ptrace.c b/arch/x86_64/kernel/ptrace.c
index 525f6a128a27..bbf64b59a21e 100644
--- a/arch/x86_64/kernel/ptrace.c
+++ b/arch/x86_64/kernel/ptrace.c
@@ -257,12 +257,12 @@ static int putreg(struct task_struct *child,
257 value &= 0xffff; 257 value &= 0xffff;
258 return 0; 258 return 0;
259 case offsetof(struct user_regs_struct,fs_base): 259 case offsetof(struct user_regs_struct,fs_base):
260 if (value >= TASK_SIZE) 260 if (value >= TASK_SIZE_OF(child))
261 return -EIO; 261 return -EIO;
262 child->thread.fs = value; 262 child->thread.fs = value;
263 return 0; 263 return 0;
264 case offsetof(struct user_regs_struct,gs_base): 264 case offsetof(struct user_regs_struct,gs_base):
265 if (value >= TASK_SIZE) 265 if (value >= TASK_SIZE_OF(child))
266 return -EIO; 266 return -EIO;
267 child->thread.gs = value; 267 child->thread.gs = value;
268 return 0; 268 return 0;
@@ -279,7 +279,7 @@ static int putreg(struct task_struct *child,
279 break; 279 break;
280 case offsetof(struct user_regs_struct, rip): 280 case offsetof(struct user_regs_struct, rip):
281 /* Check if the new RIP address is canonical */ 281 /* Check if the new RIP address is canonical */
282 if (value >= TASK_SIZE) 282 if (value >= TASK_SIZE_OF(child))
283 return -EIO; 283 return -EIO;
284 break; 284 break;
285 } 285 }
@@ -419,6 +419,8 @@ asmlinkage long sys_ptrace(long request, long pid, unsigned long addr, long data
419 break; 419 break;
420 420
421 case PTRACE_POKEUSR: /* write the word at location addr in the USER area */ 421 case PTRACE_POKEUSR: /* write the word at location addr in the USER area */
422 {
423 int dsize = test_tsk_thread_flag(child, TIF_IA32) ? 3 : 7;
422 ret = -EIO; 424 ret = -EIO;
423 if ((addr & 7) || 425 if ((addr & 7) ||
424 addr > sizeof(struct user) - 7) 426 addr > sizeof(struct user) - 7)
@@ -430,22 +432,22 @@ asmlinkage long sys_ptrace(long request, long pid, unsigned long addr, long data
430 break; 432 break;
431 /* Disallows to set a breakpoint into the vsyscall */ 433 /* Disallows to set a breakpoint into the vsyscall */
432 case offsetof(struct user, u_debugreg[0]): 434 case offsetof(struct user, u_debugreg[0]):
433 if (data >= TASK_SIZE-7) break; 435 if (data >= TASK_SIZE_OF(child) - dsize) break;
434 child->thread.debugreg0 = data; 436 child->thread.debugreg0 = data;
435 ret = 0; 437 ret = 0;
436 break; 438 break;
437 case offsetof(struct user, u_debugreg[1]): 439 case offsetof(struct user, u_debugreg[1]):
438 if (data >= TASK_SIZE-7) break; 440 if (data >= TASK_SIZE_OF(child) - dsize) break;
439 child->thread.debugreg1 = data; 441 child->thread.debugreg1 = data;
440 ret = 0; 442 ret = 0;
441 break; 443 break;
442 case offsetof(struct user, u_debugreg[2]): 444 case offsetof(struct user, u_debugreg[2]):
443 if (data >= TASK_SIZE-7) break; 445 if (data >= TASK_SIZE_OF(child) - dsize) break;
444 child->thread.debugreg2 = data; 446 child->thread.debugreg2 = data;
445 ret = 0; 447 ret = 0;
446 break; 448 break;
447 case offsetof(struct user, u_debugreg[3]): 449 case offsetof(struct user, u_debugreg[3]):
448 if (data >= TASK_SIZE-7) break; 450 if (data >= TASK_SIZE_OF(child) - dsize) break;
449 child->thread.debugreg3 = data; 451 child->thread.debugreg3 = data;
450 ret = 0; 452 ret = 0;
451 break; 453 break;
@@ -469,6 +471,7 @@ asmlinkage long sys_ptrace(long request, long pid, unsigned long addr, long data
469 break; 471 break;
470 } 472 }
471 break; 473 break;
474 }
472 case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ 475 case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */
473 case PTRACE_CONT: /* restart after signal. */ 476 case PTRACE_CONT: /* restart after signal. */
474 477
diff --git a/arch/x86_64/kernel/sys_x86_64.c b/arch/x86_64/kernel/sys_x86_64.c
index dbebd5ccba6b..cc7821c68851 100644
--- a/arch/x86_64/kernel/sys_x86_64.c
+++ b/arch/x86_64/kernel/sys_x86_64.c
@@ -68,13 +68,7 @@ out:
68static void find_start_end(unsigned long flags, unsigned long *begin, 68static void find_start_end(unsigned long flags, unsigned long *begin,
69 unsigned long *end) 69 unsigned long *end)
70{ 70{
71#ifdef CONFIG_IA32_EMULATION 71 if (!test_thread_flag(TIF_IA32) && (flags & MAP_32BIT)) {
72 if (test_thread_flag(TIF_IA32)) {
73 *begin = TASK_UNMAPPED_32;
74 *end = IA32_PAGE_OFFSET;
75 } else
76#endif
77 if (flags & MAP_32BIT) {
78 /* This is usually used needed to map code in small 72 /* This is usually used needed to map code in small
79 model, so it needs to be in the first 31bit. Limit 73 model, so it needs to be in the first 31bit. Limit
80 it to that. This means we need to move the 74 it to that. This means we need to move the
@@ -84,10 +78,10 @@ static void find_start_end(unsigned long flags, unsigned long *begin,
84 of playground for now. -AK */ 78 of playground for now. -AK */
85 *begin = 0x40000000; 79 *begin = 0x40000000;
86 *end = 0x80000000; 80 *end = 0x80000000;
87 } else { 81 } else {
88 *begin = TASK_UNMAPPED_64; 82 *begin = TASK_UNMAPPED_BASE;
89 *end = TASK_SIZE; 83 *end = TASK_SIZE;
90 } 84 }
91} 85}
92 86
93unsigned long 87unsigned long
@@ -111,6 +105,11 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
111 (!vma || addr + len <= vma->vm_start)) 105 (!vma || addr + len <= vma->vm_start))
112 return addr; 106 return addr;
113 } 107 }
108 if (((flags & MAP_32BIT) || test_thread_flag(TIF_IA32))
109 && len <= mm->cached_hole_size) {
110 mm->cached_hole_size = 0;
111 mm->free_area_cache = begin;
112 }
114 addr = mm->free_area_cache; 113 addr = mm->free_area_cache;
115 if (addr < begin) 114 if (addr < begin)
116 addr = begin; 115 addr = begin;
@@ -126,6 +125,7 @@ full_search:
126 */ 125 */
127 if (start_addr != begin) { 126 if (start_addr != begin) {
128 start_addr = addr = begin; 127 start_addr = addr = begin;
128 mm->cached_hole_size = 0;
129 goto full_search; 129 goto full_search;
130 } 130 }
131 return -ENOMEM; 131 return -ENOMEM;
@@ -137,6 +137,9 @@ full_search:
137 mm->free_area_cache = addr + len; 137 mm->free_area_cache = addr + len;
138 return addr; 138 return addr;
139 } 139 }
140 if (addr + mm->cached_hole_size < vma->vm_start)
141 mm->cached_hole_size = vma->vm_start - addr;
142
140 addr = vma->vm_end; 143 addr = vma->vm_end;
141 } 144 }
142} 145}
diff --git a/arch/x86_64/lib/delay.c b/arch/x86_64/lib/delay.c
index 6e2d66472eb1..aed61a668a1b 100644
--- a/arch/x86_64/lib/delay.c
+++ b/arch/x86_64/lib/delay.c
@@ -34,7 +34,7 @@ void __delay(unsigned long loops)
34 34
35inline void __const_udelay(unsigned long xloops) 35inline void __const_udelay(unsigned long xloops)
36{ 36{
37 __delay(((xloops * cpu_data[_smp_processor_id()].loops_per_jiffy) >> 32) * HZ); 37 __delay(((xloops * cpu_data[raw_smp_processor_id()].loops_per_jiffy) >> 32) * HZ);
38} 38}
39 39
40void __udelay(unsigned long usecs) 40void __udelay(unsigned long usecs)
diff --git a/arch/x86_64/mm/fault.c b/arch/x86_64/mm/fault.c
index 5d6b2114cc9a..57d3ab15a5c7 100644
--- a/arch/x86_64/mm/fault.c
+++ b/arch/x86_64/mm/fault.c
@@ -350,7 +350,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code)
350 * (error_code & 4) == 0, and that the fault was not a 350 * (error_code & 4) == 0, and that the fault was not a
351 * protection error (error_code & 1) == 0. 351 * protection error (error_code & 1) == 0.
352 */ 352 */
353 if (unlikely(address >= TASK_SIZE)) { 353 if (unlikely(address >= TASK_SIZE64)) {
354 if (!(error_code & 5) && 354 if (!(error_code & 5) &&
355 ((address >= VMALLOC_START && address < VMALLOC_END) || 355 ((address >= VMALLOC_START && address < VMALLOC_END) ||
356 (address >= MODULES_VADDR && address < MODULES_END))) { 356 (address >= MODULES_VADDR && address < MODULES_END))) {
diff --git a/drivers/Kconfig b/drivers/Kconfig
index ed41d9036bfc..aed4a9b97c14 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -58,4 +58,6 @@ source "drivers/mmc/Kconfig"
58 58
59source "drivers/infiniband/Kconfig" 59source "drivers/infiniband/Kconfig"
60 60
61source "drivers/sn/Kconfig"
62
61endmenu 63endmenu
diff --git a/drivers/Makefile b/drivers/Makefile
index 15681de688f4..3167be54fedd 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -61,6 +61,6 @@ obj-$(CONFIG_EISA) += eisa/
61obj-$(CONFIG_CPU_FREQ) += cpufreq/ 61obj-$(CONFIG_CPU_FREQ) += cpufreq/
62obj-$(CONFIG_MMC) += mmc/ 62obj-$(CONFIG_MMC) += mmc/
63obj-$(CONFIG_INFINIBAND) += infiniband/ 63obj-$(CONFIG_INFINIBAND) += infiniband/
64obj-$(CONFIG_BLK_DEV_SGIIOC4) += sn/ 64obj-$(CONFIG_SGI_IOC4) += sn/
65obj-y += firmware/ 65obj-y += firmware/
66obj-$(CONFIG_CRYPTO) += crypto/ 66obj-$(CONFIG_CRYPTO) += crypto/
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index ff64d333e95f..c9d671cf7857 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -171,7 +171,7 @@ static void acpi_processor_idle (void)
171 int sleep_ticks = 0; 171 int sleep_ticks = 0;
172 u32 t1, t2 = 0; 172 u32 t1, t2 = 0;
173 173
174 pr = processors[_smp_processor_id()]; 174 pr = processors[raw_smp_processor_id()];
175 if (!pr) 175 if (!pr)
176 return; 176 return;
177 177
diff --git a/drivers/base/node.c b/drivers/base/node.c
index 5d4517ccc422..904b27caf697 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -87,7 +87,7 @@ static ssize_t node_read_numastat(struct sys_device * dev, char * buf)
87 for (i = 0; i < MAX_NR_ZONES; i++) { 87 for (i = 0; i < MAX_NR_ZONES; i++) {
88 struct zone *z = &pg->node_zones[i]; 88 struct zone *z = &pg->node_zones[i];
89 for (cpu = 0; cpu < NR_CPUS; cpu++) { 89 for (cpu = 0; cpu < NR_CPUS; cpu++) {
90 struct per_cpu_pageset *ps = &z->pageset[cpu]; 90 struct per_cpu_pageset *ps = zone_pcp(z,cpu);
91 numa_hit += ps->numa_hit; 91 numa_hit += ps->numa_hit;
92 numa_miss += ps->numa_miss; 92 numa_miss += ps->numa_miss;
93 numa_foreign += ps->numa_foreign; 93 numa_foreign += ps->numa_foreign;
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index 5ed6515ae01f..7ccf871d3c9d 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -929,6 +929,10 @@ config SCx200_GPIO
929 929
930 If compiled as a module, it will be called scx200_gpio. 930 If compiled as a module, it will be called scx200_gpio.
931 931
932config GPIO_VR41XX
933 tristate "NEC VR4100 series General-purpose I/O Unit support"
934 depends on CPU_VR41XX
935
932config RAW_DRIVER 936config RAW_DRIVER
933 tristate "RAW driver (/dev/raw/rawN) (OBSOLETE)" 937 tristate "RAW driver (/dev/raw/rawN) (OBSOLETE)"
934 help 938 help
diff --git a/drivers/char/Makefile b/drivers/char/Makefile
index e3f5c32aac55..1aff819f3832 100644
--- a/drivers/char/Makefile
+++ b/drivers/char/Makefile
@@ -80,6 +80,7 @@ obj-$(CONFIG_PPDEV) += ppdev.o
80obj-$(CONFIG_NWBUTTON) += nwbutton.o 80obj-$(CONFIG_NWBUTTON) += nwbutton.o
81obj-$(CONFIG_NWFLASH) += nwflash.o 81obj-$(CONFIG_NWFLASH) += nwflash.o
82obj-$(CONFIG_SCx200_GPIO) += scx200_gpio.o 82obj-$(CONFIG_SCx200_GPIO) += scx200_gpio.o
83obj-$(CONFIG_GPIO_VR41XX) += vr41xx_giu.o
83obj-$(CONFIG_TANBAC_TB0219) += tb0219.o 84obj-$(CONFIG_TANBAC_TB0219) += tb0219.o
84 85
85obj-$(CONFIG_WATCHDOG) += watchdog/ 86obj-$(CONFIG_WATCHDOG) += watchdog/
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index d7fb452af7f9..0c81652eaba6 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -641,7 +641,7 @@ int ipmi_create_user(unsigned int if_num,
641 return -ENOMEM; 641 return -ENOMEM;
642 642
643 down_read(&interfaces_sem); 643 down_read(&interfaces_sem);
644 if ((if_num > MAX_IPMI_INTERFACES) || ipmi_interfaces[if_num] == NULL) 644 if ((if_num >= MAX_IPMI_INTERFACES) || ipmi_interfaces[if_num] == NULL)
645 { 645 {
646 rv = -EINVAL; 646 rv = -EINVAL;
647 goto out_unlock; 647 goto out_unlock;
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index 257b8ee605e5..e3085b22a365 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -484,7 +484,7 @@ static ssize_t write_kmem(struct file * file, const char __user * buf,
484 return virtr + wrote; 484 return virtr + wrote;
485} 485}
486 486
487#if defined(CONFIG_ISA) || !defined(__mc68000__) 487#if (defined(CONFIG_ISA) || !defined(__mc68000__)) && (!defined(CONFIG_PPC_ISERIES) || defined(CONFIG_PCI))
488static ssize_t read_port(struct file * file, char __user * buf, 488static ssize_t read_port(struct file * file, char __user * buf,
489 size_t count, loff_t *ppos) 489 size_t count, loff_t *ppos)
490{ 490{
@@ -744,7 +744,7 @@ static struct file_operations null_fops = {
744 .write = write_null, 744 .write = write_null,
745}; 745};
746 746
747#if defined(CONFIG_ISA) || !defined(__mc68000__) 747#if (defined(CONFIG_ISA) || !defined(__mc68000__)) && (!defined(CONFIG_PPC_ISERIES) || defined(CONFIG_PCI))
748static struct file_operations port_fops = { 748static struct file_operations port_fops = {
749 .llseek = memory_lseek, 749 .llseek = memory_lseek,
750 .read = read_port, 750 .read = read_port,
@@ -804,7 +804,7 @@ static int memory_open(struct inode * inode, struct file * filp)
804 case 3: 804 case 3:
805 filp->f_op = &null_fops; 805 filp->f_op = &null_fops;
806 break; 806 break;
807#if defined(CONFIG_ISA) || !defined(__mc68000__) 807#if (defined(CONFIG_ISA) || !defined(__mc68000__)) && (!defined(CONFIG_PPC_ISERIES) || defined(CONFIG_PCI))
808 case 4: 808 case 4:
809 filp->f_op = &port_fops; 809 filp->f_op = &port_fops;
810 break; 810 break;
@@ -846,7 +846,7 @@ static const struct {
846 {1, "mem", S_IRUSR | S_IWUSR | S_IRGRP, &mem_fops}, 846 {1, "mem", S_IRUSR | S_IWUSR | S_IRGRP, &mem_fops},
847 {2, "kmem", S_IRUSR | S_IWUSR | S_IRGRP, &kmem_fops}, 847 {2, "kmem", S_IRUSR | S_IWUSR | S_IRGRP, &kmem_fops},
848 {3, "null", S_IRUGO | S_IWUGO, &null_fops}, 848 {3, "null", S_IRUGO | S_IWUGO, &null_fops},
849#if defined(CONFIG_ISA) || !defined(__mc68000__) 849#if (defined(CONFIG_ISA) || !defined(__mc68000__)) && (!defined(CONFIG_PPC_ISERIES) || defined(CONFIG_PCI))
850 {4, "port", S_IRUSR | S_IWUSR | S_IRGRP, &port_fops}, 850 {4, "port", S_IRUSR | S_IWUSR | S_IRGRP, &port_fops},
851#endif 851#endif
852 {5, "zero", S_IRUGO | S_IWUGO, &zero_fops}, 852 {5, "zero", S_IRUGO | S_IWUGO, &zero_fops},
diff --git a/drivers/char/vr41xx_giu.c b/drivers/char/vr41xx_giu.c
new file mode 100644
index 000000000000..683278bc5241
--- /dev/null
+++ b/drivers/char/vr41xx_giu.c
@@ -0,0 +1,743 @@
1/*
2 * Driver for NEC VR4100 series General-purpose I/O Unit.
3 *
4 * Copyright (C) 2002 MontaVista Software Inc.
5 * Author: Yoichi Yuasa <yyuasa@mvista.com or source@mvista.com>
6 * Copyright (C) 2003-2005 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22#include <linux/device.h>
23#include <linux/errno.h>
24#include <linux/fs.h>
25#include <linux/init.h>
26#include <linux/irq.h>
27#include <linux/interrupt.h>
28#include <linux/kernel.h>
29#include <linux/module.h>
30#include <linux/spinlock.h>
31#include <linux/types.h>
32
33#include <asm/cpu.h>
34#include <asm/io.h>
35#include <asm/vr41xx/giu.h>
36#include <asm/vr41xx/vr41xx.h>
37
38MODULE_AUTHOR("Yoichi Yuasa <yuasa@hh.iij4u.or.jp>");
39MODULE_DESCRIPTION("NEC VR4100 series General-purpose I/O Unit driver");
40MODULE_LICENSE("GPL");
41
42static int major; /* default is dynamic major device number */
43module_param(major, int, 0);
44MODULE_PARM_DESC(major, "Major device number");
45
46#define GIU_TYPE1_START 0x0b000100UL
47#define GIU_TYPE1_SIZE 0x20UL
48
49#define GIU_TYPE2_START 0x0f000140UL
50#define GIU_TYPE2_SIZE 0x20UL
51
52#define GIU_TYPE3_START 0x0f000140UL
53#define GIU_TYPE3_SIZE 0x28UL
54
55#define GIU_PULLUPDOWN_START 0x0b0002e0UL
56#define GIU_PULLUPDOWN_SIZE 0x04UL
57
58#define GIUIOSELL 0x00
59#define GIUIOSELH 0x02
60#define GIUPIODL 0x04
61#define GIUPIODH 0x06
62#define GIUINTSTATL 0x08
63#define GIUINTSTATH 0x0a
64#define GIUINTENL 0x0c
65#define GIUINTENH 0x0e
66#define GIUINTTYPL 0x10
67#define GIUINTTYPH 0x12
68#define GIUINTALSELL 0x14
69#define GIUINTALSELH 0x16
70#define GIUINTHTSELL 0x18
71#define GIUINTHTSELH 0x1a
72#define GIUPODATL 0x1c
73#define GIUPODATEN 0x1c
74#define GIUPODATH 0x1e
75 #define PIOEN0 0x0100
76 #define PIOEN1 0x0200
77#define GIUPODAT 0x1e
78#define GIUFEDGEINHL 0x20
79#define GIUFEDGEINHH 0x22
80#define GIUREDGEINHL 0x24
81#define GIUREDGEINHH 0x26
82
83#define GIUUSEUPDN 0x1e0
84#define GIUTERMUPDN 0x1e2
85
86#define GPIO_HAS_PULLUPDOWN_IO 0x0001
87#define GPIO_HAS_OUTPUT_ENABLE 0x0002
88#define GPIO_HAS_INTERRUPT_EDGE_SELECT 0x0100
89
90static spinlock_t giu_lock;
91static struct resource *giu_resource1;
92static struct resource *giu_resource2;
93static unsigned long giu_flags;
94static unsigned int giu_nr_pins;
95
96static void __iomem *giu_base;
97
98#define giu_read(offset) readw(giu_base + (offset))
99#define giu_write(offset, value) writew((value), giu_base + (offset))
100
101#define GPIO_PIN_OF_IRQ(irq) ((irq) - GIU_IRQ_BASE)
102#define GIUINT_HIGH_OFFSET 16
103#define GIUINT_HIGH_MAX 32
104
105static inline uint16_t giu_set(uint16_t offset, uint16_t set)
106{
107 uint16_t data;
108
109 data = giu_read(offset);
110 data |= set;
111 giu_write(offset, data);
112
113 return data;
114}
115
116static inline uint16_t giu_clear(uint16_t offset, uint16_t clear)
117{
118 uint16_t data;
119
120 data = giu_read(offset);
121 data &= ~clear;
122 giu_write(offset, data);
123
124 return data;
125}
126
127static unsigned int startup_giuint_low_irq(unsigned int irq)
128{
129 unsigned int pin;
130
131 pin = GPIO_PIN_OF_IRQ(irq);
132 giu_write(GIUINTSTATL, 1 << pin);
133 giu_set(GIUINTENL, 1 << pin);
134
135 return 0;
136}
137
138static void shutdown_giuint_low_irq(unsigned int irq)
139{
140 giu_clear(GIUINTENL, 1 << GPIO_PIN_OF_IRQ(irq));
141}
142
143static void enable_giuint_low_irq(unsigned int irq)
144{
145 giu_set(GIUINTENL, 1 << GPIO_PIN_OF_IRQ(irq));
146}
147
148#define disable_giuint_low_irq shutdown_giuint_low_irq
149
150static void ack_giuint_low_irq(unsigned int irq)
151{
152 unsigned int pin;
153
154 pin = GPIO_PIN_OF_IRQ(irq);
155 giu_clear(GIUINTENL, 1 << pin);
156 giu_write(GIUINTSTATL, 1 << pin);
157}
158
159static void end_giuint_low_irq(unsigned int irq)
160{
161 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
162 giu_set(GIUINTENL, 1 << GPIO_PIN_OF_IRQ(irq));
163}
164
165static struct hw_interrupt_type giuint_low_irq_type = {
166 .typename = "GIUINTL",
167 .startup = startup_giuint_low_irq,
168 .shutdown = shutdown_giuint_low_irq,
169 .enable = enable_giuint_low_irq,
170 .disable = disable_giuint_low_irq,
171 .ack = ack_giuint_low_irq,
172 .end = end_giuint_low_irq,
173};
174
175static unsigned int startup_giuint_high_irq(unsigned int irq)
176{
177 unsigned int pin;
178
179 pin = GPIO_PIN_OF_IRQ(irq) - GIUINT_HIGH_OFFSET;
180 giu_write(GIUINTSTATH, 1 << pin);
181 giu_set(GIUINTENH, 1 << pin);
182
183 return 0;
184}
185
186static void shutdown_giuint_high_irq(unsigned int irq)
187{
188 giu_clear(GIUINTENH, 1 << (GPIO_PIN_OF_IRQ(irq) - GIUINT_HIGH_OFFSET));
189}
190
191static void enable_giuint_high_irq(unsigned int irq)
192{
193 giu_set(GIUINTENH, 1 << (GPIO_PIN_OF_IRQ(irq) - GIUINT_HIGH_OFFSET));
194}
195
196#define disable_giuint_high_irq shutdown_giuint_high_irq
197
198static void ack_giuint_high_irq(unsigned int irq)
199{
200 unsigned int pin;
201
202 pin = GPIO_PIN_OF_IRQ(irq) - GIUINT_HIGH_OFFSET;
203 giu_clear(GIUINTENH, 1 << pin);
204 giu_write(GIUINTSTATH, 1 << pin);
205}
206
207static void end_giuint_high_irq(unsigned int irq)
208{
209 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
210 giu_set(GIUINTENH, 1 << (GPIO_PIN_OF_IRQ(irq) - GIUINT_HIGH_OFFSET));
211}
212
213static struct hw_interrupt_type giuint_high_irq_type = {
214 .typename = "GIUINTH",
215 .startup = startup_giuint_high_irq,
216 .shutdown = shutdown_giuint_high_irq,
217 .enable = enable_giuint_high_irq,
218 .disable = disable_giuint_high_irq,
219 .ack = ack_giuint_high_irq,
220 .end = end_giuint_high_irq,
221};
222
223static int giu_get_irq(unsigned int irq, struct pt_regs *regs)
224{
225 uint16_t pendl, pendh, maskl, maskh;
226 int i;
227
228 pendl = giu_read(GIUINTSTATL);
229 pendh = giu_read(GIUINTSTATH);
230 maskl = giu_read(GIUINTENL);
231 maskh = giu_read(GIUINTENH);
232
233 maskl &= pendl;
234 maskh &= pendh;
235
236 if (maskl) {
237 for (i = 0; i < 16; i++) {
238 if (maskl & (1 << i))
239 return GIU_IRQ(i);
240 }
241 } else if (maskh) {
242 for (i = 0; i < 16; i++) {
243 if (maskh & (1 << i))
244 return GIU_IRQ(i + GIUINT_HIGH_OFFSET);
245 }
246 }
247
248 printk(KERN_ERR "spurious GIU interrupt: %04x(%04x),%04x(%04x)\n",
249 maskl, pendl, maskh, pendh);
250
251 atomic_inc(&irq_err_count);
252
253 return -EINVAL;
254}
255
256void vr41xx_set_irq_trigger(unsigned int pin, irq_trigger_t trigger, irq_signal_t signal)
257{
258 uint16_t mask;
259
260 if (pin < GIUINT_HIGH_OFFSET) {
261 mask = 1 << pin;
262 if (trigger != IRQ_TRIGGER_LEVEL) {
263 giu_set(GIUINTTYPL, mask);
264 if (signal == IRQ_SIGNAL_HOLD)
265 giu_set(GIUINTHTSELL, mask);
266 else
267 giu_clear(GIUINTHTSELL, mask);
268 if (current_cpu_data.cputype == CPU_VR4133) {
269 switch (trigger) {
270 case IRQ_TRIGGER_EDGE_FALLING:
271 giu_set(GIUFEDGEINHL, mask);
272 giu_clear(GIUREDGEINHL, mask);
273 break;
274 case IRQ_TRIGGER_EDGE_RISING:
275 giu_clear(GIUFEDGEINHL, mask);
276 giu_set(GIUREDGEINHL, mask);
277 break;
278 default:
279 giu_set(GIUFEDGEINHL, mask);
280 giu_set(GIUREDGEINHL, mask);
281 break;
282 }
283 }
284 } else {
285 giu_clear(GIUINTTYPL, mask);
286 giu_clear(GIUINTHTSELL, mask);
287 }
288 giu_write(GIUINTSTATL, mask);
289 } else if (pin < GIUINT_HIGH_MAX) {
290 mask = 1 << (pin - GIUINT_HIGH_OFFSET);
291 if (trigger != IRQ_TRIGGER_LEVEL) {
292 giu_set(GIUINTTYPH, mask);
293 if (signal == IRQ_SIGNAL_HOLD)
294 giu_set(GIUINTHTSELH, mask);
295 else
296 giu_clear(GIUINTHTSELH, mask);
297 if (current_cpu_data.cputype == CPU_VR4133) {
298 switch (trigger) {
299 case IRQ_TRIGGER_EDGE_FALLING:
300 giu_set(GIUFEDGEINHH, mask);
301 giu_clear(GIUREDGEINHH, mask);
302 break;
303 case IRQ_TRIGGER_EDGE_RISING:
304 giu_clear(GIUFEDGEINHH, mask);
305 giu_set(GIUREDGEINHH, mask);
306 break;
307 default:
308 giu_set(GIUFEDGEINHH, mask);
309 giu_set(GIUREDGEINHH, mask);
310 break;
311 }
312 }
313 } else {
314 giu_clear(GIUINTTYPH, mask);
315 giu_clear(GIUINTHTSELH, mask);
316 }
317 giu_write(GIUINTSTATH, mask);
318 }
319}
320
321EXPORT_SYMBOL_GPL(vr41xx_set_irq_trigger);
322
323void vr41xx_set_irq_level(unsigned int pin, irq_level_t level)
324{
325 uint16_t mask;
326
327 if (pin < GIUINT_HIGH_OFFSET) {
328 mask = 1 << pin;
329 if (level == IRQ_LEVEL_HIGH)
330 giu_set(GIUINTALSELL, mask);
331 else
332 giu_clear(GIUINTALSELL, mask);
333 giu_write(GIUINTSTATL, mask);
334 } else if (pin < GIUINT_HIGH_MAX) {
335 mask = 1 << (pin - GIUINT_HIGH_OFFSET);
336 if (level == IRQ_LEVEL_HIGH)
337 giu_set(GIUINTALSELH, mask);
338 else
339 giu_clear(GIUINTALSELH, mask);
340 giu_write(GIUINTSTATH, mask);
341 }
342}
343
344EXPORT_SYMBOL_GPL(vr41xx_set_irq_level);
345
346gpio_data_t vr41xx_gpio_get_pin(unsigned int pin)
347{
348 uint16_t reg, mask;
349
350 if (pin >= giu_nr_pins)
351 return GPIO_DATA_INVAL;
352
353 if (pin < 16) {
354 reg = giu_read(GIUPIODL);
355 mask = (uint16_t)1 << pin;
356 } else if (pin < 32) {
357 reg = giu_read(GIUPIODH);
358 mask = (uint16_t)1 << (pin - 16);
359 } else if (pin < 48) {
360 reg = giu_read(GIUPODATL);
361 mask = (uint16_t)1 << (pin - 32);
362 } else {
363 reg = giu_read(GIUPODATH);
364 mask = (uint16_t)1 << (pin - 48);
365 }
366
367 if (reg & mask)
368 return GPIO_DATA_HIGH;
369
370 return GPIO_DATA_LOW;
371}
372
373EXPORT_SYMBOL_GPL(vr41xx_gpio_get_pin);
374
375int vr41xx_gpio_set_pin(unsigned int pin, gpio_data_t data)
376{
377 uint16_t offset, mask, reg;
378 unsigned long flags;
379
380 if (pin >= giu_nr_pins)
381 return -EINVAL;
382
383 if (pin < 16) {
384 offset = GIUPIODL;
385 mask = (uint16_t)1 << pin;
386 } else if (pin < 32) {
387 offset = GIUPIODH;
388 mask = (uint16_t)1 << (pin - 16);
389 } else if (pin < 48) {
390 offset = GIUPODATL;
391 mask = (uint16_t)1 << (pin - 32);
392 } else {
393 offset = GIUPODATH;
394 mask = (uint16_t)1 << (pin - 48);
395 }
396
397 spin_lock_irqsave(&giu_lock, flags);
398
399 reg = giu_read(offset);
400 if (data == GPIO_DATA_HIGH)
401 reg |= mask;
402 else
403 reg &= ~mask;
404 giu_write(offset, reg);
405
406 spin_unlock_irqrestore(&giu_lock, flags);
407
408 return 0;
409}
410
411EXPORT_SYMBOL_GPL(vr41xx_gpio_set_pin);
412
413int vr41xx_gpio_set_direction(unsigned int pin, gpio_direction_t dir)
414{
415 uint16_t offset, mask, reg;
416 unsigned long flags;
417
418 if (pin >= giu_nr_pins)
419 return -EINVAL;
420
421 if (pin < 16) {
422 offset = GIUIOSELL;
423 mask = (uint16_t)1 << pin;
424 } else if (pin < 32) {
425 offset = GIUIOSELH;
426 mask = (uint16_t)1 << (pin - 16);
427 } else {
428 if (giu_flags & GPIO_HAS_OUTPUT_ENABLE) {
429 offset = GIUPODATEN;
430 mask = (uint16_t)1 << (pin - 32);
431 } else {
432 switch (pin) {
433 case 48:
434 offset = GIUPODATH;
435 mask = PIOEN0;
436 break;
437 case 49:
438 offset = GIUPODATH;
439 mask = PIOEN1;
440 break;
441 default:
442 return -EINVAL;
443 }
444 }
445 }
446
447 spin_lock_irqsave(&giu_lock, flags);
448
449 reg = giu_read(offset);
450 if (dir == GPIO_OUTPUT)
451 reg |= mask;
452 else
453 reg &= ~mask;
454 giu_write(offset, reg);
455
456 spin_unlock_irqrestore(&giu_lock, flags);
457
458 return 0;
459}
460
461EXPORT_SYMBOL_GPL(vr41xx_gpio_set_direction);
462
463int vr41xx_gpio_pullupdown(unsigned int pin, gpio_pull_t pull)
464{
465 uint16_t reg, mask;
466 unsigned long flags;
467
468 if ((giu_flags & GPIO_HAS_PULLUPDOWN_IO) != GPIO_HAS_PULLUPDOWN_IO)
469 return -EPERM;
470
471 if (pin >= 15)
472 return -EINVAL;
473
474 mask = (uint16_t)1 << pin;
475
476 spin_lock_irqsave(&giu_lock, flags);
477
478 if (pull == GPIO_PULL_UP || pull == GPIO_PULL_DOWN) {
479 reg = giu_read(GIUTERMUPDN);
480 if (pull == GPIO_PULL_UP)
481 reg |= mask;
482 else
483 reg &= ~mask;
484 giu_write(GIUTERMUPDN, reg);
485
486 reg = giu_read(GIUUSEUPDN);
487 reg |= mask;
488 giu_write(GIUUSEUPDN, reg);
489 } else {
490 reg = giu_read(GIUUSEUPDN);
491 reg &= ~mask;
492 giu_write(GIUUSEUPDN, reg);
493 }
494
495 spin_unlock_irqrestore(&giu_lock, flags);
496
497 return 0;
498}
499
500EXPORT_SYMBOL_GPL(vr41xx_gpio_pullupdown);
501
502static ssize_t gpio_read(struct file *file, char __user *buf, size_t len,
503 loff_t *ppos)
504{
505 unsigned int pin;
506 char value = '0';
507
508 pin = iminor(file->f_dentry->d_inode);
509 if (pin >= giu_nr_pins)
510 return -EBADF;
511
512 if (vr41xx_gpio_get_pin(pin) == GPIO_DATA_HIGH)
513 value = '1';
514
515 if (len <= 0)
516 return -EFAULT;
517
518 if (put_user(value, buf))
519 return -EFAULT;
520
521 return 1;
522}
523
524static ssize_t gpio_write(struct file *file, const char __user *data,
525 size_t len, loff_t *ppos)
526{
527 unsigned int pin;
528 size_t i;
529 char c;
530 int retval = 0;
531
532 pin = iminor(file->f_dentry->d_inode);
533 if (pin >= giu_nr_pins)
534 return -EBADF;
535
536 for (i = 0; i < len; i++) {
537 if (get_user(c, data + i))
538 return -EFAULT;
539
540 switch (c) {
541 case '0':
542 retval = vr41xx_gpio_set_pin(pin, GPIO_DATA_LOW);
543 break;
544 case '1':
545 retval = vr41xx_gpio_set_pin(pin, GPIO_DATA_HIGH);
546 break;
547 case 'D':
548 printk(KERN_INFO "GPIO%d: pull down\n", pin);
549 retval = vr41xx_gpio_pullupdown(pin, GPIO_PULL_DOWN);
550 break;
551 case 'd':
552 printk(KERN_INFO "GPIO%d: pull up/down disable\n", pin);
553 retval = vr41xx_gpio_pullupdown(pin, GPIO_PULL_DISABLE);
554 break;
555 case 'I':
556 printk(KERN_INFO "GPIO%d: input\n", pin);
557 retval = vr41xx_gpio_set_direction(pin, GPIO_INPUT);
558 break;
559 case 'O':
560 printk(KERN_INFO "GPIO%d: output\n", pin);
561 retval = vr41xx_gpio_set_direction(pin, GPIO_OUTPUT);
562 break;
563 case 'o':
564 printk(KERN_INFO "GPIO%d: output disable\n", pin);
565 retval = vr41xx_gpio_set_direction(pin, GPIO_OUTPUT_DISABLE);
566 break;
567 case 'P':
568 printk(KERN_INFO "GPIO%d: pull up\n", pin);
569 retval = vr41xx_gpio_pullupdown(pin, GPIO_PULL_UP);
570 break;
571 case 'p':
572 printk(KERN_INFO "GPIO%d: pull up/down disable\n", pin);
573 retval = vr41xx_gpio_pullupdown(pin, GPIO_PULL_DISABLE);
574 break;
575 default:
576 break;
577 }
578
579 if (retval < 0)
580 break;
581 }
582
583 return i;
584}
585
586static int gpio_open(struct inode *inode, struct file *file)
587{
588 unsigned int pin;
589
590 pin = iminor(inode);
591 if (pin >= giu_nr_pins)
592 return -EBADF;
593
594 return nonseekable_open(inode, file);
595}
596
597static int gpio_release(struct inode *inode, struct file *file)
598{
599 unsigned int pin;
600
601 pin = iminor(inode);
602 if (pin >= giu_nr_pins)
603 return -EBADF;
604
605 return 0;
606}
607
608static struct file_operations gpio_fops = {
609 .owner = THIS_MODULE,
610 .read = gpio_read,
611 .write = gpio_write,
612 .open = gpio_open,
613 .release = gpio_release,
614};
615
616static int giu_probe(struct device *dev)
617{
618 unsigned long start, size, flags = 0;
619 unsigned int nr_pins = 0;
620 struct resource *res1, *res2 = NULL;
621 void *base;
622 int retval, i;
623
624 switch (current_cpu_data.cputype) {
625 case CPU_VR4111:
626 case CPU_VR4121:
627 start = GIU_TYPE1_START;
628 size = GIU_TYPE1_SIZE;
629 flags = GPIO_HAS_PULLUPDOWN_IO;
630 nr_pins = 50;
631 break;
632 case CPU_VR4122:
633 case CPU_VR4131:
634 start = GIU_TYPE2_START;
635 size = GIU_TYPE2_SIZE;
636 nr_pins = 36;
637 break;
638 case CPU_VR4133:
639 start = GIU_TYPE3_START;
640 size = GIU_TYPE3_SIZE;
641 flags = GPIO_HAS_INTERRUPT_EDGE_SELECT;
642 nr_pins = 48;
643 break;
644 default:
645 return -ENODEV;
646 }
647
648 res1 = request_mem_region(start, size, "GIU");
649 if (res1 == NULL)
650 return -EBUSY;
651
652 base = ioremap(start, size);
653 if (base == NULL) {
654 release_resource(res1);
655 return -ENOMEM;
656 }
657
658 if (flags & GPIO_HAS_PULLUPDOWN_IO) {
659 res2 = request_mem_region(GIU_PULLUPDOWN_START, GIU_PULLUPDOWN_SIZE, "GIU");
660 if (res2 == NULL) {
661 iounmap(base);
662 release_resource(res1);
663 return -EBUSY;
664 }
665 }
666
667 retval = register_chrdev(major, "GIU", &gpio_fops);
668 if (retval < 0) {
669 iounmap(base);
670 release_resource(res1);
671 release_resource(res2);
672 return retval;
673 }
674
675 if (major == 0) {
676 major = retval;
677 printk(KERN_INFO "GIU: major number %d\n", major);
678 }
679
680 spin_lock_init(&giu_lock);
681 giu_base = base;
682 giu_resource1 = res1;
683 giu_resource2 = res2;
684 giu_flags = flags;
685 giu_nr_pins = nr_pins;
686
687 giu_write(GIUINTENL, 0);
688 giu_write(GIUINTENH, 0);
689
690 for (i = GIU_IRQ_BASE; i <= GIU_IRQ_LAST; i++) {
691 if (i < GIU_IRQ(GIUINT_HIGH_OFFSET))
692 irq_desc[i].handler = &giuint_low_irq_type;
693 else
694 irq_desc[i].handler = &giuint_high_irq_type;
695 }
696
697 return cascade_irq(GIUINT_IRQ, giu_get_irq);
698}
699
700static int giu_remove(struct device *dev)
701{
702 iounmap(giu_base);
703
704 release_resource(giu_resource1);
705 if (giu_flags & GPIO_HAS_PULLUPDOWN_IO)
706 release_resource(giu_resource2);
707
708 return 0;
709}
710
711static struct platform_device *giu_platform_device;
712
713static struct device_driver giu_device_driver = {
714 .name = "GIU",
715 .bus = &platform_bus_type,
716 .probe = giu_probe,
717 .remove = giu_remove,
718};
719
720static int __devinit vr41xx_giu_init(void)
721{
722 int retval;
723
724 giu_platform_device = platform_device_register_simple("GIU", -1, NULL, 0);
725 if (IS_ERR(giu_platform_device))
726 return PTR_ERR(giu_platform_device);
727
728 retval = driver_register(&giu_device_driver);
729 if (retval < 0)
730 platform_device_unregister(giu_platform_device);
731
732 return retval;
733}
734
735static void __devexit vr41xx_giu_exit(void)
736{
737 driver_unregister(&giu_device_driver);
738
739 platform_device_unregister(giu_platform_device);
740}
741
742module_init(vr41xx_giu_init);
743module_exit(vr41xx_giu_exit);
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig
index 3ac0a535b4aa..0273f124a4f7 100644
--- a/drivers/ide/Kconfig
+++ b/drivers/ide/Kconfig
@@ -672,8 +672,8 @@ config BLK_DEV_SVWKS
672 chipsets. 672 chipsets.
673 673
674config BLK_DEV_SGIIOC4 674config BLK_DEV_SGIIOC4
675 tristate "Silicon Graphics IOC4 chipset support" 675 tristate "Silicon Graphics IOC4 chipset ATA/ATAPI support"
676 depends on IA64_SGI_SN2 || IA64_GENERIC 676 depends on (IA64_SGI_SN2 || IA64_GENERIC) && SGI_IOC4
677 help 677 help
678 This driver adds PIO & MultiMode DMA-2 support for the SGI IOC4 678 This driver adds PIO & MultiMode DMA-2 support for the SGI IOC4
679 chipset, which has one channel and can support two devices. 679 chipset, which has one channel and can support two devices.
diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c
index 4651a22bf12e..af526b671c4e 100644
--- a/drivers/ide/pci/sgiioc4.c
+++ b/drivers/ide/pci/sgiioc4.c
@@ -34,7 +34,7 @@
34#include <linux/mm.h> 34#include <linux/mm.h>
35#include <linux/ioport.h> 35#include <linux/ioport.h>
36#include <linux/blkdev.h> 36#include <linux/blkdev.h>
37#include <linux/ioc4_common.h> 37#include <linux/ioc4.h>
38#include <asm/io.h> 38#include <asm/io.h>
39 39
40#include <linux/ide.h> 40#include <linux/ide.h>
@@ -715,14 +715,34 @@ static ide_pci_device_t sgiioc4_chipsets[] __devinitdata = {
715}; 715};
716 716
717int 717int
718ioc4_ide_attach_one(struct pci_dev *dev, const struct pci_device_id *id) 718ioc4_ide_attach_one(struct ioc4_driver_data *idd)
719{ 719{
720 return pci_init_sgiioc4(dev, &sgiioc4_chipsets[id->driver_data]); 720 return pci_init_sgiioc4(idd->idd_pdev,
721 &sgiioc4_chipsets[idd->idd_pci_id->driver_data]);
721} 722}
722 723
724static struct ioc4_submodule ioc4_ide_submodule = {
725 .is_name = "IOC4_ide",
726 .is_owner = THIS_MODULE,
727 .is_probe = ioc4_ide_attach_one,
728/* .is_remove = ioc4_ide_remove_one, */
729};
730
731static int __devinit
732ioc4_ide_init(void)
733{
734 return ioc4_register_submodule(&ioc4_ide_submodule);
735}
736
737static void __devexit
738ioc4_ide_exit(void)
739{
740 ioc4_unregister_submodule(&ioc4_ide_submodule);
741}
742
743module_init(ioc4_ide_init);
744module_exit(ioc4_ide_exit);
723 745
724MODULE_AUTHOR("Aniket Malatpure - Silicon Graphics Inc. (SGI)"); 746MODULE_AUTHOR("Aniket Malatpure - Silicon Graphics Inc. (SGI)");
725MODULE_DESCRIPTION("IDE PCI driver module for SGI IOC4 Base-IO Card"); 747MODULE_DESCRIPTION("IDE PCI driver module for SGI IOC4 Base-IO Card");
726MODULE_LICENSE("GPL"); 748MODULE_LICENSE("GPL");
727
728EXPORT_SYMBOL(ioc4_ide_attach_one);
diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c
index 9b8ff396e6f8..e152d0fa0cdd 100644
--- a/drivers/input/gameport/gameport.c
+++ b/drivers/input/gameport/gameport.c
@@ -134,7 +134,7 @@ static int gameport_measure_speed(struct gameport *gameport)
134 } 134 }
135 135
136 gameport_close(gameport); 136 gameport_close(gameport);
137 return (cpu_data[_smp_processor_id()].loops_per_jiffy * (unsigned long)HZ / (1000 / 50)) / (tx < 1 ? 1 : tx); 137 return (cpu_data[raw_smp_processor_id()].loops_per_jiffy * (unsigned long)HZ / (1000 / 50)) / (tx < 1 ? 1 : tx);
138 138
139#else 139#else
140 140
diff --git a/drivers/md/Makefile b/drivers/md/Makefile
index 90de9c146a5f..d3efedf6a6ad 100644
--- a/drivers/md/Makefile
+++ b/drivers/md/Makefile
@@ -7,6 +7,7 @@ dm-mod-objs := dm.o dm-table.o dm-target.o dm-linear.o dm-stripe.o \
7dm-multipath-objs := dm-hw-handler.o dm-path-selector.o dm-mpath.o 7dm-multipath-objs := dm-hw-handler.o dm-path-selector.o dm-mpath.o
8dm-snapshot-objs := dm-snap.o dm-exception-store.o 8dm-snapshot-objs := dm-snap.o dm-exception-store.o
9dm-mirror-objs := dm-log.o dm-raid1.o 9dm-mirror-objs := dm-log.o dm-raid1.o
10md-mod-objs := md.o bitmap.o
10raid6-objs := raid6main.o raid6algos.o raid6recov.o raid6tables.o \ 11raid6-objs := raid6main.o raid6algos.o raid6recov.o raid6tables.o \
11 raid6int1.o raid6int2.o raid6int4.o \ 12 raid6int1.o raid6int2.o raid6int4.o \
12 raid6int8.o raid6int16.o raid6int32.o \ 13 raid6int8.o raid6int16.o raid6int32.o \
@@ -28,7 +29,7 @@ obj-$(CONFIG_MD_RAID5) += raid5.o xor.o
28obj-$(CONFIG_MD_RAID6) += raid6.o xor.o 29obj-$(CONFIG_MD_RAID6) += raid6.o xor.o
29obj-$(CONFIG_MD_MULTIPATH) += multipath.o 30obj-$(CONFIG_MD_MULTIPATH) += multipath.o
30obj-$(CONFIG_MD_FAULTY) += faulty.o 31obj-$(CONFIG_MD_FAULTY) += faulty.o
31obj-$(CONFIG_BLK_DEV_MD) += md.o 32obj-$(CONFIG_BLK_DEV_MD) += md-mod.o
32obj-$(CONFIG_BLK_DEV_DM) += dm-mod.o 33obj-$(CONFIG_BLK_DEV_DM) += dm-mod.o
33obj-$(CONFIG_DM_CRYPT) += dm-crypt.o 34obj-$(CONFIG_DM_CRYPT) += dm-crypt.o
34obj-$(CONFIG_DM_MULTIPATH) += dm-multipath.o dm-round-robin.o 35obj-$(CONFIG_DM_MULTIPATH) += dm-multipath.o dm-round-robin.o
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
new file mode 100644
index 000000000000..95980ad6b27b
--- /dev/null
+++ b/drivers/md/bitmap.c
@@ -0,0 +1,1586 @@
1/*
2 * bitmap.c two-level bitmap (C) Peter T. Breuer (ptb@ot.uc3m.es) 2003
3 *
4 * bitmap_create - sets up the bitmap structure
5 * bitmap_destroy - destroys the bitmap structure
6 *
7 * additions, Copyright (C) 2003-2004, Paul Clements, SteelEye Technology, Inc.:
8 * - added disk storage for bitmap
9 * - changes to allow various bitmap chunk sizes
10 * - added bitmap daemon (to asynchronously clear bitmap bits from disk)
11 */
12
13/*
14 * Still to do:
15 *
16 * flush after percent set rather than just time based. (maybe both).
17 * wait if count gets too high, wake when it drops to half.
18 * allow bitmap to be mirrored with superblock (before or after...)
19 * allow hot-add to re-instate a current device.
20 * allow hot-add of bitmap after quiessing device
21 */
22
23#include <linux/module.h>
24#include <linux/version.h>
25#include <linux/errno.h>
26#include <linux/slab.h>
27#include <linux/init.h>
28#include <linux/config.h>
29#include <linux/timer.h>
30#include <linux/sched.h>
31#include <linux/list.h>
32#include <linux/file.h>
33#include <linux/mount.h>
34#include <linux/buffer_head.h>
35#include <linux/raid/md.h>
36#include <linux/raid/bitmap.h>
37
38/* debug macros */
39
40#define DEBUG 0
41
42#if DEBUG
43/* these are for debugging purposes only! */
44
45/* define one and only one of these */
46#define INJECT_FAULTS_1 0 /* cause bitmap_alloc_page to fail always */
47#define INJECT_FAULTS_2 0 /* cause bitmap file to be kicked when first bit set*/
48#define INJECT_FAULTS_3 0 /* treat bitmap file as kicked at init time */
49#define INJECT_FAULTS_4 0 /* undef */
50#define INJECT_FAULTS_5 0 /* undef */
51#define INJECT_FAULTS_6 0
52
53/* if these are defined, the driver will fail! debug only */
54#define INJECT_FATAL_FAULT_1 0 /* fail kmalloc, causing bitmap_create to fail */
55#define INJECT_FATAL_FAULT_2 0 /* undef */
56#define INJECT_FATAL_FAULT_3 0 /* undef */
57#endif
58
59//#define DPRINTK PRINTK /* set this NULL to avoid verbose debug output */
60#define DPRINTK(x...) do { } while(0)
61
62#ifndef PRINTK
63# if DEBUG > 0
64# define PRINTK(x...) printk(KERN_DEBUG x)
65# else
66# define PRINTK(x...)
67# endif
68#endif
69
70static inline char * bmname(struct bitmap *bitmap)
71{
72 return bitmap->mddev ? mdname(bitmap->mddev) : "mdX";
73}
74
75
76/*
77 * test if the bitmap is active
78 */
79int bitmap_active(struct bitmap *bitmap)
80{
81 unsigned long flags;
82 int res = 0;
83
84 if (!bitmap)
85 return res;
86 spin_lock_irqsave(&bitmap->lock, flags);
87 res = bitmap->flags & BITMAP_ACTIVE;
88 spin_unlock_irqrestore(&bitmap->lock, flags);
89 return res;
90}
91
92#define WRITE_POOL_SIZE 256
93/* mempool for queueing pending writes on the bitmap file */
94static void *write_pool_alloc(unsigned int gfp_flags, void *data)
95{
96 return kmalloc(sizeof(struct page_list), gfp_flags);
97}
98
99static void write_pool_free(void *ptr, void *data)
100{
101 kfree(ptr);
102}
103
104/*
105 * just a placeholder - calls kmalloc for bitmap pages
106 */
107static unsigned char *bitmap_alloc_page(struct bitmap *bitmap)
108{
109 unsigned char *page;
110
111#if INJECT_FAULTS_1
112 page = NULL;
113#else
114 page = kmalloc(PAGE_SIZE, GFP_NOIO);
115#endif
116 if (!page)
117 printk("%s: bitmap_alloc_page FAILED\n", bmname(bitmap));
118 else
119 PRINTK("%s: bitmap_alloc_page: allocated page at %p\n",
120 bmname(bitmap), page);
121 return page;
122}
123
124/*
125 * for now just a placeholder -- just calls kfree for bitmap pages
126 */
127static void bitmap_free_page(struct bitmap *bitmap, unsigned char *page)
128{
129 PRINTK("%s: bitmap_free_page: free page %p\n", bmname(bitmap), page);
130 kfree(page);
131}
132
133/*
134 * check a page and, if necessary, allocate it (or hijack it if the alloc fails)
135 *
136 * 1) check to see if this page is allocated, if it's not then try to alloc
137 * 2) if the alloc fails, set the page's hijacked flag so we'll use the
138 * page pointer directly as a counter
139 *
140 * if we find our page, we increment the page's refcount so that it stays
141 * allocated while we're using it
142 */
143static int bitmap_checkpage(struct bitmap *bitmap, unsigned long page, int create)
144{
145 unsigned char *mappage;
146
147 if (page >= bitmap->pages) {
148 printk(KERN_ALERT
149 "%s: invalid bitmap page request: %lu (> %lu)\n",
150 bmname(bitmap), page, bitmap->pages-1);
151 return -EINVAL;
152 }
153
154
155 if (bitmap->bp[page].hijacked) /* it's hijacked, don't try to alloc */
156 return 0;
157
158 if (bitmap->bp[page].map) /* page is already allocated, just return */
159 return 0;
160
161 if (!create)
162 return -ENOENT;
163
164 spin_unlock_irq(&bitmap->lock);
165
166 /* this page has not been allocated yet */
167
168 if ((mappage = bitmap_alloc_page(bitmap)) == NULL) {
169 PRINTK("%s: bitmap map page allocation failed, hijacking\n",
170 bmname(bitmap));
171 /* failed - set the hijacked flag so that we can use the
172 * pointer as a counter */
173 spin_lock_irq(&bitmap->lock);
174 if (!bitmap->bp[page].map)
175 bitmap->bp[page].hijacked = 1;
176 goto out;
177 }
178
179 /* got a page */
180
181 spin_lock_irq(&bitmap->lock);
182
183 /* recheck the page */
184
185 if (bitmap->bp[page].map || bitmap->bp[page].hijacked) {
186 /* somebody beat us to getting the page */
187 bitmap_free_page(bitmap, mappage);
188 return 0;
189 }
190
191 /* no page was in place and we have one, so install it */
192
193 memset(mappage, 0, PAGE_SIZE);
194 bitmap->bp[page].map = mappage;
195 bitmap->missing_pages--;
196out:
197 return 0;
198}
199
200
201/* if page is completely empty, put it back on the free list, or dealloc it */
202/* if page was hijacked, unmark the flag so it might get alloced next time */
203/* Note: lock should be held when calling this */
204static inline void bitmap_checkfree(struct bitmap *bitmap, unsigned long page)
205{
206 char *ptr;
207
208 if (bitmap->bp[page].count) /* page is still busy */
209 return;
210
211 /* page is no longer in use, it can be released */
212
213 if (bitmap->bp[page].hijacked) { /* page was hijacked, undo this now */
214 bitmap->bp[page].hijacked = 0;
215 bitmap->bp[page].map = NULL;
216 return;
217 }
218
219 /* normal case, free the page */
220
221#if 0
222/* actually ... let's not. We will probably need the page again exactly when
223 * memory is tight and we are flusing to disk
224 */
225 return;
226#else
227 ptr = bitmap->bp[page].map;
228 bitmap->bp[page].map = NULL;
229 bitmap->missing_pages++;
230 bitmap_free_page(bitmap, ptr);
231 return;
232#endif
233}
234
235
236/*
237 * bitmap file handling - read and write the bitmap file and its superblock
238 */
239
240/* copy the pathname of a file to a buffer */
241char *file_path(struct file *file, char *buf, int count)
242{
243 struct dentry *d;
244 struct vfsmount *v;
245
246 if (!buf)
247 return NULL;
248
249 d = file->f_dentry;
250 v = file->f_vfsmnt;
251
252 buf = d_path(d, v, buf, count);
253
254 return IS_ERR(buf) ? NULL : buf;
255}
256
257/*
258 * basic page I/O operations
259 */
260
261/* IO operations when bitmap is stored near all superblocks */
262static struct page *read_sb_page(mddev_t *mddev, long offset, unsigned long index)
263{
264 /* choose a good rdev and read the page from there */
265
266 mdk_rdev_t *rdev;
267 struct list_head *tmp;
268 struct page *page = alloc_page(GFP_KERNEL);
269 sector_t target;
270
271 if (!page)
272 return ERR_PTR(-ENOMEM);
273 do {
274 ITERATE_RDEV(mddev, rdev, tmp)
275 if (rdev->in_sync && !rdev->faulty)
276 goto found;
277 return ERR_PTR(-EIO);
278
279 found:
280 target = (rdev->sb_offset << 1) + offset + index * (PAGE_SIZE/512);
281
282 } while (!sync_page_io(rdev->bdev, target, PAGE_SIZE, page, READ));
283
284 page->index = index;
285 return page;
286}
287
288static int write_sb_page(mddev_t *mddev, long offset, struct page *page, int wait)
289{
290 mdk_rdev_t *rdev;
291 struct list_head *tmp;
292
293 ITERATE_RDEV(mddev, rdev, tmp)
294 if (rdev->in_sync && !rdev->faulty)
295 md_super_write(mddev, rdev,
296 (rdev->sb_offset<<1) + offset
297 + page->index * (PAGE_SIZE/512),
298 PAGE_SIZE,
299 page);
300
301 if (wait)
302 wait_event(mddev->sb_wait, atomic_read(&mddev->pending_writes)==0);
303 return 0;
304}
305
306/*
307 * write out a page to a file
308 */
309static int write_page(struct bitmap *bitmap, struct page *page, int wait)
310{
311 int ret = -ENOMEM;
312
313 if (bitmap->file == NULL)
314 return write_sb_page(bitmap->mddev, bitmap->offset, page, wait);
315
316 if (wait)
317 lock_page(page);
318 else {
319 if (TestSetPageLocked(page))
320 return -EAGAIN; /* already locked */
321 if (PageWriteback(page)) {
322 unlock_page(page);
323 return -EAGAIN;
324 }
325 }
326
327 ret = page->mapping->a_ops->prepare_write(NULL, page, 0, PAGE_SIZE);
328 if (!ret)
329 ret = page->mapping->a_ops->commit_write(NULL, page, 0,
330 PAGE_SIZE);
331 if (ret) {
332 unlock_page(page);
333 return ret;
334 }
335
336 set_page_dirty(page); /* force it to be written out */
337
338 if (!wait) {
339 /* add to list to be waited for by daemon */
340 struct page_list *item = mempool_alloc(bitmap->write_pool, GFP_NOIO);
341 item->page = page;
342 page_cache_get(page);
343 spin_lock(&bitmap->write_lock);
344 list_add(&item->list, &bitmap->complete_pages);
345 spin_unlock(&bitmap->write_lock);
346 md_wakeup_thread(bitmap->writeback_daemon);
347 }
348 return write_one_page(page, wait);
349}
350
351/* read a page from a file, pinning it into cache, and return bytes_read */
352static struct page *read_page(struct file *file, unsigned long index,
353 unsigned long *bytes_read)
354{
355 struct inode *inode = file->f_mapping->host;
356 struct page *page = NULL;
357 loff_t isize = i_size_read(inode);
358 unsigned long end_index = isize >> PAGE_CACHE_SHIFT;
359
360 PRINTK("read bitmap file (%dB @ %Lu)\n", (int)PAGE_CACHE_SIZE,
361 (unsigned long long)index << PAGE_CACHE_SHIFT);
362
363 page = read_cache_page(inode->i_mapping, index,
364 (filler_t *)inode->i_mapping->a_ops->readpage, file);
365 if (IS_ERR(page))
366 goto out;
367 wait_on_page_locked(page);
368 if (!PageUptodate(page) || PageError(page)) {
369 page_cache_release(page);
370 page = ERR_PTR(-EIO);
371 goto out;
372 }
373
374 if (index > end_index) /* we have read beyond EOF */
375 *bytes_read = 0;
376 else if (index == end_index) /* possible short read */
377 *bytes_read = isize & ~PAGE_CACHE_MASK;
378 else
379 *bytes_read = PAGE_CACHE_SIZE; /* got a full page */
380out:
381 if (IS_ERR(page))
382 printk(KERN_ALERT "md: bitmap read error: (%dB @ %Lu): %ld\n",
383 (int)PAGE_CACHE_SIZE,
384 (unsigned long long)index << PAGE_CACHE_SHIFT,
385 PTR_ERR(page));
386 return page;
387}
388
389/*
390 * bitmap file superblock operations
391 */
392
393/* update the event counter and sync the superblock to disk */
394int bitmap_update_sb(struct bitmap *bitmap)
395{
396 bitmap_super_t *sb;
397 unsigned long flags;
398
399 if (!bitmap || !bitmap->mddev) /* no bitmap for this array */
400 return 0;
401 spin_lock_irqsave(&bitmap->lock, flags);
402 if (!bitmap->sb_page) { /* no superblock */
403 spin_unlock_irqrestore(&bitmap->lock, flags);
404 return 0;
405 }
406 spin_unlock_irqrestore(&bitmap->lock, flags);
407 sb = (bitmap_super_t *)kmap(bitmap->sb_page);
408 sb->events = cpu_to_le64(bitmap->mddev->events);
409 if (!bitmap->mddev->degraded)
410 sb->events_cleared = cpu_to_le64(bitmap->mddev->events);
411 kunmap(bitmap->sb_page);
412 return write_page(bitmap, bitmap->sb_page, 1);
413}
414
415/* print out the bitmap file superblock */
416void bitmap_print_sb(struct bitmap *bitmap)
417{
418 bitmap_super_t *sb;
419
420 if (!bitmap || !bitmap->sb_page)
421 return;
422 sb = (bitmap_super_t *)kmap(bitmap->sb_page);
423 printk(KERN_DEBUG "%s: bitmap file superblock:\n", bmname(bitmap));
424 printk(KERN_DEBUG " magic: %08x\n", le32_to_cpu(sb->magic));
425 printk(KERN_DEBUG " version: %d\n", le32_to_cpu(sb->version));
426 printk(KERN_DEBUG " uuid: %08x.%08x.%08x.%08x\n",
427 *(__u32 *)(sb->uuid+0),
428 *(__u32 *)(sb->uuid+4),
429 *(__u32 *)(sb->uuid+8),
430 *(__u32 *)(sb->uuid+12));
431 printk(KERN_DEBUG " events: %llu\n",
432 (unsigned long long) le64_to_cpu(sb->events));
433 printk(KERN_DEBUG "events cleared: %llu\n",
434 (unsigned long long) le64_to_cpu(sb->events_cleared));
435 printk(KERN_DEBUG " state: %08x\n", le32_to_cpu(sb->state));
436 printk(KERN_DEBUG " chunksize: %d B\n", le32_to_cpu(sb->chunksize));
437 printk(KERN_DEBUG " daemon sleep: %ds\n", le32_to_cpu(sb->daemon_sleep));
438 printk(KERN_DEBUG " sync size: %llu KB\n",
439 (unsigned long long)le64_to_cpu(sb->sync_size)/2);
440 kunmap(bitmap->sb_page);
441}
442
443/* read the superblock from the bitmap file and initialize some bitmap fields */
444static int bitmap_read_sb(struct bitmap *bitmap)
445{
446 char *reason = NULL;
447 bitmap_super_t *sb;
448 unsigned long chunksize, daemon_sleep;
449 unsigned long bytes_read;
450 unsigned long long events;
451 int err = -EINVAL;
452
453 /* page 0 is the superblock, read it... */
454 if (bitmap->file)
455 bitmap->sb_page = read_page(bitmap->file, 0, &bytes_read);
456 else {
457 bitmap->sb_page = read_sb_page(bitmap->mddev, bitmap->offset, 0);
458 bytes_read = PAGE_SIZE;
459 }
460 if (IS_ERR(bitmap->sb_page)) {
461 err = PTR_ERR(bitmap->sb_page);
462 bitmap->sb_page = NULL;
463 return err;
464 }
465
466 sb = (bitmap_super_t *)kmap(bitmap->sb_page);
467
468 if (bytes_read < sizeof(*sb)) { /* short read */
469 printk(KERN_INFO "%s: bitmap file superblock truncated\n",
470 bmname(bitmap));
471 err = -ENOSPC;
472 goto out;
473 }
474
475 chunksize = le32_to_cpu(sb->chunksize);
476 daemon_sleep = le32_to_cpu(sb->daemon_sleep);
477
478 /* verify that the bitmap-specific fields are valid */
479 if (sb->magic != cpu_to_le32(BITMAP_MAGIC))
480 reason = "bad magic";
481 else if (sb->version != cpu_to_le32(BITMAP_MAJOR))
482 reason = "unrecognized superblock version";
483 else if (chunksize < 512 || chunksize > (1024 * 1024 * 4))
484 reason = "bitmap chunksize out of range (512B - 4MB)";
485 else if ((1 << ffz(~chunksize)) != chunksize)
486 reason = "bitmap chunksize not a power of 2";
487 else if (daemon_sleep < 1 || daemon_sleep > 15)
488 reason = "daemon sleep period out of range";
489 if (reason) {
490 printk(KERN_INFO "%s: invalid bitmap file superblock: %s\n",
491 bmname(bitmap), reason);
492 goto out;
493 }
494
495 /* keep the array size field of the bitmap superblock up to date */
496 sb->sync_size = cpu_to_le64(bitmap->mddev->resync_max_sectors);
497
498 if (!bitmap->mddev->persistent)
499 goto success;
500
501 /*
502 * if we have a persistent array superblock, compare the
503 * bitmap's UUID and event counter to the mddev's
504 */
505 if (memcmp(sb->uuid, bitmap->mddev->uuid, 16)) {
506 printk(KERN_INFO "%s: bitmap superblock UUID mismatch\n",
507 bmname(bitmap));
508 goto out;
509 }
510 events = le64_to_cpu(sb->events);
511 if (events < bitmap->mddev->events) {
512 printk(KERN_INFO "%s: bitmap file is out of date (%llu < %llu) "
513 "-- forcing full recovery\n", bmname(bitmap), events,
514 (unsigned long long) bitmap->mddev->events);
515 sb->state |= BITMAP_STALE;
516 }
517success:
518 /* assign fields using values from superblock */
519 bitmap->chunksize = chunksize;
520 bitmap->daemon_sleep = daemon_sleep;
521 bitmap->flags |= sb->state;
522 bitmap->events_cleared = le64_to_cpu(sb->events_cleared);
523 err = 0;
524out:
525 kunmap(bitmap->sb_page);
526 if (err)
527 bitmap_print_sb(bitmap);
528 return err;
529}
530
531enum bitmap_mask_op {
532 MASK_SET,
533 MASK_UNSET
534};
535
536/* record the state of the bitmap in the superblock */
537static void bitmap_mask_state(struct bitmap *bitmap, enum bitmap_state bits,
538 enum bitmap_mask_op op)
539{
540 bitmap_super_t *sb;
541 unsigned long flags;
542
543 spin_lock_irqsave(&bitmap->lock, flags);
544 if (!bitmap || !bitmap->sb_page) { /* can't set the state */
545 spin_unlock_irqrestore(&bitmap->lock, flags);
546 return;
547 }
548 page_cache_get(bitmap->sb_page);
549 spin_unlock_irqrestore(&bitmap->lock, flags);
550 sb = (bitmap_super_t *)kmap(bitmap->sb_page);
551 switch (op) {
552 case MASK_SET: sb->state |= bits;
553 break;
554 case MASK_UNSET: sb->state &= ~bits;
555 break;
556 default: BUG();
557 }
558 kunmap(bitmap->sb_page);
559 page_cache_release(bitmap->sb_page);
560}
561
562/*
563 * general bitmap file operations
564 */
565
566/* calculate the index of the page that contains this bit */
567static inline unsigned long file_page_index(unsigned long chunk)
568{
569 return CHUNK_BIT_OFFSET(chunk) >> PAGE_BIT_SHIFT;
570}
571
572/* calculate the (bit) offset of this bit within a page */
573static inline unsigned long file_page_offset(unsigned long chunk)
574{
575 return CHUNK_BIT_OFFSET(chunk) & (PAGE_BITS - 1);
576}
577
578/*
579 * return a pointer to the page in the filemap that contains the given bit
580 *
581 * this lookup is complicated by the fact that the bitmap sb might be exactly
582 * 1 page (e.g., x86) or less than 1 page -- so the bitmap might start on page
583 * 0 or page 1
584 */
585static inline struct page *filemap_get_page(struct bitmap *bitmap,
586 unsigned long chunk)
587{
588 return bitmap->filemap[file_page_index(chunk) - file_page_index(0)];
589}
590
591
592static void bitmap_file_unmap(struct bitmap *bitmap)
593{
594 struct page **map, *sb_page;
595 unsigned long *attr;
596 int pages;
597 unsigned long flags;
598
599 spin_lock_irqsave(&bitmap->lock, flags);
600 map = bitmap->filemap;
601 bitmap->filemap = NULL;
602 attr = bitmap->filemap_attr;
603 bitmap->filemap_attr = NULL;
604 pages = bitmap->file_pages;
605 bitmap->file_pages = 0;
606 sb_page = bitmap->sb_page;
607 bitmap->sb_page = NULL;
608 spin_unlock_irqrestore(&bitmap->lock, flags);
609
610 while (pages--)
611 if (map[pages]->index != 0) /* 0 is sb_page, release it below */
612 page_cache_release(map[pages]);
613 kfree(map);
614 kfree(attr);
615
616 if (sb_page)
617 page_cache_release(sb_page);
618}
619
620static void bitmap_stop_daemons(struct bitmap *bitmap);
621
622/* dequeue the next item in a page list -- don't call from irq context */
623static struct page_list *dequeue_page(struct bitmap *bitmap)
624{
625 struct page_list *item = NULL;
626 struct list_head *head = &bitmap->complete_pages;
627
628 spin_lock(&bitmap->write_lock);
629 if (list_empty(head))
630 goto out;
631 item = list_entry(head->prev, struct page_list, list);
632 list_del(head->prev);
633out:
634 spin_unlock(&bitmap->write_lock);
635 return item;
636}
637
638static void drain_write_queues(struct bitmap *bitmap)
639{
640 struct page_list *item;
641
642 while ((item = dequeue_page(bitmap))) {
643 /* don't bother to wait */
644 page_cache_release(item->page);
645 mempool_free(item, bitmap->write_pool);
646 }
647
648 wake_up(&bitmap->write_wait);
649}
650
651static void bitmap_file_put(struct bitmap *bitmap)
652{
653 struct file *file;
654 struct inode *inode;
655 unsigned long flags;
656
657 spin_lock_irqsave(&bitmap->lock, flags);
658 file = bitmap->file;
659 bitmap->file = NULL;
660 spin_unlock_irqrestore(&bitmap->lock, flags);
661
662 bitmap_stop_daemons(bitmap);
663
664 drain_write_queues(bitmap);
665
666 bitmap_file_unmap(bitmap);
667
668 if (file) {
669 inode = file->f_mapping->host;
670 spin_lock(&inode->i_lock);
671 atomic_set(&inode->i_writecount, 1); /* allow writes again */
672 spin_unlock(&inode->i_lock);
673 fput(file);
674 }
675}
676
677
678/*
679 * bitmap_file_kick - if an error occurs while manipulating the bitmap file
680 * then it is no longer reliable, so we stop using it and we mark the file
681 * as failed in the superblock
682 */
683static void bitmap_file_kick(struct bitmap *bitmap)
684{
685 char *path, *ptr = NULL;
686
687 bitmap_mask_state(bitmap, BITMAP_STALE, MASK_SET);
688 bitmap_update_sb(bitmap);
689
690 if (bitmap->file) {
691 path = kmalloc(PAGE_SIZE, GFP_KERNEL);
692 if (path)
693 ptr = file_path(bitmap->file, path, PAGE_SIZE);
694
695 printk(KERN_ALERT "%s: kicking failed bitmap file %s from array!\n",
696 bmname(bitmap), ptr ? ptr : "");
697
698 kfree(path);
699 }
700
701 bitmap_file_put(bitmap);
702
703 return;
704}
705
706enum bitmap_page_attr {
707 BITMAP_PAGE_DIRTY = 1, // there are set bits that need to be synced
708 BITMAP_PAGE_CLEAN = 2, // there are bits that might need to be cleared
709 BITMAP_PAGE_NEEDWRITE=4, // there are cleared bits that need to be synced
710};
711
712static inline void set_page_attr(struct bitmap *bitmap, struct page *page,
713 enum bitmap_page_attr attr)
714{
715 bitmap->filemap_attr[page->index] |= attr;
716}
717
718static inline void clear_page_attr(struct bitmap *bitmap, struct page *page,
719 enum bitmap_page_attr attr)
720{
721 bitmap->filemap_attr[page->index] &= ~attr;
722}
723
724static inline unsigned long get_page_attr(struct bitmap *bitmap, struct page *page)
725{
726 return bitmap->filemap_attr[page->index];
727}
728
729/*
730 * bitmap_file_set_bit -- called before performing a write to the md device
731 * to set (and eventually sync) a particular bit in the bitmap file
732 *
733 * we set the bit immediately, then we record the page number so that
734 * when an unplug occurs, we can flush the dirty pages out to disk
735 */
736static void bitmap_file_set_bit(struct bitmap *bitmap, sector_t block)
737{
738 unsigned long bit;
739 struct page *page;
740 void *kaddr;
741 unsigned long chunk = block >> CHUNK_BLOCK_SHIFT(bitmap);
742
743 if (!bitmap->filemap) {
744 return;
745 }
746
747 page = filemap_get_page(bitmap, chunk);
748 bit = file_page_offset(chunk);
749
750
751 /* make sure the page stays cached until it gets written out */
752 if (! (get_page_attr(bitmap, page) & BITMAP_PAGE_DIRTY))
753 page_cache_get(page);
754
755 /* set the bit */
756 kaddr = kmap_atomic(page, KM_USER0);
757 set_bit(bit, kaddr);
758 kunmap_atomic(kaddr, KM_USER0);
759 PRINTK("set file bit %lu page %lu\n", bit, page->index);
760
761 /* record page number so it gets flushed to disk when unplug occurs */
762 set_page_attr(bitmap, page, BITMAP_PAGE_DIRTY);
763
764}
765
766/* this gets called when the md device is ready to unplug its underlying
767 * (slave) device queues -- before we let any writes go down, we need to
768 * sync the dirty pages of the bitmap file to disk */
769int bitmap_unplug(struct bitmap *bitmap)
770{
771 unsigned long i, attr, flags;
772 struct page *page;
773 int wait = 0;
774 int err;
775
776 if (!bitmap)
777 return 0;
778
779 /* look at each page to see if there are any set bits that need to be
780 * flushed out to disk */
781 for (i = 0; i < bitmap->file_pages; i++) {
782 spin_lock_irqsave(&bitmap->lock, flags);
783 if (!bitmap->filemap) {
784 spin_unlock_irqrestore(&bitmap->lock, flags);
785 return 0;
786 }
787 page = bitmap->filemap[i];
788 attr = get_page_attr(bitmap, page);
789 clear_page_attr(bitmap, page, BITMAP_PAGE_DIRTY);
790 clear_page_attr(bitmap, page, BITMAP_PAGE_NEEDWRITE);
791 if ((attr & BITMAP_PAGE_DIRTY))
792 wait = 1;
793 spin_unlock_irqrestore(&bitmap->lock, flags);
794
795 if (attr & (BITMAP_PAGE_DIRTY | BITMAP_PAGE_NEEDWRITE)) {
796 err = write_page(bitmap, page, 0);
797 if (err == -EAGAIN) {
798 if (attr & BITMAP_PAGE_DIRTY)
799 err = write_page(bitmap, page, 1);
800 else
801 err = 0;
802 }
803 if (err)
804 return 1;
805 }
806 }
807 if (wait) { /* if any writes were performed, we need to wait on them */
808 if (bitmap->file) {
809 spin_lock_irq(&bitmap->write_lock);
810 wait_event_lock_irq(bitmap->write_wait,
811 list_empty(&bitmap->complete_pages), bitmap->write_lock,
812 wake_up_process(bitmap->writeback_daemon->tsk));
813 spin_unlock_irq(&bitmap->write_lock);
814 } else
815 wait_event(bitmap->mddev->sb_wait,
816 atomic_read(&bitmap->mddev->pending_writes)==0);
817 }
818 return 0;
819}
820
821static void bitmap_set_memory_bits(struct bitmap *bitmap, sector_t offset,
822 unsigned long sectors, int in_sync);
823/* * bitmap_init_from_disk -- called at bitmap_create time to initialize
824 * the in-memory bitmap from the on-disk bitmap -- also, sets up the
825 * memory mapping of the bitmap file
826 * Special cases:
827 * if there's no bitmap file, or if the bitmap file had been
828 * previously kicked from the array, we mark all the bits as
829 * 1's in order to cause a full resync.
830 */
831static int bitmap_init_from_disk(struct bitmap *bitmap, int in_sync)
832{
833 unsigned long i, chunks, index, oldindex, bit;
834 struct page *page = NULL, *oldpage = NULL;
835 unsigned long num_pages, bit_cnt = 0;
836 struct file *file;
837 unsigned long bytes, offset, dummy;
838 int outofdate;
839 int ret = -ENOSPC;
840
841 chunks = bitmap->chunks;
842 file = bitmap->file;
843
844 BUG_ON(!file && !bitmap->offset);
845
846#if INJECT_FAULTS_3
847 outofdate = 1;
848#else
849 outofdate = bitmap->flags & BITMAP_STALE;
850#endif
851 if (outofdate)
852 printk(KERN_INFO "%s: bitmap file is out of date, doing full "
853 "recovery\n", bmname(bitmap));
854
855 bytes = (chunks + 7) / 8;
856
857 num_pages = (bytes + sizeof(bitmap_super_t) + PAGE_SIZE - 1) / PAGE_SIZE;
858
859 if (file && i_size_read(file->f_mapping->host) < bytes + sizeof(bitmap_super_t)) {
860 printk(KERN_INFO "%s: bitmap file too short %lu < %lu\n",
861 bmname(bitmap),
862 (unsigned long) i_size_read(file->f_mapping->host),
863 bytes + sizeof(bitmap_super_t));
864 goto out;
865 }
866
867 ret = -ENOMEM;
868
869 bitmap->filemap = kmalloc(sizeof(struct page *) * num_pages, GFP_KERNEL);
870 if (!bitmap->filemap)
871 goto out;
872
873 bitmap->filemap_attr = kmalloc(sizeof(long) * num_pages, GFP_KERNEL);
874 if (!bitmap->filemap_attr)
875 goto out;
876
877 memset(bitmap->filemap_attr, 0, sizeof(long) * num_pages);
878
879 oldindex = ~0L;
880
881 for (i = 0; i < chunks; i++) {
882 index = file_page_index(i);
883 bit = file_page_offset(i);
884 if (index != oldindex) { /* this is a new page, read it in */
885 /* unmap the old page, we're done with it */
886 if (oldpage != NULL)
887 kunmap(oldpage);
888 if (index == 0) {
889 /*
890 * if we're here then the superblock page
891 * contains some bits (PAGE_SIZE != sizeof sb)
892 * we've already read it in, so just use it
893 */
894 page = bitmap->sb_page;
895 offset = sizeof(bitmap_super_t);
896 } else if (file) {
897 page = read_page(file, index, &dummy);
898 offset = 0;
899 } else {
900 page = read_sb_page(bitmap->mddev, bitmap->offset, index);
901 offset = 0;
902 }
903 if (IS_ERR(page)) { /* read error */
904 ret = PTR_ERR(page);
905 goto out;
906 }
907
908 oldindex = index;
909 oldpage = page;
910 kmap(page);
911
912 if (outofdate) {
913 /*
914 * if bitmap is out of date, dirty the
915 * whole page and write it out
916 */
917 memset(page_address(page) + offset, 0xff,
918 PAGE_SIZE - offset);
919 ret = write_page(bitmap, page, 1);
920 if (ret) {
921 kunmap(page);
922 /* release, page not in filemap yet */
923 page_cache_release(page);
924 goto out;
925 }
926 }
927
928 bitmap->filemap[bitmap->file_pages++] = page;
929 }
930 if (test_bit(bit, page_address(page))) {
931 /* if the disk bit is set, set the memory bit */
932 bitmap_set_memory_bits(bitmap,
933 i << CHUNK_BLOCK_SHIFT(bitmap), 1, in_sync);
934 bit_cnt++;
935 }
936 }
937
938 /* everything went OK */
939 ret = 0;
940 bitmap_mask_state(bitmap, BITMAP_STALE, MASK_UNSET);
941
942 if (page) /* unmap the last page */
943 kunmap(page);
944
945 if (bit_cnt) { /* Kick recovery if any bits were set */
946 set_bit(MD_RECOVERY_NEEDED, &bitmap->mddev->recovery);
947 md_wakeup_thread(bitmap->mddev->thread);
948 }
949
950out:
951 printk(KERN_INFO "%s: bitmap initialized from disk: "
952 "read %lu/%lu pages, set %lu bits, status: %d\n",
953 bmname(bitmap), bitmap->file_pages, num_pages, bit_cnt, ret);
954
955 return ret;
956}
957
958void bitmap_write_all(struct bitmap *bitmap)
959{
960 /* We don't actually write all bitmap blocks here,
961 * just flag them as needing to be written
962 */
963
964 unsigned long chunks = bitmap->chunks;
965 unsigned long bytes = (chunks+7)/8 + sizeof(bitmap_super_t);
966 unsigned long num_pages = (bytes + PAGE_SIZE-1) / PAGE_SIZE;
967 while (num_pages--)
968 bitmap->filemap_attr[num_pages] |= BITMAP_PAGE_NEEDWRITE;
969}
970
971
972static void bitmap_count_page(struct bitmap *bitmap, sector_t offset, int inc)
973{
974 sector_t chunk = offset >> CHUNK_BLOCK_SHIFT(bitmap);
975 unsigned long page = chunk >> PAGE_COUNTER_SHIFT;
976 bitmap->bp[page].count += inc;
977/*
978 if (page == 0) printk("count page 0, offset %llu: %d gives %d\n",
979 (unsigned long long)offset, inc, bitmap->bp[page].count);
980*/
981 bitmap_checkfree(bitmap, page);
982}
983static bitmap_counter_t *bitmap_get_counter(struct bitmap *bitmap,
984 sector_t offset, int *blocks,
985 int create);
986
987/*
988 * bitmap daemon -- periodically wakes up to clean bits and flush pages
989 * out to disk
990 */
991
992int bitmap_daemon_work(struct bitmap *bitmap)
993{
994 unsigned long j;
995 unsigned long flags;
996 struct page *page = NULL, *lastpage = NULL;
997 int err = 0;
998 int blocks;
999 int attr;
1000
1001 if (bitmap == NULL)
1002 return 0;
1003 if (time_before(jiffies, bitmap->daemon_lastrun + bitmap->daemon_sleep*HZ))
1004 return 0;
1005 bitmap->daemon_lastrun = jiffies;
1006
1007 for (j = 0; j < bitmap->chunks; j++) {
1008 bitmap_counter_t *bmc;
1009 spin_lock_irqsave(&bitmap->lock, flags);
1010 if (!bitmap->filemap) {
1011 /* error or shutdown */
1012 spin_unlock_irqrestore(&bitmap->lock, flags);
1013 break;
1014 }
1015
1016 page = filemap_get_page(bitmap, j);
1017
1018 if (page != lastpage) {
1019 /* skip this page unless it's marked as needing cleaning */
1020 if (!((attr=get_page_attr(bitmap, page)) & BITMAP_PAGE_CLEAN)) {
1021 if (attr & BITMAP_PAGE_NEEDWRITE) {
1022 page_cache_get(page);
1023 clear_page_attr(bitmap, page, BITMAP_PAGE_NEEDWRITE);
1024 }
1025 spin_unlock_irqrestore(&bitmap->lock, flags);
1026 if (attr & BITMAP_PAGE_NEEDWRITE) {
1027 switch (write_page(bitmap, page, 0)) {
1028 case -EAGAIN:
1029 set_page_attr(bitmap, page, BITMAP_PAGE_NEEDWRITE);
1030 break;
1031 case 0:
1032 break;
1033 default:
1034 bitmap_file_kick(bitmap);
1035 }
1036 page_cache_release(page);
1037 }
1038 continue;
1039 }
1040
1041 /* grab the new page, sync and release the old */
1042 page_cache_get(page);
1043 if (lastpage != NULL) {
1044 if (get_page_attr(bitmap, lastpage) & BITMAP_PAGE_NEEDWRITE) {
1045 clear_page_attr(bitmap, lastpage, BITMAP_PAGE_NEEDWRITE);
1046 spin_unlock_irqrestore(&bitmap->lock, flags);
1047 err = write_page(bitmap, lastpage, 0);
1048 if (err == -EAGAIN) {
1049 err = 0;
1050 set_page_attr(bitmap, lastpage, BITMAP_PAGE_NEEDWRITE);
1051 }
1052 } else {
1053 set_page_attr(bitmap, lastpage, BITMAP_PAGE_NEEDWRITE);
1054 spin_unlock_irqrestore(&bitmap->lock, flags);
1055 }
1056 kunmap(lastpage);
1057 page_cache_release(lastpage);
1058 if (err)
1059 bitmap_file_kick(bitmap);
1060 } else
1061 spin_unlock_irqrestore(&bitmap->lock, flags);
1062 lastpage = page;
1063 kmap(page);
1064/*
1065 printk("bitmap clean at page %lu\n", j);
1066*/
1067 spin_lock_irqsave(&bitmap->lock, flags);
1068 clear_page_attr(bitmap, page, BITMAP_PAGE_CLEAN);
1069 }
1070 bmc = bitmap_get_counter(bitmap, j << CHUNK_BLOCK_SHIFT(bitmap),
1071 &blocks, 0);
1072 if (bmc) {
1073/*
1074 if (j < 100) printk("bitmap: j=%lu, *bmc = 0x%x\n", j, *bmc);
1075*/
1076 if (*bmc == 2) {
1077 *bmc=1; /* maybe clear the bit next time */
1078 set_page_attr(bitmap, page, BITMAP_PAGE_CLEAN);
1079 } else if (*bmc == 1) {
1080 /* we can clear the bit */
1081 *bmc = 0;
1082 bitmap_count_page(bitmap, j << CHUNK_BLOCK_SHIFT(bitmap),
1083 -1);
1084
1085 /* clear the bit */
1086 clear_bit(file_page_offset(j), page_address(page));
1087 }
1088 }
1089 spin_unlock_irqrestore(&bitmap->lock, flags);
1090 }
1091
1092 /* now sync the final page */
1093 if (lastpage != NULL) {
1094 kunmap(lastpage);
1095 spin_lock_irqsave(&bitmap->lock, flags);
1096 if (get_page_attr(bitmap, lastpage) &BITMAP_PAGE_NEEDWRITE) {
1097 clear_page_attr(bitmap, lastpage, BITMAP_PAGE_NEEDWRITE);
1098 spin_unlock_irqrestore(&bitmap->lock, flags);
1099 err = write_page(bitmap, lastpage, 0);
1100 if (err == -EAGAIN) {
1101 set_page_attr(bitmap, lastpage, BITMAP_PAGE_NEEDWRITE);
1102 err = 0;
1103 }
1104 } else {
1105 set_page_attr(bitmap, lastpage, BITMAP_PAGE_NEEDWRITE);
1106 spin_unlock_irqrestore(&bitmap->lock, flags);
1107 }
1108
1109 page_cache_release(lastpage);
1110 }
1111
1112 return err;
1113}
1114
1115static void daemon_exit(struct bitmap *bitmap, mdk_thread_t **daemon)
1116{
1117 mdk_thread_t *dmn;
1118 unsigned long flags;
1119
1120 /* if no one is waiting on us, we'll free the md thread struct
1121 * and exit, otherwise we let the waiter clean things up */
1122 spin_lock_irqsave(&bitmap->lock, flags);
1123 if ((dmn = *daemon)) { /* no one is waiting, cleanup and exit */
1124 *daemon = NULL;
1125 spin_unlock_irqrestore(&bitmap->lock, flags);
1126 kfree(dmn);
1127 complete_and_exit(NULL, 0); /* do_exit not exported */
1128 }
1129 spin_unlock_irqrestore(&bitmap->lock, flags);
1130}
1131
1132static void bitmap_writeback_daemon(mddev_t *mddev)
1133{
1134 struct bitmap *bitmap = mddev->bitmap;
1135 struct page *page;
1136 struct page_list *item;
1137 int err = 0;
1138
1139 if (signal_pending(current)) {
1140 printk(KERN_INFO
1141 "%s: bitmap writeback daemon got signal, exiting...\n",
1142 bmname(bitmap));
1143 err = -EINTR;
1144 goto out;
1145 }
1146
1147 PRINTK("%s: bitmap writeback daemon woke up...\n", bmname(bitmap));
1148 /* wait on bitmap page writebacks */
1149 while ((item = dequeue_page(bitmap))) {
1150 page = item->page;
1151 mempool_free(item, bitmap->write_pool);
1152 PRINTK("wait on page writeback: %p\n", page);
1153 wait_on_page_writeback(page);
1154 PRINTK("finished page writeback: %p\n", page);
1155
1156 err = PageError(page);
1157 page_cache_release(page);
1158 if (err) {
1159 printk(KERN_WARNING "%s: bitmap file writeback "
1160 "failed (page %lu): %d\n",
1161 bmname(bitmap), page->index, err);
1162 bitmap_file_kick(bitmap);
1163 goto out;
1164 }
1165 }
1166 out:
1167 wake_up(&bitmap->write_wait);
1168 if (err) {
1169 printk(KERN_INFO "%s: bitmap writeback daemon exiting (%d)\n",
1170 bmname(bitmap), err);
1171 daemon_exit(bitmap, &bitmap->writeback_daemon);
1172 }
1173}
1174
1175static int bitmap_start_daemon(struct bitmap *bitmap, mdk_thread_t **ptr,
1176 void (*func)(mddev_t *), char *name)
1177{
1178 mdk_thread_t *daemon;
1179 unsigned long flags;
1180 char namebuf[32];
1181
1182 spin_lock_irqsave(&bitmap->lock, flags);
1183 *ptr = NULL;
1184
1185 if (!bitmap->file) /* no need for daemon if there's no backing file */
1186 goto out_unlock;
1187
1188 spin_unlock_irqrestore(&bitmap->lock, flags);
1189
1190#if INJECT_FATAL_FAULT_2
1191 daemon = NULL;
1192#else
1193 sprintf(namebuf, "%%s_%s", name);
1194 daemon = md_register_thread(func, bitmap->mddev, namebuf);
1195#endif
1196 if (!daemon) {
1197 printk(KERN_ERR "%s: failed to start bitmap daemon\n",
1198 bmname(bitmap));
1199 return -ECHILD;
1200 }
1201
1202 spin_lock_irqsave(&bitmap->lock, flags);
1203 *ptr = daemon;
1204
1205 md_wakeup_thread(daemon); /* start it running */
1206
1207 PRINTK("%s: %s daemon (pid %d) started...\n",
1208 bmname(bitmap), name, daemon->tsk->pid);
1209out_unlock:
1210 spin_unlock_irqrestore(&bitmap->lock, flags);
1211 return 0;
1212}
1213
1214static int bitmap_start_daemons(struct bitmap *bitmap)
1215{
1216 int err = bitmap_start_daemon(bitmap, &bitmap->writeback_daemon,
1217 bitmap_writeback_daemon, "bitmap_wb");
1218 return err;
1219}
1220
1221static void bitmap_stop_daemon(struct bitmap *bitmap, mdk_thread_t **ptr)
1222{
1223 mdk_thread_t *daemon;
1224 unsigned long flags;
1225
1226 spin_lock_irqsave(&bitmap->lock, flags);
1227 daemon = *ptr;
1228 *ptr = NULL;
1229 spin_unlock_irqrestore(&bitmap->lock, flags);
1230 if (daemon)
1231 md_unregister_thread(daemon); /* destroy the thread */
1232}
1233
1234static void bitmap_stop_daemons(struct bitmap *bitmap)
1235{
1236 /* the daemons can't stop themselves... they'll just exit instead... */
1237 if (bitmap->writeback_daemon &&
1238 current->pid != bitmap->writeback_daemon->tsk->pid)
1239 bitmap_stop_daemon(bitmap, &bitmap->writeback_daemon);
1240}
1241
1242static bitmap_counter_t *bitmap_get_counter(struct bitmap *bitmap,
1243 sector_t offset, int *blocks,
1244 int create)
1245{
1246 /* If 'create', we might release the lock and reclaim it.
1247 * The lock must have been taken with interrupts enabled.
1248 * If !create, we don't release the lock.
1249 */
1250 sector_t chunk = offset >> CHUNK_BLOCK_SHIFT(bitmap);
1251 unsigned long page = chunk >> PAGE_COUNTER_SHIFT;
1252 unsigned long pageoff = (chunk & PAGE_COUNTER_MASK) << COUNTER_BYTE_SHIFT;
1253 sector_t csize;
1254
1255 if (bitmap_checkpage(bitmap, page, create) < 0) {
1256 csize = ((sector_t)1) << (CHUNK_BLOCK_SHIFT(bitmap));
1257 *blocks = csize - (offset & (csize- 1));
1258 return NULL;
1259 }
1260 /* now locked ... */
1261
1262 if (bitmap->bp[page].hijacked) { /* hijacked pointer */
1263 /* should we use the first or second counter field
1264 * of the hijacked pointer? */
1265 int hi = (pageoff > PAGE_COUNTER_MASK);
1266 csize = ((sector_t)1) << (CHUNK_BLOCK_SHIFT(bitmap) +
1267 PAGE_COUNTER_SHIFT - 1);
1268 *blocks = csize - (offset & (csize- 1));
1269 return &((bitmap_counter_t *)
1270 &bitmap->bp[page].map)[hi];
1271 } else { /* page is allocated */
1272 csize = ((sector_t)1) << (CHUNK_BLOCK_SHIFT(bitmap));
1273 *blocks = csize - (offset & (csize- 1));
1274 return (bitmap_counter_t *)
1275 &(bitmap->bp[page].map[pageoff]);
1276 }
1277}
1278
1279int bitmap_startwrite(struct bitmap *bitmap, sector_t offset, unsigned long sectors)
1280{
1281 if (!bitmap) return 0;
1282 while (sectors) {
1283 int blocks;
1284 bitmap_counter_t *bmc;
1285
1286 spin_lock_irq(&bitmap->lock);
1287 bmc = bitmap_get_counter(bitmap, offset, &blocks, 1);
1288 if (!bmc) {
1289 spin_unlock_irq(&bitmap->lock);
1290 return 0;
1291 }
1292
1293 switch(*bmc) {
1294 case 0:
1295 bitmap_file_set_bit(bitmap, offset);
1296 bitmap_count_page(bitmap,offset, 1);
1297 blk_plug_device(bitmap->mddev->queue);
1298 /* fall through */
1299 case 1:
1300 *bmc = 2;
1301 }
1302 if ((*bmc & COUNTER_MAX) == COUNTER_MAX) BUG();
1303 (*bmc)++;
1304
1305 spin_unlock_irq(&bitmap->lock);
1306
1307 offset += blocks;
1308 if (sectors > blocks)
1309 sectors -= blocks;
1310 else sectors = 0;
1311 }
1312 return 0;
1313}
1314
1315void bitmap_endwrite(struct bitmap *bitmap, sector_t offset, unsigned long sectors,
1316 int success)
1317{
1318 if (!bitmap) return;
1319 while (sectors) {
1320 int blocks;
1321 unsigned long flags;
1322 bitmap_counter_t *bmc;
1323
1324 spin_lock_irqsave(&bitmap->lock, flags);
1325 bmc = bitmap_get_counter(bitmap, offset, &blocks, 0);
1326 if (!bmc) {
1327 spin_unlock_irqrestore(&bitmap->lock, flags);
1328 return;
1329 }
1330
1331 if (!success && ! (*bmc & NEEDED_MASK))
1332 *bmc |= NEEDED_MASK;
1333
1334 (*bmc)--;
1335 if (*bmc <= 2) {
1336 set_page_attr(bitmap,
1337 filemap_get_page(bitmap, offset >> CHUNK_BLOCK_SHIFT(bitmap)),
1338 BITMAP_PAGE_CLEAN);
1339 }
1340 spin_unlock_irqrestore(&bitmap->lock, flags);
1341 offset += blocks;
1342 if (sectors > blocks)
1343 sectors -= blocks;
1344 else sectors = 0;
1345 }
1346}
1347
1348int bitmap_start_sync(struct bitmap *bitmap, sector_t offset, int *blocks)
1349{
1350 bitmap_counter_t *bmc;
1351 int rv;
1352 if (bitmap == NULL) {/* FIXME or bitmap set as 'failed' */
1353 *blocks = 1024;
1354 return 1; /* always resync if no bitmap */
1355 }
1356 spin_lock_irq(&bitmap->lock);
1357 bmc = bitmap_get_counter(bitmap, offset, blocks, 0);
1358 rv = 0;
1359 if (bmc) {
1360 /* locked */
1361 if (RESYNC(*bmc))
1362 rv = 1;
1363 else if (NEEDED(*bmc)) {
1364 rv = 1;
1365 *bmc |= RESYNC_MASK;
1366 *bmc &= ~NEEDED_MASK;
1367 }
1368 }
1369 spin_unlock_irq(&bitmap->lock);
1370 return rv;
1371}
1372
1373void bitmap_end_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int aborted)
1374{
1375 bitmap_counter_t *bmc;
1376 unsigned long flags;
1377/*
1378 if (offset == 0) printk("bitmap_end_sync 0 (%d)\n", aborted);
1379*/ if (bitmap == NULL) {
1380 *blocks = 1024;
1381 return;
1382 }
1383 spin_lock_irqsave(&bitmap->lock, flags);
1384 bmc = bitmap_get_counter(bitmap, offset, blocks, 0);
1385 if (bmc == NULL)
1386 goto unlock;
1387 /* locked */
1388/*
1389 if (offset == 0) printk("bitmap_end sync found 0x%x, blocks %d\n", *bmc, *blocks);
1390*/
1391 if (RESYNC(*bmc)) {
1392 *bmc &= ~RESYNC_MASK;
1393
1394 if (!NEEDED(*bmc) && aborted)
1395 *bmc |= NEEDED_MASK;
1396 else {
1397 if (*bmc <= 2) {
1398 set_page_attr(bitmap,
1399 filemap_get_page(bitmap, offset >> CHUNK_BLOCK_SHIFT(bitmap)),
1400 BITMAP_PAGE_CLEAN);
1401 }
1402 }
1403 }
1404 unlock:
1405 spin_unlock_irqrestore(&bitmap->lock, flags);
1406}
1407
1408void bitmap_close_sync(struct bitmap *bitmap)
1409{
1410 /* Sync has finished, and any bitmap chunks that weren't synced
1411 * properly have been aborted. It remains to us to clear the
1412 * RESYNC bit wherever it is still on
1413 */
1414 sector_t sector = 0;
1415 int blocks;
1416 if (!bitmap) return;
1417 while (sector < bitmap->mddev->resync_max_sectors) {
1418 bitmap_end_sync(bitmap, sector, &blocks, 0);
1419/*
1420 if (sector < 500) printk("bitmap_close_sync: sec %llu blks %d\n",
1421 (unsigned long long)sector, blocks);
1422*/ sector += blocks;
1423 }
1424}
1425
1426static void bitmap_set_memory_bits(struct bitmap *bitmap, sector_t offset,
1427 unsigned long sectors, int in_sync)
1428{
1429 /* For each chunk covered by any of these sectors, set the
1430 * counter to 1 and set resync_needed unless in_sync. They should all
1431 * be 0 at this point
1432 */
1433 while (sectors) {
1434 int secs;
1435 bitmap_counter_t *bmc;
1436 spin_lock_irq(&bitmap->lock);
1437 bmc = bitmap_get_counter(bitmap, offset, &secs, 1);
1438 if (!bmc) {
1439 spin_unlock_irq(&bitmap->lock);
1440 return;
1441 }
1442 if (! *bmc) {
1443 struct page *page;
1444 *bmc = 1 | (in_sync? 0 : NEEDED_MASK);
1445 bitmap_count_page(bitmap, offset, 1);
1446 page = filemap_get_page(bitmap, offset >> CHUNK_BLOCK_SHIFT(bitmap));
1447 set_page_attr(bitmap, page, BITMAP_PAGE_CLEAN);
1448 }
1449 spin_unlock_irq(&bitmap->lock);
1450 if (sectors > secs)
1451 sectors -= secs;
1452 else
1453 sectors = 0;
1454 }
1455}
1456
1457/*
1458 * free memory that was allocated
1459 */
1460void bitmap_destroy(mddev_t *mddev)
1461{
1462 unsigned long k, pages;
1463 struct bitmap_page *bp;
1464 struct bitmap *bitmap = mddev->bitmap;
1465
1466 if (!bitmap) /* there was no bitmap */
1467 return;
1468
1469 mddev->bitmap = NULL; /* disconnect from the md device */
1470
1471 /* release the bitmap file and kill the daemon */
1472 bitmap_file_put(bitmap);
1473
1474 bp = bitmap->bp;
1475 pages = bitmap->pages;
1476
1477 /* free all allocated memory */
1478
1479 mempool_destroy(bitmap->write_pool);
1480
1481 if (bp) /* deallocate the page memory */
1482 for (k = 0; k < pages; k++)
1483 if (bp[k].map && !bp[k].hijacked)
1484 kfree(bp[k].map);
1485 kfree(bp);
1486 kfree(bitmap);
1487}
1488
1489/*
1490 * initialize the bitmap structure
1491 * if this returns an error, bitmap_destroy must be called to do clean up
1492 */
1493int bitmap_create(mddev_t *mddev)
1494{
1495 struct bitmap *bitmap;
1496 unsigned long blocks = mddev->resync_max_sectors;
1497 unsigned long chunks;
1498 unsigned long pages;
1499 struct file *file = mddev->bitmap_file;
1500 int err;
1501
1502 BUG_ON(sizeof(bitmap_super_t) != 256);
1503
1504 if (!file && !mddev->bitmap_offset) /* bitmap disabled, nothing to do */
1505 return 0;
1506
1507 BUG_ON(file && mddev->bitmap_offset);
1508
1509 bitmap = kmalloc(sizeof(*bitmap), GFP_KERNEL);
1510 if (!bitmap)
1511 return -ENOMEM;
1512
1513 memset(bitmap, 0, sizeof(*bitmap));
1514
1515 spin_lock_init(&bitmap->lock);
1516 bitmap->mddev = mddev;
1517 mddev->bitmap = bitmap;
1518
1519 spin_lock_init(&bitmap->write_lock);
1520 INIT_LIST_HEAD(&bitmap->complete_pages);
1521 init_waitqueue_head(&bitmap->write_wait);
1522 bitmap->write_pool = mempool_create(WRITE_POOL_SIZE, write_pool_alloc,
1523 write_pool_free, NULL);
1524 if (!bitmap->write_pool)
1525 return -ENOMEM;
1526
1527 bitmap->file = file;
1528 bitmap->offset = mddev->bitmap_offset;
1529 if (file) get_file(file);
1530 /* read superblock from bitmap file (this sets bitmap->chunksize) */
1531 err = bitmap_read_sb(bitmap);
1532 if (err)
1533 return err;
1534
1535 bitmap->chunkshift = find_first_bit(&bitmap->chunksize,
1536 sizeof(bitmap->chunksize));
1537
1538 /* now that chunksize and chunkshift are set, we can use these macros */
1539 chunks = (blocks + CHUNK_BLOCK_RATIO(bitmap) - 1) /
1540 CHUNK_BLOCK_RATIO(bitmap);
1541 pages = (chunks + PAGE_COUNTER_RATIO - 1) / PAGE_COUNTER_RATIO;
1542
1543 BUG_ON(!pages);
1544
1545 bitmap->chunks = chunks;
1546 bitmap->pages = pages;
1547 bitmap->missing_pages = pages;
1548 bitmap->counter_bits = COUNTER_BITS;
1549
1550 bitmap->syncchunk = ~0UL;
1551
1552#if INJECT_FATAL_FAULT_1
1553 bitmap->bp = NULL;
1554#else
1555 bitmap->bp = kmalloc(pages * sizeof(*bitmap->bp), GFP_KERNEL);
1556#endif
1557 if (!bitmap->bp)
1558 return -ENOMEM;
1559 memset(bitmap->bp, 0, pages * sizeof(*bitmap->bp));
1560
1561 bitmap->flags |= BITMAP_ACTIVE;
1562
1563 /* now that we have some pages available, initialize the in-memory
1564 * bitmap from the on-disk bitmap */
1565 err = bitmap_init_from_disk(bitmap, mddev->recovery_cp == MaxSector);
1566 if (err)
1567 return err;
1568
1569 printk(KERN_INFO "created bitmap (%lu pages) for device %s\n",
1570 pages, bmname(bitmap));
1571
1572 /* kick off the bitmap daemons */
1573 err = bitmap_start_daemons(bitmap);
1574 if (err)
1575 return err;
1576 return bitmap_update_sb(bitmap);
1577}
1578
1579/* the bitmap API -- for raid personalities */
1580EXPORT_SYMBOL(bitmap_startwrite);
1581EXPORT_SYMBOL(bitmap_endwrite);
1582EXPORT_SYMBOL(bitmap_start_sync);
1583EXPORT_SYMBOL(bitmap_end_sync);
1584EXPORT_SYMBOL(bitmap_unplug);
1585EXPORT_SYMBOL(bitmap_close_sync);
1586EXPORT_SYMBOL(bitmap_daemon_work);
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index 0dd6c2b5391b..d0a4bab220e5 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -704,8 +704,7 @@ static void crypt_dtr(struct dm_target *ti)
704 mempool_destroy(cc->page_pool); 704 mempool_destroy(cc->page_pool);
705 mempool_destroy(cc->io_pool); 705 mempool_destroy(cc->io_pool);
706 706
707 if (cc->iv_mode) 707 kfree(cc->iv_mode);
708 kfree(cc->iv_mode);
709 if (cc->iv_gen_ops && cc->iv_gen_ops->dtr) 708 if (cc->iv_gen_ops && cc->iv_gen_ops->dtr)
710 cc->iv_gen_ops->dtr(cc); 709 cc->iv_gen_ops->dtr(cc);
711 crypto_free_tfm(cc->tfm); 710 crypto_free_tfm(cc->tfm);
diff --git a/drivers/md/linear.c b/drivers/md/linear.c
index b1941b887f46..8d740013d74d 100644
--- a/drivers/md/linear.c
+++ b/drivers/md/linear.c
@@ -217,8 +217,7 @@ static int linear_run (mddev_t *mddev)
217 return 0; 217 return 0;
218 218
219out: 219out:
220 if (conf) 220 kfree(conf);
221 kfree(conf);
222 return 1; 221 return 1;
223} 222}
224 223
diff --git a/drivers/md/md.c b/drivers/md/md.c
index d899204d3743..0c6b5b6baff6 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -19,6 +19,9 @@
19 19
20 Neil Brown <neilb@cse.unsw.edu.au>. 20 Neil Brown <neilb@cse.unsw.edu.au>.
21 21
22 - persistent bitmap code
23 Copyright (C) 2003-2004, Paul Clements, SteelEye Technology, Inc.
24
22 This program is free software; you can redistribute it and/or modify 25 This program is free software; you can redistribute it and/or modify
23 it under the terms of the GNU General Public License as published by 26 it under the terms of the GNU General Public License as published by
24 the Free Software Foundation; either version 2, or (at your option) 27 the Free Software Foundation; either version 2, or (at your option)
@@ -33,6 +36,7 @@
33#include <linux/config.h> 36#include <linux/config.h>
34#include <linux/linkage.h> 37#include <linux/linkage.h>
35#include <linux/raid/md.h> 38#include <linux/raid/md.h>
39#include <linux/raid/bitmap.h>
36#include <linux/sysctl.h> 40#include <linux/sysctl.h>
37#include <linux/devfs_fs_kernel.h> 41#include <linux/devfs_fs_kernel.h>
38#include <linux/buffer_head.h> /* for invalidate_bdev */ 42#include <linux/buffer_head.h> /* for invalidate_bdev */
@@ -40,6 +44,8 @@
40 44
41#include <linux/init.h> 45#include <linux/init.h>
42 46
47#include <linux/file.h>
48
43#ifdef CONFIG_KMOD 49#ifdef CONFIG_KMOD
44#include <linux/kmod.h> 50#include <linux/kmod.h>
45#endif 51#endif
@@ -189,8 +195,7 @@ static mddev_t * mddev_find(dev_t unit)
189 if (mddev->unit == unit) { 195 if (mddev->unit == unit) {
190 mddev_get(mddev); 196 mddev_get(mddev);
191 spin_unlock(&all_mddevs_lock); 197 spin_unlock(&all_mddevs_lock);
192 if (new) 198 kfree(new);
193 kfree(new);
194 return mddev; 199 return mddev;
195 } 200 }
196 201
@@ -218,6 +223,8 @@ static mddev_t * mddev_find(dev_t unit)
218 INIT_LIST_HEAD(&new->all_mddevs); 223 INIT_LIST_HEAD(&new->all_mddevs);
219 init_timer(&new->safemode_timer); 224 init_timer(&new->safemode_timer);
220 atomic_set(&new->active, 1); 225 atomic_set(&new->active, 1);
226 spin_lock_init(&new->write_lock);
227 init_waitqueue_head(&new->sb_wait);
221 228
222 new->queue = blk_alloc_queue(GFP_KERNEL); 229 new->queue = blk_alloc_queue(GFP_KERNEL);
223 if (!new->queue) { 230 if (!new->queue) {
@@ -320,6 +327,40 @@ static void free_disk_sb(mdk_rdev_t * rdev)
320} 327}
321 328
322 329
330static int super_written(struct bio *bio, unsigned int bytes_done, int error)
331{
332 mdk_rdev_t *rdev = bio->bi_private;
333 if (bio->bi_size)
334 return 1;
335
336 if (error || !test_bit(BIO_UPTODATE, &bio->bi_flags))
337 md_error(rdev->mddev, rdev);
338
339 if (atomic_dec_and_test(&rdev->mddev->pending_writes))
340 wake_up(&rdev->mddev->sb_wait);
341 return 0;
342}
343
344void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev,
345 sector_t sector, int size, struct page *page)
346{
347 /* write first size bytes of page to sector of rdev
348 * Increment mddev->pending_writes before returning
349 * and decrement it on completion, waking up sb_wait
350 * if zero is reached.
351 * If an error occurred, call md_error
352 */
353 struct bio *bio = bio_alloc(GFP_NOIO, 1);
354
355 bio->bi_bdev = rdev->bdev;
356 bio->bi_sector = sector;
357 bio_add_page(bio, page, size, 0);
358 bio->bi_private = rdev;
359 bio->bi_end_io = super_written;
360 atomic_inc(&mddev->pending_writes);
361 submit_bio((1<<BIO_RW)|(1<<BIO_RW_SYNC), bio);
362}
363
323static int bi_complete(struct bio *bio, unsigned int bytes_done, int error) 364static int bi_complete(struct bio *bio, unsigned int bytes_done, int error)
324{ 365{
325 if (bio->bi_size) 366 if (bio->bi_size)
@@ -329,7 +370,7 @@ static int bi_complete(struct bio *bio, unsigned int bytes_done, int error)
329 return 0; 370 return 0;
330} 371}
331 372
332static int sync_page_io(struct block_device *bdev, sector_t sector, int size, 373int sync_page_io(struct block_device *bdev, sector_t sector, int size,
333 struct page *page, int rw) 374 struct page *page, int rw)
334{ 375{
335 struct bio *bio = bio_alloc(GFP_NOIO, 1); 376 struct bio *bio = bio_alloc(GFP_NOIO, 1);
@@ -416,11 +457,8 @@ static int sb_equal(mdp_super_t *sb1, mdp_super_t *sb2)
416 ret = 1; 457 ret = 1;
417 458
418abort: 459abort:
419 if (tmp1) 460 kfree(tmp1);
420 kfree(tmp1); 461 kfree(tmp2);
421 if (tmp2)
422 kfree(tmp2);
423
424 return ret; 462 return ret;
425} 463}
426 464
@@ -569,6 +607,8 @@ static int super_90_validate(mddev_t *mddev, mdk_rdev_t *rdev)
569 mdp_disk_t *desc; 607 mdp_disk_t *desc;
570 mdp_super_t *sb = (mdp_super_t *)page_address(rdev->sb_page); 608 mdp_super_t *sb = (mdp_super_t *)page_address(rdev->sb_page);
571 609
610 rdev->raid_disk = -1;
611 rdev->in_sync = 0;
572 if (mddev->raid_disks == 0) { 612 if (mddev->raid_disks == 0) {
573 mddev->major_version = 0; 613 mddev->major_version = 0;
574 mddev->minor_version = sb->minor_version; 614 mddev->minor_version = sb->minor_version;
@@ -599,16 +639,35 @@ static int super_90_validate(mddev_t *mddev, mdk_rdev_t *rdev)
599 memcpy(mddev->uuid+12,&sb->set_uuid3, 4); 639 memcpy(mddev->uuid+12,&sb->set_uuid3, 4);
600 640
601 mddev->max_disks = MD_SB_DISKS; 641 mddev->max_disks = MD_SB_DISKS;
602 } else { 642
603 __u64 ev1; 643 if (sb->state & (1<<MD_SB_BITMAP_PRESENT) &&
604 ev1 = md_event(sb); 644 mddev->bitmap_file == NULL) {
645 if (mddev->level != 1) {
646 /* FIXME use a better test */
647 printk(KERN_WARNING "md: bitmaps only support for raid1\n");
648 return -EINVAL;
649 }
650 mddev->bitmap_offset = (MD_SB_BYTES >> 9);
651 }
652
653 } else if (mddev->pers == NULL) {
654 /* Insist on good event counter while assembling */
655 __u64 ev1 = md_event(sb);
605 ++ev1; 656 ++ev1;
606 if (ev1 < mddev->events) 657 if (ev1 < mddev->events)
607 return -EINVAL; 658 return -EINVAL;
608 } 659 } else if (mddev->bitmap) {
660 /* if adding to array with a bitmap, then we can accept an
661 * older device ... but not too old.
662 */
663 __u64 ev1 = md_event(sb);
664 if (ev1 < mddev->bitmap->events_cleared)
665 return 0;
666 } else /* just a hot-add of a new device, leave raid_disk at -1 */
667 return 0;
668
609 if (mddev->level != LEVEL_MULTIPATH) { 669 if (mddev->level != LEVEL_MULTIPATH) {
610 rdev->raid_disk = -1; 670 rdev->faulty = 0;
611 rdev->in_sync = rdev->faulty = 0;
612 desc = sb->disks + rdev->desc_nr; 671 desc = sb->disks + rdev->desc_nr;
613 672
614 if (desc->state & (1<<MD_DISK_FAULTY)) 673 if (desc->state & (1<<MD_DISK_FAULTY))
@@ -618,7 +677,8 @@ static int super_90_validate(mddev_t *mddev, mdk_rdev_t *rdev)
618 rdev->in_sync = 1; 677 rdev->in_sync = 1;
619 rdev->raid_disk = desc->raid_disk; 678 rdev->raid_disk = desc->raid_disk;
620 } 679 }
621 } 680 } else /* MULTIPATH are always insync */
681 rdev->in_sync = 1;
622 return 0; 682 return 0;
623} 683}
624 684
@@ -683,6 +743,9 @@ static void super_90_sync(mddev_t *mddev, mdk_rdev_t *rdev)
683 sb->layout = mddev->layout; 743 sb->layout = mddev->layout;
684 sb->chunk_size = mddev->chunk_size; 744 sb->chunk_size = mddev->chunk_size;
685 745
746 if (mddev->bitmap && mddev->bitmap_file == NULL)
747 sb->state |= (1<<MD_SB_BITMAP_PRESENT);
748
686 sb->disks[0].state = (1<<MD_DISK_REMOVED); 749 sb->disks[0].state = (1<<MD_DISK_REMOVED);
687 ITERATE_RDEV(mddev,rdev2,tmp) { 750 ITERATE_RDEV(mddev,rdev2,tmp) {
688 mdp_disk_t *d; 751 mdp_disk_t *d;
@@ -780,7 +843,7 @@ static int super_1_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version)
780 case 0: 843 case 0:
781 sb_offset = rdev->bdev->bd_inode->i_size >> 9; 844 sb_offset = rdev->bdev->bd_inode->i_size >> 9;
782 sb_offset -= 8*2; 845 sb_offset -= 8*2;
783 sb_offset &= ~(4*2-1); 846 sb_offset &= ~(sector_t)(4*2-1);
784 /* convert from sectors to K */ 847 /* convert from sectors to K */
785 sb_offset /= 2; 848 sb_offset /= 2;
786 break; 849 break;
@@ -860,6 +923,8 @@ static int super_1_validate(mddev_t *mddev, mdk_rdev_t *rdev)
860{ 923{
861 struct mdp_superblock_1 *sb = (struct mdp_superblock_1*)page_address(rdev->sb_page); 924 struct mdp_superblock_1 *sb = (struct mdp_superblock_1*)page_address(rdev->sb_page);
862 925
926 rdev->raid_disk = -1;
927 rdev->in_sync = 0;
863 if (mddev->raid_disks == 0) { 928 if (mddev->raid_disks == 0) {
864 mddev->major_version = 1; 929 mddev->major_version = 1;
865 mddev->patch_version = 0; 930 mddev->patch_version = 0;
@@ -877,13 +942,30 @@ static int super_1_validate(mddev_t *mddev, mdk_rdev_t *rdev)
877 memcpy(mddev->uuid, sb->set_uuid, 16); 942 memcpy(mddev->uuid, sb->set_uuid, 16);
878 943
879 mddev->max_disks = (4096-256)/2; 944 mddev->max_disks = (4096-256)/2;
880 } else { 945
881 __u64 ev1; 946 if ((le32_to_cpu(sb->feature_map) & 1) &&
882 ev1 = le64_to_cpu(sb->events); 947 mddev->bitmap_file == NULL ) {
948 if (mddev->level != 1) {
949 printk(KERN_WARNING "md: bitmaps only supported for raid1\n");
950 return -EINVAL;
951 }
952 mddev->bitmap_offset = (__s32)le32_to_cpu(sb->bitmap_offset);
953 }
954 } else if (mddev->pers == NULL) {
955 /* Insist of good event counter while assembling */
956 __u64 ev1 = le64_to_cpu(sb->events);
883 ++ev1; 957 ++ev1;
884 if (ev1 < mddev->events) 958 if (ev1 < mddev->events)
885 return -EINVAL; 959 return -EINVAL;
886 } 960 } else if (mddev->bitmap) {
961 /* If adding to array with a bitmap, then we can accept an
962 * older device, but not too old.
963 */
964 __u64 ev1 = le64_to_cpu(sb->events);
965 if (ev1 < mddev->bitmap->events_cleared)
966 return 0;
967 } else /* just a hot-add of a new device, leave raid_disk at -1 */
968 return 0;
887 969
888 if (mddev->level != LEVEL_MULTIPATH) { 970 if (mddev->level != LEVEL_MULTIPATH) {
889 int role; 971 int role;
@@ -891,14 +973,10 @@ static int super_1_validate(mddev_t *mddev, mdk_rdev_t *rdev)
891 role = le16_to_cpu(sb->dev_roles[rdev->desc_nr]); 973 role = le16_to_cpu(sb->dev_roles[rdev->desc_nr]);
892 switch(role) { 974 switch(role) {
893 case 0xffff: /* spare */ 975 case 0xffff: /* spare */
894 rdev->in_sync = 0;
895 rdev->faulty = 0; 976 rdev->faulty = 0;
896 rdev->raid_disk = -1;
897 break; 977 break;
898 case 0xfffe: /* faulty */ 978 case 0xfffe: /* faulty */
899 rdev->in_sync = 0;
900 rdev->faulty = 1; 979 rdev->faulty = 1;
901 rdev->raid_disk = -1;
902 break; 980 break;
903 default: 981 default:
904 rdev->in_sync = 1; 982 rdev->in_sync = 1;
@@ -906,7 +984,9 @@ static int super_1_validate(mddev_t *mddev, mdk_rdev_t *rdev)
906 rdev->raid_disk = role; 984 rdev->raid_disk = role;
907 break; 985 break;
908 } 986 }
909 } 987 } else /* MULTIPATH are always insync */
988 rdev->in_sync = 1;
989
910 return 0; 990 return 0;
911} 991}
912 992
@@ -933,6 +1013,11 @@ static void super_1_sync(mddev_t *mddev, mdk_rdev_t *rdev)
933 else 1013 else
934 sb->resync_offset = cpu_to_le64(0); 1014 sb->resync_offset = cpu_to_le64(0);
935 1015
1016 if (mddev->bitmap && mddev->bitmap_file == NULL) {
1017 sb->bitmap_offset = cpu_to_le32((__u32)mddev->bitmap_offset);
1018 sb->feature_map = cpu_to_le32(1);
1019 }
1020
936 max_dev = 0; 1021 max_dev = 0;
937 ITERATE_RDEV(mddev,rdev2,tmp) 1022 ITERATE_RDEV(mddev,rdev2,tmp)
938 if (rdev2->desc_nr+1 > max_dev) 1023 if (rdev2->desc_nr+1 > max_dev)
@@ -1196,8 +1281,11 @@ void md_print_devices(void)
1196 printk("md: * <COMPLETE RAID STATE PRINTOUT> *\n"); 1281 printk("md: * <COMPLETE RAID STATE PRINTOUT> *\n");
1197 printk("md: **********************************\n"); 1282 printk("md: **********************************\n");
1198 ITERATE_MDDEV(mddev,tmp) { 1283 ITERATE_MDDEV(mddev,tmp) {
1199 printk("%s: ", mdname(mddev));
1200 1284
1285 if (mddev->bitmap)
1286 bitmap_print_sb(mddev->bitmap);
1287 else
1288 printk("%s: ", mdname(mddev));
1201 ITERATE_RDEV(mddev,rdev,tmp2) 1289 ITERATE_RDEV(mddev,rdev,tmp2)
1202 printk("<%s>", bdevname(rdev->bdev,b)); 1290 printk("<%s>", bdevname(rdev->bdev,b));
1203 printk("\n"); 1291 printk("\n");
@@ -1210,30 +1298,6 @@ void md_print_devices(void)
1210} 1298}
1211 1299
1212 1300
1213static int write_disk_sb(mdk_rdev_t * rdev)
1214{
1215 char b[BDEVNAME_SIZE];
1216 if (!rdev->sb_loaded) {
1217 MD_BUG();
1218 return 1;
1219 }
1220 if (rdev->faulty) {
1221 MD_BUG();
1222 return 1;
1223 }
1224
1225 dprintk(KERN_INFO "(write) %s's sb offset: %llu\n",
1226 bdevname(rdev->bdev,b),
1227 (unsigned long long)rdev->sb_offset);
1228
1229 if (sync_page_io(rdev->bdev, rdev->sb_offset<<1, MD_SB_BYTES, rdev->sb_page, WRITE))
1230 return 0;
1231
1232 printk("md: write_disk_sb failed for device %s\n",
1233 bdevname(rdev->bdev,b));
1234 return 1;
1235}
1236
1237static void sync_sbs(mddev_t * mddev) 1301static void sync_sbs(mddev_t * mddev)
1238{ 1302{
1239 mdk_rdev_t *rdev; 1303 mdk_rdev_t *rdev;
@@ -1248,12 +1312,14 @@ static void sync_sbs(mddev_t * mddev)
1248 1312
1249static void md_update_sb(mddev_t * mddev) 1313static void md_update_sb(mddev_t * mddev)
1250{ 1314{
1251 int err, count = 100; 1315 int err;
1252 struct list_head *tmp; 1316 struct list_head *tmp;
1253 mdk_rdev_t *rdev; 1317 mdk_rdev_t *rdev;
1318 int sync_req;
1254 1319
1255 mddev->sb_dirty = 0;
1256repeat: 1320repeat:
1321 spin_lock(&mddev->write_lock);
1322 sync_req = mddev->in_sync;
1257 mddev->utime = get_seconds(); 1323 mddev->utime = get_seconds();
1258 mddev->events ++; 1324 mddev->events ++;
1259 1325
@@ -1266,20 +1332,26 @@ repeat:
1266 MD_BUG(); 1332 MD_BUG();
1267 mddev->events --; 1333 mddev->events --;
1268 } 1334 }
1335 mddev->sb_dirty = 2;
1269 sync_sbs(mddev); 1336 sync_sbs(mddev);
1270 1337
1271 /* 1338 /*
1272 * do not write anything to disk if using 1339 * do not write anything to disk if using
1273 * nonpersistent superblocks 1340 * nonpersistent superblocks
1274 */ 1341 */
1275 if (!mddev->persistent) 1342 if (!mddev->persistent) {
1343 mddev->sb_dirty = 0;
1344 spin_unlock(&mddev->write_lock);
1345 wake_up(&mddev->sb_wait);
1276 return; 1346 return;
1347 }
1348 spin_unlock(&mddev->write_lock);
1277 1349
1278 dprintk(KERN_INFO 1350 dprintk(KERN_INFO
1279 "md: updating %s RAID superblock on device (in sync %d)\n", 1351 "md: updating %s RAID superblock on device (in sync %d)\n",
1280 mdname(mddev),mddev->in_sync); 1352 mdname(mddev),mddev->in_sync);
1281 1353
1282 err = 0; 1354 err = bitmap_update_sb(mddev->bitmap);
1283 ITERATE_RDEV(mddev,rdev,tmp) { 1355 ITERATE_RDEV(mddev,rdev,tmp) {
1284 char b[BDEVNAME_SIZE]; 1356 char b[BDEVNAME_SIZE];
1285 dprintk(KERN_INFO "md: "); 1357 dprintk(KERN_INFO "md: ");
@@ -1288,22 +1360,32 @@ repeat:
1288 1360
1289 dprintk("%s ", bdevname(rdev->bdev,b)); 1361 dprintk("%s ", bdevname(rdev->bdev,b));
1290 if (!rdev->faulty) { 1362 if (!rdev->faulty) {
1291 err += write_disk_sb(rdev); 1363 md_super_write(mddev,rdev,
1364 rdev->sb_offset<<1, MD_SB_BYTES,
1365 rdev->sb_page);
1366 dprintk(KERN_INFO "(write) %s's sb offset: %llu\n",
1367 bdevname(rdev->bdev,b),
1368 (unsigned long long)rdev->sb_offset);
1369
1292 } else 1370 } else
1293 dprintk(")\n"); 1371 dprintk(")\n");
1294 if (!err && mddev->level == LEVEL_MULTIPATH) 1372 if (mddev->level == LEVEL_MULTIPATH)
1295 /* only need to write one superblock... */ 1373 /* only need to write one superblock... */
1296 break; 1374 break;
1297 } 1375 }
1298 if (err) { 1376 wait_event(mddev->sb_wait, atomic_read(&mddev->pending_writes)==0);
1299 if (--count) { 1377 /* if there was a failure, sb_dirty was set to 1, and we re-write super */
1300 printk(KERN_ERR "md: errors occurred during superblock" 1378
1301 " update, repeating\n"); 1379 spin_lock(&mddev->write_lock);
1302 goto repeat; 1380 if (mddev->in_sync != sync_req|| mddev->sb_dirty == 1) {
1303 } 1381 /* have to write it out again */
1304 printk(KERN_ERR \ 1382 spin_unlock(&mddev->write_lock);
1305 "md: excessive errors occurred during superblock update, exiting\n"); 1383 goto repeat;
1306 } 1384 }
1385 mddev->sb_dirty = 0;
1386 spin_unlock(&mddev->write_lock);
1387 wake_up(&mddev->sb_wait);
1388
1307} 1389}
1308 1390
1309/* 1391/*
@@ -1607,12 +1689,19 @@ static int do_md_run(mddev_t * mddev)
1607 1689
1608 mddev->resync_max_sectors = mddev->size << 1; /* may be over-ridden by personality */ 1690 mddev->resync_max_sectors = mddev->size << 1; /* may be over-ridden by personality */
1609 1691
1610 err = mddev->pers->run(mddev); 1692 /* before we start the array running, initialise the bitmap */
1693 err = bitmap_create(mddev);
1694 if (err)
1695 printk(KERN_ERR "%s: failed to create bitmap (%d)\n",
1696 mdname(mddev), err);
1697 else
1698 err = mddev->pers->run(mddev);
1611 if (err) { 1699 if (err) {
1612 printk(KERN_ERR "md: pers->run() failed ...\n"); 1700 printk(KERN_ERR "md: pers->run() failed ...\n");
1613 module_put(mddev->pers->owner); 1701 module_put(mddev->pers->owner);
1614 mddev->pers = NULL; 1702 mddev->pers = NULL;
1615 return -EINVAL; 1703 bitmap_destroy(mddev);
1704 return err;
1616 } 1705 }
1617 atomic_set(&mddev->writes_pending,0); 1706 atomic_set(&mddev->writes_pending,0);
1618 mddev->safemode = 0; 1707 mddev->safemode = 0;
@@ -1725,6 +1814,14 @@ static int do_md_stop(mddev_t * mddev, int ro)
1725 if (ro) 1814 if (ro)
1726 set_disk_ro(disk, 1); 1815 set_disk_ro(disk, 1);
1727 } 1816 }
1817
1818 bitmap_destroy(mddev);
1819 if (mddev->bitmap_file) {
1820 atomic_set(&mddev->bitmap_file->f_dentry->d_inode->i_writecount, 1);
1821 fput(mddev->bitmap_file);
1822 mddev->bitmap_file = NULL;
1823 }
1824
1728 /* 1825 /*
1729 * Free resources if final stop 1826 * Free resources if final stop
1730 */ 1827 */
@@ -1983,6 +2080,42 @@ static int get_array_info(mddev_t * mddev, void __user * arg)
1983 return 0; 2080 return 0;
1984} 2081}
1985 2082
2083static int get_bitmap_file(mddev_t * mddev, void * arg)
2084{
2085 mdu_bitmap_file_t *file = NULL; /* too big for stack allocation */
2086 char *ptr, *buf = NULL;
2087 int err = -ENOMEM;
2088
2089 file = kmalloc(sizeof(*file), GFP_KERNEL);
2090 if (!file)
2091 goto out;
2092
2093 /* bitmap disabled, zero the first byte and copy out */
2094 if (!mddev->bitmap || !mddev->bitmap->file) {
2095 file->pathname[0] = '\0';
2096 goto copy_out;
2097 }
2098
2099 buf = kmalloc(sizeof(file->pathname), GFP_KERNEL);
2100 if (!buf)
2101 goto out;
2102
2103 ptr = file_path(mddev->bitmap->file, buf, sizeof(file->pathname));
2104 if (!ptr)
2105 goto out;
2106
2107 strcpy(file->pathname, ptr);
2108
2109copy_out:
2110 err = 0;
2111 if (copy_to_user(arg, file, sizeof(*file)))
2112 err = -EFAULT;
2113out:
2114 kfree(buf);
2115 kfree(file);
2116 return err;
2117}
2118
1986static int get_disk_info(mddev_t * mddev, void __user * arg) 2119static int get_disk_info(mddev_t * mddev, void __user * arg)
1987{ 2120{
1988 mdu_disk_info_t info; 2121 mdu_disk_info_t info;
@@ -2078,11 +2211,25 @@ static int add_new_disk(mddev_t * mddev, mdu_disk_info_t *info)
2078 PTR_ERR(rdev)); 2211 PTR_ERR(rdev));
2079 return PTR_ERR(rdev); 2212 return PTR_ERR(rdev);
2080 } 2213 }
2214 /* set save_raid_disk if appropriate */
2215 if (!mddev->persistent) {
2216 if (info->state & (1<<MD_DISK_SYNC) &&
2217 info->raid_disk < mddev->raid_disks)
2218 rdev->raid_disk = info->raid_disk;
2219 else
2220 rdev->raid_disk = -1;
2221 } else
2222 super_types[mddev->major_version].
2223 validate_super(mddev, rdev);
2224 rdev->saved_raid_disk = rdev->raid_disk;
2225
2081 rdev->in_sync = 0; /* just to be sure */ 2226 rdev->in_sync = 0; /* just to be sure */
2082 rdev->raid_disk = -1; 2227 rdev->raid_disk = -1;
2083 err = bind_rdev_to_array(rdev, mddev); 2228 err = bind_rdev_to_array(rdev, mddev);
2084 if (err) 2229 if (err)
2085 export_rdev(rdev); 2230 export_rdev(rdev);
2231
2232 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
2086 if (mddev->thread) 2233 if (mddev->thread)
2087 md_wakeup_thread(mddev->thread); 2234 md_wakeup_thread(mddev->thread);
2088 return err; 2235 return err;
@@ -2256,6 +2403,49 @@ abort_export:
2256 return err; 2403 return err;
2257} 2404}
2258 2405
2406/* similar to deny_write_access, but accounts for our holding a reference
2407 * to the file ourselves */
2408static int deny_bitmap_write_access(struct file * file)
2409{
2410 struct inode *inode = file->f_mapping->host;
2411
2412 spin_lock(&inode->i_lock);
2413 if (atomic_read(&inode->i_writecount) > 1) {
2414 spin_unlock(&inode->i_lock);
2415 return -ETXTBSY;
2416 }
2417 atomic_set(&inode->i_writecount, -1);
2418 spin_unlock(&inode->i_lock);
2419
2420 return 0;
2421}
2422
2423static int set_bitmap_file(mddev_t *mddev, int fd)
2424{
2425 int err;
2426
2427 if (mddev->pers)
2428 return -EBUSY;
2429
2430 mddev->bitmap_file = fget(fd);
2431
2432 if (mddev->bitmap_file == NULL) {
2433 printk(KERN_ERR "%s: error: failed to get bitmap file\n",
2434 mdname(mddev));
2435 return -EBADF;
2436 }
2437
2438 err = deny_bitmap_write_access(mddev->bitmap_file);
2439 if (err) {
2440 printk(KERN_ERR "%s: error: bitmap file is already in use\n",
2441 mdname(mddev));
2442 fput(mddev->bitmap_file);
2443 mddev->bitmap_file = NULL;
2444 } else
2445 mddev->bitmap_offset = 0; /* file overrides offset */
2446 return err;
2447}
2448
2259/* 2449/*
2260 * set_array_info is used two different ways 2450 * set_array_info is used two different ways
2261 * The original usage is when creating a new array. 2451 * The original usage is when creating a new array.
@@ -2567,8 +2757,10 @@ static int md_ioctl(struct inode *inode, struct file *file,
2567 /* 2757 /*
2568 * Commands querying/configuring an existing array: 2758 * Commands querying/configuring an existing array:
2569 */ 2759 */
2570 /* if we are initialised yet, only ADD_NEW_DISK or STOP_ARRAY is allowed */ 2760 /* if we are not initialised yet, only ADD_NEW_DISK, STOP_ARRAY,
2571 if (!mddev->raid_disks && cmd != ADD_NEW_DISK && cmd != STOP_ARRAY && cmd != RUN_ARRAY) { 2761 * RUN_ARRAY, and SET_BITMAP_FILE are allowed */
2762 if (!mddev->raid_disks && cmd != ADD_NEW_DISK && cmd != STOP_ARRAY
2763 && cmd != RUN_ARRAY && cmd != SET_BITMAP_FILE) {
2572 err = -ENODEV; 2764 err = -ENODEV;
2573 goto abort_unlock; 2765 goto abort_unlock;
2574 } 2766 }
@@ -2582,6 +2774,10 @@ static int md_ioctl(struct inode *inode, struct file *file,
2582 err = get_array_info(mddev, argp); 2774 err = get_array_info(mddev, argp);
2583 goto done_unlock; 2775 goto done_unlock;
2584 2776
2777 case GET_BITMAP_FILE:
2778 err = get_bitmap_file(mddev, (void *)arg);
2779 goto done_unlock;
2780
2585 case GET_DISK_INFO: 2781 case GET_DISK_INFO:
2586 err = get_disk_info(mddev, argp); 2782 err = get_disk_info(mddev, argp);
2587 goto done_unlock; 2783 goto done_unlock;
@@ -2662,6 +2858,10 @@ static int md_ioctl(struct inode *inode, struct file *file,
2662 err = do_md_run (mddev); 2858 err = do_md_run (mddev);
2663 goto done_unlock; 2859 goto done_unlock;
2664 2860
2861 case SET_BITMAP_FILE:
2862 err = set_bitmap_file(mddev, (int)arg);
2863 goto done_unlock;
2864
2665 default: 2865 default:
2666 if (_IOC_TYPE(cmd) == MD_MAJOR) 2866 if (_IOC_TYPE(cmd) == MD_MAJOR)
2667 printk(KERN_WARNING "md: %s(pid %d) used" 2867 printk(KERN_WARNING "md: %s(pid %d) used"
@@ -2773,8 +2973,9 @@ static int md_thread(void * arg)
2773 while (thread->run) { 2973 while (thread->run) {
2774 void (*run)(mddev_t *); 2974 void (*run)(mddev_t *);
2775 2975
2776 wait_event_interruptible(thread->wqueue, 2976 wait_event_interruptible_timeout(thread->wqueue,
2777 test_bit(THREAD_WAKEUP, &thread->flags)); 2977 test_bit(THREAD_WAKEUP, &thread->flags),
2978 thread->timeout);
2778 if (current->flags & PF_FREEZE) 2979 if (current->flags & PF_FREEZE)
2779 refrigerator(PF_FREEZE); 2980 refrigerator(PF_FREEZE);
2780 2981
@@ -2820,6 +3021,7 @@ mdk_thread_t *md_register_thread(void (*run) (mddev_t *), mddev_t *mddev,
2820 thread->run = run; 3021 thread->run = run;
2821 thread->mddev = mddev; 3022 thread->mddev = mddev;
2822 thread->name = name; 3023 thread->name = name;
3024 thread->timeout = MAX_SCHEDULE_TIMEOUT;
2823 ret = kernel_thread(md_thread, thread, 0); 3025 ret = kernel_thread(md_thread, thread, 0);
2824 if (ret < 0) { 3026 if (ret < 0) {
2825 kfree(thread); 3027 kfree(thread);
@@ -2858,13 +3060,13 @@ void md_error(mddev_t *mddev, mdk_rdev_t *rdev)
2858 3060
2859 if (!rdev || rdev->faulty) 3061 if (!rdev || rdev->faulty)
2860 return; 3062 return;
2861 3063/*
2862 dprintk("md_error dev:%s, rdev:(%d:%d), (caller: %p,%p,%p,%p).\n", 3064 dprintk("md_error dev:%s, rdev:(%d:%d), (caller: %p,%p,%p,%p).\n",
2863 mdname(mddev), 3065 mdname(mddev),
2864 MAJOR(rdev->bdev->bd_dev), MINOR(rdev->bdev->bd_dev), 3066 MAJOR(rdev->bdev->bd_dev), MINOR(rdev->bdev->bd_dev),
2865 __builtin_return_address(0),__builtin_return_address(1), 3067 __builtin_return_address(0),__builtin_return_address(1),
2866 __builtin_return_address(2),__builtin_return_address(3)); 3068 __builtin_return_address(2),__builtin_return_address(3));
2867 3069*/
2868 if (!mddev->pers->error_handler) 3070 if (!mddev->pers->error_handler)
2869 return; 3071 return;
2870 mddev->pers->error_handler(mddev,rdev); 3072 mddev->pers->error_handler(mddev,rdev);
@@ -3018,6 +3220,7 @@ static int md_seq_show(struct seq_file *seq, void *v)
3018 struct list_head *tmp2; 3220 struct list_head *tmp2;
3019 mdk_rdev_t *rdev; 3221 mdk_rdev_t *rdev;
3020 int i; 3222 int i;
3223 struct bitmap *bitmap;
3021 3224
3022 if (v == (void*)1) { 3225 if (v == (void*)1) {
3023 seq_printf(seq, "Personalities : "); 3226 seq_printf(seq, "Personalities : ");
@@ -3070,10 +3273,35 @@ static int md_seq_show(struct seq_file *seq, void *v)
3070 if (mddev->pers) { 3273 if (mddev->pers) {
3071 mddev->pers->status (seq, mddev); 3274 mddev->pers->status (seq, mddev);
3072 seq_printf(seq, "\n "); 3275 seq_printf(seq, "\n ");
3073 if (mddev->curr_resync > 2) 3276 if (mddev->curr_resync > 2) {
3074 status_resync (seq, mddev); 3277 status_resync (seq, mddev);
3075 else if (mddev->curr_resync == 1 || mddev->curr_resync == 2) 3278 seq_printf(seq, "\n ");
3076 seq_printf(seq, " resync=DELAYED"); 3279 } else if (mddev->curr_resync == 1 || mddev->curr_resync == 2)
3280 seq_printf(seq, " resync=DELAYED\n ");
3281 } else
3282 seq_printf(seq, "\n ");
3283
3284 if ((bitmap = mddev->bitmap)) {
3285 unsigned long chunk_kb;
3286 unsigned long flags;
3287 spin_lock_irqsave(&bitmap->lock, flags);
3288 chunk_kb = bitmap->chunksize >> 10;
3289 seq_printf(seq, "bitmap: %lu/%lu pages [%luKB], "
3290 "%lu%s chunk",
3291 bitmap->pages - bitmap->missing_pages,
3292 bitmap->pages,
3293 (bitmap->pages - bitmap->missing_pages)
3294 << (PAGE_SHIFT - 10),
3295 chunk_kb ? chunk_kb : bitmap->chunksize,
3296 chunk_kb ? "KB" : "B");
3297 if (bitmap->file) {
3298 seq_printf(seq, ", file: ");
3299 seq_path(seq, bitmap->file->f_vfsmnt,
3300 bitmap->file->f_dentry," \t\n");
3301 }
3302
3303 seq_printf(seq, "\n");
3304 spin_unlock_irqrestore(&bitmap->lock, flags);
3077 } 3305 }
3078 3306
3079 seq_printf(seq, "\n"); 3307 seq_printf(seq, "\n");
@@ -3176,19 +3404,28 @@ void md_done_sync(mddev_t *mddev, int blocks, int ok)
3176} 3404}
3177 3405
3178 3406
3179void md_write_start(mddev_t *mddev) 3407/* md_write_start(mddev, bi)
3408 * If we need to update some array metadata (e.g. 'active' flag
3409 * in superblock) before writing, schedule a superblock update
3410 * and wait for it to complete.
3411 */
3412void md_write_start(mddev_t *mddev, struct bio *bi)
3180{ 3413{
3181 if (!atomic_read(&mddev->writes_pending)) { 3414 DEFINE_WAIT(w);
3182 mddev_lock_uninterruptible(mddev); 3415 if (bio_data_dir(bi) != WRITE)
3416 return;
3417
3418 atomic_inc(&mddev->writes_pending);
3419 if (mddev->in_sync) {
3420 spin_lock(&mddev->write_lock);
3183 if (mddev->in_sync) { 3421 if (mddev->in_sync) {
3184 mddev->in_sync = 0; 3422 mddev->in_sync = 0;
3185 del_timer(&mddev->safemode_timer); 3423 mddev->sb_dirty = 1;
3186 md_update_sb(mddev); 3424 md_wakeup_thread(mddev->thread);
3187 } 3425 }
3188 atomic_inc(&mddev->writes_pending); 3426 spin_unlock(&mddev->write_lock);
3189 mddev_unlock(mddev); 3427 }
3190 } else 3428 wait_event(mddev->sb_wait, mddev->sb_dirty==0);
3191 atomic_inc(&mddev->writes_pending);
3192} 3429}
3193 3430
3194void md_write_end(mddev_t *mddev) 3431void md_write_end(mddev_t *mddev)
@@ -3201,37 +3438,6 @@ void md_write_end(mddev_t *mddev)
3201 } 3438 }
3202} 3439}
3203 3440
3204static inline void md_enter_safemode(mddev_t *mddev)
3205{
3206 if (!mddev->safemode) return;
3207 if (mddev->safemode == 2 &&
3208 (atomic_read(&mddev->writes_pending) || mddev->in_sync ||
3209 mddev->recovery_cp != MaxSector))
3210 return; /* avoid the lock */
3211 mddev_lock_uninterruptible(mddev);
3212 if (mddev->safemode && !atomic_read(&mddev->writes_pending) &&
3213 !mddev->in_sync && mddev->recovery_cp == MaxSector) {
3214 mddev->in_sync = 1;
3215 md_update_sb(mddev);
3216 }
3217 mddev_unlock(mddev);
3218
3219 if (mddev->safemode == 1)
3220 mddev->safemode = 0;
3221}
3222
3223void md_handle_safemode(mddev_t *mddev)
3224{
3225 if (signal_pending(current)) {
3226 printk(KERN_INFO "md: %s in immediate safe mode\n",
3227 mdname(mddev));
3228 mddev->safemode = 2;
3229 flush_signals(current);
3230 }
3231 md_enter_safemode(mddev);
3232}
3233
3234
3235static DECLARE_WAIT_QUEUE_HEAD(resync_wait); 3441static DECLARE_WAIT_QUEUE_HEAD(resync_wait);
3236 3442
3237#define SYNC_MARKS 10 3443#define SYNC_MARKS 10
@@ -3241,12 +3447,13 @@ static void md_do_sync(mddev_t *mddev)
3241 mddev_t *mddev2; 3447 mddev_t *mddev2;
3242 unsigned int currspeed = 0, 3448 unsigned int currspeed = 0,
3243 window; 3449 window;
3244 sector_t max_sectors,j; 3450 sector_t max_sectors,j, io_sectors;
3245 unsigned long mark[SYNC_MARKS]; 3451 unsigned long mark[SYNC_MARKS];
3246 sector_t mark_cnt[SYNC_MARKS]; 3452 sector_t mark_cnt[SYNC_MARKS];
3247 int last_mark,m; 3453 int last_mark,m;
3248 struct list_head *tmp; 3454 struct list_head *tmp;
3249 sector_t last_check; 3455 sector_t last_check;
3456 int skipped = 0;
3250 3457
3251 /* just incase thread restarts... */ 3458 /* just incase thread restarts... */
3252 if (test_bit(MD_RECOVERY_DONE, &mddev->recovery)) 3459 if (test_bit(MD_RECOVERY_DONE, &mddev->recovery))
@@ -3312,7 +3519,7 @@ static void md_do_sync(mddev_t *mddev)
3312 3519
3313 if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) 3520 if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery))
3314 /* resync follows the size requested by the personality, 3521 /* resync follows the size requested by the personality,
3315 * which default to physical size, but can be virtual size 3522 * which defaults to physical size, but can be virtual size
3316 */ 3523 */
3317 max_sectors = mddev->resync_max_sectors; 3524 max_sectors = mddev->resync_max_sectors;
3318 else 3525 else
@@ -3327,13 +3534,15 @@ static void md_do_sync(mddev_t *mddev)
3327 sysctl_speed_limit_max); 3534 sysctl_speed_limit_max);
3328 3535
3329 is_mddev_idle(mddev); /* this also initializes IO event counters */ 3536 is_mddev_idle(mddev); /* this also initializes IO event counters */
3330 if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) 3537 /* we don't use the checkpoint if there's a bitmap */
3538 if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery) && !mddev->bitmap)
3331 j = mddev->recovery_cp; 3539 j = mddev->recovery_cp;
3332 else 3540 else
3333 j = 0; 3541 j = 0;
3542 io_sectors = 0;
3334 for (m = 0; m < SYNC_MARKS; m++) { 3543 for (m = 0; m < SYNC_MARKS; m++) {
3335 mark[m] = jiffies; 3544 mark[m] = jiffies;
3336 mark_cnt[m] = j; 3545 mark_cnt[m] = io_sectors;
3337 } 3546 }
3338 last_mark = 0; 3547 last_mark = 0;
3339 mddev->resync_mark = mark[last_mark]; 3548 mddev->resync_mark = mark[last_mark];
@@ -3358,21 +3567,29 @@ static void md_do_sync(mddev_t *mddev)
3358 } 3567 }
3359 3568
3360 while (j < max_sectors) { 3569 while (j < max_sectors) {
3361 int sectors; 3570 sector_t sectors;
3362 3571
3363 sectors = mddev->pers->sync_request(mddev, j, currspeed < sysctl_speed_limit_min); 3572 skipped = 0;
3364 if (sectors < 0) { 3573 sectors = mddev->pers->sync_request(mddev, j, &skipped,
3574 currspeed < sysctl_speed_limit_min);
3575 if (sectors == 0) {
3365 set_bit(MD_RECOVERY_ERR, &mddev->recovery); 3576 set_bit(MD_RECOVERY_ERR, &mddev->recovery);
3366 goto out; 3577 goto out;
3367 } 3578 }
3368 atomic_add(sectors, &mddev->recovery_active); 3579
3580 if (!skipped) { /* actual IO requested */
3581 io_sectors += sectors;
3582 atomic_add(sectors, &mddev->recovery_active);
3583 }
3584
3369 j += sectors; 3585 j += sectors;
3370 if (j>1) mddev->curr_resync = j; 3586 if (j>1) mddev->curr_resync = j;
3371 3587
3372 if (last_check + window > j || j == max_sectors) 3588
3589 if (last_check + window > io_sectors || j == max_sectors)
3373 continue; 3590 continue;
3374 3591
3375 last_check = j; 3592 last_check = io_sectors;
3376 3593
3377 if (test_bit(MD_RECOVERY_INTR, &mddev->recovery) || 3594 if (test_bit(MD_RECOVERY_INTR, &mddev->recovery) ||
3378 test_bit(MD_RECOVERY_ERR, &mddev->recovery)) 3595 test_bit(MD_RECOVERY_ERR, &mddev->recovery))
@@ -3386,7 +3603,7 @@ static void md_do_sync(mddev_t *mddev)
3386 mddev->resync_mark = mark[next]; 3603 mddev->resync_mark = mark[next];
3387 mddev->resync_mark_cnt = mark_cnt[next]; 3604 mddev->resync_mark_cnt = mark_cnt[next];
3388 mark[next] = jiffies; 3605 mark[next] = jiffies;
3389 mark_cnt[next] = j - atomic_read(&mddev->recovery_active); 3606 mark_cnt[next] = io_sectors - atomic_read(&mddev->recovery_active);
3390 last_mark = next; 3607 last_mark = next;
3391 } 3608 }
3392 3609
@@ -3413,7 +3630,8 @@ static void md_do_sync(mddev_t *mddev)
3413 mddev->queue->unplug_fn(mddev->queue); 3630 mddev->queue->unplug_fn(mddev->queue);
3414 cond_resched(); 3631 cond_resched();
3415 3632
3416 currspeed = ((unsigned long)(j-mddev->resync_mark_cnt))/2/((jiffies-mddev->resync_mark)/HZ +1) +1; 3633 currspeed = ((unsigned long)(io_sectors-mddev->resync_mark_cnt))/2
3634 /((jiffies-mddev->resync_mark)/HZ +1) +1;
3417 3635
3418 if (currspeed > sysctl_speed_limit_min) { 3636 if (currspeed > sysctl_speed_limit_min) {
3419 if ((currspeed > sysctl_speed_limit_max) || 3637 if ((currspeed > sysctl_speed_limit_max) ||
@@ -3433,7 +3651,7 @@ static void md_do_sync(mddev_t *mddev)
3433 wait_event(mddev->recovery_wait, !atomic_read(&mddev->recovery_active)); 3651 wait_event(mddev->recovery_wait, !atomic_read(&mddev->recovery_active));
3434 3652
3435 /* tell personality that we are finished */ 3653 /* tell personality that we are finished */
3436 mddev->pers->sync_request(mddev, max_sectors, 1); 3654 mddev->pers->sync_request(mddev, max_sectors, &skipped, 1);
3437 3655
3438 if (!test_bit(MD_RECOVERY_ERR, &mddev->recovery) && 3656 if (!test_bit(MD_RECOVERY_ERR, &mddev->recovery) &&
3439 mddev->curr_resync > 2 && 3657 mddev->curr_resync > 2 &&
@@ -3447,7 +3665,6 @@ static void md_do_sync(mddev_t *mddev)
3447 mddev->recovery_cp = MaxSector; 3665 mddev->recovery_cp = MaxSector;
3448 } 3666 }
3449 3667
3450 md_enter_safemode(mddev);
3451 skip: 3668 skip:
3452 mddev->curr_resync = 0; 3669 mddev->curr_resync = 0;
3453 wake_up(&resync_wait); 3670 wake_up(&resync_wait);
@@ -3484,20 +3701,48 @@ void md_check_recovery(mddev_t *mddev)
3484 struct list_head *rtmp; 3701 struct list_head *rtmp;
3485 3702
3486 3703
3487 dprintk(KERN_INFO "md: recovery thread got woken up ...\n"); 3704 if (mddev->bitmap)
3705 bitmap_daemon_work(mddev->bitmap);
3488 3706
3489 if (mddev->ro) 3707 if (mddev->ro)
3490 return; 3708 return;
3709
3710 if (signal_pending(current)) {
3711 if (mddev->pers->sync_request) {
3712 printk(KERN_INFO "md: %s in immediate safe mode\n",
3713 mdname(mddev));
3714 mddev->safemode = 2;
3715 }
3716 flush_signals(current);
3717 }
3718
3491 if ( ! ( 3719 if ( ! (
3492 mddev->sb_dirty || 3720 mddev->sb_dirty ||
3493 test_bit(MD_RECOVERY_NEEDED, &mddev->recovery) || 3721 test_bit(MD_RECOVERY_NEEDED, &mddev->recovery) ||
3494 test_bit(MD_RECOVERY_DONE, &mddev->recovery) 3722 test_bit(MD_RECOVERY_DONE, &mddev->recovery) ||
3723 (mddev->safemode == 1) ||
3724 (mddev->safemode == 2 && ! atomic_read(&mddev->writes_pending)
3725 && !mddev->in_sync && mddev->recovery_cp == MaxSector)
3495 )) 3726 ))
3496 return; 3727 return;
3728
3497 if (mddev_trylock(mddev)==0) { 3729 if (mddev_trylock(mddev)==0) {
3498 int spares =0; 3730 int spares =0;
3731
3732 spin_lock(&mddev->write_lock);
3733 if (mddev->safemode && !atomic_read(&mddev->writes_pending) &&
3734 !mddev->in_sync && mddev->recovery_cp == MaxSector) {
3735 mddev->in_sync = 1;
3736 mddev->sb_dirty = 1;
3737 }
3738 if (mddev->safemode == 1)
3739 mddev->safemode = 0;
3740 spin_unlock(&mddev->write_lock);
3741
3499 if (mddev->sb_dirty) 3742 if (mddev->sb_dirty)
3500 md_update_sb(mddev); 3743 md_update_sb(mddev);
3744
3745
3501 if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) && 3746 if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) &&
3502 !test_bit(MD_RECOVERY_DONE, &mddev->recovery)) { 3747 !test_bit(MD_RECOVERY_DONE, &mddev->recovery)) {
3503 /* resync/recovery still happening */ 3748 /* resync/recovery still happening */
@@ -3515,6 +3760,14 @@ void md_check_recovery(mddev_t *mddev)
3515 mddev->pers->spare_active(mddev); 3760 mddev->pers->spare_active(mddev);
3516 } 3761 }
3517 md_update_sb(mddev); 3762 md_update_sb(mddev);
3763
3764 /* if array is no-longer degraded, then any saved_raid_disk
3765 * information must be scrapped
3766 */
3767 if (!mddev->degraded)
3768 ITERATE_RDEV(mddev,rdev,rtmp)
3769 rdev->saved_raid_disk = -1;
3770
3518 mddev->recovery = 0; 3771 mddev->recovery = 0;
3519 /* flag recovery needed just to double check */ 3772 /* flag recovery needed just to double check */
3520 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); 3773 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
@@ -3557,6 +3810,13 @@ void md_check_recovery(mddev_t *mddev)
3557 set_bit(MD_RECOVERY_RUNNING, &mddev->recovery); 3810 set_bit(MD_RECOVERY_RUNNING, &mddev->recovery);
3558 if (!spares) 3811 if (!spares)
3559 set_bit(MD_RECOVERY_SYNC, &mddev->recovery); 3812 set_bit(MD_RECOVERY_SYNC, &mddev->recovery);
3813 if (spares && mddev->bitmap && ! mddev->bitmap->file) {
3814 /* We are adding a device or devices to an array
3815 * which has the bitmap stored on all devices.
3816 * So make sure all bitmap pages get written
3817 */
3818 bitmap_write_all(mddev->bitmap);
3819 }
3560 mddev->sync_thread = md_register_thread(md_do_sync, 3820 mddev->sync_thread = md_register_thread(md_do_sync,
3561 mddev, 3821 mddev,
3562 "%s_resync"); 3822 "%s_resync");
@@ -3624,6 +3884,8 @@ static int __init md_init(void)
3624 " MD_SB_DISKS=%d\n", 3884 " MD_SB_DISKS=%d\n",
3625 MD_MAJOR_VERSION, MD_MINOR_VERSION, 3885 MD_MAJOR_VERSION, MD_MINOR_VERSION,
3626 MD_PATCHLEVEL_VERSION, MAX_MD_DEVS, MD_SB_DISKS); 3886 MD_PATCHLEVEL_VERSION, MAX_MD_DEVS, MD_SB_DISKS);
3887 printk(KERN_INFO "md: bitmap version %d.%d\n", BITMAP_MAJOR,
3888 BITMAP_MINOR);
3627 3889
3628 if (register_blkdev(MAJOR_NR, "md")) 3890 if (register_blkdev(MAJOR_NR, "md"))
3629 return -1; 3891 return -1;
@@ -3739,7 +4001,6 @@ EXPORT_SYMBOL(md_error);
3739EXPORT_SYMBOL(md_done_sync); 4001EXPORT_SYMBOL(md_done_sync);
3740EXPORT_SYMBOL(md_write_start); 4002EXPORT_SYMBOL(md_write_start);
3741EXPORT_SYMBOL(md_write_end); 4003EXPORT_SYMBOL(md_write_end);
3742EXPORT_SYMBOL(md_handle_safemode);
3743EXPORT_SYMBOL(md_register_thread); 4004EXPORT_SYMBOL(md_register_thread);
3744EXPORT_SYMBOL(md_unregister_thread); 4005EXPORT_SYMBOL(md_unregister_thread);
3745EXPORT_SYMBOL(md_wakeup_thread); 4006EXPORT_SYMBOL(md_wakeup_thread);
diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c
index 2ae2d709cb15..2d2ca7fa0265 100644
--- a/drivers/md/multipath.c
+++ b/drivers/md/multipath.c
@@ -533,8 +533,7 @@ static int multipath_run (mddev_t *mddev)
533out_free_conf: 533out_free_conf:
534 if (conf->pool) 534 if (conf->pool)
535 mempool_destroy(conf->pool); 535 mempool_destroy(conf->pool);
536 if (conf->multipaths) 536 kfree(conf->multipaths);
537 kfree(conf->multipaths);
538 kfree(conf); 537 kfree(conf);
539 mddev->private = NULL; 538 mddev->private = NULL;
540out: 539out:
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
index e7d934eca06f..e11dd14d0b43 100644
--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@ -371,10 +371,8 @@ static int raid0_run (mddev_t *mddev)
371 return 0; 371 return 0;
372 372
373out_free_conf: 373out_free_conf:
374 if (conf->strip_zone) 374 kfree(conf->strip_zone);
375 kfree(conf->strip_zone); 375 kfree(conf->devlist);
376 if (conf->devlist)
377 kfree (conf->devlist);
378 kfree(conf); 376 kfree(conf);
379 mddev->private = NULL; 377 mddev->private = NULL;
380out: 378out:
@@ -386,11 +384,11 @@ static int raid0_stop (mddev_t *mddev)
386 raid0_conf_t *conf = mddev_to_conf(mddev); 384 raid0_conf_t *conf = mddev_to_conf(mddev);
387 385
388 blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/ 386 blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/
389 kfree (conf->hash_table); 387 kfree(conf->hash_table);
390 conf->hash_table = NULL; 388 conf->hash_table = NULL;
391 kfree (conf->strip_zone); 389 kfree(conf->strip_zone);
392 conf->strip_zone = NULL; 390 conf->strip_zone = NULL;
393 kfree (conf); 391 kfree(conf);
394 mddev->private = NULL; 392 mddev->private = NULL;
395 393
396 return 0; 394 return 0;
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 1db5de52d376..ff1dbec864af 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -12,6 +12,15 @@
12 * Fixes to reconstruction by Jakob Østergaard" <jakob@ostenfeld.dk> 12 * Fixes to reconstruction by Jakob Østergaard" <jakob@ostenfeld.dk>
13 * Various fixes by Neil Brown <neilb@cse.unsw.edu.au> 13 * Various fixes by Neil Brown <neilb@cse.unsw.edu.au>
14 * 14 *
15 * Changes by Peter T. Breuer <ptb@it.uc3m.es> 31/1/2003 to support
16 * bitmapped intelligence in resync:
17 *
18 * - bitmap marked during normal i/o
19 * - bitmap used to skip nondirty blocks during sync
20 *
21 * Additions to bitmap code, (C) 2003-2004 Paul Clements, SteelEye Technology:
22 * - persistent bitmap code
23 *
15 * This program is free software; you can redistribute it and/or modify 24 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by 25 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2, or (at your option) 26 * the Free Software Foundation; either version 2, or (at your option)
@@ -22,7 +31,16 @@
22 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 31 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 */ 32 */
24 33
34#include "dm-bio-list.h"
25#include <linux/raid/raid1.h> 35#include <linux/raid/raid1.h>
36#include <linux/raid/bitmap.h>
37
38#define DEBUG 0
39#if DEBUG
40#define PRINTK(x...) printk(x)
41#else
42#define PRINTK(x...)
43#endif
26 44
27/* 45/*
28 * Number of guaranteed r1bios in case of extreme VM load: 46 * Number of guaranteed r1bios in case of extreme VM load:
@@ -287,9 +305,11 @@ static int raid1_end_write_request(struct bio *bio, unsigned int bytes_done, int
287 /* 305 /*
288 * this branch is our 'one mirror IO has finished' event handler: 306 * this branch is our 'one mirror IO has finished' event handler:
289 */ 307 */
290 if (!uptodate) 308 if (!uptodate) {
291 md_error(r1_bio->mddev, conf->mirrors[mirror].rdev); 309 md_error(r1_bio->mddev, conf->mirrors[mirror].rdev);
292 else 310 /* an I/O failed, we can't clear the bitmap */
311 set_bit(R1BIO_Degraded, &r1_bio->state);
312 } else
293 /* 313 /*
294 * Set R1BIO_Uptodate in our master bio, so that 314 * Set R1BIO_Uptodate in our master bio, so that
295 * we will return a good error code for to the higher 315 * we will return a good error code for to the higher
@@ -309,6 +329,10 @@ static int raid1_end_write_request(struct bio *bio, unsigned int bytes_done, int
309 * already. 329 * already.
310 */ 330 */
311 if (atomic_dec_and_test(&r1_bio->remaining)) { 331 if (atomic_dec_and_test(&r1_bio->remaining)) {
332 /* clear the bitmap if all writes complete successfully */
333 bitmap_endwrite(r1_bio->mddev->bitmap, r1_bio->sector,
334 r1_bio->sectors,
335 !test_bit(R1BIO_Degraded, &r1_bio->state));
312 md_write_end(r1_bio->mddev); 336 md_write_end(r1_bio->mddev);
313 raid_end_bio_io(r1_bio); 337 raid_end_bio_io(r1_bio);
314 } 338 }
@@ -458,7 +482,10 @@ static void unplug_slaves(mddev_t *mddev)
458 482
459static void raid1_unplug(request_queue_t *q) 483static void raid1_unplug(request_queue_t *q)
460{ 484{
461 unplug_slaves(q->queuedata); 485 mddev_t *mddev = q->queuedata;
486
487 unplug_slaves(mddev);
488 md_wakeup_thread(mddev->thread);
462} 489}
463 490
464static int raid1_issue_flush(request_queue_t *q, struct gendisk *disk, 491static int raid1_issue_flush(request_queue_t *q, struct gendisk *disk,
@@ -501,16 +528,16 @@ static void device_barrier(conf_t *conf, sector_t sect)
501{ 528{
502 spin_lock_irq(&conf->resync_lock); 529 spin_lock_irq(&conf->resync_lock);
503 wait_event_lock_irq(conf->wait_idle, !waitqueue_active(&conf->wait_resume), 530 wait_event_lock_irq(conf->wait_idle, !waitqueue_active(&conf->wait_resume),
504 conf->resync_lock, unplug_slaves(conf->mddev)); 531 conf->resync_lock, raid1_unplug(conf->mddev->queue));
505 532
506 if (!conf->barrier++) { 533 if (!conf->barrier++) {
507 wait_event_lock_irq(conf->wait_idle, !conf->nr_pending, 534 wait_event_lock_irq(conf->wait_idle, !conf->nr_pending,
508 conf->resync_lock, unplug_slaves(conf->mddev)); 535 conf->resync_lock, raid1_unplug(conf->mddev->queue));
509 if (conf->nr_pending) 536 if (conf->nr_pending)
510 BUG(); 537 BUG();
511 } 538 }
512 wait_event_lock_irq(conf->wait_resume, conf->barrier < RESYNC_DEPTH, 539 wait_event_lock_irq(conf->wait_resume, conf->barrier < RESYNC_DEPTH,
513 conf->resync_lock, unplug_slaves(conf->mddev)); 540 conf->resync_lock, raid1_unplug(conf->mddev->queue));
514 conf->next_resync = sect; 541 conf->next_resync = sect;
515 spin_unlock_irq(&conf->resync_lock); 542 spin_unlock_irq(&conf->resync_lock);
516} 543}
@@ -522,14 +549,20 @@ static int make_request(request_queue_t *q, struct bio * bio)
522 mirror_info_t *mirror; 549 mirror_info_t *mirror;
523 r1bio_t *r1_bio; 550 r1bio_t *r1_bio;
524 struct bio *read_bio; 551 struct bio *read_bio;
525 int i, disks; 552 int i, targets = 0, disks;
526 mdk_rdev_t *rdev; 553 mdk_rdev_t *rdev;
554 struct bitmap *bitmap = mddev->bitmap;
555 unsigned long flags;
556 struct bio_list bl;
557
527 558
528 /* 559 /*
529 * Register the new request and wait if the reconstruction 560 * Register the new request and wait if the reconstruction
530 * thread has put up a bar for new requests. 561 * thread has put up a bar for new requests.
531 * Continue immediately if no resync is active currently. 562 * Continue immediately if no resync is active currently.
532 */ 563 */
564 md_write_start(mddev, bio); /* wait on superblock update early */
565
533 spin_lock_irq(&conf->resync_lock); 566 spin_lock_irq(&conf->resync_lock);
534 wait_event_lock_irq(conf->wait_resume, !conf->barrier, conf->resync_lock, ); 567 wait_event_lock_irq(conf->wait_resume, !conf->barrier, conf->resync_lock, );
535 conf->nr_pending++; 568 conf->nr_pending++;
@@ -552,7 +585,7 @@ static int make_request(request_queue_t *q, struct bio * bio)
552 585
553 r1_bio->master_bio = bio; 586 r1_bio->master_bio = bio;
554 r1_bio->sectors = bio->bi_size >> 9; 587 r1_bio->sectors = bio->bi_size >> 9;
555 588 r1_bio->state = 0;
556 r1_bio->mddev = mddev; 589 r1_bio->mddev = mddev;
557 r1_bio->sector = bio->bi_sector; 590 r1_bio->sector = bio->bi_sector;
558 591
@@ -595,6 +628,13 @@ static int make_request(request_queue_t *q, struct bio * bio)
595 * bios[x] to bio 628 * bios[x] to bio
596 */ 629 */
597 disks = conf->raid_disks; 630 disks = conf->raid_disks;
631#if 0
632 { static int first=1;
633 if (first) printk("First Write sector %llu disks %d\n",
634 (unsigned long long)r1_bio->sector, disks);
635 first = 0;
636 }
637#endif
598 rcu_read_lock(); 638 rcu_read_lock();
599 for (i = 0; i < disks; i++) { 639 for (i = 0; i < disks; i++) {
600 if ((rdev=conf->mirrors[i].rdev) != NULL && 640 if ((rdev=conf->mirrors[i].rdev) != NULL &&
@@ -605,13 +645,21 @@ static int make_request(request_queue_t *q, struct bio * bio)
605 r1_bio->bios[i] = NULL; 645 r1_bio->bios[i] = NULL;
606 } else 646 } else
607 r1_bio->bios[i] = bio; 647 r1_bio->bios[i] = bio;
648 targets++;
608 } else 649 } else
609 r1_bio->bios[i] = NULL; 650 r1_bio->bios[i] = NULL;
610 } 651 }
611 rcu_read_unlock(); 652 rcu_read_unlock();
612 653
613 atomic_set(&r1_bio->remaining, 1); 654 if (targets < conf->raid_disks) {
614 md_write_start(mddev); 655 /* array is degraded, we will not clear the bitmap
656 * on I/O completion (see raid1_end_write_request) */
657 set_bit(R1BIO_Degraded, &r1_bio->state);
658 }
659
660 atomic_set(&r1_bio->remaining, 0);
661
662 bio_list_init(&bl);
615 for (i = 0; i < disks; i++) { 663 for (i = 0; i < disks; i++) {
616 struct bio *mbio; 664 struct bio *mbio;
617 if (!r1_bio->bios[i]) 665 if (!r1_bio->bios[i])
@@ -627,14 +675,23 @@ static int make_request(request_queue_t *q, struct bio * bio)
627 mbio->bi_private = r1_bio; 675 mbio->bi_private = r1_bio;
628 676
629 atomic_inc(&r1_bio->remaining); 677 atomic_inc(&r1_bio->remaining);
630 generic_make_request(mbio);
631 }
632 678
633 if (atomic_dec_and_test(&r1_bio->remaining)) { 679 bio_list_add(&bl, mbio);
634 md_write_end(mddev);
635 raid_end_bio_io(r1_bio);
636 } 680 }
637 681
682 bitmap_startwrite(bitmap, bio->bi_sector, r1_bio->sectors);
683 spin_lock_irqsave(&conf->device_lock, flags);
684 bio_list_merge(&conf->pending_bio_list, &bl);
685 bio_list_init(&bl);
686
687 blk_plug_device(mddev->queue);
688 spin_unlock_irqrestore(&conf->device_lock, flags);
689
690#if 0
691 while ((bio = bio_list_pop(&bl)) != NULL)
692 generic_make_request(bio);
693#endif
694
638 return 0; 695 return 0;
639} 696}
640 697
@@ -714,7 +771,7 @@ static void close_sync(conf_t *conf)
714{ 771{
715 spin_lock_irq(&conf->resync_lock); 772 spin_lock_irq(&conf->resync_lock);
716 wait_event_lock_irq(conf->wait_resume, !conf->barrier, 773 wait_event_lock_irq(conf->wait_resume, !conf->barrier,
717 conf->resync_lock, unplug_slaves(conf->mddev)); 774 conf->resync_lock, raid1_unplug(conf->mddev->queue));
718 spin_unlock_irq(&conf->resync_lock); 775 spin_unlock_irq(&conf->resync_lock);
719 776
720 if (conf->barrier) BUG(); 777 if (conf->barrier) BUG();
@@ -754,9 +811,12 @@ static int raid1_add_disk(mddev_t *mddev, mdk_rdev_t *rdev)
754{ 811{
755 conf_t *conf = mddev->private; 812 conf_t *conf = mddev->private;
756 int found = 0; 813 int found = 0;
757 int mirror; 814 int mirror = 0;
758 mirror_info_t *p; 815 mirror_info_t *p;
759 816
817 if (rdev->saved_raid_disk >= 0 &&
818 conf->mirrors[rdev->saved_raid_disk].rdev == NULL)
819 mirror = rdev->saved_raid_disk;
760 for (mirror=0; mirror < mddev->raid_disks; mirror++) 820 for (mirror=0; mirror < mddev->raid_disks; mirror++)
761 if ( !(p=conf->mirrors+mirror)->rdev) { 821 if ( !(p=conf->mirrors+mirror)->rdev) {
762 822
@@ -773,6 +833,8 @@ static int raid1_add_disk(mddev_t *mddev, mdk_rdev_t *rdev)
773 p->head_position = 0; 833 p->head_position = 0;
774 rdev->raid_disk = mirror; 834 rdev->raid_disk = mirror;
775 found = 1; 835 found = 1;
836 if (rdev->saved_raid_disk != mirror)
837 conf->fullsync = 1;
776 p->rdev = rdev; 838 p->rdev = rdev;
777 break; 839 break;
778 } 840 }
@@ -828,10 +890,11 @@ static int end_sync_read(struct bio *bio, unsigned int bytes_done, int error)
828 * or re-read if the read failed. 890 * or re-read if the read failed.
829 * We don't do much here, just schedule handling by raid1d 891 * We don't do much here, just schedule handling by raid1d
830 */ 892 */
831 if (!uptodate) 893 if (!uptodate) {
832 md_error(r1_bio->mddev, 894 md_error(r1_bio->mddev,
833 conf->mirrors[r1_bio->read_disk].rdev); 895 conf->mirrors[r1_bio->read_disk].rdev);
834 else 896 set_bit(R1BIO_Degraded, &r1_bio->state);
897 } else
835 set_bit(R1BIO_Uptodate, &r1_bio->state); 898 set_bit(R1BIO_Uptodate, &r1_bio->state);
836 rdev_dec_pending(conf->mirrors[r1_bio->read_disk].rdev, conf->mddev); 899 rdev_dec_pending(conf->mirrors[r1_bio->read_disk].rdev, conf->mddev);
837 reschedule_retry(r1_bio); 900 reschedule_retry(r1_bio);
@@ -855,8 +918,10 @@ static int end_sync_write(struct bio *bio, unsigned int bytes_done, int error)
855 mirror = i; 918 mirror = i;
856 break; 919 break;
857 } 920 }
858 if (!uptodate) 921 if (!uptodate) {
859 md_error(mddev, conf->mirrors[mirror].rdev); 922 md_error(mddev, conf->mirrors[mirror].rdev);
923 set_bit(R1BIO_Degraded, &r1_bio->state);
924 }
860 update_head_pos(mirror, r1_bio); 925 update_head_pos(mirror, r1_bio);
861 926
862 if (atomic_dec_and_test(&r1_bio->remaining)) { 927 if (atomic_dec_and_test(&r1_bio->remaining)) {
@@ -876,6 +941,9 @@ static void sync_request_write(mddev_t *mddev, r1bio_t *r1_bio)
876 941
877 bio = r1_bio->bios[r1_bio->read_disk]; 942 bio = r1_bio->bios[r1_bio->read_disk];
878 943
944/*
945 if (r1_bio->sector == 0) printk("First sync write startss\n");
946*/
879 /* 947 /*
880 * schedule writes 948 * schedule writes
881 */ 949 */
@@ -903,10 +971,12 @@ static void sync_request_write(mddev_t *mddev, r1bio_t *r1_bio)
903 atomic_inc(&conf->mirrors[i].rdev->nr_pending); 971 atomic_inc(&conf->mirrors[i].rdev->nr_pending);
904 atomic_inc(&r1_bio->remaining); 972 atomic_inc(&r1_bio->remaining);
905 md_sync_acct(conf->mirrors[i].rdev->bdev, wbio->bi_size >> 9); 973 md_sync_acct(conf->mirrors[i].rdev->bdev, wbio->bi_size >> 9);
974
906 generic_make_request(wbio); 975 generic_make_request(wbio);
907 } 976 }
908 977
909 if (atomic_dec_and_test(&r1_bio->remaining)) { 978 if (atomic_dec_and_test(&r1_bio->remaining)) {
979 /* if we're here, all write(s) have completed, so clean up */
910 md_done_sync(mddev, r1_bio->sectors, 1); 980 md_done_sync(mddev, r1_bio->sectors, 1);
911 put_buf(r1_bio); 981 put_buf(r1_bio);
912 } 982 }
@@ -931,11 +1001,30 @@ static void raid1d(mddev_t *mddev)
931 mdk_rdev_t *rdev; 1001 mdk_rdev_t *rdev;
932 1002
933 md_check_recovery(mddev); 1003 md_check_recovery(mddev);
934 md_handle_safemode(mddev);
935 1004
936 for (;;) { 1005 for (;;) {
937 char b[BDEVNAME_SIZE]; 1006 char b[BDEVNAME_SIZE];
938 spin_lock_irqsave(&conf->device_lock, flags); 1007 spin_lock_irqsave(&conf->device_lock, flags);
1008
1009 if (conf->pending_bio_list.head) {
1010 bio = bio_list_get(&conf->pending_bio_list);
1011 blk_remove_plug(mddev->queue);
1012 spin_unlock_irqrestore(&conf->device_lock, flags);
1013 /* flush any pending bitmap writes to disk before proceeding w/ I/O */
1014 if (bitmap_unplug(mddev->bitmap) != 0)
1015 printk("%s: bitmap file write failed!\n", mdname(mddev));
1016
1017 while (bio) { /* submit pending writes */
1018 struct bio *next = bio->bi_next;
1019 bio->bi_next = NULL;
1020 generic_make_request(bio);
1021 bio = next;
1022 }
1023 unplug = 1;
1024
1025 continue;
1026 }
1027
939 if (list_empty(head)) 1028 if (list_empty(head))
940 break; 1029 break;
941 r1_bio = list_entry(head->prev, r1bio_t, retry_list); 1030 r1_bio = list_entry(head->prev, r1bio_t, retry_list);
@@ -1009,7 +1098,7 @@ static int init_resync(conf_t *conf)
1009 * that can be installed to exclude normal IO requests. 1098 * that can be installed to exclude normal IO requests.
1010 */ 1099 */
1011 1100
1012static int sync_request(mddev_t *mddev, sector_t sector_nr, int go_faster) 1101static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, int go_faster)
1013{ 1102{
1014 conf_t *conf = mddev_to_conf(mddev); 1103 conf_t *conf = mddev_to_conf(mddev);
1015 mirror_info_t *mirror; 1104 mirror_info_t *mirror;
@@ -1019,17 +1108,43 @@ static int sync_request(mddev_t *mddev, sector_t sector_nr, int go_faster)
1019 int disk; 1108 int disk;
1020 int i; 1109 int i;
1021 int write_targets = 0; 1110 int write_targets = 0;
1111 int sync_blocks;
1022 1112
1023 if (!conf->r1buf_pool) 1113 if (!conf->r1buf_pool)
1114 {
1115/*
1116 printk("sync start - bitmap %p\n", mddev->bitmap);
1117*/
1024 if (init_resync(conf)) 1118 if (init_resync(conf))
1025 return -ENOMEM; 1119 return 0;
1120 }
1026 1121
1027 max_sector = mddev->size << 1; 1122 max_sector = mddev->size << 1;
1028 if (sector_nr >= max_sector) { 1123 if (sector_nr >= max_sector) {
1124 /* If we aborted, we need to abort the
1125 * sync on the 'current' bitmap chunk (there will
1126 * only be one in raid1 resync.
1127 * We can find the current addess in mddev->curr_resync
1128 */
1129 if (!conf->fullsync) {
1130 if (mddev->curr_resync < max_sector)
1131 bitmap_end_sync(mddev->bitmap,
1132 mddev->curr_resync,
1133 &sync_blocks, 1);
1134 bitmap_close_sync(mddev->bitmap);
1135 }
1136 if (mddev->curr_resync >= max_sector)
1137 conf->fullsync = 0;
1029 close_sync(conf); 1138 close_sync(conf);
1030 return 0; 1139 return 0;
1031 } 1140 }
1032 1141
1142 if (!conf->fullsync &&
1143 !bitmap_start_sync(mddev->bitmap, sector_nr, &sync_blocks)) {
1144 /* We can skip this block, and probably several more */
1145 *skipped = 1;
1146 return sync_blocks;
1147 }
1033 /* 1148 /*
1034 * If there is non-resync activity waiting for us then 1149 * If there is non-resync activity waiting for us then
1035 * put in a delay to throttle resync. 1150 * put in a delay to throttle resync.
@@ -1068,6 +1183,7 @@ static int sync_request(mddev_t *mddev, sector_t sector_nr, int go_faster)
1068 1183
1069 r1_bio->mddev = mddev; 1184 r1_bio->mddev = mddev;
1070 r1_bio->sector = sector_nr; 1185 r1_bio->sector = sector_nr;
1186 r1_bio->state = 0;
1071 set_bit(R1BIO_IsSync, &r1_bio->state); 1187 set_bit(R1BIO_IsSync, &r1_bio->state);
1072 r1_bio->read_disk = disk; 1188 r1_bio->read_disk = disk;
1073 1189
@@ -1102,18 +1218,24 @@ static int sync_request(mddev_t *mddev, sector_t sector_nr, int go_faster)
1102 bio->bi_bdev = conf->mirrors[i].rdev->bdev; 1218 bio->bi_bdev = conf->mirrors[i].rdev->bdev;
1103 bio->bi_private = r1_bio; 1219 bio->bi_private = r1_bio;
1104 } 1220 }
1221
1222 if (write_targets + 1 < conf->raid_disks)
1223 /* array degraded, can't clear bitmap */
1224 set_bit(R1BIO_Degraded, &r1_bio->state);
1225
1105 if (write_targets == 0) { 1226 if (write_targets == 0) {
1106 /* There is nowhere to write, so all non-sync 1227 /* There is nowhere to write, so all non-sync
1107 * drives must be failed - so we are finished 1228 * drives must be failed - so we are finished
1108 */ 1229 */
1109 int rv = max_sector - sector_nr; 1230 sector_t rv = max_sector - sector_nr;
1110 md_done_sync(mddev, rv, 1); 1231 *skipped = 1;
1111 put_buf(r1_bio); 1232 put_buf(r1_bio);
1112 rdev_dec_pending(conf->mirrors[disk].rdev, mddev); 1233 rdev_dec_pending(conf->mirrors[disk].rdev, mddev);
1113 return rv; 1234 return rv;
1114 } 1235 }
1115 1236
1116 nr_sectors = 0; 1237 nr_sectors = 0;
1238 sync_blocks = 0;
1117 do { 1239 do {
1118 struct page *page; 1240 struct page *page;
1119 int len = PAGE_SIZE; 1241 int len = PAGE_SIZE;
@@ -1121,6 +1243,17 @@ static int sync_request(mddev_t *mddev, sector_t sector_nr, int go_faster)
1121 len = (max_sector - sector_nr) << 9; 1243 len = (max_sector - sector_nr) << 9;
1122 if (len == 0) 1244 if (len == 0)
1123 break; 1245 break;
1246 if (!conf->fullsync) {
1247 if (sync_blocks == 0) {
1248 if (!bitmap_start_sync(mddev->bitmap,
1249 sector_nr, &sync_blocks))
1250 break;
1251 if (sync_blocks < (PAGE_SIZE>>9))
1252 BUG();
1253 if (len > (sync_blocks<<9)) len = sync_blocks<<9;
1254 }
1255 }
1256
1124 for (i=0 ; i < conf->raid_disks; i++) { 1257 for (i=0 ; i < conf->raid_disks; i++) {
1125 bio = r1_bio->bios[i]; 1258 bio = r1_bio->bios[i];
1126 if (bio->bi_end_io) { 1259 if (bio->bi_end_io) {
@@ -1143,6 +1276,7 @@ static int sync_request(mddev_t *mddev, sector_t sector_nr, int go_faster)
1143 } 1276 }
1144 nr_sectors += len>>9; 1277 nr_sectors += len>>9;
1145 sector_nr += len>>9; 1278 sector_nr += len>>9;
1279 sync_blocks -= (len>>9);
1146 } while (r1_bio->bios[disk]->bi_vcnt < RESYNC_PAGES); 1280 } while (r1_bio->bios[disk]->bi_vcnt < RESYNC_PAGES);
1147 bio_full: 1281 bio_full:
1148 bio = r1_bio->bios[disk]; 1282 bio = r1_bio->bios[disk];
@@ -1231,6 +1365,9 @@ static int run(mddev_t *mddev)
1231 init_waitqueue_head(&conf->wait_idle); 1365 init_waitqueue_head(&conf->wait_idle);
1232 init_waitqueue_head(&conf->wait_resume); 1366 init_waitqueue_head(&conf->wait_resume);
1233 1367
1368 bio_list_init(&conf->pending_bio_list);
1369 bio_list_init(&conf->flushing_bio_list);
1370
1234 if (!conf->working_disks) { 1371 if (!conf->working_disks) {
1235 printk(KERN_ERR "raid1: no operational mirrors for %s\n", 1372 printk(KERN_ERR "raid1: no operational mirrors for %s\n",
1236 mdname(mddev)); 1373 mdname(mddev));
@@ -1259,16 +1396,15 @@ static int run(mddev_t *mddev)
1259 conf->last_used = j; 1396 conf->last_used = j;
1260 1397
1261 1398
1262 1399 mddev->thread = md_register_thread(raid1d, mddev, "%s_raid1");
1263 { 1400 if (!mddev->thread) {
1264 mddev->thread = md_register_thread(raid1d, mddev, "%s_raid1"); 1401 printk(KERN_ERR
1265 if (!mddev->thread) { 1402 "raid1: couldn't allocate thread for %s\n",
1266 printk(KERN_ERR 1403 mdname(mddev));
1267 "raid1: couldn't allocate thread for %s\n", 1404 goto out_free_conf;
1268 mdname(mddev));
1269 goto out_free_conf;
1270 }
1271 } 1405 }
1406 if (mddev->bitmap) mddev->thread->timeout = mddev->bitmap->daemon_sleep * HZ;
1407
1272 printk(KERN_INFO 1408 printk(KERN_INFO
1273 "raid1: raid set %s active with %d out of %d mirrors\n", 1409 "raid1: raid set %s active with %d out of %d mirrors\n",
1274 mdname(mddev), mddev->raid_disks - mddev->degraded, 1410 mdname(mddev), mddev->raid_disks - mddev->degraded,
@@ -1291,10 +1427,8 @@ out_free_conf:
1291 if (conf) { 1427 if (conf) {
1292 if (conf->r1bio_pool) 1428 if (conf->r1bio_pool)
1293 mempool_destroy(conf->r1bio_pool); 1429 mempool_destroy(conf->r1bio_pool);
1294 if (conf->mirrors) 1430 kfree(conf->mirrors);
1295 kfree(conf->mirrors); 1431 kfree(conf->poolinfo);
1296 if (conf->poolinfo)
1297 kfree(conf->poolinfo);
1298 kfree(conf); 1432 kfree(conf);
1299 mddev->private = NULL; 1433 mddev->private = NULL;
1300 } 1434 }
@@ -1311,10 +1445,8 @@ static int stop(mddev_t *mddev)
1311 blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/ 1445 blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/
1312 if (conf->r1bio_pool) 1446 if (conf->r1bio_pool)
1313 mempool_destroy(conf->r1bio_pool); 1447 mempool_destroy(conf->r1bio_pool);
1314 if (conf->mirrors) 1448 kfree(conf->mirrors);
1315 kfree(conf->mirrors); 1449 kfree(conf->poolinfo);
1316 if (conf->poolinfo)
1317 kfree(conf->poolinfo);
1318 kfree(conf); 1450 kfree(conf);
1319 mddev->private = NULL; 1451 mddev->private = NULL;
1320 return 0; 1452 return 0;
@@ -1349,17 +1481,26 @@ static int raid1_reshape(mddev_t *mddev, int raid_disks)
1349 * We allocate a new r1bio_pool if we can. 1481 * We allocate a new r1bio_pool if we can.
1350 * Then raise a device barrier and wait until all IO stops. 1482 * Then raise a device barrier and wait until all IO stops.
1351 * Then resize conf->mirrors and swap in the new r1bio pool. 1483 * Then resize conf->mirrors and swap in the new r1bio pool.
1484 *
1485 * At the same time, we "pack" the devices so that all the missing
1486 * devices have the higher raid_disk numbers.
1352 */ 1487 */
1353 mempool_t *newpool, *oldpool; 1488 mempool_t *newpool, *oldpool;
1354 struct pool_info *newpoolinfo; 1489 struct pool_info *newpoolinfo;
1355 mirror_info_t *newmirrors; 1490 mirror_info_t *newmirrors;
1356 conf_t *conf = mddev_to_conf(mddev); 1491 conf_t *conf = mddev_to_conf(mddev);
1492 int cnt;
1357 1493
1358 int d; 1494 int d, d2;
1359 1495
1360 for (d= raid_disks; d < conf->raid_disks; d++) 1496 if (raid_disks < conf->raid_disks) {
1361 if (conf->mirrors[d].rdev) 1497 cnt=0;
1498 for (d= 0; d < conf->raid_disks; d++)
1499 if (conf->mirrors[d].rdev)
1500 cnt++;
1501 if (cnt > raid_disks)
1362 return -EBUSY; 1502 return -EBUSY;
1503 }
1363 1504
1364 newpoolinfo = kmalloc(sizeof(*newpoolinfo), GFP_KERNEL); 1505 newpoolinfo = kmalloc(sizeof(*newpoolinfo), GFP_KERNEL);
1365 if (!newpoolinfo) 1506 if (!newpoolinfo)
@@ -1384,14 +1525,18 @@ static int raid1_reshape(mddev_t *mddev, int raid_disks)
1384 spin_lock_irq(&conf->resync_lock); 1525 spin_lock_irq(&conf->resync_lock);
1385 conf->barrier++; 1526 conf->barrier++;
1386 wait_event_lock_irq(conf->wait_idle, !conf->nr_pending, 1527 wait_event_lock_irq(conf->wait_idle, !conf->nr_pending,
1387 conf->resync_lock, unplug_slaves(mddev)); 1528 conf->resync_lock, raid1_unplug(mddev->queue));
1388 spin_unlock_irq(&conf->resync_lock); 1529 spin_unlock_irq(&conf->resync_lock);
1389 1530
1390 /* ok, everything is stopped */ 1531 /* ok, everything is stopped */
1391 oldpool = conf->r1bio_pool; 1532 oldpool = conf->r1bio_pool;
1392 conf->r1bio_pool = newpool; 1533 conf->r1bio_pool = newpool;
1393 for (d=0; d < raid_disks && d < conf->raid_disks; d++) 1534
1394 newmirrors[d] = conf->mirrors[d]; 1535 for (d=d2=0; d < conf->raid_disks; d++)
1536 if (conf->mirrors[d].rdev) {
1537 conf->mirrors[d].rdev->raid_disk = d2;
1538 newmirrors[d2++].rdev = conf->mirrors[d].rdev;
1539 }
1395 kfree(conf->mirrors); 1540 kfree(conf->mirrors);
1396 conf->mirrors = newmirrors; 1541 conf->mirrors = newmirrors;
1397 kfree(conf->poolinfo); 1542 kfree(conf->poolinfo);
@@ -1400,6 +1545,7 @@ static int raid1_reshape(mddev_t *mddev, int raid_disks)
1400 mddev->degraded += (raid_disks - conf->raid_disks); 1545 mddev->degraded += (raid_disks - conf->raid_disks);
1401 conf->raid_disks = mddev->raid_disks = raid_disks; 1546 conf->raid_disks = mddev->raid_disks = raid_disks;
1402 1547
1548 conf->last_used = 0; /* just make sure it is in-range */
1403 spin_lock_irq(&conf->resync_lock); 1549 spin_lock_irq(&conf->resync_lock);
1404 conf->barrier--; 1550 conf->barrier--;
1405 spin_unlock_irq(&conf->resync_lock); 1551 spin_unlock_irq(&conf->resync_lock);
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 3c37be6423d7..62ebb1bc72be 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -700,6 +700,8 @@ static int make_request(request_queue_t *q, struct bio * bio)
700 return 0; 700 return 0;
701 } 701 }
702 702
703 md_write_start(mddev, bio);
704
703 /* 705 /*
704 * Register the new request and wait if the reconstruction 706 * Register the new request and wait if the reconstruction
705 * thread has put up a bar for new requests. 707 * thread has put up a bar for new requests.
@@ -774,7 +776,7 @@ static int make_request(request_queue_t *q, struct bio * bio)
774 rcu_read_unlock(); 776 rcu_read_unlock();
775 777
776 atomic_set(&r10_bio->remaining, 1); 778 atomic_set(&r10_bio->remaining, 1);
777 md_write_start(mddev); 779
778 for (i = 0; i < conf->copies; i++) { 780 for (i = 0; i < conf->copies; i++) {
779 struct bio *mbio; 781 struct bio *mbio;
780 int d = r10_bio->devs[i].devnum; 782 int d = r10_bio->devs[i].devnum;
@@ -1216,7 +1218,6 @@ static void raid10d(mddev_t *mddev)
1216 mdk_rdev_t *rdev; 1218 mdk_rdev_t *rdev;
1217 1219
1218 md_check_recovery(mddev); 1220 md_check_recovery(mddev);
1219 md_handle_safemode(mddev);
1220 1221
1221 for (;;) { 1222 for (;;) {
1222 char b[BDEVNAME_SIZE]; 1223 char b[BDEVNAME_SIZE];
@@ -1319,7 +1320,7 @@ static int init_resync(conf_t *conf)
1319 * 1320 *
1320 */ 1321 */
1321 1322
1322static int sync_request(mddev_t *mddev, sector_t sector_nr, int go_faster) 1323static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, int go_faster)
1323{ 1324{
1324 conf_t *conf = mddev_to_conf(mddev); 1325 conf_t *conf = mddev_to_conf(mddev);
1325 r10bio_t *r10_bio; 1326 r10bio_t *r10_bio;
@@ -1333,7 +1334,7 @@ static int sync_request(mddev_t *mddev, sector_t sector_nr, int go_faster)
1333 1334
1334 if (!conf->r10buf_pool) 1335 if (!conf->r10buf_pool)
1335 if (init_resync(conf)) 1336 if (init_resync(conf))
1336 return -ENOMEM; 1337 return 0;
1337 1338
1338 skipped: 1339 skipped:
1339 max_sector = mddev->size << 1; 1340 max_sector = mddev->size << 1;
@@ -1341,15 +1342,15 @@ static int sync_request(mddev_t *mddev, sector_t sector_nr, int go_faster)
1341 max_sector = mddev->resync_max_sectors; 1342 max_sector = mddev->resync_max_sectors;
1342 if (sector_nr >= max_sector) { 1343 if (sector_nr >= max_sector) {
1343 close_sync(conf); 1344 close_sync(conf);
1345 *skipped = 1;
1344 return sectors_skipped; 1346 return sectors_skipped;
1345 } 1347 }
1346 if (chunks_skipped >= conf->raid_disks) { 1348 if (chunks_skipped >= conf->raid_disks) {
1347 /* if there has been nothing to do on any drive, 1349 /* if there has been nothing to do on any drive,
1348 * then there is nothing to do at all.. 1350 * then there is nothing to do at all..
1349 */ 1351 */
1350 sector_t sec = max_sector - sector_nr; 1352 *skipped = 1;
1351 md_done_sync(mddev, sec, 1); 1353 return (max_sector - sector_nr) + sectors_skipped;
1352 return sec + sectors_skipped;
1353 } 1354 }
1354 1355
1355 /* make sure whole request will fit in a chunk - if chunks 1356 /* make sure whole request will fit in a chunk - if chunks
@@ -1563,17 +1564,22 @@ static int sync_request(mddev_t *mddev, sector_t sector_nr, int go_faster)
1563 } 1564 }
1564 } 1565 }
1565 1566
1567 if (sectors_skipped)
1568 /* pretend they weren't skipped, it makes
1569 * no important difference in this case
1570 */
1571 md_done_sync(mddev, sectors_skipped, 1);
1572
1566 return sectors_skipped + nr_sectors; 1573 return sectors_skipped + nr_sectors;
1567 giveup: 1574 giveup:
1568 /* There is nowhere to write, so all non-sync 1575 /* There is nowhere to write, so all non-sync
1569 * drives must be failed, so try the next chunk... 1576 * drives must be failed, so try the next chunk...
1570 */ 1577 */
1571 { 1578 {
1572 int sec = max_sector - sector_nr; 1579 sector_t sec = max_sector - sector_nr;
1573 sectors_skipped += sec; 1580 sectors_skipped += sec;
1574 chunks_skipped ++; 1581 chunks_skipped ++;
1575 sector_nr = max_sector; 1582 sector_nr = max_sector;
1576 md_done_sync(mddev, sec, 1);
1577 goto skipped; 1583 goto skipped;
1578 } 1584 }
1579} 1585}
@@ -1731,8 +1737,7 @@ static int run(mddev_t *mddev)
1731out_free_conf: 1737out_free_conf:
1732 if (conf->r10bio_pool) 1738 if (conf->r10bio_pool)
1733 mempool_destroy(conf->r10bio_pool); 1739 mempool_destroy(conf->r10bio_pool);
1734 if (conf->mirrors) 1740 kfree(conf->mirrors);
1735 kfree(conf->mirrors);
1736 kfree(conf); 1741 kfree(conf);
1737 mddev->private = NULL; 1742 mddev->private = NULL;
1738out: 1743out:
@@ -1748,8 +1753,7 @@ static int stop(mddev_t *mddev)
1748 blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/ 1753 blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/
1749 if (conf->r10bio_pool) 1754 if (conf->r10bio_pool)
1750 mempool_destroy(conf->r10bio_pool); 1755 mempool_destroy(conf->r10bio_pool);
1751 if (conf->mirrors) 1756 kfree(conf->mirrors);
1752 kfree(conf->mirrors);
1753 kfree(conf); 1757 kfree(conf);
1754 mddev->private = NULL; 1758 mddev->private = NULL;
1755 return 0; 1759 return 0;
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 3cb11ac232fa..93a9726cc2d6 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -1411,6 +1411,8 @@ static int make_request (request_queue_t *q, struct bio * bi)
1411 sector_t logical_sector, last_sector; 1411 sector_t logical_sector, last_sector;
1412 struct stripe_head *sh; 1412 struct stripe_head *sh;
1413 1413
1414 md_write_start(mddev, bi);
1415
1414 if (bio_data_dir(bi)==WRITE) { 1416 if (bio_data_dir(bi)==WRITE) {
1415 disk_stat_inc(mddev->gendisk, writes); 1417 disk_stat_inc(mddev->gendisk, writes);
1416 disk_stat_add(mddev->gendisk, write_sectors, bio_sectors(bi)); 1418 disk_stat_add(mddev->gendisk, write_sectors, bio_sectors(bi));
@@ -1423,8 +1425,7 @@ static int make_request (request_queue_t *q, struct bio * bi)
1423 last_sector = bi->bi_sector + (bi->bi_size>>9); 1425 last_sector = bi->bi_sector + (bi->bi_size>>9);
1424 bi->bi_next = NULL; 1426 bi->bi_next = NULL;
1425 bi->bi_phys_segments = 1; /* over-loaded to count active stripes */ 1427 bi->bi_phys_segments = 1; /* over-loaded to count active stripes */
1426 if ( bio_data_dir(bi) == WRITE ) 1428
1427 md_write_start(mddev);
1428 for (;logical_sector < last_sector; logical_sector += STRIPE_SECTORS) { 1429 for (;logical_sector < last_sector; logical_sector += STRIPE_SECTORS) {
1429 DEFINE_WAIT(w); 1430 DEFINE_WAIT(w);
1430 1431
@@ -1475,7 +1476,7 @@ static int make_request (request_queue_t *q, struct bio * bi)
1475} 1476}
1476 1477
1477/* FIXME go_faster isn't used */ 1478/* FIXME go_faster isn't used */
1478static int sync_request (mddev_t *mddev, sector_t sector_nr, int go_faster) 1479static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, int go_faster)
1479{ 1480{
1480 raid5_conf_t *conf = (raid5_conf_t *) mddev->private; 1481 raid5_conf_t *conf = (raid5_conf_t *) mddev->private;
1481 struct stripe_head *sh; 1482 struct stripe_head *sh;
@@ -1498,8 +1499,8 @@ static int sync_request (mddev_t *mddev, sector_t sector_nr, int go_faster)
1498 * nothing we can do. 1499 * nothing we can do.
1499 */ 1500 */
1500 if (mddev->degraded >= 1 && test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) { 1501 if (mddev->degraded >= 1 && test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) {
1501 int rv = (mddev->size << 1) - sector_nr; 1502 sector_t rv = (mddev->size << 1) - sector_nr;
1502 md_done_sync(mddev, rv, 1); 1503 *skipped = 1;
1503 return rv; 1504 return rv;
1504 } 1505 }
1505 1506
@@ -1546,7 +1547,6 @@ static void raid5d (mddev_t *mddev)
1546 PRINTK("+++ raid5d active\n"); 1547 PRINTK("+++ raid5d active\n");
1547 1548
1548 md_check_recovery(mddev); 1549 md_check_recovery(mddev);
1549 md_handle_safemode(mddev);
1550 1550
1551 handled = 0; 1551 handled = 0;
1552 spin_lock_irq(&conf->device_lock); 1552 spin_lock_irq(&conf->device_lock);
diff --git a/drivers/md/raid6main.c b/drivers/md/raid6main.c
index 908edd78a792..f62ea1a73d0d 100644
--- a/drivers/md/raid6main.c
+++ b/drivers/md/raid6main.c
@@ -1570,6 +1570,8 @@ static int make_request (request_queue_t *q, struct bio * bi)
1570 sector_t logical_sector, last_sector; 1570 sector_t logical_sector, last_sector;
1571 struct stripe_head *sh; 1571 struct stripe_head *sh;
1572 1572
1573 md_write_start(mddev, bi);
1574
1573 if (bio_data_dir(bi)==WRITE) { 1575 if (bio_data_dir(bi)==WRITE) {
1574 disk_stat_inc(mddev->gendisk, writes); 1576 disk_stat_inc(mddev->gendisk, writes);
1575 disk_stat_add(mddev->gendisk, write_sectors, bio_sectors(bi)); 1577 disk_stat_add(mddev->gendisk, write_sectors, bio_sectors(bi));
@@ -1583,8 +1585,7 @@ static int make_request (request_queue_t *q, struct bio * bi)
1583 1585
1584 bi->bi_next = NULL; 1586 bi->bi_next = NULL;
1585 bi->bi_phys_segments = 1; /* over-loaded to count active stripes */ 1587 bi->bi_phys_segments = 1; /* over-loaded to count active stripes */
1586 if ( bio_data_dir(bi) == WRITE ) 1588
1587 md_write_start(mddev);
1588 for (;logical_sector < last_sector; logical_sector += STRIPE_SECTORS) { 1589 for (;logical_sector < last_sector; logical_sector += STRIPE_SECTORS) {
1589 DEFINE_WAIT(w); 1590 DEFINE_WAIT(w);
1590 1591
@@ -1634,7 +1635,7 @@ static int make_request (request_queue_t *q, struct bio * bi)
1634} 1635}
1635 1636
1636/* FIXME go_faster isn't used */ 1637/* FIXME go_faster isn't used */
1637static int sync_request (mddev_t *mddev, sector_t sector_nr, int go_faster) 1638static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, int go_faster)
1638{ 1639{
1639 raid6_conf_t *conf = (raid6_conf_t *) mddev->private; 1640 raid6_conf_t *conf = (raid6_conf_t *) mddev->private;
1640 struct stripe_head *sh; 1641 struct stripe_head *sh;
@@ -1657,8 +1658,8 @@ static int sync_request (mddev_t *mddev, sector_t sector_nr, int go_faster)
1657 * nothing we can do. 1658 * nothing we can do.
1658 */ 1659 */
1659 if (mddev->degraded >= 2 && test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) { 1660 if (mddev->degraded >= 2 && test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) {
1660 int rv = (mddev->size << 1) - sector_nr; 1661 sector_t rv = (mddev->size << 1) - sector_nr;
1661 md_done_sync(mddev, rv, 1); 1662 *skipped = 1;
1662 return rv; 1663 return rv;
1663 } 1664 }
1664 1665
@@ -1705,7 +1706,6 @@ static void raid6d (mddev_t *mddev)
1705 PRINTK("+++ raid6d active\n"); 1706 PRINTK("+++ raid6d active\n");
1706 1707
1707 md_check_recovery(mddev); 1708 md_check_recovery(mddev);
1708 md_handle_safemode(mddev);
1709 1709
1710 handled = 0; 1710 handled = 0;
1711 spin_lock_irq(&conf->device_lock); 1711 spin_lock_irq(&conf->device_lock);
diff --git a/drivers/misc/ibmasm/command.c b/drivers/misc/ibmasm/command.c
index 245b0058381d..07a085ccbd5b 100644
--- a/drivers/misc/ibmasm/command.c
+++ b/drivers/misc/ibmasm/command.c
@@ -23,6 +23,7 @@
23 */ 23 */
24 24
25#include "ibmasm.h" 25#include "ibmasm.h"
26#include "lowlevel.h"
26 27
27static void exec_next_command(struct service_processor *sp); 28static void exec_next_command(struct service_processor *sp);
28static void free_command(struct kobject *kobj); 29static void free_command(struct kobject *kobj);
@@ -31,8 +32,9 @@ static struct kobj_type ibmasm_cmd_kobj_type = {
31 .release = free_command, 32 .release = free_command,
32}; 33};
33 34
35static atomic_t command_count = ATOMIC_INIT(0);
34 36
35struct command *ibmasm_new_command(size_t buffer_size) 37struct command *ibmasm_new_command(struct service_processor *sp, size_t buffer_size)
36{ 38{
37 struct command *cmd; 39 struct command *cmd;
38 40
@@ -55,11 +57,15 @@ struct command *ibmasm_new_command(size_t buffer_size)
55 57
56 kobject_init(&cmd->kobj); 58 kobject_init(&cmd->kobj);
57 cmd->kobj.ktype = &ibmasm_cmd_kobj_type; 59 cmd->kobj.ktype = &ibmasm_cmd_kobj_type;
60 cmd->lock = &sp->lock;
58 61
59 cmd->status = IBMASM_CMD_PENDING; 62 cmd->status = IBMASM_CMD_PENDING;
60 init_waitqueue_head(&cmd->wait); 63 init_waitqueue_head(&cmd->wait);
61 INIT_LIST_HEAD(&cmd->queue_node); 64 INIT_LIST_HEAD(&cmd->queue_node);
62 65
66 atomic_inc(&command_count);
67 dbg("command count: %d\n", atomic_read(&command_count));
68
63 return cmd; 69 return cmd;
64} 70}
65 71
@@ -68,6 +74,8 @@ static void free_command(struct kobject *kobj)
68 struct command *cmd = to_command(kobj); 74 struct command *cmd = to_command(kobj);
69 75
70 list_del(&cmd->queue_node); 76 list_del(&cmd->queue_node);
77 atomic_dec(&command_count);
78 dbg("command count: %d\n", atomic_read(&command_count));
71 kfree(cmd->buffer); 79 kfree(cmd->buffer);
72 kfree(cmd); 80 kfree(cmd);
73} 81}
@@ -94,8 +102,14 @@ static struct command *dequeue_command(struct service_processor *sp)
94 102
95static inline void do_exec_command(struct service_processor *sp) 103static inline void do_exec_command(struct service_processor *sp)
96{ 104{
105 char tsbuf[32];
106
107 dbg("%s:%d at %s\n", __FUNCTION__, __LINE__, get_timestamp(tsbuf));
108
97 if (ibmasm_send_i2o_message(sp)) { 109 if (ibmasm_send_i2o_message(sp)) {
98 sp->current_command->status = IBMASM_CMD_FAILED; 110 sp->current_command->status = IBMASM_CMD_FAILED;
111 wake_up(&sp->current_command->wait);
112 command_put(sp->current_command);
99 exec_next_command(sp); 113 exec_next_command(sp);
100 } 114 }
101} 115}
@@ -111,14 +125,16 @@ static inline void do_exec_command(struct service_processor *sp)
111void ibmasm_exec_command(struct service_processor *sp, struct command *cmd) 125void ibmasm_exec_command(struct service_processor *sp, struct command *cmd)
112{ 126{
113 unsigned long flags; 127 unsigned long flags;
128 char tsbuf[32];
129
130 dbg("%s:%d at %s\n", __FUNCTION__, __LINE__, get_timestamp(tsbuf));
114 131
115 spin_lock_irqsave(&sp->lock, flags); 132 spin_lock_irqsave(&sp->lock, flags);
116 133
117 if (!sp->current_command) { 134 if (!sp->current_command) {
118 command_get(cmd);
119 sp->current_command = cmd; 135 sp->current_command = cmd;
136 command_get(sp->current_command);
120 spin_unlock_irqrestore(&sp->lock, flags); 137 spin_unlock_irqrestore(&sp->lock, flags);
121
122 do_exec_command(sp); 138 do_exec_command(sp);
123 } else { 139 } else {
124 enqueue_command(sp, cmd); 140 enqueue_command(sp, cmd);
@@ -129,9 +145,9 @@ void ibmasm_exec_command(struct service_processor *sp, struct command *cmd)
129static void exec_next_command(struct service_processor *sp) 145static void exec_next_command(struct service_processor *sp)
130{ 146{
131 unsigned long flags; 147 unsigned long flags;
148 char tsbuf[32];
132 149
133 wake_up(&sp->current_command->wait); 150 dbg("%s:%d at %s\n", __FUNCTION__, __LINE__, get_timestamp(tsbuf));
134 command_put(sp->current_command);
135 151
136 spin_lock_irqsave(&sp->lock, flags); 152 spin_lock_irqsave(&sp->lock, flags);
137 sp->current_command = dequeue_command(sp); 153 sp->current_command = dequeue_command(sp);
@@ -169,7 +185,9 @@ void ibmasm_receive_command_response(struct service_processor *sp, void *respons
169 if (!sp->current_command) 185 if (!sp->current_command)
170 return; 186 return;
171 187
172 memcpy(cmd->buffer, response, min(size, cmd->buffer_size)); 188 memcpy_fromio(cmd->buffer, response, min(size, cmd->buffer_size));
173 cmd->status = IBMASM_CMD_COMPLETE; 189 cmd->status = IBMASM_CMD_COMPLETE;
190 wake_up(&sp->current_command->wait);
191 command_put(sp->current_command);
174 exec_next_command(sp); 192 exec_next_command(sp);
175} 193}
diff --git a/drivers/misc/ibmasm/dot_command.c b/drivers/misc/ibmasm/dot_command.c
index 478a8d898fc1..13c52f866e2e 100644
--- a/drivers/misc/ibmasm/dot_command.c
+++ b/drivers/misc/ibmasm/dot_command.c
@@ -33,7 +33,13 @@ void ibmasm_receive_message(struct service_processor *sp, void *message, int mes
33 u32 size; 33 u32 size;
34 struct dot_command_header *header = (struct dot_command_header *)message; 34 struct dot_command_header *header = (struct dot_command_header *)message;
35 35
36 if (message_size == 0)
37 return;
38
36 size = get_dot_command_size(message); 39 size = get_dot_command_size(message);
40 if (size == 0)
41 return;
42
37 if (size > message_size) 43 if (size > message_size)
38 size = message_size; 44 size = message_size;
39 45
@@ -67,7 +73,7 @@ int ibmasm_send_driver_vpd(struct service_processor *sp)
67 u8 *vpd_data; 73 u8 *vpd_data;
68 int result = 0; 74 int result = 0;
69 75
70 command = ibmasm_new_command(INIT_BUFFER_SIZE); 76 command = ibmasm_new_command(sp, INIT_BUFFER_SIZE);
71 if (command == NULL) 77 if (command == NULL)
72 return -ENOMEM; 78 return -ENOMEM;
73 79
@@ -121,7 +127,7 @@ int ibmasm_send_os_state(struct service_processor *sp, int os_state)
121 struct os_state_command *os_state_cmd; 127 struct os_state_command *os_state_cmd;
122 int result = 0; 128 int result = 0;
123 129
124 cmd = ibmasm_new_command(sizeof(struct os_state_command)); 130 cmd = ibmasm_new_command(sp, sizeof(struct os_state_command));
125 if (cmd == NULL) 131 if (cmd == NULL)
126 return -ENOMEM; 132 return -ENOMEM;
127 133
diff --git a/drivers/misc/ibmasm/event.c b/drivers/misc/ibmasm/event.c
index e100f34f1587..fe1e819235a4 100644
--- a/drivers/misc/ibmasm/event.c
+++ b/drivers/misc/ibmasm/event.c
@@ -23,6 +23,7 @@
23 */ 23 */
24 24
25#include "ibmasm.h" 25#include "ibmasm.h"
26#include "lowlevel.h"
26 27
27/* 28/*
28 * ASM service processor event handling routines. 29 * ASM service processor event handling routines.
@@ -34,7 +35,6 @@
34 * circular buffer. 35 * circular buffer.
35 */ 36 */
36 37
37
38static void wake_up_event_readers(struct service_processor *sp) 38static void wake_up_event_readers(struct service_processor *sp)
39{ 39{
40 struct event_reader *reader; 40 struct event_reader *reader;
@@ -63,7 +63,7 @@ void ibmasm_receive_event(struct service_processor *sp, void *data, unsigned int
63 spin_lock_irqsave(&sp->lock, flags); 63 spin_lock_irqsave(&sp->lock, flags);
64 /* copy the event into the next slot in the circular buffer */ 64 /* copy the event into the next slot in the circular buffer */
65 event = &buffer->events[buffer->next_index]; 65 event = &buffer->events[buffer->next_index];
66 memcpy(event->data, data, data_size); 66 memcpy_fromio(event->data, data, data_size);
67 event->data_size = data_size; 67 event->data_size = data_size;
68 event->serial_number = buffer->next_serial_number; 68 event->serial_number = buffer->next_serial_number;
69 69
@@ -93,7 +93,10 @@ int ibmasm_get_next_event(struct service_processor *sp, struct event_reader *rea
93 unsigned int index; 93 unsigned int index;
94 unsigned long flags; 94 unsigned long flags;
95 95
96 if (wait_event_interruptible(reader->wait, event_available(buffer, reader))) 96 reader->cancelled = 0;
97
98 if (wait_event_interruptible(reader->wait,
99 event_available(buffer, reader) || reader->cancelled))
97 return -ERESTARTSYS; 100 return -ERESTARTSYS;
98 101
99 if (!event_available(buffer, reader)) 102 if (!event_available(buffer, reader))
@@ -116,6 +119,12 @@ int ibmasm_get_next_event(struct service_processor *sp, struct event_reader *rea
116 return event->data_size; 119 return event->data_size;
117} 120}
118 121
122void ibmasm_cancel_next_event(struct event_reader *reader)
123{
124 reader->cancelled = 1;
125 wake_up_interruptible(&reader->wait);
126}
127
119void ibmasm_event_reader_register(struct service_processor *sp, struct event_reader *reader) 128void ibmasm_event_reader_register(struct service_processor *sp, struct event_reader *reader)
120{ 129{
121 unsigned long flags; 130 unsigned long flags;
@@ -131,8 +140,6 @@ void ibmasm_event_reader_unregister(struct service_processor *sp, struct event_r
131{ 140{
132 unsigned long flags; 141 unsigned long flags;
133 142
134 wake_up_interruptible(&reader->wait);
135
136 spin_lock_irqsave(&sp->lock, flags); 143 spin_lock_irqsave(&sp->lock, flags);
137 list_del(&reader->node); 144 list_del(&reader->node);
138 spin_unlock_irqrestore(&sp->lock, flags); 145 spin_unlock_irqrestore(&sp->lock, flags);
@@ -164,6 +171,5 @@ int ibmasm_event_buffer_init(struct service_processor *sp)
164 171
165void ibmasm_event_buffer_exit(struct service_processor *sp) 172void ibmasm_event_buffer_exit(struct service_processor *sp)
166{ 173{
167 wake_up_event_readers(sp);
168 kfree(sp->event_buffer); 174 kfree(sp->event_buffer);
169} 175}
diff --git a/drivers/misc/ibmasm/heartbeat.c b/drivers/misc/ibmasm/heartbeat.c
index ce09309174d6..f295401fac21 100644
--- a/drivers/misc/ibmasm/heartbeat.c
+++ b/drivers/misc/ibmasm/heartbeat.c
@@ -25,6 +25,7 @@
25#include <linux/notifier.h> 25#include <linux/notifier.h>
26#include "ibmasm.h" 26#include "ibmasm.h"
27#include "dot_command.h" 27#include "dot_command.h"
28#include "lowlevel.h"
28 29
29static int suspend_heartbeats = 0; 30static int suspend_heartbeats = 0;
30 31
@@ -62,7 +63,7 @@ void ibmasm_unregister_panic_notifier(void)
62 63
63int ibmasm_heartbeat_init(struct service_processor *sp) 64int ibmasm_heartbeat_init(struct service_processor *sp)
64{ 65{
65 sp->heartbeat = ibmasm_new_command(HEARTBEAT_BUFFER_SIZE); 66 sp->heartbeat = ibmasm_new_command(sp, HEARTBEAT_BUFFER_SIZE);
66 if (sp->heartbeat == NULL) 67 if (sp->heartbeat == NULL)
67 return -ENOMEM; 68 return -ENOMEM;
68 69
@@ -71,6 +72,12 @@ int ibmasm_heartbeat_init(struct service_processor *sp)
71 72
72void ibmasm_heartbeat_exit(struct service_processor *sp) 73void ibmasm_heartbeat_exit(struct service_processor *sp)
73{ 74{
75 char tsbuf[32];
76
77 dbg("%s:%d at %s\n", __FUNCTION__, __LINE__, get_timestamp(tsbuf));
78 ibmasm_wait_for_response(sp->heartbeat, IBMASM_CMD_TIMEOUT_NORMAL);
79 dbg("%s:%d at %s\n", __FUNCTION__, __LINE__, get_timestamp(tsbuf));
80 suspend_heartbeats = 1;
74 command_put(sp->heartbeat); 81 command_put(sp->heartbeat);
75} 82}
76 83
@@ -78,14 +85,16 @@ void ibmasm_receive_heartbeat(struct service_processor *sp, void *message, size
78{ 85{
79 struct command *cmd = sp->heartbeat; 86 struct command *cmd = sp->heartbeat;
80 struct dot_command_header *header = (struct dot_command_header *)cmd->buffer; 87 struct dot_command_header *header = (struct dot_command_header *)cmd->buffer;
88 char tsbuf[32];
81 89
90 dbg("%s:%d at %s\n", __FUNCTION__, __LINE__, get_timestamp(tsbuf));
82 if (suspend_heartbeats) 91 if (suspend_heartbeats)
83 return; 92 return;
84 93
85 /* return the received dot command to sender */ 94 /* return the received dot command to sender */
86 cmd->status = IBMASM_CMD_PENDING; 95 cmd->status = IBMASM_CMD_PENDING;
87 size = min(size, cmd->buffer_size); 96 size = min(size, cmd->buffer_size);
88 memcpy(cmd->buffer, message, size); 97 memcpy_fromio(cmd->buffer, message, size);
89 header->type = sp_write; 98 header->type = sp_write;
90 ibmasm_exec_command(sp, cmd); 99 ibmasm_exec_command(sp, cmd);
91} 100}
diff --git a/drivers/misc/ibmasm/ibmasm.h b/drivers/misc/ibmasm/ibmasm.h
index 6fec7fd8cd1a..ecce4ffd3e23 100644
--- a/drivers/misc/ibmasm/ibmasm.h
+++ b/drivers/misc/ibmasm/ibmasm.h
@@ -34,16 +34,31 @@
34#include <linux/version.h> 34#include <linux/version.h>
35#include <linux/interrupt.h> 35#include <linux/interrupt.h>
36#include <linux/device.h> 36#include <linux/device.h>
37#include <linux/input.h>
37 38
38/* Driver identification */ 39/* Driver identification */
39#define DRIVER_NAME "ibmasm" 40#define DRIVER_NAME "ibmasm"
40#define DRIVER_VERSION "0.4" 41#define DRIVER_VERSION "1.0"
41#define DRIVER_AUTHOR "Max Asbock" 42#define DRIVER_AUTHOR "Max Asbock <masbock@us.ibm.com>, Vernon Mauery <vernux@us.ibm.com>"
42#define DRIVER_DESC "IBM ASM Service Processor Driver" 43#define DRIVER_DESC "IBM ASM Service Processor Driver"
43 44
44#define err(msg) printk(KERN_ERR "%s: " msg "\n", DRIVER_NAME) 45#define err(msg) printk(KERN_ERR "%s: " msg "\n", DRIVER_NAME)
45#define info(msg) printk(KERN_INFO "%s: " msg "\n", DRIVER_NAME) 46#define info(msg) printk(KERN_INFO "%s: " msg "\n", DRIVER_NAME)
46 47
48extern int ibmasm_debug;
49#define dbg(STR, ARGS...) \
50 do { \
51 if (ibmasm_debug) \
52 printk(KERN_DEBUG STR , ##ARGS); \
53 } while (0)
54
55static inline char *get_timestamp(char *buf)
56{
57 struct timeval now;
58 do_gettimeofday(&now);
59 sprintf(buf, "%lu.%lu", now.tv_sec, now.tv_usec);
60 return buf;
61}
47 62
48#define IBMASM_CMD_PENDING 0 63#define IBMASM_CMD_PENDING 0
49#define IBMASM_CMD_COMPLETE 1 64#define IBMASM_CMD_COMPLETE 1
@@ -52,7 +67,7 @@
52#define IBMASM_CMD_TIMEOUT_NORMAL 45 67#define IBMASM_CMD_TIMEOUT_NORMAL 45
53#define IBMASM_CMD_TIMEOUT_EXTRA 240 68#define IBMASM_CMD_TIMEOUT_EXTRA 240
54 69
55#define IBMASM_CMD_MAX_BUFFER_SIZE 0x4000 70#define IBMASM_CMD_MAX_BUFFER_SIZE 0x8000
56 71
57#define REVERSE_HEARTBEAT_TIMEOUT 120 72#define REVERSE_HEARTBEAT_TIMEOUT 120
58 73
@@ -80,12 +95,17 @@ struct command {
80 size_t buffer_size; 95 size_t buffer_size;
81 int status; 96 int status;
82 struct kobject kobj; 97 struct kobject kobj;
98 spinlock_t *lock;
83}; 99};
84#define to_command(c) container_of(c, struct command, kobj) 100#define to_command(c) container_of(c, struct command, kobj)
85 101
86static inline void command_put(struct command *cmd) 102static inline void command_put(struct command *cmd)
87{ 103{
104 unsigned long flags;
105
106 spin_lock_irqsave(cmd->lock, flags);
88 kobject_put(&cmd->kobj); 107 kobject_put(&cmd->kobj);
108 spin_unlock_irqrestore(cmd->lock, flags);
89} 109}
90 110
91static inline void command_get(struct command *cmd) 111static inline void command_get(struct command *cmd)
@@ -108,6 +128,7 @@ struct event_buffer {
108}; 128};
109 129
110struct event_reader { 130struct event_reader {
131 int cancelled;
111 unsigned int next_serial_number; 132 unsigned int next_serial_number;
112 wait_queue_head_t wait; 133 wait_queue_head_t wait;
113 struct list_head node; 134 struct list_head node;
@@ -120,41 +141,11 @@ struct reverse_heartbeat {
120 unsigned int stopped; 141 unsigned int stopped;
121}; 142};
122 143
123 144struct ibmasm_remote {
124/* remote console events */ 145 struct input_dev keybd_dev;
125struct mouse_event { 146 struct input_dev mouse_dev;
126 long x;
127 long y;
128 unsigned char buttons;
129 unsigned char transitions;
130};
131
132struct keyboard_event {
133 unsigned long key_code;
134 unsigned char key_down;
135}; 147};
136 148
137struct remote_event {
138 unsigned long type;
139 union {
140 struct mouse_event mouse;
141 struct keyboard_event keyboard;
142 } data;
143};
144
145#define DRIVER_REMOTE_QUEUE_SIZE 240
146
147struct remote_queue {
148 struct remote_event *start;
149 struct remote_event *end;
150 struct remote_event *reader;
151 struct remote_event *writer;
152 unsigned int size;
153 int open;
154 wait_queue_head_t wait;
155};
156
157
158struct service_processor { 149struct service_processor {
159 struct list_head node; 150 struct list_head node;
160 spinlock_t lock; 151 spinlock_t lock;
@@ -167,13 +158,13 @@ struct service_processor {
167 char dirname[IBMASM_NAME_SIZE]; 158 char dirname[IBMASM_NAME_SIZE];
168 char devname[IBMASM_NAME_SIZE]; 159 char devname[IBMASM_NAME_SIZE];
169 unsigned int number; 160 unsigned int number;
170 struct remote_queue remote_queue; 161 struct ibmasm_remote *remote;
171 int serial_line; 162 int serial_line;
172 struct device *dev; 163 struct device *dev;
173}; 164};
174 165
175/* command processing */ 166/* command processing */
176extern struct command *ibmasm_new_command(size_t buffer_size); 167extern struct command *ibmasm_new_command(struct service_processor *sp, size_t buffer_size);
177extern void ibmasm_exec_command(struct service_processor *sp, struct command *cmd); 168extern void ibmasm_exec_command(struct service_processor *sp, struct command *cmd);
178extern void ibmasm_wait_for_response(struct command *cmd, int timeout); 169extern void ibmasm_wait_for_response(struct command *cmd, int timeout);
179extern void ibmasm_receive_command_response(struct service_processor *sp, void *response, size_t size); 170extern void ibmasm_receive_command_response(struct service_processor *sp, void *response, size_t size);
@@ -185,6 +176,7 @@ extern void ibmasm_receive_event(struct service_processor *sp, void *data, unsi
185extern void ibmasm_event_reader_register(struct service_processor *sp, struct event_reader *reader); 176extern void ibmasm_event_reader_register(struct service_processor *sp, struct event_reader *reader);
186extern void ibmasm_event_reader_unregister(struct service_processor *sp, struct event_reader *reader); 177extern void ibmasm_event_reader_unregister(struct service_processor *sp, struct event_reader *reader);
187extern int ibmasm_get_next_event(struct service_processor *sp, struct event_reader *reader); 178extern int ibmasm_get_next_event(struct service_processor *sp, struct event_reader *reader);
179extern void ibmasm_cancel_next_event(struct event_reader *reader);
188 180
189/* heartbeat - from SP to OS */ 181/* heartbeat - from SP to OS */
190extern void ibmasm_register_panic_notifier(void); 182extern void ibmasm_register_panic_notifier(void);
@@ -208,11 +200,9 @@ extern int ibmasm_send_i2o_message(struct service_processor *sp);
208extern irqreturn_t ibmasm_interrupt_handler(int irq, void * dev_id, struct pt_regs *regs); 200extern irqreturn_t ibmasm_interrupt_handler(int irq, void * dev_id, struct pt_regs *regs);
209 201
210/* remote console */ 202/* remote console */
211extern void ibmasm_handle_mouse_interrupt(struct service_processor *sp); 203extern void ibmasm_handle_mouse_interrupt(struct service_processor *sp, struct pt_regs *regs);
212extern int ibmasm_init_remote_queue(struct service_processor *sp); 204extern int ibmasm_init_remote_input_dev(struct service_processor *sp);
213extern void ibmasm_free_remote_queue(struct service_processor *sp); 205extern void ibmasm_free_remote_input_dev(struct service_processor *sp);
214extern void ibmasm_advance_reader(struct remote_queue *q, unsigned int n);
215extern size_t ibmasm_events_available(struct remote_queue *q);
216 206
217/* file system */ 207/* file system */
218extern int ibmasmfs_register(void); 208extern int ibmasmfs_register(void);
diff --git a/drivers/misc/ibmasm/ibmasmfs.c b/drivers/misc/ibmasm/ibmasmfs.c
index 866e867e68f2..5c550fcac2c4 100644
--- a/drivers/misc/ibmasm/ibmasmfs.c
+++ b/drivers/misc/ibmasm/ibmasmfs.c
@@ -37,9 +37,7 @@
37 * | |-- event 37 * | |-- event
38 * | |-- reverse_heartbeat 38 * | |-- reverse_heartbeat
39 * | `-- remote_video 39 * | `-- remote_video
40 * | |-- connected
41 * | |-- depth 40 * | |-- depth
42 * | |-- events
43 * | |-- height 41 * | |-- height
44 * | `-- width 42 * | `-- width
45 * . 43 * .
@@ -50,9 +48,7 @@
50 * |-- event 48 * |-- event
51 * |-- reverse_heartbeat 49 * |-- reverse_heartbeat
52 * `-- remote_video 50 * `-- remote_video
53 * |-- connected
54 * |-- depth 51 * |-- depth
55 * |-- events
56 * |-- height 52 * |-- height
57 * `-- width 53 * `-- width
58 * 54 *
@@ -75,14 +71,6 @@
75 * remote_video/width: control remote display settings 71 * remote_video/width: control remote display settings
76 * write: set value 72 * write: set value
77 * read: read value 73 * read: read value
78 *
79 * remote_video/connected
80 * read: return "1" if web browser VNC java applet is connected,
81 * "0" otherwise
82 *
83 * remote_video/events
84 * read: sleep until a remote mouse or keyboard event occurs, then return
85 * then event.
86 */ 74 */
87 75
88#include <linux/fs.h> 76#include <linux/fs.h>
@@ -333,7 +321,7 @@ static ssize_t command_file_write(struct file *file, const char __user *ubuff, s
333 if (command_data->command) 321 if (command_data->command)
334 return -EAGAIN; 322 return -EAGAIN;
335 323
336 cmd = ibmasm_new_command(count); 324 cmd = ibmasm_new_command(command_data->sp, count);
337 if (!cmd) 325 if (!cmd)
338 return -ENOMEM; 326 return -ENOMEM;
339 327
@@ -374,6 +362,7 @@ static int event_file_open(struct inode *inode, struct file *file)
374 ibmasm_event_reader_register(sp, &event_data->reader); 362 ibmasm_event_reader_register(sp, &event_data->reader);
375 363
376 event_data->sp = sp; 364 event_data->sp = sp;
365 event_data->active = 0;
377 file->private_data = event_data; 366 file->private_data = event_data;
378 return 0; 367 return 0;
379} 368}
@@ -391,7 +380,9 @@ static ssize_t event_file_read(struct file *file, char __user *buf, size_t count
391{ 380{
392 struct ibmasmfs_event_data *event_data = file->private_data; 381 struct ibmasmfs_event_data *event_data = file->private_data;
393 struct event_reader *reader = &event_data->reader; 382 struct event_reader *reader = &event_data->reader;
383 struct service_processor *sp = event_data->sp;
394 int ret; 384 int ret;
385 unsigned long flags;
395 386
396 if (*offset < 0) 387 if (*offset < 0)
397 return -EINVAL; 388 return -EINVAL;
@@ -400,17 +391,32 @@ static ssize_t event_file_read(struct file *file, char __user *buf, size_t count
400 if (*offset != 0) 391 if (*offset != 0)
401 return 0; 392 return 0;
402 393
403 ret = ibmasm_get_next_event(event_data->sp, reader); 394 spin_lock_irqsave(&sp->lock, flags);
395 if (event_data->active) {
396 spin_unlock_irqrestore(&sp->lock, flags);
397 return -EBUSY;
398 }
399 event_data->active = 1;
400 spin_unlock_irqrestore(&sp->lock, flags);
401
402 ret = ibmasm_get_next_event(sp, reader);
404 if (ret <= 0) 403 if (ret <= 0)
405 return ret; 404 goto out;
406 405
407 if (count < reader->data_size) 406 if (count < reader->data_size) {
408 return -EINVAL; 407 ret = -EINVAL;
408 goto out;
409 }
409 410
410 if (copy_to_user(buf, reader->data, reader->data_size)) 411 if (copy_to_user(buf, reader->data, reader->data_size)) {
411 return -EFAULT; 412 ret = -EFAULT;
413 goto out;
414 }
415 ret = reader->data_size;
412 416
413 return reader->data_size; 417out:
418 event_data->active = 0;
419 return ret;
414} 420}
415 421
416static ssize_t event_file_write(struct file *file, const char __user *buf, size_t count, loff_t *offset) 422static ssize_t event_file_write(struct file *file, const char __user *buf, size_t count, loff_t *offset)
@@ -424,7 +430,7 @@ static ssize_t event_file_write(struct file *file, const char __user *buf, size_
424 if (*offset != 0) 430 if (*offset != 0)
425 return 0; 431 return 0;
426 432
427 wake_up_interruptible(&event_data->reader.wait); 433 ibmasm_cancel_next_event(&event_data->reader);
428 return 0; 434 return 0;
429} 435}
430 436
@@ -575,75 +581,6 @@ static ssize_t remote_settings_file_write(struct file *file, const char __user *
575 return count; 581 return count;
576} 582}
577 583
578static int remote_event_file_open(struct inode *inode, struct file *file)
579{
580 struct service_processor *sp;
581 unsigned long flags;
582 struct remote_queue *q;
583
584 file->private_data = inode->u.generic_ip;
585 sp = file->private_data;
586 q = &sp->remote_queue;
587
588 /* allow only one event reader */
589 spin_lock_irqsave(&sp->lock, flags);
590 if (q->open) {
591 spin_unlock_irqrestore(&sp->lock, flags);
592 return -EBUSY;
593 }
594 q->open = 1;
595 spin_unlock_irqrestore(&sp->lock, flags);
596
597 enable_mouse_interrupts(sp);
598
599 return 0;
600}
601
602static int remote_event_file_close(struct inode *inode, struct file *file)
603{
604 struct service_processor *sp = file->private_data;
605
606 disable_mouse_interrupts(sp);
607 wake_up_interruptible(&sp->remote_queue.wait);
608 sp->remote_queue.open = 0;
609
610 return 0;
611}
612
613static ssize_t remote_event_file_read(struct file *file, char __user *buf, size_t count, loff_t *offset)
614{
615 struct service_processor *sp = file->private_data;
616 struct remote_queue *q = &sp->remote_queue;
617 size_t data_size;
618 struct remote_event *reader = q->reader;
619 size_t num_events;
620
621 if (*offset < 0)
622 return -EINVAL;
623 if (count == 0 || count > 1024)
624 return 0;
625 if (*offset != 0)
626 return 0;
627
628 if (wait_event_interruptible(q->wait, q->reader != q->writer))
629 return -ERESTARTSYS;
630
631 /* only get multiples of struct remote_event */
632 num_events = min((count/sizeof(struct remote_event)), ibmasm_events_available(q));
633 if (!num_events)
634 return 0;
635
636 data_size = num_events * sizeof(struct remote_event);
637
638 if (copy_to_user(buf, reader, data_size))
639 return -EFAULT;
640
641 ibmasm_advance_reader(q, num_events);
642
643 return data_size;
644}
645
646
647static struct file_operations command_fops = { 584static struct file_operations command_fops = {
648 .open = command_file_open, 585 .open = command_file_open,
649 .release = command_file_close, 586 .release = command_file_close,
@@ -672,12 +609,6 @@ static struct file_operations remote_settings_fops = {
672 .write = remote_settings_file_write, 609 .write = remote_settings_file_write,
673}; 610};
674 611
675static struct file_operations remote_event_fops = {
676 .open = remote_event_file_open,
677 .release = remote_event_file_close,
678 .read = remote_event_file_read,
679};
680
681 612
682static void ibmasmfs_create_files (struct super_block *sb, struct dentry *root) 613static void ibmasmfs_create_files (struct super_block *sb, struct dentry *root)
683{ 614{
@@ -703,7 +634,5 @@ static void ibmasmfs_create_files (struct super_block *sb, struct dentry *root)
703 ibmasmfs_create_file(sb, remote_dir, "width", &remote_settings_fops, (void *)display_width(sp), S_IRUSR|S_IWUSR); 634 ibmasmfs_create_file(sb, remote_dir, "width", &remote_settings_fops, (void *)display_width(sp), S_IRUSR|S_IWUSR);
704 ibmasmfs_create_file(sb, remote_dir, "height", &remote_settings_fops, (void *)display_height(sp), S_IRUSR|S_IWUSR); 635 ibmasmfs_create_file(sb, remote_dir, "height", &remote_settings_fops, (void *)display_height(sp), S_IRUSR|S_IWUSR);
705 ibmasmfs_create_file(sb, remote_dir, "depth", &remote_settings_fops, (void *)display_depth(sp), S_IRUSR|S_IWUSR); 636 ibmasmfs_create_file(sb, remote_dir, "depth", &remote_settings_fops, (void *)display_depth(sp), S_IRUSR|S_IWUSR);
706 ibmasmfs_create_file(sb, remote_dir, "connected", &remote_settings_fops, (void *)vnc_status(sp), S_IRUSR);
707 ibmasmfs_create_file(sb, remote_dir, "events", &remote_event_fops, (void *)sp, S_IRUSR);
708 } 637 }
709} 638}
diff --git a/drivers/misc/ibmasm/lowlevel.c b/drivers/misc/ibmasm/lowlevel.c
index 5156de2759d8..47949a2c7e94 100644
--- a/drivers/misc/ibmasm/lowlevel.c
+++ b/drivers/misc/ibmasm/lowlevel.c
@@ -46,8 +46,8 @@ int ibmasm_send_i2o_message(struct service_processor *sp)
46 46
47 message = get_i2o_message(sp->base_address, mfa); 47 message = get_i2o_message(sp->base_address, mfa);
48 48
49 memcpy(&message->header, &header, sizeof(struct i2o_header)); 49 memcpy_toio(&message->header, &header, sizeof(struct i2o_header));
50 memcpy(&message->data, command->buffer, command_size); 50 memcpy_toio(&message->data, command->buffer, command_size);
51 51
52 set_mfa_inbound(sp->base_address, mfa); 52 set_mfa_inbound(sp->base_address, mfa);
53 53
@@ -59,23 +59,27 @@ irqreturn_t ibmasm_interrupt_handler(int irq, void * dev_id, struct pt_regs *reg
59 u32 mfa; 59 u32 mfa;
60 struct service_processor *sp = (struct service_processor *)dev_id; 60 struct service_processor *sp = (struct service_processor *)dev_id;
61 void __iomem *base_address = sp->base_address; 61 void __iomem *base_address = sp->base_address;
62 char tsbuf[32];
62 63
63 if (!sp_interrupt_pending(base_address)) 64 if (!sp_interrupt_pending(base_address))
64 return IRQ_NONE; 65 return IRQ_NONE;
65 66
67 dbg("respond to interrupt at %s\n", get_timestamp(tsbuf));
68
66 if (mouse_interrupt_pending(sp)) { 69 if (mouse_interrupt_pending(sp)) {
67 ibmasm_handle_mouse_interrupt(sp); 70 ibmasm_handle_mouse_interrupt(sp, regs);
68 mfa = get_mfa_outbound(base_address);
69 clear_mouse_interrupt(sp); 71 clear_mouse_interrupt(sp);
70 set_mfa_outbound(base_address, mfa);
71 return IRQ_HANDLED;
72 } 72 }
73 73
74 mfa = get_mfa_outbound(base_address); 74 mfa = get_mfa_outbound(base_address);
75 if (valid_mfa(mfa)) { 75 if (valid_mfa(mfa)) {
76 struct i2o_message *msg = get_i2o_message(base_address, mfa); 76 struct i2o_message *msg = get_i2o_message(base_address, mfa);
77 ibmasm_receive_message(sp, &msg->data, incoming_data_size(msg)); 77 ibmasm_receive_message(sp, &msg->data, incoming_data_size(msg));
78 } 78 } else
79 dbg("didn't get a valid MFA\n");
80
79 set_mfa_outbound(base_address, mfa); 81 set_mfa_outbound(base_address, mfa);
82 dbg("finished interrupt at %s\n", get_timestamp(tsbuf));
83
80 return IRQ_HANDLED; 84 return IRQ_HANDLED;
81} 85}
diff --git a/drivers/misc/ibmasm/module.c b/drivers/misc/ibmasm/module.c
index 777432ae764a..1fdf03fd2da7 100644
--- a/drivers/misc/ibmasm/module.c
+++ b/drivers/misc/ibmasm/module.c
@@ -56,17 +56,26 @@
56#include "lowlevel.h" 56#include "lowlevel.h"
57#include "remote.h" 57#include "remote.h"
58 58
59int ibmasm_debug = 0;
60module_param(ibmasm_debug, int , S_IRUGO | S_IWUSR);
61MODULE_PARM_DESC(ibmasm_debug, " Set debug mode on or off");
62
59 63
60static int __devinit ibmasm_init_one(struct pci_dev *pdev, const struct pci_device_id *id) 64static int __devinit ibmasm_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
61{ 65{
62 int err, result = -ENOMEM; 66 int result;
63 struct service_processor *sp; 67 struct service_processor *sp;
64 68
65 if ((err = pci_enable_device(pdev))) { 69 if ((result = pci_enable_device(pdev))) {
66 printk(KERN_ERR "%s: can't enable PCI device at %s\n", 70 dev_err(&pdev->dev, "Failed to enable PCI device\n");
67 DRIVER_NAME, pci_name(pdev)); 71 return result;
68 return err;
69 } 72 }
73 if ((result = pci_request_regions(pdev, DRIVER_NAME))) {
74 dev_err(&pdev->dev, "Failed to allocate PCI resources\n");
75 goto error_resources;
76 }
77 /* vnc client won't work without bus-mastering */
78 pci_set_master(pdev);
70 79
71 sp = kmalloc(sizeof(struct service_processor), GFP_KERNEL); 80 sp = kmalloc(sizeof(struct service_processor), GFP_KERNEL);
72 if (sp == NULL) { 81 if (sp == NULL) {
@@ -76,6 +85,9 @@ static int __devinit ibmasm_init_one(struct pci_dev *pdev, const struct pci_devi
76 } 85 }
77 memset(sp, 0, sizeof(struct service_processor)); 86 memset(sp, 0, sizeof(struct service_processor));
78 87
88 sp->lock = SPIN_LOCK_UNLOCKED;
89 INIT_LIST_HEAD(&sp->command_queue);
90
79 pci_set_drvdata(pdev, (void *)sp); 91 pci_set_drvdata(pdev, (void *)sp);
80 sp->dev = &pdev->dev; 92 sp->dev = &pdev->dev;
81 sp->number = pdev->bus->number; 93 sp->number = pdev->bus->number;
@@ -101,15 +113,6 @@ static int __devinit ibmasm_init_one(struct pci_dev *pdev, const struct pci_devi
101 goto error_ioremap; 113 goto error_ioremap;
102 } 114 }
103 115
104 result = ibmasm_init_remote_queue(sp);
105 if (result) {
106 dev_err(sp->dev, "Failed to initialize remote queue\n");
107 goto error_remote_queue;
108 }
109
110 spin_lock_init(&sp->lock);
111 INIT_LIST_HEAD(&sp->command_queue);
112
113 result = request_irq(sp->irq, ibmasm_interrupt_handler, SA_SHIRQ, sp->devname, (void*)sp); 116 result = request_irq(sp->irq, ibmasm_interrupt_handler, SA_SHIRQ, sp->devname, (void*)sp);
114 if (result) { 117 if (result) {
115 dev_err(sp->dev, "Failed to register interrupt handler\n"); 118 dev_err(sp->dev, "Failed to register interrupt handler\n");
@@ -117,7 +120,12 @@ static int __devinit ibmasm_init_one(struct pci_dev *pdev, const struct pci_devi
117 } 120 }
118 121
119 enable_sp_interrupts(sp->base_address); 122 enable_sp_interrupts(sp->base_address);
120 disable_mouse_interrupts(sp); 123
124 result = ibmasm_init_remote_input_dev(sp);
125 if (result) {
126 dev_err(sp->dev, "Failed to initialize remote queue\n");
127 goto error_send_message;
128 }
121 129
122 result = ibmasm_send_driver_vpd(sp); 130 result = ibmasm_send_driver_vpd(sp);
123 if (result) { 131 if (result) {
@@ -133,30 +141,25 @@ static int __devinit ibmasm_init_one(struct pci_dev *pdev, const struct pci_devi
133 141
134 ibmasm_register_uart(sp); 142 ibmasm_register_uart(sp);
135 143
136 dev_printk(KERN_DEBUG, &pdev->dev, "WARNING: This software may not be supported or function\n");
137 dev_printk(KERN_DEBUG, &pdev->dev, "correctly on your IBM server. Please consult the IBM\n");
138 dev_printk(KERN_DEBUG, &pdev->dev, "ServerProven website\n");
139 dev_printk(KERN_DEBUG, &pdev->dev, "http://www.pc.ibm.com/ww/eserver/xseries/serverproven\n");
140 dev_printk(KERN_DEBUG, &pdev->dev, "for information on the specific driver level and support\n");
141 dev_printk(KERN_DEBUG, &pdev->dev, "statement for your IBM server.\n");
142
143 return 0; 144 return 0;
144 145
145error_send_message: 146error_send_message:
146 disable_sp_interrupts(sp->base_address); 147 disable_sp_interrupts(sp->base_address);
148 ibmasm_free_remote_input_dev(sp);
147 free_irq(sp->irq, (void *)sp); 149 free_irq(sp->irq, (void *)sp);
148error_request_irq: 150error_request_irq:
149 ibmasm_free_remote_queue(sp);
150error_remote_queue:
151 iounmap(sp->base_address); 151 iounmap(sp->base_address);
152error_ioremap: 152error_ioremap:
153 ibmasm_heartbeat_exit(sp); 153 ibmasm_heartbeat_exit(sp);
154error_heartbeat: 154error_heartbeat:
155 ibmasm_event_buffer_exit(sp); 155 ibmasm_event_buffer_exit(sp);
156error_eventbuffer: 156error_eventbuffer:
157 pci_set_drvdata(pdev, NULL);
157 kfree(sp); 158 kfree(sp);
158error_kmalloc: 159error_kmalloc:
159 pci_disable_device(pdev); 160 pci_release_regions(pdev);
161error_resources:
162 pci_disable_device(pdev);
160 163
161 return result; 164 return result;
162} 165}
@@ -165,16 +168,24 @@ static void __devexit ibmasm_remove_one(struct pci_dev *pdev)
165{ 168{
166 struct service_processor *sp = (struct service_processor *)pci_get_drvdata(pdev); 169 struct service_processor *sp = (struct service_processor *)pci_get_drvdata(pdev);
167 170
171 dbg("Unregistering UART\n");
168 ibmasm_unregister_uart(sp); 172 ibmasm_unregister_uart(sp);
169 ibmasm_send_os_state(sp, SYSTEM_STATE_OS_DOWN); 173 dbg("Sending OS down message\n");
174 if (ibmasm_send_os_state(sp, SYSTEM_STATE_OS_DOWN))
175 err("failed to get repsonse to 'Send OS State' command\n");
176 dbg("Disabling heartbeats\n");
177 ibmasm_heartbeat_exit(sp);
178 dbg("Disabling interrupts\n");
170 disable_sp_interrupts(sp->base_address); 179 disable_sp_interrupts(sp->base_address);
171 disable_mouse_interrupts(sp); 180 dbg("Freeing SP irq\n");
172 free_irq(sp->irq, (void *)sp); 181 free_irq(sp->irq, (void *)sp);
173 ibmasm_heartbeat_exit(sp); 182 dbg("Cleaning up\n");
174 ibmasm_free_remote_queue(sp); 183 ibmasm_free_remote_input_dev(sp);
175 iounmap(sp->base_address); 184 iounmap(sp->base_address);
176 ibmasm_event_buffer_exit(sp); 185 ibmasm_event_buffer_exit(sp);
186 pci_set_drvdata(pdev, NULL);
177 kfree(sp); 187 kfree(sp);
188 pci_release_regions(pdev);
178 pci_disable_device(pdev); 189 pci_disable_device(pdev);
179} 190}
180 191
diff --git a/drivers/misc/ibmasm/r_heartbeat.c b/drivers/misc/ibmasm/r_heartbeat.c
index 93d9c1b2ad6f..f8fdb2d5417e 100644
--- a/drivers/misc/ibmasm/r_heartbeat.c
+++ b/drivers/misc/ibmasm/r_heartbeat.c
@@ -63,7 +63,7 @@ int ibmasm_start_reverse_heartbeat(struct service_processor *sp, struct reverse_
63 int times_failed = 0; 63 int times_failed = 0;
64 int result = 1; 64 int result = 1;
65 65
66 cmd = ibmasm_new_command(sizeof rhb_dot_cmd); 66 cmd = ibmasm_new_command(sp, sizeof rhb_dot_cmd);
67 if (!cmd) 67 if (!cmd)
68 return -ENOMEM; 68 return -ENOMEM;
69 69
diff --git a/drivers/misc/ibmasm/remote.c b/drivers/misc/ibmasm/remote.c
index 520c3f10c271..d3c48d23ee51 100644
--- a/drivers/misc/ibmasm/remote.c
+++ b/drivers/misc/ibmasm/remote.c
@@ -1,4 +1,3 @@
1
2/* 1/*
3 * IBM ASM Service Processor Device Driver 2 * IBM ASM Service Processor Device Driver
4 * 3 *
@@ -18,135 +17,256 @@
18 * 17 *
19 * Copyright (C) IBM Corporation, 2004 18 * Copyright (C) IBM Corporation, 2004
20 * 19 *
21 * Author: Max Asböck <amax@us.ibm.com> 20 * Authors: Max Asböck <amax@us.ibm.com>
21 * Vernon Mauery <vernux@us.ibm.com>
22 * 22 *
23 */ 23 */
24 24
25/* Remote mouse and keyboard event handling functions */ 25/* Remote mouse and keyboard event handling functions */
26 26
27#include <linux/pci.h>
27#include "ibmasm.h" 28#include "ibmasm.h"
28#include "remote.h" 29#include "remote.h"
29 30
30int ibmasm_init_remote_queue(struct service_processor *sp) 31static int xmax = 1600;
31{ 32static int ymax = 1200;
32 struct remote_queue *q = &sp->remote_queue;
33
34 disable_mouse_interrupts(sp);
35 33
36 q->open = 0;
37 q->size = 0;
38 34
39 q->start = kmalloc(DRIVER_REMOTE_QUEUE_SIZE * sizeof(struct remote_event), GFP_KERNEL); 35static unsigned short xlate_high[XLATE_SIZE] = {
40 if (q->start == 0) 36 [KEY_SYM_ENTER & 0xff] = KEY_ENTER,
41 return -ENOMEM; 37 [KEY_SYM_KPSLASH & 0xff] = KEY_KPSLASH,
38 [KEY_SYM_KPSTAR & 0xff] = KEY_KPASTERISK,
39 [KEY_SYM_KPMINUS & 0xff] = KEY_KPMINUS,
40 [KEY_SYM_KPDOT & 0xff] = KEY_KPDOT,
41 [KEY_SYM_KPPLUS & 0xff] = KEY_KPPLUS,
42 [KEY_SYM_KP0 & 0xff] = KEY_KP0,
43 [KEY_SYM_KP1 & 0xff] = KEY_KP1,
44 [KEY_SYM_KP2 & 0xff] = KEY_KP2, [KEY_SYM_KPDOWN & 0xff] = KEY_KP2,
45 [KEY_SYM_KP3 & 0xff] = KEY_KP3,
46 [KEY_SYM_KP4 & 0xff] = KEY_KP4, [KEY_SYM_KPLEFT & 0xff] = KEY_KP4,
47 [KEY_SYM_KP5 & 0xff] = KEY_KP5,
48 [KEY_SYM_KP6 & 0xff] = KEY_KP6, [KEY_SYM_KPRIGHT & 0xff] = KEY_KP6,
49 [KEY_SYM_KP7 & 0xff] = KEY_KP7,
50 [KEY_SYM_KP8 & 0xff] = KEY_KP8, [KEY_SYM_KPUP & 0xff] = KEY_KP8,
51 [KEY_SYM_KP9 & 0xff] = KEY_KP9,
52 [KEY_SYM_BK_SPC & 0xff] = KEY_BACKSPACE,
53 [KEY_SYM_TAB & 0xff] = KEY_TAB,
54 [KEY_SYM_CTRL & 0xff] = KEY_LEFTCTRL,
55 [KEY_SYM_ALT & 0xff] = KEY_LEFTALT,
56 [KEY_SYM_INSERT & 0xff] = KEY_INSERT,
57 [KEY_SYM_DELETE & 0xff] = KEY_DELETE,
58 [KEY_SYM_SHIFT & 0xff] = KEY_LEFTSHIFT,
59 [KEY_SYM_UARROW & 0xff] = KEY_UP,
60 [KEY_SYM_DARROW & 0xff] = KEY_DOWN,
61 [KEY_SYM_LARROW & 0xff] = KEY_LEFT,
62 [KEY_SYM_RARROW & 0xff] = KEY_RIGHT,
63 [KEY_SYM_ESCAPE & 0xff] = KEY_ESC,
64 [KEY_SYM_PAGEUP & 0xff] = KEY_PAGEUP,
65 [KEY_SYM_PAGEDOWN & 0xff] = KEY_PAGEDOWN,
66 [KEY_SYM_HOME & 0xff] = KEY_HOME,
67 [KEY_SYM_END & 0xff] = KEY_END,
68 [KEY_SYM_F1 & 0xff] = KEY_F1,
69 [KEY_SYM_F2 & 0xff] = KEY_F2,
70 [KEY_SYM_F3 & 0xff] = KEY_F3,
71 [KEY_SYM_F4 & 0xff] = KEY_F4,
72 [KEY_SYM_F5 & 0xff] = KEY_F5,
73 [KEY_SYM_F6 & 0xff] = KEY_F6,
74 [KEY_SYM_F7 & 0xff] = KEY_F7,
75 [KEY_SYM_F8 & 0xff] = KEY_F8,
76 [KEY_SYM_F9 & 0xff] = KEY_F9,
77 [KEY_SYM_F10 & 0xff] = KEY_F10,
78 [KEY_SYM_F11 & 0xff] = KEY_F11,
79 [KEY_SYM_F12 & 0xff] = KEY_F12,
80 [KEY_SYM_CAP_LOCK & 0xff] = KEY_CAPSLOCK,
81 [KEY_SYM_NUM_LOCK & 0xff] = KEY_NUMLOCK,
82 [KEY_SYM_SCR_LOCK & 0xff] = KEY_SCROLLLOCK,
83};
84static unsigned short xlate[XLATE_SIZE] = {
85 [NO_KEYCODE] = KEY_RESERVED,
86 [KEY_SYM_SPACE] = KEY_SPACE,
87 [KEY_SYM_TILDE] = KEY_GRAVE, [KEY_SYM_BKTIC] = KEY_GRAVE,
88 [KEY_SYM_ONE] = KEY_1, [KEY_SYM_BANG] = KEY_1,
89 [KEY_SYM_TWO] = KEY_2, [KEY_SYM_AT] = KEY_2,
90 [KEY_SYM_THREE] = KEY_3, [KEY_SYM_POUND] = KEY_3,
91 [KEY_SYM_FOUR] = KEY_4, [KEY_SYM_DOLLAR] = KEY_4,
92 [KEY_SYM_FIVE] = KEY_5, [KEY_SYM_PERCENT] = KEY_5,
93 [KEY_SYM_SIX] = KEY_6, [KEY_SYM_CARAT] = KEY_6,
94 [KEY_SYM_SEVEN] = KEY_7, [KEY_SYM_AMPER] = KEY_7,
95 [KEY_SYM_EIGHT] = KEY_8, [KEY_SYM_STAR] = KEY_8,
96 [KEY_SYM_NINE] = KEY_9, [KEY_SYM_LPAREN] = KEY_9,
97 [KEY_SYM_ZERO] = KEY_0, [KEY_SYM_RPAREN] = KEY_0,
98 [KEY_SYM_MINUS] = KEY_MINUS, [KEY_SYM_USCORE] = KEY_MINUS,
99 [KEY_SYM_EQUAL] = KEY_EQUAL, [KEY_SYM_PLUS] = KEY_EQUAL,
100 [KEY_SYM_LBRKT] = KEY_LEFTBRACE, [KEY_SYM_LCURLY] = KEY_LEFTBRACE,
101 [KEY_SYM_RBRKT] = KEY_RIGHTBRACE, [KEY_SYM_RCURLY] = KEY_RIGHTBRACE,
102 [KEY_SYM_SLASH] = KEY_BACKSLASH, [KEY_SYM_PIPE] = KEY_BACKSLASH,
103 [KEY_SYM_TIC] = KEY_APOSTROPHE, [KEY_SYM_QUOTE] = KEY_APOSTROPHE,
104 [KEY_SYM_SEMIC] = KEY_SEMICOLON, [KEY_SYM_COLON] = KEY_SEMICOLON,
105 [KEY_SYM_COMMA] = KEY_COMMA, [KEY_SYM_LT] = KEY_COMMA,
106 [KEY_SYM_PERIOD] = KEY_DOT, [KEY_SYM_GT] = KEY_DOT,
107 [KEY_SYM_BSLASH] = KEY_SLASH, [KEY_SYM_QMARK] = KEY_SLASH,
108 [KEY_SYM_A] = KEY_A, [KEY_SYM_a] = KEY_A,
109 [KEY_SYM_B] = KEY_B, [KEY_SYM_b] = KEY_B,
110 [KEY_SYM_C] = KEY_C, [KEY_SYM_c] = KEY_C,
111 [KEY_SYM_D] = KEY_D, [KEY_SYM_d] = KEY_D,
112 [KEY_SYM_E] = KEY_E, [KEY_SYM_e] = KEY_E,
113 [KEY_SYM_F] = KEY_F, [KEY_SYM_f] = KEY_F,
114 [KEY_SYM_G] = KEY_G, [KEY_SYM_g] = KEY_G,
115 [KEY_SYM_H] = KEY_H, [KEY_SYM_h] = KEY_H,
116 [KEY_SYM_I] = KEY_I, [KEY_SYM_i] = KEY_I,
117 [KEY_SYM_J] = KEY_J, [KEY_SYM_j] = KEY_J,
118 [KEY_SYM_K] = KEY_K, [KEY_SYM_k] = KEY_K,
119 [KEY_SYM_L] = KEY_L, [KEY_SYM_l] = KEY_L,
120 [KEY_SYM_M] = KEY_M, [KEY_SYM_m] = KEY_M,
121 [KEY_SYM_N] = KEY_N, [KEY_SYM_n] = KEY_N,
122 [KEY_SYM_O] = KEY_O, [KEY_SYM_o] = KEY_O,
123 [KEY_SYM_P] = KEY_P, [KEY_SYM_p] = KEY_P,
124 [KEY_SYM_Q] = KEY_Q, [KEY_SYM_q] = KEY_Q,
125 [KEY_SYM_R] = KEY_R, [KEY_SYM_r] = KEY_R,
126 [KEY_SYM_S] = KEY_S, [KEY_SYM_s] = KEY_S,
127 [KEY_SYM_T] = KEY_T, [KEY_SYM_t] = KEY_T,
128 [KEY_SYM_U] = KEY_U, [KEY_SYM_u] = KEY_U,
129 [KEY_SYM_V] = KEY_V, [KEY_SYM_v] = KEY_V,
130 [KEY_SYM_W] = KEY_W, [KEY_SYM_w] = KEY_W,
131 [KEY_SYM_X] = KEY_X, [KEY_SYM_x] = KEY_X,
132 [KEY_SYM_Y] = KEY_Y, [KEY_SYM_y] = KEY_Y,
133 [KEY_SYM_Z] = KEY_Z, [KEY_SYM_z] = KEY_Z,
134};
42 135
43 q->end = q->start + DRIVER_REMOTE_QUEUE_SIZE; 136static char remote_mouse_name[] = "ibmasm RSA I remote mouse";
44 q->reader = q->start; 137static char remote_keybd_name[] = "ibmasm RSA I remote keyboard";
45 q->writer = q->start;
46 q->size = DRIVER_REMOTE_QUEUE_SIZE;
47 init_waitqueue_head(&q->wait);
48 138
49 return 0; 139static void print_input(struct remote_input *input)
50}
51
52void ibmasm_free_remote_queue(struct service_processor *sp)
53{ 140{
54 kfree(sp->remote_queue.start); 141 if (input->type == INPUT_TYPE_MOUSE) {
142 unsigned char buttons = input->mouse_buttons;
143 dbg("remote mouse movement: (x,y)=(%d,%d)%s%s%s%s\n",
144 input->data.mouse.x, input->data.mouse.y,
145 (buttons)?" -- buttons:":"",
146 (buttons & REMOTE_BUTTON_LEFT)?"left ":"",
147 (buttons & REMOTE_BUTTON_MIDDLE)?"middle ":"",
148 (buttons & REMOTE_BUTTON_RIGHT)?"right":""
149 );
150 } else {
151 dbg("remote keypress (code, flag, down):"
152 "%d (0x%x) [0x%x] [0x%x]\n",
153 input->data.keyboard.key_code,
154 input->data.keyboard.key_code,
155 input->data.keyboard.key_flag,
156 input->data.keyboard.key_down
157 );
158 }
55} 159}
56 160
57void ibmasm_advance_reader(struct remote_queue *q, unsigned int n) 161static void send_mouse_event(struct input_dev *dev, struct pt_regs *regs,
162 struct remote_input *input)
58{ 163{
59 q->reader += n; 164 unsigned char buttons = input->mouse_buttons;
60 if (q->reader >= q->end)
61 q->reader -= q->size;
62}
63 165
64size_t ibmasm_events_available(struct remote_queue *q) 166 input_regs(dev, regs);
65{ 167 input_report_abs(dev, ABS_X, input->data.mouse.x);
66 ssize_t diff = q->writer - q->reader; 168 input_report_abs(dev, ABS_Y, input->data.mouse.y);
67 169 input_report_key(dev, BTN_LEFT, buttons & REMOTE_BUTTON_LEFT);
68 return (diff >= 0) ? diff : q->end - q->reader; 170 input_report_key(dev, BTN_MIDDLE, buttons & REMOTE_BUTTON_MIDDLE);
171 input_report_key(dev, BTN_RIGHT, buttons & REMOTE_BUTTON_RIGHT);
172 input_sync(dev);
69} 173}
70
71 174
72static int space_free(struct remote_queue *q) 175static void send_keyboard_event(struct input_dev *dev, struct pt_regs *regs,
176 struct remote_input *input)
73{ 177{
74 if (q->reader == q->writer) 178 unsigned int key;
75 return q->size - 1; 179 unsigned short code = input->data.keyboard.key_code;
76 180
77 return ( (q->reader + q->size - q->writer) % q->size ) - 1; 181 if (code & 0xff00)
182 key = xlate_high[code & 0xff];
183 else
184 key = xlate[code];
185 input_regs(dev, regs);
186 input_report_key(dev, key, (input->data.keyboard.key_down) ? 1 : 0);
187 input_sync(dev);
78} 188}
79 189
80static void set_mouse_event(struct remote_input *input, struct mouse_event *mouse) 190void ibmasm_handle_mouse_interrupt(struct service_processor *sp,
191 struct pt_regs *regs)
81{ 192{
82 static char last_buttons = 0; 193 unsigned long reader;
194 unsigned long writer;
195 struct remote_input input;
83 196
84 mouse->x = input->data.mouse.x; 197 reader = get_queue_reader(sp);
85 mouse->y = input->data.mouse.y; 198 writer = get_queue_writer(sp);
86 199
87 if (input->mouse_buttons == REMOTE_MOUSE_DOUBLE_CLICK) { 200 while (reader != writer) {
88 mouse->buttons = REMOTE_MOUSE_DOUBLE_CLICK; 201 memcpy_fromio(&input, get_queue_entry(sp, reader),
89 last_buttons = 0; 202 sizeof(struct remote_input));
90 return;
91 }
92 mouse->transitions = last_buttons ^ input->mouse_buttons;
93 mouse->buttons = input->mouse_buttons;
94 203
95 last_buttons = input->mouse_buttons; 204 print_input(&input);
96} 205 if (input.type == INPUT_TYPE_MOUSE) {
206 send_mouse_event(&sp->remote->mouse_dev, regs, &input);
207 } else if (input.type == INPUT_TYPE_KEYBOARD) {
208 send_keyboard_event(&sp->remote->keybd_dev, regs, &input);
209 } else
210 break;
97 211
98static void set_keyboard_event(struct remote_input *input, struct keyboard_event *keyboard) 212 reader = advance_queue_reader(sp, reader);
99{ 213 writer = get_queue_writer(sp);
100 keyboard->key_code = input->data.keyboard.key_code; 214 }
101 keyboard->key_down = input->data.keyboard.key_down;
102} 215}
103 216
104static int add_to_driver_queue(struct remote_queue *q, struct remote_input *input) 217int ibmasm_init_remote_input_dev(struct service_processor *sp)
105{ 218{
106 struct remote_event *event = q->writer; 219 /* set up the mouse input device */
220 struct ibmasm_remote *remote;
221 struct pci_dev *pdev = to_pci_dev(sp->dev);
222 int i;
107 223
108 if (space_free(q) < 1) { 224 sp->remote = remote = kmalloc(sizeof(*remote), GFP_KERNEL);
109 return 1; 225 if (!remote)
110 } 226 return -ENOMEM;
111 227
112 switch(input->type) { 228 memset(remote, 0, sizeof(*remote));
113 case (INPUT_TYPE_MOUSE):
114 event->type = INPUT_TYPE_MOUSE;
115 set_mouse_event(input, &event->data.mouse);
116 break;
117 case (INPUT_TYPE_KEYBOARD):
118 event->type = INPUT_TYPE_KEYBOARD;
119 set_keyboard_event(input, &event->data.keyboard);
120 break;
121 default:
122 return 0;
123 }
124 event->type = input->type;
125 229
126 q->writer++; 230 remote->mouse_dev.private = remote;
127 if (q->writer == q->end) 231 init_input_dev(&remote->mouse_dev);
128 q->writer = q->start; 232 remote->mouse_dev.id.vendor = pdev->vendor;
233 remote->mouse_dev.id.product = pdev->device;
234 remote->mouse_dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
235 remote->mouse_dev.keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) |
236 BIT(BTN_RIGHT) | BIT(BTN_MIDDLE);
237 set_bit(BTN_TOUCH, remote->mouse_dev.keybit);
238 remote->mouse_dev.name = remote_mouse_name;
239 input_set_abs_params(&remote->mouse_dev, ABS_X, 0, xmax, 0, 0);
240 input_set_abs_params(&remote->mouse_dev, ABS_Y, 0, ymax, 0, 0);
129 241
130 return 0; 242 remote->keybd_dev.private = remote;
131} 243 init_input_dev(&remote->keybd_dev);
132 244 remote->keybd_dev.id.vendor = pdev->vendor;
245 remote->keybd_dev.id.product = pdev->device;
246 remote->keybd_dev.evbit[0] = BIT(EV_KEY);
247 remote->keybd_dev.name = remote_keybd_name;
133 248
134void ibmasm_handle_mouse_interrupt(struct service_processor *sp) 249 for (i=0; i<XLATE_SIZE; i++) {
135{ 250 if (xlate_high[i])
136 unsigned long reader; 251 set_bit(xlate_high[i], remote->keybd_dev.keybit);
137 unsigned long writer; 252 if (xlate[i])
138 struct remote_input input; 253 set_bit(xlate[i], remote->keybd_dev.keybit);
254 }
139 255
140 reader = get_queue_reader(sp); 256 input_register_device(&remote->mouse_dev);
141 writer = get_queue_writer(sp); 257 input_register_device(&remote->keybd_dev);
258 enable_mouse_interrupts(sp);
142 259
143 while (reader != writer) { 260 printk(KERN_INFO "ibmasm remote responding to events on RSA card %d\n", sp->number);
144 memcpy(&input, (void *)get_queue_entry(sp, reader), sizeof(struct remote_input));
145 261
146 if (add_to_driver_queue(&sp->remote_queue, &input)) 262 return 0;
147 break; 263}
148 264
149 reader = advance_queue_reader(sp, reader); 265void ibmasm_free_remote_input_dev(struct service_processor *sp)
150 } 266{
151 wake_up_interruptible(&sp->remote_queue.wait); 267 disable_mouse_interrupts(sp);
268 input_unregister_device(&sp->remote->keybd_dev);
269 input_unregister_device(&sp->remote->mouse_dev);
270 kfree(sp->remote);
152} 271}
272
diff --git a/drivers/misc/ibmasm/remote.h b/drivers/misc/ibmasm/remote.h
index a8eb19f02d3f..b7076a8442d2 100644
--- a/drivers/misc/ibmasm/remote.h
+++ b/drivers/misc/ibmasm/remote.h
@@ -51,11 +51,13 @@
51 51
52 52
53/* mouse button states received from SP */ 53/* mouse button states received from SP */
54#define REMOTE_MOUSE_DOUBLE_CLICK 0xF0 54#define REMOTE_DOUBLE_CLICK 0xF0
55#define REMOTE_MOUSE_BUTTON_LEFT 0x01 55#define REMOTE_BUTTON_LEFT 0x01
56#define REMOTE_MOUSE_BUTTON_MIDDLE 0x02 56#define REMOTE_BUTTON_MIDDLE 0x02
57#define REMOTE_MOUSE_BUTTON_RIGHT 0x04 57#define REMOTE_BUTTON_RIGHT 0x04
58 58
59/* size of keysym/keycode translation matricies */
60#define XLATE_SIZE 256
59 61
60struct mouse_input { 62struct mouse_input {
61 unsigned short y; 63 unsigned short y;
@@ -83,11 +85,13 @@ struct remote_input {
83 unsigned char pad3; 85 unsigned char pad3;
84}; 86};
85 87
86#define mouse_addr(sp) sp->base_address + CONDOR_MOUSE_DATA 88#define mouse_addr(sp) (sp->base_address + CONDOR_MOUSE_DATA)
87#define display_width(sp) mouse_addr(sp) + CONDOR_INPUT_DISPLAY_RESX 89#define display_width(sp) (mouse_addr(sp) + CONDOR_INPUT_DISPLAY_RESX)
88#define display_height(sp) mouse_addr(sp) + CONDOR_INPUT_DISPLAY_RESY 90#define display_height(sp) (mouse_addr(sp) + CONDOR_INPUT_DISPLAY_RESY)
89#define display_depth(sp) mouse_addr(sp) + CONDOR_INPUT_DISPLAY_BITS 91#define display_depth(sp) (mouse_addr(sp) + CONDOR_INPUT_DISPLAY_BITS)
90#define vnc_status(sp) mouse_addr(sp) + CONDOR_OUTPUT_VNC_STATUS 92#define desktop_info(sp) (mouse_addr(sp) + CONDOR_INPUT_DESKTOP_INFO)
93#define vnc_status(sp) (mouse_addr(sp) + CONDOR_OUTPUT_VNC_STATUS)
94#define isr_control(sp) (mouse_addr(sp) + CONDOR_MOUSE_ISR_CONTROL)
91 95
92#define mouse_interrupt_pending(sp) readl(mouse_addr(sp) + CONDOR_MOUSE_ISR_STATUS) 96#define mouse_interrupt_pending(sp) readl(mouse_addr(sp) + CONDOR_MOUSE_ISR_STATUS)
93#define clear_mouse_interrupt(sp) writel(0, mouse_addr(sp) + CONDOR_MOUSE_ISR_STATUS) 97#define clear_mouse_interrupt(sp) writel(0, mouse_addr(sp) + CONDOR_MOUSE_ISR_STATUS)
@@ -101,10 +105,10 @@ struct remote_input {
101#define get_queue_reader(sp) readl(mouse_addr(sp) + CONDOR_MOUSE_Q_READER) 105#define get_queue_reader(sp) readl(mouse_addr(sp) + CONDOR_MOUSE_Q_READER)
102#define set_queue_reader(sp, reader) writel(reader, mouse_addr(sp) + CONDOR_MOUSE_Q_READER) 106#define set_queue_reader(sp, reader) writel(reader, mouse_addr(sp) + CONDOR_MOUSE_Q_READER)
103 107
104#define queue_begin mouse_addr(sp) + CONDOR_MOUSE_Q_BEGIN 108#define queue_begin (mouse_addr(sp) + CONDOR_MOUSE_Q_BEGIN)
105 109
106#define get_queue_entry(sp, read_index) \ 110#define get_queue_entry(sp, read_index) \
107 queue_begin + read_index * sizeof(struct remote_input) 111 ((void*)(queue_begin + read_index * sizeof(struct remote_input)))
108 112
109static inline int advance_queue_reader(struct service_processor *sp, unsigned long reader) 113static inline int advance_queue_reader(struct service_processor *sp, unsigned long reader)
110{ 114{
@@ -116,4 +120,151 @@ static inline int advance_queue_reader(struct service_processor *sp, unsigned lo
116 return reader; 120 return reader;
117} 121}
118 122
123#define NO_KEYCODE 0
124#define KEY_SYM_BK_SPC 0xFF08
125#define KEY_SYM_TAB 0xFF09
126#define KEY_SYM_ENTER 0xFF0D
127#define KEY_SYM_SCR_LOCK 0xFF14
128#define KEY_SYM_ESCAPE 0xFF1B
129#define KEY_SYM_HOME 0xFF50
130#define KEY_SYM_LARROW 0xFF51
131#define KEY_SYM_UARROW 0xFF52
132#define KEY_SYM_RARROW 0xFF53
133#define KEY_SYM_DARROW 0xFF54
134#define KEY_SYM_PAGEUP 0xFF55
135#define KEY_SYM_PAGEDOWN 0xFF56
136#define KEY_SYM_END 0xFF57
137#define KEY_SYM_INSERT 0xFF63
138#define KEY_SYM_NUM_LOCK 0xFF7F
139#define KEY_SYM_KPSTAR 0xFFAA
140#define KEY_SYM_KPPLUS 0xFFAB
141#define KEY_SYM_KPMINUS 0xFFAD
142#define KEY_SYM_KPDOT 0xFFAE
143#define KEY_SYM_KPSLASH 0xFFAF
144#define KEY_SYM_KPRIGHT 0xFF96
145#define KEY_SYM_KPUP 0xFF97
146#define KEY_SYM_KPLEFT 0xFF98
147#define KEY_SYM_KPDOWN 0xFF99
148#define KEY_SYM_KP0 0xFFB0
149#define KEY_SYM_KP1 0xFFB1
150#define KEY_SYM_KP2 0xFFB2
151#define KEY_SYM_KP3 0xFFB3
152#define KEY_SYM_KP4 0xFFB4
153#define KEY_SYM_KP5 0xFFB5
154#define KEY_SYM_KP6 0xFFB6
155#define KEY_SYM_KP7 0xFFB7
156#define KEY_SYM_KP8 0xFFB8
157#define KEY_SYM_KP9 0xFFB9
158#define KEY_SYM_F1 0xFFBE // 1B 5B 5B 41
159#define KEY_SYM_F2 0xFFBF // 1B 5B 5B 42
160#define KEY_SYM_F3 0xFFC0 // 1B 5B 5B 43
161#define KEY_SYM_F4 0xFFC1 // 1B 5B 5B 44
162#define KEY_SYM_F5 0xFFC2 // 1B 5B 5B 45
163#define KEY_SYM_F6 0xFFC3 // 1B 5B 31 37 7E
164#define KEY_SYM_F7 0xFFC4 // 1B 5B 31 38 7E
165#define KEY_SYM_F8 0xFFC5 // 1B 5B 31 39 7E
166#define KEY_SYM_F9 0xFFC6 // 1B 5B 32 30 7E
167#define KEY_SYM_F10 0xFFC7 // 1B 5B 32 31 7E
168#define KEY_SYM_F11 0xFFC8 // 1B 5B 32 33 7E
169#define KEY_SYM_F12 0xFFC9 // 1B 5B 32 34 7E
170#define KEY_SYM_SHIFT 0xFFE1
171#define KEY_SYM_CTRL 0xFFE3
172#define KEY_SYM_ALT 0xFFE9
173#define KEY_SYM_CAP_LOCK 0xFFE5
174#define KEY_SYM_DELETE 0xFFFF
175#define KEY_SYM_TILDE 0x60
176#define KEY_SYM_BKTIC 0x7E
177#define KEY_SYM_ONE 0x31
178#define KEY_SYM_BANG 0x21
179#define KEY_SYM_TWO 0x32
180#define KEY_SYM_AT 0x40
181#define KEY_SYM_THREE 0x33
182#define KEY_SYM_POUND 0x23
183#define KEY_SYM_FOUR 0x34
184#define KEY_SYM_DOLLAR 0x24
185#define KEY_SYM_FIVE 0x35
186#define KEY_SYM_PERCENT 0x25
187#define KEY_SYM_SIX 0x36
188#define KEY_SYM_CARAT 0x5E
189#define KEY_SYM_SEVEN 0x37
190#define KEY_SYM_AMPER 0x26
191#define KEY_SYM_EIGHT 0x38
192#define KEY_SYM_STAR 0x2A
193#define KEY_SYM_NINE 0x39
194#define KEY_SYM_LPAREN 0x28
195#define KEY_SYM_ZERO 0x30
196#define KEY_SYM_RPAREN 0x29
197#define KEY_SYM_MINUS 0x2D
198#define KEY_SYM_USCORE 0x5F
199#define KEY_SYM_EQUAL 0x2B
200#define KEY_SYM_PLUS 0x3D
201#define KEY_SYM_LBRKT 0x5B
202#define KEY_SYM_LCURLY 0x7B
203#define KEY_SYM_RBRKT 0x5D
204#define KEY_SYM_RCURLY 0x7D
205#define KEY_SYM_SLASH 0x5C
206#define KEY_SYM_PIPE 0x7C
207#define KEY_SYM_TIC 0x27
208#define KEY_SYM_QUOTE 0x22
209#define KEY_SYM_SEMIC 0x3B
210#define KEY_SYM_COLON 0x3A
211#define KEY_SYM_COMMA 0x2C
212#define KEY_SYM_LT 0x3C
213#define KEY_SYM_PERIOD 0x2E
214#define KEY_SYM_GT 0x3E
215#define KEY_SYM_BSLASH 0x2F
216#define KEY_SYM_QMARK 0x3F
217#define KEY_SYM_A 0x41
218#define KEY_SYM_B 0x42
219#define KEY_SYM_C 0x43
220#define KEY_SYM_D 0x44
221#define KEY_SYM_E 0x45
222#define KEY_SYM_F 0x46
223#define KEY_SYM_G 0x47
224#define KEY_SYM_H 0x48
225#define KEY_SYM_I 0x49
226#define KEY_SYM_J 0x4A
227#define KEY_SYM_K 0x4B
228#define KEY_SYM_L 0x4C
229#define KEY_SYM_M 0x4D
230#define KEY_SYM_N 0x4E
231#define KEY_SYM_O 0x4F
232#define KEY_SYM_P 0x50
233#define KEY_SYM_Q 0x51
234#define KEY_SYM_R 0x52
235#define KEY_SYM_S 0x53
236#define KEY_SYM_T 0x54
237#define KEY_SYM_U 0x55
238#define KEY_SYM_V 0x56
239#define KEY_SYM_W 0x57
240#define KEY_SYM_X 0x58
241#define KEY_SYM_Y 0x59
242#define KEY_SYM_Z 0x5A
243#define KEY_SYM_a 0x61
244#define KEY_SYM_b 0x62
245#define KEY_SYM_c 0x63
246#define KEY_SYM_d 0x64
247#define KEY_SYM_e 0x65
248#define KEY_SYM_f 0x66
249#define KEY_SYM_g 0x67
250#define KEY_SYM_h 0x68
251#define KEY_SYM_i 0x69
252#define KEY_SYM_j 0x6A
253#define KEY_SYM_k 0x6B
254#define KEY_SYM_l 0x6C
255#define KEY_SYM_m 0x6D
256#define KEY_SYM_n 0x6E
257#define KEY_SYM_o 0x6F
258#define KEY_SYM_p 0x70
259#define KEY_SYM_q 0x71
260#define KEY_SYM_r 0x72
261#define KEY_SYM_s 0x73
262#define KEY_SYM_t 0x74
263#define KEY_SYM_u 0x75
264#define KEY_SYM_v 0x76
265#define KEY_SYM_w 0x77
266#define KEY_SYM_x 0x78
267#define KEY_SYM_y 0x79
268#define KEY_SYM_z 0x7A
269#define KEY_SYM_SPACE 0x20
119#endif /* _IBMASM_REMOTE_H_ */ 270#endif /* _IBMASM_REMOTE_H_ */
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c
index b5e076043431..80ec9aa575bb 100644
--- a/drivers/net/3c59x.c
+++ b/drivers/net/3c59x.c
@@ -2202,9 +2202,8 @@ boomerang_start_xmit(struct sk_buff *skb, struct net_device *dev)
2202 2202
2203 if (vortex_debug > 6) { 2203 if (vortex_debug > 6) {
2204 printk(KERN_DEBUG "boomerang_start_xmit()\n"); 2204 printk(KERN_DEBUG "boomerang_start_xmit()\n");
2205 if (vortex_debug > 3) 2205 printk(KERN_DEBUG "%s: Trying to send a packet, Tx index %d.\n",
2206 printk(KERN_DEBUG "%s: Trying to send a packet, Tx index %d.\n", 2206 dev->name, vp->cur_tx);
2207 dev->name, vp->cur_tx);
2208 } 2207 }
2209 2208
2210 if (vp->cur_tx - vp->dirty_tx >= TX_RING_SIZE) { 2209 if (vp->cur_tx - vp->dirty_tx >= TX_RING_SIZE) {
diff --git a/drivers/net/8390.c b/drivers/net/8390.c
index bab16bcc9ae5..6d76f3a99b17 100644
--- a/drivers/net/8390.c
+++ b/drivers/net/8390.c
@@ -225,9 +225,9 @@ void ei_tx_timeout(struct net_device *dev)
225 unsigned long icucr; 225 unsigned long icucr;
226 226
227 local_irq_save(flags); 227 local_irq_save(flags);
228 icucr = inl(ICUCR1); 228 icucr = inl(M32R_ICU_CR1_PORTL);
229 icucr |= M32R_ICUCR_ISMOD11; 229 icucr |= M32R_ICUCR_ISMOD11;
230 outl(icucr, ICUCR1); 230 outl(icucr, M32R_ICU_CR1_PORTL);
231 local_irq_restore(flags); 231 local_irq_restore(flags);
232#endif 232#endif
233 ei_local->stat.tx_errors++; 233 ei_local->stat.tx_errors++;
diff --git a/drivers/oprofile/buffer_sync.c b/drivers/oprofile/buffer_sync.c
index 55720dc6ec43..745a14183634 100644
--- a/drivers/oprofile/buffer_sync.c
+++ b/drivers/oprofile/buffer_sync.c
@@ -62,7 +62,7 @@ static int task_exit_notify(struct notifier_block * self, unsigned long val, voi
62 /* To avoid latency problems, we only process the current CPU, 62 /* To avoid latency problems, we only process the current CPU,
63 * hoping that most samples for the task are on this CPU 63 * hoping that most samples for the task are on this CPU
64 */ 64 */
65 sync_buffer(_smp_processor_id()); 65 sync_buffer(raw_smp_processor_id());
66 return 0; 66 return 0;
67} 67}
68 68
@@ -86,7 +86,7 @@ static int munmap_notify(struct notifier_block * self, unsigned long val, void *
86 /* To avoid latency problems, we only process the current CPU, 86 /* To avoid latency problems, we only process the current CPU,
87 * hoping that most samples for the task are on this CPU 87 * hoping that most samples for the task are on this CPU
88 */ 88 */
89 sync_buffer(_smp_processor_id()); 89 sync_buffer(raw_smp_processor_id());
90 return 0; 90 return 0;
91 } 91 }
92 92
diff --git a/drivers/pcmcia/Kconfig b/drivers/pcmcia/Kconfig
index 6375ebc85020..14e4124e1523 100644
--- a/drivers/pcmcia/Kconfig
+++ b/drivers/pcmcia/Kconfig
@@ -171,19 +171,21 @@ config PCMCIA_PROBE
171config M32R_PCC 171config M32R_PCC
172 bool "M32R PCMCIA I/F" 172 bool "M32R PCMCIA I/F"
173 depends on M32R && CHIP_M32700 && PCMCIA 173 depends on M32R && CHIP_M32700 && PCMCIA
174 select PCCARD_NONSTATIC
174 help 175 help
175 Say Y here to use the M32R PCMCIA controller. 176 Say Y here to use the M32R PCMCIA controller.
176 177
177config M32R_CFC 178config M32R_CFC
178 bool "M32R CF I/F Controller" 179 bool "M32R CF I/F Controller"
179 depends on M32R && (PLAT_USRV || PLAT_M32700UT || PLAT_MAPPI2 || PLAT_OPSPUT) 180 depends on M32R && (PLAT_USRV || PLAT_M32700UT || PLAT_MAPPI2 || PLAT_MAPPI3 || PLAT_OPSPUT)
181 select PCCARD_NONSTATIC
180 help 182 help
181 Say Y here to use the M32R CompactFlash controller. 183 Say Y here to use the M32R CompactFlash controller.
182 184
183config M32R_CFC_NUM 185config M32R_CFC_NUM
184 int "M32R CF I/F number" 186 int "M32R CF I/F number"
185 depends on M32R_CFC 187 depends on M32R_CFC
186 default "1" if PLAT_USRV || PLAT_M32700UT || PLAT_MAPPI2 || PLAT_OPSPUT 188 default "1" if PLAT_USRV || PLAT_M32700UT || PLAT_MAPPI2 || PLAT_MAPPI3 || PLAT_OPSPUT
187 help 189 help
188 Set the number of M32R CF slots. 190 Set the number of M32R CF slots.
189 191
diff --git a/drivers/pcmcia/m32r_cfc.c b/drivers/pcmcia/m32r_cfc.c
index 581bfa95429e..b1111c6bf062 100644
--- a/drivers/pcmcia/m32r_cfc.c
+++ b/drivers/pcmcia/m32r_cfc.c
@@ -24,9 +24,9 @@
24#include <linux/workqueue.h> 24#include <linux/workqueue.h>
25#include <linux/interrupt.h> 25#include <linux/interrupt.h>
26#include <linux/device.h> 26#include <linux/device.h>
27#include <linux/bitops.h>
27#include <asm/irq.h> 28#include <asm/irq.h>
28#include <asm/io.h> 29#include <asm/io.h>
29#include <asm/bitops.h>
30#include <asm/system.h> 30#include <asm/system.h>
31 31
32#include <pcmcia/version.h> 32#include <pcmcia/version.h>
@@ -444,7 +444,7 @@ static int _pcc_get_status(u_short sock, u_int *value)
444 debug(3, "m32r_cfc: _pcc_get_status: " 444 debug(3, "m32r_cfc: _pcc_get_status: "
445 "power off (CPCR=0x%08x)\n", status); 445 "power off (CPCR=0x%08x)\n", status);
446 } 446 }
447#elif defined(CONFIG_PLAT_MAPPI2) 447#elif defined(CONFIG_PLAT_MAPPI2) || defined(CONFIG_PLAT_MAPPI3)
448 if ( status ) { 448 if ( status ) {
449 status = pcc_get(sock, (unsigned int)PLD_CPCR); 449 status = pcc_get(sock, (unsigned int)PLD_CPCR);
450 if (status == 0) { /* power off */ 450 if (status == 0) { /* power off */
@@ -452,18 +452,23 @@ static int _pcc_get_status(u_short sock, u_int *value)
452 pcc_set(sock, (unsigned int)PLD_CFBUFCR,0); /* force buffer off for ZA-36 */ 452 pcc_set(sock, (unsigned int)PLD_CFBUFCR,0); /* force buffer off for ZA-36 */
453 udelay(50); 453 udelay(50);
454 } 454 }
455 status = pcc_get(sock, (unsigned int)PLD_CFBUFCR); 455 *value |= SS_POWERON;
456 if (status != 0) { /* buffer off */ 456
457 pcc_set(sock, (unsigned int)PLD_CFBUFCR,0); 457 pcc_set(sock, (unsigned int)PLD_CFBUFCR,0);
458 udelay(50); 458 udelay(50);
459 pcc_set(sock, (unsigned int)PLD_CFRSTCR, 0x0101); 459 pcc_set(sock, (unsigned int)PLD_CFRSTCR, 0x0101);
460 udelay(25); /* for IDE reset */ 460 udelay(25); /* for IDE reset */
461 pcc_set(sock, (unsigned int)PLD_CFRSTCR, 0x0100); 461 pcc_set(sock, (unsigned int)PLD_CFRSTCR, 0x0100);
462 mdelay(2); /* for IDE reset */ 462 mdelay(2); /* for IDE reset */
463 } else { 463
464 *value |= SS_POWERON; 464 *value |= SS_READY;
465 *value |= SS_READY; 465 *value |= SS_3VCARD;
466 } 466 } else {
467 /* disable CF power */
468 pcc_set(sock, (unsigned int)PLD_CPCR, 0);
469 udelay(100);
470 debug(3, "m32r_cfc: _pcc_get_status: "
471 "power off (CPCR=0x%08x)\n", status);
467 } 472 }
468#else 473#else
469#error no platform configuration 474#error no platform configuration
@@ -479,14 +484,13 @@ static int _pcc_get_socket(u_short sock, socket_state_t *state)
479{ 484{
480// pcc_socket_t *t = &socket[sock]; 485// pcc_socket_t *t = &socket[sock];
481 486
482#if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_USRV) || defined(CONFIG_PLAT_OPSPUT)
483 state->flags = 0; 487 state->flags = 0;
484 state->csc_mask = SS_DETECT; 488 state->csc_mask = SS_DETECT;
485 state->csc_mask |= SS_READY; 489 state->csc_mask |= SS_READY;
486 state->io_irq = 0; 490 state->io_irq = 0;
487 state->Vcc = 33; /* 3.3V fixed */ 491 state->Vcc = 33; /* 3.3V fixed */
488 state->Vpp = 33; 492 state->Vpp = 33;
489#endif 493
490 debug(3, "m32r_cfc: GetSocket(%d) = flags %#3.3x, Vcc %d, Vpp %d, " 494 debug(3, "m32r_cfc: GetSocket(%d) = flags %#3.3x, Vcc %d, Vpp %d, "
491 "io_irq %d, csc_mask %#2.2x\n", sock, state->flags, 495 "io_irq %d, csc_mask %#2.2x\n", sock, state->flags,
492 state->Vcc, state->Vpp, state->io_irq, state->csc_mask); 496 state->Vcc, state->Vpp, state->io_irq, state->csc_mask);
@@ -497,32 +501,17 @@ static int _pcc_get_socket(u_short sock, socket_state_t *state)
497 501
498static int _pcc_set_socket(u_short sock, socket_state_t *state) 502static int _pcc_set_socket(u_short sock, socket_state_t *state)
499{ 503{
500#if defined(CONFIG_PLAT_MAPPI2)
501 u_long reg = 0;
502#endif
503 debug(3, "m32r_cfc: SetSocket(%d, flags %#3.3x, Vcc %d, Vpp %d, " 504 debug(3, "m32r_cfc: SetSocket(%d, flags %#3.3x, Vcc %d, Vpp %d, "
504 "io_irq %d, csc_mask %#2.2x)\n", sock, state->flags, 505 "io_irq %d, csc_mask %#2.2x)\n", sock, state->flags,
505 state->Vcc, state->Vpp, state->io_irq, state->csc_mask); 506 state->Vcc, state->Vpp, state->io_irq, state->csc_mask);
506 507
507#if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_USRV) || defined(CONFIG_PLAT_OPSPUT) 508#if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_USRV) || defined(CONFIG_PLAT_OPSPUT) || defined(CONFIG_PLAT_MAPPI2) || defined(CONFIG_PLAT_MAPPI3)
508 if (state->Vcc) { 509 if (state->Vcc) {
509 if ((state->Vcc != 50) && (state->Vcc != 33)) 510 if ((state->Vcc != 50) && (state->Vcc != 33))
510 return -EINVAL; 511 return -EINVAL;
511 /* accept 5V and 3.3V */ 512 /* accept 5V and 3.3V */
512 } 513 }
513#elif defined(CONFIG_PLAT_MAPPI2)
514 if (state->Vcc) {
515 /*
516 * 5V only
517 */
518 if (state->Vcc == 50) {
519 reg |= PCCSIGCR_VEN;
520 } else {
521 return -EINVAL;
522 }
523 }
524#endif 514#endif
525
526 if (state->flags & SS_RESET) { 515 if (state->flags & SS_RESET) {
527 debug(3, ":RESET\n"); 516 debug(3, ":RESET\n");
528 pcc_set(sock,(unsigned int)PLD_CFRSTCR,0x101); 517 pcc_set(sock,(unsigned int)PLD_CFRSTCR,0x101);
@@ -788,7 +777,7 @@ static int __init init_m32r_pcc(void)
788 return ret; 777 return ret;
789 } 778 }
790 779
791#if defined(CONFIG_PLAT_MAPPI2) 780#if defined(CONFIG_PLAT_MAPPI2) || defined(CONFIG_PLAT_MAPPI3)
792 pcc_set(0, (unsigned int)PLD_CFCR0, 0x0f0f); 781 pcc_set(0, (unsigned int)PLD_CFCR0, 0x0f0f);
793 pcc_set(0, (unsigned int)PLD_CFCR1, 0x0200); 782 pcc_set(0, (unsigned int)PLD_CFCR1, 0x0200);
794#endif 783#endif
@@ -825,7 +814,7 @@ static int __init init_m32r_pcc(void)
825 for (i = 0 ; i < pcc_sockets ; i++) { 814 for (i = 0 ; i < pcc_sockets ; i++) {
826 socket[i].socket.dev.dev = &pcc_device.dev; 815 socket[i].socket.dev.dev = &pcc_device.dev;
827 socket[i].socket.ops = &pcc_operations; 816 socket[i].socket.ops = &pcc_operations;
828 socket[i].socket.resource_ops = &pccard_static_ops; 817 socket[i].socket.resource_ops = &pccard_nonstatic_ops;
829 socket[i].socket.owner = THIS_MODULE; 818 socket[i].socket.owner = THIS_MODULE;
830 socket[i].number = i; 819 socket[i].number = i;
831 ret = pcmcia_register_socket(&socket[i].socket); 820 ret = pcmcia_register_socket(&socket[i].socket);
diff --git a/drivers/pcmcia/m32r_cfc.h b/drivers/pcmcia/m32r_cfc.h
index 17c1db7ae155..8146e3bee2e8 100644
--- a/drivers/pcmcia/m32r_cfc.h
+++ b/drivers/pcmcia/m32r_cfc.h
@@ -71,11 +71,15 @@
71 71
72#define CFC_IOPORT_BASE 0x1000 72#define CFC_IOPORT_BASE 0x1000
73 73
74#if !defined(CONFIG_PLAT_USRV) 74#if defined(CONFIG_PLAT_MAPPI3)
75#define CFC_ATTR_MAPBASE 0x14014000
76#define CFC_IO_MAPBASE_BYTE 0xb4012000
77#define CFC_IO_MAPBASE_WORD 0xb4002000
78#elif !defined(CONFIG_PLAT_USRV)
75#define CFC_ATTR_MAPBASE 0x0c014000 79#define CFC_ATTR_MAPBASE 0x0c014000
76#define CFC_IO_MAPBASE_BYTE 0xac012000 80#define CFC_IO_MAPBASE_BYTE 0xac012000
77#define CFC_IO_MAPBASE_WORD 0xac002000 81#define CFC_IO_MAPBASE_WORD 0xac002000
78#else /* CONFIG_PLAT_USRV */ 82#else
79#define CFC_ATTR_MAPBASE 0x04014000 83#define CFC_ATTR_MAPBASE 0x04014000
80#define CFC_IO_MAPBASE_BYTE 0xa4012000 84#define CFC_IO_MAPBASE_BYTE 0xa4012000
81#define CFC_IO_MAPBASE_WORD 0xa4002000 85#define CFC_IO_MAPBASE_WORD 0xa4002000
diff --git a/drivers/s390/cio/blacklist.c b/drivers/s390/cio/blacklist.c
index 4a06c7d0e5e4..aac83ce6469c 100644
--- a/drivers/s390/cio/blacklist.c
+++ b/drivers/s390/cio/blacklist.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * drivers/s390/cio/blacklist.c 2 * drivers/s390/cio/blacklist.c
3 * S/390 common I/O routines -- blacklisting of specific devices 3 * S/390 common I/O routines -- blacklisting of specific devices
4 * $Revision: 1.33 $ 4 * $Revision: 1.34 $
5 * 5 *
6 * Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH, 6 * Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH,
7 * IBM Corporation 7 * IBM Corporation
@@ -289,7 +289,7 @@ static int cio_ignore_read (char *page, char **start, off_t off,
289 len = 0; 289 len = 0;
290 for (devno = off; /* abuse the page variable 290 for (devno = off; /* abuse the page variable
291 * as counter, see fs/proc/generic.c */ 291 * as counter, see fs/proc/generic.c */
292 devno <= __MAX_SUBCHANNELS && len + entry_size < count; devno++) { 292 devno < __MAX_SUBCHANNELS && len + entry_size < count; devno++) {
293 if (!test_bit(devno, bl_dev)) 293 if (!test_bit(devno, bl_dev))
294 continue; 294 continue;
295 len += sprintf(page + len, "0.0.%04lx", devno); 295 len += sprintf(page + len, "0.0.%04lx", devno);
@@ -302,7 +302,7 @@ static int cio_ignore_read (char *page, char **start, off_t off,
302 len += sprintf(page + len, "\n"); 302 len += sprintf(page + len, "\n");
303 } 303 }
304 304
305 if (devno <= __MAX_SUBCHANNELS) 305 if (devno < __MAX_SUBCHANNELS)
306 *eof = 1; 306 *eof = 1;
307 *start = (char *) (devno - off); /* number of checked entries */ 307 *start = (char *) (devno - off); /* number of checked entries */
308 return len; 308 return len;
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index 80b0c40c522b..ec81532eb845 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -1975,7 +1975,7 @@ __megaraid_reset(Scsi_Cmnd *cmd)
1975static int 1975static int
1976megaraid_reset(Scsi_Cmnd *cmd) 1976megaraid_reset(Scsi_Cmnd *cmd)
1977{ 1977{
1978 adapter = (adapter_t *)cmd->device->host->hostdata; 1978 adapter_t *adapter = (adapter_t *)cmd->device->host->hostdata;
1979 int rc; 1979 int rc;
1980 1980
1981 spin_lock_irq(&adapter->lock); 1981 spin_lock_irq(&adapter->lock);
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index 6e44b46c9e9d..25fcef2c42de 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -753,7 +753,7 @@ config SERIAL_MPC52xx_CONSOLE_BAUD
753 753
754config SERIAL_ICOM 754config SERIAL_ICOM
755 tristate "IBM Multiport Serial Adapter" 755 tristate "IBM Multiport Serial Adapter"
756 depends on PPC_ISERIES || PPC_PSERIES 756 depends on PCI && (PPC_ISERIES || PPC_PSERIES)
757 select SERIAL_CORE 757 select SERIAL_CORE
758 help 758 help
759 This driver is for a family of multiport serial adapters 759 This driver is for a family of multiport serial adapters
@@ -843,4 +843,13 @@ config SERIAL_JSM
843 To compile this driver as a module, choose M here: the 843 To compile this driver as a module, choose M here: the
844 module will be called jsm. 844 module will be called jsm.
845 845
846config SERIAL_SGI_IOC4
847 tristate "SGI IOC4 controller serial support"
848 depends on (IA64_GENERIC || IA64_SGI_SN2) && SGI_IOC4
849 select SERIAL_CORE
850 help
851 If you have an SGI Altix with an IOC4 based Base IO card
852 and wish to use the serial ports on this card, say Y.
853 Otherwise, say N.
854
846endmenu 855endmenu
diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile
index 81b77d769b84..8f1cdde7dbed 100644
--- a/drivers/serial/Makefile
+++ b/drivers/serial/Makefile
@@ -51,4 +51,4 @@ obj-$(CONFIG_ETRAX_SERIAL) += crisv10.o
51obj-$(CONFIG_SERIAL_JSM) += jsm/ 51obj-$(CONFIG_SERIAL_JSM) += jsm/
52obj-$(CONFIG_SERIAL_TXX9) += serial_txx9.o 52obj-$(CONFIG_SERIAL_TXX9) += serial_txx9.o
53obj-$(CONFIG_SERIAL_VR41XX) += vr41xx_siu.o 53obj-$(CONFIG_SERIAL_VR41XX) += vr41xx_siu.o
54obj-$(CONFIG_BLK_DEV_SGIIOC4) += ioc4_serial.o 54obj-$(CONFIG_SERIAL_SGI_IOC4) += ioc4_serial.o
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm2.c b/drivers/serial/cpm_uart/cpm_uart_cpm2.c
index b422c3abfba6..c4c8f4b44f53 100644
--- a/drivers/serial/cpm_uart/cpm_uart_cpm2.c
+++ b/drivers/serial/cpm_uart/cpm_uart_cpm2.c
@@ -134,12 +134,21 @@ void scc1_lineif(struct uart_cpm_port *pinfo)
134 134
135void scc2_lineif(struct uart_cpm_port *pinfo) 135void scc2_lineif(struct uart_cpm_port *pinfo)
136{ 136{
137 /*
138 * STx GP3 uses the SCC2 secondary option pin assignment
139 * which this driver doesn't account for in the static
140 * pin assignments. This kind of board specific info
141 * really has to get out of the driver so boards can
142 * be supported in a sane fashion.
143 */
144#ifndef CONFIG_STX_GP3
137 volatile iop_cpm2_t *io = &cpm2_immr->im_ioport; 145 volatile iop_cpm2_t *io = &cpm2_immr->im_ioport;
138 io->iop_pparb |= 0x008b0000; 146 io->iop_pparb |= 0x008b0000;
139 io->iop_pdirb |= 0x00880000; 147 io->iop_pdirb |= 0x00880000;
140 io->iop_psorb |= 0x00880000; 148 io->iop_psorb |= 0x00880000;
141 io->iop_pdirb &= ~0x00030000; 149 io->iop_pdirb &= ~0x00030000;
142 io->iop_psorb &= ~0x00030000; 150 io->iop_psorb &= ~0x00030000;
151#endif
143 cpm2_immr->im_cpmux.cmx_scr &= 0xff00ffff; 152 cpm2_immr->im_cpmux.cmx_scr &= 0xff00ffff;
144 cpm2_immr->im_cpmux.cmx_scr |= 0x00090000; 153 cpm2_immr->im_cpmux.cmx_scr |= 0x00090000;
145 pinfo->brg = 2; 154 pinfo->brg = 2;
diff --git a/drivers/serial/ioc4_serial.c b/drivers/serial/ioc4_serial.c
index ba4e13a22a50..793c3a7cbe47 100644
--- a/drivers/serial/ioc4_serial.c
+++ b/drivers/serial/ioc4_serial.c
@@ -20,7 +20,7 @@
20#include <linux/serial_reg.h> 20#include <linux/serial_reg.h>
21#include <linux/module.h> 21#include <linux/module.h>
22#include <linux/pci.h> 22#include <linux/pci.h>
23#include <linux/ioc4_common.h> 23#include <linux/ioc4.h>
24#include <linux/serial_core.h> 24#include <linux/serial_core.h>
25 25
26/* 26/*
@@ -130,12 +130,19 @@
130 IOC4_SIO_IR_S3_TX_EXPLICIT) 130 IOC4_SIO_IR_S3_TX_EXPLICIT)
131 131
132/* Bitmasks for IOC4_OTHER_IR, IOC4_OTHER_IEC, and IOC4_OTHER_IES */ 132/* Bitmasks for IOC4_OTHER_IR, IOC4_OTHER_IEC, and IOC4_OTHER_IES */
133#define IOC4_OTHER_IR_ATA_INT 0x00000001 /* ATAPI intr pass-thru */ 133#define IOC4_OTHER_IR_ATA_INT 0x00000001 /* ATAPI intr pass-thru */
134#define IOC4_OTHER_IR_ATA_MEMERR 0x00000002 /* ATAPI DMA PCI error */ 134#define IOC4_OTHER_IR_ATA_MEMERR 0x00000002 /* ATAPI DMA PCI error */
135#define IOC4_OTHER_IR_S0_MEMERR 0x00000004 /* Port 0 PCI error */ 135#define IOC4_OTHER_IR_S0_MEMERR 0x00000004 /* Port 0 PCI error */
136#define IOC4_OTHER_IR_S1_MEMERR 0x00000008 /* Port 1 PCI error */ 136#define IOC4_OTHER_IR_S1_MEMERR 0x00000008 /* Port 1 PCI error */
137#define IOC4_OTHER_IR_S2_MEMERR 0x00000010 /* Port 2 PCI error */ 137#define IOC4_OTHER_IR_S2_MEMERR 0x00000010 /* Port 2 PCI error */
138#define IOC4_OTHER_IR_S3_MEMERR 0x00000020 /* Port 3 PCI error */ 138#define IOC4_OTHER_IR_S3_MEMERR 0x00000020 /* Port 3 PCI error */
139#define IOC4_OTHER_IR_KBD_INT 0x00000040 /* Keyboard/mouse */
140#define IOC4_OTHER_IR_RESERVED 0x007fff80 /* Reserved */
141#define IOC4_OTHER_IR_RT_INT 0x00800000 /* INT_OUT section output */
142#define IOC4_OTHER_IR_GEN_INT 0xff000000 /* Generic pins */
143
144#define IOC4_OTHER_IR_SER_MEMERR (IOC4_OTHER_IR_S0_MEMERR | IOC4_OTHER_IR_S1_MEMERR | \
145 IOC4_OTHER_IR_S2_MEMERR | IOC4_OTHER_IR_S3_MEMERR)
139 146
140/* Bitmasks for IOC4_SIO_CR */ 147/* Bitmasks for IOC4_SIO_CR */
141#define IOC4_SIO_CR_CMD_PULSE_SHIFT 0 /* byte bus strobe shift */ 148#define IOC4_SIO_CR_CMD_PULSE_SHIFT 0 /* byte bus strobe shift */
@@ -274,70 +281,24 @@ struct ioc4_uartregs {
274#define i4u_dlm u2.dlm 281#define i4u_dlm u2.dlm
275#define i4u_fcr u3.fcr 282#define i4u_fcr u3.fcr
276 283
277/* PCI memory space register map addressed using pci_bar0 */ 284/* Serial port registers used for DMA serial I/O */
278struct ioc4_memregs { 285struct ioc4_serial {
279 struct ioc4_mem { 286 uint32_t sbbr01_l;
280 /* Miscellaneous IOC4 registers */ 287 uint32_t sbbr01_h;
281 uint32_t pci_err_addr_l; 288 uint32_t sbbr23_l;
282 uint32_t pci_err_addr_h; 289 uint32_t sbbr23_h;
283 uint32_t sio_ir; 290
284 uint32_t other_ir; 291 struct ioc4_serialregs port_0;
285 292 struct ioc4_serialregs port_1;
286 /* These registers are read-only for general kernel code. */ 293 struct ioc4_serialregs port_2;
287 uint32_t sio_ies_ro; 294 struct ioc4_serialregs port_3;
288 uint32_t other_ies_ro; 295 struct ioc4_uartregs uart_0;
289 uint32_t sio_iec_ro; 296 struct ioc4_uartregs uart_1;
290 uint32_t other_iec_ro; 297 struct ioc4_uartregs uart_2;
291 uint32_t sio_cr; 298 struct ioc4_uartregs uart_3;
292 uint32_t misc_fill1; 299} ioc4_serial;
293 uint32_t int_out;
294 uint32_t misc_fill2;
295 uint32_t gpcr_s;
296 uint32_t gpcr_c;
297 uint32_t gpdr;
298 uint32_t misc_fill3;
299 uint32_t gppr_0;
300 uint32_t gppr_1;
301 uint32_t gppr_2;
302 uint32_t gppr_3;
303 uint32_t gppr_4;
304 uint32_t gppr_5;
305 uint32_t gppr_6;
306 uint32_t gppr_7;
307 } ioc4_mem;
308
309 char misc_fill4[0x100 - 0x5C - 4];
310
311 /* ATA/ATAP registers */
312 uint32_t ata_notused[9];
313 char ata_fill1[0x140 - 0x120 - 4];
314 uint32_t ata_notused1[8];
315 char ata_fill2[0x200 - 0x15C - 4];
316
317 /* Keyboard and mouse registers */
318 uint32_t km_notused[5];;
319 char km_fill1[0x300 - 0x210 - 4];
320
321 /* Serial port registers used for DMA serial I/O */
322 struct ioc4_serial {
323 uint32_t sbbr01_l;
324 uint32_t sbbr01_h;
325 uint32_t sbbr23_l;
326 uint32_t sbbr23_h;
327
328 struct ioc4_serialregs port_0;
329 struct ioc4_serialregs port_1;
330 struct ioc4_serialregs port_2;
331 struct ioc4_serialregs port_3;
332 struct ioc4_uartregs uart_0;
333 struct ioc4_uartregs uart_1;
334 struct ioc4_uartregs uart_2;
335 struct ioc4_uartregs uart_3;
336 } ioc4_serial;
337};
338 300
339/* UART clock speed */ 301/* UART clock speed */
340#define IOC4_SER_XIN_CLK IOC4_SER_XIN_CLK_66
341#define IOC4_SER_XIN_CLK_66 66666667 302#define IOC4_SER_XIN_CLK_66 66666667
342#define IOC4_SER_XIN_CLK_33 33333333 303#define IOC4_SER_XIN_CLK_33 33333333
343 304
@@ -412,8 +373,8 @@ enum sio_proto {
412 | UART_LCR_WLEN7 | UART_LCR_WLEN8) 373 | UART_LCR_WLEN7 | UART_LCR_WLEN8)
413#define LCR_MASK_STOP_BITS (UART_LCR_STOP) 374#define LCR_MASK_STOP_BITS (UART_LCR_STOP)
414 375
415#define PENDING(_p) (readl(&(_p)->ip_mem->sio_ir) & _p->ip_ienb) 376#define PENDING(_p) (readl(&(_p)->ip_mem->sio_ir.raw) & _p->ip_ienb)
416#define READ_SIO_IR(_p) readl(&(_p)->ip_mem->sio_ir) 377#define READ_SIO_IR(_p) readl(&(_p)->ip_mem->sio_ir.raw)
417 378
418/* Default to 4k buffers */ 379/* Default to 4k buffers */
419#ifdef IOC4_1K_BUFFERS 380#ifdef IOC4_1K_BUFFERS
@@ -447,7 +408,7 @@ struct ioc4_control {
447 */ 408 */
448#define MAX_IOC4_INTR_ENTS (8 * sizeof(uint32_t)) 409#define MAX_IOC4_INTR_ENTS (8 * sizeof(uint32_t))
449struct ioc4_soft { 410struct ioc4_soft {
450 struct ioc4_mem __iomem *is_ioc4_mem_addr; 411 struct ioc4_misc_regs __iomem *is_ioc4_misc_addr;
451 struct ioc4_serial __iomem *is_ioc4_serial_addr; 412 struct ioc4_serial __iomem *is_ioc4_serial_addr;
452 413
453 /* Each interrupt type has an entry in the array */ 414 /* Each interrupt type has an entry in the array */
@@ -486,7 +447,7 @@ struct ioc4_port {
486 struct ioc4_soft *ip_ioc4_soft; 447 struct ioc4_soft *ip_ioc4_soft;
487 448
488 /* pci mem addresses */ 449 /* pci mem addresses */
489 struct ioc4_mem __iomem *ip_mem; 450 struct ioc4_misc_regs __iomem *ip_mem;
490 struct ioc4_serial __iomem *ip_serial; 451 struct ioc4_serial __iomem *ip_serial;
491 struct ioc4_serialregs __iomem *ip_serial_regs; 452 struct ioc4_serialregs __iomem *ip_serial_regs;
492 struct ioc4_uartregs __iomem *ip_uart_regs; 453 struct ioc4_uartregs __iomem *ip_uart_regs;
@@ -553,7 +514,7 @@ struct hooks {
553 uint32_t intr_dma_error; 514 uint32_t intr_dma_error;
554 uint32_t intr_clear; 515 uint32_t intr_clear;
555 uint32_t intr_all; 516 uint32_t intr_all;
556 char rs422_select_pin; 517 int rs422_select_pin;
557}; 518};
558 519
559static struct hooks hooks_array[IOC4_NUM_SERIAL_PORTS] = { 520static struct hooks hooks_array[IOC4_NUM_SERIAL_PORTS] = {
@@ -669,7 +630,7 @@ static void handle_intr(void *arg, uint32_t sio_ir);
669static inline void 630static inline void
670write_ireg(struct ioc4_soft *ioc4_soft, uint32_t val, int which, int type) 631write_ireg(struct ioc4_soft *ioc4_soft, uint32_t val, int which, int type)
671{ 632{
672 struct ioc4_mem __iomem *mem = ioc4_soft->is_ioc4_mem_addr; 633 struct ioc4_misc_regs __iomem *mem = ioc4_soft->is_ioc4_misc_addr;
673 unsigned long flags; 634 unsigned long flags;
674 635
675 spin_lock_irqsave(&ioc4_soft->is_ir_lock, flags); 636 spin_lock_irqsave(&ioc4_soft->is_ir_lock, flags);
@@ -678,11 +639,11 @@ write_ireg(struct ioc4_soft *ioc4_soft, uint32_t val, int which, int type)
678 case IOC4_SIO_INTR_TYPE: 639 case IOC4_SIO_INTR_TYPE:
679 switch (which) { 640 switch (which) {
680 case IOC4_W_IES: 641 case IOC4_W_IES:
681 writel(val, &mem->sio_ies_ro); 642 writel(val, &mem->sio_ies.raw);
682 break; 643 break;
683 644
684 case IOC4_W_IEC: 645 case IOC4_W_IEC:
685 writel(val, &mem->sio_iec_ro); 646 writel(val, &mem->sio_iec.raw);
686 break; 647 break;
687 } 648 }
688 break; 649 break;
@@ -690,11 +651,11 @@ write_ireg(struct ioc4_soft *ioc4_soft, uint32_t val, int which, int type)
690 case IOC4_OTHER_INTR_TYPE: 651 case IOC4_OTHER_INTR_TYPE:
691 switch (which) { 652 switch (which) {
692 case IOC4_W_IES: 653 case IOC4_W_IES:
693 writel(val, &mem->other_ies_ro); 654 writel(val, &mem->other_ies.raw);
694 break; 655 break;
695 656
696 case IOC4_W_IEC: 657 case IOC4_W_IEC:
697 writel(val, &mem->other_iec_ro); 658 writel(val, &mem->other_iec.raw);
698 break; 659 break;
699 } 660 }
700 break; 661 break;
@@ -747,7 +708,8 @@ static int set_baud(struct ioc4_port *port, int baud)
747 */ 708 */
748static struct ioc4_port *get_ioc4_port(struct uart_port *the_port) 709static struct ioc4_port *get_ioc4_port(struct uart_port *the_port)
749{ 710{
750 struct ioc4_control *control = dev_get_drvdata(the_port->dev); 711 struct ioc4_driver_data *idd = dev_get_drvdata(the_port->dev);
712 struct ioc4_control *control = idd->idd_serial_data;
751 int ii; 713 int ii;
752 714
753 if (control) { 715 if (control) {
@@ -782,7 +744,7 @@ static struct ioc4_port *get_ioc4_port(struct uart_port *the_port)
782static inline uint32_t 744static inline uint32_t
783pending_intrs(struct ioc4_soft *soft, int type) 745pending_intrs(struct ioc4_soft *soft, int type)
784{ 746{
785 struct ioc4_mem __iomem *mem = soft->is_ioc4_mem_addr; 747 struct ioc4_misc_regs __iomem *mem = soft->is_ioc4_misc_addr;
786 unsigned long flag; 748 unsigned long flag;
787 uint32_t intrs = 0; 749 uint32_t intrs = 0;
788 750
@@ -793,11 +755,11 @@ pending_intrs(struct ioc4_soft *soft, int type)
793 755
794 switch (type) { 756 switch (type) {
795 case IOC4_SIO_INTR_TYPE: 757 case IOC4_SIO_INTR_TYPE:
796 intrs = readl(&mem->sio_ir) & readl(&mem->sio_ies_ro); 758 intrs = readl(&mem->sio_ir.raw) & readl(&mem->sio_ies.raw);
797 break; 759 break;
798 760
799 case IOC4_OTHER_INTR_TYPE: 761 case IOC4_OTHER_INTR_TYPE:
800 intrs = readl(&mem->other_ir) & readl(&mem->other_ies_ro); 762 intrs = readl(&mem->other_ir.raw) & readl(&mem->other_ies.raw);
801 763
802 /* Don't process any ATA interrupte */ 764 /* Don't process any ATA interrupte */
803 intrs &= ~(IOC4_OTHER_IR_ATA_INT | IOC4_OTHER_IR_ATA_MEMERR); 765 intrs &= ~(IOC4_OTHER_IR_ATA_INT | IOC4_OTHER_IR_ATA_MEMERR);
@@ -826,7 +788,7 @@ static int inline port_init(struct ioc4_port *port)
826 788
827 /* Wait until any pending bus activity for this port has ceased */ 789 /* Wait until any pending bus activity for this port has ceased */
828 do 790 do
829 sio_cr = readl(&port->ip_mem->sio_cr); 791 sio_cr = readl(&port->ip_mem->sio_cr.raw);
830 while (!(sio_cr & IOC4_SIO_CR_SIO_DIAG_IDLE)); 792 while (!(sio_cr & IOC4_SIO_CR_SIO_DIAG_IDLE));
831 793
832 /* Finish reset sequence */ 794 /* Finish reset sequence */
@@ -899,7 +861,7 @@ static int inline port_init(struct ioc4_port *port)
899 write_ireg(port->ip_ioc4_soft, hooks->intr_clear, 861 write_ireg(port->ip_ioc4_soft, hooks->intr_clear,
900 IOC4_W_IEC, IOC4_SIO_INTR_TYPE); 862 IOC4_W_IEC, IOC4_SIO_INTR_TYPE);
901 port->ip_ienb &= ~hooks->intr_clear; 863 port->ip_ienb &= ~hooks->intr_clear;
902 writel(hooks->intr_clear, &port->ip_mem->sio_ir); 864 writel(hooks->intr_clear, &port->ip_mem->sio_ir.raw);
903 return 0; 865 return 0;
904} 866}
905 867
@@ -918,23 +880,23 @@ static void handle_dma_error_intr(void *arg, uint32_t other_ir)
918 spin_lock_irqsave(&port->ip_lock, flags); 880 spin_lock_irqsave(&port->ip_lock, flags);
919 881
920 /* ACK the interrupt */ 882 /* ACK the interrupt */
921 writel(hooks->intr_dma_error, &port->ip_mem->other_ir); 883 writel(hooks->intr_dma_error, &port->ip_mem->other_ir.raw);
922 884
923 if (readl(&port->ip_mem->pci_err_addr_l) & IOC4_PCI_ERR_ADDR_VLD) { 885 if (readl(&port->ip_mem->pci_err_addr_l.raw) & IOC4_PCI_ERR_ADDR_VLD) {
924 printk(KERN_ERR 886 printk(KERN_ERR
925 "PCI error address is 0x%lx, " 887 "PCI error address is 0x%lx, "
926 "master is serial port %c %s\n", 888 "master is serial port %c %s\n",
927 (((uint64_t)readl(&port->ip_mem->pci_err_addr_h) 889 (((uint64_t)readl(&port->ip_mem->pci_err_addr_h)
928 << 32) 890 << 32)
929 | readl(&port->ip_mem->pci_err_addr_l)) 891 | readl(&port->ip_mem->pci_err_addr_l.raw))
930 & IOC4_PCI_ERR_ADDR_ADDR_MSK, '1' + 892 & IOC4_PCI_ERR_ADDR_ADDR_MSK, '1' +
931 ((char)(readl(&port->ip_mem-> pci_err_addr_l) & 893 ((char)(readl(&port->ip_mem->pci_err_addr_l.raw) &
932 IOC4_PCI_ERR_ADDR_MST_NUM_MSK) >> 1), 894 IOC4_PCI_ERR_ADDR_MST_NUM_MSK) >> 1),
933 (readl(&port->ip_mem->pci_err_addr_l) 895 (readl(&port->ip_mem->pci_err_addr_l.raw)
934 & IOC4_PCI_ERR_ADDR_MST_TYP_MSK) 896 & IOC4_PCI_ERR_ADDR_MST_TYP_MSK)
935 ? "RX" : "TX"); 897 ? "RX" : "TX");
936 898
937 if (readl(&port->ip_mem->pci_err_addr_l) 899 if (readl(&port->ip_mem->pci_err_addr_l.raw)
938 & IOC4_PCI_ERR_ADDR_MUL_ERR) { 900 & IOC4_PCI_ERR_ADDR_MUL_ERR) {
939 printk(KERN_ERR 901 printk(KERN_ERR
940 "Multiple errors occurred\n"); 902 "Multiple errors occurred\n");
@@ -1018,26 +980,26 @@ static irqreturn_t ioc4_intr(int irq, void *arg, struct pt_regs *regs)
1018 "other_ies = 0x%x\n", 980 "other_ies = 0x%x\n",
1019 (intr_type == IOC4_SIO_INTR_TYPE) ? "sio" : 981 (intr_type == IOC4_SIO_INTR_TYPE) ? "sio" :
1020 "other", this_ir, 982 "other", this_ir,
1021 readl(&soft->is_ioc4_mem_addr->sio_ir), 983 readl(&soft->is_ioc4_misc_addr->sio_ir.raw),
1022 readl(&soft->is_ioc4_mem_addr->sio_ies_ro), 984 readl(&soft->is_ioc4_misc_addr->sio_ies.raw),
1023 readl(&soft->is_ioc4_mem_addr->other_ir), 985 readl(&soft->is_ioc4_misc_addr->other_ir.raw),
1024 readl(&soft->is_ioc4_mem_addr->other_ies_ro)); 986 readl(&soft->is_ioc4_misc_addr->other_ies.raw));
1025 } 987 }
1026 } 988 }
1027#ifdef DEBUG_INTERRUPTS 989#ifdef DEBUG_INTERRUPTS
1028 { 990 {
1029 struct ioc4_mem __iomem *mem = soft->is_ioc4_mem_addr; 991 struct ioc4_misc_regs __iomem *mem = soft->is_ioc4_misc_addr;
1030 spinlock_t *lp = &soft->is_ir_lock; 992 spinlock_t *lp = &soft->is_ir_lock;
1031 unsigned long flag; 993 unsigned long flag;
1032 994
1033 spin_lock_irqsave(&soft->is_ir_lock, flag); 995 spin_lock_irqsave(&soft->is_ir_lock, flag);
1034 printk ("%s : %d : mem 0x%p sio_ir 0x%x sio_ies_ro 0x%x " 996 printk ("%s : %d : mem 0x%p sio_ir 0x%x sio_ies 0x%x "
1035 "other_ir 0x%x other_ies_ro 0x%x mask 0x%x\n", 997 "other_ir 0x%x other_ies 0x%x mask 0x%x\n",
1036 __FUNCTION__, __LINE__, 998 __FUNCTION__, __LINE__,
1037 (void *)mem, readl(&mem->sio_ir), 999 (void *)mem, readl(&mem->sio_ir.raw),
1038 readl(&mem->sio_ies_ro), 1000 readl(&mem->sio_ies.raw),
1039 readl(&mem->other_ir), 1001 readl(&mem->other_ir.raw),
1040 readl(&mem->other_ies_ro), 1002 readl(&mem->other_ies.raw),
1041 IOC4_OTHER_IR_ATA_INT | IOC4_OTHER_IR_ATA_MEMERR); 1003 IOC4_OTHER_IR_ATA_INT | IOC4_OTHER_IR_ATA_MEMERR);
1042 spin_unlock_irqrestore(&soft->is_ir_lock, flag); 1004 spin_unlock_irqrestore(&soft->is_ir_lock, flag);
1043 } 1005 }
@@ -1049,21 +1011,20 @@ static irqreturn_t ioc4_intr(int irq, void *arg, struct pt_regs *regs)
1049 * ioc4_attach_local - Device initialization. 1011 * ioc4_attach_local - Device initialization.
1050 * Called at *_attach() time for each 1012 * Called at *_attach() time for each
1051 * IOC4 with serial ports in the system. 1013 * IOC4 with serial ports in the system.
1052 * @control: ioc4_control ptr 1014 * @idd: Master module data for this IOC4
1053 * @pdev: PCI handle for this device
1054 * @soft: soft struct for this device
1055 * @ioc4: ioc4 mem space
1056 */ 1015 */
1057static int inline ioc4_attach_local(struct pci_dev *pdev, 1016static int inline ioc4_attach_local(struct ioc4_driver_data *idd)
1058 struct ioc4_control *control,
1059 struct ioc4_soft *soft, void __iomem *ioc4_mem,
1060 void __iomem *ioc4_serial)
1061{ 1017{
1062 struct ioc4_port *port; 1018 struct ioc4_port *port;
1063 struct ioc4_port *ports[IOC4_NUM_SERIAL_PORTS]; 1019 struct ioc4_port *ports[IOC4_NUM_SERIAL_PORTS];
1064 int port_number; 1020 int port_number;
1065 uint16_t ioc4_revid_min = 62; 1021 uint16_t ioc4_revid_min = 62;
1066 uint16_t ioc4_revid; 1022 uint16_t ioc4_revid;
1023 struct pci_dev *pdev = idd->idd_pdev;
1024 struct ioc4_control* control = idd->idd_serial_data;
1025 struct ioc4_soft *soft = control->ic_soft;
1026 void __iomem *ioc4_misc = idd->idd_misc_regs;
1027 void __iomem *ioc4_serial = soft->is_ioc4_serial_addr;
1067 1028
1068 /* IOC4 firmware must be at least rev 62 */ 1029 /* IOC4 firmware must be at least rev 62 */
1069 pci_read_config_word(pdev, PCI_COMMAND_SPECIAL, &ioc4_revid); 1030 pci_read_config_word(pdev, PCI_COMMAND_SPECIAL, &ioc4_revid);
@@ -1076,7 +1037,7 @@ static int inline ioc4_attach_local(struct pci_dev *pdev,
1076 ioc4_revid, ioc4_revid_min); 1037 ioc4_revid, ioc4_revid_min);
1077 return -EPERM; 1038 return -EPERM;
1078 } 1039 }
1079 BUG_ON(ioc4_mem == NULL); 1040 BUG_ON(ioc4_misc == NULL);
1080 BUG_ON(ioc4_serial == NULL); 1041 BUG_ON(ioc4_serial == NULL);
1081 1042
1082 /* Create port structures for each port */ 1043 /* Create port structures for each port */
@@ -1100,10 +1061,18 @@ static int inline ioc4_attach_local(struct pci_dev *pdev,
1100 port->ip_ioc4_soft = soft; 1061 port->ip_ioc4_soft = soft;
1101 port->ip_pdev = pdev; 1062 port->ip_pdev = pdev;
1102 port->ip_ienb = 0; 1063 port->ip_ienb = 0;
1103 port->ip_pci_bus_speed = IOC4_SER_XIN_CLK; 1064 /* Use baud rate calculations based on detected PCI
1065 * bus speed. Simply test whether the PCI clock is
1066 * running closer to 66MHz or 33MHz.
1067 */
1068 if (idd->count_period/IOC4_EXTINT_COUNT_DIVISOR < 20) {
1069 port->ip_pci_bus_speed = IOC4_SER_XIN_CLK_66;
1070 } else {
1071 port->ip_pci_bus_speed = IOC4_SER_XIN_CLK_33;
1072 }
1104 port->ip_baud = 9600; 1073 port->ip_baud = 9600;
1105 port->ip_control = control; 1074 port->ip_control = control;
1106 port->ip_mem = ioc4_mem; 1075 port->ip_mem = ioc4_misc;
1107 port->ip_serial = ioc4_serial; 1076 port->ip_serial = ioc4_serial;
1108 1077
1109 /* point to the right hook */ 1078 /* point to the right hook */
@@ -1604,14 +1573,12 @@ static int ioc4_set_proto(struct ioc4_port *port, enum sio_proto proto)
1604 switch (proto) { 1573 switch (proto) {
1605 case PROTO_RS232: 1574 case PROTO_RS232:
1606 /* Clear the appropriate GIO pin */ 1575 /* Clear the appropriate GIO pin */
1607 writel(0, (&port->ip_mem->gppr_0 + 1576 writel(0, (&port->ip_mem->gppr[hooks->rs422_select_pin].raw));
1608 hooks->rs422_select_pin));
1609 break; 1577 break;
1610 1578
1611 case PROTO_RS422: 1579 case PROTO_RS422:
1612 /* Set the appropriate GIO pin */ 1580 /* Set the appropriate GIO pin */
1613 writel(1, (&port->ip_mem->gppr_0 + 1581 writel(1, (&port->ip_mem->gppr[hooks->rs422_select_pin].raw));
1614 hooks->rs422_select_pin));
1615 break; 1582 break;
1616 1583
1617 default: 1584 default:
@@ -1885,7 +1852,7 @@ static void handle_intr(void *arg, uint32_t sio_ir)
1885 if (sio_ir & hooks->intr_delta_dcd) { 1852 if (sio_ir & hooks->intr_delta_dcd) {
1886 /* ACK the interrupt */ 1853 /* ACK the interrupt */
1887 writel(hooks->intr_delta_dcd, 1854 writel(hooks->intr_delta_dcd,
1888 &port->ip_mem->sio_ir); 1855 &port->ip_mem->sio_ir.raw);
1889 1856
1890 shadow = readl(&port->ip_serial_regs->shadow); 1857 shadow = readl(&port->ip_serial_regs->shadow);
1891 1858
@@ -1907,7 +1874,7 @@ static void handle_intr(void *arg, uint32_t sio_ir)
1907 if (sio_ir & hooks->intr_delta_cts) { 1874 if (sio_ir & hooks->intr_delta_cts) {
1908 /* ACK the interrupt */ 1875 /* ACK the interrupt */
1909 writel(hooks->intr_delta_cts, 1876 writel(hooks->intr_delta_cts,
1910 &port->ip_mem->sio_ir); 1877 &port->ip_mem->sio_ir.raw);
1911 1878
1912 shadow = readl(&port->ip_serial_regs->shadow); 1879 shadow = readl(&port->ip_serial_regs->shadow);
1913 1880
@@ -1928,7 +1895,7 @@ static void handle_intr(void *arg, uint32_t sio_ir)
1928 if (sio_ir & hooks->intr_rx_timer) { 1895 if (sio_ir & hooks->intr_rx_timer) {
1929 /* ACK the interrupt */ 1896 /* ACK the interrupt */
1930 writel(hooks->intr_rx_timer, 1897 writel(hooks->intr_rx_timer,
1931 &port->ip_mem->sio_ir); 1898 &port->ip_mem->sio_ir.raw);
1932 1899
1933 if ((port->ip_notify & N_DATA_READY) 1900 if ((port->ip_notify & N_DATA_READY)
1934 && (port->ip_port)) { 1901 && (port->ip_port)) {
@@ -1974,7 +1941,7 @@ static void handle_intr(void *arg, uint32_t sio_ir)
1974 1941
1975 /* ACK the interrupt */ 1942 /* ACK the interrupt */
1976 writel(hooks->intr_tx_explicit, 1943 writel(hooks->intr_tx_explicit,
1977 &port->ip_mem->sio_ir); 1944 &port->ip_mem->sio_ir.raw);
1978 1945
1979 if (port->ip_notify & N_OUTPUT_LOWAT) 1946 if (port->ip_notify & N_OUTPUT_LOWAT)
1980 ioc4_cb_output_lowat(port); 1947 ioc4_cb_output_lowat(port);
@@ -2634,7 +2601,8 @@ ioc4_serial_core_attach(struct pci_dev *pdev)
2634{ 2601{
2635 struct ioc4_port *port; 2602 struct ioc4_port *port;
2636 struct uart_port *the_port; 2603 struct uart_port *the_port;
2637 struct ioc4_control *control = pci_get_drvdata(pdev); 2604 struct ioc4_driver_data *idd = pci_get_drvdata(pdev);
2605 struct ioc4_control *control = idd->idd_serial_data;
2638 int ii; 2606 int ii;
2639 2607
2640 DPRINT_CONFIG(("%s: attach pdev 0x%p - control 0x%p\n", 2608 DPRINT_CONFIG(("%s: attach pdev 0x%p - control 0x%p\n",
@@ -2680,55 +2648,29 @@ ioc4_serial_core_attach(struct pci_dev *pdev)
2680 2648
2681/** 2649/**
2682 * ioc4_serial_attach_one - register attach function 2650 * ioc4_serial_attach_one - register attach function
2683 * called per card found from ioc4_serial_detect as part 2651 * called per card found from IOC4 master module.
2684 * of module_init(). 2652 * @idd: Master module data for this IOC4
2685 * @pdev: handle for this card
2686 * @pci_id: pci id for this card
2687 */ 2653 */
2688int 2654int
2689ioc4_serial_attach_one(struct pci_dev *pdev, const struct pci_device_id *pci_id) 2655ioc4_serial_attach_one(struct ioc4_driver_data *idd)
2690{ 2656{
2691 struct ioc4_mem __iomem *mem; 2657 unsigned long tmp_addr1;
2692 unsigned long tmp_addr, tmp_addr1;
2693 struct ioc4_serial __iomem *serial; 2658 struct ioc4_serial __iomem *serial;
2694 struct ioc4_soft *soft; 2659 struct ioc4_soft *soft;
2695 struct ioc4_control *control; 2660 struct ioc4_control *control;
2696 int tmp, ret = 0; 2661 int ret = 0;
2697 2662
2698 2663
2699 DPRINT_CONFIG(("%s (0x%p, 0x%p)\n", __FUNCTION__, pdev, pci_id)); 2664 DPRINT_CONFIG(("%s (0x%p, 0x%p)\n", __FUNCTION__, idd->idd_pdev, idd->idd_pci_id));
2700
2701 /* Map in the ioc4 memory */
2702 tmp_addr = pci_resource_start(pdev, 0);
2703 if (!tmp_addr) {
2704 printk(KERN_WARNING
2705 "ioc4 (%p) : unable to get PIO mapping for "
2706 "MEM space\n", (void *)pdev);
2707 return -ENODEV;
2708 }
2709 if (!request_region(tmp_addr, sizeof(struct ioc4_mem), "sioc4_mem")) {
2710 printk(KERN_ALERT
2711 "ioc4 (%p): unable to get request region for "
2712 "MEM space\n", (void *)pdev);
2713 return -ENODEV;
2714 }
2715 mem = ioremap(tmp_addr, sizeof(struct ioc4_mem));
2716 if (!mem) {
2717 printk(KERN_WARNING
2718 "ioc4 (%p) : unable to remap ioc4 memory\n",
2719 (void *)pdev);
2720 ret = -ENODEV;
2721 goto out1;
2722 }
2723 2665
2724 /* request serial registers */ 2666 /* request serial registers */
2725 tmp_addr1 = pci_resource_start(pdev, 0) + IOC4_SERIAL_OFFSET; 2667 tmp_addr1 = idd->idd_bar0 + IOC4_SERIAL_OFFSET;
2726 2668
2727 if (!request_region(tmp_addr1, sizeof(struct ioc4_serial), 2669 if (!request_region(tmp_addr1, sizeof(struct ioc4_serial),
2728 "sioc4_uart")) { 2670 "sioc4_uart")) {
2729 printk(KERN_WARNING 2671 printk(KERN_WARNING
2730 "ioc4 (%p): unable to get request region for " 2672 "ioc4 (%p): unable to get request region for "
2731 "uart space\n", (void *)pdev); 2673 "uart space\n", (void *)idd->idd_pdev);
2732 ret = -ENODEV; 2674 ret = -ENODEV;
2733 goto out1; 2675 goto out1;
2734 } 2676 }
@@ -2736,12 +2678,12 @@ ioc4_serial_attach_one(struct pci_dev *pdev, const struct pci_device_id *pci_id)
2736 if (!serial) { 2678 if (!serial) {
2737 printk(KERN_WARNING 2679 printk(KERN_WARNING
2738 "ioc4 (%p) : unable to remap ioc4 serial register\n", 2680 "ioc4 (%p) : unable to remap ioc4 serial register\n",
2739 (void *)pdev); 2681 (void *)idd->idd_pdev);
2740 ret = -ENODEV; 2682 ret = -ENODEV;
2741 goto out2; 2683 goto out2;
2742 } 2684 }
2743 DPRINT_CONFIG(("%s : mem 0x%p, serial 0x%p\n", 2685 DPRINT_CONFIG(("%s : mem 0x%p, serial 0x%p\n",
2744 __FUNCTION__, (void *)mem, (void *)serial)); 2686 __FUNCTION__, (void *)idd->idd_misc_regs, (void *)serial));
2745 2687
2746 /* Get memory for the new card */ 2688 /* Get memory for the new card */
2747 control = kmalloc(sizeof(struct ioc4_control) * IOC4_NUM_SERIAL_PORTS, 2689 control = kmalloc(sizeof(struct ioc4_control) * IOC4_NUM_SERIAL_PORTS,
@@ -2754,59 +2696,56 @@ ioc4_serial_attach_one(struct pci_dev *pdev, const struct pci_device_id *pci_id)
2754 goto out2; 2696 goto out2;
2755 } 2697 }
2756 memset(control, 0, sizeof(struct ioc4_control)); 2698 memset(control, 0, sizeof(struct ioc4_control));
2757 pci_set_drvdata(pdev, control); 2699 idd->idd_serial_data = control;
2758 2700
2759 /* Allocate the soft structure */ 2701 /* Allocate the soft structure */
2760 soft = kmalloc(sizeof(struct ioc4_soft), GFP_KERNEL); 2702 soft = kmalloc(sizeof(struct ioc4_soft), GFP_KERNEL);
2761 if (!soft) { 2703 if (!soft) {
2762 printk(KERN_WARNING 2704 printk(KERN_WARNING
2763 "ioc4 (%p): unable to get memory for the soft struct\n", 2705 "ioc4 (%p): unable to get memory for the soft struct\n",
2764 (void *)pdev); 2706 (void *)idd->idd_pdev);
2765 ret = -ENOMEM; 2707 ret = -ENOMEM;
2766 goto out3; 2708 goto out3;
2767 } 2709 }
2768 memset(soft, 0, sizeof(struct ioc4_soft)); 2710 memset(soft, 0, sizeof(struct ioc4_soft));
2769 2711
2770 spin_lock_init(&soft->is_ir_lock); 2712 spin_lock_init(&soft->is_ir_lock);
2771 soft->is_ioc4_mem_addr = mem; 2713 soft->is_ioc4_misc_addr = idd->idd_misc_regs;
2772 soft->is_ioc4_serial_addr = serial; 2714 soft->is_ioc4_serial_addr = serial;
2773 2715
2774 /* Init the IOC4 */ 2716 /* Init the IOC4 */
2775 pci_read_config_dword(pdev, PCI_COMMAND, &tmp); 2717 writel(0xf << IOC4_SIO_CR_CMD_PULSE_SHIFT,
2776 pci_write_config_dword(pdev, PCI_COMMAND, 2718 &idd->idd_misc_regs->sio_cr.raw);
2777 tmp | PCI_COMMAND_PARITY | PCI_COMMAND_SERR);
2778
2779 writel(0xf << IOC4_SIO_CR_CMD_PULSE_SHIFT, &mem->sio_cr);
2780 2719
2781 /* Enable serial port mode select generic PIO pins as outputs */ 2720 /* Enable serial port mode select generic PIO pins as outputs */
2782 writel(IOC4_GPCR_UART0_MODESEL | IOC4_GPCR_UART1_MODESEL 2721 writel(IOC4_GPCR_UART0_MODESEL | IOC4_GPCR_UART1_MODESEL
2783 | IOC4_GPCR_UART2_MODESEL | IOC4_GPCR_UART3_MODESEL, 2722 | IOC4_GPCR_UART2_MODESEL | IOC4_GPCR_UART3_MODESEL,
2784 &mem->gpcr_s); 2723 &idd->idd_misc_regs->gpcr_s.raw);
2785 2724
2786 /* Clear and disable all interrupts */ 2725 /* Clear and disable all serial interrupts */
2787 write_ireg(soft, ~0, IOC4_W_IEC, IOC4_SIO_INTR_TYPE); 2726 write_ireg(soft, ~0, IOC4_W_IEC, IOC4_SIO_INTR_TYPE);
2788 writel(~0, &mem->sio_ir); 2727 writel(~0, &idd->idd_misc_regs->sio_ir.raw);
2789 write_ireg(soft, ~(IOC4_OTHER_IR_ATA_INT | IOC4_OTHER_IR_ATA_MEMERR), 2728 write_ireg(soft, IOC4_OTHER_IR_SER_MEMERR, IOC4_W_IEC,
2790 IOC4_W_IEC, IOC4_OTHER_INTR_TYPE); 2729 IOC4_OTHER_INTR_TYPE);
2791 writel(~(IOC4_OTHER_IR_ATA_MEMERR | IOC4_OTHER_IR_ATA_MEMERR), 2730 writel(IOC4_OTHER_IR_SER_MEMERR, &idd->idd_misc_regs->other_ir.raw);
2792 &mem->other_ir);
2793 control->ic_soft = soft; 2731 control->ic_soft = soft;
2794 if (!request_irq(pdev->irq, ioc4_intr, SA_SHIRQ, 2732
2733 /* Hook up interrupt handler */
2734 if (!request_irq(idd->idd_pdev->irq, ioc4_intr, SA_SHIRQ,
2795 "sgi-ioc4serial", (void *)soft)) { 2735 "sgi-ioc4serial", (void *)soft)) {
2796 control->ic_irq = pdev->irq; 2736 control->ic_irq = idd->idd_pdev->irq;
2797 } else { 2737 } else {
2798 printk(KERN_WARNING 2738 printk(KERN_WARNING
2799 "%s : request_irq fails for IRQ 0x%x\n ", 2739 "%s : request_irq fails for IRQ 0x%x\n ",
2800 __FUNCTION__, pdev->irq); 2740 __FUNCTION__, idd->idd_pdev->irq);
2801 } 2741 }
2802 if ((ret = ioc4_attach_local(pdev, control, soft, 2742 ret = ioc4_attach_local(idd);
2803 soft->is_ioc4_mem_addr, 2743 if (ret)
2804 soft->is_ioc4_serial_addr)))
2805 goto out4; 2744 goto out4;
2806 2745
2807 /* register port with the serial core */ 2746 /* register port with the serial core */
2808 2747
2809 if ((ret = ioc4_serial_core_attach(pdev))) 2748 if ((ret = ioc4_serial_core_attach(idd->idd_pdev)))
2810 goto out4; 2749 goto out4;
2811 2750
2812 return ret; 2751 return ret;
@@ -2819,7 +2758,6 @@ out3:
2819out2: 2758out2:
2820 release_region(tmp_addr1, sizeof(struct ioc4_serial)); 2759 release_region(tmp_addr1, sizeof(struct ioc4_serial));
2821out1: 2760out1:
2822 release_region(tmp_addr, sizeof(struct ioc4_mem));
2823 2761
2824 return ret; 2762 return ret;
2825} 2763}
@@ -2828,11 +2766,10 @@ out1:
2828/** 2766/**
2829 * ioc4_serial_remove_one - detach function 2767 * ioc4_serial_remove_one - detach function
2830 * 2768 *
2831 * @pdev: handle for this card 2769 * @idd: IOC4 master module data for this IOC4
2832 */ 2770 */
2833 2771
2834#if 0 2772int ioc4_serial_remove_one(struct ioc4_driver_data *idd)
2835void ioc4_serial_remove_one(struct pci_dev *pdev)
2836{ 2773{
2837 int ii; 2774 int ii;
2838 struct ioc4_control *control; 2775 struct ioc4_control *control;
@@ -2840,7 +2777,7 @@ void ioc4_serial_remove_one(struct pci_dev *pdev)
2840 struct ioc4_port *port; 2777 struct ioc4_port *port;
2841 struct ioc4_soft *soft; 2778 struct ioc4_soft *soft;
2842 2779
2843 control = pci_get_drvdata(pdev); 2780 control = idd->idd_serial_data;
2844 2781
2845 for (ii = 0; ii < IOC4_NUM_SERIAL_PORTS; ii++) { 2782 for (ii = 0; ii < IOC4_NUM_SERIAL_PORTS; ii++) {
2846 the_port = &control->ic_port[ii].icp_uart_port; 2783 the_port = &control->ic_port[ii].icp_uart_port;
@@ -2867,10 +2804,17 @@ void ioc4_serial_remove_one(struct pci_dev *pdev)
2867 kfree(soft); 2804 kfree(soft);
2868 } 2805 }
2869 kfree(control); 2806 kfree(control);
2870 pci_set_drvdata(pdev, NULL); 2807 idd->idd_serial_data = NULL;
2871 uart_unregister_driver(&ioc4_uart); 2808
2809 return 0;
2872} 2810}
2873#endif 2811
2812static struct ioc4_submodule ioc4_serial_submodule = {
2813 .is_name = "IOC4_serial",
2814 .is_owner = THIS_MODULE,
2815 .is_probe = ioc4_serial_attach_one,
2816 .is_remove = ioc4_serial_remove_one,
2817};
2874 2818
2875/** 2819/**
2876 * ioc4_serial_init - module init 2820 * ioc4_serial_init - module init
@@ -2886,12 +2830,20 @@ int ioc4_serial_init(void)
2886 __FUNCTION__); 2830 __FUNCTION__);
2887 return ret; 2831 return ret;
2888 } 2832 }
2889 return 0; 2833
2834 /* register with IOC4 main module */
2835 return ioc4_register_submodule(&ioc4_serial_submodule);
2836}
2837
2838static void __devexit ioc4_serial_exit(void)
2839{
2840 ioc4_unregister_submodule(&ioc4_serial_submodule);
2841 uart_unregister_driver(&ioc4_uart);
2890} 2842}
2891 2843
2844module_init(ioc4_serial_init);
2845module_exit(ioc4_serial_exit);
2846
2892MODULE_AUTHOR("Pat Gefre - Silicon Graphics Inc. (SGI) <pfg@sgi.com>"); 2847MODULE_AUTHOR("Pat Gefre - Silicon Graphics Inc. (SGI) <pfg@sgi.com>");
2893MODULE_DESCRIPTION("Serial PCI driver module for SGI IOC4 Base-IO Card"); 2848MODULE_DESCRIPTION("Serial PCI driver module for SGI IOC4 Base-IO Card");
2894MODULE_LICENSE("GPL"); 2849MODULE_LICENSE("GPL");
2895
2896EXPORT_SYMBOL(ioc4_serial_init);
2897EXPORT_SYMBOL(ioc4_serial_attach_one);
diff --git a/drivers/sn/Kconfig b/drivers/sn/Kconfig
new file mode 100644
index 000000000000..13b8d249da5c
--- /dev/null
+++ b/drivers/sn/Kconfig
@@ -0,0 +1,20 @@
1#
2# Miscellaneous SN-specific devices
3#
4
5menu "SN Devices"
6
7config SGI_IOC4
8 tristate "SGI IOC4 Base IO support"
9 depends on (IA64_GENERIC || IA64_SGI_SN2) && MMTIMER
10 default m
11 ---help---
12 This option enables basic support for the SGI IOC4-based Base IO
13 controller card. This option does not enable any specific
14 functions on such a card, but provides necessary infrastructure
15 for other drivers to utilize.
16
17 If you have an SGI Altix with an IOC4-based
18 I/O controller say Y. Otherwise say N.
19
20endmenu
diff --git a/drivers/sn/Makefile b/drivers/sn/Makefile
index 631e54958448..c2a284185372 100644
--- a/drivers/sn/Makefile
+++ b/drivers/sn/Makefile
@@ -3,4 +3,4 @@
3# 3#
4# 4#
5 5
6obj-$(CONFIG_BLK_DEV_SGIIOC4) += ioc4.o 6obj-$(CONFIG_SGI_IOC4) += ioc4.o
diff --git a/drivers/sn/ioc4.c b/drivers/sn/ioc4.c
index d9e4ee280e5f..ea75b3d0612b 100644
--- a/drivers/sn/ioc4.c
+++ b/drivers/sn/ioc4.c
@@ -6,60 +6,422 @@
6 * Copyright (C) 2005 Silicon Graphics, Inc. All Rights Reserved. 6 * Copyright (C) 2005 Silicon Graphics, Inc. All Rights Reserved.
7 */ 7 */
8 8
9/* 9/* This file contains the master driver module for use by SGI IOC4 subdrivers.
10 * This file contains a shim driver for the IOC4 IDE and serial drivers. 10 *
11 * It allocates any resources shared between multiple subdevices, and
12 * provides accessor functions (where needed) and the like for those
13 * resources. It also provides a mechanism for the subdevice modules
14 * to support loading and unloading.
15 *
16 * Non-shared resources (e.g. external interrupt A_INT_OUT register page
17 * alias, serial port and UART registers) are handled by the subdevice
18 * modules themselves.
19 *
20 * This is all necessary because IOC4 is not implemented as a multi-function
21 * PCI device, but an amalgamation of disparate registers for several
22 * types of device (ATA, serial, external interrupts). The normal
23 * resource management in the kernel doesn't have quite the right interfaces
24 * to handle this situation (e.g. multiple modules can't claim the same
25 * PCI ID), thus this IOC4 master module.
11 */ 26 */
12 27
13#include <linux/errno.h> 28#include <linux/errno.h>
14#include <linux/module.h> 29#include <linux/module.h>
15#include <linux/pci.h> 30#include <linux/pci.h>
16#include <linux/ioc4_common.h> 31#include <linux/ioc4.h>
17#include <linux/ide.h> 32#include <linux/mmtimer.h>
33#include <linux/rtc.h>
34#include <linux/rwsem.h>
35#include <asm/sn/addrs.h>
36#include <asm/sn/clksupport.h>
37#include <asm/sn/shub_mmr.h>
18 38
39/***************
40 * Definitions *
41 ***************/
19 42
20static int __devinit 43/* Tweakable values */
21ioc4_probe_one(struct pci_dev *pdev, const struct pci_device_id *pci_id) 44
45/* PCI bus speed detection/calibration */
46#define IOC4_CALIBRATE_COUNT 63 /* Calibration cycle period */
47#define IOC4_CALIBRATE_CYCLES 256 /* Average over this many cycles */
48#define IOC4_CALIBRATE_DISCARD 2 /* Discard first few cycles */
49#define IOC4_CALIBRATE_LOW_MHZ 25 /* Lower bound on bus speed sanity */
50#define IOC4_CALIBRATE_HIGH_MHZ 75 /* Upper bound on bus speed sanity */
51#define IOC4_CALIBRATE_DEFAULT_MHZ 66 /* Assumed if sanity check fails */
52
53/************************
54 * Submodule management *
55 ************************/
56
57static LIST_HEAD(ioc4_devices);
58static DECLARE_RWSEM(ioc4_devices_rwsem);
59
60static LIST_HEAD(ioc4_submodules);
61static DECLARE_RWSEM(ioc4_submodules_rwsem);
62
63/* Register an IOC4 submodule */
64int
65ioc4_register_submodule(struct ioc4_submodule *is)
66{
67 struct ioc4_driver_data *idd;
68
69 down_write(&ioc4_submodules_rwsem);
70 list_add(&is->is_list, &ioc4_submodules);
71 up_write(&ioc4_submodules_rwsem);
72
73 /* Initialize submodule for each IOC4 */
74 if (!is->is_probe)
75 return 0;
76
77 down_read(&ioc4_devices_rwsem);
78 list_for_each_entry(idd, &ioc4_devices, idd_list) {
79 if (is->is_probe(idd)) {
80 printk(KERN_WARNING
81 "%s: IOC4 submodule %s probe failed "
82 "for pci_dev %s",
83 __FUNCTION__, module_name(is->is_owner),
84 pci_name(idd->idd_pdev));
85 }
86 }
87 up_read(&ioc4_devices_rwsem);
88
89 return 0;
90}
91
92/* Unregister an IOC4 submodule */
93void
94ioc4_unregister_submodule(struct ioc4_submodule *is)
95{
96 struct ioc4_driver_data *idd;
97
98 down_write(&ioc4_submodules_rwsem);
99 list_del(&is->is_list);
100 up_write(&ioc4_submodules_rwsem);
101
102 /* Remove submodule for each IOC4 */
103 if (!is->is_remove)
104 return;
105
106 down_read(&ioc4_devices_rwsem);
107 list_for_each_entry(idd, &ioc4_devices, idd_list) {
108 if (is->is_remove(idd)) {
109 printk(KERN_WARNING
110 "%s: IOC4 submodule %s remove failed "
111 "for pci_dev %s.\n",
112 __FUNCTION__, module_name(is->is_owner),
113 pci_name(idd->idd_pdev));
114 }
115 }
116 up_read(&ioc4_devices_rwsem);
117}
118
119/*********************
120 * Device management *
121 *********************/
122
123#define IOC4_CALIBRATE_LOW_LIMIT \
124 (1000*IOC4_EXTINT_COUNT_DIVISOR/IOC4_CALIBRATE_LOW_MHZ)
125#define IOC4_CALIBRATE_HIGH_LIMIT \
126 (1000*IOC4_EXTINT_COUNT_DIVISOR/IOC4_CALIBRATE_HIGH_MHZ)
127#define IOC4_CALIBRATE_DEFAULT \
128 (1000*IOC4_EXTINT_COUNT_DIVISOR/IOC4_CALIBRATE_DEFAULT_MHZ)
129
130#define IOC4_CALIBRATE_END \
131 (IOC4_CALIBRATE_CYCLES + IOC4_CALIBRATE_DISCARD)
132
133#define IOC4_INT_OUT_MODE_TOGGLE 0x7 /* Toggle INT_OUT every COUNT+1 ticks */
134
135/* Determines external interrupt output clock period of the PCI bus an
136 * IOC4 is attached to. This value can be used to determine the PCI
137 * bus speed.
138 *
139 * IOC4 has a design feature that various internal timers are derived from
140 * the PCI bus clock. This causes IOC4 device drivers to need to take the
141 * bus speed into account when setting various register values (e.g. INT_OUT
142 * register COUNT field, UART divisors, etc). Since this information is
143 * needed by several subdrivers, it is determined by the main IOC4 driver,
144 * even though the following code utilizes external interrupt registers
145 * to perform the speed calculation.
146 */
147static void
148ioc4_clock_calibrate(struct ioc4_driver_data *idd)
149{
150 extern unsigned long sn_rtc_cycles_per_second;
151 union ioc4_int_out int_out;
152 union ioc4_gpcr gpcr;
153 unsigned int state, last_state = 1;
154 uint64_t start = 0, end, period;
155 unsigned int count = 0;
156
157 /* Enable output */
158 gpcr.raw = 0;
159 gpcr.fields.dir = IOC4_GPCR_DIR_0;
160 gpcr.fields.int_out_en = 1;
161 writel(gpcr.raw, &idd->idd_misc_regs->gpcr_s.raw);
162
163 /* Reset to power-on state */
164 writel(0, &idd->idd_misc_regs->int_out.raw);
165 mmiowb();
166
167 printk(KERN_INFO
168 "%s: Calibrating PCI bus speed "
169 "for pci_dev %s ... ", __FUNCTION__, pci_name(idd->idd_pdev));
170 /* Set up square wave */
171 int_out.raw = 0;
172 int_out.fields.count = IOC4_CALIBRATE_COUNT;
173 int_out.fields.mode = IOC4_INT_OUT_MODE_TOGGLE;
174 int_out.fields.diag = 0;
175 writel(int_out.raw, &idd->idd_misc_regs->int_out.raw);
176 mmiowb();
177
178 /* Check square wave period averaged over some number of cycles */
179 do {
180 int_out.raw = readl(&idd->idd_misc_regs->int_out.raw);
181 state = int_out.fields.int_out;
182 if (!last_state && state) {
183 count++;
184 if (count == IOC4_CALIBRATE_END) {
185 end = rtc_time();
186 break;
187 } else if (count == IOC4_CALIBRATE_DISCARD)
188 start = rtc_time();
189 }
190 last_state = state;
191 } while (1);
192
193 /* Calculation rearranged to preserve intermediate precision.
194 * Logically:
195 * 1. "end - start" gives us number of RTC cycles over all the
196 * square wave cycles measured.
197 * 2. Divide by number of square wave cycles to get number of
198 * RTC cycles per square wave cycle.
199 * 3. Divide by 2*(int_out.fields.count+1), which is the formula
200 * by which the IOC4 generates the square wave, to get the
201 * number of RTC cycles per IOC4 INT_OUT count.
202 * 4. Divide by sn_rtc_cycles_per_second to get seconds per
203 * count.
204 * 5. Multiply by 1E9 to get nanoseconds per count.
205 */
206 period = ((end - start) * 1000000000) /
207 (IOC4_CALIBRATE_CYCLES * 2 * (IOC4_CALIBRATE_COUNT + 1)
208 * sn_rtc_cycles_per_second);
209
210 /* Bounds check the result. */
211 if (period > IOC4_CALIBRATE_LOW_LIMIT ||
212 period < IOC4_CALIBRATE_HIGH_LIMIT) {
213 printk("failed. Assuming PCI clock ticks are %d ns.\n",
214 IOC4_CALIBRATE_DEFAULT / IOC4_EXTINT_COUNT_DIVISOR);
215 period = IOC4_CALIBRATE_DEFAULT;
216 } else {
217 printk("succeeded. PCI clock ticks are %ld ns.\n",
218 period / IOC4_EXTINT_COUNT_DIVISOR);
219 }
220
221 /* Remember results. We store the extint clock period rather
222 * than the PCI clock period so that greater precision is
223 * retained. Divide by IOC4_EXTINT_COUNT_DIVISOR to get
224 * PCI clock period.
225 */
226 idd->count_period = period;
227}
228
229/* Adds a new instance of an IOC4 card */
230static int
231ioc4_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)
22{ 232{
233 struct ioc4_driver_data *idd;
234 struct ioc4_submodule *is;
235 uint32_t pcmd;
23 int ret; 236 int ret;
24 237
238 /* Enable IOC4 and take ownership of it */
25 if ((ret = pci_enable_device(pdev))) { 239 if ((ret = pci_enable_device(pdev))) {
26 printk(KERN_WARNING 240 printk(KERN_WARNING
27 "%s: Failed to enable device with " 241 "%s: Failed to enable IOC4 device for pci_dev %s.\n",
28 "pci_dev 0x%p... returning\n", 242 __FUNCTION__, pci_name(pdev));
29 __FUNCTION__, (void *)pdev); 243 goto out;
30 return ret;
31 } 244 }
32 pci_set_master(pdev); 245 pci_set_master(pdev);
33 246
34 /* attach each sub-device */ 247 /* Set up per-IOC4 data */
35 ret = ioc4_ide_attach_one(pdev, pci_id); 248 idd = kmalloc(sizeof(struct ioc4_driver_data), GFP_KERNEL);
36 if (ret) 249 if (!idd) {
37 return ret; 250 printk(KERN_WARNING
38 return ioc4_serial_attach_one(pdev, pci_id); 251 "%s: Failed to allocate IOC4 data for pci_dev %s.\n",
252 __FUNCTION__, pci_name(pdev));
253 ret = -ENODEV;
254 goto out_idd;
255 }
256 idd->idd_pdev = pdev;
257 idd->idd_pci_id = pci_id;
258
259 /* Map IOC4 misc registers. These are shared between subdevices
260 * so the main IOC4 module manages them.
261 */
262 idd->idd_bar0 = pci_resource_start(idd->idd_pdev, 0);
263 if (!idd->idd_bar0) {
264 printk(KERN_WARNING
265 "%s: Unable to find IOC4 misc resource "
266 "for pci_dev %s.\n",
267 __FUNCTION__, pci_name(idd->idd_pdev));
268 ret = -ENODEV;
269 goto out_pci;
270 }
271 if (!request_region(idd->idd_bar0, sizeof(struct ioc4_misc_regs),
272 "ioc4_misc")) {
273 printk(KERN_WARNING
274 "%s: Unable to request IOC4 misc region "
275 "for pci_dev %s.\n",
276 __FUNCTION__, pci_name(idd->idd_pdev));
277 ret = -ENODEV;
278 goto out_pci;
279 }
280 idd->idd_misc_regs = ioremap(idd->idd_bar0,
281 sizeof(struct ioc4_misc_regs));
282 if (!idd->idd_misc_regs) {
283 printk(KERN_WARNING
284 "%s: Unable to remap IOC4 misc region "
285 "for pci_dev %s.\n",
286 __FUNCTION__, pci_name(idd->idd_pdev));
287 ret = -ENODEV;
288 goto out_misc_region;
289 }
290
291 /* Failsafe portion of per-IOC4 initialization */
292
293 /* Initialize IOC4 */
294 pci_read_config_dword(idd->idd_pdev, PCI_COMMAND, &pcmd);
295 pci_write_config_dword(idd->idd_pdev, PCI_COMMAND,
296 pcmd | PCI_COMMAND_PARITY | PCI_COMMAND_SERR);
297
298 /* Determine PCI clock */
299 ioc4_clock_calibrate(idd);
300
301 /* Disable/clear all interrupts. Need to do this here lest
302 * one submodule request the shared IOC4 IRQ, but interrupt
303 * is generated by a different subdevice.
304 */
305 /* Disable */
306 writel(~0, &idd->idd_misc_regs->other_iec.raw);
307 writel(~0, &idd->idd_misc_regs->sio_iec);
308 /* Clear (i.e. acknowledge) */
309 writel(~0, &idd->idd_misc_regs->other_ir.raw);
310 writel(~0, &idd->idd_misc_regs->sio_ir);
311
312 /* Track PCI-device specific data */
313 idd->idd_serial_data = NULL;
314 pci_set_drvdata(idd->idd_pdev, idd);
315 down_write(&ioc4_devices_rwsem);
316 list_add(&idd->idd_list, &ioc4_devices);
317 up_write(&ioc4_devices_rwsem);
318
319 /* Add this IOC4 to all submodules */
320 down_read(&ioc4_submodules_rwsem);
321 list_for_each_entry(is, &ioc4_submodules, is_list) {
322 if (is->is_probe && is->is_probe(idd)) {
323 printk(KERN_WARNING
324 "%s: IOC4 submodule 0x%s probe failed "
325 "for pci_dev %s.\n",
326 __FUNCTION__, module_name(is->is_owner),
327 pci_name(idd->idd_pdev));
328 }
329 }
330 up_read(&ioc4_submodules_rwsem);
331
332 return 0;
333
334out_misc_region:
335 release_region(idd->idd_bar0, sizeof(struct ioc4_misc_regs));
336out_pci:
337 kfree(idd);
338out_idd:
339 pci_disable_device(pdev);
340out:
341 return ret;
39} 342}
40 343
41/* pci device struct */ 344/* Removes a particular instance of an IOC4 card. */
42static struct pci_device_id ioc4_s_id_table[] = { 345static void
346ioc4_remove(struct pci_dev *pdev)
347{
348 struct ioc4_submodule *is;
349 struct ioc4_driver_data *idd;
350
351 idd = pci_get_drvdata(pdev);
352
353 /* Remove this IOC4 from all submodules */
354 down_read(&ioc4_submodules_rwsem);
355 list_for_each_entry(is, &ioc4_submodules, is_list) {
356 if (is->is_remove && is->is_remove(idd)) {
357 printk(KERN_WARNING
358 "%s: IOC4 submodule 0x%s remove failed "
359 "for pci_dev %s.\n",
360 __FUNCTION__, module_name(is->is_owner),
361 pci_name(idd->idd_pdev));
362 }
363 }
364 up_read(&ioc4_submodules_rwsem);
365
366 /* Release resources */
367 iounmap(idd->idd_misc_regs);
368 if (!idd->idd_bar0) {
369 printk(KERN_WARNING
370 "%s: Unable to get IOC4 misc mapping for pci_dev %s. "
371 "Device removal may be incomplete.\n",
372 __FUNCTION__, pci_name(idd->idd_pdev));
373 }
374 release_region(idd->idd_bar0, sizeof(struct ioc4_misc_regs));
375
376 /* Disable IOC4 and relinquish */
377 pci_disable_device(pdev);
378
379 /* Remove and free driver data */
380 down_write(&ioc4_devices_rwsem);
381 list_del(&idd->idd_list);
382 up_write(&ioc4_devices_rwsem);
383 kfree(idd);
384}
385
386static struct pci_device_id ioc4_id_table[] = {
43 {PCI_VENDOR_ID_SGI, PCI_DEVICE_ID_SGI_IOC4, PCI_ANY_ID, 387 {PCI_VENDOR_ID_SGI, PCI_DEVICE_ID_SGI_IOC4, PCI_ANY_ID,
44 PCI_ANY_ID, 0x0b4000, 0xFFFFFF}, 388 PCI_ANY_ID, 0x0b4000, 0xFFFFFF},
45 {0} 389 {0}
46}; 390};
47MODULE_DEVICE_TABLE(pci, ioc4_s_id_table);
48 391
49static struct pci_driver __devinitdata ioc4_s_driver = { 392static struct pci_driver __devinitdata ioc4_driver = {
50 .name = "IOC4", 393 .name = "IOC4",
51 .id_table = ioc4_s_id_table, 394 .id_table = ioc4_id_table,
52 .probe = ioc4_probe_one, 395 .probe = ioc4_probe,
396 .remove = ioc4_remove,
53}; 397};
54 398
55static int __devinit ioc4_detect(void) 399MODULE_DEVICE_TABLE(pci, ioc4_id_table);
400
401/*********************
402 * Module management *
403 *********************/
404
405/* Module load */
406static int __devinit
407ioc4_init(void)
56{ 408{
57 ioc4_serial_init(); 409 return pci_register_driver(&ioc4_driver);
410}
58 411
59 return pci_register_driver(&ioc4_s_driver); 412/* Module unload */
413static void __devexit
414ioc4_exit(void)
415{
416 pci_unregister_driver(&ioc4_driver);
60} 417}
61module_init(ioc4_detect);
62 418
63MODULE_AUTHOR("Pat Gefre - Silicon Graphics Inc. (SGI) <pfg@sgi.com>"); 419module_init(ioc4_init);
64MODULE_DESCRIPTION("PCI driver module for SGI IOC4 Base-IO Card"); 420module_exit(ioc4_exit);
421
422MODULE_AUTHOR("Brent Casavant - Silicon Graphics, Inc. <bcasavan@sgi.com>");
423MODULE_DESCRIPTION("PCI driver master module for SGI IOC4 Base-IO Card");
65MODULE_LICENSE("GPL"); 424MODULE_LICENSE("GPL");
425
426EXPORT_SYMBOL(ioc4_register_submodule);
427EXPORT_SYMBOL(ioc4_unregister_submodule);
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 6be8fbec0a0e..04d3120f7236 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -322,6 +322,22 @@ config FB_FM2
322 This is the frame buffer device driver for the Amiga FrameMaster 322 This is the frame buffer device driver for the Amiga FrameMaster
323 card from BSC (exhibited 1992 but not shipped as a CBM product). 323 card from BSC (exhibited 1992 but not shipped as a CBM product).
324 324
325config FB_ARC
326 tristate "Arc Monochrome LCD board support"
327 depends on FB && X86
328 select FB_CFB_FILLRECT
329 select FB_CFB_COPYAREA
330 select FB_CFB_IMAGEBLIT
331 select FB_SOFT_CURSOR
332 help
333 This enables support for the Arc Monochrome LCD board. The board
334 is based on the KS-108 lcd controller and is typically a matrix
335 of 2*n chips. This driver was tested with a 128x64 panel. This
336 driver supports it for use with x86 SBCs through a 16 bit GPIO
337 interface (8 bit data, 8 bit control). If you anticpate using
338 this driver, say Y or M; otherwise say N. You must specify the
339 GPIO IO address to be used for setting control and data.
340
325config FB_ATARI 341config FB_ATARI
326 bool "Atari native chipset support" 342 bool "Atari native chipset support"
327 depends on (FB = y) && ATARI && BROKEN 343 depends on (FB = y) && ATARI && BROKEN
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index bd8dc0ffe723..b018df4e95c8 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -21,6 +21,7 @@ obj-$(CONFIG_FB_MACMODES) += macmodes.o
21# Hardware specific drivers go first 21# Hardware specific drivers go first
22obj-$(CONFIG_FB_RETINAZ3) += retz3fb.o 22obj-$(CONFIG_FB_RETINAZ3) += retz3fb.o
23obj-$(CONFIG_FB_AMIGA) += amifb.o c2p.o 23obj-$(CONFIG_FB_AMIGA) += amifb.o c2p.o
24obj-$(CONFIG_FB_ARC) += arcfb.o
24obj-$(CONFIG_FB_CLPS711X) += clps711xfb.o 25obj-$(CONFIG_FB_CLPS711X) += clps711xfb.o
25obj-$(CONFIG_FB_CYBER) += cyberfb.o 26obj-$(CONFIG_FB_CYBER) += cyberfb.o
26obj-$(CONFIG_FB_CYBER2000) += cyber2000fb.o 27obj-$(CONFIG_FB_CYBER2000) += cyber2000fb.o
diff --git a/drivers/video/arcfb.c b/drivers/video/arcfb.c
new file mode 100644
index 000000000000..d28457e0c063
--- /dev/null
+++ b/drivers/video/arcfb.c
@@ -0,0 +1,684 @@
1/*
2 * linux/drivers/video/arcfb.c -- FB driver for Arc monochrome LCD board
3 *
4 * Copyright (C) 2005, Jaya Kumar <jayalk@intworks.biz>
5 * http://www.intworks.biz/arclcd
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file COPYING in the main directory of this archive for
9 * more details.
10 *
11 * Layout is based on skeletonfb.c by James Simmons and Geert Uytterhoeven.
12 *
13 * This driver was written to be used with the Arc LCD board. Arc uses a
14 * set of KS108 chips that control individual 64x64 LCD matrices. The board
15 * can be paneled in a variety of setups such as 2x1=128x64, 4x4=256x256 and
16 * so on. The interface between the board and the host is TTL based GPIO. The
17 * GPIO requirements are 8 writable data lines and 4+n lines for control. On a
18 * GPIO-less system, the board can be tested by connecting the respective sigs
19 * up to a parallel port connector. The driver requires the IO addresses for
20 * data and control GPIO at load time. It is unable to probe for the
21 * existence of the LCD so it must be told at load time whether it should
22 * be enabled or not.
23 *
24 * Todo:
25 * - testing with 4x4
26 * - testing with interrupt hw
27 *
28 * General notes:
29 * - User must set tuhold. It's in microseconds. According to the 108 spec,
30 * the hold time is supposed to be at least 1 microsecond.
31 * - User must set num_cols=x num_rows=y, eg: x=2 means 128
32 * - User must set arcfb_enable=1 to enable it
33 * - User must set dio_addr=0xIOADDR cio_addr=0xIOADDR
34 *
35 */
36
37#include <linux/module.h>
38#include <linux/kernel.h>
39#include <linux/errno.h>
40#include <linux/string.h>
41#include <linux/mm.h>
42#include <linux/tty.h>
43#include <linux/slab.h>
44#include <linux/vmalloc.h>
45#include <linux/delay.h>
46#include <linux/interrupt.h>
47#include <linux/fb.h>
48#include <linux/init.h>
49#include <linux/arcfb.h>
50
51#include <asm/uaccess.h>
52
53#define floor8(a) (a&(~0x07))
54#define floorXres(a,xres) (a&(~(xres - 1)))
55#define iceil8(a) (((int)((a+7)/8))*8)
56#define ceil64(a) (a|0x3F)
57#define ceilXres(a,xres) (a|(xres - 1))
58
59/* ks108 chipset specific defines and code */
60
61#define KS_SET_DPY_START_LINE 0xC0
62#define KS_SET_PAGE_NUM 0xB8
63#define KS_SET_X 0x40
64#define KS_CEHI 0x01
65#define KS_CELO 0x00
66#define KS_SEL_CMD 0x08
67#define KS_SEL_DATA 0x00
68#define KS_DPY_ON 0x3F
69#define KS_DPY_OFF 0x3E
70#define KS_INTACK 0x40
71#define KS_CLRINT 0x02
72
73struct arcfb_par {
74 unsigned long dio_addr;
75 unsigned long cio_addr;
76 unsigned long c2io_addr;
77 atomic_t ref_count;
78 unsigned char cslut[9];
79 struct fb_info *info;
80 unsigned int irq;
81 spinlock_t lock;
82};
83
84static struct fb_fix_screeninfo arcfb_fix __initdata = {
85 .id = "arcfb",
86 .type = FB_TYPE_PACKED_PIXELS,
87 .visual = FB_VISUAL_MONO01,
88 .xpanstep = 0,
89 .ypanstep = 1,
90 .ywrapstep = 0,
91 .accel = FB_ACCEL_NONE,
92};
93
94static struct fb_var_screeninfo arcfb_var __initdata = {
95 .xres = 128,
96 .yres = 64,
97 .xres_virtual = 128,
98 .yres_virtual = 64,
99 .bits_per_pixel = 1,
100 .nonstd = 1,
101};
102
103static unsigned long num_cols;
104static unsigned long num_rows;
105static unsigned long dio_addr;
106static unsigned long cio_addr;
107static unsigned long c2io_addr;
108static unsigned long splashval;
109static unsigned long tuhold;
110static unsigned int nosplash;
111static unsigned int arcfb_enable;
112static unsigned int irq;
113
114static DECLARE_WAIT_QUEUE_HEAD(arcfb_waitq);
115
116static void ks108_writeb_ctl(struct arcfb_par *par,
117 unsigned int chipindex, unsigned char value)
118{
119 unsigned char chipselval = par->cslut[chipindex];
120
121 outb(chipselval|KS_CEHI|KS_SEL_CMD, par->cio_addr);
122 outb(value, par->dio_addr);
123 udelay(tuhold);
124 outb(chipselval|KS_CELO|KS_SEL_CMD, par->cio_addr);
125}
126
127static void ks108_writeb_mainctl(struct arcfb_par *par, unsigned char value)
128{
129
130 outb(value, par->cio_addr);
131 udelay(tuhold);
132}
133
134static unsigned char ks108_readb_ctl2(struct arcfb_par *par)
135{
136 return inb(par->c2io_addr);
137}
138
139static void ks108_writeb_data(struct arcfb_par *par,
140 unsigned int chipindex, unsigned char value)
141{
142 unsigned char chipselval = par->cslut[chipindex];
143
144 outb(chipselval|KS_CEHI|KS_SEL_DATA, par->cio_addr);
145 outb(value, par->dio_addr);
146 udelay(tuhold);
147 outb(chipselval|KS_CELO|KS_SEL_DATA, par->cio_addr);
148}
149
150static void ks108_set_start_line(struct arcfb_par *par,
151 unsigned int chipindex, unsigned char y)
152{
153 ks108_writeb_ctl(par, chipindex, KS_SET_DPY_START_LINE|y);
154}
155
156static void ks108_set_yaddr(struct arcfb_par *par,
157 unsigned int chipindex, unsigned char y)
158{
159 ks108_writeb_ctl(par, chipindex, KS_SET_PAGE_NUM|y);
160}
161
162static void ks108_set_xaddr(struct arcfb_par *par,
163 unsigned int chipindex, unsigned char x)
164{
165 ks108_writeb_ctl(par, chipindex, KS_SET_X|x);
166}
167
168static void ks108_clear_lcd(struct arcfb_par *par, unsigned int chipindex)
169{
170 int i,j;
171
172 for (i = 0; i <= 8; i++) {
173 ks108_set_yaddr(par, chipindex, i);
174 ks108_set_xaddr(par, chipindex, 0);
175 for (j = 0; j < 64; j++) {
176 ks108_writeb_data(par, chipindex,
177 (unsigned char) splashval);
178 }
179 }
180}
181
182/* main arcfb functions */
183
184static int arcfb_open(struct fb_info *info, int user)
185{
186 struct arcfb_par *par = info->par;
187
188 atomic_inc(&par->ref_count);
189 return 0;
190}
191
192static int arcfb_release(struct fb_info *info, int user)
193{
194 struct arcfb_par *par = info->par;
195 int count = atomic_read(&par->ref_count);
196
197 if (!count)
198 return -EINVAL;
199 atomic_dec(&par->ref_count);
200 return 0;
201}
202
203static int arcfb_pan_display(struct fb_var_screeninfo *var,
204 struct fb_info *info)
205{
206 int i;
207 struct arcfb_par *par = info->par;
208
209 if ((var->vmode & FB_VMODE_YWRAP) && (var->yoffset < 64)
210 && (info->var.yres <= 64)) {
211 for (i = 0; i < num_cols; i++) {
212 ks108_set_start_line(par, i, var->yoffset);
213 }
214 info->var.yoffset = var->yoffset;
215 return 0;
216 }
217
218 return -EINVAL;
219}
220
221static irqreturn_t arcfb_interrupt(int vec, void *dev_instance,
222 struct pt_regs *regs)
223{
224 struct fb_info *info = dev_instance;
225 unsigned char ctl2status;
226 struct arcfb_par *par = info->par;
227
228 ctl2status = ks108_readb_ctl2(par);
229
230 if (!(ctl2status & KS_INTACK)) /* not arc generated interrupt */
231 return IRQ_NONE;
232
233 ks108_writeb_mainctl(par, KS_CLRINT);
234
235 spin_lock(&par->lock);
236 if (waitqueue_active(&arcfb_waitq)) {
237 wake_up(&arcfb_waitq);
238 }
239 spin_unlock(&par->lock);
240
241 return IRQ_HANDLED;
242}
243
244/*
245 * here we handle a specific page on the lcd. the complexity comes from
246 * the fact that the fb is laidout in 8xX vertical columns. we extract
247 * each write of 8 vertical pixels. then we shift out as we move along
248 * X. That's what rightshift does. bitmask selects the desired input bit.
249 */
250static void arcfb_lcd_update_page(struct arcfb_par *par, unsigned int upper,
251 unsigned int left, unsigned int right, unsigned int distance)
252{
253 unsigned char *src;
254 unsigned int xindex, yindex, chipindex, linesize;
255 int i, count;
256 unsigned char val;
257 unsigned char bitmask, rightshift;
258
259 xindex = left >> 6;
260 yindex = upper >> 6;
261 chipindex = (xindex + (yindex*num_cols));
262
263 ks108_set_yaddr(par, chipindex, upper/8);
264
265 linesize = par->info->var.xres/8;
266 src = par->info->screen_base + (left/8) + (upper * linesize);
267 ks108_set_xaddr(par, chipindex, left);
268
269 bitmask=1;
270 rightshift=0;
271 while (left <= right) {
272 val = 0;
273 for (i = 0; i < 8; i++) {
274 if ( i > rightshift) {
275 val |= (*(src + (i*linesize)) & bitmask)
276 << (i - rightshift);
277 } else {
278 val |= (*(src + (i*linesize)) & bitmask)
279 >> (rightshift - i);
280 }
281 }
282 ks108_writeb_data(par, chipindex, val);
283 left++;
284 count++;
285 if (bitmask == 0x80) {
286 bitmask = 1;
287 src++;
288 rightshift=0;
289 } else {
290 bitmask <<= 1;
291 rightshift++;
292 }
293 }
294}
295
296/*
297 * here we handle the entire vertical page of the update. we write across
298 * lcd chips. update_page uses the upper/left values to decide which
299 * chip to select for the right. upper is needed for setting the page
300 * desired for the write.
301 */
302static void arcfb_lcd_update_vert(struct arcfb_par *par, unsigned int top,
303 unsigned int bottom, unsigned int left, unsigned int right)
304{
305 unsigned int distance, upper, lower;
306
307 distance = (bottom - top) + 1;
308 upper = top;
309 lower = top + 7;
310
311 while (distance > 0) {
312 distance -= 8;
313 arcfb_lcd_update_page(par, upper, left, right, 8);
314 upper = lower + 1;
315 lower = upper + 7;
316 }
317}
318
319/*
320 * here we handle horizontal blocks for the update. update_vert will
321 * handle spaning multiple pages. we break out each horizontal
322 * block in to individual blocks no taller than 64 pixels.
323 */
324static void arcfb_lcd_update_horiz(struct arcfb_par *par, unsigned int left,
325 unsigned int right, unsigned int top, unsigned int h)
326{
327 unsigned int distance, upper, lower;
328
329 distance = h;
330 upper = floor8(top);
331 lower = min(upper + distance - 1, ceil64(upper));
332
333 while (distance > 0) {
334 distance -= ((lower - upper) + 1 );
335 arcfb_lcd_update_vert(par, upper, lower, left, right);
336 upper = lower + 1;
337 lower = min(upper + distance - 1, ceil64(upper));
338 }
339}
340
341/*
342 * here we start the process of spliting out the fb update into
343 * individual blocks of pixels. we end up spliting into 64x64 blocks
344 * and finally down to 64x8 pages.
345 */
346static void arcfb_lcd_update(struct arcfb_par *par, unsigned int dx,
347 unsigned int dy, unsigned int w, unsigned int h)
348{
349 unsigned int left, right, distance, y;
350
351 /* align the request first */
352 y = floor8(dy);
353 h += dy - y;
354 h = iceil8(h);
355
356 distance = w;
357 left = dx;
358 right = min(left + w - 1, ceil64(left));
359
360 while (distance > 0) {
361 arcfb_lcd_update_horiz(par, left, right, y, h);
362 distance -= ((right - left) + 1);
363 left = right + 1;
364 right = min(left + distance - 1, ceil64(left));
365 }
366}
367
368void arcfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
369{
370 struct arcfb_par *par = info->par;
371
372 cfb_fillrect(info, rect);
373
374 /* update the physical lcd */
375 arcfb_lcd_update(par, rect->dx, rect->dy, rect->width, rect->height);
376}
377
378void arcfb_copyarea(struct fb_info *info, const struct fb_copyarea *area)
379{
380 struct arcfb_par *par = info->par;
381
382 cfb_copyarea(info, area);
383
384 /* update the physical lcd */
385 arcfb_lcd_update(par, area->dx, area->dy, area->width, area->height);
386}
387
388void arcfb_imageblit(struct fb_info *info, const struct fb_image *image)
389{
390 struct arcfb_par *par = info->par;
391
392 cfb_imageblit(info, image);
393
394 /* update the physical lcd */
395 arcfb_lcd_update(par, image->dx, image->dy, image->width,
396 image->height);
397}
398
399static int arcfb_ioctl(struct inode *inode, struct file *file,
400 unsigned int cmd, unsigned long arg,
401 struct fb_info *info)
402{
403 void __user *argp = (void __user *)arg;
404 struct arcfb_par *par = info->par;
405 unsigned long flags;
406
407 switch (cmd) {
408 case FBIO_WAITEVENT:
409 {
410 DEFINE_WAIT(wait);
411 /* illegal to wait on arc if no irq will occur */
412 if (!par->irq)
413 return -EINVAL;
414
415 /* wait until the Arc has generated an interrupt
416 * which will wake us up */
417 spin_lock_irqsave(&par->lock, flags);
418 prepare_to_wait(&arcfb_waitq, &wait,
419 TASK_INTERRUPTIBLE);
420 spin_unlock_irqrestore(&par->lock, flags);
421 schedule();
422 finish_wait(&arcfb_waitq, &wait);
423 }
424 case FBIO_GETCONTROL2:
425 {
426 unsigned char ctl2;
427
428 ctl2 = ks108_readb_ctl2(info->par);
429 if (copy_to_user(argp, &ctl2, sizeof(ctl2)))
430 return -EFAULT;
431 return 0;
432 }
433 default:
434 return -EINVAL;
435 }
436}
437
438/*
439 * this is the access path from userspace. they can seek and write to
440 * the fb. it's inefficient for them to do anything less than 64*8
441 * writes since we update the lcd in each write() anyway.
442 */
443static ssize_t arcfb_write(struct file *file, const char *buf, size_t count,
444 loff_t *ppos)
445{
446 /* modded from epson 1355 */
447
448 struct inode *inode;
449 int fbidx;
450 struct fb_info *info;
451 unsigned long p;
452 int err=-EINVAL;
453 unsigned int fbmemlength,x,y,w,h, bitppos, startpos, endpos, bitcount;
454 struct arcfb_par *par;
455 unsigned int xres;
456
457 p = *ppos;
458 inode = file->f_dentry->d_inode;
459 fbidx = iminor(inode);
460 info = registered_fb[fbidx];
461 par = info->par;
462
463 if (!info || !info->screen_base)
464 return -ENODEV;
465
466 xres = info->var.xres;
467 fbmemlength = (xres * info->var.yres)/8;
468
469 if (p > fbmemlength)
470 return -ENOSPC;
471
472 err = 0;
473 if ((count + p) > fbmemlength) {
474 count = fbmemlength - p;
475 err = -ENOSPC;
476 }
477
478 if (count) {
479 char *base_addr;
480
481 base_addr = info->screen_base;
482 count -= copy_from_user(base_addr + p, buf, count);
483 *ppos += count;
484 err = -EFAULT;
485 }
486
487
488 bitppos = p*8;
489 startpos = floorXres(bitppos, xres);
490 endpos = ceilXres((bitppos + (count*8)), xres);
491 bitcount = endpos - startpos;
492
493 x = startpos % xres;
494 y = startpos / xres;
495 w = xres;
496 h = bitcount / xres;
497 arcfb_lcd_update(par, x, y, w, h);
498
499 if (count)
500 return count;
501 return err;
502}
503
504static void arcfb_platform_release(struct device *device)
505{
506}
507
508static struct fb_ops arcfb_ops = {
509 .owner = THIS_MODULE,
510 .fb_open = arcfb_open,
511 .fb_write = arcfb_write,
512 .fb_release = arcfb_release,
513 .fb_pan_display = arcfb_pan_display,
514 .fb_fillrect = arcfb_fillrect,
515 .fb_copyarea = arcfb_copyarea,
516 .fb_imageblit = arcfb_imageblit,
517 .fb_cursor = soft_cursor,
518 .fb_ioctl = arcfb_ioctl,
519};
520
521static int __init arcfb_probe(struct device *device)
522{
523 struct platform_device *dev = to_platform_device(device);
524 struct fb_info *info;
525 int retval = -ENOMEM;
526 int videomemorysize;
527 unsigned char *videomemory;
528 struct arcfb_par *par;
529 int i;
530
531 videomemorysize = (((64*64)*num_cols)*num_rows)/8;
532
533 /* We need a flat backing store for the Arc's
534 less-flat actual paged framebuffer */
535 if (!(videomemory = vmalloc(videomemorysize)))
536 return retval;
537
538 memset(videomemory, 0, videomemorysize);
539
540 info = framebuffer_alloc(sizeof(struct arcfb_par), &dev->dev);
541 if (!info)
542 goto err;
543
544 info->screen_base = (char __iomem *)videomemory;
545 info->fbops = &arcfb_ops;
546
547 info->var = arcfb_var;
548 info->fix = arcfb_fix;
549 par = info->par;
550 par->info = info;
551
552 if (!dio_addr || !cio_addr || !c2io_addr) {
553 printk(KERN_WARNING "no IO addresses supplied\n");
554 goto err1;
555 }
556 par->dio_addr = dio_addr;
557 par->cio_addr = cio_addr;
558 par->c2io_addr = c2io_addr;
559 par->cslut[0] = 0x00;
560 par->cslut[1] = 0x06;
561 info->flags = FBINFO_FLAG_DEFAULT;
562 spin_lock_init(&par->lock);
563 retval = register_framebuffer(info);
564 if (retval < 0)
565 goto err1;
566 dev_set_drvdata(&dev->dev, info);
567 if (irq) {
568 par->irq = irq;
569 if (request_irq(par->irq, &arcfb_interrupt, SA_SHIRQ,
570 "arcfb", info)) {
571 printk(KERN_INFO
572 "arcfb: Failed req IRQ %d\n", par->irq);
573 goto err1;
574 }
575 }
576 printk(KERN_INFO
577 "fb%d: Arc frame buffer device, using %dK of video memory\n",
578 info->node, videomemorysize >> 10);
579
580 /* this inits the lcd but doesn't clear dirty pixels */
581 for (i = 0; i < num_cols * num_rows; i++) {
582 ks108_writeb_ctl(par, i, KS_DPY_OFF);
583 ks108_set_start_line(par, i, 0);
584 ks108_set_yaddr(par, i, 0);
585 ks108_set_xaddr(par, i, 0);
586 ks108_writeb_ctl(par, i, KS_DPY_ON);
587 }
588
589 /* if we were told to splash the screen, we just clear it */
590 if (!nosplash) {
591 for (i = 0; i < num_cols * num_rows; i++) {
592 printk(KERN_INFO "fb%d: splashing lcd %d\n",
593 info->node, i);
594 ks108_set_start_line(par, i, 0);
595 ks108_clear_lcd(par, i);
596 }
597 }
598
599 return 0;
600err1:
601 framebuffer_release(info);
602err:
603 vfree(videomemory);
604 return retval;
605}
606
607static int arcfb_remove(struct device *device)
608{
609 struct fb_info *info = dev_get_drvdata(device);
610
611 if (info) {
612 unregister_framebuffer(info);
613 vfree(info->screen_base);
614 framebuffer_release(info);
615 }
616 return 0;
617}
618
619static struct device_driver arcfb_driver = {
620 .name = "arcfb",
621 .bus = &platform_bus_type,
622 .probe = arcfb_probe,
623 .remove = arcfb_remove,
624};
625
626static struct platform_device arcfb_device = {
627 .name = "arcfb",
628 .id = 0,
629 .dev = {
630 .release = arcfb_platform_release,
631 }
632};
633
634static int __init arcfb_init(void)
635{
636 int ret;
637
638 if (!arcfb_enable)
639 return -ENXIO;
640
641 ret = driver_register(&arcfb_driver);
642 if (!ret) {
643 ret = platform_device_register(&arcfb_device);
644 if (ret)
645 driver_unregister(&arcfb_driver);
646 }
647 return ret;
648
649}
650
651static void __exit arcfb_exit(void)
652{
653 platform_device_unregister(&arcfb_device);
654 driver_unregister(&arcfb_driver);
655}
656
657module_param(num_cols, ulong, 0);
658MODULE_PARM_DESC(num_cols, "Num horiz panels, eg: 2 = 128 bit wide");
659module_param(num_rows, ulong, 0);
660MODULE_PARM_DESC(num_rows, "Num vert panels, eg: 1 = 64 bit high");
661module_param(nosplash, uint, 0);
662MODULE_PARM_DESC(nosplash, "Disable doing the splash screen");
663module_param(arcfb_enable, uint, 0);
664MODULE_PARM_DESC(arcfb_enable, "Enable communication with Arc board");
665module_param(dio_addr, ulong, 0);
666MODULE_PARM_DESC(dio_addr, "IO address for data, eg: 0x480");
667module_param(cio_addr, ulong, 0);
668MODULE_PARM_DESC(cio_addr, "IO address for control, eg: 0x400");
669module_param(c2io_addr, ulong, 0);
670MODULE_PARM_DESC(c2io_addr, "IO address for secondary control, eg: 0x408");
671module_param(splashval, ulong, 0);
672MODULE_PARM_DESC(splashval, "Splash pattern: 0xFF is black, 0x00 is green");
673module_param(tuhold, ulong, 0);
674MODULE_PARM_DESC(tuhold, "Time to hold between strobing data to Arc board");
675module_param(irq, uint, 0);
676MODULE_PARM_DESC(irq, "IRQ for the Arc board");
677
678module_init(arcfb_init);
679module_exit(arcfb_exit);
680
681MODULE_DESCRIPTION("fbdev driver for Arc monochrome LCD board");
682MODULE_AUTHOR("Jaya Kumar");
683MODULE_LICENSE("GPL");
684
diff --git a/drivers/video/chipsfb.c b/drivers/video/chipsfb.c
index ab98f225fe3e..95e72550d43f 100644
--- a/drivers/video/chipsfb.c
+++ b/drivers/video/chipsfb.c
@@ -423,9 +423,6 @@ chipsfb_pci_init(struct pci_dev *dp, const struct pci_device_id *ent)
423 pmu_register_sleep_notifier(&chips_sleep_notifier); 423 pmu_register_sleep_notifier(&chips_sleep_notifier);
424#endif /* CONFIG_PMAC_PBOOK */ 424#endif /* CONFIG_PMAC_PBOOK */
425 425
426 /* Clear the entire framebuffer */
427 memset(p->screen_base, 0, 0x100000);
428
429 pci_set_drvdata(dp, p); 426 pci_set_drvdata(dp, p);
430 return 0; 427 return 0;
431} 428}
diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig
index ccf55811d24f..e4b91a4b936c 100644
--- a/drivers/video/console/Kconfig
+++ b/drivers/video/console/Kconfig
@@ -153,6 +153,15 @@ config FONT_6x11
153 Small console font with Macintosh-style high-half glyphs. Some Mac 153 Small console font with Macintosh-style high-half glyphs. Some Mac
154 framebuffer drivers don't support this one at all. 154 framebuffer drivers don't support this one at all.
155 155
156config FONT_7x14
157 bool "console 7x14 font (not supported by all drivers)" if FONTS
158 depends on FRAMEBUFFER_CONSOLE
159 default y if !SPARC32 && !SPARC64 && !FONTS
160 help
161 Console font with characters just a bit smaller than the default.
162 If the standard 8x16 font is a little too big for you, say Y.
163 Otherwise, say N.
164
156config FONT_PEARL_8x8 165config FONT_PEARL_8x8
157 bool "Pearl (old m68k) console 8x8 font" if FONTS 166 bool "Pearl (old m68k) console 8x8 font" if FONTS
158 depends on FRAMEBUFFER_CONSOLE 167 depends on FRAMEBUFFER_CONSOLE
@@ -187,5 +196,13 @@ config FONT_SUN12x22
187 big letters (like the letters used in the SPARC PROM). If the 196 big letters (like the letters used in the SPARC PROM). If the
188 standard font is unreadable for you, say Y, otherwise say N. 197 standard font is unreadable for you, say Y, otherwise say N.
189 198
199config FONT_10x18
200 bool "console 10x18 font (not supported by all drivers)"
201 depends on FONTS
202 help
203 This is a high resolution console font for machines with very
204 big letters. It fits between the sun 12x22 and the normal 8x16 font.
205 If other fonts are too big or too small for you, say Y, otherwise say N.
206
190endmenu 207endmenu
191 208
diff --git a/drivers/video/console/Makefile b/drivers/video/console/Makefile
index 33516447f9f2..b562f6bb9d31 100644
--- a/drivers/video/console/Makefile
+++ b/drivers/video/console/Makefile
@@ -10,6 +10,8 @@ font-objs-$(CONFIG_FONT_SUN12x22) += font_sun12x22.o
10font-objs-$(CONFIG_FONT_8x8) += font_8x8.o 10font-objs-$(CONFIG_FONT_8x8) += font_8x8.o
11font-objs-$(CONFIG_FONT_8x16) += font_8x16.o 11font-objs-$(CONFIG_FONT_8x16) += font_8x16.o
12font-objs-$(CONFIG_FONT_6x11) += font_6x11.o 12font-objs-$(CONFIG_FONT_6x11) += font_6x11.o
13font-objs-$(CONFIG_FONT_7x14) += font_7x14.o
14font-objs-$(CONFIG_FONT_10x18) += font_10x18.o
13font-objs-$(CONFIG_FONT_PEARL_8x8) += font_pearl_8x8.o 15font-objs-$(CONFIG_FONT_PEARL_8x8) += font_pearl_8x8.o
14font-objs-$(CONFIG_FONT_ACORN_8x8) += font_acorn_8x8.o 16font-objs-$(CONFIG_FONT_ACORN_8x8) += font_acorn_8x8.o
15font-objs-$(CONFIG_FONT_MINI_4x6) += font_mini_4x6.o 17font-objs-$(CONFIG_FONT_MINI_4x6) += font_mini_4x6.o
diff --git a/drivers/video/console/bitblit.c b/drivers/video/console/bitblit.c
index b28a4b0e395e..3c731577fed6 100644
--- a/drivers/video/console/bitblit.c
+++ b/drivers/video/console/bitblit.c
@@ -107,13 +107,6 @@ static void bit_putcs(struct vc_data *vc, struct fb_info *info,
107 const unsigned short *s, int count, int yy, int xx, 107 const unsigned short *s, int count, int yy, int xx,
108 int fg, int bg) 108 int fg, int bg)
109{ 109{
110 void (*move_unaligned)(struct fb_info *info, struct fb_pixmap *buf,
111 u8 *dst, u32 d_pitch, u8 *src, u32 idx,
112 u32 height, u32 shift_high, u32 shift_low,
113 u32 mod);
114 void (*move_aligned)(struct fb_info *info, struct fb_pixmap *buf,
115 u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch,
116 u32 height);
117 unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; 110 unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
118 unsigned int width = (vc->vc_font.width + 7) >> 3; 111 unsigned int width = (vc->vc_font.width + 7) >> 3;
119 unsigned int cellsize = vc->vc_font.height * width; 112 unsigned int cellsize = vc->vc_font.height * width;
@@ -141,13 +134,6 @@ static void bit_putcs(struct vc_data *vc, struct fb_info *info,
141 image.height = vc->vc_font.height; 134 image.height = vc->vc_font.height;
142 image.depth = 1; 135 image.depth = 1;
143 136
144 if (info->pixmap.outbuf && info->pixmap.inbuf) {
145 move_aligned = fb_iomove_buf_aligned;
146 move_unaligned = fb_iomove_buf_unaligned;
147 } else {
148 move_aligned = fb_sysmove_buf_aligned;
149 move_unaligned = fb_sysmove_buf_unaligned;
150 }
151 while (count) { 137 while (count) {
152 if (count > maxcnt) 138 if (count > maxcnt)
153 cnt = k = maxcnt; 139 cnt = k = maxcnt;
@@ -171,9 +157,9 @@ static void bit_putcs(struct vc_data *vc, struct fb_info *info,
171 src = buf; 157 src = buf;
172 } 158 }
173 159
174 move_unaligned(info, &info->pixmap, dst, pitch, 160 fb_pad_unaligned_buffer(dst, pitch, src, idx,
175 src, idx, image.height, 161 image.height, shift_high,
176 shift_high, shift_low, mod); 162 shift_low, mod);
177 shift_low += mod; 163 shift_low += mod;
178 dst += (shift_low >= 8) ? width : width - 1; 164 dst += (shift_low >= 8) ? width : width - 1;
179 shift_low &= 7; 165 shift_low &= 7;
@@ -189,8 +175,7 @@ static void bit_putcs(struct vc_data *vc, struct fb_info *info,
189 src = buf; 175 src = buf;
190 } 176 }
191 177
192 move_aligned(info, &info->pixmap, dst, pitch, 178 fb_pad_aligned_buffer(dst, pitch, src, idx, image.height);
193 src, idx, image.height);
194 dst += width; 179 dst += width;
195 } 180 }
196 } 181 }
diff --git a/drivers/video/console/font_10x18.c b/drivers/video/console/font_10x18.c
new file mode 100644
index 000000000000..ff0af96e4dfc
--- /dev/null
+++ b/drivers/video/console/font_10x18.c
@@ -0,0 +1,5146 @@
1/********************************
2 * adapted from font_sun12x22.c *
3 * by Jurriaan Kalkman 06-2005 *
4 ********************************/
5
6#include <linux/font.h>
7
8#define FONTDATAMAX 9216
9
10static unsigned char fontdata_10x18[FONTDATAMAX] = {
11
12 /* 0 0x00 '^@' */
13 0x00, 0x00, /* 0000000000 */
14 0x00, 0x00, /* 0000000000 */
15 0x00, 0x00, /* 0000000000 */
16 0x00, 0x00, /* 0000000000 */
17 0x00, 0x00, /* 0000000000 */
18 0x00, 0x00, /* 0000000000 */
19 0x00, 0x00, /* 0000000000 */
20 0x00, 0x00, /* 0000000000 */
21 0x00, 0x00, /* 0000000000 */
22 0x00, 0x00, /* 0000000000 */
23 0x00, 0x00, /* 0000000000 */
24 0x00, 0x00, /* 0000000000 */
25 0x00, 0x00, /* 0000000000 */
26 0x00, 0x00, /* 0000000000 */
27 0x00, 0x00, /* 0000000000 */
28 0x00, 0x00, /* 0000000000 */
29 0x00, 0x00, /* 0000000000 */
30 0x00, 0x00, /* 0000000000 */
31
32 /* 1 0x01 '^A' */
33 0x00, 0x00, /* 0000000000 */
34 0x00, 0x00, /* 0000000000 */
35 0x00, 0x00, /* 0000000000 */
36 0x00, 0x00, /* 0000000000 */
37 0x00, 0x00, /* 0000000000 */
38 0x3f, 0x80, /* 0011111110 */
39 0x40, 0x40, /* 0100000001 */
40 0x5b, 0x40, /* 0101101101 */
41 0x40, 0x40, /* 0100000001 */
42 0x44, 0x40, /* 0100010001 */
43 0x44, 0x40, /* 0100010001 */
44 0x51, 0x40, /* 0101000101 */
45 0x4e, 0x40, /* 0100111001 */
46 0x40, 0x40, /* 0100000001 */
47 0x3f, 0x80, /* 0011111110 */
48 0x00, 0x00, /* 0000000000 */
49 0x00, 0x00, /* 0000000000 */
50 0x00, 0x00, /* 0000000000 */
51
52 /* 2 0x02 '^B' */
53 0x00, 0x00, /* 0000000000 */
54 0x00, 0x00, /* 0000000000 */
55 0x00, 0x00, /* 0000000000 */
56 0x00, 0x00, /* 0000000000 */
57 0x00, 0x00, /* 0000000000 */
58 0x3f, 0x80, /* 0011111110 */
59 0x7f, 0xc0, /* 0111111111 */
60 0x64, 0xc0, /* 0110010011 */
61 0x7f, 0xc0, /* 0111111111 */
62 0x7b, 0xc0, /* 0111101111 */
63 0x7b, 0xc0, /* 0111101111 */
64 0x6e, 0xc0, /* 0110111011 */
65 0x71, 0xc0, /* 0111000111 */
66 0x7f, 0xc0, /* 0111111111 */
67 0x3f, 0x80, /* 0011111110 */
68 0x00, 0x00, /* 0000000000 */
69 0x00, 0x00, /* 0000000000 */
70 0x00, 0x00, /* 0000000000 */
71
72 /* 3 0x03 '^C' */
73 0x00, 0x00, /* 0000000000 */
74 0x00, 0x00, /* 0000000000 */
75 0x00, 0x00, /* 0000000000 */
76 0x00, 0x00, /* 0000000000 */
77 0x00, 0x00, /* 0000000000 */
78 0x11, 0x00, /* 0001000100 */
79 0x3b, 0x80, /* 0011101110 */
80 0x7f, 0xc0, /* 0111111111 */
81 0x3f, 0x80, /* 0011111110 */
82 0x3f, 0x80, /* 0011111110 */
83 0x1f, 0x00, /* 0001111100 */
84 0x1f, 0x00, /* 0001111100 */
85 0x0e, 0x00, /* 0000111000 */
86 0x0e, 0x00, /* 0000111000 */
87 0x04, 0x00, /* 0000010000 */
88 0x00, 0x00, /* 0000000000 */
89 0x00, 0x00, /* 0000000000 */
90 0x00, 0x00, /* 0000000000 */
91
92 /* 4 0x04 '^D' */
93 0x00, 0x00, /* 0000000000 */
94 0x00, 0x00, /* 0000000000 */
95 0x00, 0x00, /* 0000000000 */
96 0x00, 0x00, /* 0000000000 */
97 0x04, 0x00, /* 0000010000 */
98 0x0e, 0x00, /* 0000111000 */
99 0x0e, 0x00, /* 0000111000 */
100 0x1f, 0x00, /* 0001111100 */
101 0x1f, 0x00, /* 0001111100 */
102 0x3f, 0x80, /* 0011111110 */
103 0x1f, 0x00, /* 0001111100 */
104 0x1f, 0x00, /* 0001111100 */
105 0x0e, 0x00, /* 0000111000 */
106 0x0e, 0x00, /* 0000111000 */
107 0x04, 0x00, /* 0000010000 */
108 0x00, 0x00, /* 0000000000 */
109 0x00, 0x00, /* 0000000000 */
110 0x00, 0x00, /* 0000000000 */
111
112 /* 5 0x05 '^E' */
113 0x00, 0x00, /* 0000000000 */
114 0x00, 0x00, /* 0000000000 */
115 0x00, 0x00, /* 0000000000 */
116 0x00, 0x00, /* 0000000000 */
117 0x00, 0x00, /* 0000000000 */
118 0x00, 0x00, /* 0000000000 */
119 0x0c, 0x00, /* 0000110000 */
120 0x1e, 0x00, /* 0001111000 */
121 0x0c, 0x00, /* 0000110000 */
122 0x31, 0x80, /* 0011000110 */
123 0x7b, 0xc0, /* 0111101111 */
124 0x35, 0x80, /* 0011010110 */
125 0x04, 0x00, /* 0000010000 */
126 0x0e, 0x00, /* 0000111000 */
127 0x1f, 0x00, /* 0001111100 */
128 0x00, 0x00, /* 0000000000 */
129 0x00, 0x00, /* 0000000000 */
130 0x00, 0x00, /* 0000000000 */
131
132 /* 6 0x06 '^F' */
133 0x00, 0x00, /* 0000000000 */
134 0x00, 0x00, /* 0000000000 */
135 0x00, 0x00, /* 0000000000 */
136 0x00, 0x00, /* 0000000000 */
137 0x04, 0x00, /* 0000010000 */
138 0x0e, 0x00, /* 0000111000 */
139 0x1f, 0x00, /* 0001111100 */
140 0x1f, 0x00, /* 0001111100 */
141 0x3f, 0x80, /* 0011111110 */
142 0x7f, 0xc0, /* 0111111111 */
143 0x7f, 0xc0, /* 0111111111 */
144 0x35, 0x80, /* 0011010110 */
145 0x04, 0x00, /* 0000010000 */
146 0x0e, 0x00, /* 0000111000 */
147 0x1f, 0x00, /* 0001111100 */
148 0x00, 0x00, /* 0000000000 */
149 0x00, 0x00, /* 0000000000 */
150 0x00, 0x00, /* 0000000000 */
151
152 /* 7 0x07 '^G' */
153 0x00, 0x00, /* 0000000000 */
154 0x00, 0x00, /* 0000000000 */
155 0x00, 0x00, /* 0000000000 */
156 0x00, 0x00, /* 0000000000 */
157 0x00, 0x00, /* 0000000000 */
158 0x0c, 0x00, /* 0000110000 */
159 0x1e, 0x00, /* 0001111000 */
160 0x1e, 0x00, /* 0001111000 */
161 0x3f, 0x00, /* 0011111100 */
162 0x3f, 0x00, /* 0011111100 */
163 0x1e, 0x00, /* 0001111000 */
164 0x1e, 0x00, /* 0001111000 */
165 0x0c, 0x00, /* 0000110000 */
166 0x00, 0x00, /* 0000000000 */
167 0x00, 0x00, /* 0000000000 */
168 0x00, 0x00, /* 0000000000 */
169 0x00, 0x00, /* 0000000000 */
170 0x00, 0x00, /* 0000000000 */
171
172 /* 8 0x08 '^H' */
173 0xff, 0xc0, /* 1111111111 */
174 0xff, 0xc0, /* 1111111111 */
175 0xff, 0xc0, /* 1111111111 */
176 0xff, 0xc0, /* 1111111111 */
177 0xff, 0xc0, /* 1111111111 */
178 0xf3, 0xc0, /* 1111001111 */
179 0xe1, 0xc0, /* 1110000111 */
180 0xe1, 0xc0, /* 1110000111 */
181 0xc0, 0xc0, /* 1100000011 */
182 0xc0, 0xc0, /* 1100000011 */
183 0xe1, 0xc0, /* 1110000111 */
184 0xe1, 0xc0, /* 1110000111 */
185 0xf3, 0xc0, /* 1111001111 */
186 0xff, 0xc0, /* 1111111111 */
187 0xff, 0xc0, /* 1111111111 */
188 0xff, 0xc0, /* 1111111111 */
189 0xff, 0xc0, /* 1111111111 */
190 0xff, 0xc0, /* 1111111111 */
191
192 /* 9 0x09 '^I' */
193 0x00, 0x00, /* 0000000000 */
194 0x00, 0x00, /* 0000000000 */
195 0x00, 0x00, /* 0000000000 */
196 0x00, 0x00, /* 0000000000 */
197 0x00, 0x00, /* 0000000000 */
198 0x0c, 0x00, /* 0000110000 */
199 0x12, 0x00, /* 0001001000 */
200 0x12, 0x00, /* 0001001000 */
201 0x21, 0x00, /* 0010000100 */
202 0x21, 0x00, /* 0010000100 */
203 0x12, 0x00, /* 0001001000 */
204 0x12, 0x00, /* 0001001000 */
205 0x0c, 0x00, /* 0000110000 */
206 0x00, 0x00, /* 0000000000 */
207 0x00, 0x00, /* 0000000000 */
208 0x00, 0x00, /* 0000000000 */
209 0x00, 0x00, /* 0000000000 */
210 0x00, 0x00, /* 0000000000 */
211
212 /* 10 0x0a '^J' */
213 0xff, 0xc0, /* 1111111111 */
214 0xff, 0xc0, /* 1111111111 */
215 0xff, 0xc0, /* 1111111111 */
216 0xff, 0xc0, /* 1111111111 */
217 0xff, 0xc0, /* 1111111111 */
218 0xf3, 0xc0, /* 1111001111 */
219 0xed, 0xc0, /* 1110110111 */
220 0xed, 0xc0, /* 1110110111 */
221 0xde, 0xc0, /* 1101111011 */
222 0xde, 0xc0, /* 1101111011 */
223 0xed, 0xc0, /* 1110110111 */
224 0xed, 0xc0, /* 1110110111 */
225 0xf3, 0xc0, /* 1111001111 */
226 0xff, 0xc0, /* 1111111111 */
227 0xff, 0xc0, /* 1111111111 */
228 0xff, 0xc0, /* 1111111111 */
229 0xff, 0xc0, /* 1111111111 */
230 0xff, 0xc0, /* 1111111111 */
231
232 /* 11 0x0b '^K' */
233 0x00, 0x00, /* 0000000000 */
234 0x00, 0x00, /* 0000000000 */
235 0x0f, 0xc0, /* 0000111111 */
236 0x0f, 0xc0, /* 0000111111 */
237 0x03, 0xc0, /* 0000001111 */
238 0x06, 0xc0, /* 0000011011 */
239 0x0c, 0xc0, /* 0000110011 */
240 0x3c, 0x00, /* 0011110000 */
241 0x66, 0x00, /* 0110011000 */
242 0xc3, 0x00, /* 1100001100 */
243 0xc3, 0x00, /* 1100001100 */
244 0xc3, 0x00, /* 1100001100 */
245 0x66, 0x00, /* 0110011000 */
246 0x3c, 0x00, /* 0011110000 */
247 0x00, 0x00, /* 0000000000 */
248 0x00, 0x00, /* 0000000000 */
249 0x00, 0x00, /* 0000000000 */
250 0x00, 0x00, /* 0000000000 */
251
252 /* 12 0x0c '^L' */
253 0x00, 0x00, /* 0000000000 */
254 0x00, 0x00, /* 0000000000 */
255 0x00, 0x00, /* 0000000000 */
256 0x1e, 0x00, /* 0001111000 */
257 0x33, 0x00, /* 0011001100 */
258 0x61, 0x80, /* 0110000110 */
259 0x61, 0x80, /* 0110000110 */
260 0x61, 0x80, /* 0110000110 */
261 0x33, 0x00, /* 0011001100 */
262 0x1e, 0x00, /* 0001111000 */
263 0x0c, 0x00, /* 0000110000 */
264 0x0c, 0x00, /* 0000110000 */
265 0x3f, 0x00, /* 0011111100 */
266 0x0c, 0x00, /* 0000110000 */
267 0x0c, 0x00, /* 0000110000 */
268 0x00, 0x00, /* 0000000000 */
269 0x00, 0x00, /* 0000000000 */
270 0x00, 0x00, /* 0000000000 */
271
272 /* 13 0x0d '^M' */
273 0x00, 0x00, /* 0000000000 */
274 0x00, 0x00, /* 0000000000 */
275 0x00, 0x00, /* 0000000000 */
276 0x0f, 0x80, /* 0000111110 */
277 0x08, 0x80, /* 0000100010 */
278 0x0f, 0x80, /* 0000111110 */
279 0x08, 0x00, /* 0000100000 */
280 0x08, 0x00, /* 0000100000 */
281 0x08, 0x00, /* 0000100000 */
282 0x08, 0x00, /* 0000100000 */
283 0x08, 0x00, /* 0000100000 */
284 0x08, 0x00, /* 0000100000 */
285 0x38, 0x00, /* 0011100000 */
286 0x78, 0x00, /* 0111100000 */
287 0x30, 0x00, /* 0011000000 */
288 0x00, 0x00, /* 0000000000 */
289 0x00, 0x00, /* 0000000000 */
290 0x00, 0x00, /* 0000000000 */
291
292 /* 14 0x0e '^N' */
293 0x00, 0x00, /* 0000000000 */
294 0x00, 0x00, /* 0000000000 */
295 0x00, 0x00, /* 0000000000 */
296 0x1f, 0x80, /* 0001111110 */
297 0x10, 0x80, /* 0001000010 */
298 0x1f, 0x80, /* 0001111110 */
299 0x10, 0x80, /* 0001000010 */
300 0x10, 0x80, /* 0001000010 */
301 0x10, 0x80, /* 0001000010 */
302 0x10, 0x80, /* 0001000010 */
303 0x13, 0x80, /* 0001001110 */
304 0x17, 0x80, /* 0001011110 */
305 0x73, 0x00, /* 0111001100 */
306 0xf0, 0x00, /* 1111000000 */
307 0x60, 0x00, /* 0110000000 */
308 0x00, 0x00, /* 0000000000 */
309 0x00, 0x00, /* 0000000000 */
310 0x00, 0x00, /* 0000000000 */
311
312 /* 15 0x0f '^O' */
313 0x00, 0x00, /* 0000000000 */
314 0x00, 0x00, /* 0000000000 */
315 0x00, 0x00, /* 0000000000 */
316 0x04, 0x00, /* 0000010000 */
317 0x24, 0x80, /* 0010010010 */
318 0x15, 0x00, /* 0001010100 */
319 0x55, 0x40, /* 0101010101 */
320 0x3f, 0x80, /* 0011111110 */
321 0x0e, 0x00, /* 0000111000 */
322 0x00, 0x00, /* 0000000000 */
323 0x0e, 0x00, /* 0000111000 */
324 0x3f, 0x80, /* 0011111110 */
325 0x55, 0x40, /* 0101010101 */
326 0x15, 0x00, /* 0001010100 */
327 0x24, 0x80, /* 0010010010 */
328 0x00, 0x00, /* 0000000000 */
329 0x00, 0x00, /* 0000000000 */
330 0x00, 0x00, /* 0000000000 */
331
332 /* 16 0x10 '^P' */
333 0x00, 0x80, /* 0000000010 */
334 0x01, 0x80, /* 0000000110 */
335 0x03, 0x80, /* 0000001110 */
336 0x07, 0x80, /* 0000011110 */
337 0x0f, 0x80, /* 0000111110 */
338 0x1f, 0x80, /* 0001111110 */
339 0x3f, 0x80, /* 0011111110 */
340 0x7f, 0x80, /* 0111111110 */
341 0xff, 0x80, /* 1111111110 */
342 0x7f, 0x80, /* 0111111110 */
343 0x3f, 0x80, /* 0011111110 */
344 0x1f, 0x80, /* 0001111110 */
345 0x0f, 0x80, /* 0000111110 */
346 0x07, 0x80, /* 0000011110 */
347 0x03, 0x80, /* 0000001110 */
348 0x01, 0x80, /* 0000000110 */
349 0x00, 0x80, /* 0000000010 */
350 0x00, 0x00, /* 0000000000 */
351
352 /* 17 0x11 '^Q' */
353 0x40, 0x00, /* 0100000000 */
354 0x60, 0x00, /* 0110000000 */
355 0x70, 0x00, /* 0111000000 */
356 0x78, 0x00, /* 0111100000 */
357 0x7c, 0x00, /* 0111110000 */
358 0x7e, 0x00, /* 0111111000 */
359 0x7f, 0x00, /* 0111111100 */
360 0x7f, 0x80, /* 0111111110 */
361 0x7f, 0xc0, /* 0111111111 */
362 0x7f, 0x80, /* 0111111110 */
363 0x7f, 0x00, /* 0111111100 */
364 0x7e, 0x00, /* 0111111000 */
365 0x7c, 0x00, /* 0111110000 */
366 0x78, 0x00, /* 0111100000 */
367 0x70, 0x00, /* 0111000000 */
368 0x60, 0x00, /* 0110000000 */
369 0x40, 0x00, /* 0100000000 */
370 0x00, 0x00, /* 0000000000 */
371
372 /* 18 0x12 '^R' */
373 0x00, 0x00, /* 0000000000 */
374 0x00, 0x00, /* 0000000000 */
375 0x00, 0x00, /* 0000000000 */
376 0x00, 0x00, /* 0000000000 */
377 0x0c, 0x00, /* 0000110000 */
378 0x1e, 0x00, /* 0001111000 */
379 0x3f, 0x00, /* 0011111100 */
380 0x7f, 0x80, /* 0111111110 */
381 0x0c, 0x00, /* 0000110000 */
382 0x0c, 0x00, /* 0000110000 */
383 0x0c, 0x00, /* 0000110000 */
384 0x7f, 0x80, /* 0111111110 */
385 0x3f, 0x00, /* 0011111100 */
386 0x1e, 0x00, /* 0001111000 */
387 0x0c, 0x00, /* 0000110000 */
388 0x00, 0x00, /* 0000000000 */
389 0x00, 0x00, /* 0000000000 */
390 0x00, 0x00, /* 0000000000 */
391
392 /* 19 0x13 '^S' */
393 0x00, 0x00, /* 0000000000 */
394 0x33, 0x00, /* 0011001100 */
395 0x33, 0x00, /* 0011001100 */
396 0x33, 0x00, /* 0011001100 */
397 0x33, 0x00, /* 0011001100 */
398 0x33, 0x00, /* 0011001100 */
399 0x33, 0x00, /* 0011001100 */
400 0x33, 0x00, /* 0011001100 */
401 0x33, 0x00, /* 0011001100 */
402 0x33, 0x00, /* 0011001100 */
403 0x33, 0x00, /* 0011001100 */
404 0x00, 0x00, /* 0000000000 */
405 0x00, 0x00, /* 0000000000 */
406 0x33, 0x00, /* 0011001100 */
407 0x33, 0x00, /* 0011001100 */
408 0x00, 0x00, /* 0000000000 */
409 0x00, 0x00, /* 0000000000 */
410 0x00, 0x00, /* 0000000000 */
411
412 /* 20 0x14 '^T' */
413 0x00, 0x00, /* 0000000000 */
414 0x1f, 0xc0, /* 0001111111 */
415 0x39, 0x80, /* 0011100110 */
416 0x79, 0x80, /* 0111100110 */
417 0x79, 0x80, /* 0111100110 */
418 0x79, 0x80, /* 0111100110 */
419 0x39, 0x80, /* 0011100110 */
420 0x19, 0x80, /* 0001100110 */
421 0x19, 0x80, /* 0001100110 */
422 0x19, 0x80, /* 0001100110 */
423 0x19, 0x80, /* 0001100110 */
424 0x19, 0x80, /* 0001100110 */
425 0x19, 0x80, /* 0001100110 */
426 0x39, 0xc0, /* 0011100111 */
427 0x00, 0x00, /* 0000000000 */
428 0x00, 0x00, /* 0000000000 */
429 0x00, 0x00, /* 0000000000 */
430 0x00, 0x00, /* 0000000000 */
431
432 /* 21 0x15 '^U' */
433 0x00, 0x00, /* 0000000000 */
434 0x00, 0x00, /* 0000000000 */
435 0x3e, 0x00, /* 0011111000 */
436 0x63, 0x00, /* 0110001100 */
437 0x63, 0x00, /* 0110001100 */
438 0x60, 0x00, /* 0110000000 */
439 0x60, 0x00, /* 0110000000 */
440 0x3e, 0x00, /* 0011111000 */
441 0x63, 0x00, /* 0110001100 */
442 0x63, 0x00, /* 0110001100 */
443 0x3e, 0x00, /* 0011111000 */
444 0x03, 0x00, /* 0000001100 */
445 0x03, 0x00, /* 0000001100 */
446 0x63, 0x00, /* 0110001100 */
447 0x63, 0x00, /* 0110001100 */
448 0x3e, 0x00, /* 0011111000 */
449 0x00, 0x00, /* 0000000000 */
450 0x00, 0x00, /* 0000000000 */
451
452 /* 22 0x16 '^V' */
453 0x00, 0x00, /* 0000000000 */
454 0x00, 0x00, /* 0000000000 */
455 0x00, 0x00, /* 0000000000 */
456 0x00, 0x00, /* 0000000000 */
457 0x00, 0x00, /* 0000000000 */
458 0x00, 0x00, /* 0000000000 */
459 0x00, 0x00, /* 0000000000 */
460 0x00, 0x00, /* 0000000000 */
461 0x00, 0x00, /* 0000000000 */
462 0x00, 0x00, /* 0000000000 */
463 0x00, 0x00, /* 0000000000 */
464 0x00, 0x00, /* 0000000000 */
465 0x7f, 0x80, /* 0111111110 */
466 0x7f, 0x80, /* 0111111110 */
467 0x7f, 0x80, /* 0111111110 */
468 0x00, 0x00, /* 0000000000 */
469 0x00, 0x00, /* 0000000000 */
470 0x00, 0x00, /* 0000000000 */
471
472 /* 23 0x17 '^W' */
473 0x00, 0x00, /* 0000000000 */
474 0x00, 0x00, /* 0000000000 */
475 0x0c, 0x00, /* 0000110000 */
476 0x1e, 0x00, /* 0001111000 */
477 0x3f, 0x00, /* 0011111100 */
478 0x7f, 0x80, /* 0111111110 */
479 0x0c, 0x00, /* 0000110000 */
480 0x0c, 0x00, /* 0000110000 */
481 0x0c, 0x00, /* 0000110000 */
482 0x7f, 0x80, /* 0111111110 */
483 0x3f, 0x00, /* 0011111100 */
484 0x1e, 0x00, /* 0001111000 */
485 0x0c, 0x00, /* 0000110000 */
486 0x7f, 0x80, /* 0111111110 */
487 0x7f, 0x80, /* 0111111110 */
488 0x00, 0x00, /* 0000000000 */
489 0x00, 0x00, /* 0000000000 */
490 0x00, 0x00, /* 0000000000 */
491
492 /* 24 0x18 '^X' */
493 0x00, 0x00, /* 0000000000 */
494 0x00, 0x00, /* 0000000000 */
495 0x00, 0x00, /* 0000000000 */
496 0x0c, 0x00, /* 0000110000 */
497 0x1e, 0x00, /* 0001111000 */
498 0x3f, 0x00, /* 0011111100 */
499 0x7f, 0x80, /* 0111111110 */
500 0x0c, 0x00, /* 0000110000 */
501 0x0c, 0x00, /* 0000110000 */
502 0x0c, 0x00, /* 0000110000 */
503 0x0c, 0x00, /* 0000110000 */
504 0x0c, 0x00, /* 0000110000 */
505 0x0c, 0x00, /* 0000110000 */
506 0x0c, 0x00, /* 0000110000 */
507 0x0c, 0x00, /* 0000110000 */
508 0x00, 0x00, /* 0000000000 */
509 0x00, 0x00, /* 0000000000 */
510 0x00, 0x00, /* 0000000000 */
511
512 /* 25 0x19 '^Y' */
513 0x00, 0x00, /* 0000000000 */
514 0x00, 0x00, /* 0000000000 */
515 0x00, 0x00, /* 0000000000 */
516 0x0c, 0x00, /* 0000110000 */
517 0x0c, 0x00, /* 0000110000 */
518 0x0c, 0x00, /* 0000110000 */
519 0x0c, 0x00, /* 0000110000 */
520 0x0c, 0x00, /* 0000110000 */
521 0x0c, 0x00, /* 0000110000 */
522 0x0c, 0x00, /* 0000110000 */
523 0x0c, 0x00, /* 0000110000 */
524 0x7f, 0x80, /* 0111111110 */
525 0x3f, 0x00, /* 0011111100 */
526 0x1e, 0x00, /* 0001111000 */
527 0x0c, 0x00, /* 0000110000 */
528 0x00, 0x00, /* 0000000000 */
529 0x00, 0x00, /* 0000000000 */
530 0x00, 0x00, /* 0000000000 */
531
532 /* 26 0x1a '^Z' */
533 0x00, 0x00, /* 0000000000 */
534 0x00, 0x00, /* 0000000000 */
535 0x00, 0x00, /* 0000000000 */
536 0x00, 0x00, /* 0000000000 */
537 0x04, 0x00, /* 0000010000 */
538 0x06, 0x00, /* 0000011000 */
539 0x07, 0x00, /* 0000011100 */
540 0x7f, 0x80, /* 0111111110 */
541 0x7f, 0x80, /* 0111111110 */
542 0x07, 0x00, /* 0000011100 */
543 0x06, 0x00, /* 0000011000 */
544 0x04, 0x00, /* 0000010000 */
545 0x00, 0x00, /* 0000000000 */
546 0x00, 0x00, /* 0000000000 */
547 0x00, 0x00, /* 0000000000 */
548 0x00, 0x00, /* 0000000000 */
549 0x00, 0x00, /* 0000000000 */
550 0x00, 0x00, /* 0000000000 */
551
552 /* 27 0x1b '^[' */
553 0x00, 0x00, /* 0000000000 */
554 0x00, 0x00, /* 0000000000 */
555 0x00, 0x00, /* 0000000000 */
556 0x00, 0x00, /* 0000000000 */
557 0x00, 0x00, /* 0000000000 */
558 0x08, 0x00, /* 0000100000 */
559 0x18, 0x00, /* 0001100000 */
560 0x38, 0x00, /* 0011100000 */
561 0x7f, 0x80, /* 0111111110 */
562 0x7f, 0x80, /* 0111111110 */
563 0x38, 0x00, /* 0011100000 */
564 0x18, 0x00, /* 0001100000 */
565 0x08, 0x00, /* 0000100000 */
566 0x00, 0x00, /* 0000000000 */
567 0x00, 0x00, /* 0000000000 */
568 0x00, 0x00, /* 0000000000 */
569 0x00, 0x00, /* 0000000000 */
570 0x00, 0x00, /* 0000000000 */
571
572 /* 28 0x1c '^\' */
573 0x00, 0x00, /* 0000000000 */
574 0x00, 0x00, /* 0000000000 */
575 0x00, 0x00, /* 0000000000 */
576 0x00, 0x00, /* 0000000000 */
577 0x00, 0x00, /* 0000000000 */
578 0x60, 0x00, /* 0110000000 */
579 0x60, 0x00, /* 0110000000 */
580 0x60, 0x00, /* 0110000000 */
581 0x7f, 0x80, /* 0111111110 */
582 0x7f, 0x80, /* 0111111110 */
583 0x00, 0x00, /* 0000000000 */
584 0x00, 0x00, /* 0000000000 */
585 0x00, 0x00, /* 0000000000 */
586 0x00, 0x00, /* 0000000000 */
587 0x00, 0x00, /* 0000000000 */
588 0x00, 0x00, /* 0000000000 */
589 0x00, 0x00, /* 0000000000 */
590 0x00, 0x00, /* 0000000000 */
591
592 /* 29 0x1d '^]' */
593 0x00, 0x00, /* 0000000000 */
594 0x00, 0x00, /* 0000000000 */
595 0x00, 0x00, /* 0000000000 */
596 0x00, 0x00, /* 0000000000 */
597 0x00, 0x00, /* 0000000000 */
598 0x12, 0x00, /* 0001001000 */
599 0x33, 0x00, /* 0011001100 */
600 0x73, 0x80, /* 0111001110 */
601 0xff, 0xc0, /* 1111111111 */
602 0xff, 0xc0, /* 1111111111 */
603 0x73, 0x80, /* 0111001110 */
604 0x33, 0x00, /* 0011001100 */
605 0x12, 0x00, /* 0001001000 */
606 0x00, 0x00, /* 0000000000 */
607 0x00, 0x00, /* 0000000000 */
608 0x00, 0x00, /* 0000000000 */
609 0x00, 0x00, /* 0000000000 */
610 0x00, 0x00, /* 0000000000 */
611
612 /* 30 0x1e '^^' */
613 0x00, 0x00, /* 0000000000 */
614 0x00, 0x00, /* 0000000000 */
615 0x00, 0x00, /* 0000000000 */
616 0x00, 0x00, /* 0000000000 */
617 0x00, 0x00, /* 0000000000 */
618 0x04, 0x00, /* 0000010000 */
619 0x04, 0x00, /* 0000010000 */
620 0x0e, 0x00, /* 0000111000 */
621 0x0e, 0x00, /* 0000111000 */
622 0x1f, 0x00, /* 0001111100 */
623 0x1f, 0x00, /* 0001111100 */
624 0x3f, 0x80, /* 0011111110 */
625 0x3f, 0x80, /* 0011111110 */
626 0x7f, 0xc0, /* 0111111111 */
627 0x7f, 0xc0, /* 0111111111 */
628 0x00, 0x00, /* 0000000000 */
629 0x00, 0x00, /* 0000000000 */
630 0x00, 0x00, /* 0000000000 */
631
632 /* 31 0x1f '^_' */
633 0x00, 0x00, /* 0000000000 */
634 0x00, 0x00, /* 0000000000 */
635 0x00, 0x00, /* 0000000000 */
636 0x00, 0x00, /* 0000000000 */
637 0x00, 0x00, /* 0000000000 */
638 0x7f, 0xc0, /* 0111111111 */
639 0x7f, 0xc0, /* 0111111111 */
640 0x3f, 0x80, /* 0011111110 */
641 0x3f, 0x80, /* 0011111110 */
642 0x1f, 0x00, /* 0001111100 */
643 0x1f, 0x00, /* 0001111100 */
644 0x0e, 0x00, /* 0000111000 */
645 0x0e, 0x00, /* 0000111000 */
646 0x04, 0x00, /* 0000010000 */
647 0x04, 0x00, /* 0000010000 */
648 0x00, 0x00, /* 0000000000 */
649 0x00, 0x00, /* 0000000000 */
650 0x00, 0x00, /* 0000000000 */
651
652 /* 32 0x20 ' ' */
653 0x00, 0x00, /* 0000000000 */
654 0x00, 0x00, /* 0000000000 */
655 0x00, 0x00, /* 0000000000 */
656 0x00, 0x00, /* 0000000000 */
657 0x00, 0x00, /* 0000000000 */
658 0x00, 0x00, /* 0000000000 */
659 0x00, 0x00, /* 0000000000 */
660 0x00, 0x00, /* 0000000000 */
661 0x00, 0x00, /* 0000000000 */
662 0x00, 0x00, /* 0000000000 */
663 0x00, 0x00, /* 0000000000 */
664 0x00, 0x00, /* 0000000000 */
665 0x00, 0x00, /* 0000000000 */
666 0x00, 0x00, /* 0000000000 */
667 0x00, 0x00, /* 0000000000 */
668 0x00, 0x00, /* 0000000000 */
669 0x00, 0x00, /* 0000000000 */
670 0x00, 0x00, /* 0000000000 */
671
672 /* 33 0x21 '!' */
673 0x00, 0x00, /* 0000000000 */
674 0x0c, 0x00, /* 0000110000 */
675 0x0c, 0x00, /* 0000110000 */
676 0x0c, 0x00, /* 0000110000 */
677 0x0c, 0x00, /* 0000110000 */
678 0x0c, 0x00, /* 0000110000 */
679 0x0c, 0x00, /* 0000110000 */
680 0x0c, 0x00, /* 0000110000 */
681 0x0c, 0x00, /* 0000110000 */
682 0x0c, 0x00, /* 0000110000 */
683 0x0c, 0x00, /* 0000110000 */
684 0x00, 0x00, /* 0000000000 */
685 0x0c, 0x00, /* 0000110000 */
686 0x0c, 0x00, /* 0000110000 */
687 0x00, 0x00, /* 0000000000 */
688 0x00, 0x00, /* 0000000000 */
689 0x00, 0x00, /* 0000000000 */
690 0x00, 0x00, /* 0000000000 */
691
692 /* 34 0x22 '"' */
693 0x00, 0x00, /* 0000000000 */
694 0x63, 0x00, /* 0110001100 */
695 0xf7, 0x80, /* 1111011110 */
696 0xf7, 0x80, /* 1111011110 */
697 0x31, 0x80, /* 0011000110 */
698 0x31, 0x80, /* 0011000110 */
699 0x63, 0x00, /* 0110001100 */
700 0x42, 0x00, /* 0100001000 */
701 0x00, 0x00, /* 0000000000 */
702 0x00, 0x00, /* 0000000000 */
703 0x00, 0x00, /* 0000000000 */
704 0x00, 0x00, /* 0000000000 */
705 0x00, 0x00, /* 0000000000 */
706 0x00, 0x00, /* 0000000000 */
707 0x00, 0x00, /* 0000000000 */
708 0x00, 0x00, /* 0000000000 */
709 0x00, 0x00, /* 0000000000 */
710 0x00, 0x00, /* 0000000000 */
711
712 /* 35 0x23 '#' */
713 0x00, 0x00, /* 0000000000 */
714 0x33, 0x00, /* 0011001100 */
715 0x33, 0x00, /* 0011001100 */
716 0x7f, 0x80, /* 0111111110 */
717 0x7f, 0x80, /* 0111111110 */
718 0x33, 0x00, /* 0011001100 */
719 0x33, 0x00, /* 0011001100 */
720 0x33, 0x00, /* 0011001100 */
721 0x33, 0x00, /* 0011001100 */
722 0x7f, 0x80, /* 0111111110 */
723 0x7f, 0x80, /* 0111111110 */
724 0x33, 0x00, /* 0011001100 */
725 0x33, 0x00, /* 0011001100 */
726 0x00, 0x00, /* 0000000000 */
727 0x00, 0x00, /* 0000000000 */
728 0x00, 0x00, /* 0000000000 */
729 0x00, 0x00, /* 0000000000 */
730 0x00, 0x00, /* 0000000000 */
731
732 /* 36 0x24 '$' */
733 0x00, 0x00, /* 0000000000 */
734 0x0c, 0x00, /* 0000110000 */
735 0x3e, 0x00, /* 0011111000 */
736 0x3f, 0x00, /* 0011111100 */
737 0x6f, 0x80, /* 0110111110 */
738 0x6d, 0x80, /* 0110110110 */
739 0x6c, 0x80, /* 0110110010 */
740 0x3c, 0x00, /* 0011110000 */
741 0x0f, 0x00, /* 0000111100 */
742 0x0d, 0x80, /* 0000110110 */
743 0x4d, 0x80, /* 0100110110 */
744 0x6d, 0x80, /* 0110110110 */
745 0x7f, 0x00, /* 0111111100 */
746 0x3e, 0x00, /* 0011111000 */
747 0x0c, 0x00, /* 0000110000 */
748 0x00, 0x00, /* 0000000000 */
749 0x00, 0x00, /* 0000000000 */
750 0x00, 0x00, /* 0000000000 */
751
752 /* 37 0x25 '%' */
753 0x00, 0x00, /* 0000000000 */
754 0x31, 0x80, /* 0011000110 */
755 0x7b, 0x00, /* 0111101100 */
756 0x7b, 0x00, /* 0111101100 */
757 0x36, 0x00, /* 0011011000 */
758 0x06, 0x00, /* 0000011000 */
759 0x0c, 0x00, /* 0000110000 */
760 0x0c, 0x00, /* 0000110000 */
761 0x18, 0x00, /* 0001100000 */
762 0x1b, 0x00, /* 0001101100 */
763 0x37, 0x80, /* 0011011110 */
764 0x37, 0x80, /* 0011011110 */
765 0x63, 0x00, /* 0110001100 */
766 0x00, 0x00, /* 0000000000 */
767 0x00, 0x00, /* 0000000000 */
768 0x00, 0x00, /* 0000000000 */
769 0x00, 0x00, /* 0000000000 */
770 0x00, 0x00, /* 0000000000 */
771
772 /* 38 0x26 '&' */
773 0x00, 0x00, /* 0000000000 */
774 0x07, 0x00, /* 0000011100 */
775 0x0f, 0x80, /* 0000111110 */
776 0x19, 0x80, /* 0001100110 */
777 0x19, 0x80, /* 0001100110 */
778 0x0f, 0x80, /* 0000111110 */
779 0x1e, 0x00, /* 0001111000 */
780 0x3e, 0x00, /* 0011111000 */
781 0x76, 0x00, /* 0111011000 */
782 0x66, 0x40, /* 0110011001 */
783 0x63, 0xc0, /* 0110001111 */
784 0x63, 0x80, /* 0110001110 */
785 0x63, 0x00, /* 0110001100 */
786 0x3f, 0x80, /* 0011111110 */
787 0x1c, 0xc0, /* 0001110011 */
788 0x00, 0x00, /* 0000000000 */
789 0x00, 0x00, /* 0000000000 */
790 0x00, 0x00, /* 0000000000 */
791
792 /* 39 0x27 ''' */
793 0x00, 0x00, /* 0000000000 */
794 0x30, 0x00, /* 0011000000 */
795 0x78, 0x00, /* 0111100000 */
796 0x78, 0x00, /* 0111100000 */
797 0x18, 0x00, /* 0001100000 */
798 0x18, 0x00, /* 0001100000 */
799 0x30, 0x00, /* 0011000000 */
800 0x20, 0x00, /* 0010000000 */
801 0x00, 0x00, /* 0000000000 */
802 0x00, 0x00, /* 0000000000 */
803 0x00, 0x00, /* 0000000000 */
804 0x00, 0x00, /* 0000000000 */
805 0x00, 0x00, /* 0000000000 */
806 0x00, 0x00, /* 0000000000 */
807 0x00, 0x00, /* 0000000000 */
808 0x00, 0x00, /* 0000000000 */
809 0x00, 0x00, /* 0000000000 */
810 0x00, 0x00, /* 0000000000 */
811
812 /* 40 0x28 '(' */
813 0x00, 0x00, /* 0000000000 */
814 0x03, 0x00, /* 0000001100 */
815 0x06, 0x00, /* 0000011000 */
816 0x0c, 0x00, /* 0000110000 */
817 0x0c, 0x00, /* 0000110000 */
818 0x18, 0x00, /* 0001100000 */
819 0x18, 0x00, /* 0001100000 */
820 0x18, 0x00, /* 0001100000 */
821 0x18, 0x00, /* 0001100000 */
822 0x18, 0x00, /* 0001100000 */
823 0x18, 0x00, /* 0001100000 */
824 0x0c, 0x00, /* 0000110000 */
825 0x0c, 0x00, /* 0000110000 */
826 0x06, 0x00, /* 0000011000 */
827 0x03, 0x00, /* 0000001100 */
828 0x00, 0x00, /* 0000000000 */
829 0x00, 0x00, /* 0000000000 */
830 0x00, 0x00, /* 0000000000 */
831
832 /* 41 0x29 ')' */
833 0x00, 0x00, /* 0000000000 */
834 0x30, 0x00, /* 0011000000 */
835 0x18, 0x00, /* 0001100000 */
836 0x0c, 0x00, /* 0000110000 */
837 0x0c, 0x00, /* 0000110000 */
838 0x06, 0x00, /* 0000011000 */
839 0x06, 0x00, /* 0000011000 */
840 0x06, 0x00, /* 0000011000 */
841 0x06, 0x00, /* 0000011000 */
842 0x06, 0x00, /* 0000011000 */
843 0x06, 0x00, /* 0000011000 */
844 0x0c, 0x00, /* 0000110000 */
845 0x0c, 0x00, /* 0000110000 */
846 0x18, 0x00, /* 0001100000 */
847 0x30, 0x00, /* 0011000000 */
848 0x00, 0x00, /* 0000000000 */
849 0x00, 0x00, /* 0000000000 */
850 0x00, 0x00, /* 0000000000 */
851
852 /* 42 0x2a '*' */
853 0x00, 0x00, /* 0000000000 */
854 0x00, 0x00, /* 0000000000 */
855 0x00, 0x00, /* 0000000000 */
856 0x0c, 0x00, /* 0000110000 */
857 0x4c, 0x80, /* 0100110010 */
858 0x6d, 0x80, /* 0110110110 */
859 0x3f, 0x00, /* 0011111100 */
860 0x7f, 0x80, /* 0111111110 */
861 0x3f, 0x00, /* 0011111100 */
862 0x6d, 0x80, /* 0110110110 */
863 0x4c, 0x80, /* 0100110010 */
864 0x0c, 0x00, /* 0000110000 */
865 0x00, 0x00, /* 0000000000 */
866 0x00, 0x00, /* 0000000000 */
867 0x00, 0x00, /* 0000000000 */
868 0x00, 0x00, /* 0000000000 */
869 0x00, 0x00, /* 0000000000 */
870 0x00, 0x00, /* 0000000000 */
871
872 /* 43 0x2b '+' */
873 0x00, 0x00, /* 0000000000 */
874 0x00, 0x00, /* 0000000000 */
875 0x00, 0x00, /* 0000000000 */
876 0x0c, 0x00, /* 0000110000 */
877 0x0c, 0x00, /* 0000110000 */
878 0x0c, 0x00, /* 0000110000 */
879 0x0c, 0x00, /* 0000110000 */
880 0x7f, 0x80, /* 0111111110 */
881 0x7f, 0x80, /* 0111111110 */
882 0x0c, 0x00, /* 0000110000 */
883 0x0c, 0x00, /* 0000110000 */
884 0x0c, 0x00, /* 0000110000 */
885 0x0c, 0x00, /* 0000110000 */
886 0x00, 0x00, /* 0000000000 */
887 0x00, 0x00, /* 0000000000 */
888 0x00, 0x00, /* 0000000000 */
889 0x00, 0x00, /* 0000000000 */
890 0x00, 0x00, /* 0000000000 */
891
892 /* 44 0x2c ',' */
893 0x00, 0x00, /* 0000000000 */
894 0x00, 0x00, /* 0000000000 */
895 0x00, 0x00, /* 0000000000 */
896 0x00, 0x00, /* 0000000000 */
897 0x00, 0x00, /* 0000000000 */
898 0x00, 0x00, /* 0000000000 */
899 0x00, 0x00, /* 0000000000 */
900 0x00, 0x00, /* 0000000000 */
901 0x00, 0x00, /* 0000000000 */
902 0x00, 0x00, /* 0000000000 */
903 0x30, 0x00, /* 0011000000 */
904 0x78, 0x00, /* 0111100000 */
905 0x78, 0x00, /* 0111100000 */
906 0x18, 0x00, /* 0001100000 */
907 0x18, 0x00, /* 0001100000 */
908 0x30, 0x00, /* 0011000000 */
909 0x60, 0x00, /* 0110000000 */
910 0x40, 0x00, /* 0100000000 */
911
912 /* 45 0x2d '-' */
913 0x00, 0x00, /* 0000000000 */
914 0x00, 0x00, /* 0000000000 */
915 0x00, 0x00, /* 0000000000 */
916 0x00, 0x00, /* 0000000000 */
917 0x00, 0x00, /* 0000000000 */
918 0x00, 0x00, /* 0000000000 */
919 0x00, 0x00, /* 0000000000 */
920 0x00, 0x00, /* 0000000000 */
921 0x7f, 0x80, /* 0111111110 */
922 0x7f, 0x80, /* 0111111110 */
923 0x00, 0x00, /* 0000000000 */
924 0x00, 0x00, /* 0000000000 */
925 0x00, 0x00, /* 0000000000 */
926 0x00, 0x00, /* 0000000000 */
927 0x00, 0x00, /* 0000000000 */
928 0x00, 0x00, /* 0000000000 */
929 0x00, 0x00, /* 0000000000 */
930 0x00, 0x00, /* 0000000000 */
931
932 /* 46 0x2e '.' */
933 0x00, 0x00, /* 0000000000 */
934 0x00, 0x00, /* 0000000000 */
935 0x00, 0x00, /* 0000000000 */
936 0x00, 0x00, /* 0000000000 */
937 0x00, 0x00, /* 0000000000 */
938 0x00, 0x00, /* 0000000000 */
939 0x00, 0x00, /* 0000000000 */
940 0x00, 0x00, /* 0000000000 */
941 0x00, 0x00, /* 0000000000 */
942 0x00, 0x00, /* 0000000000 */
943 0x00, 0x00, /* 0000000000 */
944 0x18, 0x00, /* 0001100000 */
945 0x3c, 0x00, /* 0011110000 */
946 0x3c, 0x00, /* 0011110000 */
947 0x18, 0x00, /* 0001100000 */
948 0x00, 0x00, /* 0000000000 */
949 0x00, 0x00, /* 0000000000 */
950 0x00, 0x00, /* 0000000000 */
951
952 /* 47 0x2f '/' */
953 0x00, 0x00, /* 0000000000 */
954 0x01, 0x80, /* 0000000110 */
955 0x01, 0x80, /* 0000000110 */
956 0x03, 0x00, /* 0000001100 */
957 0x03, 0x00, /* 0000001100 */
958 0x06, 0x00, /* 0000011000 */
959 0x06, 0x00, /* 0000011000 */
960 0x0c, 0x00, /* 0000110000 */
961 0x0c, 0x00, /* 0000110000 */
962 0x18, 0x00, /* 0001100000 */
963 0x18, 0x00, /* 0001100000 */
964 0x30, 0x00, /* 0011000000 */
965 0x30, 0x00, /* 0011000000 */
966 0x60, 0x00, /* 0110000000 */
967 0x60, 0x00, /* 0110000000 */
968 0x00, 0x00, /* 0000000000 */
969 0x00, 0x00, /* 0000000000 */
970 0x00, 0x00, /* 0000000000 */
971
972 /* 48 0x30 '0' */
973 0x00, 0x00, /* 0000000000 */
974 0x0e, 0x00, /* 0000111000 */
975 0x1f, 0x00, /* 0001111100 */
976 0x23, 0x00, /* 0010001100 */
977 0x61, 0x80, /* 0110000110 */
978 0x63, 0x80, /* 0110001110 */
979 0x65, 0x80, /* 0110010110 */
980 0x65, 0x80, /* 0110010110 */
981 0x69, 0x80, /* 0110100110 */
982 0x69, 0x80, /* 0110100110 */
983 0x71, 0x80, /* 0111000110 */
984 0x61, 0x00, /* 0110000100 */
985 0x31, 0x00, /* 0011000100 */
986 0x3e, 0x00, /* 0011111000 */
987 0x1c, 0x00, /* 0001110000 */
988 0x00, 0x00, /* 0000000000 */
989 0x00, 0x00, /* 0000000000 */
990 0x00, 0x00, /* 0000000000 */
991
992 /* 49 0x31 '1' */
993 0x00, 0x00, /* 0000000000 */
994 0x04, 0x00, /* 0000010000 */
995 0x0c, 0x00, /* 0000110000 */
996 0x1c, 0x00, /* 0001110000 */
997 0x3c, 0x00, /* 0011110000 */
998 0x6c, 0x00, /* 0110110000 */
999 0x0c, 0x00, /* 0000110000 */
1000 0x0c, 0x00, /* 0000110000 */
1001 0x0c, 0x00, /* 0000110000 */
1002 0x0c, 0x00, /* 0000110000 */
1003 0x0c, 0x00, /* 0000110000 */
1004 0x0c, 0x00, /* 0000110000 */
1005 0x0c, 0x00, /* 0000110000 */
1006 0x0c, 0x00, /* 0000110000 */
1007 0x7f, 0x80, /* 0111111110 */
1008 0x00, 0x00, /* 0000000000 */
1009 0x00, 0x00, /* 0000000000 */
1010 0x00, 0x00, /* 0000000000 */
1011
1012 /* 50 0x32 '2' */
1013 0x00, 0x00, /* 0000000000 */
1014 0x1e, 0x00, /* 0001111000 */
1015 0x3f, 0x00, /* 0011111100 */
1016 0x63, 0x80, /* 0110001110 */
1017 0x41, 0x80, /* 0100000110 */
1018 0x01, 0x80, /* 0000000110 */
1019 0x01, 0x80, /* 0000000110 */
1020 0x03, 0x00, /* 0000001100 */
1021 0x06, 0x00, /* 0000011000 */
1022 0x06, 0x00, /* 0000011000 */
1023 0x0c, 0x00, /* 0000110000 */
1024 0x18, 0x00, /* 0001100000 */
1025 0x30, 0x80, /* 0011000010 */
1026 0x7f, 0x80, /* 0111111110 */
1027 0x7f, 0x80, /* 0111111110 */
1028 0x00, 0x00, /* 0000000000 */
1029 0x00, 0x00, /* 0000000000 */
1030 0x00, 0x00, /* 0000000000 */
1031
1032 /* 51 0x33 '3' */
1033 0x00, 0x00, /* 0000000000 */
1034 0x1c, 0x00, /* 0001110000 */
1035 0x3e, 0x00, /* 0011111000 */
1036 0x47, 0x00, /* 0100011100 */
1037 0x03, 0x00, /* 0000001100 */
1038 0x07, 0x00, /* 0000011100 */
1039 0x06, 0x00, /* 0000011000 */
1040 0x0e, 0x00, /* 0000111000 */
1041 0x07, 0x00, /* 0000011100 */
1042 0x03, 0x00, /* 0000001100 */
1043 0x01, 0x80, /* 0000000110 */
1044 0x41, 0x80, /* 0100000110 */
1045 0x61, 0x80, /* 0110000110 */
1046 0x3f, 0x00, /* 0011111100 */
1047 0x1e, 0x00, /* 0001111000 */
1048 0x00, 0x00, /* 0000000000 */
1049 0x00, 0x00, /* 0000000000 */
1050 0x00, 0x00, /* 0000000000 */
1051
1052 /* 52 0x34 '4' */
1053 0x00, 0x00, /* 0000000000 */
1054 0x06, 0x00, /* 0000011000 */
1055 0x0e, 0x00, /* 0000111000 */
1056 0x1e, 0x00, /* 0001111000 */
1057 0x36, 0x00, /* 0011011000 */
1058 0x36, 0x00, /* 0011011000 */
1059 0x66, 0x00, /* 0110011000 */
1060 0x66, 0x00, /* 0110011000 */
1061 0xc6, 0x00, /* 1100011000 */
1062 0xc6, 0x00, /* 1100011000 */
1063 0xff, 0x80, /* 1111111110 */
1064 0xff, 0x80, /* 1111111110 */
1065 0x06, 0x00, /* 0000011000 */
1066 0x06, 0x00, /* 0000011000 */
1067 0x06, 0x00, /* 0000011000 */
1068 0x00, 0x00, /* 0000000000 */
1069 0x00, 0x00, /* 0000000000 */
1070 0x00, 0x00, /* 0000000000 */
1071
1072 /* 53 0x35 '5' */
1073 0x00, 0x00, /* 0000000000 */
1074 0x1f, 0x00, /* 0001111100 */
1075 0x1f, 0x00, /* 0001111100 */
1076 0x30, 0x00, /* 0011000000 */
1077 0x30, 0x00, /* 0011000000 */
1078 0x60, 0x00, /* 0110000000 */
1079 0x7e, 0x00, /* 0111111000 */
1080 0x67, 0x00, /* 0110011100 */
1081 0x03, 0x80, /* 0000001110 */
1082 0x01, 0x80, /* 0000000110 */
1083 0x01, 0x80, /* 0000000110 */
1084 0x01, 0x80, /* 0000000110 */
1085 0x41, 0x80, /* 0100000110 */
1086 0x63, 0x00, /* 0110001100 */
1087 0x3e, 0x00, /* 0011111000 */
1088 0x00, 0x00, /* 0000000000 */
1089 0x00, 0x00, /* 0000000000 */
1090 0x00, 0x00, /* 0000000000 */
1091
1092 /* 54 0x36 '6' */
1093 0x00, 0x00, /* 0000000000 */
1094 0x06, 0x00, /* 0000011000 */
1095 0x0c, 0x00, /* 0000110000 */
1096 0x18, 0x00, /* 0001100000 */
1097 0x30, 0x00, /* 0011000000 */
1098 0x30, 0x00, /* 0011000000 */
1099 0x60, 0x00, /* 0110000000 */
1100 0x6e, 0x00, /* 0110111000 */
1101 0x7f, 0x00, /* 0111111100 */
1102 0x73, 0x80, /* 0111001110 */
1103 0x61, 0x80, /* 0110000110 */
1104 0x61, 0x80, /* 0110000110 */
1105 0x71, 0x00, /* 0111000100 */
1106 0x3e, 0x00, /* 0011111000 */
1107 0x1c, 0x00, /* 0001110000 */
1108 0x00, 0x00, /* 0000000000 */
1109 0x00, 0x00, /* 0000000000 */
1110 0x00, 0x00, /* 0000000000 */
1111
1112 /* 55 0x37 '7' */
1113 0x00, 0x00, /* 0000000000 */
1114 0x1f, 0x80, /* 0001111110 */
1115 0x3f, 0x80, /* 0011111110 */
1116 0x61, 0x80, /* 0110000110 */
1117 0x01, 0x80, /* 0000000110 */
1118 0x03, 0x00, /* 0000001100 */
1119 0x03, 0x00, /* 0000001100 */
1120 0x06, 0x00, /* 0000011000 */
1121 0x06, 0x00, /* 0000011000 */
1122 0x0c, 0x00, /* 0000110000 */
1123 0x0c, 0x00, /* 0000110000 */
1124 0x18, 0x00, /* 0001100000 */
1125 0x18, 0x00, /* 0001100000 */
1126 0x30, 0x00, /* 0011000000 */
1127 0x30, 0x00, /* 0011000000 */
1128 0x00, 0x00, /* 0000000000 */
1129 0x00, 0x00, /* 0000000000 */
1130 0x00, 0x00, /* 0000000000 */
1131
1132 /* 56 0x38 '8' */
1133 0x00, 0x00, /* 0000000000 */
1134 0x1e, 0x00, /* 0001111000 */
1135 0x23, 0x00, /* 0010001100 */
1136 0x61, 0x80, /* 0110000110 */
1137 0x61, 0x80, /* 0110000110 */
1138 0x31, 0x00, /* 0011000100 */
1139 0x1a, 0x00, /* 0001101000 */
1140 0x0c, 0x00, /* 0000110000 */
1141 0x16, 0x00, /* 0001011000 */
1142 0x23, 0x00, /* 0010001100 */
1143 0x61, 0x80, /* 0110000110 */
1144 0x61, 0x80, /* 0110000110 */
1145 0x61, 0x80, /* 0110000110 */
1146 0x31, 0x00, /* 0011000100 */
1147 0x1e, 0x00, /* 0001111000 */
1148 0x00, 0x00, /* 0000000000 */
1149 0x00, 0x00, /* 0000000000 */
1150 0x00, 0x00, /* 0000000000 */
1151
1152 /* 57 0x39 '9' */
1153 0x00, 0x00, /* 0000000000 */
1154 0x0e, 0x00, /* 0000111000 */
1155 0x17, 0x00, /* 0001011100 */
1156 0x23, 0x80, /* 0010001110 */
1157 0x61, 0x80, /* 0110000110 */
1158 0x61, 0x80, /* 0110000110 */
1159 0x61, 0x80, /* 0110000110 */
1160 0x73, 0x80, /* 0111001110 */
1161 0x3d, 0x80, /* 0011110110 */
1162 0x19, 0x80, /* 0001100110 */
1163 0x01, 0x80, /* 0000000110 */
1164 0x03, 0x00, /* 0000001100 */
1165 0x03, 0x00, /* 0000001100 */
1166 0x06, 0x00, /* 0000011000 */
1167 0x0c, 0x00, /* 0000110000 */
1168 0x18, 0x00, /* 0001100000 */
1169 0x00, 0x00, /* 0000000000 */
1170 0x00, 0x00, /* 0000000000 */
1171
1172 /* 58 0x3a ':' */
1173 0x00, 0x00, /* 0000000000 */
1174 0x00, 0x00, /* 0000000000 */
1175 0x00, 0x00, /* 0000000000 */
1176 0x00, 0x00, /* 0000000000 */
1177 0x18, 0x00, /* 0001100000 */
1178 0x3c, 0x00, /* 0011110000 */
1179 0x3c, 0x00, /* 0011110000 */
1180 0x18, 0x00, /* 0001100000 */
1181 0x00, 0x00, /* 0000000000 */
1182 0x00, 0x00, /* 0000000000 */
1183 0x18, 0x00, /* 0001100000 */
1184 0x3c, 0x00, /* 0011110000 */
1185 0x3c, 0x00, /* 0011110000 */
1186 0x18, 0x00, /* 0001100000 */
1187 0x00, 0x00, /* 0000000000 */
1188 0x00, 0x00, /* 0000000000 */
1189 0x00, 0x00, /* 0000000000 */
1190 0x00, 0x00, /* 0000000000 */
1191
1192 /* 59 0x3b ';' */
1193 0x00, 0x00, /* 0000000000 */
1194 0x00, 0x00, /* 0000000000 */
1195 0x00, 0x00, /* 0000000000 */
1196 0x00, 0x00, /* 0000000000 */
1197 0x00, 0x00, /* 0000000000 */
1198 0x00, 0x00, /* 0000000000 */
1199 0x18, 0x00, /* 0001100000 */
1200 0x3c, 0x00, /* 0011110000 */
1201 0x3c, 0x00, /* 0011110000 */
1202 0x18, 0x00, /* 0001100000 */
1203 0x00, 0x00, /* 0000000000 */
1204 0x18, 0x00, /* 0001100000 */
1205 0x3c, 0x00, /* 0011110000 */
1206 0x3c, 0x00, /* 0011110000 */
1207 0x0c, 0x00, /* 0000110000 */
1208 0x18, 0x00, /* 0001100000 */
1209 0x30, 0x00, /* 0011000000 */
1210 0x20, 0x00, /* 0010000000 */
1211
1212 /* 60 0x3c '<' */
1213 0x00, 0x00, /* 0000000000 */
1214 0x00, 0x00, /* 0000000000 */
1215 0x03, 0x00, /* 0000001100 */
1216 0x06, 0x00, /* 0000011000 */
1217 0x0c, 0x00, /* 0000110000 */
1218 0x18, 0x00, /* 0001100000 */
1219 0x30, 0x00, /* 0011000000 */
1220 0x60, 0x00, /* 0110000000 */
1221 0x60, 0x00, /* 0110000000 */
1222 0x30, 0x00, /* 0011000000 */
1223 0x18, 0x00, /* 0001100000 */
1224 0x0c, 0x00, /* 0000110000 */
1225 0x06, 0x00, /* 0000011000 */
1226 0x03, 0x00, /* 0000001100 */
1227 0x00, 0x00, /* 0000000000 */
1228 0x00, 0x00, /* 0000000000 */
1229 0x00, 0x00, /* 0000000000 */
1230 0x00, 0x00, /* 0000000000 */
1231
1232 /* 61 0x3d '=' */
1233 0x00, 0x00, /* 0000000000 */
1234 0x00, 0x00, /* 0000000000 */
1235 0x00, 0x00, /* 0000000000 */
1236 0x00, 0x00, /* 0000000000 */
1237 0x00, 0x00, /* 0000000000 */
1238 0x00, 0x00, /* 0000000000 */
1239 0x7f, 0x80, /* 0111111110 */
1240 0x7f, 0x80, /* 0111111110 */
1241 0x00, 0x00, /* 0000000000 */
1242 0x00, 0x00, /* 0000000000 */
1243 0x7f, 0x80, /* 0111111110 */
1244 0x7f, 0x80, /* 0111111110 */
1245 0x00, 0x00, /* 0000000000 */
1246 0x00, 0x00, /* 0000000000 */
1247 0x00, 0x00, /* 0000000000 */
1248 0x00, 0x00, /* 0000000000 */
1249 0x00, 0x00, /* 0000000000 */
1250 0x00, 0x00, /* 0000000000 */
1251
1252 /* 62 0x3e '>' */
1253 0x00, 0x00, /* 0000000000 */
1254 0x00, 0x00, /* 0000000000 */
1255 0x30, 0x00, /* 0011000000 */
1256 0x18, 0x00, /* 0001100000 */
1257 0x0c, 0x00, /* 0000110000 */
1258 0x06, 0x00, /* 0000011000 */
1259 0x03, 0x00, /* 0000001100 */
1260 0x01, 0x80, /* 0000000110 */
1261 0x01, 0x80, /* 0000000110 */
1262 0x03, 0x00, /* 0000001100 */
1263 0x06, 0x00, /* 0000011000 */
1264 0x0c, 0x00, /* 0000110000 */
1265 0x18, 0x00, /* 0001100000 */
1266 0x30, 0x00, /* 0011000000 */
1267 0x00, 0x00, /* 0000000000 */
1268 0x00, 0x00, /* 0000000000 */
1269 0x00, 0x00, /* 0000000000 */
1270 0x00, 0x00, /* 0000000000 */
1271
1272 /* 63 0x3f '?' */
1273 0x00, 0x00, /* 0000000000 */
1274 0x0e, 0x00, /* 0000111000 */
1275 0x1f, 0x00, /* 0001111100 */
1276 0x3b, 0x80, /* 0011101110 */
1277 0x21, 0x80, /* 0010000110 */
1278 0x01, 0x80, /* 0000000110 */
1279 0x03, 0x00, /* 0000001100 */
1280 0x06, 0x00, /* 0000011000 */
1281 0x06, 0x00, /* 0000011000 */
1282 0x0c, 0x00, /* 0000110000 */
1283 0x0c, 0x00, /* 0000110000 */
1284 0x00, 0x00, /* 0000000000 */
1285 0x00, 0x00, /* 0000000000 */
1286 0x0c, 0x00, /* 0000110000 */
1287 0x0c, 0x00, /* 0000110000 */
1288 0x00, 0x00, /* 0000000000 */
1289 0x00, 0x00, /* 0000000000 */
1290 0x00, 0x00, /* 0000000000 */
1291
1292 /* 64 0x40 '@' */
1293 0x00, 0x00, /* 0000000000 */
1294 0x00, 0x00, /* 0000000000 */
1295 0x0e, 0x00, /* 0000111000 */
1296 0x3f, 0x00, /* 0011111100 */
1297 0x31, 0x80, /* 0011000110 */
1298 0x65, 0x80, /* 0110010110 */
1299 0x6d, 0x80, /* 0110110110 */
1300 0x6d, 0x80, /* 0110110110 */
1301 0x6d, 0x80, /* 0110110110 */
1302 0x6d, 0x80, /* 0110110110 */
1303 0x6f, 0x80, /* 0110111110 */
1304 0x60, 0x00, /* 0110000000 */
1305 0x31, 0x80, /* 0011000110 */
1306 0x3f, 0x80, /* 0011111110 */
1307 0x0f, 0x00, /* 0000111100 */
1308 0x00, 0x00, /* 0000000000 */
1309 0x00, 0x00, /* 0000000000 */
1310 0x00, 0x00, /* 0000000000 */
1311
1312 /* 65 0x41 'A' */
1313 0x00, 0x00, /* 0000000000 */
1314 0x04, 0x00, /* 0000010000 */
1315 0x04, 0x00, /* 0000010000 */
1316 0x0e, 0x00, /* 0000111000 */
1317 0x0e, 0x00, /* 0000111000 */
1318 0x1b, 0x00, /* 0001101100 */
1319 0x1b, 0x00, /* 0001101100 */
1320 0x19, 0x80, /* 0001100110 */
1321 0x31, 0x80, /* 0011000110 */
1322 0x3f, 0x80, /* 0011111110 */
1323 0x31, 0x80, /* 0011000110 */
1324 0x61, 0x80, /* 0110000110 */
1325 0x60, 0xc0, /* 0110000011 */
1326 0x60, 0xc0, /* 0110000011 */
1327 0xf1, 0xc0, /* 1111000111 */
1328 0x00, 0x00, /* 0000000000 */
1329 0x00, 0x00, /* 0000000000 */
1330 0x00, 0x00, /* 0000000000 */
1331
1332 /* 66 0x42 'B' */
1333 0x00, 0x00, /* 0000000000 */
1334 0xfc, 0x00, /* 1111110000 */
1335 0x62, 0x00, /* 0110001000 */
1336 0x63, 0x00, /* 0110001100 */
1337 0x63, 0x00, /* 0110001100 */
1338 0x63, 0x00, /* 0110001100 */
1339 0x66, 0x00, /* 0110011000 */
1340 0x7e, 0x00, /* 0111111000 */
1341 0x63, 0x00, /* 0110001100 */
1342 0x61, 0x80, /* 0110000110 */
1343 0x61, 0x80, /* 0110000110 */
1344 0x61, 0x80, /* 0110000110 */
1345 0x61, 0x80, /* 0110000110 */
1346 0x63, 0x00, /* 0110001100 */
1347 0xfe, 0x00, /* 1111111000 */
1348 0x00, 0x00, /* 0000000000 */
1349 0x00, 0x00, /* 0000000000 */
1350 0x00, 0x00, /* 0000000000 */
1351
1352 /* 67 0x43 'C' */
1353 0x00, 0x00, /* 0000000000 */
1354 0x0f, 0x00, /* 0000111100 */
1355 0x11, 0x80, /* 0001000110 */
1356 0x20, 0x80, /* 0010000010 */
1357 0x20, 0x00, /* 0010000000 */
1358 0x60, 0x00, /* 0110000000 */
1359 0x60, 0x00, /* 0110000000 */
1360 0x60, 0x00, /* 0110000000 */
1361 0x60, 0x00, /* 0110000000 */
1362 0x60, 0x00, /* 0110000000 */
1363 0x60, 0x00, /* 0110000000 */
1364 0x20, 0x00, /* 0010000000 */
1365 0x30, 0x80, /* 0011000010 */
1366 0x19, 0x00, /* 0001100100 */
1367 0x0e, 0x00, /* 0000111000 */
1368 0x00, 0x00, /* 0000000000 */
1369 0x00, 0x00, /* 0000000000 */
1370 0x00, 0x00, /* 0000000000 */
1371
1372 /* 68 0x44 'D' */
1373 0x00, 0x00, /* 0000000000 */
1374 0xfc, 0x00, /* 1111110000 */
1375 0x67, 0x00, /* 0110011100 */
1376 0x63, 0x00, /* 0110001100 */
1377 0x61, 0x80, /* 0110000110 */
1378 0x61, 0x80, /* 0110000110 */
1379 0x61, 0x80, /* 0110000110 */
1380 0x61, 0x80, /* 0110000110 */
1381 0x61, 0x80, /* 0110000110 */
1382 0x61, 0x80, /* 0110000110 */
1383 0x61, 0x80, /* 0110000110 */
1384 0x61, 0x80, /* 0110000110 */
1385 0x61, 0x00, /* 0110000100 */
1386 0x66, 0x00, /* 0110011000 */
1387 0xf8, 0x00, /* 1111100000 */
1388 0x00, 0x00, /* 0000000000 */
1389 0x00, 0x00, /* 0000000000 */
1390 0x00, 0x00, /* 0000000000 */
1391
1392 /* 69 0x45 'E' */
1393 0x00, 0x00, /* 0000000000 */
1394 0x7f, 0x80, /* 0111111110 */
1395 0x30, 0x80, /* 0011000010 */
1396 0x30, 0x80, /* 0011000010 */
1397 0x30, 0x00, /* 0011000000 */
1398 0x30, 0x00, /* 0011000000 */
1399 0x31, 0x00, /* 0011000100 */
1400 0x3f, 0x00, /* 0011111100 */
1401 0x31, 0x00, /* 0011000100 */
1402 0x30, 0x00, /* 0011000000 */
1403 0x30, 0x00, /* 0011000000 */
1404 0x30, 0x00, /* 0011000000 */
1405 0x30, 0x80, /* 0011000010 */
1406 0x30, 0x80, /* 0011000010 */
1407 0x7f, 0x80, /* 0111111110 */
1408 0x00, 0x00, /* 0000000000 */
1409 0x00, 0x00, /* 0000000000 */
1410 0x00, 0x00, /* 0000000000 */
1411
1412 /* 70 0x46 'F' */
1413 0x00, 0x00, /* 0000000000 */
1414 0x7f, 0x80, /* 0111111110 */
1415 0x30, 0x80, /* 0011000010 */
1416 0x30, 0x80, /* 0011000010 */
1417 0x30, 0x00, /* 0011000000 */
1418 0x30, 0x00, /* 0011000000 */
1419 0x31, 0x00, /* 0011000100 */
1420 0x3f, 0x00, /* 0011111100 */
1421 0x31, 0x00, /* 0011000100 */
1422 0x30, 0x00, /* 0011000000 */
1423 0x30, 0x00, /* 0011000000 */
1424 0x30, 0x00, /* 0011000000 */
1425 0x30, 0x00, /* 0011000000 */
1426 0x30, 0x00, /* 0011000000 */
1427 0x78, 0x00, /* 0111100000 */
1428 0x00, 0x00, /* 0000000000 */
1429 0x00, 0x00, /* 0000000000 */
1430 0x00, 0x00, /* 0000000000 */
1431
1432 /* 71 0x47 'G' */
1433 0x00, 0x00, /* 0000000000 */
1434 0x0f, 0x00, /* 0000111100 */
1435 0x11, 0x80, /* 0001000110 */
1436 0x20, 0x80, /* 0010000010 */
1437 0x20, 0x00, /* 0010000000 */
1438 0x60, 0x00, /* 0110000000 */
1439 0x60, 0x00, /* 0110000000 */
1440 0x60, 0x00, /* 0110000000 */
1441 0x60, 0x00, /* 0110000000 */
1442 0x67, 0xc0, /* 0110011111 */
1443 0x61, 0x80, /* 0110000110 */
1444 0x21, 0x80, /* 0010000110 */
1445 0x31, 0x80, /* 0011000110 */
1446 0x19, 0x80, /* 0001100110 */
1447 0x0e, 0x00, /* 0000111000 */
1448 0x00, 0x00, /* 0000000000 */
1449 0x00, 0x00, /* 0000000000 */
1450 0x00, 0x00, /* 0000000000 */
1451
1452 /* 72 0x48 'H' */
1453 0x00, 0x00, /* 0000000000 */
1454 0xf3, 0xc0, /* 1111001111 */
1455 0x61, 0x80, /* 0110000110 */
1456 0x61, 0x80, /* 0110000110 */
1457 0x61, 0x80, /* 0110000110 */
1458 0x61, 0x80, /* 0110000110 */
1459 0x61, 0x80, /* 0110000110 */
1460 0x7f, 0x80, /* 0111111110 */
1461 0x61, 0x80, /* 0110000110 */
1462 0x61, 0x80, /* 0110000110 */
1463 0x61, 0x80, /* 0110000110 */
1464 0x61, 0x80, /* 0110000110 */
1465 0x61, 0x80, /* 0110000110 */
1466 0x61, 0x80, /* 0110000110 */
1467 0xf3, 0xc0, /* 1111001111 */
1468 0x00, 0x00, /* 0000000000 */
1469 0x00, 0x00, /* 0000000000 */
1470 0x00, 0x00, /* 0000000000 */
1471
1472 /* 73 0x49 'I' */
1473 0x00, 0x00, /* 0000000000 */
1474 0x3f, 0x00, /* 0011111100 */
1475 0x0c, 0x00, /* 0000110000 */
1476 0x0c, 0x00, /* 0000110000 */
1477 0x0c, 0x00, /* 0000110000 */
1478 0x0c, 0x00, /* 0000110000 */
1479 0x0c, 0x00, /* 0000110000 */
1480 0x0c, 0x00, /* 0000110000 */
1481 0x0c, 0x00, /* 0000110000 */
1482 0x0c, 0x00, /* 0000110000 */
1483 0x0c, 0x00, /* 0000110000 */
1484 0x0c, 0x00, /* 0000110000 */
1485 0x0c, 0x00, /* 0000110000 */
1486 0x0c, 0x00, /* 0000110000 */
1487 0x3f, 0x00, /* 0011111100 */
1488 0x00, 0x00, /* 0000000000 */
1489 0x00, 0x00, /* 0000000000 */
1490 0x00, 0x00, /* 0000000000 */
1491
1492 /* 74 0x4a 'J' */
1493 0x00, 0x00, /* 0000000000 */
1494 0x3f, 0x00, /* 0011111100 */
1495 0x0c, 0x00, /* 0000110000 */
1496 0x0c, 0x00, /* 0000110000 */
1497 0x0c, 0x00, /* 0000110000 */
1498 0x0c, 0x00, /* 0000110000 */
1499 0x0c, 0x00, /* 0000110000 */
1500 0x0c, 0x00, /* 0000110000 */
1501 0x0c, 0x00, /* 0000110000 */
1502 0x0c, 0x00, /* 0000110000 */
1503 0x0c, 0x00, /* 0000110000 */
1504 0x0c, 0x00, /* 0000110000 */
1505 0x0c, 0x00, /* 0000110000 */
1506 0x0c, 0x00, /* 0000110000 */
1507 0x08, 0x00, /* 0000100000 */
1508 0x70, 0x00, /* 0111000000 */
1509 0x60, 0x00, /* 0110000000 */
1510 0x00, 0x00, /* 0000000000 */
1511
1512 /* 75 0x4b 'K' */
1513 0x00, 0x00, /* 0000000000 */
1514 0xf1, 0x80, /* 1111000110 */
1515 0x63, 0x00, /* 0110001100 */
1516 0x66, 0x00, /* 0110011000 */
1517 0x6c, 0x00, /* 0110110000 */
1518 0x78, 0x00, /* 0111100000 */
1519 0x70, 0x00, /* 0111000000 */
1520 0x70, 0x00, /* 0111000000 */
1521 0x78, 0x00, /* 0111100000 */
1522 0x78, 0x00, /* 0111100000 */
1523 0x6c, 0x00, /* 0110110000 */
1524 0x66, 0x00, /* 0110011000 */
1525 0x63, 0x00, /* 0110001100 */
1526 0x61, 0x80, /* 0110000110 */
1527 0xf0, 0xc0, /* 1111000011 */
1528 0x00, 0x00, /* 0000000000 */
1529 0x00, 0x00, /* 0000000000 */
1530 0x00, 0x00, /* 0000000000 */
1531
1532 /* 76 0x4c 'L' */
1533 0x00, 0x00, /* 0000000000 */
1534 0x78, 0x00, /* 0111100000 */
1535 0x30, 0x00, /* 0011000000 */
1536 0x30, 0x00, /* 0011000000 */
1537 0x30, 0x00, /* 0011000000 */
1538 0x30, 0x00, /* 0011000000 */
1539 0x30, 0x00, /* 0011000000 */
1540 0x30, 0x00, /* 0011000000 */
1541 0x30, 0x00, /* 0011000000 */
1542 0x30, 0x00, /* 0011000000 */
1543 0x30, 0x00, /* 0011000000 */
1544 0x30, 0x00, /* 0011000000 */
1545 0x30, 0x80, /* 0011000010 */
1546 0x30, 0x80, /* 0011000010 */
1547 0x7f, 0x80, /* 0111111110 */
1548 0x00, 0x00, /* 0000000000 */
1549 0x00, 0x00, /* 0000000000 */
1550 0x00, 0x00, /* 0000000000 */
1551
1552 /* 77 0x4d 'M' */
1553 0x00, 0x00, /* 0000000000 */
1554 0xe0, 0xc0, /* 1110000011 */
1555 0x61, 0x80, /* 0110000110 */
1556 0x73, 0x80, /* 0111001110 */
1557 0x73, 0x80, /* 0111001110 */
1558 0x6d, 0x80, /* 0110110110 */
1559 0x6d, 0x80, /* 0110110110 */
1560 0x61, 0x80, /* 0110000110 */
1561 0x61, 0x80, /* 0110000110 */
1562 0x61, 0x80, /* 0110000110 */
1563 0x61, 0x80, /* 0110000110 */
1564 0x61, 0x80, /* 0110000110 */
1565 0x61, 0x80, /* 0110000110 */
1566 0x61, 0x80, /* 0110000110 */
1567 0xf3, 0xc0, /* 1111001111 */
1568 0x00, 0x00, /* 0000000000 */
1569 0x00, 0x00, /* 0000000000 */
1570 0x00, 0x00, /* 0000000000 */
1571
1572 /* 78 0x4e 'N' */
1573 0x00, 0x00, /* 0000000000 */
1574 0xf3, 0xc0, /* 1111001111 */
1575 0x61, 0x80, /* 0110000110 */
1576 0x61, 0x80, /* 0110000110 */
1577 0x71, 0x80, /* 0111000110 */
1578 0x79, 0x80, /* 0111100110 */
1579 0x79, 0x80, /* 0111100110 */
1580 0x6d, 0x80, /* 0110110110 */
1581 0x6d, 0x80, /* 0110110110 */
1582 0x67, 0x80, /* 0110011110 */
1583 0x67, 0x80, /* 0110011110 */
1584 0x63, 0x80, /* 0110001110 */
1585 0x61, 0x80, /* 0110000110 */
1586 0x61, 0x80, /* 0110000110 */
1587 0xf3, 0xc0, /* 1111001111 */
1588 0x00, 0x00, /* 0000000000 */
1589 0x00, 0x00, /* 0000000000 */
1590 0x00, 0x00, /* 0000000000 */
1591
1592 /* 79 0x4f 'O' */
1593 0x00, 0x00, /* 0000000000 */
1594 0x0c, 0x00, /* 0000110000 */
1595 0x17, 0x00, /* 0001011100 */
1596 0x23, 0x00, /* 0010001100 */
1597 0x21, 0x80, /* 0010000110 */
1598 0x61, 0x80, /* 0110000110 */
1599 0x61, 0x80, /* 0110000110 */
1600 0x61, 0x80, /* 0110000110 */
1601 0x61, 0x80, /* 0110000110 */
1602 0x61, 0x80, /* 0110000110 */
1603 0x61, 0x80, /* 0110000110 */
1604 0x21, 0x00, /* 0010000100 */
1605 0x31, 0x00, /* 0011000100 */
1606 0x1a, 0x00, /* 0001101000 */
1607 0x0c, 0x00, /* 0000110000 */
1608 0x00, 0x00, /* 0000000000 */
1609 0x00, 0x00, /* 0000000000 */
1610 0x00, 0x00, /* 0000000000 */
1611
1612 /* 80 0x50 'P' */
1613 0x00, 0x00, /* 0000000000 */
1614 0xfe, 0x00, /* 1111111000 */
1615 0x63, 0x00, /* 0110001100 */
1616 0x61, 0x80, /* 0110000110 */
1617 0x61, 0x80, /* 0110000110 */
1618 0x61, 0x80, /* 0110000110 */
1619 0x63, 0x00, /* 0110001100 */
1620 0x7e, 0x00, /* 0111111000 */
1621 0x60, 0x00, /* 0110000000 */
1622 0x60, 0x00, /* 0110000000 */
1623 0x60, 0x00, /* 0110000000 */
1624 0x60, 0x00, /* 0110000000 */
1625 0x60, 0x00, /* 0110000000 */
1626 0x60, 0x00, /* 0110000000 */
1627 0xf0, 0x00, /* 1111000000 */
1628 0x00, 0x00, /* 0000000000 */
1629 0x00, 0x00, /* 0000000000 */
1630 0x00, 0x00, /* 0000000000 */
1631
1632 /* 81 0x51 'Q' */
1633 0x00, 0x00, /* 0000000000 */
1634 0x0e, 0x00, /* 0000111000 */
1635 0x13, 0x00, /* 0001001100 */
1636 0x23, 0x00, /* 0010001100 */
1637 0x21, 0x80, /* 0010000110 */
1638 0x61, 0x80, /* 0110000110 */
1639 0x61, 0x80, /* 0110000110 */
1640 0x61, 0x80, /* 0110000110 */
1641 0x61, 0x80, /* 0110000110 */
1642 0x61, 0x80, /* 0110000110 */
1643 0x31, 0x80, /* 0011000110 */
1644 0x3b, 0x00, /* 0011101100 */
1645 0x1e, 0x00, /* 0001111000 */
1646 0x0c, 0x00, /* 0000110000 */
1647 0x1e, 0x00, /* 0001111000 */
1648 0x26, 0x00, /* 0010011000 */
1649 0x03, 0x80, /* 0000001110 */
1650 0x00, 0x00, /* 0000000000 */
1651
1652 /* 82 0x52 'R' */
1653 0x00, 0x00, /* 0000000000 */
1654 0xfe, 0x00, /* 1111111000 */
1655 0x63, 0x00, /* 0110001100 */
1656 0x61, 0x80, /* 0110000110 */
1657 0x61, 0x80, /* 0110000110 */
1658 0x61, 0x80, /* 0110000110 */
1659 0x61, 0x00, /* 0110000100 */
1660 0x7e, 0x00, /* 0111111000 */
1661 0x78, 0x00, /* 0111100000 */
1662 0x6c, 0x00, /* 0110110000 */
1663 0x6e, 0x00, /* 0110111000 */
1664 0x67, 0x00, /* 0110011100 */
1665 0x63, 0x80, /* 0110001110 */
1666 0x61, 0xc0, /* 0110000111 */
1667 0xf0, 0xc0, /* 1111000011 */
1668 0x00, 0x00, /* 0000000000 */
1669 0x00, 0x00, /* 0000000000 */
1670 0x00, 0x00, /* 0000000000 */
1671
1672 /* 83 0x53 'S' */
1673 0x00, 0x00, /* 0000000000 */
1674 0x1f, 0x00, /* 0001111100 */
1675 0x31, 0x80, /* 0011000110 */
1676 0x60, 0x80, /* 0110000010 */
1677 0x60, 0x00, /* 0110000000 */
1678 0x60, 0x00, /* 0110000000 */
1679 0x30, 0x00, /* 0011000000 */
1680 0x18, 0x00, /* 0001100000 */
1681 0x0c, 0x00, /* 0000110000 */
1682 0x06, 0x00, /* 0000011000 */
1683 0x03, 0x00, /* 0000001100 */
1684 0x01, 0x80, /* 0000000110 */
1685 0x41, 0x80, /* 0100000110 */
1686 0x63, 0x00, /* 0110001100 */
1687 0x3e, 0x00, /* 0011111000 */
1688 0x00, 0x00, /* 0000000000 */
1689 0x00, 0x00, /* 0000000000 */
1690 0x00, 0x00, /* 0000000000 */
1691
1692 /* 84 0x54 'T' */
1693 0x00, 0x00, /* 0000000000 */
1694 0x7f, 0x80, /* 0111111110 */
1695 0x4c, 0x80, /* 0100110010 */
1696 0x0c, 0x00, /* 0000110000 */
1697 0x0c, 0x00, /* 0000110000 */
1698 0x0c, 0x00, /* 0000110000 */
1699 0x0c, 0x00, /* 0000110000 */
1700 0x0c, 0x00, /* 0000110000 */
1701 0x0c, 0x00, /* 0000110000 */
1702 0x0c, 0x00, /* 0000110000 */
1703 0x0c, 0x00, /* 0000110000 */
1704 0x0c, 0x00, /* 0000110000 */
1705 0x0c, 0x00, /* 0000110000 */
1706 0x0c, 0x00, /* 0000110000 */
1707 0x3f, 0x00, /* 0011111100 */
1708 0x00, 0x00, /* 0000000000 */
1709 0x00, 0x00, /* 0000000000 */
1710 0x00, 0x00, /* 0000000000 */
1711
1712 /* 85 0x55 'U' */
1713 0x00, 0x00, /* 0000000000 */
1714 0xf3, 0xc0, /* 1111001111 */
1715 0x61, 0x80, /* 0110000110 */
1716 0x61, 0x80, /* 0110000110 */
1717 0x61, 0x80, /* 0110000110 */
1718 0x61, 0x80, /* 0110000110 */
1719 0x61, 0x80, /* 0110000110 */
1720 0x61, 0x80, /* 0110000110 */
1721 0x61, 0x80, /* 0110000110 */
1722 0x61, 0x80, /* 0110000110 */
1723 0x61, 0x80, /* 0110000110 */
1724 0x61, 0x80, /* 0110000110 */
1725 0x73, 0x00, /* 0111001100 */
1726 0x3f, 0x00, /* 0011111100 */
1727 0x1e, 0x00, /* 0001111000 */
1728 0x00, 0x00, /* 0000000000 */
1729 0x00, 0x00, /* 0000000000 */
1730 0x00, 0x00, /* 0000000000 */
1731
1732 /* 86 0x56 'V' */
1733 0x00, 0x00, /* 0000000000 */
1734 0xe1, 0xc0, /* 1110000111 */
1735 0xc0, 0xc0, /* 1100000011 */
1736 0x61, 0x80, /* 0110000110 */
1737 0x61, 0x80, /* 0110000110 */
1738 0x61, 0x80, /* 0110000110 */
1739 0x33, 0x00, /* 0011001100 */
1740 0x33, 0x00, /* 0011001100 */
1741 0x33, 0x00, /* 0011001100 */
1742 0x12, 0x00, /* 0001001000 */
1743 0x1e, 0x00, /* 0001111000 */
1744 0x1e, 0x00, /* 0001111000 */
1745 0x0c, 0x00, /* 0000110000 */
1746 0x0c, 0x00, /* 0000110000 */
1747 0x0c, 0x00, /* 0000110000 */
1748 0x00, 0x00, /* 0000000000 */
1749 0x00, 0x00, /* 0000000000 */
1750 0x00, 0x00, /* 0000000000 */
1751
1752 /* 87 0x57 'W' */
1753 0x00, 0x00, /* 0000000000 */
1754 0xe1, 0xc0, /* 1110000111 */
1755 0xc0, 0xc0, /* 1100000011 */
1756 0xc0, 0xc0, /* 1100000011 */
1757 0xc0, 0xc0, /* 1100000011 */
1758 0xe0, 0xc0, /* 1110000011 */
1759 0x61, 0x80, /* 0110000110 */
1760 0x6d, 0x80, /* 0110110110 */
1761 0x6d, 0x80, /* 0110110110 */
1762 0x7f, 0x80, /* 0111111110 */
1763 0x77, 0x00, /* 0111011100 */
1764 0x33, 0x00, /* 0011001100 */
1765 0x33, 0x00, /* 0011001100 */
1766 0x33, 0x00, /* 0011001100 */
1767 0x33, 0x00, /* 0011001100 */
1768 0x00, 0x00, /* 0000000000 */
1769 0x00, 0x00, /* 0000000000 */
1770 0x00, 0x00, /* 0000000000 */
1771
1772 /* 88 0x58 'X' */
1773 0x00, 0x00, /* 0000000000 */
1774 0xf7, 0x80, /* 1111011110 */
1775 0x63, 0x00, /* 0110001100 */
1776 0x63, 0x00, /* 0110001100 */
1777 0x36, 0x00, /* 0011011000 */
1778 0x36, 0x00, /* 0011011000 */
1779 0x36, 0x00, /* 0011011000 */
1780 0x1c, 0x00, /* 0001110000 */
1781 0x1c, 0x00, /* 0001110000 */
1782 0x36, 0x00, /* 0011011000 */
1783 0x36, 0x00, /* 0011011000 */
1784 0x36, 0x00, /* 0011011000 */
1785 0x63, 0x00, /* 0110001100 */
1786 0x63, 0x00, /* 0110001100 */
1787 0xf7, 0x80, /* 1111011110 */
1788 0x00, 0x00, /* 0000000000 */
1789 0x00, 0x00, /* 0000000000 */
1790 0x00, 0x00, /* 0000000000 */
1791
1792 /* 89 0x59 'Y' */
1793 0x00, 0x00, /* 0000000000 */
1794 0xf3, 0xc0, /* 1111001111 */
1795 0x61, 0x80, /* 0110000110 */
1796 0x61, 0x80, /* 0110000110 */
1797 0x33, 0x00, /* 0011001100 */
1798 0x33, 0x00, /* 0011001100 */
1799 0x1e, 0x00, /* 0001111000 */
1800 0x0c, 0x00, /* 0000110000 */
1801 0x0c, 0x00, /* 0000110000 */
1802 0x0c, 0x00, /* 0000110000 */
1803 0x0c, 0x00, /* 0000110000 */
1804 0x0c, 0x00, /* 0000110000 */
1805 0x0c, 0x00, /* 0000110000 */
1806 0x0c, 0x00, /* 0000110000 */
1807 0x1e, 0x00, /* 0001111000 */
1808 0x00, 0x00, /* 0000000000 */
1809 0x00, 0x00, /* 0000000000 */
1810 0x00, 0x00, /* 0000000000 */
1811
1812 /* 90 0x5a 'Z' */
1813 0x00, 0x00, /* 0000000000 */
1814 0x3f, 0x80, /* 0011111110 */
1815 0x21, 0x80, /* 0010000110 */
1816 0x01, 0x80, /* 0000000110 */
1817 0x03, 0x00, /* 0000001100 */
1818 0x03, 0x00, /* 0000001100 */
1819 0x06, 0x00, /* 0000011000 */
1820 0x06, 0x00, /* 0000011000 */
1821 0x0c, 0x00, /* 0000110000 */
1822 0x0c, 0x00, /* 0000110000 */
1823 0x18, 0x00, /* 0001100000 */
1824 0x18, 0x00, /* 0001100000 */
1825 0x30, 0x00, /* 0011000000 */
1826 0x30, 0x80, /* 0011000010 */
1827 0x3f, 0x80, /* 0011111110 */
1828 0x00, 0x00, /* 0000000000 */
1829 0x00, 0x00, /* 0000000000 */
1830 0x00, 0x00, /* 0000000000 */
1831
1832 /* 91 0x5b '[' */
1833 0x00, 0x00, /* 0000000000 */
1834 0x1f, 0x00, /* 0001111100 */
1835 0x1f, 0x00, /* 0001111100 */
1836 0x18, 0x00, /* 0001100000 */
1837 0x18, 0x00, /* 0001100000 */
1838 0x18, 0x00, /* 0001100000 */
1839 0x18, 0x00, /* 0001100000 */
1840 0x18, 0x00, /* 0001100000 */
1841 0x18, 0x00, /* 0001100000 */
1842 0x18, 0x00, /* 0001100000 */
1843 0x18, 0x00, /* 0001100000 */
1844 0x18, 0x00, /* 0001100000 */
1845 0x18, 0x00, /* 0001100000 */
1846 0x18, 0x00, /* 0001100000 */
1847 0x1f, 0x00, /* 0001111100 */
1848 0x1f, 0x00, /* 0001111100 */
1849 0x00, 0x00, /* 0000000000 */
1850 0x00, 0x00, /* 0000000000 */
1851
1852 /* 92 0x5c '\' */
1853 0x00, 0x00, /* 0000000000 */
1854 0xc0, 0x00, /* 1100000000 */
1855 0x60, 0x00, /* 0110000000 */
1856 0x60, 0x00, /* 0110000000 */
1857 0x30, 0x00, /* 0011000000 */
1858 0x30, 0x00, /* 0011000000 */
1859 0x18, 0x00, /* 0001100000 */
1860 0x18, 0x00, /* 0001100000 */
1861 0x0c, 0x00, /* 0000110000 */
1862 0x0c, 0x00, /* 0000110000 */
1863 0x06, 0x00, /* 0000011000 */
1864 0x06, 0x00, /* 0000011000 */
1865 0x03, 0x00, /* 0000001100 */
1866 0x03, 0x00, /* 0000001100 */
1867 0x01, 0x80, /* 0000000110 */
1868 0x01, 0x80, /* 0000000110 */
1869 0x00, 0xc0, /* 0000000011 */
1870 0x00, 0x00, /* 0000000000 */
1871
1872 /* 93 0x5d ']' */
1873 0x00, 0x00, /* 0000000000 */
1874 0x3e, 0x00, /* 0011111000 */
1875 0x3e, 0x00, /* 0011111000 */
1876 0x06, 0x00, /* 0000011000 */
1877 0x06, 0x00, /* 0000011000 */
1878 0x06, 0x00, /* 0000011000 */
1879 0x06, 0x00, /* 0000011000 */
1880 0x06, 0x00, /* 0000011000 */
1881 0x06, 0x00, /* 0000011000 */
1882 0x06, 0x00, /* 0000011000 */
1883 0x06, 0x00, /* 0000011000 */
1884 0x06, 0x00, /* 0000011000 */
1885 0x06, 0x00, /* 0000011000 */
1886 0x06, 0x00, /* 0000011000 */
1887 0x3e, 0x00, /* 0011111000 */
1888 0x3e, 0x00, /* 0011111000 */
1889 0x00, 0x00, /* 0000000000 */
1890 0x00, 0x00, /* 0000000000 */
1891
1892 /* 94 0x5e '^' */
1893 0x00, 0x00, /* 0000000000 */
1894 0x0c, 0x00, /* 0000110000 */
1895 0x1e, 0x00, /* 0001111000 */
1896 0x33, 0x00, /* 0011001100 */
1897 0x61, 0x80, /* 0110000110 */
1898 0x00, 0x00, /* 0000000000 */
1899 0x00, 0x00, /* 0000000000 */
1900 0x00, 0x00, /* 0000000000 */
1901 0x00, 0x00, /* 0000000000 */
1902 0x00, 0x00, /* 0000000000 */
1903 0x00, 0x00, /* 0000000000 */
1904 0x00, 0x00, /* 0000000000 */
1905 0x00, 0x00, /* 0000000000 */
1906 0x00, 0x00, /* 0000000000 */
1907 0x00, 0x00, /* 0000000000 */
1908 0x00, 0x00, /* 0000000000 */
1909 0x00, 0x00, /* 0000000000 */
1910 0x00, 0x00, /* 0000000000 */
1911
1912 /* 95 0x5f '_' */
1913 0x00, 0x00, /* 0000000000 */
1914 0x00, 0x00, /* 0000000000 */
1915 0x00, 0x00, /* 0000000000 */
1916 0x00, 0x00, /* 0000000000 */
1917 0x00, 0x00, /* 0000000000 */
1918 0x00, 0x00, /* 0000000000 */
1919 0x00, 0x00, /* 0000000000 */
1920 0x00, 0x00, /* 0000000000 */
1921 0x00, 0x00, /* 0000000000 */
1922 0x00, 0x00, /* 0000000000 */
1923 0x00, 0x00, /* 0000000000 */
1924 0x00, 0x00, /* 0000000000 */
1925 0x00, 0x00, /* 0000000000 */
1926 0x00, 0x00, /* 0000000000 */
1927 0x00, 0x00, /* 0000000000 */
1928 0xff, 0xc0, /* 1111111111 */
1929 0xff, 0xc0, /* 1111111111 */
1930 0x00, 0x00, /* 0000000000 */
1931
1932 /* 96 0x60 '`' */
1933 0x04, 0x00, /* 0000010000 */
1934 0x0c, 0x00, /* 0000110000 */
1935 0x18, 0x00, /* 0001100000 */
1936 0x18, 0x00, /* 0001100000 */
1937 0x1e, 0x00, /* 0001111000 */
1938 0x1e, 0x00, /* 0001111000 */
1939 0x0c, 0x00, /* 0000110000 */
1940 0x00, 0x00, /* 0000000000 */
1941 0x00, 0x00, /* 0000000000 */
1942 0x00, 0x00, /* 0000000000 */
1943 0x00, 0x00, /* 0000000000 */
1944 0x00, 0x00, /* 0000000000 */
1945 0x00, 0x00, /* 0000000000 */
1946 0x00, 0x00, /* 0000000000 */
1947 0x00, 0x00, /* 0000000000 */
1948 0x00, 0x00, /* 0000000000 */
1949 0x00, 0x00, /* 0000000000 */
1950 0x00, 0x00, /* 0000000000 */
1951
1952 /* 97 0x61 'a' */
1953 0x00, 0x00, /* 0000000000 */
1954 0x00, 0x00, /* 0000000000 */
1955 0x00, 0x00, /* 0000000000 */
1956 0x00, 0x00, /* 0000000000 */
1957 0x00, 0x00, /* 0000000000 */
1958 0x1f, 0x00, /* 0001111100 */
1959 0x31, 0x80, /* 0011000110 */
1960 0x21, 0x80, /* 0010000110 */
1961 0x07, 0x80, /* 0000011110 */
1962 0x39, 0x80, /* 0011100110 */
1963 0x61, 0x80, /* 0110000110 */
1964 0x61, 0x80, /* 0110000110 */
1965 0x61, 0x80, /* 0110000110 */
1966 0x73, 0x80, /* 0111001110 */
1967 0x3d, 0xc0, /* 0011110111 */
1968 0x00, 0x00, /* 0000000000 */
1969 0x00, 0x00, /* 0000000000 */
1970 0x00, 0x00, /* 0000000000 */
1971
1972 /* 98 0x62 'b' */
1973 0x20, 0x00, /* 0010000000 */
1974 0x60, 0x00, /* 0110000000 */
1975 0xe0, 0x00, /* 1110000000 */
1976 0x60, 0x00, /* 0110000000 */
1977 0x60, 0x00, /* 0110000000 */
1978 0x66, 0x00, /* 0110011000 */
1979 0x6f, 0x00, /* 0110111100 */
1980 0x73, 0x80, /* 0111001110 */
1981 0x61, 0x80, /* 0110000110 */
1982 0x61, 0x80, /* 0110000110 */
1983 0x61, 0x80, /* 0110000110 */
1984 0x61, 0x80, /* 0110000110 */
1985 0x71, 0x80, /* 0111000110 */
1986 0x7b, 0x00, /* 0111101100 */
1987 0x4e, 0x00, /* 0100111000 */
1988 0x00, 0x00, /* 0000000000 */
1989 0x00, 0x00, /* 0000000000 */
1990 0x00, 0x00, /* 0000000000 */
1991
1992 /* 99 0x63 'c' */
1993 0x00, 0x00, /* 0000000000 */
1994 0x00, 0x00, /* 0000000000 */
1995 0x00, 0x00, /* 0000000000 */
1996 0x00, 0x00, /* 0000000000 */
1997 0x00, 0x00, /* 0000000000 */
1998 0x1e, 0x00, /* 0001111000 */
1999 0x37, 0x00, /* 0011011100 */
2000 0x23, 0x00, /* 0010001100 */
2001 0x60, 0x00, /* 0110000000 */
2002 0x60, 0x00, /* 0110000000 */
2003 0x60, 0x00, /* 0110000000 */
2004 0x60, 0x00, /* 0110000000 */
2005 0x71, 0x00, /* 0111000100 */
2006 0x33, 0x00, /* 0011001100 */
2007 0x1e, 0x00, /* 0001111000 */
2008 0x00, 0x00, /* 0000000000 */
2009 0x00, 0x00, /* 0000000000 */
2010 0x00, 0x00, /* 0000000000 */
2011
2012 /* 100 0x64 'd' */
2013 0x01, 0x80, /* 0000000110 */
2014 0x03, 0x80, /* 0000001110 */
2015 0x01, 0x80, /* 0000000110 */
2016 0x01, 0x80, /* 0000000110 */
2017 0x01, 0x80, /* 0000000110 */
2018 0x0d, 0x80, /* 0000110110 */
2019 0x37, 0x80, /* 0011011110 */
2020 0x23, 0x80, /* 0010001110 */
2021 0x61, 0x80, /* 0110000110 */
2022 0x61, 0x80, /* 0110000110 */
2023 0x61, 0x80, /* 0110000110 */
2024 0x61, 0x80, /* 0110000110 */
2025 0x73, 0x80, /* 0111001110 */
2026 0x35, 0x80, /* 0011010110 */
2027 0x19, 0xc0, /* 0001100111 */
2028 0x00, 0x00, /* 0000000000 */
2029 0x00, 0x00, /* 0000000000 */
2030 0x00, 0x00, /* 0000000000 */
2031
2032 /* 101 0x65 'e' */
2033 0x00, 0x00, /* 0000000000 */
2034 0x00, 0x00, /* 0000000000 */
2035 0x00, 0x00, /* 0000000000 */
2036 0x00, 0x00, /* 0000000000 */
2037 0x00, 0x00, /* 0000000000 */
2038 0x0c, 0x00, /* 0000110000 */
2039 0x33, 0x00, /* 0011001100 */
2040 0x61, 0x80, /* 0110000110 */
2041 0x61, 0x80, /* 0110000110 */
2042 0x7f, 0x80, /* 0111111110 */
2043 0x60, 0x00, /* 0110000000 */
2044 0x60, 0x00, /* 0110000000 */
2045 0x30, 0x00, /* 0011000000 */
2046 0x19, 0x80, /* 0001100110 */
2047 0x0e, 0x00, /* 0000111000 */
2048 0x00, 0x00, /* 0000000000 */
2049 0x00, 0x00, /* 0000000000 */
2050 0x00, 0x00, /* 0000000000 */
2051
2052 /* 102 0x66 'f' */
2053 0x07, 0x00, /* 0000011100 */
2054 0x09, 0x80, /* 0000100110 */
2055 0x09, 0x80, /* 0000100110 */
2056 0x18, 0x00, /* 0001100000 */
2057 0x18, 0x00, /* 0001100000 */
2058 0x18, 0x00, /* 0001100000 */
2059 0x18, 0x00, /* 0001100000 */
2060 0x7f, 0x00, /* 0111111100 */
2061 0x18, 0x00, /* 0001100000 */
2062 0x18, 0x00, /* 0001100000 */
2063 0x18, 0x00, /* 0001100000 */
2064 0x18, 0x00, /* 0001100000 */
2065 0x18, 0x00, /* 0001100000 */
2066 0x18, 0x00, /* 0001100000 */
2067 0x3c, 0x00, /* 0011110000 */
2068 0x00, 0x00, /* 0000000000 */
2069 0x00, 0x00, /* 0000000000 */
2070 0x00, 0x00, /* 0000000000 */
2071
2072 /* 103 0x67 'g' */
2073 0x00, 0x00, /* 0000000000 */
2074 0x00, 0x00, /* 0000000000 */
2075 0x00, 0x00, /* 0000000000 */
2076 0x00, 0x00, /* 0000000000 */
2077 0x00, 0x00, /* 0000000000 */
2078 0x1c, 0x80, /* 0001110010 */
2079 0x37, 0x80, /* 0011011110 */
2080 0x63, 0x00, /* 0110001100 */
2081 0x63, 0x00, /* 0110001100 */
2082 0x36, 0x00, /* 0011011000 */
2083 0x3c, 0x00, /* 0011110000 */
2084 0x60, 0x00, /* 0110000000 */
2085 0x7f, 0x00, /* 0111111100 */
2086 0x3f, 0x80, /* 0011111110 */
2087 0x21, 0x80, /* 0010000110 */
2088 0x40, 0x80, /* 0100000010 */
2089 0x7f, 0x00, /* 0111111100 */
2090 0x3e, 0x00, /* 0011111000 */
2091
2092 /* 104 0x68 'h' */
2093 0x10, 0x00, /* 0001000000 */
2094 0x30, 0x00, /* 0011000000 */
2095 0x70, 0x00, /* 0111000000 */
2096 0x30, 0x00, /* 0011000000 */
2097 0x30, 0x00, /* 0011000000 */
2098 0x37, 0x00, /* 0011011100 */
2099 0x3b, 0x80, /* 0011101110 */
2100 0x31, 0x80, /* 0011000110 */
2101 0x31, 0x80, /* 0011000110 */
2102 0x31, 0x80, /* 0011000110 */
2103 0x31, 0x80, /* 0011000110 */
2104 0x31, 0x80, /* 0011000110 */
2105 0x31, 0x80, /* 0011000110 */
2106 0x31, 0x80, /* 0011000110 */
2107 0x7b, 0xc0, /* 0111101111 */
2108 0x00, 0x00, /* 0000000000 */
2109 0x00, 0x00, /* 0000000000 */
2110 0x00, 0x00, /* 0000000000 */
2111
2112 /* 105 0x69 'i' */
2113 0x00, 0x00, /* 0000000000 */
2114 0x0c, 0x00, /* 0000110000 */
2115 0x0c, 0x00, /* 0000110000 */
2116 0x00, 0x00, /* 0000000000 */
2117 0x00, 0x00, /* 0000000000 */
2118 0x3c, 0x00, /* 0011110000 */
2119 0x0c, 0x00, /* 0000110000 */
2120 0x0c, 0x00, /* 0000110000 */
2121 0x0c, 0x00, /* 0000110000 */
2122 0x0c, 0x00, /* 0000110000 */
2123 0x0c, 0x00, /* 0000110000 */
2124 0x0c, 0x00, /* 0000110000 */
2125 0x0c, 0x00, /* 0000110000 */
2126 0x0c, 0x00, /* 0000110000 */
2127 0x3f, 0x00, /* 0011111100 */
2128 0x00, 0x00, /* 0000000000 */
2129 0x00, 0x00, /* 0000000000 */
2130 0x00, 0x00, /* 0000000000 */
2131
2132 /* 106 0x6a 'j' */
2133 0x00, 0x00, /* 0000000000 */
2134 0x01, 0x80, /* 0000000110 */
2135 0x01, 0x80, /* 0000000110 */
2136 0x00, 0x00, /* 0000000000 */
2137 0x00, 0x00, /* 0000000000 */
2138 0x07, 0x80, /* 0000011110 */
2139 0x01, 0x80, /* 0000000110 */
2140 0x01, 0x80, /* 0000000110 */
2141 0x01, 0x80, /* 0000000110 */
2142 0x01, 0x80, /* 0000000110 */
2143 0x01, 0x80, /* 0000000110 */
2144 0x01, 0x80, /* 0000000110 */
2145 0x01, 0x80, /* 0000000110 */
2146 0x41, 0x80, /* 0100000110 */
2147 0x61, 0x80, /* 0110000110 */
2148 0x71, 0x80, /* 0111000110 */
2149 0x3f, 0x00, /* 0011111100 */
2150 0x1c, 0x00, /* 0001110000 */
2151
2152 /* 107 0x6b 'k' */
2153 0x60, 0x00, /* 0110000000 */
2154 0xe0, 0x00, /* 1110000000 */
2155 0x60, 0x00, /* 0110000000 */
2156 0x60, 0x00, /* 0110000000 */
2157 0x60, 0x00, /* 0110000000 */
2158 0x63, 0x80, /* 0110001110 */
2159 0x66, 0x00, /* 0110011000 */
2160 0x6c, 0x00, /* 0110110000 */
2161 0x78, 0x00, /* 0111100000 */
2162 0x70, 0x00, /* 0111000000 */
2163 0x78, 0x00, /* 0111100000 */
2164 0x6c, 0x00, /* 0110110000 */
2165 0x6e, 0x00, /* 0110111000 */
2166 0x67, 0x00, /* 0110011100 */
2167 0xf3, 0x80, /* 1111001110 */
2168 0x00, 0x00, /* 0000000000 */
2169 0x00, 0x00, /* 0000000000 */
2170 0x00, 0x00, /* 0000000000 */
2171
2172 /* 108 0x6c 'l' */
2173 0x3c, 0x00, /* 0011110000 */
2174 0x0c, 0x00, /* 0000110000 */
2175 0x0c, 0x00, /* 0000110000 */
2176 0x0c, 0x00, /* 0000110000 */
2177 0x0c, 0x00, /* 0000110000 */
2178 0x0c, 0x00, /* 0000110000 */
2179 0x0c, 0x00, /* 0000110000 */
2180 0x0c, 0x00, /* 0000110000 */
2181 0x0c, 0x00, /* 0000110000 */
2182 0x0c, 0x00, /* 0000110000 */
2183 0x0c, 0x00, /* 0000110000 */
2184 0x0c, 0x00, /* 0000110000 */
2185 0x0c, 0x00, /* 0000110000 */
2186 0x0c, 0x00, /* 0000110000 */
2187 0x3f, 0x00, /* 0011111100 */
2188 0x00, 0x00, /* 0000000000 */
2189 0x00, 0x00, /* 0000000000 */
2190 0x00, 0x00, /* 0000000000 */
2191
2192 /* 109 0x6d 'm' */
2193 0x00, 0x00, /* 0000000000 */
2194 0x00, 0x00, /* 0000000000 */
2195 0x00, 0x00, /* 0000000000 */
2196 0x00, 0x00, /* 0000000000 */
2197 0x00, 0x00, /* 0000000000 */
2198 0xdb, 0x80, /* 1101101110 */
2199 0x6d, 0x80, /* 0110110110 */
2200 0x6d, 0x80, /* 0110110110 */
2201 0x6d, 0x80, /* 0110110110 */
2202 0x6d, 0x80, /* 0110110110 */
2203 0x6d, 0x80, /* 0110110110 */
2204 0x6d, 0x80, /* 0110110110 */
2205 0x6d, 0x80, /* 0110110110 */
2206 0x6d, 0x80, /* 0110110110 */
2207 0xed, 0xc0, /* 1110110111 */
2208 0x00, 0x00, /* 0000000000 */
2209 0x00, 0x00, /* 0000000000 */
2210 0x00, 0x00, /* 0000000000 */
2211
2212 /* 110 0x6e 'n' */
2213 0x00, 0x00, /* 0000000000 */
2214 0x00, 0x00, /* 0000000000 */
2215 0x00, 0x00, /* 0000000000 */
2216 0x00, 0x00, /* 0000000000 */
2217 0x00, 0x00, /* 0000000000 */
2218 0x6f, 0x00, /* 0110111100 */
2219 0x7b, 0x80, /* 0111101110 */
2220 0x31, 0x80, /* 0011000110 */
2221 0x31, 0x80, /* 0011000110 */
2222 0x31, 0x80, /* 0011000110 */
2223 0x31, 0x80, /* 0011000110 */
2224 0x31, 0x80, /* 0011000110 */
2225 0x31, 0x80, /* 0011000110 */
2226 0x31, 0x80, /* 0011000110 */
2227 0x7b, 0xc0, /* 0111101111 */
2228 0x00, 0x00, /* 0000000000 */
2229 0x00, 0x00, /* 0000000000 */
2230 0x00, 0x00, /* 0000000000 */
2231
2232 /* 111 0x6f 'o' */
2233 0x00, 0x00, /* 0000000000 */
2234 0x00, 0x00, /* 0000000000 */
2235 0x00, 0x00, /* 0000000000 */
2236 0x00, 0x00, /* 0000000000 */
2237 0x00, 0x00, /* 0000000000 */
2238 0x3c, 0x00, /* 0011110000 */
2239 0x66, 0x00, /* 0110011000 */
2240 0xc3, 0x00, /* 1100001100 */
2241 0xc1, 0x80, /* 1100000110 */
2242 0xc1, 0x80, /* 1100000110 */
2243 0xc1, 0x80, /* 1100000110 */
2244 0xc1, 0x80, /* 1100000110 */
2245 0xe1, 0x80, /* 1110000110 */
2246 0x73, 0x00, /* 0111001100 */
2247 0x3c, 0x00, /* 0011110000 */
2248 0x00, 0x00, /* 0000000000 */
2249 0x00, 0x00, /* 0000000000 */
2250 0x00, 0x00, /* 0000000000 */
2251
2252 /* 112 0x70 'p' */
2253 0x00, 0x00, /* 0000000000 */
2254 0x00, 0x00, /* 0000000000 */
2255 0x00, 0x00, /* 0000000000 */
2256 0x00, 0x00, /* 0000000000 */
2257 0x00, 0x00, /* 0000000000 */
2258 0xde, 0x00, /* 1101111000 */
2259 0x76, 0x00, /* 0111011000 */
2260 0x63, 0x00, /* 0110001100 */
2261 0x61, 0x80, /* 0110000110 */
2262 0x61, 0x80, /* 0110000110 */
2263 0x61, 0x80, /* 0110000110 */
2264 0x61, 0x80, /* 0110000110 */
2265 0x71, 0x80, /* 0111000110 */
2266 0x7b, 0x00, /* 0111101100 */
2267 0x7e, 0x00, /* 0111111000 */
2268 0x60, 0x00, /* 0110000000 */
2269 0x60, 0x00, /* 0110000000 */
2270 0xf0, 0x00, /* 1111000000 */
2271
2272 /* 113 0x71 'q' */
2273 0x00, 0x00, /* 0000000000 */
2274 0x00, 0x00, /* 0000000000 */
2275 0x00, 0x00, /* 0000000000 */
2276 0x00, 0x00, /* 0000000000 */
2277 0x00, 0x00, /* 0000000000 */
2278 0x0e, 0xc0, /* 0000111011 */
2279 0x1b, 0x80, /* 0001101110 */
2280 0x33, 0x80, /* 0011001110 */
2281 0x61, 0x80, /* 0110000110 */
2282 0x61, 0x80, /* 0110000110 */
2283 0x61, 0x80, /* 0110000110 */
2284 0x61, 0x80, /* 0110000110 */
2285 0x71, 0x80, /* 0111000110 */
2286 0x3b, 0x80, /* 0011101110 */
2287 0x1f, 0x80, /* 0001111110 */
2288 0x01, 0x80, /* 0000000110 */
2289 0x01, 0x80, /* 0000000110 */
2290 0x03, 0xc0, /* 0000001111 */
2291
2292 /* 114 0x72 'r' */
2293 0x00, 0x00, /* 0000000000 */
2294 0x00, 0x00, /* 0000000000 */
2295 0x00, 0x00, /* 0000000000 */
2296 0x00, 0x00, /* 0000000000 */
2297 0x00, 0x00, /* 0000000000 */
2298 0x73, 0x00, /* 0111001100 */
2299 0x35, 0x80, /* 0011010110 */
2300 0x39, 0x80, /* 0011100110 */
2301 0x30, 0x00, /* 0011000000 */
2302 0x30, 0x00, /* 0011000000 */
2303 0x30, 0x00, /* 0011000000 */
2304 0x30, 0x00, /* 0011000000 */
2305 0x30, 0x00, /* 0011000000 */
2306 0x30, 0x00, /* 0011000000 */
2307 0x78, 0x00, /* 0111100000 */
2308 0x00, 0x00, /* 0000000000 */
2309 0x00, 0x00, /* 0000000000 */
2310 0x00, 0x00, /* 0000000000 */
2311
2312 /* 115 0x73 's' */
2313 0x00, 0x00, /* 0000000000 */
2314 0x00, 0x00, /* 0000000000 */
2315 0x00, 0x00, /* 0000000000 */
2316 0x00, 0x00, /* 0000000000 */
2317 0x00, 0x00, /* 0000000000 */
2318 0x3f, 0x00, /* 0011111100 */
2319 0x63, 0x00, /* 0110001100 */
2320 0x61, 0x00, /* 0110000100 */
2321 0x70, 0x00, /* 0111000000 */
2322 0x38, 0x00, /* 0011100000 */
2323 0x0e, 0x00, /* 0000111000 */
2324 0x07, 0x00, /* 0000011100 */
2325 0x43, 0x00, /* 0100001100 */
2326 0x63, 0x00, /* 0110001100 */
2327 0x7e, 0x00, /* 0111111000 */
2328 0x00, 0x00, /* 0000000000 */
2329 0x00, 0x00, /* 0000000000 */
2330 0x00, 0x00, /* 0000000000 */
2331
2332 /* 116 0x74 't' */
2333 0x00, 0x00, /* 0000000000 */
2334 0x00, 0x00, /* 0000000000 */
2335 0x08, 0x00, /* 0000100000 */
2336 0x08, 0x00, /* 0000100000 */
2337 0x18, 0x00, /* 0001100000 */
2338 0x7f, 0x80, /* 0111111110 */
2339 0x18, 0x00, /* 0001100000 */
2340 0x18, 0x00, /* 0001100000 */
2341 0x18, 0x00, /* 0001100000 */
2342 0x18, 0x00, /* 0001100000 */
2343 0x18, 0x00, /* 0001100000 */
2344 0x18, 0x00, /* 0001100000 */
2345 0x18, 0x00, /* 0001100000 */
2346 0x1c, 0x80, /* 0001110010 */
2347 0x0f, 0x00, /* 0000111100 */
2348 0x00, 0x00, /* 0000000000 */
2349 0x00, 0x00, /* 0000000000 */
2350 0x00, 0x00, /* 0000000000 */
2351
2352 /* 117 0x75 'u' */
2353 0x00, 0x00, /* 0000000000 */
2354 0x00, 0x00, /* 0000000000 */
2355 0x00, 0x00, /* 0000000000 */
2356 0x00, 0x00, /* 0000000000 */
2357 0x00, 0x00, /* 0000000000 */
2358 0xf7, 0x80, /* 1111011110 */
2359 0x63, 0x00, /* 0110001100 */
2360 0x63, 0x00, /* 0110001100 */
2361 0x63, 0x00, /* 0110001100 */
2362 0x63, 0x00, /* 0110001100 */
2363 0x63, 0x00, /* 0110001100 */
2364 0x63, 0x00, /* 0110001100 */
2365 0x63, 0x00, /* 0110001100 */
2366 0x77, 0x00, /* 0111011100 */
2367 0x3d, 0x80, /* 0011110110 */
2368 0x00, 0x00, /* 0000000000 */
2369 0x00, 0x00, /* 0000000000 */
2370 0x00, 0x00, /* 0000000000 */
2371
2372 /* 118 0x76 'v' */
2373 0x00, 0x00, /* 0000000000 */
2374 0x00, 0x00, /* 0000000000 */
2375 0x00, 0x00, /* 0000000000 */
2376 0x00, 0x00, /* 0000000000 */
2377 0x00, 0x00, /* 0000000000 */
2378 0xf1, 0xc0, /* 1111000111 */
2379 0x60, 0xc0, /* 0110000011 */
2380 0x31, 0x80, /* 0011000110 */
2381 0x31, 0x80, /* 0011000110 */
2382 0x19, 0x80, /* 0001100110 */
2383 0x1b, 0x00, /* 0001101100 */
2384 0x0f, 0x00, /* 0000111100 */
2385 0x0f, 0x00, /* 0000111100 */
2386 0x06, 0x00, /* 0000011000 */
2387 0x06, 0x00, /* 0000011000 */
2388 0x00, 0x00, /* 0000000000 */
2389 0x00, 0x00, /* 0000000000 */
2390 0x00, 0x00, /* 0000000000 */
2391
2392 /* 119 0x77 'w' */
2393 0x00, 0x00, /* 0000000000 */
2394 0x00, 0x00, /* 0000000000 */
2395 0x00, 0x00, /* 0000000000 */
2396 0x00, 0x00, /* 0000000000 */
2397 0x00, 0x00, /* 0000000000 */
2398 0xe3, 0xc0, /* 1110001111 */
2399 0xc1, 0x80, /* 1100000110 */
2400 0xc1, 0x80, /* 1100000110 */
2401 0xc1, 0x80, /* 1100000110 */
2402 0xc1, 0x80, /* 1100000110 */
2403 0x6b, 0x00, /* 0110101100 */
2404 0x6b, 0x00, /* 0110101100 */
2405 0x7e, 0x00, /* 0111111000 */
2406 0x36, 0x00, /* 0011011000 */
2407 0x36, 0x00, /* 0011011000 */
2408 0x00, 0x00, /* 0000000000 */
2409 0x00, 0x00, /* 0000000000 */
2410 0x00, 0x00, /* 0000000000 */
2411
2412 /* 120 0x78 'x' */
2413 0x00, 0x00, /* 0000000000 */
2414 0x00, 0x00, /* 0000000000 */
2415 0x00, 0x00, /* 0000000000 */
2416 0x00, 0x00, /* 0000000000 */
2417 0x00, 0x00, /* 0000000000 */
2418 0xf7, 0x80, /* 1111011110 */
2419 0x63, 0x00, /* 0110001100 */
2420 0x36, 0x00, /* 0011011000 */
2421 0x36, 0x00, /* 0011011000 */
2422 0x1c, 0x00, /* 0001110000 */
2423 0x1c, 0x00, /* 0001110000 */
2424 0x36, 0x00, /* 0011011000 */
2425 0x66, 0x00, /* 0110011000 */
2426 0x63, 0x00, /* 0110001100 */
2427 0xf7, 0x80, /* 1111011110 */
2428 0x00, 0x00, /* 0000000000 */
2429 0x00, 0x00, /* 0000000000 */
2430 0x00, 0x00, /* 0000000000 */
2431
2432 /* 121 0x79 'y' */
2433 0x00, 0x00, /* 0000000000 */
2434 0x00, 0x00, /* 0000000000 */
2435 0x00, 0x00, /* 0000000000 */
2436 0x00, 0x00, /* 0000000000 */
2437 0x00, 0x00, /* 0000000000 */
2438 0xf3, 0xc0, /* 1111001111 */
2439 0x61, 0x80, /* 0110000110 */
2440 0x33, 0x00, /* 0011001100 */
2441 0x1b, 0x00, /* 0001101100 */
2442 0x1e, 0x00, /* 0001111000 */
2443 0x0e, 0x00, /* 0000111000 */
2444 0x0c, 0x00, /* 0000110000 */
2445 0x0c, 0x00, /* 0000110000 */
2446 0x0c, 0x00, /* 0000110000 */
2447 0x0c, 0x00, /* 0000110000 */
2448 0x18, 0x00, /* 0001100000 */
2449 0x78, 0x00, /* 0111100000 */
2450 0x70, 0x00, /* 0111000000 */
2451
2452 /* 122 0x7a 'z' */
2453 0x00, 0x00, /* 0000000000 */
2454 0x00, 0x00, /* 0000000000 */
2455 0x00, 0x00, /* 0000000000 */
2456 0x00, 0x00, /* 0000000000 */
2457 0x00, 0x00, /* 0000000000 */
2458 0x7f, 0x80, /* 0111111110 */
2459 0x61, 0x80, /* 0110000110 */
2460 0x43, 0x00, /* 0100001100 */
2461 0x06, 0x00, /* 0000011000 */
2462 0x0c, 0x00, /* 0000110000 */
2463 0x18, 0x00, /* 0001100000 */
2464 0x30, 0x00, /* 0011000000 */
2465 0x60, 0x80, /* 0110000010 */
2466 0x61, 0x80, /* 0110000110 */
2467 0x7f, 0x80, /* 0111111110 */
2468 0x00, 0x00, /* 0000000000 */
2469 0x00, 0x00, /* 0000000000 */
2470 0x00, 0x00, /* 0000000000 */
2471
2472 /* 123 0x7b '{' */
2473 0x07, 0x00, /* 0000011100 */
2474 0x0c, 0x00, /* 0000110000 */
2475 0x0c, 0x00, /* 0000110000 */
2476 0x0c, 0x00, /* 0000110000 */
2477 0x0c, 0x00, /* 0000110000 */
2478 0x0c, 0x00, /* 0000110000 */
2479 0x18, 0x00, /* 0001100000 */
2480 0x70, 0x00, /* 0111000000 */
2481 0x18, 0x00, /* 0001100000 */
2482 0x0c, 0x00, /* 0000110000 */
2483 0x0c, 0x00, /* 0000110000 */
2484 0x0c, 0x00, /* 0000110000 */
2485 0x0c, 0x00, /* 0000110000 */
2486 0x0c, 0x00, /* 0000110000 */
2487 0x07, 0x00, /* 0000011100 */
2488 0x00, 0x00, /* 0000000000 */
2489 0x00, 0x00, /* 0000000000 */
2490 0x00, 0x00, /* 0000000000 */
2491
2492 /* 124 0x7c '|' */
2493 0x0c, 0x00, /* 0000110000 */
2494 0x0c, 0x00, /* 0000110000 */
2495 0x0c, 0x00, /* 0000110000 */
2496 0x0c, 0x00, /* 0000110000 */
2497 0x0c, 0x00, /* 0000110000 */
2498 0x0c, 0x00, /* 0000110000 */
2499 0x0c, 0x00, /* 0000110000 */
2500 0x0c, 0x00, /* 0000110000 */
2501 0x0c, 0x00, /* 0000110000 */
2502 0x0c, 0x00, /* 0000110000 */
2503 0x0c, 0x00, /* 0000110000 */
2504 0x0c, 0x00, /* 0000110000 */
2505 0x0c, 0x00, /* 0000110000 */
2506 0x0c, 0x00, /* 0000110000 */
2507 0x0c, 0x00, /* 0000110000 */
2508 0x0c, 0x00, /* 0000110000 */
2509 0x0c, 0x00, /* 0000110000 */
2510 0x00, 0x00, /* 0000000000 */
2511
2512 /* 125 0x7d '}' */
2513 0x38, 0x00, /* 0011100000 */
2514 0x0c, 0x00, /* 0000110000 */
2515 0x0c, 0x00, /* 0000110000 */
2516 0x0c, 0x00, /* 0000110000 */
2517 0x0c, 0x00, /* 0000110000 */
2518 0x0c, 0x00, /* 0000110000 */
2519 0x06, 0x00, /* 0000011000 */
2520 0x03, 0x80, /* 0000001110 */
2521 0x06, 0x00, /* 0000011000 */
2522 0x0c, 0x00, /* 0000110000 */
2523 0x0c, 0x00, /* 0000110000 */
2524 0x0c, 0x00, /* 0000110000 */
2525 0x0c, 0x00, /* 0000110000 */
2526 0x0c, 0x00, /* 0000110000 */
2527 0x38, 0x00, /* 0011100000 */
2528 0x00, 0x00, /* 0000000000 */
2529 0x00, 0x00, /* 0000000000 */
2530 0x00, 0x00, /* 0000000000 */
2531
2532 /* 126 0x7e '~' */
2533 0x00, 0x00, /* 0000000000 */
2534 0x18, 0x80, /* 0001100010 */
2535 0x3d, 0x80, /* 0011110110 */
2536 0x6f, 0x00, /* 0110111100 */
2537 0x46, 0x00, /* 0100011000 */
2538 0x00, 0x00, /* 0000000000 */
2539 0x00, 0x00, /* 0000000000 */
2540 0x00, 0x00, /* 0000000000 */
2541 0x00, 0x00, /* 0000000000 */
2542 0x00, 0x00, /* 0000000000 */
2543 0x00, 0x00, /* 0000000000 */
2544 0x00, 0x00, /* 0000000000 */
2545 0x00, 0x00, /* 0000000000 */
2546 0x00, 0x00, /* 0000000000 */
2547 0x00, 0x00, /* 0000000000 */
2548 0x00, 0x00, /* 0000000000 */
2549 0x00, 0x00, /* 0000000000 */
2550 0x00, 0x00, /* 0000000000 */
2551
2552 /* 127 0x7f '.' */
2553 0x00, 0x00, /* 0000000000 */
2554 0x00, 0x00, /* 0000000000 */
2555 0x00, 0x00, /* 0000000000 */
2556 0x00, 0x00, /* 0000000000 */
2557 0x00, 0x00, /* 0000000000 */
2558 0x00, 0x00, /* 0000000000 */
2559 0x00, 0x00, /* 0000000000 */
2560 0x00, 0x00, /* 0000000000 */
2561 0x0c, 0x00, /* 0000110000 */
2562 0x12, 0x00, /* 0001001000 */
2563 0x21, 0x00, /* 0010000100 */
2564 0x40, 0x80, /* 0100000010 */
2565 0x40, 0x80, /* 0100000010 */
2566 0x40, 0x80, /* 0100000010 */
2567 0x7f, 0x80, /* 0111111110 */
2568 0x00, 0x00, /* 0000000000 */
2569 0x00, 0x00, /* 0000000000 */
2570 0x00, 0x00, /* 0000000000 */
2571
2572 /* 128 0x80 '.' */
2573 0x00, 0x00, /* 0000000000 */
2574 0x1f, 0x00, /* 0001111100 */
2575 0x21, 0x80, /* 0010000110 */
2576 0x40, 0x80, /* 0100000010 */
2577 0x40, 0x00, /* 0100000000 */
2578 0x40, 0x00, /* 0100000000 */
2579 0x40, 0x00, /* 0100000000 */
2580 0x40, 0x00, /* 0100000000 */
2581 0x40, 0x00, /* 0100000000 */
2582 0x40, 0x00, /* 0100000000 */
2583 0x60, 0x80, /* 0110000010 */
2584 0x31, 0x00, /* 0011000100 */
2585 0x1e, 0x00, /* 0001111000 */
2586 0x08, 0x00, /* 0000100000 */
2587 0x04, 0x00, /* 0000010000 */
2588 0x02, 0x00, /* 0000001000 */
2589 0x02, 0x00, /* 0000001000 */
2590 0x1c, 0x00, /* 0001110000 */
2591
2592 /* 129 0x81 '.' */
2593 0x00, 0x00, /* 0000000000 */
2594 0x1b, 0x00, /* 0001101100 */
2595 0x1b, 0x00, /* 0001101100 */
2596 0x00, 0x00, /* 0000000000 */
2597 0x00, 0x00, /* 0000000000 */
2598 0x7b, 0x80, /* 0111101110 */
2599 0x31, 0x00, /* 0011000100 */
2600 0x31, 0x00, /* 0011000100 */
2601 0x31, 0x00, /* 0011000100 */
2602 0x31, 0x00, /* 0011000100 */
2603 0x31, 0x00, /* 0011000100 */
2604 0x31, 0x00, /* 0011000100 */
2605 0x31, 0x00, /* 0011000100 */
2606 0x3b, 0x00, /* 0011101100 */
2607 0x1c, 0x80, /* 0001110010 */
2608 0x00, 0x00, /* 0000000000 */
2609 0x00, 0x00, /* 0000000000 */
2610 0x00, 0x00, /* 0000000000 */
2611
2612 /* 130 0x82 '.' */
2613 0x00, 0x00, /* 0000000000 */
2614 0x01, 0x00, /* 0000000100 */
2615 0x02, 0x00, /* 0000001000 */
2616 0x04, 0x00, /* 0000010000 */
2617 0x00, 0x00, /* 0000000000 */
2618 0x0c, 0x00, /* 0000110000 */
2619 0x33, 0x00, /* 0011001100 */
2620 0x61, 0x80, /* 0110000110 */
2621 0x61, 0x80, /* 0110000110 */
2622 0x7f, 0x80, /* 0111111110 */
2623 0x60, 0x00, /* 0110000000 */
2624 0x60, 0x00, /* 0110000000 */
2625 0x30, 0x00, /* 0011000000 */
2626 0x19, 0x80, /* 0001100110 */
2627 0x0e, 0x00, /* 0000111000 */
2628 0x00, 0x00, /* 0000000000 */
2629 0x00, 0x00, /* 0000000000 */
2630 0x00, 0x00, /* 0000000000 */
2631
2632 /* 131 0x83 '.' */
2633 0x04, 0x00, /* 0000010000 */
2634 0x0e, 0x00, /* 0000111000 */
2635 0x1b, 0x00, /* 0001101100 */
2636 0x31, 0x80, /* 0011000110 */
2637 0x00, 0x00, /* 0000000000 */
2638 0x1f, 0x00, /* 0001111100 */
2639 0x31, 0x80, /* 0011000110 */
2640 0x21, 0x80, /* 0010000110 */
2641 0x07, 0x80, /* 0000011110 */
2642 0x39, 0x80, /* 0011100110 */
2643 0x61, 0x80, /* 0110000110 */
2644 0x61, 0x80, /* 0110000110 */
2645 0x61, 0x80, /* 0110000110 */
2646 0x73, 0x80, /* 0111001110 */
2647 0x3d, 0xc0, /* 0011110111 */
2648 0x00, 0x00, /* 0000000000 */
2649 0x00, 0x00, /* 0000000000 */
2650 0x00, 0x00, /* 0000000000 */
2651
2652 /* 132 0x84 '.' */
2653 0x00, 0x00, /* 0000000000 */
2654 0x1b, 0x00, /* 0001101100 */
2655 0x1b, 0x00, /* 0001101100 */
2656 0x00, 0x00, /* 0000000000 */
2657 0x00, 0x00, /* 0000000000 */
2658 0x1f, 0x00, /* 0001111100 */
2659 0x31, 0x80, /* 0011000110 */
2660 0x21, 0x80, /* 0010000110 */
2661 0x07, 0x80, /* 0000011110 */
2662 0x39, 0x80, /* 0011100110 */
2663 0x61, 0x80, /* 0110000110 */
2664 0x61, 0x80, /* 0110000110 */
2665 0x61, 0x80, /* 0110000110 */
2666 0x73, 0x80, /* 0111001110 */
2667 0x3d, 0xc0, /* 0011110111 */
2668 0x00, 0x00, /* 0000000000 */
2669 0x00, 0x00, /* 0000000000 */
2670 0x00, 0x00, /* 0000000000 */
2671
2672 /* 133 0x85 '.' */
2673 0x00, 0x00, /* 0000000000 */
2674 0x18, 0x00, /* 0001100000 */
2675 0x0c, 0x00, /* 0000110000 */
2676 0x06, 0x00, /* 0000011000 */
2677 0x00, 0x00, /* 0000000000 */
2678 0x1f, 0x00, /* 0001111100 */
2679 0x31, 0x80, /* 0011000110 */
2680 0x21, 0x80, /* 0010000110 */
2681 0x07, 0x80, /* 0000011110 */
2682 0x39, 0x80, /* 0011100110 */
2683 0x61, 0x80, /* 0110000110 */
2684 0x61, 0x80, /* 0110000110 */
2685 0x61, 0x80, /* 0110000110 */
2686 0x73, 0x80, /* 0111001110 */
2687 0x3d, 0xc0, /* 0011110111 */
2688 0x00, 0x00, /* 0000000000 */
2689 0x00, 0x00, /* 0000000000 */
2690 0x00, 0x00, /* 0000000000 */
2691
2692 /* 134 0x86 '.' */
2693 0x00, 0x00, /* 0000000000 */
2694 0x0e, 0x00, /* 0000111000 */
2695 0x1b, 0x00, /* 0001101100 */
2696 0x0e, 0x00, /* 0000111000 */
2697 0x00, 0x00, /* 0000000000 */
2698 0x1f, 0x00, /* 0001111100 */
2699 0x31, 0x80, /* 0011000110 */
2700 0x21, 0x80, /* 0010000110 */
2701 0x07, 0x80, /* 0000011110 */
2702 0x39, 0x80, /* 0011100110 */
2703 0x61, 0x80, /* 0110000110 */
2704 0x61, 0x80, /* 0110000110 */
2705 0x61, 0x80, /* 0110000110 */
2706 0x73, 0x80, /* 0111001110 */
2707 0x3d, 0xc0, /* 0011110111 */
2708 0x00, 0x00, /* 0000000000 */
2709 0x00, 0x00, /* 0000000000 */
2710 0x00, 0x00, /* 0000000000 */
2711
2712 /* 135 0x87 '.' */
2713 0x00, 0x00, /* 0000000000 */
2714 0x00, 0x00, /* 0000000000 */
2715 0x00, 0x00, /* 0000000000 */
2716 0x00, 0x00, /* 0000000000 */
2717 0x00, 0x00, /* 0000000000 */
2718 0x1f, 0x00, /* 0001111100 */
2719 0x31, 0x80, /* 0011000110 */
2720 0x20, 0x80, /* 0010000010 */
2721 0x60, 0x00, /* 0110000000 */
2722 0x60, 0x00, /* 0110000000 */
2723 0x60, 0x00, /* 0110000000 */
2724 0x70, 0x80, /* 0111000010 */
2725 0x30, 0x80, /* 0011000010 */
2726 0x1f, 0x00, /* 0001111100 */
2727 0x04, 0x00, /* 0000010000 */
2728 0x02, 0x00, /* 0000001000 */
2729 0x01, 0x00, /* 0000000100 */
2730 0x0e, 0x00, /* 0000111000 */
2731
2732 /* 136 0x88 '.' */
2733 0x04, 0x00, /* 0000010000 */
2734 0x0e, 0x00, /* 0000111000 */
2735 0x1b, 0x00, /* 0001101100 */
2736 0x31, 0x80, /* 0011000110 */
2737 0x00, 0x00, /* 0000000000 */
2738 0x0c, 0x00, /* 0000110000 */
2739 0x33, 0x00, /* 0011001100 */
2740 0x61, 0x80, /* 0110000110 */
2741 0x61, 0x80, /* 0110000110 */
2742 0x7f, 0x80, /* 0111111110 */
2743 0x60, 0x00, /* 0110000000 */
2744 0x60, 0x00, /* 0110000000 */
2745 0x30, 0x00, /* 0011000000 */
2746 0x19, 0x80, /* 0001100110 */
2747 0x0e, 0x00, /* 0000111000 */
2748 0x00, 0x00, /* 0000000000 */
2749 0x00, 0x00, /* 0000000000 */
2750 0x00, 0x00, /* 0000000000 */
2751
2752 /* 137 0x89 '.' */
2753 0x00, 0x00, /* 0000000000 */
2754 0x36, 0x00, /* 0011011000 */
2755 0x36, 0x00, /* 0011011000 */
2756 0x00, 0x00, /* 0000000000 */
2757 0x00, 0x00, /* 0000000000 */
2758 0x0c, 0x00, /* 0000110000 */
2759 0x33, 0x00, /* 0011001100 */
2760 0x61, 0x80, /* 0110000110 */
2761 0x61, 0x80, /* 0110000110 */
2762 0x7f, 0x80, /* 0111111110 */
2763 0x60, 0x00, /* 0110000000 */
2764 0x60, 0x00, /* 0110000000 */
2765 0x30, 0x00, /* 0011000000 */
2766 0x19, 0x80, /* 0001100110 */
2767 0x0e, 0x00, /* 0000111000 */
2768 0x00, 0x00, /* 0000000000 */
2769 0x00, 0x00, /* 0000000000 */
2770 0x00, 0x00, /* 0000000000 */
2771
2772 /* 138 0x8a '.' */
2773 0x00, 0x00, /* 0000000000 */
2774 0x30, 0x00, /* 0011000000 */
2775 0x18, 0x00, /* 0001100000 */
2776 0x0c, 0x00, /* 0000110000 */
2777 0x00, 0x00, /* 0000000000 */
2778 0x0c, 0x00, /* 0000110000 */
2779 0x33, 0x00, /* 0011001100 */
2780 0x61, 0x80, /* 0110000110 */
2781 0x61, 0x80, /* 0110000110 */
2782 0x7f, 0x80, /* 0111111110 */
2783 0x60, 0x00, /* 0110000000 */
2784 0x60, 0x00, /* 0110000000 */
2785 0x30, 0x00, /* 0011000000 */
2786 0x19, 0x80, /* 0001100110 */
2787 0x0e, 0x00, /* 0000111000 */
2788 0x00, 0x00, /* 0000000000 */
2789 0x00, 0x00, /* 0000000000 */
2790 0x00, 0x00, /* 0000000000 */
2791
2792 /* 139 0x8b '.' */
2793 0x00, 0x00, /* 0000000000 */
2794 0x36, 0x00, /* 0011011000 */
2795 0x36, 0x00, /* 0011011000 */
2796 0x00, 0x00, /* 0000000000 */
2797 0x00, 0x00, /* 0000000000 */
2798 0x3c, 0x00, /* 0011110000 */
2799 0x0c, 0x00, /* 0000110000 */
2800 0x0c, 0x00, /* 0000110000 */
2801 0x0c, 0x00, /* 0000110000 */
2802 0x0c, 0x00, /* 0000110000 */
2803 0x0c, 0x00, /* 0000110000 */
2804 0x0c, 0x00, /* 0000110000 */
2805 0x0c, 0x00, /* 0000110000 */
2806 0x0c, 0x00, /* 0000110000 */
2807 0x3f, 0x00, /* 0011111100 */
2808 0x00, 0x00, /* 0000000000 */
2809 0x00, 0x00, /* 0000000000 */
2810 0x00, 0x00, /* 0000000000 */
2811
2812 /* 140 0x8c '.' */
2813 0x08, 0x00, /* 0000100000 */
2814 0x1c, 0x00, /* 0001110000 */
2815 0x36, 0x00, /* 0011011000 */
2816 0x63, 0x00, /* 0110001100 */
2817 0x00, 0x00, /* 0000000000 */
2818 0x3c, 0x00, /* 0011110000 */
2819 0x0c, 0x00, /* 0000110000 */
2820 0x0c, 0x00, /* 0000110000 */
2821 0x0c, 0x00, /* 0000110000 */
2822 0x0c, 0x00, /* 0000110000 */
2823 0x0c, 0x00, /* 0000110000 */
2824 0x0c, 0x00, /* 0000110000 */
2825 0x0c, 0x00, /* 0000110000 */
2826 0x0c, 0x00, /* 0000110000 */
2827 0x3f, 0x00, /* 0011111100 */
2828 0x00, 0x00, /* 0000000000 */
2829 0x00, 0x00, /* 0000000000 */
2830 0x00, 0x00, /* 0000000000 */
2831
2832 /* 141 0x8d '.' */
2833 0x00, 0x00, /* 0000000000 */
2834 0x30, 0x00, /* 0011000000 */
2835 0x18, 0x00, /* 0001100000 */
2836 0x0c, 0x00, /* 0000110000 */
2837 0x00, 0x00, /* 0000000000 */
2838 0x3c, 0x00, /* 0011110000 */
2839 0x0c, 0x00, /* 0000110000 */
2840 0x0c, 0x00, /* 0000110000 */
2841 0x0c, 0x00, /* 0000110000 */
2842 0x0c, 0x00, /* 0000110000 */
2843 0x0c, 0x00, /* 0000110000 */
2844 0x0c, 0x00, /* 0000110000 */
2845 0x0c, 0x00, /* 0000110000 */
2846 0x0c, 0x00, /* 0000110000 */
2847 0x3f, 0x00, /* 0011111100 */
2848 0x00, 0x00, /* 0000000000 */
2849 0x00, 0x00, /* 0000000000 */
2850 0x00, 0x00, /* 0000000000 */
2851
2852 /* 142 0x8e '.' */
2853 0x31, 0x80, /* 0011000110 */
2854 0x31, 0x80, /* 0011000110 */
2855 0x04, 0x00, /* 0000010000 */
2856 0x04, 0x00, /* 0000010000 */
2857 0x0e, 0x00, /* 0000111000 */
2858 0x0e, 0x00, /* 0000111000 */
2859 0x0e, 0x00, /* 0000111000 */
2860 0x19, 0x00, /* 0001100100 */
2861 0x19, 0x00, /* 0001100100 */
2862 0x3f, 0x00, /* 0011111100 */
2863 0x31, 0x00, /* 0011000100 */
2864 0x31, 0x00, /* 0011000100 */
2865 0x60, 0x80, /* 0110000010 */
2866 0x60, 0x80, /* 0110000010 */
2867 0xf3, 0xc0, /* 1111001111 */
2868 0x00, 0x00, /* 0000000000 */
2869 0x00, 0x00, /* 0000000000 */
2870 0x00, 0x00, /* 0000000000 */
2871
2872 /* 143 0x8f '.' */
2873 0x04, 0x00, /* 0000010000 */
2874 0x0a, 0x00, /* 0000101000 */
2875 0x0a, 0x00, /* 0000101000 */
2876 0x04, 0x00, /* 0000010000 */
2877 0x0e, 0x00, /* 0000111000 */
2878 0x0e, 0x00, /* 0000111000 */
2879 0x0e, 0x00, /* 0000111000 */
2880 0x19, 0x00, /* 0001100100 */
2881 0x19, 0x00, /* 0001100100 */
2882 0x3f, 0x00, /* 0011111100 */
2883 0x31, 0x00, /* 0011000100 */
2884 0x31, 0x00, /* 0011000100 */
2885 0x60, 0x80, /* 0110000010 */
2886 0x60, 0x80, /* 0110000010 */
2887 0xf3, 0xc0, /* 1111001111 */
2888 0x00, 0x00, /* 0000000000 */
2889 0x00, 0x00, /* 0000000000 */
2890 0x00, 0x00, /* 0000000000 */
2891
2892 /* 144 0x90 '.' */
2893 0x03, 0x00, /* 0000001100 */
2894 0x06, 0x00, /* 0000011000 */
2895 0x0c, 0x00, /* 0000110000 */
2896 0x7f, 0x80, /* 0111111110 */
2897 0x30, 0x80, /* 0011000010 */
2898 0x30, 0x80, /* 0011000010 */
2899 0x30, 0x00, /* 0011000000 */
2900 0x31, 0x00, /* 0011000100 */
2901 0x3f, 0x00, /* 0011111100 */
2902 0x31, 0x00, /* 0011000100 */
2903 0x30, 0x00, /* 0011000000 */
2904 0x30, 0x00, /* 0011000000 */
2905 0x30, 0x80, /* 0011000010 */
2906 0x30, 0x80, /* 0011000010 */
2907 0x7f, 0x80, /* 0111111110 */
2908 0x00, 0x00, /* 0000000000 */
2909 0x00, 0x00, /* 0000000000 */
2910 0x00, 0x00, /* 0000000000 */
2911
2912 /* 145 0x91 '.' */
2913 0x00, 0x00, /* 0000000000 */
2914 0x00, 0x00, /* 0000000000 */
2915 0x00, 0x00, /* 0000000000 */
2916 0x00, 0x00, /* 0000000000 */
2917 0x00, 0x00, /* 0000000000 */
2918 0x3b, 0x80, /* 0011101110 */
2919 0x6c, 0xc0, /* 0110110011 */
2920 0x4c, 0xc0, /* 0100110011 */
2921 0x0c, 0xc0, /* 0000110011 */
2922 0x3f, 0xc0, /* 0011111111 */
2923 0x6c, 0x00, /* 0110110000 */
2924 0xcc, 0x00, /* 1100110000 */
2925 0xcc, 0x00, /* 1100110000 */
2926 0xee, 0xc0, /* 1110111011 */
2927 0x7b, 0x80, /* 0111101110 */
2928 0x00, 0x00, /* 0000000000 */
2929 0x00, 0x00, /* 0000000000 */
2930 0x00, 0x00, /* 0000000000 */
2931
2932 /* 146 0x92 '.' */
2933 0x00, 0x00, /* 0000000000 */
2934 0x07, 0xc0, /* 0000011111 */
2935 0x0e, 0x40, /* 0000111001 */
2936 0x0e, 0x40, /* 0000111001 */
2937 0x0e, 0x00, /* 0000111000 */
2938 0x16, 0x00, /* 0001011000 */
2939 0x16, 0x80, /* 0001011010 */
2940 0x17, 0x80, /* 0001011110 */
2941 0x16, 0x80, /* 0001011010 */
2942 0x3e, 0x00, /* 0011111000 */
2943 0x26, 0x00, /* 0010011000 */
2944 0x26, 0x00, /* 0010011000 */
2945 0x46, 0x40, /* 0100011001 */
2946 0x46, 0x40, /* 0100011001 */
2947 0xef, 0xc0, /* 1110111111 */
2948 0x00, 0x00, /* 0000000000 */
2949 0x00, 0x00, /* 0000000000 */
2950 0x00, 0x00, /* 0000000000 */
2951
2952 /* 147 0x93 '.' */
2953 0x00, 0x00, /* 0000000000 */
2954 0x08, 0x00, /* 0000100000 */
2955 0x1c, 0x00, /* 0001110000 */
2956 0x36, 0x00, /* 0011011000 */
2957 0x00, 0x00, /* 0000000000 */
2958 0x3c, 0x00, /* 0011110000 */
2959 0x66, 0x00, /* 0110011000 */
2960 0xc3, 0x00, /* 1100001100 */
2961 0xc1, 0x80, /* 1100000110 */
2962 0xc1, 0x80, /* 1100000110 */
2963 0xc1, 0x80, /* 1100000110 */
2964 0xc1, 0x80, /* 1100000110 */
2965 0xe1, 0x80, /* 1110000110 */
2966 0x73, 0x00, /* 0111001100 */
2967 0x3c, 0x00, /* 0011110000 */
2968 0x00, 0x00, /* 0000000000 */
2969 0x00, 0x00, /* 0000000000 */
2970 0x00, 0x00, /* 0000000000 */
2971
2972 /* 148 0x94 '.' */
2973 0x00, 0x00, /* 0000000000 */
2974 0x00, 0x00, /* 0000000000 */
2975 0x33, 0x00, /* 0011001100 */
2976 0x33, 0x00, /* 0011001100 */
2977 0x00, 0x00, /* 0000000000 */
2978 0x3c, 0x00, /* 0011110000 */
2979 0x66, 0x00, /* 0110011000 */
2980 0xc3, 0x00, /* 1100001100 */
2981 0xc1, 0x80, /* 1100000110 */
2982 0xc1, 0x80, /* 1100000110 */
2983 0xc1, 0x80, /* 1100000110 */
2984 0xc1, 0x80, /* 1100000110 */
2985 0xe1, 0x80, /* 1110000110 */
2986 0x73, 0x00, /* 0111001100 */
2987 0x3c, 0x00, /* 0011110000 */
2988 0x00, 0x00, /* 0000000000 */
2989 0x00, 0x00, /* 0000000000 */
2990 0x00, 0x00, /* 0000000000 */
2991
2992 /* 149 0x95 '.' */
2993 0x00, 0x00, /* 0000000000 */
2994 0x18, 0x00, /* 0001100000 */
2995 0x0c, 0x00, /* 0000110000 */
2996 0x06, 0x00, /* 0000011000 */
2997 0x00, 0x00, /* 0000000000 */
2998 0x3c, 0x00, /* 0011110000 */
2999 0x66, 0x00, /* 0110011000 */
3000 0xc3, 0x00, /* 1100001100 */
3001 0xc1, 0x80, /* 1100000110 */
3002 0xc1, 0x80, /* 1100000110 */
3003 0xc1, 0x80, /* 1100000110 */
3004 0xc1, 0x80, /* 1100000110 */
3005 0xe1, 0x80, /* 1110000110 */
3006 0x73, 0x00, /* 0111001100 */
3007 0x3c, 0x00, /* 0011110000 */
3008 0x00, 0x00, /* 0000000000 */
3009 0x00, 0x00, /* 0000000000 */
3010 0x00, 0x00, /* 0000000000 */
3011
3012 /* 150 0x96 '.' */
3013 0x08, 0x00, /* 0000100000 */
3014 0x1c, 0x00, /* 0001110000 */
3015 0x36, 0x00, /* 0011011000 */
3016 0x63, 0x00, /* 0110001100 */
3017 0x00, 0x00, /* 0000000000 */
3018 0xf7, 0x80, /* 1111011110 */
3019 0x63, 0x00, /* 0110001100 */
3020 0x63, 0x00, /* 0110001100 */
3021 0x63, 0x00, /* 0110001100 */
3022 0x63, 0x00, /* 0110001100 */
3023 0x63, 0x00, /* 0110001100 */
3024 0x63, 0x00, /* 0110001100 */
3025 0x63, 0x00, /* 0110001100 */
3026 0x77, 0x00, /* 0111011100 */
3027 0x3d, 0x80, /* 0011110110 */
3028 0x00, 0x00, /* 0000000000 */
3029 0x00, 0x00, /* 0000000000 */
3030 0x00, 0x00, /* 0000000000 */
3031
3032 /* 151 0x97 '.' */
3033 0x00, 0x00, /* 0000000000 */
3034 0x60, 0x00, /* 0110000000 */
3035 0x30, 0x00, /* 0011000000 */
3036 0x18, 0x00, /* 0001100000 */
3037 0x00, 0x00, /* 0000000000 */
3038 0xf7, 0x80, /* 1111011110 */
3039 0x63, 0x00, /* 0110001100 */
3040 0x63, 0x00, /* 0110001100 */
3041 0x63, 0x00, /* 0110001100 */
3042 0x63, 0x00, /* 0110001100 */
3043 0x63, 0x00, /* 0110001100 */
3044 0x63, 0x00, /* 0110001100 */
3045 0x63, 0x00, /* 0110001100 */
3046 0x77, 0x00, /* 0111011100 */
3047 0x3d, 0x80, /* 0011110110 */
3048 0x00, 0x00, /* 0000000000 */
3049 0x00, 0x00, /* 0000000000 */
3050 0x00, 0x00, /* 0000000000 */
3051
3052 /* 152 0x98 '.' */
3053 0x00, 0x00, /* 0000000000 */
3054 0x33, 0x00, /* 0011001100 */
3055 0x33, 0x00, /* 0011001100 */
3056 0x00, 0x00, /* 0000000000 */
3057 0x00, 0x00, /* 0000000000 */
3058 0xf3, 0xc0, /* 1111001111 */
3059 0x61, 0x80, /* 0110000110 */
3060 0x33, 0x00, /* 0011001100 */
3061 0x1b, 0x00, /* 0001101100 */
3062 0x1e, 0x00, /* 0001111000 */
3063 0x0e, 0x00, /* 0000111000 */
3064 0x0c, 0x00, /* 0000110000 */
3065 0x0c, 0x00, /* 0000110000 */
3066 0x0c, 0x00, /* 0000110000 */
3067 0x0c, 0x00, /* 0000110000 */
3068 0x18, 0x00, /* 0001100000 */
3069 0x78, 0x00, /* 0111100000 */
3070 0x70, 0x00, /* 0111000000 */
3071
3072 /* 153 0x99 '.' */
3073 0x61, 0x80, /* 0110000110 */
3074 0x61, 0x80, /* 0110000110 */
3075 0x0c, 0x00, /* 0000110000 */
3076 0x17, 0x00, /* 0001011100 */
3077 0x23, 0x00, /* 0010001100 */
3078 0x21, 0x80, /* 0010000110 */
3079 0x61, 0x80, /* 0110000110 */
3080 0x61, 0x80, /* 0110000110 */
3081 0x61, 0x80, /* 0110000110 */
3082 0x61, 0x80, /* 0110000110 */
3083 0x61, 0x80, /* 0110000110 */
3084 0x21, 0x00, /* 0010000100 */
3085 0x31, 0x00, /* 0011000100 */
3086 0x1a, 0x00, /* 0001101000 */
3087 0x0c, 0x00, /* 0000110000 */
3088 0x00, 0x00, /* 0000000000 */
3089 0x00, 0x00, /* 0000000000 */
3090 0x00, 0x00, /* 0000000000 */
3091
3092 /* 154 0x9a '.' */
3093 0x33, 0x00, /* 0011001100 */
3094 0x33, 0x00, /* 0011001100 */
3095 0x00, 0x00, /* 0000000000 */
3096 0xf1, 0xc0, /* 1111000111 */
3097 0x60, 0x80, /* 0110000010 */
3098 0x60, 0x80, /* 0110000010 */
3099 0x60, 0x80, /* 0110000010 */
3100 0x60, 0x80, /* 0110000010 */
3101 0x60, 0x80, /* 0110000010 */
3102 0x60, 0x80, /* 0110000010 */
3103 0x60, 0x80, /* 0110000010 */
3104 0x60, 0x80, /* 0110000010 */
3105 0x71, 0x00, /* 0111000100 */
3106 0x3f, 0x00, /* 0011111100 */
3107 0x1e, 0x00, /* 0001111000 */
3108 0x00, 0x00, /* 0000000000 */
3109 0x00, 0x00, /* 0000000000 */
3110 0x00, 0x00, /* 0000000000 */
3111
3112 /* 155 0x9b '.' */
3113 0x00, 0x00, /* 0000000000 */
3114 0x00, 0x00, /* 0000000000 */
3115 0x00, 0x00, /* 0000000000 */
3116 0x06, 0x00, /* 0000011000 */
3117 0x06, 0x00, /* 0000011000 */
3118 0x1f, 0x80, /* 0001111110 */
3119 0x36, 0x80, /* 0011011010 */
3120 0x26, 0x00, /* 0010011000 */
3121 0x66, 0x00, /* 0110011000 */
3122 0x66, 0x00, /* 0110011000 */
3123 0x66, 0x00, /* 0110011000 */
3124 0x66, 0x00, /* 0110011000 */
3125 0x76, 0x00, /* 0111011000 */
3126 0x36, 0x80, /* 0011011010 */
3127 0x1f, 0x80, /* 0001111110 */
3128 0x06, 0x00, /* 0000011000 */
3129 0x06, 0x00, /* 0000011000 */
3130 0x00, 0x00, /* 0000000000 */
3131
3132 /* 156 0x9c '.' */
3133 0x00, 0x00, /* 0000000000 */
3134 0x1e, 0x00, /* 0001111000 */
3135 0x3b, 0x00, /* 0011101100 */
3136 0x33, 0x00, /* 0011001100 */
3137 0x30, 0x00, /* 0011000000 */
3138 0x30, 0x00, /* 0011000000 */
3139 0x30, 0x00, /* 0011000000 */
3140 0x7e, 0x00, /* 0111111000 */
3141 0x7e, 0x00, /* 0111111000 */
3142 0x30, 0x00, /* 0011000000 */
3143 0x30, 0x00, /* 0011000000 */
3144 0x30, 0x00, /* 0011000000 */
3145 0x30, 0x00, /* 0011000000 */
3146 0x7c, 0x80, /* 0111110010 */
3147 0x7f, 0x80, /* 0111111110 */
3148 0x43, 0x00, /* 0100001100 */
3149 0x00, 0x00, /* 0000000000 */
3150 0x00, 0x00, /* 0000000000 */
3151
3152 /* 157 0x9d '.' */
3153 0x00, 0x00, /* 0000000000 */
3154 0x40, 0x80, /* 0100000010 */
3155 0x40, 0x80, /* 0100000010 */
3156 0x21, 0x00, /* 0010000100 */
3157 0x33, 0x00, /* 0011001100 */
3158 0x33, 0x00, /* 0011001100 */
3159 0x1e, 0x00, /* 0001111000 */
3160 0x0c, 0x00, /* 0000110000 */
3161 0x3f, 0x00, /* 0011111100 */
3162 0x0c, 0x00, /* 0000110000 */
3163 0x3f, 0x00, /* 0011111100 */
3164 0x0c, 0x00, /* 0000110000 */
3165 0x0c, 0x00, /* 0000110000 */
3166 0x0c, 0x00, /* 0000110000 */
3167 0x0c, 0x00, /* 0000110000 */
3168 0x00, 0x00, /* 0000000000 */
3169 0x00, 0x00, /* 0000000000 */
3170 0x00, 0x00, /* 0000000000 */
3171
3172 /* 158 0x9e '.' */
3173 0x00, 0x00, /* 0000000000 */
3174 0xbf, 0x00, /* 1011111100 */
3175 0x40, 0x80, /* 0100000010 */
3176 0x40, 0x80, /* 0100000010 */
3177 0x7f, 0x00, /* 0111111100 */
3178 0x40, 0x00, /* 0100000000 */
3179 0x48, 0x00, /* 0100100000 */
3180 0x48, 0x00, /* 0100100000 */
3181 0x5e, 0x00, /* 0101111000 */
3182 0x48, 0x00, /* 0100100000 */
3183 0x48, 0x00, /* 0100100000 */
3184 0x48, 0x00, /* 0100100000 */
3185 0x48, 0x80, /* 0100100010 */
3186 0x47, 0x00, /* 0100011100 */
3187 0xe0, 0x00, /* 1110000000 */
3188 0x00, 0x00, /* 0000000000 */
3189 0x00, 0x00, /* 0000000000 */
3190 0x00, 0x00, /* 0000000000 */
3191
3192 /* 159 0x9f '.' */
3193 0x00, 0x00, /* 0000000000 */
3194 0x03, 0x00, /* 0000001100 */
3195 0x04, 0x80, /* 0000010010 */
3196 0x08, 0x00, /* 0000100000 */
3197 0x08, 0x00, /* 0000100000 */
3198 0x08, 0x00, /* 0000100000 */
3199 0x08, 0x00, /* 0000100000 */
3200 0x09, 0x00, /* 0000100100 */
3201 0x3e, 0x00, /* 0011111000 */
3202 0x48, 0x00, /* 0100100000 */
3203 0x08, 0x00, /* 0000100000 */
3204 0x08, 0x00, /* 0000100000 */
3205 0x08, 0x00, /* 0000100000 */
3206 0x08, 0x00, /* 0000100000 */
3207 0x08, 0x00, /* 0000100000 */
3208 0x90, 0x00, /* 1001000000 */
3209 0x60, 0x00, /* 0110000000 */
3210 0x00, 0x00, /* 0000000000 */
3211
3212 /* 160 0xa0 '.' */
3213 0x00, 0x00, /* 0000000000 */
3214 0x03, 0x00, /* 0000001100 */
3215 0x06, 0x00, /* 0000011000 */
3216 0x0c, 0x00, /* 0000110000 */
3217 0x00, 0x00, /* 0000000000 */
3218 0x1f, 0x00, /* 0001111100 */
3219 0x31, 0x80, /* 0011000110 */
3220 0x21, 0x80, /* 0010000110 */
3221 0x07, 0x80, /* 0000011110 */
3222 0x39, 0x80, /* 0011100110 */
3223 0x61, 0x80, /* 0110000110 */
3224 0x61, 0x80, /* 0110000110 */
3225 0x61, 0x80, /* 0110000110 */
3226 0x73, 0x80, /* 0111001110 */
3227 0x3d, 0xc0, /* 0011110111 */
3228 0x00, 0x00, /* 0000000000 */
3229 0x00, 0x00, /* 0000000000 */
3230 0x00, 0x00, /* 0000000000 */
3231
3232 /* 161 0xa1 '.' */
3233 0x00, 0x00, /* 0000000000 */
3234 0x03, 0x00, /* 0000001100 */
3235 0x06, 0x00, /* 0000011000 */
3236 0x0c, 0x00, /* 0000110000 */
3237 0x00, 0x00, /* 0000000000 */
3238 0x3c, 0x00, /* 0011110000 */
3239 0x0c, 0x00, /* 0000110000 */
3240 0x0c, 0x00, /* 0000110000 */
3241 0x0c, 0x00, /* 0000110000 */
3242 0x0c, 0x00, /* 0000110000 */
3243 0x0c, 0x00, /* 0000110000 */
3244 0x0c, 0x00, /* 0000110000 */
3245 0x0c, 0x00, /* 0000110000 */
3246 0x0c, 0x00, /* 0000110000 */
3247 0x3f, 0x00, /* 0011111100 */
3248 0x00, 0x00, /* 0000000000 */
3249 0x00, 0x00, /* 0000000000 */
3250 0x00, 0x00, /* 0000000000 */
3251
3252 /* 162 0xa2 '.' */
3253 0x00, 0x00, /* 0000000000 */
3254 0x06, 0x00, /* 0000011000 */
3255 0x0c, 0x00, /* 0000110000 */
3256 0x18, 0x00, /* 0001100000 */
3257 0x00, 0x00, /* 0000000000 */
3258 0x3c, 0x00, /* 0011110000 */
3259 0x66, 0x00, /* 0110011000 */
3260 0xc3, 0x00, /* 1100001100 */
3261 0xc1, 0x80, /* 1100000110 */
3262 0xc1, 0x80, /* 1100000110 */
3263 0xc1, 0x80, /* 1100000110 */
3264 0xc1, 0x80, /* 1100000110 */
3265 0xe1, 0x80, /* 1110000110 */
3266 0x73, 0x00, /* 0111001100 */
3267 0x3c, 0x00, /* 0011110000 */
3268 0x00, 0x00, /* 0000000000 */
3269 0x00, 0x00, /* 0000000000 */
3270 0x00, 0x00, /* 0000000000 */
3271
3272 /* 163 0xa3 '.' */
3273 0x00, 0x00, /* 0000000000 */
3274 0x06, 0x00, /* 0000011000 */
3275 0x0c, 0x00, /* 0000110000 */
3276 0x18, 0x00, /* 0001100000 */
3277 0x00, 0x00, /* 0000000000 */
3278 0xf7, 0x80, /* 1111011110 */
3279 0x63, 0x00, /* 0110001100 */
3280 0x63, 0x00, /* 0110001100 */
3281 0x63, 0x00, /* 0110001100 */
3282 0x63, 0x00, /* 0110001100 */
3283 0x63, 0x00, /* 0110001100 */
3284 0x63, 0x00, /* 0110001100 */
3285 0x63, 0x00, /* 0110001100 */
3286 0x77, 0x00, /* 0111011100 */
3287 0x3d, 0x80, /* 0011110110 */
3288 0x00, 0x00, /* 0000000000 */
3289 0x00, 0x00, /* 0000000000 */
3290 0x00, 0x00, /* 0000000000 */
3291
3292 /* 164 0xa4 '.' */
3293 0x00, 0x00, /* 0000000000 */
3294 0x38, 0x80, /* 0011100010 */
3295 0x7f, 0x80, /* 0111111110 */
3296 0x47, 0x00, /* 0100011100 */
3297 0x00, 0x00, /* 0000000000 */
3298 0x6f, 0x00, /* 0110111100 */
3299 0x7b, 0x80, /* 0111101110 */
3300 0x31, 0x80, /* 0011000110 */
3301 0x31, 0x80, /* 0011000110 */
3302 0x31, 0x80, /* 0011000110 */
3303 0x31, 0x80, /* 0011000110 */
3304 0x31, 0x80, /* 0011000110 */
3305 0x31, 0x80, /* 0011000110 */
3306 0x31, 0x80, /* 0011000110 */
3307 0x7b, 0xc0, /* 0111101111 */
3308 0x00, 0x00, /* 0000000000 */
3309 0x00, 0x00, /* 0000000000 */
3310 0x00, 0x00, /* 0000000000 */
3311
3312 /* 165 0xa5 '.' */
3313 0x00, 0x00, /* 0000000000 */
3314 0x38, 0x80, /* 0011100010 */
3315 0x7f, 0x80, /* 0111111110 */
3316 0x47, 0x00, /* 0100011100 */
3317 0x00, 0x00, /* 0000000000 */
3318 0xe3, 0xc0, /* 1110001111 */
3319 0x71, 0x80, /* 0111000110 */
3320 0x79, 0x80, /* 0111100110 */
3321 0x79, 0x80, /* 0111100110 */
3322 0x6d, 0x80, /* 0110110110 */
3323 0x6d, 0x80, /* 0110110110 */
3324 0x67, 0x80, /* 0110011110 */
3325 0x63, 0x80, /* 0110001110 */
3326 0x61, 0x80, /* 0110000110 */
3327 0xf0, 0xc0, /* 1111000011 */
3328 0x00, 0x00, /* 0000000000 */
3329 0x00, 0x00, /* 0000000000 */
3330 0x00, 0x00, /* 0000000000 */
3331
3332 /* 166 0xa6 '.' */
3333 0x00, 0x00, /* 0000000000 */
3334 0x3e, 0x00, /* 0011111000 */
3335 0x63, 0x00, /* 0110001100 */
3336 0x03, 0x00, /* 0000001100 */
3337 0x0f, 0x00, /* 0000111100 */
3338 0x33, 0x00, /* 0011001100 */
3339 0x63, 0x00, /* 0110001100 */
3340 0x63, 0x00, /* 0110001100 */
3341 0x67, 0x00, /* 0110011100 */
3342 0x3b, 0x80, /* 0011101110 */
3343 0x00, 0x00, /* 0000000000 */
3344 0x7f, 0x80, /* 0111111110 */
3345 0x00, 0x00, /* 0000000000 */
3346 0x00, 0x00, /* 0000000000 */
3347 0x00, 0x00, /* 0000000000 */
3348 0x00, 0x00, /* 0000000000 */
3349 0x00, 0x00, /* 0000000000 */
3350 0x00, 0x00, /* 0000000000 */
3351
3352 /* 167 0xa7 '.' */
3353 0x00, 0x00, /* 0000000000 */
3354 0x0e, 0x00, /* 0000111000 */
3355 0x33, 0x00, /* 0011001100 */
3356 0x21, 0x80, /* 0010000110 */
3357 0x61, 0x80, /* 0110000110 */
3358 0x61, 0x80, /* 0110000110 */
3359 0x61, 0x80, /* 0110000110 */
3360 0x61, 0x00, /* 0110000100 */
3361 0x33, 0x00, /* 0011001100 */
3362 0x1c, 0x00, /* 0001110000 */
3363 0x00, 0x00, /* 0000000000 */
3364 0x7f, 0x80, /* 0111111110 */
3365 0x00, 0x00, /* 0000000000 */
3366 0x00, 0x00, /* 0000000000 */
3367 0x00, 0x00, /* 0000000000 */
3368 0x00, 0x00, /* 0000000000 */
3369 0x00, 0x00, /* 0000000000 */
3370 0x00, 0x00, /* 0000000000 */
3371
3372 /* 168 0xa8 '.' */
3373 0x00, 0x00, /* 0000000000 */
3374 0x06, 0x00, /* 0000011000 */
3375 0x06, 0x00, /* 0000011000 */
3376 0x00, 0x00, /* 0000000000 */
3377 0x06, 0x00, /* 0000011000 */
3378 0x06, 0x00, /* 0000011000 */
3379 0x0c, 0x00, /* 0000110000 */
3380 0x18, 0x00, /* 0001100000 */
3381 0x30, 0x00, /* 0011000000 */
3382 0x60, 0x00, /* 0110000000 */
3383 0x60, 0x00, /* 0110000000 */
3384 0x60, 0x80, /* 0110000010 */
3385 0x73, 0x80, /* 0111001110 */
3386 0x3f, 0x00, /* 0011111100 */
3387 0x1e, 0x00, /* 0001111000 */
3388 0x00, 0x00, /* 0000000000 */
3389 0x00, 0x00, /* 0000000000 */
3390 0x00, 0x00, /* 0000000000 */
3391
3392 /* 169 0xa9 '.' */
3393 0x00, 0x00, /* 0000000000 */
3394 0x00, 0x00, /* 0000000000 */
3395 0x00, 0x00, /* 0000000000 */
3396 0x00, 0x00, /* 0000000000 */
3397 0x00, 0x00, /* 0000000000 */
3398 0x00, 0x00, /* 0000000000 */
3399 0x00, 0x00, /* 0000000000 */
3400 0x00, 0x00, /* 0000000000 */
3401 0x7f, 0x80, /* 0111111110 */
3402 0x7f, 0x80, /* 0111111110 */
3403 0x60, 0x00, /* 0110000000 */
3404 0x60, 0x00, /* 0110000000 */
3405 0x60, 0x00, /* 0110000000 */
3406 0x00, 0x00, /* 0000000000 */
3407 0x00, 0x00, /* 0000000000 */
3408 0x00, 0x00, /* 0000000000 */
3409 0x00, 0x00, /* 0000000000 */
3410 0x00, 0x00, /* 0000000000 */
3411
3412 /* 170 0xaa '.' */
3413 0x00, 0x00, /* 0000000000 */
3414 0x00, 0x00, /* 0000000000 */
3415 0x00, 0x00, /* 0000000000 */
3416 0x00, 0x00, /* 0000000000 */
3417 0x00, 0x00, /* 0000000000 */
3418 0x00, 0x00, /* 0000000000 */
3419 0x00, 0x00, /* 0000000000 */
3420 0x00, 0x00, /* 0000000000 */
3421 0x7f, 0x80, /* 0111111110 */
3422 0x7f, 0x80, /* 0111111110 */
3423 0x01, 0x80, /* 0000000110 */
3424 0x01, 0x80, /* 0000000110 */
3425 0x01, 0x80, /* 0000000110 */
3426 0x00, 0x00, /* 0000000000 */
3427 0x00, 0x00, /* 0000000000 */
3428 0x00, 0x00, /* 0000000000 */
3429 0x00, 0x00, /* 0000000000 */
3430 0x00, 0x00, /* 0000000000 */
3431
3432 /* 171 0xab '.' */
3433 0x00, 0x00, /* 0000000000 */
3434 0x20, 0x00, /* 0010000000 */
3435 0x60, 0x00, /* 0110000000 */
3436 0x20, 0x00, /* 0010000000 */
3437 0x20, 0x80, /* 0010000010 */
3438 0x21, 0x00, /* 0010000100 */
3439 0x22, 0x00, /* 0010001000 */
3440 0x74, 0x00, /* 0111010000 */
3441 0x08, 0x00, /* 0000100000 */
3442 0x17, 0x00, /* 0001011100 */
3443 0x28, 0x80, /* 0010100010 */
3444 0x43, 0x00, /* 0100001100 */
3445 0x04, 0x00, /* 0000010000 */
3446 0x08, 0x00, /* 0000100000 */
3447 0x0f, 0x80, /* 0000111110 */
3448 0x00, 0x00, /* 0000000000 */
3449 0x00, 0x00, /* 0000000000 */
3450 0x00, 0x00, /* 0000000000 */
3451
3452 /* 172 0xac '.' */
3453 0x00, 0x00, /* 0000000000 */
3454 0x20, 0x00, /* 0010000000 */
3455 0x60, 0x00, /* 0110000000 */
3456 0x20, 0x00, /* 0010000000 */
3457 0x20, 0x80, /* 0010000010 */
3458 0x21, 0x00, /* 0010000100 */
3459 0x22, 0x00, /* 0010001000 */
3460 0x74, 0x00, /* 0111010000 */
3461 0x09, 0x00, /* 0000100100 */
3462 0x13, 0x00, /* 0001001100 */
3463 0x25, 0x00, /* 0010010100 */
3464 0x49, 0x00, /* 0100100100 */
3465 0x1f, 0x80, /* 0001111110 */
3466 0x01, 0x00, /* 0000000100 */
3467 0x01, 0x00, /* 0000000100 */
3468 0x00, 0x00, /* 0000000000 */
3469 0x00, 0x00, /* 0000000000 */
3470 0x00, 0x00, /* 0000000000 */
3471
3472 /* 173 0xad '.' */
3473 0x00, 0x00, /* 0000000000 */
3474 0x0c, 0x00, /* 0000110000 */
3475 0x0c, 0x00, /* 0000110000 */
3476 0x00, 0x00, /* 0000000000 */
3477 0x0c, 0x00, /* 0000110000 */
3478 0x0c, 0x00, /* 0000110000 */
3479 0x0c, 0x00, /* 0000110000 */
3480 0x0c, 0x00, /* 0000110000 */
3481 0x0c, 0x00, /* 0000110000 */
3482 0x0c, 0x00, /* 0000110000 */
3483 0x0c, 0x00, /* 0000110000 */
3484 0x0c, 0x00, /* 0000110000 */
3485 0x0c, 0x00, /* 0000110000 */
3486 0x0c, 0x00, /* 0000110000 */
3487 0x0c, 0x00, /* 0000110000 */
3488 0x00, 0x00, /* 0000000000 */
3489 0x00, 0x00, /* 0000000000 */
3490 0x00, 0x00, /* 0000000000 */
3491
3492 /* 174 0xae '.' */
3493 0x00, 0x00, /* 0000000000 */
3494 0x00, 0x00, /* 0000000000 */
3495 0x00, 0x00, /* 0000000000 */
3496 0x00, 0x00, /* 0000000000 */
3497 0x00, 0x00, /* 0000000000 */
3498 0x0d, 0x80, /* 0000110110 */
3499 0x1b, 0x00, /* 0001101100 */
3500 0x36, 0x00, /* 0011011000 */
3501 0x6c, 0x00, /* 0110110000 */
3502 0xd8, 0x00, /* 1101100000 */
3503 0x6c, 0x00, /* 0110110000 */
3504 0x36, 0x00, /* 0011011000 */
3505 0x1b, 0x00, /* 0001101100 */
3506 0x0d, 0x80, /* 0000110110 */
3507 0x00, 0x00, /* 0000000000 */
3508 0x00, 0x00, /* 0000000000 */
3509 0x00, 0x00, /* 0000000000 */
3510 0x00, 0x00, /* 0000000000 */
3511
3512 /* 175 0xaf '.' */
3513 0x00, 0x00, /* 0000000000 */
3514 0x00, 0x00, /* 0000000000 */
3515 0x00, 0x00, /* 0000000000 */
3516 0x00, 0x00, /* 0000000000 */
3517 0x00, 0x00, /* 0000000000 */
3518 0x6c, 0x00, /* 0110110000 */
3519 0x36, 0x00, /* 0011011000 */
3520 0x1b, 0x00, /* 0001101100 */
3521 0x0d, 0x80, /* 0000110110 */
3522 0x06, 0xc0, /* 0000011011 */
3523 0x0d, 0x80, /* 0000110110 */
3524 0x1b, 0x00, /* 0001101100 */
3525 0x36, 0x00, /* 0011011000 */
3526 0x6c, 0x00, /* 0110110000 */
3527 0x00, 0x00, /* 0000000000 */
3528 0x00, 0x00, /* 0000000000 */
3529 0x00, 0x00, /* 0000000000 */
3530 0x00, 0x00, /* 0000000000 */
3531
3532 /* 176 0xb0 '.' */
3533 0xc3, 0x00, /* 1100001100 */
3534 0x41, 0x00, /* 0100000100 */
3535 0x18, 0x40, /* 0001100001 */
3536 0x10, 0x40, /* 0001000001 */
3537 0xc3, 0x00, /* 1100001100 */
3538 0x41, 0x00, /* 0100000100 */
3539 0x18, 0x40, /* 0001100001 */
3540 0x10, 0x40, /* 0001000001 */
3541 0xc3, 0x00, /* 1100001100 */
3542 0x41, 0x00, /* 0100000100 */
3543 0x18, 0x40, /* 0001100001 */
3544 0x10, 0x40, /* 0001000001 */
3545 0xc3, 0x00, /* 1100001100 */
3546 0x41, 0x00, /* 0100000100 */
3547 0x18, 0x40, /* 0001100001 */
3548 0x10, 0x40, /* 0001000001 */
3549 0xc3, 0x00, /* 1100001100 */
3550 0x41, 0x00, /* 0100000100 */
3551
3552 /* 177 0xb1 '.' */
3553 0x11, 0x00, /* 0001000100 */
3554 0xbb, 0x80, /* 1011101110 */
3555 0x11, 0x00, /* 0001000100 */
3556 0x44, 0x40, /* 0100010001 */
3557 0xee, 0xc0, /* 1110111011 */
3558 0x44, 0x40, /* 0100010001 */
3559 0x11, 0x00, /* 0001000100 */
3560 0xbb, 0x80, /* 1011101110 */
3561 0x11, 0x00, /* 0001000100 */
3562 0x44, 0x40, /* 0100010001 */
3563 0xee, 0xc0, /* 1110111011 */
3564 0x44, 0x40, /* 0100010001 */
3565 0x11, 0x00, /* 0001000100 */
3566 0xbb, 0x80, /* 1011101110 */
3567 0x11, 0x00, /* 0001000100 */
3568 0x44, 0x40, /* 0100010001 */
3569 0xee, 0xc0, /* 1110111011 */
3570 0x44, 0x40, /* 0100010001 */
3571
3572 /* 178 0xb2 '.' */
3573 0x3c, 0xc0, /* 0011110011 */
3574 0xbe, 0xc0, /* 1011111011 */
3575 0xe7, 0x80, /* 1110011110 */
3576 0xef, 0x80, /* 1110111110 */
3577 0x3c, 0xc0, /* 0011110011 */
3578 0xbe, 0xc0, /* 1011111011 */
3579 0xe7, 0x80, /* 1110011110 */
3580 0xef, 0x80, /* 1110111110 */
3581 0x3c, 0xc0, /* 0011110011 */
3582 0xbe, 0xc0, /* 1011111011 */
3583 0xe7, 0x80, /* 1110011110 */
3584 0xef, 0x80, /* 1110111110 */
3585 0x3c, 0xc0, /* 0011110011 */
3586 0xbe, 0xc0, /* 1011111011 */
3587 0xe7, 0x80, /* 1110011110 */
3588 0xef, 0x80, /* 1110111110 */
3589 0x3c, 0xc0, /* 0011110011 */
3590 0xbe, 0xc0, /* 1011111011 */
3591
3592 /* 179 0xb3 '.' */
3593 0x0c, 0x00, /* 0000110000 */
3594 0x0c, 0x00, /* 0000110000 */
3595 0x0c, 0x00, /* 0000110000 */
3596 0x0c, 0x00, /* 0000110000 */
3597 0x0c, 0x00, /* 0000110000 */
3598 0x0c, 0x00, /* 0000110000 */
3599 0x0c, 0x00, /* 0000110000 */
3600 0x0c, 0x00, /* 0000110000 */
3601 0x0c, 0x00, /* 0000110000 */
3602 0x0c, 0x00, /* 0000110000 */
3603 0x0c, 0x00, /* 0000110000 */
3604 0x0c, 0x00, /* 0000110000 */
3605 0x0c, 0x00, /* 0000110000 */
3606 0x0c, 0x00, /* 0000110000 */
3607 0x0c, 0x00, /* 0000110000 */
3608 0x0c, 0x00, /* 0000110000 */
3609 0x0c, 0x00, /* 0000110000 */
3610 0x0c, 0x00, /* 0000110000 */
3611
3612 /* 180 0xb4 '.' */
3613 0x0c, 0x00, /* 0000110000 */
3614 0x0c, 0x00, /* 0000110000 */
3615 0x0c, 0x00, /* 0000110000 */
3616 0x0c, 0x00, /* 0000110000 */
3617 0x0c, 0x00, /* 0000110000 */
3618 0x0c, 0x00, /* 0000110000 */
3619 0x0c, 0x00, /* 0000110000 */
3620 0x0c, 0x00, /* 0000110000 */
3621 0xfc, 0x00, /* 1111110000 */
3622 0xfc, 0x00, /* 1111110000 */
3623 0x0c, 0x00, /* 0000110000 */
3624 0x0c, 0x00, /* 0000110000 */
3625 0x0c, 0x00, /* 0000110000 */
3626 0x0c, 0x00, /* 0000110000 */
3627 0x0c, 0x00, /* 0000110000 */
3628 0x0c, 0x00, /* 0000110000 */
3629 0x0c, 0x00, /* 0000110000 */
3630 0x0c, 0x00, /* 0000110000 */
3631
3632 /* 181 0xb5 '.' */
3633 0x0c, 0x00, /* 0000110000 */
3634 0x0c, 0x00, /* 0000110000 */
3635 0x0c, 0x00, /* 0000110000 */
3636 0x0c, 0x00, /* 0000110000 */
3637 0x0c, 0x00, /* 0000110000 */
3638 0xfc, 0x00, /* 1111110000 */
3639 0xfc, 0x00, /* 1111110000 */
3640 0x0c, 0x00, /* 0000110000 */
3641 0xfc, 0x00, /* 1111110000 */
3642 0xfc, 0x00, /* 1111110000 */
3643 0x0c, 0x00, /* 0000110000 */
3644 0x0c, 0x00, /* 0000110000 */
3645 0x0c, 0x00, /* 0000110000 */
3646 0x0c, 0x00, /* 0000110000 */
3647 0x0c, 0x00, /* 0000110000 */
3648 0x0c, 0x00, /* 0000110000 */
3649 0x0c, 0x00, /* 0000110000 */
3650 0x0c, 0x00, /* 0000110000 */
3651
3652 /* 182 0xb6 '.' */
3653 0x1b, 0x00, /* 0001101100 */
3654 0x1b, 0x00, /* 0001101100 */
3655 0x1b, 0x00, /* 0001101100 */
3656 0x1b, 0x00, /* 0001101100 */
3657 0x1b, 0x00, /* 0001101100 */
3658 0x1b, 0x00, /* 0001101100 */
3659 0x1b, 0x00, /* 0001101100 */
3660 0x1b, 0x00, /* 0001101100 */
3661 0xfb, 0x00, /* 1111101100 */
3662 0xfb, 0x00, /* 1111101100 */
3663 0x1b, 0x00, /* 0001101100 */
3664 0x1b, 0x00, /* 0001101100 */
3665 0x1b, 0x00, /* 0001101100 */
3666 0x1b, 0x00, /* 0001101100 */
3667 0x1b, 0x00, /* 0001101100 */
3668 0x1b, 0x00, /* 0001101100 */
3669 0x1b, 0x00, /* 0001101100 */
3670 0x1b, 0x00, /* 0001101100 */
3671
3672 /* 183 0xb7 '.' */
3673 0x00, 0x00, /* 0000000000 */
3674 0x00, 0x00, /* 0000000000 */
3675 0x00, 0x00, /* 0000000000 */
3676 0x00, 0x00, /* 0000000000 */
3677 0x00, 0x00, /* 0000000000 */
3678 0x00, 0x00, /* 0000000000 */
3679 0x00, 0x00, /* 0000000000 */
3680 0x00, 0x00, /* 0000000000 */
3681 0xff, 0x00, /* 1111111100 */
3682 0xff, 0x00, /* 1111111100 */
3683 0x1b, 0x00, /* 0001101100 */
3684 0x1b, 0x00, /* 0001101100 */
3685 0x1b, 0x00, /* 0001101100 */
3686 0x1b, 0x00, /* 0001101100 */
3687 0x1b, 0x00, /* 0001101100 */
3688 0x1b, 0x00, /* 0001101100 */
3689 0x1b, 0x00, /* 0001101100 */
3690 0x1b, 0x00, /* 0001101100 */
3691
3692 /* 184 0xb8 '.' */
3693 0x00, 0x00, /* 0000000000 */
3694 0x00, 0x00, /* 0000000000 */
3695 0x00, 0x00, /* 0000000000 */
3696 0x00, 0x00, /* 0000000000 */
3697 0x00, 0x00, /* 0000000000 */
3698 0xfc, 0x00, /* 1111110000 */
3699 0xfc, 0x00, /* 1111110000 */
3700 0x0c, 0x00, /* 0000110000 */
3701 0xfc, 0x00, /* 1111110000 */
3702 0xfc, 0x00, /* 1111110000 */
3703 0x0c, 0x00, /* 0000110000 */
3704 0x0c, 0x00, /* 0000110000 */
3705 0x0c, 0x00, /* 0000110000 */
3706 0x0c, 0x00, /* 0000110000 */
3707 0x0c, 0x00, /* 0000110000 */
3708 0x0c, 0x00, /* 0000110000 */
3709 0x0c, 0x00, /* 0000110000 */
3710 0x0c, 0x00, /* 0000110000 */
3711
3712 /* 185 0xb9 '.' */
3713 0x1b, 0x00, /* 0001101100 */
3714 0x1b, 0x00, /* 0001101100 */
3715 0x1b, 0x00, /* 0001101100 */
3716 0x1b, 0x00, /* 0001101100 */
3717 0x1b, 0x00, /* 0001101100 */
3718 0xfb, 0x00, /* 1111101100 */
3719 0xfb, 0x00, /* 1111101100 */
3720 0x03, 0x00, /* 0000001100 */
3721 0xfb, 0x00, /* 1111101100 */
3722 0xfb, 0x00, /* 1111101100 */
3723 0x1b, 0x00, /* 0001101100 */
3724 0x1b, 0x00, /* 0001101100 */
3725 0x1b, 0x00, /* 0001101100 */
3726 0x1b, 0x00, /* 0001101100 */
3727 0x1b, 0x00, /* 0001101100 */
3728 0x1b, 0x00, /* 0001101100 */
3729 0x1b, 0x00, /* 0001101100 */
3730 0x1b, 0x00, /* 0001101100 */
3731
3732 /* 186 0xba '.' */
3733 0x1b, 0x00, /* 0001101100 */
3734 0x1b, 0x00, /* 0001101100 */
3735 0x1b, 0x00, /* 0001101100 */
3736 0x1b, 0x00, /* 0001101100 */
3737 0x1b, 0x00, /* 0001101100 */
3738 0x1b, 0x00, /* 0001101100 */
3739 0x1b, 0x00, /* 0001101100 */
3740 0x1b, 0x00, /* 0001101100 */
3741 0x1b, 0x00, /* 0001101100 */
3742 0x1b, 0x00, /* 0001101100 */
3743 0x1b, 0x00, /* 0001101100 */
3744 0x1b, 0x00, /* 0001101100 */
3745 0x1b, 0x00, /* 0001101100 */
3746 0x1b, 0x00, /* 0001101100 */
3747 0x1b, 0x00, /* 0001101100 */
3748 0x1b, 0x00, /* 0001101100 */
3749 0x1b, 0x00, /* 0001101100 */
3750 0x1b, 0x00, /* 0001101100 */
3751
3752 /* 187 0xbb '.' */
3753 0x00, 0x00, /* 0000000000 */
3754 0x00, 0x00, /* 0000000000 */
3755 0x00, 0x00, /* 0000000000 */
3756 0x00, 0x00, /* 0000000000 */
3757 0x00, 0x00, /* 0000000000 */
3758 0xff, 0x00, /* 1111111100 */
3759 0xff, 0x00, /* 1111111100 */
3760 0x03, 0x00, /* 0000001100 */
3761 0xfb, 0x00, /* 1111101100 */
3762 0xfb, 0x00, /* 1111101100 */
3763 0x1b, 0x00, /* 0001101100 */
3764 0x1b, 0x00, /* 0001101100 */
3765 0x1b, 0x00, /* 0001101100 */
3766 0x1b, 0x00, /* 0001101100 */
3767 0x1b, 0x00, /* 0001101100 */
3768 0x1b, 0x00, /* 0001101100 */
3769 0x1b, 0x00, /* 0001101100 */
3770 0x1b, 0x00, /* 0001101100 */
3771
3772 /* 188 0xbc '.' */
3773 0x1b, 0x00, /* 0001101100 */
3774 0x1b, 0x00, /* 0001101100 */
3775 0x1b, 0x00, /* 0001101100 */
3776 0x1b, 0x00, /* 0001101100 */
3777 0x1b, 0x00, /* 0001101100 */
3778 0xfb, 0x00, /* 1111101100 */
3779 0xfb, 0x00, /* 1111101100 */
3780 0x03, 0x00, /* 0000001100 */
3781 0xff, 0x00, /* 1111111100 */
3782 0xff, 0x00, /* 1111111100 */
3783 0x00, 0x00, /* 0000000000 */
3784 0x00, 0x00, /* 0000000000 */
3785 0x00, 0x00, /* 0000000000 */
3786 0x00, 0x00, /* 0000000000 */
3787 0x00, 0x00, /* 0000000000 */
3788 0x00, 0x00, /* 0000000000 */
3789 0x00, 0x00, /* 0000000000 */
3790 0x00, 0x00, /* 0000000000 */
3791
3792 /* 189 0xbd '.' */
3793 0x1b, 0x00, /* 0001101100 */
3794 0x1b, 0x00, /* 0001101100 */
3795 0x1b, 0x00, /* 0001101100 */
3796 0x1b, 0x00, /* 0001101100 */
3797 0x1b, 0x00, /* 0001101100 */
3798 0x1b, 0x00, /* 0001101100 */
3799 0x1b, 0x00, /* 0001101100 */
3800 0x1b, 0x00, /* 0001101100 */
3801 0xff, 0x00, /* 1111111100 */
3802 0xff, 0x00, /* 1111111100 */
3803 0x00, 0x00, /* 0000000000 */
3804 0x00, 0x00, /* 0000000000 */
3805 0x00, 0x00, /* 0000000000 */
3806 0x00, 0x00, /* 0000000000 */
3807 0x00, 0x00, /* 0000000000 */
3808 0x00, 0x00, /* 0000000000 */
3809 0x00, 0x00, /* 0000000000 */
3810 0x00, 0x00, /* 0000000000 */
3811
3812 /* 190 0xbe '.' */
3813 0x0c, 0x00, /* 0000110000 */
3814 0x0c, 0x00, /* 0000110000 */
3815 0x0c, 0x00, /* 0000110000 */
3816 0x0c, 0x00, /* 0000110000 */
3817 0x0c, 0x00, /* 0000110000 */
3818 0xfc, 0x00, /* 1111110000 */
3819 0xfc, 0x00, /* 1111110000 */
3820 0x0c, 0x00, /* 0000110000 */
3821 0xfc, 0x00, /* 1111110000 */
3822 0xfc, 0x00, /* 1111110000 */
3823 0x00, 0x00, /* 0000000000 */
3824 0x00, 0x00, /* 0000000000 */
3825 0x00, 0x00, /* 0000000000 */
3826 0x00, 0x00, /* 0000000000 */
3827 0x00, 0x00, /* 0000000000 */
3828 0x00, 0x00, /* 0000000000 */
3829 0x00, 0x00, /* 0000000000 */
3830 0x00, 0x00, /* 0000000000 */
3831
3832 /* 191 0xbf '.' */
3833 0x00, 0x00, /* 0000000000 */
3834 0x00, 0x00, /* 0000000000 */
3835 0x00, 0x00, /* 0000000000 */
3836 0x00, 0x00, /* 0000000000 */
3837 0x00, 0x00, /* 0000000000 */
3838 0x00, 0x00, /* 0000000000 */
3839 0x00, 0x00, /* 0000000000 */
3840 0x00, 0x00, /* 0000000000 */
3841 0xfc, 0x00, /* 1111110000 */
3842 0xfc, 0x00, /* 1111110000 */
3843 0x0c, 0x00, /* 0000110000 */
3844 0x0c, 0x00, /* 0000110000 */
3845 0x0c, 0x00, /* 0000110000 */
3846 0x0c, 0x00, /* 0000110000 */
3847 0x0c, 0x00, /* 0000110000 */
3848 0x0c, 0x00, /* 0000110000 */
3849 0x0c, 0x00, /* 0000110000 */
3850 0x0c, 0x00, /* 0000110000 */
3851
3852 /* 192 0xc0 '.' */
3853 0x0c, 0x00, /* 0000110000 */
3854 0x0c, 0x00, /* 0000110000 */
3855 0x0c, 0x00, /* 0000110000 */
3856 0x0c, 0x00, /* 0000110000 */
3857 0x0c, 0x00, /* 0000110000 */
3858 0x0c, 0x00, /* 0000110000 */
3859 0x0c, 0x00, /* 0000110000 */
3860 0x0c, 0x00, /* 0000110000 */
3861 0x0f, 0xc0, /* 0000111111 */
3862 0x0f, 0xc0, /* 0000111111 */
3863 0x00, 0x00, /* 0000000000 */
3864 0x00, 0x00, /* 0000000000 */
3865 0x00, 0x00, /* 0000000000 */
3866 0x00, 0x00, /* 0000000000 */
3867 0x00, 0x00, /* 0000000000 */
3868 0x00, 0x00, /* 0000000000 */
3869 0x00, 0x00, /* 0000000000 */
3870 0x00, 0x00, /* 0000000000 */
3871
3872 /* 193 0xc1 '.' */
3873 0x0c, 0x00, /* 0000110000 */
3874 0x0c, 0x00, /* 0000110000 */
3875 0x0c, 0x00, /* 0000110000 */
3876 0x0c, 0x00, /* 0000110000 */
3877 0x0c, 0x00, /* 0000110000 */
3878 0x0c, 0x00, /* 0000110000 */
3879 0x0c, 0x00, /* 0000110000 */
3880 0x0c, 0x00, /* 0000110000 */
3881 0xff, 0xc0, /* 1111111111 */
3882 0xff, 0xc0, /* 1111111111 */
3883 0x00, 0x00, /* 0000000000 */
3884 0x00, 0x00, /* 0000000000 */
3885 0x00, 0x00, /* 0000000000 */
3886 0x00, 0x00, /* 0000000000 */
3887 0x00, 0x00, /* 0000000000 */
3888 0x00, 0x00, /* 0000000000 */
3889 0x00, 0x00, /* 0000000000 */
3890 0x00, 0x00, /* 0000000000 */
3891
3892 /* 194 0xc2 '.' */
3893 0x00, 0x00, /* 0000000000 */
3894 0x00, 0x00, /* 0000000000 */
3895 0x00, 0x00, /* 0000000000 */
3896 0x00, 0x00, /* 0000000000 */
3897 0x00, 0x00, /* 0000000000 */
3898 0x00, 0x00, /* 0000000000 */
3899 0x00, 0x00, /* 0000000000 */
3900 0x00, 0x00, /* 0000000000 */
3901 0xff, 0xc0, /* 1111111111 */
3902 0xff, 0xc0, /* 1111111111 */
3903 0x0c, 0x00, /* 0000110000 */
3904 0x0c, 0x00, /* 0000110000 */
3905 0x0c, 0x00, /* 0000110000 */
3906 0x0c, 0x00, /* 0000110000 */
3907 0x0c, 0x00, /* 0000110000 */
3908 0x0c, 0x00, /* 0000110000 */
3909 0x0c, 0x00, /* 0000110000 */
3910 0x0c, 0x00, /* 0000110000 */
3911
3912 /* 195 0xc3 '.' */
3913 0x0c, 0x00, /* 0000110000 */
3914 0x0c, 0x00, /* 0000110000 */
3915 0x0c, 0x00, /* 0000110000 */
3916 0x0c, 0x00, /* 0000110000 */
3917 0x0c, 0x00, /* 0000110000 */
3918 0x0c, 0x00, /* 0000110000 */
3919 0x0c, 0x00, /* 0000110000 */
3920 0x0c, 0x00, /* 0000110000 */
3921 0x0f, 0xc0, /* 0000111111 */
3922 0x0f, 0xc0, /* 0000111111 */
3923 0x0c, 0x00, /* 0000110000 */
3924 0x0c, 0x00, /* 0000110000 */
3925 0x0c, 0x00, /* 0000110000 */
3926 0x0c, 0x00, /* 0000110000 */
3927 0x0c, 0x00, /* 0000110000 */
3928 0x0c, 0x00, /* 0000110000 */
3929 0x0c, 0x00, /* 0000110000 */
3930 0x0c, 0x00, /* 0000110000 */
3931
3932 /* 196 0xc4 '.' */
3933 0x00, 0x00, /* 0000000000 */
3934 0x00, 0x00, /* 0000000000 */
3935 0x00, 0x00, /* 0000000000 */
3936 0x00, 0x00, /* 0000000000 */
3937 0x00, 0x00, /* 0000000000 */
3938 0x00, 0x00, /* 0000000000 */
3939 0x00, 0x00, /* 0000000000 */
3940 0x00, 0x00, /* 0000000000 */
3941 0xff, 0xc0, /* 1111111111 */
3942 0xff, 0xc0, /* 1111111111 */
3943 0x00, 0x00, /* 0000000000 */
3944 0x00, 0x00, /* 0000000000 */
3945 0x00, 0x00, /* 0000000000 */
3946 0x00, 0x00, /* 0000000000 */
3947 0x00, 0x00, /* 0000000000 */
3948 0x00, 0x00, /* 0000000000 */
3949 0x00, 0x00, /* 0000000000 */
3950 0x00, 0x00, /* 0000000000 */
3951
3952 /* 197 0xc5 '.' */
3953 0x0c, 0x00, /* 0000110000 */
3954 0x0c, 0x00, /* 0000110000 */
3955 0x0c, 0x00, /* 0000110000 */
3956 0x0c, 0x00, /* 0000110000 */
3957 0x0c, 0x00, /* 0000110000 */
3958 0x0c, 0x00, /* 0000110000 */
3959 0x0c, 0x00, /* 0000110000 */
3960 0x0c, 0x00, /* 0000110000 */
3961 0xff, 0xc0, /* 1111111111 */
3962 0xff, 0xc0, /* 1111111111 */
3963 0x0c, 0x00, /* 0000110000 */
3964 0x0c, 0x00, /* 0000110000 */
3965 0x0c, 0x00, /* 0000110000 */
3966 0x0c, 0x00, /* 0000110000 */
3967 0x0c, 0x00, /* 0000110000 */
3968 0x0c, 0x00, /* 0000110000 */
3969 0x0c, 0x00, /* 0000110000 */
3970 0x0c, 0x00, /* 0000110000 */
3971
3972 /* 198 0xc6 '.' */
3973 0x0c, 0x00, /* 0000110000 */
3974 0x0c, 0x00, /* 0000110000 */
3975 0x0c, 0x00, /* 0000110000 */
3976 0x0c, 0x00, /* 0000110000 */
3977 0x0c, 0x00, /* 0000110000 */
3978 0x0f, 0xc0, /* 0000111111 */
3979 0x0f, 0xc0, /* 0000111111 */
3980 0x0c, 0x00, /* 0000110000 */
3981 0x0f, 0xc0, /* 0000111111 */
3982 0x0f, 0xc0, /* 0000111111 */
3983 0x0c, 0x00, /* 0000110000 */
3984 0x0c, 0x00, /* 0000110000 */
3985 0x0c, 0x00, /* 0000110000 */
3986 0x0c, 0x00, /* 0000110000 */
3987 0x0c, 0x00, /* 0000110000 */
3988 0x0c, 0x00, /* 0000110000 */
3989 0x0c, 0x00, /* 0000110000 */
3990 0x0c, 0x00, /* 0000110000 */
3991
3992 /* 199 0xc7 '.' */
3993 0x1b, 0x00, /* 0001101100 */
3994 0x1b, 0x00, /* 0001101100 */
3995 0x1b, 0x00, /* 0001101100 */
3996 0x1b, 0x00, /* 0001101100 */
3997 0x1b, 0x00, /* 0001101100 */
3998 0x1b, 0x00, /* 0001101100 */
3999 0x1b, 0x00, /* 0001101100 */
4000 0x1b, 0x00, /* 0001101100 */
4001 0x1b, 0xc0, /* 0001101111 */
4002 0x1b, 0xc0, /* 0001101111 */
4003 0x1b, 0x00, /* 0001101100 */
4004 0x1b, 0x00, /* 0001101100 */
4005 0x1b, 0x00, /* 0001101100 */
4006 0x1b, 0x00, /* 0001101100 */
4007 0x1b, 0x00, /* 0001101100 */
4008 0x1b, 0x00, /* 0001101100 */
4009 0x1b, 0x00, /* 0001101100 */
4010 0x1b, 0x00, /* 0001101100 */
4011
4012 /* 200 0xc8 '.' */
4013 0x1b, 0x00, /* 0001101100 */
4014 0x1b, 0x00, /* 0001101100 */
4015 0x1b, 0x00, /* 0001101100 */
4016 0x1b, 0x00, /* 0001101100 */
4017 0x1b, 0x00, /* 0001101100 */
4018 0x1b, 0xc0, /* 0001101111 */
4019 0x1b, 0xc0, /* 0001101111 */
4020 0x18, 0x00, /* 0001100000 */
4021 0x1f, 0xc0, /* 0001111111 */
4022 0x1f, 0xc0, /* 0001111111 */
4023 0x00, 0x00, /* 0000000000 */
4024 0x00, 0x00, /* 0000000000 */
4025 0x00, 0x00, /* 0000000000 */
4026 0x00, 0x00, /* 0000000000 */
4027 0x00, 0x00, /* 0000000000 */
4028 0x00, 0x00, /* 0000000000 */
4029 0x00, 0x00, /* 0000000000 */
4030 0x00, 0x00, /* 0000000000 */
4031
4032 /* 201 0xc9 '.' */
4033 0x00, 0x00, /* 0000000000 */
4034 0x00, 0x00, /* 0000000000 */
4035 0x00, 0x00, /* 0000000000 */
4036 0x00, 0x00, /* 0000000000 */
4037 0x00, 0x00, /* 0000000000 */
4038 0x1f, 0xc0, /* 0001111111 */
4039 0x1f, 0xc0, /* 0001111111 */
4040 0x18, 0x00, /* 0001100000 */
4041 0x1b, 0xc0, /* 0001101111 */
4042 0x1b, 0xc0, /* 0001101111 */
4043 0x1b, 0x00, /* 0001101100 */
4044 0x1b, 0x00, /* 0001101100 */
4045 0x1b, 0x00, /* 0001101100 */
4046 0x1b, 0x00, /* 0001101100 */
4047 0x1b, 0x00, /* 0001101100 */
4048 0x1b, 0x00, /* 0001101100 */
4049 0x1b, 0x00, /* 0001101100 */
4050 0x1b, 0x00, /* 0001101100 */
4051
4052 /* 202 0xca '.' */
4053 0x1b, 0x00, /* 0001101100 */
4054 0x1b, 0x00, /* 0001101100 */
4055 0x1b, 0x00, /* 0001101100 */
4056 0x1b, 0x00, /* 0001101100 */
4057 0x1b, 0x00, /* 0001101100 */
4058 0xfb, 0xc0, /* 1111101111 */
4059 0xfb, 0xc0, /* 1111101111 */
4060 0x00, 0x00, /* 0000000000 */
4061 0xff, 0xc0, /* 1111111111 */
4062 0xff, 0xc0, /* 1111111111 */
4063 0x00, 0x00, /* 0000000000 */
4064 0x00, 0x00, /* 0000000000 */
4065 0x00, 0x00, /* 0000000000 */
4066 0x00, 0x00, /* 0000000000 */
4067 0x00, 0x00, /* 0000000000 */
4068 0x00, 0x00, /* 0000000000 */
4069 0x00, 0x00, /* 0000000000 */
4070 0x00, 0x00, /* 0000000000 */
4071
4072 /* 203 0xcb '.' */
4073 0x00, 0x00, /* 0000000000 */
4074 0x00, 0x00, /* 0000000000 */
4075 0x00, 0x00, /* 0000000000 */
4076 0x00, 0x00, /* 0000000000 */
4077 0x00, 0x00, /* 0000000000 */
4078 0xff, 0xc0, /* 1111111111 */
4079 0xff, 0xc0, /* 1111111111 */
4080 0x00, 0x00, /* 0000000000 */
4081 0xfb, 0xc0, /* 1111101111 */
4082 0xfb, 0xc0, /* 1111101111 */
4083 0x1b, 0x00, /* 0001101100 */
4084 0x1b, 0x00, /* 0001101100 */
4085 0x1b, 0x00, /* 0001101100 */
4086 0x1b, 0x00, /* 0001101100 */
4087 0x1b, 0x00, /* 0001101100 */
4088 0x1b, 0x00, /* 0001101100 */
4089 0x1b, 0x00, /* 0001101100 */
4090 0x1b, 0x00, /* 0001101100 */
4091
4092 /* 204 0xcc '.' */
4093 0x1b, 0x00, /* 0001101100 */
4094 0x1b, 0x00, /* 0001101100 */
4095 0x1b, 0x00, /* 0001101100 */
4096 0x1b, 0x00, /* 0001101100 */
4097 0x1b, 0x00, /* 0001101100 */
4098 0x1b, 0xc0, /* 0001101111 */
4099 0x1b, 0xc0, /* 0001101111 */
4100 0x18, 0x00, /* 0001100000 */
4101 0x1b, 0xc0, /* 0001101111 */
4102 0x1b, 0xc0, /* 0001101111 */
4103 0x1b, 0x00, /* 0001101100 */
4104 0x1b, 0x00, /* 0001101100 */
4105 0x1b, 0x00, /* 0001101100 */
4106 0x1b, 0x00, /* 0001101100 */
4107 0x1b, 0x00, /* 0001101100 */
4108 0x1b, 0x00, /* 0001101100 */
4109 0x1b, 0x00, /* 0001101100 */
4110 0x1b, 0x00, /* 0001101100 */
4111
4112 /* 205 0xcd '.' */
4113 0x00, 0x00, /* 0000000000 */
4114 0x00, 0x00, /* 0000000000 */
4115 0x00, 0x00, /* 0000000000 */
4116 0x00, 0x00, /* 0000000000 */
4117 0x00, 0x00, /* 0000000000 */
4118 0xff, 0xc0, /* 1111111111 */
4119 0xff, 0xc0, /* 1111111111 */
4120 0x00, 0x00, /* 0000000000 */
4121 0xff, 0xc0, /* 1111111111 */
4122 0xff, 0xc0, /* 1111111111 */
4123 0x00, 0x00, /* 0000000000 */
4124 0x00, 0x00, /* 0000000000 */
4125 0x00, 0x00, /* 0000000000 */
4126 0x00, 0x00, /* 0000000000 */
4127 0x00, 0x00, /* 0000000000 */
4128 0x00, 0x00, /* 0000000000 */
4129 0x00, 0x00, /* 0000000000 */
4130 0x00, 0x00, /* 0000000000 */
4131
4132 /* 206 0xce '.' */
4133 0x1b, 0x00, /* 0001101100 */
4134 0x1b, 0x00, /* 0001101100 */
4135 0x1b, 0x00, /* 0001101100 */
4136 0x1b, 0x00, /* 0001101100 */
4137 0x1b, 0x00, /* 0001101100 */
4138 0xfb, 0xc0, /* 1111101111 */
4139 0xfb, 0xc0, /* 1111101111 */
4140 0x00, 0x00, /* 0000000000 */
4141 0xfb, 0xc0, /* 1111101111 */
4142 0xfb, 0xc0, /* 1111101111 */
4143 0x1b, 0x00, /* 0001101100 */
4144 0x1b, 0x00, /* 0001101100 */
4145 0x1b, 0x00, /* 0001101100 */
4146 0x1b, 0x00, /* 0001101100 */
4147 0x1b, 0x00, /* 0001101100 */
4148 0x1b, 0x00, /* 0001101100 */
4149 0x1b, 0x00, /* 0001101100 */
4150 0x1b, 0x00, /* 0001101100 */
4151
4152 /* 207 0xcf '.' */
4153 0x0c, 0x00, /* 0000110000 */
4154 0x0c, 0x00, /* 0000110000 */
4155 0x0c, 0x00, /* 0000110000 */
4156 0x0c, 0x00, /* 0000110000 */
4157 0x0c, 0x00, /* 0000110000 */
4158 0xff, 0xc0, /* 1111111111 */
4159 0xff, 0xc0, /* 1111111111 */
4160 0x00, 0x00, /* 0000000000 */
4161 0xff, 0xc0, /* 1111111111 */
4162 0xff, 0xc0, /* 1111111111 */
4163 0x00, 0x00, /* 0000000000 */
4164 0x00, 0x00, /* 0000000000 */
4165 0x00, 0x00, /* 0000000000 */
4166 0x00, 0x00, /* 0000000000 */
4167 0x00, 0x00, /* 0000000000 */
4168 0x00, 0x00, /* 0000000000 */
4169 0x00, 0x00, /* 0000000000 */
4170 0x00, 0x00, /* 0000000000 */
4171
4172 /* 208 0xd0 '.' */
4173 0x1b, 0x00, /* 0001101100 */
4174 0x1b, 0x00, /* 0001101100 */
4175 0x1b, 0x00, /* 0001101100 */
4176 0x1b, 0x00, /* 0001101100 */
4177 0x1b, 0x00, /* 0001101100 */
4178 0x1b, 0x00, /* 0001101100 */
4179 0x1b, 0x00, /* 0001101100 */
4180 0x1b, 0x00, /* 0001101100 */
4181 0xff, 0xc0, /* 1111111111 */
4182 0xff, 0xc0, /* 1111111111 */
4183 0x00, 0x00, /* 0000000000 */
4184 0x00, 0x00, /* 0000000000 */
4185 0x00, 0x00, /* 0000000000 */
4186 0x00, 0x00, /* 0000000000 */
4187 0x00, 0x00, /* 0000000000 */
4188 0x00, 0x00, /* 0000000000 */
4189 0x00, 0x00, /* 0000000000 */
4190 0x00, 0x00, /* 0000000000 */
4191
4192 /* 209 0xd1 '.' */
4193 0x00, 0x00, /* 0000000000 */
4194 0x00, 0x00, /* 0000000000 */
4195 0x00, 0x00, /* 0000000000 */
4196 0x00, 0x00, /* 0000000000 */
4197 0x00, 0x00, /* 0000000000 */
4198 0xff, 0xc0, /* 1111111111 */
4199 0xff, 0xc0, /* 1111111111 */
4200 0x00, 0x00, /* 0000000000 */
4201 0xff, 0xc0, /* 1111111111 */
4202 0xff, 0xc0, /* 1111111111 */
4203 0x0c, 0x00, /* 0000110000 */
4204 0x0c, 0x00, /* 0000110000 */
4205 0x0c, 0x00, /* 0000110000 */
4206 0x0c, 0x00, /* 0000110000 */
4207 0x0c, 0x00, /* 0000110000 */
4208 0x0c, 0x00, /* 0000110000 */
4209 0x0c, 0x00, /* 0000110000 */
4210 0x0c, 0x00, /* 0000110000 */
4211
4212 /* 210 0xd2 '.' */
4213 0x00, 0x00, /* 0000000000 */
4214 0x00, 0x00, /* 0000000000 */
4215 0x00, 0x00, /* 0000000000 */
4216 0x00, 0x00, /* 0000000000 */
4217 0x00, 0x00, /* 0000000000 */
4218 0x00, 0x00, /* 0000000000 */
4219 0x00, 0x00, /* 0000000000 */
4220 0x00, 0x00, /* 0000000000 */
4221 0xff, 0xc0, /* 1111111111 */
4222 0xff, 0xc0, /* 1111111111 */
4223 0x1b, 0x00, /* 0001101100 */
4224 0x1b, 0x00, /* 0001101100 */
4225 0x1b, 0x00, /* 0001101100 */
4226 0x1b, 0x00, /* 0001101100 */
4227 0x1b, 0x00, /* 0001101100 */
4228 0x1b, 0x00, /* 0001101100 */
4229 0x1b, 0x00, /* 0001101100 */
4230 0x1b, 0x00, /* 0001101100 */
4231
4232 /* 211 0xd3 '.' */
4233 0x1b, 0x00, /* 0001101100 */
4234 0x1b, 0x00, /* 0001101100 */
4235 0x1b, 0x00, /* 0001101100 */
4236 0x1b, 0x00, /* 0001101100 */
4237 0x1b, 0x00, /* 0001101100 */
4238 0x1b, 0x00, /* 0001101100 */
4239 0x1b, 0x00, /* 0001101100 */
4240 0x1b, 0x00, /* 0001101100 */
4241 0x1f, 0xc0, /* 0001111111 */
4242 0x1f, 0xc0, /* 0001111111 */
4243 0x00, 0x00, /* 0000000000 */
4244 0x00, 0x00, /* 0000000000 */
4245 0x00, 0x00, /* 0000000000 */
4246 0x00, 0x00, /* 0000000000 */
4247 0x00, 0x00, /* 0000000000 */
4248 0x00, 0x00, /* 0000000000 */
4249 0x00, 0x00, /* 0000000000 */
4250 0x00, 0x00, /* 0000000000 */
4251
4252 /* 212 0xd4 '.' */
4253 0x0c, 0x00, /* 0000110000 */
4254 0x0c, 0x00, /* 0000110000 */
4255 0x0c, 0x00, /* 0000110000 */
4256 0x0c, 0x00, /* 0000110000 */
4257 0x0c, 0x00, /* 0000110000 */
4258 0x0f, 0xc0, /* 0000111111 */
4259 0x0f, 0xc0, /* 0000111111 */
4260 0x0c, 0x00, /* 0000110000 */
4261 0x0f, 0xc0, /* 0000111111 */
4262 0x0f, 0xc0, /* 0000111111 */
4263 0x00, 0x00, /* 0000000000 */
4264 0x00, 0x00, /* 0000000000 */
4265 0x00, 0x00, /* 0000000000 */
4266 0x00, 0x00, /* 0000000000 */
4267 0x00, 0x00, /* 0000000000 */
4268 0x00, 0x00, /* 0000000000 */
4269 0x00, 0x00, /* 0000000000 */
4270 0x00, 0x00, /* 0000000000 */
4271
4272 /* 213 0xd5 '.' */
4273 0x00, 0x00, /* 0000000000 */
4274 0x00, 0x00, /* 0000000000 */
4275 0x00, 0x00, /* 0000000000 */
4276 0x00, 0x00, /* 0000000000 */
4277 0x00, 0x00, /* 0000000000 */
4278 0x0f, 0xc0, /* 0000111111 */
4279 0x0f, 0xc0, /* 0000111111 */
4280 0x0c, 0x00, /* 0000110000 */
4281 0x0f, 0xc0, /* 0000111111 */
4282 0x0f, 0xc0, /* 0000111111 */
4283 0x0c, 0x00, /* 0000110000 */
4284 0x0c, 0x00, /* 0000110000 */
4285 0x0c, 0x00, /* 0000110000 */
4286 0x0c, 0x00, /* 0000110000 */
4287 0x0c, 0x00, /* 0000110000 */
4288 0x0c, 0x00, /* 0000110000 */
4289 0x0c, 0x00, /* 0000110000 */
4290 0x0c, 0x00, /* 0000110000 */
4291
4292 /* 214 0xd6 '.' */
4293 0x00, 0x00, /* 0000000000 */
4294 0x00, 0x00, /* 0000000000 */
4295 0x00, 0x00, /* 0000000000 */
4296 0x00, 0x00, /* 0000000000 */
4297 0x00, 0x00, /* 0000000000 */
4298 0x00, 0x00, /* 0000000000 */
4299 0x00, 0x00, /* 0000000000 */
4300 0x00, 0x00, /* 0000000000 */
4301 0x1f, 0xc0, /* 0001111111 */
4302 0x1f, 0xc0, /* 0001111111 */
4303 0x1b, 0x00, /* 0001101100 */
4304 0x1b, 0x00, /* 0001101100 */
4305 0x1b, 0x00, /* 0001101100 */
4306 0x1b, 0x00, /* 0001101100 */
4307 0x1b, 0x00, /* 0001101100 */
4308 0x1b, 0x00, /* 0001101100 */
4309 0x1b, 0x00, /* 0001101100 */
4310 0x1b, 0x00, /* 0001101100 */
4311
4312 /* 215 0xd7 '.' */
4313 0x1b, 0x00, /* 0001101100 */
4314 0x1b, 0x00, /* 0001101100 */
4315 0x1b, 0x00, /* 0001101100 */
4316 0x1b, 0x00, /* 0001101100 */
4317 0x1b, 0x00, /* 0001101100 */
4318 0x1b, 0x00, /* 0001101100 */
4319 0x1b, 0x00, /* 0001101100 */
4320 0x1b, 0x00, /* 0001101100 */
4321 0xff, 0xc0, /* 1111111111 */
4322 0xff, 0xc0, /* 1111111111 */
4323 0x1b, 0x00, /* 0001101100 */
4324 0x1b, 0x00, /* 0001101100 */
4325 0x1b, 0x00, /* 0001101100 */
4326 0x1b, 0x00, /* 0001101100 */
4327 0x1b, 0x00, /* 0001101100 */
4328 0x1b, 0x00, /* 0001101100 */
4329 0x1b, 0x00, /* 0001101100 */
4330 0x1b, 0x00, /* 0001101100 */
4331
4332 /* 216 0xd8 '.' */
4333 0x0c, 0x00, /* 0000110000 */
4334 0x0c, 0x00, /* 0000110000 */
4335 0x0c, 0x00, /* 0000110000 */
4336 0x0c, 0x00, /* 0000110000 */
4337 0x0c, 0x00, /* 0000110000 */
4338 0xff, 0xc0, /* 1111111111 */
4339 0xff, 0xc0, /* 1111111111 */
4340 0x0c, 0x00, /* 0000110000 */
4341 0xff, 0xc0, /* 1111111111 */
4342 0xff, 0xc0, /* 1111111111 */
4343 0x0c, 0x00, /* 0000110000 */
4344 0x0c, 0x00, /* 0000110000 */
4345 0x0c, 0x00, /* 0000110000 */
4346 0x0c, 0x00, /* 0000110000 */
4347 0x0c, 0x00, /* 0000110000 */
4348 0x0c, 0x00, /* 0000110000 */
4349 0x0c, 0x00, /* 0000110000 */
4350 0x0c, 0x00, /* 0000110000 */
4351
4352 /* 217 0xd9 '.' */
4353 0x0c, 0x00, /* 0000110000 */
4354 0x0c, 0x00, /* 0000110000 */
4355 0x0c, 0x00, /* 0000110000 */
4356 0x0c, 0x00, /* 0000110000 */
4357 0x0c, 0x00, /* 0000110000 */
4358 0x0c, 0x00, /* 0000110000 */
4359 0x0c, 0x00, /* 0000110000 */
4360 0x0c, 0x00, /* 0000110000 */
4361 0xfc, 0x00, /* 1111110000 */
4362 0xfc, 0x00, /* 1111110000 */
4363 0x00, 0x00, /* 0000000000 */
4364 0x00, 0x00, /* 0000000000 */
4365 0x00, 0x00, /* 0000000000 */
4366 0x00, 0x00, /* 0000000000 */
4367 0x00, 0x00, /* 0000000000 */
4368 0x00, 0x00, /* 0000000000 */
4369 0x00, 0x00, /* 0000000000 */
4370 0x00, 0x00, /* 0000000000 */
4371
4372 /* 218 0xda '.' */
4373 0x00, 0x00, /* 0000000000 */
4374 0x00, 0x00, /* 0000000000 */
4375 0x00, 0x00, /* 0000000000 */
4376 0x00, 0x00, /* 0000000000 */
4377 0x00, 0x00, /* 0000000000 */
4378 0x00, 0x00, /* 0000000000 */
4379 0x00, 0x00, /* 0000000000 */
4380 0x00, 0x00, /* 0000000000 */
4381 0x0f, 0xc0, /* 0000111111 */
4382 0x0f, 0xc0, /* 0000111111 */
4383 0x0c, 0x00, /* 0000110000 */
4384 0x0c, 0x00, /* 0000110000 */
4385 0x0c, 0x00, /* 0000110000 */
4386 0x0c, 0x00, /* 0000110000 */
4387 0x0c, 0x00, /* 0000110000 */
4388 0x0c, 0x00, /* 0000110000 */
4389 0x0c, 0x00, /* 0000110000 */
4390 0x0c, 0x00, /* 0000110000 */
4391
4392 /* 219 0xdb '.' */
4393 0xff, 0xc0, /* 1111111111 */
4394 0xff, 0xc0, /* 1111111111 */
4395 0xff, 0xc0, /* 1111111111 */
4396 0xff, 0xc0, /* 1111111111 */
4397 0xff, 0xc0, /* 1111111111 */
4398 0xff, 0xc0, /* 1111111111 */
4399 0xff, 0xc0, /* 1111111111 */
4400 0xff, 0xc0, /* 1111111111 */
4401 0xff, 0xc0, /* 1111111111 */
4402 0xff, 0xc0, /* 1111111111 */
4403 0xff, 0xc0, /* 1111111111 */
4404 0xff, 0xc0, /* 1111111111 */
4405 0xff, 0xc0, /* 1111111111 */
4406 0xff, 0xc0, /* 1111111111 */
4407 0xff, 0xc0, /* 1111111111 */
4408 0xff, 0xc0, /* 1111111111 */
4409 0xff, 0xc0, /* 1111111111 */
4410 0xff, 0xc0, /* 1111111111 */
4411
4412 /* 220 0xdc '.' */
4413 0x00, 0x00, /* 0000000000 */
4414 0x00, 0x00, /* 0000000000 */
4415 0x00, 0x00, /* 0000000000 */
4416 0x00, 0x00, /* 0000000000 */
4417 0x00, 0x00, /* 0000000000 */
4418 0x00, 0x00, /* 0000000000 */
4419 0x00, 0x00, /* 0000000000 */
4420 0x00, 0x00, /* 0000000000 */
4421 0xff, 0xc0, /* 1111111111 */
4422 0xff, 0xc0, /* 1111111111 */
4423 0xff, 0xc0, /* 1111111111 */
4424 0xff, 0xc0, /* 1111111111 */
4425 0xff, 0xc0, /* 1111111111 */
4426 0xff, 0xc0, /* 1111111111 */
4427 0xff, 0xc0, /* 1111111111 */
4428 0xff, 0xc0, /* 1111111111 */
4429 0xff, 0xc0, /* 1111111111 */
4430 0xff, 0xc0, /* 1111111111 */
4431
4432 /* 221 0xdd '.' */
4433 0xf8, 0x00, /* 1111100000 */
4434 0xf8, 0x00, /* 1111100000 */
4435 0xf8, 0x00, /* 1111100000 */
4436 0xf8, 0x00, /* 1111100000 */
4437 0xf8, 0x00, /* 1111100000 */
4438 0xf8, 0x00, /* 1111100000 */
4439 0xf8, 0x00, /* 1111100000 */
4440 0xf8, 0x00, /* 1111100000 */
4441 0xf8, 0x00, /* 1111100000 */
4442 0xf8, 0x00, /* 1111100000 */
4443 0xf8, 0x00, /* 1111100000 */
4444 0xf8, 0x00, /* 1111100000 */
4445 0xf8, 0x00, /* 1111100000 */
4446 0xf8, 0x00, /* 1111100000 */
4447 0xf8, 0x00, /* 1111100000 */
4448 0xf8, 0x00, /* 1111100000 */
4449 0xf8, 0x00, /* 1111100000 */
4450 0xf8, 0x00, /* 1111100000 */
4451
4452 /* 222 0xde '.' */
4453 0x07, 0xc0, /* 0000011111 */
4454 0x07, 0xc0, /* 0000011111 */
4455 0x07, 0xc0, /* 0000011111 */
4456 0x07, 0xc0, /* 0000011111 */
4457 0x07, 0xc0, /* 0000011111 */
4458 0x07, 0xc0, /* 0000011111 */
4459 0x07, 0xc0, /* 0000011111 */
4460 0x07, 0xc0, /* 0000011111 */
4461 0x07, 0xc0, /* 0000011111 */
4462 0x07, 0xc0, /* 0000011111 */
4463 0x07, 0xc0, /* 0000011111 */
4464 0x07, 0xc0, /* 0000011111 */
4465 0x07, 0xc0, /* 0000011111 */
4466 0x07, 0xc0, /* 0000011111 */
4467 0x07, 0xc0, /* 0000011111 */
4468 0x07, 0xc0, /* 0000011111 */
4469 0x07, 0xc0, /* 0000011111 */
4470 0x07, 0xc0, /* 0000011111 */
4471
4472 /* 223 0xdf '.' */
4473 0xff, 0xc0, /* 1111111111 */
4474 0xff, 0xc0, /* 1111111111 */
4475 0xff, 0xc0, /* 1111111111 */
4476 0xff, 0xc0, /* 1111111111 */
4477 0xff, 0xc0, /* 1111111111 */
4478 0xff, 0xc0, /* 1111111111 */
4479 0xff, 0xc0, /* 1111111111 */
4480 0xff, 0xc0, /* 1111111111 */
4481 0x00, 0x00, /* 0000000000 */
4482 0x00, 0x00, /* 0000000000 */
4483 0x00, 0x00, /* 0000000000 */
4484 0x00, 0x00, /* 0000000000 */
4485 0x00, 0x00, /* 0000000000 */
4486 0x00, 0x00, /* 0000000000 */
4487 0x00, 0x00, /* 0000000000 */
4488 0x00, 0x00, /* 0000000000 */
4489 0x00, 0x00, /* 0000000000 */
4490 0x00, 0x00, /* 0000000000 */
4491
4492 /* 224 0xe0 '.' */
4493 0x00, 0x00, /* 0000000000 */
4494 0x00, 0x00, /* 0000000000 */
4495 0x00, 0x00, /* 0000000000 */
4496 0x00, 0x00, /* 0000000000 */
4497 0x00, 0x00, /* 0000000000 */
4498 0x1c, 0x80, /* 0001110010 */
4499 0x35, 0x80, /* 0011010110 */
4500 0x63, 0x00, /* 0110001100 */
4501 0x63, 0x00, /* 0110001100 */
4502 0x63, 0x00, /* 0110001100 */
4503 0x63, 0x00, /* 0110001100 */
4504 0x63, 0x00, /* 0110001100 */
4505 0x63, 0x00, /* 0110001100 */
4506 0x37, 0x80, /* 0011011110 */
4507 0x1c, 0x80, /* 0001110010 */
4508 0x00, 0x00, /* 0000000000 */
4509 0x00, 0x00, /* 0000000000 */
4510 0x00, 0x00, /* 0000000000 */
4511
4512 /* 225 0xe1 '.' */
4513 0x00, 0x00, /* 0000000000 */
4514 0x1e, 0x00, /* 0001111000 */
4515 0x33, 0x00, /* 0011001100 */
4516 0x61, 0x80, /* 0110000110 */
4517 0x61, 0x80, /* 0110000110 */
4518 0x61, 0x80, /* 0110000110 */
4519 0x63, 0x00, /* 0110001100 */
4520 0x6f, 0x00, /* 0110111100 */
4521 0x63, 0x00, /* 0110001100 */
4522 0x61, 0x80, /* 0110000110 */
4523 0x61, 0x80, /* 0110000110 */
4524 0x61, 0x80, /* 0110000110 */
4525 0x61, 0x80, /* 0110000110 */
4526 0x63, 0x00, /* 0110001100 */
4527 0x6e, 0x00, /* 0110111000 */
4528 0x00, 0x00, /* 0000000000 */
4529 0x00, 0x00, /* 0000000000 */
4530 0x00, 0x00, /* 0000000000 */
4531
4532 /* 226 0xe2 '.' */
4533 0x00, 0x00, /* 0000000000 */
4534 0x7f, 0x80, /* 0111111110 */
4535 0x61, 0x80, /* 0110000110 */
4536 0x61, 0x80, /* 0110000110 */
4537 0x60, 0x00, /* 0110000000 */
4538 0x60, 0x00, /* 0110000000 */
4539 0x60, 0x00, /* 0110000000 */
4540 0x60, 0x00, /* 0110000000 */
4541 0x60, 0x00, /* 0110000000 */
4542 0x60, 0x00, /* 0110000000 */
4543 0x60, 0x00, /* 0110000000 */
4544 0x60, 0x00, /* 0110000000 */
4545 0x60, 0x00, /* 0110000000 */
4546 0x60, 0x00, /* 0110000000 */
4547 0x60, 0x00, /* 0110000000 */
4548 0x00, 0x00, /* 0000000000 */
4549 0x00, 0x00, /* 0000000000 */
4550 0x00, 0x00, /* 0000000000 */
4551
4552 /* 227 0xe3 '.' */
4553 0x00, 0x00, /* 0000000000 */
4554 0x00, 0x00, /* 0000000000 */
4555 0x00, 0x00, /* 0000000000 */
4556 0x00, 0x00, /* 0000000000 */
4557 0x00, 0x00, /* 0000000000 */
4558 0x00, 0x00, /* 0000000000 */
4559 0x7f, 0x80, /* 0111111110 */
4560 0x33, 0x00, /* 0011001100 */
4561 0x33, 0x00, /* 0011001100 */
4562 0x33, 0x00, /* 0011001100 */
4563 0x33, 0x00, /* 0011001100 */
4564 0x33, 0x00, /* 0011001100 */
4565 0x33, 0x00, /* 0011001100 */
4566 0x33, 0x00, /* 0011001100 */
4567 0x33, 0x00, /* 0011001100 */
4568 0x00, 0x00, /* 0000000000 */
4569 0x00, 0x00, /* 0000000000 */
4570 0x00, 0x00, /* 0000000000 */
4571
4572 /* 228 0xe4 '.' */
4573 0x00, 0x00, /* 0000000000 */
4574 0x00, 0x00, /* 0000000000 */
4575 0xff, 0x80, /* 1111111110 */
4576 0x60, 0x00, /* 0110000000 */
4577 0x30, 0x00, /* 0011000000 */
4578 0x30, 0x00, /* 0011000000 */
4579 0x18, 0x00, /* 0001100000 */
4580 0x18, 0x00, /* 0001100000 */
4581 0x0c, 0x00, /* 0000110000 */
4582 0x0c, 0x00, /* 0000110000 */
4583 0x18, 0x00, /* 0001100000 */
4584 0x30, 0x00, /* 0011000000 */
4585 0x30, 0x80, /* 0011000010 */
4586 0x61, 0x80, /* 0110000110 */
4587 0xff, 0x80, /* 1111111110 */
4588 0x00, 0x00, /* 0000000000 */
4589 0x00, 0x00, /* 0000000000 */
4590 0x00, 0x00, /* 0000000000 */
4591
4592 /* 229 0xe5 '.' */
4593 0x00, 0x00, /* 0000000000 */
4594 0x00, 0x00, /* 0000000000 */
4595 0x00, 0x00, /* 0000000000 */
4596 0x00, 0x00, /* 0000000000 */
4597 0x00, 0x00, /* 0000000000 */
4598 0x00, 0x00, /* 0000000000 */
4599 0x00, 0x00, /* 0000000000 */
4600 0x1f, 0xc0, /* 0001111111 */
4601 0x36, 0x00, /* 0011011000 */
4602 0x63, 0x00, /* 0110001100 */
4603 0x61, 0x80, /* 0110000110 */
4604 0x61, 0x80, /* 0110000110 */
4605 0x61, 0x80, /* 0110000110 */
4606 0x33, 0x00, /* 0011001100 */
4607 0x3e, 0x00, /* 0011111000 */
4608 0x00, 0x00, /* 0000000000 */
4609 0x00, 0x00, /* 0000000000 */
4610 0x00, 0x00, /* 0000000000 */
4611
4612 /* 230 0xe6 '.' */
4613 0x00, 0x00, /* 0000000000 */
4614 0x00, 0x00, /* 0000000000 */
4615 0x00, 0x00, /* 0000000000 */
4616 0x61, 0x80, /* 0110000110 */
4617 0x61, 0x80, /* 0110000110 */
4618 0x61, 0x80, /* 0110000110 */
4619 0x61, 0x80, /* 0110000110 */
4620 0x61, 0x80, /* 0110000110 */
4621 0x61, 0x80, /* 0110000110 */
4622 0x61, 0x80, /* 0110000110 */
4623 0x61, 0x80, /* 0110000110 */
4624 0x73, 0x80, /* 0111001110 */
4625 0x6d, 0x80, /* 0110110110 */
4626 0x60, 0x00, /* 0110000000 */
4627 0x60, 0x00, /* 0110000000 */
4628 0x60, 0x00, /* 0110000000 */
4629 0x60, 0x00, /* 0110000000 */
4630 0xc0, 0x00, /* 1100000000 */
4631
4632 /* 231 0xe7 '.' */
4633 0x00, 0x00, /* 0000000000 */
4634 0x00, 0x00, /* 0000000000 */
4635 0x00, 0x00, /* 0000000000 */
4636 0x01, 0x80, /* 0000000110 */
4637 0x36, 0x40, /* 0011011001 */
4638 0x5e, 0x00, /* 0101111000 */
4639 0x8c, 0x00, /* 1000110000 */
4640 0x0c, 0x00, /* 0000110000 */
4641 0x0c, 0x00, /* 0000110000 */
4642 0x0c, 0x00, /* 0000110000 */
4643 0x0c, 0x00, /* 0000110000 */
4644 0x0c, 0x00, /* 0000110000 */
4645 0x0c, 0x00, /* 0000110000 */
4646 0x0c, 0x00, /* 0000110000 */
4647 0x0c, 0x00, /* 0000110000 */
4648 0x00, 0x00, /* 0000000000 */
4649 0x00, 0x00, /* 0000000000 */
4650 0x00, 0x00, /* 0000000000 */
4651
4652 /* 232 0xe8 '.' */
4653 0x00, 0x00, /* 0000000000 */
4654 0x00, 0x00, /* 0000000000 */
4655 0x7f, 0x80, /* 0111111110 */
4656 0x0c, 0x00, /* 0000110000 */
4657 0x0c, 0x00, /* 0000110000 */
4658 0x1e, 0x00, /* 0001111000 */
4659 0x33, 0x00, /* 0011001100 */
4660 0x61, 0x80, /* 0110000110 */
4661 0x61, 0x80, /* 0110000110 */
4662 0x61, 0x80, /* 0110000110 */
4663 0x33, 0x00, /* 0011001100 */
4664 0x1e, 0x00, /* 0001111000 */
4665 0x0c, 0x00, /* 0000110000 */
4666 0x0c, 0x00, /* 0000110000 */
4667 0x7f, 0x80, /* 0111111110 */
4668 0x00, 0x00, /* 0000000000 */
4669 0x00, 0x00, /* 0000000000 */
4670 0x00, 0x00, /* 0000000000 */
4671
4672 /* 233 0xe9 '.' */
4673 0x00, 0x00, /* 0000000000 */
4674 0x00, 0x00, /* 0000000000 */
4675 0x00, 0x00, /* 0000000000 */
4676 0x0e, 0x00, /* 0000111000 */
4677 0x1f, 0x00, /* 0001111100 */
4678 0x31, 0x80, /* 0011000110 */
4679 0x31, 0x80, /* 0011000110 */
4680 0x60, 0xc0, /* 0110000011 */
4681 0x7f, 0xc0, /* 0111111111 */
4682 0x7f, 0xc0, /* 0111111111 */
4683 0x60, 0xc0, /* 0110000011 */
4684 0x31, 0x80, /* 0011000110 */
4685 0x31, 0x80, /* 0011000110 */
4686 0x1f, 0x00, /* 0001111100 */
4687 0x0e, 0x00, /* 0000111000 */
4688 0x00, 0x00, /* 0000000000 */
4689 0x00, 0x00, /* 0000000000 */
4690 0x00, 0x00, /* 0000000000 */
4691
4692 /* 234 0xea '.' */
4693 0x00, 0x00, /* 0000000000 */
4694 0x00, 0x00, /* 0000000000 */
4695 0x00, 0x00, /* 0000000000 */
4696 0x00, 0x00, /* 0000000000 */
4697 0x1e, 0x00, /* 0001111000 */
4698 0x33, 0x00, /* 0011001100 */
4699 0x61, 0x80, /* 0110000110 */
4700 0xc0, 0xc0, /* 1100000011 */
4701 0xc0, 0xc0, /* 1100000011 */
4702 0xc0, 0xc0, /* 1100000011 */
4703 0x61, 0x80, /* 0110000110 */
4704 0x33, 0x00, /* 0011001100 */
4705 0x33, 0x00, /* 0011001100 */
4706 0x33, 0x00, /* 0011001100 */
4707 0x33, 0x00, /* 0011001100 */
4708 0xf3, 0xc0, /* 1111001111 */
4709 0x00, 0x00, /* 0000000000 */
4710 0x00, 0x00, /* 0000000000 */
4711
4712 /* 235 0xeb '.' */
4713 0x00, 0x00, /* 0000000000 */
4714 0x07, 0x00, /* 0000011100 */
4715 0x1f, 0x80, /* 0001111110 */
4716 0x30, 0xc0, /* 0011000011 */
4717 0x30, 0x00, /* 0011000000 */
4718 0x18, 0x00, /* 0001100000 */
4719 0x0c, 0x00, /* 0000110000 */
4720 0x0c, 0x00, /* 0000110000 */
4721 0x3e, 0x00, /* 0011111000 */
4722 0x66, 0x00, /* 0110011000 */
4723 0xc3, 0x00, /* 1100001100 */
4724 0xc3, 0x00, /* 1100001100 */
4725 0xc3, 0x00, /* 1100001100 */
4726 0x66, 0x00, /* 0110011000 */
4727 0x3c, 0x00, /* 0011110000 */
4728 0x18, 0x00, /* 0001100000 */
4729 0x00, 0x00, /* 0000000000 */
4730 0x00, 0x00, /* 0000000000 */
4731
4732 /* 236 0xec '.' */
4733 0x00, 0x00, /* 0000000000 */
4734 0x00, 0x00, /* 0000000000 */
4735 0x00, 0x00, /* 0000000000 */
4736 0x00, 0x00, /* 0000000000 */
4737 0x00, 0x00, /* 0000000000 */
4738 0x33, 0x00, /* 0011001100 */
4739 0x6d, 0x80, /* 0110110110 */
4740 0xcc, 0xc0, /* 1100110011 */
4741 0xcc, 0xc0, /* 1100110011 */
4742 0xcc, 0xc0, /* 1100110011 */
4743 0xcc, 0xc0, /* 1100110011 */
4744 0x6d, 0x80, /* 0110110110 */
4745 0x33, 0x00, /* 0011001100 */
4746 0x00, 0x00, /* 0000000000 */
4747 0x00, 0x00, /* 0000000000 */
4748 0x00, 0x00, /* 0000000000 */
4749 0x00, 0x00, /* 0000000000 */
4750 0x00, 0x00, /* 0000000000 */
4751
4752 /* 237 0xed '.' */
4753 0x00, 0x00, /* 0000000000 */
4754 0x01, 0x80, /* 0000000110 */
4755 0x01, 0x80, /* 0000000110 */
4756 0x03, 0x00, /* 0000001100 */
4757 0x03, 0x00, /* 0000001100 */
4758 0x37, 0x00, /* 0011011100 */
4759 0x6d, 0x80, /* 0110110110 */
4760 0xcc, 0xc0, /* 1100110011 */
4761 0xcc, 0xc0, /* 1100110011 */
4762 0xcc, 0xc0, /* 1100110011 */
4763 0xcc, 0xc0, /* 1100110011 */
4764 0x6d, 0x80, /* 0110110110 */
4765 0x3b, 0x00, /* 0011101100 */
4766 0x30, 0x00, /* 0011000000 */
4767 0x30, 0x00, /* 0011000000 */
4768 0x60, 0x00, /* 0110000000 */
4769 0x60, 0x00, /* 0110000000 */
4770 0x00, 0x00, /* 0000000000 */
4771
4772 /* 238 0xee '.' */
4773 0x00, 0x00, /* 0000000000 */
4774 0x03, 0x80, /* 0000001110 */
4775 0x0e, 0x00, /* 0000111000 */
4776 0x18, 0x00, /* 0001100000 */
4777 0x18, 0x00, /* 0001100000 */
4778 0x30, 0x00, /* 0011000000 */
4779 0x30, 0x00, /* 0011000000 */
4780 0x3f, 0x80, /* 0011111110 */
4781 0x3f, 0x80, /* 0011111110 */
4782 0x30, 0x00, /* 0011000000 */
4783 0x30, 0x00, /* 0011000000 */
4784 0x18, 0x00, /* 0001100000 */
4785 0x18, 0x00, /* 0001100000 */
4786 0x0e, 0x00, /* 0000111000 */
4787 0x03, 0x80, /* 0000001110 */
4788 0x00, 0x00, /* 0000000000 */
4789 0x00, 0x00, /* 0000000000 */
4790 0x00, 0x00, /* 0000000000 */
4791
4792 /* 239 0xef '.' */
4793 0x00, 0x00, /* 0000000000 */
4794 0x00, 0x00, /* 0000000000 */
4795 0x00, 0x00, /* 0000000000 */
4796 0x00, 0x00, /* 0000000000 */
4797 0x1e, 0x00, /* 0001111000 */
4798 0x33, 0x00, /* 0011001100 */
4799 0x61, 0x80, /* 0110000110 */
4800 0x61, 0x80, /* 0110000110 */
4801 0x61, 0x80, /* 0110000110 */
4802 0x61, 0x80, /* 0110000110 */
4803 0x61, 0x80, /* 0110000110 */
4804 0x61, 0x80, /* 0110000110 */
4805 0x61, 0x80, /* 0110000110 */
4806 0x61, 0x80, /* 0110000110 */
4807 0x61, 0x80, /* 0110000110 */
4808 0x00, 0x00, /* 0000000000 */
4809 0x00, 0x00, /* 0000000000 */
4810 0x00, 0x00, /* 0000000000 */
4811
4812 /* 240 0xf0 '.' */
4813 0x00, 0x00, /* 0000000000 */
4814 0x00, 0x00, /* 0000000000 */
4815 0x00, 0x00, /* 0000000000 */
4816 0x00, 0x00, /* 0000000000 */
4817 0x00, 0x00, /* 0000000000 */
4818 0x7f, 0x80, /* 0111111110 */
4819 0x7f, 0x80, /* 0111111110 */
4820 0x00, 0x00, /* 0000000000 */
4821 0x00, 0x00, /* 0000000000 */
4822 0x7f, 0x80, /* 0111111110 */
4823 0x7f, 0x80, /* 0111111110 */
4824 0x00, 0x00, /* 0000000000 */
4825 0x00, 0x00, /* 0000000000 */
4826 0x7f, 0x80, /* 0111111110 */
4827 0x7f, 0x80, /* 0111111110 */
4828 0x00, 0x00, /* 0000000000 */
4829 0x00, 0x00, /* 0000000000 */
4830 0x00, 0x00, /* 0000000000 */
4831
4832 /* 241 0xf1 '.' */
4833 0x00, 0x00, /* 0000000000 */
4834 0x00, 0x00, /* 0000000000 */
4835 0x0c, 0x00, /* 0000110000 */
4836 0x0c, 0x00, /* 0000110000 */
4837 0x0c, 0x00, /* 0000110000 */
4838 0x0c, 0x00, /* 0000110000 */
4839 0x7f, 0x80, /* 0111111110 */
4840 0x7f, 0x80, /* 0111111110 */
4841 0x0c, 0x00, /* 0000110000 */
4842 0x0c, 0x00, /* 0000110000 */
4843 0x0c, 0x00, /* 0000110000 */
4844 0x0c, 0x00, /* 0000110000 */
4845 0x00, 0x00, /* 0000000000 */
4846 0x7f, 0x80, /* 0111111110 */
4847 0x7f, 0x80, /* 0111111110 */
4848 0x00, 0x00, /* 0000000000 */
4849 0x00, 0x00, /* 0000000000 */
4850 0x00, 0x00, /* 0000000000 */
4851
4852 /* 242 0xf2 '.' */
4853 0x00, 0x00, /* 0000000000 */
4854 0x00, 0x00, /* 0000000000 */
4855 0x00, 0x00, /* 0000000000 */
4856 0x00, 0x00, /* 0000000000 */
4857 0x00, 0x00, /* 0000000000 */
4858 0xe0, 0x00, /* 1110000000 */
4859 0x38, 0x00, /* 0011100000 */
4860 0x0e, 0x00, /* 0000111000 */
4861 0x03, 0x80, /* 0000001110 */
4862 0x0e, 0x00, /* 0000111000 */
4863 0x38, 0x00, /* 0011100000 */
4864 0xe0, 0x00, /* 1110000000 */
4865 0x00, 0x00, /* 0000000000 */
4866 0xff, 0x00, /* 1111111100 */
4867 0xff, 0x00, /* 1111111100 */
4868 0x00, 0x00, /* 0000000000 */
4869 0x00, 0x00, /* 0000000000 */
4870 0x00, 0x00, /* 0000000000 */
4871
4872 /* 243 0xf3 '.' */
4873 0x00, 0x00, /* 0000000000 */
4874 0x00, 0x00, /* 0000000000 */
4875 0x00, 0x00, /* 0000000000 */
4876 0x00, 0x00, /* 0000000000 */
4877 0x00, 0x00, /* 0000000000 */
4878 0x03, 0x80, /* 0000001110 */
4879 0x0e, 0x00, /* 0000111000 */
4880 0x38, 0x00, /* 0011100000 */
4881 0xe0, 0x00, /* 1110000000 */
4882 0x38, 0x00, /* 0011100000 */
4883 0x0e, 0x00, /* 0000111000 */
4884 0x03, 0x80, /* 0000001110 */
4885 0x00, 0x00, /* 0000000000 */
4886 0xff, 0x80, /* 1111111110 */
4887 0xff, 0x80, /* 1111111110 */
4888 0x00, 0x00, /* 0000000000 */
4889 0x00, 0x00, /* 0000000000 */
4890 0x00, 0x00, /* 0000000000 */
4891
4892 /* 244 0xf4 '.' */
4893 0x00, 0x00, /* 0000000000 */
4894 0x00, 0x00, /* 0000000000 */
4895 0x1e, 0x00, /* 0001111000 */
4896 0x33, 0x00, /* 0011001100 */
4897 0x33, 0x00, /* 0011001100 */
4898 0x30, 0x00, /* 0011000000 */
4899 0x30, 0x00, /* 0011000000 */
4900 0x30, 0x00, /* 0011000000 */
4901 0x30, 0x00, /* 0011000000 */
4902 0x30, 0x00, /* 0011000000 */
4903 0x30, 0x00, /* 0011000000 */
4904 0x30, 0x00, /* 0011000000 */
4905 0x30, 0x00, /* 0011000000 */
4906 0x30, 0x00, /* 0011000000 */
4907 0x30, 0x00, /* 0011000000 */
4908 0x30, 0x00, /* 0011000000 */
4909 0x30, 0x00, /* 0011000000 */
4910 0x00, 0x00, /* 0000000000 */
4911
4912 /* 245 0xf5 '.' */
4913 0x00, 0x00, /* 0000000000 */
4914 0x00, 0x00, /* 0000000000 */
4915 0x1e, 0x00, /* 0001111000 */
4916 0x33, 0x00, /* 0011001100 */
4917 0x33, 0x00, /* 0011001100 */
4918 0x03, 0x00, /* 0000001100 */
4919 0x03, 0x00, /* 0000001100 */
4920 0x03, 0x00, /* 0000001100 */
4921 0x03, 0x00, /* 0000001100 */
4922 0x03, 0x00, /* 0000001100 */
4923 0x03, 0x00, /* 0000001100 */
4924 0x03, 0x00, /* 0000001100 */
4925 0x03, 0x00, /* 0000001100 */
4926 0x03, 0x00, /* 0000001100 */
4927 0x03, 0x00, /* 0000001100 */
4928 0x03, 0x00, /* 0000001100 */
4929 0x03, 0x00, /* 0000001100 */
4930 0x00, 0x00, /* 0000000000 */
4931
4932 /* 246 0xf6 '.' */
4933 0x00, 0x00, /* 0000000000 */
4934 0x00, 0x00, /* 0000000000 */
4935 0x00, 0x00, /* 0000000000 */
4936 0x00, 0x00, /* 0000000000 */
4937 0x00, 0x00, /* 0000000000 */
4938 0x0c, 0x00, /* 0000110000 */
4939 0x0c, 0x00, /* 0000110000 */
4940 0x00, 0x00, /* 0000000000 */
4941 0x00, 0x00, /* 0000000000 */
4942 0x7f, 0x80, /* 0111111110 */
4943 0x7f, 0x80, /* 0111111110 */
4944 0x00, 0x00, /* 0000000000 */
4945 0x00, 0x00, /* 0000000000 */
4946 0x0c, 0x00, /* 0000110000 */
4947 0x0c, 0x00, /* 0000110000 */
4948 0x00, 0x00, /* 0000000000 */
4949 0x00, 0x00, /* 0000000000 */
4950 0x00, 0x00, /* 0000000000 */
4951
4952 /* 247 0xf7 '.' */
4953 0x00, 0x00, /* 0000000000 */
4954 0x00, 0x00, /* 0000000000 */
4955 0x00, 0x00, /* 0000000000 */
4956 0x00, 0x00, /* 0000000000 */
4957 0x00, 0x00, /* 0000000000 */
4958 0x00, 0x00, /* 0000000000 */
4959 0x38, 0x00, /* 0011100000 */
4960 0x6c, 0x00, /* 0110110000 */
4961 0x06, 0xc0, /* 0000011011 */
4962 0x03, 0x80, /* 0000001110 */
4963 0x38, 0x00, /* 0011100000 */
4964 0x6c, 0x00, /* 0110110000 */
4965 0x06, 0xc0, /* 0000011011 */
4966 0x03, 0x80, /* 0000001110 */
4967 0x00, 0x00, /* 0000000000 */
4968 0x00, 0x00, /* 0000000000 */
4969 0x00, 0x00, /* 0000000000 */
4970 0x00, 0x00, /* 0000000000 */
4971
4972 /* 248 0xf8 '.' */
4973 0x00, 0x00, /* 0000000000 */
4974 0x1e, 0x00, /* 0001111000 */
4975 0x33, 0x00, /* 0011001100 */
4976 0x33, 0x00, /* 0011001100 */
4977 0x1e, 0x00, /* 0001111000 */
4978 0x00, 0x00, /* 0000000000 */
4979 0x00, 0x00, /* 0000000000 */
4980 0x00, 0x00, /* 0000000000 */
4981 0x00, 0x00, /* 0000000000 */
4982 0x00, 0x00, /* 0000000000 */
4983 0x00, 0x00, /* 0000000000 */
4984 0x00, 0x00, /* 0000000000 */
4985 0x00, 0x00, /* 0000000000 */
4986 0x00, 0x00, /* 0000000000 */
4987 0x00, 0x00, /* 0000000000 */
4988 0x00, 0x00, /* 0000000000 */
4989 0x00, 0x00, /* 0000000000 */
4990 0x00, 0x00, /* 0000000000 */
4991
4992 /* 249 0xf9 '.' */
4993 0x00, 0x00, /* 0000000000 */
4994 0x00, 0x00, /* 0000000000 */
4995 0x00, 0x00, /* 0000000000 */
4996 0x00, 0x00, /* 0000000000 */
4997 0x00, 0x00, /* 0000000000 */
4998 0x00, 0x00, /* 0000000000 */
4999 0x00, 0x00, /* 0000000000 */
5000 0x00, 0x00, /* 0000000000 */
5001 0x0c, 0x00, /* 0000110000 */
5002 0x1e, 0x00, /* 0001111000 */
5003 0x1e, 0x00, /* 0001111000 */
5004 0x0c, 0x00, /* 0000110000 */
5005 0x00, 0x00, /* 0000000000 */
5006 0x00, 0x00, /* 0000000000 */
5007 0x00, 0x00, /* 0000000000 */
5008 0x00, 0x00, /* 0000000000 */
5009 0x00, 0x00, /* 0000000000 */
5010 0x00, 0x00, /* 0000000000 */
5011
5012 /* 250 0xfa '.' */
5013 0x00, 0x00, /* 0000000000 */
5014 0x00, 0x00, /* 0000000000 */
5015 0x00, 0x00, /* 0000000000 */
5016 0x00, 0x00, /* 0000000000 */
5017 0x00, 0x00, /* 0000000000 */
5018 0x00, 0x00, /* 0000000000 */
5019 0x00, 0x00, /* 0000000000 */
5020 0x00, 0x00, /* 0000000000 */
5021 0x00, 0x00, /* 0000000000 */
5022 0x0c, 0x00, /* 0000110000 */
5023 0x0c, 0x00, /* 0000110000 */
5024 0x00, 0x00, /* 0000000000 */
5025 0x00, 0x00, /* 0000000000 */
5026 0x00, 0x00, /* 0000000000 */
5027 0x00, 0x00, /* 0000000000 */
5028 0x00, 0x00, /* 0000000000 */
5029 0x00, 0x00, /* 0000000000 */
5030 0x00, 0x00, /* 0000000000 */
5031
5032 /* 251 0xfb '.' */
5033 0x00, 0x00, /* 0000000000 */
5034 0x00, 0x00, /* 0000000000 */
5035 0x0f, 0xc0, /* 0000111111 */
5036 0x0f, 0xc0, /* 0000111111 */
5037 0x0c, 0x00, /* 0000110000 */
5038 0x0c, 0x00, /* 0000110000 */
5039 0x0c, 0x00, /* 0000110000 */
5040 0x0c, 0x00, /* 0000110000 */
5041 0x0c, 0x00, /* 0000110000 */
5042 0x0c, 0x00, /* 0000110000 */
5043 0xcc, 0x00, /* 1100110000 */
5044 0x6c, 0x00, /* 0110110000 */
5045 0x3c, 0x00, /* 0011110000 */
5046 0x1c, 0x00, /* 0001110000 */
5047 0x0c, 0x00, /* 0000110000 */
5048 0x00, 0x00, /* 0000000000 */
5049 0x00, 0x00, /* 0000000000 */
5050 0x00, 0x00, /* 0000000000 */
5051
5052 /* 252 0xfc '.' */
5053 0x00, 0x00, /* 0000000000 */
5054 0x27, 0x00, /* 0010011100 */
5055 0x7b, 0x00, /* 0111101100 */
5056 0x31, 0x00, /* 0011000100 */
5057 0x31, 0x00, /* 0011000100 */
5058 0x31, 0x00, /* 0011000100 */
5059 0x7b, 0x80, /* 0111101110 */
5060 0x00, 0x00, /* 0000000000 */
5061 0x00, 0x00, /* 0000000000 */
5062 0x00, 0x00, /* 0000000000 */
5063 0x00, 0x00, /* 0000000000 */
5064 0x00, 0x00, /* 0000000000 */
5065 0x00, 0x00, /* 0000000000 */
5066 0x00, 0x00, /* 0000000000 */
5067 0x00, 0x00, /* 0000000000 */
5068 0x00, 0x00, /* 0000000000 */
5069 0x00, 0x00, /* 0000000000 */
5070 0x00, 0x00, /* 0000000000 */
5071
5072 /* 253 0xfd '.' */
5073 0x00, 0x00, /* 0000000000 */
5074 0x1e, 0x00, /* 0001111000 */
5075 0x3f, 0x00, /* 0011111100 */
5076 0x63, 0x00, /* 0110001100 */
5077 0x43, 0x00, /* 0100001100 */
5078 0x06, 0x00, /* 0000011000 */
5079 0x0c, 0x00, /* 0000110000 */
5080 0x18, 0x00, /* 0001100000 */
5081 0x30, 0x80, /* 0011000010 */
5082 0x7f, 0x80, /* 0111111110 */
5083 0x7f, 0x80, /* 0111111110 */
5084 0x00, 0x00, /* 0000000000 */
5085 0x00, 0x00, /* 0000000000 */
5086 0x00, 0x00, /* 0000000000 */
5087 0x00, 0x00, /* 0000000000 */
5088 0x00, 0x00, /* 0000000000 */
5089 0x00, 0x00, /* 0000000000 */
5090 0x00, 0x00, /* 0000000000 */
5091
5092 /* 254 0xfe '.' */
5093 0x00, 0x00, /* 0000000000 */
5094 0x00, 0x00, /* 0000000000 */
5095 0x00, 0x00, /* 0000000000 */
5096 0x3f, 0x00, /* 0011111100 */
5097 0x3f, 0x00, /* 0011111100 */
5098 0x3f, 0x00, /* 0011111100 */
5099 0x3f, 0x00, /* 0011111100 */
5100 0x3f, 0x00, /* 0011111100 */
5101 0x3f, 0x00, /* 0011111100 */
5102 0x3f, 0x00, /* 0011111100 */
5103 0x3f, 0x00, /* 0011111100 */
5104 0x3f, 0x00, /* 0011111100 */
5105 0x3f, 0x00, /* 0011111100 */
5106 0x3f, 0x00, /* 0011111100 */
5107 0x3f, 0x00, /* 0011111100 */
5108 0x00, 0x00, /* 0000000000 */
5109 0x00, 0x00, /* 0000000000 */
5110 0x00, 0x00, /* 0000000000 */
5111
5112 /* 255 0xff '.' */
5113 0x00, 0x00, /* 0000000000 */
5114 0x00, 0x00, /* 0000000000 */
5115 0x00, 0x00, /* 0000000000 */
5116 0x00, 0x00, /* 0000000000 */
5117 0x00, 0x00, /* 0000000000 */
5118 0x00, 0x00, /* 0000000000 */
5119 0x00, 0x00, /* 0000000000 */
5120 0x00, 0x00, /* 0000000000 */
5121 0x00, 0x00, /* 0000000000 */
5122 0x00, 0x00, /* 0000000000 */
5123 0x00, 0x00, /* 0000000000 */
5124 0x00, 0x00, /* 0000000000 */
5125 0x00, 0x00, /* 0000000000 */
5126 0x00, 0x00, /* 0000000000 */
5127 0x00, 0x00, /* 0000000000 */
5128 0x00, 0x00, /* 0000000000 */
5129 0x00, 0x00, /* 0000000000 */
5130 0x00, 0x00, /* 0000000000 */
5131
5132};
5133
5134
5135struct font_desc font_10x18 = {
5136 FONT10x18_IDX,
5137 "10x18",
5138 10,
5139 18,
5140 fontdata_10x18,
5141#ifdef __sparc__
5142 5
5143#else
5144 -1
5145#endif
5146};
diff --git a/drivers/video/console/font_7x14.c b/drivers/video/console/font_7x14.c
new file mode 100644
index 000000000000..1fa7fcf2ff72
--- /dev/null
+++ b/drivers/video/console/font_7x14.c
@@ -0,0 +1,4118 @@
1/**************************************/
2/* this file adapted from font_8x16.c */
3/* by Jurriaan Kalkman 05-2005 */
4/**************************************/
5
6#include <linux/font.h>
7
8#define FONTDATAMAX 3584
9
10static unsigned char fontdata_7x14[FONTDATAMAX] = {
11
12 /* 0 0x00 '^@' */
13 0x00, /* 0000000 */
14 0x00, /* 0000000 */
15 0x00, /* 0000000 */
16 0x00, /* 0000000 */
17 0x00, /* 0000000 */
18 0x00, /* 0000000 */
19 0x00, /* 0000000 */
20 0x00, /* 0000000 */
21 0x00, /* 0000000 */
22 0x00, /* 0000000 */
23 0x00, /* 0000000 */
24 0x00, /* 0000000 */
25 0x00, /* 0000000 */
26 0x00, /* 0000000 */
27
28 /* 1 0x01 '^A' */
29 0x00, /* 0000000 */
30 0x7c, /* 0111110 */
31 0x82, /* 1000001 */
32 0xaa, /* 1010101 */
33 0x82, /* 1000001 */
34 0x82, /* 1000001 */
35 0xba, /* 1011101 */
36 0x92, /* 1001001 */
37 0x82, /* 1000001 */
38 0x7c, /* 0111110 */
39 0x00, /* 0000000 */
40 0x00, /* 0000000 */
41 0x00, /* 0000000 */
42 0x00, /* 0000000 */
43
44 /* 2 0x02 '^B' */
45 0x00, /* 0000000 */
46 0x7c, /* 0111110 */
47 0xfe, /* 1111111 */
48 0xd6, /* 1101011 */
49 0xfe, /* 1111111 */
50 0xfe, /* 1111111 */
51 0xc6, /* 1100011 */
52 0xee, /* 1110111 */
53 0xfe, /* 1111111 */
54 0xfe, /* 1111111 */
55 0x7c, /* 0111110 */
56 0x00, /* 0000000 */
57 0x00, /* 0000000 */
58 0x00, /* 0000000 */
59
60 /* 3 0x03 '^C' */
61 0x00, /* 0000000 */
62 0x00, /* 0000000 */
63 0x00, /* 0000000 */
64 0x00, /* 0000000 */
65 0x6c, /* 0110110 */
66 0x7c, /* 0111110 */
67 0xfe, /* 1111111 */
68 0x7c, /* 0111110 */
69 0x38, /* 0011100 */
70 0x18, /* 0001100 */
71 0x10, /* 0001000 */
72 0x00, /* 0000000 */
73 0x00, /* 0000000 */
74 0x00, /* 0000000 */
75
76 /* 4 0x04 '^D' */
77 0x00, /* 0000000 */
78 0x00, /* 0000000 */
79 0x00, /* 0000000 */
80 0x10, /* 0001000 */
81 0x38, /* 0011100 */
82 0x7c, /* 0111110 */
83 0xfe, /* 1111111 */
84 0x7c, /* 0111110 */
85 0x38, /* 0011100 */
86 0x10, /* 0001000 */
87 0x00, /* 0000000 */
88 0x00, /* 0000000 */
89 0x00, /* 0000000 */
90 0x00, /* 0000000 */
91
92 /* 5 0x05 '^E' */
93 0x00, /* 0000000 */
94 0x00, /* 0000000 */
95 0x38, /* 0011100 */
96 0x38, /* 0011100 */
97 0x38, /* 0011100 */
98 0xee, /* 1110111 */
99 0xee, /* 1110111 */
100 0xee, /* 1110111 */
101 0x10, /* 0001000 */
102 0x10, /* 0001000 */
103 0x38, /* 0011100 */
104 0x00, /* 0000000 */
105 0x00, /* 0000000 */
106 0x00, /* 0000000 */
107
108 /* 6 0x06 '^F' */
109 0x00, /* 0000000 */
110 0x00, /* 0000000 */
111 0x10, /* 0001000 */
112 0x38, /* 0011100 */
113 0x7c, /* 0111110 */
114 0xfe, /* 1111111 */
115 0xfe, /* 1111111 */
116 0x7c, /* 0111110 */
117 0x10, /* 0001000 */
118 0x10, /* 0001000 */
119 0x38, /* 0011100 */
120 0x00, /* 0000000 */
121 0x00, /* 0000000 */
122 0x00, /* 0000000 */
123
124 /* 7 0x07 '^G' */
125 0x00, /* 0000000 */
126 0x00, /* 0000000 */
127 0x00, /* 0000000 */
128 0x00, /* 0000000 */
129 0x00, /* 0000000 */
130 0x18, /* 0001100 */
131 0x3c, /* 0011110 */
132 0x3c, /* 0011110 */
133 0x18, /* 0001100 */
134 0x00, /* 0000000 */
135 0x00, /* 0000000 */
136 0x00, /* 0000000 */
137 0x00, /* 0000000 */
138 0x00, /* 0000000 */
139
140 /* 8 0x08 '^H' */
141 0xfe, /* 1111111 */
142 0xfe, /* 1111111 */
143 0xfe, /* 1111111 */
144 0xfe, /* 1111111 */
145 0xfe, /* 1111111 */
146 0xe6, /* 1110011 */
147 0xc2, /* 1100001 */
148 0xc2, /* 1100001 */
149 0xe6, /* 1110011 */
150 0xfe, /* 1111111 */
151 0xfe, /* 1111111 */
152 0xfe, /* 1111111 */
153 0xfe, /* 1111111 */
154 0xfe, /* 1111111 */
155
156 /* 9 0x09 '^I' */
157 0x00, /* 0000000 */
158 0x00, /* 0000000 */
159 0x00, /* 0000000 */
160 0x00, /* 0000000 */
161 0x00, /* 0000000 */
162 0x38, /* 0011100 */
163 0x6c, /* 0110110 */
164 0x44, /* 0100010 */
165 0x6c, /* 0110110 */
166 0x38, /* 0011100 */
167 0x00, /* 0000000 */
168 0x00, /* 0000000 */
169 0x00, /* 0000000 */
170 0x00, /* 0000000 */
171
172 /* 10 0x0a '^J' */
173 0xfe, /* 1111111 */
174 0xfe, /* 1111111 */
175 0xfe, /* 1111111 */
176 0xfe, /* 1111111 */
177 0xfe, /* 1111111 */
178 0xc6, /* 1100011 */
179 0x92, /* 1001001 */
180 0xba, /* 1011101 */
181 0x92, /* 1001001 */
182 0xc6, /* 1100011 */
183 0xfe, /* 1111111 */
184 0xfe, /* 1111111 */
185 0xfe, /* 1111111 */
186 0xfe, /* 1111111 */
187
188 /* 11 0x0b '^K' */
189 0x00, /* 0000000 */
190 0x1e, /* 0001111 */
191 0x0e, /* 0000111 */
192 0x1a, /* 0001101 */
193 0x1a, /* 0001101 */
194 0x78, /* 0111100 */
195 0xcc, /* 1100110 */
196 0xcc, /* 1100110 */
197 0xcc, /* 1100110 */
198 0xcc, /* 1100110 */
199 0x78, /* 0111100 */
200 0x00, /* 0000000 */
201 0x00, /* 0000000 */
202 0x00, /* 0000000 */
203
204 /* 12 0x0c '^L' */
205 0x00, /* 0000000 */
206 0x3c, /* 0011110 */
207 0x66, /* 0110011 */
208 0x66, /* 0110011 */
209 0x66, /* 0110011 */
210 0x66, /* 0110011 */
211 0x3c, /* 0011110 */
212 0x18, /* 0001100 */
213 0x7e, /* 0111111 */
214 0x18, /* 0001100 */
215 0x18, /* 0001100 */
216 0x00, /* 0000000 */
217 0x00, /* 0000000 */
218 0x00, /* 0000000 */
219
220 /* 13 0x0d '^M' */
221 0x00, /* 0000000 */
222 0x3e, /* 0011111 */
223 0x36, /* 0011011 */
224 0x3e, /* 0011111 */
225 0x30, /* 0011000 */
226 0x30, /* 0011000 */
227 0x30, /* 0011000 */
228 0x30, /* 0011000 */
229 0x70, /* 0111000 */
230 0xf0, /* 1111000 */
231 0xe0, /* 1110000 */
232 0x00, /* 0000000 */
233 0x00, /* 0000000 */
234 0x00, /* 0000000 */
235
236 /* 14 0x0e '^N' */
237 0x00, /* 0000000 */
238 0x7e, /* 0111111 */
239 0x66, /* 0110011 */
240 0x7e, /* 0111111 */
241 0x66, /* 0110011 */
242 0x66, /* 0110011 */
243 0x66, /* 0110011 */
244 0x66, /* 0110011 */
245 0x6e, /* 0110111 */
246 0xee, /* 1110111 */
247 0xec, /* 1110110 */
248 0xc0, /* 1100000 */
249 0x00, /* 0000000 */
250 0x00, /* 0000000 */
251
252 /* 15 0x0f '^O' */
253 0x00, /* 0000000 */
254 0x00, /* 0000000 */
255 0x10, /* 0001000 */
256 0x10, /* 0001000 */
257 0xd6, /* 1101011 */
258 0x38, /* 0011100 */
259 0xee, /* 1110111 */
260 0x38, /* 0011100 */
261 0xd6, /* 1101011 */
262 0x10, /* 0001000 */
263 0x10, /* 0001000 */
264 0x00, /* 0000000 */
265 0x00, /* 0000000 */
266 0x00, /* 0000000 */
267
268 /* 16 0x10 '^P' */
269 0x00, /* 0000000 */
270 0x80, /* 1000000 */
271 0xc0, /* 1100000 */
272 0xe0, /* 1110000 */
273 0xf0, /* 1111000 */
274 0xfc, /* 1111110 */
275 0xf0, /* 1111000 */
276 0xe0, /* 1110000 */
277 0xc0, /* 1100000 */
278 0x80, /* 1000000 */
279 0x00, /* 0000000 */
280 0x00, /* 0000000 */
281 0x00, /* 0000000 */
282 0x00, /* 0000000 */
283
284 /* 17 0x11 '^Q' */
285 0x00, /* 0000000 */
286 0x04, /* 0000010 */
287 0x0c, /* 0000110 */
288 0x1c, /* 0001110 */
289 0x3c, /* 0011110 */
290 0xfc, /* 1111110 */
291 0x3c, /* 0011110 */
292 0x1c, /* 0001110 */
293 0x0c, /* 0000110 */
294 0x04, /* 0000010 */
295 0x00, /* 0000000 */
296 0x00, /* 0000000 */
297 0x00, /* 0000000 */
298 0x00, /* 0000000 */
299
300 /* 18 0x12 '^R' */
301 0x00, /* 0000000 */
302 0x18, /* 0001100 */
303 0x3c, /* 0011110 */
304 0x7e, /* 0111111 */
305 0x18, /* 0001100 */
306 0x18, /* 0001100 */
307 0x18, /* 0001100 */
308 0x7e, /* 0111111 */
309 0x3c, /* 0011110 */
310 0x18, /* 0001100 */
311 0x00, /* 0000000 */
312 0x00, /* 0000000 */
313 0x00, /* 0000000 */
314 0x00, /* 0000000 */
315
316 /* 19 0x13 '^S' */
317 0x00, /* 0000000 */
318 0x6c, /* 0110110 */
319 0x6c, /* 0110110 */
320 0x6c, /* 0110110 */
321 0x6c, /* 0110110 */
322 0x6c, /* 0110110 */
323 0x6c, /* 0110110 */
324 0x6c, /* 0110110 */
325 0x00, /* 0000000 */
326 0x6c, /* 0110110 */
327 0x6c, /* 0110110 */
328 0x00, /* 0000000 */
329 0x00, /* 0000000 */
330 0x00, /* 0000000 */
331
332 /* 20 0x14 '^T' */
333 0x00, /* 0000000 */
334 0x7e, /* 0111111 */
335 0xd4, /* 1101010 */
336 0xd4, /* 1101010 */
337 0xd4, /* 1101010 */
338 0x74, /* 0111010 */
339 0x14, /* 0001010 */
340 0x14, /* 0001010 */
341 0x14, /* 0001010 */
342 0x14, /* 0001010 */
343 0x16, /* 0001011 */
344 0x00, /* 0000000 */
345 0x00, /* 0000000 */
346 0x00, /* 0000000 */
347
348 /* 21 0x15 '^U' */
349 0x78, /* 0111100 */
350 0xcc, /* 1100110 */
351 0x60, /* 0110000 */
352 0x38, /* 0011100 */
353 0x6c, /* 0110110 */
354 0xc6, /* 1100011 */
355 0xc6, /* 1100011 */
356 0x6c, /* 0110110 */
357 0x38, /* 0011100 */
358 0x18, /* 0001100 */
359 0xcc, /* 1100110 */
360 0x78, /* 0111100 */
361 0x00, /* 0000000 */
362 0x00, /* 0000000 */
363
364 /* 22 0x16 '^V' */
365 0x00, /* 0000000 */
366 0x00, /* 0000000 */
367 0x00, /* 0000000 */
368 0x00, /* 0000000 */
369 0x00, /* 0000000 */
370 0x00, /* 0000000 */
371 0x00, /* 0000000 */
372 0xfc, /* 1111110 */
373 0xfc, /* 1111110 */
374 0xfc, /* 1111110 */
375 0xfc, /* 1111110 */
376 0x00, /* 0000000 */
377 0x00, /* 0000000 */
378 0x00, /* 0000000 */
379
380 /* 23 0x17 '^W' */
381 0x00, /* 0000000 */
382 0x18, /* 0001100 */
383 0x3c, /* 0011110 */
384 0x7e, /* 0111111 */
385 0x18, /* 0001100 */
386 0x18, /* 0001100 */
387 0x18, /* 0001100 */
388 0x7e, /* 0111111 */
389 0x3c, /* 0011110 */
390 0x18, /* 0001100 */
391 0x7e, /* 0111111 */
392 0x00, /* 0000000 */
393 0x00, /* 0000000 */
394 0x00, /* 0000000 */
395
396 /* 24 0x18 '^X' */
397 0x00, /* 0000000 */
398 0x18, /* 0001100 */
399 0x3c, /* 0011110 */
400 0x7e, /* 0111111 */
401 0x18, /* 0001100 */
402 0x18, /* 0001100 */
403 0x18, /* 0001100 */
404 0x18, /* 0001100 */
405 0x18, /* 0001100 */
406 0x18, /* 0001100 */
407 0x18, /* 0001100 */
408 0x00, /* 0000000 */
409 0x00, /* 0000000 */
410 0x00, /* 0000000 */
411
412 /* 25 0x19 '^Y' */
413 0x00, /* 0000000 */
414 0x18, /* 0001100 */
415 0x18, /* 0001100 */
416 0x18, /* 0001100 */
417 0x18, /* 0001100 */
418 0x18, /* 0001100 */
419 0x18, /* 0001100 */
420 0x18, /* 0001100 */
421 0x7e, /* 0111111 */
422 0x3c, /* 0011110 */
423 0x18, /* 0001100 */
424 0x00, /* 0000000 */
425 0x00, /* 0000000 */
426 0x00, /* 0000000 */
427
428 /* 26 0x1a '^Z' */
429 0x00, /* 0000000 */
430 0x00, /* 0000000 */
431 0x00, /* 0000000 */
432 0x00, /* 0000000 */
433 0x30, /* 0011000 */
434 0x18, /* 0001100 */
435 0xfc, /* 1111110 */
436 0x18, /* 0001100 */
437 0x30, /* 0011000 */
438 0x00, /* 0000000 */
439 0x00, /* 0000000 */
440 0x00, /* 0000000 */
441 0x00, /* 0000000 */
442 0x00, /* 0000000 */
443
444 /* 27 0x1b '^[' */
445 0x00, /* 0000000 */
446 0x00, /* 0000000 */
447 0x00, /* 0000000 */
448 0x00, /* 0000000 */
449 0x30, /* 0011000 */
450 0x60, /* 0110000 */
451 0xfc, /* 1111110 */
452 0x60, /* 0110000 */
453 0x30, /* 0011000 */
454 0x00, /* 0000000 */
455 0x00, /* 0000000 */
456 0x00, /* 0000000 */
457 0x00, /* 0000000 */
458 0x00, /* 0000000 */
459
460 /* 28 0x1c '^\' */
461 0x00, /* 0000000 */
462 0x00, /* 0000000 */
463 0x00, /* 0000000 */
464 0x00, /* 0000000 */
465 0x00, /* 0000000 */
466 0xc0, /* 1100000 */
467 0xc0, /* 1100000 */
468 0xc0, /* 1100000 */
469 0xfc, /* 1111110 */
470 0x00, /* 0000000 */
471 0x00, /* 0000000 */
472 0x00, /* 0000000 */
473 0x00, /* 0000000 */
474 0x00, /* 0000000 */
475
476 /* 29 0x1d '^]' */
477 0x00, /* 0000000 */
478 0x00, /* 0000000 */
479 0x00, /* 0000000 */
480 0x00, /* 0000000 */
481 0x28, /* 0010100 */
482 0x6c, /* 0110110 */
483 0xfe, /* 1111111 */
484 0x6c, /* 0110110 */
485 0x28, /* 0010100 */
486 0x00, /* 0000000 */
487 0x00, /* 0000000 */
488 0x00, /* 0000000 */
489 0x00, /* 0000000 */
490 0x00, /* 0000000 */
491
492 /* 30 0x1e '^^' */
493 0x00, /* 0000000 */
494 0x00, /* 0000000 */
495 0x00, /* 0000000 */
496 0x00, /* 0000000 */
497 0x30, /* 0011000 */
498 0x30, /* 0011000 */
499 0x78, /* 0111100 */
500 0x78, /* 0111100 */
501 0xfc, /* 1111110 */
502 0xfc, /* 1111110 */
503 0x00, /* 0000000 */
504 0x00, /* 0000000 */
505 0x00, /* 0000000 */
506 0x00, /* 0000000 */
507
508 /* 31 0x1f '^_' */
509 0x00, /* 0000000 */
510 0x00, /* 0000000 */
511 0x00, /* 0000000 */
512 0x00, /* 0000000 */
513 0xfc, /* 1111110 */
514 0xfc, /* 1111110 */
515 0x78, /* 0111100 */
516 0x78, /* 0111100 */
517 0x30, /* 0011000 */
518 0x30, /* 0011000 */
519 0x00, /* 0000000 */
520 0x00, /* 0000000 */
521 0x00, /* 0000000 */
522 0x00, /* 0000000 */
523
524 /* 32 0x20 ' ' */
525 0x00, /* 0000000 */
526 0x00, /* 0000000 */
527 0x00, /* 0000000 */
528 0x00, /* 0000000 */
529 0x00, /* 0000000 */
530 0x00, /* 0000000 */
531 0x00, /* 0000000 */
532 0x00, /* 0000000 */
533 0x00, /* 0000000 */
534 0x00, /* 0000000 */
535 0x00, /* 0000000 */
536 0x00, /* 0000000 */
537 0x00, /* 0000000 */
538 0x00, /* 0000000 */
539
540 /* 33 0x21 '!' */
541 0x00, /* 0000000 */
542 0x18, /* 0001100 */
543 0x3c, /* 0011110 */
544 0x3c, /* 0011110 */
545 0x3c, /* 0011110 */
546 0x18, /* 0001100 */
547 0x18, /* 0001100 */
548 0x18, /* 0001100 */
549 0x00, /* 0000000 */
550 0x18, /* 0001100 */
551 0x18, /* 0001100 */
552 0x00, /* 0000000 */
553 0x00, /* 0000000 */
554 0x00, /* 0000000 */
555
556 /* 34 0x22 '"' */
557 0x00, /* 0000000 */
558 0x6c, /* 0110110 */
559 0x6c, /* 0110110 */
560 0x6c, /* 0110110 */
561 0x28, /* 0010100 */
562 0x00, /* 0000000 */
563 0x00, /* 0000000 */
564 0x00, /* 0000000 */
565 0x00, /* 0000000 */
566 0x00, /* 0000000 */
567 0x00, /* 0000000 */
568 0x00, /* 0000000 */
569 0x00, /* 0000000 */
570 0x00, /* 0000000 */
571
572 /* 35 0x23 '#' */
573 0x00, /* 0000000 */
574 0x6c, /* 0110110 */
575 0x6c, /* 0110110 */
576 0xfe, /* 1111111 */
577 0xfe, /* 1111111 */
578 0x6c, /* 0110110 */
579 0x6c, /* 0110110 */
580 0xfe, /* 1111111 */
581 0xfe, /* 1111111 */
582 0x6c, /* 0110110 */
583 0x6c, /* 0110110 */
584 0x00, /* 0000000 */
585 0x00, /* 0000000 */
586 0x00, /* 0000000 */
587
588 /* 36 0x24 '$' */
589 0x30, /* 0011000 */
590 0x30, /* 0011000 */
591 0x78, /* 0111100 */
592 0xcc, /* 1100110 */
593 0xc4, /* 1100010 */
594 0xc0, /* 1100000 */
595 0x78, /* 0111100 */
596 0x0c, /* 0000110 */
597 0x8c, /* 1000110 */
598 0xcc, /* 1100110 */
599 0x78, /* 0111100 */
600 0x30, /* 0011000 */
601 0x30, /* 0011000 */
602 0x00, /* 0000000 */
603
604 /* 37 0x25 '%' */
605 0x00, /* 0000000 */
606 0x00, /* 0000000 */
607 0x00, /* 0000000 */
608 0xc0, /* 1100000 */
609 0xc4, /* 1100010 */
610 0x0c, /* 0000110 */
611 0x18, /* 0001100 */
612 0x30, /* 0011000 */
613 0x60, /* 0110000 */
614 0xcc, /* 1100110 */
615 0x8c, /* 1000110 */
616 0x00, /* 0000000 */
617 0x00, /* 0000000 */
618 0x00, /* 0000000 */
619
620 /* 38 0x26 '&' */
621 0x00, /* 0000000 */
622 0x38, /* 0011100 */
623 0x6c, /* 0110110 */
624 0x6c, /* 0110110 */
625 0x38, /* 0011100 */
626 0x78, /* 0111100 */
627 0xde, /* 1101111 */
628 0xcc, /* 1100110 */
629 0xcc, /* 1100110 */
630 0xdc, /* 1101110 */
631 0x76, /* 0111011 */
632 0x00, /* 0000000 */
633 0x00, /* 0000000 */
634 0x00, /* 0000000 */
635
636 /* 39 0x27 ''' */
637 0x00, /* 0000000 */
638 0x30, /* 0011000 */
639 0x30, /* 0011000 */
640 0x30, /* 0011000 */
641 0x60, /* 0110000 */
642 0x00, /* 0000000 */
643 0x00, /* 0000000 */
644 0x00, /* 0000000 */
645 0x00, /* 0000000 */
646 0x00, /* 0000000 */
647 0x00, /* 0000000 */
648 0x00, /* 0000000 */
649 0x00, /* 0000000 */
650 0x00, /* 0000000 */
651
652 /* 40 0x28 '(' */
653 0x00, /* 0000000 */
654 0x0c, /* 0000110 */
655 0x18, /* 0001100 */
656 0x30, /* 0011000 */
657 0x30, /* 0011000 */
658 0x30, /* 0011000 */
659 0x30, /* 0011000 */
660 0x30, /* 0011000 */
661 0x30, /* 0011000 */
662 0x18, /* 0001100 */
663 0x0c, /* 0000110 */
664 0x00, /* 0000000 */
665 0x00, /* 0000000 */
666 0x00, /* 0000000 */
667
668 /* 41 0x29 ')' */
669 0x00, /* 0000000 */
670 0x30, /* 0011000 */
671 0x18, /* 0001100 */
672 0x0c, /* 0000110 */
673 0x0c, /* 0000110 */
674 0x0c, /* 0000110 */
675 0x0c, /* 0000110 */
676 0x0c, /* 0000110 */
677 0x0c, /* 0000110 */
678 0x18, /* 0001100 */
679 0x30, /* 0011000 */
680 0x00, /* 0000000 */
681 0x00, /* 0000000 */
682 0x00, /* 0000000 */
683
684 /* 42 0x2a '*' */
685 0x00, /* 0000000 */
686 0x00, /* 0000000 */
687 0x00, /* 0000000 */
688 0x00, /* 0000000 */
689 0x6c, /* 0110110 */
690 0x38, /* 0011100 */
691 0xfe, /* 1111111 */
692 0x38, /* 0011100 */
693 0x6c, /* 0110110 */
694 0x00, /* 0000000 */
695 0x00, /* 0000000 */
696 0x00, /* 0000000 */
697 0x00, /* 0000000 */
698 0x00, /* 0000000 */
699
700 /* 43 0x2b '+' */
701 0x00, /* 0000000 */
702 0x00, /* 0000000 */
703 0x00, /* 0000000 */
704 0x00, /* 0000000 */
705 0x10, /* 0001000 */
706 0x10, /* 0001000 */
707 0x7c, /* 0111110 */
708 0x10, /* 0001000 */
709 0x10, /* 0001000 */
710 0x00, /* 0000000 */
711 0x00, /* 0000000 */
712 0x00, /* 0000000 */
713 0x00, /* 0000000 */
714 0x00, /* 0000000 */
715
716 /* 44 0x2c ',' */
717 0x00, /* 0000000 */
718 0x00, /* 0000000 */
719 0x00, /* 0000000 */
720 0x00, /* 0000000 */
721 0x00, /* 0000000 */
722 0x00, /* 0000000 */
723 0x00, /* 0000000 */
724 0x00, /* 0000000 */
725 0x18, /* 0001100 */
726 0x18, /* 0001100 */
727 0x18, /* 0001100 */
728 0x30, /* 0011000 */
729 0x00, /* 0000000 */
730 0x00, /* 0000000 */
731
732 /* 45 0x2d '-' */
733 0x00, /* 0000000 */
734 0x00, /* 0000000 */
735 0x00, /* 0000000 */
736 0x00, /* 0000000 */
737 0x00, /* 0000000 */
738 0x00, /* 0000000 */
739 0xfc, /* 1111110 */
740 0x00, /* 0000000 */
741 0x00, /* 0000000 */
742 0x00, /* 0000000 */
743 0x00, /* 0000000 */
744 0x00, /* 0000000 */
745 0x00, /* 0000000 */
746 0x00, /* 0000000 */
747
748 /* 46 0x2e '.' */
749 0x00, /* 0000000 */
750 0x00, /* 0000000 */
751 0x00, /* 0000000 */
752 0x00, /* 0000000 */
753 0x00, /* 0000000 */
754 0x00, /* 0000000 */
755 0x00, /* 0000000 */
756 0x00, /* 0000000 */
757 0x00, /* 0000000 */
758 0x18, /* 0001100 */
759 0x18, /* 0001100 */
760 0x00, /* 0000000 */
761 0x00, /* 0000000 */
762 0x00, /* 0000000 */
763
764 /* 47 0x2f '/' */
765 0x00, /* 0000000 */
766 0x00, /* 0000000 */
767 0x00, /* 0000000 */
768 0x00, /* 0000000 */
769 0x04, /* 0000010 */
770 0x0c, /* 0000110 */
771 0x18, /* 0001100 */
772 0x30, /* 0011000 */
773 0x60, /* 0110000 */
774 0xc0, /* 1100000 */
775 0x80, /* 1000000 */
776 0x00, /* 0000000 */
777 0x00, /* 0000000 */
778 0x00, /* 0000000 */
779
780 /* 48 0x30 '0' */
781 0x00, /* 0000000 */
782 0x30, /* 0011000 */
783 0x78, /* 0111100 */
784 0xcc, /* 1100110 */
785 0xcc, /* 1100110 */
786 0xdc, /* 1101110 */
787 0xec, /* 1110110 */
788 0xcc, /* 1100110 */
789 0xcc, /* 1100110 */
790 0x78, /* 0111100 */
791 0x30, /* 0011000 */
792 0x00, /* 0000000 */
793 0x00, /* 0000000 */
794 0x00, /* 0000000 */
795
796 /* 49 0x31 '1' */
797 0x00, /* 0000000 */
798 0x18, /* 0001100 */
799 0x38, /* 0011100 */
800 0x78, /* 0111100 */
801 0x18, /* 0001100 */
802 0x18, /* 0001100 */
803 0x18, /* 0001100 */
804 0x18, /* 0001100 */
805 0x18, /* 0001100 */
806 0x18, /* 0001100 */
807 0x7c, /* 0111110 */
808 0x00, /* 0000000 */
809 0x00, /* 0000000 */
810 0x00, /* 0000000 */
811
812 /* 50 0x32 '2' */
813 0x00, /* 0000000 */
814 0x78, /* 0111100 */
815 0xcc, /* 1100110 */
816 0x0c, /* 0000110 */
817 0x18, /* 0001100 */
818 0x18, /* 0001100 */
819 0x30, /* 0011000 */
820 0x60, /* 0110000 */
821 0xc0, /* 1100000 */
822 0xcc, /* 1100110 */
823 0xfc, /* 1111110 */
824 0x00, /* 0000000 */
825 0x00, /* 0000000 */
826 0x00, /* 0000000 */
827
828 /* 51 0x33 '3' */
829 0x00, /* 0000000 */
830 0x78, /* 0111100 */
831 0xcc, /* 1100110 */
832 0x0c, /* 0000110 */
833 0x0c, /* 0000110 */
834 0x38, /* 0011100 */
835 0x0c, /* 0000110 */
836 0x0c, /* 0000110 */
837 0x0c, /* 0000110 */
838 0xcc, /* 1100110 */
839 0x78, /* 0111100 */
840 0x00, /* 0000000 */
841 0x00, /* 0000000 */
842 0x00, /* 0000000 */
843
844 /* 52 0x34 '4' */
845 0x00, /* 0000000 */
846 0x0c, /* 0000110 */
847 0x1c, /* 0001110 */
848 0x3c, /* 0011110 */
849 0x6c, /* 0110110 */
850 0xcc, /* 1100110 */
851 0xfe, /* 1111111 */
852 0x0c, /* 0000110 */
853 0x0c, /* 0000110 */
854 0x0c, /* 0000110 */
855 0x0c, /* 0000110 */
856 0x00, /* 0000000 */
857 0x00, /* 0000000 */
858 0x00, /* 0000000 */
859
860 /* 53 0x35 '5' */
861 0x00, /* 0000000 */
862 0xfc, /* 1111110 */
863 0xc0, /* 1100000 */
864 0xc0, /* 1100000 */
865 0xc0, /* 1100000 */
866 0xf8, /* 1111100 */
867 0x0c, /* 0000110 */
868 0x0c, /* 0000110 */
869 0x0c, /* 0000110 */
870 0xcc, /* 1100110 */
871 0x78, /* 0111100 */
872 0x00, /* 0000000 */
873 0x00, /* 0000000 */
874 0x00, /* 0000000 */
875
876 /* 54 0x36 '6' */
877 0x00, /* 0000000 */
878 0x30, /* 0011000 */
879 0x60, /* 0110000 */
880 0xc0, /* 1100000 */
881 0xc0, /* 1100000 */
882 0xf8, /* 1111100 */
883 0xcc, /* 1100110 */
884 0xcc, /* 1100110 */
885 0xcc, /* 1100110 */
886 0xcc, /* 1100110 */
887 0x78, /* 0111100 */
888 0x00, /* 0000000 */
889 0x00, /* 0000000 */
890 0x00, /* 0000000 */
891
892 /* 55 0x37 '7' */
893 0x00, /* 0000000 */
894 0xfc, /* 1111110 */
895 0xcc, /* 1100110 */
896 0x0c, /* 0000110 */
897 0x0c, /* 0000110 */
898 0x18, /* 0001100 */
899 0x18, /* 0001100 */
900 0x30, /* 0011000 */
901 0x30, /* 0011000 */
902 0x30, /* 0011000 */
903 0x30, /* 0011000 */
904 0x00, /* 0000000 */
905 0x00, /* 0000000 */
906 0x00, /* 0000000 */
907
908 /* 56 0x38 '8' */
909 0x00, /* 0000000 */
910 0x78, /* 0111100 */
911 0xcc, /* 1100110 */
912 0xcc, /* 1100110 */
913 0xcc, /* 1100110 */
914 0x78, /* 0111100 */
915 0xcc, /* 1100110 */
916 0xcc, /* 1100110 */
917 0xcc, /* 1100110 */
918 0xcc, /* 1100110 */
919 0x78, /* 0111100 */
920 0x00, /* 0000000 */
921 0x00, /* 0000000 */
922 0x00, /* 0000000 */
923
924 /* 57 0x39 '9' */
925 0x00, /* 0000000 */
926 0x78, /* 0111100 */
927 0xcc, /* 1100110 */
928 0xcc, /* 1100110 */
929 0xcc, /* 1100110 */
930 0x7c, /* 0111110 */
931 0x0c, /* 0000110 */
932 0x0c, /* 0000110 */
933 0x0c, /* 0000110 */
934 0x18, /* 0001100 */
935 0x70, /* 0111000 */
936 0x00, /* 0000000 */
937 0x00, /* 0000000 */
938 0x00, /* 0000000 */
939
940 /* 58 0x3a ':' */
941 0x00, /* 0000000 */
942 0x00, /* 0000000 */
943 0x00, /* 0000000 */
944 0x18, /* 0001100 */
945 0x18, /* 0001100 */
946 0x00, /* 0000000 */
947 0x00, /* 0000000 */
948 0x00, /* 0000000 */
949 0x18, /* 0001100 */
950 0x18, /* 0001100 */
951 0x00, /* 0000000 */
952 0x00, /* 0000000 */
953 0x00, /* 0000000 */
954 0x00, /* 0000000 */
955
956 /* 59 0x3b ';' */
957 0x00, /* 0000000 */
958 0x00, /* 0000000 */
959 0x00, /* 0000000 */
960 0x18, /* 0001100 */
961 0x18, /* 0001100 */
962 0x00, /* 0000000 */
963 0x00, /* 0000000 */
964 0x00, /* 0000000 */
965 0x18, /* 0001100 */
966 0x18, /* 0001100 */
967 0x30, /* 0011000 */
968 0x00, /* 0000000 */
969 0x00, /* 0000000 */
970 0x00, /* 0000000 */
971
972 /* 60 0x3c '<' */
973 0x00, /* 0000000 */
974 0x00, /* 0000000 */
975 0x04, /* 0000010 */
976 0x0c, /* 0000110 */
977 0x18, /* 0001100 */
978 0x30, /* 0011000 */
979 0x60, /* 0110000 */
980 0x30, /* 0011000 */
981 0x18, /* 0001100 */
982 0x0c, /* 0000110 */
983 0x04, /* 0000010 */
984 0x00, /* 0000000 */
985 0x00, /* 0000000 */
986 0x00, /* 0000000 */
987
988 /* 61 0x3d '=' */
989 0x00, /* 0000000 */
990 0x00, /* 0000000 */
991 0x00, /* 0000000 */
992 0x00, /* 0000000 */
993 0x7c, /* 0111110 */
994 0x00, /* 0000000 */
995 0x00, /* 0000000 */
996 0x7c, /* 0111110 */
997 0x00, /* 0000000 */
998 0x00, /* 0000000 */
999 0x00, /* 0000000 */
1000 0x00, /* 0000000 */
1001 0x00, /* 0000000 */
1002 0x00, /* 0000000 */
1003
1004 /* 62 0x3e '>' */
1005 0x00, /* 0000000 */
1006 0x00, /* 0000000 */
1007 0x40, /* 0100000 */
1008 0x60, /* 0110000 */
1009 0x30, /* 0011000 */
1010 0x18, /* 0001100 */
1011 0x0c, /* 0000110 */
1012 0x18, /* 0001100 */
1013 0x30, /* 0011000 */
1014 0x60, /* 0110000 */
1015 0x40, /* 0100000 */
1016 0x00, /* 0000000 */
1017 0x00, /* 0000000 */
1018 0x00, /* 0000000 */
1019
1020 /* 63 0x3f '?' */
1021 0x00, /* 0000000 */
1022 0x78, /* 0111100 */
1023 0xcc, /* 1100110 */
1024 0xcc, /* 1100110 */
1025 0x18, /* 0001100 */
1026 0x30, /* 0011000 */
1027 0x30, /* 0011000 */
1028 0x30, /* 0011000 */
1029 0x00, /* 0000000 */
1030 0x30, /* 0011000 */
1031 0x30, /* 0011000 */
1032 0x00, /* 0000000 */
1033 0x00, /* 0000000 */
1034 0x00, /* 0000000 */
1035
1036 /* 64 0x40 '@' */
1037 0x00, /* 0000000 */
1038 0x00, /* 0000000 */
1039 0x00, /* 0000000 */
1040 0x78, /* 0111100 */
1041 0xcc, /* 1100110 */
1042 0xcc, /* 1100110 */
1043 0xdc, /* 1101110 */
1044 0xdc, /* 1101110 */
1045 0xd8, /* 1101100 */
1046 0xc0, /* 1100000 */
1047 0x78, /* 0111100 */
1048 0x00, /* 0000000 */
1049 0x00, /* 0000000 */
1050 0x00, /* 0000000 */
1051
1052 /* 65 0x41 'A' */
1053 0x00, /* 0000000 */
1054 0x30, /* 0011000 */
1055 0x78, /* 0111100 */
1056 0xcc, /* 1100110 */
1057 0xcc, /* 1100110 */
1058 0xcc, /* 1100110 */
1059 0xfc, /* 1111110 */
1060 0xcc, /* 1100110 */
1061 0xcc, /* 1100110 */
1062 0xcc, /* 1100110 */
1063 0xcc, /* 1100110 */
1064 0x00, /* 0000000 */
1065 0x00, /* 0000000 */
1066 0x00, /* 0000000 */
1067
1068 /* 66 0x42 'B' */
1069 0x00, /* 0000000 */
1070 0xf8, /* 1111100 */
1071 0x6c, /* 0110110 */
1072 0x6c, /* 0110110 */
1073 0x6c, /* 0110110 */
1074 0x78, /* 0111100 */
1075 0x6c, /* 0110110 */
1076 0x6c, /* 0110110 */
1077 0x6c, /* 0110110 */
1078 0x6c, /* 0110110 */
1079 0xf8, /* 1111100 */
1080 0x00, /* 0000000 */
1081 0x00, /* 0000000 */
1082 0x00, /* 0000000 */
1083
1084 /* 67 0x43 'C' */
1085 0x00, /* 0000000 */
1086 0x38, /* 0011100 */
1087 0x6c, /* 0110110 */
1088 0xc4, /* 1100010 */
1089 0xc0, /* 1100000 */
1090 0xc0, /* 1100000 */
1091 0xc0, /* 1100000 */
1092 0xc0, /* 1100000 */
1093 0xc4, /* 1100010 */
1094 0x6c, /* 0110110 */
1095 0x38, /* 0011100 */
1096 0x00, /* 0000000 */
1097 0x00, /* 0000000 */
1098 0x00, /* 0000000 */
1099
1100 /* 68 0x44 'D' */
1101 0x00, /* 0000000 */
1102 0xf0, /* 1111000 */
1103 0xd8, /* 1101100 */
1104 0xcc, /* 1100110 */
1105 0xcc, /* 1100110 */
1106 0xcc, /* 1100110 */
1107 0xcc, /* 1100110 */
1108 0xcc, /* 1100110 */
1109 0xcc, /* 1100110 */
1110 0xd8, /* 1101100 */
1111 0xf0, /* 1111000 */
1112 0x00, /* 0000000 */
1113 0x00, /* 0000000 */
1114 0x00, /* 0000000 */
1115
1116 /* 69 0x45 'E' */
1117 0x00, /* 0000000 */
1118 0x7c, /* 0111110 */
1119 0x6c, /* 0110110 */
1120 0x64, /* 0110010 */
1121 0x68, /* 0110100 */
1122 0x78, /* 0111100 */
1123 0x68, /* 0110100 */
1124 0x60, /* 0110000 */
1125 0x64, /* 0110010 */
1126 0x6c, /* 0110110 */
1127 0x7c, /* 0111110 */
1128 0x00, /* 0000000 */
1129 0x00, /* 0000000 */
1130 0x00, /* 0000000 */
1131
1132 /* 70 0x46 'F' */
1133 0x00, /* 0000000 */
1134 0x7c, /* 0111110 */
1135 0x64, /* 0110010 */
1136 0x60, /* 0110000 */
1137 0x68, /* 0110100 */
1138 0x78, /* 0111100 */
1139 0x68, /* 0110100 */
1140 0x60, /* 0110000 */
1141 0x60, /* 0110000 */
1142 0x60, /* 0110000 */
1143 0x70, /* 0111000 */
1144 0x00, /* 0000000 */
1145 0x00, /* 0000000 */
1146 0x00, /* 0000000 */
1147
1148 /* 71 0x47 'G' */
1149 0x00, /* 0000000 */
1150 0x38, /* 0011100 */
1151 0x6c, /* 0110110 */
1152 0xc4, /* 1100010 */
1153 0xc0, /* 1100000 */
1154 0xc0, /* 1100000 */
1155 0xdc, /* 1101110 */
1156 0xcc, /* 1100110 */
1157 0xcc, /* 1100110 */
1158 0x6c, /* 0110110 */
1159 0x34, /* 0011010 */
1160 0x00, /* 0000000 */
1161 0x00, /* 0000000 */
1162 0x00, /* 0000000 */
1163
1164 /* 72 0x48 'H' */
1165 0x00, /* 0000000 */
1166 0xcc, /* 1100110 */
1167 0xcc, /* 1100110 */
1168 0xcc, /* 1100110 */
1169 0xcc, /* 1100110 */
1170 0xfc, /* 1111110 */
1171 0xcc, /* 1100110 */
1172 0xcc, /* 1100110 */
1173 0xcc, /* 1100110 */
1174 0xcc, /* 1100110 */
1175 0xcc, /* 1100110 */
1176 0x00, /* 0000000 */
1177 0x00, /* 0000000 */
1178 0x00, /* 0000000 */
1179
1180 /* 73 0x49 'I' */
1181 0x00, /* 0000000 */
1182 0x3c, /* 0011110 */
1183 0x18, /* 0001100 */
1184 0x18, /* 0001100 */
1185 0x18, /* 0001100 */
1186 0x18, /* 0001100 */
1187 0x18, /* 0001100 */
1188 0x18, /* 0001100 */
1189 0x18, /* 0001100 */
1190 0x18, /* 0001100 */
1191 0x3c, /* 0011110 */
1192 0x00, /* 0000000 */
1193 0x00, /* 0000000 */
1194 0x00, /* 0000000 */
1195
1196 /* 74 0x4a 'J' */
1197 0x00, /* 0000000 */
1198 0x1c, /* 0001110 */
1199 0x0c, /* 0000110 */
1200 0x0c, /* 0000110 */
1201 0x0c, /* 0000110 */
1202 0x0c, /* 0000110 */
1203 0x0c, /* 0000110 */
1204 0xcc, /* 1100110 */
1205 0xcc, /* 1100110 */
1206 0xcc, /* 1100110 */
1207 0x78, /* 0111100 */
1208 0x00, /* 0000000 */
1209 0x00, /* 0000000 */
1210 0x00, /* 0000000 */
1211
1212 /* 75 0x4b 'K' */
1213 0x00, /* 0000000 */
1214 0xcc, /* 1100110 */
1215 0xcc, /* 1100110 */
1216 0xcc, /* 1100110 */
1217 0xd8, /* 1101100 */
1218 0xf0, /* 1111000 */
1219 0xf0, /* 1111000 */
1220 0xd8, /* 1101100 */
1221 0xcc, /* 1100110 */
1222 0xcc, /* 1100110 */
1223 0xcc, /* 1100110 */
1224 0x00, /* 0000000 */
1225 0x00, /* 0000000 */
1226 0x00, /* 0000000 */
1227
1228 /* 76 0x4c 'L' */
1229 0x00, /* 0000000 */
1230 0xc0, /* 1100000 */
1231 0xc0, /* 1100000 */
1232 0xc0, /* 1100000 */
1233 0xc0, /* 1100000 */
1234 0xc0, /* 1100000 */
1235 0xc0, /* 1100000 */
1236 0xc0, /* 1100000 */
1237 0xc4, /* 1100010 */
1238 0xcc, /* 1100110 */
1239 0xfc, /* 1111110 */
1240 0x00, /* 0000000 */
1241 0x00, /* 0000000 */
1242 0x00, /* 0000000 */
1243
1244 /* 77 0x4d 'M' */
1245 0x00, /* 0000000 */
1246 0xc6, /* 1100011 */
1247 0xee, /* 1110111 */
1248 0xfe, /* 1111111 */
1249 0xfe, /* 1111111 */
1250 0xd6, /* 1101011 */
1251 0xc6, /* 1100011 */
1252 0xc6, /* 1100011 */
1253 0xc6, /* 1100011 */
1254 0xc6, /* 1100011 */
1255 0xc6, /* 1100011 */
1256 0x00, /* 0000000 */
1257 0x00, /* 0000000 */
1258 0x00, /* 0000000 */
1259
1260 /* 78 0x4e 'N' */
1261 0x00, /* 0000000 */
1262 0xcc, /* 1100110 */
1263 0xec, /* 1110110 */
1264 0xec, /* 1110110 */
1265 0xfc, /* 1111110 */
1266 0xdc, /* 1101110 */
1267 0xdc, /* 1101110 */
1268 0xcc, /* 1100110 */
1269 0xcc, /* 1100110 */
1270 0xcc, /* 1100110 */
1271 0xcc, /* 1100110 */
1272 0x00, /* 0000000 */
1273 0x00, /* 0000000 */
1274 0x00, /* 0000000 */
1275
1276 /* 79 0x4f 'O' */
1277 0x00, /* 0000000 */
1278 0x78, /* 0111100 */
1279 0xcc, /* 1100110 */
1280 0xcc, /* 1100110 */
1281 0xcc, /* 1100110 */
1282 0xcc, /* 1100110 */
1283 0xcc, /* 1100110 */
1284 0xcc, /* 1100110 */
1285 0xcc, /* 1100110 */
1286 0xcc, /* 1100110 */
1287 0x78, /* 0111100 */
1288 0x00, /* 0000000 */
1289 0x00, /* 0000000 */
1290 0x00, /* 0000000 */
1291
1292 /* 80 0x50 'P' */
1293 0x00, /* 0000000 */
1294 0xf8, /* 1111100 */
1295 0xcc, /* 1100110 */
1296 0xcc, /* 1100110 */
1297 0xcc, /* 1100110 */
1298 0xf8, /* 1111100 */
1299 0xc0, /* 1100000 */
1300 0xc0, /* 1100000 */
1301 0xc0, /* 1100000 */
1302 0xc0, /* 1100000 */
1303 0xc0, /* 1100000 */
1304 0x00, /* 0000000 */
1305 0x00, /* 0000000 */
1306 0x00, /* 0000000 */
1307
1308 /* 81 0x51 'Q' */
1309 0x00, /* 0000000 */
1310 0x78, /* 0111100 */
1311 0xcc, /* 1100110 */
1312 0xcc, /* 1100110 */
1313 0xcc, /* 1100110 */
1314 0xcc, /* 1100110 */
1315 0xcc, /* 1100110 */
1316 0xcc, /* 1100110 */
1317 0xcc, /* 1100110 */
1318 0xdc, /* 1101110 */
1319 0x78, /* 0111100 */
1320 0x18, /* 0001100 */
1321 0x1c, /* 0001110 */
1322 0x00, /* 0000000 */
1323
1324 /* 82 0x52 'R' */
1325 0x00, /* 0000000 */
1326 0xf8, /* 1111100 */
1327 0xcc, /* 1100110 */
1328 0xcc, /* 1100110 */
1329 0xcc, /* 1100110 */
1330 0xf8, /* 1111100 */
1331 0xd8, /* 1101100 */
1332 0xcc, /* 1100110 */
1333 0xcc, /* 1100110 */
1334 0xcc, /* 1100110 */
1335 0xcc, /* 1100110 */
1336 0x00, /* 0000000 */
1337 0x00, /* 0000000 */
1338 0x00, /* 0000000 */
1339
1340 /* 83 0x53 'S' */
1341 0x00, /* 0000000 */
1342 0x7c, /* 0111110 */
1343 0xc4, /* 1100010 */
1344 0xc0, /* 1100000 */
1345 0xc0, /* 1100000 */
1346 0x60, /* 0110000 */
1347 0x38, /* 0011100 */
1348 0x0c, /* 0000110 */
1349 0x0c, /* 0000110 */
1350 0x8c, /* 1000110 */
1351 0xf8, /* 1111100 */
1352 0x00, /* 0000000 */
1353 0x00, /* 0000000 */
1354 0x00, /* 0000000 */
1355
1356 /* 84 0x54 'T' */
1357 0x00, /* 0000000 */
1358 0xfc, /* 1111110 */
1359 0xfc, /* 1111110 */
1360 0xb4, /* 1011010 */
1361 0x30, /* 0011000 */
1362 0x30, /* 0011000 */
1363 0x30, /* 0011000 */
1364 0x30, /* 0011000 */
1365 0x30, /* 0011000 */
1366 0x30, /* 0011000 */
1367 0x78, /* 0111100 */
1368 0x00, /* 0000000 */
1369 0x00, /* 0000000 */
1370 0x00, /* 0000000 */
1371
1372 /* 85 0x55 'U' */
1373 0x00, /* 0000000 */
1374 0xcc, /* 1100110 */
1375 0xcc, /* 1100110 */
1376 0xcc, /* 1100110 */
1377 0xcc, /* 1100110 */
1378 0xcc, /* 1100110 */
1379 0xcc, /* 1100110 */
1380 0xcc, /* 1100110 */
1381 0xcc, /* 1100110 */
1382 0xcc, /* 1100110 */
1383 0x78, /* 0111100 */
1384 0x00, /* 0000000 */
1385 0x00, /* 0000000 */
1386 0x00, /* 0000000 */
1387
1388 /* 86 0x56 'V' */
1389 0x00, /* 0000000 */
1390 0xcc, /* 1100110 */
1391 0xcc, /* 1100110 */
1392 0xcc, /* 1100110 */
1393 0xcc, /* 1100110 */
1394 0xcc, /* 1100110 */
1395 0xcc, /* 1100110 */
1396 0xcc, /* 1100110 */
1397 0x78, /* 0111100 */
1398 0x78, /* 0111100 */
1399 0x30, /* 0011000 */
1400 0x00, /* 0000000 */
1401 0x00, /* 0000000 */
1402 0x00, /* 0000000 */
1403
1404 /* 87 0x57 'W' */
1405 0x00, /* 0000000 */
1406 0xcc, /* 1100110 */
1407 0xcc, /* 1100110 */
1408 0xcc, /* 1100110 */
1409 0xcc, /* 1100110 */
1410 0xcc, /* 1100110 */
1411 0xcc, /* 1100110 */
1412 0xcc, /* 1100110 */
1413 0xfc, /* 1111110 */
1414 0xfc, /* 1111110 */
1415 0x48, /* 0100100 */
1416 0x00, /* 0000000 */
1417 0x00, /* 0000000 */
1418 0x00, /* 0000000 */
1419
1420 /* 88 0x58 'X' */
1421 0x00, /* 0000000 */
1422 0xcc, /* 1100110 */
1423 0xcc, /* 1100110 */
1424 0x78, /* 0111100 */
1425 0x78, /* 0111100 */
1426 0x30, /* 0011000 */
1427 0x30, /* 0011000 */
1428 0x78, /* 0111100 */
1429 0x78, /* 0111100 */
1430 0xcc, /* 1100110 */
1431 0xcc, /* 1100110 */
1432 0x00, /* 0000000 */
1433 0x00, /* 0000000 */
1434 0x00, /* 0000000 */
1435
1436 /* 89 0x59 'Y' */
1437 0x00, /* 0000000 */
1438 0xcc, /* 1100110 */
1439 0xcc, /* 1100110 */
1440 0xcc, /* 1100110 */
1441 0xcc, /* 1100110 */
1442 0x78, /* 0111100 */
1443 0x30, /* 0011000 */
1444 0x30, /* 0011000 */
1445 0x30, /* 0011000 */
1446 0x30, /* 0011000 */
1447 0x30, /* 0011000 */
1448 0x00, /* 0000000 */
1449 0x00, /* 0000000 */
1450 0x00, /* 0000000 */
1451
1452 /* 90 0x5a 'Z' */
1453 0x00, /* 0000000 */
1454 0xfc, /* 1111110 */
1455 0xcc, /* 1100110 */
1456 0x8c, /* 1000110 */
1457 0x18, /* 0001100 */
1458 0x18, /* 0001100 */
1459 0x30, /* 0011000 */
1460 0x60, /* 0110000 */
1461 0xc4, /* 1100010 */
1462 0xcc, /* 1100110 */
1463 0xfc, /* 1111110 */
1464 0x00, /* 0000000 */
1465 0x00, /* 0000000 */
1466 0x00, /* 0000000 */
1467
1468 /* 91 0x5b '[' */
1469 0x00, /* 0000000 */
1470 0x78, /* 0111100 */
1471 0x60, /* 0110000 */
1472 0x60, /* 0110000 */
1473 0x60, /* 0110000 */
1474 0x60, /* 0110000 */
1475 0x60, /* 0110000 */
1476 0x60, /* 0110000 */
1477 0x60, /* 0110000 */
1478 0x60, /* 0110000 */
1479 0x78, /* 0111100 */
1480 0x00, /* 0000000 */
1481 0x00, /* 0000000 */
1482 0x00, /* 0000000 */
1483
1484 /* 92 0x5c '\' */
1485 0x00, /* 0000000 */
1486 0x00, /* 0000000 */
1487 0x00, /* 0000000 */
1488 0x80, /* 1000000 */
1489 0xc0, /* 1100000 */
1490 0xe0, /* 1110000 */
1491 0x70, /* 0111000 */
1492 0x38, /* 0011100 */
1493 0x1c, /* 0001110 */
1494 0x0c, /* 0000110 */
1495 0x04, /* 0000010 */
1496 0x00, /* 0000000 */
1497 0x00, /* 0000000 */
1498 0x00, /* 0000000 */
1499
1500 /* 93 0x5d ']' */
1501 0x00, /* 0000000 */
1502 0x78, /* 0111100 */
1503 0x18, /* 0001100 */
1504 0x18, /* 0001100 */
1505 0x18, /* 0001100 */
1506 0x18, /* 0001100 */
1507 0x18, /* 0001100 */
1508 0x18, /* 0001100 */
1509 0x18, /* 0001100 */
1510 0x18, /* 0001100 */
1511 0x78, /* 0111100 */
1512 0x00, /* 0000000 */
1513 0x00, /* 0000000 */
1514 0x00, /* 0000000 */
1515
1516 /* 94 0x5e '^' */
1517 0x10, /* 0001000 */
1518 0x38, /* 0011100 */
1519 0x6c, /* 0110110 */
1520 0xc6, /* 1100011 */
1521 0x00, /* 0000000 */
1522 0x00, /* 0000000 */
1523 0x00, /* 0000000 */
1524 0x00, /* 0000000 */
1525 0x00, /* 0000000 */
1526 0x00, /* 0000000 */
1527 0x00, /* 0000000 */
1528 0x00, /* 0000000 */
1529 0x00, /* 0000000 */
1530 0x00, /* 0000000 */
1531
1532 /* 95 0x5f '_' */
1533 0x00, /* 0000000 */
1534 0x00, /* 0000000 */
1535 0x00, /* 0000000 */
1536 0x00, /* 0000000 */
1537 0x00, /* 0000000 */
1538 0x00, /* 0000000 */
1539 0x00, /* 0000000 */
1540 0x00, /* 0000000 */
1541 0x00, /* 0000000 */
1542 0x00, /* 0000000 */
1543 0x00, /* 0000000 */
1544 0x00, /* 0000000 */
1545 0xfe, /* 1111111 */
1546 0x00, /* 0000000 */
1547
1548 /* 96 0x60 '`' */
1549 0x00, /* 0000000 */
1550 0x60, /* 0110000 */
1551 0x30, /* 0011000 */
1552 0x18, /* 0001100 */
1553 0x00, /* 0000000 */
1554 0x00, /* 0000000 */
1555 0x00, /* 0000000 */
1556 0x00, /* 0000000 */
1557 0x00, /* 0000000 */
1558 0x00, /* 0000000 */
1559 0x00, /* 0000000 */
1560 0x00, /* 0000000 */
1561 0x00, /* 0000000 */
1562 0x00, /* 0000000 */
1563
1564 /* 97 0x61 'a' */
1565 0x00, /* 0000000 */
1566 0x00, /* 0000000 */
1567 0x00, /* 0000000 */
1568 0x00, /* 0000000 */
1569 0x78, /* 0111100 */
1570 0x0c, /* 0000110 */
1571 0x7c, /* 0111110 */
1572 0xcc, /* 1100110 */
1573 0xcc, /* 1100110 */
1574 0xcc, /* 1100110 */
1575 0x76, /* 0111011 */
1576 0x00, /* 0000000 */
1577 0x00, /* 0000000 */
1578 0x00, /* 0000000 */
1579
1580 /* 98 0x62 'b' */
1581 0x00, /* 0000000 */
1582 0xc0, /* 1100000 */
1583 0xc0, /* 1100000 */
1584 0xc0, /* 1100000 */
1585 0xf0, /* 1111000 */
1586 0xd8, /* 1101100 */
1587 0xcc, /* 1100110 */
1588 0xcc, /* 1100110 */
1589 0xcc, /* 1100110 */
1590 0xcc, /* 1100110 */
1591 0xf8, /* 1111100 */
1592 0x00, /* 0000000 */
1593 0x00, /* 0000000 */
1594 0x00, /* 0000000 */
1595
1596 /* 99 0x63 'c' */
1597 0x00, /* 0000000 */
1598 0x00, /* 0000000 */
1599 0x00, /* 0000000 */
1600 0x00, /* 0000000 */
1601 0x78, /* 0111100 */
1602 0xcc, /* 1100110 */
1603 0xc0, /* 1100000 */
1604 0xc0, /* 1100000 */
1605 0xc0, /* 1100000 */
1606 0xcc, /* 1100110 */
1607 0x78, /* 0111100 */
1608 0x00, /* 0000000 */
1609 0x00, /* 0000000 */
1610 0x00, /* 0000000 */
1611
1612 /* 100 0x64 'd' */
1613 0x00, /* 0000000 */
1614 0x1c, /* 0001110 */
1615 0x0c, /* 0000110 */
1616 0x0c, /* 0000110 */
1617 0x3c, /* 0011110 */
1618 0x6c, /* 0110110 */
1619 0xcc, /* 1100110 */
1620 0xcc, /* 1100110 */
1621 0xcc, /* 1100110 */
1622 0xcc, /* 1100110 */
1623 0x76, /* 0111011 */
1624 0x00, /* 0000000 */
1625 0x00, /* 0000000 */
1626 0x00, /* 0000000 */
1627
1628 /* 101 0x65 'e' */
1629 0x00, /* 0000000 */
1630 0x00, /* 0000000 */
1631 0x00, /* 0000000 */
1632 0x00, /* 0000000 */
1633 0x78, /* 0111100 */
1634 0xcc, /* 1100110 */
1635 0xfc, /* 1111110 */
1636 0xc0, /* 1100000 */
1637 0xc0, /* 1100000 */
1638 0xcc, /* 1100110 */
1639 0x78, /* 0111100 */
1640 0x00, /* 0000000 */
1641 0x00, /* 0000000 */
1642 0x00, /* 0000000 */
1643
1644 /* 102 0x66 'f' */
1645 0x00, /* 0000000 */
1646 0x38, /* 0011100 */
1647 0x6c, /* 0110110 */
1648 0x64, /* 0110010 */
1649 0x60, /* 0110000 */
1650 0xf0, /* 1111000 */
1651 0x60, /* 0110000 */
1652 0x60, /* 0110000 */
1653 0x60, /* 0110000 */
1654 0x60, /* 0110000 */
1655 0xf0, /* 1111000 */
1656 0x00, /* 0000000 */
1657 0x00, /* 0000000 */
1658 0x00, /* 0000000 */
1659
1660 /* 103 0x67 'g' */
1661 0x00, /* 0000000 */
1662 0x00, /* 0000000 */
1663 0x00, /* 0000000 */
1664 0x00, /* 0000000 */
1665 0x76, /* 0111011 */
1666 0xcc, /* 1100110 */
1667 0xcc, /* 1100110 */
1668 0xcc, /* 1100110 */
1669 0xcc, /* 1100110 */
1670 0xcc, /* 1100110 */
1671 0x7c, /* 0111110 */
1672 0x0c, /* 0000110 */
1673 0xcc, /* 1100110 */
1674 0x78, /* 0111100 */
1675
1676 /* 104 0x68 'h' */
1677 0x00, /* 0000000 */
1678 0xc0, /* 1100000 */
1679 0xc0, /* 1100000 */
1680 0xc0, /* 1100000 */
1681 0xd8, /* 1101100 */
1682 0xec, /* 1110110 */
1683 0xcc, /* 1100110 */
1684 0xcc, /* 1100110 */
1685 0xcc, /* 1100110 */
1686 0xcc, /* 1100110 */
1687 0xcc, /* 1100110 */
1688 0x00, /* 0000000 */
1689 0x00, /* 0000000 */
1690 0x00, /* 0000000 */
1691
1692 /* 105 0x69 'i' */
1693 0x00, /* 0000000 */
1694 0x30, /* 0011000 */
1695 0x30, /* 0011000 */
1696 0x00, /* 0000000 */
1697 0x70, /* 0111000 */
1698 0x30, /* 0011000 */
1699 0x30, /* 0011000 */
1700 0x30, /* 0011000 */
1701 0x30, /* 0011000 */
1702 0x30, /* 0011000 */
1703 0x78, /* 0111100 */
1704 0x00, /* 0000000 */
1705 0x00, /* 0000000 */
1706 0x00, /* 0000000 */
1707
1708 /* 106 0x6a 'j' */
1709 0x00, /* 0000000 */
1710 0x0c, /* 0000110 */
1711 0x0c, /* 0000110 */
1712 0x00, /* 0000000 */
1713 0x1c, /* 0001110 */
1714 0x0c, /* 0000110 */
1715 0x0c, /* 0000110 */
1716 0x0c, /* 0000110 */
1717 0x0c, /* 0000110 */
1718 0x0c, /* 0000110 */
1719 0x0c, /* 0000110 */
1720 0xcc, /* 1100110 */
1721 0xcc, /* 1100110 */
1722 0x78, /* 0111100 */
1723
1724 /* 107 0x6b 'k' */
1725 0x00, /* 0000000 */
1726 0xc0, /* 1100000 */
1727 0xc0, /* 1100000 */
1728 0xc0, /* 1100000 */
1729 0xcc, /* 1100110 */
1730 0xd8, /* 1101100 */
1731 0xf0, /* 1111000 */
1732 0xf0, /* 1111000 */
1733 0xd8, /* 1101100 */
1734 0xcc, /* 1100110 */
1735 0xcc, /* 1100110 */
1736 0x00, /* 0000000 */
1737 0x00, /* 0000000 */
1738 0x00, /* 0000000 */
1739
1740 /* 108 0x6c 'l' */
1741 0x00, /* 0000000 */
1742 0x70, /* 0111000 */
1743 0x30, /* 0011000 */
1744 0x30, /* 0011000 */
1745 0x30, /* 0011000 */
1746 0x30, /* 0011000 */
1747 0x30, /* 0011000 */
1748 0x30, /* 0011000 */
1749 0x30, /* 0011000 */
1750 0x30, /* 0011000 */
1751 0x78, /* 0111100 */
1752 0x00, /* 0000000 */
1753 0x00, /* 0000000 */
1754 0x00, /* 0000000 */
1755
1756 /* 109 0x6d 'm' */
1757 0x00, /* 0000000 */
1758 0x00, /* 0000000 */
1759 0x00, /* 0000000 */
1760 0x00, /* 0000000 */
1761 0xec, /* 1110110 */
1762 0xfe, /* 1111111 */
1763 0xd6, /* 1101011 */
1764 0xd6, /* 1101011 */
1765 0xd6, /* 1101011 */
1766 0xd6, /* 1101011 */
1767 0xd6, /* 1101011 */
1768 0x00, /* 0000000 */
1769 0x00, /* 0000000 */
1770 0x00, /* 0000000 */
1771
1772 /* 110 0x6e 'n' */
1773 0x00, /* 0000000 */
1774 0x00, /* 0000000 */
1775 0x00, /* 0000000 */
1776 0x00, /* 0000000 */
1777 0xb8, /* 1011100 */
1778 0xcc, /* 1100110 */
1779 0xcc, /* 1100110 */
1780 0xcc, /* 1100110 */
1781 0xcc, /* 1100110 */
1782 0xcc, /* 1100110 */
1783 0xcc, /* 1100110 */
1784 0x00, /* 0000000 */
1785 0x00, /* 0000000 */
1786 0x00, /* 0000000 */
1787
1788 /* 111 0x6f 'o' */
1789 0x00, /* 0000000 */
1790 0x00, /* 0000000 */
1791 0x00, /* 0000000 */
1792 0x00, /* 0000000 */
1793 0x78, /* 0111100 */
1794 0xcc, /* 1100110 */
1795 0xcc, /* 1100110 */
1796 0xcc, /* 1100110 */
1797 0xcc, /* 1100110 */
1798 0xcc, /* 1100110 */
1799 0x78, /* 0111100 */
1800 0x00, /* 0000000 */
1801 0x00, /* 0000000 */
1802 0x00, /* 0000000 */
1803
1804 /* 112 0x70 'p' */
1805 0x00, /* 0000000 */
1806 0x00, /* 0000000 */
1807 0x00, /* 0000000 */
1808 0x00, /* 0000000 */
1809 0xb8, /* 1011100 */
1810 0xcc, /* 1100110 */
1811 0xcc, /* 1100110 */
1812 0xcc, /* 1100110 */
1813 0xcc, /* 1100110 */
1814 0xcc, /* 1100110 */
1815 0xf8, /* 1111100 */
1816 0xc0, /* 1100000 */
1817 0xc0, /* 1100000 */
1818 0xc0, /* 1100000 */
1819
1820 /* 113 0x71 'q' */
1821 0x00, /* 0000000 */
1822 0x00, /* 0000000 */
1823 0x00, /* 0000000 */
1824 0x00, /* 0000000 */
1825 0x74, /* 0111010 */
1826 0xcc, /* 1100110 */
1827 0xcc, /* 1100110 */
1828 0xcc, /* 1100110 */
1829 0xcc, /* 1100110 */
1830 0xcc, /* 1100110 */
1831 0x7c, /* 0111110 */
1832 0x0c, /* 0000110 */
1833 0x0c, /* 0000110 */
1834 0x0c, /* 0000110 */
1835
1836 /* 114 0x72 'r' */
1837 0x00, /* 0000000 */
1838 0x00, /* 0000000 */
1839 0x00, /* 0000000 */
1840 0x00, /* 0000000 */
1841 0xb8, /* 1011100 */
1842 0xec, /* 1110110 */
1843 0xcc, /* 1100110 */
1844 0xc0, /* 1100000 */
1845 0xc0, /* 1100000 */
1846 0xc0, /* 1100000 */
1847 0xc0, /* 1100000 */
1848 0x00, /* 0000000 */
1849 0x00, /* 0000000 */
1850 0x00, /* 0000000 */
1851
1852 /* 115 0x73 's' */
1853 0x00, /* 0000000 */
1854 0x00, /* 0000000 */
1855 0x00, /* 0000000 */
1856 0x00, /* 0000000 */
1857 0x78, /* 0111100 */
1858 0xcc, /* 1100110 */
1859 0x60, /* 0110000 */
1860 0x30, /* 0011000 */
1861 0x18, /* 0001100 */
1862 0xcc, /* 1100110 */
1863 0x78, /* 0111100 */
1864 0x00, /* 0000000 */
1865 0x00, /* 0000000 */
1866 0x00, /* 0000000 */
1867
1868 /* 116 0x74 't' */
1869 0x00, /* 0000000 */
1870 0x10, /* 0001000 */
1871 0x30, /* 0011000 */
1872 0x30, /* 0011000 */
1873 0xfc, /* 1111110 */
1874 0x30, /* 0011000 */
1875 0x30, /* 0011000 */
1876 0x30, /* 0011000 */
1877 0x30, /* 0011000 */
1878 0x36, /* 0011011 */
1879 0x1c, /* 0001110 */
1880 0x00, /* 0000000 */
1881 0x00, /* 0000000 */
1882 0x00, /* 0000000 */
1883
1884 /* 117 0x75 'u' */
1885 0x00, /* 0000000 */
1886 0x00, /* 0000000 */
1887 0x00, /* 0000000 */
1888 0x00, /* 0000000 */
1889 0xcc, /* 1100110 */
1890 0xcc, /* 1100110 */
1891 0xcc, /* 1100110 */
1892 0xcc, /* 1100110 */
1893 0xcc, /* 1100110 */
1894 0xcc, /* 1100110 */
1895 0x76, /* 0111011 */
1896 0x00, /* 0000000 */
1897 0x00, /* 0000000 */
1898 0x00, /* 0000000 */
1899
1900 /* 118 0x76 'v' */
1901 0x00, /* 0000000 */
1902 0x00, /* 0000000 */
1903 0x00, /* 0000000 */
1904 0x00, /* 0000000 */
1905 0xcc, /* 1100110 */
1906 0xcc, /* 1100110 */
1907 0xcc, /* 1100110 */
1908 0xcc, /* 1100110 */
1909 0xcc, /* 1100110 */
1910 0x78, /* 0111100 */
1911 0x30, /* 0011000 */
1912 0x00, /* 0000000 */
1913 0x00, /* 0000000 */
1914 0x00, /* 0000000 */
1915
1916 /* 119 0x77 'w' */
1917 0x00, /* 0000000 */
1918 0x00, /* 0000000 */
1919 0x00, /* 0000000 */
1920 0x00, /* 0000000 */
1921 0xc6, /* 1100011 */
1922 0xc6, /* 1100011 */
1923 0xd6, /* 1101011 */
1924 0xd6, /* 1101011 */
1925 0xd6, /* 1101011 */
1926 0xfe, /* 1111111 */
1927 0x6c, /* 0110110 */
1928 0x00, /* 0000000 */
1929 0x00, /* 0000000 */
1930 0x00, /* 0000000 */
1931
1932 /* 120 0x78 'x' */
1933 0x00, /* 0000000 */
1934 0x00, /* 0000000 */
1935 0x00, /* 0000000 */
1936 0x00, /* 0000000 */
1937 0xcc, /* 1100110 */
1938 0xcc, /* 1100110 */
1939 0x78, /* 0111100 */
1940 0x30, /* 0011000 */
1941 0x78, /* 0111100 */
1942 0xcc, /* 1100110 */
1943 0xcc, /* 1100110 */
1944 0x00, /* 0000000 */
1945 0x00, /* 0000000 */
1946 0x00, /* 0000000 */
1947
1948 /* 121 0x79 'y' */
1949 0x00, /* 0000000 */
1950 0x00, /* 0000000 */
1951 0x00, /* 0000000 */
1952 0x00, /* 0000000 */
1953 0xcc, /* 1100110 */
1954 0xcc, /* 1100110 */
1955 0xcc, /* 1100110 */
1956 0xcc, /* 1100110 */
1957 0xcc, /* 1100110 */
1958 0xcc, /* 1100110 */
1959 0x7c, /* 0111110 */
1960 0x0c, /* 0000110 */
1961 0x18, /* 0001100 */
1962 0xf0, /* 1111000 */
1963
1964 /* 122 0x7a 'z' */
1965 0x00, /* 0000000 */
1966 0x00, /* 0000000 */
1967 0x00, /* 0000000 */
1968 0x00, /* 0000000 */
1969 0xfc, /* 1111110 */
1970 0xcc, /* 1100110 */
1971 0x18, /* 0001100 */
1972 0x30, /* 0011000 */
1973 0x60, /* 0110000 */
1974 0xcc, /* 1100110 */
1975 0xfc, /* 1111110 */
1976 0x00, /* 0000000 */
1977 0x00, /* 0000000 */
1978 0x00, /* 0000000 */
1979
1980 /* 123 0x7b '{' */
1981 0x00, /* 0000000 */
1982 0x1c, /* 0001110 */
1983 0x30, /* 0011000 */
1984 0x30, /* 0011000 */
1985 0x30, /* 0011000 */
1986 0xe0, /* 1110000 */
1987 0x30, /* 0011000 */
1988 0x30, /* 0011000 */
1989 0x30, /* 0011000 */
1990 0x30, /* 0011000 */
1991 0x1c, /* 0001110 */
1992 0x00, /* 0000000 */
1993 0x00, /* 0000000 */
1994 0x00, /* 0000000 */
1995
1996 /* 124 0x7c '|' */
1997 0x00, /* 0000000 */
1998 0x30, /* 0011000 */
1999 0x30, /* 0011000 */
2000 0x30, /* 0011000 */
2001 0x30, /* 0011000 */
2002 0x30, /* 0011000 */
2003 0x30, /* 0011000 */
2004 0x30, /* 0011000 */
2005 0x30, /* 0011000 */
2006 0x30, /* 0011000 */
2007 0x30, /* 0011000 */
2008 0x00, /* 0000000 */
2009 0x00, /* 0000000 */
2010 0x00, /* 0000000 */
2011
2012 /* 125 0x7d '}' */
2013 0x00, /* 0000000 */
2014 0x70, /* 0111000 */
2015 0x18, /* 0001100 */
2016 0x18, /* 0001100 */
2017 0x18, /* 0001100 */
2018 0x0e, /* 0000111 */
2019 0x18, /* 0001100 */
2020 0x18, /* 0001100 */
2021 0x18, /* 0001100 */
2022 0x18, /* 0001100 */
2023 0x70, /* 0111000 */
2024 0x00, /* 0000000 */
2025 0x00, /* 0000000 */
2026 0x00, /* 0000000 */
2027
2028 /* 126 0x7e '~' */
2029 0x00, /* 0000000 */
2030 0xec, /* 1110110 */
2031 0xb8, /* 1011100 */
2032 0x00, /* 0000000 */
2033 0x00, /* 0000000 */
2034 0x00, /* 0000000 */
2035 0x00, /* 0000000 */
2036 0x00, /* 0000000 */
2037 0x00, /* 0000000 */
2038 0x00, /* 0000000 */
2039 0x00, /* 0000000 */
2040 0x00, /* 0000000 */
2041 0x00, /* 0000000 */
2042 0x00, /* 0000000 */
2043
2044 /* 127 0x7f '' */
2045 0x00, /* 0000000 */
2046 0x00, /* 0000000 */
2047 0x00, /* 0000000 */
2048 0x10, /* 0001000 */
2049 0x38, /* 0011100 */
2050 0x6c, /* 0110110 */
2051 0xc6, /* 1100011 */
2052 0xc6, /* 1100011 */
2053 0xc6, /* 1100011 */
2054 0xfe, /* 1111111 */
2055 0x00, /* 0000000 */
2056 0x00, /* 0000000 */
2057 0x00, /* 0000000 */
2058 0x00, /* 0000000 */
2059
2060 /* 128 0x80 '€' */
2061 0x00, /* 0000000 */
2062 0x38, /* 0011100 */
2063 0x6c, /* 0110110 */
2064 0xc4, /* 1100010 */
2065 0xc0, /* 1100000 */
2066 0xc0, /* 1100000 */
2067 0xc0, /* 1100000 */
2068 0xc0, /* 1100000 */
2069 0xc4, /* 1100010 */
2070 0x6c, /* 0110110 */
2071 0x38, /* 0011100 */
2072 0x18, /* 0001100 */
2073 0x70, /* 0111000 */
2074 0x00, /* 0000000 */
2075
2076 /* 129 0x81 '' */
2077 0x00, /* 0000000 */
2078 0xcc, /* 1100110 */
2079 0x00, /* 0000000 */
2080 0x00, /* 0000000 */
2081 0xcc, /* 1100110 */
2082 0xcc, /* 1100110 */
2083 0xcc, /* 1100110 */
2084 0xcc, /* 1100110 */
2085 0xcc, /* 1100110 */
2086 0xcc, /* 1100110 */
2087 0x76, /* 0111011 */
2088 0x00, /* 0000000 */
2089 0x00, /* 0000000 */
2090 0x00, /* 0000000 */
2091
2092 /* 130 0x82 '‚' */
2093 0x0c, /* 0000110 */
2094 0x18, /* 0001100 */
2095 0x30, /* 0011000 */
2096 0x00, /* 0000000 */
2097 0x78, /* 0111100 */
2098 0xcc, /* 1100110 */
2099 0xfc, /* 1111110 */
2100 0xc0, /* 1100000 */
2101 0xc0, /* 1100000 */
2102 0xcc, /* 1100110 */
2103 0x78, /* 0111100 */
2104 0x00, /* 0000000 */
2105 0x00, /* 0000000 */
2106 0x00, /* 0000000 */
2107
2108 /* 131 0x83 'ƒ' */
2109 0x10, /* 0001000 */
2110 0x38, /* 0011100 */
2111 0x6c, /* 0110110 */
2112 0x00, /* 0000000 */
2113 0x78, /* 0111100 */
2114 0x0c, /* 0000110 */
2115 0x7c, /* 0111110 */
2116 0xcc, /* 1100110 */
2117 0xcc, /* 1100110 */
2118 0xcc, /* 1100110 */
2119 0x76, /* 0111011 */
2120 0x00, /* 0000000 */
2121 0x00, /* 0000000 */
2122 0x00, /* 0000000 */
2123
2124 /* 132 0x84 '„' */
2125 0x00, /* 0000000 */
2126 0xcc, /* 1100110 */
2127 0x00, /* 0000000 */
2128 0x00, /* 0000000 */
2129 0x78, /* 0111100 */
2130 0x0c, /* 0000110 */
2131 0x7c, /* 0111110 */
2132 0xcc, /* 1100110 */
2133 0xcc, /* 1100110 */
2134 0xcc, /* 1100110 */
2135 0x76, /* 0111011 */
2136 0x00, /* 0000000 */
2137 0x00, /* 0000000 */
2138 0x00, /* 0000000 */
2139
2140 /* 133 0x85 '…' */
2141 0x60, /* 0110000 */
2142 0x30, /* 0011000 */
2143 0x18, /* 0001100 */
2144 0x00, /* 0000000 */
2145 0x78, /* 0111100 */
2146 0x0c, /* 0000110 */
2147 0x7c, /* 0111110 */
2148 0xcc, /* 1100110 */
2149 0xcc, /* 1100110 */
2150 0xcc, /* 1100110 */
2151 0x76, /* 0111011 */
2152 0x00, /* 0000000 */
2153 0x00, /* 0000000 */
2154 0x00, /* 0000000 */
2155
2156 /* 134 0x86 '†' */
2157 0x38, /* 0011100 */
2158 0x6c, /* 0110110 */
2159 0x38, /* 0011100 */
2160 0x00, /* 0000000 */
2161 0x78, /* 0111100 */
2162 0x0c, /* 0000110 */
2163 0x7c, /* 0111110 */
2164 0xcc, /* 1100110 */
2165 0xcc, /* 1100110 */
2166 0xcc, /* 1100110 */
2167 0x76, /* 0111011 */
2168 0x00, /* 0000000 */
2169 0x00, /* 0000000 */
2170 0x00, /* 0000000 */
2171
2172 /* 135 0x87 '‡' */
2173 0x00, /* 0000000 */
2174 0x00, /* 0000000 */
2175 0x00, /* 0000000 */
2176 0x00, /* 0000000 */
2177 0x78, /* 0111100 */
2178 0xcc, /* 1100110 */
2179 0xc0, /* 1100000 */
2180 0xc0, /* 1100000 */
2181 0xc0, /* 1100000 */
2182 0xcc, /* 1100110 */
2183 0x78, /* 0111100 */
2184 0x30, /* 0011000 */
2185 0x30, /* 0011000 */
2186 0xe0, /* 1110000 */
2187
2188 /* 136 0x88 'ˆ' */
2189 0x10, /* 0001000 */
2190 0x38, /* 0011100 */
2191 0x6c, /* 0110110 */
2192 0x00, /* 0000000 */
2193 0x78, /* 0111100 */
2194 0xcc, /* 1100110 */
2195 0xfc, /* 1111110 */
2196 0xc0, /* 1100000 */
2197 0xc0, /* 1100000 */
2198 0xcc, /* 1100110 */
2199 0x78, /* 0111100 */
2200 0x00, /* 0000000 */
2201 0x00, /* 0000000 */
2202 0x00, /* 0000000 */
2203
2204 /* 137 0x89 '‰' */
2205 0x00, /* 0000000 */
2206 0xcc, /* 1100110 */
2207 0x00, /* 0000000 */
2208 0x00, /* 0000000 */
2209 0x78, /* 0111100 */
2210 0xcc, /* 1100110 */
2211 0xfc, /* 1111110 */
2212 0xc0, /* 1100000 */
2213 0xc0, /* 1100000 */
2214 0xcc, /* 1100110 */
2215 0x78, /* 0111100 */
2216 0x00, /* 0000000 */
2217 0x00, /* 0000000 */
2218 0x00, /* 0000000 */
2219
2220 /* 138 0x8a 'Š' */
2221 0xc0, /* 1100000 */
2222 0x60, /* 0110000 */
2223 0x30, /* 0011000 */
2224 0x00, /* 0000000 */
2225 0x78, /* 0111100 */
2226 0xcc, /* 1100110 */
2227 0xfc, /* 1111110 */
2228 0xc0, /* 1100000 */
2229 0xc0, /* 1100000 */
2230 0xcc, /* 1100110 */
2231 0x78, /* 0111100 */
2232 0x00, /* 0000000 */
2233 0x00, /* 0000000 */
2234 0x00, /* 0000000 */
2235
2236 /* 139 0x8b '‹' */
2237 0x00, /* 0000000 */
2238 0x6c, /* 0110110 */
2239 0x00, /* 0000000 */
2240 0x00, /* 0000000 */
2241 0x38, /* 0011100 */
2242 0x18, /* 0001100 */
2243 0x18, /* 0001100 */
2244 0x18, /* 0001100 */
2245 0x18, /* 0001100 */
2246 0x18, /* 0001100 */
2247 0x3c, /* 0011110 */
2248 0x00, /* 0000000 */
2249 0x00, /* 0000000 */
2250 0x00, /* 0000000 */
2251
2252 /* 140 0x8c 'Œ' */
2253 0x30, /* 0011000 */
2254 0x78, /* 0111100 */
2255 0xcc, /* 1100110 */
2256 0x00, /* 0000000 */
2257 0x70, /* 0111000 */
2258 0x30, /* 0011000 */
2259 0x30, /* 0011000 */
2260 0x30, /* 0011000 */
2261 0x30, /* 0011000 */
2262 0x30, /* 0011000 */
2263 0x78, /* 0111100 */
2264 0x00, /* 0000000 */
2265 0x00, /* 0000000 */
2266 0x00, /* 0000000 */
2267
2268 /* 141 0x8d '' */
2269 0xc0, /* 1100000 */
2270 0x60, /* 0110000 */
2271 0x30, /* 0011000 */
2272 0x00, /* 0000000 */
2273 0x70, /* 0111000 */
2274 0x30, /* 0011000 */
2275 0x30, /* 0011000 */
2276 0x30, /* 0011000 */
2277 0x30, /* 0011000 */
2278 0x30, /* 0011000 */
2279 0x78, /* 0111100 */
2280 0x00, /* 0000000 */
2281 0x00, /* 0000000 */
2282 0x00, /* 0000000 */
2283
2284 /* 142 0x8e 'Ž' */
2285 0x00, /* 0000000 */
2286 0xcc, /* 1100110 */
2287 0x00, /* 0000000 */
2288 0x30, /* 0011000 */
2289 0x78, /* 0111100 */
2290 0xcc, /* 1100110 */
2291 0xcc, /* 1100110 */
2292 0xfc, /* 1111110 */
2293 0xcc, /* 1100110 */
2294 0xcc, /* 1100110 */
2295 0xcc, /* 1100110 */
2296 0x00, /* 0000000 */
2297 0x00, /* 0000000 */
2298 0x00, /* 0000000 */
2299
2300 /* 143 0x8f '' */
2301 0x30, /* 0011000 */
2302 0x48, /* 0100100 */
2303 0x48, /* 0100100 */
2304 0x30, /* 0011000 */
2305 0x78, /* 0111100 */
2306 0xcc, /* 1100110 */
2307 0xfc, /* 1111110 */
2308 0xcc, /* 1100110 */
2309 0xcc, /* 1100110 */
2310 0xcc, /* 1100110 */
2311 0xcc, /* 1100110 */
2312 0x00, /* 0000000 */
2313 0x00, /* 0000000 */
2314 0x00, /* 0000000 */
2315
2316 /* 144 0x90 '' */
2317 0x18, /* 0001100 */
2318 0x30, /* 0011000 */
2319 0xfc, /* 1111110 */
2320 0xcc, /* 1100110 */
2321 0xc4, /* 1100010 */
2322 0xd0, /* 1101000 */
2323 0xf0, /* 1111000 */
2324 0xd0, /* 1101000 */
2325 0xc4, /* 1100010 */
2326 0xcc, /* 1100110 */
2327 0xfc, /* 1111110 */
2328 0x00, /* 0000000 */
2329 0x00, /* 0000000 */
2330 0x00, /* 0000000 */
2331
2332 /* 145 0x91 '‘' */
2333 0x00, /* 0000000 */
2334 0x00, /* 0000000 */
2335 0x00, /* 0000000 */
2336 0x00, /* 0000000 */
2337 0xec, /* 1110110 */
2338 0x36, /* 0011011 */
2339 0x36, /* 0011011 */
2340 0x7e, /* 0111111 */
2341 0xd8, /* 1101100 */
2342 0xd8, /* 1101100 */
2343 0x6e, /* 0110111 */
2344 0x00, /* 0000000 */
2345 0x00, /* 0000000 */
2346 0x00, /* 0000000 */
2347
2348 /* 146 0x92 '’' */
2349 0x00, /* 0000000 */
2350 0x3e, /* 0011111 */
2351 0x6c, /* 0110110 */
2352 0xcc, /* 1100110 */
2353 0xcc, /* 1100110 */
2354 0xfe, /* 1111111 */
2355 0xcc, /* 1100110 */
2356 0xcc, /* 1100110 */
2357 0xcc, /* 1100110 */
2358 0xcc, /* 1100110 */
2359 0xce, /* 1100111 */
2360 0x00, /* 0000000 */
2361 0x00, /* 0000000 */
2362 0x00, /* 0000000 */
2363
2364 /* 147 0x93 '“' */
2365 0x10, /* 0001000 */
2366 0x38, /* 0011100 */
2367 0x6c, /* 0110110 */
2368 0x00, /* 0000000 */
2369 0x78, /* 0111100 */
2370 0xcc, /* 1100110 */
2371 0xcc, /* 1100110 */
2372 0xcc, /* 1100110 */
2373 0xcc, /* 1100110 */
2374 0xcc, /* 1100110 */
2375 0x78, /* 0111100 */
2376 0x00, /* 0000000 */
2377 0x00, /* 0000000 */
2378 0x00, /* 0000000 */
2379
2380 /* 148 0x94 '”' */
2381 0x00, /* 0000000 */
2382 0xcc, /* 1100110 */
2383 0x00, /* 0000000 */
2384 0x00, /* 0000000 */
2385 0x78, /* 0111100 */
2386 0xcc, /* 1100110 */
2387 0xcc, /* 1100110 */
2388 0xcc, /* 1100110 */
2389 0xcc, /* 1100110 */
2390 0xcc, /* 1100110 */
2391 0x78, /* 0111100 */
2392 0x00, /* 0000000 */
2393 0x00, /* 0000000 */
2394 0x00, /* 0000000 */
2395
2396 /* 149 0x95 '•' */
2397 0xc0, /* 1100000 */
2398 0x60, /* 0110000 */
2399 0x30, /* 0011000 */
2400 0x00, /* 0000000 */
2401 0x78, /* 0111100 */
2402 0xcc, /* 1100110 */
2403 0xcc, /* 1100110 */
2404 0xcc, /* 1100110 */
2405 0xcc, /* 1100110 */
2406 0xcc, /* 1100110 */
2407 0x78, /* 0111100 */
2408 0x00, /* 0000000 */
2409 0x00, /* 0000000 */
2410 0x00, /* 0000000 */
2411
2412 /* 150 0x96 '–' */
2413 0x30, /* 0011000 */
2414 0x78, /* 0111100 */
2415 0xcc, /* 1100110 */
2416 0x00, /* 0000000 */
2417 0xcc, /* 1100110 */
2418 0xcc, /* 1100110 */
2419 0xcc, /* 1100110 */
2420 0xcc, /* 1100110 */
2421 0xcc, /* 1100110 */
2422 0xcc, /* 1100110 */
2423 0x76, /* 0111011 */
2424 0x00, /* 0000000 */
2425 0x00, /* 0000000 */
2426 0x00, /* 0000000 */
2427
2428 /* 151 0x97 '—' */
2429 0x60, /* 0110000 */
2430 0x30, /* 0011000 */
2431 0x18, /* 0001100 */
2432 0x00, /* 0000000 */
2433 0xcc, /* 1100110 */
2434 0xcc, /* 1100110 */
2435 0xcc, /* 1100110 */
2436 0xcc, /* 1100110 */
2437 0xcc, /* 1100110 */
2438 0xcc, /* 1100110 */
2439 0x76, /* 0111011 */
2440 0x00, /* 0000000 */
2441 0x00, /* 0000000 */
2442 0x00, /* 0000000 */
2443
2444 /* 152 0x98 '˜' */
2445 0x00, /* 0000000 */
2446 0xcc, /* 1100110 */
2447 0x00, /* 0000000 */
2448 0x00, /* 0000000 */
2449 0xcc, /* 1100110 */
2450 0xcc, /* 1100110 */
2451 0xcc, /* 1100110 */
2452 0xcc, /* 1100110 */
2453 0xcc, /* 1100110 */
2454 0xcc, /* 1100110 */
2455 0x7c, /* 0111110 */
2456 0x0c, /* 0000110 */
2457 0x18, /* 0001100 */
2458 0x70, /* 0111000 */
2459
2460 /* 153 0x99 '™' */
2461 0xcc, /* 1100110 */
2462 0x00, /* 0000000 */
2463 0x78, /* 0111100 */
2464 0xcc, /* 1100110 */
2465 0xcc, /* 1100110 */
2466 0xcc, /* 1100110 */
2467 0xcc, /* 1100110 */
2468 0xcc, /* 1100110 */
2469 0xcc, /* 1100110 */
2470 0xcc, /* 1100110 */
2471 0x78, /* 0111100 */
2472 0x00, /* 0000000 */
2473 0x00, /* 0000000 */
2474 0x00, /* 0000000 */
2475
2476 /* 154 0x9a 'š' */
2477 0xcc, /* 1100110 */
2478 0x00, /* 0000000 */
2479 0xcc, /* 1100110 */
2480 0xcc, /* 1100110 */
2481 0xcc, /* 1100110 */
2482 0xcc, /* 1100110 */
2483 0xcc, /* 1100110 */
2484 0xcc, /* 1100110 */
2485 0xcc, /* 1100110 */
2486 0xcc, /* 1100110 */
2487 0x78, /* 0111100 */
2488 0x00, /* 0000000 */
2489 0x00, /* 0000000 */
2490 0x00, /* 0000000 */
2491
2492 /* 155 0x9b '›' */
2493 0x30, /* 0011000 */
2494 0x30, /* 0011000 */
2495 0x7c, /* 0111110 */
2496 0xcc, /* 1100110 */
2497 0xc0, /* 1100000 */
2498 0xc0, /* 1100000 */
2499 0xc0, /* 1100000 */
2500 0xcc, /* 1100110 */
2501 0x7c, /* 0111110 */
2502 0x30, /* 0011000 */
2503 0x30, /* 0011000 */
2504 0x00, /* 0000000 */
2505 0x00, /* 0000000 */
2506 0x00, /* 0000000 */
2507
2508 /* 156 0x9c 'œ' */
2509 0x38, /* 0011100 */
2510 0x6c, /* 0110110 */
2511 0x64, /* 0110010 */
2512 0x60, /* 0110000 */
2513 0xf0, /* 1111000 */
2514 0x60, /* 0110000 */
2515 0x60, /* 0110000 */
2516 0x60, /* 0110000 */
2517 0x60, /* 0110000 */
2518 0xe6, /* 1110011 */
2519 0xfc, /* 1111110 */
2520 0x00, /* 0000000 */
2521 0x00, /* 0000000 */
2522 0x00, /* 0000000 */
2523
2524 /* 157 0x9d '' */
2525 0x00, /* 0000000 */
2526 0xcc, /* 1100110 */
2527 0xcc, /* 1100110 */
2528 0x78, /* 0111100 */
2529 0x30, /* 0011000 */
2530 0xfc, /* 1111110 */
2531 0x30, /* 0011000 */
2532 0xfc, /* 1111110 */
2533 0x30, /* 0011000 */
2534 0x30, /* 0011000 */
2535 0x30, /* 0011000 */
2536 0x00, /* 0000000 */
2537 0x00, /* 0000000 */
2538 0x00, /* 0000000 */
2539
2540 /* 158 0x9e 'ž' */
2541 0xf8, /* 1111100 */
2542 0xcc, /* 1100110 */
2543 0xcc, /* 1100110 */
2544 0xf8, /* 1111100 */
2545 0xc4, /* 1100010 */
2546 0xcc, /* 1100110 */
2547 0xde, /* 1101111 */
2548 0xcc, /* 1100110 */
2549 0xcc, /* 1100110 */
2550 0xcc, /* 1100110 */
2551 0xc6, /* 1100011 */
2552 0x00, /* 0000000 */
2553 0x00, /* 0000000 */
2554 0x00, /* 0000000 */
2555
2556 /* 159 0x9f 'Ÿ' */
2557 0x1c, /* 0001110 */
2558 0x36, /* 0011011 */
2559 0x30, /* 0011000 */
2560 0x30, /* 0011000 */
2561 0x30, /* 0011000 */
2562 0xfc, /* 1111110 */
2563 0x30, /* 0011000 */
2564 0x30, /* 0011000 */
2565 0x30, /* 0011000 */
2566 0xb0, /* 1011000 */
2567 0xe0, /* 1110000 */
2568 0x00, /* 0000000 */
2569 0x00, /* 0000000 */
2570 0x00, /* 0000000 */
2571
2572 /* 160 0xa0 ' ' */
2573 0x18, /* 0001100 */
2574 0x30, /* 0011000 */
2575 0x60, /* 0110000 */
2576 0x00, /* 0000000 */
2577 0x78, /* 0111100 */
2578 0x0c, /* 0000110 */
2579 0x7c, /* 0111110 */
2580 0xcc, /* 1100110 */
2581 0xcc, /* 1100110 */
2582 0xcc, /* 1100110 */
2583 0x76, /* 0111011 */
2584 0x00, /* 0000000 */
2585 0x00, /* 0000000 */
2586 0x00, /* 0000000 */
2587
2588 /* 161 0xa1 '¡' */
2589 0x18, /* 0001100 */
2590 0x30, /* 0011000 */
2591 0x60, /* 0110000 */
2592 0x00, /* 0000000 */
2593 0x70, /* 0111000 */
2594 0x30, /* 0011000 */
2595 0x30, /* 0011000 */
2596 0x30, /* 0011000 */
2597 0x30, /* 0011000 */
2598 0x30, /* 0011000 */
2599 0x78, /* 0111100 */
2600 0x00, /* 0000000 */
2601 0x00, /* 0000000 */
2602 0x00, /* 0000000 */
2603
2604 /* 162 0xa2 '¢' */
2605 0x18, /* 0001100 */
2606 0x30, /* 0011000 */
2607 0x60, /* 0110000 */
2608 0x00, /* 0000000 */
2609 0x78, /* 0111100 */
2610 0xcc, /* 1100110 */
2611 0xcc, /* 1100110 */
2612 0xcc, /* 1100110 */
2613 0xcc, /* 1100110 */
2614 0xcc, /* 1100110 */
2615 0x78, /* 0111100 */
2616 0x00, /* 0000000 */
2617 0x00, /* 0000000 */
2618 0x00, /* 0000000 */
2619
2620 /* 163 0xa3 '£' */
2621 0x18, /* 0001100 */
2622 0x30, /* 0011000 */
2623 0x60, /* 0110000 */
2624 0x00, /* 0000000 */
2625 0xcc, /* 1100110 */
2626 0xcc, /* 1100110 */
2627 0xcc, /* 1100110 */
2628 0xcc, /* 1100110 */
2629 0xcc, /* 1100110 */
2630 0xcc, /* 1100110 */
2631 0x76, /* 0111011 */
2632 0x00, /* 0000000 */
2633 0x00, /* 0000000 */
2634 0x00, /* 0000000 */
2635
2636 /* 164 0xa4 '¤' */
2637 0x00, /* 0000000 */
2638 0x76, /* 0111011 */
2639 0xdc, /* 1101110 */
2640 0x00, /* 0000000 */
2641 0xb8, /* 1011100 */
2642 0xcc, /* 1100110 */
2643 0xcc, /* 1100110 */
2644 0xcc, /* 1100110 */
2645 0xcc, /* 1100110 */
2646 0xcc, /* 1100110 */
2647 0xcc, /* 1100110 */
2648 0x00, /* 0000000 */
2649 0x00, /* 0000000 */
2650 0x00, /* 0000000 */
2651
2652 /* 165 0xa5 '¥' */
2653 0x76, /* 0111011 */
2654 0xdc, /* 1101110 */
2655 0x00, /* 0000000 */
2656 0xcc, /* 1100110 */
2657 0xec, /* 1110110 */
2658 0xec, /* 1110110 */
2659 0xfc, /* 1111110 */
2660 0xdc, /* 1101110 */
2661 0xcc, /* 1100110 */
2662 0xcc, /* 1100110 */
2663 0xcc, /* 1100110 */
2664 0x00, /* 0000000 */
2665 0x00, /* 0000000 */
2666 0x00, /* 0000000 */
2667
2668 /* 166 0xa6 '¦' */
2669 0x00, /* 0000000 */
2670 0x78, /* 0111100 */
2671 0xd8, /* 1101100 */
2672 0xd8, /* 1101100 */
2673 0x7c, /* 0111110 */
2674 0x00, /* 0000000 */
2675 0xfc, /* 1111110 */
2676 0x00, /* 0000000 */
2677 0x00, /* 0000000 */
2678 0x00, /* 0000000 */
2679 0x00, /* 0000000 */
2680 0x00, /* 0000000 */
2681 0x00, /* 0000000 */
2682 0x00, /* 0000000 */
2683
2684 /* 167 0xa7 '§' */
2685 0x00, /* 0000000 */
2686 0x70, /* 0111000 */
2687 0xd8, /* 1101100 */
2688 0xd8, /* 1101100 */
2689 0x70, /* 0111000 */
2690 0x00, /* 0000000 */
2691 0xf8, /* 1111100 */
2692 0x00, /* 0000000 */
2693 0x00, /* 0000000 */
2694 0x00, /* 0000000 */
2695 0x00, /* 0000000 */
2696 0x00, /* 0000000 */
2697 0x00, /* 0000000 */
2698 0x00, /* 0000000 */
2699
2700 /* 168 0xa8 '¨' */
2701 0x00, /* 0000000 */
2702 0x30, /* 0011000 */
2703 0x30, /* 0011000 */
2704 0x00, /* 0000000 */
2705 0x30, /* 0011000 */
2706 0x30, /* 0011000 */
2707 0x60, /* 0110000 */
2708 0xc0, /* 1100000 */
2709 0xcc, /* 1100110 */
2710 0xcc, /* 1100110 */
2711 0x78, /* 0111100 */
2712 0x00, /* 0000000 */
2713 0x00, /* 0000000 */
2714 0x00, /* 0000000 */
2715
2716 /* 169 0xa9 '©' */
2717 0x00, /* 0000000 */
2718 0x00, /* 0000000 */
2719 0x00, /* 0000000 */
2720 0x00, /* 0000000 */
2721 0x00, /* 0000000 */
2722 0xfc, /* 1111110 */
2723 0xc0, /* 1100000 */
2724 0xc0, /* 1100000 */
2725 0xc0, /* 1100000 */
2726 0xc0, /* 1100000 */
2727 0x00, /* 0000000 */
2728 0x00, /* 0000000 */
2729 0x00, /* 0000000 */
2730 0x00, /* 0000000 */
2731
2732 /* 170 0xaa 'ª' */
2733 0x00, /* 0000000 */
2734 0x00, /* 0000000 */
2735 0x00, /* 0000000 */
2736 0x00, /* 0000000 */
2737 0x00, /* 0000000 */
2738 0xfc, /* 1111110 */
2739 0x0c, /* 0000110 */
2740 0x0c, /* 0000110 */
2741 0x0c, /* 0000110 */
2742 0x0c, /* 0000110 */
2743 0x00, /* 0000000 */
2744 0x00, /* 0000000 */
2745 0x00, /* 0000000 */
2746 0x00, /* 0000000 */
2747
2748 /* 171 0xab '«' */
2749 0x60, /* 0110000 */
2750 0xe0, /* 1110000 */
2751 0x62, /* 0110001 */
2752 0x66, /* 0110011 */
2753 0x6c, /* 0110110 */
2754 0x18, /* 0001100 */
2755 0x30, /* 0011000 */
2756 0x60, /* 0110000 */
2757 0xc0, /* 1100000 */
2758 0xb8, /* 1011100 */
2759 0x4c, /* 0100110 */
2760 0x18, /* 0001100 */
2761 0x30, /* 0011000 */
2762 0x7c, /* 0111110 */
2763
2764 /* 172 0xac '¬' */
2765 0x60, /* 0110000 */
2766 0xe0, /* 1110000 */
2767 0x62, /* 0110001 */
2768 0x66, /* 0110011 */
2769 0x6c, /* 0110110 */
2770 0x18, /* 0001100 */
2771 0x30, /* 0011000 */
2772 0x6c, /* 0110110 */
2773 0xdc, /* 1101110 */
2774 0xb4, /* 1011010 */
2775 0x7e, /* 0111111 */
2776 0x0c, /* 0000110 */
2777 0x0c, /* 0000110 */
2778 0x00, /* 0000000 */
2779
2780 /* 173 0xad '­' */
2781 0x00, /* 0000000 */
2782 0x30, /* 0011000 */
2783 0x30, /* 0011000 */
2784 0x00, /* 0000000 */
2785 0x30, /* 0011000 */
2786 0x30, /* 0011000 */
2787 0x30, /* 0011000 */
2788 0x78, /* 0111100 */
2789 0x78, /* 0111100 */
2790 0x78, /* 0111100 */
2791 0x30, /* 0011000 */
2792 0x00, /* 0000000 */
2793 0x00, /* 0000000 */
2794 0x00, /* 0000000 */
2795
2796 /* 174 0xae '®' */
2797 0x00, /* 0000000 */
2798 0x00, /* 0000000 */
2799 0x00, /* 0000000 */
2800 0x00, /* 0000000 */
2801 0x36, /* 0011011 */
2802 0x6c, /* 0110110 */
2803 0xd8, /* 1101100 */
2804 0x6c, /* 0110110 */
2805 0x36, /* 0011011 */
2806 0x00, /* 0000000 */
2807 0x00, /* 0000000 */
2808 0x00, /* 0000000 */
2809 0x00, /* 0000000 */
2810 0x00, /* 0000000 */
2811
2812 /* 175 0xaf '¯' */
2813 0x00, /* 0000000 */
2814 0x00, /* 0000000 */
2815 0x00, /* 0000000 */
2816 0x00, /* 0000000 */
2817 0xd8, /* 1101100 */
2818 0x6c, /* 0110110 */
2819 0x36, /* 0011011 */
2820 0x6c, /* 0110110 */
2821 0xd8, /* 1101100 */
2822 0x00, /* 0000000 */
2823 0x00, /* 0000000 */
2824 0x00, /* 0000000 */
2825 0x00, /* 0000000 */
2826 0x00, /* 0000000 */
2827
2828 /* 176 0xb0 '°' */
2829 0x88, /* 1000100 */
2830 0x22, /* 0010001 */
2831 0x88, /* 1000100 */
2832 0x22, /* 0010001 */
2833 0x88, /* 1000100 */
2834 0x22, /* 0010001 */
2835 0x88, /* 1000100 */
2836 0x22, /* 0010001 */
2837 0x88, /* 1000100 */
2838 0x22, /* 0010001 */
2839 0x88, /* 1000100 */
2840 0x22, /* 0010001 */
2841 0x88, /* 1000100 */
2842 0x22, /* 0010001 */
2843
2844 /* 177 0xb1 '±' */
2845 0x54, /* 0101010 */
2846 0xaa, /* 1010101 */
2847 0x54, /* 0101010 */
2848 0xaa, /* 1010101 */
2849 0x54, /* 0101010 */
2850 0xaa, /* 1010101 */
2851 0x54, /* 0101010 */
2852 0xaa, /* 1010101 */
2853 0x54, /* 0101010 */
2854 0xaa, /* 1010101 */
2855 0x54, /* 0101010 */
2856 0xaa, /* 1010101 */
2857 0x54, /* 0101010 */
2858 0xaa, /* 1010101 */
2859
2860 /* 178 0xb2 '²' */
2861 0xee, /* 1110111 */
2862 0xba, /* 1011101 */
2863 0xee, /* 1110111 */
2864 0xba, /* 1011101 */
2865 0xee, /* 1110111 */
2866 0xba, /* 1011101 */
2867 0xee, /* 1110111 */
2868 0xba, /* 1011101 */
2869 0xee, /* 1110111 */
2870 0xba, /* 1011101 */
2871 0xee, /* 1110111 */
2872 0xba, /* 1011101 */
2873 0xee, /* 1110111 */
2874 0xba, /* 1011101 */
2875
2876 /* 179 0xb3 '³' */
2877 0x30, /* 0011000 */
2878 0x30, /* 0011000 */
2879 0x30, /* 0011000 */
2880 0x30, /* 0011000 */
2881 0x30, /* 0011000 */
2882 0x30, /* 0011000 */
2883 0x30, /* 0011000 */
2884 0x30, /* 0011000 */
2885 0x30, /* 0011000 */
2886 0x30, /* 0011000 */
2887 0x30, /* 0011000 */
2888 0x30, /* 0011000 */
2889 0x30, /* 0011000 */
2890 0x30, /* 0011000 */
2891
2892 /* 180 0xb4 '´' */
2893 0x30, /* 0011000 */
2894 0x30, /* 0011000 */
2895 0x30, /* 0011000 */
2896 0x30, /* 0011000 */
2897 0x30, /* 0011000 */
2898 0x30, /* 0011000 */
2899 0xf0, /* 1111000 */
2900 0x30, /* 0011000 */
2901 0x30, /* 0011000 */
2902 0x30, /* 0011000 */
2903 0x30, /* 0011000 */
2904 0x30, /* 0011000 */
2905 0x30, /* 0011000 */
2906 0x30, /* 0011000 */
2907
2908 /* 181 0xb5 'µ' */
2909 0x30, /* 0011000 */
2910 0x30, /* 0011000 */
2911 0x30, /* 0011000 */
2912 0x30, /* 0011000 */
2913 0xf0, /* 1111000 */
2914 0x30, /* 0011000 */
2915 0xf0, /* 1111000 */
2916 0x30, /* 0011000 */
2917 0x30, /* 0011000 */
2918 0x30, /* 0011000 */
2919 0x30, /* 0011000 */
2920 0x30, /* 0011000 */
2921 0x30, /* 0011000 */
2922 0x30, /* 0011000 */
2923
2924 /* 182 0xb6 '¶' */
2925 0x6c, /* 0110110 */
2926 0x6c, /* 0110110 */
2927 0x6c, /* 0110110 */
2928 0x6c, /* 0110110 */
2929 0x6c, /* 0110110 */
2930 0x6c, /* 0110110 */
2931 0xec, /* 1110110 */
2932 0x6c, /* 0110110 */
2933 0x6c, /* 0110110 */
2934 0x6c, /* 0110110 */
2935 0x6c, /* 0110110 */
2936 0x6c, /* 0110110 */
2937 0x6c, /* 0110110 */
2938 0x6c, /* 0110110 */
2939
2940 /* 183 0xb7 '·' */
2941 0x00, /* 0000000 */
2942 0x00, /* 0000000 */
2943 0x00, /* 0000000 */
2944 0x00, /* 0000000 */
2945 0x00, /* 0000000 */
2946 0x00, /* 0000000 */
2947 0xfc, /* 1111110 */
2948 0x6c, /* 0110110 */
2949 0x6c, /* 0110110 */
2950 0x6c, /* 0110110 */
2951 0x6c, /* 0110110 */
2952 0x6c, /* 0110110 */
2953 0x6c, /* 0110110 */
2954 0x6c, /* 0110110 */
2955
2956 /* 184 0xb8 '¸' */
2957 0x00, /* 0000000 */
2958 0x00, /* 0000000 */
2959 0x00, /* 0000000 */
2960 0x00, /* 0000000 */
2961 0xf0, /* 1111000 */
2962 0x30, /* 0011000 */
2963 0xf0, /* 1111000 */
2964 0x30, /* 0011000 */
2965 0x30, /* 0011000 */
2966 0x30, /* 0011000 */
2967 0x30, /* 0011000 */
2968 0x30, /* 0011000 */
2969 0x30, /* 0011000 */
2970 0x30, /* 0011000 */
2971
2972 /* 185 0xb9 '¹' */
2973 0x6c, /* 0110110 */
2974 0x6c, /* 0110110 */
2975 0x6c, /* 0110110 */
2976 0x6c, /* 0110110 */
2977 0xec, /* 1110110 */
2978 0x0c, /* 0000110 */
2979 0xec, /* 1110110 */
2980 0x6c, /* 0110110 */
2981 0x6c, /* 0110110 */
2982 0x6c, /* 0110110 */
2983 0x6c, /* 0110110 */
2984 0x6c, /* 0110110 */
2985 0x6c, /* 0110110 */
2986 0x6c, /* 0110110 */
2987
2988 /* 186 0xba 'º' */
2989 0x6c, /* 0110110 */
2990 0x6c, /* 0110110 */
2991 0x6c, /* 0110110 */
2992 0x6c, /* 0110110 */
2993 0x6c, /* 0110110 */
2994 0x6c, /* 0110110 */
2995 0x6c, /* 0110110 */
2996 0x6c, /* 0110110 */
2997 0x6c, /* 0110110 */
2998 0x6c, /* 0110110 */
2999 0x6c, /* 0110110 */
3000 0x6c, /* 0110110 */
3001 0x6c, /* 0110110 */
3002 0x6c, /* 0110110 */
3003
3004 /* 187 0xbb '»' */
3005 0x00, /* 0000000 */
3006 0x00, /* 0000000 */
3007 0x00, /* 0000000 */
3008 0x00, /* 0000000 */
3009 0xfc, /* 1111110 */
3010 0x0c, /* 0000110 */
3011 0xec, /* 1110110 */
3012 0x6c, /* 0110110 */
3013 0x6c, /* 0110110 */
3014 0x6c, /* 0110110 */
3015 0x6c, /* 0110110 */
3016 0x6c, /* 0110110 */
3017 0x6c, /* 0110110 */
3018 0x6c, /* 0110110 */
3019
3020 /* 188 0xbc '¼' */
3021 0x6c, /* 0110110 */
3022 0x6c, /* 0110110 */
3023 0x6c, /* 0110110 */
3024 0x6c, /* 0110110 */
3025 0xec, /* 1110110 */
3026 0x0c, /* 0000110 */
3027 0xfc, /* 1111110 */
3028 0x00, /* 0000000 */
3029 0x00, /* 0000000 */
3030 0x00, /* 0000000 */
3031 0x00, /* 0000000 */
3032 0x00, /* 0000000 */
3033 0x00, /* 0000000 */
3034 0x00, /* 0000000 */
3035
3036 /* 189 0xbd '½' */
3037 0x6c, /* 0110110 */
3038 0x6c, /* 0110110 */
3039 0x6c, /* 0110110 */
3040 0x6c, /* 0110110 */
3041 0x6c, /* 0110110 */
3042 0x6c, /* 0110110 */
3043 0xfc, /* 1111110 */
3044 0x00, /* 0000000 */
3045 0x00, /* 0000000 */
3046 0x00, /* 0000000 */
3047 0x00, /* 0000000 */
3048 0x00, /* 0000000 */
3049 0x00, /* 0000000 */
3050 0x00, /* 0000000 */
3051
3052 /* 190 0xbe '¾' */
3053 0x30, /* 0011000 */
3054 0x30, /* 0011000 */
3055 0x30, /* 0011000 */
3056 0x30, /* 0011000 */
3057 0xf0, /* 1111000 */
3058 0x30, /* 0011000 */
3059 0xf0, /* 1111000 */
3060 0x00, /* 0000000 */
3061 0x00, /* 0000000 */
3062 0x00, /* 0000000 */
3063 0x00, /* 0000000 */
3064 0x00, /* 0000000 */
3065 0x00, /* 0000000 */
3066 0x00, /* 0000000 */
3067
3068 /* 191 0xbf '¿' */
3069 0x00, /* 0000000 */
3070 0x00, /* 0000000 */
3071 0x00, /* 0000000 */
3072 0x00, /* 0000000 */
3073 0x00, /* 0000000 */
3074 0x00, /* 0000000 */
3075 0xf0, /* 1111000 */
3076 0x30, /* 0011000 */
3077 0x30, /* 0011000 */
3078 0x30, /* 0011000 */
3079 0x30, /* 0011000 */
3080 0x30, /* 0011000 */
3081 0x30, /* 0011000 */
3082 0x30, /* 0011000 */
3083
3084 /* 192 0xc0 'À' */
3085 0x30, /* 0011000 */
3086 0x30, /* 0011000 */
3087 0x30, /* 0011000 */
3088 0x30, /* 0011000 */
3089 0x30, /* 0011000 */
3090 0x30, /* 0011000 */
3091 0x3e, /* 0011111 */
3092 0x00, /* 0000000 */
3093 0x00, /* 0000000 */
3094 0x00, /* 0000000 */
3095 0x00, /* 0000000 */
3096 0x00, /* 0000000 */
3097 0x00, /* 0000000 */
3098 0x00, /* 0000000 */
3099
3100 /* 193 0xc1 'Á' */
3101 0x30, /* 0011000 */
3102 0x30, /* 0011000 */
3103 0x30, /* 0011000 */
3104 0x30, /* 0011000 */
3105 0x30, /* 0011000 */
3106 0x30, /* 0011000 */
3107 0xfe, /* 1111111 */
3108 0x00, /* 0000000 */
3109 0x00, /* 0000000 */
3110 0x00, /* 0000000 */
3111 0x00, /* 0000000 */
3112 0x00, /* 0000000 */
3113 0x00, /* 0000000 */
3114 0x00, /* 0000000 */
3115
3116 /* 194 0xc2 'Â' */
3117 0x00, /* 0000000 */
3118 0x00, /* 0000000 */
3119 0x00, /* 0000000 */
3120 0x00, /* 0000000 */
3121 0x00, /* 0000000 */
3122 0x00, /* 0000000 */
3123 0xfe, /* 1111111 */
3124 0x30, /* 0011000 */
3125 0x30, /* 0011000 */
3126 0x30, /* 0011000 */
3127 0x30, /* 0011000 */
3128 0x30, /* 0011000 */
3129 0x30, /* 0011000 */
3130 0x30, /* 0011000 */
3131
3132 /* 195 0xc3 'Ã' */
3133 0x30, /* 0011000 */
3134 0x30, /* 0011000 */
3135 0x30, /* 0011000 */
3136 0x30, /* 0011000 */
3137 0x30, /* 0011000 */
3138 0x30, /* 0011000 */
3139 0x3e, /* 0011111 */
3140 0x30, /* 0011000 */
3141 0x30, /* 0011000 */
3142 0x30, /* 0011000 */
3143 0x30, /* 0011000 */
3144 0x30, /* 0011000 */
3145 0x30, /* 0011000 */
3146 0x30, /* 0011000 */
3147
3148 /* 196 0xc4 'Ä' */
3149 0x00, /* 0000000 */
3150 0x00, /* 0000000 */
3151 0x00, /* 0000000 */
3152 0x00, /* 0000000 */
3153 0x00, /* 0000000 */
3154 0x00, /* 0000000 */
3155 0xfe, /* 1111111 */
3156 0x00, /* 0000000 */
3157 0x00, /* 0000000 */
3158 0x00, /* 0000000 */
3159 0x00, /* 0000000 */
3160 0x00, /* 0000000 */
3161 0x00, /* 0000000 */
3162 0x00, /* 0000000 */
3163
3164 /* 197 0xc5 'Å' */
3165 0x30, /* 0011000 */
3166 0x30, /* 0011000 */
3167 0x30, /* 0011000 */
3168 0x30, /* 0011000 */
3169 0x30, /* 0011000 */
3170 0x30, /* 0011000 */
3171 0xfe, /* 1111111 */
3172 0x30, /* 0011000 */
3173 0x30, /* 0011000 */
3174 0x30, /* 0011000 */
3175 0x30, /* 0011000 */
3176 0x30, /* 0011000 */
3177 0x30, /* 0011000 */
3178 0x30, /* 0011000 */
3179
3180 /* 198 0xc6 'Æ' */
3181 0x30, /* 0011000 */
3182 0x30, /* 0011000 */
3183 0x30, /* 0011000 */
3184 0x30, /* 0011000 */
3185 0x3e, /* 0011111 */
3186 0x30, /* 0011000 */
3187 0x3e, /* 0011111 */
3188 0x30, /* 0011000 */
3189 0x30, /* 0011000 */
3190 0x30, /* 0011000 */
3191 0x30, /* 0011000 */
3192 0x30, /* 0011000 */
3193 0x30, /* 0011000 */
3194 0x30, /* 0011000 */
3195
3196 /* 199 0xc7 'Ç' */
3197 0x6c, /* 0110110 */
3198 0x6c, /* 0110110 */
3199 0x6c, /* 0110110 */
3200 0x6c, /* 0110110 */
3201 0x6c, /* 0110110 */
3202 0x6c, /* 0110110 */
3203 0x6e, /* 0110111 */
3204 0x6c, /* 0110110 */
3205 0x6c, /* 0110110 */
3206 0x6c, /* 0110110 */
3207 0x6c, /* 0110110 */
3208 0x6c, /* 0110110 */
3209 0x6c, /* 0110110 */
3210 0x6c, /* 0110110 */
3211
3212 /* 200 0xc8 'È' */
3213 0x6c, /* 0110110 */
3214 0x6c, /* 0110110 */
3215 0x6c, /* 0110110 */
3216 0x6c, /* 0110110 */
3217 0x6e, /* 0110111 */
3218 0x60, /* 0110000 */
3219 0x7e, /* 0111111 */
3220 0x00, /* 0000000 */
3221 0x00, /* 0000000 */
3222 0x00, /* 0000000 */
3223 0x00, /* 0000000 */
3224 0x00, /* 0000000 */
3225 0x00, /* 0000000 */
3226 0x00, /* 0000000 */
3227
3228 /* 201 0xc9 'É' */
3229 0x00, /* 0000000 */
3230 0x00, /* 0000000 */
3231 0x00, /* 0000000 */
3232 0x00, /* 0000000 */
3233 0x7e, /* 0111111 */
3234 0x60, /* 0110000 */
3235 0x6e, /* 0110111 */
3236 0x6c, /* 0110110 */
3237 0x6c, /* 0110110 */
3238 0x6c, /* 0110110 */
3239 0x6c, /* 0110110 */
3240 0x6c, /* 0110110 */
3241 0x6c, /* 0110110 */
3242 0x6c, /* 0110110 */
3243
3244 /* 202 0xca 'Ê' */
3245 0x6c, /* 0110110 */
3246 0x6c, /* 0110110 */
3247 0x6c, /* 0110110 */
3248 0x6c, /* 0110110 */
3249 0xee, /* 1110111 */
3250 0x00, /* 0000000 */
3251 0xfe, /* 1111111 */
3252 0x00, /* 0000000 */
3253 0x00, /* 0000000 */
3254 0x00, /* 0000000 */
3255 0x00, /* 0000000 */
3256 0x00, /* 0000000 */
3257 0x00, /* 0000000 */
3258 0x00, /* 0000000 */
3259
3260 /* 203 0xcb 'Ë' */
3261 0x00, /* 0000000 */
3262 0x00, /* 0000000 */
3263 0x00, /* 0000000 */
3264 0x00, /* 0000000 */
3265 0xfe, /* 1111111 */
3266 0x00, /* 0000000 */
3267 0xee, /* 1110111 */
3268 0x6c, /* 0110110 */
3269 0x6c, /* 0110110 */
3270 0x6c, /* 0110110 */
3271 0x6c, /* 0110110 */
3272 0x6c, /* 0110110 */
3273 0x6c, /* 0110110 */
3274 0x6c, /* 0110110 */
3275
3276 /* 204 0xcc 'Ì' */
3277 0x6c, /* 0110110 */
3278 0x6c, /* 0110110 */
3279 0x6c, /* 0110110 */
3280 0x6c, /* 0110110 */
3281 0x6e, /* 0110111 */
3282 0x60, /* 0110000 */
3283 0x6e, /* 0110111 */
3284 0x6c, /* 0110110 */
3285 0x6c, /* 0110110 */
3286 0x6c, /* 0110110 */
3287 0x6c, /* 0110110 */
3288 0x6c, /* 0110110 */
3289 0x6c, /* 0110110 */
3290 0x6c, /* 0110110 */
3291
3292 /* 205 0xcd 'Í' */
3293 0x00, /* 0000000 */
3294 0x00, /* 0000000 */
3295 0x00, /* 0000000 */
3296 0x00, /* 0000000 */
3297 0xfe, /* 1111111 */
3298 0x00, /* 0000000 */
3299 0xfe, /* 1111111 */
3300 0x00, /* 0000000 */
3301 0x00, /* 0000000 */
3302 0x00, /* 0000000 */
3303 0x00, /* 0000000 */
3304 0x00, /* 0000000 */
3305 0x00, /* 0000000 */
3306 0x00, /* 0000000 */
3307
3308 /* 206 0xce 'Î' */
3309 0x6c, /* 0110110 */
3310 0x6c, /* 0110110 */
3311 0x6c, /* 0110110 */
3312 0x6c, /* 0110110 */
3313 0xee, /* 1110111 */
3314 0x00, /* 0000000 */
3315 0xee, /* 1110111 */
3316 0x6c, /* 0110110 */
3317 0x6c, /* 0110110 */
3318 0x6c, /* 0110110 */
3319 0x6c, /* 0110110 */
3320 0x6c, /* 0110110 */
3321 0x6c, /* 0110110 */
3322 0x6c, /* 0110110 */
3323
3324 /* 207 0xcf 'Ï' */
3325 0x30, /* 0011000 */
3326 0x30, /* 0011000 */
3327 0x30, /* 0011000 */
3328 0x30, /* 0011000 */
3329 0xfe, /* 1111111 */
3330 0x00, /* 0000000 */
3331 0xfe, /* 1111111 */
3332 0x00, /* 0000000 */
3333 0x00, /* 0000000 */
3334 0x00, /* 0000000 */
3335 0x00, /* 0000000 */
3336 0x00, /* 0000000 */
3337 0x00, /* 0000000 */
3338 0x00, /* 0000000 */
3339
3340 /* 208 0xd0 'Ð' */
3341 0x6c, /* 0110110 */
3342 0x6c, /* 0110110 */
3343 0x6c, /* 0110110 */
3344 0x6c, /* 0110110 */
3345 0x6c, /* 0110110 */
3346 0x6c, /* 0110110 */
3347 0xfe, /* 1111111 */
3348 0x00, /* 0000000 */
3349 0x00, /* 0000000 */
3350 0x00, /* 0000000 */
3351 0x00, /* 0000000 */
3352 0x00, /* 0000000 */
3353 0x00, /* 0000000 */
3354 0x00, /* 0000000 */
3355
3356 /* 209 0xd1 'Ñ' */
3357 0x00, /* 0000000 */
3358 0x00, /* 0000000 */
3359 0x00, /* 0000000 */
3360 0x00, /* 0000000 */
3361 0xfe, /* 1111111 */
3362 0x00, /* 0000000 */
3363 0xfe, /* 1111111 */
3364 0x30, /* 0011000 */
3365 0x30, /* 0011000 */
3366 0x30, /* 0011000 */
3367 0x30, /* 0011000 */
3368 0x30, /* 0011000 */
3369 0x30, /* 0011000 */
3370 0x30, /* 0011000 */
3371
3372 /* 210 0xd2 'Ò' */
3373 0x00, /* 0000000 */
3374 0x00, /* 0000000 */
3375 0x00, /* 0000000 */
3376 0x00, /* 0000000 */
3377 0x00, /* 0000000 */
3378 0x00, /* 0000000 */
3379 0xfe, /* 1111111 */
3380 0x6c, /* 0110110 */
3381 0x6c, /* 0110110 */
3382 0x6c, /* 0110110 */
3383 0x6c, /* 0110110 */
3384 0x6c, /* 0110110 */
3385 0x6c, /* 0110110 */
3386 0x6c, /* 0110110 */
3387
3388 /* 211 0xd3 'Ó' */
3389 0x6c, /* 0110110 */
3390 0x6c, /* 0110110 */
3391 0x6c, /* 0110110 */
3392 0x6c, /* 0110110 */
3393 0x6c, /* 0110110 */
3394 0x6c, /* 0110110 */
3395 0x7e, /* 0111111 */
3396 0x00, /* 0000000 */
3397 0x00, /* 0000000 */
3398 0x00, /* 0000000 */
3399 0x00, /* 0000000 */
3400 0x00, /* 0000000 */
3401 0x00, /* 0000000 */
3402 0x00, /* 0000000 */
3403
3404 /* 212 0xd4 'Ô' */
3405 0x30, /* 0011000 */
3406 0x30, /* 0011000 */
3407 0x30, /* 0011000 */
3408 0x30, /* 0011000 */
3409 0x3e, /* 0011111 */
3410 0x30, /* 0011000 */
3411 0x3e, /* 0011111 */
3412 0x00, /* 0000000 */
3413 0x00, /* 0000000 */
3414 0x00, /* 0000000 */
3415 0x00, /* 0000000 */
3416 0x00, /* 0000000 */
3417 0x00, /* 0000000 */
3418 0x00, /* 0000000 */
3419
3420 /* 213 0xd5 'Õ' */
3421 0x00, /* 0000000 */
3422 0x00, /* 0000000 */
3423 0x00, /* 0000000 */
3424 0x00, /* 0000000 */
3425 0x3e, /* 0011111 */
3426 0x30, /* 0011000 */
3427 0x3e, /* 0011111 */
3428 0x30, /* 0011000 */
3429 0x30, /* 0011000 */
3430 0x30, /* 0011000 */
3431 0x30, /* 0011000 */
3432 0x30, /* 0011000 */
3433 0x30, /* 0011000 */
3434 0x30, /* 0011000 */
3435
3436 /* 214 0xd6 'Ö' */
3437 0x00, /* 0000000 */
3438 0x00, /* 0000000 */
3439 0x00, /* 0000000 */
3440 0x00, /* 0000000 */
3441 0x00, /* 0000000 */
3442 0x00, /* 0000000 */
3443 0x7e, /* 0111111 */
3444 0x6c, /* 0110110 */
3445 0x6c, /* 0110110 */
3446 0x6c, /* 0110110 */
3447 0x6c, /* 0110110 */
3448 0x6c, /* 0110110 */
3449 0x6c, /* 0110110 */
3450 0x6c, /* 0110110 */
3451
3452 /* 215 0xd7 '×' */
3453 0x6c, /* 0110110 */
3454 0x6c, /* 0110110 */
3455 0x6c, /* 0110110 */
3456 0x6c, /* 0110110 */
3457 0x6c, /* 0110110 */
3458 0x6c, /* 0110110 */
3459 0xfe, /* 1111111 */
3460 0x6c, /* 0110110 */
3461 0x6c, /* 0110110 */
3462 0x6c, /* 0110110 */
3463 0x6c, /* 0110110 */
3464 0x6c, /* 0110110 */
3465 0x6c, /* 0110110 */
3466 0x6c, /* 0110110 */
3467
3468 /* 216 0xd8 'Ø' */
3469 0x30, /* 0011000 */
3470 0x30, /* 0011000 */
3471 0x30, /* 0011000 */
3472 0x30, /* 0011000 */
3473 0xfe, /* 1111111 */
3474 0x30, /* 0011000 */
3475 0xfe, /* 1111111 */
3476 0x30, /* 0011000 */
3477 0x30, /* 0011000 */
3478 0x30, /* 0011000 */
3479 0x30, /* 0011000 */
3480 0x30, /* 0011000 */
3481 0x30, /* 0011000 */
3482 0x30, /* 0011000 */
3483
3484 /* 217 0xd9 'Ù' */
3485 0x30, /* 0011000 */
3486 0x30, /* 0011000 */
3487 0x30, /* 0011000 */
3488 0x30, /* 0011000 */
3489 0x30, /* 0011000 */
3490 0x30, /* 0011000 */
3491 0xf0, /* 1111000 */
3492 0x00, /* 0000000 */
3493 0x00, /* 0000000 */
3494 0x00, /* 0000000 */
3495 0x00, /* 0000000 */
3496 0x00, /* 0000000 */
3497 0x00, /* 0000000 */
3498 0x00, /* 0000000 */
3499
3500 /* 218 0xda 'Ú' */
3501 0x00, /* 0000000 */
3502 0x00, /* 0000000 */
3503 0x00, /* 0000000 */
3504 0x00, /* 0000000 */
3505 0x00, /* 0000000 */
3506 0x00, /* 0000000 */
3507 0x3e, /* 0011111 */
3508 0x30, /* 0011000 */
3509 0x30, /* 0011000 */
3510 0x30, /* 0011000 */
3511 0x30, /* 0011000 */
3512 0x30, /* 0011000 */
3513 0x30, /* 0011000 */
3514 0x30, /* 0011000 */
3515
3516 /* 219 0xdb 'Û' */
3517 0xfe, /* 1111111 */
3518 0xfe, /* 1111111 */
3519 0xfe, /* 1111111 */
3520 0xfe, /* 1111111 */
3521 0xfe, /* 1111111 */
3522 0xfe, /* 1111111 */
3523 0xfe, /* 1111111 */
3524 0xfe, /* 1111111 */
3525 0xfe, /* 1111111 */
3526 0xfe, /* 1111111 */
3527 0xfe, /* 1111111 */
3528 0xfe, /* 1111111 */
3529 0xfe, /* 1111111 */
3530 0xfe, /* 1111111 */
3531
3532 /* 220 0xdc 'Ü' */
3533 0x00, /* 0000000 */
3534 0x00, /* 0000000 */
3535 0x00, /* 0000000 */
3536 0x00, /* 0000000 */
3537 0x00, /* 0000000 */
3538 0x00, /* 0000000 */
3539 0xfe, /* 1111111 */
3540 0xfe, /* 1111111 */
3541 0xfe, /* 1111111 */
3542 0xfe, /* 1111111 */
3543 0xfe, /* 1111111 */
3544 0xfe, /* 1111111 */
3545 0xfe, /* 1111111 */
3546 0xfe, /* 1111111 */
3547
3548 /* 221 0xdd 'Ý' */
3549 0xe0, /* 1110000 */
3550 0xe0, /* 1110000 */
3551 0xe0, /* 1110000 */
3552 0xe0, /* 1110000 */
3553 0xe0, /* 1110000 */
3554 0xe0, /* 1110000 */
3555 0xe0, /* 1110000 */
3556 0xe0, /* 1110000 */
3557 0xe0, /* 1110000 */
3558 0xe0, /* 1110000 */
3559 0xe0, /* 1110000 */
3560 0xe0, /* 1110000 */
3561 0xe0, /* 1110000 */
3562 0xe0, /* 1110000 */
3563
3564 /* 222 0xde 'Þ' */
3565 0x1e, /* 0001111 */
3566 0x1e, /* 0001111 */
3567 0x1e, /* 0001111 */
3568 0x1e, /* 0001111 */
3569 0x1e, /* 0001111 */
3570 0x1e, /* 0001111 */
3571 0x1e, /* 0001111 */
3572 0x1e, /* 0001111 */
3573 0x1e, /* 0001111 */
3574 0x1e, /* 0001111 */
3575 0x1e, /* 0001111 */
3576 0x1e, /* 0001111 */
3577 0x1e, /* 0001111 */
3578 0x1e, /* 0001111 */
3579
3580 /* 223 0xdf 'ß' */
3581 0xfe, /* 1111111 */
3582 0xfe, /* 1111111 */
3583 0xfe, /* 1111111 */
3584 0xfe, /* 1111111 */
3585 0xfe, /* 1111111 */
3586 0xfe, /* 1111111 */
3587 0x00, /* 0000000 */
3588 0x00, /* 0000000 */
3589 0x00, /* 0000000 */
3590 0x00, /* 0000000 */
3591 0x00, /* 0000000 */
3592 0x00, /* 0000000 */
3593 0x00, /* 0000000 */
3594 0x00, /* 0000000 */
3595
3596 /* 224 0xe0 'à' */
3597 0x00, /* 0000000 */
3598 0x00, /* 0000000 */
3599 0x00, /* 0000000 */
3600 0x00, /* 0000000 */
3601 0x76, /* 0111011 */
3602 0xdc, /* 1101110 */
3603 0xd8, /* 1101100 */
3604 0xd8, /* 1101100 */
3605 0xd8, /* 1101100 */
3606 0xdc, /* 1101110 */
3607 0x76, /* 0111011 */
3608 0x00, /* 0000000 */
3609 0x00, /* 0000000 */
3610 0x00, /* 0000000 */
3611
3612 /* 225 0xe1 'á' */
3613 0x00, /* 0000000 */
3614 0x78, /* 0111100 */
3615 0xcc, /* 1100110 */
3616 0xcc, /* 1100110 */
3617 0xcc, /* 1100110 */
3618 0xd8, /* 1101100 */
3619 0xcc, /* 1100110 */
3620 0xc6, /* 1100011 */
3621 0xc6, /* 1100011 */
3622 0xc6, /* 1100011 */
3623 0xcc, /* 1100110 */
3624 0x00, /* 0000000 */
3625 0x00, /* 0000000 */
3626 0x00, /* 0000000 */
3627
3628 /* 226 0xe2 'â' */
3629 0x00, /* 0000000 */
3630 0xfc, /* 1111110 */
3631 0xcc, /* 1100110 */
3632 0xcc, /* 1100110 */
3633 0xc0, /* 1100000 */
3634 0xc0, /* 1100000 */
3635 0xc0, /* 1100000 */
3636 0xc0, /* 1100000 */
3637 0xc0, /* 1100000 */
3638 0xc0, /* 1100000 */
3639 0xc0, /* 1100000 */
3640 0x00, /* 0000000 */
3641 0x00, /* 0000000 */
3642 0x00, /* 0000000 */
3643
3644 /* 227 0xe3 'ã' */
3645 0x00, /* 0000000 */
3646 0x00, /* 0000000 */
3647 0xfe, /* 1111111 */
3648 0xfe, /* 1111111 */
3649 0x6c, /* 0110110 */
3650 0x6c, /* 0110110 */
3651 0x6c, /* 0110110 */
3652 0x6c, /* 0110110 */
3653 0x6c, /* 0110110 */
3654 0x6c, /* 0110110 */
3655 0x6c, /* 0110110 */
3656 0x00, /* 0000000 */
3657 0x00, /* 0000000 */
3658 0x00, /* 0000000 */
3659
3660 /* 228 0xe4 'ä' */
3661 0x00, /* 0000000 */
3662 0xfc, /* 1111110 */
3663 0xcc, /* 1100110 */
3664 0x60, /* 0110000 */
3665 0x30, /* 0011000 */
3666 0x18, /* 0001100 */
3667 0x18, /* 0001100 */
3668 0x30, /* 0011000 */
3669 0x60, /* 0110000 */
3670 0xcc, /* 1100110 */
3671 0xfc, /* 1111110 */
3672 0x00, /* 0000000 */
3673 0x00, /* 0000000 */
3674 0x00, /* 0000000 */
3675
3676 /* 229 0xe5 'å' */
3677 0x00, /* 0000000 */
3678 0x00, /* 0000000 */
3679 0x00, /* 0000000 */
3680 0x00, /* 0000000 */
3681 0x7e, /* 0111111 */
3682 0xd8, /* 1101100 */
3683 0xd8, /* 1101100 */
3684 0xd8, /* 1101100 */
3685 0xd8, /* 1101100 */
3686 0xd8, /* 1101100 */
3687 0x70, /* 0111000 */
3688 0x00, /* 0000000 */
3689 0x00, /* 0000000 */
3690 0x00, /* 0000000 */
3691
3692 /* 230 0xe6 'æ' */
3693 0x00, /* 0000000 */
3694 0x00, /* 0000000 */
3695 0x00, /* 0000000 */
3696 0x00, /* 0000000 */
3697 0xcc, /* 1100110 */
3698 0xcc, /* 1100110 */
3699 0xcc, /* 1100110 */
3700 0xcc, /* 1100110 */
3701 0xcc, /* 1100110 */
3702 0xcc, /* 1100110 */
3703 0xf8, /* 1111100 */
3704 0xc0, /* 1100000 */
3705 0xc0, /* 1100000 */
3706 0x80, /* 1000000 */
3707
3708 /* 231 0xe7 'ç' */
3709 0x00, /* 0000000 */
3710 0x00, /* 0000000 */
3711 0x00, /* 0000000 */
3712 0x76, /* 0111011 */
3713 0xdc, /* 1101110 */
3714 0x18, /* 0001100 */
3715 0x18, /* 0001100 */
3716 0x18, /* 0001100 */
3717 0x18, /* 0001100 */
3718 0x18, /* 0001100 */
3719 0x18, /* 0001100 */
3720 0x00, /* 0000000 */
3721 0x00, /* 0000000 */
3722 0x00, /* 0000000 */
3723
3724 /* 232 0xe8 'è' */
3725 0x00, /* 0000000 */
3726 0xfc, /* 1111110 */
3727 0x30, /* 0011000 */
3728 0x78, /* 0111100 */
3729 0xcc, /* 1100110 */
3730 0xcc, /* 1100110 */
3731 0xcc, /* 1100110 */
3732 0xcc, /* 1100110 */
3733 0x78, /* 0111100 */
3734 0x30, /* 0011000 */
3735 0xfc, /* 1111110 */
3736 0x00, /* 0000000 */
3737 0x00, /* 0000000 */
3738 0x00, /* 0000000 */
3739
3740 /* 233 0xe9 'é' */
3741 0x00, /* 0000000 */
3742 0x38, /* 0011100 */
3743 0x6c, /* 0110110 */
3744 0xcc, /* 1100110 */
3745 0xcc, /* 1100110 */
3746 0xfc, /* 1111110 */
3747 0xcc, /* 1100110 */
3748 0xcc, /* 1100110 */
3749 0xcc, /* 1100110 */
3750 0x6c, /* 0110110 */
3751 0x38, /* 0011100 */
3752 0x00, /* 0000000 */
3753 0x00, /* 0000000 */
3754 0x00, /* 0000000 */
3755
3756 /* 234 0xea 'ê' */
3757 0x00, /* 0000000 */
3758 0x38, /* 0011100 */
3759 0x6c, /* 0110110 */
3760 0xc6, /* 1100011 */
3761 0xc6, /* 1100011 */
3762 0xc6, /* 1100011 */
3763 0x6c, /* 0110110 */
3764 0x6c, /* 0110110 */
3765 0x6c, /* 0110110 */
3766 0x6c, /* 0110110 */
3767 0xee, /* 1110111 */
3768 0x00, /* 0000000 */
3769 0x00, /* 0000000 */
3770 0x00, /* 0000000 */
3771
3772 /* 235 0xeb 'ë' */
3773 0x00, /* 0000000 */
3774 0x3c, /* 0011110 */
3775 0x60, /* 0110000 */
3776 0x30, /* 0011000 */
3777 0x18, /* 0001100 */
3778 0x7c, /* 0111110 */
3779 0xcc, /* 1100110 */
3780 0xcc, /* 1100110 */
3781 0xcc, /* 1100110 */
3782 0xcc, /* 1100110 */
3783 0x78, /* 0111100 */
3784 0x00, /* 0000000 */
3785 0x00, /* 0000000 */
3786 0x00, /* 0000000 */
3787
3788 /* 236 0xec 'ì' */
3789 0x00, /* 0000000 */
3790 0x00, /* 0000000 */
3791 0x00, /* 0000000 */
3792 0x00, /* 0000000 */
3793 0x7c, /* 0111110 */
3794 0xd6, /* 1101011 */
3795 0xd6, /* 1101011 */
3796 0xd6, /* 1101011 */
3797 0x7c, /* 0111110 */
3798 0x00, /* 0000000 */
3799 0x00, /* 0000000 */
3800 0x00, /* 0000000 */
3801 0x00, /* 0000000 */
3802 0x00, /* 0000000 */
3803
3804 /* 237 0xed 'í' */
3805 0x00, /* 0000000 */
3806 0x00, /* 0000000 */
3807 0x06, /* 0000011 */
3808 0x0c, /* 0000110 */
3809 0x7c, /* 0111110 */
3810 0xd6, /* 1101011 */
3811 0xd6, /* 1101011 */
3812 0xe6, /* 1110011 */
3813 0x7c, /* 0111110 */
3814 0x60, /* 0110000 */
3815 0xc0, /* 1100000 */
3816 0x00, /* 0000000 */
3817 0x00, /* 0000000 */
3818 0x00, /* 0000000 */
3819
3820 /* 238 0xee 'î' */
3821 0x00, /* 0000000 */
3822 0x1c, /* 0001110 */
3823 0x30, /* 0011000 */
3824 0x60, /* 0110000 */
3825 0x60, /* 0110000 */
3826 0x7c, /* 0111110 */
3827 0x60, /* 0110000 */
3828 0x60, /* 0110000 */
3829 0x60, /* 0110000 */
3830 0x30, /* 0011000 */
3831 0x1c, /* 0001110 */
3832 0x00, /* 0000000 */
3833 0x00, /* 0000000 */
3834 0x00, /* 0000000 */
3835
3836 /* 239 0xef 'ï' */
3837 0x00, /* 0000000 */
3838 0x00, /* 0000000 */
3839 0x78, /* 0111100 */
3840 0xcc, /* 1100110 */
3841 0xcc, /* 1100110 */
3842 0xcc, /* 1100110 */
3843 0xcc, /* 1100110 */
3844 0xcc, /* 1100110 */
3845 0xcc, /* 1100110 */
3846 0xcc, /* 1100110 */
3847 0xcc, /* 1100110 */
3848 0x00, /* 0000000 */
3849 0x00, /* 0000000 */
3850 0x00, /* 0000000 */
3851
3852 /* 240 0xf0 'ð' */
3853 0x00, /* 0000000 */
3854 0x00, /* 0000000 */
3855 0x00, /* 0000000 */
3856 0xfc, /* 1111110 */
3857 0x00, /* 0000000 */
3858 0x00, /* 0000000 */
3859 0xfc, /* 1111110 */
3860 0x00, /* 0000000 */
3861 0x00, /* 0000000 */
3862 0xfc, /* 1111110 */
3863 0x00, /* 0000000 */
3864 0x00, /* 0000000 */
3865 0x00, /* 0000000 */
3866 0x00, /* 0000000 */
3867
3868 /* 241 0xf1 'ñ' */
3869 0x00, /* 0000000 */
3870 0x00, /* 0000000 */
3871 0x00, /* 0000000 */
3872 0x30, /* 0011000 */
3873 0x30, /* 0011000 */
3874 0xfc, /* 1111110 */
3875 0x30, /* 0011000 */
3876 0x30, /* 0011000 */
3877 0x00, /* 0000000 */
3878 0x00, /* 0000000 */
3879 0xfc, /* 1111110 */
3880 0x00, /* 0000000 */
3881 0x00, /* 0000000 */
3882 0x00, /* 0000000 */
3883
3884 /* 242 0xf2 'ò' */
3885 0x00, /* 0000000 */
3886 0x00, /* 0000000 */
3887 0x60, /* 0110000 */
3888 0x30, /* 0011000 */
3889 0x18, /* 0001100 */
3890 0x0c, /* 0000110 */
3891 0x18, /* 0001100 */
3892 0x30, /* 0011000 */
3893 0x60, /* 0110000 */
3894 0x00, /* 0000000 */
3895 0xfc, /* 1111110 */
3896 0x00, /* 0000000 */
3897 0x00, /* 0000000 */
3898 0x00, /* 0000000 */
3899
3900 /* 243 0xf3 'ó' */
3901 0x00, /* 0000000 */
3902 0x00, /* 0000000 */
3903 0x18, /* 0001100 */
3904 0x30, /* 0011000 */
3905 0x60, /* 0110000 */
3906 0xc0, /* 1100000 */
3907 0x60, /* 0110000 */
3908 0x30, /* 0011000 */
3909 0x18, /* 0001100 */
3910 0x00, /* 0000000 */
3911 0xfc, /* 1111110 */
3912 0x00, /* 0000000 */
3913 0x00, /* 0000000 */
3914 0x00, /* 0000000 */
3915
3916 /* 244 0xf4 'ô' */
3917 0x00, /* 0000000 */
3918 0x1c, /* 0001110 */
3919 0x36, /* 0011011 */
3920 0x36, /* 0011011 */
3921 0x30, /* 0011000 */
3922 0x30, /* 0011000 */
3923 0x30, /* 0011000 */
3924 0x30, /* 0011000 */
3925 0x30, /* 0011000 */
3926 0x30, /* 0011000 */
3927 0x30, /* 0011000 */
3928 0x30, /* 0011000 */
3929 0x30, /* 0011000 */
3930 0x30, /* 0011000 */
3931
3932 /* 245 0xf5 'õ' */
3933 0x18, /* 0001100 */
3934 0x18, /* 0001100 */
3935 0x18, /* 0001100 */
3936 0x18, /* 0001100 */
3937 0x18, /* 0001100 */
3938 0x18, /* 0001100 */
3939 0x18, /* 0001100 */
3940 0x18, /* 0001100 */
3941 0xd8, /* 1101100 */
3942 0xd8, /* 1101100 */
3943 0xd8, /* 1101100 */
3944 0x70, /* 0111000 */
3945 0x00, /* 0000000 */
3946 0x00, /* 0000000 */
3947
3948 /* 246 0xf6 'ö' */
3949 0x00, /* 0000000 */
3950 0x00, /* 0000000 */
3951 0x00, /* 0000000 */
3952 0x00, /* 0000000 */
3953 0x30, /* 0011000 */
3954 0x00, /* 0000000 */
3955 0xfc, /* 1111110 */
3956 0x00, /* 0000000 */
3957 0x30, /* 0011000 */
3958 0x00, /* 0000000 */
3959 0x00, /* 0000000 */
3960 0x00, /* 0000000 */
3961 0x00, /* 0000000 */
3962 0x00, /* 0000000 */
3963
3964 /* 247 0xf7 '÷' */
3965 0x00, /* 0000000 */
3966 0x00, /* 0000000 */
3967 0x00, /* 0000000 */
3968 0x00, /* 0000000 */
3969 0x76, /* 0111011 */
3970 0xdc, /* 1101110 */
3971 0x00, /* 0000000 */
3972 0x76, /* 0111011 */
3973 0xdc, /* 1101110 */
3974 0x00, /* 0000000 */
3975 0x00, /* 0000000 */
3976 0x00, /* 0000000 */
3977 0x00, /* 0000000 */
3978 0x00, /* 0000000 */
3979
3980 /* 248 0xf8 'ø' */
3981 0x38, /* 0011100 */
3982 0x6c, /* 0110110 */
3983 0x6c, /* 0110110 */
3984 0x38, /* 0011100 */
3985 0x00, /* 0000000 */
3986 0x00, /* 0000000 */
3987 0x00, /* 0000000 */
3988 0x00, /* 0000000 */
3989 0x00, /* 0000000 */
3990 0x00, /* 0000000 */
3991 0x00, /* 0000000 */
3992 0x00, /* 0000000 */
3993 0x00, /* 0000000 */
3994 0x00, /* 0000000 */
3995
3996 /* 249 0xf9 'ù' */
3997 0x00, /* 0000000 */
3998 0x00, /* 0000000 */
3999 0x00, /* 0000000 */
4000 0x00, /* 0000000 */
4001 0x00, /* 0000000 */
4002 0x00, /* 0000000 */
4003 0x30, /* 0011000 */
4004 0x30, /* 0011000 */
4005 0x00, /* 0000000 */
4006 0x00, /* 0000000 */
4007 0x00, /* 0000000 */
4008 0x00, /* 0000000 */
4009 0x00, /* 0000000 */
4010 0x00, /* 0000000 */
4011
4012 /* 250 0xfa 'ú' */
4013 0x00, /* 0000000 */
4014 0x00, /* 0000000 */
4015 0x00, /* 0000000 */
4016 0x00, /* 0000000 */
4017 0x00, /* 0000000 */
4018 0x00, /* 0000000 */
4019 0x30, /* 0011000 */
4020 0x00, /* 0000000 */
4021 0x00, /* 0000000 */
4022 0x00, /* 0000000 */
4023 0x00, /* 0000000 */
4024 0x00, /* 0000000 */
4025 0x00, /* 0000000 */
4026 0x00, /* 0000000 */
4027
4028 /* 251 0xfb 'û' */
4029 0x1e, /* 0001111 */
4030 0x18, /* 0001100 */
4031 0x18, /* 0001100 */
4032 0x18, /* 0001100 */
4033 0x18, /* 0001100 */
4034 0x18, /* 0001100 */
4035 0xd8, /* 1101100 */
4036 0xd8, /* 1101100 */
4037 0xd8, /* 1101100 */
4038 0x78, /* 0111100 */
4039 0x38, /* 0011100 */
4040 0x00, /* 0000000 */
4041 0x00, /* 0000000 */
4042 0x00, /* 0000000 */
4043
4044 /* 252 0xfc 'ü' */
4045 0xd8, /* 1101100 */
4046 0x6c, /* 0110110 */
4047 0x6c, /* 0110110 */
4048 0x6c, /* 0110110 */
4049 0x6c, /* 0110110 */
4050 0x6c, /* 0110110 */
4051 0x00, /* 0000000 */
4052 0x00, /* 0000000 */
4053 0x00, /* 0000000 */
4054 0x00, /* 0000000 */
4055 0x00, /* 0000000 */
4056 0x00, /* 0000000 */
4057 0x00, /* 0000000 */
4058 0x00, /* 0000000 */
4059
4060 /* 253 0xfd 'ý' */
4061 0x78, /* 0111100 */
4062 0xcc, /* 1100110 */
4063 0x18, /* 0001100 */
4064 0x30, /* 0011000 */
4065 0x64, /* 0110010 */
4066 0xfc, /* 1111110 */
4067 0x00, /* 0000000 */
4068 0x00, /* 0000000 */
4069 0x00, /* 0000000 */
4070 0x00, /* 0000000 */
4071 0x00, /* 0000000 */
4072 0x00, /* 0000000 */
4073 0x00, /* 0000000 */
4074 0x00, /* 0000000 */
4075
4076 /* 254 0xfe 'þ' */
4077 0x00, /* 0000000 */
4078 0x00, /* 0000000 */
4079 0x00, /* 0000000 */
4080 0x7c, /* 0111110 */
4081 0x7c, /* 0111110 */
4082 0x7c, /* 0111110 */
4083 0x7c, /* 0111110 */
4084 0x7c, /* 0111110 */
4085 0x7c, /* 0111110 */
4086 0x7c, /* 0111110 */
4087 0x00, /* 0000000 */
4088 0x00, /* 0000000 */
4089 0x00, /* 0000000 */
4090 0x00, /* 0000000 */
4091
4092 /* 255 0xff 'ÿ' */
4093 0x00, /* 0000000 */
4094 0x00, /* 0000000 */
4095 0x00, /* 0000000 */
4096 0x00, /* 0000000 */
4097 0x00, /* 0000000 */
4098 0x00, /* 0000000 */
4099 0x00, /* 0000000 */
4100 0x00, /* 0000000 */
4101 0x00, /* 0000000 */
4102 0x00, /* 0000000 */
4103 0x00, /* 0000000 */
4104 0x00, /* 0000000 */
4105 0x00, /* 0000000 */
4106 0x00, /* 0000000 */
4107
4108};
4109
4110
4111struct font_desc font_7x14 = {
4112 FONT7x14_IDX,
4113 "7x14",
4114 7,
4115 14,
4116 fontdata_7x14,
4117 0
4118};
diff --git a/drivers/video/console/font_sun12x22.c b/drivers/video/console/font_sun12x22.c
index 05215d0c3e09..c7bd967ea100 100644
--- a/drivers/video/console/font_sun12x22.c
+++ b/drivers/video/console/font_sun12x22.c
@@ -29,24 +29,23 @@ static unsigned char fontdata_sun12x22[FONTDATAMAX] = {
29 0x00, 0x00, /* 000000000000 */ 29 0x00, 0x00, /* 000000000000 */
30 30
31 /* 1 0x01 '^A' */ 31 /* 1 0x01 '^A' */
32 /* FIXME */
33 0x00, 0x00, /* 000000000000 */ 32 0x00, 0x00, /* 000000000000 */
34 0x00, 0x00, /* 000000000000 */ 33 0x00, 0x00, /* 000000000000 */
35 0x00, 0x00, /* 000000000000 */ 34 0x00, 0x00, /* 000000000000 */
36 0x00, 0x00, /* 000000000000 */ 35 0x00, 0x00, /* 000000000000 */
36 0x1f, 0xc0, /* 000111111100 */
37 0x30, 0x60, /* 001100000110 */
38 0x65, 0x30, /* 011001010011 */
39 0x6d, 0xb0, /* 011011011011 */
40 0x60, 0x30, /* 011000000011 */
41 0x62, 0x30, /* 011000100011 */
42 0x62, 0x30, /* 011000100011 */
43 0x60, 0x30, /* 011000000011 */
44 0x6f, 0xb0, /* 011011111011 */
45 0x67, 0x30, /* 011001110011 */
46 0x30, 0x60, /* 001100000110 */
47 0x1f, 0xc0, /* 000111111100 */
37 0x00, 0x00, /* 000000000000 */ 48 0x00, 0x00, /* 000000000000 */
38 0x3f, 0xc0, /* 001111111100 */
39 0x3f, 0xc0, /* 001111111100 */
40 0x3f, 0xc0, /* 001111111100 */
41 0x3f, 0xc0, /* 001111111100 */
42 0x3f, 0xc0, /* 001111111100 */
43 0x3f, 0xc0, /* 001111111100 */
44 0x3f, 0xc0, /* 001111111100 */
45 0x3f, 0xc0, /* 001111111100 */
46 0x3f, 0xc0, /* 001111111100 */
47 0x3f, 0xc0, /* 001111111100 */
48 0x3f, 0xc0, /* 001111111100 */
49 0x3f, 0xc0, /* 001111111100 */
50 0x00, 0x00, /* 000000000000 */ 49 0x00, 0x00, /* 000000000000 */
51 0x00, 0x00, /* 000000000000 */ 50 0x00, 0x00, /* 000000000000 */
52 0x00, 0x00, /* 000000000000 */ 51 0x00, 0x00, /* 000000000000 */
@@ -54,24 +53,23 @@ static unsigned char fontdata_sun12x22[FONTDATAMAX] = {
54 0x00, 0x00, /* 000000000000 */ 53 0x00, 0x00, /* 000000000000 */
55 54
56 /* 2 0x02 '^B' */ 55 /* 2 0x02 '^B' */
57 /* FIXME */
58 0x00, 0x00, /* 000000000000 */ 56 0x00, 0x00, /* 000000000000 */
59 0x00, 0x00, /* 000000000000 */ 57 0x00, 0x00, /* 000000000000 */
60 0x00, 0x00, /* 000000000000 */ 58 0x00, 0x00, /* 000000000000 */
61 0x00, 0x00, /* 000000000000 */ 59 0x00, 0x00, /* 000000000000 */
60 0x1f, 0xc0, /* 000111111100 */
61 0x3f, 0xe0, /* 001111111110 */
62 0x7a, 0xf0, /* 011110101111 */
63 0x72, 0x70, /* 011100100111 */
64 0x7f, 0xf0, /* 011111111111 */
65 0x7d, 0xf0, /* 011111011111 */
66 0x7d, 0xf0, /* 011111011111 */
67 0x7f, 0xf0, /* 011111111111 */
68 0x70, 0x70, /* 011100000111 */
69 0x78, 0xf0, /* 011110001111 */
70 0x3f, 0xe0, /* 001111111110 */
71 0x1f, 0xc0, /* 000111111100 */
62 0x00, 0x00, /* 000000000000 */ 72 0x00, 0x00, /* 000000000000 */
63 0x3f, 0xc0, /* 001111111100 */
64 0x3f, 0xc0, /* 001111111100 */
65 0x3f, 0xc0, /* 001111111100 */
66 0x3f, 0xc0, /* 001111111100 */
67 0x3f, 0xc0, /* 001111111100 */
68 0x3f, 0xc0, /* 001111111100 */
69 0x3f, 0xc0, /* 001111111100 */
70 0x3f, 0xc0, /* 001111111100 */
71 0x3f, 0xc0, /* 001111111100 */
72 0x3f, 0xc0, /* 001111111100 */
73 0x3f, 0xc0, /* 001111111100 */
74 0x3f, 0xc0, /* 001111111100 */
75 0x00, 0x00, /* 000000000000 */ 73 0x00, 0x00, /* 000000000000 */
76 0x00, 0x00, /* 000000000000 */ 74 0x00, 0x00, /* 000000000000 */
77 0x00, 0x00, /* 000000000000 */ 75 0x00, 0x00, /* 000000000000 */
@@ -79,24 +77,23 @@ static unsigned char fontdata_sun12x22[FONTDATAMAX] = {
79 0x00, 0x00, /* 000000000000 */ 77 0x00, 0x00, /* 000000000000 */
80 78
81 /* 3 0x03 '^C' */ 79 /* 3 0x03 '^C' */
82 /* FIXME */
83 0x00, 0x00, /* 000000000000 */ 80 0x00, 0x00, /* 000000000000 */
84 0x00, 0x00, /* 000000000000 */ 81 0x00, 0x00, /* 000000000000 */
85 0x00, 0x00, /* 000000000000 */ 82 0x00, 0x00, /* 000000000000 */
86 0x00, 0x00, /* 000000000000 */ 83 0x00, 0x00, /* 000000000000 */
87 0x00, 0x00, /* 000000000000 */ 84 0x00, 0x00, /* 000000000000 */
85 0x00, 0x00, /* 000000000000 */
86 0x19, 0x80, /* 000110011000 */
88 0x3f, 0xc0, /* 001111111100 */ 87 0x3f, 0xc0, /* 001111111100 */
88 0x7f, 0xe0, /* 011111111110 */
89 0x3f, 0xc0, /* 001111111100 */ 89 0x3f, 0xc0, /* 001111111100 */
90 0x3f, 0xc0, /* 001111111100 */ 90 0x3f, 0xc0, /* 001111111100 */
91 0x3f, 0xc0, /* 001111111100 */ 91 0x1f, 0x80, /* 000111111000 */
92 0x3f, 0xc0, /* 001111111100 */ 92 0x1f, 0x80, /* 000111111000 */
93 0x3f, 0xc0, /* 001111111100 */ 93 0x0f, 0x00, /* 000011110000 */
94 0x3f, 0xc0, /* 001111111100 */ 94 0x0f, 0x00, /* 000011110000 */
95 0x3f, 0xc0, /* 001111111100 */ 95 0x06, 0x00, /* 000001100000 */
96 0x3f, 0xc0, /* 001111111100 */ 96 0x00, 0x00, /* 000000000000 */
97 0x3f, 0xc0, /* 001111111100 */
98 0x3f, 0xc0, /* 001111111100 */
99 0x3f, 0xc0, /* 001111111100 */
100 0x00, 0x00, /* 000000000000 */ 97 0x00, 0x00, /* 000000000000 */
101 0x00, 0x00, /* 000000000000 */ 98 0x00, 0x00, /* 000000000000 */
102 0x00, 0x00, /* 000000000000 */ 99 0x00, 0x00, /* 000000000000 */
@@ -104,49 +101,47 @@ static unsigned char fontdata_sun12x22[FONTDATAMAX] = {
104 0x00, 0x00, /* 000000000000 */ 101 0x00, 0x00, /* 000000000000 */
105 102
106 /* 4 0x04 '^D' */ 103 /* 4 0x04 '^D' */
107 /* FIXME */
108 0x00, 0x00, /* 000000000000 */ 104 0x00, 0x00, /* 000000000000 */
109 0x00, 0x00, /* 000000000000 */ 105 0x00, 0x00, /* 000000000000 */
110 0x00, 0x00, /* 000000000000 */ 106 0x00, 0x00, /* 000000000000 */
107 0x02, 0x00, /* 000000100000 */
108 0x07, 0x00, /* 000001110000 */
109 0x0f, 0x80, /* 000011111000 */
110 0x0f, 0x80, /* 000011111000 */
111 0x1f, 0xc0, /* 000111111100 */
112 0x1f, 0xc0, /* 000111111100 */
113 0x3f, 0xe0, /* 001111111110 */
114 0x1f, 0xc0, /* 000111111100 */
115 0x1f, 0xc0, /* 000111111100 */
116 0x0f, 0x80, /* 000011111000 */
117 0x0f, 0x80, /* 000011111000 */
118 0x07, 0x00, /* 000001110000 */
119 0x02, 0x00, /* 000000100000 */
111 0x00, 0x00, /* 000000000000 */ 120 0x00, 0x00, /* 000000000000 */
112 0x00, 0x00, /* 000000000000 */ 121 0x00, 0x00, /* 000000000000 */
113 0x3f, 0xc0, /* 001111111100 */
114 0x3f, 0xc0, /* 001111111100 */
115 0x3f, 0xc0, /* 001111111100 */
116 0x3f, 0xc0, /* 001111111100 */
117 0x3f, 0xc0, /* 001111111100 */
118 0x3f, 0xc0, /* 001111111100 */
119 0x3f, 0xc0, /* 001111111100 */
120 0x3f, 0xc0, /* 001111111100 */
121 0x3f, 0xc0, /* 001111111100 */
122 0x3f, 0xc0, /* 001111111100 */
123 0x3f, 0xc0, /* 001111111100 */
124 0x3f, 0xc0, /* 001111111100 */
125 0x00, 0x00, /* 000000000000 */
126 0x00, 0x00, /* 000000000000 */ 122 0x00, 0x00, /* 000000000000 */
127 0x00, 0x00, /* 000000000000 */ 123 0x00, 0x00, /* 000000000000 */
128 0x00, 0x00, /* 000000000000 */ 124 0x00, 0x00, /* 000000000000 */
129 0x00, 0x00, /* 000000000000 */ 125 0x00, 0x00, /* 000000000000 */
130 126
131 /* 5 0x05 '^E' */ 127 /* 5 0x05 '^E' */
132 /* FIXME */
133 0x00, 0x00, /* 000000000000 */ 128 0x00, 0x00, /* 000000000000 */
134 0x00, 0x00, /* 000000000000 */ 129 0x00, 0x00, /* 000000000000 */
135 0x00, 0x00, /* 000000000000 */ 130 0x00, 0x00, /* 000000000000 */
136 0x00, 0x00, /* 000000000000 */ 131 0x00, 0x00, /* 000000000000 */
132 0x02, 0x00, /* 000000100000 */
133 0x07, 0x00, /* 000001110000 */
134 0x07, 0x00, /* 000001110000 */
135 0x02, 0x00, /* 000000100000 */
136 0x18, 0xc0, /* 000110001100 */
137 0x3d, 0xe0, /* 001111011110 */
138 0x3d, 0xe0, /* 001111011110 */
139 0x1a, 0xc0, /* 000110101100 */
140 0x02, 0x00, /* 000000100000 */
141 0x07, 0x00, /* 000001110000 */
142 0x0f, 0x80, /* 000011111000 */
143 0x1f, 0xc0, /* 000111111100 */
137 0x00, 0x00, /* 000000000000 */ 144 0x00, 0x00, /* 000000000000 */
138 0x3f, 0xc0, /* 001111111100 */
139 0x3f, 0xc0, /* 001111111100 */
140 0x3f, 0xc0, /* 001111111100 */
141 0x3f, 0xc0, /* 001111111100 */
142 0x3f, 0xc0, /* 001111111100 */
143 0x3f, 0xc0, /* 001111111100 */
144 0x3f, 0xc0, /* 001111111100 */
145 0x3f, 0xc0, /* 001111111100 */
146 0x3f, 0xc0, /* 001111111100 */
147 0x3f, 0xc0, /* 001111111100 */
148 0x3f, 0xc0, /* 001111111100 */
149 0x3f, 0xc0, /* 001111111100 */
150 0x00, 0x00, /* 000000000000 */ 145 0x00, 0x00, /* 000000000000 */
151 0x00, 0x00, /* 000000000000 */ 146 0x00, 0x00, /* 000000000000 */
152 0x00, 0x00, /* 000000000000 */ 147 0x00, 0x00, /* 000000000000 */
@@ -154,23 +149,22 @@ static unsigned char fontdata_sun12x22[FONTDATAMAX] = {
154 0x00, 0x00, /* 000000000000 */ 149 0x00, 0x00, /* 000000000000 */
155 150
156 /* 6 0x06 '^F' */ 151 /* 6 0x06 '^F' */
157 /* FIXME */
158 0x00, 0x00, /* 000000000000 */
159 0x00, 0x00, /* 000000000000 */ 152 0x00, 0x00, /* 000000000000 */
160 0x00, 0x00, /* 000000000000 */ 153 0x00, 0x00, /* 000000000000 */
161 0x00, 0x00, /* 000000000000 */ 154 0x00, 0x00, /* 000000000000 */
162 0x00, 0x00, /* 000000000000 */ 155 0x00, 0x00, /* 000000000000 */
156 0x06, 0x00, /* 000001100000 */
157 0x0f, 0x00, /* 000011110000 */
158 0x1f, 0x80, /* 000111111000 */
159 0x1f, 0x80, /* 000111111000 */
163 0x3f, 0xc0, /* 001111111100 */ 160 0x3f, 0xc0, /* 001111111100 */
164 0x3f, 0xc0, /* 001111111100 */ 161 0x7f, 0xe0, /* 011111111110 */
165 0x3f, 0xc0, /* 001111111100 */ 162 0x7f, 0xe0, /* 011111111110 */
166 0x3f, 0xc0, /* 001111111100 */ 163 0x36, 0xc0, /* 001101101100 */
167 0x3f, 0xc0, /* 001111111100 */ 164 0x06, 0x00, /* 000001100000 */
168 0x3f, 0xc0, /* 001111111100 */ 165 0x06, 0x00, /* 000001100000 */
169 0x3f, 0xc0, /* 001111111100 */ 166 0x0f, 0x00, /* 000011110000 */
170 0x3f, 0xc0, /* 001111111100 */ 167 0x1f, 0x80, /* 000111111000 */
171 0x3f, 0xc0, /* 001111111100 */
172 0x3f, 0xc0, /* 001111111100 */
173 0x3f, 0xc0, /* 001111111100 */
174 0x3f, 0xc0, /* 001111111100 */ 168 0x3f, 0xc0, /* 001111111100 */
175 0x00, 0x00, /* 000000000000 */ 169 0x00, 0x00, /* 000000000000 */
176 0x00, 0x00, /* 000000000000 */ 170 0x00, 0x00, /* 000000000000 */
@@ -179,24 +173,23 @@ static unsigned char fontdata_sun12x22[FONTDATAMAX] = {
179 0x00, 0x00, /* 000000000000 */ 173 0x00, 0x00, /* 000000000000 */
180 174
181 /* 7 0x07 '^G' */ 175 /* 7 0x07 '^G' */
182 /* FIXME */
183 0x00, 0x00, /* 000000000000 */
184 0x00, 0x00, /* 000000000000 */ 176 0x00, 0x00, /* 000000000000 */
185 0x00, 0x00, /* 000000000000 */ 177 0x00, 0x00, /* 000000000000 */
186 0x00, 0x00, /* 000000000000 */ 178 0x00, 0x00, /* 000000000000 */
187 0x00, 0x00, /* 000000000000 */ 179 0x00, 0x00, /* 000000000000 */
180 0x06, 0x00, /* 000001100000 */
181 0x0f, 0x00, /* 000011110000 */
182 0x0f, 0x00, /* 000011110000 */
183 0x1f, 0x80, /* 000111111000 */
184 0x1f, 0x80, /* 000111111000 */
188 0x3f, 0xc0, /* 001111111100 */ 185 0x3f, 0xc0, /* 001111111100 */
189 0x3f, 0xc0, /* 001111111100 */ 186 0x3f, 0xc0, /* 001111111100 */
190 0x3f, 0xc0, /* 001111111100 */ 187 0x1f, 0x80, /* 000111111000 */
191 0x3f, 0xc0, /* 001111111100 */ 188 0x1f, 0x80, /* 000111111000 */
192 0x3f, 0xc0, /* 001111111100 */ 189 0x0f, 0x00, /* 000011110000 */
193 0x3f, 0xc0, /* 001111111100 */ 190 0x0f, 0x00, /* 000011110000 */
194 0x3f, 0xc0, /* 001111111100 */ 191 0x06, 0x00, /* 000001100000 */
195 0x3f, 0xc0, /* 001111111100 */ 192 0x00, 0x00, /* 000000000000 */
196 0x3f, 0xc0, /* 001111111100 */
197 0x3f, 0xc0, /* 001111111100 */
198 0x3f, 0xc0, /* 001111111100 */
199 0x3f, 0xc0, /* 001111111100 */
200 0x00, 0x00, /* 000000000000 */ 193 0x00, 0x00, /* 000000000000 */
201 0x00, 0x00, /* 000000000000 */ 194 0x00, 0x00, /* 000000000000 */
202 0x00, 0x00, /* 000000000000 */ 195 0x00, 0x00, /* 000000000000 */
@@ -204,49 +197,47 @@ static unsigned char fontdata_sun12x22[FONTDATAMAX] = {
204 0x00, 0x00, /* 000000000000 */ 197 0x00, 0x00, /* 000000000000 */
205 198
206 /* 8 0x08 '^H' */ 199 /* 8 0x08 '^H' */
207 /* FIXME */ 200 0xff, 0xf0, /* 111111111111 */
208 0x00, 0x00, /* 000000000000 */ 201 0xff, 0xf0, /* 111111111111 */
209 0x00, 0x00, /* 000000000000 */ 202 0xff, 0xf0, /* 111111111111 */
210 0x00, 0x00, /* 000000000000 */ 203 0xff, 0xf0, /* 111111111111 */
211 0x00, 0x00, /* 000000000000 */ 204 0xf9, 0xf0, /* 111110011111 */
212 0x00, 0x00, /* 000000000000 */ 205 0xf0, 0xf0, /* 111100001111 */
213 0x3f, 0xc0, /* 001111111100 */ 206 0xf0, 0xf0, /* 111100001111 */
214 0x3f, 0xc0, /* 001111111100 */ 207 0xe0, 0x70, /* 111000000111 */
215 0x3f, 0xc0, /* 001111111100 */ 208 0xe0, 0x70, /* 111000000111 */
216 0x3f, 0xc0, /* 001111111100 */ 209 0xc0, 0x30, /* 110000000011 */
217 0x3f, 0xc0, /* 001111111100 */ 210 0xc0, 0x30, /* 110000000011 */
218 0x3f, 0xc0, /* 001111111100 */ 211 0xe0, 0x70, /* 111000000111 */
219 0x3f, 0xc0, /* 001111111100 */ 212 0xe0, 0x70, /* 111000000111 */
220 0x3f, 0xc0, /* 001111111100 */ 213 0xf0, 0xf0, /* 111100001111 */
221 0x3f, 0xc0, /* 001111111100 */ 214 0xf0, 0xf0, /* 111100001111 */
222 0x3f, 0xc0, /* 001111111100 */ 215 0xf9, 0xf0, /* 111110011111 */
223 0x3f, 0xc0, /* 001111111100 */ 216 0xff, 0xf0, /* 111111111111 */
224 0x3f, 0xc0, /* 001111111100 */ 217 0xff, 0xf0, /* 111111111111 */
225 0x00, 0x00, /* 000000000000 */ 218 0xff, 0xf0, /* 111111111111 */
226 0x00, 0x00, /* 000000000000 */ 219 0xff, 0xf0, /* 111111111111 */
227 0x00, 0x00, /* 000000000000 */ 220 0xff, 0xf0, /* 111111111111 */
228 0x00, 0x00, /* 000000000000 */ 221 0xff, 0xf0, /* 111111111111 */
229 0x00, 0x00, /* 000000000000 */
230 222
231 /* 9 0x09 '^I' */ 223 /* 9 0x09 '^I' */
232 /* FIXME */
233 0x00, 0x00, /* 000000000000 */ 224 0x00, 0x00, /* 000000000000 */
234 0x00, 0x00, /* 000000000000 */ 225 0x00, 0x00, /* 000000000000 */
235 0x00, 0x00, /* 000000000000 */ 226 0x00, 0x00, /* 000000000000 */
236 0x00, 0x00, /* 000000000000 */ 227 0x00, 0x00, /* 000000000000 */
228 0x06, 0x00, /* 000001100000 */
229 0x0f, 0x00, /* 000011110000 */
230 0x0f, 0x00, /* 000011110000 */
231 0x19, 0x80, /* 000110011000 */
232 0x19, 0x80, /* 000110011000 */
233 0x30, 0xc0, /* 001100001100 */
234 0x30, 0xc0, /* 001100001100 */
235 0x19, 0x80, /* 000110011000 */
236 0x19, 0x80, /* 000110011000 */
237 0x0f, 0x00, /* 000011110000 */
238 0x0f, 0x00, /* 000011110000 */
239 0x06, 0x00, /* 000001100000 */
237 0x00, 0x00, /* 000000000000 */ 240 0x00, 0x00, /* 000000000000 */
238 0x3f, 0xc0, /* 001111111100 */
239 0x3f, 0xc0, /* 001111111100 */
240 0x3f, 0xc0, /* 001111111100 */
241 0x3f, 0xc0, /* 001111111100 */
242 0x3f, 0xc0, /* 001111111100 */
243 0x3f, 0xc0, /* 001111111100 */
244 0x3f, 0xc0, /* 001111111100 */
245 0x3f, 0xc0, /* 001111111100 */
246 0x3f, 0xc0, /* 001111111100 */
247 0x3f, 0xc0, /* 001111111100 */
248 0x3f, 0xc0, /* 001111111100 */
249 0x3f, 0xc0, /* 001111111100 */
250 0x00, 0x00, /* 000000000000 */ 241 0x00, 0x00, /* 000000000000 */
251 0x00, 0x00, /* 000000000000 */ 242 0x00, 0x00, /* 000000000000 */
252 0x00, 0x00, /* 000000000000 */ 243 0x00, 0x00, /* 000000000000 */
@@ -254,49 +245,47 @@ static unsigned char fontdata_sun12x22[FONTDATAMAX] = {
254 0x00, 0x00, /* 000000000000 */ 245 0x00, 0x00, /* 000000000000 */
255 246
256 /* 10 0x0a '^J' */ 247 /* 10 0x0a '^J' */
257 /* FIXME */ 248 0xff, 0xf0, /* 111111111111 */
258 0x00, 0x00, /* 000000000000 */ 249 0xff, 0xf0, /* 111111111111 */
259 0x00, 0x00, /* 000000000000 */ 250 0xff, 0xf0, /* 111111111111 */
260 0x00, 0x00, /* 000000000000 */ 251 0xff, 0xf0, /* 111111111111 */
261 0x00, 0x00, /* 000000000000 */ 252 0xf9, 0xf0, /* 111110011111 */
262 0x00, 0x00, /* 000000000000 */ 253 0xf0, 0xf0, /* 111100001111 */
263 0x3f, 0xc0, /* 001111111100 */ 254 0xf0, 0xf0, /* 111100001111 */
264 0x3f, 0xc0, /* 001111111100 */ 255 0xe6, 0x70, /* 111001100111 */
265 0x3f, 0xc0, /* 001111111100 */ 256 0xe6, 0x70, /* 111001100111 */
266 0x3f, 0xc0, /* 001111111100 */ 257 0xcf, 0x30, /* 110011110011 */
267 0x3f, 0xc0, /* 001111111100 */ 258 0xcf, 0x30, /* 110011110011 */
268 0x3f, 0xc0, /* 001111111100 */ 259 0xe6, 0x70, /* 111001100111 */
269 0x3f, 0xc0, /* 001111111100 */ 260 0xe6, 0x70, /* 111001100111 */
270 0x3f, 0xc0, /* 001111111100 */ 261 0xf0, 0xf0, /* 111100001111 */
271 0x3f, 0xc0, /* 001111111100 */ 262 0xf0, 0xf0, /* 111100001111 */
272 0x3f, 0xc0, /* 001111111100 */ 263 0xf9, 0xf0, /* 111110011111 */
273 0x3f, 0xc0, /* 001111111100 */ 264 0xff, 0xf0, /* 111111111111 */
274 0x3f, 0xc0, /* 001111111100 */ 265 0xff, 0xf0, /* 111111111111 */
275 0x00, 0x00, /* 000000000000 */ 266 0xff, 0xf0, /* 111111111111 */
276 0x00, 0x00, /* 000000000000 */ 267 0xff, 0xf0, /* 111111111111 */
277 0x00, 0x00, /* 000000000000 */ 268 0xff, 0xf0, /* 111111111111 */
278 0x00, 0x00, /* 000000000000 */ 269 0xff, 0xf0, /* 111111111111 */
279 0x00, 0x00, /* 000000000000 */
280 270
281 /* 11 0x0b '^K' */ 271 /* 11 0x0b '^K' */
282 /* FIXME */
283 0x00, 0x00, /* 000000000000 */
284 0x00, 0x00, /* 000000000000 */
285 0x00, 0x00, /* 000000000000 */ 272 0x00, 0x00, /* 000000000000 */
286 0x00, 0x00, /* 000000000000 */ 273 0x00, 0x00, /* 000000000000 */
274 0x0f, 0xe0, /* 000011111110 */
275 0x0f, 0xe0, /* 000011111110 */
276 0x01, 0xe0, /* 000000011110 */
277 0x03, 0x60, /* 000000110110 */
278 0x06, 0x60, /* 000001100110 */
279 0x1e, 0x00, /* 000111100000 */
280 0x33, 0x00, /* 001100110000 */
281 0x33, 0x00, /* 001100110000 */
282 0x61, 0x80, /* 011000011000 */
283 0x61, 0x80, /* 011000011000 */
284 0x33, 0x00, /* 001100110000 */
285 0x33, 0x00, /* 001100110000 */
286 0x1e, 0x00, /* 000111100000 */
287 0x0c, 0x00, /* 000011000000 */
287 0x00, 0x00, /* 000000000000 */ 288 0x00, 0x00, /* 000000000000 */
288 0x3f, 0xc0, /* 001111111100 */
289 0x3f, 0xc0, /* 001111111100 */
290 0x3f, 0xc0, /* 001111111100 */
291 0x3f, 0xc0, /* 001111111100 */
292 0x3f, 0xc0, /* 001111111100 */
293 0x3f, 0xc0, /* 001111111100 */
294 0x3f, 0xc0, /* 001111111100 */
295 0x3f, 0xc0, /* 001111111100 */
296 0x3f, 0xc0, /* 001111111100 */
297 0x3f, 0xc0, /* 001111111100 */
298 0x3f, 0xc0, /* 001111111100 */
299 0x3f, 0xc0, /* 001111111100 */
300 0x00, 0x00, /* 000000000000 */ 289 0x00, 0x00, /* 000000000000 */
301 0x00, 0x00, /* 000000000000 */ 290 0x00, 0x00, /* 000000000000 */
302 0x00, 0x00, /* 000000000000 */ 291 0x00, 0x00, /* 000000000000 */
@@ -304,24 +293,23 @@ static unsigned char fontdata_sun12x22[FONTDATAMAX] = {
304 0x00, 0x00, /* 000000000000 */ 293 0x00, 0x00, /* 000000000000 */
305 294
306 /* 12 0x0c '^L' */ 295 /* 12 0x0c '^L' */
307 /* FIXME */
308 0x00, 0x00, /* 000000000000 */
309 0x00, 0x00, /* 000000000000 */
310 0x00, 0x00, /* 000000000000 */
311 0x00, 0x00, /* 000000000000 */ 296 0x00, 0x00, /* 000000000000 */
312 0x00, 0x00, /* 000000000000 */ 297 0x00, 0x00, /* 000000000000 */
298 0x06, 0x00, /* 000001100000 */
299 0x0f, 0x00, /* 000011110000 */
300 0x19, 0x80, /* 000110011000 */
301 0x30, 0xc0, /* 001100001100 */
302 0x30, 0xc0, /* 001100001100 */
303 0x19, 0x80, /* 000110011000 */
304 0x0f, 0x00, /* 000011110000 */
305 0x06, 0x00, /* 000001100000 */
306 0x06, 0x00, /* 000001100000 */
307 0x06, 0x00, /* 000001100000 */
313 0x3f, 0xc0, /* 001111111100 */ 308 0x3f, 0xc0, /* 001111111100 */
314 0x3f, 0xc0, /* 001111111100 */ 309 0x3f, 0xc0, /* 001111111100 */
315 0x3f, 0xc0, /* 001111111100 */ 310 0x06, 0x00, /* 000001100000 */
316 0x3f, 0xc0, /* 001111111100 */ 311 0x06, 0x00, /* 000001100000 */
317 0x3f, 0xc0, /* 001111111100 */ 312 0x00, 0x00, /* 000000000000 */
318 0x3f, 0xc0, /* 001111111100 */
319 0x3f, 0xc0, /* 001111111100 */
320 0x3f, 0xc0, /* 001111111100 */
321 0x3f, 0xc0, /* 001111111100 */
322 0x3f, 0xc0, /* 001111111100 */
323 0x3f, 0xc0, /* 001111111100 */
324 0x3f, 0xc0, /* 001111111100 */
325 0x00, 0x00, /* 000000000000 */ 313 0x00, 0x00, /* 000000000000 */
326 0x00, 0x00, /* 000000000000 */ 314 0x00, 0x00, /* 000000000000 */
327 0x00, 0x00, /* 000000000000 */ 315 0x00, 0x00, /* 000000000000 */
@@ -329,149 +317,143 @@ static unsigned char fontdata_sun12x22[FONTDATAMAX] = {
329 0x00, 0x00, /* 000000000000 */ 317 0x00, 0x00, /* 000000000000 */
330 318
331 /* 13 0x0d '^M' */ 319 /* 13 0x0d '^M' */
332 /* FIXME */
333 0x00, 0x00, /* 000000000000 */
334 0x00, 0x00, /* 000000000000 */
335 0x00, 0x00, /* 000000000000 */
336 0x00, 0x00, /* 000000000000 */
337 0x00, 0x00, /* 000000000000 */
338 0x3f, 0xc0, /* 001111111100 */
339 0x3f, 0xc0, /* 001111111100 */
340 0x3f, 0xc0, /* 001111111100 */
341 0x3f, 0xc0, /* 001111111100 */
342 0x3f, 0xc0, /* 001111111100 */
343 0x3f, 0xc0, /* 001111111100 */
344 0x3f, 0xc0, /* 001111111100 */
345 0x3f, 0xc0, /* 001111111100 */
346 0x3f, 0xc0, /* 001111111100 */
347 0x3f, 0xc0, /* 001111111100 */
348 0x3f, 0xc0, /* 001111111100 */
349 0x3f, 0xc0, /* 001111111100 */
350 0x00, 0x00, /* 000000000000 */ 320 0x00, 0x00, /* 000000000000 */
351 0x00, 0x00, /* 000000000000 */ 321 0x00, 0x00, /* 000000000000 */
322 0x0f, 0xe0, /* 000011111110 */
323 0x0c, 0x60, /* 000011000110 */
324 0x0c, 0x60, /* 000011000110 */
325 0x0f, 0xe0, /* 000011111110 */
326 0x0c, 0x00, /* 000011000000 */
327 0x0c, 0x00, /* 000011000000 */
328 0x0c, 0x00, /* 000011000000 */
329 0x0c, 0x00, /* 000011000000 */
330 0x0c, 0x00, /* 000011000000 */
331 0x0c, 0x00, /* 000011000000 */
332 0x0c, 0x00, /* 000011000000 */
333 0x0c, 0x00, /* 000011000000 */
334 0x0c, 0x00, /* 000011000000 */
335 0x3c, 0x00, /* 001111000000 */
336 0x7c, 0x00, /* 011111000000 */
337 0x78, 0x00, /* 011110000000 */
338 0x30, 0x00, /* 001100000000 */
352 0x00, 0x00, /* 000000000000 */ 339 0x00, 0x00, /* 000000000000 */
353 0x00, 0x00, /* 000000000000 */ 340 0x00, 0x00, /* 000000000000 */
354 0x00, 0x00, /* 000000000000 */ 341 0x00, 0x00, /* 000000000000 */
355 342
356 /* 14 0x0e '^N' */ 343 /* 14 0x0e '^N' */
357 /* FIXME */
358 0x00, 0x00, /* 000000000000 */
359 0x00, 0x00, /* 000000000000 */
360 0x00, 0x00, /* 000000000000 */
361 0x00, 0x00, /* 000000000000 */
362 0x00, 0x00, /* 000000000000 */
363 0x3f, 0xc0, /* 001111111100 */
364 0x3f, 0xc0, /* 001111111100 */
365 0x3f, 0xc0, /* 001111111100 */
366 0x3f, 0xc0, /* 001111111100 */
367 0x3f, 0xc0, /* 001111111100 */
368 0x3f, 0xc0, /* 001111111100 */
369 0x3f, 0xc0, /* 001111111100 */
370 0x3f, 0xc0, /* 001111111100 */
371 0x3f, 0xc0, /* 001111111100 */
372 0x3f, 0xc0, /* 001111111100 */
373 0x3f, 0xc0, /* 001111111100 */
374 0x3f, 0xc0, /* 001111111100 */
375 0x00, 0x00, /* 000000000000 */ 344 0x00, 0x00, /* 000000000000 */
376 0x00, 0x00, /* 000000000000 */ 345 0x00, 0x00, /* 000000000000 */
346 0x1f, 0xe0, /* 000111111110 */
347 0x18, 0x60, /* 000110000110 */
348 0x18, 0x60, /* 000110000110 */
349 0x1f, 0xe0, /* 000111111110 */
350 0x18, 0x60, /* 000110000110 */
351 0x18, 0x60, /* 000110000110 */
352 0x18, 0x60, /* 000110000110 */
353 0x18, 0x60, /* 000110000110 */
354 0x18, 0x60, /* 000110000110 */
355 0x18, 0x60, /* 000110000110 */
356 0x19, 0xe0, /* 000110011110 */
357 0x1b, 0xe0, /* 000110111110 */
358 0x1b, 0xc0, /* 000110111100 */
359 0x79, 0x80, /* 011110011000 */
360 0xf8, 0x00, /* 111110000000 */
361 0xf0, 0x00, /* 111100000000 */
362 0x60, 0x00, /* 011000000000 */
377 0x00, 0x00, /* 000000000000 */ 363 0x00, 0x00, /* 000000000000 */
378 0x00, 0x00, /* 000000000000 */ 364 0x00, 0x00, /* 000000000000 */
379 0x00, 0x00, /* 000000000000 */ 365 0x00, 0x00, /* 000000000000 */
380 366
381 /* 15 0x0f '^O' */ 367 /* 15 0x0f '^O' */
382 /* FIXME */
383 0x00, 0x00, /* 000000000000 */
384 0x00, 0x00, /* 000000000000 */ 368 0x00, 0x00, /* 000000000000 */
385 0x00, 0x00, /* 000000000000 */ 369 0x00, 0x00, /* 000000000000 */
386 0x00, 0x00, /* 000000000000 */ 370 0x00, 0x00, /* 000000000000 */
387 0x00, 0x00, /* 000000000000 */ 371 0x00, 0x00, /* 000000000000 */
388 0x3f, 0xc0, /* 001111111100 */
389 0x3f, 0xc0, /* 001111111100 */
390 0x3f, 0xc0, /* 001111111100 */
391 0x3f, 0xc0, /* 001111111100 */
392 0x3f, 0xc0, /* 001111111100 */
393 0x3f, 0xc0, /* 001111111100 */
394 0x3f, 0xc0, /* 001111111100 */
395 0x3f, 0xc0, /* 001111111100 */
396 0x3f, 0xc0, /* 001111111100 */
397 0x3f, 0xc0, /* 001111111100 */
398 0x3f, 0xc0, /* 001111111100 */
399 0x3f, 0xc0, /* 001111111100 */
400 0x00, 0x00, /* 000000000000 */
401 0x00, 0x00, /* 000000000000 */
402 0x00, 0x00, /* 000000000000 */ 372 0x00, 0x00, /* 000000000000 */
403 0x00, 0x00, /* 000000000000 */ 373 0x00, 0x00, /* 000000000000 */
404 0x00, 0x00, /* 000000000000 */ 374 0x00, 0x00, /* 000000000000 */
405 375 0x18, 0xc0, /* 000110001100 */
406 /* 16 0x10 '^P' */ 376 0x0d, 0x80, /* 000011011000 */
407 /* FIXME */ 377 0x6d, 0xb0, /* 011011011011 */
378 0x3d, 0xe0, /* 001111011110 */
408 0x00, 0x00, /* 000000000000 */ 379 0x00, 0x00, /* 000000000000 */
380 0x3d, 0xe0, /* 001111011110 */
381 0x6d, 0xb0, /* 011011011011 */
382 0x0d, 0x80, /* 000011011000 */
383 0x18, 0xc0, /* 000110001100 */
409 0x00, 0x00, /* 000000000000 */ 384 0x00, 0x00, /* 000000000000 */
410 0x00, 0x00, /* 000000000000 */ 385 0x00, 0x00, /* 000000000000 */
411 0x00, 0x00, /* 000000000000 */ 386 0x00, 0x00, /* 000000000000 */
412 0x00, 0x00, /* 000000000000 */ 387 0x00, 0x00, /* 000000000000 */
413 0x3f, 0xc0, /* 001111111100 */
414 0x3f, 0xc0, /* 001111111100 */
415 0x3f, 0xc0, /* 001111111100 */
416 0x3f, 0xc0, /* 001111111100 */
417 0x3f, 0xc0, /* 001111111100 */
418 0x3f, 0xc0, /* 001111111100 */
419 0x3f, 0xc0, /* 001111111100 */
420 0x3f, 0xc0, /* 001111111100 */
421 0x3f, 0xc0, /* 001111111100 */
422 0x3f, 0xc0, /* 001111111100 */
423 0x3f, 0xc0, /* 001111111100 */
424 0x3f, 0xc0, /* 001111111100 */
425 0x00, 0x00, /* 000000000000 */ 388 0x00, 0x00, /* 000000000000 */
426 0x00, 0x00, /* 000000000000 */ 389 0x00, 0x00, /* 000000000000 */
390
391 /* 16 0x10 '^P' */
427 0x00, 0x00, /* 000000000000 */ 392 0x00, 0x00, /* 000000000000 */
393 0x00, 0x20, /* 000000000010 */
394 0x00, 0x60, /* 000000000110 */
395 0x00, 0xe0, /* 000000001110 */
396 0x01, 0xe0, /* 000000011110 */
397 0x03, 0xe0, /* 000000111110 */
398 0x07, 0xe0, /* 000001111110 */
399 0x0f, 0xe0, /* 000011111110 */
400 0x1f, 0xe0, /* 000111111110 */
401 0x3f, 0xe0, /* 001111111110 */
402 0x7f, 0xe0, /* 011111111110 */
403 0x3f, 0xe0, /* 001111111110 */
404 0x1f, 0xe0, /* 000111111110 */
405 0x0f, 0xe0, /* 000011111110 */
406 0x07, 0xe0, /* 000001111110 */
407 0x03, 0xe0, /* 000000111110 */
408 0x01, 0xe0, /* 000000011110 */
409 0x00, 0xe0, /* 000000001110 */
410 0x00, 0x60, /* 000000000110 */
411 0x00, 0x20, /* 000000000010 */
428 0x00, 0x00, /* 000000000000 */ 412 0x00, 0x00, /* 000000000000 */
429 0x00, 0x00, /* 000000000000 */ 413 0x00, 0x00, /* 000000000000 */
430 414
431 /* 17 0x11 '^Q' */ 415 /* 17 0x11 '^Q' */
432 /* FIXME */
433 0x00, 0x00, /* 000000000000 */
434 0x00, 0x00, /* 000000000000 */
435 0x00, 0x00, /* 000000000000 */
436 0x00, 0x00, /* 000000000000 */
437 0x00, 0x00, /* 000000000000 */
438 0x3f, 0xc0, /* 001111111100 */
439 0x3f, 0xc0, /* 001111111100 */
440 0x3f, 0xc0, /* 001111111100 */
441 0x3f, 0xc0, /* 001111111100 */
442 0x3f, 0xc0, /* 001111111100 */
443 0x3f, 0xc0, /* 001111111100 */
444 0x3f, 0xc0, /* 001111111100 */
445 0x3f, 0xc0, /* 001111111100 */
446 0x3f, 0xc0, /* 001111111100 */
447 0x3f, 0xc0, /* 001111111100 */
448 0x3f, 0xc0, /* 001111111100 */
449 0x3f, 0xc0, /* 001111111100 */
450 0x00, 0x00, /* 000000000000 */
451 0x00, 0x00, /* 000000000000 */
452 0x00, 0x00, /* 000000000000 */ 416 0x00, 0x00, /* 000000000000 */
417 0x40, 0x00, /* 010000000000 */
418 0x60, 0x00, /* 011000000000 */
419 0x70, 0x00, /* 011100000000 */
420 0x78, 0x00, /* 011110000000 */
421 0x7c, 0x00, /* 011111000000 */
422 0x7e, 0x00, /* 011111100000 */
423 0x7f, 0x00, /* 011111110000 */
424 0x7f, 0x80, /* 011111111000 */
425 0x7f, 0xc0, /* 011111111100 */
426 0x7f, 0xe0, /* 011111111110 */
427 0x7f, 0xc0, /* 011111111100 */
428 0x7f, 0x80, /* 011111111000 */
429 0x7f, 0x00, /* 011111110000 */
430 0x7e, 0x00, /* 011111100000 */
431 0x7c, 0x00, /* 011111000000 */
432 0x78, 0x00, /* 011110000000 */
433 0x70, 0x00, /* 011100000000 */
434 0x60, 0x00, /* 011000000000 */
435 0x40, 0x00, /* 010000000000 */
453 0x00, 0x00, /* 000000000000 */ 436 0x00, 0x00, /* 000000000000 */
454 0x00, 0x00, /* 000000000000 */ 437 0x00, 0x00, /* 000000000000 */
455 438
456 /* 18 0x12 '^R' */ 439 /* 18 0x12 '^R' */
457 /* FIXME */
458 0x00, 0x00, /* 000000000000 */ 440 0x00, 0x00, /* 000000000000 */
459 0x00, 0x00, /* 000000000000 */ 441 0x00, 0x00, /* 000000000000 */
460 0x00, 0x00, /* 000000000000 */ 442 0x00, 0x00, /* 000000000000 */
461 0x00, 0x00, /* 000000000000 */ 443 0x00, 0x00, /* 000000000000 */
444 0x04, 0x00, /* 000001000000 */
445 0x0e, 0x00, /* 000011100000 */
446 0x1f, 0x00, /* 000111110000 */
447 0x3f, 0x80, /* 001111111000 */
448 0x7f, 0xc0, /* 011111111100 */
449 0x0e, 0x00, /* 000011100000 */
450 0x0e, 0x00, /* 000011100000 */
451 0x7f, 0xc0, /* 011111111100 */
452 0x3f, 0x80, /* 001111111000 */
453 0x1f, 0x00, /* 000111110000 */
454 0x0e, 0x00, /* 000011100000 */
455 0x04, 0x00, /* 000001000000 */
462 0x00, 0x00, /* 000000000000 */ 456 0x00, 0x00, /* 000000000000 */
463 0x3f, 0xc0, /* 001111111100 */
464 0x3f, 0xc0, /* 001111111100 */
465 0x3f, 0xc0, /* 001111111100 */
466 0x3f, 0xc0, /* 001111111100 */
467 0x3f, 0xc0, /* 001111111100 */
468 0x3f, 0xc0, /* 001111111100 */
469 0x3f, 0xc0, /* 001111111100 */
470 0x3f, 0xc0, /* 001111111100 */
471 0x3f, 0xc0, /* 001111111100 */
472 0x3f, 0xc0, /* 001111111100 */
473 0x3f, 0xc0, /* 001111111100 */
474 0x3f, 0xc0, /* 001111111100 */
475 0x00, 0x00, /* 000000000000 */ 457 0x00, 0x00, /* 000000000000 */
476 0x00, 0x00, /* 000000000000 */ 458 0x00, 0x00, /* 000000000000 */
477 0x00, 0x00, /* 000000000000 */ 459 0x00, 0x00, /* 000000000000 */
@@ -551,99 +533,95 @@ static unsigned char fontdata_sun12x22[FONTDATAMAX] = {
551 0x00, 0x00, /* 000000000000 */ 533 0x00, 0x00, /* 000000000000 */
552 534
553 /* 22 0x16 '^V' */ 535 /* 22 0x16 '^V' */
554 /* FIXME */
555 0x00, 0x00, /* 000000000000 */ 536 0x00, 0x00, /* 000000000000 */
556 0x00, 0x00, /* 000000000000 */ 537 0x00, 0x00, /* 000000000000 */
557 0x00, 0x00, /* 000000000000 */ 538 0x00, 0x00, /* 000000000000 */
558 0x00, 0x00, /* 000000000000 */ 539 0x00, 0x00, /* 000000000000 */
559 0x00, 0x00, /* 000000000000 */ 540 0x00, 0x00, /* 000000000000 */
560 0x3f, 0xc0, /* 001111111100 */
561 0x3f, 0xc0, /* 001111111100 */
562 0x3f, 0xc0, /* 001111111100 */
563 0x3f, 0xc0, /* 001111111100 */
564 0x3f, 0xc0, /* 001111111100 */
565 0x3f, 0xc0, /* 001111111100 */
566 0x3f, 0xc0, /* 001111111100 */
567 0x3f, 0xc0, /* 001111111100 */
568 0x3f, 0xc0, /* 001111111100 */
569 0x3f, 0xc0, /* 001111111100 */
570 0x3f, 0xc0, /* 001111111100 */
571 0x3f, 0xc0, /* 001111111100 */
572 0x00, 0x00, /* 000000000000 */
573 0x00, 0x00, /* 000000000000 */ 541 0x00, 0x00, /* 000000000000 */
574 0x00, 0x00, /* 000000000000 */ 542 0x00, 0x00, /* 000000000000 */
575 0x00, 0x00, /* 000000000000 */ 543 0x00, 0x00, /* 000000000000 */
576 0x00, 0x00, /* 000000000000 */ 544 0x00, 0x00, /* 000000000000 */
577
578 /* 23 0x17 '^W' */
579 /* FIXME */
580 0x00, 0x00, /* 000000000000 */ 545 0x00, 0x00, /* 000000000000 */
581 0x00, 0x00, /* 000000000000 */ 546 0x00, 0x00, /* 000000000000 */
582 0x00, 0x00, /* 000000000000 */ 547 0x00, 0x00, /* 000000000000 */
583 0x00, 0x00, /* 000000000000 */ 548 0x00, 0x00, /* 000000000000 */
549 0x7f, 0xe0, /* 011111111110 */
550 0x7f, 0xe0, /* 011111111110 */
551 0x7f, 0xe0, /* 011111111110 */
584 0x00, 0x00, /* 000000000000 */ 552 0x00, 0x00, /* 000000000000 */
585 0x3f, 0xc0, /* 001111111100 */
586 0x3f, 0xc0, /* 001111111100 */
587 0x3f, 0xc0, /* 001111111100 */
588 0x3f, 0xc0, /* 001111111100 */
589 0x3f, 0xc0, /* 001111111100 */
590 0x3f, 0xc0, /* 001111111100 */
591 0x3f, 0xc0, /* 001111111100 */
592 0x3f, 0xc0, /* 001111111100 */
593 0x3f, 0xc0, /* 001111111100 */
594 0x3f, 0xc0, /* 001111111100 */
595 0x3f, 0xc0, /* 001111111100 */
596 0x3f, 0xc0, /* 001111111100 */
597 0x00, 0x00, /* 000000000000 */ 553 0x00, 0x00, /* 000000000000 */
598 0x00, 0x00, /* 000000000000 */ 554 0x00, 0x00, /* 000000000000 */
599 0x00, 0x00, /* 000000000000 */ 555 0x00, 0x00, /* 000000000000 */
600 0x00, 0x00, /* 000000000000 */ 556 0x00, 0x00, /* 000000000000 */
601 0x00, 0x00, /* 000000000000 */ 557 0x00, 0x00, /* 000000000000 */
602 558
603 /* 24 0x18 '^X' */ 559 /* 23 0x17 '^W' */
604 /* FIXME */
605 0x00, 0x00, /* 000000000000 */ 560 0x00, 0x00, /* 000000000000 */
606 0x00, 0x00, /* 000000000000 */ 561 0x00, 0x00, /* 000000000000 */
562 0x04, 0x00, /* 000001000000 */
563 0x0e, 0x00, /* 000011100000 */
564 0x1f, 0x00, /* 000111110000 */
565 0x3f, 0x80, /* 001111111000 */
566 0x7f, 0xc0, /* 011111111100 */
567 0x0e, 0x00, /* 000011100000 */
568 0x0e, 0x00, /* 000011100000 */
569 0x7f, 0xc0, /* 011111111100 */
570 0x3f, 0x80, /* 001111111000 */
571 0x1f, 0x00, /* 000111110000 */
572 0x0e, 0x00, /* 000011100000 */
573 0x04, 0x00, /* 000001000000 */
607 0x00, 0x00, /* 000000000000 */ 574 0x00, 0x00, /* 000000000000 */
575 0x7f, 0xe0, /* 011111111110 */
576 0x7f, 0xe0, /* 011111111110 */
608 0x00, 0x00, /* 000000000000 */ 577 0x00, 0x00, /* 000000000000 */
609 0x00, 0x00, /* 000000000000 */ 578 0x00, 0x00, /* 000000000000 */
610 0x3f, 0xc0, /* 001111111100 */
611 0x3f, 0xc0, /* 001111111100 */
612 0x3f, 0xc0, /* 001111111100 */
613 0x3f, 0xc0, /* 001111111100 */
614 0x3f, 0xc0, /* 001111111100 */
615 0x3f, 0xc0, /* 001111111100 */
616 0x3f, 0xc0, /* 001111111100 */
617 0x3f, 0xc0, /* 001111111100 */
618 0x3f, 0xc0, /* 001111111100 */
619 0x3f, 0xc0, /* 001111111100 */
620 0x3f, 0xc0, /* 001111111100 */
621 0x3f, 0xc0, /* 001111111100 */
622 0x00, 0x00, /* 000000000000 */ 579 0x00, 0x00, /* 000000000000 */
623 0x00, 0x00, /* 000000000000 */ 580 0x00, 0x00, /* 000000000000 */
624 0x00, 0x00, /* 000000000000 */ 581 0x00, 0x00, /* 000000000000 */
582
583 /* 24 0x18 '^X' */
625 0x00, 0x00, /* 000000000000 */ 584 0x00, 0x00, /* 000000000000 */
626 0x00, 0x00, /* 000000000000 */ 585 0x00, 0x00, /* 000000000000 */
627 586 0x04, 0x00, /* 000001000000 */
628 /* 25 0x19 '^Y' */ 587 0x0e, 0x00, /* 000011100000 */
629 /* FIXME */ 588 0x1f, 0x00, /* 000111110000 */
589 0x3f, 0x80, /* 001111111000 */
590 0x7f, 0xc0, /* 011111111100 */
591 0x0e, 0x00, /* 000011100000 */
592 0x0e, 0x00, /* 000011100000 */
593 0x0e, 0x00, /* 000011100000 */
594 0x0e, 0x00, /* 000011100000 */
595 0x0e, 0x00, /* 000011100000 */
596 0x0e, 0x00, /* 000011100000 */
597 0x0e, 0x00, /* 000011100000 */
598 0x0e, 0x00, /* 000011100000 */
599 0x0e, 0x00, /* 000011100000 */
630 0x00, 0x00, /* 000000000000 */ 600 0x00, 0x00, /* 000000000000 */
631 0x00, 0x00, /* 000000000000 */ 601 0x00, 0x00, /* 000000000000 */
632 0x00, 0x00, /* 000000000000 */ 602 0x00, 0x00, /* 000000000000 */
633 0x00, 0x00, /* 000000000000 */ 603 0x00, 0x00, /* 000000000000 */
634 0x00, 0x00, /* 000000000000 */ 604 0x00, 0x00, /* 000000000000 */
635 0x3f, 0xc0, /* 001111111100 */ 605 0x00, 0x00, /* 000000000000 */
636 0x3f, 0xc0, /* 001111111100 */ 606
637 0x3f, 0xc0, /* 001111111100 */ 607 /* 25 0x19 '^Y' */
638 0x3f, 0xc0, /* 001111111100 */ 608 0x00, 0x00, /* 000000000000 */
639 0x3f, 0xc0, /* 001111111100 */ 609 0x00, 0x00, /* 000000000000 */
640 0x3f, 0xc0, /* 001111111100 */ 610 0x0e, 0x00, /* 000011100000 */
641 0x3f, 0xc0, /* 001111111100 */ 611 0x0e, 0x00, /* 000011100000 */
642 0x3f, 0xc0, /* 001111111100 */ 612 0x0e, 0x00, /* 000011100000 */
643 0x3f, 0xc0, /* 001111111100 */ 613 0x0e, 0x00, /* 000011100000 */
644 0x3f, 0xc0, /* 001111111100 */ 614 0x0e, 0x00, /* 000011100000 */
645 0x3f, 0xc0, /* 001111111100 */ 615 0x0e, 0x00, /* 000011100000 */
646 0x3f, 0xc0, /* 001111111100 */ 616 0x0e, 0x00, /* 000011100000 */
617 0x0e, 0x00, /* 000011100000 */
618 0x0e, 0x00, /* 000011100000 */
619 0x0e, 0x00, /* 000011100000 */
620 0x7f, 0xc0, /* 011111111100 */
621 0x3f, 0x80, /* 001111111000 */
622 0x1f, 0x00, /* 000111110000 */
623 0x0e, 0x00, /* 000011100000 */
624 0x04, 0x00, /* 000001000000 */
647 0x00, 0x00, /* 000000000000 */ 625 0x00, 0x00, /* 000000000000 */
648 0x00, 0x00, /* 000000000000 */ 626 0x00, 0x00, /* 000000000000 */
649 0x00, 0x00, /* 000000000000 */ 627 0x00, 0x00, /* 000000000000 */
@@ -651,24 +629,23 @@ static unsigned char fontdata_sun12x22[FONTDATAMAX] = {
651 0x00, 0x00, /* 000000000000 */ 629 0x00, 0x00, /* 000000000000 */
652 630
653 /* 26 0x1a '^Z' */ 631 /* 26 0x1a '^Z' */
654 /* FIXME */
655 0x00, 0x00, /* 000000000000 */ 632 0x00, 0x00, /* 000000000000 */
656 0x00, 0x00, /* 000000000000 */ 633 0x00, 0x00, /* 000000000000 */
657 0x00, 0x00, /* 000000000000 */ 634 0x00, 0x00, /* 000000000000 */
658 0x00, 0x00, /* 000000000000 */ 635 0x00, 0x00, /* 000000000000 */
659 0x00, 0x00, /* 000000000000 */ 636 0x00, 0x00, /* 000000000000 */
660 0x3f, 0xc0, /* 001111111100 */ 637 0x00, 0x00, /* 000000000000 */
661 0x3f, 0xc0, /* 001111111100 */ 638 0x08, 0x00, /* 000010000000 */
662 0x3f, 0xc0, /* 001111111100 */ 639 0x18, 0x00, /* 000110000000 */
663 0x3f, 0xc0, /* 001111111100 */ 640 0x38, 0x00, /* 001110000000 */
664 0x3f, 0xc0, /* 001111111100 */ 641 0x7f, 0xe0, /* 011111111110 */
665 0x3f, 0xc0, /* 001111111100 */ 642 0xff, 0xe0, /* 111111111110 */
666 0x3f, 0xc0, /* 001111111100 */ 643 0x7f, 0xe0, /* 011111111110 */
667 0x3f, 0xc0, /* 001111111100 */ 644 0x38, 0x00, /* 001110000000 */
668 0x3f, 0xc0, /* 001111111100 */ 645 0x18, 0x00, /* 000110000000 */
669 0x3f, 0xc0, /* 001111111100 */ 646 0x08, 0x00, /* 000010000000 */
670 0x3f, 0xc0, /* 001111111100 */ 647 0x00, 0x00, /* 000000000000 */
671 0x3f, 0xc0, /* 001111111100 */ 648 0x00, 0x00, /* 000000000000 */
672 0x00, 0x00, /* 000000000000 */ 649 0x00, 0x00, /* 000000000000 */
673 0x00, 0x00, /* 000000000000 */ 650 0x00, 0x00, /* 000000000000 */
674 0x00, 0x00, /* 000000000000 */ 651 0x00, 0x00, /* 000000000000 */
@@ -676,24 +653,23 @@ static unsigned char fontdata_sun12x22[FONTDATAMAX] = {
676 0x00, 0x00, /* 000000000000 */ 653 0x00, 0x00, /* 000000000000 */
677 654
678 /* 27 0x1b '^[' */ 655 /* 27 0x1b '^[' */
679 /* FIXME */
680 0x00, 0x00, /* 000000000000 */ 656 0x00, 0x00, /* 000000000000 */
681 0x00, 0x00, /* 000000000000 */ 657 0x00, 0x00, /* 000000000000 */
682 0x00, 0x00, /* 000000000000 */ 658 0x00, 0x00, /* 000000000000 */
683 0x00, 0x00, /* 000000000000 */ 659 0x00, 0x00, /* 000000000000 */
684 0x00, 0x00, /* 000000000000 */ 660 0x00, 0x00, /* 000000000000 */
685 0x3f, 0xc0, /* 001111111100 */ 661 0x00, 0x00, /* 000000000000 */
686 0x3f, 0xc0, /* 001111111100 */ 662 0x01, 0x00, /* 000000010000 */
687 0x3f, 0xc0, /* 001111111100 */ 663 0x01, 0x80, /* 000000011000 */
688 0x3f, 0xc0, /* 001111111100 */ 664 0x01, 0xc0, /* 000000011100 */
689 0x3f, 0xc0, /* 001111111100 */ 665 0x7f, 0xe0, /* 011111111110 */
690 0x3f, 0xc0, /* 001111111100 */ 666 0x7f, 0xf0, /* 011111111111 */
691 0x3f, 0xc0, /* 001111111100 */ 667 0x7f, 0xe0, /* 011111111110 */
692 0x3f, 0xc0, /* 001111111100 */ 668 0x01, 0xc0, /* 000000011100 */
693 0x3f, 0xc0, /* 001111111100 */ 669 0x01, 0x80, /* 000000011000 */
694 0x3f, 0xc0, /* 001111111100 */ 670 0x01, 0x00, /* 000000010000 */
695 0x3f, 0xc0, /* 001111111100 */ 671 0x00, 0x00, /* 000000000000 */
696 0x3f, 0xc0, /* 001111111100 */ 672 0x00, 0x00, /* 000000000000 */
697 0x00, 0x00, /* 000000000000 */ 673 0x00, 0x00, /* 000000000000 */
698 0x00, 0x00, /* 000000000000 */ 674 0x00, 0x00, /* 000000000000 */
699 0x00, 0x00, /* 000000000000 */ 675 0x00, 0x00, /* 000000000000 */
@@ -701,24 +677,23 @@ static unsigned char fontdata_sun12x22[FONTDATAMAX] = {
701 0x00, 0x00, /* 000000000000 */ 677 0x00, 0x00, /* 000000000000 */
702 678
703 /* 28 0x1c '^\' */ 679 /* 28 0x1c '^\' */
704 /* FIXME */
705 0x00, 0x00, /* 000000000000 */ 680 0x00, 0x00, /* 000000000000 */
706 0x00, 0x00, /* 000000000000 */ 681 0x00, 0x00, /* 000000000000 */
707 0x00, 0x00, /* 000000000000 */ 682 0x00, 0x00, /* 000000000000 */
708 0x00, 0x00, /* 000000000000 */ 683 0x00, 0x00, /* 000000000000 */
709 0x00, 0x00, /* 000000000000 */ 684 0x00, 0x00, /* 000000000000 */
710 0x3f, 0xc0, /* 001111111100 */ 685 0x00, 0x00, /* 000000000000 */
711 0x3f, 0xc0, /* 001111111100 */ 686 0x00, 0x00, /* 000000000000 */
712 0x3f, 0xc0, /* 001111111100 */ 687 0x00, 0x00, /* 000000000000 */
713 0x3f, 0xc0, /* 001111111100 */ 688 0x00, 0x00, /* 000000000000 */
714 0x3f, 0xc0, /* 001111111100 */ 689 0x00, 0x00, /* 000000000000 */
715 0x3f, 0xc0, /* 001111111100 */ 690 0x00, 0x00, /* 000000000000 */
716 0x3f, 0xc0, /* 001111111100 */ 691 0x00, 0x00, /* 000000000000 */
717 0x3f, 0xc0, /* 001111111100 */ 692 0x00, 0x00, /* 000000000000 */
718 0x3f, 0xc0, /* 001111111100 */ 693 0x30, 0x00, /* 001100000000 */
719 0x3f, 0xc0, /* 001111111100 */ 694 0x30, 0x00, /* 001100000000 */
720 0x3f, 0xc0, /* 001111111100 */ 695 0x3f, 0xe0, /* 001111111110 */
721 0x3f, 0xc0, /* 001111111100 */ 696 0x3f, 0xe0, /* 001111111110 */
722 0x00, 0x00, /* 000000000000 */ 697 0x00, 0x00, /* 000000000000 */
723 0x00, 0x00, /* 000000000000 */ 698 0x00, 0x00, /* 000000000000 */
724 0x00, 0x00, /* 000000000000 */ 699 0x00, 0x00, /* 000000000000 */
@@ -726,24 +701,23 @@ static unsigned char fontdata_sun12x22[FONTDATAMAX] = {
726 0x00, 0x00, /* 000000000000 */ 701 0x00, 0x00, /* 000000000000 */
727 702
728 /* 29 0x1d '^]' */ 703 /* 29 0x1d '^]' */
729 /* FIXME */
730 0x00, 0x00, /* 000000000000 */ 704 0x00, 0x00, /* 000000000000 */
731 0x00, 0x00, /* 000000000000 */ 705 0x00, 0x00, /* 000000000000 */
732 0x00, 0x00, /* 000000000000 */ 706 0x00, 0x00, /* 000000000000 */
733 0x00, 0x00, /* 000000000000 */ 707 0x00, 0x00, /* 000000000000 */
734 0x00, 0x00, /* 000000000000 */ 708 0x00, 0x00, /* 000000000000 */
735 0x3f, 0xc0, /* 001111111100 */ 709 0x00, 0x00, /* 000000000000 */
736 0x3f, 0xc0, /* 001111111100 */ 710 0x09, 0x00, /* 000010010000 */
737 0x3f, 0xc0, /* 001111111100 */ 711 0x19, 0x80, /* 000110011000 */
738 0x3f, 0xc0, /* 001111111100 */ 712 0x39, 0xc0, /* 001110011100 */
739 0x3f, 0xc0, /* 001111111100 */ 713 0x7f, 0xe0, /* 011111111110 */
740 0x3f, 0xc0, /* 001111111100 */ 714 0xff, 0xf0, /* 111111111111 */
741 0x3f, 0xc0, /* 001111111100 */ 715 0x7f, 0xe0, /* 011111111110 */
742 0x3f, 0xc0, /* 001111111100 */ 716 0x39, 0xc0, /* 001110011100 */
743 0x3f, 0xc0, /* 001111111100 */ 717 0x19, 0x80, /* 000110011000 */
744 0x3f, 0xc0, /* 001111111100 */ 718 0x09, 0x00, /* 000010010000 */
745 0x3f, 0xc0, /* 001111111100 */ 719 0x00, 0x00, /* 000000000000 */
746 0x3f, 0xc0, /* 001111111100 */ 720 0x00, 0x00, /* 000000000000 */
747 0x00, 0x00, /* 000000000000 */ 721 0x00, 0x00, /* 000000000000 */
748 0x00, 0x00, /* 000000000000 */ 722 0x00, 0x00, /* 000000000000 */
749 0x00, 0x00, /* 000000000000 */ 723 0x00, 0x00, /* 000000000000 */
@@ -751,24 +725,23 @@ static unsigned char fontdata_sun12x22[FONTDATAMAX] = {
751 0x00, 0x00, /* 000000000000 */ 725 0x00, 0x00, /* 000000000000 */
752 726
753 /* 30 0x1e '^^' */ 727 /* 30 0x1e '^^' */
754 /* FIXME */
755 0x00, 0x00, /* 000000000000 */ 728 0x00, 0x00, /* 000000000000 */
756 0x00, 0x00, /* 000000000000 */ 729 0x00, 0x00, /* 000000000000 */
757 0x00, 0x00, /* 000000000000 */ 730 0x00, 0x00, /* 000000000000 */
758 0x00, 0x00, /* 000000000000 */ 731 0x00, 0x00, /* 000000000000 */
759 0x00, 0x00, /* 000000000000 */ 732 0x00, 0x00, /* 000000000000 */
760 0x3f, 0xc0, /* 001111111100 */ 733 0x00, 0x00, /* 000000000000 */
761 0x3f, 0xc0, /* 001111111100 */ 734 0x04, 0x00, /* 000001000000 */
762 0x3f, 0xc0, /* 001111111100 */ 735 0x04, 0x00, /* 000001000000 */
763 0x3f, 0xc0, /* 001111111100 */ 736 0x0e, 0x00, /* 000011100000 */
764 0x3f, 0xc0, /* 001111111100 */ 737 0x0e, 0x00, /* 000011100000 */
765 0x3f, 0xc0, /* 001111111100 */ 738 0x1f, 0x00, /* 000111110000 */
766 0x3f, 0xc0, /* 001111111100 */ 739 0x1f, 0x00, /* 000111110000 */
767 0x3f, 0xc0, /* 001111111100 */ 740 0x3f, 0x80, /* 001111111000 */
768 0x3f, 0xc0, /* 001111111100 */ 741 0x3f, 0x80, /* 001111111000 */
769 0x3f, 0xc0, /* 001111111100 */ 742 0x7f, 0xc0, /* 011111111100 */
770 0x3f, 0xc0, /* 001111111100 */ 743 0x7f, 0xc0, /* 011111111100 */
771 0x3f, 0xc0, /* 001111111100 */ 744 0x00, 0x00, /* 000000000000 */
772 0x00, 0x00, /* 000000000000 */ 745 0x00, 0x00, /* 000000000000 */
773 0x00, 0x00, /* 000000000000 */ 746 0x00, 0x00, /* 000000000000 */
774 0x00, 0x00, /* 000000000000 */ 747 0x00, 0x00, /* 000000000000 */
@@ -776,24 +749,23 @@ static unsigned char fontdata_sun12x22[FONTDATAMAX] = {
776 0x00, 0x00, /* 000000000000 */ 749 0x00, 0x00, /* 000000000000 */
777 750
778 /* 31 0x1f '^_' */ 751 /* 31 0x1f '^_' */
779 /* FIXME */
780 0x00, 0x00, /* 000000000000 */ 752 0x00, 0x00, /* 000000000000 */
781 0x00, 0x00, /* 000000000000 */ 753 0x00, 0x00, /* 000000000000 */
782 0x00, 0x00, /* 000000000000 */ 754 0x00, 0x00, /* 000000000000 */
783 0x00, 0x00, /* 000000000000 */ 755 0x00, 0x00, /* 000000000000 */
784 0x00, 0x00, /* 000000000000 */ 756 0x00, 0x00, /* 000000000000 */
785 0x3f, 0xc0, /* 001111111100 */ 757 0x00, 0x00, /* 000000000000 */
786 0x3f, 0xc0, /* 001111111100 */ 758 0x7f, 0xc0, /* 011111111100 */
787 0x3f, 0xc0, /* 001111111100 */ 759 0x7f, 0xc0, /* 011111111100 */
788 0x3f, 0xc0, /* 001111111100 */ 760 0x3f, 0x80, /* 001111111000 */
789 0x3f, 0xc0, /* 001111111100 */ 761 0x3f, 0x80, /* 001111111000 */
790 0x3f, 0xc0, /* 001111111100 */ 762 0x1f, 0x00, /* 000111110000 */
791 0x3f, 0xc0, /* 001111111100 */ 763 0x1f, 0x00, /* 000111110000 */
792 0x3f, 0xc0, /* 001111111100 */ 764 0x0e, 0x00, /* 000011100000 */
793 0x3f, 0xc0, /* 001111111100 */ 765 0x0e, 0x00, /* 000011100000 */
794 0x3f, 0xc0, /* 001111111100 */ 766 0x04, 0x00, /* 000001000000 */
795 0x3f, 0xc0, /* 001111111100 */ 767 0x04, 0x00, /* 000001000000 */
796 0x3f, 0xc0, /* 001111111100 */ 768 0x00, 0x00, /* 000000000000 */
797 0x00, 0x00, /* 000000000000 */ 769 0x00, 0x00, /* 000000000000 */
798 0x00, 0x00, /* 000000000000 */ 770 0x00, 0x00, /* 000000000000 */
799 0x00, 0x00, /* 000000000000 */ 771 0x00, 0x00, /* 000000000000 */
@@ -3081,29 +3053,28 @@ static unsigned char fontdata_sun12x22[FONTDATAMAX] = {
3081 0x00, 0x00, /* 000000000000 */ 3053 0x00, 0x00, /* 000000000000 */
3082 3054
3083 /* 127 0x7f '.' */ 3055 /* 127 0x7f '.' */
3084 /* FIXME */
3085 0x00, 0x00, /* 000000000000 */ 3056 0x00, 0x00, /* 000000000000 */
3086 0x00, 0x00, /* 000000000000 */ 3057 0x00, 0x00, /* 000000000000 */
3087 0x00, 0x00, /* 000000000000 */ 3058 0x00, 0x00, /* 000000000000 */
3088 0x00, 0x00, /* 000000000000 */ 3059 0x00, 0x00, /* 000000000000 */
3089 0x00, 0x00, /* 000000000000 */ 3060 0x00, 0x00, /* 000000000000 */
3090 0x3f, 0xc0, /* 001111111100 */
3091 0x3f, 0xc0, /* 001111111100 */
3092 0x3f, 0xc0, /* 001111111100 */
3093 0x3f, 0xc0, /* 001111111100 */
3094 0x3f, 0xc0, /* 001111111100 */
3095 0x3f, 0xc0, /* 001111111100 */
3096 0x3f, 0xc0, /* 001111111100 */
3097 0x3f, 0xc0, /* 001111111100 */
3098 0x3f, 0xc0, /* 001111111100 */
3099 0x3f, 0xc0, /* 001111111100 */
3100 0x3f, 0xc0, /* 001111111100 */
3101 0x3f, 0xc0, /* 001111111100 */
3102 0x00, 0x00, /* 000000000000 */ 3061 0x00, 0x00, /* 000000000000 */
3103 0x00, 0x00, /* 000000000000 */ 3062 0x00, 0x00, /* 000000000000 */
3104 0x00, 0x00, /* 000000000000 */ 3063 0x00, 0x00, /* 000000000000 */
3105 0x00, 0x00, /* 000000000000 */ 3064 0x00, 0x00, /* 000000000000 */
3106 0x00, 0x00, /* 000000000000 */ 3065 0x00, 0x00, /* 000000000000 */
3066 0x00, 0x00, /* 000000000000 */
3067 0x00, 0x00, /* 000000000000 */
3068 0x00, 0x00, /* 000000000000 */
3069 0x00, 0x00, /* 000000000000 */
3070 0x00, 0x00, /* 000000000000 */
3071 0x00, 0x00, /* 000000000000 */
3072 0x00, 0x00, /* 000000000000 */
3073 0x00, 0x00, /* 000000000000 */
3074 0x00, 0x00, /* 000000000000 */
3075 0xff, 0xf0, /* 111111111111 */
3076 0xff, 0xf0, /* 111111111111 */
3077 0x00, 0x00, /* 000000000000 */
3107 3078
3108 /* 128 0x80 '.' */ 3079 /* 128 0x80 '.' */
3109 0x00, 0x00, /* 000000000000 */ 3080 0x00, 0x00, /* 000000000000 */
@@ -3826,24 +3797,23 @@ static unsigned char fontdata_sun12x22[FONTDATAMAX] = {
3826 0x00, 0x00, /* 000000000000 */ 3797 0x00, 0x00, /* 000000000000 */
3827 3798
3828 /* 158 0x9e '.' */ 3799 /* 158 0x9e '.' */
3829 /* FIXME */
3830 0x00, 0x00, /* 000000000000 */
3831 0x00, 0x00, /* 000000000000 */
3832 0x00, 0x00, /* 000000000000 */
3833 0x00, 0x00, /* 000000000000 */ 3800 0x00, 0x00, /* 000000000000 */
3801 0x7f, 0x80, /* 011111111000 */
3802 0x30, 0xc0, /* 001100001100 */
3803 0x30, 0x60, /* 001100000110 */
3804 0x30, 0x60, /* 001100000110 */
3805 0x30, 0x60, /* 001100000110 */
3806 0x30, 0xc0, /* 001100001100 */
3807 0x37, 0x80, /* 001101111000 */
3808 0x30, 0x00, /* 001100000000 */
3809 0x33, 0x00, /* 001100110000 */
3810 0x37, 0x80, /* 001101111000 */
3811 0x33, 0x00, /* 001100110000 */
3812 0x33, 0x00, /* 001100110000 */
3813 0x33, 0x30, /* 001100110011 */
3814 0x31, 0xe0, /* 001100011110 */
3815 0x78, 0xc0, /* 011110001100 */
3834 0x00, 0x00, /* 000000000000 */ 3816 0x00, 0x00, /* 000000000000 */
3835 0x3f, 0xc0, /* 001111111100 */
3836 0x3f, 0xc0, /* 001111111100 */
3837 0x3f, 0xc0, /* 001111111100 */
3838 0x3f, 0xc0, /* 001111111100 */
3839 0x3f, 0xc0, /* 001111111100 */
3840 0x3f, 0xc0, /* 001111111100 */
3841 0x3f, 0xc0, /* 001111111100 */
3842 0x3f, 0xc0, /* 001111111100 */
3843 0x3f, 0xc0, /* 001111111100 */
3844 0x3f, 0xc0, /* 001111111100 */
3845 0x3f, 0xc0, /* 001111111100 */
3846 0x3f, 0xc0, /* 001111111100 */
3847 0x00, 0x00, /* 000000000000 */ 3817 0x00, 0x00, /* 000000000000 */
3848 0x00, 0x00, /* 000000000000 */ 3818 0x00, 0x00, /* 000000000000 */
3849 0x00, 0x00, /* 000000000000 */ 3819 0x00, 0x00, /* 000000000000 */
@@ -3851,28 +3821,27 @@ static unsigned char fontdata_sun12x22[FONTDATAMAX] = {
3851 0x00, 0x00, /* 000000000000 */ 3821 0x00, 0x00, /* 000000000000 */
3852 3822
3853 /* 159 0x9f '.' */ 3823 /* 159 0x9f '.' */
3854 /* FIXME */
3855 0x00, 0x00, /* 000000000000 */
3856 0x00, 0x00, /* 000000000000 */
3857 0x00, 0x00, /* 000000000000 */
3858 0x00, 0x00, /* 000000000000 */
3859 0x00, 0x00, /* 000000000000 */
3860 0x3f, 0xc0, /* 001111111100 */
3861 0x3f, 0xc0, /* 001111111100 */
3862 0x3f, 0xc0, /* 001111111100 */
3863 0x3f, 0xc0, /* 001111111100 */
3864 0x3f, 0xc0, /* 001111111100 */
3865 0x3f, 0xc0, /* 001111111100 */
3866 0x3f, 0xc0, /* 001111111100 */
3867 0x3f, 0xc0, /* 001111111100 */
3868 0x3f, 0xc0, /* 001111111100 */
3869 0x3f, 0xc0, /* 001111111100 */
3870 0x3f, 0xc0, /* 001111111100 */
3871 0x3f, 0xc0, /* 001111111100 */
3872 0x00, 0x00, /* 000000000000 */
3873 0x00, 0x00, /* 000000000000 */
3874 0x00, 0x00, /* 000000000000 */
3875 0x00, 0x00, /* 000000000000 */ 3824 0x00, 0x00, /* 000000000000 */
3825 0x00, 0xc0, /* 000000001100 */
3826 0x01, 0xe0, /* 000000011110 */
3827 0x03, 0x30, /* 000000110011 */
3828 0x06, 0x00, /* 000001100000 */
3829 0x06, 0x00, /* 000001100000 */
3830 0x06, 0x00, /* 000001100000 */
3831 0x06, 0x00, /* 000001100000 */
3832 0x06, 0x00, /* 000001100000 */
3833 0x06, 0x00, /* 000001100000 */
3834 0x3f, 0xe0, /* 001111111110 */
3835 0x7f, 0xc0, /* 011111111100 */
3836 0x06, 0x00, /* 000001100000 */
3837 0x06, 0x00, /* 000001100000 */
3838 0x06, 0x00, /* 000001100000 */
3839 0x06, 0x00, /* 000001100000 */
3840 0x06, 0x00, /* 000001100000 */
3841 0x06, 0x00, /* 000001100000 */
3842 0xcc, 0x00, /* 110011000000 */
3843 0x78, 0x00, /* 011110000000 */
3844 0x30, 0x00, /* 001100000000 */
3876 0x00, 0x00, /* 000000000000 */ 3845 0x00, 0x00, /* 000000000000 */
3877 3846
3878 /* 160 0xa0 '.' */ 3847 /* 160 0xa0 '.' */
@@ -4092,24 +4061,23 @@ static unsigned char fontdata_sun12x22[FONTDATAMAX] = {
4092 0x00, 0x00, /* 000000000000 */ 4061 0x00, 0x00, /* 000000000000 */
4093 4062
4094 /* 169 0xa9 '.' */ 4063 /* 169 0xa9 '.' */
4095 /* FIXME */
4096 0x00, 0x00, /* 000000000000 */
4097 0x00, 0x00, /* 000000000000 */ 4064 0x00, 0x00, /* 000000000000 */
4098 0x00, 0x00, /* 000000000000 */ 4065 0x00, 0x00, /* 000000000000 */
4099 0x00, 0x00, /* 000000000000 */ 4066 0x00, 0x00, /* 000000000000 */
4100 0x00, 0x00, /* 000000000000 */ 4067 0x00, 0x00, /* 000000000000 */
4101 0x3f, 0xc0, /* 001111111100 */ 4068 0x3f, 0xc0, /* 001111111100 */
4102 0x3f, 0xc0, /* 001111111100 */ 4069 0x3f, 0xc0, /* 001111111100 */
4103 0x3f, 0xc0, /* 001111111100 */ 4070 0x30, 0x00, /* 001100000000 */
4104 0x3f, 0xc0, /* 001111111100 */ 4071 0x30, 0x00, /* 001100000000 */
4105 0x3f, 0xc0, /* 001111111100 */ 4072 0x30, 0x00, /* 001100000000 */
4106 0x3f, 0xc0, /* 001111111100 */ 4073 0x00, 0x00, /* 000000000000 */
4107 0x3f, 0xc0, /* 001111111100 */ 4074 0x00, 0x00, /* 000000000000 */
4108 0x3f, 0xc0, /* 001111111100 */ 4075 0x00, 0x00, /* 000000000000 */
4109 0x3f, 0xc0, /* 001111111100 */ 4076 0x00, 0x00, /* 000000000000 */
4110 0x3f, 0xc0, /* 001111111100 */ 4077 0x00, 0x00, /* 000000000000 */
4111 0x3f, 0xc0, /* 001111111100 */ 4078 0x00, 0x00, /* 000000000000 */
4112 0x3f, 0xc0, /* 001111111100 */ 4079 0x00, 0x00, /* 000000000000 */
4080 0x00, 0x00, /* 000000000000 */
4113 0x00, 0x00, /* 000000000000 */ 4081 0x00, 0x00, /* 000000000000 */
4114 0x00, 0x00, /* 000000000000 */ 4082 0x00, 0x00, /* 000000000000 */
4115 0x00, 0x00, /* 000000000000 */ 4083 0x00, 0x00, /* 000000000000 */
@@ -5413,24 +5381,23 @@ static unsigned char fontdata_sun12x22[FONTDATAMAX] = {
5413 0x00, 0x00, /* 000000000000 */ 5381 0x00, 0x00, /* 000000000000 */
5414 5382
5415 /* 224 0xe0 '.' */ 5383 /* 224 0xe0 '.' */
5416 /* FIXME */
5417 0x00, 0x00, /* 000000000000 */ 5384 0x00, 0x00, /* 000000000000 */
5418 0x00, 0x00, /* 000000000000 */ 5385 0x00, 0x00, /* 000000000000 */
5419 0x00, 0x00, /* 000000000000 */ 5386 0x00, 0x00, /* 000000000000 */
5420 0x00, 0x00, /* 000000000000 */ 5387 0x00, 0x00, /* 000000000000 */
5421 0x00, 0x00, /* 000000000000 */ 5388 0x00, 0x00, /* 000000000000 */
5422 0x3f, 0xc0, /* 001111111100 */ 5389 0x00, 0x00, /* 000000000000 */
5423 0x3f, 0xc0, /* 001111111100 */ 5390 0x0f, 0x60, /* 000011110110 */
5424 0x3f, 0xc0, /* 001111111100 */ 5391 0x13, 0xe0, /* 000100111110 */
5425 0x3f, 0xc0, /* 001111111100 */ 5392 0x21, 0xc0, /* 001000011100 */
5426 0x3f, 0xc0, /* 001111111100 */ 5393 0x60, 0xc0, /* 011000001100 */
5427 0x3f, 0xc0, /* 001111111100 */ 5394 0x60, 0xc0, /* 011000001100 */
5428 0x3f, 0xc0, /* 001111111100 */ 5395 0x60, 0xc0, /* 011000001100 */
5429 0x3f, 0xc0, /* 001111111100 */ 5396 0x60, 0xc0, /* 011000001100 */
5430 0x3f, 0xc0, /* 001111111100 */ 5397 0x70, 0x80, /* 011100001000 */
5431 0x3f, 0xc0, /* 001111111100 */ 5398 0x39, 0xc0, /* 001110011100 */
5432 0x3f, 0xc0, /* 001111111100 */ 5399 0x1f, 0x60, /* 000111110110 */
5433 0x3f, 0xc0, /* 001111111100 */ 5400 0x00, 0x00, /* 000000000000 */
5434 0x00, 0x00, /* 000000000000 */ 5401 0x00, 0x00, /* 000000000000 */
5435 0x00, 0x00, /* 000000000000 */ 5402 0x00, 0x00, /* 000000000000 */
5436 0x00, 0x00, /* 000000000000 */ 5403 0x00, 0x00, /* 000000000000 */
@@ -5462,24 +5429,23 @@ static unsigned char fontdata_sun12x22[FONTDATAMAX] = {
5462 0x00, 0x00, /* 000000000000 */ 5429 0x00, 0x00, /* 000000000000 */
5463 5430
5464 /* 226 0xe2 '.' */ 5431 /* 226 0xe2 '.' */
5465 /* FIXME */
5466 0x00, 0x00, /* 000000000000 */
5467 0x00, 0x00, /* 000000000000 */
5468 0x00, 0x00, /* 000000000000 */ 5432 0x00, 0x00, /* 000000000000 */
5469 0x00, 0x00, /* 000000000000 */ 5433 0x00, 0x00, /* 000000000000 */
5434 0x3f, 0xe0, /* 001111111110 */
5435 0x3f, 0xe0, /* 001111111110 */
5436 0x30, 0x60, /* 001100000110 */
5437 0x30, 0x60, /* 001100000110 */
5438 0x30, 0x00, /* 001100000000 */
5439 0x30, 0x00, /* 001100000000 */
5440 0x30, 0x00, /* 001100000000 */
5441 0x30, 0x00, /* 001100000000 */
5442 0x30, 0x00, /* 001100000000 */
5443 0x30, 0x00, /* 001100000000 */
5444 0x30, 0x00, /* 001100000000 */
5445 0x30, 0x00, /* 001100000000 */
5446 0x30, 0x00, /* 001100000000 */
5447 0x30, 0x00, /* 001100000000 */
5470 0x00, 0x00, /* 000000000000 */ 5448 0x00, 0x00, /* 000000000000 */
5471 0x3f, 0xc0, /* 001111111100 */
5472 0x3f, 0xc0, /* 001111111100 */
5473 0x3f, 0xc0, /* 001111111100 */
5474 0x3f, 0xc0, /* 001111111100 */
5475 0x3f, 0xc0, /* 001111111100 */
5476 0x3f, 0xc0, /* 001111111100 */
5477 0x3f, 0xc0, /* 001111111100 */
5478 0x3f, 0xc0, /* 001111111100 */
5479 0x3f, 0xc0, /* 001111111100 */
5480 0x3f, 0xc0, /* 001111111100 */
5481 0x3f, 0xc0, /* 001111111100 */
5482 0x3f, 0xc0, /* 001111111100 */
5483 0x00, 0x00, /* 000000000000 */ 5449 0x00, 0x00, /* 000000000000 */
5484 0x00, 0x00, /* 000000000000 */ 5450 0x00, 0x00, /* 000000000000 */
5485 0x00, 0x00, /* 000000000000 */ 5451 0x00, 0x00, /* 000000000000 */
@@ -5487,49 +5453,47 @@ static unsigned char fontdata_sun12x22[FONTDATAMAX] = {
5487 0x00, 0x00, /* 000000000000 */ 5453 0x00, 0x00, /* 000000000000 */
5488 5454
5489 /* 227 0xe3 '.' */ 5455 /* 227 0xe3 '.' */
5490 /* FIXME */
5491 0x00, 0x00, /* 000000000000 */ 5456 0x00, 0x00, /* 000000000000 */
5492 0x00, 0x00, /* 000000000000 */ 5457 0x00, 0x00, /* 000000000000 */
5493 0x00, 0x00, /* 000000000000 */ 5458 0x00, 0x00, /* 000000000000 */
5494 0x00, 0x00, /* 000000000000 */ 5459 0x00, 0x00, /* 000000000000 */
5495 0x00, 0x00, /* 000000000000 */ 5460 0x00, 0x00, /* 000000000000 */
5496 0x3f, 0xc0, /* 001111111100 */
5497 0x3f, 0xc0, /* 001111111100 */
5498 0x3f, 0xc0, /* 001111111100 */
5499 0x3f, 0xc0, /* 001111111100 */
5500 0x3f, 0xc0, /* 001111111100 */
5501 0x3f, 0xc0, /* 001111111100 */
5502 0x3f, 0xc0, /* 001111111100 */
5503 0x3f, 0xc0, /* 001111111100 */
5504 0x3f, 0xc0, /* 001111111100 */
5505 0x3f, 0xc0, /* 001111111100 */
5506 0x3f, 0xc0, /* 001111111100 */
5507 0x3f, 0xc0, /* 001111111100 */
5508 0x00, 0x00, /* 000000000000 */
5509 0x00, 0x00, /* 000000000000 */ 5461 0x00, 0x00, /* 000000000000 */
5462 0x7f, 0xe0, /* 011111111110 */
5463 0x7f, 0xe0, /* 011111111110 */
5464 0x19, 0x80, /* 000110011000 */
5465 0x19, 0x80, /* 000110011000 */
5466 0x19, 0x80, /* 000110011000 */
5467 0x19, 0x80, /* 000110011000 */
5468 0x19, 0x80, /* 000110011000 */
5469 0x19, 0x80, /* 000110011000 */
5470 0x19, 0x80, /* 000110011000 */
5471 0x19, 0x80, /* 000110011000 */
5510 0x00, 0x00, /* 000000000000 */ 5472 0x00, 0x00, /* 000000000000 */
5511 0x00, 0x00, /* 000000000000 */ 5473 0x00, 0x00, /* 000000000000 */
5512 0x00, 0x00, /* 000000000000 */ 5474 0x00, 0x00, /* 000000000000 */
5513
5514 /* 228 0xe4 '.' */
5515 /* FIXME */
5516 0x00, 0x00, /* 000000000000 */ 5475 0x00, 0x00, /* 000000000000 */
5517 0x00, 0x00, /* 000000000000 */ 5476 0x00, 0x00, /* 000000000000 */
5518 0x00, 0x00, /* 000000000000 */ 5477 0x00, 0x00, /* 000000000000 */
5478
5479 /* 228 0xe4 '.' */
5519 0x00, 0x00, /* 000000000000 */ 5480 0x00, 0x00, /* 000000000000 */
5481 0x7f, 0xe0, /* 011111111110 */
5482 0x7f, 0xe0, /* 011111111110 */
5483 0x60, 0x60, /* 011000000110 */
5484 0x30, 0x60, /* 001100000110 */
5485 0x30, 0x00, /* 001100000000 */
5486 0x18, 0x00, /* 000110000000 */
5487 0x18, 0x00, /* 000110000000 */
5488 0x0c, 0x00, /* 000011000000 */
5489 0x18, 0x00, /* 000110000000 */
5490 0x18, 0x00, /* 000110000000 */
5491 0x30, 0x00, /* 001100000000 */
5492 0x30, 0x60, /* 001100000110 */
5493 0x60, 0x60, /* 011000000110 */
5494 0x7f, 0xe0, /* 011111111110 */
5495 0x7f, 0xe0, /* 011111111110 */
5520 0x00, 0x00, /* 000000000000 */ 5496 0x00, 0x00, /* 000000000000 */
5521 0x3f, 0xc0, /* 001111111100 */
5522 0x3f, 0xc0, /* 001111111100 */
5523 0x3f, 0xc0, /* 001111111100 */
5524 0x3f, 0xc0, /* 001111111100 */
5525 0x3f, 0xc0, /* 001111111100 */
5526 0x3f, 0xc0, /* 001111111100 */
5527 0x3f, 0xc0, /* 001111111100 */
5528 0x3f, 0xc0, /* 001111111100 */
5529 0x3f, 0xc0, /* 001111111100 */
5530 0x3f, 0xc0, /* 001111111100 */
5531 0x3f, 0xc0, /* 001111111100 */
5532 0x3f, 0xc0, /* 001111111100 */
5533 0x00, 0x00, /* 000000000000 */ 5497 0x00, 0x00, /* 000000000000 */
5534 0x00, 0x00, /* 000000000000 */ 5498 0x00, 0x00, /* 000000000000 */
5535 0x00, 0x00, /* 000000000000 */ 5499 0x00, 0x00, /* 000000000000 */
@@ -5537,24 +5501,23 @@ static unsigned char fontdata_sun12x22[FONTDATAMAX] = {
5537 0x00, 0x00, /* 000000000000 */ 5501 0x00, 0x00, /* 000000000000 */
5538 5502
5539 /* 229 0xe5 '.' */ 5503 /* 229 0xe5 '.' */
5540 /* FIXME */
5541 0x00, 0x00, /* 000000000000 */ 5504 0x00, 0x00, /* 000000000000 */
5542 0x00, 0x00, /* 000000000000 */ 5505 0x00, 0x00, /* 000000000000 */
5543 0x00, 0x00, /* 000000000000 */ 5506 0x00, 0x00, /* 000000000000 */
5544 0x00, 0x00, /* 000000000000 */ 5507 0x00, 0x00, /* 000000000000 */
5545 0x00, 0x00, /* 000000000000 */ 5508 0x00, 0x00, /* 000000000000 */
5546 0x3f, 0xc0, /* 001111111100 */ 5509 0x07, 0xe0, /* 000001111110 */
5547 0x3f, 0xc0, /* 001111111100 */ 5510 0x0f, 0xe0, /* 000011111110 */
5548 0x3f, 0xc0, /* 001111111100 */ 5511 0x13, 0x80, /* 000100111000 */
5549 0x3f, 0xc0, /* 001111111100 */ 5512 0x21, 0xc0, /* 001000011100 */
5550 0x3f, 0xc0, /* 001111111100 */ 5513 0x60, 0xc0, /* 011000001100 */
5551 0x3f, 0xc0, /* 001111111100 */ 5514 0x60, 0xc0, /* 011000001100 */
5552 0x3f, 0xc0, /* 001111111100 */ 5515 0x60, 0xc0, /* 011000001100 */
5553 0x3f, 0xc0, /* 001111111100 */ 5516 0x60, 0xc0, /* 011000001100 */
5554 0x3f, 0xc0, /* 001111111100 */ 5517 0x70, 0x80, /* 011100001000 */
5555 0x3f, 0xc0, /* 001111111100 */ 5518 0x39, 0x00, /* 001110010000 */
5556 0x3f, 0xc0, /* 001111111100 */ 5519 0x1e, 0x00, /* 000111100000 */
5557 0x3f, 0xc0, /* 001111111100 */ 5520 0x00, 0x00, /* 000000000000 */
5558 0x00, 0x00, /* 000000000000 */ 5521 0x00, 0x00, /* 000000000000 */
5559 0x00, 0x00, /* 000000000000 */ 5522 0x00, 0x00, /* 000000000000 */
5560 0x00, 0x00, /* 000000000000 */ 5523 0x00, 0x00, /* 000000000000 */
@@ -5586,24 +5549,23 @@ static unsigned char fontdata_sun12x22[FONTDATAMAX] = {
5586 0x00, 0x00, /* 000000000000 */ 5549 0x00, 0x00, /* 000000000000 */
5587 5550
5588 /* 231 0xe7 '.' */ 5551 /* 231 0xe7 '.' */
5589 /* FIXME */
5590 0x00, 0x00, /* 000000000000 */
5591 0x00, 0x00, /* 000000000000 */
5592 0x00, 0x00, /* 000000000000 */
5593 0x00, 0x00, /* 000000000000 */ 5552 0x00, 0x00, /* 000000000000 */
5594 0x00, 0x00, /* 000000000000 */ 5553 0x19, 0x80, /* 000110011000 */
5595 0x3f, 0xc0, /* 001111111100 */
5596 0x3f, 0xc0, /* 001111111100 */
5597 0x3f, 0xc0, /* 001111111100 */
5598 0x3f, 0xc0, /* 001111111100 */
5599 0x3f, 0xc0, /* 001111111100 */
5600 0x3f, 0xc0, /* 001111111100 */
5601 0x3f, 0xc0, /* 001111111100 */
5602 0x3f, 0xc0, /* 001111111100 */
5603 0x3f, 0xc0, /* 001111111100 */
5604 0x3f, 0xc0, /* 001111111100 */
5605 0x3f, 0xc0, /* 001111111100 */
5606 0x3f, 0xc0, /* 001111111100 */ 5554 0x3f, 0xc0, /* 001111111100 */
5555 0x66, 0x60, /* 011001100110 */
5556 0x66, 0x60, /* 011001100110 */
5557 0x06, 0x00, /* 000001100000 */
5558 0x06, 0x00, /* 000001100000 */
5559 0x06, 0x00, /* 000001100000 */
5560 0x06, 0x00, /* 000001100000 */
5561 0x06, 0x00, /* 000001100000 */
5562 0x06, 0x00, /* 000001100000 */
5563 0x06, 0x00, /* 000001100000 */
5564 0x06, 0x00, /* 000001100000 */
5565 0x06, 0x00, /* 000001100000 */
5566 0x06, 0x00, /* 000001100000 */
5567 0x06, 0x00, /* 000001100000 */
5568 0x00, 0x00, /* 000000000000 */
5607 0x00, 0x00, /* 000000000000 */ 5569 0x00, 0x00, /* 000000000000 */
5608 0x00, 0x00, /* 000000000000 */ 5570 0x00, 0x00, /* 000000000000 */
5609 0x00, 0x00, /* 000000000000 */ 5571 0x00, 0x00, /* 000000000000 */
@@ -5611,24 +5573,23 @@ static unsigned char fontdata_sun12x22[FONTDATAMAX] = {
5611 0x00, 0x00, /* 000000000000 */ 5573 0x00, 0x00, /* 000000000000 */
5612 5574
5613 /* 232 0xe8 '.' */ 5575 /* 232 0xe8 '.' */
5614 /* FIXME */
5615 0x00, 0x00, /* 000000000000 */
5616 0x00, 0x00, /* 000000000000 */
5617 0x00, 0x00, /* 000000000000 */ 5576 0x00, 0x00, /* 000000000000 */
5618 0x00, 0x00, /* 000000000000 */ 5577 0x00, 0x00, /* 000000000000 */
5578 0x7f, 0xe0, /* 011111111110 */
5579 0x7f, 0xe0, /* 011111111110 */
5580 0x06, 0x00, /* 000001100000 */
5581 0x06, 0x00, /* 000001100000 */
5582 0x0f, 0x00, /* 000011110000 */
5583 0x19, 0x80, /* 000110011000 */
5584 0x30, 0xc0, /* 001100001100 */
5585 0x30, 0xc0, /* 001100001100 */
5586 0x19, 0x80, /* 000110011000 */
5587 0x0f, 0x00, /* 000011110000 */
5588 0x06, 0x00, /* 000001100000 */
5589 0x06, 0x00, /* 000001100000 */
5590 0x7f, 0xe0, /* 011111111110 */
5591 0x7f, 0xe0, /* 011111111110 */
5619 0x00, 0x00, /* 000000000000 */ 5592 0x00, 0x00, /* 000000000000 */
5620 0x3f, 0xc0, /* 001111111100 */
5621 0x3f, 0xc0, /* 001111111100 */
5622 0x3f, 0xc0, /* 001111111100 */
5623 0x3f, 0xc0, /* 001111111100 */
5624 0x3f, 0xc0, /* 001111111100 */
5625 0x3f, 0xc0, /* 001111111100 */
5626 0x3f, 0xc0, /* 001111111100 */
5627 0x3f, 0xc0, /* 001111111100 */
5628 0x3f, 0xc0, /* 001111111100 */
5629 0x3f, 0xc0, /* 001111111100 */
5630 0x3f, 0xc0, /* 001111111100 */
5631 0x3f, 0xc0, /* 001111111100 */
5632 0x00, 0x00, /* 000000000000 */ 5593 0x00, 0x00, /* 000000000000 */
5633 0x00, 0x00, /* 000000000000 */ 5594 0x00, 0x00, /* 000000000000 */
5634 0x00, 0x00, /* 000000000000 */ 5595 0x00, 0x00, /* 000000000000 */
@@ -5636,24 +5597,23 @@ static unsigned char fontdata_sun12x22[FONTDATAMAX] = {
5636 0x00, 0x00, /* 000000000000 */ 5597 0x00, 0x00, /* 000000000000 */
5637 5598
5638 /* 233 0xe9 '.' */ 5599 /* 233 0xe9 '.' */
5639 /* FIXME */
5640 0x00, 0x00, /* 000000000000 */ 5600 0x00, 0x00, /* 000000000000 */
5641 0x00, 0x00, /* 000000000000 */ 5601 0x00, 0x00, /* 000000000000 */
5642 0x00, 0x00, /* 000000000000 */ 5602 0x00, 0x00, /* 000000000000 */
5643 0x00, 0x00, /* 000000000000 */ 5603 0x00, 0x00, /* 000000000000 */
5604 0x0f, 0x00, /* 000011110000 */
5605 0x1f, 0x80, /* 000111111000 */
5606 0x30, 0xc0, /* 001100001100 */
5607 0x60, 0x60, /* 011000000110 */
5608 0x60, 0x60, /* 011000000110 */
5609 0x7f, 0xe0, /* 011111111110 */
5610 0x7f, 0xe0, /* 011111111110 */
5611 0x60, 0x60, /* 011000000110 */
5612 0x60, 0x60, /* 011000000110 */
5613 0x30, 0xc0, /* 001100001100 */
5614 0x1f, 0x80, /* 000111111000 */
5615 0x0f, 0x00, /* 000011110000 */
5644 0x00, 0x00, /* 000000000000 */ 5616 0x00, 0x00, /* 000000000000 */
5645 0x3f, 0xc0, /* 001111111100 */
5646 0x3f, 0xc0, /* 001111111100 */
5647 0x3f, 0xc0, /* 001111111100 */
5648 0x3f, 0xc0, /* 001111111100 */
5649 0x3f, 0xc0, /* 001111111100 */
5650 0x3f, 0xc0, /* 001111111100 */
5651 0x3f, 0xc0, /* 001111111100 */
5652 0x3f, 0xc0, /* 001111111100 */
5653 0x3f, 0xc0, /* 001111111100 */
5654 0x3f, 0xc0, /* 001111111100 */
5655 0x3f, 0xc0, /* 001111111100 */
5656 0x3f, 0xc0, /* 001111111100 */
5657 0x00, 0x00, /* 000000000000 */ 5617 0x00, 0x00, /* 000000000000 */
5658 0x00, 0x00, /* 000000000000 */ 5618 0x00, 0x00, /* 000000000000 */
5659 0x00, 0x00, /* 000000000000 */ 5619 0x00, 0x00, /* 000000000000 */
@@ -5661,24 +5621,23 @@ static unsigned char fontdata_sun12x22[FONTDATAMAX] = {
5661 0x00, 0x00, /* 000000000000 */ 5621 0x00, 0x00, /* 000000000000 */
5662 5622
5663 /* 234 0xea '.' */ 5623 /* 234 0xea '.' */
5664 /* FIXME */
5665 0x00, 0x00, /* 000000000000 */ 5624 0x00, 0x00, /* 000000000000 */
5666 0x00, 0x00, /* 000000000000 */ 5625 0x00, 0x00, /* 000000000000 */
5667 0x00, 0x00, /* 000000000000 */ 5626 0x00, 0x00, /* 000000000000 */
5668 0x00, 0x00, /* 000000000000 */ 5627 0x00, 0x00, /* 000000000000 */
5628 0x1f, 0x00, /* 000111110000 */
5629 0x31, 0x80, /* 001100011000 */
5630 0x30, 0xc0, /* 001100001100 */
5631 0x30, 0xc0, /* 001100001100 */
5632 0x60, 0x60, /* 011000000110 */
5633 0x60, 0x60, /* 011000000110 */
5634 0x30, 0xc0, /* 001100001100 */
5635 0x30, 0xc0, /* 001100001100 */
5636 0x19, 0x80, /* 000110011000 */
5637 0x19, 0x80, /* 000110011000 */
5638 0xd9, 0xb0, /* 110110011011 */
5639 0x79, 0xe0, /* 011110011110 */
5669 0x00, 0x00, /* 000000000000 */ 5640 0x00, 0x00, /* 000000000000 */
5670 0x3f, 0xc0, /* 001111111100 */
5671 0x3f, 0xc0, /* 001111111100 */
5672 0x3f, 0xc0, /* 001111111100 */
5673 0x3f, 0xc0, /* 001111111100 */
5674 0x3f, 0xc0, /* 001111111100 */
5675 0x3f, 0xc0, /* 001111111100 */
5676 0x3f, 0xc0, /* 001111111100 */
5677 0x3f, 0xc0, /* 001111111100 */
5678 0x3f, 0xc0, /* 001111111100 */
5679 0x3f, 0xc0, /* 001111111100 */
5680 0x3f, 0xc0, /* 001111111100 */
5681 0x3f, 0xc0, /* 001111111100 */
5682 0x00, 0x00, /* 000000000000 */ 5641 0x00, 0x00, /* 000000000000 */
5683 0x00, 0x00, /* 000000000000 */ 5642 0x00, 0x00, /* 000000000000 */
5684 0x00, 0x00, /* 000000000000 */ 5643 0x00, 0x00, /* 000000000000 */
@@ -5686,24 +5645,23 @@ static unsigned char fontdata_sun12x22[FONTDATAMAX] = {
5686 0x00, 0x00, /* 000000000000 */ 5645 0x00, 0x00, /* 000000000000 */
5687 5646
5688 /* 235 0xeb '.' */ 5647 /* 235 0xeb '.' */
5689 /* FIXME */
5690 0x00, 0x00, /* 000000000000 */
5691 0x00, 0x00, /* 000000000000 */
5692 0x00, 0x00, /* 000000000000 */
5693 0x00, 0x00, /* 000000000000 */ 5648 0x00, 0x00, /* 000000000000 */
5649 0x07, 0x80, /* 000001111000 */
5650 0x0c, 0xc0, /* 000011001100 */
5651 0x18, 0x60, /* 000110000110 */
5652 0x18, 0x00, /* 000110000000 */
5653 0x0c, 0x00, /* 000011000000 */
5654 0x06, 0x00, /* 000001100000 */
5655 0x03, 0x00, /* 000000110000 */
5656 0x0f, 0x80, /* 000011111000 */
5657 0x11, 0xc0, /* 000100011100 */
5658 0x20, 0xe0, /* 001000001110 */
5659 0x60, 0x60, /* 011000000110 */
5660 0x60, 0x60, /* 011000000110 */
5661 0x70, 0x40, /* 011100000100 */
5662 0x38, 0x80, /* 001110001000 */
5663 0x1f, 0x00, /* 000111110000 */
5694 0x00, 0x00, /* 000000000000 */ 5664 0x00, 0x00, /* 000000000000 */
5695 0x3f, 0xc0, /* 001111111100 */
5696 0x3f, 0xc0, /* 001111111100 */
5697 0x3f, 0xc0, /* 001111111100 */
5698 0x3f, 0xc0, /* 001111111100 */
5699 0x3f, 0xc0, /* 001111111100 */
5700 0x3f, 0xc0, /* 001111111100 */
5701 0x3f, 0xc0, /* 001111111100 */
5702 0x3f, 0xc0, /* 001111111100 */
5703 0x3f, 0xc0, /* 001111111100 */
5704 0x3f, 0xc0, /* 001111111100 */
5705 0x3f, 0xc0, /* 001111111100 */
5706 0x3f, 0xc0, /* 001111111100 */
5707 0x00, 0x00, /* 000000000000 */ 5665 0x00, 0x00, /* 000000000000 */
5708 0x00, 0x00, /* 000000000000 */ 5666 0x00, 0x00, /* 000000000000 */
5709 0x00, 0x00, /* 000000000000 */ 5667 0x00, 0x00, /* 000000000000 */
@@ -5711,99 +5669,95 @@ static unsigned char fontdata_sun12x22[FONTDATAMAX] = {
5711 0x00, 0x00, /* 000000000000 */ 5669 0x00, 0x00, /* 000000000000 */
5712 5670
5713 /* 236 0xec '.' */ 5671 /* 236 0xec '.' */
5714 /* FIXME */
5715 0x00, 0x00, /* 000000000000 */ 5672 0x00, 0x00, /* 000000000000 */
5716 0x00, 0x00, /* 000000000000 */ 5673 0x00, 0x00, /* 000000000000 */
5717 0x00, 0x00, /* 000000000000 */ 5674 0x00, 0x00, /* 000000000000 */
5718 0x00, 0x00, /* 000000000000 */ 5675 0x00, 0x00, /* 000000000000 */
5719 0x00, 0x00, /* 000000000000 */ 5676 0x00, 0x00, /* 000000000000 */
5720 0x3f, 0xc0, /* 001111111100 */
5721 0x3f, 0xc0, /* 001111111100 */
5722 0x3f, 0xc0, /* 001111111100 */
5723 0x3f, 0xc0, /* 001111111100 */
5724 0x3f, 0xc0, /* 001111111100 */
5725 0x3f, 0xc0, /* 001111111100 */
5726 0x3f, 0xc0, /* 001111111100 */
5727 0x3f, 0xc0, /* 001111111100 */
5728 0x3f, 0xc0, /* 001111111100 */
5729 0x3f, 0xc0, /* 001111111100 */
5730 0x3f, 0xc0, /* 001111111100 */
5731 0x3f, 0xc0, /* 001111111100 */
5732 0x00, 0x00, /* 000000000000 */ 5677 0x00, 0x00, /* 000000000000 */
5733 0x00, 0x00, /* 000000000000 */ 5678 0x00, 0x00, /* 000000000000 */
5734 0x00, 0x00, /* 000000000000 */ 5679 0x00, 0x00, /* 000000000000 */
5680 0x39, 0xc0, /* 001110011100 */
5681 0x6f, 0x60, /* 011011110110 */
5682 0x66, 0x60, /* 011001100110 */
5683 0xc6, 0x30, /* 110001100011 */
5684 0xc6, 0x30, /* 110001100011 */
5685 0x66, 0x60, /* 011001100110 */
5686 0x6f, 0x60, /* 011011110110 */
5687 0x39, 0xc0, /* 001110011100 */
5735 0x00, 0x00, /* 000000000000 */ 5688 0x00, 0x00, /* 000000000000 */
5736 0x00, 0x00, /* 000000000000 */ 5689 0x00, 0x00, /* 000000000000 */
5737
5738 /* 237 0xed '.' */
5739 /* FIXME */
5740 0x00, 0x00, /* 000000000000 */ 5690 0x00, 0x00, /* 000000000000 */
5741 0x00, 0x00, /* 000000000000 */ 5691 0x00, 0x00, /* 000000000000 */
5742 0x00, 0x00, /* 000000000000 */ 5692 0x00, 0x00, /* 000000000000 */
5743 0x00, 0x00, /* 000000000000 */ 5693 0x00, 0x00, /* 000000000000 */
5694
5695 /* 237 0xed '.' */
5744 0x00, 0x00, /* 000000000000 */ 5696 0x00, 0x00, /* 000000000000 */
5745 0x3f, 0xc0, /* 001111111100 */
5746 0x3f, 0xc0, /* 001111111100 */
5747 0x3f, 0xc0, /* 001111111100 */
5748 0x3f, 0xc0, /* 001111111100 */
5749 0x3f, 0xc0, /* 001111111100 */
5750 0x3f, 0xc0, /* 001111111100 */
5751 0x3f, 0xc0, /* 001111111100 */
5752 0x3f, 0xc0, /* 001111111100 */
5753 0x3f, 0xc0, /* 001111111100 */
5754 0x3f, 0xc0, /* 001111111100 */
5755 0x3f, 0xc0, /* 001111111100 */
5756 0x3f, 0xc0, /* 001111111100 */
5757 0x00, 0x00, /* 000000000000 */ 5697 0x00, 0x00, /* 000000000000 */
5758 0x00, 0x00, /* 000000000000 */ 5698 0x00, 0x00, /* 000000000000 */
5759 0x00, 0x00, /* 000000000000 */ 5699 0x00, 0x00, /* 000000000000 */
5700 0x00, 0xc0, /* 000000001100 */
5701 0x00, 0xc0, /* 000000001100 */
5702 0x01, 0x80, /* 000000011000 */
5703 0x01, 0x80, /* 000000011000 */
5704 0x3b, 0xc0, /* 001110111100 */
5705 0x6f, 0x60, /* 011011110110 */
5706 0x66, 0x60, /* 011001100110 */
5707 0xc6, 0x30, /* 110001100011 */
5708 0xc6, 0x30, /* 110001100011 */
5709 0x66, 0x60, /* 011001100110 */
5710 0x6f, 0x60, /* 011011110110 */
5711 0x3d, 0xc0, /* 001111011100 */
5712 0x18, 0x00, /* 000110000000 */
5713 0x18, 0x00, /* 000110000000 */
5714 0x30, 0x00, /* 001100000000 */
5715 0x30, 0x00, /* 001100000000 */
5760 0x00, 0x00, /* 000000000000 */ 5716 0x00, 0x00, /* 000000000000 */
5761 0x00, 0x00, /* 000000000000 */ 5717 0x00, 0x00, /* 000000000000 */
5762 5718
5763 /* 238 0xee '.' */ 5719 /* 238 0xee '.' */
5764 /* FIXME */
5765 0x00, 0x00, /* 000000000000 */ 5720 0x00, 0x00, /* 000000000000 */
5721 0x01, 0xc0, /* 000000011100 */
5722 0x03, 0x00, /* 000000110000 */
5723 0x06, 0x00, /* 000001100000 */
5724 0x06, 0x00, /* 000001100000 */
5725 0x0c, 0x00, /* 000011000000 */
5726 0x0c, 0x00, /* 000011000000 */
5727 0x18, 0x00, /* 000110000000 */
5728 0x1f, 0xc0, /* 000111111100 */
5729 0x18, 0x00, /* 000110000000 */
5730 0x0c, 0x00, /* 000011000000 */
5731 0x0c, 0x00, /* 000011000000 */
5732 0x06, 0x00, /* 000001100000 */
5733 0x06, 0x00, /* 000001100000 */
5734 0x03, 0x00, /* 000000110000 */
5735 0x01, 0xc0, /* 000000011100 */
5766 0x00, 0x00, /* 000000000000 */ 5736 0x00, 0x00, /* 000000000000 */
5767 0x00, 0x00, /* 000000000000 */ 5737 0x00, 0x00, /* 000000000000 */
5768 0x00, 0x00, /* 000000000000 */ 5738 0x00, 0x00, /* 000000000000 */
5769 0x00, 0x00, /* 000000000000 */ 5739 0x00, 0x00, /* 000000000000 */
5770 0x3f, 0xc0, /* 001111111100 */
5771 0x3f, 0xc0, /* 001111111100 */
5772 0x3f, 0xc0, /* 001111111100 */
5773 0x3f, 0xc0, /* 001111111100 */
5774 0x3f, 0xc0, /* 001111111100 */
5775 0x3f, 0xc0, /* 001111111100 */
5776 0x3f, 0xc0, /* 001111111100 */
5777 0x3f, 0xc0, /* 001111111100 */
5778 0x3f, 0xc0, /* 001111111100 */
5779 0x3f, 0xc0, /* 001111111100 */
5780 0x3f, 0xc0, /* 001111111100 */
5781 0x3f, 0xc0, /* 001111111100 */
5782 0x00, 0x00, /* 000000000000 */
5783 0x00, 0x00, /* 000000000000 */
5784 0x00, 0x00, /* 000000000000 */
5785 0x00, 0x00, /* 000000000000 */ 5740 0x00, 0x00, /* 000000000000 */
5786 0x00, 0x00, /* 000000000000 */ 5741 0x00, 0x00, /* 000000000000 */
5787 5742
5788 /* 239 0xef '.' */ 5743 /* 239 0xef '.' */
5789 /* FIXME */
5790 0x00, 0x00, /* 000000000000 */ 5744 0x00, 0x00, /* 000000000000 */
5791 0x00, 0x00, /* 000000000000 */ 5745 0x00, 0x00, /* 000000000000 */
5792 0x00, 0x00, /* 000000000000 */ 5746 0x00, 0x00, /* 000000000000 */
5793 0x00, 0x00, /* 000000000000 */ 5747 0x00, 0x00, /* 000000000000 */
5794 0x00, 0x00, /* 000000000000 */ 5748 0x00, 0x00, /* 000000000000 */
5795 0x3f, 0xc0, /* 001111111100 */ 5749 0x0f, 0x00, /* 000011110000 */
5796 0x3f, 0xc0, /* 001111111100 */ 5750 0x1f, 0x80, /* 000111111000 */
5797 0x3f, 0xc0, /* 001111111100 */ 5751 0x39, 0xc0, /* 001110011100 */
5798 0x3f, 0xc0, /* 001111111100 */ 5752 0x30, 0xc0, /* 001100001100 */
5799 0x3f, 0xc0, /* 001111111100 */ 5753 0x30, 0xc0, /* 001100001100 */
5800 0x3f, 0xc0, /* 001111111100 */ 5754 0x30, 0xc0, /* 001100001100 */
5801 0x3f, 0xc0, /* 001111111100 */ 5755 0x30, 0xc0, /* 001100001100 */
5802 0x3f, 0xc0, /* 001111111100 */ 5756 0x30, 0xc0, /* 001100001100 */
5803 0x3f, 0xc0, /* 001111111100 */ 5757 0x30, 0xc0, /* 001100001100 */
5804 0x3f, 0xc0, /* 001111111100 */ 5758 0x30, 0xc0, /* 001100001100 */
5805 0x3f, 0xc0, /* 001111111100 */ 5759 0x30, 0xc0, /* 001100001100 */
5806 0x3f, 0xc0, /* 001111111100 */ 5760 0x30, 0xc0, /* 001100001100 */
5807 0x00, 0x00, /* 000000000000 */ 5761 0x00, 0x00, /* 000000000000 */
5808 0x00, 0x00, /* 000000000000 */ 5762 0x00, 0x00, /* 000000000000 */
5809 0x00, 0x00, /* 000000000000 */ 5763 0x00, 0x00, /* 000000000000 */
@@ -5811,24 +5765,23 @@ static unsigned char fontdata_sun12x22[FONTDATAMAX] = {
5811 0x00, 0x00, /* 000000000000 */ 5765 0x00, 0x00, /* 000000000000 */
5812 5766
5813 /* 240 0xf0 '.' */ 5767 /* 240 0xf0 '.' */
5814 /* FIXME */
5815 0x00, 0x00, /* 000000000000 */ 5768 0x00, 0x00, /* 000000000000 */
5816 0x00, 0x00, /* 000000000000 */ 5769 0x00, 0x00, /* 000000000000 */
5817 0x00, 0x00, /* 000000000000 */ 5770 0x00, 0x00, /* 000000000000 */
5818 0x00, 0x00, /* 000000000000 */ 5771 0x00, 0x00, /* 000000000000 */
5819 0x00, 0x00, /* 000000000000 */ 5772 0x00, 0x00, /* 000000000000 */
5820 0x3f, 0xc0, /* 001111111100 */ 5773 0x7f, 0xe0, /* 011111111110 */
5821 0x3f, 0xc0, /* 001111111100 */ 5774 0x7f, 0xe0, /* 011111111110 */
5822 0x3f, 0xc0, /* 001111111100 */ 5775 0x00, 0x00, /* 000000000000 */
5823 0x3f, 0xc0, /* 001111111100 */ 5776 0x00, 0x00, /* 000000000000 */
5824 0x3f, 0xc0, /* 001111111100 */ 5777 0x00, 0x00, /* 000000000000 */
5825 0x3f, 0xc0, /* 001111111100 */ 5778 0x7f, 0xe0, /* 011111111110 */
5826 0x3f, 0xc0, /* 001111111100 */ 5779 0x7f, 0xe0, /* 011111111110 */
5827 0x3f, 0xc0, /* 001111111100 */ 5780 0x00, 0x00, /* 000000000000 */
5828 0x3f, 0xc0, /* 001111111100 */ 5781 0x00, 0x00, /* 000000000000 */
5829 0x3f, 0xc0, /* 001111111100 */ 5782 0x00, 0x00, /* 000000000000 */
5830 0x3f, 0xc0, /* 001111111100 */ 5783 0x7f, 0xe0, /* 011111111110 */
5831 0x3f, 0xc0, /* 001111111100 */ 5784 0x7f, 0xe0, /* 011111111110 */
5832 0x00, 0x00, /* 000000000000 */ 5785 0x00, 0x00, /* 000000000000 */
5833 0x00, 0x00, /* 000000000000 */ 5786 0x00, 0x00, /* 000000000000 */
5834 0x00, 0x00, /* 000000000000 */ 5787 0x00, 0x00, /* 000000000000 */
@@ -5860,24 +5813,23 @@ static unsigned char fontdata_sun12x22[FONTDATAMAX] = {
5860 0x00, 0x00, /* 000000000000 */ 5813 0x00, 0x00, /* 000000000000 */
5861 5814
5862 /* 242 0xf2 '.' */ 5815 /* 242 0xf2 '.' */
5863 /* FIXME */
5864 0x00, 0x00, /* 000000000000 */ 5816 0x00, 0x00, /* 000000000000 */
5865 0x00, 0x00, /* 000000000000 */ 5817 0x00, 0x00, /* 000000000000 */
5866 0x00, 0x00, /* 000000000000 */ 5818 0x00, 0x00, /* 000000000000 */
5867 0x00, 0x00, /* 000000000000 */ 5819 0x00, 0x00, /* 000000000000 */
5820 0x60, 0x00, /* 011000000000 */
5821 0x38, 0x00, /* 001110000000 */
5822 0x0e, 0x00, /* 000011100000 */
5823 0x03, 0x80, /* 000000111000 */
5824 0x00, 0xe0, /* 000000001110 */
5825 0x00, 0xe0, /* 000000001110 */
5826 0x03, 0x80, /* 000000111000 */
5827 0x0e, 0x00, /* 000011100000 */
5828 0x38, 0x00, /* 001110000000 */
5829 0x60, 0x00, /* 011000000000 */
5868 0x00, 0x00, /* 000000000000 */ 5830 0x00, 0x00, /* 000000000000 */
5869 0x3f, 0xc0, /* 001111111100 */ 5831 0x7f, 0xe0, /* 011111111110 */
5870 0x3f, 0xc0, /* 001111111100 */ 5832 0x7f, 0xe0, /* 011111111110 */
5871 0x3f, 0xc0, /* 001111111100 */
5872 0x3f, 0xc0, /* 001111111100 */
5873 0x3f, 0xc0, /* 001111111100 */
5874 0x3f, 0xc0, /* 001111111100 */
5875 0x3f, 0xc0, /* 001111111100 */
5876 0x3f, 0xc0, /* 001111111100 */
5877 0x3f, 0xc0, /* 001111111100 */
5878 0x3f, 0xc0, /* 001111111100 */
5879 0x3f, 0xc0, /* 001111111100 */
5880 0x3f, 0xc0, /* 001111111100 */
5881 0x00, 0x00, /* 000000000000 */ 5833 0x00, 0x00, /* 000000000000 */
5882 0x00, 0x00, /* 000000000000 */ 5834 0x00, 0x00, /* 000000000000 */
5883 0x00, 0x00, /* 000000000000 */ 5835 0x00, 0x00, /* 000000000000 */
@@ -5885,24 +5837,23 @@ static unsigned char fontdata_sun12x22[FONTDATAMAX] = {
5885 0x00, 0x00, /* 000000000000 */ 5837 0x00, 0x00, /* 000000000000 */
5886 5838
5887 /* 243 0xf3 '.' */ 5839 /* 243 0xf3 '.' */
5888 /* FIXME */
5889 0x00, 0x00, /* 000000000000 */ 5840 0x00, 0x00, /* 000000000000 */
5890 0x00, 0x00, /* 000000000000 */ 5841 0x00, 0x00, /* 000000000000 */
5891 0x00, 0x00, /* 000000000000 */ 5842 0x00, 0x00, /* 000000000000 */
5843 0x00, 0x60, /* 000000000110 */
5844 0x01, 0xc0, /* 000000011100 */
5845 0x07, 0x00, /* 000001110000 */
5846 0x1c, 0x00, /* 000111000000 */
5847 0x70, 0x00, /* 011100000000 */
5848 0x70, 0x00, /* 011100000000 */
5849 0x1c, 0x00, /* 000111000000 */
5850 0x07, 0x00, /* 000001110000 */
5851 0x01, 0xc0, /* 000000011100 */
5852 0x00, 0x60, /* 000000000110 */
5892 0x00, 0x00, /* 000000000000 */ 5853 0x00, 0x00, /* 000000000000 */
5854 0x7f, 0xe0, /* 011111111110 */
5855 0x7f, 0xe0, /* 011111111110 */
5893 0x00, 0x00, /* 000000000000 */ 5856 0x00, 0x00, /* 000000000000 */
5894 0x3f, 0xc0, /* 001111111100 */
5895 0x3f, 0xc0, /* 001111111100 */
5896 0x3f, 0xc0, /* 001111111100 */
5897 0x3f, 0xc0, /* 001111111100 */
5898 0x3f, 0xc0, /* 001111111100 */
5899 0x3f, 0xc0, /* 001111111100 */
5900 0x3f, 0xc0, /* 001111111100 */
5901 0x3f, 0xc0, /* 001111111100 */
5902 0x3f, 0xc0, /* 001111111100 */
5903 0x3f, 0xc0, /* 001111111100 */
5904 0x3f, 0xc0, /* 001111111100 */
5905 0x3f, 0xc0, /* 001111111100 */
5906 0x00, 0x00, /* 000000000000 */ 5857 0x00, 0x00, /* 000000000000 */
5907 0x00, 0x00, /* 000000000000 */ 5858 0x00, 0x00, /* 000000000000 */
5908 0x00, 0x00, /* 000000000000 */ 5859 0x00, 0x00, /* 000000000000 */
@@ -5910,54 +5861,52 @@ static unsigned char fontdata_sun12x22[FONTDATAMAX] = {
5910 0x00, 0x00, /* 000000000000 */ 5861 0x00, 0x00, /* 000000000000 */
5911 5862
5912 /* 244 0xf4 '.' */ 5863 /* 244 0xf4 '.' */
5913 /* FIXME */
5914 0x00, 0x00, /* 000000000000 */
5915 0x00, 0x00, /* 000000000000 */
5916 0x00, 0x00, /* 000000000000 */
5917 0x00, 0x00, /* 000000000000 */
5918 0x00, 0x00, /* 000000000000 */
5919 0x3f, 0xc0, /* 001111111100 */
5920 0x3f, 0xc0, /* 001111111100 */
5921 0x3f, 0xc0, /* 001111111100 */
5922 0x3f, 0xc0, /* 001111111100 */
5923 0x3f, 0xc0, /* 001111111100 */
5924 0x3f, 0xc0, /* 001111111100 */
5925 0x3f, 0xc0, /* 001111111100 */
5926 0x3f, 0xc0, /* 001111111100 */
5927 0x3f, 0xc0, /* 001111111100 */
5928 0x3f, 0xc0, /* 001111111100 */
5929 0x3f, 0xc0, /* 001111111100 */
5930 0x3f, 0xc0, /* 001111111100 */
5931 0x00, 0x00, /* 000000000000 */
5932 0x00, 0x00, /* 000000000000 */
5933 0x00, 0x00, /* 000000000000 */
5934 0x00, 0x00, /* 000000000000 */
5935 0x00, 0x00, /* 000000000000 */ 5864 0x00, 0x00, /* 000000000000 */
5865 0x03, 0x80, /* 000000111000 */
5866 0x07, 0xc0, /* 000001111100 */
5867 0x0c, 0x60, /* 000011000110 */
5868 0x0c, 0x60, /* 000011000110 */
5869 0x0c, 0x00, /* 000011000000 */
5870 0x0c, 0x00, /* 000011000000 */
5871 0x0c, 0x00, /* 000011000000 */
5872 0x0c, 0x00, /* 000011000000 */
5873 0x0c, 0x00, /* 000011000000 */
5874 0x0c, 0x00, /* 000011000000 */
5875 0x0c, 0x00, /* 000011000000 */
5876 0x0c, 0x00, /* 000011000000 */
5877 0x0c, 0x00, /* 000011000000 */
5878 0x0c, 0x00, /* 000011000000 */
5879 0x0c, 0x00, /* 000011000000 */
5880 0x0c, 0x00, /* 000011000000 */
5881 0x0c, 0x00, /* 000011000000 */
5882 0x0c, 0x00, /* 000011000000 */
5883 0x0c, 0x00, /* 000011000000 */
5884 0x0c, 0x00, /* 000011000000 */
5885 0x0c, 0x00, /* 000011000000 */
5936 5886
5937 /* 245 0xf5 '.' */ 5887 /* 245 0xf5 '.' */
5938 /* FIXME */
5939 0x00, 0x00, /* 000000000000 */
5940 0x00, 0x00, /* 000000000000 */
5941 0x00, 0x00, /* 000000000000 */
5942 0x00, 0x00, /* 000000000000 */
5943 0x00, 0x00, /* 000000000000 */
5944 0x3f, 0xc0, /* 001111111100 */
5945 0x3f, 0xc0, /* 001111111100 */
5946 0x3f, 0xc0, /* 001111111100 */
5947 0x3f, 0xc0, /* 001111111100 */
5948 0x3f, 0xc0, /* 001111111100 */
5949 0x3f, 0xc0, /* 001111111100 */
5950 0x3f, 0xc0, /* 001111111100 */
5951 0x3f, 0xc0, /* 001111111100 */
5952 0x3f, 0xc0, /* 001111111100 */
5953 0x3f, 0xc0, /* 001111111100 */
5954 0x3f, 0xc0, /* 001111111100 */
5955 0x3f, 0xc0, /* 001111111100 */
5956 0x00, 0x00, /* 000000000000 */
5957 0x00, 0x00, /* 000000000000 */
5958 0x00, 0x00, /* 000000000000 */
5959 0x00, 0x00, /* 000000000000 */
5960 0x00, 0x00, /* 000000000000 */ 5888 0x00, 0x00, /* 000000000000 */
5889 0x1c, 0x00, /* 000111000000 */
5890 0x3e, 0x00, /* 001111100000 */
5891 0x63, 0x00, /* 011000110000 */
5892 0x63, 0x00, /* 011000110000 */
5893 0x03, 0x00, /* 000000110000 */
5894 0x03, 0x00, /* 000000110000 */
5895 0x03, 0x00, /* 000000110000 */
5896 0x03, 0x00, /* 000000110000 */
5897 0x03, 0x00, /* 000000110000 */
5898 0x03, 0x00, /* 000000110000 */
5899 0x03, 0x00, /* 000000110000 */
5900 0x03, 0x00, /* 000000110000 */
5901 0x03, 0x00, /* 000000110000 */
5902 0x03, 0x00, /* 000000110000 */
5903 0x03, 0x00, /* 000000110000 */
5904 0x03, 0x00, /* 000000110000 */
5905 0x03, 0x00, /* 000000110000 */
5906 0x03, 0x00, /* 000000110000 */
5907 0x03, 0x00, /* 000000110000 */
5908 0x03, 0x00, /* 000000110000 */
5909 0x03, 0x00, /* 000000110000 */
5961 5910
5962 /* 246 0xf6 '.' */ 5911 /* 246 0xf6 '.' */
5963 0x00, 0x00, /* 000000000000 */ 5912 0x00, 0x00, /* 000000000000 */
@@ -5984,24 +5933,23 @@ static unsigned char fontdata_sun12x22[FONTDATAMAX] = {
5984 0x00, 0x00, /* 000000000000 */ 5933 0x00, 0x00, /* 000000000000 */
5985 5934
5986 /* 247 0xf7 '.' */ 5935 /* 247 0xf7 '.' */
5987 /* FIXME */
5988 0x00, 0x00, /* 000000000000 */ 5936 0x00, 0x00, /* 000000000000 */
5989 0x00, 0x00, /* 000000000000 */ 5937 0x00, 0x00, /* 000000000000 */
5990 0x00, 0x00, /* 000000000000 */ 5938 0x00, 0x00, /* 000000000000 */
5991 0x00, 0x00, /* 000000000000 */ 5939 0x00, 0x00, /* 000000000000 */
5992 0x00, 0x00, /* 000000000000 */ 5940 0x00, 0x00, /* 000000000000 */
5993 0x3f, 0xc0, /* 001111111100 */ 5941 0x00, 0x00, /* 000000000000 */
5994 0x3f, 0xc0, /* 001111111100 */ 5942 0x00, 0x00, /* 000000000000 */
5995 0x3f, 0xc0, /* 001111111100 */ 5943 0x38, 0x00, /* 001110000000 */
5996 0x3f, 0xc0, /* 001111111100 */ 5944 0x6c, 0x00, /* 011011000000 */
5997 0x3f, 0xc0, /* 001111111100 */ 5945 0x06, 0x30, /* 000001100011 */
5998 0x3f, 0xc0, /* 001111111100 */ 5946 0x03, 0x60, /* 000000110110 */
5999 0x3f, 0xc0, /* 001111111100 */ 5947 0x39, 0xc0, /* 001110011100 */
6000 0x3f, 0xc0, /* 001111111100 */ 5948 0x6c, 0x00, /* 011011000000 */
6001 0x3f, 0xc0, /* 001111111100 */ 5949 0x06, 0x30, /* 000001100011 */
6002 0x3f, 0xc0, /* 001111111100 */ 5950 0x03, 0x60, /* 000000110110 */
6003 0x3f, 0xc0, /* 001111111100 */ 5951 0x01, 0xc0, /* 000000011100 */
6004 0x3f, 0xc0, /* 001111111100 */ 5952 0x00, 0x00, /* 000000000000 */
6005 0x00, 0x00, /* 000000000000 */ 5953 0x00, 0x00, /* 000000000000 */
6006 0x00, 0x00, /* 000000000000 */ 5954 0x00, 0x00, /* 000000000000 */
6007 0x00, 0x00, /* 000000000000 */ 5955 0x00, 0x00, /* 000000000000 */
@@ -6033,44 +5981,31 @@ static unsigned char fontdata_sun12x22[FONTDATAMAX] = {
6033 0x00, 0x00, /* 000000000000 */ 5981 0x00, 0x00, /* 000000000000 */
6034 5982
6035 /* 249 0xf9 '.' */ 5983 /* 249 0xf9 '.' */
6036 /* FIXME */
6037 0x00, 0x00, /* 000000000000 */ 5984 0x00, 0x00, /* 000000000000 */
6038 0x00, 0x00, /* 000000000000 */ 5985 0x00, 0x00, /* 000000000000 */
6039 0x00, 0x00, /* 000000000000 */ 5986 0x00, 0x00, /* 000000000000 */
6040 0x00, 0x00, /* 000000000000 */ 5987 0x00, 0x00, /* 000000000000 */
6041 0x00, 0x00, /* 000000000000 */ 5988 0x00, 0x00, /* 000000000000 */
6042 0x3f, 0xc0, /* 001111111100 */
6043 0x3f, 0xc0, /* 001111111100 */
6044 0x3f, 0xc0, /* 001111111100 */
6045 0x3f, 0xc0, /* 001111111100 */
6046 0x3f, 0xc0, /* 001111111100 */
6047 0x3f, 0xc0, /* 001111111100 */
6048 0x3f, 0xc0, /* 001111111100 */
6049 0x3f, 0xc0, /* 001111111100 */
6050 0x3f, 0xc0, /* 001111111100 */
6051 0x3f, 0xc0, /* 001111111100 */
6052 0x3f, 0xc0, /* 001111111100 */
6053 0x3f, 0xc0, /* 001111111100 */
6054 0x00, 0x00, /* 000000000000 */ 5989 0x00, 0x00, /* 000000000000 */
6055 0x00, 0x00, /* 000000000000 */ 5990 0x00, 0x00, /* 000000000000 */
6056 0x00, 0x00, /* 000000000000 */ 5991 0x00, 0x00, /* 000000000000 */
6057 0x00, 0x00, /* 000000000000 */ 5992 0x00, 0x00, /* 000000000000 */
6058 0x00, 0x00, /* 000000000000 */ 5993 0x00, 0x00, /* 000000000000 */
6059
6060 /* 250 0xfa '.' */
6061 0x00, 0x00, /* 000000000000 */
6062 0x00, 0x00, /* 000000000000 */ 5994 0x00, 0x00, /* 000000000000 */
5995 0x1c, 0x00, /* 000111000000 */
5996 0x3e, 0x00, /* 001111100000 */
5997 0x3e, 0x00, /* 001111100000 */
5998 0x3e, 0x00, /* 001111100000 */
5999 0x1c, 0x00, /* 000111000000 */
6063 0x00, 0x00, /* 000000000000 */ 6000 0x00, 0x00, /* 000000000000 */
6064 0x00, 0x00, /* 000000000000 */ 6001 0x00, 0x00, /* 000000000000 */
6065 0x00, 0x00, /* 000000000000 */ 6002 0x00, 0x00, /* 000000000000 */
6066 0x00, 0x00, /* 000000000000 */ 6003 0x00, 0x00, /* 000000000000 */
6067 0x00, 0x00, /* 000000000000 */ 6004 0x00, 0x00, /* 000000000000 */
6068 0x00, 0x00, /* 000000000000 */ 6005 0x00, 0x00, /* 000000000000 */
6006
6007 /* 250 0xfa '.' */
6069 0x00, 0x00, /* 000000000000 */ 6008 0x00, 0x00, /* 000000000000 */
6070 0x06, 0x00, /* 000001100000 */
6071 0x0f, 0x00, /* 000011110000 */
6072 0x0f, 0x00, /* 000011110000 */
6073 0x06, 0x00, /* 000001100000 */
6074 0x00, 0x00, /* 000000000000 */ 6009 0x00, 0x00, /* 000000000000 */
6075 0x00, 0x00, /* 000000000000 */ 6010 0x00, 0x00, /* 000000000000 */
6076 0x00, 0x00, /* 000000000000 */ 6011 0x00, 0x00, /* 000000000000 */
@@ -6080,51 +6015,61 @@ static unsigned char fontdata_sun12x22[FONTDATAMAX] = {
6080 0x00, 0x00, /* 000000000000 */ 6015 0x00, 0x00, /* 000000000000 */
6081 0x00, 0x00, /* 000000000000 */ 6016 0x00, 0x00, /* 000000000000 */
6082 0x00, 0x00, /* 000000000000 */ 6017 0x00, 0x00, /* 000000000000 */
6083
6084 /* 251 0xfb '.' */
6085 /* FIXME */
6086 0x00, 0x00, /* 000000000000 */ 6018 0x00, 0x00, /* 000000000000 */
6087 0x00, 0x00, /* 000000000000 */ 6019 0x00, 0x00, /* 000000000000 */
6020 0x18, 0x00, /* 000110000000 */
6021 0x3c, 0x00, /* 001111000000 */
6022 0x3c, 0x00, /* 001111000000 */
6023 0x18, 0x00, /* 000110000000 */
6088 0x00, 0x00, /* 000000000000 */ 6024 0x00, 0x00, /* 000000000000 */
6089 0x00, 0x00, /* 000000000000 */ 6025 0x00, 0x00, /* 000000000000 */
6090 0x00, 0x00, /* 000000000000 */ 6026 0x00, 0x00, /* 000000000000 */
6091 0x3f, 0xc0, /* 001111111100 */
6092 0x3f, 0xc0, /* 001111111100 */
6093 0x3f, 0xc0, /* 001111111100 */
6094 0x3f, 0xc0, /* 001111111100 */
6095 0x3f, 0xc0, /* 001111111100 */
6096 0x3f, 0xc0, /* 001111111100 */
6097 0x3f, 0xc0, /* 001111111100 */
6098 0x3f, 0xc0, /* 001111111100 */
6099 0x3f, 0xc0, /* 001111111100 */
6100 0x3f, 0xc0, /* 001111111100 */
6101 0x3f, 0xc0, /* 001111111100 */
6102 0x3f, 0xc0, /* 001111111100 */
6103 0x00, 0x00, /* 000000000000 */ 6027 0x00, 0x00, /* 000000000000 */
6104 0x00, 0x00, /* 000000000000 */ 6028 0x00, 0x00, /* 000000000000 */
6105 0x00, 0x00, /* 000000000000 */ 6029 0x00, 0x00, /* 000000000000 */
6030
6031 /* 251 0xfb '.' */
6106 0x00, 0x00, /* 000000000000 */ 6032 0x00, 0x00, /* 000000000000 */
6033 0x07, 0xe0, /* 000001111110 */
6034 0x06, 0x00, /* 000001100000 */
6035 0x06, 0x00, /* 000001100000 */
6036 0x06, 0x00, /* 000001100000 */
6037 0x06, 0x00, /* 000001100000 */
6038 0x06, 0x00, /* 000001100000 */
6039 0x06, 0x00, /* 000001100000 */
6040 0x06, 0x00, /* 000001100000 */
6041 0x06, 0x00, /* 000001100000 */
6042 0x06, 0x00, /* 000001100000 */
6043 0x06, 0x00, /* 000001100000 */
6044 0x06, 0x00, /* 000001100000 */
6045 0x06, 0x00, /* 000001100000 */
6046 0xc6, 0x00, /* 110001100000 */
6047 0x66, 0x00, /* 011001100000 */
6048 0x36, 0x00, /* 001101100000 */
6049 0x1e, 0x00, /* 000111100000 */
6050 0x0e, 0x00, /* 000011100000 */
6051 0x06, 0x00, /* 000001100000 */
6052 0x02, 0x00, /* 000000100000 */
6107 0x00, 0x00, /* 000000000000 */ 6053 0x00, 0x00, /* 000000000000 */
6108 6054
6109 /* 252 0xfc '.' */ 6055 /* 252 0xfc '.' */
6110 /* FIXME */ 6056 0x00, 0x00, /* 000000000000 */
6057 0x00, 0x00, /* 000000000000 */
6058 0x13, 0x80, /* 000100111000 */
6059 0x3d, 0xc0, /* 001111011100 */
6060 0x18, 0xc0, /* 000110001100 */
6061 0x18, 0xc0, /* 000110001100 */
6062 0x18, 0xc0, /* 000110001100 */
6063 0x18, 0xc0, /* 000110001100 */
6064 0x3d, 0xe0, /* 001111011110 */
6065 0x00, 0x00, /* 000000000000 */
6066 0x00, 0x00, /* 000000000000 */
6067 0x00, 0x00, /* 000000000000 */
6111 0x00, 0x00, /* 000000000000 */ 6068 0x00, 0x00, /* 000000000000 */
6112 0x00, 0x00, /* 000000000000 */ 6069 0x00, 0x00, /* 000000000000 */
6113 0x00, 0x00, /* 000000000000 */ 6070 0x00, 0x00, /* 000000000000 */
6114 0x00, 0x00, /* 000000000000 */ 6071 0x00, 0x00, /* 000000000000 */
6115 0x00, 0x00, /* 000000000000 */ 6072 0x00, 0x00, /* 000000000000 */
6116 0x3f, 0xc0, /* 001111111100 */
6117 0x3f, 0xc0, /* 001111111100 */
6118 0x3f, 0xc0, /* 001111111100 */
6119 0x3f, 0xc0, /* 001111111100 */
6120 0x3f, 0xc0, /* 001111111100 */
6121 0x3f, 0xc0, /* 001111111100 */
6122 0x3f, 0xc0, /* 001111111100 */
6123 0x3f, 0xc0, /* 001111111100 */
6124 0x3f, 0xc0, /* 001111111100 */
6125 0x3f, 0xc0, /* 001111111100 */
6126 0x3f, 0xc0, /* 001111111100 */
6127 0x3f, 0xc0, /* 001111111100 */
6128 0x00, 0x00, /* 000000000000 */ 6073 0x00, 0x00, /* 000000000000 */
6129 0x00, 0x00, /* 000000000000 */ 6074 0x00, 0x00, /* 000000000000 */
6130 0x00, 0x00, /* 000000000000 */ 6075 0x00, 0x00, /* 000000000000 */
diff --git a/drivers/video/console/fonts.c b/drivers/video/console/fonts.c
index 465d678230ae..e79b29702649 100644
--- a/drivers/video/console/fonts.c
+++ b/drivers/video/console/fonts.c
@@ -36,6 +36,10 @@ static struct font_desc *fonts[] = {
36#undef NO_FONTS 36#undef NO_FONTS
37 &font_vga_6x11, 37 &font_vga_6x11,
38#endif 38#endif
39#ifdef CONFIG_FONT_7x14
40#undef NO_FONTS
41 &font_7x14,
42#endif
39#ifdef CONFIG_FONT_SUN8x16 43#ifdef CONFIG_FONT_SUN8x16
40#undef NO_FONTS 44#undef NO_FONTS
41 &font_sun_8x16, 45 &font_sun_8x16,
@@ -44,6 +48,10 @@ static struct font_desc *fonts[] = {
44#undef NO_FONTS 48#undef NO_FONTS
45 &font_sun_12x22, 49 &font_sun_12x22,
46#endif 50#endif
51#ifdef CONFIG_FONT_10x18
52#undef NO_FONTS
53 &font_10x18,
54#endif
47#ifdef CONFIG_FONT_ACORN_8x8 55#ifdef CONFIG_FONT_ACORN_8x8
48#undef NO_FONTS 56#undef NO_FONTS
49 &font_acorn_8x8, 57 &font_acorn_8x8,
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
index bcf59b28a14f..d27fa91e5886 100644
--- a/drivers/video/console/vgacon.c
+++ b/drivers/video/console/vgacon.c
@@ -95,6 +95,7 @@ static unsigned long vgacon_uni_pagedir[2];
95/* Description of the hardware situation */ 95/* Description of the hardware situation */
96static unsigned long vga_vram_base; /* Base of video memory */ 96static unsigned long vga_vram_base; /* Base of video memory */
97static unsigned long vga_vram_end; /* End of video memory */ 97static unsigned long vga_vram_end; /* End of video memory */
98static int vga_vram_size; /* Size of video memory */
98static u16 vga_video_port_reg; /* Video register select port */ 99static u16 vga_video_port_reg; /* Video register select port */
99static u16 vga_video_port_val; /* Video register value port */ 100static u16 vga_video_port_val; /* Video register value port */
100static unsigned int vga_video_num_columns; /* Number of text columns */ 101static unsigned int vga_video_num_columns; /* Number of text columns */
@@ -288,6 +289,7 @@ static const char __init *vgacon_startup(void)
288 289
289 vga_vram_base = VGA_MAP_MEM(vga_vram_base); 290 vga_vram_base = VGA_MAP_MEM(vga_vram_base);
290 vga_vram_end = VGA_MAP_MEM(vga_vram_end); 291 vga_vram_end = VGA_MAP_MEM(vga_vram_end);
292 vga_vram_size = vga_vram_end - vga_vram_base;
291 293
292 /* 294 /*
293 * Find out if there is a graphics card present. 295 * Find out if there is a graphics card present.
@@ -504,9 +506,13 @@ static int vgacon_switch(struct vc_data *c)
504 */ 506 */
505 vga_video_num_columns = c->vc_cols; 507 vga_video_num_columns = c->vc_cols;
506 vga_video_num_lines = c->vc_rows; 508 vga_video_num_lines = c->vc_rows;
509
510 /* We can only copy out the size of the video buffer here,
511 * otherwise we get into VGA BIOS */
512
507 if (!vga_is_gfx) 513 if (!vga_is_gfx)
508 scr_memcpyw((u16 *) c->vc_origin, (u16 *) c->vc_screenbuf, 514 scr_memcpyw((u16 *) c->vc_origin, (u16 *) c->vc_screenbuf,
509 c->vc_screenbuf_size); 515 c->vc_screenbuf_size > vga_vram_size ? vga_vram_size : c->vc_screenbuf_size);
510 return 0; /* Redrawing not needed */ 516 return 0; /* Redrawing not needed */
511} 517}
512 518
@@ -961,7 +967,6 @@ static int vgacon_scrolldelta(struct vc_data *c, int lines)
961 if (!lines) /* Turn scrollback off */ 967 if (!lines) /* Turn scrollback off */
962 c->vc_visible_origin = c->vc_origin; 968 c->vc_visible_origin = c->vc_origin;
963 else { 969 else {
964 int vram_size = vga_vram_end - vga_vram_base;
965 int margin = c->vc_size_row * 4; 970 int margin = c->vc_size_row * 4;
966 int ul, we, p, st; 971 int ul, we, p, st;
967 972
@@ -971,7 +976,7 @@ static int vgacon_scrolldelta(struct vc_data *c, int lines)
971 we = vga_rolled_over + c->vc_size_row; 976 we = vga_rolled_over + c->vc_size_row;
972 } else { 977 } else {
973 ul = 0; 978 ul = 0;
974 we = vram_size; 979 we = vga_vram_size;
975 } 980 }
976 p = (c->vc_visible_origin - vga_vram_base - ul + we) % we + 981 p = (c->vc_visible_origin - vga_vram_base - ul + we) % we +
977 lines * c->vc_size_row; 982 lines * c->vc_size_row;
@@ -1012,9 +1017,13 @@ static void vgacon_save_screen(struct vc_data *c)
1012 c->vc_x = ORIG_X; 1017 c->vc_x = ORIG_X;
1013 c->vc_y = ORIG_Y; 1018 c->vc_y = ORIG_Y;
1014 } 1019 }
1020
1021 /* We can't copy in more then the size of the video buffer,
1022 * or we'll be copying in VGA BIOS */
1023
1015 if (!vga_is_gfx) 1024 if (!vga_is_gfx)
1016 scr_memcpyw((u16 *) c->vc_screenbuf, (u16 *) c->vc_origin, 1025 scr_memcpyw((u16 *) c->vc_screenbuf, (u16 *) c->vc_origin,
1017 c->vc_screenbuf_size); 1026 c->vc_screenbuf_size > vga_vram_size ? vga_vram_size : c->vc_screenbuf_size);
1018} 1027}
1019 1028
1020static int vgacon_scroll(struct vc_data *c, int t, int b, int dir, 1029static int vgacon_scroll(struct vc_data *c, int t, int b, int dir,
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index 8cef020d1801..2222de6ad844 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -76,70 +76,22 @@ int fb_get_color_depth(struct fb_var_screeninfo *var)
76EXPORT_SYMBOL(fb_get_color_depth); 76EXPORT_SYMBOL(fb_get_color_depth);
77 77
78/* 78/*
79 * Drawing helpers. 79 * Data padding functions.
80 */ 80 */
81void fb_iomove_buf_aligned(struct fb_info *info, struct fb_pixmap *buf, 81void fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, u32 height)
82 u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch,
83 u32 height)
84{ 82{
85 int i; 83 int i;
86 84
87 for (i = height; i--; ) { 85 for (i = height; i--; ) {
88 buf->outbuf(info, dst, src, s_pitch); 86 memcpy(dst, src, s_pitch);
89 src += s_pitch; 87 src += s_pitch;
90 dst += d_pitch; 88 dst += d_pitch;
91 } 89 }
92} 90}
91EXPORT_SYMBOL(fb_pad_aligned_buffer);
93 92
94void fb_sysmove_buf_aligned(struct fb_info *info, struct fb_pixmap *buf, 93void fb_pad_unaligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 idx, u32 height,
95 u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, 94 u32 shift_high, u32 shift_low, u32 mod)
96 u32 height)
97{
98 int i, j;
99
100 for (i = height; i--; ) {
101 for (j = 0; j < s_pitch; j++)
102 dst[j] = src[j];
103 src += s_pitch;
104 dst += d_pitch;
105 }
106}
107
108void fb_iomove_buf_unaligned(struct fb_info *info, struct fb_pixmap *buf,
109 u8 *dst, u32 d_pitch, u8 *src, u32 idx,
110 u32 height, u32 shift_high, u32 shift_low,
111 u32 mod)
112{
113 u8 mask = (u8) (0xfff << shift_high), tmp;
114 int i, j;
115
116 for (i = height; i--; ) {
117 for (j = 0; j < idx; j++) {
118 tmp = buf->inbuf(info, dst+j);
119 tmp &= mask;
120 tmp |= *src >> shift_low;
121 buf->outbuf(info, dst+j, &tmp, 1);
122 tmp = *src << shift_high;
123 buf->outbuf(info, dst+j+1, &tmp, 1);
124 src++;
125 }
126 tmp = buf->inbuf(info, dst+idx);
127 tmp &= mask;
128 tmp |= *src >> shift_low;
129 buf->outbuf(info, dst+idx, &tmp, 1);
130 if (shift_high < mod) {
131 tmp = *src << shift_high;
132 buf->outbuf(info, dst+idx+1, &tmp, 1);
133 }
134 src++;
135 dst += d_pitch;
136 }
137}
138
139void fb_sysmove_buf_unaligned(struct fb_info *info, struct fb_pixmap *buf,
140 u8 *dst, u32 d_pitch, u8 *src, u32 idx,
141 u32 height, u32 shift_high, u32 shift_low,
142 u32 mod)
143{ 95{
144 u8 mask = (u8) (0xfff << shift_high), tmp; 96 u8 mask = (u8) (0xfff << shift_high), tmp;
145 int i, j; 97 int i, j;
@@ -166,6 +118,7 @@ void fb_sysmove_buf_unaligned(struct fb_info *info, struct fb_pixmap *buf,
166 dst += d_pitch; 118 dst += d_pitch;
167 } 119 }
168} 120}
121EXPORT_SYMBOL(fb_pad_unaligned_buffer);
169 122
170/* 123/*
171 * we need to lock this section since fb_cursor 124 * we need to lock this section since fb_cursor
@@ -1081,7 +1034,7 @@ register_framebuffer(struct fb_info *fb_info)
1081 fb_info->pixmap.size = FBPIXMAPSIZE; 1034 fb_info->pixmap.size = FBPIXMAPSIZE;
1082 fb_info->pixmap.buf_align = 1; 1035 fb_info->pixmap.buf_align = 1;
1083 fb_info->pixmap.scan_align = 1; 1036 fb_info->pixmap.scan_align = 1;
1084 fb_info->pixmap.access_align = 4; 1037 fb_info->pixmap.access_align = 32;
1085 fb_info->pixmap.flags = FB_PIXMAP_DEFAULT; 1038 fb_info->pixmap.flags = FB_PIXMAP_DEFAULT;
1086 } 1039 }
1087 } 1040 }
@@ -1357,10 +1310,6 @@ EXPORT_SYMBOL(fb_set_var);
1357EXPORT_SYMBOL(fb_blank); 1310EXPORT_SYMBOL(fb_blank);
1358EXPORT_SYMBOL(fb_pan_display); 1311EXPORT_SYMBOL(fb_pan_display);
1359EXPORT_SYMBOL(fb_get_buffer_offset); 1312EXPORT_SYMBOL(fb_get_buffer_offset);
1360EXPORT_SYMBOL(fb_iomove_buf_unaligned);
1361EXPORT_SYMBOL(fb_iomove_buf_aligned);
1362EXPORT_SYMBOL(fb_sysmove_buf_unaligned);
1363EXPORT_SYMBOL(fb_sysmove_buf_aligned);
1364EXPORT_SYMBOL(fb_set_suspend); 1313EXPORT_SYMBOL(fb_set_suspend);
1365EXPORT_SYMBOL(fb_register_client); 1314EXPORT_SYMBOL(fb_register_client);
1366EXPORT_SYMBOL(fb_unregister_client); 1315EXPORT_SYMBOL(fb_unregister_client);
diff --git a/drivers/video/i810/i810_main.c b/drivers/video/i810/i810_main.c
index a9a618f2aa6a..7513fb9b19cf 100644
--- a/drivers/video/i810/i810_main.c
+++ b/drivers/video/i810/i810_main.c
@@ -1885,6 +1885,7 @@ static int __devinit i810fb_init_pci (struct pci_dev *dev,
1885 memset(info->pixmap.addr, 0, 8*1024); 1885 memset(info->pixmap.addr, 0, 8*1024);
1886 info->pixmap.size = 8*1024; 1886 info->pixmap.size = 8*1024;
1887 info->pixmap.buf_align = 8; 1887 info->pixmap.buf_align = 8;
1888 info->pixmap.access_align = 32;
1888 info->pixmap.flags = FB_PIXMAP_SYSTEM; 1889 info->pixmap.flags = FB_PIXMAP_SYSTEM;
1889 1890
1890 if ((err = i810_allocate_pci_resource(par, entry))) { 1891 if ((err = i810_allocate_pci_resource(par, entry))) {
diff --git a/drivers/video/intelfb/intelfbdrv.c b/drivers/video/intelfb/intelfbdrv.c
index 25f9a9a65c24..298bc9cd99e7 100644
--- a/drivers/video/intelfb/intelfbdrv.c
+++ b/drivers/video/intelfb/intelfbdrv.c
@@ -214,7 +214,7 @@ static struct fb_ops intel_fb_ops = {
214 214
215/* PCI driver module table */ 215/* PCI driver module table */
216static struct pci_driver intelfb_driver = { 216static struct pci_driver intelfb_driver = {
217 .name = "Intel(R) " SUPPORTED_CHIPSETS " Framebuffer Driver", 217 .name = "intelfb",
218 .id_table = intelfb_pci_table, 218 .id_table = intelfb_pci_table,
219 .probe = intelfb_pci_register, 219 .probe = intelfb_pci_register,
220 .remove = __devexit_p(intelfb_pci_unregister) 220 .remove = __devexit_p(intelfb_pci_unregister)
@@ -238,12 +238,15 @@ static int noregister = 0;
238static int probeonly = 0; 238static int probeonly = 0;
239static int idonly = 0; 239static int idonly = 0;
240static int bailearly = 0; 240static int bailearly = 0;
241static int voffset = 48;
241static char *mode = NULL; 242static char *mode = NULL;
242 243
243module_param(accel, bool, S_IRUGO); 244module_param(accel, bool, S_IRUGO);
244MODULE_PARM_DESC(accel, "Enable console acceleration"); 245MODULE_PARM_DESC(accel, "Enable console acceleration");
245module_param(vram, int, S_IRUGO); 246module_param(vram, int, S_IRUGO);
246MODULE_PARM_DESC(vram, "System RAM to allocate to framebuffer in MiB"); 247MODULE_PARM_DESC(vram, "System RAM to allocate to framebuffer in MiB");
248module_param(voffset, int, S_IRUGO);
249MODULE_PARM_DESC(voffset, "Offset of framebuffer in MiB");
247module_param(hwcursor, bool, S_IRUGO); 250module_param(hwcursor, bool, S_IRUGO);
248MODULE_PARM_DESC(hwcursor, "Enable HW cursor"); 251MODULE_PARM_DESC(hwcursor, "Enable HW cursor");
249module_param(mtrr, bool, S_IRUGO); 252module_param(mtrr, bool, S_IRUGO);
@@ -503,6 +506,7 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
503 struct agp_bridge_data *bridge; 506 struct agp_bridge_data *bridge;
504 int aperture_bar = 0; 507 int aperture_bar = 0;
505 int mmio_bar = 1; 508 int mmio_bar = 1;
509 int offset;
506 510
507 DBG_MSG("intelfb_pci_register\n"); 511 DBG_MSG("intelfb_pci_register\n");
508 512
@@ -659,17 +663,21 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
659 return -ENODEV; 663 return -ENODEV;
660 } 664 }
661 665
666 if (MB(voffset) < stolen_size)
667 offset = (stolen_size >> 12);
668 else
669 offset = ROUND_UP_TO_PAGE(MB(voffset))/GTT_PAGE_SIZE;
670
662 /* set the mem offsets - set them after the already used pages */ 671 /* set the mem offsets - set them after the already used pages */
663 if (dinfo->accel) { 672 if (dinfo->accel) {
664 dinfo->ring.offset = (stolen_size >> 12) 673 dinfo->ring.offset = offset + gtt_info.current_memory;
665 + gtt_info.current_memory;
666 } 674 }
667 if (dinfo->hwcursor) { 675 if (dinfo->hwcursor) {
668 dinfo->cursor.offset = (stolen_size >> 12) + 676 dinfo->cursor.offset = offset +
669 + gtt_info.current_memory + (dinfo->ring.size >> 12); 677 + gtt_info.current_memory + (dinfo->ring.size >> 12);
670 } 678 }
671 if (dinfo->fbmem_gart) { 679 if (dinfo->fbmem_gart) {
672 dinfo->fb.offset = (stolen_size >> 12) + 680 dinfo->fb.offset = offset +
673 + gtt_info.current_memory + (dinfo->ring.size >> 12) 681 + gtt_info.current_memory + (dinfo->ring.size >> 12)
674 + (dinfo->cursor.size >> 12); 682 + (dinfo->cursor.size >> 12);
675 } 683 }
@@ -1083,6 +1091,7 @@ intelfb_set_fbinfo(struct intelfb_info *dinfo)
1083 1091
1084 info->pixmap.size = 64*1024; 1092 info->pixmap.size = 64*1024;
1085 info->pixmap.buf_align = 8; 1093 info->pixmap.buf_align = 8;
1094 info->pixmap.access_align = 32;
1086 info->pixmap.flags = FB_PIXMAP_SYSTEM; 1095 info->pixmap.flags = FB_PIXMAP_SYSTEM;
1087 1096
1088 if (intelfb_init_var(dinfo)) 1097 if (intelfb_init_var(dinfo))
@@ -1293,7 +1302,7 @@ intelfb_set_par(struct fb_info *info)
1293 1302
1294 intelfb_blank(FB_BLANK_POWERDOWN, info); 1303 intelfb_blank(FB_BLANK_POWERDOWN, info);
1295 1304
1296 if (dinfo->accel) 1305 if (ACCEL(dinfo, info))
1297 intelfbhw_2d_stop(dinfo); 1306 intelfbhw_2d_stop(dinfo);
1298 1307
1299 memcpy(hw, &dinfo->save_state, sizeof(*hw)); 1308 memcpy(hw, &dinfo->save_state, sizeof(*hw));
@@ -1309,7 +1318,7 @@ intelfb_set_par(struct fb_info *info)
1309 1318
1310 update_dinfo(dinfo, &info->var); 1319 update_dinfo(dinfo, &info->var);
1311 1320
1312 if (dinfo->accel) 1321 if (ACCEL(dinfo, info))
1313 intelfbhw_2d_start(dinfo); 1322 intelfbhw_2d_start(dinfo);
1314 1323
1315 intelfb_pan_display(&info->var, info); 1324 intelfb_pan_display(&info->var, info);
diff --git a/drivers/video/nvidia/nvidia.c b/drivers/video/nvidia/nvidia.c
index 47733f58153b..b2e6b2407869 100644
--- a/drivers/video/nvidia/nvidia.c
+++ b/drivers/video/nvidia/nvidia.c
@@ -516,9 +516,9 @@ static struct backlight_controller nvidia_backlight_controller = {
516static void nvidiafb_load_cursor_image(struct nvidia_par *par, u8 * data8, 516static void nvidiafb_load_cursor_image(struct nvidia_par *par, u8 * data8,
517 u16 bg, u16 fg, u32 w, u32 h) 517 u16 bg, u16 fg, u32 w, u32 h)
518{ 518{
519 u32 *data = (u32 *) data8;
519 int i, j, k = 0; 520 int i, j, k = 0;
520 u32 b, tmp; 521 u32 b, tmp;
521 u32 *data = (u32 *) data8;
522 522
523 w = (w + 1) & ~1; 523 w = (w + 1) & ~1;
524 524
@@ -890,11 +890,11 @@ static int nvidiafb_cursor(struct fb_info *info, struct fb_cursor *cursor)
890{ 890{
891 struct nvidia_par *par = info->par; 891 struct nvidia_par *par = info->par;
892 u8 data[MAX_CURS * MAX_CURS / 8]; 892 u8 data[MAX_CURS * MAX_CURS / 8];
893 u16 fg, bg;
894 int i, set = cursor->set; 893 int i, set = cursor->set;
894 u16 fg, bg;
895 895
896 if (cursor->image.width > MAX_CURS || cursor->image.height > MAX_CURS) 896 if (cursor->image.width > MAX_CURS || cursor->image.height > MAX_CURS)
897 return soft_cursor(info, cursor); 897 return -ENXIO;
898 898
899 NVShowHideCursor(par, 0); 899 NVShowHideCursor(par, 0);
900 900
@@ -931,21 +931,18 @@ static int nvidiafb_cursor(struct fb_info *info, struct fb_cursor *cursor)
931 if (src) { 931 if (src) {
932 switch (cursor->rop) { 932 switch (cursor->rop) {
933 case ROP_XOR: 933 case ROP_XOR:
934 for (i = 0; i < s_pitch * cursor->image.height; 934 for (i = 0; i < s_pitch * cursor->image.height; i++)
935 i++)
936 src[i] = dat[i] ^ msk[i]; 935 src[i] = dat[i] ^ msk[i];
937 break; 936 break;
938 case ROP_COPY: 937 case ROP_COPY:
939 default: 938 default:
940 for (i = 0; i < s_pitch * cursor->image.height; 939 for (i = 0; i < s_pitch * cursor->image.height; i++)
941 i++)
942 src[i] = dat[i] & msk[i]; 940 src[i] = dat[i] & msk[i];
943 break; 941 break;
944 } 942 }
945 943
946 fb_sysmove_buf_aligned(info, &info->pixmap, data, 944 fb_pad_aligned_buffer(data, d_pitch, src, s_pitch,
947 d_pitch, src, s_pitch, 945 cursor->image.height);
948 cursor->image.height);
949 946
950 bg = ((info->cmap.red[bg_idx] & 0xf8) << 7) | 947 bg = ((info->cmap.red[bg_idx] & 0xf8) << 7) |
951 ((info->cmap.green[bg_idx] & 0xf8) << 2) | 948 ((info->cmap.green[bg_idx] & 0xf8) << 2) |
@@ -1348,6 +1345,7 @@ static int __devinit nvidia_set_fbinfo(struct fb_info *info)
1348 1345
1349 info->pixmap.scan_align = 4; 1346 info->pixmap.scan_align = 4;
1350 info->pixmap.buf_align = 4; 1347 info->pixmap.buf_align = 4;
1348 info->pixmap.access_align = 32;
1351 info->pixmap.size = 8 * 1024; 1349 info->pixmap.size = 8 * 1024;
1352 info->pixmap.flags = FB_PIXMAP_SYSTEM; 1350 info->pixmap.flags = FB_PIXMAP_SYSTEM;
1353 1351
diff --git a/drivers/video/pm3fb.c b/drivers/video/pm3fb.c
index 8e024aad1b57..e0dad948467b 100644
--- a/drivers/video/pm3fb.c
+++ b/drivers/video/pm3fb.c
@@ -5,7 +5,7 @@
5 * Based on code written by: 5 * Based on code written by:
6 * Sven Luther, <luther@dpt-info.u-strasbg.fr> 6 * Sven Luther, <luther@dpt-info.u-strasbg.fr>
7 * Alan Hourihane, <alanh@fairlite.demon.co.uk> 7 * Alan Hourihane, <alanh@fairlite.demon.co.uk>
8 * Russel King, <rmk@arm.linux.org.uk> 8 * Russell King, <rmk@arm.linux.org.uk>
9 * Based on linux/drivers/video/skeletonfb.c: 9 * Based on linux/drivers/video/skeletonfb.c:
10 * Copyright (C) 1997 Geert Uytterhoeven 10 * Copyright (C) 1997 Geert Uytterhoeven
11 * Based on linux/driver/video/pm2fb.c: 11 * Based on linux/driver/video/pm2fb.c:
diff --git a/drivers/video/riva/fbdev.c b/drivers/video/riva/fbdev.c
index b0c886de0404..6a9e183be41b 100644
--- a/drivers/video/riva/fbdev.c
+++ b/drivers/video/riva/fbdev.c
@@ -1582,12 +1582,11 @@ static int rivafb_cursor(struct fb_info *info, struct fb_cursor *cursor)
1582{ 1582{
1583 struct riva_par *par = (struct riva_par *) info->par; 1583 struct riva_par *par = (struct riva_par *) info->par;
1584 u8 data[MAX_CURS * MAX_CURS/8]; 1584 u8 data[MAX_CURS * MAX_CURS/8];
1585 u16 fg, bg;
1586 int i, set = cursor->set; 1585 int i, set = cursor->set;
1586 u16 fg, bg;
1587 1587
1588 if (cursor->image.width > MAX_CURS || 1588 if (cursor->image.width > MAX_CURS || cursor->image.height > MAX_CURS)
1589 cursor->image.height > MAX_CURS) 1589 return -ENXIO;
1590 return soft_cursor(info, cursor);
1591 1590
1592 par->riva.ShowHideCursor(&par->riva, 0); 1591 par->riva.ShowHideCursor(&par->riva, 0);
1593 1592
@@ -1625,21 +1624,18 @@ static int rivafb_cursor(struct fb_info *info, struct fb_cursor *cursor)
1625 if (src) { 1624 if (src) {
1626 switch (cursor->rop) { 1625 switch (cursor->rop) {
1627 case ROP_XOR: 1626 case ROP_XOR:
1628 for (i = 0; i < s_pitch * cursor->image.height; 1627 for (i = 0; i < s_pitch * cursor->image.height; i++)
1629 i++)
1630 src[i] = dat[i] ^ msk[i]; 1628 src[i] = dat[i] ^ msk[i];
1631 break; 1629 break;
1632 case ROP_COPY: 1630 case ROP_COPY:
1633 default: 1631 default:
1634 for (i = 0; i < s_pitch * cursor->image.height; 1632 for (i = 0; i < s_pitch * cursor->image.height; i++)
1635 i++)
1636 src[i] = dat[i] & msk[i]; 1633 src[i] = dat[i] & msk[i];
1637 break; 1634 break;
1638 } 1635 }
1639 1636
1640 fb_sysmove_buf_aligned(info, &info->pixmap, data, 1637 fb_pad_aligned_buffer(data, d_pitch, src, s_pitch,
1641 d_pitch, src, s_pitch, 1638 cursor->image.height);
1642 cursor->image.height);
1643 1639
1644 bg = ((info->cmap.red[bg_idx] & 0xf8) << 7) | 1640 bg = ((info->cmap.red[bg_idx] & 0xf8) << 7) |
1645 ((info->cmap.green[bg_idx] & 0xf8) << 2) | 1641 ((info->cmap.green[bg_idx] & 0xf8) << 2) |
@@ -1727,6 +1723,7 @@ static int __devinit riva_set_fbinfo(struct fb_info *info)
1727 1723
1728 info->pixmap.size = 8 * 1024; 1724 info->pixmap.size = 8 * 1024;
1729 info->pixmap.buf_align = 4; 1725 info->pixmap.buf_align = 4;
1726 info->pixmap.access_align = 32;
1730 info->pixmap.flags = FB_PIXMAP_SYSTEM; 1727 info->pixmap.flags = FB_PIXMAP_SYSTEM;
1731 info->var.yres_virtual = -1; 1728 info->var.yres_virtual = -1;
1732 NVTRACE_LEAVE(); 1729 NVTRACE_LEAVE();
diff --git a/drivers/video/s1d13xxxfb.c b/drivers/video/s1d13xxxfb.c
index b637c389e4f4..789de13f461f 100644
--- a/drivers/video/s1d13xxxfb.c
+++ b/drivers/video/s1d13xxxfb.c
@@ -493,7 +493,7 @@ s1d13xxxfb_fetch_hw_state(struct fb_info *info)
493} 493}
494 494
495 495
496static int __devexit 496static int
497s1d13xxxfb_remove(struct device *dev) 497s1d13xxxfb_remove(struct device *dev)
498{ 498{
499 struct fb_info *info = dev_get_drvdata(dev); 499 struct fb_info *info = dev_get_drvdata(dev);
diff --git a/drivers/video/savage/savagefb_driver.c b/drivers/video/savage/savagefb_driver.c
index 03d74e8ee067..8fadcdae6f42 100644
--- a/drivers/video/savage/savagefb_driver.c
+++ b/drivers/video/savage/savagefb_driver.c
@@ -1897,7 +1897,7 @@ static int __devinit savage_init_fb_info (struct fb_info *info,
1897 info->pixmap.size = 8*1024; 1897 info->pixmap.size = 8*1024;
1898 info->pixmap.scan_align = 4; 1898 info->pixmap.scan_align = 4;
1899 info->pixmap.buf_align = 4; 1899 info->pixmap.buf_align = 4;
1900 info->pixmap.access_align = 4; 1900 info->pixmap.access_align = 32;
1901 1901
1902 fb_alloc_cmap (&info->cmap, NR_PALETTE, 0); 1902 fb_alloc_cmap (&info->cmap, NR_PALETTE, 0);
1903 info->flags |= FBINFO_HWACCEL_COPYAREA | 1903 info->flags |= FBINFO_HWACCEL_COPYAREA |
diff --git a/drivers/video/softcursor.c b/drivers/video/softcursor.c
index 13a4511539a1..229c4bc35079 100644
--- a/drivers/video/softcursor.c
+++ b/drivers/video/softcursor.c
@@ -58,17 +58,10 @@ int soft_cursor(struct fb_info *info, struct fb_cursor *cursor)
58 } else 58 } else
59 memcpy(src, image->data, dsize); 59 memcpy(src, image->data, dsize);
60 60
61 if (info->pixmap.outbuf) 61 fb_pad_aligned_buffer(dst, d_pitch, src, s_pitch, image->height);
62 fb_iomove_buf_aligned(info, &info->pixmap, dst, d_pitch, src,
63 s_pitch, image->height);
64 else
65 fb_sysmove_buf_aligned(info, &info->pixmap, dst, d_pitch, src,
66 s_pitch, image->height);
67
68 image->data = dst; 62 image->data = dst;
69 info->fbops->fb_imageblit(info, image); 63 info->fbops->fb_imageblit(info, image);
70 kfree(src); 64 kfree(src);
71
72 return 0; 65 return 0;
73} 66}
74 67
diff --git a/drivers/video/vesafb.c b/drivers/video/vesafb.c
index 3027841f9c24..f3069b01e248 100644
--- a/drivers/video/vesafb.c
+++ b/drivers/video/vesafb.c
@@ -271,7 +271,7 @@ static int __init vesafb_probe(struct device *device)
271 271
272 if (!request_mem_region(vesafb_fix.smem_start, size_total, "vesafb")) { 272 if (!request_mem_region(vesafb_fix.smem_start, size_total, "vesafb")) {
273 printk(KERN_WARNING 273 printk(KERN_WARNING
274 "vesafb: abort, cannot reserve video memory at 0x%lx\n", 274 "vesafb: cannot reserve video memory at 0x%lx\n",
275 vesafb_fix.smem_start); 275 vesafb_fix.smem_start);
276 /* We cannot make this fatal. Sometimes this comes from magic 276 /* We cannot make this fatal. Sometimes this comes from magic
277 spaces our resource handlers simply don't know about */ 277 spaces our resource handlers simply don't know about */
@@ -279,13 +279,13 @@ static int __init vesafb_probe(struct device *device)
279 279
280 info = framebuffer_alloc(sizeof(u32) * 256, &dev->dev); 280 info = framebuffer_alloc(sizeof(u32) * 256, &dev->dev);
281 if (!info) { 281 if (!info) {
282 release_mem_region(vesafb_fix.smem_start, vesafb_fix.smem_len); 282 release_mem_region(vesafb_fix.smem_start, size_total);
283 return -ENOMEM; 283 return -ENOMEM;
284 } 284 }
285 info->pseudo_palette = info->par; 285 info->pseudo_palette = info->par;
286 info->par = NULL; 286 info->par = NULL;
287 287
288 info->screen_base = ioremap(vesafb_fix.smem_start, vesafb_fix.smem_len); 288 info->screen_base = ioremap(vesafb_fix.smem_start, vesafb_fix.smem_len);
289 if (!info->screen_base) { 289 if (!info->screen_base) {
290 printk(KERN_ERR 290 printk(KERN_ERR
291 "vesafb: abort, cannot ioremap video memory 0x%x @ 0x%lx\n", 291 "vesafb: abort, cannot ioremap video memory 0x%x @ 0x%lx\n",
@@ -386,7 +386,7 @@ static int __init vesafb_probe(struct device *device)
386 request_region(0x3c0, 32, "vesafb"); 386 request_region(0x3c0, 32, "vesafb");
387 387
388 if (mtrr) { 388 if (mtrr) {
389 int temp_size = size_total; 389 unsigned int temp_size = size_total;
390 /* Find the largest power-of-two */ 390 /* Find the largest power-of-two */
391 while (temp_size & (temp_size - 1)) 391 while (temp_size & (temp_size - 1))
392 temp_size &= (temp_size - 1); 392 temp_size &= (temp_size - 1);
diff --git a/fs/Kconfig b/fs/Kconfig
index 6a4ad4bb7a54..178e27494b74 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -741,56 +741,6 @@ config SYSFS
741 741
742 Designers of embedded systems may wish to say N here to conserve space. 742 Designers of embedded systems may wish to say N here to conserve space.
743 743
744config DEVFS_FS
745 bool "/dev file system support (OBSOLETE)"
746 depends on EXPERIMENTAL
747 help
748 This is support for devfs, a virtual file system (like /proc) which
749 provides the file system interface to device drivers, normally found
750 in /dev. Devfs does not depend on major and minor number
751 allocations. Device drivers register entries in /dev which then
752 appear automatically, which means that the system administrator does
753 not have to create character and block special device files in the
754 /dev directory using the mknod command (or MAKEDEV script) anymore.
755
756 This is work in progress. If you want to use this, you *must* read
757 the material in <file:Documentation/filesystems/devfs/>, especially
758 the file README there.
759
760 Note that devfs no longer manages /dev/pts! If you are using UNIX98
761 ptys, you will also need to mount the /dev/pts filesystem (devpts).
762
763 Note that devfs has been obsoleted by udev,
764 <http://www.kernel.org/pub/linux/utils/kernel/hotplug/>.
765 It has been stripped down to a bare minimum and is only provided for
766 legacy installations that use its naming scheme which is
767 unfortunately different from the names normal Linux installations
768 use.
769
770 If unsure, say N.
771
772config DEVFS_MOUNT
773 bool "Automatically mount at boot"
774 depends on DEVFS_FS
775 help
776 This option appears if you have CONFIG_DEVFS_FS enabled. Setting
777 this to 'Y' will make the kernel automatically mount devfs onto /dev
778 when the system is booted, before the init thread is started.
779 You can override this with the "devfs=nomount" boot option.
780
781 If unsure, say N.
782
783config DEVFS_DEBUG
784 bool "Debug devfs"
785 depends on DEVFS_FS
786 help
787 If you say Y here, then the /dev file system code will generate
788 debugging messages. See the file
789 <file:Documentation/filesystems/devfs/boot-options> for more
790 details.
791
792 If unsure, say N.
793
794config DEVPTS_FS_XATTR 744config DEVPTS_FS_XATTR
795 bool "/dev/pts Extended Attributes" 745 bool "/dev/pts Extended Attributes"
796 depends on UNIX98_PTYS 746 depends on UNIX98_PTYS
diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h
index c7b2b8890188..9c09641ce907 100644
--- a/fs/autofs4/autofs_i.h
+++ b/fs/autofs4/autofs_i.h
@@ -185,6 +185,19 @@ int autofs4_wait(struct autofs_sb_info *,struct dentry *, enum autofs_notify);
185int autofs4_wait_release(struct autofs_sb_info *,autofs_wqt_t,int); 185int autofs4_wait_release(struct autofs_sb_info *,autofs_wqt_t,int);
186void autofs4_catatonic_mode(struct autofs_sb_info *); 186void autofs4_catatonic_mode(struct autofs_sb_info *);
187 187
188static inline int autofs4_follow_mount(struct vfsmount **mnt, struct dentry **dentry)
189{
190 int res = 0;
191
192 while (d_mountpoint(*dentry)) {
193 int followed = follow_down(mnt, dentry);
194 if (!followed)
195 break;
196 res = 1;
197 }
198 return res;
199}
200
188static inline int simple_positive(struct dentry *dentry) 201static inline int simple_positive(struct dentry *dentry)
189{ 202{
190 return dentry->d_inode && !d_unhashed(dentry); 203 return dentry->d_inode && !d_unhashed(dentry);
diff --git a/fs/autofs4/expire.c b/fs/autofs4/expire.c
index 500425e24fba..feb6ac427d05 100644
--- a/fs/autofs4/expire.c
+++ b/fs/autofs4/expire.c
@@ -56,12 +56,9 @@ static int autofs4_check_mount(struct vfsmount *mnt, struct dentry *dentry)
56 mntget(mnt); 56 mntget(mnt);
57 dget(dentry); 57 dget(dentry);
58 58
59 if (!follow_down(&mnt, &dentry)) 59 if (!autofs4_follow_mount(&mnt, &dentry))
60 goto done; 60 goto done;
61 61
62 while (d_mountpoint(dentry) && follow_down(&mnt, &dentry))
63 ;
64
65 /* This is an autofs submount, we can't expire it */ 62 /* This is an autofs submount, we can't expire it */
66 if (is_autofs4_dentry(dentry)) 63 if (is_autofs4_dentry(dentry))
67 goto done; 64 goto done;
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index 3765c047f157..2a771ec66956 100644
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -205,7 +205,11 @@ static int autofs4_dir_open(struct inode *inode, struct file *file)
205 struct vfsmount *fp_mnt = mntget(mnt); 205 struct vfsmount *fp_mnt = mntget(mnt);
206 struct dentry *fp_dentry = dget(dentry); 206 struct dentry *fp_dentry = dget(dentry);
207 207
208 while (follow_down(&fp_mnt, &fp_dentry) && d_mountpoint(fp_dentry)); 208 if (!autofs4_follow_mount(&fp_mnt, &fp_dentry)) {
209 dput(fp_dentry);
210 mntput(fp_mnt);
211 return -ENOENT;
212 }
209 213
210 fp = dentry_open(fp_dentry, fp_mnt, file->f_flags); 214 fp = dentry_open(fp_dentry, fp_mnt, file->f_flags);
211 status = PTR_ERR(fp); 215 status = PTR_ERR(fp);
@@ -302,7 +306,14 @@ static int try_to_fill_dentry(struct dentry *dentry,
302 306
303 DPRINTK("expire done status=%d", status); 307 DPRINTK("expire done status=%d", status);
304 308
305 return 0; 309 /*
310 * If the directory still exists the mount request must
311 * continue otherwise it can't be followed at the right
312 * time during the walk.
313 */
314 status = d_invalidate(dentry);
315 if (status != -EBUSY)
316 return 0;
306 } 317 }
307 318
308 DPRINTK("dentry=%p %.*s ino=%p", 319 DPRINTK("dentry=%p %.*s ino=%p",
diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c
index 5a40d36e5a51..fa2348dcd671 100644
--- a/fs/autofs4/waitq.c
+++ b/fs/autofs4/waitq.c
@@ -191,6 +191,13 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry,
191 } 191 }
192 192
193 if ( !wq ) { 193 if ( !wq ) {
194 /* Can't wait for an expire if there's no mount */
195 if (notify == NFY_NONE && !d_mountpoint(dentry)) {
196 kfree(name);
197 up(&sbi->wq_sem);
198 return -ENOENT;
199 }
200
194 /* Create a new wait queue */ 201 /* Create a new wait queue */
195 wq = kmalloc(sizeof(struct autofs_wait_queue),GFP_KERNEL); 202 wq = kmalloc(sizeof(struct autofs_wait_queue),GFP_KERNEL);
196 if ( !wq ) { 203 if ( !wq ) {
diff --git a/fs/binfmt_aout.c b/fs/binfmt_aout.c
index 009b8920c1ff..dd9baabaf016 100644
--- a/fs/binfmt_aout.c
+++ b/fs/binfmt_aout.c
@@ -316,6 +316,7 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs)
316 current->mm->brk = ex.a_bss + 316 current->mm->brk = ex.a_bss +
317 (current->mm->start_brk = N_BSSADDR(ex)); 317 (current->mm->start_brk = N_BSSADDR(ex));
318 current->mm->free_area_cache = current->mm->mmap_base; 318 current->mm->free_area_cache = current->mm->mmap_base;
319 current->mm->cached_hole_size = 0;
319 320
320 set_mm_counter(current->mm, rss, 0); 321 set_mm_counter(current->mm, rss, 0);
321 current->mm->mmap = NULL; 322 current->mm->mmap = NULL;
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index f8f6b6b76179..7976a238f0a3 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -775,6 +775,7 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs)
775 change some of these later */ 775 change some of these later */
776 set_mm_counter(current->mm, rss, 0); 776 set_mm_counter(current->mm, rss, 0);
777 current->mm->free_area_cache = current->mm->mmap_base; 777 current->mm->free_area_cache = current->mm->mmap_base;
778 current->mm->cached_hole_size = 0;
778 retval = setup_arg_pages(bprm, randomize_stack_top(STACK_TOP), 779 retval = setup_arg_pages(bprm, randomize_stack_top(STACK_TOP),
779 executable_stack); 780 executable_stack);
780 if (retval < 0) { 781 if (retval < 0) {
diff --git a/fs/buffer.c b/fs/buffer.c
index 7e9e409feaa7..0befa724ab98 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -528,7 +528,7 @@ static void free_more_memory(void)
528 for_each_pgdat(pgdat) { 528 for_each_pgdat(pgdat) {
529 zones = pgdat->node_zonelists[GFP_NOFS&GFP_ZONEMASK].zones; 529 zones = pgdat->node_zonelists[GFP_NOFS&GFP_ZONEMASK].zones;
530 if (*zones) 530 if (*zones)
531 try_to_free_pages(zones, GFP_NOFS, 0); 531 try_to_free_pages(zones, GFP_NOFS);
532 } 532 }
533} 533}
534 534
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 2af3338f891b..3a9b6d179cbd 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -122,6 +122,9 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
122 122
123 start_addr = mm->free_area_cache; 123 start_addr = mm->free_area_cache;
124 124
125 if (len <= mm->cached_hole_size)
126 start_addr = TASK_UNMAPPED_BASE;
127
125full_search: 128full_search:
126 addr = ALIGN(start_addr, HPAGE_SIZE); 129 addr = ALIGN(start_addr, HPAGE_SIZE);
127 130
diff --git a/fs/isofs/dir.c b/fs/isofs/dir.c
index 6030956b894b..7901ac9f97ab 100644
--- a/fs/isofs/dir.c
+++ b/fs/isofs/dir.c
@@ -193,12 +193,17 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp,
193 193
194 /* Handle everything else. Do name translation if there 194 /* Handle everything else. Do name translation if there
195 is no Rock Ridge NM field. */ 195 is no Rock Ridge NM field. */
196 if (sbi->s_unhide == 'n') { 196
197 /* Do not report hidden or associated files */ 197 /*
198 if (de->flags[-sbi->s_high_sierra] & 5) { 198 * Do not report hidden files if so instructed, or associated
199 filp->f_pos += de_len; 199 * files unless instructed to do so
200 continue; 200 */
201 } 201 if ((sbi->s_hide == 'y' &&
202 (de->flags[-sbi->s_high_sierra] & 1)) ||
203 (sbi->s_showassoc =='n' &&
204 (de->flags[-sbi->s_high_sierra] & 4))) {
205 filp->f_pos += de_len;
206 continue;
202 } 207 }
203 208
204 map = 1; 209 map = 1;
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index abd7b12eeca7..1652de1b6cb9 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -28,11 +28,6 @@
28 28
29#define BEQUIET 29#define BEQUIET
30 30
31#ifdef LEAK_CHECK
32static int check_malloc;
33static int check_bread;
34#endif
35
36static int isofs_hashi(struct dentry *parent, struct qstr *qstr); 31static int isofs_hashi(struct dentry *parent, struct qstr *qstr);
37static int isofs_hash(struct dentry *parent, struct qstr *qstr); 32static int isofs_hash(struct dentry *parent, struct qstr *qstr);
38static int isofs_dentry_cmpi(struct dentry *dentry, struct qstr *a, struct qstr *b); 33static int isofs_dentry_cmpi(struct dentry *dentry, struct qstr *a, struct qstr *b);
@@ -55,11 +50,6 @@ static void isofs_put_super(struct super_block *sb)
55 } 50 }
56#endif 51#endif
57 52
58#ifdef LEAK_CHECK
59 printk("Outstanding mallocs:%d, outstanding buffers: %d\n",
60 check_malloc, check_bread);
61#endif
62
63 kfree(sbi); 53 kfree(sbi);
64 sb->s_fs_info = NULL; 54 sb->s_fs_info = NULL;
65 return; 55 return;
@@ -73,7 +63,7 @@ static kmem_cache_t *isofs_inode_cachep;
73static struct inode *isofs_alloc_inode(struct super_block *sb) 63static struct inode *isofs_alloc_inode(struct super_block *sb)
74{ 64{
75 struct iso_inode_info *ei; 65 struct iso_inode_info *ei;
76 ei = (struct iso_inode_info *)kmem_cache_alloc(isofs_inode_cachep, SLAB_KERNEL); 66 ei = kmem_cache_alloc(isofs_inode_cachep, SLAB_KERNEL);
77 if (!ei) 67 if (!ei)
78 return NULL; 68 return NULL;
79 return &ei->vfs_inode; 69 return &ei->vfs_inode;
@@ -84,9 +74,9 @@ static void isofs_destroy_inode(struct inode *inode)
84 kmem_cache_free(isofs_inode_cachep, ISOFS_I(inode)); 74 kmem_cache_free(isofs_inode_cachep, ISOFS_I(inode));
85} 75}
86 76
87static void init_once(void * foo, kmem_cache_t * cachep, unsigned long flags) 77static void init_once(void *foo, kmem_cache_t * cachep, unsigned long flags)
88{ 78{
89 struct iso_inode_info *ei = (struct iso_inode_info *) foo; 79 struct iso_inode_info *ei = foo;
90 80
91 if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) == 81 if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) ==
92 SLAB_CTOR_CONSTRUCTOR) 82 SLAB_CTOR_CONSTRUCTOR)
@@ -107,7 +97,8 @@ static int init_inodecache(void)
107static void destroy_inodecache(void) 97static void destroy_inodecache(void)
108{ 98{
109 if (kmem_cache_destroy(isofs_inode_cachep)) 99 if (kmem_cache_destroy(isofs_inode_cachep))
110 printk(KERN_INFO "iso_inode_cache: not all structures were freed\n"); 100 printk(KERN_INFO "iso_inode_cache: not all structures were "
101 "freed\n");
111} 102}
112 103
113static int isofs_remount(struct super_block *sb, int *flags, char *data) 104static int isofs_remount(struct super_block *sb, int *flags, char *data)
@@ -144,7 +135,7 @@ static struct dentry_operations isofs_dentry_ops[] = {
144 { 135 {
145 .d_hash = isofs_hashi_ms, 136 .d_hash = isofs_hashi_ms,
146 .d_compare = isofs_dentry_cmpi_ms, 137 .d_compare = isofs_dentry_cmpi_ms,
147 } 138 },
148#endif 139#endif
149}; 140};
150 141
@@ -153,7 +144,8 @@ struct iso9660_options{
153 char rock; 144 char rock;
154 char joliet; 145 char joliet;
155 char cruft; 146 char cruft;
156 char unhide; 147 char hide;
148 char showassoc;
157 char nocompress; 149 char nocompress;
158 unsigned char check; 150 unsigned char check;
159 unsigned int blocksize; 151 unsigned int blocksize;
@@ -219,8 +211,8 @@ isofs_hashi_common(struct dentry *dentry, struct qstr *qstr, int ms)
219/* 211/*
220 * Case insensitive compare of two isofs names. 212 * Case insensitive compare of two isofs names.
221 */ 213 */
222static int 214static int isofs_dentry_cmpi_common(struct dentry *dentry, struct qstr *a,
223isofs_dentry_cmpi_common(struct dentry *dentry,struct qstr *a,struct qstr *b,int ms) 215 struct qstr *b, int ms)
224{ 216{
225 int alen, blen; 217 int alen, blen;
226 218
@@ -243,8 +235,8 @@ isofs_dentry_cmpi_common(struct dentry *dentry,struct qstr *a,struct qstr *b,int
243/* 235/*
244 * Case sensitive compare of two isofs names. 236 * Case sensitive compare of two isofs names.
245 */ 237 */
246static int 238static int isofs_dentry_cmp_common(struct dentry *dentry, struct qstr *a,
247isofs_dentry_cmp_common(struct dentry *dentry,struct qstr *a,struct qstr *b,int ms) 239 struct qstr *b, int ms)
248{ 240{
249 int alen, blen; 241 int alen, blen;
250 242
@@ -318,13 +310,15 @@ enum {
318 Opt_block, Opt_check_r, Opt_check_s, Opt_cruft, Opt_gid, Opt_ignore, 310 Opt_block, Opt_check_r, Opt_check_s, Opt_cruft, Opt_gid, Opt_ignore,
319 Opt_iocharset, Opt_map_a, Opt_map_n, Opt_map_o, Opt_mode, Opt_nojoliet, 311 Opt_iocharset, Opt_map_a, Opt_map_n, Opt_map_o, Opt_mode, Opt_nojoliet,
320 Opt_norock, Opt_sb, Opt_session, Opt_uid, Opt_unhide, Opt_utf8, Opt_err, 312 Opt_norock, Opt_sb, Opt_session, Opt_uid, Opt_unhide, Opt_utf8, Opt_err,
321 Opt_nocompress, 313 Opt_nocompress, Opt_hide, Opt_showassoc,
322}; 314};
323 315
324static match_table_t tokens = { 316static match_table_t tokens = {
325 {Opt_norock, "norock"}, 317 {Opt_norock, "norock"},
326 {Opt_nojoliet, "nojoliet"}, 318 {Opt_nojoliet, "nojoliet"},
327 {Opt_unhide, "unhide"}, 319 {Opt_unhide, "unhide"},
320 {Opt_hide, "hide"},
321 {Opt_showassoc, "showassoc"},
328 {Opt_cruft, "cruft"}, 322 {Opt_cruft, "cruft"},
329 {Opt_utf8, "utf8"}, 323 {Opt_utf8, "utf8"},
330 {Opt_iocharset, "iocharset=%s"}, 324 {Opt_iocharset, "iocharset=%s"},
@@ -356,7 +350,7 @@ static match_table_t tokens = {
356 {Opt_err, NULL} 350 {Opt_err, NULL}
357}; 351};
358 352
359static int parse_options(char *options, struct iso9660_options * popt) 353static int parse_options(char *options, struct iso9660_options *popt)
360{ 354{
361 char *p; 355 char *p;
362 int option; 356 int option;
@@ -365,7 +359,8 @@ static int parse_options(char *options, struct iso9660_options * popt)
365 popt->rock = 'y'; 359 popt->rock = 'y';
366 popt->joliet = 'y'; 360 popt->joliet = 'y';
367 popt->cruft = 'n'; 361 popt->cruft = 'n';
368 popt->unhide = 'n'; 362 popt->hide = 'n';
363 popt->showassoc = 'n';
369 popt->check = 'u'; /* unset */ 364 popt->check = 'u'; /* unset */
370 popt->nocompress = 0; 365 popt->nocompress = 0;
371 popt->blocksize = 1024; 366 popt->blocksize = 1024;
@@ -398,8 +393,12 @@ static int parse_options(char *options, struct iso9660_options * popt)
398 case Opt_nojoliet: 393 case Opt_nojoliet:
399 popt->joliet = 'n'; 394 popt->joliet = 'n';
400 break; 395 break;
396 case Opt_hide:
397 popt->hide = 'y';
398 break;
401 case Opt_unhide: 399 case Opt_unhide:
402 popt->unhide = 'y'; 400 case Opt_showassoc:
401 popt->showassoc = 'y';
403 break; 402 break;
404 case Opt_cruft: 403 case Opt_cruft:
405 popt->cruft = 'y'; 404 popt->cruft = 'y';
@@ -493,7 +492,7 @@ static int parse_options(char *options, struct iso9660_options * popt)
493 */ 492 */
494#define WE_OBEY_THE_WRITTEN_STANDARDS 1 493#define WE_OBEY_THE_WRITTEN_STANDARDS 1
495 494
496static unsigned int isofs_get_last_session(struct super_block *sb,s32 session ) 495static unsigned int isofs_get_last_session(struct super_block *sb, s32 session)
497{ 496{
498 struct cdrom_multisession ms_info; 497 struct cdrom_multisession ms_info;
499 unsigned int vol_desc_start; 498 unsigned int vol_desc_start;
@@ -518,7 +517,8 @@ static unsigned int isofs_get_last_session(struct super_block *sb,s32 session )
518 printk(KERN_ERR "Invalid session number or type of track\n"); 517 printk(KERN_ERR "Invalid session number or type of track\n");
519 } 518 }
520 i = ioctl_by_bdev(bdev, CDROMMULTISESSION, (unsigned long) &ms_info); 519 i = ioctl_by_bdev(bdev, CDROMMULTISESSION, (unsigned long) &ms_info);
521 if(session > 0) printk(KERN_ERR "Invalid session number\n"); 520 if (session > 0)
521 printk(KERN_ERR "Invalid session number\n");
522#if 0 522#if 0
523 printk("isofs.inode: CDROMMULTISESSION: rc=%d\n",i); 523 printk("isofs.inode: CDROMMULTISESSION: rc=%d\n",i);
524 if (i==0) { 524 if (i==0) {
@@ -557,13 +557,13 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent)
557 struct iso9660_options opt; 557 struct iso9660_options opt;
558 struct isofs_sb_info * sbi; 558 struct isofs_sb_info * sbi;
559 559
560 sbi = kmalloc(sizeof(struct isofs_sb_info), GFP_KERNEL); 560 sbi = kmalloc(sizeof(*sbi), GFP_KERNEL);
561 if (!sbi) 561 if (!sbi)
562 return -ENOMEM; 562 return -ENOMEM;
563 s->s_fs_info = sbi; 563 s->s_fs_info = sbi;
564 memset(sbi, 0, sizeof(struct isofs_sb_info)); 564 memset(sbi, 0, sizeof(*sbi));
565 565
566 if (!parse_options((char *) data, &opt)) 566 if (!parse_options((char *)data, &opt))
567 goto out_freesbi; 567 goto out_freesbi;
568 568
569 /* 569 /*
@@ -792,7 +792,8 @@ root_found:
792 sbi->s_rock = (opt.rock == 'y' ? 2 : 0); 792 sbi->s_rock = (opt.rock == 'y' ? 2 : 0);
793 sbi->s_rock_offset = -1; /* initial offset, will guess until SP is found*/ 793 sbi->s_rock_offset = -1; /* initial offset, will guess until SP is found*/
794 sbi->s_cruft = opt.cruft; 794 sbi->s_cruft = opt.cruft;
795 sbi->s_unhide = opt.unhide; 795 sbi->s_hide = opt.hide;
796 sbi->s_showassoc = opt.showassoc;
796 sbi->s_uid = opt.uid; 797 sbi->s_uid = opt.uid;
797 sbi->s_gid = opt.gid; 798 sbi->s_gid = opt.gid;
798 sbi->s_utf8 = opt.utf8; 799 sbi->s_utf8 = opt.utf8;
@@ -1002,7 +1003,6 @@ int isofs_get_blocks(struct inode *inode, sector_t iblock_s,
1002 rv++; 1003 rv++;
1003 } 1004 }
1004 1005
1005
1006abort: 1006abort:
1007 unlock_kernel(); 1007 unlock_kernel();
1008 return rv; 1008 return rv;
@@ -1014,7 +1014,7 @@ abort:
1014static int isofs_get_block(struct inode *inode, sector_t iblock, 1014static int isofs_get_block(struct inode *inode, sector_t iblock,
1015 struct buffer_head *bh_result, int create) 1015 struct buffer_head *bh_result, int create)
1016{ 1016{
1017 if ( create ) { 1017 if (create) {
1018 printk("isofs_get_block: Kernel tries to allocate a block\n"); 1018 printk("isofs_get_block: Kernel tries to allocate a block\n");
1019 return -EROFS; 1019 return -EROFS;
1020 } 1020 }
@@ -1061,19 +1061,17 @@ static struct address_space_operations isofs_aops = {
1061 1061
1062static inline void test_and_set_uid(uid_t *p, uid_t value) 1062static inline void test_and_set_uid(uid_t *p, uid_t value)
1063{ 1063{
1064 if(value) { 1064 if (value)
1065 *p = value; 1065 *p = value;
1066 }
1067} 1066}
1068 1067
1069static inline void test_and_set_gid(gid_t *p, gid_t value) 1068static inline void test_and_set_gid(gid_t *p, gid_t value)
1070{ 1069{
1071 if(value) { 1070 if (value)
1072 *p = value; 1071 *p = value;
1073 }
1074} 1072}
1075 1073
1076static int isofs_read_level3_size(struct inode * inode) 1074static int isofs_read_level3_size(struct inode *inode)
1077{ 1075{
1078 unsigned long bufsize = ISOFS_BUFFER_SIZE(inode); 1076 unsigned long bufsize = ISOFS_BUFFER_SIZE(inode);
1079 int high_sierra = ISOFS_SB(inode->i_sb)->s_high_sierra; 1077 int high_sierra = ISOFS_SB(inode->i_sb)->s_high_sierra;
@@ -1136,7 +1134,7 @@ static int isofs_read_level3_size(struct inode * inode)
1136 bh = sb_bread(inode->i_sb, block); 1134 bh = sb_bread(inode->i_sb, block);
1137 if (!bh) 1135 if (!bh)
1138 goto out_noread; 1136 goto out_noread;
1139 memcpy((void *) tmpde + slop, bh->b_data, offset); 1137 memcpy((void *)tmpde+slop, bh->b_data, offset);
1140 } 1138 }
1141 de = tmpde; 1139 de = tmpde;
1142 } 1140 }
@@ -1150,12 +1148,11 @@ static int isofs_read_level3_size(struct inode * inode)
1150 more_entries = de->flags[-high_sierra] & 0x80; 1148 more_entries = de->flags[-high_sierra] & 0x80;
1151 1149
1152 i++; 1150 i++;
1153 if(i > 100) 1151 if (i > 100)
1154 goto out_toomany; 1152 goto out_toomany;
1155 } while(more_entries); 1153 } while (more_entries);
1156out: 1154out:
1157 if (tmpde) 1155 kfree(tmpde);
1158 kfree(tmpde);
1159 if (bh) 1156 if (bh)
1160 brelse(bh); 1157 brelse(bh);
1161 return 0; 1158 return 0;
@@ -1179,7 +1176,7 @@ out_toomany:
1179 goto out; 1176 goto out;
1180} 1177}
1181 1178
1182static void isofs_read_inode(struct inode * inode) 1179static void isofs_read_inode(struct inode *inode)
1183{ 1180{
1184 struct super_block *sb = inode->i_sb; 1181 struct super_block *sb = inode->i_sb;
1185 struct isofs_sb_info *sbi = ISOFS_SB(sb); 1182 struct isofs_sb_info *sbi = ISOFS_SB(sb);
@@ -1249,7 +1246,7 @@ static void isofs_read_inode(struct inode * inode)
1249 ei->i_format_parm[2] = 0; 1246 ei->i_format_parm[2] = 0;
1250 1247
1251 ei->i_section_size = isonum_733 (de->size); 1248 ei->i_section_size = isonum_733 (de->size);
1252 if(de->flags[-high_sierra] & 0x80) { 1249 if (de->flags[-high_sierra] & 0x80) {
1253 if(isofs_read_level3_size(inode)) goto fail; 1250 if(isofs_read_level3_size(inode)) goto fail;
1254 } else { 1251 } else {
1255 ei->i_next_section_block = 0; 1252 ei->i_next_section_block = 0;
@@ -1336,16 +1333,16 @@ static void isofs_read_inode(struct inode * inode)
1336 /* XXX - parse_rock_ridge_inode() had already set i_rdev. */ 1333 /* XXX - parse_rock_ridge_inode() had already set i_rdev. */
1337 init_special_inode(inode, inode->i_mode, inode->i_rdev); 1334 init_special_inode(inode, inode->i_mode, inode->i_rdev);
1338 1335
1339 out: 1336out:
1340 if (tmpde) 1337 if (tmpde)
1341 kfree(tmpde); 1338 kfree(tmpde);
1342 if (bh) 1339 if (bh)
1343 brelse(bh); 1340 brelse(bh);
1344 return; 1341 return;
1345 1342
1346 out_badread: 1343out_badread:
1347 printk(KERN_WARNING "ISOFS: unable to read i-node block\n"); 1344 printk(KERN_WARNING "ISOFS: unable to read i-node block\n");
1348 fail: 1345fail:
1349 make_bad_inode(inode); 1346 make_bad_inode(inode);
1350 goto out; 1347 goto out;
1351} 1348}
@@ -1394,11 +1391,8 @@ struct inode *isofs_iget(struct super_block *sb,
1394 1391
1395 hashval = (block << sb->s_blocksize_bits) | offset; 1392 hashval = (block << sb->s_blocksize_bits) | offset;
1396 1393
1397 inode = iget5_locked(sb, 1394 inode = iget5_locked(sb, hashval, &isofs_iget5_test,
1398 hashval, 1395 &isofs_iget5_set, &data);
1399 &isofs_iget5_test,
1400 &isofs_iget5_set,
1401 &data);
1402 1396
1403 if (inode && (inode->i_state & I_NEW)) { 1397 if (inode && (inode->i_state & I_NEW)) {
1404 sb->s_op->read_inode(inode); 1398 sb->s_op->read_inode(inode);
@@ -1408,36 +1402,6 @@ struct inode *isofs_iget(struct super_block *sb,
1408 return inode; 1402 return inode;
1409} 1403}
1410 1404
1411#ifdef LEAK_CHECK
1412#undef malloc
1413#undef free_s
1414#undef sb_bread
1415#undef brelse
1416
1417void * leak_check_malloc(unsigned int size){
1418 void * tmp;
1419 check_malloc++;
1420 tmp = kmalloc(size, GFP_KERNEL);
1421 return tmp;
1422}
1423
1424void leak_check_free_s(void * obj, int size){
1425 check_malloc--;
1426 return kfree(obj);
1427}
1428
1429struct buffer_head * leak_check_bread(struct super_block *sb, int block){
1430 check_bread++;
1431 return sb_bread(sb, block);
1432}
1433
1434void leak_check_brelse(struct buffer_head * bh){
1435 check_bread--;
1436 return brelse(bh);
1437}
1438
1439#endif
1440
1441static struct super_block *isofs_get_sb(struct file_system_type *fs_type, 1405static struct super_block *isofs_get_sb(struct file_system_type *fs_type,
1442 int flags, const char *dev_name, void *data) 1406 int flags, const char *dev_name, void *data)
1443{ 1407{
diff --git a/fs/isofs/isofs.h b/fs/isofs/isofs.h
index 9ce7b51fb614..38c75151fc66 100644
--- a/fs/isofs/isofs.h
+++ b/fs/isofs/isofs.h
@@ -47,6 +47,8 @@ struct isofs_sb_info {
47 unsigned char s_nosuid; 47 unsigned char s_nosuid;
48 unsigned char s_nodev; 48 unsigned char s_nodev;
49 unsigned char s_nocompress; 49 unsigned char s_nocompress;
50 unsigned char s_hide;
51 unsigned char s_showassoc;
50 52
51 mode_t s_mode; 53 mode_t s_mode;
52 gid_t s_gid; 54 gid_t s_gid;
diff --git a/fs/isofs/namei.c b/fs/isofs/namei.c
index 690edf37173c..e37e82b7cbf0 100644
--- a/fs/isofs/namei.c
+++ b/fs/isofs/namei.c
@@ -131,14 +131,16 @@ isofs_find_entry(struct inode *dir, struct dentry *dentry,
131 } 131 }
132 132
133 /* 133 /*
134 * Skip hidden or associated files unless unhide is set 134 * Skip hidden or associated files unless hide or showassoc,
135 * respectively, is set
135 */ 136 */
136 match = 0; 137 match = 0;
137 if (dlen > 0 && 138 if (dlen > 0 &&
138 (!(de->flags[-sbi->s_high_sierra] & 5) 139 (sbi->s_hide =='n' ||
139 || sbi->s_unhide == 'y')) 140 (!(de->flags[-sbi->s_high_sierra] & 1))) &&
140 { 141 (sbi->s_showassoc =='y' ||
141 match = (isofs_cmp(dentry,dpnt,dlen) == 0); 142 (!(de->flags[-sbi->s_high_sierra] & 4)))) {
143 match = (isofs_cmp(dentry, dpnt, dlen) == 0);
142 } 144 }
143 if (match) { 145 if (match) {
144 isofs_normalize_block_and_offset(de, 146 isofs_normalize_block_and_offset(de,
@@ -146,11 +148,11 @@ isofs_find_entry(struct inode *dir, struct dentry *dentry,
146 &offset_saved); 148 &offset_saved);
147 *block_rv = block_saved; 149 *block_rv = block_saved;
148 *offset_rv = offset_saved; 150 *offset_rv = offset_saved;
149 if (bh) brelse(bh); 151 brelse(bh);
150 return 1; 152 return 1;
151 } 153 }
152 } 154 }
153 if (bh) brelse(bh); 155 brelse(bh);
154 return 0; 156 return 0;
155} 157}
156 158
diff --git a/fs/isofs/rock.c b/fs/isofs/rock.c
index 089e79c65585..4326cb47f8fa 100644
--- a/fs/isofs/rock.c
+++ b/fs/isofs/rock.c
@@ -13,352 +13,542 @@
13#include "isofs.h" 13#include "isofs.h"
14#include "rock.h" 14#include "rock.h"
15 15
16/* These functions are designed to read the system areas of a directory record 16/*
17 * These functions are designed to read the system areas of a directory record
17 * and extract relevant information. There are different functions provided 18 * and extract relevant information. There are different functions provided
18 * depending upon what information we need at the time. One function fills 19 * depending upon what information we need at the time. One function fills
19 * out an inode structure, a second one extracts a filename, a third one 20 * out an inode structure, a second one extracts a filename, a third one
20 * returns a symbolic link name, and a fourth one returns the extent number 21 * returns a symbolic link name, and a fourth one returns the extent number
21 * for the file. */ 22 * for the file.
22 23 */
23#define SIG(A,B) ((A) | ((B) << 8)) /* isonum_721() */ 24
24 25#define SIG(A,B) ((A) | ((B) << 8)) /* isonum_721() */
25 26
26/* This is a way of ensuring that we have something in the system 27struct rock_state {
27 use fields that is compatible with Rock Ridge */ 28 void *buffer;
28#define CHECK_SP(FAIL) \ 29 unsigned char *chr;
29 if(rr->u.SP.magic[0] != 0xbe) FAIL; \ 30 int len;
30 if(rr->u.SP.magic[1] != 0xef) FAIL; \ 31 int cont_size;
31 ISOFS_SB(inode->i_sb)->s_rock_offset=rr->u.SP.skip; 32 int cont_extent;
32/* We define a series of macros because each function must do exactly the 33 int cont_offset;
33 same thing in certain places. We use the macros to ensure that everything 34 struct inode *inode;
34 is done correctly */ 35};
35 36
36#define CONTINUE_DECLS \ 37/*
37 int cont_extent = 0, cont_offset = 0, cont_size = 0; \ 38 * This is a way of ensuring that we have something in the system
38 void *buffer = NULL 39 * use fields that is compatible with Rock Ridge. Return zero on success.
39 40 */
40#define CHECK_CE \ 41
41 {cont_extent = isonum_733(rr->u.CE.extent); \ 42static int check_sp(struct rock_ridge *rr, struct inode *inode)
42 cont_offset = isonum_733(rr->u.CE.offset); \
43 cont_size = isonum_733(rr->u.CE.size);}
44
45#define SETUP_ROCK_RIDGE(DE,CHR,LEN) \
46 {LEN= sizeof(struct iso_directory_record) + DE->name_len[0]; \
47 if(LEN & 1) LEN++; \
48 CHR = ((unsigned char *) DE) + LEN; \
49 LEN = *((unsigned char *) DE) - LEN; \
50 if (LEN<0) LEN=0; \
51 if (ISOFS_SB(inode->i_sb)->s_rock_offset!=-1) \
52 { \
53 LEN-=ISOFS_SB(inode->i_sb)->s_rock_offset; \
54 CHR+=ISOFS_SB(inode->i_sb)->s_rock_offset; \
55 if (LEN<0) LEN=0; \
56 } \
57}
58
59#define MAYBE_CONTINUE(LABEL,DEV) \
60 {if (buffer) { kfree(buffer); buffer = NULL; } \
61 if (cont_extent){ \
62 int block, offset, offset1; \
63 struct buffer_head * pbh; \
64 buffer = kmalloc(cont_size,GFP_KERNEL); \
65 if (!buffer) goto out; \
66 block = cont_extent; \
67 offset = cont_offset; \
68 offset1 = 0; \
69 pbh = sb_bread(DEV->i_sb, block); \
70 if(pbh){ \
71 if (offset > pbh->b_size || offset + cont_size > pbh->b_size){ \
72 brelse(pbh); \
73 goto out; \
74 } \
75 memcpy(buffer + offset1, pbh->b_data + offset, cont_size - offset1); \
76 brelse(pbh); \
77 chr = (unsigned char *) buffer; \
78 len = cont_size; \
79 cont_extent = 0; \
80 cont_size = 0; \
81 cont_offset = 0; \
82 goto LABEL; \
83 } \
84 printk("Unable to read rock-ridge attributes\n"); \
85 }}
86
87/* return length of name field; 0: not found, -1: to be ignored */
88int get_rock_ridge_filename(struct iso_directory_record * de,
89 char * retname, struct inode * inode)
90{ 43{
91 int len; 44 if (rr->u.SP.magic[0] != 0xbe)
92 unsigned char * chr; 45 return -1;
93 CONTINUE_DECLS; 46 if (rr->u.SP.magic[1] != 0xef)
94 int retnamlen = 0, truncate=0; 47 return -1;
95 48 ISOFS_SB(inode->i_sb)->s_rock_offset = rr->u.SP.skip;
96 if (!ISOFS_SB(inode->i_sb)->s_rock) return 0; 49 return 0;
97 *retname = 0; 50}
98 51
99 SETUP_ROCK_RIDGE(de, chr, len); 52static void setup_rock_ridge(struct iso_directory_record *de,
100 repeat: 53 struct inode *inode, struct rock_state *rs)
101 { 54{
102 struct rock_ridge * rr; 55 rs->len = sizeof(struct iso_directory_record) + de->name_len[0];
103 int sig; 56 if (rs->len & 1)
104 57 (rs->len)++;
105 while (len > 2){ /* There may be one byte for padding somewhere */ 58 rs->chr = (unsigned char *)de + rs->len;
106 rr = (struct rock_ridge *) chr; 59 rs->len = *((unsigned char *)de) - rs->len;
107 if (rr->len < 3) goto out; /* Something got screwed up here */ 60 if (rs->len < 0)
108 sig = isonum_721(chr); 61 rs->len = 0;
109 chr += rr->len; 62
110 len -= rr->len; 63 if (ISOFS_SB(inode->i_sb)->s_rock_offset != -1) {
111 if (len < 0) goto out; /* corrupted isofs */ 64 rs->len -= ISOFS_SB(inode->i_sb)->s_rock_offset;
112 65 rs->chr += ISOFS_SB(inode->i_sb)->s_rock_offset;
113 switch(sig){ 66 if (rs->len < 0)
114 case SIG('R','R'): 67 rs->len = 0;
115 if((rr->u.RR.flags[0] & RR_NM) == 0) goto out; 68 }
116 break; 69}
117 case SIG('S','P'): 70
118 CHECK_SP(goto out); 71static void init_rock_state(struct rock_state *rs, struct inode *inode)
119 break; 72{
120 case SIG('C','E'): 73 memset(rs, 0, sizeof(*rs));
121 CHECK_CE; 74 rs->inode = inode;
122 break; 75}
123 case SIG('N','M'): 76
124 if (truncate) break; 77/*
125 if (rr->len < 5) break; 78 * Returns 0 if the caller should continue scanning, 1 if the scan must end
126 /* 79 * and -ve on error.
127 * If the flags are 2 or 4, this indicates '.' or '..'. 80 */
128 * We don't want to do anything with this, because it 81static int rock_continue(struct rock_state *rs)
129 * screws up the code that calls us. We don't really 82{
130 * care anyways, since we can just use the non-RR 83 int ret = 1;
131 * name. 84 int blocksize = 1 << rs->inode->i_blkbits;
132 */ 85 const int min_de_size = offsetof(struct rock_ridge, u);
133 if (rr->u.NM.flags & 6) { 86
134 break; 87 kfree(rs->buffer);
88 rs->buffer = NULL;
89
90 if ((unsigned)rs->cont_offset > blocksize - min_de_size ||
91 (unsigned)rs->cont_size > blocksize ||
92 (unsigned)(rs->cont_offset + rs->cont_size) > blocksize) {
93 printk(KERN_NOTICE "rock: corrupted directory entry. "
94 "extent=%d, offset=%d, size=%d\n",
95 rs->cont_extent, rs->cont_offset, rs->cont_size);
96 ret = -EIO;
97 goto out;
135 } 98 }
136 99
137 if (rr->u.NM.flags & ~1) { 100 if (rs->cont_extent) {
138 printk("Unsupported NM flag settings (%d)\n",rr->u.NM.flags); 101 struct buffer_head *bh;
139 break; 102
103 rs->buffer = kmalloc(rs->cont_size, GFP_KERNEL);
104 if (!rs->buffer) {
105 ret = -ENOMEM;
106 goto out;
107 }
108 ret = -EIO;
109 bh = sb_bread(rs->inode->i_sb, rs->cont_extent);
110 if (bh) {
111 memcpy(rs->buffer, bh->b_data + rs->cont_offset,
112 rs->cont_size);
113 put_bh(bh);
114 rs->chr = rs->buffer;
115 rs->len = rs->cont_size;
116 rs->cont_extent = 0;
117 rs->cont_size = 0;
118 rs->cont_offset = 0;
119 return 0;
120 }
121 printk("Unable to read rock-ridge attributes\n");
122 }
123out:
124 kfree(rs->buffer);
125 rs->buffer = NULL;
126 return ret;
127}
128
129/*
130 * We think there's a record of type `sig' at rs->chr. Parse the signature
131 * and make sure that there's really room for a record of that type.
132 */
133static int rock_check_overflow(struct rock_state *rs, int sig)
134{
135 int len;
136
137 switch (sig) {
138 case SIG('S', 'P'):
139 len = sizeof(struct SU_SP_s);
140 break;
141 case SIG('C', 'E'):
142 len = sizeof(struct SU_CE_s);
143 break;
144 case SIG('E', 'R'):
145 len = sizeof(struct SU_ER_s);
146 break;
147 case SIG('R', 'R'):
148 len = sizeof(struct RR_RR_s);
149 break;
150 case SIG('P', 'X'):
151 len = sizeof(struct RR_PX_s);
152 break;
153 case SIG('P', 'N'):
154 len = sizeof(struct RR_PN_s);
155 break;
156 case SIG('S', 'L'):
157 len = sizeof(struct RR_SL_s);
158 break;
159 case SIG('N', 'M'):
160 len = sizeof(struct RR_NM_s);
161 break;
162 case SIG('C', 'L'):
163 len = sizeof(struct RR_CL_s);
164 break;
165 case SIG('P', 'L'):
166 len = sizeof(struct RR_PL_s);
167 break;
168 case SIG('T', 'F'):
169 len = sizeof(struct RR_TF_s);
170 break;
171 case SIG('Z', 'F'):
172 len = sizeof(struct RR_ZF_s);
173 break;
174 default:
175 len = 0;
176 break;
140 } 177 }
141 if((strlen(retname) + rr->len - 5) >= 254) { 178 len += offsetof(struct rock_ridge, u);
142 truncate = 1; 179 if (len > rs->len) {
143 break; 180 printk(KERN_NOTICE "rock: directory entry would overflow "
181 "storage\n");
182 printk(KERN_NOTICE "rock: sig=0x%02x, size=%d, remaining=%d\n",
183 sig, len, rs->len);
184 return -EIO;
185 }
186 return 0;
187}
188
189/*
190 * return length of name field; 0: not found, -1: to be ignored
191 */
192int get_rock_ridge_filename(struct iso_directory_record *de,
193 char *retname, struct inode *inode)
194{
195 struct rock_state rs;
196 struct rock_ridge *rr;
197 int sig;
198 int retnamlen = 0;
199 int truncate = 0;
200 int ret = 0;
201
202 if (!ISOFS_SB(inode->i_sb)->s_rock)
203 return 0;
204 *retname = 0;
205
206 init_rock_state(&rs, inode);
207 setup_rock_ridge(de, inode, &rs);
208repeat:
209
210 while (rs.len > 2) { /* There may be one byte for padding somewhere */
211 rr = (struct rock_ridge *)rs.chr;
212 if (rr->len < 3)
213 goto out; /* Something got screwed up here */
214 sig = isonum_721(rs.chr);
215 if (rock_check_overflow(&rs, sig))
216 goto eio;
217 rs.chr += rr->len;
218 rs.len -= rr->len;
219 if (rs.len < 0)
220 goto eio; /* corrupted isofs */
221
222 switch (sig) {
223 case SIG('R', 'R'):
224 if ((rr->u.RR.flags[0] & RR_NM) == 0)
225 goto out;
226 break;
227 case SIG('S', 'P'):
228 if (check_sp(rr, inode))
229 goto out;
230 break;
231 case SIG('C', 'E'):
232 rs.cont_extent = isonum_733(rr->u.CE.extent);
233 rs.cont_offset = isonum_733(rr->u.CE.offset);
234 rs.cont_size = isonum_733(rr->u.CE.size);
235 break;
236 case SIG('N', 'M'):
237 if (truncate)
238 break;
239 if (rr->len < 5)
240 break;
241 /*
242 * If the flags are 2 or 4, this indicates '.' or '..'.
243 * We don't want to do anything with this, because it
244 * screws up the code that calls us. We don't really
245 * care anyways, since we can just use the non-RR
246 * name.
247 */
248 if (rr->u.NM.flags & 6)
249 break;
250
251 if (rr->u.NM.flags & ~1) {
252 printk("Unsupported NM flag settings (%d)\n",
253 rr->u.NM.flags);
254 break;
255 }
256 if ((strlen(retname) + rr->len - 5) >= 254) {
257 truncate = 1;
258 break;
259 }
260 strncat(retname, rr->u.NM.name, rr->len - 5);
261 retnamlen += rr->len - 5;
262 break;
263 case SIG('R', 'E'):
264 kfree(rs.buffer);
265 return -1;
266 default:
267 break;
268 }
144 } 269 }
145 strncat(retname, rr->u.NM.name, rr->len - 5); 270 ret = rock_continue(&rs);
146 retnamlen += rr->len - 5; 271 if (ret == 0)
147 break; 272 goto repeat;
148 case SIG('R','E'): 273 if (ret == 1)
149 if (buffer) kfree(buffer); 274 return retnamlen; /* If 0, this file did not have a NM field */
150 return -1; 275out:
151 default: 276 kfree(rs.buffer);
152 break; 277 return ret;
153 } 278eio:
154 } 279 ret = -EIO;
155 } 280 goto out;
156 MAYBE_CONTINUE(repeat,inode);
157 if (buffer) kfree(buffer);
158 return retnamlen; /* If 0, this file did not have a NM field */
159 out:
160 if(buffer) kfree(buffer);
161 return 0;
162} 281}
163 282
164static int 283static int
165parse_rock_ridge_inode_internal(struct iso_directory_record *de, 284parse_rock_ridge_inode_internal(struct iso_directory_record *de,
166 struct inode *inode, int regard_xa) 285 struct inode *inode, int regard_xa)
167{ 286{
168 int len; 287 int symlink_len = 0;
169 unsigned char * chr; 288 int cnt, sig;
170 int symlink_len = 0; 289 struct inode *reloc;
171 CONTINUE_DECLS; 290 struct rock_ridge *rr;
172 291 int rootflag;
173 if (!ISOFS_SB(inode->i_sb)->s_rock) return 0; 292 struct rock_state rs;
174 293 int ret = 0;
175 SETUP_ROCK_RIDGE(de, chr, len); 294
176 if (regard_xa) 295 if (!ISOFS_SB(inode->i_sb)->s_rock)
177 { 296 return 0;
178 chr+=14; 297
179 len-=14; 298 init_rock_state(&rs, inode);
180 if (len<0) len=0; 299 setup_rock_ridge(de, inode, &rs);
181 } 300 if (regard_xa) {
182 301 rs.chr += 14;
183 repeat: 302 rs.len -= 14;
184 { 303 if (rs.len < 0)
185 int cnt, sig; 304 rs.len = 0;
186 struct inode * reloc; 305 }
187 struct rock_ridge * rr; 306
188 int rootflag; 307repeat:
189 308 while (rs.len > 2) { /* There may be one byte for padding somewhere */
190 while (len > 2){ /* There may be one byte for padding somewhere */ 309 rr = (struct rock_ridge *)rs.chr;
191 rr = (struct rock_ridge *) chr; 310 if (rr->len < 3)
192 if (rr->len < 3) goto out; /* Something got screwed up here */ 311 goto out; /* Something got screwed up here */
193 sig = isonum_721(chr); 312 sig = isonum_721(rs.chr);
194 chr += rr->len; 313 if (rock_check_overflow(&rs, sig))
195 len -= rr->len; 314 goto eio;
196 if (len < 0) goto out; /* corrupted isofs */ 315 rs.chr += rr->len;
197 316 rs.len -= rr->len;
198 switch(sig){ 317 if (rs.len < 0)
318 goto eio; /* corrupted isofs */
319
320 switch (sig) {
199#ifndef CONFIG_ZISOFS /* No flag for SF or ZF */ 321#ifndef CONFIG_ZISOFS /* No flag for SF or ZF */
200 case SIG('R','R'): 322 case SIG('R', 'R'):
201 if((rr->u.RR.flags[0] & 323 if ((rr->u.RR.flags[0] &
202 (RR_PX | RR_TF | RR_SL | RR_CL)) == 0) goto out; 324 (RR_PX | RR_TF | RR_SL | RR_CL)) == 0)
203 break; 325 goto out;
326 break;
204#endif 327#endif
205 case SIG('S','P'): 328 case SIG('S', 'P'):
206 CHECK_SP(goto out); 329 if (check_sp(rr, inode))
207 break; 330 goto out;
208 case SIG('C','E'): 331 break;
209 CHECK_CE; 332 case SIG('C', 'E'):
210 break; 333 rs.cont_extent = isonum_733(rr->u.CE.extent);
211 case SIG('E','R'): 334 rs.cont_offset = isonum_733(rr->u.CE.offset);
212 ISOFS_SB(inode->i_sb)->s_rock = 1; 335 rs.cont_size = isonum_733(rr->u.CE.size);
213 printk(KERN_DEBUG "ISO 9660 Extensions: "); 336 break;
214 { int p; 337 case SIG('E', 'R'):
215 for(p=0;p<rr->u.ER.len_id;p++) printk("%c",rr->u.ER.data[p]); 338 ISOFS_SB(inode->i_sb)->s_rock = 1;
216 } 339 printk(KERN_DEBUG "ISO 9660 Extensions: ");
217 printk("\n"); 340 {
218 break; 341 int p;
219 case SIG('P','X'): 342 for (p = 0; p < rr->u.ER.len_id; p++)
220 inode->i_mode = isonum_733(rr->u.PX.mode); 343 printk("%c", rr->u.ER.data[p]);
221 inode->i_nlink = isonum_733(rr->u.PX.n_links); 344 }
222 inode->i_uid = isonum_733(rr->u.PX.uid); 345 printk("\n");
223 inode->i_gid = isonum_733(rr->u.PX.gid); 346 break;
224 break; 347 case SIG('P', 'X'):
225 case SIG('P','N'): 348 inode->i_mode = isonum_733(rr->u.PX.mode);
226 { int high, low; 349 inode->i_nlink = isonum_733(rr->u.PX.n_links);
227 high = isonum_733(rr->u.PN.dev_high); 350 inode->i_uid = isonum_733(rr->u.PX.uid);
228 low = isonum_733(rr->u.PN.dev_low); 351 inode->i_gid = isonum_733(rr->u.PX.gid);
229 /* 352 break;
230 * The Rock Ridge standard specifies that if sizeof(dev_t) <= 4, 353 case SIG('P', 'N'):
231 * then the high field is unused, and the device number is completely 354 {
232 * stored in the low field. Some writers may ignore this subtlety, 355 int high, low;
233 * and as a result we test to see if the entire device number is 356 high = isonum_733(rr->u.PN.dev_high);
234 * stored in the low field, and use that. 357 low = isonum_733(rr->u.PN.dev_low);
235 */ 358 /*
236 if((low & ~0xff) && high == 0) { 359 * The Rock Ridge standard specifies that if
237 inode->i_rdev = MKDEV(low >> 8, low & 0xff); 360 * sizeof(dev_t) <= 4, then the high field is
238 } else { 361 * unused, and the device number is completely
239 inode->i_rdev = MKDEV(high, low); 362 * stored in the low field. Some writers may
240 } 363 * ignore this subtlety,
241 } 364 * and as a result we test to see if the entire
242 break; 365 * device number is
243 case SIG('T','F'): 366 * stored in the low field, and use that.
244 /* Some RRIP writers incorrectly place ctime in the TF_CREATE field. 367 */
245 Try to handle this correctly for either case. */ 368 if ((low & ~0xff) && high == 0) {
246 cnt = 0; /* Rock ridge never appears on a High Sierra disk */ 369 inode->i_rdev =
247 if(rr->u.TF.flags & TF_CREATE) { 370 MKDEV(low >> 8, low & 0xff);
248 inode->i_ctime.tv_sec = iso_date(rr->u.TF.times[cnt++].time, 0); 371 } else {
249 inode->i_ctime.tv_nsec = 0; 372 inode->i_rdev =
250 } 373 MKDEV(high, low);
251 if(rr->u.TF.flags & TF_MODIFY) { 374 }
252 inode->i_mtime.tv_sec = iso_date(rr->u.TF.times[cnt++].time, 0); 375 }
253 inode->i_mtime.tv_nsec = 0; 376 break;
254 } 377 case SIG('T', 'F'):
255 if(rr->u.TF.flags & TF_ACCESS) { 378 /*
256 inode->i_atime.tv_sec = iso_date(rr->u.TF.times[cnt++].time, 0); 379 * Some RRIP writers incorrectly place ctime in the
257 inode->i_atime.tv_nsec = 0; 380 * TF_CREATE field. Try to handle this correctly for
258 } 381 * either case.
259 if(rr->u.TF.flags & TF_ATTRIBUTES) { 382 */
260 inode->i_ctime.tv_sec = iso_date(rr->u.TF.times[cnt++].time, 0); 383 /* Rock ridge never appears on a High Sierra disk */
261 inode->i_ctime.tv_nsec = 0; 384 cnt = 0;
262 } 385 if (rr->u.TF.flags & TF_CREATE) {
263 break; 386 inode->i_ctime.tv_sec =
264 case SIG('S','L'): 387 iso_date(rr->u.TF.times[cnt++].time,
265 {int slen; 388 0);
266 struct SL_component * slp; 389 inode->i_ctime.tv_nsec = 0;
267 struct SL_component * oldslp; 390 }
268 slen = rr->len - 5; 391 if (rr->u.TF.flags & TF_MODIFY) {
269 slp = &rr->u.SL.link; 392 inode->i_mtime.tv_sec =
270 inode->i_size = symlink_len; 393 iso_date(rr->u.TF.times[cnt++].time,
271 while (slen > 1){ 394 0);
272 rootflag = 0; 395 inode->i_mtime.tv_nsec = 0;
273 switch(slp->flags &~1){ 396 }
274 case 0: 397 if (rr->u.TF.flags & TF_ACCESS) {
275 inode->i_size += slp->len; 398 inode->i_atime.tv_sec =
276 break; 399 iso_date(rr->u.TF.times[cnt++].time,
277 case 2: 400 0);
278 inode->i_size += 1; 401 inode->i_atime.tv_nsec = 0;
279 break; 402 }
280 case 4: 403 if (rr->u.TF.flags & TF_ATTRIBUTES) {
281 inode->i_size += 2; 404 inode->i_ctime.tv_sec =
282 break; 405 iso_date(rr->u.TF.times[cnt++].time,
283 case 8: 406 0);
284 rootflag = 1; 407 inode->i_ctime.tv_nsec = 0;
285 inode->i_size += 1; 408 }
286 break; 409 break;
287 default: 410 case SIG('S', 'L'):
288 printk("Symlink component flag not implemented\n"); 411 {
289 } 412 int slen;
290 slen -= slp->len + 2; 413 struct SL_component *slp;
291 oldslp = slp; 414 struct SL_component *oldslp;
292 slp = (struct SL_component *) (((char *) slp) + slp->len + 2); 415 slen = rr->len - 5;
293 416 slp = &rr->u.SL.link;
294 if(slen < 2) { 417 inode->i_size = symlink_len;
295 if( ((rr->u.SL.flags & 1) != 0) 418 while (slen > 1) {
296 && ((oldslp->flags & 1) == 0) ) inode->i_size += 1; 419 rootflag = 0;
297 break; 420 switch (slp->flags & ~1) {
298 } 421 case 0:
299 422 inode->i_size +=
300 /* 423 slp->len;
301 * If this component record isn't continued, then append a '/'. 424 break;
302 */ 425 case 2:
303 if (!rootflag && (oldslp->flags & 1) == 0) 426 inode->i_size += 1;
304 inode->i_size += 1; 427 break;
305 } 428 case 4:
306 } 429 inode->i_size += 2;
307 symlink_len = inode->i_size; 430 break;
308 break; 431 case 8:
309 case SIG('R','E'): 432 rootflag = 1;
310 printk(KERN_WARNING "Attempt to read inode for relocated directory\n"); 433 inode->i_size += 1;
311 goto out; 434 break;
312 case SIG('C','L'): 435 default:
313 ISOFS_I(inode)->i_first_extent = isonum_733(rr->u.CL.location); 436 printk("Symlink component flag "
314 reloc = isofs_iget(inode->i_sb, ISOFS_I(inode)->i_first_extent, 0); 437 "not implemented\n");
315 if (!reloc) 438 }
316 goto out; 439 slen -= slp->len + 2;
317 inode->i_mode = reloc->i_mode; 440 oldslp = slp;
318 inode->i_nlink = reloc->i_nlink; 441 slp = (struct SL_component *)
319 inode->i_uid = reloc->i_uid; 442 (((char *)slp) + slp->len + 2);
320 inode->i_gid = reloc->i_gid; 443
321 inode->i_rdev = reloc->i_rdev; 444 if (slen < 2) {
322 inode->i_size = reloc->i_size; 445 if (((rr->u.SL.
323 inode->i_blocks = reloc->i_blocks; 446 flags & 1) != 0)
324 inode->i_atime = reloc->i_atime; 447 &&
325 inode->i_ctime = reloc->i_ctime; 448 ((oldslp->
326 inode->i_mtime = reloc->i_mtime; 449 flags & 1) == 0))
327 iput(reloc); 450 inode->i_size +=
328 break; 451 1;
452 break;
453 }
454
455 /*
456 * If this component record isn't
457 * continued, then append a '/'.
458 */
459 if (!rootflag
460 && (oldslp->flags & 1) == 0)
461 inode->i_size += 1;
462 }
463 }
464 symlink_len = inode->i_size;
465 break;
466 case SIG('R', 'E'):
467 printk(KERN_WARNING "Attempt to read inode for "
468 "relocated directory\n");
469 goto out;
470 case SIG('C', 'L'):
471 ISOFS_I(inode)->i_first_extent =
472 isonum_733(rr->u.CL.location);
473 reloc =
474 isofs_iget(inode->i_sb,
475 ISOFS_I(inode)->i_first_extent,
476 0);
477 if (!reloc)
478 goto out;
479 inode->i_mode = reloc->i_mode;
480 inode->i_nlink = reloc->i_nlink;
481 inode->i_uid = reloc->i_uid;
482 inode->i_gid = reloc->i_gid;
483 inode->i_rdev = reloc->i_rdev;
484 inode->i_size = reloc->i_size;
485 inode->i_blocks = reloc->i_blocks;
486 inode->i_atime = reloc->i_atime;
487 inode->i_ctime = reloc->i_ctime;
488 inode->i_mtime = reloc->i_mtime;
489 iput(reloc);
490 break;
329#ifdef CONFIG_ZISOFS 491#ifdef CONFIG_ZISOFS
330 case SIG('Z','F'): 492 case SIG('Z', 'F'): {
331 if ( !ISOFS_SB(inode->i_sb)->s_nocompress ) { 493 int algo;
332 int algo; 494
333 algo = isonum_721(rr->u.ZF.algorithm); 495 if (ISOFS_SB(inode->i_sb)->s_nocompress)
334 if ( algo == SIG('p','z') ) { 496 break;
335 int block_shift = isonum_711(&rr->u.ZF.parms[1]); 497 algo = isonum_721(rr->u.ZF.algorithm);
336 if ( block_shift < PAGE_CACHE_SHIFT || block_shift > 17 ) { 498 if (algo == SIG('p', 'z')) {
337 printk(KERN_WARNING "isofs: Can't handle ZF block size of 2^%d\n", block_shift); 499 int block_shift =
338 } else { 500 isonum_711(&rr->u.ZF.parms[1]);
339 /* Note: we don't change i_blocks here */ 501 if (block_shift < PAGE_CACHE_SHIFT
340 ISOFS_I(inode)->i_file_format = isofs_file_compressed; 502 || block_shift > 17) {
341 /* Parameters to compression algorithm (header size, block size) */ 503 printk(KERN_WARNING "isofs: "
342 ISOFS_I(inode)->i_format_parm[0] = isonum_711(&rr->u.ZF.parms[0]); 504 "Can't handle ZF block "
343 ISOFS_I(inode)->i_format_parm[1] = isonum_711(&rr->u.ZF.parms[1]); 505 "size of 2^%d\n",
344 inode->i_size = isonum_733(rr->u.ZF.real_size); 506 block_shift);
345 } 507 } else {
346 } else { 508 /*
347 printk(KERN_WARNING "isofs: Unknown ZF compression algorithm: %c%c\n", 509 * Note: we don't change
348 rr->u.ZF.algorithm[0], rr->u.ZF.algorithm[1]); 510 * i_blocks here
349 } 511 */
350 } 512 ISOFS_I(inode)->i_file_format =
351 break; 513 isofs_file_compressed;
514 /*
515 * Parameters to compression
516 * algorithm (header size,
517 * block size)
518 */
519 ISOFS_I(inode)->i_format_parm[0] =
520 isonum_711(&rr->u.ZF.parms[0]);
521 ISOFS_I(inode)->i_format_parm[1] =
522 isonum_711(&rr->u.ZF.parms[1]);
523 inode->i_size =
524 isonum_733(rr->u.ZF.
525 real_size);
526 }
527 } else {
528 printk(KERN_WARNING
529 "isofs: Unknown ZF compression "
530 "algorithm: %c%c\n",
531 rr->u.ZF.algorithm[0],
532 rr->u.ZF.algorithm[1]);
533 }
534 break;
535 }
352#endif 536#endif
353 default: 537 default:
354 break; 538 break;
355 } 539 }
356 } 540 }
357 } 541 ret = rock_continue(&rs);
358 MAYBE_CONTINUE(repeat,inode); 542 if (ret == 0)
359 out: 543 goto repeat;
360 if(buffer) kfree(buffer); 544 if (ret == 1)
361 return 0; 545 ret = 0;
546out:
547 kfree(rs.buffer);
548 return ret;
549eio:
550 ret = -EIO;
551 goto out;
362} 552}
363 553
364static char *get_symlink_chunk(char *rpnt, struct rock_ridge *rr, char *plimit) 554static char *get_symlink_chunk(char *rpnt, struct rock_ridge *rr, char *plimit)
@@ -376,32 +566,32 @@ static char *get_symlink_chunk(char *rpnt, struct rock_ridge *rr, char *plimit)
376 if (slp->len > plimit - rpnt) 566 if (slp->len > plimit - rpnt)
377 return NULL; 567 return NULL;
378 memcpy(rpnt, slp->text, slp->len); 568 memcpy(rpnt, slp->text, slp->len);
379 rpnt+=slp->len; 569 rpnt += slp->len;
380 break; 570 break;
381 case 2: 571 case 2:
382 if (rpnt >= plimit) 572 if (rpnt >= plimit)
383 return NULL; 573 return NULL;
384 *rpnt++='.'; 574 *rpnt++ = '.';
385 break; 575 break;
386 case 4: 576 case 4:
387 if (2 > plimit - rpnt) 577 if (2 > plimit - rpnt)
388 return NULL; 578 return NULL;
389 *rpnt++='.'; 579 *rpnt++ = '.';
390 *rpnt++='.'; 580 *rpnt++ = '.';
391 break; 581 break;
392 case 8: 582 case 8:
393 if (rpnt >= plimit) 583 if (rpnt >= plimit)
394 return NULL; 584 return NULL;
395 rootflag = 1; 585 rootflag = 1;
396 *rpnt++='/'; 586 *rpnt++ = '/';
397 break; 587 break;
398 default: 588 default:
399 printk("Symlink component flag not implemented (%d)\n", 589 printk("Symlink component flag not implemented (%d)\n",
400 slp->flags); 590 slp->flags);
401 } 591 }
402 slen -= slp->len + 2; 592 slen -= slp->len + 2;
403 oldslp = slp; 593 oldslp = slp;
404 slp = (struct SL_component *) ((char *) slp + slp->len + 2); 594 slp = (struct SL_component *)((char *)slp + slp->len + 2);
405 595
406 if (slen < 2) { 596 if (slen < 2) {
407 /* 597 /*
@@ -412,7 +602,7 @@ static char *get_symlink_chunk(char *rpnt, struct rock_ridge *rr, char *plimit)
412 !(oldslp->flags & 1)) { 602 !(oldslp->flags & 1)) {
413 if (rpnt >= plimit) 603 if (rpnt >= plimit)
414 return NULL; 604 return NULL;
415 *rpnt++='/'; 605 *rpnt++ = '/';
416 } 606 }
417 break; 607 break;
418 } 608 }
@@ -423,59 +613,61 @@ static char *get_symlink_chunk(char *rpnt, struct rock_ridge *rr, char *plimit)
423 if (!rootflag && !(oldslp->flags & 1)) { 613 if (!rootflag && !(oldslp->flags & 1)) {
424 if (rpnt >= plimit) 614 if (rpnt >= plimit)
425 return NULL; 615 return NULL;
426 *rpnt++='/'; 616 *rpnt++ = '/';
427 } 617 }
428 } 618 }
429 return rpnt; 619 return rpnt;
430} 620}
431 621
432int parse_rock_ridge_inode(struct iso_directory_record * de, 622int parse_rock_ridge_inode(struct iso_directory_record *de, struct inode *inode)
433 struct inode * inode)
434{ 623{
435 int result=parse_rock_ridge_inode_internal(de,inode,0); 624 int result = parse_rock_ridge_inode_internal(de, inode, 0);
436 /* if rockridge flag was reset and we didn't look for attributes
437 * behind eventual XA attributes, have a look there */
438 if ((ISOFS_SB(inode->i_sb)->s_rock_offset==-1)
439 &&(ISOFS_SB(inode->i_sb)->s_rock==2))
440 {
441 result=parse_rock_ridge_inode_internal(de,inode,14);
442 }
443 return result;
444}
445 625
446/* readpage() for symlinks: reads symlink contents into the page and either 626 /*
447 makes it uptodate and returns 0 or returns error (-EIO) */ 627 * if rockridge flag was reset and we didn't look for attributes
628 * behind eventual XA attributes, have a look there
629 */
630 if ((ISOFS_SB(inode->i_sb)->s_rock_offset == -1)
631 && (ISOFS_SB(inode->i_sb)->s_rock == 2)) {
632 result = parse_rock_ridge_inode_internal(de, inode, 14);
633 }
634 return result;
635}
448 636
637/*
638 * readpage() for symlinks: reads symlink contents into the page and either
639 * makes it uptodate and returns 0 or returns error (-EIO)
640 */
449static int rock_ridge_symlink_readpage(struct file *file, struct page *page) 641static int rock_ridge_symlink_readpage(struct file *file, struct page *page)
450{ 642{
451 struct inode *inode = page->mapping->host; 643 struct inode *inode = page->mapping->host;
452 struct iso_inode_info *ei = ISOFS_I(inode); 644 struct iso_inode_info *ei = ISOFS_I(inode);
453 char *link = kmap(page); 645 char *link = kmap(page);
454 unsigned long bufsize = ISOFS_BUFFER_SIZE(inode); 646 unsigned long bufsize = ISOFS_BUFFER_SIZE(inode);
455 struct buffer_head *bh; 647 struct buffer_head *bh;
456 char *rpnt = link; 648 char *rpnt = link;
457 unsigned char *pnt; 649 unsigned char *pnt;
458 struct iso_directory_record *raw_inode; 650 struct iso_directory_record *raw_de;
459 CONTINUE_DECLS;
460 unsigned long block, offset; 651 unsigned long block, offset;
461 int sig; 652 int sig;
462 int len;
463 unsigned char *chr;
464 struct rock_ridge *rr; 653 struct rock_ridge *rr;
654 struct rock_state rs;
655 int ret;
465 656
466 if (!ISOFS_SB(inode->i_sb)->s_rock) 657 if (!ISOFS_SB(inode->i_sb)->s_rock)
467 goto error; 658 goto error;
468 659
660 init_rock_state(&rs, inode);
469 block = ei->i_iget5_block; 661 block = ei->i_iget5_block;
470 lock_kernel(); 662 lock_kernel();
471 bh = sb_bread(inode->i_sb, block); 663 bh = sb_bread(inode->i_sb, block);
472 if (!bh) 664 if (!bh)
473 goto out_noread; 665 goto out_noread;
474 666
475 offset = ei->i_iget5_offset; 667 offset = ei->i_iget5_offset;
476 pnt = (unsigned char *) bh->b_data + offset; 668 pnt = (unsigned char *)bh->b_data + offset;
477 669
478 raw_inode = (struct iso_directory_record *) pnt; 670 raw_de = (struct iso_directory_record *)pnt;
479 671
480 /* 672 /*
481 * If we go past the end of the buffer, there is some sort of error. 673 * If we go past the end of the buffer, there is some sort of error.
@@ -483,20 +675,24 @@ static int rock_ridge_symlink_readpage(struct file *file, struct page *page)
483 if (offset + *pnt > bufsize) 675 if (offset + *pnt > bufsize)
484 goto out_bad_span; 676 goto out_bad_span;
485 677
486 /* Now test for possible Rock Ridge extensions which will override 678 /*
487 some of these numbers in the inode structure. */ 679 * Now test for possible Rock Ridge extensions which will override
680 * some of these numbers in the inode structure.
681 */
488 682
489 SETUP_ROCK_RIDGE(raw_inode, chr, len); 683 setup_rock_ridge(raw_de, inode, &rs);
490 684
491 repeat: 685repeat:
492 while (len > 2) { /* There may be one byte for padding somewhere */ 686 while (rs.len > 2) { /* There may be one byte for padding somewhere */
493 rr = (struct rock_ridge *) chr; 687 rr = (struct rock_ridge *)rs.chr;
494 if (rr->len < 3) 688 if (rr->len < 3)
495 goto out; /* Something got screwed up here */ 689 goto out; /* Something got screwed up here */
496 sig = isonum_721(chr); 690 sig = isonum_721(rs.chr);
497 chr += rr->len; 691 if (rock_check_overflow(&rs, sig))
498 len -= rr->len; 692 goto out;
499 if (len < 0) 693 rs.chr += rr->len;
694 rs.len -= rr->len;
695 if (rs.len < 0)
500 goto out; /* corrupted isofs */ 696 goto out; /* corrupted isofs */
501 697
502 switch (sig) { 698 switch (sig) {
@@ -505,7 +701,8 @@ static int rock_ridge_symlink_readpage(struct file *file, struct page *page)
505 goto out; 701 goto out;
506 break; 702 break;
507 case SIG('S', 'P'): 703 case SIG('S', 'P'):
508 CHECK_SP(goto out); 704 if (check_sp(rr, inode))
705 goto out;
509 break; 706 break;
510 case SIG('S', 'L'): 707 case SIG('S', 'L'):
511 rpnt = get_symlink_chunk(rpnt, rr, 708 rpnt = get_symlink_chunk(rpnt, rr,
@@ -515,14 +712,18 @@ static int rock_ridge_symlink_readpage(struct file *file, struct page *page)
515 break; 712 break;
516 case SIG('C', 'E'): 713 case SIG('C', 'E'):
517 /* This tells is if there is a continuation record */ 714 /* This tells is if there is a continuation record */
518 CHECK_CE; 715 rs.cont_extent = isonum_733(rr->u.CE.extent);
716 rs.cont_offset = isonum_733(rr->u.CE.offset);
717 rs.cont_size = isonum_733(rr->u.CE.size);
519 default: 718 default:
520 break; 719 break;
521 } 720 }
522 } 721 }
523 MAYBE_CONTINUE(repeat, inode); 722 ret = rock_continue(&rs);
524 if (buffer) 723 if (ret == 0)
525 kfree(buffer); 724 goto repeat;
725 if (ret < 0)
726 goto fail;
526 727
527 if (rpnt == link) 728 if (rpnt == link)
528 goto fail; 729 goto fail;
@@ -535,19 +736,18 @@ static int rock_ridge_symlink_readpage(struct file *file, struct page *page)
535 return 0; 736 return 0;
536 737
537 /* error exit from macro */ 738 /* error exit from macro */
538 out: 739out:
539 if (buffer) 740 kfree(rs.buffer);
540 kfree(buffer);
541 goto fail; 741 goto fail;
542 out_noread: 742out_noread:
543 printk("unable to read i-node block"); 743 printk("unable to read i-node block");
544 goto fail; 744 goto fail;
545 out_bad_span: 745out_bad_span:
546 printk("symlink spans iso9660 blocks\n"); 746 printk("symlink spans iso9660 blocks\n");
547 fail: 747fail:
548 brelse(bh); 748 brelse(bh);
549 unlock_kernel(); 749 unlock_kernel();
550 error: 750error:
551 SetPageError(page); 751 SetPageError(page);
552 kunmap(page); 752 kunmap(page);
553 unlock_page(page); 753 unlock_page(page);
@@ -555,5 +755,5 @@ static int rock_ridge_symlink_readpage(struct file *file, struct page *page)
555} 755}
556 756
557struct address_space_operations isofs_symlink_aops = { 757struct address_space_operations isofs_symlink_aops = {
558 .readpage = rock_ridge_symlink_readpage 758 .readpage = rock_ridge_symlink_readpage
559}; 759};
diff --git a/fs/isofs/rock.h b/fs/isofs/rock.h
index deaf5c8e8b4a..ed09e2b08637 100644
--- a/fs/isofs/rock.h
+++ b/fs/isofs/rock.h
@@ -1,85 +1,88 @@
1/* These structs are used by the system-use-sharing protocol, in which the 1/*
2 Rock Ridge extensions are embedded. It is quite possible that other 2 * These structs are used by the system-use-sharing protocol, in which the
3 extensions are present on the disk, and this is fine as long as they 3 * Rock Ridge extensions are embedded. It is quite possible that other
4 all use SUSP */ 4 * extensions are present on the disk, and this is fine as long as they
5 5 * all use SUSP
6struct SU_SP{ 6 */
7 unsigned char magic[2]; 7
8 unsigned char skip; 8struct SU_SP_s {
9} __attribute__((packed)); 9 unsigned char magic[2];
10 10 unsigned char skip;
11struct SU_CE{ 11} __attribute__ ((packed));
12 char extent[8]; 12
13 char offset[8]; 13struct SU_CE_s {
14 char size[8]; 14 char extent[8];
15 char offset[8];
16 char size[8];
15}; 17};
16 18
17struct SU_ER{ 19struct SU_ER_s {
18 unsigned char len_id; 20 unsigned char len_id;
19 unsigned char len_des; 21 unsigned char len_des;
20 unsigned char len_src; 22 unsigned char len_src;
21 unsigned char ext_ver; 23 unsigned char ext_ver;
22 char data[0]; 24 char data[0];
23} __attribute__((packed)); 25} __attribute__ ((packed));
24 26
25struct RR_RR{ 27struct RR_RR_s {
26 char flags[1]; 28 char flags[1];
27} __attribute__((packed)); 29} __attribute__ ((packed));
28 30
29struct RR_PX{ 31struct RR_PX_s {
30 char mode[8]; 32 char mode[8];
31 char n_links[8]; 33 char n_links[8];
32 char uid[8]; 34 char uid[8];
33 char gid[8]; 35 char gid[8];
34}; 36};
35 37
36struct RR_PN{ 38struct RR_PN_s {
37 char dev_high[8]; 39 char dev_high[8];
38 char dev_low[8]; 40 char dev_low[8];
39}; 41};
40 42
43struct SL_component {
44 unsigned char flags;
45 unsigned char len;
46 char text[0];
47} __attribute__ ((packed));
41 48
42struct SL_component{ 49struct RR_SL_s {
43 unsigned char flags; 50 unsigned char flags;
44 unsigned char len; 51 struct SL_component link;
45 char text[0]; 52} __attribute__ ((packed));
46} __attribute__((packed));
47 53
48struct RR_SL{ 54struct RR_NM_s {
49 unsigned char flags; 55 unsigned char flags;
50 struct SL_component link; 56 char name[0];
51} __attribute__((packed)); 57} __attribute__ ((packed));
52 58
53struct RR_NM{ 59struct RR_CL_s {
54 unsigned char flags; 60 char location[8];
55 char name[0];
56} __attribute__((packed));
57
58struct RR_CL{
59 char location[8];
60}; 61};
61 62
62struct RR_PL{ 63struct RR_PL_s {
63 char location[8]; 64 char location[8];
64}; 65};
65 66
66struct stamp{ 67struct stamp {
67 char time[7]; 68 char time[7];
68} __attribute__((packed)); 69} __attribute__ ((packed));
69 70
70struct RR_TF{ 71struct RR_TF_s {
71 char flags; 72 char flags;
72 struct stamp times[0]; /* Variable number of these beasts */ 73 struct stamp times[0]; /* Variable number of these beasts */
73} __attribute__((packed)); 74} __attribute__ ((packed));
74 75
75/* Linux-specific extension for transparent decompression */ 76/* Linux-specific extension for transparent decompression */
76struct RR_ZF{ 77struct RR_ZF_s {
77 char algorithm[2]; 78 char algorithm[2];
78 char parms[2]; 79 char parms[2];
79 char real_size[8]; 80 char real_size[8];
80}; 81};
81 82
82/* These are the bits and their meanings for flags in the TF structure. */ 83/*
84 * These are the bits and their meanings for flags in the TF structure.
85 */
83#define TF_CREATE 1 86#define TF_CREATE 1
84#define TF_MODIFY 2 87#define TF_MODIFY 2
85#define TF_ACCESS 4 88#define TF_ACCESS 4
@@ -89,31 +92,31 @@ struct RR_ZF{
89#define TF_EFFECTIVE 64 92#define TF_EFFECTIVE 64
90#define TF_LONG_FORM 128 93#define TF_LONG_FORM 128
91 94
92struct rock_ridge{ 95struct rock_ridge {
93 char signature[2]; 96 char signature[2];
94 unsigned char len; 97 unsigned char len;
95 unsigned char version; 98 unsigned char version;
96 union{ 99 union {
97 struct SU_SP SP; 100 struct SU_SP_s SP;
98 struct SU_CE CE; 101 struct SU_CE_s CE;
99 struct SU_ER ER; 102 struct SU_ER_s ER;
100 struct RR_RR RR; 103 struct RR_RR_s RR;
101 struct RR_PX PX; 104 struct RR_PX_s PX;
102 struct RR_PN PN; 105 struct RR_PN_s PN;
103 struct RR_SL SL; 106 struct RR_SL_s SL;
104 struct RR_NM NM; 107 struct RR_NM_s NM;
105 struct RR_CL CL; 108 struct RR_CL_s CL;
106 struct RR_PL PL; 109 struct RR_PL_s PL;
107 struct RR_TF TF; 110 struct RR_TF_s TF;
108 struct RR_ZF ZF; 111 struct RR_ZF_s ZF;
109 } u; 112 } u;
110}; 113};
111 114
112#define RR_PX 1 /* POSIX attributes */ 115#define RR_PX 1 /* POSIX attributes */
113#define RR_PN 2 /* POSIX devices */ 116#define RR_PN 2 /* POSIX devices */
114#define RR_SL 4 /* Symbolic link */ 117#define RR_SL 4 /* Symbolic link */
115#define RR_NM 8 /* Alternate Name */ 118#define RR_NM 8 /* Alternate Name */
116#define RR_CL 16 /* Child link */ 119#define RR_CL 16 /* Child link */
117#define RR_PL 32 /* Parent link */ 120#define RR_PL 32 /* Parent link */
118#define RR_RE 64 /* Relocation directory */ 121#define RR_RE 64 /* Relocation directory */
119#define RR_TF 128 /* Timestamps */ 122#define RR_TF 128 /* Timestamps */
diff --git a/fs/jfs/acl.c b/fs/jfs/acl.c
index 8d2a9ab981d4..30a2bf9eeda5 100644
--- a/fs/jfs/acl.c
+++ b/fs/jfs/acl.c
@@ -70,8 +70,7 @@ static struct posix_acl *jfs_get_acl(struct inode *inode, int type)
70 if (!IS_ERR(acl)) 70 if (!IS_ERR(acl))
71 *p_acl = posix_acl_dup(acl); 71 *p_acl = posix_acl_dup(acl);
72 } 72 }
73 if (value) 73 kfree(value);
74 kfree(value);
75 return acl; 74 return acl;
76} 75}
77 76
@@ -112,8 +111,7 @@ static int jfs_set_acl(struct inode *inode, int type, struct posix_acl *acl)
112 } 111 }
113 rc = __jfs_setxattr(inode, ea_name, value, size, 0); 112 rc = __jfs_setxattr(inode, ea_name, value, size, 0);
114out: 113out:
115 if (value) 114 kfree(value);
116 kfree(value);
117 115
118 if (!rc) { 116 if (!rc) {
119 if (*p_acl && (*p_acl != JFS_ACL_NOT_CACHED)) 117 if (*p_acl && (*p_acl != JFS_ACL_NOT_CACHED))
diff --git a/fs/jfs/file.c b/fs/jfs/file.c
index a87b06fa8ff8..c2c19c9ed9a4 100644
--- a/fs/jfs/file.c
+++ b/fs/jfs/file.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (c) International Business Machines Corp., 2000-2002 2 * Copyright (C) International Business Machines Corp., 2000-2002
3 * Portions Copyright (c) Christoph Hellwig, 2001-2002 3 * Portions Copyright (C) Christoph Hellwig, 2001-2002
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 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 6 * it under the terms of the GNU General Public License as published by
@@ -19,16 +19,13 @@
19 19
20#include <linux/fs.h> 20#include <linux/fs.h>
21#include "jfs_incore.h" 21#include "jfs_incore.h"
22#include "jfs_inode.h"
22#include "jfs_dmap.h" 23#include "jfs_dmap.h"
23#include "jfs_txnmgr.h" 24#include "jfs_txnmgr.h"
24#include "jfs_xattr.h" 25#include "jfs_xattr.h"
25#include "jfs_acl.h" 26#include "jfs_acl.h"
26#include "jfs_debug.h" 27#include "jfs_debug.h"
27 28
28
29extern int jfs_commit_inode(struct inode *, int);
30extern void jfs_truncate(struct inode *);
31
32int jfs_fsync(struct file *file, struct dentry *dentry, int datasync) 29int jfs_fsync(struct file *file, struct dentry *dentry, int datasync)
33{ 30{
34 struct inode *inode = dentry->d_inode; 31 struct inode *inode = dentry->d_inode;
diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c
index 24a689179af2..2137138c59b0 100644
--- a/fs/jfs/inode.c
+++ b/fs/jfs/inode.c
@@ -23,6 +23,7 @@
23#include <linux/pagemap.h> 23#include <linux/pagemap.h>
24#include <linux/quotaops.h> 24#include <linux/quotaops.h>
25#include "jfs_incore.h" 25#include "jfs_incore.h"
26#include "jfs_inode.h"
26#include "jfs_filsys.h" 27#include "jfs_filsys.h"
27#include "jfs_imap.h" 28#include "jfs_imap.h"
28#include "jfs_extent.h" 29#include "jfs_extent.h"
@@ -30,14 +31,6 @@
30#include "jfs_debug.h" 31#include "jfs_debug.h"
31 32
32 33
33extern struct inode_operations jfs_dir_inode_operations;
34extern struct inode_operations jfs_file_inode_operations;
35extern struct inode_operations jfs_symlink_inode_operations;
36extern struct file_operations jfs_dir_operations;
37extern struct file_operations jfs_file_operations;
38struct address_space_operations jfs_aops;
39extern int freeZeroLink(struct inode *);
40
41void jfs_read_inode(struct inode *inode) 34void jfs_read_inode(struct inode *inode)
42{ 35{
43 if (diRead(inode)) { 36 if (diRead(inode)) {
@@ -136,7 +129,7 @@ void jfs_delete_inode(struct inode *inode)
136 jfs_info("In jfs_delete_inode, inode = 0x%p", inode); 129 jfs_info("In jfs_delete_inode, inode = 0x%p", inode);
137 130
138 if (test_cflag(COMMIT_Freewmap, inode)) 131 if (test_cflag(COMMIT_Freewmap, inode))
139 freeZeroLink(inode); 132 jfs_free_zero_link(inode);
140 133
141 diFree(inode); 134 diFree(inode);
142 135
diff --git a/fs/jfs/jfs_debug.c b/fs/jfs/jfs_debug.c
index 91a0a889ebc5..4caea6b43b92 100644
--- a/fs/jfs/jfs_debug.c
+++ b/fs/jfs/jfs_debug.c
@@ -58,8 +58,6 @@ void dump_mem(char *label, void *data, int length)
58 58
59static struct proc_dir_entry *base; 59static struct proc_dir_entry *base;
60#ifdef CONFIG_JFS_DEBUG 60#ifdef CONFIG_JFS_DEBUG
61extern read_proc_t jfs_txanchor_read;
62
63static int loglevel_read(char *page, char **start, off_t off, 61static int loglevel_read(char *page, char **start, off_t off,
64 int count, int *eof, void *data) 62 int count, int *eof, void *data)
65{ 63{
@@ -97,14 +95,6 @@ static int loglevel_write(struct file *file, const char __user *buffer,
97} 95}
98#endif 96#endif
99 97
100
101#ifdef CONFIG_JFS_STATISTICS
102extern read_proc_t jfs_lmstats_read;
103extern read_proc_t jfs_txstats_read;
104extern read_proc_t jfs_xtstat_read;
105extern read_proc_t jfs_mpstat_read;
106#endif
107
108static struct { 98static struct {
109 const char *name; 99 const char *name;
110 read_proc_t *read_fn; 100 read_proc_t *read_fn;
diff --git a/fs/jfs/jfs_debug.h b/fs/jfs/jfs_debug.h
index a38079ae1e00..ddffbbd4d955 100644
--- a/fs/jfs/jfs_debug.h
+++ b/fs/jfs/jfs_debug.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (c) International Business Machines Corp., 2000-2002 2 * Copyright (C) International Business Machines Corp., 2000-2002
3 * Portions Copyright (c) Christoph Hellwig, 2001-2002 3 * Portions Copyright (C) Christoph Hellwig, 2001-2002
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 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 6 * it under the terms of the GNU General Public License as published by
@@ -31,7 +31,9 @@
31 * CONFIG_JFS_DEBUG or CONFIG_JFS_STATISTICS is defined 31 * CONFIG_JFS_DEBUG or CONFIG_JFS_STATISTICS is defined
32 */ 32 */
33#if defined(CONFIG_PROC_FS) && (defined(CONFIG_JFS_DEBUG) || defined(CONFIG_JFS_STATISTICS)) 33#if defined(CONFIG_PROC_FS) && (defined(CONFIG_JFS_DEBUG) || defined(CONFIG_JFS_STATISTICS))
34 #define PROC_FS_JFS 34#define PROC_FS_JFS
35extern void jfs_proc_init(void);
36extern void jfs_proc_clean(void);
35#endif 37#endif
36 38
37/* 39/*
@@ -65,8 +67,8 @@
65 67
66extern int jfsloglevel; 68extern int jfsloglevel;
67 69
68/* dump memory contents */
69extern void dump_mem(char *label, void *data, int length); 70extern void dump_mem(char *label, void *data, int length);
71extern int jfs_txanchor_read(char *, char **, off_t, int, int *, void *);
70 72
71/* information message: e.g., configuration, major event */ 73/* information message: e.g., configuration, major event */
72#define jfs_info(fmt, arg...) do { \ 74#define jfs_info(fmt, arg...) do { \
@@ -110,6 +112,11 @@ extern void dump_mem(char *label, void *data, int length);
110 * ---------- 112 * ----------
111 */ 113 */
112#ifdef CONFIG_JFS_STATISTICS 114#ifdef CONFIG_JFS_STATISTICS
115extern int jfs_lmstats_read(char *, char **, off_t, int, int *, void *);
116extern int jfs_txstats_read(char *, char **, off_t, int, int *, void *);
117extern int jfs_mpstat_read(char *, char **, off_t, int, int *, void *);
118extern int jfs_xtstat_read(char *, char **, off_t, int, int *, void *);
119
113#define INCREMENT(x) ((x)++) 120#define INCREMENT(x) ((x)++)
114#define DECREMENT(x) ((x)--) 121#define DECREMENT(x) ((x)--)
115#define HIGHWATERMARK(x,y) ((x) = max((x), (y))) 122#define HIGHWATERMARK(x,y) ((x) = max((x), (y)))
diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
index 69007fd546ef..cced2fed9d0f 100644
--- a/fs/jfs/jfs_dmap.c
+++ b/fs/jfs/jfs_dmap.c
@@ -272,7 +272,6 @@ int dbMount(struct inode *ipbmap)
272int dbUnmount(struct inode *ipbmap, int mounterror) 272int dbUnmount(struct inode *ipbmap, int mounterror)
273{ 273{
274 struct bmap *bmp = JFS_SBI(ipbmap->i_sb)->bmap; 274 struct bmap *bmp = JFS_SBI(ipbmap->i_sb)->bmap;
275 int i;
276 275
277 if (!(mounterror || isReadOnly(ipbmap))) 276 if (!(mounterror || isReadOnly(ipbmap)))
278 dbSync(ipbmap); 277 dbSync(ipbmap);
@@ -282,14 +281,6 @@ int dbUnmount(struct inode *ipbmap, int mounterror)
282 */ 281 */
283 truncate_inode_pages(ipbmap->i_mapping, 0); 282 truncate_inode_pages(ipbmap->i_mapping, 0);
284 283
285 /*
286 * Sanity Check
287 */
288 for (i = 0; i < bmp->db_numag; i++)
289 if (atomic_read(&bmp->db_active[i]))
290 printk(KERN_ERR "dbUnmount: db_active[%d] = %d\n",
291 i, atomic_read(&bmp->db_active[i]));
292
293 /* free the memory for the in-memory bmap. */ 284 /* free the memory for the in-memory bmap. */
294 kfree(bmp); 285 kfree(bmp);
295 286
diff --git a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c
index ac41f72d6d50..8676aee3ae48 100644
--- a/fs/jfs/jfs_dtree.c
+++ b/fs/jfs/jfs_dtree.c
@@ -2931,6 +2931,9 @@ static void add_missing_indices(struct inode *inode, s64 bn)
2931 ASSERT(p->header.flag & BT_LEAF); 2931 ASSERT(p->header.flag & BT_LEAF);
2932 2932
2933 tlck = txLock(tid, inode, mp, tlckDTREE | tlckENTRY); 2933 tlck = txLock(tid, inode, mp, tlckDTREE | tlckENTRY);
2934 if (BT_IS_ROOT(mp))
2935 tlck->type |= tlckBTROOT;
2936
2934 dtlck = (struct dt_lock *) &tlck->lock; 2937 dtlck = (struct dt_lock *) &tlck->lock;
2935 2938
2936 stbl = DT_GETSTBL(p); 2939 stbl = DT_GETSTBL(p);
diff --git a/fs/jfs/jfs_extent.c b/fs/jfs/jfs_extent.c
index 1953acb79266..4879603daa1c 100644
--- a/fs/jfs/jfs_extent.c
+++ b/fs/jfs/jfs_extent.c
@@ -19,6 +19,7 @@
19#include <linux/fs.h> 19#include <linux/fs.h>
20#include <linux/quotaops.h> 20#include <linux/quotaops.h>
21#include "jfs_incore.h" 21#include "jfs_incore.h"
22#include "jfs_inode.h"
22#include "jfs_superblock.h" 23#include "jfs_superblock.h"
23#include "jfs_dmap.h" 24#include "jfs_dmap.h"
24#include "jfs_extent.h" 25#include "jfs_extent.h"
@@ -33,12 +34,6 @@ static int extBrealloc(struct inode *, s64, s64, s64 *, s64 *);
33#endif 34#endif
34static s64 extRoundDown(s64 nb); 35static s64 extRoundDown(s64 nb);
35 36
36/*
37 * external references
38 */
39extern int jfs_commit_inode(struct inode *, int);
40
41
42#define DPD(a) (printk("(a): %d\n",(a))) 37#define DPD(a) (printk("(a): %d\n",(a)))
43#define DPC(a) (printk("(a): %c\n",(a))) 38#define DPC(a) (printk("(a): %c\n",(a)))
44#define DPL1(a) \ 39#define DPL1(a) \
diff --git a/fs/jfs/jfs_imap.c b/fs/jfs/jfs_imap.c
index 7acff2ce3c80..971af2977eff 100644
--- a/fs/jfs/jfs_imap.c
+++ b/fs/jfs/jfs_imap.c
@@ -47,6 +47,7 @@
47#include <linux/quotaops.h> 47#include <linux/quotaops.h>
48 48
49#include "jfs_incore.h" 49#include "jfs_incore.h"
50#include "jfs_inode.h"
50#include "jfs_filsys.h" 51#include "jfs_filsys.h"
51#include "jfs_dinode.h" 52#include "jfs_dinode.h"
52#include "jfs_dmap.h" 53#include "jfs_dmap.h"
@@ -69,11 +70,6 @@
69#define AG_UNLOCK(imap,agno) up(&imap->im_aglock[agno]) 70#define AG_UNLOCK(imap,agno) up(&imap->im_aglock[agno])
70 71
71/* 72/*
72 * external references
73 */
74extern struct address_space_operations jfs_aops;
75
76/*
77 * forward references 73 * forward references
78 */ 74 */
79static int diAllocAG(struct inomap *, int, boolean_t, struct inode *); 75static int diAllocAG(struct inomap *, int, boolean_t, struct inode *);
diff --git a/fs/jfs/jfs_inode.c b/fs/jfs/jfs_inode.c
index 84f2459b2191..2af5efbfd06f 100644
--- a/fs/jfs/jfs_inode.c
+++ b/fs/jfs/jfs_inode.c
@@ -19,6 +19,7 @@
19#include <linux/fs.h> 19#include <linux/fs.h>
20#include <linux/quotaops.h> 20#include <linux/quotaops.h>
21#include "jfs_incore.h" 21#include "jfs_incore.h"
22#include "jfs_inode.h"
22#include "jfs_filsys.h" 23#include "jfs_filsys.h"
23#include "jfs_imap.h" 24#include "jfs_imap.h"
24#include "jfs_dinode.h" 25#include "jfs_dinode.h"
diff --git a/fs/jfs/jfs_inode.h b/fs/jfs/jfs_inode.h
index 3df91fbfe781..b54bac576cb3 100644
--- a/fs/jfs/jfs_inode.h
+++ b/fs/jfs/jfs_inode.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) International Business Machines Corp., 2000-2001 2 * Copyright (C) International Business Machines Corp., 2000-2001
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 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 5 * it under the terms of the GNU General Public License as published by
@@ -19,5 +19,22 @@
19#define _H_JFS_INODE 19#define _H_JFS_INODE
20 20
21extern struct inode *ialloc(struct inode *, umode_t); 21extern struct inode *ialloc(struct inode *, umode_t);
22extern int jfs_fsync(struct file *, struct dentry *, int);
23extern void jfs_read_inode(struct inode *);
24extern int jfs_commit_inode(struct inode *, int);
25extern int jfs_write_inode(struct inode*, int);
26extern void jfs_delete_inode(struct inode *);
27extern void jfs_dirty_inode(struct inode *);
28extern void jfs_truncate(struct inode *);
29extern void jfs_truncate_nolock(struct inode *, loff_t);
30extern void jfs_free_zero_link(struct inode *);
31extern struct dentry *jfs_get_parent(struct dentry *dentry);
22 32
33extern struct address_space_operations jfs_aops;
34extern struct inode_operations jfs_dir_inode_operations;
35extern struct file_operations jfs_dir_operations;
36extern struct inode_operations jfs_file_inode_operations;
37extern struct file_operations jfs_file_operations;
38extern struct inode_operations jfs_symlink_inode_operations;
39extern struct dentry_operations jfs_ci_dentry_operations;
23#endif /* _H_JFS_INODE */ 40#endif /* _H_JFS_INODE */
diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c
index dfa1200daa61..7c8387ed4192 100644
--- a/fs/jfs/jfs_logmgr.c
+++ b/fs/jfs/jfs_logmgr.c
@@ -71,6 +71,7 @@
71#include "jfs_incore.h" 71#include "jfs_incore.h"
72#include "jfs_filsys.h" 72#include "jfs_filsys.h"
73#include "jfs_metapage.h" 73#include "jfs_metapage.h"
74#include "jfs_superblock.h"
74#include "jfs_txnmgr.h" 75#include "jfs_txnmgr.h"
75#include "jfs_debug.h" 76#include "jfs_debug.h"
76 77
@@ -167,14 +168,6 @@ static struct jfs_log *dummy_log = NULL;
167static DECLARE_MUTEX(jfs_log_sem); 168static DECLARE_MUTEX(jfs_log_sem);
168 169
169/* 170/*
170 * external references
171 */
172extern void txLazyUnlock(struct tblock * tblk);
173extern int jfs_stop_threads;
174extern struct completion jfsIOwait;
175extern int jfs_tlocks_low;
176
177/*
178 * forward references 171 * forward references
179 */ 172 */
180static int lmWriteRecord(struct jfs_log * log, struct tblock * tblk, 173static int lmWriteRecord(struct jfs_log * log, struct tblock * tblk,
@@ -1624,6 +1617,8 @@ void jfs_flush_journal(struct jfs_log *log, int wait)
1624 } 1617 }
1625 } 1618 }
1626 assert(list_empty(&log->cqueue)); 1619 assert(list_empty(&log->cqueue));
1620
1621#ifdef CONFIG_JFS_DEBUG
1627 if (!list_empty(&log->synclist)) { 1622 if (!list_empty(&log->synclist)) {
1628 struct logsyncblk *lp; 1623 struct logsyncblk *lp;
1629 1624
@@ -1638,9 +1633,8 @@ void jfs_flush_journal(struct jfs_log *log, int wait)
1638 dump_mem("orphan tblock", lp, 1633 dump_mem("orphan tblock", lp,
1639 sizeof(struct tblock)); 1634 sizeof(struct tblock));
1640 } 1635 }
1641// current->state = TASK_INTERRUPTIBLE;
1642// schedule();
1643 } 1636 }
1637#endif
1644 //assert(list_empty(&log->synclist)); 1638 //assert(list_empty(&log->synclist));
1645 clear_bit(log_FLUSH, &log->flag); 1639 clear_bit(log_FLUSH, &log->flag);
1646} 1640}
diff --git a/fs/jfs/jfs_logmgr.h b/fs/jfs/jfs_logmgr.h
index 51291fbc420c..747114cd38b8 100644
--- a/fs/jfs/jfs_logmgr.h
+++ b/fs/jfs/jfs_logmgr.h
@@ -507,6 +507,8 @@ extern int lmLogClose(struct super_block *sb);
507extern int lmLogShutdown(struct jfs_log * log); 507extern int lmLogShutdown(struct jfs_log * log);
508extern int lmLogInit(struct jfs_log * log); 508extern int lmLogInit(struct jfs_log * log);
509extern int lmLogFormat(struct jfs_log *log, s64 logAddress, int logSize); 509extern int lmLogFormat(struct jfs_log *log, s64 logAddress, int logSize);
510extern int lmGroupCommit(struct jfs_log *, struct tblock *);
511extern int jfsIOWait(void *);
510extern void jfs_flush_journal(struct jfs_log * log, int wait); 512extern void jfs_flush_journal(struct jfs_log * log, int wait);
511extern void jfs_syncpt(struct jfs_log *log); 513extern void jfs_syncpt(struct jfs_log *log);
512 514
diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c
index 41bf078dce05..6c5485d16c39 100644
--- a/fs/jfs/jfs_metapage.c
+++ b/fs/jfs/jfs_metapage.c
@@ -198,7 +198,7 @@ static void init_once(void *foo, kmem_cache_t *cachep, unsigned long flags)
198 } 198 }
199} 199}
200 200
201static inline struct metapage *alloc_metapage(int gfp_mask) 201static inline struct metapage *alloc_metapage(unsigned int gfp_mask)
202{ 202{
203 return mempool_alloc(metapage_mempool, gfp_mask); 203 return mempool_alloc(metapage_mempool, gfp_mask);
204} 204}
@@ -726,12 +726,12 @@ void force_metapage(struct metapage *mp)
726 page_cache_release(page); 726 page_cache_release(page);
727} 727}
728 728
729extern void hold_metapage(struct metapage *mp) 729void hold_metapage(struct metapage *mp)
730{ 730{
731 lock_page(mp->page); 731 lock_page(mp->page);
732} 732}
733 733
734extern void put_metapage(struct metapage *mp) 734void put_metapage(struct metapage *mp)
735{ 735{
736 if (mp->count || mp->nohomeok) { 736 if (mp->count || mp->nohomeok) {
737 /* Someone else will release this */ 737 /* Someone else will release this */
diff --git a/fs/jfs/jfs_metapage.h b/fs/jfs/jfs_metapage.h
index 991e9fb84c75..f0b7d3282b07 100644
--- a/fs/jfs/jfs_metapage.h
+++ b/fs/jfs/jfs_metapage.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (c) International Business Machines Corp., 2000-2002 2 * Copyright (C) International Business Machines Corp., 2000-2002
3 * Portions Copyright (c) Christoph Hellwig, 2001-2002 3 * Portions Copyright (C) Christoph Hellwig, 2001-2002
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 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 6 * it under the terms of the GNU General Public License as published by
@@ -58,6 +58,8 @@ struct metapage {
58#define mark_metapage_dirty(mp) set_bit(META_dirty, &(mp)->flag) 58#define mark_metapage_dirty(mp) set_bit(META_dirty, &(mp)->flag)
59 59
60/* function prototypes */ 60/* function prototypes */
61extern int metapage_init(void);
62extern void metapage_exit(void);
61extern struct metapage *__get_metapage(struct inode *inode, 63extern struct metapage *__get_metapage(struct inode *inode,
62 unsigned long lblock, unsigned int size, 64 unsigned long lblock, unsigned int size,
63 int absolute, unsigned long new); 65 int absolute, unsigned long new);
diff --git a/fs/jfs/jfs_superblock.h b/fs/jfs/jfs_superblock.h
index ab0566f70cfa..fcf781bf31cb 100644
--- a/fs/jfs/jfs_superblock.h
+++ b/fs/jfs/jfs_superblock.h
@@ -109,5 +109,16 @@ struct jfs_superblock {
109extern int readSuper(struct super_block *, struct buffer_head **); 109extern int readSuper(struct super_block *, struct buffer_head **);
110extern int updateSuper(struct super_block *, uint); 110extern int updateSuper(struct super_block *, uint);
111extern void jfs_error(struct super_block *, const char *, ...); 111extern void jfs_error(struct super_block *, const char *, ...);
112extern int jfs_mount(struct super_block *);
113extern int jfs_mount_rw(struct super_block *, int);
114extern int jfs_umount(struct super_block *);
115extern int jfs_umount_rw(struct super_block *);
116
117extern int jfs_stop_threads;
118extern struct completion jfsIOwait;
119extern wait_queue_head_t jfs_IO_thread_wait;
120extern wait_queue_head_t jfs_commit_thread_wait;
121extern wait_queue_head_t jfs_sync_thread_wait;
122extern int jfs_extendfs(struct super_block *, s64, int);
112 123
113#endif /*_H_JFS_SUPERBLOCK */ 124#endif /*_H_JFS_SUPERBLOCK */
diff --git a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c
index e93d01aa12c4..8cbaaff1d5fa 100644
--- a/fs/jfs/jfs_txnmgr.c
+++ b/fs/jfs/jfs_txnmgr.c
@@ -42,7 +42,6 @@
42 * hold on to mp+lock thru update of maps 42 * hold on to mp+lock thru update of maps
43 */ 43 */
44 44
45
46#include <linux/fs.h> 45#include <linux/fs.h>
47#include <linux/vmalloc.h> 46#include <linux/vmalloc.h>
48#include <linux/smp_lock.h> 47#include <linux/smp_lock.h>
@@ -51,6 +50,7 @@
51#include <linux/module.h> 50#include <linux/module.h>
52#include <linux/moduleparam.h> 51#include <linux/moduleparam.h>
53#include "jfs_incore.h" 52#include "jfs_incore.h"
53#include "jfs_inode.h"
54#include "jfs_filsys.h" 54#include "jfs_filsys.h"
55#include "jfs_metapage.h" 55#include "jfs_metapage.h"
56#include "jfs_dinode.h" 56#include "jfs_dinode.h"
@@ -109,7 +109,6 @@ static int TxLockHWM; /* High water mark for number of txLocks used */
109static int TxLockVHWM; /* Very High water mark */ 109static int TxLockVHWM; /* Very High water mark */
110struct tlock *TxLock; /* transaction lock table */ 110struct tlock *TxLock; /* transaction lock table */
111 111
112
113/* 112/*
114 * transaction management lock 113 * transaction management lock
115 */ 114 */
@@ -149,7 +148,6 @@ static inline void TXN_SLEEP_DROP_LOCK(wait_queue_head_t * event)
149 148
150#define TXN_WAKEUP(event) wake_up_all(event) 149#define TXN_WAKEUP(event) wake_up_all(event)
151 150
152
153/* 151/*
154 * statistics 152 * statistics
155 */ 153 */
@@ -161,16 +159,6 @@ static struct {
161 int waitlock; /* 4: # of tlock wait */ 159 int waitlock; /* 4: # of tlock wait */
162} stattx; 160} stattx;
163 161
164
165/*
166 * external references
167 */
168extern int lmGroupCommit(struct jfs_log *, struct tblock *);
169extern int jfs_commit_inode(struct inode *, int);
170extern int jfs_stop_threads;
171
172extern struct completion jfsIOwait;
173
174/* 162/*
175 * forward references 163 * forward references
176 */ 164 */
@@ -358,7 +346,6 @@ void txExit(void)
358 TxBlock = NULL; 346 TxBlock = NULL;
359} 347}
360 348
361
362/* 349/*
363 * NAME: txBegin() 350 * NAME: txBegin()
364 * 351 *
@@ -460,7 +447,6 @@ tid_t txBegin(struct super_block *sb, int flag)
460 return t; 447 return t;
461} 448}
462 449
463
464/* 450/*
465 * NAME: txBeginAnon() 451 * NAME: txBeginAnon()
466 * 452 *
@@ -503,7 +489,6 @@ void txBeginAnon(struct super_block *sb)
503 TXN_UNLOCK(); 489 TXN_UNLOCK();
504} 490}
505 491
506
507/* 492/*
508 * txEnd() 493 * txEnd()
509 * 494 *
@@ -592,7 +577,6 @@ wakeup:
592 TXN_WAKEUP(&TxAnchor.freewait); 577 TXN_WAKEUP(&TxAnchor.freewait);
593} 578}
594 579
595
596/* 580/*
597 * txLock() 581 * txLock()
598 * 582 *
@@ -868,7 +852,6 @@ struct tlock *txLock(tid_t tid, struct inode *ip, struct metapage * mp,
868 return NULL; 852 return NULL;
869} 853}
870 854
871
872/* 855/*
873 * NAME: txRelease() 856 * NAME: txRelease()
874 * 857 *
@@ -908,7 +891,6 @@ static void txRelease(struct tblock * tblk)
908 TXN_UNLOCK(); 891 TXN_UNLOCK();
909} 892}
910 893
911
912/* 894/*
913 * NAME: txUnlock() 895 * NAME: txUnlock()
914 * 896 *
@@ -996,7 +978,6 @@ static void txUnlock(struct tblock * tblk)
996 } 978 }
997} 979}
998 980
999
1000/* 981/*
1001 * txMaplock() 982 * txMaplock()
1002 * 983 *
@@ -1069,7 +1050,6 @@ struct tlock *txMaplock(tid_t tid, struct inode *ip, int type)
1069 return tlck; 1050 return tlck;
1070} 1051}
1071 1052
1072
1073/* 1053/*
1074 * txLinelock() 1054 * txLinelock()
1075 * 1055 *
@@ -1103,8 +1083,6 @@ struct linelock *txLinelock(struct linelock * tlock)
1103 return linelock; 1083 return linelock;
1104} 1084}
1105 1085
1106
1107
1108/* 1086/*
1109 * transaction commit management 1087 * transaction commit management
1110 * ----------------------------- 1088 * -----------------------------
@@ -1373,7 +1351,6 @@ int txCommit(tid_t tid, /* transaction identifier */
1373 return rc; 1351 return rc;
1374} 1352}
1375 1353
1376
1377/* 1354/*
1378 * NAME: txLog() 1355 * NAME: txLog()
1379 * 1356 *
@@ -1437,7 +1414,6 @@ static int txLog(struct jfs_log * log, struct tblock * tblk, struct commit * cd)
1437 return rc; 1414 return rc;
1438} 1415}
1439 1416
1440
1441/* 1417/*
1442 * diLog() 1418 * diLog()
1443 * 1419 *
@@ -1465,7 +1441,6 @@ static int diLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
1465 if (tlck->type & tlckENTRY) { 1441 if (tlck->type & tlckENTRY) {
1466 /* log after-image for logredo(): */ 1442 /* log after-image for logredo(): */
1467 lrd->type = cpu_to_le16(LOG_REDOPAGE); 1443 lrd->type = cpu_to_le16(LOG_REDOPAGE);
1468// *pxd = mp->cm_pxd;
1469 PXDaddress(pxd, mp->index); 1444 PXDaddress(pxd, mp->index);
1470 PXDlength(pxd, 1445 PXDlength(pxd,
1471 mp->logical_size >> tblk->sb->s_blocksize_bits); 1446 mp->logical_size >> tblk->sb->s_blocksize_bits);
@@ -1552,7 +1527,6 @@ static int diLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
1552 return rc; 1527 return rc;
1553} 1528}
1554 1529
1555
1556/* 1530/*
1557 * dataLog() 1531 * dataLog()
1558 * 1532 *
@@ -1599,7 +1573,6 @@ static int dataLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
1599 return 0; 1573 return 0;
1600} 1574}
1601 1575
1602
1603/* 1576/*
1604 * dtLog() 1577 * dtLog()
1605 * 1578 *
@@ -1639,7 +1612,6 @@ static void dtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
1639 lrd->log.redopage.type |= cpu_to_le16(LOG_EXTEND); 1612 lrd->log.redopage.type |= cpu_to_le16(LOG_EXTEND);
1640 else 1613 else
1641 lrd->log.redopage.type |= cpu_to_le16(LOG_NEW); 1614 lrd->log.redopage.type |= cpu_to_le16(LOG_NEW);
1642// *pxd = mp->cm_pxd;
1643 PXDaddress(pxd, mp->index); 1615 PXDaddress(pxd, mp->index);
1644 PXDlength(pxd, 1616 PXDlength(pxd,
1645 mp->logical_size >> tblk->sb->s_blocksize_bits); 1617 mp->logical_size >> tblk->sb->s_blocksize_bits);
@@ -1704,7 +1676,6 @@ static void dtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
1704 return; 1676 return;
1705} 1677}
1706 1678
1707
1708/* 1679/*
1709 * xtLog() 1680 * xtLog()
1710 * 1681 *
@@ -1760,7 +1731,6 @@ static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
1760 * applying the after-image to the meta-data page. 1731 * applying the after-image to the meta-data page.
1761 */ 1732 */
1762 lrd->type = cpu_to_le16(LOG_REDOPAGE); 1733 lrd->type = cpu_to_le16(LOG_REDOPAGE);
1763// *page_pxd = mp->cm_pxd;
1764 PXDaddress(page_pxd, mp->index); 1734 PXDaddress(page_pxd, mp->index);
1765 PXDlength(page_pxd, 1735 PXDlength(page_pxd,
1766 mp->logical_size >> tblk->sb->s_blocksize_bits); 1736 mp->logical_size >> tblk->sb->s_blocksize_bits);
@@ -2093,7 +2063,6 @@ static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
2093 return; 2063 return;
2094} 2064}
2095 2065
2096
2097/* 2066/*
2098 * mapLog() 2067 * mapLog()
2099 * 2068 *
@@ -2180,7 +2149,6 @@ void mapLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
2180 } 2149 }
2181} 2150}
2182 2151
2183
2184/* 2152/*
2185 * txEA() 2153 * txEA()
2186 * 2154 *
@@ -2233,7 +2201,6 @@ void txEA(tid_t tid, struct inode *ip, dxd_t * oldea, dxd_t * newea)
2233 } 2201 }
2234} 2202}
2235 2203
2236
2237/* 2204/*
2238 * txForce() 2205 * txForce()
2239 * 2206 *
@@ -2300,7 +2267,6 @@ void txForce(struct tblock * tblk)
2300 } 2267 }
2301} 2268}
2302 2269
2303
2304/* 2270/*
2305 * txUpdateMap() 2271 * txUpdateMap()
2306 * 2272 *
@@ -2437,7 +2403,6 @@ static void txUpdateMap(struct tblock * tblk)
2437 } 2403 }
2438} 2404}
2439 2405
2440
2441/* 2406/*
2442 * txAllocPMap() 2407 * txAllocPMap()
2443 * 2408 *
@@ -2509,7 +2474,6 @@ static void txAllocPMap(struct inode *ip, struct maplock * maplock,
2509 } 2474 }
2510} 2475}
2511 2476
2512
2513/* 2477/*
2514 * txFreeMap() 2478 * txFreeMap()
2515 * 2479 *
@@ -2611,7 +2575,6 @@ void txFreeMap(struct inode *ip,
2611 } 2575 }
2612} 2576}
2613 2577
2614
2615/* 2578/*
2616 * txFreelock() 2579 * txFreelock()
2617 * 2580 *
@@ -2652,7 +2615,6 @@ void txFreelock(struct inode *ip)
2652 TXN_UNLOCK(); 2615 TXN_UNLOCK();
2653} 2616}
2654 2617
2655
2656/* 2618/*
2657 * txAbort() 2619 * txAbort()
2658 * 2620 *
diff --git a/fs/jfs/jfs_txnmgr.h b/fs/jfs/jfs_txnmgr.h
index b71b82c2df04..59ad0f6b7231 100644
--- a/fs/jfs/jfs_txnmgr.h
+++ b/fs/jfs/jfs_txnmgr.h
@@ -285,34 +285,26 @@ struct commit {
285/* 285/*
286 * external declarations 286 * external declarations
287 */ 287 */
288extern struct tlock *txLock(tid_t tid, struct inode *ip, struct metapage *mp, 288extern int jfs_tlocks_low;
289 int flag); 289
290 290extern int txInit(void);
291extern struct tlock *txMaplock(tid_t tid, struct inode *ip, int flag); 291extern void txExit(void);
292 292extern struct tlock *txLock(tid_t, struct inode *, struct metapage *, int);
293extern int txCommit(tid_t tid, int nip, struct inode **iplist, int flag); 293extern struct tlock *txMaplock(tid_t, struct inode *, int);
294 294extern int txCommit(tid_t, int, struct inode **, int);
295extern tid_t txBegin(struct super_block *sb, int flag); 295extern tid_t txBegin(struct super_block *, int);
296 296extern void txBeginAnon(struct super_block *);
297extern void txBeginAnon(struct super_block *sb); 297extern void txEnd(tid_t);
298 298extern void txAbort(tid_t, int);
299extern void txEnd(tid_t tid); 299extern struct linelock *txLinelock(struct linelock *);
300 300extern void txFreeMap(struct inode *, struct maplock *, struct tblock *, int);
301extern void txAbort(tid_t tid, int dirty); 301extern void txEA(tid_t, struct inode *, dxd_t *, dxd_t *);
302 302extern void txFreelock(struct inode *);
303extern struct linelock *txLinelock(struct linelock * tlock); 303extern int lmLog(struct jfs_log *, struct tblock *, struct lrd *,
304 304 struct tlock *);
305extern void txFreeMap(struct inode *ip, struct maplock * maplock, 305extern void txQuiesce(struct super_block *);
306 struct tblock * tblk, int maptype); 306extern void txResume(struct super_block *);
307 307extern void txLazyUnlock(struct tblock *);
308extern void txEA(tid_t tid, struct inode *ip, dxd_t * oldea, dxd_t * newea); 308extern int jfs_lazycommit(void *);
309 309extern int jfs_sync(void *);
310extern void txFreelock(struct inode *ip);
311
312extern int lmLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
313 struct tlock * tlck);
314
315extern void txQuiesce(struct super_block *sb);
316
317extern void txResume(struct super_block *sb);
318#endif /* _H_JFS_TXNMGR */ 310#endif /* _H_JFS_TXNMGR */
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
index 8413a368f449..1cae14e741eb 100644
--- a/fs/jfs/namei.c
+++ b/fs/jfs/namei.c
@@ -31,20 +31,9 @@
31#include "jfs_acl.h" 31#include "jfs_acl.h"
32#include "jfs_debug.h" 32#include "jfs_debug.h"
33 33
34extern struct inode_operations jfs_file_inode_operations;
35extern struct inode_operations jfs_symlink_inode_operations;
36extern struct file_operations jfs_file_operations;
37extern struct address_space_operations jfs_aops;
38
39extern int jfs_fsync(struct file *, struct dentry *, int);
40extern void jfs_truncate_nolock(struct inode *, loff_t);
41extern int jfs_init_acl(struct inode *, struct inode *);
42
43/* 34/*
44 * forward references 35 * forward references
45 */ 36 */
46struct inode_operations jfs_dir_inode_operations;
47struct file_operations jfs_dir_operations;
48struct dentry_operations jfs_ci_dentry_operations; 37struct dentry_operations jfs_ci_dentry_operations;
49 38
50static s64 commitZeroLink(tid_t, struct inode *); 39static s64 commitZeroLink(tid_t, struct inode *);
@@ -655,7 +644,7 @@ static s64 commitZeroLink(tid_t tid, struct inode *ip)
655 644
656 645
657/* 646/*
658 * NAME: freeZeroLink() 647 * NAME: jfs_free_zero_link()
659 * 648 *
660 * FUNCTION: for non-directory, called by iClose(), 649 * FUNCTION: for non-directory, called by iClose(),
661 * free resources of a file from cache and WORKING map 650 * free resources of a file from cache and WORKING map
@@ -663,15 +652,12 @@ static s64 commitZeroLink(tid_t tid, struct inode *ip)
663 * while associated with a pager object, 652 * while associated with a pager object,
664 * 653 *
665 * PARAMETER: ip - pointer to inode of file. 654 * PARAMETER: ip - pointer to inode of file.
666 *
667 * RETURN: 0 -ok
668 */ 655 */
669int freeZeroLink(struct inode *ip) 656void jfs_free_zero_link(struct inode *ip)
670{ 657{
671 int rc = 0;
672 int type; 658 int type;
673 659
674 jfs_info("freeZeroLink: ip = 0x%p", ip); 660 jfs_info("jfs_free_zero_link: ip = 0x%p", ip);
675 661
676 /* return if not reg or symbolic link or if size is 662 /* return if not reg or symbolic link or if size is
677 * already ok. 663 * already ok.
@@ -684,10 +670,10 @@ int freeZeroLink(struct inode *ip)
684 case S_IFLNK: 670 case S_IFLNK:
685 /* if its contained in inode nothing to do */ 671 /* if its contained in inode nothing to do */
686 if (ip->i_size < IDATASIZE) 672 if (ip->i_size < IDATASIZE)
687 return 0; 673 return;
688 break; 674 break;
689 default: 675 default:
690 return 0; 676 return;
691 } 677 }
692 678
693 /* 679 /*
@@ -737,9 +723,7 @@ int freeZeroLink(struct inode *ip)
737 * free xtree/data blocks from working block map; 723 * free xtree/data blocks from working block map;
738 */ 724 */
739 if (ip->i_size) 725 if (ip->i_size)
740 rc = xtTruncate(0, ip, 0, COMMIT_WMAP); 726 xtTruncate(0, ip, 0, COMMIT_WMAP);
741
742 return rc;
743} 727}
744 728
745/* 729/*
diff --git a/fs/jfs/super.c b/fs/jfs/super.c
index 5e774ed7fb64..810a3653d8b3 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -28,6 +28,7 @@
28 28
29#include "jfs_incore.h" 29#include "jfs_incore.h"
30#include "jfs_filsys.h" 30#include "jfs_filsys.h"
31#include "jfs_inode.h"
31#include "jfs_metapage.h" 32#include "jfs_metapage.h"
32#include "jfs_superblock.h" 33#include "jfs_superblock.h"
33#include "jfs_dmap.h" 34#include "jfs_dmap.h"
@@ -62,37 +63,6 @@ module_param(jfsloglevel, int, 0644);
62MODULE_PARM_DESC(jfsloglevel, "Specify JFS loglevel (0, 1 or 2)"); 63MODULE_PARM_DESC(jfsloglevel, "Specify JFS loglevel (0, 1 or 2)");
63#endif 64#endif
64 65
65/*
66 * External declarations
67 */
68extern int jfs_mount(struct super_block *);
69extern int jfs_mount_rw(struct super_block *, int);
70extern int jfs_umount(struct super_block *);
71extern int jfs_umount_rw(struct super_block *);
72
73extern int jfsIOWait(void *);
74extern int jfs_lazycommit(void *);
75extern int jfs_sync(void *);
76
77extern void jfs_read_inode(struct inode *inode);
78extern void jfs_dirty_inode(struct inode *inode);
79extern void jfs_delete_inode(struct inode *inode);
80extern int jfs_write_inode(struct inode *inode, int wait);
81
82extern struct dentry *jfs_get_parent(struct dentry *dentry);
83extern int jfs_extendfs(struct super_block *, s64, int);
84
85extern struct dentry_operations jfs_ci_dentry_operations;
86
87#ifdef PROC_FS_JFS /* see jfs_debug.h */
88extern void jfs_proc_init(void);
89extern void jfs_proc_clean(void);
90#endif
91
92extern wait_queue_head_t jfs_IO_thread_wait;
93extern wait_queue_head_t jfs_commit_thread_wait;
94extern wait_queue_head_t jfs_sync_thread_wait;
95
96static void jfs_handle_error(struct super_block *sb) 66static void jfs_handle_error(struct super_block *sb)
97{ 67{
98 struct jfs_sb_info *sbi = JFS_SBI(sb); 68 struct jfs_sb_info *sbi = JFS_SBI(sb);
@@ -593,11 +563,6 @@ static struct file_system_type jfs_fs_type = {
593 .fs_flags = FS_REQUIRES_DEV, 563 .fs_flags = FS_REQUIRES_DEV,
594}; 564};
595 565
596extern int metapage_init(void);
597extern int txInit(void);
598extern void txExit(void);
599extern void metapage_exit(void);
600
601static void init_once(void *foo, kmem_cache_t * cachep, unsigned long flags) 566static void init_once(void *foo, kmem_cache_t * cachep, unsigned long flags)
602{ 567{
603 struct jfs_inode_info *jfs_ip = (struct jfs_inode_info *) foo; 568 struct jfs_inode_info *jfs_ip = (struct jfs_inode_info *) foo;
diff --git a/fs/jfs/symlink.c b/fs/jfs/symlink.c
index ef4c07ee92b2..287d8d6c3cfd 100644
--- a/fs/jfs/symlink.c
+++ b/fs/jfs/symlink.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) Christoph Hellwig, 2001-2002 2 * Copyright (C) Christoph Hellwig, 2001-2002
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 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 5 * it under the terms of the GNU General Public License as published by
@@ -19,6 +19,7 @@
19#include <linux/fs.h> 19#include <linux/fs.h>
20#include <linux/namei.h> 20#include <linux/namei.h>
21#include "jfs_incore.h" 21#include "jfs_incore.h"
22#include "jfs_inode.h"
22#include "jfs_xattr.h" 23#include "jfs_xattr.h"
23 24
24static int jfs_follow_link(struct dentry *dentry, struct nameidata *nd) 25static int jfs_follow_link(struct dentry *dentry, struct nameidata *nd)
diff --git a/fs/jfs/xattr.c b/fs/jfs/xattr.c
index 7a9ffd5d03dc..6016373701a3 100644
--- a/fs/jfs/xattr.c
+++ b/fs/jfs/xattr.c
@@ -946,8 +946,7 @@ int __jfs_setxattr(struct inode *inode, const char *name, const void *value,
946 out: 946 out:
947 up_write(&JFS_IP(inode)->xattr_sem); 947 up_write(&JFS_IP(inode)->xattr_sem);
948 948
949 if (os2name) 949 kfree(os2name);
950 kfree(os2name);
951 950
952 return rc; 951 return rc;
953} 952}
@@ -1042,8 +1041,7 @@ ssize_t __jfs_getxattr(struct inode *inode, const char *name, void *data,
1042 out: 1041 out:
1043 up_read(&JFS_IP(inode)->xattr_sem); 1042 up_read(&JFS_IP(inode)->xattr_sem);
1044 1043
1045 if (os2name) 1044 kfree(os2name);
1046 kfree(os2name);
1047 1045
1048 return size; 1046 return size;
1049} 1047}
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
index a60a3b3d8a7b..63a9fbf1ac51 100644
--- a/fs/proc/proc_misc.c
+++ b/fs/proc/proc_misc.c
@@ -219,6 +219,19 @@ static struct file_operations fragmentation_file_operations = {
219 .release = seq_release, 219 .release = seq_release,
220}; 220};
221 221
222extern struct seq_operations zoneinfo_op;
223static int zoneinfo_open(struct inode *inode, struct file *file)
224{
225 return seq_open(file, &zoneinfo_op);
226}
227
228static struct file_operations proc_zoneinfo_file_operations = {
229 .open = zoneinfo_open,
230 .read = seq_read,
231 .llseek = seq_lseek,
232 .release = seq_release,
233};
234
222static int version_read_proc(char *page, char **start, off_t off, 235static int version_read_proc(char *page, char **start, off_t off,
223 int count, int *eof, void *data) 236 int count, int *eof, void *data)
224{ 237{
@@ -589,6 +602,7 @@ void __init proc_misc_init(void)
589 create_seq_entry("slabinfo",S_IWUSR|S_IRUGO,&proc_slabinfo_operations); 602 create_seq_entry("slabinfo",S_IWUSR|S_IRUGO,&proc_slabinfo_operations);
590 create_seq_entry("buddyinfo",S_IRUGO, &fragmentation_file_operations); 603 create_seq_entry("buddyinfo",S_IRUGO, &fragmentation_file_operations);
591 create_seq_entry("vmstat",S_IRUGO, &proc_vmstat_file_operations); 604 create_seq_entry("vmstat",S_IRUGO, &proc_vmstat_file_operations);
605 create_seq_entry("zoneinfo",S_IRUGO, &proc_zoneinfo_file_operations);
592 create_seq_entry("diskstats", 0, &proc_diskstats_operations); 606 create_seq_entry("diskstats", 0, &proc_diskstats_operations);
593#ifdef CONFIG_MODULES 607#ifdef CONFIG_MODULES
594 create_seq_entry("modules", 0, &proc_modules_operations); 608 create_seq_entry("modules", 0, &proc_modules_operations);
diff --git a/fs/super.c b/fs/super.c
index 3a1b8ca04ba6..573bcc81bb82 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -835,6 +835,7 @@ do_kern_mount(const char *fstype, int flags, const char *name, void *data)
835 mnt->mnt_parent = mnt; 835 mnt->mnt_parent = mnt;
836 mnt->mnt_namespace = current->namespace; 836 mnt->mnt_namespace = current->namespace;
837 up_write(&sb->s_umount); 837 up_write(&sb->s_umount);
838 free_secdata(secdata);
838 put_filesystem(type); 839 put_filesystem(type);
839 return mnt; 840 return mnt;
840out_sb: 841out_sb:
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c
index 997963e53622..c60e69431e11 100644
--- a/fs/xfs/linux-2.6/xfs_buf.c
+++ b/fs/xfs/linux-2.6/xfs_buf.c
@@ -61,12 +61,13 @@
61 * File wide globals 61 * File wide globals
62 */ 62 */
63 63
64STATIC kmem_cache_t *pagebuf_cache; 64STATIC kmem_cache_t *pagebuf_zone;
65STATIC kmem_shaker_t pagebuf_shake; 65STATIC kmem_shaker_t pagebuf_shake;
66STATIC int pagebuf_daemon_wakeup(int, unsigned int); 66STATIC int xfsbufd_wakeup(int, unsigned int);
67STATIC void pagebuf_delwri_queue(xfs_buf_t *, int); 67STATIC void pagebuf_delwri_queue(xfs_buf_t *, int);
68STATIC struct workqueue_struct *pagebuf_logio_workqueue; 68
69STATIC struct workqueue_struct *pagebuf_dataio_workqueue; 69STATIC struct workqueue_struct *xfslogd_workqueue;
70STATIC struct workqueue_struct *xfsdatad_workqueue;
70 71
71/* 72/*
72 * Pagebuf debugging 73 * Pagebuf debugging
@@ -123,9 +124,9 @@ ktrace_t *pagebuf_trace_buf;
123 124
124 125
125#define pagebuf_allocate(flags) \ 126#define pagebuf_allocate(flags) \
126 kmem_zone_alloc(pagebuf_cache, pb_to_km(flags)) 127 kmem_zone_alloc(pagebuf_zone, pb_to_km(flags))
127#define pagebuf_deallocate(pb) \ 128#define pagebuf_deallocate(pb) \
128 kmem_zone_free(pagebuf_cache, (pb)); 129 kmem_zone_free(pagebuf_zone, (pb));
129 130
130/* 131/*
131 * Page Region interfaces. 132 * Page Region interfaces.
@@ -425,7 +426,7 @@ _pagebuf_lookup_pages(
425 __FUNCTION__, gfp_mask); 426 __FUNCTION__, gfp_mask);
426 427
427 XFS_STATS_INC(pb_page_retries); 428 XFS_STATS_INC(pb_page_retries);
428 pagebuf_daemon_wakeup(0, gfp_mask); 429 xfsbufd_wakeup(0, gfp_mask);
429 blk_congestion_wait(WRITE, HZ/50); 430 blk_congestion_wait(WRITE, HZ/50);
430 goto retry; 431 goto retry;
431 } 432 }
@@ -1136,8 +1137,8 @@ pagebuf_iodone(
1136 if ((pb->pb_iodone) || (pb->pb_flags & PBF_ASYNC)) { 1137 if ((pb->pb_iodone) || (pb->pb_flags & PBF_ASYNC)) {
1137 if (schedule) { 1138 if (schedule) {
1138 INIT_WORK(&pb->pb_iodone_work, pagebuf_iodone_work, pb); 1139 INIT_WORK(&pb->pb_iodone_work, pagebuf_iodone_work, pb);
1139 queue_work(dataio ? pagebuf_dataio_workqueue : 1140 queue_work(dataio ? xfsdatad_workqueue :
1140 pagebuf_logio_workqueue, &pb->pb_iodone_work); 1141 xfslogd_workqueue, &pb->pb_iodone_work);
1141 } else { 1142 } else {
1142 pagebuf_iodone_work(pb); 1143 pagebuf_iodone_work(pb);
1143 } 1144 }
@@ -1562,16 +1563,6 @@ xfs_free_buftarg(
1562 kmem_free(btp, sizeof(*btp)); 1563 kmem_free(btp, sizeof(*btp));
1563} 1564}
1564 1565
1565void
1566xfs_incore_relse(
1567 xfs_buftarg_t *btp,
1568 int delwri_only,
1569 int wait)
1570{
1571 invalidate_bdev(btp->pbr_bdev, 1);
1572 truncate_inode_pages(btp->pbr_mapping, 0LL);
1573}
1574
1575STATIC int 1566STATIC int
1576xfs_setsize_buftarg_flags( 1567xfs_setsize_buftarg_flags(
1577 xfs_buftarg_t *btp, 1568 xfs_buftarg_t *btp,
@@ -1742,27 +1733,27 @@ pagebuf_runall_queues(
1742} 1733}
1743 1734
1744/* Defines for pagebuf daemon */ 1735/* Defines for pagebuf daemon */
1745STATIC DECLARE_COMPLETION(pagebuf_daemon_done); 1736STATIC DECLARE_COMPLETION(xfsbufd_done);
1746STATIC struct task_struct *pagebuf_daemon_task; 1737STATIC struct task_struct *xfsbufd_task;
1747STATIC int pagebuf_daemon_active; 1738STATIC int xfsbufd_active;
1748STATIC int force_flush; 1739STATIC int xfsbufd_force_flush;
1749STATIC int force_sleep; 1740STATIC int xfsbufd_force_sleep;
1750 1741
1751STATIC int 1742STATIC int
1752pagebuf_daemon_wakeup( 1743xfsbufd_wakeup(
1753 int priority, 1744 int priority,
1754 unsigned int mask) 1745 unsigned int mask)
1755{ 1746{
1756 if (force_sleep) 1747 if (xfsbufd_force_sleep)
1757 return 0; 1748 return 0;
1758 force_flush = 1; 1749 xfsbufd_force_flush = 1;
1759 barrier(); 1750 barrier();
1760 wake_up_process(pagebuf_daemon_task); 1751 wake_up_process(xfsbufd_task);
1761 return 0; 1752 return 0;
1762} 1753}
1763 1754
1764STATIC int 1755STATIC int
1765pagebuf_daemon( 1756xfsbufd(
1766 void *data) 1757 void *data)
1767{ 1758{
1768 struct list_head tmp; 1759 struct list_head tmp;
@@ -1774,17 +1765,17 @@ pagebuf_daemon(
1774 daemonize("xfsbufd"); 1765 daemonize("xfsbufd");
1775 current->flags |= PF_MEMALLOC; 1766 current->flags |= PF_MEMALLOC;
1776 1767
1777 pagebuf_daemon_task = current; 1768 xfsbufd_task = current;
1778 pagebuf_daemon_active = 1; 1769 xfsbufd_active = 1;
1779 barrier(); 1770 barrier();
1780 1771
1781 INIT_LIST_HEAD(&tmp); 1772 INIT_LIST_HEAD(&tmp);
1782 do { 1773 do {
1783 if (unlikely(current->flags & PF_FREEZE)) { 1774 if (unlikely(current->flags & PF_FREEZE)) {
1784 force_sleep = 1; 1775 xfsbufd_force_sleep = 1;
1785 refrigerator(PF_FREEZE); 1776 refrigerator(PF_FREEZE);
1786 } else { 1777 } else {
1787 force_sleep = 0; 1778 xfsbufd_force_sleep = 0;
1788 } 1779 }
1789 1780
1790 set_current_state(TASK_INTERRUPTIBLE); 1781 set_current_state(TASK_INTERRUPTIBLE);
@@ -1797,7 +1788,7 @@ pagebuf_daemon(
1797 ASSERT(pb->pb_flags & PBF_DELWRI); 1788 ASSERT(pb->pb_flags & PBF_DELWRI);
1798 1789
1799 if (!pagebuf_ispin(pb) && !pagebuf_cond_lock(pb)) { 1790 if (!pagebuf_ispin(pb) && !pagebuf_cond_lock(pb)) {
1800 if (!force_flush && 1791 if (!xfsbufd_force_flush &&
1801 time_before(jiffies, 1792 time_before(jiffies,
1802 pb->pb_queuetime + age)) { 1793 pb->pb_queuetime + age)) {
1803 pagebuf_unlock(pb); 1794 pagebuf_unlock(pb);
@@ -1824,10 +1815,10 @@ pagebuf_daemon(
1824 if (as_list_len > 0) 1815 if (as_list_len > 0)
1825 purge_addresses(); 1816 purge_addresses();
1826 1817
1827 force_flush = 0; 1818 xfsbufd_force_flush = 0;
1828 } while (pagebuf_daemon_active); 1819 } while (xfsbufd_active);
1829 1820
1830 complete_and_exit(&pagebuf_daemon_done, 0); 1821 complete_and_exit(&xfsbufd_done, 0);
1831} 1822}
1832 1823
1833/* 1824/*
@@ -1844,8 +1835,8 @@ xfs_flush_buftarg(
1844 xfs_buf_t *pb, *n; 1835 xfs_buf_t *pb, *n;
1845 int pincount = 0; 1836 int pincount = 0;
1846 1837
1847 pagebuf_runall_queues(pagebuf_dataio_workqueue); 1838 pagebuf_runall_queues(xfsdatad_workqueue);
1848 pagebuf_runall_queues(pagebuf_logio_workqueue); 1839 pagebuf_runall_queues(xfslogd_workqueue);
1849 1840
1850 INIT_LIST_HEAD(&tmp); 1841 INIT_LIST_HEAD(&tmp);
1851 spin_lock(&pbd_delwrite_lock); 1842 spin_lock(&pbd_delwrite_lock);
@@ -1898,43 +1889,43 @@ xfs_flush_buftarg(
1898} 1889}
1899 1890
1900STATIC int 1891STATIC int
1901pagebuf_daemon_start(void) 1892xfs_buf_daemons_start(void)
1902{ 1893{
1903 int rval; 1894 int error = -ENOMEM;
1904 1895
1905 pagebuf_logio_workqueue = create_workqueue("xfslogd"); 1896 xfslogd_workqueue = create_workqueue("xfslogd");
1906 if (!pagebuf_logio_workqueue) 1897 if (!xfslogd_workqueue)
1907 return -ENOMEM; 1898 goto out;
1908 1899
1909 pagebuf_dataio_workqueue = create_workqueue("xfsdatad"); 1900 xfsdatad_workqueue = create_workqueue("xfsdatad");
1910 if (!pagebuf_dataio_workqueue) { 1901 if (!xfsdatad_workqueue)
1911 destroy_workqueue(pagebuf_logio_workqueue); 1902 goto out_destroy_xfslogd_workqueue;
1912 return -ENOMEM;
1913 }
1914 1903
1915 rval = kernel_thread(pagebuf_daemon, NULL, CLONE_FS|CLONE_FILES); 1904 error = kernel_thread(xfsbufd, NULL, CLONE_FS|CLONE_FILES);
1916 if (rval < 0) { 1905 if (error < 0)
1917 destroy_workqueue(pagebuf_logio_workqueue); 1906 goto out_destroy_xfsdatad_workqueue;
1918 destroy_workqueue(pagebuf_dataio_workqueue); 1907 return 0;
1919 }
1920 1908
1921 return rval; 1909 out_destroy_xfsdatad_workqueue:
1910 destroy_workqueue(xfsdatad_workqueue);
1911 out_destroy_xfslogd_workqueue:
1912 destroy_workqueue(xfslogd_workqueue);
1913 out:
1914 return error;
1922} 1915}
1923 1916
1924/* 1917/*
1925 * pagebuf_daemon_stop
1926 *
1927 * Note: do not mark as __exit, it is called from pagebuf_terminate. 1918 * Note: do not mark as __exit, it is called from pagebuf_terminate.
1928 */ 1919 */
1929STATIC void 1920STATIC void
1930pagebuf_daemon_stop(void) 1921xfs_buf_daemons_stop(void)
1931{ 1922{
1932 pagebuf_daemon_active = 0; 1923 xfsbufd_active = 0;
1933 barrier(); 1924 barrier();
1934 wait_for_completion(&pagebuf_daemon_done); 1925 wait_for_completion(&xfsbufd_done);
1935 1926
1936 destroy_workqueue(pagebuf_logio_workqueue); 1927 destroy_workqueue(xfslogd_workqueue);
1937 destroy_workqueue(pagebuf_dataio_workqueue); 1928 destroy_workqueue(xfsdatad_workqueue);
1938} 1929}
1939 1930
1940/* 1931/*
@@ -1944,27 +1935,37 @@ pagebuf_daemon_stop(void)
1944int __init 1935int __init
1945pagebuf_init(void) 1936pagebuf_init(void)
1946{ 1937{
1947 pagebuf_cache = kmem_cache_create("xfs_buf_t", sizeof(xfs_buf_t), 0, 1938 int error = -ENOMEM;
1948 SLAB_HWCACHE_ALIGN, NULL, NULL); 1939
1949 if (pagebuf_cache == NULL) { 1940 pagebuf_zone = kmem_zone_init(sizeof(xfs_buf_t), "xfs_buf");
1950 printk("XFS: couldn't init xfs_buf_t cache\n"); 1941 if (!pagebuf_zone)
1951 pagebuf_terminate(); 1942 goto out;
1952 return -ENOMEM;
1953 }
1954 1943
1955#ifdef PAGEBUF_TRACE 1944#ifdef PAGEBUF_TRACE
1956 pagebuf_trace_buf = ktrace_alloc(PAGEBUF_TRACE_SIZE, KM_SLEEP); 1945 pagebuf_trace_buf = ktrace_alloc(PAGEBUF_TRACE_SIZE, KM_SLEEP);
1957#endif 1946#endif
1958 1947
1959 pagebuf_daemon_start(); 1948 error = xfs_buf_daemons_start();
1949 if (error)
1950 goto out_free_buf_zone;
1960 1951
1961 pagebuf_shake = kmem_shake_register(pagebuf_daemon_wakeup); 1952 pagebuf_shake = kmem_shake_register(xfsbufd_wakeup);
1962 if (pagebuf_shake == NULL) { 1953 if (!pagebuf_shake) {
1963 pagebuf_terminate(); 1954 error = -ENOMEM;
1964 return -ENOMEM; 1955 goto out_stop_daemons;
1965 } 1956 }
1966 1957
1967 return 0; 1958 return 0;
1959
1960 out_stop_daemons:
1961 xfs_buf_daemons_stop();
1962 out_free_buf_zone:
1963#ifdef PAGEBUF_TRACE
1964 ktrace_free(pagebuf_trace_buf);
1965#endif
1966 kmem_zone_destroy(pagebuf_zone);
1967 out:
1968 return error;
1968} 1969}
1969 1970
1970 1971
@@ -1976,12 +1977,12 @@ pagebuf_init(void)
1976void 1977void
1977pagebuf_terminate(void) 1978pagebuf_terminate(void)
1978{ 1979{
1979 pagebuf_daemon_stop(); 1980 xfs_buf_daemons_stop();
1980 1981
1981#ifdef PAGEBUF_TRACE 1982#ifdef PAGEBUF_TRACE
1982 ktrace_free(pagebuf_trace_buf); 1983 ktrace_free(pagebuf_trace_buf);
1983#endif 1984#endif
1984 1985
1985 kmem_zone_destroy(pagebuf_cache); 1986 kmem_zone_destroy(pagebuf_zone);
1986 kmem_shake_deregister(pagebuf_shake); 1987 kmem_shake_deregister(pagebuf_shake);
1987} 1988}
diff --git a/fs/xfs/linux-2.6/xfs_buf.h b/fs/xfs/linux-2.6/xfs_buf.h
index 74deed8e6d90..3f8f69a66aea 100644
--- a/fs/xfs/linux-2.6/xfs_buf.h
+++ b/fs/xfs/linux-2.6/xfs_buf.h
@@ -576,7 +576,6 @@ extern xfs_buftarg_t *xfs_alloc_buftarg(struct block_device *, int);
576extern void xfs_free_buftarg(xfs_buftarg_t *, int); 576extern void xfs_free_buftarg(xfs_buftarg_t *, int);
577extern void xfs_wait_buftarg(xfs_buftarg_t *); 577extern void xfs_wait_buftarg(xfs_buftarg_t *);
578extern int xfs_setsize_buftarg(xfs_buftarg_t *, unsigned int, unsigned int); 578extern int xfs_setsize_buftarg(xfs_buftarg_t *, unsigned int, unsigned int);
579extern void xfs_incore_relse(xfs_buftarg_t *, int, int);
580extern int xfs_flush_buftarg(xfs_buftarg_t *, int); 579extern int xfs_flush_buftarg(xfs_buftarg_t *, int);
581 580
582#define xfs_getsize_buftarg(buftarg) \ 581#define xfs_getsize_buftarg(buftarg) \
diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c
index 24fa3b101b93..f1ce4323f56e 100644
--- a/fs/xfs/linux-2.6/xfs_file.c
+++ b/fs/xfs/linux-2.6/xfs_file.c
@@ -57,7 +57,9 @@
57#include <linux/smp_lock.h> 57#include <linux/smp_lock.h>
58 58
59static struct vm_operations_struct linvfs_file_vm_ops; 59static struct vm_operations_struct linvfs_file_vm_ops;
60 60#ifdef CONFIG_XFS_DMAPI
61static struct vm_operations_struct linvfs_dmapi_file_vm_ops;
62#endif
61 63
62STATIC inline ssize_t 64STATIC inline ssize_t
63__linvfs_read( 65__linvfs_read(
@@ -388,6 +390,14 @@ done:
388 return -error; 390 return -error;
389} 391}
390 392
393#ifdef CONFIG_XFS_DMAPI
394STATIC void
395linvfs_mmap_close(
396 struct vm_area_struct *vma)
397{
398 xfs_dm_mm_put(vma);
399}
400#endif /* CONFIG_XFS_DMAPI */
391 401
392STATIC int 402STATIC int
393linvfs_file_mmap( 403linvfs_file_mmap(
@@ -399,16 +409,19 @@ linvfs_file_mmap(
399 vattr_t va = { .va_mask = XFS_AT_UPDATIME }; 409 vattr_t va = { .va_mask = XFS_AT_UPDATIME };
400 int error; 410 int error;
401 411
412 vma->vm_ops = &linvfs_file_vm_ops;
413
402 if (vp->v_vfsp->vfs_flag & VFS_DMI) { 414 if (vp->v_vfsp->vfs_flag & VFS_DMI) {
403 xfs_mount_t *mp = XFS_VFSTOM(vp->v_vfsp); 415 xfs_mount_t *mp = XFS_VFSTOM(vp->v_vfsp);
404 416
405 error = -XFS_SEND_MMAP(mp, vma, 0); 417 error = -XFS_SEND_MMAP(mp, vma, 0);
406 if (error) 418 if (error)
407 return error; 419 return error;
420#ifdef CONFIG_XFS_DMAPI
421 vma->vm_ops = &linvfs_dmapi_file_vm_ops;
422#endif
408 } 423 }
409 424
410 vma->vm_ops = &linvfs_file_vm_ops;
411
412 VOP_SETATTR(vp, &va, XFS_AT_UPDATIME, NULL, error); 425 VOP_SETATTR(vp, &va, XFS_AT_UPDATIME, NULL, error);
413 if (!error) 426 if (!error)
414 vn_revalidate(vp); /* update Linux inode flags */ 427 vn_revalidate(vp); /* update Linux inode flags */
@@ -609,7 +622,15 @@ struct file_operations linvfs_dir_operations = {
609static struct vm_operations_struct linvfs_file_vm_ops = { 622static struct vm_operations_struct linvfs_file_vm_ops = {
610 .nopage = filemap_nopage, 623 .nopage = filemap_nopage,
611 .populate = filemap_populate, 624 .populate = filemap_populate,
625};
626
627#ifdef CONFIG_XFS_DMAPI
628static struct vm_operations_struct linvfs_dmapi_file_vm_ops = {
629 .close = linvfs_mmap_close,
630 .nopage = filemap_nopage,
631 .populate = filemap_populate,
612#ifdef HAVE_VMOP_MPROTECT 632#ifdef HAVE_VMOP_MPROTECT
613 .mprotect = linvfs_mprotect, 633 .mprotect = linvfs_mprotect,
614#endif 634#endif
615}; 635};
636#endif /* CONFIG_XFS_DMAPI */
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c
index 69809eef8a54..05a447e51cc0 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl.c
+++ b/fs/xfs/linux-2.6/xfs_ioctl.c
@@ -1174,7 +1174,8 @@ xfs_ioc_xattr(
1174 1174
1175 switch (cmd) { 1175 switch (cmd) {
1176 case XFS_IOC_FSGETXATTR: { 1176 case XFS_IOC_FSGETXATTR: {
1177 va.va_mask = XFS_AT_XFLAGS|XFS_AT_EXTSIZE|XFS_AT_NEXTENTS; 1177 va.va_mask = XFS_AT_XFLAGS | XFS_AT_EXTSIZE | \
1178 XFS_AT_NEXTENTS | XFS_AT_PROJID;
1178 VOP_GETATTR(vp, &va, 0, NULL, error); 1179 VOP_GETATTR(vp, &va, 0, NULL, error);
1179 if (error) 1180 if (error)
1180 return -error; 1181 return -error;
@@ -1182,6 +1183,7 @@ xfs_ioc_xattr(
1182 fa.fsx_xflags = va.va_xflags; 1183 fa.fsx_xflags = va.va_xflags;
1183 fa.fsx_extsize = va.va_extsize; 1184 fa.fsx_extsize = va.va_extsize;
1184 fa.fsx_nextents = va.va_nextents; 1185 fa.fsx_nextents = va.va_nextents;
1186 fa.fsx_projid = va.va_projid;
1185 1187
1186 if (copy_to_user(arg, &fa, sizeof(fa))) 1188 if (copy_to_user(arg, &fa, sizeof(fa)))
1187 return -XFS_ERROR(EFAULT); 1189 return -XFS_ERROR(EFAULT);
@@ -1196,9 +1198,10 @@ xfs_ioc_xattr(
1196 if (filp->f_flags & (O_NDELAY|O_NONBLOCK)) 1198 if (filp->f_flags & (O_NDELAY|O_NONBLOCK))
1197 attr_flags |= ATTR_NONBLOCK; 1199 attr_flags |= ATTR_NONBLOCK;
1198 1200
1199 va.va_mask = XFS_AT_XFLAGS | XFS_AT_EXTSIZE; 1201 va.va_mask = XFS_AT_XFLAGS | XFS_AT_EXTSIZE | XFS_AT_PROJID;
1200 va.va_xflags = fa.fsx_xflags; 1202 va.va_xflags = fa.fsx_xflags;
1201 va.va_extsize = fa.fsx_extsize; 1203 va.va_extsize = fa.fsx_extsize;
1204 va.va_projid = fa.fsx_projid;
1202 1205
1203 VOP_SETATTR(vp, &va, attr_flags, NULL, error); 1206 VOP_SETATTR(vp, &va, attr_flags, NULL, error);
1204 if (!error) 1207 if (!error)
@@ -1207,7 +1210,8 @@ xfs_ioc_xattr(
1207 } 1210 }
1208 1211
1209 case XFS_IOC_FSGETXATTRA: { 1212 case XFS_IOC_FSGETXATTRA: {
1210 va.va_mask = XFS_AT_XFLAGS|XFS_AT_EXTSIZE|XFS_AT_ANEXTENTS; 1213 va.va_mask = XFS_AT_XFLAGS | XFS_AT_EXTSIZE | \
1214 XFS_AT_ANEXTENTS | XFS_AT_PROJID;
1211 VOP_GETATTR(vp, &va, 0, NULL, error); 1215 VOP_GETATTR(vp, &va, 0, NULL, error);
1212 if (error) 1216 if (error)
1213 return -error; 1217 return -error;
@@ -1215,6 +1219,7 @@ xfs_ioc_xattr(
1215 fa.fsx_xflags = va.va_xflags; 1219 fa.fsx_xflags = va.va_xflags;
1216 fa.fsx_extsize = va.va_extsize; 1220 fa.fsx_extsize = va.va_extsize;
1217 fa.fsx_nextents = va.va_anextents; 1221 fa.fsx_nextents = va.va_anextents;
1222 fa.fsx_projid = va.va_projid;
1218 1223
1219 if (copy_to_user(arg, &fa, sizeof(fa))) 1224 if (copy_to_user(arg, &fa, sizeof(fa)))
1220 return -XFS_ERROR(EFAULT); 1225 return -XFS_ERROR(EFAULT);
diff --git a/fs/xfs/linux-2.6/xfs_linux.h b/fs/xfs/linux-2.6/xfs_linux.h
index 71bb41019a12..42dc5e4662ed 100644
--- a/fs/xfs/linux-2.6/xfs_linux.h
+++ b/fs/xfs/linux-2.6/xfs_linux.h
@@ -145,10 +145,10 @@ static inline void set_buffer_unwritten_io(struct buffer_head *bh)
145#define xfs_inherit_nosymlinks xfs_params.inherit_nosym.val 145#define xfs_inherit_nosymlinks xfs_params.inherit_nosym.val
146#define xfs_rotorstep xfs_params.rotorstep.val 146#define xfs_rotorstep xfs_params.rotorstep.val
147 147
148#ifndef __smp_processor_id 148#ifndef raw_smp_processor_id
149#define __smp_processor_id() smp_processor_id() 149#define raw_smp_processor_id() smp_processor_id()
150#endif 150#endif
151#define current_cpu() __smp_processor_id() 151#define current_cpu() raw_smp_processor_id()
152#define current_pid() (current->pid) 152#define current_pid() (current->pid)
153#define current_fsuid(cred) (current->fsuid) 153#define current_fsuid(cred) (current->fsuid)
154#define current_fsgid(cred) (current->fsgid) 154#define current_fsgid(cred) (current->fsgid)
@@ -230,8 +230,10 @@ static inline void set_buffer_unwritten_io(struct buffer_head *bh)
230 * field (see the QCMD macro in quota.h). These macros help keep the 230 * field (see the QCMD macro in quota.h). These macros help keep the
231 * code portable - they are not visible from the syscall interface. 231 * code portable - they are not visible from the syscall interface.
232 */ 232 */
233#define Q_XSETGQLIM XQM_CMD(0x8) /* set groups disk limits */ 233#define Q_XSETGQLIM XQM_CMD(8) /* set groups disk limits */
234#define Q_XGETGQUOTA XQM_CMD(0x9) /* get groups disk limits */ 234#define Q_XGETGQUOTA XQM_CMD(9) /* get groups disk limits */
235#define Q_XSETPQLIM XQM_CMD(10) /* set projects disk limits */
236#define Q_XGETPQUOTA XQM_CMD(11) /* get projects disk limits */
235 237
236/* IRIX uses a dynamic sizing algorithm (ndquot = 200 + numprocs*2) */ 238/* IRIX uses a dynamic sizing algorithm (ndquot = 200 + numprocs*2) */
237/* we may well need to fine-tune this if it ever becomes an issue. */ 239/* we may well need to fine-tune this if it ever becomes an issue. */
diff --git a/fs/xfs/linux-2.6/xfs_lrw.c b/fs/xfs/linux-2.6/xfs_lrw.c
index aa9daaea6c34..acab58c48043 100644
--- a/fs/xfs/linux-2.6/xfs_lrw.c
+++ b/fs/xfs/linux-2.6/xfs_lrw.c
@@ -209,30 +209,6 @@ unlock:
209 return (-status); 209 return (-status);
210} 210}
211 211
212/*
213 * xfs_inval_cached_pages
214 *
215 * This routine is responsible for keeping direct I/O and buffered I/O
216 * somewhat coherent. From here we make sure that we're at least
217 * temporarily holding the inode I/O lock exclusively and then call
218 * the page cache to flush and invalidate any cached pages. If there
219 * are no cached pages this routine will be very quick.
220 */
221void
222xfs_inval_cached_pages(
223 vnode_t *vp,
224 xfs_iocore_t *io,
225 xfs_off_t offset,
226 int write,
227 int relock)
228{
229 if (VN_CACHED(vp)) {
230 xfs_inval_cached_trace(io, offset, -1, ctooff(offtoct(offset)), -1);
231 VOP_FLUSHINVAL_PAGES(vp, ctooff(offtoct(offset)), -1, FI_REMAPF_LOCKED);
232 }
233
234}
235
236ssize_t /* bytes read, or (-) error */ 212ssize_t /* bytes read, or (-) error */
237xfs_read( 213xfs_read(
238 bhv_desc_t *bdp, 214 bhv_desc_t *bdp,
@@ -304,10 +280,11 @@ xfs_read(
304 if (DM_EVENT_ENABLED(vp->v_vfsp, ip, DM_EVENT_READ) && 280 if (DM_EVENT_ENABLED(vp->v_vfsp, ip, DM_EVENT_READ) &&
305 !(ioflags & IO_INVIS)) { 281 !(ioflags & IO_INVIS)) {
306 vrwlock_t locktype = VRWLOCK_READ; 282 vrwlock_t locktype = VRWLOCK_READ;
283 int dmflags = FILP_DELAY_FLAG(file) | DM_SEM_FLAG_RD(ioflags);
307 284
308 ret = -XFS_SEND_DATA(mp, DM_EVENT_READ, 285 ret = -XFS_SEND_DATA(mp, DM_EVENT_READ,
309 BHV_TO_VNODE(bdp), *offset, size, 286 BHV_TO_VNODE(bdp), *offset, size,
310 FILP_DELAY_FLAG(file), &locktype); 287 dmflags, &locktype);
311 if (ret) { 288 if (ret) {
312 xfs_iunlock(ip, XFS_IOLOCK_SHARED); 289 xfs_iunlock(ip, XFS_IOLOCK_SHARED);
313 goto unlock_isem; 290 goto unlock_isem;
@@ -867,11 +844,15 @@ retry:
867 !(ioflags & IO_INVIS)) { 844 !(ioflags & IO_INVIS)) {
868 845
869 xfs_rwunlock(bdp, locktype); 846 xfs_rwunlock(bdp, locktype);
847 if (need_isem)
848 up(&inode->i_sem);
870 error = XFS_SEND_NAMESP(xip->i_mount, DM_EVENT_NOSPACE, vp, 849 error = XFS_SEND_NAMESP(xip->i_mount, DM_EVENT_NOSPACE, vp,
871 DM_RIGHT_NULL, vp, DM_RIGHT_NULL, NULL, NULL, 850 DM_RIGHT_NULL, vp, DM_RIGHT_NULL, NULL, NULL,
872 0, 0, 0); /* Delay flag intentionally unused */ 851 0, 0, 0); /* Delay flag intentionally unused */
873 if (error) 852 if (error)
874 goto out_unlock_isem; 853 goto out_nounlocks;
854 if (need_isem)
855 down(&inode->i_sem);
875 xfs_rwlock(bdp, locktype); 856 xfs_rwlock(bdp, locktype);
876 pos = xip->i_d.di_size; 857 pos = xip->i_d.di_size;
877 ret = 0; 858 ret = 0;
@@ -986,6 +967,7 @@ retry:
986 out_unlock_isem: 967 out_unlock_isem:
987 if (need_isem) 968 if (need_isem)
988 up(&inode->i_sem); 969 up(&inode->i_sem);
970 out_nounlocks:
989 return -error; 971 return -error;
990} 972}
991 973
diff --git a/fs/xfs/linux-2.6/xfs_lrw.h b/fs/xfs/linux-2.6/xfs_lrw.h
index d723e35254a0..f197a720e394 100644
--- a/fs/xfs/linux-2.6/xfs_lrw.h
+++ b/fs/xfs/linux-2.6/xfs_lrw.h
@@ -94,8 +94,6 @@ extern int xfs_bdstrat_cb(struct xfs_buf *);
94 94
95extern int xfs_zero_eof(struct vnode *, struct xfs_iocore *, xfs_off_t, 95extern int xfs_zero_eof(struct vnode *, struct xfs_iocore *, xfs_off_t,
96 xfs_fsize_t, xfs_fsize_t); 96 xfs_fsize_t, xfs_fsize_t);
97extern void xfs_inval_cached_pages(struct vnode *, struct xfs_iocore *,
98 xfs_off_t, int, int);
99extern ssize_t xfs_read(struct bhv_desc *, struct kiocb *, 97extern ssize_t xfs_read(struct bhv_desc *, struct kiocb *,
100 const struct iovec *, unsigned int, 98 const struct iovec *, unsigned int,
101 loff_t *, int, struct cred *); 99 loff_t *, int, struct cred *);
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
index 455e2b2fb964..5fe9af38aa20 100644
--- a/fs/xfs/linux-2.6/xfs_super.c
+++ b/fs/xfs/linux-2.6/xfs_super.c
@@ -590,8 +590,10 @@ linvfs_sync_super(
590 int error; 590 int error;
591 int flags = SYNC_FSDATA; 591 int flags = SYNC_FSDATA;
592 592
593 if (wait) 593 if (unlikely(sb->s_frozen == SB_FREEZE_WRITE))
594 flags |= SYNC_WAIT; 594 flags = SYNC_QUIESCE;
595 else
596 flags = SYNC_FSDATA | (wait ? SYNC_WAIT : 0);
595 597
596 VFS_SYNC(vfsp, flags, NULL, error); 598 VFS_SYNC(vfsp, flags, NULL, error);
597 sb->s_dirt = 0; 599 sb->s_dirt = 0;
@@ -701,7 +703,8 @@ linvfs_getxquota(
701 struct vfs *vfsp = LINVFS_GET_VFS(sb); 703 struct vfs *vfsp = LINVFS_GET_VFS(sb);
702 int error, getmode; 704 int error, getmode;
703 705
704 getmode = (type == GRPQUOTA) ? Q_XGETGQUOTA : Q_XGETQUOTA; 706 getmode = (type == USRQUOTA) ? Q_XGETQUOTA :
707 ((type == GRPQUOTA) ? Q_XGETGQUOTA : Q_XGETPQUOTA);
705 VFS_QUOTACTL(vfsp, getmode, id, (caddr_t)fdq, error); 708 VFS_QUOTACTL(vfsp, getmode, id, (caddr_t)fdq, error);
706 return -error; 709 return -error;
707} 710}
@@ -716,7 +719,8 @@ linvfs_setxquota(
716 struct vfs *vfsp = LINVFS_GET_VFS(sb); 719 struct vfs *vfsp = LINVFS_GET_VFS(sb);
717 int error, setmode; 720 int error, setmode;
718 721
719 setmode = (type == GRPQUOTA) ? Q_XSETGQLIM : Q_XSETQLIM; 722 setmode = (type == USRQUOTA) ? Q_XSETQLIM :
723 ((type == GRPQUOTA) ? Q_XSETGQLIM : Q_XSETPQLIM);
720 VFS_QUOTACTL(vfsp, setmode, id, (caddr_t)fdq, error); 724 VFS_QUOTACTL(vfsp, setmode, id, (caddr_t)fdq, error);
721 return -error; 725 return -error;
722} 726}
diff --git a/fs/xfs/linux-2.6/xfs_vfs.h b/fs/xfs/linux-2.6/xfs_vfs.h
index 76493991578f..7ee1f714e9ba 100644
--- a/fs/xfs/linux-2.6/xfs_vfs.h
+++ b/fs/xfs/linux-2.6/xfs_vfs.h
@@ -107,6 +107,7 @@ typedef enum {
107#define SYNC_FSDATA 0x0020 /* flush fs data (e.g. superblocks) */ 107#define SYNC_FSDATA 0x0020 /* flush fs data (e.g. superblocks) */
108#define SYNC_REFCACHE 0x0040 /* prune some of the nfs ref cache */ 108#define SYNC_REFCACHE 0x0040 /* prune some of the nfs ref cache */
109#define SYNC_REMOUNT 0x0080 /* remount readonly, no dummy LRs */ 109#define SYNC_REMOUNT 0x0080 /* remount readonly, no dummy LRs */
110#define SYNC_QUIESCE 0x0100 /* quiesce fileystem for a snapshot */
110 111
111typedef int (*vfs_mount_t)(bhv_desc_t *, 112typedef int (*vfs_mount_t)(bhv_desc_t *,
112 struct xfs_mount_args *, struct cred *); 113 struct xfs_mount_args *, struct cred *);
diff --git a/fs/xfs/linux-2.6/xfs_vnode.c b/fs/xfs/linux-2.6/xfs_vnode.c
index a832d165f24f..250cad54e892 100644
--- a/fs/xfs/linux-2.6/xfs_vnode.c
+++ b/fs/xfs/linux-2.6/xfs_vnode.c
@@ -411,13 +411,13 @@ vn_remove(
411/* 0 */ (void *)(__psint_t)(vk), \ 411/* 0 */ (void *)(__psint_t)(vk), \
412/* 1 */ (void *)(s), \ 412/* 1 */ (void *)(s), \
413/* 2 */ (void *)(__psint_t) line, \ 413/* 2 */ (void *)(__psint_t) line, \
414/* 3 */ (void *)(vn_count(vp)), \ 414/* 3 */ (void *)(__psint_t)(vn_count(vp)), \
415/* 4 */ (void *)(ra), \ 415/* 4 */ (void *)(ra), \
416/* 5 */ (void *)(__psunsigned_t)(vp)->v_flag, \ 416/* 5 */ (void *)(__psunsigned_t)(vp)->v_flag, \
417/* 6 */ (void *)(__psint_t)current_cpu(), \ 417/* 6 */ (void *)(__psint_t)current_cpu(), \
418/* 7 */ (void *)(__psint_t)current_pid(), \ 418/* 7 */ (void *)(__psint_t)current_pid(), \
419/* 8 */ (void *)__return_address, \ 419/* 8 */ (void *)__return_address, \
420/* 9 */ 0, 0, 0, 0, 0, 0, 0) 420/* 9 */ NULL, NULL, NULL, NULL, NULL, NULL, NULL)
421 421
422/* 422/*
423 * Vnode tracing code. 423 * Vnode tracing code.
diff --git a/fs/xfs/linux-2.6/xfs_vnode.h b/fs/xfs/linux-2.6/xfs_vnode.h
index 00466c3194ac..a6e57c647be4 100644
--- a/fs/xfs/linux-2.6/xfs_vnode.h
+++ b/fs/xfs/linux-2.6/xfs_vnode.h
@@ -426,7 +426,7 @@ typedef struct vattr {
426 u_long va_extsize; /* file extent size */ 426 u_long va_extsize; /* file extent size */
427 u_long va_nextents; /* number of extents in file */ 427 u_long va_nextents; /* number of extents in file */
428 u_long va_anextents; /* number of attr extents in file */ 428 u_long va_anextents; /* number of attr extents in file */
429 int va_projid; /* project id */ 429 prid_t va_projid; /* project id */
430} vattr_t; 430} vattr_t;
431 431
432/* 432/*
diff --git a/fs/xfs/quota/xfs_dquot.c b/fs/xfs/quota/xfs_dquot.c
index 740d20d33187..46ce1e3ce1d6 100644
--- a/fs/xfs/quota/xfs_dquot.c
+++ b/fs/xfs/quota/xfs_dquot.c
@@ -101,7 +101,7 @@ int xfs_dqerror_mod = 33;
101 * is the d_id field. The idea is to fill in the entire q_core 101 * is the d_id field. The idea is to fill in the entire q_core
102 * when we read in the on disk dquot. 102 * when we read in the on disk dquot.
103 */ 103 */
104xfs_dquot_t * 104STATIC xfs_dquot_t *
105xfs_qm_dqinit( 105xfs_qm_dqinit(
106 xfs_mount_t *mp, 106 xfs_mount_t *mp,
107 xfs_dqid_t id, 107 xfs_dqid_t id,
@@ -286,7 +286,9 @@ xfs_qm_adjust_dqlimits(
286 * We also return 0 as the values of the timers in Q_GETQUOTA calls, when 286 * We also return 0 as the values of the timers in Q_GETQUOTA calls, when
287 * enforcement's off. 287 * enforcement's off.
288 * In contrast, warnings are a little different in that they don't 288 * In contrast, warnings are a little different in that they don't
289 * 'automatically' get started when limits get exceeded. 289 * 'automatically' get started when limits get exceeded. They do
290 * get reset to zero, however, when we find the count to be under
291 * the soft limit (they are only ever set non-zero via userspace).
290 */ 292 */
291void 293void
292xfs_qm_adjust_dqtimers( 294xfs_qm_adjust_dqtimers(
@@ -315,6 +317,8 @@ xfs_qm_adjust_dqtimers(
315 INT_GET(d->d_blk_hardlimit, ARCH_CONVERT)))) { 317 INT_GET(d->d_blk_hardlimit, ARCH_CONVERT)))) {
316 INT_SET(d->d_btimer, ARCH_CONVERT, 318 INT_SET(d->d_btimer, ARCH_CONVERT,
317 get_seconds() + XFS_QI_BTIMELIMIT(mp)); 319 get_seconds() + XFS_QI_BTIMELIMIT(mp));
320 } else {
321 d->d_bwarns = 0;
318 } 322 }
319 } else { 323 } else {
320 if ((!d->d_blk_softlimit || 324 if ((!d->d_blk_softlimit ||
@@ -336,6 +340,8 @@ xfs_qm_adjust_dqtimers(
336 INT_GET(d->d_ino_hardlimit, ARCH_CONVERT)))) { 340 INT_GET(d->d_ino_hardlimit, ARCH_CONVERT)))) {
337 INT_SET(d->d_itimer, ARCH_CONVERT, 341 INT_SET(d->d_itimer, ARCH_CONVERT,
338 get_seconds() + XFS_QI_ITIMELIMIT(mp)); 342 get_seconds() + XFS_QI_ITIMELIMIT(mp));
343 } else {
344 d->d_iwarns = 0;
339 } 345 }
340 } else { 346 } else {
341 if ((!d->d_ino_softlimit || 347 if ((!d->d_ino_softlimit ||
@@ -357,6 +363,8 @@ xfs_qm_adjust_dqtimers(
357 INT_GET(d->d_rtb_hardlimit, ARCH_CONVERT)))) { 363 INT_GET(d->d_rtb_hardlimit, ARCH_CONVERT)))) {
358 INT_SET(d->d_rtbtimer, ARCH_CONVERT, 364 INT_SET(d->d_rtbtimer, ARCH_CONVERT,
359 get_seconds() + XFS_QI_RTBTIMELIMIT(mp)); 365 get_seconds() + XFS_QI_RTBTIMELIMIT(mp));
366 } else {
367 d->d_rtbwarns = 0;
360 } 368 }
361 } else { 369 } else {
362 if ((!d->d_rtb_softlimit || 370 if ((!d->d_rtb_softlimit ||
@@ -371,68 +379,6 @@ xfs_qm_adjust_dqtimers(
371} 379}
372 380
373/* 381/*
374 * Increment or reset warnings of a given dquot.
375 */
376int
377xfs_qm_dqwarn(
378 xfs_disk_dquot_t *d,
379 uint flags)
380{
381 int warned;
382
383 /*
384 * root's limits are not real limits.
385 */
386 if (!d->d_id)
387 return (0);
388
389 warned = 0;
390 if (INT_GET(d->d_blk_softlimit, ARCH_CONVERT) &&
391 (INT_GET(d->d_bcount, ARCH_CONVERT) >=
392 INT_GET(d->d_blk_softlimit, ARCH_CONVERT))) {
393 if (flags & XFS_QMOPT_DOWARN) {
394 INT_MOD(d->d_bwarns, ARCH_CONVERT, +1);
395 warned++;
396 }
397 } else {
398 if (!d->d_blk_softlimit ||
399 (INT_GET(d->d_bcount, ARCH_CONVERT) <
400 INT_GET(d->d_blk_softlimit, ARCH_CONVERT))) {
401 d->d_bwarns = 0;
402 }
403 }
404
405 if (INT_GET(d->d_ino_softlimit, ARCH_CONVERT) > 0 &&
406 (INT_GET(d->d_icount, ARCH_CONVERT) >=
407 INT_GET(d->d_ino_softlimit, ARCH_CONVERT))) {
408 if (flags & XFS_QMOPT_DOWARN) {
409 INT_MOD(d->d_iwarns, ARCH_CONVERT, +1);
410 warned++;
411 }
412 } else {
413 if (!d->d_ino_softlimit ||
414 (INT_GET(d->d_icount, ARCH_CONVERT) <
415 INT_GET(d->d_ino_softlimit, ARCH_CONVERT))) {
416 d->d_iwarns = 0;
417 }
418 }
419#ifdef QUOTADEBUG
420 if (INT_GET(d->d_iwarns, ARCH_CONVERT))
421 cmn_err(CE_DEBUG,
422 "--------@@Inode warnings running : %Lu >= %Lu",
423 INT_GET(d->d_icount, ARCH_CONVERT),
424 INT_GET(d->d_ino_softlimit, ARCH_CONVERT));
425 if (INT_GET(d->d_bwarns, ARCH_CONVERT))
426 cmn_err(CE_DEBUG,
427 "--------@@Blks warnings running : %Lu >= %Lu",
428 INT_GET(d->d_bcount, ARCH_CONVERT),
429 INT_GET(d->d_blk_softlimit, ARCH_CONVERT));
430#endif
431 return (warned);
432}
433
434
435/*
436 * initialize a buffer full of dquots and log the whole thing 382 * initialize a buffer full of dquots and log the whole thing
437 */ 383 */
438STATIC void 384STATIC void
@@ -461,9 +407,9 @@ xfs_qm_init_dquot_blk(
461 for (i = 0; i < XFS_QM_DQPERBLK(mp); i++, d++, curid++) 407 for (i = 0; i < XFS_QM_DQPERBLK(mp); i++, d++, curid++)
462 xfs_qm_dqinit_core(curid, type, d); 408 xfs_qm_dqinit_core(curid, type, d);
463 xfs_trans_dquot_buf(tp, bp, 409 xfs_trans_dquot_buf(tp, bp,
464 type & XFS_DQ_USER ? 410 (type & XFS_DQ_USER ? XFS_BLI_UDQUOT_BUF :
465 XFS_BLI_UDQUOT_BUF : 411 ((type & XFS_DQ_PROJ) ? XFS_BLI_PDQUOT_BUF :
466 XFS_BLI_GDQUOT_BUF); 412 XFS_BLI_GDQUOT_BUF)));
467 xfs_trans_log_buf(tp, bp, 0, BBTOB(XFS_QI_DQCHUNKLEN(mp)) - 1); 413 xfs_trans_log_buf(tp, bp, 0, BBTOB(XFS_QI_DQCHUNKLEN(mp)) - 1);
468} 414}
469 415
@@ -544,8 +490,7 @@ xfs_qm_dqalloc(
544 * the entire thing. 490 * the entire thing.
545 */ 491 */
546 xfs_qm_init_dquot_blk(tp, mp, INT_GET(dqp->q_core.d_id, ARCH_CONVERT), 492 xfs_qm_init_dquot_blk(tp, mp, INT_GET(dqp->q_core.d_id, ARCH_CONVERT),
547 dqp->dq_flags & (XFS_DQ_USER|XFS_DQ_GROUP), 493 dqp->dq_flags & XFS_DQ_ALLTYPES, bp);
548 bp);
549 494
550 if ((error = xfs_bmap_finish(&tp, &flist, firstblock, &committed))) { 495 if ((error = xfs_bmap_finish(&tp, &flist, firstblock, &committed))) {
551 goto error1; 496 goto error1;
@@ -675,8 +620,7 @@ xfs_qm_dqtobp(
675 /* 620 /*
676 * A simple sanity check in case we got a corrupted dquot... 621 * A simple sanity check in case we got a corrupted dquot...
677 */ 622 */
678 if (xfs_qm_dqcheck(ddq, id, 623 if (xfs_qm_dqcheck(ddq, id, dqp->dq_flags & XFS_DQ_ALLTYPES,
679 dqp->dq_flags & (XFS_DQ_USER|XFS_DQ_GROUP),
680 flags & (XFS_QMOPT_DQREPAIR|XFS_QMOPT_DOWARN), 624 flags & (XFS_QMOPT_DQREPAIR|XFS_QMOPT_DOWARN),
681 "dqtobp")) { 625 "dqtobp")) {
682 if (!(flags & XFS_QMOPT_DQREPAIR)) { 626 if (!(flags & XFS_QMOPT_DQREPAIR)) {
@@ -953,8 +897,8 @@ int
953xfs_qm_dqget( 897xfs_qm_dqget(
954 xfs_mount_t *mp, 898 xfs_mount_t *mp,
955 xfs_inode_t *ip, /* locked inode (optional) */ 899 xfs_inode_t *ip, /* locked inode (optional) */
956 xfs_dqid_t id, /* gid or uid, depending on type */ 900 xfs_dqid_t id, /* uid/projid/gid depending on type */
957 uint type, /* UDQUOT or GDQUOT */ 901 uint type, /* XFS_DQ_USER/XFS_DQ_PROJ/XFS_DQ_GROUP */
958 uint flags, /* DQALLOC, DQSUSER, DQREPAIR, DOWARN */ 902 uint flags, /* DQALLOC, DQSUSER, DQREPAIR, DOWARN */
959 xfs_dquot_t **O_dqpp) /* OUT : locked incore dquot */ 903 xfs_dquot_t **O_dqpp) /* OUT : locked incore dquot */
960{ 904{
@@ -965,6 +909,7 @@ xfs_qm_dqget(
965 909
966 ASSERT(XFS_IS_QUOTA_RUNNING(mp)); 910 ASSERT(XFS_IS_QUOTA_RUNNING(mp));
967 if ((! XFS_IS_UQUOTA_ON(mp) && type == XFS_DQ_USER) || 911 if ((! XFS_IS_UQUOTA_ON(mp) && type == XFS_DQ_USER) ||
912 (! XFS_IS_PQUOTA_ON(mp) && type == XFS_DQ_PROJ) ||
968 (! XFS_IS_GQUOTA_ON(mp) && type == XFS_DQ_GROUP)) { 913 (! XFS_IS_GQUOTA_ON(mp) && type == XFS_DQ_GROUP)) {
969 return (ESRCH); 914 return (ESRCH);
970 } 915 }
@@ -983,7 +928,9 @@ xfs_qm_dqget(
983 again: 928 again:
984 929
985#ifdef DEBUG 930#ifdef DEBUG
986 ASSERT(type == XFS_DQ_USER || type == XFS_DQ_GROUP); 931 ASSERT(type == XFS_DQ_USER ||
932 type == XFS_DQ_PROJ ||
933 type == XFS_DQ_GROUP);
987 if (ip) { 934 if (ip) {
988 ASSERT(XFS_ISLOCKED_INODE_EXCL(ip)); 935 ASSERT(XFS_ISLOCKED_INODE_EXCL(ip));
989 if (type == XFS_DQ_USER) 936 if (type == XFS_DQ_USER)
@@ -1306,8 +1253,8 @@ xfs_qm_dqflush(
1306 return (error); 1253 return (error);
1307 } 1254 }
1308 1255
1309 if (xfs_qm_dqcheck(&dqp->q_core, INT_GET(ddqp->d_id, ARCH_CONVERT), 0, XFS_QMOPT_DOWARN, 1256 if (xfs_qm_dqcheck(&dqp->q_core, INT_GET(ddqp->d_id, ARCH_CONVERT),
1310 "dqflush (incore copy)")) { 1257 0, XFS_QMOPT_DOWARN, "dqflush (incore copy)")) {
1311 xfs_force_shutdown(dqp->q_mount, XFS_CORRUPT_INCORE); 1258 xfs_force_shutdown(dqp->q_mount, XFS_CORRUPT_INCORE);
1312 return XFS_ERROR(EIO); 1259 return XFS_ERROR(EIO);
1313 } 1260 }
@@ -1459,7 +1406,8 @@ xfs_dqlock2(
1459{ 1406{
1460 if (d1 && d2) { 1407 if (d1 && d2) {
1461 ASSERT(d1 != d2); 1408 ASSERT(d1 != d2);
1462 if (INT_GET(d1->q_core.d_id, ARCH_CONVERT) > INT_GET(d2->q_core.d_id, ARCH_CONVERT)) { 1409 if (INT_GET(d1->q_core.d_id, ARCH_CONVERT) >
1410 INT_GET(d2->q_core.d_id, ARCH_CONVERT)) {
1463 xfs_dqlock(d2); 1411 xfs_dqlock(d2);
1464 xfs_dqlock(d1); 1412 xfs_dqlock(d1);
1465 } else { 1413 } else {
@@ -1582,8 +1530,7 @@ xfs_qm_dqprint(xfs_dquot_t *dqp)
1582 cmn_err(CE_DEBUG, "-----------KERNEL DQUOT----------------"); 1530 cmn_err(CE_DEBUG, "-----------KERNEL DQUOT----------------");
1583 cmn_err(CE_DEBUG, "---- dquotID = %d", 1531 cmn_err(CE_DEBUG, "---- dquotID = %d",
1584 (int)INT_GET(dqp->q_core.d_id, ARCH_CONVERT)); 1532 (int)INT_GET(dqp->q_core.d_id, ARCH_CONVERT));
1585 cmn_err(CE_DEBUG, "---- type = %s", 1533 cmn_err(CE_DEBUG, "---- type = %s", DQFLAGTO_TYPESTR(dqp));
1586 XFS_QM_ISUDQ(dqp) ? "USR" : "GRP");
1587 cmn_err(CE_DEBUG, "---- fs = 0x%p", dqp->q_mount); 1534 cmn_err(CE_DEBUG, "---- fs = 0x%p", dqp->q_mount);
1588 cmn_err(CE_DEBUG, "---- blkno = 0x%x", (int) dqp->q_blkno); 1535 cmn_err(CE_DEBUG, "---- blkno = 0x%x", (int) dqp->q_blkno);
1589 cmn_err(CE_DEBUG, "---- boffset = 0x%x", (int) dqp->q_bufoffset); 1536 cmn_err(CE_DEBUG, "---- boffset = 0x%x", (int) dqp->q_bufoffset);
diff --git a/fs/xfs/quota/xfs_dquot.h b/fs/xfs/quota/xfs_dquot.h
index 0c3fe3175baa..39175103c8e0 100644
--- a/fs/xfs/quota/xfs_dquot.h
+++ b/fs/xfs/quota/xfs_dquot.h
@@ -114,25 +114,18 @@ typedef struct xfs_dquot {
114#define XFS_DQHOLD(dqp) ((dqp)->q_nrefs++) 114#define XFS_DQHOLD(dqp) ((dqp)->q_nrefs++)
115 115
116/* 116/*
117 * Quota Accounting flags 117 * Quota Accounting/Enforcement flags
118 */ 118 */
119#define XFS_ALL_QUOTA_ACCT (XFS_UQUOTA_ACCT | XFS_GQUOTA_ACCT) 119#define XFS_ALL_QUOTA_ACCT \
120#define XFS_ALL_QUOTA_ENFD (XFS_UQUOTA_ENFD | XFS_GQUOTA_ENFD) 120 (XFS_UQUOTA_ACCT | XFS_GQUOTA_ACCT | XFS_PQUOTA_ACCT)
121#define XFS_ALL_QUOTA_CHKD (XFS_UQUOTA_CHKD | XFS_GQUOTA_CHKD) 121#define XFS_ALL_QUOTA_ENFD (XFS_UQUOTA_ENFD | XFS_OQUOTA_ENFD)
122#define XFS_ALL_QUOTA_ACTV (XFS_UQUOTA_ACTIVE | XFS_GQUOTA_ACTIVE) 122#define XFS_ALL_QUOTA_CHKD (XFS_UQUOTA_CHKD | XFS_OQUOTA_CHKD)
123#define XFS_ALL_QUOTA_ACCT_ENFD (XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD|\
124 XFS_GQUOTA_ACCT|XFS_GQUOTA_ENFD)
125 123
126#define XFS_IS_QUOTA_RUNNING(mp) ((mp)->m_qflags & XFS_ALL_QUOTA_ACCT) 124#define XFS_IS_QUOTA_RUNNING(mp) ((mp)->m_qflags & XFS_ALL_QUOTA_ACCT)
127#define XFS_IS_UQUOTA_RUNNING(mp) ((mp)->m_qflags & XFS_UQUOTA_ACCT)
128#define XFS_IS_GQUOTA_RUNNING(mp) ((mp)->m_qflags & XFS_GQUOTA_ACCT)
129
130/*
131 * Quota Limit Enforcement flags
132 */
133#define XFS_IS_QUOTA_ENFORCED(mp) ((mp)->m_qflags & XFS_ALL_QUOTA_ENFD) 125#define XFS_IS_QUOTA_ENFORCED(mp) ((mp)->m_qflags & XFS_ALL_QUOTA_ENFD)
134#define XFS_IS_UQUOTA_ENFORCED(mp) ((mp)->m_qflags & XFS_UQUOTA_ENFD) 126#define XFS_IS_UQUOTA_RUNNING(mp) ((mp)->m_qflags & XFS_UQUOTA_ACCT)
135#define XFS_IS_GQUOTA_ENFORCED(mp) ((mp)->m_qflags & XFS_GQUOTA_ENFD) 127#define XFS_IS_PQUOTA_RUNNING(mp) ((mp)->m_qflags & XFS_PQUOTA_ACCT)
128#define XFS_IS_GQUOTA_RUNNING(mp) ((mp)->m_qflags & XFS_GQUOTA_ACCT)
136 129
137#ifdef DEBUG 130#ifdef DEBUG
138static inline int 131static inline int
@@ -167,6 +160,8 @@ XFS_DQ_IS_LOCKED(xfs_dquot_t *dqp)
167#define XFS_DQ_IS_ON_FREELIST(dqp) ((dqp)->dq_flnext != (dqp)) 160#define XFS_DQ_IS_ON_FREELIST(dqp) ((dqp)->dq_flnext != (dqp))
168#define XFS_DQ_IS_DIRTY(dqp) ((dqp)->dq_flags & XFS_DQ_DIRTY) 161#define XFS_DQ_IS_DIRTY(dqp) ((dqp)->dq_flags & XFS_DQ_DIRTY)
169#define XFS_QM_ISUDQ(dqp) ((dqp)->dq_flags & XFS_DQ_USER) 162#define XFS_QM_ISUDQ(dqp) ((dqp)->dq_flags & XFS_DQ_USER)
163#define XFS_QM_ISPDQ(dqp) ((dqp)->dq_flags & XFS_DQ_PROJ)
164#define XFS_QM_ISGDQ(dqp) ((dqp)->dq_flags & XFS_DQ_GROUP)
170#define XFS_DQ_TO_QINF(dqp) ((dqp)->q_mount->m_quotainfo) 165#define XFS_DQ_TO_QINF(dqp) ((dqp)->q_mount->m_quotainfo)
171#define XFS_DQ_TO_QIP(dqp) (XFS_QM_ISUDQ(dqp) ? \ 166#define XFS_DQ_TO_QIP(dqp) (XFS_QM_ISUDQ(dqp) ? \
172 XFS_DQ_TO_QINF(dqp)->qi_uquotaip : \ 167 XFS_DQ_TO_QINF(dqp)->qi_uquotaip : \
@@ -174,7 +169,7 @@ XFS_DQ_IS_LOCKED(xfs_dquot_t *dqp)
174 169
175#define XFS_IS_THIS_QUOTA_OFF(d) (! (XFS_QM_ISUDQ(d) ? \ 170#define XFS_IS_THIS_QUOTA_OFF(d) (! (XFS_QM_ISUDQ(d) ? \
176 (XFS_IS_UQUOTA_ON((d)->q_mount)) : \ 171 (XFS_IS_UQUOTA_ON((d)->q_mount)) : \
177 (XFS_IS_GQUOTA_ON((d)->q_mount)))) 172 (XFS_IS_OQUOTA_ON((d)->q_mount))))
178 173
179#ifdef XFS_DQUOT_TRACE 174#ifdef XFS_DQUOT_TRACE
180/* 175/*
@@ -211,7 +206,6 @@ extern void xfs_qm_adjust_dqtimers(xfs_mount_t *,
211 xfs_disk_dquot_t *); 206 xfs_disk_dquot_t *);
212extern void xfs_qm_adjust_dqlimits(xfs_mount_t *, 207extern void xfs_qm_adjust_dqlimits(xfs_mount_t *,
213 xfs_disk_dquot_t *); 208 xfs_disk_dquot_t *);
214extern int xfs_qm_dqwarn(xfs_disk_dquot_t *, uint);
215extern int xfs_qm_dqget(xfs_mount_t *, xfs_inode_t *, 209extern int xfs_qm_dqget(xfs_mount_t *, xfs_inode_t *,
216 xfs_dqid_t, uint, uint, xfs_dquot_t **); 210 xfs_dqid_t, uint, uint, xfs_dquot_t **);
217extern void xfs_qm_dqput(xfs_dquot_t *); 211extern void xfs_qm_dqput(xfs_dquot_t *);
diff --git a/fs/xfs/quota/xfs_dquot_item.c b/fs/xfs/quota/xfs_dquot_item.c
index a5425ee6e7bd..f5271b7b1e84 100644
--- a/fs/xfs/quota/xfs_dquot_item.c
+++ b/fs/xfs/quota/xfs_dquot_item.c
@@ -428,7 +428,7 @@ xfs_qm_dquot_logitem_committing(
428/* 428/*
429 * This is the ops vector for dquots 429 * This is the ops vector for dquots
430 */ 430 */
431struct xfs_item_ops xfs_dquot_item_ops = { 431STATIC struct xfs_item_ops xfs_dquot_item_ops = {
432 .iop_size = (uint(*)(xfs_log_item_t*))xfs_qm_dquot_logitem_size, 432 .iop_size = (uint(*)(xfs_log_item_t*))xfs_qm_dquot_logitem_size,
433 .iop_format = (void(*)(xfs_log_item_t*, xfs_log_iovec_t*)) 433 .iop_format = (void(*)(xfs_log_item_t*, xfs_log_iovec_t*))
434 xfs_qm_dquot_logitem_format, 434 xfs_qm_dquot_logitem_format,
@@ -646,7 +646,7 @@ xfs_qm_qoffend_logitem_committing(xfs_qoff_logitem_t *qip, xfs_lsn_t commit_lsn)
646 return; 646 return;
647} 647}
648 648
649struct xfs_item_ops xfs_qm_qoffend_logitem_ops = { 649STATIC struct xfs_item_ops xfs_qm_qoffend_logitem_ops = {
650 .iop_size = (uint(*)(xfs_log_item_t*))xfs_qm_qoff_logitem_size, 650 .iop_size = (uint(*)(xfs_log_item_t*))xfs_qm_qoff_logitem_size,
651 .iop_format = (void(*)(xfs_log_item_t*, xfs_log_iovec_t*)) 651 .iop_format = (void(*)(xfs_log_item_t*, xfs_log_iovec_t*))
652 xfs_qm_qoff_logitem_format, 652 xfs_qm_qoff_logitem_format,
@@ -669,7 +669,7 @@ struct xfs_item_ops xfs_qm_qoffend_logitem_ops = {
669/* 669/*
670 * This is the ops vector shared by all quotaoff-start log items. 670 * This is the ops vector shared by all quotaoff-start log items.
671 */ 671 */
672struct xfs_item_ops xfs_qm_qoff_logitem_ops = { 672STATIC struct xfs_item_ops xfs_qm_qoff_logitem_ops = {
673 .iop_size = (uint(*)(xfs_log_item_t*))xfs_qm_qoff_logitem_size, 673 .iop_size = (uint(*)(xfs_log_item_t*))xfs_qm_qoff_logitem_size,
674 .iop_format = (void(*)(xfs_log_item_t*, xfs_log_iovec_t*)) 674 .iop_format = (void(*)(xfs_log_item_t*, xfs_log_iovec_t*))
675 xfs_qm_qoff_logitem_format, 675 xfs_qm_qoff_logitem_format,
diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/quota/xfs_qm.c
index 89f2cd656ebf..f665ca8f9e96 100644
--- a/fs/xfs/quota/xfs_qm.c
+++ b/fs/xfs/quota/xfs_qm.c
@@ -81,12 +81,18 @@ struct xfs_qm *xfs_Gqm;
81 81
82kmem_zone_t *qm_dqzone; 82kmem_zone_t *qm_dqzone;
83kmem_zone_t *qm_dqtrxzone; 83kmem_zone_t *qm_dqtrxzone;
84kmem_shaker_t xfs_qm_shaker; 84STATIC kmem_shaker_t xfs_qm_shaker;
85 85
86STATIC void xfs_qm_list_init(xfs_dqlist_t *, char *, int); 86STATIC void xfs_qm_list_init(xfs_dqlist_t *, char *, int);
87STATIC void xfs_qm_list_destroy(xfs_dqlist_t *); 87STATIC void xfs_qm_list_destroy(xfs_dqlist_t *);
88 88
89STATIC void xfs_qm_freelist_init(xfs_frlist_t *);
90STATIC void xfs_qm_freelist_destroy(xfs_frlist_t *);
91STATIC int xfs_qm_mplist_nowait(xfs_mount_t *);
92STATIC int xfs_qm_dqhashlock_nowait(xfs_dquot_t *);
93
89STATIC int xfs_qm_init_quotainos(xfs_mount_t *); 94STATIC int xfs_qm_init_quotainos(xfs_mount_t *);
95STATIC int xfs_qm_init_quotainfo(xfs_mount_t *);
90STATIC int xfs_qm_shake(int, unsigned int); 96STATIC int xfs_qm_shake(int, unsigned int);
91 97
92#ifdef DEBUG 98#ifdef DEBUG
@@ -184,7 +190,7 @@ xfs_Gqm_init(void)
184/* 190/*
185 * Destroy the global quota manager when its reference count goes to zero. 191 * Destroy the global quota manager when its reference count goes to zero.
186 */ 192 */
187void 193STATIC void
188xfs_qm_destroy( 194xfs_qm_destroy(
189 struct xfs_qm *xqm) 195 struct xfs_qm *xqm)
190{ 196{
@@ -304,9 +310,9 @@ xfs_qm_mount_quotainit(
304 uint flags) 310 uint flags)
305{ 311{
306 /* 312 /*
307 * User or group quotas has to be on. 313 * User, projects or group quotas has to be on.
308 */ 314 */
309 ASSERT(flags & (XFSMNT_UQUOTA | XFSMNT_GQUOTA)); 315 ASSERT(flags & (XFSMNT_UQUOTA | XFSMNT_PQUOTA | XFSMNT_GQUOTA));
310 316
311 /* 317 /*
312 * Initialize the flags in the mount structure. From this point 318 * Initialize the flags in the mount structure. From this point
@@ -324,7 +330,11 @@ xfs_qm_mount_quotainit(
324 if (flags & XFSMNT_GQUOTA) { 330 if (flags & XFSMNT_GQUOTA) {
325 mp->m_qflags |= (XFS_GQUOTA_ACCT | XFS_GQUOTA_ACTIVE); 331 mp->m_qflags |= (XFS_GQUOTA_ACCT | XFS_GQUOTA_ACTIVE);
326 if (flags & XFSMNT_GQUOTAENF) 332 if (flags & XFSMNT_GQUOTAENF)
327 mp->m_qflags |= XFS_GQUOTA_ENFD; 333 mp->m_qflags |= XFS_OQUOTA_ENFD;
334 } else if (flags & XFSMNT_PQUOTA) {
335 mp->m_qflags |= (XFS_PQUOTA_ACCT | XFS_PQUOTA_ACTIVE);
336 if (flags & XFSMNT_PQUOTAENF)
337 mp->m_qflags |= XFS_OQUOTA_ENFD;
328 } 338 }
329} 339}
330 340
@@ -357,11 +367,11 @@ xfs_qm_mount_quotas(
357 367
358 /* 368 /*
359 * If a file system had quotas running earlier, but decided to 369 * If a file system had quotas running earlier, but decided to
360 * mount without -o quota/uquota/gquota options, revoke the 370 * mount without -o uquota/pquota/gquota options, revoke the
361 * quotachecked license, and bail out. 371 * quotachecked license, and bail out.
362 */ 372 */
363 if (! XFS_IS_QUOTA_ON(mp) && 373 if (! XFS_IS_QUOTA_ON(mp) &&
364 (mp->m_sb.sb_qflags & (XFS_UQUOTA_ACCT|XFS_GQUOTA_ACCT))) { 374 (mp->m_sb.sb_qflags & XFS_ALL_QUOTA_ACCT)) {
365 mp->m_qflags = 0; 375 mp->m_qflags = 0;
366 goto write_changes; 376 goto write_changes;
367 } 377 }
@@ -509,7 +519,7 @@ out:
509 * Flush all dquots of the given file system to disk. The dquots are 519 * Flush all dquots of the given file system to disk. The dquots are
510 * _not_ purged from memory here, just their data written to disk. 520 * _not_ purged from memory here, just their data written to disk.
511 */ 521 */
512int 522STATIC int
513xfs_qm_dqflush_all( 523xfs_qm_dqflush_all(
514 xfs_mount_t *mp, 524 xfs_mount_t *mp,
515 int flags) 525 int flags)
@@ -613,7 +623,7 @@ xfs_qm_detach_gdquots(
613STATIC int 623STATIC int
614xfs_qm_dqpurge_int( 624xfs_qm_dqpurge_int(
615 xfs_mount_t *mp, 625 xfs_mount_t *mp,
616 uint flags) /* QUOTAOFF/UMOUNTING/UQUOTA/GQUOTA */ 626 uint flags) /* QUOTAOFF/UMOUNTING/UQUOTA/PQUOTA/GQUOTA */
617{ 627{
618 xfs_dquot_t *dqp; 628 xfs_dquot_t *dqp;
619 uint dqtype; 629 uint dqtype;
@@ -625,6 +635,7 @@ xfs_qm_dqpurge_int(
625 return (0); 635 return (0);
626 636
627 dqtype = (flags & XFS_QMOPT_UQUOTA) ? XFS_DQ_USER : 0; 637 dqtype = (flags & XFS_QMOPT_UQUOTA) ? XFS_DQ_USER : 0;
638 dqtype |= (flags & XFS_QMOPT_PQUOTA) ? XFS_DQ_PROJ : 0;
628 dqtype |= (flags & XFS_QMOPT_GQUOTA) ? XFS_DQ_GROUP : 0; 639 dqtype |= (flags & XFS_QMOPT_GQUOTA) ? XFS_DQ_GROUP : 0;
629 640
630 xfs_qm_mplist_lock(mp); 641 xfs_qm_mplist_lock(mp);
@@ -734,11 +745,11 @@ xfs_qm_dqattach_one(
734 745
735 /* 746 /*
736 * udqhint is the i_udquot field in inode, and is non-NULL only 747 * udqhint is the i_udquot field in inode, and is non-NULL only
737 * when the type arg is XFS_DQ_GROUP. Its purpose is to save a 748 * when the type arg is group/project. Its purpose is to save a
738 * lookup by dqid (xfs_qm_dqget) by caching a group dquot inside 749 * lookup by dqid (xfs_qm_dqget) by caching a group dquot inside
739 * the user dquot. 750 * the user dquot.
740 */ 751 */
741 ASSERT(!udqhint || type == XFS_DQ_GROUP); 752 ASSERT(!udqhint || type == XFS_DQ_GROUP || type == XFS_DQ_PROJ);
742 if (udqhint && !dolock) 753 if (udqhint && !dolock)
743 xfs_dqlock(udqhint); 754 xfs_dqlock(udqhint);
744 755
@@ -897,8 +908,8 @@ xfs_qm_dqattach_grouphint(
897 908
898 909
899/* 910/*
900 * Given a locked inode, attach dquot(s) to it, taking UQUOTAON / GQUOTAON 911 * Given a locked inode, attach dquot(s) to it, taking U/G/P-QUOTAON
901 * in to account. 912 * into account.
902 * If XFS_QMOPT_DQALLOC, the dquot(s) will be allocated if needed. 913 * If XFS_QMOPT_DQALLOC, the dquot(s) will be allocated if needed.
903 * If XFS_QMOPT_DQLOCK, the dquot(s) will be returned locked. This option pretty 914 * If XFS_QMOPT_DQLOCK, the dquot(s) will be returned locked. This option pretty
904 * much made this code a complete mess, but it has been pretty useful. 915 * much made this code a complete mess, but it has been pretty useful.
@@ -937,8 +948,13 @@ xfs_qm_dqattach(
937 nquotas++; 948 nquotas++;
938 } 949 }
939 ASSERT(XFS_ISLOCKED_INODE_EXCL(ip)); 950 ASSERT(XFS_ISLOCKED_INODE_EXCL(ip));
940 if (XFS_IS_GQUOTA_ON(mp)) { 951 if (XFS_IS_OQUOTA_ON(mp)) {
941 error = xfs_qm_dqattach_one(ip, ip->i_d.di_gid, XFS_DQ_GROUP, 952 error = XFS_IS_GQUOTA_ON(mp) ?
953 xfs_qm_dqattach_one(ip, ip->i_d.di_gid, XFS_DQ_GROUP,
954 flags & XFS_QMOPT_DQALLOC,
955 flags & XFS_QMOPT_DQLOCK,
956 ip->i_udquot, &ip->i_gdquot) :
957 xfs_qm_dqattach_one(ip, ip->i_d.di_projid, XFS_DQ_PROJ,
942 flags & XFS_QMOPT_DQALLOC, 958 flags & XFS_QMOPT_DQALLOC,
943 flags & XFS_QMOPT_DQLOCK, 959 flags & XFS_QMOPT_DQLOCK,
944 ip->i_udquot, &ip->i_gdquot); 960 ip->i_udquot, &ip->i_gdquot);
@@ -989,7 +1005,7 @@ xfs_qm_dqattach(
989 } 1005 }
990 if (XFS_IS_UQUOTA_ON(mp)) 1006 if (XFS_IS_UQUOTA_ON(mp))
991 ASSERT(ip->i_udquot); 1007 ASSERT(ip->i_udquot);
992 if (XFS_IS_GQUOTA_ON(mp)) 1008 if (XFS_IS_OQUOTA_ON(mp))
993 ASSERT(ip->i_gdquot); 1009 ASSERT(ip->i_gdquot);
994 } 1010 }
995#endif 1011#endif
@@ -1018,13 +1034,13 @@ xfs_qm_dqdetach(
1018 1034
1019 ASSERT(ip->i_ino != ip->i_mount->m_sb.sb_uquotino); 1035 ASSERT(ip->i_ino != ip->i_mount->m_sb.sb_uquotino);
1020 ASSERT(ip->i_ino != ip->i_mount->m_sb.sb_gquotino); 1036 ASSERT(ip->i_ino != ip->i_mount->m_sb.sb_gquotino);
1021 if (ip->i_udquot)
1022 xfs_dqtrace_entry_ino(ip->i_udquot, "DQDETTACH", ip);
1023 if (ip->i_udquot) { 1037 if (ip->i_udquot) {
1038 xfs_dqtrace_entry_ino(ip->i_udquot, "DQDETTACH", ip);
1024 xfs_qm_dqrele(ip->i_udquot); 1039 xfs_qm_dqrele(ip->i_udquot);
1025 ip->i_udquot = NULL; 1040 ip->i_udquot = NULL;
1026 } 1041 }
1027 if (ip->i_gdquot) { 1042 if (ip->i_gdquot) {
1043 xfs_dqtrace_entry_ino(ip->i_gdquot, "DQDETTACH", ip);
1028 xfs_qm_dqrele(ip->i_gdquot); 1044 xfs_qm_dqrele(ip->i_gdquot);
1029 ip->i_gdquot = NULL; 1045 ip->i_gdquot = NULL;
1030 } 1046 }
@@ -1149,7 +1165,7 @@ xfs_qm_sync(
1149 * This initializes all the quota information that's kept in the 1165 * This initializes all the quota information that's kept in the
1150 * mount structure 1166 * mount structure
1151 */ 1167 */
1152int 1168STATIC int
1153xfs_qm_init_quotainfo( 1169xfs_qm_init_quotainfo(
1154 xfs_mount_t *mp) 1170 xfs_mount_t *mp)
1155{ 1171{
@@ -1202,8 +1218,9 @@ xfs_qm_init_quotainfo(
1202 * and group quotas, at least not at this point. 1218 * and group quotas, at least not at this point.
1203 */ 1219 */
1204 error = xfs_qm_dqget(mp, NULL, (xfs_dqid_t)0, 1220 error = xfs_qm_dqget(mp, NULL, (xfs_dqid_t)0,
1205 (XFS_IS_UQUOTA_RUNNING(mp)) ? 1221 XFS_IS_UQUOTA_RUNNING(mp) ? XFS_DQ_USER :
1206 XFS_DQ_USER : XFS_DQ_GROUP, 1222 (XFS_IS_GQUOTA_RUNNING(mp) ? XFS_DQ_GROUP :
1223 XFS_DQ_PROJ),
1207 XFS_QMOPT_DQSUSER|XFS_QMOPT_DOWARN, 1224 XFS_QMOPT_DQSUSER|XFS_QMOPT_DOWARN,
1208 &dqp); 1225 &dqp);
1209 if (! error) { 1226 if (! error) {
@@ -1234,6 +1251,10 @@ xfs_qm_init_quotainfo(
1234 INT_GET(ddqp->d_iwarns, ARCH_CONVERT) ? 1251 INT_GET(ddqp->d_iwarns, ARCH_CONVERT) ?
1235 INT_GET(ddqp->d_iwarns, ARCH_CONVERT) : 1252 INT_GET(ddqp->d_iwarns, ARCH_CONVERT) :
1236 XFS_QM_IWARNLIMIT; 1253 XFS_QM_IWARNLIMIT;
1254 qinf->qi_rtbwarnlimit =
1255 INT_GET(ddqp->d_rtbwarns, ARCH_CONVERT) ?
1256 INT_GET(ddqp->d_rtbwarns, ARCH_CONVERT) :
1257 XFS_QM_RTBWARNLIMIT;
1237 qinf->qi_bhardlimit = 1258 qinf->qi_bhardlimit =
1238 INT_GET(ddqp->d_blk_hardlimit, ARCH_CONVERT); 1259 INT_GET(ddqp->d_blk_hardlimit, ARCH_CONVERT);
1239 qinf->qi_bsoftlimit = 1260 qinf->qi_bsoftlimit =
@@ -1259,6 +1280,7 @@ xfs_qm_init_quotainfo(
1259 qinf->qi_rtbtimelimit = XFS_QM_RTBTIMELIMIT; 1280 qinf->qi_rtbtimelimit = XFS_QM_RTBTIMELIMIT;
1260 qinf->qi_bwarnlimit = XFS_QM_BWARNLIMIT; 1281 qinf->qi_bwarnlimit = XFS_QM_BWARNLIMIT;
1261 qinf->qi_iwarnlimit = XFS_QM_IWARNLIMIT; 1282 qinf->qi_iwarnlimit = XFS_QM_IWARNLIMIT;
1283 qinf->qi_rtbwarnlimit = XFS_QM_RTBWARNLIMIT;
1262 } 1284 }
1263 1285
1264 return (0); 1286 return (0);
@@ -1366,13 +1388,20 @@ xfs_qm_dqget_noattach(
1366 ASSERT(udqp); 1388 ASSERT(udqp);
1367 } 1389 }
1368 1390
1369 if (XFS_IS_GQUOTA_ON(mp)) { 1391 if (XFS_IS_OQUOTA_ON(mp)) {
1370 ASSERT(ip->i_gdquot == NULL); 1392 ASSERT(ip->i_gdquot == NULL);
1371 if (udqp) 1393 if (udqp)
1372 xfs_dqunlock(udqp); 1394 xfs_dqunlock(udqp);
1373 if ((error = xfs_qm_dqget(mp, ip, ip->i_d.di_gid, XFS_DQ_GROUP, 1395 error = XFS_IS_GQUOTA_ON(mp) ?
1374 XFS_QMOPT_DQALLOC|XFS_QMOPT_DOWARN, 1396 xfs_qm_dqget(mp, ip,
1375 &gdqp))) { 1397 ip->i_d.di_gid, XFS_DQ_GROUP,
1398 XFS_QMOPT_DQALLOC|XFS_QMOPT_DOWARN,
1399 &gdqp) :
1400 xfs_qm_dqget(mp, ip,
1401 ip->i_d.di_projid, XFS_DQ_PROJ,
1402 XFS_QMOPT_DQALLOC|XFS_QMOPT_DOWARN,
1403 &gdqp);
1404 if (error) {
1376 if (udqp) 1405 if (udqp)
1377 xfs_qm_dqrele(udqp); 1406 xfs_qm_dqrele(udqp);
1378 ASSERT(error != ESRCH); 1407 ASSERT(error != ESRCH);
@@ -1521,8 +1550,10 @@ xfs_qm_reset_dqcounts(
1521 INT_SET(ddq->d_rtbcount, ARCH_CONVERT, 0ULL); 1550 INT_SET(ddq->d_rtbcount, ARCH_CONVERT, 0ULL);
1522 INT_SET(ddq->d_btimer, ARCH_CONVERT, (time_t)0); 1551 INT_SET(ddq->d_btimer, ARCH_CONVERT, (time_t)0);
1523 INT_SET(ddq->d_itimer, ARCH_CONVERT, (time_t)0); 1552 INT_SET(ddq->d_itimer, ARCH_CONVERT, (time_t)0);
1553 INT_SET(ddq->d_rtbtimer, ARCH_CONVERT, (time_t)0);
1524 INT_SET(ddq->d_bwarns, ARCH_CONVERT, 0UL); 1554 INT_SET(ddq->d_bwarns, ARCH_CONVERT, 0UL);
1525 INT_SET(ddq->d_iwarns, ARCH_CONVERT, 0UL); 1555 INT_SET(ddq->d_iwarns, ARCH_CONVERT, 0UL);
1556 INT_SET(ddq->d_rtbwarns, ARCH_CONVERT, 0UL);
1526 ddq = (xfs_disk_dquot_t *) ((xfs_dqblk_t *)ddq + 1); 1557 ddq = (xfs_disk_dquot_t *) ((xfs_dqblk_t *)ddq + 1);
1527 } 1558 }
1528 1559
@@ -1541,11 +1572,14 @@ xfs_qm_dqiter_bufs(
1541 int error; 1572 int error;
1542 int notcommitted; 1573 int notcommitted;
1543 int incr; 1574 int incr;
1575 int type;
1544 1576
1545 ASSERT(blkcnt > 0); 1577 ASSERT(blkcnt > 0);
1546 notcommitted = 0; 1578 notcommitted = 0;
1547 incr = (blkcnt > XFS_QM_MAX_DQCLUSTER_LOGSZ) ? 1579 incr = (blkcnt > XFS_QM_MAX_DQCLUSTER_LOGSZ) ?
1548 XFS_QM_MAX_DQCLUSTER_LOGSZ : blkcnt; 1580 XFS_QM_MAX_DQCLUSTER_LOGSZ : blkcnt;
1581 type = flags & XFS_QMOPT_UQUOTA ? XFS_DQ_USER :
1582 (flags & XFS_QMOPT_PQUOTA ? XFS_DQ_PROJ : XFS_DQ_GROUP);
1549 error = 0; 1583 error = 0;
1550 1584
1551 /* 1585 /*
@@ -1564,9 +1598,7 @@ xfs_qm_dqiter_bufs(
1564 if (error) 1598 if (error)
1565 break; 1599 break;
1566 1600
1567 (void) xfs_qm_reset_dqcounts(mp, bp, firstid, 1601 (void) xfs_qm_reset_dqcounts(mp, bp, firstid, type);
1568 flags & XFS_QMOPT_UQUOTA ?
1569 XFS_DQ_USER : XFS_DQ_GROUP);
1570 xfs_bdwrite(mp, bp); 1602 xfs_bdwrite(mp, bp);
1571 /* 1603 /*
1572 * goto the next block. 1604 * goto the next block.
@@ -1578,7 +1610,7 @@ xfs_qm_dqiter_bufs(
1578} 1610}
1579 1611
1580/* 1612/*
1581 * Iterate over all allocated USR/GRP dquots in the system, calling a 1613 * Iterate over all allocated USR/GRP/PRJ dquots in the system, calling a
1582 * caller supplied function for every chunk of dquots that we find. 1614 * caller supplied function for every chunk of dquots that we find.
1583 */ 1615 */
1584STATIC int 1616STATIC int
@@ -1849,7 +1881,7 @@ xfs_qm_dqusage_adjust(
1849 xfs_qm_quotacheck_dqadjust(udqp, nblks, rtblks); 1881 xfs_qm_quotacheck_dqadjust(udqp, nblks, rtblks);
1850 xfs_qm_dqput(udqp); 1882 xfs_qm_dqput(udqp);
1851 } 1883 }
1852 if (XFS_IS_GQUOTA_ON(mp)) { 1884 if (XFS_IS_OQUOTA_ON(mp)) {
1853 ASSERT(gdqp); 1885 ASSERT(gdqp);
1854 xfs_qm_quotacheck_dqadjust(gdqp, nblks, rtblks); 1886 xfs_qm_quotacheck_dqadjust(gdqp, nblks, rtblks);
1855 xfs_qm_dqput(gdqp); 1887 xfs_qm_dqput(gdqp);
@@ -1898,7 +1930,7 @@ xfs_qm_quotacheck(
1898 cmn_err(CE_NOTE, "XFS quotacheck %s: Please wait.", mp->m_fsname); 1930 cmn_err(CE_NOTE, "XFS quotacheck %s: Please wait.", mp->m_fsname);
1899 1931
1900 /* 1932 /*
1901 * First we go thru all the dquots on disk, USR and GRP, and reset 1933 * First we go thru all the dquots on disk, USR and GRP/PRJ, and reset
1902 * their counters to zero. We need a clean slate. 1934 * their counters to zero. We need a clean slate.
1903 * We don't log our changes till later. 1935 * We don't log our changes till later.
1904 */ 1936 */
@@ -1909,9 +1941,10 @@ xfs_qm_quotacheck(
1909 } 1941 }
1910 1942
1911 if ((gip = XFS_QI_GQIP(mp))) { 1943 if ((gip = XFS_QI_GQIP(mp))) {
1912 if ((error = xfs_qm_dqiterate(mp, gip, XFS_QMOPT_GQUOTA))) 1944 if ((error = xfs_qm_dqiterate(mp, gip, XFS_IS_GQUOTA_ON(mp) ?
1945 XFS_QMOPT_GQUOTA : XFS_QMOPT_PQUOTA)))
1913 goto error_return; 1946 goto error_return;
1914 flags |= XFS_GQUOTA_CHKD; 1947 flags |= XFS_OQUOTA_CHKD;
1915 } 1948 }
1916 1949
1917 do { 1950 do {
@@ -1938,7 +1971,7 @@ xfs_qm_quotacheck(
1938 if (error) { 1971 if (error) {
1939 xfs_qm_dqpurge_all(mp, 1972 xfs_qm_dqpurge_all(mp,
1940 XFS_QMOPT_UQUOTA|XFS_QMOPT_GQUOTA| 1973 XFS_QMOPT_UQUOTA|XFS_QMOPT_GQUOTA|
1941 XFS_QMOPT_QUOTAOFF); 1974 XFS_QMOPT_PQUOTA|XFS_QMOPT_QUOTAOFF);
1942 goto error_return; 1975 goto error_return;
1943 } 1976 }
1944 /* 1977 /*
@@ -1961,7 +1994,7 @@ xfs_qm_quotacheck(
1961 * quotachecked status, since we won't be doing accounting for 1994 * quotachecked status, since we won't be doing accounting for
1962 * that type anymore. 1995 * that type anymore.
1963 */ 1996 */
1964 mp->m_qflags &= ~(XFS_GQUOTA_CHKD | XFS_UQUOTA_CHKD); 1997 mp->m_qflags &= ~(XFS_OQUOTA_CHKD | XFS_UQUOTA_CHKD);
1965 mp->m_qflags |= flags; 1998 mp->m_qflags |= flags;
1966 1999
1967 XQM_LIST_PRINT(&(XFS_QI_MPL_LIST(mp)), MPL_NEXT, "++++ Mp list +++"); 2000 XQM_LIST_PRINT(&(XFS_QI_MPL_LIST(mp)), MPL_NEXT, "++++ Mp list +++");
@@ -2013,7 +2046,7 @@ xfs_qm_init_quotainos(
2013 0, 0, &uip, 0))) 2046 0, 0, &uip, 0)))
2014 return XFS_ERROR(error); 2047 return XFS_ERROR(error);
2015 } 2048 }
2016 if (XFS_IS_GQUOTA_ON(mp) && 2049 if (XFS_IS_OQUOTA_ON(mp) &&
2017 mp->m_sb.sb_gquotino != NULLFSINO) { 2050 mp->m_sb.sb_gquotino != NULLFSINO) {
2018 ASSERT(mp->m_sb.sb_gquotino > 0); 2051 ASSERT(mp->m_sb.sb_gquotino > 0);
2019 if ((error = xfs_iget(mp, NULL, mp->m_sb.sb_gquotino, 2052 if ((error = xfs_iget(mp, NULL, mp->m_sb.sb_gquotino,
@@ -2043,10 +2076,12 @@ xfs_qm_init_quotainos(
2043 2076
2044 flags &= ~XFS_QMOPT_SBVERSION; 2077 flags &= ~XFS_QMOPT_SBVERSION;
2045 } 2078 }
2046 if (XFS_IS_GQUOTA_ON(mp) && gip == NULL) { 2079 if (XFS_IS_OQUOTA_ON(mp) && gip == NULL) {
2047 if ((error = xfs_qm_qino_alloc(mp, &gip, 2080 flags |= (XFS_IS_GQUOTA_ON(mp) ?
2048 sbflags | XFS_SB_GQUOTINO, 2081 XFS_QMOPT_GQUOTA : XFS_QMOPT_PQUOTA);
2049 flags | XFS_QMOPT_GQUOTA))) { 2082 error = xfs_qm_qino_alloc(mp, &gip,
2083 sbflags | XFS_SB_GQUOTINO, flags);
2084 if (error) {
2050 if (uip) 2085 if (uip)
2051 VN_RELE(XFS_ITOV(uip)); 2086 VN_RELE(XFS_ITOV(uip));
2052 2087
@@ -2452,6 +2487,7 @@ xfs_qm_vop_dqalloc(
2452 xfs_inode_t *ip, 2487 xfs_inode_t *ip,
2453 uid_t uid, 2488 uid_t uid,
2454 gid_t gid, 2489 gid_t gid,
2490 prid_t prid,
2455 uint flags, 2491 uint flags,
2456 xfs_dquot_t **O_udqpp, 2492 xfs_dquot_t **O_udqpp,
2457 xfs_dquot_t **O_gdqpp) 2493 xfs_dquot_t **O_gdqpp)
@@ -2483,8 +2519,7 @@ xfs_qm_vop_dqalloc(
2483 } 2519 }
2484 2520
2485 uq = gq = NULL; 2521 uq = gq = NULL;
2486 if ((flags & XFS_QMOPT_UQUOTA) && 2522 if ((flags & XFS_QMOPT_UQUOTA) && XFS_IS_UQUOTA_ON(mp)) {
2487 XFS_IS_UQUOTA_ON(mp)) {
2488 if (ip->i_d.di_uid != uid) { 2523 if (ip->i_d.di_uid != uid) {
2489 /* 2524 /*
2490 * What we need is the dquot that has this uid, and 2525 * What we need is the dquot that has this uid, and
@@ -2522,8 +2557,7 @@ xfs_qm_vop_dqalloc(
2522 xfs_dqunlock(uq); 2557 xfs_dqunlock(uq);
2523 } 2558 }
2524 } 2559 }
2525 if ((flags & XFS_QMOPT_GQUOTA) && 2560 if ((flags & XFS_QMOPT_GQUOTA) && XFS_IS_GQUOTA_ON(mp)) {
2526 XFS_IS_GQUOTA_ON(mp)) {
2527 if (ip->i_d.di_gid != gid) { 2561 if (ip->i_d.di_gid != gid) {
2528 xfs_iunlock(ip, lockflags); 2562 xfs_iunlock(ip, lockflags);
2529 if ((error = xfs_qm_dqget(mp, NULL, (xfs_dqid_t)gid, 2563 if ((error = xfs_qm_dqget(mp, NULL, (xfs_dqid_t)gid,
@@ -2546,6 +2580,29 @@ xfs_qm_vop_dqalloc(
2546 XFS_DQHOLD(gq); 2580 XFS_DQHOLD(gq);
2547 xfs_dqunlock(gq); 2581 xfs_dqunlock(gq);
2548 } 2582 }
2583 } else if ((flags & XFS_QMOPT_PQUOTA) && XFS_IS_PQUOTA_ON(mp)) {
2584 if (ip->i_d.di_projid != prid) {
2585 xfs_iunlock(ip, lockflags);
2586 if ((error = xfs_qm_dqget(mp, NULL, (xfs_dqid_t)prid,
2587 XFS_DQ_PROJ,
2588 XFS_QMOPT_DQALLOC |
2589 XFS_QMOPT_DOWARN,
2590 &gq))) {
2591 if (uq)
2592 xfs_qm_dqrele(uq);
2593 ASSERT(error != ENOENT);
2594 return (error);
2595 }
2596 xfs_dqunlock(gq);
2597 lockflags = XFS_ILOCK_SHARED;
2598 xfs_ilock(ip, lockflags);
2599 } else {
2600 ASSERT(ip->i_gdquot);
2601 gq = ip->i_gdquot;
2602 xfs_dqlock(gq);
2603 XFS_DQHOLD(gq);
2604 xfs_dqunlock(gq);
2605 }
2549 } 2606 }
2550 if (uq) 2607 if (uq)
2551 xfs_dqtrace_entry_ino(uq, "DQALLOC", ip); 2608 xfs_dqtrace_entry_ino(uq, "DQALLOC", ip);
@@ -2574,6 +2631,9 @@ xfs_qm_vop_chown(
2574 xfs_dquot_t *newdq) 2631 xfs_dquot_t *newdq)
2575{ 2632{
2576 xfs_dquot_t *prevdq; 2633 xfs_dquot_t *prevdq;
2634 uint bfield = XFS_IS_REALTIME_INODE(ip) ?
2635 XFS_TRANS_DQ_RTBCOUNT : XFS_TRANS_DQ_BCOUNT;
2636
2577 ASSERT(XFS_ISLOCKED_INODE_EXCL(ip)); 2637 ASSERT(XFS_ISLOCKED_INODE_EXCL(ip));
2578 ASSERT(XFS_IS_QUOTA_RUNNING(ip->i_mount)); 2638 ASSERT(XFS_IS_QUOTA_RUNNING(ip->i_mount));
2579 2639
@@ -2582,20 +2642,12 @@ xfs_qm_vop_chown(
2582 ASSERT(prevdq); 2642 ASSERT(prevdq);
2583 ASSERT(prevdq != newdq); 2643 ASSERT(prevdq != newdq);
2584 2644
2585 xfs_trans_mod_dquot(tp, prevdq, 2645 xfs_trans_mod_dquot(tp, prevdq, bfield, -(ip->i_d.di_nblocks));
2586 XFS_TRANS_DQ_BCOUNT, 2646 xfs_trans_mod_dquot(tp, prevdq, XFS_TRANS_DQ_ICOUNT, -1);
2587 -(ip->i_d.di_nblocks));
2588 xfs_trans_mod_dquot(tp, prevdq,
2589 XFS_TRANS_DQ_ICOUNT,
2590 -1);
2591 2647
2592 /* the sparkling new dquot */ 2648 /* the sparkling new dquot */
2593 xfs_trans_mod_dquot(tp, newdq, 2649 xfs_trans_mod_dquot(tp, newdq, bfield, ip->i_d.di_nblocks);
2594 XFS_TRANS_DQ_BCOUNT, 2650 xfs_trans_mod_dquot(tp, newdq, XFS_TRANS_DQ_ICOUNT, 1);
2595 ip->i_d.di_nblocks);
2596 xfs_trans_mod_dquot(tp, newdq,
2597 XFS_TRANS_DQ_ICOUNT,
2598 1);
2599 2651
2600 /* 2652 /*
2601 * Take an extra reference, because the inode 2653 * Take an extra reference, because the inode
@@ -2611,7 +2663,7 @@ xfs_qm_vop_chown(
2611} 2663}
2612 2664
2613/* 2665/*
2614 * Quota reservations for setattr(AT_UID|AT_GID). 2666 * Quota reservations for setattr(AT_UID|AT_GID|AT_PROJID).
2615 */ 2667 */
2616int 2668int
2617xfs_qm_vop_chown_reserve( 2669xfs_qm_vop_chown_reserve(
@@ -2623,7 +2675,7 @@ xfs_qm_vop_chown_reserve(
2623{ 2675{
2624 int error; 2676 int error;
2625 xfs_mount_t *mp; 2677 xfs_mount_t *mp;
2626 uint delblks; 2678 uint delblks, blkflags;
2627 xfs_dquot_t *unresudq, *unresgdq, *delblksudq, *delblksgdq; 2679 xfs_dquot_t *unresudq, *unresgdq, *delblksudq, *delblksgdq;
2628 2680
2629 ASSERT(XFS_ISLOCKED_INODE(ip)); 2681 ASSERT(XFS_ISLOCKED_INODE(ip));
@@ -2632,6 +2684,8 @@ xfs_qm_vop_chown_reserve(
2632 2684
2633 delblks = ip->i_delayed_blks; 2685 delblks = ip->i_delayed_blks;
2634 delblksudq = delblksgdq = unresudq = unresgdq = NULL; 2686 delblksudq = delblksgdq = unresudq = unresgdq = NULL;
2687 blkflags = XFS_IS_REALTIME_INODE(ip) ?
2688 XFS_QMOPT_RES_RTBLKS : XFS_QMOPT_RES_REGBLKS;
2635 2689
2636 if (XFS_IS_UQUOTA_ON(mp) && udqp && 2690 if (XFS_IS_UQUOTA_ON(mp) && udqp &&
2637 ip->i_d.di_uid != (uid_t)INT_GET(udqp->q_core.d_id, ARCH_CONVERT)) { 2691 ip->i_d.di_uid != (uid_t)INT_GET(udqp->q_core.d_id, ARCH_CONVERT)) {
@@ -2646,18 +2700,22 @@ xfs_qm_vop_chown_reserve(
2646 unresudq = ip->i_udquot; 2700 unresudq = ip->i_udquot;
2647 } 2701 }
2648 } 2702 }
2649 if (XFS_IS_GQUOTA_ON(ip->i_mount) && gdqp && 2703 if (XFS_IS_OQUOTA_ON(ip->i_mount) && gdqp) {
2650 ip->i_d.di_gid != INT_GET(gdqp->q_core.d_id, ARCH_CONVERT)) { 2704 if ((XFS_IS_GQUOTA_ON(ip->i_mount) && ip->i_d.di_gid !=
2651 delblksgdq = gdqp; 2705 INT_GET(gdqp->q_core.d_id, ARCH_CONVERT)) ||
2652 if (delblks) { 2706 (XFS_IS_PQUOTA_ON(ip->i_mount) && ip->i_d.di_projid !=
2653 ASSERT(ip->i_gdquot); 2707 INT_GET(gdqp->q_core.d_id, ARCH_CONVERT))) {
2654 unresgdq = ip->i_gdquot; 2708 delblksgdq = gdqp;
2709 if (delblks) {
2710 ASSERT(ip->i_gdquot);
2711 unresgdq = ip->i_gdquot;
2712 }
2655 } 2713 }
2656 } 2714 }
2657 2715
2658 if ((error = xfs_trans_reserve_quota_bydquots(tp, ip->i_mount, 2716 if ((error = xfs_trans_reserve_quota_bydquots(tp, ip->i_mount,
2659 delblksudq, delblksgdq, ip->i_d.di_nblocks, 1, 2717 delblksudq, delblksgdq, ip->i_d.di_nblocks, 1,
2660 flags | XFS_QMOPT_RES_REGBLKS))) 2718 flags | blkflags)))
2661 return (error); 2719 return (error);
2662 2720
2663 /* 2721 /*
@@ -2674,11 +2732,11 @@ xfs_qm_vop_chown_reserve(
2674 ASSERT(unresudq || unresgdq); 2732 ASSERT(unresudq || unresgdq);
2675 if ((error = xfs_trans_reserve_quota_bydquots(NULL, ip->i_mount, 2733 if ((error = xfs_trans_reserve_quota_bydquots(NULL, ip->i_mount,
2676 delblksudq, delblksgdq, (xfs_qcnt_t)delblks, 0, 2734 delblksudq, delblksgdq, (xfs_qcnt_t)delblks, 0,
2677 flags | XFS_QMOPT_RES_REGBLKS))) 2735 flags | blkflags)))
2678 return (error); 2736 return (error);
2679 xfs_trans_reserve_quota_bydquots(NULL, ip->i_mount, 2737 xfs_trans_reserve_quota_bydquots(NULL, ip->i_mount,
2680 unresudq, unresgdq, -((xfs_qcnt_t)delblks), 0, 2738 unresudq, unresgdq, -((xfs_qcnt_t)delblks), 0,
2681 XFS_QMOPT_RES_REGBLKS); 2739 blkflags);
2682 } 2740 }
2683 2741
2684 return (0); 2742 return (0);
@@ -2751,7 +2809,7 @@ xfs_qm_vop_dqattach_and_dqmod_newinode(
2751} 2809}
2752 2810
2753/* ------------- list stuff -----------------*/ 2811/* ------------- list stuff -----------------*/
2754void 2812STATIC void
2755xfs_qm_freelist_init(xfs_frlist_t *ql) 2813xfs_qm_freelist_init(xfs_frlist_t *ql)
2756{ 2814{
2757 ql->qh_next = ql->qh_prev = (xfs_dquot_t *) ql; 2815 ql->qh_next = ql->qh_prev = (xfs_dquot_t *) ql;
@@ -2760,7 +2818,7 @@ xfs_qm_freelist_init(xfs_frlist_t *ql)
2760 ql->qh_nelems = 0; 2818 ql->qh_nelems = 0;
2761} 2819}
2762 2820
2763void 2821STATIC void
2764xfs_qm_freelist_destroy(xfs_frlist_t *ql) 2822xfs_qm_freelist_destroy(xfs_frlist_t *ql)
2765{ 2823{
2766 xfs_dquot_t *dqp, *nextdqp; 2824 xfs_dquot_t *dqp, *nextdqp;
@@ -2786,7 +2844,7 @@ xfs_qm_freelist_destroy(xfs_frlist_t *ql)
2786 ASSERT(ql->qh_nelems == 0); 2844 ASSERT(ql->qh_nelems == 0);
2787} 2845}
2788 2846
2789void 2847STATIC void
2790xfs_qm_freelist_insert(xfs_frlist_t *ql, xfs_dquot_t *dq) 2848xfs_qm_freelist_insert(xfs_frlist_t *ql, xfs_dquot_t *dq)
2791{ 2849{
2792 dq->dq_flnext = ql->qh_next; 2850 dq->dq_flnext = ql->qh_next;
@@ -2816,7 +2874,7 @@ xfs_qm_freelist_append(xfs_frlist_t *ql, xfs_dquot_t *dq)
2816 xfs_qm_freelist_insert((xfs_frlist_t *)ql->qh_prev, dq); 2874 xfs_qm_freelist_insert((xfs_frlist_t *)ql->qh_prev, dq);
2817} 2875}
2818 2876
2819int 2877STATIC int
2820xfs_qm_dqhashlock_nowait( 2878xfs_qm_dqhashlock_nowait(
2821 xfs_dquot_t *dqp) 2879 xfs_dquot_t *dqp)
2822{ 2880{
@@ -2836,7 +2894,7 @@ xfs_qm_freelist_lock_nowait(
2836 return (locked); 2894 return (locked);
2837} 2895}
2838 2896
2839int 2897STATIC int
2840xfs_qm_mplist_nowait( 2898xfs_qm_mplist_nowait(
2841 xfs_mount_t *mp) 2899 xfs_mount_t *mp)
2842{ 2900{
diff --git a/fs/xfs/quota/xfs_qm.h b/fs/xfs/quota/xfs_qm.h
index dcf1a7a831d8..b03eecf3b6cb 100644
--- a/fs/xfs/quota/xfs_qm.h
+++ b/fs/xfs/quota/xfs_qm.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved. 2 * Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License as 5 * under the terms of version 2 of the GNU General Public License as
@@ -133,8 +133,9 @@ typedef struct xfs_quotainfo {
133 time_t qi_btimelimit; /* limit for blks timer */ 133 time_t qi_btimelimit; /* limit for blks timer */
134 time_t qi_itimelimit; /* limit for inodes timer */ 134 time_t qi_itimelimit; /* limit for inodes timer */
135 time_t qi_rtbtimelimit;/* limit for rt blks timer */ 135 time_t qi_rtbtimelimit;/* limit for rt blks timer */
136 xfs_qwarncnt_t qi_bwarnlimit; /* limit for num warnings */ 136 xfs_qwarncnt_t qi_bwarnlimit; /* limit for blks warnings */
137 xfs_qwarncnt_t qi_iwarnlimit; /* limit for num warnings */ 137 xfs_qwarncnt_t qi_iwarnlimit; /* limit for inodes warnings */
138 xfs_qwarncnt_t qi_rtbwarnlimit;/* limit for rt blks warnings */
138 mutex_t qi_quotaofflock;/* to serialize quotaoff */ 139 mutex_t qi_quotaofflock;/* to serialize quotaoff */
139 xfs_filblks_t qi_dqchunklen; /* # BBs in a chunk of dqs */ 140 xfs_filblks_t qi_dqchunklen; /* # BBs in a chunk of dqs */
140 uint qi_dqperchunk; /* # ondisk dqs in above chunk */ 141 uint qi_dqperchunk; /* # ondisk dqs in above chunk */
@@ -176,6 +177,7 @@ typedef struct xfs_dquot_acct {
176 177
177#define XFS_QM_BWARNLIMIT 5 178#define XFS_QM_BWARNLIMIT 5
178#define XFS_QM_IWARNLIMIT 5 179#define XFS_QM_IWARNLIMIT 5
180#define XFS_QM_RTBWARNLIMIT 5
179 181
180#define XFS_QM_LOCK(xqm) (mutex_lock(&xqm##_lock, PINOD)) 182#define XFS_QM_LOCK(xqm) (mutex_lock(&xqm##_lock, PINOD))
181#define XFS_QM_UNLOCK(xqm) (mutex_unlock(&xqm##_lock)) 183#define XFS_QM_UNLOCK(xqm) (mutex_unlock(&xqm##_lock))
@@ -184,7 +186,6 @@ typedef struct xfs_dquot_acct {
184 186
185extern void xfs_mount_reset_sbqflags(xfs_mount_t *); 187extern void xfs_mount_reset_sbqflags(xfs_mount_t *);
186 188
187extern int xfs_qm_init_quotainfo(xfs_mount_t *);
188extern void xfs_qm_destroy_quotainfo(xfs_mount_t *); 189extern void xfs_qm_destroy_quotainfo(xfs_mount_t *);
189extern int xfs_qm_mount_quotas(xfs_mount_t *, int); 190extern int xfs_qm_mount_quotas(xfs_mount_t *, int);
190extern void xfs_qm_mount_quotainit(xfs_mount_t *, uint); 191extern void xfs_qm_mount_quotainit(xfs_mount_t *, uint);
@@ -203,7 +204,7 @@ extern void xfs_qm_dqrele_all_inodes(xfs_mount_t *, uint);
203 204
204/* vop stuff */ 205/* vop stuff */
205extern int xfs_qm_vop_dqalloc(xfs_mount_t *, xfs_inode_t *, 206extern int xfs_qm_vop_dqalloc(xfs_mount_t *, xfs_inode_t *,
206 uid_t, gid_t, uint, 207 uid_t, gid_t, prid_t, uint,
207 xfs_dquot_t **, xfs_dquot_t **); 208 xfs_dquot_t **, xfs_dquot_t **);
208extern void xfs_qm_vop_dqattach_and_dqmod_newinode( 209extern void xfs_qm_vop_dqattach_and_dqmod_newinode(
209 xfs_trans_t *, xfs_inode_t *, 210 xfs_trans_t *, xfs_inode_t *,
@@ -215,14 +216,9 @@ extern int xfs_qm_vop_chown_reserve(xfs_trans_t *, xfs_inode_t *,
215 xfs_dquot_t *, xfs_dquot_t *, uint); 216 xfs_dquot_t *, xfs_dquot_t *, uint);
216 217
217/* list stuff */ 218/* list stuff */
218extern void xfs_qm_freelist_init(xfs_frlist_t *);
219extern void xfs_qm_freelist_destroy(xfs_frlist_t *);
220extern void xfs_qm_freelist_insert(xfs_frlist_t *, xfs_dquot_t *);
221extern void xfs_qm_freelist_append(xfs_frlist_t *, xfs_dquot_t *); 219extern void xfs_qm_freelist_append(xfs_frlist_t *, xfs_dquot_t *);
222extern void xfs_qm_freelist_unlink(xfs_dquot_t *); 220extern void xfs_qm_freelist_unlink(xfs_dquot_t *);
223extern int xfs_qm_freelist_lock_nowait(xfs_qm_t *); 221extern int xfs_qm_freelist_lock_nowait(xfs_qm_t *);
224extern int xfs_qm_mplist_nowait(xfs_mount_t *);
225extern int xfs_qm_dqhashlock_nowait(xfs_dquot_t *);
226 222
227/* system call interface */ 223/* system call interface */
228extern int xfs_qm_quotactl(bhv_desc_t *, int, int, xfs_caddr_t); 224extern int xfs_qm_quotactl(bhv_desc_t *, int, int, xfs_caddr_t);
diff --git a/fs/xfs/quota/xfs_qm_bhv.c b/fs/xfs/quota/xfs_qm_bhv.c
index be67d9c265f8..dc3c37a1e158 100644
--- a/fs/xfs/quota/xfs_qm_bhv.c
+++ b/fs/xfs/quota/xfs_qm_bhv.c
@@ -71,10 +71,13 @@
71#define MNTOPT_NOQUOTA "noquota" /* no quotas */ 71#define MNTOPT_NOQUOTA "noquota" /* no quotas */
72#define MNTOPT_USRQUOTA "usrquota" /* user quota enabled */ 72#define MNTOPT_USRQUOTA "usrquota" /* user quota enabled */
73#define MNTOPT_GRPQUOTA "grpquota" /* group quota enabled */ 73#define MNTOPT_GRPQUOTA "grpquota" /* group quota enabled */
74#define MNTOPT_PRJQUOTA "prjquota" /* project quota enabled */
74#define MNTOPT_UQUOTA "uquota" /* user quota (IRIX variant) */ 75#define MNTOPT_UQUOTA "uquota" /* user quota (IRIX variant) */
75#define MNTOPT_GQUOTA "gquota" /* group quota (IRIX variant) */ 76#define MNTOPT_GQUOTA "gquota" /* group quota (IRIX variant) */
77#define MNTOPT_PQUOTA "pquota" /* project quota (IRIX variant) */
76#define MNTOPT_UQUOTANOENF "uqnoenforce"/* user quota limit enforcement */ 78#define MNTOPT_UQUOTANOENF "uqnoenforce"/* user quota limit enforcement */
77#define MNTOPT_GQUOTANOENF "gqnoenforce"/* group quota limit enforcement */ 79#define MNTOPT_GQUOTANOENF "gqnoenforce"/* group quota limit enforcement */
80#define MNTOPT_PQUOTANOENF "pqnoenforce"/* project quota limit enforcement */
78#define MNTOPT_QUOTANOENF "qnoenforce" /* same as uqnoenforce */ 81#define MNTOPT_QUOTANOENF "qnoenforce" /* same as uqnoenforce */
79 82
80STATIC int 83STATIC int
@@ -109,6 +112,14 @@ xfs_qm_parseargs(
109 args->flags |= XFSMNT_UQUOTA; 112 args->flags |= XFSMNT_UQUOTA;
110 args->flags &= ~XFSMNT_UQUOTAENF; 113 args->flags &= ~XFSMNT_UQUOTAENF;
111 referenced = 1; 114 referenced = 1;
115 } else if (!strcmp(this_char, MNTOPT_PQUOTA) ||
116 !strcmp(this_char, MNTOPT_PRJQUOTA)) {
117 args->flags |= XFSMNT_PQUOTA | XFSMNT_PQUOTAENF;
118 referenced = 1;
119 } else if (!strcmp(this_char, MNTOPT_PQUOTANOENF)) {
120 args->flags |= XFSMNT_PQUOTA;
121 args->flags &= ~XFSMNT_PQUOTAENF;
122 referenced = 1;
112 } else if (!strcmp(this_char, MNTOPT_GQUOTA) || 123 } else if (!strcmp(this_char, MNTOPT_GQUOTA) ||
113 !strcmp(this_char, MNTOPT_GRPQUOTA)) { 124 !strcmp(this_char, MNTOPT_GRPQUOTA)) {
114 args->flags |= XFSMNT_GQUOTA | XFSMNT_GQUOTAENF; 125 args->flags |= XFSMNT_GQUOTA | XFSMNT_GQUOTAENF;
@@ -127,6 +138,12 @@ xfs_qm_parseargs(
127 *this_char++ = ','; 138 *this_char++ = ',';
128 } 139 }
129 140
141 if ((args->flags & XFSMNT_GQUOTA) && (args->flags & XFSMNT_PQUOTA)) {
142 cmn_err(CE_WARN,
143 "XFS: cannot mount with both project and group quota");
144 return XFS_ERROR(EINVAL);
145 }
146
130 PVFS_PARSEARGS(BHV_NEXT(bhv), options, args, update, error); 147 PVFS_PARSEARGS(BHV_NEXT(bhv), options, args, update, error);
131 if (!error && !referenced) 148 if (!error && !referenced)
132 bhv_remove_vfsops(bhvtovfs(bhv), VFS_POSITION_QM); 149 bhv_remove_vfsops(bhvtovfs(bhv), VFS_POSITION_QM);
@@ -148,13 +165,19 @@ xfs_qm_showargs(
148 seq_puts(m, "," MNTOPT_UQUOTANOENF); 165 seq_puts(m, "," MNTOPT_UQUOTANOENF);
149 } 166 }
150 167
168 if (mp->m_qflags & XFS_PQUOTA_ACCT) {
169 (mp->m_qflags & XFS_OQUOTA_ENFD) ?
170 seq_puts(m, "," MNTOPT_PRJQUOTA) :
171 seq_puts(m, "," MNTOPT_PQUOTANOENF);
172 }
173
151 if (mp->m_qflags & XFS_GQUOTA_ACCT) { 174 if (mp->m_qflags & XFS_GQUOTA_ACCT) {
152 (mp->m_qflags & XFS_GQUOTA_ENFD) ? 175 (mp->m_qflags & XFS_OQUOTA_ENFD) ?
153 seq_puts(m, "," MNTOPT_GRPQUOTA) : 176 seq_puts(m, "," MNTOPT_GRPQUOTA) :
154 seq_puts(m, "," MNTOPT_GQUOTANOENF); 177 seq_puts(m, "," MNTOPT_GQUOTANOENF);
155 } 178 }
156 179
157 if (!(mp->m_qflags & (XFS_UQUOTA_ACCT|XFS_GQUOTA_ACCT))) 180 if (!(mp->m_qflags & XFS_ALL_QUOTA_ACCT))
158 seq_puts(m, "," MNTOPT_NOQUOTA); 181 seq_puts(m, "," MNTOPT_NOQUOTA);
159 182
160 PVFS_SHOWARGS(BHV_NEXT(bhv), m, error); 183 PVFS_SHOWARGS(BHV_NEXT(bhv), m, error);
@@ -171,7 +194,7 @@ xfs_qm_mount(
171 struct xfs_mount *mp = XFS_VFSTOM(vfsp); 194 struct xfs_mount *mp = XFS_VFSTOM(vfsp);
172 int error; 195 int error;
173 196
174 if (args->flags & (XFSMNT_UQUOTA | XFSMNT_GQUOTA)) 197 if (args->flags & (XFSMNT_UQUOTA | XFSMNT_GQUOTA | XFSMNT_PQUOTA))
175 xfs_qm_mount_quotainit(mp, args->flags); 198 xfs_qm_mount_quotainit(mp, args->flags);
176 PVFS_MOUNT(BHV_NEXT(bhv), args, cr, error); 199 PVFS_MOUNT(BHV_NEXT(bhv), args, cr, error);
177 return error; 200 return error;
@@ -255,16 +278,17 @@ xfs_qm_newmount(
255 uint *quotaflags) 278 uint *quotaflags)
256{ 279{
257 uint quotaondisk; 280 uint quotaondisk;
258 uint uquotaondisk = 0, gquotaondisk = 0; 281 uint uquotaondisk = 0, gquotaondisk = 0, pquotaondisk = 0;
259 282
260 *quotaflags = 0; 283 *quotaflags = 0;
261 *needquotamount = B_FALSE; 284 *needquotamount = B_FALSE;
262 285
263 quotaondisk = XFS_SB_VERSION_HASQUOTA(&mp->m_sb) && 286 quotaondisk = XFS_SB_VERSION_HASQUOTA(&mp->m_sb) &&
264 mp->m_sb.sb_qflags & (XFS_UQUOTA_ACCT|XFS_GQUOTA_ACCT); 287 (mp->m_sb.sb_qflags & XFS_ALL_QUOTA_ACCT);
265 288
266 if (quotaondisk) { 289 if (quotaondisk) {
267 uquotaondisk = mp->m_sb.sb_qflags & XFS_UQUOTA_ACCT; 290 uquotaondisk = mp->m_sb.sb_qflags & XFS_UQUOTA_ACCT;
291 pquotaondisk = mp->m_sb.sb_qflags & XFS_PQUOTA_ACCT;
268 gquotaondisk = mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT; 292 gquotaondisk = mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT;
269 } 293 }
270 294
@@ -277,13 +301,16 @@ xfs_qm_newmount(
277 301
278 if (((uquotaondisk && !XFS_IS_UQUOTA_ON(mp)) || 302 if (((uquotaondisk && !XFS_IS_UQUOTA_ON(mp)) ||
279 (!uquotaondisk && XFS_IS_UQUOTA_ON(mp)) || 303 (!uquotaondisk && XFS_IS_UQUOTA_ON(mp)) ||
304 (pquotaondisk && !XFS_IS_PQUOTA_ON(mp)) ||
305 (!pquotaondisk && XFS_IS_PQUOTA_ON(mp)) ||
280 (gquotaondisk && !XFS_IS_GQUOTA_ON(mp)) || 306 (gquotaondisk && !XFS_IS_GQUOTA_ON(mp)) ||
281 (!gquotaondisk && XFS_IS_GQUOTA_ON(mp))) && 307 (!gquotaondisk && XFS_IS_OQUOTA_ON(mp))) &&
282 xfs_dev_is_read_only(mp, "changing quota state")) { 308 xfs_dev_is_read_only(mp, "changing quota state")) {
283 cmn_err(CE_WARN, 309 cmn_err(CE_WARN,
284 "XFS: please mount with%s%s%s.", 310 "XFS: please mount with%s%s%s%s.",
285 (!quotaondisk ? "out quota" : ""), 311 (!quotaondisk ? "out quota" : ""),
286 (uquotaondisk ? " usrquota" : ""), 312 (uquotaondisk ? " usrquota" : ""),
313 (pquotaondisk ? " prjquota" : ""),
287 (gquotaondisk ? " grpquota" : "")); 314 (gquotaondisk ? " grpquota" : ""));
288 return XFS_ERROR(EPERM); 315 return XFS_ERROR(EPERM);
289 } 316 }
@@ -359,7 +386,7 @@ xfs_qm_dqrele_null(
359} 386}
360 387
361 388
362struct xfs_qmops xfs_qmcore_xfs = { 389STATIC struct xfs_qmops xfs_qmcore_xfs = {
363 .xfs_qminit = xfs_qm_newmount, 390 .xfs_qminit = xfs_qm_newmount,
364 .xfs_qmdone = xfs_qm_unmount_quotadestroy, 391 .xfs_qmdone = xfs_qm_unmount_quotadestroy,
365 .xfs_qmmount = xfs_qm_endmount, 392 .xfs_qmmount = xfs_qm_endmount,
diff --git a/fs/xfs/quota/xfs_qm_syscalls.c b/fs/xfs/quota/xfs_qm_syscalls.c
index 229f5b5a2d25..68e98962dbef 100644
--- a/fs/xfs/quota/xfs_qm_syscalls.c
+++ b/fs/xfs/quota/xfs_qm_syscalls.c
@@ -118,40 +118,41 @@ xfs_qm_quotactl(
118 * The following commands are valid even when quotaoff. 118 * The following commands are valid even when quotaoff.
119 */ 119 */
120 switch (cmd) { 120 switch (cmd) {
121 case Q_XQUOTARM:
121 /* 122 /*
122 * truncate quota files. quota must be off. 123 * Truncate quota files. quota must be off.
123 */ 124 */
124 case Q_XQUOTARM:
125 if (XFS_IS_QUOTA_ON(mp) || addr == NULL) 125 if (XFS_IS_QUOTA_ON(mp) || addr == NULL)
126 return XFS_ERROR(EINVAL); 126 return XFS_ERROR(EINVAL);
127 if (vfsp->vfs_flag & VFS_RDONLY) 127 if (vfsp->vfs_flag & VFS_RDONLY)
128 return XFS_ERROR(EROFS); 128 return XFS_ERROR(EROFS);
129 return (xfs_qm_scall_trunc_qfiles(mp, 129 return (xfs_qm_scall_trunc_qfiles(mp,
130 xfs_qm_import_qtype_flags(*(uint *)addr))); 130 xfs_qm_import_qtype_flags(*(uint *)addr)));
131
132 case Q_XGETQSTAT:
131 /* 133 /*
132 * Get quota status information. 134 * Get quota status information.
133 */ 135 */
134 case Q_XGETQSTAT:
135 return (xfs_qm_scall_getqstat(mp, (fs_quota_stat_t *)addr)); 136 return (xfs_qm_scall_getqstat(mp, (fs_quota_stat_t *)addr));
136 137
138 case Q_XQUOTAON:
137 /* 139 /*
138 * QUOTAON for root f/s and quota enforcement on others.. 140 * QUOTAON - enabling quota enforcement.
139 * Quota accounting for non-root f/s's must be turned on 141 * Quota accounting must be turned on at mount time.
140 * at mount time.
141 */ 142 */
142 case Q_XQUOTAON:
143 if (addr == NULL) 143 if (addr == NULL)
144 return XFS_ERROR(EINVAL); 144 return XFS_ERROR(EINVAL);
145 if (vfsp->vfs_flag & VFS_RDONLY) 145 if (vfsp->vfs_flag & VFS_RDONLY)
146 return XFS_ERROR(EROFS); 146 return XFS_ERROR(EROFS);
147 return (xfs_qm_scall_quotaon(mp, 147 return (xfs_qm_scall_quotaon(mp,
148 xfs_qm_import_flags(*(uint *)addr))); 148 xfs_qm_import_flags(*(uint *)addr)));
149 case Q_XQUOTAOFF: 149
150 case Q_XQUOTAOFF:
150 if (vfsp->vfs_flag & VFS_RDONLY) 151 if (vfsp->vfs_flag & VFS_RDONLY)
151 return XFS_ERROR(EROFS); 152 return XFS_ERROR(EROFS);
152 break; 153 break;
153 154
154 default: 155 default:
155 break; 156 break;
156 } 157 }
157 158
@@ -159,7 +160,7 @@ xfs_qm_quotactl(
159 return XFS_ERROR(ESRCH); 160 return XFS_ERROR(ESRCH);
160 161
161 switch (cmd) { 162 switch (cmd) {
162 case Q_XQUOTAOFF: 163 case Q_XQUOTAOFF:
163 if (vfsp->vfs_flag & VFS_RDONLY) 164 if (vfsp->vfs_flag & VFS_RDONLY)
164 return XFS_ERROR(EROFS); 165 return XFS_ERROR(EROFS);
165 error = xfs_qm_scall_quotaoff(mp, 166 error = xfs_qm_scall_quotaoff(mp,
@@ -167,42 +168,39 @@ xfs_qm_quotactl(
167 B_FALSE); 168 B_FALSE);
168 break; 169 break;
169 170
170 /* 171 case Q_XGETQUOTA:
171 * Defaults to XFS_GETUQUOTA.
172 */
173 case Q_XGETQUOTA:
174 error = xfs_qm_scall_getquota(mp, (xfs_dqid_t)id, XFS_DQ_USER, 172 error = xfs_qm_scall_getquota(mp, (xfs_dqid_t)id, XFS_DQ_USER,
175 (fs_disk_quota_t *)addr); 173 (fs_disk_quota_t *)addr);
176 break; 174 break;
177 /* 175 case Q_XGETGQUOTA:
178 * Set limits, both hard and soft. Defaults to Q_SETUQLIM. 176 error = xfs_qm_scall_getquota(mp, (xfs_dqid_t)id, XFS_DQ_GROUP,
179 */ 177 (fs_disk_quota_t *)addr);
180 case Q_XSETQLIM: 178 break;
179 case Q_XGETPQUOTA:
180 error = xfs_qm_scall_getquota(mp, (xfs_dqid_t)id, XFS_DQ_PROJ,
181 (fs_disk_quota_t *)addr);
182 break;
183
184 case Q_XSETQLIM:
181 if (vfsp->vfs_flag & VFS_RDONLY) 185 if (vfsp->vfs_flag & VFS_RDONLY)
182 return XFS_ERROR(EROFS); 186 return XFS_ERROR(EROFS);
183 error = xfs_qm_scall_setqlim(mp, (xfs_dqid_t)id, XFS_DQ_USER, 187 error = xfs_qm_scall_setqlim(mp, (xfs_dqid_t)id, XFS_DQ_USER,
184 (fs_disk_quota_t *)addr); 188 (fs_disk_quota_t *)addr);
185 break; 189 break;
186 190 case Q_XSETGQLIM:
187 case Q_XSETGQLIM:
188 if (vfsp->vfs_flag & VFS_RDONLY) 191 if (vfsp->vfs_flag & VFS_RDONLY)
189 return XFS_ERROR(EROFS); 192 return XFS_ERROR(EROFS);
190 error = xfs_qm_scall_setqlim(mp, (xfs_dqid_t)id, XFS_DQ_GROUP, 193 error = xfs_qm_scall_setqlim(mp, (xfs_dqid_t)id, XFS_DQ_GROUP,
191 (fs_disk_quota_t *)addr); 194 (fs_disk_quota_t *)addr);
192 break; 195 break;
193 196 case Q_XSETPQLIM:
194 197 if (vfsp->vfs_flag & VFS_RDONLY)
195 case Q_XGETGQUOTA: 198 return XFS_ERROR(EROFS);
196 error = xfs_qm_scall_getquota(mp, (xfs_dqid_t)id, XFS_DQ_GROUP, 199 error = xfs_qm_scall_setqlim(mp, (xfs_dqid_t)id, XFS_DQ_PROJ,
197 (fs_disk_quota_t *)addr); 200 (fs_disk_quota_t *)addr);
198 break; 201 break;
199 202
200 /* 203 default:
201 * Quotas are entirely undefined after quotaoff in XFS quotas.
202 * For instance, there's no way to set limits when quotaoff.
203 */
204
205 default:
206 error = XFS_ERROR(EINVAL); 204 error = XFS_ERROR(EINVAL);
207 break; 205 break;
208 } 206 }
@@ -286,8 +284,12 @@ xfs_qm_scall_quotaoff(
286 } 284 }
287 if (flags & XFS_GQUOTA_ACCT) { 285 if (flags & XFS_GQUOTA_ACCT) {
288 dqtype |= XFS_QMOPT_GQUOTA; 286 dqtype |= XFS_QMOPT_GQUOTA;
289 flags |= (XFS_GQUOTA_CHKD | XFS_GQUOTA_ENFD); 287 flags |= (XFS_OQUOTA_CHKD | XFS_OQUOTA_ENFD);
290 inactivate_flags |= XFS_GQUOTA_ACTIVE; 288 inactivate_flags |= XFS_GQUOTA_ACTIVE;
289 } else if (flags & XFS_PQUOTA_ACCT) {
290 dqtype |= XFS_QMOPT_PQUOTA;
291 flags |= (XFS_OQUOTA_CHKD | XFS_OQUOTA_ENFD);
292 inactivate_flags |= XFS_PQUOTA_ACTIVE;
291 } 293 }
292 294
293 /* 295 /*
@@ -364,7 +366,8 @@ xfs_qm_scall_quotaoff(
364 /* 366 /*
365 * If quotas is completely disabled, close shop. 367 * If quotas is completely disabled, close shop.
366 */ 368 */
367 if ((flags & XFS_MOUNT_QUOTA_ALL) == XFS_MOUNT_QUOTA_ALL) { 369 if (((flags & XFS_MOUNT_QUOTA_ALL) == XFS_MOUNT_QUOTA_SET1) ||
370 ((flags & XFS_MOUNT_QUOTA_ALL) == XFS_MOUNT_QUOTA_SET2)) {
368 mutex_unlock(&(XFS_QI_QOFFLOCK(mp))); 371 mutex_unlock(&(XFS_QI_QOFFLOCK(mp)));
369 xfs_qm_destroy_quotainfo(mp); 372 xfs_qm_destroy_quotainfo(mp);
370 return (0); 373 return (0);
@@ -378,7 +381,7 @@ xfs_qm_scall_quotaoff(
378 XFS_PURGE_INODE(XFS_QI_UQIP(mp)); 381 XFS_PURGE_INODE(XFS_QI_UQIP(mp));
379 XFS_QI_UQIP(mp) = NULL; 382 XFS_QI_UQIP(mp) = NULL;
380 } 383 }
381 if ((dqtype & XFS_QMOPT_GQUOTA) && XFS_QI_GQIP(mp)) { 384 if ((dqtype & (XFS_QMOPT_GQUOTA|XFS_QMOPT_PQUOTA)) && XFS_QI_GQIP(mp)) {
382 XFS_PURGE_INODE(XFS_QI_GQIP(mp)); 385 XFS_PURGE_INODE(XFS_QI_GQIP(mp));
383 XFS_QI_GQIP(mp) = NULL; 386 XFS_QI_GQIP(mp) = NULL;
384 } 387 }
@@ -411,7 +414,8 @@ xfs_qm_scall_trunc_qfiles(
411 } 414 }
412 } 415 }
413 416
414 if ((flags & XFS_DQ_GROUP) && mp->m_sb.sb_gquotino != NULLFSINO) { 417 if ((flags & (XFS_DQ_GROUP|XFS_DQ_PROJ)) &&
418 mp->m_sb.sb_gquotino != NULLFSINO) {
415 error = xfs_iget(mp, NULL, mp->m_sb.sb_gquotino, 0, 0, &qip, 0); 419 error = xfs_iget(mp, NULL, mp->m_sb.sb_gquotino, 0, 0, &qip, 0);
416 if (! error) { 420 if (! error) {
417 (void) xfs_truncate_file(mp, qip); 421 (void) xfs_truncate_file(mp, qip);
@@ -434,7 +438,7 @@ xfs_qm_scall_quotaon(
434 uint flags) 438 uint flags)
435{ 439{
436 int error; 440 int error;
437 unsigned long s; 441 unsigned long s;
438 uint qf; 442 uint qf;
439 uint accflags; 443 uint accflags;
440 __int64_t sbflags; 444 __int64_t sbflags;
@@ -468,9 +472,13 @@ xfs_qm_scall_quotaon(
468 (mp->m_sb.sb_qflags & XFS_UQUOTA_ACCT) == 0 && 472 (mp->m_sb.sb_qflags & XFS_UQUOTA_ACCT) == 0 &&
469 (flags & XFS_UQUOTA_ENFD)) 473 (flags & XFS_UQUOTA_ENFD))
470 || 474 ||
475 ((flags & XFS_PQUOTA_ACCT) == 0 &&
476 (mp->m_sb.sb_qflags & XFS_PQUOTA_ACCT) == 0 &&
477 (flags & XFS_OQUOTA_ENFD))
478 ||
471 ((flags & XFS_GQUOTA_ACCT) == 0 && 479 ((flags & XFS_GQUOTA_ACCT) == 0 &&
472 (mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT) == 0 && 480 (mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT) == 0 &&
473 (flags & XFS_GQUOTA_ENFD))) { 481 (flags & XFS_OQUOTA_ENFD))) {
474 qdprintk("Can't enforce without acct, flags=%x sbflags=%x\n", 482 qdprintk("Can't enforce without acct, flags=%x sbflags=%x\n",
475 flags, mp->m_sb.sb_qflags); 483 flags, mp->m_sb.sb_qflags);
476 return XFS_ERROR(EINVAL); 484 return XFS_ERROR(EINVAL);
@@ -504,6 +512,10 @@ xfs_qm_scall_quotaon(
504 */ 512 */
505 if (((mp->m_sb.sb_qflags & XFS_UQUOTA_ACCT) != 513 if (((mp->m_sb.sb_qflags & XFS_UQUOTA_ACCT) !=
506 (mp->m_qflags & XFS_UQUOTA_ACCT)) || 514 (mp->m_qflags & XFS_UQUOTA_ACCT)) ||
515 ((mp->m_sb.sb_qflags & XFS_PQUOTA_ACCT) !=
516 (mp->m_qflags & XFS_PQUOTA_ACCT)) ||
517 ((mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT) !=
518 (mp->m_qflags & XFS_GQUOTA_ACCT)) ||
507 (flags & XFS_ALL_QUOTA_ENFD) == 0) 519 (flags & XFS_ALL_QUOTA_ENFD) == 0)
508 return (0); 520 return (0);
509 521
@@ -521,7 +533,6 @@ xfs_qm_scall_quotaon(
521} 533}
522 534
523 535
524
525/* 536/*
526 * Return quota status information, such as uquota-off, enforcements, etc. 537 * Return quota status information, such as uquota-off, enforcements, etc.
527 */ 538 */
@@ -606,7 +617,8 @@ xfs_qm_scall_setqlim(
606 if (!capable(CAP_SYS_ADMIN)) 617 if (!capable(CAP_SYS_ADMIN))
607 return XFS_ERROR(EPERM); 618 return XFS_ERROR(EPERM);
608 619
609 if ((newlim->d_fieldmask & (FS_DQ_LIMIT_MASK|FS_DQ_TIMER_MASK)) == 0) 620 if ((newlim->d_fieldmask &
621 (FS_DQ_LIMIT_MASK|FS_DQ_TIMER_MASK|FS_DQ_WARNS_MASK)) == 0)
610 return (0); 622 return (0);
611 623
612 tp = xfs_trans_alloc(mp, XFS_TRANS_QM_SETQLIM); 624 tp = xfs_trans_alloc(mp, XFS_TRANS_QM_SETQLIM);
@@ -691,12 +703,23 @@ xfs_qm_scall_setqlim(
691 qdprintk("ihard %Ld < isoft %Ld\n", hard, soft); 703 qdprintk("ihard %Ld < isoft %Ld\n", hard, soft);
692 } 704 }
693 705
706 /*
707 * Update warnings counter(s) if requested
708 */
709 if (newlim->d_fieldmask & FS_DQ_BWARNS)
710 INT_SET(ddq->d_bwarns, ARCH_CONVERT, newlim->d_bwarns);
711 if (newlim->d_fieldmask & FS_DQ_IWARNS)
712 INT_SET(ddq->d_iwarns, ARCH_CONVERT, newlim->d_iwarns);
713 if (newlim->d_fieldmask & FS_DQ_RTBWARNS)
714 INT_SET(ddq->d_rtbwarns, ARCH_CONVERT, newlim->d_rtbwarns);
715
694 if (id == 0) { 716 if (id == 0) {
695 /* 717 /*
696 * Timelimits for the super user set the relative time 718 * Timelimits for the super user set the relative time
697 * the other users can be over quota for this file system. 719 * the other users can be over quota for this file system.
698 * If it is zero a default is used. Ditto for the default 720 * If it is zero a default is used. Ditto for the default
699 * soft and hard limit values (already done, above). 721 * soft and hard limit values (already done, above), and
722 * for warnings.
700 */ 723 */
701 if (newlim->d_fieldmask & FS_DQ_BTIMER) { 724 if (newlim->d_fieldmask & FS_DQ_BTIMER) {
702 mp->m_quotainfo->qi_btimelimit = newlim->d_btimer; 725 mp->m_quotainfo->qi_btimelimit = newlim->d_btimer;
@@ -710,7 +733,13 @@ xfs_qm_scall_setqlim(
710 mp->m_quotainfo->qi_rtbtimelimit = newlim->d_rtbtimer; 733 mp->m_quotainfo->qi_rtbtimelimit = newlim->d_rtbtimer;
711 INT_SET(ddq->d_rtbtimer, ARCH_CONVERT, newlim->d_rtbtimer); 734 INT_SET(ddq->d_rtbtimer, ARCH_CONVERT, newlim->d_rtbtimer);
712 } 735 }
713 } else /* if (XFS_IS_QUOTA_ENFORCED(mp)) */ { 736 if (newlim->d_fieldmask & FS_DQ_BWARNS)
737 mp->m_quotainfo->qi_bwarnlimit = newlim->d_bwarns;
738 if (newlim->d_fieldmask & FS_DQ_IWARNS)
739 mp->m_quotainfo->qi_iwarnlimit = newlim->d_iwarns;
740 if (newlim->d_fieldmask & FS_DQ_RTBWARNS)
741 mp->m_quotainfo->qi_rtbwarnlimit = newlim->d_rtbwarns;
742 } else {
714 /* 743 /*
715 * If the user is now over quota, start the timelimit. 744 * If the user is now over quota, start the timelimit.
716 * The user will not be 'warned'. 745 * The user will not be 'warned'.
@@ -776,9 +805,9 @@ xfs_qm_log_quotaoff_end(
776 xfs_qoff_logitem_t *startqoff, 805 xfs_qoff_logitem_t *startqoff,
777 uint flags) 806 uint flags)
778{ 807{
779 xfs_trans_t *tp; 808 xfs_trans_t *tp;
780 int error; 809 int error;
781 xfs_qoff_logitem_t *qoffi; 810 xfs_qoff_logitem_t *qoffi;
782 811
783 tp = xfs_trans_alloc(mp, XFS_TRANS_QM_QUOTAOFF_END); 812 tp = xfs_trans_alloc(mp, XFS_TRANS_QM_QUOTAOFF_END);
784 813
@@ -928,18 +957,26 @@ xfs_qm_export_dquot(
928 957
929STATIC uint 958STATIC uint
930xfs_qm_import_qtype_flags( 959xfs_qm_import_qtype_flags(
931 uint uflags) 960 uint uflags)
932{ 961{
962 uint oflags = 0;
963
933 /* 964 /*
934 * Can't be both at the same time. 965 * Can't be more than one, or none.
935 */ 966 */
936 if (((uflags & (XFS_GROUP_QUOTA | XFS_USER_QUOTA)) == 967 if (((uflags & (XFS_GROUP_QUOTA | XFS_USER_QUOTA)) ==
937 (XFS_GROUP_QUOTA | XFS_USER_QUOTA)) || 968 (XFS_GROUP_QUOTA | XFS_USER_QUOTA)) ||
938 ((uflags & (XFS_GROUP_QUOTA | XFS_USER_QUOTA)) == 0)) 969 ((uflags & (XFS_GROUP_QUOTA | XFS_PROJ_QUOTA)) ==
970 (XFS_GROUP_QUOTA | XFS_PROJ_QUOTA)) ||
971 ((uflags & (XFS_USER_QUOTA | XFS_PROJ_QUOTA)) ==
972 (XFS_USER_QUOTA | XFS_PROJ_QUOTA)) ||
973 ((uflags & (XFS_GROUP_QUOTA|XFS_USER_QUOTA|XFS_PROJ_QUOTA)) == 0))
939 return (0); 974 return (0);
940 975
941 return (uflags & XFS_USER_QUOTA) ? 976 oflags |= (uflags & XFS_USER_QUOTA) ? XFS_DQ_USER : 0;
942 XFS_DQ_USER : XFS_DQ_GROUP; 977 oflags |= (uflags & XFS_PROJ_QUOTA) ? XFS_DQ_PROJ : 0;
978 oflags |= (uflags & XFS_GROUP_QUOTA) ? XFS_DQ_GROUP: 0;
979 return oflags;
943} 980}
944 981
945STATIC uint 982STATIC uint
@@ -947,14 +984,19 @@ xfs_qm_export_qtype_flags(
947 uint flags) 984 uint flags)
948{ 985{
949 /* 986 /*
950 * Can't be both at the same time. 987 * Can't be more than one, or none.
951 */ 988 */
952 ASSERT((flags & (XFS_GROUP_QUOTA | XFS_USER_QUOTA)) != 989 ASSERT((flags & (XFS_PROJ_QUOTA | XFS_USER_QUOTA)) !=
953 (XFS_GROUP_QUOTA | XFS_USER_QUOTA)); 990 (XFS_PROJ_QUOTA | XFS_USER_QUOTA));
954 ASSERT((flags & (XFS_GROUP_QUOTA | XFS_USER_QUOTA)) != 0); 991 ASSERT((flags & (XFS_PROJ_QUOTA | XFS_GROUP_QUOTA)) !=
992 (XFS_PROJ_QUOTA | XFS_GROUP_QUOTA));
993 ASSERT((flags & (XFS_USER_QUOTA | XFS_GROUP_QUOTA)) !=
994 (XFS_USER_QUOTA | XFS_GROUP_QUOTA));
995 ASSERT((flags & (XFS_PROJ_QUOTA|XFS_USER_QUOTA|XFS_GROUP_QUOTA)) != 0);
955 996
956 return (flags & XFS_DQ_USER) ? 997 return (flags & XFS_DQ_USER) ?
957 XFS_USER_QUOTA : XFS_GROUP_QUOTA; 998 XFS_USER_QUOTA : (flags & XFS_DQ_PROJ) ?
999 XFS_PROJ_QUOTA : XFS_GROUP_QUOTA;
958} 1000}
959 1001
960STATIC uint 1002STATIC uint
@@ -965,12 +1007,14 @@ xfs_qm_import_flags(
965 1007
966 if (uflags & XFS_QUOTA_UDQ_ACCT) 1008 if (uflags & XFS_QUOTA_UDQ_ACCT)
967 flags |= XFS_UQUOTA_ACCT; 1009 flags |= XFS_UQUOTA_ACCT;
1010 if (uflags & XFS_QUOTA_PDQ_ACCT)
1011 flags |= XFS_PQUOTA_ACCT;
968 if (uflags & XFS_QUOTA_GDQ_ACCT) 1012 if (uflags & XFS_QUOTA_GDQ_ACCT)
969 flags |= XFS_GQUOTA_ACCT; 1013 flags |= XFS_GQUOTA_ACCT;
970 if (uflags & XFS_QUOTA_UDQ_ENFD) 1014 if (uflags & XFS_QUOTA_UDQ_ENFD)
971 flags |= XFS_UQUOTA_ENFD; 1015 flags |= XFS_UQUOTA_ENFD;
972 if (uflags & XFS_QUOTA_GDQ_ENFD) 1016 if (uflags & (XFS_QUOTA_PDQ_ENFD|XFS_QUOTA_GDQ_ENFD))
973 flags |= XFS_GQUOTA_ENFD; 1017 flags |= XFS_OQUOTA_ENFD;
974 return (flags); 1018 return (flags);
975} 1019}
976 1020
@@ -984,12 +1028,16 @@ xfs_qm_export_flags(
984 uflags = 0; 1028 uflags = 0;
985 if (flags & XFS_UQUOTA_ACCT) 1029 if (flags & XFS_UQUOTA_ACCT)
986 uflags |= XFS_QUOTA_UDQ_ACCT; 1030 uflags |= XFS_QUOTA_UDQ_ACCT;
1031 if (flags & XFS_PQUOTA_ACCT)
1032 uflags |= XFS_QUOTA_PDQ_ACCT;
987 if (flags & XFS_GQUOTA_ACCT) 1033 if (flags & XFS_GQUOTA_ACCT)
988 uflags |= XFS_QUOTA_GDQ_ACCT; 1034 uflags |= XFS_QUOTA_GDQ_ACCT;
989 if (flags & XFS_UQUOTA_ENFD) 1035 if (flags & XFS_UQUOTA_ENFD)
990 uflags |= XFS_QUOTA_UDQ_ENFD; 1036 uflags |= XFS_QUOTA_UDQ_ENFD;
991 if (flags & XFS_GQUOTA_ENFD) 1037 if (flags & (XFS_OQUOTA_ENFD)) {
992 uflags |= XFS_QUOTA_GDQ_ENFD; 1038 uflags |= (flags & XFS_GQUOTA_ACCT) ?
1039 XFS_QUOTA_GDQ_ENFD : XFS_QUOTA_PDQ_ENFD;
1040 }
993 return (uflags); 1041 return (uflags);
994} 1042}
995 1043
@@ -1070,7 +1118,7 @@ again:
1070 xfs_qm_dqrele(ip->i_udquot); 1118 xfs_qm_dqrele(ip->i_udquot);
1071 ip->i_udquot = NULL; 1119 ip->i_udquot = NULL;
1072 } 1120 }
1073 if ((flags & XFS_GQUOTA_ACCT) && ip->i_gdquot) { 1121 if (flags & (XFS_PQUOTA_ACCT|XFS_GQUOTA_ACCT) && ip->i_gdquot) {
1074 xfs_qm_dqrele(ip->i_gdquot); 1122 xfs_qm_dqrele(ip->i_gdquot);
1075 ip->i_gdquot = NULL; 1123 ip->i_gdquot = NULL;
1076 } 1124 }
@@ -1160,7 +1208,6 @@ xfs_qm_dqtest_print(
1160{ 1208{
1161 cmn_err(CE_DEBUG, "-----------DQTEST DQUOT----------------"); 1209 cmn_err(CE_DEBUG, "-----------DQTEST DQUOT----------------");
1162 cmn_err(CE_DEBUG, "---- dquot ID = %d", d->d_id); 1210 cmn_err(CE_DEBUG, "---- dquot ID = %d", d->d_id);
1163 cmn_err(CE_DEBUG, "---- type = %s", XFS_QM_ISUDQ(d)? "USR" : "GRP");
1164 cmn_err(CE_DEBUG, "---- fs = 0x%p", d->q_mount); 1211 cmn_err(CE_DEBUG, "---- fs = 0x%p", d->q_mount);
1165 cmn_err(CE_DEBUG, "---- bcount = %Lu (0x%x)", 1212 cmn_err(CE_DEBUG, "---- bcount = %Lu (0x%x)",
1166 d->d_bcount, (int)d->d_bcount); 1213 d->d_bcount, (int)d->d_bcount);
@@ -1231,7 +1278,7 @@ xfs_dqtest_cmp2(
1231#ifdef QUOTADEBUG 1278#ifdef QUOTADEBUG
1232 if (!err) { 1279 if (!err) {
1233 cmn_err(CE_DEBUG, "%d [%s] [0x%p] qchecked", 1280 cmn_err(CE_DEBUG, "%d [%s] [0x%p] qchecked",
1234 d->d_id, XFS_QM_ISUDQ(d) ? "USR" : "GRP", d->q_mount); 1281 d->d_id, DQFLAGTO_TYPESTR(d), d->q_mount);
1235 } 1282 }
1236#endif 1283#endif
1237 return (err); 1284 return (err);
@@ -1287,6 +1334,7 @@ STATIC void
1287xfs_qm_internalqcheck_get_dquots( 1334xfs_qm_internalqcheck_get_dquots(
1288 xfs_mount_t *mp, 1335 xfs_mount_t *mp,
1289 xfs_dqid_t uid, 1336 xfs_dqid_t uid,
1337 xfs_dqid_t projid,
1290 xfs_dqid_t gid, 1338 xfs_dqid_t gid,
1291 xfs_dqtest_t **ud, 1339 xfs_dqtest_t **ud,
1292 xfs_dqtest_t **gd) 1340 xfs_dqtest_t **gd)
@@ -1295,6 +1343,8 @@ xfs_qm_internalqcheck_get_dquots(
1295 xfs_qm_internalqcheck_dqget(mp, uid, XFS_DQ_USER, ud); 1343 xfs_qm_internalqcheck_dqget(mp, uid, XFS_DQ_USER, ud);
1296 if (XFS_IS_GQUOTA_ON(mp)) 1344 if (XFS_IS_GQUOTA_ON(mp))
1297 xfs_qm_internalqcheck_dqget(mp, gid, XFS_DQ_GROUP, gd); 1345 xfs_qm_internalqcheck_dqget(mp, gid, XFS_DQ_GROUP, gd);
1346 else if (XFS_IS_PQUOTA_ON(mp))
1347 xfs_qm_internalqcheck_dqget(mp, projid, XFS_DQ_PROJ, gd);
1298} 1348}
1299 1349
1300 1350
@@ -1362,13 +1412,14 @@ xfs_qm_internalqcheck_adjust(
1362 } 1412 }
1363 xfs_qm_internalqcheck_get_dquots(mp, 1413 xfs_qm_internalqcheck_get_dquots(mp,
1364 (xfs_dqid_t) ip->i_d.di_uid, 1414 (xfs_dqid_t) ip->i_d.di_uid,
1415 (xfs_dqid_t) ip->i_d.di_projid,
1365 (xfs_dqid_t) ip->i_d.di_gid, 1416 (xfs_dqid_t) ip->i_d.di_gid,
1366 &ud, &gd); 1417 &ud, &gd);
1367 if (XFS_IS_UQUOTA_ON(mp)) { 1418 if (XFS_IS_UQUOTA_ON(mp)) {
1368 ASSERT(ud); 1419 ASSERT(ud);
1369 xfs_qm_internalqcheck_dqadjust(ip, ud); 1420 xfs_qm_internalqcheck_dqadjust(ip, ud);
1370 } 1421 }
1371 if (XFS_IS_GQUOTA_ON(mp)) { 1422 if (XFS_IS_OQUOTA_ON(mp)) {
1372 ASSERT(gd); 1423 ASSERT(gd);
1373 xfs_qm_internalqcheck_dqadjust(ip, gd); 1424 xfs_qm_internalqcheck_dqadjust(ip, gd);
1374 } 1425 }
diff --git a/fs/xfs/quota/xfs_quota_priv.h b/fs/xfs/quota/xfs_quota_priv.h
index 414b6004af21..bf413e70ec07 100644
--- a/fs/xfs/quota/xfs_quota_priv.h
+++ b/fs/xfs/quota/xfs_quota_priv.h
@@ -56,6 +56,7 @@
56#define XFS_QI_RTBTIMELIMIT(mp) ((mp)->m_quotainfo->qi_rtbtimelimit) 56#define XFS_QI_RTBTIMELIMIT(mp) ((mp)->m_quotainfo->qi_rtbtimelimit)
57#define XFS_QI_ITIMELIMIT(mp) ((mp)->m_quotainfo->qi_itimelimit) 57#define XFS_QI_ITIMELIMIT(mp) ((mp)->m_quotainfo->qi_itimelimit)
58#define XFS_QI_BWARNLIMIT(mp) ((mp)->m_quotainfo->qi_bwarnlimit) 58#define XFS_QI_BWARNLIMIT(mp) ((mp)->m_quotainfo->qi_bwarnlimit)
59#define XFS_QI_RTBWARNLIMIT(mp) ((mp)->m_quotainfo->qi_rtbwarnlimit)
59#define XFS_QI_IWARNLIMIT(mp) ((mp)->m_quotainfo->qi_iwarnlimit) 60#define XFS_QI_IWARNLIMIT(mp) ((mp)->m_quotainfo->qi_iwarnlimit)
60#define XFS_QI_QOFFLOCK(mp) ((mp)->m_quotainfo->qi_quotaofflock) 61#define XFS_QI_QOFFLOCK(mp) ((mp)->m_quotainfo->qi_quotaofflock)
61 62
@@ -102,7 +103,8 @@ static inline int XQMISLCKD(struct xfs_dqhash *h)
102 (xfs_Gqm->qm_grp_dqhtable + \ 103 (xfs_Gqm->qm_grp_dqhtable + \
103 XFS_DQ_HASHVAL(mp, id))) 104 XFS_DQ_HASHVAL(mp, id)))
104#define XFS_IS_DQTYPE_ON(mp, type) (type == XFS_DQ_USER ? \ 105#define XFS_IS_DQTYPE_ON(mp, type) (type == XFS_DQ_USER ? \
105 XFS_IS_UQUOTA_ON(mp):XFS_IS_GQUOTA_ON(mp)) 106 XFS_IS_UQUOTA_ON(mp) : \
107 XFS_IS_OQUOTA_ON(mp))
106#define XFS_IS_DQUOT_UNINITIALIZED(dqp) ( \ 108#define XFS_IS_DQUOT_UNINITIALIZED(dqp) ( \
107 !dqp->q_core.d_blk_hardlimit && \ 109 !dqp->q_core.d_blk_hardlimit && \
108 !dqp->q_core.d_blk_softlimit && \ 110 !dqp->q_core.d_blk_softlimit && \
@@ -177,16 +179,11 @@ for ((dqp) = (qlist)->qh_next; (dqp) != (xfs_dquot_t *)(qlist); \
177 (!((dqp)->q_core.d_id)) 179 (!((dqp)->q_core.d_id))
178 180
179#define XFS_PURGE_INODE(ip) \ 181#define XFS_PURGE_INODE(ip) \
180 { \ 182 IRELE(ip);
181 vmap_t dqvmap; \
182 vnode_t *dqvp; \
183 dqvp = XFS_ITOV(ip); \
184 VMAP(dqvp, dqvmap); \
185 VN_RELE(dqvp); \
186 }
187 183
188#define DQFLAGTO_TYPESTR(d) (((d)->dq_flags & XFS_DQ_USER) ? "USR" : \ 184#define DQFLAGTO_TYPESTR(d) (((d)->dq_flags & XFS_DQ_USER) ? "USR" : \
189 (((d)->dq_flags & XFS_DQ_GROUP) ? "GRP" : "???")) 185 (((d)->dq_flags & XFS_DQ_GROUP) ? "GRP" : \
186 (((d)->dq_flags & XFS_DQ_PROJ) ? "PRJ":"???")))
190#define DQFLAGTO_DIRTYSTR(d) (XFS_DQ_IS_DIRTY(d) ? "DIRTY" : "NOTDIRTY") 187#define DQFLAGTO_DIRTYSTR(d) (XFS_DQ_IS_DIRTY(d) ? "DIRTY" : "NOTDIRTY")
191 188
192#endif /* __XFS_QUOTA_PRIV_H__ */ 189#endif /* __XFS_QUOTA_PRIV_H__ */
diff --git a/fs/xfs/quota/xfs_trans_dquot.c b/fs/xfs/quota/xfs_trans_dquot.c
index 149b2a1fd949..3b99daf8a640 100644
--- a/fs/xfs/quota/xfs_trans_dquot.c
+++ b/fs/xfs/quota/xfs_trans_dquot.c
@@ -187,7 +187,7 @@ xfs_trans_dup_dqinfo(
187/* 187/*
188 * Wrap around mod_dquot to account for both user and group quotas. 188 * Wrap around mod_dquot to account for both user and group quotas.
189 */ 189 */
190void 190STATIC void
191xfs_trans_mod_dquot_byino( 191xfs_trans_mod_dquot_byino(
192 xfs_trans_t *tp, 192 xfs_trans_t *tp,
193 xfs_inode_t *ip, 193 xfs_inode_t *ip,
@@ -207,12 +207,10 @@ xfs_trans_mod_dquot_byino(
207 if (tp->t_dqinfo == NULL) 207 if (tp->t_dqinfo == NULL)
208 xfs_trans_alloc_dqinfo(tp); 208 xfs_trans_alloc_dqinfo(tp);
209 209
210 if (XFS_IS_UQUOTA_ON(mp) && ip->i_udquot) { 210 if (XFS_IS_UQUOTA_ON(mp) && ip->i_udquot)
211 (void) xfs_trans_mod_dquot(tp, ip->i_udquot, field, delta); 211 (void) xfs_trans_mod_dquot(tp, ip->i_udquot, field, delta);
212 } 212 if (XFS_IS_OQUOTA_ON(mp) && ip->i_gdquot)
213 if (XFS_IS_GQUOTA_ON(mp) && ip->i_gdquot) {
214 (void) xfs_trans_mod_dquot(tp, ip->i_gdquot, field, delta); 213 (void) xfs_trans_mod_dquot(tp, ip->i_gdquot, field, delta);
215 }
216} 214}
217 215
218STATIC xfs_dqtrx_t * 216STATIC xfs_dqtrx_t *
@@ -368,7 +366,7 @@ xfs_trans_dqlockedjoin(
368 * Unreserve just the reservations done by this transaction. 366 * Unreserve just the reservations done by this transaction.
369 * dquot is still left locked at exit. 367 * dquot is still left locked at exit.
370 */ 368 */
371void 369STATIC void
372xfs_trans_apply_dquot_deltas( 370xfs_trans_apply_dquot_deltas(
373 xfs_trans_t *tp) 371 xfs_trans_t *tp)
374{ 372{
@@ -499,7 +497,7 @@ xfs_trans_apply_dquot_deltas(
499 * Adjust the RT reservation. 497 * Adjust the RT reservation.
500 */ 498 */
501 if (qtrx->qt_rtblk_res != 0) { 499 if (qtrx->qt_rtblk_res != 0) {
502 if (qtrx->qt_blk_res != qtrx->qt_blk_res_used) { 500 if (qtrx->qt_rtblk_res != qtrx->qt_rtblk_res_used) {
503 if (qtrx->qt_rtblk_res > 501 if (qtrx->qt_rtblk_res >
504 qtrx->qt_rtblk_res_used) 502 qtrx->qt_rtblk_res_used)
505 dqp->q_res_rtbcount -= (xfs_qcnt_t) 503 dqp->q_res_rtbcount -= (xfs_qcnt_t)
@@ -532,12 +530,6 @@ xfs_trans_apply_dquot_deltas(
532 (xfs_qcnt_t)qtrx->qt_icount_delta; 530 (xfs_qcnt_t)qtrx->qt_icount_delta;
533 } 531 }
534 532
535
536#ifdef QUOTADEBUG
537 if (qtrx->qt_rtblk_res != 0)
538 cmn_err(CE_DEBUG, "RT res %d for 0x%p\n",
539 (int) qtrx->qt_rtblk_res, dqp);
540#endif
541 ASSERT(dqp->q_res_bcount >= 533 ASSERT(dqp->q_res_bcount >=
542 INT_GET(dqp->q_core.d_bcount, ARCH_CONVERT)); 534 INT_GET(dqp->q_core.d_bcount, ARCH_CONVERT));
543 ASSERT(dqp->q_res_icount >= 535 ASSERT(dqp->q_res_icount >=
@@ -638,7 +630,10 @@ xfs_trans_dqresv(
638 int error; 630 int error;
639 xfs_qcnt_t hardlimit; 631 xfs_qcnt_t hardlimit;
640 xfs_qcnt_t softlimit; 632 xfs_qcnt_t softlimit;
641 time_t btimer; 633 time_t timer;
634 xfs_qwarncnt_t warns;
635 xfs_qwarncnt_t warnlimit;
636 xfs_qcnt_t count;
642 xfs_qcnt_t *resbcountp; 637 xfs_qcnt_t *resbcountp;
643 xfs_quotainfo_t *q = mp->m_quotainfo; 638 xfs_quotainfo_t *q = mp->m_quotainfo;
644 639
@@ -653,7 +648,9 @@ xfs_trans_dqresv(
653 softlimit = INT_GET(dqp->q_core.d_blk_softlimit, ARCH_CONVERT); 648 softlimit = INT_GET(dqp->q_core.d_blk_softlimit, ARCH_CONVERT);
654 if (!softlimit) 649 if (!softlimit)
655 softlimit = q->qi_bsoftlimit; 650 softlimit = q->qi_bsoftlimit;
656 btimer = INT_GET(dqp->q_core.d_btimer, ARCH_CONVERT); 651 timer = INT_GET(dqp->q_core.d_btimer, ARCH_CONVERT);
652 warns = INT_GET(dqp->q_core.d_bwarns, ARCH_CONVERT);
653 warnlimit = XFS_QI_BWARNLIMIT(dqp->q_mount);
657 resbcountp = &dqp->q_res_bcount; 654 resbcountp = &dqp->q_res_bcount;
658 } else { 655 } else {
659 ASSERT(flags & XFS_TRANS_DQ_RES_RTBLKS); 656 ASSERT(flags & XFS_TRANS_DQ_RES_RTBLKS);
@@ -663,7 +660,9 @@ xfs_trans_dqresv(
663 softlimit = INT_GET(dqp->q_core.d_rtb_softlimit, ARCH_CONVERT); 660 softlimit = INT_GET(dqp->q_core.d_rtb_softlimit, ARCH_CONVERT);
664 if (!softlimit) 661 if (!softlimit)
665 softlimit = q->qi_rtbsoftlimit; 662 softlimit = q->qi_rtbsoftlimit;
666 btimer = INT_GET(dqp->q_core.d_rtbtimer, ARCH_CONVERT); 663 timer = INT_GET(dqp->q_core.d_rtbtimer, ARCH_CONVERT);
664 warns = INT_GET(dqp->q_core.d_rtbwarns, ARCH_CONVERT);
665 warnlimit = XFS_QI_RTBWARNLIMIT(dqp->q_mount);
667 resbcountp = &dqp->q_res_rtbcount; 666 resbcountp = &dqp->q_res_rtbcount;
668 } 667 }
669 error = 0; 668 error = 0;
@@ -693,37 +692,36 @@ xfs_trans_dqresv(
693 * If timer or warnings has expired, 692 * If timer or warnings has expired,
694 * return EDQUOT 693 * return EDQUOT
695 */ 694 */
696 if ((btimer != 0 && get_seconds() > btimer) || 695 if ((timer != 0 && get_seconds() > timer) ||
697 (dqp->q_core.d_bwarns && 696 (warns != 0 && warns >= warnlimit)) {
698 INT_GET(dqp->q_core.d_bwarns, ARCH_CONVERT) >=
699 XFS_QI_BWARNLIMIT(dqp->q_mount))) {
700 error = EDQUOT; 697 error = EDQUOT;
701 goto error_return; 698 goto error_return;
702 } 699 }
703 } 700 }
704 } 701 }
705 if (ninos > 0) { 702 if (ninos > 0) {
706 hardlimit = INT_GET(dqp->q_core.d_ino_hardlimit, ARCH_CONVERT); 703 count = INT_GET(dqp->q_core.d_icount, ARCH_CONVERT);
704 timer = INT_GET(dqp->q_core.d_itimer, ARCH_CONVERT);
705 warns = INT_GET(dqp->q_core.d_iwarns, ARCH_CONVERT);
706 warnlimit = XFS_QI_IWARNLIMIT(dqp->q_mount);
707 hardlimit = INT_GET(dqp->q_core.d_ino_hardlimit,
708 ARCH_CONVERT);
707 if (!hardlimit) 709 if (!hardlimit)
708 hardlimit = q->qi_ihardlimit; 710 hardlimit = q->qi_ihardlimit;
709 softlimit = INT_GET(dqp->q_core.d_ino_softlimit, ARCH_CONVERT); 711 softlimit = INT_GET(dqp->q_core.d_ino_softlimit,
712 ARCH_CONVERT);
710 if (!softlimit) 713 if (!softlimit)
711 softlimit = q->qi_isoftlimit; 714 softlimit = q->qi_isoftlimit;
712 if (hardlimit > 0ULL && 715 if (hardlimit > 0ULL && count >= hardlimit) {
713 INT_GET(dqp->q_core.d_icount, ARCH_CONVERT) >= hardlimit) {
714 error = EDQUOT; 716 error = EDQUOT;
715 goto error_return; 717 goto error_return;
716 } else if (softlimit > 0ULL && 718 } else if (softlimit > 0ULL && count >= softlimit) {
717 INT_GET(dqp->q_core.d_icount, ARCH_CONVERT) >= softlimit) {
718 /* 719 /*
719 * If timer or warnings has expired, 720 * If timer or warnings has expired,
720 * return EDQUOT 721 * return EDQUOT
721 */ 722 */
722 if ((dqp->q_core.d_itimer && 723 if ((timer != 0 && get_seconds() > timer) ||
723 get_seconds() > INT_GET(dqp->q_core.d_itimer, ARCH_CONVERT)) || 724 (warns != 0 && warns >= warnlimit)) {
724 (dqp->q_core.d_iwarns &&
725 INT_GET(dqp->q_core.d_iwarns, ARCH_CONVERT) >=
726 XFS_QI_IWARNLIMIT(dqp->q_mount))) {
727 error = EDQUOT; 725 error = EDQUOT;
728 goto error_return; 726 goto error_return;
729 } 727 }
diff --git a/fs/xfs/support/debug.c b/fs/xfs/support/debug.c
index 7d6e1f37df10..4ed7b6928cd7 100644
--- a/fs/xfs/support/debug.c
+++ b/fs/xfs/support/debug.c
@@ -36,7 +36,6 @@
36#include <linux/sched.h> 36#include <linux/sched.h>
37#include <linux/kernel.h> 37#include <linux/kernel.h>
38 38
39int doass = 1;
40static char message[256]; /* keep it off the stack */ 39static char message[256]; /* keep it off the stack */
41static DEFINE_SPINLOCK(xfs_err_lock); 40static DEFINE_SPINLOCK(xfs_err_lock);
42 41
diff --git a/fs/xfs/support/debug.h b/fs/xfs/support/debug.h
index 40b0f4c54d9e..c5b9365a7e2a 100644
--- a/fs/xfs/support/debug.h
+++ b/fs/xfs/support/debug.h
@@ -50,16 +50,11 @@ extern void cmn_err(int, char *, ...);
50#endif 50#endif
51 51
52#ifdef DEBUG 52#ifdef DEBUG
53# ifdef lint 53# define ASSERT(EX) ((EX) ? ((void)0) : assfail(#EX, __FILE__, __LINE__))
54# define ASSERT(EX) ((void)0) /* avoid "constant in conditional" babble */
55# else
56# define ASSERT(EX) ((!doass||(EX))?((void)0):assfail(#EX, __FILE__, __LINE__))
57# endif /* lint */
58#else 54#else
59# define ASSERT(x) ((void)0) 55# define ASSERT(x) ((void)0)
60#endif 56#endif
61 57
62extern int doass; /* dynamically turn off asserts */
63extern void assfail(char *, char *, int); 58extern void assfail(char *, char *, int);
64#ifdef DEBUG 59#ifdef DEBUG
65extern unsigned long random(void); 60extern unsigned long random(void);
diff --git a/fs/xfs/xfs_alloc.c b/fs/xfs/xfs_alloc.c
index 36603db10fe9..dcfe19703620 100644
--- a/fs/xfs/xfs_alloc.c
+++ b/fs/xfs/xfs_alloc.c
@@ -59,7 +59,7 @@
59#define XFSA_FIXUP_BNO_OK 1 59#define XFSA_FIXUP_BNO_OK 1
60#define XFSA_FIXUP_CNT_OK 2 60#define XFSA_FIXUP_CNT_OK 2
61 61
62int 62STATIC int
63xfs_alloc_search_busy(xfs_trans_t *tp, 63xfs_alloc_search_busy(xfs_trans_t *tp,
64 xfs_agnumber_t agno, 64 xfs_agnumber_t agno,
65 xfs_agblock_t bno, 65 xfs_agblock_t bno,
@@ -2562,7 +2562,7 @@ xfs_alloc_clear_busy(xfs_trans_t *tp,
2562/* 2562/*
2563 * returns non-zero if any of (agno,bno):len is in a busy list 2563 * returns non-zero if any of (agno,bno):len is in a busy list
2564 */ 2564 */
2565int 2565STATIC int
2566xfs_alloc_search_busy(xfs_trans_t *tp, 2566xfs_alloc_search_busy(xfs_trans_t *tp,
2567 xfs_agnumber_t agno, 2567 xfs_agnumber_t agno,
2568 xfs_agblock_t bno, 2568 xfs_agblock_t bno,
diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c
index ee8b5904ec7c..a41ad3a5e554 100644
--- a/fs/xfs/xfs_attr.c
+++ b/fs/xfs/xfs_attr.c
@@ -71,6 +71,11 @@
71 * Provide the external interfaces to manage attribute lists. 71 * Provide the external interfaces to manage attribute lists.
72 */ 72 */
73 73
74#define ATTR_SYSCOUNT 2
75STATIC struct attrnames posix_acl_access;
76STATIC struct attrnames posix_acl_default;
77STATIC struct attrnames *attr_system_names[ATTR_SYSCOUNT];
78
74/*======================================================================== 79/*========================================================================
75 * Function prototypes for the kernel. 80 * Function prototypes for the kernel.
76 *========================================================================*/ 81 *========================================================================*/
@@ -83,6 +88,7 @@ STATIC int xfs_attr_shortform_addname(xfs_da_args_t *args);
83/* 88/*
84 * Internal routines when attribute list is one block. 89 * Internal routines when attribute list is one block.
85 */ 90 */
91STATIC int xfs_attr_leaf_get(xfs_da_args_t *args);
86STATIC int xfs_attr_leaf_addname(xfs_da_args_t *args); 92STATIC int xfs_attr_leaf_addname(xfs_da_args_t *args);
87STATIC int xfs_attr_leaf_removename(xfs_da_args_t *args); 93STATIC int xfs_attr_leaf_removename(xfs_da_args_t *args);
88STATIC int xfs_attr_leaf_list(xfs_attr_list_context_t *context); 94STATIC int xfs_attr_leaf_list(xfs_attr_list_context_t *context);
@@ -90,6 +96,7 @@ STATIC int xfs_attr_leaf_list(xfs_attr_list_context_t *context);
90/* 96/*
91 * Internal routines when attribute list is more than one block. 97 * Internal routines when attribute list is more than one block.
92 */ 98 */
99STATIC int xfs_attr_node_get(xfs_da_args_t *args);
93STATIC int xfs_attr_node_addname(xfs_da_args_t *args); 100STATIC int xfs_attr_node_addname(xfs_da_args_t *args);
94STATIC int xfs_attr_node_removename(xfs_da_args_t *args); 101STATIC int xfs_attr_node_removename(xfs_da_args_t *args);
95STATIC int xfs_attr_node_list(xfs_attr_list_context_t *context); 102STATIC int xfs_attr_node_list(xfs_attr_list_context_t *context);
@@ -1102,7 +1109,7 @@ xfs_attr_leaf_removename(xfs_da_args_t *args)
1102 * This leaf block cannot have a "remote" value, we only call this routine 1109 * This leaf block cannot have a "remote" value, we only call this routine
1103 * if bmap_one_block() says there is only one block (ie: no remote blks). 1110 * if bmap_one_block() says there is only one block (ie: no remote blks).
1104 */ 1111 */
1105int 1112STATIC int
1106xfs_attr_leaf_get(xfs_da_args_t *args) 1113xfs_attr_leaf_get(xfs_da_args_t *args)
1107{ 1114{
1108 xfs_dabuf_t *bp; 1115 xfs_dabuf_t *bp;
@@ -1707,7 +1714,7 @@ xfs_attr_refillstate(xfs_da_state_t *state)
1707 * block, ie: both true Btree attr lists and for single-leaf-blocks with 1714 * block, ie: both true Btree attr lists and for single-leaf-blocks with
1708 * "remote" values taking up more blocks. 1715 * "remote" values taking up more blocks.
1709 */ 1716 */
1710int 1717STATIC int
1711xfs_attr_node_get(xfs_da_args_t *args) 1718xfs_attr_node_get(xfs_da_args_t *args)
1712{ 1719{
1713 xfs_da_state_t *state; 1720 xfs_da_state_t *state;
@@ -2398,7 +2405,7 @@ posix_acl_default_exists(
2398 return xfs_acl_vhasacl_default(vp); 2405 return xfs_acl_vhasacl_default(vp);
2399} 2406}
2400 2407
2401struct attrnames posix_acl_access = { 2408STATIC struct attrnames posix_acl_access = {
2402 .attr_name = "posix_acl_access", 2409 .attr_name = "posix_acl_access",
2403 .attr_namelen = sizeof("posix_acl_access") - 1, 2410 .attr_namelen = sizeof("posix_acl_access") - 1,
2404 .attr_get = posix_acl_access_get, 2411 .attr_get = posix_acl_access_get,
@@ -2407,7 +2414,7 @@ struct attrnames posix_acl_access = {
2407 .attr_exists = posix_acl_access_exists, 2414 .attr_exists = posix_acl_access_exists,
2408}; 2415};
2409 2416
2410struct attrnames posix_acl_default = { 2417STATIC struct attrnames posix_acl_default = {
2411 .attr_name = "posix_acl_default", 2418 .attr_name = "posix_acl_default",
2412 .attr_namelen = sizeof("posix_acl_default") - 1, 2419 .attr_namelen = sizeof("posix_acl_default") - 1,
2413 .attr_get = posix_acl_default_get, 2420 .attr_get = posix_acl_default_get,
@@ -2416,7 +2423,7 @@ struct attrnames posix_acl_default = {
2416 .attr_exists = posix_acl_default_exists, 2423 .attr_exists = posix_acl_default_exists,
2417}; 2424};
2418 2425
2419struct attrnames *attr_system_names[] = 2426STATIC struct attrnames *attr_system_names[] =
2420 { &posix_acl_access, &posix_acl_default }; 2427 { &posix_acl_access, &posix_acl_default };
2421 2428
2422 2429
diff --git a/fs/xfs/xfs_attr.h b/fs/xfs/xfs_attr.h
index 67cd0f5ac1a7..45ab1c542baf 100644
--- a/fs/xfs/xfs_attr.h
+++ b/fs/xfs/xfs_attr.h
@@ -76,11 +76,6 @@ extern struct attrnames attr_system;
76extern struct attrnames attr_trusted; 76extern struct attrnames attr_trusted;
77extern struct attrnames *attr_namespaces[ATTR_NAMECOUNT]; 77extern struct attrnames *attr_namespaces[ATTR_NAMECOUNT];
78 78
79#define ATTR_SYSCOUNT 2
80extern struct attrnames posix_acl_access;
81extern struct attrnames posix_acl_default;
82extern struct attrnames *attr_system_names[ATTR_SYSCOUNT];
83
84extern attrnames_t *attr_lookup_namespace(char *, attrnames_t **, int); 79extern attrnames_t *attr_lookup_namespace(char *, attrnames_t **, int);
85extern int attr_generic_list(struct vnode *, void *, size_t, int, ssize_t *); 80extern int attr_generic_list(struct vnode *, void *, size_t, int, ssize_t *);
86 81
@@ -184,8 +179,6 @@ int xfs_attr_list(bhv_desc_t *, char *, int, int,
184 struct attrlist_cursor_kern *, struct cred *); 179 struct attrlist_cursor_kern *, struct cred *);
185int xfs_attr_inactive(struct xfs_inode *dp); 180int xfs_attr_inactive(struct xfs_inode *dp);
186 181
187int xfs_attr_node_get(struct xfs_da_args *);
188int xfs_attr_leaf_get(struct xfs_da_args *);
189int xfs_attr_shortform_getvalue(struct xfs_da_args *); 182int xfs_attr_shortform_getvalue(struct xfs_da_args *);
190int xfs_attr_fetch(struct xfs_inode *, char *, int, 183int xfs_attr_fetch(struct xfs_inode *, char *, int,
191 char *, int *, int, struct cred *); 184 char *, int *, int, struct cred *);
diff --git a/fs/xfs/xfs_attr_leaf.c b/fs/xfs/xfs_attr_leaf.c
index b11256e58bf4..1cdd574c63a9 100644
--- a/fs/xfs/xfs_attr_leaf.c
+++ b/fs/xfs/xfs_attr_leaf.c
@@ -79,6 +79,8 @@
79/* 79/*
80 * Routines used for growing the Btree. 80 * Routines used for growing the Btree.
81 */ 81 */
82STATIC int xfs_attr_leaf_create(xfs_da_args_t *args, xfs_dablk_t which_block,
83 xfs_dabuf_t **bpp);
82STATIC int xfs_attr_leaf_add_work(xfs_dabuf_t *leaf_buffer, xfs_da_args_t *args, 84STATIC int xfs_attr_leaf_add_work(xfs_dabuf_t *leaf_buffer, xfs_da_args_t *args,
83 int freemap_index); 85 int freemap_index);
84STATIC void xfs_attr_leaf_compact(xfs_trans_t *trans, xfs_dabuf_t *leaf_buffer); 86STATIC void xfs_attr_leaf_compact(xfs_trans_t *trans, xfs_dabuf_t *leaf_buffer);
@@ -92,6 +94,16 @@ STATIC int xfs_attr_leaf_figure_balance(xfs_da_state_t *state,
92 int *number_usedbytes_in_blk1); 94 int *number_usedbytes_in_blk1);
93 95
94/* 96/*
97 * Routines used for shrinking the Btree.
98 */
99STATIC int xfs_attr_node_inactive(xfs_trans_t **trans, xfs_inode_t *dp,
100 xfs_dabuf_t *bp, int level);
101STATIC int xfs_attr_leaf_inactive(xfs_trans_t **trans, xfs_inode_t *dp,
102 xfs_dabuf_t *bp);
103STATIC int xfs_attr_leaf_freextent(xfs_trans_t **trans, xfs_inode_t *dp,
104 xfs_dablk_t blkno, int blkcnt);
105
106/*
95 * Utility routines. 107 * Utility routines.
96 */ 108 */
97STATIC void xfs_attr_leaf_moveents(xfs_attr_leafblock_t *src_leaf, 109STATIC void xfs_attr_leaf_moveents(xfs_attr_leafblock_t *src_leaf,
@@ -99,6 +111,10 @@ STATIC void xfs_attr_leaf_moveents(xfs_attr_leafblock_t *src_leaf,
99 xfs_attr_leafblock_t *dst_leaf, 111 xfs_attr_leafblock_t *dst_leaf,
100 int dst_start, int move_count, 112 int dst_start, int move_count,
101 xfs_mount_t *mp); 113 xfs_mount_t *mp);
114STATIC int xfs_attr_leaf_entsize(xfs_attr_leafblock_t *leaf, int index);
115STATIC int xfs_attr_put_listent(xfs_attr_list_context_t *context,
116 attrnames_t *, char *name, int namelen,
117 int valuelen);
102 118
103 119
104/*======================================================================== 120/*========================================================================
@@ -774,7 +790,7 @@ out:
774 * Create the initial contents of a leaf attribute list 790 * Create the initial contents of a leaf attribute list
775 * or a leaf in a node attribute list. 791 * or a leaf in a node attribute list.
776 */ 792 */
777int 793STATIC int
778xfs_attr_leaf_create(xfs_da_args_t *args, xfs_dablk_t blkno, xfs_dabuf_t **bpp) 794xfs_attr_leaf_create(xfs_da_args_t *args, xfs_dablk_t blkno, xfs_dabuf_t **bpp)
779{ 795{
780 xfs_attr_leafblock_t *leaf; 796 xfs_attr_leafblock_t *leaf;
@@ -2209,7 +2225,7 @@ xfs_attr_leaf_lasthash(xfs_dabuf_t *bp, int *count)
2209 * Calculate the number of bytes used to store the indicated attribute 2225 * Calculate the number of bytes used to store the indicated attribute
2210 * (whether local or remote only calculate bytes in this block). 2226 * (whether local or remote only calculate bytes in this block).
2211 */ 2227 */
2212int 2228STATIC int
2213xfs_attr_leaf_entsize(xfs_attr_leafblock_t *leaf, int index) 2229xfs_attr_leaf_entsize(xfs_attr_leafblock_t *leaf, int index)
2214{ 2230{
2215 xfs_attr_leaf_name_local_t *name_loc; 2231 xfs_attr_leaf_name_local_t *name_loc;
@@ -2380,7 +2396,7 @@ xfs_attr_leaf_list_int(xfs_dabuf_t *bp, xfs_attr_list_context_t *context)
2380 * we may be reading them directly out of a user buffer. 2396 * we may be reading them directly out of a user buffer.
2381 */ 2397 */
2382/*ARGSUSED*/ 2398/*ARGSUSED*/
2383int 2399STATIC int
2384xfs_attr_put_listent(xfs_attr_list_context_t *context, 2400xfs_attr_put_listent(xfs_attr_list_context_t *context,
2385 attrnames_t *namesp, char *name, int namelen, int valuelen) 2401 attrnames_t *namesp, char *name, int namelen, int valuelen)
2386{ 2402{
@@ -2740,7 +2756,7 @@ xfs_attr_root_inactive(xfs_trans_t **trans, xfs_inode_t *dp)
2740 * Recurse (gasp!) through the attribute nodes until we find leaves. 2756 * Recurse (gasp!) through the attribute nodes until we find leaves.
2741 * We're doing a depth-first traversal in order to invalidate everything. 2757 * We're doing a depth-first traversal in order to invalidate everything.
2742 */ 2758 */
2743int 2759STATIC int
2744xfs_attr_node_inactive(xfs_trans_t **trans, xfs_inode_t *dp, xfs_dabuf_t *bp, 2760xfs_attr_node_inactive(xfs_trans_t **trans, xfs_inode_t *dp, xfs_dabuf_t *bp,
2745 int level) 2761 int level)
2746{ 2762{
@@ -2849,7 +2865,7 @@ xfs_attr_node_inactive(xfs_trans_t **trans, xfs_inode_t *dp, xfs_dabuf_t *bp,
2849 * Note that we must release the lock on the buffer so that we are not 2865 * Note that we must release the lock on the buffer so that we are not
2850 * caught holding something that the logging code wants to flush to disk. 2866 * caught holding something that the logging code wants to flush to disk.
2851 */ 2867 */
2852int 2868STATIC int
2853xfs_attr_leaf_inactive(xfs_trans_t **trans, xfs_inode_t *dp, xfs_dabuf_t *bp) 2869xfs_attr_leaf_inactive(xfs_trans_t **trans, xfs_inode_t *dp, xfs_dabuf_t *bp)
2854{ 2870{
2855 xfs_attr_leafblock_t *leaf; 2871 xfs_attr_leafblock_t *leaf;
@@ -2934,7 +2950,7 @@ xfs_attr_leaf_inactive(xfs_trans_t **trans, xfs_inode_t *dp, xfs_dabuf_t *bp)
2934 * Look at all the extents for this logical region, 2950 * Look at all the extents for this logical region,
2935 * invalidate any buffers that are incore/in transactions. 2951 * invalidate any buffers that are incore/in transactions.
2936 */ 2952 */
2937int 2953STATIC int
2938xfs_attr_leaf_freextent(xfs_trans_t **trans, xfs_inode_t *dp, 2954xfs_attr_leaf_freextent(xfs_trans_t **trans, xfs_inode_t *dp,
2939 xfs_dablk_t blkno, int blkcnt) 2955 xfs_dablk_t blkno, int blkcnt)
2940{ 2956{
diff --git a/fs/xfs/xfs_attr_leaf.h b/fs/xfs/xfs_attr_leaf.h
index b1480e0b3349..0a4cfad6df91 100644
--- a/fs/xfs/xfs_attr_leaf.h
+++ b/fs/xfs/xfs_attr_leaf.h
@@ -261,8 +261,6 @@ int xfs_attr_leaf_flipflags(xfs_da_args_t *args);
261/* 261/*
262 * Routines used for growing the Btree. 262 * Routines used for growing the Btree.
263 */ 263 */
264int xfs_attr_leaf_create(struct xfs_da_args *args, xfs_dablk_t which_block,
265 struct xfs_dabuf **bpp);
266int xfs_attr_leaf_split(struct xfs_da_state *state, 264int xfs_attr_leaf_split(struct xfs_da_state *state,
267 struct xfs_da_state_blk *oldblk, 265 struct xfs_da_state_blk *oldblk,
268 struct xfs_da_state_blk *newblk); 266 struct xfs_da_state_blk *newblk);
@@ -284,12 +282,6 @@ void xfs_attr_leaf_unbalance(struct xfs_da_state *state,
284 struct xfs_da_state_blk *drop_blk, 282 struct xfs_da_state_blk *drop_blk,
285 struct xfs_da_state_blk *save_blk); 283 struct xfs_da_state_blk *save_blk);
286int xfs_attr_root_inactive(struct xfs_trans **trans, struct xfs_inode *dp); 284int xfs_attr_root_inactive(struct xfs_trans **trans, struct xfs_inode *dp);
287int xfs_attr_node_inactive(struct xfs_trans **trans, struct xfs_inode *dp,
288 struct xfs_dabuf *bp, int level);
289int xfs_attr_leaf_inactive(struct xfs_trans **trans, struct xfs_inode *dp,
290 struct xfs_dabuf *bp);
291int xfs_attr_leaf_freextent(struct xfs_trans **trans, struct xfs_inode *dp,
292 xfs_dablk_t blkno, int blkcnt);
293 285
294/* 286/*
295 * Utility routines. 287 * Utility routines.
@@ -299,10 +291,6 @@ int xfs_attr_leaf_order(struct xfs_dabuf *leaf1_bp,
299 struct xfs_dabuf *leaf2_bp); 291 struct xfs_dabuf *leaf2_bp);
300int xfs_attr_leaf_newentsize(struct xfs_da_args *args, int blocksize, 292int xfs_attr_leaf_newentsize(struct xfs_da_args *args, int blocksize,
301 int *local); 293 int *local);
302int xfs_attr_leaf_entsize(struct xfs_attr_leafblock *leaf, int index);
303int xfs_attr_put_listent(struct xfs_attr_list_context *context,
304 struct attrnames *, char *name, int namelen,
305 int valuelen);
306int xfs_attr_rolltrans(struct xfs_trans **transp, struct xfs_inode *dp); 294int xfs_attr_rolltrans(struct xfs_trans **transp, struct xfs_inode *dp);
307 295
308#endif /* __XFS_ATTR_LEAF_H__ */ 296#endif /* __XFS_ATTR_LEAF_H__ */
diff --git a/fs/xfs/xfs_bit.c b/fs/xfs/xfs_bit.c
index a20a6c3dc13e..76c9ad3875ef 100644
--- a/fs/xfs/xfs_bit.c
+++ b/fs/xfs/xfs_bit.c
@@ -45,7 +45,7 @@
45/* 45/*
46 * Index of high bit number in byte, -1 for none set, 0..7 otherwise. 46 * Index of high bit number in byte, -1 for none set, 0..7 otherwise.
47 */ 47 */
48const char xfs_highbit[256] = { 48STATIC const char xfs_highbit[256] = {
49 -1, 0, 1, 1, 2, 2, 2, 2, /* 00 .. 07 */ 49 -1, 0, 1, 1, 2, 2, 2, 2, /* 00 .. 07 */
50 3, 3, 3, 3, 3, 3, 3, 3, /* 08 .. 0f */ 50 3, 3, 3, 3, 3, 3, 3, 3, /* 08 .. 0f */
51 4, 4, 4, 4, 4, 4, 4, 4, /* 10 .. 17 */ 51 4, 4, 4, 4, 4, 4, 4, 4, /* 10 .. 17 */
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
index de3162418663..6f5d283888aa 100644
--- a/fs/xfs/xfs_bmap.c
+++ b/fs/xfs/xfs_bmap.c
@@ -301,6 +301,19 @@ xfs_bmap_search_extents(
301 xfs_bmbt_irec_t *gotp, /* out: extent entry found */ 301 xfs_bmbt_irec_t *gotp, /* out: extent entry found */
302 xfs_bmbt_irec_t *prevp); /* out: previous extent entry found */ 302 xfs_bmbt_irec_t *prevp); /* out: previous extent entry found */
303 303
304/*
305 * Check the last inode extent to determine whether this allocation will result
306 * in blocks being allocated at the end of the file. When we allocate new data
307 * blocks at the end of the file which do not start at the previous data block,
308 * we will try to align the new blocks at stripe unit boundaries.
309 */
310STATIC int /* error */
311xfs_bmap_isaeof(
312 xfs_inode_t *ip, /* incore inode pointer */
313 xfs_fileoff_t off, /* file offset in fsblocks */
314 int whichfork, /* data or attribute fork */
315 char *aeof); /* return value */
316
304#ifdef XFS_BMAP_TRACE 317#ifdef XFS_BMAP_TRACE
305/* 318/*
306 * Add a bmap trace buffer entry. Base routine for the others. 319 * Add a bmap trace buffer entry. Base routine for the others.
@@ -4532,18 +4545,17 @@ xfs_bmapi(
4532 xfs_extlen_t alen; /* allocated extent length */ 4545 xfs_extlen_t alen; /* allocated extent length */
4533 xfs_fileoff_t aoff; /* allocated file offset */ 4546 xfs_fileoff_t aoff; /* allocated file offset */
4534 xfs_bmalloca_t bma; /* args for xfs_bmap_alloc */ 4547 xfs_bmalloca_t bma; /* args for xfs_bmap_alloc */
4535 char contig; /* allocation must be one extent */
4536 xfs_btree_cur_t *cur; /* bmap btree cursor */ 4548 xfs_btree_cur_t *cur; /* bmap btree cursor */
4537 char delay; /* this request is for delayed alloc */
4538 xfs_fileoff_t end; /* end of mapped file region */ 4549 xfs_fileoff_t end; /* end of mapped file region */
4539 int eof; /* we've hit the end of extent list */ 4550 int eof; /* we've hit the end of extent list */
4551 char contig; /* allocation must be one extent */
4552 char delay; /* this request is for delayed alloc */
4553 char exact; /* don't do all of wasdelayed extent */
4540 xfs_bmbt_rec_t *ep; /* extent list entry pointer */ 4554 xfs_bmbt_rec_t *ep; /* extent list entry pointer */
4541 int error; /* error return */ 4555 int error; /* error return */
4542 char exact; /* don't do all of wasdelayed extent */
4543 xfs_bmbt_irec_t got; /* current extent list record */ 4556 xfs_bmbt_irec_t got; /* current extent list record */
4544 xfs_ifork_t *ifp; /* inode fork pointer */ 4557 xfs_ifork_t *ifp; /* inode fork pointer */
4545 xfs_extlen_t indlen; /* indirect blocks length */ 4558 xfs_extlen_t indlen; /* indirect blocks length */
4546 char inhole; /* current location is hole in file */
4547 xfs_extnum_t lastx; /* last useful extent number */ 4559 xfs_extnum_t lastx; /* last useful extent number */
4548 int logflags; /* flags for transaction logging */ 4560 int logflags; /* flags for transaction logging */
4549 xfs_extlen_t minleft; /* min blocks left after allocation */ 4561 xfs_extlen_t minleft; /* min blocks left after allocation */
@@ -4554,13 +4566,15 @@ xfs_bmapi(
4554 xfs_extnum_t nextents; /* number of extents in file */ 4566 xfs_extnum_t nextents; /* number of extents in file */
4555 xfs_fileoff_t obno; /* old block number (offset) */ 4567 xfs_fileoff_t obno; /* old block number (offset) */
4556 xfs_bmbt_irec_t prev; /* previous extent list record */ 4568 xfs_bmbt_irec_t prev; /* previous extent list record */
4557 char stateless; /* ignore state flag set */
4558 int tmp_logflags; /* temp flags holder */ 4569 int tmp_logflags; /* temp flags holder */
4570 int whichfork; /* data or attr fork */
4571 char inhole; /* current location is hole in file */
4572 char stateless; /* ignore state flag set */
4559 char trim; /* output trimmed to match range */ 4573 char trim; /* output trimmed to match range */
4560 char userdata; /* allocating non-metadata */ 4574 char userdata; /* allocating non-metadata */
4561 char wasdelay; /* old extent was delayed */ 4575 char wasdelay; /* old extent was delayed */
4562 int whichfork; /* data or attr fork */
4563 char wr; /* this is a write request */ 4576 char wr; /* this is a write request */
4577 char rt; /* this is a realtime file */
4564 char rsvd; /* OK to allocate reserved blocks */ 4578 char rsvd; /* OK to allocate reserved blocks */
4565#ifdef DEBUG 4579#ifdef DEBUG
4566 xfs_fileoff_t orig_bno; /* original block number value */ 4580 xfs_fileoff_t orig_bno; /* original block number value */
@@ -4590,6 +4604,7 @@ xfs_bmapi(
4590 } 4604 }
4591 if (XFS_FORCED_SHUTDOWN(mp)) 4605 if (XFS_FORCED_SHUTDOWN(mp))
4592 return XFS_ERROR(EIO); 4606 return XFS_ERROR(EIO);
4607 rt = XFS_IS_REALTIME_INODE(ip);
4593 ifp = XFS_IFORK_PTR(ip, whichfork); 4608 ifp = XFS_IFORK_PTR(ip, whichfork);
4594 ASSERT(ifp->if_ext_max == 4609 ASSERT(ifp->if_ext_max ==
4595 XFS_IFORK_SIZE(ip, whichfork) / (uint)sizeof(xfs_bmbt_rec_t)); 4610 XFS_IFORK_SIZE(ip, whichfork) / (uint)sizeof(xfs_bmbt_rec_t));
@@ -4694,9 +4709,16 @@ xfs_bmapi(
4694 } 4709 }
4695 minlen = contig ? alen : 1; 4710 minlen = contig ? alen : 1;
4696 if (delay) { 4711 if (delay) {
4697 indlen = (xfs_extlen_t) 4712 xfs_extlen_t extsz = 0;
4698 xfs_bmap_worst_indlen(ip, alen); 4713
4699 ASSERT(indlen > 0); 4714 /* Figure out the extent size, adjust alen */
4715 if (rt) {
4716 if (!(extsz = ip->i_d.di_extsize))
4717 extsz = mp->m_sb.sb_rextsize;
4718 alen = roundup(alen, extsz);
4719 extsz = alen / mp->m_sb.sb_rextsize;
4720 }
4721
4700 /* 4722 /*
4701 * Make a transaction-less quota reservation for 4723 * Make a transaction-less quota reservation for
4702 * delayed allocation blocks. This number gets 4724 * delayed allocation blocks. This number gets
@@ -4704,8 +4726,10 @@ xfs_bmapi(
4704 * We return EDQUOT if we haven't allocated 4726 * We return EDQUOT if we haven't allocated
4705 * blks already inside this loop; 4727 * blks already inside this loop;
4706 */ 4728 */
4707 if (XFS_TRANS_RESERVE_BLKQUOTA( 4729 if (XFS_TRANS_RESERVE_QUOTA_NBLKS(
4708 mp, NULL, ip, (long)alen)) { 4730 mp, NULL, ip, (long)alen, 0,
4731 rt ? XFS_QMOPT_RES_RTBLKS :
4732 XFS_QMOPT_RES_REGBLKS)) {
4709 if (n == 0) { 4733 if (n == 0) {
4710 *nmap = 0; 4734 *nmap = 0;
4711 ASSERT(cur == NULL); 4735 ASSERT(cur == NULL);
@@ -4718,40 +4742,34 @@ xfs_bmapi(
4718 * Split changing sb for alen and indlen since 4742 * Split changing sb for alen and indlen since
4719 * they could be coming from different places. 4743 * they could be coming from different places.
4720 */ 4744 */
4721 if (ip->i_d.di_flags & XFS_DIFLAG_REALTIME) { 4745 indlen = (xfs_extlen_t)
4722 xfs_extlen_t extsz; 4746 xfs_bmap_worst_indlen(ip, alen);
4723 xfs_extlen_t ralen; 4747 ASSERT(indlen > 0);
4724 if (!(extsz = ip->i_d.di_extsize))
4725 extsz = mp->m_sb.sb_rextsize;
4726 ralen = roundup(alen, extsz);
4727 ralen = ralen / mp->m_sb.sb_rextsize;
4728 if (xfs_mod_incore_sb(mp,
4729 XFS_SBS_FREXTENTS,
4730 -(ralen), rsvd)) {
4731 if (XFS_IS_QUOTA_ON(ip->i_mount))
4732 XFS_TRANS_UNRESERVE_BLKQUOTA(
4733 mp, NULL, ip,
4734 (long)alen);
4735 break;
4736 }
4737 } else {
4738 if (xfs_mod_incore_sb(mp,
4739 XFS_SBS_FDBLOCKS,
4740 -(alen), rsvd)) {
4741 if (XFS_IS_QUOTA_ON(ip->i_mount))
4742 XFS_TRANS_UNRESERVE_BLKQUOTA(
4743 mp, NULL, ip,
4744 (long)alen);
4745 break;
4746 }
4747 }
4748 4748
4749 if (xfs_mod_incore_sb(mp, XFS_SBS_FDBLOCKS, 4749 if (rt)
4750 -(indlen), rsvd)) { 4750 error = xfs_mod_incore_sb(mp,
4751 XFS_TRANS_UNRESERVE_BLKQUOTA( 4751 XFS_SBS_FREXTENTS,
4752 mp, NULL, ip, (long)alen); 4752 -(extsz), rsvd);
4753 else
4754 error = xfs_mod_incore_sb(mp,
4755 XFS_SBS_FDBLOCKS,
4756 -(alen), rsvd);
4757 if (!error)
4758 error = xfs_mod_incore_sb(mp,
4759 XFS_SBS_FDBLOCKS,
4760 -(indlen), rsvd);
4761
4762 if (error) {
4763 if (XFS_IS_QUOTA_ON(ip->i_mount))
4764 /* unreserve the blocks now */
4765 XFS_TRANS_UNRESERVE_QUOTA_NBLKS(
4766 mp, NULL, ip,
4767 (long)alen, 0, rt ?
4768 XFS_QMOPT_RES_RTBLKS :
4769 XFS_QMOPT_RES_REGBLKS);
4753 break; 4770 break;
4754 } 4771 }
4772
4755 ip->i_delayed_blks += alen; 4773 ip->i_delayed_blks += alen;
4756 abno = NULLSTARTBLOCK(indlen); 4774 abno = NULLSTARTBLOCK(indlen);
4757 } else { 4775 } else {
@@ -5376,13 +5394,24 @@ xfs_bunmapi(
5376 } 5394 }
5377 if (wasdel) { 5395 if (wasdel) {
5378 ASSERT(STARTBLOCKVAL(del.br_startblock) > 0); 5396 ASSERT(STARTBLOCKVAL(del.br_startblock) > 0);
5379 xfs_mod_incore_sb(mp, XFS_SBS_FDBLOCKS, 5397 /* Update realtim/data freespace, unreserve quota */
5380 (int)del.br_blockcount, rsvd); 5398 if (isrt) {
5381 /* Unreserve our quota space */ 5399 xfs_filblks_t rtexts;
5382 XFS_TRANS_RESERVE_QUOTA_NBLKS( 5400
5383 mp, NULL, ip, -((long)del.br_blockcount), 0, 5401 rtexts = XFS_FSB_TO_B(mp, del.br_blockcount);
5384 isrt ? XFS_QMOPT_RES_RTBLKS : 5402 do_div(rtexts, mp->m_sb.sb_rextsize);
5403 xfs_mod_incore_sb(mp, XFS_SBS_FREXTENTS,
5404 (int)rtexts, rsvd);
5405 XFS_TRANS_RESERVE_QUOTA_NBLKS(mp, NULL, ip,
5406 -((long)del.br_blockcount), 0,
5407 XFS_QMOPT_RES_RTBLKS);
5408 } else {
5409 xfs_mod_incore_sb(mp, XFS_SBS_FDBLOCKS,
5410 (int)del.br_blockcount, rsvd);
5411 XFS_TRANS_RESERVE_QUOTA_NBLKS(mp, NULL, ip,
5412 -((long)del.br_blockcount), 0,
5385 XFS_QMOPT_RES_REGBLKS); 5413 XFS_QMOPT_RES_REGBLKS);
5414 }
5386 ip->i_delayed_blks -= del.br_blockcount; 5415 ip->i_delayed_blks -= del.br_blockcount;
5387 if (cur) 5416 if (cur)
5388 cur->bc_private.b.flags |= 5417 cur->bc_private.b.flags |=
@@ -5714,7 +5743,7 @@ unlock_and_return:
5714 * blocks at the end of the file which do not start at the previous data block, 5743 * blocks at the end of the file which do not start at the previous data block,
5715 * we will try to align the new blocks at stripe unit boundaries. 5744 * we will try to align the new blocks at stripe unit boundaries.
5716 */ 5745 */
5717int /* error */ 5746STATIC int /* error */
5718xfs_bmap_isaeof( 5747xfs_bmap_isaeof(
5719 xfs_inode_t *ip, /* incore inode pointer */ 5748 xfs_inode_t *ip, /* incore inode pointer */
5720 xfs_fileoff_t off, /* file offset in fsblocks */ 5749 xfs_fileoff_t off, /* file offset in fsblocks */
diff --git a/fs/xfs/xfs_bmap.h b/fs/xfs/xfs_bmap.h
index f1bc22fb26ae..e6d22ec9b2e4 100644
--- a/fs/xfs/xfs_bmap.h
+++ b/fs/xfs/xfs_bmap.h
@@ -332,19 +332,6 @@ xfs_getbmap(
332 int iflags); /* interface flags */ 332 int iflags); /* interface flags */
333 333
334/* 334/*
335 * Check the last inode extent to determine whether this allocation will result
336 * in blocks being allocated at the end of the file. When we allocate new data
337 * blocks at the end of the file which do not start at the previous data block,
338 * we will try to align the new blocks at stripe unit boundaries.
339 */
340int
341xfs_bmap_isaeof(
342 struct xfs_inode *ip,
343 xfs_fileoff_t off,
344 int whichfork,
345 char *aeof);
346
347/*
348 * Check if the endoff is outside the last extent. If so the caller will grow 335 * Check if the endoff is outside the last extent. If so the caller will grow
349 * the allocation to a stripe unit boundary 336 * the allocation to a stripe unit boundary
350 */ 337 */
diff --git a/fs/xfs/xfs_bmap_btree.c b/fs/xfs/xfs_bmap_btree.c
index 163305a79fcc..09c413576ba8 100644
--- a/fs/xfs/xfs_bmap_btree.c
+++ b/fs/xfs/xfs_bmap_btree.c
@@ -2331,20 +2331,6 @@ xfs_bmbt_lookup_ge(
2331 return xfs_bmbt_lookup(cur, XFS_LOOKUP_GE, stat); 2331 return xfs_bmbt_lookup(cur, XFS_LOOKUP_GE, stat);
2332} 2332}
2333 2333
2334int /* error */
2335xfs_bmbt_lookup_le(
2336 xfs_btree_cur_t *cur,
2337 xfs_fileoff_t off,
2338 xfs_fsblock_t bno,
2339 xfs_filblks_t len,
2340 int *stat) /* success/failure */
2341{
2342 cur->bc_rec.b.br_startoff = off;
2343 cur->bc_rec.b.br_startblock = bno;
2344 cur->bc_rec.b.br_blockcount = len;
2345 return xfs_bmbt_lookup(cur, XFS_LOOKUP_LE, stat);
2346}
2347
2348/* 2334/*
2349 * Give the bmap btree a new root block. Copy the old broot contents 2335 * Give the bmap btree a new root block. Copy the old broot contents
2350 * down into a real block and make the broot point to it. 2336 * down into a real block and make the broot point to it.
diff --git a/fs/xfs/xfs_bmap_btree.h b/fs/xfs/xfs_bmap_btree.h
index 843ff12b4bf2..0a40cf126c28 100644
--- a/fs/xfs/xfs_bmap_btree.h
+++ b/fs/xfs/xfs_bmap_btree.h
@@ -580,14 +580,6 @@ xfs_bmbt_lookup_ge(
580 xfs_filblks_t, 580 xfs_filblks_t,
581 int *); 581 int *);
582 582
583int
584xfs_bmbt_lookup_le(
585 struct xfs_btree_cur *,
586 xfs_fileoff_t,
587 xfs_fsblock_t,
588 xfs_filblks_t,
589 int *);
590
591/* 583/*
592 * Give the bmap btree a new root block. Copy the old broot contents 584 * Give the bmap btree a new root block. Copy the old broot contents
593 * down into a real block and make the broot point to it. 585 * down into a real block and make the broot point to it.
diff --git a/fs/xfs/xfs_btree.c b/fs/xfs/xfs_btree.c
index 9dd22dd95487..0cc63d657a14 100644
--- a/fs/xfs/xfs_btree.c
+++ b/fs/xfs/xfs_btree.c
@@ -90,6 +90,16 @@ xfs_btree_maxrecs(
90 */ 90 */
91 91
92/* 92/*
93 * Retrieve the block pointer from the cursor at the given level.
94 * This may be a bmap btree root or from a buffer.
95 */
96STATIC xfs_btree_block_t * /* generic btree block pointer */
97xfs_btree_get_block(
98 xfs_btree_cur_t *cur, /* btree cursor */
99 int level, /* level in btree */
100 struct xfs_buf **bpp); /* buffer containing the block */
101
102/*
93 * Checking routine: return maxrecs for the block. 103 * Checking routine: return maxrecs for the block.
94 */ 104 */
95STATIC int /* number of records fitting in block */ 105STATIC int /* number of records fitting in block */
@@ -497,7 +507,7 @@ xfs_btree_firstrec(
497 * Retrieve the block pointer from the cursor at the given level. 507 * Retrieve the block pointer from the cursor at the given level.
498 * This may be a bmap btree root or from a buffer. 508 * This may be a bmap btree root or from a buffer.
499 */ 509 */
500xfs_btree_block_t * /* generic btree block pointer */ 510STATIC xfs_btree_block_t * /* generic btree block pointer */
501xfs_btree_get_block( 511xfs_btree_get_block(
502 xfs_btree_cur_t *cur, /* btree cursor */ 512 xfs_btree_cur_t *cur, /* btree cursor */
503 int level, /* level in btree */ 513 int level, /* level in btree */
diff --git a/fs/xfs/xfs_btree.h b/fs/xfs/xfs_btree.h
index 93872bba41f5..09b4e1532a35 100644
--- a/fs/xfs/xfs_btree.h
+++ b/fs/xfs/xfs_btree.h
@@ -325,16 +325,6 @@ xfs_btree_firstrec(
325 int level); /* level to change */ 325 int level); /* level to change */
326 326
327/* 327/*
328 * Retrieve the block pointer from the cursor at the given level.
329 * This may be a bmap btree root or from a buffer.
330 */
331xfs_btree_block_t * /* generic btree block pointer */
332xfs_btree_get_block(
333 xfs_btree_cur_t *cur, /* btree cursor */
334 int level, /* level in btree */
335 struct xfs_buf **bpp); /* buffer containing the block */
336
337/*
338 * Get a buffer for the block, return it with no data read. 328 * Get a buffer for the block, return it with no data read.
339 * Long-form addressing. 329 * Long-form addressing.
340 */ 330 */
diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c
index 9ab0039f07df..30b8285ad476 100644
--- a/fs/xfs/xfs_buf_item.c
+++ b/fs/xfs/xfs_buf_item.c
@@ -172,7 +172,7 @@ STATIC void xfs_buf_do_callbacks(xfs_buf_t *bp, xfs_log_item_t *lip);
172 * 172 *
173 * If the XFS_BLI_STALE flag has been set, then log nothing. 173 * If the XFS_BLI_STALE flag has been set, then log nothing.
174 */ 174 */
175uint 175STATIC uint
176xfs_buf_item_size( 176xfs_buf_item_size(
177 xfs_buf_log_item_t *bip) 177 xfs_buf_log_item_t *bip)
178{ 178{
@@ -240,7 +240,7 @@ xfs_buf_item_size(
240 * format structure, and the rest point to contiguous chunks 240 * format structure, and the rest point to contiguous chunks
241 * within the buffer. 241 * within the buffer.
242 */ 242 */
243void 243STATIC void
244xfs_buf_item_format( 244xfs_buf_item_format(
245 xfs_buf_log_item_t *bip, 245 xfs_buf_log_item_t *bip,
246 xfs_log_iovec_t *log_vector) 246 xfs_log_iovec_t *log_vector)
@@ -365,7 +365,7 @@ xfs_buf_item_format(
365 * item in memory so it cannot be written out. Simply call bpin() 365 * item in memory so it cannot be written out. Simply call bpin()
366 * on the buffer to do this. 366 * on the buffer to do this.
367 */ 367 */
368void 368STATIC void
369xfs_buf_item_pin( 369xfs_buf_item_pin(
370 xfs_buf_log_item_t *bip) 370 xfs_buf_log_item_t *bip)
371{ 371{
@@ -391,7 +391,7 @@ xfs_buf_item_pin(
391 * If the XFS_BLI_STALE flag is set and we are the last reference, 391 * If the XFS_BLI_STALE flag is set and we are the last reference,
392 * then free up the buf log item and unlock the buffer. 392 * then free up the buf log item and unlock the buffer.
393 */ 393 */
394void 394STATIC void
395xfs_buf_item_unpin( 395xfs_buf_item_unpin(
396 xfs_buf_log_item_t *bip, 396 xfs_buf_log_item_t *bip,
397 int stale) 397 int stale)
@@ -446,7 +446,7 @@ xfs_buf_item_unpin(
446 * so we need to free the item's descriptor (that points to the item) 446 * so we need to free the item's descriptor (that points to the item)
447 * in the transaction. 447 * in the transaction.
448 */ 448 */
449void 449STATIC void
450xfs_buf_item_unpin_remove( 450xfs_buf_item_unpin_remove(
451 xfs_buf_log_item_t *bip, 451 xfs_buf_log_item_t *bip,
452 xfs_trans_t *tp) 452 xfs_trans_t *tp)
@@ -493,7 +493,7 @@ xfs_buf_item_unpin_remove(
493 * the lock right away, return 0. If we can get the lock, pull the 493 * the lock right away, return 0. If we can get the lock, pull the
494 * buffer from the free list, mark it busy, and return 1. 494 * buffer from the free list, mark it busy, and return 1.
495 */ 495 */
496uint 496STATIC uint
497xfs_buf_item_trylock( 497xfs_buf_item_trylock(
498 xfs_buf_log_item_t *bip) 498 xfs_buf_log_item_t *bip)
499{ 499{
@@ -537,7 +537,7 @@ xfs_buf_item_trylock(
537 * This is for support of xfs_trans_bhold(). Make sure the 537 * This is for support of xfs_trans_bhold(). Make sure the
538 * XFS_BLI_HOLD field is cleared if we don't free the item. 538 * XFS_BLI_HOLD field is cleared if we don't free the item.
539 */ 539 */
540void 540STATIC void
541xfs_buf_item_unlock( 541xfs_buf_item_unlock(
542 xfs_buf_log_item_t *bip) 542 xfs_buf_log_item_t *bip)
543{ 543{
@@ -635,7 +635,7 @@ xfs_buf_item_unlock(
635 * by returning the original lsn of that transaction here rather than 635 * by returning the original lsn of that transaction here rather than
636 * the current one. 636 * the current one.
637 */ 637 */
638xfs_lsn_t 638STATIC xfs_lsn_t
639xfs_buf_item_committed( 639xfs_buf_item_committed(
640 xfs_buf_log_item_t *bip, 640 xfs_buf_log_item_t *bip,
641 xfs_lsn_t lsn) 641 xfs_lsn_t lsn)
@@ -654,7 +654,7 @@ xfs_buf_item_committed(
654 * and have aborted this transaction, we'll trap this buffer when it tries to 654 * and have aborted this transaction, we'll trap this buffer when it tries to
655 * get written out. 655 * get written out.
656 */ 656 */
657void 657STATIC void
658xfs_buf_item_abort( 658xfs_buf_item_abort(
659 xfs_buf_log_item_t *bip) 659 xfs_buf_log_item_t *bip)
660{ 660{
@@ -674,7 +674,7 @@ xfs_buf_item_abort(
674 * B_DELWRI set, then get it going out to disk with a call to bawrite(). 674 * B_DELWRI set, then get it going out to disk with a call to bawrite().
675 * If not, then just release the buffer. 675 * If not, then just release the buffer.
676 */ 676 */
677void 677STATIC void
678xfs_buf_item_push( 678xfs_buf_item_push(
679 xfs_buf_log_item_t *bip) 679 xfs_buf_log_item_t *bip)
680{ 680{
@@ -693,7 +693,7 @@ xfs_buf_item_push(
693} 693}
694 694
695/* ARGSUSED */ 695/* ARGSUSED */
696void 696STATIC void
697xfs_buf_item_committing(xfs_buf_log_item_t *bip, xfs_lsn_t commit_lsn) 697xfs_buf_item_committing(xfs_buf_log_item_t *bip, xfs_lsn_t commit_lsn)
698{ 698{
699} 699}
@@ -701,7 +701,7 @@ xfs_buf_item_committing(xfs_buf_log_item_t *bip, xfs_lsn_t commit_lsn)
701/* 701/*
702 * This is the ops vector shared by all buf log items. 702 * This is the ops vector shared by all buf log items.
703 */ 703 */
704struct xfs_item_ops xfs_buf_item_ops = { 704STATIC struct xfs_item_ops xfs_buf_item_ops = {
705 .iop_size = (uint(*)(xfs_log_item_t*))xfs_buf_item_size, 705 .iop_size = (uint(*)(xfs_log_item_t*))xfs_buf_item_size,
706 .iop_format = (void(*)(xfs_log_item_t*, xfs_log_iovec_t*)) 706 .iop_format = (void(*)(xfs_log_item_t*, xfs_log_iovec_t*))
707 xfs_buf_item_format, 707 xfs_buf_item_format,
diff --git a/fs/xfs/xfs_buf_item.h b/fs/xfs/xfs_buf_item.h
index 5f1b0c9308f6..01aed5f2d579 100644
--- a/fs/xfs/xfs_buf_item.h
+++ b/fs/xfs/xfs_buf_item.h
@@ -80,7 +80,7 @@ typedef struct xfs_buf_log_format_t {
80 * user or group dquots and may require special recovery handling. 80 * user or group dquots and may require special recovery handling.
81 */ 81 */
82#define XFS_BLI_UDQUOT_BUF 0x4 82#define XFS_BLI_UDQUOT_BUF 0x4
83/* #define XFS_BLI_PDQUOT_BUF 0x8 */ 83#define XFS_BLI_PDQUOT_BUF 0x8
84#define XFS_BLI_GDQUOT_BUF 0x10 84#define XFS_BLI_GDQUOT_BUF 0x10
85 85
86#define XFS_BLI_CHUNK 128 86#define XFS_BLI_CHUNK 128
diff --git a/fs/xfs/xfs_da_btree.c b/fs/xfs/xfs_da_btree.c
index d7fe28866764..8b792ddf2164 100644
--- a/fs/xfs/xfs_da_btree.c
+++ b/fs/xfs/xfs_da_btree.c
@@ -113,7 +113,10 @@ STATIC void xfs_da_node_unbalance(xfs_da_state_t *state,
113STATIC uint xfs_da_node_lasthash(xfs_dabuf_t *bp, int *count); 113STATIC uint xfs_da_node_lasthash(xfs_dabuf_t *bp, int *count);
114STATIC int xfs_da_node_order(xfs_dabuf_t *node1_bp, xfs_dabuf_t *node2_bp); 114STATIC int xfs_da_node_order(xfs_dabuf_t *node1_bp, xfs_dabuf_t *node2_bp);
115STATIC xfs_dabuf_t *xfs_da_buf_make(int nbuf, xfs_buf_t **bps, inst_t *ra); 115STATIC xfs_dabuf_t *xfs_da_buf_make(int nbuf, xfs_buf_t **bps, inst_t *ra);
116 116STATIC int xfs_da_blk_unlink(xfs_da_state_t *state,
117 xfs_da_state_blk_t *drop_blk,
118 xfs_da_state_blk_t *save_blk);
119STATIC void xfs_da_state_kill_altpath(xfs_da_state_t *state);
117 120
118/*======================================================================== 121/*========================================================================
119 * Routines used for growing the Btree. 122 * Routines used for growing the Btree.
@@ -1424,7 +1427,7 @@ xfs_da_node_lasthash(xfs_dabuf_t *bp, int *count)
1424/* 1427/*
1425 * Unlink a block from a doubly linked list of blocks. 1428 * Unlink a block from a doubly linked list of blocks.
1426 */ 1429 */
1427int /* error */ 1430STATIC int /* error */
1428xfs_da_blk_unlink(xfs_da_state_t *state, xfs_da_state_blk_t *drop_blk, 1431xfs_da_blk_unlink(xfs_da_state_t *state, xfs_da_state_blk_t *drop_blk,
1429 xfs_da_state_blk_t *save_blk) 1432 xfs_da_state_blk_t *save_blk)
1430{ 1433{
@@ -2381,7 +2384,7 @@ xfs_da_state_alloc(void)
2381/* 2384/*
2382 * Kill the altpath contents of a da-state structure. 2385 * Kill the altpath contents of a da-state structure.
2383 */ 2386 */
2384void 2387STATIC void
2385xfs_da_state_kill_altpath(xfs_da_state_t *state) 2388xfs_da_state_kill_altpath(xfs_da_state_t *state)
2386{ 2389{
2387 int i; 2390 int i;
diff --git a/fs/xfs/xfs_da_btree.h b/fs/xfs/xfs_da_btree.h
index 9fc699d96995..3a9b9e809c60 100644
--- a/fs/xfs/xfs_da_btree.h
+++ b/fs/xfs/xfs_da_btree.h
@@ -296,8 +296,6 @@ int xfs_da_path_shift(xfs_da_state_t *state, xfs_da_state_path_t *path,
296/* 296/*
297 * Utility routines. 297 * Utility routines.
298 */ 298 */
299int xfs_da_blk_unlink(xfs_da_state_t *state, xfs_da_state_blk_t *drop_blk,
300 xfs_da_state_blk_t *save_blk);
301int xfs_da_blk_link(xfs_da_state_t *state, xfs_da_state_blk_t *old_blk, 299int xfs_da_blk_link(xfs_da_state_t *state, xfs_da_state_blk_t *old_blk,
302 xfs_da_state_blk_t *new_blk); 300 xfs_da_state_blk_t *new_blk);
303 301
@@ -320,7 +318,6 @@ uint xfs_da_hashname(uchar_t *name_string, int name_length);
320uint xfs_da_log2_roundup(uint i); 318uint xfs_da_log2_roundup(uint i);
321xfs_da_state_t *xfs_da_state_alloc(void); 319xfs_da_state_t *xfs_da_state_alloc(void);
322void xfs_da_state_free(xfs_da_state_t *state); 320void xfs_da_state_free(xfs_da_state_t *state);
323void xfs_da_state_kill_altpath(xfs_da_state_t *state);
324 321
325void xfs_da_buf_done(xfs_dabuf_t *dabuf); 322void xfs_da_buf_done(xfs_dabuf_t *dabuf);
326void xfs_da_log_buf(struct xfs_trans *tp, xfs_dabuf_t *dabuf, uint first, 323void xfs_da_log_buf(struct xfs_trans *tp, xfs_dabuf_t *dabuf, uint first,
diff --git a/fs/xfs/xfs_dfrag.c b/fs/xfs/xfs_dfrag.c
index 63abdc2ac7f4..681be5c93af5 100644
--- a/fs/xfs/xfs_dfrag.c
+++ b/fs/xfs/xfs_dfrag.c
@@ -180,9 +180,10 @@ xfs_swapext(
180 goto error0; 180 goto error0;
181 } 181 }
182 182
183 if (VN_CACHED(tvp) != 0) 183 if (VN_CACHED(tvp) != 0) {
184 xfs_inval_cached_pages(XFS_ITOV(tip), &(tip->i_iocore), 184 xfs_inval_cached_trace(&tip->i_iocore, 0, -1, 0, -1);
185 (xfs_off_t)0, 0, 0); 185 VOP_FLUSHINVAL_PAGES(tvp, 0, -1, FI_REMAPF_LOCKED);
186 }
186 187
187 /* Verify O_DIRECT for ftmp */ 188 /* Verify O_DIRECT for ftmp */
188 if (VN_CACHED(tvp) != 0) { 189 if (VN_CACHED(tvp) != 0) {
diff --git a/fs/xfs/xfs_dir2_data.c b/fs/xfs/xfs_dir2_data.c
index db9887a107de..a0aa0e44ff9d 100644
--- a/fs/xfs/xfs_dir2_data.c
+++ b/fs/xfs/xfs_dir2_data.c
@@ -304,7 +304,7 @@ xfs_dir2_data_freeinsert(
304/* 304/*
305 * Remove a bestfree entry from the table. 305 * Remove a bestfree entry from the table.
306 */ 306 */
307void 307STATIC void
308xfs_dir2_data_freeremove( 308xfs_dir2_data_freeremove(
309 xfs_dir2_data_t *d, /* data block pointer */ 309 xfs_dir2_data_t *d, /* data block pointer */
310 xfs_dir2_data_free_t *dfp, /* bestfree entry pointer */ 310 xfs_dir2_data_free_t *dfp, /* bestfree entry pointer */
diff --git a/fs/xfs/xfs_dir2_data.h b/fs/xfs/xfs_dir2_data.h
index 3f02294ccff0..476cac920bf5 100644
--- a/fs/xfs/xfs_dir2_data.h
+++ b/fs/xfs/xfs_dir2_data.h
@@ -193,10 +193,6 @@ extern xfs_dir2_data_free_t *
193 xfs_dir2_data_unused_t *dup, int *loghead); 193 xfs_dir2_data_unused_t *dup, int *loghead);
194 194
195extern void 195extern void
196 xfs_dir2_data_freeremove(xfs_dir2_data_t *d,
197 xfs_dir2_data_free_t *dfp, int *loghead);
198
199extern void
200 xfs_dir2_data_freescan(struct xfs_mount *mp, xfs_dir2_data_t *d, 196 xfs_dir2_data_freescan(struct xfs_mount *mp, xfs_dir2_data_t *d,
201 int *loghead, char *aendp); 197 int *loghead, char *aendp);
202 198
diff --git a/fs/xfs/xfs_dir2_leaf.c b/fs/xfs/xfs_dir2_leaf.c
index 262d1e86df30..056f5283904b 100644
--- a/fs/xfs/xfs_dir2_leaf.c
+++ b/fs/xfs/xfs_dir2_leaf.c
@@ -77,6 +77,10 @@ static void xfs_dir2_leaf_check(xfs_inode_t *dp, xfs_dabuf_t *bp);
77#endif 77#endif
78static int xfs_dir2_leaf_lookup_int(xfs_da_args_t *args, xfs_dabuf_t **lbpp, 78static int xfs_dir2_leaf_lookup_int(xfs_da_args_t *args, xfs_dabuf_t **lbpp,
79 int *indexp, xfs_dabuf_t **dbpp); 79 int *indexp, xfs_dabuf_t **dbpp);
80static void xfs_dir2_leaf_log_bests(struct xfs_trans *tp, struct xfs_dabuf *bp,
81 int first, int last);
82static void xfs_dir2_leaf_log_tail(struct xfs_trans *tp, struct xfs_dabuf *bp);
83
80 84
81/* 85/*
82 * Convert a block form directory to a leaf form directory. 86 * Convert a block form directory to a leaf form directory.
@@ -1214,7 +1218,7 @@ xfs_dir2_leaf_init(
1214/* 1218/*
1215 * Log the bests entries indicated from a leaf1 block. 1219 * Log the bests entries indicated from a leaf1 block.
1216 */ 1220 */
1217void 1221static void
1218xfs_dir2_leaf_log_bests( 1222xfs_dir2_leaf_log_bests(
1219 xfs_trans_t *tp, /* transaction pointer */ 1223 xfs_trans_t *tp, /* transaction pointer */
1220 xfs_dabuf_t *bp, /* leaf buffer */ 1224 xfs_dabuf_t *bp, /* leaf buffer */
@@ -1278,7 +1282,7 @@ xfs_dir2_leaf_log_header(
1278/* 1282/*
1279 * Log the tail of the leaf1 block. 1283 * Log the tail of the leaf1 block.
1280 */ 1284 */
1281void 1285STATIC void
1282xfs_dir2_leaf_log_tail( 1286xfs_dir2_leaf_log_tail(
1283 xfs_trans_t *tp, /* transaction pointer */ 1287 xfs_trans_t *tp, /* transaction pointer */
1284 xfs_dabuf_t *bp) /* leaf buffer */ 1288 xfs_dabuf_t *bp) /* leaf buffer */
diff --git a/fs/xfs/xfs_dir2_leaf.h b/fs/xfs/xfs_dir2_leaf.h
index 7f20eee56a52..3303cd6f4c00 100644
--- a/fs/xfs/xfs_dir2_leaf.h
+++ b/fs/xfs/xfs_dir2_leaf.h
@@ -330,15 +330,8 @@ extern void
330 int first, int last); 330 int first, int last);
331 331
332extern void 332extern void
333 xfs_dir2_leaf_log_bests(struct xfs_trans *tp, struct xfs_dabuf *bp,
334 int first, int last);
335
336extern void
337 xfs_dir2_leaf_log_header(struct xfs_trans *tp, struct xfs_dabuf *bp); 333 xfs_dir2_leaf_log_header(struct xfs_trans *tp, struct xfs_dabuf *bp);
338 334
339extern void
340 xfs_dir2_leaf_log_tail(struct xfs_trans *tp, struct xfs_dabuf *bp);
341
342extern int 335extern int
343 xfs_dir2_leaf_lookup(struct xfs_da_args *args); 336 xfs_dir2_leaf_lookup(struct xfs_da_args *args);
344 337
diff --git a/fs/xfs/xfs_dir_leaf.c b/fs/xfs/xfs_dir_leaf.c
index 617018d6bbdc..c2ea6171fb0e 100644
--- a/fs/xfs/xfs_dir_leaf.c
+++ b/fs/xfs/xfs_dir_leaf.c
@@ -91,6 +91,10 @@ STATIC int xfs_dir_leaf_figure_balance(xfs_da_state_t *state,
91 int *number_entries_in_blk1, 91 int *number_entries_in_blk1,
92 int *number_namebytes_in_blk1); 92 int *number_namebytes_in_blk1);
93 93
94STATIC int xfs_dir_leaf_create(struct xfs_da_args *args,
95 xfs_dablk_t which_block,
96 struct xfs_dabuf **bpp);
97
94/* 98/*
95 * Utility routines. 99 * Utility routines.
96 */ 100 */
@@ -781,7 +785,7 @@ xfs_dir_leaf_to_node(xfs_da_args_t *args)
781 * Create the initial contents of a leaf directory 785 * Create the initial contents of a leaf directory
782 * or a leaf in a node directory. 786 * or a leaf in a node directory.
783 */ 787 */
784int 788STATIC int
785xfs_dir_leaf_create(xfs_da_args_t *args, xfs_dablk_t blkno, xfs_dabuf_t **bpp) 789xfs_dir_leaf_create(xfs_da_args_t *args, xfs_dablk_t blkno, xfs_dabuf_t **bpp)
786{ 790{
787 xfs_dir_leafblock_t *leaf; 791 xfs_dir_leafblock_t *leaf;
diff --git a/fs/xfs/xfs_dir_leaf.h b/fs/xfs/xfs_dir_leaf.h
index 00d68d33cc7a..dd423ce1bc8d 100644
--- a/fs/xfs/xfs_dir_leaf.h
+++ b/fs/xfs/xfs_dir_leaf.h
@@ -202,8 +202,6 @@ int xfs_dir_leaf_to_shortform(struct xfs_da_args *args);
202/* 202/*
203 * Routines used for growing the Btree. 203 * Routines used for growing the Btree.
204 */ 204 */
205int xfs_dir_leaf_create(struct xfs_da_args *args, xfs_dablk_t which_block,
206 struct xfs_dabuf **bpp);
207int xfs_dir_leaf_split(struct xfs_da_state *state, 205int xfs_dir_leaf_split(struct xfs_da_state *state,
208 struct xfs_da_state_blk *oldblk, 206 struct xfs_da_state_blk *oldblk,
209 struct xfs_da_state_blk *newblk); 207 struct xfs_da_state_blk *newblk);
diff --git a/fs/xfs/xfs_dmapi.h b/fs/xfs/xfs_dmapi.h
index 55ae3e67d245..55c17adaaa37 100644
--- a/fs/xfs/xfs_dmapi.h
+++ b/fs/xfs/xfs_dmapi.h
@@ -166,27 +166,32 @@ typedef enum {
166#define DM_FLAGS_NDELAY 0x001 /* return EAGAIN after dm_pending() */ 166#define DM_FLAGS_NDELAY 0x001 /* return EAGAIN after dm_pending() */
167#define DM_FLAGS_UNWANTED 0x002 /* event not in fsys dm_eventset_t */ 167#define DM_FLAGS_UNWANTED 0x002 /* event not in fsys dm_eventset_t */
168#define DM_FLAGS_ISEM 0x004 /* thread holds i_sem */ 168#define DM_FLAGS_ISEM 0x004 /* thread holds i_sem */
169#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
170#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,21)
171/* i_alloc_sem was added in 2.4.22-pre1 */
172#define DM_FLAGS_IALLOCSEM_RD 0x010 /* thread holds i_alloc_sem rd */ 169#define DM_FLAGS_IALLOCSEM_RD 0x010 /* thread holds i_alloc_sem rd */
173#define DM_FLAGS_IALLOCSEM_WR 0x020 /* thread holds i_alloc_sem wr */ 170#define DM_FLAGS_IALLOCSEM_WR 0x020 /* thread holds i_alloc_sem wr */
174#endif
175#endif
176 171
177/* 172/*
178 * Based on IO_ISDIRECT, decide which i_ flag is set. 173 * Based on IO_ISDIRECT, decide which i_ flag is set.
179 */ 174 */
180#ifdef DM_FLAGS_IALLOCSEM_RD 175#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
176#define DM_SEM_FLAG_RD(ioflags) (((ioflags) & IO_ISDIRECT) ? \
177 DM_FLAGS_ISEM : 0)
178#define DM_SEM_FLAG_WR (DM_FLAGS_IALLOCSEM_WR | DM_FLAGS_ISEM)
179#endif
180
181#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)) && \
182 (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,22))
181#define DM_SEM_FLAG_RD(ioflags) (((ioflags) & IO_ISDIRECT) ? \ 183#define DM_SEM_FLAG_RD(ioflags) (((ioflags) & IO_ISDIRECT) ? \
182 DM_FLAGS_IALLOCSEM_RD : DM_FLAGS_ISEM) 184 DM_FLAGS_IALLOCSEM_RD : DM_FLAGS_ISEM)
183#define DM_SEM_FLAG_WR (DM_FLAGS_IALLOCSEM_WR | DM_FLAGS_ISEM) 185#define DM_SEM_FLAG_WR (DM_FLAGS_IALLOCSEM_WR | DM_FLAGS_ISEM)
184#else 186#endif
187
188#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,4,21)
185#define DM_SEM_FLAG_RD(ioflags) (((ioflags) & IO_ISDIRECT) ? \ 189#define DM_SEM_FLAG_RD(ioflags) (((ioflags) & IO_ISDIRECT) ? \
186 0 : DM_FLAGS_ISEM) 190 0 : DM_FLAGS_ISEM)
187#define DM_SEM_FLAG_WR (DM_FLAGS_ISEM) 191#define DM_SEM_FLAG_WR (DM_FLAGS_ISEM)
188#endif 192#endif
189 193
194
190/* 195/*
191 * Macros to turn caller specified delay/block flags into 196 * Macros to turn caller specified delay/block flags into
192 * dm_send_xxxx_event flag DM_FLAGS_NDELAY. 197 * dm_send_xxxx_event flag DM_FLAGS_NDELAY.
diff --git a/fs/xfs/xfs_error.c b/fs/xfs/xfs_error.c
index bbe1dea11c08..dcd3fdd5c1f7 100644
--- a/fs/xfs/xfs_error.c
+++ b/fs/xfs/xfs_error.c
@@ -280,7 +280,7 @@ xfs_error_report(
280 } 280 }
281} 281}
282 282
283void 283STATIC void
284xfs_hex_dump(void *p, int length) 284xfs_hex_dump(void *p, int length)
285{ 285{
286 __uint8_t *uip = (__uint8_t*)p; 286 __uint8_t *uip = (__uint8_t*)p;
diff --git a/fs/xfs/xfs_error.h b/fs/xfs/xfs_error.h
index 6bc0535c0a65..52ee2b90b5ed 100644
--- a/fs/xfs/xfs_error.h
+++ b/fs/xfs/xfs_error.h
@@ -73,9 +73,6 @@ xfs_corruption_error(
73 int linenum, 73 int linenum,
74 inst_t *ra); 74 inst_t *ra);
75 75
76extern void
77xfs_hex_dump(void *p, int length);
78
79#define XFS_ERROR_REPORT(e, lvl, mp) \ 76#define XFS_ERROR_REPORT(e, lvl, mp) \
80 xfs_error_report(e, lvl, mp, __FILE__, __LINE__, __return_address) 77 xfs_error_report(e, lvl, mp, __FILE__, __LINE__, __return_address)
81#define XFS_CORRUPTION_ERROR(e, lvl, mp, mem) \ 78#define XFS_CORRUPTION_ERROR(e, lvl, mp, mem) \
diff --git a/fs/xfs/xfs_extfree_item.c b/fs/xfs/xfs_extfree_item.c
index 5eafd5b63211..db7cbd1bc857 100644
--- a/fs/xfs/xfs_extfree_item.c
+++ b/fs/xfs/xfs_extfree_item.c
@@ -59,6 +59,18 @@ STATIC void xfs_efi_item_abort(xfs_efi_log_item_t *);
59STATIC void xfs_efd_item_abort(xfs_efd_log_item_t *); 59STATIC void xfs_efd_item_abort(xfs_efd_log_item_t *);
60 60
61 61
62void
63xfs_efi_item_free(xfs_efi_log_item_t *efip)
64{
65 int nexts = efip->efi_format.efi_nextents;
66
67 if (nexts > XFS_EFI_MAX_FAST_EXTENTS) {
68 kmem_free(efip, sizeof(xfs_efi_log_item_t) +
69 (nexts - 1) * sizeof(xfs_extent_t));
70 } else {
71 kmem_zone_free(xfs_efi_zone, efip);
72 }
73}
62 74
63/* 75/*
64 * This returns the number of iovecs needed to log the given efi item. 76 * This returns the number of iovecs needed to log the given efi item.
@@ -120,8 +132,6 @@ xfs_efi_item_pin(xfs_efi_log_item_t *efip)
120STATIC void 132STATIC void
121xfs_efi_item_unpin(xfs_efi_log_item_t *efip, int stale) 133xfs_efi_item_unpin(xfs_efi_log_item_t *efip, int stale)
122{ 134{
123 int nexts;
124 int size;
125 xfs_mount_t *mp; 135 xfs_mount_t *mp;
126 SPLDECL(s); 136 SPLDECL(s);
127 137
@@ -132,21 +142,11 @@ xfs_efi_item_unpin(xfs_efi_log_item_t *efip, int stale)
132 * xfs_trans_delete_ail() drops the AIL lock. 142 * xfs_trans_delete_ail() drops the AIL lock.
133 */ 143 */
134 xfs_trans_delete_ail(mp, (xfs_log_item_t *)efip, s); 144 xfs_trans_delete_ail(mp, (xfs_log_item_t *)efip, s);
135 145 xfs_efi_item_free(efip);
136 nexts = efip->efi_format.efi_nextents;
137 if (nexts > XFS_EFI_MAX_FAST_EXTENTS) {
138 size = sizeof(xfs_efi_log_item_t);
139 size += (nexts - 1) * sizeof(xfs_extent_t);
140 kmem_free(efip, size);
141 } else {
142 kmem_zone_free(xfs_efi_zone, efip);
143 }
144 } else { 146 } else {
145 efip->efi_flags |= XFS_EFI_COMMITTED; 147 efip->efi_flags |= XFS_EFI_COMMITTED;
146 AIL_UNLOCK(mp, s); 148 AIL_UNLOCK(mp, s);
147 } 149 }
148
149 return;
150} 150}
151 151
152/* 152/*
@@ -159,8 +159,6 @@ xfs_efi_item_unpin(xfs_efi_log_item_t *efip, int stale)
159STATIC void 159STATIC void
160xfs_efi_item_unpin_remove(xfs_efi_log_item_t *efip, xfs_trans_t *tp) 160xfs_efi_item_unpin_remove(xfs_efi_log_item_t *efip, xfs_trans_t *tp)
161{ 161{
162 int nexts;
163 int size;
164 xfs_mount_t *mp; 162 xfs_mount_t *mp;
165 xfs_log_item_desc_t *lidp; 163 xfs_log_item_desc_t *lidp;
166 SPLDECL(s); 164 SPLDECL(s);
@@ -178,23 +176,11 @@ xfs_efi_item_unpin_remove(xfs_efi_log_item_t *efip, xfs_trans_t *tp)
178 * xfs_trans_delete_ail() drops the AIL lock. 176 * xfs_trans_delete_ail() drops the AIL lock.
179 */ 177 */
180 xfs_trans_delete_ail(mp, (xfs_log_item_t *)efip, s); 178 xfs_trans_delete_ail(mp, (xfs_log_item_t *)efip, s);
181 /* 179 xfs_efi_item_free(efip);
182 * now free the item itself
183 */
184 nexts = efip->efi_format.efi_nextents;
185 if (nexts > XFS_EFI_MAX_FAST_EXTENTS) {
186 size = sizeof(xfs_efi_log_item_t);
187 size += (nexts - 1) * sizeof(xfs_extent_t);
188 kmem_free(efip, size);
189 } else {
190 kmem_zone_free(xfs_efi_zone, efip);
191 }
192 } else { 180 } else {
193 efip->efi_flags |= XFS_EFI_COMMITTED; 181 efip->efi_flags |= XFS_EFI_COMMITTED;
194 AIL_UNLOCK(mp, s); 182 AIL_UNLOCK(mp, s);
195 } 183 }
196
197 return;
198} 184}
199 185
200/* 186/*
@@ -245,18 +231,7 @@ xfs_efi_item_committed(xfs_efi_log_item_t *efip, xfs_lsn_t lsn)
245STATIC void 231STATIC void
246xfs_efi_item_abort(xfs_efi_log_item_t *efip) 232xfs_efi_item_abort(xfs_efi_log_item_t *efip)
247{ 233{
248 int nexts; 234 xfs_efi_item_free(efip);
249 int size;
250
251 nexts = efip->efi_format.efi_nextents;
252 if (nexts > XFS_EFI_MAX_FAST_EXTENTS) {
253 size = sizeof(xfs_efi_log_item_t);
254 size += (nexts - 1) * sizeof(xfs_extent_t);
255 kmem_free(efip, size);
256 } else {
257 kmem_zone_free(xfs_efi_zone, efip);
258 }
259 return;
260} 235}
261 236
262/* 237/*
@@ -288,7 +263,7 @@ xfs_efi_item_committing(xfs_efi_log_item_t *efip, xfs_lsn_t lsn)
288/* 263/*
289 * This is the ops vector shared by all efi log items. 264 * This is the ops vector shared by all efi log items.
290 */ 265 */
291struct xfs_item_ops xfs_efi_item_ops = { 266STATIC struct xfs_item_ops xfs_efi_item_ops = {
292 .iop_size = (uint(*)(xfs_log_item_t*))xfs_efi_item_size, 267 .iop_size = (uint(*)(xfs_log_item_t*))xfs_efi_item_size,
293 .iop_format = (void(*)(xfs_log_item_t*, xfs_log_iovec_t*)) 268 .iop_format = (void(*)(xfs_log_item_t*, xfs_log_iovec_t*))
294 xfs_efi_item_format, 269 xfs_efi_item_format,
@@ -355,8 +330,6 @@ xfs_efi_release(xfs_efi_log_item_t *efip,
355{ 330{
356 xfs_mount_t *mp; 331 xfs_mount_t *mp;
357 int extents_left; 332 int extents_left;
358 uint size;
359 int nexts;
360 SPLDECL(s); 333 SPLDECL(s);
361 334
362 mp = efip->efi_item.li_mountp; 335 mp = efip->efi_item.li_mountp;
@@ -372,20 +345,10 @@ xfs_efi_release(xfs_efi_log_item_t *efip,
372 * xfs_trans_delete_ail() drops the AIL lock. 345 * xfs_trans_delete_ail() drops the AIL lock.
373 */ 346 */
374 xfs_trans_delete_ail(mp, (xfs_log_item_t *)efip, s); 347 xfs_trans_delete_ail(mp, (xfs_log_item_t *)efip, s);
348 xfs_efi_item_free(efip);
375 } else { 349 } else {
376 AIL_UNLOCK(mp, s); 350 AIL_UNLOCK(mp, s);
377 } 351 }
378
379 if (extents_left == 0) {
380 nexts = efip->efi_format.efi_nextents;
381 if (nexts > XFS_EFI_MAX_FAST_EXTENTS) {
382 size = sizeof(xfs_efi_log_item_t);
383 size += (nexts - 1) * sizeof(xfs_extent_t);
384 kmem_free(efip, size);
385 } else {
386 kmem_zone_free(xfs_efi_zone, efip);
387 }
388 }
389} 352}
390 353
391/* 354/*
@@ -398,8 +361,6 @@ STATIC void
398xfs_efi_cancel( 361xfs_efi_cancel(
399 xfs_efi_log_item_t *efip) 362 xfs_efi_log_item_t *efip)
400{ 363{
401 int nexts;
402 int size;
403 xfs_mount_t *mp; 364 xfs_mount_t *mp;
404 SPLDECL(s); 365 SPLDECL(s);
405 366
@@ -410,26 +371,25 @@ xfs_efi_cancel(
410 * xfs_trans_delete_ail() drops the AIL lock. 371 * xfs_trans_delete_ail() drops the AIL lock.
411 */ 372 */
412 xfs_trans_delete_ail(mp, (xfs_log_item_t *)efip, s); 373 xfs_trans_delete_ail(mp, (xfs_log_item_t *)efip, s);
413 374 xfs_efi_item_free(efip);
414 nexts = efip->efi_format.efi_nextents;
415 if (nexts > XFS_EFI_MAX_FAST_EXTENTS) {
416 size = sizeof(xfs_efi_log_item_t);
417 size += (nexts - 1) * sizeof(xfs_extent_t);
418 kmem_free(efip, size);
419 } else {
420 kmem_zone_free(xfs_efi_zone, efip);
421 }
422 } else { 375 } else {
423 efip->efi_flags |= XFS_EFI_CANCELED; 376 efip->efi_flags |= XFS_EFI_CANCELED;
424 AIL_UNLOCK(mp, s); 377 AIL_UNLOCK(mp, s);
425 } 378 }
426
427 return;
428} 379}
429 380
381STATIC void
382xfs_efd_item_free(xfs_efd_log_item_t *efdp)
383{
384 int nexts = efdp->efd_format.efd_nextents;
430 385
431 386 if (nexts > XFS_EFD_MAX_FAST_EXTENTS) {
432 387 kmem_free(efdp, sizeof(xfs_efd_log_item_t) +
388 (nexts - 1) * sizeof(xfs_extent_t));
389 } else {
390 kmem_zone_free(xfs_efd_zone, efdp);
391 }
392}
433 393
434/* 394/*
435 * This returns the number of iovecs needed to log the given efd item. 395 * This returns the number of iovecs needed to log the given efd item.
@@ -533,9 +493,6 @@ xfs_efd_item_unlock(xfs_efd_log_item_t *efdp)
533STATIC xfs_lsn_t 493STATIC xfs_lsn_t
534xfs_efd_item_committed(xfs_efd_log_item_t *efdp, xfs_lsn_t lsn) 494xfs_efd_item_committed(xfs_efd_log_item_t *efdp, xfs_lsn_t lsn)
535{ 495{
536 uint size;
537 int nexts;
538
539 /* 496 /*
540 * If we got a log I/O error, it's always the case that the LR with the 497 * If we got a log I/O error, it's always the case that the LR with the
541 * EFI got unpinned and freed before the EFD got aborted. 498 * EFI got unpinned and freed before the EFD got aborted.
@@ -543,15 +500,7 @@ xfs_efd_item_committed(xfs_efd_log_item_t *efdp, xfs_lsn_t lsn)
543 if ((efdp->efd_item.li_flags & XFS_LI_ABORTED) == 0) 500 if ((efdp->efd_item.li_flags & XFS_LI_ABORTED) == 0)
544 xfs_efi_release(efdp->efd_efip, efdp->efd_format.efd_nextents); 501 xfs_efi_release(efdp->efd_efip, efdp->efd_format.efd_nextents);
545 502
546 nexts = efdp->efd_format.efd_nextents; 503 xfs_efd_item_free(efdp);
547 if (nexts > XFS_EFD_MAX_FAST_EXTENTS) {
548 size = sizeof(xfs_efd_log_item_t);
549 size += (nexts - 1) * sizeof(xfs_extent_t);
550 kmem_free(efdp, size);
551 } else {
552 kmem_zone_free(xfs_efd_zone, efdp);
553 }
554
555 return (xfs_lsn_t)-1; 504 return (xfs_lsn_t)-1;
556} 505}
557 506
@@ -565,9 +514,6 @@ xfs_efd_item_committed(xfs_efd_log_item_t *efdp, xfs_lsn_t lsn)
565STATIC void 514STATIC void
566xfs_efd_item_abort(xfs_efd_log_item_t *efdp) 515xfs_efd_item_abort(xfs_efd_log_item_t *efdp)
567{ 516{
568 int nexts;
569 int size;
570
571 /* 517 /*
572 * If we got a log I/O error, it's always the case that the LR with the 518 * If we got a log I/O error, it's always the case that the LR with the
573 * EFI got unpinned and freed before the EFD got aborted. So don't 519 * EFI got unpinned and freed before the EFD got aborted. So don't
@@ -576,15 +522,7 @@ xfs_efd_item_abort(xfs_efd_log_item_t *efdp)
576 if ((efdp->efd_item.li_flags & XFS_LI_ABORTED) == 0) 522 if ((efdp->efd_item.li_flags & XFS_LI_ABORTED) == 0)
577 xfs_efi_cancel(efdp->efd_efip); 523 xfs_efi_cancel(efdp->efd_efip);
578 524
579 nexts = efdp->efd_format.efd_nextents; 525 xfs_efd_item_free(efdp);
580 if (nexts > XFS_EFD_MAX_FAST_EXTENTS) {
581 size = sizeof(xfs_efd_log_item_t);
582 size += (nexts - 1) * sizeof(xfs_extent_t);
583 kmem_free(efdp, size);
584 } else {
585 kmem_zone_free(xfs_efd_zone, efdp);
586 }
587 return;
588} 526}
589 527
590/* 528/*
@@ -615,7 +553,7 @@ xfs_efd_item_committing(xfs_efd_log_item_t *efip, xfs_lsn_t lsn)
615/* 553/*
616 * This is the ops vector shared by all efd log items. 554 * This is the ops vector shared by all efd log items.
617 */ 555 */
618struct xfs_item_ops xfs_efd_item_ops = { 556STATIC struct xfs_item_ops xfs_efd_item_ops = {
619 .iop_size = (uint(*)(xfs_log_item_t*))xfs_efd_item_size, 557 .iop_size = (uint(*)(xfs_log_item_t*))xfs_efd_item_size,
620 .iop_format = (void(*)(xfs_log_item_t*, xfs_log_iovec_t*)) 558 .iop_format = (void(*)(xfs_log_item_t*, xfs_log_iovec_t*))
621 xfs_efd_item_format, 559 xfs_efd_item_format,
diff --git a/fs/xfs/xfs_extfree_item.h b/fs/xfs/xfs_extfree_item.h
index 7122d6101d15..d433bac9f59d 100644
--- a/fs/xfs/xfs_extfree_item.h
+++ b/fs/xfs/xfs_extfree_item.h
@@ -118,6 +118,8 @@ xfs_efi_log_item_t *xfs_efi_init(struct xfs_mount *, uint);
118xfs_efd_log_item_t *xfs_efd_init(struct xfs_mount *, xfs_efi_log_item_t *, 118xfs_efd_log_item_t *xfs_efd_init(struct xfs_mount *, xfs_efi_log_item_t *,
119 uint); 119 uint);
120 120
121void xfs_efi_item_free(xfs_efi_log_item_t *);
122
121#endif /* __KERNEL__ */ 123#endif /* __KERNEL__ */
122 124
123#endif /* __XFS_EXTFREE_ITEM_H__ */ 125#endif /* __XFS_EXTFREE_ITEM_H__ */
diff --git a/fs/xfs/xfs_fs.h b/fs/xfs/xfs_fs.h
index 6ee8443bf9d3..095af0a5cff3 100644
--- a/fs/xfs/xfs_fs.h
+++ b/fs/xfs/xfs_fs.h
@@ -60,7 +60,8 @@ struct fsxattr {
60 __u32 fsx_xflags; /* xflags field value (get/set) */ 60 __u32 fsx_xflags; /* xflags field value (get/set) */
61 __u32 fsx_extsize; /* extsize field value (get/set)*/ 61 __u32 fsx_extsize; /* extsize field value (get/set)*/
62 __u32 fsx_nextents; /* nextents field value (get) */ 62 __u32 fsx_nextents; /* nextents field value (get) */
63 unsigned char fsx_pad[16]; 63 __u32 fsx_projid; /* project identifier (get/set) */
64 unsigned char fsx_pad[12];
64}; 65};
65#endif 66#endif
66 67
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
index 21213057c27f..ca535d613190 100644
--- a/fs/xfs/xfs_fsops.c
+++ b/fs/xfs/xfs_fsops.c
@@ -559,32 +559,6 @@ xfs_reserve_blocks(
559 return(0); 559 return(0);
560} 560}
561 561
562void
563xfs_fs_log_dummy(xfs_mount_t *mp)
564{
565 xfs_trans_t *tp;
566 xfs_inode_t *ip;
567
568
569 tp = _xfs_trans_alloc(mp, XFS_TRANS_DUMMY1);
570 atomic_inc(&mp->m_active_trans);
571 if (xfs_trans_reserve(tp, 0, XFS_ICHANGE_LOG_RES(mp), 0, 0, 0)) {
572 xfs_trans_cancel(tp, 0);
573 return;
574 }
575
576 ip = mp->m_rootip;
577 xfs_ilock(ip, XFS_ILOCK_EXCL);
578
579 xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
580 xfs_trans_ihold(tp, ip);
581 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
582 xfs_trans_set_sync(tp);
583 xfs_trans_commit(tp, 0, NULL);
584
585 xfs_iunlock(ip, XFS_ILOCK_EXCL);
586}
587
588int 562int
589xfs_fs_goingdown( 563xfs_fs_goingdown(
590 xfs_mount_t *mp, 564 xfs_mount_t *mp,
diff --git a/fs/xfs/xfs_ialloc_btree.h b/fs/xfs/xfs_ialloc_btree.h
index 803c4d17a057..44be188674a6 100644
--- a/fs/xfs/xfs_ialloc_btree.h
+++ b/fs/xfs/xfs_ialloc_btree.h
@@ -100,9 +100,13 @@ xfs_inofree_t xfs_inobt_mask(int i);
100#endif 100#endif
101#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_IS_FREE) 101#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_IS_FREE)
102int xfs_inobt_is_free(xfs_inobt_rec_t *rp, int i); 102int xfs_inobt_is_free(xfs_inobt_rec_t *rp, int i);
103#define XFS_INOBT_IS_FREE(rp,i) xfs_inobt_is_free(rp,i) 103#define XFS_INOBT_IS_FREE(rp,i) xfs_inobt_is_free(rp,i)
104#define XFS_INOBT_IS_FREE_DISK(rp,i) xfs_inobt_is_free_disk(rp,i)
104#else 105#else
105#define XFS_INOBT_IS_FREE(rp,i) (((rp)->ir_free & XFS_INOBT_MASK(i)) != 0) 106#define XFS_INOBT_IS_FREE(rp,i) \
107 (((rp)->ir_free & XFS_INOBT_MASK(i)) != 0)
108#define XFS_INOBT_IS_FREE_DISK(rp,i) \
109 ((INT_GET((rp)->ir_free, ARCH_CONVERT) & XFS_INOBT_MASK(i)) != 0)
106#endif 110#endif
107#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_SET_FREE) 111#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_SET_FREE)
108void xfs_inobt_set_free(xfs_inobt_rec_t *rp, int i); 112void xfs_inobt_set_free(xfs_inobt_rec_t *rp, int i);
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index bc8c8c7f9039..34bdf5909687 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -146,51 +146,6 @@ xfs_inobp_check(
146#endif 146#endif
147 147
148/* 148/*
149 * called from bwrite on xfs inode buffers
150 */
151void
152xfs_inobp_bwcheck(xfs_buf_t *bp)
153{
154 xfs_mount_t *mp;
155 int i;
156 int j;
157 xfs_dinode_t *dip;
158
159 ASSERT(XFS_BUF_FSPRIVATE3(bp, void *) != NULL);
160
161 mp = XFS_BUF_FSPRIVATE3(bp, xfs_mount_t *);
162
163
164 j = mp->m_inode_cluster_size >> mp->m_sb.sb_inodelog;
165
166 for (i = 0; i < j; i++) {
167 dip = (xfs_dinode_t *) xfs_buf_offset(bp,
168 i * mp->m_sb.sb_inodesize);
169 if (INT_GET(dip->di_core.di_magic, ARCH_CONVERT) != XFS_DINODE_MAGIC) {
170 cmn_err(CE_WARN,
171"Bad magic # 0x%x in XFS inode buffer 0x%Lx, starting blockno %Ld, offset 0x%x",
172 INT_GET(dip->di_core.di_magic, ARCH_CONVERT),
173 (__uint64_t)(__psunsigned_t) bp,
174 (__int64_t) XFS_BUF_ADDR(bp),
175 xfs_buf_offset(bp, i * mp->m_sb.sb_inodesize));
176 xfs_fs_cmn_err(CE_WARN, mp,
177 "corrupt, unmount and run xfs_repair");
178 }
179 if (!dip->di_next_unlinked) {
180 cmn_err(CE_WARN,
181"Bad next_unlinked field (0) in XFS inode buffer 0x%p, starting blockno %Ld, offset 0x%x",
182 (__uint64_t)(__psunsigned_t) bp,
183 (__int64_t) XFS_BUF_ADDR(bp),
184 xfs_buf_offset(bp, i * mp->m_sb.sb_inodesize));
185 xfs_fs_cmn_err(CE_WARN, mp,
186 "corrupt, unmount and run xfs_repair");
187 }
188 }
189
190 return;
191}
192
193/*
194 * This routine is called to map an inode number within a file 149 * This routine is called to map an inode number within a file
195 * system to the buffer containing the on-disk version of the 150 * system to the buffer containing the on-disk version of the
196 * inode. It returns a pointer to the buffer containing the 151 * inode. It returns a pointer to the buffer containing the
@@ -203,7 +158,7 @@ xfs_inobp_bwcheck(xfs_buf_t *bp)
203 * Use xfs_imap() to determine the size and location of the 158 * Use xfs_imap() to determine the size and location of the
204 * buffer to read from disk. 159 * buffer to read from disk.
205 */ 160 */
206int 161STATIC int
207xfs_inotobp( 162xfs_inotobp(
208 xfs_mount_t *mp, 163 xfs_mount_t *mp,
209 xfs_trans_t *tp, 164 xfs_trans_t *tp,
@@ -1247,26 +1202,32 @@ xfs_ialloc(
1247 case S_IFREG: 1202 case S_IFREG:
1248 case S_IFDIR: 1203 case S_IFDIR:
1249 if (unlikely(pip->i_d.di_flags & XFS_DIFLAG_ANY)) { 1204 if (unlikely(pip->i_d.di_flags & XFS_DIFLAG_ANY)) {
1250 if (pip->i_d.di_flags & XFS_DIFLAG_RTINHERIT) { 1205 uint di_flags = 0;
1251 if ((mode & S_IFMT) == S_IFDIR) { 1206
1252 ip->i_d.di_flags |= XFS_DIFLAG_RTINHERIT; 1207 if ((mode & S_IFMT) == S_IFDIR) {
1253 } else { 1208 if (pip->i_d.di_flags & XFS_DIFLAG_RTINHERIT)
1254 ip->i_d.di_flags |= XFS_DIFLAG_REALTIME; 1209 di_flags |= XFS_DIFLAG_RTINHERIT;
1210 } else {
1211 if (pip->i_d.di_flags & XFS_DIFLAG_RTINHERIT) {
1212 di_flags |= XFS_DIFLAG_REALTIME;
1255 ip->i_iocore.io_flags |= XFS_IOCORE_RT; 1213 ip->i_iocore.io_flags |= XFS_IOCORE_RT;
1256 } 1214 }
1257 } 1215 }
1258 if ((pip->i_d.di_flags & XFS_DIFLAG_NOATIME) && 1216 if ((pip->i_d.di_flags & XFS_DIFLAG_NOATIME) &&
1259 xfs_inherit_noatime) 1217 xfs_inherit_noatime)
1260 ip->i_d.di_flags |= XFS_DIFLAG_NOATIME; 1218 di_flags |= XFS_DIFLAG_NOATIME;
1261 if ((pip->i_d.di_flags & XFS_DIFLAG_NODUMP) && 1219 if ((pip->i_d.di_flags & XFS_DIFLAG_NODUMP) &&
1262 xfs_inherit_nodump) 1220 xfs_inherit_nodump)
1263 ip->i_d.di_flags |= XFS_DIFLAG_NODUMP; 1221 di_flags |= XFS_DIFLAG_NODUMP;
1264 if ((pip->i_d.di_flags & XFS_DIFLAG_SYNC) && 1222 if ((pip->i_d.di_flags & XFS_DIFLAG_SYNC) &&
1265 xfs_inherit_sync) 1223 xfs_inherit_sync)
1266 ip->i_d.di_flags |= XFS_DIFLAG_SYNC; 1224 di_flags |= XFS_DIFLAG_SYNC;
1267 if ((pip->i_d.di_flags & XFS_DIFLAG_NOSYMLINKS) && 1225 if ((pip->i_d.di_flags & XFS_DIFLAG_NOSYMLINKS) &&
1268 xfs_inherit_nosymlinks) 1226 xfs_inherit_nosymlinks)
1269 ip->i_d.di_flags |= XFS_DIFLAG_NOSYMLINKS; 1227 di_flags |= XFS_DIFLAG_NOSYMLINKS;
1228 if (pip->i_d.di_flags & XFS_DIFLAG_PROJINHERIT)
1229 di_flags |= XFS_DIFLAG_PROJINHERIT;
1230 ip->i_d.di_flags |= di_flags;
1270 } 1231 }
1271 /* FALLTHROUGH */ 1232 /* FALLTHROUGH */
1272 case S_IFLNK: 1233 case S_IFLNK:
@@ -2156,7 +2117,7 @@ static __inline__ int xfs_inode_clean(xfs_inode_t *ip)
2156 (ip->i_update_core == 0)); 2117 (ip->i_update_core == 0));
2157} 2118}
2158 2119
2159void 2120STATIC void
2160xfs_ifree_cluster( 2121xfs_ifree_cluster(
2161 xfs_inode_t *free_ip, 2122 xfs_inode_t *free_ip,
2162 xfs_trans_t *tp, 2123 xfs_trans_t *tp,
@@ -2875,7 +2836,7 @@ xfs_iunpin(
2875 * be subsequently pinned once someone is waiting for it to be 2836 * be subsequently pinned once someone is waiting for it to be
2876 * unpinned. 2837 * unpinned.
2877 */ 2838 */
2878void 2839STATIC void
2879xfs_iunpin_wait( 2840xfs_iunpin_wait(
2880 xfs_inode_t *ip) 2841 xfs_inode_t *ip)
2881{ 2842{
@@ -3601,107 +3562,43 @@ corrupt_out:
3601 3562
3602 3563
3603/* 3564/*
3604 * Flush all inactive inodes in mp. Return true if no user references 3565 * Flush all inactive inodes in mp.
3605 * were found, false otherwise.
3606 */ 3566 */
3607int 3567void
3608xfs_iflush_all( 3568xfs_iflush_all(
3609 xfs_mount_t *mp, 3569 xfs_mount_t *mp)
3610 int flag)
3611{ 3570{
3612 int busy;
3613 int done;
3614 int purged;
3615 xfs_inode_t *ip; 3571 xfs_inode_t *ip;
3616 vmap_t vmap;
3617 vnode_t *vp; 3572 vnode_t *vp;
3618 3573
3619 busy = done = 0; 3574 again:
3620 while (!done) { 3575 XFS_MOUNT_ILOCK(mp);
3621 purged = 0; 3576 ip = mp->m_inodes;
3622 XFS_MOUNT_ILOCK(mp); 3577 if (ip == NULL)
3623 ip = mp->m_inodes; 3578 goto out;
3624 if (ip == NULL) {
3625 break;
3626 }
3627 do {
3628 /* Make sure we skip markers inserted by sync */
3629 if (ip->i_mount == NULL) {
3630 ip = ip->i_mnext;
3631 continue;
3632 }
3633
3634 /*
3635 * It's up to our caller to purge the root
3636 * and quota vnodes later.
3637 */
3638 vp = XFS_ITOV_NULL(ip);
3639
3640 if (!vp) {
3641 XFS_MOUNT_IUNLOCK(mp);
3642 xfs_finish_reclaim(ip, 0, XFS_IFLUSH_ASYNC);
3643 purged = 1;
3644 break;
3645 }
3646 3579
3647 if (vn_count(vp) != 0) { 3580 do {
3648 if (vn_count(vp) == 1 && 3581 /* Make sure we skip markers inserted by sync */
3649 (ip == mp->m_rootip || 3582 if (ip->i_mount == NULL) {
3650 (mp->m_quotainfo && 3583 ip = ip->i_mnext;
3651 (ip->i_ino == mp->m_sb.sb_uquotino || 3584 continue;
3652 ip->i_ino == mp->m_sb.sb_gquotino)))) { 3585 }
3653 3586
3654 ip = ip->i_mnext; 3587 vp = XFS_ITOV_NULL(ip);
3655 continue; 3588 if (!vp) {
3656 }
3657 if (!(flag & XFS_FLUSH_ALL)) {
3658 busy = 1;
3659 done = 1;
3660 break;
3661 }
3662 /*
3663 * Ignore busy inodes but continue flushing
3664 * others.
3665 */
3666 ip = ip->i_mnext;
3667 continue;
3668 }
3669 /*
3670 * Sample vp mapping while holding mp locked on MP
3671 * systems, so we don't purge a reclaimed or
3672 * nonexistent vnode. We break from the loop
3673 * since we know that we modify
3674 * it by pulling ourselves from it in xfs_reclaim()
3675 * called via vn_purge() below. Set ip to the next
3676 * entry in the list anyway so we'll know below
3677 * whether we reached the end or not.
3678 */
3679 VMAP(vp, vmap);
3680 XFS_MOUNT_IUNLOCK(mp); 3589 XFS_MOUNT_IUNLOCK(mp);
3590 xfs_finish_reclaim(ip, 0, XFS_IFLUSH_ASYNC);
3591 goto again;
3592 }
3681 3593
3682 vn_purge(vp, &vmap); 3594 ASSERT(vn_count(vp) == 0);
3683 3595
3684 purged = 1; 3596 ip = ip->i_mnext;
3685 break; 3597 } while (ip != mp->m_inodes);
3686 } while (ip != mp->m_inodes); 3598 out:
3687 /*
3688 * We need to distinguish between when we exit the loop
3689 * after a purge and when we simply hit the end of the
3690 * list. We can't use the (ip == mp->m_inodes) test,
3691 * because when we purge an inode at the start of the list
3692 * the next inode on the list becomes mp->m_inodes. That
3693 * would cause such a test to bail out early. The purged
3694 * variable tells us how we got out of the loop.
3695 */
3696 if (!purged) {
3697 done = 1;
3698 }
3699 }
3700 XFS_MOUNT_IUNLOCK(mp); 3599 XFS_MOUNT_IUNLOCK(mp);
3701 return !busy;
3702} 3600}
3703 3601
3704
3705/* 3602/*
3706 * xfs_iaccess: check accessibility of inode for mode. 3603 * xfs_iaccess: check accessibility of inode for mode.
3707 */ 3604 */
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h
index 37e1c316f3b6..54d9e54c7c95 100644
--- a/fs/xfs/xfs_inode.h
+++ b/fs/xfs/xfs_inode.h
@@ -412,11 +412,6 @@ void xfs_ifork_next_set(xfs_inode_t *ip, int w, int n);
412#define XFS_IFLUSH_DELWRI 5 412#define XFS_IFLUSH_DELWRI 5
413 413
414/* 414/*
415 * Flags for xfs_iflush_all.
416 */
417#define XFS_FLUSH_ALL 0x1
418
419/*
420 * Flags for xfs_itruncate_start(). 415 * Flags for xfs_itruncate_start().
421 */ 416 */
422#define XFS_ITRUNC_DEFINITE 0x1 417#define XFS_ITRUNC_DEFINITE 0x1
@@ -487,8 +482,6 @@ int xfs_finish_reclaim_all(struct xfs_mount *, int);
487/* 482/*
488 * xfs_inode.c prototypes. 483 * xfs_inode.c prototypes.
489 */ 484 */
490int xfs_inotobp(struct xfs_mount *, struct xfs_trans *, xfs_ino_t,
491 xfs_dinode_t **, struct xfs_buf **, int *);
492int xfs_itobp(struct xfs_mount *, struct xfs_trans *, 485int xfs_itobp(struct xfs_mount *, struct xfs_trans *,
493 xfs_inode_t *, xfs_dinode_t **, struct xfs_buf **, 486 xfs_inode_t *, xfs_dinode_t **, struct xfs_buf **,
494 xfs_daddr_t); 487 xfs_daddr_t);
@@ -522,7 +515,7 @@ void xfs_ipin(xfs_inode_t *);
522void xfs_iunpin(xfs_inode_t *); 515void xfs_iunpin(xfs_inode_t *);
523int xfs_iextents_copy(xfs_inode_t *, xfs_bmbt_rec_t *, int); 516int xfs_iextents_copy(xfs_inode_t *, xfs_bmbt_rec_t *, int);
524int xfs_iflush(xfs_inode_t *, uint); 517int xfs_iflush(xfs_inode_t *, uint);
525int xfs_iflush_all(struct xfs_mount *, int); 518void xfs_iflush_all(struct xfs_mount *);
526int xfs_iaccess(xfs_inode_t *, mode_t, cred_t *); 519int xfs_iaccess(xfs_inode_t *, mode_t, cred_t *);
527uint xfs_iroundup(uint); 520uint xfs_iroundup(uint);
528void xfs_ichgtime(xfs_inode_t *, int); 521void xfs_ichgtime(xfs_inode_t *, int);
diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c
index 768cb1816b8e..0eed30f5cb19 100644
--- a/fs/xfs/xfs_inode_item.c
+++ b/fs/xfs/xfs_inode_item.c
@@ -910,7 +910,7 @@ xfs_inode_item_committing(
910/* 910/*
911 * This is the ops vector shared by all buf log items. 911 * This is the ops vector shared by all buf log items.
912 */ 912 */
913struct xfs_item_ops xfs_inode_item_ops = { 913STATIC struct xfs_item_ops xfs_inode_item_ops = {
914 .iop_size = (uint(*)(xfs_log_item_t*))xfs_inode_item_size, 914 .iop_size = (uint(*)(xfs_log_item_t*))xfs_inode_item_size,
915 .iop_format = (void(*)(xfs_log_item_t*, xfs_log_iovec_t*)) 915 .iop_format = (void(*)(xfs_log_item_t*, xfs_log_iovec_t*))
916 xfs_inode_item_format, 916 xfs_inode_item_format,
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index 469e1a7939d4..2edd6769e5d3 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -385,15 +385,15 @@ xfs_iomap_write_direct(
385 int nimaps, maps; 385 int nimaps, maps;
386 int error; 386 int error;
387 int bmapi_flag; 387 int bmapi_flag;
388 int quota_flag;
388 int rt; 389 int rt;
389 xfs_trans_t *tp; 390 xfs_trans_t *tp;
390 xfs_bmbt_irec_t imap[XFS_WRITE_IMAPS], *imapp; 391 xfs_bmbt_irec_t imap[XFS_WRITE_IMAPS], *imapp;
391 xfs_bmap_free_t free_list; 392 xfs_bmap_free_t free_list;
392 int aeof; 393 int aeof;
393 xfs_filblks_t datablocks; 394 xfs_filblks_t datablocks, qblocks, resblks;
394 int committed; 395 int committed;
395 int numrtextents; 396 int numrtextents;
396 uint resblks;
397 397
398 /* 398 /*
399 * Make sure that the dquots are there. This doesn't hold 399 * Make sure that the dquots are there. This doesn't hold
@@ -419,7 +419,6 @@ xfs_iomap_write_direct(
419 xfs_fileoff_t map_last_fsb; 419 xfs_fileoff_t map_last_fsb;
420 420
421 map_last_fsb = ret_imap->br_blockcount + ret_imap->br_startoff; 421 map_last_fsb = ret_imap->br_blockcount + ret_imap->br_startoff;
422
423 if (map_last_fsb < last_fsb) { 422 if (map_last_fsb < last_fsb) {
424 last_fsb = map_last_fsb; 423 last_fsb = map_last_fsb;
425 count_fsb = last_fsb - offset_fsb; 424 count_fsb = last_fsb - offset_fsb;
@@ -428,56 +427,47 @@ xfs_iomap_write_direct(
428 } 427 }
429 428
430 /* 429 /*
431 * determine if reserving space on 430 * Determine if reserving space on the data or realtime partition.
432 * the data or realtime partition.
433 */ 431 */
434 if ((rt = XFS_IS_REALTIME_INODE(ip))) { 432 if ((rt = XFS_IS_REALTIME_INODE(ip))) {
435 int sbrtextsize, iprtextsize; 433 xfs_extlen_t extsz;
436 434
437 sbrtextsize = mp->m_sb.sb_rextsize; 435 if (!(extsz = ip->i_d.di_extsize))
438 iprtextsize = 436 extsz = mp->m_sb.sb_rextsize;
439 ip->i_d.di_extsize ? ip->i_d.di_extsize : sbrtextsize; 437 numrtextents = qblocks = (count_fsb + extsz - 1);
440 numrtextents = (count_fsb + iprtextsize - 1); 438 do_div(numrtextents, mp->m_sb.sb_rextsize);
441 do_div(numrtextents, sbrtextsize); 439 quota_flag = XFS_QMOPT_RES_RTBLKS;
442 datablocks = 0; 440 datablocks = 0;
443 } else { 441 } else {
444 datablocks = count_fsb; 442 datablocks = qblocks = count_fsb;
443 quota_flag = XFS_QMOPT_RES_REGBLKS;
445 numrtextents = 0; 444 numrtextents = 0;
446 } 445 }
447 446
448 /* 447 /*
449 * allocate and setup the transaction 448 * Allocate and setup the transaction
450 */ 449 */
451 xfs_iunlock(ip, XFS_ILOCK_EXCL); 450 xfs_iunlock(ip, XFS_ILOCK_EXCL);
452 tp = xfs_trans_alloc(mp, XFS_TRANS_DIOSTRAT); 451 tp = xfs_trans_alloc(mp, XFS_TRANS_DIOSTRAT);
453
454 resblks = XFS_DIOSTRAT_SPACE_RES(mp, datablocks); 452 resblks = XFS_DIOSTRAT_SPACE_RES(mp, datablocks);
455
456 error = xfs_trans_reserve(tp, resblks, 453 error = xfs_trans_reserve(tp, resblks,
457 XFS_WRITE_LOG_RES(mp), numrtextents, 454 XFS_WRITE_LOG_RES(mp), numrtextents,
458 XFS_TRANS_PERM_LOG_RES, 455 XFS_TRANS_PERM_LOG_RES,
459 XFS_WRITE_LOG_COUNT); 456 XFS_WRITE_LOG_COUNT);
460 457
461 /* 458 /*
462 * check for running out of space 459 * Check for running out of space, note: need lock to return
463 */ 460 */
464 if (error) 461 if (error)
465 /*
466 * Free the transaction structure.
467 */
468 xfs_trans_cancel(tp, 0); 462 xfs_trans_cancel(tp, 0);
469
470 xfs_ilock(ip, XFS_ILOCK_EXCL); 463 xfs_ilock(ip, XFS_ILOCK_EXCL);
471
472 if (error) 464 if (error)
473 goto error_out; /* Don't return in above if .. trans .., 465 goto error_out;
474 need lock to return */
475 466
476 if (XFS_TRANS_RESERVE_BLKQUOTA(mp, tp, ip, resblks)) { 467 if (XFS_TRANS_RESERVE_QUOTA_NBLKS(mp, tp, ip, qblocks, 0, quota_flag)) {
477 error = (EDQUOT); 468 error = (EDQUOT);
478 goto error1; 469 goto error1;
479 } 470 }
480 nimaps = 1;
481 471
482 bmapi_flag = XFS_BMAPI_WRITE; 472 bmapi_flag = XFS_BMAPI_WRITE;
483 xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); 473 xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
@@ -487,31 +477,29 @@ xfs_iomap_write_direct(
487 bmapi_flag |= XFS_BMAPI_PREALLOC; 477 bmapi_flag |= XFS_BMAPI_PREALLOC;
488 478
489 /* 479 /*
490 * issue the bmapi() call to allocate the blocks 480 * Issue the bmapi() call to allocate the blocks
491 */ 481 */
492 XFS_BMAP_INIT(&free_list, &firstfsb); 482 XFS_BMAP_INIT(&free_list, &firstfsb);
483 nimaps = 1;
493 imapp = &imap[0]; 484 imapp = &imap[0];
494 error = xfs_bmapi(tp, ip, offset_fsb, count_fsb, 485 error = xfs_bmapi(tp, ip, offset_fsb, count_fsb,
495 bmapi_flag, &firstfsb, 0, imapp, &nimaps, &free_list); 486 bmapi_flag, &firstfsb, 0, imapp, &nimaps, &free_list);
496 if (error) { 487 if (error)
497 goto error0; 488 goto error0;
498 }
499 489
500 /* 490 /*
501 * complete the transaction 491 * Complete the transaction
502 */ 492 */
503
504 error = xfs_bmap_finish(&tp, &free_list, firstfsb, &committed); 493 error = xfs_bmap_finish(&tp, &free_list, firstfsb, &committed);
505 if (error) { 494 if (error)
506 goto error0; 495 goto error0;
507 }
508
509 error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES, NULL); 496 error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES, NULL);
510 if (error) { 497 if (error)
511 goto error_out; 498 goto error_out;
512 }
513 499
514 /* copy any maps to caller's array and return any error. */ 500 /*
501 * Copy any maps to caller's array and return any error.
502 */
515 if (nimaps == 0) { 503 if (nimaps == 0) {
516 error = (ENOSPC); 504 error = (ENOSPC);
517 goto error_out; 505 goto error_out;
@@ -530,10 +518,11 @@ xfs_iomap_write_direct(
530 } 518 }
531 return 0; 519 return 0;
532 520
533 error0: /* Cancel bmap, unlock inode, and cancel trans */ 521error0: /* Cancel bmap, unlock inode, unreserve quota blocks, cancel trans */
534 xfs_bmap_cancel(&free_list); 522 xfs_bmap_cancel(&free_list);
523 XFS_TRANS_UNRESERVE_QUOTA_NBLKS(mp, tp, ip, qblocks, 0, quota_flag);
535 524
536 error1: /* Just cancel transaction */ 525error1: /* Just cancel transaction */
537 xfs_trans_cancel(tp, XFS_TRANS_RELEASE_LOG_RES | XFS_TRANS_ABORT); 526 xfs_trans_cancel(tp, XFS_TRANS_RELEASE_LOG_RES | XFS_TRANS_ABORT);
538 *nmaps = 0; /* nothing set-up here */ 527 *nmaps = 0; /* nothing set-up here */
539 528
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 092d5fb096b1..1cd2ac163877 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -134,7 +134,7 @@ STATIC void xlog_verify_tail_lsn(xlog_t *log, xlog_in_core_t *iclog,
134#define xlog_verify_tail_lsn(a,b,c) 134#define xlog_verify_tail_lsn(a,b,c)
135#endif 135#endif
136 136
137int xlog_iclogs_empty(xlog_t *log); 137STATIC int xlog_iclogs_empty(xlog_t *log);
138 138
139#ifdef DEBUG 139#ifdef DEBUG
140int xlog_do_error = 0; 140int xlog_do_error = 0;
@@ -1857,7 +1857,7 @@ xlog_write(xfs_mount_t * mp,
1857 * 1857 *
1858 * State Change: DIRTY -> ACTIVE 1858 * State Change: DIRTY -> ACTIVE
1859 */ 1859 */
1860void 1860STATIC void
1861xlog_state_clean_log(xlog_t *log) 1861xlog_state_clean_log(xlog_t *log)
1862{ 1862{
1863 xlog_in_core_t *iclog; 1863 xlog_in_core_t *iclog;
@@ -3542,7 +3542,7 @@ xfs_log_force_umount(
3542 return (retval); 3542 return (retval);
3543} 3543}
3544 3544
3545int 3545STATIC int
3546xlog_iclogs_empty(xlog_t *log) 3546xlog_iclogs_empty(xlog_t *log)
3547{ 3547{
3548 xlog_in_core_t *iclog; 3548 xlog_in_core_t *iclog;
diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h
index c31e3ce3be66..1a1d452f15f9 100644
--- a/fs/xfs/xfs_log_priv.h
+++ b/fs/xfs/xfs_log_priv.h
@@ -535,7 +535,6 @@ typedef struct log {
535 535
536/* common routines */ 536/* common routines */
537extern xfs_lsn_t xlog_assign_tail_lsn(struct xfs_mount *mp); 537extern xfs_lsn_t xlog_assign_tail_lsn(struct xfs_mount *mp);
538extern int xlog_find_head(xlog_t *log, xfs_daddr_t *head_blk);
539extern int xlog_find_tail(xlog_t *log, 538extern int xlog_find_tail(xlog_t *log,
540 xfs_daddr_t *head_blk, 539 xfs_daddr_t *head_blk,
541 xfs_daddr_t *tail_blk, 540 xfs_daddr_t *tail_blk,
@@ -548,7 +547,6 @@ extern void xlog_recover_process_iunlinks(xlog_t *log);
548extern struct xfs_buf *xlog_get_bp(xlog_t *, int); 547extern struct xfs_buf *xlog_get_bp(xlog_t *, int);
549extern void xlog_put_bp(struct xfs_buf *); 548extern void xlog_put_bp(struct xfs_buf *);
550extern int xlog_bread(xlog_t *, xfs_daddr_t, int, struct xfs_buf *); 549extern int xlog_bread(xlog_t *, xfs_daddr_t, int, struct xfs_buf *);
551extern xfs_caddr_t xlog_align(xlog_t *, xfs_daddr_t, int, struct xfs_buf *);
552 550
553/* iclog tracing */ 551/* iclog tracing */
554#define XLOG_TRACE_GRAB_FLUSH 1 552#define XLOG_TRACE_GRAB_FLUSH 1
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index 9824b5bf0ec0..0aac28ddb81c 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -148,7 +148,7 @@ xlog_bread(
148 * The buffer is kept locked across the write and is returned locked. 148 * The buffer is kept locked across the write and is returned locked.
149 * This can only be used for synchronous log writes. 149 * This can only be used for synchronous log writes.
150 */ 150 */
151int 151STATIC int
152xlog_bwrite( 152xlog_bwrite(
153 xlog_t *log, 153 xlog_t *log,
154 xfs_daddr_t blk_no, 154 xfs_daddr_t blk_no,
@@ -179,7 +179,7 @@ xlog_bwrite(
179 return error; 179 return error;
180} 180}
181 181
182xfs_caddr_t 182STATIC xfs_caddr_t
183xlog_align( 183xlog_align(
184 xlog_t *log, 184 xlog_t *log,
185 xfs_daddr_t blk_no, 185 xfs_daddr_t blk_no,
@@ -528,7 +528,7 @@ out:
528 * 528 *
529 * Return: zero if normal, non-zero if error. 529 * Return: zero if normal, non-zero if error.
530 */ 530 */
531int 531STATIC int
532xlog_find_head( 532xlog_find_head(
533 xlog_t *log, 533 xlog_t *log,
534 xfs_daddr_t *return_head_blk) 534 xfs_daddr_t *return_head_blk)
@@ -1964,7 +1964,8 @@ xlog_recover_do_reg_buffer(
1964 * probably a good thing to do for other buf types also. 1964 * probably a good thing to do for other buf types also.
1965 */ 1965 */
1966 error = 0; 1966 error = 0;
1967 if (buf_f->blf_flags & (XFS_BLI_UDQUOT_BUF|XFS_BLI_GDQUOT_BUF)) { 1967 if (buf_f->blf_flags &
1968 (XFS_BLI_UDQUOT_BUF|XFS_BLI_PDQUOT_BUF|XFS_BLI_GDQUOT_BUF)) {
1968 error = xfs_qm_dqcheck((xfs_disk_dquot_t *) 1969 error = xfs_qm_dqcheck((xfs_disk_dquot_t *)
1969 item->ri_buf[i].i_addr, 1970 item->ri_buf[i].i_addr,
1970 -1, 0, XFS_QMOPT_DOWARN, 1971 -1, 0, XFS_QMOPT_DOWARN,
@@ -2030,6 +2031,7 @@ xfs_qm_dqcheck(
2030 } 2031 }
2031 2032
2032 if (INT_GET(ddq->d_flags, ARCH_CONVERT) != XFS_DQ_USER && 2033 if (INT_GET(ddq->d_flags, ARCH_CONVERT) != XFS_DQ_USER &&
2034 INT_GET(ddq->d_flags, ARCH_CONVERT) != XFS_DQ_PROJ &&
2033 INT_GET(ddq->d_flags, ARCH_CONVERT) != XFS_DQ_GROUP) { 2035 INT_GET(ddq->d_flags, ARCH_CONVERT) != XFS_DQ_GROUP) {
2034 if (flags & XFS_QMOPT_DOWARN) 2036 if (flags & XFS_QMOPT_DOWARN)
2035 cmn_err(CE_ALERT, 2037 cmn_err(CE_ALERT,
@@ -2135,6 +2137,8 @@ xlog_recover_do_dquot_buffer(
2135 type = 0; 2137 type = 0;
2136 if (buf_f->blf_flags & XFS_BLI_UDQUOT_BUF) 2138 if (buf_f->blf_flags & XFS_BLI_UDQUOT_BUF)
2137 type |= XFS_DQ_USER; 2139 type |= XFS_DQ_USER;
2140 if (buf_f->blf_flags & XFS_BLI_PDQUOT_BUF)
2141 type |= XFS_DQ_PROJ;
2138 if (buf_f->blf_flags & XFS_BLI_GDQUOT_BUF) 2142 if (buf_f->blf_flags & XFS_BLI_GDQUOT_BUF)
2139 type |= XFS_DQ_GROUP; 2143 type |= XFS_DQ_GROUP;
2140 /* 2144 /*
@@ -2247,7 +2251,8 @@ xlog_recover_do_buffer_trans(
2247 error = 0; 2251 error = 0;
2248 if (flags & XFS_BLI_INODE_BUF) { 2252 if (flags & XFS_BLI_INODE_BUF) {
2249 error = xlog_recover_do_inode_buffer(mp, item, bp, buf_f); 2253 error = xlog_recover_do_inode_buffer(mp, item, bp, buf_f);
2250 } else if (flags & (XFS_BLI_UDQUOT_BUF | XFS_BLI_GDQUOT_BUF)) { 2254 } else if (flags &
2255 (XFS_BLI_UDQUOT_BUF|XFS_BLI_PDQUOT_BUF|XFS_BLI_GDQUOT_BUF)) {
2251 xlog_recover_do_dquot_buffer(mp, log, item, bp, buf_f); 2256 xlog_recover_do_dquot_buffer(mp, log, item, bp, buf_f);
2252 } else { 2257 } else {
2253 xlog_recover_do_reg_buffer(mp, item, bp, buf_f); 2258 xlog_recover_do_reg_buffer(mp, item, bp, buf_f);
@@ -2619,7 +2624,7 @@ xlog_recover_do_dquot_trans(
2619 * This type of quotas was turned off, so ignore this record. 2624 * This type of quotas was turned off, so ignore this record.
2620 */ 2625 */
2621 type = INT_GET(recddq->d_flags, ARCH_CONVERT) & 2626 type = INT_GET(recddq->d_flags, ARCH_CONVERT) &
2622 (XFS_DQ_USER | XFS_DQ_GROUP); 2627 (XFS_DQ_USER | XFS_DQ_PROJ | XFS_DQ_GROUP);
2623 ASSERT(type); 2628 ASSERT(type);
2624 if (log->l_quotaoffs_flag & type) 2629 if (log->l_quotaoffs_flag & type)
2625 return (0); 2630 return (0);
@@ -2742,7 +2747,6 @@ xlog_recover_do_efd_trans(
2742 xfs_efi_log_item_t *efip = NULL; 2747 xfs_efi_log_item_t *efip = NULL;
2743 xfs_log_item_t *lip; 2748 xfs_log_item_t *lip;
2744 int gen; 2749 int gen;
2745 int nexts;
2746 __uint64_t efi_id; 2750 __uint64_t efi_id;
2747 SPLDECL(s); 2751 SPLDECL(s);
2748 2752
@@ -2777,22 +2781,15 @@ xlog_recover_do_efd_trans(
2777 } 2781 }
2778 lip = xfs_trans_next_ail(mp, lip, &gen, NULL); 2782 lip = xfs_trans_next_ail(mp, lip, &gen, NULL);
2779 } 2783 }
2780 if (lip == NULL) {
2781 AIL_UNLOCK(mp, s);
2782 }
2783 2784
2784 /* 2785 /*
2785 * If we found it, then free it up. If it wasn't there, it 2786 * If we found it, then free it up. If it wasn't there, it
2786 * must have been overwritten in the log. Oh well. 2787 * must have been overwritten in the log. Oh well.
2787 */ 2788 */
2788 if (lip != NULL) { 2789 if (lip != NULL) {
2789 nexts = efip->efi_format.efi_nextents; 2790 xfs_efi_item_free(efip);
2790 if (nexts > XFS_EFI_MAX_FAST_EXTENTS) { 2791 } else {
2791 kmem_free(lip, sizeof(xfs_efi_log_item_t) + 2792 AIL_UNLOCK(mp, s);
2792 ((nexts - 1) * sizeof(xfs_extent_t)));
2793 } else {
2794 kmem_zone_free(xfs_efi_zone, efip);
2795 }
2796 } 2793 }
2797} 2794}
2798 2795
diff --git a/fs/xfs/xfs_macros.c b/fs/xfs/xfs_macros.c
index ce4f46c6b3ab..698c2cd62858 100644
--- a/fs/xfs/xfs_macros.c
+++ b/fs/xfs/xfs_macros.c
@@ -1658,6 +1658,11 @@ xfs_inobt_is_free(xfs_inobt_rec_t *rp, int i)
1658{ 1658{
1659 return XFS_INOBT_IS_FREE(rp, i); 1659 return XFS_INOBT_IS_FREE(rp, i);
1660} 1660}
1661int
1662xfs_inobt_is_free_disk(xfs_inobt_rec_t *rp, int i)
1663{
1664 return XFS_INOBT_IS_FREE_DISK(rp, i);
1665}
1661#endif 1666#endif
1662 1667
1663#if XFS_WANT_FUNCS_C || (XFS_WANT_SPACE_C && XFSSO_XFS_INOBT_IS_LAST_REC) 1668#if XFS_WANT_FUNCS_C || (XFS_WANT_SPACE_C && XFSSO_XFS_INOBT_IS_LAST_REC)
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index 2ec967d93e5a..82e1646e6243 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -64,6 +64,7 @@
64STATIC void xfs_mount_log_sbunit(xfs_mount_t *, __int64_t); 64STATIC void xfs_mount_log_sbunit(xfs_mount_t *, __int64_t);
65STATIC int xfs_uuid_mount(xfs_mount_t *); 65STATIC int xfs_uuid_mount(xfs_mount_t *);
66STATIC void xfs_uuid_unmount(xfs_mount_t *mp); 66STATIC void xfs_uuid_unmount(xfs_mount_t *mp);
67STATIC void xfs_unmountfs_wait(xfs_mount_t *);
67 68
68static struct { 69static struct {
69 short offset; 70 short offset;
@@ -555,7 +556,7 @@ xfs_readsb(xfs_mount_t *mp)
555 * fields from the superblock associated with the given 556 * fields from the superblock associated with the given
556 * mount structure 557 * mount structure
557 */ 558 */
558void 559STATIC void
559xfs_mount_common(xfs_mount_t *mp, xfs_sb_t *sbp) 560xfs_mount_common(xfs_mount_t *mp, xfs_sb_t *sbp)
560{ 561{
561 int i; 562 int i;
@@ -1081,7 +1082,7 @@ xfs_unmountfs(xfs_mount_t *mp, struct cred *cr)
1081 int64_t fsid; 1082 int64_t fsid;
1082#endif 1083#endif
1083 1084
1084 xfs_iflush_all(mp, XFS_FLUSH_ALL); 1085 xfs_iflush_all(mp);
1085 1086
1086 XFS_QM_DQPURGEALL(mp, 1087 XFS_QM_DQPURGEALL(mp,
1087 XFS_QMOPT_UQUOTA | XFS_QMOPT_GQUOTA | XFS_QMOPT_UMOUNTING); 1088 XFS_QMOPT_UQUOTA | XFS_QMOPT_GQUOTA | XFS_QMOPT_UMOUNTING);
@@ -1111,15 +1112,6 @@ xfs_unmountfs(xfs_mount_t *mp, struct cred *cr)
1111 */ 1112 */
1112 ASSERT(mp->m_inodes == NULL); 1113 ASSERT(mp->m_inodes == NULL);
1113 1114
1114 /*
1115 * We may have bufs that are in the process of getting written still.
1116 * We must wait for the I/O completion of those. The sync flag here
1117 * does a two pass iteration thru the bufcache.
1118 */
1119 if (XFS_FORCED_SHUTDOWN(mp)) {
1120 xfs_incore_relse(mp->m_ddev_targp, 0, 1); /* synchronous */
1121 }
1122
1123 xfs_unmountfs_close(mp, cr); 1115 xfs_unmountfs_close(mp, cr);
1124 if ((mp->m_flags & XFS_MOUNT_NOUUID) == 0) 1116 if ((mp->m_flags & XFS_MOUNT_NOUUID) == 0)
1125 xfs_uuid_unmount(mp); 1117 xfs_uuid_unmount(mp);
@@ -1146,7 +1138,7 @@ xfs_unmountfs_close(xfs_mount_t *mp, struct cred *cr)
1146 xfs_free_buftarg(mp->m_ddev_targp, 0); 1138 xfs_free_buftarg(mp->m_ddev_targp, 0);
1147} 1139}
1148 1140
1149void 1141STATIC void
1150xfs_unmountfs_wait(xfs_mount_t *mp) 1142xfs_unmountfs_wait(xfs_mount_t *mp)
1151{ 1143{
1152 if (mp->m_logdev_targp != mp->m_ddev_targp) 1144 if (mp->m_logdev_targp != mp->m_ddev_targp)
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
index 30dd08fb9f57..5affba38a577 100644
--- a/fs/xfs/xfs_mount.h
+++ b/fs/xfs/xfs_mount.h
@@ -141,7 +141,7 @@ typedef int (*xfs_dqattach_t)(struct xfs_inode *, uint);
141typedef void (*xfs_dqdetach_t)(struct xfs_inode *); 141typedef void (*xfs_dqdetach_t)(struct xfs_inode *);
142typedef int (*xfs_dqpurgeall_t)(struct xfs_mount *, uint); 142typedef int (*xfs_dqpurgeall_t)(struct xfs_mount *, uint);
143typedef int (*xfs_dqvopalloc_t)(struct xfs_mount *, 143typedef int (*xfs_dqvopalloc_t)(struct xfs_mount *,
144 struct xfs_inode *, uid_t, gid_t, uint, 144 struct xfs_inode *, uid_t, gid_t, prid_t, uint,
145 struct xfs_dquot **, struct xfs_dquot **); 145 struct xfs_dquot **, struct xfs_dquot **);
146typedef void (*xfs_dqvopcreate_t)(struct xfs_trans *, struct xfs_inode *, 146typedef void (*xfs_dqvopcreate_t)(struct xfs_trans *, struct xfs_inode *,
147 struct xfs_dquot *, struct xfs_dquot *); 147 struct xfs_dquot *, struct xfs_dquot *);
@@ -185,8 +185,8 @@ typedef struct xfs_qmops {
185 (*(mp)->m_qm_ops.xfs_dqdetach)(ip) 185 (*(mp)->m_qm_ops.xfs_dqdetach)(ip)
186#define XFS_QM_DQPURGEALL(mp, fl) \ 186#define XFS_QM_DQPURGEALL(mp, fl) \
187 (*(mp)->m_qm_ops.xfs_dqpurgeall)(mp, fl) 187 (*(mp)->m_qm_ops.xfs_dqpurgeall)(mp, fl)
188#define XFS_QM_DQVOPALLOC(mp, ip, uid, gid, fl, dq1, dq2) \ 188#define XFS_QM_DQVOPALLOC(mp, ip, uid, gid, prid, fl, dq1, dq2) \
189 (*(mp)->m_qm_ops.xfs_dqvopalloc)(mp, ip, uid, gid, fl, dq1, dq2) 189 (*(mp)->m_qm_ops.xfs_dqvopalloc)(mp, ip, uid, gid, prid, fl, dq1, dq2)
190#define XFS_QM_DQVOPCREATE(mp, tp, ip, dq1, dq2) \ 190#define XFS_QM_DQVOPCREATE(mp, tp, ip, dq1, dq2) \
191 (*(mp)->m_qm_ops.xfs_dqvopcreate)(tp, ip, dq1, dq2) 191 (*(mp)->m_qm_ops.xfs_dqvopcreate)(tp, ip, dq1, dq2)
192#define XFS_QM_DQVOPRENAME(mp, ip) \ 192#define XFS_QM_DQVOPRENAME(mp, ip) \
@@ -544,7 +544,6 @@ extern void xfs_mount_free(xfs_mount_t *mp, int remove_bhv);
544extern int xfs_mountfs(struct vfs *, xfs_mount_t *mp, int); 544extern int xfs_mountfs(struct vfs *, xfs_mount_t *mp, int);
545 545
546extern int xfs_unmountfs(xfs_mount_t *, struct cred *); 546extern int xfs_unmountfs(xfs_mount_t *, struct cred *);
547extern void xfs_unmountfs_wait(xfs_mount_t *);
548extern void xfs_unmountfs_close(xfs_mount_t *, struct cred *); 547extern void xfs_unmountfs_close(xfs_mount_t *, struct cred *);
549extern int xfs_unmountfs_writesb(xfs_mount_t *); 548extern int xfs_unmountfs_writesb(xfs_mount_t *);
550extern int xfs_unmount_flush(xfs_mount_t *, int); 549extern int xfs_unmount_flush(xfs_mount_t *, int);
diff --git a/fs/xfs/xfs_quota.h b/fs/xfs/xfs_quota.h
index 703ec4efcb41..7134576ae7fa 100644
--- a/fs/xfs/xfs_quota.h
+++ b/fs/xfs/xfs_quota.h
@@ -96,7 +96,7 @@ typedef struct xfs_dqblk {
96 * flags for q_flags field in the dquot. 96 * flags for q_flags field in the dquot.
97 */ 97 */
98#define XFS_DQ_USER 0x0001 /* a user quota */ 98#define XFS_DQ_USER 0x0001 /* a user quota */
99/* #define XFS_DQ_PROJ 0x0002 -- project quota (IRIX) */ 99#define XFS_DQ_PROJ 0x0002 /* project quota */
100#define XFS_DQ_GROUP 0x0004 /* a group quota */ 100#define XFS_DQ_GROUP 0x0004 /* a group quota */
101#define XFS_DQ_FLOCKED 0x0008 /* flush lock taken */ 101#define XFS_DQ_FLOCKED 0x0008 /* flush lock taken */
102#define XFS_DQ_DIRTY 0x0010 /* dquot is dirty */ 102#define XFS_DQ_DIRTY 0x0010 /* dquot is dirty */
@@ -104,6 +104,8 @@ typedef struct xfs_dqblk {
104#define XFS_DQ_INACTIVE 0x0040 /* dq off mplist & hashlist */ 104#define XFS_DQ_INACTIVE 0x0040 /* dq off mplist & hashlist */
105#define XFS_DQ_MARKER 0x0080 /* sentinel */ 105#define XFS_DQ_MARKER 0x0080 /* sentinel */
106 106
107#define XFS_DQ_ALLTYPES (XFS_DQ_USER|XFS_DQ_PROJ|XFS_DQ_GROUP)
108
107/* 109/*
108 * In the worst case, when both user and group quotas are on, 110 * In the worst case, when both user and group quotas are on,
109 * we can have a max of three dquots changing in a single transaction. 111 * we can have a max of three dquots changing in a single transaction.
@@ -124,7 +126,7 @@ typedef struct xfs_dqblk {
124typedef struct xfs_dq_logformat { 126typedef struct xfs_dq_logformat {
125 __uint16_t qlf_type; /* dquot log item type */ 127 __uint16_t qlf_type; /* dquot log item type */
126 __uint16_t qlf_size; /* size of this item */ 128 __uint16_t qlf_size; /* size of this item */
127 xfs_dqid_t qlf_id; /* usr/grp id number : 32 bits */ 129 xfs_dqid_t qlf_id; /* usr/grp/proj id : 32 bits */
128 __int64_t qlf_blkno; /* blkno of dquot buffer */ 130 __int64_t qlf_blkno; /* blkno of dquot buffer */
129 __int32_t qlf_len; /* len of dquot buffer */ 131 __int32_t qlf_len; /* len of dquot buffer */
130 __uint32_t qlf_boffset; /* off of dquot in buffer */ 132 __uint32_t qlf_boffset; /* off of dquot in buffer */
@@ -152,9 +154,9 @@ typedef struct xfs_qoff_logformat {
152#define XFS_UQUOTA_ACCT 0x0001 /* user quota accounting ON */ 154#define XFS_UQUOTA_ACCT 0x0001 /* user quota accounting ON */
153#define XFS_UQUOTA_ENFD 0x0002 /* user quota limits enforced */ 155#define XFS_UQUOTA_ENFD 0x0002 /* user quota limits enforced */
154#define XFS_UQUOTA_CHKD 0x0004 /* quotacheck run on usr quotas */ 156#define XFS_UQUOTA_CHKD 0x0004 /* quotacheck run on usr quotas */
155#define XFS_PQUOTA_ACCT 0x0008 /* (IRIX) project quota accounting ON */ 157#define XFS_PQUOTA_ACCT 0x0008 /* project quota accounting ON */
156#define XFS_GQUOTA_ENFD 0x0010 /* group quota limits enforced */ 158#define XFS_OQUOTA_ENFD 0x0010 /* other (grp/prj) quota limits enforced */
157#define XFS_GQUOTA_CHKD 0x0020 /* quotacheck run on grp quotas */ 159#define XFS_OQUOTA_CHKD 0x0020 /* quotacheck run on other (grp/prj) quotas */
158#define XFS_GQUOTA_ACCT 0x0040 /* group quota accounting ON */ 160#define XFS_GQUOTA_ACCT 0x0040 /* group quota accounting ON */
159 161
160/* 162/*
@@ -162,17 +164,22 @@ typedef struct xfs_qoff_logformat {
162 * are in the process of getting turned off. These flags are in m_qflags but 164 * are in the process of getting turned off. These flags are in m_qflags but
163 * never in sb_qflags. 165 * never in sb_qflags.
164 */ 166 */
165#define XFS_UQUOTA_ACTIVE 0x0080 /* uquotas are being turned off */ 167#define XFS_UQUOTA_ACTIVE 0x0100 /* uquotas are being turned off */
166#define XFS_GQUOTA_ACTIVE 0x0100 /* gquotas are being turned off */ 168#define XFS_PQUOTA_ACTIVE 0x0200 /* pquotas are being turned off */
169#define XFS_GQUOTA_ACTIVE 0x0400 /* gquotas are being turned off */
167 170
168/* 171/*
169 * Checking XFS_IS_*QUOTA_ON() while holding any inode lock guarantees 172 * Checking XFS_IS_*QUOTA_ON() while holding any inode lock guarantees
170 * quota will be not be switched off as long as that inode lock is held. 173 * quota will be not be switched off as long as that inode lock is held.
171 */ 174 */
172#define XFS_IS_QUOTA_ON(mp) ((mp)->m_qflags & (XFS_UQUOTA_ACTIVE | \ 175#define XFS_IS_QUOTA_ON(mp) ((mp)->m_qflags & (XFS_UQUOTA_ACTIVE | \
173 XFS_GQUOTA_ACTIVE)) 176 XFS_GQUOTA_ACTIVE | \
177 XFS_PQUOTA_ACTIVE))
178#define XFS_IS_OQUOTA_ON(mp) ((mp)->m_qflags & (XFS_GQUOTA_ACTIVE | \
179 XFS_PQUOTA_ACTIVE))
174#define XFS_IS_UQUOTA_ON(mp) ((mp)->m_qflags & XFS_UQUOTA_ACTIVE) 180#define XFS_IS_UQUOTA_ON(mp) ((mp)->m_qflags & XFS_UQUOTA_ACTIVE)
175#define XFS_IS_GQUOTA_ON(mp) ((mp)->m_qflags & XFS_GQUOTA_ACTIVE) 181#define XFS_IS_GQUOTA_ON(mp) ((mp)->m_qflags & XFS_GQUOTA_ACTIVE)
182#define XFS_IS_PQUOTA_ON(mp) ((mp)->m_qflags & XFS_PQUOTA_ACTIVE)
176 183
177/* 184/*
178 * Flags to tell various functions what to do. Not all of these are meaningful 185 * Flags to tell various functions what to do. Not all of these are meaningful
@@ -182,7 +189,7 @@ typedef struct xfs_qoff_logformat {
182#define XFS_QMOPT_DQLOCK 0x0000001 /* dqlock */ 189#define XFS_QMOPT_DQLOCK 0x0000001 /* dqlock */
183#define XFS_QMOPT_DQALLOC 0x0000002 /* alloc dquot ondisk if needed */ 190#define XFS_QMOPT_DQALLOC 0x0000002 /* alloc dquot ondisk if needed */
184#define XFS_QMOPT_UQUOTA 0x0000004 /* user dquot requested */ 191#define XFS_QMOPT_UQUOTA 0x0000004 /* user dquot requested */
185#define XFS_QMOPT_GQUOTA 0x0000008 /* group dquot requested */ 192#define XFS_QMOPT_PQUOTA 0x0000008 /* project dquot requested */
186#define XFS_QMOPT_FORCE_RES 0x0000010 /* ignore quota limits */ 193#define XFS_QMOPT_FORCE_RES 0x0000010 /* ignore quota limits */
187#define XFS_QMOPT_DQSUSER 0x0000020 /* don't cache super users dquot */ 194#define XFS_QMOPT_DQSUSER 0x0000020 /* don't cache super users dquot */
188#define XFS_QMOPT_SBVERSION 0x0000040 /* change superblock version num */ 195#define XFS_QMOPT_SBVERSION 0x0000040 /* change superblock version num */
@@ -192,6 +199,7 @@ typedef struct xfs_qoff_logformat {
192#define XFS_QMOPT_DOWARN 0x0000400 /* increase warning cnt if necessary */ 199#define XFS_QMOPT_DOWARN 0x0000400 /* increase warning cnt if necessary */
193#define XFS_QMOPT_ILOCKED 0x0000800 /* inode is already locked (excl) */ 200#define XFS_QMOPT_ILOCKED 0x0000800 /* inode is already locked (excl) */
194#define XFS_QMOPT_DQREPAIR 0x0001000 /* repair dquot, if damaged. */ 201#define XFS_QMOPT_DQREPAIR 0x0001000 /* repair dquot, if damaged. */
202#define XFS_QMOPT_GQUOTA 0x0002000 /* group dquot requested */
195 203
196/* 204/*
197 * flags to xfs_trans_mod_dquot to indicate which field needs to be 205 * flags to xfs_trans_mod_dquot to indicate which field needs to be
@@ -231,7 +239,8 @@ typedef struct xfs_qoff_logformat {
231#define XFS_TRANS_DQ_DELRTBCOUNT XFS_QMOPT_DELRTBCOUNT 239#define XFS_TRANS_DQ_DELRTBCOUNT XFS_QMOPT_DELRTBCOUNT
232 240
233 241
234#define XFS_QMOPT_QUOTALL (XFS_QMOPT_UQUOTA|XFS_QMOPT_GQUOTA) 242#define XFS_QMOPT_QUOTALL \
243 (XFS_QMOPT_UQUOTA | XFS_QMOPT_PQUOTA | XFS_QMOPT_GQUOTA)
235#define XFS_QMOPT_RESBLK_MASK (XFS_QMOPT_RES_REGBLKS | XFS_QMOPT_RES_RTBLKS) 244#define XFS_QMOPT_RESBLK_MASK (XFS_QMOPT_RES_REGBLKS | XFS_QMOPT_RES_RTBLKS)
236 245
237#ifdef __KERNEL__ 246#ifdef __KERNEL__
@@ -246,21 +255,33 @@ typedef struct xfs_qoff_logformat {
246 */ 255 */
247#define XFS_NOT_DQATTACHED(mp, ip) ((XFS_IS_UQUOTA_ON(mp) &&\ 256#define XFS_NOT_DQATTACHED(mp, ip) ((XFS_IS_UQUOTA_ON(mp) &&\
248 (ip)->i_udquot == NULL) || \ 257 (ip)->i_udquot == NULL) || \
249 (XFS_IS_GQUOTA_ON(mp) && \ 258 (XFS_IS_OQUOTA_ON(mp) && \
250 (ip)->i_gdquot == NULL)) 259 (ip)->i_gdquot == NULL))
251 260
252#define XFS_QM_NEED_QUOTACHECK(mp) ((XFS_IS_UQUOTA_ON(mp) && \ 261#define XFS_QM_NEED_QUOTACHECK(mp) \
253 (mp->m_sb.sb_qflags & \ 262 ((XFS_IS_UQUOTA_ON(mp) && \
254 XFS_UQUOTA_CHKD) == 0) || \ 263 (mp->m_sb.sb_qflags & XFS_UQUOTA_CHKD) == 0) || \
255 (XFS_IS_GQUOTA_ON(mp) && \ 264 (XFS_IS_GQUOTA_ON(mp) && \
256 (mp->m_sb.sb_qflags & \ 265 ((mp->m_sb.sb_qflags & XFS_OQUOTA_CHKD) == 0 || \
257 XFS_GQUOTA_CHKD) == 0)) 266 (mp->m_sb.sb_qflags & XFS_PQUOTA_ACCT))) || \
267 (XFS_IS_PQUOTA_ON(mp) && \
268 ((mp->m_sb.sb_qflags & XFS_OQUOTA_CHKD) == 0 || \
269 (mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT))))
270
271#define XFS_MOUNT_QUOTA_SET1 (XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD|\
272 XFS_UQUOTA_CHKD|XFS_PQUOTA_ACCT|\
273 XFS_OQUOTA_ENFD|XFS_OQUOTA_CHKD)
274
275#define XFS_MOUNT_QUOTA_SET2 (XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD|\
276 XFS_UQUOTA_CHKD|XFS_GQUOTA_ACCT|\
277 XFS_OQUOTA_ENFD|XFS_OQUOTA_CHKD)
258 278
259#define XFS_MOUNT_QUOTA_ALL (XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD|\ 279#define XFS_MOUNT_QUOTA_ALL (XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD|\
260 XFS_UQUOTA_CHKD|XFS_GQUOTA_ACCT|\ 280 XFS_UQUOTA_CHKD|XFS_PQUOTA_ACCT|\
261 XFS_GQUOTA_ENFD|XFS_GQUOTA_CHKD) 281 XFS_OQUOTA_ENFD|XFS_OQUOTA_CHKD|\
282 XFS_GQUOTA_ACCT)
262#define XFS_MOUNT_QUOTA_MASK (XFS_MOUNT_QUOTA_ALL | XFS_UQUOTA_ACTIVE | \ 283#define XFS_MOUNT_QUOTA_MASK (XFS_MOUNT_QUOTA_ALL | XFS_UQUOTA_ACTIVE | \
263 XFS_GQUOTA_ACTIVE) 284 XFS_GQUOTA_ACTIVE | XFS_PQUOTA_ACTIVE)
264 285
265 286
266/* 287/*
@@ -331,15 +352,8 @@ typedef struct xfs_dqtrxops {
331#define XFS_TRANS_UNRESERVE_AND_MOD_DQUOTS(mp, tp) \ 352#define XFS_TRANS_UNRESERVE_AND_MOD_DQUOTS(mp, tp) \
332 XFS_DQTRXOP_VOID(mp, tp, qo_unreserve_and_mod_dquots) 353 XFS_DQTRXOP_VOID(mp, tp, qo_unreserve_and_mod_dquots)
333 354
334#define XFS_TRANS_RESERVE_BLKQUOTA(mp, tp, ip, nblks) \ 355#define XFS_TRANS_UNRESERVE_QUOTA_NBLKS(mp, tp, ip, nblks, ninos, flags) \
335 XFS_TRANS_RESERVE_QUOTA_NBLKS(mp, tp, ip, nblks, 0, \ 356 XFS_TRANS_RESERVE_QUOTA_NBLKS(mp, tp, ip, -(nblks), -(ninos), flags)
336 XFS_QMOPT_RES_REGBLKS)
337#define XFS_TRANS_RESERVE_BLKQUOTA_FORCE(mp, tp, ip, nblks) \
338 XFS_TRANS_RESERVE_QUOTA_NBLKS(mp, tp, ip, nblks, 0, \
339 XFS_QMOPT_RES_REGBLKS | XFS_QMOPT_FORCE_RES)
340#define XFS_TRANS_UNRESERVE_BLKQUOTA(mp, tp, ip, nblks) \
341 XFS_TRANS_RESERVE_QUOTA_NBLKS(mp, tp, ip, -(nblks), 0, \
342 XFS_QMOPT_RES_REGBLKS)
343#define XFS_TRANS_RESERVE_QUOTA(mp, tp, ud, gd, nb, ni, f) \ 357#define XFS_TRANS_RESERVE_QUOTA(mp, tp, ud, gd, nb, ni, f) \
344 XFS_TRANS_RESERVE_QUOTA_BYDQUOTS(mp, tp, ud, gd, nb, ni, \ 358 XFS_TRANS_RESERVE_QUOTA_BYDQUOTS(mp, tp, ud, gd, nb, ni, \
345 f | XFS_QMOPT_RES_REGBLKS) 359 f | XFS_QMOPT_RES_REGBLKS)
diff --git a/fs/xfs/xfs_rename.c b/fs/xfs/xfs_rename.c
index cb13f9a1d45b..23b48ac1cb7e 100644
--- a/fs/xfs/xfs_rename.c
+++ b/fs/xfs/xfs_rename.c
@@ -234,9 +234,6 @@ xfs_lock_for_rename(
234 return 0; 234 return 0;
235} 235}
236 236
237
238int rename_which_error_return = 0;
239
240/* 237/*
241 * xfs_rename 238 * xfs_rename
242 */ 239 */
@@ -316,7 +313,6 @@ xfs_rename(
316 &num_inodes); 313 &num_inodes);
317 314
318 if (error) { 315 if (error) {
319 rename_which_error_return = __LINE__;
320 /* 316 /*
321 * We have nothing locked, no inode references, and 317 * We have nothing locked, no inode references, and
322 * no transaction, so just get out. 318 * no transaction, so just get out.
@@ -332,7 +328,6 @@ xfs_rename(
332 */ 328 */
333 if (target_ip == NULL && (src_dp != target_dp) && 329 if (target_ip == NULL && (src_dp != target_dp) &&
334 target_dp->i_d.di_nlink >= XFS_MAXLINK) { 330 target_dp->i_d.di_nlink >= XFS_MAXLINK) {
335 rename_which_error_return = __LINE__;
336 error = XFS_ERROR(EMLINK); 331 error = XFS_ERROR(EMLINK);
337 xfs_rename_unlock4(inodes, XFS_ILOCK_SHARED); 332 xfs_rename_unlock4(inodes, XFS_ILOCK_SHARED);
338 goto rele_return; 333 goto rele_return;
@@ -359,7 +354,6 @@ xfs_rename(
359 XFS_TRANS_PERM_LOG_RES, XFS_RENAME_LOG_COUNT); 354 XFS_TRANS_PERM_LOG_RES, XFS_RENAME_LOG_COUNT);
360 } 355 }
361 if (error) { 356 if (error) {
362 rename_which_error_return = __LINE__;
363 xfs_trans_cancel(tp, 0); 357 xfs_trans_cancel(tp, 0);
364 goto rele_return; 358 goto rele_return;
365 } 359 }
@@ -369,7 +363,6 @@ xfs_rename(
369 */ 363 */
370 if ((error = XFS_QM_DQVOPRENAME(mp, inodes))) { 364 if ((error = XFS_QM_DQVOPRENAME(mp, inodes))) {
371 xfs_trans_cancel(tp, cancel_flags); 365 xfs_trans_cancel(tp, cancel_flags);
372 rename_which_error_return = __LINE__;
373 goto rele_return; 366 goto rele_return;
374 } 367 }
375 368
@@ -413,7 +406,6 @@ xfs_rename(
413 if (spaceres == 0 && 406 if (spaceres == 0 &&
414 (error = XFS_DIR_CANENTER(mp, tp, target_dp, target_name, 407 (error = XFS_DIR_CANENTER(mp, tp, target_dp, target_name,
415 target_namelen))) { 408 target_namelen))) {
416 rename_which_error_return = __LINE__;
417 goto error_return; 409 goto error_return;
418 } 410 }
419 /* 411 /*
@@ -425,11 +417,9 @@ xfs_rename(
425 target_namelen, src_ip->i_ino, 417 target_namelen, src_ip->i_ino,
426 &first_block, &free_list, spaceres); 418 &first_block, &free_list, spaceres);
427 if (error == ENOSPC) { 419 if (error == ENOSPC) {
428 rename_which_error_return = __LINE__;
429 goto error_return; 420 goto error_return;
430 } 421 }
431 if (error) { 422 if (error) {
432 rename_which_error_return = __LINE__;
433 goto abort_return; 423 goto abort_return;
434 } 424 }
435 xfs_ichgtime(target_dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); 425 xfs_ichgtime(target_dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
@@ -437,7 +427,6 @@ xfs_rename(
437 if (new_parent && src_is_directory) { 427 if (new_parent && src_is_directory) {
438 error = xfs_bumplink(tp, target_dp); 428 error = xfs_bumplink(tp, target_dp);
439 if (error) { 429 if (error) {
440 rename_which_error_return = __LINE__;
441 goto abort_return; 430 goto abort_return;
442 } 431 }
443 } 432 }
@@ -455,7 +444,6 @@ xfs_rename(
455 if (!(XFS_DIR_ISEMPTY(target_ip->i_mount, target_ip)) || 444 if (!(XFS_DIR_ISEMPTY(target_ip->i_mount, target_ip)) ||
456 (target_ip->i_d.di_nlink > 2)) { 445 (target_ip->i_d.di_nlink > 2)) {
457 error = XFS_ERROR(EEXIST); 446 error = XFS_ERROR(EEXIST);
458 rename_which_error_return = __LINE__;
459 goto error_return; 447 goto error_return;
460 } 448 }
461 } 449 }
@@ -473,7 +461,6 @@ xfs_rename(
473 target_namelen, src_ip->i_ino, &first_block, 461 target_namelen, src_ip->i_ino, &first_block,
474 &free_list, spaceres); 462 &free_list, spaceres);
475 if (error) { 463 if (error) {
476 rename_which_error_return = __LINE__;
477 goto abort_return; 464 goto abort_return;
478 } 465 }
479 xfs_ichgtime(target_dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); 466 xfs_ichgtime(target_dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
@@ -484,7 +471,6 @@ xfs_rename(
484 */ 471 */
485 error = xfs_droplink(tp, target_ip); 472 error = xfs_droplink(tp, target_ip);
486 if (error) { 473 if (error) {
487 rename_which_error_return = __LINE__;
488 goto abort_return; 474 goto abort_return;
489 } 475 }
490 target_ip_dropped = 1; 476 target_ip_dropped = 1;
@@ -495,7 +481,6 @@ xfs_rename(
495 */ 481 */
496 error = xfs_droplink(tp, target_ip); 482 error = xfs_droplink(tp, target_ip);
497 if (error) { 483 if (error) {
498 rename_which_error_return = __LINE__;
499 goto abort_return; 484 goto abort_return;
500 } 485 }
501 } 486 }
@@ -519,7 +504,6 @@ xfs_rename(
519 &free_list, spaceres); 504 &free_list, spaceres);
520 ASSERT(error != EEXIST); 505 ASSERT(error != EEXIST);
521 if (error) { 506 if (error) {
522 rename_which_error_return = __LINE__;
523 goto abort_return; 507 goto abort_return;
524 } 508 }
525 xfs_ichgtime(src_ip, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); 509 xfs_ichgtime(src_ip, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
@@ -550,7 +534,6 @@ xfs_rename(
550 */ 534 */
551 error = xfs_droplink(tp, src_dp); 535 error = xfs_droplink(tp, src_dp);
552 if (error) { 536 if (error) {
553 rename_which_error_return = __LINE__;
554 goto abort_return; 537 goto abort_return;
555 } 538 }
556 } 539 }
@@ -558,7 +541,6 @@ xfs_rename(
558 error = XFS_DIR_REMOVENAME(mp, tp, src_dp, src_name, src_namelen, 541 error = XFS_DIR_REMOVENAME(mp, tp, src_dp, src_name, src_namelen,
559 src_ip->i_ino, &first_block, &free_list, spaceres); 542 src_ip->i_ino, &first_block, &free_list, spaceres);
560 if (error) { 543 if (error) {
561 rename_which_error_return = __LINE__;
562 goto abort_return; 544 goto abort_return;
563 } 545 }
564 xfs_ichgtime(src_dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); 546 xfs_ichgtime(src_dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
index 3db0e2200775..06dfca531f79 100644
--- a/fs/xfs/xfs_trans.c
+++ b/fs/xfs/xfs_trans.c
@@ -332,25 +332,6 @@ undo_blocks:
332 332
333 333
334/* 334/*
335 * This is called to set the a callback to be called when the given
336 * transaction is committed to disk. The transaction pointer and the
337 * argument pointer will be passed to the callback routine.
338 *
339 * Only one callback can be associated with any single transaction.
340 */
341void
342xfs_trans_callback(
343 xfs_trans_t *tp,
344 xfs_trans_callback_t callback,
345 void *arg)
346{
347 ASSERT(tp->t_callback == NULL);
348 tp->t_callback = callback;
349 tp->t_callarg = arg;
350}
351
352
353/*
354 * Record the indicated change to the given field for application 335 * Record the indicated change to the given field for application
355 * to the file system's superblock when the transaction commits. 336 * to the file system's superblock when the transaction commits.
356 * For now, just store the change in the transaction structure. 337 * For now, just store the change in the transaction structure.
@@ -551,7 +532,7 @@ xfs_trans_apply_sb_deltas(
551 * 532 *
552 * This is done efficiently with a single call to xfs_mod_incore_sb_batch(). 533 * This is done efficiently with a single call to xfs_mod_incore_sb_batch().
553 */ 534 */
554void 535STATIC void
555xfs_trans_unreserve_and_mod_sb( 536xfs_trans_unreserve_and_mod_sb(
556 xfs_trans_t *tp) 537 xfs_trans_t *tp)
557{ 538{
diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h
index bd37ccb85e76..ec541d66fa2a 100644
--- a/fs/xfs/xfs_trans.h
+++ b/fs/xfs/xfs_trans.h
@@ -987,8 +987,6 @@ xfs_trans_t *_xfs_trans_alloc(struct xfs_mount *, uint);
987xfs_trans_t *xfs_trans_dup(xfs_trans_t *); 987xfs_trans_t *xfs_trans_dup(xfs_trans_t *);
988int xfs_trans_reserve(xfs_trans_t *, uint, uint, uint, 988int xfs_trans_reserve(xfs_trans_t *, uint, uint, uint,
989 uint, uint); 989 uint, uint);
990void xfs_trans_callback(xfs_trans_t *,
991 void (*)(xfs_trans_t *, void *), void *);
992void xfs_trans_mod_sb(xfs_trans_t *, uint, long); 990void xfs_trans_mod_sb(xfs_trans_t *, uint, long);
993struct xfs_buf *xfs_trans_get_buf(xfs_trans_t *, struct xfs_buftarg *, xfs_daddr_t, 991struct xfs_buf *xfs_trans_get_buf(xfs_trans_t *, struct xfs_buftarg *, xfs_daddr_t,
994 int, uint); 992 int, uint);
@@ -1010,7 +1008,6 @@ int xfs_trans_iget(struct xfs_mount *, xfs_trans_t *,
1010 xfs_ino_t , uint, uint, struct xfs_inode **); 1008 xfs_ino_t , uint, uint, struct xfs_inode **);
1011void xfs_trans_ijoin(xfs_trans_t *, struct xfs_inode *, uint); 1009void xfs_trans_ijoin(xfs_trans_t *, struct xfs_inode *, uint);
1012void xfs_trans_ihold(xfs_trans_t *, struct xfs_inode *); 1010void xfs_trans_ihold(xfs_trans_t *, struct xfs_inode *);
1013void xfs_trans_ihold_release(xfs_trans_t *, struct xfs_inode *);
1014void xfs_trans_log_buf(xfs_trans_t *, struct xfs_buf *, uint, uint); 1011void xfs_trans_log_buf(xfs_trans_t *, struct xfs_buf *, uint, uint);
1015void xfs_trans_log_inode(xfs_trans_t *, struct xfs_inode *, uint); 1012void xfs_trans_log_inode(xfs_trans_t *, struct xfs_inode *, uint);
1016struct xfs_efi_log_item *xfs_trans_get_efi(xfs_trans_t *, uint); 1013struct xfs_efi_log_item *xfs_trans_get_efi(xfs_trans_t *, uint);
diff --git a/fs/xfs/xfs_trans_buf.c b/fs/xfs/xfs_trans_buf.c
index a9682b9510c1..144da7a85466 100644
--- a/fs/xfs/xfs_trans_buf.c
+++ b/fs/xfs/xfs_trans_buf.c
@@ -976,6 +976,7 @@ xfs_trans_dquot_buf(
976 ASSERT(XFS_BUF_FSPRIVATE2(bp, xfs_trans_t *) == tp); 976 ASSERT(XFS_BUF_FSPRIVATE2(bp, xfs_trans_t *) == tp);
977 ASSERT(XFS_BUF_FSPRIVATE(bp, void *) != NULL); 977 ASSERT(XFS_BUF_FSPRIVATE(bp, void *) != NULL);
978 ASSERT(type == XFS_BLI_UDQUOT_BUF || 978 ASSERT(type == XFS_BLI_UDQUOT_BUF ||
979 type == XFS_BLI_PDQUOT_BUF ||
979 type == XFS_BLI_GDQUOT_BUF); 980 type == XFS_BLI_GDQUOT_BUF);
980 981
981 bip = XFS_BUF_FSPRIVATE(bp, xfs_buf_log_item_t *); 982 bip = XFS_BUF_FSPRIVATE(bp, xfs_buf_log_item_t *);
diff --git a/fs/xfs/xfs_trans_inode.c b/fs/xfs/xfs_trans_inode.c
index e2c3706f453d..7e7631ca4979 100644
--- a/fs/xfs/xfs_trans_inode.c
+++ b/fs/xfs/xfs_trans_inode.c
@@ -253,24 +253,6 @@ xfs_trans_ihold(
253 ip->i_itemp->ili_flags |= XFS_ILI_HOLD; 253 ip->i_itemp->ili_flags |= XFS_ILI_HOLD;
254} 254}
255 255
256/*
257 * Cancel the previous inode hold request made on this inode
258 * for this transaction.
259 */
260/*ARGSUSED*/
261void
262xfs_trans_ihold_release(
263 xfs_trans_t *tp,
264 xfs_inode_t *ip)
265{
266 ASSERT(ip->i_transp == tp);
267 ASSERT(ip->i_itemp != NULL);
268 ASSERT(ismrlocked(&ip->i_lock, MR_UPDATE));
269 ASSERT(ip->i_itemp->ili_flags & XFS_ILI_HOLD);
270
271 ip->i_itemp->ili_flags &= ~XFS_ILI_HOLD;
272}
273
274 256
275/* 257/*
276 * This is called to mark the fields indicated in fieldmask as needing 258 * This is called to mark the fields indicated in fieldmask as needing
diff --git a/fs/xfs/xfs_types.h b/fs/xfs/xfs_types.h
index e4bf711e48ff..16f5371ce102 100644
--- a/fs/xfs/xfs_types.h
+++ b/fs/xfs/xfs_types.h
@@ -55,7 +55,7 @@ typedef signed long long int __int64_t;
55typedef unsigned long long int __uint64_t; 55typedef unsigned long long int __uint64_t;
56 56
57typedef enum { B_FALSE,B_TRUE } boolean_t; 57typedef enum { B_FALSE,B_TRUE } boolean_t;
58typedef __int64_t prid_t; /* project ID */ 58typedef __uint32_t prid_t; /* project ID */
59typedef __uint32_t inst_t; /* an instruction */ 59typedef __uint32_t inst_t; /* an instruction */
60 60
61typedef __s64 xfs_off_t; /* <file offset> type */ 61typedef __s64 xfs_off_t; /* <file offset> type */
diff --git a/fs/xfs/xfs_utils.c b/fs/xfs/xfs_utils.c
index d1f8146a06ea..11351f08d438 100644
--- a/fs/xfs/xfs_utils.c
+++ b/fs/xfs/xfs_utils.c
@@ -428,7 +428,7 @@ xfs_truncate_file(
428 if (ip->i_ino != mp->m_sb.sb_uquotino) 428 if (ip->i_ino != mp->m_sb.sb_uquotino)
429 ASSERT(ip->i_udquot); 429 ASSERT(ip->i_udquot);
430 } 430 }
431 if (XFS_IS_GQUOTA_ON(mp)) { 431 if (XFS_IS_OQUOTA_ON(mp)) {
432 if (ip->i_ino != mp->m_sb.sb_gquotino) 432 if (ip->i_ino != mp->m_sb.sb_gquotino)
433 ASSERT(ip->i_gdquot); 433 ASSERT(ip->i_gdquot);
434 } 434 }
diff --git a/fs/xfs/xfs_vfsops.c b/fs/xfs/xfs_vfsops.c
index b53736650100..42bcc0215203 100644
--- a/fs/xfs/xfs_vfsops.c
+++ b/fs/xfs/xfs_vfsops.c
@@ -368,16 +368,6 @@ xfs_finish_flags(
368 } 368 }
369 369
370 /* 370 /*
371 * disallow mount attempts with (IRIX) project quota enabled
372 */
373 if (XFS_SB_VERSION_HASQUOTA(&mp->m_sb) &&
374 (mp->m_sb.sb_qflags & XFS_PQUOTA_ACCT)) {
375 cmn_err(CE_WARN,
376 "XFS: cannot mount a filesystem with IRIX project quota enabled");
377 return XFS_ERROR(ENOSYS);
378 }
379
380 /*
381 * check for shared mount. 371 * check for shared mount.
382 */ 372 */
383 if (ap->flags & XFSMNT_SHARED) { 373 if (ap->flags & XFSMNT_SHARED) {
@@ -622,7 +612,34 @@ out:
622 return XFS_ERROR(error); 612 return XFS_ERROR(error);
623} 613}
624 614
625#define REMOUNT_READONLY_FLAGS (SYNC_REMOUNT|SYNC_ATTR|SYNC_WAIT) 615STATIC int
616xfs_quiesce_fs(
617 xfs_mount_t *mp)
618{
619 int count = 0, pincount;
620
621 xfs_refcache_purge_mp(mp);
622 xfs_flush_buftarg(mp->m_ddev_targp, 0);
623 xfs_finish_reclaim_all(mp, 0);
624
625 /* This loop must run at least twice.
626 * The first instance of the loop will flush
627 * most meta data but that will generate more
628 * meta data (typically directory updates).
629 * Which then must be flushed and logged before
630 * we can write the unmount record.
631 */
632 do {
633 xfs_syncsub(mp, SYNC_REMOUNT|SYNC_ATTR|SYNC_WAIT, 0, NULL);
634 pincount = xfs_flush_buftarg(mp->m_ddev_targp, 1);
635 if (!pincount) {
636 delay(50);
637 count++;
638 }
639 } while (count < 2);
640
641 return 0;
642}
626 643
627STATIC int 644STATIC int
628xfs_mntupdate( 645xfs_mntupdate(
@@ -632,8 +649,7 @@ xfs_mntupdate(
632{ 649{
633 struct vfs *vfsp = bhvtovfs(bdp); 650 struct vfs *vfsp = bhvtovfs(bdp);
634 xfs_mount_t *mp = XFS_BHVTOM(bdp); 651 xfs_mount_t *mp = XFS_BHVTOM(bdp);
635 int pincount, error; 652 int error;
636 int count = 0;
637 653
638 if (args->flags & XFSMNT_NOATIME) 654 if (args->flags & XFSMNT_NOATIME)
639 mp->m_flags |= XFS_MOUNT_NOATIME; 655 mp->m_flags |= XFS_MOUNT_NOATIME;
@@ -645,25 +661,7 @@ xfs_mntupdate(
645 } 661 }
646 662
647 if (*flags & MS_RDONLY) { 663 if (*flags & MS_RDONLY) {
648 xfs_refcache_purge_mp(mp); 664 xfs_quiesce_fs(mp);
649 xfs_flush_buftarg(mp->m_ddev_targp, 0);
650 xfs_finish_reclaim_all(mp, 0);
651
652 /* This loop must run at least twice.
653 * The first instance of the loop will flush
654 * most meta data but that will generate more
655 * meta data (typically directory updates).
656 * Which then must be flushed and logged before
657 * we can write the unmount record.
658 */
659 do {
660 VFS_SYNC(vfsp, REMOUNT_READONLY_FLAGS, NULL, error);
661 pincount = xfs_flush_buftarg(mp->m_ddev_targp, 1);
662 if (!pincount) {
663 delay(50);
664 count++;
665 }
666 } while (count < 2);
667 665
668 /* Ok now write out an unmount record */ 666 /* Ok now write out an unmount record */
669 xfs_log_unmount_write(mp); 667 xfs_log_unmount_write(mp);
@@ -879,10 +877,12 @@ xfs_sync(
879 int flags, 877 int flags,
880 cred_t *credp) 878 cred_t *credp)
881{ 879{
882 xfs_mount_t *mp; 880 xfs_mount_t *mp = XFS_BHVTOM(bdp);
883 881
884 mp = XFS_BHVTOM(bdp); 882 if (unlikely(flags == SYNC_QUIESCE))
885 return (xfs_syncsub(mp, flags, 0, NULL)); 883 return xfs_quiesce_fs(mp);
884 else
885 return xfs_syncsub(mp, flags, 0, NULL);
886} 886}
887 887
888/* 888/*
@@ -1681,7 +1681,7 @@ suffix_strtoul(const char *cp, char **endp, unsigned int base)
1681 return simple_strtoul(cp, endp, base) << shift_left_factor; 1681 return simple_strtoul(cp, endp, base) << shift_left_factor;
1682} 1682}
1683 1683
1684int 1684STATIC int
1685xfs_parseargs( 1685xfs_parseargs(
1686 struct bhv_desc *bhv, 1686 struct bhv_desc *bhv,
1687 char *options, 1687 char *options,
@@ -1867,7 +1867,7 @@ printk("XFS: irixsgid is now a sysctl(2) variable, option is deprecated.\n");
1867 return 0; 1867 return 0;
1868} 1868}
1869 1869
1870int 1870STATIC int
1871xfs_showargs( 1871xfs_showargs(
1872 struct bhv_desc *bhv, 1872 struct bhv_desc *bhv,
1873 struct seq_file *m) 1873 struct seq_file *m)
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index 25a526629b12..1377c868f3f4 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved. 2 * Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License as 5 * under the terms of version 2 of the GNU General Public License as
@@ -351,21 +351,28 @@ xfs_setattr(
351 * If the IDs do change before we take the ilock, we're covered 351 * If the IDs do change before we take the ilock, we're covered
352 * because the i_*dquot fields will get updated anyway. 352 * because the i_*dquot fields will get updated anyway.
353 */ 353 */
354 if (XFS_IS_QUOTA_ON(mp) && (mask & (XFS_AT_UID|XFS_AT_GID))) { 354 if (XFS_IS_QUOTA_ON(mp) &&
355 (mask & (XFS_AT_UID|XFS_AT_GID|XFS_AT_PROJID))) {
355 uint qflags = 0; 356 uint qflags = 0;
356 357
357 if (mask & XFS_AT_UID) { 358 if ((mask & XFS_AT_UID) && XFS_IS_UQUOTA_ON(mp)) {
358 uid = vap->va_uid; 359 uid = vap->va_uid;
359 qflags |= XFS_QMOPT_UQUOTA; 360 qflags |= XFS_QMOPT_UQUOTA;
360 } else { 361 } else {
361 uid = ip->i_d.di_uid; 362 uid = ip->i_d.di_uid;
362 } 363 }
363 if (mask & XFS_AT_GID) { 364 if ((mask & XFS_AT_GID) && XFS_IS_GQUOTA_ON(mp)) {
364 gid = vap->va_gid; 365 gid = vap->va_gid;
365 qflags |= XFS_QMOPT_GQUOTA; 366 qflags |= XFS_QMOPT_GQUOTA;
366 } else { 367 } else {
367 gid = ip->i_d.di_gid; 368 gid = ip->i_d.di_gid;
368 } 369 }
370 if ((mask & XFS_AT_PROJID) && XFS_IS_PQUOTA_ON(mp)) {
371 projid = vap->va_projid;
372 qflags |= XFS_QMOPT_PQUOTA;
373 } else {
374 projid = ip->i_d.di_projid;
375 }
369 /* 376 /*
370 * We take a reference when we initialize udqp and gdqp, 377 * We take a reference when we initialize udqp and gdqp,
371 * so it is important that we never blindly double trip on 378 * so it is important that we never blindly double trip on
@@ -373,7 +380,8 @@ xfs_setattr(
373 */ 380 */
374 ASSERT(udqp == NULL); 381 ASSERT(udqp == NULL);
375 ASSERT(gdqp == NULL); 382 ASSERT(gdqp == NULL);
376 code = XFS_QM_DQVOPALLOC(mp, ip, uid,gid, qflags, &udqp, &gdqp); 383 code = XFS_QM_DQVOPALLOC(mp, ip, uid, gid, projid, qflags,
384 &udqp, &gdqp);
377 if (code) 385 if (code)
378 return (code); 386 return (code);
379 } 387 }
@@ -499,8 +507,6 @@ xfs_setattr(
499 * that the group ID supplied to the chown() function 507 * that the group ID supplied to the chown() function
500 * shall be equal to either the group ID or one of the 508 * shall be equal to either the group ID or one of the
501 * supplementary group IDs of the calling process. 509 * supplementary group IDs of the calling process.
502 *
503 * XXX: How does restricted_chown affect projid?
504 */ 510 */
505 if (restricted_chown && 511 if (restricted_chown &&
506 (iuid != uid || (igid != gid && 512 (iuid != uid || (igid != gid &&
@@ -510,10 +516,11 @@ xfs_setattr(
510 goto error_return; 516 goto error_return;
511 } 517 }
512 /* 518 /*
513 * Do a quota reservation only if uid or gid is actually 519 * Do a quota reservation only if uid/projid/gid is actually
514 * going to change. 520 * going to change.
515 */ 521 */
516 if ((XFS_IS_UQUOTA_ON(mp) && iuid != uid) || 522 if ((XFS_IS_UQUOTA_ON(mp) && iuid != uid) ||
523 (XFS_IS_PQUOTA_ON(mp) && iprojid != projid) ||
517 (XFS_IS_GQUOTA_ON(mp) && igid != gid)) { 524 (XFS_IS_GQUOTA_ON(mp) && igid != gid)) {
518 ASSERT(tp); 525 ASSERT(tp);
519 code = XFS_QM_DQVOPCHOWNRESV(mp, tp, ip, udqp, gdqp, 526 code = XFS_QM_DQVOPCHOWNRESV(mp, tp, ip, udqp, gdqp,
@@ -774,6 +781,7 @@ xfs_setattr(
774 } 781 }
775 if (igid != gid) { 782 if (igid != gid) {
776 if (XFS_IS_GQUOTA_ON(mp)) { 783 if (XFS_IS_GQUOTA_ON(mp)) {
784 ASSERT(!XFS_IS_PQUOTA_ON(mp));
777 ASSERT(mask & XFS_AT_GID); 785 ASSERT(mask & XFS_AT_GID);
778 ASSERT(gdqp); 786 ASSERT(gdqp);
779 olddquot2 = XFS_QM_DQVOPCHOWN(mp, tp, ip, 787 olddquot2 = XFS_QM_DQVOPCHOWN(mp, tp, ip,
@@ -782,6 +790,13 @@ xfs_setattr(
782 ip->i_d.di_gid = gid; 790 ip->i_d.di_gid = gid;
783 } 791 }
784 if (iprojid != projid) { 792 if (iprojid != projid) {
793 if (XFS_IS_PQUOTA_ON(mp)) {
794 ASSERT(!XFS_IS_GQUOTA_ON(mp));
795 ASSERT(mask & XFS_AT_PROJID);
796 ASSERT(gdqp);
797 olddquot2 = XFS_QM_DQVOPCHOWN(mp, tp, ip,
798 &ip->i_gdquot, gdqp);
799 }
785 ip->i_d.di_projid = projid; 800 ip->i_d.di_projid = projid;
786 /* 801 /*
787 * We may have to rev the inode as well as 802 * We may have to rev the inode as well as
@@ -843,6 +858,8 @@ xfs_setattr(
843 di_flags |= XFS_DIFLAG_NOATIME; 858 di_flags |= XFS_DIFLAG_NOATIME;
844 if (vap->va_xflags & XFS_XFLAG_NODUMP) 859 if (vap->va_xflags & XFS_XFLAG_NODUMP)
845 di_flags |= XFS_DIFLAG_NODUMP; 860 di_flags |= XFS_DIFLAG_NODUMP;
861 if (vap->va_xflags & XFS_XFLAG_PROJINHERIT)
862 di_flags |= XFS_DIFLAG_PROJINHERIT;
846 if ((ip->i_d.di_mode & S_IFMT) == S_IFDIR) { 863 if ((ip->i_d.di_mode & S_IFMT) == S_IFDIR) {
847 if (vap->va_xflags & XFS_XFLAG_RTINHERIT) 864 if (vap->va_xflags & XFS_XFLAG_RTINHERIT)
848 di_flags |= XFS_DIFLAG_RTINHERIT; 865 di_flags |= XFS_DIFLAG_RTINHERIT;
@@ -1898,7 +1915,9 @@ xfs_create(
1898 /* Return through std_return after this point. */ 1915 /* Return through std_return after this point. */
1899 1916
1900 udqp = gdqp = NULL; 1917 udqp = gdqp = NULL;
1901 if (vap->va_mask & XFS_AT_PROJID) 1918 if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT)
1919 prid = dp->i_d.di_projid;
1920 else if (vap->va_mask & XFS_AT_PROJID)
1902 prid = (xfs_prid_t)vap->va_projid; 1921 prid = (xfs_prid_t)vap->va_projid;
1903 else 1922 else
1904 prid = (xfs_prid_t)dfltprid; 1923 prid = (xfs_prid_t)dfltprid;
@@ -1907,7 +1926,7 @@ xfs_create(
1907 * Make sure that we have allocated dquot(s) on disk. 1926 * Make sure that we have allocated dquot(s) on disk.
1908 */ 1927 */
1909 error = XFS_QM_DQVOPALLOC(mp, dp, 1928 error = XFS_QM_DQVOPALLOC(mp, dp,
1910 current_fsuid(credp), current_fsgid(credp), 1929 current_fsuid(credp), current_fsgid(credp), prid,
1911 XFS_QMOPT_QUOTALL|XFS_QMOPT_INHERIT, &udqp, &gdqp); 1930 XFS_QMOPT_QUOTALL|XFS_QMOPT_INHERIT, &udqp, &gdqp);
1912 if (error) 1931 if (error)
1913 goto std_return; 1932 goto std_return;
@@ -2604,17 +2623,7 @@ xfs_link(
2604 if (src_vp->v_type == VDIR) 2623 if (src_vp->v_type == VDIR)
2605 return XFS_ERROR(EPERM); 2624 return XFS_ERROR(EPERM);
2606 2625
2607 /*
2608 * For now, manually find the XFS behavior descriptor for
2609 * the source vnode. If it doesn't exist then something
2610 * is wrong and we should just return an error.
2611 * Eventually we need to figure out how link is going to
2612 * work in the face of stacked vnodes.
2613 */
2614 src_bdp = vn_bhv_lookup_unlocked(VN_BHV_HEAD(src_vp), &xfs_vnodeops); 2626 src_bdp = vn_bhv_lookup_unlocked(VN_BHV_HEAD(src_vp), &xfs_vnodeops);
2615 if (src_bdp == NULL) {
2616 return XFS_ERROR(EXDEV);
2617 }
2618 sip = XFS_BHVTOI(src_bdp); 2627 sip = XFS_BHVTOI(src_bdp);
2619 tdp = XFS_BHVTOI(target_dir_bdp); 2628 tdp = XFS_BHVTOI(target_dir_bdp);
2620 mp = tdp->i_mount; 2629 mp = tdp->i_mount;
@@ -2681,6 +2690,17 @@ xfs_link(
2681 goto error_return; 2690 goto error_return;
2682 } 2691 }
2683 2692
2693 /*
2694 * If we are using project inheritance, we only allow hard link
2695 * creation in our tree when the project IDs are the same; else
2696 * the tree quota mechanism could be circumvented.
2697 */
2698 if (unlikely((tdp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) &&
2699 (tdp->i_d.di_projid != sip->i_d.di_projid))) {
2700 error = XFS_ERROR(EPERM);
2701 goto error_return;
2702 }
2703
2684 if (resblks == 0 && 2704 if (resblks == 0 &&
2685 (error = XFS_DIR_CANENTER(mp, tp, tdp, target_name, 2705 (error = XFS_DIR_CANENTER(mp, tp, tdp, target_name,
2686 target_namelen))) 2706 target_namelen)))
@@ -2803,7 +2823,9 @@ xfs_mkdir(
2803 2823
2804 mp = dp->i_mount; 2824 mp = dp->i_mount;
2805 udqp = gdqp = NULL; 2825 udqp = gdqp = NULL;
2806 if (vap->va_mask & XFS_AT_PROJID) 2826 if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT)
2827 prid = dp->i_d.di_projid;
2828 else if (vap->va_mask & XFS_AT_PROJID)
2807 prid = (xfs_prid_t)vap->va_projid; 2829 prid = (xfs_prid_t)vap->va_projid;
2808 else 2830 else
2809 prid = (xfs_prid_t)dfltprid; 2831 prid = (xfs_prid_t)dfltprid;
@@ -2812,7 +2834,7 @@ xfs_mkdir(
2812 * Make sure that we have allocated dquot(s) on disk. 2834 * Make sure that we have allocated dquot(s) on disk.
2813 */ 2835 */
2814 error = XFS_QM_DQVOPALLOC(mp, dp, 2836 error = XFS_QM_DQVOPALLOC(mp, dp,
2815 current_fsuid(credp), current_fsgid(credp), 2837 current_fsuid(credp), current_fsgid(credp), prid,
2816 XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, &udqp, &gdqp); 2838 XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, &udqp, &gdqp);
2817 if (error) 2839 if (error)
2818 goto std_return; 2840 goto std_return;
@@ -3357,7 +3379,9 @@ xfs_symlink(
3357 /* Return through std_return after this point. */ 3379 /* Return through std_return after this point. */
3358 3380
3359 udqp = gdqp = NULL; 3381 udqp = gdqp = NULL;
3360 if (vap->va_mask & XFS_AT_PROJID) 3382 if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT)
3383 prid = dp->i_d.di_projid;
3384 else if (vap->va_mask & XFS_AT_PROJID)
3361 prid = (xfs_prid_t)vap->va_projid; 3385 prid = (xfs_prid_t)vap->va_projid;
3362 else 3386 else
3363 prid = (xfs_prid_t)dfltprid; 3387 prid = (xfs_prid_t)dfltprid;
@@ -3366,7 +3390,7 @@ xfs_symlink(
3366 * Make sure that we have allocated dquot(s) on disk. 3390 * Make sure that we have allocated dquot(s) on disk.
3367 */ 3391 */
3368 error = XFS_QM_DQVOPALLOC(mp, dp, 3392 error = XFS_QM_DQVOPALLOC(mp, dp,
3369 current_fsuid(credp), current_fsgid(credp), 3393 current_fsuid(credp), current_fsgid(credp), prid,
3370 XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, &udqp, &gdqp); 3394 XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, &udqp, &gdqp);
3371 if (error) 3395 if (error)
3372 goto std_return; 3396 goto std_return;
@@ -4028,7 +4052,7 @@ xfs_finish_reclaim_all(xfs_mount_t *mp, int noblock)
4028 * errno on error 4052 * errno on error
4029 * 4053 *
4030 */ 4054 */
4031int 4055STATIC int
4032xfs_alloc_file_space( 4056xfs_alloc_file_space(
4033 xfs_inode_t *ip, 4057 xfs_inode_t *ip,
4034 xfs_off_t offset, 4058 xfs_off_t offset,
@@ -4151,9 +4175,8 @@ retry:
4151 break; 4175 break;
4152 } 4176 }
4153 xfs_ilock(ip, XFS_ILOCK_EXCL); 4177 xfs_ilock(ip, XFS_ILOCK_EXCL);
4154 error = XFS_TRANS_RESERVE_QUOTA_BYDQUOTS(mp, tp, 4178 error = XFS_TRANS_RESERVE_QUOTA(mp, tp,
4155 ip->i_udquot, ip->i_gdquot, resblks, 0, rt ? 4179 ip->i_udquot, ip->i_gdquot, resblks, 0, 0);
4156 XFS_QMOPT_RES_RTBLKS : XFS_QMOPT_RES_REGBLKS);
4157 if (error) 4180 if (error)
4158 goto error1; 4181 goto error1;
4159 4182
@@ -4305,6 +4328,7 @@ xfs_free_file_space(
4305 xfs_off_t len, 4328 xfs_off_t len,
4306 int attr_flags) 4329 int attr_flags)
4307{ 4330{
4331 vnode_t *vp;
4308 int committed; 4332 int committed;
4309 int done; 4333 int done;
4310 xfs_off_t end_dmi_offset; 4334 xfs_off_t end_dmi_offset;
@@ -4325,9 +4349,11 @@ xfs_free_file_space(
4325 xfs_trans_t *tp; 4349 xfs_trans_t *tp;
4326 int need_iolock = 1; 4350 int need_iolock = 1;
4327 4351
4328 vn_trace_entry(XFS_ITOV(ip), __FUNCTION__, (inst_t *)__return_address); 4352 vp = XFS_ITOV(ip);
4329 mp = ip->i_mount; 4353 mp = ip->i_mount;
4330 4354
4355 vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
4356
4331 if ((error = XFS_QM_DQATTACH(mp, ip, 0))) 4357 if ((error = XFS_QM_DQATTACH(mp, ip, 0)))
4332 return error; 4358 return error;
4333 4359
@@ -4344,7 +4370,7 @@ xfs_free_file_space(
4344 DM_EVENT_ENABLED(XFS_MTOVFS(mp), ip, DM_EVENT_WRITE)) { 4370 DM_EVENT_ENABLED(XFS_MTOVFS(mp), ip, DM_EVENT_WRITE)) {
4345 if (end_dmi_offset > ip->i_d.di_size) 4371 if (end_dmi_offset > ip->i_d.di_size)
4346 end_dmi_offset = ip->i_d.di_size; 4372 end_dmi_offset = ip->i_d.di_size;
4347 error = XFS_SEND_DATA(mp, DM_EVENT_WRITE, XFS_ITOV(ip), 4373 error = XFS_SEND_DATA(mp, DM_EVENT_WRITE, vp,
4348 offset, end_dmi_offset - offset, 4374 offset, end_dmi_offset - offset,
4349 AT_DELAY_FLAG(attr_flags), NULL); 4375 AT_DELAY_FLAG(attr_flags), NULL);
4350 if (error) 4376 if (error)
@@ -4363,7 +4389,14 @@ xfs_free_file_space(
4363 ioffset = offset & ~(rounding - 1); 4389 ioffset = offset & ~(rounding - 1);
4364 if (ilen & (rounding - 1)) 4390 if (ilen & (rounding - 1))
4365 ilen = (ilen + rounding) & ~(rounding - 1); 4391 ilen = (ilen + rounding) & ~(rounding - 1);
4366 xfs_inval_cached_pages(XFS_ITOV(ip), &(ip->i_iocore), ioffset, 0, 0); 4392
4393 if (VN_CACHED(vp) != 0) {
4394 xfs_inval_cached_trace(&ip->i_iocore, ioffset, -1,
4395 ctooff(offtoct(ioffset)), -1);
4396 VOP_FLUSHINVAL_PAGES(vp, ctooff(offtoct(ioffset)),
4397 -1, FI_REMAPF_LOCKED);
4398 }
4399
4367 /* 4400 /*
4368 * Need to zero the stuff we're not freeing, on disk. 4401 * Need to zero the stuff we're not freeing, on disk.
4369 * If its a realtime file & can't use unwritten extents then we 4402 * If its a realtime file & can't use unwritten extents then we
diff --git a/include/asm-alpha/smp.h b/include/asm-alpha/smp.h
index cbc173ae45aa..9950706abdf8 100644
--- a/include/asm-alpha/smp.h
+++ b/include/asm-alpha/smp.h
@@ -43,7 +43,7 @@ extern struct cpuinfo_alpha cpu_data[NR_CPUS];
43#define PROC_CHANGE_PENALTY 20 43#define PROC_CHANGE_PENALTY 20
44 44
45#define hard_smp_processor_id() __hard_smp_processor_id() 45#define hard_smp_processor_id() __hard_smp_processor_id()
46#define smp_processor_id() (current_thread_info()->cpu) 46#define raw_smp_processor_id() (current_thread_info()->cpu)
47 47
48extern cpumask_t cpu_present_mask; 48extern cpumask_t cpu_present_mask;
49extern cpumask_t cpu_online_map; 49extern cpumask_t cpu_online_map;
diff --git a/include/asm-arm/smp.h b/include/asm-arm/smp.h
index bd44f894690f..6c6c60adbbaa 100644
--- a/include/asm-arm/smp.h
+++ b/include/asm-arm/smp.h
@@ -21,7 +21,7 @@
21# error "<asm-arm/smp.h> included in non-SMP build" 21# error "<asm-arm/smp.h> included in non-SMP build"
22#endif 22#endif
23 23
24#define smp_processor_id() (current_thread_info()->cpu) 24#define raw_smp_processor_id() (current_thread_info()->cpu)
25 25
26extern cpumask_t cpu_present_mask; 26extern cpumask_t cpu_present_mask;
27#define cpu_possible_map cpu_present_mask 27#define cpu_possible_map cpu_present_mask
diff --git a/include/asm-arm/system.h b/include/asm-arm/system.h
index 8405eb6558ed..39dd7008013c 100644
--- a/include/asm-arm/system.h
+++ b/include/asm-arm/system.h
@@ -308,7 +308,7 @@ do { \
308({ \ 308({ \
309 unsigned long flags; \ 309 unsigned long flags; \
310 local_save_flags(flags); \ 310 local_save_flags(flags); \
311 flags & PSR_I_BIT; \ 311 (int)(flags & PSR_I_BIT); \
312}) 312})
313 313
314#ifdef CONFIG_SMP 314#ifdef CONFIG_SMP
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index 1f4ec7b70270..f40593565173 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -125,6 +125,9 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addres
125 125
126#ifndef __HAVE_ARCH_PAGE_TEST_AND_CLEAR_DIRTY 126#ifndef __HAVE_ARCH_PAGE_TEST_AND_CLEAR_DIRTY
127#define page_test_and_clear_dirty(page) (0) 127#define page_test_and_clear_dirty(page) (0)
128#define pte_maybe_dirty(pte) pte_dirty(pte)
129#else
130#define pte_maybe_dirty(pte) (1)
128#endif 131#endif
129 132
130#ifndef __HAVE_ARCH_PAGE_TEST_AND_CLEAR_YOUNG 133#ifndef __HAVE_ARCH_PAGE_TEST_AND_CLEAR_YOUNG
diff --git a/include/asm-i386/page.h b/include/asm-i386/page.h
index ed13969fa2d6..41400d342d44 100644
--- a/include/asm-i386/page.h
+++ b/include/asm-i386/page.h
@@ -68,6 +68,7 @@ typedef struct { unsigned long pgprot; } pgprot_t;
68#define HPAGE_MASK (~(HPAGE_SIZE - 1)) 68#define HPAGE_MASK (~(HPAGE_SIZE - 1))
69#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) 69#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
70#define HAVE_ARCH_HUGETLB_UNMAPPED_AREA 70#define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
71#define ARCH_HAS_HUGETLB_CLEAN_STALE_PGTABLE
71#endif 72#endif
72 73
73#define pgd_val(x) ((x).pgd) 74#define pgd_val(x) ((x).pgd)
diff --git a/include/asm-i386/pgtable.h b/include/asm-i386/pgtable.h
index 8d60c2b4b003..e9efe148fdf7 100644
--- a/include/asm-i386/pgtable.h
+++ b/include/asm-i386/pgtable.h
@@ -236,6 +236,7 @@ static inline pte_t pte_mkexec(pte_t pte) { (pte).pte_low |= _PAGE_USER; return
236static inline pte_t pte_mkdirty(pte_t pte) { (pte).pte_low |= _PAGE_DIRTY; return pte; } 236static inline pte_t pte_mkdirty(pte_t pte) { (pte).pte_low |= _PAGE_DIRTY; return pte; }
237static inline pte_t pte_mkyoung(pte_t pte) { (pte).pte_low |= _PAGE_ACCESSED; return pte; } 237static inline pte_t pte_mkyoung(pte_t pte) { (pte).pte_low |= _PAGE_ACCESSED; return pte; }
238static inline pte_t pte_mkwrite(pte_t pte) { (pte).pte_low |= _PAGE_RW; return pte; } 238static inline pte_t pte_mkwrite(pte_t pte) { (pte).pte_low |= _PAGE_RW; return pte; }
239static inline pte_t pte_mkhuge(pte_t pte) { (pte).pte_low |= _PAGE_PRESENT | _PAGE_PSE; return pte; }
239 240
240#ifdef CONFIG_X86_PAE 241#ifdef CONFIG_X86_PAE
241# include <asm/pgtable-3level.h> 242# include <asm/pgtable-3level.h>
@@ -275,7 +276,6 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr,
275 */ 276 */
276 277
277#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot)) 278#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot))
278#define mk_pte_huge(entry) ((entry).pte_low |= _PAGE_PRESENT | _PAGE_PSE)
279 279
280static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) 280static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
281{ 281{
diff --git a/include/asm-i386/smp.h b/include/asm-i386/smp.h
index e03a206dfa36..55ef31f66bbe 100644
--- a/include/asm-i386/smp.h
+++ b/include/asm-i386/smp.h
@@ -51,7 +51,7 @@ extern u8 x86_cpu_to_apicid[];
51 * from the initial startup. We map APIC_BASE very early in page_setup(), 51 * from the initial startup. We map APIC_BASE very early in page_setup(),
52 * so this is correct in the x86 case. 52 * so this is correct in the x86 case.
53 */ 53 */
54#define __smp_processor_id() (current_thread_info()->cpu) 54#define raw_smp_processor_id() (current_thread_info()->cpu)
55 55
56extern cpumask_t cpu_callout_map; 56extern cpumask_t cpu_callout_map;
57extern cpumask_t cpu_callin_map; 57extern cpumask_t cpu_callin_map;
diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h
index 61bcc1b1e3f4..176413fb9ae3 100644
--- a/include/asm-i386/unistd.h
+++ b/include/asm-i386/unistd.h
@@ -256,7 +256,7 @@
256#define __NR_io_submit 248 256#define __NR_io_submit 248
257#define __NR_io_cancel 249 257#define __NR_io_cancel 249
258#define __NR_fadvise64 250 258#define __NR_fadvise64 250
259 259#define __NR_set_zone_reclaim 251
260#define __NR_exit_group 252 260#define __NR_exit_group 252
261#define __NR_lookup_dcookie 253 261#define __NR_lookup_dcookie 253
262#define __NR_epoll_create 254 262#define __NR_epoll_create 254
diff --git a/include/asm-ia64/mmzone.h b/include/asm-ia64/mmzone.h
index 9491dacc89cf..83ca4043fc11 100644
--- a/include/asm-ia64/mmzone.h
+++ b/include/asm-ia64/mmzone.h
@@ -15,6 +15,20 @@
15#include <asm/page.h> 15#include <asm/page.h>
16#include <asm/meminit.h> 16#include <asm/meminit.h>
17 17
18static inline int pfn_to_nid(unsigned long pfn)
19{
20#ifdef CONFIG_NUMA
21 extern int paddr_to_nid(unsigned long);
22 int nid = paddr_to_nid(pfn << PAGE_SHIFT);
23 if (nid < 0)
24 return 0;
25 else
26 return nid;
27#else
28 return 0;
29#endif
30}
31
18#ifdef CONFIG_DISCONTIGMEM 32#ifdef CONFIG_DISCONTIGMEM
19 33
20#ifdef CONFIG_IA64_DIG /* DIG systems are small */ 34#ifdef CONFIG_IA64_DIG /* DIG systems are small */
diff --git a/include/asm-ia64/pgtable.h b/include/asm-ia64/pgtable.h
index fcc9c3344ab4..48586e08f432 100644
--- a/include/asm-ia64/pgtable.h
+++ b/include/asm-ia64/pgtable.h
@@ -283,6 +283,7 @@ ia64_phys_addr_valid (unsigned long addr)
283#define pte_mkyoung(pte) (__pte(pte_val(pte) | _PAGE_A)) 283#define pte_mkyoung(pte) (__pte(pte_val(pte) | _PAGE_A))
284#define pte_mkclean(pte) (__pte(pte_val(pte) & ~_PAGE_D)) 284#define pte_mkclean(pte) (__pte(pte_val(pte) & ~_PAGE_D))
285#define pte_mkdirty(pte) (__pte(pte_val(pte) | _PAGE_D)) 285#define pte_mkdirty(pte) (__pte(pte_val(pte) | _PAGE_D))
286#define pte_mkhuge(pte) (__pte(pte_val(pte) | _PAGE_P))
286 287
287/* 288/*
288 * Macro to a page protection value as "uncacheable". Note that "protection" is really a 289 * Macro to a page protection value as "uncacheable". Note that "protection" is really a
diff --git a/include/asm-ia64/smp.h b/include/asm-ia64/smp.h
index 3ba1a061e4ae..a3914352c995 100644
--- a/include/asm-ia64/smp.h
+++ b/include/asm-ia64/smp.h
@@ -46,7 +46,7 @@ ia64_get_lid (void)
46#define SMP_IRQ_REDIRECTION (1 << 0) 46#define SMP_IRQ_REDIRECTION (1 << 0)
47#define SMP_IPI_REDIRECTION (1 << 1) 47#define SMP_IPI_REDIRECTION (1 << 1)
48 48
49#define smp_processor_id() (current_thread_info()->cpu) 49#define raw_smp_processor_id() (current_thread_info()->cpu)
50 50
51extern struct smp_boot_data { 51extern struct smp_boot_data {
52 int cpu_count; 52 int cpu_count;
diff --git a/include/asm-ia64/sn/mspec.h b/include/asm-ia64/sn/mspec.h
new file mode 100644
index 000000000000..dbe13c6121a8
--- /dev/null
+++ b/include/asm-ia64/sn/mspec.h
@@ -0,0 +1,59 @@
1/*
2 *
3 * This file is subject to the terms and conditions of the GNU General Public
4 * License. See the file "COPYING" in the main directory of this archive
5 * for more details.
6 *
7 * Copyright (c) 2001-2004 Silicon Graphics, Inc. All rights reserved.
8 */
9
10#ifndef _ASM_IA64_SN_MSPEC_H
11#define _ASM_IA64_SN_MSPEC_H
12
13#define FETCHOP_VAR_SIZE 64 /* 64 byte per fetchop variable */
14
15#define FETCHOP_LOAD 0
16#define FETCHOP_INCREMENT 8
17#define FETCHOP_DECREMENT 16
18#define FETCHOP_CLEAR 24
19
20#define FETCHOP_STORE 0
21#define FETCHOP_AND 24
22#define FETCHOP_OR 32
23
24#define FETCHOP_CLEAR_CACHE 56
25
26#define FETCHOP_LOAD_OP(addr, op) ( \
27 *(volatile long *)((char*) (addr) + (op)))
28
29#define FETCHOP_STORE_OP(addr, op, x) ( \
30 *(volatile long *)((char*) (addr) + (op)) = (long) (x))
31
32#ifdef __KERNEL__
33
34/*
35 * Each Atomic Memory Operation (AMO formerly known as fetchop)
36 * variable is 64 bytes long. The first 8 bytes are used. The
37 * remaining 56 bytes are unaddressable due to the operation taking
38 * that portion of the address.
39 *
40 * NOTE: The AMO_t _MUST_ be placed in either the first or second half
41 * of the cache line. The cache line _MUST NOT_ be used for anything
42 * other than additional AMO_t entries. This is because there are two
43 * addresses which reference the same physical cache line. One will
44 * be a cached entry with the memory type bits all set. This address
45 * may be loaded into processor cache. The AMO_t will be referenced
46 * uncached via the memory special memory type. If any portion of the
47 * cached cache-line is modified, when that line is flushed, it will
48 * overwrite the uncached value in physical memory and lead to
49 * inconsistency.
50 */
51typedef struct {
52 u64 variable;
53 u64 unused[7];
54} AMO_t;
55
56
57#endif /* __KERNEL__ */
58
59#endif /* _ASM_IA64_SN_MSPEC_H */
diff --git a/include/asm-ia64/uncached.h b/include/asm-ia64/uncached.h
new file mode 100644
index 000000000000..b82d923b73c1
--- /dev/null
+++ b/include/asm-ia64/uncached.h
@@ -0,0 +1,12 @@
1/*
2 * Copyright (C) 2001-2005 Silicon Graphics, Inc. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License
6 * as published by the Free Software Foundation.
7 *
8 * Prototypes for the uncached page allocator
9 */
10
11extern unsigned long uncached_alloc_page(int nid);
12extern void uncached_free_page(unsigned long);
diff --git a/include/asm-ia64/unistd.h b/include/asm-ia64/unistd.h
index 33e26c557c5c..f7f43ec2483a 100644
--- a/include/asm-ia64/unistd.h
+++ b/include/asm-ia64/unistd.h
@@ -263,6 +263,7 @@
263#define __NR_add_key 1271 263#define __NR_add_key 1271
264#define __NR_request_key 1272 264#define __NR_request_key 1272
265#define __NR_keyctl 1273 265#define __NR_keyctl 1273
266#define __NR_set_zone_reclaim 1276
266 267
267#ifdef __KERNEL__ 268#ifdef __KERNEL__
268 269
diff --git a/include/asm-m32r/div64.h b/include/asm-m32r/div64.h
index 417a51bd552d..6cd978cefb28 100644
--- a/include/asm-m32r/div64.h
+++ b/include/asm-m32r/div64.h
@@ -1,38 +1 @@
1#ifndef _ASM_M32R_DIV64 #include <asm-generic/div64.h>
2#define _ASM_M32R_DIV64
3
4/* $Id$ */
5
6/* unsigned long long division.
7 * Input:
8 * unsigned long long n
9 * unsigned long base
10 * Output:
11 * n = n / base;
12 * return value = n % base;
13 */
14#define do_div(n, base) \
15({ \
16 unsigned long _res, _high, _mid, _low; \
17 \
18 _low = (n) & 0xffffffffUL; \
19 _high = (n) >> 32; \
20 if (_high) { \
21 _mid = (_high % (unsigned long)(base)) << 16; \
22 _high = _high / (unsigned long)(base); \
23 _mid += _low >> 16; \
24 _low &= 0x0000ffffUL; \
25 _low += (_mid % (unsigned long)(base)) << 16; \
26 _mid = _mid / (unsigned long)(base); \
27 _res = _low % (unsigned long)(base); \
28 _low = _low / (unsigned long)(base); \
29 n = _low + ((long long)_mid << 16) + \
30 ((long long)_high << 32); \
31 } else { \
32 _res = _low % (unsigned long)(base); \
33 n = (_low / (unsigned long)(base)); \
34 } \
35 _res; \
36})
37
38#endif /* _ASM_M32R_DIV64 */
diff --git a/include/asm-m32r/ide.h b/include/asm-m32r/ide.h
index be64f24e37ee..194393bd8beb 100644
--- a/include/asm-m32r/ide.h
+++ b/include/asm-m32r/ide.h
@@ -35,7 +35,7 @@
35static __inline__ int ide_default_irq(unsigned long base) 35static __inline__ int ide_default_irq(unsigned long base)
36{ 36{
37 switch (base) { 37 switch (base) {
38#if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_MAPPI2) 38#if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_MAPPI2) || defined(CONFIG_PLAT_MAPPI3)
39 case 0x1f0: return PLD_IRQ_CFIREQ; 39 case 0x1f0: return PLD_IRQ_CFIREQ;
40 default: 40 default:
41 return 0; 41 return 0;
diff --git a/include/asm-m32r/m32102.h b/include/asm-m32r/m32102.h
index b56034026bf8..cb98101f4f6e 100644
--- a/include/asm-m32r/m32102.h
+++ b/include/asm-m32r/m32102.h
@@ -175,6 +175,7 @@
175#define M32R_ICU_CR5_PORTL (0x210+M32R_ICU_OFFSET) /* INT4 */ 175#define M32R_ICU_CR5_PORTL (0x210+M32R_ICU_OFFSET) /* INT4 */
176#define M32R_ICU_CR6_PORTL (0x214+M32R_ICU_OFFSET) /* INT5 */ 176#define M32R_ICU_CR6_PORTL (0x214+M32R_ICU_OFFSET) /* INT5 */
177#define M32R_ICU_CR7_PORTL (0x218+M32R_ICU_OFFSET) /* INT6 */ 177#define M32R_ICU_CR7_PORTL (0x218+M32R_ICU_OFFSET) /* INT6 */
178#define M32R_ICU_CR8_PORTL (0x219+M32R_ICU_OFFSET) /* INT7 */
178#define M32R_ICU_CR16_PORTL (0x23C+M32R_ICU_OFFSET) /* MFT0 */ 179#define M32R_ICU_CR16_PORTL (0x23C+M32R_ICU_OFFSET) /* MFT0 */
179#define M32R_ICU_CR17_PORTL (0x240+M32R_ICU_OFFSET) /* MFT1 */ 180#define M32R_ICU_CR17_PORTL (0x240+M32R_ICU_OFFSET) /* MFT1 */
180#define M32R_ICU_CR18_PORTL (0x244+M32R_ICU_OFFSET) /* MFT2 */ 181#define M32R_ICU_CR18_PORTL (0x244+M32R_ICU_OFFSET) /* MFT2 */
diff --git a/include/asm-m32r/m32102peri.h b/include/asm-m32r/m32102peri.h
deleted file mode 100644
index 3c12955ad0f0..000000000000
--- a/include/asm-m32r/m32102peri.h
+++ /dev/null
@@ -1,468 +0,0 @@
1/* $Id$
2 *
3 * This file is subject to the terms and conditions of the GNU General Public
4 * License. See the file "COPYING" in the main directory of this archive
5 * for more details.
6 *
7 * Copyright (C) 2000,2001 by Hiroyuki Kondo
8 */
9
10#ifndef __ASSEMBLY__
11
12typedef void V;
13typedef char B;
14typedef short S;
15typedef int W;
16typedef long L;
17typedef float F;
18typedef double D;
19typedef unsigned char UB;
20typedef unsigned short US;
21typedef unsigned int UW;
22typedef unsigned long UL;
23typedef const unsigned int CUW;
24
25/*********************************
26
27M32102 ICU
28
29*********************************/
30#define ICUISTS (UW *)0xa0EFF004
31#define ICUIREQ0 (UW *)0xa0EFF008
32#define ICUIREQ1 (UW *)0xa0EFF00C
33
34#define ICUSBICR (UW *)0xa0EFF018
35#define ICUIMASK (UW *)0xa0EFF01C
36
37#define ICUCR1 (UW *)0xa0EFF200 /* INT0 */
38#define ICUCR2 (UW *)0xa0EFF204 /* INT1 */
39#define ICUCR3 (UW *)0xa0EFF208 /* INT2 */
40#define ICUCR4 (UW *)0xa0EFF20C /* INT3 */
41#define ICUCR5 (UW *)0xa0EFF210 /* INT4 */
42#define ICUCR6 (UW *)0xa0EFF214 /* INT5 */
43#define ICUCR7 (UW *)0xa0EFF218 /* INT6 */
44
45#define ICUCR16 (UW *)0xa0EFF23C /* MFT0 */
46#define ICUCR17 (UW *)0xa0EFF240 /* MFT1 */
47#define ICUCR18 (UW *)0xa0EFF244 /* MFT2 */
48#define ICUCR19 (UW *)0xa0EFF248 /* MFT3 */
49#define ICUCR20 (UW *)0xa0EFF24C /* MFT4 */
50#define ICUCR21 (UW *)0xa0EFF250 /* MFT5 */
51
52#define ICUCR32 (UW *)0xa0EFF27C /* DMA0 */
53#define ICUCR33 (UW *)0xa0EFF280 /* DMA1 */
54
55#define ICUCR48 (UW *)0xa0EFF2BC /* SIO0R */
56#define ICUCR49 (UW *)0xa0EFF2C0 /* SIO0S */
57#define ICUCR50 (UW *)0xa0EFF2C4 /* SIO1R */
58#define ICUCR51 (UW *)0xa0EFF2C8 /* SIO1S */
59#define ICUCR52 (UW *)0xa0EFF2CC /* SIO2R */
60#define ICUCR53 (UW *)0xa0EFF2D0 /* SIO2S */
61#define ICUCR54 (UW *)0xa0EFF2D4 /* SIO3R */
62#define ICUCR55 (UW *)0xa0EFF2D8 /* SIO3S */
63#define ICUCR56 (UW *)0xa0EFF2DC /* SIO4R */
64#define ICUCR57 (UW *)0xa0EFF2E0 /* SIO4S */
65
66/*********************************
67
68M32102 MFT
69
70*********************************/
71#define MFTCR (US *)0xa0EFC002
72#define MFTRPR (UB *)0xa0EFC006
73
74#define MFT0MOD (US *)0xa0EFC102
75#define MFT0BOS (US *)0xa0EFC106
76#define MFT0CUT (US *)0xa0EFC10A
77#define MFT0RLD (US *)0xa0EFC10E
78#define MFT0CRLD (US *)0xa0EFC112
79
80#define MFT1MOD (US *)0xa0EFC202
81#define MFT1BOS (US *)0xa0EFC206
82#define MFT1CUT (US *)0xa0EFC20A
83#define MFT1RLD (US *)0xa0EFC20E
84#define MFT1CRLD (US *)0xa0EFC212
85
86#define MFT2MOD (US *)0xa0EFC302
87#define MFT2BOS (US *)0xa0EFC306
88#define MFT2CUT (US *)0xa0EFC30A
89#define MFT2RLD (US *)0xa0EFC30E
90#define MFT2CRLD (US *)0xa0EFC312
91
92#define MFT3MOD (US *)0xa0EFC402
93#define MFT3CUT (US *)0xa0EFC40A
94#define MFT3RLD (US *)0xa0EFC40E
95#define MFT3CRLD (US *)0xa0EFC412
96
97#define MFT4MOD (US *)0xa0EFC502
98#define MFT4CUT (US *)0xa0EFC50A
99#define MFT4RLD (US *)0xa0EFC50E
100#define MFT4CRLD (US *)0xa0EFC512
101
102#define MFT5MOD (US *)0xa0EFC602
103#define MFT5CUT (US *)0xa0EFC60A
104#define MFT5RLD (US *)0xa0EFC60E
105#define MFT5CRLD (US *)0xa0EFC612
106
107/*********************************
108
109M32102 SIO
110
111*********************************/
112
113#define SIO0CR (volatile int *)0xa0efd000
114#define SIO0MOD0 (volatile int *)0xa0efd004
115#define SIO0MOD1 (volatile int *)0xa0efd008
116#define SIO0STS (volatile int *)0xa0efd00c
117#define SIO0IMASK (volatile int *)0xa0efd010
118#define SIO0BAUR (volatile int *)0xa0efd014
119#define SIO0RBAUR (volatile int *)0xa0efd018
120#define SIO0TXB (volatile int *)0xa0efd01c
121#define SIO0RXB (volatile int *)0xa0efd020
122
123#define SIO1CR (volatile int *)0xa0efd100
124#define SIO1MOD0 (volatile int *)0xa0efd104
125#define SIO1MOD1 (volatile int *)0xa0efd108
126#define SIO1STS (volatile int *)0xa0efd10c
127#define SIO1IMASK (volatile int *)0xa0efd110
128#define SIO1BAUR (volatile int *)0xa0efd114
129#define SIO1RBAUR (volatile int *)0xa0efd118
130#define SIO1TXB (volatile int *)0xa0efd11c
131#define SIO1RXB (volatile int *)0xa0efd120
132/*********************************
133
134M32102 PORT
135
136*********************************/
137#define PIEN (UB *)0xa0EF1003 /* input enable */
138
139#define P0DATA (UB *)0xa0EF1020 /* data */
140#define P1DATA (UB *)0xa0EF1021
141#define P2DATA (UB *)0xa0EF1022
142#define P3DATA (UB *)0xa0EF1023
143#define P4DATA (UB *)0xa0EF1024
144#define P5DATA (UB *)0xa0EF1025
145#define P6DATA (UB *)0xa0EF1026
146#define P7DATA (UB *)0xa0EF1027
147
148#define P0DIR (UB *)0xa0EF1040 /* direction */
149#define P1DIR (UB *)0xa0EF1041
150#define P2DIR (UB *)0xa0EF1042
151#define P3DIR (UB *)0xa0EF1043
152#define P4DIR (UB *)0xa0EF1044
153#define P5DIR (UB *)0xa0EF1045
154#define P6DIR (UB *)0xa0EF1046
155#define P7DIR (UB *)0xa0EF1047
156
157#define P0MOD (US *)0xa0EF1060 /* mode control */
158#define P1MOD (US *)0xa0EF1062
159#define P2MOD (US *)0xa0EF1064
160#define P3MOD (US *)0xa0EF1066
161#define P4MOD (US *)0xa0EF1068
162#define P5MOD (US *)0xa0EF106A
163#define P6MOD (US *)0xa0EF106C
164#define P7MOD (US *)0xa0EF106E
165
166#define P0ODCR (UB *)0xa0EF1080 /* open-drain control */
167#define P1ODCR (UB *)0xa0EF1081
168#define P2ODCR (UB *)0xa0EF1082
169#define P3ODCR (UB *)0xa0EF1083
170#define P4ODCR (UB *)0xa0EF1084
171#define P5ODCR (UB *)0xa0EF1085
172#define P6ODCR (UB *)0xa0EF1086
173#define P7ODCR (UB *)0xa0EF1087
174
175/*********************************
176
177M32102 Cache
178
179********************************/
180
181#define MCCR (US *)0xFFFFFFFE
182
183
184#else /* __ASSEMBLY__ */
185
186;;
187;; PIO 0x80ef1000
188;;
189
190#define PIEN 0xa0ef1000
191
192#define P0DATA 0xa0ef1020
193#define P1DATA 0xa0ef1021
194#define P2DATA 0xa0ef1022
195#define P3DATA 0xa0ef1023
196#define P4DATA 0xa0ef1024
197#define P5DATA 0xa0ef1025
198#define P6DATA 0xa0ef1026
199#define P7DATA 0xa0ef1027
200
201#define P0DIR 0xa0ef1040
202#define P1DIR 0xa0ef1041
203#define P2DIR 0xa0ef1042
204#define P3DIR 0xa0ef1043
205#define P4DIR 0xa0ef1044
206#define P5DIR 0xa0ef1045
207#define P6DIR 0xa0ef1046
208#define P7DIR 0xa0ef1047
209
210#define P0MOD 0xa0ef1060
211#define P1MOD 0xa0ef1062
212#define P2MOD 0xa0ef1064
213#define P3MOD 0xa0ef1066
214#define P4MOD 0xa0ef1068
215#define P5MOD 0xa0ef106a
216#define P6MOD 0xa0ef106c
217#define P7MOD 0xa0ef106e
218;
219#define P0ODCR 0xa0ef1080
220#define P1ODCR 0xa0ef1081
221#define P2ODCR 0xa0ef1082
222#define P3ODCR 0xa0ef1083
223#define P4ODCR 0xa0ef1084
224#define P5ODCR 0xa0ef1085
225#define P6ODCR 0xa0ef1086
226#define P7ODCR 0xa0ef1087
227
228;;
229;; WDT 0xa0ef2000
230;;
231
232#define WDTCR 0xa0ef2000
233
234
235;;
236;; CLK 0xa0ef4000
237;;
238
239#define CPUCLKCR 0xa0ef4000
240#define CLKMOD 0xa0ef4004
241#define PLLCR 0xa0ef4008
242
243
244;;
245;; BSEL 0xa0ef5000
246;;
247
248#define BSEL0CR 0xa0ef5000
249#define BSEL1CR 0xa0ef5004
250#define BSEL2CR 0xa0ef5008
251#define BSEL3CR 0xa0ef500c
252#define BSEL4CR 0xa0ef5010
253#define BSEL5CR 0xa0ef5014
254
255
256;;
257;; SDRAMC 0xa0ef6000
258;;
259
260#define SDRF0 0xa0ef6000
261#define SDRF1 0xa0ef6004
262#define SDIR0 0xa0ef6008
263#define SDIR1 0xa0ef600c
264#define SDBR 0xa0ef6010
265
266;; CH0
267#define SD0ADR 0xa0ef6020
268#define SD0SZ 0xa0ef6022
269#define SD0ER 0xa0ef6024
270#define SD0TR 0xa0ef6028
271#define SD0MOD 0xa0ef602c
272
273;; CH1
274#define SD1ADR 0xa0ef6040
275#define SD1SZ 0xa0ef6042
276#define SD1ER 0xa0ef6044
277#define SD1TR 0xa0ef6048
278#define SD1MOD 0xa0ef604c
279
280
281;;
282;; DMAC 0xa0ef8000
283;;
284
285#define DMAEN 0xa0ef8000
286#define DMAISTS 0xa0ef8004
287#define DMAEDET 0xa0ef8008
288#define DMAASTS 0xa0ef800c
289
290;; CH0
291#define DMA0CR0 0xa0ef8100
292#define DMA0CR1 0xa0ef8104
293#define DMA0CSA 0xa0ef8108
294#define DMA0RSA 0xa0ef810c
295#define DMA0CDA 0xa0ef8110
296#define DMA0RDA 0xa0ef8114
297#define DMA0CBCUT 0xa0ef8118
298#define DMA0RBCUT 0xa0ef811c
299
300;; CH1
301#define DMA1CR0 0xa0ef8200
302#define DMA1CR1 0xa0ef8204
303#define DMA1CSA 0xa0ef8208
304#define DMA1RSA 0xa0ef820c
305#define DMA1CDA 0xa0ef8210
306#define DMA1RDA 0xa0ef8214
307#define DMA1CBCUT 0xa0ef8218
308#define DMA1RBCUT 0xa0ef821c
309
310
311;;
312;; MFT 0xa0efc000
313;;
314
315#define MFTCR 0xa0efc000
316#define MFTRPR 0xa0efc004
317
318;; CH0
319#define MFT0MOD 0xa0efc100
320#define MFT0BOS 0xa0efc104
321#define MFT0CUT 0xa0efc108
322#define MFT0RLD 0xa0efc10c
323#define MFT0CMPRLD 0xa0efc110
324
325;; CH1
326#define MFT1MOD 0xa0efc200
327#define MFT1BOS 0xa0efc204
328#define MFT1CUT 0xa0efc208
329#define MFT1RLD 0xa0efc20c
330#define MFT1CMPRLD 0xa0efc210
331
332;; CH2
333#define MFT2MOD 0xa0efc300
334#define MFT2BOS 0xa0efc304
335#define MFT2CUT 0xa0efc308
336#define MFT2RLD 0xa0efc30c
337#define MFT2CMPRLD 0xa0efc310
338
339;; CH3
340#define MFT3MOD 0xa0efc400
341#define MFT3BOS 0xa0efc404
342#define MFT3CUT 0xa0efc408
343#define MFT3RLD 0xa0efc40c
344#define MFT3CMPRLD 0xa0efc410
345
346;; CH4
347#define MFT4MOD 0xa0efc500
348#define MFT4BOS 0xa0efc504
349#define MFT4CUT 0xa0efc508
350#define MFT4RLD 0xa0efc50c
351#define MFT4CMPRLD 0xa0efc510
352
353;; CH5
354#define MFT5MOD 0xa0efc600
355#define MFT5BOS 0xa0efc604
356#define MFT5CUT 0xa0efc608
357#define MFT5RLD 0xa0efc60c
358#define MFT5CMPRLD 0xa0efc610
359
360
361;;
362;; SIO 0xa0efd000
363;;
364
365;; CH0
366#define SIO0CR 0xa0efd000
367#define SIO0MOD0 0xa0efd004
368#define SIO0MOD1 0xa0efd008
369#define SIO0STS 0xa0efd00c
370#define SIO0IMASK 0xa0efd010
371#define SIO0BAUR 0xa0efd014
372#define SIO0RBAUR 0xa0efd018
373#define SIO0TXB 0xa0efd01c
374#define SIO0RXB 0xa0efd020
375
376;; CH1
377#define SIO1CR 0xa0efd100
378#define SIO1MOD0 0xa0efd104
379#define SIO1MOD1 0xa0efd108
380#define SIO1STS 0xa0efd10c
381#define SIO1IMASK 0xa0efd110
382#define SIO1BAUR 0xa0efd114
383#define SIO1RBAUR 0xa0efd118
384#define SIO1TXB 0xa0efd11c
385#define SIO1RXB 0xa0efd120
386
387;; CH2
388#define SIO2CR 0xa0efd200
389#define SIO2MOD0 0xa0efd204
390#define SIO2MOD1 0xa0efd208
391#define SIO2STS 0xa0efd20c
392#define SIO2IMASK 0xa0efd210
393#define SIO2BAUR 0xa0efd214
394#define SIO2RBAUR 0xa0efd218
395#define SIO2TXB 0xa0efd21c
396#define SIO2RXB 0xa0efd220
397
398;; CH3
399#define SIO3CR 0xa0efd300
400#define SIO3MOD0 0xa0efd304
401#define SIO3MOD1 0xa0efd308
402#define SIO3STS 0xa0efd30c
403#define SIO3IMASK 0xa0efd310
404#define SIO3BAUR 0xa0efd314
405#define SIO3RBAUR 0xa0efd318
406#define SIO3TXB 0xa0efd31c
407#define SIO3RXB 0xa0efd320
408
409;; CH4
410#define SIO4CR 0xa0efd400
411#define SIO4MOD0 0xa0efd404
412#define SIO4MOD1 0xa0efd408
413#define SIO4STS 0xa0efd40c
414#define SIO4IMASK 0xa0efd410
415#define SIO4BAUR 0xa0efd414
416#define SIO4RBAUR 0xa0efd418
417#define SIO4TXB 0xa0efd41c
418#define SIO4RXB 0xa0efd420
419
420
421;;
422;; ICU 0xa0eff000
423;;
424
425#define ICUISTS 0xa0eff004
426#define ICUIREQ0 0xa0eff008
427#define ICUIREQ1 0xa0eff00c
428
429#define ICUSBICR 0xa0eff018
430#define ICUIMASK 0xa0eff01c
431
432#define ICUCR1 0xa0eff200
433#define ICUCR2 0xa0eff204
434#define ICUCR3 0xa0eff208
435#define ICUCR4 0xa0eff20c
436#define ICUCR5 0xa0eff210
437#define ICUCR6 0xa0eff214
438#define ICUCR7 0xa0eff218
439
440#define ICUCR16 0xa0eff23c
441#define ICUCR17 0xa0eff240
442#define ICUCR18 0xa0eff244
443#define ICUCR19 0xa0eff248
444#define ICUCR20 0xa0eff24c
445#define ICUCR21 0xa0eff250
446
447#define ICUCR32 0xa0eff27c
448#define ICUCR33 0xa0eff280
449
450#define ICUCR48 0xa0eff2bc
451#define ICUCR49 0xa0eff2c0
452#define ICUCR50 0xa0eff2c4
453#define ICUCR51 0xa0eff2c8
454#define ICUCR52 0xa0eff2cc
455#define ICUCR53 0xa0eff2d0
456#define ICUCR54 0xa0eff2d4
457#define ICUCR55 0xa0eff2d8
458#define ICUCR56 0xa0eff2dc
459#define ICUCR57 0xa0eff2e0
460
461;;
462;; CACHE
463;;
464
465#define MCCR 0xfffffffc
466
467
468#endif /* __ASSEMBLY__ */
diff --git a/include/asm-m32r/m32r.h b/include/asm-m32r/m32r.h
index f116649bbef3..ec142be00862 100644
--- a/include/asm-m32r/m32r.h
+++ b/include/asm-m32r/m32r.h
@@ -16,7 +16,6 @@
16 || defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_M32102) \ 16 || defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_M32102) \
17 || defined(CONFIG_CHIP_OPSP) 17 || defined(CONFIG_CHIP_OPSP)
18#include <asm/m32102.h> 18#include <asm/m32102.h>
19#include <asm/m32102peri.h>
20#endif 19#endif
21 20
22/* Platform type */ 21/* Platform type */
@@ -36,6 +35,10 @@
36#include <asm/mappi2/mappi2_pld.h> 35#include <asm/mappi2/mappi2_pld.h>
37#endif /* CONFIG_PLAT_MAPPI2 */ 36#endif /* CONFIG_PLAT_MAPPI2 */
38 37
38#if defined(CONFIG_PLAT_MAPPI3)
39#include <asm/mappi3/mappi3_pld.h>
40#endif /* CONFIG_PLAT_MAPPI3 */
41
39#if defined(CONFIG_PLAT_USRV) 42#if defined(CONFIG_PLAT_USRV)
40#include <asm/m32700ut/m32700ut_pld.h> 43#include <asm/m32700ut/m32700ut_pld.h>
41#endif 44#endif
diff --git a/include/asm-m32r/mappi3/mappi3_pld.h b/include/asm-m32r/mappi3/mappi3_pld.h
new file mode 100644
index 000000000000..3f1551f7f01f
--- /dev/null
+++ b/include/asm-m32r/mappi3/mappi3_pld.h
@@ -0,0 +1,143 @@
1/*
2 * include/asm/mappi3/mappi3_pld.h
3 *
4 * Definitions for Extended IO Logic on MAPPI3 board.
5 * based on m32700ut_pld.h
6 *
7 * This file is subject to the terms and conditions of the GNU General
8 * Public License. See the file "COPYING" in the main directory of
9 * this archive for more details.
10 *
11 */
12
13#ifndef _MAPPI3_PLD_H
14#define _MAPPI3_PLD_H
15
16#ifndef __ASSEMBLY__
17/* FIXME:
18 * Some C functions use non-cache address, so can't define non-cache address.
19 */
20#define PLD_BASE (0x1c000000 /* + NONCACHE_OFFSET */)
21#define __reg8 (volatile unsigned char *)
22#define __reg16 (volatile unsigned short *)
23#define __reg32 (volatile unsigned int *)
24#else
25#define PLD_BASE (0x1c000000 + NONCACHE_OFFSET)
26#define __reg8
27#define __reg16
28#define __reg32
29#endif /* __ASSEMBLY__ */
30
31/* CFC */
32#define PLD_CFRSTCR __reg16(PLD_BASE + 0x0000)
33#define PLD_CFSTS __reg16(PLD_BASE + 0x0002)
34#define PLD_CFIMASK __reg16(PLD_BASE + 0x0004)
35#define PLD_CFBUFCR __reg16(PLD_BASE + 0x0006)
36#define PLD_CFCR0 __reg16(PLD_BASE + 0x000a)
37#define PLD_CFCR1 __reg16(PLD_BASE + 0x000c)
38
39/* MMC */
40#define PLD_MMCCR __reg16(PLD_BASE + 0x4000)
41#define PLD_MMCMOD __reg16(PLD_BASE + 0x4002)
42#define PLD_MMCSTS __reg16(PLD_BASE + 0x4006)
43#define PLD_MMCBAUR __reg16(PLD_BASE + 0x400a)
44#define PLD_MMCCMDBCUT __reg16(PLD_BASE + 0x400c)
45#define PLD_MMCCDTBCUT __reg16(PLD_BASE + 0x400e)
46#define PLD_MMCDET __reg16(PLD_BASE + 0x4010)
47#define PLD_MMCWP __reg16(PLD_BASE + 0x4012)
48#define PLD_MMCWDATA __reg16(PLD_BASE + 0x5000)
49#define PLD_MMCRDATA __reg16(PLD_BASE + 0x6000)
50#define PLD_MMCCMDDATA __reg16(PLD_BASE + 0x7000)
51#define PLD_MMCRSPDATA __reg16(PLD_BASE + 0x7006)
52
53/* Power Control of MMC and CF */
54#define PLD_CPCR __reg16(PLD_BASE + 0x14000)
55
56
57/*==== ICU ====*/
58#define M32R_IRQ_PC104 (5) /* INT4(PC/104) */
59#define M32R_IRQ_I2C (28) /* I2C-BUS */
60#define PLD_IRQ_CFIREQ (6) /* INT5 CFC Card Interrupt */
61#define PLD_IRQ_CFC_INSERT (7) /* INT6 CFC Card Insert */
62#define PLD_IRQ_CFC_EJECT (8) /* INT7 CFC Card Eject */
63#define PLD_IRQ_MMCCARD (43) /* MMC Card Insert */
64#define PLD_IRQ_MMCIRQ (44) /* MMC Transfer Done */
65
66
67#if 0
68/* LED Control
69 *
70 * 1: DIP swich side
71 * 2: Reset switch side
72 */
73#define PLD_IOLEDCR __reg16(PLD_BASE + 0x14002)
74#define PLD_IOLED_1_ON 0x001
75#define PLD_IOLED_1_OFF 0x000
76#define PLD_IOLED_2_ON 0x002
77#define PLD_IOLED_2_OFF 0x000
78
79/* DIP Switch
80 * 0: Write-protect of Flash Memory (0:protected, 1:non-protected)
81 * 1: -
82 * 2: -
83 * 3: -
84 */
85#define PLD_IOSWSTS __reg16(PLD_BASE + 0x14004)
86#define PLD_IOSWSTS_IOSW2 0x0200
87#define PLD_IOSWSTS_IOSW1 0x0100
88#define PLD_IOSWSTS_IOWP0 0x0001
89
90#endif
91
92/* CRC */
93#define PLD_CRC7DATA __reg16(PLD_BASE + 0x18000)
94#define PLD_CRC7INDATA __reg16(PLD_BASE + 0x18002)
95#define PLD_CRC16DATA __reg16(PLD_BASE + 0x18004)
96#define PLD_CRC16INDATA __reg16(PLD_BASE + 0x18006)
97#define PLD_CRC16ADATA __reg16(PLD_BASE + 0x18008)
98#define PLD_CRC16AINDATA __reg16(PLD_BASE + 0x1800a)
99
100
101#if 0
102/* RTC */
103#define PLD_RTCCR __reg16(PLD_BASE + 0x1c000)
104#define PLD_RTCBAUR __reg16(PLD_BASE + 0x1c002)
105#define PLD_RTCWRDATA __reg16(PLD_BASE + 0x1c004)
106#define PLD_RTCRDDATA __reg16(PLD_BASE + 0x1c006)
107#define PLD_RTCRSTODT __reg16(PLD_BASE + 0x1c008)
108
109/* SIO0 */
110#define PLD_ESIO0CR __reg16(PLD_BASE + 0x20000)
111#define PLD_ESIO0CR_TXEN 0x0001
112#define PLD_ESIO0CR_RXEN 0x0002
113#define PLD_ESIO0MOD0 __reg16(PLD_BASE + 0x20002)
114#define PLD_ESIO0MOD0_CTSS 0x0040
115#define PLD_ESIO0MOD0_RTSS 0x0080
116#define PLD_ESIO0MOD1 __reg16(PLD_BASE + 0x20004)
117#define PLD_ESIO0MOD1_LMFS 0x0010
118#define PLD_ESIO0STS __reg16(PLD_BASE + 0x20006)
119#define PLD_ESIO0STS_TEMP 0x0001
120#define PLD_ESIO0STS_TXCP 0x0002
121#define PLD_ESIO0STS_RXCP 0x0004
122#define PLD_ESIO0STS_TXSC 0x0100
123#define PLD_ESIO0STS_RXSC 0x0200
124#define PLD_ESIO0STS_TXREADY (PLD_ESIO0STS_TXCP | PLD_ESIO0STS_TEMP)
125#define PLD_ESIO0INTCR __reg16(PLD_BASE + 0x20008)
126#define PLD_ESIO0INTCR_TXIEN 0x0002
127#define PLD_ESIO0INTCR_RXCEN 0x0004
128#define PLD_ESIO0BAUR __reg16(PLD_BASE + 0x2000a)
129#define PLD_ESIO0TXB __reg16(PLD_BASE + 0x2000c)
130#define PLD_ESIO0RXB __reg16(PLD_BASE + 0x2000e)
131
132/* SIM Card */
133#define PLD_SCCR __reg16(PLD_BASE + 0x38000)
134#define PLD_SCMOD __reg16(PLD_BASE + 0x38004)
135#define PLD_SCSTS __reg16(PLD_BASE + 0x38006)
136#define PLD_SCINTCR __reg16(PLD_BASE + 0x38008)
137#define PLD_SCBAUR __reg16(PLD_BASE + 0x3800a)
138#define PLD_SCTXB __reg16(PLD_BASE + 0x3800c)
139#define PLD_SCRXB __reg16(PLD_BASE + 0x3800e)
140
141#endif
142
143#endif /* _MAPPI3_PLD.H */
diff --git a/include/asm-m32r/smp.h b/include/asm-m32r/smp.h
index 8cd4d0da4be1..b9a20cdad65f 100644
--- a/include/asm-m32r/smp.h
+++ b/include/asm-m32r/smp.h
@@ -66,7 +66,7 @@ extern volatile int cpu_2_physid[NR_CPUS];
66#define physid_to_cpu(physid) physid_2_cpu[physid] 66#define physid_to_cpu(physid) physid_2_cpu[physid]
67#define cpu_to_physid(cpu_id) cpu_2_physid[cpu_id] 67#define cpu_to_physid(cpu_id) cpu_2_physid[cpu_id]
68 68
69#define smp_processor_id() (current_thread_info()->cpu) 69#define raw_smp_processor_id() (current_thread_info()->cpu)
70 70
71extern cpumask_t cpu_callout_map; 71extern cpumask_t cpu_callout_map;
72#define cpu_possible_map cpu_callout_map 72#define cpu_possible_map cpu_callout_map
diff --git a/include/asm-mips/smp.h b/include/asm-mips/smp.h
index 8ba370ecfd4c..5618f1e12f40 100644
--- a/include/asm-mips/smp.h
+++ b/include/asm-mips/smp.h
@@ -21,7 +21,7 @@
21#include <linux/cpumask.h> 21#include <linux/cpumask.h>
22#include <asm/atomic.h> 22#include <asm/atomic.h>
23 23
24#define smp_processor_id() (current_thread_info()->cpu) 24#define raw_smp_processor_id() (current_thread_info()->cpu)
25 25
26/* Map from cpu id to sequential logical cpu number. This will only 26/* Map from cpu id to sequential logical cpu number. This will only
27 not be idempotent when cpus failed to come on-line. */ 27 not be idempotent when cpus failed to come on-line. */
diff --git a/include/asm-mips/vr41xx/giu.h b/include/asm-mips/vr41xx/giu.h
new file mode 100644
index 000000000000..8590885a7638
--- /dev/null
+++ b/include/asm-mips/vr41xx/giu.h
@@ -0,0 +1,69 @@
1/*
2 * Include file for NEC VR4100 series General-purpose I/O Unit.
3 *
4 * Copyright (C) 2005 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#ifndef __NEC_VR41XX_GIU_H
21#define __NEC_VR41XX_GIU_H
22
23typedef enum {
24 IRQ_TRIGGER_LEVEL,
25 IRQ_TRIGGER_EDGE,
26 IRQ_TRIGGER_EDGE_FALLING,
27 IRQ_TRIGGER_EDGE_RISING,
28} irq_trigger_t;
29
30typedef enum {
31 IRQ_SIGNAL_THROUGH,
32 IRQ_SIGNAL_HOLD,
33} irq_signal_t;
34
35extern void vr41xx_set_irq_trigger(unsigned int pin, irq_trigger_t trigger, irq_signal_t signal);
36
37typedef enum {
38 IRQ_LEVEL_LOW,
39 IRQ_LEVEL_HIGH,
40} irq_level_t;
41
42extern void vr41xx_set_irq_level(unsigned int pin, irq_level_t level);
43
44typedef enum {
45 GPIO_DATA_LOW,
46 GPIO_DATA_HIGH,
47 GPIO_DATA_INVAL,
48} gpio_data_t;
49
50extern gpio_data_t vr41xx_gpio_get_pin(unsigned int pin);
51extern int vr41xx_gpio_set_pin(unsigned int pin, gpio_data_t data);
52
53typedef enum {
54 GPIO_INPUT,
55 GPIO_OUTPUT,
56 GPIO_OUTPUT_DISABLE,
57} gpio_direction_t;
58
59extern int vr41xx_gpio_set_direction(unsigned int pin, gpio_direction_t dir);
60
61typedef enum {
62 GPIO_PULL_DOWN,
63 GPIO_PULL_UP,
64 GPIO_PULL_DISABLE,
65} gpio_pull_t;
66
67extern int vr41xx_gpio_pullupdown(unsigned int pin, gpio_pull_t pull);
68
69#endif /* __NEC_VR41XX_GIU_H */
diff --git a/include/asm-mips/vr41xx/vr41xx.h b/include/asm-mips/vr41xx/vr41xx.h
index ad0d1ea144f0..7d41e44463f9 100644
--- a/include/asm-mips/vr41xx/vr41xx.h
+++ b/include/asm-mips/vr41xx/vr41xx.h
@@ -126,7 +126,6 @@ extern void vr41xx_mask_clock(vr41xx_clock_t clock);
126#define GIU_IRQ_BASE 40 126#define GIU_IRQ_BASE 40
127#define GIU_IRQ(x) (GIU_IRQ_BASE + (x)) /* IRQ 40-71 */ 127#define GIU_IRQ(x) (GIU_IRQ_BASE + (x)) /* IRQ 40-71 */
128#define GIU_IRQ_LAST GIU_IRQ(31) 128#define GIU_IRQ_LAST GIU_IRQ(31)
129#define GIU_IRQ_TO_PIN(x) ((x) - GIU_IRQ_BASE) /* Pin 0-31 */
130 129
131extern int vr41xx_set_intassign(unsigned int irq, unsigned char intassign); 130extern int vr41xx_set_intassign(unsigned int irq, unsigned char intassign);
132extern int vr41xx_cascade_irq(unsigned int irq, int (*get_irq_number)(int irq)); 131extern int vr41xx_cascade_irq(unsigned int irq, int (*get_irq_number)(int irq));
@@ -197,38 +196,4 @@ extern void vr41xx_disable_csiint(uint16_t mask);
197extern void vr41xx_enable_bcuint(void); 196extern void vr41xx_enable_bcuint(void);
198extern void vr41xx_disable_bcuint(void); 197extern void vr41xx_disable_bcuint(void);
199 198
200/*
201 * General-Purpose I/O Unit
202 */
203enum {
204 TRIGGER_LEVEL,
205 TRIGGER_EDGE,
206 TRIGGER_EDGE_FALLING,
207 TRIGGER_EDGE_RISING
208};
209
210enum {
211 SIGNAL_THROUGH,
212 SIGNAL_HOLD
213};
214
215extern void vr41xx_set_irq_trigger(int pin, int trigger, int hold);
216
217enum {
218 LEVEL_LOW,
219 LEVEL_HIGH
220};
221
222extern void vr41xx_set_irq_level(int pin, int level);
223
224enum {
225 PIO_INPUT,
226 PIO_OUTPUT
227};
228
229enum {
230 DATA_LOW,
231 DATA_HIGH
232};
233
234#endif /* __NEC_VR41XX_H */ 199#endif /* __NEC_VR41XX_H */
diff --git a/include/asm-parisc/smp.h b/include/asm-parisc/smp.h
index fde77ac35463..9413f67a540b 100644
--- a/include/asm-parisc/smp.h
+++ b/include/asm-parisc/smp.h
@@ -51,7 +51,7 @@ extern void smp_send_reschedule(int cpu);
51 51
52extern unsigned long cpu_present_mask; 52extern unsigned long cpu_present_mask;
53 53
54#define smp_processor_id() (current_thread_info()->cpu) 54#define raw_smp_processor_id() (current_thread_info()->cpu)
55 55
56#endif /* CONFIG_SMP */ 56#endif /* CONFIG_SMP */
57 57
diff --git a/include/asm-ppc/irq.h b/include/asm-ppc/irq.h
index 06b86be61ed1..a9b33324f562 100644
--- a/include/asm-ppc/irq.h
+++ b/include/asm-ppc/irq.h
@@ -176,7 +176,7 @@ static __inline__ int irq_canonicalize(int irq)
176*/ 176*/
177#include <asm/mpc85xx.h> 177#include <asm/mpc85xx.h>
178 178
179/* The MPC8560 openpic has 32 internal interrupts and 12 external 179/* The MPC8548 openpic has 48 internal interrupts and 12 external
180 * interrupts. 180 * interrupts.
181 * 181 *
182 * We are "flattening" the interrupt vectors of the cascaded CPM 182 * We are "flattening" the interrupt vectors of the cascaded CPM
@@ -184,7 +184,7 @@ static __inline__ int irq_canonicalize(int irq)
184 * single integer. 184 * single integer.
185 */ 185 */
186#define NR_CPM_INTS 64 186#define NR_CPM_INTS 64
187#define NR_EPIC_INTS 44 187#define NR_EPIC_INTS 60
188#ifndef NR_8259_INTS 188#ifndef NR_8259_INTS
189#define NR_8259_INTS 0 189#define NR_8259_INTS 0
190#endif 190#endif
@@ -223,9 +223,15 @@ static __inline__ int irq_canonicalize(int irq)
223#define MPC85xx_IRQ_RIO_RX (12 + MPC85xx_OPENPIC_IRQ_OFFSET) 223#define MPC85xx_IRQ_RIO_RX (12 + MPC85xx_OPENPIC_IRQ_OFFSET)
224#define MPC85xx_IRQ_TSEC1_TX (13 + MPC85xx_OPENPIC_IRQ_OFFSET) 224#define MPC85xx_IRQ_TSEC1_TX (13 + MPC85xx_OPENPIC_IRQ_OFFSET)
225#define MPC85xx_IRQ_TSEC1_RX (14 + MPC85xx_OPENPIC_IRQ_OFFSET) 225#define MPC85xx_IRQ_TSEC1_RX (14 + MPC85xx_OPENPIC_IRQ_OFFSET)
226#define MPC85xx_IRQ_TSEC3_TX (15 + MPC85xx_OPENPIC_IRQ_OFFSET)
227#define MPC85xx_IRQ_TSEC3_RX (16 + MPC85xx_OPENPIC_IRQ_OFFSET)
228#define MPC85xx_IRQ_TSEC3_ERROR (17 + MPC85xx_OPENPIC_IRQ_OFFSET)
226#define MPC85xx_IRQ_TSEC1_ERROR (18 + MPC85xx_OPENPIC_IRQ_OFFSET) 229#define MPC85xx_IRQ_TSEC1_ERROR (18 + MPC85xx_OPENPIC_IRQ_OFFSET)
227#define MPC85xx_IRQ_TSEC2_TX (19 + MPC85xx_OPENPIC_IRQ_OFFSET) 230#define MPC85xx_IRQ_TSEC2_TX (19 + MPC85xx_OPENPIC_IRQ_OFFSET)
228#define MPC85xx_IRQ_TSEC2_RX (20 + MPC85xx_OPENPIC_IRQ_OFFSET) 231#define MPC85xx_IRQ_TSEC2_RX (20 + MPC85xx_OPENPIC_IRQ_OFFSET)
232#define MPC85xx_IRQ_TSEC4_TX (21 + MPC85xx_OPENPIC_IRQ_OFFSET)
233#define MPC85xx_IRQ_TSEC4_RX (22 + MPC85xx_OPENPIC_IRQ_OFFSET)
234#define MPC85xx_IRQ_TSEC4_ERROR (23 + MPC85xx_OPENPIC_IRQ_OFFSET)
229#define MPC85xx_IRQ_TSEC2_ERROR (24 + MPC85xx_OPENPIC_IRQ_OFFSET) 235#define MPC85xx_IRQ_TSEC2_ERROR (24 + MPC85xx_OPENPIC_IRQ_OFFSET)
230#define MPC85xx_IRQ_FEC (25 + MPC85xx_OPENPIC_IRQ_OFFSET) 236#define MPC85xx_IRQ_FEC (25 + MPC85xx_OPENPIC_IRQ_OFFSET)
231#define MPC85xx_IRQ_DUART (26 + MPC85xx_OPENPIC_IRQ_OFFSET) 237#define MPC85xx_IRQ_DUART (26 + MPC85xx_OPENPIC_IRQ_OFFSET)
@@ -235,18 +241,18 @@ static __inline__ int irq_canonicalize(int irq)
235#define MPC85xx_IRQ_CPM (30 + MPC85xx_OPENPIC_IRQ_OFFSET) 241#define MPC85xx_IRQ_CPM (30 + MPC85xx_OPENPIC_IRQ_OFFSET)
236 242
237/* The 12 external interrupt lines */ 243/* The 12 external interrupt lines */
238#define MPC85xx_IRQ_EXT0 (32 + MPC85xx_OPENPIC_IRQ_OFFSET) 244#define MPC85xx_IRQ_EXT0 (48 + MPC85xx_OPENPIC_IRQ_OFFSET)
239#define MPC85xx_IRQ_EXT1 (33 + MPC85xx_OPENPIC_IRQ_OFFSET) 245#define MPC85xx_IRQ_EXT1 (49 + MPC85xx_OPENPIC_IRQ_OFFSET)
240#define MPC85xx_IRQ_EXT2 (34 + MPC85xx_OPENPIC_IRQ_OFFSET) 246#define MPC85xx_IRQ_EXT2 (50 + MPC85xx_OPENPIC_IRQ_OFFSET)
241#define MPC85xx_IRQ_EXT3 (35 + MPC85xx_OPENPIC_IRQ_OFFSET) 247#define MPC85xx_IRQ_EXT3 (51 + MPC85xx_OPENPIC_IRQ_OFFSET)
242#define MPC85xx_IRQ_EXT4 (36 + MPC85xx_OPENPIC_IRQ_OFFSET) 248#define MPC85xx_IRQ_EXT4 (52 + MPC85xx_OPENPIC_IRQ_OFFSET)
243#define MPC85xx_IRQ_EXT5 (37 + MPC85xx_OPENPIC_IRQ_OFFSET) 249#define MPC85xx_IRQ_EXT5 (53 + MPC85xx_OPENPIC_IRQ_OFFSET)
244#define MPC85xx_IRQ_EXT6 (38 + MPC85xx_OPENPIC_IRQ_OFFSET) 250#define MPC85xx_IRQ_EXT6 (54 + MPC85xx_OPENPIC_IRQ_OFFSET)
245#define MPC85xx_IRQ_EXT7 (39 + MPC85xx_OPENPIC_IRQ_OFFSET) 251#define MPC85xx_IRQ_EXT7 (55 + MPC85xx_OPENPIC_IRQ_OFFSET)
246#define MPC85xx_IRQ_EXT8 (40 + MPC85xx_OPENPIC_IRQ_OFFSET) 252#define MPC85xx_IRQ_EXT8 (56 + MPC85xx_OPENPIC_IRQ_OFFSET)
247#define MPC85xx_IRQ_EXT9 (41 + MPC85xx_OPENPIC_IRQ_OFFSET) 253#define MPC85xx_IRQ_EXT9 (57 + MPC85xx_OPENPIC_IRQ_OFFSET)
248#define MPC85xx_IRQ_EXT10 (42 + MPC85xx_OPENPIC_IRQ_OFFSET) 254#define MPC85xx_IRQ_EXT10 (58 + MPC85xx_OPENPIC_IRQ_OFFSET)
249#define MPC85xx_IRQ_EXT11 (43 + MPC85xx_OPENPIC_IRQ_OFFSET) 255#define MPC85xx_IRQ_EXT11 (59 + MPC85xx_OPENPIC_IRQ_OFFSET)
250 256
251/* CPM related interrupts */ 257/* CPM related interrupts */
252#define SIU_INT_ERROR ((uint)0x00+CPM_IRQ_OFFSET) 258#define SIU_INT_ERROR ((uint)0x00+CPM_IRQ_OFFSET)
diff --git a/include/asm-ppc/mpc10x.h b/include/asm-ppc/mpc10x.h
index d8e7e2d6128e..f5196a4efbe0 100644
--- a/include/asm-ppc/mpc10x.h
+++ b/include/asm-ppc/mpc10x.h
@@ -159,6 +159,12 @@ extern unsigned long ioremap_base;
159#define MPC10X_MAPA_EUMB_BASE (ioremap_base - MPC10X_EUMB_SIZE) 159#define MPC10X_MAPA_EUMB_BASE (ioremap_base - MPC10X_EUMB_SIZE)
160#define MPC10X_MAPB_EUMB_BASE MPC10X_MAPA_EUMB_BASE 160#define MPC10X_MAPB_EUMB_BASE MPC10X_MAPA_EUMB_BASE
161 161
162enum ppc_sys_devices {
163 MPC10X_IIC1,
164 MPC10X_DMA0,
165 MPC10X_DMA1,
166 MPC10X_DUART,
167};
162 168
163int mpc10x_bridge_init(struct pci_controller *hose, 169int mpc10x_bridge_init(struct pci_controller *hose,
164 uint current_map, 170 uint current_map,
diff --git a/include/asm-ppc/mpc85xx.h b/include/asm-ppc/mpc85xx.h
index 22713e331585..516984ee14b5 100644
--- a/include/asm-ppc/mpc85xx.h
+++ b/include/asm-ppc/mpc85xx.h
@@ -25,7 +25,7 @@
25#ifdef CONFIG_MPC8540_ADS 25#ifdef CONFIG_MPC8540_ADS
26#include <platforms/85xx/mpc8540_ads.h> 26#include <platforms/85xx/mpc8540_ads.h>
27#endif 27#endif
28#ifdef CONFIG_MPC8555_CDS 28#if defined(CONFIG_MPC8555_CDS) || defined(CONFIG_MPC8548_CDS)
29#include <platforms/85xx/mpc8555_cds.h> 29#include <platforms/85xx/mpc8555_cds.h>
30#endif 30#endif
31#ifdef CONFIG_MPC8560_ADS 31#ifdef CONFIG_MPC8560_ADS
@@ -74,7 +74,7 @@ extern unsigned char __res[];
74#define MPC85xx_GUTS_OFFSET (0xe0000) 74#define MPC85xx_GUTS_OFFSET (0xe0000)
75#define MPC85xx_GUTS_SIZE (0x01000) 75#define MPC85xx_GUTS_SIZE (0x01000)
76#define MPC85xx_IIC1_OFFSET (0x03000) 76#define MPC85xx_IIC1_OFFSET (0x03000)
77#define MPC85xx_IIC1_SIZE (0x01000) 77#define MPC85xx_IIC1_SIZE (0x00100)
78#define MPC85xx_OPENPIC_OFFSET (0x40000) 78#define MPC85xx_OPENPIC_OFFSET (0x40000)
79#define MPC85xx_OPENPIC_SIZE (0x40000) 79#define MPC85xx_OPENPIC_SIZE (0x40000)
80#define MPC85xx_PCI1_OFFSET (0x08000) 80#define MPC85xx_PCI1_OFFSET (0x08000)
@@ -127,8 +127,64 @@ enum ppc_sys_devices {
127 MPC85xx_CPM_MCC2, 127 MPC85xx_CPM_MCC2,
128 MPC85xx_CPM_SMC1, 128 MPC85xx_CPM_SMC1,
129 MPC85xx_CPM_SMC2, 129 MPC85xx_CPM_SMC2,
130 MPC85xx_eTSEC1,
131 MPC85xx_eTSEC2,
132 MPC85xx_eTSEC3,
133 MPC85xx_eTSEC4,
134 MPC85xx_IIC2,
130}; 135};
131 136
137/* Internal interrupts are all Level Sensitive, and Positive Polarity */
138#define MPC85XX_INTERNAL_IRQ_SENSES \
139 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 0 */ \
140 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 1 */ \
141 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 2 */ \
142 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 3 */ \
143 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 4 */ \
144 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 5 */ \
145 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 6 */ \
146 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 7 */ \
147 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 8 */ \
148 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 9 */ \
149 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 10 */ \
150 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 11 */ \
151 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 12 */ \
152 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 13 */ \
153 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 14 */ \
154 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 15 */ \
155 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 16 */ \
156 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 17 */ \
157 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 18 */ \
158 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 19 */ \
159 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 20 */ \
160 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 21 */ \
161 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 22 */ \
162 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 23 */ \
163 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 24 */ \
164 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 25 */ \
165 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 26 */ \
166 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 27 */ \
167 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 28 */ \
168 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 29 */ \
169 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 30 */ \
170 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 31 */ \
171 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 32 */ \
172 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 33 */ \
173 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 34 */ \
174 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 35 */ \
175 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 36 */ \
176 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 37 */ \
177 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 38 */ \
178 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 39 */ \
179 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 40 */ \
180 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 41 */ \
181 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 42 */ \
182 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 43 */ \
183 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 44 */ \
184 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 45 */ \
185 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 46 */ \
186 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE) /* Internal 47 */
187
132#endif /* CONFIG_85xx */ 188#endif /* CONFIG_85xx */
133#endif /* __ASM_MPC85xx_H__ */ 189#endif /* __ASM_MPC85xx_H__ */
134#endif /* __KERNEL__ */ 190#endif /* __KERNEL__ */
diff --git a/include/asm-ppc/pgtable.h b/include/asm-ppc/pgtable.h
index a38606d15549..4d4b20c9de78 100644
--- a/include/asm-ppc/pgtable.h
+++ b/include/asm-ppc/pgtable.h
@@ -267,8 +267,6 @@ extern unsigned long ioremap_bot, ioremap_base;
267#define _PMD_PRESENT_MASK (PAGE_MASK) 267#define _PMD_PRESENT_MASK (PAGE_MASK)
268#define _PMD_BAD (~PAGE_MASK) 268#define _PMD_BAD (~PAGE_MASK)
269 269
270#define NUM_TLBCAMS (16)
271
272#elif defined(CONFIG_8xx) 270#elif defined(CONFIG_8xx)
273/* Definitions for 8xx embedded chips. */ 271/* Definitions for 8xx embedded chips. */
274#define _PAGE_PRESENT 0x0001 /* Page is valid */ 272#define _PAGE_PRESENT 0x0001 /* Page is valid */
diff --git a/include/asm-ppc/ppc_sys.h b/include/asm-ppc/ppc_sys.h
index 24b991c42769..8ea624566231 100644
--- a/include/asm-ppc/ppc_sys.h
+++ b/include/asm-ppc/ppc_sys.h
@@ -27,6 +27,8 @@
27#include <asm/mpc85xx.h> 27#include <asm/mpc85xx.h>
28#elif defined(CONFIG_PPC_MPC52xx) 28#elif defined(CONFIG_PPC_MPC52xx)
29#include <asm/mpc52xx.h> 29#include <asm/mpc52xx.h>
30#elif defined(CONFIG_MPC10X_BRIDGE)
31#include <asm/mpc10x.h>
30#else 32#else
31#error "need definition of ppc_sys_devices" 33#error "need definition of ppc_sys_devices"
32#endif 34#endif
diff --git a/include/asm-ppc/smp.h b/include/asm-ppc/smp.h
index ebfb614f55f6..17530c232c76 100644
--- a/include/asm-ppc/smp.h
+++ b/include/asm-ppc/smp.h
@@ -44,7 +44,7 @@ extern void smp_message_recv(int, struct pt_regs *);
44#define NO_PROC_ID 0xFF /* No processor magic marker */ 44#define NO_PROC_ID 0xFF /* No processor magic marker */
45#define PROC_CHANGE_PENALTY 20 45#define PROC_CHANGE_PENALTY 20
46 46
47#define smp_processor_id() (current_thread_info()->cpu) 47#define raw_smp_processor_id() (current_thread_info()->cpu)
48 48
49extern int __cpu_up(unsigned int cpu); 49extern int __cpu_up(unsigned int cpu);
50 50
diff --git a/include/asm-ppc64/dma.h b/include/asm-ppc64/dma.h
index d693b8026bc3..dfd1f69059ba 100644
--- a/include/asm-ppc64/dma.h
+++ b/include/asm-ppc64/dma.h
@@ -27,6 +27,8 @@
27/* Doesn't really apply... */ 27/* Doesn't really apply... */
28#define MAX_DMA_ADDRESS (~0UL) 28#define MAX_DMA_ADDRESS (~0UL)
29 29
30#if !defined(CONFIG_PPC_ISERIES) || defined(CONFIG_PCI)
31
30#define dma_outb outb 32#define dma_outb outb
31#define dma_inb inb 33#define dma_inb inb
32 34
@@ -323,4 +325,5 @@ extern int isa_dma_bridge_buggy;
323#else 325#else
324#define isa_dma_bridge_buggy (0) 326#define isa_dma_bridge_buggy (0)
325#endif 327#endif
328#endif /* !defined(CONFIG_PPC_ISERIES) || defined(CONFIG_PCI) */
326#endif /* _ASM_DMA_H */ 329#endif /* _ASM_DMA_H */
diff --git a/include/asm-ppc64/iSeries/HvCall.h b/include/asm-ppc64/iSeries/HvCall.h
index d9a2e74e2399..c3f19475c0d9 100644
--- a/include/asm-ppc64/iSeries/HvCall.h
+++ b/include/asm-ppc64/iSeries/HvCall.h
@@ -1,84 +1,36 @@
1/* 1/*
2 * HvCall.h 2 * HvCall.h
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation 3 * Copyright (C) 2001 Mike Corrigan IBM Corporation
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 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 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 7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version. 8 * (at your option) any later version.
9 * 9 *
10 * This program is distributed in the hope that it will be useful, 10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU General Public License 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 16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */ 18 */
19 19/*
20//=========================================================================== 20 * This file contains the "hypervisor call" interface which is used to
21// 21 * drive the hypervisor from the OS.
22// This file contains the "hypervisor call" interface which is used to 22 */
23// drive the hypervisor from the OS.
24//
25//===========================================================================
26#ifndef _HVCALL_H 23#ifndef _HVCALL_H
27#define _HVCALL_H 24#define _HVCALL_H
28 25
29//-------------------------------------------------------------------
30// Standard Includes
31//-------------------------------------------------------------------
32#include <asm/iSeries/HvCallSc.h> 26#include <asm/iSeries/HvCallSc.h>
33#include <asm/iSeries/HvTypes.h> 27#include <asm/iSeries/HvTypes.h>
34#include <asm/paca.h> 28#include <asm/paca.h>
35 29
36/*
37enum HvCall_ReturnCode
38{
39 HvCall_Good = 0,
40 HvCall_Partial = 1,
41 HvCall_NotOwned = 2,
42 HvCall_NotFreed = 3,
43 HvCall_UnspecifiedError = 4
44};
45
46enum HvCall_TypeOfSIT
47{
48 HvCall_ReduceOnly = 0,
49 HvCall_Unconditional = 1
50};
51
52enum HvCall_TypeOfYield
53{
54 HvCall_YieldTimed = 0, // Yield until specified time
55 HvCall_YieldToActive = 1, // Yield until all active procs have run
56 HvCall_YieldToProc = 2 // Yield until the specified processor has run
57};
58
59enum HvCall_InterruptMasks
60{
61 HvCall_MaskIPI = 0x00000001,
62 HvCall_MaskLpEvent = 0x00000002,
63 HvCall_MaskLpProd = 0x00000004,
64 HvCall_MaskTimeout = 0x00000008
65};
66
67enum HvCall_VaryOffChunkRc
68{
69 HvCall_VaryOffSucceeded = 0,
70 HvCall_VaryOffWithdrawn = 1,
71 HvCall_ChunkInLoadArea = 2,
72 HvCall_ChunkInHPT = 3,
73 HvCall_ChunkNotAccessible = 4,
74 HvCall_ChunkInUse = 5
75};
76*/
77
78/* Type of yield for HvCallBaseYieldProcessor */ 30/* Type of yield for HvCallBaseYieldProcessor */
79#define HvCall_YieldTimed 0 // Yield until specified time (tb) 31#define HvCall_YieldTimed 0 /* Yield until specified time (tb) */
80#define HvCall_YieldToActive 1 // Yield until all active procs have run 32#define HvCall_YieldToActive 1 /* Yield until all active procs have run */
81#define HvCall_YieldToProc 2 // Yield until the specified processor has run 33#define HvCall_YieldToProc 2 /* Yield until the specified processor has run */
82 34
83/* interrupt masks for setEnabledInterrupts */ 35/* interrupt masks for setEnabledInterrupts */
84#define HvCall_MaskIPI 0x00000001 36#define HvCall_MaskIPI 0x00000001
@@ -86,7 +38,7 @@ enum HvCall_VaryOffChunkRc
86#define HvCall_MaskLpProd 0x00000004 38#define HvCall_MaskLpProd 0x00000004
87#define HvCall_MaskTimeout 0x00000008 39#define HvCall_MaskTimeout 0x00000008
88 40
89/* Log buffer formats */ 41/* Log buffer formats */
90#define HvCall_LogBuffer_ASCII 0 42#define HvCall_LogBuffer_ASCII 0
91#define HvCall_LogBuffer_EBCDIC 1 43#define HvCall_LogBuffer_EBCDIC 1
92 44
@@ -95,7 +47,7 @@ enum HvCall_VaryOffChunkRc
95#define HvCallBaseGetHwPatch HvCallBase + 2 47#define HvCallBaseGetHwPatch HvCallBase + 2
96#define HvCallBaseReIplSpAttn HvCallBase + 3 48#define HvCallBaseReIplSpAttn HvCallBase + 3
97#define HvCallBaseSetASR HvCallBase + 4 49#define HvCallBaseSetASR HvCallBase + 4
98#define HvCallBaseSetASRAndRfi HvCallBase + 5 50#define HvCallBaseSetASRAndRfi HvCallBase + 5
99#define HvCallBaseSetIMR HvCallBase + 6 51#define HvCallBaseSetIMR HvCallBase + 6
100#define HvCallBaseSendIPI HvCallBase + 7 52#define HvCallBaseSendIPI HvCallBase + 7
101#define HvCallBaseTerminateMachine HvCallBase + 8 53#define HvCallBaseTerminateMachine HvCallBase + 8
@@ -115,91 +67,47 @@ enum HvCall_VaryOffChunkRc
115#define HvCallBaseGetLogBufferCodePage HvCallBase + 22 67#define HvCallBaseGetLogBufferCodePage HvCallBase + 22
116#define HvCallBaseGetLogBufferFormat HvCallBase + 23 68#define HvCallBaseGetLogBufferFormat HvCallBase + 23
117#define HvCallBaseGetLogBufferLength HvCallBase + 24 69#define HvCallBaseGetLogBufferLength HvCallBase + 24
118#define HvCallBaseReadLogBuffer HvCallBase + 25 70#define HvCallBaseReadLogBuffer HvCallBase + 25
119#define HvCallBaseSetLogBufferFormatAndCodePage HvCallBase + 26 71#define HvCallBaseSetLogBufferFormatAndCodePage HvCallBase + 26
120#define HvCallBaseWriteLogBuffer HvCallBase + 27 72#define HvCallBaseWriteLogBuffer HvCallBase + 27
121#define HvCallBaseRouter28 HvCallBase + 28 73#define HvCallBaseRouter28 HvCallBase + 28
122#define HvCallBaseRouter29 HvCallBase + 29 74#define HvCallBaseRouter29 HvCallBase + 29
123#define HvCallBaseRouter30 HvCallBase + 30 75#define HvCallBaseRouter30 HvCallBase + 30
124#define HvCallBaseSetDebugBus HvCallBase + 31 76#define HvCallBaseSetDebugBus HvCallBase + 31
125 77
126#define HvCallCcSetDABR HvCallCc + 7 78#define HvCallCcSetDABR HvCallCc + 7
127 79
128//===================================================================================== 80static inline void HvCall_setVirtualDecr(void)
129static inline void HvCall_setVirtualDecr(void)
130{ 81{
131 /* Ignore any error return codes - most likely means that the target value for the 82 /*
132 * LP has been increased and this vary off would bring us below the new target. */ 83 * Ignore any error return codes - most likely means that the
84 * target value for the LP has been increased and this vary off
85 * would bring us below the new target.
86 */
133 HvCall0(HvCallBaseSetVirtualDecr); 87 HvCall0(HvCallBaseSetVirtualDecr);
134} 88}
135//=====================================================================
136static inline void HvCall_yieldProcessor(unsigned typeOfYield, u64 yieldParm)
137{
138 HvCall2( HvCallBaseYieldProcessor, typeOfYield, yieldParm );
139}
140//=====================================================================
141static inline void HvCall_setEnabledInterrupts(u64 enabledInterrupts)
142{
143 HvCall1(HvCallBaseSetEnabledInterrupts,enabledInterrupts);
144}
145
146//=====================================================================
147static inline void HvCall_clearLogBuffer(HvLpIndex lpindex)
148{
149 HvCall1(HvCallBaseClearLogBuffer,lpindex);
150}
151
152//=====================================================================
153static inline u32 HvCall_getLogBufferCodePage(HvLpIndex lpindex)
154{
155 u32 retVal = HvCall1(HvCallBaseGetLogBufferCodePage,lpindex);
156 return retVal;
157}
158
159//=====================================================================
160static inline int HvCall_getLogBufferFormat(HvLpIndex lpindex)
161{
162 int retVal = HvCall1(HvCallBaseGetLogBufferFormat,lpindex);
163 return retVal;
164}
165
166//=====================================================================
167static inline u32 HvCall_getLogBufferLength(HvLpIndex lpindex)
168{
169 u32 retVal = HvCall1(HvCallBaseGetLogBufferLength,lpindex);
170 return retVal;
171}
172 89
173//===================================================================== 90static inline void HvCall_yieldProcessor(unsigned typeOfYield, u64 yieldParm)
174static inline void HvCall_setLogBufferFormatAndCodepage(int format, u32 codePage)
175{ 91{
176 HvCall2(HvCallBaseSetLogBufferFormatAndCodePage,format, codePage); 92 HvCall2(HvCallBaseYieldProcessor, typeOfYield, yieldParm);
177} 93}
178 94
179//===================================================================== 95static inline void HvCall_setEnabledInterrupts(u64 enabledInterrupts)
180int HvCall_readLogBuffer(HvLpIndex lpindex, void *buffer, u64 bufLen);
181void HvCall_writeLogBuffer(const void *buffer, u64 bufLen);
182
183//=====================================================================
184static inline void HvCall_sendIPI(struct paca_struct * targetPaca)
185{ 96{
186 HvCall1( HvCallBaseSendIPI, targetPaca->paca_index ); 97 HvCall1(HvCallBaseSetEnabledInterrupts, enabledInterrupts);
187} 98}
188 99
189//===================================================================== 100static inline void HvCall_setLogBufferFormatAndCodepage(int format,
190static inline void HvCall_terminateMachineSrc(void) 101 u32 codePage)
191{ 102{
192 HvCall0( HvCallBaseTerminateMachineSrc ); 103 HvCall2(HvCallBaseSetLogBufferFormatAndCodePage, format, codePage);
193} 104}
194 105
195static inline void HvCall_setDABR(unsigned long val) 106extern void HvCall_writeLogBuffer(const void *buffer, u64 bufLen);
196{
197 HvCall1(HvCallCcSetDABR, val);
198}
199 107
200static inline void HvCall_setDebugBus(unsigned long val) 108static inline void HvCall_sendIPI(struct paca_struct *targetPaca)
201{ 109{
202 HvCall1(HvCallBaseSetDebugBus, val); 110 HvCall1(HvCallBaseSendIPI, targetPaca->paca_index);
203} 111}
204 112
205#endif /* _HVCALL_H */ 113#endif /* _HVCALL_H */
diff --git a/include/asm-ppc64/iSeries/HvCallCfg.h b/include/asm-ppc64/iSeries/HvCallCfg.h
deleted file mode 100644
index 9f40f16de533..000000000000
--- a/include/asm-ppc64/iSeries/HvCallCfg.h
+++ /dev/null
@@ -1,213 +0,0 @@
1/*
2 * HvCallCfg.h
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20//=====================================================================================
21//
22// This file contains the "hypervisor call" interface which is used to
23// drive the hypervisor from the OS.
24//
25//=====================================================================================
26#ifndef _HVCALLCFG_H
27#define _HVCALLCFG_H
28
29//-------------------------------------------------------------------
30// Standard Includes
31//-------------------------------------------------------------------
32#include <asm/iSeries/HvCallSc.h>
33#include <asm/iSeries/HvTypes.h>
34
35//-------------------------------------------------------------------------------------
36// Constants
37//-------------------------------------------------------------------------------------
38
39enum HvCallCfg_ReqQual
40{
41 HvCallCfg_Cur = 0,
42 HvCallCfg_Init = 1,
43 HvCallCfg_Max = 2,
44 HvCallCfg_Min = 3
45};
46
47#define HvCallCfgGetLps HvCallCfg + 0
48#define HvCallCfgGetActiveLpMap HvCallCfg + 1
49#define HvCallCfgGetLpVrmIndex HvCallCfg + 2
50#define HvCallCfgGetLpMinSupportedPlicVrmIndex HvCallCfg + 3
51#define HvCallCfgGetLpMinCompatablePlicVrmIndex HvCallCfg + 4
52#define HvCallCfgGetLpVrmName HvCallCfg + 5
53#define HvCallCfgGetSystemPhysicalProcessors HvCallCfg + 6
54#define HvCallCfgGetPhysicalProcessors HvCallCfg + 7
55#define HvCallCfgGetSystemMsChunks HvCallCfg + 8
56#define HvCallCfgGetMsChunks HvCallCfg + 9
57#define HvCallCfgGetInteractivePercentage HvCallCfg + 10
58#define HvCallCfgIsBusDedicated HvCallCfg + 11
59#define HvCallCfgGetBusOwner HvCallCfg + 12
60#define HvCallCfgGetBusAllocation HvCallCfg + 13
61#define HvCallCfgGetBusUnitOwner HvCallCfg + 14
62#define HvCallCfgGetBusUnitAllocation HvCallCfg + 15
63#define HvCallCfgGetVirtualBusPool HvCallCfg + 16
64#define HvCallCfgGetBusUnitInterruptProc HvCallCfg + 17
65#define HvCallCfgGetConfiguredBusUnitsForIntProc HvCallCfg + 18
66#define HvCallCfgGetRioSanBusPool HvCallCfg + 19
67#define HvCallCfgGetSharedPoolIndex HvCallCfg + 20
68#define HvCallCfgGetSharedProcUnits HvCallCfg + 21
69#define HvCallCfgGetNumProcsInSharedPool HvCallCfg + 22
70#define HvCallCfgRouter23 HvCallCfg + 23
71#define HvCallCfgRouter24 HvCallCfg + 24
72#define HvCallCfgRouter25 HvCallCfg + 25
73#define HvCallCfgRouter26 HvCallCfg + 26
74#define HvCallCfgRouter27 HvCallCfg + 27
75#define HvCallCfgGetMinRuntimeMsChunks HvCallCfg + 28
76#define HvCallCfgSetMinRuntimeMsChunks HvCallCfg + 29
77#define HvCallCfgGetVirtualLanIndexMap HvCallCfg + 30
78#define HvCallCfgGetLpExecutionMode HvCallCfg + 31
79#define HvCallCfgGetHostingLpIndex HvCallCfg + 32
80
81//====================================================================
82static inline HvLpIndex HvCallCfg_getLps(void)
83{
84 HvLpIndex retVal = HvCall0(HvCallCfgGetLps);
85 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
86 return retVal;
87}
88//====================================================================
89static inline int HvCallCfg_isBusDedicated(u64 busIndex)
90{
91 int retVal = HvCall1(HvCallCfgIsBusDedicated,busIndex);
92 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
93 return retVal;
94}
95//====================================================================
96static inline HvLpIndex HvCallCfg_getBusOwner(u64 busIndex)
97{
98 HvLpIndex retVal = HvCall1(HvCallCfgGetBusOwner,busIndex);
99 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
100 return retVal;
101}
102//====================================================================
103static inline HvLpIndexMap HvCallCfg_getBusAllocation(u64 busIndex)
104{
105 HvLpIndexMap retVal = HvCall1(HvCallCfgGetBusAllocation,busIndex);
106 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
107 return retVal;
108}
109//====================================================================
110static inline HvLpIndexMap HvCallCfg_getActiveLpMap(void)
111{
112 HvLpIndexMap retVal = HvCall0(HvCallCfgGetActiveLpMap);
113 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
114 return retVal;
115}
116//====================================================================
117static inline HvLpVirtualLanIndexMap HvCallCfg_getVirtualLanIndexMap(HvLpIndex lp)
118{
119 // This is a new function in V5R1 so calls to this on older
120 // hypervisors will return -1
121 u64 retVal = HvCall1(HvCallCfgGetVirtualLanIndexMap, lp);
122 if(retVal == -1)
123 retVal = 0;
124 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
125 return retVal;
126}
127//===================================================================
128static inline u64 HvCallCfg_getSystemMsChunks(void)
129{
130 u64 retVal = HvCall0(HvCallCfgGetSystemMsChunks);
131 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
132 return retVal;
133}
134//===================================================================
135static inline u64 HvCallCfg_getMsChunks(HvLpIndex lp,enum HvCallCfg_ReqQual qual)
136{
137 u64 retVal = HvCall2(HvCallCfgGetMsChunks,lp,qual);
138 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
139 return retVal;
140}
141//===================================================================
142static inline u64 HvCallCfg_getMinRuntimeMsChunks(HvLpIndex lp)
143{
144 // NOTE: This function was added in v5r1 so older hypervisors will return a -1 value
145 u64 retVal = HvCall1(HvCallCfgGetMinRuntimeMsChunks,lp);
146 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
147 return retVal;
148}
149//===================================================================
150static inline u64 HvCallCfg_setMinRuntimeMsChunks(u64 chunks)
151{
152 u64 retVal = HvCall1(HvCallCfgSetMinRuntimeMsChunks,chunks);
153 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
154 return retVal;
155}
156//===================================================================
157static inline u64 HvCallCfg_getSystemPhysicalProcessors(void)
158{
159 u64 retVal = HvCall0(HvCallCfgGetSystemPhysicalProcessors);
160 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
161 return retVal;
162}
163//===================================================================
164static inline u64 HvCallCfg_getPhysicalProcessors(HvLpIndex lp,enum HvCallCfg_ReqQual qual)
165{
166 u64 retVal = HvCall2(HvCallCfgGetPhysicalProcessors,lp,qual);
167 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
168 return retVal;
169}
170//===================================================================
171static inline u64 HvCallCfg_getConfiguredBusUnitsForInterruptProc(HvLpIndex lp,
172 u16 hvLogicalProcIndex)
173{
174 u64 retVal = HvCall2(HvCallCfgGetConfiguredBusUnitsForIntProc,lp,hvLogicalProcIndex);
175 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
176 return retVal;
177
178}
179//==================================================================
180static inline HvLpSharedPoolIndex HvCallCfg_getSharedPoolIndex(HvLpIndex lp)
181{
182 HvLpSharedPoolIndex retVal =
183 HvCall1(HvCallCfgGetSharedPoolIndex,lp);
184 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
185 return retVal;
186
187}
188//==================================================================
189static inline u64 HvCallCfg_getSharedProcUnits(HvLpIndex lp,enum HvCallCfg_ReqQual qual)
190{
191 u64 retVal = HvCall2(HvCallCfgGetSharedProcUnits,lp,qual);
192 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
193 return retVal;
194
195}
196//==================================================================
197static inline u64 HvCallCfg_getNumProcsInSharedPool(HvLpSharedPoolIndex sPI)
198{
199 u16 retVal = HvCall1(HvCallCfgGetNumProcsInSharedPool,sPI);
200 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
201 return retVal;
202
203}
204//==================================================================
205static inline HvLpIndex HvCallCfg_getHostingLpIndex(HvLpIndex lp)
206{
207 u64 retVal = HvCall1(HvCallCfgGetHostingLpIndex,lp);
208 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
209 return retVal;
210
211}
212
213#endif /* _HVCALLCFG_H */
diff --git a/include/asm-ppc64/iSeries/HvCallEvent.h b/include/asm-ppc64/iSeries/HvCallEvent.h
index 191ddce0c2c6..5d9a327d0122 100644
--- a/include/asm-ppc64/iSeries/HvCallEvent.h
+++ b/include/asm-ppc64/iSeries/HvCallEvent.h
@@ -1,32 +1,28 @@
1/* 1/*
2 * HvCallEvent.h 2 * HvCallEvent.h
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation 3 * Copyright (C) 2001 Mike Corrigan IBM Corporation
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 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 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 7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version. 8 * (at your option) any later version.
9 * 9 *
10 * This program is distributed in the hope that it will be useful, 10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU General Public License 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 16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */ 18 */
19
20/* 19/*
21 * This file contains the "hypervisor call" interface which is used to 20 * This file contains the "hypervisor call" interface which is used to
22 * drive the hypervisor from the OS. 21 * drive the hypervisor from the OS.
23 */ 22 */
24#ifndef _HVCALLEVENT_H 23#ifndef _HVCALLEVENT_H
25#define _HVCALLEVENT_H 24#define _HVCALLEVENT_H
26 25
27/*
28 * Standard Includes
29 */
30#include <asm/iSeries/HvCallSc.h> 26#include <asm/iSeries/HvCallSc.h>
31#include <asm/iSeries/HvTypes.h> 27#include <asm/iSeries/HvTypes.h>
32#include <asm/abs_addr.h> 28#include <asm/abs_addr.h>
@@ -71,7 +67,7 @@ typedef u64 HvLpDma_Rc;
71#define HvCallEventCloseLpEventPath HvCallEvent + 2 67#define HvCallEventCloseLpEventPath HvCallEvent + 2
72#define HvCallEventDmaBufList HvCallEvent + 3 68#define HvCallEventDmaBufList HvCallEvent + 3
73#define HvCallEventDmaSingle HvCallEvent + 4 69#define HvCallEventDmaSingle HvCallEvent + 4
74#define HvCallEventDmaToSp HvCallEvent + 5 70#define HvCallEventDmaToSp HvCallEvent + 5
75#define HvCallEventGetOverflowLpEvents HvCallEvent + 6 71#define HvCallEventGetOverflowLpEvents HvCallEvent + 6
76#define HvCallEventGetSourceLpInstanceId HvCallEvent + 7 72#define HvCallEventGetSourceLpInstanceId HvCallEvent + 7
77#define HvCallEventGetTargetLpInstanceId HvCallEvent + 8 73#define HvCallEventGetTargetLpInstanceId HvCallEvent + 8
@@ -85,14 +81,12 @@ typedef u64 HvLpDma_Rc;
85 81
86static inline void HvCallEvent_getOverflowLpEvents(u8 queueIndex) 82static inline void HvCallEvent_getOverflowLpEvents(u8 queueIndex)
87{ 83{
88 HvCall1(HvCallEventGetOverflowLpEvents,queueIndex); 84 HvCall1(HvCallEventGetOverflowLpEvents, queueIndex);
89 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
90} 85}
91 86
92static inline void HvCallEvent_setInterLpQueueIndex(u8 queueIndex) 87static inline void HvCallEvent_setInterLpQueueIndex(u8 queueIndex)
93{ 88{
94 HvCall1(HvCallEventSetInterLpQueueIndex,queueIndex); 89 HvCall1(HvCallEventSetInterLpQueueIndex, queueIndex);
95 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
96} 90}
97 91
98static inline void HvCallEvent_setLpEventStack(u8 queueIndex, 92static inline void HvCallEvent_setLpEventStack(u8 queueIndex,
@@ -103,7 +97,6 @@ static inline void HvCallEvent_setLpEventStack(u8 queueIndex,
103 abs_addr = virt_to_abs(eventStackAddr); 97 abs_addr = virt_to_abs(eventStackAddr);
104 HvCall3(HvCallEventSetLpEventStack, queueIndex, abs_addr, 98 HvCall3(HvCallEventSetLpEventStack, queueIndex, abs_addr,
105 eventStackSize); 99 eventStackSize);
106 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
107} 100}
108 101
109static inline void HvCallEvent_setLpEventQueueInterruptProc(u8 queueIndex, 102static inline void HvCallEvent_setLpEventQueueInterruptProc(u8 queueIndex,
@@ -111,22 +104,18 @@ static inline void HvCallEvent_setLpEventQueueInterruptProc(u8 queueIndex,
111{ 104{
112 HvCall2(HvCallEventSetLpEventQueueInterruptProc, queueIndex, 105 HvCall2(HvCallEventSetLpEventQueueInterruptProc, queueIndex,
113 lpLogicalProcIndex); 106 lpLogicalProcIndex);
114 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
115} 107}
116 108
117static inline HvLpEvent_Rc HvCallEvent_signalLpEvent(struct HvLpEvent *event) 109static inline HvLpEvent_Rc HvCallEvent_signalLpEvent(struct HvLpEvent *event)
118{ 110{
119 u64 abs_addr; 111 u64 abs_addr;
120 HvLpEvent_Rc retVal;
121 112
122#ifdef DEBUG_SENDEVENT 113#ifdef DEBUG_SENDEVENT
123 printk("HvCallEvent_signalLpEvent: *event = %016lx\n ", 114 printk("HvCallEvent_signalLpEvent: *event = %016lx\n ",
124 (unsigned long)event); 115 (unsigned long)event);
125#endif 116#endif
126 abs_addr = virt_to_abs(event); 117 abs_addr = virt_to_abs(event);
127 retVal = (HvLpEvent_Rc)HvCall1(HvCallEventSignalLpEvent, abs_addr); 118 return HvCall1(HvCallEventSignalLpEvent, abs_addr);
128 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
129 return retVal;
130} 119}
131 120
132static inline HvLpEvent_Rc HvCallEvent_signalLpEventFast(HvLpIndex targetLp, 121static inline HvLpEvent_Rc HvCallEvent_signalLpEventFast(HvLpIndex targetLp,
@@ -136,9 +125,7 @@ static inline HvLpEvent_Rc HvCallEvent_signalLpEventFast(HvLpIndex targetLp,
136 u64 eventData1, u64 eventData2, u64 eventData3, 125 u64 eventData1, u64 eventData2, u64 eventData3,
137 u64 eventData4, u64 eventData5) 126 u64 eventData4, u64 eventData5)
138{ 127{
139 HvLpEvent_Rc retVal; 128 /* Pack the misc bits into a single Dword to pass to PLIC */
140
141 // Pack the misc bits into a single Dword to pass to PLIC
142 union { 129 union {
143 struct HvCallEvent_PackedParms parms; 130 struct HvCallEvent_PackedParms parms;
144 u64 dword; 131 u64 dword;
@@ -152,67 +139,49 @@ static inline HvLpEvent_Rc HvCallEvent_signalLpEventFast(HvLpIndex targetLp,
152 packed.parms.xSourceInstId = sourceInstanceId; 139 packed.parms.xSourceInstId = sourceInstanceId;
153 packed.parms.xTargetInstId = targetInstanceId; 140 packed.parms.xTargetInstId = targetInstanceId;
154 141
155 retVal = (HvLpEvent_Rc)HvCall7(HvCallEventSignalLpEventParms, 142 return HvCall7(HvCallEventSignalLpEventParms, packed.dword,
156 packed.dword, correlationToken, eventData1,eventData2, 143 correlationToken, eventData1, eventData2,
157 eventData3,eventData4, eventData5); 144 eventData3, eventData4, eventData5);
158 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
159 return retVal;
160} 145}
161 146
162static inline HvLpEvent_Rc HvCallEvent_ackLpEvent(struct HvLpEvent *event) 147static inline HvLpEvent_Rc HvCallEvent_ackLpEvent(struct HvLpEvent *event)
163{ 148{
164 u64 abs_addr; 149 u64 abs_addr;
165 HvLpEvent_Rc retVal;
166 150
167 abs_addr = virt_to_abs(event); 151 abs_addr = virt_to_abs(event);
168 retVal = (HvLpEvent_Rc)HvCall1(HvCallEventAckLpEvent, abs_addr); 152 return HvCall1(HvCallEventAckLpEvent, abs_addr);
169 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
170 return retVal;
171} 153}
172 154
173static inline HvLpEvent_Rc HvCallEvent_cancelLpEvent(struct HvLpEvent *event) 155static inline HvLpEvent_Rc HvCallEvent_cancelLpEvent(struct HvLpEvent *event)
174{ 156{
175 u64 abs_addr; 157 u64 abs_addr;
176 HvLpEvent_Rc retVal;
177 158
178 abs_addr = virt_to_abs(event); 159 abs_addr = virt_to_abs(event);
179 retVal = (HvLpEvent_Rc)HvCall1(HvCallEventCancelLpEvent, abs_addr); 160 return HvCall1(HvCallEventCancelLpEvent, abs_addr);
180 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
181 return retVal;
182} 161}
183 162
184static inline HvLpInstanceId HvCallEvent_getSourceLpInstanceId( 163static inline HvLpInstanceId HvCallEvent_getSourceLpInstanceId(
185 HvLpIndex targetLp, HvLpEvent_Type type) 164 HvLpIndex targetLp, HvLpEvent_Type type)
186{ 165{
187 HvLpInstanceId retVal; 166 return HvCall2(HvCallEventGetSourceLpInstanceId, targetLp, type);
188
189 retVal = HvCall2(HvCallEventGetSourceLpInstanceId, targetLp, type);
190 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
191 return retVal;
192} 167}
193 168
194static inline HvLpInstanceId HvCallEvent_getTargetLpInstanceId( 169static inline HvLpInstanceId HvCallEvent_getTargetLpInstanceId(
195 HvLpIndex targetLp, HvLpEvent_Type type) 170 HvLpIndex targetLp, HvLpEvent_Type type)
196{ 171{
197 HvLpInstanceId retVal; 172 return HvCall2(HvCallEventGetTargetLpInstanceId, targetLp, type);
198
199 retVal = HvCall2(HvCallEventGetTargetLpInstanceId, targetLp, type);
200 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
201 return retVal;
202} 173}
203 174
204static inline void HvCallEvent_openLpEventPath(HvLpIndex targetLp, 175static inline void HvCallEvent_openLpEventPath(HvLpIndex targetLp,
205 HvLpEvent_Type type) 176 HvLpEvent_Type type)
206{ 177{
207 HvCall2(HvCallEventOpenLpEventPath, targetLp, type); 178 HvCall2(HvCallEventOpenLpEventPath, targetLp, type);
208 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
209} 179}
210 180
211static inline void HvCallEvent_closeLpEventPath(HvLpIndex targetLp, 181static inline void HvCallEvent_closeLpEventPath(HvLpIndex targetLp,
212 HvLpEvent_Type type) 182 HvLpEvent_Type type)
213{ 183{
214 HvCall2(HvCallEventCloseLpEventPath, targetLp, type); 184 HvCall2(HvCallEventCloseLpEventPath, targetLp, type);
215 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
216} 185}
217 186
218static inline HvLpDma_Rc HvCallEvent_dmaBufList(HvLpEvent_Type type, 187static inline HvLpDma_Rc HvCallEvent_dmaBufList(HvLpEvent_Type type,
@@ -224,8 +193,7 @@ static inline HvLpDma_Rc HvCallEvent_dmaBufList(HvLpEvent_Type type,
224 /* Do these need to be converted to absolute addresses? */ 193 /* Do these need to be converted to absolute addresses? */
225 u64 localBufList, u64 remoteBufList, u32 transferLength) 194 u64 localBufList, u64 remoteBufList, u32 transferLength)
226{ 195{
227 HvLpDma_Rc retVal; 196 /* Pack the misc bits into a single Dword to pass to PLIC */
228 // Pack the misc bits into a single Dword to pass to PLIC
229 union { 197 union {
230 struct HvCallEvent_PackedDmaParms parms; 198 struct HvCallEvent_PackedDmaParms parms;
231 u64 dword; 199 u64 dword;
@@ -241,11 +209,8 @@ static inline HvLpDma_Rc HvCallEvent_dmaBufList(HvLpEvent_Type type,
241 packed.parms.xLocalInstId = localInstanceId; 209 packed.parms.xLocalInstId = localInstanceId;
242 packed.parms.xRemoteInstId = remoteInstanceId; 210 packed.parms.xRemoteInstId = remoteInstanceId;
243 211
244 retVal = (HvLpDma_Rc)HvCall4(HvCallEventDmaBufList, 212 return HvCall4(HvCallEventDmaBufList, packed.dword, localBufList,
245 packed.dword, localBufList, remoteBufList, 213 remoteBufList, transferLength);
246 transferLength);
247 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
248 return retVal;
249} 214}
250 215
251static inline HvLpDma_Rc HvCallEvent_dmaSingle(HvLpEvent_Type type, 216static inline HvLpDma_Rc HvCallEvent_dmaSingle(HvLpEvent_Type type,
@@ -256,8 +221,7 @@ static inline HvLpDma_Rc HvCallEvent_dmaSingle(HvLpEvent_Type type,
256 HvLpDma_AddressType remoteAddressType, 221 HvLpDma_AddressType remoteAddressType,
257 u64 localAddrOrTce, u64 remoteAddrOrTce, u32 transferLength) 222 u64 localAddrOrTce, u64 remoteAddrOrTce, u32 transferLength)
258{ 223{
259 HvLpDma_Rc retVal; 224 /* Pack the misc bits into a single Dword to pass to PLIC */
260 // Pack the misc bits into a single Dword to pass to PLIC
261 union { 225 union {
262 struct HvCallEvent_PackedDmaParms parms; 226 struct HvCallEvent_PackedDmaParms parms;
263 u64 dword; 227 u64 dword;
@@ -273,25 +237,17 @@ static inline HvLpDma_Rc HvCallEvent_dmaSingle(HvLpEvent_Type type,
273 packed.parms.xLocalInstId = localInstanceId; 237 packed.parms.xLocalInstId = localInstanceId;
274 packed.parms.xRemoteInstId = remoteInstanceId; 238 packed.parms.xRemoteInstId = remoteInstanceId;
275 239
276 retVal = (HvLpDma_Rc)HvCall4(HvCallEventDmaSingle, 240 return (HvLpDma_Rc)HvCall4(HvCallEventDmaSingle, packed.dword,
277 packed.dword, localAddrOrTce, remoteAddrOrTce, 241 localAddrOrTce, remoteAddrOrTce, transferLength);
278 transferLength);
279 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
280 return retVal;
281} 242}
282 243
283static inline HvLpDma_Rc HvCallEvent_dmaToSp(void* local, u32 remote, 244static inline HvLpDma_Rc HvCallEvent_dmaToSp(void *local, u32 remote,
284 u32 length, HvLpDma_Direction dir) 245 u32 length, HvLpDma_Direction dir)
285{ 246{
286 u64 abs_addr; 247 u64 abs_addr;
287 HvLpDma_Rc retVal;
288 248
289 abs_addr = virt_to_abs(local); 249 abs_addr = virt_to_abs(local);
290 retVal = (HvLpDma_Rc)HvCall4(HvCallEventDmaToSp, abs_addr, remote, 250 return HvCall4(HvCallEventDmaToSp, abs_addr, remote, length, dir);
291 length, dir);
292 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
293 return retVal;
294} 251}
295 252
296
297#endif /* _HVCALLEVENT_H */ 253#endif /* _HVCALLEVENT_H */
diff --git a/include/asm-ppc64/iSeries/HvCallHpt.h b/include/asm-ppc64/iSeries/HvCallHpt.h
index da769873d18b..66f38222ff75 100644
--- a/include/asm-ppc64/iSeries/HvCallHpt.h
+++ b/include/asm-ppc64/iSeries/HvCallHpt.h
@@ -1,17 +1,17 @@
1/* 1/*
2 * HvCallHpt.h 2 * HvCallHpt.h
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation 3 * Copyright (C) 2001 Mike Corrigan IBM Corporation
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 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 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 7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version. 8 * (at your option) any later version.
9 * 9 *
10 * This program is distributed in the hope that it will be useful, 10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU General Public License 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 16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -19,21 +19,15 @@
19#ifndef _HVCALLHPT_H 19#ifndef _HVCALLHPT_H
20#define _HVCALLHPT_H 20#define _HVCALLHPT_H
21 21
22//============================================================================ 22/*
23// 23 * This file contains the "hypervisor call" interface which is used to
24// This file contains the "hypervisor call" interface which is used to 24 * drive the hypervisor from the OS.
25// drive the hypervisor from the OS. 25 */
26//
27//============================================================================
28 26
29#include <asm/iSeries/HvCallSc.h> 27#include <asm/iSeries/HvCallSc.h>
30#include <asm/iSeries/HvTypes.h> 28#include <asm/iSeries/HvTypes.h>
31#include <asm/mmu.h> 29#include <asm/mmu.h>
32 30
33//-----------------------------------------------------------------------------
34// Constants
35//-----------------------------------------------------------------------------
36
37#define HvCallHptGetHptAddress HvCallHpt + 0 31#define HvCallHptGetHptAddress HvCallHpt + 0
38#define HvCallHptGetHptPages HvCallHpt + 1 32#define HvCallHptGetHptPages HvCallHpt + 1
39#define HvCallHptSetPp HvCallHpt + 5 33#define HvCallHptSetPp HvCallHpt + 5
@@ -47,81 +41,63 @@
47#define HvCallHptInvalidateSetSwBitsGet HvCallHpt + 18 41#define HvCallHptInvalidateSetSwBitsGet HvCallHpt + 18
48 42
49 43
50//============================================================================ 44static inline u64 HvCallHpt_getHptAddress(void)
51static inline u64 HvCallHpt_getHptAddress(void)
52{ 45{
53 u64 retval = HvCall0(HvCallHptGetHptAddress); 46 return HvCall0(HvCallHptGetHptAddress);
54 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
55 return retval;
56} 47}
57//============================================================================ 48
58static inline u64 HvCallHpt_getHptPages(void) 49static inline u64 HvCallHpt_getHptPages(void)
59{ 50{
60 u64 retval = HvCall0(HvCallHptGetHptPages); 51 return HvCall0(HvCallHptGetHptPages);
61 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
62 return retval;
63} 52}
64//============================================================================= 53
65static inline void HvCallHpt_setPp(u32 hpteIndex, u8 value) 54static inline void HvCallHpt_setPp(u32 hpteIndex, u8 value)
66{ 55{
67 HvCall2( HvCallHptSetPp, hpteIndex, value ); 56 HvCall2(HvCallHptSetPp, hpteIndex, value);
68 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
69} 57}
70//============================================================================= 58
71static inline void HvCallHpt_setSwBits(u32 hpteIndex, u8 bitson, u8 bitsoff ) 59static inline void HvCallHpt_setSwBits(u32 hpteIndex, u8 bitson, u8 bitsoff)
72{ 60{
73 HvCall3( HvCallHptSetSwBits, hpteIndex, bitson, bitsoff ); 61 HvCall3(HvCallHptSetSwBits, hpteIndex, bitson, bitsoff);
74 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
75} 62}
76//============================================================================= 63
77static inline void HvCallHpt_invalidateNoSyncICache(u32 hpteIndex) 64static inline void HvCallHpt_invalidateNoSyncICache(u32 hpteIndex)
78
79{ 65{
80 HvCall1( HvCallHptInvalidateNoSyncICache, hpteIndex ); 66 HvCall1(HvCallHptInvalidateNoSyncICache, hpteIndex);
81 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
82} 67}
83//============================================================================= 68
84static inline u64 HvCallHpt_invalidateSetSwBitsGet(u32 hpteIndex, u8 bitson, u8 bitsoff ) 69static inline u64 HvCallHpt_invalidateSetSwBitsGet(u32 hpteIndex, u8 bitson,
85 70 u8 bitsoff)
86{ 71{
87 u64 compressedStatus; 72 u64 compressedStatus;
88 compressedStatus = HvCall4( HvCallHptInvalidateSetSwBitsGet, hpteIndex, bitson, bitsoff, 1 ); 73
89 HvCall1( HvCallHptInvalidateNoSyncICache, hpteIndex ); 74 compressedStatus = HvCall4(HvCallHptInvalidateSetSwBitsGet,
90 // getPaca()->adjustHmtForNoOfSpinLocksHeld(); 75 hpteIndex, bitson, bitsoff, 1);
76 HvCall1(HvCallHptInvalidateNoSyncICache, hpteIndex);
91 return compressedStatus; 77 return compressedStatus;
92} 78}
93//============================================================================= 79
94static inline u64 HvCallHpt_findValid( HPTE *hpte, u64 vpn ) 80static inline u64 HvCallHpt_findValid(HPTE *hpte, u64 vpn)
95{ 81{
96 u64 retIndex = HvCall3Ret16( HvCallHptFindValid, hpte, vpn, 0, 0 ); 82 return HvCall3Ret16(HvCallHptFindValid, hpte, vpn, 0, 0);
97 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
98 return retIndex;
99} 83}
100//============================================================================= 84
101static inline u64 HvCallHpt_findNextValid( HPTE *hpte, u32 hpteIndex, u8 bitson, u8 bitsoff ) 85static inline u64 HvCallHpt_findNextValid(HPTE *hpte, u32 hpteIndex,
86 u8 bitson, u8 bitsoff)
102{ 87{
103 u64 retIndex = HvCall3Ret16( HvCallHptFindNextValid, hpte, hpteIndex, bitson, bitsoff ); 88 return HvCall3Ret16(HvCallHptFindNextValid, hpte, hpteIndex,
104 // getPaca()->adjustHmtForNoOfSpinLocksHeld(); 89 bitson, bitsoff);
105 return retIndex;
106} 90}
107//============================================================================= 91
108static inline void HvCallHpt_get( HPTE *hpte, u32 hpteIndex ) 92static inline void HvCallHpt_get(HPTE *hpte, u32 hpteIndex)
109{ 93{
110 HvCall2Ret16( HvCallHptGet, hpte, hpteIndex, 0 ); 94 HvCall2Ret16(HvCallHptGet, hpte, hpteIndex, 0);
111 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
112} 95}
113//============================================================================ 96
114static inline void HvCallHpt_addValidate( u32 hpteIndex, 97static inline void HvCallHpt_addValidate(u32 hpteIndex, u32 hBit, HPTE *hpte)
115 u32 hBit,
116 HPTE *hpte )
117
118{ 98{
119 HvCall4( HvCallHptAddValidate, hpteIndex, 99 HvCall4(HvCallHptAddValidate, hpteIndex, hBit, (*((u64 *)hpte)),
120 hBit, (*((u64 *)hpte)), (*(((u64 *)hpte)+1)) ); 100 (*(((u64 *)hpte)+1)));
121 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
122} 101}
123 102
124
125//=============================================================================
126
127#endif /* _HVCALLHPT_H */ 103#endif /* _HVCALLHPT_H */
diff --git a/include/asm-ppc64/iSeries/HvCallPci.h b/include/asm-ppc64/iSeries/HvCallPci.h
index 6887b619288e..c8d675c40f5e 100644
--- a/include/asm-ppc64/iSeries/HvCallPci.h
+++ b/include/asm-ppc64/iSeries/HvCallPci.h
@@ -1,26 +1,26 @@
1/************************************************************************/ 1/*
2/* Provides the Hypervisor PCI calls for iSeries Linux Parition. */ 2 * Provides the Hypervisor PCI calls for iSeries Linux Parition.
3/* Copyright (C) 2001 <Wayne G Holm> <IBM Corporation> */ 3 * Copyright (C) 2001 <Wayne G Holm> <IBM Corporation>
4/* */ 4 *
5/* This program is free software; you can redistribute it and/or modify */ 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 */ 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 */ 7 * the Free Software Foundation; either version 2 of the License, or
8/* (at your option) any later version. */ 8 * (at your option) any later version.
9/* */ 9 *
10/* This program is distributed in the hope that it will be useful, */ 10 * This program is distributed in the hope that it will be useful,
11/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13/* GNU General Public License for more details. */ 13 * GNU General Public License for more details.
14/* */ 14 *
15/* You should have received a copy of the GNU General Public License */ 15 * You should have received a copy of the GNU General Public License
16/* along with this program; if not, write to the: */ 16 * along with this program; if not, write to the:
17/* Free Software Foundation, Inc., */ 17 * Free Software Foundation, Inc.,
18/* 59 Temple Place, Suite 330, */ 18 * 59 Temple Place, Suite 330,
19/* Boston, MA 02111-1307 USA */ 19 * Boston, MA 02111-1307 USA
20/************************************************************************/ 20 *
21/* Change Activity: */ 21 * Change Activity:
22/* Created, Jan 9, 2001 */ 22 * Created, Jan 9, 2001
23/************************************************************************/ 23 */
24 24
25#ifndef _HVCALLPCI_H 25#ifndef _HVCALLPCI_H
26#define _HVCALLPCI_H 26#define _HVCALLPCI_H
@@ -34,8 +34,8 @@
34 */ 34 */
35struct HvCallPci_DsaAddr { 35struct HvCallPci_DsaAddr {
36 u16 busNumber; /* PHB index? */ 36 u16 busNumber; /* PHB index? */
37 u8 subBusNumber; /* PCI bus number? */ 37 u8 subBusNumber; /* PCI bus number? */
38 u8 deviceId; /* device and function? */ 38 u8 deviceId; /* device and function? */
39 u8 barNumber; 39 u8 barNumber;
40 u8 reserved[3]; 40 u8 reserved[3];
41}; 41};
@@ -52,34 +52,37 @@ struct HvCallPci_LoadReturn {
52 52
53enum HvCallPci_DeviceType { 53enum HvCallPci_DeviceType {
54 HvCallPci_NodeDevice = 1, 54 HvCallPci_NodeDevice = 1,
55 HvCallPci_SpDevice = 2, 55 HvCallPci_SpDevice = 2,
56 HvCallPci_IopDevice = 3, 56 HvCallPci_IopDevice = 3,
57 HvCallPci_BridgeDevice = 4, 57 HvCallPci_BridgeDevice = 4,
58 HvCallPci_MultiFunctionDevice = 5, 58 HvCallPci_MultiFunctionDevice = 5,
59 HvCallPci_IoaDevice = 6 59 HvCallPci_IoaDevice = 6
60}; 60};
61 61
62 62
63struct HvCallPci_DeviceInfo { 63struct HvCallPci_DeviceInfo {
64 u32 deviceType; // See DeviceType enum for values 64 u32 deviceType; /* See DeviceType enum for values */
65}; 65};
66 66
67struct HvCallPci_BusUnitInfo { 67struct HvCallPci_BusUnitInfo {
68 u32 sizeReturned; // length of data returned 68 u32 sizeReturned; /* length of data returned */
69 u32 deviceType; // see DeviceType enum for values 69 u32 deviceType; /* see DeviceType enum for values */
70}; 70};
71 71
72struct HvCallPci_BridgeInfo { 72struct HvCallPci_BridgeInfo {
73 struct HvCallPci_BusUnitInfo busUnitInfo; // Generic bus unit info 73 struct HvCallPci_BusUnitInfo busUnitInfo; /* Generic bus unit info */
74 u8 subBusNumber; // Bus number of secondary bus 74 u8 subBusNumber; /* Bus number of secondary bus */
75 u8 maxAgents; // Max idsels on secondary bus 75 u8 maxAgents; /* Max idsels on secondary bus */
76 u8 maxSubBusNumber; // Max Sub Bus 76 u8 maxSubBusNumber; /* Max Sub Bus */
77 u8 logicalSlotNumber; // Logical Slot Number for IOA 77 u8 logicalSlotNumber; /* Logical Slot Number for IOA */
78}; 78};
79
80 79
81// Maximum BusUnitInfo buffer size. Provided for clients so they can allocate 80
82// a buffer big enough for any type of bus unit. Increase as needed. 81/*
82 * Maximum BusUnitInfo buffer size. Provided for clients so
83 * they can allocate a buffer big enough for any type of bus
84 * unit. Increase as needed.
85 */
83enum {HvCallPci_MaxBusUnitInfoSize = 128}; 86enum {HvCallPci_MaxBusUnitInfoSize = 128};
84 87
85struct HvCallPci_BarParms { 88struct HvCallPci_BarParms {
@@ -89,12 +92,12 @@ struct HvCallPci_BarParms {
89 u64 protectStart; 92 u64 protectStart;
90 u64 protectEnd; 93 u64 protectEnd;
91 u64 relocationOffset; 94 u64 relocationOffset;
92 u64 pciAddress; 95 u64 pciAddress;
93 u64 reserved[3]; 96 u64 reserved[3];
94}; 97};
95 98
96enum HvCallPci_VpdType { 99enum HvCallPci_VpdType {
97 HvCallPci_BusVpd = 1, 100 HvCallPci_BusVpd = 1,
98 HvCallPci_BusAdapterVpd = 2 101 HvCallPci_BusAdapterVpd = 2
99}; 102};
100 103
@@ -123,15 +126,13 @@ enum HvCallPci_VpdType {
123#define HvCallPciUnmaskInterrupts HvCallPci + 49 126#define HvCallPciUnmaskInterrupts HvCallPci + 49
124#define HvCallPciGetBusUnitInfo HvCallPci + 50 127#define HvCallPciGetBusUnitInfo HvCallPci + 50
125 128
126//============================================================================
127static inline u64 HvCallPci_configLoad8(u16 busNumber, u8 subBusNumber, 129static inline u64 HvCallPci_configLoad8(u16 busNumber, u8 subBusNumber,
128 u8 deviceId, u32 offset, 130 u8 deviceId, u32 offset, u8 *value)
129 u8 *value)
130{ 131{
131 struct HvCallPci_DsaAddr dsa; 132 struct HvCallPci_DsaAddr dsa;
132 struct HvCallPci_LoadReturn retVal; 133 struct HvCallPci_LoadReturn retVal;
133 134
134 *((u64*)&dsa) = 0; 135 *((u64*)&dsa) = 0;
135 136
136 dsa.busNumber = busNumber; 137 dsa.busNumber = busNumber;
137 dsa.subBusNumber = subBusNumber; 138 dsa.subBusNumber = subBusNumber;
@@ -139,21 +140,18 @@ static inline u64 HvCallPci_configLoad8(u16 busNumber, u8 subBusNumber,
139 140
140 HvCall3Ret16(HvCallPciConfigLoad8, &retVal, *(u64 *)&dsa, offset, 0); 141 HvCall3Ret16(HvCallPciConfigLoad8, &retVal, *(u64 *)&dsa, offset, 0);
141 142
142 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
143
144 *value = retVal.value; 143 *value = retVal.value;
145 144
146 return retVal.rc; 145 return retVal.rc;
147} 146}
148//============================================================================ 147
149static inline u64 HvCallPci_configLoad16(u16 busNumber, u8 subBusNumber, 148static inline u64 HvCallPci_configLoad16(u16 busNumber, u8 subBusNumber,
150 u8 deviceId, u32 offset, 149 u8 deviceId, u32 offset, u16 *value)
151 u16 *value)
152{ 150{
153 struct HvCallPci_DsaAddr dsa; 151 struct HvCallPci_DsaAddr dsa;
154 struct HvCallPci_LoadReturn retVal; 152 struct HvCallPci_LoadReturn retVal;
155 153
156 *((u64*)&dsa) = 0; 154 *((u64*)&dsa) = 0;
157 155
158 dsa.busNumber = busNumber; 156 dsa.busNumber = busNumber;
159 dsa.subBusNumber = subBusNumber; 157 dsa.subBusNumber = subBusNumber;
@@ -161,21 +159,18 @@ static inline u64 HvCallPci_configLoad16(u16 busNumber, u8 subBusNumber,
161 159
162 HvCall3Ret16(HvCallPciConfigLoad16, &retVal, *(u64 *)&dsa, offset, 0); 160 HvCall3Ret16(HvCallPciConfigLoad16, &retVal, *(u64 *)&dsa, offset, 0);
163 161
164 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
165
166 *value = retVal.value; 162 *value = retVal.value;
167 163
168 return retVal.rc; 164 return retVal.rc;
169} 165}
170//============================================================================ 166
171static inline u64 HvCallPci_configLoad32(u16 busNumber, u8 subBusNumber, 167static inline u64 HvCallPci_configLoad32(u16 busNumber, u8 subBusNumber,
172 u8 deviceId, u32 offset, 168 u8 deviceId, u32 offset, u32 *value)
173 u32 *value)
174{ 169{
175 struct HvCallPci_DsaAddr dsa; 170 struct HvCallPci_DsaAddr dsa;
176 struct HvCallPci_LoadReturn retVal; 171 struct HvCallPci_LoadReturn retVal;
177 172
178 *((u64*)&dsa) = 0; 173 *((u64*)&dsa) = 0;
179 174
180 dsa.busNumber = busNumber; 175 dsa.busNumber = busNumber;
181 dsa.subBusNumber = subBusNumber; 176 dsa.subBusNumber = subBusNumber;
@@ -183,84 +178,61 @@ static inline u64 HvCallPci_configLoad32(u16 busNumber, u8 subBusNumber,
183 178
184 HvCall3Ret16(HvCallPciConfigLoad32, &retVal, *(u64 *)&dsa, offset, 0); 179 HvCall3Ret16(HvCallPciConfigLoad32, &retVal, *(u64 *)&dsa, offset, 0);
185 180
186 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
187
188 *value = retVal.value; 181 *value = retVal.value;
189 182
190 return retVal.rc; 183 return retVal.rc;
191} 184}
192//============================================================================ 185
193static inline u64 HvCallPci_configStore8(u16 busNumber, u8 subBusNumber, 186static inline u64 HvCallPci_configStore8(u16 busNumber, u8 subBusNumber,
194 u8 deviceId, u32 offset, 187 u8 deviceId, u32 offset, u8 value)
195 u8 value)
196{ 188{
197 struct HvCallPci_DsaAddr dsa; 189 struct HvCallPci_DsaAddr dsa;
198 u64 retVal;
199 190
200 *((u64*)&dsa) = 0; 191 *((u64*)&dsa) = 0;
201 192
202 dsa.busNumber = busNumber; 193 dsa.busNumber = busNumber;
203 dsa.subBusNumber = subBusNumber; 194 dsa.subBusNumber = subBusNumber;
204 dsa.deviceId = deviceId; 195 dsa.deviceId = deviceId;
205 196
206 retVal = HvCall4(HvCallPciConfigStore8, *(u64 *)&dsa, offset, value, 0); 197 return HvCall4(HvCallPciConfigStore8, *(u64 *)&dsa, offset, value, 0);
207
208 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
209
210 return retVal;
211} 198}
212//============================================================================ 199
213static inline u64 HvCallPci_configStore16(u16 busNumber, u8 subBusNumber, 200static inline u64 HvCallPci_configStore16(u16 busNumber, u8 subBusNumber,
214 u8 deviceId, u32 offset, 201 u8 deviceId, u32 offset, u16 value)
215 u16 value)
216{ 202{
217 struct HvCallPci_DsaAddr dsa; 203 struct HvCallPci_DsaAddr dsa;
218 u64 retVal;
219 204
220 *((u64*)&dsa) = 0; 205 *((u64*)&dsa) = 0;
221 206
222 dsa.busNumber = busNumber; 207 dsa.busNumber = busNumber;
223 dsa.subBusNumber = subBusNumber; 208 dsa.subBusNumber = subBusNumber;
224 dsa.deviceId = deviceId; 209 dsa.deviceId = deviceId;
225 210
226 retVal = HvCall4(HvCallPciConfigStore16, *(u64 *)&dsa, offset, value, 0); 211 return HvCall4(HvCallPciConfigStore16, *(u64 *)&dsa, offset, value, 0);
227
228 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
229
230 return retVal;
231} 212}
232//============================================================================ 213
233static inline u64 HvCallPci_configStore32(u16 busNumber, u8 subBusNumber, 214static inline u64 HvCallPci_configStore32(u16 busNumber, u8 subBusNumber,
234 u8 deviceId, u32 offset, 215 u8 deviceId, u32 offset, u32 value)
235 u32 value)
236{ 216{
237 struct HvCallPci_DsaAddr dsa; 217 struct HvCallPci_DsaAddr dsa;
238 u64 retVal;
239 218
240 *((u64*)&dsa) = 0; 219 *((u64*)&dsa) = 0;
241 220
242 dsa.busNumber = busNumber; 221 dsa.busNumber = busNumber;
243 dsa.subBusNumber = subBusNumber; 222 dsa.subBusNumber = subBusNumber;
244 dsa.deviceId = deviceId; 223 dsa.deviceId = deviceId;
245 224
246 retVal = HvCall4(HvCallPciConfigStore32, *(u64 *)&dsa, offset, value, 0); 225 return HvCall4(HvCallPciConfigStore32, *(u64 *)&dsa, offset, value, 0);
247
248 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
249
250 return retVal;
251} 226}
252//============================================================================ 227
253static inline u64 HvCallPci_barLoad8(u16 busNumberParm, 228static inline u64 HvCallPci_barLoad8(u16 busNumberParm, u8 subBusParm,
254 u8 subBusParm, 229 u8 deviceIdParm, u8 barNumberParm, u64 offsetParm,
255 u8 deviceIdParm, 230 u8 *valueParm)
256 u8 barNumberParm,
257 u64 offsetParm,
258 u8* valueParm)
259{ 231{
260 struct HvCallPci_DsaAddr dsa; 232 struct HvCallPci_DsaAddr dsa;
261 struct HvCallPci_LoadReturn retVal; 233 struct HvCallPci_LoadReturn retVal;
262 234
263 *((u64*)&dsa) = 0; 235 *((u64*)&dsa) = 0;
264 236
265 dsa.busNumber = busNumberParm; 237 dsa.busNumber = busNumberParm;
266 dsa.subBusNumber = subBusParm; 238 dsa.subBusNumber = subBusParm;
@@ -269,24 +241,19 @@ static inline u64 HvCallPci_barLoad8(u16 busNumberParm,
269 241
270 HvCall3Ret16(HvCallPciBarLoad8, &retVal, *(u64 *)&dsa, offsetParm, 0); 242 HvCall3Ret16(HvCallPciBarLoad8, &retVal, *(u64 *)&dsa, offsetParm, 0);
271 243
272 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
273
274 *valueParm = retVal.value; 244 *valueParm = retVal.value;
275 245
276 return retVal.rc; 246 return retVal.rc;
277} 247}
278//============================================================================ 248
279static inline u64 HvCallPci_barLoad16(u16 busNumberParm, 249static inline u64 HvCallPci_barLoad16(u16 busNumberParm, u8 subBusParm,
280 u8 subBusParm, 250 u8 deviceIdParm, u8 barNumberParm, u64 offsetParm,
281 u8 deviceIdParm, 251 u16 *valueParm)
282 u8 barNumberParm,
283 u64 offsetParm,
284 u16* valueParm)
285{ 252{
286 struct HvCallPci_DsaAddr dsa; 253 struct HvCallPci_DsaAddr dsa;
287 struct HvCallPci_LoadReturn retVal; 254 struct HvCallPci_LoadReturn retVal;
288 255
289 *((u64*)&dsa) = 0; 256 *((u64*)&dsa) = 0;
290 257
291 dsa.busNumber = busNumberParm; 258 dsa.busNumber = busNumberParm;
292 dsa.subBusNumber = subBusParm; 259 dsa.subBusNumber = subBusParm;
@@ -295,24 +262,19 @@ static inline u64 HvCallPci_barLoad16(u16 busNumberParm,
295 262
296 HvCall3Ret16(HvCallPciBarLoad16, &retVal, *(u64 *)&dsa, offsetParm, 0); 263 HvCall3Ret16(HvCallPciBarLoad16, &retVal, *(u64 *)&dsa, offsetParm, 0);
297 264
298 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
299
300 *valueParm = retVal.value; 265 *valueParm = retVal.value;
301 266
302 return retVal.rc; 267 return retVal.rc;
303} 268}
304//============================================================================ 269
305static inline u64 HvCallPci_barLoad32(u16 busNumberParm, 270static inline u64 HvCallPci_barLoad32(u16 busNumberParm, u8 subBusParm,
306 u8 subBusParm, 271 u8 deviceIdParm, u8 barNumberParm, u64 offsetParm,
307 u8 deviceIdParm, 272 u32 *valueParm)
308 u8 barNumberParm,
309 u64 offsetParm,
310 u32* valueParm)
311{ 273{
312 struct HvCallPci_DsaAddr dsa; 274 struct HvCallPci_DsaAddr dsa;
313 struct HvCallPci_LoadReturn retVal; 275 struct HvCallPci_LoadReturn retVal;
314 276
315 *((u64*)&dsa) = 0; 277 *((u64*)&dsa) = 0;
316 278
317 dsa.busNumber = busNumberParm; 279 dsa.busNumber = busNumberParm;
318 dsa.subBusNumber = subBusParm; 280 dsa.subBusNumber = subBusParm;
@@ -321,24 +283,19 @@ static inline u64 HvCallPci_barLoad32(u16 busNumberParm,
321 283
322 HvCall3Ret16(HvCallPciBarLoad32, &retVal, *(u64 *)&dsa, offsetParm, 0); 284 HvCall3Ret16(HvCallPciBarLoad32, &retVal, *(u64 *)&dsa, offsetParm, 0);
323 285
324 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
325
326 *valueParm = retVal.value; 286 *valueParm = retVal.value;
327 287
328 return retVal.rc; 288 return retVal.rc;
329} 289}
330//============================================================================ 290
331static inline u64 HvCallPci_barLoad64(u16 busNumberParm, 291static inline u64 HvCallPci_barLoad64(u16 busNumberParm, u8 subBusParm,
332 u8 subBusParm, 292 u8 deviceIdParm, u8 barNumberParm, u64 offsetParm,
333 u8 deviceIdParm, 293 u64 *valueParm)
334 u8 barNumberParm,
335 u64 offsetParm,
336 u64* valueParm)
337{ 294{
338 struct HvCallPci_DsaAddr dsa; 295 struct HvCallPci_DsaAddr dsa;
339 struct HvCallPci_LoadReturn retVal; 296 struct HvCallPci_LoadReturn retVal;
340 297
341 *((u64*)&dsa) = 0; 298 *((u64*)&dsa) = 0;
342 299
343 dsa.busNumber = busNumberParm; 300 dsa.busNumber = busNumberParm;
344 dsa.subBusNumber = subBusParm; 301 dsa.subBusNumber = subBusParm;
@@ -347,112 +304,81 @@ static inline u64 HvCallPci_barLoad64(u16 busNumberParm,
347 304
348 HvCall3Ret16(HvCallPciBarLoad64, &retVal, *(u64 *)&dsa, offsetParm, 0); 305 HvCall3Ret16(HvCallPciBarLoad64, &retVal, *(u64 *)&dsa, offsetParm, 0);
349 306
350 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
351
352 *valueParm = retVal.value; 307 *valueParm = retVal.value;
353 308
354 return retVal.rc; 309 return retVal.rc;
355} 310}
356//============================================================================ 311
357static inline u64 HvCallPci_barStore8(u16 busNumberParm, 312static inline u64 HvCallPci_barStore8(u16 busNumberParm, u8 subBusParm,
358 u8 subBusParm, 313 u8 deviceIdParm, u8 barNumberParm, u64 offsetParm,
359 u8 deviceIdParm, 314 u8 valueParm)
360 u8 barNumberParm,
361 u64 offsetParm,
362 u8 valueParm)
363{ 315{
364 struct HvCallPci_DsaAddr dsa; 316 struct HvCallPci_DsaAddr dsa;
365 u64 retVal;
366 317
367 *((u64*)&dsa) = 0; 318 *((u64*)&dsa) = 0;
368 319
369 dsa.busNumber = busNumberParm; 320 dsa.busNumber = busNumberParm;
370 dsa.subBusNumber = subBusParm; 321 dsa.subBusNumber = subBusParm;
371 dsa.deviceId = deviceIdParm; 322 dsa.deviceId = deviceIdParm;
372 dsa.barNumber = barNumberParm; 323 dsa.barNumber = barNumberParm;
373 324
374 retVal = HvCall4(HvCallPciBarStore8, *(u64 *)&dsa, offsetParm, valueParm, 0); 325 return HvCall4(HvCallPciBarStore8, *(u64 *)&dsa, offsetParm,
375 326 valueParm, 0);
376 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
377
378 return retVal;
379} 327}
380//============================================================================ 328
381static inline u64 HvCallPci_barStore16(u16 busNumberParm, 329static inline u64 HvCallPci_barStore16(u16 busNumberParm, u8 subBusParm,
382 u8 subBusParm, 330 u8 deviceIdParm, u8 barNumberParm, u64 offsetParm,
383 u8 deviceIdParm, 331 u16 valueParm)
384 u8 barNumberParm,
385 u64 offsetParm,
386 u16 valueParm)
387{ 332{
388 struct HvCallPci_DsaAddr dsa; 333 struct HvCallPci_DsaAddr dsa;
389 u64 retVal;
390 334
391 *((u64*)&dsa) = 0; 335 *((u64*)&dsa) = 0;
392 336
393 dsa.busNumber = busNumberParm; 337 dsa.busNumber = busNumberParm;
394 dsa.subBusNumber = subBusParm; 338 dsa.subBusNumber = subBusParm;
395 dsa.deviceId = deviceIdParm; 339 dsa.deviceId = deviceIdParm;
396 dsa.barNumber = barNumberParm; 340 dsa.barNumber = barNumberParm;
397 341
398 retVal = HvCall4(HvCallPciBarStore16, *(u64 *)&dsa, offsetParm, valueParm, 0); 342 return HvCall4(HvCallPciBarStore16, *(u64 *)&dsa, offsetParm,
399 343 valueParm, 0);
400 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
401
402 return retVal;
403} 344}
404//============================================================================ 345
405static inline u64 HvCallPci_barStore32(u16 busNumberParm, 346static inline u64 HvCallPci_barStore32(u16 busNumberParm, u8 subBusParm,
406 u8 subBusParm, 347 u8 deviceIdParm, u8 barNumberParm, u64 offsetParm,
407 u8 deviceIdParm, 348 u32 valueParm)
408 u8 barNumberParm,
409 u64 offsetParm,
410 u32 valueParm)
411{ 349{
412 struct HvCallPci_DsaAddr dsa; 350 struct HvCallPci_DsaAddr dsa;
413 u64 retVal;
414 351
415 *((u64*)&dsa) = 0; 352 *((u64*)&dsa) = 0;
416 353
417 dsa.busNumber = busNumberParm; 354 dsa.busNumber = busNumberParm;
418 dsa.subBusNumber = subBusParm; 355 dsa.subBusNumber = subBusParm;
419 dsa.deviceId = deviceIdParm; 356 dsa.deviceId = deviceIdParm;
420 dsa.barNumber = barNumberParm; 357 dsa.barNumber = barNumberParm;
421 358
422 retVal = HvCall4(HvCallPciBarStore32, *(u64 *)&dsa, offsetParm, valueParm, 0); 359 return HvCall4(HvCallPciBarStore32, *(u64 *)&dsa, offsetParm,
423 360 valueParm, 0);
424 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
425
426 return retVal;
427} 361}
428//============================================================================ 362
429static inline u64 HvCallPci_barStore64(u16 busNumberParm, 363static inline u64 HvCallPci_barStore64(u16 busNumberParm, u8 subBusParm,
430 u8 subBusParm, 364 u8 deviceIdParm, u8 barNumberParm, u64 offsetParm,
431 u8 deviceIdParm, 365 u64 valueParm)
432 u8 barNumberParm,
433 u64 offsetParm,
434 u64 valueParm)
435{ 366{
436 struct HvCallPci_DsaAddr dsa; 367 struct HvCallPci_DsaAddr dsa;
437 u64 retVal;
438 368
439 *((u64*)&dsa) = 0; 369 *((u64*)&dsa) = 0;
440 370
441 dsa.busNumber = busNumberParm; 371 dsa.busNumber = busNumberParm;
442 dsa.subBusNumber = subBusParm; 372 dsa.subBusNumber = subBusParm;
443 dsa.deviceId = deviceIdParm; 373 dsa.deviceId = deviceIdParm;
444 dsa.barNumber = barNumberParm; 374 dsa.barNumber = barNumberParm;
445 375
446 retVal = HvCall4(HvCallPciBarStore64, *(u64 *)&dsa, offsetParm, valueParm, 0); 376 return HvCall4(HvCallPciBarStore64, *(u64 *)&dsa, offsetParm,
447 377 valueParm, 0);
448 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
449
450 return retVal;
451} 378}
452//============================================================================ 379
453static inline u64 HvCallPci_eoi(u16 busNumberParm, 380static inline u64 HvCallPci_eoi(u16 busNumberParm, u8 subBusParm,
454 u8 subBusParm, 381 u8 deviceIdParm)
455 u8 deviceIdParm)
456{ 382{
457 struct HvCallPci_DsaAddr dsa; 383 struct HvCallPci_DsaAddr dsa;
458 struct HvCallPci_LoadReturn retVal; 384 struct HvCallPci_LoadReturn retVal;
@@ -465,20 +391,13 @@ static inline u64 HvCallPci_eoi(u16 busNumberParm,
465 391
466 HvCall1Ret16(HvCallPciEoi, &retVal, *(u64*)&dsa); 392 HvCall1Ret16(HvCallPciEoi, &retVal, *(u64*)&dsa);
467 393
468 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
469
470 return retVal.rc; 394 return retVal.rc;
471} 395}
472//============================================================================ 396
473static inline u64 HvCallPci_getBarParms(u16 busNumberParm, 397static inline u64 HvCallPci_getBarParms(u16 busNumberParm, u8 subBusParm,
474 u8 subBusParm, 398 u8 deviceIdParm, u8 barNumberParm, u64 parms, u32 sizeofParms)
475 u8 deviceIdParm,
476 u8 barNumberParm,
477 u64 parms,
478 u32 sizeofParms)
479{ 399{
480 struct HvCallPci_DsaAddr dsa; 400 struct HvCallPci_DsaAddr dsa;
481 u64 retVal;
482 401
483 *((u64*)&dsa) = 0; 402 *((u64*)&dsa) = 0;
484 403
@@ -487,62 +406,41 @@ static inline u64 HvCallPci_getBarParms(u16 busNumberParm,
487 dsa.deviceId = deviceIdParm; 406 dsa.deviceId = deviceIdParm;
488 dsa.barNumber = barNumberParm; 407 dsa.barNumber = barNumberParm;
489 408
490 retVal = HvCall3(HvCallPciGetBarParms, *(u64*)&dsa, parms, sizeofParms); 409 return HvCall3(HvCallPciGetBarParms, *(u64*)&dsa, parms, sizeofParms);
491
492 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
493
494 return retVal;
495} 410}
496//============================================================================ 411
497static inline u64 HvCallPci_maskFisr(u16 busNumberParm, 412static inline u64 HvCallPci_maskFisr(u16 busNumberParm, u8 subBusParm,
498 u8 subBusParm, 413 u8 deviceIdParm, u64 fisrMask)
499 u8 deviceIdParm,
500 u64 fisrMask)
501{ 414{
502 struct HvCallPci_DsaAddr dsa; 415 struct HvCallPci_DsaAddr dsa;
503 u64 retVal;
504 416
505 *((u64*)&dsa) = 0; 417 *((u64*)&dsa) = 0;
506 418
507 dsa.busNumber = busNumberParm; 419 dsa.busNumber = busNumberParm;
508 dsa.subBusNumber = subBusParm; 420 dsa.subBusNumber = subBusParm;
509 dsa.deviceId = deviceIdParm; 421 dsa.deviceId = deviceIdParm;
510 422
511 retVal = HvCall2(HvCallPciMaskFisr, *(u64*)&dsa, fisrMask); 423 return HvCall2(HvCallPciMaskFisr, *(u64*)&dsa, fisrMask);
512
513 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
514
515 return retVal;
516} 424}
517//============================================================================ 425
518static inline u64 HvCallPci_unmaskFisr(u16 busNumberParm, 426static inline u64 HvCallPci_unmaskFisr(u16 busNumberParm, u8 subBusParm,
519 u8 subBusParm, 427 u8 deviceIdParm, u64 fisrMask)
520 u8 deviceIdParm,
521 u64 fisrMask)
522{ 428{
523 struct HvCallPci_DsaAddr dsa; 429 struct HvCallPci_DsaAddr dsa;
524 u64 retVal;
525 430
526 *((u64*)&dsa) = 0; 431 *((u64*)&dsa) = 0;
527 432
528 dsa.busNumber = busNumberParm; 433 dsa.busNumber = busNumberParm;
529 dsa.subBusNumber = subBusParm; 434 dsa.subBusNumber = subBusParm;
530 dsa.deviceId = deviceIdParm; 435 dsa.deviceId = deviceIdParm;
531 436
532 retVal = HvCall2(HvCallPciUnmaskFisr, *(u64*)&dsa, fisrMask); 437 return HvCall2(HvCallPciUnmaskFisr, *(u64*)&dsa, fisrMask);
533
534 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
535
536 return retVal;
537} 438}
538//============================================================================ 439
539static inline u64 HvCallPci_setSlotReset(u16 busNumberParm, 440static inline u64 HvCallPci_setSlotReset(u16 busNumberParm, u8 subBusParm,
540 u8 subBusParm, 441 u8 deviceIdParm, u64 onNotOff)
541 u8 deviceIdParm,
542 u64 onNotOff)
543{ 442{
544 struct HvCallPci_DsaAddr dsa; 443 struct HvCallPci_DsaAddr dsa;
545 u64 retVal;
546 444
547 *((u64*)&dsa) = 0; 445 *((u64*)&dsa) = 0;
548 446
@@ -550,21 +448,13 @@ static inline u64 HvCallPci_setSlotReset(u16 busNumberParm,
550 dsa.subBusNumber = subBusParm; 448 dsa.subBusNumber = subBusParm;
551 dsa.deviceId = deviceIdParm; 449 dsa.deviceId = deviceIdParm;
552 450
553 retVal = HvCall2(HvCallPciSetSlotReset, *(u64*)&dsa, onNotOff); 451 return HvCall2(HvCallPciSetSlotReset, *(u64*)&dsa, onNotOff);
554
555 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
556
557 return retVal;
558} 452}
559//============================================================================ 453
560static inline u64 HvCallPci_getDeviceInfo(u16 busNumberParm, 454static inline u64 HvCallPci_getDeviceInfo(u16 busNumberParm, u8 subBusParm,
561 u8 subBusParm, 455 u8 deviceNumberParm, u64 parms, u32 sizeofParms)
562 u8 deviceNumberParm,
563 u64 parms,
564 u32 sizeofParms)
565{ 456{
566 struct HvCallPci_DsaAddr dsa; 457 struct HvCallPci_DsaAddr dsa;
567 u64 retVal;
568 458
569 *((u64*)&dsa) = 0; 459 *((u64*)&dsa) = 0;
570 460
@@ -572,102 +462,72 @@ static inline u64 HvCallPci_getDeviceInfo(u16 busNumberParm,
572 dsa.subBusNumber = subBusParm; 462 dsa.subBusNumber = subBusParm;
573 dsa.deviceId = deviceNumberParm << 4; 463 dsa.deviceId = deviceNumberParm << 4;
574 464
575 retVal = HvCall3(HvCallPciGetDeviceInfo, *(u64*)&dsa, parms, sizeofParms); 465 return HvCall3(HvCallPciGetDeviceInfo, *(u64*)&dsa, parms, sizeofParms);
576
577 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
578
579 return retVal;
580} 466}
581//============================================================================ 467
582static inline u64 HvCallPci_maskInterrupts(u16 busNumberParm, 468static inline u64 HvCallPci_maskInterrupts(u16 busNumberParm, u8 subBusParm,
583 u8 subBusParm, 469 u8 deviceIdParm, u64 interruptMask)
584 u8 deviceIdParm,
585 u64 interruptMask)
586{ 470{
587 struct HvCallPci_DsaAddr dsa; 471 struct HvCallPci_DsaAddr dsa;
588 u64 retVal;
589 472
590 *((u64*)&dsa) = 0; 473 *((u64*)&dsa) = 0;
591 474
592 dsa.busNumber = busNumberParm; 475 dsa.busNumber = busNumberParm;
593 dsa.subBusNumber = subBusParm; 476 dsa.subBusNumber = subBusParm;
594 dsa.deviceId = deviceIdParm; 477 dsa.deviceId = deviceIdParm;
595 478
596 retVal = HvCall2(HvCallPciMaskInterrupts, *(u64*)&dsa, interruptMask); 479 return HvCall2(HvCallPciMaskInterrupts, *(u64*)&dsa, interruptMask);
597
598 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
599
600 return retVal;
601} 480}
602//============================================================================ 481
603static inline u64 HvCallPci_unmaskInterrupts(u16 busNumberParm, 482static inline u64 HvCallPci_unmaskInterrupts(u16 busNumberParm, u8 subBusParm,
604 u8 subBusParm, 483 u8 deviceIdParm, u64 interruptMask)
605 u8 deviceIdParm,
606 u64 interruptMask)
607{ 484{
608 struct HvCallPci_DsaAddr dsa; 485 struct HvCallPci_DsaAddr dsa;
609 u64 retVal;
610 486
611 *((u64*)&dsa) = 0; 487 *((u64*)&dsa) = 0;
612 488
613 dsa.busNumber = busNumberParm; 489 dsa.busNumber = busNumberParm;
614 dsa.subBusNumber = subBusParm; 490 dsa.subBusNumber = subBusParm;
615 dsa.deviceId = deviceIdParm; 491 dsa.deviceId = deviceIdParm;
616 492
617 retVal = HvCall2(HvCallPciUnmaskInterrupts, *(u64*)&dsa, interruptMask); 493 return HvCall2(HvCallPciUnmaskInterrupts, *(u64*)&dsa, interruptMask);
618
619 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
620
621 return retVal;
622} 494}
623//============================================================================
624 495
625static inline u64 HvCallPci_getBusUnitInfo(u16 busNumberParm, 496static inline u64 HvCallPci_getBusUnitInfo(u16 busNumberParm, u8 subBusParm,
626 u8 subBusParm, 497 u8 deviceIdParm, u64 parms, u32 sizeofParms)
627 u8 deviceIdParm,
628 u64 parms,
629 u32 sizeofParms)
630{ 498{
631 struct HvCallPci_DsaAddr dsa; 499 struct HvCallPci_DsaAddr dsa;
632 u64 retVal;
633 500
634 *((u64*)&dsa) = 0; 501 *((u64*)&dsa) = 0;
635 502
636 dsa.busNumber = busNumberParm; 503 dsa.busNumber = busNumberParm;
637 dsa.subBusNumber = subBusParm; 504 dsa.subBusNumber = subBusParm;
638 dsa.deviceId = deviceIdParm; 505 dsa.deviceId = deviceIdParm;
639 506
640 retVal = HvCall3(HvCallPciGetBusUnitInfo, *(u64*)&dsa, parms, sizeofParms); 507 return HvCall3(HvCallPciGetBusUnitInfo, *(u64*)&dsa, parms,
641 508 sizeofParms);
642 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
643
644 return retVal;
645} 509}
646//============================================================================
647 510
648static inline int HvCallPci_getBusVpd(u16 busNumParm, u64 destParm, u16 sizeParm) 511static inline int HvCallPci_getBusVpd(u16 busNumParm, u64 destParm,
512 u16 sizeParm)
649{ 513{
650 int xRetSize; 514 u64 xRc = HvCall4(HvCallPciGetCardVpd, busNumParm, destParm,
651 u64 xRc = HvCall4(HvCallPciGetCardVpd, busNumParm, destParm, sizeParm, HvCallPci_BusVpd); 515 sizeParm, HvCallPci_BusVpd);
652 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
653 if (xRc == -1) 516 if (xRc == -1)
654 xRetSize = -1; 517 return -1;
655 else 518 else
656 xRetSize = xRc & 0xFFFF; 519 return xRc & 0xFFFF;
657 return xRetSize;
658} 520}
659//============================================================================
660 521
661static inline int HvCallPci_getBusAdapterVpd(u16 busNumParm, u64 destParm, u16 sizeParm) 522static inline int HvCallPci_getBusAdapterVpd(u16 busNumParm, u64 destParm,
523 u16 sizeParm)
662{ 524{
663 int xRetSize; 525 u64 xRc = HvCall4(HvCallPciGetCardVpd, busNumParm, destParm,
664 u64 xRc = HvCall4(HvCallPciGetCardVpd, busNumParm, destParm, sizeParm, HvCallPci_BusAdapterVpd); 526 sizeParm, HvCallPci_BusAdapterVpd);
665 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
666 if (xRc == -1) 527 if (xRc == -1)
667 xRetSize = -1; 528 return -1;
668 else 529 else
669 xRetSize = xRc & 0xFFFF; 530 return xRc & 0xFFFF;
670 return xRetSize;
671} 531}
672//============================================================================ 532
673#endif /* _HVCALLPCI_H */ 533#endif /* _HVCALLPCI_H */
diff --git a/include/asm-ppc64/iSeries/HvCallSc.h b/include/asm-ppc64/iSeries/HvCallSc.h
index eea258447642..a62cef3822f9 100644
--- a/include/asm-ppc64/iSeries/HvCallSc.h
+++ b/include/asm-ppc64/iSeries/HvCallSc.h
@@ -1,17 +1,17 @@
1/* 1/*
2 * HvCallSc.h 2 * HvCallSc.h
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation 3 * Copyright (C) 2001 Mike Corrigan IBM Corporation
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 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 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 7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version. 8 * (at your option) any later version.
9 * 9 *
10 * This program is distributed in the hope that it will be useful, 10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU General Public License 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 16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -19,7 +19,7 @@
19#ifndef _HVCALLSC_H 19#ifndef _HVCALLSC_H
20#define _HVCALLSC_H 20#define _HVCALLSC_H
21 21
22#include <asm/iSeries/HvTypes.h> 22#include <linux/types.h>
23 23
24#define HvCallBase 0x8000000000000000ul 24#define HvCallBase 0x8000000000000000ul
25#define HvCallCc 0x8001000000000000ul 25#define HvCallCc 0x8001000000000000ul
@@ -30,22 +30,22 @@
30#define HvCallSm 0x8007000000000000ul 30#define HvCallSm 0x8007000000000000ul
31#define HvCallXm 0x8009000000000000ul 31#define HvCallXm 0x8009000000000000ul
32 32
33u64 HvCall0( u64 ); 33extern u64 HvCall0(u64);
34u64 HvCall1( u64, u64 ); 34extern u64 HvCall1(u64, u64);
35u64 HvCall2( u64, u64, u64 ); 35extern u64 HvCall2(u64, u64, u64);
36u64 HvCall3( u64, u64, u64, u64 ); 36extern u64 HvCall3(u64, u64, u64, u64);
37u64 HvCall4( u64, u64, u64, u64, u64 ); 37extern u64 HvCall4(u64, u64, u64, u64, u64);
38u64 HvCall5( u64, u64, u64, u64, u64, u64 ); 38extern u64 HvCall5(u64, u64, u64, u64, u64, u64);
39u64 HvCall6( u64, u64, u64, u64, u64, u64, u64 ); 39extern u64 HvCall6(u64, u64, u64, u64, u64, u64, u64);
40u64 HvCall7( u64, u64, u64, u64, u64, u64, u64, u64 ); 40extern u64 HvCall7(u64, u64, u64, u64, u64, u64, u64, u64);
41 41
42u64 HvCall0Ret16( u64, void * ); 42extern u64 HvCall0Ret16(u64, void *);
43u64 HvCall1Ret16( u64, void *, u64 ); 43extern u64 HvCall1Ret16(u64, void *, u64);
44u64 HvCall2Ret16( u64, void *, u64, u64 ); 44extern u64 HvCall2Ret16(u64, void *, u64, u64);
45u64 HvCall3Ret16( u64, void *, u64, u64, u64 ); 45extern u64 HvCall3Ret16(u64, void *, u64, u64, u64);
46u64 HvCall4Ret16( u64, void *, u64, u64, u64, u64 ); 46extern u64 HvCall4Ret16(u64, void *, u64, u64, u64, u64);
47u64 HvCall5Ret16( u64, void *, u64, u64, u64, u64, u64 ); 47extern u64 HvCall5Ret16(u64, void *, u64, u64, u64, u64, u64);
48u64 HvCall6Ret16( u64, void *, u64, u64, u64, u64, u64, u64 ); 48extern u64 HvCall6Ret16(u64, void *, u64, u64, u64, u64, u64, u64);
49u64 HvCall7Ret16( u64, void *, u64, u64 ,u64 ,u64 ,u64 ,u64 ,u64 ); 49extern u64 HvCall7Ret16(u64, void *, u64, u64 ,u64 ,u64 ,u64 ,u64 ,u64);
50 50
51#endif /* _HVCALLSC_H */ 51#endif /* _HVCALLSC_H */
diff --git a/include/asm-ppc64/iSeries/HvCallSm.h b/include/asm-ppc64/iSeries/HvCallSm.h
index 9050c94a529d..8a3dbb071a43 100644
--- a/include/asm-ppc64/iSeries/HvCallSm.h
+++ b/include/asm-ppc64/iSeries/HvCallSm.h
@@ -1,17 +1,17 @@
1/* 1/*
2 * HvCallSm.h 2 * HvCallSm.h
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation 3 * Copyright (C) 2001 Mike Corrigan IBM Corporation
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 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 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 7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version. 8 * (at your option) any later version.
9 * 9 *
10 * This program is distributed in the hope that it will be useful, 10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU General Public License 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 16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -19,34 +19,20 @@
19#ifndef _HVCALLSM_H 19#ifndef _HVCALLSM_H
20#define _HVCALLSM_H 20#define _HVCALLSM_H
21 21
22//============================================================================ 22/*
23// 23 * This file contains the "hypervisor call" interface which is used to
24// This file contains the "hypervisor call" interface which is used to 24 * drive the hypervisor from the OS.
25// drive the hypervisor from the OS. 25 */
26//
27//============================================================================
28 26
29//-------------------------------------------------------------------
30// Standard Includes
31//-------------------------------------------------------------------
32#include <asm/iSeries/HvCallSc.h> 27#include <asm/iSeries/HvCallSc.h>
33#include <asm/iSeries/HvTypes.h> 28#include <asm/iSeries/HvTypes.h>
34 29
35//-----------------------------------------------------------------------------
36// Constants
37//-----------------------------------------------------------------------------
38
39#define HvCallSmGet64BitsOfAccessMap HvCallSm + 11 30#define HvCallSmGet64BitsOfAccessMap HvCallSm + 11
40 31
41 32static inline u64 HvCallSm_get64BitsOfAccessMap(HvLpIndex lpIndex,
42//============================================================================ 33 u64 indexIntoBitMap)
43static inline u64 HvCallSm_get64BitsOfAccessMap(
44 HvLpIndex lpIndex, u64 indexIntoBitMap )
45{ 34{
46 u64 retval = HvCall2(HvCallSmGet64BitsOfAccessMap, lpIndex, 35 return HvCall2(HvCallSmGet64BitsOfAccessMap, lpIndex, indexIntoBitMap);
47 indexIntoBitMap );
48 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
49 return retval;
50} 36}
51//============================================================================ 37
52#endif /* _HVCALLSM_H */ 38#endif /* _HVCALLSM_H */
diff --git a/include/asm-ppc64/iSeries/HvCallXm.h b/include/asm-ppc64/iSeries/HvCallXm.h
index bfb898f4db8d..8b9ba608daaf 100644
--- a/include/asm-ppc64/iSeries/HvCallXm.h
+++ b/include/asm-ppc64/iSeries/HvCallXm.h
@@ -1,30 +1,13 @@
1//============================================================================ 1/*
2// Header File Id 2 * This file contains the "hypervisor call" interface which is used to
3// Name______________: HvCallXm.H 3 * drive the hypervisor from SLIC.
4// 4 */
5// Description_______:
6//
7// This file contains the "hypervisor call" interface which is used to
8// drive the hypervisor from SLIC.
9//
10//============================================================================
11#ifndef _HVCALLXM_H 5#ifndef _HVCALLXM_H
12#define _HVCALLXM_H 6#define _HVCALLXM_H
13 7
14//-------------------------------------------------------------------
15// Forward declarations
16//-------------------------------------------------------------------
17
18//-------------------------------------------------------------------
19// Standard Includes
20//-------------------------------------------------------------------
21#include <asm/iSeries/HvCallSc.h> 8#include <asm/iSeries/HvCallSc.h>
22#include <asm/iSeries/HvTypes.h> 9#include <asm/iSeries/HvTypes.h>
23 10
24//-----------------------------------------------------------------------------
25// Constants
26//-----------------------------------------------------------------------------
27
28#define HvCallXmGetTceTableParms HvCallXm + 0 11#define HvCallXmGetTceTableParms HvCallXm + 0
29#define HvCallXmTestBus HvCallXm + 1 12#define HvCallXmTestBus HvCallXm + 1
30#define HvCallXmConnectBusUnit HvCallXm + 2 13#define HvCallXmConnectBusUnit HvCallXm + 2
@@ -33,63 +16,63 @@
33#define HvCallXmSetTce HvCallXm + 11 16#define HvCallXmSetTce HvCallXm + 11
34#define HvCallXmSetTces HvCallXm + 13 17#define HvCallXmSetTces HvCallXm + 13
35 18
19/*
20 * Structure passed to HvCallXm_getTceTableParms
21 */
22struct iommu_table_cb {
23 unsigned long itc_busno; /* Bus number for this tce table */
24 unsigned long itc_start; /* Will be NULL for secondary */
25 unsigned long itc_totalsize; /* Size (in pages) of whole table */
26 unsigned long itc_offset; /* Index into real tce table of the
27 start of our section */
28 unsigned long itc_size; /* Size (in pages) of our section */
29 unsigned long itc_index; /* Index of this tce table */
30 unsigned short itc_maxtables; /* Max num of tables for partition */
31 unsigned char itc_virtbus; /* Flag to indicate virtual bus */
32 unsigned char itc_slotno; /* IOA Tce Slot Index */
33 unsigned char itc_rsvd[4];
34};
36 35
37 36static inline void HvCallXm_getTceTableParms(u64 cb)
38//============================================================================
39static inline void HvCallXm_getTceTableParms(u64 cb)
40{ 37{
41 HvCall1(HvCallXmGetTceTableParms, cb); 38 HvCall1(HvCallXmGetTceTableParms, cb);
42 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
43} 39}
44//============================================================================ 40
45static inline u64 HvCallXm_setTce(u64 tceTableToken, u64 tceOffset, u64 tce) 41static inline u64 HvCallXm_setTce(u64 tceTableToken, u64 tceOffset, u64 tce)
46{ 42{
47 u64 retval = HvCall3(HvCallXmSetTce, tceTableToken, tceOffset, tce ); 43 return HvCall3(HvCallXmSetTce, tceTableToken, tceOffset, tce);
48 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
49 return retval;
50}
51//============================================================================
52static inline u64 HvCallXm_setTces(u64 tceTableToken, u64 tceOffset, u64 numTces, u64 tce1, u64 tce2, u64 tce3, u64 tce4)
53{
54 u64 retval = HvCall7(HvCallXmSetTces, tceTableToken, tceOffset, numTces,
55 tce1, tce2, tce3, tce4 );
56 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
57 return retval;
58} 44}
59//============================================================================= 45
60static inline u64 HvCallXm_testBus(u16 busNumber) 46static inline u64 HvCallXm_setTces(u64 tceTableToken, u64 tceOffset,
47 u64 numTces, u64 tce1, u64 tce2, u64 tce3, u64 tce4)
61{ 48{
62 u64 retVal = HvCall1(HvCallXmTestBus, busNumber); 49 return HvCall7(HvCallXmSetTces, tceTableToken, tceOffset, numTces,
63 // getPaca()->adjustHmtForNoOfSpinLocksHeld(); 50 tce1, tce2, tce3, tce4);
64 return retVal;
65} 51}
66//===================================================================================== 52
67static inline u64 HvCallXm_testBusUnit(u16 busNumber, u8 subBusNumber, u8 deviceId) 53static inline u64 HvCallXm_testBus(u16 busNumber)
68{ 54{
69 u64 busUnitNumber = (subBusNumber << 8) | deviceId; 55 return HvCall1(HvCallXmTestBus, busNumber);
70 u64 retVal = HvCall2(HvCallXmTestBusUnit, busNumber, busUnitNumber);
71 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
72 return retVal;
73} 56}
74//===================================================================================== 57
75static inline u64 HvCallXm_connectBusUnit(u16 busNumber, u8 subBusNumber, u8 deviceId, 58static inline u64 HvCallXm_testBusUnit(u16 busNumber, u8 subBusNumber,
76 u64 interruptToken) 59 u8 deviceId)
77{ 60{
78 u64 busUnitNumber = (subBusNumber << 8) | deviceId; 61 return HvCall2(HvCallXmTestBusUnit, busNumber,
79 u64 queueIndex = 0; // HvLpConfig::mapDsaToQueueIndex(HvLpDSA(busNumber, xBoard, xCard)); 62 (subBusNumber << 8) | deviceId);
63}
80 64
81 u64 retVal = HvCall5(HvCallXmConnectBusUnit, busNumber, busUnitNumber, 65static inline u64 HvCallXm_connectBusUnit(u16 busNumber, u8 subBusNumber,
82 interruptToken, 0, queueIndex); 66 u8 deviceId, u64 interruptToken)
83 // getPaca()->adjustHmtForNoOfSpinLocksHeld(); 67{
84 return retVal; 68 return HvCall5(HvCallXmConnectBusUnit, busNumber,
69 (subBusNumber << 8) | deviceId, interruptToken, 0,
70 0 /* HvLpConfig::mapDsaToQueueIndex(HvLpDSA(busNumber, xBoard, xCard)) */);
85} 71}
86//===================================================================================== 72
87static inline u64 HvCallXm_loadTod(void) 73static inline u64 HvCallXm_loadTod(void)
88{ 74{
89 u64 retVal = HvCall0(HvCallXmLoadTod); 75 return HvCall0(HvCallXmLoadTod);
90 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
91 return retVal;
92} 76}
93//=====================================================================================
94 77
95#endif /* _HVCALLXM_H */ 78#endif /* _HVCALLXM_H */
diff --git a/include/asm-ppc64/iSeries/HvLpConfig.h b/include/asm-ppc64/iSeries/HvLpConfig.h
index bdbd70f42c9d..f1cf1e70ca3c 100644
--- a/include/asm-ppc64/iSeries/HvLpConfig.h
+++ b/include/asm-ppc64/iSeries/HvLpConfig.h
@@ -1,17 +1,17 @@
1/* 1/*
2 * HvLpConfig.h 2 * HvLpConfig.h
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation 3 * Copyright (C) 2001 Mike Corrigan IBM Corporation
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 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 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 7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version. 8 * (at your option) any later version.
9 * 9 *
10 * This program is distributed in the hope that it will be useful, 10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU General Public License 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 16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -19,262 +19,120 @@
19#ifndef _HVLPCONFIG_H 19#ifndef _HVLPCONFIG_H
20#define _HVLPCONFIG_H 20#define _HVLPCONFIG_H
21 21
22//=========================================================================== 22/*
23// 23 * This file contains the interface to the LPAR configuration data
24// This file contains the interface to the LPAR configuration data 24 * to determine which resources should be allocated to each partition.
25// to determine which resources should be allocated to each partition. 25 */
26//
27//===========================================================================
28 26
29#include <asm/iSeries/HvCallCfg.h> 27#include <asm/iSeries/HvCallSc.h>
30#include <asm/iSeries/HvTypes.h> 28#include <asm/iSeries/HvTypes.h>
31#include <asm/iSeries/ItLpNaca.h> 29#include <asm/iSeries/ItLpNaca.h>
32#include <asm/iSeries/LparData.h>
33 30
34//------------------------------------------------------------------- 31enum {
35// Constants 32 HvCallCfg_Cur = 0,
36//------------------------------------------------------------------- 33 HvCallCfg_Init = 1,
34 HvCallCfg_Max = 2,
35 HvCallCfg_Min = 3
36};
37
38#define HvCallCfgGetSystemPhysicalProcessors HvCallCfg + 6
39#define HvCallCfgGetPhysicalProcessors HvCallCfg + 7
40#define HvCallCfgGetMsChunks HvCallCfg + 9
41#define HvCallCfgGetSharedPoolIndex HvCallCfg + 20
42#define HvCallCfgGetSharedProcUnits HvCallCfg + 21
43#define HvCallCfgGetNumProcsInSharedPool HvCallCfg + 22
44#define HvCallCfgGetVirtualLanIndexMap HvCallCfg + 30
45#define HvCallCfgGetHostingLpIndex HvCallCfg + 32
37 46
38extern HvLpIndex HvLpConfig_getLpIndex_outline(void); 47extern HvLpIndex HvLpConfig_getLpIndex_outline(void);
39 48
40//===================================================================
41static inline HvLpIndex HvLpConfig_getLpIndex(void) 49static inline HvLpIndex HvLpConfig_getLpIndex(void)
42{ 50{
43 return itLpNaca.xLpIndex; 51 return itLpNaca.xLpIndex;
44} 52}
45//=================================================================== 53
46static inline HvLpIndex HvLpConfig_getPrimaryLpIndex(void) 54static inline HvLpIndex HvLpConfig_getPrimaryLpIndex(void)
47{ 55{
48 return itLpNaca.xPrimaryLpIndex; 56 return itLpNaca.xPrimaryLpIndex;
49} 57}
50//================================================================= 58
51static inline HvLpIndex HvLpConfig_getLps(void) 59static inline u64 HvLpConfig_getMsChunks(void)
52{
53 return HvCallCfg_getLps();
54}
55//=================================================================
56static inline HvLpIndexMap HvLpConfig_getActiveLpMap(void)
57{
58 return HvCallCfg_getActiveLpMap();
59}
60//=================================================================
61static inline u64 HvLpConfig_getSystemMsMegs(void)
62{
63 return HvCallCfg_getSystemMsChunks() / HVCHUNKSPERMEG;
64}
65//=================================================================
66static inline u64 HvLpConfig_getSystemMsChunks(void)
67{
68 return HvCallCfg_getSystemMsChunks();
69}
70//=================================================================
71static inline u64 HvLpConfig_getSystemMsPages(void)
72{
73 return HvCallCfg_getSystemMsChunks() * HVPAGESPERCHUNK;
74}
75//================================================================
76static inline u64 HvLpConfig_getMsMegs(void)
77{
78 return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Cur) / HVCHUNKSPERMEG;
79}
80//================================================================
81static inline u64 HvLpConfig_getMsChunks(void)
82{
83 return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Cur);
84}
85//================================================================
86static inline u64 HvLpConfig_getMsPages(void)
87{
88 return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Cur) * HVPAGESPERCHUNK;
89}
90//================================================================
91static inline u64 HvLpConfig_getMinMsMegs(void)
92{
93 return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Min) / HVCHUNKSPERMEG;
94}
95//================================================================
96static inline u64 HvLpConfig_getMinMsChunks(void)
97{
98 return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Min);
99}
100//================================================================
101static inline u64 HvLpConfig_getMinMsPages(void)
102{
103 return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Min) * HVPAGESPERCHUNK;
104}
105//================================================================
106static inline u64 HvLpConfig_getMinRuntimeMsMegs(void)
107{
108 return HvCallCfg_getMinRuntimeMsChunks(HvLpConfig_getLpIndex()) / HVCHUNKSPERMEG;
109}
110//===============================================================
111static inline u64 HvLpConfig_getMinRuntimeMsChunks(void)
112{
113 return HvCallCfg_getMinRuntimeMsChunks(HvLpConfig_getLpIndex());
114}
115//===============================================================
116static inline u64 HvLpConfig_getMinRuntimeMsPages(void)
117{
118 return HvCallCfg_getMinRuntimeMsChunks(HvLpConfig_getLpIndex()) * HVPAGESPERCHUNK;
119}
120//===============================================================
121static inline u64 HvLpConfig_getMaxMsMegs(void)
122{
123 return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Max) / HVCHUNKSPERMEG;
124}
125//===============================================================
126static inline u64 HvLpConfig_getMaxMsChunks(void)
127{
128 return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Max);
129}
130//===============================================================
131static inline u64 HvLpConfig_getMaxMsPages(void)
132{
133 return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Max) * HVPAGESPERCHUNK;
134}
135//===============================================================
136static inline u64 HvLpConfig_getInitMsMegs(void)
137{
138 return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Init) / HVCHUNKSPERMEG;
139}
140//===============================================================
141static inline u64 HvLpConfig_getInitMsChunks(void)
142{
143 return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Init);
144}
145//===============================================================
146static inline u64 HvLpConfig_getInitMsPages(void)
147{ return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Init) * HVPAGESPERCHUNK;
148}
149//===============================================================
150static inline u64 HvLpConfig_getSystemPhysicalProcessors(void)
151{
152 return HvCallCfg_getSystemPhysicalProcessors();
153}
154//===============================================================
155static inline u64 HvLpConfig_getSystemLogicalProcessors(void)
156{
157 return HvCallCfg_getSystemPhysicalProcessors() * (/*getPaca()->getSecondaryThreadCount() +*/ 1);
158}
159//===============================================================
160static inline u64 HvLpConfig_getNumProcsInSharedPool(HvLpSharedPoolIndex sPI)
161{
162 return HvCallCfg_getNumProcsInSharedPool(sPI);
163}
164//===============================================================
165static inline u64 HvLpConfig_getPhysicalProcessors(void)
166{
167 return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Cur);
168}
169//===============================================================
170static inline u64 HvLpConfig_getLogicalProcessors(void)
171{
172 return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Cur) * (/*getPaca()->getSecondaryThreadCount() +*/ 1);
173}
174//===============================================================
175static inline HvLpSharedPoolIndex HvLpConfig_getSharedPoolIndex(void)
176{
177 return HvCallCfg_getSharedPoolIndex(HvLpConfig_getLpIndex());
178}
179//===============================================================
180static inline u64 HvLpConfig_getSharedProcUnits(void)
181{
182 return HvCallCfg_getSharedProcUnits(HvLpConfig_getLpIndex(),HvCallCfg_Cur);
183}
184//===============================================================
185static inline u64 HvLpConfig_getMinSharedProcUnits(void)
186{
187 return HvCallCfg_getSharedProcUnits(HvLpConfig_getLpIndex(),HvCallCfg_Min);
188}
189//===============================================================
190static inline u64 HvLpConfig_getMaxSharedProcUnits(void)
191{
192 return HvCallCfg_getSharedProcUnits(HvLpConfig_getLpIndex(),HvCallCfg_Max);
193}
194//===============================================================
195static inline u64 HvLpConfig_getMinPhysicalProcessors(void)
196{
197 return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Min);
198}
199//===============================================================
200static inline u64 HvLpConfig_getMinLogicalProcessors(void)
201{
202 return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Min) * (/*getPaca()->getSecondaryThreadCount() +*/ 1);
203}
204//===============================================================
205static inline u64 HvLpConfig_getMaxPhysicalProcessors(void)
206{
207 return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Max);
208}
209//===============================================================
210static inline u64 HvLpConfig_getMaxLogicalProcessors(void)
211{
212 return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Max) * (/*getPaca()->getSecondaryThreadCount() +*/ 1);
213}
214//===============================================================
215static inline u64 HvLpConfig_getInitPhysicalProcessors(void)
216{ 60{
217 return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Init); 61 return HvCall2(HvCallCfgGetMsChunks, HvLpConfig_getLpIndex(),
62 HvCallCfg_Cur);
218} 63}
219//=============================================================== 64
220static inline u64 HvLpConfig_getInitLogicalProcessors(void) 65static inline u64 HvLpConfig_getSystemPhysicalProcessors(void)
221{ 66{
222 return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Init) * (/*getPaca()->getSecondaryThreadCount() +*/ 1); 67 return HvCall0(HvCallCfgGetSystemPhysicalProcessors);
223} 68}
224//================================================================ 69
225static inline HvLpVirtualLanIndexMap HvLpConfig_getVirtualLanIndexMap(void) 70static inline u64 HvLpConfig_getNumProcsInSharedPool(HvLpSharedPoolIndex sPI)
226{ 71{
227 return HvCallCfg_getVirtualLanIndexMap(HvLpConfig_getLpIndex_outline()); 72 return (u16)HvCall1(HvCallCfgGetNumProcsInSharedPool, sPI);
228} 73}
229//=============================================================== 74
230static inline HvLpVirtualLanIndexMap HvLpConfig_getVirtualLanIndexMapForLp(HvLpIndex lp) 75static inline u64 HvLpConfig_getPhysicalProcessors(void)
231{ 76{
232 return HvCallCfg_getVirtualLanIndexMap(lp); 77 return HvCall2(HvCallCfgGetPhysicalProcessors, HvLpConfig_getLpIndex(),
78 HvCallCfg_Cur);
233} 79}
234//================================================================ 80
235static inline HvLpIndex HvLpConfig_getBusOwner(HvBusNumber busNumber) 81static inline HvLpSharedPoolIndex HvLpConfig_getSharedPoolIndex(void)
236{ 82{
237 return HvCallCfg_getBusOwner(busNumber); 83 return HvCall1(HvCallCfgGetSharedPoolIndex, HvLpConfig_getLpIndex());
238} 84}
239//=============================================================== 85
240static inline int HvLpConfig_isBusDedicated(HvBusNumber busNumber) 86static inline u64 HvLpConfig_getSharedProcUnits(void)
241{ 87{
242 return HvCallCfg_isBusDedicated(busNumber); 88 return HvCall2(HvCallCfgGetSharedProcUnits, HvLpConfig_getLpIndex(),
89 HvCallCfg_Cur);
243} 90}
244//================================================================ 91
245static inline HvLpIndexMap HvLpConfig_getBusAllocation(HvBusNumber busNumber) 92static inline u64 HvLpConfig_getMaxSharedProcUnits(void)
246{ 93{
247 return HvCallCfg_getBusAllocation(busNumber); 94 return HvCall2(HvCallCfgGetSharedProcUnits, HvLpConfig_getLpIndex(),
95 HvCallCfg_Max);
248} 96}
249//================================================================ 97
250// returns the absolute real address of the load area 98static inline u64 HvLpConfig_getMaxPhysicalProcessors(void)
251static inline u64 HvLpConfig_getLoadAddress(void)
252{ 99{
253 return itLpNaca.xLoadAreaAddr & 0x7fffffffffffffff; 100 return HvCall2(HvCallCfgGetPhysicalProcessors, HvLpConfig_getLpIndex(),
101 HvCallCfg_Max);
254} 102}
255//================================================================ 103
256static inline u64 HvLpConfig_getLoadPages(void) 104static inline HvLpVirtualLanIndexMap HvLpConfig_getVirtualLanIndexMapForLp(
257{ 105 HvLpIndex lp)
258 return itLpNaca.xLoadAreaChunks * HVPAGESPERCHUNK; 106{
107 /*
108 * This is a new function in V5R1 so calls to this on older
109 * hypervisors will return -1
110 */
111 u64 retVal = HvCall1(HvCallCfgGetVirtualLanIndexMap, lp);
112 if (retVal == -1)
113 retVal = 0;
114 return retVal;
259} 115}
260//================================================================ 116
261static inline int HvLpConfig_isBusOwnedByThisLp(HvBusNumber busNumber) 117static inline HvLpVirtualLanIndexMap HvLpConfig_getVirtualLanIndexMap(void)
262{ 118{
263 HvLpIndex busOwner = HvLpConfig_getBusOwner(busNumber); 119 return HvLpConfig_getVirtualLanIndexMapForLp(
264 return (busOwner == HvLpConfig_getLpIndex()); 120 HvLpConfig_getLpIndex_outline());
265} 121}
266//================================================================ 122
267static inline int HvLpConfig_doLpsCommunicateOnVirtualLan(HvLpIndex lp1, HvLpIndex lp2) 123static inline int HvLpConfig_doLpsCommunicateOnVirtualLan(HvLpIndex lp1,
124 HvLpIndex lp2)
268{ 125{
269 HvLpVirtualLanIndexMap virtualLanIndexMap1 = HvCallCfg_getVirtualLanIndexMap( lp1 ); 126 HvLpVirtualLanIndexMap virtualLanIndexMap1 =
270 HvLpVirtualLanIndexMap virtualLanIndexMap2 = HvCallCfg_getVirtualLanIndexMap( lp2 ); 127 HvLpConfig_getVirtualLanIndexMapForLp(lp1);
128 HvLpVirtualLanIndexMap virtualLanIndexMap2 =
129 HvLpConfig_getVirtualLanIndexMapForLp(lp2);
271 return ((virtualLanIndexMap1 & virtualLanIndexMap2) != 0); 130 return ((virtualLanIndexMap1 & virtualLanIndexMap2) != 0);
272} 131}
273//================================================================ 132
274static inline HvLpIndex HvLpConfig_getHostingLpIndex(HvLpIndex lp) 133static inline HvLpIndex HvLpConfig_getHostingLpIndex(HvLpIndex lp)
275{ 134{
276 return HvCallCfg_getHostingLpIndex(lp); 135 return HvCall1(HvCallCfgGetHostingLpIndex, lp);
277} 136}
278//================================================================
279 137
280#endif /* _HVLPCONFIG_H */ 138#endif /* _HVLPCONFIG_H */
diff --git a/include/asm-ppc64/iSeries/HvLpEvent.h b/include/asm-ppc64/iSeries/HvLpEvent.h
index 30936e433064..865000de79b6 100644
--- a/include/asm-ppc64/iSeries/HvLpEvent.h
+++ b/include/asm-ppc64/iSeries/HvLpEvent.h
@@ -1,27 +1,24 @@
1/* 1/*
2 * HvLpEvent.h 2 * HvLpEvent.h
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation 3 * Copyright (C) 2001 Mike Corrigan IBM Corporation
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 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 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 7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version. 8 * (at your option) any later version.
9 * 9 *
10 * This program is distributed in the hope that it will be useful, 10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU General Public License 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 16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */ 18 */
19 19
20//====================================================================== 20/* This file contains the class for HV events in the system. */
21// 21
22// This file contains the class for HV events in the system.
23//
24//=====================================================================
25#ifndef _HVLPEVENT_H 22#ifndef _HVLPEVENT_H
26#define _HVLPEVENT_H 23#define _HVLPEVENT_H
27 24
@@ -30,69 +27,70 @@
30#include <asm/iSeries/HvTypes.h> 27#include <asm/iSeries/HvTypes.h>
31#include <asm/iSeries/HvCallEvent.h> 28#include <asm/iSeries/HvCallEvent.h>
32 29
33//===================================================================== 30/*
34// 31 * HvLpEvent is the structure for Lp Event messages passed between
35// HvLpEvent is the structure for Lp Event messages passed between 32 * partitions through PLIC.
36// partitions through PLIC. 33 */
37// 34
38//===================================================================== 35struct HvEventFlags {
39 36 u8 xValid:1; /* Indicates a valid request x00-x00 */
40struct HvEventFlags 37 u8 xRsvd1:4; /* Reserved ... */
41{ 38 u8 xAckType:1; /* Immediate or deferred ... */
42 u8 xValid:1; // Indicates a valid request x00-x00 39 u8 xAckInd:1; /* Indicates if ACK required ... */
43 u8 xRsvd1:4; // Reserved ... 40 u8 xFunction:1; /* Interrupt or Acknowledge ... */
44 u8 xAckType:1; // Immediate or deferred ...
45 u8 xAckInd:1; // Indicates if ACK required ...
46 u8 xFunction:1; // Interrupt or Acknowledge ...
47}; 41};
48 42
49 43
50struct HvLpEvent 44struct HvLpEvent {
51{ 45 struct HvEventFlags xFlags; /* Event flags x00-x00 */
52 struct HvEventFlags xFlags; // Event flags x00-x00 46 u8 xType; /* Type of message x01-x01 */
53 u8 xType; // Type of message x01-x01 47 u16 xSubtype; /* Subtype for event x02-x03 */
54 u16 xSubtype; // Subtype for event x02-x03 48 u8 xSourceLp; /* Source LP x04-x04 */
55 u8 xSourceLp; // Source LP x04-x04 49 u8 xTargetLp; /* Target LP x05-x05 */
56 u8 xTargetLp; // Target LP x05-x05 50 u8 xSizeMinus1; /* Size of Derived class - 1 x06-x06 */
57 u8 xSizeMinus1; // Size of Derived class - 1 x06-x06 51 u8 xRc; /* RC for Ack flows x07-x07 */
58 u8 xRc; // RC for Ack flows x07-x07 52 u16 xSourceInstanceId; /* Source sides instance id x08-x09 */
59 u16 xSourceInstanceId; // Source sides instance id x08-x09 53 u16 xTargetInstanceId; /* Target sides instance id x0A-x0B */
60 u16 xTargetInstanceId; // Target sides instance id x0A-x0B
61 union { 54 union {
62 u32 xSubtypeData; // Data usable by the subtype x0C-x0F 55 u32 xSubtypeData; /* Data usable by the subtype x0C-x0F */
63 u16 xSubtypeDataShort[2]; // Data as 2 shorts 56 u16 xSubtypeDataShort[2]; /* Data as 2 shorts */
64 u8 xSubtypeDataChar[4]; // Data as 4 chars 57 u8 xSubtypeDataChar[4]; /* Data as 4 chars */
65 } x; 58 } x;
66 59
67 u64 xCorrelationToken; // Unique value for source/type x10-x17 60 u64 xCorrelationToken; /* Unique value for source/type x10-x17 */
68}; 61};
69 62
70// Lp Event handler function
71typedef void (*LpEventHandler)(struct HvLpEvent *, struct pt_regs *); 63typedef void (*LpEventHandler)(struct HvLpEvent *, struct pt_regs *);
72 64
73// Register a handler for an event type 65/* Register a handler for an event type - returns 0 on success */
74// returns 0 on success 66extern int HvLpEvent_registerHandler(HvLpEvent_Type eventType,
75extern int HvLpEvent_registerHandler( HvLpEvent_Type eventType, LpEventHandler hdlr); 67 LpEventHandler hdlr);
76
77// Unregister a handler for an event type
78// This call will sleep until the handler being removed is guaranteed to
79// be no longer executing on any CPU. Do not call with locks held.
80//
81// returns 0 on success
82// Unregister will fail if there are any paths open for the type
83extern int HvLpEvent_unregisterHandler( HvLpEvent_Type eventType );
84 68
85// Open an Lp Event Path for an event type 69/*
86// returns 0 on success 70 * Unregister a handler for an event type
87// openPath will fail if there is no handler registered for the event type. 71 *
88// The lpIndex specified is the partition index for the target partition 72 * This call will sleep until the handler being removed is guaranteed to
89// (for VirtualIo, VirtualLan and SessionMgr) other types specify zero) 73 * be no longer executing on any CPU. Do not call with locks held.
90extern int HvLpEvent_openPath( HvLpEvent_Type eventType, HvLpIndex lpIndex ); 74 *
75 * returns 0 on success
76 * Unregister will fail if there are any paths open for the type
77 */
78extern int HvLpEvent_unregisterHandler(HvLpEvent_Type eventType);
91 79
80/*
81 * Open an Lp Event Path for an event type
82 * returns 0 on success
83 * openPath will fail if there is no handler registered for the event type.
84 * The lpIndex specified is the partition index for the target partition
85 * (for VirtualIo, VirtualLan and SessionMgr) other types specify zero)
86 */
87extern int HvLpEvent_openPath(HvLpEvent_Type eventType, HvLpIndex lpIndex);
92 88
93// Close an Lp Event Path for a type and partition 89/*
94// returns 0 on sucess 90 * Close an Lp Event Path for a type and partition
95extern int HvLpEvent_closePath( HvLpEvent_Type eventType, HvLpIndex lpIndex ); 91 * returns 0 on sucess
92 */
93extern int HvLpEvent_closePath(HvLpEvent_Type eventType, HvLpIndex lpIndex);
96 94
97#define HvLpEvent_Type_Hypervisor 0 95#define HvLpEvent_Type_Hypervisor 0
98#define HvLpEvent_Type_MachineFac 1 96#define HvLpEvent_Type_MachineFac 1
@@ -141,4 +139,4 @@ extern int HvLpEvent_closePath( HvLpEvent_Type eventType, HvLpIndex lpIndex );
141#define HvLpDma_Rc_InvalidAddress 4 139#define HvLpDma_Rc_InvalidAddress 4
142#define HvLpDma_Rc_InvalidLength 5 140#define HvLpDma_Rc_InvalidLength 5
143 141
144#endif // _HVLPEVENT_H 142#endif /* _HVLPEVENT_H */
diff --git a/include/asm-ppc64/iSeries/HvReleaseData.h b/include/asm-ppc64/iSeries/HvReleaseData.h
index 183e5e738c26..01a1f13ea4a0 100644
--- a/include/asm-ppc64/iSeries/HvReleaseData.h
+++ b/include/asm-ppc64/iSeries/HvReleaseData.h
@@ -1,17 +1,17 @@
1/* 1/*
2 * HvReleaseData.h 2 * HvReleaseData.h
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation 3 * Copyright (C) 2001 Mike Corrigan IBM Corporation
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 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 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 7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version. 8 * (at your option) any later version.
9 * 9 *
10 * This program is distributed in the hope that it will be useful, 10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU General Public License 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 16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -19,47 +19,45 @@
19#ifndef _HVRELEASEDATA_H 19#ifndef _HVRELEASEDATA_H
20#define _HVRELEASEDATA_H 20#define _HVRELEASEDATA_H
21 21
22//============================================================================= 22/*
23// 23 * This control block contains the critical information about the
24// This control block contains the critical information about the 24 * release so that it can be changed in the future (ie, the virtual
25// release so that it can be changed in the future (ie, the virtual 25 * address of the OS's NACA).
26// address of the OS's NACA). 26 */
27//
28#include <asm/types.h> 27#include <asm/types.h>
29#include <asm/naca.h> 28#include <asm/naca.h>
30 29
31//============================================================================= 30/*
32// 31 * When we IPL a secondary partition, we will check if if the
33// When we IPL a secondary partition, we will check if if the 32 * secondary xMinPlicVrmIndex > the primary xVrmIndex.
34// secondary xMinPlicVrmIndex > the primary xVrmIndex. 33 * If it is then this tells PLIC that this secondary is not
35// If it is then this tells PLIC that this secondary is not 34 * supported running on this "old" of a level of PLIC.
36// supported running on this "old" of a level of PLIC. 35 *
37// 36 * Likewise, we will compare the primary xMinSlicVrmIndex to
38// Likewise, we will compare the primary xMinSlicVrmIndex to 37 * the secondary xVrmIndex.
39// the secondary xVrmIndex. 38 * If the primary xMinSlicVrmDelta > secondary xVrmDelta then we
40// If the primary xMinSlicVrmDelta > secondary xVrmDelta then we 39 * know that this PLIC does not support running an OS "that old".
41// know that this PLIC does not support running an OS "that old". 40 */
42//
43//=============================================================================
44 41
45struct HvReleaseData 42struct HvReleaseData {
46{ 43 u32 xDesc; /* Descriptor "HvRD" ebcdic x00-x03 */
47 u32 xDesc; // Descriptor "HvRD" ebcdic x00-x03 44 u16 xSize; /* Size of this control block x04-x05 */
48 u16 xSize; // Size of this control block x04-x05 45 u16 xVpdAreasPtrOffset; /* Offset in NACA of ItVpdAreas x06-x07 */
49 u16 xVpdAreasPtrOffset; // Offset in NACA of ItVpdAreas x06-x07 46 struct naca_struct *xSlicNacaAddr; /* Virt addr of SLIC NACA x08-x0F */
50 struct naca_struct * xSlicNacaAddr; // Virt addr of SLIC NACA x08-x0F 47 u32 xMsNucDataOffset; /* Offset of Linux Mapping Data x10-x13 */
51 u32 xMsNucDataOffset; // Offset of Linux Mapping Data x10-x13 48 u32 xRsvd1; /* Reserved x14-x17 */
52 u32 xRsvd1; // Reserved x14-x17 49 u16 xTagsMode:1; /* 0 == tags active, 1 == tags inactive */
53 u16 xTagsMode:1; // 0 == tags active, 1 == tags inactive 50 u16 xAddressSize:1; /* 0 == 64-bit, 1 == 32-bit */
54 u16 xAddressSize:1; // 0 == 64-bit, 1 == 32-bit 51 u16 xNoSharedProcs:1; /* 0 == shared procs, 1 == no shared */
55 u16 xNoSharedProcs:1; // 0 == shared procs, 1 == no shared 52 u16 xNoHMT:1; /* 0 == allow HMT, 1 == no HMT */
56 u16 xNoHMT:1; // 0 == allow HMT, 1 == no HMT 53 u16 xRsvd2:12; /* Reserved x18-x19 */
57 u16 xRsvd2:12; // Reserved x18-x19 54 u16 xVrmIndex; /* VRM Index of OS image x1A-x1B */
58 u16 xVrmIndex; // VRM Index of OS image x1A-x1B 55 u16 xMinSupportedPlicVrmIndex; /* Min PLIC level (soft) x1C-x1D */
59 u16 xMinSupportedPlicVrmIndex;// Min PLIC level (soft) x1C-x1D 56 u16 xMinCompatablePlicVrmIndex; /* Min PLIC levelP (hard) x1E-x1F */
60 u16 xMinCompatablePlicVrmIndex;// Min PLIC levelP (hard) x1E-x1F 57 char xVrmName[12]; /* Displayable name x20-x2B */
61 char xVrmName[12]; // Displayable name x20-x2B 58 char xRsvd3[20]; /* Reserved x2C-x3F */
62 char xRsvd3[20]; // Reserved x2C-x3F
63}; 59};
64 60
61extern struct HvReleaseData hvReleaseData;
62
65#endif /* _HVRELEASEDATA_H */ 63#endif /* _HVRELEASEDATA_H */
diff --git a/include/asm-ppc64/iSeries/HvTypes.h b/include/asm-ppc64/iSeries/HvTypes.h
index 3ec49c1aec32..b1ef2b4cb3e3 100644
--- a/include/asm-ppc64/iSeries/HvTypes.h
+++ b/include/asm-ppc64/iSeries/HvTypes.h
@@ -1,17 +1,17 @@
1/* 1/*
2 * HvTypes.h 2 * HvTypes.h
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation 3 * Copyright (C) 2001 Mike Corrigan IBM Corporation
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 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 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 7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version. 8 * (at your option) any later version.
9 * 9 *
10 * This program is distributed in the hope that it will be useful, 10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU General Public License 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 16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -19,74 +19,60 @@
19#ifndef _HVTYPES_H 19#ifndef _HVTYPES_H
20#define _HVTYPES_H 20#define _HVTYPES_H
21 21
22//=========================================================================== 22/*
23// Header File Id 23 * General typedefs for the hypervisor.
24// Name______________: HvTypes.H 24 */
25//
26// Description_______:
27//
28// General typedefs for the hypervisor.
29//
30// Declared Class(es):
31//
32//===========================================================================
33 25
34#include <asm/types.h> 26#include <asm/types.h>
35 27
36//-------------------------------------------------------------------
37// Typedefs
38//-------------------------------------------------------------------
39typedef u8 HvLpIndex; 28typedef u8 HvLpIndex;
40typedef u16 HvLpInstanceId; 29typedef u16 HvLpInstanceId;
41typedef u64 HvLpTOD; 30typedef u64 HvLpTOD;
42typedef u64 HvLpSystemSerialNum; 31typedef u64 HvLpSystemSerialNum;
43typedef u8 HvLpDeviceSerialNum[12]; 32typedef u8 HvLpDeviceSerialNum[12];
44typedef u16 HvLpSanHwSet; 33typedef u16 HvLpSanHwSet;
45typedef u16 HvLpBus; 34typedef u16 HvLpBus;
46typedef u16 HvLpBoard; 35typedef u16 HvLpBoard;
47typedef u16 HvLpCard; 36typedef u16 HvLpCard;
48typedef u8 HvLpDeviceType[4]; 37typedef u8 HvLpDeviceType[4];
49typedef u8 HvLpDeviceModel[3]; 38typedef u8 HvLpDeviceModel[3];
50typedef u64 HvIoToken; 39typedef u64 HvIoToken;
51typedef u8 HvLpName[8]; 40typedef u8 HvLpName[8];
52typedef u32 HvIoId; 41typedef u32 HvIoId;
53typedef u64 HvRealMemoryIndex; 42typedef u64 HvRealMemoryIndex;
54typedef u32 HvLpIndexMap; // Must hold HvMaxArchitectedLps bits!!! 43typedef u32 HvLpIndexMap; /* Must hold HVMAXARCHITECTEDLPS bits!!! */
55typedef u16 HvLpVrmIndex; 44typedef u16 HvLpVrmIndex;
56typedef u32 HvXmGenerationId; 45typedef u32 HvXmGenerationId;
57typedef u8 HvLpBusPool; 46typedef u8 HvLpBusPool;
58typedef u8 HvLpSharedPoolIndex; 47typedef u8 HvLpSharedPoolIndex;
59typedef u16 HvLpSharedProcUnitsX100; 48typedef u16 HvLpSharedProcUnitsX100;
60typedef u8 HvLpVirtualLanIndex; 49typedef u8 HvLpVirtualLanIndex;
61typedef u16 HvLpVirtualLanIndexMap; // Must hold HvMaxArchitectedVirtualLans bits!!! 50typedef u16 HvLpVirtualLanIndexMap; /* Must hold HVMAXARCHITECTEDVIRTUALLANS bits!!! */
62typedef u16 HvBusNumber; // Hypervisor Bus Number 51typedef u16 HvBusNumber; /* Hypervisor Bus Number */
63typedef u8 HvSubBusNumber; // Hypervisor SubBus Number 52typedef u8 HvSubBusNumber; /* Hypervisor SubBus Number */
64typedef u8 HvAgentId; // Hypervisor DevFn 53typedef u8 HvAgentId; /* Hypervisor DevFn */
54
65 55
56#define HVMAXARCHITECTEDLPS 32
57#define HVMAXARCHITECTEDVIRTUALLANS 16
58#define HVMAXARCHITECTEDVIRTUALDISKS 32
59#define HVMAXARCHITECTEDVIRTUALCDROMS 8
60#define HVMAXARCHITECTEDVIRTUALTAPES 8
61#define HVCHUNKSIZE (256 * 1024)
62#define HVPAGESIZE (4 * 1024)
63#define HVLPMINMEGSPRIMARY 256
64#define HVLPMINMEGSSECONDARY 64
65#define HVCHUNKSPERMEG 4
66#define HVPAGESPERMEG 256
67#define HVPAGESPERCHUNK 64
66 68
67#define HVMAXARCHITECTEDLPS 32
68#define HVMAXARCHITECTEDVIRTUALLANS 16
69#define HVMAXARCHITECTEDVIRTUALDISKS 32
70#define HVMAXARCHITECTEDVIRTUALCDROMS 8
71#define HVMAXARCHITECTEDVIRTUALTAPES 8
72#define HVCHUNKSIZE 256 * 1024
73#define HVPAGESIZE 4 * 1024
74#define HVLPMINMEGSPRIMARY 256
75#define HVLPMINMEGSSECONDARY 64
76#define HVCHUNKSPERMEG 4
77#define HVPAGESPERMEG 256
78#define HVPAGESPERCHUNK 64
79
80#define HvMaxArchitectedLps ((HvLpIndex)HVMAXARCHITECTEDLPS)
81#define HvMaxArchitectedVirtualLans ((HvLpVirtualLanIndex)16)
82#define HvLpIndexInvalid ((HvLpIndex)0xff) 69#define HvLpIndexInvalid ((HvLpIndex)0xff)
83 70
84//-------------------------------------------------------------------- 71/*
85// Enums for the sub-components under PLIC 72 * Enums for the sub-components under PLIC
86// Used in HvCall and HvPrimaryCall 73 * Used in HvCall and HvPrimaryCall
87//-------------------------------------------------------------------- 74 */
88enum HvCallCompIds 75enum {
89{
90 HvCallCompId = 0, 76 HvCallCompId = 0,
91 HvCallCpuCtlsCompId = 1, 77 HvCallCpuCtlsCompId = 1,
92 HvCallCfgCompId = 2, 78 HvCallCfgCompId = 2,
@@ -97,18 +83,18 @@ enum HvCallCompIds
97 HvCallSmCompId = 7, 83 HvCallSmCompId = 7,
98 HvCallSpdCompId = 8, 84 HvCallSpdCompId = 8,
99 HvCallXmCompId = 9, 85 HvCallXmCompId = 9,
100 HvCallRioCompId = 10, 86 HvCallRioCompId = 10,
101 HvCallRsvd3CompId = 11, 87 HvCallRsvd3CompId = 11,
102 HvCallRsvd2CompId = 12, 88 HvCallRsvd2CompId = 12,
103 HvCallRsvd1CompId = 13, 89 HvCallRsvd1CompId = 13,
104 HvCallMaxCompId = 14, 90 HvCallMaxCompId = 14,
105 HvPrimaryCallCompId = 0, 91 HvPrimaryCallCompId = 0,
106 HvPrimaryCallCfgCompId = 1, 92 HvPrimaryCallCfgCompId = 1,
107 HvPrimaryCallPciCompId = 2, 93 HvPrimaryCallPciCompId = 2,
108 HvPrimaryCallSmCompId = 3, 94 HvPrimaryCallSmCompId = 3,
109 HvPrimaryCallSpdCompId = 4, 95 HvPrimaryCallSpdCompId = 4,
110 HvPrimaryCallXmCompId = 5, 96 HvPrimaryCallXmCompId = 5,
111 HvPrimaryCallRioCompId = 6, 97 HvPrimaryCallRioCompId = 6,
112 HvPrimaryCallRsvd7CompId = 7, 98 HvPrimaryCallRsvd7CompId = 7,
113 HvPrimaryCallRsvd6CompId = 8, 99 HvPrimaryCallRsvd6CompId = 8,
114 HvPrimaryCallRsvd5CompId = 9, 100 HvPrimaryCallRsvd5CompId = 9,
@@ -116,7 +102,7 @@ enum HvCallCompIds
116 HvPrimaryCallRsvd3CompId = 11, 102 HvPrimaryCallRsvd3CompId = 11,
117 HvPrimaryCallRsvd2CompId = 12, 103 HvPrimaryCallRsvd2CompId = 12,
118 HvPrimaryCallRsvd1CompId = 13, 104 HvPrimaryCallRsvd1CompId = 13,
119 HvPrimaryCallMaxCompId = HvCallMaxCompId 105 HvPrimaryCallMaxCompId = HvCallMaxCompId
120}; 106};
121 107
122struct HvLpBufferList { 108struct HvLpBufferList {
diff --git a/include/asm-ppc64/iSeries/IoHriMainStore.h b/include/asm-ppc64/iSeries/IoHriMainStore.h
index ff00e865f620..45ed3ea67d06 100644
--- a/include/asm-ppc64/iSeries/IoHriMainStore.h
+++ b/include/asm-ppc64/iSeries/IoHriMainStore.h
@@ -1,17 +1,17 @@
1/* 1/*
2 * IoHriMainStore.h 2 * IoHriMainStore.h
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation 3 * Copyright (C) 2001 Mike Corrigan IBM Corporation
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 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 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 7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version. 8 * (at your option) any later version.
9 * 9 *
10 * This program is distributed in the hope that it will be useful, 10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU General Public License 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 16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -21,7 +21,7 @@
21#define _IOHRIMAINSTORE_H 21#define _IOHRIMAINSTORE_H
22 22
23/* Main Store Vpd for Condor,iStar,sStar */ 23/* Main Store Vpd for Condor,iStar,sStar */
24struct IoHriMainStoreSegment4 { 24struct IoHriMainStoreSegment4 {
25 u8 msArea0Exists:1; 25 u8 msArea0Exists:1;
26 u8 msArea1Exists:1; 26 u8 msArea1Exists:1;
27 u8 msArea2Exists:1; 27 u8 msArea2Exists:1;
@@ -51,7 +51,7 @@ struct IoHriMainStoreSegment4 {
51 u8 msArea1HasRiserVpd:1; 51 u8 msArea1HasRiserVpd:1;
52 u8 msArea2HasRiserVpd:1; 52 u8 msArea2HasRiserVpd:1;
53 u8 msArea3HasRiserVpd:1; 53 u8 msArea3HasRiserVpd:1;
54 u8 reserved5:4; 54 u8 reserved5:4;
55 u8 reserved6; 55 u8 reserved6;
56 u16 reserved7; 56 u16 reserved7;
57 57
@@ -82,8 +82,8 @@ struct IoHriMainStoreVpdFruData {
82}; 82};
83 83
84struct IoHriMainStoreAdrRangeBlock { 84struct IoHriMainStoreAdrRangeBlock {
85 void * blockStart __attribute((packed)); 85 void *blockStart __attribute((packed));
86 void * blockEnd __attribute((packed)); 86 void *blockEnd __attribute((packed));
87 u32 blockProcChipId __attribute((packed)); 87 u32 blockProcChipId __attribute((packed));
88}; 88};
89 89
@@ -102,7 +102,7 @@ struct IoHriMainStoreArea4 {
102 u32 procNodeId __attribute((packed)); 102 u32 procNodeId __attribute((packed));
103 103
104 u32 numAdrRangeBlocks __attribute((packed)); 104 u32 numAdrRangeBlocks __attribute((packed));
105 struct IoHriMainStoreAdrRangeBlock xAdrRangeBlock[MaxAreaAdrRangeBlocks] __attribute((packed)); 105 struct IoHriMainStoreAdrRangeBlock xAdrRangeBlock[MaxAreaAdrRangeBlocks] __attribute((packed));
106 106
107 struct IoHriMainStoreChipInfo1 chipInfo0 __attribute((packed)); 107 struct IoHriMainStoreChipInfo1 chipInfo0 __attribute((packed));
108 struct IoHriMainStoreChipInfo1 chipInfo1 __attribute((packed)); 108 struct IoHriMainStoreChipInfo1 chipInfo1 __attribute((packed));
@@ -113,17 +113,17 @@ struct IoHriMainStoreArea4 {
113 struct IoHriMainStoreChipInfo1 chipInfo6 __attribute((packed)); 113 struct IoHriMainStoreChipInfo1 chipInfo6 __attribute((packed));
114 struct IoHriMainStoreChipInfo1 chipInfo7 __attribute((packed)); 114 struct IoHriMainStoreChipInfo1 chipInfo7 __attribute((packed));
115 115
116 void * msRamAreaArray __attribute((packed)); 116 void *msRamAreaArray __attribute((packed));
117 u32 msRamAreaArrayNumEntries __attribute((packed)); 117 u32 msRamAreaArrayNumEntries __attribute((packed));
118 u32 msRamAreaArrayEntrySize __attribute((packed)); 118 u32 msRamAreaArrayEntrySize __attribute((packed));
119 119
120 u32 numaDimmExists __attribute((packed)); 120 u32 numaDimmExists __attribute((packed));
121 u32 numaDimmFunctional __attribute((packed)); 121 u32 numaDimmFunctional __attribute((packed));
122 void * numaDimmArray __attribute((packed)); 122 void *numaDimmArray __attribute((packed));
123 u32 numaDimmArrayNumEntries __attribute((packed)); 123 u32 numaDimmArrayNumEntries __attribute((packed));
124 u32 numaDimmArrayEntrySize __attribute((packed)); 124 u32 numaDimmArrayEntrySize __attribute((packed));
125 125
126 struct IoHriMainStoreVpdIdData idData __attribute((packed)); 126 struct IoHriMainStoreVpdIdData idData __attribute((packed));
127 127
128 u64 powerData __attribute((packed)); 128 u64 powerData __attribute((packed));
129 u64 cardAssemblyPartNum __attribute((packed)); 129 u64 cardAssemblyPartNum __attribute((packed));
@@ -143,7 +143,7 @@ struct IoHriMainStoreArea4 {
143}; 143};
144 144
145 145
146struct IoHriMainStoreSegment5 { 146struct IoHriMainStoreSegment5 {
147 u16 reserved1; 147 u16 reserved1;
148 u8 reserved2; 148 u8 reserved2;
149 u8 msVpdFormat; 149 u8 msVpdFormat;
@@ -151,17 +151,16 @@ struct IoHriMainStoreSegment5 {
151 u32 totalMainStore; 151 u32 totalMainStore;
152 u64 maxConfiguredMsAdr; 152 u64 maxConfiguredMsAdr;
153 153
154 struct IoHriMainStoreArea4* msAreaArray; 154 struct IoHriMainStoreArea4 *msAreaArray;
155 u32 msAreaArrayNumEntries; 155 u32 msAreaArrayNumEntries;
156 u32 msAreaArrayEntrySize; 156 u32 msAreaArrayEntrySize;
157 157
158 u32 msAreaExists; 158 u32 msAreaExists;
159 u32 msAreaFunctional; 159 u32 msAreaFunctional;
160 160
161 u64 reserved3; 161 u64 reserved3;
162}; 162};
163 163
164extern u64 xMsVpd[];
164 165
165 166#endif /* _IOHRIMAINSTORE_H */
166#endif // _IOHRIMAINSTORE_H
167
diff --git a/include/asm-ppc64/iSeries/IoHriProcessorVpd.h b/include/asm-ppc64/iSeries/IoHriProcessorVpd.h
index 965433888653..73b73d80b8b1 100644
--- a/include/asm-ppc64/iSeries/IoHriProcessorVpd.h
+++ b/include/asm-ppc64/iSeries/IoHriProcessorVpd.h
@@ -1,17 +1,17 @@
1/* 1/*
2 * IoHriProcessorVpd.h 2 * IoHriProcessorVpd.h
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation 3 * Copyright (C) 2001 Mike Corrigan IBM Corporation
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 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 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 7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version. 8 * (at your option) any later version.
9 * 9 *
10 * This program is distributed in the hope that it will be useful, 10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU General Public License 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 16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -19,16 +19,12 @@
19#ifndef _IOHRIPROCESSORVPD_H 19#ifndef _IOHRIPROCESSORVPD_H
20#define _IOHRIPROCESSORVPD_H 20#define _IOHRIPROCESSORVPD_H
21 21
22//===================================================================
23//
24// This struct maps Processor Vpd that is DMAd to SLIC by CSP
25//
26
27#include <asm/types.h> 22#include <asm/types.h>
28 23
29struct IoHriProcessorVpd 24/*
30{ 25 * This struct maps Processor Vpd that is DMAd to SLIC by CSP
31 26 */
27struct IoHriProcessorVpd {
32 u8 xFormat; // VPD format indicator x00-x00 28 u8 xFormat; // VPD format indicator x00-x00
33 u8 xProcStatus:8; // Processor State x01-x01 29 u8 xProcStatus:8; // Processor State x01-x01
34 u8 xSecondaryThreadCount; // Secondary thread cnt x02-x02 30 u8 xSecondaryThreadCount; // Secondary thread cnt x02-x02
@@ -40,12 +36,12 @@ struct IoHriProcessorVpd
40 u16 xRsvd2; // Reserved x06-x07 36 u16 xRsvd2; // Reserved x06-x07
41 u32 xHwNodeId; // Hardware node id x08-x0B 37 u32 xHwNodeId; // Hardware node id x08-x0B
42 u32 xHwProcId; // Hardware processor id x0C-x0F 38 u32 xHwProcId; // Hardware processor id x0C-x0F
43 39
44 u32 xTypeNum; // Card Type/CCIN number x10-x13 40 u32 xTypeNum; // Card Type/CCIN number x10-x13
45 u32 xModelNum; // Model/Feature number x14-x17 41 u32 xModelNum; // Model/Feature number x14-x17
46 u64 xSerialNum; // Serial number x18-x1F 42 u64 xSerialNum; // Serial number x18-x1F
47 char xPartNum[12]; // Book Part or FPU number x20-x2B 43 char xPartNum[12]; // Book Part or FPU number x20-x2B
48 char xMfgID[4]; // Manufacturing ID x2C-x2F 44 char xMfgID[4]; // Manufacturing ID x2C-x2F
49 45
50 u32 xProcFreq; // Processor Frequency x30-x33 46 u32 xProcFreq; // Processor Frequency x30-x33
51 u32 xTimeBaseFreq; // Time Base Frequency x34-x37 47 u32 xTimeBaseFreq; // Time Base Frequency x34-x37
@@ -71,7 +67,7 @@ struct IoHriProcessorVpd
71 u32 xDataL3CacheSizeKB; // L3 data cache size in KB x80-x83 67 u32 xDataL3CacheSizeKB; // L3 data cache size in KB x80-x83
72 u32 xDataL3CacheLineSize; // L3 data cache block size x84-x87 68 u32 xDataL3CacheLineSize; // L3 data cache block size x84-x87
73 u64 xRsvd6; // Reserved x88-x8F 69 u64 xRsvd6; // Reserved x88-x8F
74 70
75 u64 xFruLabel; // Card Location Label x90-x97 71 u64 xFruLabel; // Card Location Label x90-x97
76 u8 xSlotsOnCard; // Slots on card (0=no slots) x98-x98 72 u8 xSlotsOnCard; // Slots on card (0=no slots) x98-x98
77 u8 xPartLocFlag; // Location flag (0-pluggable 1-imbedded) x99-x99 73 u8 xPartLocFlag; // Location flag (0-pluggable 1-imbedded) x99-x99
@@ -79,10 +75,12 @@ struct IoHriProcessorVpd
79 u8 xSmartCardPortNo; // Smart card port number x9C-x9C 75 u8 xSmartCardPortNo; // Smart card port number x9C-x9C
80 u8 xRsvd7; // Reserved x9D-x9D 76 u8 xRsvd7; // Reserved x9D-x9D
81 u16 xFrameIdAndRackUnit; // Frame ID and rack unit adr x9E-x9F 77 u16 xFrameIdAndRackUnit; // Frame ID and rack unit adr x9E-x9F
82 78
83 u8 xRsvd8[24]; // Reserved xA0-xB7 79 u8 xRsvd8[24]; // Reserved xA0-xB7
84 80
85 char xProcSrc[72]; // CSP format SRC xB8-xFF 81 char xProcSrc[72]; // CSP format SRC xB8-xFF
86}; 82};
87 83
84extern struct IoHriProcessorVpd xIoHriProcessorVpd[];
85
88#endif /* _IOHRIPROCESSORVPD_H */ 86#endif /* _IOHRIPROCESSORVPD_H */
diff --git a/include/asm-ppc64/iSeries/ItExtVpdPanel.h b/include/asm-ppc64/iSeries/ItExtVpdPanel.h
index dee6b1273031..4c546a8802b4 100644
--- a/include/asm-ppc64/iSeries/ItExtVpdPanel.h
+++ b/include/asm-ppc64/iSeries/ItExtVpdPanel.h
@@ -1,17 +1,17 @@
1/* 1/*
2 * ItExtVpdPanel.h 2 * ItExtVpdPanel.h
3 * Copyright (C) 2002 Dave Boutcher IBM Corporation 3 * Copyright (C) 2002 Dave Boutcher IBM Corporation
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 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 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 7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version. 8 * (at your option) any later version.
9 * 9 *
10 * This program is distributed in the hope that it will be useful, 10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU General Public License 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 16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -20,39 +20,33 @@
20#define _ITEXTVPDPANEL_H 20#define _ITEXTVPDPANEL_H
21 21
22/* 22/*
23 * 23 * This struct maps the panel information
24 * This struct maps the panel information
25 * 24 *
26 * Warning: 25 * Warning:
27 * This data must match the architecture for the panel information 26 * This data must match the architecture for the panel information
28 *
29 */ 27 */
30 28
31
32/*-------------------------------------------------------------------
33 * Standard Includes
34 *-------------------------------------------------------------------
35*/
36#include <asm/types.h> 29#include <asm/types.h>
37 30
38struct ItExtVpdPanel 31struct ItExtVpdPanel {
39{ 32 /* Definition of the Extended Vpd On Panel Data Area */
40 // Definition of the Extended Vpd On Panel Data Area 33 char systemSerial[8];
41 char systemSerial[8]; 34 char mfgID[4];
42 char mfgID[4]; 35 char reserved1[24];
43 char reserved1[24]; 36 char machineType[4];
44 char machineType[4]; 37 char systemID[6];
45 char systemID[6]; 38 char somUniqueCnt[4];
46 char somUniqueCnt[4]; 39 char serialNumberCount;
47 char serialNumberCount; 40 char reserved2[7];
48 char reserved2[7]; 41 u16 bbu3;
49 u16 bbu3; 42 u16 bbu2;
50 u16 bbu2; 43 u16 bbu1;
51 u16 bbu1; 44 char xLocationLabel[8];
52 char xLocationLabel[8]; 45 u8 xRsvd1[6];
53 u8 xRsvd1[6]; 46 u16 xFrameId;
54 u16 xFrameId; 47 u8 xRsvd2[48];
55 u8 xRsvd2[48];
56}; 48};
57 49
58#endif /* _ITEXTVPDPANEL_H */ 50extern struct ItExtVpdPanel xItExtVpdPanel;
51
52#endif /* _ITEXTVPDPANEL_H */
diff --git a/include/asm-ppc64/iSeries/ItIplParmsReal.h b/include/asm-ppc64/iSeries/ItIplParmsReal.h
index 4d8b430ab12d..ae3417dc599e 100644
--- a/include/asm-ppc64/iSeries/ItIplParmsReal.h
+++ b/include/asm-ppc64/iSeries/ItIplParmsReal.h
@@ -1,17 +1,17 @@
1/* 1/*
2 * ItIplParmsReal.h 2 * ItIplParmsReal.h
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation 3 * Copyright (C) 2001 Mike Corrigan IBM Corporation
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 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 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 7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version. 8 * (at your option) any later version.
9 * 9 *
10 * This program is distributed in the hope that it will be useful, 10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU General Public License 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 16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -19,58 +19,53 @@
19#ifndef _ITIPLPARMSREAL_H 19#ifndef _ITIPLPARMSREAL_H
20#define _ITIPLPARMSREAL_H 20#define _ITIPLPARMSREAL_H
21 21
22//============================================================================== 22/*
23// 23 * This struct maps the IPL Parameters DMA'd from the SP.
24// This struct maps the IPL Parameters DMA'd from the SP. 24 *
25// 25 * Warning:
26// Warning: 26 * This data must map in exactly 64 bytes and match the architecture for
27// This data must map in exactly 64 bytes and match the architecture for 27 * the IPL parms
28// the IPL parms 28 */
29//
30//=============================================================================
31
32 29
33//-------------------------------------------------------------------
34// Standard Includes
35//-------------------------------------------------------------------
36#include <asm/types.h> 30#include <asm/types.h>
37 31
38struct ItIplParmsReal 32struct ItIplParmsReal {
39{ 33 u8 xFormat; // Defines format of IplParms x00-x00
40 u8 xFormat; // Defines format of IplParms x00-x00 34 u8 xRsvd01:6; // Reserved x01-x01
41 u8 xRsvd01:6; // Reserved x01-x01 35 u8 xAlternateSearch:1; // Alternate search indicator ...
42 u8 xAlternateSearch:1; // Alternate search indicator ... 36 u8 xUaSupplied:1; // UA Supplied on programmed IPL...
43 u8 xUaSupplied:1; // UA Supplied on programmed IPL ... 37 u8 xLsUaFormat; // Format byte for UA x02-x02
44 u8 xLsUaFormat; // Format byte for UA x02-x02 38 u8 xRsvd02; // Reserved x03-x03
45 u8 xRsvd02; // Reserved x03-x03 39 u32 xLsUa; // LS UA x04-x07
46 u32 xLsUa; // LS UA x04-x07 40 u32 xUnusedLsLid; // First OS LID to load x08-x0B
47 u32 xUnusedLsLid; // First OS LID to load x08-x0B 41 u16 xLsBusNumber; // LS Bus Number x0C-x0D
48 u16 xLsBusNumber; // LS Bus Number x0C-x0D 42 u8 xLsCardAdr; // LS Card Address x0E-x0E
49 u8 xLsCardAdr; // LS Card Address x0E-x0E 43 u8 xLsBoardAdr; // LS Board Address x0F-x0F
50 u8 xLsBoardAdr; // LS Board Address x0F-x0F 44 u32 xRsvd03; // Reserved x10-x13
51 u32 xRsvd03; // Reserved x10-x13 45 u8 xSpcnPresent:1; // SPCN present x14-x14
52 u8 xSpcnPresent:1; // SPCN present x14-x14 46 u8 xCpmPresent:1; // CPM present ...
53 u8 xCpmPresent:1; // CPM present ... 47 u8 xRsvd04:6; // Reserved ...
54 u8 xRsvd04:6; // Reserved ... 48 u8 xRsvd05:4; // Reserved x15-x15
55 u8 xRsvd05:4; // Reserved x15-x15 49 u8 xKeyLock:4; // Keylock setting ...
56 u8 xKeyLock:4; // Keylock setting ... 50 u8 xRsvd06:6; // Reserved x16-x16
57 u8 xRsvd06:6; // Reserved x16-x16 51 u8 xIplMode:2; // Ipl mode (A|B|C|D) ...
58 u8 xIplMode:2; // Ipl mode (A|B|C|D) ... 52 u8 xHwIplType; // Fast v slow v slow EC HW IPL x17-x17
59 u8 xHwIplType; // Fast v slow v slow EC HW IPL x17-x17 53 u16 xCpmEnabledIpl:1; // CPM in effect when IPL initiatedx18-x19
60 u16 xCpmEnabledIpl:1; // CPM in effect when IPL initiated x18-x19 54 u16 xPowerOnResetIpl:1; // Indicate POR condition ...
61 u16 xPowerOnResetIpl:1; // Indicate POR condition ... 55 u16 xMainStorePreserved:1; // Main Storage is preserved ...
62 u16 xMainStorePreserved:1; // Main Storage is preserved ... 56 u16 xRsvd07:13; // Reserved ...
63 u16 xRsvd07:13; // Reserved ... 57 u16 xIplSource:16; // Ipl source x1A-x1B
64 u16 xIplSource:16; // Ipl source x1A-x1B 58 u8 xIplReason:8; // Reason for this IPL x1C-x1C
65 u8 xIplReason:8; // Reason for this IPL x1C-x1C 59 u8 xRsvd08; // Reserved x1D-x1D
66 u8 xRsvd08; // Reserved x1D-x1D 60 u16 xRsvd09; // Reserved x1E-x1F
67 u16 xRsvd09; // Reserved x1E-x1F 61 u16 xSysBoxType; // System Box Type x20-x21
68 u16 xSysBoxType; // System Box Type x20-x21 62 u16 xSysProcType; // System Processor Type x22-x23
69 u16 xSysProcType; // System Processor Type x22-x23 63 u32 xRsvd10; // Reserved x24-x27
70 u32 xRsvd10; // Reserved x24-x27 64 u64 xRsvd11; // Reserved x28-x2F
71 u64 xRsvd11; // Reserved x28-x2F 65 u64 xRsvd12; // Reserved x30-x37
72 u64 xRsvd12; // Reserved x30-x37 66 u64 xRsvd13; // Reserved x38-x3F
73 u64 xRsvd13; // Reserved x38-x3F
74}; 67};
75 68
69extern struct ItIplParmsReal xItIplParmsReal;
70
76#endif /* _ITIPLPARMSREAL_H */ 71#endif /* _ITIPLPARMSREAL_H */
diff --git a/include/asm-ppc64/iSeries/ItLpNaca.h b/include/asm-ppc64/iSeries/ItLpNaca.h
index 5baffddfae1b..225d0176779d 100644
--- a/include/asm-ppc64/iSeries/ItLpNaca.h
+++ b/include/asm-ppc64/iSeries/ItLpNaca.h
@@ -1,17 +1,17 @@
1/* 1/*
2 * ItLpNaca.h 2 * ItLpNaca.h
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation 3 * Copyright (C) 2001 Mike Corrigan IBM Corporation
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 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 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 7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version. 8 * (at your option) any later version.
9 * 9 *
10 * This program is distributed in the hope that it will be useful, 10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU General Public License 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 16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -19,18 +19,15 @@
19#ifndef _ITLPNACA_H 19#ifndef _ITLPNACA_H
20#define _ITLPNACA_H 20#define _ITLPNACA_H
21 21
22//============================================================================= 22#include <linux/types.h>
23//
24// This control block contains the data that is shared between the
25// hypervisor (PLIC) and the OS.
26//
27//=============================================================================
28 23
29struct ItLpNaca 24/*
30{ 25 * This control block contains the data that is shared between the
31//============================================================================= 26 * hypervisor (PLIC) and the OS.
27 */
28
29struct ItLpNaca {
32// CACHE_LINE_1 0x0000 - 0x007F Contains read-only data 30// CACHE_LINE_1 0x0000 - 0x007F Contains read-only data
33//=============================================================================
34 u32 xDesc; // Eye catcher x00-x03 31 u32 xDesc; // Eye catcher x00-x03
35 u16 xSize; // Size of this class x04-x05 32 u16 xSize; // Size of this class x04-x05
36 u16 xIntHdlrOffset; // Offset to IntHdlr array x06-x07 33 u16 xIntHdlrOffset; // Offset to IntHdlr array x06-x07
@@ -59,30 +56,25 @@ struct ItLpNaca
59 u64 xLoadAreaAddr; // ER address of load area x28-x2F 56 u64 xLoadAreaAddr; // ER address of load area x28-x2F
60 u32 xLoadAreaChunks; // Chunks for the load area x30-x33 57 u32 xLoadAreaChunks; // Chunks for the load area x30-x33
61 u32 xPaseSysCallCRMask; // Mask used to test CR before x34-x37 58 u32 xPaseSysCallCRMask; // Mask used to test CR before x34-x37
62 // doing an ASR switch on PASE 59 // doing an ASR switch on PASE
63 // system call. 60 // system call.
64 u64 xSlicSegmentTablePtr; // Pointer to Slic seg table. x38-x3f 61 u64 xSlicSegmentTablePtr; // Pointer to Slic seg table. x38-x3f
65 u8 xRsvd1_4[64]; // x40-x7F 62 u8 xRsvd1_4[64]; // x40-x7F
66 63
67//=============================================================================
68// CACHE_LINE_2 0x0080 - 0x00FF Contains local read-write data 64// CACHE_LINE_2 0x0080 - 0x00FF Contains local read-write data
69//=============================================================================
70 u8 xRsvd2_0[128]; // Reserved x00-x7F 65 u8 xRsvd2_0[128]; // Reserved x00-x7F
71 66
72//=============================================================================
73// CACHE_LINE_3-6 0x0100 - 0x02FF Contains LP Queue indicators 67// CACHE_LINE_3-6 0x0100 - 0x02FF Contains LP Queue indicators
74// NB: Padding required to keep xInterrruptHdlr at x300 which is required 68// NB: Padding required to keep xInterrruptHdlr at x300 which is required
75// for v4r4 PLIC. 69// for v4r4 PLIC.
76//=============================================================================
77 u8 xOldLpQueue[128]; // LP Queue needed for v4r4 100-17F 70 u8 xOldLpQueue[128]; // LP Queue needed for v4r4 100-17F
78 u8 xRsvd3_0[384]; // Reserved 180-2FF 71 u8 xRsvd3_0[384]; // Reserved 180-2FF
79//============================================================================= 72
80// CACHE_LINE_7-8 0x0300 - 0x03FF Contains the address of the OS interrupt 73// CACHE_LINE_7-8 0x0300 - 0x03FF Contains the address of the OS interrupt
81// handlers 74// handlers
82//=============================================================================
83 u64 xInterruptHdlr[32]; // Interrupt handlers 300-x3FF 75 u64 xInterruptHdlr[32]; // Interrupt handlers 300-x3FF
84}; 76};
85 77
86//============================================================================= 78extern struct ItLpNaca itLpNaca;
87 79
88#endif /* _ITLPNACA_H */ 80#endif /* _ITLPNACA_H */
diff --git a/include/asm-ppc64/iSeries/ItLpQueue.h b/include/asm-ppc64/iSeries/ItLpQueue.h
index 4f4dde2a638d..393299e04d7f 100644
--- a/include/asm-ppc64/iSeries/ItLpQueue.h
+++ b/include/asm-ppc64/iSeries/ItLpQueue.h
@@ -1,17 +1,17 @@
1/* 1/*
2 * ItLpQueue.h 2 * ItLpQueue.h
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation 3 * Copyright (C) 2001 Mike Corrigan IBM Corporation
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 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 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 7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version. 8 * (at your option) any later version.
9 * 9 *
10 * This program is distributed in the hope that it will be useful, 10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU General Public License 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 16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -19,54 +19,54 @@
19#ifndef _ITLPQUEUE_H 19#ifndef _ITLPQUEUE_H
20#define _ITLPQUEUE_H 20#define _ITLPQUEUE_H
21 21
22//============================================================================= 22/*
23// 23 * This control block defines the simple LP queue structure that is
24// This control block defines the simple LP queue structure that is 24 * shared between the hypervisor (PLIC) and the OS in order to send
25// shared between the hypervisor (PLIC) and the OS in order to send 25 * events to an LP.
26// events to an LP. 26 */
27//
28 27
29#include <asm/types.h> 28#include <asm/types.h>
30#include <asm/ptrace.h> 29#include <asm/ptrace.h>
31 30
32struct HvLpEvent; 31struct HvLpEvent;
33 32
34#define ITMaxLpQueues 8 33#define ITMaxLpQueues 8
35 34
36#define NotUsed 0 // Queue will not be used by PLIC 35#define NotUsed 0 // Queue will not be used by PLIC
37#define DedicatedIo 1 // Queue dedicated to IO processor specified 36#define DedicatedIo 1 // Queue dedicated to IO processor specified
38#define DedicatedLp 2 // Queue dedicated to LP specified 37#define DedicatedLp 2 // Queue dedicated to LP specified
39#define Shared 3 // Queue shared for both IO and LP 38#define Shared 3 // Queue shared for both IO and LP
40 39
41#define LpEventStackSize 4096 40#define LpEventStackSize 4096
42#define LpEventMaxSize 256 41#define LpEventMaxSize 256
43#define LpEventAlign 64 42#define LpEventAlign 64
44 43
45struct ItLpQueue 44struct ItLpQueue {
46{ 45/*
47// 46 * The xSlicCurEventPtr is the pointer to the next event stack entry
48// The xSlicCurEventPtr is the pointer to the next event stack entry that will 47 * that will become valid. The OS must peek at this entry to determine
49// become valid. The OS must peek at this entry to determine if it is valid. 48 * if it is valid. PLIC will set the valid indicator as the very last
50// PLIC will set the valid indicator as the very last store into that entry. 49 * store into that entry.
51// 50 *
52// When the OS has completed processing of the event then it will mark the event 51 * When the OS has completed processing of the event then it will mark
53// as invalid so that PLIC knows it can store into that event location again. 52 * the event as invalid so that PLIC knows it can store into that event
54// 53 * location again.
55// If the event stack fills and there are overflow events, then PLIC will set 54 *
56// the xPlicOverflowIntPending flag in which case the OS will have to fetch the 55 * If the event stack fills and there are overflow events, then PLIC
57// additional LP events once they have drained the event stack. 56 * will set the xPlicOverflowIntPending flag in which case the OS will
58// 57 * have to fetch the additional LP events once they have drained the
59// The first 16-bytes are known by both the OS and PLIC. The remainder of the 58 * event stack.
60// cache line is for use by the OS. 59 *
61// 60 * The first 16-bytes are known by both the OS and PLIC. The remainder
62//============================================================================= 61 * of the cache line is for use by the OS.
62 */
63 u8 xPlicOverflowIntPending;// 0x00 Overflow events are pending 63 u8 xPlicOverflowIntPending;// 0x00 Overflow events are pending
64 u8 xPlicStatus; // 0x01 DedicatedIo or DedicatedLp or NotUsed 64 u8 xPlicStatus; // 0x01 DedicatedIo or DedicatedLp or NotUsed
65 u16 xSlicLogicalProcIndex; // 0x02 Logical Proc Index for correlation 65 u16 xSlicLogicalProcIndex; // 0x02 Logical Proc Index for correlation
66 u8 xPlicRsvd[12]; // 0x04 66 u8 xPlicRsvd[12]; // 0x04
67 char* xSlicCurEventPtr; // 0x10 67 char *xSlicCurEventPtr; // 0x10
68 char* xSlicLastValidEventPtr; // 0x18 68 char *xSlicLastValidEventPtr; // 0x18
69 char* xSlicEventStackPtr; // 0x20 69 char *xSlicEventStackPtr; // 0x20
70 u8 xIndex; // 0x28 unique sequential index. 70 u8 xIndex; // 0x28 unique sequential index.
71 u8 xSlicRsvd[3]; // 0x29-2b 71 u8 xSlicRsvd[3]; // 0x29-2b
72 u32 xInUseWord; // 0x2C 72 u32 xInUseWord; // 0x2C
@@ -76,17 +76,9 @@ struct ItLpQueue
76 76
77extern struct ItLpQueue xItLpQueue; 77extern struct ItLpQueue xItLpQueue;
78 78
79extern struct HvLpEvent * ItLpQueue_getNextLpEvent( struct ItLpQueue * ); 79extern struct HvLpEvent *ItLpQueue_getNextLpEvent(struct ItLpQueue *);
80extern int ItLpQueue_isLpIntPending( struct ItLpQueue * ); 80extern int ItLpQueue_isLpIntPending(struct ItLpQueue *);
81extern unsigned ItLpQueue_process( struct ItLpQueue *, struct pt_regs * ); 81extern unsigned ItLpQueue_process(struct ItLpQueue *, struct pt_regs *);
82extern void ItLpQueue_clearValid( struct HvLpEvent * ); 82extern void ItLpQueue_clearValid(struct HvLpEvent *);
83
84static __inline__ void process_iSeries_events( void )
85{
86 __asm__ __volatile__ (
87 " li 0,0x5555 \n\
88 sc"
89 : : : "r0", "r3" );
90}
91 83
92#endif /* _ITLPQUEUE_H */ 84#endif /* _ITLPQUEUE_H */
diff --git a/include/asm-ppc64/iSeries/ItLpRegSave.h b/include/asm-ppc64/iSeries/ItLpRegSave.h
index dafc4c813788..1b3087e76205 100644
--- a/include/asm-ppc64/iSeries/ItLpRegSave.h
+++ b/include/asm-ppc64/iSeries/ItLpRegSave.h
@@ -1,17 +1,17 @@
1/* 1/*
2 * ItLpRegSave.h 2 * ItLpRegSave.h
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation 3 * Copyright (C) 2001 Mike Corrigan IBM Corporation
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 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 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 7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version. 8 * (at your option) any later version.
9 * 9 *
10 * This program is distributed in the hope that it will be useful, 10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU General Public License 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 16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -19,33 +19,30 @@
19#ifndef _ITLPREGSAVE_H 19#ifndef _ITLPREGSAVE_H
20#define _ITLPREGSAVE_H 20#define _ITLPREGSAVE_H
21 21
22//===================================================================================== 22/*
23// 23 * This control block contains the data that is shared between PLIC
24// This control block contains the data that is shared between PLIC 24 * and the OS
25// and the OS 25 */
26//
27//
28 26
29struct ItLpRegSave 27struct ItLpRegSave {
30{
31 u32 xDesc; // Eye catcher "LpRS" ebcdic 000-003 28 u32 xDesc; // Eye catcher "LpRS" ebcdic 000-003
32 u16 xSize; // Size of this class 004-005 29 u16 xSize; // Size of this class 004-005
33 u8 xInUse; // Area is live 006-007 30 u8 xInUse; // Area is live 006-007
34 u8 xRsvd1[9]; // Reserved 007-00F 31 u8 xRsvd1[9]; // Reserved 007-00F
35 32
36 u8 xFixedRegSave[352]; // Fixed Register Save Area 010-16F 33 u8 xFixedRegSave[352]; // Fixed Register Save Area 010-16F
37 u32 xCTRL; // Control Register 170-173 34 u32 xCTRL; // Control Register 170-173
38 u32 xDEC; // Decrementer 174-177 35 u32 xDEC; // Decrementer 174-177
39 u32 xFPSCR; // FP Status and Control Reg 178-17B 36 u32 xFPSCR; // FP Status and Control Reg 178-17B
40 u32 xPVR; // Processor Version Number 17C-17F 37 u32 xPVR; // Processor Version Number 17C-17F
41 38
42 u64 xMMCR0; // Monitor Mode Control Reg 0 180-187 39 u64 xMMCR0; // Monitor Mode Control Reg 0 180-187
43 u32 xPMC1; // Perf Monitor Counter 1 188-18B 40 u32 xPMC1; // Perf Monitor Counter 1 188-18B
44 u32 xPMC2; // Perf Monitor Counter 2 18C-18F 41 u32 xPMC2; // Perf Monitor Counter 2 18C-18F
45 u32 xPMC3; // Perf Monitor Counter 3 190-193 42 u32 xPMC3; // Perf Monitor Counter 3 190-193
46 u32 xPMC4; // Perf Monitor Counter 4 194-197 43 u32 xPMC4; // Perf Monitor Counter 4 194-197
47 u32 xPIR; // Processor ID Reg 198-19B 44 u32 xPIR; // Processor ID Reg 198-19B
48 45
49 u32 xMMCR1; // Monitor Mode Control Reg 1 19C-19F 46 u32 xMMCR1; // Monitor Mode Control Reg 1 19C-19F
50 u32 xMMCRA; // Monitor Mode Control Reg A 1A0-1A3 47 u32 xMMCRA; // Monitor Mode Control Reg A 1A0-1A3
51 u32 xPMC5; // Perf Monitor Counter 5 1A4-1A7 48 u32 xPMC5; // Perf Monitor Counter 5 1A4-1A7
@@ -57,17 +54,17 @@ struct ItLpRegSave
57 u32 xRsvd; // Reserved 1BC-1BF 54 u32 xRsvd; // Reserved 1BC-1BF
58 55
59 u64 xACCR; // Address Compare Control Reg 1C0-1C7 56 u64 xACCR; // Address Compare Control Reg 1C0-1C7
60 u64 xIMR; // Instruction Match Register 1C8-1CF 57 u64 xIMR; // Instruction Match Register 1C8-1CF
61 u64 xSDR1; // Storage Description Reg 1 1D0-1D7 58 u64 xSDR1; // Storage Description Reg 1 1D0-1D7
62 u64 xSPRG0; // Special Purpose Reg General0 1D8-1DF 59 u64 xSPRG0; // Special Purpose Reg General0 1D8-1DF
63 u64 xSPRG1; // Special Purpose Reg General1 1E0-1E7 60 u64 xSPRG1; // Special Purpose Reg General1 1E0-1E7
64 u64 xSPRG2; // Special Purpose Reg General2 1E8-1EF 61 u64 xSPRG2; // Special Purpose Reg General2 1E8-1EF
65 u64 xSPRG3; // Special Purpose Reg General3 1F0-1F7 62 u64 xSPRG3; // Special Purpose Reg General3 1F0-1F7
66 u64 xTB; // Time Base Register 1F8-1FF 63 u64 xTB; // Time Base Register 1F8-1FF
67 64
68 u64 xFPR[32]; // Floating Point Registers 200-2FF 65 u64 xFPR[32]; // Floating Point Registers 200-2FF
69 66
70 u64 xMSR; // Machine State Register 300-307 67 u64 xMSR; // Machine State Register 300-307
71 u64 xNIA; // Next Instruction Address 308-30F 68 u64 xNIA; // Next Instruction Address 308-30F
72 69
73 u64 xDABR; // Data Address Breakpoint Reg 310-317 70 u64 xDABR; // Data Address Breakpoint Reg 310-317
@@ -76,8 +73,8 @@ struct ItLpRegSave
76 u64 xHID0; // HW Implementation Dependent0 320-327 73 u64 xHID0; // HW Implementation Dependent0 320-327
77 74
78 u64 xHID4; // HW Implementation Dependent4 328-32F 75 u64 xHID4; // HW Implementation Dependent4 328-32F
79 u64 xSCOMd; // SCON Data Reg (SPRG4) 330-337 76 u64 xSCOMd; // SCON Data Reg (SPRG4) 330-337
80 u64 xSCOMc; // SCON Command Reg (SPRG5) 338-33F 77 u64 xSCOMc; // SCON Command Reg (SPRG5) 338-33F
81 u64 xSDAR; // Sample Data Address Register 340-347 78 u64 xSDAR; // Sample Data Address Register 340-347
82 u64 xSIAR; // Sample Inst Address Register 348-34F 79 u64 xSIAR; // Sample Inst Address Register 348-34F
83 80
diff --git a/include/asm-ppc64/iSeries/ItSpCommArea.h b/include/asm-ppc64/iSeries/ItSpCommArea.h
index f1b56f9e11e2..5535f8271c9f 100644
--- a/include/asm-ppc64/iSeries/ItSpCommArea.h
+++ b/include/asm-ppc64/iSeries/ItSpCommArea.h
@@ -1,29 +1,27 @@
1/* 1/*
2 * ItSpCommArea.h 2 * ItSpCommArea.h
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation 3 * Copyright (C) 2001 Mike Corrigan IBM Corporation
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 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 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 7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version. 8 * (at your option) any later version.
9 * 9 *
10 * This program is distributed in the hope that it will be useful, 10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU General Public License 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 16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */ 18 */
19 19
20
21#ifndef _ITSPCOMMAREA_H 20#ifndef _ITSPCOMMAREA_H
22#define _ITSPCOMMAREA_H 21#define _ITSPCOMMAREA_H
23 22
24 23
25struct SpCommArea 24struct SpCommArea {
26{
27 u32 xDesc; // Descriptor (only in new formats) 000-003 25 u32 xDesc; // Descriptor (only in new formats) 000-003
28 u8 xFormat; // Format (only in new formats) 004-004 26 u8 xFormat; // Format (only in new formats) 004-004
29 u8 xRsvd1[11]; // Reserved 005-00F 27 u8 xRsvd1[11]; // Reserved 005-00F
diff --git a/include/asm-ppc64/iSeries/ItVpdAreas.h b/include/asm-ppc64/iSeries/ItVpdAreas.h
index d120439f30a5..71b3ad24f95a 100644
--- a/include/asm-ppc64/iSeries/ItVpdAreas.h
+++ b/include/asm-ppc64/iSeries/ItVpdAreas.h
@@ -1,17 +1,17 @@
1/* 1/*
2 * ItVpdAreas.h 2 * ItVpdAreas.h
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation 3 * Copyright (C) 2001 Mike Corrigan IBM Corporation
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 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 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 7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version. 8 * (at your option) any later version.
9 * 9 *
10 * This program is distributed in the hope that it will be useful, 10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU General Public License 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 16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -19,78 +19,71 @@
19#ifndef _ITVPDAREAS_H 19#ifndef _ITVPDAREAS_H
20#define _ITVPDAREAS_H 20#define _ITVPDAREAS_H
21 21
22//===================================================================================== 22/*
23// 23 * This file defines the address and length of all of the VPD area passed to
24// This file defines the address and length of all of the VPD area passed to 24 * the OS from PLIC (most of which start from the SP).
25// the OS from PLIC (most of which start from the SP). 25 */
26//
27 26
28#include <asm/types.h> 27#include <asm/types.h>
29 28
30// VPD Entry index is carved in stone - cannot be changed (easily). 29/* VPD Entry index is carved in stone - cannot be changed (easily). */
31#define ItVpdCecVpd 0 30#define ItVpdCecVpd 0
32#define ItVpdDynamicSpace 1 31#define ItVpdDynamicSpace 1
33#define ItVpdExtVpd 2 32#define ItVpdExtVpd 2
34#define ItVpdExtVpdOnPanel 3 33#define ItVpdExtVpdOnPanel 3
35#define ItVpdFirstPaca 4 34#define ItVpdFirstPaca 4
36#define ItVpdIoVpd 5 35#define ItVpdIoVpd 5
37#define ItVpdIplParms 6 36#define ItVpdIplParms 6
38#define ItVpdMsVpd 7 37#define ItVpdMsVpd 7
39#define ItVpdPanelVpd 8 38#define ItVpdPanelVpd 8
40#define ItVpdLpNaca 9 39#define ItVpdLpNaca 9
41#define ItVpdBackplaneAndMaybeClockCardVpd 10 40#define ItVpdBackplaneAndMaybeClockCardVpd 10
42#define ItVpdRecoveryLogBuffer 11 41#define ItVpdRecoveryLogBuffer 11
43#define ItVpdSpCommArea 12 42#define ItVpdSpCommArea 12
44#define ItVpdSpLogBuffer 13 43#define ItVpdSpLogBuffer 13
45#define ItVpdSpLogBufferSave 14 44#define ItVpdSpLogBufferSave 14
46#define ItVpdSpCardVpd 15 45#define ItVpdSpCardVpd 15
47#define ItVpdFirstProcVpd 16 46#define ItVpdFirstProcVpd 16
48#define ItVpdApModelVpd 17 47#define ItVpdApModelVpd 17
49#define ItVpdClockCardVpd 18 48#define ItVpdClockCardVpd 18
50#define ItVpdBusExtCardVpd 19 49#define ItVpdBusExtCardVpd 19
51#define ItVpdProcCapacityVpd 20 50#define ItVpdProcCapacityVpd 20
52#define ItVpdInteractiveCapacityVpd 21 51#define ItVpdInteractiveCapacityVpd 21
53#define ItVpdFirstSlotLabel 22 52#define ItVpdFirstSlotLabel 22
54#define ItVpdFirstLpQueue 23 53#define ItVpdFirstLpQueue 23
55#define ItVpdFirstL3CacheVpd 24 54#define ItVpdFirstL3CacheVpd 24
56#define ItVpdFirstProcFruVpd 25 55#define ItVpdFirstProcFruVpd 25
57
58#define ItVpdMaxEntries 26
59 56
57#define ItVpdMaxEntries 26
60 58
61#define ItDmaMaxEntries 10 59#define ItDmaMaxEntries 10
62 60
63#define ItVpdAreasMaxSlotLabels 192 61#define ItVpdAreasMaxSlotLabels 192
64 62
65 63
66struct SlicVpdAdrs { 64struct ItVpdAreas {
67 u32 pad1; 65 u32 xSlicDesc; // Descriptor 000-003
68 void * vpdAddr; 66 u16 xSlicSize; // Size of this control block 004-005
67 u16 xPlicAdjustVpdLens:1; // Flag to indicate new interface006-007
68 u16 xRsvd1:15; // Reserved bits ...
69 u16 xSlicVpdEntries; // Number of VPD entries 008-009
70 u16 xSlicDmaEntries; // Number of DMA entries 00A-00B
71 u16 xSlicMaxLogicalProcs; // Maximum logical processors 00C-00D
72 u16 xSlicMaxPhysicalProcs; // Maximum physical processors 00E-00F
73 u16 xSlicDmaToksOffset; // Offset into this of array 010-011
74 u16 xSlicVpdAdrsOffset; // Offset into this of array 012-013
75 u16 xSlicDmaLensOffset; // Offset into this of array 014-015
76 u16 xSlicVpdLensOffset; // Offset into this of array 016-017
77 u16 xSlicMaxSlotLabels; // Maximum number of slot labels018-019
78 u16 xSlicMaxLpQueues; // Maximum number of LP Queues 01A-01B
79 u8 xRsvd2[4]; // Reserved 01C-01F
80 u64 xRsvd3[12]; // Reserved 020-07F
81 u32 xPlicDmaLens[ItDmaMaxEntries];// Array of DMA lengths 080-0A7
82 u32 xPlicDmaToks[ItDmaMaxEntries];// Array of DMA tokens 0A8-0CF
83 u32 xSlicVpdLens[ItVpdMaxEntries];// Array of VPD lengths 0D0-12F
84 void *xSlicVpdAdrs[ItVpdMaxEntries];// Array of VPD buffers 130-1EF
69}; 85};
70 86
71 87extern struct ItVpdAreas itVpdAreas;
72struct ItVpdAreas
73{
74 u32 xSlicDesc; // Descriptor 000-003
75 u16 xSlicSize; // Size of this control block 004-005
76 u16 xPlicAdjustVpdLens:1; // Flag to indicate new interface 006-007
77 u16 xRsvd1:15; // Reserved bits ...
78 u16 xSlicVpdEntries; // Number of VPD entries 008-009
79 u16 xSlicDmaEntries; // Number of DMA entries 00A-00B
80 u16 xSlicMaxLogicalProcs; // Maximum logical processors 00C-00D
81 u16 xSlicMaxPhysicalProcs; // Maximum physical processors 00E-00F
82 u16 xSlicDmaToksOffset; // Offset into this of array 010-011
83 u16 xSlicVpdAdrsOffset; // Offset into this of array 012-013
84 u16 xSlicDmaLensOffset; // Offset into this of array 014-015
85 u16 xSlicVpdLensOffset; // Offset into this of array 016-017
86 u16 xSlicMaxSlotLabels; // Maximum number of slot labels 018-019
87 u16 xSlicMaxLpQueues; // Maximum number of LP Queues 01A-01B
88 u8 xRsvd2[4]; // Reserved 01C-01F
89 u64 xRsvd3[12]; // Reserved 020-07F
90 u32 xPlicDmaLens[ItDmaMaxEntries];// Array of DMA lengths 080-0A7
91 u32 xPlicDmaToks[ItDmaMaxEntries];// Array of DMA tokens 0A8-0CF
92 u32 xSlicVpdLens[ItVpdMaxEntries];// Array of VPD lengths 0D0-12F
93 void * xSlicVpdAdrs[ItVpdMaxEntries];// Array of VPD buffers 130-1EF
94};
95 88
96#endif /* _ITVPDAREAS_H */ 89#endif /* _ITVPDAREAS_H */
diff --git a/include/asm-ppc64/iSeries/LparData.h b/include/asm-ppc64/iSeries/LparData.h
deleted file mode 100644
index e54f3b686e58..000000000000
--- a/include/asm-ppc64/iSeries/LparData.h
+++ /dev/null
@@ -1,49 +0,0 @@
1/*
2 * LparData.h
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#ifndef _LPARDATA_H
21#define _LPARDATA_H
22
23#include <asm/types.h>
24#include <asm/page.h>
25#include <asm/abs_addr.h>
26
27#include <asm/iSeries/ItLpNaca.h>
28#include <asm/iSeries/ItLpRegSave.h>
29#include <asm/iSeries/HvReleaseData.h>
30#include <asm/iSeries/LparMap.h>
31#include <asm/iSeries/ItVpdAreas.h>
32#include <asm/iSeries/ItIplParmsReal.h>
33#include <asm/iSeries/ItExtVpdPanel.h>
34#include <asm/iSeries/ItLpQueue.h>
35#include <asm/iSeries/IoHriProcessorVpd.h>
36
37extern struct LparMap xLparMap;
38extern struct HvReleaseData hvReleaseData;
39extern struct ItLpNaca itLpNaca;
40extern struct ItIplParmsReal xItIplParmsReal;
41extern struct ItExtVpdPanel xItExtVpdPanel;
42extern struct IoHriProcessorVpd xIoHriProcessorVpd[];
43extern struct ItLpQueue xItLpQueue;
44extern struct ItVpdAreas itVpdAreas;
45extern u64 xMsVpd[];
46extern struct msChunks msChunks;
47
48
49#endif /* _LPARDATA_H */
diff --git a/include/asm-ppc64/iSeries/LparMap.h b/include/asm-ppc64/iSeries/LparMap.h
index 075205bb0f4a..038e5df7e9f8 100644
--- a/include/asm-ppc64/iSeries/LparMap.h
+++ b/include/asm-ppc64/iSeries/LparMap.h
@@ -1,17 +1,17 @@
1/* 1/*
2 * LparMap.h 2 * LparMap.h
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation 3 * Copyright (C) 2001 Mike Corrigan IBM Corporation
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 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 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 7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version. 8 * (at your option) any later version.
9 * 9 *
10 * This program is distributed in the hope that it will be useful, 10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU General Public License 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 16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -21,13 +21,14 @@
21 21
22#include <asm/types.h> 22#include <asm/types.h>
23 23
24/* The iSeries hypervisor will set up mapping for one or more 24/*
25 * The iSeries hypervisor will set up mapping for one or more
25 * ESID/VSID pairs (in SLB/segment registers) and will set up 26 * ESID/VSID pairs (in SLB/segment registers) and will set up
26 * mappings of one or more ranges of pages to VAs. 27 * mappings of one or more ranges of pages to VAs.
27 * We will have the hypervisor set up the ESID->VSID mapping 28 * We will have the hypervisor set up the ESID->VSID mapping
28 * for the four kernel segments (C-F). With shared processors, 29 * for the four kernel segments (C-F). With shared processors,
29 * the hypervisor will clear all segment registers and reload 30 * the hypervisor will clear all segment registers and reload
30 * these four whenever the processor is switched from one 31 * these four whenever the processor is switched from one
31 * partition to another. 32 * partition to another.
32 */ 33 */
33 34
@@ -38,30 +39,31 @@
38 * need to be located within the load area (if the total partition size 39 * need to be located within the load area (if the total partition size
39 * is 64 MB), but cannot be mapped. Typically, this should specify 40 * is 64 MB), but cannot be mapped. Typically, this should specify
40 * to map half (32 MB) of the load area. 41 * to map half (32 MB) of the load area.
41 * 42 *
42 * The hypervisor will set up page table entries for the number of 43 * The hypervisor will set up page table entries for the number of
43 * pages specified. 44 * pages specified.
44 * 45 *
45 * In 32-bit mode, the hypervisor will load all four of the 46 * In 32-bit mode, the hypervisor will load all four of the
46 * segment registers (identified by the low-order four bits of the 47 * segment registers (identified by the low-order four bits of the
47 * Esid field. In 64-bit mode, the hypervisor will load one SLB 48 * Esid field. In 64-bit mode, the hypervisor will load one SLB
48 * entry to map the Esid to the Vsid. 49 * entry to map the Esid to the Vsid.
49*/ 50*/
50 51
51// Hypervisor initially maps 32MB of the load area 52/* Hypervisor initially maps 32MB of the load area */
52#define HvPagesToMap 8192 53#define HvPagesToMap 8192
53 54
54struct LparMap 55struct LparMap {
55{ 56 u64 xNumberEsids; // Number of ESID/VSID pairs (1)
56 u64 xNumberEsids; // Number of ESID/VSID pairs (1) 57 u64 xNumberRanges; // Number of VA ranges to map (1)
57 u64 xNumberRanges; // Number of VA ranges to map (1) 58 u64 xSegmentTableOffs; // Page number within load area of seg table (0)
58 u64 xSegmentTableOffs; // Page number within load area of seg table (0) 59 u64 xRsvd[5];
59 u64 xRsvd[5]; // Reserved (0) 60 u64 xKernelEsid; // Esid used to map kernel load (0x0C00000000)
60 u64 xKernelEsid; // Esid used to map kernel load (0x0C00000000) 61 u64 xKernelVsid; // Vsid used to map kernel load (0x0C00000000)
61 u64 xKernelVsid; // Vsid used to map kernel load (0x0C00000000) 62 u64 xPages; // Number of pages to be mapped (8192)
62 u64 xPages; // Number of pages to be mapped (8192) 63 u64 xOffset; // Offset from start of load area (0)
63 u64 xOffset; // Offset from start of load area (0) 64 u64 xVPN; // Virtual Page Number (0x000C000000000000)
64 u64 xVPN; // Virtual Page Number (0x000C000000000000)
65}; 65};
66 66
67extern struct LparMap xLparMap;
68
67#endif /* _LPARMAP_H */ 69#endif /* _LPARMAP_H */
diff --git a/include/asm-ppc64/iSeries/XmPciLpEvent.h b/include/asm-ppc64/iSeries/XmPciLpEvent.h
deleted file mode 100644
index a3d27f116e49..000000000000
--- a/include/asm-ppc64/iSeries/XmPciLpEvent.h
+++ /dev/null
@@ -1,18 +0,0 @@
1
2#ifndef __XMPCILPEVENT_H__
3#define __XMPCILPEVENT_H__
4
5
6#ifdef __cplusplus
7extern "C" {
8#endif
9
10int XmPciLpEvent_init(void);
11void ppc_irq_dispatch_handler(struct pt_regs *regs, int irq);
12
13
14#ifdef __cplusplus
15}
16#endif
17
18#endif /* __XMPCILPEVENT_H__ */
diff --git a/include/asm-ppc64/iSeries/iSeries_io.h b/include/asm-ppc64/iSeries/iSeries_io.h
index f52b7599b372..9f79413342b3 100644
--- a/include/asm-ppc64/iSeries/iSeries_io.h
+++ b/include/asm-ppc64/iSeries/iSeries_io.h
@@ -5,32 +5,33 @@
5 5
6#ifdef CONFIG_PPC_ISERIES 6#ifdef CONFIG_PPC_ISERIES
7#include <linux/types.h> 7#include <linux/types.h>
8/************************************************************************/ 8/*
9/* File iSeries_io.h created by Allan Trautman on Thu Dec 28 2000. */ 9 * File iSeries_io.h created by Allan Trautman on Thu Dec 28 2000.
10/************************************************************************/ 10 *
11/* Remaps the io.h for the iSeries Io */ 11 * Remaps the io.h for the iSeries Io
12/* Copyright (C) 20yy Allan H Trautman, IBM Corporation */ 12 * Copyright (C) 2000 Allan H Trautman, IBM Corporation
13/* */ 13 *
14/* This program is free software; you can redistribute it and/or modify */ 14 * This program is free software; you can redistribute it and/or modify
15/* it under the terms of the GNU General Public License as published by */ 15 * it under the terms of the GNU General Public License as published by
16/* the Free Software Foundation; either version 2 of the License, or */ 16 * the Free Software Foundation; either version 2 of the License, or
17/* (at your option) any later version. */ 17 * (at your option) any later version.
18/* */ 18 *
19/* This program is distributed in the hope that it will be useful, */ 19 * This program is distributed in the hope that it will be useful,
20/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ 20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ 21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22/* GNU General Public License for more details. */ 22 * GNU General Public License for more details.
23/* */ 23 *
24/* You should have received a copy of the GNU General Public License */ 24 * You should have received a copy of the GNU General Public License
25/* along with this program; if not, write to the: */ 25 * along with this program; if not, write to the:
26/* Free Software Foundation, Inc., */ 26 * Free Software Foundation, Inc.,
27/* 59 Temple Place, Suite 330, */ 27 * 59 Temple Place, Suite 330,
28/* Boston, MA 02111-1307 USA */ 28 * Boston, MA 02111-1307 USA
29/************************************************************************/ 29 *
30/* Change Activity: */ 30 * Change Activity:
31/* Created December 28, 2000 */ 31 * Created December 28, 2000
32/* End Change Activity */ 32 * End Change Activity
33/************************************************************************/ 33 */
34
34extern u8 iSeries_Read_Byte(const volatile void __iomem * IoAddress); 35extern u8 iSeries_Read_Byte(const volatile void __iomem * IoAddress);
35extern u16 iSeries_Read_Word(const volatile void __iomem * IoAddress); 36extern u16 iSeries_Read_Word(const volatile void __iomem * IoAddress);
36extern u32 iSeries_Read_Long(const volatile void __iomem * IoAddress); 37extern u32 iSeries_Read_Long(const volatile void __iomem * IoAddress);
@@ -39,8 +40,10 @@ extern void iSeries_Write_Word(u16 IoData, volatile void __iomem * IoAddress);
39extern void iSeries_Write_Long(u32 IoData, volatile void __iomem * IoAddress); 40extern void iSeries_Write_Long(u32 IoData, volatile void __iomem * IoAddress);
40 41
41extern void iSeries_memset_io(volatile void __iomem *dest, char x, size_t n); 42extern void iSeries_memset_io(volatile void __iomem *dest, char x, size_t n);
42extern void iSeries_memcpy_toio(volatile void __iomem *dest, void *source, size_t n); 43extern void iSeries_memcpy_toio(volatile void __iomem *dest, void *source,
43extern void iSeries_memcpy_fromio(void *dest, const volatile void __iomem *source, size_t n); 44 size_t n);
45extern void iSeries_memcpy_fromio(void *dest,
46 const volatile void __iomem *source, size_t n);
44 47
45#endif /* CONFIG_PPC_ISERIES */ 48#endif /* CONFIG_PPC_ISERIES */
46#endif /* _ISERIES_IO_H */ 49#endif /* _ISERIES_IO_H */
diff --git a/include/asm-ppc64/iSeries/iSeries_irq.h b/include/asm-ppc64/iSeries/iSeries_irq.h
index ff8ddede038c..6c9767ac1302 100644
--- a/include/asm-ppc64/iSeries/iSeries_irq.h
+++ b/include/asm-ppc64/iSeries/iSeries_irq.h
@@ -1,19 +1,8 @@
1#ifndef __ISERIES_IRQ_H__ 1#ifndef __ISERIES_IRQ_H__
2#define __ISERIES_IRQ_H__ 2#define __ISERIES_IRQ_H__
3 3
4#ifdef __cplusplus 4extern void iSeries_init_IRQ(void);
5extern "C" { 5extern int iSeries_allocate_IRQ(HvBusNumber, HvSubBusNumber, HvAgentId);
6#endif 6extern void iSeries_activate_IRQs(void);
7
8void iSeries_init_IRQ(void);
9int iSeries_allocate_IRQ(HvBusNumber, HvSubBusNumber, HvAgentId);
10int iSeries_assign_IRQ(int, HvBusNumber, HvSubBusNumber, HvAgentId);
11void iSeries_activate_IRQs(void);
12
13int XmPciLpEvent_init(void);
14
15#ifdef __cplusplus
16}
17#endif
18 7
19#endif /* __ISERIES_IRQ_H__ */ 8#endif /* __ISERIES_IRQ_H__ */
diff --git a/include/asm-ppc64/iSeries/iSeries_pci.h b/include/asm-ppc64/iSeries/iSeries_pci.h
index 5769cff4c00c..575f611f8b33 100644
--- a/include/asm-ppc64/iSeries/iSeries_pci.h
+++ b/include/asm-ppc64/iSeries/iSeries_pci.h
@@ -1,112 +1,88 @@
1#ifndef _ISERIES_64_PCI_H 1#ifndef _ISERIES_64_PCI_H
2#define _ISERIES_64_PCI_H 2#define _ISERIES_64_PCI_H
3 3
4/************************************************************************/ 4/*
5/* File iSeries_pci.h created by Allan Trautman on Tue Feb 20, 2001. */ 5 * File iSeries_pci.h created by Allan Trautman on Tue Feb 20, 2001.
6/************************************************************************/ 6 *
7/* Define some useful macros for the iSeries pci routines. */ 7 * Define some useful macros for the iSeries pci routines.
8/* Copyright (C) 2001 Allan H Trautman, IBM Corporation */ 8 * Copyright (C) 2001 Allan H Trautman, IBM Corporation
9/* */ 9 *
10/* This program is free software; you can redistribute it and/or modify */ 10 * This program is free software; you can redistribute it and/or modify
11/* it under the terms of the GNU General Public License as published by */ 11 * it under the terms of the GNU General Public License as published by
12/* the Free Software Foundation; either version 2 of the License, or */ 12 * the Free Software Foundation; either version 2 of the License, or
13/* (at your option) any later version. */ 13 * (at your option) any later version.
14/* */ 14 *
15/* This program is distributed in the hope that it will be useful, */ 15 * This program is distributed in the hope that it will be useful,
16/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18/* GNU General Public License for more details. */ 18 * GNU General Public License for more details.
19/* */ 19 *
20/* You should have received a copy of the GNU General Public License */ 20 * You should have received a copy of the GNU General Public License
21/* along with this program; if not, write to the: */ 21 * along with this program; if not, write to the:
22/* Free Software Foundation, Inc., */ 22 * Free Software Foundation, Inc.,
23/* 59 Temple Place, Suite 330, */ 23 * 59 Temple Place, Suite 330,
24/* Boston, MA 02111-1307 USA */ 24 * Boston, MA 02111-1307 USA
25/************************************************************************/ 25 *
26/* Change Activity: */ 26 * Change Activity:
27/* Created Feb 20, 2001 */ 27 * Created Feb 20, 2001
28/* Added device reset, March 22, 2001 */ 28 * Added device reset, March 22, 2001
29/* Ported to ppc64, May 25, 2001 */ 29 * Ported to ppc64, May 25, 2001
30/* End Change Activity */ 30 * End Change Activity
31/************************************************************************/ 31 */
32 32
33#include <asm/iSeries/HvCallPci.h> 33#include <asm/iSeries/HvCallPci.h>
34#include <asm/abs_addr.h> 34#include <asm/abs_addr.h>
35 35
36struct pci_dev; /* For Forward Reference */ 36struct pci_dev; /* For Forward Reference */
37struct iSeries_Device_Node; 37struct iSeries_Device_Node;
38 38
39/************************************************************************/ 39/*
40/* Gets iSeries Bus, SubBus, DevFn using iSeries_Device_Node structure */ 40 * Gets iSeries Bus, SubBus, DevFn using iSeries_Device_Node structure
41/************************************************************************/ 41 */
42 42
43#define ISERIES_BUS(DevPtr) DevPtr->DsaAddr.Dsa.busNumber 43#define ISERIES_BUS(DevPtr) DevPtr->DsaAddr.Dsa.busNumber
44#define ISERIES_SUBBUS(DevPtr) DevPtr->DsaAddr.Dsa.subBusNumber 44#define ISERIES_SUBBUS(DevPtr) DevPtr->DsaAddr.Dsa.subBusNumber
45#define ISERIES_DEVICE(DevPtr) DevPtr->DsaAddr.Dsa.deviceId 45#define ISERIES_DEVICE(DevPtr) DevPtr->DsaAddr.Dsa.deviceId
46#define ISERIES_DSA(DevPtr) DevPtr->DsaAddr.DsaAddr 46#define ISERIES_DSA(DevPtr) DevPtr->DsaAddr.DsaAddr
47#define ISERIES_DEVFUN(DevPtr) DevPtr->DevFn 47#define ISERIES_DEVNODE(PciDev) ((struct iSeries_Device_Node *)PciDev->sysdata)
48#define ISERIES_DEVNODE(PciDev) ((struct iSeries_Device_Node*)PciDev->sysdata)
49 48
50#define EADsMaxAgents 7 49#define EADsMaxAgents 7
51 50
52/************************************************************************/
53/* Decodes Linux DevFn to iSeries DevFn, bridge device, or function. */
54/* For Linux, see PCI_SLOT and PCI_FUNC in include/linux/pci.h */
55/************************************************************************/
56
57#define ISERIES_PCI_AGENTID(idsel,func) ((idsel & 0x0F) << 4) | (func & 0x07)
58#define ISERIES_ENCODE_DEVICE(agentid) ((0x10) | ((agentid&0x20)>>2) | (agentid&07))
59
60#define ISERIES_GET_DEVICE_FROM_SUBBUS(subbus) ((subbus >> 5) & 0x7)
61#define ISERIES_GET_FUNCTION_FROM_SUBBUS(subbus) ((subbus >> 2) & 0x7)
62
63/* 51/*
64 * N.B. the ISERIES_DECODE_* macros are not used anywhere, and I think 52 * Decodes Linux DevFn to iSeries DevFn, bridge device, or function.
65 * the 0x71 (at least) must be wrong - 0x78 maybe? -- paulus. 53 * For Linux, see PCI_SLOT and PCI_FUNC in include/linux/pci.h
66 */ 54 */
67#define ISERIES_DECODE_DEVFN(linuxdevfn) (((linuxdevfn & 0x71) << 1) | (linuxdevfn & 0x07))
68#define ISERIES_DECODE_DEVICE(linuxdevfn) (((linuxdevfn & 0x38) >> 3) |(((linuxdevfn & 0x40) >> 2) + 0x10))
69#define ISERIES_DECODE_FUNCTION(linuxdevfn) (linuxdevfn & 0x07)
70 55
71/************************************************************************/ 56#define ISERIES_PCI_AGENTID(idsel, func) \
72/* Converts Virtual Address to Real Address for Hypervisor calls */ 57 (((idsel & 0x0F) << 4) | (func & 0x07))
73/************************************************************************/ 58#define ISERIES_ENCODE_DEVICE(agentid) \
59 ((0x10) | ((agentid & 0x20) >> 2) | (agentid & 0x07))
74 60
75#define ISERIES_HV_ADDR(virtaddr) (0x8000000000000000 | virt_to_abs(virtaddr)) 61#define ISERIES_GET_DEVICE_FROM_SUBBUS(subbus) ((subbus >> 5) & 0x7)
62#define ISERIES_GET_FUNCTION_FROM_SUBBUS(subbus) ((subbus >> 2) & 0x7)
76 63
77/************************************************************************/ 64/*
78/* iSeries Device Information */ 65 * Converts Virtual Address to Real Address for Hypervisor calls
79/************************************************************************/ 66 */
67#define ISERIES_HV_ADDR(virtaddr) \
68 (0x8000000000000000 | virt_to_abs(virtaddr))
80 69
70/*
71 * iSeries Device Information
72 */
81struct iSeries_Device_Node { 73struct iSeries_Device_Node {
82 struct list_head Device_List; 74 struct list_head Device_List;
83 struct pci_dev* PciDev; /* Pointer to pci_dev structure*/ 75 struct pci_dev *PciDev;
84 union HvDsaMap DsaAddr; /* Direct Select Address */ 76 union HvDsaMap DsaAddr; /* Direct Select Address */
85 /* busNumber,subBusNumber, */ 77 /* busNumber, subBusNumber, */
86 /* deviceId, barNumber */ 78 /* deviceId, barNumber */
87 HvAgentId AgentId; /* Hypervisor DevFn */ 79 int DevFn; /* Linux devfn */
88 int DevFn; /* Linux devfn */ 80 int Irq; /* Assigned IRQ */
89 int BarOffset; 81 int Flags; /* Possible flags(disable/bist)*/
90 int Irq; /* Assigned IRQ */ 82 u8 LogicalSlot; /* Hv Slot Index for Tces */
91 int ReturnCode; /* Return Code Holder */ 83 struct iommu_table *iommu_table;/* Device TCE Table */
92 int IoRetry; /* Current Retry Count */
93 int Flags; /* Possible flags(disable/bist)*/
94 u16 Vendor; /* Vendor ID */
95 u8 LogicalSlot; /* Hv Slot Index for Tces */
96 struct iommu_table* iommu_table;/* Device TCE Table */
97 u8 PhbId; /* Phb Card is on. */
98 u16 Board; /* Board Number */
99 u8 FrameId; /* iSeries spcn Frame Id */
100 char CardLocation[4];/* Char format of planar vpd */
101 char Location[20]; /* Frame 1, Card C10 */
102}; 84};
103 85
104/************************************************************************/ 86extern void iSeries_Device_Information(struct pci_dev*, int);
105/* Functions */
106/************************************************************************/
107
108extern int iSeries_Device_Information(struct pci_dev*,char*, int);
109extern void iSeries_Get_Location_Code(struct iSeries_Device_Node*);
110extern int iSeries_Device_ToggleReset(struct pci_dev* PciDev, int AssertTime, int DelayTime);
111 87
112#endif /* _ISERIES_64_PCI_H */ 88#endif /* _ISERIES_64_PCI_H */
diff --git a/include/asm-ppc64/iSeries/iSeries_proc.h b/include/asm-ppc64/iSeries/iSeries_proc.h
deleted file mode 100644
index adb6dc14dd4d..000000000000
--- a/include/asm-ppc64/iSeries/iSeries_proc.h
+++ /dev/null
@@ -1,24 +0,0 @@
1/*
2 * iSeries_proc.h
3 * Copyright (C) 2001 Kyle A. Lucke IBM Corporation
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19#ifndef _ISERIES_PROC_H
20#define _ISERIES_PROC_H
21
22extern void iSeries_proc_early_init(void);
23
24#endif /* _iSeries_PROC_H */
diff --git a/include/asm-ppc64/iSeries/mf.h b/include/asm-ppc64/iSeries/mf.h
index db333e1ee216..7e6a0d936999 100644
--- a/include/asm-ppc64/iSeries/mf.h
+++ b/include/asm-ppc64/iSeries/mf.h
@@ -9,17 +9,16 @@
9 * all partitions in the iSeries. It also provides miscellaneous low-level 9 * all partitions in the iSeries. It also provides miscellaneous low-level
10 * machine facility type operations. 10 * machine facility type operations.
11 * 11 *
12 *
13 * This program is free software; you can redistribute it and/or modify 12 * 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 13 * 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 14 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version. 15 * (at your option) any later version.
17 * 16 *
18 * This program is distributed in the hope that it will be useful, 17 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details. 20 * GNU General Public License for more details.
22 * 21 *
23 * You should have received a copy of the GNU General Public License 22 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software 23 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
diff --git a/include/asm-ppc64/iSeries/vio.h b/include/asm-ppc64/iSeries/vio.h
index 3e5766a849d6..6c05e6257f53 100644
--- a/include/asm-ppc64/iSeries/vio.h
+++ b/include/asm-ppc64/iSeries/vio.h
@@ -8,32 +8,32 @@
8 * Colin Devilbiss <devilbis@us.ibm.com> 8 * Colin Devilbiss <devilbis@us.ibm.com>
9 * 9 *
10 * (C) Copyright 2000 IBM Corporation 10 * (C) Copyright 2000 IBM Corporation
11 * 11 *
12 * This header file is used by the iSeries virtual I/O device 12 * This header file is used by the iSeries virtual I/O device
13 * drivers. It defines the interfaces to the common functions 13 * drivers. It defines the interfaces to the common functions
14 * (implemented in drivers/char/viopath.h) as well as defining 14 * (implemented in drivers/char/viopath.h) as well as defining
15 * common functions and structures. Currently (at the time I 15 * common functions and structures. Currently (at the time I
16 * wrote this comment) the iSeries virtual I/O device drivers 16 * wrote this comment) the iSeries virtual I/O device drivers
17 * that use this are 17 * that use this are
18 * drivers/block/viodasd.c 18 * drivers/block/viodasd.c
19 * drivers/char/viocons.c 19 * drivers/char/viocons.c
20 * drivers/char/viotape.c 20 * drivers/char/viotape.c
21 * drivers/cdrom/viocd.c 21 * drivers/cdrom/viocd.c
22 * 22 *
23 * The iSeries virtual ethernet support (veth.c) uses a whole 23 * The iSeries virtual ethernet support (veth.c) uses a whole
24 * different set of functions. 24 * different set of functions.
25 * 25 *
26 * This program is free software; you can redistribute it and/or 26 * This program is free software; you can redistribute it and/or
27 * modify it under the terms of the GNU General Public License as 27 * modify it under the terms of the GNU General Public License as
28 * published by the Free Software Foundation; either version 2 of the 28 * published by the Free Software Foundation; either version 2 of the
29 * License, or (at your option) anyu later version. 29 * License, or (at your option) anyu later version.
30 * 30 *
31 * This program is distributed in the hope that it will be useful, but 31 * This program is distributed in the hope that it will be useful, but
32 * WITHOUT ANY WARRANTY; without even the implied warranty of 32 * WITHOUT ANY WARRANTY; without even the implied warranty of
33 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 33 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
34 * General Public License for more details. 34 * General Public License for more details.
35 * 35 *
36 * You should have received a copy of the GNU General Public License 36 * You should have received a copy of the GNU General Public License
37 * along with this program; if not, write to the Free Software Foundation, 37 * along with this program; if not, write to the Free Software Foundation,
38 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 38 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
39 * 39 *
@@ -44,39 +44,41 @@
44#include <asm/iSeries/HvTypes.h> 44#include <asm/iSeries/HvTypes.h>
45#include <asm/iSeries/HvLpEvent.h> 45#include <asm/iSeries/HvLpEvent.h>
46 46
47/* iSeries virtual I/O events use the subtype field in 47/*
48 * iSeries virtual I/O events use the subtype field in
48 * HvLpEvent to figure out what kind of vio event is coming 49 * HvLpEvent to figure out what kind of vio event is coming
49 * in. We use a table to route these, and this defines 50 * in. We use a table to route these, and this defines
50 * the maximum number of distinct subtypes 51 * the maximum number of distinct subtypes
51 */ 52 */
52#define VIO_MAX_SUBTYPES 8 53#define VIO_MAX_SUBTYPES 8
53 54
54/* Each subtype can register a handler to process their events. 55/*
56 * Each subtype can register a handler to process their events.
55 * The handler must have this interface. 57 * The handler must have this interface.
56 */ 58 */
57typedef void (vio_event_handler_t) (struct HvLpEvent * event); 59typedef void (vio_event_handler_t) (struct HvLpEvent * event);
58 60
59int viopath_open(HvLpIndex remoteLp, int subtype, int numReq); 61extern int viopath_open(HvLpIndex remoteLp, int subtype, int numReq);
60int viopath_close(HvLpIndex remoteLp, int subtype, int numReq); 62extern int viopath_close(HvLpIndex remoteLp, int subtype, int numReq);
61int vio_setHandler(int subtype, vio_event_handler_t * beh); 63extern int vio_setHandler(int subtype, vio_event_handler_t * beh);
62int vio_clearHandler(int subtype); 64extern int vio_clearHandler(int subtype);
63int viopath_isactive(HvLpIndex lp); 65extern int viopath_isactive(HvLpIndex lp);
64HvLpInstanceId viopath_sourceinst(HvLpIndex lp); 66extern HvLpInstanceId viopath_sourceinst(HvLpIndex lp);
65HvLpInstanceId viopath_targetinst(HvLpIndex lp); 67extern HvLpInstanceId viopath_targetinst(HvLpIndex lp);
66void vio_set_hostlp(void); 68extern void vio_set_hostlp(void);
67void *vio_get_event_buffer(int subtype); 69extern void *vio_get_event_buffer(int subtype);
68void vio_free_event_buffer(int subtype, void *buffer); 70extern void vio_free_event_buffer(int subtype, void *buffer);
69 71
70extern HvLpIndex viopath_hostLp; 72extern HvLpIndex viopath_hostLp;
71extern HvLpIndex viopath_ourLp; 73extern HvLpIndex viopath_ourLp;
72 74
73#define VIOCHAR_MAX_DATA 200 75#define VIOCHAR_MAX_DATA 200
74 76
75#define VIOMAJOR_SUBTYPE_MASK 0xff00 77#define VIOMAJOR_SUBTYPE_MASK 0xff00
76#define VIOMINOR_SUBTYPE_MASK 0x00ff 78#define VIOMINOR_SUBTYPE_MASK 0x00ff
77#define VIOMAJOR_SUBTYPE_SHIFT 8 79#define VIOMAJOR_SUBTYPE_SHIFT 8
78 80
79#define VIOVERSION 0x0101 81#define VIOVERSION 0x0101
80 82
81/* 83/*
82 * This is the general structure for VIO errors; each module should have 84 * This is the general structure for VIO errors; each module should have
@@ -89,8 +91,8 @@ struct vio_error_entry {
89 int errno; 91 int errno;
90 const char *msg; 92 const char *msg;
91}; 93};
92const struct vio_error_entry *vio_lookup_rc(const struct vio_error_entry 94extern const struct vio_error_entry *vio_lookup_rc(
93 *local_table, u16 rc); 95 const struct vio_error_entry *local_table, u16 rc);
94 96
95enum viosubtypes { 97enum viosubtypes {
96 viomajorsubtype_monitor = 0x0100, 98 viomajorsubtype_monitor = 0x0100,
@@ -102,7 +104,6 @@ enum viosubtypes {
102 viomajorsubtype_scsi = 0x0700 104 viomajorsubtype_scsi = 0x0700
103}; 105};
104 106
105
106enum vioconfigsubtype { 107enum vioconfigsubtype {
107 vioconfigget = 0x0001, 108 vioconfigget = 0x0001,
108}; 109};
diff --git a/include/asm-ppc64/imalloc.h b/include/asm-ppc64/imalloc.h
index 3a45e918bf16..e46ff68a6e41 100644
--- a/include/asm-ppc64/imalloc.h
+++ b/include/asm-ppc64/imalloc.h
@@ -4,9 +4,9 @@
4/* 4/*
5 * Define the address range of the imalloc VM area. 5 * Define the address range of the imalloc VM area.
6 */ 6 */
7#define PHBS_IO_BASE IOREGIONBASE 7#define PHBS_IO_BASE VMALLOC_END
8#define IMALLOC_BASE (IOREGIONBASE + 0x80000000ul) /* Reserve 2 gigs for PHBs */ 8#define IMALLOC_BASE (PHBS_IO_BASE + 0x80000000ul) /* Reserve 2 gigs for PHBs */
9#define IMALLOC_END (IOREGIONBASE + EADDR_MASK) 9#define IMALLOC_END (VMALLOC_START + EADDR_MASK)
10 10
11 11
12/* imalloc region types */ 12/* imalloc region types */
@@ -18,7 +18,9 @@
18 18
19extern struct vm_struct * im_get_free_area(unsigned long size); 19extern struct vm_struct * im_get_free_area(unsigned long size);
20extern struct vm_struct * im_get_area(unsigned long v_addr, unsigned long size, 20extern struct vm_struct * im_get_area(unsigned long v_addr, unsigned long size,
21 int region_type); 21 int region_type);
22unsigned long im_free(void *addr); 22extern void im_free(void *addr);
23
24extern unsigned long ioremap_bot;
23 25
24#endif /* _PPC64_IMALLOC_H */ 26#endif /* _PPC64_IMALLOC_H */
diff --git a/include/asm-ppc64/iommu.h b/include/asm-ppc64/iommu.h
index bd53ca4dcfa2..729de5cc21d9 100644
--- a/include/asm-ppc64/iommu.h
+++ b/include/asm-ppc64/iommu.h
@@ -82,24 +82,6 @@ struct iommu_table {
82 unsigned long *it_map; /* A simple allocation bitmap for now */ 82 unsigned long *it_map; /* A simple allocation bitmap for now */
83}; 83};
84 84
85#ifdef CONFIG_PPC_ISERIES
86struct iommu_table_cb {
87 unsigned long itc_busno; /* Bus number for this tce table */
88 unsigned long itc_start; /* Will be NULL for secondary */
89 unsigned long itc_totalsize; /* Size (in pages) of whole table */
90 unsigned long itc_offset; /* Index into real tce table of the
91 start of our section */
92 unsigned long itc_size; /* Size (in pages) of our section */
93 unsigned long itc_index; /* Index of this tce table */
94 unsigned short itc_maxtables; /* Max num of tables for partition */
95 unsigned char itc_virtbus; /* Flag to indicate virtual bus */
96 unsigned char itc_slotno; /* IOA Tce Slot Index */
97 unsigned char itc_rsvd[4];
98};
99
100extern struct iommu_table vio_tce_table; /* Tce table for virtual bus */
101#endif /* CONFIG_PPC_ISERIES */
102
103struct scatterlist; 85struct scatterlist;
104 86
105#ifdef CONFIG_PPC_MULTIPLATFORM 87#ifdef CONFIG_PPC_MULTIPLATFORM
@@ -122,9 +104,6 @@ extern void iommu_devnode_init_pSeries(struct device_node *dn);
122 104
123#ifdef CONFIG_PPC_ISERIES 105#ifdef CONFIG_PPC_ISERIES
124 106
125/* Walks all buses and creates iommu tables */
126extern void iommu_setup_iSeries(void);
127
128/* Initializes tables for bio buses */ 107/* Initializes tables for bio buses */
129extern void __init iommu_vio_init(void); 108extern void __init iommu_vio_init(void);
130 109
@@ -158,8 +137,12 @@ extern void iommu_init_early_pSeries(void);
158extern void iommu_init_early_iSeries(void); 137extern void iommu_init_early_iSeries(void);
159extern void iommu_init_early_u3(void); 138extern void iommu_init_early_u3(void);
160 139
140#ifdef CONFIG_PCI
161extern void pci_iommu_init(void); 141extern void pci_iommu_init(void);
162extern void pci_direct_iommu_init(void); 142extern void pci_direct_iommu_init(void);
143#else
144static inline void pci_iommu_init(void) { }
145#endif
163 146
164extern void alloc_u3_dart_table(void); 147extern void alloc_u3_dart_table(void);
165 148
diff --git a/include/asm-ppc64/paca.h b/include/asm-ppc64/paca.h
index 1a0223b5f3b8..ae76cae1483f 100644
--- a/include/asm-ppc64/paca.h
+++ b/include/asm-ppc64/paca.h
@@ -20,13 +20,13 @@
20#include <asm/types.h> 20#include <asm/types.h>
21#include <asm/lppaca.h> 21#include <asm/lppaca.h>
22#include <asm/iSeries/ItLpRegSave.h> 22#include <asm/iSeries/ItLpRegSave.h>
23#include <asm/iSeries/ItLpQueue.h>
23#include <asm/mmu.h> 24#include <asm/mmu.h>
24 25
25register struct paca_struct *local_paca asm("r13"); 26register struct paca_struct *local_paca asm("r13");
26#define get_paca() local_paca 27#define get_paca() local_paca
27 28
28struct task_struct; 29struct task_struct;
29struct ItLpQueue;
30 30
31/* 31/*
32 * Defines the layout of the paca. 32 * Defines the layout of the paca.
diff --git a/include/asm-ppc64/page.h b/include/asm-ppc64/page.h
index bcd21789d3b7..257d87eb7c34 100644
--- a/include/asm-ppc64/page.h
+++ b/include/asm-ppc64/page.h
@@ -202,9 +202,7 @@ extern u64 ppc64_pft_size; /* Log 2 of page table size */
202#define PAGE_OFFSET ASM_CONST(0xC000000000000000) 202#define PAGE_OFFSET ASM_CONST(0xC000000000000000)
203#define KERNELBASE PAGE_OFFSET 203#define KERNELBASE PAGE_OFFSET
204#define VMALLOCBASE ASM_CONST(0xD000000000000000) 204#define VMALLOCBASE ASM_CONST(0xD000000000000000)
205#define IOREGIONBASE ASM_CONST(0xE000000000000000)
206 205
207#define IO_REGION_ID (IOREGIONBASE >> REGION_SHIFT)
208#define VMALLOC_REGION_ID (VMALLOCBASE >> REGION_SHIFT) 206#define VMALLOC_REGION_ID (VMALLOCBASE >> REGION_SHIFT)
209#define KERNEL_REGION_ID (KERNELBASE >> REGION_SHIFT) 207#define KERNEL_REGION_ID (KERNELBASE >> REGION_SHIFT)
210#define USER_REGION_ID (0UL) 208#define USER_REGION_ID (0UL)
diff --git a/include/asm-ppc64/pgtable.h b/include/asm-ppc64/pgtable.h
index 264c4f7993be..46cf61c2ff69 100644
--- a/include/asm-ppc64/pgtable.h
+++ b/include/asm-ppc64/pgtable.h
@@ -53,7 +53,8 @@
53 * Define the address range of the vmalloc VM area. 53 * Define the address range of the vmalloc VM area.
54 */ 54 */
55#define VMALLOC_START (0xD000000000000000ul) 55#define VMALLOC_START (0xD000000000000000ul)
56#define VMALLOC_END (VMALLOC_START + EADDR_MASK) 56#define VMALLOC_SIZE (0x10000000000UL)
57#define VMALLOC_END (VMALLOC_START + VMALLOC_SIZE)
57 58
58/* 59/*
59 * Bits in a linux-style PTE. These match the bits in the 60 * Bits in a linux-style PTE. These match the bits in the
@@ -239,9 +240,6 @@ static inline pte_t pfn_pte(unsigned long pfn, pgprot_t pgprot)
239/* This now only contains the vmalloc pages */ 240/* This now only contains the vmalloc pages */
240#define pgd_offset_k(address) pgd_offset(&init_mm, address) 241#define pgd_offset_k(address) pgd_offset(&init_mm, address)
241 242
242/* to find an entry in the ioremap page-table-directory */
243#define pgd_offset_i(address) (ioremap_pgd + pgd_index(address))
244
245/* 243/*
246 * The following only work if pte_present() is true. 244 * The following only work if pte_present() is true.
247 * Undefined behaviour if not.. 245 * Undefined behaviour if not..
@@ -459,15 +457,12 @@ extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long addr,
459#define __HAVE_ARCH_PTE_SAME 457#define __HAVE_ARCH_PTE_SAME
460#define pte_same(A,B) (((pte_val(A) ^ pte_val(B)) & ~_PAGE_HPTEFLAGS) == 0) 458#define pte_same(A,B) (((pte_val(A) ^ pte_val(B)) & ~_PAGE_HPTEFLAGS) == 0)
461 459
462extern unsigned long ioremap_bot, ioremap_base;
463
464#define pmd_ERROR(e) \ 460#define pmd_ERROR(e) \
465 printk("%s:%d: bad pmd %08x.\n", __FILE__, __LINE__, pmd_val(e)) 461 printk("%s:%d: bad pmd %08x.\n", __FILE__, __LINE__, pmd_val(e))
466#define pgd_ERROR(e) \ 462#define pgd_ERROR(e) \
467 printk("%s:%d: bad pgd %08x.\n", __FILE__, __LINE__, pgd_val(e)) 463 printk("%s:%d: bad pgd %08x.\n", __FILE__, __LINE__, pgd_val(e))
468 464
469extern pgd_t swapper_pg_dir[]; 465extern pgd_t swapper_pg_dir[];
470extern pgd_t ioremap_dir[];
471 466
472extern void paging_init(void); 467extern void paging_init(void);
473 468
diff --git a/include/asm-ppc64/processor.h b/include/asm-ppc64/processor.h
index 809c634ba1df..3084099086a8 100644
--- a/include/asm-ppc64/processor.h
+++ b/include/asm-ppc64/processor.h
@@ -430,16 +430,6 @@ struct thread_struct {
430} 430}
431 431
432/* 432/*
433 * Note: the vm_start and vm_end fields here should *not*
434 * be in kernel space. (Could vm_end == vm_start perhaps?)
435 */
436#define IOREMAP_MMAP { &ioremap_mm, 0, 0x1000, NULL, \
437 PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, \
438 1, NULL, NULL }
439
440extern struct mm_struct ioremap_mm;
441
442/*
443 * Return saved PC of a blocked thread. For now, this is the "user" PC 433 * Return saved PC of a blocked thread. For now, this is the "user" PC
444 */ 434 */
445#define thread_saved_pc(tsk) \ 435#define thread_saved_pc(tsk) \
diff --git a/include/asm-ppc64/smp.h b/include/asm-ppc64/smp.h
index c8646fa999c2..8115ecb8feee 100644
--- a/include/asm-ppc64/smp.h
+++ b/include/asm-ppc64/smp.h
@@ -45,7 +45,7 @@ void generic_cpu_die(unsigned int cpu);
45void generic_mach_cpu_die(void); 45void generic_mach_cpu_die(void);
46#endif 46#endif
47 47
48#define __smp_processor_id() (get_paca()->paca_index) 48#define raw_smp_processor_id() (get_paca()->paca_index)
49#define hard_smp_processor_id() (get_paca()->hw_cpu_id) 49#define hard_smp_processor_id() (get_paca()->hw_cpu_id)
50 50
51extern cpumask_t cpu_sibling_map[NR_CPUS]; 51extern cpumask_t cpu_sibling_map[NR_CPUS];
diff --git a/include/asm-s390/smp.h b/include/asm-s390/smp.h
index 9473786387a3..dd50e57a928f 100644
--- a/include/asm-s390/smp.h
+++ b/include/asm-s390/smp.h
@@ -47,7 +47,7 @@ extern int smp_call_function_on(void (*func) (void *info), void *info,
47 47
48#define PROC_CHANGE_PENALTY 20 /* Schedule penalty */ 48#define PROC_CHANGE_PENALTY 20 /* Schedule penalty */
49 49
50#define smp_processor_id() (S390_lowcore.cpu_data.cpu_nr) 50#define raw_smp_processor_id() (S390_lowcore.cpu_data.cpu_nr)
51 51
52extern int smp_get_cpu(cpumask_t cpu_map); 52extern int smp_get_cpu(cpumask_t cpu_map);
53extern void smp_put_cpu(int cpu); 53extern void smp_put_cpu(int cpu);
diff --git a/include/asm-sh/page.h b/include/asm-sh/page.h
index 4c6d129e7d91..180467be8e7b 100644
--- a/include/asm-sh/page.h
+++ b/include/asm-sh/page.h
@@ -31,6 +31,7 @@
31#define HPAGE_SIZE (1UL << HPAGE_SHIFT) 31#define HPAGE_SIZE (1UL << HPAGE_SHIFT)
32#define HPAGE_MASK (~(HPAGE_SIZE-1)) 32#define HPAGE_MASK (~(HPAGE_SIZE-1))
33#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT-PAGE_SHIFT) 33#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT-PAGE_SHIFT)
34#define ARCH_HAS_SETCLEAR_HUGE_PTE
34#endif 35#endif
35 36
36#ifdef __KERNEL__ 37#ifdef __KERNEL__
diff --git a/include/asm-sh/pgtable.h b/include/asm-sh/pgtable.h
index cd847a47a9aa..ecb909572d3f 100644
--- a/include/asm-sh/pgtable.h
+++ b/include/asm-sh/pgtable.h
@@ -196,6 +196,7 @@ static inline pte_t pte_mkexec(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _
196static inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; } 196static inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; }
197static inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; } 197static inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; }
198static inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_RW)); return pte; } 198static inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_RW)); return pte; }
199static inline pte_t pte_mkhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_SZHUGE)); return pte; }
199 200
200/* 201/*
201 * Macro and implementation to make a page protection as uncachable. 202 * Macro and implementation to make a page protection as uncachable.
diff --git a/include/asm-sh/smp.h b/include/asm-sh/smp.h
index 38b54469d7d1..f19a8b3b69a6 100644
--- a/include/asm-sh/smp.h
+++ b/include/asm-sh/smp.h
@@ -25,7 +25,7 @@ extern cpumask_t cpu_possible_map;
25 25
26#define cpu_online(cpu) cpu_isset(cpu, cpu_online_map) 26#define cpu_online(cpu) cpu_isset(cpu, cpu_online_map)
27 27
28#define smp_processor_id() (current_thread_info()->cpu) 28#define raw_smp_processor_id() (current_thread_info()->cpu)
29 29
30/* I've no idea what the real meaning of this is */ 30/* I've no idea what the real meaning of this is */
31#define PROC_CHANGE_PENALTY 20 31#define PROC_CHANGE_PENALTY 20
diff --git a/include/asm-sh64/page.h b/include/asm-sh64/page.h
index e1f7f5a41210..d6167f1c0e99 100644
--- a/include/asm-sh64/page.h
+++ b/include/asm-sh64/page.h
@@ -41,6 +41,7 @@
41#define HPAGE_SIZE (1UL << HPAGE_SHIFT) 41#define HPAGE_SIZE (1UL << HPAGE_SHIFT)
42#define HPAGE_MASK (~(HPAGE_SIZE-1)) 42#define HPAGE_MASK (~(HPAGE_SIZE-1))
43#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT-PAGE_SHIFT) 43#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT-PAGE_SHIFT)
44#define ARCH_HAS_SETCLEAR_HUGE_PTE
44#endif 45#endif
45 46
46#ifdef __KERNEL__ 47#ifdef __KERNEL__
diff --git a/include/asm-sh64/pgtable.h b/include/asm-sh64/pgtable.h
index 525e1523ef5f..78ac6be2d9ef 100644
--- a/include/asm-sh64/pgtable.h
+++ b/include/asm-sh64/pgtable.h
@@ -430,6 +430,8 @@ extern inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) |
430extern inline pte_t pte_mkexec(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_EXECUTE)); return pte; } 430extern inline pte_t pte_mkexec(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_EXECUTE)); return pte; }
431extern inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; } 431extern inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; }
432extern inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; } 432extern inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; }
433extern inline pte_t pte_mkhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_SZHUGE)); return pte; }
434
433 435
434/* 436/*
435 * Conversion functions: convert a page and protection to a page entry. 437 * Conversion functions: convert a page and protection to a page entry.
diff --git a/include/asm-sparc/smp.h b/include/asm-sparc/smp.h
index f986c0d0922a..4f96d8333a12 100644
--- a/include/asm-sparc/smp.h
+++ b/include/asm-sparc/smp.h
@@ -148,7 +148,7 @@ extern __inline__ int hard_smp_processor_id(void)
148} 148}
149#endif 149#endif
150 150
151#define smp_processor_id() (current_thread_info()->cpu) 151#define raw_smp_processor_id() (current_thread_info()->cpu)
152 152
153#define prof_multiplier(__cpu) cpu_data(__cpu).multiplier 153#define prof_multiplier(__cpu) cpu_data(__cpu).multiplier
154#define prof_counter(__cpu) cpu_data(__cpu).counter 154#define prof_counter(__cpu) cpu_data(__cpu).counter
diff --git a/include/asm-sparc64/page.h b/include/asm-sparc64/page.h
index 219ea043a14a..b87dbbd64bc9 100644
--- a/include/asm-sparc64/page.h
+++ b/include/asm-sparc64/page.h
@@ -95,6 +95,8 @@ typedef unsigned long pgprot_t;
95#define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT) 95#define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT)
96#define HPAGE_MASK (~(HPAGE_SIZE - 1UL)) 96#define HPAGE_MASK (~(HPAGE_SIZE - 1UL))
97#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) 97#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
98#define ARCH_HAS_SETCLEAR_HUGE_PTE
99#define ARCH_HAS_HUGETLB_PREFAULT_HOOK
98#endif 100#endif
99 101
100#define TASK_UNMAPPED_BASE (test_thread_flag(TIF_32BIT) ? \ 102#define TASK_UNMAPPED_BASE (test_thread_flag(TIF_32BIT) ? \
diff --git a/include/asm-sparc64/pgtable.h b/include/asm-sparc64/pgtable.h
index ae2cd5b09a7c..1ae00c5087f1 100644
--- a/include/asm-sparc64/pgtable.h
+++ b/include/asm-sparc64/pgtable.h
@@ -286,6 +286,7 @@ static inline pte_t pte_modify(pte_t orig_pte, pgprot_t new_prot)
286#define pte_mkyoung(pte) (__pte(pte_val(pte) | _PAGE_ACCESSED | _PAGE_R)) 286#define pte_mkyoung(pte) (__pte(pte_val(pte) | _PAGE_ACCESSED | _PAGE_R))
287#define pte_mkwrite(pte) (__pte(pte_val(pte) | _PAGE_WRITE)) 287#define pte_mkwrite(pte) (__pte(pte_val(pte) | _PAGE_WRITE))
288#define pte_mkdirty(pte) (__pte(pte_val(pte) | _PAGE_MODIFIED | _PAGE_W)) 288#define pte_mkdirty(pte) (__pte(pte_val(pte) | _PAGE_MODIFIED | _PAGE_W))
289#define pte_mkhuge(pte) (__pte(pte_val(pte) | _PAGE_SZHUGE))
289 290
290/* to find an entry in a page-table-directory. */ 291/* to find an entry in a page-table-directory. */
291#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1)) 292#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1))
diff --git a/include/asm-sparc64/processor.h b/include/asm-sparc64/processor.h
index bc1445b904ef..d0bee2413560 100644
--- a/include/asm-sparc64/processor.h
+++ b/include/asm-sparc64/processor.h
@@ -192,6 +192,40 @@ extern unsigned long get_wchan(struct task_struct *task);
192 192
193#define cpu_relax() barrier() 193#define cpu_relax() barrier()
194 194
195/* Prefetch support. This is tuned for UltraSPARC-III and later.
196 * UltraSPARC-I will treat these as nops, and UltraSPARC-II has
197 * a shallower prefetch queue than later chips.
198 */
199#define ARCH_HAS_PREFETCH
200#define ARCH_HAS_PREFETCHW
201#define ARCH_HAS_SPINLOCK_PREFETCH
202
203static inline void prefetch(const void *x)
204{
205 /* We do not use the read prefetch mnemonic because that
206 * prefetches into the prefetch-cache which only is accessible
207 * by floating point operations in UltraSPARC-III and later.
208 * By contrast, "#one_write" prefetches into the L2 cache
209 * in shared state.
210 */
211 __asm__ __volatile__("prefetch [%0], #one_write"
212 : /* no outputs */
213 : "r" (x));
214}
215
216static inline void prefetchw(const void *x)
217{
218 /* The most optimal prefetch to use for writes is
219 * "#n_writes". This brings the cacheline into the
220 * L2 cache in "owned" state.
221 */
222 __asm__ __volatile__("prefetch [%0], #n_writes"
223 : /* no outputs */
224 : "r" (x));
225}
226
227#define spin_lock_prefetch(x) prefetchw(x)
228
195#endif /* !(__ASSEMBLY__) */ 229#endif /* !(__ASSEMBLY__) */
196 230
197#endif /* !(__ASM_SPARC64_PROCESSOR_H) */ 231#endif /* !(__ASM_SPARC64_PROCESSOR_H) */
diff --git a/include/asm-sparc64/smp.h b/include/asm-sparc64/smp.h
index 5e3e06d908fe..110a2de89123 100644
--- a/include/asm-sparc64/smp.h
+++ b/include/asm-sparc64/smp.h
@@ -64,7 +64,7 @@ static __inline__ int hard_smp_processor_id(void)
64 } 64 }
65} 65}
66 66
67#define smp_processor_id() (current_thread_info()->cpu) 67#define raw_smp_processor_id() (current_thread_info()->cpu)
68 68
69#endif /* !(__ASSEMBLY__) */ 69#endif /* !(__ASSEMBLY__) */
70 70
diff --git a/include/asm-um/smp.h b/include/asm-um/smp.h
index 4412d5d9c26b..d879eba2b52c 100644
--- a/include/asm-um/smp.h
+++ b/include/asm-um/smp.h
@@ -8,7 +8,8 @@
8#include "asm/current.h" 8#include "asm/current.h"
9#include "linux/cpumask.h" 9#include "linux/cpumask.h"
10 10
11#define smp_processor_id() (current_thread->cpu) 11#define raw_smp_processor_id() (current_thread->cpu)
12
12#define cpu_logical_map(n) (n) 13#define cpu_logical_map(n) (n)
13#define cpu_number_map(n) (n) 14#define cpu_number_map(n) (n)
14#define PROC_CHANGE_PENALTY 15 /* Pick a number, any number */ 15#define PROC_CHANGE_PENALTY 15 /* Pick a number, any number */
diff --git a/include/asm-x86_64/a.out.h b/include/asm-x86_64/a.out.h
index 5952914f4121..7255cde06538 100644
--- a/include/asm-x86_64/a.out.h
+++ b/include/asm-x86_64/a.out.h
@@ -21,7 +21,7 @@ struct exec
21 21
22#ifdef __KERNEL__ 22#ifdef __KERNEL__
23#include <linux/thread_info.h> 23#include <linux/thread_info.h>
24#define STACK_TOP (test_thread_flag(TIF_IA32) ? IA32_PAGE_OFFSET : TASK_SIZE) 24#define STACK_TOP TASK_SIZE
25#endif 25#endif
26 26
27#endif /* __A_OUT_GNU_H__ */ 27#endif /* __A_OUT_GNU_H__ */
diff --git a/include/asm-x86_64/page.h b/include/asm-x86_64/page.h
index f43048035a03..9ce338c3a71e 100644
--- a/include/asm-x86_64/page.h
+++ b/include/asm-x86_64/page.h
@@ -28,6 +28,7 @@
28#define HPAGE_SIZE ((1UL) << HPAGE_SHIFT) 28#define HPAGE_SIZE ((1UL) << HPAGE_SHIFT)
29#define HPAGE_MASK (~(HPAGE_SIZE - 1)) 29#define HPAGE_MASK (~(HPAGE_SIZE - 1))
30#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) 30#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
31#define ARCH_HAS_HUGETLB_CLEAN_STALE_PGTABLE
31 32
32#ifdef __KERNEL__ 33#ifdef __KERNEL__
33#ifndef __ASSEMBLY__ 34#ifndef __ASSEMBLY__
diff --git a/include/asm-x86_64/pgtable.h b/include/asm-x86_64/pgtable.h
index db2a0efbf573..4eec176c3c39 100644
--- a/include/asm-x86_64/pgtable.h
+++ b/include/asm-x86_64/pgtable.h
@@ -253,6 +253,7 @@ extern inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED;
253extern inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; } 253extern inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; }
254static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } 254static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
255 255
256#define __LARGE_PTE (_PAGE_PSE|_PAGE_PRESENT)
256extern inline pte_t pte_rdprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; } 257extern inline pte_t pte_rdprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; }
257extern inline pte_t pte_exprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; } 258extern inline pte_t pte_exprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; }
258extern inline pte_t pte_mkclean(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY)); return pte; } 259extern inline pte_t pte_mkclean(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY)); return pte; }
@@ -263,6 +264,7 @@ extern inline pte_t pte_mkexec(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _
263extern inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; } 264extern inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; }
264extern inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; } 265extern inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; }
265extern inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_RW)); return pte; } 266extern inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_RW)); return pte; }
267extern inline pte_t pte_mkhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | __LARGE_PTE)); return pte; }
266 268
267struct vm_area_struct; 269struct vm_area_struct;
268 270
@@ -290,7 +292,6 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr,
290 */ 292 */
291#define pgprot_noncached(prot) (__pgprot(pgprot_val(prot) | _PAGE_PCD | _PAGE_PWT)) 293#define pgprot_noncached(prot) (__pgprot(pgprot_val(prot) | _PAGE_PCD | _PAGE_PWT))
292 294
293#define __LARGE_PTE (_PAGE_PSE|_PAGE_PRESENT)
294static inline int pmd_large(pmd_t pte) { 295static inline int pmd_large(pmd_t pte) {
295 return (pmd_val(pte) & __LARGE_PTE) == __LARGE_PTE; 296 return (pmd_val(pte) & __LARGE_PTE) == __LARGE_PTE;
296} 297}
diff --git a/include/asm-x86_64/processor.h b/include/asm-x86_64/processor.h
index d641b19f6da5..8b55f139968f 100644
--- a/include/asm-x86_64/processor.h
+++ b/include/asm-x86_64/processor.h
@@ -160,16 +160,17 @@ static inline void clear_in_cr4 (unsigned long mask)
160/* 160/*
161 * User space process size. 47bits minus one guard page. 161 * User space process size. 47bits minus one guard page.
162 */ 162 */
163#define TASK_SIZE (0x800000000000UL - 4096) 163#define TASK_SIZE64 (0x800000000000UL - 4096)
164 164
165/* This decides where the kernel will search for a free chunk of vm 165/* This decides where the kernel will search for a free chunk of vm
166 * space during mmap's. 166 * space during mmap's.
167 */ 167 */
168#define IA32_PAGE_OFFSET ((current->personality & ADDR_LIMIT_3GB) ? 0xc0000000 : 0xFFFFe000) 168#define IA32_PAGE_OFFSET ((current->personality & ADDR_LIMIT_3GB) ? 0xc0000000 : 0xFFFFe000)
169#define TASK_UNMAPPED_32 PAGE_ALIGN(IA32_PAGE_OFFSET/3) 169
170#define TASK_UNMAPPED_64 PAGE_ALIGN(TASK_SIZE/3) 170#define TASK_SIZE (test_thread_flag(TIF_IA32) ? IA32_PAGE_OFFSET : TASK_SIZE64)
171#define TASK_UNMAPPED_BASE \ 171#define TASK_SIZE_OF(child) ((test_tsk_thread_flag(child, TIF_IA32)) ? IA32_PAGE_OFFSET : TASK_SIZE64)
172 (test_thread_flag(TIF_IA32) ? TASK_UNMAPPED_32 : TASK_UNMAPPED_64) 172
173#define TASK_UNMAPPED_BASE PAGE_ALIGN(TASK_SIZE/3)
173 174
174/* 175/*
175 * Size of io_bitmap. 176 * Size of io_bitmap.
diff --git a/include/asm-x86_64/smp.h b/include/asm-x86_64/smp.h
index 96844fecbde8..a7425aa5a3b7 100644
--- a/include/asm-x86_64/smp.h
+++ b/include/asm-x86_64/smp.h
@@ -68,7 +68,7 @@ static inline int num_booting_cpus(void)
68 return cpus_weight(cpu_callout_map); 68 return cpus_weight(cpu_callout_map);
69} 69}
70 70
71#define __smp_processor_id() read_pda(cpunumber) 71#define raw_smp_processor_id() read_pda(cpunumber)
72 72
73extern __inline int hard_smp_processor_id(void) 73extern __inline int hard_smp_processor_id(void)
74{ 74{
diff --git a/include/linux/arcfb.h b/include/linux/arcfb.h
new file mode 100644
index 000000000000..721e7654daeb
--- /dev/null
+++ b/include/linux/arcfb.h
@@ -0,0 +1,8 @@
1#ifndef __LINUX_ARCFB_H__
2#define __LINUX_ARCFB_H__
3
4#define FBIO_WAITEVENT _IO('F', 0x88)
5#define FBIO_GETCONTROL2 _IOR('F', 0x89, size_t)
6
7#endif
8
diff --git a/include/linux/auto_fs4.h b/include/linux/auto_fs4.h
index a1657fb99516..9343c89d843c 100644
--- a/include/linux/auto_fs4.h
+++ b/include/linux/auto_fs4.h
@@ -23,7 +23,7 @@
23#define AUTOFS_MIN_PROTO_VERSION 3 23#define AUTOFS_MIN_PROTO_VERSION 3
24#define AUTOFS_MAX_PROTO_VERSION 4 24#define AUTOFS_MAX_PROTO_VERSION 4
25 25
26#define AUTOFS_PROTO_SUBVERSION 6 26#define AUTOFS_PROTO_SUBVERSION 7
27 27
28/* Mask for expire behaviour */ 28/* Mask for expire behaviour */
29#define AUTOFS_EXP_IMMEDIATE 1 29#define AUTOFS_EXP_IMMEDIATE 1
diff --git a/include/linux/fb.h b/include/linux/fb.h
index b468bf496547..bc24beeed971 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -524,11 +524,11 @@ struct fb_pixmap {
524 u32 offset; /* current offset to buffer */ 524 u32 offset; /* current offset to buffer */
525 u32 buf_align; /* byte alignment of each bitmap */ 525 u32 buf_align; /* byte alignment of each bitmap */
526 u32 scan_align; /* alignment per scanline */ 526 u32 scan_align; /* alignment per scanline */
527 u32 access_align; /* alignment per read/write */ 527 u32 access_align; /* alignment per read/write (bits) */
528 u32 flags; /* see FB_PIXMAP_* */ 528 u32 flags; /* see FB_PIXMAP_* */
529 /* access methods */ 529 /* access methods */
530 void (*outbuf)(struct fb_info *info, u8 *addr, u8 *src, unsigned int size); 530 void (*writeio)(struct fb_info *info, void __iomem *dst, void *src, unsigned int size);
531 u8 (*inbuf) (struct fb_info *info, u8 *addr); 531 void (*readio) (struct fb_info *info, void *dst, void __iomem *src, unsigned int size);
532}; 532};
533 533
534 534
@@ -816,18 +816,9 @@ extern int unregister_framebuffer(struct fb_info *fb_info);
816extern int fb_prepare_logo(struct fb_info *fb_info); 816extern int fb_prepare_logo(struct fb_info *fb_info);
817extern int fb_show_logo(struct fb_info *fb_info); 817extern int fb_show_logo(struct fb_info *fb_info);
818extern char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size); 818extern char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size);
819extern void fb_iomove_buf_unaligned(struct fb_info *info, struct fb_pixmap *buf, 819extern void fb_pad_unaligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 idx,
820 u8 *dst, u32 d_pitch, u8 *src, u32 idx,
821 u32 height, u32 shift_high, u32 shift_low, u32 mod); 820 u32 height, u32 shift_high, u32 shift_low, u32 mod);
822extern void fb_iomove_buf_aligned(struct fb_info *info, struct fb_pixmap *buf, 821extern void fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, u32 height);
823 u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch,
824 u32 height);
825extern void fb_sysmove_buf_unaligned(struct fb_info *info, struct fb_pixmap *buf,
826 u8 *dst, u32 d_pitch, u8 *src, u32 idx,
827 u32 height, u32 shift_high, u32 shift_low, u32 mod);
828extern void fb_sysmove_buf_aligned(struct fb_info *info, struct fb_pixmap *buf,
829 u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch,
830 u32 height);
831extern void fb_set_suspend(struct fb_info *info, int state); 822extern void fb_set_suspend(struct fb_info *info, int state);
832extern int fb_get_color_depth(struct fb_var_screeninfo *var); 823extern int fb_get_color_depth(struct fb_var_screeninfo *var);
833extern int fb_get_options(char *name, char **option); 824extern int fb_get_options(char *name, char **option);
diff --git a/include/linux/font.h b/include/linux/font.h
index fc2d690c9d5f..8fc80a7d78ac 100644
--- a/include/linux/font.h
+++ b/include/linux/font.h
@@ -25,19 +25,23 @@ struct font_desc {
25#define VGA8x16_IDX 1 25#define VGA8x16_IDX 1
26#define PEARL8x8_IDX 2 26#define PEARL8x8_IDX 2
27#define VGA6x11_IDX 3 27#define VGA6x11_IDX 3
28#define SUN8x16_IDX 4 28#define FONT7x14_IDX 4
29#define SUN12x22_IDX 5 29#define FONT10x18_IDX 5
30#define ACORN8x8_IDX 6 30#define SUN8x16_IDX 6
31#define MINI4x6_IDX 7 31#define SUN12x22_IDX 7
32#define ACORN8x8_IDX 8
33#define MINI4x6_IDX 9
32 34
33extern struct font_desc font_vga_8x8, 35extern struct font_desc font_vga_8x8,
34 font_vga_8x16, 36 font_vga_8x16,
35 font_pearl_8x8, 37 font_pearl_8x8,
36 font_vga_6x11, 38 font_vga_6x11,
37 font_sun_8x16, 39 font_7x14,
38 font_sun_12x22, 40 font_10x18,
39 font_acorn_8x8, 41 font_sun_8x16,
40 font_mini_4x6; 42 font_sun_12x22,
43 font_acorn_8x8,
44 font_mini_4x6;
41 45
42/* Find a font with a specific name */ 46/* Find a font with a specific name */
43 47
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
index faaff4c64559..70f54af87b9f 100644
--- a/include/linux/fsl_devices.h
+++ b/include/linux/fsl_devices.h
@@ -51,6 +51,7 @@ struct gianfar_platform_data {
51 51
52 /* board specific information */ 52 /* board specific information */
53 u32 board_flags; 53 u32 board_flags;
54 u32 phy_flags;
54 u32 phyid; 55 u32 phyid;
55 u32 interruptPHY; 56 u32 interruptPHY;
56 u8 mac_addr[6]; 57 u8 mac_addr[6];
@@ -61,9 +62,14 @@ struct gianfar_platform_data {
61#define FSL_GIANFAR_DEV_HAS_COALESCE 0x00000002 62#define FSL_GIANFAR_DEV_HAS_COALESCE 0x00000002
62#define FSL_GIANFAR_DEV_HAS_RMON 0x00000004 63#define FSL_GIANFAR_DEV_HAS_RMON 0x00000004
63#define FSL_GIANFAR_DEV_HAS_MULTI_INTR 0x00000008 64#define FSL_GIANFAR_DEV_HAS_MULTI_INTR 0x00000008
65#define FSL_GIANFAR_DEV_HAS_CSUM 0x00000010
66#define FSL_GIANFAR_DEV_HAS_VLAN 0x00000020
67#define FSL_GIANFAR_DEV_HAS_EXTENDED_HASH 0x00000040
68#define FSL_GIANFAR_DEV_HAS_PADDING 0x00000080
64 69
65/* Flags in gianfar_platform_data */ 70/* Flags in gianfar_platform_data */
66#define FSL_GIANFAR_BRD_HAS_PHY_INTR 0x00000001 /* if not set use a timer */ 71#define FSL_GIANFAR_BRD_HAS_PHY_INTR 0x00000001 /* set or use a timer */
72#define FSL_GIANFAR_BRD_IS_REDUCED 0x00000002 /* Set if RGMII, RMII */
67 73
68struct fsl_i2c_platform_data { 74struct fsl_i2c_platform_data {
69 /* device specific information */ 75 /* device specific information */
diff --git a/include/linux/genalloc.h b/include/linux/genalloc.h
new file mode 100644
index 000000000000..7fd0576a4454
--- /dev/null
+++ b/include/linux/genalloc.h
@@ -0,0 +1,40 @@
1/*
2 * Basic general purpose allocator for managing special purpose memory
3 * not managed by the regular kmalloc/kfree interface.
4 * Uses for this includes on-device special memory, uncached memory
5 * etc.
6 *
7 * This code is based on the buddy allocator found in the sym53c8xx_2
8 * driver, adapted for general purpose use.
9 *
10 * This source code is licensed under the GNU General Public License,
11 * Version 2. See the file COPYING for more details.
12 */
13
14#include <linux/spinlock.h>
15
16#define ALLOC_MIN_SHIFT 5 /* 32 bytes minimum */
17/*
18 * Link between free memory chunks of a given size.
19 */
20struct gen_pool_link {
21 struct gen_pool_link *next;
22};
23
24/*
25 * Memory pool descriptor.
26 */
27struct gen_pool {
28 spinlock_t lock;
29 unsigned long (*get_new_chunk)(struct gen_pool *);
30 struct gen_pool *next;
31 struct gen_pool_link *h;
32 unsigned long private;
33 int max_chunk_shift;
34};
35
36unsigned long gen_pool_alloc(struct gen_pool *poolp, int size);
37void gen_pool_free(struct gen_pool *mp, unsigned long ptr, int size);
38struct gen_pool *gen_pool_create(int nr_chunks, int max_chunk_shift,
39 unsigned long (*fp)(struct gen_pool *),
40 unsigned long data);
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index af7407e8cfc5..8d6bf608b199 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -39,6 +39,7 @@ struct vm_area_struct;
39#define __GFP_COMP 0x4000u /* Add compound page metadata */ 39#define __GFP_COMP 0x4000u /* Add compound page metadata */
40#define __GFP_ZERO 0x8000u /* Return zeroed page on success */ 40#define __GFP_ZERO 0x8000u /* Return zeroed page on success */
41#define __GFP_NOMEMALLOC 0x10000u /* Don't use emergency reserves */ 41#define __GFP_NOMEMALLOC 0x10000u /* Don't use emergency reserves */
42#define __GFP_NORECLAIM 0x20000u /* No realy zone reclaim during allocation */
42 43
43#define __GFP_BITS_SHIFT 20 /* Room for 20 __GFP_FOO bits */ 44#define __GFP_BITS_SHIFT 20 /* Room for 20 __GFP_FOO bits */
44#define __GFP_BITS_MASK ((1 << __GFP_BITS_SHIFT) - 1) 45#define __GFP_BITS_MASK ((1 << __GFP_BITS_SHIFT) - 1)
@@ -47,7 +48,7 @@ struct vm_area_struct;
47#define GFP_LEVEL_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_FS| \ 48#define GFP_LEVEL_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_FS| \
48 __GFP_COLD|__GFP_NOWARN|__GFP_REPEAT| \ 49 __GFP_COLD|__GFP_NOWARN|__GFP_REPEAT| \
49 __GFP_NOFAIL|__GFP_NORETRY|__GFP_NO_GROW|__GFP_COMP| \ 50 __GFP_NOFAIL|__GFP_NORETRY|__GFP_NO_GROW|__GFP_COMP| \
50 __GFP_NOMEMALLOC) 51 __GFP_NOMEMALLOC|__GFP_NORECLAIM)
51 52
52#define GFP_ATOMIC (__GFP_HIGH) 53#define GFP_ATOMIC (__GFP_HIGH)
53#define GFP_NOIO (__GFP_WAIT) 54#define GFP_NOIO (__GFP_WAIT)
@@ -132,5 +133,10 @@ extern void FASTCALL(free_cold_page(struct page *page));
132#define free_page(addr) free_pages((addr),0) 133#define free_page(addr) free_pages((addr),0)
133 134
134void page_alloc_init(void); 135void page_alloc_init(void);
136#ifdef CONFIG_NUMA
137void drain_remote_pages(void);
138#else
139static inline void drain_remote_pages(void) { };
140#endif
135 141
136#endif /* __LINUX_GFP_H */ 142#endif /* __LINUX_GFP_H */
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 6af1ae4a8211..f529d1442815 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -4,6 +4,7 @@
4#ifdef CONFIG_HUGETLB_PAGE 4#ifdef CONFIG_HUGETLB_PAGE
5 5
6#include <linux/mempolicy.h> 6#include <linux/mempolicy.h>
7#include <asm/tlbflush.h>
7 8
8struct ctl_table; 9struct ctl_table;
9 10
@@ -22,12 +23,6 @@ int hugetlb_report_meminfo(char *);
22int hugetlb_report_node_meminfo(int, char *); 23int hugetlb_report_node_meminfo(int, char *);
23int is_hugepage_mem_enough(size_t); 24int is_hugepage_mem_enough(size_t);
24unsigned long hugetlb_total_pages(void); 25unsigned long hugetlb_total_pages(void);
25struct page *follow_huge_addr(struct mm_struct *mm, unsigned long address,
26 int write);
27struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address,
28 pmd_t *pmd, int write);
29int is_aligned_hugepage_range(unsigned long addr, unsigned long len);
30int pmd_huge(pmd_t pmd);
31struct page *alloc_huge_page(void); 26struct page *alloc_huge_page(void);
32void free_huge_page(struct page *); 27void free_huge_page(struct page *);
33 28
@@ -35,6 +30,17 @@ extern unsigned long max_huge_pages;
35extern const unsigned long hugetlb_zero, hugetlb_infinity; 30extern const unsigned long hugetlb_zero, hugetlb_infinity;
36extern int sysctl_hugetlb_shm_group; 31extern int sysctl_hugetlb_shm_group;
37 32
33/* arch callbacks */
34
35pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr);
36pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr);
37struct page *follow_huge_addr(struct mm_struct *mm, unsigned long address,
38 int write);
39struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address,
40 pmd_t *pmd, int write);
41int is_aligned_hugepage_range(unsigned long addr, unsigned long len);
42int pmd_huge(pmd_t pmd);
43
38#ifndef ARCH_HAS_HUGEPAGE_ONLY_RANGE 44#ifndef ARCH_HAS_HUGEPAGE_ONLY_RANGE
39#define is_hugepage_only_range(mm, addr, len) 0 45#define is_hugepage_only_range(mm, addr, len) 0
40#define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) \ 46#define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) \
@@ -48,6 +54,28 @@ extern int sysctl_hugetlb_shm_group;
48int prepare_hugepage_range(unsigned long addr, unsigned long len); 54int prepare_hugepage_range(unsigned long addr, unsigned long len);
49#endif 55#endif
50 56
57#ifndef ARCH_HAS_SETCLEAR_HUGE_PTE
58#define set_huge_pte_at(mm, addr, ptep, pte) set_pte_at(mm, addr, ptep, pte)
59#define huge_ptep_get_and_clear(mm, addr, ptep) ptep_get_and_clear(mm, addr, ptep)
60#else
61void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
62 pte_t *ptep, pte_t pte);
63pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
64 pte_t *ptep);
65#endif
66
67#ifndef ARCH_HAS_HUGETLB_PREFAULT_HOOK
68#define hugetlb_prefault_arch_hook(mm) do { } while (0)
69#else
70void hugetlb_prefault_arch_hook(struct mm_struct *mm);
71#endif
72
73#ifndef ARCH_HAS_HUGETLB_CLEAN_STALE_PGTABLE
74#define hugetlb_clean_stale_pgtable(pte) BUG()
75#else
76void hugetlb_clean_stale_pgtable(pte_t *pte);
77#endif
78
51#else /* !CONFIG_HUGETLB_PAGE */ 79#else /* !CONFIG_HUGETLB_PAGE */
52 80
53static inline int is_vm_hugetlb_page(struct vm_area_struct *vma) 81static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
diff --git a/include/linux/ioc4.h b/include/linux/ioc4.h
new file mode 100644
index 000000000000..3dd18b785ebd
--- /dev/null
+++ b/include/linux/ioc4.h
@@ -0,0 +1,179 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (c) 2005 Silicon Graphics, Inc. All Rights Reserved.
7 */
8
9#ifndef _LINUX_IOC4_H
10#define _LINUX_IOC4_H
11
12#include <linux/interrupt.h>
13
14/***************
15 * Definitions *
16 ***************/
17
18/* Miscellaneous values inherent to hardware */
19
20#define IOC4_EXTINT_COUNT_DIVISOR 520 /* PCI clocks per COUNT tick */
21
22/***********************************
23 * Structures needed by subdrivers *
24 ***********************************/
25
26/* This structure fully describes the IOC4 miscellaneous registers which
27 * appear at bar[0]+0x00000 through bar[0]+0x0005c. The corresponding
28 * PCI resource is managed by the main IOC4 driver because it contains
29 * registers of interest to many different IOC4 subdrivers.
30 */
31struct ioc4_misc_regs {
32 /* Miscellaneous IOC4 registers */
33 union ioc4_pci_err_addr_l {
34 uint32_t raw;
35 struct {
36 uint32_t valid:1; /* Address captured */
37 uint32_t master_id:4; /* Unit causing error
38 * 0/1: Serial port 0 TX/RX
39 * 2/3: Serial port 1 TX/RX
40 * 4/5: Serial port 2 TX/RX
41 * 6/7: Serial port 3 TX/RX
42 * 8: ATA/ATAPI
43 * 9-15: Undefined
44 */
45 uint32_t mul_err:1; /* Multiple errors occurred */
46 uint32_t addr:26; /* Bits 31-6 of error addr */
47 } fields;
48 } pci_err_addr_l;
49 uint32_t pci_err_addr_h; /* Bits 63-32 of error addr */
50 union ioc4_sio_int {
51 uint32_t raw;
52 struct {
53 uint8_t tx_mt:1; /* TX ring buffer empty */
54 uint8_t rx_full:1; /* RX ring buffer full */
55 uint8_t rx_high:1; /* RX high-water exceeded */
56 uint8_t rx_timer:1; /* RX timer has triggered */
57 uint8_t delta_dcd:1; /* DELTA_DCD seen */
58 uint8_t delta_cts:1; /* DELTA_CTS seen */
59 uint8_t intr_pass:1; /* Interrupt pass-through */
60 uint8_t tx_explicit:1; /* TX, MCW, or delay complete */
61 } fields[4];
62 } sio_ir; /* Serial interrupt state */
63 union ioc4_other_int {
64 uint32_t raw;
65 struct {
66 uint32_t ata_int:1; /* ATA port passthru */
67 uint32_t ata_memerr:1; /* ATA halted by mem error */
68 uint32_t memerr:4; /* Serial halted by mem err */
69 uint32_t kbd_int:1; /* kbd/mouse intr asserted */
70 uint32_t reserved:16; /* zero */
71 uint32_t rt_int:1; /* INT_OUT section latch */
72 uint32_t gen_int:8; /* Intr. from generic pins */
73 } fields;
74 } other_ir; /* Other interrupt state */
75 union ioc4_sio_int sio_ies; /* Serial interrupt enable set */
76 union ioc4_other_int other_ies; /* Other interrupt enable set */
77 union ioc4_sio_int sio_iec; /* Serial interrupt enable clear */
78 union ioc4_other_int other_iec; /* Other interrupt enable clear */
79 union ioc4_sio_cr {
80 uint32_t raw;
81 struct {
82 uint32_t cmd_pulse:4; /* Bytebus strobe width */
83 uint32_t arb_diag:3; /* PCI bus requester */
84 uint32_t sio_diag_idle:1; /* Active ser req? */
85 uint32_t ata_diag_idle:1; /* Active ATA req? */
86 uint32_t ata_diag_active:1; /* ATA req is winner */
87 uint32_t reserved:22; /* zero */
88 } fields;
89 } sio_cr;
90 uint32_t unused1;
91 union ioc4_int_out {
92 uint32_t raw;
93 struct {
94 uint32_t count:16; /* Period control */
95 uint32_t mode:3; /* Output signal shape */
96 uint32_t reserved:11; /* zero */
97 uint32_t diag:1; /* Timebase control */
98 uint32_t int_out:1; /* Current value */
99 } fields;
100 } int_out; /* External interrupt output control */
101 uint32_t unused2;
102 union ioc4_gpcr {
103 uint32_t raw;
104 struct {
105 uint32_t dir:8; /* Pin direction */
106 uint32_t edge:8; /* Edge/level mode */
107 uint32_t reserved1:4; /* zero */
108 uint32_t int_out_en:1; /* INT_OUT enable */
109 uint32_t reserved2:11; /* zero */
110 } fields;
111 } gpcr_s; /* Generic PIO control set */
112 union ioc4_gpcr gpcr_c; /* Generic PIO control clear */
113 union ioc4_gpdr {
114 uint32_t raw;
115 struct {
116 uint32_t gen_pin:8; /* State of pins */
117 uint32_t reserved:24;
118 } fields;
119 } gpdr; /* Generic PIO data */
120 uint32_t unused3;
121 union ioc4_gppr {
122 uint32_t raw;
123 struct {
124 uint32_t gen_pin:1; /* Single pin state */
125 uint32_t reserved:31;
126 } fields;
127 } gppr[8]; /* Generic PIO pins */
128};
129
130/* Masks for GPCR DIR pins */
131#define IOC4_GPCR_DIR_0 0x01 /* External interrupt output */
132#define IOC4_GPCR_DIR_1 0x02 /* External interrupt input */
133#define IOC4_GPCR_DIR_2 0x04
134#define IOC4_GPCR_DIR_3 0x08 /* Keyboard/mouse presence */
135#define IOC4_GPCR_DIR_4 0x10 /* Ser. port 0 xcvr select (0=232, 1=422) */
136#define IOC4_GPCR_DIR_5 0x20 /* Ser. port 1 xcvr select (0=232, 1=422) */
137#define IOC4_GPCR_DIR_6 0x40 /* Ser. port 2 xcvr select (0=232, 1=422) */
138#define IOC4_GPCR_DIR_7 0x80 /* Ser. port 3 xcvr select (0=232, 1=422) */
139
140/* Masks for GPCR EDGE pins */
141#define IOC4_GPCR_EDGE_0 0x01
142#define IOC4_GPCR_EDGE_1 0x02 /* External interrupt input */
143#define IOC4_GPCR_EDGE_2 0x04
144#define IOC4_GPCR_EDGE_3 0x08
145#define IOC4_GPCR_EDGE_4 0x10
146#define IOC4_GPCR_EDGE_5 0x20
147#define IOC4_GPCR_EDGE_6 0x40
148#define IOC4_GPCR_EDGE_7 0x80
149
150/* One of these per IOC4 */
151struct ioc4_driver_data {
152 struct list_head idd_list;
153 unsigned long idd_bar0;
154 struct pci_dev *idd_pdev;
155 const struct pci_device_id *idd_pci_id;
156 struct __iomem ioc4_misc_regs *idd_misc_regs;
157 unsigned long count_period;
158 void *idd_serial_data;
159};
160
161/* One per submodule */
162struct ioc4_submodule {
163 struct list_head is_list;
164 char *is_name;
165 struct module *is_owner;
166 int (*is_probe) (struct ioc4_driver_data *);
167 int (*is_remove) (struct ioc4_driver_data *);
168};
169
170#define IOC4_NUM_CARDS 8 /* max cards per partition */
171
172/**********************************
173 * Functions needed by submodules *
174 **********************************/
175
176extern int ioc4_register_submodule(struct ioc4_submodule *);
177extern void ioc4_unregister_submodule(struct ioc4_submodule *);
178
179#endif /* _LINUX_IOC4_H */
diff --git a/include/linux/ioc4_common.h b/include/linux/ioc4_common.h
deleted file mode 100644
index b03bcc46df55..000000000000
--- a/include/linux/ioc4_common.h
+++ /dev/null
@@ -1,21 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (c) 2005 Silicon Graphics, Inc. All Rights Reserved.
7 */
8
9#ifndef _LINUX_IOC4_COMMON_H
10#define _LINUX_IOC4_COMMON_H
11
12/* prototypes */
13
14int ioc4_serial_init(void);
15
16int ioc4_serial_attach_one(struct pci_dev *pdev, const struct
17 pci_device_id *pci_id);
18int ioc4_ide_attach_one(struct pci_dev *pdev, const struct
19 pci_device_id *pci_id);
20
21#endif /* _LINUX_IOC4_COMMON_H */
diff --git a/include/linux/irq.h b/include/linux/irq.h
index c3ff4d101667..7fc1022be9ee 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -47,6 +47,10 @@ struct hw_interrupt_type {
47 void (*ack)(unsigned int irq); 47 void (*ack)(unsigned int irq);
48 void (*end)(unsigned int irq); 48 void (*end)(unsigned int irq);
49 void (*set_affinity)(unsigned int irq, cpumask_t dest); 49 void (*set_affinity)(unsigned int irq, cpumask_t dest);
50 /* Currently used only by UML, might disappear one day.*/
51#ifdef CONFIG_IRQ_RELEASE_METHOD
52 void (*release)(unsigned int irq, void *dev_id);
53#endif
50}; 54};
51 55
52typedef struct hw_interrupt_type hw_irq_controller; 56typedef struct hw_interrupt_type hw_irq_controller;
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 17518fe0b311..1813b162b0a8 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -691,6 +691,12 @@ extern void show_mem(void);
691extern void si_meminfo(struct sysinfo * val); 691extern void si_meminfo(struct sysinfo * val);
692extern void si_meminfo_node(struct sysinfo *val, int nid); 692extern void si_meminfo_node(struct sysinfo *val, int nid);
693 693
694#ifdef CONFIG_NUMA
695extern void setup_per_cpu_pageset(void);
696#else
697static inline void setup_per_cpu_pageset(void) {}
698#endif
699
694/* prio_tree.c */ 700/* prio_tree.c */
695void vma_prio_tree_add(struct vm_area_struct *, struct vm_area_struct *old); 701void vma_prio_tree_add(struct vm_area_struct *, struct vm_area_struct *old);
696void vma_prio_tree_insert(struct vm_area_struct *, struct prio_tree_root *); 702void vma_prio_tree_insert(struct vm_area_struct *, struct prio_tree_root *);
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index e530c6c092f1..4733d35d8223 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -63,6 +63,12 @@ struct per_cpu_pageset {
63#endif 63#endif
64} ____cacheline_aligned_in_smp; 64} ____cacheline_aligned_in_smp;
65 65
66#ifdef CONFIG_NUMA
67#define zone_pcp(__z, __cpu) ((__z)->pageset[(__cpu)])
68#else
69#define zone_pcp(__z, __cpu) (&(__z)->pageset[(__cpu)])
70#endif
71
66#define ZONE_DMA 0 72#define ZONE_DMA 0
67#define ZONE_NORMAL 1 73#define ZONE_NORMAL 1
68#define ZONE_HIGHMEM 2 74#define ZONE_HIGHMEM 2
@@ -122,8 +128,11 @@ struct zone {
122 */ 128 */
123 unsigned long lowmem_reserve[MAX_NR_ZONES]; 129 unsigned long lowmem_reserve[MAX_NR_ZONES];
124 130
131#ifdef CONFIG_NUMA
132 struct per_cpu_pageset *pageset[NR_CPUS];
133#else
125 struct per_cpu_pageset pageset[NR_CPUS]; 134 struct per_cpu_pageset pageset[NR_CPUS];
126 135#endif
127 /* 136 /*
128 * free areas of different sizes 137 * free areas of different sizes
129 */ 138 */
@@ -145,6 +154,14 @@ struct zone {
145 int all_unreclaimable; /* All pages pinned */ 154 int all_unreclaimable; /* All pages pinned */
146 155
147 /* 156 /*
157 * Does the allocator try to reclaim pages from the zone as soon
158 * as it fails a watermark_ok() in __alloc_pages?
159 */
160 int reclaim_pages;
161 /* A count of how many reclaimers are scanning this zone */
162 atomic_t reclaim_in_progress;
163
164 /*
148 * prev_priority holds the scanning priority for this zone. It is 165 * prev_priority holds the scanning priority for this zone. It is
149 * defined as the scanning priority at which we achieved our reclaim 166 * defined as the scanning priority at which we achieved our reclaim
150 * target at the previous try_to_free_pages() or balance_pgdat() 167 * target at the previous try_to_free_pages() or balance_pgdat()
@@ -381,7 +398,7 @@ int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *, int, struct file *,
381 398
382#include <linux/topology.h> 399#include <linux/topology.h>
383/* Returns the number of the current Node. */ 400/* Returns the number of the current Node. */
384#define numa_node_id() (cpu_to_node(_smp_processor_id())) 401#define numa_node_id() (cpu_to_node(raw_smp_processor_id()))
385 402
386#ifndef CONFIG_DISCONTIGMEM 403#ifndef CONFIG_DISCONTIGMEM
387 404
diff --git a/include/linux/netfilter_ipv4.h b/include/linux/netfilter_ipv4.h
index 9e5750079e09..3ebc36afae1a 100644
--- a/include/linux/netfilter_ipv4.h
+++ b/include/linux/netfilter_ipv4.h
@@ -75,12 +75,6 @@ enum nf_ip_hook_priorities {
75#define SO_ORIGINAL_DST 80 75#define SO_ORIGINAL_DST 80
76 76
77#ifdef __KERNEL__ 77#ifdef __KERNEL__
78#ifdef CONFIG_NETFILTER_DEBUG
79void nf_debug_ip_local_deliver(struct sk_buff *skb);
80void nf_debug_ip_loopback_xmit(struct sk_buff *newskb);
81void nf_debug_ip_finish_output2(struct sk_buff *skb);
82#endif /*CONFIG_NETFILTER_DEBUG*/
83
84extern int ip_route_me_harder(struct sk_buff **pskb); 78extern int ip_route_me_harder(struct sk_buff **pskb);
85 79
86/* Call this before modifying an existing IP packet: ensures it is 80/* Call this before modifying an existing IP packet: ensures it is
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_core.h b/include/linux/netfilter_ipv4/ip_conntrack_core.h
index d84be02cb4fc..694aec9b4784 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_core.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_core.h
@@ -1,7 +1,6 @@
1#ifndef _IP_CONNTRACK_CORE_H 1#ifndef _IP_CONNTRACK_CORE_H
2#define _IP_CONNTRACK_CORE_H 2#define _IP_CONNTRACK_CORE_H
3#include <linux/netfilter.h> 3#include <linux/netfilter.h>
4#include <linux/netfilter_ipv4/lockhelp.h>
5 4
6/* This header is used to share core functionality between the 5/* This header is used to share core functionality between the
7 standalone connection tracking module, and the compatibility layer's use 6 standalone connection tracking module, and the compatibility layer's use
@@ -47,6 +46,6 @@ static inline int ip_conntrack_confirm(struct sk_buff **pskb)
47 46
48extern struct list_head *ip_conntrack_hash; 47extern struct list_head *ip_conntrack_hash;
49extern struct list_head ip_conntrack_expect_list; 48extern struct list_head ip_conntrack_expect_list;
50DECLARE_RWLOCK_EXTERN(ip_conntrack_lock); 49extern rwlock_t ip_conntrack_lock;
51#endif /* _IP_CONNTRACK_CORE_H */ 50#endif /* _IP_CONNTRACK_CORE_H */
52 51
diff --git a/include/linux/netfilter_ipv4/ip_nat.h b/include/linux/netfilter_ipv4/ip_nat.h
index 2b72b86176f0..e201ec6e9905 100644
--- a/include/linux/netfilter_ipv4/ip_nat.h
+++ b/include/linux/netfilter_ipv4/ip_nat.h
@@ -50,10 +50,9 @@ struct ip_nat_multi_range_compat
50 50
51#ifdef __KERNEL__ 51#ifdef __KERNEL__
52#include <linux/list.h> 52#include <linux/list.h>
53#include <linux/netfilter_ipv4/lockhelp.h>
54 53
55/* Protects NAT hash tables, and NAT-private part of conntracks. */ 54/* Protects NAT hash tables, and NAT-private part of conntracks. */
56DECLARE_RWLOCK_EXTERN(ip_nat_lock); 55extern rwlock_t ip_nat_lock;
57 56
58/* The structure embedded in the conntrack structure. */ 57/* The structure embedded in the conntrack structure. */
59struct ip_nat_info 58struct ip_nat_info
diff --git a/include/linux/netfilter_ipv4/listhelp.h b/include/linux/netfilter_ipv4/listhelp.h
index f2ae7c5e57bb..360429f48737 100644
--- a/include/linux/netfilter_ipv4/listhelp.h
+++ b/include/linux/netfilter_ipv4/listhelp.h
@@ -2,7 +2,6 @@
2#define _LISTHELP_H 2#define _LISTHELP_H
3#include <linux/config.h> 3#include <linux/config.h>
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/netfilter_ipv4/lockhelp.h>
6 5
7/* Header to do more comprehensive job than linux/list.h; assume list 6/* Header to do more comprehensive job than linux/list.h; assume list
8 is first entry in structure. */ 7 is first entry in structure. */
diff --git a/include/linux/netfilter_ipv4/lockhelp.h b/include/linux/netfilter_ipv4/lockhelp.h
deleted file mode 100644
index a3288633ab46..000000000000
--- a/include/linux/netfilter_ipv4/lockhelp.h
+++ /dev/null
@@ -1,129 +0,0 @@
1#ifndef _LOCKHELP_H
2#define _LOCKHELP_H
3#include <linux/config.h>
4
5#include <linux/spinlock.h>
6#include <asm/atomic.h>
7#include <linux/interrupt.h>
8#include <linux/smp.h>
9
10/* Header to do help in lock debugging. */
11
12#ifdef CONFIG_NETFILTER_DEBUG
13struct spinlock_debug
14{
15 spinlock_t l;
16 atomic_t locked_by;
17};
18
19struct rwlock_debug
20{
21 rwlock_t l;
22 long read_locked_map;
23 long write_locked_map;
24};
25
26#define DECLARE_LOCK(l) \
27struct spinlock_debug l = { SPIN_LOCK_UNLOCKED, ATOMIC_INIT(-1) }
28#define DECLARE_LOCK_EXTERN(l) \
29extern struct spinlock_debug l
30#define DECLARE_RWLOCK(l) \
31struct rwlock_debug l = { RW_LOCK_UNLOCKED, 0, 0 }
32#define DECLARE_RWLOCK_EXTERN(l) \
33extern struct rwlock_debug l
34
35#define MUST_BE_LOCKED(l) \
36do { if (atomic_read(&(l)->locked_by) != smp_processor_id()) \
37 printk("ASSERT %s:%u %s unlocked\n", __FILE__, __LINE__, #l); \
38} while(0)
39
40#define MUST_BE_UNLOCKED(l) \
41do { if (atomic_read(&(l)->locked_by) == smp_processor_id()) \
42 printk("ASSERT %s:%u %s locked\n", __FILE__, __LINE__, #l); \
43} while(0)
44
45/* Write locked OK as well. */
46#define MUST_BE_READ_LOCKED(l) \
47do { if (!((l)->read_locked_map & (1UL << smp_processor_id())) \
48 && !((l)->write_locked_map & (1UL << smp_processor_id()))) \
49 printk("ASSERT %s:%u %s not readlocked\n", __FILE__, __LINE__, #l); \
50} while(0)
51
52#define MUST_BE_WRITE_LOCKED(l) \
53do { if (!((l)->write_locked_map & (1UL << smp_processor_id()))) \
54 printk("ASSERT %s:%u %s not writelocked\n", __FILE__, __LINE__, #l); \
55} while(0)
56
57#define MUST_BE_READ_WRITE_UNLOCKED(l) \
58do { if ((l)->read_locked_map & (1UL << smp_processor_id())) \
59 printk("ASSERT %s:%u %s readlocked\n", __FILE__, __LINE__, #l); \
60 else if ((l)->write_locked_map & (1UL << smp_processor_id())) \
61 printk("ASSERT %s:%u %s writelocked\n", __FILE__, __LINE__, #l); \
62} while(0)
63
64#define LOCK_BH(lk) \
65do { \
66 MUST_BE_UNLOCKED(lk); \
67 spin_lock_bh(&(lk)->l); \
68 atomic_set(&(lk)->locked_by, smp_processor_id()); \
69} while(0)
70
71#define UNLOCK_BH(lk) \
72do { \
73 MUST_BE_LOCKED(lk); \
74 atomic_set(&(lk)->locked_by, -1); \
75 spin_unlock_bh(&(lk)->l); \
76} while(0)
77
78#define READ_LOCK(lk) \
79do { \
80 MUST_BE_READ_WRITE_UNLOCKED(lk); \
81 read_lock_bh(&(lk)->l); \
82 set_bit(smp_processor_id(), &(lk)->read_locked_map); \
83} while(0)
84
85#define WRITE_LOCK(lk) \
86do { \
87 MUST_BE_READ_WRITE_UNLOCKED(lk); \
88 write_lock_bh(&(lk)->l); \
89 set_bit(smp_processor_id(), &(lk)->write_locked_map); \
90} while(0)
91
92#define READ_UNLOCK(lk) \
93do { \
94 if (!((lk)->read_locked_map & (1UL << smp_processor_id()))) \
95 printk("ASSERT: %s:%u %s not readlocked\n", \
96 __FILE__, __LINE__, #lk); \
97 clear_bit(smp_processor_id(), &(lk)->read_locked_map); \
98 read_unlock_bh(&(lk)->l); \
99} while(0)
100
101#define WRITE_UNLOCK(lk) \
102do { \
103 MUST_BE_WRITE_LOCKED(lk); \
104 clear_bit(smp_processor_id(), &(lk)->write_locked_map); \
105 write_unlock_bh(&(lk)->l); \
106} while(0)
107
108#else
109#define DECLARE_LOCK(l) spinlock_t l = SPIN_LOCK_UNLOCKED
110#define DECLARE_LOCK_EXTERN(l) extern spinlock_t l
111#define DECLARE_RWLOCK(l) rwlock_t l = RW_LOCK_UNLOCKED
112#define DECLARE_RWLOCK_EXTERN(l) extern rwlock_t l
113
114#define MUST_BE_LOCKED(l)
115#define MUST_BE_UNLOCKED(l)
116#define MUST_BE_READ_LOCKED(l)
117#define MUST_BE_WRITE_LOCKED(l)
118#define MUST_BE_READ_WRITE_UNLOCKED(l)
119
120#define LOCK_BH(l) spin_lock_bh(l)
121#define UNLOCK_BH(l) spin_unlock_bh(l)
122
123#define READ_LOCK(l) read_lock_bh(l)
124#define WRITE_LOCK(l) write_lock_bh(l)
125#define READ_UNLOCK(l) read_unlock_bh(l)
126#define WRITE_UNLOCK(l) write_unlock_bh(l)
127#endif /*CONFIG_NETFILTER_DEBUG*/
128
129#endif /* _LOCKHELP_H */
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 561d4dc75836..3029cad63a01 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -147,7 +147,7 @@ struct netlink_callback
147 int (*dump)(struct sk_buff * skb, struct netlink_callback *cb); 147 int (*dump)(struct sk_buff * skb, struct netlink_callback *cb);
148 int (*done)(struct netlink_callback *cb); 148 int (*done)(struct netlink_callback *cb);
149 int family; 149 int family;
150 long args[4]; 150 long args[5];
151}; 151};
152 152
153struct netlink_notify 153struct netlink_notify
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 39ab8c6b5652..f5a6695d4d21 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -61,21 +61,20 @@
61#define PG_active 6 61#define PG_active 6
62#define PG_slab 7 /* slab debug (Suparna wants this) */ 62#define PG_slab 7 /* slab debug (Suparna wants this) */
63 63
64#define PG_highmem 8 64#define PG_checked 8 /* kill me in 2.5.<early>. */
65#define PG_checked 9 /* kill me in 2.5.<early>. */ 65#define PG_arch_1 9
66#define PG_arch_1 10 66#define PG_reserved 10
67#define PG_reserved 11 67#define PG_private 11 /* Has something at ->private */
68 68
69#define PG_private 12 /* Has something at ->private */ 69#define PG_writeback 12 /* Page is under writeback */
70#define PG_writeback 13 /* Page is under writeback */ 70#define PG_nosave 13 /* Used for system suspend/resume */
71#define PG_nosave 14 /* Used for system suspend/resume */ 71#define PG_compound 14 /* Part of a compound page */
72#define PG_compound 15 /* Part of a compound page */ 72#define PG_swapcache 15 /* Swap page: swp_entry_t in private */
73 73
74#define PG_swapcache 16 /* Swap page: swp_entry_t in private */ 74#define PG_mappedtodisk 16 /* Has blocks allocated on-disk */
75#define PG_mappedtodisk 17 /* Has blocks allocated on-disk */ 75#define PG_reclaim 17 /* To be reclaimed asap */
76#define PG_reclaim 18 /* To be reclaimed asap */ 76#define PG_nosave_free 18 /* Free, should not be written */
77#define PG_nosave_free 19 /* Free, should not be written */ 77#define PG_uncached 19 /* Page has been mapped as uncached */
78#define PG_uncached 20 /* Page has been mapped as uncached */
79 78
80/* 79/*
81 * Global page accounting. One instance per CPU. Only unsigned longs are 80 * Global page accounting. One instance per CPU. Only unsigned longs are
@@ -136,8 +135,8 @@ struct page_state {
136 135
137extern void get_page_state(struct page_state *ret); 136extern void get_page_state(struct page_state *ret);
138extern void get_full_page_state(struct page_state *ret); 137extern void get_full_page_state(struct page_state *ret);
139extern unsigned long __read_page_state(unsigned offset); 138extern unsigned long __read_page_state(unsigned long offset);
140extern void __mod_page_state(unsigned offset, unsigned long delta); 139extern void __mod_page_state(unsigned long offset, unsigned long delta);
141 140
142#define read_page_state(member) \ 141#define read_page_state(member) \
143 __read_page_state(offsetof(struct page_state, member)) 142 __read_page_state(offsetof(struct page_state, member))
@@ -215,7 +214,7 @@ extern void __mod_page_state(unsigned offset, unsigned long delta);
215#define TestSetPageSlab(page) test_and_set_bit(PG_slab, &(page)->flags) 214#define TestSetPageSlab(page) test_and_set_bit(PG_slab, &(page)->flags)
216 215
217#ifdef CONFIG_HIGHMEM 216#ifdef CONFIG_HIGHMEM
218#define PageHighMem(page) test_bit(PG_highmem, &(page)->flags) 217#define PageHighMem(page) is_highmem(page_zone(page))
219#else 218#else
220#define PageHighMem(page) 0 /* needed to optimize away at compile time */ 219#define PageHighMem(page) 0 /* needed to optimize away at compile time */
221#endif 220#endif
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 0422031161ba..d9a25647a295 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -52,12 +52,12 @@ void release_pages(struct page **pages, int nr, int cold);
52 52
53static inline struct page *page_cache_alloc(struct address_space *x) 53static inline struct page *page_cache_alloc(struct address_space *x)
54{ 54{
55 return alloc_pages(mapping_gfp_mask(x), 0); 55 return alloc_pages(mapping_gfp_mask(x)|__GFP_NORECLAIM, 0);
56} 56}
57 57
58static inline struct page *page_cache_alloc_cold(struct address_space *x) 58static inline struct page *page_cache_alloc_cold(struct address_space *x)
59{ 59{
60 return alloc_pages(mapping_gfp_mask(x)|__GFP_COLD, 0); 60 return alloc_pages(mapping_gfp_mask(x)|__GFP_COLD|__GFP_NORECLAIM, 0);
61} 61}
62 62
63typedef int filler_t(void *, struct page *); 63typedef int filler_t(void *, struct page *);
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index b8b4ebf9abf1..63e89e47b8e9 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -575,6 +575,7 @@
575#define PCI_DEVICE_ID_CT_65550 0x00e0 575#define PCI_DEVICE_ID_CT_65550 0x00e0
576#define PCI_DEVICE_ID_CT_65554 0x00e4 576#define PCI_DEVICE_ID_CT_65554 0x00e4
577#define PCI_DEVICE_ID_CT_65555 0x00e5 577#define PCI_DEVICE_ID_CT_65555 0x00e5
578#define PCI_DEVICE_ID_CT_69000 0x00c0
578 579
579#define PCI_VENDOR_ID_MIRO 0x1031 580#define PCI_VENDOR_ID_MIRO 0x1031
580#define PCI_DEVICE_ID_MIRO_36050 0x5601 581#define PCI_DEVICE_ID_MIRO_36050 0x5601
diff --git a/include/linux/raid/bitmap.h b/include/linux/raid/bitmap.h
new file mode 100644
index 000000000000..e24b74b11150
--- /dev/null
+++ b/include/linux/raid/bitmap.h
@@ -0,0 +1,273 @@
1/*
2 * bitmap.h: Copyright (C) Peter T. Breuer (ptb@ot.uc3m.es) 2003
3 *
4 * additions: Copyright (C) 2003-2004, Paul Clements, SteelEye Technology, Inc.
5 */
6#ifndef BITMAP_H
7#define BITMAP_H 1
8
9#define BITMAP_MAJOR 3
10#define BITMAP_MINOR 38
11
12/*
13 * in-memory bitmap:
14 *
15 * Use 16 bit block counters to track pending writes to each "chunk".
16 * The 2 high order bits are special-purpose, the first is a flag indicating
17 * whether a resync is needed. The second is a flag indicating whether a
18 * resync is active.
19 * This means that the counter is actually 14 bits:
20 *
21 * +--------+--------+------------------------------------------------+
22 * | resync | resync | counter |
23 * | needed | active | |
24 * | (0-1) | (0-1) | (0-16383) |
25 * +--------+--------+------------------------------------------------+
26 *
27 * The "resync needed" bit is set when:
28 * a '1' bit is read from storage at startup.
29 * a write request fails on some drives
30 * a resync is aborted on a chunk with 'resync active' set
31 * It is cleared (and resync-active set) when a resync starts across all drives
32 * of the chunk.
33 *
34 *
35 * The "resync active" bit is set when:
36 * a resync is started on all drives, and resync_needed is set.
37 * resync_needed will be cleared (as long as resync_active wasn't already set).
38 * It is cleared when a resync completes.
39 *
40 * The counter counts pending write requests, plus the on-disk bit.
41 * When the counter is '1' and the resync bits are clear, the on-disk
42 * bit can be cleared aswell, thus setting the counter to 0.
43 * When we set a bit, or in the counter (to start a write), if the fields is
44 * 0, we first set the disk bit and set the counter to 1.
45 *
46 * If the counter is 0, the on-disk bit is clear and the stipe is clean
47 * Anything that dirties the stipe pushes the counter to 2 (at least)
48 * and sets the on-disk bit (lazily).
49 * If a periodic sweep find the counter at 2, it is decremented to 1.
50 * If the sweep find the counter at 1, the on-disk bit is cleared and the
51 * counter goes to zero.
52 *
53 * Also, we'll hijack the "map" pointer itself and use it as two 16 bit block
54 * counters as a fallback when "page" memory cannot be allocated:
55 *
56 * Normal case (page memory allocated):
57 *
58 * page pointer (32-bit)
59 *
60 * [ ] ------+
61 * |
62 * +-------> [ ][ ]..[ ] (4096 byte page == 2048 counters)
63 * c1 c2 c2048
64 *
65 * Hijacked case (page memory allocation failed):
66 *
67 * hijacked page pointer (32-bit)
68 *
69 * [ ][ ] (no page memory allocated)
70 * counter #1 (16-bit) counter #2 (16-bit)
71 *
72 */
73
74#ifdef __KERNEL__
75
76#define PAGE_BITS (PAGE_SIZE << 3)
77#define PAGE_BIT_SHIFT (PAGE_SHIFT + 3)
78
79typedef __u16 bitmap_counter_t;
80#define COUNTER_BITS 16
81#define COUNTER_BIT_SHIFT 4
82#define COUNTER_BYTE_RATIO (COUNTER_BITS / 8)
83#define COUNTER_BYTE_SHIFT (COUNTER_BIT_SHIFT - 3)
84
85#define NEEDED_MASK ((bitmap_counter_t) (1 << (COUNTER_BITS - 1)))
86#define RESYNC_MASK ((bitmap_counter_t) (1 << (COUNTER_BITS - 2)))
87#define COUNTER_MAX ((bitmap_counter_t) RESYNC_MASK - 1)
88#define NEEDED(x) (((bitmap_counter_t) x) & NEEDED_MASK)
89#define RESYNC(x) (((bitmap_counter_t) x) & RESYNC_MASK)
90#define COUNTER(x) (((bitmap_counter_t) x) & COUNTER_MAX)
91
92/* how many counters per page? */
93#define PAGE_COUNTER_RATIO (PAGE_BITS / COUNTER_BITS)
94/* same, except a shift value for more efficient bitops */
95#define PAGE_COUNTER_SHIFT (PAGE_BIT_SHIFT - COUNTER_BIT_SHIFT)
96/* same, except a mask value for more efficient bitops */
97#define PAGE_COUNTER_MASK (PAGE_COUNTER_RATIO - 1)
98
99#define BITMAP_BLOCK_SIZE 512
100#define BITMAP_BLOCK_SHIFT 9
101
102/* how many blocks per chunk? (this is variable) */
103#define CHUNK_BLOCK_RATIO(bitmap) ((bitmap)->chunksize >> BITMAP_BLOCK_SHIFT)
104#define CHUNK_BLOCK_SHIFT(bitmap) ((bitmap)->chunkshift - BITMAP_BLOCK_SHIFT)
105#define CHUNK_BLOCK_MASK(bitmap) (CHUNK_BLOCK_RATIO(bitmap) - 1)
106
107/* when hijacked, the counters and bits represent even larger "chunks" */
108/* there will be 1024 chunks represented by each counter in the page pointers */
109#define PAGEPTR_BLOCK_RATIO(bitmap) \
110 (CHUNK_BLOCK_RATIO(bitmap) << PAGE_COUNTER_SHIFT >> 1)
111#define PAGEPTR_BLOCK_SHIFT(bitmap) \
112 (CHUNK_BLOCK_SHIFT(bitmap) + PAGE_COUNTER_SHIFT - 1)
113#define PAGEPTR_BLOCK_MASK(bitmap) (PAGEPTR_BLOCK_RATIO(bitmap) - 1)
114
115/*
116 * on-disk bitmap:
117 *
118 * Use one bit per "chunk" (block set). We do the disk I/O on the bitmap
119 * file a page at a time. There's a superblock at the start of the file.
120 */
121
122/* map chunks (bits) to file pages - offset by the size of the superblock */
123#define CHUNK_BIT_OFFSET(chunk) ((chunk) + (sizeof(bitmap_super_t) << 3))
124
125#endif
126
127/*
128 * bitmap structures:
129 */
130
131#define BITMAP_MAGIC 0x6d746962
132
133/* use these for bitmap->flags and bitmap->sb->state bit-fields */
134enum bitmap_state {
135 BITMAP_ACTIVE = 0x001, /* the bitmap is in use */
136 BITMAP_STALE = 0x002 /* the bitmap file is out of date or had -EIO */
137};
138
139/* the superblock at the front of the bitmap file -- little endian */
140typedef struct bitmap_super_s {
141 __u32 magic; /* 0 BITMAP_MAGIC */
142 __u32 version; /* 4 the bitmap major for now, could change... */
143 __u8 uuid[16]; /* 8 128 bit uuid - must match md device uuid */
144 __u64 events; /* 24 event counter for the bitmap (1)*/
145 __u64 events_cleared;/*32 event counter when last bit cleared (2) */
146 __u64 sync_size; /* 40 the size of the md device's sync range(3) */
147 __u32 state; /* 48 bitmap state information */
148 __u32 chunksize; /* 52 the bitmap chunk size in bytes */
149 __u32 daemon_sleep; /* 56 seconds between disk flushes */
150
151 __u8 pad[256 - 60]; /* set to zero */
152} bitmap_super_t;
153
154/* notes:
155 * (1) This event counter is updated before the eventcounter in the md superblock
156 * When a bitmap is loaded, it is only accepted if this event counter is equal
157 * to, or one greater than, the event counter in the superblock.
158 * (2) This event counter is updated when the other one is *if*and*only*if* the
159 * array is not degraded. As bits are not cleared when the array is degraded,
160 * this represents the last time that any bits were cleared.
161 * If a device is being added that has an event count with this value or
162 * higher, it is accepted as conforming to the bitmap.
163 * (3)This is the number of sectors represented by the bitmap, and is the range that
164 * resync happens across. For raid1 and raid5/6 it is the size of individual
165 * devices. For raid10 it is the size of the array.
166 */
167
168#ifdef __KERNEL__
169
170/* the in-memory bitmap is represented by bitmap_pages */
171struct bitmap_page {
172 /*
173 * map points to the actual memory page
174 */
175 char *map;
176 /*
177 * in emergencies (when map cannot be alloced), hijack the map
178 * pointer and use it as two counters itself
179 */
180 unsigned int hijacked:1;
181 /*
182 * count of dirty bits on the page
183 */
184 unsigned int count:31;
185};
186
187/* keep track of bitmap file pages that have pending writes on them */
188struct page_list {
189 struct list_head list;
190 struct page *page;
191};
192
193/* the main bitmap structure - one per mddev */
194struct bitmap {
195 struct bitmap_page *bp;
196 unsigned long pages; /* total number of pages in the bitmap */
197 unsigned long missing_pages; /* number of pages not yet allocated */
198
199 mddev_t *mddev; /* the md device that the bitmap is for */
200
201 int counter_bits; /* how many bits per block counter */
202
203 /* bitmap chunksize -- how much data does each bit represent? */
204 unsigned long chunksize;
205 unsigned long chunkshift; /* chunksize = 2^chunkshift (for bitops) */
206 unsigned long chunks; /* total number of data chunks for the array */
207
208 /* We hold a count on the chunk currently being synced, and drop
209 * it when the last block is started. If the resync is aborted
210 * midway, we need to be able to drop that count, so we remember
211 * the counted chunk..
212 */
213 unsigned long syncchunk;
214
215 __u64 events_cleared;
216
217 /* bitmap spinlock */
218 spinlock_t lock;
219
220 long offset; /* offset from superblock if file is NULL */
221 struct file *file; /* backing disk file */
222 struct page *sb_page; /* cached copy of the bitmap file superblock */
223 struct page **filemap; /* list of cache pages for the file */
224 unsigned long *filemap_attr; /* attributes associated w/ filemap pages */
225 unsigned long file_pages; /* number of pages in the file */
226
227 unsigned long flags;
228
229 /*
230 * the bitmap daemon - periodically wakes up and sweeps the bitmap
231 * file, cleaning up bits and flushing out pages to disk as necessary
232 */
233 unsigned long daemon_lastrun; /* jiffies of last run */
234 unsigned long daemon_sleep; /* how many seconds between updates? */
235
236 /*
237 * bitmap_writeback_daemon waits for file-pages that have been written,
238 * as there is no way to get a call-back when a page write completes.
239 */
240 mdk_thread_t *writeback_daemon;
241 spinlock_t write_lock;
242 wait_queue_head_t write_wait;
243 struct list_head complete_pages;
244 mempool_t *write_pool;
245};
246
247/* the bitmap API */
248
249/* these are used only by md/bitmap */
250int bitmap_create(mddev_t *mddev);
251void bitmap_destroy(mddev_t *mddev);
252int bitmap_active(struct bitmap *bitmap);
253
254char *file_path(struct file *file, char *buf, int count);
255void bitmap_print_sb(struct bitmap *bitmap);
256int bitmap_update_sb(struct bitmap *bitmap);
257
258int bitmap_setallbits(struct bitmap *bitmap);
259void bitmap_write_all(struct bitmap *bitmap);
260
261/* these are exported */
262int bitmap_startwrite(struct bitmap *bitmap, sector_t offset, unsigned long sectors);
263void bitmap_endwrite(struct bitmap *bitmap, sector_t offset, unsigned long sectors,
264 int success);
265int bitmap_start_sync(struct bitmap *bitmap, sector_t offset, int *blocks);
266void bitmap_end_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int aborted);
267void bitmap_close_sync(struct bitmap *bitmap);
268
269int bitmap_unplug(struct bitmap *bitmap);
270int bitmap_daemon_work(struct bitmap *bitmap);
271#endif
272
273#endif
diff --git a/include/linux/raid/md.h b/include/linux/raid/md.h
index a6a67d102bfa..ffa316ce4dc8 100644
--- a/include/linux/raid/md.h
+++ b/include/linux/raid/md.h
@@ -60,7 +60,14 @@
60 */ 60 */
61#define MD_MAJOR_VERSION 0 61#define MD_MAJOR_VERSION 0
62#define MD_MINOR_VERSION 90 62#define MD_MINOR_VERSION 90
63#define MD_PATCHLEVEL_VERSION 1 63/*
64 * MD_PATCHLEVEL_VERSION indicates kernel functionality.
65 * >=1 means different superblock formats are selectable using SET_ARRAY_INFO
66 * and major_version/minor_version accordingly
67 * >=2 means that Internal bitmaps are supported by setting MD_SB_BITMAP_PRESENT
68 * in the super status byte
69 */
70#define MD_PATCHLEVEL_VERSION 2
64 71
65extern int register_md_personality (int p_num, mdk_personality_t *p); 72extern int register_md_personality (int p_num, mdk_personality_t *p);
66extern int unregister_md_personality (int p_num); 73extern int unregister_md_personality (int p_num);
@@ -69,7 +76,7 @@ extern mdk_thread_t * md_register_thread (void (*run) (mddev_t *mddev),
69extern void md_unregister_thread (mdk_thread_t *thread); 76extern void md_unregister_thread (mdk_thread_t *thread);
70extern void md_wakeup_thread(mdk_thread_t *thread); 77extern void md_wakeup_thread(mdk_thread_t *thread);
71extern void md_check_recovery(mddev_t *mddev); 78extern void md_check_recovery(mddev_t *mddev);
72extern void md_write_start(mddev_t *mddev); 79extern void md_write_start(mddev_t *mddev, struct bio *bi);
73extern void md_write_end(mddev_t *mddev); 80extern void md_write_end(mddev_t *mddev);
74extern void md_handle_safemode(mddev_t *mddev); 81extern void md_handle_safemode(mddev_t *mddev);
75extern void md_done_sync(mddev_t *mddev, int blocks, int ok); 82extern void md_done_sync(mddev_t *mddev, int blocks, int ok);
@@ -78,6 +85,12 @@ extern void md_unplug_mddev(mddev_t *mddev);
78 85
79extern void md_print_devices (void); 86extern void md_print_devices (void);
80 87
88extern void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev,
89 sector_t sector, int size, struct page *page);
90extern int sync_page_io(struct block_device *bdev, sector_t sector, int size,
91 struct page *page, int rw);
92
93
81#define MD_BUG(x...) { printk("md: bug in file %s, line %d\n", __FILE__, __LINE__); md_print_devices(); } 94#define MD_BUG(x...) { printk("md: bug in file %s, line %d\n", __FILE__, __LINE__); md_print_devices(); }
82 95
83#endif 96#endif
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
index c9a0d4013be7..8c14ba565a45 100644
--- a/include/linux/raid/md_k.h
+++ b/include/linux/raid/md_k.h
@@ -15,6 +15,9 @@
15#ifndef _MD_K_H 15#ifndef _MD_K_H
16#define _MD_K_H 16#define _MD_K_H
17 17
18/* and dm-bio-list.h is not under include/linux because.... ??? */
19#include "../../../drivers/md/dm-bio-list.h"
20
18#define MD_RESERVED 0UL 21#define MD_RESERVED 0UL
19#define LINEAR 1UL 22#define LINEAR 1UL
20#define RAID0 2UL 23#define RAID0 2UL
@@ -180,6 +183,10 @@ struct mdk_rdev_s
180 183
181 int desc_nr; /* descriptor index in the superblock */ 184 int desc_nr; /* descriptor index in the superblock */
182 int raid_disk; /* role of device in array */ 185 int raid_disk; /* role of device in array */
186 int saved_raid_disk; /* role that device used to have in the
187 * array and could again if we did a partial
188 * resync from the bitmap
189 */
183 190
184 atomic_t nr_pending; /* number of pending requests. 191 atomic_t nr_pending; /* number of pending requests.
185 * only maintained for arrays that 192 * only maintained for arrays that
@@ -252,6 +259,11 @@ struct mddev_s
252 atomic_t recovery_active; /* blocks scheduled, but not written */ 259 atomic_t recovery_active; /* blocks scheduled, but not written */
253 wait_queue_head_t recovery_wait; 260 wait_queue_head_t recovery_wait;
254 sector_t recovery_cp; 261 sector_t recovery_cp;
262
263 spinlock_t write_lock;
264 wait_queue_head_t sb_wait; /* for waiting on superblock updates */
265 atomic_t pending_writes; /* number of active superblock writes */
266
255 unsigned int safemode; /* if set, update "clean" superblock 267 unsigned int safemode; /* if set, update "clean" superblock
256 * when no writes pending. 268 * when no writes pending.
257 */ 269 */
@@ -260,6 +272,13 @@ struct mddev_s
260 atomic_t writes_pending; 272 atomic_t writes_pending;
261 request_queue_t *queue; /* for plugging ... */ 273 request_queue_t *queue; /* for plugging ... */
262 274
275 struct bitmap *bitmap; /* the bitmap for the device */
276 struct file *bitmap_file; /* the bitmap file */
277 long bitmap_offset; /* offset from superblock of
278 * start of bitmap. May be
279 * negative, but not '0'
280 */
281
263 struct list_head all_mddevs; 282 struct list_head all_mddevs;
264}; 283};
265 284
@@ -291,7 +310,7 @@ struct mdk_personality_s
291 int (*hot_add_disk) (mddev_t *mddev, mdk_rdev_t *rdev); 310 int (*hot_add_disk) (mddev_t *mddev, mdk_rdev_t *rdev);
292 int (*hot_remove_disk) (mddev_t *mddev, int number); 311 int (*hot_remove_disk) (mddev_t *mddev, int number);
293 int (*spare_active) (mddev_t *mddev); 312 int (*spare_active) (mddev_t *mddev);
294 int (*sync_request)(mddev_t *mddev, sector_t sector_nr, int go_faster); 313 sector_t (*sync_request)(mddev_t *mddev, sector_t sector_nr, int *skipped, int go_faster);
295 int (*resize) (mddev_t *mddev, sector_t sectors); 314 int (*resize) (mddev_t *mddev, sector_t sectors);
296 int (*reshape) (mddev_t *mddev, int raid_disks); 315 int (*reshape) (mddev_t *mddev, int raid_disks);
297 int (*reconfig) (mddev_t *mddev, int layout, int chunk_size); 316 int (*reconfig) (mddev_t *mddev, int layout, int chunk_size);
@@ -334,6 +353,7 @@ typedef struct mdk_thread_s {
334 unsigned long flags; 353 unsigned long flags;
335 struct completion *event; 354 struct completion *event;
336 struct task_struct *tsk; 355 struct task_struct *tsk;
356 unsigned long timeout;
337 const char *name; 357 const char *name;
338} mdk_thread_t; 358} mdk_thread_t;
339 359
diff --git a/include/linux/raid/md_p.h b/include/linux/raid/md_p.h
index 8ba95d67329f..dc65cd435494 100644
--- a/include/linux/raid/md_p.h
+++ b/include/linux/raid/md_p.h
@@ -96,6 +96,7 @@ typedef struct mdp_device_descriptor_s {
96#define MD_SB_CLEAN 0 96#define MD_SB_CLEAN 0
97#define MD_SB_ERRORS 1 97#define MD_SB_ERRORS 1
98 98
99#define MD_SB_BITMAP_PRESENT 8 /* bitmap may be present nearby */
99typedef struct mdp_superblock_s { 100typedef struct mdp_superblock_s {
100 /* 101 /*
101 * Constant generic information 102 * Constant generic information
@@ -184,7 +185,7 @@ struct mdp_superblock_1 {
184 /* constant array information - 128 bytes */ 185 /* constant array information - 128 bytes */
185 __u32 magic; /* MD_SB_MAGIC: 0xa92b4efc - little endian */ 186 __u32 magic; /* MD_SB_MAGIC: 0xa92b4efc - little endian */
186 __u32 major_version; /* 1 */ 187 __u32 major_version; /* 1 */
187 __u32 feature_map; /* 0 for now */ 188 __u32 feature_map; /* bit 0 set if 'bitmap_offset' is meaningful */
188 __u32 pad0; /* always set to 0 when writing */ 189 __u32 pad0; /* always set to 0 when writing */
189 190
190 __u8 set_uuid[16]; /* user-space generated. */ 191 __u8 set_uuid[16]; /* user-space generated. */
@@ -197,7 +198,11 @@ struct mdp_superblock_1 {
197 198
198 __u32 chunksize; /* in 512byte sectors */ 199 __u32 chunksize; /* in 512byte sectors */
199 __u32 raid_disks; 200 __u32 raid_disks;
200 __u8 pad1[128-96]; /* set to 0 when written */ 201 __u32 bitmap_offset; /* sectors after start of superblock that bitmap starts
202 * NOTE: signed, so bitmap can be before superblock
203 * only meaningful of feature_map[0] is set.
204 */
205 __u8 pad1[128-100]; /* set to 0 when written */
201 206
202 /* constant this-device information - 64 bytes */ 207 /* constant this-device information - 64 bytes */
203 __u64 data_offset; /* sector start of data, often 0 */ 208 __u64 data_offset; /* sector start of data, often 0 */
diff --git a/include/linux/raid/md_u.h b/include/linux/raid/md_u.h
index a2df5c2a42af..81da20ccec4d 100644
--- a/include/linux/raid/md_u.h
+++ b/include/linux/raid/md_u.h
@@ -23,6 +23,7 @@
23#define GET_DISK_INFO _IOR (MD_MAJOR, 0x12, mdu_disk_info_t) 23#define GET_DISK_INFO _IOR (MD_MAJOR, 0x12, mdu_disk_info_t)
24#define PRINT_RAID_DEBUG _IO (MD_MAJOR, 0x13) 24#define PRINT_RAID_DEBUG _IO (MD_MAJOR, 0x13)
25#define RAID_AUTORUN _IO (MD_MAJOR, 0x14) 25#define RAID_AUTORUN _IO (MD_MAJOR, 0x14)
26#define GET_BITMAP_FILE _IOR (MD_MAJOR, 0x15, mdu_bitmap_file_t)
26 27
27/* configuration */ 28/* configuration */
28#define CLEAR_ARRAY _IO (MD_MAJOR, 0x20) 29#define CLEAR_ARRAY _IO (MD_MAJOR, 0x20)
@@ -36,6 +37,7 @@
36#define HOT_ADD_DISK _IO (MD_MAJOR, 0x28) 37#define HOT_ADD_DISK _IO (MD_MAJOR, 0x28)
37#define SET_DISK_FAULTY _IO (MD_MAJOR, 0x29) 38#define SET_DISK_FAULTY _IO (MD_MAJOR, 0x29)
38#define HOT_GENERATE_ERROR _IO (MD_MAJOR, 0x2a) 39#define HOT_GENERATE_ERROR _IO (MD_MAJOR, 0x2a)
40#define SET_BITMAP_FILE _IOW (MD_MAJOR, 0x2b, int)
39 41
40/* usage */ 42/* usage */
41#define RUN_ARRAY _IOW (MD_MAJOR, 0x30, mdu_param_t) 43#define RUN_ARRAY _IOW (MD_MAJOR, 0x30, mdu_param_t)
@@ -106,6 +108,11 @@ typedef struct mdu_start_info_s {
106 108
107} mdu_start_info_t; 109} mdu_start_info_t;
108 110
111typedef struct mdu_bitmap_file_s
112{
113 char pathname[4096];
114} mdu_bitmap_file_t;
115
109typedef struct mdu_param_s 116typedef struct mdu_param_s
110{ 117{
111 int personality; /* 1,2,3,4 */ 118 int personality; /* 1,2,3,4 */
diff --git a/include/linux/raid/raid1.h b/include/linux/raid/raid1.h
index abbfdd9afe1e..9d93cf12e890 100644
--- a/include/linux/raid/raid1.h
+++ b/include/linux/raid/raid1.h
@@ -36,12 +36,21 @@ struct r1_private_data_s {
36 spinlock_t device_lock; 36 spinlock_t device_lock;
37 37
38 struct list_head retry_list; 38 struct list_head retry_list;
39 /* queue pending writes and submit them on unplug */
40 struct bio_list pending_bio_list;
41 /* queue of writes that have been unplugged */
42 struct bio_list flushing_bio_list;
43
39 /* for use when syncing mirrors: */ 44 /* for use when syncing mirrors: */
40 45
41 spinlock_t resync_lock; 46 spinlock_t resync_lock;
42 int nr_pending; 47 int nr_pending;
43 int barrier; 48 int barrier;
44 sector_t next_resync; 49 sector_t next_resync;
50 int fullsync; /* set to 1 if a full sync is needed,
51 * (fresh device added).
52 * Cleared when a sync completes.
53 */
45 54
46 wait_queue_head_t wait_idle; 55 wait_queue_head_t wait_idle;
47 wait_queue_head_t wait_resume; 56 wait_queue_head_t wait_resume;
@@ -85,14 +94,17 @@ struct r1bio_s {
85 int read_disk; 94 int read_disk;
86 95
87 struct list_head retry_list; 96 struct list_head retry_list;
97 struct bitmap_update *bitmap_update;
88 /* 98 /*
89 * if the IO is in WRITE direction, then multiple bios are used. 99 * if the IO is in WRITE direction, then multiple bios are used.
90 * We choose the number when they are allocated. 100 * We choose the number when they are allocated.
91 */ 101 */
92 struct bio *bios[0]; 102 struct bio *bios[0];
103 /* DO NOT PUT ANY NEW FIELDS HERE - bios array is contiguously alloced*/
93}; 104};
94 105
95/* bits for r1bio.state */ 106/* bits for r1bio.state */
96#define R1BIO_Uptodate 0 107#define R1BIO_Uptodate 0
97#define R1BIO_IsSync 1 108#define R1BIO_IsSync 1
109#define R1BIO_Degraded 2
98#endif 110#endif
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 4dbb109022f3..b58afd97a180 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -201,8 +201,8 @@ extern unsigned long
201arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr, 201arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr,
202 unsigned long len, unsigned long pgoff, 202 unsigned long len, unsigned long pgoff,
203 unsigned long flags); 203 unsigned long flags);
204extern void arch_unmap_area(struct vm_area_struct *area); 204extern void arch_unmap_area(struct mm_struct *, unsigned long);
205extern void arch_unmap_area_topdown(struct vm_area_struct *area); 205extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long);
206 206
207#define set_mm_counter(mm, member, value) (mm)->_##member = (value) 207#define set_mm_counter(mm, member, value) (mm)->_##member = (value)
208#define get_mm_counter(mm, member) ((mm)->_##member) 208#define get_mm_counter(mm, member) ((mm)->_##member)
@@ -218,9 +218,10 @@ struct mm_struct {
218 unsigned long (*get_unmapped_area) (struct file *filp, 218 unsigned long (*get_unmapped_area) (struct file *filp,
219 unsigned long addr, unsigned long len, 219 unsigned long addr, unsigned long len,
220 unsigned long pgoff, unsigned long flags); 220 unsigned long pgoff, unsigned long flags);
221 void (*unmap_area) (struct vm_area_struct *area); 221 void (*unmap_area) (struct mm_struct *mm, unsigned long addr);
222 unsigned long mmap_base; /* base of mmap area */ 222 unsigned long mmap_base; /* base of mmap area */
223 unsigned long free_area_cache; /* first hole */ 223 unsigned long cached_hole_size; /* if non-zero, the largest hole below free_area_cache */
224 unsigned long free_area_cache; /* first hole of size cached_hole_size or larger */
224 pgd_t * pgd; 225 pgd_t * pgd;
225 atomic_t mm_users; /* How many users with user space? */ 226 atomic_t mm_users; /* How many users with user space? */
226 atomic_t mm_count; /* How many references to "struct mm_struct" (users count as 1) */ 227 atomic_t mm_count; /* How many references to "struct mm_struct" (users count as 1) */
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index cc04f5cd2286..d7c839a21842 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -193,7 +193,6 @@ struct skb_shared_info {
193 * @nfcache: Cache info 193 * @nfcache: Cache info
194 * @nfct: Associated connection, if any 194 * @nfct: Associated connection, if any
195 * @nfctinfo: Relationship of this skb to the connection 195 * @nfctinfo: Relationship of this skb to the connection
196 * @nf_debug: Netfilter debugging
197 * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c 196 * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c
198 * @private: Data which is private to the HIPPI implementation 197 * @private: Data which is private to the HIPPI implementation
199 * @tc_index: Traffic control index 198 * @tc_index: Traffic control index
@@ -264,9 +263,6 @@ struct sk_buff {
264 __u32 nfcache; 263 __u32 nfcache;
265 __u32 nfctinfo; 264 __u32 nfctinfo;
266 struct nf_conntrack *nfct; 265 struct nf_conntrack *nfct;
267#ifdef CONFIG_NETFILTER_DEBUG
268 unsigned int nf_debug;
269#endif
270#ifdef CONFIG_BRIDGE_NETFILTER 266#ifdef CONFIG_BRIDGE_NETFILTER
271 struct nf_bridge_info *nf_bridge; 267 struct nf_bridge_info *nf_bridge;
272#endif 268#endif
@@ -1219,15 +1215,6 @@ static inline void nf_reset(struct sk_buff *skb)
1219{ 1215{
1220 nf_conntrack_put(skb->nfct); 1216 nf_conntrack_put(skb->nfct);
1221 skb->nfct = NULL; 1217 skb->nfct = NULL;
1222#ifdef CONFIG_NETFILTER_DEBUG
1223 skb->nf_debug = 0;
1224#endif
1225}
1226static inline void nf_reset_debug(struct sk_buff *skb)
1227{
1228#ifdef CONFIG_NETFILTER_DEBUG
1229 skb->nf_debug = 0;
1230#endif
1231} 1218}
1232 1219
1233#ifdef CONFIG_BRIDGE_NETFILTER 1220#ifdef CONFIG_BRIDGE_NETFILTER
diff --git a/include/linux/smp.h b/include/linux/smp.h
index dcf1db3b35d3..9dfa3ee769ae 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -92,10 +92,7 @@ void smp_prepare_boot_cpu(void);
92/* 92/*
93 * These macros fold the SMP functionality into a single CPU system 93 * These macros fold the SMP functionality into a single CPU system
94 */ 94 */
95 95#define raw_smp_processor_id() 0
96#if !defined(__smp_processor_id) || !defined(CONFIG_PREEMPT)
97# define smp_processor_id() 0
98#endif
99#define hard_smp_processor_id() 0 96#define hard_smp_processor_id() 0
100#define smp_call_function(func,info,retry,wait) ({ 0; }) 97#define smp_call_function(func,info,retry,wait) ({ 0; })
101#define on_each_cpu(func,info,retry,wait) ({ func(info); 0; }) 98#define on_each_cpu(func,info,retry,wait) ({ func(info); 0; })
@@ -106,30 +103,25 @@ static inline void smp_send_reschedule(int cpu) { }
106#endif /* !SMP */ 103#endif /* !SMP */
107 104
108/* 105/*
109 * DEBUG_PREEMPT support: check whether smp_processor_id() is being 106 * smp_processor_id(): get the current CPU ID.
110 * used in a preemption-safe way.
111 * 107 *
112 * An architecture has to enable this debugging code explicitly. 108 * if DEBUG_PREEMPT is enabled the we check whether it is
113 * It can do so by renaming the smp_processor_id() macro to 109 * used in a preemption-safe way. (smp_processor_id() is safe
114 * __smp_processor_id(). This should only be done after some minimal 110 * if it's used in a preemption-off critical section, or in
115 * testing, because usually there are a number of false positives 111 * a thread that is bound to the current CPU.)
116 * that an architecture will trigger.
117 * 112 *
118 * To fix a false positive (i.e. smp_processor_id() use that the 113 * NOTE: raw_smp_processor_id() is for internal use only
119 * debugging code reports but which use for some reason is legal), 114 * (smp_processor_id() is the preferred variant), but in rare
120 * change the smp_processor_id() reference to _smp_processor_id(), 115 * instances it might also be used to turn off false positives
121 * which is the nondebug variant. NOTE: don't use this to hack around 116 * (i.e. smp_processor_id() use that the debugging code reports but
122 * real bugs. 117 * which use for some reason is legal). Don't use this to hack around
118 * the warning message, as your code might not work under PREEMPT.
123 */ 119 */
124#ifdef __smp_processor_id 120#ifdef CONFIG_DEBUG_PREEMPT
125# if defined(CONFIG_PREEMPT) && defined(CONFIG_DEBUG_PREEMPT) 121 extern unsigned int debug_smp_processor_id(void);
126 extern unsigned int smp_processor_id(void); 122# define smp_processor_id() debug_smp_processor_id()
127# else
128# define smp_processor_id() __smp_processor_id()
129# endif
130# define _smp_processor_id() __smp_processor_id()
131#else 123#else
132# define _smp_processor_id() smp_processor_id() 124# define smp_processor_id() raw_smp_processor_id()
133#endif 125#endif
134 126
135#define get_cpu() ({ preempt_disable(); smp_processor_id(); }) 127#define get_cpu() ({ preempt_disable(); smp_processor_id(); })
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 3bbc41be9bd0..2343f999e6e1 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -172,7 +172,8 @@ extern int rotate_reclaimable_page(struct page *page);
172extern void swap_setup(void); 172extern void swap_setup(void);
173 173
174/* linux/mm/vmscan.c */ 174/* linux/mm/vmscan.c */
175extern int try_to_free_pages(struct zone **, unsigned int, unsigned int); 175extern int try_to_free_pages(struct zone **, unsigned int);
176extern int zone_reclaim(struct zone *, unsigned int, unsigned int);
176extern int shrink_all_memory(int); 177extern int shrink_all_memory(int);
177extern int vm_swappiness; 178extern int vm_swappiness;
178 179
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 319904518194..a66e9de16a6c 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -167,14 +167,17 @@ extern int fib6_walk_continue(struct fib6_walker_t *w);
167extern int fib6_add(struct fib6_node *root, 167extern int fib6_add(struct fib6_node *root,
168 struct rt6_info *rt, 168 struct rt6_info *rt,
169 struct nlmsghdr *nlh, 169 struct nlmsghdr *nlh,
170 void *rtattr); 170 void *rtattr,
171 struct netlink_skb_parms *req);
171 172
172extern int fib6_del(struct rt6_info *rt, 173extern int fib6_del(struct rt6_info *rt,
173 struct nlmsghdr *nlh, 174 struct nlmsghdr *nlh,
174 void *rtattr); 175 void *rtattr,
176 struct netlink_skb_parms *req);
175 177
176extern void inet6_rt_notify(int event, struct rt6_info *rt, 178extern void inet6_rt_notify(int event, struct rt6_info *rt,
177 struct nlmsghdr *nlh); 179 struct nlmsghdr *nlh,
180 struct netlink_skb_parms *req);
178 181
179extern void fib6_run_gc(unsigned long dummy); 182extern void fib6_run_gc(unsigned long dummy);
180 183
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index d5d1dd10cdb8..f920706d526b 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -41,13 +41,16 @@ extern int ipv6_route_ioctl(unsigned int cmd, void __user *arg);
41 41
42extern int ip6_route_add(struct in6_rtmsg *rtmsg, 42extern int ip6_route_add(struct in6_rtmsg *rtmsg,
43 struct nlmsghdr *, 43 struct nlmsghdr *,
44 void *rtattr); 44 void *rtattr,
45 struct netlink_skb_parms *req);
45extern int ip6_ins_rt(struct rt6_info *, 46extern int ip6_ins_rt(struct rt6_info *,
46 struct nlmsghdr *, 47 struct nlmsghdr *,
47 void *rtattr); 48 void *rtattr,
49 struct netlink_skb_parms *req);
48extern int ip6_del_rt(struct rt6_info *, 50extern int ip6_del_rt(struct rt6_info *,
49 struct nlmsghdr *, 51 struct nlmsghdr *,
50 void *rtattr); 52 void *rtattr,
53 struct netlink_skb_parms *req);
51 54
52extern int ip6_rt_addr_add(struct in6_addr *addr, 55extern int ip6_rt_addr_add(struct in6_addr *addr,
53 struct net_device *dev, 56 struct net_device *dev,
diff --git a/include/net/route.h b/include/net/route.h
index d34ca8fc6756..c3cd069a9aca 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -107,7 +107,7 @@ struct rt_cache_stat
107 107
108extern struct rt_cache_stat *rt_cache_stat; 108extern struct rt_cache_stat *rt_cache_stat;
109#define RT_CACHE_STAT_INC(field) \ 109#define RT_CACHE_STAT_INC(field) \
110 (per_cpu_ptr(rt_cache_stat, _smp_processor_id())->field++) 110 (per_cpu_ptr(rt_cache_stat, raw_smp_processor_id())->field++)
111 111
112extern struct ip_rt_acct *ip_rt_acct; 112extern struct ip_rt_acct *ip_rt_acct;
113 113
diff --git a/include/net/snmp.h b/include/net/snmp.h
index a15ab256276e..a36bed8ea210 100644
--- a/include/net/snmp.h
+++ b/include/net/snmp.h
@@ -128,18 +128,18 @@ struct linux_mib {
128#define SNMP_STAT_USRPTR(name) (name[1]) 128#define SNMP_STAT_USRPTR(name) (name[1])
129 129
130#define SNMP_INC_STATS_BH(mib, field) \ 130#define SNMP_INC_STATS_BH(mib, field) \
131 (per_cpu_ptr(mib[0], _smp_processor_id())->mibs[field]++) 131 (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field]++)
132#define SNMP_INC_STATS_OFFSET_BH(mib, field, offset) \ 132#define SNMP_INC_STATS_OFFSET_BH(mib, field, offset) \
133 (per_cpu_ptr(mib[0], _smp_processor_id())->mibs[field + (offset)]++) 133 (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field + (offset)]++)
134#define SNMP_INC_STATS_USER(mib, field) \ 134#define SNMP_INC_STATS_USER(mib, field) \
135 (per_cpu_ptr(mib[1], _smp_processor_id())->mibs[field]++) 135 (per_cpu_ptr(mib[1], raw_smp_processor_id())->mibs[field]++)
136#define SNMP_INC_STATS(mib, field) \ 136#define SNMP_INC_STATS(mib, field) \
137 (per_cpu_ptr(mib[!in_softirq()], _smp_processor_id())->mibs[field]++) 137 (per_cpu_ptr(mib[!in_softirq()], raw_smp_processor_id())->mibs[field]++)
138#define SNMP_DEC_STATS(mib, field) \ 138#define SNMP_DEC_STATS(mib, field) \
139 (per_cpu_ptr(mib[!in_softirq()], _smp_processor_id())->mibs[field]--) 139 (per_cpu_ptr(mib[!in_softirq()], raw_smp_processor_id())->mibs[field]--)
140#define SNMP_ADD_STATS_BH(mib, field, addend) \ 140#define SNMP_ADD_STATS_BH(mib, field, addend) \
141 (per_cpu_ptr(mib[0], _smp_processor_id())->mibs[field] += addend) 141 (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field] += addend)
142#define SNMP_ADD_STATS_USER(mib, field, addend) \ 142#define SNMP_ADD_STATS_USER(mib, field, addend) \
143 (per_cpu_ptr(mib[1], _smp_processor_id())->mibs[field] += addend) 143 (per_cpu_ptr(mib[1], raw_smp_processor_id())->mibs[field] += addend)
144 144
145#endif 145#endif
diff --git a/init/main.c b/init/main.c
index 40bf367ffdf1..d324801729ba 100644
--- a/init/main.c
+++ b/init/main.c
@@ -490,6 +490,7 @@ asmlinkage void __init start_kernel(void)
490 vfs_caches_init_early(); 490 vfs_caches_init_early();
491 mem_init(); 491 mem_init();
492 kmem_cache_init(); 492 kmem_cache_init();
493 setup_per_cpu_pageset();
493 numa_policy_init(); 494 numa_policy_init();
494 if (late_time_init) 495 if (late_time_init)
495 late_time_init(); 496 late_time_init();
diff --git a/kernel/fork.c b/kernel/fork.c
index f42a17f88699..a28d11e10877 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -194,6 +194,7 @@ static inline int dup_mmap(struct mm_struct * mm, struct mm_struct * oldmm)
194 mm->mmap = NULL; 194 mm->mmap = NULL;
195 mm->mmap_cache = NULL; 195 mm->mmap_cache = NULL;
196 mm->free_area_cache = oldmm->mmap_base; 196 mm->free_area_cache = oldmm->mmap_base;
197 mm->cached_hole_size = ~0UL;
197 mm->map_count = 0; 198 mm->map_count = 0;
198 set_mm_counter(mm, rss, 0); 199 set_mm_counter(mm, rss, 0);
199 set_mm_counter(mm, anon_rss, 0); 200 set_mm_counter(mm, anon_rss, 0);
@@ -249,8 +250,9 @@ static inline int dup_mmap(struct mm_struct * mm, struct mm_struct * oldmm)
249 250
250 /* 251 /*
251 * Link in the new vma and copy the page table entries: 252 * Link in the new vma and copy the page table entries:
252 * link in first so that swapoff can see swap entries, 253 * link in first so that swapoff can see swap entries.
253 * and try_to_unmap_one's find_vma find the new vma. 254 * Note that, exceptionally, here the vma is inserted
255 * without holding mm->mmap_sem.
254 */ 256 */
255 spin_lock(&mm->page_table_lock); 257 spin_lock(&mm->page_table_lock);
256 *pprev = tmp; 258 *pprev = tmp;
@@ -322,6 +324,7 @@ static struct mm_struct * mm_init(struct mm_struct * mm)
322 mm->ioctx_list = NULL; 324 mm->ioctx_list = NULL;
323 mm->default_kioctx = (struct kioctx)INIT_KIOCTX(mm->default_kioctx, *mm); 325 mm->default_kioctx = (struct kioctx)INIT_KIOCTX(mm->default_kioctx, *mm);
324 mm->free_area_cache = TASK_UNMAPPED_BASE; 326 mm->free_area_cache = TASK_UNMAPPED_BASE;
327 mm->cached_hole_size = ~0UL;
325 328
326 if (likely(!mm_alloc_pgd(mm))) { 329 if (likely(!mm_alloc_pgd(mm))) {
327 mm->def_flags = 0; 330 mm->def_flags = 0;
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 5202e4c4a5b6..ac6700985705 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -6,6 +6,7 @@
6 * This file contains driver APIs to the irq subsystem. 6 * This file contains driver APIs to the irq subsystem.
7 */ 7 */
8 8
9#include <linux/config.h>
9#include <linux/irq.h> 10#include <linux/irq.h>
10#include <linux/module.h> 11#include <linux/module.h>
11#include <linux/random.h> 12#include <linux/random.h>
@@ -255,6 +256,13 @@ void free_irq(unsigned int irq, void *dev_id)
255 256
256 /* Found it - now remove it from the list of entries */ 257 /* Found it - now remove it from the list of entries */
257 *pp = action->next; 258 *pp = action->next;
259
260 /* Currently used only by UML, might disappear one day.*/
261#ifdef CONFIG_IRQ_RELEASE_METHOD
262 if (desc->handler->release)
263 desc->handler->release(irq, dev_id);
264#endif
265
258 if (!desc->action) { 266 if (!desc->action) {
259 desc->status |= IRQ_DISABLED; 267 desc->status |= IRQ_DISABLED;
260 if (desc->handler->shutdown) 268 if (desc->handler->shutdown)
diff --git a/kernel/module.c b/kernel/module.c
index 83b3d376708c..a566745dde62 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -379,7 +379,7 @@ static void module_unload_init(struct module *mod)
379 for (i = 0; i < NR_CPUS; i++) 379 for (i = 0; i < NR_CPUS; i++)
380 local_set(&mod->ref[i].count, 0); 380 local_set(&mod->ref[i].count, 0);
381 /* Hold reference count during initialization. */ 381 /* Hold reference count during initialization. */
382 local_set(&mod->ref[_smp_processor_id()].count, 1); 382 local_set(&mod->ref[raw_smp_processor_id()].count, 1);
383 /* Backwards compatibility macros put refcount during init. */ 383 /* Backwards compatibility macros put refcount during init. */
384 mod->waiter = current; 384 mod->waiter = current;
385} 385}
diff --git a/kernel/power/smp.c b/kernel/power/smp.c
index cba3584b80fe..457c2302ed42 100644
--- a/kernel/power/smp.c
+++ b/kernel/power/smp.c
@@ -48,11 +48,11 @@ void disable_nonboot_cpus(void)
48{ 48{
49 oldmask = current->cpus_allowed; 49 oldmask = current->cpus_allowed;
50 set_cpus_allowed(current, cpumask_of_cpu(0)); 50 set_cpus_allowed(current, cpumask_of_cpu(0));
51 printk("Freezing CPUs (at %d)", _smp_processor_id()); 51 printk("Freezing CPUs (at %d)", raw_smp_processor_id());
52 current->state = TASK_INTERRUPTIBLE; 52 current->state = TASK_INTERRUPTIBLE;
53 schedule_timeout(HZ); 53 schedule_timeout(HZ);
54 printk("..."); 54 printk("...");
55 BUG_ON(_smp_processor_id() != 0); 55 BUG_ON(raw_smp_processor_id() != 0);
56 56
57 /* FIXME: for this to work, all the CPUs must be running 57 /* FIXME: for this to work, all the CPUs must be running
58 * "idle" thread (or we deadlock). Is that guaranteed? */ 58 * "idle" thread (or we deadlock). Is that guaranteed? */
diff --git a/kernel/sched.c b/kernel/sched.c
index f12a0c8a7d98..deca041fc364 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -3814,7 +3814,7 @@ EXPORT_SYMBOL(yield);
3814 */ 3814 */
3815void __sched io_schedule(void) 3815void __sched io_schedule(void)
3816{ 3816{
3817 struct runqueue *rq = &per_cpu(runqueues, _smp_processor_id()); 3817 struct runqueue *rq = &per_cpu(runqueues, raw_smp_processor_id());
3818 3818
3819 atomic_inc(&rq->nr_iowait); 3819 atomic_inc(&rq->nr_iowait);
3820 schedule(); 3820 schedule();
@@ -3825,7 +3825,7 @@ EXPORT_SYMBOL(io_schedule);
3825 3825
3826long __sched io_schedule_timeout(long timeout) 3826long __sched io_schedule_timeout(long timeout)
3827{ 3827{
3828 struct runqueue *rq = &per_cpu(runqueues, _smp_processor_id()); 3828 struct runqueue *rq = &per_cpu(runqueues, raw_smp_processor_id());
3829 long ret; 3829 long ret;
3830 3830
3831 atomic_inc(&rq->nr_iowait); 3831 atomic_inc(&rq->nr_iowait);
diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c
index 6116b25aa7cf..84a9d18aa8da 100644
--- a/kernel/stop_machine.c
+++ b/kernel/stop_machine.c
@@ -100,7 +100,7 @@ static int stop_machine(void)
100 stopmachine_state = STOPMACHINE_WAIT; 100 stopmachine_state = STOPMACHINE_WAIT;
101 101
102 for_each_online_cpu(i) { 102 for_each_online_cpu(i) {
103 if (i == _smp_processor_id()) 103 if (i == raw_smp_processor_id())
104 continue; 104 continue;
105 ret = kernel_thread(stopmachine, (void *)(long)i,CLONE_KERNEL); 105 ret = kernel_thread(stopmachine, (void *)(long)i,CLONE_KERNEL);
106 if (ret < 0) 106 if (ret < 0)
@@ -182,7 +182,7 @@ struct task_struct *__stop_machine_run(int (*fn)(void *), void *data,
182 182
183 /* If they don't care which CPU fn runs on, bind to any online one. */ 183 /* If they don't care which CPU fn runs on, bind to any online one. */
184 if (cpu == NR_CPUS) 184 if (cpu == NR_CPUS)
185 cpu = _smp_processor_id(); 185 cpu = raw_smp_processor_id();
186 186
187 p = kthread_create(do_stop, &smdata, "kstopmachine"); 187 p = kthread_create(do_stop, &smdata, "kstopmachine");
188 if (!IS_ERR(p)) { 188 if (!IS_ERR(p)) {
diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c
index 0dda70ed1f98..6f15bea7d1a8 100644
--- a/kernel/sys_ni.c
+++ b/kernel/sys_ni.c
@@ -77,6 +77,7 @@ cond_syscall(sys_request_key);
77cond_syscall(sys_keyctl); 77cond_syscall(sys_keyctl);
78cond_syscall(compat_sys_keyctl); 78cond_syscall(compat_sys_keyctl);
79cond_syscall(compat_sys_socketcall); 79cond_syscall(compat_sys_socketcall);
80cond_syscall(sys_set_zone_reclaim);
80 81
81/* arch-specific weak syscall entries */ 82/* arch-specific weak syscall entries */
82cond_syscall(sys_pciconfig_read); 83cond_syscall(sys_pciconfig_read);
diff --git a/lib/Kconfig b/lib/Kconfig
index eeb45225248f..2d4d4e3bc4aa 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -40,6 +40,12 @@ config ZLIB_DEFLATE
40 tristate 40 tristate
41 41
42# 42#
43# Generic allocator support is selected if needed
44#
45config GENERIC_ALLOCATOR
46 boolean
47
48#
43# reed solomon support is select'ed if needed 49# reed solomon support is select'ed if needed
44# 50#
45config REED_SOLOMON 51config REED_SOLOMON
diff --git a/lib/Makefile b/lib/Makefile
index 9eccea9429a7..dcb4231916e2 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -20,6 +20,7 @@ lib-$(CONFIG_RWSEM_GENERIC_SPINLOCK) += rwsem-spinlock.o
20lib-$(CONFIG_RWSEM_XCHGADD_ALGORITHM) += rwsem.o 20lib-$(CONFIG_RWSEM_XCHGADD_ALGORITHM) += rwsem.o
21lib-$(CONFIG_GENERIC_FIND_NEXT_BIT) += find_next_bit.o 21lib-$(CONFIG_GENERIC_FIND_NEXT_BIT) += find_next_bit.o
22obj-$(CONFIG_LOCK_KERNEL) += kernel_lock.o 22obj-$(CONFIG_LOCK_KERNEL) += kernel_lock.o
23obj-$(CONFIG_DEBUG_PREEMPT) += smp_processor_id.o
23 24
24ifneq ($(CONFIG_HAVE_DEC_LOCK),y) 25ifneq ($(CONFIG_HAVE_DEC_LOCK),y)
25 lib-y += dec_and_lock.o 26 lib-y += dec_and_lock.o
@@ -29,6 +30,7 @@ obj-$(CONFIG_CRC_CCITT) += crc-ccitt.o
29obj-$(CONFIG_CRC32) += crc32.o 30obj-$(CONFIG_CRC32) += crc32.o
30obj-$(CONFIG_LIBCRC32C) += libcrc32c.o 31obj-$(CONFIG_LIBCRC32C) += libcrc32c.o
31obj-$(CONFIG_GENERIC_IOMAP) += iomap.o 32obj-$(CONFIG_GENERIC_IOMAP) += iomap.o
33obj-$(CONFIG_GENERIC_ALLOCATOR) += genalloc.o
32 34
33obj-$(CONFIG_ZLIB_INFLATE) += zlib_inflate/ 35obj-$(CONFIG_ZLIB_INFLATE) += zlib_inflate/
34obj-$(CONFIG_ZLIB_DEFLATE) += zlib_deflate/ 36obj-$(CONFIG_ZLIB_DEFLATE) += zlib_deflate/
diff --git a/lib/genalloc.c b/lib/genalloc.c
new file mode 100644
index 000000000000..d6d30d2e7166
--- /dev/null
+++ b/lib/genalloc.c
@@ -0,0 +1,188 @@
1/*
2 * Basic general purpose allocator for managing special purpose memory
3 * not managed by the regular kmalloc/kfree interface.
4 * Uses for this includes on-device special memory, uncached memory
5 * etc.
6 *
7 * This code is based on the buddy allocator found in the sym53c8xx_2
8 * driver Copyright (C) 1999-2001 Gerard Roudier <groudier@free.fr>,
9 * and adapted for general purpose use.
10 *
11 * Copyright 2005 (C) Jes Sorensen <jes@trained-monkey.org>
12 *
13 * This source code is licensed under the GNU General Public License,
14 * Version 2. See the file COPYING for more details.
15 */
16
17#include <linux/module.h>
18#include <linux/stddef.h>
19#include <linux/kernel.h>
20#include <linux/string.h>
21#include <linux/slab.h>
22#include <linux/init.h>
23#include <linux/mm.h>
24#include <linux/spinlock.h>
25#include <linux/genalloc.h>
26
27#include <asm/page.h>
28
29
30struct gen_pool *gen_pool_create(int nr_chunks, int max_chunk_shift,
31 unsigned long (*fp)(struct gen_pool *),
32 unsigned long data)
33{
34 struct gen_pool *poolp;
35 unsigned long tmp;
36 int i;
37
38 /*
39 * This is really an arbitrary limit, +10 is enough for
40 * IA64_GRANULE_SHIFT, aka 16MB. If anyone needs a large limit
41 * this can be increased without problems.
42 */
43 if ((max_chunk_shift > (PAGE_SHIFT + 10)) ||
44 ((max_chunk_shift < ALLOC_MIN_SHIFT) && max_chunk_shift))
45 return NULL;
46
47 if (!max_chunk_shift)
48 max_chunk_shift = PAGE_SHIFT;
49
50 poolp = kmalloc(sizeof(struct gen_pool), GFP_KERNEL);
51 if (!poolp)
52 return NULL;
53 memset(poolp, 0, sizeof(struct gen_pool));
54 poolp->h = kmalloc(sizeof(struct gen_pool_link) *
55 (max_chunk_shift - ALLOC_MIN_SHIFT + 1),
56 GFP_KERNEL);
57 if (!poolp->h) {
58 printk(KERN_WARNING "gen_pool_alloc() failed to allocate\n");
59 kfree(poolp);
60 return NULL;
61 }
62 memset(poolp->h, 0, sizeof(struct gen_pool_link) *
63 (max_chunk_shift - ALLOC_MIN_SHIFT + 1));
64
65 spin_lock_init(&poolp->lock);
66 poolp->get_new_chunk = fp;
67 poolp->max_chunk_shift = max_chunk_shift;
68 poolp->private = data;
69
70 for (i = 0; i < nr_chunks; i++) {
71 tmp = poolp->get_new_chunk(poolp);
72 printk(KERN_INFO "allocated %lx\n", tmp);
73 if (!tmp)
74 break;
75 gen_pool_free(poolp, tmp, (1 << poolp->max_chunk_shift));
76 }
77
78 return poolp;
79}
80EXPORT_SYMBOL(gen_pool_create);
81
82
83/*
84 * Simple power of two buddy-like generic allocator.
85 * Provides naturally aligned memory chunks.
86 */
87unsigned long gen_pool_alloc(struct gen_pool *poolp, int size)
88{
89 int j, i, s, max_chunk_size;
90 unsigned long a, flags;
91 struct gen_pool_link *h = poolp->h;
92
93 max_chunk_size = 1 << poolp->max_chunk_shift;
94
95 if (size > max_chunk_size)
96 return 0;
97
98 i = 0;
99
100 size = max(size, 1 << ALLOC_MIN_SHIFT);
101 s = roundup_pow_of_two(size);
102
103 j = i;
104
105 spin_lock_irqsave(&poolp->lock, flags);
106 while (!h[j].next) {
107 if (s == max_chunk_size) {
108 struct gen_pool_link *ptr;
109 spin_unlock_irqrestore(&poolp->lock, flags);
110 ptr = (struct gen_pool_link *)poolp->get_new_chunk(poolp);
111 spin_lock_irqsave(&poolp->lock, flags);
112 h[j].next = ptr;
113 if (h[j].next)
114 h[j].next->next = NULL;
115 break;
116 }
117 j++;
118 s <<= 1;
119 }
120 a = (unsigned long) h[j].next;
121 if (a) {
122 h[j].next = h[j].next->next;
123 /*
124 * This should be split into a seperate function doing
125 * the chunk split in order to support custom
126 * handling memory not physically accessible by host
127 */
128 while (j > i) {
129 j -= 1;
130 s >>= 1;
131 h[j].next = (struct gen_pool_link *) (a + s);
132 h[j].next->next = NULL;
133 }
134 }
135 spin_unlock_irqrestore(&poolp->lock, flags);
136 return a;
137}
138EXPORT_SYMBOL(gen_pool_alloc);
139
140
141/*
142 * Counter-part of the generic allocator.
143 */
144void gen_pool_free(struct gen_pool *poolp, unsigned long ptr, int size)
145{
146 struct gen_pool_link *q;
147 struct gen_pool_link *h = poolp->h;
148 unsigned long a, b, flags;
149 int i, s, max_chunk_size;
150
151 max_chunk_size = 1 << poolp->max_chunk_shift;
152
153 if (size > max_chunk_size)
154 return;
155
156 i = 0;
157
158 size = max(size, 1 << ALLOC_MIN_SHIFT);
159 s = roundup_pow_of_two(size);
160
161 a = ptr;
162
163 spin_lock_irqsave(&poolp->lock, flags);
164 while (1) {
165 if (s == max_chunk_size) {
166 ((struct gen_pool_link *)a)->next = h[i].next;
167 h[i].next = (struct gen_pool_link *)a;
168 break;
169 }
170 b = a ^ s;
171 q = &h[i];
172
173 while (q->next && q->next != (struct gen_pool_link *)b)
174 q = q->next;
175
176 if (!q->next) {
177 ((struct gen_pool_link *)a)->next = h[i].next;
178 h[i].next = (struct gen_pool_link *)a;
179 break;
180 }
181 q->next = q->next->next;
182 a = a & b;
183 s <<= 1;
184 i++;
185 }
186 spin_unlock_irqrestore(&poolp->lock, flags);
187}
188EXPORT_SYMBOL(gen_pool_free);
diff --git a/lib/idr.c b/lib/idr.c
index 81fc430602ee..c5be889de449 100644
--- a/lib/idr.c
+++ b/lib/idr.c
@@ -175,7 +175,7 @@ build_up:
175 * Add a new layer to the top of the tree if the requested 175 * Add a new layer to the top of the tree if the requested
176 * id is larger than the currently allocated space. 176 * id is larger than the currently allocated space.
177 */ 177 */
178 while ((layers < MAX_LEVEL) && (id >= (1 << (layers*IDR_BITS)))) { 178 while ((layers < (MAX_LEVEL - 1)) && (id >= (1 << (layers*IDR_BITS)))) {
179 layers++; 179 layers++;
180 if (!p->count) 180 if (!p->count)
181 continue; 181 continue;
diff --git a/lib/kernel_lock.c b/lib/kernel_lock.c
index 99b0ae3d51dd..bd2bc5d887b8 100644
--- a/lib/kernel_lock.c
+++ b/lib/kernel_lock.c
@@ -9,61 +9,6 @@
9#include <linux/module.h> 9#include <linux/module.h>
10#include <linux/kallsyms.h> 10#include <linux/kallsyms.h>
11 11
12#if defined(CONFIG_PREEMPT) && defined(__smp_processor_id) && \
13 defined(CONFIG_DEBUG_PREEMPT)
14
15/*
16 * Debugging check.
17 */
18unsigned int smp_processor_id(void)
19{
20 unsigned long preempt_count = preempt_count();
21 int this_cpu = __smp_processor_id();
22 cpumask_t this_mask;
23
24 if (likely(preempt_count))
25 goto out;
26
27 if (irqs_disabled())
28 goto out;
29
30 /*
31 * Kernel threads bound to a single CPU can safely use
32 * smp_processor_id():
33 */
34 this_mask = cpumask_of_cpu(this_cpu);
35
36 if (cpus_equal(current->cpus_allowed, this_mask))
37 goto out;
38
39 /*
40 * It is valid to assume CPU-locality during early bootup:
41 */
42 if (system_state != SYSTEM_RUNNING)
43 goto out;
44
45 /*
46 * Avoid recursion:
47 */
48 preempt_disable();
49
50 if (!printk_ratelimit())
51 goto out_enable;
52
53 printk(KERN_ERR "BUG: using smp_processor_id() in preemptible [%08x] code: %s/%d\n", preempt_count(), current->comm, current->pid);
54 print_symbol("caller is %s\n", (long)__builtin_return_address(0));
55 dump_stack();
56
57out_enable:
58 preempt_enable_no_resched();
59out:
60 return this_cpu;
61}
62
63EXPORT_SYMBOL(smp_processor_id);
64
65#endif /* PREEMPT && __smp_processor_id && DEBUG_PREEMPT */
66
67#ifdef CONFIG_PREEMPT_BKL 12#ifdef CONFIG_PREEMPT_BKL
68/* 13/*
69 * The 'big kernel semaphore' 14 * The 'big kernel semaphore'
diff --git a/lib/smp_processor_id.c b/lib/smp_processor_id.c
new file mode 100644
index 000000000000..42c08ef828c5
--- /dev/null
+++ b/lib/smp_processor_id.c
@@ -0,0 +1,55 @@
1/*
2 * lib/smp_processor_id.c
3 *
4 * DEBUG_PREEMPT variant of smp_processor_id().
5 */
6#include <linux/module.h>
7#include <linux/kallsyms.h>
8
9unsigned int debug_smp_processor_id(void)
10{
11 unsigned long preempt_count = preempt_count();
12 int this_cpu = raw_smp_processor_id();
13 cpumask_t this_mask;
14
15 if (likely(preempt_count))
16 goto out;
17
18 if (irqs_disabled())
19 goto out;
20
21 /*
22 * Kernel threads bound to a single CPU can safely use
23 * smp_processor_id():
24 */
25 this_mask = cpumask_of_cpu(this_cpu);
26
27 if (cpus_equal(current->cpus_allowed, this_mask))
28 goto out;
29
30 /*
31 * It is valid to assume CPU-locality during early bootup:
32 */
33 if (system_state != SYSTEM_RUNNING)
34 goto out;
35
36 /*
37 * Avoid recursion:
38 */
39 preempt_disable();
40
41 if (!printk_ratelimit())
42 goto out_enable;
43
44 printk(KERN_ERR "BUG: using smp_processor_id() in preemptible [%08x] code: %s/%d\n", preempt_count(), current->comm, current->pid);
45 print_symbol("caller is %s\n", (long)__builtin_return_address(0));
46 dump_stack();
47
48out_enable:
49 preempt_enable_no_resched();
50out:
51 return this_cpu;
52}
53
54EXPORT_SYMBOL(debug_smp_processor_id);
55
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 4eb5ae3fbe10..fbd1111ea119 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -7,10 +7,14 @@
7#include <linux/init.h> 7#include <linux/init.h>
8#include <linux/module.h> 8#include <linux/module.h>
9#include <linux/mm.h> 9#include <linux/mm.h>
10#include <linux/hugetlb.h>
11#include <linux/sysctl.h> 10#include <linux/sysctl.h>
12#include <linux/highmem.h> 11#include <linux/highmem.h>
13#include <linux/nodemask.h> 12#include <linux/nodemask.h>
13#include <linux/pagemap.h>
14#include <asm/page.h>
15#include <asm/pgtable.h>
16
17#include <linux/hugetlb.h>
14 18
15const unsigned long hugetlb_zero = 0, hugetlb_infinity = ~0UL; 19const unsigned long hugetlb_zero = 0, hugetlb_infinity = ~0UL;
16static unsigned long nr_huge_pages, free_huge_pages; 20static unsigned long nr_huge_pages, free_huge_pages;
@@ -249,6 +253,72 @@ struct vm_operations_struct hugetlb_vm_ops = {
249 .nopage = hugetlb_nopage, 253 .nopage = hugetlb_nopage,
250}; 254};
251 255
256static pte_t make_huge_pte(struct vm_area_struct *vma, struct page *page)
257{
258 pte_t entry;
259
260 if (vma->vm_flags & VM_WRITE) {
261 entry =
262 pte_mkwrite(pte_mkdirty(mk_pte(page, vma->vm_page_prot)));
263 } else {
264 entry = pte_wrprotect(mk_pte(page, vma->vm_page_prot));
265 }
266 entry = pte_mkyoung(entry);
267 entry = pte_mkhuge(entry);
268
269 return entry;
270}
271
272int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src,
273 struct vm_area_struct *vma)
274{
275 pte_t *src_pte, *dst_pte, entry;
276 struct page *ptepage;
277 unsigned long addr = vma->vm_start;
278 unsigned long end = vma->vm_end;
279
280 while (addr < end) {
281 dst_pte = huge_pte_alloc(dst, addr);
282 if (!dst_pte)
283 goto nomem;
284 src_pte = huge_pte_offset(src, addr);
285 BUG_ON(!src_pte || pte_none(*src_pte)); /* prefaulted */
286 entry = *src_pte;
287 ptepage = pte_page(entry);
288 get_page(ptepage);
289 add_mm_counter(dst, rss, HPAGE_SIZE / PAGE_SIZE);
290 set_huge_pte_at(dst, addr, dst_pte, entry);
291 addr += HPAGE_SIZE;
292 }
293 return 0;
294
295nomem:
296 return -ENOMEM;
297}
298
299void unmap_hugepage_range(struct vm_area_struct *vma, unsigned long start,
300 unsigned long end)
301{
302 struct mm_struct *mm = vma->vm_mm;
303 unsigned long address;
304 pte_t pte;
305 struct page *page;
306
307 WARN_ON(!is_vm_hugetlb_page(vma));
308 BUG_ON(start & ~HPAGE_MASK);
309 BUG_ON(end & ~HPAGE_MASK);
310
311 for (address = start; address < end; address += HPAGE_SIZE) {
312 pte = huge_ptep_get_and_clear(mm, address, huge_pte_offset(mm, address));
313 if (pte_none(pte))
314 continue;
315 page = pte_page(pte);
316 put_page(page);
317 }
318 add_mm_counter(mm, rss, -((end - start) >> PAGE_SHIFT));
319 flush_tlb_range(vma, start, end);
320}
321
252void zap_hugepage_range(struct vm_area_struct *vma, 322void zap_hugepage_range(struct vm_area_struct *vma,
253 unsigned long start, unsigned long length) 323 unsigned long start, unsigned long length)
254{ 324{
@@ -258,3 +328,108 @@ void zap_hugepage_range(struct vm_area_struct *vma,
258 unmap_hugepage_range(vma, start, start + length); 328 unmap_hugepage_range(vma, start, start + length);
259 spin_unlock(&mm->page_table_lock); 329 spin_unlock(&mm->page_table_lock);
260} 330}
331
332int hugetlb_prefault(struct address_space *mapping, struct vm_area_struct *vma)
333{
334 struct mm_struct *mm = current->mm;
335 unsigned long addr;
336 int ret = 0;
337
338 WARN_ON(!is_vm_hugetlb_page(vma));
339 BUG_ON(vma->vm_start & ~HPAGE_MASK);
340 BUG_ON(vma->vm_end & ~HPAGE_MASK);
341
342 hugetlb_prefault_arch_hook(mm);
343
344 spin_lock(&mm->page_table_lock);
345 for (addr = vma->vm_start; addr < vma->vm_end; addr += HPAGE_SIZE) {
346 unsigned long idx;
347 pte_t *pte = huge_pte_alloc(mm, addr);
348 struct page *page;
349
350 if (!pte) {
351 ret = -ENOMEM;
352 goto out;
353 }
354 if (! pte_none(*pte))
355 hugetlb_clean_stale_pgtable(pte);
356
357 idx = ((addr - vma->vm_start) >> HPAGE_SHIFT)
358 + (vma->vm_pgoff >> (HPAGE_SHIFT - PAGE_SHIFT));
359 page = find_get_page(mapping, idx);
360 if (!page) {
361 /* charge the fs quota first */
362 if (hugetlb_get_quota(mapping)) {
363 ret = -ENOMEM;
364 goto out;
365 }
366 page = alloc_huge_page();
367 if (!page) {
368 hugetlb_put_quota(mapping);
369 ret = -ENOMEM;
370 goto out;
371 }
372 ret = add_to_page_cache(page, mapping, idx, GFP_ATOMIC);
373 if (! ret) {
374 unlock_page(page);
375 } else {
376 hugetlb_put_quota(mapping);
377 free_huge_page(page);
378 goto out;
379 }
380 }
381 add_mm_counter(mm, rss, HPAGE_SIZE / PAGE_SIZE);
382 set_huge_pte_at(mm, addr, pte, make_huge_pte(vma, page));
383 }
384out:
385 spin_unlock(&mm->page_table_lock);
386 return ret;
387}
388
389int follow_hugetlb_page(struct mm_struct *mm, struct vm_area_struct *vma,
390 struct page **pages, struct vm_area_struct **vmas,
391 unsigned long *position, int *length, int i)
392{
393 unsigned long vpfn, vaddr = *position;
394 int remainder = *length;
395
396 BUG_ON(!is_vm_hugetlb_page(vma));
397
398 vpfn = vaddr/PAGE_SIZE;
399 while (vaddr < vma->vm_end && remainder) {
400
401 if (pages) {
402 pte_t *pte;
403 struct page *page;
404
405 /* Some archs (sparc64, sh*) have multiple
406 * pte_ts to each hugepage. We have to make
407 * sure we get the first, for the page
408 * indexing below to work. */
409 pte = huge_pte_offset(mm, vaddr & HPAGE_MASK);
410
411 /* hugetlb should be locked, and hence, prefaulted */
412 WARN_ON(!pte || pte_none(*pte));
413
414 page = &pte_page(*pte)[vpfn % (HPAGE_SIZE/PAGE_SIZE)];
415
416 WARN_ON(!PageCompound(page));
417
418 get_page(page);
419 pages[i] = page;
420 }
421
422 if (vmas)
423 vmas[i] = vma;
424
425 vaddr += PAGE_SIZE;
426 ++vpfn;
427 --remainder;
428 ++i;
429 }
430
431 *length = remainder;
432 *position = vaddr;
433
434 return i;
435}
diff --git a/mm/madvise.c b/mm/madvise.c
index 944b5e52d812..e3108054733c 100644
--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -8,17 +8,47 @@
8#include <linux/mman.h> 8#include <linux/mman.h>
9#include <linux/pagemap.h> 9#include <linux/pagemap.h>
10#include <linux/syscalls.h> 10#include <linux/syscalls.h>
11#include <linux/mempolicy.h>
11#include <linux/hugetlb.h> 12#include <linux/hugetlb.h>
12 13
13/* 14/*
14 * We can potentially split a vm area into separate 15 * We can potentially split a vm area into separate
15 * areas, each area with its own behavior. 16 * areas, each area with its own behavior.
16 */ 17 */
17static long madvise_behavior(struct vm_area_struct * vma, unsigned long start, 18static long madvise_behavior(struct vm_area_struct * vma,
18 unsigned long end, int behavior) 19 struct vm_area_struct **prev,
20 unsigned long start, unsigned long end, int behavior)
19{ 21{
20 struct mm_struct * mm = vma->vm_mm; 22 struct mm_struct * mm = vma->vm_mm;
21 int error = 0; 23 int error = 0;
24 pgoff_t pgoff;
25 int new_flags = vma->vm_flags & ~VM_READHINTMASK;
26
27 switch (behavior) {
28 case MADV_SEQUENTIAL:
29 new_flags |= VM_SEQ_READ;
30 break;
31 case MADV_RANDOM:
32 new_flags |= VM_RAND_READ;
33 break;
34 default:
35 break;
36 }
37
38 if (new_flags == vma->vm_flags) {
39 *prev = vma;
40 goto success;
41 }
42
43 pgoff = vma->vm_pgoff + ((start - vma->vm_start) >> PAGE_SHIFT);
44 *prev = vma_merge(mm, *prev, start, end, new_flags, vma->anon_vma,
45 vma->vm_file, pgoff, vma_policy(vma));
46 if (*prev) {
47 vma = *prev;
48 goto success;
49 }
50
51 *prev = vma;
22 52
23 if (start != vma->vm_start) { 53 if (start != vma->vm_start) {
24 error = split_vma(mm, vma, start, 1); 54 error = split_vma(mm, vma, start, 1);
@@ -36,21 +66,12 @@ static long madvise_behavior(struct vm_area_struct * vma, unsigned long start,
36 * vm_flags is protected by the mmap_sem held in write mode. 66 * vm_flags is protected by the mmap_sem held in write mode.
37 */ 67 */
38 VM_ClearReadHint(vma); 68 VM_ClearReadHint(vma);
39 69 vma->vm_flags = new_flags;
40 switch (behavior) {
41 case MADV_SEQUENTIAL:
42 vma->vm_flags |= VM_SEQ_READ;
43 break;
44 case MADV_RANDOM:
45 vma->vm_flags |= VM_RAND_READ;
46 break;
47 default:
48 break;
49 }
50 70
51out: 71out:
52 if (error == -ENOMEM) 72 if (error == -ENOMEM)
53 error = -EAGAIN; 73 error = -EAGAIN;
74success:
54 return error; 75 return error;
55} 76}
56 77
@@ -58,6 +79,7 @@ out:
58 * Schedule all required I/O operations. Do not wait for completion. 79 * Schedule all required I/O operations. Do not wait for completion.
59 */ 80 */
60static long madvise_willneed(struct vm_area_struct * vma, 81static long madvise_willneed(struct vm_area_struct * vma,
82 struct vm_area_struct ** prev,
61 unsigned long start, unsigned long end) 83 unsigned long start, unsigned long end)
62{ 84{
63 struct file *file = vma->vm_file; 85 struct file *file = vma->vm_file;
@@ -65,6 +87,7 @@ static long madvise_willneed(struct vm_area_struct * vma,
65 if (!file) 87 if (!file)
66 return -EBADF; 88 return -EBADF;
67 89
90 *prev = vma;
68 start = ((start - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff; 91 start = ((start - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff;
69 if (end > vma->vm_end) 92 if (end > vma->vm_end)
70 end = vma->vm_end; 93 end = vma->vm_end;
@@ -95,8 +118,10 @@ static long madvise_willneed(struct vm_area_struct * vma,
95 * dirty pages is already available as msync(MS_INVALIDATE). 118 * dirty pages is already available as msync(MS_INVALIDATE).
96 */ 119 */
97static long madvise_dontneed(struct vm_area_struct * vma, 120static long madvise_dontneed(struct vm_area_struct * vma,
121 struct vm_area_struct ** prev,
98 unsigned long start, unsigned long end) 122 unsigned long start, unsigned long end)
99{ 123{
124 *prev = vma;
100 if ((vma->vm_flags & VM_LOCKED) || is_vm_hugetlb_page(vma)) 125 if ((vma->vm_flags & VM_LOCKED) || is_vm_hugetlb_page(vma))
101 return -EINVAL; 126 return -EINVAL;
102 127
@@ -111,8 +136,8 @@ static long madvise_dontneed(struct vm_area_struct * vma,
111 return 0; 136 return 0;
112} 137}
113 138
114static long madvise_vma(struct vm_area_struct * vma, unsigned long start, 139static long madvise_vma(struct vm_area_struct *vma, struct vm_area_struct **prev,
115 unsigned long end, int behavior) 140 unsigned long start, unsigned long end, int behavior)
116{ 141{
117 long error = -EBADF; 142 long error = -EBADF;
118 143
@@ -120,15 +145,15 @@ static long madvise_vma(struct vm_area_struct * vma, unsigned long start,
120 case MADV_NORMAL: 145 case MADV_NORMAL:
121 case MADV_SEQUENTIAL: 146 case MADV_SEQUENTIAL:
122 case MADV_RANDOM: 147 case MADV_RANDOM:
123 error = madvise_behavior(vma, start, end, behavior); 148 error = madvise_behavior(vma, prev, start, end, behavior);
124 break; 149 break;
125 150
126 case MADV_WILLNEED: 151 case MADV_WILLNEED:
127 error = madvise_willneed(vma, start, end); 152 error = madvise_willneed(vma, prev, start, end);
128 break; 153 break;
129 154
130 case MADV_DONTNEED: 155 case MADV_DONTNEED:
131 error = madvise_dontneed(vma, start, end); 156 error = madvise_dontneed(vma, prev, start, end);
132 break; 157 break;
133 158
134 default: 159 default:
@@ -175,8 +200,8 @@ static long madvise_vma(struct vm_area_struct * vma, unsigned long start,
175 */ 200 */
176asmlinkage long sys_madvise(unsigned long start, size_t len_in, int behavior) 201asmlinkage long sys_madvise(unsigned long start, size_t len_in, int behavior)
177{ 202{
178 unsigned long end; 203 unsigned long end, tmp;
179 struct vm_area_struct * vma; 204 struct vm_area_struct * vma, *prev;
180 int unmapped_error = 0; 205 int unmapped_error = 0;
181 int error = -EINVAL; 206 int error = -EINVAL;
182 size_t len; 207 size_t len;
@@ -202,40 +227,42 @@ asmlinkage long sys_madvise(unsigned long start, size_t len_in, int behavior)
202 /* 227 /*
203 * If the interval [start,end) covers some unmapped address 228 * If the interval [start,end) covers some unmapped address
204 * ranges, just ignore them, but return -ENOMEM at the end. 229 * ranges, just ignore them, but return -ENOMEM at the end.
230 * - different from the way of handling in mlock etc.
205 */ 231 */
206 vma = find_vma(current->mm, start); 232 vma = find_vma_prev(current->mm, start, &prev);
233 if (!vma && prev)
234 vma = prev->vm_next;
207 for (;;) { 235 for (;;) {
208 /* Still start < end. */ 236 /* Still start < end. */
209 error = -ENOMEM; 237 error = -ENOMEM;
210 if (!vma) 238 if (!vma)
211 goto out; 239 goto out;
212 240
213 /* Here start < vma->vm_end. */ 241 /* Here start < (end|vma->vm_end). */
214 if (start < vma->vm_start) { 242 if (start < vma->vm_start) {
215 unmapped_error = -ENOMEM; 243 unmapped_error = -ENOMEM;
216 start = vma->vm_start; 244 start = vma->vm_start;
245 if (start >= end)
246 goto out;
217 } 247 }
218 248
219 /* Here vma->vm_start <= start < vma->vm_end. */ 249 /* Here vma->vm_start <= start < (end|vma->vm_end) */
220 if (end <= vma->vm_end) { 250 tmp = vma->vm_end;
221 if (start < end) { 251 if (end < tmp)
222 error = madvise_vma(vma, start, end, 252 tmp = end;
223 behavior);
224 if (error)
225 goto out;
226 }
227 error = unmapped_error;
228 goto out;
229 }
230 253
231 /* Here vma->vm_start <= start < vma->vm_end < end. */ 254 /* Here vma->vm_start <= start < tmp <= (end|vma->vm_end). */
232 error = madvise_vma(vma, start, vma->vm_end, behavior); 255 error = madvise_vma(vma, &prev, start, tmp, behavior);
233 if (error) 256 if (error)
234 goto out; 257 goto out;
235 start = vma->vm_end; 258 start = tmp;
236 vma = vma->vm_next; 259 if (start < prev->vm_end)
260 start = prev->vm_end;
261 error = unmapped_error;
262 if (start >= end)
263 goto out;
264 vma = prev->vm_next;
237 } 265 }
238
239out: 266out:
240 up_write(&current->mm->mmap_sem); 267 up_write(&current->mm->mmap_sem);
241 return error; 268 return error;
diff --git a/mm/memory.c b/mm/memory.c
index d209f745db7f..da91b7bf9986 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -840,23 +840,8 @@ check_user_page_readable(struct mm_struct *mm, unsigned long address)
840{ 840{
841 return __follow_page(mm, address, /*read*/1, /*write*/0) != NULL; 841 return __follow_page(mm, address, /*read*/1, /*write*/0) != NULL;
842} 842}
843
844EXPORT_SYMBOL(check_user_page_readable); 843EXPORT_SYMBOL(check_user_page_readable);
845 844
846/*
847 * Given a physical address, is there a useful struct page pointing to
848 * it? This may become more complex in the future if we start dealing
849 * with IO-aperture pages for direct-IO.
850 */
851
852static inline struct page *get_page_map(struct page *page)
853{
854 if (!pfn_valid(page_to_pfn(page)))
855 return NULL;
856 return page;
857}
858
859
860static inline int 845static inline int
861untouched_anonymous_page(struct mm_struct* mm, struct vm_area_struct *vma, 846untouched_anonymous_page(struct mm_struct* mm, struct vm_area_struct *vma,
862 unsigned long address) 847 unsigned long address)
@@ -887,7 +872,6 @@ untouched_anonymous_page(struct mm_struct* mm, struct vm_area_struct *vma,
887 return 0; 872 return 0;
888} 873}
889 874
890
891int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, 875int get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
892 unsigned long start, int len, int write, int force, 876 unsigned long start, int len, int write, int force,
893 struct page **pages, struct vm_area_struct **vmas) 877 struct page **pages, struct vm_area_struct **vmas)
@@ -951,21 +935,21 @@ int get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
951 } 935 }
952 spin_lock(&mm->page_table_lock); 936 spin_lock(&mm->page_table_lock);
953 do { 937 do {
954 struct page *map; 938 struct page *page;
955 int lookup_write = write; 939 int lookup_write = write;
956 940
957 cond_resched_lock(&mm->page_table_lock); 941 cond_resched_lock(&mm->page_table_lock);
958 while (!(map = follow_page(mm, start, lookup_write))) { 942 while (!(page = follow_page(mm, start, lookup_write))) {
959 /* 943 /*
960 * Shortcut for anonymous pages. We don't want 944 * Shortcut for anonymous pages. We don't want
961 * to force the creation of pages tables for 945 * to force the creation of pages tables for
962 * insanly big anonymously mapped areas that 946 * insanely big anonymously mapped areas that
963 * nobody touched so far. This is important 947 * nobody touched so far. This is important
964 * for doing a core dump for these mappings. 948 * for doing a core dump for these mappings.
965 */ 949 */
966 if (!lookup_write && 950 if (!lookup_write &&
967 untouched_anonymous_page(mm,vma,start)) { 951 untouched_anonymous_page(mm,vma,start)) {
968 map = ZERO_PAGE(start); 952 page = ZERO_PAGE(start);
969 break; 953 break;
970 } 954 }
971 spin_unlock(&mm->page_table_lock); 955 spin_unlock(&mm->page_table_lock);
@@ -994,30 +978,21 @@ int get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
994 spin_lock(&mm->page_table_lock); 978 spin_lock(&mm->page_table_lock);
995 } 979 }
996 if (pages) { 980 if (pages) {
997 pages[i] = get_page_map(map); 981 pages[i] = page;
998 if (!pages[i]) { 982 flush_dcache_page(page);
999 spin_unlock(&mm->page_table_lock); 983 if (!PageReserved(page))
1000 while (i--) 984 page_cache_get(page);
1001 page_cache_release(pages[i]);
1002 i = -EFAULT;
1003 goto out;
1004 }
1005 flush_dcache_page(pages[i]);
1006 if (!PageReserved(pages[i]))
1007 page_cache_get(pages[i]);
1008 } 985 }
1009 if (vmas) 986 if (vmas)
1010 vmas[i] = vma; 987 vmas[i] = vma;
1011 i++; 988 i++;
1012 start += PAGE_SIZE; 989 start += PAGE_SIZE;
1013 len--; 990 len--;
1014 } while(len && start < vma->vm_end); 991 } while (len && start < vma->vm_end);
1015 spin_unlock(&mm->page_table_lock); 992 spin_unlock(&mm->page_table_lock);
1016 } while(len); 993 } while (len);
1017out:
1018 return i; 994 return i;
1019} 995}
1020
1021EXPORT_SYMBOL(get_user_pages); 996EXPORT_SYMBOL(get_user_pages);
1022 997
1023static int zeromap_pte_range(struct mm_struct *mm, pmd_t *pmd, 998static int zeromap_pte_range(struct mm_struct *mm, pmd_t *pmd,
@@ -1264,7 +1239,7 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct * vma,
1264 } 1239 }
1265 old_page = pfn_to_page(pfn); 1240 old_page = pfn_to_page(pfn);
1266 1241
1267 if (!TestSetPageLocked(old_page)) { 1242 if (PageAnon(old_page) && !TestSetPageLocked(old_page)) {
1268 int reuse = can_share_swap_page(old_page); 1243 int reuse = can_share_swap_page(old_page);
1269 unlock_page(old_page); 1244 unlock_page(old_page);
1270 if (reuse) { 1245 if (reuse) {
@@ -1711,10 +1686,6 @@ static int do_swap_page(struct mm_struct * mm,
1711 } 1686 }
1712 1687
1713 /* The page isn't present yet, go ahead with the fault. */ 1688 /* The page isn't present yet, go ahead with the fault. */
1714
1715 swap_free(entry);
1716 if (vm_swap_full())
1717 remove_exclusive_swap_page(page);
1718 1689
1719 inc_mm_counter(mm, rss); 1690 inc_mm_counter(mm, rss);
1720 pte = mk_pte(page, vma->vm_page_prot); 1691 pte = mk_pte(page, vma->vm_page_prot);
@@ -1722,12 +1693,16 @@ static int do_swap_page(struct mm_struct * mm,
1722 pte = maybe_mkwrite(pte_mkdirty(pte), vma); 1693 pte = maybe_mkwrite(pte_mkdirty(pte), vma);
1723 write_access = 0; 1694 write_access = 0;
1724 } 1695 }
1725 unlock_page(page);
1726 1696
1727 flush_icache_page(vma, page); 1697 flush_icache_page(vma, page);
1728 set_pte_at(mm, address, page_table, pte); 1698 set_pte_at(mm, address, page_table, pte);
1729 page_add_anon_rmap(page, vma, address); 1699 page_add_anon_rmap(page, vma, address);
1730 1700
1701 swap_free(entry);
1702 if (vm_swap_full())
1703 remove_exclusive_swap_page(page);
1704 unlock_page(page);
1705
1731 if (write_access) { 1706 if (write_access) {
1732 if (do_wp_page(mm, vma, address, 1707 if (do_wp_page(mm, vma, address,
1733 page_table, pmd, pte) == VM_FAULT_OOM) 1708 page_table, pmd, pte) == VM_FAULT_OOM)
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 08c41da429cf..cb41c31e7c87 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -238,46 +238,80 @@ static struct mempolicy *mpol_new(int mode, unsigned long *nodes)
238} 238}
239 239
240/* Ensure all existing pages follow the policy. */ 240/* Ensure all existing pages follow the policy. */
241static int 241static int check_pte_range(struct mm_struct *mm, pmd_t *pmd,
242verify_pages(struct mm_struct *mm, 242 unsigned long addr, unsigned long end, unsigned long *nodes)
243 unsigned long addr, unsigned long end, unsigned long *nodes)
244{ 243{
245 while (addr < end) { 244 pte_t *orig_pte;
246 struct page *p; 245 pte_t *pte;
247 pte_t *pte; 246
248 pmd_t *pmd; 247 spin_lock(&mm->page_table_lock);
249 pud_t *pud; 248 orig_pte = pte = pte_offset_map(pmd, addr);
250 pgd_t *pgd; 249 do {
251 pgd = pgd_offset(mm, addr); 250 unsigned long pfn;
252 if (pgd_none(*pgd)) { 251 unsigned int nid;
253 unsigned long next = (addr + PGDIR_SIZE) & PGDIR_MASK; 252
254 if (next > addr) 253 if (!pte_present(*pte))
255 break;
256 addr = next;
257 continue; 254 continue;
258 } 255 pfn = pte_pfn(*pte);
259 pud = pud_offset(pgd, addr); 256 if (!pfn_valid(pfn))
260 if (pud_none(*pud)) {
261 addr = (addr + PUD_SIZE) & PUD_MASK;
262 continue; 257 continue;
263 } 258 nid = pfn_to_nid(pfn);
264 pmd = pmd_offset(pud, addr); 259 if (!test_bit(nid, nodes))
265 if (pmd_none(*pmd)) { 260 break;
266 addr = (addr + PMD_SIZE) & PMD_MASK; 261 } while (pte++, addr += PAGE_SIZE, addr != end);
262 pte_unmap(orig_pte);
263 spin_unlock(&mm->page_table_lock);
264 return addr != end;
265}
266
267static inline int check_pmd_range(struct mm_struct *mm, pud_t *pud,
268 unsigned long addr, unsigned long end, unsigned long *nodes)
269{
270 pmd_t *pmd;
271 unsigned long next;
272
273 pmd = pmd_offset(pud, addr);
274 do {
275 next = pmd_addr_end(addr, end);
276 if (pmd_none_or_clear_bad(pmd))
267 continue; 277 continue;
268 } 278 if (check_pte_range(mm, pmd, addr, next, nodes))
269 p = NULL; 279 return -EIO;
270 pte = pte_offset_map(pmd, addr); 280 } while (pmd++, addr = next, addr != end);
271 if (pte_present(*pte)) 281 return 0;
272 p = pte_page(*pte); 282}
273 pte_unmap(pte); 283
274 if (p) { 284static inline int check_pud_range(struct mm_struct *mm, pgd_t *pgd,
275 unsigned nid = page_to_nid(p); 285 unsigned long addr, unsigned long end, unsigned long *nodes)
276 if (!test_bit(nid, nodes)) 286{
277 return -EIO; 287 pud_t *pud;
278 } 288 unsigned long next;
279 addr += PAGE_SIZE; 289
280 } 290 pud = pud_offset(pgd, addr);
291 do {
292 next = pud_addr_end(addr, end);
293 if (pud_none_or_clear_bad(pud))
294 continue;
295 if (check_pmd_range(mm, pud, addr, next, nodes))
296 return -EIO;
297 } while (pud++, addr = next, addr != end);
298 return 0;
299}
300
301static inline int check_pgd_range(struct mm_struct *mm,
302 unsigned long addr, unsigned long end, unsigned long *nodes)
303{
304 pgd_t *pgd;
305 unsigned long next;
306
307 pgd = pgd_offset(mm, addr);
308 do {
309 next = pgd_addr_end(addr, end);
310 if (pgd_none_or_clear_bad(pgd))
311 continue;
312 if (check_pud_range(mm, pgd, addr, next, nodes))
313 return -EIO;
314 } while (pgd++, addr = next, addr != end);
281 return 0; 315 return 0;
282} 316}
283 317
@@ -299,7 +333,7 @@ check_range(struct mm_struct *mm, unsigned long start, unsigned long end,
299 if (prev && prev->vm_end < vma->vm_start) 333 if (prev && prev->vm_end < vma->vm_start)
300 return ERR_PTR(-EFAULT); 334 return ERR_PTR(-EFAULT);
301 if ((flags & MPOL_MF_STRICT) && !is_vm_hugetlb_page(vma)) { 335 if ((flags & MPOL_MF_STRICT) && !is_vm_hugetlb_page(vma)) {
302 err = verify_pages(vma->vm_mm, 336 err = check_pgd_range(vma->vm_mm,
303 vma->vm_start, vma->vm_end, nodes); 337 vma->vm_start, vma->vm_end, nodes);
304 if (err) { 338 if (err) {
305 first = ERR_PTR(err); 339 first = ERR_PTR(err);
@@ -721,7 +755,7 @@ static struct page *alloc_page_interleave(unsigned int __nocast gfp, unsigned or
721 zl = NODE_DATA(nid)->node_zonelists + (gfp & GFP_ZONEMASK); 755 zl = NODE_DATA(nid)->node_zonelists + (gfp & GFP_ZONEMASK);
722 page = __alloc_pages(gfp, order, zl); 756 page = __alloc_pages(gfp, order, zl);
723 if (page && page_zone(page) == zl->zones[0]) { 757 if (page && page_zone(page) == zl->zones[0]) {
724 zl->zones[0]->pageset[get_cpu()].interleave_hit++; 758 zone_pcp(zl->zones[0],get_cpu())->interleave_hit++;
725 put_cpu(); 759 put_cpu();
726 } 760 }
727 return page; 761 return page;
diff --git a/mm/mmap.c b/mm/mmap.c
index de54acd9942f..da3fa90a0aae 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1175,7 +1175,12 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
1175 (!vma || addr + len <= vma->vm_start)) 1175 (!vma || addr + len <= vma->vm_start))
1176 return addr; 1176 return addr;
1177 } 1177 }
1178 start_addr = addr = mm->free_area_cache; 1178 if (len > mm->cached_hole_size) {
1179 start_addr = addr = mm->free_area_cache;
1180 } else {
1181 start_addr = addr = TASK_UNMAPPED_BASE;
1182 mm->cached_hole_size = 0;
1183 }
1179 1184
1180full_search: 1185full_search:
1181 for (vma = find_vma(mm, addr); ; vma = vma->vm_next) { 1186 for (vma = find_vma(mm, addr); ; vma = vma->vm_next) {
@@ -1186,7 +1191,9 @@ full_search:
1186 * some holes. 1191 * some holes.
1187 */ 1192 */
1188 if (start_addr != TASK_UNMAPPED_BASE) { 1193 if (start_addr != TASK_UNMAPPED_BASE) {
1189 start_addr = addr = TASK_UNMAPPED_BASE; 1194 addr = TASK_UNMAPPED_BASE;
1195 start_addr = addr;
1196 mm->cached_hole_size = 0;
1190 goto full_search; 1197 goto full_search;
1191 } 1198 }
1192 return -ENOMEM; 1199 return -ENOMEM;
@@ -1198,19 +1205,22 @@ full_search:
1198 mm->free_area_cache = addr + len; 1205 mm->free_area_cache = addr + len;
1199 return addr; 1206 return addr;
1200 } 1207 }
1208 if (addr + mm->cached_hole_size < vma->vm_start)
1209 mm->cached_hole_size = vma->vm_start - addr;
1201 addr = vma->vm_end; 1210 addr = vma->vm_end;
1202 } 1211 }
1203} 1212}
1204#endif 1213#endif
1205 1214
1206void arch_unmap_area(struct vm_area_struct *area) 1215void arch_unmap_area(struct mm_struct *mm, unsigned long addr)
1207{ 1216{
1208 /* 1217 /*
1209 * Is this a new hole at the lowest possible address? 1218 * Is this a new hole at the lowest possible address?
1210 */ 1219 */
1211 if (area->vm_start >= TASK_UNMAPPED_BASE && 1220 if (addr >= TASK_UNMAPPED_BASE && addr < mm->free_area_cache) {
1212 area->vm_start < area->vm_mm->free_area_cache) 1221 mm->free_area_cache = addr;
1213 area->vm_mm->free_area_cache = area->vm_start; 1222 mm->cached_hole_size = ~0UL;
1223 }
1214} 1224}
1215 1225
1216/* 1226/*
@@ -1240,6 +1250,12 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
1240 return addr; 1250 return addr;
1241 } 1251 }
1242 1252
1253 /* check if free_area_cache is useful for us */
1254 if (len <= mm->cached_hole_size) {
1255 mm->cached_hole_size = 0;
1256 mm->free_area_cache = mm->mmap_base;
1257 }
1258
1243 /* either no address requested or can't fit in requested address hole */ 1259 /* either no address requested or can't fit in requested address hole */
1244 addr = mm->free_area_cache; 1260 addr = mm->free_area_cache;
1245 1261
@@ -1251,6 +1267,9 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
1251 return (mm->free_area_cache = addr-len); 1267 return (mm->free_area_cache = addr-len);
1252 } 1268 }
1253 1269
1270 if (mm->mmap_base < len)
1271 goto bottomup;
1272
1254 addr = mm->mmap_base-len; 1273 addr = mm->mmap_base-len;
1255 1274
1256 do { 1275 do {
@@ -1264,38 +1283,45 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
1264 /* remember the address as a hint for next time */ 1283 /* remember the address as a hint for next time */
1265 return (mm->free_area_cache = addr); 1284 return (mm->free_area_cache = addr);
1266 1285
1286 /* remember the largest hole we saw so far */
1287 if (addr + mm->cached_hole_size < vma->vm_start)
1288 mm->cached_hole_size = vma->vm_start - addr;
1289
1267 /* try just below the current vma->vm_start */ 1290 /* try just below the current vma->vm_start */
1268 addr = vma->vm_start-len; 1291 addr = vma->vm_start-len;
1269 } while (len < vma->vm_start); 1292 } while (len < vma->vm_start);
1270 1293
1294bottomup:
1271 /* 1295 /*
1272 * A failed mmap() very likely causes application failure, 1296 * A failed mmap() very likely causes application failure,
1273 * so fall back to the bottom-up function here. This scenario 1297 * so fall back to the bottom-up function here. This scenario
1274 * can happen with large stack limits and large mmap() 1298 * can happen with large stack limits and large mmap()
1275 * allocations. 1299 * allocations.
1276 */ 1300 */
1277 mm->free_area_cache = TASK_UNMAPPED_BASE; 1301 mm->cached_hole_size = ~0UL;
1302 mm->free_area_cache = TASK_UNMAPPED_BASE;
1278 addr = arch_get_unmapped_area(filp, addr0, len, pgoff, flags); 1303 addr = arch_get_unmapped_area(filp, addr0, len, pgoff, flags);
1279 /* 1304 /*
1280 * Restore the topdown base: 1305 * Restore the topdown base:
1281 */ 1306 */
1282 mm->free_area_cache = mm->mmap_base; 1307 mm->free_area_cache = mm->mmap_base;
1308 mm->cached_hole_size = ~0UL;
1283 1309
1284 return addr; 1310 return addr;
1285} 1311}
1286#endif 1312#endif
1287 1313
1288void arch_unmap_area_topdown(struct vm_area_struct *area) 1314void arch_unmap_area_topdown(struct mm_struct *mm, unsigned long addr)
1289{ 1315{
1290 /* 1316 /*
1291 * Is this a new hole at the highest possible address? 1317 * Is this a new hole at the highest possible address?
1292 */ 1318 */
1293 if (area->vm_end > area->vm_mm->free_area_cache) 1319 if (addr > mm->free_area_cache)
1294 area->vm_mm->free_area_cache = area->vm_end; 1320 mm->free_area_cache = addr;
1295 1321
1296 /* dont allow allocations above current base */ 1322 /* dont allow allocations above current base */
1297 if (area->vm_mm->free_area_cache > area->vm_mm->mmap_base) 1323 if (mm->free_area_cache > mm->mmap_base)
1298 area->vm_mm->free_area_cache = area->vm_mm->mmap_base; 1324 mm->free_area_cache = mm->mmap_base;
1299} 1325}
1300 1326
1301unsigned long 1327unsigned long
@@ -1595,7 +1621,6 @@ static void unmap_vma(struct mm_struct *mm, struct vm_area_struct *area)
1595 if (area->vm_flags & VM_LOCKED) 1621 if (area->vm_flags & VM_LOCKED)
1596 area->vm_mm->locked_vm -= len >> PAGE_SHIFT; 1622 area->vm_mm->locked_vm -= len >> PAGE_SHIFT;
1597 vm_stat_unaccount(area); 1623 vm_stat_unaccount(area);
1598 area->vm_mm->unmap_area(area);
1599 remove_vm_struct(area); 1624 remove_vm_struct(area);
1600} 1625}
1601 1626
@@ -1649,6 +1674,7 @@ detach_vmas_to_be_unmapped(struct mm_struct *mm, struct vm_area_struct *vma,
1649{ 1674{
1650 struct vm_area_struct **insertion_point; 1675 struct vm_area_struct **insertion_point;
1651 struct vm_area_struct *tail_vma = NULL; 1676 struct vm_area_struct *tail_vma = NULL;
1677 unsigned long addr;
1652 1678
1653 insertion_point = (prev ? &prev->vm_next : &mm->mmap); 1679 insertion_point = (prev ? &prev->vm_next : &mm->mmap);
1654 do { 1680 do {
@@ -1659,6 +1685,11 @@ detach_vmas_to_be_unmapped(struct mm_struct *mm, struct vm_area_struct *vma,
1659 } while (vma && vma->vm_start < end); 1685 } while (vma && vma->vm_start < end);
1660 *insertion_point = vma; 1686 *insertion_point = vma;
1661 tail_vma->vm_next = NULL; 1687 tail_vma->vm_next = NULL;
1688 if (mm->unmap_area == arch_unmap_area)
1689 addr = prev ? prev->vm_end : mm->mmap_base;
1690 else
1691 addr = vma ? vma->vm_start : mm->mmap_base;
1692 mm->unmap_area(mm, addr);
1662 mm->mmap_cache = NULL; /* Kill the cache. */ 1693 mm->mmap_cache = NULL; /* Kill the cache. */
1663} 1694}
1664 1695
diff --git a/mm/msync.c b/mm/msync.c
index 090f426bca7d..d0f5a1bce7cb 100644
--- a/mm/msync.c
+++ b/mm/msync.c
@@ -34,6 +34,8 @@ static void sync_pte_range(struct vm_area_struct *vma, pmd_t *pmd,
34 34
35 if (!pte_present(*pte)) 35 if (!pte_present(*pte))
36 continue; 36 continue;
37 if (!pte_maybe_dirty(*pte))
38 continue;
37 pfn = pte_pfn(*pte); 39 pfn = pte_pfn(*pte);
38 if (!pfn_valid(pfn)) 40 if (!pfn_valid(pfn))
39 continue; 41 continue;
diff --git a/mm/nommu.c b/mm/nommu.c
index c53e9c8f6b4a..ce74452c02d9 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -1067,7 +1067,7 @@ unsigned long arch_get_unmapped_area(struct file *file, unsigned long addr,
1067 return -ENOMEM; 1067 return -ENOMEM;
1068} 1068}
1069 1069
1070void arch_unmap_area(struct vm_area_struct *area) 1070void arch_unmap_area(struct mm_struct *mm, unsigned long addr)
1071{ 1071{
1072} 1072}
1073 1073
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 4bbb1cb10495..59666d905f19 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -258,6 +258,10 @@ void out_of_memory(unsigned int __nocast gfp_mask)
258 struct mm_struct *mm = NULL; 258 struct mm_struct *mm = NULL;
259 task_t * p; 259 task_t * p;
260 260
261 printk("oom-killer: gfp_mask=0x%x\n", gfp_mask);
262 /* print memory stats */
263 show_mem();
264
261 read_lock(&tasklist_lock); 265 read_lock(&tasklist_lock);
262retry: 266retry:
263 p = select_bad_process(); 267 p = select_bad_process();
@@ -268,12 +272,9 @@ retry:
268 /* Found nothing?!?! Either we hang forever, or we panic. */ 272 /* Found nothing?!?! Either we hang forever, or we panic. */
269 if (!p) { 273 if (!p) {
270 read_unlock(&tasklist_lock); 274 read_unlock(&tasklist_lock);
271 show_free_areas();
272 panic("Out of memory and no killable processes...\n"); 275 panic("Out of memory and no killable processes...\n");
273 } 276 }
274 277
275 printk("oom-killer: gfp_mask=0x%x\n", gfp_mask);
276 show_free_areas();
277 mm = oom_kill_process(p); 278 mm = oom_kill_process(p);
278 if (!mm) 279 if (!mm)
279 goto retry; 280 goto retry;
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index b1061b1962f8..206920796f5f 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -105,11 +105,13 @@ static void bad_page(const char *function, struct page *page)
105 printk(KERN_EMERG "Backtrace:\n"); 105 printk(KERN_EMERG "Backtrace:\n");
106 dump_stack(); 106 dump_stack();
107 printk(KERN_EMERG "Trying to fix it up, but a reboot is needed\n"); 107 printk(KERN_EMERG "Trying to fix it up, but a reboot is needed\n");
108 page->flags &= ~(1 << PG_private | 108 page->flags &= ~(1 << PG_lru |
109 1 << PG_private |
109 1 << PG_locked | 110 1 << PG_locked |
110 1 << PG_lru |
111 1 << PG_active | 111 1 << PG_active |
112 1 << PG_dirty | 112 1 << PG_dirty |
113 1 << PG_reclaim |
114 1 << PG_slab |
113 1 << PG_swapcache | 115 1 << PG_swapcache |
114 1 << PG_writeback); 116 1 << PG_writeback);
115 set_page_count(page, 0); 117 set_page_count(page, 0);
@@ -440,14 +442,17 @@ void set_page_refs(struct page *page, int order)
440 */ 442 */
441static void prep_new_page(struct page *page, int order) 443static void prep_new_page(struct page *page, int order)
442{ 444{
443 if (page->mapping || page_mapcount(page) || 445 if ( page_mapcount(page) ||
444 (page->flags & ( 446 page->mapping != NULL ||
447 page_count(page) != 0 ||
448 (page->flags & (
449 1 << PG_lru |
445 1 << PG_private | 450 1 << PG_private |
446 1 << PG_locked | 451 1 << PG_locked |
447 1 << PG_lru |
448 1 << PG_active | 452 1 << PG_active |
449 1 << PG_dirty | 453 1 << PG_dirty |
450 1 << PG_reclaim | 454 1 << PG_reclaim |
455 1 << PG_slab |
451 1 << PG_swapcache | 456 1 << PG_swapcache |
452 1 << PG_writeback ))) 457 1 << PG_writeback )))
453 bad_page(__FUNCTION__, page); 458 bad_page(__FUNCTION__, page);
@@ -511,6 +516,36 @@ static int rmqueue_bulk(struct zone *zone, unsigned int order,
511 return allocated; 516 return allocated;
512} 517}
513 518
519#ifdef CONFIG_NUMA
520/* Called from the slab reaper to drain remote pagesets */
521void drain_remote_pages(void)
522{
523 struct zone *zone;
524 int i;
525 unsigned long flags;
526
527 local_irq_save(flags);
528 for_each_zone(zone) {
529 struct per_cpu_pageset *pset;
530
531 /* Do not drain local pagesets */
532 if (zone->zone_pgdat->node_id == numa_node_id())
533 continue;
534
535 pset = zone->pageset[smp_processor_id()];
536 for (i = 0; i < ARRAY_SIZE(pset->pcp); i++) {
537 struct per_cpu_pages *pcp;
538
539 pcp = &pset->pcp[i];
540 if (pcp->count)
541 pcp->count -= free_pages_bulk(zone, pcp->count,
542 &pcp->list, 0);
543 }
544 }
545 local_irq_restore(flags);
546}
547#endif
548
514#if defined(CONFIG_PM) || defined(CONFIG_HOTPLUG_CPU) 549#if defined(CONFIG_PM) || defined(CONFIG_HOTPLUG_CPU)
515static void __drain_pages(unsigned int cpu) 550static void __drain_pages(unsigned int cpu)
516{ 551{
@@ -520,7 +555,7 @@ static void __drain_pages(unsigned int cpu)
520 for_each_zone(zone) { 555 for_each_zone(zone) {
521 struct per_cpu_pageset *pset; 556 struct per_cpu_pageset *pset;
522 557
523 pset = &zone->pageset[cpu]; 558 pset = zone_pcp(zone, cpu);
524 for (i = 0; i < ARRAY_SIZE(pset->pcp); i++) { 559 for (i = 0; i < ARRAY_SIZE(pset->pcp); i++) {
525 struct per_cpu_pages *pcp; 560 struct per_cpu_pages *pcp;
526 561
@@ -583,12 +618,12 @@ static void zone_statistics(struct zonelist *zonelist, struct zone *z)
583 618
584 local_irq_save(flags); 619 local_irq_save(flags);
585 cpu = smp_processor_id(); 620 cpu = smp_processor_id();
586 p = &z->pageset[cpu]; 621 p = zone_pcp(z,cpu);
587 if (pg == orig) { 622 if (pg == orig) {
588 z->pageset[cpu].numa_hit++; 623 p->numa_hit++;
589 } else { 624 } else {
590 p->numa_miss++; 625 p->numa_miss++;
591 zonelist->zones[0]->pageset[cpu].numa_foreign++; 626 zone_pcp(zonelist->zones[0], cpu)->numa_foreign++;
592 } 627 }
593 if (pg == NODE_DATA(numa_node_id())) 628 if (pg == NODE_DATA(numa_node_id()))
594 p->local_node++; 629 p->local_node++;
@@ -615,12 +650,12 @@ static void fastcall free_hot_cold_page(struct page *page, int cold)
615 if (PageAnon(page)) 650 if (PageAnon(page))
616 page->mapping = NULL; 651 page->mapping = NULL;
617 free_pages_check(__FUNCTION__, page); 652 free_pages_check(__FUNCTION__, page);
618 pcp = &zone->pageset[get_cpu()].pcp[cold]; 653 pcp = &zone_pcp(zone, get_cpu())->pcp[cold];
619 local_irq_save(flags); 654 local_irq_save(flags);
620 if (pcp->count >= pcp->high)
621 pcp->count -= free_pages_bulk(zone, pcp->batch, &pcp->list, 0);
622 list_add(&page->lru, &pcp->list); 655 list_add(&page->lru, &pcp->list);
623 pcp->count++; 656 pcp->count++;
657 if (pcp->count >= pcp->high)
658 pcp->count -= free_pages_bulk(zone, pcp->batch, &pcp->list, 0);
624 local_irq_restore(flags); 659 local_irq_restore(flags);
625 put_cpu(); 660 put_cpu();
626} 661}
@@ -659,7 +694,7 @@ buffered_rmqueue(struct zone *zone, int order, unsigned int __nocast gfp_flags)
659 if (order == 0) { 694 if (order == 0) {
660 struct per_cpu_pages *pcp; 695 struct per_cpu_pages *pcp;
661 696
662 pcp = &zone->pageset[get_cpu()].pcp[cold]; 697 pcp = &zone_pcp(zone, get_cpu())->pcp[cold];
663 local_irq_save(flags); 698 local_irq_save(flags);
664 if (pcp->count <= pcp->low) 699 if (pcp->count <= pcp->low)
665 pcp->count += rmqueue_bulk(zone, 0, 700 pcp->count += rmqueue_bulk(zone, 0,
@@ -724,6 +759,16 @@ int zone_watermark_ok(struct zone *z, int order, unsigned long mark,
724 return 1; 759 return 1;
725} 760}
726 761
762static inline int
763should_reclaim_zone(struct zone *z, unsigned int gfp_mask)
764{
765 if (!z->reclaim_pages)
766 return 0;
767 if (gfp_mask & __GFP_NORECLAIM)
768 return 0;
769 return 1;
770}
771
727/* 772/*
728 * This is the 'heart' of the zoned buddy allocator. 773 * This is the 'heart' of the zoned buddy allocator.
729 */ 774 */
@@ -760,17 +805,32 @@ __alloc_pages(unsigned int __nocast gfp_mask, unsigned int order,
760 805
761 classzone_idx = zone_idx(zones[0]); 806 classzone_idx = zone_idx(zones[0]);
762 807
763 restart: 808restart:
764 /* Go through the zonelist once, looking for a zone with enough free */ 809 /* Go through the zonelist once, looking for a zone with enough free */
765 for (i = 0; (z = zones[i]) != NULL; i++) { 810 for (i = 0; (z = zones[i]) != NULL; i++) {
766 811 int do_reclaim = should_reclaim_zone(z, gfp_mask);
767 if (!zone_watermark_ok(z, order, z->pages_low,
768 classzone_idx, 0, 0))
769 continue;
770 812
771 if (!cpuset_zone_allowed(z)) 813 if (!cpuset_zone_allowed(z))
772 continue; 814 continue;
773 815
816 /*
817 * If the zone is to attempt early page reclaim then this loop
818 * will try to reclaim pages and check the watermark a second
819 * time before giving up and falling back to the next zone.
820 */
821zone_reclaim_retry:
822 if (!zone_watermark_ok(z, order, z->pages_low,
823 classzone_idx, 0, 0)) {
824 if (!do_reclaim)
825 continue;
826 else {
827 zone_reclaim(z, gfp_mask, order);
828 /* Only try reclaim once */
829 do_reclaim = 0;
830 goto zone_reclaim_retry;
831 }
832 }
833
774 page = buffered_rmqueue(z, order, gfp_mask); 834 page = buffered_rmqueue(z, order, gfp_mask);
775 if (page) 835 if (page)
776 goto got_pg; 836 goto got_pg;
@@ -829,7 +889,7 @@ rebalance:
829 reclaim_state.reclaimed_slab = 0; 889 reclaim_state.reclaimed_slab = 0;
830 p->reclaim_state = &reclaim_state; 890 p->reclaim_state = &reclaim_state;
831 891
832 did_some_progress = try_to_free_pages(zones, gfp_mask, order); 892 did_some_progress = try_to_free_pages(zones, gfp_mask);
833 893
834 p->reclaim_state = NULL; 894 p->reclaim_state = NULL;
835 p->flags &= ~PF_MEMALLOC; 895 p->flags &= ~PF_MEMALLOC;
@@ -905,6 +965,7 @@ nopage:
905 " order:%d, mode:0x%x\n", 965 " order:%d, mode:0x%x\n",
906 p->comm, order, gfp_mask); 966 p->comm, order, gfp_mask);
907 dump_stack(); 967 dump_stack();
968 show_mem();
908 } 969 }
909 return NULL; 970 return NULL;
910got_pg: 971got_pg:
@@ -1114,7 +1175,7 @@ void get_full_page_state(struct page_state *ret)
1114 __get_page_state(ret, sizeof(*ret) / sizeof(unsigned long)); 1175 __get_page_state(ret, sizeof(*ret) / sizeof(unsigned long));
1115} 1176}
1116 1177
1117unsigned long __read_page_state(unsigned offset) 1178unsigned long __read_page_state(unsigned long offset)
1118{ 1179{
1119 unsigned long ret = 0; 1180 unsigned long ret = 0;
1120 int cpu; 1181 int cpu;
@@ -1128,7 +1189,7 @@ unsigned long __read_page_state(unsigned offset)
1128 return ret; 1189 return ret;
1129} 1190}
1130 1191
1131void __mod_page_state(unsigned offset, unsigned long delta) 1192void __mod_page_state(unsigned long offset, unsigned long delta)
1132{ 1193{
1133 unsigned long flags; 1194 unsigned long flags;
1134 void* ptr; 1195 void* ptr;
@@ -1237,22 +1298,23 @@ void show_free_areas(void)
1237 if (!cpu_possible(cpu)) 1298 if (!cpu_possible(cpu))
1238 continue; 1299 continue;
1239 1300
1240 pageset = zone->pageset + cpu; 1301 pageset = zone_pcp(zone, cpu);
1241 1302
1242 for (temperature = 0; temperature < 2; temperature++) 1303 for (temperature = 0; temperature < 2; temperature++)
1243 printk("cpu %d %s: low %d, high %d, batch %d\n", 1304 printk("cpu %d %s: low %d, high %d, batch %d used:%d\n",
1244 cpu, 1305 cpu,
1245 temperature ? "cold" : "hot", 1306 temperature ? "cold" : "hot",
1246 pageset->pcp[temperature].low, 1307 pageset->pcp[temperature].low,
1247 pageset->pcp[temperature].high, 1308 pageset->pcp[temperature].high,
1248 pageset->pcp[temperature].batch); 1309 pageset->pcp[temperature].batch,
1310 pageset->pcp[temperature].count);
1249 } 1311 }
1250 } 1312 }
1251 1313
1252 get_page_state(&ps); 1314 get_page_state(&ps);
1253 get_zone_counts(&active, &inactive, &free); 1315 get_zone_counts(&active, &inactive, &free);
1254 1316
1255 printk("\nFree pages: %11ukB (%ukB HighMem)\n", 1317 printk("Free pages: %11ukB (%ukB HighMem)\n",
1256 K(nr_free_pages()), 1318 K(nr_free_pages()),
1257 K(nr_free_highpages())); 1319 K(nr_free_highpages()));
1258 1320
@@ -1620,6 +1682,155 @@ void zone_init_free_lists(struct pglist_data *pgdat, struct zone *zone,
1620 memmap_init_zone((size), (nid), (zone), (start_pfn)) 1682 memmap_init_zone((size), (nid), (zone), (start_pfn))
1621#endif 1683#endif
1622 1684
1685static int __devinit zone_batchsize(struct zone *zone)
1686{
1687 int batch;
1688
1689 /*
1690 * The per-cpu-pages pools are set to around 1000th of the
1691 * size of the zone. But no more than 1/4 of a meg - there's
1692 * no point in going beyond the size of L2 cache.
1693 *
1694 * OK, so we don't know how big the cache is. So guess.
1695 */
1696 batch = zone->present_pages / 1024;
1697 if (batch * PAGE_SIZE > 256 * 1024)
1698 batch = (256 * 1024) / PAGE_SIZE;
1699 batch /= 4; /* We effectively *= 4 below */
1700 if (batch < 1)
1701 batch = 1;
1702
1703 /*
1704 * Clamp the batch to a 2^n - 1 value. Having a power
1705 * of 2 value was found to be more likely to have
1706 * suboptimal cache aliasing properties in some cases.
1707 *
1708 * For example if 2 tasks are alternately allocating
1709 * batches of pages, one task can end up with a lot
1710 * of pages of one half of the possible page colors
1711 * and the other with pages of the other colors.
1712 */
1713 batch = (1 << fls(batch + batch/2)) - 1;
1714 return batch;
1715}
1716
1717inline void setup_pageset(struct per_cpu_pageset *p, unsigned long batch)
1718{
1719 struct per_cpu_pages *pcp;
1720
1721 pcp = &p->pcp[0]; /* hot */
1722 pcp->count = 0;
1723 pcp->low = 2 * batch;
1724 pcp->high = 6 * batch;
1725 pcp->batch = max(1UL, 1 * batch);
1726 INIT_LIST_HEAD(&pcp->list);
1727
1728 pcp = &p->pcp[1]; /* cold*/
1729 pcp->count = 0;
1730 pcp->low = 0;
1731 pcp->high = 2 * batch;
1732 pcp->batch = max(1UL, 1 * batch);
1733 INIT_LIST_HEAD(&pcp->list);
1734}
1735
1736#ifdef CONFIG_NUMA
1737/*
1738 * Boot pageset table. One per cpu which is going to be used for all
1739 * zones and all nodes. The parameters will be set in such a way
1740 * that an item put on a list will immediately be handed over to
1741 * the buddy list. This is safe since pageset manipulation is done
1742 * with interrupts disabled.
1743 *
1744 * Some NUMA counter updates may also be caught by the boot pagesets.
1745 * These will be discarded when bootup is complete.
1746 */
1747static struct per_cpu_pageset
1748 boot_pageset[NR_CPUS] __initdata;
1749
1750/*
1751 * Dynamically allocate memory for the
1752 * per cpu pageset array in struct zone.
1753 */
1754static int __devinit process_zones(int cpu)
1755{
1756 struct zone *zone, *dzone;
1757
1758 for_each_zone(zone) {
1759
1760 zone->pageset[cpu] = kmalloc_node(sizeof(struct per_cpu_pageset),
1761 GFP_KERNEL, cpu_to_node(cpu));
1762 if (!zone->pageset[cpu])
1763 goto bad;
1764
1765 setup_pageset(zone->pageset[cpu], zone_batchsize(zone));
1766 }
1767
1768 return 0;
1769bad:
1770 for_each_zone(dzone) {
1771 if (dzone == zone)
1772 break;
1773 kfree(dzone->pageset[cpu]);
1774 dzone->pageset[cpu] = NULL;
1775 }
1776 return -ENOMEM;
1777}
1778
1779static inline void free_zone_pagesets(int cpu)
1780{
1781#ifdef CONFIG_NUMA
1782 struct zone *zone;
1783
1784 for_each_zone(zone) {
1785 struct per_cpu_pageset *pset = zone_pcp(zone, cpu);
1786
1787 zone_pcp(zone, cpu) = NULL;
1788 kfree(pset);
1789 }
1790#endif
1791}
1792
1793static int __devinit pageset_cpuup_callback(struct notifier_block *nfb,
1794 unsigned long action,
1795 void *hcpu)
1796{
1797 int cpu = (long)hcpu;
1798 int ret = NOTIFY_OK;
1799
1800 switch (action) {
1801 case CPU_UP_PREPARE:
1802 if (process_zones(cpu))
1803 ret = NOTIFY_BAD;
1804 break;
1805#ifdef CONFIG_HOTPLUG_CPU
1806 case CPU_DEAD:
1807 free_zone_pagesets(cpu);
1808 break;
1809#endif
1810 default:
1811 break;
1812 }
1813 return ret;
1814}
1815
1816static struct notifier_block pageset_notifier =
1817 { &pageset_cpuup_callback, NULL, 0 };
1818
1819void __init setup_per_cpu_pageset()
1820{
1821 int err;
1822
1823 /* Initialize per_cpu_pageset for cpu 0.
1824 * A cpuup callback will do this for every cpu
1825 * as it comes online
1826 */
1827 err = process_zones(smp_processor_id());
1828 BUG_ON(err);
1829 register_cpu_notifier(&pageset_notifier);
1830}
1831
1832#endif
1833
1623/* 1834/*
1624 * Set up the zone data structures: 1835 * Set up the zone data structures:
1625 * - mark all pages reserved 1836 * - mark all pages reserved
@@ -1662,48 +1873,16 @@ static void __init free_area_init_core(struct pglist_data *pgdat,
1662 1873
1663 zone->temp_priority = zone->prev_priority = DEF_PRIORITY; 1874 zone->temp_priority = zone->prev_priority = DEF_PRIORITY;
1664 1875
1665 /* 1876 batch = zone_batchsize(zone);
1666 * The per-cpu-pages pools are set to around 1000th of the
1667 * size of the zone. But no more than 1/4 of a meg - there's
1668 * no point in going beyond the size of L2 cache.
1669 *
1670 * OK, so we don't know how big the cache is. So guess.
1671 */
1672 batch = zone->present_pages / 1024;
1673 if (batch * PAGE_SIZE > 256 * 1024)
1674 batch = (256 * 1024) / PAGE_SIZE;
1675 batch /= 4; /* We effectively *= 4 below */
1676 if (batch < 1)
1677 batch = 1;
1678
1679 /*
1680 * Clamp the batch to a 2^n - 1 value. Having a power
1681 * of 2 value was found to be more likely to have
1682 * suboptimal cache aliasing properties in some cases.
1683 *
1684 * For example if 2 tasks are alternately allocating
1685 * batches of pages, one task can end up with a lot
1686 * of pages of one half of the possible page colors
1687 * and the other with pages of the other colors.
1688 */
1689 batch = (1 << fls(batch + batch/2)) - 1;
1690 1877
1691 for (cpu = 0; cpu < NR_CPUS; cpu++) { 1878 for (cpu = 0; cpu < NR_CPUS; cpu++) {
1692 struct per_cpu_pages *pcp; 1879#ifdef CONFIG_NUMA
1693 1880 /* Early boot. Slab allocator not functional yet */
1694 pcp = &zone->pageset[cpu].pcp[0]; /* hot */ 1881 zone->pageset[cpu] = &boot_pageset[cpu];
1695 pcp->count = 0; 1882 setup_pageset(&boot_pageset[cpu],0);
1696 pcp->low = 2 * batch; 1883#else
1697 pcp->high = 6 * batch; 1884 setup_pageset(zone_pcp(zone,cpu), batch);
1698 pcp->batch = 1 * batch; 1885#endif
1699 INIT_LIST_HEAD(&pcp->list);
1700
1701 pcp = &zone->pageset[cpu].pcp[1]; /* cold */
1702 pcp->count = 0;
1703 pcp->low = 0;
1704 pcp->high = 2 * batch;
1705 pcp->batch = 1 * batch;
1706 INIT_LIST_HEAD(&pcp->list);
1707 } 1886 }
1708 printk(KERN_DEBUG " %s zone: %lu pages, LIFO batch:%lu\n", 1887 printk(KERN_DEBUG " %s zone: %lu pages, LIFO batch:%lu\n",
1709 zone_names[j], realsize, batch); 1888 zone_names[j], realsize, batch);
@@ -1713,6 +1892,7 @@ static void __init free_area_init_core(struct pglist_data *pgdat,
1713 zone->nr_scan_inactive = 0; 1892 zone->nr_scan_inactive = 0;
1714 zone->nr_active = 0; 1893 zone->nr_active = 0;
1715 zone->nr_inactive = 0; 1894 zone->nr_inactive = 0;
1895 atomic_set(&zone->reclaim_in_progress, -1);
1716 if (!size) 1896 if (!size)
1717 continue; 1897 continue;
1718 1898
@@ -1853,6 +2033,115 @@ struct seq_operations fragmentation_op = {
1853 .show = frag_show, 2033 .show = frag_show,
1854}; 2034};
1855 2035
2036/*
2037 * Output information about zones in @pgdat.
2038 */
2039static int zoneinfo_show(struct seq_file *m, void *arg)
2040{
2041 pg_data_t *pgdat = arg;
2042 struct zone *zone;
2043 struct zone *node_zones = pgdat->node_zones;
2044 unsigned long flags;
2045
2046 for (zone = node_zones; zone - node_zones < MAX_NR_ZONES; zone++) {
2047 int i;
2048
2049 if (!zone->present_pages)
2050 continue;
2051
2052 spin_lock_irqsave(&zone->lock, flags);
2053 seq_printf(m, "Node %d, zone %8s", pgdat->node_id, zone->name);
2054 seq_printf(m,
2055 "\n pages free %lu"
2056 "\n min %lu"
2057 "\n low %lu"
2058 "\n high %lu"
2059 "\n active %lu"
2060 "\n inactive %lu"
2061 "\n scanned %lu (a: %lu i: %lu)"
2062 "\n spanned %lu"
2063 "\n present %lu",
2064 zone->free_pages,
2065 zone->pages_min,
2066 zone->pages_low,
2067 zone->pages_high,
2068 zone->nr_active,
2069 zone->nr_inactive,
2070 zone->pages_scanned,
2071 zone->nr_scan_active, zone->nr_scan_inactive,
2072 zone->spanned_pages,
2073 zone->present_pages);
2074 seq_printf(m,
2075 "\n protection: (%lu",
2076 zone->lowmem_reserve[0]);
2077 for (i = 1; i < ARRAY_SIZE(zone->lowmem_reserve); i++)
2078 seq_printf(m, ", %lu", zone->lowmem_reserve[i]);
2079 seq_printf(m,
2080 ")"
2081 "\n pagesets");
2082 for (i = 0; i < ARRAY_SIZE(zone->pageset); i++) {
2083 struct per_cpu_pageset *pageset;
2084 int j;
2085
2086 pageset = zone_pcp(zone, i);
2087 for (j = 0; j < ARRAY_SIZE(pageset->pcp); j++) {
2088 if (pageset->pcp[j].count)
2089 break;
2090 }
2091 if (j == ARRAY_SIZE(pageset->pcp))
2092 continue;
2093 for (j = 0; j < ARRAY_SIZE(pageset->pcp); j++) {
2094 seq_printf(m,
2095 "\n cpu: %i pcp: %i"
2096 "\n count: %i"
2097 "\n low: %i"
2098 "\n high: %i"
2099 "\n batch: %i",
2100 i, j,
2101 pageset->pcp[j].count,
2102 pageset->pcp[j].low,
2103 pageset->pcp[j].high,
2104 pageset->pcp[j].batch);
2105 }
2106#ifdef CONFIG_NUMA
2107 seq_printf(m,
2108 "\n numa_hit: %lu"
2109 "\n numa_miss: %lu"
2110 "\n numa_foreign: %lu"
2111 "\n interleave_hit: %lu"
2112 "\n local_node: %lu"
2113 "\n other_node: %lu",
2114 pageset->numa_hit,
2115 pageset->numa_miss,
2116 pageset->numa_foreign,
2117 pageset->interleave_hit,
2118 pageset->local_node,
2119 pageset->other_node);
2120#endif
2121 }
2122 seq_printf(m,
2123 "\n all_unreclaimable: %u"
2124 "\n prev_priority: %i"
2125 "\n temp_priority: %i"
2126 "\n start_pfn: %lu",
2127 zone->all_unreclaimable,
2128 zone->prev_priority,
2129 zone->temp_priority,
2130 zone->zone_start_pfn);
2131 spin_unlock_irqrestore(&zone->lock, flags);
2132 seq_putc(m, '\n');
2133 }
2134 return 0;
2135}
2136
2137struct seq_operations zoneinfo_op = {
2138 .start = frag_start, /* iterate over all zones. The same as in
2139 * fragmentation. */
2140 .next = frag_next,
2141 .stop = frag_stop,
2142 .show = zoneinfo_show,
2143};
2144
1856static char *vmstat_text[] = { 2145static char *vmstat_text[] = {
1857 "nr_dirty", 2146 "nr_dirty",
1858 "nr_writeback", 2147 "nr_writeback",
@@ -2058,10 +2347,10 @@ static void setup_per_zone_pages_min(void)
2058 min_pages = 128; 2347 min_pages = 128;
2059 zone->pages_min = min_pages; 2348 zone->pages_min = min_pages;
2060 } else { 2349 } else {
2061 /* if it's a lowmem zone, reserve a number of pages 2350 /* if it's a lowmem zone, reserve a number of pages
2062 * proportionate to the zone's size. 2351 * proportionate to the zone's size.
2063 */ 2352 */
2064 zone->pages_min = (pages_min * zone->present_pages) / 2353 zone->pages_min = (pages_min * zone->present_pages) /
2065 lowmem_pages; 2354 lowmem_pages;
2066 } 2355 }
2067 2356
diff --git a/mm/rmap.c b/mm/rmap.c
index 9827409eb7c7..89770bd25f31 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -539,27 +539,6 @@ static int try_to_unmap_one(struct page *page, struct vm_area_struct *vma)
539 goto out_unmap; 539 goto out_unmap;
540 } 540 }
541 541
542 /*
543 * Don't pull an anonymous page out from under get_user_pages.
544 * GUP carefully breaks COW and raises page count (while holding
545 * page_table_lock, as we have here) to make sure that the page
546 * cannot be freed. If we unmap that page here, a user write
547 * access to the virtual address will bring back the page, but
548 * its raised count will (ironically) be taken to mean it's not
549 * an exclusive swap page, do_wp_page will replace it by a copy
550 * page, and the user never get to see the data GUP was holding
551 * the original page for.
552 *
553 * This test is also useful for when swapoff (unuse_process) has
554 * to drop page lock: its reference to the page stops existing
555 * ptes from being unmapped, so swapoff can make progress.
556 */
557 if (PageSwapCache(page) &&
558 page_count(page) != page_mapcount(page) + 2) {
559 ret = SWAP_FAIL;
560 goto out_unmap;
561 }
562
563 /* Nuke the page table entry. */ 542 /* Nuke the page table entry. */
564 flush_cache_page(vma, address, page_to_pfn(page)); 543 flush_cache_page(vma, address, page_to_pfn(page));
565 pteval = ptep_clear_flush(vma, address, pte); 544 pteval = ptep_clear_flush(vma, address, pte);
diff --git a/mm/shmem.c b/mm/shmem.c
index 61574b81d979..e64fa726a790 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -6,8 +6,8 @@
6 * 2000-2001 Christoph Rohland 6 * 2000-2001 Christoph Rohland
7 * 2000-2001 SAP AG 7 * 2000-2001 SAP AG
8 * 2002 Red Hat Inc. 8 * 2002 Red Hat Inc.
9 * Copyright (C) 2002-2004 Hugh Dickins. 9 * Copyright (C) 2002-2005 Hugh Dickins.
10 * Copyright (C) 2002-2004 VERITAS Software Corporation. 10 * Copyright (C) 2002-2005 VERITAS Software Corporation.
11 * Copyright (C) 2004 Andi Kleen, SuSE Labs 11 * Copyright (C) 2004 Andi Kleen, SuSE Labs
12 * 12 *
13 * Extended attribute support for tmpfs: 13 * Extended attribute support for tmpfs:
@@ -194,7 +194,7 @@ static DEFINE_SPINLOCK(shmem_swaplist_lock);
194static void shmem_free_blocks(struct inode *inode, long pages) 194static void shmem_free_blocks(struct inode *inode, long pages)
195{ 195{
196 struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb); 196 struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb);
197 if (sbinfo) { 197 if (sbinfo->max_blocks) {
198 spin_lock(&sbinfo->stat_lock); 198 spin_lock(&sbinfo->stat_lock);
199 sbinfo->free_blocks += pages; 199 sbinfo->free_blocks += pages;
200 inode->i_blocks -= pages*BLOCKS_PER_PAGE; 200 inode->i_blocks -= pages*BLOCKS_PER_PAGE;
@@ -357,7 +357,7 @@ static swp_entry_t *shmem_swp_alloc(struct shmem_inode_info *info, unsigned long
357 * page (and perhaps indirect index pages) yet to allocate: 357 * page (and perhaps indirect index pages) yet to allocate:
358 * a waste to allocate index if we cannot allocate data. 358 * a waste to allocate index if we cannot allocate data.
359 */ 359 */
360 if (sbinfo) { 360 if (sbinfo->max_blocks) {
361 spin_lock(&sbinfo->stat_lock); 361 spin_lock(&sbinfo->stat_lock);
362 if (sbinfo->free_blocks <= 1) { 362 if (sbinfo->free_blocks <= 1) {
363 spin_unlock(&sbinfo->stat_lock); 363 spin_unlock(&sbinfo->stat_lock);
@@ -677,8 +677,8 @@ static void shmem_delete_inode(struct inode *inode)
677 spin_unlock(&shmem_swaplist_lock); 677 spin_unlock(&shmem_swaplist_lock);
678 } 678 }
679 } 679 }
680 if (sbinfo) { 680 BUG_ON(inode->i_blocks);
681 BUG_ON(inode->i_blocks); 681 if (sbinfo->max_inodes) {
682 spin_lock(&sbinfo->stat_lock); 682 spin_lock(&sbinfo->stat_lock);
683 sbinfo->free_inodes++; 683 sbinfo->free_inodes++;
684 spin_unlock(&sbinfo->stat_lock); 684 spin_unlock(&sbinfo->stat_lock);
@@ -1080,7 +1080,7 @@ repeat:
1080 } else { 1080 } else {
1081 shmem_swp_unmap(entry); 1081 shmem_swp_unmap(entry);
1082 sbinfo = SHMEM_SB(inode->i_sb); 1082 sbinfo = SHMEM_SB(inode->i_sb);
1083 if (sbinfo) { 1083 if (sbinfo->max_blocks) {
1084 spin_lock(&sbinfo->stat_lock); 1084 spin_lock(&sbinfo->stat_lock);
1085 if (sbinfo->free_blocks == 0 || 1085 if (sbinfo->free_blocks == 0 ||
1086 shmem_acct_block(info->flags)) { 1086 shmem_acct_block(info->flags)) {
@@ -1269,7 +1269,7 @@ shmem_get_inode(struct super_block *sb, int mode, dev_t dev)
1269 struct shmem_inode_info *info; 1269 struct shmem_inode_info *info;
1270 struct shmem_sb_info *sbinfo = SHMEM_SB(sb); 1270 struct shmem_sb_info *sbinfo = SHMEM_SB(sb);
1271 1271
1272 if (sbinfo) { 1272 if (sbinfo->max_inodes) {
1273 spin_lock(&sbinfo->stat_lock); 1273 spin_lock(&sbinfo->stat_lock);
1274 if (!sbinfo->free_inodes) { 1274 if (!sbinfo->free_inodes) {
1275 spin_unlock(&sbinfo->stat_lock); 1275 spin_unlock(&sbinfo->stat_lock);
@@ -1319,7 +1319,7 @@ shmem_get_inode(struct super_block *sb, int mode, dev_t dev)
1319 mpol_shared_policy_init(&info->policy); 1319 mpol_shared_policy_init(&info->policy);
1320 break; 1320 break;
1321 } 1321 }
1322 } else if (sbinfo) { 1322 } else if (sbinfo->max_inodes) {
1323 spin_lock(&sbinfo->stat_lock); 1323 spin_lock(&sbinfo->stat_lock);
1324 sbinfo->free_inodes++; 1324 sbinfo->free_inodes++;
1325 spin_unlock(&sbinfo->stat_lock); 1325 spin_unlock(&sbinfo->stat_lock);
@@ -1328,31 +1328,6 @@ shmem_get_inode(struct super_block *sb, int mode, dev_t dev)
1328} 1328}
1329 1329
1330#ifdef CONFIG_TMPFS 1330#ifdef CONFIG_TMPFS
1331
1332static int shmem_set_size(struct shmem_sb_info *sbinfo,
1333 unsigned long max_blocks, unsigned long max_inodes)
1334{
1335 int error;
1336 unsigned long blocks, inodes;
1337
1338 spin_lock(&sbinfo->stat_lock);
1339 blocks = sbinfo->max_blocks - sbinfo->free_blocks;
1340 inodes = sbinfo->max_inodes - sbinfo->free_inodes;
1341 error = -EINVAL;
1342 if (max_blocks < blocks)
1343 goto out;
1344 if (max_inodes < inodes)
1345 goto out;
1346 error = 0;
1347 sbinfo->max_blocks = max_blocks;
1348 sbinfo->free_blocks = max_blocks - blocks;
1349 sbinfo->max_inodes = max_inodes;
1350 sbinfo->free_inodes = max_inodes - inodes;
1351out:
1352 spin_unlock(&sbinfo->stat_lock);
1353 return error;
1354}
1355
1356static struct inode_operations shmem_symlink_inode_operations; 1331static struct inode_operations shmem_symlink_inode_operations;
1357static struct inode_operations shmem_symlink_inline_operations; 1332static struct inode_operations shmem_symlink_inline_operations;
1358 1333
@@ -1607,15 +1582,17 @@ static int shmem_statfs(struct super_block *sb, struct kstatfs *buf)
1607 buf->f_type = TMPFS_MAGIC; 1582 buf->f_type = TMPFS_MAGIC;
1608 buf->f_bsize = PAGE_CACHE_SIZE; 1583 buf->f_bsize = PAGE_CACHE_SIZE;
1609 buf->f_namelen = NAME_MAX; 1584 buf->f_namelen = NAME_MAX;
1610 if (sbinfo) { 1585 spin_lock(&sbinfo->stat_lock);
1611 spin_lock(&sbinfo->stat_lock); 1586 if (sbinfo->max_blocks) {
1612 buf->f_blocks = sbinfo->max_blocks; 1587 buf->f_blocks = sbinfo->max_blocks;
1613 buf->f_bavail = buf->f_bfree = sbinfo->free_blocks; 1588 buf->f_bavail = buf->f_bfree = sbinfo->free_blocks;
1589 }
1590 if (sbinfo->max_inodes) {
1614 buf->f_files = sbinfo->max_inodes; 1591 buf->f_files = sbinfo->max_inodes;
1615 buf->f_ffree = sbinfo->free_inodes; 1592 buf->f_ffree = sbinfo->free_inodes;
1616 spin_unlock(&sbinfo->stat_lock);
1617 } 1593 }
1618 /* else leave those fields 0 like simple_statfs */ 1594 /* else leave those fields 0 like simple_statfs */
1595 spin_unlock(&sbinfo->stat_lock);
1619 return 0; 1596 return 0;
1620} 1597}
1621 1598
@@ -1672,7 +1649,7 @@ static int shmem_link(struct dentry *old_dentry, struct inode *dir, struct dentr
1672 * but each new link needs a new dentry, pinning lowmem, and 1649 * but each new link needs a new dentry, pinning lowmem, and
1673 * tmpfs dentries cannot be pruned until they are unlinked. 1650 * tmpfs dentries cannot be pruned until they are unlinked.
1674 */ 1651 */
1675 if (sbinfo) { 1652 if (sbinfo->max_inodes) {
1676 spin_lock(&sbinfo->stat_lock); 1653 spin_lock(&sbinfo->stat_lock);
1677 if (!sbinfo->free_inodes) { 1654 if (!sbinfo->free_inodes) {
1678 spin_unlock(&sbinfo->stat_lock); 1655 spin_unlock(&sbinfo->stat_lock);
@@ -1697,7 +1674,7 @@ static int shmem_unlink(struct inode *dir, struct dentry *dentry)
1697 1674
1698 if (inode->i_nlink > 1 && !S_ISDIR(inode->i_mode)) { 1675 if (inode->i_nlink > 1 && !S_ISDIR(inode->i_mode)) {
1699 struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb); 1676 struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb);
1700 if (sbinfo) { 1677 if (sbinfo->max_inodes) {
1701 spin_lock(&sbinfo->stat_lock); 1678 spin_lock(&sbinfo->stat_lock);
1702 sbinfo->free_inodes++; 1679 sbinfo->free_inodes++;
1703 spin_unlock(&sbinfo->stat_lock); 1680 spin_unlock(&sbinfo->stat_lock);
@@ -1921,22 +1898,42 @@ bad_val:
1921static int shmem_remount_fs(struct super_block *sb, int *flags, char *data) 1898static int shmem_remount_fs(struct super_block *sb, int *flags, char *data)
1922{ 1899{
1923 struct shmem_sb_info *sbinfo = SHMEM_SB(sb); 1900 struct shmem_sb_info *sbinfo = SHMEM_SB(sb);
1924 unsigned long max_blocks = 0; 1901 unsigned long max_blocks = sbinfo->max_blocks;
1925 unsigned long max_inodes = 0; 1902 unsigned long max_inodes = sbinfo->max_inodes;
1903 unsigned long blocks;
1904 unsigned long inodes;
1905 int error = -EINVAL;
1906
1907 if (shmem_parse_options(data, NULL, NULL, NULL,
1908 &max_blocks, &max_inodes))
1909 return error;
1926 1910
1927 if (sbinfo) { 1911 spin_lock(&sbinfo->stat_lock);
1928 max_blocks = sbinfo->max_blocks; 1912 blocks = sbinfo->max_blocks - sbinfo->free_blocks;
1929 max_inodes = sbinfo->max_inodes; 1913 inodes = sbinfo->max_inodes - sbinfo->free_inodes;
1930 } 1914 if (max_blocks < blocks)
1931 if (shmem_parse_options(data, NULL, NULL, NULL, &max_blocks, &max_inodes)) 1915 goto out;
1932 return -EINVAL; 1916 if (max_inodes < inodes)
1933 /* Keep it simple: disallow limited <-> unlimited remount */ 1917 goto out;
1934 if ((max_blocks || max_inodes) == !sbinfo) 1918 /*
1935 return -EINVAL; 1919 * Those tests also disallow limited->unlimited while any are in
1936 /* But allow the pointless unlimited -> unlimited remount */ 1920 * use, so i_blocks will always be zero when max_blocks is zero;
1937 if (!sbinfo) 1921 * but we must separately disallow unlimited->limited, because
1938 return 0; 1922 * in that case we have no record of how much is already in use.
1939 return shmem_set_size(sbinfo, max_blocks, max_inodes); 1923 */
1924 if (max_blocks && !sbinfo->max_blocks)
1925 goto out;
1926 if (max_inodes && !sbinfo->max_inodes)
1927 goto out;
1928
1929 error = 0;
1930 sbinfo->max_blocks = max_blocks;
1931 sbinfo->free_blocks = max_blocks - blocks;
1932 sbinfo->max_inodes = max_inodes;
1933 sbinfo->free_inodes = max_inodes - inodes;
1934out:
1935 spin_unlock(&sbinfo->stat_lock);
1936 return error;
1940} 1937}
1941#endif 1938#endif
1942 1939
@@ -1961,11 +1958,11 @@ static int shmem_fill_super(struct super_block *sb,
1961 uid_t uid = current->fsuid; 1958 uid_t uid = current->fsuid;
1962 gid_t gid = current->fsgid; 1959 gid_t gid = current->fsgid;
1963 int err = -ENOMEM; 1960 int err = -ENOMEM;
1964 1961 struct shmem_sb_info *sbinfo;
1965#ifdef CONFIG_TMPFS
1966 unsigned long blocks = 0; 1962 unsigned long blocks = 0;
1967 unsigned long inodes = 0; 1963 unsigned long inodes = 0;
1968 1964
1965#ifdef CONFIG_TMPFS
1969 /* 1966 /*
1970 * Per default we only allow half of the physical ram per 1967 * Per default we only allow half of the physical ram per
1971 * tmpfs instance, limiting inodes to one per page of lowmem; 1968 * tmpfs instance, limiting inodes to one per page of lowmem;
@@ -1976,34 +1973,34 @@ static int shmem_fill_super(struct super_block *sb,
1976 inodes = totalram_pages - totalhigh_pages; 1973 inodes = totalram_pages - totalhigh_pages;
1977 if (inodes > blocks) 1974 if (inodes > blocks)
1978 inodes = blocks; 1975 inodes = blocks;
1979 1976 if (shmem_parse_options(data, &mode, &uid, &gid,
1980 if (shmem_parse_options(data, &mode, 1977 &blocks, &inodes))
1981 &uid, &gid, &blocks, &inodes))
1982 return -EINVAL; 1978 return -EINVAL;
1983 } 1979 }
1984
1985 if (blocks || inodes) {
1986 struct shmem_sb_info *sbinfo;
1987 sbinfo = kmalloc(sizeof(struct shmem_sb_info), GFP_KERNEL);
1988 if (!sbinfo)
1989 return -ENOMEM;
1990 sb->s_fs_info = sbinfo;
1991 spin_lock_init(&sbinfo->stat_lock);
1992 sbinfo->max_blocks = blocks;
1993 sbinfo->free_blocks = blocks;
1994 sbinfo->max_inodes = inodes;
1995 sbinfo->free_inodes = inodes;
1996 }
1997 sb->s_xattr = shmem_xattr_handlers;
1998#else 1980#else
1999 sb->s_flags |= MS_NOUSER; 1981 sb->s_flags |= MS_NOUSER;
2000#endif 1982#endif
2001 1983
1984 /* Round up to L1_CACHE_BYTES to resist false sharing */
1985 sbinfo = kmalloc(max((int)sizeof(struct shmem_sb_info),
1986 L1_CACHE_BYTES), GFP_KERNEL);
1987 if (!sbinfo)
1988 return -ENOMEM;
1989
1990 spin_lock_init(&sbinfo->stat_lock);
1991 sbinfo->max_blocks = blocks;
1992 sbinfo->free_blocks = blocks;
1993 sbinfo->max_inodes = inodes;
1994 sbinfo->free_inodes = inodes;
1995
1996 sb->s_fs_info = sbinfo;
2002 sb->s_maxbytes = SHMEM_MAX_BYTES; 1997 sb->s_maxbytes = SHMEM_MAX_BYTES;
2003 sb->s_blocksize = PAGE_CACHE_SIZE; 1998 sb->s_blocksize = PAGE_CACHE_SIZE;
2004 sb->s_blocksize_bits = PAGE_CACHE_SHIFT; 1999 sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
2005 sb->s_magic = TMPFS_MAGIC; 2000 sb->s_magic = TMPFS_MAGIC;
2006 sb->s_op = &shmem_ops; 2001 sb->s_op = &shmem_ops;
2002 sb->s_xattr = shmem_xattr_handlers;
2003
2007 inode = shmem_get_inode(sb, S_IFDIR | mode, 0); 2004 inode = shmem_get_inode(sb, S_IFDIR | mode, 0);
2008 if (!inode) 2005 if (!inode)
2009 goto failed; 2006 goto failed;
diff --git a/mm/slab.c b/mm/slab.c
index c78d343b3c5f..93cbbbb39f42 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -2851,6 +2851,7 @@ next:
2851 } 2851 }
2852 check_irq_on(); 2852 check_irq_on();
2853 up(&cache_chain_sem); 2853 up(&cache_chain_sem);
2854 drain_remote_pages();
2854 /* Setup the next iteration */ 2855 /* Setup the next iteration */
2855 schedule_delayed_work(&__get_cpu_var(reap_work), REAPTIMEOUT_CPUC + smp_processor_id()); 2856 schedule_delayed_work(&__get_cpu_var(reap_work), REAPTIMEOUT_CPUC + smp_processor_id());
2856} 2857}
diff --git a/mm/swapfile.c b/mm/swapfile.c
index da48405cd9a3..60cd24a55204 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -276,61 +276,37 @@ void swap_free(swp_entry_t entry)
276} 276}
277 277
278/* 278/*
279 * Check if we're the only user of a swap page, 279 * How many references to page are currently swapped out?
280 * when the page is locked.
281 */ 280 */
282static int exclusive_swap_page(struct page *page) 281static inline int page_swapcount(struct page *page)
283{ 282{
284 int retval = 0; 283 int count = 0;
285 struct swap_info_struct * p; 284 struct swap_info_struct *p;
286 swp_entry_t entry; 285 swp_entry_t entry;
287 286
288 entry.val = page->private; 287 entry.val = page->private;
289 p = swap_info_get(entry); 288 p = swap_info_get(entry);
290 if (p) { 289 if (p) {
291 /* Is the only swap cache user the cache itself? */ 290 /* Subtract the 1 for the swap cache itself */
292 if (p->swap_map[swp_offset(entry)] == 1) { 291 count = p->swap_map[swp_offset(entry)] - 1;
293 /* Recheck the page count with the swapcache lock held.. */
294 write_lock_irq(&swapper_space.tree_lock);
295 if (page_count(page) == 2)
296 retval = 1;
297 write_unlock_irq(&swapper_space.tree_lock);
298 }
299 swap_info_put(p); 292 swap_info_put(p);
300 } 293 }
301 return retval; 294 return count;
302} 295}
303 296
304/* 297/*
305 * We can use this swap cache entry directly 298 * We can use this swap cache entry directly
306 * if there are no other references to it. 299 * if there are no other references to it.
307 *
308 * Here "exclusive_swap_page()" does the real
309 * work, but we opportunistically check whether
310 * we need to get all the locks first..
311 */ 300 */
312int can_share_swap_page(struct page *page) 301int can_share_swap_page(struct page *page)
313{ 302{
314 int retval = 0; 303 int count;
315 304
316 if (!PageLocked(page)) 305 BUG_ON(!PageLocked(page));
317 BUG(); 306 count = page_mapcount(page);
318 switch (page_count(page)) { 307 if (count <= 1 && PageSwapCache(page))
319 case 3: 308 count += page_swapcount(page);
320 if (!PagePrivate(page)) 309 return count == 1;
321 break;
322 /* Fallthrough */
323 case 2:
324 if (!PageSwapCache(page))
325 break;
326 retval = exclusive_swap_page(page);
327 break;
328 case 1:
329 if (PageReserved(page))
330 break;
331 retval = 1;
332 }
333 return retval;
334} 310}
335 311
336/* 312/*
@@ -529,9 +505,10 @@ static int unuse_mm(struct mm_struct *mm,
529 505
530 if (!down_read_trylock(&mm->mmap_sem)) { 506 if (!down_read_trylock(&mm->mmap_sem)) {
531 /* 507 /*
532 * Our reference to the page stops try_to_unmap_one from 508 * Activate page so shrink_cache is unlikely to unmap its
533 * unmapping its ptes, so swapoff can make progress. 509 * ptes while lock is dropped, so swapoff can make progress.
534 */ 510 */
511 activate_page(page);
535 unlock_page(page); 512 unlock_page(page);
536 down_read(&mm->mmap_sem); 513 down_read(&mm->mmap_sem);
537 lock_page(page); 514 lock_page(page);
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 269eded9b459..4b8e62a19370 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -74,6 +74,9 @@ struct scan_control {
74 74
75 int may_writepage; 75 int may_writepage;
76 76
77 /* Can pages be swapped as part of reclaim? */
78 int may_swap;
79
77 /* This context's SWAP_CLUSTER_MAX. If freeing memory for 80 /* This context's SWAP_CLUSTER_MAX. If freeing memory for
78 * suspend, we effectively ignore SWAP_CLUSTER_MAX. 81 * suspend, we effectively ignore SWAP_CLUSTER_MAX.
79 * In this context, it doesn't matter that we scan the 82 * In this context, it doesn't matter that we scan the
@@ -180,17 +183,20 @@ EXPORT_SYMBOL(remove_shrinker);
180 * `lru_pages' represents the number of on-LRU pages in all the zones which 183 * `lru_pages' represents the number of on-LRU pages in all the zones which
181 * are eligible for the caller's allocation attempt. It is used for balancing 184 * are eligible for the caller's allocation attempt. It is used for balancing
182 * slab reclaim versus page reclaim. 185 * slab reclaim versus page reclaim.
186 *
187 * Returns the number of slab objects which we shrunk.
183 */ 188 */
184static int shrink_slab(unsigned long scanned, unsigned int gfp_mask, 189static int shrink_slab(unsigned long scanned, unsigned int gfp_mask,
185 unsigned long lru_pages) 190 unsigned long lru_pages)
186{ 191{
187 struct shrinker *shrinker; 192 struct shrinker *shrinker;
193 int ret = 0;
188 194
189 if (scanned == 0) 195 if (scanned == 0)
190 scanned = SWAP_CLUSTER_MAX; 196 scanned = SWAP_CLUSTER_MAX;
191 197
192 if (!down_read_trylock(&shrinker_rwsem)) 198 if (!down_read_trylock(&shrinker_rwsem))
193 return 0; 199 return 1; /* Assume we'll be able to shrink next time */
194 200
195 list_for_each_entry(shrinker, &shrinker_list, list) { 201 list_for_each_entry(shrinker, &shrinker_list, list) {
196 unsigned long long delta; 202 unsigned long long delta;
@@ -209,10 +215,14 @@ static int shrink_slab(unsigned long scanned, unsigned int gfp_mask,
209 while (total_scan >= SHRINK_BATCH) { 215 while (total_scan >= SHRINK_BATCH) {
210 long this_scan = SHRINK_BATCH; 216 long this_scan = SHRINK_BATCH;
211 int shrink_ret; 217 int shrink_ret;
218 int nr_before;
212 219
220 nr_before = (*shrinker->shrinker)(0, gfp_mask);
213 shrink_ret = (*shrinker->shrinker)(this_scan, gfp_mask); 221 shrink_ret = (*shrinker->shrinker)(this_scan, gfp_mask);
214 if (shrink_ret == -1) 222 if (shrink_ret == -1)
215 break; 223 break;
224 if (shrink_ret < nr_before)
225 ret += nr_before - shrink_ret;
216 mod_page_state(slabs_scanned, this_scan); 226 mod_page_state(slabs_scanned, this_scan);
217 total_scan -= this_scan; 227 total_scan -= this_scan;
218 228
@@ -222,7 +232,7 @@ static int shrink_slab(unsigned long scanned, unsigned int gfp_mask,
222 shrinker->nr += total_scan; 232 shrinker->nr += total_scan;
223 } 233 }
224 up_read(&shrinker_rwsem); 234 up_read(&shrinker_rwsem);
225 return 0; 235 return ret;
226} 236}
227 237
228/* Called without lock on whether page is mapped, so answer is unstable */ 238/* Called without lock on whether page is mapped, so answer is unstable */
@@ -407,7 +417,7 @@ static int shrink_list(struct list_head *page_list, struct scan_control *sc)
407 * Anonymous process memory has backing store? 417 * Anonymous process memory has backing store?
408 * Try to allocate it some swap space here. 418 * Try to allocate it some swap space here.
409 */ 419 */
410 if (PageAnon(page) && !PageSwapCache(page)) { 420 if (PageAnon(page) && !PageSwapCache(page) && sc->may_swap) {
411 if (!add_to_swap(page)) 421 if (!add_to_swap(page))
412 goto activate_locked; 422 goto activate_locked;
413 } 423 }
@@ -890,7 +900,9 @@ shrink_caches(struct zone **zones, struct scan_control *sc)
890 if (zone->all_unreclaimable && sc->priority != DEF_PRIORITY) 900 if (zone->all_unreclaimable && sc->priority != DEF_PRIORITY)
891 continue; /* Let kswapd poll it */ 901 continue; /* Let kswapd poll it */
892 902
903 atomic_inc(&zone->reclaim_in_progress);
893 shrink_zone(zone, sc); 904 shrink_zone(zone, sc);
905 atomic_dec(&zone->reclaim_in_progress);
894 } 906 }
895} 907}
896 908
@@ -907,8 +919,7 @@ shrink_caches(struct zone **zones, struct scan_control *sc)
907 * holds filesystem locks which prevent writeout this might not work, and the 919 * holds filesystem locks which prevent writeout this might not work, and the
908 * allocation attempt will fail. 920 * allocation attempt will fail.
909 */ 921 */
910int try_to_free_pages(struct zone **zones, 922int try_to_free_pages(struct zone **zones, unsigned int gfp_mask)
911 unsigned int gfp_mask, unsigned int order)
912{ 923{
913 int priority; 924 int priority;
914 int ret = 0; 925 int ret = 0;
@@ -920,6 +931,7 @@ int try_to_free_pages(struct zone **zones,
920 931
921 sc.gfp_mask = gfp_mask; 932 sc.gfp_mask = gfp_mask;
922 sc.may_writepage = 0; 933 sc.may_writepage = 0;
934 sc.may_swap = 1;
923 935
924 inc_page_state(allocstall); 936 inc_page_state(allocstall);
925 937
@@ -1020,6 +1032,7 @@ loop_again:
1020 total_reclaimed = 0; 1032 total_reclaimed = 0;
1021 sc.gfp_mask = GFP_KERNEL; 1033 sc.gfp_mask = GFP_KERNEL;
1022 sc.may_writepage = 0; 1034 sc.may_writepage = 0;
1035 sc.may_swap = 1;
1023 sc.nr_mapped = read_page_state(nr_mapped); 1036 sc.nr_mapped = read_page_state(nr_mapped);
1024 1037
1025 inc_page_state(pageoutrun); 1038 inc_page_state(pageoutrun);
@@ -1079,6 +1092,7 @@ scan:
1079 */ 1092 */
1080 for (i = 0; i <= end_zone; i++) { 1093 for (i = 0; i <= end_zone; i++) {
1081 struct zone *zone = pgdat->node_zones + i; 1094 struct zone *zone = pgdat->node_zones + i;
1095 int nr_slab;
1082 1096
1083 if (zone->present_pages == 0) 1097 if (zone->present_pages == 0)
1084 continue; 1098 continue;
@@ -1098,16 +1112,19 @@ scan:
1098 sc.nr_reclaimed = 0; 1112 sc.nr_reclaimed = 0;
1099 sc.priority = priority; 1113 sc.priority = priority;
1100 sc.swap_cluster_max = nr_pages? nr_pages : SWAP_CLUSTER_MAX; 1114 sc.swap_cluster_max = nr_pages? nr_pages : SWAP_CLUSTER_MAX;
1115 atomic_inc(&zone->reclaim_in_progress);
1101 shrink_zone(zone, &sc); 1116 shrink_zone(zone, &sc);
1117 atomic_dec(&zone->reclaim_in_progress);
1102 reclaim_state->reclaimed_slab = 0; 1118 reclaim_state->reclaimed_slab = 0;
1103 shrink_slab(sc.nr_scanned, GFP_KERNEL, lru_pages); 1119 nr_slab = shrink_slab(sc.nr_scanned, GFP_KERNEL,
1120 lru_pages);
1104 sc.nr_reclaimed += reclaim_state->reclaimed_slab; 1121 sc.nr_reclaimed += reclaim_state->reclaimed_slab;
1105 total_reclaimed += sc.nr_reclaimed; 1122 total_reclaimed += sc.nr_reclaimed;
1106 total_scanned += sc.nr_scanned; 1123 total_scanned += sc.nr_scanned;
1107 if (zone->all_unreclaimable) 1124 if (zone->all_unreclaimable)
1108 continue; 1125 continue;
1109 if (zone->pages_scanned >= (zone->nr_active + 1126 if (nr_slab == 0 && zone->pages_scanned >=
1110 zone->nr_inactive) * 4) 1127 (zone->nr_active + zone->nr_inactive) * 4)
1111 zone->all_unreclaimable = 1; 1128 zone->all_unreclaimable = 1;
1112 /* 1129 /*
1113 * If we've done a decent amount of scanning and 1130 * If we've done a decent amount of scanning and
@@ -1309,3 +1326,73 @@ static int __init kswapd_init(void)
1309} 1326}
1310 1327
1311module_init(kswapd_init) 1328module_init(kswapd_init)
1329
1330
1331/*
1332 * Try to free up some pages from this zone through reclaim.
1333 */
1334int zone_reclaim(struct zone *zone, unsigned int gfp_mask, unsigned int order)
1335{
1336 struct scan_control sc;
1337 int nr_pages = 1 << order;
1338 int total_reclaimed = 0;
1339
1340 /* The reclaim may sleep, so don't do it if sleep isn't allowed */
1341 if (!(gfp_mask & __GFP_WAIT))
1342 return 0;
1343 if (zone->all_unreclaimable)
1344 return 0;
1345
1346 sc.gfp_mask = gfp_mask;
1347 sc.may_writepage = 0;
1348 sc.may_swap = 0;
1349 sc.nr_mapped = read_page_state(nr_mapped);
1350 sc.nr_scanned = 0;
1351 sc.nr_reclaimed = 0;
1352 /* scan at the highest priority */
1353 sc.priority = 0;
1354
1355 if (nr_pages > SWAP_CLUSTER_MAX)
1356 sc.swap_cluster_max = nr_pages;
1357 else
1358 sc.swap_cluster_max = SWAP_CLUSTER_MAX;
1359
1360 /* Don't reclaim the zone if there are other reclaimers active */
1361 if (!atomic_inc_and_test(&zone->reclaim_in_progress))
1362 goto out;
1363
1364 shrink_zone(zone, &sc);
1365 total_reclaimed = sc.nr_reclaimed;
1366
1367 out:
1368 atomic_dec(&zone->reclaim_in_progress);
1369 return total_reclaimed;
1370}
1371
1372asmlinkage long sys_set_zone_reclaim(unsigned int node, unsigned int zone,
1373 unsigned int state)
1374{
1375 struct zone *z;
1376 int i;
1377
1378 if (node >= MAX_NUMNODES || !node_online(node))
1379 return -EINVAL;
1380
1381 /* This will break if we ever add more zones */
1382 if (!(zone & (1<<ZONE_DMA|1<<ZONE_NORMAL|1<<ZONE_HIGHMEM)))
1383 return -EINVAL;
1384
1385 for (i = 0; i < MAX_NR_ZONES; i++) {
1386 if (!(zone & 1<<i))
1387 continue;
1388
1389 z = &NODE_DATA(node)->node_zones[i];
1390
1391 if (state)
1392 z->reclaim_pages = 1;
1393 else
1394 z->reclaim_pages = 0;
1395 }
1396
1397 return 0;
1398}
diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c
index ef9f2095f96e..069253f830c1 100644
--- a/net/bridge/br_forward.c
+++ b/net/bridge/br_forward.c
@@ -57,9 +57,6 @@ int br_forward_finish(struct sk_buff *skb)
57static void __br_deliver(const struct net_bridge_port *to, struct sk_buff *skb) 57static void __br_deliver(const struct net_bridge_port *to, struct sk_buff *skb)
58{ 58{
59 skb->dev = to->dev; 59 skb->dev = to->dev;
60#ifdef CONFIG_NETFILTER_DEBUG
61 skb->nf_debug = 0;
62#endif
63 NF_HOOK(PF_BRIDGE, NF_BR_LOCAL_OUT, skb, NULL, skb->dev, 60 NF_HOOK(PF_BRIDGE, NF_BR_LOCAL_OUT, skb, NULL, skb->dev,
64 br_forward_finish); 61 br_forward_finish);
65} 62}
diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
index 8f5f2e730992..9a45e6279c57 100644
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
@@ -23,11 +23,7 @@ const unsigned char bridge_ula[6] = { 0x01, 0x80, 0xc2, 0x00, 0x00, 0x00 };
23 23
24static int br_pass_frame_up_finish(struct sk_buff *skb) 24static int br_pass_frame_up_finish(struct sk_buff *skb)
25{ 25{
26#ifdef CONFIG_NETFILTER_DEBUG
27 skb->nf_debug = 0;
28#endif
29 netif_receive_skb(skb); 26 netif_receive_skb(skb);
30
31 return 0; 27 return 0;
32} 28}
33 29
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
index be03d3ad2648..03ae4edddac3 100644
--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -102,10 +102,6 @@ static int br_nf_pre_routing_finish_ipv6(struct sk_buff *skb)
102{ 102{
103 struct nf_bridge_info *nf_bridge = skb->nf_bridge; 103 struct nf_bridge_info *nf_bridge = skb->nf_bridge;
104 104
105#ifdef CONFIG_NETFILTER_DEBUG
106 skb->nf_debug ^= (1 << NF_BR_PRE_ROUTING);
107#endif
108
109 if (nf_bridge->mask & BRNF_PKT_TYPE) { 105 if (nf_bridge->mask & BRNF_PKT_TYPE) {
110 skb->pkt_type = PACKET_OTHERHOST; 106 skb->pkt_type = PACKET_OTHERHOST;
111 nf_bridge->mask ^= BRNF_PKT_TYPE; 107 nf_bridge->mask ^= BRNF_PKT_TYPE;
@@ -182,10 +178,6 @@ static void __br_dnat_complain(void)
182 * --Bart, 20021007 (updated) */ 178 * --Bart, 20021007 (updated) */
183static int br_nf_pre_routing_finish_bridge(struct sk_buff *skb) 179static int br_nf_pre_routing_finish_bridge(struct sk_buff *skb)
184{ 180{
185#ifdef CONFIG_NETFILTER_DEBUG
186 skb->nf_debug |= (1 << NF_BR_PRE_ROUTING) | (1 << NF_BR_FORWARD);
187#endif
188
189 if (skb->pkt_type == PACKET_OTHERHOST) { 181 if (skb->pkt_type == PACKET_OTHERHOST) {
190 skb->pkt_type = PACKET_HOST; 182 skb->pkt_type = PACKET_HOST;
191 skb->nf_bridge->mask |= BRNF_PKT_TYPE; 183 skb->nf_bridge->mask |= BRNF_PKT_TYPE;
@@ -207,10 +199,6 @@ static int br_nf_pre_routing_finish(struct sk_buff *skb)
207 struct iphdr *iph = skb->nh.iph; 199 struct iphdr *iph = skb->nh.iph;
208 struct nf_bridge_info *nf_bridge = skb->nf_bridge; 200 struct nf_bridge_info *nf_bridge = skb->nf_bridge;
209 201
210#ifdef CONFIG_NETFILTER_DEBUG
211 skb->nf_debug ^= (1 << NF_BR_PRE_ROUTING);
212#endif
213
214 if (nf_bridge->mask & BRNF_PKT_TYPE) { 202 if (nf_bridge->mask & BRNF_PKT_TYPE) {
215 skb->pkt_type = PACKET_OTHERHOST; 203 skb->pkt_type = PACKET_OTHERHOST;
216 nf_bridge->mask ^= BRNF_PKT_TYPE; 204 nf_bridge->mask ^= BRNF_PKT_TYPE;
@@ -382,9 +370,6 @@ static unsigned int br_nf_pre_routing_ipv6(unsigned int hook,
382 if (hdr->nexthdr == NEXTHDR_HOP && check_hbh_len(skb)) 370 if (hdr->nexthdr == NEXTHDR_HOP && check_hbh_len(skb))
383 goto inhdr_error; 371 goto inhdr_error;
384 372
385#ifdef CONFIG_NETFILTER_DEBUG
386 skb->nf_debug ^= (1 << NF_IP6_PRE_ROUTING);
387#endif
388 if ((nf_bridge = nf_bridge_alloc(skb)) == NULL) 373 if ((nf_bridge = nf_bridge_alloc(skb)) == NULL)
389 return NF_DROP; 374 return NF_DROP;
390 setup_pre_routing(skb); 375 setup_pre_routing(skb);
@@ -468,9 +453,6 @@ static unsigned int br_nf_pre_routing(unsigned int hook, struct sk_buff **pskb,
468 skb->ip_summed = CHECKSUM_NONE; 453 skb->ip_summed = CHECKSUM_NONE;
469 } 454 }
470 455
471#ifdef CONFIG_NETFILTER_DEBUG
472 skb->nf_debug ^= (1 << NF_IP_PRE_ROUTING);
473#endif
474 if ((nf_bridge = nf_bridge_alloc(skb)) == NULL) 456 if ((nf_bridge = nf_bridge_alloc(skb)) == NULL)
475 return NF_DROP; 457 return NF_DROP;
476 setup_pre_routing(skb); 458 setup_pre_routing(skb);
@@ -517,10 +499,6 @@ static int br_nf_forward_finish(struct sk_buff *skb)
517 struct net_device *in; 499 struct net_device *in;
518 struct vlan_ethhdr *hdr = vlan_eth_hdr(skb); 500 struct vlan_ethhdr *hdr = vlan_eth_hdr(skb);
519 501
520#ifdef CONFIG_NETFILTER_DEBUG
521 skb->nf_debug ^= (1 << NF_BR_FORWARD);
522#endif
523
524 if (skb->protocol != __constant_htons(ETH_P_ARP) && !IS_VLAN_ARP) { 502 if (skb->protocol != __constant_htons(ETH_P_ARP) && !IS_VLAN_ARP) {
525 in = nf_bridge->physindev; 503 in = nf_bridge->physindev;
526 if (nf_bridge->mask & BRNF_PKT_TYPE) { 504 if (nf_bridge->mask & BRNF_PKT_TYPE) {
@@ -566,9 +544,6 @@ static unsigned int br_nf_forward_ip(unsigned int hook, struct sk_buff **pskb,
566 (*pskb)->nh.raw += VLAN_HLEN; 544 (*pskb)->nh.raw += VLAN_HLEN;
567 } 545 }
568 546
569#ifdef CONFIG_NETFILTER_DEBUG
570 skb->nf_debug ^= (1 << NF_BR_FORWARD);
571#endif
572 nf_bridge = skb->nf_bridge; 547 nf_bridge = skb->nf_bridge;
573 if (skb->pkt_type == PACKET_OTHERHOST) { 548 if (skb->pkt_type == PACKET_OTHERHOST) {
574 skb->pkt_type = PACKET_HOST; 549 skb->pkt_type = PACKET_HOST;
@@ -605,10 +580,6 @@ static unsigned int br_nf_forward_arp(unsigned int hook, struct sk_buff **pskb,
605 (*pskb)->nh.raw += VLAN_HLEN; 580 (*pskb)->nh.raw += VLAN_HLEN;
606 } 581 }
607 582
608#ifdef CONFIG_NETFILTER_DEBUG
609 skb->nf_debug ^= (1 << NF_BR_FORWARD);
610#endif
611
612 if (skb->nh.arph->ar_pln != 4) { 583 if (skb->nh.arph->ar_pln != 4) {
613 if (IS_VLAN_ARP) { 584 if (IS_VLAN_ARP) {
614 skb_push(*pskb, VLAN_HLEN); 585 skb_push(*pskb, VLAN_HLEN);
@@ -627,9 +598,6 @@ static unsigned int br_nf_forward_arp(unsigned int hook, struct sk_buff **pskb,
627/* PF_BRIDGE/LOCAL_OUT ***********************************************/ 598/* PF_BRIDGE/LOCAL_OUT ***********************************************/
628static int br_nf_local_out_finish(struct sk_buff *skb) 599static int br_nf_local_out_finish(struct sk_buff *skb)
629{ 600{
630#ifdef CONFIG_NETFILTER_DEBUG
631 skb->nf_debug &= ~(1 << NF_BR_LOCAL_OUT);
632#endif
633 if (skb->protocol == __constant_htons(ETH_P_8021Q)) { 601 if (skb->protocol == __constant_htons(ETH_P_8021Q)) {
634 skb_push(skb, VLAN_HLEN); 602 skb_push(skb, VLAN_HLEN);
635 skb->nh.raw -= VLAN_HLEN; 603 skb->nh.raw -= VLAN_HLEN;
@@ -731,10 +699,6 @@ static unsigned int br_nf_local_out(unsigned int hook, struct sk_buff **pskb,
731 realoutdev, br_nf_local_out_finish, 699 realoutdev, br_nf_local_out_finish,
732 NF_IP_PRI_BRIDGE_SABOTAGE_FORWARD + 1); 700 NF_IP_PRI_BRIDGE_SABOTAGE_FORWARD + 1);
733 } else { 701 } else {
734#ifdef CONFIG_NETFILTER_DEBUG
735 skb->nf_debug ^= (1 << NF_IP_LOCAL_OUT);
736#endif
737
738 NF_HOOK_THRESH(pf, NF_IP_LOCAL_OUT, skb, realindev, 702 NF_HOOK_THRESH(pf, NF_IP_LOCAL_OUT, skb, realindev,
739 realoutdev, br_nf_local_out_finish, 703 realoutdev, br_nf_local_out_finish,
740 NF_IP_PRI_BRIDGE_SABOTAGE_LOCAL_OUT + 1); 704 NF_IP_PRI_BRIDGE_SABOTAGE_LOCAL_OUT + 1);
@@ -779,8 +743,6 @@ static unsigned int br_nf_post_routing(unsigned int hook, struct sk_buff **pskb,
779 printk(KERN_CRIT "br_netfilter: skb->dst == NULL."); 743 printk(KERN_CRIT "br_netfilter: skb->dst == NULL.");
780 goto print_error; 744 goto print_error;
781 } 745 }
782
783 skb->nf_debug ^= (1 << NF_IP_POST_ROUTING);
784#endif 746#endif
785 747
786 /* We assume any code from br_dev_queue_push_xmit onwards doesn't care 748 /* We assume any code from br_dev_queue_push_xmit onwards doesn't care
diff --git a/net/core/netfilter.c b/net/core/netfilter.c
index 22a8f127c4aa..076c156d5eda 100644
--- a/net/core/netfilter.c
+++ b/net/core/netfilter.c
@@ -141,136 +141,6 @@ void nf_unregister_sockopt(struct nf_sockopt_ops *reg)
141 up(&nf_sockopt_mutex); 141 up(&nf_sockopt_mutex);
142} 142}
143 143
144#ifdef CONFIG_NETFILTER_DEBUG
145#include <net/ip.h>
146#include <net/tcp.h>
147#include <linux/netfilter_ipv4.h>
148
149static void debug_print_hooks_ip(unsigned int nf_debug)
150{
151 if (nf_debug & (1 << NF_IP_PRE_ROUTING)) {
152 printk("PRE_ROUTING ");
153 nf_debug ^= (1 << NF_IP_PRE_ROUTING);
154 }
155 if (nf_debug & (1 << NF_IP_LOCAL_IN)) {
156 printk("LOCAL_IN ");
157 nf_debug ^= (1 << NF_IP_LOCAL_IN);
158 }
159 if (nf_debug & (1 << NF_IP_FORWARD)) {
160 printk("FORWARD ");
161 nf_debug ^= (1 << NF_IP_FORWARD);
162 }
163 if (nf_debug & (1 << NF_IP_LOCAL_OUT)) {
164 printk("LOCAL_OUT ");
165 nf_debug ^= (1 << NF_IP_LOCAL_OUT);
166 }
167 if (nf_debug & (1 << NF_IP_POST_ROUTING)) {
168 printk("POST_ROUTING ");
169 nf_debug ^= (1 << NF_IP_POST_ROUTING);
170 }
171 if (nf_debug)
172 printk("Crap bits: 0x%04X", nf_debug);
173 printk("\n");
174}
175
176static void nf_dump_skb(int pf, struct sk_buff *skb)
177{
178 printk("skb: pf=%i %s dev=%s len=%u\n",
179 pf,
180 skb->sk ? "(owned)" : "(unowned)",
181 skb->dev ? skb->dev->name : "(no dev)",
182 skb->len);
183 switch (pf) {
184 case PF_INET: {
185 const struct iphdr *ip = skb->nh.iph;
186 __u32 *opt = (__u32 *) (ip + 1);
187 int opti;
188 __u16 src_port = 0, dst_port = 0;
189
190 if (ip->protocol == IPPROTO_TCP
191 || ip->protocol == IPPROTO_UDP) {
192 struct tcphdr *tcp=(struct tcphdr *)((__u32 *)ip+ip->ihl);
193 src_port = ntohs(tcp->source);
194 dst_port = ntohs(tcp->dest);
195 }
196
197 printk("PROTO=%d %u.%u.%u.%u:%hu %u.%u.%u.%u:%hu"
198 " L=%hu S=0x%2.2hX I=%hu F=0x%4.4hX T=%hu",
199 ip->protocol, NIPQUAD(ip->saddr),
200 src_port, NIPQUAD(ip->daddr),
201 dst_port,
202 ntohs(ip->tot_len), ip->tos, ntohs(ip->id),
203 ntohs(ip->frag_off), ip->ttl);
204
205 for (opti = 0; opti < (ip->ihl - sizeof(struct iphdr) / 4); opti++)
206 printk(" O=0x%8.8X", *opt++);
207 printk("\n");
208 }
209 }
210}
211
212void nf_debug_ip_local_deliver(struct sk_buff *skb)
213{
214 /* If it's a loopback packet, it must have come through
215 * NF_IP_LOCAL_OUT, NF_IP_RAW_INPUT, NF_IP_PRE_ROUTING and
216 * NF_IP_LOCAL_IN. Otherwise, must have gone through
217 * NF_IP_RAW_INPUT and NF_IP_PRE_ROUTING. */
218 if (!skb->dev) {
219 printk("ip_local_deliver: skb->dev is NULL.\n");
220 } else {
221 if (skb->nf_debug != ((1<<NF_IP_PRE_ROUTING)
222 | (1<<NF_IP_LOCAL_IN))) {
223 printk("ip_local_deliver: bad skb: ");
224 debug_print_hooks_ip(skb->nf_debug);
225 nf_dump_skb(PF_INET, skb);
226 }
227 }
228}
229
230void nf_debug_ip_loopback_xmit(struct sk_buff *newskb)
231{
232 if (newskb->nf_debug != ((1 << NF_IP_LOCAL_OUT)
233 | (1 << NF_IP_POST_ROUTING))) {
234 printk("ip_dev_loopback_xmit: bad owned skb = %p: ",
235 newskb);
236 debug_print_hooks_ip(newskb->nf_debug);
237 nf_dump_skb(PF_INET, newskb);
238 }
239}
240
241void nf_debug_ip_finish_output2(struct sk_buff *skb)
242{
243 /* If it's owned, it must have gone through the
244 * NF_IP_LOCAL_OUT and NF_IP_POST_ROUTING.
245 * Otherwise, must have gone through
246 * NF_IP_PRE_ROUTING, NF_IP_FORWARD and NF_IP_POST_ROUTING.
247 */
248 if (skb->sk) {
249 if (skb->nf_debug != ((1 << NF_IP_LOCAL_OUT)
250 | (1 << NF_IP_POST_ROUTING))) {
251 printk("ip_finish_output: bad owned skb = %p: ", skb);
252 debug_print_hooks_ip(skb->nf_debug);
253 nf_dump_skb(PF_INET, skb);
254 }
255 } else {
256 if (skb->nf_debug != ((1 << NF_IP_PRE_ROUTING)
257 | (1 << NF_IP_FORWARD)
258 | (1 << NF_IP_POST_ROUTING))) {
259 /* Fragments, entunnelled packets, TCP RSTs
260 generated by ipt_REJECT will have no
261 owners, but still may be local */
262 if (skb->nf_debug != ((1 << NF_IP_LOCAL_OUT)
263 | (1 << NF_IP_POST_ROUTING))){
264 printk("ip_finish_output:"
265 " bad unowned skb = %p: ",skb);
266 debug_print_hooks_ip(skb->nf_debug);
267 nf_dump_skb(PF_INET, skb);
268 }
269 }
270 }
271}
272#endif /*CONFIG_NETFILTER_DEBUG*/
273
274/* Call get/setsockopt() */ 144/* Call get/setsockopt() */
275static int nf_sockopt(struct sock *sk, int pf, int val, 145static int nf_sockopt(struct sock *sk, int pf, int val,
276 char __user *opt, int *len, int get) 146 char __user *opt, int *len, int get)
@@ -488,14 +358,6 @@ int nf_hook_slow(int pf, unsigned int hook, struct sk_buff **pskb,
488 /* We may already have this, but read-locks nest anyway */ 358 /* We may already have this, but read-locks nest anyway */
489 rcu_read_lock(); 359 rcu_read_lock();
490 360
491#ifdef CONFIG_NETFILTER_DEBUG
492 if (unlikely((*pskb)->nf_debug & (1 << hook))) {
493 printk("nf_hook: hook %i already set.\n", hook);
494 nf_dump_skb(pf, *pskb);
495 }
496 (*pskb)->nf_debug |= (1 << hook);
497#endif
498
499 elem = &nf_hooks[pf][hook]; 361 elem = &nf_hooks[pf][hook];
500next_hook: 362next_hook:
501 verdict = nf_iterate(&nf_hooks[pf][hook], pskb, hook, indev, 363 verdict = nf_iterate(&nf_hooks[pf][hook], pskb, hook, indev,
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index f65b3de590a9..6d68c03bc051 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -365,9 +365,6 @@ struct sk_buff *skb_clone(struct sk_buff *skb, int gfp_mask)
365 C(nfct); 365 C(nfct);
366 nf_conntrack_get(skb->nfct); 366 nf_conntrack_get(skb->nfct);
367 C(nfctinfo); 367 C(nfctinfo);
368#ifdef CONFIG_NETFILTER_DEBUG
369 C(nf_debug);
370#endif
371#ifdef CONFIG_BRIDGE_NETFILTER 368#ifdef CONFIG_BRIDGE_NETFILTER
372 C(nf_bridge); 369 C(nf_bridge);
373 nf_bridge_get(skb->nf_bridge); 370 nf_bridge_get(skb->nf_bridge);
@@ -432,9 +429,6 @@ static void copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
432 new->nfct = old->nfct; 429 new->nfct = old->nfct;
433 nf_conntrack_get(old->nfct); 430 nf_conntrack_get(old->nfct);
434 new->nfctinfo = old->nfctinfo; 431 new->nfctinfo = old->nfctinfo;
435#ifdef CONFIG_NETFILTER_DEBUG
436 new->nf_debug = old->nf_debug;
437#endif
438#ifdef CONFIG_BRIDGE_NETFILTER 432#ifdef CONFIG_BRIDGE_NETFILTER
439 new->nf_bridge = old->nf_bridge; 433 new->nf_bridge = old->nf_bridge;
440 nf_bridge_get(old->nf_bridge); 434 nf_bridge_get(old->nf_bridge);
diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig
index 6d3e8b1bd1f2..05107e0dc145 100644
--- a/net/ipv4/Kconfig
+++ b/net/ipv4/Kconfig
@@ -1,6 +1,32 @@
1# 1#
2# IP configuration 2# IP configuration
3# 3#
4choice
5 prompt "Choose IP: FIB lookup""
6 depends on INET
7 default IP_FIB_HASH
8
9config IP_FIB_HASH
10 bool "FIB_HASH"
11 ---help---
12 Current FIB is very proven and good enough for most users.
13
14config IP_FIB_TRIE
15 bool "FIB_TRIE"
16 ---help---
17 Use new experimental LC-trie as FIB lookup algoritm.
18 This improves lookup performance
19
20 LC-trie is described in:
21
22 IP-address lookup using LC-tries. Stefan Nilsson and Gunnar Karlsson
23 IEEE Journal on Selected Areas in Communications, 17(6):1083-1092, June 1999
24 An experimental study of compression methods for dynamic tries
25 Stefan Nilsson and Matti Tikkanen. Algorithmica, 33(1):19-33, 2002.
26 http://www.nada.kth.se/~snilsson/public/papers/dyntrie2/
27
28endchoice
29
4config IP_MULTICAST 30config IP_MULTICAST
5 bool "IP: multicasting" 31 bool "IP: multicasting"
6 depends on INET 32 depends on INET
diff --git a/net/ipv4/Makefile b/net/ipv4/Makefile
index 8b379627ebb6..65d57d8e1add 100644
--- a/net/ipv4/Makefile
+++ b/net/ipv4/Makefile
@@ -7,8 +7,10 @@ obj-y := utils.o route.o inetpeer.o protocol.o \
7 ip_output.o ip_sockglue.o \ 7 ip_output.o ip_sockglue.o \
8 tcp.o tcp_input.o tcp_output.o tcp_timer.o tcp_ipv4.o tcp_minisocks.o \ 8 tcp.o tcp_input.o tcp_output.o tcp_timer.o tcp_ipv4.o tcp_minisocks.o \
9 datagram.o raw.o udp.o arp.o icmp.o devinet.o af_inet.o igmp.o \ 9 datagram.o raw.o udp.o arp.o icmp.o devinet.o af_inet.o igmp.o \
10 sysctl_net_ipv4.o fib_frontend.o fib_semantics.o fib_hash.o 10 sysctl_net_ipv4.o fib_frontend.o fib_semantics.o
11 11
12obj-$(CONFIG_IP_FIB_HASH) += fib_hash.o
13obj-$(CONFIG_IP_FIB_TRIE) += fib_trie.o
12obj-$(CONFIG_PROC_FS) += proc.o 14obj-$(CONFIG_PROC_FS) += proc.o
13obj-$(CONFIG_IP_MULTIPLE_TABLES) += fib_rules.o 15obj-$(CONFIG_IP_MULTIPLE_TABLES) += fib_rules.o
14obj-$(CONFIG_IP_MROUTE) += ipmr.o 16obj-$(CONFIG_IP_MROUTE) += ipmr.o
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 03942f133944..658e7977924d 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -1119,6 +1119,10 @@ module_init(inet_init);
1119#ifdef CONFIG_PROC_FS 1119#ifdef CONFIG_PROC_FS
1120extern int fib_proc_init(void); 1120extern int fib_proc_init(void);
1121extern void fib_proc_exit(void); 1121extern void fib_proc_exit(void);
1122#ifdef CONFIG_IP_FIB_TRIE
1123extern int fib_stat_proc_init(void);
1124extern void fib_stat_proc_exit(void);
1125#endif
1122extern int ip_misc_proc_init(void); 1126extern int ip_misc_proc_init(void);
1123extern int raw_proc_init(void); 1127extern int raw_proc_init(void);
1124extern void raw_proc_exit(void); 1128extern void raw_proc_exit(void);
@@ -1139,11 +1143,19 @@ static int __init ipv4_proc_init(void)
1139 goto out_udp; 1143 goto out_udp;
1140 if (fib_proc_init()) 1144 if (fib_proc_init())
1141 goto out_fib; 1145 goto out_fib;
1146#ifdef CONFIG_IP_FIB_TRIE
1147 if (fib_stat_proc_init())
1148 goto out_fib_stat;
1149 #endif
1142 if (ip_misc_proc_init()) 1150 if (ip_misc_proc_init())
1143 goto out_misc; 1151 goto out_misc;
1144out: 1152out:
1145 return rc; 1153 return rc;
1146out_misc: 1154out_misc:
1155#ifdef CONFIG_IP_FIB_TRIE
1156 fib_stat_proc_exit();
1157out_fib_stat:
1158#endif
1147 fib_proc_exit(); 1159 fib_proc_exit();
1148out_fib: 1160out_fib:
1149 udp4_proc_exit(); 1161 udp4_proc_exit();
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
new file mode 100644
index 000000000000..0671569ee6f0
--- /dev/null
+++ b/net/ipv4/fib_trie.c
@@ -0,0 +1,2454 @@
1/*
2 * This program is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU General Public License
4 * as published by the Free Software Foundation; either version
5 * 2 of the License, or (at your option) any later version.
6 *
7 * Robert Olsson <robert.olsson@its.uu.se> Uppsala Universitet
8 * & Swedish University of Agricultural Sciences.
9 *
10 * Jens Laas <jens.laas@data.slu.se> Swedish University of
11 * Agricultural Sciences.
12 *
13 * Hans Liss <hans.liss@its.uu.se> Uppsala Universitet
14 *
15 * This work is based on the LPC-trie which is originally descibed in:
16 *
17 * An experimental study of compression methods for dynamic tries
18 * Stefan Nilsson and Matti Tikkanen. Algorithmica, 33(1):19-33, 2002.
19 * http://www.nada.kth.se/~snilsson/public/papers/dyntrie2/
20 *
21 *
22 * IP-address lookup using LC-tries. Stefan Nilsson and Gunnar Karlsson
23 * IEEE Journal on Selected Areas in Communications, 17(6):1083-1092, June 1999
24 *
25 * Version: $Id: fib_trie.c,v 1.3 2005/06/08 14:20:01 robert Exp $
26 *
27 *
28 * Code from fib_hash has been reused which includes the following header:
29 *
30 *
31 * INET An implementation of the TCP/IP protocol suite for the LINUX
32 * operating system. INET is implemented using the BSD Socket
33 * interface as the means of communication with the user level.
34 *
35 * IPv4 FIB: lookup engine and maintenance routines.
36 *
37 *
38 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
39 *
40 * This program is free software; you can redistribute it and/or
41 * modify it under the terms of the GNU General Public License
42 * as published by the Free Software Foundation; either version
43 * 2 of the License, or (at your option) any later version.
44 */
45
46#define VERSION "0.323"
47
48#include <linux/config.h>
49#include <asm/uaccess.h>
50#include <asm/system.h>
51#include <asm/bitops.h>
52#include <linux/types.h>
53#include <linux/kernel.h>
54#include <linux/sched.h>
55#include <linux/mm.h>
56#include <linux/string.h>
57#include <linux/socket.h>
58#include <linux/sockios.h>
59#include <linux/errno.h>
60#include <linux/in.h>
61#include <linux/inet.h>
62#include <linux/netdevice.h>
63#include <linux/if_arp.h>
64#include <linux/proc_fs.h>
65#include <linux/skbuff.h>
66#include <linux/netlink.h>
67#include <linux/init.h>
68#include <linux/list.h>
69#include <net/ip.h>
70#include <net/protocol.h>
71#include <net/route.h>
72#include <net/tcp.h>
73#include <net/sock.h>
74#include <net/ip_fib.h>
75#include "fib_lookup.h"
76
77#undef CONFIG_IP_FIB_TRIE_STATS
78#define MAX_CHILDS 16384
79
80#define EXTRACT(p, n, str) ((str)<<(p)>>(32-(n)))
81#define KEYLENGTH (8*sizeof(t_key))
82#define MASK_PFX(k, l) (((l)==0)?0:(k >> (KEYLENGTH-l)) << (KEYLENGTH-l))
83#define TKEY_GET_MASK(offset, bits) (((bits)==0)?0:((t_key)(-1) << (KEYLENGTH - bits) >> offset))
84
85static DEFINE_RWLOCK(fib_lock);
86
87typedef unsigned int t_key;
88
89#define T_TNODE 0
90#define T_LEAF 1
91#define NODE_TYPE_MASK 0x1UL
92#define NODE_PARENT(_node) \
93((struct tnode *)((_node)->_parent & ~NODE_TYPE_MASK))
94#define NODE_SET_PARENT(_node, _ptr) \
95((_node)->_parent = (((unsigned long)(_ptr)) | \
96 ((_node)->_parent & NODE_TYPE_MASK)))
97#define NODE_INIT_PARENT(_node, _type) \
98((_node)->_parent = (_type))
99#define NODE_TYPE(_node) \
100((_node)->_parent & NODE_TYPE_MASK)
101
102#define IS_TNODE(n) (!(n->_parent & T_LEAF))
103#define IS_LEAF(n) (n->_parent & T_LEAF)
104
105struct node {
106 t_key key;
107 unsigned long _parent;
108};
109
110struct leaf {
111 t_key key;
112 unsigned long _parent;
113 struct hlist_head list;
114};
115
116struct leaf_info {
117 struct hlist_node hlist;
118 int plen;
119 struct list_head falh;
120};
121
122struct tnode {
123 t_key key;
124 unsigned long _parent;
125 unsigned short pos:5; /* 2log(KEYLENGTH) bits needed */
126 unsigned short bits:5; /* 2log(KEYLENGTH) bits needed */
127 unsigned short full_children; /* KEYLENGTH bits needed */
128 unsigned short empty_children; /* KEYLENGTH bits needed */
129 struct node *child[0];
130};
131
132#ifdef CONFIG_IP_FIB_TRIE_STATS
133struct trie_use_stats {
134 unsigned int gets;
135 unsigned int backtrack;
136 unsigned int semantic_match_passed;
137 unsigned int semantic_match_miss;
138 unsigned int null_node_hit;
139};
140#endif
141
142struct trie_stat {
143 unsigned int totdepth;
144 unsigned int maxdepth;
145 unsigned int tnodes;
146 unsigned int leaves;
147 unsigned int nullpointers;
148 unsigned int nodesizes[MAX_CHILDS];
149};
150
151struct trie {
152 struct node *trie;
153#ifdef CONFIG_IP_FIB_TRIE_STATS
154 struct trie_use_stats stats;
155#endif
156 int size;
157 unsigned int revision;
158};
159
160static int trie_debug = 0;
161
162static int tnode_full(struct tnode *tn, struct node *n);
163static void put_child(struct trie *t, struct tnode *tn, int i, struct node *n);
164static void tnode_put_child_reorg(struct tnode *tn, int i, struct node *n, int wasfull);
165static int tnode_child_length(struct tnode *tn);
166static struct node *resize(struct trie *t, struct tnode *tn);
167static struct tnode *inflate(struct trie *t, struct tnode *tn);
168static struct tnode *halve(struct trie *t, struct tnode *tn);
169static void tnode_free(struct tnode *tn);
170static void trie_dump_seq(struct seq_file *seq, struct trie *t);
171extern struct fib_alias *fib_find_alias(struct list_head *fah, u8 tos, u32 prio);
172extern int fib_detect_death(struct fib_info *fi, int order,
173 struct fib_info **last_resort, int *last_idx, int *dflt);
174
175extern void rtmsg_fib(int event, u32 key, struct fib_alias *fa, int z, int tb_id,
176 struct nlmsghdr *n, struct netlink_skb_parms *req);
177
178static kmem_cache_t *fn_alias_kmem;
179static struct trie *trie_local = NULL, *trie_main = NULL;
180
181static void trie_bug(char *err)
182{
183 printk("Trie Bug: %s\n", err);
184 BUG();
185}
186
187static inline struct node *tnode_get_child(struct tnode *tn, int i)
188{
189 if (i >= 1<<tn->bits)
190 trie_bug("tnode_get_child");
191
192 return tn->child[i];
193}
194
195static inline int tnode_child_length(struct tnode *tn)
196{
197 return 1<<tn->bits;
198}
199
200/*
201 _________________________________________________________________
202 | i | i | i | i | i | i | i | N | N | N | S | S | S | S | S | C |
203 ----------------------------------------------------------------
204 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
205
206 _________________________________________________________________
207 | C | C | C | u | u | u | u | u | u | u | u | u | u | u | u | u |
208 -----------------------------------------------------------------
209 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
210
211 tp->pos = 7
212 tp->bits = 3
213 n->pos = 15
214 n->bits=4
215 KEYLENGTH=32
216*/
217
218static inline t_key tkey_extract_bits(t_key a, int offset, int bits)
219{
220 if (offset < KEYLENGTH)
221 return ((t_key)(a << offset)) >> (KEYLENGTH - bits);
222 else
223 return 0;
224}
225
226static inline int tkey_equals(t_key a, t_key b)
227{
228 return a == b;
229}
230
231static inline int tkey_sub_equals(t_key a, int offset, int bits, t_key b)
232{
233 if (bits == 0 || offset >= KEYLENGTH)
234 return 1;
235 bits = bits > KEYLENGTH ? KEYLENGTH : bits;
236 return ((a ^ b) << offset) >> (KEYLENGTH - bits) == 0;
237}
238
239static inline int tkey_mismatch(t_key a, int offset, t_key b)
240{
241 t_key diff = a ^ b;
242 int i = offset;
243
244 if(!diff)
245 return 0;
246 while((diff << i) >> (KEYLENGTH-1) == 0)
247 i++;
248 return i;
249}
250
251/* Candiate for fib_semantics */
252
253static void fn_free_alias(struct fib_alias *fa)
254{
255 fib_release_info(fa->fa_info);
256 kmem_cache_free(fn_alias_kmem, fa);
257}
258
259/*
260 To understand this stuff, an understanding of keys and all their bits is
261 necessary. Every node in the trie has a key associated with it, but not
262 all of the bits in that key are significant.
263
264 Consider a node 'n' and its parent 'tp'.
265
266 If n is a leaf, every bit in its key is significant. Its presence is
267 necessitaded by path compression, since during a tree traversal (when
268 searching for a leaf - unless we are doing an insertion) we will completely
269 ignore all skipped bits we encounter. Thus we need to verify, at the end of
270 a potentially successful search, that we have indeed been walking the
271 correct key path.
272
273 Note that we can never "miss" the correct key in the tree if present by
274 following the wrong path. Path compression ensures that segments of the key
275 that are the same for all keys with a given prefix are skipped, but the
276 skipped part *is* identical for each node in the subtrie below the skipped
277 bit! trie_insert() in this implementation takes care of that - note the
278 call to tkey_sub_equals() in trie_insert().
279
280 if n is an internal node - a 'tnode' here, the various parts of its key
281 have many different meanings.
282
283 Example:
284 _________________________________________________________________
285 | i | i | i | i | i | i | i | N | N | N | S | S | S | S | S | C |
286 -----------------------------------------------------------------
287 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
288
289 _________________________________________________________________
290 | C | C | C | u | u | u | u | u | u | u | u | u | u | u | u | u |
291 -----------------------------------------------------------------
292 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
293
294 tp->pos = 7
295 tp->bits = 3
296 n->pos = 15
297 n->bits=4
298
299 First, let's just ignore the bits that come before the parent tp, that is
300 the bits from 0 to (tp->pos-1). They are *known* but at this point we do
301 not use them for anything.
302
303 The bits from (tp->pos) to (tp->pos + tp->bits - 1) - "N", above - are the
304 index into the parent's child array. That is, they will be used to find
305 'n' among tp's children.
306
307 The bits from (tp->pos + tp->bits) to (n->pos - 1) - "S" - are skipped bits
308 for the node n.
309
310 All the bits we have seen so far are significant to the node n. The rest
311 of the bits are really not needed or indeed known in n->key.
312
313 The bits from (n->pos) to (n->pos + n->bits - 1) - "C" - are the index into
314 n's child array, and will of course be different for each child.
315
316 The rest of the bits, from (n->pos + n->bits) onward, are completely unknown
317 at this point.
318
319*/
320
321static void check_tnode(struct tnode *tn)
322{
323 if(tn && tn->pos+tn->bits > 32) {
324 printk("TNODE ERROR tn=%p, pos=%d, bits=%d\n", tn, tn->pos, tn->bits);
325 }
326}
327
328static int halve_threshold = 25;
329static int inflate_threshold = 50;
330
331static struct leaf *leaf_new(void)
332{
333 struct leaf *l = kmalloc(sizeof(struct leaf), GFP_KERNEL);
334 if(l) {
335 NODE_INIT_PARENT(l, T_LEAF);
336 INIT_HLIST_HEAD(&l->list);
337 }
338 return l;
339}
340
341static struct leaf_info *leaf_info_new(int plen)
342{
343 struct leaf_info *li = kmalloc(sizeof(struct leaf_info), GFP_KERNEL);
344 li->plen = plen;
345 INIT_LIST_HEAD(&li->falh);
346 return li;
347}
348
349static inline void free_leaf(struct leaf *l)
350{
351 kfree(l);
352}
353
354static inline void free_leaf_info(struct leaf_info *li)
355{
356 kfree(li);
357}
358
359static struct tnode* tnode_new(t_key key, int pos, int bits)
360{
361 int nchildren = 1<<bits;
362 int sz = sizeof(struct tnode) + nchildren * sizeof(struct node *);
363 struct tnode *tn = kmalloc(sz, GFP_KERNEL);
364
365 if(tn) {
366 memset(tn, 0, sz);
367 NODE_INIT_PARENT(tn, T_TNODE);
368 tn->pos = pos;
369 tn->bits = bits;
370 tn->key = key;
371 tn->full_children = 0;
372 tn->empty_children = 1<<bits;
373 }
374 if(trie_debug > 0)
375 printk("AT %p s=%u %u\n", tn, (unsigned int) sizeof(struct tnode),
376 (unsigned int) (sizeof(struct node) * 1<<bits));
377 return tn;
378}
379
380static void tnode_free(struct tnode *tn)
381{
382 if(!tn) {
383 trie_bug("tnode_free\n");
384 }
385 if(IS_LEAF(tn)) {
386 free_leaf((struct leaf *)tn);
387 if(trie_debug > 0 )
388 printk("FL %p \n", tn);
389 }
390 else if(IS_TNODE(tn)) {
391 kfree(tn);
392 if(trie_debug > 0 )
393 printk("FT %p \n", tn);
394 }
395 else {
396 trie_bug("tnode_free\n");
397 }
398}
399
400/*
401 * Check whether a tnode 'n' is "full", i.e. it is an internal node
402 * and no bits are skipped. See discussion in dyntree paper p. 6
403 */
404
405static inline int tnode_full(struct tnode *tn, struct node *n)
406{
407 if(n == NULL || IS_LEAF(n))
408 return 0;
409
410 return ((struct tnode *) n)->pos == tn->pos + tn->bits;
411}
412
413static inline void put_child(struct trie *t, struct tnode *tn, int i, struct node *n)
414{
415 tnode_put_child_reorg(tn, i, n, -1);
416}
417
418 /*
419 * Add a child at position i overwriting the old value.
420 * Update the value of full_children and empty_children.
421 */
422
423static void tnode_put_child_reorg(struct tnode *tn, int i, struct node *n, int wasfull)
424{
425 struct node *chi;
426 int isfull;
427
428 if(i >= 1<<tn->bits) {
429 printk("bits=%d, i=%d\n", tn->bits, i);
430 trie_bug("tnode_put_child_reorg bits");
431 }
432 write_lock_bh(&fib_lock);
433 chi = tn->child[i];
434
435 /* update emptyChildren */
436 if (n == NULL && chi != NULL)
437 tn->empty_children++;
438 else if (n != NULL && chi == NULL)
439 tn->empty_children--;
440
441 /* update fullChildren */
442 if (wasfull == -1)
443 wasfull = tnode_full(tn, chi);
444
445 isfull = tnode_full(tn, n);
446 if (wasfull && !isfull)
447 tn->full_children--;
448
449 else if (!wasfull && isfull)
450 tn->full_children++;
451 if(n)
452 NODE_SET_PARENT(n, tn);
453
454 tn->child[i] = n;
455 write_unlock_bh(&fib_lock);
456}
457
458static struct node *resize(struct trie *t, struct tnode *tn)
459{
460 int i;
461
462 if (!tn)
463 return NULL;
464
465 if(trie_debug)
466 printk("In tnode_resize %p inflate_threshold=%d threshold=%d\n",
467 tn, inflate_threshold, halve_threshold);
468
469 /* No children */
470 if (tn->empty_children == tnode_child_length(tn)) {
471 tnode_free(tn);
472 return NULL;
473 }
474 /* One child */
475 if (tn->empty_children == tnode_child_length(tn) - 1)
476 for (i = 0; i < tnode_child_length(tn); i++) {
477
478 write_lock_bh(&fib_lock);
479 if (tn->child[i] != NULL) {
480
481 /* compress one level */
482 struct node *n = tn->child[i];
483 if(n)
484 NODE_INIT_PARENT(n, NODE_TYPE(n));
485
486 write_unlock_bh(&fib_lock);
487 tnode_free(tn);
488 return n;
489 }
490 write_unlock_bh(&fib_lock);
491 }
492 /*
493 * Double as long as the resulting node has a number of
494 * nonempty nodes that are above the threshold.
495 */
496
497 /*
498 * From "Implementing a dynamic compressed trie" by Stefan Nilsson of
499 * the Helsinki University of Technology and Matti Tikkanen of Nokia
500 * Telecommunications, page 6:
501 * "A node is doubled if the ratio of non-empty children to all
502 * children in the *doubled* node is at least 'high'."
503 *
504 * 'high' in this instance is the variable 'inflate_threshold'. It
505 * is expressed as a percentage, so we multiply it with
506 * tnode_child_length() and instead of multiplying by 2 (since the
507 * child array will be doubled by inflate()) and multiplying
508 * the left-hand side by 100 (to handle the percentage thing) we
509 * multiply the left-hand side by 50.
510 *
511 * The left-hand side may look a bit weird: tnode_child_length(tn)
512 * - tn->empty_children is of course the number of non-null children
513 * in the current node. tn->full_children is the number of "full"
514 * children, that is non-null tnodes with a skip value of 0.
515 * All of those will be doubled in the resulting inflated tnode, so
516 * we just count them one extra time here.
517 *
518 * A clearer way to write this would be:
519 *
520 * to_be_doubled = tn->full_children;
521 * not_to_be_doubled = tnode_child_length(tn) - tn->empty_children -
522 * tn->full_children;
523 *
524 * new_child_length = tnode_child_length(tn) * 2;
525 *
526 * new_fill_factor = 100 * (not_to_be_doubled + 2*to_be_doubled) /
527 * new_child_length;
528 * if (new_fill_factor >= inflate_threshold)
529 *
530 * ...and so on, tho it would mess up the while() loop.
531 *
532 * anyway,
533 * 100 * (not_to_be_doubled + 2*to_be_doubled) / new_child_length >=
534 * inflate_threshold
535 *
536 * avoid a division:
537 * 100 * (not_to_be_doubled + 2*to_be_doubled) >=
538 * inflate_threshold * new_child_length
539 *
540 * expand not_to_be_doubled and to_be_doubled, and shorten:
541 * 100 * (tnode_child_length(tn) - tn->empty_children +
542 * tn->full_children ) >= inflate_threshold * new_child_length
543 *
544 * expand new_child_length:
545 * 100 * (tnode_child_length(tn) - tn->empty_children +
546 * tn->full_children ) >=
547 * inflate_threshold * tnode_child_length(tn) * 2
548 *
549 * shorten again:
550 * 50 * (tn->full_children + tnode_child_length(tn) -
551 * tn->empty_children ) >= inflate_threshold *
552 * tnode_child_length(tn)
553 *
554 */
555
556 check_tnode(tn);
557
558 while ((tn->full_children > 0 &&
559 50 * (tn->full_children + tnode_child_length(tn) - tn->empty_children) >=
560 inflate_threshold * tnode_child_length(tn))) {
561
562 tn = inflate(t, tn);
563 }
564
565 check_tnode(tn);
566
567 /*
568 * Halve as long as the number of empty children in this
569 * node is above threshold.
570 */
571 while (tn->bits > 1 &&
572 100 * (tnode_child_length(tn) - tn->empty_children) <
573 halve_threshold * tnode_child_length(tn))
574
575 tn = halve(t, tn);
576
577 /* Only one child remains */
578
579 if (tn->empty_children == tnode_child_length(tn) - 1)
580 for (i = 0; i < tnode_child_length(tn); i++) {
581
582 write_lock_bh(&fib_lock);
583 if (tn->child[i] != NULL) {
584 /* compress one level */
585 struct node *n = tn->child[i];
586
587 if(n)
588 NODE_INIT_PARENT(n, NODE_TYPE(n));
589
590 write_unlock_bh(&fib_lock);
591 tnode_free(tn);
592 return n;
593 }
594 write_unlock_bh(&fib_lock);
595 }
596
597 return (struct node *) tn;
598}
599
600static struct tnode *inflate(struct trie *t, struct tnode *tn)
601{
602 struct tnode *inode;
603 struct tnode *oldtnode = tn;
604 int olen = tnode_child_length(tn);
605 int i;
606
607 if(trie_debug)
608 printk("In inflate\n");
609
610 tn = tnode_new(oldtnode->key, oldtnode->pos, oldtnode->bits + 1);
611
612 if (!tn)
613 trie_bug("tnode_new failed");
614
615 for(i = 0; i < olen; i++) {
616 struct node *node = tnode_get_child(oldtnode, i);
617
618 /* An empty child */
619 if (node == NULL)
620 continue;
621
622 /* A leaf or an internal node with skipped bits */
623
624 if(IS_LEAF(node) || ((struct tnode *) node)->pos >
625 tn->pos + tn->bits - 1) {
626 if(tkey_extract_bits(node->key, tn->pos + tn->bits - 1,
627 1) == 0)
628 put_child(t, tn, 2*i, node);
629 else
630 put_child(t, tn, 2*i+1, node);
631 continue;
632 }
633
634 /* An internal node with two children */
635 inode = (struct tnode *) node;
636
637 if (inode->bits == 1) {
638 put_child(t, tn, 2*i, inode->child[0]);
639 put_child(t, tn, 2*i+1, inode->child[1]);
640
641 tnode_free(inode);
642 }
643
644 /* An internal node with more than two children */
645 else {
646 struct tnode *left, *right;
647 int size, j;
648
649 /* We will replace this node 'inode' with two new
650 * ones, 'left' and 'right', each with half of the
651 * original children. The two new nodes will have
652 * a position one bit further down the key and this
653 * means that the "significant" part of their keys
654 * (see the discussion near the top of this file)
655 * will differ by one bit, which will be "0" in
656 * left's key and "1" in right's key. Since we are
657 * moving the key position by one step, the bit that
658 * we are moving away from - the bit at position
659 * (inode->pos) - is the one that will differ between
660 * left and right. So... we synthesize that bit in the
661 * two new keys.
662 * The mask 'm' below will be a single "one" bit at
663 * the position (inode->pos)
664 */
665
666 t_key m = TKEY_GET_MASK(inode->pos, 1);
667
668 /* Use the old key, but set the new significant
669 * bit to zero.
670 */
671 left = tnode_new(inode->key&(~m), inode->pos + 1,
672 inode->bits - 1);
673
674 if(!left)
675 trie_bug("tnode_new failed");
676
677
678 /* Use the old key, but set the new significant
679 * bit to one.
680 */
681 right = tnode_new(inode->key|m, inode->pos + 1,
682 inode->bits - 1);
683
684 if(!right)
685 trie_bug("tnode_new failed");
686
687 size = tnode_child_length(left);
688 for(j = 0; j < size; j++) {
689 put_child(t, left, j, inode->child[j]);
690 put_child(t, right, j, inode->child[j + size]);
691 }
692 put_child(t, tn, 2*i, resize(t, left));
693 put_child(t, tn, 2*i+1, resize(t, right));
694
695 tnode_free(inode);
696 }
697 }
698 tnode_free(oldtnode);
699 return tn;
700}
701
702static struct tnode *halve(struct trie *t, struct tnode *tn)
703{
704 struct tnode *oldtnode = tn;
705 struct node *left, *right;
706 int i;
707 int olen = tnode_child_length(tn);
708
709 if(trie_debug) printk("In halve\n");
710
711 tn=tnode_new(oldtnode->key, oldtnode->pos, oldtnode->bits - 1);
712
713 if(!tn)
714 trie_bug("tnode_new failed");
715
716 for(i = 0; i < olen; i += 2) {
717 left = tnode_get_child(oldtnode, i);
718 right = tnode_get_child(oldtnode, i+1);
719
720 /* At least one of the children is empty */
721 if (left == NULL) {
722 if (right == NULL) /* Both are empty */
723 continue;
724 put_child(t, tn, i/2, right);
725 } else if (right == NULL)
726 put_child(t, tn, i/2, left);
727
728 /* Two nonempty children */
729 else {
730 struct tnode *newBinNode =
731 tnode_new(left->key, tn->pos + tn->bits, 1);
732
733 if(!newBinNode)
734 trie_bug("tnode_new failed");
735
736 put_child(t, newBinNode, 0, left);
737 put_child(t, newBinNode, 1, right);
738 put_child(t, tn, i/2, resize(t, newBinNode));
739 }
740 }
741 tnode_free(oldtnode);
742 return tn;
743}
744
745static void *trie_init(struct trie *t)
746{
747 if(t) {
748 t->size = 0;
749 t->trie = NULL;
750 t->revision = 0;
751#ifdef CONFIG_IP_FIB_TRIE_STATS
752 memset(&t->stats, 0, sizeof(struct trie_use_stats));
753#endif
754 }
755 return t;
756}
757
758static struct leaf_info *find_leaf_info(struct hlist_head *head, int plen)
759{
760 struct hlist_node *node;
761 struct leaf_info *li;
762
763 hlist_for_each_entry(li, node, head, hlist) {
764
765 if ( li->plen == plen )
766 return li;
767 }
768 return NULL;
769}
770
771static inline struct list_head * get_fa_head(struct leaf *l, int plen)
772{
773 struct list_head *fa_head=NULL;
774 struct leaf_info *li = find_leaf_info(&l->list, plen);
775
776 if(li)
777 fa_head = &li->falh;
778
779 return fa_head;
780}
781
782static void insert_leaf_info(struct hlist_head *head, struct leaf_info *new)
783{
784 struct leaf_info *li=NULL, *last=NULL;
785 struct hlist_node *node, *tmp;
786
787 write_lock_bh(&fib_lock);
788
789 if(hlist_empty(head))
790 hlist_add_head(&new->hlist, head);
791 else {
792 hlist_for_each_entry_safe(li, node, tmp, head, hlist) {
793
794 if (new->plen > li->plen)
795 break;
796
797 last = li;
798 }
799 if(last)
800 hlist_add_after(&last->hlist, &new->hlist);
801 else
802 hlist_add_before(&new->hlist, &li->hlist);
803 }
804 write_unlock_bh(&fib_lock);
805}
806
807static struct leaf *
808fib_find_node(struct trie *t, u32 key)
809{
810 int pos;
811 struct tnode *tn;
812 struct node *n;
813
814 pos = 0;
815 n=t->trie;
816
817 while (n != NULL && NODE_TYPE(n) == T_TNODE) {
818 tn = (struct tnode *) n;
819
820 check_tnode(tn);
821
822 if(tkey_sub_equals(tn->key, pos, tn->pos-pos, key)) {
823 pos=tn->pos + tn->bits;
824 n = tnode_get_child(tn, tkey_extract_bits(key, tn->pos, tn->bits));
825 }
826 else
827 break;
828 }
829 /* Case we have found a leaf. Compare prefixes */
830
831 if (n != NULL && IS_LEAF(n) && tkey_equals(key, n->key)) {
832 struct leaf *l = (struct leaf *) n;
833 return l;
834 }
835 return NULL;
836}
837
838static struct node *trie_rebalance(struct trie *t, struct tnode *tn)
839{
840 int i = 0;
841 int wasfull;
842 t_key cindex, key;
843 struct tnode *tp = NULL;
844
845 if(!tn)
846 BUG();
847
848 key = tn->key;
849 i = 0;
850
851 while (tn != NULL && NODE_PARENT(tn) != NULL) {
852
853 if( i > 10 ) {
854 printk("Rebalance tn=%p \n", tn);
855 if(tn) printk("tn->parent=%p \n", NODE_PARENT(tn));
856
857 printk("Rebalance tp=%p \n", tp);
858 if(tp) printk("tp->parent=%p \n", NODE_PARENT(tp));
859 }
860
861 if( i > 12 ) BUG();
862 i++;
863
864 tp = NODE_PARENT(tn);
865 cindex = tkey_extract_bits(key, tp->pos, tp->bits);
866 wasfull = tnode_full(tp, tnode_get_child(tp, cindex));
867 tn = (struct tnode *) resize (t, (struct tnode *)tn);
868 tnode_put_child_reorg((struct tnode *)tp, cindex,(struct node*)tn, wasfull);
869
870 if(!NODE_PARENT(tn))
871 break;
872
873 tn = NODE_PARENT(tn);
874 }
875 /* Handle last (top) tnode */
876 if (IS_TNODE(tn))
877 tn = (struct tnode*) resize(t, (struct tnode *)tn);
878
879 return (struct node*) tn;
880}
881
882static struct list_head *
883fib_insert_node(struct trie *t, u32 key, int plen)
884{
885 int pos, newpos;
886 struct tnode *tp = NULL, *tn = NULL;
887 struct node *n;
888 struct leaf *l;
889 int missbit;
890 struct list_head *fa_head=NULL;
891 struct leaf_info *li;
892 t_key cindex;
893
894 pos = 0;
895 n=t->trie;
896
897 /* If we point to NULL, stop. Either the tree is empty and we should
898 * just put a new leaf in if, or we have reached an empty child slot,
899 * and we should just put our new leaf in that.
900 * If we point to a T_TNODE, check if it matches our key. Note that
901 * a T_TNODE might be skipping any number of bits - its 'pos' need
902 * not be the parent's 'pos'+'bits'!
903 *
904 * If it does match the current key, get pos/bits from it, extract
905 * the index from our key, push the T_TNODE and walk the tree.
906 *
907 * If it doesn't, we have to replace it with a new T_TNODE.
908 *
909 * If we point to a T_LEAF, it might or might not have the same key
910 * as we do. If it does, just change the value, update the T_LEAF's
911 * value, and return it.
912 * If it doesn't, we need to replace it with a T_TNODE.
913 */
914
915 while (n != NULL && NODE_TYPE(n) == T_TNODE) {
916 tn = (struct tnode *) n;
917
918 check_tnode(tn);
919
920 if(tkey_sub_equals(tn->key, pos, tn->pos-pos, key)) {
921 tp = tn;
922 pos=tn->pos + tn->bits;
923 n = tnode_get_child(tn, tkey_extract_bits(key, tn->pos, tn->bits));
924
925 if(n && NODE_PARENT(n) != tn) {
926 printk("BUG tn=%p, n->parent=%p\n", tn, NODE_PARENT(n));
927 BUG();
928 }
929 }
930 else
931 break;
932 }
933
934 /*
935 * n ----> NULL, LEAF or TNODE
936 *
937 * tp is n's (parent) ----> NULL or TNODE
938 */
939
940 if(tp && IS_LEAF(tp))
941 BUG();
942
943 t->revision++;
944
945 /* Case 1: n is a leaf. Compare prefixes */
946
947 if (n != NULL && IS_LEAF(n) && tkey_equals(key, n->key)) {
948 struct leaf *l = ( struct leaf *) n;
949
950 li = leaf_info_new(plen);
951
952 if(! li)
953 BUG();
954
955 fa_head = &li->falh;
956 insert_leaf_info(&l->list, li);
957 goto done;
958 }
959 t->size++;
960 l = leaf_new();
961
962 if(! l)
963 BUG();
964
965 l->key = key;
966 li = leaf_info_new(plen);
967
968 if(! li)
969 BUG();
970
971 fa_head = &li->falh;
972 insert_leaf_info(&l->list, li);
973
974 /* Case 2: n is NULL, and will just insert a new leaf */
975 if (t->trie && n == NULL) {
976
977 NODE_SET_PARENT(l, tp);
978
979 if (!tp)
980 BUG();
981
982 else {
983 cindex = tkey_extract_bits(key, tp->pos, tp->bits);
984 put_child(t, (struct tnode *)tp, cindex, (struct node *)l);
985 }
986 }
987 /* Case 3: n is a LEAF or a TNODE and the key doesn't match. */
988 else {
989 /*
990 * Add a new tnode here
991 * first tnode need some special handling
992 */
993
994 if (tp)
995 pos=tp->pos+tp->bits;
996 else
997 pos=0;
998 if(n) {
999 newpos = tkey_mismatch(key, pos, n->key);
1000 tn = tnode_new(n->key, newpos, 1);
1001 }
1002 else {
1003 newpos = 0;
1004 tn = tnode_new(key, newpos, 1); /* First tnode */
1005 }
1006 if(!tn)
1007 trie_bug("tnode_pfx_new failed");
1008
1009 NODE_SET_PARENT(tn, tp);
1010
1011 missbit=tkey_extract_bits(key, newpos, 1);
1012 put_child(t, tn, missbit, (struct node *)l);
1013 put_child(t, tn, 1-missbit, n);
1014
1015 if(tp) {
1016 cindex = tkey_extract_bits(key, tp->pos, tp->bits);
1017 put_child(t, (struct tnode *)tp, cindex, (struct node *)tn);
1018 }
1019 else {
1020 t->trie = (struct node*) tn; /* First tnode */
1021 tp = tn;
1022 }
1023 }
1024 if(tp && tp->pos+tp->bits > 32) {
1025 printk("ERROR tp=%p pos=%d, bits=%d, key=%0x plen=%d\n",
1026 tp, tp->pos, tp->bits, key, plen);
1027 }
1028 /* Rebalance the trie */
1029 t->trie = trie_rebalance(t, tp);
1030done:;
1031 return fa_head;
1032}
1033
1034static int
1035fn_trie_insert(struct fib_table *tb, struct rtmsg *r, struct kern_rta *rta,
1036 struct nlmsghdr *nlhdr, struct netlink_skb_parms *req)
1037{
1038 struct trie *t = (struct trie *) tb->tb_data;
1039 struct fib_alias *fa, *new_fa;
1040 struct list_head *fa_head=NULL;
1041 struct fib_info *fi;
1042 int plen = r->rtm_dst_len;
1043 int type = r->rtm_type;
1044 u8 tos = r->rtm_tos;
1045 u32 key, mask;
1046 int err;
1047 struct leaf *l;
1048
1049 if (plen > 32)
1050 return -EINVAL;
1051
1052 key = 0;
1053 if (rta->rta_dst)
1054 memcpy(&key, rta->rta_dst, 4);
1055
1056 key = ntohl(key);
1057
1058 if(trie_debug)
1059 printk("Insert table=%d %08x/%d\n", tb->tb_id, key, plen);
1060
1061 mask = ntohl( inet_make_mask(plen) );
1062
1063 if(key & ~mask)
1064 return -EINVAL;
1065
1066 key = key & mask;
1067
1068 if ((fi = fib_create_info(r, rta, nlhdr, &err)) == NULL)
1069 goto err;
1070
1071 l = fib_find_node(t, key);
1072 fa = NULL;
1073
1074 if(l) {
1075 fa_head = get_fa_head(l, plen);
1076 fa = fib_find_alias(fa_head, tos, fi->fib_priority);
1077 }
1078
1079 /* Now fa, if non-NULL, points to the first fib alias
1080 * with the same keys [prefix,tos,priority], if such key already
1081 * exists or to the node before which we will insert new one.
1082 *
1083 * If fa is NULL, we will need to allocate a new one and
1084 * insert to the head of f.
1085 *
1086 * If f is NULL, no fib node matched the destination key
1087 * and we need to allocate a new one of those as well.
1088 */
1089
1090 if (fa &&
1091 fa->fa_info->fib_priority == fi->fib_priority) {
1092 struct fib_alias *fa_orig;
1093
1094 err = -EEXIST;
1095 if (nlhdr->nlmsg_flags & NLM_F_EXCL)
1096 goto out;
1097
1098 if (nlhdr->nlmsg_flags & NLM_F_REPLACE) {
1099 struct fib_info *fi_drop;
1100 u8 state;
1101
1102 write_lock_bh(&fib_lock);
1103
1104 fi_drop = fa->fa_info;
1105 fa->fa_info = fi;
1106 fa->fa_type = type;
1107 fa->fa_scope = r->rtm_scope;
1108 state = fa->fa_state;
1109 fa->fa_state &= ~FA_S_ACCESSED;
1110
1111 write_unlock_bh(&fib_lock);
1112
1113 fib_release_info(fi_drop);
1114 if (state & FA_S_ACCESSED)
1115 rt_cache_flush(-1);
1116
1117 goto succeeded;
1118 }
1119 /* Error if we find a perfect match which
1120 * uses the same scope, type, and nexthop
1121 * information.
1122 */
1123 fa_orig = fa;
1124 list_for_each_entry(fa, fa_orig->fa_list.prev, fa_list) {
1125 if (fa->fa_tos != tos)
1126 break;
1127 if (fa->fa_info->fib_priority != fi->fib_priority)
1128 break;
1129 if (fa->fa_type == type &&
1130 fa->fa_scope == r->rtm_scope &&
1131 fa->fa_info == fi) {
1132 goto out;
1133 }
1134 }
1135 if (!(nlhdr->nlmsg_flags & NLM_F_APPEND))
1136 fa = fa_orig;
1137 }
1138 err = -ENOENT;
1139 if (!(nlhdr->nlmsg_flags&NLM_F_CREATE))
1140 goto out;
1141
1142 err = -ENOBUFS;
1143 new_fa = kmem_cache_alloc(fn_alias_kmem, SLAB_KERNEL);
1144 if (new_fa == NULL)
1145 goto out;
1146
1147 new_fa->fa_info = fi;
1148 new_fa->fa_tos = tos;
1149 new_fa->fa_type = type;
1150 new_fa->fa_scope = r->rtm_scope;
1151 new_fa->fa_state = 0;
1152#if 0
1153 new_fa->dst = NULL;
1154#endif
1155 /*
1156 * Insert new entry to the list.
1157 */
1158
1159 if(!fa_head)
1160 fa_head = fib_insert_node(t, key, plen);
1161
1162 write_lock_bh(&fib_lock);
1163
1164 list_add_tail(&new_fa->fa_list,
1165 (fa ? &fa->fa_list : fa_head));
1166
1167 write_unlock_bh(&fib_lock);
1168
1169 rt_cache_flush(-1);
1170 rtmsg_fib(RTM_NEWROUTE, htonl(key), new_fa, plen, tb->tb_id, nlhdr, req);
1171succeeded:
1172 return 0;
1173out:
1174 fib_release_info(fi);
1175err:;
1176 return err;
1177}
1178
1179static inline int check_leaf(struct trie *t, struct leaf *l, t_key key, int *plen, const struct flowi *flp,
1180 struct fib_result *res, int *err)
1181{
1182 int i;
1183 t_key mask;
1184 struct leaf_info *li;
1185 struct hlist_head *hhead = &l->list;
1186 struct hlist_node *node;
1187
1188 hlist_for_each_entry(li, node, hhead, hlist) {
1189
1190 i = li->plen;
1191 mask = ntohl(inet_make_mask(i));
1192 if (l->key != (key & mask))
1193 continue;
1194
1195 if (((*err) = fib_semantic_match(&li->falh, flp, res, l->key, mask, i)) == 0) {
1196 *plen = i;
1197#ifdef CONFIG_IP_FIB_TRIE_STATS
1198 t->stats.semantic_match_passed++;
1199#endif
1200 return 1;
1201 }
1202#ifdef CONFIG_IP_FIB_TRIE_STATS
1203 t->stats.semantic_match_miss++;
1204#endif
1205 }
1206 return 0;
1207}
1208
1209static int
1210fn_trie_lookup(struct fib_table *tb, const struct flowi *flp, struct fib_result *res)
1211{
1212 struct trie *t = (struct trie *) tb->tb_data;
1213 int plen, ret = 0;
1214 struct node *n;
1215 struct tnode *pn;
1216 int pos, bits;
1217 t_key key=ntohl(flp->fl4_dst);
1218 int chopped_off;
1219 t_key cindex = 0;
1220 int current_prefix_length = KEYLENGTH;
1221 n = t->trie;
1222
1223 read_lock(&fib_lock);
1224 if(!n)
1225 goto failed;
1226
1227#ifdef CONFIG_IP_FIB_TRIE_STATS
1228 t->stats.gets++;
1229#endif
1230
1231 /* Just a leaf? */
1232 if (IS_LEAF(n)) {
1233 if( check_leaf(t, (struct leaf *)n, key, &plen, flp, res, &ret) )
1234 goto found;
1235 goto failed;
1236 }
1237 pn = (struct tnode *) n;
1238 chopped_off = 0;
1239
1240 while (pn) {
1241
1242 pos = pn->pos;
1243 bits = pn->bits;
1244
1245 if(!chopped_off)
1246 cindex = tkey_extract_bits(MASK_PFX(key, current_prefix_length), pos, bits);
1247
1248 n = tnode_get_child(pn, cindex);
1249
1250 if (n == NULL) {
1251#ifdef CONFIG_IP_FIB_TRIE_STATS
1252 t->stats.null_node_hit++;
1253#endif
1254 goto backtrace;
1255 }
1256
1257 if (IS_TNODE(n)) {
1258#define HL_OPTIMIZE
1259#ifdef HL_OPTIMIZE
1260 struct tnode *cn = (struct tnode *)n;
1261 t_key node_prefix, key_prefix, pref_mismatch;
1262 int mp;
1263
1264 /*
1265 * It's a tnode, and we can do some extra checks here if we
1266 * like, to avoid descending into a dead-end branch.
1267 * This tnode is in the parent's child array at index
1268 * key[p_pos..p_pos+p_bits] but potentially with some bits
1269 * chopped off, so in reality the index may be just a
1270 * subprefix, padded with zero at the end.
1271 * We can also take a look at any skipped bits in this
1272 * tnode - everything up to p_pos is supposed to be ok,
1273 * and the non-chopped bits of the index (se previous
1274 * paragraph) are also guaranteed ok, but the rest is
1275 * considered unknown.
1276 *
1277 * The skipped bits are key[pos+bits..cn->pos].
1278 */
1279
1280 /* If current_prefix_length < pos+bits, we are already doing
1281 * actual prefix matching, which means everything from
1282 * pos+(bits-chopped_off) onward must be zero along some
1283 * branch of this subtree - otherwise there is *no* valid
1284 * prefix present. Here we can only check the skipped
1285 * bits. Remember, since we have already indexed into the
1286 * parent's child array, we know that the bits we chopped of
1287 * *are* zero.
1288 */
1289
1290 /* NOTA BENE: CHECKING ONLY SKIPPED BITS FOR THE NEW NODE HERE */
1291
1292 if (current_prefix_length < pos+bits) {
1293 if (tkey_extract_bits(cn->key, current_prefix_length,
1294 cn->pos - current_prefix_length) != 0 ||
1295 !(cn->child[0]))
1296 goto backtrace;
1297 }
1298
1299 /*
1300 * If chopped_off=0, the index is fully validated and we
1301 * only need to look at the skipped bits for this, the new,
1302 * tnode. What we actually want to do is to find out if
1303 * these skipped bits match our key perfectly, or if we will
1304 * have to count on finding a matching prefix further down,
1305 * because if we do, we would like to have some way of
1306 * verifying the existence of such a prefix at this point.
1307 */
1308
1309 /* The only thing we can do at this point is to verify that
1310 * any such matching prefix can indeed be a prefix to our
1311 * key, and if the bits in the node we are inspecting that
1312 * do not match our key are not ZERO, this cannot be true.
1313 * Thus, find out where there is a mismatch (before cn->pos)
1314 * and verify that all the mismatching bits are zero in the
1315 * new tnode's key.
1316 */
1317
1318 /* Note: We aren't very concerned about the piece of the key
1319 * that precede pn->pos+pn->bits, since these have already been
1320 * checked. The bits after cn->pos aren't checked since these are
1321 * by definition "unknown" at this point. Thus, what we want to
1322 * see is if we are about to enter the "prefix matching" state,
1323 * and in that case verify that the skipped bits that will prevail
1324 * throughout this subtree are zero, as they have to be if we are
1325 * to find a matching prefix.
1326 */
1327
1328 node_prefix = MASK_PFX(cn->key, cn->pos);
1329 key_prefix = MASK_PFX(key, cn->pos);
1330 pref_mismatch = key_prefix^node_prefix;
1331 mp = 0;
1332
1333 /* In short: If skipped bits in this node do not match the search
1334 * key, enter the "prefix matching" state.directly.
1335 */
1336 if (pref_mismatch) {
1337 while (!(pref_mismatch & (1<<(KEYLENGTH-1)))) {
1338 mp++;
1339 pref_mismatch = pref_mismatch <<1;
1340 }
1341 key_prefix = tkey_extract_bits(cn->key, mp, cn->pos-mp);
1342
1343 if (key_prefix != 0)
1344 goto backtrace;
1345
1346 if (current_prefix_length >= cn->pos)
1347 current_prefix_length=mp;
1348 }
1349#endif
1350 pn = (struct tnode *)n; /* Descend */
1351 chopped_off = 0;
1352 continue;
1353 }
1354 if (IS_LEAF(n)) {
1355 if( check_leaf(t, (struct leaf *)n, key, &plen, flp, res, &ret))
1356 goto found;
1357 }
1358backtrace:
1359 chopped_off++;
1360
1361 /* As zero don't change the child key (cindex) */
1362 while ((chopped_off <= pn->bits) && !(cindex & (1<<(chopped_off-1)))) {
1363 chopped_off++;
1364 }
1365
1366 /* Decrease current_... with bits chopped off */
1367 if (current_prefix_length > pn->pos + pn->bits - chopped_off)
1368 current_prefix_length = pn->pos + pn->bits - chopped_off;
1369
1370 /*
1371 * Either we do the actual chop off according or if we have
1372 * chopped off all bits in this tnode walk up to our parent.
1373 */
1374
1375 if(chopped_off <= pn->bits)
1376 cindex &= ~(1 << (chopped_off-1));
1377 else {
1378 if( NODE_PARENT(pn) == NULL)
1379 goto failed;
1380
1381 /* Get Child's index */
1382 cindex = tkey_extract_bits(pn->key, NODE_PARENT(pn)->pos, NODE_PARENT(pn)->bits);
1383 pn = NODE_PARENT(pn);
1384 chopped_off = 0;
1385
1386#ifdef CONFIG_IP_FIB_TRIE_STATS
1387 t->stats.backtrack++;
1388#endif
1389 goto backtrace;
1390 }
1391 }
1392failed:
1393 ret = 1;
1394found:
1395 read_unlock(&fib_lock);
1396 return ret;
1397}
1398
1399static int trie_leaf_remove(struct trie *t, t_key key)
1400{
1401 t_key cindex;
1402 struct tnode *tp = NULL;
1403 struct node *n = t->trie;
1404 struct leaf *l;
1405
1406 if(trie_debug)
1407 printk("entering trie_leaf_remove(%p)\n", n);
1408
1409 /* Note that in the case skipped bits, those bits are *not* checked!
1410 * When we finish this, we will have NULL or a T_LEAF, and the
1411 * T_LEAF may or may not match our key.
1412 */
1413
1414 while (n != NULL && IS_TNODE(n)) {
1415 struct tnode *tn = (struct tnode *) n;
1416 check_tnode(tn);
1417 n = tnode_get_child(tn ,tkey_extract_bits(key, tn->pos, tn->bits));
1418
1419 if(n && NODE_PARENT(n) != tn) {
1420 printk("BUG tn=%p, n->parent=%p\n", tn, NODE_PARENT(n));
1421 BUG();
1422 }
1423 }
1424 l = (struct leaf *) n;
1425
1426 if(!n || !tkey_equals(l->key, key))
1427 return 0;
1428
1429 /*
1430 * Key found.
1431 * Remove the leaf and rebalance the tree
1432 */
1433
1434 t->revision++;
1435 t->size--;
1436
1437 tp = NODE_PARENT(n);
1438 tnode_free((struct tnode *) n);
1439
1440 if(tp) {
1441 cindex = tkey_extract_bits(key, tp->pos, tp->bits);
1442 put_child(t, (struct tnode *)tp, cindex, NULL);
1443 t->trie = trie_rebalance(t, tp);
1444 }
1445 else
1446 t->trie = NULL;
1447
1448 return 1;
1449}
1450
1451static int
1452fn_trie_delete(struct fib_table *tb, struct rtmsg *r, struct kern_rta *rta,
1453 struct nlmsghdr *nlhdr, struct netlink_skb_parms *req)
1454{
1455 struct trie *t = (struct trie *) tb->tb_data;
1456 u32 key, mask;
1457 int plen = r->rtm_dst_len;
1458 u8 tos = r->rtm_tos;
1459 struct fib_alias *fa, *fa_to_delete;
1460 struct list_head *fa_head;
1461 struct leaf *l;
1462
1463 if (plen > 32)
1464 return -EINVAL;
1465
1466 key = 0;
1467 if (rta->rta_dst)
1468 memcpy(&key, rta->rta_dst, 4);
1469
1470 key = ntohl(key);
1471 mask = ntohl( inet_make_mask(plen) );
1472
1473 if(key & ~mask)
1474 return -EINVAL;
1475
1476 key = key & mask;
1477 l = fib_find_node(t, key);
1478
1479 if(!l)
1480 return -ESRCH;
1481
1482 fa_head = get_fa_head(l, plen);
1483 fa = fib_find_alias(fa_head, tos, 0);
1484
1485 if (!fa)
1486 return -ESRCH;
1487
1488 if (trie_debug)
1489 printk("Deleting %08x/%d tos=%d t=%p\n", key, plen, tos, t);
1490
1491 fa_to_delete = NULL;
1492 fa_head = fa->fa_list.prev;
1493 list_for_each_entry(fa, fa_head, fa_list) {
1494 struct fib_info *fi = fa->fa_info;
1495
1496 if (fa->fa_tos != tos)
1497 break;
1498
1499 if ((!r->rtm_type ||
1500 fa->fa_type == r->rtm_type) &&
1501 (r->rtm_scope == RT_SCOPE_NOWHERE ||
1502 fa->fa_scope == r->rtm_scope) &&
1503 (!r->rtm_protocol ||
1504 fi->fib_protocol == r->rtm_protocol) &&
1505 fib_nh_match(r, nlhdr, rta, fi) == 0) {
1506 fa_to_delete = fa;
1507 break;
1508 }
1509 }
1510
1511 if (fa_to_delete) {
1512 int kill_li = 0;
1513 struct leaf_info *li;
1514
1515 fa = fa_to_delete;
1516 rtmsg_fib(RTM_DELROUTE, htonl(key), fa, plen, tb->tb_id, nlhdr, req);
1517
1518 l = fib_find_node(t, key);
1519 li = find_leaf_info(&l->list, plen);
1520
1521 write_lock_bh(&fib_lock);
1522
1523 list_del(&fa->fa_list);
1524
1525 if(list_empty(fa_head)) {
1526 hlist_del(&li->hlist);
1527 kill_li = 1;
1528 }
1529 write_unlock_bh(&fib_lock);
1530
1531 if(kill_li)
1532 free_leaf_info(li);
1533
1534 if(hlist_empty(&l->list))
1535 trie_leaf_remove(t, key);
1536
1537 if (fa->fa_state & FA_S_ACCESSED)
1538 rt_cache_flush(-1);
1539
1540 fn_free_alias(fa);
1541 return 0;
1542 }
1543 return -ESRCH;
1544}
1545
1546static int trie_flush_list(struct trie *t, struct list_head *head)
1547{
1548 struct fib_alias *fa, *fa_node;
1549 int found = 0;
1550
1551 list_for_each_entry_safe(fa, fa_node, head, fa_list) {
1552 struct fib_info *fi = fa->fa_info;
1553
1554 if (fi && (fi->fib_flags&RTNH_F_DEAD)) {
1555
1556 write_lock_bh(&fib_lock);
1557 list_del(&fa->fa_list);
1558 write_unlock_bh(&fib_lock);
1559
1560 fn_free_alias(fa);
1561 found++;
1562 }
1563 }
1564 return found;
1565}
1566
1567static int trie_flush_leaf(struct trie *t, struct leaf *l)
1568{
1569 int found = 0;
1570 struct hlist_head *lih = &l->list;
1571 struct hlist_node *node, *tmp;
1572 struct leaf_info *li = NULL;
1573
1574 hlist_for_each_entry_safe(li, node, tmp, lih, hlist) {
1575
1576 found += trie_flush_list(t, &li->falh);
1577
1578 if (list_empty(&li->falh)) {
1579
1580 write_lock_bh(&fib_lock);
1581 hlist_del(&li->hlist);
1582 write_unlock_bh(&fib_lock);
1583
1584 free_leaf_info(li);
1585 }
1586 }
1587 return found;
1588}
1589
1590static struct leaf *nextleaf(struct trie *t, struct leaf *thisleaf)
1591{
1592 struct node *c = (struct node *) thisleaf;
1593 struct tnode *p;
1594 int idx;
1595
1596 if(c == NULL) {
1597 if(t->trie == NULL)
1598 return NULL;
1599
1600 if (IS_LEAF(t->trie)) /* trie w. just a leaf */
1601 return (struct leaf *) t->trie;
1602
1603 p = (struct tnode*) t->trie; /* Start */
1604 }
1605 else
1606 p = (struct tnode *) NODE_PARENT(c);
1607 while (p) {
1608 int pos, last;
1609
1610 /* Find the next child of the parent */
1611 if(c)
1612 pos = 1 + tkey_extract_bits(c->key, p->pos, p->bits);
1613 else
1614 pos = 0;
1615
1616 last = 1 << p->bits;
1617 for(idx = pos; idx < last ; idx++) {
1618 if( p->child[idx]) {
1619
1620 /* Decend if tnode */
1621
1622 while (IS_TNODE(p->child[idx])) {
1623 p = (struct tnode*) p->child[idx];
1624 idx = 0;
1625
1626 /* Rightmost non-NULL branch */
1627 if( p && IS_TNODE(p) )
1628 while ( p->child[idx] == NULL && idx < (1 << p->bits) ) idx++;
1629
1630 /* Done with this tnode? */
1631 if( idx >= (1 << p->bits) || p->child[idx] == NULL )
1632 goto up;
1633 }
1634 return (struct leaf*) p->child[idx];
1635 }
1636 }
1637up:
1638 /* No more children go up one step */
1639 c = (struct node*) p;
1640 p = (struct tnode *) NODE_PARENT(p);
1641 }
1642 return NULL; /* Ready. Root of trie */
1643}
1644
1645static int fn_trie_flush(struct fib_table *tb)
1646{
1647 struct trie *t = (struct trie *) tb->tb_data;
1648 struct leaf *ll = NULL, *l = NULL;
1649 int found = 0, h;
1650
1651 t->revision++;
1652
1653 for (h=0; (l = nextleaf(t, l)) != NULL; h++) {
1654 found += trie_flush_leaf(t, l);
1655
1656 if (ll && hlist_empty(&ll->list))
1657 trie_leaf_remove(t, ll->key);
1658 ll = l;
1659 }
1660
1661 if (ll && hlist_empty(&ll->list))
1662 trie_leaf_remove(t, ll->key);
1663
1664 if(trie_debug)
1665 printk("trie_flush found=%d\n", found);
1666 return found;
1667}
1668
1669static int trie_last_dflt=-1;
1670
1671static void
1672fn_trie_select_default(struct fib_table *tb, const struct flowi *flp, struct fib_result *res)
1673{
1674 struct trie *t = (struct trie *) tb->tb_data;
1675 int order, last_idx;
1676 struct fib_info *fi = NULL;
1677 struct fib_info *last_resort;
1678 struct fib_alias *fa = NULL;
1679 struct list_head *fa_head;
1680 struct leaf *l;
1681
1682 last_idx = -1;
1683 last_resort = NULL;
1684 order = -1;
1685
1686 read_lock(&fib_lock);
1687
1688 l = fib_find_node(t, 0);
1689 if(!l)
1690 goto out;
1691
1692 fa_head = get_fa_head(l, 0);
1693 if(!fa_head)
1694 goto out;
1695
1696 if (list_empty(fa_head))
1697 goto out;
1698
1699 list_for_each_entry(fa, fa_head, fa_list) {
1700 struct fib_info *next_fi = fa->fa_info;
1701
1702 if (fa->fa_scope != res->scope ||
1703 fa->fa_type != RTN_UNICAST)
1704 continue;
1705
1706 if (next_fi->fib_priority > res->fi->fib_priority)
1707 break;
1708 if (!next_fi->fib_nh[0].nh_gw ||
1709 next_fi->fib_nh[0].nh_scope != RT_SCOPE_LINK)
1710 continue;
1711 fa->fa_state |= FA_S_ACCESSED;
1712
1713 if (fi == NULL) {
1714 if (next_fi != res->fi)
1715 break;
1716 } else if (!fib_detect_death(fi, order, &last_resort,
1717 &last_idx, &trie_last_dflt)) {
1718 if (res->fi)
1719 fib_info_put(res->fi);
1720 res->fi = fi;
1721 atomic_inc(&fi->fib_clntref);
1722 trie_last_dflt = order;
1723 goto out;
1724 }
1725 fi = next_fi;
1726 order++;
1727 }
1728 if (order <= 0 || fi == NULL) {
1729 trie_last_dflt = -1;
1730 goto out;
1731 }
1732
1733 if (!fib_detect_death(fi, order, &last_resort, &last_idx, &trie_last_dflt)) {
1734 if (res->fi)
1735 fib_info_put(res->fi);
1736 res->fi = fi;
1737 atomic_inc(&fi->fib_clntref);
1738 trie_last_dflt = order;
1739 goto out;
1740 }
1741 if (last_idx >= 0) {
1742 if (res->fi)
1743 fib_info_put(res->fi);
1744 res->fi = last_resort;
1745 if (last_resort)
1746 atomic_inc(&last_resort->fib_clntref);
1747 }
1748 trie_last_dflt = last_idx;
1749 out:;
1750 read_unlock(&fib_lock);
1751}
1752
1753static int fn_trie_dump_fa(t_key key, int plen, struct list_head *fah, struct fib_table *tb,
1754 struct sk_buff *skb, struct netlink_callback *cb)
1755{
1756 int i, s_i;
1757 struct fib_alias *fa;
1758
1759 u32 xkey=htonl(key);
1760
1761 s_i=cb->args[3];
1762 i = 0;
1763
1764 list_for_each_entry(fa, fah, fa_list) {
1765 if (i < s_i) {
1766 i++;
1767 continue;
1768 }
1769 if (fa->fa_info->fib_nh == NULL) {
1770 printk("Trie error _fib_nh=NULL in fa[%d] k=%08x plen=%d\n", i, key, plen);
1771 i++;
1772 continue;
1773 }
1774 if (fa->fa_info == NULL) {
1775 printk("Trie error fa_info=NULL in fa[%d] k=%08x plen=%d\n", i, key, plen);
1776 i++;
1777 continue;
1778 }
1779
1780 if (fib_dump_info(skb, NETLINK_CB(cb->skb).pid,
1781 cb->nlh->nlmsg_seq,
1782 RTM_NEWROUTE,
1783 tb->tb_id,
1784 fa->fa_type,
1785 fa->fa_scope,
1786 &xkey,
1787 plen,
1788 fa->fa_tos,
1789 fa->fa_info, 0) < 0) {
1790 cb->args[3] = i;
1791 return -1;
1792 }
1793 i++;
1794 }
1795 cb->args[3]=i;
1796 return skb->len;
1797}
1798
1799static int fn_trie_dump_plen(struct trie *t, int plen, struct fib_table *tb, struct sk_buff *skb,
1800 struct netlink_callback *cb)
1801{
1802 int h, s_h;
1803 struct list_head *fa_head;
1804 struct leaf *l = NULL;
1805 s_h=cb->args[2];
1806
1807 for (h=0; (l = nextleaf(t, l)) != NULL; h++) {
1808
1809 if (h < s_h)
1810 continue;
1811 if (h > s_h)
1812 memset(&cb->args[3], 0,
1813 sizeof(cb->args) - 3*sizeof(cb->args[0]));
1814
1815 fa_head = get_fa_head(l, plen);
1816
1817 if(!fa_head)
1818 continue;
1819
1820 if(list_empty(fa_head))
1821 continue;
1822
1823 if (fn_trie_dump_fa(l->key, plen, fa_head, tb, skb, cb)<0) {
1824 cb->args[2]=h;
1825 return -1;
1826 }
1827 }
1828 cb->args[2]=h;
1829 return skb->len;
1830}
1831
1832static int fn_trie_dump(struct fib_table *tb, struct sk_buff *skb, struct netlink_callback *cb)
1833{
1834 int m, s_m;
1835 struct trie *t = (struct trie *) tb->tb_data;
1836
1837 s_m = cb->args[1];
1838
1839 read_lock(&fib_lock);
1840 for (m=0; m<=32; m++) {
1841
1842 if (m < s_m)
1843 continue;
1844 if (m > s_m)
1845 memset(&cb->args[2], 0,
1846 sizeof(cb->args) - 2*sizeof(cb->args[0]));
1847
1848 if (fn_trie_dump_plen(t, 32-m, tb, skb, cb)<0) {
1849 cb->args[1] = m;
1850 goto out;
1851 }
1852 }
1853 read_unlock(&fib_lock);
1854 cb->args[1] = m;
1855 return skb->len;
1856 out:
1857 read_unlock(&fib_lock);
1858 return -1;
1859}
1860
1861/* Fix more generic FIB names for init later */
1862
1863#ifdef CONFIG_IP_MULTIPLE_TABLES
1864struct fib_table * fib_hash_init(int id)
1865#else
1866struct fib_table * __init fib_hash_init(int id)
1867#endif
1868{
1869 struct fib_table *tb;
1870 struct trie *t;
1871
1872 if (fn_alias_kmem == NULL)
1873 fn_alias_kmem = kmem_cache_create("ip_fib_alias",
1874 sizeof(struct fib_alias),
1875 0, SLAB_HWCACHE_ALIGN,
1876 NULL, NULL);
1877
1878 tb = kmalloc(sizeof(struct fib_table) + sizeof(struct trie),
1879 GFP_KERNEL);
1880 if (tb == NULL)
1881 return NULL;
1882
1883 tb->tb_id = id;
1884 tb->tb_lookup = fn_trie_lookup;
1885 tb->tb_insert = fn_trie_insert;
1886 tb->tb_delete = fn_trie_delete;
1887 tb->tb_flush = fn_trie_flush;
1888 tb->tb_select_default = fn_trie_select_default;
1889 tb->tb_dump = fn_trie_dump;
1890 memset(tb->tb_data, 0, sizeof(struct trie));
1891
1892 t = (struct trie *) tb->tb_data;
1893
1894 trie_init(t);
1895
1896 if (id == RT_TABLE_LOCAL)
1897 trie_local=t;
1898 else if (id == RT_TABLE_MAIN)
1899 trie_main=t;
1900
1901 if (id == RT_TABLE_LOCAL)
1902 printk("IPv4 FIB: Using LC-trie version %s\n", VERSION);
1903
1904 return tb;
1905}
1906
1907/* Trie dump functions */
1908
1909static void putspace_seq(struct seq_file *seq, int n)
1910{
1911 while (n--) seq_printf(seq, " ");
1912}
1913
1914static void printbin_seq(struct seq_file *seq, unsigned int v, int bits)
1915{
1916 while (bits--)
1917 seq_printf(seq, "%s", (v & (1<<bits))?"1":"0");
1918}
1919
1920static void printnode_seq(struct seq_file *seq, int indent, struct node *n,
1921 int pend, int cindex, int bits)
1922{
1923 putspace_seq(seq, indent);
1924 if (IS_LEAF(n))
1925 seq_printf(seq, "|");
1926 else
1927 seq_printf(seq, "+");
1928 if (bits) {
1929 seq_printf(seq, "%d/", cindex);
1930 printbin_seq(seq, cindex, bits);
1931 seq_printf(seq, ": ");
1932 }
1933 else
1934 seq_printf(seq, "<root>: ");
1935 seq_printf(seq, "%s:%p ", IS_LEAF(n)?"Leaf":"Internal node", n);
1936
1937 if (IS_LEAF(n))
1938 seq_printf(seq, "key=%d.%d.%d.%d\n",
1939 n->key >> 24, (n->key >> 16) % 256, (n->key >> 8) % 256, n->key % 256);
1940 else {
1941 int plen=((struct tnode *)n)->pos;
1942 t_key prf=MASK_PFX(n->key, plen);
1943 seq_printf(seq, "key=%d.%d.%d.%d/%d\n",
1944 prf >> 24, (prf >> 16) % 256, (prf >> 8) % 256, prf % 256, plen);
1945 }
1946 if (IS_LEAF(n)) {
1947 struct leaf *l=(struct leaf *)n;
1948 struct fib_alias *fa;
1949 int i;
1950 for (i=32; i>=0; i--)
1951 if(find_leaf_info(&l->list, i)) {
1952
1953 struct list_head *fa_head = get_fa_head(l, i);
1954
1955 if(!fa_head)
1956 continue;
1957
1958 if(list_empty(fa_head))
1959 continue;
1960
1961 putspace_seq(seq, indent+2);
1962 seq_printf(seq, "{/%d...dumping}\n", i);
1963
1964
1965 list_for_each_entry(fa, fa_head, fa_list) {
1966 putspace_seq(seq, indent+2);
1967 if (fa->fa_info->fib_nh == NULL) {
1968 seq_printf(seq, "Error _fib_nh=NULL\n");
1969 continue;
1970 }
1971 if (fa->fa_info == NULL) {
1972 seq_printf(seq, "Error fa_info=NULL\n");
1973 continue;
1974 }
1975
1976 seq_printf(seq, "{type=%d scope=%d TOS=%d}\n",
1977 fa->fa_type,
1978 fa->fa_scope,
1979 fa->fa_tos);
1980 }
1981 }
1982 }
1983 else if (IS_TNODE(n)) {
1984 struct tnode *tn=(struct tnode *)n;
1985 putspace_seq(seq, indent); seq_printf(seq, "| ");
1986 seq_printf(seq, "{key prefix=%08x/", tn->key&TKEY_GET_MASK(0, tn->pos));
1987 printbin_seq(seq, tkey_extract_bits(tn->key, 0, tn->pos), tn->pos);
1988 seq_printf(seq, "}\n");
1989 putspace_seq(seq, indent); seq_printf(seq, "| ");
1990 seq_printf(seq, "{pos=%d", tn->pos);
1991 seq_printf(seq, " (skip=%d bits)", tn->pos - pend);
1992 seq_printf(seq, " bits=%d (%u children)}\n", tn->bits, (1 << tn->bits));
1993 putspace_seq(seq, indent); seq_printf(seq, "| ");
1994 seq_printf(seq, "{empty=%d full=%d}\n", tn->empty_children, tn->full_children);
1995 }
1996}
1997
1998static void trie_dump_seq(struct seq_file *seq, struct trie *t)
1999{
2000 struct node *n=t->trie;
2001 int cindex=0;
2002 int indent=1;
2003 int pend=0;
2004 int depth = 0;
2005
2006 read_lock(&fib_lock);
2007
2008 seq_printf(seq, "------ trie_dump of t=%p ------\n", t);
2009 if (n) {
2010 printnode_seq(seq, indent, n, pend, cindex, 0);
2011 if (IS_TNODE(n)) {
2012 struct tnode *tn=(struct tnode *)n;
2013 pend = tn->pos+tn->bits;
2014 putspace_seq(seq, indent); seq_printf(seq, "\\--\n");
2015 indent += 3;
2016 depth++;
2017
2018 while (tn && cindex < (1 << tn->bits)) {
2019 if (tn->child[cindex]) {
2020
2021 /* Got a child */
2022
2023 printnode_seq(seq, indent, tn->child[cindex], pend, cindex, tn->bits);
2024 if (IS_LEAF(tn->child[cindex])) {
2025 cindex++;
2026
2027 }
2028 else {
2029 /*
2030 * New tnode. Decend one level
2031 */
2032
2033 depth++;
2034 n=tn->child[cindex];
2035 tn=(struct tnode *)n;
2036 pend=tn->pos+tn->bits;
2037 putspace_seq(seq, indent); seq_printf(seq, "\\--\n");
2038 indent+=3;
2039 cindex=0;
2040 }
2041 }
2042 else
2043 cindex++;
2044
2045 /*
2046 * Test if we are done
2047 */
2048
2049 while (cindex >= (1 << tn->bits)) {
2050
2051 /*
2052 * Move upwards and test for root
2053 * pop off all traversed nodes
2054 */
2055
2056 if (NODE_PARENT(tn) == NULL) {
2057 tn = NULL;
2058 n = NULL;
2059 break;
2060 }
2061 else {
2062 cindex = tkey_extract_bits(tn->key, NODE_PARENT(tn)->pos, NODE_PARENT(tn)->bits);
2063 tn = NODE_PARENT(tn);
2064 cindex++;
2065 n=(struct node *)tn;
2066 pend=tn->pos+tn->bits;
2067 indent-=3;
2068 depth--;
2069 }
2070 }
2071 }
2072 }
2073 else n = NULL;
2074 }
2075 else seq_printf(seq, "------ trie is empty\n");
2076
2077 read_unlock(&fib_lock);
2078}
2079
2080static struct trie_stat *trie_stat_new(void)
2081{
2082 struct trie_stat *s = kmalloc(sizeof(struct trie_stat), GFP_KERNEL);
2083 int i;
2084
2085 if(s) {
2086 s->totdepth = 0;
2087 s->maxdepth = 0;
2088 s->tnodes = 0;
2089 s->leaves = 0;
2090 s->nullpointers = 0;
2091
2092 for(i=0; i< MAX_CHILDS; i++)
2093 s->nodesizes[i] = 0;
2094 }
2095 return s;
2096}
2097
2098static struct trie_stat *trie_collect_stats(struct trie *t)
2099{
2100 struct node *n=t->trie;
2101 struct trie_stat *s = trie_stat_new();
2102 int cindex = 0;
2103 int indent = 1;
2104 int pend = 0;
2105 int depth = 0;
2106
2107 read_lock(&fib_lock);
2108
2109 if (s) {
2110 if (n) {
2111 if (IS_TNODE(n)) {
2112 struct tnode *tn = (struct tnode *)n;
2113 pend=tn->pos+tn->bits;
2114 indent += 3;
2115 s->nodesizes[tn->bits]++;
2116 depth++;
2117
2118 while (tn && cindex < (1 << tn->bits)) {
2119 if (tn->child[cindex]) {
2120 /* Got a child */
2121
2122 if (IS_LEAF(tn->child[cindex])) {
2123 cindex++;
2124
2125 /* stats */
2126 if (depth > s->maxdepth)
2127 s->maxdepth = depth;
2128 s->totdepth += depth;
2129 s->leaves++;
2130 }
2131
2132 else {
2133 /*
2134 * New tnode. Decend one level
2135 */
2136
2137 s->tnodes++;
2138 s->nodesizes[tn->bits]++;
2139 depth++;
2140
2141 n = tn->child[cindex];
2142 tn = (struct tnode *)n;
2143 pend = tn->pos+tn->bits;
2144
2145 indent += 3;
2146 cindex = 0;
2147 }
2148 }
2149 else {
2150 cindex++;
2151 s->nullpointers++;
2152 }
2153
2154 /*
2155 * Test if we are done
2156 */
2157
2158 while (cindex >= (1 << tn->bits)) {
2159
2160 /*
2161 * Move upwards and test for root
2162 * pop off all traversed nodes
2163 */
2164
2165
2166 if (NODE_PARENT(tn) == NULL) {
2167 tn = NULL;
2168 n = NULL;
2169 break;
2170 }
2171 else {
2172 cindex = tkey_extract_bits(tn->key, NODE_PARENT(tn)->pos, NODE_PARENT(tn)->bits);
2173 tn = NODE_PARENT(tn);
2174 cindex++;
2175 n = (struct node *)tn;
2176 pend=tn->pos+tn->bits;
2177 indent -= 3;
2178 depth--;
2179 }
2180 }
2181 }
2182 }
2183 else n = NULL;
2184 }
2185 }
2186
2187 read_unlock(&fib_lock);
2188 return s;
2189}
2190
2191#ifdef CONFIG_PROC_FS
2192
2193static struct fib_alias *fib_triestat_get_first(struct seq_file *seq)
2194{
2195 return NULL;
2196}
2197
2198static struct fib_alias *fib_triestat_get_next(struct seq_file *seq)
2199{
2200 return NULL;
2201}
2202
2203static void *fib_triestat_seq_start(struct seq_file *seq, loff_t *pos)
2204{
2205 void *v = NULL;
2206
2207 if (ip_fib_main_table)
2208 v = *pos ? fib_triestat_get_next(seq) : SEQ_START_TOKEN;
2209 return v;
2210}
2211
2212static void *fib_triestat_seq_next(struct seq_file *seq, void *v, loff_t *pos)
2213{
2214 ++*pos;
2215 return v == SEQ_START_TOKEN ? fib_triestat_get_first(seq) : fib_triestat_get_next(seq);
2216}
2217
2218static void fib_triestat_seq_stop(struct seq_file *seq, void *v)
2219{
2220
2221}
2222
2223/*
2224 * This outputs /proc/net/fib_triestats
2225 *
2226 * It always works in backward compatibility mode.
2227 * The format of the file is not supposed to be changed.
2228 */
2229
2230static void collect_and_show(struct trie *t, struct seq_file *seq)
2231{
2232 int bytes = 0; /* How many bytes are used, a ref is 4 bytes */
2233 int i, max, pointers;
2234 struct trie_stat *stat;
2235 int avdepth;
2236
2237 stat = trie_collect_stats(t);
2238
2239 bytes=0;
2240 seq_printf(seq, "trie=%p\n", t);
2241
2242 if (stat) {
2243 if (stat->leaves)
2244 avdepth=stat->totdepth*100 / stat->leaves;
2245 else
2246 avdepth=0;
2247 seq_printf(seq, "Aver depth: %d.%02d\n", avdepth / 100, avdepth % 100 );
2248 seq_printf(seq, "Max depth: %4d\n", stat->maxdepth);
2249
2250 seq_printf(seq, "Leaves: %d\n", stat->leaves);
2251 bytes += sizeof(struct leaf) * stat->leaves;
2252 seq_printf(seq, "Internal nodes: %d\n", stat->tnodes);
2253 bytes += sizeof(struct tnode) * stat->tnodes;
2254
2255 max = MAX_CHILDS-1;
2256
2257 while (max >= 0 && stat->nodesizes[max] == 0)
2258 max--;
2259 pointers = 0;
2260
2261 for (i = 1; i <= max; i++)
2262 if (stat->nodesizes[i] != 0) {
2263 seq_printf(seq, " %d: %d", i, stat->nodesizes[i]);
2264 pointers += (1<<i) * stat->nodesizes[i];
2265 }
2266 seq_printf(seq, "\n");
2267 seq_printf(seq, "Pointers: %d\n", pointers);
2268 bytes += sizeof(struct node *) * pointers;
2269 seq_printf(seq, "Null ptrs: %d\n", stat->nullpointers);
2270 seq_printf(seq, "Total size: %d kB\n", bytes / 1024);
2271
2272 kfree(stat);
2273 }
2274
2275#ifdef CONFIG_IP_FIB_TRIE_STATS
2276 seq_printf(seq, "Counters:\n---------\n");
2277 seq_printf(seq,"gets = %d\n", t->stats.gets);
2278 seq_printf(seq,"backtracks = %d\n", t->stats.backtrack);
2279 seq_printf(seq,"semantic match passed = %d\n", t->stats.semantic_match_passed);
2280 seq_printf(seq,"semantic match miss = %d\n", t->stats.semantic_match_miss);
2281 seq_printf(seq,"null node hit= %d\n", t->stats.null_node_hit);
2282#ifdef CLEAR_STATS
2283 memset(&(t->stats), 0, sizeof(t->stats));
2284#endif
2285#endif /* CONFIG_IP_FIB_TRIE_STATS */
2286}
2287
2288static int fib_triestat_seq_show(struct seq_file *seq, void *v)
2289{
2290 char bf[128];
2291
2292 if (v == SEQ_START_TOKEN) {
2293 seq_printf(seq, "Basic info: size of leaf: %Zd bytes, size of tnode: %Zd bytes.\n",
2294 sizeof(struct leaf), sizeof(struct tnode));
2295 if (trie_local)
2296 collect_and_show(trie_local, seq);
2297
2298 if (trie_main)
2299 collect_and_show(trie_main, seq);
2300 }
2301 else {
2302 snprintf(bf, sizeof(bf),
2303 "*\t%08X\t%08X", 200, 400);
2304
2305 seq_printf(seq, "%-127s\n", bf);
2306 }
2307 return 0;
2308}
2309
2310static struct seq_operations fib_triestat_seq_ops = {
2311 .start = fib_triestat_seq_start,
2312 .next = fib_triestat_seq_next,
2313 .stop = fib_triestat_seq_stop,
2314 .show = fib_triestat_seq_show,
2315};
2316
2317static int fib_triestat_seq_open(struct inode *inode, struct file *file)
2318{
2319 struct seq_file *seq;
2320 int rc = -ENOMEM;
2321
2322 rc = seq_open(file, &fib_triestat_seq_ops);
2323 if (rc)
2324 goto out_kfree;
2325
2326 seq = file->private_data;
2327out:
2328 return rc;
2329out_kfree:
2330 goto out;
2331}
2332
2333static struct file_operations fib_triestat_seq_fops = {
2334 .owner = THIS_MODULE,
2335 .open = fib_triestat_seq_open,
2336 .read = seq_read,
2337 .llseek = seq_lseek,
2338 .release = seq_release_private,
2339};
2340
2341int __init fib_stat_proc_init(void)
2342{
2343 if (!proc_net_fops_create("fib_triestat", S_IRUGO, &fib_triestat_seq_fops))
2344 return -ENOMEM;
2345 return 0;
2346}
2347
2348void __init fib_stat_proc_exit(void)
2349{
2350 proc_net_remove("fib_triestat");
2351}
2352
2353static struct fib_alias *fib_trie_get_first(struct seq_file *seq)
2354{
2355 return NULL;
2356}
2357
2358static struct fib_alias *fib_trie_get_next(struct seq_file *seq)
2359{
2360 return NULL;
2361}
2362
2363static void *fib_trie_seq_start(struct seq_file *seq, loff_t *pos)
2364{
2365 void *v = NULL;
2366
2367 if (ip_fib_main_table)
2368 v = *pos ? fib_trie_get_next(seq) : SEQ_START_TOKEN;
2369 return v;
2370}
2371
2372static void *fib_trie_seq_next(struct seq_file *seq, void *v, loff_t *pos)
2373{
2374 ++*pos;
2375 return v == SEQ_START_TOKEN ? fib_trie_get_first(seq) : fib_trie_get_next(seq);
2376}
2377
2378static void fib_trie_seq_stop(struct seq_file *seq, void *v)
2379{
2380
2381}
2382
2383/*
2384 * This outputs /proc/net/fib_trie.
2385 *
2386 * It always works in backward compatibility mode.
2387 * The format of the file is not supposed to be changed.
2388 */
2389
2390static int fib_trie_seq_show(struct seq_file *seq, void *v)
2391{
2392 char bf[128];
2393
2394 if (v == SEQ_START_TOKEN) {
2395 if (trie_local)
2396 trie_dump_seq(seq, trie_local);
2397
2398 if (trie_main)
2399 trie_dump_seq(seq, trie_main);
2400 }
2401
2402 else {
2403 snprintf(bf, sizeof(bf),
2404 "*\t%08X\t%08X", 200, 400);
2405 seq_printf(seq, "%-127s\n", bf);
2406 }
2407
2408 return 0;
2409}
2410
2411static struct seq_operations fib_trie_seq_ops = {
2412 .start = fib_trie_seq_start,
2413 .next = fib_trie_seq_next,
2414 .stop = fib_trie_seq_stop,
2415 .show = fib_trie_seq_show,
2416};
2417
2418static int fib_trie_seq_open(struct inode *inode, struct file *file)
2419{
2420 struct seq_file *seq;
2421 int rc = -ENOMEM;
2422
2423 rc = seq_open(file, &fib_trie_seq_ops);
2424 if (rc)
2425 goto out_kfree;
2426
2427 seq = file->private_data;
2428out:
2429 return rc;
2430out_kfree:
2431 goto out;
2432}
2433
2434static struct file_operations fib_trie_seq_fops = {
2435 .owner = THIS_MODULE,
2436 .open = fib_trie_seq_open,
2437 .read = seq_read,
2438 .llseek = seq_lseek,
2439 .release = seq_release_private,
2440};
2441
2442int __init fib_proc_init(void)
2443{
2444 if (!proc_net_fops_create("fib_trie", S_IRUGO, &fib_trie_seq_fops))
2445 return -ENOMEM;
2446 return 0;
2447}
2448
2449void __init fib_proc_exit(void)
2450{
2451 proc_net_remove("fib_trie");
2452}
2453
2454#endif /* CONFIG_PROC_FS */
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
index 4e47a2658c7c..af2ec88bbb2f 100644
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -184,6 +184,7 @@ int ip_call_ra_chain(struct sk_buff *skb)
184 raw_rcv(last, skb2); 184 raw_rcv(last, skb2);
185 } 185 }
186 last = sk; 186 last = sk;
187 nf_reset(skb);
187 } 188 }
188 } 189 }
189 190
@@ -200,10 +201,6 @@ static inline int ip_local_deliver_finish(struct sk_buff *skb)
200{ 201{
201 int ihl = skb->nh.iph->ihl*4; 202 int ihl = skb->nh.iph->ihl*4;
202 203
203#ifdef CONFIG_NETFILTER_DEBUG
204 nf_debug_ip_local_deliver(skb);
205#endif /*CONFIG_NETFILTER_DEBUG*/
206
207 __skb_pull(skb, ihl); 204 __skb_pull(skb, ihl);
208 205
209 /* Free reference early: we don't need it any more, and it may 206 /* Free reference early: we don't need it any more, and it may
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 760dc8238d65..ee07aec215a0 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -107,10 +107,6 @@ static int ip_dev_loopback_xmit(struct sk_buff *newskb)
107 newskb->pkt_type = PACKET_LOOPBACK; 107 newskb->pkt_type = PACKET_LOOPBACK;
108 newskb->ip_summed = CHECKSUM_UNNECESSARY; 108 newskb->ip_summed = CHECKSUM_UNNECESSARY;
109 BUG_TRAP(newskb->dst); 109 BUG_TRAP(newskb->dst);
110
111#ifdef CONFIG_NETFILTER_DEBUG
112 nf_debug_ip_loopback_xmit(newskb);
113#endif
114 nf_reset(newskb); 110 nf_reset(newskb);
115 netif_rx(newskb); 111 netif_rx(newskb);
116 return 0; 112 return 0;
@@ -192,10 +188,6 @@ static inline int ip_finish_output2(struct sk_buff *skb)
192 skb = skb2; 188 skb = skb2;
193 } 189 }
194 190
195#ifdef CONFIG_NETFILTER_DEBUG
196 nf_debug_ip_finish_output2(skb);
197#endif /*CONFIG_NETFILTER_DEBUG*/
198
199 nf_reset(skb); 191 nf_reset(skb);
200 192
201 if (hh) { 193 if (hh) {
@@ -415,9 +407,6 @@ static void ip_copy_metadata(struct sk_buff *to, struct sk_buff *from)
415 to->nf_bridge = from->nf_bridge; 407 to->nf_bridge = from->nf_bridge;
416 nf_bridge_get(to->nf_bridge); 408 nf_bridge_get(to->nf_bridge);
417#endif 409#endif
418#ifdef CONFIG_NETFILTER_DEBUG
419 to->nf_debug = from->nf_debug;
420#endif
421#endif 410#endif
422} 411}
423 412
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index e21c049ec62a..e4f809a93f47 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -1350,6 +1350,7 @@ int ip_mr_input(struct sk_buff *skb)
1350 */ 1350 */
1351 read_lock(&mrt_lock); 1351 read_lock(&mrt_lock);
1352 if (mroute_socket) { 1352 if (mroute_socket) {
1353 nf_reset(skb);
1353 raw_rcv(mroute_socket, skb); 1354 raw_rcv(mroute_socket, skb);
1354 read_unlock(&mrt_lock); 1355 read_unlock(&mrt_lock);
1355 return 0; 1356 return 0;
diff --git a/net/ipv4/ipvs/ip_vs_xmit.c b/net/ipv4/ipvs/ip_vs_xmit.c
index de21da00057f..a8512a3fd08a 100644
--- a/net/ipv4/ipvs/ip_vs_xmit.c
+++ b/net/ipv4/ipvs/ip_vs_xmit.c
@@ -127,7 +127,6 @@ ip_vs_dst_reset(struct ip_vs_dest *dest)
127 127
128#define IP_VS_XMIT(skb, rt) \ 128#define IP_VS_XMIT(skb, rt) \
129do { \ 129do { \
130 nf_reset_debug(skb); \
131 (skb)->nfcache |= NFC_IPVS_PROPERTY; \ 130 (skb)->nfcache |= NFC_IPVS_PROPERTY; \
132 (skb)->ip_summed = CHECKSUM_NONE; \ 131 (skb)->ip_summed = CHECKSUM_NONE; \
133 NF_HOOK(PF_INET, NF_IP_LOCAL_OUT, (skb), NULL, \ 132 NF_HOOK(PF_INET, NF_IP_LOCAL_OUT, (skb), NULL, \
diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c
index df79f5ed6a0a..fa1634256680 100644
--- a/net/ipv4/netfilter/arp_tables.c
+++ b/net/ipv4/netfilter/arp_tables.c
@@ -60,7 +60,6 @@ static DECLARE_MUTEX(arpt_mutex);
60 60
61#define ASSERT_READ_LOCK(x) ARP_NF_ASSERT(down_trylock(&arpt_mutex) != 0) 61#define ASSERT_READ_LOCK(x) ARP_NF_ASSERT(down_trylock(&arpt_mutex) != 0)
62#define ASSERT_WRITE_LOCK(x) ARP_NF_ASSERT(down_trylock(&arpt_mutex) != 0) 62#define ASSERT_WRITE_LOCK(x) ARP_NF_ASSERT(down_trylock(&arpt_mutex) != 0)
63#include <linux/netfilter_ipv4/lockhelp.h>
64#include <linux/netfilter_ipv4/listhelp.h> 63#include <linux/netfilter_ipv4/listhelp.h>
65 64
66struct arpt_table_info { 65struct arpt_table_info {
diff --git a/net/ipv4/netfilter/ip_conntrack_amanda.c b/net/ipv4/netfilter/ip_conntrack_amanda.c
index 3dbddd062605..a78a320eee08 100644
--- a/net/ipv4/netfilter/ip_conntrack_amanda.c
+++ b/net/ipv4/netfilter/ip_conntrack_amanda.c
@@ -26,7 +26,6 @@
26#include <net/checksum.h> 26#include <net/checksum.h>
27#include <net/udp.h> 27#include <net/udp.h>
28 28
29#include <linux/netfilter_ipv4/lockhelp.h>
30#include <linux/netfilter_ipv4/ip_conntrack_helper.h> 29#include <linux/netfilter_ipv4/ip_conntrack_helper.h>
31#include <linux/netfilter_ipv4/ip_conntrack_amanda.h> 30#include <linux/netfilter_ipv4/ip_conntrack_amanda.h>
32 31
@@ -42,7 +41,7 @@ static char *conns[] = { "DATA ", "MESG ", "INDEX " };
42 41
43/* This is slow, but it's simple. --RR */ 42/* This is slow, but it's simple. --RR */
44static char amanda_buffer[65536]; 43static char amanda_buffer[65536];
45static DECLARE_LOCK(amanda_buffer_lock); 44static DEFINE_SPINLOCK(amanda_buffer_lock);
46 45
47unsigned int (*ip_nat_amanda_hook)(struct sk_buff **pskb, 46unsigned int (*ip_nat_amanda_hook)(struct sk_buff **pskb,
48 enum ip_conntrack_info ctinfo, 47 enum ip_conntrack_info ctinfo,
@@ -76,7 +75,7 @@ static int help(struct sk_buff **pskb,
76 return NF_ACCEPT; 75 return NF_ACCEPT;
77 } 76 }
78 77
79 LOCK_BH(&amanda_buffer_lock); 78 spin_lock_bh(&amanda_buffer_lock);
80 skb_copy_bits(*pskb, dataoff, amanda_buffer, (*pskb)->len - dataoff); 79 skb_copy_bits(*pskb, dataoff, amanda_buffer, (*pskb)->len - dataoff);
81 data = amanda_buffer; 80 data = amanda_buffer;
82 data_limit = amanda_buffer + (*pskb)->len - dataoff; 81 data_limit = amanda_buffer + (*pskb)->len - dataoff;
@@ -134,7 +133,7 @@ static int help(struct sk_buff **pskb,
134 } 133 }
135 134
136out: 135out:
137 UNLOCK_BH(&amanda_buffer_lock); 136 spin_unlock_bh(&amanda_buffer_lock);
138 return ret; 137 return ret;
139} 138}
140 139
diff --git a/net/ipv4/netfilter/ip_conntrack_core.c b/net/ipv4/netfilter/ip_conntrack_core.c
index 09e824622977..4b78ebeb6635 100644
--- a/net/ipv4/netfilter/ip_conntrack_core.c
+++ b/net/ipv4/netfilter/ip_conntrack_core.c
@@ -38,10 +38,10 @@
38#include <linux/percpu.h> 38#include <linux/percpu.h>
39#include <linux/moduleparam.h> 39#include <linux/moduleparam.h>
40 40
41/* This rwlock protects the main hash table, protocol/helper/expected 41/* ip_conntrack_lock protects the main hash table, protocol/helper/expected
42 registrations, conntrack timers*/ 42 registrations, conntrack timers*/
43#define ASSERT_READ_LOCK(x) MUST_BE_READ_LOCKED(&ip_conntrack_lock) 43#define ASSERT_READ_LOCK(x)
44#define ASSERT_WRITE_LOCK(x) MUST_BE_WRITE_LOCKED(&ip_conntrack_lock) 44#define ASSERT_WRITE_LOCK(x)
45 45
46#include <linux/netfilter_ipv4/ip_conntrack.h> 46#include <linux/netfilter_ipv4/ip_conntrack.h>
47#include <linux/netfilter_ipv4/ip_conntrack_protocol.h> 47#include <linux/netfilter_ipv4/ip_conntrack_protocol.h>
@@ -57,7 +57,7 @@
57#define DEBUGP(format, args...) 57#define DEBUGP(format, args...)
58#endif 58#endif
59 59
60DECLARE_RWLOCK(ip_conntrack_lock); 60DEFINE_RWLOCK(ip_conntrack_lock);
61 61
62/* ip_conntrack_standalone needs this */ 62/* ip_conntrack_standalone needs this */
63atomic_t ip_conntrack_count = ATOMIC_INIT(0); 63atomic_t ip_conntrack_count = ATOMIC_INIT(0);
@@ -147,7 +147,7 @@ static void destroy_expect(struct ip_conntrack_expect *exp)
147 147
148static void unlink_expect(struct ip_conntrack_expect *exp) 148static void unlink_expect(struct ip_conntrack_expect *exp)
149{ 149{
150 MUST_BE_WRITE_LOCKED(&ip_conntrack_lock); 150 ASSERT_WRITE_LOCK(&ip_conntrack_lock);
151 list_del(&exp->list); 151 list_del(&exp->list);
152 /* Logically in destroy_expect, but we hold the lock here. */ 152 /* Logically in destroy_expect, but we hold the lock here. */
153 exp->master->expecting--; 153 exp->master->expecting--;
@@ -157,9 +157,9 @@ static void expectation_timed_out(unsigned long ul_expect)
157{ 157{
158 struct ip_conntrack_expect *exp = (void *)ul_expect; 158 struct ip_conntrack_expect *exp = (void *)ul_expect;
159 159
160 WRITE_LOCK(&ip_conntrack_lock); 160 write_lock_bh(&ip_conntrack_lock);
161 unlink_expect(exp); 161 unlink_expect(exp);
162 WRITE_UNLOCK(&ip_conntrack_lock); 162 write_unlock_bh(&ip_conntrack_lock);
163 destroy_expect(exp); 163 destroy_expect(exp);
164} 164}
165 165
@@ -209,7 +209,7 @@ clean_from_lists(struct ip_conntrack *ct)
209 unsigned int ho, hr; 209 unsigned int ho, hr;
210 210
211 DEBUGP("clean_from_lists(%p)\n", ct); 211 DEBUGP("clean_from_lists(%p)\n", ct);
212 MUST_BE_WRITE_LOCKED(&ip_conntrack_lock); 212 ASSERT_WRITE_LOCK(&ip_conntrack_lock);
213 213
214 ho = hash_conntrack(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple); 214 ho = hash_conntrack(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple);
215 hr = hash_conntrack(&ct->tuplehash[IP_CT_DIR_REPLY].tuple); 215 hr = hash_conntrack(&ct->tuplehash[IP_CT_DIR_REPLY].tuple);
@@ -240,7 +240,7 @@ destroy_conntrack(struct nf_conntrack *nfct)
240 if (ip_conntrack_destroyed) 240 if (ip_conntrack_destroyed)
241 ip_conntrack_destroyed(ct); 241 ip_conntrack_destroyed(ct);
242 242
243 WRITE_LOCK(&ip_conntrack_lock); 243 write_lock_bh(&ip_conntrack_lock);
244 /* Expectations will have been removed in clean_from_lists, 244 /* Expectations will have been removed in clean_from_lists,
245 * except TFTP can create an expectation on the first packet, 245 * except TFTP can create an expectation on the first packet,
246 * before connection is in the list, so we need to clean here, 246 * before connection is in the list, so we need to clean here,
@@ -254,7 +254,7 @@ destroy_conntrack(struct nf_conntrack *nfct)
254 } 254 }
255 255
256 CONNTRACK_STAT_INC(delete); 256 CONNTRACK_STAT_INC(delete);
257 WRITE_UNLOCK(&ip_conntrack_lock); 257 write_unlock_bh(&ip_conntrack_lock);
258 258
259 if (ct->master) 259 if (ct->master)
260 ip_conntrack_put(ct->master); 260 ip_conntrack_put(ct->master);
@@ -268,12 +268,12 @@ static void death_by_timeout(unsigned long ul_conntrack)
268{ 268{
269 struct ip_conntrack *ct = (void *)ul_conntrack; 269 struct ip_conntrack *ct = (void *)ul_conntrack;
270 270
271 WRITE_LOCK(&ip_conntrack_lock); 271 write_lock_bh(&ip_conntrack_lock);
272 /* Inside lock so preempt is disabled on module removal path. 272 /* Inside lock so preempt is disabled on module removal path.
273 * Otherwise we can get spurious warnings. */ 273 * Otherwise we can get spurious warnings. */
274 CONNTRACK_STAT_INC(delete_list); 274 CONNTRACK_STAT_INC(delete_list);
275 clean_from_lists(ct); 275 clean_from_lists(ct);
276 WRITE_UNLOCK(&ip_conntrack_lock); 276 write_unlock_bh(&ip_conntrack_lock);
277 ip_conntrack_put(ct); 277 ip_conntrack_put(ct);
278} 278}
279 279
@@ -282,7 +282,7 @@ conntrack_tuple_cmp(const struct ip_conntrack_tuple_hash *i,
282 const struct ip_conntrack_tuple *tuple, 282 const struct ip_conntrack_tuple *tuple,
283 const struct ip_conntrack *ignored_conntrack) 283 const struct ip_conntrack *ignored_conntrack)
284{ 284{
285 MUST_BE_READ_LOCKED(&ip_conntrack_lock); 285 ASSERT_READ_LOCK(&ip_conntrack_lock);
286 return tuplehash_to_ctrack(i) != ignored_conntrack 286 return tuplehash_to_ctrack(i) != ignored_conntrack
287 && ip_ct_tuple_equal(tuple, &i->tuple); 287 && ip_ct_tuple_equal(tuple, &i->tuple);
288} 288}
@@ -294,7 +294,7 @@ __ip_conntrack_find(const struct ip_conntrack_tuple *tuple,
294 struct ip_conntrack_tuple_hash *h; 294 struct ip_conntrack_tuple_hash *h;
295 unsigned int hash = hash_conntrack(tuple); 295 unsigned int hash = hash_conntrack(tuple);
296 296
297 MUST_BE_READ_LOCKED(&ip_conntrack_lock); 297 ASSERT_READ_LOCK(&ip_conntrack_lock);
298 list_for_each_entry(h, &ip_conntrack_hash[hash], list) { 298 list_for_each_entry(h, &ip_conntrack_hash[hash], list) {
299 if (conntrack_tuple_cmp(h, tuple, ignored_conntrack)) { 299 if (conntrack_tuple_cmp(h, tuple, ignored_conntrack)) {
300 CONNTRACK_STAT_INC(found); 300 CONNTRACK_STAT_INC(found);
@@ -313,11 +313,11 @@ ip_conntrack_find_get(const struct ip_conntrack_tuple *tuple,
313{ 313{
314 struct ip_conntrack_tuple_hash *h; 314 struct ip_conntrack_tuple_hash *h;
315 315
316 READ_LOCK(&ip_conntrack_lock); 316 read_lock_bh(&ip_conntrack_lock);
317 h = __ip_conntrack_find(tuple, ignored_conntrack); 317 h = __ip_conntrack_find(tuple, ignored_conntrack);
318 if (h) 318 if (h)
319 atomic_inc(&tuplehash_to_ctrack(h)->ct_general.use); 319 atomic_inc(&tuplehash_to_ctrack(h)->ct_general.use);
320 READ_UNLOCK(&ip_conntrack_lock); 320 read_unlock_bh(&ip_conntrack_lock);
321 321
322 return h; 322 return h;
323} 323}
@@ -352,7 +352,7 @@ __ip_conntrack_confirm(struct sk_buff **pskb)
352 IP_NF_ASSERT(!is_confirmed(ct)); 352 IP_NF_ASSERT(!is_confirmed(ct));
353 DEBUGP("Confirming conntrack %p\n", ct); 353 DEBUGP("Confirming conntrack %p\n", ct);
354 354
355 WRITE_LOCK(&ip_conntrack_lock); 355 write_lock_bh(&ip_conntrack_lock);
356 356
357 /* See if there's one in the list already, including reverse: 357 /* See if there's one in the list already, including reverse:
358 NAT could have grabbed it without realizing, since we're 358 NAT could have grabbed it without realizing, since we're
@@ -380,12 +380,12 @@ __ip_conntrack_confirm(struct sk_buff **pskb)
380 atomic_inc(&ct->ct_general.use); 380 atomic_inc(&ct->ct_general.use);
381 set_bit(IPS_CONFIRMED_BIT, &ct->status); 381 set_bit(IPS_CONFIRMED_BIT, &ct->status);
382 CONNTRACK_STAT_INC(insert); 382 CONNTRACK_STAT_INC(insert);
383 WRITE_UNLOCK(&ip_conntrack_lock); 383 write_unlock_bh(&ip_conntrack_lock);
384 return NF_ACCEPT; 384 return NF_ACCEPT;
385 } 385 }
386 386
387 CONNTRACK_STAT_INC(insert_failed); 387 CONNTRACK_STAT_INC(insert_failed);
388 WRITE_UNLOCK(&ip_conntrack_lock); 388 write_unlock_bh(&ip_conntrack_lock);
389 389
390 return NF_DROP; 390 return NF_DROP;
391} 391}
@@ -398,9 +398,9 @@ ip_conntrack_tuple_taken(const struct ip_conntrack_tuple *tuple,
398{ 398{
399 struct ip_conntrack_tuple_hash *h; 399 struct ip_conntrack_tuple_hash *h;
400 400
401 READ_LOCK(&ip_conntrack_lock); 401 read_lock_bh(&ip_conntrack_lock);
402 h = __ip_conntrack_find(tuple, ignored_conntrack); 402 h = __ip_conntrack_find(tuple, ignored_conntrack);
403 READ_UNLOCK(&ip_conntrack_lock); 403 read_unlock_bh(&ip_conntrack_lock);
404 404
405 return h != NULL; 405 return h != NULL;
406} 406}
@@ -419,13 +419,13 @@ static int early_drop(struct list_head *chain)
419 struct ip_conntrack *ct = NULL; 419 struct ip_conntrack *ct = NULL;
420 int dropped = 0; 420 int dropped = 0;
421 421
422 READ_LOCK(&ip_conntrack_lock); 422 read_lock_bh(&ip_conntrack_lock);
423 h = LIST_FIND_B(chain, unreplied, struct ip_conntrack_tuple_hash *); 423 h = LIST_FIND_B(chain, unreplied, struct ip_conntrack_tuple_hash *);
424 if (h) { 424 if (h) {
425 ct = tuplehash_to_ctrack(h); 425 ct = tuplehash_to_ctrack(h);
426 atomic_inc(&ct->ct_general.use); 426 atomic_inc(&ct->ct_general.use);
427 } 427 }
428 READ_UNLOCK(&ip_conntrack_lock); 428 read_unlock_bh(&ip_conntrack_lock);
429 429
430 if (!ct) 430 if (!ct)
431 return dropped; 431 return dropped;
@@ -508,7 +508,7 @@ init_conntrack(const struct ip_conntrack_tuple *tuple,
508 conntrack->timeout.data = (unsigned long)conntrack; 508 conntrack->timeout.data = (unsigned long)conntrack;
509 conntrack->timeout.function = death_by_timeout; 509 conntrack->timeout.function = death_by_timeout;
510 510
511 WRITE_LOCK(&ip_conntrack_lock); 511 write_lock_bh(&ip_conntrack_lock);
512 exp = find_expectation(tuple); 512 exp = find_expectation(tuple);
513 513
514 if (exp) { 514 if (exp) {
@@ -532,7 +532,7 @@ init_conntrack(const struct ip_conntrack_tuple *tuple,
532 list_add(&conntrack->tuplehash[IP_CT_DIR_ORIGINAL].list, &unconfirmed); 532 list_add(&conntrack->tuplehash[IP_CT_DIR_ORIGINAL].list, &unconfirmed);
533 533
534 atomic_inc(&ip_conntrack_count); 534 atomic_inc(&ip_conntrack_count);
535 WRITE_UNLOCK(&ip_conntrack_lock); 535 write_unlock_bh(&ip_conntrack_lock);
536 536
537 if (exp) { 537 if (exp) {
538 if (exp->expectfn) 538 if (exp->expectfn)
@@ -723,17 +723,17 @@ void ip_conntrack_unexpect_related(struct ip_conntrack_expect *exp)
723{ 723{
724 struct ip_conntrack_expect *i; 724 struct ip_conntrack_expect *i;
725 725
726 WRITE_LOCK(&ip_conntrack_lock); 726 write_lock_bh(&ip_conntrack_lock);
727 /* choose the the oldest expectation to evict */ 727 /* choose the the oldest expectation to evict */
728 list_for_each_entry_reverse(i, &ip_conntrack_expect_list, list) { 728 list_for_each_entry_reverse(i, &ip_conntrack_expect_list, list) {
729 if (expect_matches(i, exp) && del_timer(&i->timeout)) { 729 if (expect_matches(i, exp) && del_timer(&i->timeout)) {
730 unlink_expect(i); 730 unlink_expect(i);
731 WRITE_UNLOCK(&ip_conntrack_lock); 731 write_unlock_bh(&ip_conntrack_lock);
732 destroy_expect(i); 732 destroy_expect(i);
733 return; 733 return;
734 } 734 }
735 } 735 }
736 WRITE_UNLOCK(&ip_conntrack_lock); 736 write_unlock_bh(&ip_conntrack_lock);
737} 737}
738 738
739struct ip_conntrack_expect *ip_conntrack_expect_alloc(void) 739struct ip_conntrack_expect *ip_conntrack_expect_alloc(void)
@@ -760,15 +760,11 @@ static void ip_conntrack_expect_insert(struct ip_conntrack_expect *exp)
760 exp->master->expecting++; 760 exp->master->expecting++;
761 list_add(&exp->list, &ip_conntrack_expect_list); 761 list_add(&exp->list, &ip_conntrack_expect_list);
762 762
763 if (exp->master->helper->timeout) { 763 init_timer(&exp->timeout);
764 init_timer(&exp->timeout); 764 exp->timeout.data = (unsigned long)exp;
765 exp->timeout.data = (unsigned long)exp; 765 exp->timeout.function = expectation_timed_out;
766 exp->timeout.function = expectation_timed_out; 766 exp->timeout.expires = jiffies + exp->master->helper->timeout * HZ;
767 exp->timeout.expires 767 add_timer(&exp->timeout);
768 = jiffies + exp->master->helper->timeout * HZ;
769 add_timer(&exp->timeout);
770 } else
771 exp->timeout.function = NULL;
772 768
773 CONNTRACK_STAT_INC(expect_create); 769 CONNTRACK_STAT_INC(expect_create);
774} 770}
@@ -808,7 +804,7 @@ int ip_conntrack_expect_related(struct ip_conntrack_expect *expect)
808 DEBUGP("tuple: "); DUMP_TUPLE(&expect->tuple); 804 DEBUGP("tuple: "); DUMP_TUPLE(&expect->tuple);
809 DEBUGP("mask: "); DUMP_TUPLE(&expect->mask); 805 DEBUGP("mask: "); DUMP_TUPLE(&expect->mask);
810 806
811 WRITE_LOCK(&ip_conntrack_lock); 807 write_lock_bh(&ip_conntrack_lock);
812 list_for_each_entry(i, &ip_conntrack_expect_list, list) { 808 list_for_each_entry(i, &ip_conntrack_expect_list, list) {
813 if (expect_matches(i, expect)) { 809 if (expect_matches(i, expect)) {
814 /* Refresh timer: if it's dying, ignore.. */ 810 /* Refresh timer: if it's dying, ignore.. */
@@ -832,7 +828,7 @@ int ip_conntrack_expect_related(struct ip_conntrack_expect *expect)
832 ip_conntrack_expect_insert(expect); 828 ip_conntrack_expect_insert(expect);
833 ret = 0; 829 ret = 0;
834out: 830out:
835 WRITE_UNLOCK(&ip_conntrack_lock); 831 write_unlock_bh(&ip_conntrack_lock);
836 return ret; 832 return ret;
837} 833}
838 834
@@ -841,7 +837,7 @@ out:
841void ip_conntrack_alter_reply(struct ip_conntrack *conntrack, 837void ip_conntrack_alter_reply(struct ip_conntrack *conntrack,
842 const struct ip_conntrack_tuple *newreply) 838 const struct ip_conntrack_tuple *newreply)
843{ 839{
844 WRITE_LOCK(&ip_conntrack_lock); 840 write_lock_bh(&ip_conntrack_lock);
845 /* Should be unconfirmed, so not in hash table yet */ 841 /* Should be unconfirmed, so not in hash table yet */
846 IP_NF_ASSERT(!is_confirmed(conntrack)); 842 IP_NF_ASSERT(!is_confirmed(conntrack));
847 843
@@ -851,15 +847,15 @@ void ip_conntrack_alter_reply(struct ip_conntrack *conntrack,
851 conntrack->tuplehash[IP_CT_DIR_REPLY].tuple = *newreply; 847 conntrack->tuplehash[IP_CT_DIR_REPLY].tuple = *newreply;
852 if (!conntrack->master && conntrack->expecting == 0) 848 if (!conntrack->master && conntrack->expecting == 0)
853 conntrack->helper = ip_ct_find_helper(newreply); 849 conntrack->helper = ip_ct_find_helper(newreply);
854 WRITE_UNLOCK(&ip_conntrack_lock); 850 write_unlock_bh(&ip_conntrack_lock);
855} 851}
856 852
857int ip_conntrack_helper_register(struct ip_conntrack_helper *me) 853int ip_conntrack_helper_register(struct ip_conntrack_helper *me)
858{ 854{
859 BUG_ON(me->timeout == 0); 855 BUG_ON(me->timeout == 0);
860 WRITE_LOCK(&ip_conntrack_lock); 856 write_lock_bh(&ip_conntrack_lock);
861 list_prepend(&helpers, me); 857 list_prepend(&helpers, me);
862 WRITE_UNLOCK(&ip_conntrack_lock); 858 write_unlock_bh(&ip_conntrack_lock);
863 859
864 return 0; 860 return 0;
865} 861}
@@ -878,7 +874,7 @@ void ip_conntrack_helper_unregister(struct ip_conntrack_helper *me)
878 struct ip_conntrack_expect *exp, *tmp; 874 struct ip_conntrack_expect *exp, *tmp;
879 875
880 /* Need write lock here, to delete helper. */ 876 /* Need write lock here, to delete helper. */
881 WRITE_LOCK(&ip_conntrack_lock); 877 write_lock_bh(&ip_conntrack_lock);
882 LIST_DELETE(&helpers, me); 878 LIST_DELETE(&helpers, me);
883 879
884 /* Get rid of expectations */ 880 /* Get rid of expectations */
@@ -893,7 +889,7 @@ void ip_conntrack_helper_unregister(struct ip_conntrack_helper *me)
893 for (i = 0; i < ip_conntrack_htable_size; i++) 889 for (i = 0; i < ip_conntrack_htable_size; i++)
894 LIST_FIND_W(&ip_conntrack_hash[i], unhelp, 890 LIST_FIND_W(&ip_conntrack_hash[i], unhelp,
895 struct ip_conntrack_tuple_hash *, me); 891 struct ip_conntrack_tuple_hash *, me);
896 WRITE_UNLOCK(&ip_conntrack_lock); 892 write_unlock_bh(&ip_conntrack_lock);
897 893
898 /* Someone could be still looking at the helper in a bh. */ 894 /* Someone could be still looking at the helper in a bh. */
899 synchronize_net(); 895 synchronize_net();
@@ -925,14 +921,14 @@ void ip_ct_refresh_acct(struct ip_conntrack *ct,
925 ct->timeout.expires = extra_jiffies; 921 ct->timeout.expires = extra_jiffies;
926 ct_add_counters(ct, ctinfo, skb); 922 ct_add_counters(ct, ctinfo, skb);
927 } else { 923 } else {
928 WRITE_LOCK(&ip_conntrack_lock); 924 write_lock_bh(&ip_conntrack_lock);
929 /* Need del_timer for race avoidance (may already be dying). */ 925 /* Need del_timer for race avoidance (may already be dying). */
930 if (del_timer(&ct->timeout)) { 926 if (del_timer(&ct->timeout)) {
931 ct->timeout.expires = jiffies + extra_jiffies; 927 ct->timeout.expires = jiffies + extra_jiffies;
932 add_timer(&ct->timeout); 928 add_timer(&ct->timeout);
933 } 929 }
934 ct_add_counters(ct, ctinfo, skb); 930 ct_add_counters(ct, ctinfo, skb);
935 WRITE_UNLOCK(&ip_conntrack_lock); 931 write_unlock_bh(&ip_conntrack_lock);
936 } 932 }
937} 933}
938 934
@@ -940,10 +936,6 @@ void ip_ct_refresh_acct(struct ip_conntrack *ct,
940struct sk_buff * 936struct sk_buff *
941ip_ct_gather_frags(struct sk_buff *skb, u_int32_t user) 937ip_ct_gather_frags(struct sk_buff *skb, u_int32_t user)
942{ 938{
943#ifdef CONFIG_NETFILTER_DEBUG
944 unsigned int olddebug = skb->nf_debug;
945#endif
946
947 skb_orphan(skb); 939 skb_orphan(skb);
948 940
949 local_bh_disable(); 941 local_bh_disable();
@@ -953,12 +945,7 @@ ip_ct_gather_frags(struct sk_buff *skb, u_int32_t user)
953 if (skb) { 945 if (skb) {
954 ip_send_check(skb->nh.iph); 946 ip_send_check(skb->nh.iph);
955 skb->nfcache |= NFC_ALTERED; 947 skb->nfcache |= NFC_ALTERED;
956#ifdef CONFIG_NETFILTER_DEBUG
957 /* Packet path as if nothing had happened. */
958 skb->nf_debug = olddebug;
959#endif
960 } 948 }
961
962 return skb; 949 return skb;
963} 950}
964 951
@@ -997,7 +984,7 @@ get_next_corpse(int (*iter)(struct ip_conntrack *i, void *data),
997{ 984{
998 struct ip_conntrack_tuple_hash *h = NULL; 985 struct ip_conntrack_tuple_hash *h = NULL;
999 986
1000 WRITE_LOCK(&ip_conntrack_lock); 987 write_lock_bh(&ip_conntrack_lock);
1001 for (; *bucket < ip_conntrack_htable_size; (*bucket)++) { 988 for (; *bucket < ip_conntrack_htable_size; (*bucket)++) {
1002 h = LIST_FIND_W(&ip_conntrack_hash[*bucket], do_iter, 989 h = LIST_FIND_W(&ip_conntrack_hash[*bucket], do_iter,
1003 struct ip_conntrack_tuple_hash *, iter, data); 990 struct ip_conntrack_tuple_hash *, iter, data);
@@ -1009,7 +996,7 @@ get_next_corpse(int (*iter)(struct ip_conntrack *i, void *data),
1009 struct ip_conntrack_tuple_hash *, iter, data); 996 struct ip_conntrack_tuple_hash *, iter, data);
1010 if (h) 997 if (h)
1011 atomic_inc(&tuplehash_to_ctrack(h)->ct_general.use); 998 atomic_inc(&tuplehash_to_ctrack(h)->ct_general.use);
1012 WRITE_UNLOCK(&ip_conntrack_lock); 999 write_unlock_bh(&ip_conntrack_lock);
1013 1000
1014 return h; 1001 return h;
1015} 1002}
@@ -1201,14 +1188,14 @@ int __init ip_conntrack_init(void)
1201 } 1188 }
1202 1189
1203 /* Don't NEED lock here, but good form anyway. */ 1190 /* Don't NEED lock here, but good form anyway. */
1204 WRITE_LOCK(&ip_conntrack_lock); 1191 write_lock_bh(&ip_conntrack_lock);
1205 for (i = 0; i < MAX_IP_CT_PROTO; i++) 1192 for (i = 0; i < MAX_IP_CT_PROTO; i++)
1206 ip_ct_protos[i] = &ip_conntrack_generic_protocol; 1193 ip_ct_protos[i] = &ip_conntrack_generic_protocol;
1207 /* Sew in builtin protocols. */ 1194 /* Sew in builtin protocols. */
1208 ip_ct_protos[IPPROTO_TCP] = &ip_conntrack_protocol_tcp; 1195 ip_ct_protos[IPPROTO_TCP] = &ip_conntrack_protocol_tcp;
1209 ip_ct_protos[IPPROTO_UDP] = &ip_conntrack_protocol_udp; 1196 ip_ct_protos[IPPROTO_UDP] = &ip_conntrack_protocol_udp;
1210 ip_ct_protos[IPPROTO_ICMP] = &ip_conntrack_protocol_icmp; 1197 ip_ct_protos[IPPROTO_ICMP] = &ip_conntrack_protocol_icmp;
1211 WRITE_UNLOCK(&ip_conntrack_lock); 1198 write_unlock_bh(&ip_conntrack_lock);
1212 1199
1213 for (i = 0; i < ip_conntrack_htable_size; i++) 1200 for (i = 0; i < ip_conntrack_htable_size; i++)
1214 INIT_LIST_HEAD(&ip_conntrack_hash[i]); 1201 INIT_LIST_HEAD(&ip_conntrack_hash[i]);
diff --git a/net/ipv4/netfilter/ip_conntrack_ftp.c b/net/ipv4/netfilter/ip_conntrack_ftp.c
index dd86503aa788..fea6dd2a00b6 100644
--- a/net/ipv4/netfilter/ip_conntrack_ftp.c
+++ b/net/ipv4/netfilter/ip_conntrack_ftp.c
@@ -16,7 +16,6 @@
16#include <net/checksum.h> 16#include <net/checksum.h>
17#include <net/tcp.h> 17#include <net/tcp.h>
18 18
19#include <linux/netfilter_ipv4/lockhelp.h>
20#include <linux/netfilter_ipv4/ip_conntrack_helper.h> 19#include <linux/netfilter_ipv4/ip_conntrack_helper.h>
21#include <linux/netfilter_ipv4/ip_conntrack_ftp.h> 20#include <linux/netfilter_ipv4/ip_conntrack_ftp.h>
22#include <linux/moduleparam.h> 21#include <linux/moduleparam.h>
@@ -28,7 +27,7 @@ MODULE_DESCRIPTION("ftp connection tracking helper");
28/* This is slow, but it's simple. --RR */ 27/* This is slow, but it's simple. --RR */
29static char ftp_buffer[65536]; 28static char ftp_buffer[65536];
30 29
31static DECLARE_LOCK(ip_ftp_lock); 30static DEFINE_SPINLOCK(ip_ftp_lock);
32 31
33#define MAX_PORTS 8 32#define MAX_PORTS 8
34static int ports[MAX_PORTS]; 33static int ports[MAX_PORTS];
@@ -319,7 +318,7 @@ static int help(struct sk_buff **pskb,
319 } 318 }
320 datalen = (*pskb)->len - dataoff; 319 datalen = (*pskb)->len - dataoff;
321 320
322 LOCK_BH(&ip_ftp_lock); 321 spin_lock_bh(&ip_ftp_lock);
323 fb_ptr = skb_header_pointer(*pskb, dataoff, 322 fb_ptr = skb_header_pointer(*pskb, dataoff,
324 (*pskb)->len - dataoff, ftp_buffer); 323 (*pskb)->len - dataoff, ftp_buffer);
325 BUG_ON(fb_ptr == NULL); 324 BUG_ON(fb_ptr == NULL);
@@ -442,7 +441,7 @@ out_update_nl:
442 if (ends_in_nl) 441 if (ends_in_nl)
443 update_nl_seq(seq, ct_ftp_info,dir); 442 update_nl_seq(seq, ct_ftp_info,dir);
444 out: 443 out:
445 UNLOCK_BH(&ip_ftp_lock); 444 spin_unlock_bh(&ip_ftp_lock);
446 return ret; 445 return ret;
447} 446}
448 447
diff --git a/net/ipv4/netfilter/ip_conntrack_irc.c b/net/ipv4/netfilter/ip_conntrack_irc.c
index 33cc7348b6ee..cd98772cc332 100644
--- a/net/ipv4/netfilter/ip_conntrack_irc.c
+++ b/net/ipv4/netfilter/ip_conntrack_irc.c
@@ -29,7 +29,6 @@
29#include <net/checksum.h> 29#include <net/checksum.h>
30#include <net/tcp.h> 30#include <net/tcp.h>
31 31
32#include <linux/netfilter_ipv4/lockhelp.h>
33#include <linux/netfilter_ipv4/ip_conntrack_helper.h> 32#include <linux/netfilter_ipv4/ip_conntrack_helper.h>
34#include <linux/netfilter_ipv4/ip_conntrack_irc.h> 33#include <linux/netfilter_ipv4/ip_conntrack_irc.h>
35#include <linux/moduleparam.h> 34#include <linux/moduleparam.h>
@@ -41,7 +40,7 @@ static int max_dcc_channels = 8;
41static unsigned int dcc_timeout = 300; 40static unsigned int dcc_timeout = 300;
42/* This is slow, but it's simple. --RR */ 41/* This is slow, but it's simple. --RR */
43static char irc_buffer[65536]; 42static char irc_buffer[65536];
44static DECLARE_LOCK(irc_buffer_lock); 43static DEFINE_SPINLOCK(irc_buffer_lock);
45 44
46unsigned int (*ip_nat_irc_hook)(struct sk_buff **pskb, 45unsigned int (*ip_nat_irc_hook)(struct sk_buff **pskb,
47 enum ip_conntrack_info ctinfo, 46 enum ip_conntrack_info ctinfo,
@@ -141,7 +140,7 @@ static int help(struct sk_buff **pskb,
141 if (dataoff >= (*pskb)->len) 140 if (dataoff >= (*pskb)->len)
142 return NF_ACCEPT; 141 return NF_ACCEPT;
143 142
144 LOCK_BH(&irc_buffer_lock); 143 spin_lock_bh(&irc_buffer_lock);
145 ib_ptr = skb_header_pointer(*pskb, dataoff, 144 ib_ptr = skb_header_pointer(*pskb, dataoff,
146 (*pskb)->len - dataoff, irc_buffer); 145 (*pskb)->len - dataoff, irc_buffer);
147 BUG_ON(ib_ptr == NULL); 146 BUG_ON(ib_ptr == NULL);
@@ -237,7 +236,7 @@ static int help(struct sk_buff **pskb,
237 } /* while data < ... */ 236 } /* while data < ... */
238 237
239 out: 238 out:
240 UNLOCK_BH(&irc_buffer_lock); 239 spin_unlock_bh(&irc_buffer_lock);
241 return ret; 240 return ret;
242} 241}
243 242
diff --git a/net/ipv4/netfilter/ip_conntrack_proto_sctp.c b/net/ipv4/netfilter/ip_conntrack_proto_sctp.c
index ff8c34a860ff..31d75390bf12 100644
--- a/net/ipv4/netfilter/ip_conntrack_proto_sctp.c
+++ b/net/ipv4/netfilter/ip_conntrack_proto_sctp.c
@@ -26,7 +26,6 @@
26 26
27#include <linux/netfilter_ipv4/ip_conntrack.h> 27#include <linux/netfilter_ipv4/ip_conntrack.h>
28#include <linux/netfilter_ipv4/ip_conntrack_protocol.h> 28#include <linux/netfilter_ipv4/ip_conntrack_protocol.h>
29#include <linux/netfilter_ipv4/lockhelp.h>
30 29
31#if 0 30#if 0
32#define DEBUGP(format, ...) printk(format, ## __VA_ARGS__) 31#define DEBUGP(format, ...) printk(format, ## __VA_ARGS__)
@@ -35,7 +34,7 @@
35#endif 34#endif
36 35
37/* Protects conntrack->proto.sctp */ 36/* Protects conntrack->proto.sctp */
38static DECLARE_RWLOCK(sctp_lock); 37static DEFINE_RWLOCK(sctp_lock);
39 38
40/* FIXME: Examine ipfilter's timeouts and conntrack transitions more 39/* FIXME: Examine ipfilter's timeouts and conntrack transitions more
41 closely. They're more complex. --RR 40 closely. They're more complex. --RR
@@ -199,9 +198,9 @@ static int sctp_print_conntrack(struct seq_file *s,
199 DEBUGP(__FUNCTION__); 198 DEBUGP(__FUNCTION__);
200 DEBUGP("\n"); 199 DEBUGP("\n");
201 200
202 READ_LOCK(&sctp_lock); 201 read_lock_bh(&sctp_lock);
203 state = conntrack->proto.sctp.state; 202 state = conntrack->proto.sctp.state;
204 READ_UNLOCK(&sctp_lock); 203 read_unlock_bh(&sctp_lock);
205 204
206 return seq_printf(s, "%s ", sctp_conntrack_names[state]); 205 return seq_printf(s, "%s ", sctp_conntrack_names[state]);
207} 206}
@@ -343,13 +342,13 @@ static int sctp_packet(struct ip_conntrack *conntrack,
343 342
344 oldsctpstate = newconntrack = SCTP_CONNTRACK_MAX; 343 oldsctpstate = newconntrack = SCTP_CONNTRACK_MAX;
345 for_each_sctp_chunk (skb, sch, _sch, offset, count) { 344 for_each_sctp_chunk (skb, sch, _sch, offset, count) {
346 WRITE_LOCK(&sctp_lock); 345 write_lock_bh(&sctp_lock);
347 346
348 /* Special cases of Verification tag check (Sec 8.5.1) */ 347 /* Special cases of Verification tag check (Sec 8.5.1) */
349 if (sch->type == SCTP_CID_INIT) { 348 if (sch->type == SCTP_CID_INIT) {
350 /* Sec 8.5.1 (A) */ 349 /* Sec 8.5.1 (A) */
351 if (sh->vtag != 0) { 350 if (sh->vtag != 0) {
352 WRITE_UNLOCK(&sctp_lock); 351 write_unlock_bh(&sctp_lock);
353 return -1; 352 return -1;
354 } 353 }
355 } else if (sch->type == SCTP_CID_ABORT) { 354 } else if (sch->type == SCTP_CID_ABORT) {
@@ -357,7 +356,7 @@ static int sctp_packet(struct ip_conntrack *conntrack,
357 if (!(sh->vtag == conntrack->proto.sctp.vtag[CTINFO2DIR(ctinfo)]) 356 if (!(sh->vtag == conntrack->proto.sctp.vtag[CTINFO2DIR(ctinfo)])
358 && !(sh->vtag == conntrack->proto.sctp.vtag 357 && !(sh->vtag == conntrack->proto.sctp.vtag
359 [1 - CTINFO2DIR(ctinfo)])) { 358 [1 - CTINFO2DIR(ctinfo)])) {
360 WRITE_UNLOCK(&sctp_lock); 359 write_unlock_bh(&sctp_lock);
361 return -1; 360 return -1;
362 } 361 }
363 } else if (sch->type == SCTP_CID_SHUTDOWN_COMPLETE) { 362 } else if (sch->type == SCTP_CID_SHUTDOWN_COMPLETE) {
@@ -366,13 +365,13 @@ static int sctp_packet(struct ip_conntrack *conntrack,
366 && !(sh->vtag == conntrack->proto.sctp.vtag 365 && !(sh->vtag == conntrack->proto.sctp.vtag
367 [1 - CTINFO2DIR(ctinfo)] 366 [1 - CTINFO2DIR(ctinfo)]
368 && (sch->flags & 1))) { 367 && (sch->flags & 1))) {
369 WRITE_UNLOCK(&sctp_lock); 368 write_unlock_bh(&sctp_lock);
370 return -1; 369 return -1;
371 } 370 }
372 } else if (sch->type == SCTP_CID_COOKIE_ECHO) { 371 } else if (sch->type == SCTP_CID_COOKIE_ECHO) {
373 /* Sec 8.5.1 (D) */ 372 /* Sec 8.5.1 (D) */
374 if (!(sh->vtag == conntrack->proto.sctp.vtag[CTINFO2DIR(ctinfo)])) { 373 if (!(sh->vtag == conntrack->proto.sctp.vtag[CTINFO2DIR(ctinfo)])) {
375 WRITE_UNLOCK(&sctp_lock); 374 write_unlock_bh(&sctp_lock);
376 return -1; 375 return -1;
377 } 376 }
378 } 377 }
@@ -384,7 +383,7 @@ static int sctp_packet(struct ip_conntrack *conntrack,
384 if (newconntrack == SCTP_CONNTRACK_MAX) { 383 if (newconntrack == SCTP_CONNTRACK_MAX) {
385 DEBUGP("ip_conntrack_sctp: Invalid dir=%i ctype=%u conntrack=%u\n", 384 DEBUGP("ip_conntrack_sctp: Invalid dir=%i ctype=%u conntrack=%u\n",
386 CTINFO2DIR(ctinfo), sch->type, oldsctpstate); 385 CTINFO2DIR(ctinfo), sch->type, oldsctpstate);
387 WRITE_UNLOCK(&sctp_lock); 386 write_unlock_bh(&sctp_lock);
388 return -1; 387 return -1;
389 } 388 }
390 389
@@ -396,7 +395,7 @@ static int sctp_packet(struct ip_conntrack *conntrack,
396 ih = skb_header_pointer(skb, offset + sizeof(sctp_chunkhdr_t), 395 ih = skb_header_pointer(skb, offset + sizeof(sctp_chunkhdr_t),
397 sizeof(_inithdr), &_inithdr); 396 sizeof(_inithdr), &_inithdr);
398 if (ih == NULL) { 397 if (ih == NULL) {
399 WRITE_UNLOCK(&sctp_lock); 398 write_unlock_bh(&sctp_lock);
400 return -1; 399 return -1;
401 } 400 }
402 DEBUGP("Setting vtag %x for dir %d\n", 401 DEBUGP("Setting vtag %x for dir %d\n",
@@ -405,7 +404,7 @@ static int sctp_packet(struct ip_conntrack *conntrack,
405 } 404 }
406 405
407 conntrack->proto.sctp.state = newconntrack; 406 conntrack->proto.sctp.state = newconntrack;
408 WRITE_UNLOCK(&sctp_lock); 407 write_unlock_bh(&sctp_lock);
409 } 408 }
410 409
411 ip_ct_refresh_acct(conntrack, ctinfo, skb, *sctp_timeouts[newconntrack]); 410 ip_ct_refresh_acct(conntrack, ctinfo, skb, *sctp_timeouts[newconntrack]);
diff --git a/net/ipv4/netfilter/ip_conntrack_proto_tcp.c b/net/ipv4/netfilter/ip_conntrack_proto_tcp.c
index 721ddbf522b4..809dfed766d4 100644
--- a/net/ipv4/netfilter/ip_conntrack_proto_tcp.c
+++ b/net/ipv4/netfilter/ip_conntrack_proto_tcp.c
@@ -36,7 +36,6 @@
36#include <linux/netfilter_ipv4.h> 36#include <linux/netfilter_ipv4.h>
37#include <linux/netfilter_ipv4/ip_conntrack.h> 37#include <linux/netfilter_ipv4/ip_conntrack.h>
38#include <linux/netfilter_ipv4/ip_conntrack_protocol.h> 38#include <linux/netfilter_ipv4/ip_conntrack_protocol.h>
39#include <linux/netfilter_ipv4/lockhelp.h>
40 39
41#if 0 40#if 0
42#define DEBUGP printk 41#define DEBUGP printk
@@ -46,7 +45,7 @@
46#endif 45#endif
47 46
48/* Protects conntrack->proto.tcp */ 47/* Protects conntrack->proto.tcp */
49static DECLARE_RWLOCK(tcp_lock); 48static DEFINE_RWLOCK(tcp_lock);
50 49
51/* "Be conservative in what you do, 50/* "Be conservative in what you do,
52 be liberal in what you accept from others." 51 be liberal in what you accept from others."
@@ -330,9 +329,9 @@ static int tcp_print_conntrack(struct seq_file *s,
330{ 329{
331 enum tcp_conntrack state; 330 enum tcp_conntrack state;
332 331
333 READ_LOCK(&tcp_lock); 332 read_lock_bh(&tcp_lock);
334 state = conntrack->proto.tcp.state; 333 state = conntrack->proto.tcp.state;
335 READ_UNLOCK(&tcp_lock); 334 read_unlock_bh(&tcp_lock);
336 335
337 return seq_printf(s, "%s ", tcp_conntrack_names[state]); 336 return seq_printf(s, "%s ", tcp_conntrack_names[state]);
338} 337}
@@ -738,14 +737,14 @@ void ip_conntrack_tcp_update(struct sk_buff *skb,
738 737
739 end = segment_seq_plus_len(ntohl(tcph->seq), skb->len, iph, tcph); 738 end = segment_seq_plus_len(ntohl(tcph->seq), skb->len, iph, tcph);
740 739
741 WRITE_LOCK(&tcp_lock); 740 write_lock_bh(&tcp_lock);
742 /* 741 /*
743 * We have to worry for the ack in the reply packet only... 742 * We have to worry for the ack in the reply packet only...
744 */ 743 */
745 if (after(end, conntrack->proto.tcp.seen[dir].td_end)) 744 if (after(end, conntrack->proto.tcp.seen[dir].td_end))
746 conntrack->proto.tcp.seen[dir].td_end = end; 745 conntrack->proto.tcp.seen[dir].td_end = end;
747 conntrack->proto.tcp.last_end = end; 746 conntrack->proto.tcp.last_end = end;
748 WRITE_UNLOCK(&tcp_lock); 747 write_unlock_bh(&tcp_lock);
749 DEBUGP("tcp_update: sender end=%u maxend=%u maxwin=%u scale=%i " 748 DEBUGP("tcp_update: sender end=%u maxend=%u maxwin=%u scale=%i "
750 "receiver end=%u maxend=%u maxwin=%u scale=%i\n", 749 "receiver end=%u maxend=%u maxwin=%u scale=%i\n",
751 sender->td_end, sender->td_maxend, sender->td_maxwin, 750 sender->td_end, sender->td_maxend, sender->td_maxwin,
@@ -857,7 +856,7 @@ static int tcp_packet(struct ip_conntrack *conntrack,
857 sizeof(_tcph), &_tcph); 856 sizeof(_tcph), &_tcph);
858 BUG_ON(th == NULL); 857 BUG_ON(th == NULL);
859 858
860 WRITE_LOCK(&tcp_lock); 859 write_lock_bh(&tcp_lock);
861 old_state = conntrack->proto.tcp.state; 860 old_state = conntrack->proto.tcp.state;
862 dir = CTINFO2DIR(ctinfo); 861 dir = CTINFO2DIR(ctinfo);
863 index = get_conntrack_index(th); 862 index = get_conntrack_index(th);
@@ -879,7 +878,7 @@ static int tcp_packet(struct ip_conntrack *conntrack,
879 * that the client cannot but retransmit its SYN and 878 * that the client cannot but retransmit its SYN and
880 * thus initiate a clean new session. 879 * thus initiate a clean new session.
881 */ 880 */
882 WRITE_UNLOCK(&tcp_lock); 881 write_unlock_bh(&tcp_lock);
883 if (LOG_INVALID(IPPROTO_TCP)) 882 if (LOG_INVALID(IPPROTO_TCP))
884 nf_log_packet(PF_INET, 0, skb, NULL, NULL, 883 nf_log_packet(PF_INET, 0, skb, NULL, NULL,
885 "ip_ct_tcp: killing out of sync session "); 884 "ip_ct_tcp: killing out of sync session ");
@@ -894,7 +893,7 @@ static int tcp_packet(struct ip_conntrack *conntrack,
894 conntrack->proto.tcp.last_end = 893 conntrack->proto.tcp.last_end =
895 segment_seq_plus_len(ntohl(th->seq), skb->len, iph, th); 894 segment_seq_plus_len(ntohl(th->seq), skb->len, iph, th);
896 895
897 WRITE_UNLOCK(&tcp_lock); 896 write_unlock_bh(&tcp_lock);
898 if (LOG_INVALID(IPPROTO_TCP)) 897 if (LOG_INVALID(IPPROTO_TCP))
899 nf_log_packet(PF_INET, 0, skb, NULL, NULL, 898 nf_log_packet(PF_INET, 0, skb, NULL, NULL,
900 "ip_ct_tcp: invalid packet ignored "); 899 "ip_ct_tcp: invalid packet ignored ");
@@ -904,7 +903,7 @@ static int tcp_packet(struct ip_conntrack *conntrack,
904 DEBUGP("ip_ct_tcp: Invalid dir=%i index=%u ostate=%u\n", 903 DEBUGP("ip_ct_tcp: Invalid dir=%i index=%u ostate=%u\n",
905 dir, get_conntrack_index(th), 904 dir, get_conntrack_index(th),
906 old_state); 905 old_state);
907 WRITE_UNLOCK(&tcp_lock); 906 write_unlock_bh(&tcp_lock);
908 if (LOG_INVALID(IPPROTO_TCP)) 907 if (LOG_INVALID(IPPROTO_TCP))
909 nf_log_packet(PF_INET, 0, skb, NULL, NULL, 908 nf_log_packet(PF_INET, 0, skb, NULL, NULL,
910 "ip_ct_tcp: invalid state "); 909 "ip_ct_tcp: invalid state ");
@@ -918,13 +917,13 @@ static int tcp_packet(struct ip_conntrack *conntrack,
918 conntrack->proto.tcp.seen[dir].td_end)) { 917 conntrack->proto.tcp.seen[dir].td_end)) {
919 /* Attempt to reopen a closed connection. 918 /* Attempt to reopen a closed connection.
920 * Delete this connection and look up again. */ 919 * Delete this connection and look up again. */
921 WRITE_UNLOCK(&tcp_lock); 920 write_unlock_bh(&tcp_lock);
922 if (del_timer(&conntrack->timeout)) 921 if (del_timer(&conntrack->timeout))
923 conntrack->timeout.function((unsigned long) 922 conntrack->timeout.function((unsigned long)
924 conntrack); 923 conntrack);
925 return -NF_REPEAT; 924 return -NF_REPEAT;
926 } else { 925 } else {
927 WRITE_UNLOCK(&tcp_lock); 926 write_unlock_bh(&tcp_lock);
928 if (LOG_INVALID(IPPROTO_TCP)) 927 if (LOG_INVALID(IPPROTO_TCP))
929 nf_log_packet(PF_INET, 0, skb, NULL, NULL, 928 nf_log_packet(PF_INET, 0, skb, NULL, NULL,
930 "ip_ct_tcp: invalid SYN"); 929 "ip_ct_tcp: invalid SYN");
@@ -949,7 +948,7 @@ static int tcp_packet(struct ip_conntrack *conntrack,
949 948
950 if (!tcp_in_window(&conntrack->proto.tcp, dir, index, 949 if (!tcp_in_window(&conntrack->proto.tcp, dir, index,
951 skb, iph, th)) { 950 skb, iph, th)) {
952 WRITE_UNLOCK(&tcp_lock); 951 write_unlock_bh(&tcp_lock);
953 return -NF_ACCEPT; 952 return -NF_ACCEPT;
954 } 953 }
955 in_window: 954 in_window:
@@ -972,7 +971,7 @@ static int tcp_packet(struct ip_conntrack *conntrack,
972 timeout = conntrack->proto.tcp.retrans >= ip_ct_tcp_max_retrans 971 timeout = conntrack->proto.tcp.retrans >= ip_ct_tcp_max_retrans
973 && *tcp_timeouts[new_state] > ip_ct_tcp_timeout_max_retrans 972 && *tcp_timeouts[new_state] > ip_ct_tcp_timeout_max_retrans
974 ? ip_ct_tcp_timeout_max_retrans : *tcp_timeouts[new_state]; 973 ? ip_ct_tcp_timeout_max_retrans : *tcp_timeouts[new_state];
975 WRITE_UNLOCK(&tcp_lock); 974 write_unlock_bh(&tcp_lock);
976 975
977 if (!test_bit(IPS_SEEN_REPLY_BIT, &conntrack->status)) { 976 if (!test_bit(IPS_SEEN_REPLY_BIT, &conntrack->status)) {
978 /* If only reply is a RST, we can consider ourselves not to 977 /* If only reply is a RST, we can consider ourselves not to
diff --git a/net/ipv4/netfilter/ip_conntrack_proto_udp.c b/net/ipv4/netfilter/ip_conntrack_proto_udp.c
index 5bc28a224623..8c1eaba098d4 100644
--- a/net/ipv4/netfilter/ip_conntrack_proto_udp.c
+++ b/net/ipv4/netfilter/ip_conntrack_proto_udp.c
@@ -120,6 +120,7 @@ static int udp_error(struct sk_buff *skb, enum ip_conntrack_info *ctinfo,
120 * and moreover root might send raw packets. 120 * and moreover root might send raw packets.
121 * FIXME: Source route IP option packets --RR */ 121 * FIXME: Source route IP option packets --RR */
122 if (hooknum == NF_IP_PRE_ROUTING 122 if (hooknum == NF_IP_PRE_ROUTING
123 && skb->ip_summed != CHECKSUM_UNNECESSARY
123 && csum_tcpudp_magic(iph->saddr, iph->daddr, udplen, IPPROTO_UDP, 124 && csum_tcpudp_magic(iph->saddr, iph->daddr, udplen, IPPROTO_UDP,
124 skb->ip_summed == CHECKSUM_HW ? skb->csum 125 skb->ip_summed == CHECKSUM_HW ? skb->csum
125 : skb_checksum(skb, iph->ihl*4, udplen, 0))) { 126 : skb_checksum(skb, iph->ihl*4, udplen, 0))) {
diff --git a/net/ipv4/netfilter/ip_conntrack_standalone.c b/net/ipv4/netfilter/ip_conntrack_standalone.c
index bc59f7b39805..42dc95102873 100644
--- a/net/ipv4/netfilter/ip_conntrack_standalone.c
+++ b/net/ipv4/netfilter/ip_conntrack_standalone.c
@@ -28,8 +28,8 @@
28#include <net/checksum.h> 28#include <net/checksum.h>
29#include <net/ip.h> 29#include <net/ip.h>
30 30
31#define ASSERT_READ_LOCK(x) MUST_BE_READ_LOCKED(&ip_conntrack_lock) 31#define ASSERT_READ_LOCK(x)
32#define ASSERT_WRITE_LOCK(x) MUST_BE_WRITE_LOCKED(&ip_conntrack_lock) 32#define ASSERT_WRITE_LOCK(x)
33 33
34#include <linux/netfilter_ipv4/ip_conntrack.h> 34#include <linux/netfilter_ipv4/ip_conntrack.h>
35#include <linux/netfilter_ipv4/ip_conntrack_protocol.h> 35#include <linux/netfilter_ipv4/ip_conntrack_protocol.h>
@@ -119,7 +119,7 @@ static struct list_head *ct_get_idx(struct seq_file *seq, loff_t pos)
119 119
120static void *ct_seq_start(struct seq_file *seq, loff_t *pos) 120static void *ct_seq_start(struct seq_file *seq, loff_t *pos)
121{ 121{
122 READ_LOCK(&ip_conntrack_lock); 122 read_lock_bh(&ip_conntrack_lock);
123 return ct_get_idx(seq, *pos); 123 return ct_get_idx(seq, *pos);
124} 124}
125 125
@@ -131,7 +131,7 @@ static void *ct_seq_next(struct seq_file *s, void *v, loff_t *pos)
131 131
132static void ct_seq_stop(struct seq_file *s, void *v) 132static void ct_seq_stop(struct seq_file *s, void *v)
133{ 133{
134 READ_UNLOCK(&ip_conntrack_lock); 134 read_unlock_bh(&ip_conntrack_lock);
135} 135}
136 136
137static int ct_seq_show(struct seq_file *s, void *v) 137static int ct_seq_show(struct seq_file *s, void *v)
@@ -140,7 +140,7 @@ static int ct_seq_show(struct seq_file *s, void *v)
140 const struct ip_conntrack *conntrack = tuplehash_to_ctrack(hash); 140 const struct ip_conntrack *conntrack = tuplehash_to_ctrack(hash);
141 struct ip_conntrack_protocol *proto; 141 struct ip_conntrack_protocol *proto;
142 142
143 MUST_BE_READ_LOCKED(&ip_conntrack_lock); 143 ASSERT_READ_LOCK(&ip_conntrack_lock);
144 IP_NF_ASSERT(conntrack); 144 IP_NF_ASSERT(conntrack);
145 145
146 /* we only want to print DIR_ORIGINAL */ 146 /* we only want to print DIR_ORIGINAL */
@@ -239,7 +239,7 @@ static void *exp_seq_start(struct seq_file *s, loff_t *pos)
239 239
240 /* strange seq_file api calls stop even if we fail, 240 /* strange seq_file api calls stop even if we fail,
241 * thus we need to grab lock since stop unlocks */ 241 * thus we need to grab lock since stop unlocks */
242 READ_LOCK(&ip_conntrack_lock); 242 read_lock_bh(&ip_conntrack_lock);
243 243
244 if (list_empty(e)) 244 if (list_empty(e))
245 return NULL; 245 return NULL;
@@ -267,7 +267,7 @@ static void *exp_seq_next(struct seq_file *s, void *v, loff_t *pos)
267 267
268static void exp_seq_stop(struct seq_file *s, void *v) 268static void exp_seq_stop(struct seq_file *s, void *v)
269{ 269{
270 READ_UNLOCK(&ip_conntrack_lock); 270 read_unlock_bh(&ip_conntrack_lock);
271} 271}
272 272
273static int exp_seq_show(struct seq_file *s, void *v) 273static int exp_seq_show(struct seq_file *s, void *v)
@@ -921,22 +921,22 @@ int ip_conntrack_protocol_register(struct ip_conntrack_protocol *proto)
921{ 921{
922 int ret = 0; 922 int ret = 0;
923 923
924 WRITE_LOCK(&ip_conntrack_lock); 924 write_lock_bh(&ip_conntrack_lock);
925 if (ip_ct_protos[proto->proto] != &ip_conntrack_generic_protocol) { 925 if (ip_ct_protos[proto->proto] != &ip_conntrack_generic_protocol) {
926 ret = -EBUSY; 926 ret = -EBUSY;
927 goto out; 927 goto out;
928 } 928 }
929 ip_ct_protos[proto->proto] = proto; 929 ip_ct_protos[proto->proto] = proto;
930 out: 930 out:
931 WRITE_UNLOCK(&ip_conntrack_lock); 931 write_unlock_bh(&ip_conntrack_lock);
932 return ret; 932 return ret;
933} 933}
934 934
935void ip_conntrack_protocol_unregister(struct ip_conntrack_protocol *proto) 935void ip_conntrack_protocol_unregister(struct ip_conntrack_protocol *proto)
936{ 936{
937 WRITE_LOCK(&ip_conntrack_lock); 937 write_lock_bh(&ip_conntrack_lock);
938 ip_ct_protos[proto->proto] = &ip_conntrack_generic_protocol; 938 ip_ct_protos[proto->proto] = &ip_conntrack_generic_protocol;
939 WRITE_UNLOCK(&ip_conntrack_lock); 939 write_unlock_bh(&ip_conntrack_lock);
940 940
941 /* Somebody could be still looking at the proto in bh. */ 941 /* Somebody could be still looking at the proto in bh. */
942 synchronize_net(); 942 synchronize_net();
diff --git a/net/ipv4/netfilter/ip_nat_core.c b/net/ipv4/netfilter/ip_nat_core.c
index 9fc6f93af0dd..739b6dde1c82 100644
--- a/net/ipv4/netfilter/ip_nat_core.c
+++ b/net/ipv4/netfilter/ip_nat_core.c
@@ -22,8 +22,8 @@
22#include <linux/udp.h> 22#include <linux/udp.h>
23#include <linux/jhash.h> 23#include <linux/jhash.h>
24 24
25#define ASSERT_READ_LOCK(x) MUST_BE_READ_LOCKED(&ip_nat_lock) 25#define ASSERT_READ_LOCK(x)
26#define ASSERT_WRITE_LOCK(x) MUST_BE_WRITE_LOCKED(&ip_nat_lock) 26#define ASSERT_WRITE_LOCK(x)
27 27
28#include <linux/netfilter_ipv4/ip_conntrack.h> 28#include <linux/netfilter_ipv4/ip_conntrack.h>
29#include <linux/netfilter_ipv4/ip_conntrack_core.h> 29#include <linux/netfilter_ipv4/ip_conntrack_core.h>
@@ -41,7 +41,7 @@
41#define DEBUGP(format, args...) 41#define DEBUGP(format, args...)
42#endif 42#endif
43 43
44DECLARE_RWLOCK(ip_nat_lock); 44DEFINE_RWLOCK(ip_nat_lock);
45 45
46/* Calculated at init based on memory size */ 46/* Calculated at init based on memory size */
47static unsigned int ip_nat_htable_size; 47static unsigned int ip_nat_htable_size;
@@ -65,9 +65,9 @@ static void ip_nat_cleanup_conntrack(struct ip_conntrack *conn)
65 if (!(conn->status & IPS_NAT_DONE_MASK)) 65 if (!(conn->status & IPS_NAT_DONE_MASK))
66 return; 66 return;
67 67
68 WRITE_LOCK(&ip_nat_lock); 68 write_lock_bh(&ip_nat_lock);
69 list_del(&conn->nat.info.bysource); 69 list_del(&conn->nat.info.bysource);
70 WRITE_UNLOCK(&ip_nat_lock); 70 write_unlock_bh(&ip_nat_lock);
71} 71}
72 72
73/* We do checksum mangling, so if they were wrong before they're still 73/* We do checksum mangling, so if they were wrong before they're still
@@ -142,7 +142,7 @@ find_appropriate_src(const struct ip_conntrack_tuple *tuple,
142 unsigned int h = hash_by_src(tuple); 142 unsigned int h = hash_by_src(tuple);
143 struct ip_conntrack *ct; 143 struct ip_conntrack *ct;
144 144
145 READ_LOCK(&ip_nat_lock); 145 read_lock_bh(&ip_nat_lock);
146 list_for_each_entry(ct, &bysource[h], nat.info.bysource) { 146 list_for_each_entry(ct, &bysource[h], nat.info.bysource) {
147 if (same_src(ct, tuple)) { 147 if (same_src(ct, tuple)) {
148 /* Copy source part from reply tuple. */ 148 /* Copy source part from reply tuple. */
@@ -151,12 +151,12 @@ find_appropriate_src(const struct ip_conntrack_tuple *tuple,
151 result->dst = tuple->dst; 151 result->dst = tuple->dst;
152 152
153 if (in_range(result, range)) { 153 if (in_range(result, range)) {
154 READ_UNLOCK(&ip_nat_lock); 154 read_unlock_bh(&ip_nat_lock);
155 return 1; 155 return 1;
156 } 156 }
157 } 157 }
158 } 158 }
159 READ_UNLOCK(&ip_nat_lock); 159 read_unlock_bh(&ip_nat_lock);
160 return 0; 160 return 0;
161} 161}
162 162
@@ -297,9 +297,9 @@ ip_nat_setup_info(struct ip_conntrack *conntrack,
297 unsigned int srchash 297 unsigned int srchash
298 = hash_by_src(&conntrack->tuplehash[IP_CT_DIR_ORIGINAL] 298 = hash_by_src(&conntrack->tuplehash[IP_CT_DIR_ORIGINAL]
299 .tuple); 299 .tuple);
300 WRITE_LOCK(&ip_nat_lock); 300 write_lock_bh(&ip_nat_lock);
301 list_add(&info->bysource, &bysource[srchash]); 301 list_add(&info->bysource, &bysource[srchash]);
302 WRITE_UNLOCK(&ip_nat_lock); 302 write_unlock_bh(&ip_nat_lock);
303 } 303 }
304 304
305 /* It's done. */ 305 /* It's done. */
@@ -474,23 +474,23 @@ int ip_nat_protocol_register(struct ip_nat_protocol *proto)
474{ 474{
475 int ret = 0; 475 int ret = 0;
476 476
477 WRITE_LOCK(&ip_nat_lock); 477 write_lock_bh(&ip_nat_lock);
478 if (ip_nat_protos[proto->protonum] != &ip_nat_unknown_protocol) { 478 if (ip_nat_protos[proto->protonum] != &ip_nat_unknown_protocol) {
479 ret = -EBUSY; 479 ret = -EBUSY;
480 goto out; 480 goto out;
481 } 481 }
482 ip_nat_protos[proto->protonum] = proto; 482 ip_nat_protos[proto->protonum] = proto;
483 out: 483 out:
484 WRITE_UNLOCK(&ip_nat_lock); 484 write_unlock_bh(&ip_nat_lock);
485 return ret; 485 return ret;
486} 486}
487 487
488/* Noone stores the protocol anywhere; simply delete it. */ 488/* Noone stores the protocol anywhere; simply delete it. */
489void ip_nat_protocol_unregister(struct ip_nat_protocol *proto) 489void ip_nat_protocol_unregister(struct ip_nat_protocol *proto)
490{ 490{
491 WRITE_LOCK(&ip_nat_lock); 491 write_lock_bh(&ip_nat_lock);
492 ip_nat_protos[proto->protonum] = &ip_nat_unknown_protocol; 492 ip_nat_protos[proto->protonum] = &ip_nat_unknown_protocol;
493 WRITE_UNLOCK(&ip_nat_lock); 493 write_unlock_bh(&ip_nat_lock);
494 494
495 /* Someone could be still looking at the proto in a bh. */ 495 /* Someone could be still looking at the proto in a bh. */
496 synchronize_net(); 496 synchronize_net();
@@ -509,13 +509,13 @@ int __init ip_nat_init(void)
509 return -ENOMEM; 509 return -ENOMEM;
510 510
511 /* Sew in builtin protocols. */ 511 /* Sew in builtin protocols. */
512 WRITE_LOCK(&ip_nat_lock); 512 write_lock_bh(&ip_nat_lock);
513 for (i = 0; i < MAX_IP_NAT_PROTO; i++) 513 for (i = 0; i < MAX_IP_NAT_PROTO; i++)
514 ip_nat_protos[i] = &ip_nat_unknown_protocol; 514 ip_nat_protos[i] = &ip_nat_unknown_protocol;
515 ip_nat_protos[IPPROTO_TCP] = &ip_nat_protocol_tcp; 515 ip_nat_protos[IPPROTO_TCP] = &ip_nat_protocol_tcp;
516 ip_nat_protos[IPPROTO_UDP] = &ip_nat_protocol_udp; 516 ip_nat_protos[IPPROTO_UDP] = &ip_nat_protocol_udp;
517 ip_nat_protos[IPPROTO_ICMP] = &ip_nat_protocol_icmp; 517 ip_nat_protos[IPPROTO_ICMP] = &ip_nat_protocol_icmp;
518 WRITE_UNLOCK(&ip_nat_lock); 518 write_unlock_bh(&ip_nat_lock);
519 519
520 for (i = 0; i < ip_nat_htable_size; i++) { 520 for (i = 0; i < ip_nat_htable_size; i++) {
521 INIT_LIST_HEAD(&bysource[i]); 521 INIT_LIST_HEAD(&bysource[i]);
diff --git a/net/ipv4/netfilter/ip_nat_helper.c b/net/ipv4/netfilter/ip_nat_helper.c
index 1637b96d8c01..158f34f32c04 100644
--- a/net/ipv4/netfilter/ip_nat_helper.c
+++ b/net/ipv4/netfilter/ip_nat_helper.c
@@ -28,8 +28,8 @@
28#include <net/tcp.h> 28#include <net/tcp.h>
29#include <net/udp.h> 29#include <net/udp.h>
30 30
31#define ASSERT_READ_LOCK(x) MUST_BE_READ_LOCKED(&ip_nat_lock) 31#define ASSERT_READ_LOCK(x)
32#define ASSERT_WRITE_LOCK(x) MUST_BE_WRITE_LOCKED(&ip_nat_lock) 32#define ASSERT_WRITE_LOCK(x)
33 33
34#include <linux/netfilter_ipv4/ip_conntrack.h> 34#include <linux/netfilter_ipv4/ip_conntrack.h>
35#include <linux/netfilter_ipv4/ip_conntrack_helper.h> 35#include <linux/netfilter_ipv4/ip_conntrack_helper.h>
@@ -47,7 +47,7 @@
47#define DUMP_OFFSET(x) 47#define DUMP_OFFSET(x)
48#endif 48#endif
49 49
50static DECLARE_LOCK(ip_nat_seqofs_lock); 50static DEFINE_SPINLOCK(ip_nat_seqofs_lock);
51 51
52/* Setup TCP sequence correction given this change at this sequence */ 52/* Setup TCP sequence correction given this change at this sequence */
53static inline void 53static inline void
@@ -70,7 +70,7 @@ adjust_tcp_sequence(u32 seq,
70 DEBUGP("ip_nat_resize_packet: Seq_offset before: "); 70 DEBUGP("ip_nat_resize_packet: Seq_offset before: ");
71 DUMP_OFFSET(this_way); 71 DUMP_OFFSET(this_way);
72 72
73 LOCK_BH(&ip_nat_seqofs_lock); 73 spin_lock_bh(&ip_nat_seqofs_lock);
74 74
75 /* SYN adjust. If it's uninitialized, or this is after last 75 /* SYN adjust. If it's uninitialized, or this is after last
76 * correction, record it: we don't handle more than one 76 * correction, record it: we don't handle more than one
@@ -82,7 +82,7 @@ adjust_tcp_sequence(u32 seq,
82 this_way->offset_before = this_way->offset_after; 82 this_way->offset_before = this_way->offset_after;
83 this_way->offset_after += sizediff; 83 this_way->offset_after += sizediff;
84 } 84 }
85 UNLOCK_BH(&ip_nat_seqofs_lock); 85 spin_unlock_bh(&ip_nat_seqofs_lock);
86 86
87 DEBUGP("ip_nat_resize_packet: Seq_offset after: "); 87 DEBUGP("ip_nat_resize_packet: Seq_offset after: ");
88 DUMP_OFFSET(this_way); 88 DUMP_OFFSET(this_way);
@@ -142,9 +142,6 @@ static int enlarge_skb(struct sk_buff **pskb, unsigned int extra)
142 /* Transfer socket to new skb. */ 142 /* Transfer socket to new skb. */
143 if ((*pskb)->sk) 143 if ((*pskb)->sk)
144 skb_set_owner_w(nskb, (*pskb)->sk); 144 skb_set_owner_w(nskb, (*pskb)->sk);
145#ifdef CONFIG_NETFILTER_DEBUG
146 nskb->nf_debug = (*pskb)->nf_debug;
147#endif
148 kfree_skb(*pskb); 145 kfree_skb(*pskb);
149 *pskb = nskb; 146 *pskb = nskb;
150 return 1; 147 return 1;
diff --git a/net/ipv4/netfilter/ip_nat_rule.c b/net/ipv4/netfilter/ip_nat_rule.c
index 581f097f5a24..60d70fa41a15 100644
--- a/net/ipv4/netfilter/ip_nat_rule.c
+++ b/net/ipv4/netfilter/ip_nat_rule.c
@@ -19,8 +19,8 @@
19#include <net/route.h> 19#include <net/route.h>
20#include <linux/bitops.h> 20#include <linux/bitops.h>
21 21
22#define ASSERT_READ_LOCK(x) MUST_BE_READ_LOCKED(&ip_nat_lock) 22#define ASSERT_READ_LOCK(x)
23#define ASSERT_WRITE_LOCK(x) MUST_BE_WRITE_LOCKED(&ip_nat_lock) 23#define ASSERT_WRITE_LOCK(x)
24 24
25#include <linux/netfilter_ipv4/ip_tables.h> 25#include <linux/netfilter_ipv4/ip_tables.h>
26#include <linux/netfilter_ipv4/ip_nat.h> 26#include <linux/netfilter_ipv4/ip_nat.h>
diff --git a/net/ipv4/netfilter/ip_nat_standalone.c b/net/ipv4/netfilter/ip_nat_standalone.c
index 79f56f662b33..bc59d0d6e89e 100644
--- a/net/ipv4/netfilter/ip_nat_standalone.c
+++ b/net/ipv4/netfilter/ip_nat_standalone.c
@@ -31,8 +31,8 @@
31#include <net/checksum.h> 31#include <net/checksum.h>
32#include <linux/spinlock.h> 32#include <linux/spinlock.h>
33 33
34#define ASSERT_READ_LOCK(x) MUST_BE_READ_LOCKED(&ip_nat_lock) 34#define ASSERT_READ_LOCK(x)
35#define ASSERT_WRITE_LOCK(x) MUST_BE_WRITE_LOCKED(&ip_nat_lock) 35#define ASSERT_WRITE_LOCK(x)
36 36
37#include <linux/netfilter_ipv4/ip_nat.h> 37#include <linux/netfilter_ipv4/ip_nat.h>
38#include <linux/netfilter_ipv4/ip_nat_rule.h> 38#include <linux/netfilter_ipv4/ip_nat_rule.h>
@@ -373,7 +373,6 @@ static int init_or_cleanup(int init)
373 cleanup_rule_init: 373 cleanup_rule_init:
374 ip_nat_rule_cleanup(); 374 ip_nat_rule_cleanup();
375 cleanup_nothing: 375 cleanup_nothing:
376 MUST_BE_READ_WRITE_UNLOCKED(&ip_nat_lock);
377 return ret; 376 return ret;
378} 377}
379 378
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
index 8a54f92b8496..c88dfcd38c56 100644
--- a/net/ipv4/netfilter/ip_tables.c
+++ b/net/ipv4/netfilter/ip_tables.c
@@ -67,7 +67,6 @@ static DECLARE_MUTEX(ipt_mutex);
67/* Must have mutex */ 67/* Must have mutex */
68#define ASSERT_READ_LOCK(x) IP_NF_ASSERT(down_trylock(&ipt_mutex) != 0) 68#define ASSERT_READ_LOCK(x) IP_NF_ASSERT(down_trylock(&ipt_mutex) != 0)
69#define ASSERT_WRITE_LOCK(x) IP_NF_ASSERT(down_trylock(&ipt_mutex) != 0) 69#define ASSERT_WRITE_LOCK(x) IP_NF_ASSERT(down_trylock(&ipt_mutex) != 0)
70#include <linux/netfilter_ipv4/lockhelp.h>
71#include <linux/netfilter_ipv4/listhelp.h> 70#include <linux/netfilter_ipv4/listhelp.h>
72 71
73#if 0 72#if 0
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c
index 0f12e3a3dc73..dc4362b57cfa 100644
--- a/net/ipv4/netfilter/ipt_CLUSTERIP.c
+++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
@@ -29,7 +29,6 @@
29#include <linux/netfilter_ipv4/ip_tables.h> 29#include <linux/netfilter_ipv4/ip_tables.h>
30#include <linux/netfilter_ipv4/ipt_CLUSTERIP.h> 30#include <linux/netfilter_ipv4/ipt_CLUSTERIP.h>
31#include <linux/netfilter_ipv4/ip_conntrack.h> 31#include <linux/netfilter_ipv4/ip_conntrack.h>
32#include <linux/netfilter_ipv4/lockhelp.h>
33 32
34#define CLUSTERIP_VERSION "0.6" 33#define CLUSTERIP_VERSION "0.6"
35 34
@@ -41,6 +40,8 @@
41#define DEBUGP 40#define DEBUGP
42#endif 41#endif
43 42
43#define ASSERT_READ_LOCK(x)
44
44MODULE_LICENSE("GPL"); 45MODULE_LICENSE("GPL");
45MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>"); 46MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>");
46MODULE_DESCRIPTION("iptables target for CLUSTERIP"); 47MODULE_DESCRIPTION("iptables target for CLUSTERIP");
@@ -67,7 +68,7 @@ static LIST_HEAD(clusterip_configs);
67 68
68/* clusterip_lock protects the clusterip_configs list _AND_ the configurable 69/* clusterip_lock protects the clusterip_configs list _AND_ the configurable
69 * data within all structurses (num_local_nodes, local_nodes[]) */ 70 * data within all structurses (num_local_nodes, local_nodes[]) */
70static DECLARE_RWLOCK(clusterip_lock); 71static DEFINE_RWLOCK(clusterip_lock);
71 72
72#ifdef CONFIG_PROC_FS 73#ifdef CONFIG_PROC_FS
73static struct file_operations clusterip_proc_fops; 74static struct file_operations clusterip_proc_fops;
@@ -82,9 +83,9 @@ clusterip_config_get(struct clusterip_config *c) {
82static inline void 83static inline void
83clusterip_config_put(struct clusterip_config *c) { 84clusterip_config_put(struct clusterip_config *c) {
84 if (atomic_dec_and_test(&c->refcount)) { 85 if (atomic_dec_and_test(&c->refcount)) {
85 WRITE_LOCK(&clusterip_lock); 86 write_lock_bh(&clusterip_lock);
86 list_del(&c->list); 87 list_del(&c->list);
87 WRITE_UNLOCK(&clusterip_lock); 88 write_unlock_bh(&clusterip_lock);
88 dev_mc_delete(c->dev, c->clustermac, ETH_ALEN, 0); 89 dev_mc_delete(c->dev, c->clustermac, ETH_ALEN, 0);
89 dev_put(c->dev); 90 dev_put(c->dev);
90 kfree(c); 91 kfree(c);
@@ -97,7 +98,7 @@ __clusterip_config_find(u_int32_t clusterip)
97{ 98{
98 struct list_head *pos; 99 struct list_head *pos;
99 100
100 MUST_BE_READ_LOCKED(&clusterip_lock); 101 ASSERT_READ_LOCK(&clusterip_lock);
101 list_for_each(pos, &clusterip_configs) { 102 list_for_each(pos, &clusterip_configs) {
102 struct clusterip_config *c = list_entry(pos, 103 struct clusterip_config *c = list_entry(pos,
103 struct clusterip_config, list); 104 struct clusterip_config, list);
@@ -114,14 +115,14 @@ clusterip_config_find_get(u_int32_t clusterip)
114{ 115{
115 struct clusterip_config *c; 116 struct clusterip_config *c;
116 117
117 READ_LOCK(&clusterip_lock); 118 read_lock_bh(&clusterip_lock);
118 c = __clusterip_config_find(clusterip); 119 c = __clusterip_config_find(clusterip);
119 if (!c) { 120 if (!c) {
120 READ_UNLOCK(&clusterip_lock); 121 read_unlock_bh(&clusterip_lock);
121 return NULL; 122 return NULL;
122 } 123 }
123 atomic_inc(&c->refcount); 124 atomic_inc(&c->refcount);
124 READ_UNLOCK(&clusterip_lock); 125 read_unlock_bh(&clusterip_lock);
125 126
126 return c; 127 return c;
127} 128}
@@ -160,9 +161,9 @@ clusterip_config_init(struct ipt_clusterip_tgt_info *i, u_int32_t ip,
160 c->pde->data = c; 161 c->pde->data = c;
161#endif 162#endif
162 163
163 WRITE_LOCK(&clusterip_lock); 164 write_lock_bh(&clusterip_lock);
164 list_add(&c->list, &clusterip_configs); 165 list_add(&c->list, &clusterip_configs);
165 WRITE_UNLOCK(&clusterip_lock); 166 write_unlock_bh(&clusterip_lock);
166 167
167 return c; 168 return c;
168} 169}
@@ -172,25 +173,25 @@ clusterip_add_node(struct clusterip_config *c, u_int16_t nodenum)
172{ 173{
173 int i; 174 int i;
174 175
175 WRITE_LOCK(&clusterip_lock); 176 write_lock_bh(&clusterip_lock);
176 177
177 if (c->num_local_nodes >= CLUSTERIP_MAX_NODES 178 if (c->num_local_nodes >= CLUSTERIP_MAX_NODES
178 || nodenum > CLUSTERIP_MAX_NODES) { 179 || nodenum > CLUSTERIP_MAX_NODES) {
179 WRITE_UNLOCK(&clusterip_lock); 180 write_unlock_bh(&clusterip_lock);
180 return 1; 181 return 1;
181 } 182 }
182 183
183 /* check if we alrady have this number in our array */ 184 /* check if we alrady have this number in our array */
184 for (i = 0; i < c->num_local_nodes; i++) { 185 for (i = 0; i < c->num_local_nodes; i++) {
185 if (c->local_nodes[i] == nodenum) { 186 if (c->local_nodes[i] == nodenum) {
186 WRITE_UNLOCK(&clusterip_lock); 187 write_unlock_bh(&clusterip_lock);
187 return 1; 188 return 1;
188 } 189 }
189 } 190 }
190 191
191 c->local_nodes[c->num_local_nodes++] = nodenum; 192 c->local_nodes[c->num_local_nodes++] = nodenum;
192 193
193 WRITE_UNLOCK(&clusterip_lock); 194 write_unlock_bh(&clusterip_lock);
194 return 0; 195 return 0;
195} 196}
196 197
@@ -199,10 +200,10 @@ clusterip_del_node(struct clusterip_config *c, u_int16_t nodenum)
199{ 200{
200 int i; 201 int i;
201 202
202 WRITE_LOCK(&clusterip_lock); 203 write_lock_bh(&clusterip_lock);
203 204
204 if (c->num_local_nodes <= 1 || nodenum > CLUSTERIP_MAX_NODES) { 205 if (c->num_local_nodes <= 1 || nodenum > CLUSTERIP_MAX_NODES) {
205 WRITE_UNLOCK(&clusterip_lock); 206 write_unlock_bh(&clusterip_lock);
206 return 1; 207 return 1;
207 } 208 }
208 209
@@ -211,12 +212,12 @@ clusterip_del_node(struct clusterip_config *c, u_int16_t nodenum)
211 int size = sizeof(u_int16_t)*(c->num_local_nodes-(i+1)); 212 int size = sizeof(u_int16_t)*(c->num_local_nodes-(i+1));
212 memmove(&c->local_nodes[i], &c->local_nodes[i+1], size); 213 memmove(&c->local_nodes[i], &c->local_nodes[i+1], size);
213 c->num_local_nodes--; 214 c->num_local_nodes--;
214 WRITE_UNLOCK(&clusterip_lock); 215 write_unlock_bh(&clusterip_lock);
215 return 0; 216 return 0;
216 } 217 }
217 } 218 }
218 219
219 WRITE_UNLOCK(&clusterip_lock); 220 write_unlock_bh(&clusterip_lock);
220 return 1; 221 return 1;
221} 222}
222 223
@@ -286,21 +287,21 @@ clusterip_responsible(struct clusterip_config *config, u_int32_t hash)
286{ 287{
287 int i; 288 int i;
288 289
289 READ_LOCK(&clusterip_lock); 290 read_lock_bh(&clusterip_lock);
290 291
291 if (config->num_local_nodes == 0) { 292 if (config->num_local_nodes == 0) {
292 READ_UNLOCK(&clusterip_lock); 293 read_unlock_bh(&clusterip_lock);
293 return 0; 294 return 0;
294 } 295 }
295 296
296 for (i = 0; i < config->num_local_nodes; i++) { 297 for (i = 0; i < config->num_local_nodes; i++) {
297 if (config->local_nodes[i] == hash) { 298 if (config->local_nodes[i] == hash) {
298 READ_UNLOCK(&clusterip_lock); 299 read_unlock_bh(&clusterip_lock);
299 return 1; 300 return 1;
300 } 301 }
301 } 302 }
302 303
303 READ_UNLOCK(&clusterip_lock); 304 read_unlock_bh(&clusterip_lock);
304 305
305 return 0; 306 return 0;
306} 307}
@@ -578,7 +579,7 @@ static void *clusterip_seq_start(struct seq_file *s, loff_t *pos)
578 struct clusterip_config *c = pde->data; 579 struct clusterip_config *c = pde->data;
579 unsigned int *nodeidx; 580 unsigned int *nodeidx;
580 581
581 READ_LOCK(&clusterip_lock); 582 read_lock_bh(&clusterip_lock);
582 if (*pos >= c->num_local_nodes) 583 if (*pos >= c->num_local_nodes)
583 return NULL; 584 return NULL;
584 585
@@ -608,7 +609,7 @@ static void clusterip_seq_stop(struct seq_file *s, void *v)
608{ 609{
609 kfree(v); 610 kfree(v);
610 611
611 READ_UNLOCK(&clusterip_lock); 612 read_unlock_bh(&clusterip_lock);
612} 613}
613 614
614static int clusterip_seq_show(struct seq_file *s, void *v) 615static int clusterip_seq_show(struct seq_file *s, void *v)
diff --git a/net/ipv4/netfilter/ipt_MASQUERADE.c b/net/ipv4/netfilter/ipt_MASQUERADE.c
index 57e9f6cf1c36..91e74502c3d3 100644
--- a/net/ipv4/netfilter/ipt_MASQUERADE.c
+++ b/net/ipv4/netfilter/ipt_MASQUERADE.c
@@ -33,7 +33,7 @@ MODULE_DESCRIPTION("iptables MASQUERADE target module");
33#endif 33#endif
34 34
35/* Lock protects masq region inside conntrack */ 35/* Lock protects masq region inside conntrack */
36static DECLARE_RWLOCK(masq_lock); 36static DEFINE_RWLOCK(masq_lock);
37 37
38/* FIXME: Multiple targets. --RR */ 38/* FIXME: Multiple targets. --RR */
39static int 39static int
@@ -103,9 +103,9 @@ masquerade_target(struct sk_buff **pskb,
103 return NF_DROP; 103 return NF_DROP;
104 } 104 }
105 105
106 WRITE_LOCK(&masq_lock); 106 write_lock_bh(&masq_lock);
107 ct->nat.masq_index = out->ifindex; 107 ct->nat.masq_index = out->ifindex;
108 WRITE_UNLOCK(&masq_lock); 108 write_unlock_bh(&masq_lock);
109 109
110 /* Transfer from original range. */ 110 /* Transfer from original range. */
111 newrange = ((struct ip_nat_range) 111 newrange = ((struct ip_nat_range)
@@ -122,9 +122,9 @@ device_cmp(struct ip_conntrack *i, void *ifindex)
122{ 122{
123 int ret; 123 int ret;
124 124
125 READ_LOCK(&masq_lock); 125 read_lock_bh(&masq_lock);
126 ret = (i->nat.masq_index == (int)(long)ifindex); 126 ret = (i->nat.masq_index == (int)(long)ifindex);
127 READ_UNLOCK(&masq_lock); 127 read_unlock_bh(&masq_lock);
128 128
129 return ret; 129 return ret;
130} 130}
diff --git a/net/ipv4/netfilter/ipt_REJECT.c b/net/ipv4/netfilter/ipt_REJECT.c
index 266d64979286..915696446020 100644
--- a/net/ipv4/netfilter/ipt_REJECT.c
+++ b/net/ipv4/netfilter/ipt_REJECT.c
@@ -104,10 +104,12 @@ static inline struct rtable *route_reverse(struct sk_buff *skb,
104static void send_reset(struct sk_buff *oldskb, int hook) 104static void send_reset(struct sk_buff *oldskb, int hook)
105{ 105{
106 struct sk_buff *nskb; 106 struct sk_buff *nskb;
107 struct iphdr *iph = oldskb->nh.iph;
107 struct tcphdr _otcph, *oth, *tcph; 108 struct tcphdr _otcph, *oth, *tcph;
108 struct rtable *rt; 109 struct rtable *rt;
109 u_int16_t tmp_port; 110 u_int16_t tmp_port;
110 u_int32_t tmp_addr; 111 u_int32_t tmp_addr;
112 unsigned int tcplen;
111 int needs_ack; 113 int needs_ack;
112 int hh_len; 114 int hh_len;
113 115
@@ -124,7 +126,16 @@ static void send_reset(struct sk_buff *oldskb, int hook)
124 if (oth->rst) 126 if (oth->rst)
125 return; 127 return;
126 128
127 /* FIXME: Check checksum --RR */ 129 /* Check checksum */
130 tcplen = oldskb->len - iph->ihl * 4;
131 if (((hook != NF_IP_LOCAL_IN && oldskb->ip_summed != CHECKSUM_HW) ||
132 (hook == NF_IP_LOCAL_IN &&
133 oldskb->ip_summed != CHECKSUM_UNNECESSARY)) &&
134 csum_tcpudp_magic(iph->saddr, iph->daddr, tcplen, IPPROTO_TCP,
135 oldskb->ip_summed == CHECKSUM_HW ? oldskb->csum :
136 skb_checksum(oldskb, iph->ihl * 4, tcplen, 0)))
137 return;
138
128 if ((rt = route_reverse(oldskb, oth, hook)) == NULL) 139 if ((rt = route_reverse(oldskb, oth, hook)) == NULL)
129 return; 140 return;
130 141
diff --git a/net/ipv4/netfilter/ipt_ULOG.c b/net/ipv4/netfilter/ipt_ULOG.c
index 6f2cefbe16cd..52a0076302a7 100644
--- a/net/ipv4/netfilter/ipt_ULOG.c
+++ b/net/ipv4/netfilter/ipt_ULOG.c
@@ -56,7 +56,6 @@
56#include <linux/netfilter.h> 56#include <linux/netfilter.h>
57#include <linux/netfilter_ipv4/ip_tables.h> 57#include <linux/netfilter_ipv4/ip_tables.h>
58#include <linux/netfilter_ipv4/ipt_ULOG.h> 58#include <linux/netfilter_ipv4/ipt_ULOG.h>
59#include <linux/netfilter_ipv4/lockhelp.h>
60#include <net/sock.h> 59#include <net/sock.h>
61#include <linux/bitops.h> 60#include <linux/bitops.h>
62 61
@@ -99,8 +98,8 @@ typedef struct {
99 98
100static ulog_buff_t ulog_buffers[ULOG_MAXNLGROUPS]; /* array of buffers */ 99static ulog_buff_t ulog_buffers[ULOG_MAXNLGROUPS]; /* array of buffers */
101 100
102static struct sock *nflognl; /* our socket */ 101static struct sock *nflognl; /* our socket */
103static DECLARE_LOCK(ulog_lock); /* spinlock */ 102static DEFINE_SPINLOCK(ulog_lock); /* spinlock */
104 103
105/* send one ulog_buff_t to userspace */ 104/* send one ulog_buff_t to userspace */
106static void ulog_send(unsigned int nlgroupnum) 105static void ulog_send(unsigned int nlgroupnum)
@@ -135,9 +134,9 @@ static void ulog_timer(unsigned long data)
135 134
136 /* lock to protect against somebody modifying our structure 135 /* lock to protect against somebody modifying our structure
137 * from ipt_ulog_target at the same time */ 136 * from ipt_ulog_target at the same time */
138 LOCK_BH(&ulog_lock); 137 spin_lock_bh(&ulog_lock);
139 ulog_send(data); 138 ulog_send(data);
140 UNLOCK_BH(&ulog_lock); 139 spin_unlock_bh(&ulog_lock);
141} 140}
142 141
143static struct sk_buff *ulog_alloc_skb(unsigned int size) 142static struct sk_buff *ulog_alloc_skb(unsigned int size)
@@ -193,7 +192,7 @@ static void ipt_ulog_packet(unsigned int hooknum,
193 192
194 ub = &ulog_buffers[groupnum]; 193 ub = &ulog_buffers[groupnum];
195 194
196 LOCK_BH(&ulog_lock); 195 spin_lock_bh(&ulog_lock);
197 196
198 if (!ub->skb) { 197 if (!ub->skb) {
199 if (!(ub->skb = ulog_alloc_skb(size))) 198 if (!(ub->skb = ulog_alloc_skb(size)))
@@ -278,7 +277,7 @@ static void ipt_ulog_packet(unsigned int hooknum,
278 ulog_send(groupnum); 277 ulog_send(groupnum);
279 } 278 }
280 279
281 UNLOCK_BH(&ulog_lock); 280 spin_unlock_bh(&ulog_lock);
282 281
283 return; 282 return;
284 283
@@ -288,7 +287,7 @@ nlmsg_failure:
288alloc_failure: 287alloc_failure:
289 PRINTR("ipt_ULOG: Error building netlink message\n"); 288 PRINTR("ipt_ULOG: Error building netlink message\n");
290 289
291 UNLOCK_BH(&ulog_lock); 290 spin_unlock_bh(&ulog_lock);
292} 291}
293 292
294static unsigned int ipt_ulog_target(struct sk_buff **pskb, 293static unsigned int ipt_ulog_target(struct sk_buff **pskb,
diff --git a/net/ipv4/netfilter/ipt_hashlimit.c b/net/ipv4/netfilter/ipt_hashlimit.c
index f1937190cd77..564b49bfebcf 100644
--- a/net/ipv4/netfilter/ipt_hashlimit.c
+++ b/net/ipv4/netfilter/ipt_hashlimit.c
@@ -37,7 +37,6 @@
37 37
38#include <linux/netfilter_ipv4/ip_tables.h> 38#include <linux/netfilter_ipv4/ip_tables.h>
39#include <linux/netfilter_ipv4/ipt_hashlimit.h> 39#include <linux/netfilter_ipv4/ipt_hashlimit.h>
40#include <linux/netfilter_ipv4/lockhelp.h>
41 40
42/* FIXME: this is just for IP_NF_ASSERRT */ 41/* FIXME: this is just for IP_NF_ASSERRT */
43#include <linux/netfilter_ipv4/ip_conntrack.h> 42#include <linux/netfilter_ipv4/ip_conntrack.h>
@@ -92,7 +91,7 @@ struct ipt_hashlimit_htable {
92 struct hlist_head hash[0]; /* hashtable itself */ 91 struct hlist_head hash[0]; /* hashtable itself */
93}; 92};
94 93
95static DECLARE_LOCK(hashlimit_lock); /* protects htables list */ 94static DEFINE_SPINLOCK(hashlimit_lock); /* protects htables list */
96static DECLARE_MUTEX(hlimit_mutex); /* additional checkentry protection */ 95static DECLARE_MUTEX(hlimit_mutex); /* additional checkentry protection */
97static HLIST_HEAD(hashlimit_htables); 96static HLIST_HEAD(hashlimit_htables);
98static kmem_cache_t *hashlimit_cachep; 97static kmem_cache_t *hashlimit_cachep;
@@ -233,9 +232,9 @@ static int htable_create(struct ipt_hashlimit_info *minfo)
233 hinfo->timer.function = htable_gc; 232 hinfo->timer.function = htable_gc;
234 add_timer(&hinfo->timer); 233 add_timer(&hinfo->timer);
235 234
236 LOCK_BH(&hashlimit_lock); 235 spin_lock_bh(&hashlimit_lock);
237 hlist_add_head(&hinfo->node, &hashlimit_htables); 236 hlist_add_head(&hinfo->node, &hashlimit_htables);
238 UNLOCK_BH(&hashlimit_lock); 237 spin_unlock_bh(&hashlimit_lock);
239 238
240 return 0; 239 return 0;
241} 240}
@@ -301,15 +300,15 @@ static struct ipt_hashlimit_htable *htable_find_get(char *name)
301 struct ipt_hashlimit_htable *hinfo; 300 struct ipt_hashlimit_htable *hinfo;
302 struct hlist_node *pos; 301 struct hlist_node *pos;
303 302
304 LOCK_BH(&hashlimit_lock); 303 spin_lock_bh(&hashlimit_lock);
305 hlist_for_each_entry(hinfo, pos, &hashlimit_htables, node) { 304 hlist_for_each_entry(hinfo, pos, &hashlimit_htables, node) {
306 if (!strcmp(name, hinfo->pde->name)) { 305 if (!strcmp(name, hinfo->pde->name)) {
307 atomic_inc(&hinfo->use); 306 atomic_inc(&hinfo->use);
308 UNLOCK_BH(&hashlimit_lock); 307 spin_unlock_bh(&hashlimit_lock);
309 return hinfo; 308 return hinfo;
310 } 309 }
311 } 310 }
312 UNLOCK_BH(&hashlimit_lock); 311 spin_unlock_bh(&hashlimit_lock);
313 312
314 return NULL; 313 return NULL;
315} 314}
@@ -317,9 +316,9 @@ static struct ipt_hashlimit_htable *htable_find_get(char *name)
317static void htable_put(struct ipt_hashlimit_htable *hinfo) 316static void htable_put(struct ipt_hashlimit_htable *hinfo)
318{ 317{
319 if (atomic_dec_and_test(&hinfo->use)) { 318 if (atomic_dec_and_test(&hinfo->use)) {
320 LOCK_BH(&hashlimit_lock); 319 spin_lock_bh(&hashlimit_lock);
321 hlist_del(&hinfo->node); 320 hlist_del(&hinfo->node);
322 UNLOCK_BH(&hashlimit_lock); 321 spin_unlock_bh(&hashlimit_lock);
323 htable_destroy(hinfo); 322 htable_destroy(hinfo);
324 } 323 }
325} 324}
diff --git a/net/ipv4/netfilter/ipt_helper.c b/net/ipv4/netfilter/ipt_helper.c
index 33fdf364d3d3..3e7dd014de43 100644
--- a/net/ipv4/netfilter/ipt_helper.c
+++ b/net/ipv4/netfilter/ipt_helper.c
@@ -53,7 +53,7 @@ match(const struct sk_buff *skb,
53 return ret; 53 return ret;
54 } 54 }
55 55
56 READ_LOCK(&ip_conntrack_lock); 56 read_lock_bh(&ip_conntrack_lock);
57 if (!ct->master->helper) { 57 if (!ct->master->helper) {
58 DEBUGP("ipt_helper: master ct %p has no helper\n", 58 DEBUGP("ipt_helper: master ct %p has no helper\n",
59 exp->expectant); 59 exp->expectant);
@@ -69,7 +69,7 @@ match(const struct sk_buff *skb,
69 ret ^= !strncmp(ct->master->helper->name, info->name, 69 ret ^= !strncmp(ct->master->helper->name, info->name,
70 strlen(ct->master->helper->name)); 70 strlen(ct->master->helper->name));
71out_unlock: 71out_unlock:
72 READ_UNLOCK(&ip_conntrack_lock); 72 read_unlock_bh(&ip_conntrack_lock);
73 return ret; 73 return ret;
74} 74}
75 75
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 47a30c3188ea..14f5c53235fe 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -695,7 +695,7 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp)
695 695
696 if (rt && ((rt->rt6i_flags & (RTF_GATEWAY | RTF_DEFAULT)) == 0)) { 696 if (rt && ((rt->rt6i_flags & (RTF_GATEWAY | RTF_DEFAULT)) == 0)) {
697 if (onlink == 0) { 697 if (onlink == 0) {
698 ip6_del_rt(rt, NULL, NULL); 698 ip6_del_rt(rt, NULL, NULL, NULL);
699 rt = NULL; 699 rt = NULL;
700 } else if (!(rt->rt6i_flags & RTF_EXPIRES)) { 700 } else if (!(rt->rt6i_flags & RTF_EXPIRES)) {
701 rt->rt6i_expires = expires; 701 rt->rt6i_expires = expires;
@@ -1340,7 +1340,7 @@ addrconf_prefix_route(struct in6_addr *pfx, int plen, struct net_device *dev,
1340 if (dev->type == ARPHRD_SIT && (dev->flags&IFF_POINTOPOINT)) 1340 if (dev->type == ARPHRD_SIT && (dev->flags&IFF_POINTOPOINT))
1341 rtmsg.rtmsg_flags |= RTF_NONEXTHOP; 1341 rtmsg.rtmsg_flags |= RTF_NONEXTHOP;
1342 1342
1343 ip6_route_add(&rtmsg, NULL, NULL); 1343 ip6_route_add(&rtmsg, NULL, NULL, NULL);
1344} 1344}
1345 1345
1346/* Create "default" multicast route to the interface */ 1346/* Create "default" multicast route to the interface */
@@ -1357,7 +1357,7 @@ static void addrconf_add_mroute(struct net_device *dev)
1357 rtmsg.rtmsg_ifindex = dev->ifindex; 1357 rtmsg.rtmsg_ifindex = dev->ifindex;
1358 rtmsg.rtmsg_flags = RTF_UP; 1358 rtmsg.rtmsg_flags = RTF_UP;
1359 rtmsg.rtmsg_type = RTMSG_NEWROUTE; 1359 rtmsg.rtmsg_type = RTMSG_NEWROUTE;
1360 ip6_route_add(&rtmsg, NULL, NULL); 1360 ip6_route_add(&rtmsg, NULL, NULL, NULL);
1361} 1361}
1362 1362
1363static void sit_route_add(struct net_device *dev) 1363static void sit_route_add(struct net_device *dev)
@@ -1374,7 +1374,7 @@ static void sit_route_add(struct net_device *dev)
1374 rtmsg.rtmsg_flags = RTF_UP|RTF_NONEXTHOP; 1374 rtmsg.rtmsg_flags = RTF_UP|RTF_NONEXTHOP;
1375 rtmsg.rtmsg_ifindex = dev->ifindex; 1375 rtmsg.rtmsg_ifindex = dev->ifindex;
1376 1376
1377 ip6_route_add(&rtmsg, NULL, NULL); 1377 ip6_route_add(&rtmsg, NULL, NULL, NULL);
1378} 1378}
1379 1379
1380static void addrconf_add_lroute(struct net_device *dev) 1380static void addrconf_add_lroute(struct net_device *dev)
@@ -1467,7 +1467,7 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len)
1467 if (rt && ((rt->rt6i_flags & (RTF_GATEWAY | RTF_DEFAULT)) == 0)) { 1467 if (rt && ((rt->rt6i_flags & (RTF_GATEWAY | RTF_DEFAULT)) == 0)) {
1468 if (rt->rt6i_flags&RTF_EXPIRES) { 1468 if (rt->rt6i_flags&RTF_EXPIRES) {
1469 if (valid_lft == 0) { 1469 if (valid_lft == 0) {
1470 ip6_del_rt(rt, NULL, NULL); 1470 ip6_del_rt(rt, NULL, NULL, NULL);
1471 rt = NULL; 1471 rt = NULL;
1472 } else { 1472 } else {
1473 rt->rt6i_expires = rt_expires; 1473 rt->rt6i_expires = rt_expires;
@@ -3094,7 +3094,7 @@ static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp)
3094 switch (event) { 3094 switch (event) {
3095 case RTM_NEWADDR: 3095 case RTM_NEWADDR:
3096 dst_hold(&ifp->rt->u.dst); 3096 dst_hold(&ifp->rt->u.dst);
3097 if (ip6_ins_rt(ifp->rt, NULL, NULL)) 3097 if (ip6_ins_rt(ifp->rt, NULL, NULL, NULL))
3098 dst_release(&ifp->rt->u.dst); 3098 dst_release(&ifp->rt->u.dst);
3099 if (ifp->idev->cnf.forwarding) 3099 if (ifp->idev->cnf.forwarding)
3100 addrconf_join_anycast(ifp); 3100 addrconf_join_anycast(ifp);
@@ -3104,7 +3104,7 @@ static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp)
3104 addrconf_leave_anycast(ifp); 3104 addrconf_leave_anycast(ifp);
3105 addrconf_leave_solict(ifp->idev, &ifp->addr); 3105 addrconf_leave_solict(ifp->idev, &ifp->addr);
3106 dst_hold(&ifp->rt->u.dst); 3106 dst_hold(&ifp->rt->u.dst);
3107 if (ip6_del_rt(ifp->rt, NULL, NULL)) 3107 if (ip6_del_rt(ifp->rt, NULL, NULL, NULL))
3108 dst_free(&ifp->rt->u.dst); 3108 dst_free(&ifp->rt->u.dst);
3109 else 3109 else
3110 dst_release(&ifp->rt->u.dst); 3110 dst_release(&ifp->rt->u.dst);
diff --git a/net/ipv6/anycast.c b/net/ipv6/anycast.c
index 5d22ca3cca2e..6b7294047238 100644
--- a/net/ipv6/anycast.c
+++ b/net/ipv6/anycast.c
@@ -337,7 +337,7 @@ int ipv6_dev_ac_inc(struct net_device *dev, struct in6_addr *addr)
337 write_unlock_bh(&idev->lock); 337 write_unlock_bh(&idev->lock);
338 338
339 dst_hold(&rt->u.dst); 339 dst_hold(&rt->u.dst);
340 if (ip6_ins_rt(rt, NULL, NULL)) 340 if (ip6_ins_rt(rt, NULL, NULL, NULL))
341 dst_release(&rt->u.dst); 341 dst_release(&rt->u.dst);
342 342
343 addrconf_join_solict(dev, &aca->aca_addr); 343 addrconf_join_solict(dev, &aca->aca_addr);
@@ -380,7 +380,7 @@ int __ipv6_dev_ac_dec(struct inet6_dev *idev, struct in6_addr *addr)
380 addrconf_leave_solict(idev, &aca->aca_addr); 380 addrconf_leave_solict(idev, &aca->aca_addr);
381 381
382 dst_hold(&aca->aca_rt->u.dst); 382 dst_hold(&aca->aca_rt->u.dst);
383 if (ip6_del_rt(aca->aca_rt, NULL, NULL)) 383 if (ip6_del_rt(aca->aca_rt, NULL, NULL, NULL))
384 dst_free(&aca->aca_rt->u.dst); 384 dst_free(&aca->aca_rt->u.dst);
385 else 385 else
386 dst_release(&aca->aca_rt->u.dst); 386 dst_release(&aca->aca_rt->u.dst);
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index 405740b75abb..1b354aa97934 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -394,7 +394,7 @@ insert_above:
394 */ 394 */
395 395
396static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt, 396static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt,
397 struct nlmsghdr *nlh) 397 struct nlmsghdr *nlh, struct netlink_skb_parms *req)
398{ 398{
399 struct rt6_info *iter = NULL; 399 struct rt6_info *iter = NULL;
400 struct rt6_info **ins; 400 struct rt6_info **ins;
@@ -449,7 +449,7 @@ out:
449 *ins = rt; 449 *ins = rt;
450 rt->rt6i_node = fn; 450 rt->rt6i_node = fn;
451 atomic_inc(&rt->rt6i_ref); 451 atomic_inc(&rt->rt6i_ref);
452 inet6_rt_notify(RTM_NEWROUTE, rt, nlh); 452 inet6_rt_notify(RTM_NEWROUTE, rt, nlh, req);
453 rt6_stats.fib_rt_entries++; 453 rt6_stats.fib_rt_entries++;
454 454
455 if ((fn->fn_flags & RTN_RTINFO) == 0) { 455 if ((fn->fn_flags & RTN_RTINFO) == 0) {
@@ -479,7 +479,8 @@ void fib6_force_start_gc(void)
479 * with source addr info in sub-trees 479 * with source addr info in sub-trees
480 */ 480 */
481 481
482int fib6_add(struct fib6_node *root, struct rt6_info *rt, struct nlmsghdr *nlh, void *_rtattr) 482int fib6_add(struct fib6_node *root, struct rt6_info *rt,
483 struct nlmsghdr *nlh, void *_rtattr, struct netlink_skb_parms *req)
483{ 484{
484 struct fib6_node *fn; 485 struct fib6_node *fn;
485 int err = -ENOMEM; 486 int err = -ENOMEM;
@@ -552,7 +553,7 @@ int fib6_add(struct fib6_node *root, struct rt6_info *rt, struct nlmsghdr *nlh,
552 } 553 }
553#endif 554#endif
554 555
555 err = fib6_add_rt2node(fn, rt, nlh); 556 err = fib6_add_rt2node(fn, rt, nlh, req);
556 557
557 if (err == 0) { 558 if (err == 0) {
558 fib6_start_gc(rt); 559 fib6_start_gc(rt);
@@ -859,7 +860,7 @@ static struct fib6_node * fib6_repair_tree(struct fib6_node *fn)
859} 860}
860 861
861static void fib6_del_route(struct fib6_node *fn, struct rt6_info **rtp, 862static void fib6_del_route(struct fib6_node *fn, struct rt6_info **rtp,
862 struct nlmsghdr *nlh, void *_rtattr) 863 struct nlmsghdr *nlh, void *_rtattr, struct netlink_skb_parms *req)
863{ 864{
864 struct fib6_walker_t *w; 865 struct fib6_walker_t *w;
865 struct rt6_info *rt = *rtp; 866 struct rt6_info *rt = *rtp;
@@ -915,11 +916,11 @@ static void fib6_del_route(struct fib6_node *fn, struct rt6_info **rtp,
915 if (atomic_read(&rt->rt6i_ref) != 1) BUG(); 916 if (atomic_read(&rt->rt6i_ref) != 1) BUG();
916 } 917 }
917 918
918 inet6_rt_notify(RTM_DELROUTE, rt, nlh); 919 inet6_rt_notify(RTM_DELROUTE, rt, nlh, req);
919 rt6_release(rt); 920 rt6_release(rt);
920} 921}
921 922
922int fib6_del(struct rt6_info *rt, struct nlmsghdr *nlh, void *_rtattr) 923int fib6_del(struct rt6_info *rt, struct nlmsghdr *nlh, void *_rtattr, struct netlink_skb_parms *req)
923{ 924{
924 struct fib6_node *fn = rt->rt6i_node; 925 struct fib6_node *fn = rt->rt6i_node;
925 struct rt6_info **rtp; 926 struct rt6_info **rtp;
@@ -944,7 +945,7 @@ int fib6_del(struct rt6_info *rt, struct nlmsghdr *nlh, void *_rtattr)
944 945
945 for (rtp = &fn->leaf; *rtp; rtp = &(*rtp)->u.next) { 946 for (rtp = &fn->leaf; *rtp; rtp = &(*rtp)->u.next) {
946 if (*rtp == rt) { 947 if (*rtp == rt) {
947 fib6_del_route(fn, rtp, nlh, _rtattr); 948 fib6_del_route(fn, rtp, nlh, _rtattr, req);
948 return 0; 949 return 0;
949 } 950 }
950 } 951 }
@@ -1073,7 +1074,7 @@ static int fib6_clean_node(struct fib6_walker_t *w)
1073 res = c->func(rt, c->arg); 1074 res = c->func(rt, c->arg);
1074 if (res < 0) { 1075 if (res < 0) {
1075 w->leaf = rt; 1076 w->leaf = rt;
1076 res = fib6_del(rt, NULL, NULL); 1077 res = fib6_del(rt, NULL, NULL, NULL);
1077 if (res) { 1078 if (res) {
1078#if RT6_DEBUG >= 2 1079#if RT6_DEBUG >= 2
1079 printk(KERN_DEBUG "fib6_clean_node: del failed: rt=%p@%p err=%d\n", rt, rt->rt6i_node, res); 1080 printk(KERN_DEBUG "fib6_clean_node: del failed: rt=%p@%p err=%d\n", rt, rt->rt6i_node, res);
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index b78a53586804..06e7cdaeedc5 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -484,9 +484,6 @@ static void ip6_copy_metadata(struct sk_buff *to, struct sk_buff *from)
484 to->nf_bridge = from->nf_bridge; 484 to->nf_bridge = from->nf_bridge;
485 nf_bridge_get(to->nf_bridge); 485 nf_bridge_get(to->nf_bridge);
486#endif 486#endif
487#ifdef CONFIG_NETFILTER_DEBUG
488 to->nf_debug = from->nf_debug;
489#endif
490#endif 487#endif
491} 488}
492 489
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index 279ab86be662..f3ef4c38d315 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -423,11 +423,12 @@ done:
423 psin6 = (struct sockaddr_in6 *)&greqs.gsr_group; 423 psin6 = (struct sockaddr_in6 *)&greqs.gsr_group;
424 retv = ipv6_sock_mc_join(sk, greqs.gsr_interface, 424 retv = ipv6_sock_mc_join(sk, greqs.gsr_interface,
425 &psin6->sin6_addr); 425 &psin6->sin6_addr);
426 if (retv) 426 /* prior join w/ different source is ok */
427 if (retv && retv != -EADDRINUSE)
427 break; 428 break;
428 omode = MCAST_INCLUDE; 429 omode = MCAST_INCLUDE;
429 add = 1; 430 add = 1;
430 } else /*IP_DROP_SOURCE_MEMBERSHIP */ { 431 } else /* MCAST_LEAVE_SOURCE_GROUP */ {
431 omode = MCAST_INCLUDE; 432 omode = MCAST_INCLUDE;
432 add = 0; 433 add = 0;
433 } 434 }
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index 393b6e6f50a9..562fcd14fdea 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -188,6 +188,16 @@ int ipv6_sock_mc_join(struct sock *sk, int ifindex, struct in6_addr *addr)
188 if (!ipv6_addr_is_multicast(addr)) 188 if (!ipv6_addr_is_multicast(addr))
189 return -EINVAL; 189 return -EINVAL;
190 190
191 read_lock_bh(&ipv6_sk_mc_lock);
192 for (mc_lst=np->ipv6_mc_list; mc_lst; mc_lst=mc_lst->next) {
193 if ((ifindex == 0 || mc_lst->ifindex == ifindex) &&
194 ipv6_addr_equal(&mc_lst->addr, addr)) {
195 read_unlock_bh(&ipv6_sk_mc_lock);
196 return -EADDRINUSE;
197 }
198 }
199 read_unlock_bh(&ipv6_sk_mc_lock);
200
191 mc_lst = sock_kmalloc(sk, sizeof(struct ipv6_mc_socklist), GFP_KERNEL); 201 mc_lst = sock_kmalloc(sk, sizeof(struct ipv6_mc_socklist), GFP_KERNEL);
192 202
193 if (mc_lst == NULL) 203 if (mc_lst == NULL)
@@ -349,6 +359,7 @@ int ip6_mc_source(int add, int omode, struct sock *sk,
349 struct ipv6_pinfo *inet6 = inet6_sk(sk); 359 struct ipv6_pinfo *inet6 = inet6_sk(sk);
350 struct ip6_sf_socklist *psl; 360 struct ip6_sf_socklist *psl;
351 int i, j, rv; 361 int i, j, rv;
362 int leavegroup = 0;
352 int err; 363 int err;
353 364
354 if (pgsr->gsr_group.ss_family != AF_INET6 || 365 if (pgsr->gsr_group.ss_family != AF_INET6 ||
@@ -368,6 +379,7 @@ int ip6_mc_source(int add, int omode, struct sock *sk,
368 379
369 err = -EADDRNOTAVAIL; 380 err = -EADDRNOTAVAIL;
370 381
382 read_lock_bh(&ipv6_sk_mc_lock);
371 for (pmc=inet6->ipv6_mc_list; pmc; pmc=pmc->next) { 383 for (pmc=inet6->ipv6_mc_list; pmc; pmc=pmc->next) {
372 if (pgsr->gsr_interface && pmc->ifindex != pgsr->gsr_interface) 384 if (pgsr->gsr_interface && pmc->ifindex != pgsr->gsr_interface)
373 continue; 385 continue;
@@ -401,6 +413,12 @@ int ip6_mc_source(int add, int omode, struct sock *sk,
401 if (rv) /* source not found */ 413 if (rv) /* source not found */
402 goto done; 414 goto done;
403 415
416 /* special case - (INCLUDE, empty) == LEAVE_GROUP */
417 if (psl->sl_count == 1 && omode == MCAST_INCLUDE) {
418 leavegroup = 1;
419 goto done;
420 }
421
404 /* update the interface filter */ 422 /* update the interface filter */
405 ip6_mc_del_src(idev, group, omode, 1, source, 1); 423 ip6_mc_del_src(idev, group, omode, 1, source, 1);
406 424
@@ -453,9 +471,12 @@ int ip6_mc_source(int add, int omode, struct sock *sk,
453 /* update the interface list */ 471 /* update the interface list */
454 ip6_mc_add_src(idev, group, omode, 1, source, 1); 472 ip6_mc_add_src(idev, group, omode, 1, source, 1);
455done: 473done:
474 read_unlock_bh(&ipv6_sk_mc_lock);
456 read_unlock_bh(&idev->lock); 475 read_unlock_bh(&idev->lock);
457 in6_dev_put(idev); 476 in6_dev_put(idev);
458 dev_put(dev); 477 dev_put(dev);
478 if (leavegroup)
479 return ipv6_sock_mc_drop(sk, pgsr->gsr_interface, group);
459 return err; 480 return err;
460} 481}
461 482
@@ -1280,15 +1301,6 @@ static struct sk_buff *mld_newpack(struct net_device *dev, int size)
1280 return NULL; 1301 return NULL;
1281 1302
1282 skb_reserve(skb, LL_RESERVED_SPACE(dev)); 1303 skb_reserve(skb, LL_RESERVED_SPACE(dev));
1283 if (dev->hard_header) {
1284 unsigned char ha[MAX_ADDR_LEN];
1285
1286 ndisc_mc_map(&mld2_all_mcr, ha, dev, 1);
1287 if (dev->hard_header(skb, dev, ETH_P_IPV6,ha,NULL,size) < 0) {
1288 kfree_skb(skb);
1289 return NULL;
1290 }
1291 }
1292 1304
1293 if (ipv6_get_lladdr(dev, &addr_buf)) { 1305 if (ipv6_get_lladdr(dev, &addr_buf)) {
1294 /* <draft-ietf-magma-mld-source-05.txt>: 1306 /* <draft-ietf-magma-mld-source-05.txt>:
@@ -1312,6 +1324,30 @@ static struct sk_buff *mld_newpack(struct net_device *dev, int size)
1312 return skb; 1324 return skb;
1313} 1325}
1314 1326
1327static inline int mld_dev_queue_xmit2(struct sk_buff *skb)
1328{
1329 struct net_device *dev = skb->dev;
1330
1331 if (dev->hard_header) {
1332 unsigned char ha[MAX_ADDR_LEN];
1333 int err;
1334
1335 ndisc_mc_map(&skb->nh.ipv6h->daddr, ha, dev, 1);
1336 err = dev->hard_header(skb, dev, ETH_P_IPV6, ha, NULL, skb->len);
1337 if (err < 0) {
1338 kfree_skb(skb);
1339 return err;
1340 }
1341 }
1342 return dev_queue_xmit(skb);
1343}
1344
1345static inline int mld_dev_queue_xmit(struct sk_buff *skb)
1346{
1347 return NF_HOOK(PF_INET6, NF_IP6_POST_ROUTING, skb, NULL, skb->dev,
1348 mld_dev_queue_xmit2);
1349}
1350
1315static void mld_sendpack(struct sk_buff *skb) 1351static void mld_sendpack(struct sk_buff *skb)
1316{ 1352{
1317 struct ipv6hdr *pip6 = skb->nh.ipv6h; 1353 struct ipv6hdr *pip6 = skb->nh.ipv6h;
@@ -1329,7 +1365,7 @@ static void mld_sendpack(struct sk_buff *skb)
1329 pmr->csum = csum_ipv6_magic(&pip6->saddr, &pip6->daddr, mldlen, 1365 pmr->csum = csum_ipv6_magic(&pip6->saddr, &pip6->daddr, mldlen,
1330 IPPROTO_ICMPV6, csum_partial(skb->h.raw, mldlen, 0)); 1366 IPPROTO_ICMPV6, csum_partial(skb->h.raw, mldlen, 0));
1331 err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, skb->dev, 1367 err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, skb->dev,
1332 dev_queue_xmit); 1368 mld_dev_queue_xmit);
1333 if (!err) { 1369 if (!err) {
1334 ICMP6_INC_STATS(idev,ICMP6_MIB_OUTMSGS); 1370 ICMP6_INC_STATS(idev,ICMP6_MIB_OUTMSGS);
1335 IP6_INC_STATS(IPSTATS_MIB_OUTMCASTPKTS); 1371 IP6_INC_STATS(IPSTATS_MIB_OUTMCASTPKTS);
@@ -1635,12 +1671,6 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type)
1635 } 1671 }
1636 1672
1637 skb_reserve(skb, LL_RESERVED_SPACE(dev)); 1673 skb_reserve(skb, LL_RESERVED_SPACE(dev));
1638 if (dev->hard_header) {
1639 unsigned char ha[MAX_ADDR_LEN];
1640 ndisc_mc_map(snd_addr, ha, dev, 1);
1641 if (dev->hard_header(skb, dev, ETH_P_IPV6, ha, NULL, full_len) < 0)
1642 goto out;
1643 }
1644 1674
1645 if (ipv6_get_lladdr(dev, &addr_buf)) { 1675 if (ipv6_get_lladdr(dev, &addr_buf)) {
1646 /* <draft-ietf-magma-mld-source-05.txt>: 1676 /* <draft-ietf-magma-mld-source-05.txt>:
@@ -1668,7 +1698,7 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type)
1668 idev = in6_dev_get(skb->dev); 1698 idev = in6_dev_get(skb->dev);
1669 1699
1670 err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, skb->dev, 1700 err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, skb->dev,
1671 dev_queue_xmit); 1701 mld_dev_queue_xmit);
1672 if (!err) { 1702 if (!err) {
1673 if (type == ICMPV6_MGM_REDUCTION) 1703 if (type == ICMPV6_MGM_REDUCTION)
1674 ICMP6_INC_STATS(idev, ICMP6_MIB_OUTGROUPMEMBREDUCTIONS); 1704 ICMP6_INC_STATS(idev, ICMP6_MIB_OUTGROUPMEMBREDUCTIONS);
@@ -1682,10 +1712,6 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type)
1682 if (likely(idev != NULL)) 1712 if (likely(idev != NULL))
1683 in6_dev_put(idev); 1713 in6_dev_put(idev);
1684 return; 1714 return;
1685
1686out:
1687 IP6_INC_STATS(IPSTATS_MIB_OUTDISCARDS);
1688 kfree_skb(skb);
1689} 1715}
1690 1716
1691static int ip6_mc_del1_src(struct ifmcaddr6 *pmc, int sfmode, 1717static int ip6_mc_del1_src(struct ifmcaddr6 *pmc, int sfmode,
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 7c291f4e9edc..7ae72d4c9bd2 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -955,7 +955,7 @@ static void ndisc_recv_na(struct sk_buff *skb)
955 struct rt6_info *rt; 955 struct rt6_info *rt;
956 rt = rt6_get_dflt_router(saddr, dev); 956 rt = rt6_get_dflt_router(saddr, dev);
957 if (rt) 957 if (rt)
958 ip6_del_rt(rt, NULL, NULL); 958 ip6_del_rt(rt, NULL, NULL, NULL);
959 } 959 }
960 960
961out: 961out:
@@ -1096,7 +1096,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
1096 1096
1097 if (rt && lifetime == 0) { 1097 if (rt && lifetime == 0) {
1098 neigh_clone(neigh); 1098 neigh_clone(neigh);
1099 ip6_del_rt(rt, NULL, NULL); 1099 ip6_del_rt(rt, NULL, NULL, NULL);
1100 rt = NULL; 1100 rt = NULL;
1101 } 1101 }
1102 1102
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c
index c735276fdd5f..73034511c8db 100644
--- a/net/ipv6/netfilter/ip6_tables.c
+++ b/net/ipv6/netfilter/ip6_tables.c
@@ -71,7 +71,6 @@ static DECLARE_MUTEX(ip6t_mutex);
71/* Must have mutex */ 71/* Must have mutex */
72#define ASSERT_READ_LOCK(x) IP_NF_ASSERT(down_trylock(&ip6t_mutex) != 0) 72#define ASSERT_READ_LOCK(x) IP_NF_ASSERT(down_trylock(&ip6t_mutex) != 0)
73#define ASSERT_WRITE_LOCK(x) IP_NF_ASSERT(down_trylock(&ip6t_mutex) != 0) 73#define ASSERT_WRITE_LOCK(x) IP_NF_ASSERT(down_trylock(&ip6t_mutex) != 0)
74#include <linux/netfilter_ipv4/lockhelp.h>
75#include <linux/netfilter_ipv4/listhelp.h> 74#include <linux/netfilter_ipv4/listhelp.h>
76 75
77#if 0 76#if 0
diff --git a/net/ipv6/netfilter/ip6t_LOG.c b/net/ipv6/netfilter/ip6t_LOG.c
index bfc3d0185d19..c44685e391b7 100644
--- a/net/ipv6/netfilter/ip6t_LOG.c
+++ b/net/ipv6/netfilter/ip6t_LOG.c
@@ -366,8 +366,6 @@ ip6t_log_packet(unsigned int hooknum,
366 const char *level_string, 366 const char *level_string,
367 const char *prefix) 367 const char *prefix)
368{ 368{
369 struct ipv6hdr *ipv6h = skb->nh.ipv6h;
370
371 spin_lock_bh(&log_lock); 369 spin_lock_bh(&log_lock);
372 printk(level_string); 370 printk(level_string);
373 printk("%sIN=%s OUT=%s ", 371 printk("%sIN=%s OUT=%s ",
@@ -377,39 +375,25 @@ ip6t_log_packet(unsigned int hooknum,
377 if (in && !out) { 375 if (in && !out) {
378 /* MAC logging for input chain only. */ 376 /* MAC logging for input chain only. */
379 printk("MAC="); 377 printk("MAC=");
380 if (skb->dev && skb->dev->hard_header_len && skb->mac.raw != (void*)ipv6h) { 378 if (skb->dev && skb->dev->hard_header_len &&
381 if (skb->dev->type != ARPHRD_SIT){ 379 skb->mac.raw != skb->nh.raw) {
382 int i; 380 unsigned char *p = skb->mac.raw;
383 unsigned char *p = skb->mac.raw; 381 int i;
384 for (i = 0; i < skb->dev->hard_header_len; i++,p++) 382
385 printk("%02x%c", *p, 383 if (skb->dev->type == ARPHRD_SIT &&
386 i==skb->dev->hard_header_len - 1 384 (p -= ETH_HLEN) < skb->head)
387 ? ' ':':'); 385 p = NULL;
388 } else { 386
389 int i; 387 if (p != NULL)
390 unsigned char *p = skb->mac.raw; 388 for (i = 0; i < skb->dev->hard_header_len; i++)
391 if ( p - (ETH_ALEN*2+2) > skb->head ){ 389 printk("%02x", p[i]);
392 p -= (ETH_ALEN+2); 390 printk(" ");
393 for (i = 0; i < (ETH_ALEN); i++,p++) 391
394 printk("%02x%s", *p, 392 if (skb->dev->type == ARPHRD_SIT) {
395 i == ETH_ALEN-1 ? "->" : ":"); 393 struct iphdr *iph = (struct iphdr *)skb->mac.raw;
396 p -= (ETH_ALEN*2); 394 printk("TUNNEL=%u.%u.%u.%u->%u.%u.%u.%u ",
397 for (i = 0; i < (ETH_ALEN); i++,p++) 395 NIPQUAD(iph->saddr),
398 printk("%02x%c", *p, 396 NIPQUAD(iph->daddr));
399 i == ETH_ALEN-1 ? ' ' : ':');
400 }
401
402 if ((skb->dev->addr_len == 4) &&
403 skb->dev->hard_header_len > 20){
404 printk("TUNNEL=");
405 p = skb->mac.raw + 12;
406 for (i = 0; i < 4; i++,p++)
407 printk("%3d%s", *p,
408 i == 3 ? "->" : ".");
409 for (i = 0; i < 4; i++,p++)
410 printk("%3d%c", *p,
411 i == 3 ? ' ' : '.');
412 }
413 } 397 }
414 } else 398 } else
415 printk(" "); 399 printk(" ");
diff --git a/net/ipv6/netfilter/ip6table_raw.c b/net/ipv6/netfilter/ip6table_raw.c
index 71407beaf790..c2982efd14af 100644
--- a/net/ipv6/netfilter/ip6table_raw.c
+++ b/net/ipv6/netfilter/ip6table_raw.c
@@ -129,13 +129,15 @@ static struct nf_hook_ops ip6t_ops[] = {
129 .hook = ip6t_hook, 129 .hook = ip6t_hook,
130 .pf = PF_INET6, 130 .pf = PF_INET6,
131 .hooknum = NF_IP6_PRE_ROUTING, 131 .hooknum = NF_IP6_PRE_ROUTING,
132 .priority = NF_IP6_PRI_FIRST 132 .priority = NF_IP6_PRI_FIRST,
133 .owner = THIS_MODULE,
133 }, 134 },
134 { 135 {
135 .hook = ip6t_hook, 136 .hook = ip6t_hook,
136 .pf = PF_INET6, 137 .pf = PF_INET6,
137 .hooknum = NF_IP6_LOCAL_OUT, 138 .hooknum = NF_IP6_LOCAL_OUT,
138 .priority = NF_IP6_PRI_FIRST 139 .priority = NF_IP6_PRI_FIRST,
140 .owner = THIS_MODULE,
139 }, 141 },
140}; 142};
141 143
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 1f5b226c3573..878789b3122d 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -384,12 +384,13 @@ struct rt6_info *rt6_lookup(struct in6_addr *daddr, struct in6_addr *saddr,
384 be destroyed. 384 be destroyed.
385 */ 385 */
386 386
387int ip6_ins_rt(struct rt6_info *rt, struct nlmsghdr *nlh, void *_rtattr) 387int ip6_ins_rt(struct rt6_info *rt, struct nlmsghdr *nlh,
388 void *_rtattr, struct netlink_skb_parms *req)
388{ 389{
389 int err; 390 int err;
390 391
391 write_lock_bh(&rt6_lock); 392 write_lock_bh(&rt6_lock);
392 err = fib6_add(&ip6_routing_table, rt, nlh, _rtattr); 393 err = fib6_add(&ip6_routing_table, rt, nlh, _rtattr, req);
393 write_unlock_bh(&rt6_lock); 394 write_unlock_bh(&rt6_lock);
394 395
395 return err; 396 return err;
@@ -400,7 +401,7 @@ int ip6_ins_rt(struct rt6_info *rt, struct nlmsghdr *nlh, void *_rtattr)
400 */ 401 */
401 402
402static struct rt6_info *rt6_cow(struct rt6_info *ort, struct in6_addr *daddr, 403static struct rt6_info *rt6_cow(struct rt6_info *ort, struct in6_addr *daddr,
403 struct in6_addr *saddr) 404 struct in6_addr *saddr, struct netlink_skb_parms *req)
404{ 405{
405 int err; 406 int err;
406 struct rt6_info *rt; 407 struct rt6_info *rt;
@@ -432,7 +433,7 @@ static struct rt6_info *rt6_cow(struct rt6_info *ort, struct in6_addr *daddr,
432 433
433 dst_hold(&rt->u.dst); 434 dst_hold(&rt->u.dst);
434 435
435 err = ip6_ins_rt(rt, NULL, NULL); 436 err = ip6_ins_rt(rt, NULL, NULL, req);
436 if (err == 0) 437 if (err == 0)
437 return rt; 438 return rt;
438 439
@@ -491,7 +492,8 @@ restart:
491 read_unlock_bh(&rt6_lock); 492 read_unlock_bh(&rt6_lock);
492 493
493 nrt = rt6_cow(rt, &skb->nh.ipv6h->daddr, 494 nrt = rt6_cow(rt, &skb->nh.ipv6h->daddr,
494 &skb->nh.ipv6h->saddr); 495 &skb->nh.ipv6h->saddr,
496 &NETLINK_CB(skb));
495 497
496 dst_release(&rt->u.dst); 498 dst_release(&rt->u.dst);
497 rt = nrt; 499 rt = nrt;
@@ -551,7 +553,7 @@ restart:
551 dst_hold(&rt->u.dst); 553 dst_hold(&rt->u.dst);
552 read_unlock_bh(&rt6_lock); 554 read_unlock_bh(&rt6_lock);
553 555
554 nrt = rt6_cow(rt, &fl->fl6_dst, &fl->fl6_src); 556 nrt = rt6_cow(rt, &fl->fl6_dst, &fl->fl6_src, NULL);
555 557
556 dst_release(&rt->u.dst); 558 dst_release(&rt->u.dst);
557 rt = nrt; 559 rt = nrt;
@@ -598,7 +600,7 @@ static struct dst_entry *ip6_negative_advice(struct dst_entry *dst)
598 600
599 if (rt) { 601 if (rt) {
600 if (rt->rt6i_flags & RTF_CACHE) 602 if (rt->rt6i_flags & RTF_CACHE)
601 ip6_del_rt(rt, NULL, NULL); 603 ip6_del_rt(rt, NULL, NULL, NULL);
602 else 604 else
603 dst_release(dst); 605 dst_release(dst);
604 } 606 }
@@ -787,7 +789,8 @@ int ipv6_get_hoplimit(struct net_device *dev)
787 * 789 *
788 */ 790 */
789 791
790int ip6_route_add(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh, void *_rtattr) 792int ip6_route_add(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh,
793 void *_rtattr, struct netlink_skb_parms *req)
791{ 794{
792 int err; 795 int err;
793 struct rtmsg *r; 796 struct rtmsg *r;
@@ -974,7 +977,7 @@ install_route:
974 rt->u.dst.metrics[RTAX_ADVMSS-1] = ipv6_advmss(dst_mtu(&rt->u.dst)); 977 rt->u.dst.metrics[RTAX_ADVMSS-1] = ipv6_advmss(dst_mtu(&rt->u.dst));
975 rt->u.dst.dev = dev; 978 rt->u.dst.dev = dev;
976 rt->rt6i_idev = idev; 979 rt->rt6i_idev = idev;
977 return ip6_ins_rt(rt, nlh, _rtattr); 980 return ip6_ins_rt(rt, nlh, _rtattr, req);
978 981
979out: 982out:
980 if (dev) 983 if (dev)
@@ -986,7 +989,7 @@ out:
986 return err; 989 return err;
987} 990}
988 991
989int ip6_del_rt(struct rt6_info *rt, struct nlmsghdr *nlh, void *_rtattr) 992int ip6_del_rt(struct rt6_info *rt, struct nlmsghdr *nlh, void *_rtattr, struct netlink_skb_parms *req)
990{ 993{
991 int err; 994 int err;
992 995
@@ -994,7 +997,7 @@ int ip6_del_rt(struct rt6_info *rt, struct nlmsghdr *nlh, void *_rtattr)
994 997
995 rt6_reset_dflt_pointer(NULL); 998 rt6_reset_dflt_pointer(NULL);
996 999
997 err = fib6_del(rt, nlh, _rtattr); 1000 err = fib6_del(rt, nlh, _rtattr, req);
998 dst_release(&rt->u.dst); 1001 dst_release(&rt->u.dst);
999 1002
1000 write_unlock_bh(&rt6_lock); 1003 write_unlock_bh(&rt6_lock);
@@ -1002,7 +1005,7 @@ int ip6_del_rt(struct rt6_info *rt, struct nlmsghdr *nlh, void *_rtattr)
1002 return err; 1005 return err;
1003} 1006}
1004 1007
1005static int ip6_route_del(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh, void *_rtattr) 1008static int ip6_route_del(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh, void *_rtattr, struct netlink_skb_parms *req)
1006{ 1009{
1007 struct fib6_node *fn; 1010 struct fib6_node *fn;
1008 struct rt6_info *rt; 1011 struct rt6_info *rt;
@@ -1029,7 +1032,7 @@ static int ip6_route_del(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh, void *_r
1029 dst_hold(&rt->u.dst); 1032 dst_hold(&rt->u.dst);
1030 read_unlock_bh(&rt6_lock); 1033 read_unlock_bh(&rt6_lock);
1031 1034
1032 return ip6_del_rt(rt, nlh, _rtattr); 1035 return ip6_del_rt(rt, nlh, _rtattr, req);
1033 } 1036 }
1034 } 1037 }
1035 read_unlock_bh(&rt6_lock); 1038 read_unlock_bh(&rt6_lock);
@@ -1136,11 +1139,11 @@ source_ok:
1136 nrt->u.dst.metrics[RTAX_MTU-1] = ipv6_get_mtu(neigh->dev); 1139 nrt->u.dst.metrics[RTAX_MTU-1] = ipv6_get_mtu(neigh->dev);
1137 nrt->u.dst.metrics[RTAX_ADVMSS-1] = ipv6_advmss(dst_mtu(&nrt->u.dst)); 1140 nrt->u.dst.metrics[RTAX_ADVMSS-1] = ipv6_advmss(dst_mtu(&nrt->u.dst));
1138 1141
1139 if (ip6_ins_rt(nrt, NULL, NULL)) 1142 if (ip6_ins_rt(nrt, NULL, NULL, NULL))
1140 goto out; 1143 goto out;
1141 1144
1142 if (rt->rt6i_flags&RTF_CACHE) { 1145 if (rt->rt6i_flags&RTF_CACHE) {
1143 ip6_del_rt(rt, NULL, NULL); 1146 ip6_del_rt(rt, NULL, NULL, NULL);
1144 return; 1147 return;
1145 } 1148 }
1146 1149
@@ -1204,7 +1207,7 @@ void rt6_pmtu_discovery(struct in6_addr *daddr, struct in6_addr *saddr,
1204 2. It is gatewayed route or NONEXTHOP route. Action: clone it. 1207 2. It is gatewayed route or NONEXTHOP route. Action: clone it.
1205 */ 1208 */
1206 if (!rt->rt6i_nexthop && !(rt->rt6i_flags & RTF_NONEXTHOP)) { 1209 if (!rt->rt6i_nexthop && !(rt->rt6i_flags & RTF_NONEXTHOP)) {
1207 nrt = rt6_cow(rt, daddr, saddr); 1210 nrt = rt6_cow(rt, daddr, saddr, NULL);
1208 if (!nrt->u.dst.error) { 1211 if (!nrt->u.dst.error) {
1209 nrt->u.dst.metrics[RTAX_MTU-1] = pmtu; 1212 nrt->u.dst.metrics[RTAX_MTU-1] = pmtu;
1210 if (allfrag) 1213 if (allfrag)
@@ -1232,7 +1235,7 @@ void rt6_pmtu_discovery(struct in6_addr *daddr, struct in6_addr *saddr,
1232 nrt->u.dst.metrics[RTAX_MTU-1] = pmtu; 1235 nrt->u.dst.metrics[RTAX_MTU-1] = pmtu;
1233 if (allfrag) 1236 if (allfrag)
1234 nrt->u.dst.metrics[RTAX_FEATURES-1] |= RTAX_FEATURE_ALLFRAG; 1237 nrt->u.dst.metrics[RTAX_FEATURES-1] |= RTAX_FEATURE_ALLFRAG;
1235 ip6_ins_rt(nrt, NULL, NULL); 1238 ip6_ins_rt(nrt, NULL, NULL, NULL);
1236 } 1239 }
1237 1240
1238out: 1241out:
@@ -1305,7 +1308,7 @@ struct rt6_info *rt6_add_dflt_router(struct in6_addr *gwaddr,
1305 1308
1306 rtmsg.rtmsg_ifindex = dev->ifindex; 1309 rtmsg.rtmsg_ifindex = dev->ifindex;
1307 1310
1308 ip6_route_add(&rtmsg, NULL, NULL); 1311 ip6_route_add(&rtmsg, NULL, NULL, NULL);
1309 return rt6_get_dflt_router(gwaddr, dev); 1312 return rt6_get_dflt_router(gwaddr, dev);
1310} 1313}
1311 1314
@@ -1323,7 +1326,7 @@ restart:
1323 1326
1324 read_unlock_bh(&rt6_lock); 1327 read_unlock_bh(&rt6_lock);
1325 1328
1326 ip6_del_rt(rt, NULL, NULL); 1329 ip6_del_rt(rt, NULL, NULL, NULL);
1327 1330
1328 goto restart; 1331 goto restart;
1329 } 1332 }
@@ -1349,10 +1352,10 @@ int ipv6_route_ioctl(unsigned int cmd, void __user *arg)
1349 rtnl_lock(); 1352 rtnl_lock();
1350 switch (cmd) { 1353 switch (cmd) {
1351 case SIOCADDRT: 1354 case SIOCADDRT:
1352 err = ip6_route_add(&rtmsg, NULL, NULL); 1355 err = ip6_route_add(&rtmsg, NULL, NULL, NULL);
1353 break; 1356 break;
1354 case SIOCDELRT: 1357 case SIOCDELRT:
1355 err = ip6_route_del(&rtmsg, NULL, NULL); 1358 err = ip6_route_del(&rtmsg, NULL, NULL, NULL);
1356 break; 1359 break;
1357 default: 1360 default:
1358 err = -EINVAL; 1361 err = -EINVAL;
@@ -1546,7 +1549,7 @@ int inet6_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
1546 1549
1547 if (inet6_rtm_to_rtmsg(r, arg, &rtmsg)) 1550 if (inet6_rtm_to_rtmsg(r, arg, &rtmsg))
1548 return -EINVAL; 1551 return -EINVAL;
1549 return ip6_route_del(&rtmsg, nlh, arg); 1552 return ip6_route_del(&rtmsg, nlh, arg, &NETLINK_CB(skb));
1550} 1553}
1551 1554
1552int inet6_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) 1555int inet6_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
@@ -1556,7 +1559,7 @@ int inet6_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
1556 1559
1557 if (inet6_rtm_to_rtmsg(r, arg, &rtmsg)) 1560 if (inet6_rtm_to_rtmsg(r, arg, &rtmsg))
1558 return -EINVAL; 1561 return -EINVAL;
1559 return ip6_route_add(&rtmsg, nlh, arg); 1562 return ip6_route_add(&rtmsg, nlh, arg, &NETLINK_CB(skb));
1560} 1563}
1561 1564
1562struct rt6_rtnl_dump_arg 1565struct rt6_rtnl_dump_arg
@@ -1566,12 +1569,9 @@ struct rt6_rtnl_dump_arg
1566}; 1569};
1567 1570
1568static int rt6_fill_node(struct sk_buff *skb, struct rt6_info *rt, 1571static int rt6_fill_node(struct sk_buff *skb, struct rt6_info *rt,
1569 struct in6_addr *dst, 1572 struct in6_addr *dst, struct in6_addr *src,
1570 struct in6_addr *src, 1573 int iif, int type, u32 pid, u32 seq,
1571 int iif, 1574 int prefix, unsigned int flags)
1572 int type, u32 pid, u32 seq,
1573 struct nlmsghdr *in_nlh, int prefix,
1574 unsigned int flags)
1575{ 1575{
1576 struct rtmsg *rtm; 1576 struct rtmsg *rtm;
1577 struct nlmsghdr *nlh; 1577 struct nlmsghdr *nlh;
@@ -1585,10 +1585,6 @@ static int rt6_fill_node(struct sk_buff *skb, struct rt6_info *rt,
1585 } 1585 }
1586 } 1586 }
1587 1587
1588 if (!pid && in_nlh) {
1589 pid = in_nlh->nlmsg_pid;
1590 }
1591
1592 nlh = NLMSG_NEW(skb, pid, seq, type, sizeof(*rtm), flags); 1588 nlh = NLMSG_NEW(skb, pid, seq, type, sizeof(*rtm), flags);
1593 rtm = NLMSG_DATA(nlh); 1589 rtm = NLMSG_DATA(nlh);
1594 rtm->rtm_family = AF_INET6; 1590 rtm->rtm_family = AF_INET6;
@@ -1675,7 +1671,7 @@ static int rt6_dump_route(struct rt6_info *rt, void *p_arg)
1675 1671
1676 return rt6_fill_node(arg->skb, rt, NULL, NULL, 0, RTM_NEWROUTE, 1672 return rt6_fill_node(arg->skb, rt, NULL, NULL, 0, RTM_NEWROUTE,
1677 NETLINK_CB(arg->cb->skb).pid, arg->cb->nlh->nlmsg_seq, 1673 NETLINK_CB(arg->cb->skb).pid, arg->cb->nlh->nlmsg_seq,
1678 NULL, prefix, NLM_F_MULTI); 1674 prefix, NLM_F_MULTI);
1679} 1675}
1680 1676
1681static int fib6_dump_node(struct fib6_walker_t *w) 1677static int fib6_dump_node(struct fib6_walker_t *w)
@@ -1823,7 +1819,7 @@ int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg)
1823 &fl.fl6_dst, &fl.fl6_src, 1819 &fl.fl6_dst, &fl.fl6_src,
1824 iif, 1820 iif,
1825 RTM_NEWROUTE, NETLINK_CB(in_skb).pid, 1821 RTM_NEWROUTE, NETLINK_CB(in_skb).pid,
1826 nlh->nlmsg_seq, nlh, 0, 0); 1822 nlh->nlmsg_seq, 0, 0);
1827 if (err < 0) { 1823 if (err < 0) {
1828 err = -EMSGSIZE; 1824 err = -EMSGSIZE;
1829 goto out_free; 1825 goto out_free;
@@ -1839,17 +1835,25 @@ out_free:
1839 goto out; 1835 goto out;
1840} 1836}
1841 1837
1842void inet6_rt_notify(int event, struct rt6_info *rt, struct nlmsghdr *nlh) 1838void inet6_rt_notify(int event, struct rt6_info *rt, struct nlmsghdr *nlh,
1839 struct netlink_skb_parms *req)
1843{ 1840{
1844 struct sk_buff *skb; 1841 struct sk_buff *skb;
1845 int size = NLMSG_SPACE(sizeof(struct rtmsg)+256); 1842 int size = NLMSG_SPACE(sizeof(struct rtmsg)+256);
1843 u32 pid = current->pid;
1844 u32 seq = 0;
1846 1845
1846 if (req)
1847 pid = req->pid;
1848 if (nlh)
1849 seq = nlh->nlmsg_seq;
1850
1847 skb = alloc_skb(size, gfp_any()); 1851 skb = alloc_skb(size, gfp_any());
1848 if (!skb) { 1852 if (!skb) {
1849 netlink_set_err(rtnl, 0, RTMGRP_IPV6_ROUTE, ENOBUFS); 1853 netlink_set_err(rtnl, 0, RTMGRP_IPV6_ROUTE, ENOBUFS);
1850 return; 1854 return;
1851 } 1855 }
1852 if (rt6_fill_node(skb, rt, NULL, NULL, 0, event, 0, 0, nlh, 0, 0) < 0) { 1856 if (rt6_fill_node(skb, rt, NULL, NULL, 0, event, pid, seq, 0, 0) < 0) {
1853 kfree_skb(skb); 1857 kfree_skb(skb);
1854 netlink_set_err(rtnl, 0, RTMGRP_IPV6_ROUTE, EINVAL); 1858 netlink_set_err(rtnl, 0, RTMGRP_IPV6_ROUTE, EINVAL);
1855 return; 1859 return;
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index db845cbd5841..87302a49067b 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -1945,6 +1945,7 @@ static int selinux_sb_copy_data(struct file_system_type *type, void *orig, void
1945 } while (*in_end++); 1945 } while (*in_end++);
1946 1946
1947 copy_page(in_save, nosec_save); 1947 copy_page(in_save, nosec_save);
1948 free_page((unsigned long)nosec_save);
1948out: 1949out:
1949 return rc; 1950 return rc;
1950} 1951}
diff --git a/sound/oss/rme96xx.c b/sound/oss/rme96xx.c
index 76774bbc1436..b4278eecc917 100644
--- a/sound/oss/rme96xx.c
+++ b/sound/oss/rme96xx.c
@@ -807,7 +807,7 @@ static void* busmaster_malloc(int size) {
807 struct page* page, *last_page; 807 struct page* page, *last_page;
808 808
809 page = virt_to_page(buf); 809 page = virt_to_page(buf);
810 last_page = virt_to_page(buf + (1 << pg)); 810 last_page = page + (1 << pg);
811 DBG(printk("setting reserved bit\n")); 811 DBG(printk("setting reserved bit\n"));
812 while (page < last_page) { 812 while (page < last_page) {
813 SetPageReserved(page); 813 SetPageReserved(page);