lines    added  deleted
linux/CREDITS                                  :      51       19        5
linux/Documentation/Configure.help             :      55        2       40
linux/Documentation/filesystems/ufs.txt        :      10        4        0
linux/Documentation/powerpc/sound.txt          :      26        7        2
linux/MAINTAINERS                              :      24        8        2
linux/Makefile                                 :      38        9        3
linux/arch/alpha/boot/bootp.c                  :      15        4        4
linux/arch/alpha/boot/main.c                   :       8        1        1
linux/arch/alpha/config.in                     :       9        0        3
linux/arch/alpha/kernel/osf_sys.c              :      15        2        0
linux/arch/alpha/kernel/setup.c                :       8        1        1
linux/arch/alpha/mm/init.c                     :      25        2        3
linux/arch/arm/defconfig                       :       8        1        1
linux/arch/arm/kernel/dec21285.c               :       7        1        0
linux/arch/arm/kernel/entry-common.S           :       4        1        0
linux/arch/arm/kernel/sys_arm.c                :      15        2        0
linux/arch/arm/mm/init.c                       :      16        1        2
linux/arch/i386/config.in                      :       9        0        3
linux/arch/i386/defconfig                      :      18        1       11
linux/arch/i386/kernel/i386_ksyms.c            :       7        1        0
linux/arch/i386/kernel/mca.c                   :      11        2        1
linux/arch/i386/kernel/mtrr.c                  :      16        5        2
linux/arch/i386/mm/init.c                      :      16        1        2
linux/arch/m68k/mm/init.c                      :      16        1        2
linux/arch/mips/Makefile                       :      85       40        8
linux/arch/mips/algor/README                   :       5        5        0
linux/arch/mips/arc/Makefile                   :      23       23        0
linux/arch/mips/arc/cmdline.c                  :      64       64        0
linux/arch/mips/arc/console.c                  :      50       50        0
linux/arch/mips/arc/env.c                      :      22       22        0
linux/arch/mips/arc/file.c                     :      59       59        0
linux/arch/mips/arc/identify.c                 :      68       68        0
linux/arch/mips/arc/init.c                     :      67       67        0
linux/arch/mips/arc/memory.c                   :     208      208        0
linux/arch/mips/arc/misc.c                     :      84       84        0
linux/arch/mips/arc/printf.c                   :      40       40        0
linux/arch/mips/arc/salone.c                   :      25       25        0
linux/arch/mips/arc/time.c                     :      19       19        0
linux/arch/mips/arc/tree.c                     :     109      109        0
linux/arch/mips/baget/Makefile                 :      75       75        0
linux/arch/mips/baget/baget.c                  :     104      104        0
linux/arch/mips/baget/bagetIRQ.S               :      98       98        0
linux/arch/mips/baget/balo.c                   :     190      190        0
linux/arch/mips/baget/balo_supp.S              :     143      143        0
linux/arch/mips/baget/irq.c                    :     438      438        0
linux/arch/mips/baget/ld.script.balo           :     124      124        0
linux/arch/mips/baget/print.c                  :     118      118        0
linux/arch/mips/baget/prom/Makefile            :      15       15        0
linux/arch/mips/baget/prom/init.c              :      20       20        0
linux/arch/mips/baget/reset.c                  :      32       32        0
linux/arch/mips/baget/setup.c                  :     494      494        0
linux/arch/mips/baget/time.c                   :      96       96        0
linux/arch/mips/baget/vacserial.c              :    2943     2943        0
linux/arch/mips/baget/wbflush.c                :      24       24        0
linux/arch/mips/boot/Makefile                  :      66       19       18
linux/arch/mips/boot/addinitrd.c               :     112      112        0
linux/arch/mips/boot/ecoff.h                   :      62       62        0
linux/arch/mips/boot/elf2ecoff.c               :     637      637        0
linux/arch/mips/config.in                      :     281      129       40
linux/arch/mips/dec/Makefile                   :      30       30        0
linux/arch/mips/dec/boot/Makefile              :      26       26        0
linux/arch/mips/dec/boot/decstation.c          :      91       91        0
linux/arch/mips/dec/boot/ld.ecoff              :      43       43        0
linux/arch/mips/dec/int-handler.S              :     362      362        0
linux/arch/mips/dec/irq.c                      :     269      269        0
linux/arch/mips/dec/prom/Makefile              :      29       29        0
linux/arch/mips/dec/prom/cmdline.c             :      46       46        0
linux/arch/mips/dec/prom/dectypes.h            :      14       14        0
linux/arch/mips/dec/prom/identify.c            :      98       98        0
linux/arch/mips/dec/prom/init.c                :      95       95        0
linux/arch/mips/dec/prom/locore.S              :      30       30        0
linux/arch/mips/dec/prom/memory.c              :     103      103        0
linux/arch/mips/dec/prom/prom.h                :      51       51        0
linux/arch/mips/dec/promcon.c                  :      71       71        0
linux/arch/mips/dec/reset.c                    :      25       25        0
linux/arch/mips/dec/rtc-dec.c                  :      36       36        0
linux/arch/mips/dec/serial.c                   :      98       98        0
linux/arch/mips/dec/setup.c                    :     503      503        0
linux/arch/mips/dec/time.c                     :     439      439        0
linux/arch/mips/dec/wbflush.c                  :     104      104        0
linux/arch/mips/defconfig                      :     373      128       77
linux/arch/mips/jazz/Makefile                  :      14        3        1
linux/arch/mips/jazz/floppy-jazz.c             :      39        5        5
linux/arch/mips/jazz/hw-access.c               :      90        0       90
linux/arch/mips/jazz/int-handler.S             :     102        7       50
linux/arch/mips/jazz/jazzdma.c                 :      35        6        1
linux/arch/mips/jazz/kbd-jazz.c                :     102      102        0
linux/arch/mips/jazz/reset.c                   :       8        1        1
linux/arch/mips/jazz/rtc-jazz.c                :       5        1        1
linux/arch/mips/jazz/setup.c                   :      95        9       33
linux/arch/mips/kernel/Makefile                :      16        6        2
linux/arch/mips/kernel/entry.S                 :      17        2        2
linux/arch/mips/kernel/fpe.c                   :      17        2        2
linux/arch/mips/kernel/gdb-low.S               :       8        1        1
linux/arch/mips/kernel/gdb-stub.c              :      35        3        5
linux/arch/mips/kernel/head.S                  :     283        4      231
linux/arch/mips/kernel/init_task.c             :      16        4        2
linux/arch/mips/kernel/irix5sys.h              :       5        1        1
linux/arch/mips/kernel/irixelf.c               :     358       80       77
linux/arch/mips/kernel/irixinv.c               :       8        1        1
linux/arch/mips/kernel/irixioctl.c             :      31        4        5
linux/arch/mips/kernel/irixsig.c               :      17        2        2
linux/arch/mips/kernel/irq.c                   :     306      124       64
linux/arch/mips/kernel/mips_ksyms.c            :      74       19       12
linux/arch/mips/kernel/pci.c                   :      33        3        8
linux/arch/mips/kernel/process.c               :      47       38        1
linux/arch/mips/kernel/ptrace.c                :     221       73       69
linux/arch/mips/kernel/r2300_fpu.S             :     223       83      104
linux/arch/mips/kernel/r2300_misc.S            :     536      141      343
linux/arch/mips/kernel/r2300_switch.S          :     223      135       62
linux/arch/mips/kernel/r4k_fpu.S               :      22        3        3
linux/arch/mips/kernel/r4k_misc.S              :       8        1        1
linux/arch/mips/kernel/r4k_switch.S            :      71       21       10
linux/arch/mips/kernel/r6000_fpu.S             :      30        4        3
linux/arch/mips/kernel/scall_o32.S             :      13        2        1
linux/arch/mips/kernel/setup.c                 :     190       35       50
linux/arch/mips/kernel/signal.c                :      37        5        1
linux/arch/mips/kernel/softfp.S                :       5        1        1
linux/arch/mips/kernel/syscall.c               :      78        8       13
linux/arch/mips/kernel/syscalls.h              :       5        1        1
linux/arch/mips/kernel/sysirix.c               :     148       20       31
linux/arch/mips/kernel/sysmips.c               :       8        1        1
linux/arch/mips/kernel/time.c                  :     105       45       16
linux/arch/mips/kernel/traps.c                 :      44        5        6
linux/arch/mips/kernel/unaligned.c             :      26        3        3
linux/arch/mips/lib/Makefile                   :      15        3        3
linux/arch/mips/lib/csum_partial.S             :       5        1        1
linux/arch/mips/lib/csum_partial_copy.c        :       8        1        1
linux/arch/mips/lib/floppy-std.c               :      13        1        2
linux/arch/mips/lib/ide-no.c                   :      44        8       10
linux/arch/mips/lib/ide-std.c                  :      36        7        8
linux/arch/mips/lib/kbd-no.c                   :      63       63        0
linux/arch/mips/lib/kbd-std.c                  :      81       81        0
linux/arch/mips/lib/memcpy.S                   :       8        1        1
linux/arch/mips/lib/memset.S                   :       8        1        1
linux/arch/mips/lib/strlen_user.S              :       8        1        1
linux/arch/mips/lib/strncpy_user.S             :       8        1        1
linux/arch/mips/lib/tags.c                     :      75        0       75
linux/arch/mips/lib/watch.S                    :       7        1        1
linux/arch/mips/mm/Makefile                    :       8        4        0
linux/arch/mips/mm/andes.c                     :       5        1        1
linux/arch/mips/mm/fault.c                     :       5        1        1
linux/arch/mips/mm/init.c                      :     201       12       96
linux/arch/mips/mm/loadmmu.c                   :      33        4        2
linux/arch/mips/mm/r2300.c                     :     626      467       34
linux/arch/mips/mm/r4xx0.c                     :      34        9        1
linux/arch/mips/mm/r6000.c                     :       5        1        1
linux/arch/mips/mm/tfp.c                       :       5        1        1
linux/arch/mips/sgi/kernel/Makefile            :      19        6        3
linux/arch/mips/sgi/kernel/indyIRQ.S           :       5        1        1
linux/arch/mips/sgi/kernel/indy_hpc.c          :      15        3        2
linux/arch/mips/sgi/kernel/indy_int.c          :     182       49       45
linux/arch/mips/sgi/kernel/indy_mc.c           :      19        4        1
linux/arch/mips/sgi/kernel/indy_sc.c           :      52       11        7
linux/arch/mips/sgi/kernel/indy_timer.c        :      20        3        3
linux/arch/mips/sgi/kernel/promcon.c           :      73       73        0
linux/arch/mips/sgi/kernel/reset.c             :      94       56       10
linux/arch/mips/sgi/kernel/setup.c             :     196      106       30
linux/arch/mips/sgi/kernel/system.c            :      76        2       41
linux/arch/mips/sgi/kernel/time.c              :       5        1        1
linux/arch/mips/sgi/prom/Makefile              :      23        0       23
linux/arch/mips/sgi/prom/cmdline.c             :      64        0       64
linux/arch/mips/sgi/prom/console.c             :      26        0       26
linux/arch/mips/sgi/prom/env.c                 :      22        0       22
linux/arch/mips/sgi/prom/file.c                :      59        0       59
linux/arch/mips/sgi/prom/init.c                :      61        0       61
linux/arch/mips/sgi/prom/memory.c              :     131        0      131
linux/arch/mips/sgi/prom/misc.c                :      84        0       84
linux/arch/mips/sgi/prom/printf.c              :      35        0       35
linux/arch/mips/sgi/prom/salone.c              :      25        0       25
linux/arch/mips/sgi/prom/tags.c                :      69        0       69
linux/arch/mips/sgi/prom/time.c                :      19        0       19
linux/arch/mips/sgi/prom/tree.c                :     109        0      109
linux/arch/mips/sni/Makefile                   :      22        2        3
linux/arch/mips/sni/hw-access.c                :      70        0       70
linux/arch/mips/sni/int-handler.S              :     268       69      145
linux/arch/mips/sni/io.c                       :     229       56       50
linux/arch/mips/sni/pci.c                      :      58       33        8
linux/arch/mips/sni/pcimt_scache.c             :      53       18       15
linux/arch/mips/sni/setup.c                    :      77       15        7
linux/arch/mips/tools/Makefile                 :       8        1        1
linux/arch/ppc/Makefile                        :      19        3        3
linux/arch/ppc/apus_defconfig                  :       8        1        1
linux/arch/ppc/chrpboot/Makefile               :       9        3        0
linux/arch/ppc/chrpboot/main.c                 :      33        4        4
linux/arch/ppc/coffboot/Makefile               :       7        0        1
linux/arch/ppc/common_defconfig                :      58        8        4
linux/arch/ppc/config.in                       :      21        1        3
linux/arch/ppc/defconfig                       :     100       36        6
linux/arch/ppc/kernel/Makefile                 :      19        3        3
linux/arch/ppc/kernel/chrp_pci.c               :       9        2        1
linux/arch/ppc/kernel/chrp_setup.c             :     111       19       18
linux/arch/ppc/kernel/idle.c                   :      15        2        2
linux/arch/ppc/kernel/irq.c                    :      19        7        1
linux/arch/ppc/kernel/mbx_setup.c              :      19        4        4
linux/arch/ppc/kernel/misc.S                   :      32        7        5
linux/arch/ppc/kernel/mk_defs.c                :       6        1        0
linux/arch/ppc/kernel/pmac_setup.c             :     107       37        7
linux/arch/ppc/kernel/ppc_htab.c               :      23        6        3
linux/arch/ppc/kernel/ppc_ksyms.c              :      68       11       15
linux/arch/ppc/kernel/prep_setup.c             :      31        6        5
linux/arch/ppc/kernel/process.c                :      14        2        1
linux/arch/ppc/kernel/prom.c                   :      31        6        4
linux/arch/ppc/kernel/setup.c                  :      40        4       11
linux/arch/ppc/kernel/signal.c                 :      16        2        1
linux/arch/ppc/kernel/smp.c                    :     119       21       16
linux/arch/ppc/kernel/syscalls.c               :      25        6        1
linux/arch/ppc/kernel/time.c                   :      27        4       12
linux/arch/ppc/mbx_defconfig                   :       8        1        1
linux/arch/ppc/mm/init.c                       :      75       18        9
linux/arch/ppc/pmac_defconfig                  :       8        1        1
linux/arch/ppc/xmon/start.c                    :       8        1        1
linux/arch/ppc/xmon/xmon.c                     :      36        5        5
linux/arch/sparc/config.in                     :      15        1        4
linux/arch/sparc/defconfig                     :       7        0        1
linux/arch/sparc/kernel/sys_sunos.c            :      14        2        2
linux/arch/sparc/mm/init.c                     :      31        3        4
linux/arch/sparc64/config.in                   :      20        2        5
linux/arch/sparc64/defconfig                   :      16        1        2
linux/arch/sparc64/kernel/binfmt_aout32.c      :      17        9        2
linux/arch/sparc64/kernel/process.c            :      14        2        2
linux/arch/sparc64/kernel/sparc64_ksyms.c      :      13        2        1
linux/arch/sparc64/kernel/sys_sparc32.c        :      68       10       18
linux/arch/sparc64/kernel/sys_sunos32.c        :      14        2        2
linux/arch/sparc64/mm/init.c                   :      90       14        7
linux/arch/sparc64/solaris/misc.c              :      21        3        1
linux/drivers/Makefile                         :      34       12        2
linux/drivers/ap1000/ringbuf.c                 :      14        5        2
linux/drivers/block/Config.in                  :      20        6        1
linux/drivers/block/genhd.c                    :      99       13       18
linux/drivers/block/icside.c                   :       7        1        0
linux/drivers/block/ide-disk.c                 :      17        6        1
linux/drivers/block/ide-floppy.c               :      17        6        1
linux/drivers/block/ide-pci.c                  :      24        4        0
linux/drivers/block/ide-pmac.c                 :      11        2        2
linux/drivers/block/ide-probe.c                :      10        3        1
linux/drivers/block/ide-proc.c                 :     186       78       20
linux/drivers/block/ide-tape.c                 :     138       31       25
linux/drivers/block/ide.c                      :      93       29        8
linux/drivers/block/ll_rw_blk.c                :      71       17       12
linux/drivers/block/pdc4030.c                  :     184       54       33
linux/drivers/block/raid1.c                    :       8        1        1
linux/drivers/block/raid5.c                    :      54       21       14
linux/drivers/block/rd.c                       :       8        1        1
linux/drivers/char/Config.in                   :      11        5        0
linux/drivers/char/dz.c                        :    1602     1602        0
linux/drivers/char/dz.h                        :     242      242        0
linux/drivers/char/ftape/lowlevel/ftape-proc.c :      15        4        1
linux/drivers/char/misc.c                      :      23       10        0
linux/drivers/char/serial.c                    :      36        5        4
linux/drivers/char/sysrq.c                     :       8        1        1
linux/drivers/char/tpqic02.c                   :       8        1        1
linux/drivers/char/tty_io.c                    :      22        4        0
linux/drivers/char/vino.c                      :     275      275        0
linux/drivers/char/vino.h                      :     118      118        0
linux/drivers/char/vt.c                        :       9        2        1
linux/drivers/i2o/i2o_config.c                 :       7        0        1
linux/drivers/i2o/i2o_core.c                   :       7        0        1
linux/drivers/i2o/i2o_lan.c                    :       7        1        0
linux/drivers/i2o/i2o_pci.c                    :       7        0        1
linux/drivers/i2o/i2o_proc.c                   :       7        0        1
linux/drivers/net/Config.in                    :       8        1        1
linux/drivers/net/Makefile                     :      28       18        2
linux/drivers/net/Space.c                      :      21        8        0
linux/drivers/net/bagetlance.c                 :    1363     1363        0
linux/drivers/net/cycx_drv.c                   :       7        0        1
linux/drivers/net/declance.c                   :    1259     1259        0
linux/drivers/net/depca.c                      :      23        4        2
linux/drivers/net/irda/irtty.c                 :       7        0        1
linux/drivers/net/jazzsonic.c                  :     266      266        0
linux/drivers/net/sgiseeq.c                    :      43        9        5
linux/drivers/net/sonic.c                      :     500       47      315
linux/drivers/net/sonic.h                      :     167       71       33
linux/drivers/net/yellowfin.c                  :      16        2        1
linux/drivers/pci/proc.c                       :      16        5        2
linux/drivers/sbus/char/aurora.c               :       7        0        1
linux/drivers/scsi/aic7xxx_proc.c              :       8        2        0
linux/drivers/scsi/sd.c                        :       8        1        1
linux/drivers/scsi/st.c                        :       8        1        1
linux/drivers/sgi/Config.in                    :      18       18        0
linux/drivers/sgi/Makefile                     :      17        4        2
linux/drivers/sgi/char/Makefile                :      27       16        2
linux/drivers/sgi/char/cons_newport.c          :     611        0      611
linux/drivers/sgi/char/ds1286.c                :     568      568        0
linux/drivers/sgi/char/graphics.c              :     334      119       56
linux/drivers/sgi/char/graphics.h              :       4        0        1
linux/drivers/sgi/char/graphics_syms.c         :      36       36        0
linux/drivers/sgi/char/newport.c               :      28        7        2
linux/drivers/sgi/char/newport.h               :     585        0      585
linux/drivers/sgi/char/rrm.c                   :      15        4        1
linux/drivers/sgi/char/sgicons.c               :     165        3      141
linux/drivers/sgi/char/sgiserial.c             :     581      269      118
linux/drivers/sgi/char/sgiserial.h             :      30       11        4
linux/drivers/sgi/char/shmiq.c                 :      56        8        6
linux/drivers/sgi/char/streamable.c            :      23        4        3
linux/drivers/sgi/char/usema.c                 :     122       19       12
linux/drivers/sgi/char/usema.h                 :      10       10        0
linux/drivers/sgi/char/vga_font.c              :     346        0      346
linux/drivers/sound/cmpci.c                    :       7        1        0
linux/drivers/sound/sb_ess.c                   :       7        1        0
linux/drivers/tc/Makefile                      :      33       33        0
linux/drivers/tc/tc.c                          :     236      236        0
linux/drivers/tc/tcsyms.c                      :      13       13        0
linux/drivers/tc/zs.c                          :    2107     2107        0
linux/drivers/tc/zs.h                          :     405      405        0
linux/drivers/usb/README.ohci                  :      63       19       20
linux/drivers/usb/acm.c                        :       7        0        1
linux/drivers/usb/audio.c                      :       7        0        1
linux/drivers/usb/cpia.c                       :       7        0        1
linux/drivers/usb/hub.c                        :       7        0        1
linux/drivers/usb/mouse.c                      :       7        0        1
linux/drivers/usb/ohci-debug.c                 :      37       23        1
linux/drivers/usb/ohci.c                       :     791      472      103
linux/drivers/usb/ohci.h                       :      59       21        3
linux/drivers/usb/printer.c                    :      58       12        7
linux/drivers/usb/uhci.c                       :      64        8        7
linux/drivers/usb/usb.c                        :      26        3        3
linux/drivers/usb/usb.h                        :      30        5        5
linux/drivers/usb/usb_scsi.c                   :       7        1        0
linux/drivers/usb/usb_scsi.h                   :       8        2        0
linux/drivers/video/Makefile                   :      16       10        0
linux/drivers/video/g364fb.c                   :      17        2        2
linux/drivers/video/newport_con.c              :     420      250       32
linux/drivers/video/sbusfb.c                   :      31       22        2
linux/drivers/video/vga_font.c                 :     352      352        0
linux/drivers/zorro/proc.c                     :      16        5        2
linux/fs/Makefile                              :      14        0        8
linux/fs/adfs/dir.c                            :      16        4        2
linux/fs/adfs/file.c                           :      15        5        3
linux/fs/affs/dir.c                            :      11        2        1
linux/fs/affs/file.c                           :      24        5        3
linux/fs/affs/symlink.c                        :      16        4        2
linux/fs/autofs/dir.c                          :      11        2        1
linux/fs/autofs/root.c                         :      11        2        1
linux/fs/autofs/symlink.c                      :      11        2        1
linux/fs/bad_inode.c                           :       8        1        1
linux/fs/binfmt_aout.c                         :      41        5        2
linux/fs/binfmt_java.c                         :     196        0      196
linux/fs/buffer.c                              :    1947      567      680
linux/fs/coda/dir.c                            :      11        2        1
linux/fs/coda/file.c                           :      33        4        4
linux/fs/coda/pioctl.c                         :      15        2        2
linux/fs/coda/symlink.c                        :      15        2        2
linux/fs/devices.c                             :      25        6        3
linux/fs/devpts/root.c                         :      11        2        1
linux/fs/efs/dir.c                             :      25        6        2
linux/fs/efs/file.c                            :     100       58       28
linux/fs/efs/symlink.c                         :      16        4        2
linux/fs/exec.c                                :      27        1        6
linux/fs/ext2/dir.c                            :       8        1        1
linux/fs/ext2/file.c                           :      47        6       14
linux/fs/ext2/fsync.c                          :       8        1        1
linux/fs/ext2/inode.c                          :     570      174      194
linux/fs/ext2/namei.c                          :       8        1        1
linux/fs/ext2/symlink.c                        :       8        1        1
linux/fs/ext2/truncate.c                       :      89        4       29
linux/fs/fat/file.c                            :      52       14        8
linux/fs/fifo.c                                :       8        1        1
linux/fs/file_table.c                          :      42        5        9
linux/fs/hfs/dir_cap.c                         :      50       12        6
linux/fs/hfs/dir_dbl.c                         :      16        4        2
linux/fs/hfs/dir_nat.c                         :      23        4        2
linux/fs/hfs/file.c                            :      12        3        2
linux/fs/hfs/file_cap.c                        :      11        2        1
linux/fs/hfs/file_hdr.c                        :      13        3        2
linux/fs/hpfs/Makefile                         :       6        1        1
linux/fs/hpfs/anode.c                          :      27       14        7
linux/fs/hpfs/ea.c                             :      33       12        7
linux/fs/hpfs/file.c                           :     228       85      127
linux/fs/hpfs/hpfs_fn.h                        :      15        2        0
linux/fs/hpfs/inode.c                          :      68       13       10
linux/fs/hpfs/mmap.c                           :     128        0      128
linux/fs/hpfs/super.c                          :       8        1        1
linux/fs/inode.c                               :      43       13        3
linux/fs/ioctl.c                               :      24       10        3
linux/fs/isofs/dir.c                           :      16        5        2
linux/fs/isofs/file.c                          :      14        4        2
linux/fs/isofs/inode.c                         :     236      100       78
linux/fs/isofs/symlink.c                       :      16        5        2
linux/fs/lockd/host.c                          :       7        1        0
linux/fs/locks.c                               :      19        8        5
linux/fs/minix/dir.c                           :      16        5        2
linux/fs/minix/file.c                          :      81       10       43
linux/fs/minix/fsync.c                         :      17        2        2
linux/fs/minix/inode.c                         :     819      366      207
linux/fs/minix/symlink.c                       :      16        5        2
linux/fs/minix/truncate.c                      :      53        6        6
linux/fs/msdos/namei.c                         :      11        2        1
linux/fs/ncpfs/dir.c                           :      11        2        1
linux/fs/ncpfs/file.c                          :      15        9        2
linux/fs/ncpfs/symlink.c                       :      16        4        2
linux/fs/nfs/dir.c                             :      28        5        3
linux/fs/nfs/file.c                            :      17        2        2
linux/fs/nfs/symlink.c                         :       8        1        1
linux/fs/nfs/write.c                           :       8        1        1
linux/fs/nfsd/vfs.c                            :      17        2        2
linux/fs/ntfs/fs.c                             :      36        7        4
linux/fs/open.c                                :       8        1        1
linux/fs/pipe.c                                :      87       31       12
linux/fs/proc/array.c                          :      17        2        2
linux/fs/proc/base.c                           :       8        1        1
linux/fs/proc/fd.c                             :       8        1        1
linux/fs/proc/generic.c                        :      17        2        2
linux/fs/proc/kmsg.c                           :       8        1        1
linux/fs/proc/link.c                           :       8        1        1
linux/fs/proc/mem.c                            :       8        1        1
linux/fs/proc/net.c                            :       8        1        1
linux/fs/proc/omirr.c                          :       8        1        1
linux/fs/proc/openpromfs.c                     :      56       16        7
linux/fs/proc/proc_devtree.c                   :       8        1        1
linux/fs/proc/root.c                           :      53        6        6
linux/fs/proc/scsi.c                           :       8        1        1
linux/fs/proc/sysvipc.c                        :       8        1        1
linux/fs/qnx4/dir.c                            :      14        4        2
linux/fs/qnx4/file.c                           :      20        4        2
linux/fs/qnx4/fsync.c                          :       8        1        1
linux/fs/qnx4/symlinks.c                       :      16        5        2
linux/fs/read_write.c                          :      86       26       40
linux/fs/romfs/inode.c                         :     247       73       58
linux/fs/select.c                              :      49        7       11
linux/fs/smbfs/dir.c                           :      11        2        1
linux/fs/smbfs/file.c                          :      11        2        1
linux/fs/smbfs/inode.c                         :       9        0        2
linux/fs/sysv/balloc.c                         :       8        1        1
linux/fs/sysv/dir.c                            :      16        5        2
linux/fs/sysv/file.c                           :      70        7       43
linux/fs/sysv/fsync.c                          :       8        1        1
linux/fs/sysv/inode.c                          :     539      233      138
linux/fs/sysv/symlink.c                        :      16        5        2
linux/fs/sysv/truncate.c                       :       8        1        1
linux/fs/ufs/dir.c                             :      26        5        5
linux/fs/ufs/file.c                            :      78       16       42
linux/fs/ufs/inode.c                           :     568      203      195
linux/fs/ufs/super.c                           :      57       20        3
linux/fs/ufs/symlink.c                         :      14        4        2
linux/fs/ufs/truncate.c                        :       8        1        1
linux/fs/ufs/util.c                            :      10        2        2
linux/fs/umsdos/dir.c                          :      12        3        2
linux/fs/umsdos/file.c                         :      47       11        5
linux/fs/umsdos/rdir.c                         :       8        1        1
linux/fs/umsdos/symlink.c                      :      12        3        2
linux/fs/vfat/namei.c                          :      16        5        2
linux/include/asm-alpha/pgtable.h              :       8        1        1
linux/include/asm-arm/arch-ebsa285/irq.h       :       7        1        0
linux/include/asm-arm/arch-ebsa285/memory.h    :       8        2        0
linux/include/asm-arm/proc-armo/pgtable.h      :       8        1        1
linux/include/asm-arm/proc-armv/pgtable.h      :       8        1        1
linux/include/asm-i386/pgtable.h               :       8        1        1
linux/include/asm-m68k/pgtable.h               :       8        1        1
linux/include/asm-mips/baget/baget.h           :      69       69        0
linux/include/asm-mips/baget/vac.h             :     209      209        0
linux/include/asm-mips/baget/vic.h             :     193      193        0
linux/include/asm-mips/bootinfo.h              :     200       26      132
linux/include/asm-mips/byteorder.h             :      24       17        0
linux/include/asm-mips/dec/interrupts.h        :      80       80        0
linux/include/asm-mips/dec/ioasic_addrs.h      :      82       82        0
linux/include/asm-mips/dec/ioasic_ints.h       :     109      109        0
linux/include/asm-mips/dec/kn01.h              :      28       28        0
linux/include/asm-mips/dec/kn02.h              :      41       41        0
linux/include/asm-mips/dec/kn02xa.h            :      34       34        0
linux/include/asm-mips/dec/kn03.h              :      33       33        0
linux/include/asm-mips/dec/machtype.h          :      20       20        0
linux/include/asm-mips/dec/tc.h                :      43       43        0
linux/include/asm-mips/dec/tcinfo.h            :      47       47        0
linux/include/asm-mips/dec/tcmodule.h          :      35       35        0
linux/include/asm-mips/delay.h                 :      36       10       10
linux/include/asm-mips/dma.h                   :      16        1        2
linux/include/asm-mips/elf.h                   :      22       12        2
linux/include/asm-mips/fcntl.h                 :      10        1        1
linux/include/asm-mips/ide.h                   :      23        6        3
linux/include/asm-mips/init.h                  :      20        3        3
linux/include/asm-mips/io.h                    :      62       20       16
linux/include/asm-mips/ipc.h                   :       9        3        0
linux/include/asm-mips/irq.h                   :      29        1       13
linux/include/asm-mips/jazz.h                  :      28       13        9
linux/include/asm-mips/keyboard.h              :     104       32       55
linux/include/asm-mips/mipsregs.h              :      17        6        5
linux/include/asm-mips/newport.h               :      12        7        0
linux/include/asm-mips/ng1.h                   :      37       13       13
linux/include/asm-mips/ng1hw.h                 :     572      572        0
linux/include/asm-mips/offset.h                :      12        3        3
linux/include/asm-mips/page.h                  :      45        6        8
linux/include/asm-mips/pci.h                   :       8        1        1
linux/include/asm-mips/pgtable.h               :      30        5        5
linux/include/asm-mips/processor.h             :      15        2        0
linux/include/asm-mips/ptrace.h                :      18        5        4
linux/include/asm-mips/resource.h              :      38       11       12
linux/include/asm-mips/semaphore-helper.h      :     125      125        0
linux/include/asm-mips/semaphore.h             :     186      100       33
linux/include/asm-mips/sgialib.h               :      31        7        3
linux/include/asm-mips/sgiarcs.h               :      46       27       10
linux/include/asm-mips/sgihpc.h                :      61       13        9
linux/include/asm-mips/sgint23.h               :      43       12        4
linux/include/asm-mips/shmparam.h              :      10        3        1
linux/include/asm-mips/sni.h                   :      25        5        7
linux/include/asm-mips/softirq.h               :      83       20       10
linux/include/asm-mips/spinlock.h              :      86       33       18
linux/include/asm-mips/stackframe.h            :      12        5        0
linux/include/asm-mips/string.h                :      41       12       10
linux/include/asm-mips/system.h                :      61       21        4
linux/include/asm-mips/timex.h                 :      37       21        2
linux/include/asm-mips/uaccess.h               :     102       24        9
linux/include/asm-mips/umap.h                  :       8        8        0
linux/include/asm-mips/unistd.h                :      66        3       43
linux/include/asm-mips/vga.h                   :      36        7       22
linux/include/asm-ppc/hardirq.h                :       8        2        0
linux/include/asm-ppc/hydra.h                  :      20        7        7
linux/include/asm-ppc/ide.h                    :      92       20       12
linux/include/asm-ppc/irq.h                    :       7        1        0
linux/include/asm-ppc/keyboard.h               :      15        2        6
linux/include/asm-ppc/machdep.h                :      19        5        1
linux/include/asm-ppc/page.h                   :      19       13        0
linux/include/asm-ppc/pgtable.h                :       8        1        1
linux/include/asm-ppc/processor.h              :      11        5        0
linux/include/asm-ppc/ptrace.h                 :      41       16       16
linux/include/asm-ppc/softirq.h                :      42        8        4
linux/include/asm-ppc/spinlock.h               :      77       15       13
linux/include/asm-ppc/unistd.h                 :      16        0       10
linux/include/asm-sparc/page.h                 :       5        1        1
linux/include/asm-sparc/pgtable.h              :      14        2        2
linux/include/asm-sparc64/page.h               :       5        1        1
linux/include/asm-sparc64/pgtable.h            :      14        2        2
linux/include/linux/a.out.h                    :       8        1        1
linux/include/linux/binfmts.h                  :      19        1        2
linux/include/linux/cyclomx.h                  :       7        1        0
linux/include/linux/epcaconfig.h               :      10        2        3
linux/include/linux/ext2_fs.h                  :       9        2        1
linux/include/linux/file.h                     :      45       19        6
linux/include/linux/fs.h                       :     214       57       51
linux/include/linux/ide.h                      :      16        3        0
linux/include/linux/iso_fs.h                   :      29        3       19
linux/include/linux/major.h                    :       8        2        0
linux/include/linux/minix_fs.h                 :       8        1        1
linux/include/linux/miscdevice.h               :      14        8        0
linux/include/linux/mm.h                       :      26        3        3
linux/include/linux/pagemap.h                  :      16        5        2
linux/include/linux/pci.h                      :      19        6        0
linux/include/linux/personality.h              :       9        3        0
linux/include/linux/proc_fs.h                  :       7        1        0
linux/include/linux/sched.h                    :      15        2        0
linux/include/linux/string.h                   :       7        1        0
linux/include/linux/swap.h                     :       8        1        1
linux/include/linux/sysctl.h                   :       8        0        2
linux/include/linux/sysv_fs.h                  :      26        1       11
linux/include/linux/timer.h                    :       8        1        1
linux/include/linux/ufs_fs.h                   :      35        6        5
linux/include/net/dn_fib.h                     :       8        2        0
linux/include/net/dn_raw.h                     :       8        2        0
linux/init/main.c                              :       7        1        0
linux/ipc/msg.c                                :       7        1        0
linux/ipc/sem.c                                :       7        1        0
linux/ipc/shm.c                                :       7        1        0
linux/kernel/acct.c                            :       8        1        1
linux/kernel/fork.c                            :      60        8        5
linux/kernel/ksyms.c                           :      35        8        2
linux/kernel/sysctl.c                          :      29        1        8
linux/lib/string.c                             :      36       23        0
linux/mm/filemap.c                             :     131       41       11
linux/mm/memory.c                              :      87       13       10
linux/mm/mlock.c                               :      26        3        3
linux/mm/mmap.c                                :      38        6        3
linux/mm/mprotect.c                            :      26        3        3
linux/mm/mremap.c                              :       8        1        1
linux/mm/page_io.c                             :      43        3       13
linux/mm/swap_state.c                          :       8        1        1
linux/mm/swapfile.c                            :       7        0        1
linux/net/core/scm.c                           :      17        2        2
linux/net/decnet/dn_nsp_out.c                  :       7        0        1
linux/net/decnet/dn_timer.c                    :       7        0        1
linux/net/ipv4/ip_masq.c                       :      18        1        3
linux/net/ipv4/ip_masq_mfw.c                   :      35        1        7
linux/net/ipv4/ip_masq_mod.c                   :      18        1        3
linux/net/ipv4/ip_masq_portfw.c                :      18        1        3
linux/net/ipv4/ipconfig.c                      :      15        2        2
linux/net/ipv4/tcp.c                           :      40        1        5
linux/net/ipv4/udp.c                           :      20        3        3
linux/net/socket.c                             :      64        0        9
linux/net/sunrpc/xprt.c                        :      16        1        2
linux/net/unix/af_unix.c                       :     164       58       14
linux/net/unix/garbage.c                       :       8        1        1
linux/net/wanrouter/wanproc.c                  :      17        2        2
#!/bin/sh
# this is part 10 of a 26 - part archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file patch-2.3.9 continued
if test ! -r _shar_seq_.tmp; then
        echo 'Please unpack part 1 first!'
        exit 1
fi
(read Scheck
if test "$Scheck" != 10; then
        echo Please unpack part "$Scheck" next!
        exit 1
 else
        exit 0
 fi
) < _shar_seq_.tmp || exit 1
if test ! -f _shar_wnt_.tmp; then
echo 'x - still skipping patch-2.3.9'
else
echo 'x - continuing with patch-2.3.9'
sed 's/^X//' << 'SHAR_EOF' >> 'patch-2.3.9' &&
+# CONFIG_SOUND_CMPCI is not set
X # CONFIG_SOUND_ES1370 is not set
X # CONFIG_SOUND_ES1371 is not set
X # CONFIG_SOUND_SONICVIBES is not set
X # CONFIG_SOUND_MSNDCLAS is not set
X # CONFIG_SOUND_MSNDPIN is not set
-# CONFIG_SOUND_OSS is not set
+CONFIG_SOUND_OSS=y
+# CONFIG_SOUND_DMAP is not set
+# CONFIG_SOUND_PAS is not set
+# CONFIG_SOUND_SB is not set
+# CONFIG_SOUND_ADLIB is not set
+# CONFIG_SOUND_GUS is not set
+# CONFIG_SOUND_MPU401 is not set
+# CONFIG_SOUND_PSS is not set
+# CONFIG_SOUND_MSS is not set
+# CONFIG_SOUND_SSCAPE is not set
+# CONFIG_SOUND_TRIX is not set
+# CONFIG_SOUND_MAD16 is not set
+# CONFIG_SOUND_WAVEFRONT is not set
+CONFIG_SOUND_CS4232=m
+# CONFIG_SOUND_OPL3SA2 is not set
+# CONFIG_SOUND_MAUI is not set
+# CONFIG_SOUND_SGALAXY is not set
+# CONFIG_SOUND_AD1816 is not set
+# CONFIG_SOUND_OPL3SA1 is not set
+# CONFIG_SOUND_SOFTOSS is not set
+# CONFIG_SOUND_YM3812 is not set
+# CONFIG_SOUND_VMIDI is not set
+# CONFIG_SOUND_UART6850 is not set
+
+#
+# Additional low level sound drivers
+#
+# CONFIG_LOWLEVEL_SOUND is not set
X 
X #
X # Kernel hacking
diff -u --recursive --new-file v2.3.8/linux/arch/ppc/kernel/Makefile linux/arch/ppc/kernel/Makefile
--- v2.3.8/linux/arch/ppc/kernel/Makefile	Sat May 22 13:03:00 1999
+++ linux/arch/ppc/kernel/Makefile	Mon Jun 28 13:40:39 1999
@@ -56,16 +56,16 @@
X 		$(TOPDIR)/include/asm/processor.h \
X 		$(TOPDIR)/include/asm/pgtable.h \
X 		$(TOPDIR)/include/asm/ptrace.h
-	$(CC) ${CFLAGS} -S mk_defs.c
+	$(CC) $(CFLAGS) -S mk_defs.c
X 	cp ppc_defs.head ppc_defs.h
X 	grep '^#define' mk_defs.s >>ppc_defs.h
X 	rm mk_defs.s
X 
X find_name : find_name.c
-	$(HOSTCC) -o find_name find_name.c
+	$(HOSTCC) $(HOSTCFLAGS) -o find_name find_name.c
X 
X checks: checks.c
-	$(HOSTCC) ${CFLAGS} -D__KERNEL__ -o checks checks.c
+	$(HOSTCC) $(HOSTCFLAGS) -D__KERNEL__ -o checks checks.c
X 	./checks
X 
X include $(TOPDIR)/Rules.make
diff -u --recursive --new-file v2.3.8/linux/arch/ppc/kernel/chrp_pci.c linux/arch/ppc/kernel/chrp_pci.c
--- v2.3.8/linux/arch/ppc/kernel/chrp_pci.c	Mon Jun  7 12:11:51 1999
+++ linux/arch/ppc/kernel/chrp_pci.c	Mon Jun 28 13:40:39 1999
@@ -354,7 +354,8 @@
X                 }
X                 else
X                 {
-			if ( !strncmp("IBM,7043-150", get_property(find_path_device("/"), "name", NULL),12) )
+			if ( !strncmp("IBM,7043-150", get_property(find_path_device("/"), "name", NULL),12) ||
+			     !strncmp("IBM,7046-155", get_property(find_path_device("/"), "name", NULL),12) )
X 			{
X 				pci_dram_offset = 0;
X 				isa_mem_base = 0x80000000;
diff -u --recursive --new-file v2.3.8/linux/arch/ppc/kernel/chrp_setup.c linux/arch/ppc/kernel/chrp_setup.c
--- v2.3.8/linux/arch/ppc/kernel/chrp_setup.c	Mon Jun  7 12:11:51 1999
+++ linux/arch/ppc/kernel/chrp_setup.c	Mon Jun 28 13:40:39 1999
@@ -48,6 +48,7 @@
X #include <asm/irq.h>
X #include <asm/adb.h>
X #include <asm/hydra.h>
+#include <asm/keyboard.h>
X 
X #include "time.h"
X #include "local_irq.h"
@@ -66,7 +67,6 @@
X 
X unsigned long chrp_get_rtc_time(void);
X int chrp_set_rtc_time(unsigned long nowtime);
-unsigned long rtas_event_scan_rate = 0, rtas_event_scan_ct = 0;
X void chrp_calibrate_decr(void);
X void chrp_time_init(void);
X 
@@ -281,7 +281,7 @@
X 	/*
X 	 *  Fix the Super I/O configuration
X 	 */
-	/*sio_init();*/
+	sio_init();
X #ifdef CONFIG_DUMMY_CONSOLE
X 	conswitchp = &dummy_con;
X #endif
@@ -295,15 +295,16 @@
X 		struct property *p;
X 		device = find_devices("rtas");
X 		for ( p = device->properties;
-		      strncmp(p->name, "rtas-event-scan-rate", 20) && p ;
+		      p && strncmp(p->name, "rtas-event-scan-rate", 20);
X 		      p = p->next )
X 			/* nothing */ ;
X 		if ( p && *(unsigned long *)p->value )
X 		{
-			rtas_event_scan_rate = (HZ/(*(unsigned long *)p->value)*30)-1;
-			rtas_event_scan_ct = 1;
+			ppc_md.heartbeat = chrp_event_scan;
+			ppc_md.heartbeat_reset = (HZ/(*(unsigned long *)p->value)*30)-1;
+			ppc_md.heartbeat_count = 1;
X 			printk("RTAS Event Scan Rate: %lu (%lu jiffies)\n",
-			       *(unsigned long *)p->value, rtas_event_scan_rate );
+			       *(unsigned long *)p->value, ppc_md.heartbeat_reset );
X 		}
X 	}
X }
@@ -312,11 +313,8 @@
X chrp_event_scan(void)
X {
X 	unsigned char log[1024];
-	if ( rtas_event_scan_rate && (rtas_event_scan_ct-- <= 0) )
-	{
-		call_rtas( "event-scan", 4, 1, NULL, 0x0, 1, __pa(log), 1024 );
-		rtas_event_scan_ct = rtas_event_scan_rate;
-	}
+	call_rtas( "event-scan", 4, 1, NULL, 0x0, 1, __pa(log), 1024 );
+	ppc_md.heartbeat_count = ppc_md.heartbeat_reset;
X }
X 	
X void
@@ -331,7 +329,7 @@
X chrp_power_off(void)
X {
X 	/* allow power on only with power button press */
-#define	PWR_FIELD(x) (0x8000000000000000 >> ((x)-96))
+#define	PWR_FIELD(x) (0x8000000000000000ULL >> ((x)-96))
X 	printk("RTAS power-off returned %d\n",
X 	       call_rtas("power-off", 2, 1, NULL,
X 			 ((PWR_FIELD(96)|PWR_FIELD(97))>>32)&0xffffffff,
@@ -632,7 +630,8 @@
X 		ppc_md.kbd_leds          = pckbd_leds;
X 		ppc_md.kbd_init_hw       = pckbd_init_hw;
X #ifdef CONFIG_MAGIC_SYSRQ
-		ppc_md.kbd_sysrq_xlate	 = pckbd_sysrq_xlate;
+		ppc_md.ppc_kbd_sysrq_xlate	 = pckbd_sysrq_xlate;
+		SYSRQ_KEY = 0x54;
X #endif		
X 	}
X 	else
@@ -644,7 +643,8 @@
X 		ppc_md.kbd_leds          = mackbd_leds;
X 		ppc_md.kbd_init_hw       = mackbd_init_hw;
X #ifdef CONFIG_MAGIC_SYSRQ
-		ppc_md.kbd_sysrq_xlate	 = mackbd_sysrq_xlate;
+		ppc_md.ppc_kbd_sysrq_xlate	 = mackbd_sysrq_xlate;
+		SYSRQ_KEY = 0x69;
X #endif		
X 	}
X #else
@@ -655,7 +655,8 @@
X 	ppc_md.kbd_leds          = pckbd_leds;
X 	ppc_md.kbd_init_hw       = pckbd_init_hw;
X #ifdef CONFIG_MAGIC_SYSRQ
-	ppc_md.kbd_sysrq_xlate	 = pckbd_sysrq_xlate;
+	ppc_md.ppc_kbd_sysrq_xlate	 = pckbd_sysrq_xlate;
+	SYSRQ_KEY = 0x54;
X #endif
X #endif
X #endif
@@ -665,9 +666,9 @@
X         ppc_ide_md.outsw = chrp_ide_outsw;
X         ppc_ide_md.default_irq = chrp_ide_default_irq;
X         ppc_ide_md.default_io_base = chrp_ide_default_io_base;
-        ppc_ide_md.check_region = chrp_ide_check_region;
-        ppc_ide_md.request_region = chrp_ide_request_region;
-        ppc_ide_md.release_region = chrp_ide_release_region;
+        ppc_ide_md.ide_check_region = chrp_ide_check_region;
+        ppc_ide_md.ide_request_region = chrp_ide_request_region;
+        ppc_ide_md.ide_release_region = chrp_ide_release_region;
X         ppc_ide_md.fix_driveid = chrp_ide_fix_driveid;
X         ppc_ide_md.ide_init_hwif = chrp_ide_init_hwif_ports;
X 
diff -u --recursive --new-file v2.3.8/linux/arch/ppc/kernel/idle.c linux/arch/ppc/kernel/idle.c
--- v2.3.8/linux/arch/ppc/kernel/idle.c	Mon Jun  7 12:11:51 1999
+++ linux/arch/ppc/kernel/idle.c	Mon Jun 28 13:40:39 1999
@@ -1,5 +1,5 @@
X /*
- * $Id: idle.c,v 1.62 1999/05/24 05:43:18 cort Exp $
+ * $Id: idle.c,v 1.63 1999/06/10 22:55:35 geert Exp $
X  *
X  * Idle daemon for PowerPC.  Idle daemon will handle any action
X  * that needs to be taken when the system becomes idle.
@@ -298,7 +298,7 @@
X 	case 7:			/* 603ev */
X 	case 8:			/* 750 */
X 		save_flags(msr);
-		cli();
+		__cli();
X 		if (!current->need_resched) {
X 			asm("mfspr %0,1008" : "=r" (hid0) :);
X 			hid0 &= ~(HID0_NAP | HID0_SLEEP | HID0_DOZE);
diff -u --recursive --new-file v2.3.8/linux/arch/ppc/kernel/irq.c linux/arch/ppc/kernel/irq.c
--- v2.3.8/linux/arch/ppc/kernel/irq.c	Mon Jun  7 12:11:51 1999
+++ linux/arch/ppc/kernel/irq.c	Mon Jun 28 13:40:39 1999
@@ -1,5 +1,5 @@
X /*
- * $Id: irq.c,v 1.106 1999/05/25 21:16:04 cort Exp $
+ * $Id: irq.c,v 1.107 1999/06/17 05:39:12 paulus Exp $
X  *
X  *  arch/ppc/kernel/irq.c
X  *
@@ -187,6 +187,12 @@
X void free_irq(unsigned int irq, void *dev_id)
X {
X 	request_irq(irq, NULL, 0, NULL, dev_id);
+}
+
+/* XXX should implement irq disable depth like on intel */
+void disable_irq_nosync(unsigned int irq_nr)
+{
+	mask_irq(irq_nr);
X }
X 
X void disable_irq(unsigned int irq_nr)
diff -u --recursive --new-file v2.3.8/linux/arch/ppc/kernel/mbx_setup.c linux/arch/ppc/kernel/mbx_setup.c
--- v2.3.8/linux/arch/ppc/kernel/mbx_setup.c	Sat May 22 13:03:00 1999
+++ linux/arch/ppc/kernel/mbx_setup.c	Mon Jun 28 13:40:39 1999
@@ -1,5 +1,5 @@
X /*
- * $Id: mbx_setup.c,v 1.10 1999/05/14 07:24:19 davem Exp $
+ * $Id: mbx_setup.c,v 1.11 1999/06/28 17:59:43 cort Exp $
X  *
X  *  linux/arch/ppc/kernel/setup.c
X  *
@@ -473,9 +473,9 @@
X         ppc_ide_md.outsw = mbx_ide_outsw;
X         ppc_ide_md.default_irq = mbx_ide_default_irq;
X         ppc_ide_md.default_io_base = mbx_ide_default_io_base;
-        ppc_ide_md.check_region = mbx_ide_check_region;
-        ppc_ide_md.request_region = mbx_ide_request_region;
-        ppc_ide_md.release_region = mbx_ide_release_region;
+        ppc_ide_md.ide_check_region = mbx_ide_check_region;
+        ppc_ide_md.ide_request_region = mbx_ide_request_region;
+        ppc_ide_md.ide_release_region = mbx_ide_release_region;
X         ppc_ide_md.fix_driveid = mbx_ide_fix_driveid;
X         ppc_ide_md.ide_init_hwif = mbx_ide_init_hwif_ports;
X 
diff -u --recursive --new-file v2.3.8/linux/arch/ppc/kernel/misc.S linux/arch/ppc/kernel/misc.S
--- v2.3.8/linux/arch/ppc/kernel/misc.S	Mon Jun  7 12:11:51 1999
+++ linux/arch/ppc/kernel/misc.S	Mon Jun 28 13:40:39 1999
@@ -650,17 +650,19 @@
X 
X /*
X  * Create a kernel thread
- *   __kernel_thread(flags, fn, arg)
+ *   kernel_thread(fn, arg, flags)
X  */
-_GLOBAL(__kernel_thread)
+_GLOBAL(kernel_thread)
+	mr	r6,r3		/* function */
+	ori	r3,r5,CLONE_VM	/* flags */
X 	li	r0,__NR_clone
X 	sc
X 	cmpi	0,r3,0		/* parent or child? */
X 	bnelr			/* return if parent */
X 	li	r0,0		/* clear out p->tss.regs */
X 	stw	r0,TSS+PT_REGS(r2)	/* since we don't have user ctx */
-	mtlr	r4              /* fn addr in lr */
-	mr	r3,r5	        /* load arg and call fn */
+	mtlr	r6              /* fn addr in lr */
+	mr	r3,r4	        /* load arg and call fn */
X 	blrl
X 	li	r0,__NR_exit	/* exit after child exits */
X         li	r3,0
@@ -866,7 +868,7 @@
X 	.long sys_getresuid	/* 165 */
X 	.long sys_query_module
X 	.long sys_poll
-#ifdef CONFIG_NFS	
+#ifdef CONFIG_NFSD	
X 	.long sys_nfsservctl
X #else
X 	.long sys_ni_syscall
diff -u --recursive --new-file v2.3.8/linux/arch/ppc/kernel/mk_defs.c linux/arch/ppc/kernel/mk_defs.c
--- v2.3.8/linux/arch/ppc/kernel/mk_defs.c	Tue May 11 08:24:32 1999
+++ linux/arch/ppc/kernel/mk_defs.c	Mon Jun 28 13:40:39 1999
@@ -97,5 +97,6 @@
X 	DEFINE(ORIG_GPR3, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, orig_gpr3));
X 	DEFINE(RESULT, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, result));
X 	DEFINE(TRAP, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, trap));
+	DEFINE(CLONE_VM, CLONE_VM);
X 	return 0;
X }
diff -u --recursive --new-file v2.3.8/linux/arch/ppc/kernel/pmac_setup.c linux/arch/ppc/kernel/pmac_setup.c
--- v2.3.8/linux/arch/ppc/kernel/pmac_setup.c	Sat May 22 13:03:00 1999
+++ linux/arch/ppc/kernel/pmac_setup.c	Mon Jun 28 13:40:39 1999
@@ -42,6 +42,7 @@
X #include <linux/vt_kern.h>
X #include <linux/console.h>
X #include <linux/ide.h>
+#include <linux/pci.h>
X #include <asm/prom.h>
X #include <asm/system.h>
X #include <asm/pgtable.h>
@@ -56,6 +57,7 @@
X #include <asm/feature.h>
X #include <asm/ide.h>
X #include <asm/machdep.h>
+#include <asm/keyboard.h>
X 
X #include "time.h"
X #include "local_irq.h"
@@ -98,6 +100,7 @@
X 
X extern void zs_kgdb_hook(int tty_num);
X static void ohare_init(void);
+static void init_p2pbridge(void);
X 
X __pmac
X int
@@ -255,6 +258,7 @@
X 	ohare_init();
X 
X 	*memory_start_p = pmac_find_bridges(*memory_start_p, *memory_end_p);
+	init_p2pbridge();
X 
X 	/* Checks "l2cr-value" property in the registry */
X 	if ( (_get_PVR() >> 16) == 8) {
@@ -299,6 +303,31 @@
X 		ROOT_DEV = to_kdev_t(DEFAULT_ROOT_DEVICE);
X }
X 
+/*
+ * Tweak the PCI-PCI bridge chip on the blue & white G3s.
+ */
+__initfunc(static void init_p2pbridge(void))
+{
+	struct device_node *p2pbridge;
+	unsigned char bus, devfn;
+	unsigned short val;
+
+	/* XXX it would be better here to identify the specific
+	   PCI-PCI bridge chip we have. */
+	if ((p2pbridge = find_devices("pci-bridge")) == 0
+	    || p2pbridge->parent == NULL
+	    || strcmp(p2pbridge->parent->name, "pci") != 0)
+		return;
+
+	if (pci_device_loc(p2pbridge, &bus, &devfn) < 0)
+		return;
+
+	pcibios_read_config_word(bus, devfn, PCI_BRIDGE_CONTROL, &val);
+	val &= ~PCI_BRIDGE_CTL_MASTER_ABORT;
+	pcibios_write_config_word(bus, devfn, PCI_BRIDGE_CONTROL, val);
+	pcibios_read_config_word(bus, devfn, PCI_BRIDGE_CONTROL, &val);
+}
+
X __initfunc(static void ohare_init(void))
X {
X 	/*
@@ -488,13 +517,13 @@
X void
X pmac_ide_insw(ide_ioreg_t port, void *buf, int ns)
X {
-	ide_insw(port, buf, ns);
+	_insw_ns(port+_IO_BASE, buf, ns);
X }
X 
X void
X pmac_ide_outsw(ide_ioreg_t port, void *buf, int ns)
X {
-	ide_outsw(port, buf, ns);
+	_outsw_ns(port+_IO_BASE, buf, ns);
X }
X 
X int
@@ -596,7 +625,8 @@
X 	ppc_md.kbd_leds          = mackbd_leds;
X 	ppc_md.kbd_init_hw       = mackbd_init_hw;
X #ifdef CONFIG_MAGIC_SYSRQ
-	ppc_md.kbd_sysrq_xlate	 = mackbd_sysrq_xlate;
+	ppc_md.ppc_kbd_sysrq_xlate	 = mackbd_sysrq_xlate;
+	SYSRQ_KEY = 0x69;
X #endif
X #endif
X 
@@ -605,13 +635,13 @@
X         ppc_ide_md.outsw = pmac_ide_outsw;
X         ppc_ide_md.default_irq = pmac_ide_default_irq;
X         ppc_ide_md.default_io_base = pmac_ide_default_io_base;
-        ppc_ide_md.check_region = pmac_ide_check_region;
-        ppc_ide_md.request_region = pmac_ide_request_region;
-        ppc_ide_md.release_region = pmac_ide_release_region;
+        ppc_ide_md.ide_check_region = pmac_ide_check_region;
+        ppc_ide_md.ide_request_region = pmac_ide_request_region;
+        ppc_ide_md.ide_release_region = pmac_ide_release_region;
X         ppc_ide_md.fix_driveid = pmac_ide_fix_driveid;
X         ppc_ide_md.ide_init_hwif = pmac_ide_init_hwif_ports;
X 
-        ppc_ide_md.io_base = 0;
+        ppc_ide_md.io_base = _IO_BASE;	/* actually too early for this :-( */
X #endif		
X }
X 
diff -u --recursive --new-file v2.3.8/linux/arch/ppc/kernel/ppc_htab.c linux/arch/ppc/kernel/ppc_htab.c
--- v2.3.8/linux/arch/ppc/kernel/ppc_htab.c	Mon Dec 21 08:37:20 1998
+++ linux/arch/ppc/kernel/ppc_htab.c	Mon Jun 28 13:40:39 1999
@@ -1,5 +1,5 @@
X /*
- * $Id: ppc_htab.c,v 1.26 1998/12/10 00:24:23 cort Exp $
+ * $Id: ppc_htab.c,v 1.28 1999/06/27 10:53:32 davem Exp $
X  *
X  * PowerPC hash table management proc entry.  Will show information
X  * about the current hash table and will allow changes to it.
@@ -74,11 +74,14 @@
X     NULL,	    /* rename	   */
X     NULL,	    /* readlink	   */
X     NULL,	    /* follow_link */
+    NULL,	    /* get_block   */
X     NULL,	    /* readpage	   */
X     NULL,	    /* writepage   */
-    NULL,	    /* bmap	   */
+    NULL,	    /* flushpage   */
X     NULL,	    /* truncate	   */
-    NULL	    /* permission  */
+    NULL,	    /* permission  */
+    NULL,	    /* smap        */
+    NULL	    /* revalidate  */
X };
X 
X /* these will go into processor.h when I'm done debugging -- Cort */
diff -u --recursive --new-file v2.3.8/linux/arch/ppc/kernel/ppc_ksyms.c linux/arch/ppc/kernel/ppc_ksyms.c
--- v2.3.8/linux/arch/ppc/kernel/ppc_ksyms.c	Thu May 13 11:00:08 1999
+++ linux/arch/ppc/kernel/ppc_ksyms.c	Mon Jun 28 13:40:39 1999
@@ -31,8 +31,8 @@
X #include <asm/dma.h>
X #include <asm/machdep.h>
X 
-#define __KERNEL_SYSCALLS__
-#include <linux/unistd.h>
+/* Tell string.h we don't want memcpy etc. as cpp defines */
+#define EXPORT_SYMTAB_STROPS
X 
X extern void transfer_to_handler(void);
X extern void int_return(void);
@@ -47,7 +47,6 @@
X extern void do_lost_interrupts(unsigned long);
X extern int do_signal(sigset_t *, struct pt_regs *);
X 
-asmlinkage long long __ashrdi3(long long, int);
X asmlinkage int abs(int);
X 
X EXPORT_SYMBOL(clear_page);
@@ -66,6 +65,7 @@
X EXPORT_SYMBOL(do_lost_interrupts);
X EXPORT_SYMBOL(enable_irq);
X EXPORT_SYMBOL(disable_irq);
+EXPORT_SYMBOL(disable_irq_nosync);
X EXPORT_SYMBOL(ppc_local_irq_count);
X EXPORT_SYMBOL(ppc_local_bh_count);
X 
@@ -112,11 +112,6 @@
X EXPORT_SYMBOL(strspn);
X EXPORT_SYMBOL(strcmp);
X EXPORT_SYMBOL(strncmp);
-EXPORT_SYMBOL(memset);
-EXPORT_SYMBOL(memcpy);
-EXPORT_SYMBOL(memmove);
-EXPORT_SYMBOL(memscan);
-EXPORT_SYMBOL(memcmp);
X 
X /* EXPORT_SYMBOL(csum_partial); already in net/netsyms.c */
X EXPORT_SYMBOL(csum_partial_copy_generic);
@@ -153,9 +148,10 @@
X 
X EXPORT_SYMBOL(ide_insw);
X EXPORT_SYMBOL(ide_outsw);
+EXPORT_SYMBOL(ppc_ide_md);
X 
X EXPORT_SYMBOL(start_thread);
-EXPORT_SYMBOL(__kernel_thread);
+EXPORT_SYMBOL(kernel_thread);
X 
X EXPORT_SYMBOL(__cli);
X EXPORT_SYMBOL(__sti);
@@ -215,11 +211,11 @@
X EXPORT_SYMBOL(nvram_write_byte);
X #endif /* CONFIG_PMAC */
X 
+EXPORT_SYMBOL_NOVERS(memcpy);
+EXPORT_SYMBOL_NOVERS(memset);
+EXPORT_SYMBOL_NOVERS(memmove);
+EXPORT_SYMBOL_NOVERS(memscan);
+EXPORT_SYMBOL_NOVERS(memcmp);
+
X EXPORT_SYMBOL(abs);
X EXPORT_SYMBOL(device_is_compatible);
-
-/* The following are special because they're not called
-   explicitly (the C compiler generates them).  Fortunately,
-   their interface isn't gonna change any time soon now, so
-   it's OK to leave it out of version control.  */
-EXPORT_SYMBOL_NOVERS(__ashrdi3);
diff -u --recursive --new-file v2.3.8/linux/arch/ppc/kernel/prep_setup.c linux/arch/ppc/kernel/prep_setup.c
--- v2.3.8/linux/arch/ppc/kernel/prep_setup.c	Sat May 22 13:03:00 1999
+++ linux/arch/ppc/kernel/prep_setup.c	Mon Jun 28 13:40:39 1999
@@ -48,7 +48,7 @@
X #include <asm/mk48t59.h>
X #include <asm/prep_nvram.h>
X #include <asm/raven.h>
-
+#include <asm/keyboard.h>
X 
X #include "time.h"
X #include "local_irq.h"
@@ -825,9 +825,9 @@
X         ppc_ide_md.outsw = prep_ide_outsw;
X         ppc_ide_md.default_irq = prep_ide_default_irq;
X         ppc_ide_md.default_io_base = prep_ide_default_io_base;
-        ppc_ide_md.check_region = prep_ide_check_region;
-        ppc_ide_md.request_region = prep_ide_request_region;
-        ppc_ide_md.release_region = prep_ide_release_region;
+        ppc_ide_md.ide_check_region = prep_ide_check_region;
+        ppc_ide_md.ide_request_region = prep_ide_request_region;
+        ppc_ide_md.ide_release_region = prep_ide_release_region;
X         ppc_ide_md.fix_driveid = prep_ide_fix_driveid;
X         ppc_ide_md.ide_init_hwif = prep_ide_init_hwif_ports;
X #endif		
@@ -841,7 +841,8 @@
X 	ppc_md.kbd_leds          = pckbd_leds;
X 	ppc_md.kbd_init_hw       = pckbd_init_hw;
X #ifdef CONFIG_MAGIC_SYSRQ
-	ppc_md.kbd_sysrq_xlate	 = pckbd_sysrq_xlate;
+	ppc_md.ppc_kbd_sysrq_xlate	 = pckbd_sysrq_xlate;
+	SYSRQ_KEY = 0x54;
X #endif
X #endif
X }
diff -u --recursive --new-file v2.3.8/linux/arch/ppc/kernel/process.c linux/arch/ppc/kernel/process.c
--- v2.3.8/linux/arch/ppc/kernel/process.c	Sat May 22 13:03:00 1999
+++ linux/arch/ppc/kernel/process.c	Mon Jun 28 13:40:39 1999
@@ -1,5 +1,5 @@
X /*
- * $Id: process.c,v 1.85 1999/05/16 21:27:08 cort Exp $
+ * $Id: process.c,v 1.86 1999/06/17 21:53:46 cort Exp $
X  *
X  *  linux/arch/ppc/kernel/process.c
X  *
@@ -306,6 +306,7 @@
X 	p->tss.fpscr = current->tss.fpscr;
X 	childregs->msr &= ~MSR_FP;
X 
+	p->processor = 0;
X #ifdef __SMP__
X 	p->last_processor = NO_PROC_ID;
X #endif /* __SMP__ */
diff -u --recursive --new-file v2.3.8/linux/arch/ppc/kernel/prom.c linux/arch/ppc/kernel/prom.c
--- v2.3.8/linux/arch/ppc/kernel/prom.c	Mon Jun  7 12:11:51 1999
+++ linux/arch/ppc/kernel/prom.c	Mon Jun 28 13:40:39 1999
@@ -1,5 +1,5 @@
X /*
- * $Id: prom.c,v 1.60 1999/05/25 01:42:41 cort Exp $
+ * $Id: prom.c,v 1.61 1999/06/17 06:05:52 paulus Exp $
X  *
X  * Procedures for interfacing to the Open Firmware PROM on
X  * Power Macintosh computers.
@@ -338,7 +338,9 @@
X 			 */
X 			model = (char *) early_get_property
X 				(r4 + bi->deviceTreeOffset, 4, RELOC("model"));
-			if (model && strcmp(model, RELOC("iMac,1")) == 0) {
+			if (model
+			    && (strcmp(model, RELOC("iMac,1")) == 0
+				|| strcmp(model, RELOC("PowerMac1,1")) == 0)) {
X 				out_le32((unsigned *)0x80880008, 1);	/* XXX */
X 			}
X 		}
@@ -887,11 +889,11 @@
X 	    && (imp = (struct pci_intr_map *)
X 		get_property(np->parent, "interrupt-map", &ml)) != 0
X 	    && (ip = (int *) get_property(np, "interrupts", &l)) != 0) {
-		unsigned int busdevfn = pci_addrs[0].addr.a_hi & 0xffff00;
+		unsigned int devfn = pci_addrs[0].addr.a_hi & 0xff00;
X 		np->n_intrs = 0;
X 		np->intrs = (struct interrupt_info *) mem_start;
X 		for (i = 0; (ml -= sizeof(struct pci_intr_map)) >= 0; ++i) {
-			if (imp[i].addr.a_hi == busdevfn) {
+			if (imp[i].addr.a_hi == devfn) {
X 				np->intrs[np->n_intrs].line = imp[i].intr;
X 				np->intrs[np->n_intrs].sense = 0;
X 				++np->n_intrs;
diff -u --recursive --new-file v2.3.8/linux/arch/ppc/kernel/setup.c linux/arch/ppc/kernel/setup.c
--- v2.3.8/linux/arch/ppc/kernel/setup.c	Sat May 22 13:03:00 1999
+++ linux/arch/ppc/kernel/setup.c	Mon Jun 28 13:40:39 1999
@@ -1,5 +1,5 @@
X /*
- * $Id: setup.c,v 1.133 1999/05/14 07:24:30 davem Exp $
+ * $Id: setup.c,v 1.136 1999/06/18 07:11:35 cort Exp $
X  * Common prep/pmac/chrp boot and setup code.
X  */
X 
@@ -80,6 +80,9 @@
X int have_of = 0;
X int is_prep = 0;
X int is_chrp = 0;
+#ifdef CONFIG_MAGIC_SYSRQ
+unsigned long SYSRQ_KEY;
+#endif /* CONFIG_MAGIC_SYSRQ */
X /* For MTX/MVME boards.. with Raven/Falcon Chipset
X       Real close to CHRP, but boot like PReP (via PPCbug)
X       There's probably a nicer way to do this.. --Troy */
@@ -160,15 +163,6 @@
X 	ppc_md.halt();
X }
X   
-#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
-void ide_init_hwif_ports (hw_regs_t *hw, ide_ioreg_t data_port, ide_ioreg_t ctrl_port, int *irq)
-{
-	if (ppc_ide_md.ide_init_hwif != NULL) {
-		ppc_ide_md.ide_init_hwif(hw, data_port, ctrl_port, irq);
-	}
-}
-#endif
-
X unsigned long cpu_temp(void)
X {
X 	unsigned char thres = 0;
@@ -376,7 +370,6 @@
X 			else
X 			{
X 				_machine = _MACH_Pmac;
-				is_prep = 1;
X 			}
X 		}
X 
diff -u --recursive --new-file v2.3.8/linux/arch/ppc/kernel/signal.c linux/arch/ppc/kernel/signal.c
--- v2.3.8/linux/arch/ppc/kernel/signal.c	Thu Apr 29 12:39:01 1999
+++ linux/arch/ppc/kernel/signal.c	Mon Jun 28 13:40:39 1999
@@ -1,7 +1,7 @@
X /*
X  *  linux/arch/ppc/kernel/signal.c
X  *
- *  $Id: signal.c,v 1.24 1999/04/03 11:25:16 paulus Exp $
+ *  $Id: signal.c,v 1.25 1999/06/17 05:40:20 paulus Exp $
X  *
X  *  PowerPC version 
X  *    Copyright (C) 1995-1996 Gary Thomas (g...@linuxppc.org)
@@ -455,6 +455,7 @@
X 			default:
X 				lock_kernel();
X 				sigaddset(¤t->signal, signr);
+				recalc_sigpending(current);
X 				current->flags |= PF_SIGNALED;
X 				do_exit(exit_code);
X 				/* NOTREACHED */
diff -u --recursive --new-file v2.3.8/linux/arch/ppc/kernel/smp.c linux/arch/ppc/kernel/smp.c
--- v2.3.8/linux/arch/ppc/kernel/smp.c	Mon Jun  7 12:11:51 1999
+++ linux/arch/ppc/kernel/smp.c	Mon Jun 28 13:40:39 1999
@@ -1,5 +1,5 @@
X /*
- * $Id: smp.c,v 1.52 1999/05/23 22:43:51 cort Exp $
+ * $Id: smp.c,v 1.54 1999/06/24 17:13:34 cort Exp $
X  *
X  * Smp support for ppc.
X  *
@@ -243,20 +243,21 @@
X {
X 	extern struct task_struct *current_set[NR_CPUS];
X 	extern void __secondary_start_psurge(void);
-	int i;
+	extern void __secondary_start_chrp(void);
+	int i, cpu_nr;
X 	struct task_struct *p;
X 	unsigned long a;
X 
X         printk("Entering SMP Mode...\n");
X 	/* let other processors know to not do certain initialization */
X 	first_cpu_booted = 1;
+	smp_num_cpus = 1;
X 	
X 	/*
X 	 * assume for now that the first cpu booted is
X 	 * cpu 0, the master -- Cort
X 	 */
X 	cpu_callin_map[0] = 1;
-	cpu_callin_map[1] = 0;
X         smp_store_cpu_info(0);
X         active_kernel_processor = 0;
X 	current->processor = 0;
@@ -282,16 +283,12 @@
X 	{
X 	case _MACH_Pmac:
X 		/* assume powersurge board - 2 processors -- Cort */
-		smp_num_cpus = 2; 
+		cpu_nr = 2; 
X 		break;
X 	case _MACH_chrp:
-		smp_num_cpus = ((openpic_read(&OpenPIC->Global.Feature_Reporting0)
+		cpu_nr = ((openpic_read(&OpenPIC->Global.Feature_Reporting0)
X 				 & OPENPIC_FEATURE_LAST_PROCESSOR_MASK) >>
X 				OPENPIC_FEATURE_LAST_PROCESSOR_SHIFT)+1;
-		/* get our processor # - we may not be cpu 0 */
-		printk("SMP %d processors, boot CPU is %d (should be 0)\n",
-		       smp_num_cpus,
-		       10/*openpic_read(&OpenPIC->Processor[0]._Who_Am_I)*/);
X 		break;
X 	}
X 
@@ -299,7 +296,7 @@
X 	 * only check for cpus we know exist.  We keep the callin map
X 	 * with cpus at the bottom -- Cort
X 	 */
-	for ( i = 1 ; i < smp_num_cpus; i++ )
+	for ( i = 1 ; i < cpu_nr; i++ )
X 	{
X 		int c;
X 		
@@ -332,6 +329,19 @@
X 		case _MACH_chrp:
X 			*(unsigned long *)KERNELBASE = i;
X 			asm volatile("dcbf 0,%0"::"r"(KERNELBASE):"memory");
+#if 0
+			device = find_type_devices("cpu");
+			/* assume cpu device list is in order, find the ith cpu */
+			for ( a = i; device && a; device = device->next, a-- )
+				;
+			if ( !device )
+				break;
+			printk( "Starting %s (%lu): ", device->full_name,
+				*(ulong *)get_property(device, "reg", NULL) );
+			call_rtas( "start-cpu", 3, 1, NULL,
+				   *(ulong *)get_property(device, "reg", NULL),
+				   __pa(__secondary_start_chrp), i);
+#endif			
X 			break;
X 		}
X 		
@@ -349,6 +359,7 @@
X 			/* this sync's the decr's -- Cort */
X 			if ( _machine == _MACH_Pmac )
X 				set_dec(decrementer_count);
+			smp_num_cpus++;
X 		} else {
X 			printk("Processor %d is stuck.\n", i);
X 		}
@@ -366,7 +377,6 @@
X 
X void __init smp_commence(void)
X {
-	printk("SMP %d: smp_commence()\n",current->processor);
X 	/*
X 	 *	Lets the callin's below out of their loop.
X 	 */
@@ -381,16 +391,12 @@
X /* Activate a secondary processor. */
X asmlinkage int __init start_secondary(void *unused)
X {
-	printk("SMP %d: start_secondary()\n",current->processor);
X 	smp_callin();
X 	return cpu_idle(NULL);
X }
X 
X void __init smp_callin(void)
X {
-	int i;
-	
-	printk("SMP %d: smp_callin()\n",current->processor);
X         smp_store_cpu_info(current->processor);
X 	set_dec(decrementer_count);
X 	
@@ -407,7 +413,6 @@
X 
X void __init smp_setup(char *str, int *ints)
X {
-	printk("SMP %d: smp_setup()\n",current->processor);
X }
X 
X int __init setup_profiling_timer(unsigned int multiplier)
diff -u --recursive --new-file v2.3.8/linux/arch/ppc/kernel/syscalls.c linux/arch/ppc/kernel/syscalls.c
--- v2.3.8/linux/arch/ppc/kernel/syscalls.c	Mon Jun  7 12:11:51 1999
+++ linux/arch/ppc/kernel/syscalls.c	Mon Jun 28 13:40:39 1999
@@ -33,6 +33,7 @@
X #include <linux/sys.h>
X #include <linux/ipc.h>
X #include <linux/utsname.h>
+#include <linux/file.h>
X 
X #include <asm/uaccess.h>
X #include <asm/ipc.h>
@@ -201,12 +202,16 @@
X 
X 	lock_kernel();
X 	if (!(flags & MAP_ANONYMOUS)) {
-		if (fd >= NR_OPEN || !(file = current->files->fd[fd]))
+		if (!(file = fget(fd)))
X 			goto out;
X 	}
X 	
X 	flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
+	down(¤t->mm->mmap_sem);
X 	ret = do_mmap(file, addr, len, prot, flags, offset);
+	up(¤t->mm->mmap_sem);
+	if (file)
+		fput(file);
X out:
X 	unlock_kernel();
X 	return ret;
diff -u --recursive --new-file v2.3.8/linux/arch/ppc/kernel/time.c linux/arch/ppc/kernel/time.c
--- v2.3.8/linux/arch/ppc/kernel/time.c	Mon Jun  7 12:11:51 1999
+++ linux/arch/ppc/kernel/time.c	Mon Jun 28 13:40:39 1999
@@ -1,5 +1,5 @@
X /*
- * $Id: time.c,v 1.48 1999/05/22 19:35:57 cort Exp $
+ * $Id: time.c,v 1.50 1999/06/05 00:23:20 cort Exp $
X  * Common time routines among all ppc machines.
X  *
X  * Written by Cort Dougan (co...@cs.nmt.edu) to merge
@@ -126,17 +126,9 @@
X 	smp_local_timer_interrupt(regs);
X #endif		
X 
-#ifdef CONFIG_APUS
-	{
-		extern void apus_heartbeat (void);
-		apus_heartbeat ();
-	}
-#endif
-#if defined(CONFIG_ALL_PPC) || defined(CONFIG_CHRP)
-	if ( _machine == _MACH_chrp )
-		chrp_event_scan();
-#endif	
-
+	if ( ppc_md.heartbeat && !ppc_md.heartbeat_count--)
+		ppc_md.heartbeat();
+	
X 	hardirq_exit(cpu);
X }
X 
diff -u --recursive --new-file v2.3.8/linux/arch/ppc/mbx_defconfig linux/arch/ppc/mbx_defconfig
--- v2.3.8/linux/arch/ppc/mbx_defconfig	Wed Mar 10 21:30:32 1999
+++ linux/arch/ppc/mbx_defconfig	Sat Jun 26 08:34:19 1999
@@ -70,7 +70,7 @@
X CONFIG_BLK_DEV_IDEPCI=y
X CONFIG_BLK_DEV_IDEDMA=y
X # CONFIG_BLK_DEV_OFFBOARD is not set
-CONFIG_IDEDMA_AUTO=y
+CONFIG_IDEDMA_PCI_AUTO=y
X # CONFIG_BLK_DEV_OPTI621 is not set
X # CONFIG_BLK_DEV_TRM290 is not set
X # CONFIG_BLK_DEV_NS87415 is not set
diff -u --recursive --new-file v2.3.8/linux/arch/ppc/mm/init.c linux/arch/ppc/mm/init.c
--- v2.3.8/linux/arch/ppc/mm/init.c	Mon Jun  7 12:11:51 1999
+++ linux/arch/ppc/mm/init.c	Tue Jun 29 09:22:08 1999
@@ -1,5 +1,5 @@
X /*
- *  $Id: init.c,v 1.166 1999/05/22 18:18:30 cort Exp $
+ *  $Id: init.c,v 1.170 1999/06/29 12:33:51 davem Exp $
X  *
X  *  PowerPC version 
X  *    Copyright (C) 1995-1996 Gary Thomas (g...@linuxppc.org)
@@ -254,7 +254,6 @@
X 	printk("%d pages shared\n",shared);
X 	printk("%d pages swap cached\n",cached);
X 	printk("%d pages in page table cache\n",(int)pgtable_cache_size);
-	show_buffers();
X #ifdef CONFIG_NET
X 	show_net_buffers();
X #endif
@@ -265,12 +264,15 @@
X #endif /* __SMP__ */
X 	printk("\n");
X 	for_each_task(p)
-	{	
+	{
X 		printk("%-8.8s %3d %3d %8ld %8ld %8ld %c%08lx %08lx ",
X 		       p->comm,p->pid,
-		       atomic_read(&p->mm->count),p->mm->context,
-		       p->mm->context<<4, p->tss.last_syscall,
-		       user_mode(p->tss.regs) ? 'u' : 'k', p->tss.regs->nip,
+		       (p->mm)?atomic_read(&p->mm->count):0,
+		       (p->mm)?p->mm->context:0,
+		       (p->mm)?(p->mm->context<<4):0,
+		       p->tss.last_syscall,
+		       (p->tss.regs)?user_mode(p->tss.regs) ? 'u' : 'k' : '?',
+		       (p->tss.regs)?p->tss.regs->nip:0,
X 		       (ulong)p);
X 		{
X 			int iscur = 0;
@@ -282,7 +284,7 @@
X 				iscur = 1;
X 				printk("current");
X 			}
-#else		
+#else
X 			if ( p == current )
X 			{
X 				iscur = 1;
@@ -309,7 +311,7 @@
X 	val->totalram = 0;
X 	val->sharedram = 0;
X 	val->freeram = nr_free_pages << PAGE_SHIFT;
-	val->bufferram = buffermem;
+	val->bufferram = atomic_read(&buffermem);
X 	while (i-- > 0)  {
X 		if (PageReserved(mem_map+i))
X 			continue;
@@ -346,6 +348,13 @@
X 	size = PAGE_ALIGN(addr + size) - p;
X 
X 	/*
+	 * If the address lies within the first 16 MB, assume it's in ISA
+	 * memory space
+	 */
+	if (p < 16*1024*1024)
+	    p += _ISA_MEM_BASE;
+
+	/*
X 	 * Don't allow anybody to remap normal RAM that we're using.
X 	 * mem_init() sets high_memory so only do the check after that.
X 	 */
@@ -371,7 +380,7 @@
X 	 * same virt address (and this is contiguous).
X 	 *  -- Cort
X 	 */
-	if ( (v = p_mapped_by_bats(addr)) /*&& p_mapped_by_bats(addr+(size-1))*/ )
+	if ( (v = p_mapped_by_bats(p)) /*&& p_mapped_by_bats(p+size-1)*/ )
X 		goto out;
X #endif /* CONFIG_8xx */
X 	
diff -u --recursive --new-file v2.3.8/linux/arch/ppc/pmac_defconfig linux/arch/ppc/pmac_defconfig
--- v2.3.8/linux/arch/ppc/pmac_defconfig	Wed Mar 10 21:30:32 1999
+++ linux/arch/ppc/pmac_defconfig	Sat Jun 26 08:34:19 1999
@@ -78,7 +78,7 @@
X CONFIG_BLK_DEV_IDE_PMAC=y
X CONFIG_BLK_DEV_IDEDMA_PMAC=y
X CONFIG_BLK_DEV_IDEDMA=y
-CONFIG_PMAC_IDEDMA_AUTO=y
+CONFIG_IDEDMA_PMAC_AUTO=y
X # CONFIG_IDE_CHIPSETS is not set
X 
X #
diff -u --recursive --new-file v2.3.8/linux/arch/ppc/xmon/start.c linux/arch/ppc/xmon/start.c
--- v2.3.8/linux/arch/ppc/xmon/start.c	Wed May 26 16:55:40 1999
+++ linux/arch/ppc/xmon/start.c	Mon Jun 28 13:40:39 1999
@@ -32,7 +32,7 @@
X #ifdef CHRP_ESCC
X 		unsigned long addr = 0xc1013020;
X #else
-		unsigned long addr = 0xf3013030;
+		unsigned long addr = 0xf3013020;
X #endif
X 		TXRDY = 4;
X 		RXRDY = 1;
diff -u --recursive --new-file v2.3.8/linux/arch/ppc/xmon/xmon.c linux/arch/ppc/xmon/xmon.c
--- v2.3.8/linux/arch/ppc/xmon/xmon.c	Mon Jun  7 12:11:51 1999
+++ linux/arch/ppc/xmon/xmon.c	Mon Jun 28 13:40:39 1999
@@ -91,7 +91,6 @@
X static char *help_string = "\
X Commands:\n\
X   d	dump bytes\n\
-  dc	dump characters\n\
X   di	dump instructions\n\
X   df	dump float values\n\
X   dd	dump double values\n\
@@ -518,7 +517,7 @@
X {
X 	printf("vector: %x at pc = %x, msr = %x, sp = %x [%x]\n",
X 	       fp->trap, fp->nip, fp->msr, fp->gpr[1], fp);
-	if ((fp->trap == 0x300) || (fp->trap == 0x600) || (fp->trap == 0x200))
+	if (fp->trap == 0x300 || fp->trap == 0x600)
X 		printf("dar = %x, dsisr = %x\n", fp->dar, fp->dsisr);
X 	if (current)
X 		printf("current = %x, pid = %d, comm = %s\n",
@@ -991,15 +990,16 @@
X 	return c;
X }
X 
-#define isxdigit(c)	('0' <= (c) && (c) <= '9' || 'a' <= (c) && (c) <= 'f' \
-			 || 'A' <= (c) && (c) <= 'F')
+#define isxdigit(c)	(('0' <= (c) && (c) <= '9') \
+			 || ('a' <= (c) && (c) <= 'f') \
+			 || ('A' <= (c) && (c) <= 'F'))
X void
X dump()
X {
X 	int c;
X 
X 	c = inchar();
-	if ((isxdigit(c) && (c != 'f') && (c != 'd')) || (c == '\n'))
+	if ((isxdigit(c) && c != 'f' && c != 'd') || c == '\n')
X 		termch = c;
X 	scanhex(&adrs);
X 	if( termch != '\n')
diff -u --recursive --new-file v2.3.8/linux/arch/sparc/config.in linux/arch/sparc/config.in
--- v2.3.8/linux/arch/sparc/config.in	Mon Mar 15 16:10:43 1999
+++ linux/arch/sparc/config.in	Tue Jun 29 09:22:08 1999
@@ -1,4 +1,4 @@
-# $Id: config.in,v 1.68 1999/03/14 03:12:42 anton Exp $
+# $Id: config.in,v 1.69 1999/06/25 11:00:20 davem Exp $
X # For a description of the syntax of this configuration file,
X # see the Configure script.
X #
@@ -72,9 +72,6 @@
X tristate 'Kernel support for a.out binaries' CONFIG_BINFMT_AOUT
X tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
X tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
-if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
-  tristate 'Kernel support for JAVA binaries (obsolete)' CONFIG_BINFMT_JAVA
-fi
X endmenu
X 
X mainmenu_option next_comment
diff -u --recursive --new-file v2.3.8/linux/arch/sparc/defconfig linux/arch/sparc/defconfig
--- v2.3.8/linux/arch/sparc/defconfig	Thu Jun 17 01:08:50 1999
+++ linux/arch/sparc/defconfig	Fri Jun 25 01:05:12 1999
@@ -80,7 +80,6 @@
X CONFIG_BINFMT_AOUT=y
X CONFIG_BINFMT_ELF=y
X CONFIG_BINFMT_MISC=m
-CONFIG_BINFMT_JAVA=m
X 
X #
X # Floppy, IDE, and other block devices
diff -u --recursive --new-file v2.3.8/linux/arch/sparc/kernel/sys_sunos.c linux/arch/sparc/kernel/sys_sunos.c
--- v2.3.8/linux/arch/sparc/kernel/sys_sunos.c	Thu Jun 17 01:08:50 1999
+++ linux/arch/sparc/kernel/sys_sunos.c	Tue Jun 29 09:22:08 1999
@@ -1,4 +1,4 @@
-/* $Id: sys_sunos.c,v 1.99 1999/06/11 11:40:39 davem Exp $
+/* $Id: sys_sunos.c,v 1.101 1999/06/29 12:33:54 davem Exp $
X  * sys_sunos.c: SunOS specific syscall compatibility support.
X  *
X  * Copyright (C) 1995 David S. Miller (da...@caip.rutgers.edu)
@@ -196,7 +196,7 @@
X 	 * simple, it hopefully works in most obvious cases.. Easy to
X 	 * fool it, but this should catch most mistakes.
X 	 */
-	freepages = buffermem >> PAGE_SHIFT;
+	freepages = atomic_read(&buffermem) >> PAGE_SHIFT;
X 	freepages += atomic_read(&page_cache_size);
X 	freepages >>= 1;
X 	freepages += nr_free_pages;
diff -u --recursive --new-file v2.3.8/linux/arch/sparc/mm/init.c linux/arch/sparc/mm/init.c
--- v2.3.8/linux/arch/sparc/mm/init.c	Thu Apr 22 19:24:51 1999
+++ linux/arch/sparc/mm/init.c	Tue Jun 29 09:22:08 1999
@@ -1,4 +1,4 @@
-/*  $Id: init.c,v 1.65 1999/04/09 16:28:03 davem Exp $
+/*  $Id: init.c,v 1.67 1999/06/29 12:33:59 davem Exp $
X  *  linux/arch/sparc/mm/init.c
X  *
X  *  Copyright (C) 1995 David S. Miller (da...@caip.rutgers.edu)
@@ -106,7 +106,6 @@
X 	printk("%ld page tables cached\n",pgtable_cache_size);
X 	if (sparc_cpu_model == sun4m || sparc_cpu_model == sun4d)
X 		printk("%ld page dirs cached\n", pgd_cache_size);
-	show_buffers();
X #ifdef CONFIG_NET
X 	show_net_buffers();
X #endif
@@ -245,7 +244,7 @@
X 	struct page *page, *end;
X 
X 	/* Saves us work later. */
-	memset((void *) ZERO_PAGE, 0, PAGE_SIZE);
+	memset((void *) ZERO_PAGE(0), 0, PAGE_SIZE);
X 
X 	end_mem &= PAGE_MASK;
X 	max_mapnr = MAP_NR(end_mem);
@@ -363,7 +362,7 @@
X 	val->totalram = 0;
X 	val->sharedram = 0;
X 	val->freeram = nr_free_pages << PAGE_SHIFT;
-	val->bufferram = buffermem;
+	val->bufferram = atomic_read(&buffermem);
X 	for (page = mem_map, end = mem_map + max_mapnr;
X 	     page < end; page++) {
X 		if (PageSkip(page)) {
diff -u --recursive --new-file v2.3.8/linux/arch/sparc64/config.in linux/arch/sparc64/config.in
--- v2.3.8/linux/arch/sparc64/config.in	Thu Apr 22 19:24:51 1999
+++ linux/arch/sparc64/config.in	Sat Jun 26 08:34:19 1999
@@ -62,10 +62,7 @@
X   tristate 'Kernel support for 32-bit ELF binaries' CONFIG_BINFMT_ELF32
X   bool 'Kernel support for 32-bit (ie. SunOS) a.out binaries' CONFIG_BINFMT_AOUT32
X fi
-if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
-  tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
-  tristate 'Kernel support for JAVA binaries (obsolete)' CONFIG_BINFMT_JAVA
-fi
+tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
X if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
X   tristate 'Solaris binary emulation' CONFIG_SOLARIS_EMUL
X fi
@@ -120,7 +117,7 @@
X 	  dep_tristate '   SCSI emulation support' CONFIG_BLK_DEV_IDESCSI $CONFIG_BLK_DEV_IDE
X 	  define_bool CONFIG_BLK_DEV_IDEPCI y
X 	  define_bool CONFIG_BLK_DEV_IDEDMA y
-	  define_bool CONFIG_IDEDMA_AUTO y
+	  define_bool CONFIG_IDEDMA_PCI_AUTO y
X 	  define_bool CONFIG_BLK_DEV_NS87415 y
X 	  define_bool CONFIG_BLK_DEV_CMD646 y
X 	fi
diff -u --recursive --new-file v2.3.8/linux/arch/sparc64/defconfig linux/arch/sparc64/defconfig
--- v2.3.8/linux/arch/sparc64/defconfig	Thu Jun 17 01:08:50 1999
+++ linux/arch/sparc64/defconfig	Sat Jun 26 08:34:19 1999
@@ -91,7 +91,6 @@
X CONFIG_BINFMT_ELF32=y
X # CONFIG_BINFMT_AOUT32 is not set
X CONFIG_BINFMT_MISC=m
-CONFIG_BINFMT_JAVA=m
X CONFIG_SOLARIS_EMUL=m
X CONFIG_PARPORT=m
X CONFIG_PARPORT_AX=m
@@ -122,7 +121,7 @@
X # CONFIG_BLK_DEV_IDESCSI is not set
X CONFIG_BLK_DEV_IDEPCI=y
X CONFIG_BLK_DEV_IDEDMA=y
-CONFIG_IDEDMA_AUTO=y
+CONFIG_IDEDMA_PCI_AUTO=y
X CONFIG_BLK_DEV_NS87415=y
X CONFIG_BLK_DEV_CMD646=y
X 
diff -u --recursive --new-file v2.3.8/linux/arch/sparc64/kernel/binfmt_aout32.c linux/arch/sparc64/kernel/binfmt_aout32.c
--- v2.3.8/linux/arch/sparc64/kernel/binfmt_aout32.c	Wed Jun  9 14:44:25 1999
+++ linux/arch/sparc64/kernel/binfmt_aout32.c	Tue Jun 22 20:25:28 1999
@@ -55,8 +55,15 @@
X  * These are the only things you should do on a core-file: use only these
X  * macros to write out all the necessary info.
X  */
-#define DUMP_WRITE(addr,nr) \
-while (file->f_op->write(file,(char *)(addr),(nr),&file->f_pos) != (nr)) goto close_coredump
+
+static int dump_write(struct file *file, const void *addr, int nr)
+{
+	return file->f_op->write(file, addr, nr, &file->f_pos) == nr;
+}
+
+#define DUMP_WRITE(addr, nr)	\
+	if (!dump_write(file, (void *)(addr), (nr))) \
+		goto close_coredump;
X 
X #define DUMP_SEEK(offset) \
X if (file->f_op->llseek) { \
diff -u --recursive --new-file v2.3.8/linux/arch/sparc64/kernel/process.c linux/arch/sparc64/kernel/process.c
--- v2.3.8/linux/arch/sparc64/kernel/process.c	Thu May 27 09:55:21 1999
+++ linux/arch/sparc64/kernel/process.c	Tue Jun 29 09:22:08 1999
@@ -1,4 +1,4 @@
-/*  $Id: process.c,v 1.94 1999/05/27 04:49:30 davem Exp $
+/*  $Id: process.c,v 1.95 1999/06/28 08:48:51 davem Exp $
X  *  arch/sparc64/kernel/process.c
X  *
X  *  Copyright (C) 1995, 1996 David S. Miller (da...@caip.rutgers.edu)
@@ -392,7 +392,7 @@
X 	}
X 
X 	printk("flags:             0x%08x\n", tss->flags);
-	printk("current_ds:        0x%016lx\n", tss->current_ds.seg);
+	printk("current_ds:        0x%x\n", tss->current_ds.seg);
X }
X 
X /* Free current thread data structures etc.. */
diff -u --recursive --new-file v2.3.8/linux/arch/sparc64/kernel/sparc64_ksyms.c linux/arch/sparc64/kernel/sparc64_ksyms.c
--- v2.3.8/linux/arch/sparc64/kernel/sparc64_ksyms.c	Tue May 11 08:24:32 1999
+++ linux/arch/sparc64/kernel/sparc64_ksyms.c	Tue Jun 29 09:22:08 1999
@@ -1,4 +1,4 @@
-/* $Id: sparc64_ksyms.c,v 1.58 1999/05/08 03:00:31 davem Exp $
+/* $Id: sparc64_ksyms.c,v 1.59 1999/06/28 11:28:50 davem Exp $
X  * arch/sparc64/kernel/sparc64_ksyms.c: Sparc64 specific ksyms support.
X  *
X  * Copyright (C) 1996 David S. Miller (da...@caip.rutgers.edu)
@@ -206,6 +206,7 @@
X 
X /* Kernel thread creation. */
X EXPORT_SYMBOL(kernel_thread);
+EXPORT_SYMBOL(init_mm);
X 
X /* prom symbols */
X EXPORT_SYMBOL(idprom);
diff -u --recursive --new-file v2.3.8/linux/arch/sparc64/kernel/sys_sparc32.c linux/arch/sparc64/kernel/sys_sparc32.c
--- v2.3.8/linux/arch/sparc64/kernel/sys_sparc32.c	Wed Jun  9 14:44:25 1999
+++ linux/arch/sparc64/kernel/sys_sparc32.c	Tue Jun 29 09:22:08 1999
@@ -1,4 +1,4 @@
-/* $Id: sys_sparc32.c,v 1.109 1999/06/03 07:11:31 davem Exp $
+/* $Id: sys_sparc32.c,v 1.112 1999/06/29 12:34:02 davem Exp $
X  * sys_sparc32.c: Conversion between 32bit and 64bit native syscalls.
X  *
X  * Copyright (C) 1997,1998 Jakub Jelinek (j...@sunsite.mff.cuni.cz)
@@ -855,17 +855,15 @@
X 	long ret = -EBADF;
X 
X 	lock_kernel();
+
X 	file = fget(fd);
X 	if(!file)
X 		goto bad_file;
X 
-	if(!(file->f_mode & 1))
-		goto out;
-
-	ret = do_readv_writev32(VERIFY_WRITE, file,
-				vector, count);
-out:
+	if (file->f_op && file->f_op->read && (file->f_mode & FMODE_READ))
+		ret = do_readv_writev32(VERIFY_WRITE, file, vector, count);
X 	fput(file);
+
X bad_file:
X 	unlock_kernel();
X 	return ret;
@@ -877,19 +875,14 @@
X 	int ret = -EBADF;
X 
X 	lock_kernel();
+
X 	file = fget(fd);
X 	if(!file)
X 		goto bad_file;
-
-	if(!(file->f_mode & 2))
-		goto out;
-
-	down(&file->f_dentry->d_inode->i_sem);
-	ret = do_readv_writev32(VERIFY_READ, file,
-				vector, count);
-	up(&file->f_dentry->d_inode->i_sem);
-out:
+	if (file->f_op && file->f_op->write && (file->f_mode & FMODE_WRITE))
+		ret = do_readv_writev32(VERIFY_READ, file, vector, count);
X 	fput(file);
+
X bad_file:
X 	unlock_kernel();
X 	return ret;
@@ -2335,7 +2328,7 @@
X 			break;
X 		}
X 		/* Bump the usage count and install the file. */
-		fp[i]->f_count++;
+		atomic_inc(&fp[i]->f_count);
X 		current->files->fd[new_fd] = fp[i];
X 	}
X 
@@ -2841,7 +2834,6 @@
X 	bprm.dentry = dentry;
X 	bprm.filename = filename;
X 	bprm.sh_bang = 0;
-	bprm.java = 0;
X 	bprm.loader = 0;
X 	bprm.exec = 0;
X 	if ((bprm.argc = count32(argv)) < 0) {
diff -u --recursive --new-file v2.3.8/linux/arch/sparc64/kernel/sys_sunos32.c linux/arch/sparc64/kernel/sys_sunos32.c
--- v2.3.8/linux/arch/sparc64/kernel/sys_sunos32.c	Thu Jun 17 01:08:50 1999
+++ linux/arch/sparc64/kernel/sys_sunos32.c	Tue Jun 29 09:22:08 1999
@@ -1,4 +1,4 @@
-/* $Id: sys_sunos32.c,v 1.26 1999/06/09 08:23:54 davem Exp $
+/* $Id: sys_sunos32.c,v 1.28 1999/06/29 12:34:04 davem Exp $
X  * sys_sunos32.c: SunOS binary compatability layer on sparc64.
X  *
X  * Copyright (C) 1995, 1996, 1997 David S. Miller (da...@caip.rutgers.edu)
@@ -163,7 +163,7 @@
X 	 * simple, it hopefully works in most obvious cases.. Easy to
X 	 * fool it, but this should catch most mistakes.
X 	 */
-	freepages = buffermem >> PAGE_SHIFT;
+	freepages = atomic_read(&buffermem) >> PAGE_SHIFT;
X 	freepages += atomic_read(&page_cache_size);
X 	freepages >>= 1;
X 	freepages += nr_free_pages;
diff -u --recursive --new-file v2.3.8/linux/arch/sparc64/mm/init.c linux/arch/sparc64/mm/init.c
--- v2.3.8/linux/arch/sparc64/mm/init.c	Thu May 27 09:55:21 1999
+++ linux/arch/sparc64/mm/init.c	Tue Jun 29 09:22:08 1999
@@ -1,4 +1,4 @@
-/*  $Id: init.c,v 1.128 1999/05/25 16:53:24 jj Exp $
+/*  $Id: init.c,v 1.130 1999/06/29 12:34:06 davem Exp $
X  *  arch/sparc64/mm/init.c
X  *
X  *  Copyright (C) 1996-1999 David S. Miller (da...@caip.rutgers.edu)
@@ -147,7 +147,6 @@
X #ifndef __SMP__
X 	printk("%d entries in page dir cache\n",pgd_cache_size);
X #endif	
-	show_buffers();
X #ifdef CONFIG_NET
X 	show_net_buffers();
X #endif
@@ -419,10 +418,12 @@
X 	}
X 
X 	if (iommu->strbuf_enabled) {
+		volatile u64 *sbuf_pflush = (volatile u64 *) &sregs->sbuf_pflush;
+
X 		spin_lock_irqsave(&iommu->iommu_lock, flags);
X 		iommu->flushflag = 0;
X 		while(start < end) {
-			sregs->sbuf_pflush = start;
+			*sbuf_pflush = start;
X 			start += PAGE_SIZE;
X 		}
X 		sregs->sbuf_fsync = __pa(&(iommu->flushflag));
@@ -447,6 +448,8 @@
X 	start &= PAGE_MASK;
X 
X 	if (iommu->strbuf_enabled) {
+		volatile u64 *sbuf_pflush = (volatile u64 *) &sregs->sbuf_pflush;
+
X 		spin_lock_irqsave(&iommu->iommu_lock, flags);
X 
X 		/* 1) Clear the flush flag word */
@@ -456,7 +459,7 @@
X 		 *    we want flushed.
X 		 */
X 		while(start < end) {
-			sregs->sbuf_pflush = start;
+			*sbuf_pflush = start;
X 			start += PAGE_SIZE;
X 		}
X 
@@ -484,6 +487,8 @@
X 	volatile u64 *sbctrl = (volatile u64 *) &sregs->sbus_control;
X 
X 	if (iommu->strbuf_enabled) {
+		volatile u64 *sbuf_pflush = (volatile u64 *) &sregs->sbuf_pflush;
+
X 		spin_lock_irqsave(&iommu->iommu_lock, flags);
X 		iommu->flushflag = 0;
X 
@@ -500,7 +505,7 @@
X 			sg[sz--].dvma_addr = sbus_dvma_addr(start);
X 			start &= PAGE_MASK;
X 			while(start < end) {
-				sregs->sbuf_pflush = start;
+				*sbuf_pflush = start;
X 				start += PAGE_SIZE;
X 			}
X 		}
@@ -535,6 +540,8 @@
X 	unsigned long flags, tmp;
X 
X 	if (iommu->strbuf_enabled) {
+		volatile u64 *sbuf_pflush = (volatile u64 *) &sregs->sbuf_pflush;
+
X 		spin_lock_irqsave(&iommu->iommu_lock, flags);
X 
X 		/* 1) Clear the flush flag word */
@@ -549,7 +556,7 @@
X 
X 			start &= PAGE_MASK;
X 			while(start < end) {
-				sregs->sbuf_pflush = start;
+				*sbuf_pflush = start;
X 				start += PAGE_SIZE;
X 			}
X 			sz--;
@@ -1448,7 +1455,7 @@
X 	val->totalram = 0;
X 	val->sharedram = 0;
X 	val->freeram = ((unsigned long)nr_free_pages) << PAGE_SHIFT;
-	val->bufferram = buffermem;
+	val->bufferram = atomic_read(&buffermem);
X 	for (page = mem_map, end = mem_map + max_mapnr;
X 	     page < end; page++) {
X 		if (PageSkip(page)) {
diff -u --recursive --new-file v2.3.8/linux/arch/sparc64/solaris/misc.c linux/arch/sparc64/solaris/misc.c
--- v2.3.8/linux/arch/sparc64/solaris/misc.c	Mon Nov 16 10:37:28 1998
+++ linux/arch/sparc64/solaris/misc.c	Tue Jun 29 09:22:08 1999
@@ -1,4 +1,4 @@
-/* $Id: misc.c,v 1.13 1998/10/28 08:11:58 jj Exp $
+/* $Id: misc.c,v 1.14 1999/06/25 11:00:53 davem Exp $
X  * misc.c: Miscelaneous syscall emulation for Solaris
X  *
X  * Copyright (C) 1997,1998 Jakub Jelinek (j...@sunsite.mff.cuni.cz)
@@ -83,6 +83,7 @@
X 		}
X 	}
X 
+	down(¤t->mm->mmap_sem);
X 	retval = -ENOMEM;
X 	if(!(flags & MAP_FIXED) && !addr) {
X 		unsigned long attempt = get_unmapped_area(addr, len);
@@ -102,6 +103,7 @@
X 	if(!ret_type)
X 		retval = ((retval < 0xf0000000) ? 0 : retval);
X out_putf:
+	up(¤t->mm->mmap_sem);
X 	if (file)
X 		fput(file);
X out:
diff -u --recursive --new-file v2.3.8/linux/drivers/Makefile linux/drivers/Makefile
--- v2.3.8/linux/drivers/Makefile	Wed Jun  2 14:40:22 1999
+++ linux/drivers/Makefile	Tue Jun 29 09:12:32 1999
@@ -9,8 +9,9 @@
X 
X SUB_DIRS     := block char net misc sound
X MOD_SUB_DIRS := $(SUB_DIRS)
-ALL_SUB_DIRS := $(SUB_DIRS) pci scsi sbus cdrom isdn pnp \
-				 macintosh video dio zorro fc4 usb
+ALL_SUB_DIRS := $(SUB_DIRS) pci sgi scsi sbus cdrom isdn pnp i2o \
+				macintosh video dio zorro fc4 usb \
+				nubus tc ap1000
X 
X ifdef CONFIG_DIO
X SUB_DIRS += dio
@@ -34,6 +35,10 @@
X SUB_DIRS += nubus
X endif
X 
+ifdef CONFIG_TC
+SUB_DIRS += tc
+endif
+
X ifdef CONFIG_VT
X SUB_DIRS += video
X MOD_SUB_DIRS += video
@@ -52,6 +57,11 @@
X   MOD_SUB_DIRS += usb
X   endif
X endif 
+
+ifdef CONFIG_SGI
+SUB_DIRS += sgi
+MOD_SUB_DIRS += sgi
+endif
X 
X ifeq ($(CONFIG_I2O),y)
X SUB_DIRS += i2o
diff -u --recursive --new-file v2.3.8/linux/drivers/ap1000/ringbuf.c linux/drivers/ap1000/ringbuf.c
--- v2.3.8/linux/drivers/ap1000/ringbuf.c	Wed Mar 10 16:51:35 1999
+++ linux/drivers/ap1000/ringbuf.c	Sun Jun 27 10:10:41 1999
@@ -318,9 +318,12 @@
X 	NULL,			/* mknod */
X 	NULL,			/* rename */
X 	NULL,			/* readlink */
+	NULL,			/* get_block */
X 	NULL,			/* readpage */
X 	NULL,			/* writepage */
-	NULL,			/* bmap */
+	NULL,			/* flushpage */
X 	NULL,			/* truncate */
-	NULL			/* permission */
+	NULL,			/* permission */
+	NULL,			/* smap */
+	NULL			/* revalidate */
X };
diff -u --recursive --new-file v2.3.8/linux/drivers/block/Config.in linux/drivers/block/Config.in
--- v2.3.8/linux/drivers/block/Config.in	Thu Jun 17 01:11:35 1999
+++ linux/drivers/block/Config.in	Sat Jun 26 08:34:19 1999
@@ -75,7 +75,7 @@
X         if [ "$CONFIG_BLK_DEV_IDE_PMAC" != "n" ]; then
X           bool '     PowerMac IDE DMA support' CONFIG_BLK_DEV_IDEDMA_PMAC
X           if [ "$CONFIG_BLK_DEV_IDEDMA_PMAC" = "y" ]; then
-            bool '     Use DMA by default' CONFIG_PMAC_IDEDMA_AUTO
+            bool '     Use DMA by default' CONFIG_IDEDMA_PMAC_AUTO
X           fi
X        fi
X     fi
@@ -93,6 +93,11 @@
X          "$CONFIG_BLK_DEV_IDEDMA_PMAC" = "y" -o \
X          "$CONFIG_BLK_DEV_IDEDMA_ICS" = "y" ]; then
X       define_bool CONFIG_BLK_DEV_IDEDMA y
+      if [ "$CONFIG_IDEDMA_PCI_AUTO" = "y" -o \
+           "$CONFIG_IDEDMA_PMAC_AUTO" = "y" -o \
+           "$CONFIG_IDEDMA_ICS_AUTO" = "y" ]; then
+        define_bool CONFIG_IDEDMA_AUTO y
+      fi
X     fi
X     bool '   Other IDE chipset support' CONFIG_IDE_CHIPSETS
X     if [ "$CONFIG_IDE_CHIPSETS" = "y" ]; then
diff -u --recursive --new-file v2.3.8/linux/drivers/block/genhd.c linux/drivers/block/genhd.c
--- v2.3.8/linux/drivers/block/genhd.c	Sat May 15 23:43:04 1999
+++ linux/drivers/block/genhd.c	Sat Jun 26 18:23:36 1999
@@ -221,11 +221,6 @@
X 			return;
X 		if (!(bh = bread(dev,0,get_ptable_blocksize(dev))))
X 			return;
-	  /*
-	   * This block is from a device that we're about to stomp on.
-	   * So make sure nobody thinks this block is usable.
-	   */
-		bh->b_state = 0;
X 
X 		if ((*(unsigned short *) (bh->b_data+510)) != cpu_to_le16(MSDOS_LABEL_MAGIC))
X 			goto done;
@@ -285,10 +280,12 @@
X 		hd->part[current_minor].start_sect = first_sector + START_SECT(p) * sector_size;
X 		this_sector = first_sector + START_SECT(p) * sector_size;
X 		dev = MKDEV(hd->major, current_minor);
-		brelse(bh);
+
+		/* Use bforget(), as we have changed the disk geometry */
+		bforget(bh);
X 	}
X done:
-	brelse(bh);
+	bforget(bh);
X }
X 
X #ifdef CONFIG_SOLARIS_X86_PARTITION
@@ -386,7 +383,6 @@
X 
X 	if (!(bh = bread(dev,0,get_ptable_blocksize(dev))))
X 		return;
-	bh->b_state = 0;
X 	l = (struct bsd_disklabel *) (bh->b_data+512);
X 	if (l->d_magic != BSD_DISKMAGIC) {
X 		brelse(bh);
@@ -402,7 +398,9 @@
X 		if (p->p_fstype != BSD_FS_UNUSED) 
X 			check_and_add_bsd_partition(hd, p, dev);
X 	}
-	brelse(bh);
+
+	/* Use bforget(), as we have changed the disk setup */
+	bforget(bh);
X 
X }
X #endif
@@ -421,7 +419,6 @@
X 
X 	if (!(bh = bread(dev, 14, get_ptable_blocksize(dev))))
X 		return;
-	bh->b_state = 0;
X 	l = (struct unixware_disklabel *) (bh->b_data+512);
X 	if (le32_to_cpu(l->d_magic) != UNIXWARE_DISKMAGIC ||
X 	    le32_to_cpu(l->vtoc.v_magic) != UNIXWARE_DISKMAGIC2) {
@@ -441,7 +438,8 @@
X 		}
X 		p++;
X 	}
-	brelse(bh);
+	/* Use bforget, as we have changed the disk setup */
+	bforget(bh);
X 	printk(" >");
X }
X #endif
@@ -469,15 +467,12 @@
X 		return -1;
X 	}
X 	data = bh->b_data;
-	/* In some cases we modify the geometry    */
-	/*  of the drive (below), so ensure that   */
-	/*  nobody else tries to re-use this data. */
-	bh->b_state = 0;
X #ifdef CONFIG_BLK_DEV_IDE
X check_table:
X #endif
+	/* Use bforget(), because we have potentially changed the disk geometry */
X 	if (*(unsigned short *)  (0x1fe + data) != cpu_to_le16(MSDOS_LABEL_MAGIC)) {
-		brelse(bh);
+		bforget(bh);
X 		return 0;
X 	}
X 	p = (struct partition *) (0x1be + data);
@@ -515,7 +510,7 @@
X 			 * adjustments to fool fdisk/LILO and partition check.
X 			 */
X 			if (ide_xlate_1024(dev, 1, " [DM6:DDO]")) {
-				brelse(bh);
+				bforget(bh);
X 				goto read_mbr;	/* start over with new MBR */
X 			}
X 		} else if (sig <= 0x1ae &&
@@ -627,7 +622,7 @@
X 		}
X 	}
X 	printk("\n");
-	brelse(bh);
+	bforget(bh);
X 	return 1;
X }
X 
diff -u --recursive --new-file v2.3.8/linux/drivers/block/icside.c linux/drivers/block/icside.c
--- v2.3.8/linux/drivers/block/icside.c	Thu Jun 17 01:11:35 1999
+++ linux/drivers/block/icside.c	Wed Jun 30 11:24:54 1999
@@ -10,6 +10,7 @@
X  *  22-May-1999	RMK	Added support for V6 DMA
X  */
X 
+#include <linux/config.h>
X #include <linux/string.h>
X #include <linux/module.h>
X #include <linux/ioport.h>
diff -u --recursive --new-file v2.3.8/linux/drivers/block/ide-disk.c linux/drivers/block/ide-disk.c
--- v2.3.8/linux/drivers/block/ide-disk.c	Fri May 28 09:34:41 1999
+++ linux/drivers/block/ide-disk.c	Sat Jun 26 08:34:19 1999
@@ -856,11 +856,16 @@
X 	ide_drive_t *drive;
X 	int failed = 0;
X 
-	while ((drive = ide_scan_devices (ide_disk, idedisk_driver.name, &idedisk_driver, failed)) != NULL)
+	while ((drive = ide_scan_devices (ide_disk, idedisk_driver.name, &idedisk_driver, failed)) != NULL) {
X 		if (idedisk_cleanup (drive)) {
X 			printk (KERN_ERR "%s: cleanup_module() called while still busy\n", drive->name);
X 			failed++;
X 		}
+		/* We must remove proc entries defined in this module.
+		   Otherwise we oops while accessing these entries */
+		if (drive->proc)
+			ide_remove_proc_entries(drive->proc, idedisk_proc);
+	}
X 	ide_unregister_module(&idedisk_module);
X }
X #endif /* MODULE */
diff -u --recursive --new-file v2.3.8/linux/drivers/block/ide-floppy.c linux/drivers/block/ide-floppy.c
--- v2.3.8/linux/drivers/block/ide-floppy.c	Thu May 13 11:04:54 1999
+++ linux/drivers/block/ide-floppy.c	Sat Jun 26 08:34:19 1999
@@ -1630,11 +1630,16 @@
X 	ide_drive_t *drive;
X 	int failed = 0;
X 
-	while ((drive = ide_scan_devices (ide_floppy, idefloppy_driver.name, &idefloppy_driver, failed)) != NULL)
+	while ((drive = ide_scan_devices (ide_floppy, idefloppy_driver.name, &idefloppy_driver, failed)) != NULL) {
X 		if (idefloppy_cleanup (drive)) {
X 			printk ("%s: cleanup_module() called while still busy\n", drive->name);
X 			failed++;
X 		}
+		/* We must remove proc entries defined in this module.
+		   Otherwise we oops while accessing these entries */
+		if (drive->proc)
+			ide_remove_proc_entries(drive->proc, idefloppy_proc);
+	}
X 	ide_unregister_module(&idefloppy_module);
X }
X #endif /* MODULE */
diff -u --recursive --new-file v2.3.8/linux/drivers/block/ide-pci.c linux/drivers/block/ide-pci.c
--- v2.3.8/linux/drivers/block/ide-pci.c	Fri May 14 18:50:32 1999
+++ linux/drivers/block/ide-pci.c	Sat Jun 26 08:34:19 1999
@@ -29,6 +29,7 @@
X #define DEVID_PIIXb	((ide_pci_devid_t){PCI_VENDOR_ID_INTEL,   PCI_DEVICE_ID_INTEL_82371FB_1})
X #define DEVID_PIIX3	((ide_pci_devid_t){PCI_VENDOR_ID_INTEL,   PCI_DEVICE_ID_INTEL_82371SB_1})
X #define DEVID_PIIX4	((ide_pci_devid_t){PCI_VENDOR_ID_INTEL,   PCI_DEVICE_ID_INTEL_82371AB})
+#define DEVID_VIA_IDE	((ide_pci_devid_t){PCI_VENDOR_ID_VIA,     PCI_DEVICE_ID_VIA_82C561})
X #define DEVID_VP_IDE	((ide_pci_devid_t){PCI_VENDOR_ID_VIA,     PCI_DEVICE_ID_VIA_82C586_1})
X #define DEVID_PDC20246	((ide_pci_devid_t){PCI_VENDOR_ID_PROMISE, PCI_DEVICE_ID_PROMISE_20246})
X #define DEVID_PDC20262	((ide_pci_devid_t){PCI_VENDOR_ID_PROMISE, PCI_DEVICE_ID_PROMISE_20262})
@@ -190,6 +191,7 @@
X 	{DEVID_PIIXb,	"PIIX",		NULL,		INIT_PIIX,	NULL,		{{0x41,0x80,0x80}, {0x43,0x80,0x80}}, 	ON_BOARD,	0 },
X 	{DEVID_PIIX3,	"PIIX3",	NULL,		INIT_PIIX,	NULL,		{{0x41,0x80,0x80}, {0x43,0x80,0x80}}, 	ON_BOARD,	0 },
X 	{DEVID_PIIX4,	"PIIX4",	NULL,		INIT_PIIX,	NULL,		{{0x41,0x80,0x80}, {0x43,0x80,0x80}}, 	ON_BOARD,	0 },
+	{DEVID_VIA_IDE,	"VIA_IDE",	NULL,		NULL,		NULL,		{{0x00,0x00,0x00}, {0x00,0x00,0x00}},	ON_BOARD,	0 },
X 	{DEVID_VP_IDE,	"VP_IDE",	NULL,		INIT_VIA82C586,	DMA_VIA82C586,	{{0x40,0x02,0x02}, {0x40,0x01,0x01}}, 	ON_BOARD,	0 },
X 	{DEVID_PDC20246,"PDC20246",	PCI_PDC202XX,	INIT_PDC202XX,	NULL,		{{0x50,0x02,0x02}, {0x50,0x04,0x04}}, 	OFF_BOARD,	16 },
X 	{DEVID_PDC20262,"PDC20262",	PCI_PDC202XX,	INIT_PDC202XX,	NULL,		{{0x50,0x02,0x02}, {0x50,0x04,0x04}},	OFF_BOARD,	48 },
@@ -548,6 +550,8 @@
X 			continue;	/* OPTI Viper-M uses same devid for functions 0 and 1 */
X 		else if (IDE_PCI_DEVID_EQ(d->devid, DEVID_CY82C693) && (!(PCI_FUNC(dev->devfn) & 1) || !((dev->class >> 8) == PCI_CLASS_STORAGE_IDE)))
X 			continue;	/* CY82C693 is more than only a IDE controller */
+		else if (IDE_PCI_DEVID_EQ(d->devid, DEVID_UM8886A) && !(PCI_FUNC(dev->devfn) & 1))
+			continue;	/* UM8886A/BF pair */
X 		else if (!IDE_PCI_DEVID_EQ(d->devid, IDE_PCI_DEVID_NULL) || (dev->class >> 8) == PCI_CLASS_STORAGE_IDE) {
X 			if (IDE_PCI_DEVID_EQ(d->devid, IDE_PCI_DEVID_NULL))
X 				printk("%s: unknown IDE controller on PCI bus %02x device %02x, VID=%04x, DID=%04x\n",
diff -u --recursive --new-file v2.3.8/linux/drivers/block/ide-pmac.c linux/drivers/block/ide-pmac.c
--- v2.3.8/linux/drivers/block/ide-pmac.c	Mon Jun  7 12:12:22 1999
+++ linux/drivers/block/ide-pmac.c	Sat Jun 26 08:34:19 1999
@@ -218,9 +218,9 @@
X 	}
X 
X 	hwif->dmaproc = &pmac_ide_dmaproc;
-#ifdef CONFIG_PMAC_IDEDMA_AUTO
+#ifdef CONFIG_IDEDMA_PMAC_AUTO
X 	hwif->autodma = 1;
-#endif
+#endif /* CONFIG_IDEDMA_PMAC_AUTO */
X }
X 
X /*
diff -u --recursive --new-file v2.3.8/linux/drivers/block/ide-probe.c linux/drivers/block/ide-probe.c
--- v2.3.8/linux/drivers/block/ide-probe.c	Fri May 28 09:34:41 1999
+++ linux/drivers/block/ide-probe.c	Sat Jun 26 08:34:19 1999
@@ -845,7 +845,9 @@
X 	
X 	for (index = 0; index < MAX_HWIFS; ++index)
X 		ide_unregister(index);
-	return ideprobe_init();
+	ideprobe_init();
+	create_proc_ide_interfaces();
+	return 0;
X }
X 
X void cleanup_module (void)
diff -u --recursive --new-file v2.3.8/linux/drivers/block/ide-proc.c linux/drivers/block/ide-proc.c
--- v2.3.8/linux/drivers/block/ide-proc.c	Thu May 13 11:04:54 1999
+++ linux/drivers/block/ide-proc.c	Tue Jun 29 09:12:32 1999
@@ -112,6 +112,8 @@
X 	return -EINVAL;
X }
X 
+static struct proc_dir_entry * proc_ide_root = NULL;
+
X static int proc_ide_write_config
X 	(struct file *file, const char *buffer, unsigned long count, void *data)
X {
@@ -384,7 +386,7 @@
X 	ide_drive_t	*drive = (ide_drive_t *)data;
X 	int		len = 0, i = 0;
X 
-	if (!proc_ide_get_identify(drive, page)) {
+	if (drive && !proc_ide_get_identify(drive, page)) {
X 		unsigned short *val = ((unsigned short *)page) + 2;
X 		char *out = ((char *)val) + (SECTOR_WORDS * 4);
X 		page = out;
@@ -394,6 +396,8 @@
X 		} while (i < (SECTOR_WORDS * 2));
X 		len = out - page;
X 	}
+	else
+		len = sprintf(page, "\n");
X 	PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
X }
X 
@@ -525,8 +529,8 @@
X 	char		*out = page;
X 	int		len;
X 
-	out += sprintf(out,"physical     %hi/%hi/%hi\n", drive->cyl, drive->head, drive->sect);
SHAR_EOF
true || echo 'restore of patch-2.3.9 failed'
fi
echo 'End of  part 10'
echo 'File patch-2.3.9 is continued in part 11'
echo 11 > _shar_seq_.tmp
exit 0
#!/bin/sh
# this is part 11 of a 26 - part archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file patch-2.3.9 continued
if test ! -r _shar_seq_.tmp; then
        echo 'Please unpack part 1 first!'
        exit 1
fi
(read Scheck
if test "$Scheck" != 11; then
        echo Please unpack part "$Scheck" next!
        exit 1
 else
        exit 0
 fi
) < _shar_seq_.tmp || exit 1
if test ! -f _shar_wnt_.tmp; then
echo 'x - still skipping patch-2.3.9'
else
echo 'x - continuing with patch-2.3.9'
sed 's/^X//' << 'SHAR_EOF' >> 'patch-2.3.9' &&
-	out += sprintf(out,"logical      %hi/%hi/%hi\n", drive->bios_cyl, drive->bios_head, drive->bios_sect);
+	out += sprintf(out,"physical     %d/%d/%d\n", drive->cyl, drive->head, drive->sect);
+	out += sprintf(out,"logical      %d/%d/%d\n", drive->bios_cyl, drive->bios_head, drive->bios_sect);
X 	len = out - page;
X 	PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
X }
@@ -634,21 +638,30 @@
X 	return sprintf(page, "ide%d/%s", n, de->name);
X }
X 
-static void create_proc_ide_drives (ide_hwif_t *hwif, struct proc_dir_entry *parent, struct proc_dir_entry *root)
+static void create_proc_ide_drives(ide_hwif_t *hwif)
X {
X 	int	d;
X 	struct proc_dir_entry *ent;
+	struct proc_dir_entry *parent = hwif->proc;
X 
X 	for (d = 0; d < MAX_DRIVES; d++) {
X 		ide_drive_t *drive = &hwif->drives[d];
+		ide_driver_t *driver = drive->driver;
X 
X 		if (!drive->present)
X 			continue;
-		drive->proc = create_proc_entry(drive->name, S_IFDIR, parent);
X 		if (drive->proc)
-			ide_add_proc_entries(drive->proc, generic_drive_entries, drive);
+			continue;
X 
-		ent = create_proc_entry(drive->name, S_IFLNK | S_IRUGO | S_IWUGO | S_IXUGO, root);
+		drive->proc = create_proc_entry(drive->name, S_IFDIR, parent);
+		if (drive->proc) {
+			ide_add_proc_entries(drive->proc, generic_drive_entries, drive);
+			if (driver) {
+				ide_add_proc_entries(drive->proc, generic_subdriver_entries, drive);
+				ide_add_proc_entries(drive->proc, driver->proc, drive);
+			}
+		}
+		ent = create_proc_entry(drive->name, S_IFLNK | S_IRUGO | S_IWUGO | S_IXUGO, proc_ide_root);
X 		if (!ent) return;
X 		ent->data = drive;
X 		ent->readlink_proc = proc_ide_readlink;
@@ -656,6 +669,25 @@
X 	}
X }
X 
+void destroy_proc_ide_drives(ide_hwif_t *hwif)
+{
+	int	d;
+
+	for (d = 0; d < MAX_DRIVES; d++) {
+		ide_drive_t *drive = &hwif->drives[d];
+		ide_driver_t *driver = drive->driver;
+
+		if (!drive->proc)
+			continue;
+		if (driver)
+			ide_remove_proc_entries(drive->proc, driver->proc);
+		ide_remove_proc_entries(drive->proc, generic_drive_entries);
+		remove_proc_entry(drive->name, proc_ide_root);
+		remove_proc_entry(drive->name, hwif->proc);
+		drive->proc = NULL;
+	}
+}
+
X static ide_proc_entry_t hwif_entries[] = {
X 	{ "channel",	S_IFREG|S_IRUGO,	proc_ide_read_channel,	NULL },
X 	{ "config",	S_IFREG|S_IRUGO|S_IWUSR,proc_ide_read_config,	proc_ide_write_config },
@@ -664,42 +696,67 @@
X 	{ NULL,	0, NULL, NULL }
X };
X 
-static void create_proc_ide_interfaces (struct proc_dir_entry *parent)
+void create_proc_ide_interfaces(void)
X {
X 	int	h;
-	struct proc_dir_entry *hwif_ent;
X 
X 	for (h = 0; h < MAX_HWIFS; h++) {
X 		ide_hwif_t *hwif = &ide_hwifs[h];
+		int exist = (hwif->proc != NULL);
X 
X 		if (!hwif->present)
X 			continue;
-		hwif_ent = create_proc_entry(hwif->name, S_IFDIR, parent);
-		if (!hwif_ent) return;
-		ide_add_proc_entries(hwif_ent, hwif_entries, hwif);
-		create_proc_ide_drives(hwif, hwif_ent, parent);
+		if (!exist)
+			hwif->proc = create_proc_entry(hwif->name, S_IFDIR, proc_ide_root);
+		if (!hwif->proc)
+			return;
+		if (!exist)
+			ide_add_proc_entries(hwif->proc, hwif_entries, hwif);
+		create_proc_ide_drives(hwif);
+	}
+}
+
+static void destroy_proc_ide_interfaces(void)
+{
+	int	h;
+
+	for (h = 0; h < MAX_HWIFS; h++) {
+		ide_hwif_t *hwif = &ide_hwifs[h];
+		int exist = (hwif->proc != NULL);
+
+#if 0
+		if (!hwif->present)
+			continue;
+#endif
+		if (exist) {
+			destroy_proc_ide_drives(hwif);
+			ide_remove_proc_entries(hwif->proc, hwif_entries);
+			remove_proc_entry(hwif->name, proc_ide_root);
+			hwif->proc = NULL;
+		} else
+			continue;
X 	}
X }
X 
X void proc_ide_create(void)
X {
-	struct proc_dir_entry *root, *ent;
-	root = create_proc_entry("ide", S_IFDIR, 0);
-	if (!root) return;
-	create_proc_ide_interfaces(root);
+	struct proc_dir_entry *ent;
+	proc_ide_root = create_proc_entry("ide", S_IFDIR, 0);
+	if (!proc_ide_root) return;
+	create_proc_ide_interfaces();
X 
-	ent = create_proc_entry("drivers", 0, root);
+	ent = create_proc_entry("drivers", 0, proc_ide_root);
X 	if (!ent) return;
X 	ent->read_proc  = proc_ide_read_drivers;
X #ifdef CONFIG_BLK_DEV_VIA82C586
X 	if (via_display_info) {
-		ent = create_proc_entry("via", 0, root);
+		ent = create_proc_entry("via", 0, proc_ide_root);
X 		ent->get_info = via_display_info;
X 	}
X #endif /* CONFIG_BLK_DEV_VIA82C586 */
X #ifdef CONFIG_BLK_DEV_ALI15X3
X 	if (ali_display_info) {
-		ent = create_proc_entry("ali", 0, root);
+		ent = create_proc_entry("ali", 0, proc_ide_root);
X 		ent->get_info = ali_display_info;
X 	}
X #endif /* CONFIG_BLK_DEV_ALI15X3 */
@@ -720,5 +777,6 @@
X 		remove_proc_entry("ide/ali",0);
X #endif /* CONFIG_BLK_DEV_ALI15X3 */
X 	remove_proc_entry("ide/drivers", 0);
+	destroy_proc_ide_interfaces();
X 	remove_proc_entry("ide", 0);
X }
diff -u --recursive --new-file v2.3.8/linux/drivers/block/ide-tape.c linux/drivers/block/ide-tape.c
--- v2.3.8/linux/drivers/block/ide-tape.c	Thu May 13 11:04:54 1999
+++ linux/drivers/block/ide-tape.c	Tue Jun 29 09:22:08 1999
@@ -1073,13 +1073,13 @@
X 			return;
X 		}
X #endif /* IDETAPE_DEBUG_BUGS */
-		count = IDE_MIN (bh->b_size - bh->b_count, bcount);
-		atapi_input_bytes (drive, bh->b_data + bh->b_count, count);
-		bcount -= count; bh->b_count += count;
-		if (bh->b_count == bh->b_size) {
+		count = IDE_MIN (bh->b_size - atomic_read(&bh->b_count), bcount);
+		atapi_input_bytes (drive, bh->b_data + atomic_read(&bh->b_count), count);
+		bcount -= count; atomic_add(count, &bh->b_count);
+		if (atomic_read(&bh->b_count) == bh->b_size) {
X 			bh = bh->b_reqnext;
X 			if (bh)
-				bh->b_count = 0;
+				atomic_set(&bh->b_count, 0);
X 		}
X 	}
X 	pc->bh = bh;
@@ -1104,7 +1104,7 @@
X 			pc->bh = bh = bh->b_reqnext;
X 			if (bh) {
X 				pc->b_data = bh->b_data;
-				pc->b_count = bh->b_count;
+				pc->b_count = atomic_read(&bh->b_count);
X 			}
X 		}
X 	}
@@ -1126,8 +1126,8 @@
X 		}
X #endif /* IDETAPE_DEBUG_BUGS */
X 		count = IDE_MIN (bh->b_size, bcount);
-		bh->b_count = count;
-		if (bh->b_count == bh->b_size)
+		atomic_set(&bh->b_count, count);
+		if (atomic_read(&bh->b_count) == bh->b_size)
X 			bh = bh->b_reqnext;
X 		bcount -= count;
X 	}
@@ -1351,13 +1351,13 @@
X 			return;
X 		}
X #endif /* IDETAPE_DEBUG_BUGS */
-		count = IDE_MIN (bh->b_size - bh->b_count, n);
-		copy_from_user (bh->b_data + bh->b_count, buf, count);
-		n -= count; bh->b_count += count; buf += count;
-		if (bh->b_count == bh->b_size) {
+		count = IDE_MIN (bh->b_size - atomic_read(&bh->b_count), n);
+		copy_from_user (bh->b_data + atomic_read(&bh->b_count), buf, count);
+		n -= count; atomic_add(count, &bh->b_count); buf += count;
+		if (atomic_read(&bh->b_count) == bh->b_size) {
X 			bh = bh->b_reqnext;
X 			if (bh)
-				bh->b_count = 0;
+				atomic_set(&bh->b_count, 0);
X 		}
X 	}
X 	tape->bh = bh;
@@ -1382,7 +1382,7 @@
X 			tape->bh = bh = bh->b_reqnext;
X 			if (bh) {
X 				tape->b_data = bh->b_data;
-				tape->b_count = bh->b_count;
+				tape->b_count = atomic_read(&bh->b_count);
X 			}
X 		}
X 	}
@@ -1394,10 +1394,10 @@
X 	
X 	tape->bh = bh;
X 	if (tape->chrdev_direction == idetape_direction_write)
-		bh->b_count = 0;
+		atomic_set(&bh->b_count, 0);
X 	else {
X 		tape->b_data = bh->b_data;
-		tape->b_count = bh->b_count;
+		tape->b_count = atomic_read(&bh->b_count);
X 	}
X }
X 
@@ -2131,7 +2131,7 @@
X 	pc->c[1] = 1;
X 	pc->callback = &idetape_rw_callback;
X 	pc->bh = bh;
-	bh->b_count = 0;
+	atomic_set(&bh->b_count, 0);
X 	pc->buffer = NULL;
X 	pc->request_transfer = pc->buffer_size = length * tape->tape_block_size;
X 	if (pc->request_transfer == tape->stage_size)
@@ -2158,7 +2158,7 @@
X 	set_bit (PC_WRITING, &pc->flags);
X 	pc->bh = bh;
X 	pc->b_data = bh->b_data;
-	pc->b_count = bh->b_count;
+	pc->b_count = atomic_read(&bh->b_count);
X 	pc->buffer = NULL;
X 	pc->request_transfer = pc->buffer_size = length * tape->tape_block_size;
X 	if (pc->request_transfer == tape->stage_size)
@@ -2587,9 +2587,9 @@
X 		bcount -= count;
X 		blocks = count / tape->tape_block_size;
X 		while (count) {
-			bh->b_count = IDE_MIN (count, bh->b_size);
-			memset (bh->b_data, 0, bh->b_count);
-			count -= bh->b_count;
+			atomic_set(&bh->b_count, IDE_MIN (count, bh->b_size));
+			memset (bh->b_data, 0, atomic_read(&bh->b_count));
+			count -= atomic_read(&bh->b_count);
X 			bh = bh->b_reqnext;
X 		}
X 		idetape_queue_rw_tail (drive, IDETAPE_WRITE_RQ, blocks, tape->merge_stage->bh);
@@ -2616,8 +2616,8 @@
X 		if (tape->merge_stage_size % tape->tape_block_size) {
X 			blocks++;
X 			i = tape->tape_block_size - tape->merge_stage_size % tape->tape_block_size;
-			memset (tape->bh->b_data + tape->bh->b_count, 0, i);
-			tape->bh->b_count += i;
+			memset (tape->bh->b_data + atomic_read(&tape->bh->b_count), 0, i);
+			atomic_add(i, &tape->bh->b_count);
X 		}
X 		(void) idetape_add_chrdev_write_request (drive, blocks);
X 		tape->merge_stage_size = 0;
@@ -3814,8 +3814,14 @@
X 
X 	for (minor = 0; minor < MAX_HWIFS * MAX_DRIVES; minor++) {
X 		drive = idetape_chrdevs[minor].drive;
-		if (drive != NULL && idetape_cleanup (drive))
-			printk (KERN_ERR "ide-tape: %s: cleanup_module() called while still busy\n", drive->name);
+		if (drive) {
+			if (idetape_cleanup (drive))
+				printk (KERN_ERR "ide-tape: %s: cleanup_module() called while still busy\n", drive->name);
+			/* We must remove proc entries defined in this module.
+			   Otherwise we oops while accessing these entries */
+			if (drive->proc)
+				ide_remove_proc_entries(drive->proc, idetape_proc);
+		}
X 	}
X 	ide_unregister_module(&idetape_module);
X }
diff -u --recursive --new-file v2.3.8/linux/drivers/block/ide.c linux/drivers/block/ide.c
--- v2.3.8/linux/drivers/block/ide.c	Fri May 28 09:34:41 1999
+++ linux/drivers/block/ide.c	Sat Jun 26 08:34:20 1999
@@ -1748,6 +1748,13 @@
X 	return 1;
X }
X 
+#ifdef CONFIG_PROC_FS
+ide_proc_entry_t generic_subdriver_entries[] = {
+	{ "capacity",	S_IFREG|S_IRUGO,	proc_ide_read_capacity,	NULL },
+	{ NULL, 0, NULL, NULL }
+};
+#endif
+
X void ide_unregister (unsigned int index)
X {
X 	struct gendisk *gd, **gdp;
@@ -1757,6 +1764,7 @@
X 	int irq_count = 0, unit, i;
X 	unsigned long flags;
X 	unsigned int p, minor;
+	ide_hwif_t old_hwif;
X 
X 	if (index >= MAX_HWIFS)
X 		return;
@@ -1793,6 +1801,9 @@
X 				invalidate_buffers (devp);
X 			}
X 		}
+#ifdef CONFIG_PROC_FS
+		destroy_proc_ide_drives(hwif);
+#endif
X 	}
X 	cli();
X 	hwgroup = hwif->hwgroup;
@@ -1875,7 +1886,21 @@
X 		kfree(gd->part);
X 		kfree(gd);
X 	}
+	old_hwif = *hwif;
X 	init_hwif_data (index);	/* restore hwif data to pristine status */
+	hwif->hwgroup = old_hwif.hwgroup;
+	hwif->tuneproc = old_hwif.tuneproc;
+	hwif->dmaproc = old_hwif.dmaproc;
+	hwif->dma_base = old_hwif.dma_base;
+	hwif->dma_extra = old_hwif.dma_extra;
+	hwif->config_data = old_hwif.config_data;
+	hwif->select_data = old_hwif.select_data;
+	hwif->irq = old_hwif.irq;
+	hwif->major = old_hwif.major;
+	hwif->proc = old_hwif.proc;
+	hwif->chipset = old_hwif.chipset;
+	hwif->pci_dev = old_hwif.pci_dev;
+	hwif->pci_devid = old_hwif.pci_devid;
X abort:
X 	restore_flags(flags);	/* all CPUs */
X }
@@ -1950,6 +1975,9 @@
X 
X 	if (!initializing) {
X 		ide_init_module(IDE_PROBE_MODULE);
+#ifdef CONFIG_PROC_FS
+		create_proc_ide_interfaces();
+#endif
X 		ide_init_module(IDE_DRIVER_MODULE);
X 	}
X 
@@ -1966,7 +1994,6 @@
X int ide_register (int arg1, int arg2, int irq)
X {
X 	hw_regs_t hw;
-
X 	ide_init_hwif_ports(&hw, (ide_ioreg_t) arg1, (ide_ioreg_t) arg2, NULL);
X 	hw.irq = irq;
X 	return ide_register_hw(&hw, NULL);
@@ -3239,13 +3266,6 @@
X 	return NULL;
X }
X 
-#ifdef CONFIG_PROC_FS
-static ide_proc_entry_t generic_subdriver_entries[] = {
-	{ "capacity",	S_IFREG|S_IRUGO,	proc_ide_read_capacity,	NULL },
-	{ NULL, 0, NULL, NULL }
-};
-#endif
-
X int ide_register_subdriver (ide_drive_t *drive, ide_driver_t *driver, int version)
X {
X 	unsigned long flags;
@@ -3401,6 +3421,7 @@
X EXPORT_SYMBOL(ide_add_proc_entries);
X EXPORT_SYMBOL(ide_remove_proc_entries);
X EXPORT_SYMBOL(proc_ide_read_geometry);
+EXPORT_SYMBOL(create_proc_ide_interfaces);
X #endif
X EXPORT_SYMBOL(ide_add_setting);
X EXPORT_SYMBOL(ide_remove_setting);
diff -u --recursive --new-file v2.3.8/linux/drivers/block/ll_rw_blk.c linux/drivers/block/ll_rw_blk.c
--- v2.3.8/linux/drivers/block/ll_rw_blk.c	Wed Jun 16 19:26:27 1999
+++ linux/drivers/block/ll_rw_blk.c	Tue Jun 29 09:22:08 1999
@@ -17,6 +17,7 @@
X #include <linux/locks.h>
X #include <linux/mm.h>
X #include <linux/init.h>
+#include <linux/smp_lock.h>
X 
X #include <asm/system.h>
X #include <asm/io.h>
@@ -322,8 +323,6 @@
X 	spin_lock_irqsave(&io_request_lock,flags);
X 	current_request = get_queue(req->rq_dev);
X 
-	if (req->bh)
-		mark_buffer_clean(req->bh);
X 	if (!(tmp = *current_request)) {
X 		*current_request = req;
X 		if (dev->current_request != &dev->plug)
@@ -385,12 +384,17 @@
X 	count = bh->b_size >> 9;
X 	sector = bh->b_rsector;
X 
-	/* Uhhuh.. Nasty dead-lock possible here.. */
-	if (buffer_locked(bh))
-		return;
-	/* Maybe the above fixes it, and maybe it doesn't boot. Life is interesting */
+	/* We'd better have a real physical mapping! */
+	if (!buffer_mapped(bh))
+		BUG();
+
+	/* It had better not be a new buffer by the time we see it */
+	if (buffer_new(bh))
+		BUG();
X 
-	lock_buffer(bh);
+	/* Only one thread can actually submit the I/O. */
+	if (test_and_set_bit(BH_Lock, &bh->b_state))
+		return;
X 
X 	if (blk_size[major]) {
X 		unsigned long maxsector = (blk_size[major][MINOR(bh->b_rdev)] << 1) + 1;
@@ -425,9 +429,11 @@
X 			rw_ahead = 1;
X 			rw = WRITE;	/* drop into WRITE */
X 		case WRITE:
-			if (!buffer_dirty(bh))   /* Hmmph! Nothing to write */
-				goto end_io;
-			/* We don't allow the write-requests to fill up the
+			if (!test_and_clear_bit(BH_Dirty, &bh->b_state))
+				goto end_io;	/* Hmmph! Nothing to write */
+			refile_buffer(bh);
+			/*
+			 * We don't allow the write-requests to fill up the
X 			 * queue completely:  we want some room for reads,
X 			 * as they take precedence. The last third of the
X 			 * requests are only for reads.
@@ -528,7 +534,6 @@
X 			} else
X 				continue;
X 
-			mark_buffer_clean(bh);
X 			spin_unlock_irqrestore(&io_request_lock,flags);
X 		    	return;
X 
@@ -605,7 +610,7 @@
X 	for (i = 0; i < nr; i++) {
X 		if (bh[i]->b_size != correct_size) {
X 			printk(KERN_NOTICE "ll_rw_block: device %s: "
-			       "only %d-char blocks implemented (%lu)\n",
+			       "only %d-char blocks implemented (%u)\n",
X 			       kdevname(bh[0]->b_dev),
X 			       correct_size, bh[i]->b_size);
X 			goto sorry;
diff -u --recursive --new-file v2.3.8/linux/drivers/block/pdc4030.c linux/drivers/block/pdc4030.c
--- v2.3.8/linux/drivers/block/pdc4030.c	Fri May 28 09:34:41 1999
+++ linux/drivers/block/pdc4030.c	Sat Jun 26 08:34:20 1999
@@ -1,5 +1,5 @@
X /*  -*- linux-c -*-
- *  linux/drivers/block/pdc4030.c	Version 0.11  May 17, 1999
+ *  linux/drivers/block/pdc4030.c	Version 0.90  May 27, 1999
X  *
X  *  Copyright (C) 1995-1999  Linus Torvalds & authors (see below)
X  */
@@ -35,6 +35,8 @@
X  *  Version 0.10	Updated for 2.1 series of kernels
X  *  Version 0.11	Updated for 2.3 series of kernels
X  *			Autodetection code added.
+ *
+ *  Version 0.90	Transition to BETA code. No lost/unexpected interrupts
X  */
X 
X /*
@@ -68,8 +70,8 @@
X  * because I still don't understand what the card is doing with interrupts.
X  */
X 
-#undef DEBUG_READ
-#undef DEBUG_WRITE
+#define DEBUG_READ
+#define DEBUG_WRITE
X 
X #include <linux/types.h>
X #include <linux/kernel.h>
@@ -100,7 +102,8 @@
X 
X /*
X  * pdc4030_cmd handles the set of vendor specific commands that are initiated
- * by command F0. They all have the same success/failure notification.
+ * by command F0. They all have the same success/failure notification -
+ * 'P' (=0x50) on success, 'p' (=0x70) on failure.
X  */
X int pdc4030_cmd(ide_drive_t *drive, byte cmd)
X {
@@ -358,11 +361,11 @@
X 		if (stat & DRQ_STAT)
X 			goto read_again;
X 		if (stat & BUSY_STAT) {
+			ide_set_handler (drive, &promise_read_intr, WAIT_CMD);
X #ifdef DEBUG_READ
X 			printk(KERN_DEBUG "%s: promise_read: waiting for"
X 			       "interrupt\n", drive->name);
X #endif 
-			ide_set_handler (drive, &promise_read_intr, WAIT_CMD);
X 			return;
X 		}
X 		printk(KERN_ERR "%s: Eeek! promise_read_intr: sectors left "
@@ -372,37 +375,39 @@
X }
X 
X /*
- * promise_finish_write()
- * called at the end of all writes
+ * promise_complete_pollfunc()
+ * This is the polling function for waiting (nicely!) until drive stops
+ * being busy. It is invoked at the end of a write, after the previous poll
+ * has finished.
+ *
+ * Once not busy, the end request is called.
X  */
-static void promise_finish_write(ide_drive_t *drive)
+static void promise_complete_pollfunc(ide_drive_t *drive)
X {
-	struct request *rq = HWGROUP(drive)->rq;
+	ide_hwgroup_t *hwgroup = HWGROUP(drive);
+	struct request *rq = hwgroup->rq;
X 	int i;
X 
-	for (i = rq->nr_sectors; i > 0; ) {
-		i -= rq->current_nr_sectors;
-		ide_end_request(1, HWGROUP(drive));
-	}
-}
-
-/*
- * promise_write_intr()
- * This interrupt is called after the particularly odd polling for completion
- * of the write request, once all the data has been sent.
- */ 
-static void promise_write_intr(ide_drive_t *drive)
-{
-	byte stat;
-
-	if (!OK_STAT(stat=GET_STAT(),DRIVE_READY,drive->bad_wstat)) {
-		ide_error(drive, "promise_write_intr", stat);
+	if (GET_STAT() & BUSY_STAT) {
+		if (time_before(jiffies, hwgroup->poll_timeout)) {
+			ide_set_handler(drive, &promise_complete_pollfunc, 1);
+			return; /* continue polling... */
+		}
+		hwgroup->poll_timeout = 0;
+		printk(KERN_ERR "%s: completion timeout - still busy!\n",
+		       drive->name);
+		ide_error(drive, "busy timeout", GET_STAT());
+		return;
X 	}
X 
+	hwgroup->poll_timeout = 0;
X #ifdef DEBUG_WRITE
X 	printk(KERN_DEBUG "%s: Write complete - end_request\n", drive->name);
X #endif
-	promise_finish_write(drive);
+	for (i = rq->nr_sectors; i > 0; ) {
+		i -= rq->current_nr_sectors;
+		ide_end_request(1, hwgroup);
+	}
X }
X 
X /*
@@ -410,22 +415,29 @@
X  */
X static void promise_write_pollfunc (ide_drive_t *drive)
X {
+	ide_hwgroup_t *hwgroup = HWGROUP(drive);
+
X 	if (IN_BYTE(IDE_NSECTOR_REG) != 0) {
-		if (time_before(jiffies, HWGROUP(drive)->poll_timeout)) {
+		if (time_before(jiffies, hwgroup->poll_timeout)) {
X 			ide_set_handler (drive, &promise_write_pollfunc, 1);
X 			return; /* continue polling... */
X 		}
+		hwgroup->poll_timeout = 0;
X 		printk(KERN_ERR "%s: write timed-out!\n",drive->name);
X 		ide_error (drive, "write timeout", GET_STAT());
X 		return;
X 	}
X 
+	/*
+	 * Now write out last 4 sectors and poll for not BUSY
+	 */
X 	ide_multwrite(drive, 4);
+	hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE;
+	ide_set_handler(drive, &promise_complete_pollfunc, 1);
X #ifdef DEBUG_WRITE
X 	printk(KERN_DEBUG "%s: Done last 4 sectors - status = %02x\n",
X 		drive->name, GET_STAT());
X #endif
-	ide_set_handler(drive, &promise_write_intr, WAIT_CMD);
X 	return;
X }
X 
@@ -433,8 +445,8 @@
X  * promise_write() transfers a block of one or more sectors of data to a
X  * drive as part of a disk write operation. All but 4 sectors are transfered
X  * in the first attempt, then the interface is polled (nicely!) for completion
- * before the final 4 sectors are transfered. The interrupt generated on 
- * writes occurs after this process, which is why I got it wrong for so long!
+ * before the final 4 sectors are transfered. There is no interrupt generated
+ * on writes (at least on the DC4030VL-2), we just have to poll for NOT BUSY.
X  */
X static void promise_write (ide_drive_t *drive)
X {
@@ -446,18 +458,27 @@
X 	       "buffer=0x%08x\n", drive->name, rq->sector,
X 	       rq->sector + rq->nr_sectors - 1, (unsigned int)rq->buffer);
X #endif
+
+	/*
+	 * If there are more than 4 sectors to transfer, do n-4 then go into
+	 * the polling strategy as defined above.
+	 */
X 	if (rq->nr_sectors > 4) {
X 		ide_multwrite(drive, rq->nr_sectors - 4);
X 		hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE;
X 		ide_set_handler (drive, &promise_write_pollfunc, 1);
-		return;
X 	} else {
+	/*
+	 * There are 4 or fewer sectors to transfer, do them all in one go
+	 * and wait for NOT BUSY.
+	 */
X 		ide_multwrite(drive, rq->nr_sectors);
+		hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE;
+		ide_set_handler(drive, &promise_complete_pollfunc, 1);
X #ifdef DEBUG_WRITE
X 		printk(KERN_DEBUG "%s: promise_write: <= 4 sectors, "
X 			"status = %02x\n", drive->name, GET_STAT());
X #endif
-		promise_finish_write(drive);
X 	}
X }
X 
diff -u --recursive --new-file v2.3.8/linux/drivers/block/raid1.c linux/drivers/block/raid1.c
--- v2.3.8/linux/drivers/block/raid1.c	Tue Dec 22 08:12:38 1998
+++ linux/drivers/block/raid1.c	Tue Jun 29 09:22:08 1999
@@ -310,7 +310,7 @@
X 		mirror_bh [i]->b_rdev 	    = raid_conf->mirrors [i].dev;
X 		mirror_bh [i]->b_rsector    = bh->b_rsector;
X 		mirror_bh [i]->b_state      = (1<<BH_Req) | (1<<BH_Dirty);
-		mirror_bh [i]->b_count      = 1;
+		atomic_set(&mirror_bh [i]->b_count, 1);
X 		mirror_bh [i]->b_size       = bh->b_size;
X 		mirror_bh [i]->b_data       = bh->b_data;
X 		mirror_bh [i]->b_list       = BUF_LOCKED;
diff -u --recursive --new-file v2.3.8/linux/drivers/block/raid5.c linux/drivers/block/raid5.c
--- v2.3.8/linux/drivers/block/raid5.c	Tue May 11 23:37:51 1999
+++ linux/drivers/block/raid5.c	Tue Jun 29 09:22:08 1999
@@ -586,13 +586,15 @@
X 
X 	b_data = ((volatile struct buffer_head *) bh)->b_data;
X 	memset (bh, 0, sizeof (struct buffer_head));
-	init_buffer(bh, dev, block, raid5_end_request, sh);
+	init_buffer(bh, raid5_end_request, sh);
+	bh->b_dev = dev;
+	bh->b_blocknr = block;
X 	((volatile struct buffer_head *) bh)->b_data = b_data;
X 
X 	bh->b_rdev	= raid_conf->disks[i].dev;
X 	bh->b_rsector   = sh->sector;
X 
-	bh->b_state	= (1 << BH_Req);
+	bh->b_state	= (1 << BH_Req) | (1 << BH_Mapped);
X 	bh->b_size	= sh->size;
X 	bh->b_list	= BUF_LOCKED;
X }
@@ -1030,19 +1032,24 @@
X 				if (sh->bh_new[i])
X 					continue;
X 				block = (int) compute_blocknr(sh, i);
-				bh = find_buffer(MKDEV(MD_MAJOR, minor), block, sh->size);
-				if (bh && bh->b_count == 0 && buffer_dirty(bh) && !buffer_locked(bh)) {
-					PRINTK(("Whee.. sector %lu, index %d (%d) found in the buffer cache!\n", sh->sector, i, block));
-					add_stripe_bh(sh, bh, i, WRITE);
-					sh->new[i] = 0;
-					nr++; nr_write++;
-					if (sh->bh_old[i]) {
-						nr_cache_overwrite++;
-						nr_cache_other--;
-					} else if (!operational[i]) {
-						nr_failed_overwrite++;
-						nr_failed_other--;
+				bh = get_hash_table(MKDEV(MD_MAJOR, minor), block, sh->size);
+				if (bh) {
+					if (atomic_read(&bh->b_count) == 1 &&
+					    buffer_dirty(bh) &&
+					    !buffer_locked(bh)) {
+						PRINTK(("Whee.. sector %lu, index %d (%d) found in the buffer cache!\n", sh->sector, i, block));
+						add_stripe_bh(sh, bh, i, WRITE);
+						sh->new[i] = 0;
+						nr++; nr_write++;
+						if (sh->bh_old[i]) {
+							nr_cache_overwrite++;
+							nr_cache_other--;
+						} else if (!operational[i]) {
+							nr_failed_overwrite++;
+							nr_failed_other--;
+						}
X 					}
+					atomic_dec(&bh->b_count);
X 				}
X 			}
X 		}
diff -u --recursive --new-file v2.3.8/linux/drivers/block/rd.c linux/drivers/block/rd.c
--- v2.3.8/linux/drivers/block/rd.c	Fri Jun  4 01:03:28 1999
+++ linux/drivers/block/rd.c	Fri Jun 25 13:52:10 1999
@@ -173,7 +173,7 @@
X 
X 	if (CURRENT->cmd == READ) 
X 		memset(CURRENT->buffer, 0, len); 
-	else	
+	else
X 		set_bit(BH_Protected, &CURRENT->bh->b_state);
X 
X 	end_request(1);
diff -u --recursive --new-file v2.3.8/linux/drivers/char/Config.in linux/drivers/char/Config.in
--- v2.3.8/linux/drivers/char/Config.in	Sat May 22 15:02:48 1999
+++ linux/drivers/char/Config.in	Fri Jun 25 17:39:14 1999
@@ -136,6 +136,11 @@
X     dep_tristate 'Quickcam BW Video For Linux' CONFIG_VIDEO_BWQCAM $CONFIG_VIDEO_DEV $CONFIG_PARPORT
X     dep_tristate 'Colour QuickCam Video For Linux (EXPERIMENTAL)' CONFIG_VIDEO_CQCAM $CONFIG_VIDEO_DEV $CONFIG_PARPORT
X   fi
+  if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
+    if [ "$CONFIG_SGI" = "y" ]; then
+      dep_tristate 'SGI Vino Video For Linux (EXPERIMENTAL)' CONFIG_VIDEO_VINO $CONFIG_VIDEO_DEV
+    fi
+  fi
X   dep_tristate 'Mediavision Pro Movie Studio Video For Linux' CONFIG_VIDEO_PMS $CONFIG_VIDEO_DEV
X   if [ "$CONFIG_PMAC" = "y" ]; then
X     dep_tristate 'PlanB Video-In on PowerMac' CONFIG_VIDEO_PLANB $CONFIG_VIDEO_DEV
diff -u --recursive --new-file v2.3.8/linux/drivers/char/dz.c linux/drivers/char/dz.c
--- v2.3.8/linux/drivers/char/dz.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/char/dz.c	Wed Jun 30 11:24:54 1999
@@ -0,0 +1,1602 @@
+/*
+ * dz.c: Serial port driver for DECStations equiped 
+ *       with the DZ chipset.
+ *
+ * Copyright (C) 1998 Olivier A. D. Lebaillif 
+ *             
+ * Email: olivier....@ifrsys.com
+ *
+ * [31-AUG-98] triemer
+ * Changed IRQ to use Harald's dec internals interrupts.h
+ * removed base_addr code - moving address assignment to setup.c
+ * Changed name of dz_init to rs_init to be consistent with tc code
+ * [13-NOV-98] triemer fixed code to receive characters
+ *    after patches by harald to irq code.  
+ * [09-JAN-99] triemer minor fix for schedule - due to removal of timeout
+ *            field from "current" - somewhere between 2.1.121 and 2.1.131
+ */
+
+#ifdef MODULE
+#include <linux/module.h>
+#include <linux/version.h>
+#else
+#define MOD_INC_USE_COUNT
+#define MOD_DEC_USE_COUNT
+#endif
+
+#include <linux/config.h>
+#include <linux/kernel.h>
+#include <linux/sched.h>
+#include <linux/init.h> 
+#include <linux/malloc.h>
+#include <linux/mm.h>
+#include <linux/major.h>
+#include <linux/param.h>
+#include <linux/tqueue.h>
+#include <linux/interrupt.h>
+#include <asm-mips/wbflush.h>
+/* for definition of SERIAL */
+#include <asm/dec/interrupts.h>
+
+/* for definition of struct console */
+#ifdef CONFIG_SERIAL_CONSOLE
+#define CONSOLE_LINE (3)
+#include <linux/console.h>
+#endif /* ifdef CONFIG_SERIAL_CONSOLE */
+
+#include <linux/tty.h>
+#include <linux/tty_flip.h>
+#include <linux/serial.h>
+
+#include <asm/uaccess.h>
+#include <asm/irq.h>
+#include <asm/dec/machtype.h>
+#include <asm/dec/kn01.h>
+#include <asm/dec/kn02.h>
+
+#define DEBUG_DZ 1
+#ifdef DEBUG_DZ
+#include <linux/tty.h>
+#include <linux/major.h>
+#include <linux/ptrace.h>
+#include <linux/init.h>
+#include <linux/console.h>
+#include <linux/fs.h>
+#include <asm/bootinfo.h>
+
+extern int (*prom_printf) (char *,...);
+#endif
+
+
+
+#include "dz.h"
+
+#define DZ_INTR_DEBUG 1
+
+DECLARE_TASK_QUEUE(tq_serial);
+
+extern struct wait_queue *keypress_wait;
+static struct dz_serial *lines[4];
+static unsigned char tmp_buffer[256];
+
+
+
+#ifdef DEBUG_DZ
+/*
+ * debugging code to send out chars via prom 
+ */
+static void debug_console( const char *s,int count)
+{
+    unsigned i;
+
+    for (i = 0; i < count; i++) {
+       if (*s == 10)
+           prom_printf("%c", 13);
+       prom_printf("%c", *s++);
+    }
+}
+#endif
+
+/*
+ * ------------------------------------------------------------
+ * dz_in () and dz_out ()
+ *
+ * These routines are used to access the registers of the DZ 
+ * chip, hiding relocation differences between implementation.
+ * ------------------------------------------------------------
+ */
+
+static inline unsigned short dz_in (struct dz_serial *info, unsigned offset)
+{
+  volatile unsigned short *addr = (volatile unsigned short *)(info->port + offset);
+  return *addr;
+}
+
+static inline void dz_out (struct dz_serial *info, unsigned offset, unsigned short value)
+{
+
+    volatile unsigned short *addr = (volatile unsigned short *)(info->port + offset);
+  *addr = value;
+
+}
+
+/*
+ * ------------------------------------------------------------
+ * rs_stop () and rs_start ()
+ *
+ * These routines are called before setting or resetting 
+ * tty->stopped. They enable or disable transmitter interrupts, 
+ * as necessary.
+ * ------------------------------------------------------------
+ */
+
+static void dz_stop (struct tty_struct *tty)
+{
+  struct dz_serial *info = (struct dz_serial *)tty->driver_data;
+  unsigned short mask, tmp;
+
+         
+  mask = 1 << info->line;
+  tmp = dz_in (info, DZ_TCR);       /* read the TX flag */
+
+    tmp &= ~mask;                   /* clear the TX flag */
+    dz_out (info, DZ_TCR, tmp);
+}  
+
+static void dz_start (struct tty_struct *tty)
+{
+  struct dz_serial *info = (struct dz_serial *)tty->driver_data;
+  unsigned short mask, tmp;
+
+  mask = 1 << info->line;
+  tmp = dz_in (info, DZ_TCR);      /* read the TX flag */
+
+    tmp |= mask;                   /* set the TX flag */
+    dz_out (info, DZ_TCR, tmp);
+
+}  
+
+/*
+ * ------------------------------------------------------------
+ * Here starts the interrupt handling routines.  All of the 
+ * following subroutines are declared as inline and are folded 
+ * into dz_interrupt.  They were separated out for readability's 
+ * sake. 
+ *
+ * Note: rs_interrupt() is a "fast" interrupt, which means that it
+ * runs with interrupts turned off.  People who may want to modify
+ * rs_interrupt() should try to keep the interrupt handler as fast as
+ * possible.  After you are done making modifications, it is not a bad
+ * idea to do:
+ * 
+ * gcc -S -DKERNEL -Wall -Wstrict-prototypes -O6 -fomit-frame-pointer dz.c
+ *
+ * and look at the resulting assemble code in serial.s.
+ *
+ * ------------------------------------------------------------
+ */
+
+/*
+ * ------------------------------------------------------------
+ * dz_sched_event ()
+ *
+ * This routine is used by the interrupt handler to schedule
+ * processing in the software interrupt portion of the driver.
+ * ------------------------------------------------------------
+ */
+static inline void dz_sched_event (struct dz_serial *info, int event)
+{
+  info->event |= 1 << event;
+  queue_task (&info->tqueue, &tq_serial);
+  mark_bh (SERIAL_BH);
+}
+
+/*
+ * ------------------------------------------------------------
+ * receive_char ()
+ *
+ * This routine deals with inputs from any lines.
+ * ------------------------------------------------------------
+ */
+static inline void receive_chars (struct dz_serial *info_in)
+{
+
+  struct dz_serial *info;
+  struct tty_struct *tty = 0;
+  struct async_icount *icount;
+  int ignore = 0;
+  unsigned short status, tmp;
+  unsigned char ch;
+
+  /* this code is going to be a problem...
+     the call to tty_flip_buffer is going to need
+     to be rethought...
+   */
+  do
+    {
+      status = dz_in (info_in, DZ_RBUF);
+      info = lines[LINE(status)];
+
+      /* punt so we don't get duplicate characters */
+      if (!(status & DZ_DVAL))
+        goto ignore_char;
+
+
+    ch = UCHAR(status);                /* grab the char */
+
+#ifdef 0
+    if (info->is_console) {
+      if (ch == 0) return;            /* it's a break ... */
+
+      wake_up (&keypress_wait);       /* It is a 'keyboard interrupt' ;-) */
+    }
+#endif
+
+    tty = info->tty;                  /* now tty points to the proper dev */
+    icount = &info->icount;
+
+    if (!tty) break;
+    if (tty->flip.count >= TTY_FLIPBUF_SIZE) break;
+
+    *tty->flip.char_buf_ptr = ch;
+    *tty->flip.flag_buf_ptr = 0;
+    icount->rx++;
+
+    /* keep track of the statistics */
+    if (status & (DZ_OERR | DZ_FERR | DZ_PERR)) {
+      if (status & DZ_PERR)                /* parity error */
+        icount->parity++;
+      else if (status & DZ_FERR)           /* frame error */
+        icount->frame++;
+      if (status & DZ_OERR)                /* overrun error */
+        icount->overrun++;
+
+      /*  check to see if we should ignore the character
+	 and mask off conditions that should be ignored
+      */
+
+      if (status & info->ignore_status_mask) {
+        if (++ignore > 100 ) break;
+        goto ignore_char;
+      }
+
+      /* mask off the error conditions we want to ignore */
+      tmp = status & info->read_status_mask;
+
+      if (tmp & DZ_PERR)
+	{
+        *tty->flip.flag_buf_ptr = TTY_PARITY;
+	  debug_console("PERR\n",5);
+	}
+      else if (tmp & DZ_FERR)
+	{
+        *tty->flip.flag_buf_ptr = TTY_FRAME;
+	  debug_console("FERR\n",5);
+	}
+      if (tmp & DZ_OERR) 
+	{ 
+	  debug_console("OERR\n",5);
+	if (tty->flip.count < TTY_FLIPBUF_SIZE) {
+          tty->flip.count++;
+          tty->flip.flag_buf_ptr++;
+          tty->flip.char_buf_ptr++;
+          *tty->flip.flag_buf_ptr = TTY_OVERRUN;
+        }
+      }
+    }
+    tty->flip.flag_buf_ptr++;
+    tty->flip.char_buf_ptr++;
+    tty->flip.count++;
+  ignore_char:
+  } while (status & DZ_DVAL);
+
+  if (tty)
+    tty_flip_buffer_push(tty);
+}
+
+/*
+ * ------------------------------------------------------------
+ * transmit_char ()
+ *
+ * This routine deals with outputs to any lines.
+ * ------------------------------------------------------------
+ */
+static inline void transmit_chars (struct dz_serial *info)
+{
+  unsigned char tmp;
+
+
+
+  if (info->x_char) {           /* XON/XOFF chars */
+    dz_out (info, DZ_TDR, info->x_char);
+    info->icount.tx++;
+    info->x_char = 0;
+    return;
+  }
+
+  /* if nothing to do or stopped or hardware stopped */
+  if ((info->xmit_cnt <= 0) || info->tty->stopped || info->tty->hw_stopped) {
+    dz_stop (info->tty);
+    return;
+  }
+
+  /* if something to do ... (rember the dz has no output fifo so we go one char at a time :-< */
+  tmp = (unsigned short)info->xmit_buf[info->xmit_tail++];
+  dz_out (info, DZ_TDR, tmp);
+  info->xmit_tail = info->xmit_tail & (DZ_XMIT_SIZE - 1);
+  info->icount.tx++;
+
+  if (--info->xmit_cnt < WAKEUP_CHARS)
+    dz_sched_event (info, DZ_EVENT_WRITE_WAKEUP);
+
+
+  /* Are we done */
+  if (info->xmit_cnt <= 0) dz_stop (info->tty);
+}
+
+/*
+ * ------------------------------------------------------------
+ * check_modem_status ()
+ *
+ * Only valid for the MODEM line duh !
+ * ------------------------------------------------------------
+ */
+static inline void check_modem_status (struct dz_serial *info)
+{
+  unsigned short status;
+
+  /* if not ne modem line just return */
+  if (info->line != DZ_MODEM) return;
+
+  status = dz_in (info, DZ_MSR);
+  
+  /* it's easy, since DSR2 is the only bit in the register */
+  if (status) info->icount.dsr++;
+}
+
+/*
+ * ------------------------------------------------------------
+ * dz_interrupt ()
+ *
+ * this is the main interrupt routine for the DZ chip.
+ * It deals with the multiple ports.
+ * ------------------------------------------------------------
+ */
+static void dz_interrupt (int irq, void *dev, struct pt_regs *regs)
+{
+  struct dz_serial *info;
+  unsigned short status;
+
+  status = dz_in ((struct dz_serial *)dev, DZ_CSR); /* get the reason why we just got an irq */
+  info = lines[LINE(status)];     /* re-arrange info the proper port */
+
+  if (status & DZ_RDONE) 
+      receive_chars (info);          /* the receive function */
+
+  if (status & DZ_TRDY) 
+    transmit_chars (info);
+}
+
+/*
+ * -------------------------------------------------------------------
+ * Here ends the DZ interrupt routines.
+ * -------------------------------------------------------------------
+ */
+
+/*
+ * This routine is used to handle the "bottom half" processing for the
+ * serial driver, known also the "software interrupt" processing.
+ * This processing is done at the kernel interrupt level, after the
+ * rs_interrupt() has returned, BUT WITH INTERRUPTS TURNED ON.  This
+ * is where time-consuming activities which can not be done in the
+ * interrupt driver proper are done; the interrupt driver schedules
+ * them using rs_sched_event(), and they get done here.
+ */
+static void do_serial_bh (void)
+{
+        run_task_queue (&tq_serial);
+}
+
+static void do_softint (void *private_data)
+{
+  struct dz_serial *info = (struct dz_serial *)private_data;
+  struct tty_struct *tty = info->tty;
+
+  if (!tty) return;
+
+  if (test_and_clear_bit (DZ_EVENT_WRITE_WAKEUP, &info->event)) {
+    if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && tty->ldisc.write_wakeup)
+      (tty->ldisc.write_wakeup) (tty);
+    wake_up_interruptible (&tty->write_wait);
+  }
+}
+
+/*
+ * -------------------------------------------------------------------
+ * This routine is called from the scheduler tqueue when the interrupt
+ * routine has signalled that a hangup has occurred.  The path of
+ * hangup processing is:
+ *
+ *      serial interrupt routine -> (scheduler tqueue) ->
+ *      do_serial_hangup() -> tty->hangup() -> rs_hangup()
+ * ------------------------------------------------------------------- 
+ */
+static void do_serial_hangup (void *private_data)
+{
+  struct dz_serial *info = (struct dz_serial *)private_data;
+  struct tty_struct *tty = info->tty;;
+        
+  if (!tty) return;
+
+  tty_hangup (tty);
+}
+
+/*
+ * -------------------------------------------------------------------
+ * startup ()
+ *
+ * various initialization tasks
+ * ------------------------------------------------------------------- 
+ */
+static int startup (struct dz_serial *info)
+{
+  unsigned long page, flags;
+  unsigned short tmp;
+
+  if (info->is_initialized) return 0;
+  
+  save_flags (flags);
+  cli ();
+
+  if (!info->port) {
+    if (info->tty) set_bit (TTY_IO_ERROR, &info->tty->flags);
+    restore_flags (flags);
+    return -ENODEV;
+  }
+
+  if (!info->xmit_buf) {
+    page = get_free_page (GFP_KERNEL);
+    if (!page) {
+      restore_flags (flags);
+      return -ENOMEM;
+    }
+    info->xmit_buf = (unsigned char *)page;
+  }
+
+  if (info->tty) clear_bit (TTY_IO_ERROR, &info->tty->flags);
+
+  /* enable the interrupt and the scanning */
+  tmp = dz_in (info, DZ_CSR);
+  tmp |= (DZ_RIE | DZ_TIE | DZ_MSE);
+  dz_out (info, DZ_CSR, tmp);
+
+  info->xmit_cnt = info->xmit_head = info->xmit_tail = 0;
+
+  /* set up the speed */
+  change_speed (info);
+
+  /* clear the line transmitter buffer 
+     I can't figure out why I need to do this - but
+     its necessary - in order for the console portion
+     and the interrupt portion to live happily side by side.
+  */
+
+  /* clear the line transmitter buffer 
+     I can't figure out why I need to do this - but
+     its necessary - in order for the console portion
+     and the interrupt portion to live happily side by side.
+  */
+
+  info->is_initialized = 1;
+
+  restore_flags (flags);
+  return 0;
+}
+
+/* 
+ * -------------------------------------------------------------------
+ * shutdown ()
+ *
+ * This routine will shutdown a serial port; interrupts are disabled, and
+ * DTR is dropped if the hangup on close termio flag is on.
+ * ------------------------------------------------------------------- 
+ */
+static void shutdown (struct dz_serial *info)
+{
+  unsigned long flags;
+  unsigned short tmp;
+
+  if (!info->is_initialized) return;
+
+  save_flags (flags);
+  cli ();
+
+  dz_stop (info->tty);
+
+
+
+  info->cflags &= ~DZ_CREAD;          /* turn off receive enable flag */
+  dz_out (info, DZ_LPR, info->cflags);
+
+  if (info->xmit_buf) {               /* free Tx buffer */
+    free_page ((unsigned long)info->xmit_buf);
+    info->xmit_buf = 0;
+  }
+
+  if (!info->tty || (info->tty->termios->c_cflag & HUPCL)) {
+    tmp = dz_in (info, DZ_TCR);
+    if (tmp & DZ_MODEM_DTR) {
+      tmp &= ~DZ_MODEM_DTR;
+      dz_out (info, DZ_TCR, tmp);
+    }
+  }
+
+  if (info->tty) set_bit (TTY_IO_ERROR, &info->tty->flags);
+
+  info->is_initialized = 0;
+  restore_flags (flags);
+}
+
+/* 
+ * -------------------------------------------------------------------
+ * change_speed ()
+ *
+ * set the baud rate.
+ * ------------------------------------------------------------------- 
+ */
+static void change_speed (struct dz_serial *info)
+{
+  unsigned long flags;
+  unsigned cflag;
+  int baud;
+
+  if (!info->tty || !info->tty->termios) return;
+  
+  save_flags (flags);
+  cli ();
+  
+  info->cflags = info->line;
+
+  cflag = info->tty->termios->c_cflag;
+
+  switch (cflag & CSIZE) {
+  case CS5: info->cflags |= DZ_CS5; break;
+  case CS6: info->cflags |= DZ_CS6; break;
+  case CS7: info->cflags |= DZ_CS7; break;
+  case CS8: 
+  default:  info->cflags |= DZ_CS8;
+  }
+
+  if (cflag & CSTOPB) info->cflags |= DZ_CSTOPB;
+  if (cflag & PARENB) info->cflags |= DZ_PARENB;
+  if (cflag & PARODD) info->cflags |= DZ_PARODD;
+  
+  baud = tty_get_baud_rate (info->tty);
+  switch (baud) {
+  case 50  :  info->cflags |= DZ_B50;   break;
+  case 75  :  info->cflags |= DZ_B75;   break;
+  case 110 :  info->cflags |= DZ_B110;  break;
+  case 134 :  info->cflags |= DZ_B134;  break; 
+  case 150 :  info->cflags |= DZ_B150;  break;
+  case 300 :  info->cflags |= DZ_B300;  break; 
+  case 600 :  info->cflags |= DZ_B600;  break;
+  case 1200:  info->cflags |= DZ_B1200; break; 
+  case 1800:  info->cflags |= DZ_B1800; break;
+  case 2000:  info->cflags |= DZ_B2000; break;
+  case 2400:  info->cflags |= DZ_B2400; break;
+  case 3600:  info->cflags |= DZ_B3600; break; 
+  case 4800:  info->cflags |= DZ_B4800; break;
+  case 7200:  info->cflags |= DZ_B7200; break; 
+  case 9600: 
+  default  :  info->cflags |= DZ_B9600; 
+  }
+
+  info->cflags |= DZ_RXENAB;
+  dz_out (info, DZ_LPR, info->cflags);
+
+  /* setup accept flag */
+  info->read_status_mask = DZ_OERR;
+  if (I_INPCK(info->tty))
+   info->read_status_mask |= (DZ_FERR | DZ_PERR); 
+  
+  /* characters to ignore */
+  info->ignore_status_mask = 0;
+  if (I_IGNPAR(info->tty))
+    info->ignore_status_mask |= (DZ_FERR | DZ_PERR);
+
+  restore_flags (flags);
+}
+
+/* 
+ * -------------------------------------------------------------------
+ * dz_flush_char ()
+ *
+ * Flush the buffer.
+ * ------------------------------------------------------------------- 
+ */
+static void dz_flush_chars (struct tty_struct *tty)
+{
+  struct dz_serial *info = (struct dz_serial *)tty->driver_data;
+  unsigned long flags;
+
+ if (info->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped || !info->xmit_buf)
+    return;
+
+ save_flags (flags);
+ cli ();  
+
+ dz_start (info->tty);
+
+ restore_flags (flags);
+}
+
+
+/* 
+ * -------------------------------------------------------------------
+ * dz_write ()
+ *
+ * main output routine.
+ * ------------------------------------------------------------------- 
+ */
+static int dz_write (struct tty_struct *tty, int from_user, const unsigned char *buf, int count)
+{
+  struct dz_serial *info = (struct dz_serial *)tty->driver_data;
+  unsigned long flags;
+  int c, ret = 0;
+
+  if (!tty ) return ret;
+  if (!info->xmit_buf) return ret;
+  if (!tmp_buf) tmp_buf = tmp_buffer;
+
+
+
+  if (from_user) {
+
+    down (&tmp_buf_sem);
+    while (1) {
+      c = MIN(count, MIN(DZ_XMIT_SIZE - info->xmit_cnt - 1, DZ_XMIT_SIZE - info->xmit_head));
+      if (c <= 0) break;
+
+      c -= copy_from_user (tmp_buf, buf, c);
+      if (!c) {
+        if (!ret) ret = -EFAULT;
+        break;
+      }
+
+      save_flags (flags);
+      cli ();
+
+      c = MIN(c, MIN(DZ_XMIT_SIZE - info->xmit_cnt - 1, DZ_XMIT_SIZE - info->xmit_head));
+      memcpy(info->xmit_buf + info->xmit_head, tmp_buf, c);
+      info->xmit_head = ((info->xmit_head + c) & (DZ_XMIT_SIZE-1));
+      info->xmit_cnt += c;
+
+      restore_flags(flags);
+
+      buf += c;
+      count -= c;
+      ret += c;
+    }
+    
+    up (&tmp_buf_sem);
+  } else {
+
+
+    while (1) {
+      save_flags (flags);
+      cli ();     
+
+      c = MIN(count, MIN(DZ_XMIT_SIZE - info->xmit_cnt - 1, DZ_XMIT_SIZE - info->xmit_head));
+      if (c <= 0) {
+        restore_flags (flags);
+        break;
+      }
+      memcpy (info->xmit_buf + info->xmit_head, buf, c);
+      info->xmit_head = ((info->xmit_head + c) & (DZ_XMIT_SIZE-1));
+      info->xmit_cnt += c;
+
+      restore_flags (flags);
+
+      buf += c;
+      count -= c;
+      ret += c;
+    }
+  }
+
+
+  if (info->xmit_cnt)
+    {
+      if (!tty->stopped) 
+	{
+	  if (!tty->hw_stopped)
+	    {
+	      dz_start (info->tty);
+	    }
+	}
+    }
+  return ret;
+}
+
+/* 
+ * -------------------------------------------------------------------
+ * dz_write_room ()
+ *
+ * compute the amount of space available for writing.
+ * ------------------------------------------------------------------- 
+ */
+static int dz_write_room (struct tty_struct *tty)
+{
+  struct dz_serial *info = (struct dz_serial *)tty->driver_data;
+  int ret;
+                                
+  ret = DZ_XMIT_SIZE - info->xmit_cnt - 1;
+  if (ret < 0) ret = 0;
+  return ret;
+}
+
+/* 
+ * -------------------------------------------------------------------
+ * dz_chars_in_buffer ()
+ *
+ * compute the amount of char left to be transmitted
+ * ------------------------------------------------------------------- 
+ */
+static int dz_chars_in_buffer (struct tty_struct *tty)
+{
+  struct dz_serial *info = (struct dz_serial *)tty->driver_data;
+  
+  return info->xmit_cnt;
+}
+
+/* 
+ * -------------------------------------------------------------------
+ * dz_flush_buffer ()
+ *
+ * Empty the output buffer
+ * ------------------------------------------------------------------- 
+ */
+static void dz_flush_buffer (struct tty_struct *tty)
+{
+  struct dz_serial *info = (struct dz_serial *)tty->driver_data;
+                                
+  cli ();
+  info->xmit_cnt = info->xmit_head = info->xmit_tail = 0;
+  sti ();
+
+  wake_up_interruptible (&tty->write_wait);
+
+  if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && tty->ldisc.write_wakeup)
+    (tty->ldisc.write_wakeup)(tty);
+}
+
+/*
+ * ------------------------------------------------------------
+ * dz_throttle () and dz_unthrottle ()
+ * 
+ * This routine is called by the upper-layer tty layer to signal that
+ * incoming characters should be throttled (or not).
+ * ------------------------------------------------------------
+ */
+static void dz_throttle (struct tty_struct *tty)
+{
+  struct dz_serial *info = (struct dz_serial *)tty->driver_data;  
+
+  if (I_IXOFF(tty))
+    info->x_char = STOP_CHAR(tty);
+}
+
+static void dz_unthrottle (struct tty_struct *tty)
+{
+  struct dz_serial *info = (struct dz_serial *)tty->driver_data;  
+
+  if (I_IXOFF(tty)) {
+    if (info->x_char)
+      info->x_char = 0;
+    else
+      info->x_char = START_CHAR(tty);
+  }
+}
+
+static void dz_send_xchar (struct tty_struct *tty, char ch)
+{
+  struct dz_serial *info = (struct dz_serial *)tty->driver_data;
+
+  info->x_char = ch;
+
+  if (ch) dz_start (info->tty);
+}
+
+/*
+ * ------------------------------------------------------------
+ * rs_ioctl () and friends
+ * ------------------------------------------------------------
+ */
+static int get_serial_info (struct dz_serial *info, struct serial_struct *retinfo)
+{
+  struct serial_struct tmp;
+  
+  if (!retinfo)
+    return -EFAULT;
+
+  memset (&tmp, 0, sizeof(tmp));
+
+  tmp.type = info->type;
+  tmp.line = info->line;
+  tmp.port = info->port;
+  tmp.irq = SERIAL;
+  tmp.flags = info->flags;
+  tmp.baud_base = info->baud_base;
+  tmp.close_delay = info->close_delay;
+  tmp.closing_wait = info->closing_wait;
+  
+  return copy_to_user (retinfo, &tmp, sizeof(*retinfo));
+}
+
+static int set_serial_info (struct dz_serial *info, struct serial_struct *new_info)
+{
+  struct serial_struct new_serial;
+  struct dz_serial old_info;
+  int retval = 0;
+
+  if (!new_info)
+    return -EFAULT;
+
+  copy_from_user (&new_serial, new_info, sizeof(new_serial));
+  old_info = *info;
+
+  if (!suser())
+    return -EPERM;
+
+  if (info->count > 1)
+    return -EBUSY;
+
+  /*
+   * OK, past this point, all the error checking has been done.
+   * At this point, we start making changes.....
+   */
+  
+  info->baud_base = new_serial.baud_base;
+  info->type = new_serial.type;
+  info->close_delay = new_serial.close_delay;
+  info->closing_wait = new_serial.closing_wait;
+
+  retval = startup (info);
+  return retval;
+}
+
+/*
+ * get_lsr_info - get line status register info
+ *
+ * Purpose: Let user call ioctl() to get info when the UART physically
+ *          is emptied.  On bus types like RS485, the transmitter must
+ *          release the bus after transmitting. This must be done when
+ *          the transmit shift register is empty, not be done when the
+ *          transmit holding register is empty.  This functionality
+ *          allows an RS485 driver to be written in user space. 
+ */
+static int get_lsr_info (struct dz_serial *info, unsigned int *value)
+{
+  unsigned short status = dz_in (info, DZ_LPR);
+
+  return put_user (status, value);
+}
+
+/*
+ * This routine sends a break character out the serial port.
+ */
+static void send_break (struct dz_serial *info, int duration)
+{
+  unsigned long flags;
+  unsigned short tmp, mask;
+
+  if (!info->port)
+    return;
+
+  mask = 1 << info->line;
+  tmp = dz_in (info, DZ_TCR);
+  tmp |= mask;
+
+  current->state = TASK_INTERRUPTIBLE;
+
+  save_flags (flags);
+  cli();
+  
+  dz_out (info, DZ_TCR, tmp);
+  
+  schedule_timeout(jiffies + duration);
+  
+  tmp &= ~mask;
+  dz_out (info, DZ_TCR, tmp);
+  
+  restore_flags (flags);
+}
+
+static int dz_ioctl (struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg)
+{
+  int error;
+  struct dz_serial * info = (struct dz_serial *)tty->driver_data;
+  int retval;
+
+  if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) &&
+      (cmd != TIOCSERCONFIG) && (cmd != TIOCSERGWILD)  &&
+      (cmd != TIOCSERSWILD) && (cmd != TIOCSERGSTRUCT)) {
+    if (tty->flags & (1 << TTY_IO_ERROR))
+      return -EIO;
+  }
+
+  switch (cmd) {
+  case TCSBRK:    /* SVID version: non-zero arg --> no break */
+    retval = tty_check_change (tty);
+    if (retval)
+      return retval;
+    tty_wait_until_sent (tty, 0);
+    if (!arg)
+      send_break (info, HZ/4); /* 1/4 second */
+    return 0;
+
+  case TCSBRKP:   /* support for POSIX tcsendbreak() */
+    retval = tty_check_change (tty);
+    if (retval)
+      return retval;
+    tty_wait_until_sent (tty, 0);
+    send_break (info, arg ? arg*(HZ/10) : HZ/4);
+    return 0;
+
+  case TIOCGSOFTCAR:
+    error = verify_area (VERIFY_WRITE, (void *)arg, sizeof(long));
+    if (error)
+      return error;
+    put_user (C_CLOCAL(tty) ? 1 : 0, (unsigned long *)arg);
+    return 0;
+
+  case TIOCSSOFTCAR:
+    error = get_user (arg, (unsigned long *)arg);
+    if (error)
+      return error;
+    tty->termios->c_cflag = ((tty->termios->c_cflag & ~CLOCAL) | (arg ? CLOCAL : 0));
+    return 0;
+
+  case TIOCGSERIAL:
+    error = verify_area (VERIFY_WRITE, (void *)arg, sizeof(struct serial_struct));
+    if (error)
+      return error;
+    return get_serial_info (info, (struct serial_struct *)arg);
+
+  case TIOCSSERIAL:
+    return set_serial_info (info, (struct serial_struct *) arg);
+
+  case TIOCSERGETLSR: /* Get line status register */
+    error = verify_area (VERIFY_WRITE, (void *)arg, sizeof(unsigned int));
+    if (error)
+      return error;
+    else
+      return get_lsr_info (info, (unsigned int *)arg);
+
+  case TIOCSERGSTRUCT:
+    error = verify_area (VERIFY_WRITE, (void *)arg, sizeof(struct dz_serial));
+    if (error)
+      return error;
+    copy_to_user((struct dz_serial *)arg, info, sizeof(struct dz_serial));
+    return 0;
+    
+  default:
+    return -ENOIOCTLCMD;
+  }
+
+  return 0;
+}
+
+static void dz_set_termios (struct tty_struct *tty,
+			    struct termios *old_termios)
+{
+  struct dz_serial *info = (struct dz_serial *)tty->driver_data;
+
+  if (tty->termios->c_cflag == old_termios->c_cflag)
+    return;
+
+  change_speed (info);
+
+  if ((old_termios->c_cflag & CRTSCTS) &&
+      !(tty->termios->c_cflag & CRTSCTS)) {
+    tty->hw_stopped = 0;
+    dz_start (tty);
+  }
+}
+
+/*
+ * ------------------------------------------------------------
+ * dz_close()
+ * 
+ * This routine is called when the serial port gets closed.  First, we
+ * wait for the last remaining data to be sent.  Then, we turn off
+ * the transmit enable and receive enable flags.
+ * ------------------------------------------------------------
+ */
+static void dz_close (struct tty_struct *tty, struct file *filp)
+{
+  struct dz_serial * info = (struct dz_serial *)tty->driver_data;
+  unsigned long flags;
+
+  if (!info) return;
+        
+  save_flags (flags); 
+  cli();
+        
+  if (tty_hung_up_p (filp)) {
+    restore_flags (flags);
+    return;
+  }
+
+  if ((tty->count == 1) && (info->count != 1)) {
+    /*
+     * Uh, oh.  tty->count is 1, which means that the tty
+     * structure will be freed.  Info->count should always
+     * be one in these conditions.  If it's greater than
+     * one, we've got real problems, since it means the
+     * serial port won't be shutdown.
+     */
+    printk("dz_close: bad serial port count; tty->count is 1, "
+                       "info->count is %d\n", info->count);
+                info->count = 1;
+  }
+
+  if (--info->count < 0) {
+    printk("rs_close: bad serial port count for ttys%d: %d\n",
+	   info->line, info->count);
+    info->count = 0;
+  }
+
+  if (info->count) {
+    restore_flags (flags);
+    return;
+  }
+  info->flags |= DZ_CLOSING;
+  /*
+   * Save the termios structure, since this port may have
+   * separate termios for callout and dialin.
+   */
+  if (info->flags & DZ_NORMAL_ACTIVE)
+    info->normal_termios = *tty->termios;
+  if (info->flags & DZ_CALLOUT_ACTIVE)
+    info->callout_termios = *tty->termios;
+  /*
+   * Now we wait for the transmit buffer to clear; and we notify 
+   * the line discipline to only process XON/XOFF characters.
+   */
+  tty->closing = 1;
+
+  if (info->closing_wait != DZ_CLOSING_WAIT_NONE)
+    tty_wait_until_sent (tty, info->closing_wait);
+
+  /*
+   * At this point we stop accepting input.  To do this, we
+   * disable the receive line status interrupts.
+   */
+
+  shutdown (info);
+
+  if (tty->driver.flush_buffer)
+    tty->driver.flush_buffer (tty);
+  if (tty->ldisc.flush_buffer)
+    tty->ldisc.flush_buffer (tty);
+  tty->closing = 0;
+  info->event = 0;
+  info->tty = 0;
+
+  if (tty->ldisc.num != ldiscs[N_TTY].num) {
+    if (tty->ldisc.close)
+      (tty->ldisc.close)(tty);
+    tty->ldisc = ldiscs[N_TTY];
+    tty->termios->c_line = N_TTY;
+    if (tty->ldisc.open)
+      (tty->ldisc.open)(tty);
+  }
+  if (info->blocked_open) {
+    if (info->close_delay) {
+      current->state = TASK_INTERRUPTIBLE;
+      schedule_timeout(jiffies + info->close_delay);
+    }
+    wake_up_interruptible (&info->open_wait);
+  }
+
+  info->flags &= ~(DZ_NORMAL_ACTIVE | DZ_CALLOUT_ACTIVE | DZ_CLOSING);
+  wake_up_interruptible (&info->close_wait);
+
+  restore_flags (flags);
+}
+
+/*
+ * dz_hangup () --- called by tty_hangup() when a hangup is signaled.
+ */
+static void dz_hangup (struct tty_struct *tty)
+{
+  struct dz_serial *info = (struct dz_serial *)tty->driver_data;
+  
+  dz_flush_buffer (tty);
+  shutdown (info);
+  info->event = 0;
+  info->count = 0;
+  info->flags &= ~(DZ_NORMAL_ACTIVE | DZ_CALLOUT_ACTIVE);
+  info->tty = 0;
+  wake_up_interruptible (&info->open_wait);
+}
+
+/*
+ * ------------------------------------------------------------
+ * rs_open() and friends
+ * ------------------------------------------------------------
+ */
+static int block_til_ready (struct tty_struct *tty, struct file *filp, struct dz_serial *info)
+{
+  struct wait_queue wait = { current, NULL };
+  int retval;
+  int do_clocal = 0;
+
+  /*
+   * If the device is in the middle of being closed, then block
+   * until it's done, and then try again.
+   */
+  if (info->flags & DZ_CLOSING) {
+    interruptible_sleep_on (&info->close_wait);
+    return -EAGAIN;
+  }
+
+  /*
+   * If this is a callout device, then just make sure the normal
+   * device isn't being used.
+   */
+  if (tty->driver.subtype == SERIAL_TYPE_CALLOUT) {
+    if (info->flags & DZ_NORMAL_ACTIVE)
+      return -EBUSY;
+    
+    if ((info->flags & DZ_CALLOUT_ACTIVE) &&
+	(info->flags & DZ_SESSION_LOCKOUT) &&
+	(info->session != current->session))
+      return -EBUSY;
+    
+    if ((info->flags & DZ_CALLOUT_ACTIVE) &&
+	(info->flags & DZ_PGRP_LOCKOUT) &&
+	(info->pgrp != current->pgrp))
+      return -EBUSY;
+    info->flags |= DZ_CALLOUT_ACTIVE;
+    return 0;
+  }
+
+  /*
+   * If non-blocking mode is set, or the port is not enabled,
+   * then make the check up front and then exit.
+   */
+  if ((filp->f_flags & O_NONBLOCK) ||
+      (tty->flags & (1 << TTY_IO_ERROR))) {
+    if (info->flags & DZ_CALLOUT_ACTIVE)
+      return -EBUSY;
+    info->flags |= DZ_NORMAL_ACTIVE;
+    return 0;
+  }
+
+  if (info->flags & DZ_CALLOUT_ACTIVE) {
+    if (info->normal_termios.c_cflag & CLOCAL)
+      do_clocal = 1;
+  } else {
+    if (tty->termios->c_cflag & CLOCAL)
+      do_clocal = 1;
+  }
+
+  /*
+   * Block waiting for the carrier detect and the line to become
+   * free (i.e., not in use by the callout).  While we are in
+   * this loop, info->count is dropped by one, so that
+   * dz_close() knows when to free things.  We restore it upon
+   * exit, either normal or abnormal.
+   */
+  retval = 0;
+  add_wait_queue (&info->open_wait, &wait);
+
+  info->count--;
+  info->blocked_open++;
+  while (1) {
+    current->state = TASK_INTERRUPTIBLE;
+    if (tty_hung_up_p (filp) || !(info->is_initialized)) {
+      retval = -EAGAIN;
+      break;
+    }
+    if (!(info->flags & DZ_CALLOUT_ACTIVE) &&
+	!(info->flags & DZ_CLOSING) && do_clocal)
+      break;
+    if (signal_pending (current)) {
+      retval = -ERESTARTSYS;
+      break;
+    }
+    schedule();
+  }
+		
+  current->state = TASK_RUNNING;
+  remove_wait_queue (&info->open_wait, &wait);
+  if (!tty_hung_up_p(filp))
+    info->count++;
+  info->blocked_open--;
+
+  if (retval)
+    return retval;
+  info->flags |= DZ_NORMAL_ACTIVE;
+  return 0;
+}       
+
+/*
+ * This routine is called whenever a serial port is opened.  It
+ * enables interrupts for a serial port. It also performs the 
+ * serial-specific initialization for the tty structure.
+ */
+static int dz_open (struct tty_struct *tty, struct file *filp)
+{
+  struct dz_serial *info;
SHAR_EOF
true || echo 'restore of patch-2.3.9 failed'
fi
echo 'End of  part 11'
echo 'File patch-2.3.9 is continued in part 12'
echo 12 > _shar_seq_.tmp
exit 0
#!/bin/sh
# this is part 12 of a 26 - part archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file patch-2.3.9 continued
if test ! -r _shar_seq_.tmp; then
        echo 'Please unpack part 1 first!'
        exit 1
fi
(read Scheck
if test "$Scheck" != 12; then
        echo Please unpack part "$Scheck" next!
        exit 1
 else
        exit 0
 fi
) < _shar_seq_.tmp || exit 1
if test ! -f _shar_wnt_.tmp; then
echo 'x - still skipping patch-2.3.9'
else
echo 'x - continuing with patch-2.3.9'
sed 's/^X//' << 'SHAR_EOF' >> 'patch-2.3.9' &&
+  int retval, line;
+
+  line = MINOR(tty->device) - tty->driver.minor_start;
+
+  /* The dz lines for the mouse/keyboard must be
+   * opened using their respective drivers.
+   */
+  if ((line < 0) || (line >= DZ_NB_PORT))
+    return -ENODEV;
+
+  if ((line == DZ_KEYBOARD) || (line == DZ_MOUSE))
+    return -ENODEV;
+
+  info = lines[line];
+  info->count++;
+
+  tty->driver_data = info;
+  info->tty = tty;
+
+  /*
+   * Start up serial port
+   */
+  retval = startup (info);
+  if (retval)
+    return retval;
+
+
+
+  retval = block_til_ready (tty, filp, info);
+  if (retval)
+    return retval;
+
+  if ((info->count == 1) && (info->flags & DZ_SPLIT_TERMIOS)) {
+    if (tty->driver.subtype == SERIAL_TYPE_NORMAL)
+      *tty->termios = info->normal_termios;
+    else 
+      *tty->termios = info->callout_termios;
+    change_speed (info);
+
+  }
+
+  info->session = current->session;
+  info->pgrp = current->pgrp;
+  return 0;
+}
+
+static void show_serial_version (void)
+{
+  printk("%s%s\n", dz_name, dz_version);
+}
+
+
+__initfunc(int dz_init(void))
+{
+  int i, flags;
+  struct dz_serial *info;
+
+  /* Setup base handler, and timer table. */
+  init_bh (SERIAL_BH, do_serial_bh);
+
+  show_serial_version ();
+
+  memset(&serial_driver, 0, sizeof(struct tty_driver));
+  serial_driver.magic = TTY_DRIVER_MAGIC;
+  serial_driver.name = "ttyS";
+  serial_driver.major = TTY_MAJOR;
+  serial_driver.minor_start = 64;
+  serial_driver.num = DZ_NB_PORT;
+  serial_driver.type = TTY_DRIVER_TYPE_SERIAL;
+  serial_driver.subtype = SERIAL_TYPE_NORMAL;
+  serial_driver.init_termios = tty_std_termios;
+
+  serial_driver.init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL;
+  serial_driver.flags = TTY_DRIVER_REAL_RAW;
+  serial_driver.refcount = &serial_refcount;
+  serial_driver.table = serial_table;
+  serial_driver.termios = serial_termios;
+  serial_driver.termios_locked = serial_termios_locked;
+
+  serial_driver.open = dz_open;
+  serial_driver.close = dz_close;
+  serial_driver.write = dz_write;
+  serial_driver.flush_chars = dz_flush_chars;
+  serial_driver.write_room = dz_write_room;
+  serial_driver.chars_in_buffer = dz_chars_in_buffer;
+  serial_driver.flush_buffer = dz_flush_buffer;
+  serial_driver.ioctl = dz_ioctl;
+  serial_driver.throttle = dz_throttle;
+  serial_driver.unthrottle = dz_unthrottle;
+  serial_driver.send_xchar = dz_send_xchar;
+  serial_driver.set_termios = dz_set_termios;
+  serial_driver.stop = dz_stop;
+  serial_driver.start = dz_start;
+  serial_driver.hangup = dz_hangup;
+
+  /*
+   * The callout device is just like normal device except for
+   * major number and the subtype code.
+   */
+  callout_driver = serial_driver;
+  callout_driver.name = "cua";
+  callout_driver.major = TTYAUX_MAJOR;
+  callout_driver.subtype = SERIAL_TYPE_CALLOUT;
+
+  if (tty_register_driver (&serial_driver))
+    panic("Couldn't register serial driver\n");
+  if (tty_register_driver (&callout_driver))
+    panic("Couldn't register callout driver\n");
+  save_flags(flags); cli();
+ 
+  i = 0;
+  for (info = &multi[i]; i < DZ_NB_PORT;  i++) 
+    {
+      lines[i] = info;
+    info->magic = SERIAL_MAGIC;
+
+      if ((mips_machtype == MACH_DS23100) || (mips_machtype == MACH_DS5100)) 
+      info->port = (unsigned long) KN01_DZ11_BASE;
+      else 
+      info->port = (unsigned long) KN02_DZ11_BASE;
+
+    info->line = i;
+    info->tty = 0;
+    info->close_delay = 50;
+    info->closing_wait = 3000;
+    info->x_char = 0;
+    info->event = 0;
+    info->count = 0;
+    info->blocked_open = 0;
+    info->tqueue.routine = do_softint;
+    info->tqueue.data = info;
+    info->tqueue_hangup.routine = do_serial_hangup;
+    info->tqueue_hangup.data = info;
+    info->callout_termios = callout_driver.init_termios;
+    info->normal_termios = serial_driver.init_termios;
+    info->open_wait = 0;
+    info->close_wait = 0;
+
+    /* If we are pointing to address zero then punt - not correctly
+       set up in setup.c to handle this. */
+    if (! info->port)
+      return 0;
+
+    printk("ttyS%02d at 0x%04x (irq = %d)\n", info->line, info->port, SERIAL);
+  }
+
+  /* reset the chip */
+#ifndef CONFIG_SERIAL_CONSOLE
+  dz_out(info, DZ_CSR, DZ_CLR);
+  while ((tmp = dz_in(info,DZ_CSR)) & DZ_CLR) ;
+  wbflush();
+  
+  /* enable scanning */
+   dz_out(info, DZ_CSR, DZ_MSE); 
+#endif
+  
+  /* order matters here... the trick is that flags
+     is updated... in request_irq - to immediatedly obliterate
+     it is unwise. */
+  restore_flags(flags);
+ 
+
+  if (request_irq (SERIAL, dz_interrupt, SA_INTERRUPT, "DZ", lines[0]))
+    panic ("Unable to register DZ interrupt\n");
+ 
+  return 0;
+}
+
+#ifdef CONFIG_SERIAL_CONSOLE
+static void dz_console_put_char (unsigned char ch)
+{
+  long flags;
+  int  loops = 2500;
+  unsigned short tmp = ch;
+  /* this code sends stuff out to serial device - spinning its
+      wheels and waiting. */
+
+  /* force the issue - point it at lines[3]*/
+  dz_console=&multi[CONSOLE_LINE];
+
+  save_flags(flags);
+  cli();
+  
+
+  /* spin our wheels */
+  while (((dz_in(dz_console,DZ_TCR) & DZ_TRDY) != DZ_TRDY) &&  loops--)
+    ;
+  
+  /* Actually transmit the character. */
+  dz_out (dz_console, DZ_TDR, tmp);
+
+  restore_flags(flags); 
+}
+/* 
+ * -------------------------------------------------------------------
+ * dz_console_print ()
+ *
+ * dz_console_print is registered for printk.
+ * ------------------------------------------------------------------- 
+ */
+static void dz_console_print (struct console *cons, 
+			      const char *str, 
+			      unsigned int count)
+{
+#ifdef DEBUG_DZ
+  prom_printf((char *)str);
+#endif
+  while (count--) 
+    {
+    if (*str == '\n')
+	dz_console_put_char ('\r');
+      dz_console_put_char (*str++);
+  }
+}
+
+static int dz_console_wait_key(struct console *co)
+{
+    return 0;
+}
+
+static kdev_t dz_console_device(struct console *c)
+{
+	return MKDEV(TTY_MAJOR, 64 + c->index);
+}
+
+__initfunc(static int dz_console_setup(struct console *co, char *options))
+{
+  	int	baud = 9600;
+	int	bits = 8;
+	int	parity = 'n';
+	int	cflag = CREAD | HUPCL | CLOCAL;
+	char	*s;
+	unsigned short mask,tmp;
+
+	if (options) {
+		baud = simple_strtoul(options, NULL, 10);
+		s = options;
+		while(*s >= '0' && *s <= '9')
+			s++;
+		if (*s)
+			parity = *s++;
+		if (*s)
+			bits   = *s - '0';
+	}
+
+	/*
+	 *	Now construct a cflag setting.
+	 */
+	switch(baud) {
+	case 1200:
+		cflag |= DZ_B1200;
+		break;
+	case 2400:
+		cflag |= DZ_B2400;
+		break;
+	case 4800:
+		cflag |= DZ_B4800;
+		break;
+	case 9600:
+	default:
+		cflag |= DZ_B9600;
+		break;
+	}
+	switch(bits) {
+	case 7:
+		cflag |= DZ_CS7;
+		break;
+	default:
+	case 8:
+		cflag |= DZ_CS8;
+		break;
+	}
+	switch(parity) {
+	case 'o': case 'O':
+		cflag |= DZ_PARODD;
+		break;
+	case 'e': case 'E':
+		cflag |= DZ_PARENB;
+		break;
+	}
+	co->cflag = cflag;
+
+	/* TOFIX: force to console line */
+	dz_console = &multi[CONSOLE_LINE];
+    	if ((mips_machtype == MACH_DS23100) || (mips_machtype == MACH_DS5100)) 
+	dz_console->port = KN01_DZ11_BASE;
+       	else 
+       		dz_console->port = KN02_DZ11_BASE; 
+	dz_console->line = CONSOLE_LINE;
+
+	dz_out(dz_console, DZ_CSR, DZ_CLR);
+	while ((tmp = dz_in(dz_console,DZ_CSR)) & DZ_CLR)
+	  ;
+
+	/* enable scanning */
+	dz_out(dz_console, DZ_CSR, DZ_MSE); 
+
+        /*  Set up flags... */
+	dz_console->cflags = 0;
+	dz_console->cflags |= DZ_B9600;
+	dz_console->cflags |= DZ_CS8;
+	dz_console->cflags |= DZ_PARENB;
+	dz_out (dz_console, DZ_LPR, dz_console->cflags);
+
+
+	mask = 1 << dz_console->line;
+	tmp = dz_in (dz_console, DZ_TCR);       /* read the TX flag */
+	if (!(tmp & mask)) {
+	  tmp |= mask;                   /* set the TX flag */
+	  dz_out (dz_console, DZ_TCR, tmp); 
+	}
+	
+
+	/* TOFIX: force to console line */
+	dz_console = &multi[CONSOLE_LINE];
+    	if ((mips_machtype == MACH_DS23100) || (mips_machtype == MACH_DS5100)) 
+	dz_console->port = KN01_DZ11_BASE;
+       	else 
+       		dz_console->port = KN02_DZ11_BASE; 
+	dz_console->line = CONSOLE_LINE;
+
+	dz_out(dz_console, DZ_CSR, DZ_CLR);
+	while ((tmp = dz_in(dz_console,DZ_CSR)) & DZ_CLR)
+	  ;
+
+	/* enable scanning */
+	dz_out(dz_console, DZ_CSR, DZ_MSE); 
+
+        /*  Set up flags... */
+	dz_console->cflags = 0;
+	dz_console->cflags |= DZ_B9600;
+	dz_console->cflags |= DZ_CS8;
+	dz_console->cflags |= DZ_PARENB;
+	dz_out (dz_console, DZ_LPR, dz_console->cflags);
+
+
+	mask = 1 << dz_console->line;
+	tmp = dz_in (dz_console, DZ_TCR);       /* read the TX flag */
+	if (!(tmp & mask)) {
+	  tmp |= mask;                   /* set the TX flag */
+	  dz_out (dz_console, DZ_TCR, tmp); 
+	}
+	
+
+	return 0;
+}
+
+static struct console dz_sercons = {
+	"ttyS",
+	dz_console_print,
+	NULL,
+	dz_console_device,
+	dz_console_wait_key,
+	NULL,
+	dz_console_setup,
+	CON_CONSDEV | CON_PRINTBUFFER,
+	CONSOLE_LINE,
+	0,
+	NULL
+};
+
+__initfunc (long dz_serial_console_init(long kmem_start, long kmem_end))
+{
+	register_console(&dz_sercons);
+
+	return kmem_start;
+}
+
+#endif /* ifdef CONFIG_SERIAL_CONSOLE */
+
diff -u --recursive --new-file v2.3.8/linux/drivers/char/dz.h linux/drivers/char/dz.h
--- v2.3.8/linux/drivers/char/dz.h	Wed Dec 31 16:00:00 1969
+++ linux/drivers/char/dz.h	Fri Jun 25 17:39:14 1999
@@ -0,0 +1,242 @@
+/*
+ * dz.h: Serial port driver for DECStations equiped 
+ *       with the DZ chipset.
+ *
+ * Copyright (C) 1998 Olivier A. D. Lebaillif 
+ *             
+ * Email: olivier....@ifrsys.com
+ *
+ */
+#ifndef DZ_SERIAL_H
+#define DZ_SERIAL_H
+
+/*
+ * Definitions for the Control and Status Received.
+ */
+#define DZ_TRDY        0x8000                 /* Transmitter empty */
+#define DZ_TIE         0x4000                 /* Transmitter Interrupt Enable */
+#define DZ_RDONE       0x0080                 /* Receiver data ready */
+#define DZ_RIE         0x0040                 /* Receive Interrupt Enable */
+#define DZ_MSE         0x0020                 /* Master Scan Enable */
+#define DZ_CLR         0x0010                 /* Master reset */
+#define DZ_MAINT       0x0008                 /* Loop Back Mode */
+
+/*
+ * Definitions for the Received buffer. 
+ */
+#define DZ_RBUF_MASK   0x00FF                 /* Data Mask in the Receive Buffer */
+#define DZ_LINE_MASK   0x0300                 /* Line Mask in the Receive Buffer */
+#define DZ_DVAL        0x8000                 /* Valid Data indicator */
+#define DZ_OERR        0x4000                 /* Overrun error indicator */
+#define DZ_FERR        0x2000                 /* Frame error indicator */
+#define DZ_PERR        0x1000                 /* Parity error indicator */
+
+#define LINE(x) (x & DZ_LINE_MASK) >> 8       /* Get the line number from the input buffer */
+#define UCHAR(x) (unsigned char)(x & DZ_RBUF_MASK)
+
+/*
+ * Definitions for the Transmit Register.
+ */
+#define DZ_LINE_KEYBOARD 0x0001
+#define DZ_LINE_MOUSE    0x0002
+#define DZ_LINE_MODEM    0x0004
+#define DZ_LINE_PRINTER  0x0008
+
+#define DZ_MODEM_DTR     0x0400               /* DTR for the modem line (2) */
+
+/*
+ * Definitions for the Modem Status Register.
+ */
+#define DZ_MODEM_DSR     0x0200               /* DSR for the modem line (2) */
+
+/*
+ * Definitions for the Transmit Data Register.
+ */
+#define DZ_BRK0          0x0100               /* Break assertion for line 0 */
+#define DZ_BRK1          0x0200               /* Break assertion for line 1 */
+#define DZ_BRK2          0x0400               /* Break assertion for line 2 */
+#define DZ_BRK3          0x0800               /* Break assertion for line 3 */
+
+/*
+ * Definitions for the Line Parameter Register.
+ */
+#define DZ_KEYBOARD      0x0000               /* line 0 = keyboard */
+#define DZ_MOUSE         0x0001               /* line 1 = mouse */
+#define DZ_MODEM         0x0002               /* line 2 = modem */
+#define DZ_PRINTER       0x0003               /* line 3 = printer */
+
+#define DZ_CSIZE         0x0018               /* Number of bits per byte (mask) */
+#define DZ_CS5           0x0000               /* 5 bits per byte */
+#define DZ_CS6           0x0008               /* 6 bits per byte */
+#define DZ_CS7           0x0010               /* 7 bits per byte */
+#define DZ_CS8           0x0018               /* 8 bits per byte */
+
+#define DZ_CSTOPB        0x0020               /* 2 stop bits instead of one */ 
+
+#define DZ_PARENB        0x0040               /* Parity enable */
+#define DZ_PARODD        0x0080               /* Odd parity instead of even */
+
+#define DZ_CBAUD         0x0E00               /* Baud Rate (mask) */
+#define DZ_B50           0x0000
+#define DZ_B75           0x0100
+#define DZ_B110          0x0200
+#define DZ_B134          0x0300
+#define DZ_B150          0x0400
+#define DZ_B300          0x0500
+#define DZ_B600          0x0600
+#define DZ_B1200         0x0700 
+#define DZ_B1800         0x0800
+#define DZ_B2000         0x0900
+#define DZ_B2400         0x0A00
+#define DZ_B3600         0x0B00
+#define DZ_B4800         0x0C00
+#define DZ_B7200         0x0D00
+#define DZ_B9600         0x0E00
+
+#define DZ_CREAD         0x1000               /* Enable receiver */
+#define DZ_RXENAB        0x1000               /* enable receive char */
+/*
+ * Addresses for the DZ registers
+ */
+#define DZ_CSR       0x00            /* Control and Status Register */
+#define DZ_RBUF      0x08            /* Receive Buffer */
+#define DZ_LPR       0x08            /* Line Parameters Register */
+#define DZ_TCR       0x10            /* Transmitter Control Register */
+#define DZ_MSR       0x18            /* Modem Status Register */
+#define DZ_TDR       0x18            /* Transmit Data Register */
+
+
+#define DZ_NB_PORT 4
+
+#define DZ_XMIT_SIZE   4096                 /* buffer size */
+#define WAKEUP_CHARS   DZ_XMIT_SIZE/4
+
+#define DZ_EVENT_WRITE_WAKEUP   0
+
+#ifndef MIN
+#define MIN(a,b)        ((a) < (b) ? (a) : (b))
+
+#define DZ_INITIALIZED       0x80000000 /* Serial port was initialized */
+#define DZ_CALLOUT_ACTIVE    0x40000000 /* Call out device is active */
+#define DZ_NORMAL_ACTIVE     0x20000000 /* Normal device is active */
+#define DZ_BOOT_AUTOCONF     0x10000000 /* Autoconfigure port on bootup */
+#define DZ_CLOSING           0x08000000 /* Serial port is closing */
+#define DZ_CTS_FLOW          0x04000000 /* Do CTS flow control */
+#define DZ_CHECK_CD          0x02000000 /* i.e., CLOCAL */
+
+#define DZ_CLOSING_WAIT_INF  0
+#define DZ_CLOSING_WAIT_NONE 65535
+
+#define DZ_SPLIT_TERMIOS   0x0008 /* Separate termios for dialin/callout */
+#define DZ_SESSION_LOCKOUT 0x0100 /* Lock out cua opens based on session */
+#define DZ_PGRP_LOCKOUT    0x0200 /* Lock out cua opens based on pgrp */
+
+struct dz_serial {
+  unsigned                port;                /* base address for the port */
+  int                     type;
+  int                     flags; 
+  int                     baud_base;
+  int                     blocked_open;
+  unsigned short          close_delay;
+  unsigned short          closing_wait;
+  unsigned short          line;                /* port/line number */
+  unsigned short          cflags;              /* line configuration flag */
+  unsigned short          x_char;              /* xon/xoff character */
+  unsigned short          read_status_mask;    /* mask for read condition */
+  unsigned short          ignore_status_mask;  /* mask for ignore condition */
+  unsigned long           event;               /* mask used in BH */
+  unsigned char           *xmit_buf;           /* Transmit buffer */
+  int                     xmit_head;           /* Position of the head */
+  int                     xmit_tail;           /* Position of the tail */
+  int                     xmit_cnt;            /* Count of the chars in the buffer */
+  int                     count;               /* indicates how many times it has been opened */
+  int                     magic;
+
+  struct async_icount     icount;              /* keep track of things ... */
+  struct tty_struct       *tty;                /* tty associated */
+  struct tq_struct        tqueue;              /* Queue for BH */
+  struct tq_struct        tqueue_hangup;
+  struct termios          normal_termios;
+  struct termios          callout_termios;
+  struct wait_queue       *open_wait;
+  struct wait_queue       *close_wait;
+
+  long                    session;             /* Session of opening process */
+  long                    pgrp;                /* pgrp of opening process */
+
+  unsigned char           is_console;          /* flag indicating a serial console */
+  unsigned char           is_initialized;
+};
+
+static struct dz_serial multi[DZ_NB_PORT];    /* Four serial lines in the DZ chip */
+static struct dz_serial *dz_console;
+static struct tty_driver serial_driver, callout_driver;
+
+static struct tty_struct *serial_table[DZ_NB_PORT];
+static struct termios *serial_termios[DZ_NB_PORT];
+static struct termios *serial_termios_locked[DZ_NB_PORT];
+
+static int serial_refcount;
+
+/*
+ * tmp_buf is used as a temporary buffer by serial_write.  We need to
+ * lock it in case the copy_from_user blocks while swapping in a page,
+ * and some other program tries to do a serial write at the same time.
+ * Since the lock will only come under contention when the system is
+ * swapping and available memory is low, it makes sense to share one
+ * buffer across all the serial ports, since it significantly saves
+ * memory if large numbers of serial ports are open.
+ */
+static unsigned char *tmp_buf;
+static struct semaphore tmp_buf_sem = MUTEX;
+
+static char *dz_name = "DECstation DZ serial driver version ";
+static char *dz_version = "1.02";
+
+static inline unsigned short dz_in (struct dz_serial *, unsigned);
+static inline void dz_out (struct dz_serial *, unsigned, unsigned short);
+
+static inline void dz_sched_event (struct dz_serial *, int);
+static inline void receive_chars (struct dz_serial *);
+static inline void transmit_chars (struct dz_serial *);
+static inline void check_modem_status (struct dz_serial *);
+
+static void dz_stop (struct tty_struct *);
+static void dz_start (struct tty_struct *);
+static void dz_interrupt (int, void *, struct pt_regs *);
+static void do_serial_bh (void);
+static void do_softint (void *);
+static void do_serial_hangup (void *);
+static void change_speed (struct dz_serial *);
+static void dz_flush_chars (struct tty_struct *);
+static void dz_console_print (struct console *, const char *, unsigned int);
+static void dz_flush_buffer (struct tty_struct *);
+static void dz_throttle (struct tty_struct *);
+static void dz_unthrottle (struct tty_struct *);
+static void dz_send_xchar (struct tty_struct *, char);
+static void shutdown (struct dz_serial *);
+static void send_break (struct dz_serial *, int);
+static void dz_set_termios (struct tty_struct *, struct termios *);
+static void dz_close (struct tty_struct *, struct file *);
+static void dz_hangup (struct tty_struct *);
+static void show_serial_version (void);
+
+static int dz_write (struct tty_struct *, int, const unsigned char *, int);
+static int dz_write_room (struct tty_struct *);
+static int dz_chars_in_buffer (struct tty_struct *);
+static int startup (struct dz_serial *);
+static int get_serial_info (struct dz_serial *, struct serial_struct *);
+static int set_serial_info (struct dz_serial *, struct serial_struct *);
+static int get_lsr_info (struct dz_serial *, unsigned int *);
+static int dz_ioctl (struct tty_struct *, struct file *, unsigned int, unsigned long);
+static int block_til_ready (struct tty_struct *, struct file *, struct dz_serial *);
+static int dz_open (struct tty_struct *, struct file *);
+
+#ifdef MODULE
+int init_module (void)
+void cleanup_module (void)
+#endif
+
+#endif
+
+#endif /* DZ_SERIAL_H */
diff -u --recursive --new-file v2.3.8/linux/drivers/char/ftape/lowlevel/ftape-proc.c linux/drivers/char/ftape/lowlevel/ftape-proc.c
--- v2.3.8/linux/drivers/char/ftape/lowlevel/ftape-proc.c	Mon Aug 24 13:02:44 1998
+++ linux/drivers/char/ftape/lowlevel/ftape-proc.c	Sun Jun 27 10:10:41 1999
@@ -112,11 +112,14 @@
X 	NULL,			/* mknod */
X 	NULL,			/* rename */
X 	NULL,			/* readlink */
+	NULL,			/* get_block */
X 	NULL,			/* readpage */
X 	NULL,			/* writepage */
-	NULL,			/* bmap */
+	NULL,			/* flushpage */
X 	NULL,			/* truncate */
X NULL, /* permission */
+	NULL,			/* smap */
+	NULL,			/* revalidate */
X };
X 
X /*
diff -u --recursive --new-file v2.3.8/linux/drivers/char/misc.c linux/drivers/char/misc.c
--- v2.3.8/linux/drivers/char/misc.c	Wed Jun  9 14:44:25 1999
+++ linux/drivers/char/misc.c	Fri Jun 25 17:39:14 1999
@@ -70,6 +70,10 @@
X extern int atari_mouse_init(void);
X extern int sun_mouse_init(void);
X extern int adb_mouse_init(void);
+#ifdef CONFIG_SGI_NEWPORT_GFX
+extern void gfx_register(void);
+#endif
+extern void streamable_init(void);
X extern void watchdog_init(void);
X extern void wdt_init(void);
X extern void acq_init(void);
@@ -271,6 +275,12 @@
X #endif
X #ifdef CONFIG_PMAC_PBOOK
X 	pmu_device_init();
+#endif
+#ifdef CONFIG_SGI_NEWPORT_GFX
+	gfx_register ();
+#endif
+#ifdef CONFIG_SGI
+	streamable_init ();
X #endif
X 	if (register_chrdev(MISC_MAJOR,"misc",&misc_fops)) {
X 		printk("unable to get major %d for misc devices\n",
diff -u --recursive --new-file v2.3.8/linux/drivers/char/serial.c linux/drivers/char/serial.c
--- v2.3.8/linux/drivers/char/serial.c	Thu May 13 14:52:15 1999
+++ linux/drivers/char/serial.c	Tue Jun 22 20:15:10 1999
@@ -103,7 +103,8 @@
X #define RS_STROBE_TIME (10*HZ)
X #define RS_ISR_PASS_LIMIT 256
X 
-#define IRQ_T(info) ((info->flags & ASYNC_SHARE_IRQ) ? SA_SHIRQ : SA_INTERRUPT)
+#define IRQ_T(state) \
+ ((state->flags & ASYNC_SHARE_IRQ) ? SA_SHIRQ : SA_INTERRUPT)
X 
X #define SERIAL_INLINE
X   
@@ -1003,7 +1004,7 @@
X 		} else 
X 			handler = rs_interrupt_single;
X 
-		retval = request_irq(state->irq, handler, IRQ_T(info),
+		retval = request_irq(state->irq, handler, IRQ_T(state),
X 				     "serial", NULL);
X 		if (retval) {
X 			if (capable(CAP_SYS_ADMIN)) {
@@ -1168,7 +1169,7 @@
X 		if (IRQ_ports[state->irq]) {
X 			free_irq(state->irq, NULL);
X 			retval = request_irq(state->irq, rs_interrupt_single,
-					     IRQ_T(info), "serial", NULL);
+					     IRQ_T(state), "serial", NULL);
X 			
X 			if (retval)
X 				printk("serial shutdown: request_irq: error %d"
@@ -2017,7 +2018,7 @@
X 		else
X 			handler = rs_interrupt;
X 
-		retval = request_irq(state->irq, handler, IRQ_T(info),
+		retval = request_irq(state->irq, handler, IRQ_T(state),
X 				     "serial", NULL);
X 		if (retval) {
X 			printk("Couldn't reallocate serial interrupt "
diff -u --recursive --new-file v2.3.8/linux/drivers/char/sysrq.c linux/drivers/char/sysrq.c
--- v2.3.8/linux/drivers/char/sysrq.c	Wed Nov 25 17:25:17 1998
+++ linux/drivers/char/sysrq.c	Tue Jun 29 09:22:08 1999
@@ -155,7 +155,7 @@
X 	struct file *file;
X 
X 	for (file = inuse_filps; file; file = file->f_next)
-		if (file->f_dentry && file->f_count && S_ISREG(file->f_dentry->d_inode->i_mode))
+		if (file->f_dentry && atomic_read(&file->f_count) && S_ISREG(file->f_dentry->d_inode->i_mode))
X 			file->f_mode &= ~2;
X }
X 
diff -u --recursive --new-file v2.3.8/linux/drivers/char/tpqic02.c linux/drivers/char/tpqic02.c
--- v2.3.8/linux/drivers/char/tpqic02.c	Wed May 12 13:27:37 1999
+++ linux/drivers/char/tpqic02.c	Tue Jun 29 09:22:08 1999
@@ -2216,7 +2216,7 @@
X     }
X     
X 	/* Only one at a time from here on... */
-    if (filp->f_count>1) 	/* filp->f_count==1 for the first open() */
+    if (atomic_read(&filp->f_count)>1) 	/* filp->f_count==1 for the first open() */
X     {
X 	return -EBUSY;
X     }
diff -u --recursive --new-file v2.3.8/linux/drivers/char/tty_io.c linux/drivers/char/tty_io.c
--- v2.3.8/linux/drivers/char/tty_io.c	Wed Jun 16 19:26:27 1999
+++ linux/drivers/char/tty_io.c	Mon Jun 28 21:35:08 1999
@@ -628,10 +628,12 @@
X 			return -ERESTARTSYS;
X 		}
X #endif
+	lock_kernel();
X 	if (tty->ldisc.read)
X 		i = (tty->ldisc.read)(tty,file,buf,count);
X 	else
X 		i = -EIO;
+	unlock_kernel();
X 	if (i > 0)
X 		inode->i_atime = CURRENT_TIME;
X 	return i;
@@ -658,7 +660,9 @@
X 		unsigned long size = PAGE_SIZE*2;
X 		if (size > count)
X 			size = count;
+		lock_kernel();
X 		ret = write(tty, file, buf, size);
+		unlock_kernel();
X 		if (ret <= 0)
X 			break;
X 		written += ret;
diff -u --recursive --new-file v2.3.8/linux/drivers/char/vino.c linux/drivers/char/vino.c
--- v2.3.8/linux/drivers/char/vino.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/char/vino.c	Wed Jun 30 11:24:54 1999
@@ -0,0 +1,275 @@
+/* $Id: vino.c,v 1.4 1999/02/09 23:59:36 ulfc Exp $
+ * drivers/char/vino.c
+ *
+ * (incomplete) Driver for the Vino Video input system found in SGI Indys.
+ *
+ * Copyright (C) 1999 Ulf Carlsson (ul...@bun.falkenberg.se)
+ *
+ * This isn't complete yet, please don't expect any video until I've written
+ * some more code.
+ */
+
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/types.h>
+#include <linux/mm.h>
+#include <linux/errno.h>
+#include <linux/videodev.h>
+
+#include <asm/addrspace.h>
+#include <asm/system.h>
+
+#include "vino.h"
+
+struct vino_device {
+	struct video_device vdev;
+
+	unsigned long chan;
+#define VINO_CHAN_A		0
+#define VINO_CHAN_B		1
+
+	unsigned long flags;
+#define VINO_DMA_ACTIVE		(1<<0)
+};
+
+/* We can actually receive TV and IndyCam input at the same time. Believe it or
+ * not..
+ */
+static struct vino_device vino[2];
+
+/* Those registers have to be accessed by either *one* 64 bit write or *one* 64
+ * bit read. We need some asm to fix this. We can't use mips3 as standard
+ * because we just save 32 bits at context switch.
+ */
+
+static __inline__ unsigned long long vino_reg_read(unsigned long addr)
+{
+	unsigned long long ret __attribute__ ((aligned (64)));
+	unsigned long virt_addr = KSEG1ADDR(addr + VINO_BASE);
+	unsigned long flags;
+
+	save_and_cli(flags);
+	__asm__ __volatile__(
+		".set\tmips3\n\t"
+		".set\tnoat\n\t"
+		"ld\t$1,(%0)\n\t"
+		"sd\t$1,(%1)\n\t"
+		".set\tat\n\t"
+		".set\tmips0"
+		:
+		:"r" (virt_addr),
+		 "r" (&ret)
+		:"$1");
+	restore_flags(flags);
+
+	return ret;
+}
+
+static __inline__ void vino_reg_write(unsigned long long value,
+				      unsigned long addr)
+{
+	unsigned long virt_addr = KSEG1ADDR(addr + VINO_BASE);
+	unsigned long flags;
+
+	/* we might lose the upper parts of the registers which are not saved
+	 * if there comes an interrupt in our way, play safe */
+
+	save_and_cli(flags);
+	__asm__ __volatile__(
+		".set\tmips3\n\t"
+		".set\tnoat\n\t"
+		"ld\t$1,(%0)\n\t"
+		"sd\t$1,(%1)\n\t"
+		".set\tat\n\t"
+		".set\tmips0"
+		:
+		:"r" (&value),
+		 "r" (virt_addr)
+		:"$1");
+	restore_flags(flags);
+}
+
+static __inline__ void vino_reg_and(unsigned long long value,
+				    unsigned long addr)
+{
+	unsigned long virt_addr = KSEG1ADDR(addr + VINO_BASE);
+	unsigned long flags;
+
+	save_and_cli(flags);
+	__asm__ __volatile__(
+		".set\tmips3\n\t"
+		".set\tnoat\n\t"
+		"ld\t$1,(%0)\n\t"
+		"ld\t$2,(%1)\n\t"
+		"and\t$1,$1,$2\n\t"
+		"sd\t$1,(%0)\n\t"
+		".set\tat\n\t"
+		".set\tmips0"
+		:
+		:"r" (virt_addr),
+		 "r" (&value)
+		:"$1","$2");
+	restore_flags(flags);
+}
+
+static __inline__ void vino_reg_or(unsigned long long value,
+				   unsigned long addr)
+{
+	unsigned long virt_addr = KSEG1ADDR(addr + VINO_BASE);
+	unsigned long flags;
+
+	save_and_cli(flags);
+	__asm__ __volatile__(
+		".set\tmips3\n\t"
+		".set\tnoat\n\t"
+		"ld\t$1,(%0)\n\t"
+		"ld\t$2,(%1)\n\t"
+		"or\t$1,$1,$2\n\t"
+		"sd\t$1,(%0)\n\t"
+		".set\tat\n\t"
+		".set\tmips0"
+		:
+		:"r" (virt_addr),
+		 "r" (&value)
+		:"$1","$2");
+	restore_flags(flags);
+}
+
+static int vino_dma_setup(void)
+{
+	return 0;
+}
+
+static void vino_dma_stop(void)
+{
+
+}
+
+static int vino_init(void)
+{
+	unsigned long ret;
+	unsigned short rev, id;
+	unsigned long long foo;
+	unsigned long *bar;
+
+	bar = (unsigned long *) &foo;
+
+	ret = vino_reg_read(VINO_REVID);
+
+	rev = (ret & VINO_REVID_REV_MASK);
+	id = (ret & VINO_REVID_ID_MASK) >> 4;
+
+	printk("Vino: ID:%02hx Rev:%02hx\n", id, rev);
+
+	foo = vino_reg_read(VINO_A_DESC_DATA0);
+	printk("0x%lx", bar[0]);
+	printk("%lx ", bar[1]);
+	foo = vino_reg_read(VINO_A_DESC_DATA1);
+	printk("0x%lx", bar[0]);
+	printk("%lx ", bar[1]);
+	foo = vino_reg_read(VINO_A_DESC_DATA2);
+	printk("0x%lx", bar[0]);
+	printk("%lx ", bar[1]);
+	foo = vino_reg_read(VINO_A_DESC_DATA3);
+	printk("0x%lx", bar[0]);
+	printk("%lx\n", bar[1]);
+	foo = vino_reg_read(VINO_B_DESC_DATA0);
+	printk("0x%lx", bar[0]);
+	printk("%lx ", bar[1]);
+	foo = vino_reg_read(VINO_B_DESC_DATA1);
+	printk("0x%lx", bar[0]);
+	printk("%lx ", bar[1]);
+	foo = vino_reg_read(VINO_B_DESC_DATA2);
+	printk("0x%lx", bar[0]);
+	printk("%lx ", bar[1]);
+	foo = vino_reg_read(VINO_B_DESC_DATA3);
+	printk("0x%lx", bar[0]);
+	printk("%lx\n", bar[1]);
+
+	return 0;
+}
+
+static void vino_dma_go(struct vino_device *v)
+{
+	
+}
+
+/* Reset the vino back to default state */
+
+static void vino_setup(struct vino_device *v)
+{
+	
+}
+
+static int vino_open(struct video_device *dev, int flags)
+{
+	MOD_INC_USE_COUNT;
+	return 0;
+}
+
+static void vino_close(struct video_device *dev)
+{
+	MOD_DEC_USE_COUNT;
+}
+
+static int vino_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
+{
+	return 0;
+}
+
+static int vino_mmap(struct video_device *dev, const char *adr,
+		     unsigned long size)
+{
+	return 0;
+}
+
+static struct video_device vino_dev = {
+	"Vino IndyCam/TV",
+	VID_TYPE_CAPTURE,
+	VID_HARDWARE_VINO,
+	vino_open,
+	vino_close,
+	NULL,		/* vino_read */
+	NULL,		/* vino_write */
+	NULL,		/* vino_poll */
+	vino_ioctl,
+	vino_mmap,
+	NULL,		/* vino_init */
+	NULL,
+	0,
+	0
+};
+
+__initfunc(int init_vino(struct video_device *dev))
+{
+	int err;
+
+	err = vino_init();
+	if (err)
+		return err;
+
+#if 0
+	if (video_register_device(&vinodev, VFL_TYPE_GRABBER) == -1) {
+		return -ENODEV;
+	}
+#endif
+
+	return 0;
+}
+
+#ifdef MODULE
+int init_module(void)
+{
+	int err;
+
+	err = vino_init();
+	if (err)
+		return err;
+
+	return 0;
+}
+
+void cleanup_module(void)
+{
+}
+#endif
diff -u --recursive --new-file v2.3.8/linux/drivers/char/vino.h linux/drivers/char/vino.h
--- v2.3.8/linux/drivers/char/vino.h	Wed Dec 31 16:00:00 1969
+++ linux/drivers/char/vino.h	Fri Jun 25 17:39:14 1999
@@ -0,0 +1,118 @@
+/* $Id: vino.h,v 1.2 1999/02/09 23:03:53 ulfc Exp $
+ * drivers/sgi/vino.h
+ *
+ * Copyright (C) 1999 Ulf Carlsson (ul...@bun.falkenberg.se)
+ */
+
+#define VINO_BASE		0x0008000
+
+#define VINO_REVID		0x0000
+#define VINO_CTRL		0x0008
+#define VINO_INTSTAT		0x0010	/* Interrupt status */
+#define VINO_I2C_CTRL		0x0018
+#define VINO_I2C_DATA		0x0020
+#define VINO_A_ALPHA		0x0028	/* Channel A ... */
+#define VINO_A_CLIPS		0x0030	/* Clipping start */
+#define VINO_A_CLIPE		0x0038	/* Clipping end */
+#define VINO_A_FRAMERT		0x0040	/* Framerate */
+#define VINO_A_FLDCNT		0x0048	/* Field counter */
+#define VINO_A_LNSZ		0x0050
+#define VINO_A_LNCNT		0x0058
+#define VINO_A_PGIX		0x0060	/* Page index */
+#define VINO_A_DESC_PTR		0x0068	/* Ptr to next four descriptors */
+#define VINO_A_DESC_TLB_PTR	0x0070	/* Ptr to start of descriptor table */
+#define VINO_A_DESC_DATA0	0x0078	/* Descriptor data 0 */
+#define VINO_A_DESC_DATA1	0x0080	/* ... */
+#define VINO_A_DESC_DATA2	0x0088
+#define VINO_A_DESC_DATA3	0x0090
+#define VINO_A_FIFO_THRESHOLD	0x0098	/* FIFO threshold */
+#define VINO_A_FIFO_RP		0x00a0
+#define VINO_A_FIFO_WP		0x00a8
+#define VINO_B_ALPHA		0x00b0	/* Channel B ... */
+#define VINO_B_CLIPS		0x00b8
+#define VINO_B_CLIPE		0x00c0
+#define VINO_B_FRAMERT		0x00c8
+#define VINO_B_FLDCNT		0x00d0
+#define VINO_B_LNSZ		0x00d8
+#define VINO_B_LNCNT		0x00e0
+#define VINO_B_PGIX		0x00e8
+#define VINO_B_DESC_PTR		0x00f0
+#define VINO_B_DESC_TLB_PTR	0x00f8
+#define VINO_B_DESC_DATA0	0x0100
+#define VINO_B_DESC_DATA1	0x0108
+#define VINO_B_DESC_DATA2	0x0110
+#define VINO_B_DESC_DATA3	0x0118
+#define VINO_B_FIFO_THRESHOLD	0x0120
+#define VINO_B_FIFO_RP		0x0128
+#define VINO_B_FIFO_WP		0x0130
+
+/* Bits in the VINO_REVID register */
+
+#define VINO_REVID_REV_MASK		0x000f	/* bits 0:3 */
+#define VINO_REVID_ID_MASK		0x00f0	/* bits 4:7 */
+
+/* Bits in the VINO_CTRL register */
+
+#define VINO_CTRL_LITTLE_ENDIAN		(1<<0)
+#define VINO_CTRL_A_FIELD_TRANS_INT	(1<<1)	/* Field transferred int */
+#define VINO_CTRL_A_FIFO_OF_INT		(1<<2)	/* FIFO overflow int */
+#define VINO_CTRL_A_END_DESC_TBL_INT	(1<<3)	/* End of desc table int */
+#define VINO_CTRL_B_FIELD_TRANS_INT	(1<<4)	/* Field transferred int */
+#define VINO_CTRL_B_FIFO_OF_INT		(1<<5)	/* FIFO overflow int */
+#define VINO_CTRL_B_END_DESC_TLB_INT	(1<<6)	/* End of desc table int */
+#define VINO_CTRL_A_DMA_ENBL		(1<<7)
+#define VINO_CTRL_A_INTERLEAVE_ENBL	(1<<8)
+#define VINO_CTRL_A_SYNC_ENBL		(1<<9)
+#define VINO_CTRL_A_SELECT		(1<<10)	/* 1=D1 0=Philips */
+#define VINO_CTRL_A_RGB			(1<<11)	/* 1=RGB 0=YUV */
+#define VINO_CTRL_A_LUMA_ONLY		(1<<12)
+#define VINO_CTRL_A_DEC_ENBL		(1<<13)	/* Decimation */
+#define VINO_CTRL_A_DEC_SCALE_MASK	0x1c000	/* bits 14:17 */
+#define VINO_CTRL_A_DEC_HOR_ONLY	(1<<17)	/* Horizontal only */
+#define VINO_CTRL_A_DITHER		(1<<18)	/* 24 -> 8 bit dither */
+#define VINO_CTRL_B_DMA_ENBL		(1<<19)
+#define VINO_CTRL_B_INTERLEAVE_ENBL	(1<<20)
+#define VINO_CTRL_B_SYNC_ENBL		(1<<21)
+#define VINO_CTRL_B_SELECT		(1<<22)	/* 1=D1 0=Philips */
+#define VINO_CTRL_B_RGB			(1<<22)	/* 1=RGB 0=YUV */
+#define VINO_CTRL_B_LUMA_ONLY		(1<<23)
+#define VINO_CTRL_B_DEC_ENBL		(1<<24)	/* Decimation */
+#define VINO_CTRL_B_DEC_SCALE_MASK	0x1c000000	/* bits 25:28 */
+#define VINO_CTRL_B_DEC_HOR_ONLY	(1<<29)	/* Decimation horizontal only */
+#define VINO_CTRL_B_DITHER		(1<<30)	/* ChanB 24 -> 8 bit dither */
+
+/* Bits in the Interrupt and Status register */
+
+#define VINO_INTSTAT_A_FIELD_TRANS	(1<<0)	/* Field transferred int */
+#define VINO_INTSTAT_A_FIFO_OF		(1<<1)	/* FIFO overflow int */
+#define VINO_INTSTAT_A_END_DESC_TBL	(1<<2)	/* End of desc table int */
+#define VINO_INTSTAT_B_FIELD_TRANS	(1<<3)	/* Field transferred int */
+#define VINO_INTSTAT_B_FIFO_OF		(1<<4)	/* FIFO overflow int */
+#define VINO_INTSTAT_B_END_DESC_TBL	(1<<5)	/* End of desc table int */
+
+/* Bits in the Clipping Start register */
+
+#define VINO_CLIPS_START		0x3ff		/* bits 0:9 */
+#define VINO_CLIPS_ODD_MASK		0x7fc00		/* bits 10:18 */
+#define VINO_CLIPS_EVEN_MASK		0xff80000	/* bits 19:27 */
+
+/* Bits in the Clipping End register */
+
+#define VINO_CLIPE_END			0x3ff		/* bits 0:9 */
+#define VINO_CLIPE_ODD_MASK		0x7fc00		/* bits 10:18 */
+#define VINO_CLIPE_EVEN_MASK		0xff80000	/* bits 19:27 */
+
+/* Bits in the Frame Rate register */
+
+#define VINO_FRAMERT_PAL		(1<<0)	/* 0=NTSC 1=PAL */
+#define VINO_FRAMERT_RT_MASK		0x1ffe		/* bits 1:12 */
+
+/* Bits in the VINO_I2C_CTRL */
+
+#define VINO_CTRL_I2C_IDLE		(1<<0)	/* write: 0=force idle
+						 * read: 0=idle 1=not idle */
+#define VINO_CTRL_I2C_DIR		(1<<1)	/* 0=read 1=write */
+#define VINO_CTRL_I2C_MORE_BYTES	(1<<2)	/* 0=last byte 1=more bytes */
+#define VINO_CTRL_I2C_TRANS_BUSY	(1<<4)	/* 0=trans done 1=trans busy */
+#define VINO_CTRL_I2C_ACK		(1<<5)	/* 0=ack received 1=ack not */
+#define VINO_CTRL_I2C_BUS_ERROR		(1<<7)	/* 0=no bus err 1=bus err */
diff -u --recursive --new-file v2.3.8/linux/drivers/char/vt.c linux/drivers/char/vt.c
--- v2.3.8/linux/drivers/char/vt.c	Tue May 11 14:37:40 1999
+++ linux/drivers/char/vt.c	Fri Jun 25 17:39:14 1999
@@ -88,7 +88,8 @@
X  * comments - KDMKTONE doesn't put the process to sleep.
X  */
X 
-#if defined(__i386__) || defined(__alpha__) || defined(__powerpc__) || defined(__mips__)
+#if defined(__i386__) || defined(__alpha__) || defined(__powerpc__) \
+    || (defined(__mips__) && !defined(CONFIG_SGI))
X 
X static void
X kd_nosound(unsigned long ignored)
diff -u --recursive --new-file v2.3.8/linux/drivers/i2o/i2o_config.c linux/drivers/i2o/i2o_config.c
--- v2.3.8/linux/drivers/i2o/i2o_config.c	Wed Jun  2 14:40:22 1999
+++ linux/drivers/i2o/i2o_config.c	Wed Jun 30 11:24:54 1999
@@ -14,7 +14,6 @@
X  *	2 of the License, or (at your option) any later version.
X  */
X 
-#include <linux/config.h>
X #include <linux/module.h>
X #include <linux/kernel.h>
X #include <linux/pci.h>
diff -u --recursive --new-file v2.3.8/linux/drivers/i2o/i2o_core.c linux/drivers/i2o/i2o_core.c
--- v2.3.8/linux/drivers/i2o/i2o_core.c	Wed Jun  2 14:40:22 1999
+++ linux/drivers/i2o/i2o_core.c	Wed Jun 30 11:24:54 1999
@@ -19,7 +19,6 @@
X  *	
X  */
X  
-#include <linux/config.h>
X #include <linux/module.h>
X #include <linux/kernel.h>
X #include <linux/pci.h>
diff -u --recursive --new-file v2.3.8/linux/drivers/i2o/i2o_lan.c linux/drivers/i2o/i2o_lan.c
--- v2.3.8/linux/drivers/i2o/i2o_lan.c	Wed Jun  2 14:40:22 1999
+++ linux/drivers/i2o/i2o_lan.c	Wed Jun 30 11:24:54 1999
@@ -25,6 +25,7 @@
X  *			- code/test for other LAN classes
X  */
X 
+#include <linux/config.h>
X #include <linux/module.h>
X 
X #include <linux/netdevice.h>
diff -u --recursive --new-file v2.3.8/linux/drivers/i2o/i2o_pci.c linux/drivers/i2o/i2o_pci.c
--- v2.3.8/linux/drivers/i2o/i2o_pci.c	Wed Jun  2 14:40:22 1999
+++ linux/drivers/i2o/i2o_pci.c	Wed Jun 30 11:24:54 1999
@@ -12,7 +12,6 @@
X  *	2 of the License, or (at your option) any later version.
X  */
X  
-#include <linux/config.h>
X #include <linux/module.h>
X #include <linux/kernel.h>
X #include <linux/pci.h>
diff -u --recursive --new-file v2.3.8/linux/drivers/i2o/i2o_proc.c linux/drivers/i2o/i2o_proc.c
--- v2.3.8/linux/drivers/i2o/i2o_proc.c	Wed Jun  2 14:40:22 1999
+++ linux/drivers/i2o/i2o_proc.c	Wed Jun 30 11:24:54 1999
@@ -38,7 +38,6 @@
X #define FMT_U64_HEX "0x%08x%08x"
X #define U64_VAL(pu64) *((u32*)(pu64)+1), *((u32*)(pu64))
X 
-#include <linux/config.h>
X #include <linux/types.h>
X #include <linux/kernel.h>
X #include <linux/i2o.h>
diff -u --recursive --new-file v2.3.8/linux/drivers/net/Config.in linux/drivers/net/Config.in
--- v2.3.8/linux/drivers/net/Config.in	Mon Jun  7 14:35:09 1999
+++ linux/drivers/net/Config.in	Fri Jun 25 17:39:52 1999
@@ -42,7 +42,7 @@
X     tristate 'Hydra support' CONFIG_HYDRA
X   fi
X   if [ "$CONFIG_MIPS_JAZZ" = "y" ]; then
-    bool 'MIPS JAZZ onboard SONIC Ethernet support' CONFIG_MIPS_JAZZ_SONIC
+    tristate 'MIPS JAZZ onboard SONIC Ethernet support' CONFIG_MIPS_JAZZ_SONIC
X   fi
X   bool '3COM cards' CONFIG_NET_VENDOR_3COM
X   if [ "$CONFIG_NET_VENDOR_3COM" = "y" ]; then
diff -u --recursive --new-file v2.3.8/linux/drivers/net/Makefile linux/drivers/net/Makefile
--- v2.3.8/linux/drivers/net/Makefile	Thu Jun 17 01:11:35 1999
+++ linux/drivers/net/Makefile	Fri Jun 25 17:39:52 1999
@@ -876,10 +876,26 @@
X endif
X 
X ifeq ($(CONFIG_MIPS_JAZZ_SONIC),y)
-L_OBJS += sonic.o
+L_OBJS += jazzsonic.o
X else
X   ifeq ($(CONFIG_MIPS_JAZZ_SONIC),m)
-    M_OBJS += sonic.o
+  M_OBJS += jazzsonic.o
+  endif
+endif
+
+ifeq ($(CONFIG_BAGETLANCE),y)
+L_OBJS += bagetlance.o
+else
+  ifeq ($(CONFIG_BAGETLANCE),m)
+  M_OBJS += bagetlance.o
+  endif
+endif
+
+ifeq ($(CONFIG_DECLANCE),y)
+L_OBJS += declance.o
+else
+  ifeq ($(CONFIG_DECLANCE),m)
+  M_OBJS += declance.o
X   endif
X endif
X 
diff -u --recursive --new-file v2.3.8/linux/drivers/net/Space.c linux/drivers/net/Space.c
--- v2.3.8/linux/drivers/net/Space.c	Mon Jun  7 14:35:09 1999
+++ linux/drivers/net/Space.c	Fri Jun 25 17:39:52 1999
@@ -111,6 +111,8 @@
X extern int epic100_probe(struct device *dev);
X extern int rtl8139_probe(struct device *dev);
X extern int hplance_probe(struct device *dev);
+extern int bagetlance_probe(struct device *);
+extern int dec_lance_probe(struct device *);
X extern int via_rhine_probe(struct device *dev);
X extern int tc515_probe(struct device *dev);
X extern int lance_probe(struct device *dev);
@@ -442,6 +444,12 @@
X struct devprobe mips_probes[] __initdata = {
X #ifdef CONFIG_MIPS_JAZZ_SONIC
X 	{sonic_probe, 0},
+#endif
+#ifdef CONFIG_DECLANCE		/* DECstation on-board controller */
+	{dec_lance_probe, 0},   /* and maybe TURBOchannel option boards */
+#endif
+#ifdef CONFIG_BAGETLANCE        /* Lance-based Baget ethernet boards */
+        {bagetlance_probe, 0},
X #endif
X 	{NULL, 0},
X };
diff -u --recursive --new-file v2.3.8/linux/drivers/net/bagetlance.c linux/drivers/net/bagetlance.c
--- v2.3.8/linux/drivers/net/bagetlance.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/net/bagetlance.c	Fri Jun 25 17:39:52 1999
@@ -0,0 +1,1363 @@
+/* $Id$
+ * vmelance.c: Ethernet driver for VME Lance cards on Baget/MIPS
+ *      This code stealed and adopted from linux/drivers/net/atarilance.c
+ *      See that for author info
+ *
+ * Copyright (C) 1998 Gleb Raiko & Vladimir Roganov
+ */
+
+/* 
+ * Driver code for Baget/Lance taken from atarilance.c, which also
+ * works well in case of Besta. Most significant changes made here
+ * related with 16BIT-only access to A24 space.
+ */
+
+static char *version = "bagetlance.c: v1.1 11/10/98\n";
+
+#include <linux/module.h>
+
+#include <linux/stddef.h>
+#include <linux/kernel.h>
+#include <linux/sched.h>
+#include <linux/string.h>
+#include <linux/ptrace.h>
+#include <linux/errno.h>
+#include <linux/malloc.h>
+#include <linux/interrupt.h>
+#include <linux/init.h>
+
+#include <asm/irq.h>
+#include <asm/bitops.h>
+#include <asm/io.h>
+
+#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
+#include <linux/skbuff.h>
+
+#include <asm/baget/baget.h>
+
+#define BAGET_LANCE_IRQ  BAGET_IRQ_MASK(0xdf)
+
+/*
+ *  Define following if you don't need 16BIT-only access to Lance memory
+ *  (Normally BAGET needs it)
+ */
+#undef NORMAL_MEM_ACCESS 
+
+/* Debug level:
+ *  0 = silent, print only serious errors
+ *  1 = normal, print error messages
+ *  2 = debug, print debug infos
+ *  3 = debug, print even more debug infos (packet data)
+ */
+
+#define	LANCE_DEBUG	1  
+
+#ifdef LANCE_DEBUG
+static int lance_debug = LANCE_DEBUG;
+#else
+static int lance_debug = 1;
+#endif
+MODULE_PARM(lance_debug, "i");
+
+/* Print debug messages on probing? */
+#undef LANCE_DEBUG_PROBE
+
+#define	DPRINTK(n,a)							\
+	do {										\
+		if (lance_debug >= n)					\
+			printk a;							\
+	} while( 0 )
+
+#ifdef LANCE_DEBUG_PROBE
+# define PROBE_PRINT(a)	printk a
+#else
+# define PROBE_PRINT(a)
+#endif
+
+/* These define the number of Rx and Tx buffers as log2. (Only powers
+ * of two are valid)
+ * Much more rx buffers (32) are reserved than tx buffers (8), since receiving
+ * is more time critical then sending and packets may have to remain in the
+ * board's memory when main memory is low.
+ */
+
+/* Baget Lance has 64K on-board memory, so it looks we can't increase
+   buffer quantity (40*1.5K is about 64K) */
+
+#define TX_LOG_RING_SIZE			3
+#define RX_LOG_RING_SIZE			5
+
+/* These are the derived values */
+
+#define TX_RING_SIZE			(1 << TX_LOG_RING_SIZE)
+#define TX_RING_LEN_BITS		(TX_LOG_RING_SIZE << 5)
+#define	TX_RING_MOD_MASK		(TX_RING_SIZE - 1)
+
+#define RX_RING_SIZE			(1 << RX_LOG_RING_SIZE)
+#define RX_RING_LEN_BITS		(RX_LOG_RING_SIZE << 5)
+#define	RX_RING_MOD_MASK		(RX_RING_SIZE - 1)
+
+/* The LANCE Rx and Tx ring descriptors. */
+struct lance_rx_head {
+	volatile unsigned short	base;		/* Low word of base addr */
+#ifdef NORMAL_MEM_ACCESS
+       /* Following two fields are joined into one short to guarantee
+		  16BIT access to Baget lance registers */
+	volatile unsigned char	flag;
+	unsigned char			base_hi;	/* High word of base addr (unused) */
+#else
+/* Following macros are used as replecements to 8BIT fields */
+#define GET_FLAG(h)    (((h)->flag_base_hi >> 8) & 0xff)
+#define SET_FLAG(h,f)  (h)->flag_base_hi = ((h)->flag_base_hi & 0xff) | \
+		                                                (((unsigned)(f)) << 8)
+	volatile unsigned short flag_base_hi; 
+#endif
+	volatile short			buf_length;	/* This length is 2s complement! */
+	volatile short			msg_length;	/* This length is "normal". */
+};
+
+
+struct lance_tx_head {
+	volatile unsigned short	base;		/* Low word of base addr */
+#ifdef NORMAL_MEM_ACCESS 
+/* See comments above about 8BIT-access Baget A24-space problems */
+	volatile unsigned char	flag;
+	unsigned char			base_hi;	/* High word of base addr (unused) */
+#else
+	volatile unsigned short  flag_base_hi;
+#endif
+	volatile short			length;		/* Length is 2s complement! */
+	volatile short			misc;
+};
+
+struct ringdesc {
+	volatile unsigned short	adr_lo;		/* Low 16 bits of address */
+#ifdef NORMAL_MEM_ACCESS 
+/* See comments above about 8BIT-access Bage A24-space problems */
+	unsigned char	len;		/* Length bits */
+	unsigned char	adr_hi;		/* High 8 bits of address (unused) */
+#else
+	volatile unsigned short  len_adr_hi;
+#endif
+};
+
+/* The LANCE initialization block, described in databook. */
+struct lance_init_block {
+	unsigned short	mode;		/* Pre-set mode */
+	unsigned char	hwaddr[6];	/* Physical ethernet address */
+	unsigned		filter[2];	/* Multicast filter (unused). */
+	/* Receive and transmit ring base, along with length bits. */
+	struct ringdesc	rx_ring;
+	struct ringdesc	tx_ring;
+};
+
+/* The whole layout of the Lance shared memory */
+struct lance_memory {
+	struct lance_init_block	init;
+	struct lance_tx_head	tx_head[TX_RING_SIZE];
+	struct lance_rx_head	rx_head[RX_RING_SIZE];
+	char					packet_area[0];	/* packet data follow after the
+											 * init block and the ring
+											 * descriptors and are located
+											 * at runtime */
+};
+
+/* RieblCard specifics:
+ * The original TOS driver for these cards reserves the area from offset
+ * 0xee70 to 0xeebb for storing configuration data. Of interest to us is the
+ * Ethernet address there, and the magic for verifying the data's validity.
+ * The reserved area isn't touch by packet buffers. Furthermore, offset 0xfffe
+ * is reserved for the interrupt vector number.
+ */
+#define	RIEBL_RSVD_START	0xee70
+#define	RIEBL_RSVD_END		0xeec0
+#define RIEBL_MAGIC			0x09051990
+#define RIEBL_MAGIC_ADDR	((unsigned long *)(((char *)MEM) + 0xee8a))
+#define RIEBL_HWADDR_ADDR	((unsigned char *)(((char *)MEM) + 0xee8e))
+#define RIEBL_IVEC_ADDR		((unsigned short *)(((char *)MEM) + 0xfffe))
+
+/* This is a default address for the old RieblCards without a battery
+ * that have no ethernet address at boot time. 00:00:36:04 is the
+ * prefix for Riebl cards, the 00:00 at the end is arbitrary.
+ */
+
+static unsigned char OldRieblDefHwaddr[6] = {
+	0x00, 0x00, 0x36, 0x04, 0x00, 0x00
+};
+
+/* I/O registers of the Lance chip */
+
+struct lance_ioreg {
+/* base+0x0 */	volatile unsigned short	data;
+/* base+0x2 */	volatile unsigned short	addr;
+				unsigned char			_dummy1[3];
+/* base+0x7 */	volatile unsigned char	ivec;
+				unsigned char			_dummy2[5];
+/* base+0xd */	volatile unsigned char	eeprom;
+				unsigned char			_dummy3;
+/* base+0xf */	volatile unsigned char	mem;
+};
+
+/* Types of boards this driver supports */
+
+enum lance_type {
+	OLD_RIEBL,		/* old Riebl card without battery */
+	NEW_RIEBL,		/* new Riebl card with battery */
+	PAM_CARD		/* PAM card with EEPROM */
+};
+
+static char *lance_names[] = {
+	"Riebl-Card (without battery)",
+	"Riebl-Card (with battery)",
+	"PAM intern card"
+};
+
+/* The driver's private device structure */
+
+struct lance_private {
+	enum lance_type		cardtype;
+	struct lance_ioreg	*iobase;
+	struct lance_memory	*mem;
+	int					cur_rx, cur_tx;	/* The next free ring entry */
+	int					dirty_tx;		/* Ring entries to be freed. */
+						/* copy function */
+	void				*(*memcpy_f)( void *, const void *, size_t );
+	struct net_device_stats stats;
+/* These two must be ints for set_bit() */
+	int					tx_full;
+	int					lock;
+};
+
+/* I/O register access macros */
+
+#define	MEM		lp->mem
+#define	DREG	IO->data
+#define	AREG	IO->addr
+#define	REGA(a)	( AREG = (a), DREG )
+
+/* Definitions for packet buffer access: */
+#define PKT_BUF_SZ		1544
+/* Get the address of a packet buffer corresponding to a given buffer head */
+#define	PKTBUF_ADDR(head)	(((unsigned char *)(MEM)) + (head)->base)
+
+/* Possible memory/IO addresses for probing */
+
+struct lance_addr {
+	unsigned long	memaddr;
+	unsigned long	ioaddr;
+	int				slow_flag;
+} lance_addr_list[] = {
+	{ BAGET_LANCE_MEM_BASE, BAGET_LANCE_IO_BASE, 1 }	/* Baget Lance */
+};
+
+#define	N_LANCE_ADDR	(sizeof(lance_addr_list)/sizeof(*lance_addr_list))
+
+
+#define LANCE_HI_BASE (0xff & (BAGET_LANCE_MEM_BASE >> 16))
+
+/* Definitions for the Lance */
+
+/* tx_head flags */
+#define TMD1_ENP		0x01	/* end of packet */
+#define TMD1_STP		0x02	/* start of packet */
+#define TMD1_DEF		0x04	/* deferred */
+#define TMD1_ONE		0x08	/* one retry needed */
+#define TMD1_MORE		0x10	/* more than one retry needed */
+#define TMD1_ERR		0x40	/* error summary */
+#define TMD1_OWN 		0x80	/* ownership (set: chip owns) */
+
+#define TMD1_OWN_CHIP	TMD1_OWN
+#define TMD1_OWN_HOST	0
+
+/* tx_head misc field */
+#define TMD3_TDR		0x03FF	/* Time Domain Reflectometry counter */
+#define TMD3_RTRY		0x0400	/* failed after 16 retries */
+#define TMD3_LCAR		0x0800	/* carrier lost */
+#define TMD3_LCOL		0x1000	/* late collision */
+#define TMD3_UFLO		0x4000	/* underflow (late memory) */
+#define TMD3_BUFF		0x8000	/* buffering error (no ENP) */
+
+/* rx_head flags */
+#define RMD1_ENP		0x01	/* end of packet */
+#define RMD1_STP		0x02	/* start of packet */
+#define RMD1_BUFF		0x04	/* buffer error */
+#define RMD1_CRC		0x08	/* CRC error */
+#define RMD1_OFLO		0x10	/* overflow */
+#define RMD1_FRAM		0x20	/* framing error */
+#define RMD1_ERR		0x40	/* error summary */
+#define RMD1_OWN 		0x80	/* ownership (set: ship owns) */
+
+#define RMD1_OWN_CHIP	RMD1_OWN
+#define RMD1_OWN_HOST	0
+
+/* register names */
+#define CSR0	0		/* mode/status */
+#define CSR1	1		/* init block addr (low) */
+#define CSR2	2		/* init block addr (high) */
+#define CSR3	3		/* misc */
+#define CSR8	8	  	/* address filter */
+#define CSR15	15		/* promiscuous mode */
+
+/* CSR0 */
+/* (R=readable, W=writeable, S=set on write, C=clear on write) */
+#define CSR0_INIT	0x0001		/* initialize (RS) */
+#define CSR0_STRT	0x0002		/* start (RS) */
+#define CSR0_STOP	0x0004		/* stop (RS) */
+#define CSR0_TDMD	0x0008		/* transmit demand (RS) */
+#define CSR0_TXON	0x0010		/* transmitter on (R) */
+#define CSR0_RXON	0x0020		/* receiver on (R) */
+#define CSR0_INEA	0x0040		/* interrupt enable (RW) */
+#define CSR0_INTR	0x0080		/* interrupt active (R) */
+#define CSR0_IDON	0x0100		/* initialization done (RC) */
+#define CSR0_TINT	0x0200		/* transmitter interrupt (RC) */
+#define CSR0_RINT	0x0400		/* receiver interrupt (RC) */
+#define CSR0_MERR	0x0800		/* memory error (RC) */
+#define CSR0_MISS	0x1000		/* missed frame (RC) */
+#define CSR0_CERR	0x2000		/* carrier error (no heartbeat :-) (RC) */
+#define CSR0_BABL	0x4000		/* babble: tx-ed too many bits (RC) */
+#define CSR0_ERR	0x8000		/* error (RC) */
+
+/* CSR3 */
+#define CSR3_BCON	0x0001		/* byte control */
+#define CSR3_ACON	0 // fixme: 0x0002		/* ALE control */
+#define CSR3_BSWP	0x0004		/* byte swap (1=big endian) */
+
+
+
+/***************************** Prototypes *****************************/
+
+static int addr_accessible( volatile void *regp, int wordflag, int
+                            writeflag );
+static unsigned long lance_probe1( struct device *dev, struct lance_addr
+                                   *init_rec );
+static int lance_open( struct device *dev );
+static void lance_init_ring( struct device *dev );
+static int lance_start_xmit( struct sk_buff *skb, struct device *dev );
+static void lance_interrupt( int irq, void *dev_id, struct pt_regs *fp );
+static int lance_rx( struct device *dev );
+static int lance_close( struct device *dev );
+static struct net_device_stats *lance_get_stats( struct device *dev );
+static void set_multicast_list( struct device *dev );
+static int lance_set_mac_address( struct device *dev, void *addr );
+
+/************************* End of Prototypes **************************/
+
+/* Network traffic statistic (bytes) */
+
+int lance_stat = 0;
+
+static void update_lance_stat (int len) {
+		lance_stat += len;
+}
+
+/* 
+   This function is used to access Baget/Lance memory to avoid 
+   8/32BIT access to VAC A24 space 
+   ALL memcpy calls was chenged to this function to avoid dbe problems
+   Don't confuse with function name -- it stays from original code
+*/
+
+void *slow_memcpy( void *dst, const void *src, size_t len )
+
+{	
+	unsigned long to     = (unsigned long)dst;
+	unsigned long from   = (unsigned long)src;
+	unsigned long to_end = to +len;
+	
+	/* Unaligned flags */
+
+	int odd_from   = from   & 1;
+	int odd_to     = to     & 1;
+	int odd_to_end = to_end & 1;
+
+	/* Align for 16BIT-access first */
+
+	register unsigned short *from_a   = (unsigned short*) (from   & ~1);
+	register unsigned short *to_a     = (unsigned short*) (to     & ~1); 
+	register unsigned short *to_end_a = (unsigned short*) (to_end & ~1);
+
+	/* Caching values -- not in loop invariant */
+
+	register unsigned short from_v; 
+	register unsigned short to_v;
+
+	/* Invariant is: from_a and to_a are pointers before or exactly to
+	   currently copying byte */
+
+	if (odd_to) { 
+			/* First byte unaligned case */
+			from_v = *from_a;
+			to_v   = *to_a;
+
+			to_v &= ~0xff;
+			to_v |=  0xff & (from_v >> (odd_from ? 0 : 8));
+			*to_a++ = to_v;
+
+			if (odd_from) from_a++;
+	}
+    if (odd_from == odd_to) {
+			/* Same parity */
+			while (to_a + 7 < to_end_a) {
+					unsigned long dummy1, dummy2;
+					unsigned long reg1, reg2, reg3, reg4;
+
+					__asm__ __volatile__(
+					".set\tnoreorder\n\t"
+					".set\tnoat\n\t"
+					"lh\t%2,0(%1)\n\t"
+					"nop\n\t"
+					 "lh\t%3,2(%1)\n\t"
+					"sh\t%2,0(%0)\n\t"
+					   "lh\t%4,4(%1)\n\t"
+					 "sh\t%3,2(%0)\n\t"
+					    "lh\t%5,6(%1)\n\t"
+					   "sh\t%4,4(%0)\n\t"
+					"lh\t%2,8(%1)\n\t"
+					    "sh\t%5,6(%0)\n\t"
+					 "lh\t%3,10(%1)\n\t"
+					"sh\t%2,8(%0)\n\t"
+					  "lh\t%4,12(%1)\n\t"
+					 "sh\t%3,10(%0)\n\t"
+					    "lh\t%5,14(%1)\n\t"
+					  "sh\t%4,12(%0)\n\t"
+					 "nop\n\t"
+					    "sh\t%5,14(%0)\n\t"
+					".set\tat\n\t"
+					".set\treorder"
+					:"=r" (dummy1), "=r" (dummy2),
+					"=&r" (reg1), "=&r" (reg2), "=&r" (reg3), "=&r" (reg4)
+					:"0" (to_a), "1" (from_a)
+					:"memory");
+
+					to_a   += 8;
+					from_a += 8;
+
+			}
+			while (to_a < to_end_a) {
+					*to_a++ = *from_a++;
+			}
+	} else {
+			/* Different parity */
+			from_v = *from_a;
+			while (to_a < to_end_a) {
+					unsigned short from_v_next;
+					from_v_next = *++from_a;
+					*to_a++ = ((from_v & 0xff)<<8) | ((from_v_next>>8) & 0xff);
+					from_v = from_v_next; 
+			}
+
+	}
+	if (odd_to_end) {
+			/* Last byte unaligned case */
+			to_v = *to_a;
+			from_v = *from_a;
+
+			to_v &= ~0xff00;
+			if (odd_from == odd_to) {
+					to_v |= from_v & 0xff00;
+			} else {
+					to_v |= (from_v<<8) & 0xff00;
+			}
+
+			*to_a = to_v;
+	}
+
+	update_lance_stat( len );
+
+	return( dst );
+}
+
+
+__initfunc(int bagetlance_probe( struct device *dev ))
+
+{	int i;
+	static int found = 0;
+
+	if (found)
+		/* Assume there's only one board possible... That seems true, since
+		 * the Riebl/PAM board's address cannot be changed. */
+		return( ENODEV );
+
+	for( i = 0; i < N_LANCE_ADDR; ++i ) {
+		if (lance_probe1( dev, &lance_addr_list[i] )) {
+			found = 1;
+			return( 0 );
+		}
+	}
+
+	return( ENODEV );
+}
+
+
+
+/* Derived from hwreg_present() in vme/config.c: */
+
+__initfunc(static int addr_accessible( volatile void *regp, 
+									   int wordflag, 
+									   int writeflag ))
+{	
+		/* We have a fine function to do it */
+		extern int try_read(unsigned long, int);
+		return try_read((unsigned long)regp, sizeof(short)) != -1;   
+}
+
+
+
+/* Original atari driver uses it */
+#define IRQ_TYPE_PRIO SA_INTERRUPT
+#define IRQ_SOURCE_TO_VECTOR(x) (x)
+
+__initfunc(static unsigned long lance_probe1( struct device *dev,
+								   struct lance_addr *init_rec ))
+
+{	volatile unsigned short *memaddr =
+		(volatile unsigned short *)init_rec->memaddr;
+	volatile unsigned short *ioaddr =
+		(volatile unsigned short *)init_rec->ioaddr;
+	struct lance_private	*lp;
+	struct lance_ioreg		*IO;
+	int 					i;
+	static int 				did_version = 0;
+	unsigned short			save1, save2;
+
+	PROBE_PRINT(( "Probing for Lance card at mem %#lx io %#lx\n",
+				  (long)memaddr, (long)ioaddr ));
+
+	/* Test whether memory readable and writable */
+	PROBE_PRINT(( "lance_probe1: testing memory to be accessible\n" ));
+	if (!addr_accessible( memaddr, 1, 1 )) goto probe_fail;
+
+	if ((unsigned long)memaddr >= KSEG2) {
+			extern int kseg2_alloc_io (unsigned long addr, unsigned long size);
+			if (kseg2_alloc_io((unsigned long)memaddr, BAGET_LANCE_MEM_SIZE)) {
+					printk("bagetlance: unable map lance memory\n");
+					goto probe_fail;
+			}
+	}
+
+	/* Written values should come back... */
+	PROBE_PRINT(( "lance_probe1: testing memory to be writable (1)\n" ));
+	save1 = *memaddr;
+	*memaddr = 0x0001;
+	if (*memaddr != 0x0001) goto probe_fail;
+	PROBE_PRINT(( "lance_probe1: testing memory to be writable (2)\n" ));
+	*memaddr = 0x0000;
+	if (*memaddr != 0x0000) goto probe_fail;
+	*memaddr = save1;
+
+	/* First port should be readable and writable */
+	PROBE_PRINT(( "lance_probe1: testing ioport to be accessible\n" ));
+	if (!addr_accessible( ioaddr, 1, 1 )) goto probe_fail;
+
+	/* and written values should be readable */
+	PROBE_PRINT(( "lance_probe1: testing ioport to be writeable\n" ));
+	save2 = ioaddr[1];
+	ioaddr[1] = 0x0001;
+	if (ioaddr[1] != 0x0001) goto probe_fail;
+
+	/* The CSR0_INIT bit should not be readable */
+	PROBE_PRINT(( "lance_probe1: testing CSR0 register function (1)\n" ));
+	save1 = ioaddr[0];
+	ioaddr[1] = CSR0;
+	ioaddr[0] = CSR0_INIT | CSR0_STOP;
+	if (ioaddr[0] != CSR0_STOP) {
+		ioaddr[0] = save1;
+		ioaddr[1] = save2;
+		goto probe_fail;
+	}
+	PROBE_PRINT(( "lance_probe1: testing CSR0 register function (2)\n" ));
+	ioaddr[0] = CSR0_STOP;
+	if (ioaddr[0] != CSR0_STOP) {
+		ioaddr[0] = save1;
+		ioaddr[1] = save2;
+		goto probe_fail;
+	}
+
+	/* Now ok... */
+	PROBE_PRINT(( "lance_probe1: Lance card detected\n" ));
+	goto probe_ok;
+
+  probe_fail:
SHAR_EOF
true || echo 'restore of patch-2.3.9 failed'
fi
echo 'End of  part 12'
echo 'File patch-2.3.9 is continued in part 13'
echo 13 > _shar_seq_.tmp
exit 0
#!/bin/sh
# this is part 14 of a 26 - part archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file patch-2.3.9 continued
if test ! -r _shar_seq_.tmp; then
        echo 'Please unpack part 1 first!'
        exit 1
fi
(read Scheck
if test "$Scheck" != 14; then
        echo Please unpack part "$Scheck" next!
        exit 1
 else
        exit 0
 fi
) < _shar_seq_.tmp || exit 1
if test ! -f _shar_wnt_.tmp; then
echo 'x - still skipping patch-2.3.9'
else
echo 'x - continuing with patch-2.3.9'
sed 's/^X//' << 'SHAR_EOF' >> 'patch-2.3.9' &&
+#include <linux/malloc.h>
+#include <linux/string.h>
+#include <linux/delay.h>
+#include <asm/bootinfo.h>
+#include <asm/system.h>
+#include <asm/bitops.h>
+#include <asm/pgtable.h>
+#include <asm/segment.h>
+#include <asm/io.h>
+#include <asm/dma.h>
+#include <asm/jazz.h>
+#include <asm/jazzdma.h>
+#include <linux/errno.h>
+
+#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
+#include <linux/skbuff.h>
+
+#define SREGS_PAD(n)    u16 n;
+
+#include "sonic.h"
+
+/*
+ * Macros to access SONIC registers
+ */
+#define SONIC_READ(reg) \
+	*((volatile unsigned int *)base_addr+reg)
+
+#define SONIC_WRITE(reg,val) \
+	*((volatile unsigned int *)base_addr+reg) = val
+
+
+/* use 0 for production, 1 for verification, >2 for debug */
+#ifdef SONIC_DEBUG
+static unsigned int sonic_debug = SONIC_DEBUG;
+#else 
+static unsigned int sonic_debug = 1;
+#endif
+
+/*
+ * Base address and interupt of the SONIC controller on JAZZ boards
+ */
+static struct {
+    unsigned int port;
+    unsigned int irq;
+} sonic_portlist[] = { {JAZZ_ETHERNET_BASE, JAZZ_ETHERNET_IRQ}, {0, 0}};
+
+/*
+ * We cannot use station (ethernet) address prefixes to detect the
+ * sonic controller since these are board manufacturer depended.
+ * So we check for known Silicon Revision IDs instead. 
+ */
+static unsigned short known_revisions[] =
+{
+  0x04,				/* Mips Magnum 4000 */
+  0xffff			/* end of list */
+};
+
+/* Index to functions, as function prototypes. */
+
+extern int sonic_probe(struct device *dev);
+static int sonic_probe1(struct device *dev, unsigned int base_addr, unsigned int irq);
+
+
+/*
+ * Probe for a SONIC ethernet controller on a Mips Jazz board.
+ * Actually probing is superfluous but we're paranoid.
+ */
+__initfunc(int sonic_probe(struct device *dev))
+{
+    unsigned int base_addr = dev ? dev->base_addr : 0;
+    int i;
+
+    /*
+     * Don't probe if we're not running on a Jazz board.
+     */
+    if (mips_machgroup != MACH_GROUP_JAZZ)
+	return -ENODEV;
+    if (base_addr >= KSEG0)	/* Check a single specified location. */
+	return sonic_probe1(dev, base_addr, dev->irq);
+    else if (base_addr != 0)	/* Don't probe at all. */
+	return -ENXIO;
+    
+    for (i = 0; sonic_portlist[i].port; i++) {
+	int base_addr = sonic_portlist[i].port;
+	if (check_region(base_addr, 0x100))
+	    continue;
+	if (sonic_probe1(dev, base_addr, sonic_portlist[i].irq) == 0)
+	    return 0;
+    }
+    return -ENODEV;
+}
+
+__initfunc(static int sonic_probe1(struct device *dev,
+                                   unsigned int base_addr, unsigned int irq))
+{
+    static unsigned version_printed = 0;
+    unsigned int silicon_revision;
+    unsigned int val;
+    struct sonic_local *lp;
+    int i;
+    
+    /*
+     * get the Silicon Revision ID. If this is one of the known
+     * one assume that we found a SONIC ethernet controller at
+     * the expected location.
+     */
+    silicon_revision = SONIC_READ(SONIC_SR);
+    if (sonic_debug > 1)
+      printk("SONIC Silicon Revision = 0x%04x\n",silicon_revision);
+
+    i = 0;
+    while ((known_revisions[i] != 0xffff) &&
+	   (known_revisions[i] != silicon_revision))
+      i++;
+	
+    if (known_revisions[i] == 0xffff) {
+	printk("SONIC ethernet controller not found (0x%4x)\n",
+	       silicon_revision);
+	return -ENODEV;
+    }
+    
+    request_region(base_addr, 0x100, "SONIC");
+    
+    /* Allocate a new 'dev' if needed. */
+    if (dev == NULL)
+      dev = init_etherdev(0, sizeof(struct sonic_local));
+
+    if (sonic_debug  &&  version_printed++ == 0)
+      printk(version);
+
+    printk("%s: %s found at 0x%08x, ",
+	   dev->name, "SONIC ethernet", base_addr);
+
+    /* Fill in the 'dev' fields. */
+    dev->base_addr = base_addr;
+    dev->irq = irq;
+
+    /*
+     * Put the sonic into software reset, then
+     * retrieve and print the ethernet address.
+     */
+    SONIC_WRITE(SONIC_CMD,SONIC_CR_RST);
+    SONIC_WRITE(SONIC_CEP,0);
+    for (i=0; i<3; i++) {
+	val = SONIC_READ(SONIC_CAP0-i);
+	dev->dev_addr[i*2] = val;
+	dev->dev_addr[i*2+1] = val >> 8;
+    }
+
+    printk("HW Address ");
+    for (i = 0; i < 6; i++) {
+	printk("%2.2x", dev->dev_addr[i]);
+	if (i<5)
+	  printk(":");
+    }
+    
+    printk(" IRQ %d\n", irq);
+    
+    /* Initialize the device structure. */
+    if (dev->priv == NULL) {
+	/*
+	 * the memory be located in the same 64kb segment
+	 */
+	lp = NULL;
+	i = 0;
+	do {
+	    lp = (struct sonic_local *)kmalloc(sizeof(*lp), GFP_KERNEL);
+	    if ((unsigned long)lp >> 16 != ((unsigned long)lp + sizeof(*lp) ) >> 16) {
+		/* FIXME, free the memory later */
+		kfree (lp);
+		lp = NULL;
+	    }
+	} while (lp == NULL && i++ < 20);
+	
+	if (lp == NULL) {
+	    printk ("%s: couldn't allocate memory for descriptors\n",
+	            dev->name);
+	    return -ENOMEM;
+	}
+	
+	memset(lp, 0, sizeof(struct sonic_local));
+	
+	/* get the virtual dma address */
+	lp->cda_laddr = vdma_alloc(PHYSADDR(lp),sizeof(*lp));
+	if (lp->cda_laddr == ~0UL) {
+	    printk ("%s: couldn't get DMA page entry for descriptors\n",
+	            dev->name);
+	    return -ENOMEM;
+	}
+
+	lp->tda_laddr = lp->cda_laddr + sizeof (lp->cda);
+	lp->rra_laddr = lp->tda_laddr + sizeof (lp->tda);
+	lp->rda_laddr = lp->rra_laddr + sizeof (lp->rra);
+	
+	/* allocate receive buffer area */
+	/* FIXME, maybe we should use skbs */
+	if ((lp->rba = (char *)kmalloc(SONIC_NUM_RRS * SONIC_RBSIZE, GFP_KERNEL)) == NULL) {
+	    printk ("%s: couldn't allocate receive buffers\n",dev->name);
+	    return -ENOMEM;
+	}
+	
+	/* get virtual dma address */
+	if ((lp->rba_laddr = vdma_alloc(PHYSADDR(lp->rba),SONIC_NUM_RRS * SONIC_RBSIZE)) == ~0UL) {
+	    printk ("%s: couldn't get DMA page entry for receive buffers\n",dev->name);
+	    return -ENOMEM;
+	}
+	
+	/* now convert pointer to KSEG1 pointer */
+	lp->rba = (char *)KSEG1ADDR(lp->rba);
+	flush_cache_all();
+	dev->priv = (struct sonic_local *)KSEG1ADDR(lp);
+    }
+
+    lp = (struct sonic_local *)dev->priv;
+    dev->open = sonic_open;
+    dev->stop = sonic_close;
+    dev->hard_start_xmit = sonic_send_packet;
+    dev->get_stats	= sonic_get_stats;
+    dev->set_multicast_list = &sonic_multicast_list;
+
+    /*
+     * clear tally counter
+     */
+    SONIC_WRITE(SONIC_CRCT,0xffff);
+    SONIC_WRITE(SONIC_FAET,0xffff);
+    SONIC_WRITE(SONIC_MPT,0xffff);
+
+    /* Fill in the fields of the device structure with ethernet values. */
+    ether_setup(dev);
+    return 0;
+}
+
+/*
+ *      SONIC uses a normal IRQ
+ */
+#define sonic_request_irq       request_irq
+#define sonic_free_irq          free_irq
+
+#define sonic_chiptomem(x)      KSEG1ADDR(vdma_log2phys(x))
+
+#include "sonic.c"
diff -u --recursive --new-file v2.3.8/linux/drivers/net/sgiseeq.c linux/drivers/net/sgiseeq.c
--- v2.3.8/linux/drivers/net/sgiseeq.c	Mon Nov 16 10:39:27 1998
+++ linux/drivers/net/sgiseeq.c	Fri Jun 25 17:39:52 1999
@@ -1,11 +1,9 @@
-/*
+/* $Id: sgiseeq.c,v 1.9 1998/10/14 23:40:46 ralf Exp $
+ *
X  * sgiseeq.c: Seeq8003 ethernet driver for SGI machines.
X  *
X  * Copyright (C) 1996 David S. Miller (d...@engr.sgi.com)
- *
- * $Id: sgiseeq.c,v 1.6 1998/10/14 17:29:44 ralf Exp $
X  */
-
X #include <linux/kernel.h>
X #include <linux/sched.h>
X #include <linux/types.h>
@@ -695,6 +693,7 @@
X 	dev->irq                  = irq;
X 	dev->dma                  = 0;
X 	ether_setup(dev);
+
X 	return 0;
X }
X 
@@ -724,15 +723,20 @@
X 
X int sgiseeq_probe(struct device *dev)
X {
+	static int initialized;
X 	char *ep;
X 
+	if (initialized)	/* Already initialized? */
+		return 0;
+	initialized++;
+
X 	/* First get the ethernet address of the onboard
X 	 * interface from ARCS.
+	 * (This is fragile; PROM doesn't like running from cache.)
X 	 */
X 	ep = romvec->get_evar("eaddr");
X 	str2eaddr(onboard_eth_addr, ep);
X 	return sgiseeq_init(dev,
X 			    (struct sgiseeq_regs *) (KSEG1ADDR(0x1fbd4000)),
X 			    &hpc3c0->ethregs, 3);
-
X }
diff -u --recursive --new-file v2.3.8/linux/drivers/net/sonic.c linux/drivers/net/sonic.c
--- v2.3.8/linux/drivers/net/sonic.c	Thu Jan  7 08:46:59 1999
+++ linux/drivers/net/sonic.c	Fri Jun 25 17:39:52 1999
@@ -1,290 +1,23 @@
X /*
X  * sonic.c
X  *
- * (C) 1996 by Thomas Bogendoerfer (tsbo...@bigbug.franken.de)
+ * (C) 1996,1998 by Thomas Bogendoerfer (tsbo...@alpha.franken.de)
X  * 
X  * This driver is based on work from Andreas Busse, but most of
X  * the code is rewritten.
X  * 
X  * (C) 1995 by Andreas Busse (an...@waldorf-gmbh.de)
X  *
- * A driver for the onboard Sonic ethernet controller on Mips Jazz
- * systems (Acer Pica-61, Mips Magnum 4000, Olivetti M700 and
- * perhaps others, too)
+ *    Core code included by system sonic drivers
X  */
X 
-static const char *version =
-	"sonic.c:v0.10 6.7.96 tsbo...@bigbug.franken.de\n";
-
X /*
X  * Sources: Olivetti M700-10 Risc Personal Computer hardware handbook,
X  * National Semiconductors data sheet for the DP83932B Sonic Ethernet
X  * controller, and the files "8390.c" and "skeleton.c" in this directory.
X  */
X 
-#include <linux/kernel.h>
-#include <linux/sched.h>
-#include <linux/types.h>
-#include <linux/fcntl.h>
-#include <linux/interrupt.h>
-#include <linux/ptrace.h>
-#include <linux/init.h>
-#include <linux/ioport.h>
-#include <linux/in.h>
-#include <linux/malloc.h>
-#include <linux/string.h>
-#include <linux/delay.h>
-#include <asm/bootinfo.h>
-#include <asm/system.h>
-#include <asm/bitops.h>
-#include <asm/pgtable.h>
-#include <asm/segment.h>
-#include <asm/io.h>
-#include <asm/dma.h>
-#include <asm/jazz.h>
-#include <asm/jazzdma.h>
-#include <linux/errno.h>
-
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
-#include <linux/skbuff.h>
-
-#include "sonic.h"
-
-/* use 0 for production, 1 for verification, >2 for debug */
-#ifdef SONIC_DEBUG
-static unsigned int sonic_debug = SONIC_DEBUG;
-#else 
-static unsigned int sonic_debug = 2;
-#endif
-
-/*
- * Some tunables for the buffer areas. Power of 2 is required
- * the current driver uses one receive buffer for each descriptor.
- */
-#define SONIC_NUM_RRS    16             /* number of receive resources */
-#define SONIC_NUM_RDS    SONIC_NUM_RRS  /* number of receive descriptors */
-#define SONIC_NUM_TDS    16      /* number of transmit descriptors */
-#define SONIC_RBSIZE   1520      /* size of one resource buffer */
-
-#define SONIC_RDS_MASK   (SONIC_NUM_RDS-1)
-#define SONIC_TDS_MASK   (SONIC_NUM_TDS-1)
X 
-/*
- * Base address and interupt of the SONIC controller on JAZZ boards
- */
-static struct {
-    unsigned int port;
-    unsigned int irq;
-    } sonic_portlist[] = { {JAZZ_ETHERNET_BASE, JAZZ_ETHERNET_IRQ}, {0, 0}};
-
-
-/* Information that need to be kept for each board. */
-struct sonic_local {
-    sonic_cda_t   cda;                     /* virtual CPU address of CDA */
-    sonic_td_t    tda[SONIC_NUM_TDS];      /* transmit descriptor area */
-    sonic_rr_t    rra[SONIC_NUM_RRS];      /* receive resource arrea */
-    sonic_rd_t    rda[SONIC_NUM_RDS];      /* receive descriptor area */
-    struct sk_buff* tx_skb[SONIC_NUM_TDS]; /* skbuffs for packets to transmit */
-    unsigned int  tx_laddr[SONIC_NUM_TDS]; /* logical DMA address fro skbuffs */
-    unsigned char *rba;                    /* start of receive buffer areas */    
-    unsigned int  cda_laddr;               /* logical DMA address of CDA */    
-    unsigned int  tda_laddr;               /* logical DMA address of TDA */
-    unsigned int  rra_laddr;               /* logical DMA address of RRA */    
-    unsigned int  rda_laddr;               /* logical DMA address of RDA */
-    unsigned int  rba_laddr;               /* logical DMA address of RBA */
-    unsigned int  cur_tx, cur_rx;          /* current indexes to resource areas */
-    unsigned int  dirty_tx,cur_rra;        /* last unacked transmit packet */
-    char tx_full;
-    struct enet_statistics stats;
-};
-
-/*
- * We cannot use station (ethernet) address prefixes to detect the
- * sonic controller since these are board manufacturer depended.
- * So we check for known Silicon Revision IDs instead. 
- */
-static unsigned short known_revisions[] =
-{
-  0x04,				/* Mips Magnum 4000 */
-  0xffff			/* end of list */
-};
-
-/* Index to functions, as function prototypes. */
-
-extern int sonic_probe(struct device *dev);
-static int sonic_probe1(struct device *dev, unsigned int base_addr, unsigned int irq);
-static int sonic_open(struct device *dev);
-static int sonic_send_packet(struct sk_buff *skb, struct device *dev);
-static void sonic_interrupt(int irq, void *dev_id, struct pt_regs *regs);
-static void sonic_rx(struct device *dev);
-static int sonic_close(struct device *dev);
-static struct enet_statistics *sonic_get_stats(struct device *dev);
-static void sonic_multicast_list(struct device *dev);
-static int sonic_init(struct device *dev);
-
-
-/*
- * Probe for a SONIC ethernet controller on a Mips Jazz board.
- * Actually probing is superfluous but we're paranoid.
- */
-__initfunc(int sonic_probe(struct device *dev))
-{
-    unsigned int base_addr = dev ? dev->base_addr : 0;
-    int i;
-
-    /*
-     * Don't probe if we're not running on a Jazz board.
-     */
-    if (mips_machgroup != MACH_GROUP_JAZZ)
-	return -ENODEV;
-    if (base_addr > 0x1ff)	/* Check a single specified location. */
-	return sonic_probe1(dev, base_addr, dev->irq);
-    else if (base_addr != 0)	/* Don't probe at all. */
-	return -ENXIO;
-    
-    for (i = 0; sonic_portlist[i].port; i++) {
-	int base_addr = sonic_portlist[i].port;
-	if (check_region(base_addr, 0x100))
-	    continue;
-	if (sonic_probe1(dev, base_addr, sonic_portlist[i].irq) == 0)
-	    return 0;
-    }
-    return -ENODEV;
-}
-
-__initfunc(static int sonic_probe1(struct device *dev,
-                                   unsigned int base_addr, unsigned int irq))
-{
-    static unsigned version_printed = 0;
-    unsigned int silicon_revision;
-    unsigned int val;
-    struct sonic_local *lp;
-    int i;
-    
-    /*
-     * get the Silicon Revision ID. If this is one of the known
-     * one assume that we found a SONIC ethernet controller at
-     * the expected location.
-     */
-    silicon_revision = SONIC_READ(SONIC_SR);
-    if (sonic_debug > 1)
-      printk("SONIC Silicon Revision = 0x%04x\n",silicon_revision);
-
-    i = 0;
-    while ((known_revisions[i] != 0xffff) &&
-	   (known_revisions[i] != silicon_revision))
-      i++;
-	
-    if (known_revisions[i] == 0xffff) {
-	printk("SONIC ethernet controller not found (0x%4x)\n",
-	       silicon_revision);
-	return -ENODEV;
-    }
-    
-    request_region(base_addr, 0x100, "SONIC");
-    
-    /* Allocate a new 'dev' if needed. */
-    if (dev == NULL)
-      dev = init_etherdev(0, sizeof(struct sonic_local));
-
-    if (sonic_debug  &&  version_printed++ == 0)
-      printk(version);
-
-    printk("%s: %s found at 0x%08x, ",
-	   dev->name, "SONIC ethernet", base_addr);
-
-    /* Fill in the 'dev' fields. */
-    dev->base_addr = base_addr;
-    dev->irq = irq;
-
-    /*
-     * Put the sonic into software reset, then
-     * retrieve and print the ethernet address.
-     */
-    SONIC_WRITE(SONIC_CMD,SONIC_CR_RST);
-    SONIC_WRITE(SONIC_CEP,0);
-    for (i=0; i<3; i++) {
-	val = SONIC_READ(SONIC_CAP0-i);
-	dev->dev_addr[i*2] = val;
-	dev->dev_addr[i*2+1] = val >> 8;
-    }
-
-    printk("HW Address ");
-    for (i = 0; i < 6; i++) {
-	printk("%2.2x", dev->dev_addr[i]);
-	if (i<5)
-	  printk(":");
-    }
-    
-    printk(" IRQ %d\n", irq);
-    
-    /* Initialize the device structure. */
-    if (dev->priv == NULL) {
-	/*
-	 * the memory be located in the same 64kb segment
-	 */
-	lp = NULL;
-	i = 0;
-	do {
-	    lp = (struct sonic_local *)kmalloc(sizeof(*lp), GFP_KERNEL);
-	    if ((unsigned long)lp >> 16 != ((unsigned long)lp + sizeof(*lp) ) >> 16) {
-		/* FIXME, free the memory later */
-		kfree (lp);
-		lp = NULL;
-	    }
-	} while (lp == NULL && i++ < 20);
-	
-	if (lp == NULL) {
-	    printk ("%s: couldn't allocate memory for descriptors\n",
-	            dev->name);
-	    return -ENOMEM;
-	}
-	
-	memset(lp, 0, sizeof(struct sonic_local));
-	
-	/* get the virtual dma address */
-	lp->cda_laddr = vdma_alloc(PHYSADDR(lp),sizeof(*lp));
-	if (lp->cda_laddr == ~0UL) {
-	    printk ("%s: couldn't get DMA page entry for descriptors\n",
-	            dev->name);
-	    return -ENOMEM;
-	}
-
-	lp->tda_laddr = lp->cda_laddr + sizeof (lp->cda);
-	lp->rra_laddr = lp->tda_laddr + sizeof (lp->tda);
-	lp->rda_laddr = lp->rra_laddr + sizeof (lp->rra);
-	
-	/* allocate receive buffer area */
-	/* FIXME, maybe we should use skbs */
-	if ((lp->rba = (char *)kmalloc(SONIC_NUM_RRS * SONIC_RBSIZE, GFP_KERNEL)) == NULL) {
-	    printk ("%s: couldn't allocate receive buffers\n",dev->name);
-	    return -ENOMEM;
-	}
-	
-	/* get virtual dma address */
-	if ((lp->rba_laddr = vdma_alloc(PHYSADDR(lp->rba),SONIC_NUM_RRS * SONIC_RBSIZE)) == ~0UL) {
-	    printk ("%s: couldn't get DMA page entry for receive buffers\n",dev->name);
-	    return -ENOMEM;
-	}
-	
-	/* now convert pointer to KSEG1 pointer */
-	lp->rba = (char *)KSEG1ADDR(lp->rba);
-	flush_cache_all();
-	dev->priv = (struct sonic_local *)KSEG1ADDR(lp);
-    }
-
-    lp = (struct sonic_local *)dev->priv;
-    dev->open = sonic_open;
-    dev->stop = sonic_close;
-    dev->hard_start_xmit = sonic_send_packet;
-    dev->get_stats	= sonic_get_stats;
-    dev->set_multicast_list = &sonic_multicast_list;
-
-    /* Fill in the fields of the device structure with ethernet values. */
-    ether_setup(dev);
-    return 0;
-}
X 
X /*
X  * Open/initialize the SONIC controller.
@@ -308,8 +41,8 @@
X  * covering another bug otherwise corrupting data.  This doesn't mean
X  * this glue works ok under all situations.
X  */
-//    if (request_irq(dev->irq, &sonic_interrupt, 0, "sonic", dev)) {
-    if (request_irq(dev->irq, &sonic_interrupt, SA_INTERRUPT, "sonic", dev)) {
+//    if (sonic_request_irq(dev->irq, &sonic_interrupt, 0, "sonic", dev)) {
+    if (sonic_request_irq(dev->irq, &sonic_interrupt, SA_INTERRUPT, "sonic", dev)) {
X 	printk ("\n%s: unable to get IRQ %d .\n", dev->name, dev->irq);
X 	return EAGAIN;
X     }
@@ -351,7 +84,7 @@
X     SONIC_WRITE(SONIC_IMR,0);
X     SONIC_WRITE(SONIC_CMD,SONIC_CR_RST);
X 
-    free_irq(dev->irq, dev);			/* release the IRQ */
+    sonic_free_irq(dev->irq, dev);		/* release the IRQ */
X 
X     return 0;
X }
@@ -424,11 +157,6 @@
X     lp->tda[entry].tx_frag_ptr_l = laddr & 0xffff;
X     lp->tda[entry].tx_frag_ptr_h = laddr >> 16;
X     lp->tda[entry].tx_frag_size  = length;
-    
-    /* if there are already packets queued, allow sending several packets at once */
-    if (lp->dirty_tx != lp->cur_tx)
-	lp->tda[(lp->cur_tx-1) % SONIC_TDS_MASK].link &= ~SONIC_END_OF_LINKS;
-    
X     lp->cur_tx++;
X     lp->stats.tx_bytes += length;
X     
@@ -479,20 +207,23 @@
X     
X     if (status & SONIC_INT_TXDN) {
X 	int dirty_tx = lp->dirty_tx;
-	
+
X 	while (dirty_tx < lp->cur_tx) {
X 	    int entry = dirty_tx & SONIC_TDS_MASK;
X 	    int status = lp->tda[entry].tx_status;
-	    
+
X 	    if (sonic_debug > 3)
X 	      printk ("sonic_interrupt: status %d, cur_tx %d, dirty_tx %d\n",
X 		      status,lp->cur_tx,lp->dirty_tx);
-	    
-	    if (status == 0)
-	      break;			/* It still hasn't been Txed */
+
+	    if (status == 0) {
+		/* It still hasn't been Txed, kick the sonic again */
+		SONIC_WRITE(SONIC_CMD,SONIC_CR_TXP);		
+		break;
+	    }
X 
X 	    /* put back EOL and free descriptor */
-	    lp->tda[entry].link |= SONIC_END_OF_LINKS;
+	    lp->tda[entry].tx_frag_count = 0;
X 	    lp->tda[entry].tx_status = 0;
X 
X 	    if (status & 0x0001)
@@ -574,27 +305,25 @@
X {
X     unsigned int base_addr = dev->base_addr;
X     struct sonic_local *lp = (struct sonic_local *)dev->priv;
-    int entry = lp->cur_rx & SONIC_RDS_MASK;
+    sonic_rd_t *rd = &lp->rda[lp->cur_rx & SONIC_RDS_MASK];
X     int status;
X 
-    while(lp->rda[entry].in_use == 0)
-    {
+    while (rd->in_use == 0) {
X 	struct sk_buff *skb;
X 	int pkt_len;
X 	unsigned char *pkt_ptr;
X 	
-	status = lp->rda[entry].rx_status;
+	status = rd->rx_status;
X 	if (sonic_debug > 3)
-	  printk ("status %x, cur_rx %d, cur_rra %d\n",status,lp->cur_rx,lp->cur_rra);
+	  printk ("status %x, cur_rx %d, cur_rra %x\n",status,lp->cur_rx,lp->cur_rra);
X 	if (status & SONIC_RCR_PRX) {	    
-	    pkt_len = lp->rda[entry].rx_pktlen;
-	    pkt_ptr = (char *)KSEG1ADDR(vdma_log2phys((lp->rda[entry].rx_pktptr_h << 16) +
-						      lp->rda[entry].rx_pktptr_l));
+	    pkt_len = rd->rx_pktlen;
+	    pkt_ptr = (char *)sonic_chiptomem((rd->rx_pktptr_h << 16) +
+						      rd->rx_pktptr_l);
X 	    
X 	    if (sonic_debug > 3)
-	      printk ("pktptr %p (rba %p) h:%x l:%x, rra h:%x l:%x bsize h:%x l:%x\n", pkt_ptr,lp->rba,
-		      lp->rda[entry].rx_pktptr_h,lp->rda[entry].rx_pktptr_l,
-		      lp->rra[lp->cur_rra & 15].rx_bufadr_h,lp->rra[lp->cur_rra & 15].rx_bufadr_l,
+	      printk ("pktptr %p (rba %p) h:%x l:%x, bsize h:%x l:%x\n", pkt_ptr,lp->rba,
+		      rd->rx_pktptr_h,rd->rx_pktptr_l,
X 		      SONIC_READ(SONIC_RBWC1),SONIC_READ(SONIC_RBWC0));
X 	
X 	    /* Malloc up new buffer. */
@@ -620,21 +349,26 @@
X 	    if (status & SONIC_RCR_CRCR) lp->stats.rx_crc_errors++;
X 	}
X 	
-	lp->rda[entry].in_use = 1;
-	entry = (++lp->cur_rx) & SONIC_RDS_MASK;
+	rd->in_use = 1;
+	rd = &lp->rda[(++lp->cur_rx) & SONIC_RDS_MASK];
X 	/* now give back the buffer to the receive buffer area */
X 	if (status & SONIC_RCR_LPKT) {
X 	    /*
X 	     * this was the last packet out of the current receice buffer
X 	     * give the buffer back to the SONIC
X 	     */
-	    SONIC_WRITE(SONIC_RWP,(lp->rra_laddr + (++lp->cur_rra & 15) * sizeof(sonic_rr_t)) & 0xffff);
-	}
+	    lp->cur_rra += sizeof(sonic_rr_t);
+	    if (lp->cur_rra > (lp->rra_laddr + (SONIC_NUM_RRS-1) * sizeof(sonic_rr_t)))
+		lp->cur_rra = lp->rra_laddr;
+	    SONIC_WRITE(SONIC_RWP, lp->cur_rra & 0xffff);
+	} else
+	    printk ("%s: rx desc without RCR_LPKT. Shouldn't happen !?\n",dev->name);
X     }
-  
-    /* If any worth-while packets have been received, dev_rint()
-     has done a mark_bh(NET_BH) for us and will work on them
-     when we get to the bottom-half routine. */
+    /*
+     * If any worth-while packets have been received, dev_rint()
+     * has done a mark_bh(NET_BH) for us and will work on them
+     * when we get to the bottom-half routine.
+     */
X     return;
X }
X 
@@ -689,16 +423,15 @@
X 	    for (i = 1; i <= dev->mc_count; i++) {
X 		addr = dmi->dmi_addr;
X 		dmi = dmi->next;
-		lp->cda.cam_desc[i].cam_frag2 = addr[1] << 8 | addr[0];
-		lp->cda.cam_desc[i].cam_frag1 = addr[3] << 8 | addr[2];
-		lp->cda.cam_desc[i].cam_frag0 = addr[5] << 8 | addr[4];
+		lp->cda.cam_desc[i].cam_cap0 = addr[1] << 8 | addr[0];
+		lp->cda.cam_desc[i].cam_cap1 = addr[3] << 8 | addr[2];
+		lp->cda.cam_desc[i].cam_cap2 = addr[5] << 8 | addr[4];
X 		lp->cda.cam_enable |= (1 << i);
X 	    }
-	    /* number of CAM entries to load */
-	    SONIC_WRITE(SONIC_CDC,dev->mc_count+1);
+	    SONIC_WRITE(SONIC_CDC,16);
X 	    /* issue Load CAM command */
X 	    SONIC_WRITE(SONIC_CDP, lp->cda_laddr & 0xffff);	    
-	    SONIC_WRITE(SONIC_CMD,SONIC_CR_LCAM);	    
+	    SONIC_WRITE(SONIC_CMD,SONIC_CR_LCAM);
X 	}
X     }
X     
@@ -736,7 +469,6 @@
X     SONIC_WRITE(SONIC_CMD,0);
X     SONIC_WRITE(SONIC_CMD,SONIC_CR_RXDIS);
X 
-
X     /*
X      * initialize the receive resource area
X      */
@@ -761,7 +493,7 @@
X     SONIC_WRITE(SONIC_URRA,lp->rra_laddr >> 16);
X     SONIC_WRITE(SONIC_EOBC,(SONIC_RBSIZE-2) >> 1);
X     
-    lp->cur_rra = SONIC_NUM_RRS - 2;
+    lp->cur_rra = lp->rra_laddr + (SONIC_NUM_RRS-1) * sizeof(sonic_rr_t);
X 
X     /* load the resource pointers */
X     if (sonic_debug > 3)
@@ -796,7 +528,6 @@
X     /* fix last descriptor */
X     lp->rda[SONIC_NUM_RDS-1].link = lp->rda_laddr;
X     lp->cur_rx = 0;
-    
X     SONIC_WRITE(SONIC_URDA,lp->rda_laddr >> 16);
X     SONIC_WRITE(SONIC_CRDA,lp->rda_laddr & 0xffff);
X     
@@ -816,13 +547,14 @@
X 
X     SONIC_WRITE(SONIC_UTDA,lp->tda_laddr >> 16);
X     SONIC_WRITE(SONIC_CTDA,lp->tda_laddr & 0xffff);
+    lp->cur_tx = lp->dirty_tx = 0;
X     
X     /*
X      * put our own address to CAM desc[0]
X      */
-    lp->cda.cam_desc[0].cam_frag2 = dev->dev_addr[1] << 8 | dev->dev_addr[0];
-    lp->cda.cam_desc[0].cam_frag1 = dev->dev_addr[3] << 8 | dev->dev_addr[2];
-    lp->cda.cam_desc[0].cam_frag0 = dev->dev_addr[5] << 8 | dev->dev_addr[4];
+    lp->cda.cam_desc[0].cam_cap0 = dev->dev_addr[1] << 8 | dev->dev_addr[0];
+    lp->cda.cam_desc[0].cam_cap1 = dev->dev_addr[3] << 8 | dev->dev_addr[2];
+    lp->cda.cam_desc[0].cam_cap2 = dev->dev_addr[5] << 8 | dev->dev_addr[4];
X     lp->cda.cam_enable = 1;
X     
X     for (i=0; i < 16; i++)
@@ -832,7 +564,7 @@
X      * initialize CAM registers
X      */
X     SONIC_WRITE(SONIC_CDP, lp->cda_laddr & 0xffff);
-    SONIC_WRITE(SONIC_CDC,1);
+    SONIC_WRITE(SONIC_CDC,16);
X     
X     /*
X      * load the CAM
diff -u --recursive --new-file v2.3.8/linux/drivers/net/sonic.h linux/drivers/net/sonic.h
--- v2.3.8/linux/drivers/net/sonic.h	Thu Jun 26 12:33:39 1997
+++ linux/drivers/net/sonic.h	Fri Jun 25 17:39:52 1999
@@ -15,16 +15,6 @@
X #define SONIC_H
X 
X /*
- * Macros to access SONIC registers
- */
-#define SONIC_READ(reg) \
-	*((volatile unsigned int *)base_addr+reg)
-
-#define SONIC_WRITE(reg,val) \
-	*((volatile unsigned int *)base_addr+reg) = val
-
-
-/*
X  * SONIC register offsets
X  */
X  
@@ -242,9 +232,9 @@
X 
X typedef struct {
X   u16 rx_status;	/* status after reception of a packet */
-  u16 pad0;
+  SREGS_PAD(pad0);
X   u16 rx_pktlen;	/* length of the packet incl. CRC */
-  u16 pad1;
+  SREGS_PAD(pad1);
X   
X   /*
X    * Pointers to the location in the receive buffer area (RBA)
@@ -252,22 +242,22 @@
X    * a contiguous piece of memory.
X    */
X   u16 rx_pktptr_l;
-  u16 pad2;
+  SREGS_PAD(pad2);
X   u16 rx_pktptr_h;
-  u16 pad3;
+  SREGS_PAD(pad3);
X 
X   u16 rx_seqno;	/* sequence no. */
-  u16 pad4;
+  SREGS_PAD(pad4);
X 
X   u16 link;		/* link to next RDD (end if EOL bit set) */
-  u16 pad5;
+  SREGS_PAD(pad5);
X 
X   /*
X    * Owner of this descriptor, 0= driver, 1=sonic
X    */
X   
X   u16 in_use;	
-  u16 pad6;
+  SREGS_PAD(pad6);
X 
X   caddr_t rda_next;		/* pointer to next RD */
X } sonic_rd_t;
@@ -278,23 +268,23 @@
X  */
X typedef struct {
X   u16 tx_status;	/* status after transmission of a packet */
-  u16 pad0;		
+  SREGS_PAD(pad0);
X   u16 tx_config;	/* transmit configuration for this packet */
-  u16 pad1;		
+  SREGS_PAD(pad1);
X   u16 tx_pktsize;	/* size of the packet to be transmitted */
-  u16 pad2;		
+  SREGS_PAD(pad2);
X   u16 tx_frag_count;	/* no. of fragments */
-  u16 pad3;		
+  SREGS_PAD(pad3);
X 
X   u16 tx_frag_ptr_l;
-  u16 pad4;		
+  SREGS_PAD(pad4);
X   u16 tx_frag_ptr_h;
-  u16 pad5;		
+  SREGS_PAD(pad5);
X   u16 tx_frag_size;
-  u16 pad6;		
+  SREGS_PAD(pad6);
X   
X   u16 link;		/* ptr to next descriptor */
-  u16 pad7;		
+  SREGS_PAD(pad7);
X } sonic_td_t;
X 
X 
@@ -304,13 +294,13 @@
X 
X typedef struct {
X   u16 cam_entry_pointer;
-  u16 pad;
-  u16 cam_frag2;
-  u16 pad2;
-  u16 cam_frag1;
-  u16 pad1;
-  u16 cam_frag0;
-  u16 pad0;
+  SREGS_PAD(pad0);
+  u16 cam_cap0;
+  SREGS_PAD(pad1);
+  u16 cam_cap1;
+  SREGS_PAD(pad2);
+  u16 cam_cap2;
+  SREGS_PAD(pad3);
X } sonic_cd_t;
X 
X #define CAM_DESCRIPTORS 16
@@ -319,8 +309,56 @@
X typedef struct {
X   sonic_cd_t cam_desc[CAM_DESCRIPTORS];
X   u16 cam_enable;
-  u16 pad;
+  SREGS_PAD(pad);
X } sonic_cda_t;
X 
+/*
+ * Some tunables for the buffer areas. Power of 2 is required
+ * the current driver uses one receive buffer for each descriptor.
+ */
+#define SONIC_NUM_RRS    16             /* number of receive resources */
+#define SONIC_NUM_RDS    SONIC_NUM_RRS  /* number of receive descriptors */
+#define SONIC_NUM_TDS    16      /* number of transmit descriptors */
+#define SONIC_RBSIZE   1520      /* size of one resource buffer */
+
+#define SONIC_RDS_MASK   (SONIC_NUM_RDS-1)
+#define SONIC_TDS_MASK   (SONIC_NUM_TDS-1)
+
+
+/* Information that need to be kept for each board. */
+struct sonic_local {
+    sonic_cda_t   cda;                     /* virtual CPU address of CDA */
+    sonic_td_t    tda[SONIC_NUM_TDS];      /* transmit descriptor area */
+    sonic_rr_t    rra[SONIC_NUM_RRS];      /* receive resource arrea */
+    sonic_rd_t    rda[SONIC_NUM_RDS];      /* receive descriptor area */
+    struct sk_buff* tx_skb[SONIC_NUM_TDS]; /* skbuffs for packets to transmit */
+    unsigned int  tx_laddr[SONIC_NUM_TDS]; /* logical DMA address fro skbuffs */
+    unsigned char *rba;                    /* start of receive buffer areas */    
+    unsigned int  cda_laddr;               /* logical DMA address of CDA */    
+    unsigned int  tda_laddr;               /* logical DMA address of TDA */
+    unsigned int  rra_laddr;               /* logical DMA address of RRA */    
+    unsigned int  rda_laddr;               /* logical DMA address of RDA */
+    unsigned int  rba_laddr;               /* logical DMA address of RBA */
+    unsigned int  cur_rra;                 /* current indexes to resource areas */
+    unsigned int  cur_rx;
+    unsigned int  cur_tx;
+    unsigned int  dirty_tx;                /* last unacked transmit packet */
+    char tx_full;
+    struct enet_statistics stats;
+};
+
+/* Index to functions, as function prototypes. */
+
+static int sonic_open(struct device *dev);
+static int sonic_send_packet(struct sk_buff *skb, struct device *dev);
+static void sonic_interrupt(int irq, void *dev_id, struct pt_regs *regs);
+static void sonic_rx(struct device *dev);
+static int sonic_close(struct device *dev);
+static struct enet_statistics *sonic_get_stats(struct device *dev);
+static void sonic_multicast_list(struct device *dev);
+static int sonic_init(struct device *dev);
+
+static const char *version =
+	"sonic.c:v0.92 20.9.98 tsbo...@alpha.franken.de\n";
X 
X #endif /* SONIC_H */
diff -u --recursive --new-file v2.3.8/linux/drivers/net/yellowfin.c linux/drivers/net/yellowfin.c
--- v2.3.8/linux/drivers/net/yellowfin.c	Fri Dec 18 09:45:17 1998
+++ linux/drivers/net/yellowfin.c	Tue Jun 29 09:02:35 1999
@@ -76,6 +76,7 @@
X #include <linux/pci.h>
X #include <asm/processor.h>		/* Processor type for cache alignment. */
X #include <asm/bitops.h>
+#include <asm/unaligned.h>
X #include <asm/io.h>
X 
X #include <linux/netdevice.h>
@@ -1054,7 +1055,7 @@
X 		u16 desc_status = desc->status;
X 		int data_size = desc->request_cnt - desc->result_cnt;
X 		u8 *buf_addr = bus_to_virt(desc->addr);
-		s16 frame_status = *(s16*)&(buf_addr[data_size - 2]); /* ?Alpha safe on 885? */
+		s16 frame_status = get_unaligned((s16*)(buf_addr+data_size-2));
X 
X 		if (yellowfin_debug > 4)
X 			printk(KERN_DEBUG "  yellowfin_rx() status was %4.4x.\n",
diff -u --recursive --new-file v2.3.8/linux/drivers/pci/proc.c linux/drivers/pci/proc.c
--- v2.3.8/linux/drivers/pci/proc.c	Mon Aug 24 13:14:10 1998
+++ linux/drivers/pci/proc.c	Sun Jun 27 10:10:41 1999
@@ -222,11 +222,14 @@
X 	NULL,			/* rename */
X 	NULL,			/* readlink */
X NULL, /* follow_link */
+	NULL,			/* get_block */
X 	NULL,			/* readpage */
X 	NULL,			/* writepage */
-	NULL,			/* bmap */
+	NULL,			/* flushpage */
X 	NULL,			/* truncate */
-	NULL			/* permission */
+	NULL,			/* permission */
+	NULL,			/* smap */
+	NULL			/* revalidate */
X };
X 
X int
diff -u --recursive --new-file v2.3.8/linux/drivers/sbus/char/aurora.c linux/drivers/sbus/char/aurora.c
--- v2.3.8/linux/drivers/sbus/char/aurora.c	Wed Jun  9 14:44:25 1999
+++ linux/drivers/sbus/char/aurora.c	Wed Jun 30 11:24:54 1999
@@ -45,7 +45,6 @@
X #include <linux/interrupt.h>
X #include <linux/tty.h>
X #include <linux/tty_flip.h>
-#include <linux/config.h>
X #include <linux/major.h>
X #include <linux/string.h>
X #include <linux/fcntl.h>
diff -u --recursive --new-file v2.3.8/linux/drivers/scsi/aic7xxx_proc.c linux/drivers/scsi/aic7xxx_proc.c
--- v2.3.8/linux/drivers/scsi/aic7xxx_proc.c	Wed Jun  9 16:59:15 1999
+++ linux/drivers/scsi/aic7xxx_proc.c	Wed Jun 30 11:24:54 1999
@@ -29,6 +29,8 @@
X  *  $Id: aic7xxx_proc.c,v 4.1 1997/06/97 08:23:42 deang Exp $
X  *-M*************************************************************************/
X 
+#include <linux/config.h>
+
X #define	BLS	(&aic7xxx_buffer[size])
X #define HDRB \
X "             < 2K      2K+     4K+     8K+    16K+    32K+    64K+   128K+"
diff -u --recursive --new-file v2.3.8/linux/drivers/scsi/sd.c linux/drivers/scsi/sd.c
--- v2.3.8/linux/drivers/scsi/sd.c	Mon Jun  7 16:50:56 1999
+++ linux/drivers/scsi/sd.c	Tue Jun 29 09:22:08 1999
@@ -945,7 +945,7 @@
X 		printk("maxsg = %x, counted = %d this_count = %d\n",
X 		       max_sg, counted, this_count);
X 		while(bh){
-		    printk("[%p %lx] ", bh->b_data, bh->b_size);
+		    printk("[%p %x] ", bh->b_data, bh->b_size);
X 		    bh = bh->b_reqnext;
X 		}
X 		if(SCpnt->use_sg < 16)
diff -u --recursive --new-file v2.3.8/linux/drivers/scsi/st.c linux/drivers/scsi/st.c
--- v2.3.8/linux/drivers/scsi/st.c	Sat May 22 14:50:22 1999
+++ linux/drivers/scsi/st.c	Tue Jun 29 09:22:08 1999
@@ -890,7 +890,7 @@
X     kdev_t devt = inode->i_rdev;
X     int dev;
X 
-    if (filp->f_count > 1)
+    if (atomic_read(&filp->f_count) > 1)
X 	return 0;
X 
X     dev = TAPE_NR(devt);
diff -u --recursive --new-file v2.3.8/linux/drivers/sgi/Config.in linux/drivers/sgi/Config.in
--- v2.3.8/linux/drivers/sgi/Config.in	Wed Dec 31 16:00:00 1969
+++ linux/drivers/sgi/Config.in	Fri Jun 25 17:39:34 1999
@@ -0,0 +1,18 @@
+#
+# Character device configuration
+#
+mainmenu_option next_comment
+comment 'SGI devices'
+
+bool 'SGI Zilog85C30 serial support' CONFIG_SGI_SERIAL
+if [ "$CONFIG_SGI_SERIAL" != "n" ]; then
+  define_bool CONFIG_SERIAL y
+fi
+
+bool 'SGI DS1286  RTC support' CONFIG_SGI_DS1286
+
+if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then  
+  tristate 'SGI Newport Graphics support' CONFIG_SGI_NEWPORT_GFX
+fi
+
+endmenu
diff -u --recursive --new-file v2.3.8/linux/drivers/sgi/Makefile linux/drivers/sgi/Makefile
--- v2.3.8/linux/drivers/sgi/Makefile	Wed Dec 10 10:31:11 1997
+++ linux/drivers/sgi/Makefile	Fri Jun 25 17:39:34 1999
@@ -8,13 +8,15 @@
X # Note 2! The CFLAGS definitions are now in the main makefile...
X 
X SUB_DIRS     :=
-MOD_SUB_DIRS := $(SUB_DIRS)
+MOD_SUB_DIRS := $(SUB_DIRS) char
X ALL_SUB_DIRS := $(SUB_DIRS) char
X 
+
X L_OBJS   := 
X L_TARGET := sgi.a
+MOD_LIST_NAME := SGI_MODULES
X 
-# Character devices for SGI machines.
+# Character and Audio devices for SGI machines.
X #
X SUB_DIRS += char
X L_OBJS += char/sgichar.o
diff -u --recursive --new-file v2.3.8/linux/drivers/sgi/char/Makefile linux/drivers/sgi/char/Makefile
--- v2.3.8/linux/drivers/sgi/char/Makefile	Wed Dec 10 10:31:11 1997
+++ linux/drivers/sgi/char/Makefile	Fri Jun 25 17:39:34 1999
@@ -8,11 +8,25 @@
X # Note 2! The CFLAGS definitions are now in the main makefile...
X 
X O_TARGET := sgichar.o
-O_OBJS   := graphics.o streamable.o newport.o cons_newport.o sgicons.o \
-	vga_font.o rrm.o shmiq.o usema.o
+OX_OBJS := newport.o
+O_OBJS   := sgicons.o \
+	usema.o shmiq.o streamable.o
X 
X ifeq ($(CONFIG_SGI_SERIAL),y)
X   O_OBJS += sgiserial.o
+endif
+
+ifeq ($(CONFIG_SGI_DS1286),y)
+  O_OBJS += ds1286.o
+endif
+
+ifeq ($(CONFIG_SGI_NEWPORT_GFX),y)
+  O_OBJS +=  graphics.o rrm.o
+else 
+ifeq ($(CONFIG_SGI_NEWPORT_GFX),m)
+  OX_OBJS  +=  graphics_syms.o
+  MX_OBJS +=  graphics.o rrm.o
+endif
X endif
X 
X include $(TOPDIR)/Rules.make
diff -u --recursive --new-file v2.3.8/linux/drivers/sgi/char/cons_newport.c linux/drivers/sgi/char/cons_newport.c
--- v2.3.8/linux/drivers/sgi/char/cons_newport.c	Fri May  8 00:23:41 1998
+++ linux/drivers/sgi/char/cons_newport.c	Wed Dec 31 16:00:00 1969
@@ -1,611 +0,0 @@
-/*
- * cons_newport.c: Newport graphics console code for the SGI.
- *
- * Copyright (C) 1996 David S. Miller (d...@engr.sgi.com)
- *
- * $Id: cons_newport.c,v 1.1 1998/01/10 19:05:47 ecd Exp $
- */
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/sched.h>
-#include <linux/string.h>
-#include <linux/timer.h>
-#include <linux/interrupt.h>
-#include <linux/errno.h>
-#include <linux/kd.h>
-#include <linux/tty.h>
-#include <linux/malloc.h>
-#include <linux/major.h>
-#include <linux/mm.h>
-#include <linux/version.h>
-
-#include <asm/uaccess.h>
-#include <asm/system.h>
-#include <asm/page.h>
-#include <asm/pgtable.h>
-#include <asm/bitops.h>
-#include <asm/sgialib.h>
-#include <asm/ptrace.h>
-
-#include <linux/kbd_kern.h>
-#include <linux/vt_kern.h>
-#include <linux/consolemap.h>
-#include <linux/selection.h>
-#include <linux/console_struct.h>
-
-#include "gconsole.h"
-#include "newport.h"
-#include "graphics.h" /* Just for now */
-#include <asm/gfx.h>
-#include <asm/ng1.h>
-
-#if 0
-#include "linux_logo.h"
-#endif
-
-#define BMASK(c) (c << 24)
-
-#define RENDER(regs, cp) do { \
-(regs)->go.zpattern = BMASK((cp)[0x0]); (regs)->go.zpattern = BMASK((cp)[0x1]); \
-(regs)->go.zpattern = BMASK((cp)[0x2]); (regs)->go.zpattern = BMASK((cp)[0x3]); \
-(regs)->go.zpattern = BMASK((cp)[0x4]); (regs)->go.zpattern = BMASK((cp)[0x5]); \
-(regs)->go.zpattern = BMASK((cp)[0x6]); (regs)->go.zpattern = BMASK((cp)[0x7]); \
-(regs)->go.zpattern = BMASK((cp)[0x8]); (regs)->go.zpattern = BMASK((cp)[0x9]); \
-(regs)->go.zpattern = BMASK((cp)[0xa]); (regs)->go.zpattern = BMASK((cp)[0xb]); \
-(regs)->go.zpattern = BMASK((cp)[0xc]); (regs)->go.zpattern = BMASK((cp)[0xd]); \
-(regs)->go.zpattern = BMASK((cp)[0xe]); (regs)->go.zpattern = BMASK((cp)[0xf]); \
-} while(0)        
-
-#define REVERSE_RENDER(regs, cp) do { \
-(regs)->go.zpattern = BMASK((~(cp)[0x0])); (regs)->go.zpattern = BMASK((~(cp)[0x1])); \
-(regs)->go.zpattern = BMASK((~(cp)[0x2])); (regs)->go.zpattern = BMASK((~(cp)[0x3])); \
-(regs)->go.zpattern = BMASK((~(cp)[0x4])); (regs)->go.zpattern = BMASK((~(cp)[0x5])); \
-(regs)->go.zpattern = BMASK((~(cp)[0x6])); (regs)->go.zpattern = BMASK((~(cp)[0x7])); \
-(regs)->go.zpattern = BMASK((~(cp)[0x8])); (regs)->go.zpattern = BMASK((~(cp)[0x9])); \
-(regs)->go.zpattern = BMASK((~(cp)[0xa])); (regs)->go.zpattern = BMASK((~(cp)[0xb])); \
-(regs)->go.zpattern = BMASK((~(cp)[0xc])); (regs)->go.zpattern = BMASK((~(cp)[0xd])); \
-(regs)->go.zpattern = BMASK((~(cp)[0xe])); (regs)->go.zpattern = BMASK((~(cp)[0xf])); \
-} while(0)        
-
-extern int default_red[16], default_grn[16], default_blu[16];
-extern unsigned char video_type;
-
-static int cursor_pos = -1;
-struct newport_regs *npregs;
-
-#define TESTVAL 0xdeadbeef
-#define XSTI_TO_FXSTART(val) (((val) & 0xffff) << 11)
-
-static inline void
-newport_disable_video(void)
-{
-	unsigned short treg;
-
-	treg = newport_vc2_get(npregs, VC2_IREG_CONTROL);
-	newport_vc2_set(npregs, VC2_IREG_CONTROL, (treg & ~(VC2_CTRL_EVIDEO)));
-}
-
-static inline void
-newport_enable_video(void)
-{
-	unsigned short treg;
-
-	treg = newport_vc2_get(npregs, VC2_IREG_CONTROL);
-	newport_vc2_set(npregs, VC2_IREG_CONTROL, (treg | VC2_CTRL_EVIDEO));
-}
-
-static inline void
-newport_disable_cursor(void)
-{
-	unsigned short treg;
-
-	treg = newport_vc2_get(npregs, VC2_IREG_CONTROL);
-	newport_vc2_set(npregs, VC2_IREG_CONTROL, (treg & ~(VC2_CTRL_ECDISP)));
-}
-
-#if 0
-static inline void
-newport_enable_cursor(void)
-{
-	unsigned short treg;
-
-	treg = newport_vc2_get(npregs, VC2_IREG_CONTROL);
-	newport_vc2_set(npregs, VC2_IREG_CONTROL, (treg | VC2_CTRL_ECDISP));
-}
-#endif
-
-static inline void
-newport_init_cmap(void)
-{
-	unsigned short i;
-
-	for(i = 0; i < 16; i++) {
-		newport_bfwait();
-		newport_cmap_setaddr(npregs, color_table[i]);
-		newport_cmap_setrgb(npregs,
-				    default_red[i],
-				    default_grn[i],
-				    default_blu[i]);
-	}
-}
-
-#if 0
-static inline void
-newport_init_cursor(void)
-{
-	unsigned char cursor[256];
-	unsigned short *cookie;
-	int i;
-
-	for(i = 0; i < 256; i++)
-		cursor[i] = 0x0;
-	for(i = 211; i < 256; i+=4) {
-		cursor[i] = 0xff;
-#if 0
-		cursor[(i + 128) << 2] = 0xff;
-		cursor[((i + 128) << 2) + 1] = 0xff;
-#endif
-	}
-
-	/* Load the SRAM on the VC2 for this new GLYPH. */
-	cookie = (unsigned short *) cursor;
-	newport_vc2_set(npregs, VC2_IREG_RADDR, VC2_CGLYPH_ADDR);
-	npregs->set.dcbmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_RAM |
-			       NPORT_DMODE_W2 | VC2_PROTOCOL);
-	for(i = 0; i < 128; i++) {
-		newport_bfwait();
-		npregs->set.dcbdata0.hwords.s1 = *cookie++;
-	}
-
-	/* Place the cursor at origin. */
-	newport_vc2_set(npregs, VC2_IREG_CURSX, 0);
-	newport_vc2_set(npregs, VC2_IREG_CURSY, 0);
-	newport_enable_cursor();
-}
-#endif
-
-static inline void
-newport_clear_screen(void)
-{
-	newport_wait();
-	npregs->set.wrmask = 0xffffffff;
-	npregs->set.drawmode0 = (NPORT_DMODE0_DRAW | NPORT_DMODE0_BLOCK |
-			      NPORT_DMODE0_DOSETUP | NPORT_DMODE0_STOPX |
-			      NPORT_DMODE0_STOPY);
-	npregs->set.colori = 0;
-	npregs->set.xystarti = 0;
-	npregs->go.xyendi = (((1280 + 63) << 16)|(1024));
-	newport_bfwait();
-}
-
-static inline void
-newport_render_version(void)
-{
-#if 0
-	unsigned short *ush;
-	int currcons = 0;
-	char *p;
-
-	ush = (unsigned short *) video_mem_base + video_num_columns * 2 + 20;
-	for (p = "SGI/Linux version " UTS_RELEASE; *p; p++, ush++) {
-		*ush = (attr << 8) + *p;
-		newport_blitc (*ush, (unsigned long) ush);
-	}
-#endif
-}
-
-#if 0
-static inline void
-newport_render_logo(void)
-{
-	int i, xpos, ypos;
-	unsigned char *bmap;
-
-	xpos = 8;
-	ypos = 18;
-
-	newport_wait();
-	npregs->set.colori = 9;
-	npregs->set.drawmode0 = (NPORT_DMODE0_DRAW | NPORT_DMODE0_BLOCK |
-			      NPORT_DMODE0_STOPX | NPORT_DMODE0_ZPENAB |
-			      NPORT_DMODE0_L32);
-
-	for(i = 0; i < 80; i+=8) {
-		/* Set coordinates for bitmap operation. */
-		npregs->set.xystarti = ((xpos + i) << 16) | ypos;
-		npregs->set.xyendi = (((xpos + i) + 7) << 16);
-		newport_wait();
-
-		bmap = linux_logo + (i * 80);
-		RENDER(npregs, bmap); bmap += 0x10;
-		RENDER(npregs, bmap); bmap += 0x10;
-		RENDER(npregs, bmap); bmap += 0x10;
-		RENDER(npregs, bmap); bmap += 0x10;
-		RENDER(npregs, bmap);
-	}
-	prom_getchar();
-	prom_imode();
-}
-#endif
-
-static inline void
-newport_render_background(int xpos, int ypos, int ci)
-{
-	newport_wait();
-	npregs->set.wrmask = 0xffffffff;
-	npregs->set.drawmode0 = (NPORT_DMODE0_DRAW | NPORT_DMODE0_BLOCK |
-			      NPORT_DMODE0_DOSETUP | NPORT_DMODE0_STOPX |
-			      NPORT_DMODE0_STOPY);
-	npregs->set.colori = ci;
-	npregs->set.xystarti = (xpos << 16) | ypos;
-	npregs->go.xyendi = ((xpos + 7) << 16) | (ypos + 15);
-}
-
-void
-newport_set_origin(unsigned short offset)
-{
-	/* maybe this works... */
-	__origin = offset;
-}
-
-void
-newport_hide_cursor(void)
-{
-	int xpos, ypos, idx;
-	unsigned long flags;
-
-	if(vt_cons[fg_console]->vc_mode == KD_GRAPHICS)
-		return;
-	save_and_cli(flags);
-
-	idx = cursor_pos;
-	if(idx == -1) {
-		restore_flags(flags);
-		return;
-	}
-	xpos = 8 + ((idx % video_num_columns) << 3);
-	ypos = 18 + ((idx / video_num_columns) << 4);
-	newport_render_background(xpos, ypos, 0);
-	restore_flags(flags);
-}
-
-void
-newport_set_cursor(int currcons)
-{
-	int xpos, ypos, idx, oldpos;
-	unsigned short *sp, *osp, cattr;
-	unsigned long flags;
-	unsigned char *p;
-
-	if (currcons != fg_console || console_blanked || vcmode == KD_GRAPHICS)
-		return;
-
-	if (__real_origin != __origin)
-		__set_origin(__real_origin);
-
-	save_and_cli(flags);
-
-	idx = (pos - video_mem_base) >> 1;
-	sp = (unsigned short *) pos;
-	oldpos = cursor_pos;
-	cursor_pos = idx;
-	if(!deccm) {
-		hide_cursor();
-		restore_flags(flags);
-		return;
-	}
-	xpos = 8 + ((idx % video_num_columns) << 3);
-	ypos = 18 + ((idx / video_num_columns) << 4);
-	if(oldpos != -1) {
-		int oxpos, oypos;
-
-		/* Restore old location. */
-		osp = (unsigned short *) ((oldpos << 1) + video_mem_base);
-		oxpos = 8 + ((oldpos % video_num_columns) << 3);
-		oypos = 18 + ((oldpos / video_num_columns) << 4);
-		cattr = *osp;
-		newport_render_background(oxpos, oypos, (cattr & 0xf000) >> 12);
-		p = &vga_font[(cattr & 0xff) << 4];
-		newport_wait();
-		npregs->set.colori = (cattr & 0x0f00) >> 8;
-		npregs->set.drawmode0 = (NPORT_DMODE0_DRAW | NPORT_DMODE0_BLOCK |
-				      NPORT_DMODE0_STOPX | NPORT_DMODE0_ZPENAB |
-				      NPORT_DMODE0_L32);
-		npregs->set.xystarti = (oxpos << 16) | oypos;
-		npregs->set.xyendi = ((oxpos + 7) << 16);
-		newport_wait();
-		RENDER(npregs, p);
-	}
-	cattr = *sp;
-	newport_render_background(xpos, ypos, (cattr & 0xf000) >> 12);
-	p = &vga_font[(cattr & 0xff) << 4];
-	newport_wait();
-	npregs->set.colori = (cattr & 0x0f00) >> 8;
-	npregs->set.drawmode0 = (NPORT_DMODE0_DRAW | NPORT_DMODE0_BLOCK |
-			      NPORT_DMODE0_STOPX | NPORT_DMODE0_ZPENAB |
-			      NPORT_DMODE0_L32);
-	npregs->set.xystarti = (xpos << 16) | ypos;
-	npregs->set.xyendi = ((xpos + 7) << 16);
-	newport_wait();
-	REVERSE_RENDER(npregs, p);
-	restore_flags (flags);
-	return;
-}
-
-void
-newport_get_scrmem(int currcons)
-{
-	memcpyw((unsigned short *)vc_scrbuf[currcons],
-		(unsigned short *)origin, video_screen_size);
-	origin = video_mem_start = (unsigned long)vc_scrbuf[currcons];
-	scr_end = video_mem_end = video_mem_start + video_screen_size;
-	pos = origin + y*video_size_row + (x<<1);
-}
-
-void
-newport_set_scrmem(int currcons, long offset)
-{
-	if (video_mem_term - video_mem_base < offset + video_screen_size)
-		offset = 0;
-	memcpyw((unsigned short *)(video_mem_base + offset),
-		(unsigned short *) origin, video_screen_size);
-	video_mem_start = video_mem_base;
-	video_mem_end = video_mem_term;
-	origin = video_mem_base + offset;
-	scr_end = origin + video_screen_size;
-	pos = origin + y*video_size_row + (x<<1);
-	has_wrapped = 0;
-}
-
-int
-newport_set_get_cmap(unsigned char * arg, int set)
-{
-	unsigned short ent;
-	int i;
-
-	i = verify_area(set ? VERIFY_READ : VERIFY_WRITE, (void *)arg, 16*3);
-	if (i)
-		return i;
-
-	for (i=0; i<16; i++) {
-		if (set) {
-			__get_user(default_red[i], arg++);
-			__get_user(default_grn[i], arg++);
-			__get_user(default_blu[i], arg++);
-		} else {
-			__put_user (default_red[i], arg++);
-			__put_user (default_grn[i], arg++);
-			__put_user (default_blu[i], arg++);
-		}
-	}
-	if (set) {
-		for (i=0; i<MAX_NR_CONSOLES; i++) {
-			if (vc_cons_allocated(i)) {
-				int j, k;
-				for (j = k = 0; j<16; j++) {
-					vc_cons[i].d->vc_palette[k++] =
-						default_red[j];
-					vc_cons[i].d->vc_palette[k++] =
-						default_grn[j];
-					vc_cons[i].d->vc_palette[k++] =
-						default_blu[j];
-				}
-			}
-		}
-		if(console_blanked || vt_cons[fg_console]->vc_mode == KD_GRAPHICS)
-			return 0;
-		for(ent = 0; ent < 16; ent++) {
-			newport_bfwait();
-			newport_cmap_setaddr(npregs, ent);
-			newport_cmap_setrgb(npregs,
-					    default_red[ent],
-					    default_grn[ent],
-					    default_blu[ent]);
-		}
-	}
-
-	return 0;
-}
-
-void
-newport_blitc(unsigned short charattr, unsigned long addr)
-{
-	int idx, xpos, ypos;
-	unsigned char *p;
-
-	idx = (addr - (video_mem_base + (__origin<<1))) >> 1;
-	xpos = 8 + ((idx % video_num_columns) << 3);
-	ypos = 18 + ((idx / video_num_columns) << 4);
-
-	p = &vga_font[(charattr & 0xff) << 4];
-	charattr = (charattr >> 8) & 0xff;
-
-	newport_render_background(xpos, ypos, (charattr & 0xf0) >> 4);
-
-	/* Set the color and drawing mode. */
-	newport_wait();
-	npregs->set.colori = charattr & 0xf;
-	npregs->set.drawmode0 = (NPORT_DMODE0_DRAW | NPORT_DMODE0_BLOCK |
-			      NPORT_DMODE0_STOPX | NPORT_DMODE0_ZPENAB |
-			      NPORT_DMODE0_L32);
-
-	/* Set coordinates for bitmap operation. */
-	npregs->set.xystarti = (xpos << 16) | ypos;
-	npregs->set.xyendi = ((xpos + 7) << 16);
-	newport_wait();
-
-	/* Go, baby, go... */
-	RENDER(npregs, p);
-}
-
-void
-newport_memsetw(void * s, unsigned short c, unsigned int count)
-{
-	unsigned short * addr = (unsigned short *) s;
-
-	count /= 2;
-	if (vt_cons[fg_console]->vc_mode == KD_GRAPHICS) {
-		while (count) {
-			count--;
-			*addr++ = c;
-		}
-		return;
-	}
-	if ((unsigned long) addr + count > video_mem_term ||
-	    (unsigned long) addr < video_mem_base) {
-	    	if ((unsigned long) addr + count <= video_mem_term ||
-	    	    (unsigned long) addr > video_mem_base) {
-			while (count) {
-				count--;
-				*addr++ = c;
-			}
-			return;
-	    	} else {
-			while (count) {
-				count--;
-				scr_writew(c, addr++);
-			}
-		}
-	} else {
-		while (count) {
-			count--;
-			if (*addr != c) {
-				newport_blitc(c, (unsigned long)addr);
-				*addr++ = c;
-			} else
-				addr++;
-		}
-	}
-}
-
-void
-newport_memcpyw(unsigned short *to, unsigned short *from, unsigned int count)
-{
-	if (vt_cons[fg_console]->vc_mode == KD_GRAPHICS) {
-		memcpy(to, from, count);
-		return;
-	}
-	if ((unsigned long) to + count > video_mem_term ||
-	    (unsigned long) to < video_mem_base) {
-	    	if ((unsigned long) to + count <= video_mem_term ||
-	    	    (unsigned long) to > video_mem_base)
-	    	    	memcpy(to, from, count);
-	    	else {
-	    		count /= 2;
-			while (count) {
-				count--;
-				scr_writew(scr_readw(from++), to++);
-			}
-		}
-	} else {
-		count /= 2;
-		while (count) {
-			count--;
-			if (*to != *from) {
-				newport_blitc(*from, (unsigned long)to);
-				*to++ = *from++;
-			} else {
-				from++;
-				to++;
-			}
-		}
-	}
-}
-
-struct console_ops newport_console = {
-	newport_set_origin,
-	newport_hide_cursor,
-	newport_set_cursor,
-	newport_get_scrmem,
-	newport_set_scrmem,
-	newport_set_get_cmap,
-	newport_blitc,
-	newport_memsetw,
-	newport_memcpyw
-};
-
-/* Currently hard-coded values that are the same as those found on my system */
-struct ng1_info newport_board_info = {
-	{ "NG1", "" /* what is the label? */, 1280, 1024, sizeof (struct ng1_info) },
-	6,			/* boardrev */
-	1,			/* rex3rev */
-	0,			/* vc2rev */
-	2,			/* monitor type */
-        0,			/* videoinstalled */
-	3,			/* mcrev */
-	24,			/* bitplanes */
-	0,			/* xmap9rev */
-	2,			/* cmaprev */
-	{ 256, 1280, 1024, 76},	/* ng1_vof_info */
-	13,			/* paneltype */
-	0
-};
-
-void
-newport_reset (void)
-{
-	newport_wait();
-	newport_enable_video();
-
-	/* Init the cursor disappear. */
-	newport_wait();
-#if 0
-	newport_init_cursor();
-#else
-	newport_disable_cursor();
-#endif
-
-	newport_init_cmap();
-
-	/* Clear the screen. */
-	newport_clear_screen();
-}
-
-/* right now the newport does not do anything at all */
-struct graphics_ops newport_graphic_ops = {
-	0,			      /* owner */
-	0,			      /* current user */
-	(void *) &newport_board_info, /* board info */
-	sizeof (struct ng1_info),     /* size of our data structure */
-	0, 0,			      /* g_regs, g_regs_size */
-	newport_save, newport_restore, /* g_save_context, g_restore_context */
-	newport_reset, newport_ioctl /* g_reset_console, g_ioctl */
-};
-
-struct graphics_ops *
-newport_probe (int slot, const char **name)
-{
-	struct newport_regs *p;
-
-	npregs = (struct newport_regs *) (KSEG1 + 0x1f0f0000);
-	
-	p = npregs;
-	p->cset.config = NPORT_CFG_GD0;
-
-	if(newport_wait()) {
-		prom_printf("whoops, timeout, no NEWPORT there?");
-		return 0;
-	}
-
-	p->set.xstarti = TESTVAL; if(p->set._xstart.i != XSTI_TO_FXSTART(TESTVAL)) {
-		prom_printf("newport_probe: read back wrong value ;-(\n");
-		return 0;
-	}
-
-	if (slot == 0){
-		register_gconsole (&newport_console);
-		video_type = VIDEO_TYPE_SGI;
-		can_do_color = 1;
-		*name = "NEWPORT";
-	}
-
-	newport_reset ();
-	newport_render_version();
-#if 0
-	newport_render_logo();
-#endif
-	newport_graphic_ops.g_regs = 0x1f0f0000;
-	newport_graphic_ops.g_regs_size = sizeof (struct newport_regs);
-	return &newport_graphic_ops;
-}
diff -u --recursive --new-file v2.3.8/linux/drivers/sgi/char/ds1286.c linux/drivers/sgi/char/ds1286.c
--- v2.3.8/linux/drivers/sgi/char/ds1286.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/sgi/char/ds1286.c	Fri Jun 25 17:39:34 1999
@@ -0,0 +1,568 @@
+/* $Id: ds1286.c,v 1.4 1999/06/17 13:29:03 ralf Exp $
+ *
+ *	Real Time Clock interface for Linux	
+ *
+ *	Copyright (C) 1998, 1999 Ralf Baechle
+ *	
+ *	Based on code written by Paul Gortmaker.
+ *
+ *	This driver allows use of the real time clock (built into
+ *	nearly all computers) from user space. It exports the /dev/rtc
+ *	interface supporting various ioctl() and also the /proc/rtc
+ *	pseudo-file for status information.
+ *
+ *	The ioctls can be used to set the interrupt behaviour and
+ *	generation rate from the RTC via IRQ 8. Then the /dev/rtc
+ *	interface can be used to make use of these timer interrupts,
+ *	be they interval or alarm based.
+ *
+ *	The /dev/rtc interface will block on reads until an interrupt
+ *	has been received. If a RTC interrupt has already happened,
+ *	it will output an unsigned long and then block. The output value
+ *	contains the interrupt status in the low byte and the number of
+ *	interrupts since the last read in the remaining high bytes. The 
+ *	/dev/rtc interface can also be used with the select(2) call.
+ *
+ *	This program is free software; you can redistribute it and/or
+ *	modify it under the terms of the GNU General Public License
+ *	as published by the Free Software Foundation; either version
+ *	2 of the License, or (at your option) any later version.
+ */
+#include <linux/types.h>
+#include <linux/errno.h>
+#include <linux/miscdevice.h>
+#include <linux/malloc.h>
+#include <linux/ioport.h>
+#include <linux/fcntl.h>
+#include <linux/init.h>
+#include <linux/poll.h>
+#include <linux/rtc.h>
+
+#include <asm/ds1286.h>
+#include <asm/io.h>
+#include <asm/uaccess.h>
+#include <asm/spinlock.h>
+#include <asm/system.h>
+
+#define DS1286_VERSION		"1.0"
+
+/*
+ *	We sponge a minor off of the misc major. No need slurping
+ *	up another valuable major dev number for this. If you add
+ *	an ioctl, make sure you don't conflict with SPARC's RTC
+ *	ioctls.
+ */
+
+static DECLARE_WAIT_QUEUE_HEAD(ds1286_wait);
+
+static long long ds1286_llseek(struct file *file, loff_t offset, int origin);
+
+static ssize_t ds1286_read(struct file *file, char *buf,
+			size_t count, loff_t *ppos);
+
+static int ds1286_ioctl(struct inode *inode, struct file *file,
+                        unsigned int cmd, unsigned long arg);
+
+static unsigned int ds1286_poll(struct file *file, poll_table *wait);
+
+void get_rtc_time (struct rtc_time *rtc_tm);
+void get_rtc_alm_time (struct rtc_time *alm_tm);
+
+void set_rtc_irq_bit(unsigned char bit);
+void clear_rtc_irq_bit(unsigned char bit);
+
+static inline unsigned char ds1286_is_updating(void);
+
+#ifdef __SMP__
+static spinlock_t ds1286_lock = SPIN_LOCK_UNLOCKED;
+#endif
+
+/*
+ *	Bits in rtc_status. (7 bits of room for future expansion)
+ */
+
+#define RTC_IS_OPEN		0x01	/* means /dev/rtc is in use	*/
+#define RTC_TIMER_ON		0x02	/* missed irq timer active	*/
+
+unsigned char ds1286_status = 0;	/* bitmapped status byte.	*/
+unsigned long ds1286_freq = 0;		/* Current periodic IRQ rate	*/
+unsigned long ds1286_irq_data = 0;	/* our output to the world	*/
+
+unsigned char days_in_mo[] = 
+{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
+
+/*
+ *	A very tiny interrupt handler. It runs with SA_INTERRUPT set,
+ *	so that there is no possibility of conflicting with the
+ *	set_rtc_mmss() call that happens during some timer interrupts.
+ *	(See ./arch/XXXX/kernel/time.c for the set_rtc_mmss() function.)
+ */
+
+/*
+ *	Now all the various file operations that we export.
+ */
+
+static long long ds1286_llseek(struct file *file, loff_t offset, int origin)
+{
+	return -ESPIPE;
+}
+
+static ssize_t ds1286_read(struct file *file, char *buf,
+                           size_t count, loff_t *ppos)
+{
+	DECLARE_WAITQUEUE(wait, current);
+	unsigned long data;
+	ssize_t retval;
+	
+	if (count < sizeof(unsigned long))
+		return -EINVAL;
+
+	add_wait_queue(&ds1286_wait, &wait);
+
+	current->state = TASK_INTERRUPTIBLE;
+		
+	while ((data = xchg(&ds1286_irq_data, 0)) == 0) {
+		if (file->f_flags & O_NONBLOCK) {
+			retval = -EAGAIN;
+			goto out;
+		}
+		if (signal_pending(current)) {
+			retval = -ERESTARTSYS;
+			goto out;
+		}
+		schedule();
+	}
+
+	retval = put_user(data, (unsigned long *)buf); 
+	if (!retval)
+		retval = sizeof(unsigned long); 
+ out:
+	current->state = TASK_RUNNING;
+	remove_wait_queue(&ds1286_wait, &wait);
+
+	return retval;
+}
+
+static int ds1286_ioctl(struct inode *inode, struct file *file,
+                        unsigned int cmd, unsigned long arg)
+{
+
+	struct rtc_time wtime; 
+
+	switch (cmd) {
+	case RTC_AIE_OFF:	/* Mask alarm int. enab. bit	*/
+	{
+		unsigned int flags;
+		unsigned char val;
+
+		if (!capable(CAP_SYS_TIME))
+			return -EACCES;
+
+		spin_lock_irqsave(&ds1286_lock, flags);
+		val = CMOS_READ(RTC_CMD);
+		val |=  RTC_TDM;
+		CMOS_WRITE(val, RTC_CMD);
+		spin_unlock_irqrestore(&ds1286_lock, flags);
+
+		return 0;
+	}
+	case RTC_AIE_ON:	/* Allow alarm interrupts.	*/
+	{
+		unsigned int flags;
+		unsigned char val;
+
+		if (!capable(CAP_SYS_TIME))
+			return -EACCES;
+
+		spin_lock_irqsave(&ds1286_lock, flags);
+		val = CMOS_READ(RTC_CMD);
+		val &=  ~RTC_TDM;
+		CMOS_WRITE(val, RTC_CMD);
+		spin_unlock_irqrestore(&ds1286_lock, flags);
+
+		return 0;
+	}
+	case RTC_WIE_OFF:	/* Mask watchdog int. enab. bit	*/
+	{
+		unsigned int flags;
+		unsigned char val;
+
+		if (!capable(CAP_SYS_TIME))
+			return -EACCES;
+
+		spin_lock_irqsave(&ds1286_lock, flags);
+		val = CMOS_READ(RTC_CMD);
+		val |= RTC_WAM;
+		CMOS_WRITE(val, RTC_CMD);
+		spin_unlock_irqrestore(&ds1286_lock, flags);
+
+		return 0;
+	}
+	case RTC_WIE_ON:	/* Allow watchdog interrupts.	*/
+	{
+		unsigned int flags;
+		unsigned char val;
+
+		if (!capable(CAP_SYS_TIME))
+			return -EACCES;
+
+		spin_lock_irqsave(&ds1286_lock, flags);
+		val = CMOS_READ(RTC_CMD);
+		val &= ~RTC_WAM;
+		CMOS_WRITE(val, RTC_CMD);
+		spin_unlock_irqrestore(&ds1286_lock, flags);
+
+		return 0;
+	}
+	case RTC_ALM_READ:	/* Read the present alarm time */
+	{
+		/*
+		 * This returns a struct rtc_time. Reading >= 0xc0
+		 * means "don't care" or "match all". Only the tm_hour,
+		 * tm_min, and tm_sec values are filled in.
+		 */
+
+		get_rtc_alm_time(&wtime);
+		break; 
+	}
+	case RTC_ALM_SET:	/* Store a time into the alarm */
+	{
+		/*
+		 * This expects a struct rtc_time. Writing 0xff means
+		 * "don't care" or "match all". Only the tm_hour,
SHAR_EOF
true || echo 'restore of patch-2.3.9 failed'
fi
echo 'End of  part 14'
echo 'File patch-2.3.9 is continued in part 15'
echo 15 > _shar_seq_.tmp
exit 0
#!/bin/sh
# this is part 16 of a 26 - part archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file patch-2.3.9 continued
if test ! -r _shar_seq_.tmp; then
        echo 'Please unpack part 1 first!'
        exit 1
fi
(read Scheck
if test "$Scheck" != 16; then
        echo Please unpack part "$Scheck" next!
        exit 1
 else
        exit 0
 fi
) < _shar_seq_.tmp || exit 1
if test ! -f _shar_wnt_.tmp; then
echo 'x - still skipping patch-2.3.9'
else
echo 'x - continuing with patch-2.3.9'
sed 's/^X//' << 'SHAR_EOF' >> 'patch-2.3.9' &&
+
+	i = con->cflag & CBAUD;
+	if (con->cflag & CBAUDEX) {
+		i &= ~CBAUDEX;
+		con->cflag &= ~CBAUDEX;
+	}
+	info->zs_baud = baud;
+
+	switch (con->cflag & CSIZE) {
+		case CS5:
+			zscons_regs[3] = Rx5 | RxENABLE;
+			zscons_regs[5] = Tx5 | TxENAB;
+			break;
+		case CS6:
+			zscons_regs[3] = Rx6 | RxENABLE;
+			zscons_regs[5] = Tx6 | TxENAB;
+			break;
+		case CS7:
+			zscons_regs[3] = Rx7 | RxENABLE;
+			zscons_regs[5] = Tx7 | TxENAB;
+			break;
+		default:
+		case CS8:
+			zscons_regs[3] = Rx8 | RxENABLE;
+			zscons_regs[5] = Tx8 | TxENAB;
+			break;
+	}
+	zscons_regs[5] |= DTR;
+
+	if (con->cflag & PARENB)
+		zscons_regs[4] |= PAR_ENA;
+	if (!(con->cflag & PARODD))
+		zscons_regs[4] |= PAR_EVEN;
+
+	if (con->cflag & CSTOPB)
+		zscons_regs[4] |= SB2;
+	else
+		zscons_regs[4] |= SB1;
+
+	brg = BPS_TO_BRG(baud, ZS_CLOCK / info->clk_divisor);
+	zscons_regs[12] = brg & 0xff;
+	zscons_regs[13] = (brg >> 8) & 0xff;
+	memcpy(info->curregs, zscons_regs, sizeof(zscons_regs));
+	memcpy(info->pendregs, zscons_regs, sizeof(zscons_regs));    
+	load_zsregs(info->zs_channel, zscons_regs);
+	ZS_CLEARERR(info->zs_channel);
+	ZS_CLEARFIFO(info->zs_channel);
+	return 0;
+}
+
+static struct console sgi_console_driver = {
+        "ttyS",
+        zs_console_write,       /* write */
+        NULL,                   /* read */
+        zs_console_device,      /* device */
+        zs_console_wait_key,    /* wait_key */
+        NULL,                   /* unblank */
+        zs_console_setup,       /* setup */
+        CON_PRINTBUFFER,
+        -1,
+        0,
+        NULL
+};
+
+/*
+ *	Register console.
+ */
+__initfunc (long serial_console_init(long kmem_start, long kmem_end))
+{
+	register_console(&sgi_console_driver);
+	return kmem_start;
+}
+
+
diff -u --recursive --new-file v2.3.8/linux/drivers/sgi/char/sgiserial.h linux/drivers/sgi/char/sgiserial.h
--- v2.3.8/linux/drivers/sgi/char/sgiserial.h	Sat May 15 15:05:36 1999
+++ linux/drivers/sgi/char/sgiserial.h	Fri Jun 25 17:39:34 1999
@@ -412,7 +412,8 @@
X 
X 	udelay(2);
X 	channel->control = ERR_RES;
-	junk = ioc_icontrol->istat0;
+	if (ioc_icontrol)
+		junk = ioc_icontrol->istat0;
X }
X 
X extern inline void ZS_CLEARFIFO(struct sgi_zschannel *channel)
@@ -421,11 +422,17 @@
X 
X 	udelay(2);
X 	junk = channel->data;
-	udelay(2); junk = ioc_icontrol->istat0;
+	udelay(2);
+	if (ioc_icontrol)
+		junk = ioc_icontrol->istat0;
X 	junk = channel->data;
-	udelay(2); junk = ioc_icontrol->istat0;
+	udelay(2);
+	if (ioc_icontrol)
+		junk = ioc_icontrol->istat0;
X 	junk = channel->data;
-	udelay(2); junk = ioc_icontrol->istat0;
+	udelay(2);
+	if (ioc_icontrol)
+		junk = ioc_icontrol->istat0;
X }
X 
X #if 0
diff -u --recursive --new-file v2.3.8/linux/drivers/sgi/char/shmiq.c linux/drivers/sgi/char/shmiq.c
--- v2.3.8/linux/drivers/sgi/char/shmiq.c	Sat May 15 15:05:36 1999
+++ linux/drivers/sgi/char/shmiq.c	Fri Jun 25 17:39:34 1999
@@ -1,4 +1,5 @@
-/*
+/* $Id: shmiq.c,v 1.12 1999/06/17 13:29:04 ralf Exp $
+ *
X  * shmiq.c: shared memory input queue driver
X  * written 1997 Miguel de Icaza (mig...@nuclecu.unam.mx)
X  *
@@ -47,6 +48,7 @@
X #include <linux/sched.h>
X #include <linux/file.h>
X #include <linux/interrupt.h>
+#include <linux/poll.h>
X #include <linux/vmalloc.h>
X #include <linux/wait.h>
X #include <linux/major.h>
@@ -82,7 +84,7 @@
X 	int    events;
X 	int    mapped;
X 	
-	wait_queue_head_t     proc_list;
+	wait_queue_head_t    proc_list;
X 	struct fasync_struct *fasync;
X } shmiqs [MAX_SHMI_QUEUES];
X 
@@ -237,7 +239,7 @@
X 	return -EBADF;
X }
X 
-extern sys_munmap(unsigned long addr, size_t len);
+extern int sys_munmap(unsigned long addr, size_t len);
X 
X static int
X qcntl_ioctl (struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg, int minor)
@@ -394,12 +396,12 @@
X }
X 
X static int
-shmiq_qcntl_fasync (struct file *file, int on)
+shmiq_qcntl_fasync (int fd, struct file *file, int on)
X {
X 	int retval;
X 	int minor = MINOR (file->f_dentry->d_inode->i_rdev);
X 
-	retval = fasync_helper (file, on, &shmiqs [minor].fasync);
+	retval = fasync_helper (fd, file, on, &shmiqs [minor].fasync);
X 	if (retval < 0)
X 		return retval;
X 	return 0;
@@ -422,7 +424,7 @@
X 		return -EINVAL;
X 
X 	lock_kernel ();
-	shmiq_qcntl_fasync (filp, 0);
+	shmiq_qcntl_fasync (-1, filp, 0);
X 	shmiqs [minor].opened      = 0;
X 	shmiqs [minor].mapped      = 0;
X 	shmiqs [minor].events      = 0;
diff -u --recursive --new-file v2.3.8/linux/drivers/sgi/char/streamable.c linux/drivers/sgi/char/streamable.c
--- v2.3.8/linux/drivers/sgi/char/streamable.c	Mon Aug 24 13:14:10 1998
+++ linux/drivers/sgi/char/streamable.c	Fri Jun 25 17:39:34 1999
@@ -1,4 +1,5 @@
-/*
+/* $Id: streamable.c,v 1.9 1998/09/19 19:17:50 ralf Exp $
+ *
X  * streamable.c: streamable devices. /dev/gfx
X  * (C) 1997 Miguel de Icaza (mig...@nuclecu.unam.mx)
X  *
@@ -51,14 +52,14 @@
X static int
X sgi_gfx_open (struct inode *inode, struct file *file)
X {
-	printk ("GFX: Opened by %d\n", current->pid);
+	printk ("GFX: Opened by %ld\n", current->pid);
X 	return 0;
X }
X 
X static int
X sgi_gfx_close (struct inode *inode, struct file *file)
X {
-	printk ("GFX: Closed by %d\n", current->pid);
+	printk ("GFX: Closed by %ld\n", current->pid);
X 	return 0;
X }
X 
diff -u --recursive --new-file v2.3.8/linux/drivers/sgi/char/usema.c linux/drivers/sgi/char/usema.c
--- v2.3.8/linux/drivers/sgi/char/usema.c	Sat May 15 15:05:36 1999
+++ linux/drivers/sgi/char/usema.c	Tue Jun 29 09:22:08 1999
@@ -27,11 +27,13 @@
X #include <linux/sched.h>
X #include <linux/file.h>
X #include <linux/major.h>
+#include <linux/poll.h>
X #include <linux/string.h>
X #include <linux/dcache.h>
X #include <linux/mm.h>
X #include <linux/slab.h>
X #include <linux/smp_lock.h>
+#include "usema.h"
X 
X #include <asm/usioctl.h>
X #include <asm/mman.h>
@@ -42,6 +44,7 @@
X 	wait_queue_head_t proc_list;
X };
X 
+
X static int
X sgi_usema_attach (usattach_t * attach, struct irix_usema *usema)
X {
@@ -51,7 +54,7 @@
X 		return newfd;
X 	
X 	current->files->fd [newfd] = usema->filp;
-	usema->filp->f_count++;
+	atomic_inc(&usema->filp->f_count);
X 	/* Is that it? */
X 	printk("UIOCATTACHSEMA: new usema fd is %d", newfd);
X 	return newfd;
@@ -64,7 +67,7 @@
X 	struct irix_usema *usema = file->private_data;
X 	int retval;
X 	
-	printk("[%s:%d] wants ioctl 0x%xd (arg 0x%lx)",
+	printk("[%s:%ld] wants ioctl 0x%xd (arg 0x%lx)",
X 	       current->comm, current->pid, cmd, arg);
X 
X 	switch(cmd) {
@@ -76,7 +79,7 @@
X 		usattach_t *attach = (usattach_t *)arg;
X 		retval = verify_area(VERIFY_READ, attach, sizeof(usattach_t));
X 		if (retval) {
-			printk("[%s:%d] sgi_usema_ioctl(UIOCATTACHSEMA): "
+			printk("[%s:%ld] sgi_usema_ioctl(UIOCATTACHSEMA): "
X 			       "verify_area failure",
X 			       current->comm, current->pid);
X 			return retval;
@@ -84,7 +87,8 @@
X 		if (usema == 0)
X 			return -EINVAL;
X 
-		printk("UIOCATTACHSEMA: attaching usema %p to process %d\n", usema, current->pid);
+		printk("UIOCATTACHSEMA: attaching usema %p to process %ld\n",
+		       usema, current->pid);
X 		/* XXX what is attach->us_handle for? */
X 		return sgi_usema_attach(attach, usema);
X 		break;
@@ -97,12 +101,12 @@
X 
X 		retval = verify_area(VERIFY_READ, attach, sizeof(usattach_t));
X 		if (retval) {
-			printk("[%s:%d] sgi_usema_ioctl(UIOC*BLOCK): "
+			printk("[%s:%ld] sgi_usema_ioctl(UIOC*BLOCK): "
X 			       "verify_area failure",
X 			       current->comm, current->pid);
X 			return retval;
X 		}
-		printk("UIOC*BLOCK: putting process %d to sleep on usema %p",
+		printk("UIOC*BLOCK: putting process %ld to sleep on usema %p",
X 		       current->pid, usema);
X 		if (cmd == UIOCNOIBLOCK)
X 			interruptible_sleep_on(&usema->proc_list);
@@ -117,13 +121,13 @@
X 
X 		retval = verify_area(VERIFY_READ, attach, sizeof(usattach_t));
X 		if (retval) {
-			printk("[%s:%d] sgi_usema_ioctl(UIOC*BLOCK): "
+			printk("[%s:%ld] sgi_usema_ioctl(UIOC*BLOCK): "
X 			       "verify_area failure",
X 			       current->comm, current->pid);
X 			return retval;
X 		}
X 
-		printk("[%s:%d] releasing usema %p",
+		printk("[%s:%ld] releasing usema %p",
X 		       current->comm, current->pid, usema);
X 		wake_up(&usema->proc_list);
X 		return 0;
@@ -137,7 +141,8 @@
X {
X 	struct irix_usema *usema = filp->private_data;
X 	
-	printk("[%s:%d] wants to poll usema %p", current->comm, current->pid, usema);
+	printk("[%s:%ld] wants to poll usema %p",
+	       current->comm, current->pid, usema);
X 	
X 	return 0;
X }
@@ -152,10 +157,11 @@
X 		return -ENOMEM;
X 	
X 	usema->filp        = filp;
-	usema->proc_list   = NULL;
+	init_waitqueue_head(&usema->proc_list);
X 	filp->private_data = usema;
+
X 	return 0;
-}	
+}
X 
X static int
X sgi_usemaclone_release(struct inode *inode, struct file *filp)
@@ -187,6 +193,7 @@
X void
X usema_init(void)
X {
-	printk("usemaclone misc device registered (minor: %d)\n", SGI_USEMACLONE);
+	printk("usemaclone misc device registered (minor: %d)\n",
+	       SGI_USEMACLONE);
X 	misc_register(&dev_usemaclone);
X }
diff -u --recursive --new-file v2.3.8/linux/drivers/sgi/char/usema.h linux/drivers/sgi/char/usema.h
--- v2.3.8/linux/drivers/sgi/char/usema.h	Wed Dec 31 16:00:00 1969
+++ linux/drivers/sgi/char/usema.h	Fri Jun 25 17:39:35 1999
@@ -0,0 +1,10 @@
+/* usema.h
+ *
+ * Copyright (C) 1996 Alex deVries <puf...@redhat.com>
+ */
+#ifndef _SGI_USEMA_H
+#define _SGI_USEMA_H
+
+void usema_init (void); 
+
+#endif
diff -u --recursive --new-file v2.3.8/linux/drivers/sgi/char/vga_font.c linux/drivers/sgi/char/vga_font.c
--- v2.3.8/linux/drivers/sgi/char/vga_font.c	Wed Dec 10 10:31:11 1997
+++ linux/drivers/sgi/char/vga_font.c	Wed Dec 31 16:00:00 1969
@@ -1,346 +0,0 @@
-#include "gconsole.h"
-
-unsigned char vga_font[cmapsz] = {
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x81, 0xa5, 0x81, 0x81, 0xbd, 
-0x99, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xff, 
-0xdb, 0xff, 0xff, 0xc3, 0xe7, 0xff, 0xff, 0x7e, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x6c, 0xfe, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x10, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x7c, 0xfe, 
-0x7c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 
-0x3c, 0x3c, 0xe7, 0xe7, 0xe7, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x7e, 0x18, 0x18, 0x3c, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 
-0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 
-0xff, 0xff, 0xe7, 0xc3, 0xc3, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x42, 0x42, 0x66, 0x3c, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc3, 0x99, 0xbd, 
-0xbd, 0x99, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x1e, 0x0e, 
-0x1a, 0x32, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18, 0x18, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x33, 0x3f, 0x30, 0x30, 0x30, 
-0x30, 0x70, 0xf0, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x63, 
-0x7f, 0x63, 0x63, 0x63, 0x63, 0x67, 0xe7, 0xe6, 0xc0, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x18, 0x18, 0xdb, 0x3c, 0xe7, 0x3c, 0xdb, 0x18, 0x18, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfe, 0xf8, 
-0xf0, 0xe0, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x0e, 
-0x1e, 0x3e, 0xfe, 0x3e, 0x1e, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 
-0x66, 0x00, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xdb, 
-0xdb, 0xdb, 0x7b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x7c, 0xc6, 0x60, 0x38, 0x6c, 0xc6, 0xc6, 0x6c, 0x38, 0x0c, 0xc6, 
-0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0xfe, 0xfe, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 
-0x7e, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 
-0x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x18, 0x0c, 0xfe, 0x0c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x60, 0xfe, 0x60, 0x30, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 
-0xc0, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x24, 0x66, 0xff, 0x66, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x38, 0x7c, 0x7c, 0xfe, 0xfe, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0x7c, 0x7c, 
-0x38, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x18, 0x3c, 0x3c, 0x3c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x24, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 
-0x6c, 0xfe, 0x6c, 0x6c, 0x6c, 0xfe, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, 
-0x18, 0x18, 0x7c, 0xc6, 0xc2, 0xc0, 0x7c, 0x06, 0x06, 0x86, 0xc6, 0x7c, 
-0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc2, 0xc6, 0x0c, 0x18, 
-0x30, 0x60, 0xc6, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x6c, 
-0x6c, 0x38, 0x76, 0xdc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x30, 0x30, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30, 
-0x30, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x18, 
-0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3c, 0xff, 0x3c, 0x66, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 
-0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x02, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xce, 0xde, 0xf6, 0xe6, 0xc6, 0xc6, 0x7c, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x38, 0x78, 0x18, 0x18, 0x18, 
-0x18, 0x18, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 
-0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x7c, 0xc6, 0x06, 0x06, 0x3c, 0x06, 0x06, 0x06, 0xc6, 0x7c, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x1c, 0x3c, 0x6c, 0xcc, 0xfe, 
-0x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc0, 
-0xc0, 0xc0, 0xfc, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x38, 0x60, 0xc0, 0xc0, 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc6, 0x06, 0x06, 0x0c, 0x18, 
-0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 
-0xc6, 0xc6, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0x06, 0x0c, 0x78, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 
-0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x06, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 
-0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 
-0x30, 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x0c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xde, 0xde, 
-0xde, 0xdc, 0xc0, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 
-0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x66, 0x66, 0xfc, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 
-0xc0, 0xc2, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x6c, 
-0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x62, 0x66, 0xfe, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 
-0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 
-0xc2, 0xc0, 0xc0, 0xde, 0xc6, 0xc6, 0x66, 0x3a, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 
-0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x0c, 
-0x0c, 0x0c, 0x0c, 0x0c, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0xe6, 0x66, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0x66, 0xe6, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x60, 0x60, 0x60, 0x60, 0x60, 
-0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xe7, 
-0xff, 0xff, 0xdb, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0xc6, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 
-0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x66, 
-0x66, 0x66, 0x7c, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0xde, 0x7c, 
-0x0c, 0x0e, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x6c, 
-0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 
-0xc6, 0x60, 0x38, 0x0c, 0x06, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0xff, 0xdb, 0x99, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 
-0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xc3, 
-0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xdb, 0xdb, 0xff, 0x66, 0x66, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xc3, 0x66, 0x3c, 0x18, 0x18, 
-0x3c, 0x66, 0xc3, 0xc3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xc3, 
-0xc3, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0xff, 0xc3, 0x86, 0x0c, 0x18, 0x30, 0x60, 0xc1, 0xc3, 0xff, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30, 
-0x30, 0x30, 0x30, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 
-0xc0, 0xe0, 0x70, 0x38, 0x1c, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c, 
-0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 
-0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x0c, 0x7c, 
-0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x60, 
-0x60, 0x78, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x0c, 0x0c, 0x3c, 0x6c, 0xcc, 
-0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x38, 0x6c, 0x64, 0x60, 0xf0, 0x60, 0x60, 0x60, 0x60, 0xf0, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc, 
-0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xcc, 0x78, 0x00, 0x00, 0x00, 0xe0, 0x60, 
-0x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x18, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x00, 0x0e, 0x06, 0x06, 
-0x06, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0xe0, 0x60, 
-0x60, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe6, 0xff, 0xdb, 
-0xdb, 0xdb, 0xdb, 0xdb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 
-0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0x0c, 0x1e, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x76, 0x66, 0x60, 0x60, 0x60, 0xf0, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x60, 
-0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x30, 
-0x30, 0xfc, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xc3, 0xc3, 
-0xc3, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0xc3, 0xc3, 0xc3, 0xdb, 0xdb, 0xff, 0x66, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0xc3, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 
-0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0xfe, 0xcc, 0x18, 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x0e, 0x18, 0x18, 0x18, 0x70, 0x18, 0x18, 0x18, 0x18, 0x0e, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 
-0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x18, 
-0x18, 0x18, 0x0e, 0x18, 0x18, 0x18, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 
-0xc6, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 
-0xc2, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x0c, 0x06, 0x7c, 0x00, 0x00, 
-0x00, 0x00, 0xcc, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x30, 0x00, 0x7c, 0xc6, 0xfe, 
-0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 
-0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0xcc, 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x00, 0x78, 0x0c, 0x7c, 
-0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x6c, 0x38, 
-0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x60, 0x60, 0x66, 0x3c, 0x0c, 0x06, 
-0x3c, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xfe, 
-0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x00, 
-0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x60, 0x30, 0x18, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, 0x38, 0x18, 0x18, 
-0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x66, 
-0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x60, 0x30, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 
-0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x38, 0x6c, 0x38, 0x00, 
-0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, 
-0x18, 0x30, 0x60, 0x00, 0xfe, 0x66, 0x60, 0x7c, 0x60, 0x60, 0x66, 0xfe, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6e, 0x3b, 0x1b, 
-0x7e, 0xd8, 0xdc, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x6c, 
-0xcc, 0xcc, 0xfe, 0xcc, 0xcc, 0xcc, 0xcc, 0xce, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 
-0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 
-0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x30, 0x78, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x00, 0xcc, 0xcc, 0xcc, 
-0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x00, 
-0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0x78, 0x00, 
-0x00, 0xc6, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 
-0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 
-0xc3, 0xc0, 0xc0, 0xc0, 0xc3, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x38, 0x6c, 0x64, 0x60, 0xf0, 0x60, 0x60, 0x60, 0x60, 0xe6, 0xfc, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0x66, 0x3c, 0x18, 0xff, 0x18, 
-0xff, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x66, 0x66, 
-0x7c, 0x62, 0x66, 0x6f, 0x66, 0x66, 0x66, 0xf3, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x0e, 0x1b, 0x18, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 
-0xd8, 0x70, 0x00, 0x00, 0x00, 0x18, 0x30, 0x60, 0x00, 0x78, 0x0c, 0x7c, 
-0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x30, 
-0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x18, 0x30, 0x60, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x30, 0x60, 0x00, 0xcc, 0xcc, 0xcc, 
-0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 
-0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 
-0x76, 0xdc, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x6c, 0x6c, 0x3e, 0x00, 0x7e, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x6c, 0x6c, 
-0x38, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x30, 0x30, 0x00, 0x30, 0x30, 0x60, 0xc0, 0xc6, 0xc6, 0x7c, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc0, 
-0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0xfe, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30, 0x60, 0xce, 0x9b, 0x06, 
-0x0c, 0x1f, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30, 
-0x66, 0xce, 0x96, 0x3e, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 
-0x00, 0x18, 0x18, 0x18, 0x3c, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x6c, 0xd8, 0x6c, 0x36, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, 0x6c, 0x36, 
-0x6c, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x44, 0x11, 0x44, 
-0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 
-0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 
-0x55, 0xaa, 0x55, 0xaa, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 
-0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0x18, 0x18, 0x18, 0x18, 
-0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 
-0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18, 
-0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0xf8, 
-0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x36, 0x36, 0x36, 0x36, 
-0x36, 0x36, 0x36, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x36, 0x36, 0x36, 0x36, 
-0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0xf8, 
-0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x36, 0x36, 0x36, 0x36, 
-0x36, 0xf6, 0x06, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 
-0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 
-0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, 0xf6, 
-0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 
-0x36, 0xf6, 0x06, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xfe, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0xf8, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 
-0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 
-0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, 
-0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 
-0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 
-0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, 
-0x18, 0x18, 0x18, 0x18, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 
-0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 
-0x36, 0x37, 0x30, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36, 
-0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xf7, 0x00, 0xff, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0xff, 0x00, 0xf7, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 
-0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36, 
-0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x36, 0x36, 0x36, 
-0x36, 0xf7, 0x00, 0xf7, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 
-0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xff, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0xff, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x36, 0x36, 0x36, 0x36, 
-0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x3f, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 
-0x18, 0x1f, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, 
-0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 
-0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 
-0x36, 0x36, 0x36, 0xff, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 
-0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 
-0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 
-0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
-0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 
-0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xf0, 0xf0, 0xf0, 
-0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 
-0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 
-0x0f, 0x0f, 0x0f, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x76, 0xdc, 0xd8, 0xd8, 0xd8, 0xdc, 0x76, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0xd8, 0xcc, 0xc6, 0xc6, 0xc6, 0xcc, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc6, 0xc6, 0xc0, 0xc0, 0xc0, 
-0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0xfe, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0xfe, 0xc6, 0x60, 0x30, 0x18, 0x30, 0x60, 0xc6, 0xfe, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xd8, 0xd8, 
-0xd8, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xc0, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x18, 0x3c, 0x66, 0x66, 
-0x66, 0x3c, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 
-0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0x6c, 0x6c, 0x6c, 0x6c, 0xee, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x30, 0x18, 0x0c, 0x3e, 0x66, 
-0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x7e, 0xdb, 0xdb, 0xdb, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x03, 0x06, 0x7e, 0xdb, 0xdb, 0xf3, 0x7e, 0x60, 0xc0, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x30, 0x60, 0x60, 0x7c, 0x60, 
-0x60, 0x60, 0x30, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 
-0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 
-0x18, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 
-0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x00, 0x7e, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x1b, 0x1b, 0x1b, 0x18, 0x18, 
-0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 
-0x18, 0x18, 0x18, 0x18, 0xd8, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x7e, 0x00, 0x18, 0x18, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x00, 
-0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x6c, 0x6c, 
-0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x0c, 0x0c, 
-0x0c, 0x0c, 0x0c, 0xec, 0x6c, 0x6c, 0x3c, 0x1c, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0xd8, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xd8, 0x30, 0x60, 0xc8, 0xf8, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-};
diff -u --recursive --new-file v2.3.8/linux/drivers/sound/cmpci.c linux/drivers/sound/cmpci.c
--- v2.3.8/linux/drivers/sound/cmpci.c	Wed May 26 09:35:00 1999
+++ linux/drivers/sound/cmpci.c	Wed Jun 30 11:24:55 1999
@@ -62,6 +62,7 @@
X 
X /*****************************************************************************/
X       
+#include <linux/config.h>
X #include <linux/version.h>
X #include <linux/module.h>
X #include <linux/string.h>
diff -u --recursive --new-file v2.3.8/linux/drivers/sound/sb_ess.c linux/drivers/sound/sb_ess.c
--- v2.3.8/linux/drivers/sound/sb_ess.c	Wed May 26 09:35:00 1999
+++ linux/drivers/sound/sb_ess.c	Wed Jun 30 11:24:55 1999
@@ -183,6 +183,7 @@
X  * ES1946	yes		This is a PCI chip; not handled by this driver
X  */
X 
+#include <linux/config.h>
X #include <linux/delay.h>
X 
X #include "sound_config.h"
diff -u --recursive --new-file v2.3.8/linux/drivers/tc/Makefile linux/drivers/tc/Makefile
--- v2.3.8/linux/drivers/tc/Makefile	Wed Dec 31 16:00:00 1969
+++ linux/drivers/tc/Makefile	Fri Jun 25 17:38:40 1999
@@ -0,0 +1,33 @@
+#
+# Makefile for the linux kernel.
+#
+# Note! Dependencies are done automagically by 'make dep', which also
+# removes any old dependencies. DON'T put your own dependencies here
+# unless it's something special (ie not a .c file).
+#
+# Note 2! The CFLAGS definitions are now in the main makefile...
+
+SUB_DIRS     :=
+MOD_SUB_DIRS := 
+ALL_SUB_DIRS := 
+
+L_TARGET := tc.a
+L_OBJS   := tc.o
+
+# Nasty trick as nobody references tcsyms.o, but we still want it linked.
+# Stolen from pci Makefile
+ifeq ($(CONFIG_MODULES),y)
+O_TARGET = tc_syms.o
+OX_OBJS  = tcsyms.o
+O_OBJS   = tc.o
+L_OBJS   := tc_syms.o
+else
+L_OBJS   := tc.o
+endif
+
+ifdef CONFIG_ZS
+L_OBJS   += zs.o
+endif
+
+include $(TOPDIR)/Rules.make
+
diff -u --recursive --new-file v2.3.8/linux/drivers/tc/tc.c linux/drivers/tc/tc.c
--- v2.3.8/linux/drivers/tc/tc.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/tc/tc.c	Fri Jun 25 17:38:40 1999
@@ -0,0 +1,236 @@
+/* $Id: $
+ * tc-init: We assume the TURBOchannel to be up and running so
+ * just probe for Modules and fill in the global data structure
+ * tc_bus.
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (c) Harald Koerfgen, 1998
+ *
+ */
+
+#include <linux/string.h>
+#include <asm/init.h>
+#include <asm/addrspace.h>
+#include <asm/errno.h>
+#include <asm/dec/machtype.h>
+#include <asm/dec/tcinfo.h>
+#include <asm/dec/tcmodule.h>
+#include <asm/dec/interrupts.h>
+
+#include <asm/ptrace.h>
+#include <linux/kernel.h>
+
+#define TC_DEBUG
+
+slot_info tc_bus[MAX_SLOT];
+static int max_tcslot = 0;
+static tcinfo *info = (tcinfo *)0;
+
+unsigned long system_base = 0;
+
+extern void (*dbe_board_handler)(struct pt_regs *regs);
+extern unsigned long *(*rex_slot_address)(int);
+extern void *(*rex_gettcinfo)(void);
+
+/*
+ * Interface to the world. Read comment in include/asm-mips/tc.h.
+ */
+
+int search_tc_card(char *name)
+{
+	int slot;
+	slot_info *sip;
+
+	for (slot = 0; slot <= max_tcslot; slot++) {
+		sip = &tc_bus[slot];
+		if ((sip->flags & FREE) && (strncmp(sip->name, name, strlen(name)) == 0)) {
+			return slot;
+		}
+	}
+
+	return -ENODEV;
+}
+
+void claim_tc_card(int slot)
+{
+	if (tc_bus[slot].flags & IN_USE) {
+		printk("claim_tc_card: attempting to claim a card already in use\n");
+		return;
+	}
+	tc_bus[slot].flags &= ~FREE;
+	tc_bus[slot].flags |= IN_USE;
+}
+
+void release_tc_card(int slot)
+{
+	if (tc_bus[slot].flags & FREE) {
+		printk("release_tc_card: attempting to release a card already free\n");
+		return;
+	}
+	tc_bus[slot].flags &= ~IN_USE;
+	tc_bus[slot].flags |= FREE;
+}
+
+unsigned long get_tc_base_addr(int slot)
+{
+	return tc_bus[slot].base_addr;
+}
+
+unsigned long get_tc_irq_nr(int slot)
+{
+	return tc_bus[slot].interrupt;
+}
+
+unsigned long get_tc_speed(void)
+{
+	return 100000 * (10000 / (unsigned long)info->clk_period);
+}
+
+/*
+ * Probing for TURBOchannel modules
+ */
+__initfunc(static void my_dbe_handler(struct pt_regs *regs))
+{
+	regs->cp0_epc += 4;
+}
+
+__initfunc(static void tc_probe(unsigned long startaddr, unsigned long size, int max_slot))
+{
+	int i, slot;
+	long offset;
+	unsigned char *module;
+	void (*old_be_handler)(struct pt_regs *regs);
+
+	/* Install our exception handler temporarily */
+
+	old_be_handler = dbe_board_handler;
+	dbe_board_handler = my_dbe_handler;
+	for (slot = 0; slot <= max_slot; slot++) {
+		module = (char *)(startaddr + slot * size);
+		offset = -1;
+		if (module[OLDCARD + PATTERN0] == 0x55 && module[OLDCARD + PATTERN1] == 0x00
+		  && module[OLDCARD + PATTERN2] == 0xaa && module[OLDCARD + PATTERN3] == 0xff)
+			offset = OLDCARD;
+		if (module[PATTERN0] == 0x55 && module[PATTERN1] == 0x00
+		  && module[PATTERN2] == 0xaa && module[PATTERN3] == 0xff)
+			offset = 0;
+
+		if (offset != -1) {
+			tc_bus[slot].base_addr = (unsigned long)module;
+			for(i = 0; i < 8; i++) {
+				tc_bus[slot].firmware[i] = module[FIRM_VER + offset + 4 * i];
+				tc_bus[slot].vendor[i] = module[VENDOR + offset + 4 * i];
+				tc_bus[slot].name[i] = module[MODULE + offset + 4 * i];
+			}
+			tc_bus[slot].firmware[8] = 0;
+			tc_bus[slot].vendor[8] = 0;
+			tc_bus[slot].name[8] = 0;
+			/*
+			 * Looks unneccesary, but we may change
+			 * TC? in the future
+			 */
+			switch (slot) {
+			case 0:
+				tc_bus[slot].interrupt = TC0;
+				break;
+			case 1:
+				tc_bus[slot].interrupt = TC1;
+				break;
+			case 2:
+				tc_bus[slot].interrupt = TC2;
+				break;
+			/*
+			 * Yuck! DS5000/200 onboard devices
+			 */
+			case 5:
+				tc_bus[slot].interrupt = SCSI_INT;
+				break;
+			case 6:
+				tc_bus[slot].interrupt = ETHER;
+				break;
+			default:
+				tc_bus[slot].interrupt = -1;
+				break;
+			}	
+		}
+	}
+
+	dbe_board_handler = old_be_handler;
+}
+
+/*
+ * the main entry
+ */
+__initfunc(void tc_init(void))
+{
+	int tc_clock;
+	int i;
+	unsigned long slot0addr;
+	unsigned long slot_size;
+
+	if (!TURBOCHANNEL)
+		return;
+
+	for (i = 0; i < MAX_SLOT; i++) {
+		tc_bus[i].base_addr = 0;
+		tc_bus[i].name[0] = 0;
+		tc_bus[i].vendor[0] = 0;
+		tc_bus[i].firmware[0] = 0;
+		tc_bus[i].interrupt = -1;
+		tc_bus[i].flags = FREE;
+	}
+
+	info = (tcinfo *) rex_gettcinfo();
+	slot0addr = (unsigned long)KSEG1ADDR(rex_slot_address(0));
+
+	switch (mips_machtype) {
+	case MACH_DS5000_200:
+		max_tcslot = 6;
+		break;
+	case MACH_DS5000_1XX:
+	case MACH_DS5000_2X0:
+		max_tcslot = 2;
+		break;
+	case MACH_DS5000_XX:
+	default:
+		max_tcslot = 1;
+		break;
+	}
+
+	tc_clock = 10000 / info->clk_period;
+
+	if (TURBOCHANNEL && info->slot_size && slot0addr) {
+		printk("TURBOchannel rev. %1d at %2d.%1d MHz ", info->revision,
+			tc_clock / 10, tc_clock % 10);
+		printk("(%sparity)\n", info->parity ? "" : "no ");
+
+		slot_size = info->slot_size << 20;
+
+		tc_probe(slot0addr, slot_size, max_tcslot);
+
+  		/*
+  		 * All TURBOchannel DECstations have the onboard devices
+ 		 * where the (max_tcslot + 1 or 2 on DS5k/xx) Option Module
+ 		 * would be.
+ 		 */
+ 		if(mips_machtype == MACH_DS5000_XX)
+ 			i = 2;
+		else
+ 			i = 1;
+ 		
+ 	        system_base = slot0addr + slot_size * (max_tcslot + i);
+
+#ifdef TC_DEBUG
+		for (i = 0; i <= max_tcslot; i++)
+			if (tc_bus[i].base_addr) {
+				printk("    slot %d: ", i);
+				printk("%s %s %s\n", tc_bus[i].vendor,
+					tc_bus[i].name, tc_bus[i].firmware);
+			}
+#endif
+	}
+
+}
diff -u --recursive --new-file v2.3.8/linux/drivers/tc/tcsyms.c linux/drivers/tc/tcsyms.c
--- v2.3.8/linux/drivers/tc/tcsyms.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/tc/tcsyms.c	Wed Jun 30 11:24:55 1999
@@ -0,0 +1,13 @@
+/*
+ *	Turbo Channel Services -- Exported Symbols
+ *
+ */
+
+#include <linux/module.h>
+#include <asm/dec/tc.h>
+
+EXPORT_SYMBOL(get_tc_irq_nr);
+EXPORT_SYMBOL(claim_tc_card);
+EXPORT_SYMBOL(search_tc_card);
+EXPORT_SYMBOL(get_tc_speed);
+EXPORT_SYMBOL(get_tc_base_addr);
diff -u --recursive --new-file v2.3.8/linux/drivers/tc/zs.c linux/drivers/tc/zs.c
--- v2.3.8/linux/drivers/tc/zs.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/tc/zs.c	Fri Jun 25 17:38:40 1999
@@ -0,0 +1,2107 @@
+/*
+ * decserial.c: Serial port driver for IOASIC DECsatations.
+ *
+ * Derived from drivers/macintosh/macserial.c by Harald Koerfgen.
+ * Derived from drivers/sbus/char/sunserial.c by Paul Mackerras.
+ *
+ * DECstation changes
+ * Copyright (C) 1998 Harald Koerfgen (Harald....@home.ivm.de)
+ *
+ * For the rest of the code the original Copyright applies:
+ * Copyright (C) 1996 Paul Mackerras (Paul.Ma...@cs.anu.edu.au)
+ * Copyright (C) 1995 David S. Miller (da...@caip.rutgers.edu)
+ *
+ * Keyboard and mouse are not supported right now. If you want to change this,
+ * you might want to have a look at drivers/sbus/char/sunserial.c to see
+ * how this might be done. HK
+ */
+
+#include <linux/config.h>
+#include <linux/errno.h>
+#include <linux/signal.h>
+#include <linux/sched.h>
+#include <linux/timer.h>
+#include <linux/interrupt.h>
+#include <linux/tty.h>
+#include <linux/tty_flip.h>
+#include <linux/major.h>
+#include <linux/string.h>
+#include <linux/fcntl.h>
+#include <linux/mm.h>
+#include <linux/kernel.h>
+#include <linux/delay.h>
+#include <linux/init.h>
+#ifdef CONFIG_SERIAL_CONSOLE
+#include <linux/console.h>
+#endif
+
+#include <asm/io.h>
+#include <asm/pgtable.h>
+#include <asm/irq.h>
+#include <asm/system.h>
+#include <asm/segment.h>
+#include <asm/bitops.h>
+#include <asm/uaccess.h>
+#include <asm/dec/interrupts.h>
+#include <asm/dec/machtype.h>
+#include <asm/dec/tc.h>
+#include <asm/dec/ioasic_addrs.h>
+#ifdef CONFIG_KGDB
+#include <asm/kgdb.h>
+#endif
+
+#include "zs.h"
+
+
+/*
+ * It would be nice to dynamically allocate everything that
+ * depends on NUM_SERIAL, so we could support any number of
+ * Z8530s, but for now...
+ */
+#define NUM_SERIAL	2		/* Max number of ZS chips supported */
+#define NUM_CHANNELS	(NUM_SERIAL * 2)	/* 2 channels per chip */
+
+#define RECOVERY_DELAY  udelay(2)
+
+struct dec_zschannel zs_channels[NUM_CHANNELS];
+
+struct dec_serial zs_soft[NUM_CHANNELS];
+int zs_channels_found;
+struct dec_serial *zs_chain;	/* list of all channels */
+
+struct tty_struct zs_ttys[NUM_CHANNELS];
+
+#ifdef CONFIG_SERIAL_CONSOLE
+static struct console sercons;
+#endif
+
+#ifdef CONFIG_KGDB
+struct dec_zschannel *zs_kgdbchan;
+static unsigned char scc_inittab[] = {
+	9,  0x80,	/* reset A side (CHRA) */
+	13, 0,		/* set baud rate divisor */
+	12, 1,
+	14, 1,		/* baud rate gen enable, src=rtxc (BRENABL) */
+	11, 0x50,	/* clocks = br gen (RCBR | TCBR) */
+	5,  0x6a,	/* tx 8 bits, assert RTS (Tx8 | TxENAB | RTS) */
+	4,  0x44,	/* x16 clock, 1 stop (SB1 | X16CLK)*/
+	3,  0xc1,	/* rx enable, 8 bits (RxENABLE | Rx8)*/
+};
+#endif
+
+static unsigned char zs_init_regs[16] __initdata = {
+	0,                           /* write 0 */
+	0,			     /* write 1 */
+	0xf0,                        /* write 2 */
+	(Rx8),                       /* write 3 */
+	(X16CLK | SB1),              /* write 4 */
+	(Tx8),                       /* write 5 */
+	0, 0, 0,                     /* write 6, 7, 8 */
+	(VIS),                       /* write 9 */
+	(NRZ),                       /* write 10 */
+	(TCBR | RCBR),               /* write 11 */
+	0, 0,                        /* BRG time constant, write 12 + 13 */
+	(BRSRC | BRENABL),           /* write 14 */
+	0 			     /* write 15 */
+};
+
+#define ZS_CLOCK         7372800 	/* Z8530 RTxC input clock rate */
+
+DECLARE_TASK_QUEUE(tq_zs_serial);
+
+struct tty_driver serial_driver, callout_driver;
+static int serial_refcount;
+
+/* serial subtype definitions */
+#define SERIAL_TYPE_NORMAL	1
+#define SERIAL_TYPE_CALLOUT	2
+
+/* number of characters left in xmit buffer before we ask for more */
+#define WAKEUP_CHARS 256
+
+/*
+ * Debugging.
+ */
+#undef SERIAL_DEBUG_INTR
+#undef SERIAL_DEBUG_OPEN
+#undef SERIAL_DEBUG_FLOW
+#undef SERIAL_DEBUG_THROTTLE
+#undef SERIAL_PARANOIA_CHECK
+
+#define RS_STROBE_TIME 10
+#define RS_ISR_PASS_LIMIT 256
+
+#define _INLINE_ inline
+
+static void probe_sccs(void);
+static void change_speed(struct dec_serial *info);
+static void rs_wait_until_sent(struct tty_struct *tty, int timeout);
+
+static struct tty_struct *serial_table[NUM_CHANNELS];
+static struct termios *serial_termios[NUM_CHANNELS];
+static struct termios *serial_termios_locked[NUM_CHANNELS];
+
+#ifndef MIN
+#define MIN(a,b)	((a) < (b) ? (a) : (b))
+#endif
+
+/*
+ * tmp_buf is used as a temporary buffer by serial_write.  We need to
+ * lock it in case the copy_from_user blocks while swapping in a page,
+ * and some other program tries to do a serial write at the same time.
+ * Since the lock will only come under contention when the system is
+ * swapping and available memory is low, it makes sense to share one
+ * buffer across all the serial ports, since it significantly saves
+ * memory if large numbers of serial ports are open.
+ */
+static unsigned char tmp_buf[4096]; /* This is cheating */
+static struct semaphore tmp_buf_sem = MUTEX;
+
+static inline int serial_paranoia_check(struct dec_serial *info,
+					dev_t device, const char *routine)
+{
+#ifdef SERIAL_PARANOIA_CHECK
+	static const char *badmagic =
+		"Warning: bad magic number for serial struct (%d, %d) in %s\n";
+	static const char *badinfo =
+		"Warning: null mac_serial for (%d, %d) in %s\n";
+
+	if (!info) {
+		printk(badinfo, MAJOR(device), MINOR(device), routine);
+		return 1;
+	}
+	if (info->magic != SERIAL_MAGIC) {
+		printk(badmagic, MAJOR(device), MINOR(device), routine);
+		return 1;
+	}
+#endif
+	return 0;
+}
+
+/*
+ * This is used to figure out the divisor speeds and the timeouts
+ */
+static int baud_table[] = {
+	0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800,
+	9600, 19200, 38400, 57600, 0, 0 };
+
+/* 
+ * Reading and writing Z8530 registers.
+ */
+static inline unsigned char read_zsreg(struct dec_zschannel *channel,
+				       unsigned char reg)
+{
+	unsigned char retval;
+
+	if (reg != 0) {
+		*channel->control = reg & 0xf;
+		RECOVERY_DELAY;
+	}
+	retval = *channel->control;
+	RECOVERY_DELAY;
+	return retval;
+}
+
+static inline void write_zsreg(struct dec_zschannel *channel,
+			       unsigned char reg, unsigned char value)
+{
+	if (reg != 0) {
+		*channel->control = reg & 0xf;
+		RECOVERY_DELAY;
+	}
+	*channel->control = value;
+	RECOVERY_DELAY;
+	return;
+}
+
+static inline unsigned char read_zsdata(struct dec_zschannel *channel)
+{
+	unsigned char retval;
+
+	retval = *channel->data;
+	RECOVERY_DELAY;
+	return retval;
+}
+
+static inline void write_zsdata(struct dec_zschannel *channel,
+				unsigned char value)
+{
+	*channel->data = value;
+	RECOVERY_DELAY;
+	return;
+}
+
+static inline void load_zsregs(struct dec_zschannel *channel,
+			       unsigned char *regs)
+{
+/*	ZS_CLEARERR(channel);
+	ZS_CLEARFIFO(channel); */
+	/* Load 'em up */
+	write_zsreg(channel, R4, regs[R4]);
+	write_zsreg(channel, R3, regs[R3] & ~RxENABLE);
+	write_zsreg(channel, R5, regs[R5] & ~TxENAB);
+	write_zsreg(channel, R9, regs[R9]);
+	write_zsreg(channel, R1, regs[R1]);
+	write_zsreg(channel, R2, regs[R2]);
+	write_zsreg(channel, R10, regs[R10]);
+	write_zsreg(channel, R11, regs[R11]);
+	write_zsreg(channel, R12, regs[R12]);
+	write_zsreg(channel, R13, regs[R13]);
+	write_zsreg(channel, R14, regs[R14]);
+	write_zsreg(channel, R15, regs[R15]);
+	write_zsreg(channel, R3, regs[R3]);
+	write_zsreg(channel, R5, regs[R5]);
+	return;
+}
+
+/* Sets or clears DTR/RTS on the requested line */
+static inline void zs_rtsdtr(struct dec_serial *ss, int set)
+{
+	if (ss->zs_channel != ss->zs_chan_a) {
+		if (set)
+			ss->zs_chan_a->curregs[5] |= (RTS | DTR);
+		else
+			ss->zs_chan_a->curregs[5] &= ~(RTS | DTR);
+		write_zsreg(ss->zs_chan_a, 5, ss->zs_chan_a->curregs[5]);
+	}
+	return;
+}
+
+/* Utility routines for the Zilog */
+static inline int get_zsbaud(struct dec_serial *ss)
+{
+	struct dec_zschannel *channel = ss->zs_channel;
+	int brg;
+
+	/* The baud rate is split up between two 8-bit registers in
+	 * what is termed 'BRG time constant' format in my docs for
+	 * the chip, it is a function of the clk rate the chip is
+	 * receiving which happens to be constant.
+	 */
+	brg = (read_zsreg(channel, 13) << 8);
+	brg |= read_zsreg(channel, 12);
+	return BRG_TO_BPS(brg, (ZS_CLOCK/(ss->clk_divisor)));
+}
+
+/* On receive, this clears errors and the receiver interrupts */
+static inline void rs_recv_clear(struct dec_zschannel *zsc)
+{
+	write_zsreg(zsc, 0, ERR_RES);
+	write_zsreg(zsc, 0, RES_H_IUS); /* XXX this is unnecessary */
+}
+
+/*
+ * ----------------------------------------------------------------------
+ *
+ * Here starts the interrupt handling routines.  All of the following
+ * subroutines are declared as inline and are folded into
+ * rs_interrupt().  They were separated out for readability's sake.
+ *
+ * 				- Ted Ts'o (ty...@mit.edu), 7-Mar-93
+ * -----------------------------------------------------------------------
+ */
+
+/*
+ * This routine is used by the interrupt handler to schedule
+ * processing in the software interrupt portion of the driver.
+ */
+static _INLINE_ void rs_sched_event(struct dec_serial *info,
+				  int event)
+{
+	info->event |= 1 << event;
+	queue_task(&info->tqueue, &tq_zs_serial);
+	mark_bh(SERIAL_BH);
+}
+
+static _INLINE_ void receive_chars(struct dec_serial *info,
+				   struct pt_regs *regs)
+{
+	struct tty_struct *tty = info->tty;
+	unsigned char ch, stat, flag;
+
+	while ((read_zsreg(info->zs_channel, 0) & Rx_CH_AV) != 0) {
+
+		stat = read_zsreg(info->zs_channel, R1);
+		ch = read_zsdata(info->zs_channel);
+
+#ifdef CONFIG_KGDB
+		if (info->kgdb_channel) {
+			if (ch == 0x03 || ch == '$')
+				breakpoint();
+			if (stat & (Rx_OVR|FRM_ERR|PAR_ERR))
+				write_zsreg(info->zs_channel, 0, ERR_RES);
+			return;
+		}
+#endif
+		if (!tty)
+			continue;
+
+		if (tty->flip.count >= TTY_FLIPBUF_SIZE) {
+			static int flip_buf_ovf;
+			++flip_buf_ovf;
+			continue;
+		}
+		tty->flip.count++;
+		{
+			static int flip_max_cnt;
+			if (flip_max_cnt < tty->flip.count)
+				flip_max_cnt = tty->flip.count;
+		}
+		if (stat & Rx_OVR) {
+			flag = TTY_OVERRUN;
+		} else if (stat & FRM_ERR) {
+			flag = TTY_FRAME;
+		} else if (stat & PAR_ERR) {
+			flag = TTY_PARITY;
+		} else
+			flag = 0;
+		if (flag)
+			/* reset the error indication */
+			write_zsreg(info->zs_channel, 0, ERR_RES);
+		*tty->flip.flag_buf_ptr++ = flag;
+		*tty->flip.char_buf_ptr++ = ch;
+	}
+	tty_flip_buffer_push(tty);
+}
+
+static void transmit_chars(struct dec_serial *info)
+{
+	if ((read_zsreg(info->zs_channel, 0) & Tx_BUF_EMP) == 0)
+		return;
+	info->tx_active = 0;
+
+	if (info->x_char) {
+		/* Send next char */
+		write_zsdata(info->zs_channel, info->x_char);
+		info->x_char = 0;
+		info->tx_active = 1;
+		return;
+	}
+
+	if ((info->xmit_cnt <= 0) || info->tty->stopped || info->tx_stopped) {
+		write_zsreg(info->zs_channel, 0, RES_Tx_P);
+		return;
+	}
+	/* Send char */
+	write_zsdata(info->zs_channel, info->xmit_buf[info->xmit_tail++]);
+	info->xmit_tail = info->xmit_tail & (SERIAL_XMIT_SIZE-1);
+	info->xmit_cnt--;
+	info->tx_active = 1;
+
+	if (info->xmit_cnt < WAKEUP_CHARS)
+		rs_sched_event(info, RS_EVENT_WRITE_WAKEUP);
+}
+
+static _INLINE_ void status_handle(struct dec_serial *info)
+{
+	unsigned char status;
+
+	/* Get status from Read Register 0 */
+	status = read_zsreg(info->zs_channel, 0);
+
+	/* FIXEM: Check for DCD transitions */
+	if (((status ^ info->read_reg_zero) & DCD) != 0
+	    && info->tty && !C_CLOCAL(info->tty)) {
+		if (status & DCD) {
+			wake_up_interruptible(&info->open_wait);
+		} else if (!(info->flags & ZILOG_CALLOUT_ACTIVE)) {
+			if (info->tty)
+				tty_hangup(info->tty);
+		}
+	}
+
+	/* Check for CTS transitions */
+	if (info->tty && C_CRTSCTS(info->tty)) {
+		/*
+		 * For some reason, on the Power Macintosh,
+		 * it seems that the CTS bit is 1 when CTS is
+		 * *negated* and 0 when it is asserted.
+		 * The DCD bit doesn't seem to be inverted
+		 * like this.
+		 */
+		if ((status & CTS) != 0) {
+			if (info->tx_stopped) {
+				info->tx_stopped = 0;
+				if (!info->tx_active)
+					transmit_chars(info);
+			}
+		} else {
+			info->tx_stopped = 1;
+		}
+	}
+
+	/* Clear status condition... */
+	write_zsreg(info->zs_channel, 0, RES_EXT_INT);
+	info->read_reg_zero = status;
+}
+
+/*
+ * This is the serial driver's generic interrupt routine
+ */
+void rs_interrupt(int irq, void *dev_id, struct pt_regs * regs)
+{
+	struct dec_serial *info = (struct dec_serial *) dev_id;
+	unsigned char zs_intreg;
+	int shift;
+
+	/* NOTE: The read register 3, which holds the irq status,
+	 *       does so for both channels on each chip.  Although
+	 *       the status value itself must be read from the A
+	 *       channel and is only valid when read from channel A.
+	 *       Yes... broken hardware...
+	 */
+#define CHAN_IRQMASK (CHBRxIP | CHBTxIP | CHBEXT)
+
+	if (info->zs_chan_a == info->zs_channel)
+		shift = 3;	/* Channel A */
+	else
+		shift = 0;	/* Channel B */
+
+	for (;;) {
+		zs_intreg = read_zsreg(info->zs_chan_a, 3) >> shift; 
+		if ((zs_intreg & CHAN_IRQMASK) == 0)
+			break;
+
+		if (zs_intreg & CHBRxIP) {
+			receive_chars(info, regs);
+		}
+		if (zs_intreg & CHBTxIP) {
+			transmit_chars(info);
+		}
+		if (zs_intreg & CHBEXT) {
+			status_handle(info);
+		}
+	}
+}
+
+/*
+ * -------------------------------------------------------------------
+ * Here ends the serial interrupt routines.
+ * -------------------------------------------------------------------
+ */
+
+/*
+ * ------------------------------------------------------------
+ * rs_stop() and rs_start()
+ *
+ * This routines are called before setting or resetting tty->stopped.
+ * ------------------------------------------------------------
+ */
+static void rs_stop(struct tty_struct *tty)
+{
+	struct dec_serial *info = (struct dec_serial *)tty->driver_data;
+	unsigned long flags;
+
+	if (serial_paranoia_check(info, tty->device, "rs_stop"))
+		return;
+	
+#if 1
+	save_flags(flags); cli();
+	if (info->zs_channel->curregs[5] & TxENAB) {
+		info->zs_channel->curregs[5] &= ~TxENAB;
+		write_zsreg(info->zs_channel, 5, info->zs_channel->curregs[5]);
+	}
+	restore_flags(flags);
+#endif
+}
+
+static void rs_start(struct tty_struct *tty)
+{
+	struct dec_serial *info = (struct dec_serial *)tty->driver_data;
+	unsigned long flags;
+	
+	if (serial_paranoia_check(info, tty->device, "rs_start"))
+		return;
+	
+	save_flags(flags); cli();
+#if 1
+	if (info->xmit_cnt && info->xmit_buf && !(info->zs_channel->curregs[5] & TxENAB)) {
+		info->zs_channel->curregs[5] |= TxENAB;
+		write_zsreg(info->zs_channel, 5, info->zs_channel->curregs[5]);
+	}
+#else
+	if (info->xmit_cnt && info->xmit_buf && !info->tx_active) {
+		transmit_chars(info);
+	}
+#endif
+	restore_flags(flags);
+}
+
+/*
+ * This routine is used to handle the "bottom half" processing for the
+ * serial driver, known also the "software interrupt" processing.
SHAR_EOF
true || echo 'restore of patch-2.3.9 failed'
fi
echo 'End of  part 16'
echo 'File patch-2.3.9 is continued in part 17'
echo 17 > _shar_seq_.tmp
exit 0
#!/bin/sh
# this is part 18 of a 26 - part archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file patch-2.3.9 continued
if test ! -r _shar_seq_.tmp; then
        echo 'Please unpack part 1 first!'
        exit 1
fi
(read Scheck
if test "$Scheck" != 18; then
        echo Please unpack part "$Scheck" next!
        exit 1
 else
        exit 0
 fi
) < _shar_seq_.tmp || exit 1
if test ! -f _shar_wnt_.tmp; then
echo 'x - still skipping patch-2.3.9'
else
echo 'x - continuing with patch-2.3.9'
sed 's/^X//' << 'SHAR_EOF' >> 'patch-2.3.9' &&
-#include <linux/config.h>
X #include <linux/module.h>
X 
X #include <asm/spinlock.h>
diff -u --recursive --new-file v2.3.8/linux/drivers/usb/audio.c linux/drivers/usb/audio.c
--- v2.3.8/linux/drivers/usb/audio.c	Sun Jun 20 18:51:52 1999
+++ linux/drivers/usb/audio.c	Wed Jun 30 11:24:55 1999
@@ -3,7 +3,6 @@
X #include <linux/string.h>
X #include <linux/timer.h>
X #include <linux/sched.h>
-#include <linux/config.h>
X #include <linux/module.h>
X 
X #include "usb.h"
diff -u --recursive --new-file v2.3.8/linux/drivers/usb/cpia.c linux/drivers/usb/cpia.c
--- v2.3.8/linux/drivers/usb/cpia.c	Sun Jun 20 18:51:52 1999
+++ linux/drivers/usb/cpia.c	Wed Jun 30 11:24:55 1999
@@ -17,7 +17,6 @@
X #include <linux/videodev.h>
X #include <linux/vmalloc.h>
X #include <linux/wrapper.h>
-#include <linux/config.h>
X #include <linux/module.h>
X 
X #include <asm/spinlock.h>
diff -u --recursive --new-file v2.3.8/linux/drivers/usb/hub.c linux/drivers/usb/hub.c
--- v2.3.8/linux/drivers/usb/hub.c	Sun Jun 20 18:51:52 1999
+++ linux/drivers/usb/hub.c	Wed Jun 30 11:24:55 1999
@@ -10,7 +10,6 @@
X #include <linux/list.h>
X #include <linux/malloc.h>
X #include <linux/smp_lock.h>
-#include <linux/config.h>
X #include <linux/module.h>
X 
X #include <asm/spinlock.h>
diff -u --recursive --new-file v2.3.8/linux/drivers/usb/mouse.c linux/drivers/usb/mouse.c
--- v2.3.8/linux/drivers/usb/mouse.c	Sun Jun 20 18:51:52 1999
+++ linux/drivers/usb/mouse.c	Wed Jun 30 11:24:55 1999
@@ -33,7 +33,6 @@
X #include <linux/poll.h>
X #include <linux/init.h>
X #include <linux/malloc.h>
-#include <linux/config.h>
X #include <linux/module.h>
X 
X #include <asm/spinlock.h>
diff -u --recursive --new-file v2.3.8/linux/drivers/usb/ohci-debug.c linux/drivers/usb/ohci-debug.c
--- v2.3.8/linux/drivers/usb/ohci-debug.c	Tue Jun  8 10:52:26 1999
+++ linux/drivers/usb/ohci-debug.c	Fri Jun 25 14:30:28 1999
@@ -124,7 +124,9 @@
X 		td_cc_accessed(*td) ? "" : "Not ",
X 		td_active(*td) ? "" : "Not ");
X 
-	printk(KERN_DEBUG "        %s\n", td_allocated(*td) ? "Allocated" : "Free");
+	printk(KERN_DEBUG "        %s%s\n",
+		td_allocated(*td) ? "Allocated" : "Free",
+		td_dummy(*td) ? " DUMMY" : "");
X 
X 	printk(KERN_DEBUG "      cur_buf  =  0x%x\n", le32_to_cpup(&td->cur_buf));
X 	printk(KERN_DEBUG "      next_td  =  0x%x\n", le32_to_cpup(&td->next_td));
@@ -139,6 +141,26 @@
X 			d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7] );
X 	}
X } /* show_ohci_td() */
+
+
+void show_ohci_td_chain(struct ohci_td *td)
+{
+	struct ohci_td *cur_td;
+	if (td == NULL) return;
+
+	printk(KERN_DEBUG "+++ OHCI TD Chain %lx: +++\n", virt_to_bus(td));
+
+	cur_td = td;
+	for (;;) {
+		show_ohci_td(cur_td);
+		if (!cur_td->next_td) break;
+		cur_td = bus_to_virt(le32_to_cpup(&cur_td->next_td));
+		/* we can't trust -anything- we find inside of a dummy TD */
+		if (td_dummy(*cur_td)) break;
+	}
+
+	printk(KERN_DEBUG "--- End  TD Chain %lx: ---\n", virt_to_bus(td));
+} /* show_ohci_td_chain () */
X 
X 
X void show_ohci_device(struct ohci_device *dev)
diff -u --recursive --new-file v2.3.8/linux/drivers/usb/ohci.c linux/drivers/usb/ohci.c
--- v2.3.8/linux/drivers/usb/ohci.c	Sun Jun 20 18:55:52 1999
+++ linux/drivers/usb/ohci.c	Fri Jun 25 14:30:28 1999
@@ -2,19 +2,14 @@
X  * Open Host Controller Interface driver for USB.
X  *
X  * (C) Copyright 1999 Gregory P. Smith <gr...@electricrain.com>
+ * Significant code from the following individuals has also been used:
+ * (C) Copyright 1999 Roman Weissgaerber <wei...@vienna.at> [ohci-hcd.c]
+ * (C) Copyright 1999 Linus Torvalds [uhci.c]
X  *
X  * This is the "other" host controller interface for USB.  You will
X  * find this on many non-Intel based motherboards, and of course the
- * Mac.  As Linus hacked his UHCI driver together first, I modeled
- * this after his.. (it should be obvious)
- *
- * From the programming standpoint the OHCI interface seems a little
- * prettier and potentially less CPU intensive.  This remains to be
- * proven.  In reality, I don't believe it'll make one darn bit of
- * difference.  USB v1.1 is a slow bus by today's standards.
- *
- * OHCI hardware takes care of most of the scheduling of different
- * transfer types with the correct prioritization for us.
+ * Mac.  As Linus hacked his UHCI driver together first, I originally
+ * modeled this after his.. (it should be obvious)
X  *
X  * To get started in USB, I used the "Universal Serial Bus System
X  * Architecture" book by Mindshare, Inc.  It was a reasonable introduction
@@ -76,6 +71,7 @@
X #define FIELDS_OF_TD(t)	le32_to_cpup(&t->info), le32_to_cpup(&t->cur_buf), \
X 			le32_to_cpup(&t->next_td), le32_to_cpup(&t->buf_end)
X 
+#ifdef OHCI_DEBUG
X static const char *cc_names[16] = {
X 	"no error",
X 	"CRC error",
@@ -94,6 +90,7 @@
X 	"not accessed (14)",
X 	"not accessed"
X };
+#endif
X 
X /*
X  * Add a chain of TDs to the end of the TD list on a given ED.
@@ -152,6 +149,36 @@
X } /* ohci_add_td_to_ed() */
X 
X 
+/*
+ * Add a whole chain of TDs to an ED using the above function.
+ * The same restrictions apply.
+ *
+ * XXX This function is being removed in the future! XXX
+ */
+static struct ohci_td *ohci_add_td_chain_to_ed(struct ohci_td *td, struct ohci_ed *ed)
+{
+	struct ohci_td *cur_td;
+	if (!td)
+		return NULL;
+
+	/* Find the last TD in this chain, storing its pointer in cur_td */
+	cur_td = td;
+	for (;;) {
+		__u32 next_td = cur_td->next_td;
+
+		/* advance to the next td, exit if there isn't one */
+		if (!next_td)
+			break;
+		cur_td = bus_to_virt(le32_to_cpup(&next_td));
+	}
+
+	return td = ohci_add_td_to_ed(td, cur_td, ed);
+} /* ohci_add_td_chain_to_ed() */
+
+
+/* .......... */
+
+
X inline void ohci_start_control(struct ohci *ohci)
X {
X 	/* tell the HC to start processing the control list */
@@ -474,7 +501,7 @@
X }
X 
X /*
- *  Remove a TD from the given EDs TD list.
+ *  Remove a TD from the given EDs TD list.  The TD is freed as well.
X  */
X static void ohci_remove_td_from_ed(struct ohci_td *td, struct ohci_ed *ed)
X {
@@ -484,11 +511,11 @@
X 	if ((td == NULL) || (ed == NULL))
X 		return;
X 
-	spin_lock_irqsave(&ohci_edtd_lock, flags);
-
X 	if (ed_head_td(ed) == 0)
X 		return;
X 
+	spin_lock_irqsave(&ohci_edtd_lock, flags);
+
X 	/* set the "skip me bit" in this ED */
X 	ed->status |= cpu_to_le32(OHCI_ED_SKIP);
X 
@@ -569,6 +596,10 @@
X /*
X  * Get a pointer (virtual) to an available TD from the given device's
X  * pool.  Return NULL if none are left.
+ *
+ * NOTE: This function does not allocate and attach the dummy_td.
+ * That is done in ohci_fill_ed().  FIXME: it should probably be moved
+ * into here.
X  */
X static struct ohci_ed *ohci_get_free_ed(struct ohci_device *dev)
X {
@@ -593,6 +624,11 @@
X } /* ohci_get_free_ed() */
X 
X 
+/*
+ * Free an OHCI ED and all of the TDs on its list.  It is assumed that
+ * this ED is not active.  You should call ohci_wait_for_ed_safe()
+ * beforehand if you can't guarantee that.
+ */
X void ohci_free_ed(struct ohci_ed *ed)
X {
X 	if (!ed)
@@ -692,6 +728,140 @@
X } /* ohci_fill_ed() */
X 
X 
+/*
+ *  Create a chain of Normal TDs to be used for a large data transfer
+ *  (bulk or control).
+ *
+ *  Returns the head TD in the chain.
+ */
+struct ohci_td *ohci_build_td_chain(struct ohci_device *dev, void *data, unsigned int len, int dir, __u32 toggle, int round, int auto_free, void* dev_id, usb_device_irq handler, __u32 next_td)
+{
+	struct ohci_td *head, *cur_td;
+	__u32 bus_data_start, bus_data_end;
+	unsigned short max_page0_len;
+
+	if (!data || (len == 0))
+		return NULL;
+
+	/* Setup the first TD, leaving buf_end = 0 */
+	head = ohci_get_free_td(dev);
+	if (head == NULL) {
+		printk(KERN_ERR "usb-ohci: out of TDs\n");
+		return NULL;
+	}
+
+	ohci_fill_new_td(head,
+		td_set_dir_out(dir),
+		toggle & OHCI_TD_DT,
+		(round ? OHCI_TD_ROUND : 0),
+		data, 0,
+		dev_id, handler);
+	if (!auto_free)
+		noauto_free_td(head);
+
+	cur_td = head;
+
+	/* AFICT, that the OHCI controller takes care of the innards of
+	 * bulk & control data transfers by sending zero length
+	 * packets as necessary if the transfer falls on an even packet
+	 * size boundary, we don't need a special TD for that. */
+
+	while (len > 0) {
+		bus_data_start = virt_to_bus(data);
+		bus_data_end = virt_to_bus(data+(len-1));
+
+		/* check the 4096 byte alignment of the start of the data */
+		max_page0_len = 0x1000 - (bus_data_start & 0xfff);
+
+		/* check if the remaining data occupies more than two pages */
+		if ((max_page0_len < len) && (len - max_page0_len > 0x1000)) {
+			struct ohci_td *new_td;
+
+			/* Point this TD to data up through the end of
+			 * the second page */
+			cur_td->buf_end = bus_data_start +
+				(max_page0_len + 0xfff);
+
+			/* adjust the data pointer & remaining length */
+			data += (max_page0_len + 0x1000);
+			len  -= (max_page0_len + 0x1000);
+
+			/* TODO lookup effect of rounding bit on
+			 * individual TDs vs. whole TD chain transfers;
+			 * disable cur_td's rounding bit here if needed. */
+
+			/* mark that this is not the last TD... */
+			clear_td_endofchain(cur_td);
+
+			/* allocate another td */
+			new_td = ohci_get_free_td(dev);
+			if (new_td == NULL) {
+				printk(KERN_ERR "usb-ohci: out of TDs\n");
+				/* FIXME: free any allocated TDs */
+				return NULL;
+			}
+
+			ohci_fill_new_td(new_td,
+				td_set_dir_out(dir),
+				TOGGLE_AUTO,  /* toggle Data0/1 via the ED */
+				round ? OHCI_TD_ROUND : 0,
+				data, 0,
+				dev_id, handler);
+			if (!auto_free)
+				noauto_free_td(new_td);
+
+			/* Link the new TD to the chain & advance */
+			cur_td->next_td = virt_to_bus(new_td);
+			cur_td = new_td;
+		} else {
+			/* Last TD in this chain, normal buf_end is fine */
+			cur_td->buf_end = bus_data_end;
+
+			set_td_endofchain(cur_td);
+
+			len = 0;
+			break;
+		}
+	} /* while */
+
+	/* link the given next_td to the end of this chain */
+	cur_td->next_td = next_td;
+
+	return head;
+} /* ohci_build_td_chain() */
+
+
+/*
+ * Compute the number of bytes that have been transferred on a given
+ * TD.  Do not call this on TDs that are active on the host
+ * controller.
+ */
+static __u16 ohci_td_bytes_done(struct ohci_td *td)
+{
+	__u16 result;
+	__u32 bus_data_start, bus_data_end;
+
+	bus_data_start = virt_to_bus(td->data);
+	if (!td->data || !bus_data_start)
+		return 0;
+
+	/* if cur_buf is 0, all data has been transferred */
+	bus_data_end = td->cur_buf ? td->cur_buf : td->buf_end;
+
+	/* is it on the same page? */
+	if ((bus_data_start & ~0xfff) == (bus_data_end & ~0xfff)) {
+		result = bus_data_end - bus_data_start + 1;
+	} else {
+		/* compute the amount transferred on the first page */
+		result = 0x1000 - (bus_data_start & 0xfff);
+		/* add the amount done in the second page */
+		result += (bus_data_end & 0xfff) + 1;
+	}
+
+	return result;
+} /* ohci_td_bytes_done() */
+
+
X /**********************************
X  * OHCI interrupt list operations *
X  **********************************/
@@ -762,6 +932,10 @@
X 	/* Assimilate the new ED into the collective */
X 	ohci_add_periodic_ed(dev->ohci, interrupt_ed, period);
X 
+	/* FIXME: return a request handle that can be used by the
+	 * caller to cancel this request.  Be sure its guaranteed not
+	 * to be re-used until the caller is guaranteed to know that
+	 * the transfer has ended or been cancelled */
X 	return 0;
X } /* ohci_request_irq() */
X 
@@ -794,8 +968,7 @@
X  * Send or receive a control message on a "pipe"
X  *
X  * The cmd parameter is a pointer to the 8 byte setup command to be
- * sent.  FIXME:  This is a devrequest in usb.h.  The function
- * should be updated to accept a devrequest* instead of void*..
+ * sent.
X  *
X  * A control message contains:
X  *   - The command itself
@@ -811,7 +984,6 @@
X 	struct ohci_ed *control_ed = ohci_get_free_ed(dev);
X 	struct ohci_td *setup_td, *data_td, *status_td;
X 	DECLARE_WAITQUEUE(wait, current);
-	unsigned long flags;
X 	int completion_status = -1;
X 	devrequest our_cmd;
X 
@@ -861,57 +1033,17 @@
X 	ohci_fill_new_td(setup_td, OHCI_TD_D_SETUP, TOGGLE_DATA0,
X 			OHCI_TD_IOC_OFF,
X 			&our_cmd, 8,	/* cmd is always 8 bytes long */
-			NULL, NULL);
+			&completion_status, NULL);
X 
-	/* allocate the next TD */
-	data_td = ohci_get_free_td(dev);
-	if (!data_td) {
-		printk(KERN_ERR "usb-ohci: couldn't get TD for dev %p [cntl data]\n", dev);
+	/* Allocate a TD for the control xfer status */
+	status_td = ohci_get_free_td(dev);
+	if (!status_td) {
+		printk("usb-ohci: couldn't get TD for dev %p [cntl status]\n", dev);
X 		ohci_free_td(setup_td);
X 		ohci_free_ed(control_ed);
X 		return -1;
X 	}
X 
-	/* link to the next TD */
-	setup_td->next_td = cpu_to_le32(virt_to_bus(data_td));
-
-	if (len > 0) {
-
-		/* build the Control DATA TD, it starts with a DATA1. */
-		ohci_fill_new_td(data_td, td_set_dir_out(usb_pipeout(pipe)),
-				TOGGLE_DATA1,
-				OHCI_TD_ROUND | OHCI_TD_IOC_OFF,
-				data, len,
-				NULL, NULL);
-
-		/*
-		 * TODO: Normal TDs can transfer up to 8192 bytes on OHCI.
-		 * However, for that to happen, the data must -start-
-		 * on a nice 4kb page.  We need to check for data
-		 * sizes > 4096 and, if they cross more than two 4096
-		 * byte pages of memory one or more additional TDs
-		 * will need to be created.  (repeat doing this in a
-		 * loop until all of the DATA is on a TD)
-		 *
-		 * Control transfers are -highly unlikely- to need to
-		 * transfer this much data.. but who knows.. sadistic
-		 * hardware is sure to exist.
-		 */
-
-		status_td = ohci_get_free_td(dev);  /* TODO check for NULL */
-		if (!status_td) {
-			printk(KERN_ERR "usb-ohci: couldn't get TD for dev %p [cntl status]\n", dev);
-			ohci_free_td(setup_td);
-			ohci_free_td(data_td);
-			ohci_free_ed(control_ed);
-			return -1;
-		}
-
-		data_td->next_td = cpu_to_le32(virt_to_bus(status_td));
-	} else {
-		status_td = data_td; /* no data_td, use it for status */
-	}
-
X 	/* The control status packet always uses a DATA1
X 	 * Give "dev_id" the address of completion_status so that the
X 	 * TDs status can be passed back to us from the IRQ. */
@@ -923,27 +1055,44 @@
X 			&completion_status, ohci_control_completed);
X 	status_td->next_td = 0; /* end of TDs */
X 
+	/* If there is data to transfer, create the chain of data TDs
+	 * followed by the status TD. */
+	if (len > 0) {
+		data_td = ohci_build_td_chain( dev, data, len,
+				usb_pipeout(pipe), TOGGLE_DATA1,
+				1 /* round */, 1 /* autofree */,
+				&completion_status, NULL /* no handler here */,
+				virt_to_bus(status_td) );
+		if (!data_td) {
+			printk(KERN_ERR "usb-ohci: couldn't allocate control data TDs for dev %p\n", dev);
+			ohci_free_td(setup_td);
+			ohci_free_td(status_td);
+			ohci_free_ed(control_ed);
+			return -1;
+		}
+
+		/* link the to the data & status TDs */
+		setup_td->next_td = virt_to_bus(data_td);
+	} else {
+		/* no data TDs, link to the status TD */
+		setup_td->next_td = virt_to_bus(status_td);
+	}
+
X 	/*
-	 * Add the chain of 2-3 control TDs to the control ED's TD list
+	 * Add the control TDs to the control ED (setup_td is the first)
X 	 */
-	spin_lock_irqsave(&ohci_edtd_lock, flags);
-	setup_td = ohci_add_td_to_ed(setup_td, status_td, control_ed);
-	spin_unlock_irqrestore(&ohci_edtd_lock, flags);
+	setup_td = ohci_add_td_chain_to_ed(setup_td, control_ed);
+  	control_ed->status &= ~OHCI_ED_SKIP;
+  	ohci_unhalt_ed(control_ed);
X 
X #ifdef OHCI_DEBUG
X 	if (MegaDebug) {
X 	/* complete transaction debugging output (before) */
X 	printk(KERN_DEBUG " Control ED %lx:\n", virt_to_bus(control_ed));
X 	show_ohci_ed(control_ed);
-	printk(KERN_DEBUG " Setup TD %lx:\n", virt_to_bus(setup_td));
-	show_ohci_td(setup_td);
-	if (data_td != status_td) {
-		printk(KERN_DEBUG " Data TD %lx:\n", virt_to_bus(data_td));
-		show_ohci_td(data_td);
-	}
-	printk(KERN_DEBUG " Status TD %lx:\n", virt_to_bus(status_td));
-	show_ohci_td(status_td);
-	printk(KERN_DEBUG " Controller Status:\n");
+	printk(KERN_DEBUG " Control TD chain:\n");
+	show_ohci_td_chain(setup_td);
+	printk(KERN_DEBUG " OHCI Controller Status:\n");
X 	show_ohci_status(dev->ohci);
X 	}
X #endif
@@ -966,19 +1115,15 @@
X 	/* complete transaction debugging output (after) */
X 	printk(KERN_DEBUG " *after* Control ED %lx:\n", virt_to_bus(control_ed));
X 	show_ohci_ed(control_ed);
-	printk(KERN_DEBUG " *after* Setup TD %lx:\n", virt_to_bus(setup_td));
-	show_ohci_td(setup_td);
-	if (data_td != status_td) {
-		printk(KERN_DEBUG " *after* Data TD %lx:\n", virt_to_bus(data_td));
-		show_ohci_td(data_td);
-	}
-	printk(KERN_DEBUG " *after* Status TD %lx:\n", virt_to_bus(status_td));
-	show_ohci_td(status_td);
-	printk(KERN_DEBUG " *after* Controller Status:\n");
+	printk(KERN_DEBUG " *after* Control TD chain:\n");
+	show_ohci_td_chain(setup_td);
+	printk(KERN_DEBUG " *after* OHCI Controller Status:\n");
X 	show_ohci_status(dev->ohci);
X 	}
X #endif
X 
+	/* no TD cleanup, the TDs were auto-freed as they finished */
+
X 	/* remove the control ED from the HC */
X 	ohci_remove_control_ed(dev->ohci, control_ed);
X 	ohci_free_ed(control_ed);	 /* return it to the pool */
@@ -1008,6 +1153,219 @@
X } /* ohci_control_msg() */
X 
X 
+/**********************************************************************
+ *  Bulk transfer processing
+ **********************************************************************/
+
+/*
+ * Internal state for an ohci_bulk_request
+ */
+struct ohci_bulk_request_state {
+	struct usb_device *usb_dev;
+	unsigned int	pipe;		/* usb "pipe" */
+	void		*data;		/* ptr to data */
+	int		length;		/* length to transfer */
+	int		_bytes_done;	/* bytes transferred so far */
+	unsigned long	*bytes_transferred_p;	/* where to increment */
+	void		*dev_id;	/* pass to the completion handler */
+	usb_device_irq	completion;	/* completion handler */
+};
+
+/*
+ * this handles the individual TDs of a (possibly) larger bulk
+ * request.  It keeps track of the total bytes transferred, calls the
+ * final completion handler, etc.
+ */
+static int ohci_bulk_td_handler(int stats, void *buffer, int len, void *dev_id)
+{
+	struct ohci_bulk_request_state *req;
+
+	req = (struct ohci_bulk_request_state *) dev_id;
+
+#ifdef OHCI_DEBUG
+	printk(KERN_DEBUG "ohci_bulk_td_handler stats %x, buffer %p, len %d, req %p\n", stats, buffer, len, req);
+#endif
+
+	/* only count TDs that were completed successfully */
+	if (stats == USB_ST_NOERROR)
+		req->_bytes_done += len;
+
+#ifdef OHCI_DEBUG
+	printk(KERN_DEBUG "ohci_bulk_td_handler %d bytes done\n", req->_bytes_done);
+#endif
+
+	/* call the real completion handler when done or on an error */
+	if ((stats != USB_ST_NOERROR) ||
+	    (req->_bytes_done >= req->length && req->completion != NULL)) {
+		*req->bytes_transferred_p += req->_bytes_done;
+#ifdef OHCI_DEBUG
+		printk(KERN_DEBUG "usb-ohci: bulk request %p ending after %d bytes\n", req, req->_bytes_done);
+#endif
+		req->completion(stats, buffer, req->_bytes_done, req->dev_id);
+	}
+
+	return 0;	/* do not re-queue the TD */
+} /* ohci_bulk_td_handler() */
+
+
+/*
+ * Request to send or receive bulk data.  The completion() function
+ * will be called when the transfer has completed or been aborted due
+ * to an error.
+ *
+ * bytes_transferred_p is a pointer to an integer that will be
+ * -incremented- by the number of bytes that have been successfully
+ * transferred.  The interrupt handler will update it after each
+ * internal TD completes successfully.
+ *
+ * This function can NOT be called from an interrupt (?)
+ * (TODO: verify & fix this if needed).
+ *
+ * Returns: a pointer to the ED being used for this request.  At the
+ * moment, removing & freeing it is the responsibilty of the caller.
+ */
+static struct ohci_ed* ohci_request_bulk(struct ohci_bulk_request_state *bulk_request)
+{
+	/* local names for the readonly fields */
+	struct usb_device *usb_dev = bulk_request->usb_dev;
+	unsigned int pipe = bulk_request->pipe;
+	void *data = bulk_request->data;
+	int len = bulk_request->length;
+
+	struct ohci_device *dev = usb_to_ohci(usb_dev);
+	struct ohci_ed *bulk_ed;
+	struct ohci_td *head_td;
+	unsigned long flags;
+
+#ifdef OHCI_DEBUG 
+	printk(KERN_DEBUG "ohci_request_bulk(%p) ohci_dev %p, completion %p, pipe %x, data %p, len %d\n", bulk_request, dev, bulk_request->completion, pipe, data, len);
+#endif
+
+	bulk_ed = ohci_get_free_ed(dev);
+	if (!bulk_ed) {
+		printk("usb-ohci: couldn't get ED for dev %p\n", dev);
+		return NULL;
+	}
+
+	/* allocate & fill in the TDs for this request */
+	head_td = ohci_build_td_chain(dev, data, len, usb_pipeout(pipe),
+			TOGGLE_AUTO,
+			0 /* round not required */, 1 /* autofree */,
+			bulk_request,  /* dev_id: the bulk_request  */
+			ohci_bulk_td_handler,
+			0 /* no additional TDs */);
+	if (!head_td) {
+		printk("usb-ohci: couldn't get TDs for dev %p\n", dev);
+		ohci_free_ed(bulk_ed);
+		return NULL;
+	}
+
+	/* Set the max packet size, device speed, endpoint number, usb
+	 * device number (function address), and type of TD. */
+	ohci_fill_ed(dev, bulk_ed,
+		usb_maxpacket(usb_dev, pipe),
+		usb_pipeslow(pipe),
+		usb_pipe_endpdev(pipe), 0 /* bulk uses normal TDs */);
+
+	/* initialize the internal counter */
+	bulk_request->_bytes_done = 0;
+
+	/*
+	 * Add the TDs to the ED
+	 */
+	spin_lock_irqsave(&ohci_edtd_lock, flags);
+	bulk_ed->status |= OHCI_ED_SKIP;
+	head_td = ohci_add_td_chain_to_ed(head_td, bulk_ed);
+	bulk_ed->status &= ~OHCI_ED_SKIP;
+	ohci_unhalt_ed(bulk_ed);
+	spin_unlock_irqrestore(&ohci_edtd_lock, flags);
+
+
+#ifdef OHCI_DEBUG
+/*	if (MegaDebug) { */
+	/* complete transaction debugging output (before) */
+	printk(KERN_DEBUG " Bulk ED %lx:\n", virt_to_bus(bulk_ed));
+	show_ohci_ed(bulk_ed);
+	printk(KERN_DEBUG " Bulk TDs %lx:\n", virt_to_bus(head_td));
+	show_ohci_td_chain(head_td);
+/*	} */
+#endif
+
+	/* Give the ED to the HC */
+	ohci_add_bulk_ed(dev->ohci, bulk_ed);
+
+	return bulk_ed;
+} /* ohci_request_bulk() */
+
+
+static DECLARE_WAIT_QUEUE_HEAD(bulk_wakeup);
+
+
+static int ohci_bulk_msg_completed(int stats, void *buffer, int len, void *dev_id)
+{
+	if (dev_id != NULL) {
+		int *completion_status = (int *)dev_id;
+		*completion_status = stats;
+	}
+
+	wake_up(&bulk_wakeup);
+	return 0;	/* don't requeue the TD */
+} /* ohci_bulk_msg_completed() */
+
+
+static int ohci_bulk_msg(struct usb_device *usb_dev, unsigned int pipe, void *data, int len, unsigned long *bytes_transferred_p)
+{
+	DECLARE_WAITQUEUE(wait, current);
+	int completion_status = USB_ST_INTERNALERROR;
+	struct ohci_bulk_request_state req;
+	struct ohci_ed *req_ed;
+
+	/* ....... */
+
+#ifdef OHCI_DEBUG 
+	printk(KERN_DEBUG "ohci_bulk_msg %p pipe %x, data %p, len %d, bytes_transferred %p\n", usb_dev, pipe, data, len, bytes_transferred_p);
+#endif
+
+	req.usb_dev = usb_dev;
+	req.pipe = pipe;
+	req.data = data;
+	req.length = len;
+	req.bytes_transferred_p = bytes_transferred_p;
+	req.dev_id = &completion_status;
+	req.completion = ohci_bulk_msg_completed;
+
+	/*
+	 * Start the transaction..
+	 */
+	current->state = TASK_UNINTERRUPTIBLE;
+	add_wait_queue(&bulk_wakeup, &wait);
+
+	req_ed = ohci_request_bulk(&req);
+
+	/* FIXME this should to wait for a caller specified time... */
+	schedule_timeout(HZ*5);
+
+#ifdef OHCI_DEBUG
+	printk(KERN_DEBUG "ohci_bulk_msg request completed or timed out w/ status %x\n", completion_status);
+#endif
+
+	remove_wait_queue(&bulk_wakeup, &wait);
+
+	/* remove the ED from the HC */
+	ohci_remove_bulk_ed(usb_to_ohci(usb_dev)->ohci, req_ed);
+	ohci_free_ed(req_ed);	 /* return it to the pool */
+
+#ifdef OHCI_DEBUG
+	printk(KERN_DEBUG "ohci_bulk_msg done.\n");
+#endif
+
+	return completion_status;
+} /* ohci_bulk_msg() */
+
+
+/* .......... */
+
+
X /*
X  * Allocate a new USB device to be attached to an OHCI controller
X  */
@@ -1079,8 +1437,6 @@
X 	return 0;
X }
X 
-/* FIXME! */
-#define ohci_bulk_msg NULL
X 
X /*
X  * functions for the generic USB driver
@@ -1404,6 +1760,7 @@
X {
X 	struct ohci_td *td;		/* used for walking the list */
X 
+	/* um... isn't this dangerous to do in an interrupt handler? -greg */
X 	spin_lock(&ohci_edtd_lock);
X 
X 	/* create the FIFO ordered donelist */
@@ -1416,18 +1773,12 @@
X 		if (td_dummy(*td))
X 			printk(KERN_ERR "yikes! reaping a dummy TD\n");
X 
-		/* FIXME: munge td->info into a future standard status format */
-
-		if (cc != 0 && ohci_ed_halted(td->ed) && td->completed == 0) {
+		if (cc != 0 && ohci_ed_halted(td->ed) && !td_endofchain(*td)) {
X 			/*
X 			 * There was an error on this TD and the ED
X 			 * is halted, and this was not the last TD
X 			 * of the transaction, so there will be TDs
X 			 * to clean off the ED.
-			 * (We assume that a TD with a non-NULL completed
-			 * field is the last one of a transaction.
-			 * Ultimately we should have a flag in the TD
-			 * to say that it is the last one.)
X 			 */
X 			struct ohci_ed *ed = td->ed;
X 			struct ohci_td *tail_td = bus_to_virt(ed_tail_td(ed));
@@ -1437,17 +1788,27 @@
X 			td = ntd = bus_to_virt(ed_head_td(ed));
X 			while (td != tail_td) {
X 				ntd = bus_to_virt(le32_to_cpup(&td->next_td));
-				if (td->completed != 0)
-					break;
-				ohci_free_td(td);
+
+				/* only deal with TDs from this ED,
+				 * the host controller could have
+				 * processed other endpoints at the
+				 * same time as this one.. */
+				if (td->ed == ed) {
+					if (td_endofchain(*td))
+						break;
+
+					/* FIXME: unlink this TD from the
+					 * reverse donelist! */
+					ohci_free_td(td);
+				}
+
X 				td = ntd;
X 			}
X 			/* Set the ED head past the ones we cleaned
X 			   off, and clear the halted flag */
X 			set_ed_head_td(ed, virt_to_bus(ntd));
X 			ohci_unhalt_ed(ed);
-			/* If we didn't find a TD with a completion
-			   routine, give up */
+			/* If we didn't find an endofchain TD, give up */
X 			if (td == tail_td) {
X 				td = next_td;
X 				continue;
@@ -1456,7 +1817,7 @@
X 
X 		/* Check if TD should be re-queued */
X 		if ((td->completed != NULL) &&
-		    (td->completed(cc, td->data, -1 /* XXX */, td->dev_id))) {
+		    (td->completed(cc, td->data, ohci_td_bytes_done(td), td->dev_id))) {
X 			/* Mark the TD as active again:
X 			 * Set the not accessed condition code
X 			 * Reset the Error count
@@ -1473,7 +1834,8 @@
X 			ohci_add_td_to_ed(td, td, td->ed);
X 		} else {
X 			/* return it to the pool of free TDs */
-			ohci_free_td(td);
+			if (can_auto_free(*td))
+				ohci_free_td(td);
X 		}
X 
X 		td = next_td;
@@ -1516,6 +1878,13 @@
X 	/* Disable HC interrupts */ /* why? - paulus */
X 	writel(OHCI_INTR_MIE, ®s->intrdisable);
X 
+#if 0
+	/* Only do this for SERIOUS debugging, be sure kern.debug logs
+	 * are not going to the console as this can cause your
+	 * machine to lock up if so... -greg */
+	show_ohci_status(ohci);
+#endif
+
X 	/* Process the done list */
X 	if (context & OHCI_INTR_WDH) {
X 		/* See which TD's completed.. */
@@ -1856,9 +2225,11 @@
X 				show_ohci_status(ohci);
X 			} else if (signr == SIGUSR2) {
X 				/* toggle mega TD/ED debugging output */
+#ifdef OHCI_DEBUG
X 				MegaDebug = !MegaDebug;
X 				printk(KERN_DEBUG "usb-ohci: Mega debugging %sabled.\n",
X 						MegaDebug ? "en" : "dis");
+#endif
X 			} else {
X 				/* unknown signal, exit the thread */
X 				break;
@@ -2084,9 +2455,6 @@
X } /* ohci_init */
X 
X 
-/* vim:sw=8
- */
-
X #ifdef MODULE
X /*
X  *  Clean up when unloading the module
@@ -2103,4 +2471,5 @@
X }
X #endif //MODULE
X 
-
+/* vim:sw=8
+ */
diff -u --recursive --new-file v2.3.8/linux/drivers/usb/ohci.h linux/drivers/usb/ohci.h
--- v2.3.8/linux/drivers/usb/ohci.h	Tue Jun  8 10:52:26 1999
+++ linux/drivers/usb/ohci.h	Fri Jun 25 14:30:28 1999
@@ -38,10 +38,12 @@
X 	void *data;			/* virt. address of the the buffer */
X 	usb_device_irq completed;	/* Completion handler routine */
X 	int hcd_flags;			/* Flags for the HCD: */
-		/* bit0 = boolean: Is this TD allocated? */
-		/* bit1 = boolean: Is this a dummy (end of list) TD? */
+		/* bit0: Is this TD allocated? */
+		/* bit1: Is this a dummy (end of list) TD? */
+		/* bit2: do NOT automatically free this TD on completion */
+		/* bit3: this is NOT the last TD in a contiguious TD chain
+		 *       on the indicated ED.  (0 means it is the last) */
X 
-	/* User or Device class driver specific fields */
X 	void *dev_id;	/* user defined pointer passed to irq handler */
X } __attribute((aligned(16)));
X 
@@ -54,6 +56,7 @@
X #define td_set_dir_out(d)	((d) ? OHCI_TD_D_OUT : OHCI_TD_D_IN )
X #define OHCI_TD_IOC_DELAY (7 << 21)	/* frame delay allowed before int. */
X #define OHCI_TD_IOC_OFF	(OHCI_TD_IOC_DELAY)	/* no interrupt on complete */
+#define td_set_ioc_delay(frames)	(((frames) & 7) << 21)
X #define OHCI_TD_DT	(3 << 24)	/* data toggle bits */
X #define TOGGLE_AUTO	(0 << 24)	/* automatic (from the ED) */
X #define TOGGLE_DATA0	(2 << 24)	/* force Data0 */
@@ -82,6 +85,19 @@
X #define make_dumb_td(td)	((td)->hcd_flags |= 2)
X #define clear_dumb_td(td)	((td)->hcd_flags &= ~(__u32)2)
X 
+#define td_endofchain(td)	(!((td).hcd_flags & (1 << 3)))
+#define set_td_endofchain(td)	((td)->hcd_flags &= ~(1 << 3))
+#define clear_td_endofchain(td)	((td)->hcd_flags |= (1 << 3))
+
+/*
+ * These control if the IRQ will call ohci_free_td after taking the TDs
+ * off of the donelist (assuming the completion function does not ask
+ * for the TD to be requeued).
+ */
+#define can_auto_free(td)	(!((td).hcd_flags & 4))
+#define noauto_free_td(td)	((td)->hcd_flags |= 4)
+#define auto_free_td(td)	((td)->hcd_flags &= ~(__u32)4)
+
X 
X /*
X  * The endpoint descriptors also requires 16-byte alignment
@@ -369,6 +385,7 @@
X     	int irq;
X 	struct ohci_regs *regs;			/* OHCI controller's memory */
X 	struct usb_bus *bus;
+	struct ohci_device *root_hub;		/* Root hub & controller */
X 	struct list_head interrupt_list;	/* List of interrupt active TDs for this OHCI */
X };
X 
@@ -380,6 +397,7 @@
X /* Debugging code [ohci-debug.c] */
X void show_ohci_ed(struct ohci_ed *ed);
X void show_ohci_td(struct ohci_td *td);
+void show_ohci_td_chain(struct ohci_td *td);
X void show_ohci_status(struct ohci *ohci);
X void show_ohci_device(struct ohci_device *dev);
X void show_ohci_hcca(struct ohci_hcca *hcca);
diff -u --recursive --new-file v2.3.8/linux/drivers/usb/printer.c linux/drivers/usb/printer.c
--- v2.3.8/linux/drivers/usb/printer.c	Mon Jun  7 20:04:01 1999
+++ linux/drivers/usb/printer.c	Fri Jun 25 14:30:28 1999
@@ -25,7 +25,7 @@
X #define MAX_RETRY_COUNT ((60*60*HZ)/NAK_TIMEOUT)	/* should not take 1 minute a page! */
X 
X #ifndef USB_PRINTER_MAJOR
-#define USB_PRINTER_MAJOR 0
+#define USB_PRINTER_MAJOR 63
X #endif
X 
X static int mymajor = USB_PRINTER_MAJOR;
@@ -166,6 +166,7 @@
X 	do {
X 		char *obuf = p->obuf;
X 		unsigned long thistime;
+		partial = 0;
X 
X 		thistime = copy_size = (count > p->maxout) ? p->maxout : count;
X 		if (copy_from_user(p->obuf, buffer, copy_size))
@@ -179,16 +180,19 @@
X 			}
X 			result = p->pusb_dev->bus->op->bulk_msg(p->pusb_dev,
X 					 usb_sndbulkpipe(p->pusb_dev, 1), obuf, thistime, &partial);
+			if (partial) {
+				obuf += partial;
+				thistime -= partial;
+				maxretry = MAX_RETRY_COUNT;
+			}
X 			if (result == USB_ST_TIMEOUT) {	/* NAK - so hold for a while */
X 				if(!maxretry--)
X 					return -ETIME;
X                                 interruptible_sleep_on_timeout(&p->wait_q, NAK_TIMEOUT);
X 				continue;
-			} else if (!result & partial) {
-				obuf += partial;
-				thistime -= partial;
-			} else
+			} else if (!result && !partial) {
X 				break;
+			}
X 		};
X 		if (result) {
X 			/* whoops - let's reset and fail the request */
@@ -255,7 +259,8 @@
X 	/*
X 	 * FIXME - this will not cope with combined printer/scanners
X 	 */
-	if (dev->descriptor.bDeviceClass != 7 ||
+	if ((dev->descriptor.bDeviceClass != 7 &&
+	     dev->descriptor.bDeviceClass != 0) ||
X 	    dev->descriptor.bNumConfigurations != 1 ||
X 	    dev->config[0].bNumInterfaces != 1) {
X 		return -1;
@@ -408,6 +413,6 @@
X 	unsigned int offset;
X 
X 	usb_deregister(&printer_driver);
-	unregister_chrdev(mymajor, "usblplp");
+	unregister_chrdev(mymajor, "usblp");
X }
X #endif
diff -u --recursive --new-file v2.3.8/linux/drivers/usb/uhci.c linux/drivers/usb/uhci.c
--- v2.3.8/linux/drivers/usb/uhci.c	Sun Jun 20 18:54:01 1999
+++ linux/drivers/usb/uhci.c	Mon Jun 28 10:59:14 1999
@@ -20,6 +20,7 @@
X 
X /* 4/4/1999 added data toggle for interrupt pipes -keryan */
X /* 5/16/1999 added global toggles for bulk and control */
+/* 6/25/1999 added fix for data toggles on bidirectional bulk endpoints */ 
X 
X #include <linux/config.h>
X #include <linux/module.h>
@@ -105,7 +106,7 @@
X     			if (uhci_debug) {
X 			    printk("Set toggle from %x rval %d\n", (unsigned int)tmp, rval ? *rval : 0);
X 			}
-			usb_settoggle(dev->usb, usb_pipeendpoint(tmp->info), (tmp->info >> 19) & 1);
+			usb_settoggle(dev->usb, usb_pipeendpoint(tmp->info), usb_pipeout(tmp->info), (tmp->info >> 19) & 1);
X 			break;
X 		} else {
X 		    if(rval)
@@ -372,7 +373,7 @@
X 
X 	td->link = 1;
X 	td->status = status;			/* In */
-	td->info = destination | (7 << 21) | (usb_gettoggle(usb_dev, usb_pipeendpoint(pipe)) << 19);	/* 8 bytes of data */
+	td->info = destination | (7 << 21) | (usb_gettoggle(usb_dev, usb_pipeendpoint(pipe), usb_pipeout(pipe)) << 19);	/* 8 bytes of data */
X 	td->buffer = virt_to_bus(dev->data);
X 	td->first = td;
X 	td->qh = interrupt_qh;
@@ -991,7 +992,7 @@
X 
X 		td->status = status;					/* Status */
X 		td->info = destination | ((pktsze-1) << 21) |
-			 (usb_gettoggle(usb_dev, usb_pipeendpoint(pipe)) << 19); /* pktsze bytes of data */
+			 (usb_gettoggle(usb_dev, usb_pipeendpoint(pipe), usb_pipeout(pipe)) << 19); /* pktsze bytes of data */
X 		td->buffer = virt_to_bus(data);
X 		td->backptr = &prevtd->link;
X 		td->first = first;
@@ -1006,7 +1007,7 @@
X 		}
X 
X 		/* Alternate Data0/1 (start with Data0) */
-		usb_dotoggle(usb_dev, usb_pipeendpoint(pipe));
+		usb_dotoggle(usb_dev, usb_pipeendpoint(pipe), usb_pipeout(pipe));
X 	}
X 	td->link = 1;				/* Terminate */
X 	td->status |= (1 << 24);		/* IOC */
@@ -1267,9 +1268,9 @@
X 				if (!(td->status & (1 << 25))) {
X 					struct uhci_qh *interrupt_qh = td->qh;
X 
-					usb_dotoggle(td->dev, usb_pipeendpoint(td->info));
+					usb_dotoggle(td->dev, usb_pipeendpoint(td->info), usb_pipeout(td->info));
X 					td->info &= ~(1 << 19); /* clear data toggle */
-					td->info |= usb_gettoggle(td->dev, usb_pipeendpoint(td->info)) << 19; /* toggle between data0 and data1 */
+					td->info |= usb_gettoggle(td->dev, usb_pipeendpoint(td->info), usb_pipeout(td->info)) << 19; /* toggle between data0 and data1 */
X 					td->status = (td->status & 0x2f000000) | (1 << 23) | (1 << 24);	/* active */
X 
X 					/* Remove then readd? Is that necessary */
@@ -1280,7 +1281,7 @@
X 				struct uhci_qh *interrupt_qh = td->qh;
X 				/* marked for removal */
X 				td->inuse &= ~2;
-				usb_dotoggle(td->dev, usb_pipeendpoint(td->info));
+				usb_dotoggle(td->dev, usb_pipeendpoint(td->info), usb_pipeout(td->info));
X 				uhci_remove_qh(interrupt_qh->skel, interrupt_qh);
X 				uhci_qh_deallocate(interrupt_qh);
X 				uhci_td_deallocate(td);
diff -u --recursive --new-file v2.3.8/linux/drivers/usb/usb.c linux/drivers/usb/usb.c
--- v2.3.8/linux/drivers/usb/usb.c	Tue Jun  8 10:52:26 1999
+++ linux/drivers/usb/usb.c	Wed Jun 30 11:24:55 1999
@@ -36,7 +36,6 @@
X  * 6		wLength		2	Count		Bytes for data
X  */
X 
-#include <linux/config.h>
X #include <linux/string.h>
X #include <linux/bitops.h>
X #include <linux/malloc.h>
@@ -773,7 +772,7 @@
X 
X 	/* toggle is reset on clear */
X 
-	usb_settoggle(dev, endp & 0x0f, 0);
+	usb_settoggle(dev, endp & 0x0f, ((endp >> 7) & 1) ^ 1, 0);
X 
X 	return 0;
X }
@@ -823,7 +822,8 @@
X 		return -1;
X 
X 	dev->actconfig = cp;
-	dev->toggle = 0;
+	dev->toggle[0] = 0;
+	dev->toggle[1] = 0;
X 	usb_set_maxpacket(dev);
X 	return 0;
X }
diff -u --recursive --new-file v2.3.8/linux/drivers/usb/usb.h linux/drivers/usb/usb.h
--- v2.3.8/linux/drivers/usb/usb.h	Tue Jun 22 14:42:23 1999
+++ linux/drivers/usb/usb.h	Mon Jun 28 10:59:14 1999
@@ -276,7 +276,7 @@
X 	int devnum;			/* Device number on USB bus */
X 	int slow;			/* Slow device? */
X 	int maxpacketsize;		/* Maximum packet size */
-	int toggle;			/* one bit for each endpoint */
+	int toggle[2];			/* one bit for each endpoint ([0] = IN, [1] = OUT) */
X 	int halted;			/* endpoint halts */
X 	struct usb_config_descriptor *actconfig;/* the active configuration */
X 	int epmaxpacket[16];		/* endpoint specific maximums */
@@ -362,7 +362,7 @@
X #define usb_pipedevice(pipe)	(((pipe) >> 8) & 0x7f)
X #define usb_pipeendpoint(pipe)	(((pipe) >> 15) & 0xf)
X #define usb_pipedata(pipe)	(((pipe) >> 19) & 1)
-#define usb_pipeout(pipe)	(((pipe) & 0x80) == 0)
+#define usb_pipeout(pipe)	((((pipe) >> 7) & 1) ^ 1)
X #define usb_pipeslow(pipe)	(((pipe) >> 26) & 1)
X 
X #define usb_pipetype(pipe)	(((pipe) >> 30) & 3)
@@ -374,9 +374,9 @@
X #define usb_pipe_endpdev(pipe)	(((pipe) >> 8) & 0x7ff)
X 
X /* The D0/D1 toggle bits */
-#define usb_gettoggle(dev, ep) (((dev)->toggle >> ep) & 1)
-#define	usb_dotoggle(dev, ep)	((dev)->toggle ^= (1 <<	ep))
-#define usb_settoggle(dev, ep, bit) ((dev)->toggle = ((dev)->toggle & ~(1 << ep)) | ((bit) << ep))
+#define usb_gettoggle(dev, ep, out) (((dev)->toggle[out] >> ep) & 1)
+#define	usb_dotoggle(dev, ep, out)  ((dev)->toggle[out] ^= (1 << ep))
+#define usb_settoggle(dev, ep, out, bit) ((dev)->toggle[out] = ((dev)->toggle[out] & ~(1 << ep)) | ((bit) << ep))
X 
X /* Endpoint halt */
X #define usb_endpoint_halt(dev, ep) ((dev)->halted |= (1 << (ep)))
diff -u --recursive --new-file v2.3.8/linux/drivers/usb/usb_scsi.c linux/drivers/usb/usb_scsi.c
--- v2.3.8/linux/drivers/usb/usb_scsi.c	Sun Jun 20 18:51:52 1999
+++ linux/drivers/usb/usb_scsi.c	Wed Jun 30 11:24:55 1999
@@ -25,6 +25,7 @@
X  *
X  */
X 
+#include <linux/config.h>
X #include <linux/module.h>
X #include <linux/kernel.h>
X #include <linux/sched.h>
diff -u --recursive --new-file v2.3.8/linux/drivers/usb/usb_scsi.h linux/drivers/usb/usb_scsi.h
--- v2.3.8/linux/drivers/usb/usb_scsi.h	Mon Jun  7 20:04:01 1999
+++ linux/drivers/usb/usb_scsi.h	Wed Jun 30 11:24:55 1999
@@ -11,6 +11,8 @@
X  *
X  */
X 
+#include <linux/config.h>
+
X #define USB_SCSI "usbscsi: "
X 
X extern int usbscsi_debug;
diff -u --recursive --new-file v2.3.8/linux/drivers/video/Makefile linux/drivers/video/Makefile
--- v2.3.8/linux/drivers/video/Makefile	Thu May 13 23:48:20 1999
+++ linux/drivers/video/Makefile	Fri Jun 25 17:37:52 1999
@@ -498,6 +498,16 @@
X   endif
X endif
X 
+# Newport Text Console
+
+ifeq ($(CONFIG_SGI_NEWPORT_CONSOLE),y)
+L_OBJS += newport_con.o vga_font.o
+else
+  ifeq ($(CONFIG_SGI_NEWPORT_CONSOLE),m)
+  M_OBJS += newport_con.o vga_font.o
+  endif
+endif
+
X include $(TOPDIR)/Rules.make
X 
X promcon_tbl.c: prom.uni ../char/conmakehash
diff -u --recursive --new-file v2.3.8/linux/drivers/video/g364fb.c linux/drivers/video/g364fb.c
--- v2.3.8/linux/drivers/video/g364fb.c	Thu Oct  1 10:02:21 1998
+++ linux/drivers/video/g364fb.c	Fri Jun 25 17:37:52 1999
@@ -144,7 +144,7 @@
X      case CM_MOVE:
X      case CM_DRAW:
X 	*(unsigned int *) CTLA_REG &= ~CURS_TOGGLE;
-	*(unsigned int *) CURS_POS_REG = ((x * p->fontwidth) << 12) | ((y * p->fontheight)-p->var.yoffset);
+	*(unsigned int *) CURS_POS_REG = ((x * fontwidth(p)) << 12) | ((y * fontheight(p))-p->var.yoffset);
X 	break;
X     }
X }
@@ -485,7 +485,7 @@
X     if (regno > 255)
X 	return 1;
X 
-    red >> = 8;
+    red >>= 8;
X     green >>= 8;
X     blue >>=8;
X     palette[regno].red = red;
diff -u --recursive --new-file v2.3.8/linux/drivers/video/newport_con.c linux/drivers/video/newport_con.c
--- v2.3.8/linux/drivers/video/newport_con.c	Thu Feb 25 10:02:12 1999
+++ linux/drivers/video/newport_con.c	Fri Jun 25 17:37:52 1999
@@ -1,8 +1,9 @@
-/* $Id: newport_con.c,v 1.3 1998/09/01 21:43:18 tsbogend Exp $
+/* $Id: newport_con.c,v 1.13 1999/04/11 10:37:08 ulfc Exp $
X  *
X  * newport_con.c: Abscon for newport hardware
X  * 
X  * (C) 1998 Thomas Bogendoerfer (tsbo...@alpha.franken.de)
+ * (C) 1999 Ulf Carlsson (ul...@bun.falkenberg.se)
X  * 
X  * This driver is based on sgicons.c and cons_newport.
X  * 
@@ -19,19 +20,27 @@
X #include <linux/console_struct.h>
X #include <linux/vt_kern.h>
X #include <linux/mm.h>
+#include <linux/module.h>
X 
X #include <asm/uaccess.h>
X #include <asm/system.h>
X #include <asm/page.h>
X #include <asm/pgtable.h>
X #include <asm/newport.h>
+#define INCLUDE_LINUX_LOGO_DATA
+#include <asm/linux_logo.h>
X 
-struct newport_regs *npregs;
-int newport_num_lines;
-int newport_num_columns;
-int topscan;
+#define LOGO_W		80
+#define LOGO_H		80
X 
X extern unsigned char vga_font[];
+extern struct newport_regs *npregs;
+
+static int logo_active;
+static int topscan;
+static int xcurs_correction = 29;
+static int newport_xsize;
+static int newport_ysize;
X 
X #define BMASK(c) (c << 24)
X 
@@ -49,7 +58,8 @@
X #define TESTVAL 0xdeadbeef
X #define XSTI_TO_FXSTART(val) (((val) & 0xffff) << 11)
X 
-static inline void newport_render_background(int xpos, int ypos, int ci)
+static inline void newport_render_background(int xstart, int ystart,
+					     int xend, int yend, int ci)
X {
X     newport_wait();
X     npregs->set.wrmask = 0xffffffff;
@@ -57,8 +67,8 @@
X 			     NPORT_DMODE0_DOSETUP | NPORT_DMODE0_STOPX |
X 			     NPORT_DMODE0_STOPY);
X     npregs->set.colori = ci;
-    npregs->set.xystarti = (xpos << 16) | ((ypos + topscan) & 0x3ff);
-    npregs->go.xyendi = ((xpos + 7) << 16) | ((ypos + topscan + 15) & 0x3ff);
+    npregs->set.xystarti = (xstart << 16) | ((ystart + topscan) & 0x3ff);
+    npregs->go.xyendi = ((xend + 7) << 16) | ((yend + topscan + 15) & 0x3ff);
X }
X 
X static inline void newport_init_cmap(void)
@@ -75,23 +85,51 @@
X     }
X }
X 
-static inline void newport_clear_screen(int xstart, int ystart, int xend, int yend)
+static inline void newport_show_logo(void)
X {
+    unsigned long i;
+
+    for(i = 0; i < LINUX_LOGO_COLORS; i++) {
+	newport_bfwait();
+	newport_cmap_setaddr(npregs, i + 0x20);
+	newport_cmap_setrgb(npregs,
+			    linux_logo_red[i],
+			    linux_logo_green[i],
+			    linux_logo_blue[i]);
+    }
+
+    newport_wait();
+    npregs->set.drawmode0 = (NPORT_DMODE0_DRAW | NPORT_DMODE0_BLOCK |
+			     NPORT_DMODE0_CHOST);
+    
+    npregs->set.xystarti = ((newport_xsize - LOGO_W) << 16) | (0);
+    npregs->set.xyendi = ((newport_xsize - 1) << 16);
+    newport_wait();
+
+    for (i = 0; i < LOGO_W * LOGO_H; i++)
+	npregs->go.hostrw0 = linux_logo[i] << 24;
+}
+
+static inline void newport_clear_screen(int xstart, int ystart, int xend,
+					int yend, int ci) {
+    if (logo_active)
+	return;
+
X     newport_wait();
X     npregs->set.wrmask = 0xffffffff;
X     npregs->set.drawmode0 = (NPORT_DMODE0_DRAW | NPORT_DMODE0_BLOCK |
X 			     NPORT_DMODE0_DOSETUP | NPORT_DMODE0_STOPX |
X 			     NPORT_DMODE0_STOPY);
-    npregs->set.colori = 0;
+    npregs->set.colori = ci;
X     npregs->set.xystarti = (xstart << 16) | ystart;
X     npregs->go.xyendi = (xend << 16) | yend;
X }
X 
-static inline void newport_clear_lines(int ystart, int yend)
+static inline void newport_clear_lines(int ystart, int yend, int ci)
X {
X     ystart = ((ystart << 4) + topscan) & 0x3ff;
X     yend = ((yend << 4) + topscan + 15) & 0x3ff;    
-    newport_clear_screen (0, ystart, 1279, yend);
+    newport_clear_screen (0, ystart, 1280+63, yend, ci);
X }
X 
X void newport_reset (void)
@@ -116,13 +154,121 @@
X     }
X 
X     newport_init_cmap();
-    npregs->cset.topscan = topscan = 0;
+
+    /* turn off popup plane */
+    npregs->set.dcbmode = (DCB_XMAP0 | R_DCB_XMAP9_PROTOCOL |
+                           XM9_CRS_CONFIG | NPORT_DMODE_W1);
+    npregs->set.dcbdata0.bytes.b3 &= ~XM9_PUPMODE;
+    npregs->set.dcbmode = (DCB_XMAP1 | R_DCB_XMAP9_PROTOCOL |
+                           XM9_CRS_CONFIG | NPORT_DMODE_W1);
+    npregs->set.dcbdata0.bytes.b3 &= ~XM9_PUPMODE;
+    
+    topscan = 0;
+    npregs->cset.topscan = 0x3ff;
X     npregs->cset.xywin = (4096 << 16) | 4096;
+
X     /* Clear the screen. */
-    newport_clear_screen(0,0,1280+63,1024);
+    newport_clear_screen(0,0,1280+63,1024,0);
X }
X 
+/*
+ * calculate the actual screen size by reading
+ * the video timing out of the VC2
+ */
+void newport_get_screensize(void)
+{
+    int i,cols;
+    unsigned short ventry,treg;
+    unsigned short linetable[128]; /* should be enough */
+
+    ventry = newport_vc2_get (npregs, VC2_IREG_VENTRY);
+    newport_vc2_set(npregs, VC2_IREG_RADDR, ventry);
+    npregs->set.dcbmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_RAM |
+			   NPORT_DMODE_W2 | VC2_PROTOCOL);
+    for(i = 0; i < 128; i++) {
+	newport_bfwait();
+	linetable[i] = npregs->set.dcbdata0.hwords.s1;
+    }
+
+    newport_xsize = newport_ysize = 0;
+    for (i = 0; linetable[i+1] && (i < sizeof(linetable)); i+=2) {
+	cols = 0;
+        newport_vc2_set(npregs, VC2_IREG_RADDR, linetable[i]);
+        npregs->set.dcbmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_RAM |
+			       NPORT_DMODE_W2 | VC2_PROTOCOL);
+	do {
+	    newport_bfwait();
+	    treg = npregs->set.dcbdata0.hwords.s1;
+	    if ((treg & 1) == 0)
+		cols += (treg >> 7) & 0xfe;
+	    if ((treg & 0x80) == 0) {
+		newport_bfwait();
+		treg = npregs->set.dcbdata0.hwords.s1;
+	    } 
+	} while ((treg & 0x8000) == 0);
+	if (cols) {
+	    if (cols > newport_xsize)
+		newport_xsize = cols;
+	    newport_ysize += linetable[i+1];
+	}
+    }
+    printk ("NG1: Screensize %dx%d\n",newport_xsize,newport_ysize);
+}
+
+static void newport_get_revisions(void)
+{
+    unsigned int tmp;
+    unsigned int board_rev;
+    unsigned int rex3_rev;
+    unsigned int vc2_rev;
+    unsigned int cmap_rev;
+    unsigned int xmap9_rev;
+    unsigned int bt445_rev;
+    unsigned int bitplanes;
+
+    rex3_rev = npregs->cset.stat & NPORT_STAT_VERS;
+
+    npregs->set.dcbmode = (DCB_CMAP0 | NCMAP_PROTOCOL |
+                           NCMAP_REGADDR_RREG | NPORT_DMODE_W1);
+    tmp = npregs->set.dcbdata0.bytes.b3;
+    cmap_rev = tmp & 7;
+    board_rev = (tmp >> 4) & 7;
+    bitplanes = ((board_rev > 1) && (tmp & 0x80)) ? 8 : 24; 
+
+    npregs->set.dcbmode = (DCB_CMAP1 | NCMAP_PROTOCOL |
+                           NCMAP_REGADDR_RREG | NPORT_DMODE_W1);
+    tmp = npregs->set.dcbdata0.bytes.b3;
+    if ((tmp & 7) < cmap_rev)
+	cmap_rev = (tmp & 7);
+
+    vc2_rev = (newport_vc2_get(npregs, VC2_IREG_CONFIG) >> 5) & 7;
+
+    npregs->set.dcbmode = (DCB_XMAP0 | R_DCB_XMAP9_PROTOCOL |
+                           XM9_CRS_REVISION | NPORT_DMODE_W1);
+    xmap9_rev = npregs->set.dcbdata0.bytes.b3 & 7;
+
+    npregs->set.dcbmode = (DCB_BT445 | BT445_PROTOCOL |
+                           BT445_CSR_ADDR_REG | NPORT_DMODE_W1);
+    npregs->set.dcbdata0.bytes.b3 = BT445_REVISION_REG;
+    npregs->set.dcbmode = (DCB_BT445 | BT445_PROTOCOL |
+                           BT445_CSR_REVISION | NPORT_DMODE_W1);
+    bt445_rev = (npregs->set.dcbdata0.bytes.b3 >> 4) - 0x0a;
+
+#define L(a)     (char)('A'+(a))
+    printk ("NG1: Revision %d, %d bitplanes, REX3 revision %c, VC2 revision %c, xmap9 revision %c, cmap revision %c, bt445 revision %c\n",
+	    board_rev,bitplanes,L(rex3_rev),L(vc2_rev), L(xmap9_rev),
+	    L(cmap_rev ? (cmap_rev+1):0),L(bt445_rev));
+#undef L
+
+    if (board_rev == 3) /* I don't know all affected revisions */
+	xcurs_correction = 21;
+}
+
+#ifdef MODULE
+static const char *newport_startup(void)
+#else
X __initfunc(static const char *newport_startup(void))
+#endif
X {
X     struct newport_regs *p;
X 
@@ -140,18 +286,18 @@
X     }
X 
X     newport_reset ();
+    newport_get_revisions();
+    newport_get_screensize();
X 
X     // gfx_init (display_desc);
-    newport_num_lines = ORIG_VIDEO_LINES;
-    newport_num_columns = ORIG_VIDEO_COLS;
X     
X     return "SGI Newport";
X }
X 
X static void newport_init(struct vc_data *vc, int init)
X {
-    vc->vc_cols = newport_num_columns;
-    vc->vc_rows = newport_num_lines;
+    vc->vc_cols = newport_xsize / 8;
+    vc->vc_rows = newport_ysize / 16;
X     vc->vc_can_do_color = 1;
X }
X 
@@ -160,12 +306,18 @@
X     int xend = ((sx + width) << 3) - 1;
X     int ystart = ((sy << 4) + topscan) & 0x3ff;
X     int yend = (((sy + height) << 4) + topscan - 1) & 0x3ff;
+
+    if (logo_active)
+	return;
X     
X     if (ystart < yend) {
-	newport_clear_screen(sx << 3, ystart, xend, yend);
+	newport_clear_screen(sx << 3, ystart, xend, yend,
+			     (vc->vc_color & 0xf0) >> 4);
X     } else {
-	newport_clear_screen(sx << 3, ystart, xend, 1023);
-	newport_clear_screen(sx << 3, 0, xend, yend);
+	newport_clear_screen(sx << 3, ystart, xend, 1023,
+			     (vc->vc_color & 0xf0) >> 4);
+	newport_clear_screen(sx << 3, 0, xend, yend,
+			     (vc->vc_color & 0xf0) >> 4);
X     }
X }
X 
@@ -178,7 +330,7 @@
X     xpos <<= 3;
X     ypos <<= 4;
X 
-    newport_render_background(xpos, ypos, (charattr & 0xf0) >> 4);
+    newport_render_background(xpos, ypos, xpos, ypos, (charattr & 0xf0) >> 4);
X     
X     /* Set the color and drawing mode. */
X     newport_wait();
@@ -196,11 +348,43 @@
X     RENDER(npregs, p);
X }
X 
-static void newport_putcs(struct vc_data *vc, const unsigned short *s, int count,
-			  int ypos, int xpos)
+static void newport_putcs(struct vc_data *vc, const unsigned short *s,
+			  int count, int ypos, int xpos)
X {
-    while (count--)
-	newport_putc (vc, scr_readw(s++), ypos, xpos++);
+    int i;
+    int charattr;
+    unsigned char *p; 
+
+    charattr = (*s >> 8) & 0xff;
+
+    xpos <<= 3;
+    ypos <<= 4;
+
+    if (!logo_active)
+	/* Clear the area behing the string */
+	newport_render_background(xpos, ypos, xpos + ((count-1) << 3), ypos,
+				  (charattr & 0xf0) >> 4);
+
+    newport_wait();
+
+    /* Set the color and drawing mode. */
+    npregs->set.colori = charattr & 0xf;
+    npregs->set.drawmode0 = (NPORT_DMODE0_DRAW | NPORT_DMODE0_BLOCK |
+			     NPORT_DMODE0_STOPX | NPORT_DMODE0_ZPENAB |
+			     NPORT_DMODE0_L32);
+    
+    for (i = 0; i < count; i++, xpos += 8) {
+	p = &vga_font[(s[i] & 0xff) << 4];
+
+	newport_wait();
+
+	/* Set coordinates for bitmap operation. */
+	npregs->set.xystarti = (xpos << 16) | ((ypos + topscan) & 0x3ff);
+	npregs->set.xyendi = ((xpos + 7) << 16);
+
+	/* Go, baby, go... */
+	RENDER(npregs, p);
+    }
X }
X 
X static void newport_cursor(struct vc_data *vc, int mode)
@@ -220,7 +404,7 @@
X 	newport_vc2_set(npregs, VC2_IREG_CONTROL, (treg | VC2_CTRL_ECDISP));
X 	xcurs = (vc->vc_pos - vc->vc_visible_origin) / 2;
X 	ycurs = ((xcurs / vc->vc_cols) << 4) + 31;
-	xcurs = ((xcurs % vc->vc_cols) << 3) + 21;
+	xcurs = ((xcurs % vc->vc_cols) << 3) + xcurs_correction;
X 	newport_vc2_set(npregs, VC2_IREG_CURSX, xcurs);
X 	newport_vc2_set(npregs, VC2_IREG_CURSY, ycurs);
X     }
@@ -228,7 +412,17 @@
X 
X static int newport_switch(struct vc_data *vc)
X {
-    npregs->cset.topscan = topscan = 0;
+    static int logo_drawn = 0;
+
+    topscan = 0;
+    npregs->cset.topscan = 0x3ff;
+
+    if (!logo_drawn) {
+	newport_show_logo();
+	logo_drawn = 1;
+	logo_active = 1;
+    }
+
X     return 1;
X }
X 
@@ -270,14 +464,18 @@
X     unsigned short *s, *d;
X     unsigned short chattr;
X 
+    logo_active = 0;	/* it's time to disable the logo now.. */
+
X     if (t == 0 && b == vc->vc_rows) {
X 	if (dir == SM_UP) {
-	    npregs->cset.topscan = topscan = (topscan + (lines << 4)) & 0x3ff;
-	    newport_clear_lines (vc->vc_rows-lines,vc->vc_rows-1);		
+	    topscan = (topscan + (lines << 4)) & 0x3ff;
+	    newport_clear_lines (vc->vc_rows-lines,vc->vc_rows-1,
+				 (vc->vc_color & 0xf0) >> 4);
X 	} else {
-	    npregs->cset.topscan = topscan = (topscan + (-lines << 4)) & 0x3ff;
-	    newport_clear_lines (0,lines-1);
+	    topscan = (topscan + (-lines << 4)) & 0x3ff;
+	    newport_clear_lines (0,lines-1, (vc->vc_color & 0xf0) >> 4);
X 	}
+	npregs->cset.topscan = (topscan - 1) & 0x3ff;
X 	return 0;
X     }
X     
@@ -392,3 +590,23 @@
X     NULL, /* newport_build_attr */
X     NULL  /* newport_invert_region */
X };
+
+#ifdef MODULE
+
+int init_module(void) {
+    if (!newport_startup()) 
+       printk("Error loading SGI Newport Console driver\n");
+    else 
+       printk("Loading SGI Newport Console Driver\n");
+
+    take_over_console(&newport_con,0,MAX_NR_CONSOLES-1,1);
+
+    return 0;
+}
+
+int cleanup_module(void) {
+    printk("Unloading SGI Newport Console Driver\n");
+    return 0;
+}
+
+#endif
diff -u --recursive --new-file v2.3.8/linux/drivers/video/sbusfb.c linux/drivers/video/sbusfb.c
--- v2.3.8/linux/drivers/video/sbusfb.c	Thu Apr 22 19:30:08 1999
+++ linux/drivers/video/sbusfb.c	Tue Jun 29 09:22:08 1999
@@ -364,9 +364,29 @@
X      */
X 
X static int sbusfb_set_var(struct fb_var_screeninfo *var, int con,
-			struct fb_info *info)
+			  struct fb_info *info)
X {
-	return -EINVAL;
+       struct display *display;
+       int activate = var->activate;
+
+       if(con >= 0)
+               display = &fb_display[con];
+       else
+               display = info->disp;
+
+       /* simple check for equality until fully implemented -E */
+       if ((activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW) {
+               if (display->var.xres != var->xres ||
+                       display->var.yres != var->yres ||
+                       display->var.xres_virtual != var->xres_virtual ||
+                       display->var.yres_virtual != var->yres_virtual ||
+                       display->var.bits_per_pixel != var->bits_per_pixel ||
+                       display->var.accel_flags != var->accel_flags) {
+                       return -EINVAL;
+               }
+       }
+       return 0;
+
X }
X 
X     /*
diff -u --recursive --new-file v2.3.8/linux/drivers/video/vga_font.c linux/drivers/video/vga_font.c
--- v2.3.8/linux/drivers/video/vga_font.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/video/vga_font.c	Fri Jun 25 17:37:52 1999
@@ -0,0 +1,352 @@
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/modversions.h>
+
+
+#define cmapsz 8192
+
+unsigned char vga_font[cmapsz] = {
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x81, 0xa5, 0x81, 0x81, 0xbd, 
+0x99, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xff, 
+0xdb, 0xff, 0xff, 0xc3, 0xe7, 0xff, 0xff, 0x7e, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x6c, 0xfe, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x10, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x7c, 0xfe, 
+0x7c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 
+0x3c, 0x3c, 0xe7, 0xe7, 0xe7, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x7e, 0x18, 0x18, 0x3c, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 
+0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 
+0xff, 0xff, 0xe7, 0xc3, 0xc3, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x42, 0x42, 0x66, 0x3c, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc3, 0x99, 0xbd, 
+0xbd, 0x99, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x1e, 0x0e, 
+0x1a, 0x32, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18, 0x18, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x33, 0x3f, 0x30, 0x30, 0x30, 
+0x30, 0x70, 0xf0, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x63, 
+0x7f, 0x63, 0x63, 0x63, 0x63, 0x67, 0xe7, 0xe6, 0xc0, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x18, 0x18, 0xdb, 0x3c, 0xe7, 0x3c, 0xdb, 0x18, 0x18, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfe, 0xf8, 
+0xf0, 0xe0, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x0e, 
+0x1e, 0x3e, 0xfe, 0x3e, 0x1e, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 
+0x66, 0x00, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xdb, 
+0xdb, 0xdb, 0x7b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x7c, 0xc6, 0x60, 0x38, 0x6c, 0xc6, 0xc6, 0x6c, 0x38, 0x0c, 0xc6, 
+0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0xfe, 0xfe, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 
+0x7e, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 
+0x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x18, 0x0c, 0xfe, 0x0c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x60, 0xfe, 0x60, 0x30, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 
+0xc0, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x24, 0x66, 0xff, 0x66, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x38, 0x7c, 0x7c, 0xfe, 0xfe, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0x7c, 0x7c, 
+0x38, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x18, 0x3c, 0x3c, 0x3c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x24, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 
+0x6c, 0xfe, 0x6c, 0x6c, 0x6c, 0xfe, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, 
+0x18, 0x18, 0x7c, 0xc6, 0xc2, 0xc0, 0x7c, 0x06, 0x06, 0x86, 0xc6, 0x7c, 
+0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc2, 0xc6, 0x0c, 0x18, 
+0x30, 0x60, 0xc6, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x6c, 
+0x6c, 0x38, 0x76, 0xdc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x30, 0x30, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30, 
+0x30, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x18, 
+0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3c, 0xff, 0x3c, 0x66, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 
SHAR_EOF
true || echo 'restore of patch-2.3.9 failed'
fi
echo 'End of  part 18'
echo 'File patch-2.3.9 is continued in part 19'
echo 19 > _shar_seq_.tmp
exit 0
#!/bin/sh
# this is part 19 of a 26 - part archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file patch-2.3.9 continued
if test ! -r _shar_seq_.tmp; then
        echo 'Please unpack part 1 first!'
        exit 1
fi
(read Scheck
if test "$Scheck" != 19; then
        echo Please unpack part "$Scheck" next!
        exit 1
 else
        exit 0
 fi
) < _shar_seq_.tmp || exit 1
if test ! -f _shar_wnt_.tmp; then
echo 'x - still skipping patch-2.3.9'
else
echo 'x - continuing with patch-2.3.9'
sed 's/^X//' << 'SHAR_EOF' >> 'patch-2.3.9' &&
+0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x02, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xce, 0xde, 0xf6, 0xe6, 0xc6, 0xc6, 0x7c, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x38, 0x78, 0x18, 0x18, 0x18, 
+0x18, 0x18, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 
+0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x7c, 0xc6, 0x06, 0x06, 0x3c, 0x06, 0x06, 0x06, 0xc6, 0x7c, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x1c, 0x3c, 0x6c, 0xcc, 0xfe, 
+0x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc0, 
+0xc0, 0xc0, 0xfc, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x38, 0x60, 0xc0, 0xc0, 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc6, 0x06, 0x06, 0x0c, 0x18, 
+0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 
+0xc6, 0xc6, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0x06, 0x0c, 0x78, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 
+0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x06, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 
+0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 
+0x30, 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x0c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xde, 0xde, 
+0xde, 0xdc, 0xc0, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 
+0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x66, 0x66, 0xfc, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 
+0xc0, 0xc2, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x6c, 
+0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x62, 0x66, 0xfe, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 
+0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 
+0xc2, 0xc0, 0xc0, 0xde, 0xc6, 0xc6, 0x66, 0x3a, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 
+0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x0c, 
+0x0c, 0x0c, 0x0c, 0x0c, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0xe6, 0x66, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0x66, 0xe6, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x60, 0x60, 0x60, 0x60, 0x60, 
+0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xe7, 
+0xff, 0xff, 0xdb, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0xc6, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 
+0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x66, 
+0x66, 0x66, 0x7c, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0xde, 0x7c, 
+0x0c, 0x0e, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x6c, 
+0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 
+0xc6, 0x60, 0x38, 0x0c, 0x06, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0xff, 0xdb, 0x99, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 
+0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xc3, 
+0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xdb, 0xdb, 0xff, 0x66, 0x66, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xc3, 0x66, 0x3c, 0x18, 0x18, 
+0x3c, 0x66, 0xc3, 0xc3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xc3, 
+0xc3, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0xff, 0xc3, 0x86, 0x0c, 0x18, 0x30, 0x60, 0xc1, 0xc3, 0xff, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30, 
+0x30, 0x30, 0x30, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 
+0xc0, 0xe0, 0x70, 0x38, 0x1c, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c, 
+0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 
+0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x0c, 0x7c, 
+0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x60, 
+0x60, 0x78, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x0c, 0x0c, 0x3c, 0x6c, 0xcc, 
+0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x38, 0x6c, 0x64, 0x60, 0xf0, 0x60, 0x60, 0x60, 0x60, 0xf0, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc, 
+0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xcc, 0x78, 0x00, 0x00, 0x00, 0xe0, 0x60, 
+0x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x18, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x00, 0x0e, 0x06, 0x06, 
+0x06, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0xe0, 0x60, 
+0x60, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe6, 0xff, 0xdb, 
+0xdb, 0xdb, 0xdb, 0xdb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 
+0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0x0c, 0x1e, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x76, 0x66, 0x60, 0x60, 0x60, 0xf0, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x60, 
+0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x30, 
+0x30, 0xfc, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xc3, 0xc3, 
+0xc3, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0xc3, 0xc3, 0xc3, 0xdb, 0xdb, 0xff, 0x66, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0xc3, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 
+0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0xfe, 0xcc, 0x18, 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x0e, 0x18, 0x18, 0x18, 0x70, 0x18, 0x18, 0x18, 0x18, 0x0e, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 
+0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x18, 
+0x18, 0x18, 0x0e, 0x18, 0x18, 0x18, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 
+0xc6, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 
+0xc2, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x0c, 0x06, 0x7c, 0x00, 0x00, 
+0x00, 0x00, 0xcc, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x30, 0x00, 0x7c, 0xc6, 0xfe, 
+0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 
+0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0xcc, 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x00, 0x78, 0x0c, 0x7c, 
+0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x6c, 0x38, 
+0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x60, 0x60, 0x66, 0x3c, 0x0c, 0x06, 
+0x3c, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xfe, 
+0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x00, 
+0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x60, 0x30, 0x18, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, 0x38, 0x18, 0x18, 
+0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x66, 
+0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x60, 0x30, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 
+0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x38, 0x6c, 0x38, 0x00, 
+0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, 
+0x18, 0x30, 0x60, 0x00, 0xfe, 0x66, 0x60, 0x7c, 0x60, 0x60, 0x66, 0xfe, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6e, 0x3b, 0x1b, 
+0x7e, 0xd8, 0xdc, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x6c, 
+0xcc, 0xcc, 0xfe, 0xcc, 0xcc, 0xcc, 0xcc, 0xce, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 
+0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 
+0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x30, 0x78, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x00, 0xcc, 0xcc, 0xcc, 
+0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x00, 
+0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0x78, 0x00, 
+0x00, 0xc6, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 
+0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 
+0xc3, 0xc0, 0xc0, 0xc0, 0xc3, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x38, 0x6c, 0x64, 0x60, 0xf0, 0x60, 0x60, 0x60, 0x60, 0xe6, 0xfc, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0x66, 0x3c, 0x18, 0xff, 0x18, 
+0xff, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x66, 0x66, 
+0x7c, 0x62, 0x66, 0x6f, 0x66, 0x66, 0x66, 0xf3, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x0e, 0x1b, 0x18, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 
+0xd8, 0x70, 0x00, 0x00, 0x00, 0x18, 0x30, 0x60, 0x00, 0x78, 0x0c, 0x7c, 
+0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x30, 
+0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x18, 0x30, 0x60, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x30, 0x60, 0x00, 0xcc, 0xcc, 0xcc, 
+0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 
+0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 
+0x76, 0xdc, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x6c, 0x6c, 0x3e, 0x00, 0x7e, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x6c, 0x6c, 
+0x38, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x30, 0x30, 0x00, 0x30, 0x30, 0x60, 0xc0, 0xc6, 0xc6, 0x7c, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc0, 
+0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0xfe, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30, 0x60, 0xce, 0x9b, 0x06, 
+0x0c, 0x1f, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30, 
+0x66, 0xce, 0x96, 0x3e, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 
+0x00, 0x18, 0x18, 0x18, 0x3c, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x6c, 0xd8, 0x6c, 0x36, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, 0x6c, 0x36, 
+0x6c, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x44, 0x11, 0x44, 
+0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 
+0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 
+0x55, 0xaa, 0x55, 0xaa, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 
+0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0x18, 0x18, 0x18, 0x18, 
+0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 
+0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18, 
+0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0xf8, 
+0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x36, 0x36, 0x36, 0x36, 
+0x36, 0x36, 0x36, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x36, 0x36, 0x36, 0x36, 
+0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0xf8, 
+0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x36, 0x36, 0x36, 0x36, 
+0x36, 0xf6, 0x06, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 
+0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 
+0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, 0xf6, 
+0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 
+0x36, 0xf6, 0x06, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xfe, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0xf8, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 
+0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 
+0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, 
+0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 
+0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 
+0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, 
+0x18, 0x18, 0x18, 0x18, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 
+0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 
+0x36, 0x37, 0x30, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36, 
+0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xf7, 0x00, 0xff, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0xff, 0x00, 0xf7, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 
+0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36, 
+0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x36, 0x36, 0x36, 
+0x36, 0xf7, 0x00, 0xf7, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 
+0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xff, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0xff, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x36, 0x36, 0x36, 0x36, 
+0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x3f, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 
+0x18, 0x1f, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, 
+0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 
+0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 
+0x36, 0x36, 0x36, 0xff, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 
+0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 
+0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 
+0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
+0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 
+0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xf0, 0xf0, 0xf0, 
+0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 
+0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 
+0x0f, 0x0f, 0x0f, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x76, 0xdc, 0xd8, 0xd8, 0xd8, 0xdc, 0x76, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0xd8, 0xcc, 0xc6, 0xc6, 0xc6, 0xcc, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc6, 0xc6, 0xc0, 0xc0, 0xc0, 
+0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0xfe, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0xfe, 0xc6, 0x60, 0x30, 0x18, 0x30, 0x60, 0xc6, 0xfe, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xd8, 0xd8, 
+0xd8, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xc0, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x18, 0x3c, 0x66, 0x66, 
+0x66, 0x3c, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 
+0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0x6c, 0x6c, 0x6c, 0x6c, 0xee, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x30, 0x18, 0x0c, 0x3e, 0x66, 
+0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x7e, 0xdb, 0xdb, 0xdb, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x03, 0x06, 0x7e, 0xdb, 0xdb, 0xf3, 0x7e, 0x60, 0xc0, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x30, 0x60, 0x60, 0x7c, 0x60, 
+0x60, 0x60, 0x30, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 
+0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 
+0x18, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 
+0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x00, 0x7e, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x1b, 0x1b, 0x1b, 0x18, 0x18, 
+0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 
+0x18, 0x18, 0x18, 0x18, 0xd8, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x7e, 0x00, 0x18, 0x18, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x00, 
+0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x6c, 0x6c, 
+0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x0c, 0x0c, 
+0x0c, 0x0c, 0x0c, 0xec, 0x6c, 0x6c, 0x3c, 0x1c, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0xd8, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xd8, 0x30, 0x60, 0xc8, 0xf8, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+};
+
diff -u --recursive --new-file v2.3.8/linux/drivers/zorro/proc.c linux/drivers/zorro/proc.c
--- v2.3.8/linux/drivers/zorro/proc.c	Mon Aug 24 13:14:10 1998
+++ linux/drivers/zorro/proc.c	Sun Jun 27 10:10:41 1999
@@ -89,11 +89,14 @@
X 	NULL,			/* rename */
X 	NULL,			/* readlink */
X 	NULL,			/* follow_link */
+	NULL,			/* get_block */
X 	NULL,			/* readpage */
X 	NULL,			/* writepage */
-	NULL,			/* bmap */
+	NULL,			/* flushpage */
X 	NULL,			/* truncate */
-	NULL			/* permission */
+	NULL,			/* permission */
+	NULL,			/* smap */
+	NULL			/* revalidate */
X };
X 
X int
diff -u --recursive --new-file v2.3.8/linux/fs/Makefile linux/fs/Makefile
--- v2.3.8/linux/fs/Makefile	Thu May 13 23:50:15 1999
+++ linux/fs/Makefile	Fri Jun 25 01:05:12 1999
@@ -263,14 +263,6 @@
X   endif
X endif
X 
-ifeq ($(CONFIG_BINFMT_JAVA),y)
-BINFMTS += binfmt_java.o
-else
-  ifeq ($(CONFIG_BINFMT_JAVA),m)
-  M_OBJS += binfmt_java.o
-  endif
-endif
-
X ifeq ($(CONFIG_BINFMT_EM86),y)
X BINFMTS += binfmt_em86.o
X else
diff -u --recursive --new-file v2.3.8/linux/fs/adfs/dir.c linux/fs/adfs/dir.c
--- v2.3.8/linux/fs/adfs/dir.c	Thu May 13 10:53:59 1999
+++ linux/fs/adfs/dir.c	Sun Jun 27 10:10:41 1999
@@ -51,12 +51,14 @@
X 	NULL,			/* rename */
X 	NULL,			/* read link */
X NULL, /* follow link */
+	NULL,			/* get_block */
X 	NULL,			/* read page */
X NULL, /* write page */
-	NULL,			/* bmap */
+ NULL, /* flush page */
X 	NULL,			/* truncate */
X 	NULL,			/* permission */
- NULL /* smap */
+	NULL,			/* smap */
+	NULL			/* revalidate */
X };
X 
X unsigned int adfs_val (unsigned char *p, int len)
diff -u --recursive --new-file v2.3.8/linux/fs/adfs/file.c linux/fs/adfs/file.c
--- v2.3.8/linux/fs/adfs/file.c	Mon Aug 24 13:02:44 1998
+++ linux/fs/adfs/file.c	Sun Jun 27 10:10:41 1999
@@ -61,10 +61,12 @@
X 	NULL,			/* rename			*/
X 	NULL,			/* readlink			*/
X 	NULL,			/* follow_link			*/
-	generic_readpage,	/* readpage			*/
+	adfs_bmap,		/* get_block			*/
+	block_read_full_page,	/* readpage			*/
X 	NULL,			/* writepage			*/
- adfs_bmap, /* bmap */
+	NULL,			/* flushpage			*/
X 	NULL,			/* truncate			*/
X 	NULL,			/* permission			*/
- NULL /* smap */
+	NULL,			/* smap				*/
+	NULL			/* revalidate			*/
X };
diff -u --recursive --new-file v2.3.8/linux/fs/affs/dir.c linux/fs/affs/dir.c
--- v2.3.8/linux/fs/affs/dir.c	Sat Jun 19 11:45:28 1999
+++ linux/fs/affs/dir.c	Sun Jun 27 10:10:41 1999
@@ -57,9 +57,10 @@
X 	affs_rename,		/* rename */
X 	NULL,			/* readlink */
X 	NULL,			/* follow_link */
+	NULL,			/* get_block */
X 	NULL,			/* readpage */
X 	NULL,			/* writepage */
-	NULL,			/* bmap */
+	NULL,			/* flushpage */
X 	NULL,			/* truncate */
X 	NULL,			/* permissions */
X 	NULL,			/* smap */
diff -u --recursive --new-file v2.3.8/linux/fs/affs/file.c linux/fs/affs/file.c
--- v2.3.8/linux/fs/affs/file.c	Sat Jun 19 11:45:28 1999
+++ linux/fs/affs/file.c	Sun Jun 27 10:10:41 1999
@@ -74,9 +74,10 @@
X 	NULL,			/* rename */
X 	NULL,			/* readlink */
X 	NULL,			/* follow_link */
-	generic_readpage,	/* readpage */
+	affs_bmap,		/* get_block */
+	block_read_full_page,	/* readpage */
X 	NULL,			/* writepage */
- affs_bmap, /* bmap */
+	NULL,			/* flushpage */
X affs_truncate, /* truncate */
X 	NULL,			/* permission */
X 	NULL,			/* smap */
@@ -114,9 +115,10 @@
X 	NULL,			/* rename */
X 	NULL,			/* readlink */
X 	NULL,			/* follow_link */
+	NULL,			/* get_block */
X 	NULL,			/* readpage */
X 	NULL,			/* writepage */
-	NULL,			/* bmap */
+	NULL,			/* flushpage */
X affs_truncate, /* truncate */
X 	NULL,			/* permission */
X 	NULL,			/* smap */
diff -u --recursive --new-file v2.3.8/linux/fs/affs/symlink.c linux/fs/affs/symlink.c
--- v2.3.8/linux/fs/affs/symlink.c	Sat Sep 19 13:39:45 1998
+++ linux/fs/affs/symlink.c	Sun Jun 27 10:10:41 1999
@@ -35,12 +35,14 @@
X 	NULL,			/* rename */
X 	affs_readlink,		/* readlink */
X 	affs_follow_link,	/* follow_link */
+	NULL,			/* get_block */
X 	NULL,			/* readpage */
X 	NULL,			/* writepage */
-	NULL,			/* bmap */
+	NULL,			/* flushpage */
X 	NULL,			/* truncate */
X 	NULL,			/* permission */
- NULL /* smap */
+	NULL,			/* smap */
+	NULL			/* revalidate */
X };
X 
X static int
diff -u --recursive --new-file v2.3.8/linux/fs/autofs/dir.c linux/fs/autofs/dir.c
--- v2.3.8/linux/fs/autofs/dir.c	Sat Jun 19 11:45:28 1999
+++ linux/fs/autofs/dir.c	Sun Jun 27 10:10:41 1999
@@ -73,9 +73,10 @@
X 	NULL,			/* rename */
X 	NULL,			/* readlink */
X 	NULL,			/* follow_link */
+	NULL,			/* get_block */
X 	NULL,			/* readpage */
X 	NULL,			/* writepage */
-	NULL,			/* bmap */
+	NULL,			/* flushpage */
X 	NULL,			/* truncate */
X 	NULL,			/* permission */
X 	NULL,			/* smap */
diff -u --recursive --new-file v2.3.8/linux/fs/autofs/root.c linux/fs/autofs/root.c
--- v2.3.8/linux/fs/autofs/root.c	Sat Jun 19 11:45:29 1999
+++ linux/fs/autofs/root.c	Sun Jun 27 10:10:41 1999
@@ -54,9 +54,10 @@
X         NULL,                   /* rename */
X         NULL,                   /* readlink */
X         NULL,                   /* follow_link */
+        NULL,                   /* get_block */
X         NULL,                   /* readpage */
X         NULL,                   /* writepage */
-        NULL,                   /* bmap */
+        NULL,                   /* flushpage */
X         NULL,                   /* truncate */
X         NULL,			/* permission */
X 	NULL,			/* smap */
diff -u --recursive --new-file v2.3.8/linux/fs/autofs/symlink.c linux/fs/autofs/symlink.c
--- v2.3.8/linux/fs/autofs/symlink.c	Sat Jun 19 11:45:29 1999
+++ linux/fs/autofs/symlink.c	Sun Jun 27 10:10:41 1999
@@ -49,9 +49,10 @@
X 	NULL,			/* rename */
X 	autofs_readlink,	/* readlink */
X 	autofs_follow_link,	/* follow_link */
+	NULL,			/* get_block */
X 	NULL,			/* readpage */
X 	NULL,			/* writepage */
-	NULL,			/* bmap */
+	NULL,			/* flushpage */
X 	NULL,			/* truncate */
X 	NULL,			/* permission */
X 	NULL,			/* smap */
diff -u --recursive --new-file v2.3.8/linux/fs/bad_inode.c linux/fs/bad_inode.c
--- v2.3.8/linux/fs/bad_inode.c	Sat Jun 19 11:45:28 1999
+++ linux/fs/bad_inode.c	Sat Jun 26 12:04:39 1999
@@ -60,7 +60,7 @@
X 	EIO_ERROR,		/* rename */
X 	EIO_ERROR,		/* readlink */
X 	bad_follow_link,	/* follow_link */
-	EIO_ERROR,		/* bmap */
+	EIO_ERROR,		/* get_block */
X 	EIO_ERROR,		/* readpage */
X 	EIO_ERROR,		/* writepage */
X 	EIO_ERROR,		/* flushpage */
diff -u --recursive --new-file v2.3.8/linux/fs/binfmt_aout.c linux/fs/binfmt_aout.c
--- v2.3.8/linux/fs/binfmt_aout.c	Fri Jun 18 08:00:52 1999
+++ linux/fs/binfmt_aout.c	Sat Jun 26 12:04:39 1999
@@ -323,7 +323,7 @@
X 
X 	if (N_MAGIC(ex) == ZMAGIC && ex.a_text &&
X 	    bprm->dentry->d_inode->i_op &&
-	    bprm->dentry->d_inode->i_op->bmap &&
+	    bprm->dentry->d_inode->i_op->get_block &&
X 	    (fd_offset < bprm->dentry->d_inode->i_sb->s_blocksize)) {
X 		printk(KERN_NOTICE "N_TXTOFF < BLOCK_SIZE. Please convert binary.\n");
X 		return -ENOEXEC;
@@ -396,7 +396,7 @@
X 		fd = open_dentry(bprm->dentry, O_RDONLY);
X 		if (fd < 0)
X 			return fd;
-		file = fcheck(fd);
+		file = fget(fd);
X 
X 		if ((fd_offset & ~PAGE_MASK) != 0) {
X 			printk(KERN_WARNING 
@@ -406,6 +406,7 @@
X 		}
X 
X 		if (!file->f_op || !file->f_op->mmap || ((fd_offset & ~PAGE_MASK) != 0)) {
+			fput(file);
X 			sys_close(fd);
X 			do_brk(0, ex.a_text+ex.a_data);
X 			read_exec(bprm->dentry, fd_offset,
@@ -422,6 +423,7 @@
X 			fd_offset);
X 
X 		if (error != N_TXTADDR(ex)) {
+			fput(file);
X 			sys_close(fd);
X 			send_sig(SIGKILL, current, 0);
X 			return error;
@@ -431,6 +433,7 @@
X 				PROT_READ | PROT_WRITE | PROT_EXEC,
X 				MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_EXECUTABLE,
X 				fd_offset + ex.a_text);
+		fput(file);
X 		sys_close(fd);
X 		if (error != N_DATADDR(ex)) {
X 			send_sig(SIGKILL, current, 0);
diff -u --recursive --new-file v2.3.8/linux/fs/binfmt_java.c linux/fs/binfmt_java.c
--- v2.3.8/linux/fs/binfmt_java.c	Wed Jun  2 13:49:58 1999
+++ linux/fs/binfmt_java.c	Wed Dec 31 16:00:00 1969
@@ -1,196 +0,0 @@
-/*
- *  linux/fs/binfmt_java.c
- *
- *  Copyright (C) 1996  Brian A. Lantz
- *  derived from binfmt_script.c
- *
- *  Simplified and modified to support binary java interpreters
- *  by Tom May <ft...@netcom.com>.
- */
-
-#include <linux/module.h>
-#include <linux/string.h>
-#include <linux/stat.h>
-#include <linux/malloc.h>
-#include <linux/binfmts.h>
-#include <linux/init.h>
-
-#define _PATH_JAVA	"/usr/bin/java"
-#define _PATH_APPLET	"/usr/bin/appletviewer"
-
-/*  These paths can be modified with sysctl().  */
-
-char binfmt_java_interpreter[65] = _PATH_JAVA;
-char binfmt_java_appletviewer[65] = _PATH_APPLET;
-
-static int do_load_java(struct linux_binprm *bprm,struct pt_regs *regs)
-{
-	char *i_name;
-	int len;
-	int retval;
-	struct dentry * dentry;
-	unsigned char *ucp = (unsigned char *) bprm->buf;
-
-	if ((ucp[0] != 0xca) || (ucp[1] != 0xfe) || (ucp[2] != 0xba) || (ucp[3] != 0xbe)) 
-		return -ENOEXEC;
-
-	/*
-	 * Fail if we're called recursively, e.g., the Java interpreter
-	 * is a java binary.
-	 */
-
-	if (bprm->java)
-		return -ENOEXEC;
-
-	bprm->java = 1;
-
-	dput(bprm->dentry);
-	bprm->dentry = NULL;
-
-	/*
-	 * Set args: [0] the name of the java interpreter
-	 *           [1] name of java class to execute, which is the
-	 *		 filename without the path and without trailing
-	 *		 ".class".  Note that the interpreter will use
-	 *		 its own way to found the class file (typically using
-	 *		 environment variable CLASSPATH), and may in fact
-	 *		 execute a different file from the one we want.
-	 *
-	 * This is done in reverse order, because of how the
-	 * user environment and arguments are stored.
-	 */
-	remove_arg_zero(bprm);
-	len = strlen (bprm->filename);
-	if (len >= 6 && !strcmp (bprm->filename + len - 6, ".class"))
-		bprm->filename[len - 6] = 0;
-	if ((i_name = strrchr (bprm->filename, '/')) != NULL)
-		i_name++;
-	else
-		i_name = bprm->filename;
-
-	retval = copy_strings_kernel(1, &i_name, bprm); 
-	if (retval < 0) 
-		return retval; 
-	bprm->argc++;
-
-	i_name = binfmt_java_interpreter;
-	retval = copy_strings_kernel(1, &i_name, bprm); 
-	if (retval < 0) 
-		return retval; 
-	bprm->argc++;
-
-	/*
-	 * OK, now restart the process with the interpreter's dentry.
-	 */
-	bprm->filename = binfmt_java_interpreter;
-	dentry = open_namei(binfmt_java_interpreter, 0, 0);
-	retval = PTR_ERR(dentry);
-	if (IS_ERR(dentry))
-		return retval;
-
-	bprm->dentry = dentry;
-	retval = prepare_binprm(bprm);
-	if (retval < 0)
-		return retval;
-
-	return search_binary_handler(bprm,regs);
-}
-
-static int do_load_applet(struct linux_binprm *bprm,struct pt_regs *regs)
-{
-	char *i_name;
-	struct dentry * dentry;
-	int retval;
-
-	if (strncmp (bprm->buf, "<!--applet", 10))
-		return -ENOEXEC;
-
-	dput(bprm->dentry);
-	bprm->dentry = NULL;
-
-	/*
-	 * Set args: [0] the name of the appletviewer
-	 *           [1] filename of html file
-	 *
-	 * This is done in reverse order, because of how the
-	 * user environment and arguments are stored.
-	 */
-	remove_arg_zero(bprm);
-	i_name = bprm->filename;
-	retval = copy_strings_kernel(1, &i_name, bprm);
-	if (retval < 0) return retval; 
-	bprm->argc++;
-
-	i_name = binfmt_java_appletviewer;
-	retval = copy_strings_kernel(1, &i_name, bprm);
-	if (retval < 0) return retval; 
-	bprm->argc++;
-
-	/*
-	 * OK, now restart the process with the interpreter's dentry.
-	 */
-	bprm->filename = binfmt_java_appletviewer;
-	dentry = open_namei(binfmt_java_appletviewer, 0, 0);
-	retval = PTR_ERR(dentry);
-	if (IS_ERR(dentry))
-		return retval;
-
-	bprm->dentry = dentry;
-	retval = prepare_binprm(bprm);
-	if (retval < 0)
-		return retval;
-
-	return search_binary_handler(bprm,regs);
-}
-
-static int load_java(struct linux_binprm *bprm,struct pt_regs *regs)
-{
-	int retval;
-	MOD_INC_USE_COUNT;
-	retval = do_load_java(bprm,regs);
-	MOD_DEC_USE_COUNT;
-	return retval;
-}
-
-static struct linux_binfmt java_format = {
-#ifndef MODULE
-	NULL, 0, load_java, NULL, NULL
-#else
-	NULL, &__this_module, load_java, NULL, NULL
-#endif
-};
-
-static int load_applet(struct linux_binprm *bprm,struct pt_regs *regs)
-{
-	int retval;
-	MOD_INC_USE_COUNT;
-	retval = do_load_applet(bprm,regs);
-	MOD_DEC_USE_COUNT;
-	return retval;
-}
-
-static struct linux_binfmt applet_format = {
-#ifndef MODULE
-	NULL, 0, load_applet, NULL, NULL
-#else
-	NULL, &__this_module, load_applet, NULL, NULL
-#endif
-};
-
-int __init init_java_binfmt(void)
-{
-	register_binfmt(&java_format);
-	return register_binfmt(&applet_format);
-}
-
-#ifdef MODULE
-int init_module(void)
-{
-	return init_java_binfmt();
-}
-
-void cleanup_module( void) {
-	unregister_binfmt(&java_format);
-	unregister_binfmt(&applet_format);
-}
-#endif
diff -u --recursive --new-file v2.3.8/linux/fs/buffer.c linux/fs/buffer.c
--- v2.3.8/linux/fs/buffer.c	Tue Jun 22 14:21:33 1999
+++ linux/fs/buffer.c	Wed Jun 30 10:25:46 1999
@@ -24,6 +24,8 @@
X  * - RMK
X  */
X 
+/* Thread it... -DaveM */
+
X #include <linux/sched.h>
X #include <linux/fs.h>
X #include <linux/malloc.h>
@@ -57,31 +59,39 @@
X #define MAX_UNUSED_BUFFERS NR_RESERVED+20 /* don't ever have more than this 
X 					     number of unused buffer heads */
X 
-/*
- * Hash table mask..
+/* Anti-deadlock ordering:
+ *	lru_list_lock > hash_table_lock > free_list_lock > unused_list_lock
X  */
-static unsigned long bh_hash_mask = 0;
-
-static int grow_buffers(int size);
X 
-static struct buffer_head ** hash_table;
-static struct buffer_head * lru_list[NR_LIST] = {NULL, };
-static struct buffer_head * free_list[NR_SIZES] = {NULL, };
+/*
+ * Hash table gook..
+ */
+static unsigned int bh_hash_mask = 0;
+static unsigned int bh_hash_shift = 0;
+static struct buffer_head **hash_table;
+static rwlock_t hash_table_lock = RW_LOCK_UNLOCKED;
X 
-static kmem_cache_t *bh_cachep;
+static struct buffer_head *lru_list[NR_LIST];
+static spinlock_t lru_list_lock = SPIN_LOCK_UNLOCKED;
+static int nr_buffers_type[NR_LIST] = {0,};
X 
X static struct buffer_head * unused_list = NULL;
-static struct buffer_head * reuse_list = NULL;
+static int nr_unused_buffer_heads = 0;
+static spinlock_t unused_list_lock = SPIN_LOCK_UNLOCKED;
X static DECLARE_WAIT_QUEUE_HEAD(buffer_wait);
X 
-static int nr_buffers = 0;
-static int nr_buffers_type[NR_LIST] = {0,};
-static int nr_buffer_heads = 0;
-static int nr_unused_buffer_heads = 0;
-static int nr_hashed_buffers = 0;
+struct bh_free_head {
+	struct buffer_head *list;
+	spinlock_t lock;
+};
+static struct bh_free_head free_list[NR_SIZES];
+
+static kmem_cache_t *bh_cachep;
+
+static int grow_buffers(int size);
X 
X /* This is used by some architectures to estimate available memory. */
-int buffermem = 0;
+atomic_t buffermem = ATOMIC_INIT(0);
X 
X /* Here is the parameter block for the bdflush process. If you add or
X  * remove any of the parameters, make sure to update kernel/sysctl.c.
@@ -131,7 +141,7 @@
X 	struct task_struct *tsk = current;
X 	DECLARE_WAITQUEUE(wait, tsk);
X 
-	bh->b_count++;
+	atomic_inc(&bh->b_count);
X 	add_wait_queue(&bh->b_wait, &wait);
X repeat:
X 	tsk->state = TASK_UNINTERRUPTIBLE;
@@ -142,7 +152,7 @@
X 	}
X 	tsk->state = TASK_RUNNING;
X 	remove_wait_queue(&bh->b_wait, &wait);
-	bh->b_count--;
+	atomic_dec(&bh->b_count);
X }
X 
X /* Call sync_buffers with wait!=0 to ensure that the call does not
@@ -167,17 +177,19 @@
X 	 */
X 	do {
X 		retry = 0;
-repeat:
+
X 		/* We search all lists as a failsafe mechanism, not because we expect
X 		 * there to be dirty buffers on any of the other lists.
X 		 */
+repeat:
+		spin_lock(&lru_list_lock);
X 		bh = lru_list[BUF_DIRTY];
X 		if (!bh)
X 			goto repeat2;
+
X 		for (i = nr_buffers_type[BUF_DIRTY]*2 ; i-- > 0 ; bh = next) {
-			if (bh->b_list != BUF_DIRTY)
-				goto repeat;
X 			next = bh->b_next_free;
+
X 			if (!lru_list[BUF_DIRTY])
X 				break;
X 			if (dev && bh->b_dev != dev)
@@ -190,7 +202,10 @@
X 					retry = 1;
X 					continue;
X 				}
+				atomic_inc(&bh->b_count);
+				spin_unlock(&lru_list_lock);
X 				wait_on_buffer (bh);
+				atomic_dec(&bh->b_count);
X 				goto repeat;
X 			}
X 
@@ -209,30 +224,24 @@
X 			if (!buffer_dirty(bh) || pass >= 2)
X 				continue;
X 
-			/* Don't bother about locked buffers.
-			 *
-			 * XXX We checked if it was locked above and there is no
-			 * XXX way we could have slept in between. -DaveM
-			 */
-			if (buffer_locked(bh))
-				continue;
-			bh->b_count++;
-			next->b_count++;
+			atomic_inc(&bh->b_count);
X 			bh->b_flushtime = 0;
+			spin_unlock(&lru_list_lock);
X 			ll_rw_block(WRITE, 1, &bh);
-			bh->b_count--;
-			next->b_count--;
+			atomic_dec(&bh->b_count);
X 			retry = 1;
+			goto repeat;
X 		}
X 
X     repeat2:
X 		bh = lru_list[BUF_LOCKED];
-		if (!bh)
+		if (!bh) {
+			spin_unlock(&lru_list_lock);
X 			break;
+		}
X 		for (i = nr_buffers_type[BUF_LOCKED]*2 ; i-- > 0 ; bh = next) {
-			if (bh->b_list != BUF_LOCKED)
-				goto repeat2;
X 			next = bh->b_next_free;
+
X 			if (!lru_list[BUF_LOCKED])
X 				break;
X 			if (dev && bh->b_dev != dev)
@@ -245,10 +254,15 @@
X 					retry = 1;
X 					continue;
X 				}
+				atomic_inc(&bh->b_count);
+				spin_unlock(&lru_list_lock);
X 				wait_on_buffer (bh);
+				spin_lock(&lru_list_lock);
+				atomic_dec(&bh->b_count);
X 				goto repeat2;
X 			}
X 		}
+		spin_unlock(&lru_list_lock);
X 
X 		/* If we are waiting for the sync to succeed, and if any dirty
X 		 * blocks were written, then repeat; on the second pass, only
@@ -282,17 +296,19 @@
X int fsync_dev(kdev_t dev)
X {
X 	sync_buffers(dev, 0);
+
+	lock_kernel();
X 	sync_supers(dev);
X 	sync_inodes(dev);
X 	DQUOT_SYNC(dev);
+	unlock_kernel();
+
X 	return sync_buffers(dev, 1);
X }
X 
X asmlinkage int sys_sync(void)
X {
-	lock_kernel();
X 	fsync_dev(0);
-	unlock_kernel();
X 	return 0;
X }
X 
@@ -396,19 +412,28 @@
X 
X void invalidate_buffers(kdev_t dev)
X {
-	int i;
X 	int nlist;
-	struct buffer_head * bh;
X 
+	spin_lock(&lru_list_lock);
X 	for(nlist = 0; nlist < NR_LIST; nlist++) {
+		struct buffer_head * bh;
+		int i;
+	retry:
X 		bh = lru_list[nlist];
+		if (!bh)
+			continue;
X 		for (i = nr_buffers_type[nlist]*2 ; --i > 0 ; bh = bh->b_next_free) {
X 			if (bh->b_dev != dev)
X 				continue;
-			wait_on_buffer(bh);
-			if (bh->b_dev != dev)
-				continue;
-			if (bh->b_count)
+			if (buffer_locked(bh)) {
+				atomic_inc(&bh->b_count);
+				spin_unlock(&lru_list_lock);
+				wait_on_buffer(bh);
+				spin_lock(&lru_list_lock);
+				atomic_dec(&bh->b_count);
+				goto retry;
+			}
+			if (atomic_read(&bh->b_count))
X 				continue;
X 			bh->b_flushtime = 0;
X 			clear_bit(BH_Protected, &bh->b_state);
@@ -417,157 +442,119 @@
X 			clear_bit(BH_Req, &bh->b_state);
X 		}
X 	}
+	spin_unlock(&lru_list_lock);
X }
X 
-#define _hashfn(dev,block) (((unsigned)(HASHDEV(dev)^block)) & bh_hash_mask)
-#define hash(dev,block) hash_table[_hashfn(dev,block)]
+/* After several hours of tedious analysis, the following hash
+ * function won.  Do not mess with it... -DaveM
+ */
+#define _hashfn(dev,block)	\
+	((((dev)<<(bh_hash_shift - 6)) ^ ((dev)<<(bh_hash_shift - 9))) ^ \
+	 (((block)<<(bh_hash_shift - 6)) ^ ((block) >> 13) ^ ((block) << (bh_hash_shift - 12))))
+#define hash(dev,block) hash_table[(_hashfn(dev,block) & bh_hash_mask)]
X 
-static void insert_into_hash_list(struct buffer_head * bh)
+static __inline__ void __hash_link(struct buffer_head *bh, struct buffer_head **head)
X {
-	bh->b_next = NULL;
-	bh->b_pprev = NULL;
-	if (bh->b_dev) {
-		struct buffer_head **bhp = &hash(bh->b_dev, bh->b_blocknr);
-		struct buffer_head *next = *bhp;
-
-		if (next) {
-			bh->b_next = next;
-			next->b_pprev = &bh->b_next;
-		}
-		*bhp = bh;
-		bh->b_pprev = bhp;
-		nr_hashed_buffers++;
-	}
+	if ((bh->b_next = *head) != NULL)
+		bh->b_next->b_pprev = &bh->b_next;
+	*head = bh;
+	bh->b_pprev = head;
X }
X 
-static void remove_from_hash_queue(struct buffer_head * bh)
+static __inline__ void __hash_unlink(struct buffer_head *bh)
X {
-	struct buffer_head **pprev = bh->b_pprev;
-	if (pprev) {
-		struct buffer_head * next = bh->b_next;
-		if (next) {
-			next->b_pprev = pprev;
-			bh->b_next = NULL;
-		}
-		*pprev = next;
-		bh->b_pprev = NULL;
-		nr_hashed_buffers--;
-	}
+	if (bh->b_next)
+		bh->b_next->b_pprev = bh->b_pprev;
+	*(bh->b_pprev) = bh->b_next;
+	bh->b_pprev = NULL;
X }
X 
-static void insert_into_lru_list(struct buffer_head * bh)
+static void __insert_into_lru_list(struct buffer_head * bh, int blist)
X {
-	struct buffer_head **bhp = &lru_list[bh->b_list];
-
-	if (bh->b_dev == B_FREE)
-		BUG();
+	struct buffer_head **bhp = &lru_list[blist];
X 
X 	if(!*bhp) {
X 		*bhp = bh;
X 		bh->b_prev_free = bh;
X 	}
-
-	if (bh->b_next_free)
-		panic("VFS: buffer LRU pointers corrupted");
-
X 	bh->b_next_free = *bhp;
X 	bh->b_prev_free = (*bhp)->b_prev_free;
X 	(*bhp)->b_prev_free->b_next_free = bh;
X 	(*bhp)->b_prev_free = bh;
-
-	nr_buffers++;
-	nr_buffers_type[bh->b_list]++;
+	nr_buffers_type[blist]++;
X }
X 
-static void remove_from_lru_list(struct buffer_head * bh)
+static void __remove_from_lru_list(struct buffer_head * bh, int blist)
X {
-	if (!(bh->b_prev_free) || !(bh->b_next_free))
-		return;
-
-	if (bh->b_dev == B_FREE) {
-		printk("LRU list corrupted");
-		*(int*)0 = 0;
-	}
-	bh->b_prev_free->b_next_free = bh->b_next_free;
-	bh->b_next_free->b_prev_free = bh->b_prev_free;
-
-	if (lru_list[bh->b_list] == bh)
-		 lru_list[bh->b_list] = bh->b_next_free;
-	if (lru_list[bh->b_list] == bh)
-		 lru_list[bh->b_list] = NULL;
-	bh->b_next_free = bh->b_prev_free = NULL;
-
-	nr_buffers--;
-	nr_buffers_type[bh->b_list]--;
+	if (bh->b_prev_free || bh->b_next_free) {
+		bh->b_prev_free->b_next_free = bh->b_next_free;
+		bh->b_next_free->b_prev_free = bh->b_prev_free;
+		if (lru_list[blist] == bh)
+			lru_list[blist] = bh->b_next_free;
+		if (lru_list[blist] == bh)
+			lru_list[blist] = NULL;
+		bh->b_next_free = bh->b_prev_free = NULL;
+		nr_buffers_type[blist]--;
+	}
X }
X 
-static void remove_from_free_list(struct buffer_head * bh)
+static void __remove_from_free_list(struct buffer_head * bh, int index)
X {
-	int isize = BUFSIZE_INDEX(bh->b_size);
-	if (!(bh->b_prev_free) || !(bh->b_next_free))
-		panic("VFS: Free block list corrupted");
-	if(bh->b_dev != B_FREE)
-		panic("Free list corrupted");
-	if(!free_list[isize])
-		panic("Free list empty");
X 	if(bh->b_next_free == bh)
-		 free_list[isize] = NULL;
+		 free_list[index].list = NULL;
X 	else {
X 		bh->b_prev_free->b_next_free = bh->b_next_free;
X 		bh->b_next_free->b_prev_free = bh->b_prev_free;
-		if (free_list[isize] == bh)
-			 free_list[isize] = bh->b_next_free;
+		if (free_list[index].list == bh)
+			 free_list[index].list = bh->b_next_free;
X 	}
X 	bh->b_next_free = bh->b_prev_free = NULL;
X }
X 
-static void remove_from_queues(struct buffer_head * bh)
+/* The following two functions must operate atomically
+ * because they control the visibility of a buffer head
+ * to the rest of the kernel.
+ */
+static __inline__ void __remove_from_queues(struct buffer_head *bh)
X {
-	if (bh->b_dev == B_FREE)
-		BUG();
-	remove_from_hash_queue(bh);
-	remove_from_lru_list(bh);
+	write_lock(&hash_table_lock);
+	if (bh->b_pprev)
+		__hash_unlink(bh);
+	__remove_from_lru_list(bh, bh->b_list);
+	write_unlock(&hash_table_lock);
X }
X 
-static void put_last_free(struct buffer_head * bh)
+static void insert_into_queues(struct buffer_head *bh)
X {
-	if (bh) {
-		struct buffer_head **bhp = &free_list[BUFSIZE_INDEX(bh->b_size)];
+	struct buffer_head **head = &hash(bh->b_dev, bh->b_blocknr);
X 
-		if (bh->b_count)
-			BUG();
-
-		bh->b_dev = B_FREE;  /* So it is obvious we are on the free list. */
-
-		/* Add to back of free list. */
-		if(!*bhp) {
-			*bhp = bh;
-			bh->b_prev_free = bh;
-		}
-
-		bh->b_next_free = *bhp;
-		bh->b_prev_free = (*bhp)->b_prev_free;
-		(*bhp)->b_prev_free->b_next_free = bh;
-		(*bhp)->b_prev_free = bh;
-	}
+	spin_lock(&lru_list_lock);
+	write_lock(&hash_table_lock);
+	__hash_link(bh, head);
+	__insert_into_lru_list(bh, bh->b_list);
+	write_unlock(&hash_table_lock);
+	spin_unlock(&lru_list_lock);
X }
X 
-struct buffer_head * find_buffer(kdev_t dev, int block, int size)
-{		
-	struct buffer_head * next;
+/* This function must only run if there are no other
+ * references _anywhere_ to this buffer head.
+ */
+static void put_last_free(struct buffer_head * bh)
+{
+	struct bh_free_head *head = &free_list[BUFSIZE_INDEX(bh->b_size)];
+	struct buffer_head **bhp = &head->list;
X 
-	next = hash(dev,block);
-	for (;;) {
-		struct buffer_head *tmp = next;
-		if (!next)
-			break;
-		next = tmp->b_next;
-		if (tmp->b_blocknr != block || tmp->b_size != size || tmp->b_dev != dev)
-			continue;
-		next = tmp;
-		break;
+	spin_lock(&head->lock);
+	bh->b_dev = B_FREE;
+	if(!*bhp) {
+		*bhp = bh;
+		bh->b_prev_free = bh;
X 	}
-	return next;
+	bh->b_next_free = *bhp;
+	bh->b_prev_free = (*bhp)->b_prev_free;
+	(*bhp)->b_prev_free->b_next_free = bh;
+	(*bhp)->b_prev_free = bh;
+	spin_unlock(&head->lock);
X }
X 
X /*
@@ -579,10 +566,19 @@
X  */
X struct buffer_head * get_hash_table(kdev_t dev, int block, int size)
X {
-	struct buffer_head * bh;
-	bh = find_buffer(dev,block,size);
+	struct buffer_head **head = &hash(dev, block);
+	struct buffer_head *bh;
+
+	read_lock(&hash_table_lock);
+	for(bh = *head; bh; bh = bh->b_next)
+		if (bh->b_blocknr == block	&&
+		    bh->b_size    == size	&&
+		    bh->b_dev     == dev)
+			break;
X 	if (bh)
-		bh->b_count++;
+		atomic_inc(&bh->b_count);
+	read_unlock(&hash_table_lock);
+
X 	return bh;
X }
X 
@@ -631,6 +627,8 @@
X 	 * around on the free list, and we can get in a loop if we are not careful.
X 	 */
X 	for(nlist = 0; nlist < NR_LIST; nlist++) {
+	repeat:
+		spin_lock(&lru_list_lock);
X 		bh = lru_list[nlist];
X 		for (i = nr_buffers_type[nlist]*2 ; --i > 0 ; bh = bhnext) {
X 			if(!bh)
@@ -641,21 +639,25 @@
X 				 continue;
X 			if (bh->b_size == size)
X 				 continue;
-			bhnext->b_count++;
-			bh->b_count++;
-			wait_on_buffer(bh);
-			bhnext->b_count--;
+			if (buffer_locked(bh)) {
+				atomic_inc(&bh->b_count);
+				spin_unlock(&lru_list_lock);
+				wait_on_buffer(bh);
+				atomic_dec(&bh->b_count);
+				goto repeat;
+			}
X 			if (bh->b_dev == dev && bh->b_size != size) {
X 				clear_bit(BH_Dirty, &bh->b_state);
X 				clear_bit(BH_Uptodate, &bh->b_state);
X 				clear_bit(BH_Req, &bh->b_state);
X 				bh->b_flushtime = 0;
X 			}
-			if (--bh->b_count)
-				continue;
-			remove_from_queues(bh);
-			put_last_free(bh);
+			if (atomic_read(&bh->b_count) == 0) {
+				__remove_from_queues(bh);
+				put_last_free(bh);
+			}
X 		}
+		spin_unlock(&lru_list_lock);
X 	}
X }
X 
@@ -671,13 +673,10 @@
X 	}
X }
X 
-void init_buffer(struct buffer_head *bh, kdev_t dev, int block,
-		 bh_end_io_t *handler, void *dev_id)
+void init_buffer(struct buffer_head *bh, bh_end_io_t *handler, void *dev_id)
X {
X 	bh->b_list = BUF_CLEAN;
X 	bh->b_flushtime = 0;
-	bh->b_dev = dev;
-	bh->b_blocknr = block;
X 	bh->b_end_io = handler;
X 	bh->b_dev_id = dev_id;
X }
@@ -688,6 +687,92 @@
X 	unlock_buffer(bh);
X }
X 
+static void end_buffer_io_bad(struct buffer_head *bh, int uptodate)
+{
+	mark_buffer_uptodate(bh, uptodate);
+	unlock_buffer(bh);
+	BUG();
+}
+
+static void end_buffer_io_async(struct buffer_head * bh, int uptodate)
+{
+	static spinlock_t page_uptodate_lock = SPIN_LOCK_UNLOCKED;
+	unsigned long flags;
+	struct buffer_head *tmp;
+	struct page *page;
+	int free;
+
+	mark_buffer_uptodate(bh, uptodate);
+
+	/* This is a temporary buffer used for page I/O. */
+	page = mem_map + MAP_NR(bh->b_data);
+
+	if (!uptodate)
+		SetPageError(page);
+
+	/*
+	 * Be _very_ careful from here on. Bad things can happen if
+	 * two buffer heads end IO at almost the same time and both
+	 * decide that the page is now completely done.
+	 *
+	 * Async buffer_heads are here only as labels for IO, and get
+	 * thrown away once the IO for this page is complete.  IO is
+	 * deemed complete once all buffers have been visited
+	 * (b_count==0) and are now unlocked. We must make sure that
+	 * only the _last_ buffer that decrements its count is the one
+	 * that free's the page..
+	 */
+	spin_lock_irqsave(&page_uptodate_lock, flags);
+	unlock_buffer(bh);
+	atomic_dec(&bh->b_count);
+	tmp = bh->b_this_page;
+	while (tmp != bh) {
+		if (atomic_read(&tmp->b_count) &&
+		    (tmp->b_end_io == end_buffer_io_async))
+			goto still_busy;
+		tmp = tmp->b_this_page;
+	}
+
+	/* OK, the async IO on this page is complete. */
+	spin_unlock_irqrestore(&page_uptodate_lock, flags);
+
+	/*
+	 * if none of the buffers had errors then we can set the
+	 * page uptodate:
+	 */
+	if (!PageError(page))
+		SetPageUptodate(page);
+
+	/*
+	 * Run the hooks that have to be done when a page I/O has completed.
+	 *
+	 * Note - we need to test the flags before we unlock the page, but
+	 * we must not actually free the page until after the unlock!
+	 */
+	if (test_and_clear_bit(PG_decr_after, &page->flags))
+		atomic_dec(&nr_async_pages);
+
+	if (test_and_clear_bit(PG_free_swap_after, &page->flags))
+		swap_free(page->offset);
+
+	free = test_and_clear_bit(PG_free_after, &page->flags);
+
+	if (page->owner != -1)
+		PAGE_BUG(page);
+	page->owner = (int)current;
+	UnlockPage(page);
+
+	if (free)
+		__free_page(page);
+
+	return;
+
+still_busy:
+	spin_unlock_irqrestore(&page_uptodate_lock, flags);
+	return;
+}
+
+
X /*
X  * Ok, this is getblk, and it isn't very clear, again to hinder
X  * race-conditions. Most of the code is seldom used, (ie repeating),
@@ -713,22 +798,26 @@
X 	}
X 
X 	isize = BUFSIZE_INDEX(size);
-get_free:
-	bh = free_list[isize];
+	spin_lock(&free_list[isize].lock);
+	bh = free_list[isize].list;
+	if (bh) {
+		__remove_from_free_list(bh, isize);
+		atomic_set(&bh->b_count, 1);
+	}
+	spin_unlock(&free_list[isize].lock);
X 	if (!bh)
X 		goto refill;
-	remove_from_free_list(bh);
X 
X 	/* OK, FINALLY we know that this buffer is the only one of its kind,
-	 * and that it's unused (b_count=0), unlocked, and clean.
+	 * we hold a reference (b_count>0), it is unlocked, and it is clean.
X 	 */
-	init_buffer(bh, dev, block, end_buffer_io_sync, NULL);
-	bh->b_count = 1;
-	bh->b_state = 0;
+ init_buffer(bh, end_buffer_io_sync, NULL);
+	bh->b_dev = dev;
+	bh->b_blocknr = block;
+	bh->b_state = 1 << BH_Mapped;
X 
X 	/* Insert the buffer into the regular lists */
-	insert_into_lru_list(bh);
-	insert_into_hash_list(bh);
+	insert_into_queues(bh);
X 	goto out;
X 
X 	/*
@@ -737,24 +826,12 @@
X 	 */
X refill:
X 	refill_freelist(size);
-	if (!find_buffer(dev,block,size))
-		goto get_free;
X 	goto repeat;
X out:
X 	return bh;
X }
X 
X /*
- * Put a buffer into the appropriate list, without side-effects.
- */
-static void file_buffer(struct buffer_head *bh, int list)
-{
-	remove_from_lru_list(bh);
-	bh->b_list = list;
-	insert_into_lru_list(bh);
-}
-
-/*
X  * if a new dirty buffer is created we need to balance bdflush.
X  *
X  * in the future we might want to make bdflush aware of different
@@ -783,6 +860,7 @@
X static inline void __mark_dirty(struct buffer_head *bh, int flag)
X {
X 	bh->b_flushtime = jiffies + (flag ? bdf_prm.b_un.age_super : bdf_prm.b_un.age_buffer);
+	clear_bit(BH_New, &bh->b_state);
X 	refile_buffer(bh);
X }
X 
@@ -791,34 +869,29 @@
X 	__mark_dirty(bh, flag);
X }
X 
-void __atomic_mark_buffer_dirty(struct buffer_head *bh, int flag)
-{
-	lock_kernel();
-	__mark_dirty(bh, flag);
-	unlock_kernel();
-}
-
X /*
X  * A buffer may need to be moved from one buffer list to another
X  * (e.g. in case it is not shared any more). Handle this.
X  */
-void refile_buffer(struct buffer_head * buf)
+static __inline__ void __refile_buffer(struct buffer_head *bh)
X {
-	int dispose;
-
-	if (buf->b_dev == B_FREE) {
-		printk("Attempt to refile free buffer\n");
-		return;
-	}
-
-	dispose = BUF_CLEAN;
-	if (buffer_locked(buf))
+	int dispose = BUF_CLEAN;
+	if (buffer_locked(bh))
X 		dispose = BUF_LOCKED;
-	if (buffer_dirty(buf))
+	if (buffer_dirty(bh))
X 		dispose = BUF_DIRTY;
+	if (dispose != bh->b_list) {
+		__remove_from_lru_list(bh, bh->b_list);
+		bh->b_list = dispose;
+		__insert_into_lru_list(bh, dispose);
+	}
+}
X 
-	if (dispose != buf->b_list)
-		file_buffer(buf, dispose);
+void refile_buffer(struct buffer_head *bh)
+{
+	spin_lock(&lru_list_lock);
+	__refile_buffer(bh);
+	spin_unlock(&lru_list_lock);
X }
X 
X /*
@@ -828,9 +901,8 @@
X {
X 	touch_buffer(buf);
X 
-	if (buf->b_count) {
-		buf->b_count--;
-		wake_up(&buffer_wait);
+	if (atomic_read(&buf->b_count)) {
+		atomic_dec(&buf->b_count);
X 		return;
X 	}
X 	printk("VFS: brelse: Trying to free free buffer\n");
@@ -844,14 +916,21 @@
X  */
X void __bforget(struct buffer_head * buf)
X {
-	if (buf->b_count != 1 || buffer_locked(buf)) {
-		__brelse(buf);
-		return;
+	spin_lock(&lru_list_lock);
+	write_lock(&hash_table_lock);
+	if (atomic_read(&buf->b_count) != 1 || buffer_locked(buf)) {
+		touch_buffer(buf);
+		atomic_dec(&buf->b_count);
+	} else {
+		atomic_set(&buf->b_count, 0);
+		buf->b_state = 0;
+		if (buf->b_pprev)
+			__hash_unlink(buf);
+		__remove_from_lru_list(buf, buf->b_list);
+		put_last_free(buf);
X 	}
-	buf->b_count = 0;
-	buf->b_state = 0;
-	remove_from_queues(buf);
-	put_last_free(buf);
+	write_unlock(&hash_table_lock);
+	spin_unlock(&lru_list_lock);
X }
X 
X /*
@@ -941,49 +1020,25 @@
X /*
X  * Note: the caller should wake up the buffer_wait list if needed.
X  */
-static void put_unused_buffer_head(struct buffer_head * bh)
+static __inline__ void __put_unused_buffer_head(struct buffer_head * bh)
X {
X 	if (nr_unused_buffer_heads >= MAX_UNUSED_BUFFERS) {
-		nr_buffer_heads--;
X 		kmem_cache_free(bh_cachep, bh);
-		return;
+	} else {
+		bh->b_blocknr = -1;
+		init_waitqueue_head(&bh->b_wait);
+		nr_unused_buffer_heads++;
+		bh->b_next_free = unused_list;
+		bh->b_this_page = NULL;
+		unused_list = bh;
X 	}
-
-//	memset(bh, 0, sizeof(*bh));
-	bh->b_blocknr = -1;
-	init_waitqueue_head(&bh->b_wait);
-	nr_unused_buffer_heads++;
-	bh->b_next_free = unused_list;
-	unused_list = bh;
X }
X 
-/* 
- * We can't put completed temporary IO buffer_heads directly onto the
- * unused_list when they become unlocked, since the device driver
- * end_request routines still expect access to the buffer_head's
- * fields after the final unlock.  So, the device driver puts them on
- * the reuse_list instead once IO completes, and we recover these to
- * the unused_list here.
- *
- * Note that we don't do a wakeup here, but return a flag indicating
- * whether we got any buffer heads. A task ready to sleep can check
- * the returned value, and any tasks already sleeping will have been
- * awakened when the buffer heads were added to the reuse list.
- */
-static inline int recover_reusable_buffer_heads(void)
-{
-	struct buffer_head *head = xchg(&reuse_list, NULL);
-	int found = 0;
-	
-	if (head) {
-		do {
-			struct buffer_head *bh = head;
-			head = head->b_next_free;
-			put_unused_buffer_head(bh);
-		} while (head);
-		found = 1;
-	}
-	return found;
+static void put_unused_buffer_head(struct buffer_head *bh)
+{
+	spin_lock(&unused_list_lock);
+	__put_unused_buffer_head(bh);
+	spin_unlock(&unused_list_lock);
X }
X 
X /*
@@ -995,13 +1050,15 @@
X {
X 	struct buffer_head * bh;
X 
-	recover_reusable_buffer_heads();
+	spin_lock(&unused_list_lock);
X 	if (nr_unused_buffer_heads > NR_RESERVED) {
X 		bh = unused_list;
X 		unused_list = bh->b_next_free;
X 		nr_unused_buffer_heads--;
+		spin_unlock(&unused_list_lock);
X 		return bh;
X 	}
+	spin_unlock(&unused_list_lock);
X 
X 	/* This is critical.  We can't swap out pages to get
X 	 * more buffer heads, because the swap-out may need
@@ -1010,20 +1067,23 @@
X 	if((bh = kmem_cache_alloc(bh_cachep, SLAB_BUFFER)) != NULL) {
X 		memset(bh, 0, sizeof(*bh));
X 		init_waitqueue_head(&bh->b_wait);
-		nr_buffer_heads++;
X 		return bh;
X 	}
X 
X 	/*
X 	 * If we need an async buffer, use the reserved buffer heads.
X 	 */
-	if (async && unused_list) {
-		bh = unused_list;
-		unused_list = bh->b_next_free;
-		nr_unused_buffer_heads--;
-		return bh;
+	if (async) {
+		spin_lock(&unused_list_lock);
+		if (unused_list) {
+			bh = unused_list;
+			unused_list = bh->b_next_free;
+			nr_unused_buffer_heads--;
+			spin_unlock(&unused_list_lock);
+			return bh;
+		}
+		spin_unlock(&unused_list_lock);
X 	}
-
X #if 0
X 	/*
X 	 * (Pending further analysis ...)
@@ -1035,7 +1095,6 @@
X 	   (bh = kmem_cache_alloc(bh_cachep, SLAB_KERNEL)) != NULL) {
X 		memset(bh, 0, sizeof(*bh));
X 		init_waitqueue_head(&bh->b_wait);
-		nr_buffer_heads++;
X 		return bh;
X 	}
X #endif
@@ -1052,8 +1111,7 @@
X  * from ordinary buffer allocations, and only async requests are allowed
X  * to sleep waiting for buffer heads. 
X  */
-static struct buffer_head * create_buffers(unsigned long page, 
-						unsigned long size, int async)
+static struct buffer_head * create_buffers(unsigned long page, unsigned long size, int async)
X {
X 	DECLARE_WAITQUEUE(wait, current);
X 	struct buffer_head *bh, *head;
@@ -1073,11 +1131,14 @@
X 
X 		bh->b_state = 0;
X 		bh->b_next_free = NULL;
-		bh->b_count = 0;
+		bh->b_pprev = NULL;
+		atomic_set(&bh->b_count, 0);
X 		bh->b_size = size;
X 
X 		bh->b_data = (char *) (page+offset);
-		bh->b_list = 0;
+		bh->b_list = BUF_CLEAN;
SHAR_EOF
true || echo 'restore of patch-2.3.9 failed'
fi
echo 'End of  part 19'
echo 'File patch-2.3.9 is continued in part 20'
echo 20 > _shar_seq_.tmp
exit 0
#!/bin/sh
# this is part 21 of a 26 - part archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file patch-2.3.9 continued
if test ! -r _shar_seq_.tmp; then
        echo 'Please unpack part 1 first!'
        exit 1
fi
(read Scheck
if test "$Scheck" != 21; then
        echo Please unpack part "$Scheck" next!
        exit 1
 else
        exit 0
 fi
) < _shar_seq_.tmp || exit 1
if test ! -f _shar_wnt_.tmp; then
echo 'x - still skipping patch-2.3.9'
else
echo 'x - continuing with patch-2.3.9'
sed 's/^X//' << 'SHAR_EOF' >> 'patch-2.3.9' &&
X 		mark_inode_dirty(inode);
-		bforget(bh);
X 		mark_buffer_dirty(ind_bh, 1);
X 
X 		/* accumulate blocks to free if they're contiguous */
diff -u --recursive --new-file v2.3.8/linux/fs/fat/file.c linux/fs/fat/file.c
--- v2.3.8/linux/fs/fat/file.c	Sun Feb 28 09:47:37 1999
+++ linux/fs/fat/file.c	Sun Jun 27 10:10:41 1999
@@ -57,12 +57,14 @@
X 	NULL,			/* rename */
X 	NULL,			/* readlink */
X 	NULL,			/* follow_link */
-	generic_readpage,	/* readpage */
+ fat_bmap, /* get_block */
+	block_read_full_page,	/* readpage */
X 	NULL,			/* writepage */
- fat_bmap, /* bmap */
+	NULL,			/* flushpage */
X fat_truncate, /* truncate */
X 	NULL,			/* permission */
-	NULL			/* smap */
+	NULL,			/* smap */
+	NULL			/* revalidate */
X };
X 
X /* #Specification: msdos / special devices / mmap	
@@ -107,12 +109,14 @@
X 	NULL,			/* rename */
X 	NULL,			/* readlink */
X 	NULL,			/* follow_link */
-	generic_readpage,	/* readpage */
+ NULL, /* get_block */
+	block_read_full_page,	/* readpage */
X 	NULL,			/* writepage */
-	NULL,			/* bmap */
+	NULL,			/* flushpage */
X fat_truncate, /* truncate */
X 	NULL,			/* permission */
-	NULL			/* smap */
+	NULL,			/* smap */
+	NULL			/* revalidate */
X };
X 
X static struct file_operations fat_file_operations_readpage = {
@@ -142,12 +146,14 @@
X 	NULL,			/* rename */
X 	NULL,			/* readlink */
X 	NULL,			/* follow_link */
+	NULL,			/* get_block */
X fat_readpage, /* readpage */
X 	NULL,			/* writepage */
-	NULL,			/* bmap */
+	NULL,			/* flushpage */
X fat_truncate, /* truncate */
X 	NULL,			/* permission */
-	NULL			/* smap */
+	NULL,			/* smap */
+	NULL			/* revalidate */
X };
X 
X #define MSDOS_PREFETCH	32
diff -u --recursive --new-file v2.3.8/linux/fs/fifo.c linux/fs/fifo.c
--- v2.3.8/linux/fs/fifo.c	Sat Jun 19 11:45:28 1999
+++ linux/fs/fifo.c	Sat Jun 26 12:04:39 1999
@@ -179,7 +179,7 @@
X 	NULL,			/* mknod */
X 	NULL,			/* rename */
X 	NULL,			/* readlink */
-	NULL,			/* bmap */
+	NULL,			/* get_block */
X 	NULL,			/* readpage */
X 	NULL,			/* writepage */
X 	NULL,			/* flushpage */
diff -u --recursive --new-file v2.3.8/linux/fs/file_table.c linux/fs/file_table.c
--- v2.3.8/linux/fs/file_table.c	Tue Jun  1 23:25:48 1999
+++ linux/fs/file_table.c	Mon Jun 28 11:43:43 1999
@@ -80,7 +80,7 @@
X 		nr_free_files--;
X 	new_one:
X 		memset(f, 0, sizeof(*f));
-		f->f_count = 1;
+		atomic_set(&f->f_count, 1);
X 		f->f_version = ++event;
X 		f->f_uid = current->fsuid;
X 		f->f_gid = current->fsgid;
@@ -120,7 +120,7 @@
X {
X 	memset(filp, 0, sizeof(*filp));
X 	filp->f_mode   = mode;
-	filp->f_count  = 1;
+	atomic_set(&filp->f_count, 1);
X 	filp->f_dentry = dentry;
X 	filp->f_uid    = current->fsuid;
X 	filp->f_gid    = current->fsgid;
@@ -133,21 +133,17 @@
X 
X void fput(struct file *file)
X {
-	int count = file->f_count-1;
-
-	if (!count) {
+	if (atomic_dec_and_test(&file->f_count)) {
X 		locks_remove_flock(file);
X 		__fput(file);
-		file->f_count = 0;
X 		remove_filp(file);
X 		insert_file_free(file);
-	} else
-		file->f_count = count;
+	}
X }
X 
X void put_filp(struct file *file)
X {
-	if(--file->f_count == 0) {
+	if (atomic_dec_and_test(&file->f_count)) {
X 		remove_filp(file);
X 		insert_file_free(file);
X 	}
diff -u --recursive --new-file v2.3.8/linux/fs/hfs/dir_cap.c linux/fs/hfs/dir_cap.c
--- v2.3.8/linux/fs/hfs/dir_cap.c	Thu May 13 10:53:59 1999
+++ linux/fs/hfs/dir_cap.c	Sun Jun 27 10:10:41 1999
@@ -87,12 +87,14 @@
X 	hfs_rename,		/* rename */
X 	NULL,			/* readlink */
X 	NULL,			/* follow_link */
+	NULL,			/* get_block */
X 	NULL,			/* readpage */
X 	NULL,			/* writepage */
-	NULL,			/* bmap */
+	NULL,			/* flushpage */
X 	NULL,			/* truncate */
X 	NULL,			/* permission */
-	NULL			/* smap */
+	NULL,			/* smap */
+	NULL			/* revalidate */
X };
X 
X struct inode_operations hfs_cap_fdir_inode_operations = {
@@ -108,12 +110,14 @@
X 	NULL,			/* rename */
X 	NULL,			/* readlink */
X 	NULL,			/* follow_link */
+	NULL,			/* get_block */
X 	NULL,			/* readpage */
X 	NULL,			/* writepage */
-	NULL,			/* bmap */
+	NULL,			/* flushpage */
X 	NULL,			/* truncate */
X 	NULL,			/* permission */
-	NULL			/* smap */
+	NULL,			/* smap */
+	NULL			/* revalidate */
X };
X 
X struct inode_operations hfs_cap_rdir_inode_operations = {
@@ -129,12 +133,14 @@
X 	NULL,			/* rename */
X 	NULL,			/* readlink */
X 	NULL,			/* follow_link */
+	NULL,			/* get_block */
X 	NULL,			/* readpage */
X 	NULL,			/* writepage */
-	NULL,			/* bmap */
+	NULL,			/* flushpage */
X 	NULL,			/* truncate */
X 	NULL,			/* permission */
-	NULL			/* smap */
+	NULL,			/* smap */
+	NULL			/* revalidate */
X };
X 
X /*================ File-local functions ================*/
diff -u --recursive --new-file v2.3.8/linux/fs/hfs/dir_dbl.c linux/fs/hfs/dir_dbl.c
--- v2.3.8/linux/fs/hfs/dir_dbl.c	Thu May 13 10:53:59 1999
+++ linux/fs/hfs/dir_dbl.c	Sun Jun 27 10:10:41 1999
@@ -86,12 +86,14 @@
X 	dbl_rename,		/* rename */
X 	NULL,			/* readlink */
X 	NULL,			/* follow_link */
+	NULL,			/* get_block */
X 	NULL,			/* readpage */
X 	NULL,			/* writepage */
-	NULL,			/* bmap */
+	NULL,			/* flushpage */
X 	NULL,			/* truncate */
X 	NULL,			/* permission */
-	NULL			/* smap */
+	NULL,			/* smap */
+	NULL			/* revalidate */
X };
X 
X 
diff -u --recursive --new-file v2.3.8/linux/fs/hfs/dir_nat.c linux/fs/hfs/dir_nat.c
--- v2.3.8/linux/fs/hfs/dir_nat.c	Sat Jun 19 11:45:28 1999
+++ linux/fs/hfs/dir_nat.c	Sun Jun 27 10:10:41 1999
@@ -93,9 +93,10 @@
X 	hfs_rename,		/* rename */
X 	NULL,			/* readlink */
X 	NULL,			/* follow_link */
+	NULL,			/* get_block */
X 	NULL,			/* readpage */
X 	NULL,			/* writepage */
-	NULL,			/* bmap */
+	NULL,			/* flushpage */
X 	NULL,			/* truncate */
X 	NULL,			/* permission */
X 	NULL,			/* smap */
@@ -115,9 +116,10 @@
X 	nat_hdr_rename,		/* rename */
X 	NULL,			/* readlink */
X 	NULL,			/* follow_link */
+	NULL,			/* get_block */
X 	NULL,			/* readpage */
X 	NULL,			/* writepage */
-	NULL,			/* bmap */
+	NULL,			/* flushpage */
X 	NULL,			/* truncate */
X 	NULL,			/* permission */
X 	NULL,			/* smap */
diff -u --recursive --new-file v2.3.8/linux/fs/hfs/file.c linux/fs/hfs/file.c
--- v2.3.8/linux/fs/hfs/file.c	Sat Jun 19 11:45:28 1999
+++ linux/fs/hfs/file.c	Sun Jun 27 10:10:41 1999
@@ -63,9 +63,10 @@
X 	NULL,			/* rename */
X 	NULL,			/* readlink */
X 	NULL,			/* follow_link */
-	generic_readpage,	/* readpage */
+ hfs_bmap, /* get_block */
+	block_read_full_page,	/* readpage */
X 	NULL,			/* writepage */
- hfs_bmap, /* bmap */
+	NULL,			/* flushpage */
X hfs_file_truncate, /* truncate */
X 	NULL,			/* permission */
X 	NULL,			/* smap */
diff -u --recursive --new-file v2.3.8/linux/fs/hfs/file_cap.c linux/fs/hfs/file_cap.c
--- v2.3.8/linux/fs/hfs/file_cap.c	Sat Jun 19 11:45:28 1999
+++ linux/fs/hfs/file_cap.c	Sun Jun 27 10:10:41 1999
@@ -77,9 +77,10 @@
X 	NULL,				/* rename */
X 	NULL,				/* readlink */
X 	NULL,				/* follow_link */
+ NULL, /* get_block - none */
X 	NULL,				/* readpage */
X 	NULL,				/* writepage */
- NULL, /* bmap - none */
+	NULL,				/* flushpage */
X cap_info_truncate, /* truncate */
X 	NULL,				/* permission */
X 	NULL,				/* smap */
diff -u --recursive --new-file v2.3.8/linux/fs/hfs/file_hdr.c linux/fs/hfs/file_hdr.c
--- v2.3.8/linux/fs/hfs/file_hdr.c	Sat Jun 19 11:45:28 1999
+++ linux/fs/hfs/file_hdr.c	Sun Jun 27 10:10:41 1999
@@ -78,10 +78,11 @@
X 	NULL,			/* rename */
X 	NULL,			/* readlink */
X 	NULL,			/* follow_link */
+	NULL,			/* get_block - XXX: not available since
+				   header part has no disk block */
X 	NULL,			/* readpage */
X 	NULL,			/* writepage */
-	NULL,			/* bmap - XXX: not available since
-				   header part has no disk block */
+	NULL,			/* flushpage */
X hdr_truncate, /* truncate */
X 	NULL,			/* permission */
X 	NULL,			/* smap */
diff -u --recursive --new-file v2.3.8/linux/fs/hpfs/Makefile linux/fs/hpfs/Makefile
--- v2.3.8/linux/fs/hpfs/Makefile	Thu May 13 23:48:20 1999
+++ linux/fs/hpfs/Makefile	Fri Jun 25 09:42:19 1999
@@ -1,5 +1,5 @@
X O_TARGET := hpfs.o
-O_OBJS := alloc.o anode.o buffer.o dentry.o dir.o dnode.o ea.o file.o inode.o map.o mmap.o name.o namei.o super.o
+O_OBJS := alloc.o anode.o buffer.o dentry.o dir.o dnode.o ea.o file.o inode.o map.o name.o namei.o super.o
X M_OBJS := $(O_TARGET)
X 
X include $(TOPDIR)/Rules.make
diff -u --recursive --new-file v2.3.8/linux/fs/hpfs/anode.c linux/fs/hpfs/anode.c
--- v2.3.8/linux/fs/hpfs/anode.c	Thu May 13 23:48:20 1999
+++ linux/fs/hpfs/anode.c	Sun Jun 27 10:10:41 1999
@@ -301,13 +301,20 @@
X 		anode = hpfs_map_anode(s, ano, &bh);
X 		btree1 = &anode->btree;
X 	} else btree1 = btree;
-	for (i = 0; i < btree1->n_used_nodes; i++)
-		if (btree1->u.internal[i].down == oano)
-			if ((pos = i + 1) < btree1->n_used_nodes) goto go_down;
-			else goto go_up;
-	hpfs_error(s, "reference to anode %08x not found in anode %08x (probably bad up pointer)",
-		oano, level ? ano : -1);
-	if (level) brelse(bh);
+	for (i = 0; i < btree1->n_used_nodes; i++) {
+		if (btree1->u.internal[i].down == oano) {
+			if ((pos = i + 1) < btree1->n_used_nodes)
+				goto go_down;
+			else
+				goto go_up;
+		}
+	}
+	hpfs_error(s,
+		   "reference to anode %08x not found in anode %08x "
+		   "(probably bad up pointer)",
+		   oano, level ? ano : -1);
+	if (level)
+		brelse(bh);
X }
X 
X /* Just a wrapper around hpfs_bplus_lookup .. used for reading eas */
diff -u --recursive --new-file v2.3.8/linux/fs/hpfs/ea.c linux/fs/hpfs/ea.c
--- v2.3.8/linux/fs/hpfs/ea.c	Tue Jun  1 23:25:47 1999
+++ linux/fs/hpfs/ea.c	Sun Jun 27 10:10:41 1999
@@ -233,10 +233,10 @@
X 				goto bail;
X 			fnode->ea_anode = 0;
X 			len++;
-		}
-		else if (!fnode->ea_anode)
-			if (hpfs_alloc_if_possible(s, fnode->ea_secno + len)) len++;
-			else {
+		} else if (!fnode->ea_anode) {
+			if (hpfs_alloc_if_possible(s, fnode->ea_secno + len)) {
+				len++;
+			} else {
X 				/* Aargh... don't know how to create ea anodes :-( */
X 				/*struct buffer_head *bh;
X 				struct anode *anode;
@@ -280,10 +280,15 @@
X 				fnode->ea_secno = new_sec;
X 				len = (pos + 511) >> 9;
X 			}
-		if (fnode->ea_anode)
-			if (hpfs_add_sector_to_btree(s, fnode->ea_secno, 0, len) != -1)
+		}
+		if (fnode->ea_anode) {
+			if (hpfs_add_sector_to_btree(s, fnode->ea_secno,
+						     0, len) != -1) {
X 				len++;
-			else goto bail;
+			} else {
+				goto bail;
+			}
+		}
X 	}
X 	h[0] = 0;
X 	h[1] = strlen(key);
diff -u --recursive --new-file v2.3.8/linux/fs/hpfs/file.c linux/fs/hpfs/file.c
--- v2.3.8/linux/fs/hpfs/file.c	Tue Jun  1 23:25:47 1999
+++ linux/fs/hpfs/file.c	Sun Jun 27 10:10:41 1999
@@ -53,143 +53,101 @@
X {
X 	if (IS_IMMUTABLE(i)) return /*-EPERM*/;
X 	i->i_hpfs_n_secs = 0;
-	hpfs_truncate_btree(i->i_sb, i->i_ino, 1, ((i->i_size + 511) >> 9));
X 	i->i_blocks = 1 + ((i->i_size + 511) >> 9);
+	hpfs_truncate_btree(i->i_sb, i->i_ino, 1, ((i->i_size + 511) >> 9));
X 	hpfs_write_inode(i);
X }
X 
-ssize_t hpfs_file_read(struct file *filp, char *buf, size_t count, loff_t *ppos)
+int hpfs_getblk_block(struct inode *inode, long block, int create, int *err, int *created)
X {
-	struct inode *inode = filp->f_dentry->d_inode;
-	int i,j;
-	int a = generic_file_read(filp, buf, count, ppos);
-	if (inode->i_hpfs_conv != CONV_TEXT || a < 0) {
-		return a;
-	}	
-	for (i = 0, j = 0; i < a; i++) {
-		char c;
-		int error;
-		if ((error = get_user(c, buf + i))) return error;
-		if (c != '\r') {
-			if (i != j) put_user(c, buf + j);
-			j++;
+	int add;
+	int sec = 0;
+	down(&inode->i_sem);
+	if (err) *err = 0;
+	if (created) *created = 0;
+	if (!inode->i_blocks) {
+		hpfs_error(inode->i_sb, "hpfs_get_block: inode %08x has no blocks", inode->i_ino);
+		if (err) *err = -EFSERROR;
+		up(&inode->i_sem);
+		return 0;
+	}
+	if (block < ((add = inode->i_blocks - 1))) {
+		int bm;
+		if (!(bm = hpfs_bmap(inode, block))) {
+			hpfs_error(inode->i_sb, "hpfs_get_block: cound not bmap block %08x, inode %08x, size %08x", (int)block, inode->i_ino, (int)inode->i_size);
+			*err = -EFSERROR;
X 		}
+		up(&inode->i_sem);
+		return bm;
X 	}
-	return j;
+	if (!create) {
+		if (err) *err = -EFBIG;
+		up(&inode->i_sem);
+		return 0;
+	}
+	if (created) *created = 1;
+	while (add <= block) {
+		if ((sec = hpfs_add_sector_to_btree(inode->i_sb, inode->i_ino, 1, add)) == -1) {
+			if (err) *err = -ENOSPC;
+			hpfs_truncate_btree(inode->i_sb, inode->i_ino, 1, inode->i_blocks - 1);
+			return 0;
+		} /* FIXME: clear block */
+		add++;
+	}
+	inode->i_blocks = add + 1;
+	up(&inode->i_sem);
+	return sec;
X }
X 
-ssize_t hpfs_file_write(struct file *filp, const char *buf, size_t count,
-			loff_t *ppos)
+/* copied from ext2fs */
+static int hpfs_get_block(struct inode *inode, unsigned long block, struct buffer_head *bh, int update)
X {
-	struct inode *i = filp->f_dentry->d_inode;
-	int carry, error = 0;
-	const char *start = buf;
-	if (!i) return -EINVAL;
-	if (!S_ISREG(i->i_mode)) return -EINVAL;
-	if (IS_IMMUTABLE(i)) return -EPERM;
-	if (filp->f_flags & O_APPEND) *ppos = i->i_size;
-	if (count <= 0) return 0;
-	if ((unsigned)(*ppos+count) >= 0x80000000U || (unsigned)count >= 0x80000000U) return -EFBIG;
-	carry = 0;
-	while (count || carry) {
-		int ii, add = 0;
-		secno sec = 0; /* Go away, uninitialized variable warning */
-		int offset, size, written;
-		char ch;
-		struct buffer_head *bh;
-		char *data;
-		offset = *ppos & 0x1ff;
-		size = count > 0x200 - offset ? 0x200 - offset : count;
-		if ((*ppos >> 9) < ((i->i_size + 0x1ff) >> 9)) {
-			i->i_hpfs_n_secs = 0;
-			if (!(sec = hpfs_bmap(i, *ppos >> 9))) {
-				hpfs_error(i->i_sb, "bmap failed, file %08x, fsec %08x",
-					i->i_ino, *ppos >> 9);
-				error =- EFSERROR;
-				break;
-			}
-		} else for (ii = (i->i_size + 0x1ff) >> 9, add = 1; ii <= *ppos >> 9; ii++) {
-			if ((sec = hpfs_add_sector_to_btree(i->i_sb, i->i_ino, 1, ii)) == -1) {
-				hpfs_truncate(i);
-				return -ENOSPC;
-			}
-			if (*ppos != i->i_size)
-				if ((data = hpfs_get_sector(i->i_sb, sec, &bh))) {
-					memset(data, 0, 512);
-					mark_buffer_dirty(bh, 0);
-					brelse(bh);
-				}
-			i->i_size = 0x200 * ii + 1;
-			i->i_blocks++;
-			/*mark_inode_dirty(i);*/i->i_hpfs_dirty = 1;
-			if (i->i_sb->s_hpfs_chk >= 2) {
-				secno bsec;
-				bsec = hpfs_bmap(i, ii);
-				if (sec != bsec) {
-					hpfs_error(i->i_sb, "sec == %08x, bmap returns %08x", sec, bsec);
-					error = -EFSERROR;
-					break;
-				}
-			}	
-			PRINTK(("file_write: added %08x\n", sec));
-		}
-		if (!sec || sec == 15) {
-			hpfs_error(i->i_sb, "bmap returned empty sector");
-			error = -EFSERROR;
-			break;
-		}
-		if (i->i_sb->s_hpfs_chk)
-			if (hpfs_chk_sectors(i->i_sb, sec, 1, "data")) {
-				error = -EFSERROR;
-				break;
-			}
-		if ((!offset && size == 0x200) || add)
-			data = hpfs_get_sector(i->i_sb, sec, &bh);
-		else data = hpfs_map_sector(i->i_sb, sec, &bh, 0);
-		if (!data) {
-			error = -EIO;
-			break;
-		}
-		if (i->i_hpfs_conv != CONV_TEXT) {
-			memcpy_fromfs(data + offset, buf, written = size);
-			buf += size;
-		} else {
-			int left;
-			char *to;
-			/* LF->CR/LF conversion, stolen from fat fs */
-			written = left = 0x200 - offset;
-			to = (char *) bh->b_data + (*ppos & 0x1ff);
-			if (carry) {
-				*to++ = '\n';
-				left--;
-				carry = 0;
-			}
-			for (size = 0; size < count && left; size++) {
-				if ((error = get_user(ch, buf++))) break;
-				if (ch == '\n') {
-					*to++ = '\r';
-					left--;
-				}
-				if (!left) carry = 1;
-				else {
-					*to++ = ch;
-					left--;
-				}
-			}
-			written -= left;
+	if (!bh->b_blocknr) {
+		int error, created;
+		unsigned long blocknr;
+
+		blocknr = hpfs_getblk_block(inode, block, 1, &error, &created);
+		if (!blocknr) {
+			if (!error)
+				error = -ENOSPC;
+			return error;
X 		}
-		update_vm_cache(i, *ppos, bh->b_data + (*ppos & 0x1ff), written);
-		*ppos += written;
-		if (*ppos > i->i_size) {
-			i->i_size = *ppos;
-			/*mark_inode_dirty(i);*/i->i_hpfs_dirty = 1;
+
+		bh->b_dev = inode->i_dev;
+		bh->b_blocknr = blocknr;
+
+		if (!update)
+			return 0;
+
+		if (created) {
+			memset(bh->b_data, 0, bh->b_size);
+			set_bit(BH_Uptodate, &bh->b_state);
+			return 0;
X 		}
-		mark_buffer_dirty(bh, 0);
-		brelse(bh);
-		count -= size;
-	}
-	if (start == buf) return error;
-	i->i_mtime = CURRENT_TIME;
-	/*mark_inode_dirty(i);*/i->i_hpfs_dirty = 1;
-	return buf - start;
+	}
+
+	if (!update)
+		return 0;
+
+	lock_kernel();
+	ll_rw_block(READ, 1, &bh);
+	wait_on_buffer(bh);
+	unlock_kernel();
+
+	return buffer_uptodate(bh) ? 0 : -EIO;
X }
+
+ssize_t hpfs_file_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
+{
+	ssize_t retval;
+
+	retval = generic_file_write(file, buf, count,
+				    ppos, block_write_partial_page);
+	if (retval > 0) {
+		struct inode *inode = file->f_dentry->d_inode;
+		inode->i_mtime = CURRENT_TIME;
+		inode->i_hpfs_dirty = 1;
+	}
+	return retval;
+}
+
diff -u --recursive --new-file v2.3.8/linux/fs/hpfs/hpfs_fn.h linux/fs/hpfs/hpfs_fn.h
--- v2.3.8/linux/fs/hpfs/hpfs_fn.h	Fri Jun  4 01:06:29 1999
+++ linux/fs/hpfs/hpfs_fn.h	Fri Jun 25 09:42:19 1999
@@ -21,6 +21,7 @@
X #include <asm/bitops.h>
X #include <asm/segment.h>
X #include <asm/uaccess.h>
+#include <linux/smp_lock.h>
X 
X #include <stdarg.h>
X 
@@ -259,6 +260,7 @@
X void hpfs_truncate(struct inode *);
X ssize_t hpfs_file_read(struct file *, char *, size_t, loff_t *);
X ssize_t hpfs_file_write(struct file *, const char *, size_t, loff_t *);
+int hpfs_writepage (struct file *, struct page *);
X 
X /* inode.c */
X 
diff -u --recursive --new-file v2.3.8/linux/fs/hpfs/inode.c linux/fs/hpfs/inode.c
--- v2.3.8/linux/fs/hpfs/inode.c	Sat Jun 19 11:45:28 1999
+++ linux/fs/hpfs/inode.c	Sun Jun 27 10:10:41 1999
@@ -11,7 +11,7 @@
X static const struct file_operations hpfs_file_ops =
X {
X 	NULL,				/* lseek - default */
-	hpfs_file_read,			/* read */
+	generic_file_read,		/* read */
X 	hpfs_file_write,		/* write */
X 	NULL,				/* readdir - bad */
X 	NULL,				/* poll - default */
@@ -41,11 +41,13 @@
X 	NULL,				/* rename */
X 	NULL,				/* readlink */
X 	NULL,				/* follow_link */
-	generic_readpage,		/* readpage */
-	NULL,				/* writepage */
X 	(int (*)(struct inode *, int))
-	&hpfs_bmap,			/* bmap */
-	&hpfs_truncate,			/* truncate */
+#warning Someone needs to code up hpfs_get_block properly... -DaveM
+	&hpfs_bmap,			/* get_block */
+	block_read_full_page,		/* readpage */
+	hpfs_writepage,			/* writepage */
+	block_flushpage,		/* flushpage */
+	hpfs_truncate,			/* truncate */
X 	NULL,				/* permission */
X 	NULL,				/* smap */
X 	NULL,				/* revalidate */
@@ -84,13 +86,14 @@
X 	hpfs_rename,			/* rename */
X 	NULL,				/* readlink */
X 	NULL,				/* follow_link */
+	NULL,				/* get_block */
X 	NULL,				/* readpage */
X 	NULL,				/* writepage */
-	NULL,				/* bmap */
+	NULL,				/* flushpage */
X 	NULL,				/* truncate */
X 	NULL,				/* permission */
X 	NULL,				/* smap */
- NULL, /* revalidate */
+	NULL				/* revalidate */
X };
X 
X const struct inode_operations hpfs_symlink_iops =
@@ -107,13 +110,14 @@
X 	NULL,				/* rename */
X 	hpfs_readlink,			/* readlink */
X 	hpfs_follow_link,		/* follow_link */
+	NULL,				/* get_block */
X 	NULL,				/* readpage */
X 	NULL,				/* writepage */
-	NULL,				/* bmap */
+	NULL,				/* flushpage */
X 	NULL,				/* truncate */
X 	NULL,				/* permission */
X 	NULL,				/* smap */
- NULL, /* revalidate */
+	NULL				/* revalidate */
X };
X 
X 
@@ -125,7 +129,6 @@
X 	unsigned char *ea;
X 	int ea_size;
X 	i->i_op = 0;
-	/*i->i_hpfs_sem = MUTEX;*/
X 	init_MUTEX(&i->i_hpfs_sem);
X 	i->i_uid = sb->s_hpfs_uid;
X 	i->i_gid = sb->s_hpfs_gid;
diff -u --recursive --new-file v2.3.8/linux/fs/hpfs/mmap.c linux/fs/hpfs/mmap.c
--- v2.3.8/linux/fs/hpfs/mmap.c	Thu May 13 23:48:20 1999
+++ linux/fs/hpfs/mmap.c	Wed Dec 31 16:00:00 1969
@@ -1,128 +0,0 @@
-/*
- *  linux/fs/hpfs/mmap.c
- *
- *  taken from fat filesystem
- *
- *  Written by Jacques Gelinas (jac...@solucorp.qc.ca)
- *  Inspired by fs/nfs/mmap.c (Jon Tombs 15 Aug 1993)
- *
- *  Modified for HPFS by Mikulas Patocka (mik...@artax.karlin.mff.cuni.cz)
- *
- *  mmap handling for hpfs filesystem
- *	(generic_file_mmap may be used only on filesystems that keep zeros
- *	 in last file sector beyond end)
- */
-
-/*
- * generic_file_mmap doesn't erase the space beyond file end in last sector. :-(
- * Hpfs doesn't keep zeros in last sector. This causes problems with kernel
- * mkdep.c and probably other programs. Additionally this could be a security
- * hole - some interesting data, like pieces of /etc/shadow could be found
- * beyond file end.
- *
- * So, I can't use generic mmap. mmap from fat filesystem looks good, so I used
- * it.
- *
- * BTW. fat uses generic mmap on normal disks. Doesn't it also have above bugs?
- * I don't think Msdos erases space in last sector.
- *
- * If you fix generic_file_mmap, you can remove this file and use it.
- */
-
-#include "hpfs_fn.h"
-
-/*
- * Fill in the supplied page for mmap
- */
-
-static unsigned long hpfs_file_mmap_nopage(
-	struct vm_area_struct * area,
-	unsigned long address,
-	int error_code)
-{
-	/*struct inode * inode = area->vm_inode;*/
-	struct inode * inode = area->vm_file->f_dentry->d_inode;
-	unsigned long page;
-	unsigned int clear;
-	loff_t pos;
-	long gap;	/* distance from eof to pos */
-
-	page = __get_free_page(GFP_KERNEL);
-	if (!page)
-		return page;
-	address &= PAGE_MASK;
-	pos = address - area->vm_start + area->vm_offset;
-
-	clear = 0;
-	gap = inode->i_size - pos;
-	if (gap <= 0){
-		/* mmaping beyond end of file */
-		clear = PAGE_SIZE;
-	}else{
-		int cur_read;
-		int need_read;
-		/*struct file *filp = area->vm_file;*/
-		struct file filp;
-		if (gap < PAGE_SIZE){
-			clear = PAGE_SIZE - gap;
-		}
-		filp.f_reada = 0;
-		filp.f_pos = pos;
-		filp.f_dentry=area->vm_file->f_dentry;
-		need_read = PAGE_SIZE - clear;
-		{
-			mm_segment_t cur_fs = get_fs();
-			set_fs (KERNEL_DS);
-			cur_read = generic_file_read (&filp,(char*)page
-				,need_read,&pos);
-			set_fs (cur_fs);
-		}
-		if (cur_read != need_read){
-			hpfs_error(inode->i_sb, "Error while reading an mmap file %08x", inode->i_ino);
-		}
-	}
-	if (clear > 0){
-		memset ((char*)page+PAGE_SIZE-clear,0,clear);
-	}
-	return page;
-}
-
-struct vm_operations_struct hpfs_file_mmap = {
-	NULL,			/* open */
-	NULL,			/* close */
-	NULL,			/* unmap */
-	NULL,			/* protect */
-	NULL,			/* sync */
-	NULL,			/* advise */
-	hpfs_file_mmap_nopage,	/* nopage */
-	NULL,			/* wppage */
-	NULL,			/* swapout */
-	NULL,			/* swapin */
-};
-
-/*
- * This is used for a general mmap of an msdos file
- * Returns 0 if ok, or a negative error code if not.
- */
-int hpfs_mmap(struct file * file, struct vm_area_struct * vma)
-{
-	struct inode *inode = file->f_dentry->d_inode;
-	/*printk("start mmap\n");*/
-	if (vma->vm_flags & VM_SHARED)	/* only PAGE_COW or read-only supported now */
-		return -EINVAL;
-	if (vma->vm_offset & (inode->i_sb->s_blocksize - 1))
-		return -EINVAL;
-	if (!inode->i_sb || !S_ISREG(inode->i_mode))
-		return -EACCES;
-	/*if (!IS_RDONLY(inode)) {
-		inode->i_atime = CURRENT_TIME;
-		mark_inode_dirty(inode);
-	}*/
-
-	vma->vm_file = file;
-	/*inode->i_count++;*/
-	file->f_count++;
-	vma->vm_ops = &hpfs_file_mmap;
-	/*printk("end mmap\n");*/
-	return 0;
-}
diff -u --recursive --new-file v2.3.8/linux/fs/hpfs/super.c linux/fs/hpfs/super.c
--- v2.3.8/linux/fs/hpfs/super.c	Tue Jun  8 10:47:58 1999
+++ linux/fs/hpfs/super.c	Sun Jun 27 10:10:41 1999
@@ -283,7 +283,7 @@
X 	return 1;
X }
X 
-static inline void hpfs_help()
+static inline void hpfs_help(void)
X {
X 	printk("\n\
X HPFS filesystem options:\n\
diff -u --recursive --new-file v2.3.8/linux/fs/inode.c linux/fs/inode.c
--- v2.3.8/linux/fs/inode.c	Thu Jun 17 23:11:01 1999
+++ linux/fs/inode.c	Tue Jun 29 14:03:05 1999
@@ -231,7 +231,7 @@
X void clear_inode(struct inode *inode)
X {
X 	if (inode->i_nrpages)
-		truncate_inode_pages(inode, 0);
+		BUG();
X 	wait_on_inode(inode);
X 	if (IS_QUOTAINIT(inode))
X 		DQUOT_DROP(inode);
@@ -261,6 +261,8 @@
X 		if (tmp == head)
X 			break;
X 		inode = list_entry(tmp, struct inode, i_list);
+		if (inode->i_nrpages)
+			truncate_inode_pages(inode, 0);
X 		clear_inode(inode);
X 		count++;
X 	}
@@ -735,6 +737,8 @@
X 				if (op && op->delete_inode) {
X 					void (*delete)(struct inode *) = op->delete_inode;
X 					spin_unlock(&inode_lock);
+					if (inode->i_nrpages)
+						truncate_inode_pages(inode, 0);
X 					delete(inode);
X 					spin_lock(&inode_lock);
X 				}
@@ -778,8 +782,14 @@
X 
X int bmap(struct inode * inode, int block)
X {
-	if (inode->i_op && inode->i_op->bmap)
-		return inode->i_op->bmap(inode, block);
+	struct buffer_head tmp;
+
+	if (inode->i_op && inode->i_op->get_block) {
+		tmp.b_state = 0;
+		tmp.b_blocknr = 0;
+		inode->i_op->get_block(inode, block, &tmp, 0);
+		return tmp.b_blocknr;
+	}
X 	return 0;
X }
X 
diff -u --recursive --new-file v2.3.8/linux/fs/ioctl.c linux/fs/ioctl.c
--- v2.3.8/linux/fs/ioctl.c	Wed Mar 24 08:08:53 1999
+++ linux/fs/ioctl.c	Sat Jun 26 12:04:39 1999
@@ -18,14 +18,21 @@
X 
X 	switch (cmd) {
X 		case FIBMAP:
+		{
+			struct buffer_head tmp;
+
X 			if (inode->i_op == NULL)
X 				return -EBADF;
-		    	if (inode->i_op->bmap == NULL)
+		    	if (inode->i_op->get_block == NULL)
X 				return -EINVAL;
X 			if ((error = get_user(block, (int *) arg)) != 0)
X 				return error;
-			block = inode->i_op->bmap(inode,block);
-			return put_user(block, (int *) arg);
+
+			tmp.b_state = 0;
+			tmp.b_blocknr = 0;
+			inode->i_op->get_block(inode, block, &tmp, 0);
+			return put_user(tmp.b_blocknr, (int *) arg);
+		}
X 		case FIGETBSZ:
X 			if (inode->i_sb == NULL)
X 				return -EBADF;
diff -u --recursive --new-file v2.3.8/linux/fs/isofs/dir.c linux/fs/isofs/dir.c
--- v2.3.8/linux/fs/isofs/dir.c	Fri Apr 23 21:20:38 1999
+++ linux/fs/isofs/dir.c	Sun Jun 27 10:10:41 1999
@@ -57,11 +57,14 @@
X 	NULL,			/* rename */
X 	NULL,			/* readlink */
X 	NULL,			/* follow_link */
+	NULL,			/* get_block */
X 	NULL,			/* readpage */
X 	NULL,			/* writepage */
-	NULL,			/* bmap */
+	NULL,			/* flushpage */
X 	NULL,			/* truncate */
-	NULL			/* permission */
+	NULL,			/* permission */
+	NULL,			/* smap */
+	NULL			/* revalidate */
X };
X 
X static int isofs_name_translate(char * old, int len, char * new)
diff -u --recursive --new-file v2.3.8/linux/fs/isofs/file.c linux/fs/isofs/file.c
--- v2.3.8/linux/fs/isofs/file.c	Sat Jun 19 18:20:13 1999
+++ linux/fs/isofs/file.c	Sun Jun 27 10:10:41 1999
@@ -48,10 +48,12 @@
X 	NULL,			/* rename */
X 	NULL,			/* readlink */
X 	NULL,			/* follow_link */
-	isofs_bmap,		/* bmap */
+	isofs_get_block,	/* get_block */
X 	block_read_full_page,	/* readpage */
X 	NULL,			/* writepage */
X NULL, /* flushpage */
X 	NULL,	       		/* truncate */
-	NULL			/* permission */
+	NULL,			/* permission */
+	NULL,			/* smap */
+	NULL			/* revalidate */
X };
diff -u --recursive --new-file v2.3.8/linux/fs/isofs/inode.c linux/fs/isofs/inode.c
--- v2.3.8/linux/fs/isofs/inode.c	Sat Jun 19 18:20:13 1999
+++ linux/fs/isofs/inode.c	Sun Jun 27 10:10:41 1999
@@ -55,7 +55,7 @@
X static int isofs_cmp_ms(struct dentry *dentry, struct qstr *a, struct qstr *b);
X #endif
X 
-void isofs_put_super(struct super_block *sb)
+static void isofs_put_super(struct super_block *sb)
X {
X #ifdef CONFIG_JOLIET
X 	if (sb->u.isofs_sb.s_nls_iocharset) {
@@ -73,6 +73,9 @@
X 	return;
X }
X 
+static void isofs_read_inode(struct inode *);
+static int isofs_statfs (struct super_block *, struct statfs *, int);
+
X static struct super_operations isofs_sops = {
X 	isofs_read_inode,
X 	NULL,			/* write_inode */
@@ -487,8 +490,8 @@
X  * Note: a check_disk_change() has been done immediately prior
X  * to this call, so we don't need to check again.
X  */
-struct super_block *isofs_read_super(struct super_block *s, void *data,
-				     int silent)
+static struct super_block *isofs_read_super(struct super_block *s, void *data,
+					    int silent)
X {
X 	kdev_t				dev = s->s_dev;
X 	struct buffer_head	      * bh = NULL, *pri_bh = NULL;
@@ -894,7 +897,7 @@
X 	return NULL;
X }
X 
-int isofs_statfs (struct super_block *sb, struct statfs *buf, int bufsiz)
+static int isofs_statfs (struct super_block *sb, struct statfs *buf, int bufsiz)
X {
X 	struct statfs tmp;
X 
@@ -910,96 +913,115 @@
X 	return copy_to_user(buf, &tmp, bufsiz) ? -EFAULT : 0;
X }
X 
-static int do_isofs_bmap(struct inode * inode,int block)
+/* Life is simpler than for other filesystem since we never
+ * have to create a new block, only find an existing one.
+ */
+int isofs_get_block(struct inode *inode, long iblock,
+		    struct buffer_head *bh_result, int create)
X {
-	off_t b_off, offset, size;
-	struct inode *ino;
+	off_t b_off, offset, sect_size;
X 	unsigned int firstext;
X 	unsigned long nextino;
-	int i;
+	int i, err;
X 
-	if (block<0) {
-		printk("_isofs_bmap: block<0");
-		return 0;
-	}
+	lock_kernel();
X 
-	b_off = block << ISOFS_BUFFER_BITS(inode);
+	err = -EROFS;
+	if (create)
+		goto abort_create_attempted;
X 
-	/*
-	 * If we are beyond the end of this file, don't give out any
+	err = -EIO;
+	if (iblock < 0)
+		goto abort_negative;
+
+	b_off = iblock << ISOFS_BUFFER_BITS(inode);
+
+	/* If we are beyond the end of this file, don't give out any
X 	 * blocks.
X 	 */
-	if( b_off > inode->i_size )
-	  {
-	    off_t	max_legal_read_offset;
-
-	    /*
-	     * If we are *way* beyond the end of the file, print a message.
-	     * Access beyond the end of the file up to the next page boundary
-	     * is normal, however because of the way the page cache works.
-	     * In this case, we just return 0 so that we can properly fill
-	     * the page with useless information without generating any
-	     * I/O errors.
-	     */
-	    max_legal_read_offset = (inode->i_size + PAGE_SIZE - 1)
-	      & ~(PAGE_SIZE - 1);
-	    if( b_off >= max_legal_read_offset )
-	      {
-
-		printk("_isofs_bmap: block>= EOF(%d, %ld)\n", block,
-		       inode->i_size);
-	      }
-	    return 0;
-	  }
+	if (b_off > inode->i_size) {
+		off_t max_legal_read_offset;
+
+		/* If we are *way* beyond the end of the file, print a message.
+		 * Access beyond the end of the file up to the next page boundary
+		 * is normal, however because of the way the page cache works.
+		 * In this case, we just return 0 so that we can properly fill
+		 * the page with useless information without generating any
+		 * I/O errors.
+		 */
+		max_legal_read_offset = (inode->i_size + PAGE_SIZE - 1)
+			& ~(PAGE_SIZE - 1);
+		if (b_off >= max_legal_read_offset)
+			goto abort_beyond_end;
+	}
+
+	offset    = 0;
+	firstext  = inode->u.isofs_i.i_first_extent;
+	sect_size = inode->u.isofs_i.i_section_size;
+	nextino   = inode->u.isofs_i.i_next_section_ino;
X 
-	offset = 0;
-	firstext = inode->u.isofs_i.i_first_extent;
-	size = inode->u.isofs_i.i_section_size;
-	nextino = inode->u.isofs_i.i_next_section_ino;
-#ifdef DEBUG
-	printk("first inode: inode=%x nextino=%x firstext=%u size=%lu\n",
-		inode->i_ino, nextino, firstext, size);
-#endif
X 	i = 0;
X 	if (nextino) {
-		while(b_off >= offset + size) {
-			offset += size;
+		while (b_off >= (offset + sect_size)) {
+			struct inode *ninode;
X 
-			if(nextino == 0) return 0;
-			ino = iget(inode->i_sb, nextino);
-			if(!ino) return 0;
-			firstext = ino->u.isofs_i.i_first_extent;
-			size = ino->u.isofs_i.i_section_size;
-#ifdef DEBUG
-			printk("read inode: inode=%lu ino=%lu nextino=%lu firstext=%u size=%lu\n",
-			       inode->i_ino, nextino, ino->u.isofs_i.i_next_section_ino, firstext, size);
-#endif
-			nextino = ino->u.isofs_i.i_next_section_ino;
-			iput(ino);
-		
-			if(++i > 100) {
-				printk("isofs_bmap: More than 100 file sections ?!?, aborting...\n");
-				printk("isofs_bmap: ino=%lu block=%d firstext=%u size=%u nextino=%lu\n",
-				       inode->i_ino, block, firstext, (unsigned)size, nextino);
-				return 0;
-			}
+			offset += sect_size;
+			if (nextino == 0)
+				goto abort;
+			ninode = iget(inode->i_sb, nextino);
+			if (!ninode)
+				goto abort;
+			firstext  = ninode->u.isofs_i.i_first_extent;
+			sect_size = ninode->u.isofs_i.i_section_size;
+			nextino   = ninode->u.isofs_i.i_next_section_ino;
+			iput(ninode);
+
+			if (++i > 100)
+				goto abort_too_many_sections;
X 		}
X 	}
-#ifdef DEBUG
-	printk("isofs_bmap: mapped inode:block %x:%d to block %lu\n",
-		inode->i_ino, block, (b_off - offset + firstext) >> ISOFS_BUFFER_BITS(inode));
-#endif
-	return (b_off - offset + firstext) >> ISOFS_BUFFER_BITS(inode);
-}
X 
-int isofs_bmap(struct inode * inode,int block)
-{
-	int retval;
+	bh_result->b_dev = inode->i_dev;
+	bh_result->b_blocknr =
+		(b_off - offset + firstext) >> ISOFS_BUFFER_BITS(inode);
+	bh_result->b_state |= (1UL << BH_Mapped);
+	err = 0;
X 
-	lock_kernel();
-	retval = do_isofs_bmap(inode, block);
+abort:
X 	unlock_kernel();
-	return retval;
+	return err;
+
+abort_create_attempted:
+	printk("_isofs_bmap: Kernel tries to allocate a block\n");
+	goto abort;
+
+abort_negative:
+	printk("_isofs_bmap: block < 0\n");
+	goto abort;
+
+abort_beyond_end:
+	printk("_isofs_bmap: block >= EOF (%ld, %ld)\n",
+	       iblock, inode->i_size);
+	goto abort;
+
+abort_too_many_sections:
+	printk("isofs_bmap: More than 100 file sections ?!?, aborting...\n");
+	printk("isofs_bmap: ino=%lu block=%ld firstext=%u sect_size=%u nextino=%lu\n",
+	       inode->i_ino, iblock, firstext, (unsigned) sect_size, nextino);
+	goto abort;
+}
+
+int isofs_bmap(struct inode *inode, int block)
+{
+	struct buffer_head dummy;
+	int error;
+
+	dummy.b_state = 0;
+	dummy.b_blocknr = -1000;
+	error = isofs_get_block(inode, block, &dummy, 0);
+	if (!error)
+		return dummy.b_blocknr;
+	return 0;
X }
X 
X static void test_and_set_uid(uid_t *p, uid_t value)
@@ -1101,7 +1123,7 @@
X 	goto out;
X }
X 
-void isofs_read_inode(struct inode * inode)
+static void isofs_read_inode(struct inode * inode)
X {
X 	struct super_block *sb = inode->i_sb;
X 	unsigned long bufsize = ISOFS_BUFFER_SIZE(inode);
diff -u --recursive --new-file v2.3.8/linux/fs/isofs/symlink.c linux/fs/isofs/symlink.c
--- v2.3.8/linux/fs/isofs/symlink.c	Tue Jun  1 23:25:47 1999
+++ linux/fs/isofs/symlink.c	Sun Jun 27 10:10:41 1999
@@ -38,11 +38,14 @@
X 	NULL,			/* rename */
X 	isofs_readlink,		/* readlink */
X 	isofs_follow_link,	/* follow_link */
+	NULL,			/* get_block */
X 	NULL,			/* readpage */
X 	NULL,			/* writepage */
-	NULL,			/* bmap */
+	NULL,			/* flushpage */
X 	NULL,			/* truncate */
-	NULL			/* permission */
+	NULL,			/* permission */
+	NULL,			/* smap */
+	NULL			/* revalidate */
X };
X 
X static int isofs_readlink(struct dentry * dentry, char * buffer, int buflen)
diff -u --recursive --new-file v2.3.8/linux/fs/lockd/host.c linux/fs/lockd/host.c
--- v2.3.8/linux/fs/lockd/host.c	Tue May 11 14:37:40 1999
+++ linux/fs/lockd/host.c	Wed Jun 30 10:22:00 1999
@@ -140,6 +140,7 @@
X 	host->h_nextrebind = jiffies + NLM_HOST_REBIND;
X 	host->h_expires    = jiffies + NLM_HOST_EXPIRE;
X 	host->h_count      = 1;
+	init_waitqueue_head(&host->h_gracewait);
X 	host->h_state      = 0;			/* pseudo NSM state */
X 	host->h_nsmstate   = 0;			/* real NSM state */
X 	host->h_exportent  = clnt;
diff -u --recursive --new-file v2.3.8/linux/fs/locks.c linux/fs/locks.c
--- v2.3.8/linux/fs/locks.c	Tue Jun 22 10:45:40 1999
+++ linux/fs/locks.c	Mon Jun 28 13:32:28 1999
@@ -563,11 +563,14 @@
X 	/* Candidates for mandatory locking have the setgid bit set
X 	 * but no group execute bit -  an otherwise meaningless combination.
X 	 */
-	if (IS_MANDLOCK(inode) &&
-	    (inode->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID)
-		return (locks_mandatory_area(read_write, inode, filp, offset,
-					     count));
-	return (0);
+	if (IS_MANDLOCK(inode) && (inode->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID) {
+		int retval;
+		lock_kernel();
+		retval = locks_mandatory_area(read_write, inode, filp, offset, count);
+		unlock_kernel();
+		return retval;
+	}
+	return 0;
X }
X 
X int locks_mandatory_locked(struct inode *inode)
diff -u --recursive --new-file v2.3.8/linux/fs/minix/dir.c linux/fs/minix/dir.c
--- v2.3.8/linux/fs/minix/dir.c	Fri Apr 23 21:20:38 1999
+++ linux/fs/minix/dir.c	Sun Jun 27 10:10:41 1999
@@ -52,11 +52,14 @@
X 	minix_rename,		/* rename */
X 	NULL,			/* readlink */
X 	NULL,			/* follow_link */
+	NULL,			/* get_block */
X 	NULL,			/* readpage */
X 	NULL,			/* writepage */
-	NULL,			/* bmap */
+	NULL,			/* flushpage */
X 	NULL,			/* truncate */
-	NULL			/* permission */
+	NULL,			/* permission */
+	NULL,			/* smap */
+	NULL			/* revalidate */
X };
X 
X static int minix_readdir(struct file * filp,
diff -u --recursive --new-file v2.3.8/linux/fs/minix/file.c linux/fs/minix/file.c
--- v2.3.8/linux/fs/minix/file.c	Sat Jun 19 12:15:14 1999
+++ linux/fs/minix/file.c	Sun Jun 27 10:10:41 1999
@@ -27,50 +27,14 @@
X #include <linux/fs.h>
X #include <linux/minix_fs.h>
X 
-static int minix_writepage(struct file *file, struct page *page)
-{
-	struct dentry *dentry = file->f_dentry;
-	struct inode *inode = dentry->d_inode;
-	unsigned long block;
-	int *p, nr[PAGE_SIZE/BLOCK_SIZE];
-	int i, err, created;
-	struct buffer_head *bh;
-
-	i = PAGE_SIZE / BLOCK_SIZE;
-	block = page->offset / BLOCK_SIZE;
-	p = nr;
-	bh = page->buffers;
-	do {
-		if (bh && bh->b_blocknr)
-			*p = bh->b_blocknr;
-		else
-			*p = minix_getblk_block(inode, block, 1, &err, &created);
-		if (!*p)
-			return -EIO;
-		i--;
-		block++;
-		p++;
-		if (bh)
-			bh = bh->b_this_page;
-	} while(i > 0);
-
-	/* IO start */
-	brw_page(WRITE, page, inode->i_dev, nr, BLOCK_SIZE, 1);
-	return 0;
-}
-
-static long minix_write_one_page(struct file *file, struct page *page, unsigned long offset, unsigned long bytes, const char *buf)
-{
-	return block_write_one_page(file, page, offset, bytes, buf, minix_getblk_block);
-}
-
X /*
X  * Write to a file (through the page cache).
X  */
X static ssize_t
X minix_file_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
X {
-	return generic_file_write(file, buf, count, ppos, minix_write_one_page);
+	return generic_file_write(file, buf, count,
+				  ppos, block_write_partial_page);
X }
X 
X /*
@@ -88,7 +52,10 @@
X 	NULL,			/* no special open is needed */
X 	NULL,			/* flush */
X 	NULL,			/* release */
-	minix_sync_file		/* fsync */
+	minix_sync_file,	/* fsync */
+	NULL,			/* fasync */
+	NULL,			/* check_media_change */
+	NULL			/* revalidate */
X };
X 
X struct inode_operations minix_file_inode_operations = {
@@ -104,12 +71,12 @@
X 	NULL,			/* rename */
X 	NULL,			/* readlink */
X 	NULL,			/* follow_link */
-	generic_readpage,	/* readpage */
-	minix_writepage,	/* writepage */
-	minix_bmap,		/* bmap */
+	minix_get_block,	/* get_block */
+	block_read_full_page,	/* readpage */
+	block_write_full_page,	/* writepage */
+	block_flushpage,	/* flushpage */
X 	minix_truncate,		/* truncate */
X 	NULL,			/* permission */
X 	NULL,			/* smap */
X 	NULL,			/* revalidate */
-	block_flushpage,	/* flushpage */
X };
diff -u --recursive --new-file v2.3.8/linux/fs/minix/fsync.c linux/fs/minix/fsync.c
--- v2.3.8/linux/fs/minix/fsync.c	Thu Nov 12 11:44:09 1998
+++ linux/fs/minix/fsync.c	Tue Jun 29 09:22:08 1999
@@ -53,7 +53,7 @@
X 		return 0;
X 	}
X 	ll_rw_block(WRITE, 1, &bh);
-	bh->b_count--;
+ atomic_dec(&bh->b_count);
X 	return 0;
X }
X 
@@ -190,7 +190,7 @@
X 		return 0;
X 	}
X 	ll_rw_block(WRITE, 1, &bh);
-	bh->b_count--;
+ atomic_dec(&bh->b_count);
X 	return 0;
X }
X 
diff -u --recursive --new-file v2.3.8/linux/fs/minix/inode.c linux/fs/minix/inode.c
--- v2.3.8/linux/fs/minix/inode.c	Wed Jun 16 19:26:27 1999
+++ linux/fs/minix/inode.c	Sun Jun 27 10:10:41 1999
@@ -19,6 +19,7 @@
X #include <linux/stat.h>
X #include <linux/locks.h>
X #include <linux/init.h>
+#include <linux/smp_lock.h>
X 
X #include <asm/system.h>
X #include <asm/uaccess.h>
@@ -361,112 +362,127 @@
X 	return tmp;
X }
X 
-static int V1_minix_bmap(struct inode * inode,int block)
+static int V1_minix_block_map(struct inode * inode, long block)
X {
-	int i;
+	int i, ret;
X 
-	if (block<0) {
+	ret = 0;
+	lock_kernel();
+	if (block < 0) {
X 		printk("minix_bmap: block<0");
-		return 0;
+		goto out;
X 	}
X 	if (block >= (inode->i_sb->u.minix_sb.s_max_size/BLOCK_SIZE)) {
X 		printk("minix_bmap: block>big");
-		return 0;
+		goto out;
+	}
+	if (block < 7) {
+		ret = V1_inode_bmap(inode,block);
+		goto out;
X 	}
-	if (block < 7)
-		return V1_inode_bmap(inode,block);
X 	block -= 7;
X 	if (block < 512) {
X 		i = V1_inode_bmap(inode,7);
X 		if (!i)
-			return 0;
-		return V1_block_bmap(bread(inode->i_dev,i,BLOCK_SIZE),block);
+			goto out;
+		ret = V1_block_bmap(bread(inode->i_dev, i,
+					  BLOCK_SIZE), block);
+		goto out;
X 	}
X 	block -= 512;
X 	i = V1_inode_bmap(inode,8);
X 	if (!i)
-		return 0;
+		goto out;
X 	i = V1_block_bmap(bread(inode->i_dev,i,BLOCK_SIZE),block>>9);
X 	if (!i)
-		return 0;
-	return V1_block_bmap(bread(inode->i_dev,i,BLOCK_SIZE),block & 511);
+		goto out;
+	ret = V1_block_bmap(bread(inode->i_dev, i, BLOCK_SIZE),
+			    block & 511);
+out:
+	unlock_kernel();
+	return ret;
X }
X 
X /*
X  * The minix V2 fs bmap functions.
X  */
-#define V2_inode_bmap(inode,nr) (((unsigned long  *)(inode)->u.minix_i.u.i2_data)[(nr)])
+#define V2_inode_bmap(inode,nr) (((unsigned int *)(inode)->u.minix_i.u.i2_data)[(nr)])
X static int V2_block_bmap(struct buffer_head * bh, int nr)
X {
X 	int tmp;
X 
X 	if (!bh)
X 		return 0;
-	tmp = ((unsigned long *) bh->b_data)[nr];
+	tmp = ((unsigned int *) bh->b_data)[nr];
X 	brelse(bh);
X 	return tmp;
X }
X 
-static int V2_minix_bmap(struct inode * inode, int block)
+static int V2_minix_block_map(struct inode * inode, int block)
X {
-	int i;
+	int i, ret;
X 
-	if (block<0) {
+	ret = 0;
+	lock_kernel();
+	if (block < 0) {
X 		printk("minix_bmap: block<0");
-		return 0;
+		goto out;
X 	}
X 	if (block >= (inode->i_sb->u.minix_sb.s_max_size/BLOCK_SIZE)) {
X 		printk("minix_bmap: block>big");
-		return 0;
+		goto out;
+	}
+	if (block < 7) {
+		ret = V2_inode_bmap(inode,block);
+		goto out;
X 	}
-	if (block < 7)
-		return V2_inode_bmap(inode,block);
X 	block -= 7;
X 	if (block < 256) {
-		i = V2_inode_bmap(inode,7);
+		i = V2_inode_bmap(inode, 7);
X 		if (!i)
-			return 0;
-		return V2_block_bmap(bread(inode->i_dev,i,BLOCK_SIZE),block);
+			goto out;
+		ret = V2_block_bmap(bread(inode->i_dev, i,
+					  BLOCK_SIZE), block);
+		goto out;
X 	}
X 	block -= 256;
-	if (block < 256*256) {
-		i = V2_inode_bmap(inode,8);
+	if (block < (256 * 256)) {
+		i = V2_inode_bmap(inode, 8);
X 		if (!i)
-			return 0;
-		i = V2_block_bmap(bread(inode->i_dev,i,BLOCK_SIZE),block >> 8);
+			goto out;
+		i = V2_block_bmap(bread(inode->i_dev, i, BLOCK_SIZE),
+				  block >> 8);
X 		if (!i)
-			return 0;
-		return V2_block_bmap(bread(inode->i_dev,i,BLOCK_SIZE),block & 255);
+			goto out;
+		ret = V2_block_bmap(bread(inode->i_dev, i, BLOCK_SIZE),
+				    block & 255);
+		goto out;
X 	}
-	block -= 256*256;
-	i = V2_inode_bmap(inode,9);
+	block -= (256 * 256);
+	i = V2_inode_bmap(inode, 9);
X 	if (!i)
-		return 0;
-	i = V2_block_bmap(bread(inode->i_dev,i,BLOCK_SIZE),block >> 16);
+		goto out;
+	i = V2_block_bmap(bread(inode->i_dev, i, BLOCK_SIZE),
+			  block >> 16);
X 	if (!i)
-		return 0;
-	i = V2_block_bmap(bread(inode->i_dev,i,BLOCK_SIZE),(block >> 8) & 255);
+		goto out;
+	i = V2_block_bmap(bread(inode->i_dev, i, BLOCK_SIZE),
+			  (block >> 8) & 255);
X 	if (!i)
-		return 0;
-	return V2_block_bmap(bread(inode->i_dev,i,BLOCK_SIZE),block & 255);
-}
-
-/*
- * The global minix fs bmap function.
- */
-int minix_bmap(struct inode * inode, int block)
-{
-	if (INODE_VERSION(inode) == MINIX_V1)
-		return V1_minix_bmap(inode, block);
-	else
-		return V2_minix_bmap(inode, block);
+		goto out;
+	ret = V2_block_bmap(bread(inode->i_dev, i, BLOCK_SIZE),
+			    block & 255);
+out:
+	unlock_kernel();
+	return ret;
X }
X 
X /*
X  * The minix V1 fs getblk functions.
X  */
-static struct buffer_head * V1_inode_getblk(struct inode * inode, int nr, int create,
-					    int metadata, int *phys_block, int *created)
+static struct buffer_head * V1_inode_getblk(struct inode * inode, int nr,
+					    int new_block, int *err,
+					    int metadata, int *phys, int *new)
X {
X 	int tmp;
X 	unsigned short *p;
@@ -483,15 +499,30 @@
X 			brelse(result);
X 			goto repeat;
X 		} else {
-			*phys_block = tmp;
+			*phys = tmp;
X 			return NULL;
X 		}
X 	}
-	if (!create)
-		return NULL;
+	*err = -EFBIG;
+
+	/* Check file limits.. */
+	{
+		unsigned long limit = current->rlim[RLIMIT_FSIZE].rlim_cur;
+		if (limit < RLIM_INFINITY) {
+			limit >>= BLOCK_SIZE_BITS;
+			if (new_block >= limit) {
+				send_sig(SIGXFSZ, current, 0);
+				*err = -EFBIG;
+				return NULL;
+			}
+		}
+	}
+
X 	tmp = minix_new_block(inode->i_sb);
-	if (!tmp)
+	if (!tmp) {
+		*err = -ENOSPC;
X 		return NULL;
+	}
X 	if (metadata) {
X 		result = getblk(inode->i_dev, tmp, BLOCK_SIZE);
X 		if (*p) {
@@ -504,12 +535,18 @@
X 		mark_buffer_dirty(result, 1);
X 	} else {
X 		if (*p) {
+			/*
+			 * Nobody is allowed to change block allocation
+			 * state from under us:
+			 */
+			BUG();
X 			minix_free_block(inode->i_sb, tmp);
X 			goto repeat;
X 		}
-		*phys_block = tmp;
+		*phys = tmp;
X 		result = NULL;
-		*created = 1;
+		*err = 0;
+		*new = 1;
X 	}
X 	*p = tmp;
X 
@@ -519,22 +556,22 @@
X }
X 
X static struct buffer_head * V1_block_getblk(struct inode * inode,
-	struct buffer_head * bh, int nr, int create,
-	int metadata, int *phys_block, int *created)
+	struct buffer_head * bh, int nr, int new_block, int *err,
+	int metadata, int *phys, int *new)
X {
X 	int tmp;
X 	unsigned short *p;
X 	struct buffer_head * result;
+	unsigned long limit;
X 
+	result = NULL;
X 	if (!bh)
-		return NULL;
+		goto out;
X 	if (!buffer_uptodate(bh)) {
X 		ll_rw_block(READ, 1, &bh);
X 		wait_on_buffer(bh);
-		if (!buffer_uptodate(bh)) {
-			brelse(bh);
-			return NULL;
-		}
+		if (!buffer_uptodate(bh))
+			goto out;
X 	}
X 	p = nr + (unsigned short *) bh->b_data;
X repeat:
@@ -542,27 +579,29 @@
X 	if (tmp) {
X 		if (metadata) {
X 			result = getblk(bh->b_dev, tmp, BLOCK_SIZE);
-			if (tmp == *p) {
-				brelse(bh);
-				return result;
-			}
+			if (tmp == *p)
+				goto out;
X 			brelse(result);
X 			goto repeat;
X 		} else {
-			*phys_block = tmp;
-			brelse(bh);
-			return NULL;
+			*phys = tmp;
+			goto out;
X 		}
X 	}
-	if (!create) {
-		brelse(bh);
-		return NULL;
+	*err = -EFBIG;
+
+	limit = current->rlim[RLIMIT_FSIZE].rlim_cur;
+	if (limit < RLIM_INFINITY) {
+		limit >>= BLOCK_SIZE_BITS;
+		if (new_block >= limit) {
+			send_sig(SIGXFSZ, current, 0);
+			goto out;
+		}
X 	}
+
X 	tmp = minix_new_block(inode->i_sb);
-	if (!tmp) {
-		brelse(bh);
-		return NULL;
-	}
+	if (!tmp)
+		goto out;
X 	if (metadata) {
X 		result = getblk(bh->b_dev, tmp, BLOCK_SIZE);
X 		if (*p) {
@@ -574,69 +613,118 @@
X 		mark_buffer_uptodate(result, 1);
X 		mark_buffer_dirty(result, 1);
X 	} else {
-		if (*p) {
-			minix_free_block(inode->i_sb, tmp);
-			goto repeat;
-		}
-		*phys_block = tmp;
-		result = NULL;
-		*created = 1;
+		*phys = tmp;
+		*new = 1;
+	}
+	if (*p) {
+		minix_free_block(inode->i_sb, tmp);
+		brelse(result);
+		goto repeat;
X 	}
X 
X 	*p = tmp;
X 	mark_buffer_dirty(bh, 1);
+	*err = 0;
+out:
X 	brelse(bh);
X 	return result;
X }
X 
-int V1_getblk_block(struct inode * inode, long block, int create, int *err, int *created)
+static int V1_get_block(struct inode * inode, long block,
+			struct buffer_head *bh_result, int create)
X {
-	struct buffer_head *bh, *tmp;
-	int phys_block;
+	int ret, err, new, phys, ptr;
+	struct buffer_head *bh;
X 
-	*err = -EIO;
-	if (block < 0) {
-		printk("minix_getblk: block<0");
-		return 0;
-	}
-	if (block >= inode->i_sb->u.minix_sb.s_max_size/BLOCK_SIZE) {
-		printk("minix_getblk: block>big");
+	if (!create) {
+		phys = V1_minix_block_map(inode, block);
+		if (phys) {
+			bh_result->b_dev = inode->i_dev;
+			bh_result->b_blocknr = phys;
+			bh_result->b_state |= (1UL << BH_Mapped);
+		}
X 		return 0;
X 	}
-	*created = 0;
-	if (block < 7) {
-		tmp = V1_inode_getblk(inode, block, create,
-				      0, &phys_block, created);
-		goto out;
-	}
-	block -= 7;
-	if (block < 512) {
-		bh = V1_inode_getblk(inode, 7, create, 1, NULL, NULL);
-		tmp = V1_block_getblk(inode, bh, block, create,
-				      0, &phys_block, created);
+
+	err = -EIO;
+	new = 0;
+	ret = 0;
+	bh = NULL;
+
+	lock_kernel();
+	if (block < 0)
+		goto abort_negative;
+	if (block >= inode->i_sb->u.minix_sb.s_max_size/BLOCK_SIZE)
+		goto abort_too_big;
+
+	err = 0;
+	ptr = block;
+	/*
+	 * ok, these macros clean the logic up a bit and make
+	 * it much more readable:
+	 */
+#define GET_INODE_DATABLOCK(x) \
+		V1_inode_getblk(inode, x, block, &err, 0, &phys, &new)
+#define GET_INODE_PTR(x) \
+		V1_inode_getblk(inode, x, block, &err, 1, NULL, NULL)
+#define GET_INDIRECT_DATABLOCK(x) \
+		V1_block_getblk(inode, bh, x, block, &err, 0, &phys, &new)
+#define GET_INDIRECT_PTR(x) \
+		V1_block_getblk(inode, bh, x, block, &err, 1, NULL, NULL)
+
+	if (ptr < 7) {
+		bh = GET_INODE_DATABLOCK(ptr);
X 		goto out;
X 	}
-	block -= 512;
-	bh = V1_inode_getblk(inode, 8, create, 1, NULL, NULL);
-	bh = V1_block_getblk(inode, bh, (block>>9) & 511, create, 1, NULL, NULL);
-	tmp = V1_block_getblk(inode, bh, block & 511, create, 0, &phys_block, created);
+	ptr -= 7;
+	if (ptr < 512) {
+		bh = GET_INODE_PTR(7);
+		goto get_indirect;
+	}
+	ptr -= 512;
+	bh = GET_INODE_PTR(8);
+	bh = GET_INDIRECT_PTR((ptr >> 9) & 511);
+get_indirect:
+	bh = GET_INDIRECT_DATABLOCK(ptr & 511);
+
+#undef GET_INODE_DATABLOCK
+#undef GET_INODE_PTR
+#undef GET_INDIRECT_DATABLOCK
+#undef GET_INDIRECT_PTR
X 
X out:
-	*err = 0;
-	return phys_block;
+	if (err)
+		goto abort;
+	bh_result->b_dev = inode->i_dev;
+	bh_result->b_blocknr = phys;
+	bh_result->b_state |= (1UL << BH_Mapped);
+	if (new)
+		bh_result->b_state |= (1UL << BH_New);
+abort:
+	unlock_kernel();
+	return err;
+
+abort_negative:
+	printk("minix_getblk: block<0");
+	goto abort;
+
+abort_too_big:
+	printk("minix_getblk: block>big");
+	goto abort;
X }
X 
X /*
X  * The minix V2 fs getblk functions.
X  */
-static struct buffer_head * V2_inode_getblk(struct inode * inode, int nr, int create,
-					    int metadata, int *phys_block, int *created)
+static struct buffer_head * V2_inode_getblk(struct inode * inode, int nr,
+					    int new_block, int *err,
+					    int metadata, int *phys, int *new)
X {
X 	int tmp;
-	unsigned long *p;
+	unsigned int *p;
X 	struct buffer_head * result;
X 
-	p = (unsigned long *) inode->u.minix_i.u.i2_data + nr;
+	p = (unsigned int *) inode->u.minix_i.u.i2_data + nr;
X repeat:
X 	tmp = *p;
X 	if (tmp) {
@@ -647,15 +735,30 @@
X 			brelse(result);
X 			goto repeat;
X 		} else {
-			*phys_block = tmp;
+			*phys = tmp;
X 			return NULL;
X 		}
X 	}
-	if (!create)
-		return NULL;
+	*err = -EFBIG;
+
+	/* Check file limits.. */
+	{
+		unsigned long limit = current->rlim[RLIMIT_FSIZE].rlim_cur;
+		if (limit < RLIM_INFINITY) {
+			limit >>= BLOCK_SIZE_BITS;
+			if (new_block >= limit) {
+				send_sig(SIGXFSZ, current, 0);
+				*err = -EFBIG;
+				return NULL;
+			}
+		}
+	}
+
X 	tmp = minix_new_block(inode->i_sb);
-	if (!tmp)
+	if (!tmp) {
+		*err = -ENOSPC;
X 		return NULL;
+	}
X 	if (metadata) {
X 		result = getblk(inode->i_dev, tmp, BLOCK_SIZE);
X 		if (*p) {
@@ -668,12 +771,18 @@
X 		mark_buffer_dirty(result, 1);
X 	} else {
X 		if (*p) {
+			/*
+			 * Nobody is allowed to change block allocation
+			 * state from under us:
+			 */
+			BUG();
X 			minix_free_block(inode->i_sb, tmp);
X 			goto repeat;
X 		}
-		*phys_block = tmp;
+		*phys = tmp;
X 		result = NULL;
-		*created = 1;
+		*err = 0;
+		*new = 1;
X 	}
X 	*p = tmp;
X 
@@ -683,50 +792,52 @@
X }
X 
X static struct buffer_head * V2_block_getblk(struct inode * inode,
-	struct buffer_head * bh, int nr, int create,
-	int metadata, int *phys_block, int *created)
+	struct buffer_head * bh, int nr, int new_block, int *err,
+	int metadata, int *phys, int *new)
X {
X 	int tmp;
-	unsigned long *p;
+	unsigned int *p;
X 	struct buffer_head * result;
+	unsigned long limit;
X 
+	result = NULL;
X 	if (!bh)
-		return NULL;
+		goto out;
X 	if (!buffer_uptodate(bh)) {
X 		ll_rw_block(READ, 1, &bh);
X 		wait_on_buffer(bh);
-		if (!buffer_uptodate(bh)) {
-			brelse(bh);
-			return NULL;
-		}
+		if (!buffer_uptodate(bh))
+			goto out;
X 	}
-	p = nr + (unsigned long *) bh->b_data;
+	p = nr + (unsigned int *) bh->b_data;
X repeat:
X 	tmp = *p;
X 	if (tmp) {
X 		if (metadata) {
X 			result = getblk(bh->b_dev, tmp, BLOCK_SIZE);
-			if (tmp == *p) {
-				brelse(bh);
-				return result;
-			}
+			if (tmp == *p)
+				goto out;
X 			brelse(result);
X 			goto repeat;
X 		} else {
-			*phys_block = tmp;
-			brelse(bh);
-			return NULL;
+			*phys = tmp;
+			goto out;
X 		}
X 	}
-	if (!create) {
-		brelse(bh);
-		return NULL;
+	*err = -EFBIG;
+
+	limit = current->rlim[RLIMIT_FSIZE].rlim_cur;
+	if (limit < RLIM_INFINITY) {
+		limit >>= BLOCK_SIZE_BITS;
+		if (new_block >= limit) {
+			send_sig(SIGXFSZ, current, 0);
+			goto out;
+		}
X 	}
+
X 	tmp = minix_new_block(inode->i_sb);
-	if (!tmp) {
-		brelse(bh);
-		return NULL;
-	}
+	if (!tmp)
+		goto out;
X 	if (metadata) {
X 		result = getblk(bh->b_dev, tmp, BLOCK_SIZE);
X 		if (*p) {
@@ -738,103 +849,151 @@
X 		mark_buffer_uptodate(result, 1);
X 		mark_buffer_dirty(result, 1);
X 	} else {
-		if (*p) {
-			minix_free_block(inode->i_sb, tmp);
-			goto repeat;
-		}
-		*phys_block = tmp;
-		result = NULL;
-		*created = 1;
+		*phys = tmp;
+		*new = 1;
+	}
+	if (*p) {
+		minix_free_block(inode->i_sb, tmp);
+		brelse(result);
+		goto repeat;
X 	}
X 
X 	*p = tmp;
X 	mark_buffer_dirty(bh, 1);
+	*err = 0;
+out:
X 	brelse(bh);
X 	return result;
X }
X 
-int V2_getblk_block(struct inode * inode, int block, int create, int *err, int *created)
+static int V2_get_block(struct inode * inode, long block,
+			struct buffer_head *bh_result, int create)
X {
-	struct buffer_head * bh, *tmp;
-	int phys_block;
+	int ret, err, new, phys, ptr;
+	struct buffer_head * bh;
X 
-	*err = -EIO;
-	if (block < 0) {
-		printk("minix_getblk: block<0");
-		return 0;
-	}
-	if (block >= inode->i_sb->u.minix_sb.s_max_size/BLOCK_SIZE) {
-		printk("minix_getblk: block>big");
+	if (!create) {
+		phys = V2_minix_block_map(inode, block);
+		if (phys) {
+			bh_result->b_dev = inode->i_dev;
+			bh_result->b_blocknr = phys;
+			bh_result->b_state |= (1UL << BH_Mapped);
+		}
X 		return 0;
X 	}
-	*created = 0;
-	if (block < 7) {
-		tmp = V2_inode_getblk(inode, block, create,
-				      0, &phys_block, created);
-		goto out;
-	}
-	block -= 7;
-	if (block < 256) {
-		bh = V2_inode_getblk(inode, 7, create, 1, NULL, NULL);
-		tmp = V2_block_getblk(inode, bh, block, create,
-				      0, &phys_block, created);
-		goto out;
-	}
-	block -= 256;
-	if (block < 256*256) {
-		bh = V2_inode_getblk(inode, 8, create, 1, NULL, NULL);
-		bh = V2_block_getblk(inode, bh, (block>>8) & 255, create,
-				     1, NULL, NULL);
-		tmp = V2_block_getblk(inode, bh, block & 255, create,
-				      0, &phys_block, created);
+
+	err = -EIO;
+	new = 0;
+	ret = 0;
+	bh = NULL;
+
+	lock_kernel();
+	if (block < 0)
+		goto abort_negative;
+	if (block >= inode->i_sb->u.minix_sb.s_max_size/BLOCK_SIZE)
+		goto abort_too_big;
+
+	err = 0;
+	ptr = block;
+	/*
+	 * ok, these macros clean the logic up a bit and make
+	 * it much more readable:
+	 */
+#define GET_INODE_DATABLOCK(x) \
+		V2_inode_getblk(inode, x, block, &err, 0, &phys, &new)
+#define GET_INODE_PTR(x) \
+		V2_inode_getblk(inode, x, block, &err, 1, NULL, NULL)
+#define GET_INDIRECT_DATABLOCK(x) \
+		V2_block_getblk(inode, bh, x, block, &err, 0, &phys, &new)
+#define GET_INDIRECT_PTR(x) \
+		V2_block_getblk(inode, bh, x, block, &err, 1, NULL, NULL)
+
+	if (ptr < 7) {
+		bh = GET_INODE_DATABLOCK(ptr);
X 		goto out;
X 	}
-	block -= 256*256;
-	bh = V2_inode_getblk(inode, 9, create, 1, NULL, NULL);
-	bh = V2_block_getblk(inode, bh, (block >> 16) & 255, create, 1, NULL, NULL);
-	bh = V2_block_getblk(inode, bh, (block >> 8) & 255, create, 1, NULL, NULL);
-	tmp = V2_block_getblk(inode, bh, block & 255, create, 0, &phys_block, created);
+	ptr -= 7;
+	if (ptr < 256) {
+		bh = GET_INODE_PTR(7);
+		goto get_indirect;
+	}
+	ptr -= 256;
+	if (ptr < 256*256) {
+		bh = GET_INODE_PTR(8);
+		goto get_double;
+	}
+	ptr -= 256*256;
+	bh = GET_INODE_PTR(9);
+	bh = GET_INDIRECT_PTR((ptr >> 16) & 255);
+get_double:
+	bh = GET_INDIRECT_PTR((ptr >> 8) & 255);
+get_indirect:
+	bh = GET_INDIRECT_DATABLOCK(ptr & 255);
+
+#undef GET_INODE_DATABLOCK
+#undef GET_INODE_PTR
+#undef GET_INDIRECT_DATABLOCK
+#undef GET_INDIRECT_PTR
X 
X out:
-	*err = 0;
-	return phys_block;
+	if (err)
+		goto abort;
+	bh_result->b_dev = inode->i_dev;
+	bh_result->b_blocknr = phys;
+	bh_result->b_state |= (1UL << BH_Mapped);
+	if (new)
+		bh_result->b_state |= (1UL << BH_New);
+abort:
+	unlock_kernel();
+	return err;
+
+abort_negative:
+	printk("minix_getblk: block<0");
+	goto abort;
+
+abort_too_big:
+	printk("minix_getblk: block>big");
+	goto abort;
X }
X 
-int minix_getblk_block (struct inode *inode, long block,
-			int create, int *err, int *created)
+int minix_get_block(struct inode *inode, long block,
+		    struct buffer_head *bh_result, int create)
X {
X 	if (INODE_VERSION(inode) == MINIX_V1)
-		return V1_getblk_block(inode, block, create, err, created);
+		return V1_get_block(inode, block, bh_result, create);
X 	else
-		return V2_getblk_block(inode, block, create, err, created);
+		return V2_get_block(inode, block, bh_result, create);
X }
X 
X /*
X  * the global minix fs getblk function.
X  */
-struct buffer_head *minix_getblk (struct inode *inode, int block, int create)
+struct buffer_head *minix_getblk(struct inode *inode, int block, int create)
X {
-	struct buffer_head *tmp = NULL;
-	int phys_block;
-	int err, created;
-
-	phys_block = minix_getblk_block(inode, block, create, &err, &created);
-	if (phys_block) {
-		tmp = getblk(inode->i_dev, phys_block, BLOCK_SIZE);
-		if (created) {
-			memset(tmp->b_data, 0, BLOCK_SIZE);
-			mark_buffer_uptodate(tmp, 1);
-			mark_buffer_dirty(tmp, 1);
+	struct buffer_head dummy;
+	int error;
+
+	dummy.b_state = 0;
+	dummy.b_blocknr = -1000;
+	error = minix_get_block(inode, block, &dummy, create);
+	if (!error && buffer_mapped(&dummy)) {
+		struct buffer_head *bh;
+		bh = getblk(dummy.b_dev, dummy.b_blocknr, BLOCK_SIZE);
+		if (buffer_new(&dummy)) {
SHAR_EOF
true || echo 'restore of patch-2.3.9 failed'
fi
echo 'End of  part 21'
echo 'File patch-2.3.9 is continued in part 22'
echo 22 > _shar_seq_.tmp
exit 0
#!/bin/sh
# This is a shell archive
# To extract the files from this archive, save it to a file, remove
# everything above the "!/bin/sh" line above, and type "sh file_name".
# existing files will NOT be overwritten unless -c is specified
#
# This is part 01 of a 26 - part archive
# do not concatenate these parts, unpack them in order with /bin/sh
#
if test -r _shar_seq_.tmp; then
        echo 'Must unpack archives in sequence!'
        echo Please unpack part `cat _shar_seq_.tmp` next
        exit 1
fi
# ============= patch-2.3.9 ==============
if test -f 'patch-2.3.9' -a X"$1" != X"-c"; then
        echo 'x - skipping patch-2.3.9 (File already exists)'
        rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting patch-2.3.9 (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'patch-2.3.9' &&
diff -u --recursive --new-file v2.3.8/linux/CREDITS linux/CREDITS
--- v2.3.8/linux/CREDITS	Wed Jun 16 19:26:27 1999
+++ linux/CREDITS	Tue Jun 29 09:12:32 1999
@@ -337,6 +337,10 @@
X S: 75252 Paris Cedex 05
X S: France
X 
+N: Ulf Carlsson
+D: SGI Indy audio (HAL2) drivers
+E: ul...@bun.falkenberg.se
+
X N: Ed Carp
X E: ec...@netcom.com
X D: uucp, elm, pine, pico port
@@ -466,6 +470,14 @@
X S: Warrendale, Pennsylvania 15086
X S: USA
X 
+N: Alex deVries
+E: puf...@redhat.com
+D: Various SGI parts, bits of HAL2 and Newport
+S: 18 Bernier Terrace
+S: Kanata, Ontario
+S: K2L 2V@
+S: CANADA
+
X N: Eddie C. Dost
X E: e...@skynet.be
X D: Linux/Sparc kernel hacker
@@ -971,18 +983,20 @@
X E: nk...@image.dk
X W: http://www.image.dk/~nkbj
X D: 4.4BSD and NeXTstep filesystem support in the old ufs.
-D: Openstep filesystem support in the new ufs.
+D: Openstep filesystem and NeXTstep CDROM support in the new ufs.
X D: Danish HOWTO, Linux+FreeBSD mini-HOWTO.
X S: Dr. Holsts Vej 34, lejl. 164
X S: DK-8230 Åbyhøj
X S: Denmark
X 
-N: Andrzej Krzysztofowicz
-E: an...@green.mif.pg.gda.pl
+N: Andrzej M. Krzysztofowicz
+E: an...@mif.pg.gda.pl
+D: XT disk driver
X D: Aladdin 1533/1543(C) chipset IDE
X D: PIIX chipset IDE
-S: Faculty of Applied Phys. & Math.
-S: Technical University of Gdansk
+S: ul. Matemblewska 1B/10
+S: 80-283 Gdansk
+S: Poland
X 
X N: Michael K. Johnson
X E: john...@redhat.com
diff -u --recursive --new-file v2.3.8/linux/Documentation/Configure.help linux/Documentation/Configure.help
--- v2.3.8/linux/Documentation/Configure.help	Thu Jun 17 01:11:35 1999
+++ linux/Documentation/Configure.help	Fri Jun 25 17:36:12 1999
@@ -1527,8 +1527,8 @@
X   If you want to use your SGI's built-in serial ports under Linux,
X   answer Y.
X 
-SGI graphics support
-CONFIG_SGI_GRAPHICS
+SGI Newport Graphics support
+CONFIG_SGI_NEWPORT_GFX
X   If you have an SGI machine and you want to compile the graphics
X   drivers, say Y here. This will include the code for the
X   /dev/graphics and /dev/gfx drivers into the kernel for supporting
@@ -1704,44 +1704,6 @@
X   called binfmt_aout.o. Saying M or N here is dangerous though,
X   because some crucial programs on your system might still be in A.OUT
X   format.
-
-Kernel support for JAVA binaries (obsolete)
-CONFIG_BINFMT_JAVA
-  JAVA(tm) is an object oriented programming language developed by
-  SUN; JAVA programs are compiled into "JAVA bytecode" binaries which
-  can then be interpreted by run time systems on many different
-  architectures and operating systems. These JAVA binaries are
-  becoming a universal executable format.
-
-  If you want to execute JAVA binaries, read the Java on Linux HOWTO,
-  available via FTP (user: anonymous) at
-  ftp://metalab.unc.edu/pub/Linux/docs/HOWTO. You will then need to
-  install the run time system contained in the Java Developers Kit
-  (JDK) as described in the HOWTO. This is completely independent of
-  the Linux kernel and you do NOT need to say Y here for this to work.
-
-  Saying Y here allows you to execute a JAVA bytecode binary just like
-  any other Linux program: by simply typing in its name. (You also
-  need to have the JDK installed for this to work). As more and more
-  Java programs become available, the use for this will gradually
-  increase. You can even execute HTML files containing JAVA applets
-  (little embedded JAVA binaries) if those files start with the string
-  "<!--applet-->". If you want to use this, say Y here and read
-  Documentation/java.txt.
-
-  If you disable this option it will reduce your kernel by about 4 KB.
-  This is not much and by itself does not warrant removing support.
-  However its removal is a good idea if you do not have the JDK
-  installed. You may answer M for module support and later load the
-  module when you install the JDK or find an interesting Java program
-  that you can't live without. The module will be called
-  binfmt_java.o.
-
-  The complete functionality of this Java support is also provided by
-  the more general option "Kernel support for MISC binaries",
-  below. This option is therefore considered obsolete and you should
-  say N here and Y to "Kernel support for MISC binaries" if you're 
-  interested in transparently executing Java programs.
X 
X Kernel support for Linux/Intel ELF binaries
X CONFIG_BINFMT_EM86
diff -u --recursive --new-file v2.3.8/linux/Documentation/filesystems/ufs.txt linux/Documentation/filesystems/ufs.txt
--- v2.3.8/linux/Documentation/filesystems/ufs.txt	Fri Apr 16 08:20:23 1999
+++ linux/Documentation/filesystems/ufs.txt	Tue Jun 29 09:12:32 1999
@@ -30,6 +30,10 @@
X 		used in NextStep
X 		supported as read-only
X 
+	nextstep-cd
+		used for NextStep CDROMs (block_size == 2048)
+		supported as read-only
+
X 	openstep
X 		used in OpenStep
X 		supported as read-only
diff -u --recursive --new-file v2.3.8/linux/Documentation/powerpc/sound.txt linux/Documentation/powerpc/sound.txt
--- v2.3.8/linux/Documentation/powerpc/sound.txt	Sat Oct 10 09:53:24 1998
+++ linux/Documentation/powerpc/sound.txt	Mon Jun 28 13:40:39 1999
@@ -4,7 +4,7 @@
X Please mail me (Cort Dougan, co...@cs.nmt.edu) if you have questions,
X comments or corrections.
X 
-Last Change: 3.24.98
+Last Change: 6.16.99
X 
X This just covers sound on the PReP and CHRP systems for now and later
X will contain information on the PowerMac's.
@@ -51,7 +51,7 @@
X 
X   Midi is not supported since the cs4232 driver doesn't support midi yet.
X 
-2. IBM PowerPersonal PReP machines and IBM LongTrail CHRP
+2. IBM PowerPersonal PReP machines
X 
X   I've only tested sound on the Power Personal Series of IBM workstations
X   so if you try it on others please let me know the result.  I'm especially
@@ -74,3 +74,8 @@
X   This setup does _NOT_ allow for recording yet.
X 
X   Midi is not supported since the cs4232 driver doesn't support midi yet.
+
+2. IBM CHRP
+
+  I have only tested this on the 43P-150.  Build the kernel with the cs4232
+  set as a module and load the module with irq=9 dma=1 dma2=2 io=0x550
diff -u --recursive --new-file v2.3.8/linux/MAINTAINERS linux/MAINTAINERS
--- v2.3.8/linux/MAINTAINERS	Thu Jun  3 08:26:42 1999
+++ linux/MAINTAINERS	Sat Jun 26 13:16:54 1999
@@ -170,6 +170,12 @@
X W:	http://www.dandelion.com/Linux/
X S:	Maintained
X 
+CIRRUS LOGIC GENERIC FBDEV DRIVER
+P:	Jeff Garzik
+M:	jga...@pobox.com
+L:	linux...@vuser.vu.union.edu
+S:	Maintained
+
X CONFIGURE, MENUCONFIG, XCONFIG
X P:	Michael Elizabeth Chastain
X M:	m...@shout.net
@@ -234,9 +240,9 @@
X S:	Maintained
X 
X DIGI INTL. EPCA DRIVER
-P:      Daniel Taylor
+P:	 Chad Schwartz
X M:      sup...@dgii.com
-M:      dan...@dgii.com
+M:      ch...@dgii.com
X L:      digi...@dgii.com
X S:      Maintained
X 
diff -u --recursive --new-file v2.3.8/linux/Makefile linux/Makefile
--- v2.3.8/linux/Makefile	Tue Jun 22 10:45:40 1999
+++ linux/Makefile	Tue Jun 29 09:12:32 1999
@@ -1,6 +1,6 @@
X VERSION = 2
X PATCHLEVEL = 3
-SUBLEVEL = 8
+SUBLEVEL = 9
X EXTRAVERSION =
X 
X ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)
@@ -162,6 +162,10 @@
X DRIVERS := $(DRIVERS) drivers/pnp/pnp.a
X endif
X 
+ifdef CONFIG_SGI
+DRIVERS := $(DRIVERS) drivers/sgi/sgi.a
+endif
+
X ifdef CONFIG_VT
X DRIVERS := $(DRIVERS) drivers/video/video.a
X endif
@@ -174,6 +178,10 @@
X DRIVERS := $(DRIVERS) drivers/net/hamradio/hamradio.a
X endif
X 
+ifeq ($(CONFIG_TC),y)
+DRIVERS := $(DRIVERS) drivers/tc/tc.a
+endif
+
X ifeq ($(CONFIG_USB),y)
X DRIVERS := $(DRIVERS) drivers/usb/usb.a
X endif
@@ -394,8 +402,6 @@
X dep-files: scripts/mkdep archdep include/linux/version.h
X 	scripts/mkdep init/*.c > .depend
X 	scripts/mkdep `find $(FINDHPATH) -follow -name \*.h ! -name modversions.h -print` > .hdepend
-#	set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i fastdep ;done
-# let this be made through the fastdep rule in Rules.make
X 	$(MAKE) $(patsubst %,_sfdep_%,$(SUBDIRS)) _FASTDEP_ALL_SUB_DIRS="$(SUBDIRS)"
X 
X MODVERFILE :=
diff -u --recursive --new-file v2.3.8/linux/arch/alpha/boot/bootp.c linux/arch/alpha/boot/bootp.c
--- v2.3.8/linux/arch/alpha/boot/bootp.c	Mon Oct 12 11:40:12 1998
+++ linux/arch/alpha/boot/bootp.c	Fri Jun 25 17:36:13 1999
@@ -200,11 +200,11 @@
X         load(START_ADDR+(4*KERNEL_SIZE), KERNEL_ORIGIN, KERNEL_SIZE);
X         load(START_ADDR, START_ADDR+(4*KERNEL_SIZE), KERNEL_SIZE);
X 
-	memset((char*)ZERO_PAGE, 0, PAGE_SIZE);
-	strcpy((char*)ZERO_PAGE, envval);
+	memset((char*)ZERO_PAGE(0), 0, PAGE_SIZE);
+	strcpy((char*)ZERO_PAGE(0), envval);
X #ifdef INITRD_SIZE
-	((long *)(ZERO_PAGE+256))[0] = initrd_start;
-	((long *)(ZERO_PAGE+256))[1] = INITRD_SIZE;
+	((long *)(ZERO_PAGE(0)+256))[0] = initrd_start;
+	((long *)(ZERO_PAGE(0)+256))[1] = INITRD_SIZE;
X #endif
X 
X 	runkernel();
diff -u --recursive --new-file v2.3.8/linux/arch/alpha/boot/main.c linux/arch/alpha/boot/main.c
--- v2.3.8/linux/arch/alpha/boot/main.c	Thu Feb 25 10:46:51 1999
+++ linux/arch/alpha/boot/main.c	Fri Jun 25 17:36:13 1999
@@ -182,7 +182,7 @@
X 		nbytes = 0;
X 	}
X 	envval[nbytes] = '\0';
-	strcpy((char*)ZERO_PAGE, envval);
+	strcpy((char*)ZERO_PAGE(0), envval);
X 
X 	srm_printk(" Ok\nNow booting the kernel\n");
X 	runkernel();
diff -u --recursive --new-file v2.3.8/linux/arch/alpha/config.in linux/arch/alpha/config.in
--- v2.3.8/linux/arch/alpha/config.in	Tue Jun 22 10:46:52 1999
+++ linux/arch/alpha/config.in	Fri Jun 25 01:05:12 1999
@@ -187,9 +187,6 @@
X tristate 'Kernel support for a.out (ECOFF) binaries' CONFIG_BINFMT_AOUT
X tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
X tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
-if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
-  tristate 'Kernel support for JAVA binaries (obsolete)' CONFIG_BINFMT_JAVA
-fi
X tristate 'Kernel support for Linux/Intel ELF binaries' CONFIG_BINFMT_EM86
X tristate 'Parallel port support' CONFIG_PARPORT
X if [ "$CONFIG_PARPORT" != "n" ]; then
diff -u --recursive --new-file v2.3.8/linux/arch/alpha/kernel/osf_sys.c linux/arch/alpha/kernel/osf_sys.c
--- v2.3.8/linux/arch/alpha/kernel/osf_sys.c	Mon May 10 09:55:21 1999
+++ linux/arch/alpha/kernel/osf_sys.c	Thu Jun 24 23:56:23 1999
@@ -255,6 +255,7 @@
X 	struct file *file = NULL;
X 	unsigned long ret = -EBADF;
X 
+	down(¤t->mm->mmap_sem);
X 	lock_kernel();
X #if 0
X 	if (flags & (_MAP_HASSEMAPHORE | _MAP_INHERIT | _MAP_UNALIGNED))
@@ -272,6 +273,7 @@
X 		fput(file);
X out:
X 	unlock_kernel();
+	up(¤t->mm->mmap_sem);
X 	return ret;
X }
X 
diff -u --recursive --new-file v2.3.8/linux/arch/alpha/kernel/setup.c linux/arch/alpha/kernel/setup.c
--- v2.3.8/linux/arch/alpha/kernel/setup.c	Tue Jun 22 10:46:52 1999
+++ linux/arch/alpha/kernel/setup.c	Fri Jun 25 17:36:13 1999
@@ -66,7 +66,7 @@
X  * initialized, we need to copy things out into a more permanent
X  * place.
X  */
-#define PARAM			ZERO_PAGE
+#define PARAM			ZERO_PAGE(0)
X #define COMMAND_LINE		((char*)(PARAM + 0x0000))
X #define COMMAND_LINE_SIZE	256
X #define INITRD_START		(*(unsigned long *) (PARAM+0x100))
diff -u --recursive --new-file v2.3.8/linux/arch/alpha/mm/init.c linux/arch/alpha/mm/init.c
--- v2.3.8/linux/arch/alpha/mm/init.c	Tue Jun 22 10:46:52 1999
+++ linux/arch/alpha/mm/init.c	Tue Jun 29 09:22:08 1999
@@ -166,7 +166,6 @@
X 	printk("%ld pages shared\n",shared);
X 	printk("%ld pages swap cached\n",cached);
X 	printk("%ld pages in page table cache\n",pgtable_cache_size);
-	show_buffers();
X #ifdef CONFIG_NET
X 	show_net_buffers();
X #endif
@@ -219,7 +218,7 @@
X 
X 	/* Initialize the kernel's page tables.  Linux puts the vptb in
X 	   the last slot of the L1 page table.  */
-	memset((void *) ZERO_PAGE, 0, PAGE_SIZE);
+	memset((void *) ZERO_PAGE(0), 0, PAGE_SIZE);
X 	memset(swapper_pg_dir, 0, PAGE_SIZE);
X 	newptbr = ((unsigned long) swapper_pg_dir - PAGE_OFFSET) >> PAGE_SHIFT;
X 	pgd_val(swapper_pg_dir[1023]) =
@@ -359,7 +358,7 @@
X 	val->totalram = 0;
X 	val->sharedram = 0;
X 	val->freeram = nr_free_pages << PAGE_SHIFT;
-	val->bufferram = buffermem;
+	val->bufferram = atomic_read(&buffermem);
X 	while (i-- > 0)  {
X 		if (PageReserved(mem_map+i))
X 			continue;
diff -u --recursive --new-file v2.3.8/linux/arch/arm/defconfig linux/arch/arm/defconfig
--- v2.3.8/linux/arch/arm/defconfig	Thu Jun 17 01:11:35 1999
+++ linux/arch/arm/defconfig	Sat Jun 26 08:34:19 1999
@@ -85,7 +85,7 @@
X CONFIG_BLK_DEV_IDEPCI=y
X CONFIG_BLK_DEV_IDEDMA=y
X CONFIG_BLK_DEV_OFFBOARD=y
-CONFIG_IDEDMA_AUTO=y
+CONFIG_IDEDMA_PCI_AUTO=y
X # CONFIG_BLK_DEV_OPTI621 is not set
X # CONFIG_BLK_DEV_TRM290 is not set
X # CONFIG_BLK_DEV_NS87415 is not set
diff -u --recursive --new-file v2.3.8/linux/arch/arm/kernel/dec21285.c linux/arch/arm/kernel/dec21285.c
--- v2.3.8/linux/arch/arm/kernel/dec21285.c	Thu Jun 17 01:11:35 1999
+++ linux/arch/arm/kernel/dec21285.c	Wed Jun 30 11:24:54 1999
@@ -3,6 +3,7 @@
X  *
X  * Copyright (C) 1998 Russell King, Phil Blundell
X  */
+#include <linux/config.h>
X #include <linux/sched.h>
X #include <linux/kernel.h>
X #include <linux/pci.h>
diff -u --recursive --new-file v2.3.8/linux/arch/arm/kernel/entry-common.S linux/arch/arm/kernel/entry-common.S
--- v2.3.8/linux/arch/arm/kernel/entry-common.S	Thu Jun 17 01:11:35 1999
+++ linux/arch/arm/kernel/entry-common.S	Wed Jun 30 11:24:54 1999
@@ -1,3 +1,4 @@
+#include <linux/config.h>
X /*============================================================================
X  * All exits to user mode from the kernel go through this code.
X  */
diff -u --recursive --new-file v2.3.8/linux/arch/arm/kernel/sys_arm.c linux/arch/arm/kernel/sys_arm.c
--- v2.3.8/linux/arch/arm/kernel/sys_arm.c	Thu Jun 17 01:11:35 1999
+++ linux/arch/arm/kernel/sys_arm.c	Thu Jun 24 23:56:23 1999
@@ -72,6 +72,7 @@
X 	struct file * file = NULL;
X 	struct mmap_arg_struct a;
X 
+	down(¤t->mm->mmap_sem);
X 	lock_kernel();
X 	if (copy_from_user(&a, arg, sizeof(a)))
X 		goto out;
@@ -87,6 +88,7 @@
X 		fput(file);
X out:
X 	unlock_kernel();
+	up(¤t->mm->mmap_sem);
X 	return error;
X }
X 
diff -u --recursive --new-file v2.3.8/linux/arch/arm/mm/init.c linux/arch/arm/mm/init.c
--- v2.3.8/linux/arch/arm/mm/init.c	Sat May  8 11:06:56 1999
+++ linux/arch/arm/mm/init.c	Tue Jun 29 09:22:08 1999
@@ -115,7 +115,6 @@
X 	printk("%d free pages\n",free);
X 	printk("%d reserved pages\n",reserved);
X 	printk("%d pages shared\n",shared);
-	show_buffers();
X #ifdef CONFIG_NET
X 	show_net_buffers();
X #endif
@@ -266,7 +265,7 @@
X 	val->totalram = 0;
X 	val->sharedram = 0;
X 	val->freeram = nr_free_pages << PAGE_SHIFT;
-	val->bufferram = buffermem;
+	val->bufferram = atomic_read(&buffermem);
X 	while (i-- > 0)  {
X 		if (PageReserved(mem_map+i))
X 			continue;
diff -u --recursive --new-file v2.3.8/linux/arch/i386/config.in linux/arch/i386/config.in
--- v2.3.8/linux/arch/i386/config.in	Mon Jun  7 17:02:23 1999
+++ linux/arch/i386/config.in	Fri Jun 25 01:05:12 1999
@@ -91,9 +91,6 @@
X tristate 'Kernel support for a.out binaries' CONFIG_BINFMT_AOUT
X tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
X tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
-if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
-  tristate 'Kernel support for JAVA binaries (obsolete)' CONFIG_BINFMT_JAVA
-fi
X 
X tristate 'Parallel port support' CONFIG_PARPORT
X if [ "$CONFIG_PARPORT" != "n" ]; then
diff -u --recursive --new-file v2.3.8/linux/arch/i386/defconfig linux/arch/i386/defconfig
--- v2.3.8/linux/arch/i386/defconfig	Thu Jun 17 01:27:19 1999
+++ linux/arch/i386/defconfig	Fri Jun 25 10:08:27 1999
@@ -314,17 +314,7 @@
X #
X # USB drivers - not for the faint of heart
X #
-CONFIG_USB=y
-CONFIG_USB_UHCI=y
-# CONFIG_USB_OHCI is not set
-# CONFIG_USB_OHCI_HCD is not set
-CONFIG_USB_HUB=y
-CONFIG_USB_MOUSE=y
-CONFIG_USB_KBD=y
-# CONFIG_USB_AUDIO is not set
-# CONFIG_USB_ACM is not set
-# CONFIG_USB_PRINTER is not set
-# CONFIG_USB_SCSI is not set
+# CONFIG_USB is not set
X 
X #
X # Filesystems
diff -u --recursive --new-file v2.3.8/linux/arch/i386/kernel/i386_ksyms.c linux/arch/i386/kernel/i386_ksyms.c
--- v2.3.8/linux/arch/i386/kernel/i386_ksyms.c	Mon May 10 10:32:45 1999
+++ linux/arch/i386/kernel/i386_ksyms.c	Tue Jun 29 09:59:26 1999
@@ -48,6 +48,7 @@
X EXPORT_SYMBOL_NOVERS(__up_wakeup);
X /* Networking helper routines. */
X EXPORT_SYMBOL(csum_partial_copy);
+EXPORT_SYMBOL(csum_partial_copy_generic);
X /* Delay loops */
X EXPORT_SYMBOL(__udelay);
X EXPORT_SYMBOL(__delay);
diff -u --recursive --new-file v2.3.8/linux/arch/i386/kernel/mca.c linux/arch/i386/kernel/mca.c
--- v2.3.8/linux/arch/i386/kernel/mca.c	Sat Jun 19 11:45:28 1999
+++ linux/arch/i386/kernel/mca.c	Sun Jun 27 10:10:41 1999
@@ -142,9 +142,10 @@
X 	NULL,			/* rename */
X 	NULL,			/* readlink */
X 	NULL,			/* follow_link */
+	NULL,			/* get_block */
X 	NULL,			/* readpage */
X 	NULL,			/* writepage */
-	NULL,			/* bmap */
+	NULL,			/* flushpage */
X 	NULL,			/* truncate */
X 	NULL,			/* permission */
X 	NULL,			/* smap */
diff -u --recursive --new-file v2.3.8/linux/arch/i386/kernel/mtrr.c linux/arch/i386/kernel/mtrr.c
--- v2.3.8/linux/arch/i386/kernel/mtrr.c	Fri May 14 08:59:54 1999
+++ linux/arch/i386/kernel/mtrr.c	Sun Jun 27 10:10:41 1999
@@ -1459,11 +1459,14 @@
X 	NULL,			/* rename */
X 	NULL,			/* readlink */
X 	NULL,			/* follow_link */
+	NULL,			/* get_block */
X 	NULL,			/* readpage */
X 	NULL,			/* writepage */
-	NULL,			/* bmap */
+	NULL,			/* flushpage */
X 	NULL,			/* truncate */
-	NULL			/* permission */
+	NULL,			/* permission */
+	NULL,			/* smap */
+	NULL			/* revalidate */
X };
X 
X static struct proc_dir_entry proc_root_mtrr = {
diff -u --recursive --new-file v2.3.8/linux/arch/i386/mm/init.c linux/arch/i386/mm/init.c
--- v2.3.8/linux/arch/i386/mm/init.c	Wed Jun 16 19:26:27 1999
+++ linux/arch/i386/mm/init.c	Tue Jun 29 09:22:08 1999
@@ -169,7 +169,6 @@
X 	printk("%d pages shared\n",shared);
X 	printk("%d pages swap cached\n",cached);
X printk("%ld pages in page table cache\n",pgtable_cache_size);
-	show_buffers();
X #ifdef CONFIG_NET
X 	show_net_buffers();
X #endif
@@ -489,7 +488,7 @@
X 	val->totalram = 0;
X 	val->sharedram = 0;
X 	val->freeram = nr_free_pages << PAGE_SHIFT;
-	val->bufferram = buffermem;
+	val->bufferram = atomic_read(&buffermem);
X 	while (i-- > 0)  {
X 		if (PageReserved(mem_map+i))
X 			continue;
diff -u --recursive --new-file v2.3.8/linux/arch/m68k/mm/init.c linux/arch/m68k/mm/init.c
--- v2.3.8/linux/arch/m68k/mm/init.c	Tue May 11 09:57:14 1999
+++ linux/arch/m68k/mm/init.c	Tue Jun 29 09:22:08 1999
@@ -108,7 +108,6 @@
X     printk("%d pages shared\n",shared);
X     printk("%d pages swap cached\n",cached);
X printk("%ld pages in page table cache\n",pgtable_cache_size);
-    show_buffers();
X #ifdef CONFIG_NET
X     show_net_buffers();
X #endif
@@ -479,7 +478,7 @@
X     val->totalram = 0;
X     val->sharedram = 0;
X     val->freeram = nr_free_pages << PAGE_SHIFT;
-    val->bufferram = buffermem;
+    val->bufferram = atomic_read(&buffermem);
X     while (i-- > 0) {
X 	if (PageReserved(mem_map+i))
X 	    continue;
diff -u --recursive --new-file v2.3.8/linux/arch/mips/Makefile linux/arch/mips/Makefile
--- v2.3.8/linux/arch/mips/Makefile	Tue Oct 20 13:52:54 1998
+++ linux/arch/mips/Makefile	Fri Jun 25 17:40:12 1999
@@ -36,7 +36,7 @@
X CROSS_COMPILE  = $(tool-prefix)
X endif
X 
-LINKFLAGS	= -static #-N
+LINKFLAGS	= -static -N
X MODFLAGS	+= -mlong-calls
X 
X #
@@ -97,22 +97,37 @@
X SUBDIRS       += arch/mips/algor
X #LOADADDR      += 0x80000000
X endif
+
+#
+# DECstation family
+#
+ifdef CONFIG_DECSTATION
+CORE_FILES    += arch/mips/dec/dec.o
+SUBDIRS       += arch/mips/dec arch/mips/dec/prom
+LIBS          += arch/mips/dec/prom/rexlib.a
+LOADADDR      += 0x80040000
+endif
+
X #
X # Acer PICA 61, Mips Magnum 4000 and Olivetti M700.
X #
X ifdef CONFIG_MIPS_JAZZ
X CORE_FILES    += arch/mips/jazz/jazz.o
-SUBDIRS       += arch/mips/jazz
-LOADADDR      += 0x80000000
+SUBDIRS       += arch/mips/jazz arch/mips/arc
+LIBS          += arch/mips/arc/arclib.a
+LOADADDR      += 0x80080000
X endif
+
X ifdef CONFIG_SNI_RM200_PCI
X CORE_FILES    += arch/mips/sni/sni.o
-SUBDIRS       += arch/mips/sni
-LOADADDR      += 0x80000000
+SUBDIRS       += arch/mips/sni arch/mips/arc
+LIBS          += arch/mips/arc/arclib.a
+LOADADDR      += 0x80080000
X endif
+
X ifdef CONFIG_SGI
-LIBS          += arch/mips/sgi/kernel/sgikern.a arch/mips/sgi/prom/promlib.a
-SUBDIRS       += arch/mips/sgi/kernel arch/mips/sgi/prom
+LIBS          += arch/mips/sgi/kernel/sgikern.a arch/mips/arc/arclib.a
+SUBDIRS       += arch/mips/sgi/kernel arch/mips/arc
X #
X # Set LOADADDR to >= 0x88069000 if you want to leave space for symmon,
X # 0x88002000 for production kernels.  Note that the value must be
@@ -123,6 +138,14 @@
X endif
X 
X #
+# Baget/MIPS
+#
+ifdef CONFIG_BAGET_MIPS
+SUBDIRS       += arch/mips/baget arch/mips/baget/prom
+LIBS          += arch/mips/baget/baget.a arch/mips/baget/prom/bagetlib.a
+endif
+
+#
X # Choosing incompatible machines durings configuration will result in
X # error messages during linking.  Select a default linkscript if
X # none has been choosen above.
@@ -150,7 +173,16 @@
X 
X SUBDIRS := $(SUBDIRS) $(addprefix arch/mips/, kernel mm lib tools)
X CORE_FILES := arch/mips/kernel/kernel.o arch/mips/mm/mm.o $(CORE_FILES)
-LIBS := arch/mips/lib/lib.a $(LIBS) arch/mips/lib/lib.a
+LIBS := arch/mips/lib/lib.a $(LIBS)
+
+ifdef CONFIG_BAGET_MIPS
+
+BAGETBOOT = $(MAKE) -C arch/$(ARCH)/baget
+
+balo:  vmlinux
+	$(BAGETBOOT) balo
+
+endif
X 
X MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot
X 
diff -u --recursive --new-file v2.3.8/linux/arch/mips/algor/README linux/arch/mips/algor/README
--- v2.3.8/linux/arch/mips/algor/README	Wed Dec 31 16:00:00 1969
+++ linux/arch/mips/algor/README	Fri Jun 25 17:40:12 1999
@@ -0,0 +1,5 @@
+The code for the Algorithmics P4032 evaluation board is currently under
+development.  I'll release it when it's up to the same strength as
+the other ports.
+
+  Ralf
diff -u --recursive --new-file v2.3.8/linux/arch/mips/arc/Makefile linux/arch/mips/arc/Makefile
--- v2.3.8/linux/arch/mips/arc/Makefile	Wed Dec 31 16:00:00 1969
+++ linux/arch/mips/arc/Makefile	Fri Jun 25 17:40:12 1999
@@ -0,0 +1,23 @@
+# $Id: Makefile,v 1.1 1998/10/18 13:32:08 tsbogend Exp $
+# Makefile for the SGI arcs prom monitor library routines
+# under Linux.
+#
+# Note! Dependencies are done automagically by 'make dep', which also
+# removes any old dependencies. DON'T put your own dependencies here
+# unless it's something special (ie not a .c file).
+#
+# Note 2! The CFLAGS definitions are now in the main makefile...
+
+OBJS  = console.o init.o printf.o memory.o tree.o env.o \
+      cmdline.o misc.o time.o file.o identify.o
+
+all: arclib.a
+
+arclib.a: $(OBJS)
+	$(AR) rcs arclib.a $(OBJS)
+	sync
+
+dep:
+	$(CPP) -M *.c > .depend
+
+include $(TOPDIR)/Rules.make
diff -u --recursive --new-file v2.3.8/linux/arch/mips/arc/cmdline.c linux/arch/mips/arc/cmdline.c
--- v2.3.8/linux/arch/mips/arc/cmdline.c	Wed Dec 31 16:00:00 1969
+++ linux/arch/mips/arc/cmdline.c	Fri Jun 25 17:40:12 1999
@@ -0,0 +1,64 @@
+/*
+ * cmdline.c: Kernel command line creation using ARCS argc/argv.
+ *
+ * Copyright (C) 1996 David S. Miller (d...@engr.sgi.com)
+ *
+ * $Id: cmdline.c,v 1.1 1998/10/18 13:32:08 tsbogend Exp $
+ */
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/string.h>
+
+#include <asm/sgialib.h>
+#include <asm/bootinfo.h>
+
+/* #define DEBUG_CMDLINE */
+
+char arcs_cmdline[CL_SIZE];
+
+__initfunc(char *prom_getcmdline(void))
+{
+	return &(arcs_cmdline[0]);
+}
+
+static char *ignored[] = {
+	"ConsoleIn=",
+	"ConsoleOut=",
+	"SystemPartition=",
+	"OSLoader=",
+	"OSLoadPartition=",
+	"OSLoadFilename="
+};
+#define NENTS(foo) ((sizeof((foo)) / (sizeof((foo[0])))))
+
+__initfunc(void prom_init_cmdline(void))
+{
+	char *cp;
+	int actr, i;
+
+	actr = 1; /* Always ignore argv[0] */
+
+	cp = &(arcs_cmdline[0]);
+	while(actr < prom_argc) {
+		for(i = 0; i < NENTS(ignored); i++) {
+			int len = strlen(ignored[i]);
+
+			if(!strncmp(prom_argv[actr], ignored[i], len))
+				goto pic_cont;
+		}
+		/* Ok, we want it. */
+		strcpy(cp, prom_argv[actr]);
+		cp += strlen(prom_argv[actr]);
+		*cp++ = ' ';
+
+	pic_cont:
+		actr++;
+	}
+	if (cp != &(arcs_cmdline[0])) /* get rid of trailing space */
+		--cp;
+	*cp = '\0';
+
+#ifdef DEBUG_CMDLINE
+	prom_printf("prom_init_cmdline: %s\n", &(arcs_cmdline[0]));
+#endif
+}
diff -u --recursive --new-file v2.3.8/linux/arch/mips/arc/console.c linux/arch/mips/arc/console.c
--- v2.3.8/linux/arch/mips/arc/console.c	Wed Dec 31 16:00:00 1969
+++ linux/arch/mips/arc/console.c	Wed Jun 30 11:24:54 1999
@@ -0,0 +1,50 @@
+/*
+ * console.c: SGI arcs console code.
+ *
+ * Copyright (C) 1996 David S. Miller (d...@sgi.com)
+ * Compability with board caches, Ulf Carlsson
+ *
+ * $Id: console.c,v 1.2 1999/06/12 18:42:38 ulfc Exp $
+ */
+#include <linux/config.h>
+#include <linux/init.h>
+#include <asm/sgialib.h>
+#include <asm/bcache.h>
+
+/* The romvec is not compatible with board caches.  Thus we disable it during
+ * romvec action.  Since r4xx0.c is always compiled and linked with your kernel,
+ * this shouldn't cause any harm regardless what MIPS processor you have.
+ *
+ * The romvec write and read functions seem to interfere with the serial lines
+ * in some way. You should be careful with them.
+ */
+extern struct bcache_ops *bcops;
+
+#ifdef CONFIG_SGI_PROM_CONSOLE
+void prom_putchar(char c)
+#else
+__initfunc(void prom_putchar(char c))
+#endif
+{
+	long cnt;
+	char it = c;
+
+	bcops->bc_disable();
+	romvec->write(1, &it, 1, &cnt);
+	bcops->bc_enable();
+}
+
+#ifdef CONFIG_SGI_PROM_CONSOLE
+char prom_getchar(void)
+#else
+__initfunc(char prom_getchar(void))
+#endif
+{
+	long cnt;
+	char c;
+
+	bcops->bc_disable();
+	romvec->read(0, &c, 1, &cnt);
+	bcops->bc_enable();
+	return c;
+}
diff -u --recursive --new-file v2.3.8/linux/arch/mips/arc/env.c linux/arch/mips/arc/env.c
--- v2.3.8/linux/arch/mips/arc/env.c	Wed Dec 31 16:00:00 1969
+++ linux/arch/mips/arc/env.c	Fri Jun 25 17:40:12 1999
@@ -0,0 +1,22 @@
+/*
+ * env.c: ARCS environment variable routines.
+ *
+ * Copyright (C) 1996 David S. Miller (d...@engr.sgi.com)
+ *
+ * $Id: env.c,v 1.1 1998/10/18 13:32:08 tsbogend Exp $
+ */
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/string.h>
+
+#include <asm/sgialib.h>
+
+__initfunc(char *prom_getenv(char *name))
+{
+	return romvec->get_evar(name);
+}
+
+__initfunc(long prom_setenv(char *name, char *value))
+{
+	return romvec->set_evar(name, value);
+}
diff -u --recursive --new-file v2.3.8/linux/arch/mips/arc/file.c linux/arch/mips/arc/file.c
--- v2.3.8/linux/arch/mips/arc/file.c	Wed Dec 31 16:00:00 1969
+++ linux/arch/mips/arc/file.c	Fri Jun 25 17:40:12 1999
@@ -0,0 +1,59 @@
+/*
+ * file.c: ARCS firmware interface to files.
+ *
+ * Copyright (C) 1996 David S. Miller (d...@engr.sgi.com)
+ *
+ * $Id: file.c,v 1.1 1998/10/18 13:32:08 tsbogend Exp $
+ */
+#include <linux/init.h>
+#include <asm/sgialib.h>
+
+__initfunc(long prom_getvdirent(unsigned long fd, struct linux_vdirent *ent, unsigned long num, unsigned long *cnt))
+{
+	return romvec->get_vdirent(fd, ent, num, cnt);
+}
+
+__initfunc(long prom_open(char *name, enum linux_omode md, unsigned long *fd))
+{
+	return romvec->open(name, md, fd);
+}
+
+__initfunc(long prom_close(unsigned long fd))
+{
+	return romvec->close(fd);
+}
+
+__initfunc(long prom_read(unsigned long fd, void *buf, unsigned long num, unsigned long *cnt))
+{
+	return romvec->read(fd, buf, num, cnt);
+}
+
+__initfunc(long prom_getrstatus(unsigned long fd))
+{
+	return romvec->get_rstatus(fd);
+}
+
+__initfunc(long prom_write(unsigned long fd, void *buf, unsigned long num, unsigned long *cnt))
+{
+	return romvec->write(fd, buf, num, cnt);
+}
+
+__initfunc(long prom_seek(unsigned long fd, struct linux_bigint *off, enum linux_seekmode sm))
+{
+	return romvec->seek(fd, off, sm);
+}
+
+__initfunc(long prom_mount(char *name, enum linux_mountops op))
+{
+	return romvec->mount(name, op);
+}
+
+__initfunc(long prom_getfinfo(unsigned long fd, struct linux_finfo *buf))
+{
+	return romvec->get_finfo(fd, buf);
+}
+
+__initfunc(long prom_setfinfo(unsigned long fd, unsigned long flags, unsigned long msk))
+{
+	return romvec->set_finfo(fd, flags, msk);
+}
diff -u --recursive --new-file v2.3.8/linux/arch/mips/arc/identify.c linux/arch/mips/arc/identify.c
--- v2.3.8/linux/arch/mips/arc/identify.c	Wed Dec 31 16:00:00 1969
+++ linux/arch/mips/arc/identify.c	Fri Jun 25 17:40:12 1999
@@ -0,0 +1,68 @@
+/*
+ * identify.c: identify machine by looking up system identifier
+ *
+ * Copyright (C) 1998 Thomas Bogendoerfer
+ * 
+ * This code is based on arch/mips/sgi/kernel/system.c, which is
+ * 
+ * Copyright (C) 1996 David S. Miller (d...@engr.sgi.com)
+ *
+ * $Id: identify.c,v 1.2 1999/02/25 21:04:13 tsbogend Exp $
+ */
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/string.h>
+
+#include <asm/sgi.h>
+#include <asm/sgialib.h>
+#include <asm/bootinfo.h>
+
+struct smatch {
+    char *name;
+    int group;
+    int type;
+    int flags;
+};
+
+static struct smatch mach_table[] = {
+    { "SGI-IP22", MACH_GROUP_SGI, MACH_SGI_INDY, PROM_FLAG_ARCS },
+    { "Microsoft-Jazz", MACH_GROUP_JAZZ, MACH_MIPS_MAGNUM_4000, 0 },
+    { "PICA-61", MACH_GROUP_JAZZ, MACH_ACER_PICA_61, 0 },
+    { "RM200PCI", MACH_GROUP_SNI_RM, MACH_SNI_RM200_PCI, 0 }
+};
+
+int prom_flags;
+
+static struct smatch * __init string_to_mach(char *s)
+{
+    int i;
+    
+    for (i = 0; i < sizeof (mach_table); i++) {
+	if(!strcmp(s, mach_table[i].name))
+	    return &mach_table[i];
+    }
+    prom_printf("\nYeee, could not determine architecture type <%s>\n", s);
+    prom_printf("press a key to reboot\n");
+    prom_getchar();
+    romvec->imode();
+    return NULL;
+}
+
+void __init prom_identify_arch(void)
+{
+    pcomponent *p;
+    struct smatch *mach;
+    
+    /* The root component tells us what machine architecture we
+     * have here.
+     */
+    p = prom_getchild(PROM_NULL_COMPONENT);
+    printk("ARCH: %s\n", p->iname);
+    mach = string_to_mach(p->iname);
+
+    mips_machgroup = mach->group;
+    mips_machtype = mach->type;
+    prom_flags = mach->flags;
+}
+
diff -u --recursive --new-file v2.3.8/linux/arch/mips/arc/init.c linux/arch/mips/arc/init.c
--- v2.3.8/linux/arch/mips/arc/init.c	Wed Dec 31 16:00:00 1969
+++ linux/arch/mips/arc/init.c	Fri Jun 25 17:40:12 1999
@@ -0,0 +1,67 @@
+/*
+ * init.c: PROM library initialisation code.
+ *
+ * Copyright (C) 1996 David S. Miller (d...@engr.sgi.com)
+ *
+ * $Id: init.c,v 1.2 1999/02/25 21:22:49 tsbogend Exp $
+ */
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/config.h>
+
+#include <asm/sgialib.h>
+
+/* #define DEBUG_PROM_INIT */
+
+/* Master romvec interface. */
+struct linux_romvec *romvec;
+struct linux_promblock *sgi_pblock;
+int prom_argc;
+char **prom_argv, **prom_envp;
+unsigned short prom_vers, prom_rev;
+
+extern void prom_testtree(void);
+
+__initfunc(int prom_init(int argc, char **argv, char **envp))
+{
+	struct linux_promblock *pb;
+
+	romvec = ROMVECTOR;
+	pb = sgi_pblock = PROMBLOCK;
+	prom_argc = argc;
+	prom_argv = argv;
+	prom_envp = envp;
+
+	if(pb->magic != 0x53435241) {
+		prom_printf("Aieee, bad prom vector magic %08lx\n", pb->magic);
+		while(1)
+			;
+	}
+
+	prom_init_cmdline();
+
+	prom_vers = pb->ver;
+	prom_rev = pb->rev;
+	prom_identify_arch();
+#ifdef CONFIG_SGI
+	printk("PROMLIB: SGI ARCS firmware Version %d Revision %d\n",
+		    prom_vers, prom_rev);
+#else
+	printk("PROMLIB: ARC firmware Version %d Revision %d\n",
+		    prom_vers, prom_rev);
+#endif
+	prom_meminit();
+
+#if 0
+	prom_testtree();
+#endif
+
+#ifdef DEBUG_PROM_INIT
+	{
+		prom_printf("Press a key to reboot\n");
+		(void) prom_getchar();
+		romvec->imode();
+	}
+#endif
+	return 0;
+}
diff -u --recursive --new-file v2.3.8/linux/arch/mips/arc/memory.c linux/arch/mips/arc/memory.c
--- v2.3.8/linux/arch/mips/arc/memory.c	Wed Dec 31 16:00:00 1969
+++ linux/arch/mips/arc/memory.c	Wed Jun 30 11:24:54 1999
@@ -0,0 +1,208 @@
+/*
+ * memory.c: PROM library functions for acquiring/using memory descriptors
+ *           given to us from the ARCS firmware.
+ *
+ * Copyright (C) 1996 David S. Miller (d...@engr.sgi.com)
+ *
+ * $Id: memory.c,v 1.5 1999/04/14 21:25:02 tsbogend Exp $
+ */
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/sched.h>
+#include <linux/mm.h>
+#include <linux/swap.h>
+
+#include <asm/sgialib.h>
+#include <asm/page.h>
+#include <asm/pgtable.h>
+#include <asm/bootinfo.h>
+
+/* #define DEBUG */
+
+__initfunc(struct linux_mdesc *prom_getmdesc(struct linux_mdesc *curr))
+{
+	return romvec->get_mdesc(curr);
+}
+
+#ifdef DEBUG /* convenient for debugging */
+static char *arcs_mtypes[8] = {
+	"Exception Block",
+	"ARCS Romvec Page",
+	"Free/Contig RAM",
+	"Generic Free RAM",
+	"Bad Memory",
+	"Standlong Program Pages",
+	"ARCS Temp Storage Area",
+	"ARCS Permanent Storage Area"
+};
+
+static char *arc_mtypes[8] = {
+	"Exception Block",
+	"SystemParameterBlock",
+	"FreeMemory",
+	"Bad Memory",
+	"LoadedProgram",
+	"FirmwareTemporary",
+	"FirmwarePermanent",
+	"FreeContigiuous"
+};
+#define mtypes(a) (prom_flags & PROM_FLAG_ARCS) ? arcs_mtypes[a.arcs] : arc_mtypes[a.arc]
+#endif
+
+static struct prom_pmemblock prom_pblocks[PROM_MAX_PMEMBLOCKS];
+
+__initfunc(struct prom_pmemblock *prom_getpblock_array(void))
+{
+	return &prom_pblocks[0];
+}
+
+#define MEMTYPE_DONTUSE   0
+#define MEMTYPE_PROM      1
+#define MEMTYPE_FREE      2
+
+static int __init prom_memtype_classify (union linux_memtypes type)
+{
+    if (prom_flags & PROM_FLAG_ARCS) {
+	switch (type.arcs) {
+	 case arcs_free:
+	 case arcs_fcontig:
+	    return MEMTYPE_FREE;
+	 case arcs_atmp:
+	 case arcs_aperm:
+	    return MEMTYPE_PROM;
+	 default:
+	    return MEMTYPE_DONTUSE;
+	}
+    } else {
+	switch (type.arc) {
+	 case arc_free:
+	 case arc_fcontig:
+	    return MEMTYPE_FREE;
+	 case arc_rvpage:
+	 case arc_atmp:
+	 case arc_aperm:
+	    return MEMTYPE_PROM;
+	 default:
+	    return MEMTYPE_DONTUSE;
+	}
+    }
+}
+
+__initfunc(static void prom_setup_memupper(void))
+{
+	struct prom_pmemblock *p, *highest;
+
+	for(p = prom_getpblock_array(), highest = 0; p->size != 0; p++) {
+		if(p->base == 0xdeadbeef)
+			prom_printf("WHEEE, bogus pmemblock\n");
+		if(!highest || p->base > highest->base)
+			highest = p;
+	}
+	mips_memory_upper = highest->base + highest->size;
+#ifdef DEBUG
+	prom_printf("prom_setup_memupper: mips_memory_upper = %08lx\n",
+		    mips_memory_upper);
+#endif
+}
+
+__initfunc(void prom_meminit(void))
+{
+	struct linux_mdesc *p;
+	int totram;
+	int i = 0;
+
+	p = prom_getmdesc(PROM_NULL_MDESC);
+#ifdef DEBUG
+	prom_printf("ARCS MEMORY DESCRIPTOR dump:\n");
+	while(p) {
+		prom_printf("[%d,%p]: base<%08lx> pages<%08lx> type<%s>\n",
+			    i, p, p->base, p->pages, mtypes(p->type));
+		p = prom_getmdesc(p);
+		i++;
+	}
+#endif
+	p = prom_getmdesc(PROM_NULL_MDESC);
+	totram = 0;
+	i = 0;
+	while(p) {
+	    prom_pblocks[i].type = prom_memtype_classify (p->type);
+	    prom_pblocks[i].base = ((p->base<<PAGE_SHIFT) + 0x80000000);
+	    prom_pblocks[i].size = p->pages << PAGE_SHIFT;
+	    switch (prom_pblocks[i].type) {
+	     case MEMTYPE_FREE:
+		totram += prom_pblocks[i].size;
+#ifdef DEBUG
+		prom_printf("free_chunk[%d]: base=%08lx size=%d\n",
+			    i, prom_pblocks[i].base,
+			    prom_pblocks[i].size);
+#endif
+		i++;
+		break;
+	     case MEMTYPE_PROM:
+#ifdef DEBUG
+		prom_printf("prom_chunk[%d]: base=%08lx size=%d\n",
+			    i, prom_pblocks[i].base,
+			    prom_pblocks[i].size);
+#endif
+		i++;
+		break;
+	     default:
+		break;
+	    }
+	    p = prom_getmdesc(p);
+	}
+	prom_pblocks[i].base = 0xdeadbeef;
+	prom_pblocks[i].size = 0; /* indicates last elem. of array */
+	printk("PROMLIB: Total free ram %d bytes (%dK,%dMB)\n",
+		    totram, (totram/1024), (totram/1024/1024));
+
+	/* Setup upper physical memory bound. */
+	prom_setup_memupper();
+}
+
+/* Called from mem_init() to fixup the mem_map page settings. */
+__initfunc(void prom_fixup_mem_map(unsigned long start, unsigned long end))
+{
+	struct prom_pmemblock *p;
+	int i, nents;
+
+	/* Determine number of pblockarray entries. */
+	p = prom_getpblock_array();
+	for(i = 0; p[i].size; i++)
+		;
+	nents = i;
+restart:
+	while(start < end) {
+		for(i = 0; i < nents; i++) {
+			if((p[i].type == MEMTYPE_FREE) &&
+			   (start >= (p[i].base)) &&
+			   (start < (p[i].base + p[i].size))) {
+				start = p[i].base + p[i].size;
+				start &= PAGE_MASK;
+				goto restart;
+			}
+		}
+		set_bit(PG_reserved, &mem_map[MAP_NR(start)].flags);
+		start += PAGE_SIZE;
+	}
+}
+
+void prom_free_prom_memory (void)
+{
+    struct prom_pmemblock *p;
+    unsigned long addr;
+    unsigned long num_pages = 0;
+
+    for(p = prom_getpblock_array(); p->size != 0; p++) {
+	if (p->type == MEMTYPE_PROM) {
+	    for (addr = p->base; addr < p->base + p->size; addr += PAGE_SIZE) {
+		mem_map[MAP_NR(addr)].flags &= ~(1 << PG_reserved);
+		atomic_set(&mem_map[MAP_NR(addr)].count, 1);
+		free_page(addr);
+		num_pages++;
+	    }
+	}
+    }
+    printk ("Freeing prom memory: %dk freed\n",num_pages << (PAGE_SHIFT - 10));
+}
diff -u --recursive --new-file v2.3.8/linux/arch/mips/arc/misc.c linux/arch/mips/arc/misc.c
--- v2.3.8/linux/arch/mips/arc/misc.c	Wed Dec 31 16:00:00 1969
+++ linux/arch/mips/arc/misc.c	Fri Jun 25 17:40:12 1999
@@ -0,0 +1,84 @@
+/* $Id: misc.c,v 1.1 1998/10/18 13:32:09 tsbogend Exp $
+ *
+ * misc.c: Miscellaneous ARCS PROM routines.
+ *
+ * Copyright (C) 1996 David S. Miller (d...@engr.sgi.com)
+ */
+#include <linux/config.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+
+#include <asm/bcache.h>
+#include <asm/sgialib.h>
+#include <asm/bootinfo.h>
+#include <asm/system.h>
+
+extern unsigned long mips_cputype;
+extern void *sgiwd93_host;
+extern void reset_wd33c93(void *instance);
+
+void prom_halt(void)
+{
+	bcops->bc_disable();
+	cli();
+#if CONFIG_SCSI_SGIWD93
+	reset_wd33c93(sgiwd93_host);
+#endif
+	romvec->halt();
+}
+
+void prom_powerdown(void)
+{
+	bcops->bc_disable();
+	cli();
+#if CONFIG_SCSI_SGIWD93
+	reset_wd33c93(sgiwd93_host);
+#endif
+	romvec->pdown();
+}
+
+/* XXX is this a soft reset basically? XXX */
+void prom_restart(void)
+{
+	bcops->bc_disable();
+	cli();
+#if CONFIG_SCSI_SGIWD93
+	reset_wd33c93(sgiwd93_host);
+#endif
+	romvec->restart();
+}
+
+void prom_reboot(void)
+{
+	bcops->bc_disable();
+	cli();
+#if CONFIG_SCSI_SGIWD93
+	reset_wd33c93(sgiwd93_host);
+#endif
+	romvec->reboot();
+}
+
+void prom_imode(void)
+{
+	bcops->bc_disable();
+	cli();
+#if CONFIG_SCSI_SGIWD93
+	reset_wd33c93(sgiwd93_host);
+#endif
+	romvec->imode();
+}
+
+long prom_cfgsave(void)
+{
+	return romvec->cfg_save();
+}
+
+struct linux_sysid *prom_getsysid(void)
+{
+	return romvec->get_sysid();
+}
+
+__initfunc(void prom_cacheflush(void))
+{
+	romvec->cache_flush();
+}
diff -u --recursive --new-file v2.3.8/linux/arch/mips/arc/printf.c linux/arch/mips/arc/printf.c
--- v2.3.8/linux/arch/mips/arc/printf.c	Wed Dec 31 16:00:00 1969
+++ linux/arch/mips/arc/printf.c	Wed Jun 30 11:24:54 1999
@@ -0,0 +1,40 @@
+/*
+ * printf.c: Putting things on the screen using SGI arcs
+ *           PROM facilities.
+ *
+ * Copyright (C) 1996 David S. Miller (d...@sgi.com)
+ *
+ * $Id: printf.c,v 1.2 1999/06/12 18:42:38 ulfc Exp $
+ */
+#include <linux/config.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+
+#include <asm/sgialib.h>
+
+static char ppbuf[1024];
+
+#ifdef CONFIG_SGI_PROM_CONSOLE
+void prom_printf(char *fmt, ...)
+#else
+__initfunc(void prom_printf(char *fmt, ...))
+#endif
+{
+	va_list args;
+	char ch, *bptr;
+	int i;
+
+	va_start(args, fmt);
+	i = vsprintf(ppbuf, fmt, args);
+
+	bptr = ppbuf;
+
+	while((ch = *(bptr++)) != 0) {
+		if(ch == '\n')
+			prom_putchar('\r');
+
+		prom_putchar(ch);
+	}
+	va_end(args);
+	return;
+}
diff -u --recursive --new-file v2.3.8/linux/arch/mips/arc/salone.c linux/arch/mips/arc/salone.c
--- v2.3.8/linux/arch/mips/arc/salone.c	Wed Dec 31 16:00:00 1969
+++ linux/arch/mips/arc/salone.c	Fri Jun 25 17:40:12 1999
@@ -0,0 +1,25 @@
+/*
+ * salone.c: Routines to load into memory and execute stand-along
+ *           program images using ARCS PROM firmware.
+ *
+ * Copyright (C) 1996 David S. Miller (d...@engr.sgi.com)
+ *
+ * $Id: salone.c,v 1.1 1998/10/18 13:32:09 tsbogend Exp $
+ */
+#include <linux/init.h>
+#include <asm/sgialib.h>
+
+__initfunc(long prom_load(char *name, unsigned long end, unsigned long *pc, unsigned long *eaddr))
+{
+	return romvec->load(name, end, pc, eaddr);
+}
+
+__initfunc(long prom_invoke(unsigned long pc, unsigned long sp, long argc, char **argv, char **envp))
+{
+	return romvec->invoke(pc, sp, argc, argv, envp);
+}
+
+__initfunc(long prom_exec(char *name, long argc, char **argv, char **envp))
+{
+	return romvec->exec(name, argc, argv, envp);
+}
diff -u --recursive --new-file v2.3.8/linux/arch/mips/arc/time.c linux/arch/mips/arc/time.c
--- v2.3.8/linux/arch/mips/arc/time.c	Wed Dec 31 16:00:00 1969
+++ linux/arch/mips/arc/time.c	Fri Jun 25 17:40:12 1999
@@ -0,0 +1,19 @@
+/*
+ * time.c: Extracting time information from ARCS prom.
+ *
+ * Copyright (C) 1996 David S. Miller (d...@engr.sgi.com)
+ *
+ * $Id: time.c,v 1.1 1998/10/18 13:32:10 tsbogend Exp $
+ */
+#include <linux/init.h>
+#include <asm/sgialib.h>
+
+__initfunc(struct linux_tinfo *prom_gettinfo(void))
+{
+	return romvec->get_tinfo();
+}
+
+__initfunc(unsigned long prom_getrtime(void))
+{
+	return romvec->get_rtime();
+}
diff -u --recursive --new-file v2.3.8/linux/arch/mips/arc/tree.c linux/arch/mips/arc/tree.c
--- v2.3.8/linux/arch/mips/arc/tree.c	Wed Dec 31 16:00:00 1969
+++ linux/arch/mips/arc/tree.c	Fri Jun 25 17:40:12 1999
@@ -0,0 +1,109 @@
+/*
+ * tree.c: PROM component device tree code.
+ *
+ * Copyright (C) 1996 David S. Miller (d...@engr.sgi.com)
+ *
+ * $Id: tree.c,v 1.1 1998/10/18 13:32:10 tsbogend Exp $
+ */
+#include <linux/init.h>
+#include <asm/sgialib.h>
+
+#define DEBUG_PROM_TREE
+
+__initfunc(pcomponent *prom_getsibling(pcomponent *this))
+{
+	if(this == PROM_NULL_COMPONENT)
+		return PROM_NULL_COMPONENT;
+	return romvec->next_component(this);
+}
+
+__initfunc(pcomponent *prom_getchild(pcomponent *this))
+{
+	return romvec->child_component(this);
+}
+
+__initfunc(pcomponent *prom_getparent(pcomponent *child))
+{
+	if(child == PROM_NULL_COMPONENT)
+		return PROM_NULL_COMPONENT;
+	return romvec->parent_component(child);
+}
+
+__initfunc(long prom_getcdata(void *buffer, pcomponent *this))
+{
+	return romvec->component_data(buffer, this);
+}
+
+__initfunc(pcomponent *prom_childadd(pcomponent *this, pcomponent *tmp, void *data))
+{
+	return romvec->child_add(this, tmp, data);
+}
+
+__initfunc(long prom_delcomponent(pcomponent *this))
+{
+	return romvec->comp_del(this);
+}
+
+__initfunc(pcomponent *prom_componentbypath(char *path))
+{
+	return romvec->component_by_path(path);
+}
+
+#ifdef DEBUG_PROM_TREE
+static char *classes[] = {
+	"system", "processor", "cache", "adapter", "controller", "peripheral",
+	"memory"
+};
+
+static char *types[] = {
+	"arc", "cpu", "fpu", "picache", "pdcache", "sicache", "sdcache", "sccache",
+	"memdev", "eisa adapter", "tc adapter", "scsi adapter", "dti adapter",
+	"multi-func adapter", "disk controller", "tp controller",
+	"cdrom controller", "worm controller", "serial controller",
+	"net controller", "display controller", "parallel controller",
+	"pointer controller", "keyboard controller", "audio controller",
+	"misc controller", "disk peripheral", "floppy peripheral",
+	"tp peripheral", "modem peripheral", "monitor peripheral",
+	"printer peripheral", "pointer peripheral", "keyboard peripheral",
+	"terminal peripheral", "line peripheral", "net peripheral",
+	"misc peripheral", "anonymous"
+};
+
+static char *iflags[] = {
+	"bogus", "read only", "removable", "console in", "console out",
+	"input", "output"
+};
+
+__initfunc(static void dump_component(pcomponent *p))
+{
+	prom_printf("[%p]:class<%s>type<%s>flags<%s>ver<%d>rev<%d>",
+		    p, classes[p->class], types[p->type],
+		    iflags[p->iflags], p->vers, p->rev);
+	prom_printf("key<%08lx>\n\tamask<%08lx>cdsize<%d>ilen<%d>iname<%s>\n",
+		    p->key, p->amask, (int)p->cdsize, (int)p->ilen, p->iname);
+}
+
+__initfunc(static void traverse(pcomponent *p, int op))
+{
+	dump_component(p);
+	if(prom_getchild(p))
+		traverse(prom_getchild(p), 1);
+	if(prom_getsibling(p) && op)
+		traverse(prom_getsibling(p), 1);
+}
+
+__initfunc(void prom_testtree(void))
+{
+	pcomponent *p;
+
+	p = prom_getchild(PROM_NULL_COMPONENT);
+	dump_component(p);
+	p = prom_getchild(p);
+	while(p) {
+		dump_component(p);
+		p = prom_getsibling(p);
+	}
+	prom_printf("press a key\n");
+	prom_getchar();
+}
+#endif
diff -u --recursive --new-file v2.3.8/linux/arch/mips/baget/Makefile linux/arch/mips/baget/Makefile
--- v2.3.8/linux/arch/mips/baget/Makefile	Wed Dec 31 16:00:00 1969
+++ linux/arch/mips/baget/Makefile	Fri Jun 25 17:40:12 1999
@@ -0,0 +1,75 @@
+# $Id$
+#
+# Makefile for the Baget specific kernel interface routines
+# under Linux.
+#
+# Note! Dependencies are done automagically by 'make dep', which also
+# removes any old dependencies. DON'T put your own dependencies here
+# unless it's something special (ie not a .c file).
+#
+# Note 2! The CFLAGS definitions are now in the main makefile...
+
+all: baget.a 
+
+image:	../../../vmlinux
+	cp -f $< $@
+
+O_TARGET := baget.a
+O_OBJS   := baget.o print.o setup.o time.o irq.o bagetIRQ.o reset.o wbflush.o
+
+ifeq ($(CONFIG_SERIAL),y)
+	OX_OBJS += vacserial.o
+else
+	ifeq ($(CONFIG_SERIAL),m)
+		MX_OBJS += vacserial.o
+	endif
+endif
+ifeq ($(CONFIG_VAC_RTC),y)
+	OX_OBJS += vacrtc.o
+else
+	ifeq ($(CONFIG_VAC_RTC),m)
+		MX_OBJS += vacrtc.o
+	endif
+endif
+
+bagetIRQ.o : bagetIRQ.S
+	$(CC) $(CFLAGS) -c -o $@ $<
+
+
+##################### Baget Loader stuff ########################
+
+dummy.c:
+	touch $@
+
+image.bin: image
+	$(OBJCOPY) -O binary $< $@
+
+ramdisk.bin:
+	echo "Dummy ramdisk used. Provide your own if needed !" > $@
+
+dummy.o: dummy.c image.bin ramdisk.bin
+	$(CC) $(CFLAGS) -c -o $@ $<
+	$(OBJCOPY) --add-section=.vmlinux=image.bin \
+                   --add-section=.ramdisk=ramdisk.bin   $@ 
+
+balo.h: image
+	$(NM) $< | awk ' \
+            BEGIN               { printf "/* DO NOT EDIT THIS FILE */\n" }    \
+	    /kernel_entry/      { printf "#define START 0x%s\n", $$1 }        \
+            /balo_ramdisk_base/ { printf "#define RAMDISK_BASE 0x%s\n", $$1 } \
+	    /balo_ramdisk_size/ { printf "#define RAMDISK_SIZE 0x%s\n", $$1 } \
+                       ' > $@
+balo.o:   balo.c balo.h
+	$(CC) $(CFLAGS) -c $< 
+
+balo_supp.o: balo_supp.S
+	$(CC) $(CFLAGS) -c $<
+
+balo:   balo.o dummy.o balo_supp.o print.o
+	$(LD) $(LDFLAGS) -T ld.script.balo -o $@ $^ 
+
+clean:
+	rm -f balo.o balo.h dummy.o dummy.c hello.o image.bin image balo_supp.o
+	rm -f $(O_OBJS) $(O_TARGET)
+
+include $(TOPDIR)/Rules.make
diff -u --recursive --new-file v2.3.8/linux/arch/mips/baget/baget.c linux/arch/mips/baget/baget.c
--- v2.3.8/linux/arch/mips/baget/baget.c	Wed Dec 31 16:00:00 1969
+++ linux/arch/mips/baget/baget.c	Fri Jun 25 17:40:12 1999
@@ -0,0 +1,104 @@
+/* $Id$
+ *
+ * baget.c: Baget low level stuff
+ *
+ * Copyright (C) 1998 Gleb Raiko & Vladimir Roganov
+ *
+ */
+#include <stdarg.h>
+
+#include <linux/kernel.h>
+#include <linux/mm.h>
+#include <asm/system.h>
+#include <asm/bootinfo.h>
+#include <asm/mipsregs.h>
+#include <asm/pgtable.h>
+
+#include <asm/baget/baget.h>
+
+/* 
+ * Following values are set by BALO into RAM disk buffer parameters
+ */
+unsigned long balo_ramdisk_base = 0xBA;  /* Signature for BALO ! */
+unsigned long balo_ramdisk_size = 0;
+
+
+/*
+ *  Following code is based on routines from 'mm/vmalloc.c'
+ *  Additional parameters  ioaddr  is needed to iterate across real I/O address.
+ */
+static inline int alloc_area_pte(pte_t * pte, unsigned long address, 
+				 unsigned long size, unsigned long ioaddr)
+{
+        unsigned long end;
+
+        address &= ~PMD_MASK;
+        end = address + size;
+        if (end > PMD_SIZE)
+                end = PMD_SIZE;
+        while (address < end) {
+                unsigned long page;
+                if (!pte_none(*pte))
+                        printk("kseg2_alloc_io: page already exists\n");
+		/*
+		 *  For MIPS looks pretty to have transparent mapping
+		 *  for KSEG2 areas  -- user can't access one, and no 
+		 *  problems with  virtual <--> physical  translation.
+		 */
+                page = ioaddr & PAGE_MASK;
+
+                set_pte(pte, __pte(page | pgprot_val(PAGE_USERIO) |
+				  _PAGE_GLOBAL | __READABLE | __WRITEABLE));
+                address += PAGE_SIZE;
+		ioaddr  += PAGE_SIZE;
+                pte++;
+        }
+        return 0;
+}
+
+static inline int alloc_area_pmd(pmd_t * pmd, unsigned long address, 
+				 unsigned long size, unsigned long ioaddr)
+{
+        unsigned long end;
+
+        address &= ~PGDIR_MASK;
+        end = address + size;
+        if (end > PGDIR_SIZE)
+                end = PGDIR_SIZE;
+        while (address < end) {
+                pte_t * pte = pte_alloc_kernel(pmd, address);
+                if (!pte)
+                        return -ENOMEM;
+                if (alloc_area_pte(pte, address, end - address, ioaddr))
+                        return -ENOMEM;
+                address = (address + PMD_SIZE) & PMD_MASK;
+		ioaddr  += PMD_SIZE;
+                pmd++;
+        }
+        return 0;
+}
+
+int kseg2_alloc_io (unsigned long address, unsigned long size)
+{
+        pgd_t * dir;
+        unsigned long end = address + size;
+
+        dir = pgd_offset_k(address);
+        flush_cache_all();
+        while (address < end) {
+                pmd_t *pmd;
+                pgd_t olddir = *dir;
+
+                pmd = pmd_alloc_kernel(dir, address);
+                if (!pmd)
+                        return -ENOMEM;
+                if (alloc_area_pmd(pmd, address, end - address, address))
+                        return -ENOMEM;
+                if (pgd_val(olddir) != pgd_val(*dir))
+                        set_pgdir(address, *dir);
+                address = (address + PGDIR_SIZE) & PGDIR_MASK;
+                dir++;
+        }
+        flush_tlb_all();
+        return 0;
+}
diff -u --recursive --new-file v2.3.8/linux/arch/mips/baget/bagetIRQ.S linux/arch/mips/baget/bagetIRQ.S
--- v2.3.8/linux/arch/mips/baget/bagetIRQ.S	Wed Dec 31 16:00:00 1969
+++ linux/arch/mips/baget/bagetIRQ.S	Fri Jun 25 17:40:12 1999
@@ -0,0 +1,98 @@
+/* $Id$
+ * bagetIRQ.S: Interrupt exception dispatch code for Baget/MIPS
+ *
+ * Copyright (C) 1998 Gleb Raiko & Vladimir Roganov
+ */
+
+#include <asm/asm.h>
+#include <asm/mipsconfig.h>
+#include <asm/mipsregs.h>
+#include <asm/regdef.h>
+#include <asm/stackframe.h>
+#include <asm/addrspace.h>
+
+	.text
+	.set    mips1
+	.set    reorder
+	.set    macro
+	.set    noat
+	.align	5
+
+NESTED(bagetIRQ, PT_SIZE, sp)
+	SAVE_ALL
+	CLI				# Important: mark KERNEL mode !
+
+	la      a1, baget_interrupt
+	.set	push
+	.set    noreorder
+	jal	a1
+	.set    pop 
+	move	a0, sp                                          
+
+	la      a1, ret_from_irq
+	jr	a1
+END(bagetIRQ)
+	
+#define DBE_HANDLER       0x1C
+	
+NESTED(try_read, PT_SIZE, sp)
+	mfc0	t3, CP0_STATUS		# save flags and
+	CLI				#  disable interrupts
+
+	li	t0, KSEG2
+	sltu    t1, t0, a0              # Is it KSEG2 address ?               
+	beqz	t1, mapped              # No - already mapped !    
+					 
+	move    t0, a0		        
+	ori	t0, 0xfff
+	xori    t0, 0xfff               # round address to page
+
+	ori     t1, t0, 0xf00           # prepare EntryLo (N,V,D,G) 
+
+	mfc0    t2,   CP0_ENTRYHI       # save ASID value
+	mtc0	zero, CP0_INDEX
+	mtc0	t0,   CP0_ENTRYHI       # Load MMU values ...
+	mtc0    t1,   CP0_ENTRYLO0
+	nop                             # let it understand
+	nop
+	tlbwi				# ... and write ones
+	nop
+	nop
+	mtc0    t2,  CP0_ENTRYHI           
+	
+mapped:		
+	la	t0, exception_handlers
+	lw	t1, DBE_HANDLER(t0)	# save real handler
+	la	t2, dbe_handler			
+	sw	t2, DBE_HANDLER(t0)	# set temporary local handler
+	li	v0, -1			# default (failure) value
+	
+	li	t2, 1
+	beq	t2, a1, 1f
+	li	t2, 2
+	beq	t2, a1, 2f
+	li	t2, 4
+	beq	t2, a1, 4f
+	b	out
+
+1:	lbu	v0, (a0)		# byte
+	b	out
+
+2:	lhu	v0, (a0)		# short
+	b	out
+
+4:	lw	v0, (a0)		# word
+	
+out:		
+	sw	t1, DBE_HANDLER(t0)	# restore real handler
+	mtc0	t3, CP0_STATUS		# restore CPU flags
+	jr	ra			
+	
+dbe_handler:	
+	li	v0, -1			# mark our failure
+	.set	push
+	.set	noreorder
+	b	out			# "no problems !"
+	rfe				#   return from trap
+	.set	pop
+END(try_read)
diff -u --recursive --new-file v2.3.8/linux/arch/mips/baget/balo.c linux/arch/mips/baget/balo.c
--- v2.3.8/linux/arch/mips/baget/balo.c	Wed Dec 31 16:00:00 1969
+++ linux/arch/mips/baget/balo.c	Fri Jun 25 17:40:12 1999
@@ -0,0 +1,190 @@
+/* $Id$
+ *
+ * balo.c: BAget LOader
+ *
+ * Copyright (C) 1998 Gleb Raiko & Vladimir Roganov
+ *
+ */
+#include <linux/kernel.h>
+#include <asm/system.h>
+#include <asm/ptrace.h>
+#include <asm/addrspace.h>
+
+#include <asm/baget/baget.h>
+
+#include "balo.h"  /* Includes some kernel symbol values */
+
+static char *banner = "\nBaget Linux Loader v0.2\n";
+
+static void mem_move (long *to, long *from, long size)
+{
+	while (size > 0) { 
+		*to++ = *from++;
+		size -= sizeof(long);
+	}
+}
+
+static volatile int *mem_limit     = (volatile int*)KSEG1;
+static volatile int *mem_limit_dbe = (volatile int*)KSEG1;
+
+static int can_write (volatile int* p) {
+        return p <  (int*)(KSEG1+BALO_OFFSET) ||
+               p >= (int*)(KSEG1+BALO_OFFSET+BALO_SIZE);
+}
+
+static volatile enum balo_state_enum {
+	BALO_INIT,
+	MEM_INIT,
+	MEM_PROBE,
+	START_KERNEL
+} balo_state = BALO_INIT;
+
+
+static __inline__ void reset_and_jump(int start, int mem_upper)
+{
+	__asm__ __volatile__(
+                ".set\tnoreorder\n\t"
+                ".set\tnoat\n\t"
+                "mfc0\t$1,$12\n\t"
+                "nop\n\t"
+                "nop\n\t"
+                "nop\n\t"
+                "ori\t$1,$1,0xff00\n\t"
+                "xori\t$1,$1,0xff00\n\t"
+                "mtc0\t$1,$12\n\t"
+                "nop\n\t"
+                "nop\n\t"
+                "nop\n\t"
+		"move\t$4,%1\n\t"
+		"jr\t%0\n\t"
+		"nop\n\t"
+                ".set\tat\n\t"
+                ".set\treorder"           
+                : /* no outputs */
+                :"Ir" (start), "Ir" (mem_upper)
+                :"$1", "$4", "memory");
+}
+
+static void start_kernel(void)
+{
+	extern char _vmlinux_start, _vmlinux_end;
+	extern char _ramdisk_start, _ramdisk_end;
+
+        outs( "Relocating Linux... " );
+	mem_move((long*)KSEG0, (long*)&_vmlinux_start, 
+                 &_vmlinux_end-&_vmlinux_start);
+	outs("done.\n");
+
+	if (&_ramdisk_start != &_ramdisk_end) {
+		outs("Setting up RAMDISK... ");
+		if (*(unsigned long*)RAMDISK_BASE != 0xBA) {
+			outs("Bad RAMDISK_BASE signature in system image.\n");
+                        balo_hungup();
+		}
+		*(unsigned long*)RAMDISK_BASE = (unsigned long)&_ramdisk_start;
+		*(unsigned long*)RAMDISK_SIZE = &_ramdisk_end -&_ramdisk_start;
+		outs("done.\n");
+	}
+
+	{ 
+		extern void flush_cache_low(int isize, int dsize);
+		flush_cache_low(256*1024,256*1024);
+	}
+
+        balo_printf( "Kernel entry: %x\n\n", START);
+	balo_state = START_KERNEL;
+	reset_and_jump(START, (int)mem_limit-KSEG1+KSEG0);
+}
+
+
+static void mem_probe(void)
+{
+	balo_state = MEM_PROBE;
+	outs("RAM: <");
+	while(mem_limit < mem_limit_dbe) {
+                if (can_write(mem_limit) && *mem_limit != 0) 
+                        break; /* cycle found */
+		outc('.');
+		if (can_write(mem_limit)) 
+                        *mem_limit = -1; /* mark */
+                mem_limit += 0x40000;
+	}
+	outs(">\n");
+	start_kernel();
+}
+
+volatile unsigned int int_cause;
+volatile unsigned int epc;
+volatile unsigned int badvaddr;
+
+static void print_regs(void)
+{
+        balo_printf("CAUSE=%x EPC=%x BADVADDR=%x\n",
+                    int_cause, epc, badvaddr);
+}
+
+void int_handler(struct pt_regs *regs)
+{ 
+        switch (balo_state) {
+	case BALO_INIT:
+                balo_printf("\nBALO: trap in balo itself.\n");
+		print_regs();
+                balo_hungup();
+		break;
+	case MEM_INIT:
+                if ((int_cause & CAUSE_MASK) != CAUSE_DBE) {
+                        balo_printf("\nBALO: unexpected trap during memory init.\n");
+			print_regs();
+                        balo_hungup();
+		} else {
+			mem_probe();
+		}
+		break;
+	case MEM_PROBE:
+                balo_printf("\nBALO: unexpected trap during memory probe.\n");
+		print_regs();
+                balo_hungup();
+		break;
+	case START_KERNEL:
+                balo_printf("\nBALO: unexpected kernel trap.\n");
+		print_regs();
+                balo_hungup();
+		break;
+	}
+        balo_printf("\nBALO: unexpected return from handler.\n");
+	print_regs();
+        balo_hungup();
+}
+
+static void mem_init(void)
+{
+	balo_state = MEM_INIT;
+
+	while(1) {
+		*mem_limit_dbe;
+		if (can_write(mem_limit_dbe)) 
+			*mem_limit_dbe = 0;
+
+		mem_limit_dbe += 0x40000; /* +1M */
+	}
+        /*  no return: must go to int_handler */
+}
+
+void balo_entry(void)
+{
+        extern void except_vec3_generic(void);
+
+	cli(); 
+	outs(banner);
+        memcpy((void *)(KSEG0 + 0x80), &except_vec3_generic, 0x80);
+	mem_init();
+}
+
+/* Needed for linking */
+
+int vsprintf(char *buf, const char *fmt, va_list arg)
+{
+	outs("BALO: vsprintf called.\n");
+	balo_hungup();
+	return 0;
+}
diff -u --recursive --new-file v2.3.8/linux/arch/mips/baget/balo_supp.S linux/arch/mips/baget/balo_supp.S
--- v2.3.8/linux/arch/mips/baget/balo_supp.S	Wed Dec 31 16:00:00 1969
+++ linux/arch/mips/baget/balo_supp.S	Wed Jun 30 11:24:54 1999
@@ -0,0 +1,143 @@
+/* $Id$
+ * balo_supp.S: BAget Loader supplement
+ *
+ * Copyright (C) 1998 Gleb Raiko & Vladimir Roganov
+ */
+
+#include <asm/asm.h>
+#include <asm/regdef.h>
+#include <asm/stackframe.h>
+#include <asm/mipsregs.h>
+#include <asm/addrspace.h>
+	
+	.text
+	.set    mips1
+	
+	/* General exception vector. */
+NESTED(except_vec3_generic, 0, sp)
SHAR_EOF
true || echo 'restore of patch-2.3.9 failed'
fi
echo 'End of  part 01'
echo 'File patch-2.3.9 is continued in part 02'
echo 02 > _shar_seq_.tmp
exit 0
#!/bin/sh
# this is part 24 of a 26 - part archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file patch-2.3.9 continued
if test ! -r _shar_seq_.tmp; then
        echo 'Please unpack part 1 first!'
        exit 1
fi
(read Scheck
if test "$Scheck" != 24; then
        echo Please unpack part "$Scheck" next!
        exit 1
 else
        exit 0
 fi
) < _shar_seq_.tmp || exit 1
if test ! -f _shar_wnt_.tmp; then
echo 'x - still skipping patch-2.3.9'
else
echo 'x - continuing with patch-2.3.9'
sed 's/^X//' << 'SHAR_EOF' >> 'patch-2.3.9' &&
@@ -0,0 +1,109 @@
+/*
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Definitions for the interrupt related bits in the JUNKIO Asic
+ * interrupt status register (and the interrupt mask register, of course)
+ *
+ * Created with Information from:
+ *
+ * "DEC 3000 300/400/500/600/700/800/900 AXP Models System Programmer's Manual"
+ *
+ * and the Mach Sources
+ */
+
+/* 
+ * the upper 16 bits are common to all JUNKIO machines
+ * (except the FLOPPY and ISDN bits, which are Maxine sepcific)
+ */
+#define SCC0_TRANS_PAGEEND	0x80000000	/* Serial DMA Errors	*/
+#define SCC0_TRANS_MEMRDERR	0x40000000	/* see below		*/
+#define SCC0_RECV_HALFPAGE	0x20000000
+#define	SCC0_RECV_PAGOVRRUN	0x10000000
+#define SCC1_TRANS_PAGEEND	0x08000000	/* end of page reached	*/
+#define SCC1_TRANS_MEMRDERR	0x04000000	/* SCC1 DMA memory err	*/
+#define SCC1_RECV_HALFPAGE	0x02000000	/* SCC1 half page	*/
+#define	SCC1_RECV_PAGOVRRUN	0x01000000	/* SCC1 receive overrun	*/
+#define FLOPPY_DMA_ERROR	0x00800000	/* FDI DMA error	*/
+#define	ISDN_TRANS_PTR_LOADED	0x00400000	/* xmitbuf ptr loaded	*/
+#define ISDN_RECV_PTR_LOADED	0x00200000	/* rcvbuf ptr loaded	*/
+#define ISDN_DMA_MEMRDERR	0x00100000	/* read or ovrrun error	*/
+#define SCSI_PTR_LOADED		0x00080000
+#define SCSI_PAGOVRRUN		0x00040000	/* page overrun? */
+#define SCSI_DMA_MEMRDERR	0x00020000
+#define LANCE_DMA_MEMRDERR	0x00010000
+
+/*
+ * the lower 16 bits are system specific
+ */
+
+/*
+ * The following three seem to be in common
+ */
+#define SCSI_CHIP		0x00000200
+#define LANCE_CHIP		0x00000100
+#define SCC1_CHIP		0x00000080	/* NOT on maxine	*/
+#define SCC0_CHIP		0x00000040
+
+/*
+ * The rest is different
+ */
+
+/* kmin aka 3min aka kn02ba aka DS5000_1xx */
+#define KMIN_TIMEOUT		0x00001000	/* CPU IO-Write Timeout	*/
+#define KMIN_CLOCK		0x00000020
+#define KMIN_SCSI_FIFO		0x00000004	/* SCSI Data Ready	*/
+
+/* kn02ca aka maxine */
+#define MAXINE_FLOPPY		0x00008000	/* FDI Interrupt        */
+#define MAXINE_TC0		0x00001000	/* TC Option 0      	*/
+#define MAXINE_ISDN		0x00000800	/* ISDN	Chip		*/
+#define MAXINE_FLOPPY_HDS	0x00000080	/* Floppy Status      	*/
+#define MAXINE_TC1		0x00000020	/* TC Option 1		*/
+#define MAXINE_FLOPPY_XDS	0x00000010	/* Floppy Status      	*/
+#define MAXINE_VINT		0x00000008	/* Video Frame		*/
+#define MAXINE_N_VINT		0x00000004	/* Not Video frame	*/
+#define MAXINE_DTOP_TRANS	0x00000002	/* DTI Xmit-Rdy		*/
+#define MAXINE_DTOP_RECV	0x00000001	/* DTI Recv-Available	*/
+
+/* kn03 aka 3max+ aka DS5000_2x0 */
+#define KN03_TC2		0x00004000
+#define KN03_TC1		0x00002000
+#define KN03_TC0		0x00001000
+#define KN03_SCSI_FIFO		0x00000004	/* ??? Info from Mach	*/
+
+/*
+ * Now form groups, i.e. all serial interrupts, all SCSI interrupts and so on. 
+ */
+#define SERIAL_INTS	(SCC0_TRANS_PAGEEND | SCC0_TRANS_MEMRDERR | \
+			SCC0_RECV_HALFPAGE | SCC0_RECV_PAGOVRRUN | \
+			SCC1_TRANS_PAGEEND | SCC1_TRANS_MEMRDERR | \
+			SCC1_RECV_HALFPAGE | SCC1_RECV_PAGOVRRUN | \
+			SCC1_CHIP | SCC0_CHIP)
+
+#define XINE_SERIAL_INTS	(SCC0_TRANS_PAGEEND | SCC0_TRANS_MEMRDERR | \
+			SCC0_RECV_HALFPAGE | SCC0_RECV_PAGOVRRUN | \
+			SCC0_CHIP)
+
+#define SCSI_DMA_INTS	(/* SCSI_PTR_LOADED | */ SCSI_PAGOVRRUN | \
+			SCSI_DMA_MEMRDERR)
+
+#define KMIN_SCSI_INTS	(SCSI_PTR_LOADED | SCSI_PAGOVRRUN | \
+			SCSI_DMA_MEMRDERR | SCSI_CHIP | KMIN_SCSI_FIFO)
+
+#define LANCE_INTS	(LANCE_DMA_MEMRDERR | LANCE_CHIP)
+
+/*
+ * For future use ...
+ */
+#define XINE_FLOPPY_INTS (MAXINE_FLOPPY | MAXINE_FLOPPY_HDS | \
+			FLOPPY_DMA_ERROR | MAXINE_FLOPPY_XDS)
+
+#define XINE_ISDN_INTS	(MAXINE_ISDN | ISDN_TRANS_PTR_LOADED | \
+			ISDN_RECV_PTR_LOADED | ISDN_DMA_MEMRDERR)
+
+#define XINE_DTOP_INTS	(MAXINE_DTOP_TRANS | DTOP_RECV | \
+			ISDN_TRANS_PTR_LOADED | ISDN_RECV_PTR_LOADED | \
+			ISDN_DMA_MEMRDERR)
+
diff -u --recursive --new-file v2.3.8/linux/include/asm-mips/dec/kn01.h linux/include/asm-mips/dec/kn01.h
--- v2.3.8/linux/include/asm-mips/dec/kn01.h	Wed Dec 31 16:00:00 1969
+++ linux/include/asm-mips/dec/kn01.h	Fri Jun 25 17:37:53 1999
@@ -0,0 +1,28 @@
+/*
+ * Hardware info about DEC DECstation DS2100/3100 systems (otherwise known
+ * as pmax or kn01.
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 1995,1996 by Paul M. Antoine, some code and definitions
+ * are by curteousy of Chris Fraser.
+ *
+ * This file is under construction - you were warned!
+ */
+#ifndef __ASM_MIPS_DEC_KN01_H 
+#define __ASM_MIPS_DEC_KN01_H 
+
+#include <asm/addrspace.h>
+
+/*
+ * Some port addresses...
+ * FIXME: these addresses are incomplete and need tidying up!
+ */
+
+#define KN01_LANCE_BASE (KSEG1ADDR(0x18000000)) /* 0xB8000000 */
+#define KN01_DZ11_BASE	(KSEG1ADDR(0x1c000000)) /* 0xBC000000 */
+#define KN01_RTC_BASE	(KSEG1ADDR(0x1d000000)) /* 0xBD000000 */
+
+#endif /* __ASM_MIPS_DEC_KN01_H */
diff -u --recursive --new-file v2.3.8/linux/include/asm-mips/dec/kn02.h linux/include/asm-mips/dec/kn02.h
--- v2.3.8/linux/include/asm-mips/dec/kn02.h	Wed Dec 31 16:00:00 1969
+++ linux/include/asm-mips/dec/kn02.h	Fri Jun 25 17:37:53 1999
@@ -0,0 +1,41 @@
+/*
+ * Hardware info about DEC DECstation 5000/2xx systems (otherwise known
+ * as 3max or kn02.
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 1995,1996 by Paul M. Antoine, some code and definitions
+ * are by curteousy of Chris Fraser.
+ *
+ * This file is under construction - you were warned!
+ */
+#ifndef __ASM_MIPS_DEC_KN02_H 
+#define __ASM_MIPS_DEC_KN02_H 
+
+#include <asm/addrspace.h>
+
+/*
+ * Motherboard regs (kseg1 addresses)
+ */
+#define KN02_CSR_ADDR	KSEG1ADDR(0x1ff00000)	/* system control & status reg */
+
+/*
+ * Some port addresses...
+ * FIXME: these addresses are incomplete and need tidying up!
+ */
+#define KN02_RTC_BASE	KSEG1ADDR(0x1fe80000)
+#define KN02_DZ11_BASE	KSEG1ADDR(0x1fe00000)
+
+/*
+ * Interrupt enable Bits
+ */
+#define KN02_SLOT0	(1<<16)
+#define KN02_SLOT1	(1<<17)
+#define KN02_SLOT2	(1<<18)
+#define KN02_SLOT5	(1<<21)
+#define KN02_SLOT6	(1<<22)
+#define KN02_SLOT7	(1<<23)
+
+#endif /* __ASM_MIPS_DEC_KN02_H */
diff -u --recursive --new-file v2.3.8/linux/include/asm-mips/dec/kn02xa.h linux/include/asm-mips/dec/kn02xa.h
--- v2.3.8/linux/include/asm-mips/dec/kn02xa.h	Wed Dec 31 16:00:00 1969
+++ linux/include/asm-mips/dec/kn02xa.h	Fri Jun 25 17:37:53 1999
@@ -0,0 +1,34 @@
+/*
+ * Hardware info about DEC DECstation 5000/1xx systems (otherwise known
+ * as 3min or kn02ba. Apllies to the Personal DECstations 5000/xx (otherwise known
+ * as maxine or kn02ca) as well.
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 1995,1996 by Paul M. Antoine, some code and definitions
+ * are by curteousy of Chris Fraser.
+ *
+ * These are addresses which have to be known early in the boot process.
+ * For other addresses refer to tc.h ioasic_addrs.h and friends.
+ */
+#ifndef __ASM_MIPS_DEC_KN02XA_H 
+#define __ASM_MIPS_DEC_KN02XA_H 
+
+#include <asm/addrspace.h>
+
+/*
+ * Motherboard regs (kseg1 addresses)
+ */
+#define KN02XA_SSR_ADDR		KSEG1ADDR(0x1c040100)	/* system control & status reg */
+#define KN02XA_SIR_ADDR		KSEG1ADDR(0x1c040110)	/* system interrupt reg */
+#define KN02XA_SIRM_ADDR	KSEG1ADDR(0x1c040120)	/* system interrupt mask reg */
+
+/*
+ * Some port addresses...
+ * FIXME: these addresses are incomplete and need tidying up!
+ */
+#define KN02XA_RTC_BASE	(KSEG1ADDR(0x1c000000 + 0x200000)) /* ASIC + SL8 */
+
+#endif /* __ASM_MIPS_DEC_KN02XA_H */
diff -u --recursive --new-file v2.3.8/linux/include/asm-mips/dec/kn03.h linux/include/asm-mips/dec/kn03.h
--- v2.3.8/linux/include/asm-mips/dec/kn03.h	Wed Dec 31 16:00:00 1969
+++ linux/include/asm-mips/dec/kn03.h	Fri Jun 25 17:37:53 1999
@@ -0,0 +1,33 @@
+/*
+ * Hardware info about DEC DECstation 5000/2x0 systems (otherwise known
+ * as 3max+ or kn03.
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 1995,1996 by Paul M. Antoine, some code and definitions
+ * are by curteousy of Chris Fraser.
+ *
+ * These are addresses which have to be known early in the boot process.
+ * For other addresses refer to tc.h ioasic_addrs.h and friends.
+ */
+#ifndef __ASM_MIPS_DEC_KN03_H 
+#define __ASM_MIPS_DEC_KN03_H 
+
+#include <asm/addrspace.h>
+
+/*
+ * Motherboard regs (kseg1 addresses)
+ */
+#define KN03_SSR_ADDR	KSEG1ADDR(0x1f840100)	/* system control & status reg */
+#define KN03_SIR_ADDR	KSEG1ADDR(0x1f840110)	/* system interrupt reg */
+#define KN03_SIRM_ADDR	KSEG1ADDR(0x1f840120)	/* system interrupt mask reg */
+
+/*
+ * Some port addresses...
+ * FIXME: these addresses are incomplete and need tidying up!
+ */
+#define KN03_RTC_BASE	(KSEG1ADDR(0x1f800000 + 0x200000)) /* ASIC + SL8 */
+
+#endif /* __ASM_MIPS_DEC_KN03_H */
diff -u --recursive --new-file v2.3.8/linux/include/asm-mips/dec/machtype.h linux/include/asm-mips/dec/machtype.h
--- v2.3.8/linux/include/asm-mips/dec/machtype.h	Wed Dec 31 16:00:00 1969
+++ linux/include/asm-mips/dec/machtype.h	Fri Jun 25 17:37:53 1999
@@ -0,0 +1,20 @@
+/*
+ * Various machine type definitions
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (c) 1998 Harald Koerfgen
+ */
+#include <asm/bootinfo.h>
+
+#define TURBOCHANNEL	(mips_machtype == MACH_DS5000_200 || \
+			 mips_machtype == MACH_DS5000_1XX || \
+			 mips_machtype == MACH_DS5000_XX  || \
+			 mips_machtype == MACH_DS5000_2X0)
+		      
+#define IOASIC		(mips_machtype == MACH_DS5000_1XX || \
+			 mips_machtype == MACH_DS5000_XX  || \
+			 mips_machtype == MACH_DS5000_2X0)
+
diff -u --recursive --new-file v2.3.8/linux/include/asm-mips/dec/tc.h linux/include/asm-mips/dec/tc.h
--- v2.3.8/linux/include/asm-mips/dec/tc.h	Wed Dec 31 16:00:00 1969
+++ linux/include/asm-mips/dec/tc.h	Fri Jun 25 17:37:53 1999
@@ -0,0 +1,43 @@
+/*
+ * Interface to the TURBOchannel related routines
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (c) 1998 Harald Koerfgen
+ */
+#ifndef ASM_TC_H
+#define ASM_TC_H
+
+extern unsigned long system_base;
+
+/*
+ * Search for a TURBOchannel Option Module
+ * with a certain name. Returns slot number
+ * of the first card not in use or -ENODEV
+ * if none found.
+ */
+extern int search_tc_card(const char *);
+/*
+ * Marks the card in slot as used
+ */
+extern void claim_tc_card(int);
+/*
+ * Marks the card in slot as free
+ */
+extern void release_tc_card(int);
+/*
+ * Return base address of card in slot 
+ */
+extern unsigned long get_tc_base_addr(int);
+/*
+ * Return interrupt number of slot
+ */
+extern unsigned long get_tc_irq_nr(int);
+/*
+ * Return TURBOchannel clock frequency in hz
+ */
+extern unsigned long get_tc_speed(void);
+
+#endif
diff -u --recursive --new-file v2.3.8/linux/include/asm-mips/dec/tcinfo.h linux/include/asm-mips/dec/tcinfo.h
--- v2.3.8/linux/include/asm-mips/dec/tcinfo.h	Wed Dec 31 16:00:00 1969
+++ linux/include/asm-mips/dec/tcinfo.h	Fri Jun 25 17:37:53 1999
@@ -0,0 +1,47 @@
+/* 
+ * Various TURBOchannel related stuff
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Information obtained through the get_tcinfo prom call
+ * created from:
+ *
+ * TURBOchannel Firmware Specification
+ *
+ * EK-TCAAD-FS-004
+ * from Digital Equipment Corporation
+ *
+ * Copyright (c) 1998 Harald Koerfgen
+ */
+
+typedef struct {
+	int revision;
+	int clk_period;
+	int slot_size;
+	int io_timeout;
+	int dma_range;
+	int max_dma_burst;
+	int parity;
+	int reserved[4];
+} tcinfo;
+
+#define MAX_SLOT 7
+
+typedef struct {
+	unsigned long base_addr;
+	unsigned char name[9];
+	unsigned char vendor[9];
+	unsigned char firmware[9];
+	int interrupt;
+	int flags;
+} slot_info;
+
+/*
+ * Values for flags
+ */
+#define FREE 	1<<0
+#define IN_USE	1<<1
+
+
diff -u --recursive --new-file v2.3.8/linux/include/asm-mips/dec/tcmodule.h linux/include/asm-mips/dec/tcmodule.h
--- v2.3.8/linux/include/asm-mips/dec/tcmodule.h	Wed Dec 31 16:00:00 1969
+++ linux/include/asm-mips/dec/tcmodule.h	Fri Jun 25 17:37:53 1999
@@ -0,0 +1,35 @@
+/* 
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Offsets for the ROM header locations for
+ * TURBOchannel cards
+ *
+ * created from:
+ *
+ * TURBOchannel Firmware Specification
+ *
+ * EK-TCAAD-FS-004
+ * from Digital Equipment Corporation
+ *
+ * Jan.1998 Harald Koerfgen
+ */
+ 
+#define OLDCARD 0x3c0000
+
+#define ROM_WIDTH 0x3e0
+#define ROM_STRIDE 0x3e4
+#define ROM_SIZE 0x3e8
+#define SLOT_SIZE 0x3ec
+#define PATTERN0 0x3f0
+#define PATTERN1 0x3f4
+#define PATTERN2 0x3f8
+#define PATTERN3 0x3fc
+#define FIRM_VER 0x400
+#define VENDOR 0x420
+#define MODULE 0x440
+#define FIRM_TYPE 0x460
+#define FLAGS 0x470
+
+#define ROM_OBJECTS 0x480
diff -u --recursive --new-file v2.3.8/linux/include/asm-mips/delay.h linux/include/asm-mips/delay.h
--- v2.3.8/linux/include/asm-mips/delay.h	Thu Jun 26 12:33:39 1997
+++ linux/include/asm-mips/delay.h	Fri Jun 25 17:37:53 1999
@@ -1,3 +1,12 @@
+/* $Id: delay.h,v 1.2 1999/01/04 16:09:20 ralf Exp $
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 1994 by Waldorf Electronics
+ * Copyright (C) 1995 - 1998 by Ralf Baechle
+ */
X #ifndef __ASM_MIPS_DELAY_H
X #define __ASM_MIPS_DELAY_H
X 
@@ -25,7 +34,7 @@
X extern __inline__ void __udelay(unsigned long usecs, unsigned long lps)
X {
X 	usecs *= 0x000010c6;		/* 2**32 / 1000000 */
-	__asm__("multu\t%0,%1\n\t"
+	__asm__("multu\t%0,%2\n\t"
X 		"mfhi\t%0"
X 		:"=r" (usecs)
X 		:"0" (usecs),"r" (lps));
@@ -39,14 +48,5 @@
X #endif
X 
X #define udelay(usecs) __udelay((usecs),__udelay_val)
-
-/*
- * The different variants for 32/64 bit are pure paranoia. The typical
- * range of numbers that appears for MIPS machines avoids overflows.
- */
-extern __inline__ unsigned long muldiv(unsigned long a, unsigned long b, unsigned long c)
-{
-	return (a*b)/c;
-}
X 
X #endif /* __ASM_MIPS_DELAY_H */
diff -u --recursive --new-file v2.3.8/linux/include/asm-mips/dma.h linux/include/asm-mips/dma.h
--- v2.3.8/linux/include/asm-mips/dma.h	Tue Oct 20 13:52:53 1998
+++ linux/include/asm-mips/dma.h	Fri Jun 25 17:37:53 1999
@@ -16,6 +16,7 @@
X #include <asm/io.h>			/* need byte IO */
X #include <asm/spinlock.h>		/* And spinlocks */
X #include <linux/delay.h>
+#include <asm/system.h>
X 
X 
X #ifdef HAVE_REALLY_SLOW_DMA_CONTROLLER
@@ -175,8 +176,6 @@
X 		dma_outb(dmanr | 4,  DMA1_MASK_REG);
X 	else
X 		dma_outb((dmanr & 3) | 4,  DMA2_MASK_REG);
-	/* I hate voodoo programming but .. */
-	udelay(20);
X }
X 
X /* Clear the 'DMA Pointer Flip Flop'.
diff -u --recursive --new-file v2.3.8/linux/include/asm-mips/elf.h linux/include/asm-mips/elf.h
--- v2.3.8/linux/include/asm-mips/elf.h	Fri May  8 00:13:26 1998
+++ linux/include/asm-mips/elf.h	Fri Jun 25 17:37:53 1999
@@ -53,10 +53,20 @@
X 
X #define ELF_PLATFORM  (NULL)
X 
-/* See comments in asm-alpha/elf.h, this is the same thing
+/*
+ * See comments in asm-alpha/elf.h, this is the same thing
X  * on the MIPS.
X  */
-#define ELF_PLAT_INIT(_r)	_r->regs[2] = 0;
+#define ELF_PLAT_INIT(_r)	do { \
+	_r->regs[1] = _r->regs[2] = _r->regs[3] = _r->regs[4] = 0;	\
+	_r->regs[5] = _r->regs[6] = _r->regs[7] = _r->regs[8] = 0;	\
+	_r->regs[9] = _r->regs[10] = _r->regs[11] = _r->regs[12] = 0;	\
+	_r->regs[13] = _r->regs[14] = _r->regs[15] = _r->regs[16] = 0;	\
+	_r->regs[17] = _r->regs[18] = _r->regs[19] = _r->regs[20] = 0;	\
+	_r->regs[21] = _r->regs[22] = _r->regs[23] = _r->regs[24] = 0;	\
+	_r->regs[25] = _r->regs[26] = _r->regs[27] = _r->regs[28] = 0;	\
+	_r->regs[30] = _r->regs[31] = 0;				\
+} while (0)
X 
X /* This is the location that an ET_DYN program is loaded if exec'ed.  Typical
X    use of this is to invoke "./ld.so someprog" to test out a new version of
diff -u --recursive --new-file v2.3.8/linux/include/asm-mips/fcntl.h linux/include/asm-mips/fcntl.h
--- v2.3.8/linux/include/asm-mips/fcntl.h	Wed Oct 21 10:04:28 1998
+++ linux/include/asm-mips/fcntl.h	Fri Jun 25 17:37:53 1999
@@ -24,9 +24,9 @@
X #define O_NOCTTY	0x0800	/* not fcntl */
X #define FASYNC		0x1000	/* fcntl, for BSD compatibility */
X #define O_LARGEFILE	0x2000	/* allow large file opens - currently ignored */
-#define O_NOFOLLOW	0x4000	/* Don't follow symbolic links */
X #define O_DIRECT	0x8000	/* direct disk access hint - currently ignored */
X #define O_DIRECTORY	0x10000	/* must be a directory */
+#define O_NOFOLLOW	0x20000	/* don't follow links */
X 
X #define O_NDELAY	O_NONBLOCK
X 
diff -u --recursive --new-file v2.3.8/linux/include/asm-mips/ide.h linux/include/asm-mips/ide.h
--- v2.3.8/linux/include/asm-mips/ide.h	Thu May 13 11:00:09 1999
+++ linux/include/asm-mips/ide.h	Fri Jun 25 17:37:53 1999
@@ -23,7 +23,8 @@
X struct ide_ops {
X 	int (*ide_default_irq)(ide_ioreg_t base);
X 	ide_ioreg_t (*ide_default_io_base)(int index);
-	void (*ide_init_hwif_ports)(hw_regs_t *hw, ide_ioreg_t data_port, ide_ioreg_t ctrl_port, int *irq);
+	void (*ide_init_hwif_ports)(hw_regs_t *hw, ide_ioreg_t data_port,
+	                            ide_ioreg_t ctrl_port, int *irq);
X 	int (*ide_request_irq)(unsigned int irq, void (*handler)(int, void *,
X 	                       struct pt_regs *), unsigned long flags,
X 	                       const char *device, void *dev_id);
@@ -46,9 +47,11 @@
X 	return ide_ops->ide_default_io_base(index);
X }
X 
-static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port, ide_ioreg_t ctrl_port, int *irq)
+static __inline__ void ide_init_hwif_ports(hw_regs_t *hw,
+                                           ide_ioreg_t data_port,
+                                           ide_ioreg_t ctrl_port, int *irq)
X {
-	ide_ops->ide_init_hwif_ports(hw->io_ports, data_port, ctrl_port, &hw->irq);
+	ide_ops->ide_init_hwif_ports(hw, data_port, ctrl_port, &hw->irq);
X 
X 	hw->irq = ide_ops->ide_default_irq(data_port);
X }
diff -u --recursive --new-file v2.3.8/linux/include/asm-mips/init.h linux/include/asm-mips/init.h
--- v2.3.8/linux/include/asm-mips/init.h	Fri May  8 00:13:26 1998
+++ linux/include/asm-mips/init.h	Fri Jun 25 17:37:53 1999
@@ -1,11 +1,10 @@
-/*
- * include/asm-mips/init.h
+/* $Id: init.h,v 1.3 1999/02/15 02:22:10 ralf Exp $
X  *
X  * This file is subject to the terms and conditions of the GNU General Public
X  * License.  See the file "COPYING" in the main directory of this archive
X  * for more details.
X  *
- * $Id: init.h,v 1.3 1998/05/01 01:35:53 ralf Exp $
+ * Copyright 1998, 1999 Ralf Baechle
X  */
X #ifndef __MIPS_INIT_H
X #define __MIPS_INIT_H
@@ -26,5 +25,6 @@
X #define __INIT		.section	.text.init,"ax"
X #define __FINIT		.previous
X #define __INITDATA	.section	.data.init,"a"
+#define __cacheline_aligned __attribute__((__aligned__(L1_CACHE_BYTES)))
X 
X #endif /* __MIPS_INIT_H */
diff -u --recursive --new-file v2.3.8/linux/include/asm-mips/io.h linux/include/asm-mips/io.h
--- v2.3.8/linux/include/asm-mips/io.h	Thu May 13 11:00:09 1999
+++ linux/include/asm-mips/io.h	Wed Jun 30 11:24:55 1999
@@ -140,18 +140,21 @@
X /*
X  * XXX We need system specific versions of these to handle EISA address bits
X  * 24-31 on SNI.
+ * XXX more SNI hacks.
X  */
-#define readb(addr) (*(volatile unsigned char *) (isa_slot_offset + (unsigned long)(addr)))
-#define readw(addr) (*(volatile unsigned short *) (isa_slot_offset + (unsigned long)(addr)))
-#define readl(addr) (*(volatile unsigned int *) (isa_slot_offset + (unsigned long)(addr)))
-
-#define writeb(b,addr) (*(volatile unsigned char *) (isa_slot_offset + (unsigned long)(addr)) = (b))
-#define writew(b,addr) (*(volatile unsigned short *) (isa_slot_offset + (unsigned long)(addr)) = (b))
-#define writel(b,addr) (*(volatile unsigned int *) (isa_slot_offset + (unsigned long)(addr)) = (b))
-
-#define memset_io(a,b,c)	memset((void *)(isa_slot_offset + (unsigned long)a),(b),(c))
-#define memcpy_fromio(a,b,c)	memcpy((a),(void *)(isa_slot_offset + (unsigned long)(b)),(c))
-#define memcpy_toio(a,b,c)	memcpy((void *)(isa_slot_offset + (unsigned long)(a)),(b),(c))
+#define readb(addr) (*(volatile unsigned char *) (0xa0000000 + (unsigned long)(addr)))
+#define readw(addr) (*(volatile unsigned short *) (0xa0000000 + (unsigned long)(addr)))
+#define readl(addr) (*(volatile unsigned int *) (0xa0000000 + (unsigned long)(addr)))
+
+#define writeb(b,addr) (*(volatile unsigned char *) (0xa0000000 + (unsigned long)(addr)) = (b))
+#define writew(b,addr) (*(volatile unsigned short *) (0xa0000000 + (unsigned long)(addr)) = (b))
+#define writel(b,addr) (*(volatile unsigned int *) (0xa0000000 + (unsigned long)(addr)) = (b))
+
+#define memset_io(a,b,c)	memset((void *)(0xa0000000 + (unsigned long)a),(b),(c))
+#define memcpy_fromio(a,b,c)	memcpy((a),(void *)(0xa0000000 + (unsigned long)(b)),(c))
+#define memcpy_toio(a,b,c)	memcpy((void *)(0xa0000000 + (unsigned long)(a)),(b),(c))
+
+/* END SNI HACKS ... */
X 
X /*
X  * We don't have csum_partial_copy_fromio() yet, so we cheat here and
@@ -374,23 +377,24 @@
X 
X /*
X  * The caches on some architectures aren't dma-coherent and have need to
- * handle this in software.  There are two types of operations that
+ * handle this in software.  There are three types of operations that
X  * can be applied to dma buffers.
X  *
X  *  - dma_cache_wback_inv(start, size) makes caches and coherent by
X  *    writing the content of the caches back to memory, if necessary.
X  *    The function also invalidates the affected part of the caches as
X  *    necessary before DMA transfers from outside to memory.
+ *  - dma_cache_wback(start, size) makes caches and coherent by
+ *    writing the content of the caches back to memory, if necessary.
+ *    The function also invalidates the affected part of the caches as
+ *    necessary before DMA transfers from outside to memory.
X  *  - dma_cache_inv(start, size) invalidates the affected parts of the
X  *    caches.  Dirty lines of the caches may be written back or simply
X  *    be discarded.  This operation is necessary before dma operations
X  *    to the memory.
X  */
X extern void (*dma_cache_wback_inv)(unsigned long start, unsigned long size);
+extern void (*dma_cache_wback)(unsigned long start, unsigned long size);
X extern void (*dma_cache_inv)(unsigned long start, unsigned long size);
-
-/* Nothing to do */
-
-#define dma_cache_wback(_start,_size)		do { } while (0)
X 
X #endif /* __ASM_MIPS_IO_H */
diff -u --recursive --new-file v2.3.8/linux/include/asm-mips/ipc.h linux/include/asm-mips/ipc.h
--- v2.3.8/linux/include/asm-mips/ipc.h	Thu Jun 26 12:33:39 1997
+++ linux/include/asm-mips/ipc.h	Fri Jun 25 17:37:53 1999
@@ -24,6 +24,9 @@
X #define SHMGET		23
X #define SHMCTL		24
X 
+/* Used by the DIPC package, try and avoid reusing it */
+#define DIPC		25
+
X #define IPCCALL(version,op)	((version)<<16 | (op))
X 
X #endif /* __ASM_MIPS_IPC_H */
diff -u --recursive --new-file v2.3.8/linux/include/asm-mips/irq.h linux/include/asm-mips/irq.h
--- v2.3.8/linux/include/asm-mips/irq.h	Tue Oct 20 13:52:53 1998
+++ linux/include/asm-mips/irq.h	Fri Jun 25 17:37:53 1999
@@ -10,9 +10,6 @@
X #ifndef __ASM_MIPS_IRQ_H
X #define __ASM_MIPS_IRQ_H
X 
-/*
- * Actually this is a lie but we hide the local device's interrupts ...
- */
X #define NR_IRQS 64
X 
X #define TIMER_IRQ 0
@@ -20,18 +17,9 @@
X extern int (*irq_cannonicalize)(int irq);
X 
X struct irqaction;
-extern int setup_x86_irq(int irq, struct irqaction * new);
+extern int i8259_setup_irq(int irq, struct irqaction * new);
X extern void disable_irq(unsigned int);
X extern void enable_irq(unsigned int);
-
-extern unsigned int local_irq_count[];
-
-#ifdef __SMP__
-#error Send superfluous SMP boxes to ra...@uni-koblenz.de
-#else
-#define irq_enter(cpu, irq)     (++local_irq_count[cpu])
-#define irq_exit(cpu, irq)      (--local_irq_count[cpu])
-#endif
X 
X /* Machine specific interrupt initialization  */
X extern void (*irq_setup)(void);
diff -u --recursive --new-file v2.3.8/linux/include/asm-mips/jazz.h linux/include/asm-mips/jazz.h
--- v2.3.8/linux/include/asm-mips/jazz.h	Tue Oct 20 13:52:53 1998
+++ linux/include/asm-mips/jazz.h	Fri Jun 25 17:37:53 1999
@@ -203,15 +203,19 @@
X  * This is somewhat broken.  For reasons which nobody can remember anymore
X  * we remap the Jazz interrupts to the usual ISA style interrupt numbers.
X  */
-#define JAZZ_TIMER_IRQ          0
-#define JAZZ_KEYBOARD_IRQ       1
-#define JAZZ_FLOPPY_IRQ         6 /* needs to be consistent with floppy driver! */
-#define JAZZ_SCSI_IRQ           16
-#define JAZZ_ETHERNET_IRQ       17
-#define JAZZ_SERIAL1_IRQ        18
-#define JAZZ_SERIAL2_IRQ        19
-#define JAZZ_PARALLEL_IRQ       20
-#define JAZZ_MOUSE_IRQ          21
+#define JAZZ_PARALLEL_IRQ       16
+#define JAZZ_FLOPPY_IRQ          6 /* needs to be consistent with floppy driver! */
+#define JAZZ_SOUND_IRQ          18
+#define JAZZ_VIDEO_IRQ          19
+#define JAZZ_ETHERNET_IRQ       20
+#define JAZZ_SCSI_IRQ           21
+#define JAZZ_KEYBOARD_IRQ       22
+#define JAZZ_MOUSE_IRQ          23
+#define JAZZ_SERIAL1_IRQ        24
+#define JAZZ_SERIAL2_IRQ        25
+
+#define JAZZ_TIMER_IRQ          31
+
X 
X /*
X  * JAZZ DMA Channels
diff -u --recursive --new-file v2.3.8/linux/include/asm-mips/keyboard.h linux/include/asm-mips/keyboard.h
--- v2.3.8/linux/include/asm-mips/keyboard.h	Mon Apr 26 10:54:13 1999
+++ linux/include/asm-mips/keyboard.h	Wed Jun 30 11:24:55 1999
@@ -12,11 +12,12 @@
X 
X #ifdef __KERNEL__
X 
-#include <linux/config.h>
X #include <linux/delay.h>
X #include <linux/ioport.h>
X #include <asm/bootinfo.h>
X 
+#define DISABLE_KBD_DURING_INTERRUPTS 0
+
X extern int pckbd_setkeycode(unsigned int scancode, unsigned int keycode);
X extern int pckbd_getkeycode(unsigned int scancode);
X extern int pckbd_translate(unsigned char scancode, unsigned char *keycode,
@@ -39,60 +40,36 @@
X /* Some stoneage hardware needs delays after some operations.  */
X #define kbd_pause() do { } while(0)
X 
-/* Pointers to keyboard hardware access and init functions.  */
-unsigned char (*kbd_read_input)(void);
-void (*kbd_write_output)(unsigned char val);
-void (*kbd_write_command)(unsigned char val);
-unsigned char (*kbd_read_status)(void);
-
-void (*keyboard_setup)(void);
-
-#ifdef CONFIG_MIPS_JAZZ
-
-extern int jazz_ps2_request_irq(void);
-extern void jazz_ps2_free_irq(void);
-
-#define ps2_request_irq()      jazz_ps2_request_irq()
-#define ps2_free_irq(inode)    jazz_ps2_free_irq()
-
-#endif /* CONFIG_MIPS_JAZZ */
-
-#ifdef CONFIG_SGI
-
-#define DISABLE_KBD_DURING_INTERRUPTS 1
-
-/*
- * Machine specific bits for the PS/2 driver.
- * Aux device and keyboard share the interrupt on the Indy.
- */
-#define ps2_request_irq() 0
-#define ps2_free_irq(void) do { } while(0);
-
-#endif /* CONFIG_SGI */
-
-#if defined(CONFIG_ACER_PICA_61) || defined(CONFIG_SNI_RM200_PCI)
-#define CONF_KEYBOARD_USES_IO_PORTS
-#endif
-
-#ifdef CONF_KEYBOARD_USES_IO_PORTS
-/*
- * Most other MIPS machines access the keyboard controller via
- * memory mapped I/O ports.
- */
-#include <asm/io.h>
-
-/*
- * Machine specific bits for the PS/2 driver
- */
-
-#define AUX_IRQ 12
-
-#define ps2_request_irq()						\
-	request_irq(AUX_IRQ, aux_interrupt, 0, "PS/2 Mouse", NULL)
-
-#define ps2_free_irq(inode) free_irq(AUX_IRQ, NULL)
-
-#endif /* CONF_KEYBOARD_USES_IO_PORTS */
+struct kbd_ops {
+	/* Keyboard driver resource allocation  */
+	void (*kbd_request_region)(void);
+	int (*kbd_request_irq)(void (*handler)(int, void *, struct pt_regs *));
+
+	/* PSaux driver resource managment  */
+	int (*aux_request_irq)(void (*handler)(int, void *, struct pt_regs *));
+	void (*aux_free_irq)(void);
+
+	/* Methods to access the keyboard processor's I/O registers  */
+	unsigned char (*kbd_read_input)(void);
+	void (*kbd_write_output)(unsigned char val);
+	void (*kbd_write_command)(unsigned char val);
+	unsigned char (*kbd_read_status)(void);
+};
+
+extern struct kbd_ops *kbd_ops;
+
+/* Do the actual calls via kbd_ops vector  */
+#define kbd_request_region() kbd_ops->kbd_request_region()
+#define kbd_request_irq(handler) kbd_ops->kbd_request_irq(handler)
+
+#define aux_request_irq(hand, dev_id) kbd_ops->aux_request_irq(hand)
+#define aux_free_irq(dev_id) kbd_ops->aux_free_irq()
+
+#define kbd_read_input() kbd_ops->kbd_read_input()
+#define kbd_write_output(val) kbd_ops->kbd_write_output(val)
+#define kbd_write_command(val) kbd_ops->kbd_write_command(val)
+#define kbd_read_status() kbd_ops->kbd_read_status()
X 
X #endif /* __KERNEL */
+
X #endif /* __ASM_MIPS_KEYBOARD_H */
diff -u --recursive --new-file v2.3.8/linux/include/asm-mips/mipsregs.h linux/include/asm-mips/mipsregs.h
--- v2.3.8/linux/include/asm-mips/mipsregs.h	Tue Oct 20 13:52:53 1998
+++ linux/include/asm-mips/mipsregs.h	Fri Jun 25 17:37:53 1999
@@ -233,11 +233,12 @@
X /*
X  * Bitfields in the R[23]000 cp0 status register.
X  */
-#define ST0_KUC			0x00000001
-#define ST0_IEP			0x00000002
-#define ST0_KUP			0x00000004
-#define ST0_IEO			0x00000008
-#define ST0_KUO			0x00000010
+#define ST0_IEC                 0x00000001
+#define ST0_KUC			0x00000002
+#define ST0_IEP			0x00000004
+#define ST0_KUP			0x00000008
+#define ST0_IEO			0x00000010
+#define ST0_KUO			0x00000020
X /* bits 6 & 7 are reserved on R[23]000 */
X 
X /*
diff -u --recursive --new-file v2.3.8/linux/include/asm-mips/newport.h linux/include/asm-mips/newport.h
--- v2.3.8/linux/include/asm-mips/newport.h	Wed Sep 30 10:19:10 1998
+++ linux/include/asm-mips/newport.h	Fri Jun 25 17:37:53 1999
@@ -582,5 +582,12 @@
X         rex->set.dcbdata0.all = ((modereg) << 24) | (data24 & 0xffffff);
X }
X 
+#define BT445_PROTOCOL		DCB_CYCLES(1,1,3)
+
+#define BT445_CSR_ADDR_REG	(0 << DCB_CRS_SHIFT)
+#define BT445_CSR_REVISION	(2 << DCB_CRS_SHIFT)
+
+#define BT445_REVISION_REG	0x01
+
X #endif /* !(_SGI_NEWPORT_H) */
X 
diff -u --recursive --new-file v2.3.8/linux/include/asm-mips/ng1.h linux/include/asm-mips/ng1.h
--- v2.3.8/linux/include/asm-mips/ng1.h	Fri May  8 00:13:26 1998
+++ linux/include/asm-mips/ng1.h	Fri Jun 25 17:37:53 1999
@@ -5,24 +5,24 @@
X 
X typedef struct {
X         int flags;
-        u16 w, h;
-        u16 fields_sec;
+        __u16 w, h;
+        __u16 fields_sec;
X } ng1_vof_info_t;
X 
X struct ng1_info {
X 	struct gfx_info gfx_info;
-	u8 boardrev;
-        u8 rex3rev;
-        u8 vc2rev;
-        u8 monitortype;
-        u8 videoinstalled;
-        u8 mcrev;
-        u8 bitplanes;
-        u8 xmap9rev;
-        u8 cmaprev;
+	__u8 boardrev;
+        __u8 rex3rev;
+        __u8 vc2rev;
+        __u8 monitortype;
+        __u8 videoinstalled;
+        __u8 mcrev;
+        __u8 bitplanes;
+        __u8 xmap9rev;
+        __u8 cmaprev;
X         ng1_vof_info_t ng1_vof_info;
-        u8 bt445rev;
-        u8 paneltype;
+        __u8 bt445rev;
+        __u8 paneltype;
X };
X 
X #define GFX_NAME_NEWPORT "NG1"
diff -u --recursive --new-file v2.3.8/linux/include/asm-mips/ng1hw.h linux/include/asm-mips/ng1hw.h
--- v2.3.8/linux/include/asm-mips/ng1hw.h	Wed Dec 31 16:00:00 1969
+++ linux/include/asm-mips/ng1hw.h	Fri Jun 25 17:37:53 1999
@@ -0,0 +1,572 @@
+/* This is the hardware interface for newport graphics.  It's taken from
+   IRIX.
+
+   Alex deVries <puf...@redhat.com>
+
+*/
+
+
+#ifndef __SYS_NG1HW_H__
+#define __SYS_NG1HW_H__
+
+#ident "$Revision: 1.1 $"
+
+#define BIT(n)	(0x1 << n)
+
+
+#ifndef REX_ASMCODE
+
+typedef union {
+    volatile float flt;
+    volatile unsigned int word;
+} float_long;
+
+typedef volatile unsigned int vol_ulong;
+typedef volatile unsigned int fixed16;
+
+typedef union {
+    vol_ulong   byword;
+    struct {
+	volatile unsigned short s0;
+	volatile unsigned short s1;
+    } byshort;
+    struct {
+	volatile unsigned char b0, b1, b2;
+	volatile unsigned char b3;
+    } bybyte;
+} DCB_reg;
+
+#ifndef REXSIM
+typedef struct rex3regs {	/* THE CHIP */
+    vol_ulong drawmode1;	/* extra mode bits for GL 	0x0000 */
+    vol_ulong drawmode0;	/* command register 		0x0004 */
+
+    vol_ulong lsmode;		/* line stipple mode		0x0008 */
+    vol_ulong lspattern;	/* 32 bit pixel lspattern	0x000c */
+    vol_ulong lspatsave;	/* save register for lspattern	0x0010 */
+    vol_ulong zpattern;		/* 32 bit pixel zpattern	0x0014 */
+
+    vol_ulong colorback;	/* background color		0x0018 */
+    vol_ulong colorvram;	/* fast vram clear color	0x001c */
+    vol_ulong alpharef;		/* afunction reference value	0x0020 */
+
+    vol_ulong pad0;		/* padding 			0x0024 */	
+
+    vol_ulong smask0x;		/* screen mask 0, window rel,	0x0028 */
+    vol_ulong smask0y;		/* exclusively for the GL	0x002c */
+    vol_ulong _setup;		/* do line/span setup, no iter  0x0030 */
+    vol_ulong _stepz;		/* Enable ZPATTERN for this pix 0x0034 */
+    vol_ulong _lsrestore;	/* Restore lspattern,count	0x0038 */
+    vol_ulong _lssave;		/* Backup lspattern,count	0x003c */
+
+    char _pad1[0x100-0x40];
+
+    float_long _xstart;		/* 16.4(7) current x		0x0100 */
+    float_long _ystart;		/* 16.4(7) current y		0x0104 */
+    float_long _xend;		/* 16.4(7)			0x0108 */
+    float_long _yend;		/* 16.4(7)			0x010c */
+    vol_ulong xsave;		/* 16	x save for blocks	0x0110 */
+    vol_ulong xymove;		/* x,y copy dest offset		0x0114 */
+    float_long bresd;		/* s19.8 bres d error term	0x0118 */
+    float_long bress1;		/* s2.15 bres s coverage term	0x011c */
+    vol_ulong bresoctinc1;	/* 3(4)17.3 octant+inc1 value	0x0120 */
+    volatile int bresrndinc2;	/* 8(3)18.3 bres inc2 value	0x0124 */
+    vol_ulong brese1;		/* 1.15 bres e1 (minor slope)	0x0128 */
+    vol_ulong bress2;           /* s18.8 bres s2 coverage term  0x012c */
+    vol_ulong aweight0;		/* antialiasing weights		0x0130 */
+    vol_ulong aweight1;		/* antialiasing weights		0x0134 */
+    float_long xstartf;		/* 12.4(7) GL version of _xstart0x0138 */
+    float_long ystartf;		/* 12.4(7)			0x013c */
+    float_long xendf;		/* 12.4(7)			0x0140 */
+    float_long yendf;		/* 12.4(7)			0x0144 */
+    fixed16 xstarti;		/* 16 integer format for xstart 0x0148 */
+    float_long xendf1;		/* 12.4(7) same as xend		0x014c */
+    fixed16 xystarti;		/* 16,16			0x0150 */
+    fixed16 xyendi;		/* 16,16			0x0154 */
+    fixed16 xstartendi;		/* 16,16			0x0158 */
+    char _pad2[0x200-0x15c];
+    float_long colorred;	/* o12.11 red (also foreground)	0x0200 */
+    float_long coloralpha;	/* o8.11 alpha			0x0204 */
+    float_long colorgrn;	/* o8.11 green			0x0208 */
+    float_long colorblue;	/* o8.11 blue			0x020c */
+    float_long slopered;	/* s9.11			0x0210 */
+    float_long slopealpha;	/* s9.11			0x0214 */
+    float_long slopegrn;	/* s9.11			0x0218 */
+    float_long slopeblue;	/* s9.11			0x021c */
+    vol_ulong wrmask;		/* writemask			0x0220 */
+    vol_ulong colori;		/* packed bgr/ci		0x0224 */
+    float_long colorx;		/* 12.11 red (no overflow)	0x0228 */
+    float_long slopered1;	/* same as slopered		0x022c */
+    vol_ulong hostrw0;		/* host PIO/DMA port (msw)	0x0230 */
+    vol_ulong hostrw1;		/* host PIO/DMA port (lsw)	0x0234 */
+    vol_ulong dcbmode;		/* display ctrl bus mode reg 	0x0238 */
+    volatile int pad3;						/* 0x023c */
+    DCB_reg dcbdata0;		/* display ctrl bus port (msw)	0x0240 */
+    vol_ulong dcbdata1;		/* display ctrl bus port (lsw)	0x0244 */
+} Rex3regs;
+	
+
+typedef struct configregs {
+    vol_ulong smask1x;		/* screenmask1 right,left edges 0x1300 */
+    vol_ulong smask1y;		/* screenmask1 bottom,top edges 0x1304 */
+    vol_ulong smask2x;		/* screenmask2 right,left edges 0x1308 */
+    vol_ulong smask2y;		/* screenmask2 bottom,top edges 0x130c */
+    vol_ulong smask3x;		/* screenmask3 right,left edges 0x1310 */
+    vol_ulong smask3y;		/* screenmask3 bottom,top edges 0x1314 */
+    vol_ulong smask4x;		/* screenmask4 right,left edges 0x1318 */
+    vol_ulong smask4y;		/* screenmask4 bottom,top edges 0x131c */
+    vol_ulong topscan;		/* y coord of top screen line	0x1320 */
+    vol_ulong xywin;		/* window offset 		0x1324 */
+    vol_ulong clipmode;		/* cid,smask settings 		0x1328 */
+    vol_ulong pad0;		/*				0x132c */
+    vol_ulong config;		/* miscellaneous  config bits 	0x1330 */
+    vol_ulong pad1;		/*				0x1334 */
+    vol_ulong status;		/* chip busy, FIFO, int status  0x1338 */
+				/* read clears interrupt status bits   */
+    vol_ulong ustatus;		/* padding on rex rev a, 'read-only' 0x133c */
+				/* copy of status on rex rev b.	       */
+    vol_ulong dcbreset;		/* resets DCB and flushes BFIFO 0x1340 */
+} Configregs;
+
+typedef struct rex3chip {
+		/* page 0 */    
+	struct rex3regs set;		/* 0x0000 */
+	char _pad0[0x7fc-sizeof(struct rex3regs)];
+	volatile unsigned int dummy; /* 0x7fc */
+	struct rex3regs go;		/* 0x0800 */
+
+	char _pad1[0x1300-0x800-sizeof(struct rex3regs)];
+
+		/* page 1 */
+	struct {
+	    struct configregs set; 	/* 0x1300 */
+	    char _pad0[0x800-sizeof(struct configregs)];
+	    struct configregs go; 	/* 0x1b00 */
+	} p1;
+} rex3Chip, Rex3chip;
+
+
+#endif /* REX_ASMCODE */
+#endif /* REXSIM */
+
+/* Since alot of flags went away, define here as null bits
+   and leave the code as it is for now, 
+   marking where we have to change stuff.
+
+   NONE of these should be defined !   - billt
+   */
+
+#define LSCONTINUE 0
+#define SHADECONTINUE 0
+#define XYCONTINUE 0
+#define XMAJOR 0
+#define YMAJOR 0
+#define QUADMODE 0
+#define LRQPOLY 0
+/* RGBMODE, DITHER now live in DM1 */
+#define RGBMODECMD 0
+#define DITHER 0
+#define DITHERRANGE 0
+/* BLOCK is a function of ADDRMODE */
+#define BLOCK 0
+#define STOPONX 0
+#define STOPONY 0
+/* COLORCOMPARE is a combo of 3 bits (<, = , >) */
+#define COLORCOMP 0
+/* FRACTIONS are gone... */
+#define INITFRAC 0
+#define FRACTION1 0
+
+/* -- some old AUX1 junk -- */
+#define DOUBLEBUF 0
+#define DBLDST0 0
+#define DBLDST1 0
+#define DBLSRC 0
+#define COLORAUX 0
+
+
+/* --- a couple of old cmds also only for conversion --- */
+#define REX_LDPIXEL 0x1
+#define REX_ANTIAUX 0
+#define REX_DRAW 0
+#define LOGICSRC 0
+/* --- Blech! locicops are in DM1 too! */
+#define REX_LO_ZERO REX_LO_ZERO 
+#define REX_LO_AND DM1_LO_AND
+#define REX_LO_ANDR DM1_LO_ANDR
+#define REX_LO_SRC DM1_LO_SRC
+#define REX_LO_ANDI DM1_LO_ANDI
+#define REX_LO_DST DM1_LO_DST
+#define REX_LO_XOR DM1_LO_XOR
+#define REX_LO_OR DM1_LO_OR
+#define REX_LO_NOR DM1_LO_NOR
+#define REX_LO_XNOR DM1_LO_XNOR
+#define REX_LO_NDST DM1_LO_NDST
+#define REX_LO_ORR DM1_LO_ORR
+#define REX_LO_NSRC DM1_LO_NSRC
+#define REX_LO_ORI DM1_LO_ORI
+#define REX_LO_NAND DM1_LO_NAND
+#define REX_LO_ONE DM1_LO_ONE
+
+
+/*
+ *  drawmode flags
+ */
+#define DM0_OPCODE	0x3		/* opcode(1:0)	*/
+#	define DM0_NOP		0x0
+#	define DM0_READ		0x1
+#	define DM0_DRAW		0x2
+#	define DM0_SCR2SCR	0x3
+#define DM0_ADRMODE_SHIFT	2	/* adrmode(2:0)	*/
+#	define DM0_ADRMODE	(0x7<<DM0_ADRMODE_SHIFT)
+#	define DM0_SPAN		(0x0<<DM0_ADRMODE_SHIFT)
+#	define DM0_BLOCK	(0x1<<DM0_ADRMODE_SHIFT)
+#	define DM0_ILINE	(0x2<<DM0_ADRMODE_SHIFT)
+#	define DM0_FLINE	(0x3<<DM0_ADRMODE_SHIFT)
+#	define DM0_ALINE	(0x4<<DM0_ADRMODE_SHIFT)
+#ifdef OLDJUNK
+
+/* XXX These definitions are obsolete */
+
+#	define DM0_AELINE	(0x5<<DM0_ADRMODE_SHIFT)
+#	define DM0_ACWEDGE	(0x6<<DM0_ADRMODE_SHIFT)
+#	define DM0_ACCWEDGE	(0x7<<DM0_ADRMODE_SHIFT)
+
+#else
+
+/* XXX These are according to 11/2/92 spec */
+
+#       define DM0_TLINE        (0x5<<DM0_ADRMODE_SHIFT)
+#       define DM0_BLINE        (0x6<<DM0_ADRMODE_SHIFT)
+
+#endif /* OLDJUNK */
+
+#define DM0_DOSETUP	BIT(5)
+#define DM0_COLORHOST	BIT(6)
+#define DM0_ALPHAHOST	BIT(7)
+#define DM0_STOPONX	BIT(8)
+#define DM0_STOPONY	BIT(9)
+#define DM0_STOPONXY	(DM0_STOPONX | DM0_STOPONY)
+#define DM0_SKIPFIRST	BIT(10)
+#define DM0_SKIPLAST	BIT(11)
+#define DM0_ENZPATTERN	BIT(12)
+#define DM0_ENLSPATTERN	BIT(13)
+#define DM0_LSADVLAST	BIT(14)
+#define DM0_LENGTH32	BIT(15)
+#define DM0_ZOPAQUE	BIT(16)
+#define DM0_LSOPAQUE	BIT(17)
+#define DM0_SHADE	BIT(18)
+#define DM0_LRONLY	BIT(19)
+
+#ifdef OLDJUNK
+
+/* XXX These definitions are obsolete */
+
+#define DM0_CICLAMP     BIT(20)
+#define DM0_ENDPTFILTER BIT(21)
+
+#else
+
+/* XXX These are according to 11/2/92 spec */
+
+#define DM0_XYOFFSET    BIT(20)
+#define DM0_CICLAMP     BIT(21)
+#define DM0_ENDPTFILTER BIT(22)
+
+#endif	/* OLDJUNK */
+/* New Feature in REX REV B */
+#define	DM0_YSTRIDE	BIT(23)
+
+#define DM1_PLANES_SHIFT	0
+#define DM1_PLANES	0x7		/* planes(2:0)	*/
+#	define DM1_NOPLANES	0x0
+#	define DM1_RGBPLANES	0x1
+#	define DM1_RGBAPLANES	0x2
+#	define DM1_OLAYPLANES	0x4
+#	define DM1_PUPPLANES	0x5
+#	define DM1_CIDPLANES	0x6
+#define DM1_DRAWDEPTH_SHIFT	3	/* drawdepth(1:0)	*/
+#define DM1_DRAWDEPTH_MASK      (3 << DM1_DRAWDEPTH_SHIFT)
+#	define DM1_DRAWDEPTH	(0x3 << DM1_DRAWDEPTH_SHIFT)	
+#	define DM1_DRAWDEPTH4	(0x0 << DM1_DRAWDEPTH_SHIFT)
+#	define DM1_DRAWDEPTH8	(0x1 << DM1_DRAWDEPTH_SHIFT)
+#	define DM1_DRAWDEPTH12	(0x2 << DM1_DRAWDEPTH_SHIFT)
+#	define DM1_DRAWDEPTH24	(0x3 << DM1_DRAWDEPTH_SHIFT)
+#define DM1_DBLSRC		BIT(5)
+#define DM1_YFLIP		BIT(6)
+#define DM1_RWPACKED		BIT(7)
+#define DM1_HOSTDEPTH_SHIFT 	8	/* hostdepth(1:0)	*/
+#define DM1_HOSTDEPTH_MASK      (3 << DM1_HOSTDEPTH_SHIFT)
+#	define DM1_HOSTDEPTH	(0x3 << DM1_HOSTDEPTH_SHIFT)
+#	define DM1_HOSTDEPTH4	(0x0 << DM1_HOSTDEPTH_SHIFT)
+#	define DM1_HOSTDEPTH8	(0x1 << DM1_HOSTDEPTH_SHIFT)
+#	define DM1_HOSTDEPTH12	(0x2 << DM1_HOSTDEPTH_SHIFT)
+#	define DM1_HOSTDEPTH32	(0x3 << DM1_HOSTDEPTH_SHIFT)
+#define DM1_RWDOUBLE		BIT(10)
+#define DM1_SWAPENDIAN		BIT(11)
+#define DM1_COLORCOMPARE_SHIFT  12	/* compare (2:0)	*/
+#define DM1_COLORCOMPARE_MASK  (7 << DM1_COLORCOMPARE_SHIFT)
+#	define DM1_COLORCOMPARE (0x7 << DM1_COLORCOMPARE_SHIFT)
+#	define DM1_COLORCOMPLT	BIT(12)
+#	define DM1_COLORCOMPEQ	BIT(13)
+#	define DM1_COLORCOMPGT	BIT(14)
+#define DM1_RGBMODE		BIT(15)
+#define DM1_ENDITHER		BIT(16)
+#define DM1_FASTCLEAR		BIT(17)
+#define DM1_ENBLEND		BIT(18)
+#define DM1_SF_SHIFT		19	/* sfactor(2:0)	*/
+#define DM1_SF_MASK   		(7 << DM1_SF_SHIFT)
+#	define DM1_SF		(0x7 << DM1_SF_SHIFT)
+#	define DM1_SF_ZERO	(0x0 << DM1_SF_SHIFT)
+#	define DM1_SF_ONE	(0x1 << DM1_SF_SHIFT)
+#	define DM1_SF_DC	(0x2 << DM1_SF_SHIFT)
+#	define DM1_SF_MDC	(0x3 << DM1_SF_SHIFT)
+#	define DM1_SF_SA	(0x4 << DM1_SF_SHIFT)
+#	define DM1_SF_MSA	(0x5 << DM1_SF_SHIFT)
+#define DM1_DF_SHIFT		22	/* dfactor(2:0)	*/
+#define DM1_DF_MASK     (7 << DM1_DF_SHIFT)
+#	define DM1_DF		(0x7 << DM1_DF_SHIFT)
+#	define DM1_DF_ZERO	(0x0 << DM1_DF_SHIFT)
+#	define DM1_DF_ONE	(0x1 << DM1_DF_SHIFT)
+#	define DM1_DF_SC	(0x2 << DM1_DF_SHIFT)
+#	define DM1_DF_MSC	(0x3 << DM1_DF_SHIFT)
+#	define DM1_DF_SA	(0x4 << DM1_DF_SHIFT)
+#	define DM1_DF_MSA	(0x5 << DM1_DF_SHIFT)
+#define DM1_ENBACKBLEND		BIT(25)
+#define DM1_ENPREFETCH		BIT(26)
+#define DM1_BLENDALPHA		BIT(27)
+#define DM1_LO_SHIFT		28	/* logicop(3:0)	*/
+#	define DM1_LO		(0xF << DM1_LO_SHIFT)
+#       define DM1_LO_MASK      DM1_LO
+#	define DM1_LO_ZERO	(0x0 << DM1_LO_SHIFT)
+#	define DM1_LO_AND	(0x1 << DM1_LO_SHIFT)
+#	define DM1_LO_ANDR	(0x2 << DM1_LO_SHIFT)
+#	define DM1_LO_SRC	(0x3 << DM1_LO_SHIFT)
+#	define DM1_LO_ANDI	(0x4 << DM1_LO_SHIFT)
+#	define DM1_LO_DST	(0x5 << DM1_LO_SHIFT)
+#	define DM1_LO_XOR	(0x6 << DM1_LO_SHIFT)
+#	define DM1_LO_OR	(0x7 << DM1_LO_SHIFT)
+#	define DM1_LO_NOR	(0x8 << DM1_LO_SHIFT)
+#	define DM1_LO_XNOR	(0x9 << DM1_LO_SHIFT)
+#	define DM1_LO_NDST	(0xa << DM1_LO_SHIFT)
+#	define DM1_LO_ORR	(0xb << DM1_LO_SHIFT)
+#	define DM1_LO_NSRC	(0xc << DM1_LO_SHIFT)
+#	define DM1_LO_ORI	(0xd << DM1_LO_SHIFT)
+#	define DM1_LO_NAND	(0xe << DM1_LO_SHIFT)
+#	define DM1_LO_ONE	(0xf << DM1_LO_SHIFT)
+
+
+
+/*
+ * Clipmode register bits
+ */
+
+#define SMASK0	BIT(0)
+#define SMASK1	BIT(1)
+#define SMASK2	BIT(2)
+#define SMASK3	BIT(3)
+#define SMASK4	BIT(4)
+#define ALL_SMASKS	31
+
+#define CM_CIDMATCH_SHIFT       9
+#define CM_CIDMATCH_MASK        (0xf << CM_CIDMATCH_SHIFT)
+
+
+/*
+ * Status register bits
+ */
+
+#define REX3VERSION_MASK 7
+#define GFXBUSY         BIT(3)
+#define BACKBUSY        BIT(4)
+#define VRINT           BIT(5)
+#define VIDEOINT        BIT(6)
+#define GFIFO_LEVEL_SHIFT       7
+#define GFIFO_LEVEL_MASK        (0x3f << GFIFO_LEVEL_SHIFT)
+#define BFIFO_LEVEL_SHIFT       13
+#define BFIFO_LEVEL_MASK        (0x1f << BFIFO_LEVEL_SHIFT)
+#define BFIFO_INT        BIT(18)
+#define GFIFO_INT        BIT(19)
+
+
+/*
+ * Config register bits
+ */
+
+#define GIO32MODE       BIT(0)
+#define BUSWIDTH        BIT(1)
+#define EXTREGXCVR      BIT(2)
+#define BFIFODEPTH_SHIFT        3
+#define BFIFODEPTH_MASK         (0xf << BFIFODEPTH_SHIFT)
+#define BFIFOABOVEINT   BIT(7)
+#define GFIFODEPTH_SHIFT        8
+#define GFIFODEPTH_MASK         (0x1f << GFIFODEPTH_SHIFT)
+#define GFIFOABOVEINT   BIT(13)
+#define TIMEOUT_SHIFT   14
+#define TIMEOUT_MASK    (7 << TIMEOUT_SHIFT)
+#define VREFRESH_SHIFT  17
+#define VREFRESH_MASK   (0x7 << VREFRESH_SHIFT)
+#define FB_TYPE         BIT(20)
+
+/*
+ * Display Control Bus (DCB) macros
+ */
+
+#define DCB_DATAWIDTH_MASK  (0x3)
+#define DCB_ENDATAPACK      BIT(2)
+#define DCB_ENCRSINC        BIT(3)
+#define DCB_CRS_SHIFT    4
+#define DCB_CRS_MASK     (0x7 << DCB_CRS_SHIFT)
+#define DCB_ADDR_SHIFT   7
+#define DCB_ADDR_MASK    (0xf << DCB_ADDR_SHIFT)
+#define DCB_ENSYNCACK       BIT(11)
+#define DCB_ENASYNCACK      BIT(12)
+#define DCB_CSWIDTH_SHIFT   13
+#define DCB_CSWIDTH_MASK    (0x1f << CSWIDTH_SHIFT)
+#define DCB_CSHOLD_SHIFT    18
+#define DCB_CSHOLD_MASK     (0x1f << CSHOLD_SHIFT)
+#define DCB_CSSETUP_SHIFT   23
+#define DCB_CSSETUP_MASK    (0x1f << CSSETUP_SHIFT)
+#define DCB_SWAPENDIAN      BIT(28)
+
+
+/*
+ * Some values for DCBMODE fields
+ */
+#define DCB_DATAWIDTH_4		0x0
+#define DCB_DATAWIDTH_1		0x1
+#define DCB_DATAWIDTH_2		0x2
+#define DCB_DATAWIDTH_3		0x3
+
+
+/*
+ * DCB_ADDR values to select the various dcb slave devices
+ */
+#define DCB_VC2          (0 << DCB_ADDR_SHIFT)
+#define DCB_CMAP_ALL     (1 << DCB_ADDR_SHIFT)
+#define DCB_CMAP0        (2 << DCB_ADDR_SHIFT)
+#define DCB_CMAP1        (3 << DCB_ADDR_SHIFT)
+#define DCB_XMAP_ALL     (4 << DCB_ADDR_SHIFT)
+#define DCB_XMAP0        (5 << DCB_ADDR_SHIFT)
+#define DCB_XMAP1        (6 << DCB_ADDR_SHIFT)
+#define DCB_BT445        (7 << DCB_ADDR_SHIFT)
+#define DCB_VCC1         (8 << DCB_ADDR_SHIFT)
+#define DCB_VAB1         (9 << DCB_ADDR_SHIFT)
+#define DCB_LG3_BDVERS0      (10 << DCB_ADDR_SHIFT)
+#define DCB_LG3_ICS1562      (11 << DCB_ADDR_SHIFT)
+#define DCB_RESERVED     (15 << DCB_ADDR_SHIFT)
+
+/*
+ * New DCB Addresses which are used in (new) Indigo2 Video and Galileo 1.5
+ * since these boards have to work with Mardi Gras also. Yet, these
+ * are not necessarily the MGRAS address, these translate to the Mardi Gras
+ * addresses when the lower 2 bits are swapped (which will happen on 
+ * the Newport to new video board flex cable).
+ */
+#define DCB_VAB1_NEW     (9 << DCB_ADDR_SHIFT)
+/*
+ * While the Presenter is currently using address 12 and
+ * conflicting with the CC1, it has been changed for Mardi Gras
+ * To use the new video boards with Newport (an unreleased product)
+ * the presenter probe must be disabled by changing the presenter
+ * DCB address in gfx/kern/sys/pcd.h (and possibly
+ * lotus/stand/arcs/lib/libsk/graphics/NEWPORT/pcd.h), so 
+ * it is probed at address 11.  This will of course not work with
+ * the presenter card but it will allow you to test new video
+ * boards will Newport
+ */
+
+#define DCB_VCC1_NEW     (12 << DCB_ADDR_SHIFT)
+/*#define DCB_VCC1_NEW     (8 << DCB_ADDR_SHIFT)*/
+
+/*
+ * Addresses being used for Galileo 1.5.
+ */
+#define DCB_VCC1_GAL     (8 << DCB_ADDR_SHIFT) /* was 12 and will return */
+#define DCB_VAB1_GAL     (9 << DCB_ADDR_SHIFT)
+#define DCB_TMI_CSC      (13 << DCB_ADDR_SHIFT)
+#define DCB_GAL          (14 << DCB_ADDR_SHIFT)
+
+/*
+ * LG3 - (Newport for Fullhouse) board defines
+ */
+/* Version 0 register */
+#define LG3_VC2_UNRESET BIT(0)
+#define	LG3_GFX_UNRESET	BIT(1)
+#define LG3_PLL_UNRESET BIT(2)
+#define LG3_DLHD_MASTER BIT(3)
+
+#define LG3_BDVERS_PROTOCOL ((2 << DCB_CSWIDTH_SHIFT) | (1 << DCB_CSHOLD_SHIFT) | (1 << DCB_CSSETUP_SHIFT))
+
+#define lg3BdVersGet(rex3, data)			 		\
+        rex3->set.dcbmode = DCB_LG3_BDVERS0 | \
+		LG3_BDVERS_PROTOCOL | DCB_DATAWIDTH_1 ;			\
+        data = rex3->set.dcbdata0.bybyte.b3
+
+#define lg3BdVersSet(rex3, data)			 		\
+        rex3->set.dcbmode = DCB_LG3_BDVERS0 | \
+		LG3_BDVERS_PROTOCOL | DCB_DATAWIDTH_1 ;		\
+	rex3->set.dcbdata0.bybyte.b3 = (data)
+
+#define Ics1562Set(rex3, data)			 		\
+        rex3->set.dcbmode = DCB_LG3_ICS1562 | LG3_BDVERS_PROTOCOL | DCB_DATAWIDTH_1 ; \
+	rex3->set.dcbdata0.bybyte.b3 = (data)
+
+#define	LG3_BD_001	0x7
+#define	LG3_BD_002	0x0
+/*
+ * Lsmode register bits
+ */
+#define LSRCOUNT_SHIFT  0
+#define LSRCOUNT_MASK   (0xff << LSRCOUNT_SHIFT)
+#define LSREPEAT_SHIFT  8
+#define LSREPEAT_MASK   (0xff << LSREPEAT_SHIFT)
+#define LSRCNTSAVE_SHIFT        16
+#define LSRCNTSAVE_MASK (0xff << LSRCNTSAVE_SHIFT)
+#define LSLENGTH_SHIFT  24
+#define LSLENGTH_MASK   (0xf << LSLENGTH_SHIFT)
+
+#if	defined ( _KERNEL ) && defined ( REX3_RUNTIME_REV_CHECK )
+
+extern void _newport_poll_status (register struct rex3chip *, register int);
+
+#define REX3WAIT(rex3)  _newport_poll_status (rex3, GFXBUSY)
+#define BFIFOWAIT(rex3)  _newport_poll_status (rex3, BACKBUSY)
+
+#else
+
+/* XXX  When we drop support for rex rev b,
+ * change status to ustatus in the macros below.
+ */
+#define REX3WAIT(rex3)  while ((rex3)->p1.set.status & GFXBUSY)
+#define BFIFOWAIT(rex3)  while ((rex3)->p1.set.status & BACKBUSY)
+
+#endif
+
+/*
+ * Legal GIO bus addresses for Newport graphics boards.
+ */
+#define REX3_GIO_ADDR_0         0x1f0f0000
+#define REX3_GIO_ADDR_1         0x1f4f0000
+#define REX3_GIO_ADDR_2         0x1f8f0000
+#define REX3_GIO_ADDR_3         0x1fcf0000
+
+#define NG1_XSIZE       1280    /* screen size in x */
+#define NG1_YSIZE       1024    /* screen size in y */
+
+/*
+ * XXX Correct values TBD.  Depends on video timing
+ */
+#define CURSOR_XOFF 29
+#define CURSOR_YOFF 31
+
+#ifdef _STANDALONE
+struct rex3chip;
+struct ng1_info;
+void Ng1RegisterInit(struct rex3chip *, struct ng1_info *);
+extern int ng1checkboard(void);
+extern void vc2LoadSRAM(struct rex3chip *, unsigned short *,
+		unsigned int , unsigned int);
+#endif
+
+#endif /* __SYS_NG1HW_H__ */
diff -u --recursive --new-file v2.3.8/linux/include/asm-mips/offset.h linux/include/asm-mips/offset.h
--- v2.3.8/linux/include/asm-mips/offset.h	Tue Oct 20 13:52:53 1998
+++ linux/include/asm-mips/offset.h	Fri Jun 25 17:37:53 1999
@@ -78,9 +78,9 @@
X #define THREAD_OLDCTX  912
X 
X /* Linux mm_struct offsets. */
-#define MM_COUNT      12
-#define MM_PGD        8
-#define MM_CONTEXT    32
+#define MM_COUNT      16
+#define MM_PGD        12
+#define MM_CONTEXT    52
X 
X /* Linux sigcontext offsets. */
X #define SC_REGMASK    0
diff -u --recursive --new-file v2.3.8/linux/include/asm-mips/page.h linux/include/asm-mips/page.h
--- v2.3.8/linux/include/asm-mips/page.h	Fri May  8 00:13:26 1998
+++ linux/include/asm-mips/page.h	Fri Jun 25 17:37:53 1999
@@ -1,11 +1,12 @@
-/*
+/* $Id: page.h,v 1.6 1999/01/04 16:09:24 ralf Exp $
+ *
X  * Definitions for page handling
X  *
X  * This file is subject to the terms and conditions of the GNU General Public
X  * License.  See the file "COPYING" in the main directory of this archive
X  * for more details.
X  *
- * Copyright (C) 1994, 1995, 1996 by Ralf Baechle
+ * Copyright (C) 1994 - 1998 by Ralf Baechle
X  */
X #ifndef __ASM_MIPS_PAGE_H
X #define __ASM_MIPS_PAGE_H
@@ -19,10 +20,8 @@
X 
X #define STRICT_MM_TYPECHECKS
X 
-#ifndef __LANGUAGE_ASSEMBLY__
+#ifndef _LANGUAGE_ASSEMBLY
X 
-#define get_user_page(vaddr)		__get_free_page(GFP_KERNEL)
-#define free_user_page(page, addr)	free_page(addr)
X extern void (*clear_page)(unsigned long page);
X extern void (*copy_page)(unsigned long to, unsigned long from);
X 
@@ -66,7 +65,7 @@
X 
X #endif /* !defined (STRICT_MM_TYPECHECKS) */
X 
-#endif /* __LANGUAGE_ASSEMBLY__ */
+#endif /* _LANGUAGE_ASSEMBLY */
X 
X /* to align the pointer to the (next) page boundary */
X #define PAGE_ALIGN(addr)	(((addr)+PAGE_SIZE-1)&PAGE_MASK)
@@ -78,8 +77,7 @@
X #define PAGE_OFFSET	0x80000000UL
X #define __pa(x)		((unsigned long) (x) - PAGE_OFFSET)
X #define __va(x)		((void *)((unsigned long) (x) + PAGE_OFFSET))
-#define MAP_MASK        0x1fffffffUL
-#define MAP_NR(addr)	((((unsigned long)(addr)) & MAP_MASK) >> PAGE_SHIFT)
+#define MAP_NR(addr)	(__pa(addr) >> PAGE_SHIFT)
X 
X #endif /* defined (__KERNEL__) */
X 
diff -u --recursive --new-file v2.3.8/linux/include/asm-mips/pci.h linux/include/asm-mips/pci.h
--- v2.3.8/linux/include/asm-mips/pci.h	Tue Aug  4 16:06:57 1998
+++ linux/include/asm-mips/pci.h	Fri Jun 25 17:37:53 1999
@@ -10,7 +10,7 @@
X #define __ASM_MIPS_PCI_H
X 
X struct pci_ops {
-	unsigned long (*pcibios_fixup) (void);
+	void (*pcibios_fixup) (void);
X 	int (*pcibios_read_config_byte) (unsigned char bus,
X 	                                 unsigned char dev_fn,
X 	                                 unsigned char where,
diff -u --recursive --new-file v2.3.8/linux/include/asm-mips/pgtable.h linux/include/asm-mips/pgtable.h
--- v2.3.8/linux/include/asm-mips/pgtable.h	Wed Mar 10 18:11:51 1999
+++ linux/include/asm-mips/pgtable.h	Fri Jun 25 17:37:53 1999
@@ -129,7 +129,7 @@
X #define __READABLE	(_PAGE_READ | _PAGE_SILENT_READ | _PAGE_ACCESSED)
X #define __WRITEABLE	(_PAGE_WRITE | _PAGE_SILENT_WRITE | _PAGE_MODIFIED)
X 
-#define _PAGE_CHG_MASK  (PAGE_MASK | __READABLE | __WRITEABLE | _CACHE_MASK)
+#define _PAGE_CHG_MASK  (PAGE_MASK | _PAGE_ACCESSED | _PAGE_MODIFIED | _CACHE_MASK)
X 
X #define PAGE_NONE	__pgprot(_PAGE_PRESENT | _CACHE_CACHABLE_NONCOHERENT)
X #define PAGE_SHARED     __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | \
@@ -356,7 +356,7 @@
X 
X extern inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot)
X {
-	return __pte((physpage - PAGE_OFFSET) | pgprot_val(pgprot));
+	return __pte(physpage | pgprot_val(pgprot));
X }
X 
X extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
@@ -580,9 +580,9 @@
X /*
X  * Kernel with 32 bit address space
X  */
-#define SWP_TYPE(entry) (((entry) >> 8) & 0x7f)
-#define SWP_OFFSET(entry) ((entry) >> 15)
-#define SWP_ENTRY(type,offset) (((type) << 8) | ((offset) << 15))
+#define SWP_TYPE(entry) (((entry) >> 1) & 0x3f)
+#define SWP_OFFSET(entry) ((entry) >> 8)
+#define SWP_ENTRY(type,offset) (((type) << 1) | ((offset) << 8))
X 
X #define module_map      vmalloc
X #define module_unmap    vfree
diff -u --recursive --new-file v2.3.8/linux/include/asm-mips/processor.h linux/include/asm-mips/processor.h
--- v2.3.8/linux/include/asm-mips/processor.h	Tue May 25 14:55:05 1999
+++ linux/include/asm-mips/processor.h	Fri Jun 25 17:37:53 1999
@@ -180,6 +180,7 @@
X 
X /* Free all resources held by a thread. */
X extern void release_thread(struct task_struct *);
+extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
X 
X /* Copy and release all segment info associated with a VM */
X #define copy_segments(nr, p, mm) do { } while(0)
@@ -200,6 +201,7 @@
X 	return ((unsigned long*)t->reg29)[17];
X }
X 
+struct pt_regs;
X extern int (*user_mode)(struct pt_regs *);
X 
X /*
diff -u --recursive --new-file v2.3.8/linux/include/asm-mips/ptrace.h linux/include/asm-mips/ptrace.h
--- v2.3.8/linux/include/asm-mips/ptrace.h	Tue Oct 20 13:52:54 1998
+++ linux/include/asm-mips/ptrace.h	Fri Jun 25 17:37:53 1999
@@ -15,13 +15,14 @@
X #include <linux/types.h>
X 
X /* 0 - 31 are integer registers, 32 - 63 are fp registers.  */
+#define FPR_BASE	32
X #define PC		64
X #define CAUSE		65
-#define MMLO		66
+#define BADVADDR	66
X #define MMHI		67
-#define FPC_CSR		68	/* XXX */
-#define FPC_EIR		69	/* XXX */
-#define FPR_BASE	70	/* XXX */
+#define MMLO		68
+#define FPC_CSR		69
+#define FPC_EIR		70
X 
X #ifndef __ASSEMBLY__
X /*
diff -u --recursive --new-file v2.3.8/linux/include/asm-mips/resource.h linux/include/asm-mips/resource.h
--- v2.3.8/linux/include/asm-mips/resource.h	Thu Jun 26 12:33:40 1997
+++ linux/include/asm-mips/resource.h	Fri Jun 25 17:37:53 1999
@@ -1,11 +1,10 @@
-/*
- * Process resource limits
+/* $Id: resource.h,v 1.2 1999/01/04 16:09:25 ralf Exp $
X  *
X  * This file is subject to the terms and conditions of the GNU General Public
X  * License.  See the file "COPYING" in the main directory of this archive
X  * for more details.
X  *
- * Copyright (C) 1995, 1996 by Ralf Baechle
+ * Copyright (C) 1995, 1996, 1998 by Ralf Baechle
X  */
X #ifndef __ASM_MIPS_RESOURCE_H
X #define __ASM_MIPS_RESOURCE_H
@@ -30,15 +29,15 @@
X 
X #define INIT_RLIMITS					\
X {							\
-	{LONG_MAX, LONG_MAX},				\
-	{LONG_MAX, LONG_MAX},				\
-	{LONG_MAX, LONG_MAX},				\
-	{_STK_LIM, _STK_LIM},				\
-	{       0, LONG_MAX},				\
-	{NR_OPEN, NR_OPEN},				\
-	{LONG_MAX, LONG_MAX},				\
-	{LONG_MAX, LONG_MAX},				\
-	{MAX_TASKS_PER_USER, MAX_TASKS_PER_USER},	\
+	{ LONG_MAX, LONG_MAX },				\
+	{ LONG_MAX, LONG_MAX },				\
+	{ LONG_MAX, LONG_MAX },				\
+	{ _STK_LIM, LONG_MAX },				\
+	{        0, LONG_MAX },				\
+	{ NR_OPEN, NR_OPEN },				\
+	{ LONG_MAX, LONG_MAX },				\
+	{ LONG_MAX, LONG_MAX },				\
+	{ MAX_TASKS_PER_USER, MAX_TASKS_PER_USER },	\
SHAR_EOF
true || echo 'restore of patch-2.3.9 failed'
fi
echo 'End of  part 24'
echo 'File patch-2.3.9 is continued in part 25'
echo 25 > _shar_seq_.tmp
exit 0
#!/bin/sh
# this is part 26 of a 26 - part archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file patch-2.3.9 continued
if test ! -r _shar_seq_.tmp; then
        echo 'Please unpack part 1 first!'
        exit 1
fi
(read Scheck
if test "$Scheck" != 26; then
        echo Please unpack part "$Scheck" next!
        exit 1
 else
        exit 0
 fi
) < _shar_seq_.tmp || exit 1
if test ! -f _shar_wnt_.tmp; then
echo 'x - still skipping patch-2.3.9'
else
echo 'x - continuing with patch-2.3.9'
sed 's/^X//' << 'SHAR_EOF' >> 'patch-2.3.9' &&
-	struct buffer_head * b_this_page;	/* circular list of buffers in one page */
X 	unsigned long b_state;		/* buffer state bitmap (see above) */
-	struct buffer_head * b_next_free;
-	unsigned int b_count;		/* users using this block */
-
-	/* Non-performance-critical data follows. */
-	char * b_data;			/* pointer to data block (1024 bytes) */
-	unsigned int b_list;		/* List that this buffer appears */
-	unsigned long b_flushtime;	/* Time when this (dirty) buffer
-					 * should be written */
-	wait_queue_head_t b_wait;
-	struct buffer_head ** b_pprev;		/* doubly linked list of hash-queue */
-	struct buffer_head * b_prev_free;	/* doubly linked list of buffers */
-	struct buffer_head * b_reqnext;		/* request queue */
+	unsigned long b_flushtime;	/* Time when (dirty) buffer should be written */
X 
-	/*
-	 * I/O completion
-	 */
-	void (*b_end_io)(struct buffer_head *bh, int uptodate);
+	struct buffer_head *b_next_free;/* lru/free list linkage */
+	struct buffer_head *b_prev_free;/* doubly linked list of buffers */
+	struct buffer_head *b_this_page;/* circular list of buffers in one page */
+	struct buffer_head *b_reqnext;	/* request queue */
+
+	struct buffer_head **b_pprev;	/* doubly linked list of hash-queue */
+	char *b_data;			/* pointer to data block (1024 bytes) */
+	void (*b_end_io)(struct buffer_head *bh, int uptodate); /* I/O completion */
X 	void *b_dev_id;
+
+	unsigned long b_rsector;	/* Real buffer location on disk */
+	wait_queue_head_t b_wait;
X };
X 
X typedef void (bh_end_io_t)(struct buffer_head *bh, int uptodate);
-void init_buffer(struct buffer_head *, kdev_t, int, bh_end_io_t *, void *);
+void init_buffer(struct buffer_head *, bh_end_io_t *, void *);
X 
X #define __buffer_state(bh, state)	(((bh)->b_state & (1UL << BH_##state)) != 0)
X 
@@ -240,6 +239,8 @@
X #define buffer_dirty(bh)	__buffer_state(bh,Dirty)
X #define buffer_locked(bh)	__buffer_state(bh,Lock)
X #define buffer_req(bh)		__buffer_state(bh,Req)
+#define buffer_mapped(bh)	__buffer_state(bh,Mapped)
+#define buffer_new(bh)		__buffer_state(bh,New)
X #define buffer_protected(bh)	__buffer_state(bh,Protected)
X 
X #define buffer_page(bh)		(mem_map + MAP_NR((bh)->b_data))
@@ -402,9 +403,10 @@
X 	struct file		*f_next, **f_pprev;
X 	struct dentry		*f_dentry;
X 	struct file_operations	*f_op;
+	atomic_t		f_count;
+	unsigned int 		f_flags;
X 	mode_t			f_mode;
X 	loff_t			f_pos;
-	unsigned int 		f_count, f_flags;
X 	unsigned long 		f_reada, f_ramax, f_raend, f_ralen, f_rawin;
X 	struct fown_struct	f_owner;
X 	unsigned int		f_uid, f_gid;
@@ -598,13 +600,19 @@
X 	struct dentry * (*follow_link) (struct dentry *, struct dentry *, unsigned int);
X 	/*
X 	 * the order of these functions within the VFS template has been
-	 * changed because SMP locking has changed: from now on all bmap,
+	 * changed because SMP locking has changed: from now on all get_block,
X 	 * readpage, writepage and flushpage functions are supposed to do
X 	 * whatever locking they need to get proper SMP operation - for
X 	 * now in most cases this means a lock/unlock_kernel at entry/exit.
X 	 * [The new order is also slightly more logical :)]
X 	 */
-	int (*bmap) (struct inode *,int);
+	/*
+	 * Generic block allocator exported by the lowlevel fs. All metadata
+	 * details are handled by the lowlevel fs, all 'logical data content'
+	 * details are handled by the highlevel block layer.
+	 */
+	int (*get_block) (struct inode *, long, struct buffer_head *, int);
+
X 	int (*readpage) (struct file *, struct page *);
X 	int (*writepage) (struct file *, struct page *);
X 	int (*flushpage) (struct inode *, struct page *, unsigned long);
@@ -741,23 +749,38 @@
X extern int try_to_free_buffers(struct page *);
X extern void refile_buffer(struct buffer_head * buf);
X 
-extern int buffermem;
+extern atomic_t buffermem;
X 
X #define BUF_CLEAN	0
X #define BUF_LOCKED	1	/* Buffers scheduled for write */
X #define BUF_DIRTY	2	/* Dirty buffers, not yet scheduled for write */
X #define NR_LIST		3
X 
-void mark_buffer_uptodate(struct buffer_head *, int);
+/*
+ * This is called by bh->b_end_io() handlers when I/O has completed.
+ */
+extern inline void mark_buffer_uptodate(struct buffer_head * bh, int on)
+{
+	if (on)
+		set_bit(BH_Uptodate, &bh->b_state);
+	else
+		clear_bit(BH_Uptodate, &bh->b_state);
+}
+
+#define atomic_set_buffer_clean(bh) test_and_clear_bit(BH_Dirty, &(bh)->b_state)
+
+extern inline void __mark_buffer_clean(struct buffer_head *bh)
+{
+	refile_buffer(bh);
+}
X 
X extern inline void mark_buffer_clean(struct buffer_head * bh)
X {
-	if (test_and_clear_bit(BH_Dirty, &bh->b_state))
-		refile_buffer(bh);
+	if (atomic_set_buffer_clean(bh))
+		__mark_buffer_clean(bh);
X }
X 
X extern void FASTCALL(__mark_buffer_dirty(struct buffer_head *bh, int flag));
-extern void FASTCALL(__atomic_mark_buffer_dirty(struct buffer_head *bh, int flag));
X 
X #define atomic_set_buffer_dirty(bh) test_and_set_bit(BH_Dirty, &(bh)->b_state)
X 
@@ -767,20 +790,6 @@
X 		__mark_buffer_dirty(bh, flag);
X }
X 
-/*
- * SMP-safe version of the above - does synchronization with
- * other users of buffer-cache data structures.
- *
- * since we test-set the dirty bit in a CPU-atomic way we also
- * have optimized the common 'redirtying' case away completely.
- */
-extern inline void atomic_mark_buffer_dirty(struct buffer_head * bh, int flag)
-{
-	if (!atomic_set_buffer_dirty(bh))
-		__atomic_mark_buffer_dirty(bh, flag);
-}
-
-
X extern void balance_dirty(kdev_t);
X extern int check_disk_change(kdev_t);
X extern int invalidate_inodes(struct super_block *);
@@ -847,7 +856,6 @@
X extern struct file * get_empty_filp(void);
X extern struct buffer_head * get_hash_table(kdev_t, int, int);
X extern struct buffer_head * getblk(kdev_t, int, int);
-extern struct buffer_head * find_buffer(kdev_t, int, int);
X extern void ll_rw_block(int, int, struct buffer_head * bh[]);
X extern int is_read_only(kdev_t);
X extern void __brelse(struct buffer_head *);
@@ -869,13 +877,12 @@
X 
X extern int brw_page(int, struct page *, kdev_t, int [], int, int);
X 
-typedef long (*writepage_t)(struct file *, struct page *, unsigned long, unsigned long, const char *);
-typedef int (*fs_getblock_t)(struct inode *, long, int, int *, int *);
+typedef int (*writepage_t)(struct file *, struct page *, unsigned long, unsigned long, const char *);
X 
X /* Generic buffer handling for block filesystems.. */
X extern int block_read_full_page(struct file *, struct page *);
-extern int block_write_full_page (struct file *, struct page *, fs_getblock_t);
-extern int block_write_partial_page (struct file *, struct page *, unsigned long, unsigned long, const char *, fs_getblock_t);
+extern int block_write_full_page (struct file *, struct page *);
+extern int block_write_partial_page (struct file *, struct page *, unsigned long, unsigned long, const char *);
X extern int block_flushpage(struct inode *, struct page *, unsigned long);
X 
X extern int generic_file_mmap(struct file *, struct vm_area_struct *);
@@ -889,7 +896,6 @@
X unsigned long generate_cluster_swab32(kdev_t, int b[], int);
X extern kdev_t ROOT_DEV;
X 
-extern void show_buffers(void);
X extern void mount_root(void);
X 
X #ifdef CONFIG_BLK_DEV_INITRD
diff -u --recursive --new-file v2.3.8/linux/include/linux/ide.h linux/include/linux/ide.h
--- v2.3.8/linux/include/linux/ide.h	Tue Jun 22 14:41:45 1999
+++ linux/include/linux/ide.h	Wed Jun 30 12:42:48 1999
@@ -463,6 +463,8 @@
X #ifdef CONFIG_PROC_FS
X void proc_ide_create(void);
X void proc_ide_destroy(void);
+void destroy_proc_ide_drives(ide_hwif_t *);
+void create_proc_ide_interfaces(void);
X void ide_add_proc_entries(struct proc_dir_entry *dir, ide_proc_entry_t *p, void *data);
X void ide_remove_proc_entries(struct proc_dir_entry *dir, ide_proc_entry_t *p);
X read_proc_t proc_ide_read_capacity;
@@ -757,6 +759,7 @@
X 
X #ifndef _IDE_C
X extern struct file_operations ide_fops[];
+extern ide_proc_entry_t generic_subdriver_entries[];
X #endif
X 
X #ifdef _IDE_C
diff -u --recursive --new-file v2.3.8/linux/include/linux/iso_fs.h linux/include/linux/iso_fs.h
--- v2.3.8/linux/include/linux/iso_fs.h	Fri Apr 23 21:20:38 1999
+++ linux/include/linux/iso_fs.h	Sun Jun 27 10:10:41 1999
@@ -184,26 +184,10 @@
X int get_joliet_filename(struct iso_directory_record *, struct inode *, unsigned char *);
X int get_acorn_filename(struct iso_directory_record *, char *, struct inode *);
X 
-/* The stuff that follows may be totally unneeded. I have not checked to see 
- which prototypes we are still using.  */
-
-extern int isofs_open(struct inode * inode, struct file * filp);
-extern void isofs_release(struct inode * inode, struct file * filp);
-extern struct dentry *isofs_lookup(struct inode * dir, struct dentry *);
-extern unsigned long isofs_count_free_inodes(struct super_block *sb);
-extern int isofs_new_block(int dev);
-extern int isofs_free_block(int dev, int block);
-extern int isofs_bmap(struct inode *,int);
-
-extern void isofs_put_super(struct super_block *);
-extern struct super_block *isofs_read_super(struct super_block *,void *,int);
+extern struct dentry *isofs_lookup(struct inode *, struct dentry *);
+extern int isofs_get_block(struct inode *, long, struct buffer_head *, int);
+extern int isofs_bmap(struct inode *, int);
X extern int init_iso9660_fs(void);
-extern void isofs_read_inode(struct inode *);
-extern void isofs_put_inode(struct inode *);
-extern int isofs_statfs(struct super_block *, struct statfs *, int);
-
-extern int isofs_lseek(struct inode *, struct file *, off_t, int);
-extern int isofs_read(struct inode *, struct file *, char *, int);
X extern int isofs_lookup_grandparent(struct inode *, int);
X 
X extern struct inode_operations isofs_file_inode_operations;
diff -u --recursive --new-file v2.3.8/linux/include/linux/major.h linux/include/linux/major.h
--- v2.3.8/linux/include/linux/major.h	Mon May 31 22:08:10 1999
+++ linux/include/linux/major.h	Fri Jun 25 17:37:52 1999
@@ -63,6 +63,8 @@
X #define ACSI_MAJOR	28
X #define AZTECH_CDROM_MAJOR 29
X #define GRAPHDEV_MAJOR	29	/* SparcLinux & Linux/68k /dev/fb */
+#define SHMIQ_MAJOR	85	/* Linux/mips, SGI /dev/shmiq */
+#define USEMA_MAJOR	86	/* Linux/MIPS, SGI /dev/usema */
X #define CM206_CDROM_MAJOR 32
X #define IDE2_MAJOR	33
X #define IDE3_MAJOR	34
diff -u --recursive --new-file v2.3.8/linux/include/linux/minix_fs.h linux/include/linux/minix_fs.h
--- v2.3.8/linux/include/linux/minix_fs.h	Wed Jun 16 19:26:27 1999
+++ linux/include/linux/minix_fs.h	Sun Jun 27 10:10:41 1999
@@ -110,7 +110,7 @@
X extern int minix_bmap(struct inode *,int);
X 
X extern struct buffer_head * minix_getblk(struct inode *, int, int);
-extern int minix_getblk_block (struct inode *, long, int, int *, int *);
+extern int minix_get_block(struct inode *, long, struct buffer_head *, int);
X extern struct buffer_head * minix_bread(struct inode *, int, int);
X 
X extern void minix_truncate(struct inode *);
diff -u --recursive --new-file v2.3.8/linux/include/linux/miscdevice.h linux/include/linux/miscdevice.h
--- v2.3.8/linux/include/linux/miscdevice.h	Sun Mar  7 15:25:23 1999
+++ linux/include/linux/miscdevice.h	Fri Jun 25 17:37:52 1999
@@ -19,6 +19,14 @@
X #define I2O_MINOR 166
X #define MISC_DYNAMIC_MINOR 255
X 
+#define SGI_GRAPHICS_MINOR   146
+#define SGI_OPENGL_MINOR     147
+#define SGI_GFX_MINOR        148
+#define SGI_STREAMS_MOUSE    149
+#define SGI_STREAMS_KEYBOARD 150
+/* drivers/sgi/char/usema.c */
+#define SGI_USEMACLONE	     151
+
X extern int misc_init(void);
X 
X struct miscdevice 
diff -u --recursive --new-file v2.3.8/linux/include/linux/mm.h linux/include/linux/mm.h
--- v2.3.8/linux/include/linux/mm.h	Tue Jun 22 14:41:47 1999
+++ linux/include/linux/mm.h	Wed Jun 30 12:42:45 1999
@@ -148,7 +148,7 @@
X #define PG_uptodate		 3
X #define PG_free_after		 4
X #define PG_decr_after		 5
-#define PG_swap_unlock_after	 6
+#define PG_free_swap_after	 6
X #define PG_DMA			 7
X #define PG_Slab			 8
X #define PG_swap_cache		 9
@@ -182,7 +182,7 @@
X #define PageReferenced(page)	(test_bit(PG_referenced, &(page)->flags))
X #define PageFreeAfter(page)	(test_bit(PG_free_after, &(page)->flags))
X #define PageDecrAfter(page)	(test_bit(PG_decr_after, &(page)->flags))
-#define PageSwapUnlockAfter(page) (test_bit(PG_swap_unlock_after, &(page)->flags))
+#define PageSwapUnlockAfter(page) (test_bit(PG_free_swap_after, &(page)->flags))
X #define PageDMA(page)		(test_bit(PG_DMA, &(page)->flags))
X #define PageSlab(page)		(test_bit(PG_Slab, &(page)->flags))
X #define PageSwapCache(page)	(test_bit(PG_swap_cache, &(page)->flags))
@@ -409,7 +409,7 @@
X 
X extern struct vm_area_struct *find_extend_vma(struct task_struct *tsk, unsigned long addr);
X 
-#define buffer_under_min()	((buffermem >> PAGE_SHIFT) * 100 < \
+#define buffer_under_min()	((atomic_read(&buffermem) >> PAGE_SHIFT) * 100 < \
X 				buffer_mem.min_percent * num_physpages)
X #define pgcache_under_min()	(atomic_read(&page_cache_size) * 100 < \
X 				page_cache.min_percent * num_physpages)
diff -u --recursive --new-file v2.3.8/linux/include/linux/pagemap.h linux/include/linux/pagemap.h
--- v2.3.8/linux/include/linux/pagemap.h	Tue Jun 22 14:41:52 1999
+++ linux/include/linux/pagemap.h	Wed Jun 30 12:42:46 1999
@@ -39,11 +39,14 @@
X  */
X #define page_cache_entry(x)	(mem_map + MAP_NR(x))
X 
-#define PAGE_HASH_BITS 16
+extern unsigned int page_hash_bits;
+#define PAGE_HASH_BITS (page_hash_bits)
X #define PAGE_HASH_SIZE (1 << PAGE_HASH_BITS)
X 
X extern atomic_t page_cache_size; /* # of pages currently in the hash table */
-extern struct page * page_hash_table[PAGE_HASH_SIZE];
+extern struct page **page_hash_table;
+
+extern void page_cache_init(unsigned long);
X 
X /*
X  * We use a power-of-two hash table to avoid a modulus,
diff -u --recursive --new-file v2.3.8/linux/include/linux/pci.h linux/include/linux/pci.h
--- v2.3.8/linux/include/linux/pci.h	Tue Jun 22 14:41:40 1999
+++ linux/include/linux/pci.h	Wed Jun 30 12:42:44 1999
@@ -865,6 +865,9 @@
X #define PCI_VENDOR_ID_OMEGA		0x119b
X #define PCI_DEVICE_ID_OMEGA_82C092G	0x1221
X 
+#define PCI_VENDOR_ID_GALILEO		0x11ab
+#define PCI_DEVICE_ID_GALILEO_GT64011	0x4146
+
X #define PCI_VENDOR_ID_LITEON		0x11ad
X #define PCI_DEVICE_ID_LITEON_LNE100TX	0x0002
X 
@@ -1024,6 +1027,9 @@
X 
X #define PCI_VENDOR_ID_DCI       0x6666
X #define PCI_DEVICE_ID_DCI_PCCOM4    0x0001
+
+#define PCI_VENDOR_ID_GENROCO		0x5555
+#define PCI_DEVICE_ID_GENROCO_HFP832	0x0003
X 
X #define PCI_VENDOR_ID_INTEL		0x8086
X #define PCI_DEVICE_ID_INTEL_82375	0x0482
diff -u --recursive --new-file v2.3.8/linux/include/linux/personality.h linux/include/linux/personality.h
--- v2.3.8/linux/include/linux/personality.h	Tue Dec  1 13:33:00 1998
+++ linux/include/linux/personality.h	Fri Jun 25 17:37:52 1999
@@ -24,6 +24,9 @@
X #define PER_BSD			(0x0006)
X #define PER_XENIX		(0x0007 | STICKY_TIMEOUTS)
X #define PER_LINUX32		(0x0008)
+#define PER_IRIX32              (0x0009 | STICKY_TIMEOUTS) /* IRIX5 32-bit     */
+#define PER_IRIXN32             (0x000a | STICKY_TIMEOUTS) /* IRIX6 new 32-bit */
+#define PER_IRIX64              (0x000b | STICKY_TIMEOUTS) /* IRIX6 64-bit     */
X 
X /* Prototype for an lcall7 syscall handler. */
X typedef void (*lcall7_func)(struct pt_regs *);
diff -u --recursive --new-file v2.3.8/linux/include/linux/proc_fs.h linux/include/linux/proc_fs.h
--- v2.3.8/linux/include/linux/proc_fs.h	Tue Jun 22 14:41:59 1999
+++ linux/include/linux/proc_fs.h	Wed Jun 30 12:43:17 1999
@@ -202,6 +202,7 @@
X 	PROC_SCSI_ATARI,
X 	PROC_SCSI_MAC,
X 	PROC_SCSI_IDESCSI,
+	PROC_SCSI_SGIWD93,
X 	PROC_SCSI_MESH,
X 	PROC_SCSI_53C94,
X 	PROC_SCSI_PLUTO,
diff -u --recursive --new-file v2.3.8/linux/include/linux/sched.h linux/include/linux/sched.h
--- v2.3.8/linux/include/linux/sched.h	Tue Jun 22 14:41:47 1999
+++ linux/include/linux/sched.h	Wed Jun 30 12:42:45 1999
@@ -130,6 +130,7 @@
X  */
X struct files_struct {
X 	atomic_t count;
+	rwlock_t file_lock;
X 	int max_fds;
X 	struct file ** fd;	/* current fd array */
X 	fd_set close_on_exec;
@@ -138,6 +139,7 @@
X 
X #define INIT_FILES { \
X 	ATOMIC_INIT(1), \
+	RW_LOCK_UNLOCKED, \
X 	NR_OPEN, \
X 	&init_fd_array[0], \
X 	{ { 0, } }, \
diff -u --recursive --new-file v2.3.8/linux/include/linux/string.h linux/include/linux/string.h
--- v2.3.8/linux/include/linux/string.h	Fri Apr 23 09:36:09 1999
+++ linux/include/linux/string.h	Fri Jun 25 14:35:42 1999
@@ -20,6 +20,7 @@
X extern char * strrchr(const char *,int);
X extern char * strpbrk(const char *,const char *);
X extern char * strtok(char *,const char *);
+extern char * strsep(char **,const char *);
X extern char * strstr(const char *,const char *);
X extern __kernel_size_t strlen(const char *);
X extern __kernel_size_t strnlen(const char *,__kernel_size_t);
diff -u --recursive --new-file v2.3.8/linux/include/linux/swap.h linux/include/linux/swap.h
--- v2.3.8/linux/include/linux/swap.h	Tue Jun 22 14:41:41 1999
+++ linux/include/linux/swap.h	Wed Jun 30 12:42:44 1999
@@ -67,7 +67,7 @@
X extern atomic_t nr_async_pages;
X extern struct inode swapper_inode;
X extern atomic_t page_cache_size;
-extern int buffermem;
+extern atomic_t buffermem;
X 
X /* Incomplete types for prototype declarations: */
X struct task_struct;
diff -u --recursive --new-file v2.3.8/linux/include/linux/sysctl.h linux/include/linux/sysctl.h
--- v2.3.8/linux/include/linux/sysctl.h	Thu Jun  3 16:21:47 1999
+++ linux/include/linux/sysctl.h	Fri Jun 25 01:05:12 1999
@@ -82,8 +82,6 @@
X 	KERN_PANIC=15,		/* int: panic timeout */
X 	KERN_REALROOTDEV=16,	/* real root device to mount after initrd */
X 
-	KERN_JAVA_INTERPRETER=19, /* path to Java(tm) interpreter */
-	KERN_JAVA_APPLETVIEWER=20, /* path to Java(tm) appletviewer */
X 	KERN_SPARC_REBOOT=21,	/* reboot command on Sparc */
X 	KERN_CTLALTDEL=22,	/* int: allow ctl-alt-del to reboot */
X 	KERN_PRINTK=23,		/* struct: control printk logging parameters */
diff -u --recursive --new-file v2.3.8/linux/include/linux/sysv_fs.h linux/include/linux/sysv_fs.h
--- v2.3.8/linux/include/linux/sysv_fs.h	Tue Jun 22 14:43:20 1999
+++ linux/include/linux/sysv_fs.h	Wed Jun 30 12:44:24 1999
@@ -384,25 +384,15 @@
X extern void sysv_free_block(struct super_block * sb, unsigned int block);
X extern unsigned long sysv_count_free_blocks(struct super_block *sb);
X 
-extern int sysv_bmap(struct inode *,int);
-
X extern struct buffer_head * sysv_getblk(struct inode *, unsigned int, int);
-extern int sysv_getblk_block(struct inode *, long, int, int *, int *);
+extern int sysv_get_block(struct inode *, long, struct buffer_head *, int);
X extern struct buffer_head * sysv_file_bread(struct inode *, int, int);
-extern ssize_t sysv_file_read(struct file *, char *, size_t, loff_t *);
X 
X extern void sysv_truncate(struct inode *);
-extern void sysv_put_super(struct super_block *);
-extern struct super_block *sysv_read_super(struct super_block *,void *,int);
X extern int init_sysv_fs(void);
-extern void sysv_write_super(struct super_block *);
-extern void sysv_read_inode(struct inode *);
-extern int sysv_notify_change(struct dentry *, struct iattr *);
X extern void sysv_write_inode(struct inode *);
-extern int sysv_statfs(struct super_block *, struct statfs *, int);
X extern int sysv_sync_inode(struct inode *);
X extern int sysv_sync_file(struct file *, struct dentry *);
-extern int sysv_mmap(struct file *, struct vm_area_struct *);
X 
X extern struct inode_operations sysv_file_inode_operations;
X extern struct inode_operations sysv_file_inode_operations_with_bmap;
diff -u --recursive --new-file v2.3.8/linux/include/linux/timer.h linux/include/linux/timer.h
--- v2.3.8/linux/include/linux/timer.h	Thu Nov 19 11:08:45 1998
+++ linux/include/linux/timer.h	Mon Jun 28 13:41:34 1999
@@ -71,7 +71,7 @@
X 	timer->prev = NULL;
X }
X 
-extern inline int timer_pending(struct timer_list * timer)
+extern inline int timer_pending(const struct timer_list * timer)
X {
X 	return timer->prev != NULL;
X }
diff -u --recursive --new-file v2.3.8/linux/include/linux/ufs_fs.h linux/include/linux/ufs_fs.h
--- v2.3.8/linux/include/linux/ufs_fs.h	Wed Jun 16 19:26:27 1999
+++ linux/include/linux/ufs_fs.h	Tue Jun 29 09:12:32 1999
@@ -111,13 +111,14 @@
X #define UFS_MOUNT_ONERROR_UMOUNT	0x00000004
X #define UFS_MOUNT_ONERROR_REPAIR	0x00000008
X 
-#define UFS_MOUNT_UFSTYPE		0x000003F0
+#define UFS_MOUNT_UFSTYPE		0x000007F0
X #define UFS_MOUNT_UFSTYPE_OLD		0x00000010
X #define UFS_MOUNT_UFSTYPE_44BSD		0x00000020
X #define UFS_MOUNT_UFSTYPE_SUN		0x00000040
X #define UFS_MOUNT_UFSTYPE_NEXTSTEP	0x00000080
-#define UFS_MOUNT_UFSTYPE_OPENSTEP	0x00000100
-#define UFS_MOUNT_UFSTYPE_SUNx86	0x00000200
+#define UFS_MOUNT_UFSTYPE_NEXTSTEP_CD	0x00000100
+#define UFS_MOUNT_UFSTYPE_OPENSTEP	0x00000200
+#define UFS_MOUNT_UFSTYPE_SUNx86	0x00000400
X 
X #define ufs_clear_opt(o,opt)	o &= ~UFS_MOUNT_##opt
X #define ufs_set_opt(o,opt)	o |= UFS_MOUNT_##opt
@@ -529,7 +530,7 @@
X extern struct inode * ufs_new_inode (const struct inode *, int, int *);
X 
X /* inode.c */
-extern int ufs_bmap (struct inode *, int);
+extern int ufs_frag_map (struct inode *, int);
X extern void ufs_read_inode (struct inode *);
X extern void ufs_put_inode (struct inode *);
X extern void ufs_write_inode (struct inode *);
@@ -537,7 +538,7 @@
X extern void ufs_write_inode (struct inode *);
X extern void ufs_delete_inode (struct inode *);
X extern struct buffer_head * ufs_getfrag (struct inode *, unsigned, int, int *);
-extern int ufs_getfrag_block (struct inode *, long, int, int *, int *);
+extern int ufs_getfrag_block (struct inode *, long, struct buffer_head *, int);
X extern struct buffer_head * ufs_bread (struct inode *, unsigned, int, int *);
X 
X /* namei.c */
diff -u --recursive --new-file v2.3.8/linux/include/net/dn_fib.h linux/include/net/dn_fib.h
--- v2.3.8/linux/include/net/dn_fib.h	Wed May 26 09:36:35 1999
+++ linux/include/net/dn_fib.h	Wed Jun 30 11:24:55 1999
@@ -1,6 +1,8 @@
X #ifndef _NET_DN_FIB_H
X #define _NET_DN_FIB_H
X 
+#include <linux/config.h>
+
X #ifdef CONFIG_DECNET_ROUTER
X 
X 
diff -u --recursive --new-file v2.3.8/linux/include/net/dn_raw.h linux/include/net/dn_raw.h
--- v2.3.8/linux/include/net/dn_raw.h	Wed May 26 09:36:35 1999
+++ linux/include/net/dn_raw.h	Wed Jun 30 11:24:55 1999
@@ -1,6 +1,8 @@
X #ifndef _NET_DN_RAW_H
X #define _NET_DN_RAW_H
X 
+#include <linux/config.h>
+
X #ifdef CONFIG_DECNET_RAW
X 
X extern struct proto_ops dn_raw_proto_ops;
diff -u --recursive --new-file v2.3.8/linux/init/main.c linux/init/main.c
--- v2.3.8/linux/init/main.c	Tue Jun 22 10:45:40 1999
+++ linux/init/main.c	Wed Jun 30 10:25:46 1999
@@ -1186,6 +1186,7 @@
X 	dcache_init();
X 	vma_init();
X 	buffer_init(memory_end-memory_start);
+	page_cache_init(memory_end-memory_start);
X 	signals_init();
X 	inode_init();
X 	file_table_init();
diff -u --recursive --new-file v2.3.8/linux/ipc/msg.c linux/ipc/msg.c
--- v2.3.8/linux/ipc/msg.c	Mon Jun  7 12:20:50 1999
+++ linux/ipc/msg.c	Wed Jun 30 11:24:55 1999
@@ -11,6 +11,7 @@
X  * /proc/sysvipc/msg support (c) 1999 Dragos Acostachioaie <dra...@iname.com>
X  */
X 
+#include <linux/config.h>
X #include <linux/malloc.h>
X #include <linux/msg.h>
X #include <linux/interrupt.h>
diff -u --recursive --new-file v2.3.8/linux/ipc/sem.c linux/ipc/sem.c
--- v2.3.8/linux/ipc/sem.c	Mon Jun  7 12:20:50 1999
+++ linux/ipc/sem.c	Wed Jun 30 11:24:55 1999
@@ -52,6 +52,7 @@
X  * /proc/sysvipc/sem support (c) 1999 Dragos Acostachioaie <dra...@iname.com>
X  */
X 
+#include <linux/config.h>
X #include <linux/malloc.h>
X #include <linux/smp_lock.h>
X #include <linux/init.h>
diff -u --recursive --new-file v2.3.8/linux/ipc/shm.c linux/ipc/shm.c
--- v2.3.8/linux/ipc/shm.c	Wed Jun 16 19:26:27 1999
+++ linux/ipc/shm.c	Wed Jun 30 11:24:55 1999
@@ -8,6 +8,7 @@
X  * /proc/sysvipc/shm support (c) 1999 Dragos Acostachioaie <dra...@iname.com>
X  */
X 
+#include <linux/config.h>
X #include <linux/malloc.h>
X #include <linux/shm.h>
X #include <linux/swap.h>
diff -u --recursive --new-file v2.3.8/linux/kernel/acct.c linux/kernel/acct.c
--- v2.3.8/linux/kernel/acct.c	Fri Jun 18 08:01:50 1999
+++ linux/kernel/acct.c	Tue Jun 29 09:22:08 1999
@@ -276,7 +276,7 @@
X 	 */
X 	if (!file)
X 		return 0;
-	file->f_count++;
+	atomic_inc(&file->f_count);
X 	if (!check_free_space(file)) {
X 		fput(file);
X 		return 0;
diff -u --recursive --new-file v2.3.8/linux/kernel/fork.c linux/kernel/fork.c
--- v2.3.8/linux/kernel/fork.c	Tue Jun 22 13:56:06 1999
+++ linux/kernel/fork.c	Mon Jun 28 14:19:46 1999
@@ -249,7 +249,7 @@
X 		tmp->vm_next = NULL;
X 		file = tmp->vm_file;
X 		if (file) {
-			file->f_count++;
+			atomic_inc(&file->f_count);
X 			if (tmp->vm_flags & VM_DENYWRITE)
X 				file->f_dentry->d_inode->i_writecount--;
X       
@@ -474,6 +474,7 @@
X 	if (!new_fds)
X 		goto out_release;
X 
+	newf->file_lock = RW_LOCK_UNLOCKED;
X 	atomic_set(&newf->count, 1);
X 	newf->max_fds = NR_OPEN;
X 	newf->fd = new_fds;
@@ -485,7 +486,7 @@
X 		struct file *f = *old_fds++;
X 		*new_fds = f;
X 		if (f)
-			f->f_count++;
+			atomic_inc(&f->f_count);
X 		new_fds++;
X 	}
X 	/* This is long word aligned thus could use a optimized version */ 
@@ -556,13 +557,14 @@
X 	if (p->user) {
X 		if (atomic_read(&p->user->count) >= p->rlim[RLIMIT_NPROC].rlim_cur)
X 			goto bad_fork_free;
+		atomic_inc(&p->user->count);
X 	}
X 
X 	{
X 		struct task_struct **tslot;
X 		tslot = find_empty_process();
X 		if (!tslot)
-			goto bad_fork_free;
+			goto bad_fork_cleanup_count;
X 		p->tarray_ptr = tslot;
X 		*tslot = p;
X 		nr = tslot - &task[0];
@@ -666,8 +668,6 @@
X 		write_unlock_irq(&tasklist_lock);
X 
X 		nr_tasks++;
-		if (p->user)
-			atomic_inc(&p->user->count);
X 
X 		p->next_run = NULL;
X 		p->prev_run = NULL;
@@ -695,6 +695,9 @@
X 		__MOD_DEC_USE_COUNT(p->binfmt->module);
X 
X 	add_free_taskslot(p->tarray_ptr);
+bad_fork_cleanup_count:
+	if (p->user)
+		free_uid(p);
X bad_fork_free:
X 	free_task_struct(p);
X 	goto bad_fork;
diff -u --recursive --new-file v2.3.8/linux/kernel/ksyms.c linux/kernel/ksyms.c
--- v2.3.8/linux/kernel/ksyms.c	Tue Jun 22 14:08:14 1999
+++ linux/kernel/ksyms.c	Wed Jun 30 10:25:46 1999
@@ -135,6 +135,7 @@
X EXPORT_SYMBOL(d_alloc);
X EXPORT_SYMBOL(d_lookup);
X EXPORT_SYMBOL(d_path);
+EXPORT_SYMBOL(__mark_buffer_dirty);
X EXPORT_SYMBOL(__mark_inode_dirty);
X EXPORT_SYMBOL(get_empty_filp);
X EXPORT_SYMBOL(init_private_file);
@@ -162,11 +163,16 @@
X EXPORT_SYMBOL(__bforget);
X EXPORT_SYMBOL(ll_rw_block);
X EXPORT_SYMBOL(__wait_on_buffer);
-EXPORT_SYMBOL(mark_buffer_uptodate);
X EXPORT_SYMBOL(add_blkdev_randomness);
+EXPORT_SYMBOL(block_read_full_page);
+EXPORT_SYMBOL(block_write_full_page);
+EXPORT_SYMBOL(block_write_partial_page);
+EXPORT_SYMBOL(block_flushpage);
X EXPORT_SYMBOL(generic_file_read);
X EXPORT_SYMBOL(generic_file_write);
X EXPORT_SYMBOL(generic_file_mmap);
+EXPORT_SYMBOL(page_hash_bits);
+EXPORT_SYMBOL(page_hash_table);
X EXPORT_SYMBOL(file_lock_table);
X EXPORT_SYMBOL(posix_lock_file);
X EXPORT_SYMBOL(posix_test_lock);
@@ -221,8 +227,8 @@
X EXPORT_SYMBOL(unplug_device);
X EXPORT_SYMBOL(make_request);
X EXPORT_SYMBOL(tq_disk);
-EXPORT_SYMBOL(find_buffer);
X EXPORT_SYMBOL(init_buffer);
+EXPORT_SYMBOL(refile_buffer);
X EXPORT_SYMBOL(max_sectors);
X EXPORT_SYMBOL(max_readahead);
X 
diff -u --recursive --new-file v2.3.8/linux/kernel/sysctl.c linux/kernel/sysctl.c
--- v2.3.8/linux/kernel/sysctl.c	Sat Jun 19 11:45:29 1999
+++ linux/kernel/sysctl.c	Sat Jun 26 12:04:40 1999
@@ -34,7 +34,6 @@
X extern int panic_timeout;
X extern int console_loglevel, C_A_D;
X extern int bdf_prm[], bdflush_min[], bdflush_max[];
-extern char binfmt_java_interpreter[], binfmt_java_appletviewer[];
X extern int sysctl_overcommit_memory;
X extern int nr_queued_signals, max_queued_signals;
X 
@@ -121,7 +120,7 @@
X 	NULL,		/* rename */
X 	NULL,		/* readlink */
X 	NULL,		/* follow_link */
-	NULL,		/* bmap */
+	NULL,		/* get_block */
X 	NULL,		/* readpage */
X 	NULL,		/* writepage */
X 	NULL,		/* flushpage */
@@ -170,12 +169,6 @@
X #ifdef CONFIG_BLK_DEV_INITRD
X 	{KERN_REALROOTDEV, "real-root-dev", &real_root_dev, sizeof(int),
X 	 0644, NULL, &proc_dointvec},
-#endif
-#ifdef CONFIG_BINFMT_JAVA
-	{KERN_JAVA_INTERPRETER, "java-interpreter", binfmt_java_interpreter,
-	 64, 0644, NULL, &proc_dostring, &sysctl_string },
-	{KERN_JAVA_APPLETVIEWER, "java-appletviewer", binfmt_java_appletviewer,
-	 64, 0644, NULL, &proc_dostring, &sysctl_string },
X #endif
X #ifdef __sparc__
X 	{KERN_SPARC_REBOOT, "reboot-cmd", reboot_command,
diff -u --recursive --new-file v2.3.8/linux/lib/string.c linux/lib/string.c
--- v2.3.8/linux/lib/string.c	Sun Sep  6 11:19:15 1998
+++ linux/lib/string.c	Fri Jun 25 14:35:42 1999
@@ -9,6 +9,10 @@
X  * as inline code in <asm-xx/string.h>
X  *
X  * These are buggy as well..
+ *
+ * * Fri Jun 25 1999, Ingo Oeser <i...@informatik.tu-chemnitz.de>
+ * -  Added strsep() which will replace strtok() soon (because strsep() is
+ *    reentrant and should be faster). Use only strsep() in new code, please.
X  */
X  
X #include <linux/types.h>
@@ -228,6 +232,25 @@
X 	if (send && *send != '\0')
X 		*send++ = '\0';
X 	___strtok = send;
+	return (sbegin);
+}
+#endif
+
+#ifndef __HAVE_ARCH_STRSEP
+
+char * strsep(char **s, const char * ct)
+{
+	char *sbegin=*s;
+	if (!sbegin) 
+		return NULL;
+	
+	sbegin += strspn(sbegin,ct);
+	if (*sbegin == '\0') 
+		return NULL;
+	
+	*s = strpbrk( sbegin, ct);
+	if (*s && **s != '\0')
+		**s++ = '\0';
X 	return (sbegin);
X }
X #endif
diff -u --recursive --new-file v2.3.8/linux/mm/filemap.c linux/mm/filemap.c
--- v2.3.8/linux/mm/filemap.c	Tue Jun 22 14:25:22 1999
+++ linux/mm/filemap.c	Wed Jun 30 10:25:46 1999
@@ -20,6 +20,7 @@
X #include <linux/file.h>
X #include <linux/swapctl.h>
X #include <linux/slab.h>
+#include <linux/init.h>
X 
X #include <asm/pgtable.h>
X #include <asm/uaccess.h>
@@ -35,7 +36,8 @@
X  */
X 
X atomic_t page_cache_size = ATOMIC_INIT(0);
-struct page * page_hash_table[PAGE_HASH_SIZE];
+unsigned int page_hash_bits;
+struct page **page_hash_table;
X 
X spinlock_t pagecache_lock = SPIN_LOCK_UNLOCKED;
X 
@@ -273,8 +275,8 @@
X 			continue;
X 		}
X 		if (!page_count(page)) {
-//			BUG();
X 			spin_unlock(&pagecache_lock);
+			BUG();
X 			continue;
X 		}
X 		get_page(page);
@@ -292,13 +294,18 @@
X 
X 		/* Is it a buffer page? */
X 		if (page->buffers) {
+			int mem = page->inode ? 0 : PAGE_CACHE_SIZE;
X 			spin_unlock(&pagecache_lock);
-			if (try_to_free_buffers(page))
-				goto made_progress;
+			if (!try_to_free_buffers(page))
+				goto unlock_continue;
+			atomic_sub(mem, &buffermem);
X 			spin_lock(&pagecache_lock);
X 		}
X 
-		/* We can't free pages unless there's just one user */
+		/*
+		 * We can't free pages unless there's just one user
+		 * (count == 2 because we added one ourselves above).
+		 */
X 		if (page_count(page) != 2)
X 			goto spin_unlock_continue;
X 
@@ -354,6 +361,7 @@
X 		if (page->offset == offset)
X 			break;
X 	}
+	set_bit(PG_referenced, &page->flags);
X not_found:
X 	return page;
X }
@@ -1138,7 +1146,6 @@
X {
X 	ssize_t retval;
X 
-	unlock_kernel();
X 	retval = -EFAULT;
X 	if (access_ok(VERIFY_WRITE, buf, count)) {
X 		retval = 0;
@@ -1156,7 +1163,6 @@
X 				retval = desc.error;
X 		}
X 	}
-	lock_kernel();
X 	return retval;
X }
X 
@@ -1481,7 +1487,7 @@
X 	 * If a task terminates while we're swapping the page, the vma and
X 	 * and file could be released ... increment the count to be safe.
X 	 */
-	file->f_count++;
+	atomic_inc(&file->f_count);
X 	result = do_write_page(inode, file, (const char *) page, offset);
X 	fput(file);
X 	return result;
@@ -1829,8 +1835,6 @@
X 		count = limit - pos;
X 	}
X 
-	unlock_kernel();
-
X 	while (count) {
X 		unsigned long bytes, pgpos, offset;
X 		/*
@@ -1892,7 +1896,6 @@
X 		page_cache_free(page_cache);
X 
X 	err = written ? written : status;
-	lock_kernel();
X out:
X 	return err;
X }
@@ -1913,4 +1916,31 @@
X 		panic("put_cached_page: page count=%d\n", 
X 			page_count(page));
X 	page_cache_release(page);
+}
+
+void __init page_cache_init(unsigned long memory_size)
+{
+	unsigned long htable_size, order;
+
+	htable_size = memory_size >> PAGE_SHIFT;
+	htable_size *= sizeof(struct page *);
+	for(order = 0; (PAGE_SIZE << order) < htable_size; order++)
+		;
+
+	do {
+		unsigned long tmp = (PAGE_SIZE << order) / sizeof(struct page *);
+
+		page_hash_bits = 0;
+		while((tmp >>= 1UL) != 0UL)
+			page_hash_bits++;
+
+		page_hash_table = (struct page **)
+			__get_free_pages(GFP_ATOMIC, order);
+	} while(page_hash_table == NULL && --order > 0);
+
+	printk("Page-cache hash table entries: %d (order: %ld, %ld bytes)\n",
+	       (1 << page_hash_bits), order, (PAGE_SIZE << order));
+	if (!page_hash_table)
+		panic("Failed to allocate page hash table\n");
+	memset(page_hash_table, 0, PAGE_HASH_SIZE * sizeof(struct page *));
X }
diff -u --recursive --new-file v2.3.8/linux/mm/memory.c linux/mm/memory.c
--- v2.3.8/linux/mm/memory.c	Wed Jun 16 19:26:27 1999
+++ linux/mm/memory.c	Fri Jun 25 17:36:12 1999
@@ -52,7 +52,7 @@
X  */
X static inline void copy_cow_page(unsigned long from, unsigned long to)
X {
-	if (from == ZERO_PAGE) {
+	if (from == ZERO_PAGE(to)) {
X 		clear_page(to);
X 		return;
X 	}
@@ -405,7 +405,8 @@
X 	}
X }
X 
-static inline void zeromap_pte_range(pte_t * pte, unsigned long address, unsigned long size, pte_t zero_pte)
+static inline void zeromap_pte_range(pte_t * pte, unsigned long address,
+                                     unsigned long size, pgprot_t prot)
X {
X 	unsigned long end;
X 
@@ -414,6 +415,8 @@
X 	if (end > PMD_SIZE)
X 		end = PMD_SIZE;
X 	do {
+		pte_t zero_pte = pte_wrprotect(mk_pte(ZERO_PAGE(address),
+		                               prot));
X 		pte_t oldpage = *pte;
X 		set_pte(pte, zero_pte);
X 		forget_pte(oldpage);
@@ -422,7 +425,8 @@
X 	} while (address < end);
X }
X 
-static inline int zeromap_pmd_range(pmd_t * pmd, unsigned long address, unsigned long size, pte_t zero_pte)
+static inline int zeromap_pmd_range(pmd_t * pmd, unsigned long address,
+                                    unsigned long size, pgprot_t prot)
X {
X 	unsigned long end;
X 
@@ -434,7 +438,7 @@
X 		pte_t * pte = pte_alloc(pmd, address);
X 		if (!pte)
X 			return -ENOMEM;
-		zeromap_pte_range(pte, address, end - address, zero_pte);
+		zeromap_pte_range(pte, address, end - address, prot);
X 		address = (address + PMD_SIZE) & PMD_MASK;
X 		pmd++;
X 	} while (address < end);
@@ -447,9 +451,7 @@
X 	pgd_t * dir;
X 	unsigned long beg = address;
X 	unsigned long end = address + size;
-	pte_t zero_pte;
X 
-	zero_pte = pte_wrprotect(mk_pte(ZERO_PAGE, prot));
X 	dir = pgd_offset(current->mm, address);
X 	flush_cache_range(current->mm, beg, end);
X 	while (address < end) {
@@ -457,7 +459,7 @@
X 		error = -ENOMEM;
X 		if (!pmd)
X 			break;
-		error = zeromap_pmd_range(pmd, address, end - address, zero_pte);
+		error = zeromap_pmd_range(pmd, address, end - address, prot);
X 		if (error)
X 			break;
X 		address = (address + PGDIR_SIZE) & PGDIR_MASK;
@@ -790,9 +792,9 @@
X /*
X  * This only needs the MM semaphore
X  */
-static int do_anonymous_page(struct task_struct * tsk, struct vm_area_struct * vma, pte_t *page_table, int write_access)
+static int do_anonymous_page(struct task_struct * tsk, struct vm_area_struct * vma, pte_t *page_table, int write_access, unsigned long addr)
X {
-	pte_t entry = pte_wrprotect(mk_pte(ZERO_PAGE, vma->vm_page_prot));
+	pte_t entry = pte_wrprotect(mk_pte(ZERO_PAGE(addr), vma->vm_page_prot));
X 	if (write_access) {
X 		unsigned long page = __get_free_page(GFP_USER);
X 		if (!page)
@@ -827,7 +829,8 @@
X 
X 	if (!vma->vm_ops || !vma->vm_ops->nopage) {
X 		unlock_kernel();
-		return do_anonymous_page(tsk, vma, page_table, write_access);
+		return do_anonymous_page(tsk, vma, page_table, write_access,
+		                         address);
X 	}
X 
X 	/*
diff -u --recursive --new-file v2.3.8/linux/mm/mlock.c linux/mm/mlock.c
--- v2.3.8/linux/mm/mlock.c	Sun May 16 21:45:23 1999
+++ linux/mm/mlock.c	Mon Jun 28 13:52:39 1999
@@ -31,7 +31,7 @@
X 	vma->vm_offset += vma->vm_start - n->vm_start;
X 	n->vm_flags = newflags;
X 	if (n->vm_file)
-		n->vm_file->f_count++;
+		atomic_inc(&n->vm_file->f_count);
X 	if (n->vm_ops && n->vm_ops->open)
X 		n->vm_ops->open(n);
X 	insert_vm_struct(current->mm, n);
@@ -52,7 +52,7 @@
X 	n->vm_offset += n->vm_start - vma->vm_start;
X 	n->vm_flags = newflags;
X 	if (n->vm_file)
-		n->vm_file->f_count++;
+		atomic_inc(&n->vm_file->f_count);
X 	if (n->vm_ops && n->vm_ops->open)
X 		n->vm_ops->open(n);
X 	insert_vm_struct(current->mm, n);
@@ -82,7 +82,7 @@
X 	right->vm_offset += right->vm_start - left->vm_start;
X 	vma->vm_flags = newflags;
X 	if (vma->vm_file)
-		vma->vm_file->f_count += 2;
+		atomic_add(2, &vma->vm_file->f_count);
X 
X 	if (vma->vm_ops && vma->vm_ops->open) {
X 		vma->vm_ops->open(left);
diff -u --recursive --new-file v2.3.8/linux/mm/mmap.c linux/mm/mmap.c
--- v2.3.8/linux/mm/mmap.c	Wed Jun 16 19:26:27 1999
+++ linux/mm/mmap.c	Tue Jun 29 09:22:08 1999
@@ -62,7 +62,7 @@
X 	if (sysctl_overcommit_memory)
X 	    return 1;
X 
-	free = buffermem >> PAGE_SHIFT;
+	free = atomic_read(&buffermem) >> PAGE_SHIFT;
X 	free += atomic_read(&page_cache_size);
X 	free += nr_free_pages;
X 	free += nr_swap_pages;
@@ -313,7 +313,7 @@
X 		if (error)
X 			goto unmap_and_free_vma;
X 		vma->vm_file = file;
-		file->f_count++;
+		atomic_inc(&file->f_count);
X 	}
X 
X 	/*
@@ -547,7 +547,7 @@
X 		mpnt->vm_file = area->vm_file;
X 		mpnt->vm_pte = area->vm_pte;
X 		if (mpnt->vm_file)
-			mpnt->vm_file->f_count++;
+			atomic_inc(&mpnt->vm_file->f_count);
X 		if (mpnt->vm_ops && mpnt->vm_ops->open)
X 			mpnt->vm_ops->open(mpnt);
X 		area->vm_end = addr;	/* Truncate area */
@@ -786,8 +786,11 @@
X 	 */
X 	flags = vma->vm_flags;
X 	addr = vma->vm_start;
+
+	lock_kernel();		/* kswapd, ugh */
X 	insert_vm_struct(mm, vma);
X 	merge_segments(mm, vma->vm_start, vma->vm_end);
+	unlock_kernel();
X 	
X 	mm->total_vm += len >> PAGE_SHIFT;
X 	if (flags & VM_LOCKED) {
diff -u --recursive --new-file v2.3.8/linux/mm/mprotect.c linux/mm/mprotect.c
--- v2.3.8/linux/mm/mprotect.c	Fri Nov 20 11:43:19 1998
+++ linux/mm/mprotect.c	Mon Jun 28 13:52:05 1999
@@ -103,7 +103,7 @@
X 	n->vm_flags = newflags;
X 	n->vm_page_prot = prot;
X 	if (n->vm_file)
-		n->vm_file->f_count++;
+		atomic_inc(&n->vm_file->f_count);
X 	if (n->vm_ops && n->vm_ops->open)
X 		n->vm_ops->open(n);
X 	insert_vm_struct(current->mm, n);
@@ -126,7 +126,7 @@
X 	n->vm_flags = newflags;
X 	n->vm_page_prot = prot;
X 	if (n->vm_file)
-		n->vm_file->f_count++;
+		atomic_inc(&n->vm_file->f_count);
X 	if (n->vm_ops && n->vm_ops->open)
X 		n->vm_ops->open(n);
X 	insert_vm_struct(current->mm, n);
@@ -158,7 +158,7 @@
X 	vma->vm_flags = newflags;
X 	vma->vm_page_prot = prot;
X 	if (vma->vm_file)
-		vma->vm_file->f_count += 2;
+		atomic_add(2,&vma->vm_file->f_count);
X 	if (vma->vm_ops && vma->vm_ops->open) {
X 		vma->vm_ops->open(left);
X 		vma->vm_ops->open(right);
diff -u --recursive --new-file v2.3.8/linux/mm/mremap.c linux/mm/mremap.c
--- v2.3.8/linux/mm/mremap.c	Thu Jun  3 23:15:29 1999
+++ linux/mm/mremap.c	Mon Jun 28 13:53:22 1999
@@ -136,7 +136,7 @@
X 			new_vma->vm_offset = vma->vm_offset + (addr - vma->vm_start);
X 			lock_kernel();
X 			if (new_vma->vm_file)
-				new_vma->vm_file->f_count++;
+				atomic_inc(&new_vma->vm_file->f_count);
X 			if (new_vma->vm_ops && new_vma->vm_ops->open)
X 				new_vma->vm_ops->open(new_vma);
X 			insert_vm_struct(current->mm, new_vma);
diff -u --recursive --new-file v2.3.8/linux/mm/page_io.c linux/mm/page_io.c
--- v2.3.8/linux/mm/page_io.c	Tue Jun 22 12:24:29 1999
+++ linux/mm/page_io.c	Sat Jun 26 12:04:40 1999
@@ -99,7 +99,7 @@
X 	} else if (p->swap_file) {
X 		struct inode *swapf = p->swap_file->d_inode;
X 		int i;
-		if (swapf->i_op->bmap == NULL
+		if (swapf->i_op->get_block == NULL
X 			&& swapf->i_op->smap != NULL){
X 			/*
X 				With MS-DOS, we use msdos_smap which returns
@@ -110,7 +110,7 @@
X 				It sounds like ll_rw_swap_file defined
X 				its operation size (sector size) based on
X 				PAGE_SIZE and the number of blocks to read.
-				So using bmap or smap should work even if
+				So using get_block or smap should work even if
X 				smap will require more blocks.
X 			*/
X 			int j;
@@ -147,8 +147,7 @@
X  		atomic_inc(&nr_async_pages);
X  	}
X  	if (dolock) {
- 		/* only lock/unlock swap cache pages! */
- 		set_bit(PG_swap_unlock_after, &page->flags);
+ 		set_bit(PG_free_swap_after, &page->flags);
X 		p->swap_map[offset]++;
X  	}
X  	set_bit(PG_free_after, &page->flags);
@@ -174,15 +173,6 @@
X 		(char *) page_address(page), 
X 		page_count(page));
X #endif
-}
-
-/*
- * This is run when asynchronous page I/O has completed.
- * It decrements the swap bitmap counter
- */
-void swap_after_unlock_page(unsigned long entry)
-{
-	swap_free(entry);
X }
X 
X /*
diff -u --recursive --new-file v2.3.8/linux/mm/swap_state.c linux/mm/swap_state.c
--- v2.3.8/linux/mm/swap_state.c	Tue Jun 22 14:24:34 1999
+++ linux/mm/swap_state.c	Sat Jun 26 12:04:40 1999
@@ -39,7 +39,7 @@
X 	NULL,				/* rename */
X 	NULL,				/* readlink */
X 	NULL,				/* follow_link */
-	NULL,				/* bmap */
+	NULL,				/* get_block */
X 	NULL,				/* readpage */
X 	NULL,				/* writepage */
X 	block_flushpage,		/* flushpage */
diff -u --recursive --new-file v2.3.8/linux/mm/swapfile.c linux/mm/swapfile.c
--- v2.3.8/linux/mm/swapfile.c	Tue Jun 22 12:17:05 1999
+++ linux/mm/swapfile.c	Wed Jun 30 11:24:55 1999
@@ -5,7 +5,6 @@
X  *  Swap reorganised 29.12.95, Stephen Tweedie
X  */
X 
-#include <linux/config.h>
X #include <linux/malloc.h>
X #include <linux/smp_lock.h>
X #include <linux/kernel_stat.h>
diff -u --recursive --new-file v2.3.8/linux/net/core/scm.c linux/net/core/scm.c
--- v2.3.8/linux/net/core/scm.c	Thu Apr 22 19:45:19 1999
+++ linux/net/core/scm.c	Mon Jun 28 13:55:22 1999
@@ -232,7 +232,7 @@
X 			break;
X 		}
X 		/* Bump the usage count and install the file. */
-		fp[i]->f_count++;
+		atomic_inc(&fp[i]->f_count);
X 		current->files->fd[new_fd] = fp[i];
X 	}
X 
@@ -274,7 +274,7 @@
X 		memcpy(new_fpl, fpl, sizeof(*fpl));
X 
X 		for (i=fpl->count-1; i>=0; i--)
-			fpl->fp[i]->f_count++;
+			atomic_inc(&fpl->fp[i]->f_count);
X 	}
X 	return new_fpl;
X }
diff -u --recursive --new-file v2.3.8/linux/net/decnet/dn_nsp_out.c linux/net/decnet/dn_nsp_out.c
--- v2.3.8/linux/net/decnet/dn_nsp_out.c	Wed May 26 09:36:36 1999
+++ linux/net/decnet/dn_nsp_out.c	Wed Jun 30 11:24:55 1999
@@ -34,7 +34,6 @@
X     GNU General Public License for more details.
X *******************************************************************************/
X 
-#include <linux/config.h>
X #include <linux/errno.h>
X #include <linux/types.h>
X #include <linux/socket.h>
diff -u --recursive --new-file v2.3.8/linux/net/decnet/dn_timer.c linux/net/decnet/dn_timer.c
--- v2.3.8/linux/net/decnet/dn_timer.c	Sat May 29 11:09:54 1999
+++ linux/net/decnet/dn_timer.c	Wed Jun 30 11:24:55 1999
@@ -13,7 +13,6 @@
X  *                               timer idea.
X  *       Steve Whitehouse      : Added checks for sk->sock_readers
X  */
-#include <linux/config.h>
X #include <linux/net.h>
X #include <linux/socket.h>
X #include <linux/skbuff.h>
diff -u --recursive --new-file v2.3.8/linux/net/ipv4/ip_masq.c linux/net/ipv4/ip_masq.c
--- v2.3.8/linux/net/ipv4/ip_masq.c	Tue Mar 16 21:52:05 1999
+++ linux/net/ipv4/ip_masq.c	Tue Jun 29 09:22:08 1999
@@ -4,7 +4,7 @@
X  *
X  * 	Copyright (c) 1994 Pauline Middelink
X  *
- *	$Id: ip_masq.c,v 1.34 1999/03/17 01:53:51 davem Exp $
+ *	$Id: ip_masq.c,v 1.35 1999/06/29 12:35:46 davem Exp $
X  *
X  *
X  *	See ip_fw.c for original log
@@ -315,9 +315,7 @@
X  *	Will cycle in MASQ_PORT boundaries.
X  */
X static __u16 masq_port = PORT_MASQ_BEGIN;
-#ifdef __SMP__
X static spinlock_t masq_port_lock = SPIN_LOCK_UNLOCKED;
-#endif
X 
X /*
X  *	free ports counters (UDP & TCP)
diff -u --recursive --new-file v2.3.8/linux/net/ipv4/ip_masq_mfw.c linux/net/ipv4/ip_masq_mfw.c
--- v2.3.8/linux/net/ipv4/ip_masq_mfw.c	Wed May 26 18:14:37 1999
+++ linux/net/ipv4/ip_masq_mfw.c	Tue Jun 29 09:22:08 1999
@@ -3,7 +3,7 @@
X  *
X  *	Does (reverse-masq) forwarding based on skb->fwmark value
X  *
- *	$Id: ip_masq_mfw.c,v 1.4 1999/05/13 23:25:07 davem Exp $
+ *	$Id: ip_masq_mfw.c,v 1.5 1999/06/29 12:35:49 davem Exp $
X  *
X  * Author:	Juan Jose Ciarlante   <jjci...@raiz.uncu.edu.ar>
X  *		  based on Steven Clarke's portfw
@@ -73,16 +73,12 @@
X 	__u32 fwmark;			/* key: firewall mark */
X 	struct list_head hosts;		/* list of forward-to hosts */
X 	atomic_t nhosts;		/* number of "" */
-#ifdef __SMP__
X 	rwlock_t lock;
-#endif
X };
X 
X 
X static DECLARE_MUTEX(mfw_sema);
-#ifdef __SMP__
X static rwlock_t mfw_lock = RW_LOCK_UNLOCKED;
-#endif
X 
X static struct ip_masq_mfw *ip_masq_mfw_table[IP_MASQ_MFW_HSIZE];
X 
@@ -143,9 +139,7 @@
X 	MOD_INC_USE_COUNT;
X 	memset(mfw, 0, sizeof(*mfw));
X 	mfw->fwmark = fwmark;
-#ifdef __SMP__
X 	mfw->lock = (rwlock_t) RW_LOCK_UNLOCKED;
-#endif
X 
X 	INIT_LIST_HEAD(&mfw->hosts);
X out:
diff -u --recursive --new-file v2.3.8/linux/net/ipv4/ip_masq_mod.c linux/net/ipv4/ip_masq_mod.c
--- v2.3.8/linux/net/ipv4/ip_masq_mod.c	Sun Oct  4 10:21:45 1998
+++ linux/net/ipv4/ip_masq_mod.c	Tue Jun 29 09:22:08 1999
@@ -4,7 +4,7 @@
X  *
X  * Author:	Juan Jose Ciarlante, <jjci...@raiz.uncu.edu.ar>
X  *
- * 	$Id: ip_masq_mod.c,v 1.5 1998/08/29 23:51:09 davem Exp $
+ * 	$Id: ip_masq_mod.c,v 1.6 1999/06/29 12:35:51 davem Exp $
X  *
X  *	This program is free software; you can redistribute it and/or
X  *	modify it under the terms of the GNU General Public License
@@ -33,9 +33,7 @@
X EXPORT_SYMBOL(ip_masq_mod_lkp_link);
X EXPORT_SYMBOL(ip_masq_mod_lkp_unlink);
X 
-#ifdef __SMP__
X static spinlock_t masq_mod_lock = SPIN_LOCK_UNLOCKED;
-#endif
X 
X /*
X  *	Base pointer for registered modules
diff -u --recursive --new-file v2.3.8/linux/net/ipv4/ip_masq_portfw.c linux/net/ipv4/ip_masq_portfw.c
--- v2.3.8/linux/net/ipv4/ip_masq_portfw.c	Mon Jan  4 15:31:35 1999
+++ linux/net/ipv4/ip_masq_portfw.c	Tue Jun 29 09:22:08 1999
@@ -2,7 +2,7 @@
X  *		IP_MASQ_PORTFW masquerading module
X  *
X  *
- *	$Id: ip_masq_portfw.c,v 1.3 1998/12/08 05:42:12 davem Exp $
+ *	$Id: ip_masq_portfw.c,v 1.4 1999/06/29 12:35:53 davem Exp $
X  *
X  * Author:	Steven Clarke <steven...@monmouth.demon.co.uk>
X  *
@@ -51,9 +51,7 @@
X /*
X  *	Lock
X  */
-#ifdef __SMP__
X static spinlock_t portfw_lock = SPIN_LOCK_UNLOCKED;
-#endif
X 
X static struct list_head portfw_list[2];
X static __inline__ int portfw_idx(int protocol)
diff -u --recursive --new-file v2.3.8/linux/net/ipv4/ipconfig.c linux/net/ipv4/ipconfig.c
--- v2.3.8/linux/net/ipv4/ipconfig.c	Wed Jun  9 14:45:37 1999
+++ linux/net/ipv4/ipconfig.c	Tue Jun 29 09:22:08 1999
@@ -1,5 +1,5 @@
X /*
- *  $Id: ipconfig.c,v 1.22 1999/06/09 10:10:57 davem Exp $
+ *  $Id: ipconfig.c,v 1.23 1999/06/28 11:35:07 davem Exp $
X  *
X  *  Automatic Configuration of IP -- use BOOTP or RARP or user-supplied
X  *  information to configure own IP address and routes.
@@ -666,7 +666,7 @@
X 	    b->vendor_area[2] == 83 &&
X 	    b->vendor_area[3] == 99) {
X 		u8 *ext = &b->vendor_area[4];
-		u8 *end = (u8 *) b + len;
+                u8 *end = (u8 *) b + ntohs(b->iph.tot_len);
X 		while (ext < end && *ext != 0xff) {
X 			if (*ext == 0)		/* Padding */
X 				ext++;
diff -u --recursive --new-file v2.3.8/linux/net/ipv4/tcp.c linux/net/ipv4/tcp.c
--- v2.3.8/linux/net/ipv4/tcp.c	Wed May 26 18:14:37 1999
+++ linux/net/ipv4/tcp.c	Tue Jun 29 09:22:08 1999
@@ -5,7 +5,7 @@
X  *
X  *		Implementation of the Transmission Control Protocol(TCP).
X  *
- * Version:	$Id: tcp.c,v 1.144 1999/05/27 01:03:37 davem Exp $
+ * Version:	$Id: tcp.c,v 1.145 1999/06/29 12:35:56 davem Exp $
X  *
X  * Authors:	Ross Biro, <bi...@leland.Stanford.Edu>
X  *		Fred N. van Kempen, <wal...@uWalt.NL.Mugnet.ORG>
@@ -749,7 +749,6 @@
X 	int mss_now;
X 	int err, copied;
X 
-	unlock_kernel();
X 	lock_sock(sk);
X 
X 	err = 0;
@@ -976,7 +975,6 @@
X out:
X 	tcp_push_pending_frames(sk, tp);
X 	release_sock(sk);
-	lock_kernel();
X 	return err;
X }
X 
@@ -1156,7 +1154,6 @@
X 	if (flags & MSG_WAITALL)
X 		target=len;
X 
-	unlock_kernel();
X 	add_wait_queue(sk->sleep, &wait);
X 	lock_sock(sk);
X 	
@@ -1355,7 +1352,6 @@
X 	/* Clean up data we have read: This will do ACK frames. */
X 	cleanup_rbuf(sk, copied);
X 	release_sock(sk);
-	lock_kernel();
X 	return copied;
X }
X 
diff -u --recursive --new-file v2.3.8/linux/net/ipv4/udp.c linux/net/ipv4/udp.c
--- v2.3.8/linux/net/ipv4/udp.c	Wed Jun 16 19:26:27 1999
+++ linux/net/ipv4/udp.c	Tue Jun 29 09:22:08 1999
@@ -5,7 +5,7 @@
X  *
X  *		The User Datagram Protocol (UDP).
X  *
- * Version:	$Id: udp.c,v 1.69 1999/06/09 11:15:31 davem Exp $
+ * Version:	$Id: udp.c,v 1.70 1999/06/13 05:55:16 davem Exp $
X  *
X  * Authors:	Ross Biro, <bi...@leland.Stanford.Edu>
X  *		Fred N. van Kempen, <wal...@uWalt.NL.Mugnet.ORG>
@@ -654,9 +654,9 @@
X 		struct sockaddr_in * usin = (struct sockaddr_in*)msg->msg_name;
X 		if (msg->msg_namelen < sizeof(*usin))
X 			return(-EINVAL);
-		if (usin->sin_family != AF_INET) {
+		if (usin->sin_family != AF_INET)
X 			return -EINVAL;
-		}
+
X 		ufh.daddr = usin->sin_addr.s_addr;
X 		ufh.uh.dest = usin->sin_port;
X 		if (ufh.uh.dest == 0)
diff -u --recursive --new-file v2.3.8/linux/net/socket.c linux/net/socket.c
--- v2.3.8/linux/net/socket.c	Tue Jun  8 10:47:58 1999
+++ linux/net/socket.c	Wed Jun 30 12:41:40 1999
@@ -950,7 +950,6 @@
X 	struct msghdr msg;
X 	struct iovec iov;
X 	
-	lock_kernel();
X 	sock = sockfd_lookup(fd, &err);
X 	if (!sock)
X 		goto out;
@@ -977,7 +976,6 @@
X out_put:		
X 	sockfd_put(sock);
X out:
-	unlock_kernel();
X 	return err;
X }
X 
@@ -1005,7 +1003,6 @@
X 	char address[MAX_SOCK_ADDR];
X 	int err,err2;
X 
-	lock_kernel();
X 	sock = sockfd_lookup(fd, &err);
X 	if (!sock)
X 		goto out;
@@ -1030,7 +1027,6 @@
X 	}
X 	sockfd_put(sock);			
X out:
-	unlock_kernel();
X 	return err;
X }
X 
@@ -1123,8 +1119,6 @@
X 	struct msghdr msg_sys;
X 	int err, ctl_len, iov_size, total_len;
X 	
-	lock_kernel();
-
X 	err = -EFAULT;
X 	if (copy_from_user(&msg_sys,msg,sizeof(struct msghdr)))
X 		goto out; 
@@ -1194,7 +1188,6 @@
X out_put:
X 	sockfd_put(sock);
X out:       
-	unlock_kernel();
X 	return err;
X }
X 
@@ -1218,7 +1211,6 @@
X 	struct sockaddr *uaddr;
X 	int *uaddr_len;
X 	
-	lock_kernel();
X 	err=-EFAULT;
X 	if (copy_from_user(&msg_sys,msg,sizeof(struct msghdr)))
X 		goto out;
@@ -1282,7 +1274,6 @@
X out_put:
X 	sockfd_put(sock);
X out:
-	unlock_kernel();
X 	return err;
X }
X 
diff -u --recursive --new-file v2.3.8/linux/net/sunrpc/xprt.c linux/net/sunrpc/xprt.c
--- v2.3.8/linux/net/sunrpc/xprt.c	Tue Jun  8 17:58:03 1999
+++ linux/net/sunrpc/xprt.c	Wed Jun 30 11:24:55 1999
@@ -42,7 +42,6 @@
X #define __KERNEL_SYSCALLS__
X 
X #include <linux/version.h>
-#include <linux/config.h>
X #include <linux/types.h>
X #include <linux/malloc.h>
X #include <linux/sched.h>
@@ -1456,7 +1455,7 @@
X 	proto = (sock->type == SOCK_DGRAM)? IPPROTO_UDP : IPPROTO_TCP;
X 	if ((xprt = xprt_setup(sock, proto, ap, to)) != NULL) {
X 		xprt->file = file;
-		file->f_count++;
+		atomic_inc(&file->f_count);
X 	}
X 
X 	return xprt;
diff -u --recursive --new-file v2.3.8/linux/net/unix/af_unix.c linux/net/unix/af_unix.c
--- v2.3.8/linux/net/unix/af_unix.c	Wed May 26 18:14:38 1999
+++ linux/net/unix/af_unix.c	Tue Jun 29 09:22:08 1999
@@ -8,7 +8,7 @@
X  *		as published by the Free Software Foundation; either version
X  *		2 of the License, or (at your option) any later version.
X  *
- * Version:	$Id: af_unix.c,v 1.78 1999/05/27 00:38:41 davem Exp $
+ * Version:	$Id: af_unix.c,v 1.79 1999/06/29 12:36:07 davem Exp $
X  *
X  * Fixes:
X  *		Linus Torvalds	:	Assorted bug cures.
@@ -103,6 +103,7 @@
X #include <net/scm.h>
X #include <linux/init.h>
X #include <linux/poll.h>
+#include <linux/smp_lock.h>
X 
X #include <asm/checksum.h>
X 
@@ -943,7 +944,7 @@
X  *	Send AF_UNIX data.
X  */
X 
-static int unix_dgram_sendmsg(struct socket *sock, struct msghdr *msg, int len,
+static int do_unix_dgram_sendmsg(struct socket *sock, struct msghdr *msg, int len,
X 			      struct scm_cookie *scm)
X {
X 	struct sock *sk = sock->sk;
@@ -1040,6 +1041,7 @@
X 	
X 	if (!unix_peer(sk))
X 		unix_unlock(other);
+
X 	return len;
X 
X out_unlock:
@@ -1050,8 +1052,18 @@
X 	return err;
X }
X 
+static int unix_dgram_sendmsg(struct socket *sock, struct msghdr *msg, int len,
+			      struct scm_cookie *scm)
+{
+	int retval;
+
+	lock_kernel();
+	retval = do_unix_dgram_sendmsg(sock, msg, len, scm);
+	unlock_kernel();
+	return retval;
+}
X 		
-static int unix_stream_sendmsg(struct socket *sock, struct msghdr *msg, int len,
+static int do_unix_stream_sendmsg(struct socket *sock, struct msghdr *msg, int len,
X 			       struct scm_cookie *scm)
X {
X 	struct sock *sk = sock->sk;
@@ -1120,9 +1132,9 @@
X 		
X 		if (skb==NULL)
X 		{
-			if (sent)
-				goto out;
-			return err;
+			if (!sent)
+				sent = err;
+			goto out;
X 		}
X 
X 		/*
@@ -1141,9 +1153,9 @@
X 
X 		if (memcpy_fromiovec(skb_put(skb,size), msg->msg_iov, size)) {
X 			kfree_skb(skb);
-			if (sent)
-				goto out;
-			return -EFAULT;
+			if (!sent)
+				sent = -EFAULT;
+			goto out;
X 		}
X 
X 		other=unix_peer(sk);
@@ -1155,7 +1167,8 @@
X 				goto out;
X 			if (!(msg->msg_flags&MSG_NOSIGNAL))
X 				send_sig(SIGPIPE,current,0);
-			return -EPIPE;
+			sent = -EPIPE;
+			goto out;
X 		}
X 
X 		skb_queue_tail(&other->receive_queue, skb);
@@ -1166,6 +1179,17 @@
X 	return sent;
X }
X 
+static int unix_stream_sendmsg(struct socket *sock, struct msghdr *msg, int len,
+			       struct scm_cookie *scm)
+{
+	int retval;
+
+	lock_kernel();
+	retval = do_unix_stream_sendmsg(sock, msg, len, scm);
+	unlock_kernel();
+	return retval;
+}
+
X /*
X  *	Sleep until data has arrive. But check for races..
X  */
@@ -1180,7 +1204,7 @@
X 	}
X }
X 
-static int unix_dgram_recvmsg(struct socket *sock, struct msghdr *msg, int size,
+static int do_unix_dgram_recvmsg(struct socket *sock, struct msghdr *msg, int size,
X 			      int flags, struct scm_cookie *scm)
X {
X 	struct sock *sk = sock->sk;
@@ -1257,8 +1281,18 @@
X 	return err;
X }
X 
+static int unix_dgram_recvmsg(struct socket *sock, struct msghdr *msg, int size,
+			      int flags, struct scm_cookie *scm)
+{
+	int retval;
X 
-static int unix_stream_recvmsg(struct socket *sock, struct msghdr *msg, int size,
+	lock_kernel();
+	retval = do_unix_dgram_recvmsg(sock, msg, size, flags, scm);
+	unlock_kernel();
+	return retval;
+}
+
+static int do_unix_stream_recvmsg(struct socket *sock, struct msghdr *msg, int size,
X 			       int flags, struct scm_cookie *scm)
X {
X 	struct sock *sk = sock->sk;
@@ -1275,8 +1309,7 @@
X 		return -EOPNOTSUPP;
X 	if (flags&MSG_WAITALL)
X 		target = size;
-		
-		
+
X 	msg->msg_namelen = 0;
X 
X 	/* Lock the socket to prevent queue disordering
@@ -1390,6 +1423,17 @@
X 
X 	up(&sk->protinfo.af_unix.readsem);
X 	return copied;
+}
+
+static int unix_stream_recvmsg(struct socket *sock, struct msghdr *msg, int size,
+			       int flags, struct scm_cookie *scm)
+{
+	int retval;
+
+	lock_kernel();
+	retval = do_unix_stream_recvmsg(sock, msg, size, flags, scm);
+	unlock_kernel();
+	return retval;
X }
X 
X static int unix_shutdown(struct socket *sock, int mode)
diff -u --recursive --new-file v2.3.8/linux/net/unix/garbage.c linux/net/unix/garbage.c
--- v2.3.8/linux/net/unix/garbage.c	Mon Mar 22 10:06:09 1999
+++ linux/net/unix/garbage.c	Mon Jun 28 13:56:42 1999
@@ -199,7 +199,7 @@
X 		 *	in flight we are in use.
X 		 */
X 		if(s->socket && s->socket->file &&
-		   s->socket->file->f_count > s->protinfo.af_unix.inflight)
+		   atomic_read(&s->socket->file->f_count) > s->protinfo.af_unix.inflight)
X 			maybe_unmark_and_push(s);
X 	}
X 
diff -u --recursive --new-file v2.3.8/linux/net/wanrouter/wanproc.c linux/net/wanrouter/wanproc.c
--- v2.3.8/linux/net/wanrouter/wanproc.c	Sun Nov 15 09:52:29 1998
+++ linux/net/wanrouter/wanproc.c	Sun Jun 27 10:10:41 1999
@@ -127,7 +127,7 @@
X 	NULL,			/* readlink */
X 	NULL,			/* readpage */
X 	NULL,			/* writepage */
-	NULL,			/* bmap */
+	NULL,			/* get_block */
X 	NULL,			/* truncate */
X 	router_proc_perms
X };
@@ -167,7 +167,7 @@
X 	NULL,			/* follow_link */
X 	NULL,			/* readpage */
X 	NULL,			/* writepage */
-	NULL,			/* bmap */
+	NULL,			/* get_block */
X 	NULL,			/* truncate */
X 	router_proc_perms
X };
SHAR_EOF
true || echo 'restore of patch-2.3.9 failed'
echo 'File patch-2.3.9 is complete' &&
chmod 644 patch-2.3.9 ||
echo 'restore of patch-2.3.9 failed'
Cksum="`cksum < 'patch-2.3.9'`"
if ! test "3941503955 1495992" = "$Cksum"
then
	echo 'patch-2.3.9: original Checksum 3941503955 1495992, current one' "$Cksum" 
	rm -f _shar_wnt_.tmp
	rm -f _shar_seq_.tmp
	exit 1
fi
rm -f _shar_wnt_.tmp
fi
rm -f _shar_seq_.tmp
echo 'You have unpacked the last part.'
exit 0
#!/bin/sh
# this is part 02 of a 26 - part archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file patch-2.3.9 continued
if test ! -r _shar_seq_.tmp; then
        echo 'Please unpack part 1 first!'
        exit 1
fi
(read Scheck
if test "$Scheck" != 02; then
        echo Please unpack part "$Scheck" next!
        exit 1
 else
        exit 0
 fi
) < _shar_seq_.tmp || exit 1
if test ! -f _shar_wnt_.tmp; then
echo 'x - still skipping patch-2.3.9'
else
echo 'x - continuing with patch-2.3.9'
sed 's/^X//' << 'SHAR_EOF' >> 'patch-2.3.9' &&
+	.set    noat
+	la	k0, except_vec3_generic_code
+	jr	k0
+END(except_vec3_generic)
+
+NESTED(except_vec3_generic_code, 0, sp)
+	SAVE_ALL 
+	mfc0	k1, CP0_CAUSE
+	la	k0, int_cause
+	sw      k1, (k0)
+
+        mfc0    k1, CP0_EPC
+        la      k0, epc
+        sw      k1, (k0)
+
+        mfc0    k1, CP0_BADVADDR
+        la      k0, badvaddr
+        sw      k1, (k0)
+
+	la	k0, int_handler 
+        .set    noreorder
+	jal	k0
+        .set    reorder
+	move	a0, sp
+
+        RESTORE_ALL_AND_RET
+END(except_vec3_generic_code)
+
+        .align  5
+NESTED(flush_cache_low, PT_SIZE, sp)
+        .set    at
+        .set    macro
+        .set    noreorder
+        
+        move    t1, a0  # ISIZE
+        move    t2, a1  # DSIZE
+
+        mfc0    t3, CP0_STATUS       # Save the status register.
+        mtc0    zero, CP0_STATUS     # Disable interrupts.
+        la      v0, 1f
+        or      v0, KSEG1            # Run uncached.
+        j       v0
+        nop
+/*
+ * Flush the instruction cache.
+ */
+1:
+        li      v0, ST0_DE | ST0_CE
+        mtc0    v0, CP0_STATUS       # Isolate and swap caches.
+        li      t0, KSEG1
+        subu    t0, t0, t1
+        li      t1, KSEG1
+        la      v0, 1f                          # Run cached
+        j       v0
+        nop
+1:
+        addu    t0, t0, 64
+        sb      zero, -64(t0)
+        sb      zero, -60(t0)
+        sb      zero, -56(t0)
+        sb      zero, -52(t0)
+        sb      zero, -48(t0)
+        sb      zero, -44(t0)
+        sb      zero, -40(t0)
+        sb      zero, -36(t0)
+        sb      zero, -32(t0)
+        sb      zero, -28(t0)
+        sb      zero, -24(t0)
+        sb      zero, -20(t0)
+        sb      zero, -16(t0)
+        sb      zero, -12(t0)
+        sb      zero, -8(t0)
+        bne     t0, t1, 1b
+        sb      zero, -4(t0)
+        
+        la      v0, 1f
+        or      v0, KSEG1
+        j       v0                              # Run uncached
+        nop
+/*
+ * Flush the data cache.
+ */
+1:
+        li      v0, ST0_DE
+        mtc0    v0, CP0_STATUS       # Isolate and swap back caches
+        li      t0, KSEG1
+        subu    t0, t0, t2
+        la      v0, 1f
+        j       v0                              # Back to cached mode
+        nop
+1:
+        addu    t0, t0, 64
+        sb      zero, -64(t0)
+        sb      zero, -60(t0)
+        sb      zero, -56(t0)
+        sb      zero, -52(t0)
+        sb      zero, -48(t0)
+        sb      zero, -44(t0)
+        sb      zero, -40(t0)
+        sb      zero, -36(t0)
+        sb      zero, -32(t0)
+        sb      zero, -28(t0)
+        sb      zero, -24(t0)
+        sb      zero, -20(t0)
+        sb      zero, -16(t0)
+        sb      zero, -12(t0)
+        sb      zero, -8(t0)
+        bne     t0, t1, 1b
+        sb      zero, -4(t0)
+
+        nop                                     # Insure isolated stores
+        nop                                     #   out of pipe.
+        nop
+        nop
+        mtc0    t3, CP0_STATUS                 # Restore status reg.
+        nop                                    # Insure cache unisolated.
+        nop
+        nop
+        nop
+        j       ra
+        nop
+END(flush_cache_low)
+
+/* To satisfy macros only */
+EXPORT(kernelsp)
+	PTR	0x80001000
diff -u --recursive --new-file v2.3.8/linux/arch/mips/baget/irq.c linux/arch/mips/baget/irq.c
--- v2.3.8/linux/arch/mips/baget/irq.c	Wed Dec 31 16:00:00 1969
+++ linux/arch/mips/baget/irq.c	Fri Jun 25 17:40:12 1999
@@ -0,0 +1,438 @@
+/*
+ * Code to handle Baget/MIPS IRQs plus some generic interrupt stuff.
+ *
+ * Copyright (C) 1998 Vladimir Roganov & Gleb Raiko
+ *      Code (mostly sleleton and comments) derived from DECstation IRQ
+ *      handling.
+ *
+ * $Id$
+ */
+#include <linux/errno.h>
+#include <linux/init.h>
+#include <linux/kernel_stat.h>
+#include <linux/signal.h>
+#include <linux/sched.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/ioport.h>
+#include <linux/timex.h>
+#include <linux/malloc.h>
+#include <linux/random.h>
+#include <linux/delay.h>
+
+#include <asm/bitops.h>
+#include <asm/bootinfo.h>
+#include <asm/io.h>
+#include <asm/irq.h>
+#include <asm/mipsregs.h>
+#include <asm/system.h>
+
+#include <asm/baget/baget.h>
+
+unsigned int local_bh_count[NR_CPUS];
+unsigned int local_irq_count[NR_CPUS];
+unsigned long spurious_count = 0;
+
+atomic_t __mips_bh_counter;
+
+/*
+ * This table is a correspondence between IRQ numbers and CPU PILs
+ */
+ 
+static int irq_to_pil_map[BAGET_IRQ_NR] = { 
+	7/*fixme: dma_err -1*/,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* 0x00 - 0x0f */
+	-1,-1,-1,-1, 3,-1,-1,-1, 2, 2, 2,-1, 3,-1,-1,3/*fixme: lance*/, /* 0x10 - 0x1f */
+        -1,-1,-1,-1,-1,-1, 5,-1,-1,-1,-1,-1, 7,-1,-1,-1, /* 0x20 - 0x2f */
+	-1, 3, 2/*fixme systimer:3*/, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3  /* 0x30 - 0x3f */
+};
+
+static inline int irq_to_pil(int irq_nr) 
+{
+	int pil = -1;
+
+	if (irq_nr >= BAGET_IRQ_NR) 
+		baget_printk("irq_to_pil: too large irq_nr = 0x%x\n", irq_nr);
+	else {
+		pil = irq_to_pil_map[irq_nr];
+		if (pil == -1)
+			baget_printk("irq_to_pil: unknown irq = 0x%x\n", irq_nr);
+	}
+
+	return pil;
+}
+
+/* Function for careful CP0 interrupt mask access */
+
+static inline void modify_cp0_intmask(unsigned clr_mask, unsigned set_mask)
+{
+	unsigned long status = read_32bit_cp0_register(CP0_STATUS);
+	status &= ~((clr_mask & 0xFF) << 8);
+	status |=   (set_mask & 0xFF) << 8;
+	write_32bit_cp0_register(CP0_STATUS, status);
+}
+
+/* 
+ *  These two functions may be used for unconditional IRQ
+ *  masking via their PIL protection.
+ */
+
+static inline void mask_irq(unsigned int irq_nr)
+{
+        modify_cp0_intmask(irq_to_pil(irq_nr), 0);
+}
+
+static inline void unmask_irq(unsigned int irq_nr)
+{
+	modify_cp0_intmask(0, irq_to_pil(irq_nr));
+}
+
+/*
+ * The following section is introduced for masking/unasking IRQ
+ * only while no more IRQs uses same CPU PIL.
+ *
+ * These functions are used in request_irq, free_irq, but it looks
+ * they cannot change something: CP0_STATUS is private for any
+ * process, and their action is invisible for system.
+ */
+
+static volatile unsigned int pil_in_use[BAGET_PIL_NR] = { 0, };
+
+void mask_irq_count(int irq_nr) 
+{
+	unsigned long flags;
+	int pil = irq_to_pil(irq_nr);
+	
+	save_and_cli(flags);
+	if (!--pil_in_use[pil])
+		mask_irq(irq_nr);
+	restore_flags(flags);
+}
+
+void unmask_irq_count(int irq_nr) 
+{
+	unsigned long flags;
+	int pil = irq_to_pil(irq_nr);
+	
+	save_and_cli(flags);
+	if (!pil_in_use[pil]++)
+		unmask_irq(irq_nr);
+	restore_flags(flags);
+}
+
+/*
+ * Two functions below are exported versions of mask/unmask IRQ
+ */
+
+void disable_irq(unsigned int irq_nr)
+{
+	unsigned long flags;
+
+	save_and_cli(flags);
+	mask_irq(irq_nr);
+	restore_flags(flags);
+}
+
+void enable_irq(unsigned int irq_nr)
+{
+	unsigned long flags;
+
+	save_and_cli(flags);
+	unmask_irq(irq_nr);
+	restore_flags(flags);
+}
+
+/*
+ * Data definition for static irqaction allocation.
+ * It is used while SLAB module is not initialized.
+ */
+
+#define MAX_STATIC_ALLOC 4 
+struct irqaction static_irqaction[MAX_STATIC_ALLOC];
+int static_irq_count = 0;
+ 
+/*
+ * Pointers to the low-level handlers: first the general ones, then the
+ * fast ones, then the bad ones.
+ */
+static struct irqaction *irq_action[BAGET_IRQ_NR] = { NULL, };
+
+int get_irq_list(char *buf)
+{
+	int i, len = 0;
+	struct irqaction * action;
+
+	for (i = 0 ; i < BAGET_IRQ_NR ; i++) {
+		action = irq_action[i];
+		if (!action) 
+			continue;
+		len += sprintf(buf+len, "%2d: %8d %c %s",
+			i, kstat.irqs[0][i],
+			(action->flags & SA_INTERRUPT) ? '+' : ' ',
+			action->name);
+		for (action=action->next; action; action = action->next) {
+			len += sprintf(buf+len, ",%s %s",
+				(action->flags & SA_INTERRUPT) ? " +" : "",
+				action->name);
+		}
+		len += sprintf(buf+len, "\n");
+	}
+	return len;
+}
+
+
+/*
+ * do_IRQ handles IRQ's that have been installed without the
+ * SA_INTERRUPT flag: it uses the full signal-handling return
+ * and runs with other interrupts enabled. All relatively slow
+ * IRQ's should use this format: notably the keyboard/timer
+ * routines.
+ */
+static void do_IRQ(int irq, struct pt_regs * regs)
+{
+	struct irqaction *action;
+	int do_random, cpu;
+
+	cpu = smp_processor_id();
+	hardirq_enter(cpu);
+	kstat.irqs[cpu][irq]++;
+
+	mask_irq(irq);  
+	action = *(irq + irq_action);
+	if (action) {
+		if (!(action->flags & SA_INTERRUPT))
+			__sti();
+		action = *(irq + irq_action);
+		do_random = 0;
+        	do {
+			do_random |= action->flags;
+			action->handler(irq, action->dev_id, regs);
+			action = action->next;
+        	} while (action);
+		if (do_random & SA_SAMPLE_RANDOM)
+			add_interrupt_randomness(irq);
+		__cli();
+	} else {
+		printk("do_IRQ: Unregistered IRQ (0x%X) occured\n", irq);
+	}
+	unmask_irq(irq);
+	hardirq_exit(cpu);
+
+	/* unmasking and bottom half handling is done magically for us. */
+}
+
+/*
+ *  What to do in case of 'no VIC register available' for current interrupt
+ */
+static void vic_reg_error(unsigned long address, unsigned char active_pils) 
+{
+	printk("\nNo VIC register found: reg=%08lx active_pils=%02x\n"
+	       "Current interrupt mask from CP0_CAUSE: %02x\n", 
+	       address, 0xff & active_pils, 
+	       0xff & (read_32bit_cp0_register(CP0_CAUSE)>>8));
+	{ int i; for (i=0; i<10000; i++) udelay(1000); }
+}	
+
+static char baget_fpu_irq = BAGET_FPU_IRQ;
+#define BAGET_INT_FPU {(unsigned long)&baget_fpu_irq, 1}
+
+/*
+ *  Main interrupt handler: interrupt demultiplexer
+ */
+asmlinkage void baget_interrupt(struct pt_regs *regs)
+{
+	static struct baget_int_reg int_reg[BAGET_PIL_NR] = { 
+		BAGET_INT_NONE, BAGET_INT_NONE, BAGET_INT0_ACK, BAGET_INT1_ACK,
+		BAGET_INT_NONE, BAGET_INT_FPU,  BAGET_INT_NONE, BAGET_INT5_ACK 
+	};
+	unsigned char active_pils;
+	while ((active_pils = read_32bit_cp0_register(CP0_CAUSE)>>8)) {
+		int pil;
+		struct baget_int_reg* reg;
+
+                for (pil = 0; pil < BAGET_PIL_NR; pil++) {
+                        if (!(active_pils & (1<<pil))) continue;
+ 			
+			reg = &int_reg[pil];
+
+			if (reg->address) {
+                                extern int try_read(unsigned long,int);
+				int irq  = try_read(reg->address, reg->size);
+
+				if (irq != -1) 
+				      do_IRQ(BAGET_IRQ_MASK(irq), regs);
+				else 
+				      vic_reg_error(reg->address, active_pils);
+			} else {
+				printk("baget_interrupt: unknown interrupt "
+				       "(pil = %d)\n", pil);
+			}
+		}
+	}
+}
+
+/*
+ * Idea is to put all interrupts
+ * in a single table and differenciate them just by number.
+ */
+int setup_baget_irq(int irq, struct irqaction * new)
+{
+	int shared = 0;
+	struct irqaction *old, **p;
+	unsigned long flags;
+
+	p = irq_action + irq;
+	if ((old = *p) != NULL) {
+		/* Can't share interrupts unless both agree to */
+		if (!(old->flags & new->flags & SA_SHIRQ))
+			return -EBUSY;
+
+		/* Can't share interrupts unless both are same type */
+		if ((old->flags ^ new->flags) & SA_INTERRUPT)
+			return -EBUSY;
+
+		/* add new interrupt at end of irq queue */
+		do {
+			p = &old->next;
+			old = *p;
+		} while (old);
+		shared = 1;
+	}
+
+	if (new->flags & SA_SAMPLE_RANDOM)
+		rand_initialize_irq(irq);
+
+	save_and_cli(flags);
+	*p = new;
+	restore_flags(flags);
+
+	if (!shared) {
+		unmask_irq_count(irq);
+	}
+
+	return 0;
+}
+
+int request_irq(unsigned int irq, 
+		void (*handler)(int, void *, struct pt_regs *),
+		unsigned long irqflags, 
+		const char * devname,
+		void *dev_id)
+{
+	int retval;
+	struct irqaction * action = NULL;
+
+	if (irq >= BAGET_IRQ_NR)
+		return -EINVAL;
+	if (!handler)
+		return -EINVAL;
+	if (irq_to_pil_map[irq] < 0) 
+		return -EINVAL;
+
+        if (irqflags & SA_STATIC_ALLOC) {
+		unsigned long flags;
+
+		save_and_cli(flags);
+		if (static_irq_count < MAX_STATIC_ALLOC)
+			action = &static_irqaction[static_irq_count++];
+		else 
+			printk("Request for IRQ%d (%s) SA_STATIC_ALLOC failed "
+			       "using kmalloc\n", irq, devname);
+		restore_flags(flags);
+	}
+  
+	if (action == NULL)
+		action = (struct irqaction *)
+			kmalloc(sizeof(struct irqaction), GFP_KERNEL);
+
+	if (!action) 
+		return -ENOMEM;
+
+	action->handler = handler;
+	action->flags = irqflags;
+	action->mask = 0;
+	action->name = devname;
+	action->next = NULL;
+	action->dev_id = dev_id;
+
+	retval = setup_baget_irq(irq, action);
+
+	if (retval)
+		kfree(action);
+
+	return retval;
+}
+		
+void free_irq(unsigned int irq, void *dev_id)
+{
+	struct irqaction * action, **p;
+	unsigned long flags;
+
+	if (irq >= BAGET_IRQ_NR) 
+		printk("Trying to free IRQ%d\n",irq);
+
+	for (p = irq + irq_action; (action = *p) != NULL; p = &action->next) {
+		if (action->dev_id != dev_id)
+			continue;
+
+		/* Found it - now free it */
+		save_and_cli(flags);
+		*p = action->next;
+		if (!irq[irq_action])
+			unmask_irq_count(irq);
+		restore_flags(flags);
+
+		if (action->flags & SA_STATIC_ALLOC)
+		{
+			/* This interrupt is marked as specially allocated
+			 * so it is a bad idea to free it.
+			 */
+			printk("Attempt to free statically allocated "
+			       "IRQ%d (%s)\n", irq, action->name);
+			return;
+		}
+ 
+		kfree(action);
+		return;
+	}
+	printk("Trying to free free IRQ%d\n",irq);
+}
+
+static int baget_irq_canonicalize(int irq) 
+{
+	return irq;
+}
+
+int (*irq_cannonicalize)(int irq) = baget_irq_canonicalize; 
+
+unsigned long probe_irq_on (void)
+{
+	/* TODO */
+	return 0;
+}
+
+int probe_irq_off (unsigned long irqs)
+{
+	/* TODO */
+	return 0;
+}
+
+
+static void write_err_interrupt(int irq, void *dev_id, struct pt_regs * regs)
+{
+	*(volatile char*) BAGET_WRERR_ACK = 0;
+}
+
+__initfunc(void init_IRQ(void))
+{
+	irq_setup();
+
+	/* Enable access to VIC interrupt registers */
+	vac_outw(0xacef | 0x8200, VAC_PIO_FUNC);
+
+	/* Enable interrupts for pils 2 and 3 (lines 0 and 1) */
+	modify_cp0_intmask(0, (1<<2)|(1<<3));
+
+	if (request_irq(0/*fixme*/, write_err_interrupt, 
+			SA_INTERRUPT|SA_STATIC_ALLOC, "write_err", NULL) < 0) 
+		printk("init_IRQ: unable to register write_err irq\n");
+}
diff -u --recursive --new-file v2.3.8/linux/arch/mips/baget/ld.script.balo linux/arch/mips/baget/ld.script.balo
--- v2.3.8/linux/arch/mips/baget/ld.script.balo	Wed Dec 31 16:00:00 1969
+++ linux/arch/mips/baget/ld.script.balo	Fri Jun 25 17:40:12 1999
@@ -0,0 +1,124 @@
+OUTPUT_FORMAT("elf32-bigmips")
+OUTPUT_ARCH(mips)
+ENTRY(balo_entry)
+SECTIONS
+{
+  /* Read-only sections, merged into text segment: */
+  . = 0x80400000;
+  .rel.text      : { *(.rel.text)	}
+  .rela.text     : { *(.rela.text) 	}
+  .rel.data      : { *(.rel.data)	}
+  .rela.data     : { *(.rela.data) 	}
+  .rel.rodata    : { *(.rel.rodata) 	}
+  .rela.rodata   : { *(.rela.rodata) 	}
+  .rel.got       : { *(.rel.got)	}
+  .rela.got      : { *(.rela.got)	}
+  .rel.ctors     : { *(.rel.ctors)	}
+  .rela.ctors    : { *(.rela.ctors)	}
+  .rel.dtors     : { *(.rel.dtors)	}
+  .rela.dtors    : { *(.rela.dtors)	}
+  .rel.init      : { *(.rel.init)	}
+  .rela.init     : { *(.rela.init)	}
+  .rel.fini      : { *(.rel.fini)	}
+  .rela.fini     : { *(.rela.fini)	}
+  .rel.bss       : { *(.rel.bss)	}
+  .rela.bss      : { *(.rela.bss)	}
+  .rel.plt       : { *(.rel.plt)	}
+  .rela.plt      : { *(.rela.plt)	}
+  .init          : { *(.init)		} =0
+  .text      :
+  {
+    _ftext = . ;
+    *(.text)
+    *(.rodata)
+    *(.rodata1)
+    /* .gnu.warning sections are handled specially by elf32.em.  */
+    *(.gnu.warning)
+
+  _etext = .;
+  PROVIDE (etext = .);
+
+  /* Startup code */
+  . = ALIGN(4096);
+  __init_begin = .;
+  *(.text.init) 
+  *(.data.init) 
+  . = ALIGN(4096);	/* Align double page for init_task_union */
+  __init_end = .;
+
+   *(.fini)    
+  *(.reginfo) 
+  /* Adjust the address for the data segment.  We want to adjust up to
+     the same address within the page on the next page up.  It would
+     be more correct to do this:
+       . = .;
+     The current expression does not correctly handle the case of a
+     text segment ending precisely at the end of a page; it causes the
+     data segment to skip a page.  The above expression does not have
+     this problem, but it will currently (2/95) cause BFD to allocate
+     a single segment, combining both text and data, for this case.
+     This will prevent the text segment from being shared among
+     multiple executions of the program; I think that is more
+     important than losing a page of the virtual address space (note
+     that no actual memory is lost; the page which is skipped can not
+     be referenced).  */
+  . = .;
+    _fdata = . ;
+    *(.data)
+    CONSTRUCTORS
+
+  *(.data1) 
+  _gp = . + 0x8000;
+  *(.lit8) 
+  *(.lit4) 
+  *(.ctors)   
+  *(.dtors)   
+  *(.got.plt) *(.got) 
+  *(.dynamic) 
+  /* We want the small data sections together, so single-instruction offsets
+     can access them all, and initialized data all before uninitialized, so
+     we can shorten the on-disk segment size.  */
+  *(.sdata) 
+  _edata  =  .;
+  PROVIDE (edata = .);
+
+  __bss_start = .;
+  _fbss = .;
+
+   *(.dynbss)
+   *(.bss)
+   *(COMMON)
+  _end = . ;
+  PROVIDE (end = .);
+   *(.sbss)
+   *(.scommon)
+
+  /* These are needed for ELF backends which have not yet been
+     converted to the new style linker.  */
+  *(.stab) 
+  *(.stabstr) 
+  /* DWARF debug sections.
+     Symbols in the .debug DWARF section are relative to the beginning of the
+     section so we begin .debug at 0.  It's not clear yet what needs to happen
+     for the others.   */
+  *(.debug) 
+  *(.debug_srcinfo) 
+  *(.debug_aranges) 
+  *(.debug_pubnames) 
+  *(.debug_sfnames) 
+  *(.line) 
+  /* These must appear regardless of  .  */
+  *(.gptab.data) *(.gptab.sdata) 
+  *(.gptab.bss) *(.gptab.sbss) 
+
+  _vmlinux_start = .;
+  *(.vmlinux)
+  _vmlinux_end = .;
+
+  _ramdisk_start = .;
+  *(.ramdisk)
+  _ramdisk_end = .;
+
+} =0
+
+}
diff -u --recursive --new-file v2.3.8/linux/arch/mips/baget/print.c linux/arch/mips/baget/print.c
--- v2.3.8/linux/arch/mips/baget/print.c	Wed Dec 31 16:00:00 1969
+++ linux/arch/mips/baget/print.c	Fri Jun 25 17:40:12 1999
@@ -0,0 +1,118 @@
+/* $Id$
+ *
+ * print.c: Simple print fascility
+ *
+ * Copyright (C) 1998 Gleb Raiko & Vladimir Roganov
+ *
+ */
+#include <stdarg.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+
+#include <asm/baget/baget.h>
+
+/*
+ *  Define this to see 'baget_printk' (debug) messages
+ */
+// #define BAGET_PRINTK
+
+/* 
+ *  This function is same for BALO and Linux baget_printk,
+ *  and normally prints characted to second (UART A) console.
+ */
+
+static void delay(void) {}
+
+static void outc_low(char c)
+{
+        int i;
+        vac_outb(c, VAC_UART_B_TX);
+        for (i=0; i<10000; i++) 
+                delay();
+}
+
+void outc(char c)
+{
+        if (c == '\n')
+                outc_low('\r');
+        outc_low(c);
+}
+
+void outs(char *s) 
+{
+        while(*s) outc(*s++);
+}
+
+void baget_write(char *s, int l)
+{
+        while(l--)
+                outc(*s++);
+}
+
+int baget_printk(const char *fmt, ...)
+{
+#ifdef BAGET_PRINTK
+        va_list args;
+        int i;
+        static char buf[1024];
+
+        va_start(args, fmt);
+        i = vsprintf(buf, fmt, args); /* hopefully i < sizeof(buf)-4 */
+        va_end(args);
+        baget_write(buf, i);
+        return i;
+#else
+	return 0;
+#endif
+}
+
+static __inline__ void puthex( int a )
+{
+        static char s[9];
+        static char e[] = "0123456789ABCDEF";
+        int i;
+        for( i = 7; i >= 0; i--, a >>= 4 ) s[i] = e[a & 0x0F];
+        s[8] = '\0';
+        outs( s );
+}
+
+__initfunc(void balo_printf( char *f, ... )) 
+{
+        int *arg = (int*)&f + 1;
+        char c; 
+        int format = 0;
+
+        while((c = *f++) != 0) {
+                switch(c) {
+                default:
+                        if(format) {
+                                outc('%');
+                                format = 0;
+                        }
+                        outc( c );
+                        break;
+                case '%':
+                        if( format ){
+                                format = 0;
+                                outc(c);
+                        } else format = 1;
+                        break;
+                case 'x':
+                        if(format) puthex( *arg++ );
+                        else outc(c);
+                        format = 0;
+                        break;
+                case 's':
+                        if( format ) outs((char *)*arg++);
+                        else outc(c);
+                        format = 0;
+                        break;
+                }
+        }
+}
+
+__initfunc(void balo_hungup(void))
+{ 
+        outs("Hunging up.\n");
+        while(1); 
+}
diff -u --recursive --new-file v2.3.8/linux/arch/mips/baget/prom/Makefile linux/arch/mips/baget/prom/Makefile
--- v2.3.8/linux/arch/mips/baget/prom/Makefile	Wed Dec 31 16:00:00 1969
+++ linux/arch/mips/baget/prom/Makefile	Fri Jun 25 17:40:12 1999
@@ -0,0 +1,15 @@
+# $Id$
+# Makefile for the Baget/MIPS prom emulator library routines.
+#
+# Note! Dependencies are done automagically by 'make dep', which also
+# removes any old dependencies. DON'T put your own dependencies here
+# unless it's something special (ie not a .c file).
+#
+# Note 2! The CFLAGS definitions are now in the main makefile...
+
+O_TARGET := bagetlib.a
+O_OBJS   := init.o
+
+all: 	$(O_TARGET)
+
+include $(TOPDIR)/Rules.make
diff -u --recursive --new-file v2.3.8/linux/arch/mips/baget/prom/init.c linux/arch/mips/baget/prom/init.c
--- v2.3.8/linux/arch/mips/baget/prom/init.c	Wed Dec 31 16:00:00 1969
+++ linux/arch/mips/baget/prom/init.c	Wed Jun 30 11:24:54 1999
@@ -0,0 +1,20 @@
+/*
+ * init.c: PROM library initialisation code.
+ *
+ * Copyright (C) 1998 Gleb Raiko & Vladimir Roganov 
+ *
+ * $Id$
+ */
+#include <linux/init.h>
+#include <asm/bootinfo.h>
+
+char arcs_cmdline[CL_SIZE];
+
+__initfunc(int prom_init(unsigned int mem_upper))
+{
+	mips_memory_upper = mem_upper;
+	mips_machgroup  = MACH_GROUP_UNKNOWN;
+	mips_machtype   = MACH_UNKNOWN;
+	arcs_cmdline[0] = 0;
+	return 0;
+}
diff -u --recursive --new-file v2.3.8/linux/arch/mips/baget/reset.c linux/arch/mips/baget/reset.c
--- v2.3.8/linux/arch/mips/baget/reset.c	Wed Dec 31 16:00:00 1969
+++ linux/arch/mips/baget/reset.c	Fri Jun 25 17:40:12 1999
@@ -0,0 +1,32 @@
+#include <linux/kernel.h>
+#include <asm/system.h>
+#include <asm/baget/baget.h>
+
+
+#define R3000_RESET_VEC  0xbfc00000
+typedef void vector(void);
+
+
+static void baget_reboot(char *from_fun)
+{
+	cli();
+	baget_printk("\n%s: jumping to RESET code...\n", from_fun);
+	(*(vector*)R3000_RESET_VEC)();
+}
+
+/* fixme: proper functionality */
+
+void baget_machine_restart(char *command)
+{
+	baget_reboot("restart");
+}
+
+void baget_machine_halt(void)
+{
+	baget_reboot("halt");
+}
+
+void baget_machine_power_off(void)
+{
+	baget_reboot("power off");
+}
diff -u --recursive --new-file v2.3.8/linux/arch/mips/baget/setup.c linux/arch/mips/baget/setup.c
--- v2.3.8/linux/arch/mips/baget/setup.c	Wed Dec 31 16:00:00 1969
+++ linux/arch/mips/baget/setup.c	Wed Jun 30 11:24:54 1999
@@ -0,0 +1,494 @@
+/* $Id$
+ *
+ * setup.c: Baget/MIPS specific setup, including init of the feature struct.
+ *
+ * Copyright (C) 1998 Gleb Raiko & Vladimir Roganov
+ *
+ */
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/sched.h>
+#include <asm/irq.h>
+#include <asm/addrspace.h>
+#include <asm/reboot.h>
+
+#include <asm/baget/baget.h>
+
+extern long mips_memory_upper;
+
+extern void wbflush_setup(void);
+
+#define CACHEABLE_STR(val) ((val) ? "not cached" : "cached")
+#define MIN(a,b)           (((a)<(b)) ? (a):(b)) 
+		
+__initfunc(static void vac_show(void))
+{ 
+	int i;
+	unsigned short val, decode = vac_inw(VAC_DECODE_CTRL);
+	unsigned short a24_base = vac_inw(VAC_A24_BASE);
+	unsigned long  a24_addr = ((unsigned long)
+					   (a24_base & VAC_A24_MASK)) << 16;
+	char *decode_mode[]  = { "eprom", "vsb", "shared", "dram" };
+	char *address_mode[] = { "", ", A16", ", A32/A24", ", A32/A24/A16" };
+	char *state[] = { "", " on write", " on read", " on read/write", };
+	char *region_mode[] = { "inactive", "shared", "vsb", "vme" };
+	char *asiz[]        = { "user", "A32", "A16", "A24" };
+	unsigned short regs[] = { VAC_REG1,     VAC_REG2, VAC_REG3  };
+	unsigned short bndr[] = { VAC_DRAM_MASK,VAC_BNDR2,VAC_BNDR3 };
+	unsigned short io_sels[] = { VAC_IOSEL0_CTRL,
+				     VAC_IOSEL1_CTRL,
+				     VAC_IOSEL2_CTRL,
+				     VAC_IOSEL3_CTRL,
+				     VAC_IOSEL4_CTRL,
+				     VAC_IOSEL5_CTRL };
+	
+	printk("[DSACKi %s, DRAMCS%s qualified, boundary%s qualified%s]\n",
+	       (decode & VAC_DECODE_DSACKI)     ? "on" : "off",
+	       (decode & VAC_DECODE_QFY_DRAMCS) ? ""   : " not",
+	       (decode & VAC_DECODE_QFY_BNDR)   ? ""   : " not",
+	       (decode & VAC_DECODE_FPUCS)      ? ", fpu" : "");
+
+	printk("slave0 ");
+	if (decode & VAC_DECODE_RDR_SLSEL0)
+		printk("at %08lx (%d MB)\t[dram %s]\n",
+		       ((unsigned long)vac_inw(VAC_SLSEL0_BASE))<<16,
+		       ((0xffff ^ vac_inw(VAC_SLSEL0_MASK)) + 1) >> 4,
+		       (decode & VAC_DECODE_QFY_SLSEL0) ? "qualified" : "");
+	else
+		printk("off\n");
+
+	printk("slave1 ");
+	if (decode & VAC_DECODE_RDR_SLSEL1)
+		printk("at %08lx (%d MB)\t[%s%s, %s]\n",
+		       ((unsigned long)vac_inw(VAC_SLSEL1_BASE))<<16,
+		       ((0xffff ^ vac_inw(VAC_SLSEL1_MASK)) + 1) >> 4,
+		       decode_mode[VAC_DECODE_MODE_VAL(decode)],
+		       address_mode[VAC_DECODE_CMP_SLSEL1_VAL(decode)],
+		       (decode & VAC_DECODE_QFY_SLSEL1) ? "qualified" : "");
+	else
+		printk("off\n");
+
+	printk("icf global at %04x, module at %04x [%s]\n",
+		       ((unsigned int)
+			VAC_ICFSEL_GLOBAL_VAL(vac_inw(VAC_ICFSEL_BASE)))<<4,
+		       ((unsigned int)
+			VAC_ICFSEL_MODULE_VAL(vac_inw(VAC_ICFSEL_BASE)))<<4,
+		       (decode & VAC_DECODE_QFY_ICFSEL) ? "qualified" : "");
+
+	
+	printk("region0 at 00000000 (%dMB)\t[dram, %s, delay %d cpuclk"
+	       ", cached]\n",
+	       (vac_inw(VAC_DRAM_MASK)+1)>>4,
+	       (decode & VAC_DECODE_DSACK) ? "D32" : "3state",
+	       VAC_DECODE_CPUCLK_VAL(decode));
+	
+	for (i = 0; i < sizeof(regs)/sizeof(regs[0]); i++) {
+		unsigned long from = 
+ ((unsigned long)vac_inw(bndr[i]))<<16;
+		unsigned long to   = 
+			((unsigned long)
+			 ((i+1 == sizeof(bndr)/sizeof(bndr[0])) ? 
+			  0xff00 : vac_inw(bndr[i+1])))<<16;
+		
+		
+		val = vac_inw(regs[i]);
+		printk("region%d at %08lx (%dMB)\t[%s %s/%s, %s]\n", 
+		       i+1,
+		       from,
+		       (unsigned int)((to - from) >> 20),
+		       region_mode[VAC_REG_MODE(val)],
+		       asiz[VAC_REG_ASIZ_VAL(val)],
+		       ((val & VAC_REG_WORD) ?  "D16" : "D32"),
+		       CACHEABLE_STR(val&VAC_A24_A24_CACHINH));
+		
+		if (a24_addr >= from && a24_addr < to)
+			printk("\ta24 at %08lx (%dMB)\t[vme, A24/%s, %s]\n",
+			       a24_addr,
+			       MIN((unsigned int)(a24_addr - from)>>20, 32),
+			       (a24_base & VAC_A24_DATAPATH) ?  "user" :
+			       ((a24_base & VAC_A24_D32_ENABLE)  ?  
+				"D32" : "D16"),
+			       CACHEABLE_STR(a24_base & VAC_A24_A24_CACHINH));
+	}
+
+	printk("region4 at ff000000 (15MB)\t[eprom]\n");
+	val = vac_inw(VAC_EPROMCS_CTRL);
+	printk("\t[ack %d cpuclk%s, %s%srecovery %d cpuclk, "
+	       "read %d%s, write %d%s, assert %d%s]\n",
+	       VAC_CTRL_DELAY_DSACKI_VAL(val),
+	       state[val & (VAC_CTRL_IORD|VAC_CTRL_IOWR)],
+	       (val & VAC_CTRL_DSACK0) ? "dsack0*, " : "",
+	       (val & VAC_CTRL_DSACK1) ? "dsack1*, " : "",
+	       VAC_CTRL_RECOVERY_IOSELI_VAL(val),
+	       VAC_CTRL_DELAY_IORD_VAL(val)/2,
+	       (VAC_CTRL_DELAY_IORD_VAL(val)&1) ? ".5" : "",
+	       VAC_CTRL_DELAY_IOWR_VAL(val)/2,
+	       (VAC_CTRL_DELAY_IOWR_VAL(val)&1) ? ".5" : "",
+	       VAC_CTRL_DELAY_IOSELI_VAL(val)/2,
+	       (VAC_CTRL_DELAY_IOSELI_VAL(val)&1) ? ".5" : "");
+	
+	printk("region5 at fff00000 (896KB)\t[local io, %s]\n",
+	       CACHEABLE_STR(vac_inw(VAC_A24_BASE) & VAC_A24_IO_CACHINH));
+
+	for (i = 0; i < sizeof(io_sels)/sizeof(io_sels[0]); i++) {
+		val = vac_inw(io_sels[i]);
+		printk("\tio%d[ack %d cpuclk%s, %s%srecovery %d cpuclk, "
+		       "\n\t read %d%s cpuclk, write %d%s cpuclk, "
+		       "assert %d%s%s cpuclk]\n",
+		       i, 
+		       VAC_CTRL_DELAY_DSACKI_VAL(val),
+		       state[val & (VAC_CTRL_IORD|VAC_CTRL_IOWR)],
+		       (val & VAC_CTRL_DSACK0) ? "dsack0*, " : "",
+		       (val & VAC_CTRL_DSACK1) ? "dsack1*, " : "",
+		       VAC_CTRL_RECOVERY_IOSELI_VAL(val),
+		       VAC_CTRL_DELAY_IORD_VAL(val)/2,
+		       (VAC_CTRL_DELAY_IORD_VAL(val)&1) ? ".5" : "",
+		       VAC_CTRL_DELAY_IOWR_VAL(val)/2,
+		       (VAC_CTRL_DELAY_IOWR_VAL(val)&1) ? ".5" : "",
+		       VAC_CTRL_DELAY_IOSELI_VAL(val)/2,
+		       (VAC_CTRL_DELAY_IOSELI_VAL(val)&1) ? ".5" : "",
+		       (vac_inw(VAC_DEV_LOC) & VAC_DEV_LOC_IOSEL(i)) ? 
+		          ", id" : "");
+	}
+		
+	printk("region6 at fffe0000 (128KB)\t[vme, A16/%s, "
+	       "not cached]\n",
+	       (a24_base & VAC_A24_A16D32_ENABLE) ? 
+	       ((a24_base & VAC_A24_A16D32) ? "D32" : "D16") : "user");
+		       
+	val = vac_inw(VAC_SHRCS_CTRL);
+	printk("shared[ack %d cpuclk%s, %s%srecovery %d cpuclk, "
+	       "read %d%s, write %d%s, assert %d%s]\n",
+	       VAC_CTRL_DELAY_DSACKI_VAL(val),
+	       state[val & (VAC_CTRL_IORD|VAC_CTRL_IOWR)],
+	       (val & VAC_CTRL_DSACK0) ? "dsack0*, " : "",
+	       (val & VAC_CTRL_DSACK1) ? "dsack1*, " : "",
+	       VAC_CTRL_RECOVERY_IOSELI_VAL(val),
+	       VAC_CTRL_DELAY_IORD_VAL(val)/2,
+	       (VAC_CTRL_DELAY_IORD_VAL(val)&1) ? ".5" : "",
+	       VAC_CTRL_DELAY_IOWR_VAL(val)/2,
+	       (VAC_CTRL_DELAY_IOWR_VAL(val)&1) ? ".5" : "",
+	       VAC_CTRL_DELAY_IOSELI_VAL(val)/2,
+	       (VAC_CTRL_DELAY_IOSELI_VAL(val)&1) ? ".5" : "");
+}
+
+__initfunc(static void vac_init(void))
+{
+	unsigned short mem_limit = ((mips_memory_upper-KSEG0) >> 16);
+
+	switch(vac_inw(VAC_ID)) {
+	case 0x1AC0:
+		printk("VAC068-F5: ");
+		break;
+	case 0x1AC1:
+		printk("VAC068A: ");
+		break;
+	default:
+		panic("Unknown VAC revision number");
+	}
+	
+	vac_outw(mem_limit-1, VAC_DRAM_MASK); 
+	vac_outw(mem_limit, VAC_BNDR2);
+	vac_outw(mem_limit, VAC_BNDR3);
+	vac_outw(((BAGET_A24M_BASE>>16)&~VAC_A24_D32_ENABLE)|VAC_A24_DATAPATH,
+		 VAC_A24_BASE);
+	vac_outw(VAC_REG_INACTIVE|VAC_REG_ASIZ0,VAC_REG1);
+	vac_outw(VAC_REG_INACTIVE|VAC_REG_ASIZ0,VAC_REG2);
+	vac_outw(VAC_REG_MWB|VAC_REG_ASIZ1,VAC_REG3);
+	vac_outw(BAGET_A24S_BASE>>16,VAC_SLSEL0_BASE);
+	vac_outw(BAGET_A24S_MASK>>16,VAC_SLSEL0_MASK);
+	vac_outw(BAGET_A24S_BASE>>16,VAC_SLSEL1_BASE);
+	vac_outw(BAGET_A24S_MASK>>16,VAC_SLSEL1_MASK);
+	vac_outw(BAGET_GSW_BASE|BAGET_MSW_BASE(0),VAC_ICFSEL_BASE);
+	vac_outw(VAC_DECODE_FPUCS|
+		 VAC_DECODE_CPUCLK(3)|
+		 VAC_DECODE_RDR_SLSEL0|VAC_DECODE_RDR_SLSEL1|
+		 VAC_DECODE_DSACK|
+		 VAC_DECODE_QFY_BNDR|
+		 VAC_DECODE_QFY_ICFSEL|
+		 VAC_DECODE_QFY_SLSEL1|VAC_DECODE_QFY_SLSEL0|
+		 VAC_DECODE_CMP_SLSEL1_HI|
+		 VAC_DECODE_DRAMCS|
+		 VAC_DECODE_QFY_DRAMCS|
+		 VAC_DECODE_DSACKI,VAC_DECODE_CTRL);
+	vac_outw(VAC_PIO_FUNC_UART_A_TX|VAC_PIO_FUNC_UART_A_RX|
+		 VAC_PIO_FUNC_UART_B_TX|VAC_PIO_FUNC_UART_B_RX|
+		 VAC_PIO_FUNC_IOWR|
+		 VAC_PIO_FUNC_IOSEL3|
+		 VAC_PIO_FUNC_IRQ7|VAC_PIO_FUNC_IRQ10|VAC_PIO_FUNC_IRQ11|
+		 VAC_PIO_FUNC_IOSEL2|
+		 VAC_PIO_FUNC_FCIACK,VAC_PIO_FUNC);
+	vac_outw(VAC_PIO_DIR_FCIACK |
+		 VAC_PIO_DIR_OUT(0) |
+		 VAC_PIO_DIR_OUT(1) |
+		 VAC_PIO_DIR_OUT(2) |
+		 VAC_PIO_DIR_OUT(3) |
+		 VAC_PIO_DIR_IN(4)  |
+		 VAC_PIO_DIR_OUT(5) |
+		 VAC_PIO_DIR_OUT(6) |
+		 VAC_PIO_DIR_OUT(7) |
+		 VAC_PIO_DIR_OUT(8) |
+		 VAC_PIO_DIR_IN(9)  |
+		 VAC_PIO_DIR_OUT(10)|
+		 VAC_PIO_DIR_OUT(11)|
+		 VAC_PIO_DIR_OUT(12)|
+		 VAC_PIO_DIR_OUT(13),VAC_PIO_DIRECTION);
+	vac_outw(VAC_DEV_LOC_IOSEL(2),VAC_DEV_LOC);
+	vac_outw(VAC_CTRL_IOWR|
+		 VAC_CTRL_DELAY_IOWR(3)|
+		 VAC_CTRL_DELAY_IORD(3)|
+		 VAC_CTRL_RECOVERY_IOSELI(1)|
+		 VAC_CTRL_DELAY_DSACKI(8),VAC_SHRCS_CTRL);
+	vac_outw(VAC_CTRL_IOWR|
+		 VAC_CTRL_DELAY_IOWR(3)|
+		 VAC_CTRL_DELAY_IORD(3)|
+		 VAC_CTRL_RECOVERY_IOSELI(1)|
+		 VAC_CTRL_DSACK0|VAC_CTRL_DSACK1|
+		 VAC_CTRL_DELAY_DSACKI(8),VAC_EPROMCS_CTRL);
+	vac_outw(VAC_CTRL_IOWR|
+		 VAC_CTRL_DELAY_IOWR(3)|
+		 VAC_CTRL_DELAY_IORD(3)|
+		 VAC_CTRL_RECOVERY_IOSELI(2)|
+		 VAC_CTRL_DSACK0|VAC_CTRL_DSACK1|
+		 VAC_CTRL_DELAY_DSACKI(8),VAC_IOSEL0_CTRL);
+	vac_outw(VAC_CTRL_IOWR|
+		 VAC_CTRL_DELAY_IOWR(3)|
+		 VAC_CTRL_DELAY_IORD(3)|
+		 VAC_CTRL_RECOVERY_IOSELI(2)|
+		 VAC_CTRL_DSACK0|VAC_CTRL_DSACK1|
+		 VAC_CTRL_DELAY_DSACKI(8),VAC_IOSEL1_CTRL);
+	vac_outw(VAC_CTRL_IOWR|
+		 VAC_CTRL_DELAY_IOWR(3)|
+		 VAC_CTRL_DELAY_IORD(3)|
+		 VAC_CTRL_RECOVERY_IOSELI(2)|
+		 VAC_CTRL_DSACK0|VAC_CTRL_DSACK1|
+		 VAC_CTRL_DELAY_DSACKI(8),VAC_IOSEL2_CTRL);
+	vac_outw(VAC_CTRL_IOWR|
+		 VAC_CTRL_DELAY_IOWR(3)|
+		 VAC_CTRL_DELAY_IORD(3)|
+		 VAC_CTRL_RECOVERY_IOSELI(2)|
+		 VAC_CTRL_DSACK0|VAC_CTRL_DSACK1|
+		 VAC_CTRL_DELAY_DSACKI(8),VAC_IOSEL3_CTRL);
+	vac_outw(VAC_CTRL_IOWR|
+		 VAC_CTRL_DELAY_IOWR(3)|
+		 VAC_CTRL_DELAY_IORD(3)|
+		 VAC_CTRL_RECOVERY_IOSELI(2)|
+		 VAC_CTRL_DELAY_DSACKI(8),VAC_IOSEL4_CTRL);
+	vac_outw(VAC_CTRL_IOWR|
+		 VAC_CTRL_DELAY_IOWR(3)|
+		 VAC_CTRL_DELAY_IORD(3)|
+		 VAC_CTRL_RECOVERY_IOSELI(2)|
+		 VAC_CTRL_DELAY_DSACKI(8),VAC_IOSEL5_CTRL);
+
+        vac_show();
+}
+
+__initfunc(static void vac_start(void))
+{
+	vac_outw(0, VAC_ID);
+	vac_outw(VAC_INT_CTRL_TIMER_DISABLE|
+		 VAC_INT_CTRL_UART_B_DISABLE|
+		 VAC_INT_CTRL_UART_A_DISABLE|
+		 VAC_INT_CTRL_MBOX_DISABLE|
+		 VAC_INT_CTRL_PIO4_DISABLE|
+		 VAC_INT_CTRL_PIO7_DISABLE|
+		 VAC_INT_CTRL_PIO8_DISABLE|
+		 VAC_INT_CTRL_PIO9_DISABLE,VAC_INT_CTRL);
+	vac_outw(VAC_INT_CTRL_TIMER_PIO10|
+		 VAC_INT_CTRL_UART_B_PIO7|
+		 VAC_INT_CTRL_UART_A_PIO7,VAC_INT_CTRL);
+	/* 
+	 *  Set quadro speed for both UARTs.
+	 *  To do it we need use formulae from VIC/VAC manual,
+	 *  keeping in mind Baget's 50MHz frequency...
+	 */
+	vac_outw((500000/(384*16))<<8,VAC_CPU_CLK_DIV); 
+}
+
+__initfunc(static void vic_show(void))
+{
+	unsigned char val;
+	char *timeout[]  = { "4", "16", "32", "64", "128", "256", "disabled" };
+	char *deadlock[] = { "[dedlk only]", "[dedlk only]", 
+			     "[dedlk], [halt w/ rmc], [lberr]",
+			     "[dedlk], [halt w/o rmc], [lberr]" };
+
+	val = vic_inb(VIC_IFACE_CFG);
+	if (val & VIC_IFACE_CFG_VME)
+		printk("VMEbus controller ");
+	if (val & VIC_IFACE_CFG_TURBO)
+		printk("turbo ");
+	if (val & VIC_IFACE_CFG_MSTAB)
+		printk("metastability delay ");
+	printk("%s ",
+	       deadlock[VIC_IFACE_CFG_DEADLOCK_VAL(val)]);
+	
+
+	printk("interrupts: ");
+	val = vic_inb(VIC_ERR_INT);
+	if (!(val & VIC_ERR_INT_SYSFAIL))
+		printk("[sysfail]");
+	if (!(val & VIC_ERR_INT_TIMO))
+		printk("[timeout]");
+	if (!(val & VIC_ERR_INT_WRPOST))
+		printk("[write post]");
+	if (!(val & VIC_ERR_INT_ACFAIL))
+		printk("[acfail] ");
+	printk("\n");
+	
+	printk("timeouts: ");
+	val = vic_inb(VIC_XFER_TIMO);
+	printk("local %s, vme %s ",
+	       timeout[VIC_XFER_TIMO_LOCAL_PERIOD_VAL(val)],
+	       timeout[VIC_XFER_TIMO_VME_PERIOD_VAL(val)]);
+	if (val & VIC_XFER_TIMO_VME)
+		printk("acquisition ");
+	if (val & VIC_XFER_TIMO_ARB)
+		printk("arbitration ");
+	printk("\n");
+
+	val = vic_inb(VIC_LOCAL_TIM);
+	printk("pas time: (%d,%d), ds time: %d\n",
+	       VIC_LOCAL_TIM_PAS_ASSERT_VAL(val),
+	       VIC_LOCAL_TIM_PAS_DEASSERT_VAL(val),
+	       VIC_LOCAT_TIM_DS_DEASSERT_VAL(val));
+
+	val = vic_inb(VIC_BXFER_DEF);
+	printk("dma: ");
+	if (val & VIC_BXFER_DEF_DUAL)
+		printk("[dual path]");
+	if (val & VIC_BXFER_DEF_LOCAL_CROSS)
+		printk("[local boundary cross]");
+	if (val & VIC_BXFER_DEF_VME_CROSS)
+		printk("[vme boundary cross]");
+	
+}
+
+__initfunc(static void vic_init(void))
+{
+	 unsigned char id = vic_inb(VIC_ID);
+	 if ((id & 0xf0) != 0xf0)
+		 panic("VIC not found");
+	 printk(" VIC068A Rev. %X: ", id & 0x0f);
+
+	 vic_outb(VIC_INT_IPL(3)|VIC_INT_DISABLE,VIC_VME_II);
+	 vic_outb(VIC_INT_IPL(3)|VIC_INT_DISABLE,VIC_VME_INT1);
+	 vic_outb(VIC_INT_IPL(3)|VIC_INT_DISABLE,VIC_VME_INT2);
+	 vic_outb(VIC_INT_IPL(3)|VIC_INT_DISABLE,VIC_VME_INT3);
+	 vic_outb(VIC_INT_IPL(3)|VIC_INT_DISABLE,VIC_VME_INT4);
+/*	 
+	 vic_outb(VIC_INT_IPL(3)|VIC_INT_DISABLE, VIC_VME_INT5);
+*/
+	 vic_outb(VIC_INT_IPL(3)|VIC_INT_DISABLE, VIC_VME_INT6);
+
+	 vic_outb(VIC_INT_IPL(3)|VIC_INT_DISABLE, VIC_VME_INT7);
+	 vic_outb(VIC_INT_IPL(3)|VIC_INT_DISABLE, VIC_DMA_INT);
+	 vic_outb(VIC_INT_IPL(3)|VIC_INT_NOAUTO|VIC_INT_EDGE|
+		  VIC_INT_LOW|VIC_INT_DISABLE, VIC_LINT1);
+	 vic_outb(VIC_INT_IPL(3)|VIC_INT_NOAUTO|VIC_INT_EDGE|
+		  VIC_INT_HIGH|VIC_INT_DISABLE, VIC_LINT2);
+	 vic_outb(VIC_INT_IPL(3)|VIC_INT_NOAUTO|VIC_INT_EDGE|
+		  VIC_INT_HIGH|VIC_INT_DISABLE, VIC_LINT3);
+	 vic_outb(VIC_INT_IPL(3)|VIC_INT_NOAUTO|VIC_INT_EDGE|
+		  VIC_INT_LOW|VIC_INT_DISABLE, VIC_LINT4);
+/*	 
+	 vic_outb(VIC_INT_IPL(3)|VIC_INT_NOAUTO|VIC_INT_LEVEL|
+		  VIC_INT_LOW|VIC_INT_DISABLE, VIC_LINT5);
+*/
+	 vic_outb(VIC_INT_IPL(6)|VIC_INT_NOAUTO|VIC_INT_EDGE|
+		  VIC_INT_LOW|VIC_INT_DISABLE, VIC_LINT6);
+	 vic_outb(VIC_INT_IPL(6)|VIC_INT_NOAUTO|VIC_INT_EDGE|
+		  VIC_INT_LOW|VIC_INT_DISABLE, VIC_LINT7);
+
+	 vic_outb(VIC_INT_IPL(3)|
+		  VIC_INT_SWITCH(0)|
+		  VIC_INT_SWITCH(1)|
+		  VIC_INT_SWITCH(2)|
+		  VIC_INT_SWITCH(3), VIC_ICGS_INT);
+	 vic_outb(VIC_INT_IPL(3)|
+		  VIC_INT_SWITCH(0)|
+		  VIC_INT_SWITCH(1)|
+		  VIC_INT_SWITCH(2)|
+		  VIC_INT_SWITCH(3), VIC_ICMS_INT);
+	 vic_outb(VIC_INT_IPL(6)|
+		  VIC_ERR_INT_SYSFAIL|
+		  VIC_ERR_INT_TIMO|
+		  VIC_ERR_INT_WRPOST|
+		  VIC_ERR_INT_ACFAIL, VIC_ERR_INT);
+	 vic_outb(VIC_ICxS_BASE_ID(0xf), VIC_ICGS_BASE);
+	 vic_outb(VIC_ICxS_BASE_ID(0xe), VIC_ICMS_BASE);
+	 vic_outb(VIC_LOCAL_BASE_ID(0x6), VIC_LOCAL_BASE);
+	 vic_outb(VIC_ERR_BASE_ID(0x3), VIC_ERR_BASE);
+	 vic_outb(VIC_XFER_TIMO_VME_PERIOD_32|
+		  VIC_XFER_TIMO_LOCAL_PERIOD_32, VIC_XFER_TIMO);
+	 vic_outb(VIC_LOCAL_TIM_PAS_ASSERT(2)|
+		  VIC_LOCAT_TIM_DS_DEASSERT(1)|
+		  VIC_LOCAL_TIM_PAS_DEASSERT(1), VIC_LOCAL_TIM);
+	 vic_outb(VIC_BXFER_DEF_VME_CROSS|
+		  VIC_BXFER_DEF_LOCAL_CROSS|
+		  VIC_BXFER_DEF_AMSR|
+		  VIC_BXFER_DEF_DUAL, VIC_BXFER_DEF);
+	 vic_outb(VIC_SSxCR0_LOCAL_XFER_SINGLE|
+		  VIC_SSxCR0_A32|VIC_SSxCR0_D32|
+		  VIC_SS0CR0_TIMER_FREQ_NONE, VIC_SS0CR0);
+	 vic_outb(VIC_SSxCR1_TF1(0xf)|
+		  VIC_SSxCR1_TF2(0xf), VIC_SS0CR1);
+	 vic_outb(VIC_SSxCR0_LOCAL_XFER_SINGLE|
+		  VIC_SSxCR0_A24|VIC_SSxCR0_D32, VIC_SS1CR0);
+	 vic_outb(VIC_SSxCR1_TF1(0xf)|
+		  VIC_SSxCR1_TF2(0xf), VIC_SS1CR1);
+         vic_outb(VIC_IFACE_CFG_NOHALT|
+		  VIC_IFACE_CFG_NOTURBO, VIC_IFACE_CFG);
+	 vic_outb(VIC_AMS_CODE(0), VIC_AMS);
+	 vic_outb(VIC_BXFER_CTRL_INTERLEAVE(0), VIC_BXFER_CTRL);
+	 vic_outb(0, VIC_BXFER_LEN_LO);
+	 vic_outb(0, VIC_BXFER_LEN_HI);
+	 vic_outb(VIC_REQ_CFG_FAIRNESS_DISABLED|
+		  VIC_REQ_CFG_LEVEL(3)|
+		  VIC_REQ_CFG_RR_ARBITRATION, VIC_REQ_CFG);
+	 vic_outb(VIC_RELEASE_BLKXFER_BLEN(0)|
+		  VIC_RELEASE_RWD, VIC_RELEASE);
+	 vic_outb(VIC_IC6_RUN, VIC_IC6);
+	 vic_outb(0, VIC_IC7);
+	 
+	 vic_show();
+}
+
+static void vic_start(void)
+{
+	vic_outb(VIC_INT_IPL(3)|
+		 VIC_INT_NOAUTO|
+		 VIC_INT_EDGE|
+		 VIC_INT_HIGH|
+		 VIC_INT_ENABLE, VIC_LINT7);
+}
+
+__initfunc(void baget_irq_setup(void))
+{
+	extern void bagetIRQ(void);
+
+        /* Now, it's safe to set the exception vector. */
+	set_except_vector(0, bagetIRQ);
+}
+
+extern void baget_machine_restart(char *command);
+extern void baget_machine_halt(void);
+extern void baget_machine_power_off(void);
+ 
+__initfunc(void baget_setup(void))
+{
+	printk("BT23/63-201n found.\n");
+	*BAGET_WRERR_ACK = 0;
+	irq_setup = baget_irq_setup;
+
+	wbflush_setup();
+
+        _machine_restart   = baget_machine_restart;
+        _machine_halt      = baget_machine_halt;
+        _machine_power_off = baget_machine_power_off;
+
+	vac_init();
+	vic_init();
+	vac_start();
+	vic_start();
+}
diff -u --recursive --new-file v2.3.8/linux/arch/mips/baget/time.c linux/arch/mips/baget/time.c
--- v2.3.8/linux/arch/mips/baget/time.c	Wed Dec 31 16:00:00 1969
+++ linux/arch/mips/baget/time.c	Fri Jun 25 17:40:12 1999
@@ -0,0 +1,96 @@
+/* $Id$
+ * time.c: Baget/MIPS specific time handling details
+ *
+ * Copyright (C) 1998 Gleb Raiko & Vladimir Roganov
+ */
+
+#include <linux/errno.h>
+#include <linux/init.h>
+#include <linux/sched.h>
+#include <linux/kernel.h>
+#include <linux/param.h>
+#include <linux/string.h>
+#include <linux/mm.h>
+#include <linux/interrupt.h>
+#include <linux/timex.h>
+#include <linux/kernel_stat.h>
+
+#include <asm/bootinfo.h>
+#include <asm/io.h>
+#include <asm/irq.h>
+#include <asm/ptrace.h>
+#include <asm/system.h>  
+
+#include <asm/baget/baget.h>
+
+/* 
+ *  To have precision clock, we need to fix available clock frequency
+ */
+#define FREQ_NOM  79125  /* Baget frequency ratio */
+#define FREQ_DEN  10000
+static inline int timer_intr_valid(void) 
+{
+	static unsigned long long ticks, valid_ticks;
+
+	if (ticks++ * FREQ_DEN >= valid_ticks * FREQ_NOM) {
+		/* 
+		 *  We need no overflow checks, 
+		 *  due baget unable to work 3000 years...
+		 *  At least without reboot...
+		 */
+		valid_ticks++;
+		return 1;
+	}
+	return 0;
+}
+
+void static timer_interrupt(int irq, void *dev_id, struct pt_regs * regs)
+{
+	if (timer_intr_valid()) {
+	sti();
+	do_timer(regs);
+	}
+}
+
+__initfunc(static void timer_enable(void))
+{
+	unsigned char ss0cr0 = vic_inb(VIC_SS0CR0);
+	ss0cr0 &= ~VIC_SS0CR0_TIMER_FREQ_MASK;
+	ss0cr0 |= VIC_SS0CR0_TIMER_FREQ_1000HZ;
+	vic_outb(ss0cr0, VIC_SS0CR0);
+
+	vic_outb(VIC_INT_IPL(6)|VIC_INT_NOAUTO|VIC_INT_EDGE|
+		 VIC_INT_LOW|VIC_INT_ENABLE, VIC_LINT2); 
+}
+
+__initfunc(void time_init(void))
+{
+	if (request_irq(BAGET_VIC_TIMER_IRQ, timer_interrupt, 
+			SA_INTERRUPT|SA_STATIC_ALLOC, "timer", NULL) < 0) 
+		printk("time_init: unable request irq for system timer\n");
+
+	timer_enable();
+
+	/* We don't call sti() here, because it is too early for baget */
+}
+
+void do_gettimeofday(struct timeval *tv)
+{
+        unsigned long flags;
+
+        save_and_cli(flags);
+        *tv = xtime;
+        restore_flags(flags);
+}
+
+void do_settimeofday(struct timeval *tv)
+{
+        unsigned long flags;
+  
+        save_and_cli(flags);
+        xtime = *tv;
+        time_state = TIME_BAD;
+        time_maxerror = MAXPHASE;
+        time_esterror = MAXPHASE;
+        restore_flags(flags);
+} 
diff -u --recursive --new-file v2.3.8/linux/arch/mips/baget/vacserial.c linux/arch/mips/baget/vacserial.c
--- v2.3.8/linux/arch/mips/baget/vacserial.c	Wed Dec 31 16:00:00 1969
+++ linux/arch/mips/baget/vacserial.c	Fri Jun 25 17:40:12 1999
@@ -0,0 +1,2943 @@
+/* $Id$
+ * vacserial.c: VAC UART serial driver
+ *              This code stealed and adopted from linux/drivers/char/serial.c
+ *              See that for author info
+ *
+ * Copyright (C) 1998 Gleb Raiko & Vladimir Roganov
+ */
+
+#undef  SERIAL_PARANOIA_CHECK
+#define CONFIG_SERIAL_NOPAUSE_IO
+#define SERIAL_DO_RESTART
+
+#define CONFIG_SERIAL_SHARE_IRQ
+
+/* Set of debugging defines */
+
+#undef  SERIAL_DEBUG_INTR
+#undef  SERIAL_DEBUG_OPEN
+#undef  SERIAL_DEBUG_FLOW
+#undef  SERIAL_DEBUG_RS_WAIT_UNTIL_SENT
+
+#define RS_STROBE_TIME (10*HZ)
+#define RS_ISR_PASS_LIMIT  2 /* Beget is not a super-computer (old=256) */
+
+#define IRQ_T(info) ((info->flags & ASYNC_SHARE_IRQ) ? SA_SHIRQ : SA_INTERRUPT)
+
+#define SERIAL_INLINE
+  
+#if defined(MODULE) && defined(SERIAL_DEBUG_MCOUNT)
+#define DBG_CNT(s) baget_printk("(%s):[%x] refc=%d, serc=%d, ttyc=%d-> %s\n", \
+  kdevname(tty->device),(info->flags),serial_refcount,info->count,tty->count,s)
+#else
+#define DBG_CNT(s)
+#endif
+
+#define  QUAD_UART_SPEED  /* Useful for Baget */
+
+/*
+ * End of serial driver configuration section.
+ */
+
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/errno.h>
+#include <linux/signal.h>
+#include <linux/sched.h>
+#include <linux/timer.h>
+#include <linux/interrupt.h>
+#include <linux/tty.h>
+#include <linux/tty_flip.h>
+#include <linux/serial.h>
+#include <linux/major.h>
+#include <linux/string.h>
+#include <linux/fcntl.h>
+#include <linux/ptrace.h>
+#include <linux/ioport.h>
+#include <linux/mm.h>
+#include <linux/malloc.h>
+#include <linux/init.h>
+#include <linux/delay.h>
+#ifdef CONFIG_SERIAL_CONSOLE
+#include <linux/console.h>
+#endif
+
+#include <asm/system.h>
+#include <asm/io.h>
+#include <asm/irq.h>
+#include <asm/uaccess.h>
+#include <asm/bitops.h>
+#include <asm/serial.h>
+#include <asm/baget/baget.h>
+
+#define BAGET_VAC_UART_IRQ 0x35
+
+/*
+ *  Implementation note:
+ *  It was descovered by means of advanced electronic tools,
+ *  if the driver works via TX_READY interrupts then VIC generates
+ *  strange self-eliminating traps. Thus, the driver is rewritten to work
+ *  via TX_EMPTY
+ */
+
+/* VAC-specific check/debug switches */
+
+#undef CHECK_REG_INDEX
+#undef DEBUG_IO_PORT_A
+
+#ifdef SERIAL_INLINE
+#define _INLINE_ inline
+#endif
+	
+static char *serial_name = "VAC Serial driver";
+static char *serial_version = "4.26";
+
+static DECLARE_TASK_QUEUE(tq_serial);
+
+static struct tty_driver serial_driver, callout_driver;
+static int serial_refcount;
+
+/* number of characters left in xmit buffer before we ask for more */
+#define WAKEUP_CHARS 256
+ 
+/*
+ * IRQ_timeout		- How long the timeout should be for each IRQ
+ * 				should be after the IRQ has been active.
+ */
+
+static struct async_struct *IRQ_ports[NR_IRQS];
+static int IRQ_timeout[NR_IRQS];
+#ifdef CONFIG_SERIAL_CONSOLE
+static struct console sercons;
+#endif
+
+static void autoconfig(struct serial_state * info);
+static void change_speed(struct async_struct *info);
+static void rs_wait_until_sent(struct tty_struct *tty, int timeout);
+
+/*
+ * Here we define the default xmit fifo size used for each type of
+ * UART
+ */
+static struct serial_uart_config uart_config[] = {
+        { "unknown",  1, 0 },  /* Must go first  --  used as unasigned */
+        { "VAC UART", 1, 0 }
+}; 
+#define VAC_UART_TYPE 1   /* Just index in above array */
+
+static struct serial_state rs_table[] = {
+/*
+ * VAC has tricky layout for pair of his SIO registers,
+ *  so we need special function to access ones.
+ *  To identify port we use their TX offset
+ */
+        { 0, 9600, VAC_UART_B_TX, BAGET_VAC_UART_IRQ, 
+          STD_COM_FLAGS }, /* VAC UART B */
+        { 0, 9600, VAC_UART_A_TX, BAGET_VAC_UART_IRQ, 
+          STD_COM_FLAGS }  /* VAC UART A */
+};
+
+#define NR_PORTS	(sizeof(rs_table)/sizeof(struct serial_state))
+
+static struct tty_struct *serial_table[NR_PORTS];
+static struct termios *serial_termios[NR_PORTS];
+static struct termios *serial_termios_locked[NR_PORTS];
+
+#ifndef MIN
+#define MIN(a,b)	((a) < (b) ? (a) : (b))
+#endif
+
+/*
+ * tmp_buf is used as a temporary buffer by serial_write.  We need to
+ * lock it in case the copy_from_user blocks while swapping in a page,
+ * and some other program tries to do a serial write at the same time.
+ * Since the lock will only come under contention when the system is
+ * swapping and available memory is low, it makes sense to share one
+ * buffer across all the serial ports, since it significantly saves
+ * memory if large numbers of serial ports are open.
+ */
+static unsigned char *tmp_buf;
+static struct semaphore tmp_buf_sem = MUTEX;
+
+static inline int serial_paranoia_check(struct async_struct *info,
+					kdev_t device, const char *routine)
+{
+#ifdef SERIAL_PARANOIA_CHECK
+	static const char *badmagic =
+ "Warning: bad magic number for serial struct (%s) in %s\n";
+	static const char *badinfo =
+		"Warning: null async_struct for (%s) in %s\n";
+
+	if (!info) {
+		printk(badinfo, kdevname(device), routine);
+		return 1;
+	}
+	if (info->magic != SERIAL_MAGIC) {
+		printk(badmagic, kdevname(device), routine);
+		return 1;
+	}
+#endif
+	return 0;
+}
+
+/*
+  To unify UART A/B access we will use following function 
+  to compute register offsets by register index.
+ */
+
+#define VAC_UART_MODE       0
+#define VAC_UART_TX         1
+#define VAC_UART_RX         2
+#define VAC_UART_INT_MASK   3
+#define VAC_UART_INT_STATUS 4
+
+#define VAC_UART_REG_NR     5
+
+static inline int uart_offset_map(unsigned long port, int reg_index) 
+{
+	static const unsigned int ind_to_reg[VAC_UART_REG_NR][NR_PORTS] = {
+		{ VAC_UART_B_MODE,       VAC_UART_A_MODE       },
+		{ VAC_UART_B_TX,         VAC_UART_A_TX         },
+		{ VAC_UART_B_RX,         VAC_UART_A_RX         },
+		{ VAC_UART_B_INT_MASK,   VAC_UART_A_INT_MASK   },
+		{ VAC_UART_B_INT_STATUS, VAC_UART_A_INT_STATUS }
+	};
+#ifdef CHECK_REG_INDEX
+	if (reg_index > VAC_UART_REG_NR) panic("vacserial: bad reg_index");
+#endif
+        return ind_to_reg[reg_index][port == VAC_UART_B_TX ? 0 : 1];
+}
+
+static inline unsigned int serial_inw(struct async_struct *info, int offset)
+{
+	int val = vac_inw(uart_offset_map(info->port,offset));
+#ifdef DEBUG_IO_PORT_A
+	if (info->port == VAC_UART_A_TX)
+		printk("UART_A_IN: reg = 0x%04x, val = 0x%04x\n", 
+		       uart_offset_map(info->port,offset), val);
+#endif
+	return val;
+}
+
+static inline unsigned int serial_inp(struct async_struct *info, int offset)
+{
+	return serial_inw(info, offset);
+}
+
+static inline unsigned int serial_in(struct async_struct *info, int offset)
+{
+	return serial_inw(info, offset);
+}
+
+static inline void serial_outw(struct async_struct *info,int offset, int value)
+{
+#ifdef DEBUG_IO_PORT_A
+	if (info->port == VAC_UART_A_TX)
+		printk("UART_A_OUT: offset = 0x%04x, val = 0x%04x\n", 
+		       uart_offset_map(info->port,offset), value);
+#endif
+	vac_outw(value, uart_offset_map(info->port,offset));
+}
+
+static inline void serial_outp(struct async_struct *info,int offset, int value)
+{
+	serial_outw(info,offset,value);
+}
+
+static inline void serial_out(struct async_struct *info,int offset, int value)
+{
+	serial_outw(info,offset,value);
+}
+
+/*
+ * ------------------------------------------------------------
+ * rs_stop() and rs_start()
+ *
+ * This routines are called before setting or resetting tty->stopped.
+ * They enable or disable transmitter interrupts, as necessary.
+ * ------------------------------------------------------------
+ */
+static void rs_stop(struct tty_struct *tty)
+{
+ struct async_struct *info = (struct async_struct *)tty->driver_data;
+	unsigned long flags;
+
+	if (serial_paranoia_check(info, tty->device, "rs_stop"))
+		return;
+	
+	save_flags(flags); cli();
+        if (info->IER & VAC_UART_INT_TX_EMPTY) {
+                info->IER &= ~VAC_UART_INT_TX_EMPTY;
+		serial_out(info, VAC_UART_INT_MASK, info->IER);
+	}
+	restore_flags(flags);
+}
+
+static void rs_start(struct tty_struct *tty)
+{
+ struct async_struct *info = (struct async_struct *)tty->driver_data;
+	unsigned long flags;
+	
+	if (serial_paranoia_check(info, tty->device, "rs_start"))
+		return;
+	
+	save_flags(flags); cli();
+	if (info->xmit_cnt && info->xmit_buf 
+            && !(info->IER & VAC_UART_INT_TX_EMPTY)) {
+                info->IER |= VAC_UART_INT_TX_EMPTY;
+		serial_out(info, VAC_UART_INT_MASK, info->IER);
+	}
+	restore_flags(flags);
+}
+
+/*
+ * ----------------------------------------------------------------------
+ *
+ * Here starts the interrupt handling routines.  All of the following
+ * subroutines are declared as inline and are folded into
+ * rs_interrupt().  They were separated out for readability's sake.
+ *
+ * Note: rs_interrupt() is a "fast" interrupt, which means that it
+ * runs with interrupts turned off.  People who may want to modify
+ * rs_interrupt() should try to keep the interrupt handler as fast as
+ * possible.  After you are done making modifications, it is not a bad
+ * idea to do:
+ * 
+ * gcc -S -DKERNEL -Wall -Wstrict-prototypes -O6 -fomit-frame-pointer serial.c
+ *
+ * and look at the resulting assemble code in serial.s.
+ *
+ * 				- Ted Ts'o (ty...@mit.edu), 7-Mar-93
+ * -----------------------------------------------------------------------
+ */
+
+/*
+ * This routine is used by the interrupt handler to schedule
+ * processing in the software interrupt portion of the driver.
+ */
+static _INLINE_ void rs_sched_event(struct async_struct *info,
+				  int event)
+{
+	info->event |= 1 << event;
+	queue_task(&info->tqueue, &tq_serial);
+	mark_bh(SERIAL_BH);
+}
+
+static _INLINE_ void receive_chars(struct async_struct *info,
+				   int *status)
+{
+	struct tty_struct *tty = info->tty;
+	unsigned short rx;
+	unsigned char ch;
+	int ignored = 0;
+	struct	async_icount *icount;
+
+	icount = &info->state->icount;
+	do {
+		rx = serial_inw(info, VAC_UART_RX);
+		ch = VAC_UART_RX_DATA_MASK & rx;
+
+		if (tty->flip.count >= TTY_FLIPBUF_SIZE)
+ break;
+		*tty->flip.char_buf_ptr = ch;
+		icount->rx++;
+		
+#ifdef SERIAL_DEBUG_INTR
+		baget_printk("DR%02x:%02x...", rx, *status);
+#endif
+		*tty->flip.flag_buf_ptr = 0;
+		if (*status & (VAC_UART_STATUS_RX_BREAK_CHANGE 
+			       | VAC_UART_STATUS_RX_ERR_PARITY 
+			       | VAC_UART_STATUS_RX_ERR_FRAME 
+			       | VAC_UART_STATUS_RX_ERR_OVERRUN)) {
+			/*
+			 * For statistics only
+			 */
+			if (*status & VAC_UART_STATUS_RX_BREAK_CHANGE) {
+				*status &= ~(VAC_UART_STATUS_RX_ERR_FRAME 
+					     | VAC_UART_STATUS_RX_ERR_PARITY);
+				icount->brk++;
+			} else if (*status & VAC_UART_STATUS_RX_ERR_PARITY)
+				icount->parity++;
+			else if (*status & VAC_UART_STATUS_RX_ERR_FRAME)
+				icount->frame++;
+			if (*status & VAC_UART_STATUS_RX_ERR_OVERRUN)
+				icount->overrun++;
+
+			/*
+			 * Now check to see if character should be
+			 * ignored, and mask off conditions which
+			 * should be ignored.
+			 */
+			if (*status & info->ignore_status_mask) {
+				if (++ignored > 100)
+					break;
+				goto ignore_char;
+			}
+			*status &= info->read_status_mask;
+		
+			if (*status & (VAC_UART_STATUS_RX_BREAK_CHANGE)) {
+#ifdef SERIAL_DEBUG_INTR
+				baget_printk("handling break....");
+#endif
+				*tty->flip.flag_buf_ptr = TTY_BREAK;
+				if (info->flags & ASYNC_SAK)
+					do_SAK(tty);
+			} else if (*status & VAC_UART_STATUS_RX_ERR_PARITY)
+				*tty->flip.flag_buf_ptr = TTY_PARITY;
+ else if (*status & VAC_UART_STATUS_RX_ERR_FRAME)
+				*tty->flip.flag_buf_ptr = TTY_FRAME;
+			if (*status & VAC_UART_STATUS_RX_ERR_OVERRUN) {
+				/*
+				 * Overrun is special, since it's
+				 * reported immediately, and doesn't
+				 * affect the current character
+				 */
+				if (tty->flip.count < TTY_FLIPBUF_SIZE) {
+					tty->flip.count++;
+					tty->flip.flag_buf_ptr++;
+					tty->flip.char_buf_ptr++;
+					*tty->flip.flag_buf_ptr = TTY_OVERRUN;
+				}
+			}
+		}
+		tty->flip.flag_buf_ptr++;
+		tty->flip.char_buf_ptr++;
+		tty->flip.count++;
+	ignore_char:
+		*status = serial_inw(info, VAC_UART_INT_STATUS);
+	} while ((*status & VAC_UART_STATUS_RX_READY));
+	tty_flip_buffer_push(tty);
+}
+
+static _INLINE_ void transmit_chars(struct async_struct *info, int *intr_done)
+{
+	int count;
+	
+	if (info->x_char) {
+		serial_outw(info, VAC_UART_TX, 
+			    (((unsigned short)info->x_char)<<8));
+		info->state->icount.tx++;
+		info->x_char = 0;
+		if (intr_done)
+			*intr_done = 0;
+		return;
+	}
+	if ((info->xmit_cnt <= 0) || info->tty->stopped ||
+	    info->tty->hw_stopped) {
+                info->IER &= ~VAC_UART_INT_TX_EMPTY;
+		serial_outw(info, VAC_UART_INT_MASK, info->IER);
+		return;
+	}
+	count = info->xmit_fifo_size;
+	do {
+		serial_out(info, VAC_UART_TX, 
+			   (unsigned short)info->xmit_buf[info->xmit_tail++] \
+			   << 8);
+		info->xmit_tail = info->xmit_tail & (SERIAL_XMIT_SIZE-1);
+		info->state->icount.tx++;
+		if (--info->xmit_cnt <= 0)
+			break;
+	} while (--count > 0);
+	
+	if (info->xmit_cnt < WAKEUP_CHARS)
+		rs_sched_event(info, RS_EVENT_WRITE_WAKEUP);
+
+#ifdef SERIAL_DEBUG_INTR
+	baget_printk("THRE...");
+#endif
+	if (intr_done)
+		*intr_done = 0;
+
+	if (info->xmit_cnt <= 0) {
+                info->IER &= ~VAC_UART_INT_TX_EMPTY;
+		serial_outw(info, VAC_UART_INT_MASK, info->IER);
+	}
+}
+
+static _INLINE_ void check_modem_status(struct async_struct *info)
+{
+#if 0 /* VAC hasn't modem control */
+	wake_up_interruptible(&info->open_wait);
+	rs_sched_event(info, RS_EVENT_WRITE_WAKEUP); 
+#endif
+}
+
+#ifdef CONFIG_SERIAL_SHARE_IRQ
+
+
+/*
+ *  Specific functions needed for VAC UART interrupt enter/leave
+ */
+
+#define VAC_INT_CTRL_UART_ENABLE  \
+   (VAC_INT_CTRL_TIMER_PIO10|VAC_INT_CTRL_UART_B_PIO7|VAC_INT_CTRL_UART_A_PIO7)
+
+#define VAC_INT_CTRL_UART_DISABLE(info) \
+   (VAC_INT_CTRL_TIMER_PIO10 | \
+    ((info->port == VAC_UART_A_TX) ? \
+     (VAC_INT_CTRL_UART_A_DISABLE|VAC_INT_CTRL_UART_B_PIO7) : \
+     (VAC_INT_CTRL_UART_A_PIO7|VAC_INT_CTRL_UART_B_DISABLE)))
+
+/*
+ *  Following two functions were proposed by Pavel Osipenko 
+ *  to make VAC/VIC behaviour more regular.
+ */
+static void intr_begin(struct async_struct* info) 
+{
+	serial_outw(info, VAC_UART_INT_MASK, 0);
+}
+
+static void intr_end(struct async_struct* info)
+{
+	vac_outw(VAC_INT_CTRL_UART_DISABLE(info), VAC_INT_CTRL);
+	vac_outw(VAC_INT_CTRL_UART_ENABLE,        VAC_INT_CTRL); 
+
+	serial_outw(info, VAC_UART_INT_MASK, info->IER);
+}
+
+/*
+ * This is the serial driver's generic interrupt routine
+ */
+static void rs_interrupt(int irq, void *dev_id, struct pt_regs * regs)
+{
+	int status;
+	struct async_struct * info;
+	int pass_counter = 0;
+	struct async_struct *end_mark = 0;
+
+#ifdef SERIAL_DEBUG_INTR
+	baget_printk("rs_interrupt(%d)...", irq);
+#endif
+
+	info = IRQ_ports[irq];
+	if (!info)
+		return;
+
+	do {
+	        intr_begin(info);  /* Mark we begin port handling */
+
+		if (!info->tty ||
+		     (serial_inw (info, VAC_UART_INT_STATUS) 
+		      & VAC_UART_STATUS_INTS) == 0) 
+		    {
+			if (!end_mark)
+				end_mark = info;
+			goto next;
+		    }
+		end_mark = 0;
+
+		info->last_active = jiffies;
+
+		status = serial_inw(info, VAC_UART_INT_STATUS);
+#ifdef SERIAL_DEBUG_INTR
+		baget_printk("status = %x...", status);
+#endif
+		if (status & VAC_UART_STATUS_RX_READY) {
+			receive_chars(info, &status);
+		}
+		check_modem_status(info);
+                if (status & VAC_UART_STATUS_TX_EMPTY)
SHAR_EOF
true || echo 'restore of patch-2.3.9 failed'
fi
echo 'End of  part 02'
echo 'File patch-2.3.9 is continued in part 03'
echo 03 > _shar_seq_.tmp
exit 0
#!/bin/sh
# this is part 06 of a 26 - part archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file patch-2.3.9 continued
if test ! -r _shar_seq_.tmp; then
        echo 'Please unpack part 1 first!'
        exit 1
fi
(read Scheck
if test "$Scheck" != 06; then
        echo Please unpack part "$Scheck" next!
        exit 1
 else
        exit 0
 fi
) < _shar_seq_.tmp || exit 1
if test ! -f _shar_wnt_.tmp; then
echo 'x - still skipping patch-2.3.9'
else
echo 'x - continuing with patch-2.3.9'
sed 's/^X//' << 'SHAR_EOF' >> 'patch-2.3.9' &&
-# CONFIG_BLK_DEV_NBD is not set
+CONFIG_BLK_DEV_LOOP=m
+CONFIG_BLK_DEV_NBD=m
X # CONFIG_BLK_DEV_MD is not set
-# CONFIG_BLK_DEV_RAM is not set
+CONFIG_BLK_DEV_RAM=m
X # CONFIG_BLK_DEV_XD is not set
X CONFIG_PARIDE_PARPORT=y
X # CONFIG_PARIDE is not set
+# CONFIG_BLK_DEV_IDE_MODES is not set
X # CONFIG_BLK_DEV_HD is not set
X 
X #
@@ -106,7 +123,6 @@
X # (it is safe to leave these untouched)
X #
X # CONFIG_INET_RARP is not set
-CONFIG_IP_NOSR=y
X # CONFIG_SKB_LARGE is not set
X 
X #
@@ -124,8 +140,8 @@
X # SCSI support type (disk, tape, CD-ROM)
X #
X CONFIG_BLK_DEV_SD=y
-CONFIG_CHR_DEV_ST=y
-CONFIG_BLK_DEV_SR=y
+CONFIG_CHR_DEV_ST=m
+CONFIG_BLK_DEV_SR=m
X # CONFIG_BLK_DEV_SR_VENDOR is not set
X # CONFIG_CHR_DEV_SG is not set
X 
@@ -134,12 +150,13 @@
X #
X # CONFIG_SCSI_MULTI_LUN is not set
X CONFIG_SCSI_CONSTANTS=y
-CONFIG_SCSI_LOGGING=y
+# CONFIG_SCSI_LOGGING is not set
X 
X #
X # SCSI low-level drivers
X #
X # CONFIG_SCSI_7000FASST is not set
+# CONFIG_SCSI_ACARD is not set
X # CONFIG_SCSI_AHA152X is not set
X # CONFIG_SCSI_AHA1542 is not set
X # CONFIG_SCSI_AHA1740 is not set
@@ -147,20 +164,25 @@
X # CONFIG_SCSI_ADVANSYS is not set
X # CONFIG_SCSI_IN2000 is not set
X # CONFIG_SCSI_AM53C974 is not set
+# CONFIG_SCSI_MEGARAID is not set
X # CONFIG_SCSI_BUSLOGIC is not set
X # CONFIG_SCSI_DTC3280 is not set
+# CONFIG_SCSI_EATA is not set
X # CONFIG_SCSI_EATA_DMA is not set
X # CONFIG_SCSI_EATA_PIO is not set
-# CONFIG_SCSI_EATA is not set
X # CONFIG_SCSI_FUTURE_DOMAIN is not set
X # CONFIG_SCSI_GDTH is not set
X # CONFIG_SCSI_GENERIC_NCR5380 is not set
+# CONFIG_SCSI_INITIO is not set
+# CONFIG_SCSI_INIA100 is not set
X # CONFIG_SCSI_NCR53C406A is not set
+# CONFIG_SCSI_SYM53C416 is not set
X # CONFIG_SCSI_NCR53C7xx is not set
X CONFIG_SCSI_NCR53C8XX=y
+# CONFIG_SCSI_SYM53C8XX is not set
X CONFIG_SCSI_NCR53C8XX_DEFAULT_TAGS=8
-CONFIG_SCSI_NCR53C8XX_MAX_TAGS=4
-CONFIG_SCSI_NCR53C8XX_SYNC=5
+CONFIG_SCSI_NCR53C8XX_MAX_TAGS=32
+CONFIG_SCSI_NCR53C8XX_SYNC=20
X # CONFIG_SCSI_NCR53C8XX_PROFILE is not set
X # CONFIG_SCSI_NCR53C8XX_IOMAPPED is not set
X # CONFIG_SCSI_PAS16 is not set
@@ -169,13 +191,12 @@
X # CONFIG_SCSI_PSI240I is not set
X # CONFIG_SCSI_QLOGIC_FAS is not set
X # CONFIG_SCSI_QLOGIC_ISP is not set
+# CONFIG_SCSI_QLOGIC_FC is not set
X # CONFIG_SCSI_SEAGATE is not set
X # CONFIG_SCSI_DC390T is not set
X # CONFIG_SCSI_T128 is not set
X # CONFIG_SCSI_U14_34F is not set
X # CONFIG_SCSI_ULTRASTOR is not set
-CONFIG_JAZZ_ESP=y
-CONFIG_JAZZ_ESP=y
X 
X #
X # Network device support
@@ -185,7 +206,6 @@
X # CONFIG_DUMMY is not set
X # CONFIG_EQUALIZER is not set
X CONFIG_NET_ETHERNET=y
-CONFIG_MIPS_JAZZ_SONIC=y
X # CONFIG_NET_VENDOR_3COM is not set
X # CONFIG_LANCE is not set
X # CONFIG_NET_VENDOR_SMC is not set
@@ -211,6 +231,8 @@
X # CONFIG_NET_RADIO is not set
X # CONFIG_TR is not set
X # CONFIG_HOSTESS_SV11 is not set
+# CONFIG_COSA is not set
+# CONFIG_RCPCI is not set
X # CONFIG_WAN_DRIVERS is not set
X # CONFIG_LAPBETHER is not set
X # CONFIG_X25_ASY is not set
@@ -235,7 +257,7 @@
X # CONFIG_ISDN is not set
X 
X #
-# CD-ROM drivers (not for SCSI or IDE/ATAPI drives)
+# comment
X #
X # CONFIG_CD_NO_IDESCSI is not set
X 
@@ -244,18 +266,26 @@
X #
X CONFIG_VT=y
X CONFIG_VT_CONSOLE=y
-CONFIG_SERIAL=y
-# CONFIG_SERIAL_CONSOLE is not set
+CONFIG_SERIAL=m
X # CONFIG_SERIAL_EXTENDED is not set
X # CONFIG_SERIAL_NONSTANDARD is not set
X # CONFIG_UNIX98_PTYS is not set
X # CONFIG_MOUSE is not set
X # CONFIG_QIC02_TAPE is not set
X # CONFIG_WATCHDOG is not set
-# CONFIG_RTC is not set
-# CONFIG_VIDEO_DEV is not set
X # CONFIG_NVRAM is not set
+CONFIG_RTC=y
+
+#
+# Video For Linux
+#
+# CONFIG_VIDEO_DEV is not set
+
+#
+# Joystick support
+#
X # CONFIG_JOYSTICK is not set
+# CONFIG_DTLK is not set
X 
X #
X # Ftape, the floppy tape device driver
@@ -263,71 +293,93 @@
X # CONFIG_FTAPE is not set
X 
X #
+# USB drivers - not for the faint of heart
+#
+# CONFIG_USB is not set
+
+#
X # Filesystems
X #
-# CONFIG_QUOTA is not set
-# CONFIG_MINIX_FS is not set
-CONFIG_EXT2_FS=y
-CONFIG_ISO9660_FS=y
-# CONFIG_JOLIET is not set
-CONFIG_FAT_FS=y
-CONFIG_MSDOS_FS=y
-# CONFIG_UMSDOS_FS is not set
-CONFIG_VFAT_FS=y
-CONFIG_PROC_FS=y
-CONFIG_NFS_FS=y
-CONFIG_NFSD=y
-CONFIG_SUNRPC=y
-CONFIG_LOCKD=y
-# CONFIG_CODA_FS is not set
-# CONFIG_SMB_FS is not set
-# CONFIG_HPFS_FS is not set
-# CONFIG_NTFS_FS is not set
-# CONFIG_SYSV_FS is not set
+CONFIG_QUOTA=y
+CONFIG_AUTOFS_FS=m
X # CONFIG_AFFS_FS is not set
X # CONFIG_HFS_FS is not set
-# CONFIG_ROMFS_FS is not set
-# CONFIG_AUTOFS_FS is not set
+CONFIG_FAT_FS=m
+CONFIG_MSDOS_FS=m
+CONFIG_UMSDOS_FS=m
+CONFIG_VFAT_FS=m
+CONFIG_ISO9660_FS=m
+CONFIG_JOLIET=y
+CONFIG_MINIX_FS=m
+# CONFIG_NTFS_FS is not set
+CONFIG_HPFS_FS=m
+CONFIG_PROC_FS=y
+CONFIG_ROMFS_FS=m
+CONFIG_EXT2_FS=y
+# CONFIG_SYSV_FS is not set
X # CONFIG_UFS_FS is not set
+
+#
+# Network File Systems
+#
+# CONFIG_CODA_FS is not set
+CONFIG_NFS_FS=m
+CONFIG_SUNRPC=m
+CONFIG_LOCKD=m
+# CONFIG_SMB_FS is not set
+# CONFIG_NCP_FS is not set
+
+#
+# Partition Types
+#
X # CONFIG_BSD_DISKLABEL is not set
+# CONFIG_MAC_PARTITION is not set
+# CONFIG_OSF_PARTITION is not set
X # CONFIG_SMD_DISKLABEL is not set
X # CONFIG_SOLARIS_X86_PARTITION is not set
-# CONFIG_MAC_PARTITION is not set
+# CONFIG_SGI_DISKLABEL is not set
X CONFIG_NLS=y
X 
X #
X # Native Language Support
X #
-# CONFIG_NLS_CODEPAGE_437 is not set
-# CONFIG_NLS_CODEPAGE_737 is not set
-# CONFIG_NLS_CODEPAGE_775 is not set
-CONFIG_NLS_CODEPAGE_850=y
-# CONFIG_NLS_CODEPAGE_852 is not set
-# CONFIG_NLS_CODEPAGE_855 is not set
-# CONFIG_NLS_CODEPAGE_857 is not set
-# CONFIG_NLS_CODEPAGE_860 is not set
-# CONFIG_NLS_CODEPAGE_861 is not set
-# CONFIG_NLS_CODEPAGE_862 is not set
-# CONFIG_NLS_CODEPAGE_863 is not set
-# CONFIG_NLS_CODEPAGE_864 is not set
-# CONFIG_NLS_CODEPAGE_865 is not set
-# CONFIG_NLS_CODEPAGE_866 is not set
-# CONFIG_NLS_CODEPAGE_869 is not set
-# CONFIG_NLS_CODEPAGE_874 is not set
-CONFIG_NLS_ISO8859_1=y
-# CONFIG_NLS_ISO8859_2 is not set
-# CONFIG_NLS_ISO8859_3 is not set
-# CONFIG_NLS_ISO8859_4 is not set
-# CONFIG_NLS_ISO8859_5 is not set
-# CONFIG_NLS_ISO8859_6 is not set
-# CONFIG_NLS_ISO8859_7 is not set
-# CONFIG_NLS_ISO8859_8 is not set
-# CONFIG_NLS_ISO8859_9 is not set
-# CONFIG_NLS_KOI8_R is not set
+CONFIG_NLS_CODEPAGE_437=m
+CONFIG_NLS_CODEPAGE_737=m
+CONFIG_NLS_CODEPAGE_775=m
+CONFIG_NLS_CODEPAGE_850=m
+CONFIG_NLS_CODEPAGE_852=m
+CONFIG_NLS_CODEPAGE_855=m
+CONFIG_NLS_CODEPAGE_857=m
+CONFIG_NLS_CODEPAGE_860=m
+CONFIG_NLS_CODEPAGE_861=m
+CONFIG_NLS_CODEPAGE_862=m
+CONFIG_NLS_CODEPAGE_863=m
+CONFIG_NLS_CODEPAGE_864=m
+CONFIG_NLS_CODEPAGE_865=m
+CONFIG_NLS_CODEPAGE_866=m
+CONFIG_NLS_CODEPAGE_869=m
+CONFIG_NLS_CODEPAGE_874=m
+CONFIG_NLS_ISO8859_1=m
+CONFIG_NLS_ISO8859_2=m
+CONFIG_NLS_ISO8859_3=m
+CONFIG_NLS_ISO8859_4=m
+CONFIG_NLS_ISO8859_5=m
+CONFIG_NLS_ISO8859_6=m
+CONFIG_NLS_ISO8859_7=m
+CONFIG_NLS_ISO8859_8=m
+CONFIG_NLS_ISO8859_9=m
+CONFIG_NLS_ISO8859_15=m
+CONFIG_NLS_KOI8_R=m
X 
X #
X # Console drivers
X #
+CONFIG_VGA_CONSOLE=y
+# CONFIG_FB is not set
+# CONFIG_FBCON_FONTWIDTH8_ONLY is not set
+# CONFIG_FBCON_FONTS is not set
+CONFIG_FONT_8x8=y
+CONFIG_FONT_8x16=y
X 
X #
X # Sound
@@ -337,7 +389,6 @@
X #
X # Kernel hacking
X #
-CONFIG_CROSSCOMPILE=y
+# CONFIG_CROSSCOMPILE is not set
X # CONFIG_MIPS_FPE_MODULE is not set
-# CONFIG_REMOTE_DEBUG is not set
X # CONFIG_MAGIC_SYSRQ is not set
diff -u --recursive --new-file v2.3.8/linux/arch/mips/jazz/Makefile linux/arch/mips/jazz/Makefile
--- v2.3.8/linux/arch/mips/jazz/Makefile	Tue Oct 20 13:52:54 1998
+++ linux/arch/mips/jazz/Makefile	Fri Jun 25 17:40:12 1999
@@ -1,3 +1,4 @@
+# $Id: Makefile,v 1.6 1999/02/25 21:57:01 tsbogend Exp $
X #
X # Makefile for the Jazz family specific parts of the kernel
X #
@@ -13,7 +14,8 @@
X 
X all: jazz.o
X O_TARGET := jazz.o
-O_OBJS	 := hw-access.o int-handler.o jazzdma.o reset.o rtc-jazz.o setup.o
+O_OBJS	 := int-handler.o jazzdma.o reset.o rtc-jazz.o setup.o floppy-jazz.o \
+	    kbd-jazz.o
X 
X int-handler.o: int-handler.S
X 
diff -u --recursive --new-file v2.3.8/linux/arch/mips/jazz/floppy-jazz.c linux/arch/mips/jazz/floppy-jazz.c
--- v2.3.8/linux/arch/mips/jazz/floppy-jazz.c	Tue Oct 20 13:52:54 1998
+++ linux/arch/mips/jazz/floppy-jazz.c	Fri Jun 25 17:40:12 1999
@@ -14,11 +14,11 @@
X #include <linux/types.h>
X #include <linux/mm.h>
X #include <asm/addrspace.h>
-#include <asm/vector.h>
X #include <asm/jazz.h>
X #include <asm/jazzdma.h>
X #include <asm/keyboard.h>
X #include <asm/pgtable.h>
+#include <asm/floppy.h>
X 
X static unsigned char jazz_fd_inb(unsigned int port)
X {
@@ -108,7 +108,7 @@
X 	return order;
X }
X 
-extern inline unsigned long jazz_fd_dma_mem_alloc(unsigned long size)
+static unsigned long jazz_fd_dma_mem_alloc(unsigned long size)
X {
X 	int order = __get_order(size);
X 	unsigned long mem;
@@ -121,14 +121,14 @@
X 	return mem;
X }
X 
-extern inline void jazz_fd_dma_mem_free(unsigned long addr,
+static void jazz_fd_dma_mem_free(unsigned long addr,
X                                         unsigned long size)
X {       
-	vdma_free(PHYSADDR(addr));
+	vdma_free(vdma_phys2log(PHYSADDR(addr)));
X 	free_pages(addr, __get_order(size));	
X }
X 
-static void std_fd_drive_type(unsigned long n)
+static unsigned long jazz_fd_drive_type(unsigned long n)
X {
X 	/* XXX This is wrong for machines with ED 2.88mb disk drives like the
X 	   Olivetti M700.  Anyway, we should suck this from the ARC
diff -u --recursive --new-file v2.3.8/linux/arch/mips/jazz/hw-access.c linux/arch/mips/jazz/hw-access.c
--- v2.3.8/linux/arch/mips/jazz/hw-access.c	Tue Oct 20 13:52:54 1998
+++ linux/arch/mips/jazz/hw-access.c	Wed Dec 31 16:00:00 1969
@@ -1,90 +0,0 @@
-/* $Id: hw-access.c,v 1.11 1998/09/16 22:50:39 ralf Exp $
- *
- * Low-level hardware access stuff for Jazz family machines.
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 1995, 1996, 1997, 1998 by Ralf Baechle
- */
-#include <linux/delay.h>
-#include <linux/init.h>
-#include <linux/linkage.h>
-#include <linux/types.h>
-#include <linux/mm.h>
-#include <asm/addrspace.h>
-#include <asm/jazz.h>
-#include <asm/jazzdma.h>
-#include <asm/keyboard.h>
-#include <asm/pgtable.h>
-
-static volatile keyboard_hardware *jazz_kh = 
-	(keyboard_hardware *) JAZZ_KEYBOARD_ADDRESS;
-
-#define KBD_STAT_IBF		0x02	/* Keyboard input buffer full */
-
-static unsigned char jazz_read_input(void)
-{
-	return jazz_kh->data;
-}
-
-static void jazz_write_output(unsigned char val)
-{
-	int status;
-
-	do {
-		status = jazz_kh->command;
-	} while (status & KBD_STAT_IBF);
-	jazz_kh->data = val;
-}
-
-static void jazz_write_command(unsigned char val)
-{
-	int status;
-
-	do {
-		status = jazz_kh->command;
-	} while (status & KBD_STAT_IBF);
-	jazz_kh->command = val;
-}
-
-static unsigned char jazz_read_status(void)
-{
-	return jazz_kh->command;
-}
-
-__initfunc(void jazz_keyboard_setup(void))
-{
-	kbd_read_input = jazz_read_input;
-	kbd_write_output = jazz_write_output;
-	kbd_write_command = jazz_write_command;
-	kbd_read_status = jazz_read_status;
-	request_irq(JAZZ_KEYBOARD_IRQ, keyboard_interrupt,
-	            0, "keyboard", NULL);
-	request_region(0x60, 16, "keyboard");
-	r4030_write_reg16(JAZZ_IO_IRQ_ENABLE,
-	                  r4030_read_reg16(JAZZ_IO_IRQ_ENABLE)
-	                  | JAZZ_IE_KEYBOARD);
-}
-
-int jazz_ps2_request_irq(void)
-{
-    extern void aux_interrupt(int, void *, struct pt_regs *);
-    int ret;
-    
-    ret = request_irq(JAZZ_MOUSE_IRQ, aux_interrupt, 0, "PS/2 Mouse", NULL);
-    if (!ret)
-	r4030_write_reg16(JAZZ_IO_IRQ_ENABLE, 
-			  r4030_read_reg16(JAZZ_IO_IRQ_ENABLE) | 
-			  JAZZ_IE_MOUSE);
-    return ret;
-}
-
-void jazz_ps2_free_irq(void)
-{
-    r4030_write_reg16(JAZZ_IO_IRQ_ENABLE, 
-		      r4030_read_reg16(JAZZ_IO_IRQ_ENABLE) | 
-		      JAZZ_IE_MOUSE);
-    free_irq(JAZZ_MOUSE_IRQ, NULL);
-}
diff -u --recursive --new-file v2.3.8/linux/arch/mips/jazz/int-handler.S linux/arch/mips/jazz/int-handler.S
--- v2.3.8/linux/arch/mips/jazz/int-handler.S	Tue Oct 20 13:52:54 1998
+++ linux/arch/mips/jazz/int-handler.S	Fri Jun 25 17:40:12 1999
@@ -1,4 +1,4 @@
-/* $Id: int-handler.S,v 1.6 1998/08/28 15:55:19 ralf Exp $
+/* $Id: int-handler.S,v 1.14 1999/05/01 22:40:34 ralf Exp $
X  *
X  * This file is subject to the terms and conditions of the GNU General Public
X  * License.  See the file "COPYING" in the main directory of this archive
@@ -91,51 +91,8 @@
X  * whistles and bells and we're aware of the problem.
X  */
X ll_isa_irq:	lw	a0,JAZZ_EISA_IRQ_ACK
-		lui	s0,%hi(JAZZ_PORT_BASE)
-		li	s1,1
-		andi	t0,a0,8				# which pic?
-		bnez	t0,ack_second
-		andi	a0,7				# delay slot
X 
-		/*
-		 * Acknowledge first pic
-		 */
-		lb	t2,%lo(JAZZ_PORT_BASE)+0x21(s0)
-		lui	s4,%hi(cache_21)
-		lb	t0,%lo(cache_21)(s4)
-		sllv	s1,s1,a0
-		or	t0,s1
-		sb	t0,%lo(cache_21)(s4)
-		sb	t0,%lo(JAZZ_PORT_BASE)+0x21(s0)
-		li	t2,0x20
-		sb	t2,%lo(JAZZ_PORT_BASE)+0x20(s0)
-		/*
-		 * Now call the real handler
-		 */
-		jal	do_IRQ
-		 move	a1,sp
-		j	ret_from_irq
-		nop
-
-		.align	5
-ack_second:	/*
-		 * Acknowledge second pic
-		 */
-		lbu	t2,%lo(JAZZ_PORT_BASE)+0xa1(s0)
-		lui	s4,%hi(cache_A1)
-		lb	t3,%lo(cache_A1)(s4)
-		sllv	s1,s1,a0
-		or	t3,s1
-		sb	t3,%lo(cache_A1)(s4)
-		sb	t3,%lo(JAZZ_PORT_BASE)+0xa1(s0)
-		li	t3,0x20
-		sb	t3,%lo(JAZZ_PORT_BASE)+0xa0(s0)
-		sb	t3,%lo(JAZZ_PORT_BASE)+0x20(s0)
-		/*
-		 * Now call the real handler
-		 */
-		or      a0, 8
-		jal	do_IRQ
+		jal	i8259_do_irq
X 		 move	a1,sp
X 
X 		j	ret_from_irq
@@ -144,7 +101,7 @@
X /*
X  * Hmm...  This is not just a plain PC clone so the question is
X  * which devices on Jazz machines can generate an (E)ISA NMI?
- * (Writing to nonexistant memory?)
+ * (Writing to nonexistent memory?)
X  */
X ll_isa_nmi:	li	s1,~IE_IRQ3
X 		PANIC("Unimplemented isa_nmi handler")
@@ -152,7 +109,7 @@
X /*
X  * Timer IRQ - remapped to be more similar to an IBM compatible.
X  *
- * The timer interrupt is handled specially to insure that the jiffies
+ * The timer interrupt is handled specially to ensure that the jiffies
X  * variable is updated at all times.  Specifically, the timer interrupt is
X  * just like the complete handlers except that it is invoked with interrupts
X  * disabled and should never re-enable them.  If other interrupts were
@@ -163,7 +120,7 @@
X ll_timer:	lw	zero,JAZZ_TIMER_REGISTER # timer irq cleared on read
X 		li	s1,~IE_IRQ4
X 
-		li	a0,0
+		li	a0, JAZZ_TIMER_IRQ
X 		jal	do_IRQ
X 		 move	a1,sp
X 
@@ -228,14 +185,14 @@
X 		b	loc_call
X 
X /*
- * Floppy IRQ, remapped to level 6
+ * Floppy IRQ
X  */
X loc_floppy:	li	s1,~JAZZ_IE_FLOPPY
X 		li	a0,JAZZ_FLOPPY_IRQ
X 		b	loc_call
X 
X /*
- * Sound? What sound hardware (whistle) ???
+ * Sound IRQ
X  */
X loc_sound:	PANIC("Unimplemented loc_sound handler")
X loc_video:	PANIC("Unimplemented loc_video handler")
diff -u --recursive --new-file v2.3.8/linux/arch/mips/jazz/jazzdma.c linux/arch/mips/jazz/jazzdma.c
--- v2.3.8/linux/arch/mips/jazz/jazzdma.c	Fri May  8 00:13:23 1998
+++ linux/arch/mips/jazz/jazzdma.c	Fri Jun 25 17:40:12 1999
@@ -97,6 +97,7 @@
X     unsigned int frame;
X     unsigned long laddr;
X     int i;
+    unsigned long flags;
X 
X     /* check arguments */
X   
@@ -113,6 +114,7 @@
X         return VDMA_ERROR;	/* invalid physical address */
X     }
X   
+    save_and_cli (flags);
X     /*
X      * Find free chunk
X      */
@@ -123,8 +125,10 @@
X         while (entry[first].owner != VDMA_PAGE_EMPTY &&
X                first < VDMA_PGTBL_ENTRIES)
X             first++;
-        if (first+pages > VDMA_PGTBL_ENTRIES) /* nothing free */
+        if (first+pages > VDMA_PGTBL_ENTRIES) { /* nothing free */
+	    restore_flags (flags);
X             return VDMA_ERROR;
+	}
X 
X         last = first+1;
X         while (entry[last].owner == VDMA_PAGE_EMPTY && last-first < pages)
@@ -170,6 +174,7 @@
X         printk("\n");
X     }
X   
+    restore_flags(flags);
X     return laddr;
X }
X 
diff -u --recursive --new-file v2.3.8/linux/arch/mips/jazz/kbd-jazz.c linux/arch/mips/jazz/kbd-jazz.c
--- v2.3.8/linux/arch/mips/jazz/kbd-jazz.c	Wed Dec 31 16:00:00 1969
+++ linux/arch/mips/jazz/kbd-jazz.c	Fri Jun 25 17:40:12 1999
@@ -0,0 +1,102 @@
+/* $Id: kbd-jazz.c,v 1.1 1998/10/28 12:38:10 ralf Exp $
+ *
+ * Low-level hardware access stuff for Jazz family machines.
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 1995, 1996, 1997, 1998 by Ralf Baechle
+ */
+#include <linux/sched.h>
+#include <linux/pc_keyb.h>
+#include <asm/keyboard.h>
+#include <asm/jazz.h>
+
+#define jazz_kh ((keyboard_hardware *) JAZZ_KEYBOARD_ADDRESS)
+
+static void jazz_request_region(void)
+{
+	/* No I/O ports are being used on Jazz.  */
+}
+
+static int jazz_request_irq(void (*handler)(int, void *, struct pt_regs *))
+{
+	int res;
+
+	res = request_irq(JAZZ_KEYBOARD_IRQ, handler, 0, "keyboard", NULL);
+	if (res != 0)
+		return res;
+
+	/* jazz_request_irq() should do this ...  */
+	r4030_write_reg16(JAZZ_IO_IRQ_ENABLE,
+	                  r4030_read_reg16(JAZZ_IO_IRQ_ENABLE)
+	                  | JAZZ_IE_KEYBOARD);
+
+	return 0;
+}
+
+static int jazz_aux_request_irq(void (*handler)(int, void *, struct pt_regs *))
+{
+	int ret;
+    
+	ret = request_irq(JAZZ_MOUSE_IRQ, handler, 0, "PS/2 Mouse", NULL);
+	if (ret != 0)
+		return ret;
+
+		r4030_write_reg16(JAZZ_IO_IRQ_ENABLE, 
+				  r4030_read_reg16(JAZZ_IO_IRQ_ENABLE) | 
+				  JAZZ_IE_MOUSE);
+	return 0;
+}
+
+static void jazz_aux_free_irq(void)
+{
+	r4030_write_reg16(JAZZ_IO_IRQ_ENABLE, 
+	                  r4030_read_reg16(JAZZ_IO_IRQ_ENABLE)
+	                  | JAZZ_IE_MOUSE);
+	free_irq(JAZZ_MOUSE_IRQ, NULL);
+}
+
+static unsigned char jazz_read_input(void)
+{
+	return jazz_kh->data;
+}
+
+static void jazz_write_output(unsigned char val)
+{
+	int status;
+
+	do {
+		status = jazz_kh->command;
+	} while (status & KBD_STAT_IBF);
+	jazz_kh->data = val;
+}
+
+static void jazz_write_command(unsigned char val)
+{
+	int status;
+
+	do {
+		status = jazz_kh->command;
+	} while (status & KBD_STAT_IBF);
+	jazz_kh->command = val;
+}
+
+static unsigned char jazz_read_status(void)
+{
+	return jazz_kh->command;
+}
+
+struct kbd_ops jazz_kbd_ops = {
+	jazz_request_region,
+	jazz_request_irq,
+
+	jazz_aux_request_irq,
+	jazz_aux_free_irq,
+
+	jazz_read_input,
+	jazz_write_output,
+	jazz_write_command,
+	jazz_read_status
+};
diff -u --recursive --new-file v2.3.8/linux/arch/mips/jazz/reset.c linux/arch/mips/jazz/reset.c
--- v2.3.8/linux/arch/mips/jazz/reset.c	Tue Oct 20 13:52:54 1998
+++ linux/arch/mips/jazz/reset.c	Fri Jun 25 17:40:12 1999
@@ -3,7 +3,7 @@
X  *
X  *  Reset a Jazz machine.
X  *
- *  $Id: reset.c,v 1.2 1998/03/04 12:17:40 ralf Exp $
+ *  $Id: reset.c,v 1.3 1998/03/04 08:29:10 ralf Exp $
X  */
X 
X #include <linux/sched.h>
diff -u --recursive --new-file v2.3.8/linux/arch/mips/jazz/rtc-jazz.c linux/arch/mips/jazz/rtc-jazz.c
--- v2.3.8/linux/arch/mips/jazz/rtc-jazz.c	Tue Oct 20 13:52:54 1998
+++ linux/arch/mips/jazz/rtc-jazz.c	Fri Jun 25 17:40:12 1999
@@ -1,4 +1,4 @@
-/* $Id: rtc-jazz.c,v 1.3 1998/08/28 15:55:19 ralf Exp $
+/* $Id: rtc-jazz.c,v 1.2 1998/06/25 20:19:14 ralf Exp $
X  *
X  * This file is subject to the terms and conditions of the GNU General Public
X  * License.  See the file "COPYING" in the main directory of this archive
diff -u --recursive --new-file v2.3.8/linux/arch/mips/jazz/setup.c linux/arch/mips/jazz/setup.c
--- v2.3.8/linux/arch/mips/jazz/setup.c	Tue Oct 20 13:52:54 1998
+++ linux/arch/mips/jazz/setup.c	Fri Jun 25 17:40:12 1999
@@ -1,4 +1,4 @@
-/* $Id: setup.c,v 1.14 1998/09/16 22:50:40 ralf Exp $
+/* $Id: setup.c,v 1.20 1999/02/25 21:57:47 tsbogend Exp $
X  *
X  * Setup pointers to hardware-dependent routines.
X  *
@@ -12,7 +12,6 @@
X #include <linux/hdreg.h>
X #include <linux/init.h>
X #include <linux/ioport.h>
-#include <linux/kbd_ll.h>
X #include <linux/sched.h>
X #include <linux/interrupt.h>
X #include <linux/mm.h>
@@ -40,7 +39,6 @@
X static struct irqaction irq2  = { no_action, 0, 0, "cascade", NULL, NULL};
X 
X extern asmlinkage void jazz_handle_int(void);
-extern void jazz_keyboard_setup(void);
X 
X extern void jazz_machine_restart(char *command);
X extern void jazz_machine_halt(void);
@@ -48,6 +46,9 @@
X 
X extern struct ide_ops std_ide_ops;
X extern struct rtc_ops jazz_rtc_ops;
+extern struct kbd_ops jazz_kbd_ops;
+extern struct fd_ops *fd_ops;
+extern struct fd_ops jazz_fd_ops;
X 
X void (*board_time_init)(struct irqaction *irq);
X 
@@ -55,7 +56,7 @@
X {
X         /* set the clock to 100 Hz */
X         r4030_write_reg32(JAZZ_TIMER_INTERVAL, 9);
-        setup_x86_irq(0, irq);
+        i8259_setup_irq(JAZZ_TIMER_IRQ, irq);
X }
X 
X __initfunc(static void jazz_irq_setup(void))
@@ -75,43 +76,16 @@
X 	r4030_write_reg32(JAZZ_TIMER_INTERVAL, 9);
X 	request_region(0x20, 0x20, "pic1");
X 	request_region(0xa0, 0x20, "pic2");
-	setup_x86_irq(2, &irq2);
+	i8259_setup_irq(2, &irq2);
X }
X 
X __initfunc(void jazz_setup(void))
X {
-    tag *atag;
-
-    /*
-     * we just check if a tag_screen_info can be gathered
-     * in setup_arch(), if yes we don't proceed futher...
-     */
-    atag = bi_TagFind(tag_screen_info);
-    if (!atag) {
-	/*
-	 * If no, we try to find the tag_arc_displayinfo which is
-	 * always created by Milo for an ARC box (for now Milo only
-	 * works on ARC boxes :) -Stoned.
-	 */
-	atag = bi_TagFind(tag_arcdisplayinfo);
-	if (atag) {
-	    screen_info.orig_x = 
-		((mips_arc_DisplayInfo*)TAGVALPTR(atag))->cursor_x;
-	    screen_info.orig_y = 
-		((mips_arc_DisplayInfo*)TAGVALPTR(atag))->cursor_y;
-	    screen_info.orig_video_cols  = 
-		((mips_arc_DisplayInfo*)TAGVALPTR(atag))->columns;
-	    screen_info.orig_video_lines  = 
-		((mips_arc_DisplayInfo*)TAGVALPTR(atag))->lines;
-	}
-    }
-
X 	add_wired_entry (0x02000017, 0x03c00017, 0xe0000000, PM_64K);
X 	add_wired_entry (0x02400017, 0x02440017, 0xe2000000, PM_16M);
X 	add_wired_entry (0x01800017, 0x01000017, 0xe4000000, PM_4M);
X 
X 	irq_setup = jazz_irq_setup;
-	keyboard_setup = jazz_keyboard_setup;
X 	mips_io_port_base = JAZZ_PORT_BASE;
X 	isa_slot_offset = 0xe3000000;
X 	request_region(0x00,0x20,"dma1");
@@ -128,6 +102,8 @@
X #ifdef CONFIG_BLK_DEV_IDE
X 	ide_ops = &std_ide_ops;
X #endif
-	conswitchp = &fb_con;
+	conswitchp = &dummy_con;
X 	rtc_ops = &jazz_rtc_ops;
+	kbd_ops = &jazz_kbd_ops;
+	fd_ops = &jazz_fd_ops;
X }
diff -u --recursive --new-file v2.3.8/linux/arch/mips/kernel/Makefile linux/arch/mips/kernel/Makefile
--- v2.3.8/linux/arch/mips/kernel/Makefile	Tue Oct 20 13:52:54 1998
+++ linux/arch/mips/kernel/Makefile	Fri Jun 25 17:40:12 1999
@@ -23,10 +23,14 @@
X endif
X 
X #
-# SGI's have very different interrupt/timer hardware.
+# SGIs have very different interrupt/timer hardware.
X #
X ifndef CONFIG_SGI
-O_OBJS += irq.o time.o
+  ifndef CONFIG_DECSTATION
+    ifndef CONFIG_BAGET_MIPS
+      O_OBJS += irq.o time.o
+    endif
+  endif
X endif
X 
X #
diff -u --recursive --new-file v2.3.8/linux/arch/mips/kernel/entry.S linux/arch/mips/kernel/entry.S
--- v2.3.8/linux/arch/mips/kernel/entry.S	Tue Oct 20 13:52:54 1998
+++ linux/arch/mips/kernel/entry.S	Fri Jun 25 17:40:12 1999
@@ -7,7 +7,7 @@
X  *
X  * Copyright (C) 1994, 1995 by Ralf Baechle
X  *
- * $Id: entry.S,v 1.15 1998/10/14 20:26:26 ralf Exp $
+ * $Id: entry.S,v 1.14 1999/04/12 19:13:21 harald Exp $
X  */
X 
X /*
@@ -146,7 +146,7 @@
X 		BUILD_HANDLER(adel,ade,ade,silent)		/* #4  */
X 		BUILD_HANDLER(ades,ade,ade,silent)		/* #5  */
X 		BUILD_HANDLER(ibe,ibe,cli,verbose)		/* #6  */
-		BUILD_HANDLER(dbe,dbe,cli,verbose)		/* #7  */
+		BUILD_HANDLER(dbe,dbe,cli,silent)		/* #7  */
X 		BUILD_HANDLER(bp,bp,sti,silent)			/* #9  */
X 		BUILD_HANDLER(ri,ri,sti,silent)			/* #10 */
X 		BUILD_HANDLER(cpu,cpu,sti,silent)		/* #11 */
diff -u --recursive --new-file v2.3.8/linux/arch/mips/kernel/fpe.c linux/arch/mips/kernel/fpe.c
--- v2.3.8/linux/arch/mips/kernel/fpe.c	Tue Oct 20 13:52:54 1998
+++ linux/arch/mips/kernel/fpe.c	Fri Jun 25 17:40:12 1999
@@ -6,7 +6,7 @@
X  *
X  * Copyright (C) 1997 Ralf Baechle
X  *
- * $Id: fpe.c,v 1.2 1998/03/27 08:53:39 ralf Exp $
+ * $Id: fpe.c,v 1.4 1999/05/01 22:40:35 ralf Exp $
X  */
X #include <linux/kernel.h>
X #include <linux/module.h>
@@ -39,7 +39,7 @@
X 
X /*
X  * For easier experimentation we never increment/decrement
- * the module useable counter.
+ * the module usable counter.
X  */
X int register_fpe(void (*handler)(struct pt_regs *regs, unsigned int fcr31));
X int unregister_fpe(void (*handler)(struct pt_regs *regs, unsigned int fcr31));
diff -u --recursive --new-file v2.3.8/linux/arch/mips/kernel/gdb-low.S linux/arch/mips/kernel/gdb-low.S
--- v2.3.8/linux/arch/mips/kernel/gdb-low.S	Tue Oct 20 13:52:54 1998
+++ linux/arch/mips/kernel/gdb-low.S	Fri Jun 25 17:40:12 1999
@@ -5,7 +5,7 @@
X  *
X  * Copyright (C) 1995 Andreas Busse
X  *
- * $Id: gdb-low.S,v 1.3 1997/12/02 05:51:05 ralf Exp $
+ * $Id: gdb-low.S,v 1.4 1997/12/01 17:57:26 ralf Exp $
X  */
X 
X #include <linux/sys.h>
diff -u --recursive --new-file v2.3.8/linux/arch/mips/kernel/gdb-stub.c linux/arch/mips/kernel/gdb-stub.c
--- v2.3.8/linux/arch/mips/kernel/gdb-stub.c	Tue Oct 20 13:52:54 1998
+++ linux/arch/mips/kernel/gdb-stub.c	Fri Jun 25 17:40:12 1999
@@ -12,7 +12,7 @@
X  *
X  *  Copyright (C) 1995 Andreas Busse
X  *
- * $Id: gdb-stub.c,v 1.4 1997/12/02 05:51:06 ralf Exp $
+ * $Id: gdb-stub.c,v 1.7 1999/06/12 18:39:28 ulfc Exp $
X  */
X 
X /*
@@ -326,7 +326,7 @@
X 	{ 7, SIGBUS },			/* data bus error */
X 	{ 9, SIGTRAP },			/* break */
X 	{ 10, SIGILL },			/* reserved instruction */
-/*	{ 11, SIGILL },		*/	/* cpu unusable */
+/*	{ 11, SIGILL },		*/	/* CPU unusable */
X 	{ 12, SIGFPE },			/* overflow */
X 	{ 13, SIGTRAP },		/* trap */
X 	{ 14, SIGSEGV },		/* virtual instruction cache coherency */
@@ -362,8 +362,6 @@
X 
X 	initialized = 1;
X 	restore_flags(flags);
-
-	breakpoint();
X }
X 
X 
@@ -379,7 +377,7 @@
X }
X 
X /*
- * Convert the MIPS hardware trap type code to a unix signal number.
+ * Convert the MIPS hardware trap type code to a Unix signal number.
X  */
X static int computeSignal(int tt)
X {
diff -u --recursive --new-file v2.3.8/linux/arch/mips/kernel/head.S linux/arch/mips/kernel/head.S
--- v2.3.8/linux/arch/mips/kernel/head.S	Tue Oct 20 13:52:54 1998
+++ linux/arch/mips/kernel/head.S	Fri Jun 25 17:40:12 1999
@@ -1,4 +1,4 @@
-/* $Id: head.S,v 1.13 1998/10/14 20:26:27 ralf Exp $
+/* $Id: head.S,v 1.11 1998/10/18 13:27:12 tsbogend Exp $
X  *
X  * arch/mips/kernel/head.S
X  *
@@ -408,15 +408,7 @@
X 
X probe_done:
X 
-#ifndef CONFIG_SGI
-	/* Get the memory upper limit the bootloader passed to us
-	 * in a0
-	 */
-	la	t0, mips_memory_upper
-	nop
-	sw	a0, (t0)		
-#else
-	/* On SGI's the firmware/bootloader passes argc/argp/envp
+	/* The firmware/bootloader passes argc/argp/envp
X 	 * to us as arguments.  But clear bss first because
X 	 * the romvec and other important info is stored there
X 	 * by prom_init().
@@ -431,6 +423,7 @@
X 
X 	jal	prom_init /* prom_init(argc, argv, envp); */
X 	 nop
+#ifdef CONFIG_SGI
X 	jal	sgi_sysinit
X 	 nop
X #endif
@@ -440,18 +433,6 @@
X 	 nop
X #endif
X 
-	/* Get the very one tags we need early in the boot process */
-	nop
-	jal	bi_EarlySnarf
-	 nop
-#ifndef CONFIG_SGI
-	/* Clear BSS first so that there are no surprises... */
-	la	t0, _edata
-	la	t1, _end
-1:	addiu	t0, 1
-	bne	t0, t1, 1b
-	sb	zero, -1(t0)
-#endif
X 	/*
X 	 * Determine the mmu/cache attached to this machine,
X 	 * then flush the tlb and caches.  On the r4xx0
@@ -460,34 +441,10 @@
X 	jal	loadmmu
X 	 nop
X 
-	la	t2, mips_cputype
-	lw	t4, (t2)
-	li	t1, CPU_R2000
-	li	t2, CPU_R3000
-	li	t3, CPU_R3000A
-	beq	t4,t1,2f
-	 nop		
-
-	beq	t4,t2,2f
-	 nop		
-
-	beq	t4,t3,2f
-	 nop		
-
-	jal	wire_mappings_r4xx0
-	 nop	
-
-	b	9f
-	 nop
-
-2:
-	jal	wire_mappings_r3000
-	 nop	
-
X 	/*
X 	 * Stack for kernel and init, current variable
X 	 */
-9:	la	$28, init_task_union
+	la	$28, init_task_union
X 	addiu	t0, $28, KERNEL_STACK_SIZE-32
X 	sw	t0, kernelsp
X 	subu	sp, t0, 4*SZREG
@@ -509,81 +466,6 @@
X 	 nop					# delay slot
X 	END(kernel_entry)
X 
-/*
- * wire_mappings - used to map hardware registers, r4xx0 version.
- */
-LEAF(wire_mappings_r4xx0)
-	mtc0	zero, CP0_WIRED
-	nop
-	nop
-	nop
-	j	ra
-	 nop
-	END(wire_mappings_r4xx0)
-
-/*
- * R3000 version of wire_mappings.
- */
-LEAF(wire_mappings_r3000)
-	/*
-	 * Get base address of map0 table for the
-	 * the board we're running on
-	 */
-	lw	t1, mips_machtype
-	la	t0, map0table
-	sll	t1, PTRLOG		# machtype used as index
-	addu	t0, t1
-	lw	t0, (t0)		# get base address
-	nop
-	/* Get number of wired TLB entries and
-	 * loop over selected map0 table.
-	 */
-	lw	t1, (t0)		# number of wired TLB entries
-	move	t2, zero		# TLB entry counter
-	addiu	t3, t1, 1		# wire one additional entry
-	beqz	t1, 2f			# null, exit
-	 nop
-
-	addiu	t0, 8
-1:
-	lw	t4, 24(t0)		# PageMask
-	ld	t5,  0(t0)		# entryHi
-	ld	t6,  8(t0)		# entryLo0
-	addiu	t2, 1			# increment ctr
-	mtc0	t2, CP0_INDEX		# set TLB entry
-	nop
-	mtc0	t5, CP0_ENTRYHI
-	nop
-	mtc0	t6, CP0_ENTRYLO0
-	addiu	t0, 32
-	bne	t1, t2, 1b		# next TLB entry
-	 tlbwi
-
-	/* We use only 4k pages. Therefore the PageMask register
-	 * is expected to be setup for 4k pages.
-	 */
-2:
-	/* Now map the pagetables */
-	mtc0	zero, CP0_INDEX
-	la	t0, TLB_ROOT
-	mtc0	t0, CP0_ENTRYHI
-	nop
-	la	t0, swapper_pg_dir
-	srl	t0, 12
-	ori	t0, (0x00e0|0x0100)	# uncachable, dirty, valid
-	mtc0	t0, CP0_ENTRYLO0
-	nop
-	tlbwi				# delayed
-
-	/* Load the context register with zero.  To see why, look
-	 * at how the tlb refill code above works.
-	 */
-	mtc0	zero, CP0_CONTEXT
-
-	jr	ra
-	 nop
-	END(wire_mappings_r3000)
-
X 	/* CPU type probing code, called at Kernel entry. */
X 	LEAF(cpu_probe)
X 	mfc0	t0, CP0_PRID
@@ -707,115 +589,6 @@
X 	b	probe_done
X 	 nop
X 	END(cpu_probe)
-
-	.data
-/*
- * Build an entry for table of wired entries
- */
-#define MAPDATA(q1,q2,q3,w1)                                    \
-		.quad	q1;                                     \
-		.quad	q2;                                     \
-		.quad	q3;                                     \
-		.word	w1;                                     \
-		.word	0
-
-/*
- * Initial mapping tables for supported Mips boards.
- * First item is always the number of wired TLB entries,
- * following by EntryHi/EntryLo pairs and page mask.
- * Since everything must be quad-aligned (8) we insert
- * some dummy zeros.
- *
- * Keep in mind that the PFN does not depend on the page size in the
- * TLB page mask register.  See milo's lib/dumptlb.c for how to decode
- * and encode these entries.  Don't see the same routine in the linux
- * kernel distribution, since it is older and unreliable.
- */
-
-/*
- * Address table of mapping tables for supported Mips boards.
- * Add your own stuff here but don't forget to define your
- * target system in bootinfo.h
- */
-
-map0table:	PTR	map0_dummy		# machtype = unknown
-		PTR	map0_rpc		# Deskstation rPC44
-		PTR	map0_tyne		# Deskstation Tyne
-		PTR	map0_pica61		# Acer Pica-61
-		PTR	map0_magnum4000		# MIPS Magnum 4000PC (RC4030)
-		PTR	map0_dummy
-		PTR	map0_dummy		# DEC Personal DECStation 5000/2x (for now)
-		PTR	map0_sni_rm200_pci	# SNI RM200 PCI
-		PTR	map0_dummy		# SGI INDY
-
-map0_dummy:	.word	0			# 0 entries
-
-		.align  3
-/*
- * Deskstation rpc44 mappings.  This machine has its EISA bus at physical
- * address 0xa0000000 which we map for 32M, but that doesn't match EISA
- * spec.  Not sure what to do about this.  Its I/O ports are memory mapped
- * at physical memory location 0xb0000000.
- */
-map0_rpc: 	.word   2			# no. of wired TLB entries
-		.word	0			# pad for alignment
-
-MAPDATA(0xffffffffe0000000, 0x02800017, 0x00000001, PM_16M)	# ISA Memory space
-MAPDATA(0xffffffffe2000000, 0x02c00017, 0x00000001, PM_64K)	# ISA I/O Space
-
-/*
- * Initial mappings for Deskstation Tyne boards.
- */
-map0_tyne: 	.word   2			# no. of wired TLB entries
-		.word	0			# pad for alignment
-
-MAPDATA(0xffffffffe0000000, 0x04020017, 0x00000001, PM_1M)	# VESA DMA cache
-MAPDATA(0xffffffffe2000000, 0x24000017, 0x04000017, PM_16M)	# VESA I/O and memory space
-
-/*
- * Initial mapping for ACER PICA-61 boards.
- * FIXME: These are rather preliminary since many drivers, such as serial,
- * parallel, scsi and ethernet need some changes to distinguish between "local"
- * (built-in) and "optional" (ISA/PCI) I/O hardware. Local video ram is mapped
- * to the same location as the bios maps it to. Console driver has been changed
- * accordingly (new video type: VIDEO_TYPE_PICA_S3).
- * FIXME: Remove or merge some of the mappings.
- */
-map0_pica61:	.word  	7			# no. wired TLB entries
-		.word	0			# dummy
-
-MAPDATA(0xffffffffe0000000, 0x02000017, 0x00000001, PM_64K)	# Local I/O space
-MAPDATA(0xffffffffe0100000, 0x03c00017, 0x00000001, PM_4K)	# Interrupt source register
-MAPDATA(0xffffffffe0200000, 0x01800017, 0x01804017, PM_1M)	# Local video control
-MAPDATA(0xffffffffe0400000, 0x01808017, 0x0180c017, PM_1M)	# Extended video control
-MAPDATA(0xffffffffe0800000, 0x01000017, 0x01010017, PM_4M)	# Local video memory (BIOS mapping)
-MAPDATA(0xffffffffe2000000, 0x02400017, 0x02440017, PM_16M)	# ISA I/O and ISA memory space (both 16M)
-MAPDATA(0xffffffffffffe000, 0x00000001, 0x0001ffd7, PM_4K)	# PCR (???)
-
-/*
- * Initial mapping for Mips Magnum 4000PC systems.
- * Do you believe me now that the Acer and Mips boxes are nearly the same ? :-)
- * FIXME: Remove or merge some of the mappings.
- */
-map0_magnum4000:
-		.word  	8			# no. wired TLB entries
-		.word	0			# dummy
-
-MAPDATA(0xffffffffe1000000, 0x03ffc013, 0x00000001, PM_256K)	# 0
-MAPDATA(0xffffffffe0000000, 0x02000017, 0x00000001, PM_64K)	# 1 local I/O
-MAPDATA(0xffffffffe0100000, 0x03c00017, 0x00000001, PM_4K)	# 2 IRQ source
-MAPDATA(0xffffffffe0200000, 0x01800017, 0x01804017, PM_1M)	# 3 local video ctrl
-MAPDATA(0xffffffffe0400000, 0x01808017, 0x0180c017, PM_1M)	# 4 ext. video ctrl
-MAPDATA(0xffffffffe0800000, 0x01000017, 0x01010017, PM_4M)	# 5 local video mem.
-MAPDATA(0xffffffffe2000000, 0x02400017, 0x02440017, PM_16M)	# 6 ISA I/O and mem.
-MAPDATA(0xffffffffffffe000, 0x00000001, 0x0001ffd7, PM_4K)	# 7 PCR
-
-/*
- * The RM200 doesn't need any wired entries.
- */
-map0_sni_rm200_pci:
-		.word  	0			# no. wired TLB entries
-		.word	0			# dummy
X 
X /*
X  * This buffer is reserved for the use of the cache error handler.
diff -u --recursive --new-file v2.3.8/linux/arch/mips/kernel/init_task.c linux/arch/mips/kernel/init_task.c
--- v2.3.8/linux/arch/mips/kernel/init_task.c	Fri May  8 00:13:23 1998
+++ linux/arch/mips/kernel/init_task.c	Fri Jun 25 17:40:12 1999
@@ -9,7 +9,7 @@
X static struct files * init_fd_array[NR_OPEN] = { NULL, };
X static struct files_struct init_files = INIT_FILES;
X static struct signal_struct init_signals = INIT_SIGNALS;
-struct mm_struct init_mm = INIT_MM;
+struct mm_struct init_mm = INIT_MM(init_mm);
X 
X /*
X  * Initial task structure.
@@ -21,4 +21,6 @@
X  *
X  * The things we do for performance..
X  */
-union task_union init_task_union __attribute__((__section__(".text"))) = { INIT_TASK };
+union task_union init_task_union
+	__attribute__((__section__(".text"))) =
+		{ INIT_TASK(init_task_union.task) };
diff -u --recursive --new-file v2.3.8/linux/arch/mips/kernel/irix5sys.h linux/arch/mips/kernel/irix5sys.h
--- v2.3.8/linux/arch/mips/kernel/irix5sys.h	Tue Oct 20 13:52:54 1998
+++ linux/arch/mips/kernel/irix5sys.h	Fri Jun 25 17:40:12 1999
@@ -1,4 +1,4 @@
-/* $Id: irix5sys.h,v 1.2 1998/08/17 10:16:25 ralf Exp $
+/* $Id: irix5sys.h,v 1.2 1998/08/25 09:14:39 ralf Exp $
X  *
X  * irix5sys.h: 32-bit IRIX5 ABI system call table.
X  *
diff -u --recursive --new-file v2.3.8/linux/arch/mips/kernel/irixelf.c linux/arch/mips/kernel/irixelf.c
--- v2.3.8/linux/arch/mips/kernel/irixelf.c	Thu Jun  3 23:15:29 1999
+++ linux/arch/mips/kernel/irixelf.c	Sat Jun 26 18:03:31 1999
@@ -1,4 +1,5 @@
-/*
+/* $Id: irixelf.c,v 1.17 1999/06/17 13:25:45 ralf Exp $
+ *
X  * irixelf.c: Code to load IRIX ELF executables which conform to
X  *            the MIPS ABI.
X  *
@@ -307,7 +308,7 @@
X 		return 0xffffffff;
X 	}
X 
-	file = current->files->fd[elf_exec_fileno];
+	file = fget(elf_exec_fileno);
X 
X 	eppnt = elf_phdata;
X 	for(i=0; i<interp_elf_ex->e_phnum; i++, eppnt++) {
@@ -365,6 +366,7 @@
X 	}
X 
X 	/* Now use mmap to map the library into memory. */
+	fput(file);
X 	sys_close(elf_exec_fileno);
X 	if(error < 0 && error > -1024) {
X #ifdef DEBUG_ELF
@@ -612,8 +614,9 @@
X 	unsigned int load_addr, elf_bss, elf_brk;
X 	unsigned int elf_entry, interp_load_addr = 0;
X 	unsigned int start_code, end_code, end_data, elf_stack;
-	int elf_exec_fileno, retval, has_interp, has_ephdr, i;
+	int elf_exec_fileno, retval, has_interp, has_ephdr, size, i;
X 	char *elf_interpreter;
+	struct file *file;
X 	mm_segment_t old_fs;
X 	
X 	load_addr = 0;
@@ -629,17 +632,15 @@
X #endif
X 
X 	/* Now read in all of the header information */
-	elf_phdata = (struct elf_phdr *) kmalloc(elf_ex.e_phentsize * 
-						 elf_ex.e_phnum, GFP_KERNEL);
+	size = elf_ex.e_phentsize * elf_ex.e_phnum;
+	elf_phdata = (struct elf_phdr *) kmalloc(size, GFP_KERNEL);
X 	if (elf_phdata == NULL)
X 		return -ENOMEM;
X 	
-	retval = read_exec(bprm->dentry, elf_ex.e_phoff, (char *) elf_phdata,
-			   elf_ex.e_phentsize * elf_ex.e_phnum, 1);
-	if (retval < 0) {
-		kfree (elf_phdata);
-		return retval;
-	}
+	retval = read_exec(bprm->dentry, elf_ex.e_phoff,
+	                   (char *) elf_phdata, size, 1);
+	if (retval < 0)
+		goto out_phdata;
X 	
X #ifdef DEBUG_ELF
X 	dump_phdrs(elf_phdata, elf_ex.e_phnum);
@@ -664,12 +665,10 @@
X 
X 	elf_bss = 0;
X 	elf_brk = 0;
-	elf_exec_fileno = open_dentry(bprm->dentry, O_RDONLY);
-
-	if (elf_exec_fileno < 0) {
-		kfree (elf_phdata);
-		return elf_exec_fileno;
-	}
+	retval = open_dentry(bprm->dentry, O_RDONLY);
+	if (retval < 0)
+		goto out_phdata;
+	file = fget(elf_exec_fileno = retval);
X 	
X 	elf_stack = 0xffffffff;
X 	elf_interpreter = NULL;
@@ -681,40 +680,26 @@
X 	                                   &interpreter_dentry,
X 					   &interp_elf_ex, elf_phdata, bprm,
X 					   elf_ex.e_phnum);
-	if(retval) {
-		kfree(elf_phdata);
-		sys_close(elf_exec_fileno);
-		return retval;
-	}
+	if(retval)
+		goto out_file;
X 	
X 	if(elf_interpreter) {
X 		retval = verify_irix_interpreter(&interp_elf_ex);
-		if(retval) {
-			kfree(elf_interpreter);
-			kfree(elf_phdata);
-			sys_close(elf_exec_fileno);
-			return retval;
-		}
+		if(retval)
+			goto out_interp;
X 	}
X 	
X 	/* OK, we are done with that, now set up the arg stuff,
X 	 * and then start this sucker up.
X 	 */
-	if (!bprm->sh_bang) {
-		if (!bprm->p) {
-			if(elf_interpreter) {
-			      kfree(elf_interpreter);
-			}
-			kfree (elf_phdata);
-			sys_close(elf_exec_fileno);
-			return -E2BIG;
-		}
-	}
+	retval = -E2BIG;
+	if (!bprm->sh_bang && !bprm->p)
+		goto out_interp;
X 	
X 	/* Flush all traces of the currently running executable */
X 	retval = flush_old_exec(bprm);
X 	if (retval)
-		return retval;
+		goto out_interp;
X 
X 	/* OK, This is the point of no return */
X 	current->mm->end_data = 0;
@@ -727,7 +712,7 @@
X 	 * change some of these later.
X 	 */
X 	current->mm->rss = 0;
-	bprm->p = setup_arg_pages(bprm->p, bprm);
+	setup_arg_pages(bprm);
X 	current->mm->start_stack = bprm->p;
X 	
X 	/* At this point, we assume that the image should be loaded at
@@ -736,8 +721,7 @@
X 	old_fs = get_fs();
X 	set_fs(get_ds());
X 	
-	map_executable(current->files->fd[elf_exec_fileno], elf_phdata,
-		       elf_ex.e_phnum, &elf_stack, &load_addr,
+	map_executable(file, elf_phdata, elf_ex.e_phnum, &elf_stack, &load_addr,
X 		       &start_code, &elf_bss, &end_code, &end_data, &elf_brk);
X 
X 	if(elf_interpreter) {
@@ -757,6 +741,7 @@
X 	set_fs(old_fs);
X 	
X 	kfree(elf_phdata);
+	fput(file);
X 	sys_close(elf_exec_fileno);
X 	current->personality = PER_IRIX32;
X 
@@ -797,12 +782,12 @@
X 	padzero(elf_bss);
X 
X #ifdef DEBUG_ELF
-	printk("(start_brk) %08lx\n" , current->mm->start_brk);
-	printk("(end_code) %08lx\n" , current->mm->end_code);
-	printk("(start_code) %08lx\n" , current->mm->start_code);
-	printk("(end_data) %08lx\n" , current->mm->end_data);
-	printk("(start_stack) %08lx\n" , current->mm->start_stack);
-	printk("(brk) %08lx\n" , current->mm->brk);
+	printk("(start_brk) %lx\n" , (long) current->mm->start_brk);
+	printk("(end_code) %lx\n" , (long) current->mm->end_code);
+	printk("(start_code) %lx\n" , (long) current->mm->start_code);
+	printk("(end_data) %lx\n" , (long) current->mm->end_data);
+	printk("(start_stack) %lx\n" , (long) current->mm->start_stack);
+	printk("(brk) %lx\n" , (long) current->mm->brk);
X #endif
X 
X #if 0 /* XXX No fucking way dude... */
@@ -819,6 +804,17 @@
X 	if (current->flags & PF_PTRACED)
X 		send_sig(SIGTRAP, current, 0);
X 	return 0;
+
+out_interp:
+	if(elf_interpreter) {
+	      kfree(elf_interpreter);
+	}
+out_file:
+	fput(file);
+	sys_close(elf_exec_fileno);
+out_phdata:
+	kfree (elf_phdata);
+	return retval;
X }
X 
X static int load_irix_binary(struct linux_binprm * bprm, struct pt_regs * regs)
@@ -834,9 +830,8 @@
X /* This is really simpleminded and specialized - we are loading an
X  * a.out library that is given an ELF header.
X  */
-static inline int do_load_irix_library(int fd)
+static inline int do_load_irix_library(struct file *file)
X {
-	struct file * file;
X 	struct elfhdr elf_ex;
X 	struct elf_phdr *elf_phdata  =  NULL;
X 	struct dentry *dentry;
@@ -849,14 +844,12 @@
X 	int i,j, k;
X 
X 	len = 0;
-	file = current->files->fd[fd];
+	if (!file->f_op)
+		return -EACCES;
X 	dentry = file->f_dentry;
X 	inode = dentry->d_inode;
X 	elf_bss = 0;
X 	
-	if (!file || !file->f_op)
-		return -EACCES;
-
X 	/* Seek to the beginning of the file. */
X 	if (file->f_op->llseek) {
X 		if ((error = file->f_op->llseek(file, 0, 0)) != 0)
@@ -933,10 +926,15 @@
X 
X static int load_irix_library(int fd)
X {
-	int retval;
+	int retval = -EACCES;
+	struct file *file;
X 
X 	MOD_INC_USE_COUNT;
-	retval = do_load_irix_library(fd);
+	file = fget(fd);
+	if (file) {
+		retval = do_load_irix_library(file);
+		fput(file);
+	}
X 	MOD_DEC_USE_COUNT;
X 	return retval;
X }
@@ -977,9 +975,12 @@
X 			return -ENOEXEC;
X 		}
X 
-	filp = current->files->fd[fd];
-	if(!filp || !filp->f_op) {
+	filp = fget(fd);
+	if (!filp)
+		return -EACCES;
+	if(!filp->f_op) {
X 		printk("irix_mapelf: Bogon filp!\n");
+		fput(file);
X 		return -EACCES;
X 	}
X 
@@ -997,6 +998,7 @@
X 
X 		if(retval != (hp->p_vaddr & 0xfffff000)) {
X 			printk("irix_mapelf: do_mmap fails with %d!\n", retval);
+			fput(file);
X 			return retval;
X 		}
X 	}
@@ -1004,6 +1006,7 @@
X #ifdef DEBUG_ELF
X 	printk("irix_mapelf: Success, returning %08lx\n", user_phdrp->p_vaddr);
X #endif
+	fput(file);
X 	return user_phdrp->p_vaddr;
X }
X 
@@ -1101,10 +1104,10 @@
X #undef DUMP_SEEK
X 
X #define DUMP_WRITE(addr, nr)	\
-	if (!dump_write(&file, (addr), (nr))) \
+	if (!dump_write(file, (addr), (nr))) \
X 		goto close_coredump;
X #define DUMP_SEEK(off)	\
-	if (!dump_seek(&file, (off))) \
+	if (!dump_seek(file, (off))) \
X 		goto close_coredump;
X /* Actual dumper.
X  *
@@ -1115,7 +1118,7 @@
X static int irix_core_dump(long signr, struct pt_regs * regs)
X {
X 	int has_dumped = 0;
-	struct file file;
+	struct file *file;
X 	struct dentry *dentry;
X 	struct inode *inode;
X 	mm_segment_t fs;
@@ -1184,26 +1187,28 @@
X 	
X 	fs = get_fs();
X 	set_fs(KERNEL_DS);
+
X 	memcpy(corefile,"core.", 5);
X #if 0
X 	memcpy(corefile+5,current->comm,sizeof(current->comm));
X #else
X 	corefile[4] = '\0';
X #endif
-	dentry = open_namei(corefile, O_CREAT | 2 | O_TRUNC | O_NOFOLLOW, 0600);
-	if (IS_ERR(dentry)) {
-		inode = NULL;
+	file = filp_open(corefile, O_CREAT | 2 | O_TRUNC | O_NOFOLLOW, 0600);
+	if (IS_ERR(file))
X 		goto end_coredump;
-	}
+	dentry = file->f_dentry;
X 	inode = dentry->d_inode;
+	if (inode->i_nlink > 1)
+		goto close_coredump;	/* multiple links - don't dump */
+
X 	if (!S_ISREG(inode->i_mode))
-		goto end_coredump;
+		goto close_coredump;
X 	if (!inode->i_op || !inode->i_op->default_file_ops)
-		goto end_coredump;
-	if (init_private_file(&file, dentry, 3))
-		goto end_coredump;
-	if (!file.f_op->write)
X 		goto close_coredump;
+	if (!file->f_op->write)
+		goto close_coredump;
+
X 	has_dumped = 1;
X 	current->flags |= PF_DUMPCORE;
X 
@@ -1339,7 +1344,7 @@
X 	}
X 
X 	for(i = 0; i < numnote; i++)
-		if (!writenote(¬es[i], &file))
+		if (!writenote(¬es[i], file))
X 			goto close_coredump;
X 	
X 	set_fs(fs);
@@ -1361,19 +1366,17 @@
X 		DUMP_WRITE((void *)addr, len);
X 	}
X 
-	if ((off_t) file.f_pos != offset) {
+	if ((off_t) file->f_pos != offset) {
X 		/* Sanity check. */
-		printk("elf_core_dump: file.f_pos (%ld) != offset (%ld)\n",
-		       (off_t) file.f_pos, offset);
+		printk("elf_core_dump: file->f_pos (%ld) != offset (%ld)\n",
+		       (off_t) file->f_pos, offset);
X 	}
X 
X  close_coredump:
-	if (file.f_op->release)
-		file.f_op->release(inode, &file);
+	filp_close(file, NULL);
X 
X  end_coredump:
X 	set_fs(fs);
-	dput(dentry);
X #ifndef CONFIG_BINFMT_ELF
X 	MOD_DEC_USE_COUNT;
X #endif
diff -u --recursive --new-file v2.3.8/linux/arch/mips/kernel/irixinv.c linux/arch/mips/kernel/irixinv.c
--- v2.3.8/linux/arch/mips/kernel/irixinv.c	Tue Oct 20 13:52:54 1998
+++ linux/arch/mips/kernel/irixinv.c	Fri Jun 25 17:40:12 1999
@@ -5,7 +5,7 @@
X  *
X  * Miguel de Icaza, 1997.
X  *
- * $Id: irixinv.c,v 1.3 1998/03/27 08:53:40 ralf Exp $
+ * $Id: irixinv.c,v 1.3 1998/04/05 11:23:51 ralf Exp $
X  */
X #include <linux/mm.h>
X #include <linux/init.h>
diff -u --recursive --new-file v2.3.8/linux/arch/mips/kernel/irixioctl.c linux/arch/mips/kernel/irixioctl.c
--- v2.3.8/linux/arch/mips/kernel/irixioctl.c	Sat May  8 11:14:01 1999
+++ linux/arch/mips/kernel/irixioctl.c	Fri Jun 25 17:40:12 1999
@@ -1,4 +1,4 @@
-/* $Id: irixioctl.c,v 1.4 1998/03/04 12:17:41 ralf Exp $
+/* $Id: irixioctl.c,v 1.6 1999/02/06 05:12:56 adevries Exp $
X  * irixioctl.c: A fucking mess...
X  *
X  * Copyright (C) 1996 David S. Miller (d...@engr.sgi.com)
@@ -11,6 +11,7 @@
X #include <linux/smp.h>
X #include <linux/smp_lock.h>
X #include <linux/tty.h>
+#include <linux/file.h>
X 
X #include <asm/uaccess.h>
X #include <asm/ioctl.h>
@@ -33,15 +34,13 @@
X {
X 	struct file *filp;
X 
-	file = fcheck(fd);
-	if(!file)
+	if(!(filp = fcheck(fd)))
X 		return ((struct tty_struct *) 0);
X 	if(filp->private_data) {
X 		struct tty_struct *ttyp = (struct tty_struct *) filp->private_data;
X 
-		if(ttyp->magic == TTY_MAGIC) {
+		if(ttyp->magic == TTY_MAGIC)
X 			return ttyp;
-		}
X 	}
X 	return ((struct tty_struct *) 0);
X }
diff -u --recursive --new-file v2.3.8/linux/arch/mips/kernel/irixsig.c linux/arch/mips/kernel/irixsig.c
--- v2.3.8/linux/arch/mips/kernel/irixsig.c	Sat May 15 15:05:35 1999
+++ linux/arch/mips/kernel/irixsig.c	Fri Jun 25 17:40:12 1999
@@ -3,7 +3,7 @@
X  *
X  * Copyright (C) 1996 David S. Miller (d...@engr.sgi.com)
X  *
- * $Id: irixsig.c,v 1.11 1998/03/26 07:39:09 ralf Exp $
+ * $Id: irixsig.c,v 1.11 1999/06/17 13:25:46 ralf Exp $
X  */
X 
X #include <linux/kernel.h>
@@ -666,7 +666,7 @@
X 			    int options, struct rusage *ru)
X {
X 	int flag, retval;
-	DECLARE_WAITQUEUE(wait,current);
+	DECLARE_WAITQUEUE(wait, current);
X 	struct task_struct *p;
X 
X 	lock_kernel();
diff -u --recursive --new-file v2.3.8/linux/arch/mips/kernel/irq.c linux/arch/mips/kernel/irq.c
--- v2.3.8/linux/arch/mips/kernel/irq.c	Wed Dec 23 09:44:40 1998
+++ linux/arch/mips/kernel/irq.c	Fri Jun 25 17:40:12 1999
@@ -1,4 +1,4 @@
-/* $Id: irq.c,v 1.13 1998/05/28 03:17:55 ralf Exp $
+/* $Id: irq.c,v 1.15 1999/02/25 21:50:49 tsbogend Exp $
X  *
X  * This file is subject to the terms and conditions of the GNU General Public
X  * License.  See the file "COPYING" in the main directory of this archive
@@ -12,6 +12,7 @@
X #include <linux/errno.h>
X #include <linux/init.h>
X #include <linux/kernel_stat.h>
+#include <linux/module.h>
X #include <linux/signal.h>
X #include <linux/sched.h>
X #include <linux/types.h>
@@ -27,9 +28,21 @@
X #include <asm/irq.h>
X #include <asm/mipsregs.h>
X #include <asm/system.h>
+#include <asm/sni.h>
X 
-unsigned char cache_21 = 0xff;
-unsigned char cache_A1 = 0xff;
+/*
+ * This contains the irq mask for both 8259A irq controllers, it's an
+ * int so we can deal with the third PIC in some systems like the RM300.
+ * (XXX This is broken for big endian.)
+ */
+static unsigned int cached_irq_mask = 0xffff;
+
+#define __byte(x,y) (((unsigned char *)&(y))[x])
+#define __word(x,y) (((unsigned short *)&(y))[x])
+#define __long(x,y) (((unsigned int *)&(y))[x])
+
+#define cached_21       (__byte(0,cached_irq_mask))
+#define cached_A1       (__byte(1,cached_irq_mask))
X 
X unsigned int local_bh_count[NR_CPUS];
X unsigned int local_irq_count[NR_CPUS];
@@ -39,31 +52,23 @@
X  * (un)mask_irq, disable_irq() and enable_irq() only handle (E)ISA and
X  * PCI devices.  Other onboard hardware needs specific routines.
X  */
-static inline void mask_irq(unsigned int irq_nr)
+static inline void mask_irq(unsigned int irq)
X {
-	unsigned char mask;
-
-	mask = 1 << (irq_nr & 7);
-	if (irq_nr < 8) {
-		cache_21 |= mask;
-		outb(cache_21,0x21);
+	cached_irq_mask |= 1 << irq;
+	if (irq & 8) {
+		outb(cached_A1, 0xa1);
X 	} else {
-		cache_A1 |= mask;
-		outb(cache_A1,0xA1);
+		outb(cached_21, 0x21);
X 	}
X }
X 
-static inline void unmask_irq(unsigned int irq_nr)
+static inline void unmask_irq(unsigned int irq)
X {
-	unsigned char mask;
-
-	mask = ~(1 << (irq_nr & 7));
-	if (irq_nr < 8) {
-		cache_21 &= mask;
-		outb(cache_21,0x21);
+	cached_irq_mask &= ~(1 << irq);
+	if (irq & 8) {
+		outb(cached_A1, 0xa1);
X 	} else {
-		cache_A1 &= mask;
-		outb(cache_A1,0xA1);
+		outb(cached_21, 0x21);
X 	}
X }
X 
@@ -84,13 +89,11 @@
X 	restore_flags(flags);
X }
X 
-/*
- * Pointers to the low-level handlers: first the general ones, then the
- * fast ones, then the bad ones.
- */
-extern void interrupt(void);
-
-static struct irqaction *irq_action[32] = {
+static struct irqaction *irq_action[NR_IRQS] = {
+	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
X 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
X 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
X 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -122,6 +125,59 @@
X 
X atomic_t __mips_bh_counter;
X 
+static inline void i8259_mask_and_ack_irq(int irq)
+{
+	cached_irq_mask |= 1 << irq;
+
+	if (irq & 8) {
+		inb(0xa1);
+		outb(cached_A1, 0xa1);
+		outb(0x62, 0x20);		/* Specific EOI to cascade */
+                outb(0x20, 0xa0);
+        } else {
+		inb(0x21);
+		outb(cached_21, 0x21);
+		outb(0x20, 0x20);
+        }
+}
+
+asmlinkage void i8259_do_irq(int irq, struct pt_regs *regs)
+{
+	struct irqaction *action;
+	int do_random, cpu;
+
+	cpu = smp_processor_id();
+	hardirq_enter(cpu);
+
+	if (irq >= 16)
+		goto out;
+
+	i8259_mask_and_ack_irq(irq);
+
+	kstat.irqs[cpu][irq]++;
+
+	action = *(irq + irq_action);
+	if (!action)
+		goto out;
+
+	if (!(action->flags & SA_INTERRUPT))
+		__sti();
+	action = *(irq + irq_action);
+	do_random = 0;
+       	do {
+		do_random |= action->flags;
+		action->handler(irq, action->dev_id, regs);
+		action = action->next;
+       	} while (action);
+	if (do_random & SA_SAMPLE_RANDOM)
+		add_interrupt_randomness(irq);
+	__cli();
+	unmask_irq (irq);
+
+out:
+	hardirq_exit(cpu);
+}
+
X /*
X  * do_IRQ handles IRQ's that have been installed without the
X  * SA_INTERRUPT flag: it uses the full signal-handling return
@@ -135,23 +191,9 @@
X 	int do_random, cpu;
X 
X 	cpu = smp_processor_id();
-	irq_enter(cpu, irq);
+	hardirq_enter(cpu);
X 	kstat.irqs[cpu][irq]++;
X 
-	/*
-	 * mask and ack quickly, we don't want the irq controller
-	 * thinking we're snobs just because some other CPU has
-	 * disabled global interrupts (we have already done the
-	 * INT_ACK cycles, it's too late to try to pretend to the
-	 * controller that we aren't taking the interrupt).
-	 *
-	 * Commented out because we've already done this in the
-	 * machinespecific part of the handler.  It's reasonable to
-	 * do this here in a highlevel language though because that way
-	 * we could get rid of a good part of duplicated code ...
-	 */
-        /* mask_and_ack_irq(irq); */
-
X 	action = *(irq + irq_action);
X 	if (action) {
X 		if (!(action->flags & SA_INTERRUPT))
@@ -165,21 +207,14 @@
X         	} while (action);
X 		if (do_random & SA_SAMPLE_RANDOM)
X 			add_interrupt_randomness(irq);
-		unmask_irq (irq);
X 		__cli();
X 	}
-	irq_exit(cpu, irq);
+	hardirq_exit(cpu);
X 
X 	/* unmasking and bottom half handling is done magically for us. */
X }
X 
-/*
- * Used only for setup of PC style interrupts and therefore still
- * called setup_x86_irq.  Later on I'll provide a machine specific
- * function with similar purpose.  Idea is to put all interrupts
- * in a single table and differenciate them just by number.
- */
-int setup_x86_irq(int irq, struct irqaction * new)
+int i8259_setup_irq(int irq, struct irqaction * new)
X {
X 	int shared = 0;
X 	struct irqaction *old, **p;
@@ -216,11 +251,15 @@
X 	return 0;
X }
X 
+/*
+ * Request_interrupt and free_interrupt ``sort of'' handle interrupts of
+ * non i8259 devices.  They will have to be replaced by architecture
+ * specific variants.  For now we still use this as broken as it is because
+ * it used to work ...
+ */
X int request_irq(unsigned int irq, 
X 		void (*handler)(int, void *, struct pt_regs *),
-		unsigned long irqflags, 
-		const char * devname,
-		void *dev_id)
+		unsigned long irqflags, const char * devname, void *dev_id)
X {
X 	int retval;
X 	struct irqaction * action;
@@ -241,7 +280,7 @@
X 	action->next = NULL;
X 	action->dev_id = dev_id;
X 
-	retval = setup_x86_irq(irq, action);
+	retval = i8259_setup_irq(irq, action);
X 
X 	if (retval)
X 		kfree(action);
@@ -275,7 +314,7 @@
X 
X unsigned long probe_irq_on (void)
X {
-	unsigned int i, irqs = 0, irqmask;
+	unsigned int i, irqs = 0;
X 	unsigned long delay;
X 
X 	/* first, enable any unassigned (E)ISA irqs */
@@ -291,19 +330,17 @@
X 		/* about 100ms delay */;
X 
X 	/* now filter out any obviously spurious interrupts */
-	irqmask = (((unsigned int)cache_A1)<<8) | (unsigned int)cache_21;
-	return irqs & ~irqmask;
+	return irqs & ~cached_irq_mask;
X }
X 
X int probe_irq_off (unsigned long irqs)
X {
-	unsigned int i, irqmask;
+	unsigned int i;
X 
-	irqmask = (((unsigned int)cache_A1)<<8) | (unsigned int)cache_21;
X #ifdef DEBUG
X 	printk("probe_irq_off: irqs=0x%04x irqmask=0x%04x\n", irqs, irqmask);
X #endif
-	irqs &= irqmask;
+	irqs &= cached_irq_mask;
X 	if (!irqs)
X 		return 0;
X 	i = ffz(~irqs);
@@ -314,13 +351,36 @@
X 
X int (*irq_cannonicalize)(int irq);
X 
-static int i8259a_irq_cannonicalize(int irq)
+static int i8259_irq_cannonicalize(int irq)
X {
X 	return ((irq == 2) ? 9 : irq);
X }
X 
+__initfunc(static void i8259_init(void))
+{
+	/* Init master interrupt controller */
+	outb(0x11, 0x20); /* Start init sequence */
+	outb(0x00, 0x21); /* Vector base */
+	outb(0x04, 0x21); /* edge tiggered, Cascade (slave) on IRQ2 */
+	outb(0x01, 0x21); /* Select 8086 mode */
+	outb(0xff, 0x21); /* Mask all */
+        
+	/* Init slave interrupt controller */
+	outb(0x11, 0xa0); /* Start init sequence */
+	outb(0x08, 0xa1); /* Vector base */
+	outb(0x02, 0xa1); /* edge triggered, Cascade (slave) on IRQ2 */
+	outb(0x01, 0xa1); /* Select 8086 mode */
+	outb(0xff, 0xa1); /* Mask all */
+
+	outb(cached_A1, 0xa1);
+	outb(cached_21, 0x21);
+}
+
X __initfunc(void init_IRQ(void))
X {
-	irq_cannonicalize = i8259a_irq_cannonicalize;
+	irq_cannonicalize = i8259_irq_cannonicalize;
+	/* i8259_init(); */
X 	irq_setup();
X }
+
+EXPORT_SYMBOL(irq_cannonicalize);
diff -u --recursive --new-file v2.3.8/linux/arch/mips/kernel/mips_ksyms.c linux/arch/mips/kernel/mips_ksyms.c
--- v2.3.8/linux/arch/mips/kernel/mips_ksyms.c	Tue Oct 20 13:52:54 1998
+++ linux/arch/mips/kernel/mips_ksyms.c	Fri Jun 25 17:40:12 1999
@@ -1,4 +1,4 @@
-/* $Id: mips_ksyms.c,v 1.12 1998/09/16 22:50:41 ralf Exp $
+/* $Id: mips_ksyms.c,v 1.19 1999/04/11 18:37:55 harald Exp $
X  *
X  * Export MIPS-specific functions needed for loadable modules.
X  *
@@ -13,6 +13,7 @@
X #include <linux/string.h>
X #include <linux/mm.h>
X #include <linux/interrupt.h>
+#include <asm/irq.h>
X #include <linux/in6.h>
X #include <linux/pci.h>
X 
@@ -50,23 +51,25 @@
X EXPORT_SYMBOL_NOVERS(strnlen);
X EXPORT_SYMBOL_NOVERS(strrchr);
X EXPORT_SYMBOL_NOVERS(strtok);
+EXPORT_SYMBOL_NOVERS(strpbrk);
X 
X EXPORT_SYMBOL(clear_page);
X EXPORT_SYMBOL(__mips_bh_counter);
X EXPORT_SYMBOL(local_bh_count);
X EXPORT_SYMBOL(local_irq_count);
-//EXPORT_SYMBOL(enable_irq);
-//EXPORT_SYMBOL(disable_irq);
+EXPORT_SYMBOL(enable_irq);
+EXPORT_SYMBOL(disable_irq);
+EXPORT_SYMBOL(kernel_thread);
X 
X /*
X  * Userspace access stuff.
X  */
-EXPORT_SYMBOL(__copy_user);
-EXPORT_SYMBOL(__bzero);
-EXPORT_SYMBOL(__strncpy_from_user_nocheck_asm);
-EXPORT_SYMBOL(__strncpy_from_user_asm);
-EXPORT_SYMBOL(__strlen_user_nocheck_asm);
-EXPORT_SYMBOL(__strlen_user_asm);
+EXPORT_SYMBOL_NOVERS(__copy_user);
+EXPORT_SYMBOL_NOVERS(__bzero);
+EXPORT_SYMBOL_NOVERS(__strncpy_from_user_nocheck_asm);
+EXPORT_SYMBOL_NOVERS(__strncpy_from_user_asm);
+EXPORT_SYMBOL_NOVERS(__strlen_user_nocheck_asm);
+EXPORT_SYMBOL_NOVERS(__strlen_user_asm);
X 
X 
X /* Networking helper routines. */
@@ -77,6 +80,10 @@
X  */
X EXPORT_SYMBOL(flush_page_to_ram);
X EXPORT_SYMBOL(flush_cache_all);
+EXPORT_SYMBOL(dma_cache_wback_inv);
+EXPORT_SYMBOL(dma_cache_inv);
+
+EXPORT_SYMBOL(invalid_pte_table);
X 
X /*
X  * Base address of ports for Intel style I/O.
@@ -106,12 +113,12 @@
X int unregister_fpe(void (*handler)(struct pt_regs *regs, unsigned int fcr31));
X 
X #ifdef CONFIG_MIPS_FPE_MODULE
-EXPORT_SYMBOL(force_sig);
X EXPORT_SYMBOL(__compute_return_epc);
X EXPORT_SYMBOL(register_fpe);
X EXPORT_SYMBOL(unregister_fpe);
X #endif
X 
-#if CONFIG_PCI
-EXPORT_SYMBOL(pci_devices);
SHAR_EOF
true || echo 'restore of patch-2.3.9 failed'
fi
echo 'End of  part 06'
echo 'File patch-2.3.9 is continued in part 07'
echo 07 > _shar_seq_.tmp
exit 0
#!/bin/sh
# this is part 08 of a 26 - part archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file patch-2.3.9 continued
if test ! -r _shar_seq_.tmp; then
        echo 'Please unpack part 1 first!'
        exit 1
fi
(read Scheck
if test "$Scheck" != 08; then
        echo Please unpack part "$Scheck" next!
        exit 1
 else
        exit 0
 fi
) < _shar_seq_.tmp || exit 1
if test ! -f _shar_wnt_.tmp; then
echo 'x - still skipping patch-2.3.9'
else
echo 'x - continuing with patch-2.3.9'
sed 's/^X//' << 'SHAR_EOF' >> 'patch-2.3.9' &&
--- v2.3.8/linux/arch/mips/kernel/traps.c	Tue Jan  5 11:13:56 1999
+++ linux/arch/mips/kernel/traps.c	Fri Jun 25 17:40:12 1999
@@ -1,4 +1,4 @@
-/* $Id: traps.c,v 1.20 1998/10/14 20:26:26 ralf Exp $
+/* $Id: traps.c,v 1.20 1999/06/13 16:30:34 ralf Exp $
X  *
X  * This file is subject to the terms and conditions of the GNU General Public
X  * License.  See the file "COPYING" in the main directory of this archive
@@ -202,17 +202,16 @@
X 	 * Assume it would be too dangerous to continue ...
X 	 */
X 	force_sig(SIGBUS, current);
+show_regs(regs); while(1);
X }
X 
X void do_ibe(struct pt_regs *regs)
X {
-show_regs(regs); while(1);
X 	ibe_board_handler(regs);
X }
X 
X void do_dbe(struct pt_regs *regs)
X {
-show_regs(regs); while(1);
X 	dbe_board_handler(regs);
X }
X 
@@ -325,7 +324,7 @@
X 	/*
X 	 * (A short test says that IRIX 5.3 sends SIGTRAP for all break
X 	 * insns, even for break codes that indicate arithmetic failures.
-	 * Wiered ...)
+	 * Weird ...)
X 	 */
X 	force_sig(SIGTRAP, current);
X }
@@ -465,8 +464,8 @@
X extern asmlinkage void r2300_restore_fp_context(struct sigcontext *sc);
X extern asmlinkage void r6000_restore_fp_context(struct sigcontext *sc);
X 
-extern asmlinkage void r4xx0_resume(void *tsk);
-extern asmlinkage void r2300_resume(void *tsk);
+extern asmlinkage void *r4xx0_resume(void *last, void *next);
+extern asmlinkage void *r2300_resume(void *last, void *next);
X 
X __initfunc(void trap_init(void))
X {
diff -u --recursive --new-file v2.3.8/linux/arch/mips/kernel/unaligned.c linux/arch/mips/kernel/unaligned.c
--- v2.3.8/linux/arch/mips/kernel/unaligned.c	Tue Oct 20 13:52:54 1998
+++ linux/arch/mips/kernel/unaligned.c	Fri Jun 25 17:40:12 1999
@@ -7,7 +7,7 @@
X  *
X  * Copyright (C) 1996, 1998 by Ralf Baechle
X  *
- * $Id: unaligned.c,v 1.5 1998/08/17 13:57:44 ralf Exp $
+ * $Id: unaligned.c,v 1.5 1999/05/01 22:40:39 ralf Exp $
X  *
X  * This file contains exception handler for address error exception with the
X  * special capability to execute faulting instructions in software.  The
@@ -17,7 +17,7 @@
X  * Putting data to unaligned addresses is a bad practice even on Intel where
X  * only the performance is affected.  Much worse is that such code is non-
X  * portable.  Due to several programs that die on MIPS due to alignment
- * problems I decieded to implement this handler anyway though I originally
+ * problems I decided to implement this handler anyway though I originally
X  * didn't intend to do this at all for user code.
X  *
X  * For now I enable fixing of address errors by default to make life easier.
@@ -140,7 +140,7 @@
X 		goto sigbus;
X 
X 	/*
-	 * The remaining opcodes are the ones that are really of interrest.
+	 * The remaining opcodes are the ones that are really of interest.
X 	 */
X 	case lh_op:
X 		check_axs(pc, addr, 2);
diff -u --recursive --new-file v2.3.8/linux/arch/mips/lib/Makefile linux/arch/mips/lib/Makefile
--- v2.3.8/linux/arch/mips/lib/Makefile	Tue Oct 20 13:52:54 1998
+++ linux/arch/mips/lib/Makefile	Fri Jun 25 17:40:12 1999
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.12 1998/05/28 03:17:57 ralf Exp $
+# $Id: Makefile,v 1.9 1999/01/04 16:03:50 ralf Exp $
X #
X # Makefile for MIPS-specific library files..
X #
@@ -10,7 +10,7 @@
X 
X L_TARGET = lib.a
X L_OBJS	= csum_partial.o csum_partial_copy.o dump_tlb.o floppy-std.o \
-	  floppy-no.o ide-std.o ide-no.o rtc-std.o rtc-no.o memset.o memcpy.o \
-	  strlen_user.o strncpy_user.o tags.o watch.o
+	  floppy-no.o ide-std.o ide-no.o kbd-std.o kbd-no.o rtc-std.o \
+	  rtc-no.o memset.o memcpy.o strlen_user.o strncpy_user.o watch.o
X 
X include $(TOPDIR)/Rules.make
diff -u --recursive --new-file v2.3.8/linux/arch/mips/lib/csum_partial.S linux/arch/mips/lib/csum_partial.S
--- v2.3.8/linux/arch/mips/lib/csum_partial.S	Tue Oct 20 13:52:54 1998
+++ linux/arch/mips/lib/csum_partial.S	Fri Jun 25 17:40:12 1999
@@ -1,4 +1,4 @@
-/* $Id: csum_partial.S,v 1.3 1998/05/07 14:17:45 ralf Exp $
+/* $Id: csum_partial.S,v 1.2 1998/05/07 23:44:01 ralf Exp $
X  *
X  * This file is subject to the terms and conditions of the GNU General Public
X  * License.  See the file "COPYING" in the main directory of this archive
diff -u --recursive --new-file v2.3.8/linux/arch/mips/lib/csum_partial_copy.c linux/arch/mips/lib/csum_partial_copy.c
--- v2.3.8/linux/arch/mips/lib/csum_partial_copy.c	Tue Oct 20 13:52:54 1998
+++ linux/arch/mips/lib/csum_partial_copy.c	Fri Jun 25 17:40:12 1999
@@ -14,7 +14,7 @@
X  *		as published by the Free Software Foundation; either version
X  *		2 of the License, or (at your option) any later version.
X  *
- * $Id: csum_partial_copy.c,v 1.2 1998/09/16 13:29:32 ralf Exp $
+ * $Id: csum_partial_copy.c,v 1.2 1998/09/19 19:16:17 ralf Exp $
X  */
X #include <net/checksum.h>
X #include <linux/types.h>
diff -u --recursive --new-file v2.3.8/linux/arch/mips/lib/floppy-std.c linux/arch/mips/lib/floppy-std.c
--- v2.3.8/linux/arch/mips/lib/floppy-std.c	Tue Oct 20 13:52:54 1998
+++ linux/arch/mips/lib/floppy-std.c	Fri Jun 25 17:40:12 1999
@@ -1,4 +1,4 @@
-/* $Id: floppy-std.c,v 1.2 1998/05/28 03:17:57 ralf Exp $
+/* $Id: floppy-std.c,v 1.3 1998/10/28 12:38:13 ralf Exp $
X  *
X  * This file is subject to the terms and conditions of the GNU General Public
X  * License.  See the file "COPYING" in the main directory of this archive
@@ -12,7 +12,6 @@
X #include <linux/init.h>
X #include <linux/ioport.h>
X #include <linux/sched.h>
-#include <linux/kbdcntrlr.h>
X #include <linux/kernel.h>
X #include <linux/linkage.h>
X #include <linux/types.h>
diff -u --recursive --new-file v2.3.8/linux/arch/mips/lib/ide-no.c linux/arch/mips/lib/ide-no.c
--- v2.3.8/linux/arch/mips/lib/ide-no.c	Thu May 13 11:00:08 1999
+++ linux/arch/mips/lib/ide-no.c	Fri Jun 25 17:40:13 1999
@@ -1,4 +1,4 @@
-/* $Id: ide-no.c,v 1.2 1998/05/28 03:17:57 ralf Exp $
+/* $Id: ide-no.c,v 1.3 1999/06/17 13:25:49 ralf Exp $
X  *
X  * This file is subject to the terms and conditions of the GNU General Public
X  * License.  See the file "COPYING" in the main directory of this archive
@@ -7,13 +7,13 @@
X  * Stub IDE routines to keep Linux from crashing on machine which don't
X  * have IDE like the Indy.
X  *
- * Copyright (C) 1998 by Ralf Baechle
+ * Copyright (C) 1998, 1999 by Ralf Baechle
X  */
X #include <linux/hdreg.h>
X #include <linux/kernel.h>
+#include <linux/ide.h>
X #include <asm/hdreg.h>
X #include <asm/ptrace.h>
-#include <asm/ide.h>
X 
X static int no_ide_default_irq(ide_ioreg_t base)
X {
@@ -25,17 +25,15 @@
X 	return 0;
X }
X 
-static void no_ide_init_hwif_ports (	hw_regs_t *hw,
-					ide_ioreg_t data_port,
-					ide_ioreg_t ctrl_port,
-					int *irq)
+static void no_ide_init_hwif_ports (hw_regs_t *hw, ide_ioreg_t data_port,
+                                    ide_ioreg_t ctrl_port, int *irq)
X {
X }
X 
X static int no_ide_request_irq(unsigned int irq,
-                                void (*handler)(int,void *, struct pt_regs *),
-                                unsigned long flags, const char *device,
-                                void *dev_id)
+                              void (*handler)(int,void *, struct pt_regs *),
+                              unsigned long flags, const char *device,
+                              void *dev_id)
X {
X 	panic("no_no_ide_request_irq called - shouldn't happen");
X }			
diff -u --recursive --new-file v2.3.8/linux/arch/mips/lib/ide-std.c linux/arch/mips/lib/ide-std.c
--- v2.3.8/linux/arch/mips/lib/ide-std.c	Thu May 13 11:00:08 1999
+++ linux/arch/mips/lib/ide-std.c	Fri Jun 25 17:40:13 1999
@@ -1,5 +1,4 @@
-/*
- * include/asm-mips/types.h
+/* $Id: ide-std.c,v 1.4 1999/06/17 13:25:49 ralf Exp $
X  *
X  * This file is subject to the terms and conditions of the GNU General Public
X  * License.  See the file "COPYING" in the main directory of this archive
@@ -7,12 +6,14 @@
X  *
X  * IDE routines for typical pc-like standard configurations.
X  *
- * Copyright (C) 1998 by Ralf Baechle
+ * Copyright (C) 1998, 1999 by Ralf Baechle
X  */
+#include <linux/sched.h>
+#include <linux/ide.h>
+#include <linux/ioport.h>
X #include <linux/hdreg.h>
X #include <asm/ptrace.h>
X #include <asm/hdreg.h>
-#include <asm/ide.h>
X 
X static int std_ide_default_irq(ide_ioreg_t base)
X {
@@ -42,10 +43,8 @@
X 	}
X }
X 
-static void std_ide_init_hwif_ports (	hw_regs_t *hw,
-					ide_ioreg_t data_port,
-					ide_ioreg_t ctrl_port,
-					int *irq)
+static void std_ide_init_hwif_ports (hw_regs_t *hw, ide_ioreg_t data_port,
+                                     ide_ioreg_t ctrl_port, int *irq)
X {
X 	ide_ioreg_t reg = data_port;
X 	int i;
diff -u --recursive --new-file v2.3.8/linux/arch/mips/lib/kbd-no.c linux/arch/mips/lib/kbd-no.c
--- v2.3.8/linux/arch/mips/lib/kbd-no.c	Wed Dec 31 16:00:00 1969
+++ linux/arch/mips/lib/kbd-no.c	Fri Jun 25 17:40:13 1999
@@ -0,0 +1,63 @@
+/* $Id: kbd-no.c,v 1.1 1998/10/28 12:38:14 ralf Exp $
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Stub keyboard and psaux routines to keep Linux from crashing on machines
+ * without a keyboard.
+ *
+ * Copyright (C) 1998 by Ralf Baechle
+ */
+#include <linux/sched.h>
+#include <asm/keyboard.h>
+
+static void no_kbd_request_region(void)
+{
+	/* No I/O ports are being used on the Indy.  */
+}
+
+static int no_kbd_request_irq(void (*handler)(int, void *, struct pt_regs *))
+{
+	return -ENODEV;
+}
+
+static int no_aux_request_irq(void (*handler)(int, void *, struct pt_regs *))
+{
+	return -ENODEV;
+}
+
+static void no_aux_free_irq(void)
+{
+}
+
+static unsigned char no_kbd_read_input(void)
+{
+	return 0;
+}
+
+static void no_kbd_write_output(unsigned char val)
+{
+}
+
+static void no_kbd_write_command(unsigned char val)
+{
+}
+
+static unsigned char no_kbd_read_status(void)
+{
+	return 0;
+}
+
+struct kbd_ops no_kbd_ops = {
+	no_kbd_request_region,
+	no_kbd_request_irq,
+
+	no_aux_request_irq,
+	no_aux_free_irq,
+
+	no_kbd_read_input,
+	no_kbd_write_output,
+	no_kbd_write_command,
+	no_kbd_read_status
+};
diff -u --recursive --new-file v2.3.8/linux/arch/mips/lib/kbd-std.c linux/arch/mips/lib/kbd-std.c
--- v2.3.8/linux/arch/mips/lib/kbd-std.c	Wed Dec 31 16:00:00 1969
+++ linux/arch/mips/lib/kbd-std.c	Fri Jun 25 17:40:13 1999
@@ -0,0 +1,81 @@
+/* $Id: kbd-std.c,v 1.2 1999/06/11 14:29:45 ralf Exp $
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Routines for standard PC style keyboards accessible via I/O ports.
+ *
+ * Copyright (C) 1998, 1999 by Ralf Baechle
+ */
+#include <linux/ioport.h>
+#include <linux/sched.h>
+#include <linux/pc_keyb.h>
+#include <asm/keyboard.h>
+#include <asm/io.h>
+
+#define KEYBOARD_IRQ 1
+#define AUX_IRQ 12
+
+static void std_kbd_request_region(void)
+{
+	request_region(0x60, 16, "keyboard");
+}
+
+static int std_kbd_request_irq(void (*handler)(int, void *, struct pt_regs *))
+{
+	return request_irq(KEYBOARD_IRQ, handler, 0, "keyboard", NULL);
+}
+
+static int std_aux_request_irq(void (*handler)(int, void *, struct pt_regs *))
+{
+	return request_irq(AUX_IRQ, handler, 0, "PS/2 Mouse", NULL);
+}
+
+static void std_aux_free_irq(void)
+{
+	free_irq(AUX_IRQ, NULL);
+}
+
+static unsigned char std_kbd_read_input(void)
+{
+	return inb(KBD_DATA_REG);
+}
+
+static void std_kbd_write_output(unsigned char val)
+{
+	int status;
+
+	do {
+ status = inb(KBD_CNTL_REG);
+	} while (status & KBD_STAT_IBF);
+	outb(val, KBD_DATA_REG);
+}
+
+static void std_kbd_write_command(unsigned char val)
+{
+	int status;
+
+	do {
+ status = inb(KBD_CNTL_REG);
+	} while (status & KBD_STAT_IBF);
+	outb(val, KBD_CNTL_REG);
+}
+
+static unsigned char std_kbd_read_status(void)
+{
+	return inb(KBD_STATUS_REG);
+}
+
+struct kbd_ops std_kbd_ops = {
+	std_kbd_request_region,
+	std_kbd_request_irq,
+
+	std_aux_request_irq,
+	std_aux_free_irq,
+
+	std_kbd_read_input,
+	std_kbd_write_output,
+	std_kbd_write_command,
+	std_kbd_read_status
+};
diff -u --recursive --new-file v2.3.8/linux/arch/mips/lib/memcpy.S linux/arch/mips/lib/memcpy.S
--- v2.3.8/linux/arch/mips/lib/memcpy.S	Tue Oct 20 13:52:54 1998
+++ linux/arch/mips/lib/memcpy.S	Fri Jun 25 17:40:13 1999
@@ -3,7 +3,7 @@
X  * License.  See the file "COPYING" in the main directory of this archive
X  * for more details.
X  *
- * $Id: memcpy.S,v 1.4 1998/07/03 14:05:33 ralf Exp $
+ * $Id: memcpy.S,v 1.3 1998/07/10 01:14:49 ralf Exp $
X  *
X  * Unified implementation of memcpy, memmove and the __copy_user backend.
X  * For __rmemcpy and memmove an exception is always a kernel bug, therefore
diff -u --recursive --new-file v2.3.8/linux/arch/mips/lib/memset.S linux/arch/mips/lib/memset.S
--- v2.3.8/linux/arch/mips/lib/memset.S	Tue Oct 20 13:52:54 1998
+++ linux/arch/mips/lib/memset.S	Fri Jun 25 17:40:13 1999
@@ -7,7 +7,7 @@
X  *
X  * Copyright (C) 1998 by Ralf Baechle
X  *
- * $Id: memset.S,v 1.2 1998/04/25 17:01:45 ralf Exp $
+ * $Id: memset.S,v 1.1 1998/05/04 09:12:54 ralf Exp $
X  */
X #include <asm/asm.h>
X #include <asm/offset.h>
diff -u --recursive --new-file v2.3.8/linux/arch/mips/lib/strlen_user.S linux/arch/mips/lib/strlen_user.S
--- v2.3.8/linux/arch/mips/lib/strlen_user.S	Tue Oct 20 13:52:54 1998
+++ linux/arch/mips/lib/strlen_user.S	Fri Jun 25 17:40:13 1999
@@ -7,7 +7,7 @@
X  *
X  * Copyright (c) 1996, 1998 by Ralf Baechle
X  *
- * $Id: strlen_user.S,v 1.3 1998/05/03 11:13:45 ralf Exp $
+ * $Id: strlen_user.S,v 1.2 1998/05/04 09:12:54 ralf Exp $
X  */
X #include <asm/asm.h>
X #include <asm/offset.h>
diff -u --recursive --new-file v2.3.8/linux/arch/mips/lib/strncpy_user.S linux/arch/mips/lib/strncpy_user.S
--- v2.3.8/linux/arch/mips/lib/strncpy_user.S	Tue Oct 20 13:52:54 1998
+++ linux/arch/mips/lib/strncpy_user.S	Fri Jun 25 17:40:13 1999
@@ -7,7 +7,7 @@
X  *
X  * Copyright (c) 1996 by Ralf Baechle
X  *
- * $Id: strncpy_user.S,v 1.3 1998/05/03 11:13:45 ralf Exp $
+ * $Id: strncpy_user.S,v 1.2 1998/05/04 09:12:54 ralf Exp $
X  */
X #include <linux/errno.h>
X #include <asm/asm.h>
diff -u --recursive --new-file v2.3.8/linux/arch/mips/lib/tags.c linux/arch/mips/lib/tags.c
--- v2.3.8/linux/arch/mips/lib/tags.c	Thu Jun 26 12:33:37 1997
+++ linux/arch/mips/lib/tags.c	Wed Dec 31 16:00:00 1969
@@ -1,75 +0,0 @@
-/*
- *  linux/arch/mips/lib/tags.c
- *
- *  Copyright (C) 1996  Stoned Elipot
- */
-#include <linux/stddef.h>
-#include <linux/kernel.h>
-#include <linux/string.h>
-#include <asm/addrspace.h>
-#include <asm/bootinfo.h>
-
-/*
- * Parse the tags present in upper memory to find out
- * a pecular one.
- *
- * Parameter: type - tag type to find
- * 
- * returns  : NULL  - failure
- *            !NULL - pointer on the tag structure found 
- */
-tag *
-bi_TagFind(enum bi_tag type)
-{
-	tag* t = (tag*)(mips_memory_upper - sizeof(tag));
-
-	while((t->tag != tag_dummy) && (t->tag != type))
-		t = (tag*)(NEXTTAGPTR(t));
-
-	if (t->tag == tag_dummy)		/* tag not found */
-		return (tag*)NULL;
-
-	return t;
-}
-
-/*
- * Snarf from the tag list in memory end some tags needed
- * before the kernel reachs setup_arch()
- *
- * add yours here if you want to, but *beware*: the kernel var
- * that will hold the values you want to snarf have to be
- * in .data section of the kernel, so initialized in to whatever
- * value in the kernel's sources.
- */
-void bi_EarlySnarf(void)
-{
-	tag* atag;
-  
-	/* for wire_mappings() */
-	atag = bi_TagFind(tag_machgroup);
-	if (atag)
-		memcpy(&mips_machgroup, TAGVALPTR(atag), atag->size);
-	else {
-		/* useless for boxes without text video mode but....*/
-		panic("machine group not specified by bootloader");
-	}
-
-	atag = bi_TagFind(tag_machtype);
-	if (atag)
-		memcpy(&mips_machtype, TAGVALPTR(atag), atag->size);
-	else {
-		/* useless for boxes without text video mode but....*/
-		panic("machine type not specified by bootloader");
-	}
-
-	/* for tlbflush() */
-	atag = bi_TagFind(tag_tlb_entries);
-	if (atag)
-		memcpy(&mips_tlb_entries, TAGVALPTR(atag), atag->size);
-	else {
-		/* useless for boxes without text video mode but....*/
-		panic("number of TLB entries not specified by bootloader");
-	}
-
-	return;
-}
diff -u --recursive --new-file v2.3.8/linux/arch/mips/lib/watch.S linux/arch/mips/lib/watch.S
--- v2.3.8/linux/arch/mips/lib/watch.S	Thu Jun 26 12:33:37 1997
+++ linux/arch/mips/lib/watch.S	Fri Jun 25 17:40:13 1999
@@ -1,6 +1,6 @@
X /*
X  * Kernel debug stuff to use the Watch registers.
- * Usefull to find stack overflows, dangeling pointers etc.
+ * Useful to find stack overflows, dangling pointers etc.
X  *
X  * This file is subject to the terms and conditions of the GNU General Public
X  * License.  See the file "COPYING" in the main directory of this archive
diff -u --recursive --new-file v2.3.8/linux/arch/mips/mm/Makefile linux/arch/mips/mm/Makefile
--- v2.3.8/linux/arch/mips/mm/Makefile	Sat Aug 16 09:51:07 1997
+++ linux/arch/mips/mm/Makefile	Fri Jun 25 17:40:13 1999
@@ -15,4 +15,8 @@
X O_OBJS   += umap.o
X endif
X 
+ifdef CONFIG_BAGET_MIPS
+O_OBJS   += umap.o
+endif
+
X include $(TOPDIR)/Rules.make
diff -u --recursive --new-file v2.3.8/linux/arch/mips/mm/andes.c linux/arch/mips/mm/andes.c
--- v2.3.8/linux/arch/mips/mm/andes.c	Tue Oct 20 13:52:54 1998
+++ linux/arch/mips/mm/andes.c	Fri Jun 25 17:40:13 1999
@@ -1,4 +1,4 @@
-/* $Id: andes.c,v 1.6 1998/10/16 19:22:42 ralf Exp $
+/* $Id: andes.c,v 1.6 1999/01/04 16:03:52 ralf Exp $
X  *
X  * andes.c: MMU and cache operations for the R10000 (ANDES).
X  *
diff -u --recursive --new-file v2.3.8/linux/arch/mips/mm/fault.c linux/arch/mips/mm/fault.c
--- v2.3.8/linux/arch/mips/mm/fault.c	Tue Oct 20 13:52:54 1998
+++ linux/arch/mips/mm/fault.c	Fri Jun 25 17:40:13 1999
@@ -1,4 +1,4 @@
-/* $Id: fault.c,v 1.12 1998/10/19 21:27:37 ralf Exp $
+/* $Id: fault.c,v 1.9 1999/01/04 16:03:53 ralf Exp $
X  *
X  * This file is subject to the terms and conditions of the GNU General Public
X  * License.  See the file "COPYING" in the main directory of this archive
diff -u --recursive --new-file v2.3.8/linux/arch/mips/mm/init.c linux/arch/mips/mm/init.c
--- v2.3.8/linux/arch/mips/mm/init.c	Tue Oct 20 13:52:54 1998
+++ linux/arch/mips/mm/init.c	Tue Jun 29 09:22:08 1999
@@ -1,4 +1,4 @@
-/* $Id: init.c,v 1.13 1998/10/16 19:22:42 ralf Exp $
+/* $Id: init.c,v 1.13 1999/05/01 22:40:40 ralf Exp $
X  *
X  * This file is subject to the terms and conditions of the GNU General Public
X  * License.  See the file "COPYING" in the main directory of this archive
@@ -35,12 +35,6 @@
X #endif
X #include <asm/mmu_context.h>
X 
-/*
- * Define this to effectivly disable the userpage colouring shit.
- */
-#define CONF_GIVE_A_SHIT_ABOUT_COLOURS
-
-extern void deskstation_tyne_dma_init(void);
X extern void show_net_buffers(void);
X 
X void __bad_pte_kernel(pmd_t *pmd)
@@ -59,7 +53,7 @@
X {
X 	pte_t *page;
X 
-	page = (pte_t *) __get_free_page(GFP_KERNEL);
+	page = (pte_t *) __get_free_page(GFP_USER);
X 	if (pmd_none(*pmd)) {
X 		if (page) {
X 			clear_page((unsigned long)page);
@@ -126,6 +120,7 @@
X 	case CPU_R4400SC:
X 	case CPU_R4400MC:
X 		order = 3;
+		break;
X 	default:
X 		order = 0;
X 	}
@@ -137,6 +132,7 @@
X 	pg = MAP_NR(empty_zero_page);
X 	while(pg < MAP_NR(empty_zero_page) + (1 << order)) {
X 		set_bit(PG_reserved, &mem_map[pg].flags);
+		atomic_set(&mem_map[pg].count, 0);
X 		pg++;
X 	}
X 
@@ -243,83 +239,6 @@
X 	return pte_mkdirty(mk_pte(page, PAGE_SHARED));
X }
X 
-#ifdef __SMP__
-spinlock_t user_page_lock = SPIN_LOCK_UNLOCKED;
-#endif
-struct upcache user_page_cache[8] __attribute__((aligned(32)));
-static unsigned long user_page_order;
-unsigned long user_page_colours;
-
-unsigned long get_user_page_slow(int which)
-{
-	unsigned long chunk;
-	struct upcache *up = &user_page_cache[0];
-	struct page *p, *res;
-	int i;
-
-	do {
-		chunk = __get_free_pages(GFP_KERNEL, user_page_order);
-	} while(chunk==0);
-
-	p = mem_map + MAP_NR(chunk);
-	res = p + which;
-	spin_lock(&user_page_lock);
-	for (i=user_page_colours; i>=0; i--,p++,up++,chunk+=PAGE_SIZE) {
-		atomic_set(&p->count, 1);
-		p->age = PAGE_INITIAL_AGE;
-
-		if (p != res) {
-			if(up->count < USER_PAGE_WATER) {
-				p->next = up->list;
-				up->list = p;
-				up->count++;
-			} else
-				free_pages(chunk, 0);
-		}
-	}
-	spin_unlock(&user_page_lock);
-
-	return page_address(res);
-}
-
-static inline void user_page_setup(void)
-{
-	unsigned long assoc = 0;
-	unsigned long dcache_log, icache_log, cache_log;
-	unsigned long config = read_32bit_cp0_register(CP0_CONFIG);
-
-	switch(mips_cputype) {
-	case CPU_R4000SC:
-	case CPU_R4000MC:
-	case CPU_R4400SC:
-	case CPU_R4400MC:
-		cache_log = 3;	/* => 32k, sucks  */
-		break;
-
-        case CPU_R4600:                 /* two way set associative caches?  */
-        case CPU_R4700:
-        case CPU_R5000:
-        case CPU_NEVADA:
-		assoc = 1;
-		/* fall through */
-	default:
-		/* use bigger cache  */
-		icache_log = (config >> 9) & 7;
-		dcache_log = (config >> 6) & 7;
-		if (dcache_log > icache_log)
-			cache_log = dcache_log;
-		else
-			cache_log = icache_log;
-	}
-
-#ifdef CONF_GIVE_A_SHIT_ABOUT_COLOURS
-	cache_log = assoc = 0;
-#endif
-
-	user_page_order = cache_log - assoc;
-	user_page_colours = (1 << (cache_log - assoc)) - 1;
-}
-
X void show_mem(void)
X {
X 	int i, free = 0, total = 0, reserved = 0;
@@ -346,7 +265,6 @@
X 	printk("%d pages swap cached\n",cached);
X 	printk("%ld pages in page table cache\n",pgtable_cache_size);
X 	printk("%d free pages\n", free);
-	show_buffers();
X #ifdef CONFIG_NET
X 	show_net_buffers();
X #endif
@@ -375,8 +293,9 @@
X #endif
X 
X 	end_mem &= PAGE_MASK;
-	max_mapnr = num_physpages = MAP_NR(end_mem);
+	max_mapnr = MAP_NR(end_mem);
X 	high_memory = (void *)end_mem;
+	num_physpages = 0;
X 
X 	/* mark usable pages in the mem_map[] */
X 	start_mem = PAGE_ALIGN(start_mem);
@@ -384,15 +303,12 @@
X 	for(tmp = MAP_NR(start_mem);tmp < max_mapnr;tmp++)
X 		clear_bit(PG_reserved, &mem_map[tmp].flags);
X 
-
-#ifdef CONFIG_SGI
X 	prom_fixup_mem_map(start_mem, (unsigned long)high_memory);
-#endif
X 
X 	for (tmp = PAGE_OFFSET; tmp < end_mem; tmp += PAGE_SIZE) {
X 		/*
X 		 * This is only for PC-style DMA.  The onboard DMA
-		 * of Jazz and Tyne machines is completly different and
+		 * of Jazz and Tyne machines is completely different and
X 		 * not handled via a flag in mem_map_t.
X 		 */
X 		if (tmp >= MAX_DMA_ADDRESS)
@@ -406,6 +322,7 @@
X 				datapages++;
X 			continue;
X 		}
+		num_physpages++;
X 		atomic_set(&mem_map[MAP_NR(tmp)].count, 1);
X #ifdef CONFIG_BLK_DEV_INITRD
X 		if (!initrd_start || (tmp < initrd_start || tmp >=
@@ -423,9 +340,6 @@
X 		max_mapnr << (PAGE_SHIFT-10),
X 		codepages << (PAGE_SHIFT-10),
X 		datapages << (PAGE_SHIFT-10));
-
-	/* Initialize allocator for colour matched mapped pages.  */
-	user_page_setup();
X }
X 
X extern char __init_begin, __init_end;
@@ -433,7 +347,9 @@
X void free_initmem(void)
X {
X 	unsigned long addr;
-        
+
+	prom_free_prom_memory ();
+    
X 	addr = (unsigned long)(&__init_begin);
X 	for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) {
X 		mem_map[MAP_NR(addr)].flags &= ~(1 << PG_reserved);
@@ -452,7 +368,7 @@
X 	val->totalram = 0;
X 	val->sharedram = 0;
X 	val->freeram = nr_free_pages << PAGE_SHIFT;
-	val->bufferram = buffermem;
+	val->bufferram = atomic_read(&buffermem);
X 	while (i-- > 0)  {
X 		if (PageReserved(mem_map+i))
X 			continue;
diff -u --recursive --new-file v2.3.8/linux/arch/mips/mm/loadmmu.c linux/arch/mips/mm/loadmmu.c
--- v2.3.8/linux/arch/mips/mm/loadmmu.c	Tue Oct 20 13:52:54 1998
+++ linux/arch/mips/mm/loadmmu.c	Fri Jun 25 17:40:13 1999
@@ -3,7 +3,7 @@
X  *
X  * Copyright (C) 1996 David S. Miller (d...@engr.sgi.com)
X  *
- * $Id: loadmmu.c,v 1.7 1998/03/27 08:53:41 ralf Exp $
+ * $Id: loadmmu.c,v 1.10 1999/06/17 13:25:51 ralf Exp $
X  */
X #include <linux/init.h>
X #include <linux/kernel.h>
@@ -31,6 +31,7 @@
X 
X /* DMA cache operations. */
X void (*dma_cache_wback_inv)(unsigned long start, unsigned long size);
+void (*dma_cache_wback)(unsigned long start, unsigned long size);
X void (*dma_cache_inv)(unsigned long start, unsigned long size);
X 
X /* TLB operations. */
@@ -53,7 +54,7 @@
X 
X int (*user_mode)(struct pt_regs *);
X 
-asmlinkage void (*resume)(void *tsk);
+asmlinkage void *(*resume)(void *last, void *next);
X 
X extern void ld_mmu_r2300(void);
X extern void ld_mmu_r4xx0(void);
@@ -66,6 +67,7 @@
X 	switch(mips_cputype) {
X 	case CPU_R2000:
X 	case CPU_R3000:
+	case CPU_R3000A:
X 		printk("Loading R[23]00 MMU routines.\n");
X 		ld_mmu_r2300();
X 		break;
diff -u --recursive --new-file v2.3.8/linux/arch/mips/mm/r2300.c linux/arch/mips/mm/r2300.c
--- v2.3.8/linux/arch/mips/mm/r2300.c	Tue Oct 20 13:52:54 1998
+++ linux/arch/mips/mm/r2300.c	Fri Jun 25 17:40:13 1999
@@ -1,8 +1,13 @@
-/* $Id: r2300.c,v 1.7 1998/10/16 19:22:43 ralf Exp $
- *
+/*
X  * r2300.c: R2000 and R3000 specific mmu/cache code.
X  *
X  * Copyright (C) 1996 David S. Miller (d...@engr.sgi.com)
+ *
+ * with a lot of changes to make this thing work for R3000s
+ * Copyright (C) 1998 Harald Koerfgen
+ * Copyright (C) 1998 Gleb Raiko & Vladimir Roganov
+ *
+ * $Id: r2300.c,v 1.8 1999/04/11 17:13:56 harald Exp $
X  */
X #include <linux/init.h>
X #include <linux/kernel.h>
@@ -11,12 +16,40 @@
X 
X #include <asm/page.h>
X #include <asm/pgtable.h>
+#include <asm/mmu_context.h>
X #include <asm/system.h>
X #include <asm/sgialib.h>
-#include <asm/mmu_context.h>
+#include <asm/mipsregs.h>
+#include <asm/io.h>
+/*
+ * Temporarily disabled
+ *
+#include <asm/wbflush.h>
+ */
+
+/*
+ * According to the paper written by D. Miller about Linux cache & TLB
+ * flush implementation, DMA/Driver coherence should be done at the 
+ * driver layer.  Thus, normally, we don't need flush dcache for R3000.
+ * Define this if driver does not handle cache consistency during DMA ops.
+ */
+#undef DO_DCACHE_FLUSH
+
+/*
+ *  Unified cache space description structure
+ */
+static struct cache_space {
+	unsigned long ca_flags;  /* Cache space access flags */
+	int           size;      /* Cache space size */
+} icache, dcache;
+
+#undef DEBUG_TLB
+#undef DEBUG_CACHE
X 
X extern unsigned long mips_tlb_entries;
X 
+#define NTLB_ENTRIES       64  /* Fixed on all R23000 variants... */
+
X /* page functions */
X void r2300_clear_page(unsigned long page)
X {
@@ -94,80 +127,425 @@
X 		 "I" (PAGE_SIZE));
X }
X 
-/* Cache operations. */
-static inline void r2300_flush_cache_all(void) { }
-static void r2300_flush_cache_mm(struct mm_struct *mm) { }
+__initfunc(static unsigned long size_cache(unsigned long ca_flags))
+{
+	unsigned long flags, status, dummy, size;
+	volatile unsigned long *p;
+
+	p = (volatile unsigned long *) KSEG0;
+
+	save_and_cli(flags);
+
+	/* isolate cache space */
+	write_32bit_cp0_register(CP0_STATUS, (ca_flags|flags)&~ST0_IEC);
+
+	*p = 0xa5a55a5a;
+	dummy = *p;
+	status = read_32bit_cp0_register(CP0_STATUS);
+
+	if (dummy != 0xa5a55a5a || (status & (1<<19))) {
+		size = 0;
+	} else {
+		for (size = 512; size <= 0x40000; size <<= 1)
+			*(p + size) = 0;
+		*p = -1;
+		for (size = 512; 
+		     (size <= 0x40000) && (*(p + size) == 0); 
+		     size <<= 1)
+			;
+		if (size > 0x40000)
+			size = 0;
+	}
+	restore_flags(flags);
+
+	return size * sizeof(*p);
+}
+
+__initfunc(static void probe_dcache(void))
+{
+	dcache.size = size_cache(dcache.ca_flags = ST0_DE);
+	printk("Data cache %dkb\n", dcache.size >> 10);
+}
+
+__initfunc(static void probe_icache(void))
+{
+	icache.size = size_cache(icache.ca_flags = ST0_DE|ST0_CE);
+	printk("Instruction cache %dkb\n", icache.size >> 10);
+}
+
+static inline unsigned long get_phys_page (unsigned long page,
+					   struct mm_struct *mm)
+{
+        page &= PAGE_MASK;
+	if (page >= KSEG0 && page < KSEG1) {
+		/*
+		 *  We already have physical address
+		 */
+		return page;
+	} else {
+		if (!mm) {
+			printk ("get_phys_page: vaddr without mm\n");
+			return 0;
+		} else {
+			/* 
+			 *  Find a physical page using mm_struct
+			 */
+			pgd_t *page_dir;
+			pmd_t *page_middle;
+			pte_t *page_table, pte;
+
+			unsigned long address = page;
+
+			page_dir = pgd_offset(mm, address);
+			if (pgd_none(*page_dir))
+				return 0; 
+			page_middle = pmd_offset(page_dir, address);
+			if (pmd_none(*page_middle))
+				return 0; 
+			page_table = pte_offset(page_middle, address);
+			pte = *page_table;
+			if (!pte_present(pte))
+				return 0; 
+			return pte_page(pte);
+	}
+	}
+}
+
+static inline void flush_cache_space_page(struct cache_space *space,
+					  unsigned long page)
+{
+	register unsigned long i, flags, size = space->size;
+	register volatile unsigned char *p = (volatile unsigned char*) page;
+
+#ifndef DO_DCACHE_FLUSH
+	if (space == &dcache)
+		return;
+#endif
+	if (size > PAGE_SIZE)
+		size = PAGE_SIZE;
+
+	save_and_cli(flags);
+
+	/* isolate cache space */
+	write_32bit_cp0_register(CP0_STATUS, (space->ca_flags|flags)&~ST0_IEC);
+
+	for (i = 0; i < size; i += 64) {
+		asm ( 	"sb\t$0,(%0)\n\t"
+			"sb\t$0,4(%0)\n\t"
+			"sb\t$0,8(%0)\n\t"
+			"sb\t$0,12(%0)\n\t"
+			"sb\t$0,16(%0)\n\t"
+			"sb\t$0,20(%0)\n\t"
+			"sb\t$0,24(%0)\n\t"
+			"sb\t$0,28(%0)\n\t"
+ 		        "sb\t$0,32(%0)\n\t"
+ 			"sb\t$0,36(%0)\n\t"
+ 			"sb\t$0,40(%0)\n\t"
+ 			"sb\t$0,44(%0)\n\t"
+ 			"sb\t$0,48(%0)\n\t"
+ 			"sb\t$0,52(%0)\n\t"
+ 			"sb\t$0,56(%0)\n\t"
+ 			"sb\t$0,60(%0)\n\t"
+			: : "r" (p) );
+		p += 64;
+	}
+
+	restore_flags(flags);
+}
+
+static inline void flush_cache_space_all(struct cache_space *space)
+{
+	unsigned long page = KSEG0;
+	int size = space->size;
+
+#ifndef DO_DCACHE_FLUSH
+	if (space == &dcache)
+		return;
+#endif
+	while(size > 0) { 
+		flush_cache_space_page(space, page);
+		page += PAGE_SIZE; size -= PAGE_SIZE;
+        }
+}
+
+static inline void r2300_flush_cache_all(void)
+{
+	flush_cache_space_all(&dcache);
+	flush_cache_space_all(&icache);
+}
+ 
+static void r2300_flush_cache_mm(struct mm_struct *mm)
+{
+	if(mm->context == 0) 
+		return;
+#ifdef DEBUG_CACHE
+		printk("cmm[%d]", (int)mm->context);
+#endif
+	/*
+	 *  This function is called not offen, so it looks
+	 *  enough good to flush all caches than scan mm_struct,
+	 *  count pages to flush (and, very probably, flush more
+	 *  than cache space size :-)
+ */
+	flush_cache_all();
+}
+
X static void r2300_flush_cache_range(struct mm_struct *mm,
X 				    unsigned long start,
X 				    unsigned long end)
X {
+	/*
+	 *  In general, we need to flush both i- & d- caches here.
+	 *  Optimization: if cache space is less than given range,
+	 *  it is more quickly to flush all cache than all pages in range.
+	 */
+
+	unsigned long page;
+	int icache_done = 0, dcache_done = 0;
+
+	if(mm->context == 0) 
+		return;
+#ifdef DEBUG_CACHE
+	printk("crange[%d]", (int)mm->context);
+#endif
+	if (end - start >= icache.size) {
+		flush_cache_space_all(&icache);
+		icache_done = 1;
+	}
+	if (end - start >= dcache.size) {
+		flush_cache_space_all(&dcache);
+		dcache_done = 1;
+	}
+	if (icache_done && dcache_done)
+		return;
+
+	for (page = start; page < end; page += PAGE_SIZE) {
+		unsigned long phys_page = get_phys_page(page, mm);
+		
+		if (phys_page) {
+			if (!icache_done) 
+				flush_cache_space_page(&icache, phys_page);
+			if (!dcache_done) 
+				flush_cache_space_page(&dcache, phys_page);
+		}
+	}
X }
X 
X static void r2300_flush_cache_page(struct vm_area_struct *vma,
X 				   unsigned long page)
X {
+	struct mm_struct *mm = vma->vm_mm;
+
+	if(mm->context == 0)
+		return;
+#ifdef DEBUG_CACHE
+	printk("cpage[%d,%08lx]", (int)mm->context, page);
+#endif
+	/*
+	 *  User changes page, so we need to check:
+         *     is icache page flush needed ?
+	 *  It looks we don't need to flush dcache,
+	 *  due it is write-transparent on R3000
+	 */
+	if (vma->vm_flags & VM_EXEC) {
+		unsigned long phys_page = get_phys_page(page, vma->vm_mm);
+		if (phys_page)
+			flush_cache_space_page(&icache, phys_page); 
+	}
X }
X 
X static void r2300_flush_page_to_ram(unsigned long page)
X {
-	/* XXX What we want to do here is perform a displacement
-	 * XXX flush because there are circumstances where you do
-	 * XXX indeed want to remove stale data from the cache.
-	 * XXX (DMA operations for example, where the cache cannot
-	 * XXX  "see" this data get changed.)
+	/*
+	 *  We need to flush both i- & d- caches :-(
X 	 */
+	unsigned long phys_page = get_phys_page(page, NULL);
+#ifdef DEBUG_CACHE
+	printk("cram[%08lx]", page);
+#endif
+	if (phys_page) {
+		flush_cache_space_page(&icache, phys_page);
+		flush_cache_space_page(&dcache, phys_page);
+	}
+}
+
+static void r3k_dma_cache_wback_inv(unsigned long start, unsigned long size)
+{
+	register unsigned long i, flags;
+	register volatile unsigned char *p = (volatile unsigned char*) start;
+
+/*
+ * Temporarily disabled
+	wbflush();
+	 */
+
+	/*
+	 * Invalidate dcache
+	 */
+	if (size < 64)
+		size = 64;
+
+	if (size > dcache.size)
+		size = dcache.size;
+
+	save_and_cli(flags);
+
+	/* isolate cache space */
+	write_32bit_cp0_register(CP0_STATUS, (ST0_DE|flags)&~ST0_IEC);
+
+	for (i = 0; i < size; i += 64) {
+		asm ( 	"sb\t$0,(%0)\n\t"
+			"sb\t$0,4(%0)\n\t"
+			"sb\t$0,8(%0)\n\t"
+			"sb\t$0,12(%0)\n\t"
+			"sb\t$0,16(%0)\n\t"
+			"sb\t$0,20(%0)\n\t"
+			"sb\t$0,24(%0)\n\t"
+			"sb\t$0,28(%0)\n\t"
+ 		        "sb\t$0,32(%0)\n\t"
+ 			"sb\t$0,36(%0)\n\t"
+ 			"sb\t$0,40(%0)\n\t"
+ 			"sb\t$0,44(%0)\n\t"
+ 			"sb\t$0,48(%0)\n\t"
+ 			"sb\t$0,52(%0)\n\t"
+ 			"sb\t$0,56(%0)\n\t"
+ 			"sb\t$0,60(%0)\n\t"
+			: : "r" (p) );
+		p += 64;
+	}
+
+	restore_flags(flags);
X }
X 
X static void r2300_flush_cache_sigtramp(unsigned long page)
X {
+	/*
+	 *  We need only flush i-cache here
+	 *
+	 *  This function receives virtual address (from signal.c),
+	 *  but this moment we have needed mm_struct in 'current'
+	 */
+	unsigned long phys_page = get_phys_page(page, current->mm);
+#ifdef DEBUG_CACHE
+		printk("csigtramp[%08lx]", page);
+#endif
+	if (phys_page)
+		flush_cache_space_page(&icache, phys_page);  
X }
X 
X /* TLB operations. */
X static inline void r2300_flush_tlb_all(void)
X {
X 	unsigned long flags;
+	unsigned long old_ctx;
X 	int entry;
X 
+#ifdef DEBUG_TLB
+	printk("[tlball]");
+#endif
+
X 	save_and_cli(flags);
+	old_ctx = (get_entryhi() & 0xfc0);
X 	write_32bit_cp0_register(CP0_ENTRYLO0, 0);
-	for(entry = 0; entry < mips_tlb_entries; entry++) {
-		write_32bit_cp0_register(CP0_INDEX, entry);
-		write_32bit_cp0_register(CP0_ENTRYHI, ((entry | 0x8) << 12));
+	for(entry = 0; entry < NTLB_ENTRIES; entry++) {
+		write_32bit_cp0_register(CP0_INDEX, entry << 8);
+		write_32bit_cp0_register(CP0_ENTRYHI, ((entry | 0x80000) << 12));
X 		__asm__ __volatile__("tlbwi");
X 	}
+	set_entryhi(old_ctx);
X 	restore_flags(flags);
X }
X 
X static void r2300_flush_tlb_mm(struct mm_struct *mm)
X {
+	if(mm->context != 0) {
+		unsigned long flags;
+
+#ifdef DEBUG_TLB
+		printk("[tlbmm<%d>]", mm->context);
+#endif
+		save_and_cli(flags);
+		get_new_mmu_context(mm, asid_cache);
X 	if(mm == current->mm)
-		r2300_flush_tlb_all();
+			set_entryhi(mm->context & 0xfc0);
+		restore_flags(flags);
+	}
X }
X 
X static void r2300_flush_tlb_range(struct mm_struct *mm, unsigned long start,
X 				  unsigned long end)
X {
+	if(mm->context != 0) {
+		unsigned long flags;
+		int size;
+
+#ifdef DEBUG_TLB
+		printk("[tlbrange<%02x,%08lx,%08lx>]", (mm->context & 0xfc0),
+		       start, end);
+#endif
+		save_and_cli(flags);
+		size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
+		if(size <= NTLB_ENTRIES) {
+			int oldpid = (get_entryhi() & 0xfc0);
+			int newpid = (mm->context & 0xfc0);
+
+			start &= PAGE_MASK;
+			end += (PAGE_SIZE - 1);
+			end &= PAGE_MASK;
+			while(start < end) {
+				int idx;
+
+				set_entryhi(start | newpid);
+				start += PAGE_SIZE;
+				tlb_probe();
+				idx = get_index();
+				set_entrylo0(0);
+				set_entryhi(KSEG0);
+				if(idx < 0)
+					continue;
+				tlb_write_indexed();
+			}
+			set_entryhi(oldpid);
+		} else {
+			get_new_mmu_context(mm, asid_cache);
X 	if(mm == current->mm)
-		r2300_flush_tlb_all();
+				set_entryhi(mm->context & 0xfc0);
+		}
+		restore_flags(flags);
+	}
X }
X 
X static void r2300_flush_tlb_page(struct vm_area_struct *vma, unsigned long page)
X {
-	if(vma->vm_mm == current->mm)
-		r2300_flush_tlb_all();
+	if(vma->vm_mm->context != 0) {
+		unsigned long flags;
+		int oldpid, newpid, idx;
+
+#ifdef DEBUG_TLB
+		printk("[tlbpage<%d,%08lx>]", vma->vm_mm->context, page);
+#endif
+		newpid = (vma->vm_mm->context & 0xfc0);
+		page &= PAGE_MASK;
+		save_and_cli(flags);
+		oldpid = (get_entryhi() & 0xfc0);
+		set_entryhi(page | newpid);
+		tlb_probe();
+		idx = get_index();
+		set_entrylo0(0);
+		set_entryhi(KSEG0);
+		if(idx < 0)
+			goto finish;
+		tlb_write_indexed();
+
+finish:
+		set_entryhi(oldpid);
+		restore_flags(flags);
+	}
X }
X 
X /* Load a new root pointer into the TLB. */
X static void r2300_load_pgd(unsigned long pg_dir)
X {
-	unsigned long flags;
-
-	save_and_cli(flags);
-	write_32bit_cp0_register(CP0_ENTRYHI, TLB_ROOT);
-	write_32bit_cp0_register(CP0_INDEX, 0);
-	write_32bit_cp0_register(CP0_ENTRYLO0, ((pg_dir >> 6) | 0x00e0));
-	__asm__ __volatile__("tlbwi");
-	restore_flags(flags);
X }
X 
X /*
@@ -199,17 +577,63 @@
X 		 "=r" (dummy2)
X 		:"r" ((unsigned long) invalid_pte_table),
X 		 "0" (page),
-		 "1" (USER_PTRS_PER_PGD/8));
+		 "1" (PAGE_SIZE/(sizeof(pmd_t)*8)));
X }
X 
X static void r2300_update_mmu_cache(struct vm_area_struct * vma,
X 				   unsigned long address, pte_t pte)
X {
-	r2300_flush_tlb_page(vma, address);
-	/*
-	 * FIXME: We should also reload a new entry into the TLB to
-	 * avoid unnecessary exceptions.
-	 */
+	unsigned long flags;
+	pgd_t *pgdp;
+	pmd_t *pmdp;
+	pte_t *ptep;
+	int idx, pid;
+
+	pid = (get_entryhi() & 0xfc0);
+
+#ifdef DEBUG_TLB
+	if((pid != (vma->vm_mm->context & 0xfc0)) || (vma->vm_mm->context == 0)) {
+		printk("update_mmu_cache: Wheee, bogus tlbpid mmpid=%d tlbpid=%d\n",
+		       (int) (vma->vm_mm->context & 0xfc0), pid);
+	}
+#endif
+
+	save_and_cli(flags);
+	address &= PAGE_MASK;
+	set_entryhi(address | (pid));
+	pgdp = pgd_offset(vma->vm_mm, address);
+	tlb_probe();
+	pmdp = pmd_offset(pgdp, address);
+	idx = get_index();
+	ptep = pte_offset(pmdp, address);
+	set_entrylo0(pte_val(*ptep));
+	set_entryhi(address | (pid));
+	if(idx < 0) {
+		tlb_write_random();
+#if 0
+		printk("[MISS]");
+#endif
+	} else {
+		tlb_write_indexed();
+#if 0
+		printk("[HIT]");
+#endif
+	}
+#if 0
+	if(!strcmp(current->comm, "args")) {
+		printk("<");
+		for(idx = 0; idx < NTLB_ENTRIES; idx++) {
+			set_index(idx);
+			tlb_read();
+			address = get_entryhi();
+			if((address & 0xfc0) != 0)
+				printk("[%08lx]", address);
+		}
+		printk(">\n");
+	}
+#endif
+	set_entryhi(pid);
+	restore_flags(flags);
X }
X 
X static void r2300_show_regs(struct pt_regs * regs)
@@ -248,6 +672,7 @@
X static void r2300_add_wired_entry(unsigned long entrylo0, unsigned long entrylo1,
X 				  unsigned long entryhi, unsigned long pagemask)
X {
+printk("r2300_add_wired_entry");
X         /*
X 	 * FIXME, to be done
X 	 */
@@ -255,14 +680,19 @@
X 
X static int r2300_user_mode(struct pt_regs *regs)
X {
-	return !(regs->cp0_status & 0x4);
+	return !(regs->cp0_status & ST0_KUP);
X }
X 
X __initfunc(void ld_mmu_r2300(void))
X {
+	printk("CPU revision is: %08x\n", read_32bit_cp0_register(CP0_PRID));
+
X 	clear_page = r2300_clear_page;
X 	copy_page = r2300_copy_page;
X 
+	probe_icache();
+	probe_dcache();
+
X 	flush_cache_all = r2300_flush_cache_all;
X 	flush_cache_mm = r2300_flush_cache_mm;
X 	flush_cache_range = r2300_flush_cache_range;
@@ -274,16 +704,19 @@
X 	flush_tlb_mm = r2300_flush_tlb_mm;
X 	flush_tlb_range = r2300_flush_tlb_range;
X 	flush_tlb_page = r2300_flush_tlb_page;
-	r3000_asid_setup();
+
+        dma_cache_wback_inv = r3k_dma_cache_wback_inv;
X 
X 	load_pgd = r2300_load_pgd;
X 	pgd_init = r2300_pgd_init;
X 	update_mmu_cache = r2300_update_mmu_cache;
+	r3000_asid_setup();
X 
X 	show_regs = r2300_show_regs;
X     
X         add_wired_entry = r2300_add_wired_entry;
X 
X 	user_mode = r2300_user_mode;
+
X 	flush_tlb_all();
X }
diff -u --recursive --new-file v2.3.8/linux/arch/mips/mm/r4xx0.c linux/arch/mips/mm/r4xx0.c
--- v2.3.8/linux/arch/mips/mm/r4xx0.c	Tue Oct 20 13:52:55 1998
+++ linux/arch/mips/mm/r4xx0.c	Fri Jun 25 17:40:13 1999
@@ -1,4 +1,4 @@
-/* $Id: r4xx0.c,v 1.30 1998/10/16 19:22:43 ralf Exp $
+/* $Id: r4xx0.c,v 1.22 1999/06/17 13:25:51 ralf Exp $
X  *
X  * This file is subject to the terms and conditions of the GNU General Public
X  * License.  See the file "COPYING" in the main directory of this archive
@@ -2172,6 +2172,12 @@
X 	}
X }
X 
+static void
+r4k_dma_cache_wback(unsigned long addr, unsigned long size)
+{
+	panic("r4k_dma_cache called - should not happen.\n");
+}
+
X /*
X  * While we're protected against bad userland addresses we don't care
X  * very much about what happens in that case.  Usually a segmentation
@@ -2652,6 +2658,7 @@
X 		break;
X 	}
X 	dma_cache_wback_inv = r4k_dma_cache_wback_inv_pc;
+	dma_cache_wback = r4k_dma_cache_wback;
X 	dma_cache_inv = r4k_dma_cache_inv_pc;
X }
X 
@@ -2735,6 +2742,7 @@
X 		break;
X 	}
X 	dma_cache_wback_inv = r4k_dma_cache_wback_inv_sc;
+	dma_cache_wback = r4k_dma_cache_wback;
X 	dma_cache_inv = r4k_dma_cache_inv_sc;
X }
X 
diff -u --recursive --new-file v2.3.8/linux/arch/mips/mm/r6000.c linux/arch/mips/mm/r6000.c
--- v2.3.8/linux/arch/mips/mm/r6000.c	Tue Oct 20 13:52:55 1998
+++ linux/arch/mips/mm/r6000.c	Fri Jun 25 17:40:13 1999
@@ -1,4 +1,4 @@
-/* $Id: r6000.c,v 1.6 1998/10/16 19:22:44 ralf Exp $
+/* $Id: r6000.c,v 1.6 1999/01/04 16:03:54 ralf Exp $
X  *
X  * r6000.c: MMU and cache routines for the R6000 processors.
X  *
diff -u --recursive --new-file v2.3.8/linux/arch/mips/mm/tfp.c linux/arch/mips/mm/tfp.c
--- v2.3.8/linux/arch/mips/mm/tfp.c	Tue Oct 20 13:52:55 1998
+++ linux/arch/mips/mm/tfp.c	Fri Jun 25 17:40:13 1999
@@ -1,4 +1,4 @@
-/* $Id: tfp.c,v 1.6 1998/10/16 19:22:44 ralf Exp $
+/* $Id: tfp.c,v 1.6 1999/01/04 16:03:55 ralf Exp $
X  *
X  * tfp.c: MMU and cache routines specific to the r8000 (TFP).
X  *
diff -u --recursive --new-file v2.3.8/linux/arch/mips/sgi/kernel/Makefile linux/arch/mips/sgi/kernel/Makefile
--- v2.3.8/linux/arch/mips/sgi/kernel/Makefile	Tue Oct 20 13:52:55 1998
+++ linux/arch/mips/sgi/kernel/Makefile	Fri Jun 25 17:40:13 1999
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.3 1998/06/25 20:19:17 ralf Exp $
+# $Id: Makefile,v 1.7 1999/05/07 18:00:16 ulfc Exp $
X # Makefile for the SGI specific kernel interface routines
X # under Linux.
X #
@@ -13,8 +13,11 @@
X .S.o:
X 	$(CC) $(CFLAGS) -c $< -o $*.o
X 
-OBJS  = indy_mc.o indy_sc.o indy_hpc.o indy_int.o indy_rtc.o system.o \
-	indy_timer.o indyIRQ.o reset.o setup.o time.o
+OBJS  = indy_mc.o indy_sc.o indy_hpc.o indy_int.o indy_rtc.o \
+        system.o indy_timer.o indyIRQ.o reset.o setup.o time.o
+ifdef CONFIG_SGI_PROM_CONSOLE
+OBJS += promcon.o
+endif
X 
X all: sgikern.a
X 
diff -u --recursive --new-file v2.3.8/linux/arch/mips/sgi/kernel/indyIRQ.S linux/arch/mips/sgi/kernel/indyIRQ.S
--- v2.3.8/linux/arch/mips/sgi/kernel/indyIRQ.S	Tue Oct 20 13:52:55 1998
+++ linux/arch/mips/sgi/kernel/indyIRQ.S	Fri Jun 25 17:40:13 1999
@@ -1,4 +1,4 @@
-/* $Id: indyIRQ.S,v 1.3 1998/03/21 22:39:53 ralf Exp $
+/* $Id: indyIRQ.S,v 1.3 1998/03/22 23:27:17 ralf Exp $
X  * indyIRQ.S: Interrupt exception dispatch code for FullHouse and
X  *            Guiness.
X  *
diff -u --recursive --new-file v2.3.8/linux/arch/mips/sgi/kernel/indy_hpc.c linux/arch/mips/sgi/kernel/indy_hpc.c
--- v2.3.8/linux/arch/mips/sgi/kernel/indy_hpc.c	Tue Oct 20 13:52:55 1998
+++ linux/arch/mips/sgi/kernel/indy_hpc.c	Fri Jun 25 17:40:13 1999
@@ -1,4 +1,4 @@
-/* $Id: indy_hpc.c,v 1.4 1998/07/14 09:12:27 ralf Exp $
+/* $Id: indy_hpc.c,v 1.6 1999/05/07 22:34:31 ulfc Exp $
X  *
X  * indy_hpc.c: Routines for generic manipulation of the HPC controllers.
X  *
@@ -43,7 +43,8 @@
X 	prom_printf("sgihpc_init: ");
X #endif
X 
-	if(sid & 1) {
+	/* This test works now thanks to William J. Earl */
+	if ((sid & 1) == 0 ) {
X #ifdef DEBUG_SGIHPC
X 		prom_printf("GUINESS ");
X #endif
diff -u --recursive --new-file v2.3.8/linux/arch/mips/sgi/kernel/indy_int.c linux/arch/mips/sgi/kernel/indy_int.c
--- v2.3.8/linux/arch/mips/sgi/kernel/indy_int.c	Tue Oct 20 13:52:55 1998
+++ linux/arch/mips/sgi/kernel/indy_int.c	Wed Jun 30 11:24:54 1999
@@ -1,14 +1,15 @@
-/* $Id: indy_int.c,v 1.9 1998/05/28 03:18:00 ralf Exp $
+/* $Id: indy_int.c,v 1.13 1999/06/12 17:26:15 ulfc Exp $
X  *
X  * indy_int.c: Routines for generic manipulation of the INT[23] ASIC
X  *             found on INDY workstations..
X  *
X  * Copyright (C) 1996 David S. Miller (d...@engr.sgi.com)
X  * Copyright (C) 1997, 1998 Ralf Baechle (ra...@gnu.org)
+ * Copyright (C) 1999 Andrew R. Baker (and...@uab.edu) 
+ *                    - Indigo2 changes
+ *                    - Interrupt handling fixes
X  */
-#include <linux/config.h>
X #include <linux/init.h>
-
X #include <linux/errno.h>
X #include <linux/kernel_stat.h>
X #include <linux/signal.h>
@@ -35,6 +36,7 @@
X #include <asm/sgihpc.h>
X #include <asm/sgint23.h>
X #include <asm/sgialib.h>
+#include <asm/gdb-stub.h>
X 
X /* #define DEBUG_SGINT */
X 
@@ -51,10 +53,6 @@
X 
X extern asmlinkage void indyIRQ(void);
X 
-#ifdef CONFIG_REMOTE_DEBUG
-extern void rs_kgdb_hook(int);
-#endif
-
X unsigned int local_bh_count[NR_CPUS];
X unsigned int local_irq_count[NR_CPUS];
X unsigned long spurious_count = 0;
@@ -274,7 +272,7 @@
X 	int do_random, cpu;
X 
X 	cpu = smp_processor_id();
-	irq_enter(cpu, irq);
+	hardirq_enter(cpu);
X 	kstat.irqs[0][irq]++;
X 
X 	printk("Got irq %d, press a key.", irq);
@@ -310,7 +308,7 @@
X 			add_interrupt_randomness(irq);
X 		__cli();
X 	}
-	irq_exit(cpu, irq);
+	hardirq_exit(cpu);
X 
X 	/* unmasking and bottom half handling is done magically for us. */
X }
@@ -448,10 +446,23 @@
X 		action = local_irq_action[irq];
X 	}
X 
-	irq_enter(cpu, irq);
+	/* if irq == 0, then the interrupt has already been cleared */
+	if ( irq == 0 ) { goto end; }
+	/* if action == NULL, then we do have a handler for the irq */
+	if ( action == NULL ) { goto no_handler; }
+	
+	hardirq_enter(cpu);
X 	kstat.irqs[0][irq + 16]++;
X 	action->handler(irq, action->dev_id, regs);
-	irq_exit(cpu, irq);
+	hardirq_exit(cpu);
+	goto end;
+
+no_handler:
+	printk("No handler for local0 irq: %i\n", irq);
+
+end:	
+	return;	
+	
X }
X 
X void indy_local1_irqdispatch(struct pt_regs *regs)
@@ -472,10 +483,23 @@
X 		irq = lc1msk_to_irqnr[mask];
X 		action = local_irq_action[irq];
X 	}
-	irq_enter(cpu, irq);
+	/* if irq == 0, then the interrupt has already been cleared */
+	/* not sure if it is needed here, but it is needed for local0 */
+	if ( irq == 0 ) { goto end; }
+	/* if action == NULL, then we do have a handler for the irq */
+	if ( action == NULL ) { goto no_handler; }
+	
+	hardirq_enter(cpu);
X 	kstat.irqs[0][irq + 24]++;
X 	action->handler(irq, action->dev_id, regs);
-	irq_exit(cpu, irq);
+	hardirq_exit(cpu);
+	goto end;
+	
+no_handler:
+	printk("No handler for local1 irq: %i\n", irq);
+
+end:	
+	return;	
X }
X 
X void indy_buserror_irq(struct pt_regs *regs)
@@ -483,13 +507,13 @@
X 	int cpu = smp_processor_id();
X 	int irq = 6;
X 
-	irq_enter(cpu, irq);
+	hardirq_enter(cpu);
X 	kstat.irqs[0][irq]++;
X 	printk("Got a bus error IRQ, shouldn't happen yet\n");
X 	show_regs(regs);
X 	printk("Spinning...\n");
X 	while(1);
-	irq_exit(cpu, irq);
+	hardirq_exit(cpu);
X }
X 
X /* Misc. crap just to keep the kernel linking... */
@@ -506,9 +530,6 @@
X __initfunc(void sgint_init(void))
X {
X 	int i;
-#ifdef CONFIG_REMOTE_DEBUG
-	char *ctype;
-#endif
X 
X 	sgi_i2regs = (struct sgi_int2_regs *) (KSEG1 + SGI_INT2_BASE);
X 	sgi_i3regs = (struct sgi_int3_regs *) (KSEG1 + SGI_INT3_BASE);
@@ -563,9 +584,16 @@
X 		}
X 	}
X 
-	ioc_icontrol = &sgi_i3regs->ints;
-	ioc_timers = &sgi_i3regs->timers;
-	ioc_tclear = &sgi_i3regs->tclear;
+	/* Indy uses an INT3, Indigo2 uses an INT2 */
+	if (sgi_guiness) {
+		ioc_icontrol = &sgi_i3regs->ints;
+		ioc_timers = &sgi_i3regs->timers;
+		ioc_tclear = &sgi_i3regs->tclear;
+	} else {
+		ioc_icontrol = &sgi_i2regs->ints;
+		ioc_timers = &sgi_i2regs->timers;
+		ioc_tclear = &sgi_i2regs->tclear;
+	}
X 
X 	/* Mask out all interrupts. */
X 	ioc_icontrol->imask0 = 0;
@@ -575,28 +603,4 @@
X 
X 	/* Now safe to set the exception vector. */
X 	set_except_vector(0, indyIRQ);
-
-#ifdef CONFIG_REMOTE_DEBUG
-	ctype = prom_getcmdline();
-	for(i = 0; i < strlen(ctype); i++) {
-		if(ctype[i]=='k' && ctype[i+1]=='g' &&
-		   ctype[i+2]=='d' && ctype[i+3]=='b' &&
-		   ctype[i+4]=='=' && ctype[i+5]=='t' &&
-		   ctype[i+6]=='t' && ctype[i+7]=='y' &&
-		   ctype[i+8]=='d' &&
-		   (ctype[i+9] == '1' || ctype[i+9] == '2')) {
-			printk("KGDB: Using serial line /dev/ttyd%d for "
-			       "session\n", (ctype[i+9] - '0'));
-				if(ctype[i+9]=='1')
-					rs_kgdb_hook(1);
-				else if(ctype[i+9]=='2')
-					rs_kgdb_hook(0);
-				else {
-					printk("KGDB: whoops bogon tty line "
-					       "requested, disabling session\n");
-				}
-
-		}
-	}
-#endif
X }
diff -u --recursive --new-file v2.3.8/linux/arch/mips/sgi/kernel/indy_mc.c linux/arch/mips/sgi/kernel/indy_mc.c
--- v2.3.8/linux/arch/mips/sgi/kernel/indy_mc.c	Tue Oct 20 13:52:55 1998
+++ linux/arch/mips/sgi/kernel/indy_mc.c	Fri Jun 25 17:40:13 1999
@@ -2,8 +2,9 @@
X  * indy_mc.c: Routines for manipulating the INDY memory controller.
X  *
X  * Copyright (C) 1996 David S. Miller (d...@engr.sgi.com)
+ * Copyright (C) 1999 Andrew R. Baker (and...@uab.edu) - Indigo2 changes
X  *
- * $Id: indy_mc.c,v 1.3 1998/04/25 15:43:32 ralf Exp $
+ * $Id: indy_mc.c,v 1.4 1999/05/07 22:34:32 ulfc Exp $
X  */
X #include <linux/init.h>
X #include <linux/kernel.h>
@@ -150,6 +151,8 @@
X 			tmpreg |= SGIMC_GIOPARM_PLINEEXP0; /* exp[01] pipelined */
X 			tmpreg |= SGIMC_GIOPARM_PLINEEXP1;
X 			tmpreg |= SGIMC_GIOPARM_MASTEREISA;/* EISA masters */
+			/* someone forgot this poor little guy... */
+			tmpreg |= SGIMC_GIOPARM_GFX64; 	/* GFX at 64 bits */
X 		}
X 	}
X 	mcmisc_regs->gioparm = tmpreg; /* poof */
diff -u --recursive --new-file v2.3.8/linux/arch/mips/sgi/kernel/indy_sc.c linux/arch/mips/sgi/kernel/indy_sc.c
--- v2.3.8/linux/arch/mips/sgi/kernel/indy_sc.c	Mon Oct 26 09:57:55 1998
+++ linux/arch/mips/sgi/kernel/indy_sc.c	Fri Jun 25 17:40:13 1999
@@ -1,4 +1,4 @@
-/* $Id: indy_sc.c,v 1.9 1998/08/17 12:14:55 ralf Exp $
+/* $Id: indy_sc.c,v 1.9 1999/05/12 21:57:49 ulfc Exp $
X  *
X  * indy_sc.c: Indy cache managment functions.
X  *
@@ -38,6 +38,7 @@
X 		.set	noreorder
X 		.set	mips3
X 		.set	noat
+		mfc0	$2, $12
X 		li	$1, 0x80	# Go 64 bit
X 		mtc0	$1, $12
X 
@@ -50,12 +51,12 @@
X 		bne	%0, %1, 1b
X 		daddu	%0, 32
X 
-		mtc0	$0, $12		# Back to 32 bit
+		mtc0	$2, $12		# Back to 32 bit
X 		nop; nop; nop; nop;
X 		.set mips0
X 		.set reorder"
-		: "=r" (first), "=r" (last)
-		: "0" (first), "1" (last)
+		: /* no output */
+		: "r" (first), "r" (last)
X 		: "$1");
X }
X 
@@ -69,7 +70,10 @@
X #endif
X 	/* Which lines to flush?  */
X 	first_line = SC_INDEX(addr);
-	last_line = SC_INDEX(SC_ROUND(addr + size));
+	if (size <= SC_LINE)
+		last_line = SC_INDEX(addr);
+	else
+		last_line = SC_INDEX(addr + size - 1);
X 
X 	__save_and_cli(flags);
X 	if (first_line <= last_line) {
@@ -80,8 +84,8 @@
X 	/* Cache index wrap around.  Due to the way the buddy system works
X 	   this case should not happen.  We're prepared to handle it,
X 	   though. */
-	indy_sc_wipe(last_line, SC_SIZE);
-	indy_sc_wipe(0, first_line);
+	indy_sc_wipe(first_line, SC_SIZE - SC_LINE);
+	indy_sc_wipe(0, last_line);
X out:
X 	__restore_flags(flags);
X }
diff -u --recursive --new-file v2.3.8/linux/arch/mips/sgi/kernel/indy_timer.c linux/arch/mips/sgi/kernel/indy_timer.c
--- v2.3.8/linux/arch/mips/sgi/kernel/indy_timer.c	Thu Mar 11 23:25:24 1999
+++ linux/arch/mips/sgi/kernel/indy_timer.c	Fri Jun 25 17:40:13 1999
@@ -1,4 +1,4 @@
-/* $Id: indy_timer.c,v 1.9 1998/06/25 20:15:02 ralf Exp $
+/* $Id: indy_timer.c,v 1.12 1999/06/13 16:30:36 ralf Exp $
X  *
X  * indy_timer.c: Setting up the clock on the INDY 8254 controller.
X  *
@@ -262,12 +262,12 @@
X 	int cpu = smp_processor_id();
X 	int irq = 4;
X 
-	irq_enter(cpu, irq);
+	hardirq_enter(cpu);
X 	kstat.irqs[0][irq]++;
X 	printk("indy_8254timer_irq: Whoops, should not have gotten this IRQ\n");
X 	prom_getchar();
X 	prom_imode();
-	irq_exit(cpu, irq);
+	hardirq_exit(cpu);
X }
X 
X void do_gettimeofday(struct timeval *tv)
diff -u --recursive --new-file v2.3.8/linux/arch/mips/sgi/kernel/promcon.c linux/arch/mips/sgi/kernel/promcon.c
--- v2.3.8/linux/arch/mips/sgi/kernel/promcon.c	Wed Dec 31 16:00:00 1969
+++ linux/arch/mips/sgi/kernel/promcon.c	Fri Jun 25 17:40:13 1999
@@ -0,0 +1,73 @@
+/*
+ * Wrap-around code for a console using the
+ * SGI PROM io-routines.
+ *
+ * Copyright (c) 1999 Ulf Carlsson
+ *
+ * Derived from DECstation promcon.c
+ * Copyright (c) 1998 Harald Koerfgen 
+ */
+
+#include <linux/tty.h>
+#include <linux/major.h>
+#include <linux/ptrace.h>
+#include <linux/init.h>
+#include <linux/console.h>
+#include <linux/fs.h>
+
+#include <asm/sgialib.h>
+
+static void prom_console_write(struct console *co, const char *s,
+			       unsigned count)
+{
+    unsigned i;
+
+    /*
+     *    Now, do each character
+     */
+    for (i = 0; i < count; i++) {
+	if (*s == 10)
+	    prom_printf("%c", 13);
+	prom_printf("%c", *s++);
+    }
+}
+
+static int prom_console_wait_key(struct console *co)
+{
+    return prom_getchar();
+}
+
+__initfunc(static int prom_console_setup(struct console *co, char *options))
+{
+    return 0;
+}
+
+static kdev_t prom_console_device(struct console *c)
+{
+    return MKDEV(TTY_MAJOR, 64 + c->index);
+}
+
+static struct console sercons =
+{
+    "ttyS",
+    prom_console_write,
+    NULL,
+    prom_console_device,
+    prom_console_wait_key,
+    NULL,
+    prom_console_setup,
+    CON_PRINTBUFFER,
+    -1,
+    0,
+    NULL
+};
+
+/*
+ *    Register console.
+ */
+
+__initfunc(long sgi_prom_console_init(long kmem_start, long kmem_end))
+{
+    register_console(&sercons);
+    return kmem_start;
+}
diff -u --recursive --new-file v2.3.8/linux/arch/mips/sgi/kernel/reset.c linux/arch/mips/sgi/kernel/reset.c
--- v2.3.8/linux/arch/mips/sgi/kernel/reset.c	Tue Oct 20 13:52:55 1998
+++ linux/arch/mips/sgi/kernel/reset.c	Fri Jun 25 17:40:13 1999
@@ -1,4 +1,4 @@
-/* $Id: reset.c,v 1.6 1998/07/09 19:57:47 ralf Exp $
+/* $Id: reset.c,v 1.6 1999/04/10 12:21:30 ulfc Exp $
X  *
X  * Reset a SGI.
X  *
@@ -33,7 +33,9 @@
X #define POWERDOWN_FREQ		(HZ / 4)
X #define PANIC_FREQ		(HZ / 8)
X 
-static struct timer_list power_timer, blink_timer, debounce_timer;
+static unsigned char sgi_volume;
+
+static struct timer_list power_timer, blink_timer, debounce_timer, volume_timer;
X static int shuting_down, has_paniced;
X 
X static void sgi_machine_restart(char *command) __attribute__((noreturn));
@@ -129,14 +131,50 @@
X 	add_timer(&power_timer);
X }
X 
-static inline void volume_up_button(void)
+void inline sgi_volume_set(unsigned char volume)
+{
+	sgi_volume = volume;
+
+	hpc3c0->pbus_extregs[2][0] = sgi_volume;
+	hpc3c0->pbus_extregs[2][1] = sgi_volume;
+}
+
+void inline sgi_volume_get(unsigned char *volume)
X {
-	/* Later when we have sound support ... */
+	*volume = sgi_volume;
X }
X 
-static inline void volume_down_button(void)
+static inline void volume_up_button(unsigned long data)
X {
-	/* Later when we have sound support ... */
+	del_timer(&volume_timer);
+
+	if (sgi_volume < 0xff)
+		sgi_volume++;
+
+	hpc3c0->pbus_extregs[2][0] = sgi_volume;
+	hpc3c0->pbus_extregs[2][1] = sgi_volume;
+
+	if (ioc_icontrol->istat1 & 2) {
+		volume_timer.expires = jiffies + 1;
+		add_timer(&volume_timer);
+	}
+
+}
+
+static inline void volume_down_button(unsigned long data)
+{
+	del_timer(&volume_timer);
+
+	if (sgi_volume > 0)
+		sgi_volume--;
+
+	hpc3c0->pbus_extregs[2][0] = sgi_volume;
+	hpc3c0->pbus_extregs[2][1] = sgi_volume;
+
+	if (ioc_icontrol->istat1 & 2) {
+		volume_timer.expires = jiffies + 1;
+		add_timer(&volume_timer);
+	}
X }
X 
X static void panel_int(int irq, void *dev_id, struct pt_regs *regs)
@@ -156,10 +194,18 @@
X 
X 	if (!(buttons & 2))		/* Power button was pressed */
X 		power_button();
-	if (!(buttons & 0x40))		/* Volume up button was pressed */
-		volume_up_button();
-	if (!(buttons & 0x10))		/* Volume down button was pressed */
-		volume_down_button();
+	if (!(buttons & 0x40)) {	/* Volume up button was pressed */
+		init_timer(&volume_timer);
+		volume_timer.function = volume_up_button;
+		volume_timer.expires = jiffies + 1;
+		add_timer(&volume_timer);
+	}
+	if (!(buttons & 0x10)) {	/* Volume down button was pressed */
+		init_timer(&volume_timer);
+		volume_timer.function = volume_down_button;
+		volume_timer.expires = jiffies + 1;
+		add_timer(&volume_timer);
+	}
X }
X 
X static int panic_event(struct notifier_block *this, unsigned long event,
diff -u --recursive --new-file v2.3.8/linux/arch/mips/sgi/kernel/setup.c linux/arch/mips/sgi/kernel/setup.c
--- v2.3.8/linux/arch/mips/sgi/kernel/setup.c	Mon Oct 26 09:57:55 1998
+++ linux/arch/mips/sgi/kernel/setup.c	Fri Jun 25 17:40:13 1999
@@ -1,4 +1,4 @@
-/* $Id: setup.c,v 1.13 1998/09/16 22:50:46 ralf Exp $
+/* $Id: setup.c,v 1.24 1999/06/12 17:26:15 ulfc Exp $
X  *
X  * setup.c: SGI specific setup, including init of the feature struct.
X  *
@@ -14,6 +14,7 @@
X #include <linux/console.h>
X #include <linux/sched.h>
X #include <linux/mc146818rtc.h>
+#include <linux/pc_keyb.h>
X 
X #include <asm/addrspace.h>
X #include <asm/bcache.h>
@@ -25,16 +26,55 @@
X #include <asm/sgimc.h>
X #include <asm/sgihpc.h>
X #include <asm/sgint23.h>
+#include <asm/gdb-stub.h>
X 
-extern int serial_console; /* in sgiserial.c  */
+#ifdef CONFIG_REMOTE_DEBUG
+extern void rs_kgdb_hook(int);
+extern void breakpoint(void);
+#endif
+
+#if defined(CONFIG_SERIAL_CONSOLE) || defined(CONFIG_PROM_CONSOLE)
+extern void console_setup(char *, int *);
+#endif
X 
X extern struct rtc_ops indy_rtc_ops;
X void indy_reboot_setup(void);
+void sgi_volume_set(unsigned char);
X 
-static volatile struct hpc_keyb *sgi_kh = (struct hpc_keyb *) (KSEG1 + 0x1fbd9800 + 64);
+static int remote_debug = 0;
+
+#define sgi_kh ((struct hpc_keyb *) (KSEG1 + 0x1fbd9800 + 64))
SHAR_EOF
true || echo 'restore of patch-2.3.9 failed'
fi
echo 'End of  part 08'
echo 'File patch-2.3.9 is continued in part 09'
echo 09 > _shar_seq_.tmp
exit 0
#!/bin/sh
# this is part 09 of a 26 - part archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file patch-2.3.9 continued
if test ! -r _shar_seq_.tmp; then
        echo 'Please unpack part 1 first!'
        exit 1
fi
(read Scheck
if test "$Scheck" != 09; then
        echo Please unpack part "$Scheck" next!
        exit 1
 else
        exit 0
 fi
) < _shar_seq_.tmp || exit 1
if test ! -f _shar_wnt_.tmp; then
echo 'x - still skipping patch-2.3.9'
else
echo 'x - continuing with patch-2.3.9'
sed 's/^X//' << 'SHAR_EOF' >> 'patch-2.3.9' &&
X 
X #define KBD_STAT_IBF		0x02	/* Keyboard input buffer full */
X 
+static void sgi_request_region(void)
+{
+	/* No I/O ports are being used on the Indy.  */
+}
+
+static int sgi_request_irq(void (*handler)(int, void *, struct pt_regs *))
+{
+	/* Dirty hack, this get's called as a callback from the keyboard
+	   driver.  We piggyback the initialization of the front panel
+	   button handling on it even though they're technically not
+	   related with the keyboard driver in any way.  Doing it from
+	   indy_setup wouldn't work since kmalloc isn't initialized yet.  */
+	indy_reboot_setup();
+
+	return request_irq(SGI_KEYBOARD_IRQ, handler, 0, "keyboard", NULL);
+}
+
+static int sgi_aux_request_irq(void (*handler)(int, void *, struct pt_regs *))
+{
+	/* Nothing to do, interrupt is shared with the keyboard hw  */
+	return 0;
+}
+
+static void sgi_aux_free_irq(void)
+{
+	/* Nothing to do, interrupt is shared with the keyboard hw  */
+}
+
X static unsigned char sgi_read_input(void)
X {
X 	return sgi_kh->data;
@@ -65,27 +105,28 @@
X 	return sgi_kh->command;
X }
X 
-__initfunc(static void sgi_keyboard_setup(void))
-{
-	kbd_read_input = sgi_read_input;
-	kbd_write_output = sgi_write_output;
-	kbd_write_command = sgi_write_command;
-	kbd_read_status = sgi_read_status;
-
-	request_irq(SGI_KEYBOARD_IRQ, keyboard_interrupt,
-	            0, "keyboard", NULL);
-
-	/* Dirty hack, this get's called as a callback from the keyboard
-	   driver.  We piggyback the initialization of the front panel
-	   button handling on it even though they're technically not
-	   related with the keyboard driver in any way.  Doing it from
-	   indy_setup wouldn't work since kmalloc isn't initialized yet.  */
-	indy_reboot_setup();
-}
+struct kbd_ops sgi_kbd_ops = {
+	sgi_request_region,
+	sgi_request_irq,
+
+	sgi_aux_request_irq,
+	sgi_aux_free_irq,
+
+	sgi_read_input,
+	sgi_write_output,
+	sgi_write_command,
+	sgi_read_status
+};
X 
X __initfunc(static void sgi_irq_setup(void))
X {
X 	sgint_init();
+
+#ifdef CONFIG_REMOTE_DEBUG
+	if (remote_debug)
+		set_debug_traps();
+	breakpoint(); /* you may move this line to whereever you want :-) */
+#endif
X }
X 
X __initfunc(void sgi_setup(void))
@@ -93,9 +134,12 @@
X #ifdef CONFIG_SERIAL_CONSOLE
X 	char *ctype;
X #endif
+#ifdef CONFIG_REMOTE_DEBUG
+	char *kgdb_ttyd;
+#endif
+
X 
X 	irq_setup = sgi_irq_setup;
-	keyboard_setup = sgi_keyboard_setup;
X 
X 	/* Init the INDY HPC I/O controller.  Need to call this before
X 	 * fucking with the memory controller because it needs to know the
@@ -115,23 +159,55 @@
X 	 * line and "d2" for the second serial line.
X 	 */
X 	ctype = prom_getenv("console");
-	serial_console = 0;
X 	if(*ctype == 'd') {
X 		if(*(ctype+1)=='2')
-			serial_console = 1;
+			console_setup ("ttyS1", NULL);
X 		else
-			serial_console = 2;
-		if(!serial_console) {
-			prom_printf("Weird console env setting %s\n", ctype);
-			prom_printf("Press a key to reboot.\n");
-			prom_getchar();
-			prom_imode();
-		}
+			console_setup ("ttyS0", NULL);
+	}
+#endif
+
+#ifdef CONFIG_REMOTE_DEBUG
+	kgdb_ttyd = prom_getcmdline();
+	if ((kgdb_ttyd = strstr(kgdb_ttyd, "kgdb=ttyd")) != NULL) {
+		int line;
+		kgdb_ttyd += strlen("kgdb=ttyd");
+		if (*kgdb_ttyd != '1' && *kgdb_ttyd != '2')
+			printk("KGDB: Uknown serial line /dev/ttyd%c, "
+			       "falling back to /dev/ttyd1\n", *kgdb_ttyd);
+		line = *kgdb_ttyd == '2' ? 0 : 1;
+		printk("KGDB: Using serial line /dev/ttyd%d for session\n",
+		       line ? 1 : 2);
+		rs_kgdb_hook(line);
+
+		prom_printf("KGDB: Using serial line /dev/ttyd%d for session, "
+			    "please connect your debugger\n", line ? 1 : 2);
+
+		remote_debug = 1;
+		/* Breakpoints and stuff are in sgi_irq_setup() */
X 	}
X #endif
X 
+#ifdef CONFIG_SGI_PROM_CONSOLE
+	console_setup("ttyS0", NULL);
+#endif
+	  
+	sgi_volume_set(simple_strtoul(prom_getenv("volume"), NULL, 10));
+
X #ifdef CONFIG_VT
+#ifdef CONFIG_SGI_NEWPORT_CONSOLE
X 	conswitchp = &newport_con;
+#else
+	conswitchp = &dummy_con;
+#endif
X #endif
+
X 	rtc_ops = &indy_rtc_ops;
+	kbd_ops = &sgi_kbd_ops;
+#ifdef CONFIG_PSMOUSE
+	aux_device_present = 0xaa;
+#endif
+#ifdef CONFIG_VIDEO_VINO
+	init_vino();
+#endif
X }
diff -u --recursive --new-file v2.3.8/linux/arch/mips/sgi/kernel/system.c linux/arch/mips/sgi/kernel/system.c
--- v2.3.8/linux/arch/mips/sgi/kernel/system.c	Tue Oct 20 13:52:55 1998
+++ linux/arch/mips/sgi/kernel/system.c	Fri Jun 25 17:40:13 1999
@@ -3,7 +3,7 @@
X  *
X  * Copyright (C) 1996 David S. Miller (d...@engr.sgi.com)
X  *
- * $Id: system.c,v 1.4 1998/03/27 08:53:45 ralf Exp $
+ * $Id: system.c,v 1.7 1998/10/18 22:55:34 tsbogend Exp $
X  */
X #include <linux/init.h>
X #include <linux/kernel.h>
@@ -21,28 +21,6 @@
X 	int type;
X };
X 
-static struct smatch sgi_mtable[] = {
-	{ "SGI-IP4", ip4 },
-	{ "SGI-IP5", ip5 },
-	{ "SGI-IP6", ip6 },
-	{ "SGI-IP7", ip7 },
-	{ "SGI-IP9", ip9 },
-	{ "SGI-IP12", ip12 },
-	{ "SGI-IP15", ip15 },
-	{ "SGI-IP17", ip17 },
-	{ "SGI-IP19", ip19 },
-	{ "SGI-IP20", ip20 },
-	{ "SGI-IP21", ip21 },
-	{ "SGI-IP22", ip22 },
-	{ "SGI-IP25", ip25 },
-	{ "SGI-IP26", ip26 },
-	{ "SGI-IP28", ip28 },
-	{ "SGI-IP30", ip30 },
-	{ "SGI-IP32", ip32 }
-};
-
-#define NUM_MACHS 17 /* for now */
-
X static struct smatch sgi_cputable[] = {
X 	{ "MIPS-R2000", CPU_R2000 },
X 	{ "MIPS-R3000", CPU_R3000 },
@@ -57,28 +35,13 @@
X 
X #define NUM_CPUS 9 /* for now */
X 
-__initfunc(static enum sgi_mach string_to_mach(char *s))
-{
-	int i;
-
-	for(i = 0; i < NUM_MACHS; i++) {
-		if(!strcmp(s, sgi_mtable[i].name))
-			return (enum sgi_mach) sgi_mtable[i].type;
-	}
-	prom_printf("\nYeee, could not determine SGI architecture type <%s>\n", s);
-	prom_printf("press a key to reboot\n");
-	prom_getchar();
-	romvec->imode();
-	return (enum sgi_mach) 0;
-}
-
X __initfunc(static int string_to_cpu(char *s))
X {
X 	int i;
X 
X 	for(i = 0; i < NUM_CPUS; i++) {
X 		if(!strcmp(s, sgi_cputable[i].name))
-			return sgi_mtable[i].type;
+			return sgi_cputable[i].type;
X 	}
X 	prom_printf("\nYeee, could not determine MIPS cpu type <%s>\n", s);
X 	prom_printf("press a key to reboot\n");
@@ -101,8 +64,6 @@
X 	 * have here.
X 	 */
X 	p = prom_getchild(PROM_NULL_COMPONENT);
-	printk("ARCH: %s\n", p->iname);
-	sgimach = string_to_mach(p->iname);
X 
X 	/* Now scan for cpu(s). */
X 	toplev = p = prom_getchild(p);
diff -u --recursive --new-file v2.3.8/linux/arch/mips/sgi/kernel/time.c linux/arch/mips/sgi/kernel/time.c
--- v2.3.8/linux/arch/mips/sgi/kernel/time.c	Tue Oct 20 13:52:55 1998
+++ linux/arch/mips/sgi/kernel/time.c	Fri Jun 25 17:40:13 1999
@@ -1,4 +1,4 @@
-/* $Id: time.c,v 1.2 1998/03/27 08:53:45 ralf Exp $
+/* $Id: time.c,v 1.2 1998/04/05 11:24:00 ralf Exp $
X  * time.c: Generic SGI time_init() code, this will dispatch to the
X  *         appropriate per-architecture time/counter init code.
X  *
diff -u --recursive --new-file v2.3.8/linux/arch/mips/sgi/prom/Makefile linux/arch/mips/sgi/prom/Makefile
--- v2.3.8/linux/arch/mips/sgi/prom/Makefile	Tue Oct 20 13:52:55 1998
+++ linux/arch/mips/sgi/prom/Makefile	Wed Dec 31 16:00:00 1969
@@ -1,23 +0,0 @@
-# $Id: Makefile,v 1.1.1.1 1997/06/01 03:16:40 ralf Exp $
-# Makefile for the SGI arcs prom monitor library routines
-# under Linux.
-#
-# Note! Dependencies are done automagically by 'make dep', which also
-# removes any old dependencies. DON'T put your own dependencies here
-# unless it's something special (ie not a .c file).
-#
-# Note 2! The CFLAGS definitions are now in the main makefile...
-
-OBJS  = console.o init.o printf.o memory.o tree.o tags.o env.o \
-      cmdline.o misc.o time.o file.o
-
-all: promlib.a
-
-promlib.a: $(OBJS)
-	$(AR) rcs promlib.a $(OBJS)
-	sync
-
-dep:
-	$(CPP) -M *.c > .depend
-
-include $(TOPDIR)/Rules.make
diff -u --recursive --new-file v2.3.8/linux/arch/mips/sgi/prom/cmdline.c linux/arch/mips/sgi/prom/cmdline.c
--- v2.3.8/linux/arch/mips/sgi/prom/cmdline.c	Tue Oct 20 13:52:55 1998
+++ linux/arch/mips/sgi/prom/cmdline.c	Wed Dec 31 16:00:00 1969
@@ -1,64 +0,0 @@
-/*
- * cmdline.c: Kernel command line creation using ARCS argc/argv.
- *
- * Copyright (C) 1996 David S. Miller (d...@engr.sgi.com)
- *
- * $Id: cmdline.c,v 1.3 1998/03/27 08:53:46 ralf Exp $
- */
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/string.h>
-
-#include <asm/sgialib.h>
-#include <asm/bootinfo.h>
-
-/* #define DEBUG_CMDLINE */
-
-extern char arcs_cmdline[CL_SIZE];
-
-__initfunc(char *prom_getcmdline(void))
-{
-	return &(arcs_cmdline[0]);
-}
-
-static char *ignored[] = {
-	"ConsoleIn=",
-	"ConsoleOut=",
-	"SystemPartition=",
-	"OSLoader=",
-	"OSLoadPartition=",
-	"OSLoadFilename="
-};
-#define NENTS(foo) ((sizeof((foo)) / (sizeof((foo[0])))))
-
-__initfunc(void prom_init_cmdline(void))
-{
-	char *cp;
-	int actr, i;
-
-	actr = 1; /* Always ignore argv[0] */
-
-	cp = &(arcs_cmdline[0]);
-	while(actr < prom_argc) {
-		for(i = 0; i < NENTS(ignored); i++) {
-			int len = strlen(ignored[i]);
-
-			if(!strncmp(prom_argv[actr], ignored[i], len))
-				goto pic_cont;
-		}
-		/* Ok, we want it. */
-		strcpy(cp, prom_argv[actr]);
-		cp += strlen(prom_argv[actr]);
-		*cp++ = ' ';
-
-	pic_cont:
-		actr++;
-	}
-	if (cp != &(arcs_cmdline[0])) /* get rid of trailing space */
-		--cp;
-	*cp = '\0';
-
-#ifdef DEBUG_CMDLINE
-	prom_printf("prom_init_cmdline: %s\n", &(arcs_cmdline[0]));
-#endif
-}
diff -u --recursive --new-file v2.3.8/linux/arch/mips/sgi/prom/console.c linux/arch/mips/sgi/prom/console.c
--- v2.3.8/linux/arch/mips/sgi/prom/console.c	Tue Oct 20 13:52:55 1998
+++ linux/arch/mips/sgi/prom/console.c	Wed Dec 31 16:00:00 1969
@@ -1,26 +0,0 @@
-/*
- * console.c: SGI arcs console code.
- *
- * Copyright (C) 1996 David S. Miller (d...@sgi.com)
- *
- * $Id: console.c,v 1.2 1998/03/27 08:53:46 ralf Exp $
- */
-#include <linux/init.h>
-#include <asm/sgialib.h>
-
-__initfunc(void prom_putchar(char c))
-{
-	long cnt;
-	char it = c;
-
-	romvec->write(1, &it, 1, &cnt);
-}
-
-__initfunc(char prom_getchar(void))
-{
-	long cnt;
-	char c;
-
-	romvec->read(0, &c, 1, &cnt);
-	return c;
-}
diff -u --recursive --new-file v2.3.8/linux/arch/mips/sgi/prom/env.c linux/arch/mips/sgi/prom/env.c
--- v2.3.8/linux/arch/mips/sgi/prom/env.c	Tue Oct 20 13:52:55 1998
+++ linux/arch/mips/sgi/prom/env.c	Wed Dec 31 16:00:00 1969
@@ -1,22 +0,0 @@
-/*
- * env.c: ARCS environment variable routines.
- *
- * Copyright (C) 1996 David S. Miller (d...@engr.sgi.com)
- *
- * $Id: env.c,v 1.2 1998/03/27 08:53:46 ralf Exp $
- */
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/string.h>
-
-#include <asm/sgialib.h>
-
-__initfunc(char *prom_getenv(char *name))
-{
-	return romvec->get_evar(name);
-}
-
-__initfunc(long prom_setenv(char *name, char *value))
-{
-	return romvec->set_evar(name, value);
-}
diff -u --recursive --new-file v2.3.8/linux/arch/mips/sgi/prom/file.c linux/arch/mips/sgi/prom/file.c
--- v2.3.8/linux/arch/mips/sgi/prom/file.c	Tue Oct 20 13:52:55 1998
+++ linux/arch/mips/sgi/prom/file.c	Wed Dec 31 16:00:00 1969
@@ -1,59 +0,0 @@
-/*
- * file.c: ARCS firmware interface to files.
- *
- * Copyright (C) 1996 David S. Miller (d...@engr.sgi.com)
- *
- * $Id: file.c,v 1.2 1998/03/27 08:53:47 ralf Exp $
- */
-#include <linux/init.h>
-#include <asm/sgialib.h>
-
-__initfunc(long prom_getvdirent(unsigned long fd, struct linux_vdirent *ent, unsigned long num, unsigned long *cnt))
-{
-	return romvec->get_vdirent(fd, ent, num, cnt);
-}
-
-__initfunc(long prom_open(char *name, enum linux_omode md, unsigned long *fd))
-{
-	return romvec->open(name, md, fd);
-}
-
-__initfunc(long prom_close(unsigned long fd))
-{
-	return romvec->close(fd);
-}
-
-__initfunc(long prom_read(unsigned long fd, void *buf, unsigned long num, unsigned long *cnt))
-{
-	return romvec->read(fd, buf, num, cnt);
-}
-
-__initfunc(long prom_getrstatus(unsigned long fd))
-{
-	return romvec->get_rstatus(fd);
-}
-
-__initfunc(long prom_write(unsigned long fd, void *buf, unsigned long num, unsigned long *cnt))
-{
-	return romvec->write(fd, buf, num, cnt);
-}
-
-__initfunc(long prom_seek(unsigned long fd, struct linux_bigint *off, enum linux_seekmode sm))
-{
-	return romvec->seek(fd, off, sm);
-}
-
-__initfunc(long prom_mount(char *name, enum linux_mountops op))
-{
-	return romvec->mount(name, op);
-}
-
-__initfunc(long prom_getfinfo(unsigned long fd, struct linux_finfo *buf))
-{
-	return romvec->get_finfo(fd, buf);
-}
-
-__initfunc(long prom_setfinfo(unsigned long fd, unsigned long flags, unsigned long msk))
-{
-	return romvec->set_finfo(fd, flags, msk);
-}
diff -u --recursive --new-file v2.3.8/linux/arch/mips/sgi/prom/init.c linux/arch/mips/sgi/prom/init.c
--- v2.3.8/linux/arch/mips/sgi/prom/init.c	Tue Oct 20 13:52:55 1998
+++ linux/arch/mips/sgi/prom/init.c	Wed Dec 31 16:00:00 1969
@@ -1,61 +0,0 @@
-/*
- * init.c: PROM library initialisation code.
- *
- * Copyright (C) 1996 David S. Miller (d...@engr.sgi.com)
- *
- * $Id: init.c,v 1.2 1998/03/27 08:53:47 ralf Exp $
- */
-#include <linux/init.h>
-#include <linux/kernel.h>
-
-#include <asm/sgialib.h>
-
-/* #define DEBUG_PROM_INIT */
-
-/* Master romvec interface. */
-struct linux_romvec *romvec;
-struct linux_promblock *sgi_pblock;
-int prom_argc;
-char **prom_argv, **prom_envp;
-unsigned short prom_vers, prom_rev;
-
-extern void prom_testtree(void);
-
-__initfunc(int prom_init(int argc, char **argv, char **envp))
-{
-	struct linux_promblock *pb;
-
-	romvec = ROMVECTOR;
-	pb = sgi_pblock = PROMBLOCK;
-	prom_argc = argc;
-	prom_argv = argv;
-	prom_envp = envp;
-
-	if(pb->magic != 0x53435241) {
-		prom_printf("Aieee, bad prom vector magic %08lx\n", pb->magic);
-		while(1)
-			;
-	}
-
-	prom_init_cmdline();
-
-	prom_vers = pb->ver;
-	prom_rev = pb->rev;
-	printk("PROMLIB: SGI ARCS firmware Version %d Revision %d\n",
-		    prom_vers, prom_rev);
-	prom_meminit();
-	prom_setup_archtags();
-
-#if 0
-	prom_testtree();
-#endif
-
-#ifdef DEBUG_PROM_INIT
-	{
-		prom_printf("Press a key to reboot\n");
-		(void) prom_getchar();
-		romvec->imode();
-	}
-#endif
-	return 0;
-}
diff -u --recursive --new-file v2.3.8/linux/arch/mips/sgi/prom/memory.c linux/arch/mips/sgi/prom/memory.c
--- v2.3.8/linux/arch/mips/sgi/prom/memory.c	Tue Oct 20 13:52:55 1998
+++ linux/arch/mips/sgi/prom/memory.c	Wed Dec 31 16:00:00 1969
@@ -1,131 +0,0 @@
-/*
- * memory.c: PROM library functions for acquiring/using memory descriptors
- *           given to us from the ARCS firmware.
- *
- * Copyright (C) 1996 David S. Miller (d...@engr.sgi.com)
- *
- * $Id: memory.c,v 1.2 1998/03/27 08:53:47 ralf Exp $
- */
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/sched.h>
-#include <linux/mm.h>
-#include <linux/swap.h>
-
-#include <asm/sgialib.h>
-#include <asm/page.h>
-#include <asm/pgtable.h>
-#include <asm/bootinfo.h>
-
-/* #define DEBUG */
-
-__initfunc(struct linux_mdesc *prom_getmdesc(struct linux_mdesc *curr))
-{
-	return romvec->get_mdesc(curr);
-}
-
-#ifdef DEBUG /* convenient for debugging */
-static char *mtypes[8] = {
-	"Exception Block",
-	"ARCS Romvec Page",
-	"Free/Contig RAM",
-	"Generic Free RAM",
-	"Bad Memory",
-	"Standlong Program Pages",
-	"ARCS Temp Storage Area",
-	"ARCS Permanent Storage Area"
-};
-#endif
-
-static struct prom_pmemblock prom_pblocks[PROM_MAX_PMEMBLOCKS];
-
-__initfunc(struct prom_pmemblock *prom_getpblock_array(void))
-{
-	return &prom_pblocks[0];
-}
-
-__initfunc(static void prom_setup_memupper(void))
-{
-	struct prom_pmemblock *p, *highest;
-
-	for(p = prom_getpblock_array(), highest = 0; p->size != 0; p++) {
-		if(p->base == 0xdeadbeef)
-			prom_printf("WHEEE, bogus pmemblock\n");
-		if(!highest || p->base > highest->base)
-			highest = p;
-	}
-	mips_memory_upper = highest->base + highest->size;
-#ifdef DEBUG
-	prom_printf("prom_setup_memupper: mips_memory_upper = %08lx\n",
-		    mips_memory_upper);
-#endif
-}
-
-__initfunc(void prom_meminit(void))
-{
-	struct linux_mdesc *p;
-	int totram;
-	int i = 0;
-
-	p = prom_getmdesc(PROM_NULL_MDESC);
-#ifdef DEBUG
-	prom_printf("ARCS MEMORY DESCRIPTOR dump:\n");
-	while(p) {
-		prom_printf("[%d,%p]: base<%08lx> pages<%08lx> type<%s>\n",
-			    i, p, p->base, p->pages, mtypes[p->type]);
-		p = prom_getmdesc(p);
-		i++;
-	}
-#endif
-	p = prom_getmdesc(PROM_NULL_MDESC);
-	totram = 0;
-	i = 0;
-	while(p) {
-		if(p->type == free || p->type == fcontig) {
-			prom_pblocks[i].base =
-				((p->base<<PAGE_SHIFT) + 0x80000000);
-			prom_pblocks[i].size = p->pages << PAGE_SHIFT;
-			totram += prom_pblocks[i].size;
-#ifdef DEBUG
-			prom_printf("free_chunk[%d]: base=%08lx size=%d\n",
-				    i, prom_pblocks[i].base,
-				    prom_pblocks[i].size);
-#endif
-			i++;
-		}
-		p = prom_getmdesc(p);
-	}
-	prom_pblocks[i].base = 0xdeadbeef;
-	prom_pblocks[i].size = 0; /* indicates last elem. of array */
-	printk("PROMLIB: Total free ram %d bytes (%dK,%dMB)\n",
-		    totram, (totram/1024), (totram/1024/1024));
-
-	/* Setup upper physical memory bound. */
-	prom_setup_memupper();
-}
-
-/* Called from mem_init() to fixup the mem_map page settings. */
-__initfunc(void prom_fixup_mem_map(unsigned long start, unsigned long end))
-{
-	struct prom_pmemblock *p;
-	int i, nents;
-
-	/* Determine number of pblockarray entries. */
-	p = prom_getpblock_array();
-	for(i = 0; p[i].size; i++)
-		;
-	nents = i;
-	while(start < end) {
-		for(i = 0; i < nents; i++) {
-			if((start >= (p[i].base)) &&
-			   (start < (p[i].base + p[i].size))) {
-				start = p[i].base + p[i].size;
-				start &= PAGE_MASK;
-				continue;
-			}
-		}
-		set_bit(PG_reserved, &mem_map[MAP_NR(start)].flags);
-		start += PAGE_SIZE;
-	}
-}
diff -u --recursive --new-file v2.3.8/linux/arch/mips/sgi/prom/misc.c linux/arch/mips/sgi/prom/misc.c
--- v2.3.8/linux/arch/mips/sgi/prom/misc.c	Tue Oct 20 13:52:55 1998
+++ linux/arch/mips/sgi/prom/misc.c	Wed Dec 31 16:00:00 1969
@@ -1,84 +0,0 @@
-/* $Id: misc.c,v 1.6 1998/07/08 15:59:13 ralf Exp $
- *
- * misc.c: Miscellaneous ARCS PROM routines.
- *
- * Copyright (C) 1996 David S. Miller (d...@engr.sgi.com)
- */
-#include <linux/config.h>
-#include <linux/init.h>
-#include <linux/kernel.h>
-
-#include <asm/bcache.h>
-#include <asm/sgialib.h>
-#include <asm/bootinfo.h>
-#include <asm/system.h>
-
-extern unsigned long mips_cputype;
-extern void *sgiwd93_host;
-extern void reset_wd33c93(void *instance);
-
-void prom_halt(void)
-{
-	bcops->bc_disable();
-	cli();
-#if CONFIG_SCSI_SGIWD93
-	reset_wd33c93(sgiwd93_host);
-#endif
-	romvec->halt();
-}
-
-void prom_powerdown(void)
-{
-	bcops->bc_disable();
-	cli();
-#if CONFIG_SCSI_SGIWD93
-	reset_wd33c93(sgiwd93_host);
-#endif
-	romvec->pdown();
-}
-
-/* XXX is this a soft reset basically? XXX */
-void prom_restart(void)
-{
-	bcops->bc_disable();
-	cli();
-#if CONFIG_SCSI_SGIWD93
-	reset_wd33c93(sgiwd93_host);
-#endif
-	romvec->restart();
-}
-
-void prom_reboot(void)
-{
-	bcops->bc_disable();
-	cli();
-#if CONFIG_SCSI_SGIWD93
-	reset_wd33c93(sgiwd93_host);
-#endif
-	romvec->reboot();
-}
-
-void prom_imode(void)
-{
-	bcops->bc_disable();
-	cli();
-#if CONFIG_SCSI_SGIWD93
-	reset_wd33c93(sgiwd93_host);
-#endif
-	romvec->imode();
-}
-
-long prom_cfgsave(void)
-{
-	return romvec->cfg_save();
-}
-
-struct linux_sysid *prom_getsysid(void)
-{
-	return romvec->get_sysid();
-}
-
-__initfunc(void prom_cacheflush(void))
-{
-	romvec->cache_flush();
-}
diff -u --recursive --new-file v2.3.8/linux/arch/mips/sgi/prom/printf.c linux/arch/mips/sgi/prom/printf.c
--- v2.3.8/linux/arch/mips/sgi/prom/printf.c	Tue Oct 20 13:52:55 1998
+++ linux/arch/mips/sgi/prom/printf.c	Wed Dec 31 16:00:00 1969
@@ -1,35 +0,0 @@
-/*
- * printf.c: Putting things on the screen using SGI arcs
- *           PROM facilities.
- *
- * Copyright (C) 1996 David S. Miller (d...@sgi.com)
- *
- * $Id: printf.c,v 1.2 1998/03/27 08:53:48 ralf Exp $
- */
-#include <linux/init.h>
-#include <linux/kernel.h>
-
-#include <asm/sgialib.h>
-
-static char ppbuf[1024];
-
-__initfunc(void prom_printf(char *fmt, ...))
-{
-	va_list args;
-	char ch, *bptr;
-	int i;
-
-	va_start(args, fmt);
-	i = vsprintf(ppbuf, fmt, args);
-
-	bptr = ppbuf;
-
-	while((ch = *(bptr++)) != 0) {
-		if(ch == '\n')
-			prom_putchar('\r');
-
-		prom_putchar(ch);
-	}
-	va_end(args);
-	return;
-}
diff -u --recursive --new-file v2.3.8/linux/arch/mips/sgi/prom/salone.c linux/arch/mips/sgi/prom/salone.c
--- v2.3.8/linux/arch/mips/sgi/prom/salone.c	Tue Oct 20 13:52:55 1998
+++ linux/arch/mips/sgi/prom/salone.c	Wed Dec 31 16:00:00 1969
@@ -1,25 +0,0 @@
-/*
- * salone.c: Routines to load into memory and execute stand-along
- *           program images using ARCS PROM firmware.
- *
- * Copyright (C) 1996 David S. Miller (d...@engr.sgi.com)
- *
- * $Id: salone.c,v 1.2 1998/03/27 08:53:48 ralf Exp $
- */
-#include <linux/init.h>
-#include <asm/sgialib.h>
-
-__initfunc(long prom_load(char *name, unsigned long end, unsigned long *pc, unsigned long *eaddr))
-{
-	return romvec->load(name, end, pc, eaddr);
-}
-
-__initfunc(long prom_invoke(unsigned long pc, unsigned long sp, long argc, char **argv, char **envp))
-{
-	return romvec->invoke(pc, sp, argc, argv, envp);
-}
-
-__initfunc(long prom_exec(char *name, long argc, char **argv, char **envp))
-{
-	return romvec->exec(name, argc, argv, envp);
-}
diff -u --recursive --new-file v2.3.8/linux/arch/mips/sgi/prom/tags.c linux/arch/mips/sgi/prom/tags.c
--- v2.3.8/linux/arch/mips/sgi/prom/tags.c	Tue Oct 20 13:52:55 1998
+++ linux/arch/mips/sgi/prom/tags.c	Wed Dec 31 16:00:00 1969
@@ -1,69 +0,0 @@
-/*
- * tags.c: Initialize the arch tags the way the MIPS kernel setup
- *         expects.
- *
- * Copyright (C) 1996 David S. Miller (d...@engr.sgi.com)
- *
- * $Id: tags.c,v 1.2 1998/03/27 08:53:48 ralf Exp $
- */
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/string.h>
-
-#include <asm/addrspace.h>
-#include <asm/sgialib.h>
-#include <asm/bootinfo.h>
-#include <asm/sgimc.h>
-
-/* XXX This tag thing is a fucking rats nest, I'm very inclined to completely
- * XXX rework the MIPS people's multi-arch code _NOW_.
- */
-
-static unsigned long machtype_SGI_INDY = MACH_SGI_INDY;
-static unsigned long machgroup_SGI = MACH_GROUP_SGI;
-static unsigned long memlower_SGI_INDY = (KSEG0 + SGIMC_SEG0_BADDR);
-static unsigned long cputype_SGI_INDY = CPU_R4400SC;
-static unsigned long tlb_entries_SGI_INDY = 48;
-static unsigned long dummy_SGI_INDY = 0;
-static struct drive_info_struct dummy_dinfo_SGI_INDY = { { 0, }, };
-char arcs_cmdline[CL_SIZE];
-
-#define TAG(t,l)   {tag_##t,(l)} /* XXX RATS NEST CODE!!! XXX */
-#define TAGVAL(v)  (void*)&(v)   /* XXX FUCKING LOSING!!! XXX */
-
-tag_def taglist_sgi_indy[] = {
-	{TAG(machtype, ULONGSIZE), TAGVAL(machtype_SGI_INDY)},
-	{TAG(machgroup, ULONGSIZE), TAGVAL(machgroup_SGI)},
-	{TAG(memlower, ULONGSIZE), TAGVAL(memlower_SGI_INDY)},
-	{TAG(cputype, ULONGSIZE), TAGVAL(cputype_SGI_INDY)},
-	{TAG(tlb_entries, ULONGSIZE), TAGVAL(tlb_entries_SGI_INDY)},
-	{TAG(vram_base, ULONGSIZE), TAGVAL(dummy_SGI_INDY)},
-	{TAG(drive_info, DRVINFOSIZE), TAGVAL(dummy_dinfo_SGI_INDY)},
-	{TAG(mount_root_rdonly, ULONGSIZE), TAGVAL(dummy_SGI_INDY)},
-	{TAG(command_line, CL_SIZE), TAGVAL(arcs_cmdline[0])},
-	{TAG(dummy, 0), NULL}
-	/* XXX COLOSTOMY BAG!!!! XXX */
-};
-
-__initfunc(void prom_setup_archtags(void))
-{
-	tag_def *tdp = &taglist_sgi_indy[0];
-	tag *tp;
-
-	tp = (tag *) (mips_memory_upper - sizeof(tag));
-	while(tdp->t.tag != tag_dummy) {
-		unsigned long size;
-		char *d;
-
-		*tp = tdp->t;
-		size = tp->size;
-		d = (char *) tdp->d;
-		tp = (tag *)(((unsigned long)tp) - (tp->size));
-		if(size)
-			memcpy(tp, d, size);
-
-		tp--;
-		tdp++;
-	}
-	*tp = tdp->t; /* copy last dummy element over */
-}
diff -u --recursive --new-file v2.3.8/linux/arch/mips/sgi/prom/time.c linux/arch/mips/sgi/prom/time.c
--- v2.3.8/linux/arch/mips/sgi/prom/time.c	Tue Oct 20 13:52:55 1998
+++ linux/arch/mips/sgi/prom/time.c	Wed Dec 31 16:00:00 1969
@@ -1,19 +0,0 @@
-/*
- * time.c: Extracting time information from ARCS prom.
- *
- * Copyright (C) 1996 David S. Miller (d...@engr.sgi.com)
- *
- * $Id: time.c,v 1.2 1998/03/27 08:53:49 ralf Exp $
- */
-#include <linux/init.h>
-#include <asm/sgialib.h>
-
-__initfunc(struct linux_tinfo *prom_gettinfo(void))
-{
-	return romvec->get_tinfo();
-}
-
-__initfunc(unsigned long prom_getrtime(void))
-{
-	return romvec->get_rtime();
-}
diff -u --recursive --new-file v2.3.8/linux/arch/mips/sgi/prom/tree.c linux/arch/mips/sgi/prom/tree.c
--- v2.3.8/linux/arch/mips/sgi/prom/tree.c	Tue Oct 20 13:52:55 1998
+++ linux/arch/mips/sgi/prom/tree.c	Wed Dec 31 16:00:00 1969
@@ -1,109 +0,0 @@
-/*
- * tree.c: PROM component device tree code.
- *
- * Copyright (C) 1996 David S. Miller (d...@engr.sgi.com)
- *
- * $Id: tree.c,v 1.2 1998/03/27 08:53:49 ralf Exp $
- */
-#include <linux/init.h>
-#include <asm/sgialib.h>
-
-#define DEBUG_PROM_TREE
-
-__initfunc(pcomponent *prom_getsibling(pcomponent *this))
-{
-	if(this == PROM_NULL_COMPONENT)
-		return PROM_NULL_COMPONENT;
-	return romvec->next_component(this);
-}
-
-__initfunc(pcomponent *prom_getchild(pcomponent *this))
-{
-	return romvec->child_component(this);
-}
-
-__initfunc(pcomponent *prom_getparent(pcomponent *child))
-{
-	if(child == PROM_NULL_COMPONENT)
-		return PROM_NULL_COMPONENT;
-	return romvec->parent_component(child);
-}
-
-__initfunc(long prom_getcdata(void *buffer, pcomponent *this))
-{
-	return romvec->component_data(buffer, this);
-}
-
-__initfunc(pcomponent *prom_childadd(pcomponent *this, pcomponent *tmp, void *data))
-{
-	return romvec->child_add(this, tmp, data);
-}
-
-__initfunc(long prom_delcomponent(pcomponent *this))
-{
-	return romvec->comp_del(this);
-}
-
-__initfunc(pcomponent *prom_componentbypath(char *path))
-{
-	return romvec->component_by_path(path);
-}
-
-#ifdef DEBUG_PROM_TREE
-static char *classes[] = {
-	"system", "processor", "cache", "adapter", "controller", "peripheral",
-	"memory"
-};
-
-static char *types[] = {
-	"arc", "cpu", "fpu", "picache", "pdcache", "sicache", "sdcache", "sccache",
-	"memdev", "eisa adapter", "tc adapter", "scsi adapter", "dti adapter",
-	"multi-func adapter", "disk controller", "tp controller",
-	"cdrom controller", "worm controller", "serial controller",
-	"net controller", "display controller", "parallel controller",
-	"pointer controller", "keyboard controller", "audio controller",
-	"misc controller", "disk peripheral", "floppy peripheral",
-	"tp peripheral", "modem peripheral", "monitor peripheral",
-	"printer peripheral", "pointer peripheral", "keyboard peripheral",
-	"terminal peripheral", "line peripheral", "net peripheral",
-	"misc peripheral", "anonymous"
-};
-
-static char *iflags[] = {
-	"bogus", "read only", "removable", "console in", "console out",
-	"input", "output"
-};
-
-__initfunc(static void dump_component(pcomponent *p))
-{
-	prom_printf("[%p]:class<%s>type<%s>flags<%s>ver<%d>rev<%d>",
-		    p, classes[p->class], types[p->type],
-		    iflags[p->iflags], p->vers, p->rev);
-	prom_printf("key<%08lx>\n\tamask<%08lx>cdsize<%d>ilen<%d>iname<%s>\n",
-		    p->key, p->amask, (int)p->cdsize, (int)p->ilen, p->iname);
-}
-
-__initfunc(static void traverse(pcomponent *p, int op))
-{
-	dump_component(p);
-	if(prom_getchild(p))
-		traverse(prom_getchild(p), 1);
-	if(prom_getsibling(p) && op)
-		traverse(prom_getsibling(p), 1);
-}
-
-__initfunc(void prom_testtree(void))
-{
-	pcomponent *p;
-
-	p = prom_getchild(PROM_NULL_COMPONENT);
-	dump_component(p);
-	p = prom_getchild(p);
-	while(p) {
-		dump_component(p);
-		p = prom_getsibling(p);
-	}
-	prom_printf("press a key\n");
-	prom_getchar();
-}
-#endif
diff -u --recursive --new-file v2.3.8/linux/arch/mips/sni/Makefile linux/arch/mips/sni/Makefile
--- v2.3.8/linux/arch/mips/sni/Makefile	Tue Oct 20 13:52:55 1998
+++ linux/arch/mips/sni/Makefile	Fri Jun 25 17:40:13 1999
@@ -1,3 +1,4 @@
+# $Id: Makefile,v 1.3 1999/01/04 16:03:57 ralf Exp $
X #
X # Makefile for the SNI specific part of the kernel
X #
@@ -5,8 +6,6 @@
X # removes any old dependencies. DON'T put your own dependencies here
X # unless it's something special (ie not a .c file).
X #
-# $Id: Makefile,v 1.2 1997/12/20 13:27:14 ralf Exp $
-#
X 
X .S.s:
X 	$(CPP) $(CFLAGS) $< -o $*.s
@@ -15,7 +14,7 @@
X 
X all: sni.o
X O_TARGET := sni.o
-O_OBJS	 := hw-access.o int-handler.o io.o pci.o pcimt_scache.o reset.o setup.o
+O_OBJS	 := int-handler.o io.o pci.o pcimt_scache.o reset.o setup.o
X 
X int-handler.o: int-handler.S
X 
diff -u --recursive --new-file v2.3.8/linux/arch/mips/sni/hw-access.c linux/arch/mips/sni/hw-access.c
--- v2.3.8/linux/arch/mips/sni/hw-access.c	Tue Oct 20 13:52:55 1998
+++ linux/arch/mips/sni/hw-access.c	Wed Dec 31 16:00:00 1969
@@ -1,70 +0,0 @@
-/* $Id: hw-access.c,v 1.8 1998/09/16 22:50:46 ralf Exp $
- *
- * Low-level hardware access stuff for SNI RM200 PCI
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 1996, 1997, 1998 by Ralf Baechle
- */
-#include <linux/delay.h>
-#include <linux/init.h>
-#include <linux/kbd_ll.h>
-#include <linux/kbdcntrlr.h>
-#include <linux/kernel.h>
-#include <linux/linkage.h>
-#include <linux/types.h>
-#include <linux/mm.h>
-#include <asm/bootinfo.h>
-#include <asm/cachectl.h>
-#include <asm/dma.h>
-#include <asm/keyboard.h>
-#include <asm/io.h>
-#include <asm/irq.h>
-#include <asm/mc146818rtc.h>
-#include <asm/pgtable.h>
-#include <asm/sni.h>
-
-#define KBD_STAT_IBF		0x02	/* Keyboard input buffer full */
-
-static unsigned char sni_read_input(void)
-{
-	return inb(KBD_DATA_REG);
-}
-
-static void sni_write_output(unsigned char val)
-{
-	int status;
-
-	do {
- status = inb(KBD_CNTL_REG);
-	} while (status & KBD_STAT_IBF);
-	outb(val, KBD_DATA_REG);
-}
-
-static void sni_write_command(unsigned char val)
-{
-	int status;
-
-	do {
- status = inb(KBD_CNTL_REG);
-	} while (status & KBD_STAT_IBF);
-	outb(val, KBD_CNTL_REG);
-}
-
-static unsigned char sni_read_status(void)
-{
-	return inb(KBD_STATUS_REG);
-}
-
-__initfunc(void sni_rm200_keyboard_setup(void))
-{
-	kbd_read_input = sni_read_input;
-	kbd_write_output = sni_write_output;
-	kbd_write_command = sni_write_command;
-	kbd_read_status = sni_read_status;
-	request_irq(PCIMT_KEYBOARD_IRQ, keyboard_interrupt,
-	            0, "keyboard", NULL);
-	request_region(0x60, 16, "keyboard");
-}
diff -u --recursive --new-file v2.3.8/linux/arch/mips/sni/int-handler.S linux/arch/mips/sni/int-handler.S
--- v2.3.8/linux/arch/mips/sni/int-handler.S	Tue Oct 20 13:52:55 1998
+++ linux/arch/mips/sni/int-handler.S	Fri Jun 25 17:40:13 1999
@@ -1,17 +1,22 @@
-/* $Id: int-handler.S,v 1.4 1998/05/07 14:17:47 ralf Exp $
+/* $Id: int-handler.S,v 1.4 1999/01/04 16:03:58 ralf Exp $
X  *
X  * SNI RM200 PCI specific interrupt handler code.
X  *
X  * Copyright (C) 1994 - 1997 by Ralf Baechle
X  */
X #include <asm/asm.h>
-#include <linux/config.h>
X #include <asm/mipsconfig.h>
X #include <asm/mipsregs.h>
X #include <asm/regdef.h>
X #include <asm/sni.h>
X #include <asm/stackframe.h>
X 
+/* The PCI ASIC has the nasty property that it may delay writes if it is busy.
+   As a consequence from writes that have not graduated when we exit from the
+   interrupt handler we might catch a spurious interrupt.  To avoid this we
+   force the PCI ASIC to graduate all writes by executing a read from the
+   PCI bus.  */
+
X 		.set	noreorder
X 		.set	noat
X 		.align	5
@@ -20,34 +25,38 @@
X 		CLI
X 		.set	at
X 
-		lb	t0,led_cache
-		addiu	t0,1
-		sb	t0,led_cache
-		sb	t0,PCIMT_CSLED
+		/* Blinken light ...  */
+		lb	t0, led_cache
+		addiu	t0, 1
+		sb	t0, led_cache
+		sb	t0, PCIMT_CSLED			# write only register
X 		.data
X led_cache:	.byte	0
X 		.text
X 
-		mfc0	t0,CP0_STATUS
-		mfc0	t1,CP0_CAUSE
-		and	t0,t1
-
-		 andi	t1,t0,0x0800			# hardware interrupt 1
-		bnez	t1,hwint1
-		 andi	t1,t0,0x4000			# hardware interrupt 4
-		bnez	t1,eth_int
-
-		 andi	t1,t0,0x1000			# hardware interrupt 2
-		bnez	t1,hwint2
-		 andi	t1,t0,0x2000			# hardware interrupt 3
-		bnez	t1,hwint3
-		 andi	t1,t0,0x8000			# hardware interrupt 5
-		bnez	t1,hwint5
-		 andi	t1,t0,0x0400			# hardware interrupt 0
-		bnez	t1,hwint0
+		mfc0	t0, CP0_STATUS
+		mfc0	t1, CP0_CAUSE
+		and	t0, t1
+
+		/* The following interrupt dispatch tests for hwint 1 /
+		   EISA bridge first such that the timer interrupt get the
+		   highest priority.  */
+		 andi	t1, t0, 0x0800			# hardware interrupt 1
+		bnez	t1, hwint1
+		 andi	t1, t0, 0x4000			# hardware interrupt 4
+		bnez	t1, hwint4
+
+		 andi	t1, t0, 0x1000			# hardware interrupt 2
+		bnez	t1, hwint2
+		 andi	t1, t0, 0x2000			# hardware interrupt 3
+		bnez	t1, hwint3
+		 andi	t1, t0, 0x8000			# hardware interrupt 5
+		bnez	t1, hwint5
+		 andi	t1, t0, 0x0400			# hardware interrupt 0
+		bnez	t1, hwint0
X 		 nop
X 
-		j	spurious_interrupt		# Nothing up ...
+		j	return				# spurious interrupt
X 		 nop
X 
X  ##############################################################################
@@ -57,146 +66,61 @@
X 
X  /* ------------------------------------------------------------------------ */
X 
-hwint1:		lbu	t0,PCIMT_CSITPEND
-
-		 andi	t1,t0,0x20
-		bnez	t1,eisa_int
-
-#ifdef CONFIG_SCSI_NCR53C8XX
-		 andi	t1,t0,0x40
-		beqz	t1,scsi_int
-#endif
-		 nop
-
-		j	spurious_interrupt
-		 nop
-
- /* ------------------------------------------------------------------------ */
-
-hwint0:		lbu	t0,PCIMT_CSITPEND
-
-		 andi	t1,t0,0x01
-		beqz	t1,int2
+/* hwint1 deals with EISA and SCSI interrupts.  */
+hwint1:		lbu	s0, PCIMT_CSITPEND
X 
-go_spurious:	j	spurious_interrupt		# we got fooled
+		andi	t1, s0, 0x20
+		beqz	t1, 1f
+		 andi	s1, s0, 0x40
+		lbu	a0, PCIMT_INT_ACKNOWLEDGE	# IACK cycle
+		xori	t0, a0, 0xff
+		beqz	t0, 1f				# spurious interrupt?
X 		 nop
+		jal	i8259_do_irq			# call real handler
+		 move	a1, sp
X 
-eisa_int:	lui	s0,%hi(SNI_PORT_BASE)
-		li	a0,0x0f
-		sb	a0,%lo(SNI_PORT_BASE+0x20)(s0)	# poll command
-		lb	a0,%lo(SNI_PORT_BASE+0x20)(s0)	# read result
-		bgtz	a0,poll_second
-		 andi	a0,7
-		beq	a0,2,poll_second		# cascade?
-		 li	s1,1
-		/*
-		 * Acknowledge first pic
-		 */
- lb t2,%lo(SNI_PORT_BASE+0x21)(s0)
-		lui	s4,%hi(cache_21)
-		lb	t0,%lo(cache_21)(s4)
-		sllv	s1,s1,a0
-		or	t0,s1
-		sb	t0,%lo(cache_21)(s4)
-		sb	t0,%lo(SNI_PORT_BASE+0x21)(s0)
-		li	t2,0x20
-		sb	t2,%lo(SNI_PORT_BASE+0x20)(s0)
-		/*
-		 * Now call the real handler
-		 */
+1:		bnez	s1, 1f
+		 li	a0, PCIMT_IRQ_SCSI
X 		jal	do_IRQ
-		 move	a1,sp
-		/*
-		 * Unblock first pic
-		 */
-		lbu	t1,%lo(SNI_PORT_BASE+0x21)(s0)
-		lb	t1,%lo(cache_21)(s4)
-		nor	s1,zero,s1
-		and	t1,s1
-		sb	t1,%lo(cache_21)(s4)
-		j	ret_from_irq
-		 sb	t1,%lo(SNI_PORT_BASE+0x21)(s0)
+		 move	a1, sp
X 
-		/*
-		 * Cascade interrupt from second PIC
-		 */
-		.align	5
-poll_second:	li	a0,0x0f
-		sb	a0,%lo(SNI_PORT_BASE+0xa0)(s0)	# poll command
-		lb	a0,%lo(SNI_PORT_BASE+0xa0)(s0)	# read result
-		bgtz	a0,go_spurious
-		 andi	a0,7
-		/*
-		 * Acknowledge second pic
-		 */
- lbu t2,%lo(SNI_PORT_BASE+0xa1)(s0)
-		lui	s4,%hi(cache_A1)
-		lb	t3,%lo(cache_A1)(s4)
-		sllv	s1,s1,a0
-		or	t3,s1
-		sb	t3,%lo(cache_A1)(s4)
-		sb	t3,%lo(SNI_PORT_BASE+0xa1)(s0)
-		li	t3,0x20
-		sb	t3,%lo(SNI_PORT_BASE+0xa0)(s0)
-		sb	t3,%lo(SNI_PORT_BASE+0x20)(s0)
-		/*
-		 * Now call the real handler
-		 */
- addiu a0,8
-		jal	do_IRQ
-		 move	a1,sp
-		/*
-		 * Unblock second pic
-		 */
-		lb	t1,%lo(SNI_PORT_BASE+0xa1)(s0)
-		lb	t1,%lo(cache_A1)(s4)
-		subu	t0,1
-		nor	s1,zero,s1
-		and	t1,t1,s1
-		sb	t1,%lo(cache_A1)(s4)
+1:		lui	t0, %hi(PCIMT_CSITPEND)
X 		j	ret_from_irq
-		 sb	t1,%lo(SNI_PORT_BASE+0xa1)(s0)
-
-/*
- * ... check if we were interrupted by the Lance ...
- */
-eth_int:	mfc0	s0,CP0_STATUS
-		ori	t0,s0,0x4000
-		xori	t0,0x4000
-		mtc0	t0,CP0_STATUS
+		 lbu	zero, %lo(PCIMT_CSITPEND)(t0)
X 
-		li	a0,PCIMT_IRQ_ETHERNET
-		jal	do_IRQ
-		 move	a1,sp
+ /* ------------------------------------------------------------------------ */
X 
-		mtc0	s0,CP0_STATUS
+/* hwint0 should deal with MP agent, ASIC PCI, EISA NMI and debug
+   button interrupts.  */
+hwint0:		PANIC("Received int0 but no handler yet ...\n")
+1:		j	1b
+		 nop
X 
-		j	ret_from_irq
+go_spurious:	j	spurious_interrupt		# we got fooled
X 		 nop
X 
-#ifdef CONFIG_SCSI_NCR53C8XX
+/* hwint4 is used for only the onboard PCnet 32.  */
+hwint4:		mfc0	s0, CP0_STATUS
+		ori	t0, s0, 0x4000
+		xori	t0, 0x4000
+		mtc0	t0, CP0_STATUS
X 
-/*
- * ... check if we were interrupted by the NCR ...
- */
-scsi_int:	li	a0,PCIMT_IRQ_SCSI
+		li	a0, PCIMT_IRQ_ETHERNET
X 		jal	do_IRQ
-		 move	a1,sp
-		j	ret_from_irq
-		 nop
-
-#endif /* CONFIG_SCSI_NCR53C8XX */
+		 move	a1, sp
X 
-pci_int:	PANIC("Received PCI interrupt but no handler yet ...\n")
-1:		j	1b
-		 nop
+		mtc0	s0, CP0_STATUS
X 
-int2:		PANIC("Received int2 but no handler yet ...\n")
-1:		j	1b
+		j	ret_from_irq
X 		 nop
X 
+/* This interrupt was used for the com1 console on the first prototypes.  */
X hwint2:		PANIC("hwint2 and no handler yet")
+
+/* hwint3 should deal with the PCI A - D interrupts.  */
X hwint3:		PANIC("hwint3 and no handler yet")
+
+/* hwint5 is the r4k count / compare interrupt  */
X hwint5:		PANIC("hwint5 and no handler yet")
X 
X 		END(sni_rm200_pci_handle_int)
diff -u --recursive --new-file v2.3.8/linux/arch/mips/sni/io.c linux/arch/mips/sni/io.c
--- v2.3.8/linux/arch/mips/sni/io.c	Tue Oct 20 13:52:55 1998
+++ linux/arch/mips/sni/io.c	Fri Jun 25 17:40:13 1999
@@ -1,11 +1,10 @@
-/*
+/* $Id: io.c,v 1.3 1999/01/04 16:03:58 ralf Exp $
+ *
X  * This file is subject to the terms and conditions of the GNU General Public
X  * License.  See the file "COPYING" in the main directory of this archive
X  * for more details.
X  *
X  * Low level I/O functions for SNI.
- *
- * $Id: io.c,v 1.2 1998/03/27 08:53:50 ralf Exp $
X  */
X #include <linux/string.h>
X #include <asm/mipsconfig.h>
@@ -14,46 +13,42 @@
X #include <asm/spinlock.h>
X #include <asm/sni.h>
X 
-unsigned char sni_map_isa_cache;
-
-#define unused __attribute__((unused))
-
-/*
- * The PCIMT_CSMAPISA is shared by all processors; we need locking.
- *
- * XXX It's legal to use all the I/O memory access functions in interrupt
- * code, so we need to use the _irq locking stuff which may result in
- * significant IRQ latencies.
- */
-static spinlock_t csmapisa_lock unused = SPIN_LOCK_UNLOCKED;
-
X /*
X  * Urgs...  We only can see a 16mb window of the 4gb EISA address space
X  * at PCIMT_EISA_BASE.  Maladia segmentitis ...
X  *
- * XXX Check out if accessing PCIMT_CSMAPISA really is slow.
- * For now assume so.
+ * To avoid locking and all the related headacke we implement this such
+ * that accessing the bus address space nests, so we're treating this
+ * correctly even for interrupts.  This is going to suck seriously for
+ * the SMP members of the RM family.
+ *
+ * Making things worse the PCIMT_CSMAPISA register resides on the X bus with
+ * it's unbeatable 1.4 mb/s transfer rate.
X  */
-static inline void update_isa_cache(unsigned long address)
+
+static inline void eisa_map(unsigned long address)
X {
X 	unsigned char upper;
X 
X 	upper = address >> 24;
-	if (sni_map_isa_cache != upper) {
-		sni_map_isa_cache = upper;
-		*(volatile unsigned char *)PCIMT_CSMAPISA = ~upper;
-	}
+	*(volatile unsigned char *)PCIMT_CSMAPISA = ~upper;
X }
X 
+#define save_eisa_map()							\
+	(*(volatile unsigned char *)PCIMT_CSMAPISA)
+#define restore_eisa_map(val)						\
+	do { (*(volatile unsigned char *)PCIMT_CSMAPISA) = val; } while(0)
+
X static unsigned char sni_readb(unsigned long addr)
X {
X 	unsigned char res;
+	unsigned int save_map;
X 
-	spin_lock_irq(&csmapisa_lock);
-	update_isa_cache(addr);
+	save_map = save_eisa_map();
+	eisa_map(addr);
X 	addr &= 0xffffff;
X 	res = *(volatile unsigned char *) (PCIMT_EISA_BASE + addr);
-	spin_unlock_irq(&csmapisa_lock);
+	restore_eisa_map(save_map);
X 
X 	return res;
X }
@@ -61,12 +56,13 @@
X static unsigned short sni_readw(unsigned long addr)
X {
X 	unsigned short res;
+	unsigned int save_map;
X 
-	spin_lock_irq(&csmapisa_lock);
-	update_isa_cache(addr);
+	save_map = save_eisa_map();
+	eisa_map(addr);
X 	addr &= 0xffffff;
X 	res = *(volatile unsigned char *) (PCIMT_EISA_BASE + addr);
-	spin_unlock_irq(&csmapisa_lock);
+	restore_eisa_map(save_map);
X 
X 	return res;
X }
@@ -74,101 +70,111 @@
X static unsigned int sni_readl(unsigned long addr)
X {
X 	unsigned int res;
+	unsigned int save_map;
X 
-	spin_lock_irq(&csmapisa_lock);
-	update_isa_cache(addr);
+	save_map = save_eisa_map();
+	eisa_map(addr);
X 	addr &= 0xffffff;
X 	res = *(volatile unsigned char *) (PCIMT_EISA_BASE + addr);
-	spin_unlock_irq(&csmapisa_lock);
+	restore_eisa_map(save_map);
X 
X 	return res;
X }
X 
X static void sni_writeb(unsigned char val, unsigned long addr)
X {
-	spin_lock_irq(&csmapisa_lock);
-	update_isa_cache(addr);
+	unsigned int save_map;
+
+	save_map = save_eisa_map();
+	eisa_map(addr);
X 	addr &= 0xffffff;
X 	*(volatile unsigned char *) (PCIMT_EISA_BASE + addr) = val;
-	spin_unlock_irq(&csmapisa_lock);
+	restore_eisa_map(save_map);
X }
X 
X static void sni_writew(unsigned short val, unsigned long addr)
X {
-	spin_lock_irq(&csmapisa_lock);
-	update_isa_cache(addr);
+	unsigned int save_map;
+
+	save_map = save_eisa_map();
+	eisa_map(addr);
X 	addr &= 0xffffff;
X 	*(volatile unsigned char *) (PCIMT_EISA_BASE + addr) = val;
-	spin_unlock_irq(&csmapisa_lock);
+	restore_eisa_map(save_map);
X }
X 
X static void sni_writel(unsigned int val, unsigned long addr)
X {
-	spin_lock_irq(&csmapisa_lock);
-	update_isa_cache(addr);
+	unsigned int save_map;
+
+	save_map = save_eisa_map();
+	eisa_map(addr);
X 	addr &= 0xffffff;
X 	*(volatile unsigned char *) (PCIMT_EISA_BASE + addr) = val;
-	spin_unlock_irq(&csmapisa_lock);
+	restore_eisa_map(save_map);
X }
X 
X static void sni_memset_io(unsigned long addr, int val, unsigned long len)
X {
X 	unsigned long waddr;
+	unsigned int save_map;
X 
+	save_map = save_eisa_map();
X 	waddr = PCIMT_EISA_BASE | (addr & 0xffffff);
-	spin_lock_irq(&csmapisa_lock);
X 	while(len) {
X 		unsigned long fraglen;
X 
X 		fraglen = (~addr + 1) & 0xffffff;
X 		fraglen = (fraglen < len) ? fraglen : len;
-		update_isa_cache(addr);
+		eisa_map(addr);
X 		memset((char *)waddr, val, fraglen);
X 		addr += fraglen;
X 		waddr = waddr + fraglen - 0x1000000;
X 		len -= fraglen;
X 	}
-	spin_unlock_irq(&csmapisa_lock);
+	restore_eisa_map(save_map);
X }
X 
X static void sni_memcpy_fromio(unsigned long to, unsigned long from, unsigned long len)
X {
X 	unsigned long waddr;
+	unsigned int save_map;
X 
+	save_map = save_eisa_map();
X 	waddr = PCIMT_EISA_BASE | (from & 0xffffff);
-	spin_lock_irq(&csmapisa_lock);
X 	while(len) {
X 		unsigned long fraglen;
X 
X 		fraglen = (~from + 1) & 0xffffff;
X 		fraglen = (fraglen < len) ? fraglen : len;
-		update_isa_cache(from);
+		eisa_map(from);
X 		memcpy((void *)to, (void *)waddr, fraglen);
X 		to += fraglen;
X 		from += fraglen;
X 		waddr = waddr + fraglen - 0x1000000;
X 		len -= fraglen;
X 	}
-	spin_unlock_irq(&csmapisa_lock);
+	restore_eisa_map(save_map);
X }
X 
X static void sni_memcpy_toio(unsigned long to, unsigned long from, unsigned long len)
X {
X 	unsigned long waddr;
+	unsigned int save_map;
X 
+	save_map = save_eisa_map();
X 	waddr = PCIMT_EISA_BASE | (to & 0xffffff);
-	spin_lock_irq(&csmapisa_lock);
X 	while(len) {
X 		unsigned long fraglen;
X 
X 		fraglen = (~to + 1) & 0xffffff;
X 		fraglen = (fraglen < len) ? fraglen : len;
-		update_isa_cache(to);
+		eisa_map(to);
X 		memcpy((char *)to + PCIMT_EISA_BASE, (void *)from, fraglen);
X 		to += fraglen;
X 		from += fraglen;
X 		waddr = waddr + fraglen - 0x1000000;
X 		len -= fraglen;
X 	}
-	spin_unlock_irq(&csmapisa_lock);
+	restore_eisa_map(save_map);
X }
diff -u --recursive --new-file v2.3.8/linux/arch/mips/sni/pci.c linux/arch/mips/sni/pci.c
--- v2.3.8/linux/arch/mips/sni/pci.c	Tue Oct 20 13:52:55 1998
+++ linux/arch/mips/sni/pci.c	Fri Jun 25 17:40:13 1999
@@ -1,4 +1,4 @@
-/* $Id: pci.c,v 1.6 1998/05/07 14:17:48 ralf Exp $
+/* $Id: pci.c,v 1.7 1999/01/04 16:03:58 ralf Exp $
X  *
X  * This file is subject to the terms and conditions of the GNU General Public
X  * License.  See the file "COPYING" in the main directory of this archive
@@ -9,6 +9,7 @@
X  * Copyright (C) 1997, 1998 Ralf Baechle
X  */
X #include <linux/config.h>
+#include <linux/kernel.h>
X #include <linux/pci.h>
X #include <linux/types.h>
X #include <asm/byteorder.h>
@@ -28,13 +29,37 @@
X 
X static void sni_rm200_pcibios_fixup (void)
X {
-	/*
-	 * TODO: Fix PCI_INTERRUPT_LINE register for onboard cards.
-	 * Take care of RM300 revision D boards for where the network
-	 * slot became an ordinary PCI slot.
-	 */
-	pcibios_write_config_byte(0, PCI_DEVFN(1, 0), PCI_INTERRUPT_LINE,
-	                          PCIMT_IRQ_SCSI);
+	struct pci_dev *dev;
+
+	for (dev=pci_devices; dev; dev=dev->next) {
+		/*
+		 * TODO: Take care of RM300 revision D boards for where the
+		 * network slot became an ordinary PCI slot.
+		 */
+		if (dev->devfn == PCI_DEVFN(1, 0)) {
+			/* Evil hack ...  */
+			set_cp0_config(CONF_CM_CMASK, CONF_CM_CACHABLE_NO_WA);
+			dev->irq = PCIMT_IRQ_SCSI;
+			continue;
+		}
+		if (dev->devfn == PCI_DEVFN(2, 0)) {
+			dev->irq = PCIMT_IRQ_ETHERNET;
+			continue;
+		}
+
+		switch(dev->irq) {
+		case 1 ... 4:
+			dev->irq += PCIMT_IRQ_INTA - 1;
+			break;
+		case 0:
+			break;
+		default:
+			printk("PCI device on bus %d, dev %d, function %d "
+			       "impossible interrupt configured.\n",
+			       dev->bus->number, PCI_SLOT(dev->devfn),
+			       PCI_SLOT(dev->devfn));
+		}
+	}
X }
X 
X /*
diff -u --recursive --new-file v2.3.8/linux/arch/mips/sni/pcimt_scache.c linux/arch/mips/sni/pcimt_scache.c
--- v2.3.8/linux/arch/mips/sni/pcimt_scache.c	Tue Oct 20 13:52:55 1998
+++ linux/arch/mips/sni/pcimt_scache.c	Fri Jun 25 17:40:13 1999
@@ -1,35 +1,38 @@
-/*
+/* $Id: pcimt_scache.c,v 1.4 1999/01/04 16:03:59 ralf Exp $
+ *
X  * arch/mips/sni/pcimt_scache.c
X  *
X  * This file is subject to the terms and conditions of the GNU General Public
X  * License.  See the file "COPYING" in the main directory of this archive
X  * for more details.
X  *
- * Copyright (c) 1997 by Ralf Baechle
- *
- * $Id: pcimt_scache.c,v 1.2 1998/05/28 03:18:02 ralf Exp $
+ * Copyright (c) 1997, 1998 by Ralf Baechle
X  */
X #include <linux/init.h>
X #include <linux/kernel.h>
X #include <asm/bcache.h>
X #include <asm/sni.h>
X 
+#define cacheconf (*(volatile unsigned int *)PCIMT_CACHECONF)
+#define invspace (*(volatile unsigned int *)PCIMT_INVSPACE)
+
X __initfunc(void sni_pcimt_sc_init(void))
X {
-	unsigned int cacheconf, sc_size;
+	unsigned int scsiz, sc_size;
X 
-	cacheconf = *(volatile unsigned int *)PCIMT_CACHECONF;
-	if ((cacheconf & 7) == 0) {
-		printk("No second level cache detected\n");
-		printk("WARNING: not activating second level cache, "
-		       "tell ra...@gnu.org\n");
+	scsiz = cacheconf & 7;
+	if (scsiz == 0) {
+		printk("Second level cache is deactived.\n");
X 		return;
X 	}
-	if ((cacheconf & 7) >= 6) {
-		printk("Invalid second level cache size detected\n");
+	if (scsiz >= 6) {
+		printk("Invalid second level cache size configured, "
+		       "deactivating second level cache.\n");
+		cacheconf = 0;
X 		return;
X 	}
-	
-	sc_size = 128 << (cacheconf & 7);
-	printk("%dkb second level cache detected.\n", sc_size);
+
+	sc_size = 128 << scsiz;
+	printk("%dkb second level cache detected, deactivating.\n", sc_size);
+	cacheconf = 0;
X }
diff -u --recursive --new-file v2.3.8/linux/arch/mips/sni/setup.c linux/arch/mips/sni/setup.c
--- v2.3.8/linux/arch/mips/sni/setup.c	Tue Oct 20 13:52:55 1998
+++ linux/arch/mips/sni/setup.c	Fri Jun 25 17:40:13 1999
@@ -1,4 +1,4 @@
-/* $Id: setup.c,v 1.13 1998/08/17 13:57:45 ralf Exp $
+/* $Id: setup.c,v 1.10 1999/01/04 16:03:59 ralf Exp $
X  *
X  * Setup pointers to hardware-dependent routines.
X  *
@@ -17,6 +17,11 @@
X #include <linux/interrupt.h>
X #include <linux/timex.h>
X #include <linux/pci.h>
+#include <linux/mc146818rtc.h>
+#include <linux/console.h>
+#include <linux/fb.h>
+#include <linux/pc_keyb.h>
+
X #include <asm/bcache.h>
X #include <asm/bootinfo.h>
X #include <asm/keyboard.h>
@@ -39,7 +44,6 @@
X static struct irqaction irq2  = { no_action, 0, 0, "cascade", NULL, NULL};
X 
X extern asmlinkage void sni_rm200_pci_handle_int(void);
-extern void sni_rm200_keyboard_setup(void);
X 
X extern void sni_machine_restart(char *command);
X extern void sni_machine_halt(void);
@@ -47,19 +51,20 @@
X 
X extern struct ide_ops std_ide_ops;
X extern struct rtc_ops std_rtc_ops;
+extern struct kbd_ops std_kbd_ops;
X 
X __initfunc(static void sni_irq_setup(void))
X {
X 	set_except_vector(0, sni_rm200_pci_handle_int);
X 	request_region(0x20,0x20, "pic1");
X 	request_region(0xa0,0x20, "pic2");	
-	setup_x86_irq(2, &irq2);
+	i8259_setup_irq(2, &irq2);
X 	/*
X 	 * IRQ0 seems to be the irq for PC style stuff.
X 	 * I don't know how to handle the debug button interrupt, so
X 	 * don't use this button yet or bad things happen ...
X 	 */
-	set_cp0_status(ST0_IM, IE_IRQ1 | IE_IRQ4);
+	set_cp0_status(ST0_IM, IE_IRQ1 | IE_IRQ3 | IE_IRQ4);
X }
X 
X void (*board_time_init)(struct irqaction *irq);
@@ -70,7 +75,7 @@
X 	outb_p(0x34,0x43);		/* binary, mode 2, LSB/MSB, ch 0 */
X 	outb_p(LATCH & 0xff , 0x40);	/* LSB */
X 	outb(LATCH >> 8 , 0x40);	/* MSB */
-	setup_x86_irq(0, irq);
+	i8259_setup_irq(0, irq);
X }
X 
X unsigned char aux_device_present;
@@ -132,7 +137,6 @@
X 
X 	irq_setup = sni_irq_setup;
X 	mips_io_port_base = SNI_PORT_BASE;
-	keyboard_setup = sni_rm200_keyboard_setup;
X 
X 	/*
X 	 * Setup (E)ISA I/O memory access stuff
@@ -165,6 +169,10 @@
X #ifdef CONFIG_BLK_DEV_IDE
X 	ide_ops = &std_ide_ops;
X #endif
-
+	conswitchp = &vga_con;
X 	rtc_ops = &std_rtc_ops;
+	kbd_ops = &std_kbd_ops;
+#ifdef CONFIG_PSMOUSE
+	aux_device_present = 0xaa;
+#endif
X }
diff -u --recursive --new-file v2.3.8/linux/arch/mips/tools/Makefile linux/arch/mips/tools/Makefile
--- v2.3.8/linux/arch/mips/tools/Makefile	Tue Oct 20 13:52:55 1998
+++ linux/arch/mips/tools/Makefile	Fri Jun 25 17:40:13 1999
@@ -3,7 +3,7 @@
X # Copyright (C) 1996 David S. Miller (d...@engr.sgi.com)
X # Copyright (C) 1997 Ralf Baechle (ra...@gnu.ai.mit.edu)
X #
-# $Id: Makefile,v 1.2 1997/09/23 06:23:49 ralf Exp $
+# $Id: Makefile,v 1.2 1997/12/01 17:57:41 ralf Exp $
X #
X TARGET	:= $(TOPDIR)/include/asm-$(ARCH)/offset.h
X 
diff -u --recursive --new-file v2.3.8/linux/arch/ppc/Makefile linux/arch/ppc/Makefile
--- v2.3.8/linux/arch/ppc/Makefile	Sat May 22 13:03:00 1999
+++ linux/arch/ppc/Makefile	Mon Jun 28 13:40:39 1999
@@ -22,7 +22,8 @@
X LINKFLAGS	= -T arch/ppc/vmlinux.lds -Ttext $(KERNELLOAD) -Bstatic
X CFLAGSINC	= -D__KERNEL__ -I$(TOPDIR)/include -D__powerpc__
X CFLAGS		:= $(CFLAGS) -D__powerpc__ -fsigned-char -msoft-float -pipe \
-		-fno-builtin -ffixed-r2 -Wno-uninitialized -mmultiple -mstring
+		-fno-builtin -ffixed-r2 -Wno-uninitialized -mmultiple \
+		-mstring
X CPP		= $(CC) -E $(CFLAGS)
X 
X ifdef CONFIG_8xx
@@ -30,8 +31,7 @@
X endif
X 
X ifdef CONFIG_PPC64
-CFLAGS := $(CFLAGS) -Wa,-mppc64bridge #-Wa,-mppc64
-#CFLAGS := $(CFLAGS) -Wa,-mppc64 -mpowerpc64
+CFLAGS := $(CFLAGS) -Wa,-mppc64bridge #-mpowerpc64
X endif
X 
X HEAD := arch/ppc/kernel/head.o
diff -u --recursive --new-file v2.3.8/linux/arch/ppc/apus_defconfig linux/arch/ppc/apus_defconfig
--- v2.3.8/linux/arch/ppc/apus_defconfig	Thu Feb 25 10:46:47 1999
+++ linux/arch/ppc/apus_defconfig	Sat Jun 26 08:34:19 1999
@@ -76,7 +76,7 @@
X CONFIG_BLK_DEV_IDE_PMAC=y
X CONFIG_BLK_DEV_IDEDMA_PMAC=y
X CONFIG_BLK_DEV_IDEDMA=y
-CONFIG_PMAC_IDEDMA_AUTO=y
+CONFIG_IDEDMA_PMAC_AUTO=y
X # CONFIG_IDE_CHIPSETS is not set
X 
X #
diff -u --recursive --new-file v2.3.8/linux/arch/ppc/chrpboot/Makefile linux/arch/ppc/chrpboot/Makefile
--- v2.3.8/linux/arch/ppc/chrpboot/Makefile	Mon Jun  7 12:11:51 1999
+++ linux/arch/ppc/chrpboot/Makefile	Mon Jun 28 13:40:39 1999
@@ -70,6 +70,9 @@
X 	./mknote > note
X 	$(OBJCOPY) $@ $@ --add-section=.note=note -R .comment
X 
+mknote: mknote.c
+	$(HOSTCC) $(HOSTCFLAGS) -o $@ mknote.c
+
X zImage.initrd: $(OBJS) initrd.o
X 	$(LD) $(LD_ARGS) -o $@ $(OBJS) initrd.o $(LIBS)
X 
diff -u --recursive --new-file v2.3.8/linux/arch/ppc/chrpboot/main.c linux/arch/ppc/chrpboot/main.c
--- v2.3.8/linux/arch/ppc/chrpboot/main.c	Mon Jun  7 12:11:51 1999
+++ linux/arch/ppc/chrpboot/main.c	Mon Jun 28 13:40:39 1999
@@ -19,12 +19,13 @@
X #define RAM_START	0x00000000
X #define RAM_END		(8<<20)
X 
-#define RAM_FREE	(6<<20)		/* after image of chrpboot */
+#define RAM_FREE	((unsigned long)(_end+0x1000)&~0xFFF)
X #define PROG_START	0x00010000
X 
X char *avail_ram;
X char *end_avail;
X 
+extern char _end[];
X extern char image_data[];
X extern int image_len;
X extern char initrd_data[];
@@ -47,8 +48,8 @@
X 	initrd_start = (RAM_END - initrd_size) & ~0xFFF;
X 	a1 = initrd_start;
X 	a2 = initrd_size;
-	printf("initial ramdisk at 0x%x (%u bytes)\n\r", initrd_start,
-	       initrd_size);
+	printf("initial ramdisk moving 0x%x <- 0x%x (%x bytes)\n\r", initrd_start,
+	       initrd_data,initrd_size);
X 	memcpy((char *)initrd_start, initrd_data, initrd_size);
X 	end_avail = (char *)initrd_start;
X     } else
@@ -56,7 +57,6 @@
X     im = image_data;
X     len = image_len;
X     dst = (void *) PROG_START;
-
X     if (im[0] == 0x1f && im[1] == 0x8b) {
X 	avail_ram = (char *)RAM_FREE;
X 	printf("gunzipping (0x%x <- 0x%x:0x%0x)...", dst, im, im+len);
diff -u --recursive --new-file v2.3.8/linux/arch/ppc/coffboot/Makefile linux/arch/ppc/coffboot/Makefile
--- v2.3.8/linux/arch/ppc/coffboot/Makefile	Sat May 22 13:03:00 1999
+++ linux/arch/ppc/coffboot/Makefile	Mon Jun 28 13:40:39 1999
@@ -3,7 +3,6 @@
X #
X # Paul Mackerras	January 1997
X 
-HOSTCC	= gcc
X HOSTCFLAGS = -O -I$(TOPDIR)/include
X 
X CC	= $(CROSS_COMPILE)gcc
diff -u --recursive --new-file v2.3.8/linux/arch/ppc/common_defconfig linux/arch/ppc/common_defconfig
--- v2.3.8/linux/arch/ppc/common_defconfig	Mon Jun  7 12:11:51 1999
+++ linux/arch/ppc/common_defconfig	Mon Jun 28 13:40:39 1999
@@ -81,13 +81,13 @@
X CONFIG_BLK_DEV_IDE_PMAC=y
X CONFIG_BLK_DEV_IDEDMA_PMAC=y
X CONFIG_BLK_DEV_IDEDMA=y
-CONFIG_PMAC_IDEDMA_AUTO=y
+CONFIG_IDEDMA_PMAC_AUTO=y
X # CONFIG_IDE_CHIPSETS is not set
X 
X #
X # Additional Block Devices
X #
-# CONFIG_BLK_DEV_LOOP is not set
+CONFIG_BLK_DEV_LOOP=y
X # CONFIG_BLK_DEV_NBD is not set
X # CONFIG_BLK_DEV_MD is not set
X CONFIG_BLK_DEV_RAM=y
@@ -131,6 +131,7 @@
X #
X # CONFIG_IPX is not set
X CONFIG_ATALK=m
+# CONFIG_DECNET is not set
X # CONFIG_X25 is not set
X # CONFIG_LAPB is not set
X # CONFIG_BRIDGE is not set
@@ -176,7 +177,8 @@
X # CONFIG_SCSI_AHA1542 is not set
X # CONFIG_SCSI_AHA1740 is not set
X CONFIG_SCSI_AIC7XXX=y
-# CONFIG_OVERRIDE_CMDS is not set
+# CONFIG_AIC7XXX_TCQ_ON_BY_DEFAULT is not set
+CONFIG_AIC7XXX_CMDS_PER_DEVICE=8
X CONFIG_AIC7XXX_PROC_STATS=y
X CONFIG_AIC7XXX_RESET_DELAY=15
X # CONFIG_SCSI_ADVANSYS is not set
@@ -311,7 +313,7 @@
X CONFIG_FB_MATROX=y
X # CONFIG_FB_MATROX_MILLENIUM is not set
X CONFIG_FB_MATROX_MYSTIQUE=y
-# CONFIG_FB_MATROX_G100 is not set
+CONFIG_FB_MATROX_G100=y
X # CONFIG_FB_MATROX_MULTIHEAD is not set
X # CONFIG_FB_ATY is not set
X # CONFIG_FB_VIRTUAL is not set
@@ -425,6 +427,7 @@
X CONFIG_MAC_PARTITION=y
X # CONFIG_SMD_DISKLABEL is not set
X # CONFIG_SOLARIS_X86_PARTITION is not set
+# CONFIG_SGI_DISKLABEL is not set
X # CONFIG_UNIXWARE_DISKLABEL is not set
X CONFIG_NLS=y
X 
@@ -464,6 +467,7 @@
X #
X CONFIG_SOUND=y
X CONFIG_DMASOUND=y
+# CONFIG_SOUND_CMPCI is not set
X # CONFIG_SOUND_ES1370 is not set
X # CONFIG_SOUND_ES1371 is not set
X # CONFIG_SOUND_SONICVIBES is not set
diff -u --recursive --new-file v2.3.8/linux/arch/ppc/config.in linux/arch/ppc/config.in
--- v2.3.8/linux/arch/ppc/config.in	Tue Jun  8 10:52:26 1999
+++ linux/arch/ppc/config.in	Mon Jun 28 13:40:39 1999
@@ -1,4 +1,4 @@
-# $Id: config.in,v 1.93 1999/05/14 22:36:58 cort Exp $
+# $Id: config.in,v 1.94 1999/06/25 11:00:07 davem Exp $
X # For a description of the syntax of this configuration file,
X # see the Configure script.
X #
@@ -65,7 +65,6 @@
X define_bool CONFIG_BINFMT_ELF y
X define_bool CONFIG_KERNEL_ELF y
X tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
-tristate 'Kernel support for JAVA binaries (obsolete)' CONFIG_BINFMT_JAVA
X 
X tristate 'Parallel port support' CONFIG_PARPORT
X if [ "$CONFIG_PARPORT" != "n" ]; then
@@ -176,7 +175,6 @@
X endmenu
X 
X source drivers/char/Config.in
-source drivers/usb/Config.in
X source fs/Config.in
X 
X mainmenu_option next_comment
diff -u --recursive --new-file v2.3.8/linux/arch/ppc/defconfig linux/arch/ppc/defconfig
--- v2.3.8/linux/arch/ppc/defconfig	Mon Jun  7 12:11:51 1999
+++ linux/arch/ppc/defconfig	Mon Jun 28 13:40:39 1999
@@ -35,7 +35,6 @@
X CONFIG_BINFMT_ELF=y
X CONFIG_KERNEL_ELF=y
X # CONFIG_BINFMT_MISC is not set
-# CONFIG_BINFMT_JAVA is not set
X # CONFIG_PARPORT is not set
X CONFIG_VGA_CONSOLE=y
X CONFIG_FB=y
@@ -81,13 +80,13 @@
X CONFIG_BLK_DEV_IDE_PMAC=y
X CONFIG_BLK_DEV_IDEDMA_PMAC=y
X CONFIG_BLK_DEV_IDEDMA=y
-CONFIG_PMAC_IDEDMA_AUTO=y
+CONFIG_IDEDMA_PMAC_AUTO=y
X # CONFIG_IDE_CHIPSETS is not set
X 
X #
X # Additional Block Devices
X #
-# CONFIG_BLK_DEV_LOOP is not set
+CONFIG_BLK_DEV_LOOP=y
X # CONFIG_BLK_DEV_NBD is not set
X # CONFIG_BLK_DEV_MD is not set
X CONFIG_BLK_DEV_RAM=y
@@ -131,6 +130,7 @@
X #
X # CONFIG_IPX is not set
X CONFIG_ATALK=m
+# CONFIG_DECNET is not set
X # CONFIG_X25 is not set
X # CONFIG_LAPB is not set
X # CONFIG_BRIDGE is not set
@@ -176,7 +176,8 @@
X # CONFIG_SCSI_AHA1542 is not set
X # CONFIG_SCSI_AHA1740 is not set
X CONFIG_SCSI_AIC7XXX=y
-# CONFIG_OVERRIDE_CMDS is not set
+# CONFIG_AIC7XXX_TCQ_ON_BY_DEFAULT is not set
+CONFIG_AIC7XXX_CMDS_PER_DEVICE=8
X CONFIG_AIC7XXX_PROC_STATS=y
X CONFIG_AIC7XXX_RESET_DELAY=15
X # CONFIG_SCSI_ADVANSYS is not set
@@ -311,7 +312,7 @@
X CONFIG_FB_MATROX=y
X # CONFIG_FB_MATROX_MILLENIUM is not set
X CONFIG_FB_MATROX_MYSTIQUE=y
-# CONFIG_FB_MATROX_G100 is not set
+CONFIG_FB_MATROX_G100=y
X # CONFIG_FB_MATROX_MULTIHEAD is not set
X # CONFIG_FB_ATY is not set
X # CONFIG_FB_VIRTUAL is not set
@@ -425,6 +426,7 @@
X CONFIG_MAC_PARTITION=y
X # CONFIG_SMD_DISKLABEL is not set
X # CONFIG_SOLARIS_X86_PARTITION is not set
+# CONFIG_SGI_DISKLABEL is not set
X # CONFIG_UNIXWARE_DISKLABEL is not set
X CONFIG_NLS=y
X 
@@ -464,12 +466,40 @@
X #
X CONFIG_SOUND=y
X CONFIG_DMASOUND=y
SHAR_EOF
true || echo 'restore of patch-2.3.9 failed'
fi
echo 'End of  part 09'
echo 'File patch-2.3.9 is continued in part 10'
echo 10 > _shar_seq_.tmp
exit 0