diff -Nru a/Documentation/DocBook/kernel-api.tmpl b/Documentation/DocBook/kernel-api.tmpl
--- a/Documentation/DocBook/kernel-api.tmpl Fri Feb 28 03:48:28 2003
+++ b/Documentation/DocBook/kernel-api.tmpl Sat Mar 1 05:50:59 2003
@@ -89,7 +89,11 @@
Memory Management in Linux
The Slab Cache
!Emm/slab.c
-
+
+ User Space Memory Access
+!Iinclude/asm-i386/uaccess.h
+!Iarch/i386/lib/usercopy.c
+
diff -Nru a/Documentation/filesystems/sysfs.txt b/Documentation/filesystems/sysfs.txt
--- a/Documentation/filesystems/sysfs.txt Tue Mar 11 10:20:18 2003
+++ b/Documentation/filesystems/sysfs.txt Tue Mar 18 10:09:49 2003
@@ -60,7 +60,7 @@
you publically humiliated and your code rewritten without notice.
-An attriubte definition is simply:
+An attribute definition is simply:
struct attribute {
char * name;
@@ -261,7 +261,7 @@
that point to the device's directory under root/.
drivers/ contains a directory for each device driver that is loaded
-for devices on that particular bus (this assmumes that drivers do not
+for devices on that particular bus (this assumes that drivers do not
span multiple bus types).
diff -Nru a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
--- a/Documentation/kernel-parameters.txt Sun Mar 16 22:33:11 2003
+++ b/Documentation/kernel-parameters.txt Tue Mar 18 08:49:00 2003
@@ -713,7 +713,6 @@
numbers ourselves, overriding
whatever the firmware may have
done.
-
usepirqmask [IA-32] Honor the possible IRQ mask
stored in the BIOS $PIR table. This is
needed on some systems with broken
@@ -721,6 +720,7 @@
and Omnibook XE3 notebooks. This will
have no effect if ACPI IRQ routing is
enabled.
+ noacpi [IA-32] Do not use ACPI for IRQ routing.
pcmv= [HW,PCMCIA] BadgePAD 4
diff -Nru a/Documentation/networking/e100.txt b/Documentation/networking/e100.txt
--- a/Documentation/networking/e100.txt Fri Oct 18 14:45:07 2002
+++ b/Documentation/networking/e100.txt Sun Mar 16 20:38:55 2003
@@ -1,7 +1,7 @@
Linux* Base Driver for the Intel(R) PRO/100 Family of Adapters
==============================================================
-September 16, 2002
+November 19, 2002
Contents
@@ -19,7 +19,7 @@
===============
This file describes the Linux* Base Driver for the Intel(R) PRO/100 Family of
-Adapters, version 2.1.x. This driver includes support for Itanium(TM)-based
+Adapters, version 2.2.x. This driver includes support for Itanium(TM)-based
systems.
@@ -94,8 +94,9 @@
Command Line Parameters
=======================
-The following optional parameters are used by entering them on the command
-line with the modprobe or insmod command using this syntax:
+If the driver is built as a module, the following optional parameters are
+used by entering them on the command line with the modprobe or insmod command
+using this syntax:
modprobe e100 [
PCM API
@@ -61,9 +63,6 @@
PCM Memory Managment
!Esound/core/pcm_memory.c
-
- SG-Buffer Helpers
-!Esound/core/pcm_sgbuf.c
Control/Mixer API
diff -Nru a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
--- a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl Tue Mar 11 10:20:19 2003
+++ b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl Thu Mar 20 08:41:10 2003
@@ -437,7 +437,7 @@
// (see "Management of Cards and Components")
static int __devinit snd_mychip_create(snd_card_t *card,
struct pci_device *pci,
- mychip_t *rchip)
+ mychip_t **rchip)
{
mychip_t *chip;
int err;
@@ -1377,6 +1377,8 @@
module_init(alsa_card_mychip_init)
module_exit(alsa_card_mychip_exit)
+
+ EXPORT_NO_SYMBOLS; /* for old kernels only */
]]>
@@ -1664,7 +1666,7 @@
chip->iobase_phys = pci_resource_start(pci, 0);
chip->iobase_virt = (unsigned long)
ioremap_nocache(chip->iobase_phys, 512);
- if ((chip->res_port = request_mem_region(chip->port, 512,
+ if ((chip->res_port = request_mem_region(chip->iobase_phys, 512,
"My Chip")) == NULL) {
printk(KERN_ERR "cannot allocate the memory region\n");
snd_mychip_free(chip);
@@ -2758,6 +2760,17 @@
+
+ ack callback
+
+ This callback is also not mandatory. This callback is called
+ when the appl_ptr is updated in read or write operations.
+ Some drivers like emu10k1-fx and cs46xx need to track the
+ current appl_ptr for the internal buffer, and this callback
+ is useful only for such a purpose.
+
+
+
page callback
@@ -2807,7 +2820,7 @@
- If you acquire a spinlock in the interrupt handler, and the
+ If you aquire a spinlock in the interrupt handler, and the
lock is used in other pcm callbacks, too, then you have to
release the lock before calling
snd_pcm_period_elapsed(), because
@@ -4467,8 +4480,7 @@
dma_private, return -EINVAL);
+ snd_pcm_sgbuf_t *sgbuf = (snd_pcm_sgbuf_t*)substream->dma_private;
]]>
diff -Nru a/Documentation/sound/alsa/serial-u16550.txt b/Documentation/sound/alsa/serial-u16550.txt
--- a/Documentation/sound/alsa/serial-u16550.txt Sun Sep 29 13:22:50 2002
+++ b/Documentation/sound/alsa/serial-u16550.txt Tue Feb 25 05:46:04 2003
@@ -2,7 +2,7 @@
Serial UART 16450/16550 MIDI driver
===================================
-The snd_adaptor module parameter allows you to select either:
+The adaptor module parameter allows you to select either:
0 - Roland Soundcanvas support (default)
1 - Midiator MS-124T support (1)
@@ -24,37 +24,35 @@
Usage example for simple serial converter:
/sbin/setserial /dev/ttyS0 none
- /sbin/modprobe snd-serial-u16550 snd_port=0x3f8 snd_irq=4 \
- snd_speed=115200
+ /sbin/modprobe snd-serial-u16550 port=0x3f8 irq=4 speed=115200
Usage example for Roland SoundCanvas with 4 MIDI ports:
/sbin/setserial /dev/ttyS0 none
- /sbin/modprobe snd-serial-u16550 snd_port=0x3f8 snd_irq=4 snd_outs=4
+ /sbin/modprobe snd-serial-u16550 port=0x3f8 irq=4 outs=4
-In MS-124T mode, one raw MIDI substream is supported (midiCnD0); the snd_outs
+In MS-124T mode, one raw MIDI substream is supported (midiCnD0); the outs
module parameter is automatically set to 1. The driver sends the same data to
-all four MIDI Out connectors. Set the A-B switch and the snd_speed module
+all four MIDI Out connectors. Set the A-B switch and the speed module
parameter to match (A=19200, B=9600).
Usage example for MS-124T, with A-B switch in A position:
/sbin/setserial /dev/ttyS0 none
- /sbin/modprobe snd-serial-u16550 snd_port=0x3f8 snd_irq=4 \
- snd_adaptor=1 snd_speed=19200
+ /sbin/modprobe snd-serial-u16550 port=0x3f8 irq=4 adaptor=1 \
+ speed=19200
In MS-124W S/A mode, one raw MIDI substream is supported (midiCnD0);
-the snd_outs module parameter is automatically set to 1. The driver sends
+the outs module parameter is automatically set to 1. The driver sends
the same data to all four MIDI Out connectors at full MIDI speed.
Usage example for S/A mode:
/sbin/setserial /dev/ttyS0 none
- /sbin/modprobe snd-serial-u16550 snd_port=0x3f8 snd_irq=4 \
- snd_adaptor=2
+ /sbin/modprobe snd-serial-u16550 port=0x3f8 irq=4 adaptor=2
In MS-124W M/B mode, the driver supports 16 ALSA raw MIDI substreams;
-the snd_outs module parameter is automatically set to 16. The substream
+the outs module parameter is automatically set to 16. The substream
number gives a bitmask of which MIDI Out connectors the data should be
sent to, with midiCnD1 sending to Out 1, midiCnD2 to Out 2, midiCnD4 to
Out 3, and midiCnD8 to Out 4. Thus midiCnD15 sends the data to all 4 ports.
@@ -67,8 +65,7 @@
Usage example for M/B mode:
/sbin/setserial /dev/ttyS0 none
- /sbin/modprobe snd-serial-u16550 snd_port=0x3f8 snd_irq=4 \
- snd_adaptor=3
+ /sbin/modprobe snd-serial-u16550 port=0x3f8 irq=4 adaptor=3
The MS-124W hardware's M/A mode is currently not supported. This mode allows
the MIDI Outs to act independently at double the aggregate throughput of M/B,
@@ -88,4 +85,4 @@
serial port. Similar to Roland Soundcanvas mode, F5 NN is used to select the
appropriate input or output stream (depending on the data direction).
Additionally, the CTS signal is used to regulate the data flow. The number of
-inputs is specified by the snd_ins parameter.
+inputs is specified by the ins parameter.
diff -Nru a/Documentation/sysrq.txt b/Documentation/sysrq.txt
--- a/Documentation/sysrq.txt Tue Feb 18 10:31:36 2003
+++ b/Documentation/sysrq.txt Mon Mar 17 21:33:20 2003
@@ -36,6 +36,10 @@
On other - If you know of the key combos for other architectures, please
let me know so I can add them to this section.
+On all - write a character to /proc/sysrq-trigger. eg:
+
+ echo t > /proc/sysrq-trigger
+
* What are the 'command' keys?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'r' - Turns off keyboard raw mode and sets it to XLATE.
diff -Nru a/MAINTAINERS b/MAINTAINERS
--- a/MAINTAINERS Thu Mar 6 09:07:03 2003
+++ b/MAINTAINERS Tue Mar 18 08:49:55 2003
@@ -728,7 +728,7 @@
GDT SCSI DISK ARRAY CONTROLLER DRIVER
P: Achim Leubner
-M: achim@vortex.de
+M: achim.leubner@intel.com
L: linux-scsi@vger.kernel.org
W: http://www.icp-vortex.com/
S: Supported
@@ -923,10 +923,11 @@
S: Supported
INTEL PRO/1000 GIGABIT ETHERNET SUPPORT
-P: Chris Leech
-M: christopher.leech@intel.com
+P: Jeb Cramer
+M: cramerj@intel.com
P: Scott Feldman
M: scott.feldman@intel.com
+W: http://sourceforge.net/projects/e1000/
S: Supported
INTERMEZZO FILE SYSTEM
diff -Nru a/Makefile b/Makefile
--- a/Makefile Mon Mar 17 13:36:41 2003
+++ b/Makefile Sat Mar 22 04:28:55 2003
@@ -1,7 +1,7 @@
VERSION = 2
PATCHLEVEL = 5
SUBLEVEL = 65
-EXTRAVERSION =
+EXTRAVERSION = -bk3
# *DOCUMENTATION*
# To see a list of typical targets execute "make help"
@@ -164,6 +164,8 @@
OBJCOPY = $(CROSS_COMPILE)objcopy
OBJDUMP = $(CROSS_COMPILE)objdump
AWK = awk
+RPM := $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \
+ else echo rpm; fi)
GENKSYMS = scripts/genksyms/genksyms
DEPMOD = /sbin/depmod
KALLSYMS = scripts/kallsyms
@@ -768,9 +770,7 @@
rm $(KERNELPATH) ; \
cd $(TOPDIR) ; \
$(CONFIG_SHELL) $(srctree)/scripts/mkversion > .version ; \
- RPM=`which rpmbuild`; \
- if [ -z "$$RPM" ]; then RPM=rpm; fi; \
- $$RPM -ta $(TOPDIR)/../$(KERNELPATH).tar.gz ; \
+ $(RPM) -ta $(TOPDIR)/../$(KERNELPATH).tar.gz ; \
rm $(TOPDIR)/../$(KERNELPATH).tar.gz
# Brief documentation of the typical targets used
diff -Nru a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
--- a/arch/arm/kernel/traps.c Thu Feb 6 11:28:41 2003
+++ b/arch/arm/kernel/traps.c Mon Mar 17 21:32:24 2003
@@ -208,12 +208,13 @@
NORET_TYPE void die(const char *str, struct pt_regs *regs, int err)
{
struct task_struct *tsk = current;
+ static int die_counter;
console_verbose();
spin_lock_irq(&die_lock);
bust_spinlocks(1);
- printk("Internal error: %s: %x\n", str, err);
+ printk("Internal error: %s: %x [#%d]\n", str, err, ++die_counter);
print_modules();
printk("CPU: %d\n", smp_processor_id());
show_regs(regs);
diff -Nru a/arch/i386/Kconfig b/arch/i386/Kconfig
--- a/arch/i386/Kconfig Sat Mar 8 14:50:37 2003
+++ b/arch/i386/Kconfig Mon Mar 17 21:33:21 2003
@@ -476,21 +476,6 @@
This is purely to save memory - each supported CPU adds
approximately eight kilobytes to the kernel image.
-# Common NUMA Features
-config NUMA
- bool "Numa Memory Allocation Support"
- depends on (HIGHMEM64G && (X86_NUMAQ || (X86_SUMMIT && ACPI && !ACPI_HT_ONLY))) || X86_PC
-
-config DISCONTIGMEM
- bool
- depends on NUMA
- default y
-
-config HAVE_ARCH_BOOTMEM_NODE
- bool
- depends on NUMA
- default y
-
config X86_TSC
bool
depends on (MWINCHIP3D || MWINCHIP2 || MCRUSOE || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || MK8 || MVIAC3_2) && !X86_NUMAQ
@@ -678,6 +663,30 @@
config X86_PAE
bool
depends on HIGHMEM64G
+ default y
+
+# Common NUMA Features
+config NUMA
+ bool "Numa Memory Allocation Support"
+ depends on SMP && HIGHMEM64G && (X86_PC || X86_NUMAQ || (X86_SUMMIT && ACPI && !ACPI_HT_ONLY))
+ default n if X86_PC
+ default y if (X86_NUMAQ || X86_SUMMIT)
+
+# Need comments to help the hapless user trying to turn on NUMA support
+comment "NUMA (NUMA-Q) requires SMP, 64GB highmem support"
+ depends on X86_NUMAQ && (!HIGHMEM64G || !SMP)
+
+comment "NUMA (Summit) requires SMP, 64GB highmem support, full ACPI"
+ depends on X86_SUMMIT && (!HIGHMEM64G || !ACPI || ACPI_HT_ONLY)
+
+config DISCONTIGMEM
+ bool
+ depends on NUMA
+ default y
+
+config HAVE_ARCH_BOOTMEM_NODE
+ bool
+ depends on NUMA
default y
config HIGHPTE
diff -Nru a/arch/i386/boot98/Makefile b/arch/i386/boot98/Makefile
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/arch/i386/boot98/Makefile Thu Mar 13 17:03:19 2003
@@ -0,0 +1,76 @@
+#
+# arch/i386/boot/Makefile
+#
+# 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 Linus Torvalds
+#
+
+# ROOT_DEV specifies the default root-device when making the image.
+# This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case
+# the default of FLOPPY is used by 'build'.
+
+ROOT_DEV := CURRENT
+
+# If you want to preset the SVGA mode, uncomment the next line and
+# set SVGA_MODE to whatever number you want.
+# Set it to -DSVGA_MODE=NORMAL_VGA if you just want the EGA/VGA mode.
+# The number is the same as you would ordinarily press at bootup.
+
+SVGA_MODE := -DSVGA_MODE=NORMAL_VGA
+
+# If you want the RAM disk device, define this to be the size in blocks.
+
+#RAMDISK := -DRAMDISK=512
+
+EXTRA_TARGETS := vmlinux.bin bootsect bootsect.o \
+ setup setup.o zImage bzImage
+
+subdir- := compressed
+
+host-progs := tools/build
+
+# ---------------------------------------------------------------------------
+
+$(obj)/zImage: IMAGE_OFFSET := 0x1000
+$(obj)/zImage: EXTRA_AFLAGS := -traditional $(SVGA_MODE) $(RAMDISK)
+$(obj)/bzImage: IMAGE_OFFSET := 0x100000
+$(obj)/bzImage: EXTRA_AFLAGS := -traditional $(SVGA_MODE) $(RAMDISK) -D__BIG_KERNEL__
+$(obj)/bzImage: BUILDFLAGS := -b
+
+quiet_cmd_image = BUILD $@
+cmd_image = $(obj)/tools/build $(BUILDFLAGS) $(obj)/bootsect $(obj)/setup \
+ $(obj)/vmlinux.bin $(ROOT_DEV) > $@
+
+$(obj)/zImage $(obj)/bzImage: $(obj)/bootsect $(obj)/setup \
+ $(obj)/vmlinux.bin $(obj)/tools/build FORCE
+ $(call if_changed,image)
+ @echo 'Kernel: $@ is ready'
+
+$(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE
+ $(call if_changed,objcopy)
+
+LDFLAGS_bootsect := -Ttext 0x0 -s --oformat binary
+LDFLAGS_setup := -Ttext 0x0 -s --oformat binary -e begtext
+
+$(obj)/setup $(obj)/bootsect: %: %.o FORCE
+ $(call if_changed,ld)
+
+$(obj)/compressed/vmlinux: FORCE
+ $(Q)$(MAKE) -f scripts/Makefile.build obj=$(obj)/compressed \
+ IMAGE_OFFSET=$(IMAGE_OFFSET) $@
+
+zdisk: $(BOOTIMAGE)
+ dd bs=8192 if=$(BOOTIMAGE) of=/dev/fd0
+
+zlilo: $(BOOTIMAGE)
+ if [ -f $(INSTALL_PATH)/vmlinuz ]; then mv $(INSTALL_PATH)/vmlinuz $(INSTALL_PATH)/vmlinuz.old; fi
+ if [ -f $(INSTALL_PATH)/System.map ]; then mv $(INSTALL_PATH)/System.map $(INSTALL_PATH)/System.old; fi
+ cat $(BOOTIMAGE) > $(INSTALL_PATH)/vmlinuz
+ cp System.map $(INSTALL_PATH)/
+ if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi
+
+install: $(BOOTIMAGE)
+ sh $(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)"
diff -Nru a/arch/i386/boot98/bootsect.S b/arch/i386/boot98/bootsect.S
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/arch/i386/boot98/bootsect.S Fri Feb 14 14:38:01 2003
@@ -0,0 +1,397 @@
+/*
+ * bootsect.S - boot sector for NEC PC-9800 series
+ *
+ * Linux/98 project at Kyoto University Microcomputer Club (KMC)
+ * FUJITA Norimasa, TAKAI Kousuke 1997-1998
+ * rewritten by TAKAI Kousuke (as86 -> gas), Nov 1999
+ *
+ * Based on:
+ * bootsect.S Copyright (C) 1991, 1992 Linus Torvalds
+ * modified by Drew Eckhardt
+ * modified by Bruce Evans (bde)
+ *
+ * bootsect.S is loaded at 0x1FC00 or 0x1FE00 by the bios-startup routines,
+ * and moves itself out of the way to address 0x90000, and jumps there.
+ *
+ * It then loads 'setup' directly after itself (0x90200), and the system
+ * at 0x10000, using BIOS interrupts.
+ *
+ * NOTE! currently system is at most (8*65536-4096) bytes long. This should
+ * be no problem, even in the future. I want to keep it simple. This 508 kB
+ * kernel size should be enough, especially as this doesn't contain the
+ * buffer cache as in minix (and especially now that the kernel is
+ * compressed :-)
+ *
+ * The loader has been made as simple as possible, and continuous
+ * read errors will result in a unbreakable loop. Reboot by hand. It
+ * loads pretty fast by getting whole tracks at a time whenever possible.
+ */
+
+#include /* for CONFIG_ROOT_RDONLY */
+#include
+
+SETUPSECTS = 4 /* default nr of setup-sectors */
+BOOTSEG = 0x1FC0 /* original address of boot-sector */
+INITSEG = DEF_INITSEG /* we move boot here - out of the way */
+SETUPSEG = DEF_SETUPSEG /* setup starts here */
+SYSSEG = DEF_SYSSEG /* system loaded at 0x10000 (65536) */
+SYSSIZE = DEF_SYSSIZE /* system size: # of 16-byte clicks */
+ /* to be loaded */
+ROOT_DEV = 0 /* ROOT_DEV is now written by "build" */
+SWAP_DEV = 0 /* SWAP_DEV is now written by "build" */
+
+#ifndef SVGA_MODE
+#define SVGA_MODE ASK_VGA
+#endif
+
+#ifndef RAMDISK
+#define RAMDISK 0
+#endif
+
+#ifndef ROOT_RDONLY
+#define ROOT_RDONLY 1
+#endif
+
+/* normal/hireso text VRAM segments */
+#define NORMAL_TEXT 0xa000
+#define HIRESO_TEXT 0xe000
+
+/* bios work area addresses */
+#define EXPMMSZ 0x0401
+#define BIOS_FLAG 0x0501
+#define DISK_BOOT 0x0584
+
+.code16
+.text
+
+.global _start
+_start:
+
+#if 0 /* hook for debugger, harmless unless BIOS is fussy (old HP) */
+ int $0x3
+#endif
+ jmp real_start
+ .ascii "Linux 98"
+ .word 0
+real_start:
+ xorw %di, %di /* %di = 0 */
+ movw %di, %ss /* %ss = 0 */
+ movw $0x03F0, %sp
+ pushw %cx /* for hint */
+
+ movw $0x0A00, %ax /* normal mode defaults (80x25) */
+
+ testb $0x08, %ss:BIOS_FLAG /* check hi-reso bit */
+ jnz set_crt_mode
+/*
+ * Hi-Reso (high-resolution) machine.
+ *
+ * Some hi-reso machines have no RAMs on bank 8/A (0x080000 - 0x0BFFFF).
+ * On such machines we get two RAM banks from top of protect menory and
+ * map them on bank 8/A.
+ * These work-around must be done before moving myself on INITSEG (0x090000-).
+ */
+ movw $(HIRESO_TEXT >> 8), %cs:(vram + 1) /* text VRAM segment */
+
+ /* set memory window */
+ movb $0x08, %al
+ outb %al, $0x91 /* map native RAM (if any) */
+ movb $0x0A, %al
+ outb %al, $0x93
+
+ /* check bank ram A */
+ pushw $0xA500
+ popw %ds
+ movw (%di), %cx /* %si == 0 from entry */
+ notw %cx
+ movw %cx, (%di)
+
+ movw $0x43F, %dx /* cache flush for 486 and up. */
+ movb $0xA0, %al
+ outb %al, %dx
+
+ cmpw %cx, (%di)
+ je hireso_done
+
+ /*
+ * Write test failed; we have no native RAM on 080000h - 0BFFFFh.
+ * Take 256KB of RAM from top of protected memory.
+ */
+ movb %ss:EXPMMSZ, %al
+ subb $2, %al /* reduce 2 x 128KB */
+ movb %al, %ss:EXPMMSZ
+ addb %al, %al
+ addb $0x10, %al
+ outb %al, $0x91
+ addb $2, %al
+ outb %al, $0x93
+
+hireso_done:
+ movb $0x10, %al /* CRT mode 80x31, %ah still 0Ah */
+
+set_crt_mode:
+ int $0x18 /* set CRT mode */
+
+ movb $0x0C, %ah /* turn on text displaying */
+ int $0x18
+
+ xorw %dx, %dx /* position cursor to home */
+ movb $0x13, %ah
+ int $0x18
+
+ movb $0x11, %ah /* turn cursor displaying on */
+ int $0x18
+
+ /* move 1 kilobytes from [BOOTSEG:0000h] to [INITSEG:0000h] */
+ cld
+ xorw %si, %si
+ pushw $INITSEG
+ popw %es
+ movw $512, %cx /* %di == 0 from entry */
+ rep
+ cs
+ movsw
+
+ ljmp $INITSEG, $go
+
+go:
+ pushw %cs
+ popw %ds /* %ds = %cs */
+
+ popw %dx /* %dh = saved %ch passed from BIOS */
+ movb %ss:DISK_BOOT, %al
+ andb $0xf0, %al /* %al = Device Address */
+ movb $18, %ch /* 18 secs/track, 512 b/sec (1440 KB) */
+ cmpb $0x30, %al
+ je try512
+ cmpb $0x90, %al /* 1 MB I/F, 1 MB floppy */
+ je try1.2M
+ cmpb $0xf0, %al /* 640 KB I/F, 1 MB floppy */
+ je try1.2M
+ movb $9, %ch /* 9 secs/track, 512 b/sec ( 720 KB) */
+ cmpb $0x10, %al /* 1 MB I/F, 640 KB floppy */
+ je try512
+ cmpb $0x70, %al /* 640 KB I/F, 640 KB floppy */
+ jne error /* unknown device? */
+
+ /* XXX: Does it make sense to support 8 secs/track, 512 b/sec
+ (640 KB) floppy? */
+
+try512: movb $2, %cl /* 512 b/sec */
+lasttry:call tryload
+/*
+ * Display error message and halt
+ */
+error: movw $error_msg, %si
+ call print
+wait_reboot:
+ movb $0x0, %ah
+ int $0x18 /* wait keyboard input */
+1: movb $0, %al
+ outb %al, $0xF0 /* reset CPU */
+ jmp 1b /* just in case... */
+
+try1.2M:cmpb $2, %dh
+ je try2HC
+ movw $0x0803, %cx /* 8 secs/track, 1024 b/sec (1232 KB) */
+ call tryload
+ movb $15, %ch /* 15 secs/track, 512 b/sec (1200 KB) */
+ jmp try512
+try2HC: movw $0x0F02, %cx /* 15 secs/track, 512 b/sec (1200 KB) */
+ call tryload
+ movw $0x0803, %cx /* 8 secs/track, 1024 b/sec (1232 KB) */
+ jmp lasttry
+
+/*
+ * Try to load SETUP and SYSTEM provided geometry information in %cx.
+ * This routine *will not* return on successful load...
+ */
+tryload:
+ movw %cx, sectlen
+ movb %ss:DISK_BOOT, %al
+ movb $0x7, %ah /* recalibrate the drive */
+ int $0x1b
+ jc error /* recalibration should succeed */
+
+ /*
+ * Load SETUP into memory. It is assumed that SETUP fits into
+ * first cylinder (2 tracks, 9KB on 2DD, 15-18KB on 2HD).
+ */
+ movb $0, %bl
+ movb setup_sects, %bh
+ incb %bh
+ shlw %bx /* %bx = (setup_sects + 1) * 512 */
+ movw $128, %bp
+ shlw %cl, %bp /* %bp = */
+ subw %bp, %bx /* length to load */
+ movw $0x0002, %dx /* head 0, sector 2 */
+ movb %cl, %ch /* `N' for sector address */
+ movb $0, %cl /* cylinder 0 */
+ pushw %cs
+ popw %es /* %es = %cs (= INITSEG) */
+ movb $0xd6, %ah /* read, multi-track, MFM */
+ int $0x1b /* load it! */
+ jc read_error
+
+ movw $loading_msg, %si
+ call print
+
+ movw $SYSSEG, %ax
+ movw %ax, %es /* %es = SYSSEG */
+
+/*
+ * This routine loads the system at address 0x10000, making sure
+ * no 64kB boundaries are crossed. We try to load it as fast as
+ * possible, loading whole tracks whenever we can.
+ *
+ * in: es - starting address segment (normally 0x1000)
+ */
+ movb %ch, %cl
+ addb $7, %cl /* %cl = log2 */
+ shrw %cl, %bx /* %bx = # of phys. sectors in SETUP */
+ addb %bl, %dl /* %dl = start sector # of SYSTEM */
+ decb %dl /* %dl is 0-based in below loop */
+
+rp_read_newseg:
+ xorw %bp, %bp /* = starting address within segment */
+#ifdef __BIG_KERNEL__
+ bootsect_kludge = 0x220 /* 0x200 (size of bootsector) + 0x20 (offset */
+ lcall *bootsect_kludge /* of bootsect_kludge in setup.S */
+#else
+ movw %es, %ax
+ subw $SYSSEG, %ax
+#endif
+ cmpw syssize, %ax
+ ja boot /* done! */
+
+rp_read:
+ movb sectors, %al
+ addb %al, %al
+ movb %al, %ch /* # of sectors on both surface */
+ subb %dl, %al /* # of sectors left on this track */
+ movb $0, %ah
+ shlw %cl, %ax /* # of bytes left on this track */
+ movw %ax, %bx /* transfer length */
+ addw %bp, %ax /* cross 64K boundary? */
+ jnc 1f /* ok. */
+ jz 1f /* also ok. */
+ /*
+ * Oops, we are crossing 64K boundary...
+ * Adjust transfer length to make transfer fit in the boundary.
+ *
+ * Note: sector size is assumed to be a measure of 65536.
+ */
+ xorw %bx, %bx
+ subw %bp, %bx
+1: pushw %dx
+ movw $dot_msg, %si /* give progress message */
+ call print
+ xchgw %ax, %dx
+ movb $0, %ah
+ divb sectors
+ xchgb %al, %ah
+ xchgw %ax, %dx /* %dh = head # / %dl = sector # */
+ incb %dl /* fix %dl to 1-based */
+ pushw %cx
+ movw cylinder, %cx
+ movb $0xd6, %ah /* read, multi-track, seek, MFM */
+ movb %ss:DISK_BOOT, %al
+ int $0x1b
+ popw %cx
+ popw %dx
+ jc read_error
+ movw %bx, %ax /* # of bytes just read */
+ shrw %cl, %ax /* %ax = # of sectors just read */
+ addb %al, %dl /* advance sector # */
+ cmpb %ch, %dl /* %ch = # of sectors/cylinder */
+ jb 2f
+ incb cylinder /* next cylinder */
+ xorb %dl, %dl /* sector 0 */
+2: addw %bx, %bp /* advance offset pointer */
+ jnc rp_read
+ /* offset pointer wrapped; advance segment pointer. */
+ movw %es, %ax
+ addw $0x1000, %ax
+ movw %ax, %es
+ jmp rp_read_newseg
+
+read_error:
+ ret
+
+boot: movw %cs, %ax /* = INITSEG */
+ /* movw %ax, %ds */
+ movw %ax, %ss
+ movw $0x4000, %sp /* 0x4000 is arbitrary value >=
+ * length of bootsect + length of
+ * setup + room for stack;
+ * PC-9800 never have BIOS workareas
+ * on high memory.
+ */
+/*
+ * After that we check which root-device to use. If the device is
+ * not defined, /dev/fd0 (2, 0) will be used.
+ */
+ cmpw $0, root_dev
+ jne 3f
+ movb $2, root_dev+1
+3:
+
+/*
+ * After that (everything loaded), we jump to the setup-routine
+ * loaded directly after the bootblock:
+ */
+ ljmp $SETUPSEG, $0
+
+/*
+ * Subroutine for print string on console.
+ * %cs:%si - pointer to message
+ */
+print:
+ pushaw
+ pushw %ds
+ pushw %es
+ pushw %cs
+ popw %ds
+ lesw curpos, %di /* %es:%di = current text VRAM addr. */
+1: xorw %ax, %ax
+ lodsb
+ testb %al, %al
+ jz 2f /* end of string */
+ stosw /* character code */
+ movb $0xE1, %es:0x2000-2(%di) /* character attribute */
+ jmp 1b
+2: movw %di, %dx
+ movb $0x13, %ah
+ int $0x18 /* move cursor to current point */
+ popw %es
+ popw %ds
+ popaw
+ ret
+
+loading_msg:
+ .string "Loading"
+dot_msg:
+ .string "."
+error_msg:
+ .string "Read Error!"
+
+ .org 490
+
+curpos: .word 160 /* current cursor position */
+vram: .word NORMAL_TEXT /* text VRAM segment */
+
+cylinder: .byte 0 /* current cylinder (lower byte) */
+sectlen: .byte 0 /* (log2 of ) - 7 */
+sectors: .byte 0x0F /* default is 2HD (15 sector/track) */
+
+# XXX: This is a fairly snug fit.
+
+.org 497
+setup_sects: .byte SETUPSECTS
+root_flags: .word ROOT_RDONLY
+syssize: .word SYSSIZE
+swap_dev: .word SWAP_DEV
+ram_size: .word RAMDISK
+vid_mode: .word SVGA_MODE
+root_dev: .word ROOT_DEV
+boot_flag: .word 0xAA55
diff -Nru a/arch/i386/boot98/compressed/Makefile b/arch/i386/boot98/compressed/Makefile
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/arch/i386/boot98/compressed/Makefile Thu Feb 20 08:28:06 2003
@@ -0,0 +1,25 @@
+#
+# linux/arch/i386/boot/compressed/Makefile
+#
+# create a compressed vmlinux image from the original vmlinux
+#
+
+EXTRA_TARGETS := vmlinux vmlinux.bin vmlinux.bin.gz head.o misc.o piggy.o
+EXTRA_AFLAGS := -traditional
+
+LDFLAGS_vmlinux := -Ttext $(IMAGE_OFFSET) -e startup_32
+
+$(obj)/vmlinux: $(obj)/head.o $(obj)/misc.o $(obj)/piggy.o FORCE
+ $(call if_changed,ld)
+ @:
+
+$(obj)/vmlinux.bin: vmlinux FORCE
+ $(call if_changed,objcopy)
+
+$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
+ $(call if_changed,gzip)
+
+LDFLAGS_piggy.o := -r --format binary --oformat elf32-i386 -T
+
+$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.gz FORCE
+ $(call if_changed,ld)
diff -Nru a/arch/i386/boot98/compressed/head.S b/arch/i386/boot98/compressed/head.S
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/arch/i386/boot98/compressed/head.S Fri Feb 14 14:38:01 2003
@@ -0,0 +1,128 @@
+/*
+ * linux/boot/head.S
+ *
+ * Copyright (C) 1991, 1992, 1993 Linus Torvalds
+ */
+
+/*
+ * head.S contains the 32-bit startup code.
+ *
+ * NOTE!!! Startup happens at absolute address 0x00001000, which is also where
+ * the page directory will exist. The startup code will be overwritten by
+ * the page directory. [According to comments etc elsewhere on a compressed
+ * kernel it will end up at 0x1000 + 1Mb I hope so as I assume this. - AC]
+ *
+ * Page 0 is deliberately kept safe, since System Management Mode code in
+ * laptops may need to access the BIOS data stored there. This is also
+ * useful for future device drivers that either access the BIOS via VM86
+ * mode.
+ */
+
+/*
+ * High loaded stuff by Hans Lermen & Werner Almesberger, Feb. 1996
+ */
+.text
+
+#include
+#include
+
+ .globl startup_32
+
+startup_32:
+ cld
+ cli
+ movl $(__BOOT_DS),%eax
+ movl %eax,%ds
+ movl %eax,%es
+ movl %eax,%fs
+ movl %eax,%gs
+
+ lss stack_start,%esp
+ xorl %eax,%eax
+1: incl %eax # check that A20 really IS enabled
+ movl %eax,0x000000 # loop forever if it isn't
+ cmpl %eax,0x100000
+ je 1b
+
+/*
+ * Initialize eflags. Some BIOS's leave bits like NT set. This would
+ * confuse the debugger if this code is traced.
+ * XXX - best to initialize before switching to protected mode.
+ */
+ pushl $0
+ popfl
+/*
+ * Clear BSS
+ */
+ xorl %eax,%eax
+ movl $_edata,%edi
+ movl $_end,%ecx
+ subl %edi,%ecx
+ cld
+ rep
+ stosb
+/*
+ * Do the decompression, and jump to the new kernel..
+ */
+ subl $16,%esp # place for structure on the stack
+ movl %esp,%eax
+ pushl %esi # real mode pointer as second arg
+ pushl %eax # address of structure as first arg
+ call decompress_kernel
+ orl %eax,%eax
+ jnz 3f
+ popl %esi # discard address
+ popl %esi # real mode pointer
+ xorl %ebx,%ebx
+ ljmp $(__BOOT_CS), $0x100000
+
+/*
+ * We come here, if we were loaded high.
+ * We need to move the move-in-place routine down to 0x1000
+ * and then start it with the buffer addresses in registers,
+ * which we got from the stack.
+ */
+3:
+ movl $move_routine_start,%esi
+ movl $0x1000,%edi
+ movl $move_routine_end,%ecx
+ subl %esi,%ecx
+ addl $3,%ecx
+ shrl $2,%ecx
+ cld
+ rep
+ movsl
+
+ popl %esi # discard the address
+ popl %ebx # real mode pointer
+ popl %esi # low_buffer_start
+ popl %ecx # lcount
+ popl %edx # high_buffer_start
+ popl %eax # hcount
+ movl $0x100000,%edi
+ cli # make sure we don't get interrupted
+ ljmp $(__BOOT_CS), $0x1000 # and jump to the move routine
+
+/*
+ * Routine (template) for moving the decompressed kernel in place,
+ * if we were high loaded. This _must_ PIC-code !
+ */
+move_routine_start:
+ movl %ecx,%ebp
+ shrl $2,%ecx
+ rep
+ movsl
+ movl %ebp,%ecx
+ andl $3,%ecx
+ rep
+ movsb
+ movl %edx,%esi
+ movl %eax,%ecx # NOTE: rep movsb won't move if %ecx == 0
+ addl $3,%ecx
+ shrl $2,%ecx
+ rep
+ movsl
+ movl %ebx,%esi # Restore setup pointer
+ xorl %ebx,%ebx
+ ljmp $(__BOOT_CS), $0x100000
+move_routine_end:
diff -Nru a/arch/i386/boot98/compressed/misc.c b/arch/i386/boot98/compressed/misc.c
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/arch/i386/boot98/compressed/misc.c Fri Feb 14 14:38:01 2003
@@ -0,0 +1,379 @@
+/*
+ * misc.c
+ *
+ * This is a collection of several routines from gzip-1.0.3
+ * adapted for Linux.
+ *
+ * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994
+ * puts by Nick Holloway 1993, better puts by Martin Mares 1995
+ * High loaded stuff by Hans Lermen & Werner Almesberger, Feb. 1996
+ */
+
+#include
+#include
+#include
+#include
+#ifdef STANDARD_MEMORY_BIOS_CALL
+#undef STANDARD_MEMORY_BIOS_CALL
+#endif
+
+/*
+ * gzip declarations
+ */
+
+#define OF(args) args
+#define STATIC static
+
+#undef memset
+#undef memcpy
+
+/*
+ * Why do we do this? Don't ask me..
+ *
+ * Incomprehensible are the ways of bootloaders.
+ */
+static void* memset(void *, int, size_t);
+static void* memcpy(void *, __const void *, size_t);
+#define memzero(s, n) memset ((s), 0, (n))
+
+typedef unsigned char uch;
+typedef unsigned short ush;
+typedef unsigned long ulg;
+
+#define WSIZE 0x8000 /* Window size must be at least 32k, */
+ /* and a power of two */
+
+static uch *inbuf; /* input buffer */
+static uch window[WSIZE]; /* Sliding window buffer */
+
+static unsigned insize = 0; /* valid bytes in inbuf */
+static unsigned inptr = 0; /* index of next byte to be processed in inbuf */
+static unsigned outcnt = 0; /* bytes in output buffer */
+
+/* gzip flag byte */
+#define ASCII_FLAG 0x01 /* bit 0 set: file probably ASCII text */
+#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */
+#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */
+#define ORIG_NAME 0x08 /* bit 3 set: original file name present */
+#define COMMENT 0x10 /* bit 4 set: file comment present */
+#define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */
+#define RESERVED 0xC0 /* bit 6,7: reserved */
+
+#define get_byte() (inptr < insize ? inbuf[inptr++] : fill_inbuf())
+
+/* Diagnostic functions */
+#ifdef DEBUG
+# define Assert(cond,msg) {if(!(cond)) error(msg);}
+# define Trace(x) fprintf x
+# define Tracev(x) {if (verbose) fprintf x ;}
+# define Tracevv(x) {if (verbose>1) fprintf x ;}
+# define Tracec(c,x) {if (verbose && (c)) fprintf x ;}
+# define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;}
+#else
+# define Assert(cond,msg)
+# define Trace(x)
+# define Tracev(x)
+# define Tracevv(x)
+# define Tracec(c,x)
+# define Tracecv(c,x)
+#endif
+
+static int fill_inbuf(void);
+static void flush_window(void);
+static void error(char *m);
+static void gzip_mark(void **);
+static void gzip_release(void **);
+
+/*
+ * This is set up by the setup-routine at boot-time
+ */
+static unsigned char *real_mode; /* Pointer to real-mode data */
+
+#define EXT_MEM_K (*(unsigned short *)(real_mode + 0x2))
+#ifndef STANDARD_MEMORY_BIOS_CALL
+#define ALT_MEM_K (*(unsigned long *)(real_mode + 0x1e0))
+#endif
+#define SCREEN_INFO (*(struct screen_info *)(real_mode+0))
+
+extern char input_data[];
+extern int input_len;
+
+static long bytes_out = 0;
+static uch *output_data;
+static unsigned long output_ptr = 0;
+
+static void *malloc(int size);
+static void free(void *where);
+
+static void puts(const char *);
+
+extern int end;
+static long free_mem_ptr = (long)&end;
+static long free_mem_end_ptr;
+
+#define INPLACE_MOVE_ROUTINE 0x1000
+#define LOW_BUFFER_START 0x2000
+#define LOW_BUFFER_MAX 0x90000
+#define HEAP_SIZE 0x3000
+static unsigned int low_buffer_end, low_buffer_size;
+static int high_loaded =0;
+static uch *high_buffer_start /* = (uch *)(((ulg)&end) + HEAP_SIZE)*/;
+
+static char *vidmem = (char *)0xa0000;
+static int lines, cols;
+
+#ifdef CONFIG_X86_NUMAQ
+static void * xquad_portio = NULL;
+#endif
+
+#include "../../../../lib/inflate.c"
+
+static void *malloc(int size)
+{
+ void *p;
+
+ if (size <0) error("Malloc error\n");
+ if (free_mem_ptr <= 0) error("Memory error\n");
+
+ free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */
+
+ p = (void *)free_mem_ptr;
+ free_mem_ptr += size;
+
+ if (free_mem_ptr >= free_mem_end_ptr)
+ error("\nOut of memory\n");
+
+ return p;
+}
+
+static void free(void *where)
+{ /* Don't care */
+}
+
+static void gzip_mark(void **ptr)
+{
+ *ptr = (void *) free_mem_ptr;
+}
+
+static void gzip_release(void **ptr)
+{
+ free_mem_ptr = (long) *ptr;
+}
+
+static void scroll(void)
+{
+ int i;
+
+ memcpy ( vidmem, vidmem + cols * 2, ( lines - 1 ) * cols * 2 );
+ for ( i = ( lines - 1 ) * cols * 2; i < lines * cols * 2; i += 2 )
+ vidmem[i] = ' ';
+}
+
+static void puts(const char *s)
+{
+ int x,y,pos;
+ char c;
+
+ x = SCREEN_INFO.orig_x;
+ y = SCREEN_INFO.orig_y;
+
+ while ( ( c = *s++ ) != '\0' ) {
+ if ( c == '\n' ) {
+ x = 0;
+ if ( ++y >= lines ) {
+ scroll();
+ y--;
+ }
+ } else {
+ vidmem [ ( x + cols * y ) * 2 ] = c;
+ if ( ++x >= cols ) {
+ x = 0;
+ if ( ++y >= lines ) {
+ scroll();
+ y--;
+ }
+ }
+ }
+ }
+
+ SCREEN_INFO.orig_x = x;
+ SCREEN_INFO.orig_y = y;
+
+ pos = x + cols * y; /* Update cursor position */
+ while (!(inb_p(0x60) & 4));
+ outb_p(0x49, 0x62);
+ outb_p(pos & 0xff, 0x60);
+ outb_p((pos >> 8) & 0xff, 0x60);
+}
+
+static void* memset(void* s, int c, size_t n)
+{
+ int i;
+ char *ss = (char*)s;
+
+ for (i=0;i> 8);
+ }
+ crc = c;
+ bytes_out += (ulg)outcnt;
+ output_ptr += (ulg)outcnt;
+ outcnt = 0;
+}
+
+static void flush_window_high(void)
+{
+ ulg c = crc; /* temporary variable */
+ unsigned n;
+ uch *in, ch;
+ in = window;
+ for (n = 0; n < outcnt; n++) {
+ ch = *output_data++ = *in++;
+ if ((ulg)output_data == low_buffer_end) output_data=high_buffer_start;
+ c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8);
+ }
+ crc = c;
+ bytes_out += (ulg)outcnt;
+ outcnt = 0;
+}
+
+static void flush_window(void)
+{
+ if (high_loaded) flush_window_high();
+ else flush_window_low();
+}
+
+static void error(char *x)
+{
+ puts("\n\n");
+ puts(x);
+ puts("\n\n -- System halted");
+
+ while(1); /* Halt */
+}
+
+#define STACK_SIZE (4096)
+
+long user_stack [STACK_SIZE];
+
+struct {
+ long * a;
+ short b;
+ } stack_start = { & user_stack [STACK_SIZE] , __BOOT_DS };
+
+static void setup_normal_output_buffer(void)
+{
+#ifdef STANDARD_MEMORY_BIOS_CALL
+ if (EXT_MEM_K < 1024) error("Less than 2MB of memory.\n");
+#else
+ if ((ALT_MEM_K > EXT_MEM_K ? ALT_MEM_K : EXT_MEM_K) < 1024) error("Less than 2MB of memory.\n");
+#endif
+ output_data = (char *)0x100000; /* Points to 1M */
+ free_mem_end_ptr = (long)real_mode;
+}
+
+struct moveparams {
+ uch *low_buffer_start; int lcount;
+ uch *high_buffer_start; int hcount;
+};
+
+static void setup_output_buffer_if_we_run_high(struct moveparams *mv)
+{
+ high_buffer_start = (uch *)(((ulg)&end) + HEAP_SIZE);
+#ifdef STANDARD_MEMORY_BIOS_CALL
+ if (EXT_MEM_K < (3*1024)) error("Less than 4MB of memory.\n");
+#else
+ if ((ALT_MEM_K > EXT_MEM_K ? ALT_MEM_K : EXT_MEM_K) < (3*1024)) error("Less than 4MB of memory.\n");
+#endif
+ mv->low_buffer_start = output_data = (char *)LOW_BUFFER_START;
+ low_buffer_end = ((unsigned int)real_mode > LOW_BUFFER_MAX
+ ? LOW_BUFFER_MAX : (unsigned int)real_mode) & ~0xfff;
+ low_buffer_size = low_buffer_end - LOW_BUFFER_START;
+ high_loaded = 1;
+ free_mem_end_ptr = (long)high_buffer_start;
+ if ( (0x100000 + low_buffer_size) > ((ulg)high_buffer_start)) {
+ high_buffer_start = (uch *)(0x100000 + low_buffer_size);
+ mv->hcount = 0; /* say: we need not to move high_buffer */
+ }
+ else mv->hcount = -1;
+ mv->high_buffer_start = high_buffer_start;
+}
+
+static void close_output_buffer_if_we_run_high(struct moveparams *mv)
+{
+ if (bytes_out > low_buffer_size) {
+ mv->lcount = low_buffer_size;
+ if (mv->hcount)
+ mv->hcount = bytes_out - low_buffer_size;
+ } else {
+ mv->lcount = bytes_out;
+ mv->hcount = 0;
+ }
+}
+
+
+asmlinkage int decompress_kernel(struct moveparams *mv, void *rmode)
+{
+ real_mode = rmode;
+
+ vidmem = (char *)(((unsigned int)SCREEN_INFO.orig_video_page) << 4);
+
+ lines = SCREEN_INFO.orig_video_lines;
+ cols = SCREEN_INFO.orig_video_cols;
+
+ if (free_mem_ptr < 0x100000) setup_normal_output_buffer();
+ else setup_output_buffer_if_we_run_high(mv);
+
+ makecrc();
+ puts("Uncompressing Linux... ");
+ gunzip();
+ puts("Ok, booting the kernel.\n");
+ if (high_loaded) close_output_buffer_if_we_run_high(mv);
+ return high_loaded;
+}
+
+/* We don't actually check for stack overflows this early. */
+__asm__(".globl mcount ; mcount: ret\n");
+
diff -Nru a/arch/i386/boot98/compressed/vmlinux.scr b/arch/i386/boot98/compressed/vmlinux.scr
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/arch/i386/boot98/compressed/vmlinux.scr Fri Feb 14 14:38:01 2003
@@ -0,0 +1,9 @@
+SECTIONS
+{
+ .data : {
+ input_len = .;
+ LONG(input_data_end - input_data) input_data = .;
+ *(.data)
+ input_data_end = .;
+ }
+}
diff -Nru a/arch/i386/boot98/install.sh b/arch/i386/boot98/install.sh
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/arch/i386/boot98/install.sh Fri Feb 14 14:38:01 2003
@@ -0,0 +1,40 @@
+#!/bin/sh
+#
+# arch/i386/boot/install.sh
+#
+# 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 by Linus Torvalds
+#
+# Adapted from code in arch/i386/boot/Makefile by H. Peter Anvin
+#
+# "make install" script for i386 architecture
+#
+# Arguments:
+# $1 - kernel version
+# $2 - kernel image file
+# $3 - kernel map file
+# $4 - default install path (blank if root directory)
+#
+
+# User may have a custom install script
+
+if [ -x ~/bin/installkernel ]; then exec ~/bin/installkernel "$@"; fi
+if [ -x /sbin/installkernel ]; then exec /sbin/installkernel "$@"; fi
+
+# Default install - same as make zlilo
+
+if [ -f $4/vmlinuz ]; then
+ mv $4/vmlinuz $4/vmlinuz.old
+fi
+
+if [ -f $4/System.map ]; then
+ mv $4/System.map $4/System.old
+fi
+
+cat $2 > $4/vmlinuz
+cp $3 $4/System.map
+
+if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi
diff -Nru a/arch/i386/boot98/setup.S b/arch/i386/boot98/setup.S
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/arch/i386/boot98/setup.S Thu Mar 20 10:43:51 2003
@@ -0,0 +1,961 @@
+/*
+ * setup.S Copyright (C) 1991, 1992 Linus Torvalds
+ *
+ * setup.s is responsible for getting the system data from the BIOS,
+ * and putting them into the appropriate places in system memory.
+ * both setup.s and system has been loaded by the bootblock.
+ *
+ * This code asks the bios for memory/disk/other parameters, and
+ * puts them in a "safe" place: 0x90000-0x901FF, ie where the
+ * boot-block used to be. It is then up to the protected mode
+ * system to read them from there before the area is overwritten
+ * for buffer-blocks.
+ *
+ * Move PS/2 aux init code to psaux.c
+ * (troyer@saifr00.cfsat.Honeywell.COM) 03Oct92
+ *
+ * some changes and additional features by Christoph Niemann,
+ * March 1993/June 1994 (Christoph.Niemann@linux.org)
+ *
+ * add APM BIOS checking by Stephen Rothwell, May 1994
+ * (sfr@canb.auug.org.au)
+ *
+ * High load stuff, initrd support and position independency
+ * by Hans Lermen & Werner Almesberger, February 1996
+ * ,
+ *
+ * Video handling moved to video.S by Martin Mares, March 1996
+ *
+ *
+ * Extended memory detection scheme retwiddled by orc@pell.chi.il.us (david
+ * parsons) to avoid loadlin confusion, July 1997
+ *
+ * Transcribed from Intel (as86) -> AT&T (gas) by Chris Noe, May 1999.
+ *
+ *
+ * Fix to work around buggy BIOSes which dont use carry bit correctly
+ * and/or report extended memory in CX/DX for e801h memory size detection
+ * call. As a result the kernel got wrong figures. The int15/e801h docs
+ * from Ralf Brown interrupt list seem to indicate AX/BX should be used
+ * anyway. So to avoid breaking many machines (presumably there was a reason
+ * to orginally use CX/DX instead of AX/BX), we do a kludge to see
+ * if CX/DX have been changed in the e801 call and if so use AX/BX .
+ * Michael Miller, April 2001
+ *
+ * New A20 code ported from SYSLINUX by H. Peter Anvin. AMD Elan bugfixes
+ * by Robert Schwebel, December 2001
+ *
+ * Heavily modified for NEC PC-9800 series by Kyoto University Microcomputer
+ * Club (KMC) Linux/98 project , 1997-1999
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+/* Signature words to ensure LILO loaded us right */
+#define SIG1 0xAA55
+#define SIG2 0x5A5A
+
+#define HIRESO_TEXT 0xe000
+#define NORMAL_TEXT 0xa000
+
+#define BIOS_FLAG2 0x0400
+#define BIOS_FLAG5 0x0458
+#define RDISK_EQUIP 0x0488
+#define BIOS_FLAG 0x0501
+#define KB_SHFT_STS 0x053a
+#define DISK_EQUIP 0x055c
+
+INITSEG = DEF_INITSEG # 0x9000, we move boot here, out of the way
+SYSSEG = DEF_SYSSEG # 0x1000, system loaded at 0x10000 (65536).
+SETUPSEG = DEF_SETUPSEG # 0x9020, this is the current segment
+ # ... and the former contents of CS
+
+DELTA_INITSEG = SETUPSEG - INITSEG # 0x0020
+
+.code16
+.globl begtext, begdata, begbss, endtext, enddata, endbss
+
+.text
+begtext:
+.data
+begdata:
+.bss
+begbss:
+.text
+
+start:
+ jmp trampoline
+
+# This is the setup header, and it must start at %cs:2 (old 0x9020:2)
+
+ .ascii "HdrS" # header signature
+ .word 0x0203 # header version number (>= 0x0105)
+ # or else old loadlin-1.5 will fail)
+realmode_swtch: .word 0, 0 # default_switch, SETUPSEG
+start_sys_seg: .word SYSSEG
+ .word kernel_version # pointing to kernel version string
+ # above section of header is compatible
+ # with loadlin-1.5 (header v1.5). Don't
+ # change it.
+
+type_of_loader: .byte 0 # = 0, old one (LILO, Loadlin,
+ # Bootlin, SYSLX, bootsect...)
+ # See Documentation/i386/boot.txt for
+ # assigned ids
+
+# flags, unused bits must be zero (RFU) bit within loadflags
+loadflags:
+LOADED_HIGH = 1 # If set, the kernel is loaded high
+CAN_USE_HEAP = 0x80 # If set, the loader also has set
+ # heap_end_ptr to tell how much
+ # space behind setup.S can be used for
+ # heap purposes.
+ # Only the loader knows what is free
+#ifndef __BIG_KERNEL__
+ .byte 0
+#else
+ .byte LOADED_HIGH
+#endif
+
+setup_move_size: .word 0x8000 # size to move, when setup is not
+ # loaded at 0x90000. We will move setup
+ # to 0x90000 then just before jumping
+ # into the kernel. However, only the
+ # loader knows how much data behind
+ # us also needs to be loaded.
+
+code32_start: # here loaders can put a different
+ # start address for 32-bit code.
+#ifndef __BIG_KERNEL__
+ .long 0x1000 # 0x1000 = default for zImage
+#else
+ .long 0x100000 # 0x100000 = default for big kernel
+#endif
+
+ramdisk_image: .long 0 # address of loaded ramdisk image
+ # Here the loader puts the 32-bit
+ # address where it loaded the image.
+ # This only will be read by the kernel.
+
+ramdisk_size: .long 0 # its size in bytes
+
+bootsect_kludge:
+ .word bootsect_helper, SETUPSEG
+
+heap_end_ptr: .word modelist+1024 # (Header version 0x0201 or later)
+ # space from here (exclusive) down to
+ # end of setup code can be used by setup
+ # for local heap purposes.
+
+pad1: .word 0
+cmd_line_ptr: .long 0 # (Header version 0x0202 or later)
+ # If nonzero, a 32-bit pointer
+ # to the kernel command line.
+ # The command line should be
+ # located between the start of
+ # setup and the end of low
+ # memory (0xa0000), or it may
+ # get overwritten before it
+ # gets read. If this field is
+ # used, there is no longer
+ # anything magical about the
+ # 0x90000 segment; the setup
+ # can be located anywhere in
+ # low memory 0x10000 or higher.
+
+ramdisk_max: .long __MAXMEM-1 # (Header version 0x0203 or later)
+ # The highest safe address for
+ # the contents of an initrd
+
+trampoline: call start_of_setup
+ .space 1024
+# End of setup header #####################################################
+
+start_of_setup:
+# Set %ds = %cs, we know that SETUPSEG = %cs at this point
+ movw %cs, %ax # aka SETUPSEG
+ movw %ax, %ds
+# Check signature at end of setup
+ cmpw $SIG1, setup_sig1
+ jne bad_sig
+
+ cmpw $SIG2, setup_sig2
+ jne bad_sig
+
+ jmp good_sig1
+
+# Routine to print asciiz string at ds:si
+prtstr:
+ lodsb
+ andb %al, %al
+ jz fin
+
+ call prtchr
+ jmp prtstr
+
+fin: ret
+
+no_sig_mess: .string "No setup signature found ..."
+
+good_sig1:
+ jmp good_sig
+
+# We now have to find the rest of the setup code/data
+bad_sig:
+ movw %cs, %ax # SETUPSEG
+ subw $DELTA_INITSEG, %ax # INITSEG
+ movw %ax, %ds
+ xorb %bh, %bh
+ movb (497), %bl # get setup sect from bootsect
+ subw $4, %bx # LILO loads 4 sectors of setup
+ shlw $8, %bx # convert to words (1sect=2^8 words)
+ movw %bx, %cx
+ shrw $3, %bx # convert to segment
+ addw $SYSSEG, %bx
+ movw %bx, %cs:start_sys_seg
+# Move rest of setup code/data to here
+ movw $2048, %di # four sectors loaded by LILO
+ subw %si, %si
+ pushw %cs
+ popw %es
+ movw $SYSSEG, %ax
+ movw %ax, %ds
+ rep
+ movsw
+ movw %cs, %ax # aka SETUPSEG
+ movw %ax, %ds
+ cmpw $SIG1, setup_sig1
+ jne no_sig
+
+ cmpw $SIG2, setup_sig2
+ jne no_sig
+
+ jmp good_sig
+
+no_sig:
+ lea no_sig_mess, %si
+ call prtstr
+
+no_sig_loop:
+ hlt
+ jmp no_sig_loop
+
+good_sig:
+ movw %cs, %ax # aka SETUPSEG
+ subw $DELTA_INITSEG, %ax # aka INITSEG
+ movw %ax, %ds
+# Check if an old loader tries to load a big-kernel
+ testb $LOADED_HIGH, %cs:loadflags # Do we have a big kernel?
+ jz loader_ok # No, no danger for old loaders.
+
+ cmpb $0, %cs:type_of_loader # Do we have a loader that
+ # can deal with us?
+ jnz loader_ok # Yes, continue.
+
+ pushw %cs # No, we have an old loader,
+ popw %ds # die.
+ lea loader_panic_mess, %si
+ call prtstr
+
+ jmp no_sig_loop
+
+loader_panic_mess: .string "Wrong loader, giving up..."
+
+loader_ok:
+# Get memory size (extended mem, kB)
+
+# On PC-9800, memory size detection is done completely in 32-bit
+# kernel initialize code (kernel/setup.c).
+ pushw %es
+ xorl %eax, %eax
+ movw %ax, %es
+ movb %al, (E820NR) # PC-9800 has no E820
+ movb %es:(0x401), %al
+ shll $7, %eax
+ addw $1024, %ax
+ movw %ax, (2)
+ movl %eax, (0x1e0)
+ movw %es:(0x594), %ax
+ shll $10, %eax
+ addl %eax, (0x1e0)
+ popw %es
+
+# Check for video adapter and its parameters and allow the
+# user to browse video modes.
+ call video # NOTE: we need %ds pointing
+ # to bootsector
+
+# Get text video mode
+ movb $0x0B, %ah
+ int $0x18 # CRT mode sense
+ movw $(20 << 8) + 40, %cx
+ testb $0x10, %al
+ jnz 3f
+ movb $20, %ch
+ testb $0x01, %al
+ jnz 1f
+ movb $25, %ch
+ jmp 1f
+3: # If bit 4 was 1, it means either 1) 31 lines for hi-reso mode,
+ # or 2) 30 lines for PC-9821.
+ movb $31, %ch # hireso mode value
+ pushw $0
+ popw %es
+ testb $0x08, %es:BIOS_FLAG
+ jnz 1f
+ movb $30, %ch
+1: # Now we got # of rows in %ch
+ movb %ch, (14)
+
+ testb $0x02, %al
+ jnz 2f
+ movb $80, %cl
+2: # Now we got # of columns in %cl
+ movb %cl, (7)
+
+ # Next, get horizontal frequency if supported
+ movw $0x3100, %ax
+ int $0x18 # Call CRT bios
+ movb %al, (6) # If 31h is unsupported, %al remains 0
+
+# Get hd0-3 data...
+ pushw %ds # aka INITSEG
+ popw %es
+ xorw %ax, %ax
+ movw %ax, %ds
+ cld
+ movw $0x0080, %di
+ movb DISK_EQUIP+1, %ah
+ movb $0x80, %al
+
+get_hd_info:
+ shrb %ah
+ pushw %ax
+ jnc 1f
+ movb $0x84, %ah
+ int $0x1b
+ jnc 2f # Success
+1: xorw %cx, %cx # `0 cylinders' means no drive
+2: # Attention! Work area (drive_info) is arranged for PC-9800.
+ movw %cx, %ax # # of cylinders
+ stosw
+ movw %dx, %ax # # of sectors / # of heads
+ stosw
+ movw %bx, %ax # sector size in bytes
+ stosw
+ popw %ax
+ incb %al
+ cmpb $0x84, %al
+ jb get_hd_info
+
+# Get fd data...
+ movw DISK_EQUIP, %ax
+ andw $0xf00f, %ax
+ orb %al, %ah
+ movb RDISK_EQUIP, %al
+ notb %al
+ andb %al, %ah # ignore all `RAM drive'
+
+ movb $0x30, %al
+
+get_fd_info:
+ shrb %ah
+ pushw %ax
+ jnc 1f
+ movb $0xc4, %ah
+ int $0x1b
+ movb %ah, %al
+ andb $4, %al # 1.44MB support flag
+ shrb %al
+ addb $2, %al # %al = 2 (1.2MB) or 4 (1.44MB)
+ jmp 2f
+1: movb $0, %al # no drive
+2: stosb
+ popw %ax
+ incb %al
+ testb $0x04, %al
+ jz get_fd_info
+
+ addb $(0xb0 - 0x34), %al
+ jnc get_fd_info # check FDs on 640KB I/F
+
+ pushw %es
+ popw %ds # %ds got bootsector again
+#if 0
+ mov $0, (0x1ff) # default is no pointing device
+#endif
+
+#if defined(CONFIG_APM) || defined(CONFIG_APM_MODULE)
+# Then check for an APM BIOS...
+ # %ds points to the bootsector
+ movw $0, 0x40 # version = 0 means no APM BIOS
+ movw $0x09a00, %ax # APM BIOS installation check
+ xorw %bx, %bx
+ int $0x1f
+ jc done_apm_bios # Nope, no APM BIOS
+
+ cmpw $0x0504d, %bx # Check for "PM" signature
+ jne done_apm_bios # No signature, no APM BIOS
+
+ testb $0x02, %cl # Is 32 bit supported?
+ je done_apm_bios # No 32-bit, no (good) APM BIOS
+
+ movw $0x09a04, %ax # Disconnect first just in case
+ xorw %bx, %bx
+ int $0x1f # ignore return code
+ movw $0x09a03, %ax # 32 bit connect
+ xorl %ebx, %ebx
+ int $0x1f
+ jc no_32_apm_bios # Ack, error.
+
+ movw %ax, (66) # BIOS code segment
+ movl %ebx, (68) # BIOS entry point offset
+ movw %cx, (72) # BIOS 16 bit code segment
+ movw %dx, (74) # BIOS data segment
+ movl %esi, (78) # BIOS code segment length
+ movw %di, (82) # BIOS data segment length
+# Redo the installation check as the 32 bit connect
+# modifies the flags returned on some BIOSs
+ movw $0x09a00, %ax # APM BIOS installation check
+ xorw %bx, %bx
+ int $0x1f
+ jc apm_disconnect # error -> shouldn't happen
+
+ cmpw $0x0504d, %bx # check for "PM" signature
+ jne apm_disconnect # no sig -> shouldn't happen
+
+ movw %ax, (64) # record the APM BIOS version
+ movw %cx, (76) # and flags
+ jmp done_apm_bios
+
+apm_disconnect: # Tidy up
+ movw $0x09a04, %ax # Disconnect
+ xorw %bx, %bx
+ int $0x1f # ignore return code
+
+ jmp done_apm_bios
+
+no_32_apm_bios:
+ andw $0xfffd, (76) # remove 32 bit support bit
+done_apm_bios:
+#endif
+
+# Pass cursor position to kernel...
+ movw %cs:cursor_address, %ax
+ shrw %ax # cursor_address is 2 bytes unit
+ movb $80, %cl
+ divb %cl
+ xchgb %al, %ah # (0) = %al = X, (1) = %ah = Y
+ movw %ax, (0)
+
+#if 0
+ movw $msg_cpos, %si
+ call prtstr_cs
+ call prthex
+ call prtstr_cs
+ movw %ds, %ax
+ call prthex
+ call prtstr_cs
+ movb $0x11, %ah
+ int $0x18
+ movb $0, %ah
+ int $0x18
+ .section .rodata, "a"
+msg_cpos: .string "Cursor position: 0x"
+ .string ", %ds:0x"
+ .string "\r\n"
+ .previous
+#endif
+
+# Now we want to move to protected mode ...
+ cmpw $0, %cs:realmode_swtch
+ jz rmodeswtch_normal
+
+ lcall *%cs:realmode_swtch
+
+ jmp rmodeswtch_end
+
+rmodeswtch_normal:
+ pushw %cs
+ call default_switch
+
+rmodeswtch_end:
+# we get the code32 start address and modify the below 'jmpi'
+# (loader may have changed it)
+ movl %cs:code32_start, %eax
+ movl %eax, %cs:code32
+
+# Now we move the system to its rightful place ... but we check if we have a
+# big-kernel. In that case we *must* not move it ...
+ testb $LOADED_HIGH, %cs:loadflags
+ jz do_move0 # .. then we have a normal low
+ # loaded zImage
+ # .. or else we have a high
+ # loaded bzImage
+ jmp end_move # ... and we skip moving
+
+do_move0:
+ movw $0x100, %ax # start of destination segment
+ movw %cs, %bp # aka SETUPSEG
+ subw $DELTA_INITSEG, %bp # aka INITSEG
+ movw %cs:start_sys_seg, %bx # start of source segment
+ cld
+do_move:
+ movw %ax, %es # destination segment
+ incb %ah # instead of add ax,#0x100
+ movw %bx, %ds # source segment
+ addw $0x100, %bx
+ subw %di, %di
+ subw %si, %si
+ movw $0x800, %cx
+ rep
+ movsw
+ cmpw %bp, %bx # assume start_sys_seg > 0x200,
+ # so we will perhaps read one
+ # page more than needed, but
+ # never overwrite INITSEG
+ # because destination is a
+ # minimum one page below source
+ jb do_move
+
+end_move:
+# then we load the segment descriptors
+ movw %cs, %ax # aka SETUPSEG
+ movw %ax, %ds
+
+# Check whether we need to be downward compatible with version <=201
+ cmpl $0, cmd_line_ptr
+ jne end_move_self # loader uses version >=202 features
+ cmpb $0x20, type_of_loader
+ je end_move_self # bootsect loader, we know of it
+
+# Boot loader does not support boot protocol version 2.02.
+# If we have our code not at 0x90000, we need to move it there now.
+# We also then need to move the params behind it (commandline)
+# Because we would overwrite the code on the current IP, we move
+# it in two steps, jumping high after the first one.
+ movw %cs, %ax
+ cmpw $SETUPSEG, %ax
+ je end_move_self
+
+ cli # make sure we really have
+ # interrupts disabled !
+ # because after this the stack
+ # should not be used
+ subw $DELTA_INITSEG, %ax # aka INITSEG
+ movw %ss, %dx
+ cmpw %ax, %dx
+ jb move_self_1
+
+ addw $INITSEG, %dx
+ subw %ax, %dx # this will go into %ss after
+ # the move
+move_self_1:
+ movw %ax, %ds
+ movw $INITSEG, %ax # real INITSEG
+ movw %ax, %es
+ movw %cs:setup_move_size, %cx
+ std # we have to move up, so we use
+ # direction down because the
+ # areas may overlap
+ movw %cx, %di
+ decw %di
+ movw %di, %si
+ subw $move_self_here+0x200, %cx
+ rep
+ movsb
+ ljmp $SETUPSEG, $move_self_here
+
+move_self_here:
+ movw $move_self_here+0x200, %cx
+ rep
+ movsb
+ movw $SETUPSEG, %ax
+ movw %ax, %ds
+ movw %dx, %ss
+
+end_move_self: # now we are at the right place
+ lidt idt_48 # load idt with 0,0
+ xorl %eax, %eax # Compute gdt_base
+ movw %ds, %ax # (Convert %ds:gdt to a linear ptr)
+ shll $4, %eax
+ addl $gdt, %eax
+ movl %eax, (gdt_48+2)
+ lgdt gdt_48 # load gdt with whatever is
+ # appropriate
+
+# that was painless, now we enable A20
+
+ outb %al, $0xf2 # A20 on
+ movb $0x02, %al
+ outb %al, $0xf6 # also A20 on; making ITF's
+ # way our model
+
+ # PC-9800 seems to enable A20 at the moment of `outb';
+ # so we don't wait unlike IBM PCs (see ../setup.S).
+
+# enable DMA to access memory over 0x100000 (1MB).
+
+ movw $0x439, %dx
+ inb %dx, %al
+ andb $(~4), %al
+ outb %al, %dx
+
+# Set DMA to increment its bank address automatically at 16MB boundary.
+# Initial setting is 64KB boundary mode so that we can't run DMA crossing
+# physical address 0xXXXXFFFF.
+
+ movb $0x0c, %al
+ outb %al, $0x29 # ch. 0
+ movb $0x0d, %al
+ outb %al, $0x29 # ch. 1
+ movb $0x0e, %al
+ outb %al, $0x29 # ch. 2
+ movb $0x0f, %al
+ outb %al, $0x29 # ch. 3
+ movb $0x50, %al
+ outb %al, $0x11 # reinitialize DMAC
+
+# make sure any possible coprocessor is properly reset..
+ movb $0, %al
+ outb %al, $0xf8
+ outb %al, $0x5f # delay
+
+# well, that went ok, I hope. Now we mask all interrupts - the rest
+# is done in init_IRQ().
+ movb $0xFF, %al # mask all interrupts for now
+ outb %al, $0x0A
+ outb %al, $0x5f # delay
+
+ movb $0x7F, %al # mask all irq's but irq7 which
+ outb %al, $0x02 # is cascaded
+
+# Well, that certainly wasn't fun :-(. Hopefully it works, and we don't
+# need no steenking BIOS anyway (except for the initial loading :-).
+# The BIOS-routine wants lots of unnecessary data, and it's less
+# "interesting" anyway. This is how REAL programmers do it.
+#
+# Well, now's the time to actually move into protected mode. To make
+# things as simple as possible, we do no register set-up or anything,
+# we let the gnu-compiled 32-bit programs do that. We just jump to
+# absolute address 0x1000 (or the loader supplied one),
+# in 32-bit protected mode.
+#
+# Note that the short jump isn't strictly needed, although there are
+# reasons why it might be a good idea. It won't hurt in any case.
+ movw $1, %ax # protected mode (PE) bit
+ lmsw %ax # This is it!
+ jmp flush_instr
+
+flush_instr:
+ xorw %bx, %bx # Flag to indicate a boot
+ xorl %esi, %esi # Pointer to real-mode code
+ movw %cs, %si
+ subw $DELTA_INITSEG, %si
+ shll $4, %esi # Convert to 32-bit pointer
+# NOTE: For high loaded big kernels we need a
+# jmpi 0x100000,__BOOT_CS
+#
+# but we yet haven't reloaded the CS register, so the default size
+# of the target offset still is 16 bit.
+# However, using an operand prefix (0x66), the CPU will properly
+# take our 48 bit far pointer. (INTeL 80386 Programmer's Reference
+# Manual, Mixing 16-bit and 32-bit code, page 16-6)
+
+ .byte 0x66, 0xea # prefix + jmpi-opcode
+code32: .long 0x1000 # will be set to 0x100000
+ # for big kernels
+ .word __BOOT_CS
+
+# Here's a bunch of information about your current kernel..
+kernel_version: .ascii UTS_RELEASE
+ .ascii " ("
+ .ascii LINUX_COMPILE_BY
+ .ascii "@"
+ .ascii LINUX_COMPILE_HOST
+ .ascii ") "
+ .ascii UTS_VERSION
+ .byte 0
+
+# This is the default real mode switch routine.
+# to be called just before protected mode transition
+default_switch:
+ cli # no interrupts allowed !
+ outb %al, $0x50 # disable NMI for bootup
+ # sequence
+ lret
+
+# This routine only gets called, if we get loaded by the simple
+# bootsect loader _and_ have a bzImage to load.
+# Because there is no place left in the 512 bytes of the boot sector,
+# we must emigrate to code space here.
+bootsect_helper:
+ cmpw $0, %cs:bootsect_es
+ jnz bootsect_second
+
+ movb $0x20, %cs:type_of_loader
+ movw %es, %ax
+ shrw $4, %ax
+ movb %ah, %cs:bootsect_src_base+2
+ movw %es, %ax
+ movw %ax, %cs:bootsect_es
+ subw $SYSSEG, %ax
+ lret # nothing else to do for now
+
+bootsect_second:
+ pushw %bx
+ pushw %cx
+ pushw %si
+ pushw %di
+ testw %bp, %bp # 64K full ?
+ jne bootsect_ex
+
+ xorw %cx, %cx # zero means full 64K
+ pushw %cs
+ popw %es
+ movw $bootsect_gdt, %bx
+ xorw %si, %si # source address
+ xorw %di, %di # destination address
+ movb $0x90, %ah
+ int $0x1f
+ jc bootsect_panic # this, if INT1F fails
+
+ movw %cs:bootsect_es, %es # we reset %es to always point
+ incb %cs:bootsect_dst_base+2 # to 0x10000
+bootsect_ex:
+ movb %cs:bootsect_dst_base+2, %ah
+ shlb $4, %ah # we now have the number of
+ # moved frames in %ax
+ xorb %al, %al
+ popw %di
+ popw %si
+ popw %cx
+ popw %bx
+ lret
+
+bootsect_gdt:
+ .word 0, 0, 0, 0
+ .word 0, 0, 0, 0
+
+bootsect_src:
+ .word 0xffff
+
+bootsect_src_base:
+ .byte 0x00, 0x00, 0x01 # base = 0x010000
+ .byte 0x93 # typbyte
+ .word 0 # limit16,base24 =0
+
+bootsect_dst:
+ .word 0xffff
+
+bootsect_dst_base:
+ .byte 0x00, 0x00, 0x10 # base = 0x100000
+ .byte 0x93 # typbyte
+ .word 0 # limit16,base24 =0
+ .word 0, 0, 0, 0 # BIOS CS
+ .word 0, 0, 0, 0 # BIOS DS
+
+bootsect_es:
+ .word 0
+
+bootsect_panic:
+ pushw %cs
+ popw %ds
+ cld
+ leaw bootsect_panic_mess, %si
+ call prtstr
+
+bootsect_panic_loop:
+ jmp bootsect_panic_loop
+
+bootsect_panic_mess:
+ .string "INT1F refuses to access high mem, giving up."
+
+# This routine prints one character (in %al) on console.
+# PC-9800 doesn't have BIOS-function to do it like IBM PC's INT 10h - 0Eh,
+# so we hardcode `prtchr' subroutine here.
+prtchr:
+ pushaw
+ pushw %es
+ cmpb $0, %cs:prtchr_initialized
+ jnz prtchr_ok
+ xorw %cx, %cx
+ movw %cx, %es
+ testb $0x8, %es:BIOS_FLAG
+ jz 1f
+ movb $(HIRESO_TEXT >> 8), %cs:cursor_address+3
+ movw $(80 * 31 * 2), %cs:max_cursor_offset
+1: pushw %ax
+ call get_cursor_position
+ movw %ax, %cs:cursor_address
+ popw %ax
+ movb $1, %cs:prtchr_initialized
+prtchr_ok:
+ lesw %cs:cursor_address, %di
+ movw $160, %bx
+ movb $0, %ah
+ cmpb $13, %al
+ je do_cr
+ cmpb $10, %al
+ je do_lf
+
+ # normal (printable) character
+ stosw
+ movb $0xe1, %es:0x2000-2(%di)
+ jmp 1f
+
+do_cr: movw %di, %ax
+ divb %bl # %al = Y, %ah = X * 2
+ mulb %bl
+ movw %ax, %dx
+ jmp 2f
+
+do_lf: addw %bx, %di
+1: movw %cs:max_cursor_offset, %cx
+ cmpw %cx, %di
+ movw %di, %dx
+ jb 2f
+ # cursor reaches bottom of screen; scroll it
+ subw %bx, %dx
+ xorw %di, %di
+ movw %bx, %si
+ cld
+ subw %bx, %cx
+ shrw %cx
+ pushw %cx
+ rep; es; movsw
+ movb $32, %al # clear bottom line characters
+ movb $80, %cl
+ rep; stosw
+ movw $0x2000, %di
+ popw %cx
+ leaw (%bx,%di), %si
+ rep; es; movsw
+ movb $0xe1, %al # clear bottom line attributes
+ movb $80, %cl
+ rep; stosw
+2: movw %dx, %cs:cursor_address
+ movb $0x13, %ah # move cursor to right position
+ int $0x18
+ popw %es
+ popaw
+ ret
+
+cursor_address:
+ .word 0
+ .word NORMAL_TEXT
+max_cursor_offset:
+ .word 80 * 25 * 2 # for normal 80x25 mode
+
+# putstr may called without running through start_of_setup (via bootsect_panic)
+# so we should initialize ourselves on demand.
+prtchr_initialized:
+ .byte 0
+
+# This routine queries GDC (graphic display controller) for current cursor
+# position. Cursor position is returned in %ax (CPU offset address).
+get_cursor_position:
+1: inb $0x60, %al
+ outb %al, $0x5f # delay
+ outb %al, $0x5f # delay
+ testb $0x04, %al # Is FIFO empty?
+ jz 1b # no -> wait until empty
+
+ movb $0xe0, %al # CSRR command
+ outb %al, $0x62 # command write
+ outb %al, $0x5f # delay
+ outb %al, $0x5f # delay
+
+2: inb $0x60, %al
+ outb %al, $0x5f # delay
+ outb %al, $0x5f # delay
+ testb $0x01, %al # Is DATA READY?
+ jz 2b # no -> wait until ready
+
+ inb $0x62, %al # read xAD (L)
+ outb %al, $0x5f # delay
+ outb %al, $0x5f # delay
+ movb %al, %ah
+ inb $0x62, %al # read xAD (H)
+ outb %al, $0x5f # delay
+ outb %al, $0x5f # delay
+ xchgb %al, %ah # correct byte order
+ pushw %ax
+ inb $0x62, %al # read yAD (L)
+ outb %al, $0x5f # delay
+ outb %al, $0x5f # delay
+ inb $0x62, %al # read yAD (M)
+ outb %al, $0x5f # delay
+ outb %al, $0x5f # delay
+ inb $0x62, %al # read yAD (H)
+ # yAD is not our interest,
+ # so discard it.
+ popw %ax
+ addw %ax, %ax # convert to CPU address
+ ret
+
+# Descriptor tables
+#
+# NOTE: The intel manual says gdt should be sixteen bytes aligned for
+# efficiency reasons. However, there are machines which are known not
+# to boot with misaligned GDTs, so alter this at your peril! If you alter
+# GDT_ENTRY_BOOT_CS (in asm/segment.h) remember to leave at least two
+# empty GDT entries (one for NULL and one reserved).
+#
+# NOTE: On some CPUs, the GDT must be 8 byte aligned. This is
+# true for the Voyager Quad CPU card which will not boot without
+# This directive. 16 byte aligment is recommended by intel.
+#
+ .align 16
+gdt:
+ .fill GDT_ENTRY_BOOT_CS,8,0
+
+ .word 0xFFFF # 4Gb - (0x100000*0x1000 = 4Gb)
+ .word 0 # base address = 0
+ .word 0x9A00 # code read/exec
+ .word 0x00CF # granularity = 4096, 386
+ # (+5th nibble of limit)
+
+ .word 0xFFFF # 4Gb - (0x100000*0x1000 = 4Gb)
+ .word 0 # base address = 0
+ .word 0x9200 # data read/write
+ .word 0x00CF # granularity = 4096, 386
+ # (+5th nibble of limit)
+gdt_end:
+ .align 4
+
+ .word 0 # alignment byte
+idt_48:
+ .word 0 # idt limit = 0
+ .word 0, 0 # idt base = 0L
+
+ .word 0 # alignment byte
+gdt_48:
+ .word gdt_end - gdt - 1 # gdt limit
+ .word 0, 0 # gdt base (filled in later)
+
+# Include video setup & detection code
+
+#include "video.S"
+
+# Setup signature -- must be last
+setup_sig1: .word SIG1
+setup_sig2: .word SIG2
+
+# After this point, there is some free space which is used by the video mode
+# handling code to store the temporary mode table (not used by the kernel).
+
+modelist:
+
+.text
+endtext:
+.data
+enddata:
+.bss
+endbss:
diff -Nru a/arch/i386/boot98/tools/build.c b/arch/i386/boot98/tools/build.c
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/arch/i386/boot98/tools/build.c Fri Feb 14 14:38:01 2003
@@ -0,0 +1,188 @@
+/*
+ * $Id: build.c,v 1.5 1997/05/19 12:29:58 mj Exp $
+ *
+ * Copyright (C) 1991, 1992 Linus Torvalds
+ * Copyright (C) 1997 Martin Mares
+ */
+
+/*
+ * This file builds a disk-image from three different files:
+ *
+ * - bootsect: exactly 512 bytes of 8086 machine code, loads the rest
+ * - setup: 8086 machine code, sets up system parm
+ * - system: 80386 code for actual system
+ *
+ * It does some checking that all files are of the correct type, and
+ * just writes the result to stdout, removing headers and padding to
+ * the right amount. It also writes some system data to stderr.
+ */
+
+/*
+ * Changes by tytso to allow root device specification
+ * High loaded stuff by Hans Lermen & Werner Almesberger, Feb. 1996
+ * Cross compiling fixes by Gertjan van Wingerde, July 1996
+ * Rewritten by Martin Mares, April 1997
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+typedef unsigned char byte;
+typedef unsigned short word;
+typedef unsigned long u32;
+
+#define DEFAULT_MAJOR_ROOT 0
+#define DEFAULT_MINOR_ROOT 0
+
+/* Minimal number of setup sectors (see also bootsect.S) */
+#define SETUP_SECTS 4
+
+byte buf[1024];
+int fd;
+int is_big_kernel;
+
+void die(const char * str, ...)
+{
+ va_list args;
+ va_start(args, str);
+ vfprintf(stderr, str, args);
+ fputc('\n', stderr);
+ exit(1);
+}
+
+void file_open(const char *name)
+{
+ if ((fd = open(name, O_RDONLY, 0)) < 0)
+ die("Unable to open `%s': %m", name);
+}
+
+void usage(void)
+{
+ die("Usage: build [-b] bootsect setup system [rootdev] [> image]");
+}
+
+int main(int argc, char ** argv)
+{
+ unsigned int i, c, sz, setup_sectors;
+ u32 sys_size;
+ byte major_root, minor_root;
+ struct stat sb;
+
+ if (argc > 2 && !strcmp(argv[1], "-b"))
+ {
+ is_big_kernel = 1;
+ argc--, argv++;
+ }
+ if ((argc < 4) || (argc > 5))
+ usage();
+ if (argc > 4) {
+ if (!strcmp(argv[4], "CURRENT")) {
+ if (stat("/", &sb)) {
+ perror("/");
+ die("Couldn't stat /");
+ }
+ major_root = major(sb.st_dev);
+ minor_root = minor(sb.st_dev);
+ } else if (strcmp(argv[4], "FLOPPY")) {
+ if (stat(argv[4], &sb)) {
+ perror(argv[4]);
+ die("Couldn't stat root device.");
+ }
+ major_root = major(sb.st_rdev);
+ minor_root = minor(sb.st_rdev);
+ } else {
+ major_root = 0;
+ minor_root = 0;
+ }
+ } else {
+ major_root = DEFAULT_MAJOR_ROOT;
+ minor_root = DEFAULT_MINOR_ROOT;
+ }
+ fprintf(stderr, "Root device is (%d, %d)\n", major_root, minor_root);
+
+ file_open(argv[1]);
+ i = read(fd, buf, sizeof(buf));
+ fprintf(stderr,"Boot sector %d bytes.\n",i);
+ if (i != 512)
+ die("Boot block must be exactly 512 bytes");
+ if (buf[510] != 0x55 || buf[511] != 0xaa)
+ die("Boot block hasn't got boot flag (0xAA55)");
+ buf[508] = minor_root;
+ buf[509] = major_root;
+ if (write(1, buf, 512) != 512)
+ die("Write call failed");
+ close (fd);
+
+ file_open(argv[2]); /* Copy the setup code */
+ for (i=0 ; (c=read(fd, buf, sizeof(buf)))>0 ; i+=c )
+ if (write(1, buf, c) != c)
+ die("Write call failed");
+ if (c != 0)
+ die("read-error on `setup'");
+ close (fd);
+
+ setup_sectors = (i + 511) / 512; /* Pad unused space with zeros */
+ if (!(setup_sectors & 1))
+ setup_sectors++; /* setup_sectors must be odd on NEC PC-9800 */
+ fprintf(stderr, "Setup is %d bytes.\n", i);
+ memset(buf, 0, sizeof(buf));
+ while (i < setup_sectors * 512) {
+ c = setup_sectors * 512 - i;
+ if (c > sizeof(buf))
+ c = sizeof(buf);
+ if (write(1, buf, c) != c)
+ die("Write call failed");
+ i += c;
+ }
+
+ file_open(argv[3]);
+ if (fstat (fd, &sb))
+ die("Unable to stat `%s': %m", argv[3]);
+ sz = sb.st_size;
+ fprintf (stderr, "System is %d kB\n", sz/1024);
+ sys_size = (sz + 15) / 16;
+ /* 0x28000*16 = 2.5 MB, conservative estimate for the current maximum */
+ if (sys_size > (is_big_kernel ? 0x28000 : DEF_SYSSIZE))
+ die("System is too big. Try using %smodules.",
+ is_big_kernel ? "" : "bzImage or ");
+ if (sys_size > 0xefff)
+ fprintf(stderr,"warning: kernel is too big for standalone boot "
+ "from floppy\n");
+ while (sz > 0) {
+ int l, n;
+
+ l = (sz > sizeof(buf)) ? sizeof(buf) : sz;
+ if ((n=read(fd, buf, l)) != l) {
+ if (n < 0)
+ die("Error reading %s: %m", argv[3]);
+ else
+ die("%s: Unexpected EOF", argv[3]);
+ }
+ if (write(1, buf, l) != l)
+ die("Write failed");
+ sz -= l;
+ }
+ close(fd);
+
+ if (lseek(1, 497, SEEK_SET) != 497) /* Write sizes to the bootsector */
+ die("Output: seek failed");
+ buf[0] = setup_sectors;
+ if (write(1, buf, 1) != 1)
+ die("Write of setup sector count failed");
+ if (lseek(1, 500, SEEK_SET) != 500)
+ die("Output: seek failed");
+ buf[0] = (sys_size & 0xff);
+ buf[1] = ((sys_size >> 8) & 0xff);
+ if (write(1, buf, 2) != 2)
+ die("Write of image length failed");
+
+ return 0; /* Everything is OK */
+}
diff -Nru a/arch/i386/boot98/video.S b/arch/i386/boot98/video.S
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/arch/i386/boot98/video.S Fri Feb 14 14:38:01 2003
@@ -0,0 +1,262 @@
+/* video.S
+ *
+ * Video mode setup, etc. for NEC PC-9800 series.
+ *
+ * Copyright (C) 1997,98,99 Linux/98 project
+ *
+ * Based on the video.S for IBM PC:
+ * copyright (C) Martin Mares
+ */
+
+/* Positions of various video parameters passed to the kernel */
+/* (see also include/linux/tty.h) */
+#define PARAM_CURSOR_POS 0x00
+#define PARAM_VIDEO_PAGE 0x04
+#define PARAM_VIDEO_MODE 0x06
+#define PARAM_VIDEO_COLS 0x07
+#define PARAM_VIDEO_EGA_BX 0x0a
+#define PARAM_VIDEO_LINES 0x0e
+#define PARAM_HAVE_VGA 0x0f
+#define PARAM_FONT_POINTS 0x10
+
+#define PARAM_VIDEO98_COMPAT 0x0a
+#define PARAM_VIDEO98_HIRESO 0x0b
+#define PARAM_VIDEO98_MACHTYPE 0x0c
+#define PARAM_VIDEO98_LINES 0x0e
+#define PARAM_VIDEO98_COLS 0x0f
+
+# PARAM_LFB_* and PARAM_VESAPM_* are unused on PC-9800.
+
+# This is the main entry point called by setup.S
+# %ds *must* be pointing to the bootsector
+video: xorw %ax, %ax
+ movw %ax, %es # %es = 0
+
+ movb %es:BIOS_FLAG, %al
+ movb %al, PARAM_VIDEO_MODE
+
+ movb $0, PARAM_VIDEO98_HIRESO # 0 = normal
+ movw $NORMAL_TEXT, PARAM_VIDEO_PAGE
+ testb $0x8, %al
+ movw $(80 * 256 + 25), %ax
+ jz 1f
+ # hireso machine.
+ movb $1, PARAM_VIDEO98_HIRESO # !0 = hi-reso
+ movb $(HIRESO_TEXT >> 8), PARAM_VIDEO_PAGE + 1
+ movw $(80 * 256 + 31), %ax
+1: movw %ax, PARAM_VIDEO98_LINES # also sets VIDEO98_COLS
+
+ movb $0xc0, %ch # 400-line graphic mode
+ movb $0x42, %ah
+ int $0x18
+
+ movw $80, PARAM_VIDEO_COLS
+
+ movw $msg_probing, %si
+ call prtstr_cs
+
+# Check vendor from font pattern of `A'...
+
+1: inb $0x60, %al # wait V-sync
+ testb $0x20, %al
+ jnz 1b
+2: inb $0x60, %al
+ testb $0x20, %al
+ jz 2b
+
+ movb $0x00, %al # select font of `A'
+ outb %al, $0xa1
+ movb $0x41, %al
+ outb %al, $0xa3
+
+ movw $8, %cx
+ movw PARAM_VIDEO_PAGE, %ax
+ cmpw $NORMAL_TEXT, %ax
+ je 3f
+ movb $24, %cl # for hi-reso machine
+3: addw $0x400, %ax # %ax = CG window segment
+ pushw %ds
+ movw %ax, %ds
+ xorw %dx, %dx # get sum of `A' pattern...
+ xorw %si, %si
+4: lodsw
+ addw %ax, %dx
+ loop 4b
+ popw %ds
+
+ movw %dx, %ax
+ movw $msg_nec, %si
+ xorw %bx, %bx # vendor info will go into %bx
+ testb $8, %es:BIOS_FLAG
+ jnz check_hireso_vendor
+ cmpw $0xc7f8, %ax
+ je 5f
+ jmp 6f
+check_hireso_vendor:
+ cmpw $0x9639, %ax # XXX: NOT VERIFIED!!!
+ je 5f
+6: incw %bx # compatible machine
+ movw $msg_compat, %si
+5: movb %bl, PARAM_VIDEO98_COMPAT
+ call prtstr_cs
+
+ movw $msg_fontdata, %si
+ call prtstr_cs # " (CG sum of A = 0x"
+ movw %dx, %ax
+ call prthex
+ call prtstr_cs # ") PC-98"
+
+ movb $'0', %al
+ pushw %ds
+ pushw $0xf8e8
+ popw %ds
+ cmpw $0x2198, (0)
+ popw %ds
+ jne 7f
+ movb $'2', %al
+7: call prtchr
+ call prtstr_cs # "1 "
+
+ movb $0, PARAM_VIDEO98_MACHTYPE
+#if 0 /* XXX - This check is bogus? [0000:BIOS_FLAG2]-bit7 does NOT
+ indicate whether it is a note machine, but merely indicates
+ whether it has ``RAM drive''. */
+# check note machine
+ testb $0x80, %es:BIOS_FLAG2
+ jnz is_note
+ pushw %ds
+ pushw $0xfd80
+ popw %ds
+ movb (4), %al
+ popw %ds
+ cmpb $0x20, %al # EPSON note A
+ je epson_note
+ cmpb $0x22, %al # EPSON note W
+ je epson_note
+ cmpb $0x27, %al # EPSON note AE
+ je epson_note
+ cmpb $0x2a, %al # EPSON note WR
+ jne note_done
+epson_note:
+ movb $1, PARAM_VIDEO98_MACHTYPE
+ movw $msg_note, %si
+ call prtstr_cs
+note_done:
+#endif
+
+# print h98 ? (only NEC)
+ cmpb $0, PARAM_VIDEO98_COMPAT
+ jnz 8f # not NEC -> not H98
+
+ testb $0x80, %es:BIOS_FLAG5
+ jz 8f # have NESA bus -> H98
+ movw $msg_h98, %si
+ call prtstr_cs
+ orb $2, PARAM_VIDEO98_MACHTYPE
+8: testb $0x40, %es:BIOS_FLAG5
+ jz 9f
+ movw $msg_gs, %si
+ call prtstr_cs # only prints it :-)
+9:
+ movw $msg_normal, %si # "normal"
+ testb $0x8, %es:BIOS_FLAG
+ jz 1f
+ movw $msg_hireso, %si
+1: call prtstr_cs
+
+ movw $msg_sysclk, %si
+ call prtstr_cs
+ movb $'5', %al
+ testb $0x80, %es:BIOS_FLAG
+ jz 2f
+ movb $'8', %al
+2: call prtchr
+ call prtstr_cs
+
+#if 0
+ testb $0x40, %es:(0x45c)
+ jz no_30line # no 30-line support
+
+ movb %es:KB_SHFT_STS, %al
+ testb $0x01, %al # is SHIFT key pressed?
+ jz no_30line
+
+ testb $0x10, %al # is CTRL key pressed?
+ jnz line40
+
+ # switch to 30-line mode
+ movb $30, PARAM_VIDEO98_LINES
+ movw $msg_30line, %si
+ jmp 3f
+
+line40:
+ movb $37, PARAM_VIDEO98_LINES
+ movw $40, PARAM_VIDEO_LINES
+ movw $msg_40line, %si
+3: call prtstr_cs
+
+ movb $0x32, %bh
+ movw $0x300c, %ax
+ int $0x18 # switch video mode
+ movb $0x0c, %ah
+ int $0x18 # turn on text plane
+ movw %cs:cursor_address, %dx
+ movb $0x13, %ah
+ int $0x18 # move cursor to correct place
+ mov $0x11, %ah
+ int $0x18 # turn on text plane
+
+ call prtstr_cs # "Ok.\r\n"
+no_30line:
+#endif
+ ret
+
+prtstr_cs:
+ pushw %ds
+ pushw %cs
+ popw %ds
+ call prtstr
+ popw %ds
+ ret
+
+# prthex is for debugging purposes, and prints %ax in hexadecimal.
+prthex: pushw %cx
+ movw $4, %cx
+1: rolw $4, %ax
+ pushw %ax
+ andb $0xf, %al
+ cmpb $10, %al
+ sbbb $0x69, %al
+ das
+ call prtchr
+ popw %ax
+ loop 1b
+ popw %cx
+ ret
+
+msg_probing: .string "Probing machine: "
+
+msg_nec: .string "NEC"
+msg_compat: .string "compatible"
+
+msg_fontdata: .string " (CG sum of A = 0x"
+ .string ") PC-98"
+ .string "1 "
+
+msg_gs: .string "(GS) "
+msg_h98: .string "(H98) "
+
+msg_normal: .string "normal"
+msg_hireso: .string "Hi-reso"
+
+msg_sysclk: .string " mode, system clock "
+ .string "MHz\r\n"
+
+#if 0
+msg_40line: # cpp will concat following lines, so the assembler can deal.
+ .ascii "\
+Video mode will be adjusted to 37-line (so-called ``40-line'') mode later.\r\n\
+THIS MODE MAY DAMAGE YOUR MONITOR PHYSICALLY. USE AT YOUR OWN RISK.\r\n"
+msg_30line: .string "Switching video mode to 30-line (640x480) mode... "
+ .string "Ok.\r\n"
+#endif
diff -Nru a/arch/i386/kernel/cpu/cpufreq/longhaul.c b/arch/i386/kernel/cpu/cpufreq/longhaul.c
--- a/arch/i386/kernel/cpu/cpufreq/longhaul.c Tue Mar 11 17:20:59 2003
+++ b/arch/i386/kernel/cpu/cpufreq/longhaul.c Mon Mar 17 05:50:14 2003
@@ -525,9 +525,6 @@
{
struct cpuinfo_x86 *c = cpu_data;
- if ((c->x86_vendor != X86_VENDOR_CENTAUR) || (c->x86 !=6) )
- return -ENODEV;
-
switch (c->x86_model) {
case 6: /* VIA C3 Samuel C5A */
longhaul=1;
diff -Nru a/arch/i386/kernel/cpu/cpufreq/longrun.c b/arch/i386/kernel/cpu/cpufreq/longrun.c
--- a/arch/i386/kernel/cpu/cpufreq/longrun.c Sat Mar 8 01:37:35 2003
+++ b/arch/i386/kernel/cpu/cpufreq/longrun.c Mon Mar 17 05:54:38 2003
@@ -229,9 +229,6 @@
/* capability check */
if (policy->cpu != 0)
return -ENODEV;
- if (c->x86_vendor != X86_VENDOR_TRANSMETA ||
- !cpu_has(c, X86_FEATURE_LONGRUN))
- return -ENODEV;
/* detect low and high frequency */
result = longrun_determine_freqs(&longrun_low_freq, &longrun_high_freq);
diff -Nru a/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c b/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c
--- a/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c Sat Mar 8 01:39:17 2003
+++ b/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c Mon Mar 17 05:57:02 2003
@@ -180,13 +180,6 @@
int cpuid = 0;
unsigned int i;
- /* capability check */
- if (c->x86_vendor != X86_VENDOR_INTEL)
- return -ENODEV;
- if (!test_bit(X86_FEATURE_ACPI, c->x86_capability) ||
- !test_bit(X86_FEATURE_ACC, c->x86_capability))
- return -ENODEV;
-
/* Errata workaround */
cpuid = (c->x86 << 8) | (c->x86_model << 4) | c->x86_mask;
switch (cpuid) {
diff -Nru a/arch/i386/kernel/cpu/cpufreq/powernow-k6.c b/arch/i386/kernel/cpu/cpufreq/powernow-k6.c
--- a/arch/i386/kernel/cpu/cpufreq/powernow-k6.c Sat Mar 8 01:37:35 2003
+++ b/arch/i386/kernel/cpu/cpufreq/powernow-k6.c Mon Mar 17 05:53:03 2003
@@ -145,10 +145,6 @@
struct cpuinfo_x86 *c = cpu_data;
unsigned int i;
- /* capability check */
- if ((c->x86_vendor != X86_VENDOR_AMD) || (c->x86 != 5) ||
- ((c->x86_model != 12) && (c->x86_model != 13)))
- return -ENODEV;
if (policy->cpu != 0)
return -ENODEV;
diff -Nru a/arch/i386/kernel/dmi_scan.c b/arch/i386/kernel/dmi_scan.c
--- a/arch/i386/kernel/dmi_scan.c Thu Mar 13 12:16:41 2003
+++ b/arch/i386/kernel/dmi_scan.c Thu Mar 20 16:00:01 2003
@@ -499,6 +499,19 @@
return 0;
}
+/*
+ * Exploding PnPBIOS. Don't yet know if its the BIOS or us for
+ * some entries
+ */
+
+static __init int exploding_pnp_bios(struct dmi_blacklist *d)
+{
+ printk(KERN_WARNING "%s detected. Disabling PnPBIOS\n", d->ident);
+ dmi_broken |= BROKEN_PNP_BIOS;
+ return 0;
+}
+
+
/*
* Simple "print if true" callback
@@ -686,6 +699,13 @@
MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
MATCH(DMI_BIOS_VERSION, "WXPO1Z3"),
MATCH(DMI_BIOS_DATE, "10/26/01"), NO_MATCH
+ } },
+
+ { exploding_pnp_bios, "Higraded P14H", { /* BIOSPnP problem */
+ MATCH(DMI_BIOS_VENDOR, "American Megatrends Inc."),
+ MATCH(DMI_BIOS_VERSION, "07.00T"),
+ MATCH(DMI_SYS_VENDOR, "Higraded"),
+ MATCH(DMI_PRODUCT_NAME, "P14H")
} },
/* Machines which have problems handling enabled local APICs */
diff -Nru a/arch/i386/kernel/entry.S b/arch/i386/kernel/entry.S
--- a/arch/i386/kernel/entry.S Mon Mar 10 14:41:23 2003
+++ b/arch/i386/kernel/entry.S Thu Mar 20 21:43:55 2003
@@ -73,10 +73,10 @@
VM_MASK = 0x00020000
/*
- * ESP0 is at offset 4. 0x100 is the size of the TSS, and
+ * ESP0 is at offset 4. 0x200 is the size of the TSS, and
* also thus the top-of-stack pointer offset of SYSENTER_ESP
*/
-TSS_ESP0_OFFSET = (4 - 0x100)
+TSS_ESP0_OFFSET = (4 - 0x200)
#ifdef CONFIG_PREEMPT
#define preempt_stop cli
@@ -479,23 +479,32 @@
* by hand onto the new stack - while updating the return eip past
* the instruction that would have done it for sysenter.
*/
-#define CHECK_SYSENTER_EIP \
- cmpl $sysenter_entry,(%esp); \
- jne 1f; \
- movl TSS_ESP0_OFFSET+12(%esp),%esp; \
+#define FIX_STACK(offset, ok, label) \
+ cmpw $__KERNEL_CS,4(%esp); \
+ jne ok; \
+label: \
+ movl TSS_ESP0_OFFSET+offset(%esp),%esp; \
pushfl; \
pushl $__KERNEL_CS; \
- pushl $sysenter_past_esp; \
-1:
+ pushl $sysenter_past_esp
ENTRY(debug)
- CHECK_SYSENTER_EIP
+ cmpl $sysenter_entry,(%esp)
+ jne debug_stack_correct
+ FIX_STACK(12, debug_stack_correct, debug_esp_fix_insn)
+debug_stack_correct:
pushl $0
pushl $do_debug
jmp error_code
ENTRY(nmi)
- CHECK_SYSENTER_EIP
+ cmpl $sysenter_entry,(%esp)
+ je nmi_stack_fixup
+ cmpl $debug - 1,(%esp)
+ jle nmi_stack_correct
+ cmpl $debug_esp_fix_insn,(%esp)
+ jle nmi_debug_stack_fixup
+nmi_stack_correct:
pushl %eax
SAVE_ALL
movl %esp, %edx
@@ -504,6 +513,13 @@
call do_nmi
addl $8, %esp
RESTORE_ALL
+
+nmi_stack_fixup:
+ FIX_STACK(12,nmi_stack_correct, 1)
+ jmp nmi_stack_correct
+nmi_debug_stack_fixup:
+ FIX_STACK(24,nmi_stack_correct, 1)
+ jmp nmi_stack_correct
ENTRY(int3)
pushl $0
diff -Nru a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c
--- a/arch/i386/kernel/io_apic.c Sat Mar 8 14:50:47 2003
+++ b/arch/i386/kernel/io_apic.c Thu Mar 20 03:11:41 2003
@@ -116,40 +116,84 @@
}
}
-#define __DO_ACTION(R, ACTION, FINAL) \
- \
-{ \
- int pin; \
- struct irq_pin_list *entry = irq_2_pin + irq; \
- \
- for (;;) { \
- unsigned int reg; \
- pin = entry->pin; \
- if (pin == -1) \
- break; \
- reg = io_apic_read(entry->apic, 0x10 + R + pin*2); \
- reg ACTION; \
- io_apic_modify(entry->apic, 0x10 + R + pin*2, reg); \
- if (!entry->next) \
- break; \
- entry = irq_2_pin + entry->next; \
- } \
- FINAL; \
-}
-
-#define DO_ACTION(name,R,ACTION, FINAL) \
- \
- static void name##_IO_APIC_irq (unsigned int irq) \
- __DO_ACTION(R, ACTION, FINAL)
-
-DO_ACTION( __mask, 0, |= 0x00010000, io_apic_sync(entry->apic) )
- /* mask = 1 */
-DO_ACTION( __unmask, 0, &= 0xfffeffff, )
- /* mask = 0 */
-DO_ACTION( __mask_and_edge, 0, = (reg & 0xffff7fff) | 0x00010000, )
- /* mask = 1, trigger = 0 */
-DO_ACTION( __unmask_and_level, 0, = (reg & 0xfffeffff) | 0x00008000, )
- /* mask = 0, trigger = 1 */
+/* mask = 1 */
+static void __mask_IO_APIC_irq (unsigned int irq)
+{
+ int pin;
+ struct irq_pin_list *entry = irq_2_pin + irq;
+
+ for (;;) {
+ unsigned int reg;
+ pin = entry->pin;
+ if (pin == -1)
+ break;
+ reg = io_apic_read(entry->apic, 0x10 + pin*2);
+ io_apic_modify(entry->apic, 0x10 + pin*2, reg |= 0x00010000);
+ if (!entry->next)
+ break;
+ entry = irq_2_pin + entry->next;
+ }
+ io_apic_sync(entry->apic);
+}
+
+/* mask = 0 */
+static void __unmask_IO_APIC_irq (unsigned int irq)
+{
+ int pin;
+ struct irq_pin_list *entry = irq_2_pin + irq;
+
+ for (;;) {
+ unsigned int reg;
+ pin = entry->pin;
+ if (pin == -1)
+ break;
+ reg = io_apic_read(entry->apic, 0x10 + pin*2);
+ io_apic_modify(entry->apic, 0x10 + pin*2, reg &= 0xfffeffff);
+ if (!entry->next)
+ break;
+ entry = irq_2_pin + entry->next;
+ }
+}
+
+/* mask = 1, trigger = 0 */
+static void __mask_and_edge_IO_APIC_irq (unsigned int irq)
+{
+ int pin;
+ struct irq_pin_list *entry = irq_2_pin + irq;
+
+ for (;;) {
+ unsigned int reg;
+ pin = entry->pin;
+ if (pin == -1)
+ break;
+ reg = io_apic_read(entry->apic, 0x10 + pin*2);
+ reg = (reg & 0xffff7fff) | 0x00010000;
+ io_apic_modify(entry->apic, 0x10 + pin*2, reg);
+ if (!entry->next)
+ break;
+ entry = irq_2_pin + entry->next;
+ }
+}
+
+/* mask = 0, trigger = 1 */
+static void __unmask_and_level_IO_APIC_irq (unsigned int irq)
+{
+ int pin;
+ struct irq_pin_list *entry = irq_2_pin + irq;
+
+ for (;;) {
+ unsigned int reg;
+ pin = entry->pin;
+ if (pin == -1)
+ break;
+ reg = io_apic_read(entry->apic, 0x10 + pin*2);
+ reg = (reg & 0xfffeffff) | 0x00008000;
+ io_apic_modify(entry->apic, 0x10 + pin*2, reg);
+ if (!entry->next)
+ break;
+ entry = irq_2_pin + entry->next;
+ }
+}
static void mask_IO_APIC_irq (unsigned int irq)
{
@@ -197,13 +241,23 @@
static void set_ioapic_affinity (unsigned int irq, unsigned long mask)
{
unsigned long flags;
+ int pin;
+ struct irq_pin_list *entry = irq_2_pin + irq;
/*
* Only the first 8 bits are valid.
*/
mask = mask << 24;
spin_lock_irqsave(&ioapic_lock, flags);
- __DO_ACTION(1, = mask, )
+ for (;;) {
+ pin = entry->pin;
+ if (pin == -1)
+ break;
+ io_apic_write(entry->apic, 0x10 + 1 + pin*2, mask);
+ if (!entry->next)
+ break;
+ entry = irq_2_pin + entry->next;
+ }
spin_unlock_irqrestore(&ioapic_lock, flags);
}
@@ -743,6 +797,30 @@
}
/*
+ * This function currently is only a helper for the i386 smp boot process where
+ * we need to reprogram the ioredtbls to cater for the cpus which have come online
+ * so mask in all cases should simply be TARGET_CPUS
+ */
+void __init setup_ioapic_dest (unsigned long mask)
+{
+ int pin, ioapic, irq, irq_entry;
+
+ if (skip_ioapic_setup == 1)
+ return;
+
+ for (ioapic = 0; ioapic < nr_ioapics; ioapic++) {
+ for (pin = 0; pin < nr_ioapic_registers[ioapic]; pin++) {
+ irq_entry = find_irq_entry(ioapic, pin, mp_INT);
+ if (irq_entry == -1)
+ continue;
+ irq = pin_2_irq(irq_entry, ioapic, pin);
+ set_ioapic_affinity(irq, mask);
+ }
+
+ }
+}
+
+/*
* EISA Edge/Level control register, ELCR
*/
static int __init EISA_ELCR(unsigned int irq)
@@ -2003,7 +2081,7 @@
}
printk(" failed.\n");
- if (nmi_watchdog) {
+ if (nmi_watchdog == NMI_IO_APIC) {
printk(KERN_WARNING "timer doesn't work through the IO-APIC - disabling NMI Watchdog!\n");
nmi_watchdog = 0;
}
diff -Nru a/arch/i386/kernel/irq.c b/arch/i386/kernel/irq.c
--- a/arch/i386/kernel/irq.c Sat Mar 8 14:50:44 2003
+++ b/arch/i386/kernel/irq.c Thu Mar 20 03:11:45 2003
@@ -744,6 +744,8 @@
struct irqaction *old, **p;
irq_desc_t *desc = irq_desc + irq;
+ if (desc->handler == &no_irq_type)
+ return -ENOSYS;
/*
* Some drivers like serial.c use request_irq() heavily,
* so we have to be careful not to interfere with a
diff -Nru a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c
--- a/arch/i386/kernel/process.c Mon Mar 10 10:20:30 2003
+++ b/arch/i386/kernel/process.c Mon Mar 17 21:32:03 2003
@@ -290,6 +290,7 @@
{
struct pt_regs * childregs;
struct task_struct *tsk;
+ int err;
childregs = ((struct pt_regs *) (THREAD_SIZE + (unsigned long) p->thread_info)) - 1;
struct_cpy(childregs, regs);
@@ -322,20 +323,27 @@
struct user_desc info;
int idx;
+ err = -EFAULT;
if (copy_from_user(&info, (void *)childregs->esi, sizeof(info)))
- return -EFAULT;
+ goto out;
+ err = -EINVAL;
if (LDT_empty(&info))
- return -EINVAL;
+ goto out;
idx = info.entry_number;
if (idx < GDT_ENTRY_TLS_MIN || idx > GDT_ENTRY_TLS_MAX)
- return -EINVAL;
+ goto out;
desc = p->thread.tls_array + idx - GDT_ENTRY_TLS_MIN;
desc->a = LDT_entry_a(&info);
desc->b = LDT_entry_b(&info);
}
- return 0;
+
+ err = 0;
+ out:
+ if (err && p->thread.ts_io_bitmap)
+ kfree(p->thread.ts_io_bitmap);
+ return err;
}
/*
diff -Nru a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c
--- a/arch/i386/kernel/smpboot.c Tue Mar 4 23:41:54 2003
+++ b/arch/i386/kernel/smpboot.c Mon Mar 17 21:31:45 2003
@@ -1155,6 +1155,7 @@
void __init smp_cpus_done(unsigned int max_cpus)
{
+ setup_ioapic_dest(TARGET_CPUS);
zap_low_mappings();
}
diff -Nru a/arch/i386/kernel/timers/timer_tsc.c b/arch/i386/kernel/timers/timer_tsc.c
--- a/arch/i386/kernel/timers/timer_tsc.c Sun Mar 2 18:14:23 2003
+++ b/arch/i386/kernel/timers/timer_tsc.c Thu Mar 20 03:11:42 2003
@@ -213,6 +213,7 @@
{
struct cpufreq_freqs *freq = data;
+ write_seqlock(&xtime_lock);
if (!ref_freq) {
ref_freq = freq->old;
loops_per_jiffy_ref = cpu_data[freq->cpu].loops_per_jiffy;
@@ -232,6 +233,7 @@
}
#endif
}
+ write_sequnlock(&xtime_lock);
return 0;
}
diff -Nru a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c
--- a/arch/i386/kernel/traps.c Mon Mar 10 10:20:30 2003
+++ b/arch/i386/kernel/traps.c Mon Mar 17 21:33:07 2003
@@ -247,11 +247,13 @@
void die(const char * str, struct pt_regs * regs, long err)
{
+ static int die_counter;
+
console_verbose();
spin_lock_irq(&die_lock);
bust_spinlocks(1);
handle_BUG(regs);
- printk("%s: %04lx\n", str, err & 0xffff);
+ printk("%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter);
show_registers(regs);
bust_spinlocks(0);
spin_unlock_irq(&die_lock);
diff -Nru a/arch/i386/lib/usercopy.c b/arch/i386/lib/usercopy.c
--- a/arch/i386/lib/usercopy.c Mon Jan 6 14:58:30 2003
+++ b/arch/i386/lib/usercopy.c Sat Mar 1 05:50:59 2003
@@ -50,6 +50,26 @@
: "memory"); \
} while (0)
+/**
+ * __strncpy_from_user: - Copy a NULL terminated string from userspace, with less checking.
+ * @dst: Destination address, in kernel space. This buffer must be at
+ * least @count bytes long.
+ * @src: Source address, in user space.
+ * @count: Maximum number of bytes to copy, including the trailing NULL.
+ *
+ * Copies a NULL-terminated string from userspace to kernel space.
+ * Caller must check the specified block with access_ok() before calling
+ * this function.
+ *
+ * On success, returns the length of the string (not including the trailing
+ * NULL).
+ *
+ * If access to userspace fails, returns -EFAULT (some data may have been
+ * copied).
+ *
+ * If @count is smaller than the length of the string, copies @count bytes
+ * and returns @count.
+ */
long
__strncpy_from_user(char *dst, const char *src, long count)
{
@@ -58,6 +78,24 @@
return res;
}
+/**
+ * strncpy_from_user: - Copy a NULL terminated string from userspace.
+ * @dst: Destination address, in kernel space. This buffer must be at
+ * least @count bytes long.
+ * @src: Source address, in user space.
+ * @count: Maximum number of bytes to copy, including the trailing NULL.
+ *
+ * Copies a NULL-terminated string from userspace to kernel space.
+ *
+ * On success, returns the length of the string (not including the trailing
+ * NULL).
+ *
+ * If access to userspace fails, returns -EFAULT (some data may have been
+ * copied).
+ *
+ * If @count is smaller than the length of the string, copies @count bytes
+ * and returns @count.
+ */
long
strncpy_from_user(char *dst, const char *src, long count)
{
@@ -93,6 +131,16 @@
: "r"(size & 3), "0"(size / 4), "1"(addr), "a"(0)); \
} while (0)
+/**
+ * clear_user: - Zero a block of memory in user space.
+ * @to: Destination address, in user space.
+ * @n: Number of bytes to zero.
+ *
+ * Zero a block of memory in user space.
+ *
+ * Returns number of bytes that could not be cleared.
+ * On success, this will be zero.
+ */
unsigned long
clear_user(void *to, unsigned long n)
{
@@ -101,6 +149,17 @@
return n;
}
+/**
+ * __clear_user: - Zero a block of memory in user space, with less checking.
+ * @to: Destination address, in user space.
+ * @n: Number of bytes to zero.
+ *
+ * Zero a block of memory in user space. Caller must check
+ * the specified block with access_ok() before calling this function.
+ *
+ * Returns number of bytes that could not be cleared.
+ * On success, this will be zero.
+ */
unsigned long
__clear_user(void *to, unsigned long n)
{
@@ -108,12 +167,17 @@
return n;
}
-/*
- * Return the size of a string (including the ending 0)
+/**
+ * strlen_user: - Get the size of a string in user space.
+ * @s: The string to measure.
+ * @n: The maximum valid length
*
- * Return 0 on exception, a value greater than N if too long
+ * Get the size of a NULL-terminated string in user space.
+ *
+ * Returns the size of the string INCLUDING the terminating NULL.
+ * On exception, returns 0.
+ * If the string is too long, returns a value greater than @n.
*/
-
long strnlen_user(const char *s, long n)
{
unsigned long mask = -__addr_ok(s);
diff -Nru a/arch/i386/mach-pc9800/Makefile b/arch/i386/mach-pc9800/Makefile
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/arch/i386/mach-pc9800/Makefile Thu Feb 20 08:28:14 2003
@@ -0,0 +1,7 @@
+#
+# Makefile for the linux kernel.
+#
+
+EXTRA_CFLAGS += -I../kernel
+
+obj-y := setup.o topology.o
diff -Nru a/arch/i386/mach-pc9800/setup.c b/arch/i386/mach-pc9800/setup.c
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/arch/i386/mach-pc9800/setup.c Thu Mar 20 10:43:51 2003
@@ -0,0 +1,117 @@
+/*
+ * Machine specific setup for pc9800
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+struct sys_desc_table_struct {
+ unsigned short length;
+ unsigned char table[0];
+};
+
+/**
+ * pre_intr_init_hook - initialisation prior to setting up interrupt vectors
+ *
+ * Description:
+ * Perform any necessary interrupt initialisation prior to setting up
+ * the "ordinary" interrupt call gates. For legacy reasons, the ISA
+ * interrupts should be initialised here if the machine emulates a PC
+ * in any way.
+ **/
+void __init pre_intr_init_hook(void)
+{
+ init_ISA_irqs();
+}
+
+/*
+ * IRQ7 is cascade interrupt to second interrupt controller
+ */
+static struct irqaction irq7 = { no_action, 0, 0, "cascade", NULL, NULL};
+
+/**
+ * intr_init_hook - post gate setup interrupt initialisation
+ *
+ * Description:
+ * Fill in any interrupts that may have been left out by the general
+ * init_IRQ() routine. interrupts having to do with the machine rather
+ * than the devices on the I/O bus (like APIC interrupts in intel MP
+ * systems) are started here.
+ **/
+void __init intr_init_hook(void)
+{
+#ifdef CONFIG_X86_LOCAL_APIC
+ apic_intr_init();
+#endif
+
+ setup_irq(7, &irq7);
+}
+
+/**
+ * pre_setup_arch_hook - hook called prior to any setup_arch() execution
+ *
+ * Description:
+ * generally used to activate any machine specific identification
+ * routines that may be needed before setup_arch() runs. On VISWS
+ * this is used to get the board revision and type.
+ **/
+void __init pre_setup_arch_hook(void)
+{
+ SYS_DESC_TABLE.length = 0;
+ MCA_bus = 0;
+ /* In PC-9800, APM BIOS version is written in BCD...?? */
+ APM_BIOS_INFO.version = (APM_BIOS_INFO.version & 0xff00)
+ | ((APM_BIOS_INFO.version & 0x00f0) >> 4);
+}
+
+/**
+ * trap_init_hook - initialise system specific traps
+ *
+ * Description:
+ * Called as the final act of trap_init(). Used in VISWS to initialise
+ * the various board specific APIC traps.
+ **/
+void __init trap_init_hook(void)
+{
+}
+
+static struct irqaction irq0 = { timer_interrupt, SA_INTERRUPT, 0, "timer", NULL, NULL};
+
+/**
+ * time_init_hook - do any specific initialisations for the system timer.
+ *
+ * Description:
+ * Must plug the system timer interrupt source at HZ into the IRQ listed
+ * in irq_vectors.h:TIMER_IRQ
+ **/
+void __init time_init_hook(void)
+{
+ setup_irq(0, &irq0);
+}
+
+#ifdef CONFIG_MCA
+/**
+ * mca_nmi_hook - hook into MCA specific NMI chain
+ *
+ * Description:
+ * The MCA (Microchannel Architecture) has an NMI chain for NMI sources
+ * along the MCA bus. Use this to hook into that chain if you will need
+ * it.
+ **/
+void __init mca_nmi_hook(void)
+{
+ /* If I recall correctly, there's a whole bunch of other things that
+ * we can do to check for NMI problems, but that's all I know about
+ * at the moment.
+ */
+
+ printk("NMI generated from unknown source!\n");
+}
+#endif
diff -Nru a/arch/i386/mach-pc9800/topology.c b/arch/i386/mach-pc9800/topology.c
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/arch/i386/mach-pc9800/topology.c Thu Mar 13 17:21:57 2003
@@ -0,0 +1,44 @@
+/*
+ * arch/i386/mach-pc9800/topology.c - Populate driverfs with topology information
+ *
+ * Written by: Matthew Dobson, IBM Corporation
+ * Original Code: Paul Dorwin, IBM Corporation, Patrick Mochel, OSDL
+ *
+ * Copyright (C) 2002, IBM Corp.
+ *
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
+ * NON INFRINGEMENT. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Modify for PC-9800 by Osamu Tomita
+ *
+ */
+#include
+#include
+#include
+
+struct i386_cpu cpu_devices[NR_CPUS];
+
+static int __init topology_init(void)
+{
+ int i;
+
+ for (i = 0; i < NR_CPUS; i++)
+ if (cpu_possible(i)) arch_register_cpu(i);
+ return 0;
+}
+
+subsys_initcall(topology_init);
diff -Nru a/arch/i386/pci/pcbios.c b/arch/i386/pci/pcbios.c
--- a/arch/i386/pci/pcbios.c Fri Aug 30 07:00:01 2002
+++ b/arch/i386/pci/pcbios.c Fri Feb 14 15:04:05 2003
@@ -5,21 +5,8 @@
#include
#include
#include "pci.h"
+#include "pci-functions.h"
-
-#define PCIBIOS_PCI_FUNCTION_ID 0xb1XX
-#define PCIBIOS_PCI_BIOS_PRESENT 0xb101
-#define PCIBIOS_FIND_PCI_DEVICE 0xb102
-#define PCIBIOS_FIND_PCI_CLASS_CODE 0xb103
-#define PCIBIOS_GENERATE_SPECIAL_CYCLE 0xb106
-#define PCIBIOS_READ_CONFIG_BYTE 0xb108
-#define PCIBIOS_READ_CONFIG_WORD 0xb109
-#define PCIBIOS_READ_CONFIG_DWORD 0xb10a
-#define PCIBIOS_WRITE_CONFIG_BYTE 0xb10b
-#define PCIBIOS_WRITE_CONFIG_WORD 0xb10c
-#define PCIBIOS_WRITE_CONFIG_DWORD 0xb10d
-#define PCIBIOS_GET_ROUTING_OPTIONS 0xb10e
-#define PCIBIOS_SET_PCI_HW_INT 0xb10f
/* BIOS32 signature: "_32_" */
#define BIOS32_SIGNATURE (('_' << 0) + ('3' << 8) + ('2' << 16) + ('_' << 24))
diff -Nru a/arch/ia64/kernel/traps.c b/arch/ia64/kernel/traps.c
--- a/arch/ia64/kernel/traps.c Thu Mar 6 13:42:08 2003
+++ b/arch/ia64/kernel/traps.c Mon Mar 17 21:32:24 2003
@@ -101,6 +101,7 @@
.lock_owner = -1,
.lock_owner_depth = 0
};
+ static int die_counter;
if (die.lock_owner != smp_processor_id()) {
console_verbose();
@@ -111,7 +112,8 @@
}
if (++die.lock_owner_depth < 3) {
- printk("%s[%d]: %s %ld\n", current->comm, current->pid, str, err);
+ printk("%s[%d]: %s %ld [%d]\n",
+ current->comm, current->pid, str, err, ++die_counter);
show_regs(regs);
} else
printk(KERN_ERR "Recursive die() failure, output suppressed\n");
diff -Nru a/arch/m68k/Kconfig b/arch/m68k/Kconfig
--- a/arch/m68k/Kconfig Sat Mar 8 14:50:37 2003
+++ b/arch/m68k/Kconfig Thu Feb 27 08:02:04 2003
@@ -499,8 +499,8 @@
uses.
config HEARTBEAT
- bool "Use power LED as a heartbeat" if AMIGA || ATARI || Q40
- default y if !AMIGA && !ATARI && !Q40 && HP300
+ bool "Use power LED as a heartbeat" if AMIGA || APOLLO || ATARI || MAC ||Q40
+ default y if !AMIGA && !APOLLO && !ATARI && !MAC && !Q40 && HP300
help
Use the power-on LED on your machine as a load meter. The exact
behavior is platform-dependent, but normally the flash frequency is
diff -Nru a/arch/m68k/amiga/amisound.c b/arch/m68k/amiga/amisound.c
--- a/arch/m68k/amiga/amisound.c Tue Nov 5 06:25:32 2002
+++ b/arch/m68k/amiga/amisound.c Wed Feb 26 04:06:15 2003
@@ -12,6 +12,7 @@
#include
#include
#include
+#include
#include
#include
diff -Nru a/arch/m68k/amiga/chipram.c b/arch/m68k/amiga/chipram.c
--- a/arch/m68k/amiga/chipram.c Tue Jan 15 12:00:01 2002
+++ b/arch/m68k/amiga/chipram.c Wed Feb 26 04:05:56 2003
@@ -13,6 +13,7 @@
#include
#include
#include
+#include
#include
#include
diff -Nru a/arch/m68k/amiga/config.c b/arch/m68k/amiga/config.c
--- a/arch/m68k/amiga/config.c Mon Nov 18 07:03:02 2002
+++ b/arch/m68k/amiga/config.c Thu Mar 13 05:27:40 2003
@@ -21,6 +21,7 @@
#include
#include
#include
+#include
#include
#ifdef CONFIG_ZORRO
#include
@@ -89,6 +90,7 @@
static int a3000_hwclk (int, struct rtc_time *);
static int a2000_hwclk (int, struct rtc_time *);
static int amiga_set_clock_mmss (unsigned long);
+static unsigned int amiga_get_ss (void);
extern void amiga_mksound( unsigned int count, unsigned int ticks );
#ifdef CONFIG_AMIGA_FLOPPY
extern void amiga_floppy_setup(char *, int *);
@@ -403,6 +405,7 @@
*/
mach_set_clock_mmss = amiga_set_clock_mmss;
+ mach_get_ss = amiga_get_ss;
#ifdef CONFIG_AMIGA_FLOPPY
mach_floppy_setup = amiga_floppy_setup;
#endif
@@ -545,96 +548,101 @@
static int a3000_hwclk(int op, struct rtc_time *t)
{
- volatile struct tod3000 *tod = TOD_3000;
-
- tod->cntrl1 = TOD3000_CNTRL1_HOLD;
+ tod_3000.cntrl1 = TOD3000_CNTRL1_HOLD;
if (!op) { /* read */
- t->tm_sec = tod->second1 * 10 + tod->second2;
- t->tm_min = tod->minute1 * 10 + tod->minute2;
- t->tm_hour = tod->hour1 * 10 + tod->hour2;
- t->tm_mday = tod->day1 * 10 + tod->day2;
- t->tm_wday = tod->weekday;
- t->tm_mon = tod->month1 * 10 + tod->month2 - 1;
- t->tm_year = tod->year1 * 10 + tod->year2;
+ t->tm_sec = tod_3000.second1 * 10 + tod_3000.second2;
+ t->tm_min = tod_3000.minute1 * 10 + tod_3000.minute2;
+ t->tm_hour = tod_3000.hour1 * 10 + tod_3000.hour2;
+ t->tm_mday = tod_3000.day1 * 10 + tod_3000.day2;
+ t->tm_wday = tod_3000.weekday;
+ t->tm_mon = tod_3000.month1 * 10 + tod_3000.month2 - 1;
+ t->tm_year = tod_3000.year1 * 10 + tod_3000.year2;
if (t->tm_year <= 69)
t->tm_year += 100;
} else {
- tod->second1 = t->tm_sec / 10;
- tod->second2 = t->tm_sec % 10;
- tod->minute1 = t->tm_min / 10;
- tod->minute2 = t->tm_min % 10;
- tod->hour1 = t->tm_hour / 10;
- tod->hour2 = t->tm_hour % 10;
- tod->day1 = t->tm_mday / 10;
- tod->day2 = t->tm_mday % 10;
+ tod_3000.second1 = t->tm_sec / 10;
+ tod_3000.second2 = t->tm_sec % 10;
+ tod_3000.minute1 = t->tm_min / 10;
+ tod_3000.minute2 = t->tm_min % 10;
+ tod_3000.hour1 = t->tm_hour / 10;
+ tod_3000.hour2 = t->tm_hour % 10;
+ tod_3000.day1 = t->tm_mday / 10;
+ tod_3000.day2 = t->tm_mday % 10;
if (t->tm_wday != -1)
- tod->weekday = t->tm_wday;
- tod->month1 = (t->tm_mon + 1) / 10;
- tod->month2 = (t->tm_mon + 1) % 10;
+ tod_3000.weekday = t->tm_wday;
+ tod_3000.month1 = (t->tm_mon + 1) / 10;
+ tod_3000.month2 = (t->tm_mon + 1) % 10;
if (t->tm_year >= 100)
t->tm_year -= 100;
- tod->year1 = t->tm_year / 10;
- tod->year2 = t->tm_year % 10;
+ tod_3000.year1 = t->tm_year / 10;
+ tod_3000.year2 = t->tm_year % 10;
}
- tod->cntrl1 = TOD3000_CNTRL1_FREE;
+ tod_3000.cntrl1 = TOD3000_CNTRL1_FREE;
return 0;
}
static int a2000_hwclk(int op, struct rtc_time *t)
{
- volatile struct tod2000 *tod = TOD_2000;
+ int cnt = 5;
+
+ tod_2000.cntrl1 = TOD2000_CNTRL1_HOLD;
- tod->cntrl1 = TOD2000_CNTRL1_HOLD;
+ while ((tod_2000.cntrl1 & TOD2000_CNTRL1_BUSY) && cnt--)
+ {
+ tod_2000.cntrl1 &= ~TOD2000_CNTRL1_HOLD;
+ udelay(70);
+ tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD;
+ }
- while (tod->cntrl1 & TOD2000_CNTRL1_BUSY)
- ;
+ if (!cnt)
+ printk(KERN_INFO "hwclk: timed out waiting for RTC (0x%x)\n", tod_2000.cntrl1);
if (!op) { /* read */
- t->tm_sec = tod->second1 * 10 + tod->second2;
- t->tm_min = tod->minute1 * 10 + tod->minute2;
- t->tm_hour = (tod->hour1 & 3) * 10 + tod->hour2;
- t->tm_mday = tod->day1 * 10 + tod->day2;
- t->tm_wday = tod->weekday;
- t->tm_mon = tod->month1 * 10 + tod->month2 - 1;
- t->tm_year = tod->year1 * 10 + tod->year2;
+ t->tm_sec = tod_2000.second1 * 10 + tod_2000.second2;
+ t->tm_min = tod_2000.minute1 * 10 + tod_2000.minute2;
+ t->tm_hour = (tod_2000.hour1 & 3) * 10 + tod_2000.hour2;
+ t->tm_mday = tod_2000.day1 * 10 + tod_2000.day2;
+ t->tm_wday = tod_2000.weekday;
+ t->tm_mon = tod_2000.month1 * 10 + tod_2000.month2 - 1;
+ t->tm_year = tod_2000.year1 * 10 + tod_2000.year2;
if (t->tm_year <= 69)
t->tm_year += 100;
- if (!(tod->cntrl3 & TOD2000_CNTRL3_24HMODE)){
- if (!(tod->hour1 & TOD2000_HOUR1_PM) && t->tm_hour == 12)
+ if (!(tod_2000.cntrl3 & TOD2000_CNTRL3_24HMODE)){
+ if (!(tod_2000.hour1 & TOD2000_HOUR1_PM) && t->tm_hour == 12)
t->tm_hour = 0;
- else if ((tod->hour1 & TOD2000_HOUR1_PM) && t->tm_hour != 12)
+ else if ((tod_2000.hour1 & TOD2000_HOUR1_PM) && t->tm_hour != 12)
t->tm_hour += 12;
}
} else {
- tod->second1 = t->tm_sec / 10;
- tod->second2 = t->tm_sec % 10;
- tod->minute1 = t->tm_min / 10;
- tod->minute2 = t->tm_min % 10;
- if (tod->cntrl3 & TOD2000_CNTRL3_24HMODE)
- tod->hour1 = t->tm_hour / 10;
+ tod_2000.second1 = t->tm_sec / 10;
+ tod_2000.second2 = t->tm_sec % 10;
+ tod_2000.minute1 = t->tm_min / 10;
+ tod_2000.minute2 = t->tm_min % 10;
+ if (tod_2000.cntrl3 & TOD2000_CNTRL3_24HMODE)
+ tod_2000.hour1 = t->tm_hour / 10;
else if (t->tm_hour >= 12)
- tod->hour1 = TOD2000_HOUR1_PM +
+ tod_2000.hour1 = TOD2000_HOUR1_PM +
(t->tm_hour - 12) / 10;
else
- tod->hour1 = t->tm_hour / 10;
- tod->hour2 = t->tm_hour % 10;
- tod->day1 = t->tm_mday / 10;
- tod->day2 = t->tm_mday % 10;
+ tod_2000.hour1 = t->tm_hour / 10;
+ tod_2000.hour2 = t->tm_hour % 10;
+ tod_2000.day1 = t->tm_mday / 10;
+ tod_2000.day2 = t->tm_mday % 10;
if (t->tm_wday != -1)
- tod->weekday = t->tm_wday;
- tod->month1 = (t->tm_mon + 1) / 10;
- tod->month2 = (t->tm_mon + 1) % 10;
+ tod_2000.weekday = t->tm_wday;
+ tod_2000.month1 = (t->tm_mon + 1) / 10;
+ tod_2000.month2 = (t->tm_mon + 1) % 10;
if (t->tm_year >= 100)
t->tm_year -= 100;
- tod->year1 = t->tm_year / 10;
- tod->year2 = t->tm_year % 10;
+ tod_2000.year1 = t->tm_year / 10;
+ tod_2000.year2 = t->tm_year % 10;
}
- tod->cntrl1 &= ~TOD2000_CNTRL1_HOLD;
+ tod_2000.cntrl1 &= ~TOD2000_CNTRL1_HOLD;
return 0;
}
@@ -644,33 +652,52 @@
short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60;
if (AMIGAHW_PRESENT(A3000_CLK)) {
- volatile struct tod3000 *tod = TOD_3000;
-
- tod->cntrl1 = TOD3000_CNTRL1_HOLD;
+ tod_3000.cntrl1 = TOD3000_CNTRL1_HOLD;
- tod->second1 = real_seconds / 10;
- tod->second2 = real_seconds % 10;
- tod->minute1 = real_minutes / 10;
- tod->minute2 = real_minutes % 10;
+ tod_3000.second1 = real_seconds / 10;
+ tod_3000.second2 = real_seconds % 10;
+ tod_3000.minute1 = real_minutes / 10;
+ tod_3000.minute2 = real_minutes % 10;
- tod->cntrl1 = TOD3000_CNTRL1_FREE;
+ tod_3000.cntrl1 = TOD3000_CNTRL1_FREE;
} else /* if (AMIGAHW_PRESENT(A2000_CLK)) */ {
- volatile struct tod2000 *tod = TOD_2000;
+ int cnt = 5;
+
+ tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD;
+
+ while ((tod_2000.cntrl1 & TOD2000_CNTRL1_BUSY) && cnt--)
+ {
+ tod_2000.cntrl1 &= ~TOD2000_CNTRL1_HOLD;
+ udelay(70);
+ tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD;
+ }
- tod->cntrl1 = TOD2000_CNTRL1_HOLD;
-
- while (tod->cntrl1 & TOD2000_CNTRL1_BUSY)
- ;
-
- tod->second1 = real_seconds / 10;
- tod->second2 = real_seconds % 10;
- tod->minute1 = real_minutes / 10;
- tod->minute2 = real_minutes % 10;
+ if (!cnt)
+ printk(KERN_INFO "set_clock_mmss: timed out waiting for RTC (0x%x)\n", tod_2000.cntrl1);
- tod->cntrl1 &= ~TOD2000_CNTRL1_HOLD;
+ tod_2000.second1 = real_seconds / 10;
+ tod_2000.second2 = real_seconds % 10;
+ tod_2000.minute1 = real_minutes / 10;
+ tod_2000.minute2 = real_minutes % 10;
+
+ tod_2000.cntrl1 &= ~TOD2000_CNTRL1_HOLD;
}
return 0;
+}
+
+static unsigned int amiga_get_ss( void )
+{
+ unsigned int s;
+
+ if (AMIGAHW_PRESENT(A3000_CLK)) {
+ tod_3000.cntrl1 = TOD3000_CNTRL1_HOLD;
+ s = tod_3000.second1 * 10 + tod_3000.second2;
+ tod_3000.cntrl1 = TOD3000_CNTRL1_FREE;
+ } else /* if (AMIGAHW_PRESENT(A2000_CLK)) */ {
+ s = tod_2000.second1 * 10 + tod_2000.second2;
+ }
+ return s;
}
static NORET_TYPE void amiga_reset( void )
diff -Nru a/arch/m68k/apollo/config.c b/arch/m68k/apollo/config.c
--- a/arch/m68k/apollo/config.c Mon Nov 18 09:37:20 2002
+++ b/arch/m68k/apollo/config.c Thu Feb 27 07:56:03 2003
@@ -48,7 +48,6 @@
static void dn_timer_int(int irq,void *, struct pt_regs *);
static void (*sched_timer_handler)(int, void *, struct pt_regs *)=NULL;
static void dn_get_model(char *model);
-static int dn_cpuctrl=0xff00;
static const char *apollo_models[] = {
"DN3000 (Otter)",
"DN3010 (Otter)",
@@ -290,6 +289,8 @@
}
#ifdef CONFIG_HEARTBEAT
+static int dn_cpuctrl=0xff00;
+
static void dn_heartbeat(int on) {
if(on) {
diff -Nru a/arch/m68k/apollo/dma.c b/arch/m68k/apollo/dma.c
--- a/arch/m68k/apollo/dma.c Tue Feb 5 09:40:28 2002
+++ b/arch/m68k/apollo/dma.c Thu Feb 27 07:26:52 2003
@@ -10,6 +10,7 @@
#include
#include
#include
+#include
/* note only works for 16 Bit 1 page DMA's */
@@ -27,7 +28,7 @@
#if 0
printk("phys_addr: %x, page_aligned_addr: %x, start_map_addr: %x\n",phys_addr,page_aligned_addr,start_map_addr+i);
#endif
- outw(start_map_addr+i, xlat_map_entry);
+ out_be16(xlat_map_entry, start_map_addr+i);
}
next_free_xlat_entry+=2;
diff -Nru a/arch/m68k/atari/ataints.c b/arch/m68k/atari/ataints.c
--- a/arch/m68k/atari/ataints.c Thu Nov 7 14:02:56 2002
+++ b/arch/m68k/atari/ataints.c Wed Feb 26 06:10:15 2003
@@ -273,29 +273,29 @@
/* Dummy function to allow asm with operands. */
void atari_fast_prio_irq_dummy (void) {
__asm__ (__ALIGN_STR "\n"
-"atari_fast_irq_handler:
- orw #0x700,%%sr /* disable all interrupts */
-atari_prio_irq_handler:\t
- addl %3,%2\n" /* preempt_count() += HARDIRQ_OFFSET */
- SAVE_ALL_INT "\n"
- GET_CURRENT(%%d0) "
+"atari_fast_irq_handler:\n\t"
+ "orw #0x700,%%sr\n" /* disable all interrupts */
+"atari_prio_irq_handler:\n\t"
+ "addl %3,%2\n\t" /* preempt_count() += HARDIRQ_OFFSET */
+ SAVE_ALL_INT "\n\t"
+ GET_CURRENT(%%d0) "\n\t"
/* get vector number from stack frame and convert to source */
- bfextu %%sp@(%c1){#4,#10},%%d0
- subw #(0x40-8),%%d0
- jpl 1f
- addw #(0x40-8-0x18),%%d0
-1: lea %a0,%%a0
- addql #1,%%a0@(%%d0:l:4)
- lea irq_handler,%%a0
- lea %%a0@(%%d0:l:8),%%a0
- pea %%sp@ /* push frame address */
- movel %%a0@(4),%%sp@- /* push handler data */
- movel %%d0,%%sp@- /* push int number */
- movel %%a0@,%%a0
- jsr %%a0@ /* and call the handler */
- addql #8,%%sp
- addql #4,%%sp
- jbra ret_from_interrupt"
+ "bfextu %%sp@(%c1){#4,#10},%%d0\n\t"
+ "subw #(0x40-8),%%d0\n\t"
+ "jpl 1f\n\t"
+ "addw #(0x40-8-0x18),%%d0\n"
+ "1:\tlea %a0,%%a0\n\t"
+ "addql #1,%%a0@(%%d0:l:4)\n\t"
+ "lea irq_handler,%%a0\n\t"
+ "lea %%a0@(%%d0:l:8),%%a0\n\t"
+ "pea %%sp@\n\t" /* push frame address */
+ "movel %%a0@(4),%%sp@-\n\t" /* push handler data */
+ "movel %%d0,%%sp@-\n\t" /* push int number */
+ "movel %%a0@,%%a0\n\t"
+ "jsr %%a0@\n\t" /* and call the handler */
+ "addql #8,%%sp\n\t"
+ "addql #4,%%sp\n\t"
+ "jbra ret_from_interrupt"
: : "i" (&kstat_cpu(0).irqs), "n" (PT_OFF_FORMATVEC),
"m" (preempt_count()), "di" (HARDIRQ_OFFSET)
);
@@ -308,10 +308,10 @@
*/
asmlinkage void falcon_hblhandler(void);
asm(".text\n"
-__ALIGN_STR "\n"
-"falcon_hblhandler:
- orw #0x200,%sp@ /* set saved ipl to 2 */
- rte");
+__ALIGN_STR "\n\t"
+"falcon_hblhandler:\n\t"
+ "orw #0x200,%sp@\n\t" /* set saved ipl to 2 */
+ "rte");
/* Defined in entry.S; only increments 'num_spurious' */
asmlinkage void bad_interrupt(void);
diff -Nru a/arch/m68k/atari/stram.c b/arch/m68k/atari/stram.c
--- a/arch/m68k/atari/stram.c Sat Mar 8 14:50:21 2003
+++ b/arch/m68k/atari/stram.c Wed Mar 12 07:16:13 2003
@@ -146,7 +146,7 @@
/* The following two numbers define the maximum fraction of ST-RAM in total
* memory, below that the kernel would automatically use ST-RAM as swap
- * space. This decision can be overriden with stram_swap= */
+ * space. This decision can be overridden with stram_swap= */
#define MAX_STRAM_FRACTION_NOM 1
#define MAX_STRAM_FRACTION_DENOM 3
@@ -347,7 +347,7 @@
/*
* If the whole ST-RAM is used for swapping, there are no allocatable
* dma pages left. But unfortunately, some shared parts of the kernel
- * (particularily the SCSI mid-level) call __get_dma_pages()
+ * (particularly the SCSI mid-level) call __get_dma_pages()
* unconditionally :-( These calls then fail, and scsi.c even doesn't
* check for NULL return values and just crashes. The quick fix for
* this (instead of doing much clean up work in the SCSI code) is to
diff -Nru a/arch/m68k/ifpsp060/fskeleton.S b/arch/m68k/ifpsp060/fskeleton.S
--- a/arch/m68k/ifpsp060/fskeleton.S Thu Oct 10 10:51:24 2002
+++ b/arch/m68k/ifpsp060/fskeleton.S Thu Feb 27 09:19:53 2003
@@ -302,7 +302,6 @@
| The size of this section MUST be 128 bytes!!!
- .global _FP_CALL_TOP
_FP_CALL_TOP:
.long _060_real_bsun - _FP_CALL_TOP
.long _060_real_snan - _FP_CALL_TOP
diff -Nru a/arch/m68k/ifpsp060/iskeleton.S b/arch/m68k/ifpsp060/iskeleton.S
--- a/arch/m68k/ifpsp060/iskeleton.S Thu Oct 10 10:51:24 2002
+++ b/arch/m68k/ifpsp060/iskeleton.S Thu Feb 27 09:20:37 2003
@@ -270,7 +270,6 @@
| The size of this section MUST be 128 bytes!!!
- .global _I_CALL_TOP
_I_CALL_TOP:
.long _060_real_chk - _I_CALL_TOP
.long _060_real_divbyzero - _I_CALL_TOP
diff -Nru a/arch/m68k/kernel/entry.S b/arch/m68k/kernel/entry.S
--- a/arch/m68k/kernel/entry.S Thu Dec 26 10:39:55 2002
+++ b/arch/m68k/kernel/entry.S Tue Feb 25 07:35:49 2003
@@ -33,7 +33,6 @@
* for 68040
*/
-#include
#include
#include
#include
@@ -41,6 +40,7 @@
#include
#include
#include
+#include
#include "m68k_defs.h"
@@ -661,7 +661,3 @@
.long sys_lremovexattr
.long sys_fremovexattr
.long sys_futex /* 235 */
-
- .rept NR_syscalls-(.-sys_call_table)/4
- .long sys_ni_syscall
- .endr
diff -Nru a/arch/m68k/kernel/head.S b/arch/m68k/kernel/head.S
--- a/arch/m68k/kernel/head.S Tue Feb 25 11:05:23 2003
+++ b/arch/m68k/kernel/head.S Wed Mar 12 07:16:16 2003
@@ -190,7 +190,7 @@
*
* options
* -------
- * There are many options availble in a build of this file. I've
+ * There are many options available in a build of this file. I've
* taken the time to describe them here to save you the time of searching
* for them and trying to understand what they mean.
*
diff -Nru a/arch/m68k/kernel/m68k_ksyms.c b/arch/m68k/kernel/m68k_ksyms.c
--- a/arch/m68k/kernel/m68k_ksyms.c Fri Jan 3 08:13:04 2003
+++ b/arch/m68k/kernel/m68k_ksyms.c Wed Mar 5 07:55:57 2003
@@ -53,11 +53,15 @@
EXPORT_SYMBOL(mach_get_ss);
EXPORT_SYMBOL(mach_get_rtc_pll);
EXPORT_SYMBOL(mach_set_rtc_pll);
+#ifdef CONFIG_INPUT_M68K_BEEP_MODULE
+EXPORT_SYMBOL(mach_beep);
+#endif
EXPORT_SYMBOL(dump_fpu);
EXPORT_SYMBOL(dump_thread);
EXPORT_SYMBOL(strnlen);
EXPORT_SYMBOL(strrchr);
EXPORT_SYMBOL(strstr);
+EXPORT_SYMBOL(strpbrk);
EXPORT_SYMBOL(enable_irq);
EXPORT_SYMBOL(disable_irq);
EXPORT_SYMBOL(kernel_thread);
diff -Nru a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c
--- a/arch/m68k/kernel/process.c Tue Nov 26 06:45:59 2002
+++ b/arch/m68k/kernel/process.c Tue Feb 11 05:08:30 2003
@@ -42,6 +42,7 @@
static struct fs_struct init_fs = INIT_FS;
static struct files_struct init_files = INIT_FILES;
static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
+static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
struct mm_struct init_mm = INIT_MM(init_mm);
union thread_union init_thread_union
diff -Nru a/arch/m68k/kernel/signal.c b/arch/m68k/kernel/signal.c
--- a/arch/m68k/kernel/signal.c Thu Feb 13 09:34:46 2003
+++ b/arch/m68k/kernel/signal.c Wed Mar 12 07:16:15 2003
@@ -16,7 +16,7 @@
* 1997-12-01 Modified for POSIX.1b signals by Andreas Schwab
*
* mathemu support by Roman Zippel
- * (Note: fpstate in the signal context is completly ignored for the emulator
+ * (Note: fpstate in the signal context is completely ignored for the emulator
* and the internal floating point format is put on stack)
*/
@@ -1019,7 +1019,7 @@
/* Restart the system call the same way as
if the process were not traced. */
struct k_sigaction *ka =
- ¤t->sig->action[signr-1];
+ ¤t->sighand->action[signr-1];
int has_handler =
(ka->sa.sa_handler != SIG_IGN &&
ka->sa.sa_handler != SIG_DFL);
@@ -1060,7 +1060,7 @@
}
}
- ka = ¤t->sig->action[signr-1];
+ ka = ¤t->sighand->action[signr-1];
if (ka->sa.sa_handler == SIG_IGN) {
if (signr != SIGCHLD)
continue;
@@ -1087,11 +1087,11 @@
/* FALLTHRU */
case SIGSTOP: {
- struct signal_struct *sig;
+ struct sighand_struct *sighand;
current->state = TASK_STOPPED;
current->exit_code = signr;
- sig = current->parent->sig;
- if (sig && !(sig->action[SIGCHLD-1].sa.sa_flags
+ sighand = current->parent->sighand;
+ if (sighand && !(sighand->action[SIGCHLD-1].sa.sa_flags
& SA_NOCLDSTOP))
notify_parent(current, SIGCHLD);
schedule();
@@ -1106,7 +1106,7 @@
/* FALLTHRU */
default:
- sig_exit(signr, exit_code, &info);
+ do_group_exit(signr);
/* NOTREACHED */
}
}
diff -Nru a/arch/m68k/kernel/time.c b/arch/m68k/kernel/time.c
--- a/arch/m68k/kernel/time.c Mon Feb 24 23:13:09 2003
+++ b/arch/m68k/kernel/time.c Wed Mar 5 02:26:04 2003
@@ -59,35 +59,11 @@
*/
static void timer_interrupt(int irq, void *dummy, struct pt_regs * regs)
{
- /* last time the cmos clock got updated */
- static long last_rtc_update=0;
-
do_timer(regs);
if (!user_mode(regs))
do_profile(regs->pc);
- /*
- * If we have an externally synchronized Linux clock, then update
- * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be
- * called as close as possible to 500 ms before the new second starts.
- */
- /*
- * This code hopefully becomes obsolete in 2.5 or earlier
- * Should it ever be reenabled it must be serialized with
- * genrtc.c operation
- */
-#if 0
- if ((time_status & STA_UNSYNC) == 0 &&
- xtime.tv_sec > last_rtc_update + 660 &&
- (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) tick) / 2 &&
- (xtime.tv_nsec / 1000) <= 500000 + ((unsigned) tick) / 2) {
- if (set_rtc_mmss(xtime.tv_sec) == 0)
- last_rtc_update = xtime.tv_sec;
- else
- last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */
- }
-#endif
#ifdef CONFIG_HEARTBEAT
/* use power LED as a heartbeat instead -- much more useful
for debugging -- based on the version for PReP by Cort */
diff -Nru a/arch/m68k/kernel/traps.c b/arch/m68k/kernel/traps.c
--- a/arch/m68k/kernel/traps.c Sat Feb 15 19:30:17 2003
+++ b/arch/m68k/kernel/traps.c Wed Mar 12 07:16:16 2003
@@ -303,7 +303,7 @@
return res;
}
-/* after an exception in a writeback the stack frame coresponding
+/* after an exception in a writeback the stack frame corresponding
* to that exception is discarded, set a few bits in the old frame
* to simulate what it should look like
*/
@@ -333,7 +333,7 @@
fp->un.fmt7.wb2s = 0;
}
- /* do the 2nd wb only if the first one was succesful (except for a kernel wb) */
+ /* do the 2nd wb only if the first one was successful (except for a kernel wb) */
if (fp->un.fmt7.wb3s & WBV_040 && (!res || fp->un.fmt7.wb3s & 4)) {
res = do_040writeback1(fp->un.fmt7.wb3s, fp->un.fmt7.wb3a,
fp->un.fmt7.wb3d);
diff -Nru a/arch/m68k/mac/baboon.c b/arch/m68k/mac/baboon.c
--- a/arch/m68k/mac/baboon.c Fri Jun 7 04:06:40 2002
+++ b/arch/m68k/mac/baboon.c Wed Mar 12 07:16:11 2003
@@ -1,5 +1,5 @@
/*
- * Baboon Custom IC Managment
+ * Baboon Custom IC Management
*
* The Baboon custom IC controls the IDE, PCMCIA and media bay on the
* PowerBook 190. It multiplexes multiple interrupt sources onto the
diff -Nru a/arch/m68k/mac/iop.c b/arch/m68k/mac/iop.c
--- a/arch/m68k/mac/iop.c Tue Dec 3 13:17:27 2002
+++ b/arch/m68k/mac/iop.c Wed Mar 12 07:16:11 2003
@@ -236,7 +236,7 @@
/*
* This is called by the startup code before anything else. Its purpose
- * is to find and initalize the IOPs early in the boot sequence, so that
+ * is to find and initialize the IOPs early in the boot sequence, so that
* the serial IOP can be placed into bypass mode _before_ we try to
* initialize the serial console.
*/
diff -Nru a/arch/m68k/mac/macints.c b/arch/m68k/mac/macints.c
--- a/arch/m68k/mac/macints.c Fri Feb 7 00:20:36 2003
+++ b/arch/m68k/mac/macints.c Wed Mar 12 07:16:11 2003
@@ -30,7 +30,7 @@
* - slot 0: SCSI interrupt
* - slot 1: Sound interrupt
*
- * Levels 3-6 vary by machine type. For VIA or RBV Macintohes:
+ * Levels 3-6 vary by machine type. For VIA or RBV Macintoshes:
*
* 3 - unused (?)
*
@@ -494,7 +494,7 @@
* Add an interrupt service routine to an interrupt source.
* Returns 0 on success.
*
- * FIXME: You can register interrupts on nonexistant source (ie PSC4 on a
+ * FIXME: You can register interrupts on nonexistent source (ie PSC4 on a
* non-PSC machine). We should return -EINVAL in those cases.
*/
diff -Nru a/arch/m68k/math-emu/fp_arith.c b/arch/m68k/math-emu/fp_arith.c
--- a/arch/m68k/math-emu/fp_arith.c Tue Feb 5 09:40:28 2002
+++ b/arch/m68k/math-emu/fp_arith.c Wed Mar 12 07:16:13 2003
@@ -113,7 +113,7 @@
return dest;
}
-/* fp_fsub: Implementes the kernel of the FSUB, FSSUB, and FDSUB
+/* fp_fsub: Implements the kernel of the FSUB, FSSUB, and FDSUB
instructions.
Remember that the arguments are in assembler-syntax order! */
diff -Nru a/arch/m68k/mm/memory.c b/arch/m68k/mm/memory.c
--- a/arch/m68k/mm/memory.c Sat Oct 12 12:29:15 2002
+++ b/arch/m68k/mm/memory.c Fri Feb 7 14:01:38 2003
@@ -33,7 +33,7 @@
typedef struct list_head ptable_desc;
static LIST_HEAD(ptable_list);
-#define PD_PTABLE(page) ((ptable_desc *)virt_to_page(page))
+#define PD_PTABLE(page) ((ptable_desc *)&(virt_to_page(page)->list))
#define PD_PAGE(ptable) (list_entry(ptable, struct page, list))
#define PD_MARKBITS(dp) (*(unsigned char *)&PD_PAGE(dp)->index)
diff -Nru a/arch/m68k/mm/sun3mmu.c b/arch/m68k/mm/sun3mmu.c
--- a/arch/m68k/mm/sun3mmu.c Sun May 26 04:25:49 2002
+++ b/arch/m68k/mm/sun3mmu.c Fri Feb 7 14:01:38 2003
@@ -92,13 +92,12 @@
}
mmu_emu_init(bootmem_end);
-
+
current->mm = NULL;
/* memory sizing is a hack stolen from motorola.c.. hope it works for us */
- zones_size[1] = ((unsigned long)high_memory - PAGE_OFFSET) >> PAGE_SHIFT;
- zones_size[0] = zones_size[1]/2;
- zones_size[1] -= zones_size[0];
+ zones_size[0] = ((unsigned long)high_memory - PAGE_OFFSET) >> PAGE_SHIFT;
+ zones_size[1] = 0;
free_area_init(zones_size);
diff -Nru a/arch/m68k/q40/q40ints.c b/arch/m68k/q40/q40ints.c
--- a/arch/m68k/q40/q40ints.c Sun Jan 5 04:44:44 2003
+++ b/arch/m68k/q40/q40ints.c Wed Mar 12 07:16:10 2003
@@ -7,7 +7,7 @@
* License. See the file COPYING in the main directory of this archive
* for more details.
*
- * .. used to be losely based on bvme6000ints.c
+ * .. used to be loosely based on bvme6000ints.c
*
*/
@@ -127,6 +127,7 @@
printk("warning IRQ 10 and 11 not distinguishable\n");
irq=10;
default:
+ ;
}
if (irq=5 && irq<=15 ) {
diff -Nru a/arch/m68k/sun3/sun3dvma.c b/arch/m68k/sun3/sun3dvma.c
--- a/arch/m68k/sun3/sun3dvma.c Sun Apr 7 03:56:14 2002
+++ b/arch/m68k/sun3/sun3dvma.c Wed Feb 26 06:04:37 2003
@@ -97,7 +97,7 @@
printk("end of hole listing...\n");
}
-#endif DVMA_DEBUG
+#endif /* DVMA_DEBUG */
static inline int refill(void)
{
diff -Nru a/arch/m68k/vmlinux-sun3.lds b/arch/m68k/vmlinux-sun3.lds
--- a/arch/m68k/vmlinux-sun3.lds Fri Feb 14 15:09:22 2003
+++ b/arch/m68k/vmlinux-sun3.lds Fri Feb 7 14:01:36 2003
@@ -16,11 +16,12 @@
*(.fixup)
*(.gnu.warning)
} = 0x4e75
+ RODATA
_etext = .; /* End of text section */
.data : { /* Data */
- RODATA
+ *(.data)
CONSTRUCTORS
. = ALIGN(16); /* Exception table */
__start___ex_table = .;
diff -Nru a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
--- a/arch/mips/kernel/traps.c Tue Feb 25 10:47:06 2003
+++ b/arch/mips/kernel/traps.c Mon Mar 17 21:32:24 2003
@@ -191,12 +191,13 @@
extern void __die(const char * str, struct pt_regs * regs, const char *where,
unsigned long line)
{
+ static int die_counter;
console_verbose();
spin_lock_irq(&die_lock);
printk("%s", str);
if (where)
printk(" in %s, line %ld", where, line);
- printk(":\n");
+ printk("[#%d]:\n", ++die_counter);
show_regs(regs);
printk("Process %s (pid: %d, stackpage=%08lx)\n",
current->comm, current->pid, (unsigned long) current);
diff -Nru a/arch/mips64/kernel/traps.c b/arch/mips64/kernel/traps.c
--- a/arch/mips64/kernel/traps.c Tue Feb 25 10:47:06 2003
+++ b/arch/mips64/kernel/traps.c Mon Mar 17 21:32:24 2003
@@ -161,12 +161,13 @@
void die(const char * str, struct pt_regs * regs, unsigned long err)
{
+ static int die_counter;
if (user_mode(regs)) /* Just return if in user mode. */
return;
console_verbose();
spin_lock_irq(&die_lock);
- printk("%s: %04lx\n", str, err & 0xffff);
+ printk("%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter);
show_regs(regs);
printk("Process %s (pid: %d, stackpage=%08lx)\n",
current->comm, current->pid, (unsigned long) current);
diff -Nru a/arch/parisc/Makefile b/arch/parisc/Makefile
--- a/arch/parisc/Makefile Fri Mar 7 13:28:49 2003
+++ b/arch/parisc/Makefile Mon Mar 17 09:56:44 2003
@@ -93,7 +93,8 @@
include/asm-parisc/offsets.h: arch/parisc/kernel/asm-offsets.s
$(call filechk,gen-asm-offsets)
-CLEAN_FILES += palo.conf lifimage include/asm-parisc/offsets.h
+CLEAN_FILES += lifimage include/asm-parisc/offsets.h
+MRPROPER_FILES += palo.conf
define archhelp
@echo '* vmlinux - Uncompressed kernel image (./vmlinux)'
diff -Nru a/arch/parisc/kernel/Makefile b/arch/parisc/kernel/Makefile
--- a/arch/parisc/kernel/Makefile Sun Mar 9 14:15:54 2003
+++ b/arch/parisc/kernel/Makefile Mon Mar 17 10:33:22 2003
@@ -4,7 +4,7 @@
head-y := head.o
head-$(CONFIG_PARISC64) := head64.o
-extra-y := init_task.o pdc_cons.o process.o
+extra-y := init_task.o pdc_cons.o process.o \
unaligned.o $(head-y)
AFLAGS_entry.o := -traditional
diff -Nru a/arch/parisc/kernel/binfmt_elf32.c b/arch/parisc/kernel/binfmt_elf32.c
--- a/arch/parisc/kernel/binfmt_elf32.c Mon Feb 10 17:21:29 2003
+++ b/arch/parisc/kernel/binfmt_elf32.c Tue Mar 11 16:21:06 2003
@@ -12,6 +12,26 @@
#define ELF_CLASS ELFCLASS32
+#define ELF_CORE_COPY_REGS(dst, pt) \
+ memset(dst, 0, sizeof(dst)); /* don't leak any "random" bits */ \
+ { int i; \
+ for (i = 0; i < 32; i++) dst[i] = (elf_greg_t) pt->gr[i]; \
+ for (i = 0; i < 8; i++) dst[32 + i] = (elf_greg_t) pt->sr[i]; \
+ } \
+ dst[40] = (elf_greg_t) pt->iaoq[0]; dst[41] = (elf_greg_t) pt->iaoq[1]; \
+ dst[42] = (elf_greg_t) pt->iasq[0]; dst[43] = (elf_greg_t) pt->iasq[1]; \
+ dst[44] = (elf_greg_t) pt->sar; dst[45] = (elf_greg_t) pt->iir; \
+ dst[46] = (elf_greg_t) pt->isr; dst[47] = (elf_greg_t) pt->ior; \
+ dst[48] = (elf_greg_t) mfctl(22); dst[49] = (elf_greg_t) mfctl(0); \
+ dst[50] = (elf_greg_t) mfctl(24); dst[51] = (elf_greg_t) mfctl(25); \
+ dst[52] = (elf_greg_t) mfctl(26); dst[53] = (elf_greg_t) mfctl(27); \
+ dst[54] = (elf_greg_t) mfctl(28); dst[55] = (elf_greg_t) mfctl(29); \
+ dst[56] = (elf_greg_t) mfctl(30); dst[57] = (elf_greg_t) mfctl(31); \
+ dst[58] = (elf_greg_t) mfctl( 8); dst[59] = (elf_greg_t) mfctl( 9); \
+ dst[60] = (elf_greg_t) mfctl(12); dst[61] = (elf_greg_t) mfctl(13); \
+ dst[62] = (elf_greg_t) mfctl(10); dst[63] = (elf_greg_t) mfctl(15);
+
+
typedef unsigned int elf_greg_t;
#include
@@ -60,25 +80,6 @@
#define init_elf_binfmt init_elf32_binfmt
#define ELF_PLATFORM ("PARISC32\0")
-
-#define ELF_CORE_COPY_REGS(dst, pt) \
- memset(dst, 0, sizeof(dst)); /* don't leak any "random" bits */ \
- { int i; \
- for (i = 0; i < 32; i++) dst[i] = (elf_greg_t) pt->gr[i]; \
- for (i = 0; i < 8; i++) dst[32 + i] = (elf_greg_t) pt->sr[i]; \
- } \
- dst[40] = (elf_greg_t) pt->iaoq[0]; dst[41] = (elf_greg_t) pt->iaoq[1]; \
- dst[42] = (elf_greg_t) pt->iasq[0]; dst[43] = (elf_greg_t) pt->iasq[1]; \
- dst[44] = (elf_greg_t) pt->sar; dst[45] = (elf_greg_t) pt->iir; \
- dst[46] = (elf_greg_t) pt->isr; dst[47] = (elf_greg_t) pt->ior; \
- dst[48] = (elf_greg_t) mfctl(22); dst[49] = (elf_greg_t) mfctl(0); \
- dst[50] = (elf_greg_t) mfctl(24); dst[51] = (elf_greg_t) mfctl(25); \
- dst[52] = (elf_greg_t) mfctl(26); dst[53] = (elf_greg_t) mfctl(27); \
- dst[54] = (elf_greg_t) mfctl(28); dst[55] = (elf_greg_t) mfctl(29); \
- dst[56] = (elf_greg_t) mfctl(30); dst[57] = (elf_greg_t) mfctl(31); \
- dst[58] = (elf_greg_t) mfctl( 8); dst[59] = (elf_greg_t) mfctl( 9); \
- dst[60] = (elf_greg_t) mfctl(12); dst[61] = (elf_greg_t) mfctl(13); \
- dst[62] = (elf_greg_t) mfctl(10); dst[63] = (elf_greg_t) mfctl(15);
/*
* We should probably use this macro to set a flag somewhere to indicate
diff -Nru a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c
--- a/arch/parisc/kernel/cache.c Sun Mar 2 18:13:32 2003
+++ b/arch/parisc/kernel/cache.c Sat Mar 8 12:01:30 2003
@@ -114,7 +114,7 @@
void __init
parisc_cache_init(void)
{
- if(pdc_cache_info(&cache_info)<0)
+ if (pdc_cache_info(&cache_info) < 0)
panic("parisc_cache_init: pdc_cache_info failed");
#if 0
@@ -167,25 +167,25 @@
split_tlb = 0;
if (cache_info.dt_conf.tc_sh == 0 || cache_info.dt_conf.tc_sh == 2) {
-
- if (cache_info.dt_conf.tc_sh == 2)
- printk(KERN_WARNING "Unexpected TLB configuration. "
+ if (cache_info.dt_conf.tc_sh == 2)
+ printk(KERN_WARNING "Unexpected TLB configuration. "
"Will flush I/D separately (could be optimized).\n");
- split_tlb = 1;
+ split_tlb = 1;
}
- dcache_stride = ( (1<<(cache_info.dc_conf.cc_block+3)) *
- cache_info.dc_conf.cc_line );
- icache_stride = ( (1<<(cache_info.ic_conf.cc_block+3)) *
- cache_info.ic_conf.cc_line );
+ dcache_stride = (1 << (cache_info.dc_conf.cc_block + 3)) *
+ cache_info.dc_conf.cc_line;
+ icache_stride = (1 << (cache_info.ic_conf.cc_block + 3)) *
+ cache_info.ic_conf.cc_line;
#ifndef CONFIG_PA20
- if(pdc_btlb_info(&btlb_info)<0) {
+ if (pdc_btlb_info(&btlb_info) < 0) {
memset(&btlb_info, 0, sizeof btlb_info);
}
#endif
- if ((boot_cpu_data.pdc.capabilities & PDC_MODEL_NVA_MASK) == PDC_MODEL_NVA_UNSUPPORTED) {
+ if ((boot_cpu_data.pdc.capabilities & PDC_MODEL_NVA_MASK) ==
+ PDC_MODEL_NVA_UNSUPPORTED) {
printk(KERN_WARNING "Only equivalent aliasing supported\n");
#ifndef CONFIG_SMP
panic("SMP kernel required to avoid non-equivalent aliasing");
@@ -195,31 +195,69 @@
void disable_sr_hashing(void)
{
- int srhash_type;
+ int srhash_type;
+
+ switch (boot_cpu_data.cpu_type) {
+ case pcx: /* We shouldn't get this far. setup.c should prevent it. */
+ BUG();
+ return;
+
+ case pcxs:
+ case pcxt:
+ case pcxt_:
+ srhash_type = SRHASH_PCXST;
+ break;
+
+ case pcxl:
+ srhash_type = SRHASH_PCXL;
+ break;
+
+ case pcxl2: /* pcxl2 doesn't support space register hashing */
+ return;
+
+ default: /* Currently all PA2.0 machines use the same ins. sequence */
+ srhash_type = SRHASH_PA20;
+ break;
+ }
- if (boot_cpu_data.cpu_type == pcxl2)
- return; /* pcxl2 doesn't support space register hashing */
+ disable_sr_hashing_asm(srhash_type);
+}
+
+void __flush_dcache_page(struct page *page)
+{
+ struct mm_struct *mm = current->active_mm;
+ struct list_head *l;
- switch (boot_cpu_data.cpu_type) {
+ flush_kernel_dcache_page(page_address(page));
- case pcx:
- BUG(); /* We shouldn't get here. code in setup.c should prevent it */
- return;
+ if (!page->mapping)
+ return;
- case pcxs:
- case pcxt:
- case pcxt_:
- srhash_type = SRHASH_PCXST;
- break;
+ list_for_each(l, &page->mapping->i_mmap_shared) {
+ struct vm_area_struct *mpnt;
+ unsigned long off;
- case pcxl:
- srhash_type = SRHASH_PCXL;
- break;
+ mpnt = list_entry(l, struct vm_area_struct, shared);
- default: /* Currently all PA2.0 machines use the same ins. sequence */
- srhash_type = SRHASH_PA20;
- break;
- }
+ /*
+ * If this VMA is not in our MM, we can ignore it.
+ */
+ if (mpnt->vm_mm != mm)
+ continue;
- disable_sr_hashing_asm(srhash_type);
+ if (page->index < mpnt->vm_pgoff)
+ continue;
+
+ off = page->index - mpnt->vm_pgoff;
+ if (off >= (mpnt->vm_end - mpnt->vm_start) >> PAGE_SHIFT)
+ continue;
+
+ flush_cache_page(mpnt, mpnt->vm_start + (off << PAGE_SHIFT));
+
+ /* All user shared mappings should be equivalently mapped,
+ * so once we've flushed one we should be ok
+ */
+ break;
+ }
}
+
diff -Nru a/arch/parisc/kernel/entry.S b/arch/parisc/kernel/entry.S
--- a/arch/parisc/kernel/entry.S Fri Feb 7 00:20:33 2003
+++ b/arch/parisc/kernel/entry.S Wed Mar 5 13:21:51 2003
@@ -558,11 +558,9 @@
.export ret_from_kernel_thread
ret_from_kernel_thread:
-#if CONFIG_PREEMPT || CONFIG_SMP
/* Call schedule_tail first though */
bl schedule_tail, %r2
nop
-#endif
LDREG TI_TASK-THREAD_SZ_ALGN(%r30), %r1
LDREG TASK_PT_GR25(%r1), %r26
@@ -2014,10 +2012,8 @@
/* Set the return value for the child */
child_return:
-#if CONFIG_SMP || CONFIG_PREEMPT
bl schedule_tail, %r2
nop
-#endif
LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE-FRAME_SIZE(%r30), %r1
LDREG TASK_PT_GR19(%r1),%r2
diff -Nru a/arch/parisc/kernel/hardware.c b/arch/parisc/kernel/hardware.c
--- a/arch/parisc/kernel/hardware.c Sat Nov 2 12:27:46 2002
+++ b/arch/parisc/kernel/hardware.c Fri Feb 7 05:29:04 2003
@@ -99,8 +99,8 @@
{HPHW_NPROC,0x481,0x4,0x81,"Wilbur (E25)"},
{HPHW_NPROC,0x482,0x4,0x81,"WB-80 (E35)"},
{HPHW_NPROC,0x483,0x4,0x81,"WB-96 (E45)"},
- {HPHW_NPROC,0x48,0x4,0x81,"UL Proc L-100 (811/D210,D310)"},
- {HPHW_NPROC,0x48,0x4,0x81,"UL Proc L-75 (801/D200)"},
+ {HPHW_NPROC,0x484,0x4,0x81,"UL Proc L-100 (811/D210,D310)"},
+ {HPHW_NPROC,0x485,0x4,0x81,"UL Proc L-75 (801/D200)"},
{HPHW_NPROC,0x501,0x4,0x81,"Merlin L2 132 (9000/778/B132L)"},
{HPHW_NPROC,0x502,0x4,0x81,"Merlin L2 160 (9000/778/B160L)"},
{HPHW_NPROC,0x503,0x4,0x81,"Merlin L2+ 132 (9000/778/B132L)"},
diff -Nru a/arch/parisc/kernel/init_task.c b/arch/parisc/kernel/init_task.c
--- a/arch/parisc/kernel/init_task.c Tue Oct 8 17:14:52 2002
+++ b/arch/parisc/kernel/init_task.c Mon Feb 10 09:49:16 2003
@@ -10,6 +10,7 @@
static struct fs_struct init_fs = INIT_FS;
static struct files_struct init_files = INIT_FILES;
static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
+static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
struct mm_struct init_mm = INIT_MM(init_mm);
/*
diff -Nru a/arch/parisc/kernel/ioctl32.c b/arch/parisc/kernel/ioctl32.c
--- a/arch/parisc/kernel/ioctl32.c Tue Feb 18 10:25:13 2003
+++ b/arch/parisc/kernel/ioctl32.c Mon Mar 3 16:52:27 2003
@@ -1,4 +1,4 @@
-/* $Id: ioctl32.c,v 1.6 2002/10/21 16:13:22 varenet Exp $
+/* $Id: ioctl32.c,v 1.5 2002/10/18 00:21:43 varenet Exp $
* ioctl32.c: Conversion between 32bit and 64bit native ioctls.
*
* Copyright (C) 1997-2000 Jakub Jelinek (jakub@redhat.com)
@@ -66,6 +66,9 @@
#define __KERNEL__
#include
+#include
+#include
+
#include
#include
#include
@@ -2824,6 +2827,27 @@
return err;
}
+/* Fix sizeof(sizeof()) breakage */
+#define BLKBSZGET_32 _IOR(0x12,112,int)
+#define BLKBSZSET_32 _IOW(0x12,113,int)
+#define BLKGETSIZE64_32 _IOR(0x12,114,int)
+
+static int do_blkbszget(unsigned int fd, unsigned int cmd, unsigned long arg)
+{
+ return sys_ioctl(fd, BLKBSZGET, arg);
+}
+
+static int do_blkbszset(unsigned int fd, unsigned int cmd, unsigned long arg)
+{
+ return sys_ioctl(fd, BLKBSZSET, arg);
+}
+
+static int do_blkgetsize64(unsigned int fd, unsigned int cmd,
+ unsigned long arg)
+{
+ return sys_ioctl(fd, BLKGETSIZE64, arg);
+}
+
static int ioc_settimeout(unsigned int fd, unsigned int cmd, unsigned long arg)
{
return rw_long(fd, AUTOFS_IOC_SETTIMEOUT, arg);
@@ -2997,14 +3021,13 @@
COMPATIBLE_IOCTL(BLKRRPART)
COMPATIBLE_IOCTL(BLKFLSBUF)
COMPATIBLE_IOCTL(BLKSECTSET)
-COMPATIBLE_IOCTL(BLKSSZGET)
-COMPATIBLE_IOCTL(BLKBSZGET)
/* RAID */
COMPATIBLE_IOCTL(RAID_VERSION)
COMPATIBLE_IOCTL(GET_ARRAY_INFO)
COMPATIBLE_IOCTL(GET_DISK_INFO)
COMPATIBLE_IOCTL(PRINT_RAID_DEBUG)
+COMPATIBLE_IOCTL(RAID_AUTORUN)
COMPATIBLE_IOCTL(CLEAR_ARRAY)
COMPATIBLE_IOCTL(ADD_NEW_DISK)
COMPATIBLE_IOCTL(HOT_REMOVE_DISK)
@@ -3015,12 +3038,26 @@
COMPATIBLE_IOCTL(PROTECT_ARRAY)
COMPATIBLE_IOCTL(HOT_ADD_DISK)
COMPATIBLE_IOCTL(SET_DISK_FAULTY)
+COMPATIBLE_IOCTL(HOT_GENERATE_ERROR)
COMPATIBLE_IOCTL(RUN_ARRAY)
COMPATIBLE_IOCTL(START_ARRAY)
COMPATIBLE_IOCTL(STOP_ARRAY)
COMPATIBLE_IOCTL(STOP_ARRAY_RO)
COMPATIBLE_IOCTL(RESTART_ARRAY_RW)
+/* DM */
+COMPATIBLE_IOCTL(DM_VERSION)
+COMPATIBLE_IOCTL(DM_REMOVE_ALL)
+COMPATIBLE_IOCTL(DM_DEV_CREATE)
+COMPATIBLE_IOCTL(DM_DEV_REMOVE)
+COMPATIBLE_IOCTL(DM_DEV_RELOAD)
+COMPATIBLE_IOCTL(DM_DEV_SUSPEND)
+COMPATIBLE_IOCTL(DM_DEV_RENAME)
+COMPATIBLE_IOCTL(DM_DEV_DEPS)
+COMPATIBLE_IOCTL(DM_DEV_STATUS)
+COMPATIBLE_IOCTL(DM_TARGET_STATUS)
+COMPATIBLE_IOCTL(DM_TARGET_WAIT)
+
/* Big K */
COMPATIBLE_IOCTL(PIO_FONT)
COMPATIBLE_IOCTL(GIO_FONT)
@@ -3570,6 +3607,11 @@
HANDLE_IOCTL(0x1260, broken_blkgetsize)
HANDLE_IOCTL(BLKSECTGET, w_long)
HANDLE_IOCTL(BLKPG, blkpg_ioctl_trans)
+/* take care of sizeof(sizeof()) breakage */
+/* block stuff */
+HANDLE_IOCTL(BLKBSZGET_32, do_blkbszget)
+HANDLE_IOCTL(BLKBSZSET_32, do_blkbszset)
+HANDLE_IOCTL(BLKGETSIZE64_32, do_blkgetsize64)
HANDLE_IOCTL(FBIOGET_FSCREENINFO, fb_ioctl_trans)
HANDLE_IOCTL(FBIOGETCMAP, fb_ioctl_trans)
diff -Nru a/arch/parisc/kernel/module.c b/arch/parisc/kernel/module.c
--- a/arch/parisc/kernel/module.c Mon Feb 3 21:32:54 2003
+++ b/arch/parisc/kernel/module.c Sun Mar 2 15:58:28 2003
@@ -562,10 +562,8 @@
#ifdef __LP64__
me->init = (void *)get_fdesc(me, (Elf_Addr)me->init);
#ifdef CONFIG_MODULE_UNLOAD
- if (me->cleanup)
- me->cleanup = (void *)get_fdesc(me, (Elf_Addr)me->cleanup);
- if (me->destroy)
- me->destroy = (void *)get_fdesc(me, (Elf_Addr)me->destroy);
+ if (me->exit)
+ me->exit = (void *)get_fdesc(me, (Elf_Addr)me->exit);
#endif
#endif
return 0;
diff -Nru a/arch/parisc/kernel/pci.c b/arch/parisc/kernel/pci.c
--- a/arch/parisc/kernel/pci.c Sun Mar 16 14:16:32 2003
+++ b/arch/parisc/kernel/pci.c Mon Mar 17 09:56:45 2003
@@ -83,16 +83,9 @@
u##size in##type (int addr) \
{ \
int b = PCI_PORT_HBA(addr); \
- u##size d = (u##size) -1; \
EISA_IN(size); \
- ASSERT(pci_port); /* make sure services are defined */ \
- ASSERT(parisc_pci_hba[b]); /* make sure ioaddr are "fixed up" */ \
- if (parisc_pci_hba[b] == NULL) { \
- printk(KERN_WARNING "\nPCI or EISA Host Bus Adapter %d not registered. in" #size "(0x%x) returning -1\n", b, addr); \
- } else { \
- d = pci_port->in##type(parisc_pci_hba[b], PCI_PORT_ADDR(addr)); \
- } \
- return d; \
+ if (!parisc_pci_hba[b]) return (u##size) -1; \
+ return pci_port->in##type(parisc_pci_hba[b], PCI_PORT_ADDR(addr)); \
}
PCI_PORT_IN(b, 8)
@@ -105,7 +98,7 @@
{ \
int b = PCI_PORT_HBA(addr); \
EISA_OUT(size); \
- ASSERT(pci_port); \
+ if (!parisc_pci_hba[b]) return; \
pci_port->out##type(parisc_pci_hba[b], PCI_PORT_ADDR(addr), d); \
}
@@ -318,9 +311,6 @@
EXPORT_SYMBOL(pcibios_resource_to_bus);
#endif
-#define MAX(val1, val2) ((val1) > (val2) ? (val1) : (val2))
-
-
/*
** pcibios align resources() is called everytime generic PCI code
** wants to generate a new address. The process of looking for
@@ -349,7 +339,7 @@
align = (res->flags & IORESOURCE_IO) ? PCIBIOS_MIN_IO : PCIBIOS_MIN_MEM;
/* Align to largest of MIN or input size */
- mask = MAX(alignment, align) - 1;
+ mask = max(alignment, align) - 1;
res->start += mask;
res->start &= ~mask;
diff -Nru a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c
--- a/arch/parisc/kernel/process.c Fri Nov 29 02:53:55 2002
+++ b/arch/parisc/kernel/process.c Tue Mar 11 16:21:06 2003
@@ -205,7 +205,16 @@
int dump_fpu (struct pt_regs * regs, elf_fpregset_t *r)
{
+ if (regs == NULL)
+ return 0;
+
memcpy(r, regs->fr, sizeof *r);
+ return 1;
+}
+
+int dump_task_fpu (struct task_struct *tsk, elf_fpregset_t *r)
+{
+ memcpy(r, tsk->thread.regs.fr, sizeof(*r));
return 1;
}
diff -Nru a/arch/parisc/kernel/signal.c b/arch/parisc/kernel/signal.c
--- a/arch/parisc/kernel/signal.c Mon Feb 10 17:21:29 2003
+++ b/arch/parisc/kernel/signal.c Sun Feb 16 03:10:20 2003
@@ -310,7 +310,7 @@
#endif
#if CACHE_FLUSHING_IS_NOT_BROKEN
- flush_icache_range((unsigned long) &frame->tramp[0],
+ flush_user_icache_range((unsigned long) &frame->tramp[0],
(unsigned long) &frame->tramp[4]);
#else
/* It should *always* be cache line-aligned, but the compiler
@@ -395,7 +395,7 @@
handle_signal(unsigned long sig, siginfo_t *info, sigset_t *oldset,
struct pt_regs *regs, int in_syscall)
{
- struct k_sigaction *ka = ¤t->sig->action[sig-1];
+ struct k_sigaction *ka = ¤t->sighand->action[sig-1];
DBG(("handle_signal(sig=%ld, ka=%p, info=%p, oldset=%p, regs=%p)\n",
sig, ka, info, oldset, regs));
@@ -451,7 +451,7 @@
oldset->sig[0], oldset->sig[1]));
- signr = get_signal_to_deliver(&info, regs);
+ signr = get_signal_to_deliver(&info, regs, NULL);
if (signr > 0) {
/* Restart a system call if necessary. */
if (in_syscall) {
@@ -463,7 +463,7 @@
break;
case -ERESTARTSYS:
- ka = ¤t->sig->action[signr-1];
+ ka = ¤t->sighand->action[signr-1];
if (!(ka->sa.sa_flags & SA_RESTART)) {
DBG(("ERESTARTSYS: putting -EINTR\n"));
regs->gr[28] = -EINTR;
diff -Nru a/arch/parisc/kernel/sys32.h b/arch/parisc/kernel/sys32.h
--- a/arch/parisc/kernel/sys32.h Mon Feb 10 17:21:29 2003
+++ b/arch/parisc/kernel/sys32.h Sun Mar 2 15:58:28 2003
@@ -1,6 +1,8 @@
#ifndef _PARISC64_KERNEL_SYS32_H
#define _PARISC64_KERNEL_SYS32_H
+#include
+
/* Call a kernel syscall which will use kernel space instead of user
* space for its copy_to/from_user.
*/
@@ -12,6 +14,8 @@
set_fs (old_fs); \
}
+#ifdef CONFIG_COMPAT
+
typedef __u32 __sighandler_t32;
struct sigaction32 {
@@ -19,5 +23,7 @@
unsigned int sa_flags;
compat_sigset_t sa_mask; /* mask last for extensibility */
};
+
+#endif
#endif
diff -Nru a/arch/parisc/kernel/sys_parisc.c b/arch/parisc/kernel/sys_parisc.c
--- a/arch/parisc/kernel/sys_parisc.c Wed Nov 27 01:13:35 2002
+++ b/arch/parisc/kernel/sys_parisc.c Mon Mar 17 17:15:27 2003
@@ -309,25 +309,6 @@
return -ENOSYS;
}
-/*
- * Set a given TLS descriptor:
- */
-asmlinkage int sys_set_thread_area(struct user_desc *u_info)
-{
- return -ENOSYS;
-}
-
-
-/*
- * Get the current Thread-Local Storage area:
- */
-
-asmlinkage int sys_get_thread_area(struct user_desc *u_info)
-{
- return -ENOSYS;
-}
-
-
asmlinkage unsigned long sys_alloc_hugepages(int key, unsigned long addr, unsigned long len, int prot, int flag)
{
return -ENOMEM;
diff -Nru a/arch/parisc/kernel/syscall.S b/arch/parisc/kernel/syscall.S
--- a/arch/parisc/kernel/syscall.S Sun Mar 9 01:34:44 2003
+++ b/arch/parisc/kernel/syscall.S Mon Mar 17 17:15:27 2003
@@ -567,10 +567,10 @@
ENTRY_SAME(rt_sigsuspend_wrapper) /* not really SAME -- see the code */
ENTRY_SAME(chown) /* 180 */
/* setsockopt() used by iptables: SO_SET_REPLACE/SO_SET_ADD_COUNTERS */
- ENTRY_DIFF(setsockopt)
+ ENTRY_COMP(setsockopt)
ENTRY_SAME(getsockopt)
- ENTRY_DIFF(sendmsg)
- ENTRY_DIFF(recvmsg)
+ ENTRY_COMP(sendmsg)
+ ENTRY_COMP(recvmsg)
ENTRY_SAME(semop) /* 185 */
ENTRY_SAME(semget)
ENTRY_DIFF(semctl_broken)
@@ -600,8 +600,8 @@
ENTRY_COMP(futex) /* 210 */
ENTRY_SAME(sched_setaffinity)
ENTRY_SAME(sched_getaffinity)
- ENTRY_SAME(set_thread_area)
- ENTRY_SAME(get_thread_area)
+ ENTRY_SAME(ni_syscall)
+ ENTRY_SAME(ni_syscall)
ENTRY_SAME(io_setup) /* 215 */
ENTRY_SAME(io_destroy)
ENTRY_SAME(io_getevents)
diff -Nru a/arch/parisc/kernel/traps.c b/arch/parisc/kernel/traps.c
--- a/arch/parisc/kernel/traps.c Mon Jan 13 22:57:43 2003
+++ b/arch/parisc/kernel/traps.c Fri Feb 14 00:46:27 2003
@@ -27,6 +27,7 @@
#include
#include
+#include
#include
#include
#include
@@ -165,9 +166,11 @@
startstack = (unsigned long *)((unsigned long)stack & ~(THREAD_SIZE - 1));
i = 1;
+ stack = (long *)((long)(stack + 32) &~ (FRAME_SIZE-1)); /* Align */
printk("Kernel addresses on the stack:\n");
- while (stack >= startstack) {
- addr = *stack--;
+ while (stack > startstack) {
+ stack -= 16; /* Stack frames are a multiple of 16 words */
+ addr = stack[16 - RP_OFFSET / sizeof(long)];
/*
* If the address is either in the text segment of the
* kernel, or in the region which contains vmalloc'ed
diff -Nru a/arch/ppc/kernel/traps.c b/arch/ppc/kernel/traps.c
--- a/arch/ppc/kernel/traps.c Wed Jan 15 20:09:48 2003
+++ b/arch/ppc/kernel/traps.c Mon Mar 17 21:32:24 2003
@@ -86,13 +86,14 @@
void die(const char * str, struct pt_regs * fp, long err)
{
+ static int die_counter;
console_verbose();
spin_lock_irq(&die_lock);
#ifdef CONFIG_PMAC_BACKLIGHT
set_backlight_enable(1);
set_backlight_level(BACKLIGHT_MAX);
#endif
- printk("Oops: %s, sig: %ld\n", str, err);
+ printk("Oops: %s, sig: %ld [#%d]\n", str, err, ++die_counter);
show_regs(fp);
spin_unlock_irq(&die_lock);
/* do_exit() should take care of panic'ing from an interrupt
diff -Nru a/arch/ppc64/kernel/traps.c b/arch/ppc64/kernel/traps.c
--- a/arch/ppc64/kernel/traps.c Tue Feb 11 04:15:56 2003
+++ b/arch/ppc64/kernel/traps.c Mon Mar 17 21:32:24 2003
@@ -62,10 +62,11 @@
void die(const char *str, struct pt_regs *regs, long err)
{
+ static int die_counter;
console_verbose();
spin_lock_irq(&die_lock);
bust_spinlocks(1);
- printk("Oops: %s, sig: %ld\n", str, err);
+ printk("Oops: %s, sig: %ld [#%d]\n", str, err, ++die_counter);
show_regs(regs);
bust_spinlocks(0);
spin_unlock_irq(&die_lock);
diff -Nru a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c
--- a/arch/s390/kernel/traps.c Mon Feb 24 10:24:13 2003
+++ b/arch/s390/kernel/traps.c Mon Mar 17 21:32:24 2003
@@ -226,10 +226,11 @@
void die(const char * str, struct pt_regs * regs, long err)
{
+ static int die_counter;
console_verbose();
spin_lock_irq(&die_lock);
bust_spinlocks(1);
- printk("%s: %04lx\n", str, err & 0xffff);
+ printk("%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter);
show_regs(regs);
bust_spinlocks(0);
spin_unlock_irq(&die_lock);
diff -Nru a/arch/s390x/kernel/binfmt_elf32.c b/arch/s390x/kernel/binfmt_elf32.c
--- a/arch/s390x/kernel/binfmt_elf32.c Mon Feb 24 10:25:00 2003
+++ b/arch/s390x/kernel/binfmt_elf32.c Mon Mar 17 21:31:50 2003
@@ -36,7 +36,7 @@
/* For SVR4/S390 the function pointer to be registered with `atexit` is
passed in R14. */
-#define ELF_PLAT_INIT(_r) \
+#define ELF_PLAT_INIT(_r, load_addr) \
do { \
_r->gprs[14] = 0; \
set_thread_flag(TIF_31BIT); \
diff -Nru a/arch/s390x/kernel/exec32.c b/arch/s390x/kernel/exec32.c
--- a/arch/s390x/kernel/exec32.c Sun Mar 2 18:12:49 2003
+++ b/arch/s390x/kernel/exec32.c Thu Mar 13 16:52:15 2003
@@ -21,7 +21,6 @@
#include
#include
#include
-#define __NO_VERSION__
#include
#include
diff -Nru a/arch/s390x/kernel/traps.c b/arch/s390x/kernel/traps.c
--- a/arch/s390x/kernel/traps.c Mon Feb 24 10:24:13 2003
+++ b/arch/s390x/kernel/traps.c Mon Mar 17 21:32:24 2003
@@ -228,10 +228,11 @@
void die(const char * str, struct pt_regs * regs, long err)
{
+ static int die_counter;
console_verbose();
spin_lock_irq(&die_lock);
bust_spinlocks(1);
- printk("%s: %04lx\n", str, err & 0xffff);
+ printk("%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter);
show_regs(regs);
bust_spinlocks(0);
spin_unlock_irq(&die_lock);
diff -Nru a/arch/sh/kernel/traps.c b/arch/sh/kernel/traps.c
--- a/arch/sh/kernel/traps.c Tue Feb 5 07:24:41 2002
+++ b/arch/sh/kernel/traps.c Mon Mar 17 21:32:24 2003
@@ -58,9 +58,10 @@
void die(const char * str, struct pt_regs * regs, long err)
{
+ static int die_counter;
console_verbose();
spin_lock_irq(&die_lock);
- printk("%s: %04lx\n", str, err & 0xffff);
+ printk("%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter);
show_regs(regs);
spin_unlock_irq(&die_lock);
do_exit(SIGSEGV);
diff -Nru a/arch/sparc/kernel/traps.c b/arch/sparc/kernel/traps.c
--- a/arch/sparc/kernel/traps.c Tue Jul 16 17:12:13 2002
+++ b/arch/sparc/kernel/traps.c Wed Mar 19 22:55:52 2003
@@ -89,6 +89,7 @@
void die_if_kernel(char *str, struct pt_regs *regs)
{
+ static int die_counter;
int count = 0;
/* Amuse the user. */
@@ -98,7 +99,7 @@
" /_| \\__/ |_\\\n"
" \\__U_/\n");
- printk("%s(%d): %s\n", current->comm, current->pid, str);
+ printk("%s(%d): %s [#%d]\n", current->comm, current->pid, str, ++die_counter);
show_regs(regs);
__SAVE; __SAVE; __SAVE; __SAVE;
diff -Nru a/arch/sparc64/kernel/head.S b/arch/sparc64/kernel/head.S
--- a/arch/sparc64/kernel/head.S Mon Nov 11 03:57:03 2002
+++ b/arch/sparc64/kernel/head.S Tue Mar 18 18:26:20 2003
@@ -671,7 +671,9 @@
#endif
/* Kill PROM timer */
- wr %g0, 0, %tick_cmpr
+ sethi %hi(0x80000000), %g1
+ sllx %g1, 32, %g1
+ wr %g1, 0, %tick_cmpr
BRANCH_IF_ANY_CHEETAH(g1,g5,1f)
diff -Nru a/arch/sparc64/kernel/irq.c b/arch/sparc64/kernel/irq.c
--- a/arch/sparc64/kernel/irq.c Wed Feb 12 01:41:01 2003
+++ b/arch/sparc64/kernel/irq.c Wed Mar 12 12:47:00 2003
@@ -719,12 +719,8 @@
*/
{
unsigned long clr_mask = 1 << irq;
- unsigned long tick_mask;
+ unsigned long tick_mask = tick_ops->softint_mask;
- if (SPARC64_USE_STICK)
- tick_mask = (1UL << 16);
- else
- tick_mask = (1UL << 0);
if ((irq == 14) && (get_softint() & tick_mask)) {
irq = 0;
clr_mask = tick_mask;
@@ -944,113 +940,6 @@
int probe_irq_off(unsigned long mask)
{
return 0;
-}
-
-/* This is gets the master TICK_INT timer going. */
-void sparc64_init_timers(void (*cfunc)(int, void *, struct pt_regs *),
- unsigned long *clock)
-{
- unsigned long pstate;
- extern unsigned long timer_tick_offset;
- int node, err;
-#ifdef CONFIG_SMP
- extern void smp_tick_init(void);
-#endif
-
- if (!SPARC64_USE_STICK) {
- node = linux_cpus[0].prom_node;
- *clock = prom_getint(node, "clock-frequency");
- } else {
- node = prom_root_node;
- *clock = prom_getint(node, "stick-frequency");
- }
- timer_tick_offset = *clock / HZ;
-#ifdef CONFIG_SMP
- smp_tick_init();
-#endif
-
- /* Register IRQ handler. */
- err = request_irq(build_irq(0, 0, 0UL, 0UL), cfunc, SA_STATIC_ALLOC,
- "timer", NULL);
-
- if (err) {
- prom_printf("Serious problem, cannot register TICK_INT\n");
- prom_halt();
- }
-
- /* Guarentee that the following sequences execute
- * uninterrupted.
- */
- __asm__ __volatile__("rdpr %%pstate, %0\n\t"
- "wrpr %0, %1, %%pstate"
- : "=r" (pstate)
- : "i" (PSTATE_IE));
-
- /* Set things up so user can access tick register for profiling
- * purposes. Also workaround BB_ERRATA_1 by doing a dummy
- * read back of %tick after writing it.
- */
- __asm__ __volatile__(
- " sethi %%hi(0x80000000), %%g1\n"
- " ba,pt %%xcc, 1f\n"
- " sllx %%g1, 32, %%g1\n"
- " .align 64\n"
- "1: rd %%tick, %%g2\n"
- " add %%g2, 6, %%g2\n"
- " andn %%g2, %%g1, %%g2\n"
- " wrpr %%g2, 0, %%tick\n"
- " rdpr %%tick, %%g0"
- : /* no outputs */
- : /* no inputs */
- : "g1", "g2");
-
- /* Workaround for Spitfire Errata (#54 I think??), I discovered
- * this via Sun BugID 4008234, mentioned in Solaris-2.5.1 patch
- * number 103640.
- *
- * On Blackbird writes to %tick_cmpr can fail, the
- * workaround seems to be to execute the wr instruction
- * at the start of an I-cache line, and perform a dummy
- * read back from %tick_cmpr right after writing to it. -DaveM
- */
- if (!SPARC64_USE_STICK) {
- __asm__ __volatile__(
- " rd %%tick, %%g1\n"
- " ba,pt %%xcc, 1f\n"
- " add %%g1, %0, %%g1\n"
- " .align 64\n"
- "1: wr %%g1, 0x0, %%tick_cmpr\n"
- " rd %%tick_cmpr, %%g0"
- : /* no outputs */
- : "r" (timer_tick_offset)
- : "g1");
- } else {
- /* Let the user get at STICK too. */
- __asm__ __volatile__(
- " sethi %%hi(0x80000000), %%g1\n"
- " sllx %%g1, 32, %%g1\n"
- " rd %%asr24, %%g2\n"
- " andn %%g2, %%g1, %%g2\n"
- " wr %%g2, 0, %%asr24"
- : /* no outputs */
- : /* no inputs */
- : "g1", "g2");
-
- __asm__ __volatile__(
- " rd %%asr24, %%g1\n"
- " add %%g1, %0, %%g1\n"
- " wr %%g1, 0x0, %%asr25"
- : /* no outputs */
- : "r" (timer_tick_offset)
- : "g1");
- }
-
- /* Restore PSTATE_IE. */
- __asm__ __volatile__("wrpr %0, 0x0, %%pstate"
- : /* no outputs */
- : "r" (pstate));
-
- local_irq_enable();
}
#ifdef CONFIG_SMP
diff -Nru a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c
--- a/arch/sparc64/kernel/smp.c Sat Mar 8 07:52:56 2003
+++ b/arch/sparc64/kernel/smp.c Tue Mar 18 17:11:38 2003
@@ -18,6 +18,7 @@
#include
#include
#include
+#include
#include
#include
@@ -115,7 +116,6 @@
void __init smp_callin(void)
{
int cpuid = hard_smp_processor_id();
- unsigned long pstate;
extern int bigkernel;
extern unsigned long kern_locked_tte_data;
@@ -133,50 +133,6 @@
cpu_probe();
- /* Guarentee that the following sequences execute
- * uninterrupted.
- */
- __asm__ __volatile__("rdpr %%pstate, %0\n\t"
- "wrpr %0, %1, %%pstate"
- : "=r" (pstate)
- : "i" (PSTATE_IE));
-
- /* Set things up so user can access tick register for profiling
- * purposes. Also workaround BB_ERRATA_1 by doing a dummy
- * read back of %tick after writing it.
- */
- __asm__ __volatile__(
- "sethi %%hi(0x80000000), %%g1\n\t"
- "ba,pt %%xcc, 1f\n\t"
- " sllx %%g1, 32, %%g1\n\t"
- ".align 64\n"
-"1: rd %%tick, %%g2\n\t"
- "add %%g2, 6, %%g2\n\t"
- "andn %%g2, %%g1, %%g2\n\t"
- "wrpr %%g2, 0, %%tick\n\t"
- "rdpr %%tick, %%g0"
- : /* no outputs */
- : /* no inputs */
- : "g1", "g2");
-
- if (SPARC64_USE_STICK) {
- /* Let the user get at STICK too. */
- __asm__ __volatile__(
- "sethi %%hi(0x80000000), %%g1\n\t"
- "sllx %%g1, 32, %%g1\n\t"
- "rd %%asr24, %%g2\n\t"
- "andn %%g2, %%g1, %%g2\n\t"
- "wr %%g2, 0, %%asr24"
- : /* no outputs */
- : /* no inputs */
- : "g1", "g2");
- }
-
- /* Restore PSTATE_IE. */
- __asm__ __volatile__("wrpr %0, 0x0, %%pstate"
- : /* no outputs */
- : "r" (pstate));
-
smp_setup_percpu_timer();
local_irq_enable();
@@ -211,7 +167,7 @@
static unsigned long current_tick_offset;
-/* This stick register synchronization scheme is taken entirely from
+/* This tick register synchronization scheme is taken entirely from
* the ia64 port, see arch/ia64/kernel/smpboot.c for details and credit.
*
* The only change I've made is to rework it so that the master
@@ -227,16 +183,7 @@
static spinlock_t itc_sync_lock = SPIN_LOCK_UNLOCKED;
static unsigned long go[SLAVE + 1];
-#define DEBUG_STICK_SYNC 0
-
-static inline unsigned long get_stick(void)
-{
- unsigned long val;
-
- __asm__ __volatile__("rd %%asr24, %0"
- : "=r" (val));
- return val;
-}
+#define DEBUG_TICK_SYNC 0
static inline long get_delta (long *rt, long *master)
{
@@ -245,14 +192,14 @@
unsigned long i;
for (i = 0; i < NUM_ITERS; i++) {
- t0 = get_stick();
+ t0 = tick_ops->get_tick();
go[MASTER] = 1;
membar("#StoreLoad");
while (!(tm = go[SLAVE]))
membar("#LoadLoad");
go[SLAVE] = 0;
membar("#StoreStore");
- t1 = get_stick();
+ t1 = tick_ops->get_tick();
if (t1 - t0 < best_t1 - best_t0)
best_t0 = t0, best_t1 = t1, best_tm = tm;
@@ -268,32 +215,11 @@
return tcenter - best_tm;
}
-static void adjust_stick(long adj)
-{
- unsigned long tmp, pstate;
-
- __asm__ __volatile__(
- "rdpr %%pstate, %0\n\t"
- "ba,pt %%xcc, 1f\n\t"
- " wrpr %0, %4, %%pstate\n\t"
- ".align 16\n\t"
- "1:nop\n\t"
- "rd %%asr24, %1\n\t"
- "add %1, %2, %1\n\t"
- "wr %1, 0x0, %%asr24\n\t"
- "add %1, %3, %1\n\t"
- "wr %1, 0x0, %%asr25\n\t"
- "wrpr %0, 0x0, %%pstate"
- : "=&r" (pstate), "=&r" (tmp)
- : "r" (adj), "r" (current_tick_offset),
- "i" (PSTATE_IE));
-}
-
-void smp_synchronize_stick_client(void)
+void smp_synchronize_tick_client(void)
{
long i, delta, adj, adjust_latency = 0, done = 0;
unsigned long flags, rt, master_time_stamp, bound;
-#if DEBUG_STICK_SYNC
+#if DEBUG_TICK_SYNC
struct {
long rt; /* roundtrip time */
long master; /* master's timestamp */
@@ -323,9 +249,9 @@
} else
adj = -delta;
- adjust_stick(adj);
+ tick_ops->add_tick(adj, current_tick_offset);
}
-#if DEBUG_STICK_SYNC
+#if DEBUG_TICK_SYNC
t[i].rt = rt;
t[i].master = master_time_stamp;
t[i].diff = delta;
@@ -335,25 +261,25 @@
}
local_irq_restore(flags);
-#if DEBUG_STICK_SYNC
+#if DEBUG_TICK_SYNC
for (i = 0; i < NUM_ROUNDS; i++)
printk("rt=%5ld master=%5ld diff=%5ld adjlat=%5ld\n",
t[i].rt, t[i].master, t[i].diff, t[i].lat);
#endif
- printk(KERN_INFO "CPU %d: synchronized STICK with master CPU (last diff %ld cycles,"
+ printk(KERN_INFO "CPU %d: synchronized TICK with master CPU (last diff %ld cycles,"
"maxerr %lu cycles)\n", smp_processor_id(), delta, rt);
}
-static void smp_start_sync_stick_client(int cpu);
+static void smp_start_sync_tick_client(int cpu);
-static void smp_synchronize_one_stick(int cpu)
+static void smp_synchronize_one_tick(int cpu)
{
unsigned long flags, i;
go[MASTER] = 0;
- smp_start_sync_stick_client(cpu);
+ smp_start_sync_tick_client(cpu);
/* wait for client to be ready */
while (!go[MASTER])
@@ -370,7 +296,7 @@
membar("#LoadLoad");
go[MASTER] = 0;
membar("#StoreStore");
- go[SLAVE] = get_stick();
+ go[SLAVE] = tick_ops->get_tick();
membar("#StoreLoad");
}
}
@@ -638,11 +564,11 @@
/* NOTE: Caller runs local copy on master. */
}
-extern unsigned long xcall_sync_stick;
+extern unsigned long xcall_sync_tick;
-static void smp_start_sync_stick_client(int cpu)
+static void smp_start_sync_tick_client(int cpu)
{
- smp_cross_call_masked(&xcall_sync_stick,
+ smp_cross_call_masked(&xcall_sync_tick,
0, 0, 0,
(1UL << cpu));
}
@@ -1118,12 +1044,7 @@
* Check for level 14 softint.
*/
{
- unsigned long tick_mask;
-
- if (SPARC64_USE_STICK)
- tick_mask = (1UL << 16);
- else
- tick_mask = (1UL << 0);
+ unsigned long tick_mask = tick_ops->softint_mask;
if (!(get_softint() & tick_mask)) {
extern void handler_irq(int, struct pt_regs *);
@@ -1159,47 +1080,14 @@
: "=r" (pstate)
: "i" (PSTATE_IE));
- /* Workaround for Spitfire Errata (#54 I think??), I discovered
- * this via Sun BugID 4008234, mentioned in Solaris-2.5.1 patch
- * number 103640.
- *
- * On Blackbird writes to %tick_cmpr can fail, the
- * workaround seems to be to execute the wr instruction
- * at the start of an I-cache line, and perform a dummy
- * read back from %tick_cmpr right after writing to it. -DaveM
- *
- * Just to be anal we add a workaround for Spitfire
- * Errata 50 by preventing pipeline bypasses on the
- * final read of the %tick register into a compare
- * instruction. The Errata 50 description states
- * that %tick is not prone to this bug, but I am not
- * taking any chances.
- */
- if (!SPARC64_USE_STICK) {
- __asm__ __volatile__("rd %%tick_cmpr, %0\n\t"
- "ba,pt %%xcc, 1f\n\t"
- " add %0, %2, %0\n\t"
- ".align 64\n"
- "1: wr %0, 0x0, %%tick_cmpr\n\t"
- "rd %%tick_cmpr, %%g0\n\t"
- "rd %%tick, %1\n\t"
- "mov %1, %1"
- : "=&r" (compare), "=r" (tick)
- : "r" (current_tick_offset));
- } else {
- __asm__ __volatile__("rd %%asr25, %0\n\t"
- "add %0, %2, %0\n\t"
- "wr %0, 0x0, %%asr25\n\t"
- "rd %%asr24, %1\n\t"
- : "=&r" (compare), "=r" (tick)
- : "r" (current_tick_offset));
- }
+ compare = tick_ops->add_compare(current_tick_offset);
+ tick = tick_ops->get_tick();
/* Restore PSTATE_IE. */
__asm__ __volatile__("wrpr %0, 0x0, %%pstate"
: /* no outputs */
: "r" (pstate));
- } while (tick >= compare);
+ } while (time_after_eq(tick, compare));
}
static void __init smp_setup_percpu_timer(void)
@@ -1217,35 +1105,7 @@
: "=r" (pstate)
: "i" (PSTATE_IE));
- /* Workaround for Spitfire Errata (#54 I think??), I discovered
- * this via Sun BugID 4008234, mentioned in Solaris-2.5.1 patch
- * number 103640.
- *
- * On Blackbird writes to %tick_cmpr can fail, the
- * workaround seems to be to execute the wr instruction
- * at the start of an I-cache line, and perform a dummy
- * read back from %tick_cmpr right after writing to it. -DaveM
- */
- if (!SPARC64_USE_STICK) {
- __asm__ __volatile__(
- "rd %%tick, %%g1\n\t"
- "ba,pt %%xcc, 1f\n\t"
- " add %%g1, %0, %%g1\n\t"
- ".align 64\n"
- "1: wr %%g1, 0x0, %%tick_cmpr\n\t"
- "rd %%tick_cmpr, %%g0"
- : /* no outputs */
- : "r" (current_tick_offset)
- : "g1");
- } else {
- __asm__ __volatile__(
- "rd %%asr24, %%g1\n\t"
- "add %%g1, %0, %%g1\n\t"
- "wr %%g1, 0x0, %%asr25"
- : /* no outputs */
- : "r" (current_tick_offset)
- : "g1");
- }
+ tick_ops->init_tick(current_tick_offset);
/* Restore PSTATE_IE. */
__asm__ __volatile__("wrpr %0, 0x0, %%pstate"
@@ -1314,44 +1174,23 @@
p += (64 / sizeof(unsigned long)))
*((volatile unsigned long *)p);
- /* Now the real measurement. */
- if (!SPARC64_USE_STICK) {
- __asm__ __volatile__("b,pt %%xcc, 1f\n\t"
- " rd %%tick, %0\n\t"
- ".align 64\n"
- "1:\tldx [%2 + 0x000], %%g1\n\t"
- "ldx [%2 + 0x040], %%g2\n\t"
- "ldx [%2 + 0x080], %%g3\n\t"
- "ldx [%2 + 0x0c0], %%g5\n\t"
- "add %2, 0x100, %2\n\t"
- "cmp %2, %4\n\t"
- "bne,pt %%xcc, 1b\n\t"
- " nop\n\t"
- "rd %%tick, %1\n\t"
- : "=&r" (tick1), "=&r" (tick2),
- "=&r" (flush_base)
- : "2" (flush_base),
- "r" (flush_base + ecache_size)
- : "g1", "g2", "g3", "g5");
- } else {
- __asm__ __volatile__("b,pt %%xcc, 1f\n\t"
- " rd %%asr24, %0\n\t"
- ".align 64\n"
- "1:\tldx [%2 + 0x000], %%g1\n\t"
- "ldx [%2 + 0x040], %%g2\n\t"
- "ldx [%2 + 0x080], %%g3\n\t"
- "ldx [%2 + 0x0c0], %%g5\n\t"
- "add %2, 0x100, %2\n\t"
- "cmp %2, %4\n\t"
+ tick1 = tick_ops->get_tick();
+
+ __asm__ __volatile__("1:\n\t"
+ "ldx [%0 + 0x000], %%g1\n\t"
+ "ldx [%0 + 0x040], %%g2\n\t"
+ "ldx [%0 + 0x080], %%g3\n\t"
+ "ldx [%0 + 0x0c0], %%g5\n\t"
+ "add %0, 0x100, %0\n\t"
+ "cmp %0, %2\n\t"
"bne,pt %%xcc, 1b\n\t"
- " nop\n\t"
- "rd %%asr24, %1\n\t"
- : "=&r" (tick1), "=&r" (tick2),
- "=&r" (flush_base)
- : "2" (flush_base),
+ " nop"
+ : "=&r" (flush_base)
+ : "0" (flush_base),
"r" (flush_base + ecache_size)
: "g1", "g2", "g3", "g5");
- }
+
+ tick2 = tick_ops->get_tick();
local_irq_restore(flags);
@@ -1370,6 +1209,8 @@
report:
/* Convert ticks/sticks to jiffies. */
cache_decay_ticks = cacheflush_time / timer_tick_offset;
+ if (cache_decay_ticks < 1)
+ cache_decay_ticks = 1;
printk("Using heuristic of %ld cycles, %ld ticks.\n",
cacheflush_time, cache_decay_ticks);
@@ -1438,8 +1279,7 @@
if (!test_bit(cpu, &cpu_online_map)) {
ret = -ENODEV;
} else {
- if (SPARC64_USE_STICK)
- smp_synchronize_one_stick(cpu);
+ smp_synchronize_one_tick(cpu);
}
}
return ret;
diff -Nru a/arch/sparc64/kernel/sparc64_ksyms.c b/arch/sparc64/kernel/sparc64_ksyms.c
--- a/arch/sparc64/kernel/sparc64_ksyms.c Tue Mar 11 16:12:15 2003
+++ b/arch/sparc64/kernel/sparc64_ksyms.c Wed Mar 12 03:49:42 2003
@@ -128,20 +128,13 @@
#endif
/* Hard IRQ locking */
-#ifdef CONFIG_SMP
EXPORT_SYMBOL(synchronize_irq);
-#endif
#if defined(CONFIG_MCOUNT)
extern void mcount(void);
EXPORT_SYMBOL_NOVERS(mcount);
#endif
-/* Uniprocessor clock frequency */
-#ifndef CONFIG_SMP
-EXPORT_SYMBOL(up_clock_tick);
-#endif
-
/* Per-CPU information table */
EXPORT_SYMBOL(cpu_data);
@@ -162,10 +155,13 @@
EXPORT_SYMBOL(_do_write_unlock);
#endif
-#ifdef CONFIG_SMP
EXPORT_SYMBOL(smp_call_function);
-#endif
+#endif /* CONFIG_SMP */
+/* Uniprocessor clock frequency */
+#ifndef CONFIG_SMP
+extern unsigned long up_clock_tick;
+EXPORT_SYMBOL(up_clock_tick);
#endif
/* semaphores */
diff -Nru a/arch/sparc64/kernel/time.c b/arch/sparc64/kernel/time.c
--- a/arch/sparc64/kernel/time.c Mon Feb 24 23:13:09 2003
+++ b/arch/sparc64/kernel/time.c Tue Mar 18 18:04:20 2003
@@ -25,6 +25,7 @@
#include
#include
#include
+#include
#include
#include
@@ -37,6 +38,7 @@
#include
#include
#include
+#include
spinlock_t mostek_lock = SPIN_LOCK_UNLOCKED;
spinlock_t rtc_lock = SPIN_LOCK_UNLOCKED;
@@ -54,6 +56,352 @@
static int set_rtc_mmss(unsigned long);
+struct sparc64_tick_ops *tick_ops;
+
+#define TICK_PRIV_BIT (1UL << 63)
+
+static void tick_disable_protection(void)
+{
+ /* Set things up so user can access tick register for profiling
+ * purposes. Also workaround BB_ERRATA_1 by doing a dummy
+ * read back of %tick after writing it.
+ */
+ __asm__ __volatile__(
+ " ba,pt %%xcc, 1f\n"
+ " nop\n"
+ " .align 64\n"
+ "1: rd %%tick, %%g2\n"
+ " add %%g2, 6, %%g2\n"
+ " andn %%g2, %0, %%g2\n"
+ " wrpr %%g2, 0, %%tick\n"
+ " rdpr %%tick, %%g0"
+ : /* no outputs */
+ : "r" (TICK_PRIV_BIT)
+ : "g2");
+}
+
+static void tick_init_tick(unsigned long offset)
+{
+ tick_disable_protection();
+
+ __asm__ __volatile__(
+ " rd %%tick, %%g1\n"
+ " andn %%g1, %1, %%g1\n"
+ " ba,pt %%xcc, 1f\n"
+ " add %%g1, %0, %%g1\n"
+ " .align 64\n"
+ "1: wr %%g1, 0x0, %%tick_cmpr\n"
+ " rd %%tick_cmpr, %%g0"
+ : /* no outputs */
+ : "r" (offset), "r" (TICK_PRIV_BIT)
+ : "g1");
+}
+
+static unsigned long tick_get_tick(void)
+{
+ unsigned long ret;
+
+ __asm__ __volatile__("rd %%tick, %0\n\t"
+ "mov %0, %0"
+ : "=r" (ret));
+
+ return ret & ~TICK_PRIV_BIT;
+}
+
+static unsigned long tick_get_compare(void)
+{
+ unsigned long ret;
+
+ __asm__ __volatile__("rd %%tick_cmpr, %0\n\t"
+ "mov %0, %0"
+ : "=r" (ret));
+
+ return ret;
+}
+
+static unsigned long tick_add_compare(unsigned long adj)
+{
+ unsigned long new_compare;
+
+ /* Workaround for Spitfire Errata (#54 I think??), I discovered
+ * this via Sun BugID 4008234, mentioned in Solaris-2.5.1 patch
+ * number 103640.
+ *
+ * On Blackbird writes to %tick_cmpr can fail, the
+ * workaround seems to be to execute the wr instruction
+ * at the start of an I-cache line, and perform a dummy
+ * read back from %tick_cmpr right after writing to it. -DaveM
+ */
+ __asm__ __volatile__("rd %%tick_cmpr, %0\n\t"
+ "ba,pt %%xcc, 1f\n\t"
+ " add %0, %1, %0\n\t"
+ ".align 64\n"
+ "1:\n\t"
+ "wr %0, 0, %%tick_cmpr\n\t"
+ "rd %%tick_cmpr, %%g0"
+ : "=&r" (new_compare)
+ : "r" (adj));
+
+ return new_compare;
+}
+
+static unsigned long tick_add_tick(unsigned long adj, unsigned long offset)
+{
+ unsigned long new_tick, tmp;
+
+ /* Also need to handle Blackbird bug here too. */
+ __asm__ __volatile__("rd %%tick, %0\n\t"
+ "add %0, %2, %0\n\t"
+ "wrpr %0, 0, %%tick\n\t"
+ "andn %0, %4, %1\n\t"
+ "ba,pt %%xcc, 1f\n\t"
+ " add %1, %3, %1\n\t"
+ ".align 64\n"
+ "1:\n\t"
+ "wr %1, 0, %%tick_cmpr\n\t"
+ "rd %%tick_cmpr, %%g0"
+ : "=&r" (new_tick), "=&r" (tmp)
+ : "r" (adj), "r" (offset), "r" (TICK_PRIV_BIT));
+
+ return new_tick;
+}
+
+static struct sparc64_tick_ops tick_operations = {
+ .init_tick = tick_init_tick,
+ .get_tick = tick_get_tick,
+ .get_compare = tick_get_compare,
+ .add_tick = tick_add_tick,
+ .add_compare = tick_add_compare,
+ .softint_mask = 1UL << 0,
+};
+
+static void stick_init_tick(unsigned long offset)
+{
+ tick_disable_protection();
+
+ /* Let the user get at STICK too. */
+ __asm__ __volatile__(
+ " rd %%asr24, %%g2\n"
+ " andn %%g2, %0, %%g2\n"
+ " wr %%g2, 0, %%asr24"
+ : /* no outputs */
+ : "r" (TICK_PRIV_BIT)
+ : "g1", "g2");
+
+ __asm__ __volatile__(
+ " rd %%asr24, %%g1\n"
+ " andn %%g1, %1, %%g1\n"
+ " add %%g1, %0, %%g1\n"
+ " wr %%g1, 0x0, %%asr25"
+ : /* no outputs */
+ : "r" (offset), "r" (TICK_PRIV_BIT)
+ : "g1");
+}
+
+static unsigned long stick_get_tick(void)
+{
+ unsigned long ret;
+
+ __asm__ __volatile__("rd %%asr24, %0"
+ : "=r" (ret));
+
+ return ret & ~TICK_PRIV_BIT;
+}
+
+static unsigned long stick_get_compare(void)
+{
+ unsigned long ret;
+
+ __asm__ __volatile__("rd %%asr25, %0"
+ : "=r" (ret));
+
+ return ret;
+}
+
+static unsigned long stick_add_tick(unsigned long adj, unsigned long offset)
+{
+ unsigned long new_tick, tmp;
+
+ __asm__ __volatile__("rd %%asr24, %0\n\t"
+ "add %0, %2, %0\n\t"
+ "wr %0, 0, %%asr24\n\t"
+ "andn %0, %4, %1\n\t"
+ "add %1, %3, %1\n\t"
+ "wr %1, 0, %%asr25"
+ : "=&r" (new_tick), "=&r" (tmp)
+ : "r" (adj), "r" (offset), "r" (TICK_PRIV_BIT));
+
+ return new_tick;
+}
+
+static unsigned long stick_add_compare(unsigned long adj)
+{
+ unsigned long new_compare;
+
+ __asm__ __volatile__("rd %%asr25, %0\n\t"
+ "add %0, %1, %0\n\t"
+ "wr %0, 0, %%asr25"
+ : "=&r" (new_compare)
+ : "r" (adj));
+
+ return new_compare;
+}
+
+static struct sparc64_tick_ops stick_operations = {
+ .init_tick = stick_init_tick,
+ .get_tick = stick_get_tick,
+ .get_compare = stick_get_compare,
+ .add_tick = stick_add_tick,
+ .add_compare = stick_add_compare,
+ .softint_mask = 1UL << 16,
+};
+
+/* On Hummingbird the STICK/STICK_CMPR register is implemented
+ * in I/O space. There are two 64-bit registers each, the
+ * first holds the low 32-bits of the value and the second holds
+ * the high 32-bits.
+ *
+ * Since STICK is constantly updating, we have to access it carefully.
+ *
+ * The sequence we use to read is:
+ * 1) read low
+ * 2) read high
+ * 3) read low again, if it rolled over increment high by 1
+ *
+ * Writing STICK safely is also tricky:
+ * 1) write low to zero
+ * 2) write high
+ * 3) write low
+ */
+#define HBIRD_STICKCMP_ADDR 0x1fe0000f060UL
+#define HBIRD_STICK_ADDR 0x1fe0000f070UL
+
+static unsigned long __hbird_read_stick(void)
+{
+ unsigned long ret, tmp1, tmp2, tmp3;
+ unsigned long addr = HBIRD_STICK_ADDR;
+
+ __asm__ __volatile__("ldxa [%1] %5, %2\n\t"
+ "add %1, 0x8, %1\n\t"
+ "ldxa [%1] %5, %3\n\t"
+ "sub %1, 0x8, %1\n\t"
+ "ldxa [%1] %5, %4\n\t"
+ "cmp %4, %2\n\t"
+ "blu,a,pn %%xcc, 1f\n\t"
+ " add %3, 1, %3\n"
+ "1:\n\t"
+ "sllx %3, 32, %3\n\t"
+ "or %3, %4, %0\n\t"
+ : "=&r" (ret), "=&r" (addr),
+ "=&r" (tmp1), "=&r" (tmp2), "=&r" (tmp3)
+ : "i" (ASI_PHYS_BYPASS_EC_E), "1" (addr));
+
+ return ret;
+}
+
+static unsigned long __hbird_read_compare(void)
+{
+ unsigned long low, high;
+ unsigned long addr = HBIRD_STICKCMP_ADDR;
+
+ __asm__ __volatile__("ldxa [%2] %3, %0\n\t"
+ "add %2, 0x8, %2\n\t"
+ "ldxa [%2] %3, %1"
+ : "=&r" (low), "=&r" (high), "=&r" (addr)
+ : "i" (ASI_PHYS_BYPASS_EC_E), "2" (addr));
+
+ return (high << 32UL) | low;
+}
+
+static void __hbird_write_stick(unsigned long val)
+{
+ unsigned long low = (val & 0xffffffffUL);
+ unsigned long high = (val >> 32UL);
+ unsigned long addr = HBIRD_STICK_ADDR;
+
+ __asm__ __volatile__("stxa %%g0, [%0] %4\n\t"
+ "add %0, 0x8, %0\n\t"
+ "stxa %3, [%0] %4\n\t"
+ "sub %0, 0x8, %0\n\t"
+ "stxa %2, [%0] %4"
+ : "=&r" (addr)
+ : "0" (addr), "r" (low), "r" (high),
+ "i" (ASI_PHYS_BYPASS_EC_E));
+}
+
+static void __hbird_write_compare(unsigned long val)
+{
+ unsigned long low = (val & 0xffffffffUL);
+ unsigned long high = (val >> 32UL);
+ unsigned long addr = HBIRD_STICKCMP_ADDR + 0x8UL;
+
+ __asm__ __volatile__("stxa %3, [%0] %4\n\t"
+ "sub %0, 0x8, %0\n\t"
+ "stxa %2, [%0] %4"
+ : "=&r" (addr)
+ : "0" (addr), "r" (low), "r" (high),
+ "i" (ASI_PHYS_BYPASS_EC_E));
+}
+
+static void hbtick_init_tick(unsigned long offset)
+{
+ unsigned long val;
+
+ tick_disable_protection();
+
+ /* XXX This seems to be necessary to 'jumpstart' Hummingbird
+ * XXX into actually sending STICK interrupts. I think because
+ * XXX of how we store %tick_cmpr in head.S this somehow resets the
+ * XXX {TICK + STICK} interrupt mux. -DaveM
+ */
+ __hbird_write_stick(__hbird_read_stick());
+
+ val = __hbird_read_stick() & ~TICK_PRIV_BIT;
+ __hbird_write_compare(val + offset);
+}
+
+static unsigned long hbtick_get_tick(void)
+{
+ return __hbird_read_stick() & ~TICK_PRIV_BIT;
+}
+
+static unsigned long hbtick_get_compare(void)
+{
+ return __hbird_read_compare();
+}
+
+static unsigned long hbtick_add_tick(unsigned long adj, unsigned long offset)
+{
+ unsigned long val;
+
+ val = __hbird_read_stick() + adj;
+ __hbird_write_stick(val);
+
+ val &= ~TICK_PRIV_BIT;
+ __hbird_write_compare(val + offset);
+
+ return val;
+}
+
+static unsigned long hbtick_add_compare(unsigned long adj)
+{
+ unsigned long val = __hbird_read_compare() + adj;
+
+ val &= ~TICK_PRIV_BIT;
+ __hbird_write_compare(val);
+
+ return val;
+}
+
+static struct sparc64_tick_ops hbtick_operations = {
+ .init_tick = hbtick_init_tick,
+ .get_tick = hbtick_get_tick,
+ .get_compare = hbtick_get_compare,
+ .add_tick = hbtick_add_tick,
+ .add_compare = hbtick_add_compare,
+ .softint_mask = 1UL << 0,
+};
+
/* timer_interrupt() needs to keep up the real-time clock,
* as well as call the "do_timer()" routine every clocktick
*
@@ -62,7 +410,8 @@
*/
unsigned long timer_tick_offset;
unsigned long timer_tick_compare;
-unsigned long timer_ticks_per_usec_quotient;
+
+static unsigned long timer_ticks_per_usec_quotient;
#define TICK_SIZE (tick_nsec / 1000)
@@ -146,49 +495,14 @@
: "=r" (pstate)
: "i" (PSTATE_IE));
- /* Workaround for Spitfire Errata (#54 I think??), I discovered
- * this via Sun BugID 4008234, mentioned in Solaris-2.5.1 patch
- * number 103640.
- *
- * On Blackbird writes to %tick_cmpr can fail, the
- * workaround seems to be to execute the wr instruction
- * at the start of an I-cache line, and perform a dummy
- * read back from %tick_cmpr right after writing to it. -DaveM
- *
- * Just to be anal we add a workaround for Spitfire
- * Errata 50 by preventing pipeline bypasses on the
- * final read of the %tick register into a compare
- * instruction. The Errata 50 description states
- * that %tick is not prone to this bug, but I am not
- * taking any chances.
- */
- if (!SPARC64_USE_STICK) {
- __asm__ __volatile__(
- " rd %%tick_cmpr, %0\n"
- " ba,pt %%xcc, 1f\n"
- " add %0, %2, %0\n"
- " .align 64\n"
- "1: wr %0, 0, %%tick_cmpr\n"
- " rd %%tick_cmpr, %%g0\n"
- " rd %%tick, %1\n"
- " mov %1, %1"
- : "=&r" (timer_tick_compare), "=r" (ticks)
- : "r" (timer_tick_offset));
- } else {
- __asm__ __volatile__(
- " rd %%asr25, %0\n"
- " add %0, %2, %0\n"
- " wr %0, 0, %%asr25\n"
- " rd %%asr24, %1"
- : "=&r" (timer_tick_compare), "=r" (ticks)
- : "r" (timer_tick_offset));
- }
+ timer_tick_compare = tick_ops->add_compare(timer_tick_offset);
+ ticks = tick_ops->get_tick();
/* Restore PSTATE_IE. */
__asm__ __volatile__("wrpr %0, 0x0, %%pstate"
: /* no outputs */
: "r" (pstate));
- } while (ticks >= timer_tick_compare);
+ } while (time_after_eq(ticks, timer_tick_compare));
timer_check_rtc();
@@ -205,19 +519,7 @@
/*
* Only keep timer_tick_offset uptodate, but don't set TICK_CMPR.
*/
- if (!SPARC64_USE_STICK) {
- __asm__ __volatile__(
- " rd %%tick_cmpr, %0\n"
- " add %0, %1, %0"
- : "=&r" (timer_tick_compare)
- : "r" (timer_tick_offset));
- } else {
- __asm__ __volatile__(
- " rd %%asr25, %0\n"
- " add %0, %1, %0"
- : "=&r" (timer_tick_compare)
- : "r" (timer_tick_offset));
- }
+ timer_tick_compare = tick_ops->get_compare() + timer_tick_offset;
timer_check_rtc();
@@ -620,40 +922,90 @@
local_irq_restore(flags);
}
-void __init time_init(void)
+/* This is gets the master TICK_INT timer going. */
+static unsigned long sparc64_init_timers(void (*cfunc)(int, void *, struct pt_regs *))
{
- /* clock_probe() is now done at end of [se]bus_init on sparc64
- * so that sbus, fhc and ebus bus information is probed and
- * available.
+ unsigned long pstate, clock;
+ int node, err;
+#ifdef CONFIG_SMP
+ extern void smp_tick_init(void);
+#endif
+
+ if (tlb_type == spitfire) {
+ unsigned long ver, manuf, impl;
+
+ __asm__ __volatile__ ("rdpr %%ver, %0"
+ : "=&r" (ver));
+ manuf = ((ver >> 48) & 0xffff);
+ impl = ((ver >> 32) & 0xffff);
+ if (manuf == 0x17 && impl == 0x13) {
+ /* Hummingbird, aka Ultra-IIe */
+ tick_ops = &hbtick_operations;
+ node = prom_root_node;
+ clock = prom_getint(node, "stick-frequency");
+ } else {
+ tick_ops = &tick_operations;
+ node = linux_cpus[0].prom_node;
+ clock = prom_getint(node, "clock-frequency");
+ }
+ } else {
+ tick_ops = &stick_operations;
+ node = prom_root_node;
+ clock = prom_getint(node, "stick-frequency");
+ }
+ timer_tick_offset = clock / HZ;
+
+#ifdef CONFIG_SMP
+ smp_tick_init();
+#endif
+
+ /* Register IRQ handler. */
+ err = request_irq(build_irq(0, 0, 0UL, 0UL), cfunc, SA_STATIC_ALLOC,
+ "timer", NULL);
+
+ if (err) {
+ prom_printf("Serious problem, cannot register TICK_INT\n");
+ prom_halt();
+ }
+
+ /* Guarentee that the following sequences execute
+ * uninterrupted.
*/
- unsigned long clock;
+ __asm__ __volatile__("rdpr %%pstate, %0\n\t"
+ "wrpr %0, %1, %%pstate"
+ : "=r" (pstate)
+ : "i" (PSTATE_IE));
+
+ tick_ops->init_tick(timer_tick_offset);
+
+ /* Restore PSTATE_IE. */
+ __asm__ __volatile__("wrpr %0, 0x0, %%pstate"
+ : /* no outputs */
+ : "r" (pstate));
+
+ local_irq_enable();
- sparc64_init_timers(timer_interrupt, &clock);
- timer_ticks_per_usec_quotient = ((1UL<<32) / (clock / 1000020));
+ return clock;
+}
+
+/* The quotient formula is taken from the IA64 port. */
+void __init time_init(void)
+{
+ unsigned long clock = sparc64_init_timers(timer_interrupt);
+
+ timer_ticks_per_usec_quotient =
+ (((1000000UL << 30) +
+ (clock / 2)) / clock);
}
static __inline__ unsigned long do_gettimeoffset(void)
{
- unsigned long ticks;
+ unsigned long ticks = tick_ops->get_tick();
- if (!SPARC64_USE_STICK) {
- __asm__ __volatile__(
- " rd %%tick, %%g1\n"
- " add %1, %%g1, %0\n"
- " sub %0, %2, %0\n"
- : "=r" (ticks)
- : "r" (timer_tick_offset), "r" (timer_tick_compare)
- : "g1", "g2");
- } else {
- __asm__ __volatile__("rd %%asr24, %%g1\n\t"
- "add %1, %%g1, %0\n\t"
- "sub %0, %2, %0\n\t"
- : "=&r" (ticks)
- : "r" (timer_tick_offset), "r" (timer_tick_compare)
- : "g1");
- }
+ ticks += timer_tick_offset;
+ ticks -= timer_tick_compare;
- return (ticks * timer_ticks_per_usec_quotient) >> 32UL;
+ return (ticks * timer_ticks_per_usec_quotient) >> 30UL;
}
void do_settimeofday(struct timeval *tv)
diff -Nru a/arch/sparc64/kernel/trampoline.S b/arch/sparc64/kernel/trampoline.S
--- a/arch/sparc64/kernel/trampoline.S Mon Aug 26 02:44:51 2002
+++ b/arch/sparc64/kernel/trampoline.S Tue Mar 18 18:26:20 2003
@@ -85,7 +85,10 @@
startup_continue:
wrpr %g0, 15, %pil
- wr %g0, 0, %tick_cmpr
+
+ sethi %hi(0x80000000), %g2
+ sllx %g2, 32, %g2
+ wr %g2, 0, %tick_cmpr
/* Call OBP by hand to lock KERNBASE into i/d tlbs. */
mov %o0, %l0
diff -Nru a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c
--- a/arch/sparc64/kernel/traps.c Tue Feb 25 09:17:18 2003
+++ b/arch/sparc64/kernel/traps.c Wed Mar 19 22:55:52 2003
@@ -33,6 +33,7 @@
#include
#include
#include
+#include
#ifdef CONFIG_KMOD
#include
#endif
@@ -588,7 +589,7 @@
flush_linesize = ecache_flush_linesize;
flush_size = ecache_flush_size >> 1;
- __asm__ __volatile__("rd %%tick, %0" : "=r" (tick1));
+ tick1 = tick_ops->get_tick();
__asm__ __volatile__("1: subcc %0, %4, %0\n\t"
" bne,pt %%xcc, 1b\n\t"
@@ -597,7 +598,7 @@
: "0" (flush_size), "r" (flush_base),
"i" (ASI_PHYS_USE_EC), "r" (flush_linesize));
- __asm__ __volatile__("rd %%tick, %0" : "=r" (tick2));
+ tick2 = tick_ops->get_tick();
raw = (tick2 - tick1);
@@ -1598,6 +1599,7 @@
void die_if_kernel(char *str, struct pt_regs *regs)
{
+ static int die_counter;
extern void __show_regs(struct pt_regs * regs);
extern void smp_report_regs(void);
int count = 0;
@@ -1610,7 +1612,7 @@
" /_| \\__/ |_\\\n"
" \\__U_/\n");
- printk("%s(%d): %s\n", current->comm, current->pid, str);
+ printk("%s(%d): %s [#%d]\n", current->comm, current->pid, str, ++die_counter);
__asm__ __volatile__("flushw");
__show_regs(regs);
if (regs->tstate & TSTATE_PRIV) {
diff -Nru a/arch/sparc64/mm/ultra.S b/arch/sparc64/mm/ultra.S
--- a/arch/sparc64/mm/ultra.S Sat Feb 22 00:03:07 2003
+++ b/arch/sparc64/mm/ultra.S Wed Mar 12 12:47:00 2003
@@ -560,8 +560,8 @@
/* This runs in a very controlled environment, so we do
* not need to worry about BH races etc.
*/
- .globl xcall_sync_stick
-xcall_sync_stick:
+ .globl xcall_sync_tick
+xcall_sync_tick:
rdpr %pstate, %g2
wrpr %g2, PSTATE_IG | PSTATE_AG, %pstate
rdpr %pil, %g2
@@ -569,7 +569,7 @@
sethi %hi(109f), %g7
b,pt %xcc, etrap_irq
109: or %g7, %lo(109b), %g7
- call smp_synchronize_stick_client
+ call smp_synchronize_tick_client
nop
clr %l6
b rtrap_xcall
diff -Nru a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
--- a/arch/um/drivers/ubd_kern.c Sat Mar 8 14:50:21 2003
+++ b/arch/um/drivers/ubd_kern.c Wed Mar 12 02:35:30 2003
@@ -507,7 +507,7 @@
/* /dev/ubd/N style names */
sprintf(devfs_name, "%d", unit);
*handle_out = devfs_register(dir_handle, devfs_name,
- DEVFS_FL_REMOVABLE, major, minor,
+ 0, major, minor,
S_IFBLK | S_IRUSR | S_IWUSR | S_IRGRP |
S_IWGRP, &ubd_blops, NULL);
disk->private_data = &ubd_dev[unit];
diff -Nru a/arch/x86_64/ia32/ia32_binfmt.c b/arch/x86_64/ia32/ia32_binfmt.c
--- a/arch/x86_64/ia32/ia32_binfmt.c Sun Jan 5 05:32:14 2003
+++ b/arch/x86_64/ia32/ia32_binfmt.c Mon Mar 17 21:31:50 2003
@@ -217,7 +217,7 @@
# define CONFIG_BINFMT_ELF_MODULE CONFIG_BINFMT_ELF32_MODULE
#endif
-#define ELF_PLAT_INIT(r) elf32_init(r)
+#define ELF_PLAT_INIT(r, load_addr) elf32_init(r)
#define setup_arg_pages(bprm) ia32_setup_arg_pages(bprm)
int ia32_setup_arg_pages(struct linux_binprm *bprm);
diff -Nru a/arch/x86_64/kernel/irq.c b/arch/x86_64/kernel/irq.c
--- a/arch/x86_64/kernel/irq.c Sat Mar 8 14:50:43 2003
+++ b/arch/x86_64/kernel/irq.c Thu Mar 20 03:11:45 2003
@@ -732,6 +732,9 @@
struct irqaction *old, **p;
irq_desc_t *desc = irq_desc + irq;
+ if (desc->handler == &no_irq_type)
+ return -ENOSYS;
+
/*
* Some drivers like serial.c use request_irq() heavily,
* so we have to be careful not to interfere with a
diff -Nru a/arch/x86_64/kernel/traps.c b/arch/x86_64/kernel/traps.c
--- a/arch/x86_64/kernel/traps.c Tue Feb 11 02:33:11 2003
+++ b/arch/x86_64/kernel/traps.c Mon Mar 17 21:32:24 2003
@@ -325,11 +325,12 @@
{
int cpu;
struct die_args args = { regs, str, err };
+ static int die_counter;
console_verbose();
notifier_call_chain(&die_chain, DIE_DIE, &args);
bust_spinlocks(1);
handle_BUG(regs);
- printk("%s: %04lx\n", str, err & 0xffff);
+ printk("%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter);
cpu = safe_smp_processor_id();
/* racy, but better than risking deadlock. */
local_irq_disable();
diff -Nru a/drivers/acpi/processor.c b/drivers/acpi/processor.c
--- a/drivers/acpi/processor.c Wed Feb 19 15:50:05 2003
+++ b/drivers/acpi/processor.c Sat Feb 15 09:52:17 2003
@@ -1356,7 +1356,8 @@
loff_t *data)
{
int result = 0;
- struct acpi_processor *pr = (struct acpi_processor *) data;
+ struct seq_file *m = (struct seq_file *)file->private_data;
+ struct acpi_processor *pr = (struct acpi_processor *)m->private;
char state_string[12] = {'\0'};
ACPI_FUNCTION_TRACE("acpi_processor_write_throttling");
@@ -1418,7 +1419,8 @@
loff_t *data)
{
int result = 0;
- struct acpi_processor *pr = (struct acpi_processor *) data;
+ struct seq_file *m = (struct seq_file *)file->private_data;
+ struct acpi_processor *pr = (struct acpi_processor *)m->private;
char limit_string[25] = {'\0'};
int px = 0;
int tx = 0;
diff -Nru a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c
--- a/drivers/atm/idt77252.c Mon Nov 11 05:55:56 2002
+++ b/drivers/atm/idt77252.c Thu Mar 20 00:45:11 2003
@@ -730,7 +730,7 @@
struct atm_vcc *vcc = vc->tx_vcc;
vc->estimator->cells += (skb->len + 47) / 48;
- if (atomic_read(&vcc->tx_inuse) > (vcc->sk->sndbuf >> 1)) {
+ if (atomic_read(&vcc->sk->wmem_alloc) > (vcc->sk->sndbuf >> 1)) {
u32 cps = vc->estimator->maxcps;
vc->estimator->cps = cps;
@@ -2025,7 +2025,7 @@
atomic_inc(&vcc->stats->tx_err);
return -ENOMEM;
}
- atomic_add(skb->truesize + ATM_PDU_OVHD, &vcc->tx_inuse);
+ atomic_add(skb->truesize + ATM_PDU_OVHD, &vcc->sk->wmem_alloc);
ATM_SKB(skb)->iovcnt = 0;
memcpy(skb_put(skb, 52), cell, 52);
diff -Nru a/drivers/block/amiflop.c b/drivers/block/amiflop.c
--- a/drivers/block/amiflop.c Sat Mar 8 14:50:22 2003
+++ b/drivers/block/amiflop.c Sun Mar 16 04:35:16 2003
@@ -353,10 +353,8 @@
unit[nr].motor = 1;
fd_select(nr);
- del_timer(&motor_on_timer);
motor_on_timer.data = nr;
- motor_on_timer.expires = jiffies + HZ/2;
- add_timer(&motor_on_timer);
+ mod_timer(&motor_on_timer, jiffies + HZ/2);
on_attempts = 10;
sleep_on (&motor_wait);
@@ -414,11 +412,9 @@
int drive;
drive = nr & 3;
- del_timer(motor_off_timer + drive);
- motor_off_timer[drive].expires = jiffies + 3*HZ;
/* called this way it is always from interrupt */
motor_off_timer[drive].data = nr | 0x80000000;
- add_timer(motor_off_timer + nr);
+ mod_timer(motor_off_timer + drive, jiffies + 3*HZ);
}
static int fd_calibrate(int drive)
@@ -1429,10 +1425,7 @@
floppy->dirty = 1;
/* reset the timer */
- del_timer (flush_track_timer + drive);
-
- flush_track_timer[drive].expires = jiffies + 1;
- add_timer (flush_track_timer + drive);
+ mod_timer (flush_track_timer + drive, jiffies + 1);
local_irq_restore(flags);
break;
}
diff -Nru a/drivers/block/cciss.c b/drivers/block/cciss.c
--- a/drivers/block/cciss.c Sat Mar 8 14:50:22 2003
+++ b/drivers/block/cciss.c Tue Mar 18 14:13:40 2003
@@ -2623,12 +2623,8 @@
{
printk(KERN_INFO DRIVER_NAME "\n");
- /* Register for out PCI devices */
- if (pci_register_driver(&cciss_pci_driver) > 0 )
- return 0;
- else
- return -ENODEV;
-
+ /* Register for our PCI devices */
+ return pci_register_driver(&cciss_pci_driver);
}
static int __init init_cciss_module(void)
diff -Nru a/drivers/block/floppy.c b/drivers/block/floppy.c
--- a/drivers/block/floppy.c Sat Mar 8 14:50:22 2003
+++ b/drivers/block/floppy.c Thu Mar 20 03:11:48 2003
@@ -3649,6 +3649,8 @@
name = default_drive_params[type].name;
allowed_drive_mask |= 1 << drive;
}
+ else
+ allowed_drive_mask &= ~(1 << drive);
} else {
params = &default_drive_params[0].params;
sprintf(temparea, "unknown type %d (usb?)", type);
diff -Nru a/drivers/block/genhd.c b/drivers/block/genhd.c
--- a/drivers/block/genhd.c Mon Mar 10 11:47:07 2003
+++ b/drivers/block/genhd.c Mon Mar 17 21:33:24 2003
@@ -538,12 +538,20 @@
struct gendisk *get_disk(struct gendisk *disk)
{
struct module *owner;
+ struct kobject *kobj;
+
if (!disk->fops)
return NULL;
owner = disk->fops->owner;
if (owner && !try_module_get(owner))
return NULL;
- return to_disk(kobject_get(&disk->kobj));
+ kobj = kobject_get(&disk->kobj);
+ if (kobj == NULL) {
+ module_put(owner);
+ return NULL;
+ }
+ return to_disk(kobj);
+
}
void put_disk(struct gendisk *disk)
diff -Nru a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c
--- a/drivers/block/ll_rw_blk.c Tue Mar 11 07:04:00 2003
+++ b/drivers/block/ll_rw_blk.c Mon Mar 17 21:31:55 2003
@@ -56,11 +56,7 @@
unsigned long blk_max_low_pfn, blk_max_pfn;
int blk_nohighio = 0;
-static struct congestion_state {
- wait_queue_head_t wqh;
- atomic_t nr_congested_queues;
- atomic_t nr_active_queues;
-} congestion_states[2];
+static wait_queue_head_t congestion_wqh[2];
/*
* Return the threshold (number of free requests) at which the queue is
@@ -98,14 +94,12 @@
static void clear_queue_congested(request_queue_t *q, int rw)
{
enum bdi_state bit;
- struct congestion_state *cs = &congestion_states[rw];
+ wait_queue_head_t *wqh = &congestion_wqh[rw];
bit = (rw == WRITE) ? BDI_write_congested : BDI_read_congested;
-
- if (test_and_clear_bit(bit, &q->backing_dev_info.state))
- atomic_dec(&cs->nr_congested_queues);
- if (waitqueue_active(&cs->wqh))
- wake_up(&cs->wqh);
+ clear_bit(bit, &q->backing_dev_info.state);
+ if (waitqueue_active(wqh))
+ wake_up(wqh);
}
/*
@@ -117,37 +111,7 @@
enum bdi_state bit;
bit = (rw == WRITE) ? BDI_write_congested : BDI_read_congested;
-
- if (!test_and_set_bit(bit, &q->backing_dev_info.state))
- atomic_inc(&congestion_states[rw].nr_congested_queues);
-}
-
-/*
- * A queue has just put back its last read or write request and has fallen
- * idle.
- */
-static void clear_queue_active(request_queue_t *q, int rw)
-{
- enum bdi_state bit;
-
- bit = (rw == WRITE) ? BDI_write_active : BDI_read_active;
-
- if (test_and_clear_bit(bit, &q->backing_dev_info.state))
- atomic_dec(&congestion_states[rw].nr_active_queues);
-}
-
-/*
- * A queue has just taken its first read or write request and has become
- * active.
- */
-static void set_queue_active(request_queue_t *q, int rw)
-{
- enum bdi_state bit;
-
- bit = (rw == WRITE) ? BDI_write_active : BDI_read_active;
-
- if (!test_and_set_bit(bit, &q->backing_dev_info.state))
- atomic_inc(&congestion_states[rw].nr_active_queues);
+ set_bit(bit, &q->backing_dev_info.state);
}
/**
@@ -1325,8 +1289,6 @@
rq = blkdev_free_rq(&rl->free);
list_del_init(&rq->queuelist);
rq->ref_count = 1;
- if (rl->count == queue_nr_requests)
- set_queue_active(q, rw);
rl->count--;
if (rl->count < queue_congestion_on_threshold())
set_queue_congested(q, rw);
@@ -1569,8 +1531,6 @@
rl->count++;
if (rl->count >= queue_congestion_off_threshold())
clear_queue_congested(q, rw);
- if (rl->count == queue_nr_requests)
- clear_queue_active(q, rw);
if (rl->count >= batch_requests && waitqueue_active(&rl->wait))
wake_up(&rl->wait);
}
@@ -1605,12 +1565,12 @@
void blk_congestion_wait(int rw, long timeout)
{
DEFINE_WAIT(wait);
- struct congestion_state *cs = &congestion_states[rw];
+ wait_queue_head_t *wqh = &congestion_wqh[rw];
blk_run_queues();
- prepare_to_wait(&cs->wqh, &wait, TASK_UNINTERRUPTIBLE);
+ prepare_to_wait(wqh, &wait, TASK_UNINTERRUPTIBLE);
io_schedule_timeout(timeout);
- finish_wait(&cs->wqh, &wait);
+ finish_wait(wqh, &wait);
}
/*
@@ -2249,11 +2209,8 @@
blk_max_low_pfn = max_low_pfn;
blk_max_pfn = max_pfn;
- for (i = 0; i < ARRAY_SIZE(congestion_states); i++) {
- init_waitqueue_head(&congestion_states[i].wqh);
- atomic_set(&congestion_states[i].nr_congested_queues, 0);
- atomic_set(&congestion_states[i].nr_active_queues, 0);
- }
+ for (i = 0; i < ARRAY_SIZE(congestion_wqh); i++)
+ init_waitqueue_head(&congestion_wqh[i]);
return 0;
};
diff -Nru a/drivers/block/nbd.c b/drivers/block/nbd.c
--- a/drivers/block/nbd.c Sat Mar 8 14:50:22 2003
+++ b/drivers/block/nbd.c Sat Mar 1 13:53:36 2003
@@ -76,22 +76,15 @@
{
int uptodate = (req->errors == 0) ? 1 : 0;
request_queue_t *q = req->q;
- struct bio *bio;
- unsigned nsect;
unsigned long flags;
#ifdef PARANOIA
requests_out++;
#endif
spin_lock_irqsave(q->queue_lock, flags);
- while((bio = req->bio) != NULL) {
- nsect = bio_sectors(bio);
- blk_finished_io(nsect);
- req->bio = bio->bi_next;
- bio->bi_next = NULL;
- bio_endio(bio, nsect << 9, uptodate ? 0 : -EIO);
+ if (!end_that_request_first(req, uptodate, req->nr_sectors)) {
+ end_that_request_last(req);
}
- blk_put_request(req);
spin_unlock_irqrestore(q->queue_lock, flags);
}
@@ -243,7 +236,7 @@
req = list_entry(tmp, struct request, queuelist);
if (req != xreq)
continue;
- list_del(&req->queuelist);
+ list_del_init(&req->queuelist);
spin_unlock(&lo->queue_lock);
return req;
}
@@ -322,7 +315,7 @@
spin_lock(&lo->queue_lock);
if (!list_empty(&lo->queue_head)) {
req = list_entry(lo->queue_head.next, struct request, queuelist);
- list_del(&req->queuelist);
+ list_del_init(&req->queuelist);
}
spin_unlock(&lo->queue_lock);
if (req) {
@@ -387,7 +380,7 @@
if (req->errors) {
printk(KERN_ERR "nbd: nbd_send_req failed\n");
spin_lock(&lo->queue_lock);
- list_del(&req->queuelist);
+ list_del_init(&req->queuelist);
spin_unlock(&lo->queue_lock);
nbd_end_request(req);
spin_lock_irq(q->queue_lock);
@@ -590,6 +583,7 @@
disk->first_minor = i;
disk->fops = &nbd_fops;
disk->private_data = &nbd_dev[i];
+ disk->queue = &nbd_queue;
sprintf(disk->disk_name, "nbd%d", i);
set_capacity(disk, 0x3ffffe);
add_disk(disk);
diff -Nru a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
--- a/drivers/cdrom/cdrom.c Sun Mar 2 23:30:08 2003
+++ b/drivers/cdrom/cdrom.c Wed Mar 19 01:53:58 2003
@@ -1125,7 +1125,7 @@
static int dvd_read_physical(struct cdrom_device_info *cdi, dvd_struct *s)
{
- unsigned char buf[20], *base;
+ unsigned char buf[21], *base;
struct dvd_layer *layer;
struct cdrom_generic_command cgc;
struct cdrom_device_ops *cdo = cdi->ops;
diff -Nru a/drivers/cdrom/cdu31a.c b/drivers/cdrom/cdu31a.c
--- a/drivers/cdrom/cdu31a.c Sat Mar 8 14:50:22 2003
+++ b/drivers/cdrom/cdu31a.c Tue Mar 18 12:15:50 2003
@@ -1375,9 +1375,9 @@
readahead_buffer + (2048 -
readahead_dataleft),
readahead_dataleft);
- readahead_dataleft = 0;
bytesleft -= readahead_dataleft;
offset += readahead_dataleft;
+ readahead_dataleft = 0;
} else {
/* The readahead will fill the whole buffer, get the data
and return. */
diff -Nru a/drivers/char/Makefile b/drivers/char/Makefile
--- a/drivers/char/Makefile Thu Mar 13 15:24:01 2003
+++ b/drivers/char/Makefile Tue Mar 18 08:57:58 2003
@@ -44,6 +44,7 @@
obj-$(CONFIG_PRINTER) += lp.o
obj-$(CONFIG_TIPAR) += tipar.o
+obj-$(CONFIG_PC9800_OLDLP) += lp_old98.o
obj-$(CONFIG_BUSMOUSE) += busmouse.o
obj-$(CONFIG_DTLK) += dtlk.o
diff -Nru a/drivers/char/amiserial.c b/drivers/char/amiserial.c
--- a/drivers/char/amiserial.c Mon Mar 3 12:04:08 2003
+++ b/drivers/char/amiserial.c Tue Mar 18 07:40:48 2003
@@ -102,8 +102,6 @@
static char *serial_name = "Amiga-builtin serial driver";
-static DECLARE_TASK_QUEUE(tq_serial);
-
static struct tty_driver serial_driver, callout_driver;
static int serial_refcount;
@@ -276,8 +274,7 @@
int event)
{
info->event |= 1 << event;
- queue_task(&info->tqueue, &tq_serial);
- mark_bh(SERIAL_BH);
+ tasklet_schedule(&info->tlet);
}
static _INLINE_ void receive_chars(struct async_struct *info)
@@ -560,12 +557,8 @@
* 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_)
+static void do_softint(unsigned long private_)
{
struct async_struct *info = (struct async_struct *) private_;
struct tty_struct *tty;
@@ -1878,8 +1871,7 @@
info->flags = sstate->flags;
info->xmit_fifo_size = sstate->xmit_fifo_size;
info->line = line;
- info->tqueue.routine = do_softint;
- info->tqueue.data = info;
+ tasklet_init(&info->tlet, do_softint, (unsigned long)info);
info->state = sstate;
if (sstate->info) {
kfree(info);
@@ -2117,8 +2109,6 @@
if (!request_mem_region(CUSTOM_PHYSADDR+0x30, 4, "amiserial [Paula]"))
return -EBUSY;
- init_bh(SERIAL_BH, do_serial_bh);
-
IRQ_ports = NULL;
show_serial_version();
@@ -2234,23 +2224,18 @@
static __exit void rs_exit(void)
{
- unsigned long flags;
int e1, e2;
- struct async_struct *info;
+ struct async_struct *info = rs_table[0].info;
/* printk("Unloading %s: version %s\n", serial_name, serial_version); */
- save_flags(flags);
- cli();
- remove_bh(SERIAL_BH);
+ tasklet_kill(&info->tlet);
if ((e1 = tty_unregister_driver(&serial_driver)))
printk("SERIAL: failed to unregister serial driver (%d)\n",
e1);
if ((e2 = tty_unregister_driver(&callout_driver)))
printk("SERIAL: failed to unregister callout driver (%d)\n",
e2);
- restore_flags(flags);
- info = rs_table[0].info;
if (info) {
rs_table[0].info = NULL;
kfree(info);
@@ -2320,9 +2305,10 @@
/*
* Register console.
*/
-static void __init amiserial_console_init(void)
+static int __init amiserial_console_init(void)
{
register_console(&sercons);
+ return 0;
}
console_initcall(amiserial_console_init);
#endif
diff -Nru a/drivers/char/decserial.c b/drivers/char/decserial.c
--- a/drivers/char/decserial.c Fri Feb 14 15:14:03 2003
+++ b/drivers/char/decserial.c Tue Mar 18 07:43:01 2003
@@ -75,7 +75,7 @@
/* serial_console_init handles the special case of starting
* up the console on the serial port
*/
-static void __init decserial_console_init(void)
+static int __init decserial_console_init(void)
{
#if defined(CONFIG_ZS) && defined(CONFIG_DZ)
if (IOASIC)
@@ -93,6 +93,7 @@
#endif
#endif
+ return 0;
}
console_initcall(decserial_console_init);
diff -Nru a/drivers/char/drm/ati_pcigart.h b/drivers/char/drm/ati_pcigart.h
--- a/drivers/char/drm/ati_pcigart.h Tue Oct 29 14:29:19 2002
+++ b/drivers/char/drm/ati_pcigart.h Thu Mar 13 16:52:15 2003
@@ -27,7 +27,6 @@
* Gareth Hughes
*/
-#define __NO_VERSION__
#include "drmP.h"
#if PAGE_SIZE == 65536
diff -Nru a/drivers/char/drm/drm_agpsupport.h b/drivers/char/drm/drm_agpsupport.h
--- a/drivers/char/drm/drm_agpsupport.h Wed Dec 18 09:56:28 2002
+++ b/drivers/char/drm/drm_agpsupport.h Thu Mar 13 16:52:15 2003
@@ -29,7 +29,6 @@
* Gareth Hughes
*/
-#define __NO_VERSION__
#include "drmP.h"
#include
diff -Nru a/drivers/char/drm/drm_auth.h b/drivers/char/drm/drm_auth.h
--- a/drivers/char/drm/drm_auth.h Tue Oct 29 14:29:19 2002
+++ b/drivers/char/drm/drm_auth.h Thu Mar 13 16:52:15 2003
@@ -29,7 +29,6 @@
* Gareth Hughes
*/
-#define __NO_VERSION__
#include "drmP.h"
static int DRM(hash_magic)(drm_magic_t magic)
diff -Nru a/drivers/char/drm/drm_bufs.h b/drivers/char/drm/drm_bufs.h
--- a/drivers/char/drm/drm_bufs.h Tue Oct 29 14:29:19 2002
+++ b/drivers/char/drm/drm_bufs.h Thu Mar 13 16:52:15 2003
@@ -29,7 +29,6 @@
* Gareth Hughes
*/
-#define __NO_VERSION__
#include
#include "drmP.h"
diff -Nru a/drivers/char/drm/drm_context.h b/drivers/char/drm/drm_context.h
--- a/drivers/char/drm/drm_context.h Tue Oct 29 14:29:19 2002
+++ b/drivers/char/drm/drm_context.h Thu Mar 13 16:52:15 2003
@@ -33,7 +33,6 @@
* needed by SiS driver's memory management.
*/
-#define __NO_VERSION__
#include "drmP.h"
#if __HAVE_CTX_BITMAP
diff -Nru a/drivers/char/drm/drm_dma.h b/drivers/char/drm/drm_dma.h
--- a/drivers/char/drm/drm_dma.h Wed Dec 18 09:56:28 2002
+++ b/drivers/char/drm/drm_dma.h Thu Mar 13 16:52:15 2003
@@ -29,7 +29,6 @@
* Gareth Hughes
*/
-#define __NO_VERSION__
#include "drmP.h"
#include /* For task queue support */
diff -Nru a/drivers/char/drm/drm_drawable.h b/drivers/char/drm/drm_drawable.h
--- a/drivers/char/drm/drm_drawable.h Tue Oct 29 14:29:20 2002
+++ b/drivers/char/drm/drm_drawable.h Thu Mar 13 16:52:15 2003
@@ -29,7 +29,6 @@
* Gareth Hughes
*/
-#define __NO_VERSION__
#include "drmP.h"
int DRM(adddraw)(struct inode *inode, struct file *filp,
diff -Nru a/drivers/char/drm/drm_fops.h b/drivers/char/drm/drm_fops.h
--- a/drivers/char/drm/drm_fops.h Tue Oct 29 14:29:20 2002
+++ b/drivers/char/drm/drm_fops.h Thu Mar 13 16:52:15 2003
@@ -30,7 +30,6 @@
* Gareth Hughes
*/
-#define __NO_VERSION__
#include "drmP.h"
#include
diff -Nru a/drivers/char/drm/drm_init.h b/drivers/char/drm/drm_init.h
--- a/drivers/char/drm/drm_init.h Tue Oct 29 14:29:20 2002
+++ b/drivers/char/drm/drm_init.h Thu Mar 13 16:52:15 2003
@@ -29,7 +29,6 @@
* Gareth Hughes
*/
-#define __NO_VERSION__
#include "drmP.h"
#if 0
diff -Nru a/drivers/char/drm/drm_ioctl.h b/drivers/char/drm/drm_ioctl.h
--- a/drivers/char/drm/drm_ioctl.h Tue Oct 29 14:29:20 2002
+++ b/drivers/char/drm/drm_ioctl.h Thu Mar 13 16:52:15 2003
@@ -29,7 +29,6 @@
* Gareth Hughes
*/
-#define __NO_VERSION__
#include "drmP.h"
diff -Nru a/drivers/char/drm/drm_lists.h b/drivers/char/drm/drm_lists.h
--- a/drivers/char/drm/drm_lists.h Tue Oct 29 14:29:20 2002
+++ b/drivers/char/drm/drm_lists.h Thu Mar 13 16:52:15 2003
@@ -29,7 +29,6 @@
* Gareth Hughes
*/
-#define __NO_VERSION__
#include "drmP.h"
#if __HAVE_DMA_WAITLIST
diff -Nru a/drivers/char/drm/drm_lock.h b/drivers/char/drm/drm_lock.h
--- a/drivers/char/drm/drm_lock.h Tue Oct 29 14:29:20 2002
+++ b/drivers/char/drm/drm_lock.h Thu Mar 13 16:52:15 2003
@@ -29,7 +29,6 @@
* Gareth Hughes
*/
-#define __NO_VERSION__
#include "drmP.h"
int DRM(block)(struct inode *inode, struct file *filp, unsigned int cmd,
diff -Nru a/drivers/char/drm/drm_memory.h b/drivers/char/drm/drm_memory.h
--- a/drivers/char/drm/drm_memory.h Tue Oct 29 14:29:20 2002
+++ b/drivers/char/drm/drm_memory.h Thu Mar 13 16:52:15 2003
@@ -29,7 +29,6 @@
* Gareth Hughes
*/
-#define __NO_VERSION__
#include
#include "drmP.h"
#include
diff -Nru a/drivers/char/drm/drm_os_linux.h b/drivers/char/drm/drm_os_linux.h
--- a/drivers/char/drm/drm_os_linux.h Tue Oct 29 14:29:20 2002
+++ b/drivers/char/drm/drm_os_linux.h Thu Mar 13 16:52:15 2003
@@ -1,4 +1,3 @@
-#define __NO_VERSION__
#include /* For task queue support */
#include
diff -Nru a/drivers/char/drm/drm_proc.h b/drivers/char/drm/drm_proc.h
--- a/drivers/char/drm/drm_proc.h Tue Oct 29 14:29:20 2002
+++ b/drivers/char/drm/drm_proc.h Thu Mar 13 16:52:15 2003
@@ -33,7 +33,6 @@
* the problem with the proc files not outputting all their information.
*/
-#define __NO_VERSION__
#include "drmP.h"
static int DRM(name_info)(char *buf, char **start, off_t offset,
diff -Nru a/drivers/char/drm/drm_scatter.h b/drivers/char/drm/drm_scatter.h
--- a/drivers/char/drm/drm_scatter.h Tue Oct 29 14:29:20 2002
+++ b/drivers/char/drm/drm_scatter.h Thu Mar 13 16:52:15 2003
@@ -27,7 +27,6 @@
* Gareth Hughes
*/
-#define __NO_VERSION__
#include
#include
#include "drmP.h"
diff -Nru a/drivers/char/drm/drm_stub.h b/drivers/char/drm/drm_stub.h
--- a/drivers/char/drm/drm_stub.h Tue Oct 29 14:29:20 2002
+++ b/drivers/char/drm/drm_stub.h Thu Mar 13 16:52:15 2003
@@ -28,7 +28,6 @@
*
*/
-#define __NO_VERSION__
#include "drmP.h"
#define DRM_STUB_MAXCARDS 16 /* Enough for one machine */
diff -Nru a/drivers/char/drm/drm_vm.h b/drivers/char/drm/drm_vm.h
--- a/drivers/char/drm/drm_vm.h Tue Feb 25 11:05:27 2003
+++ b/drivers/char/drm/drm_vm.h Thu Mar 13 16:52:15 2003
@@ -29,7 +29,6 @@
* Gareth Hughes
*/
-#define __NO_VERSION__
#include "drmP.h"
struct vm_operations_struct DRM(vm_ops) = {
diff -Nru a/drivers/char/drm/gamma_dma.c b/drivers/char/drm/gamma_dma.c
--- a/drivers/char/drm/gamma_dma.c Tue Oct 29 14:29:20 2002
+++ b/drivers/char/drm/gamma_dma.c Thu Mar 13 16:52:15 2003
@@ -29,7 +29,6 @@
*
*/
-#define __NO_VERSION__
#include "gamma.h"
#include "drmP.h"
#include "drm.h"
diff -Nru a/drivers/char/drm/i810_dma.c b/drivers/char/drm/i810_dma.c
--- a/drivers/char/drm/i810_dma.c Sat Nov 16 17:33:53 2002
+++ b/drivers/char/drm/i810_dma.c Thu Mar 13 16:52:15 2003
@@ -30,7 +30,6 @@
*
*/
-#define __NO_VERSION__
#include "i810.h"
#include "drmP.h"
#include "drm.h"
diff -Nru a/drivers/char/drm/i830_dma.c b/drivers/char/drm/i830_dma.c
--- a/drivers/char/drm/i830_dma.c Thu Feb 6 07:33:47 2003
+++ b/drivers/char/drm/i830_dma.c Thu Mar 13 16:52:15 2003
@@ -31,7 +31,6 @@
*
*/
-#define __NO_VERSION__
#include "i830.h"
#include "drmP.h"
#include "drm.h"
@@ -40,12 +39,6 @@
#include /* For task queue support */
#include
-#ifdef DO_MUNMAP_4_ARGS
-#define DO_MUNMAP(m, a, l) do_munmap(m, a, l, 1)
-#else
-#define DO_MUNMAP(m, a, l) do_munmap(m, a, l)
-#endif
-
#define I830_BUF_FREE 2
#define I830_BUF_CLIENT 1
#define I830_BUF_HARDWARE 0
@@ -230,7 +223,7 @@
return -EINVAL;
down_write(¤t->mm->mmap_sem);
- retcode = DO_MUNMAP(current->mm,
+ retcode = do_munmap(current->mm,
(unsigned long)buf_priv->virtual,
(size_t) buf->total);
up_write(¤t->mm->mmap_sem);
diff -Nru a/drivers/char/drm/mga_warp.c b/drivers/char/drm/mga_warp.c
--- a/drivers/char/drm/mga_warp.c Tue Oct 29 14:29:21 2002
+++ b/drivers/char/drm/mga_warp.c Thu Mar 13 16:52:15 2003
@@ -27,7 +27,6 @@
* Gareth Hughes
*/
-#define __NO_VERSION__
#include "mga.h"
#include "drmP.h"
#include "drm.h"
diff -Nru a/drivers/char/drm/sis_ds.c b/drivers/char/drm/sis_ds.c
--- a/drivers/char/drm/sis_ds.c Tue Oct 29 14:29:24 2002
+++ b/drivers/char/drm/sis_ds.c Thu Mar 13 16:52:15 2003
@@ -28,7 +28,6 @@
*
*/
-#define __NO_VERSION__
#include
#include
#include
diff -Nru a/drivers/char/drm/sis_mm.c b/drivers/char/drm/sis_mm.c
--- a/drivers/char/drm/sis_mm.c Tue Oct 29 14:29:24 2002
+++ b/drivers/char/drm/sis_mm.c Thu Mar 13 16:52:15 2003
@@ -28,7 +28,6 @@
*
*/
-#define __NO_VERSION__
#include "sis.h"
#include
#include "drmP.h"
diff -Nru a/drivers/char/ftape/lowlevel/ftape_syms.c b/drivers/char/ftape/lowlevel/ftape_syms.c
--- a/drivers/char/ftape/lowlevel/ftape_syms.c Tue Feb 25 10:47:06 2003
+++ b/drivers/char/ftape/lowlevel/ftape_syms.c Thu Mar 13 16:52:15 2003
@@ -26,7 +26,6 @@
*/
#include
-#define __NO_VERSION__
#include
#include
diff -Nru a/drivers/char/ftape/zftape/zftape-ctl.c b/drivers/char/ftape/zftape/zftape-ctl.c
--- a/drivers/char/ftape/zftape/zftape-ctl.c Tue Feb 18 10:25:13 2003
+++ b/drivers/char/ftape/zftape/zftape-ctl.c Thu Mar 13 16:52:15 2003
@@ -27,7 +27,6 @@
#include
#include
#include
-#define __NO_VERSION__
#include
#include
diff -Nru a/drivers/char/ftape/zftape/zftape_syms.c b/drivers/char/ftape/zftape/zftape_syms.c
--- a/drivers/char/ftape/zftape/zftape_syms.c Wed Sep 11 01:38:06 2002
+++ b/drivers/char/ftape/zftape/zftape_syms.c Thu Mar 13 16:52:15 2003
@@ -24,7 +24,6 @@
* the ftape floppy tape driver exports
*/
-#define __NO_VERSION__
#include
#include
diff -Nru a/drivers/char/genrtc.c b/drivers/char/genrtc.c
--- a/drivers/char/genrtc.c Wed Feb 19 12:19:16 2003
+++ b/drivers/char/genrtc.c Sun Mar 2 08:34:59 2003
@@ -1,5 +1,8 @@
/*
- * Real Time Clock interface for q40 and other m68k machines
+ * Real Time Clock interface for
+ * - q40 and other m68k machines,
+ * - HP PARISC machines
+ * - PowerPC machines
* emulate some RTC irq capabilities in software
*
* Copyright (C) 1999 Richard Zidlicky
@@ -13,7 +16,7 @@
* pseudo-file for status information.
*
* The ioctls can be used to set the interrupt behaviour where
- * supported.
+ * supported.
*
* The /dev/rtc interface will block on reads until an interrupt
* has been received. If a RTC interrupt has already happened,
@@ -34,9 +37,10 @@
* 1.04 removed useless timer code rz@linux-m68k.org
* 1.05 portable RTC_UIE emulation rz@linux-m68k.org
* 1.06 set_rtc_time can return an error trini@kernel.crashing.org
+ * 1.07 ported to HP PARISC (hppa) Helge Deller
*/
-#define RTC_VERSION "1.06"
+#define RTC_VERSION "1.07"
#include
#include
@@ -63,20 +67,17 @@
static DECLARE_WAIT_QUEUE_HEAD(gen_rtc_wait);
-static int gen_rtc_ioctl(struct inode *inode, struct file *file,
- unsigned int cmd, unsigned long arg);
-
/*
* Bits in gen_rtc_status.
*/
#define RTC_IS_OPEN 0x01 /* means /dev/rtc is in use */
-unsigned char gen_rtc_status; /* bitmapped status byte. */
-unsigned long gen_rtc_irq_data; /* our output to the world */
+static unsigned char gen_rtc_status; /* bitmapped status byte. */
+static unsigned long gen_rtc_irq_data; /* our output to the world */
/* months start at 0 now */
-unsigned char days_in_mo[] =
+static unsigned char days_in_mo[] =
{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
static int irq_active;
@@ -89,18 +90,20 @@
static int lostint;
static int tt_exp;
-void gen_rtc_timer(unsigned long data);
+static void gen_rtc_timer(unsigned long data);
static volatile int stask_active; /* schedule_work */
static volatile int ttask_active; /* timer_task */
static int stop_rtc_timers; /* don't requeue tasks */
static spinlock_t gen_rtc_lock = SPIN_LOCK_UNLOCKED;
+static void gen_rtc_interrupt(unsigned long arg);
+
/*
* Routine to poll RTC seconds field for change as often as possible,
* after first RTC_UIE use timer to reduce polling
*/
-void genrtc_troutine(void *data)
+static void genrtc_troutine(void *data)
{
unsigned int tmp = get_rtc_ss();
@@ -124,7 +127,7 @@
stask_active = 0;
}
-void gen_rtc_timer(unsigned long data)
+static void gen_rtc_timer(unsigned long data)
{
lostint = get_rtc_ss() - oldsecs ;
if (lostint<0)
@@ -145,7 +148,7 @@
* from some routine that periodically (eg 100HZ) monitors
* whether RTC_SECS changed
*/
-void gen_rtc_interrupt(unsigned long arg)
+static void gen_rtc_interrupt(unsigned long arg)
{
/* We store the status in the low byte and the number of
* interrupts received since the last read in the remainder
@@ -175,7 +178,7 @@
unsigned long data;
ssize_t retval;
- if (count != sizeof (unsigned int) && count != sizeof (unsigned long))
+ if (count != sizeof (unsigned int) && count != sizeof (unsigned long))
return -EINVAL;
if (file->f_flags & O_NONBLOCK && !gen_rtc_irq_data)
@@ -385,24 +388,24 @@
*/
static struct file_operations gen_rtc_fops = {
- .owner = THIS_MODULE,
+ .owner = THIS_MODULE,
#ifdef CONFIG_GEN_RTC_X
- .read = gen_rtc_read,
- .poll = gen_rtc_poll,
+ .read = gen_rtc_read,
+ .poll = gen_rtc_poll,
#endif
- .ioctl = gen_rtc_ioctl,
- .open = gen_rtc_open,
- .release = gen_rtc_release
+ .ioctl = gen_rtc_ioctl,
+ .open = gen_rtc_open,
+ .release = gen_rtc_release,
};
static struct miscdevice rtc_gen_dev =
{
- RTC_MINOR,
- "rtc",
- &gen_rtc_fops
+ .minor = RTC_MINOR,
+ .name = "rtc",
+ .fops = &gen_rtc_fops,
};
-int __init rtc_generic_init(void)
+static int __init rtc_generic_init(void)
{
int retval;
@@ -436,16 +439,18 @@
* Info exported via "/proc/rtc".
*/
-int gen_rtc_proc_output(char *buf)
+#ifdef CONFIG_PROC_FS
+
+static int gen_rtc_proc_output(char *buf)
{
char *p;
struct rtc_time tm;
- unsigned tmp;
+ unsigned int flags;
struct rtc_pll_info pll;
p = buf;
- get_rtc_time(&tm);
+ flags = get_rtc_time(&tm);
p += sprintf(p,
"rtc_time\t: %02d:%02d:%02d\n"
@@ -454,7 +459,7 @@
tm.tm_hour, tm.tm_min, tm.tm_sec,
tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, 1900);
- tm.tm_hour=0;tm.tm_min=0;tm.tm_sec=0;
+ tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
p += sprintf(p, "alarm\t\t: ");
if (tm.tm_hour <= 24)
@@ -472,7 +477,6 @@
else
p += sprintf(p, "**\n");
- tmp= RTC_24H ;
p += sprintf(p,
"DST_enable\t: %s\n"
"BCD\t\t: %s\n"
@@ -483,15 +487,15 @@
"periodic_IRQ\t: %s\n"
"periodic_freq\t: %ld\n"
"batt_status\t: %s\n",
- (tmp & RTC_DST_EN) ? "yes" : "no",
- (tmp & RTC_DM_BINARY) ? "no" : "yes",
- (tmp & RTC_24H) ? "yes" : "no",
- (tmp & RTC_SQWE) ? "yes" : "no",
- (tmp & RTC_AIE) ? "yes" : "no",
+ (flags & RTC_DST_EN) ? "yes" : "no",
+ (flags & RTC_DM_BINARY) ? "no" : "yes",
+ (flags & RTC_24H) ? "yes" : "no",
+ (flags & RTC_SQWE) ? "yes" : "no",
+ (flags & RTC_AIE) ? "yes" : "no",
irq_active ? "yes" : "no",
- (tmp & RTC_PIE) ? "yes" : "no",
+ (flags & RTC_PIE) ? "yes" : "no",
0L /* freq */,
- "okay" );
+ (flags & RTC_BATT_BAD) ? "bad" : "okay");
if (!get_rtc_pll(&pll))
p += sprintf(p,
"PLL adjustment\t: %d\n"
@@ -506,7 +510,7 @@
pll.pll_posmult,
pll.pll_negmult,
pll.pll_clock);
- return p - buf;
+ return p - buf;
}
static int gen_rtc_read_proc(char *page, char **start, off_t off,
@@ -521,6 +525,9 @@
return len;
}
+#endif /* CONFIG_PROC_FS */
+
MODULE_AUTHOR("Richard Zidlicky");
MODULE_LICENSE("GPL");
+
diff -Nru a/drivers/char/ipmi/ipmi_devintf.c b/drivers/char/ipmi/ipmi_devintf.c
--- a/drivers/char/ipmi/ipmi_devintf.c Tue Nov 26 14:06:25 2002
+++ b/drivers/char/ipmi/ipmi_devintf.c Thu Mar 6 15:14:51 2003
@@ -105,7 +105,7 @@
static struct ipmi_user_hndl ipmi_hndlrs =
{
- ipmi_recv_hndl : file_receive_handler
+ .ipmi_recv_hndl = file_receive_handler,
};
static int ipmi_open(struct inode *inode, struct file *file)
@@ -424,12 +424,12 @@
static struct file_operations ipmi_fops = {
- owner: THIS_MODULE,
- ioctl: ipmi_ioctl,
- open: ipmi_open,
- release: ipmi_release,
- fasync: ipmi_fasync,
- poll: ipmi_poll
+ .owner = THIS_MODULE,
+ .ioctl = ipmi_ioctl,
+ .open = ipmi_open,
+ .release = ipmi_release,
+ .fasync = ipmi_fasync,
+ .poll = ipmi_poll,
};
#define DEVICE_NAME "ipmidev"
@@ -468,8 +468,8 @@
static struct ipmi_smi_watcher smi_watcher =
{
- new_smi : ipmi_new_smi,
- smi_gone : ipmi_smi_gone
+ .new_smi = ipmi_new_smi,
+ .smi_gone = ipmi_smi_gone,
};
static __init int init_ipmi_devintf(void)
diff -Nru a/drivers/char/ite_gpio.c b/drivers/char/ite_gpio.c
--- a/drivers/char/ite_gpio.c Tue Nov 5 07:39:55 2002
+++ b/drivers/char/ite_gpio.c Thu Mar 6 14:03:51 2003
@@ -140,7 +140,7 @@
{
int ret=-1;
- if (MAX_GPIO_LINE > *data >= 0)
+ if ((MAX_GPIO_LINE > *data) && (*data >= 0))
ret=ite_gpio_irq_pending[*data];
DEB(printk("ite_gpio_in_status %d ret=%d\n",*data, ret));
diff -Nru a/drivers/char/lp_old98.c b/drivers/char/lp_old98.c
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/drivers/char/lp_old98.c Thu Mar 13 17:23:19 2003
@@ -0,0 +1,544 @@
+/*
+ * linux/drivers/char/lp_old98.c
+ *
+ * printer port driver for ancient PC-9800s with no bidirectional port support
+ *
+ * Copyright (C) 1998,99 Kousuke Takai ,
+ * Kyoto University Microcomputer Club
+ *
+ * This driver is based on and has compatibility with `lp.c',
+ * generic PC printer port driver.
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+
+#include
+
+/*
+ * I/O port numbers
+ */
+#define LP_PORT_DATA 0x40
+#define LP_PORT_STATUS (LP_PORT_DATA + 2)
+#define LP_PORT_STROBE (LP_PORT_DATA + 4)
+#define LP_PORT_CONTROL (LP_PORT_DATA + 6)
+
+#define LP_PORT_H98MODE 0x0448
+#define LP_PORT_EXTMODE 0x0149
+
+/*
+ * bit mask for I/O
+ */
+#define LP_MASK_nBUSY (1 << 2)
+#define LP_MASK_nSTROBE (1 << 7)
+
+#define LP_CONTROL_ASSERT_STROBE (0x0e)
+#define LP_CONTROL_NEGATE_STROBE (0x0f)
+
+/*
+ * Acceptable maximum value for non-privileged user for LPCHARS ioctl.
+ */
+#define LP_CHARS_NOPRIV_MAX 65535
+
+#define DC1 '\x11'
+#define DC3 '\x13'
+
+/* PC-9800s have at least and at most one old-style printer port. */
+static struct lp_struct lp = {
+ .flags = LP_EXIST | LP_ABORTOPEN,
+ .chars = LP_INIT_CHAR,
+ .time = LP_INIT_TIME,
+ .wait = LP_INIT_WAIT,
+};
+
+static int dc1_check;
+static spinlock_t lp_old98_lock = SPIN_LOCK_UNLOCKED;
+
+
+#undef LP_OLD98_DEBUG
+
+#ifdef CONFIG_PC9800_OLDLP_CONSOLE
+static struct console lp_old98_console; /* defined later */
+static short saved_console_flags;
+#endif
+
+static DECLARE_WAIT_QUEUE_HEAD (lp_old98_waitq);
+
+static void lp_old98_timer_function(unsigned long data)
+{
+ if (inb(LP_PORT_STATUS) & LP_MASK_nBUSY)
+ wake_up_interruptible(&lp_old98_waitq);
+ else {
+ struct timer_list *t = (struct timer_list *) data;
+
+ t->expires = jiffies + 1;
+ add_timer(t);
+ }
+}
+
+static inline int lp_old98_wait_ready(void)
+{
+ struct timer_list timer;
+
+ init_timer(&timer);
+ timer.function = lp_old98_timer_function;
+ timer.expires = jiffies + 1;
+ timer.data = (unsigned long)&timer;
+ add_timer(&timer);
+ interruptible_sleep_on(&lp_old98_waitq);
+ del_timer(&timer);
+ return signal_pending(current);
+}
+
+static inline int lp_old98_char(char lpchar)
+{
+ unsigned long count = 0;
+#ifdef LP_STATS
+ int tmp;
+#endif
+
+ while (!(inb(LP_PORT_STATUS) & LP_MASK_nBUSY)) {
+ count++;
+ if (count >= lp.chars)
+ return 0;
+ }
+
+ outb(lpchar, LP_PORT_DATA);
+
+#ifdef LP_STATS
+ /*
+ * Update lp statsistics here (and between next two outb()'s).
+ * Time to compute it is part of storobe delay.
+ */
+ if (count > lp.stats.maxwait) {
+#ifdef LP_OLD98_DEBUG
+ printk(KERN_DEBUG "lp_old98: success after %d counts.\n",
+ count);
+#endif
+ lp.stats.maxwait = count;
+ }
+ count *= 256;
+ tmp = count - lp.stats.meanwait;
+ if (tmp < 0)
+ tmp = -tmp;
+#endif
+ ndelay(lp.wait);
+
+ /* negate PSTB# (activate strobe) */
+ outb(LP_CONTROL_ASSERT_STROBE, LP_PORT_CONTROL);
+
+#ifdef LP_STATS
+ lp.stats.meanwait = (255 * lp.stats.meanwait + count + 128) / 256;
+ lp.stats.mdev = (127 * lp.stats.mdev + tmp + 64) / 128;
+ lp.stats.chars ++;
+#endif
+
+ ndelay(lp.wait);
+
+ /* assert PSTB# (deactivate strobe) */
+ outb(LP_CONTROL_NEGATE_STROBE, LP_PORT_CONTROL);
+
+ return 1;
+}
+
+static ssize_t lp_old98_write(struct file * file,
+ const char * buf, size_t count,
+ loff_t *dummy)
+{
+ unsigned long total_bytes_written = 0;
+
+ if (!access_ok(VERIFY_READ, buf, count))
+ return -EFAULT;
+
+#ifdef LP_STATS
+ if (jiffies - lp.lastcall > lp.time)
+ lp.runchars = 0;
+ lp.lastcall = jiffies;
+#endif
+
+ do {
+ unsigned long bytes_written = 0;
+ unsigned long copy_size
+ = (count < LP_BUFFER_SIZE ? count : LP_BUFFER_SIZE);
+
+ if (__copy_from_user(lp.lp_buffer, buf, copy_size))
+ return -EFAULT;
+
+ while (bytes_written < copy_size) {
+ if (lp_old98_char(lp.lp_buffer[bytes_written]))
+ bytes_written ++;
+ else {
+#ifdef LP_STATS
+ int rc = lp.runchars + bytes_written;
+
+ if (rc > lp.stats.maxrun)
+ lp.stats.maxrun = rc;
+
+ lp.stats.sleeps ++;
+#endif
+#ifdef LP_OLD98_DEBUG
+ printk(KERN_DEBUG
+ "lp_old98: sleeping at %d characters"
+ " for %d jiffies\n",
+ lp.runchars, lp.time);
+ lp.runchars = 0;
+#endif
+ if (lp_old98_wait_ready())
+ return ((total_bytes_written
+ + bytes_written)
+ ? : -EINTR);
+ }
+ }
+ total_bytes_written += bytes_written;
+ buf += bytes_written;
+#ifdef LP_STATS
+ lp.runchars += bytes_written;
+#endif
+ count -= bytes_written;
+ } while (count > 0);
+
+ return total_bytes_written;
+}
+
+static int lp_old98_open(struct inode * inode, struct file * file)
+{
+ if (minor(inode->i_rdev) != 0)
+ return -ENXIO;
+
+ if (lp.flags & LP_BUSY)
+ return -EBUSY;
+
+ if (dc1_check && (lp.flags & LP_ABORTOPEN)
+ && !(file->f_flags & O_NONBLOCK)) {
+ /*
+ * Check whether printer is on-line.
+ * PC-9800's old style port have only BUSY# as status input,
+ * so that it is impossible to distinguish that the printer is
+ * ready and that the printer is off-line or not connected
+ * (in both case BUSY# is in the same state). So:
+ *
+ * (1) output DC1 (0x11) to printer port and do strobe.
+ * (2) watch BUSY# line for a while. If BUSY# is pulled
+ * down, the printer will be ready. Otherwise,
+ * it will be off-line (or not connected, or power-off,
+ * ...).
+ *
+ * The source of this procedure:
+ * Terumasa KODAKA, Kazufumi SHIMIZU, Yu HAYAMI:
+ * `PC-9801 Super Technique', Ascii, 1992.
+ */
+ int count;
+ unsigned long flags;
+
+ /* interrupts while check is fairly bad */
+ spin_lock_irqsave(&lp_old98_lock, flags);
+
+ if (!lp_old98_char(DC1)) {
+ spin_unlock_irqrestore(&lp_old98_lock, flags);
+ return -EBUSY;
+ }
+ count = (unsigned int)dc1_check > 10000 ? 10000 : dc1_check;
+ while (inb(LP_PORT_STATUS) & LP_MASK_nBUSY) {
+ if (--count == 0) {
+ spin_unlock_irqrestore(&lp_old98_lock, flags);
+ return -ENODEV;
+ }
+ }
+ spin_unlock_irqrestore(&lp_old98_lock, flags);
+ }
+
+ if ((lp.lp_buffer = kmalloc(LP_BUFFER_SIZE, GFP_KERNEL)) == NULL)
+ return -ENOMEM;
+
+ lp.flags |= LP_BUSY;
+
+#ifdef CONFIG_PC9800_OLDLP_CONSOLE
+ saved_console_flags = lp_old98_console.flags;
+ lp_old98_console.flags &= ~CON_ENABLED;
+#endif
+ return 0;
+}
+
+static int lp_old98_release(struct inode * inode, struct file * file)
+{
+ kfree(lp.lp_buffer);
+ lp.lp_buffer = NULL;
+ lp.flags &= ~LP_BUSY;
+#ifdef CONFIG_PC9800_OLDLP_CONSOLE
+ lp_old98_console.flags = saved_console_flags;
+#endif
+ return 0;
+}
+
+static int lp_old98_init_device(void)
+{
+ unsigned char data;
+
+ if ((data = inb(LP_PORT_EXTMODE)) != 0xFF && (data & 0x10)) {
+ printk(KERN_INFO
+ "lp_old98: shutting down extended parallel port mode...\n");
+ outb(data & ~0x10, LP_PORT_EXTMODE);
+ }
+#ifdef PC98_HW_H98
+ if ((pc98_hw_flags & PC98_HW_H98)
+ && ((data = inb(LP_PORT_H98MODE)) & 0x01)) {
+ printk(KERN_INFO
+ "lp_old98: shutting down H98 full centronics mode...\n");
+ outb(data & ~0x01, LP_PORT_H98MODE);
+ }
+#endif
+ return 0;
+}
+
+static int lp_old98_ioctl(struct inode *inode, struct file *file,
+ unsigned int command, unsigned long arg)
+{
+ int retval = 0;
+
+ switch (command) {
+ case LPTIME:
+ lp.time = arg * HZ/100;
+ break;
+ case LPCHAR:
+ lp.chars = arg;
+ break;
+ case LPABORT:
+ if (arg)
+ lp.flags |= LP_ABORT;
+ else
+ lp.flags &= ~LP_ABORT;
+ break;
+ case LPABORTOPEN:
+ if (arg)
+ lp.flags |= LP_ABORTOPEN;
+ else
+ lp.flags &= ~LP_ABORTOPEN;
+ break;
+ case LPCAREFUL:
+ /* do nothing */
+ break;
+ case LPWAIT:
+ lp.wait = arg;
+ break;
+ case LPGETIRQ:
+ retval = put_user(0, (int *)arg);
+ break;
+ case LPGETSTATUS:
+ /*
+ * convert PC-9800's status to IBM PC's one, so that tunelp(8)
+ * works in the same way on this driver.
+ */
+ retval = put_user((inb(LP_PORT_STATUS) & LP_MASK_nBUSY)
+ ? (LP_PBUSY | LP_PERRORP) : LP_PERRORP,
+ (int *)arg);
+ break;
+ case LPRESET:
+ retval = lp_old98_init_device();
+ break;
+#ifdef LP_STATS
+ case LPGETSTATS:
+ if (copy_to_user((struct lp_stats *)arg, &lp.stats,
+ sizeof(struct lp_stats)))
+ retval = -EFAULT;
+ else if (suser())
+ memset(&lp.stats, 0, sizeof(struct lp_stats));
+ break;
+#endif
+ case LPGETFLAGS:
+ retval = put_user(lp.flags, (int *)arg);
+ break;
+ case LPSETIRQ:
+ default:
+ retval = -EINVAL;
+ }
+ return retval;
+}
+
+static struct file_operations lp_old98_fops = {
+ .owner = THIS_MODULE,
+ .write = lp_old98_write,
+ .ioctl = lp_old98_ioctl,
+ .open = lp_old98_open,
+ .release = lp_old98_release,
+};
+
+/*
+ * Support for console on lp_old98
+ */
+#ifdef CONFIG_PC9800_OLDLP_CONSOLE
+
+static inline void io_delay(void)
+{
+ unsigned char dummy; /* actually not output */
+
+ asm volatile ("out%B0 %0,%1" : "=a"(dummy) : "N"(0x5f));
+}
+
+static void lp_old98_console_write(struct console *console,
+ const char *s, unsigned int count)
+{
+ int i;
+ static unsigned int timeout_run = 0;
+
+ while (count) {
+ /* wait approx 1.2 seconds */
+ for (i = 2000000; !(inb(LP_PORT_STATUS) & LP_MASK_nBUSY);
+ io_delay())
+ if (!--i) {
+ if (++timeout_run >= 10)
+ /* disable forever... */
+ console->flags &= ~CON_ENABLED;
+ return;
+ }
+
+ timeout_run = 0;
+
+ if (*s == '\n') {
+ outb('\r', LP_PORT_DATA);
+ io_delay();
+ io_delay();
+ outb(LP_CONTROL_ASSERT_STROBE, LP_PORT_CONTROL);
+ io_delay();
+ io_delay();
+ outb(LP_CONTROL_NEGATE_STROBE, LP_PORT_CONTROL);
+ io_delay();
+ io_delay();
+ for (i = 1000000;
+ !(inb(LP_PORT_STATUS) & LP_MASK_nBUSY);
+ io_delay())
+ if (!--i)
+ return;
+ }
+
+ outb(*s++, LP_PORT_DATA);
+ io_delay();
+ io_delay();
+ outb(LP_CONTROL_ASSERT_STROBE, LP_PORT_CONTROL);
+ io_delay();
+ io_delay();
+ outb(LP_CONTROL_NEGATE_STROBE, LP_PORT_CONTROL);
+ io_delay();
+ io_delay();
+
+ --count;
+ }
+}
+
+static kdev_t lp_old98_console_device(struct console *console)
+{
+ return mk_kdev(LP_MAJOR, 0);
+}
+
+static struct console lp_old98_console = {
+ .name = "lp_old98",
+ .write = lp_old98_console_write,
+ .device = lp_old98_console_device,
+ .flags = CON_PRINTBUFFER,
+ .index = -1,
+};
+
+#endif /* console on lp_old98 */
+
+static int __init lp_old98_init(void)
+{
+ char *errmsg = "I/O ports already occupied, giving up.";
+
+#ifdef PC98_HW_H98
+ if (pc98_hw_flags & PC98_HW_H98)
+ if (!request_region(LP_PORT_H98MODE, 1, "lp_old98")
+ goto err1;
+#endif
+ if (!request_region(LP_PORT_DATA, 1, "lp_old98"))
+ goto err2;
+ if (!request_region(LP_PORT_STATUS, 1, "lp_old98"))
+ goto err3;
+ if (!request_region(LP_PORT_STROBE, 1, "lp_old98"))
+ goto err4;
+ if (!request_region(LP_PORT_EXTMODE, 1, "lp_old98"))
+ goto err5;
+ if (!register_chrdev(LP_MAJOR, "lp", &lp_old98_fops)) {
+#ifdef CONFIG_PC9800_OLDLP_CONSOLE
+ register_console(&lp_old98_console);
+ printk(KERN_INFO "lp_old98: console ready\n");
+#endif
+ /*
+ * rest are not needed by this driver,
+ * but for locking out other printer drivers...
+ */
+ lp_old98_init_device();
+ return 0;
+ } else
+ errmsg = "unable to register device";
+
+ release_region(LP_PORT_EXTMODE, 1);
+err5:
+ release_region(LP_PORT_STROBE, 1);
+err4:
+ release_region(LP_PORT_STATUS, 1);
+err3:
+ release_region(LP_PORT_DATA, 1);
+err2:
+#ifdef PC98_HW_H98
+ if (pc98_hw_flags & PC98_HW_H98)
+ release_region(LP_PORT_H98MODE, 1);
+
+err1:
+#endif
+ printk(KERN_ERR "lp_old98: %s\n", errmsg);
+ return -EBUSY;
+}
+
+static void __exit lp_old98_exit(void)
+{
+#ifdef CONFIG_PC9800_OLDLP_CONSOLE
+ unregister_console(&lp_old98_console);
+#endif
+ unregister_chrdev(LP_MAJOR, "lp");
+
+ release_region(LP_PORT_DATA, 1);
+ release_region(LP_PORT_STATUS, 1);
+ release_region(LP_PORT_STROBE, 1);
+#ifdef PC98_HW_H98
+ if (pc98_hw_flags & PC98_HW_H98)
+ release_region(LP_PORT_H98MODE, 1);
+#endif
+ release_region(LP_PORT_EXTMODE, 1);
+}
+
+#ifndef MODULE
+static int __init lp_old98_setup(char *str)
+{
+ int ints[4];
+
+ str = get_options(str, ARRAY_SIZE(ints), ints);
+ if (ints[0] > 0)
+ dc1_check = ints[1];
+ return 1;
+}
+__setup("lp_old98_dc1_check=", lp_old98_setup);
+#endif
+
+MODULE_PARM(dc1_check, "i");
+MODULE_AUTHOR("Kousuke Takai ");
+MODULE_DESCRIPTION("PC-9800 old printer port driver");
+MODULE_LICENSE("GPL");
+
+module_init(lp_old98_init);
+module_exit(lp_old98_exit);
diff -Nru a/drivers/char/mwave/mwavedd.c b/drivers/char/mwave/mwavedd.c
--- a/drivers/char/mwave/mwavedd.c Tue Dec 10 11:51:11 2002
+++ b/drivers/char/mwave/mwavedd.c Fri Mar 7 06:30:52 2003
@@ -53,46 +53,20 @@
#include
#include
#include
-#include
+#include
#include
#include
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
#include
-#else
-#include
-#endif
#include
#include "smapi.h"
#include "mwavedd.h"
#include "3780i.h"
#include "tp3780i.h"
-#ifndef __exit
-#define __exit
-#endif
-
MODULE_DESCRIPTION("3780i Advanced Communications Processor (Mwave) driver");
MODULE_AUTHOR("Mike Sullivan and Paul Schroeder");
MODULE_LICENSE("GPL");
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
-static int mwave_get_info(char *buf, char **start, off_t offset, int len);
-#else
-static int mwave_read_proc(char *buf, char **start, off_t offset, int xlen, int unused);
-static struct proc_dir_entry mwave_proc = {
- 0, /* unsigned short low_ino */
- 5, /* unsigned short namelen */
- "mwave", /* const char *name */
- S_IFREG | S_IRUGO, /* mode_t mode */
- 1, /* nlink_t nlink */
- 0, /* uid_t uid */
- 0, /* gid_t gid */
- 0, /* unsigned long size */
- NULL, /* struct inode_operations *ops */
- &mwave_read_proc /* int (*get_info) (...) */
-};
-#endif
-
/*
* These parameters support the setting of MWave resources. Note that no
* checks are made against other devices (ie. superio) for conflicts.
@@ -157,19 +131,23 @@
case IOCTL_MW_RESET:
PRINTK_1(TRACE_MWAVE,
- "mwavedd::mwave_ioctl, IOCTL_MW_RESET calling tp3780I_ResetDSP\n");
+ "mwavedd::mwave_ioctl, IOCTL_MW_RESET"
+ " calling tp3780I_ResetDSP\n");
retval = tp3780I_ResetDSP(&pDrvData->rBDData);
PRINTK_2(TRACE_MWAVE,
- "mwavedd::mwave_ioctl, IOCTL_MW_RESET retval %x from tp3780I_ResetDSP\n",
+ "mwavedd::mwave_ioctl, IOCTL_MW_RESET"
+ " retval %x from tp3780I_ResetDSP\n",
retval);
break;
case IOCTL_MW_RUN:
PRINTK_1(TRACE_MWAVE,
- "mwavedd::mwave_ioctl, IOCTL_MW_RUN calling tp3780I_StartDSP\n");
+ "mwavedd::mwave_ioctl, IOCTL_MW_RUN"
+ " calling tp3780I_StartDSP\n");
retval = tp3780I_StartDSP(&pDrvData->rBDData);
PRINTK_2(TRACE_MWAVE,
- "mwavedd::mwave_ioctl, IOCTL_MW_RUN retval %x from tp3780I_StartDSP\n",
+ "mwavedd::mwave_ioctl, IOCTL_MW_RUN"
+ " retval %x from tp3780I_StartDSP\n",
retval);
break;
@@ -177,17 +155,24 @@
MW_ABILITIES rAbilities;
PRINTK_1(TRACE_MWAVE,
- "mwavedd::mwave_ioctl, IOCTL_MW_DSP_ABILITIES calling tp3780I_QueryAbilities\n");
- retval = tp3780I_QueryAbilities(&pDrvData->rBDData, &rAbilities);
+ "mwavedd::mwave_ioctl,"
+ " IOCTL_MW_DSP_ABILITIES calling"
+ " tp3780I_QueryAbilities\n");
+ retval = tp3780I_QueryAbilities(&pDrvData->rBDData,
+ &rAbilities);
PRINTK_2(TRACE_MWAVE,
- "mwavedd::mwave_ioctl, IOCTL_MW_DSP_ABILITIES retval %x from tp3780I_QueryAbilities\n",
+ "mwavedd::mwave_ioctl, IOCTL_MW_DSP_ABILITIES"
+ " retval %x from tp3780I_QueryAbilities\n",
retval);
if (retval == 0) {
- if( copy_to_user((char *) ioarg, (char *) &rAbilities, sizeof(MW_ABILITIES)) )
+ if( copy_to_user((char *) ioarg,
+ (char *) &rAbilities,
+ sizeof(MW_ABILITIES)) )
return -EFAULT;
}
PRINTK_2(TRACE_MWAVE,
- "mwavedd::mwave_ioctl, IOCTL_MW_DSP_ABILITIES exit retval %x\n",
+ "mwavedd::mwave_ioctl, IOCTL_MW_DSP_ABILITIES"
+ " exit retval %x\n",
retval);
}
break;
@@ -197,15 +182,21 @@
MW_READWRITE rReadData;
unsigned short *pusBuffer = 0;
- if( copy_from_user((char *) &rReadData, (char *) ioarg, sizeof(MW_READWRITE)) )
+ if( copy_from_user((char *) &rReadData,
+ (char *) ioarg,
+ sizeof(MW_READWRITE)) )
return -EFAULT;
pusBuffer = (unsigned short *) (rReadData.pBuf);
PRINTK_4(TRACE_MWAVE,
- "mwavedd::mwave_ioctl IOCTL_MW_READ_DATA, size %lx, ioarg %lx pusBuffer %p\n",
+ "mwavedd::mwave_ioctl IOCTL_MW_READ_DATA,"
+ " size %lx, ioarg %lx pusBuffer %p\n",
rReadData.ulDataLength, ioarg, pusBuffer);
- retval = tp3780I_ReadWriteDspDStore(&pDrvData->rBDData, iocmd,
- (void *) pusBuffer, rReadData.ulDataLength, rReadData.usDspAddress);
+ retval = tp3780I_ReadWriteDspDStore(&pDrvData->rBDData,
+ iocmd,
+ (void *) pusBuffer,
+ rReadData.ulDataLength,
+ rReadData.usDspAddress);
}
break;
@@ -213,12 +204,14 @@
MW_READWRITE rReadData;
unsigned short *pusBuffer = 0;
- if( copy_from_user((char *) &rReadData, (char *) ioarg, sizeof(MW_READWRITE)) )
+ if( copy_from_user((char *) &rReadData, (char *) ioarg,
+ sizeof(MW_READWRITE)) )
return -EFAULT;
pusBuffer = (unsigned short *) (rReadData.pBuf);
PRINTK_4(TRACE_MWAVE,
- "mwavedd::mwave_ioctl IOCTL_MW_READ_INST, size %lx, ioarg %lx pusBuffer %p\n",
+ "mwavedd::mwave_ioctl IOCTL_MW_READ_INST,"
+ " size %lx, ioarg %lx pusBuffer %p\n",
rReadData.ulDataLength / 2, ioarg,
pusBuffer);
retval = tp3780I_ReadWriteDspDStore(&pDrvData->rBDData,
@@ -232,16 +225,21 @@
MW_READWRITE rWriteData;
unsigned short *pusBuffer = 0;
- if( copy_from_user((char *) &rWriteData, (char *) ioarg, sizeof(MW_READWRITE)) )
+ if( copy_from_user((char *) &rWriteData,
+ (char *) ioarg,
+ sizeof(MW_READWRITE)) )
return -EFAULT;
pusBuffer = (unsigned short *) (rWriteData.pBuf);
PRINTK_4(TRACE_MWAVE,
- "mwavedd::mwave_ioctl IOCTL_MW_WRITE_DATA, size %lx, ioarg %lx pusBuffer %p\n",
+ "mwavedd::mwave_ioctl IOCTL_MW_WRITE_DATA,"
+ " size %lx, ioarg %lx pusBuffer %p\n",
rWriteData.ulDataLength, ioarg,
pusBuffer);
- retval = tp3780I_ReadWriteDspDStore(&pDrvData->rBDData, iocmd,
- pusBuffer, rWriteData.ulDataLength, rWriteData.usDspAddress);
+ retval = tp3780I_ReadWriteDspDStore(&pDrvData->rBDData,
+ iocmd, pusBuffer,
+ rWriteData.ulDataLength,
+ rWriteData.usDspAddress);
}
break;
@@ -249,16 +247,21 @@
MW_READWRITE rWriteData;
unsigned short *pusBuffer = 0;
- if( copy_from_user((char *) &rWriteData, (char *) ioarg, sizeof(MW_READWRITE)) )
+ if( copy_from_user((char *) &rWriteData,
+ (char *) ioarg,
+ sizeof(MW_READWRITE)) )
return -EFAULT;
pusBuffer = (unsigned short *) (rWriteData.pBuf);
PRINTK_4(TRACE_MWAVE,
- "mwavedd::mwave_ioctl IOCTL_MW_WRITE_INST, size %lx, ioarg %lx pusBuffer %p\n",
+ "mwavedd::mwave_ioctl IOCTL_MW_WRITE_INST,"
+ " size %lx, ioarg %lx pusBuffer %p\n",
rWriteData.ulDataLength, ioarg,
pusBuffer);
- retval = tp3780I_ReadWriteDspIStore(&pDrvData->rBDData, iocmd,
- pusBuffer, rWriteData.ulDataLength, rWriteData.usDspAddress);
+ retval = tp3780I_ReadWriteDspIStore(&pDrvData->rBDData,
+ iocmd, pusBuffer,
+ rWriteData.ulDataLength,
+ rWriteData.usDspAddress);
}
break;
@@ -266,23 +269,25 @@
unsigned int ipcnum = (unsigned int) ioarg;
PRINTK_3(TRACE_MWAVE,
- "mwavedd::mwave_ioctl IOCTL_MW_REGISTER_IPC ipcnum %x entry usIntCount %x\n",
+ "mwavedd::mwave_ioctl IOCTL_MW_REGISTER_IPC"
+ " ipcnum %x entry usIntCount %x\n",
ipcnum,
pDrvData->IPCs[ipcnum].usIntCount);
- if (ipcnum > 16) {
- PRINTK_ERROR(KERN_ERR_MWAVE "mwavedd::mwave_ioctl: IOCTL_MW_REGISTER_IPC: Error: Invalid ipcnum %x\n", ipcnum);
+ if (ipcnum > ARRAY_SIZE(pDrvData->IPCs)) {
+ PRINTK_ERROR(KERN_ERR_MWAVE
+ "mwavedd::mwave_ioctl:"
+ " IOCTL_MW_REGISTER_IPC:"
+ " Error: Invalid ipcnum %x\n",
+ ipcnum);
return -EINVAL;
}
pDrvData->IPCs[ipcnum].bIsHere = FALSE;
pDrvData->IPCs[ipcnum].bIsEnabled = TRUE;
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
- #else
- current->priority = 0x28; /* boost to provide priority timing */
- #endif
PRINTK_2(TRACE_MWAVE,
- "mwavedd::mwave_ioctl IOCTL_MW_REGISTER_IPC ipcnum %x exit\n",
+ "mwavedd::mwave_ioctl IOCTL_MW_REGISTER_IPC"
+ " ipcnum %x exit\n",
ipcnum);
}
break;
@@ -293,17 +298,22 @@
unsigned long flags;
PRINTK_3(TRACE_MWAVE,
- "mwavedd::mwave_ioctl IOCTL_MW_GET_IPC ipcnum %x, usIntCount %x\n",
+ "mwavedd::mwave_ioctl IOCTL_MW_GET_IPC"
+ " ipcnum %x, usIntCount %x\n",
ipcnum,
pDrvData->IPCs[ipcnum].usIntCount);
- if (ipcnum > 16) {
- PRINTK_ERROR(KERN_ERR_MWAVE "mwavedd::mwave_ioctl: IOCTL_MW_GET_IPC: Error: Invalid ipcnum %x\n", ipcnum);
+ if (ipcnum > ARRAY_SIZE(pDrvData->IPCs)) {
+ PRINTK_ERROR(KERN_ERR_MWAVE
+ "mwavedd::mwave_ioctl:"
+ " IOCTL_MW_GET_IPC: Error:"
+ " Invalid ipcnum %x\n", ipcnum);
return -EINVAL;
}
if (pDrvData->IPCs[ipcnum].bIsEnabled == TRUE) {
PRINTK_2(TRACE_MWAVE,
- "mwavedd::mwave_ioctl, thread for ipc %x going to sleep\n",
+ "mwavedd::mwave_ioctl, thread for"
+ " ipc %x going to sleep\n",
ipcnum);
spin_lock_irqsave(&ipc_lock, flags);
@@ -313,10 +323,13 @@
pDrvData->IPCs[ipcnum].usIntCount = 2; /* first int has been handled */
spin_unlock_irqrestore(&ipc_lock, flags);
PRINTK_2(TRACE_MWAVE,
- "mwavedd::mwave_ioctl IOCTL_MW_GET_IPC ipcnum %x handling first int\n",
+ "mwavedd::mwave_ioctl"
+ " IOCTL_MW_GET_IPC ipcnum %x"
+ " handling first int\n",
ipcnum);
} else { /* either 1st int has not yet occurred, or we have already handled the first int */
pDrvData->IPCs[ipcnum].bIsHere = TRUE;
+#warning "Sleeping on spinlock"
interruptible_sleep_on(&pDrvData->IPCs[ipcnum].ipc_wait_queue);
pDrvData->IPCs[ipcnum].bIsHere = FALSE;
if (pDrvData->IPCs[ipcnum].usIntCount == 1) {
@@ -325,11 +338,16 @@
}
spin_unlock_irqrestore(&ipc_lock, flags);
PRINTK_2(TRACE_MWAVE,
- "mwavedd::mwave_ioctl IOCTL_MW_GET_IPC ipcnum %x woke up and returning to application\n",
+ "mwavedd::mwave_ioctl"
+ " IOCTL_MW_GET_IPC ipcnum %x"
+ " woke up and returning to"
+ " application\n",
ipcnum);
}
PRINTK_2(TRACE_MWAVE,
- "mwavedd::mwave_ioctl IOCTL_MW_GET_IPC, returning thread for ipc %x processing\n",
+ "mwavedd::mwave_ioctl IOCTL_MW_GET_IPC,"
+ " returning thread for ipc %x"
+ " processing\n",
ipcnum);
}
}
@@ -339,10 +357,15 @@
unsigned int ipcnum = (unsigned int) ioarg;
PRINTK_2(TRACE_MWAVE,
- "mwavedd::mwave_ioctl IOCTL_MW_UNREGISTER_IPC ipcnum %x\n",
+ "mwavedd::mwave_ioctl IOCTL_MW_UNREGISTER_IPC"
+ " ipcnum %x\n",
ipcnum);
- if (ipcnum > 16) {
- PRINTK_ERROR(KERN_ERR_MWAVE "mwavedd::mwave_ioctl: IOCTL_MW_UNREGISTER_IPC: Error: Invalid ipcnum %x\n", ipcnum);
+ if (ipcnum > ARRAY_SIZE(pDrvData->IPCs)) {
+ PRINTK_ERROR(KERN_ERR_MWAVE
+ "mwavedd::mwave_ioctl:"
+ " IOCTL_MW_UNREGISTER_IPC:"
+ " Error: Invalid ipcnum %x\n",
+ ipcnum);
return -EINVAL;
}
if (pDrvData->IPCs[ipcnum].bIsEnabled == TRUE) {
@@ -355,7 +378,9 @@
break;
default:
- PRINTK_ERROR(KERN_ERR_MWAVE "mwavedd::mwave_ioctl: Error: Unrecognized iocmd %x\n", iocmd);
+ PRINTK_ERROR(KERN_ERR_MWAVE "mwavedd::mwave_ioctl:"
+ " Error: Unrecognized iocmd %x\n",
+ iocmd);
return -ENOTTY;
break;
} /* switch */
@@ -381,7 +406,8 @@
size_t count, loff_t * ppos)
{
PRINTK_5(TRACE_MWAVE,
- "mwavedd::mwave_write entry file %p, buf %p, count %x ppos %p\n",
+ "mwavedd::mwave_write entry file %p, buf %p,"
+ " count %x ppos %p\n",
file, buf, count, ppos);
return -EINVAL;
@@ -400,7 +426,9 @@
/* OK */
break;
default:
- PRINTK_ERROR(KERN_ERR_MWAVE "mwavedd::register_serial_portandirq: Error: Illegal port %x\n", port );
+ PRINTK_ERROR(KERN_ERR_MWAVE
+ "mwavedd::register_serial_portandirq:"
+ " Error: Illegal port %x\n", port );
return -1;
} /* switch */
/* port is okay */
@@ -413,7 +441,9 @@
/* OK */
break;
default:
- PRINTK_ERROR(KERN_ERR_MWAVE "mwavedd::register_serial_portandirq: Error: Illegal irq %x\n", irq );
+ PRINTK_ERROR(KERN_ERR_MWAVE
+ "mwavedd::register_serial_portandirq:"
+ " Error: Illegal irq %x\n", irq );
return -1;
} /* switch */
/* irq is okay */
@@ -427,7 +457,6 @@
}
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
static struct file_operations mwave_fops = {
.owner = THIS_MODULE,
.read = mwave_read,
@@ -436,24 +465,46 @@
.open = mwave_open,
.release = mwave_close
};
-#else
-static struct file_operations mwave_fops = {
- NULL, /* lseek */
- mwave_read, /* read */
- mwave_write, /* write */
- NULL, /* readdir */
- NULL, /* poll */
- mwave_ioctl, /* ioctl */
- NULL, /* mmap */
- mwave_open, /* open */
- NULL, /* flush */
- mwave_close /* release */
-};
-#endif
+
static struct miscdevice mwave_misc_dev = { MWAVE_MINOR, "mwave", &mwave_fops };
/*
+ * sysfs support
+ */
+
+struct device mwave_device;
+
+/* Prevent code redundancy, create a macro for mwave_show_* functions. */
+#define mwave_show_function(attr_name, format_string, field) \
+static ssize_t mwave_show_##attr_name(struct device *dev, char *buf) \
+{ \
+ DSP_3780I_CONFIG_SETTINGS *pSettings = \
+ &mwave_s_mdd.rBDData.rDspSettings; \
+ return sprintf(buf, format_string, pSettings->field); \
+}
+
+/* All of our attributes are read attributes. */
+#define mwave_dev_rd_attr(attr_name, format_string, field) \
+ mwave_show_function(attr_name, format_string, field) \
+static DEVICE_ATTR(attr_name, S_IRUGO, mwave_show_##attr_name, NULL)
+
+mwave_dev_rd_attr (3780i_dma, "%i\n", usDspDma);
+mwave_dev_rd_attr (3780i_irq, "%i\n", usDspIrq);
+mwave_dev_rd_attr (3780i_io, "%#.4x\n", usDspBaseIO);
+mwave_dev_rd_attr (uart_irq, "%i\n", usUartIrq);
+mwave_dev_rd_attr (uart_io, "%#.4x\n", usUartBaseIO);
+
+static struct device_attribute * const mwave_dev_attrs[] = {
+ &dev_attr_3780i_dma,
+ &dev_attr_3780i_irq,
+ &dev_attr_3780i_io,
+ &dev_attr_uart_irq,
+ &dev_attr_uart_io,
+};
+
+
+/*
* mwave_init is called on module load
*
* mwave_exit is called on module unload
@@ -461,17 +512,16 @@
*/
static void mwave_exit(void)
{
+ int i;
pMWAVE_DEVICE_DATA pDrvData = &mwave_s_mdd;
PRINTK_1(TRACE_MWAVE, "mwavedd::mwave_exit entry\n");
- if (pDrvData->bProcEntryCreated) {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
- remove_proc_entry("mwave", NULL);
-#else
- proc_unregister(&proc_root, mwave_proc.low_ino);
-#endif
+ for (i = 0; i < ARRAY_SIZE(mwave_dev_attrs); i++) {
+ device_remove_file(&mwave_device, mwave_dev_attrs[i]);
}
+ device_unregister(&mwave_device);
+
if ( pDrvData->sLine >= 0 ) {
unregister_serial(pDrvData->sLine);
}
@@ -497,72 +547,81 @@
{
int i;
int retval = 0;
- unsigned int resultMiscRegister;
pMWAVE_DEVICE_DATA pDrvData = &mwave_s_mdd;
- memset(&mwave_s_mdd, 0, sizeof(MWAVE_DEVICE_DATA));
-
PRINTK_1(TRACE_MWAVE, "mwavedd::mwave_init entry\n");
+ memset(&mwave_s_mdd, 0, sizeof(MWAVE_DEVICE_DATA));
+
pDrvData->bBDInitialized = FALSE;
pDrvData->bResourcesClaimed = FALSE;
pDrvData->bDSPEnabled = FALSE;
pDrvData->bDSPReset = FALSE;
pDrvData->bMwaveDevRegistered = FALSE;
pDrvData->sLine = -1;
- pDrvData->bProcEntryCreated = FALSE;
- for (i = 0; i < 16; i++) {
+ for (i = 0; i < ARRAY_SIZE(pDrvData->IPCs); i++) {
pDrvData->IPCs[i].bIsEnabled = FALSE;
pDrvData->IPCs[i].bIsHere = FALSE;
pDrvData->IPCs[i].usIntCount = 0; /* no ints received yet */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
init_waitqueue_head(&pDrvData->IPCs[i].ipc_wait_queue);
-#endif
}
retval = tp3780I_InitializeBoardData(&pDrvData->rBDData);
PRINTK_2(TRACE_MWAVE,
- "mwavedd::mwave_init, return from tp3780I_InitializeBoardData retval %x\n",
+ "mwavedd::mwave_init, return from tp3780I_InitializeBoardData"
+ " retval %x\n",
retval);
if (retval) {
- PRINTK_ERROR(KERN_ERR_MWAVE "mwavedd::mwave_init: Error: Failed to initialize board data\n");
+ PRINTK_ERROR(KERN_ERR_MWAVE
+ "mwavedd::mwave_init: Error:"
+ " Failed to initialize board data\n");
goto cleanup_error;
}
pDrvData->bBDInitialized = TRUE;
retval = tp3780I_CalcResources(&pDrvData->rBDData);
PRINTK_2(TRACE_MWAVE,
- "mwavedd::mwave_init, return from tp3780I_CalcResources retval %x\n",
+ "mwavedd::mwave_init, return from tp3780I_CalcResources"
+ " retval %x\n",
retval);
if (retval) {
- PRINTK_ERROR(KERN_ERR_MWAVE "mwavedd:mwave_init: Error: Failed to calculate resources\n");
+ PRINTK_ERROR(KERN_ERR_MWAVE
+ "mwavedd:mwave_init: Error:"
+ " Failed to calculate resources\n");
goto cleanup_error;
}
retval = tp3780I_ClaimResources(&pDrvData->rBDData);
PRINTK_2(TRACE_MWAVE,
- "mwavedd::mwave_init, return from tp3780I_ClaimResources retval %x\n",
+ "mwavedd::mwave_init, return from tp3780I_ClaimResources"
+ " retval %x\n",
retval);
if (retval) {
- PRINTK_ERROR(KERN_ERR_MWAVE "mwavedd:mwave_init: Error: Failed to claim resources\n");
+ PRINTK_ERROR(KERN_ERR_MWAVE
+ "mwavedd:mwave_init: Error:"
+ " Failed to claim resources\n");
goto cleanup_error;
}
pDrvData->bResourcesClaimed = TRUE;
retval = tp3780I_EnableDSP(&pDrvData->rBDData);
PRINTK_2(TRACE_MWAVE,
- "mwavedd::mwave_init, return from tp3780I_EnableDSP retval %x\n",
+ "mwavedd::mwave_init, return from tp3780I_EnableDSP"
+ " retval %x\n",
retval);
if (retval) {
- PRINTK_ERROR(KERN_ERR_MWAVE "mwavedd:mwave_init: Error: Failed to enable DSP\n");
+ PRINTK_ERROR(KERN_ERR_MWAVE
+ "mwavedd:mwave_init: Error:"
+ " Failed to enable DSP\n");
goto cleanup_error;
}
pDrvData->bDSPEnabled = TRUE;
- resultMiscRegister = misc_register(&mwave_misc_dev);
- if (resultMiscRegister < 0) {
- PRINTK_ERROR(KERN_ERR_MWAVE "mwavedd:mwave_init: Error: Failed to register misc device\n");
+ if (misc_register(&mwave_misc_dev) < 0) {
+ PRINTK_ERROR(KERN_ERR_MWAVE
+ "mwavedd:mwave_init: Error:"
+ " Failed to register misc device\n");
goto cleanup_error;
}
pDrvData->bMwaveDevRegistered = TRUE;
@@ -572,28 +631,36 @@
pDrvData->rBDData.rDspSettings.usUartIrq
);
if (pDrvData->sLine < 0) {
- PRINTK_ERROR(KERN_ERR_MWAVE "mwavedd:mwave_init: Error: Failed to register serial driver\n");
+ PRINTK_ERROR(KERN_ERR_MWAVE
+ "mwavedd:mwave_init: Error:"
+ " Failed to register serial driver\n");
goto cleanup_error;
}
/* uart is registered */
- if (
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
- !create_proc_info_entry("mwave", 0, NULL, mwave_get_info)
-#else
- proc_register(&proc_root, &mwave_proc)
-#endif
- ) {
- PRINTK_ERROR(KERN_ERR_MWAVE "mwavedd::mwave_init: Error: Failed to register /proc/mwave\n");
- goto cleanup_error;
+ /* sysfs */
+ memset(&mwave_device, 0, sizeof (struct device));
+ snprintf(mwave_device.name, DEVICE_NAME_SIZE, "mwave");
+ snprintf(mwave_device.bus_id, BUS_ID_SIZE, "mwave");
+
+ device_register(&mwave_device);
+ for (i = 0; i < ARRAY_SIZE(mwave_dev_attrs); i++) {
+ if(device_create_file(&mwave_device, mwave_dev_attrs[i])) {
+ PRINTK_ERROR(KERN_ERR_MWAVE
+ "mwavedd:mwave_init: Error:"
+ " Failed to create sysfs file %s\n",
+ mwave_dev_attrs[i]->attr.name);
+ goto cleanup_error;
+ }
}
- pDrvData->bProcEntryCreated = TRUE;
/* SUCCESS! */
return 0;
cleanup_error:
- PRINTK_ERROR(KERN_ERR_MWAVE "mwavedd::mwave_init: Error: Failed to initialize\n");
+ PRINTK_ERROR(KERN_ERR_MWAVE
+ "mwavedd::mwave_init: Error:"
+ " Failed to initialize\n");
mwave_exit(); /* clean up */
return -EIO;
@@ -601,39 +668,3 @@
module_init(mwave_init);
-
-/*
-* proc entry stuff added by Ian Pilcher
-*/
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
-static int mwave_get_info(char *buf, char **start, off_t offset, int len)
-{
- DSP_3780I_CONFIG_SETTINGS *pSettings = &mwave_s_mdd.rBDData.rDspSettings;
-
- char *out = buf;
-
- out += sprintf(out, "3780i_IRQ %i\n", pSettings->usDspIrq);
- out += sprintf(out, "3780i_DMA %i\n", pSettings->usDspDma);
- out += sprintf(out, "3780i_IO %#.4x\n", pSettings->usDspBaseIO);
- out += sprintf(out, "UART_IRQ %i\n", pSettings->usUartIrq);
- out += sprintf(out, "UART_IO %#.4x\n", pSettings->usUartBaseIO);
-
- return out - buf;
-}
-#else /* kernel version < 2.4.0 */
-static int mwave_read_proc(char *buf, char **start, off_t offset,
- int xlen, int unused)
-{
- DSP_3780I_CONFIG_SETTINGS *pSettings = &mwave_s_mdd.rBDData.rDspSettings;
- int len;
-
- len = sprintf(buf, "3780i_IRQ %i\n", pSettings->usDspIrq);
- len += sprintf(&buf[len], "3780i_DMA %i\n", pSettings->usDspDma);
- len += sprintf(&buf[len], "3780i_IO %#.4x\n", pSettings->usDspBaseIO);
- len += sprintf(&buf[len], "UART_IRQ %i\n", pSettings->usUartIrq);
- len += sprintf(&buf[len], "UART_IO %#.4x\n", pSettings->usUartBaseIO);
-
- return len;
-}
-#endif
diff -Nru a/drivers/char/mwave/mwavedd.h b/drivers/char/mwave/mwavedd.h
--- a/drivers/char/mwave/mwavedd.h Mon Feb 4 23:49:25 2002
+++ b/drivers/char/mwave/mwavedd.h Thu Mar 6 15:15:49 2003
@@ -126,11 +126,7 @@
BOOLEAN bIsEnabled;
BOOLEAN bIsHere;
/* entry spin lock */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
wait_queue_head_t ipc_wait_queue;
-#else
- struct wait_queue *ipc_wait_queue;
-#endif
} MWAVE_IPC;
typedef struct _MWAVE_DEVICE_DATA {
@@ -143,7 +139,6 @@
BOOLEAN bDSPReset;
MWAVE_IPC IPCs[16];
BOOLEAN bMwaveDevRegistered;
- BOOLEAN bProcEntryCreated;
short sLine;
} MWAVE_DEVICE_DATA, *pMWAVE_DEVICE_DATA;
diff -Nru a/drivers/char/mwave/mwavepub.h b/drivers/char/mwave/mwavepub.h
--- a/drivers/char/mwave/mwavepub.h Mon Feb 4 23:49:25 2002
+++ b/drivers/char/mwave/mwavepub.h Thu Mar 6 15:15:49 2003
@@ -50,13 +50,8 @@
#ifndef _LINUX_MWAVEPUB_H
#define _LINUX_MWAVEPUB_H
-#ifndef MWAVEM_APP_DIST
#include
-#endif
-#ifdef MWAVEM_APP_DIST
-#define MWAVE_MINOR 219
-#endif
typedef struct _MW_ABILITIES {
unsigned long instr_per_sec;
diff -Nru a/drivers/char/mwave/smapi.c b/drivers/char/mwave/smapi.c
--- a/drivers/char/mwave/smapi.c Mon Feb 4 23:49:25 2002
+++ b/drivers/char/mwave/smapi.c Thu Mar 6 15:15:49 2003
@@ -280,10 +280,11 @@
if ((usSI & 0xFF) == mwave_uart_irq) {
#ifndef MWAVE_FUTZ_WITH_OTHER_DEVICES
PRINTK_ERROR(KERN_ERR_MWAVE
+ "smapi::smapi_set_DSP_cfg: Serial port A irq %x conflicts with mwave_uart_irq %x\n", usSI & 0xFF, mwave_uart_irq);
#else
PRINTK_3(TRACE_SMAPI,
+ "smapi::smapi_set_DSP_cfg: Serial port A irq %x conflicts with mwave_uart_irq %x\n", usSI & 0xFF, mwave_uart_irq);
#endif
- "smapi::smapi_set_DSP_cfg: Serial port A irq %x conflicts with mwave_uart_irq %x\n", usSI, mwave_uart_irq);
#ifdef MWAVE_FUTZ_WITH_OTHER_DEVICES
PRINTK_1(TRACE_SMAPI,
"smapi::smapi_set_DSP_cfg Disabling conflicting serial port\n");
@@ -300,13 +301,14 @@
if ((usSI >> 8) == uartio_index) {
#ifndef MWAVE_FUTZ_WITH_OTHER_DEVICES
PRINTK_ERROR(KERN_ERR_MWAVE
+ "smapi::smapi_set_DSP_cfg: Serial port A base I/O address %x conflicts with mwave uart I/O %x\n", ausUartBases[usSI >> 8], ausUartBases[uartio_index]);
#else
PRINTK_3(TRACE_SMAPI,
+ "smapi::smapi_set_DSP_cfg: Serial port A base I/O address %x conflicts with mwave uart I/O %x\n", ausUartBases[usSI >> 8], ausUartBases[uartio_index]);
#endif
- "smapi::smapi_set_DSP_cfg: Serial port A base I/O address index %x conflicts with uartio_index %x\n", usSI >> 8, uartio_index);
#ifdef MWAVE_FUTZ_WITH_OTHER_DEVICES
PRINTK_1(TRACE_SMAPI,
- "smapi::smapi_set_DSP_cfg Disabling conflicting serial port\n");
+ "smapi::smapi_set_DSP_cfg Disabling conflicting serial port A\n");
bRC = smapi_request (0x1403, 0x0100, 0, usSI,
&usAX, &usBX, &usCX, &usDX, &usDI, &usSI);
if (bRC) goto exit_smapi_request_error;
@@ -331,13 +333,14 @@
if ((usSI & 0xFF) == mwave_uart_irq) {
#ifndef MWAVE_FUTZ_WITH_OTHER_DEVICES
PRINTK_ERROR(KERN_ERR_MWAVE
+ "smapi::smapi_set_DSP_cfg: Serial port B irq %x conflicts with mwave_uart_irq %x\n", usSI & 0xFF, mwave_uart_irq);
#else
PRINTK_3(TRACE_SMAPI,
+ "smapi::smapi_set_DSP_cfg: Serial port B irq %x conflicts with mwave_uart_irq %x\n", usSI & 0xFF, mwave_uart_irq);
#endif
- "smapi::smapi_set_DSP_cfg: Serial port B irq %x conflicts with mwave_uart_irq %x\n", usSI, mwave_uart_irq);
#ifdef MWAVE_FUTZ_WITH_OTHER_DEVICES
PRINTK_1(TRACE_SMAPI,
- "smapi::smapi_set_DSP_cfg Disabling conflicting serial port\n");
+ "smapi::smapi_set_DSP_cfg Disabling conflicting serial port B\n");
bRC = smapi_request(0x1405, 0x0100, 0, usSI,
&usAX, &usBX, &usCX, &usDX, &usDI, &usSI);
if (bRC) goto exit_smapi_request_error;
@@ -351,13 +354,14 @@
if ((usSI >> 8) == uartio_index) {
#ifndef MWAVE_FUTZ_WITH_OTHER_DEVICES
PRINTK_ERROR(KERN_ERR_MWAVE
+ "smapi::smapi_set_DSP_cfg: Serial port B base I/O address %x conflicts with mwave uart I/O %x\n", ausUartBases[usSI >> 8], ausUartBases[uartio_index]);
#else
PRINTK_3(TRACE_SMAPI,
+ "smapi::smapi_set_DSP_cfg: Serial port B base I/O address %x conflicts with mwave uart I/O %x\n", ausUartBases[usSI >> 8], ausUartBases[uartio_index]);
#endif
- "smapi::smapi_set_DSP_cfg: Serial port B base I/O address index %x conflicts with uartio_index %x\n", usSI >> 8, uartio_index);
#ifdef MWAVE_FUTZ_WITH_OTHER_DEVICES
PRINTK_1 (TRACE_SMAPI,
- "smapi::smapi_set_DSP_cfg Disabling conflicting serial port\n");
+ "smapi::smapi_set_DSP_cfg Disabling conflicting serial port B\n");
bRC = smapi_request (0x1405, 0x0100, 0, usSI,
&usAX, &usBX, &usCX, &usDX, &usDI, &usSI);
if (bRC) goto exit_smapi_request_error;
@@ -380,39 +384,15 @@
&usAX, &usBX, &usCX, &usDX, &usDI, &usSI);
if (bRC) goto exit_smapi_request_error;
/* bRC == 0 */
- if ((usCX & 0xff) == mwave_uart_irq) { /* serial port is enabled */
-#ifndef MWAVE_FUTZ_WITH_OTHER_DEVICES
- PRINTK_ERROR(KERN_ERR_MWAVE
-#else
- PRINTK_3(TRACE_SMAPI,
-#endif
- "smapi::smapi_set_DSP_cfg: IR port irq %x conflicts with mwave_uart_irq %x\n", usSI, mwave_uart_irq);
-#ifdef MWAVE_FUTZ_WITH_OTHER_DEVICES
- PRINTK_1(TRACE_SMAPI,
- "smapi::smapi_set_DSP_cfg Disabling conflicting IR port\n");
- bRC = smapi_request(0x1701, 0x0100, 0, 0,
- &usAX, &usBX, &usCX, &usDX, &usDI, &usSI);
- if (bRC) goto exit_smapi_request_error;
- bRC = smapi_request(0x1700, 0, 0, 0,
- &usAX, &usBX, &usCX, &usDX, &usDI, &usSI);
- if (bRC) goto exit_smapi_request_error;
- bRC = smapi_request(0x1705, 0x01ff, 0, usSI,
- &usAX, &usBX, &usCX, &usDX, &usDI, &usSI);
- if (bRC) goto exit_smapi_request_error;
- bRC = smapi_request(0x1704, 0x0000, 0, 0,
- &usAX, &usBX, &usCX, &usDX, &usDI, &usSI);
- if (bRC) goto exit_smapi_request_error;
-#else
- goto exit_conflict;
-#endif
- } else {
- if ((usSI & 0xff) == uartio_index) {
+ if ((usCX & 0xff) != 0xff) { /* IR port not disabled */
+ if ((usCX & 0xff) == mwave_uart_irq) {
#ifndef MWAVE_FUTZ_WITH_OTHER_DEVICES
PRINTK_ERROR(KERN_ERR_MWAVE
+ "smapi::smapi_set_DSP_cfg: IR port irq %x conflicts with mwave_uart_irq %x\n", usCX & 0xff, mwave_uart_irq);
#else
PRINTK_3(TRACE_SMAPI,
+ "smapi::smapi_set_DSP_cfg: IR port irq %x conflicts with mwave_uart_irq %x\n", usCX & 0xff, mwave_uart_irq);
#endif
- "smapi::smapi_set_DSP_cfg: IR port base I/O address index %x conflicts with uartio_index %x\n", usSI & 0xff, uartio_index);
#ifdef MWAVE_FUTZ_WITH_OTHER_DEVICES
PRINTK_1(TRACE_SMAPI,
"smapi::smapi_set_DSP_cfg Disabling conflicting IR port\n");
@@ -431,6 +411,34 @@
#else
goto exit_conflict;
#endif
+ } else {
+ if ((usSI & 0xff) == uartio_index) {
+#ifndef MWAVE_FUTZ_WITH_OTHER_DEVICES
+ PRINTK_ERROR(KERN_ERR_MWAVE
+ "smapi::smapi_set_DSP_cfg: IR port base I/O address %x conflicts with mwave uart I/O %x\n", ausUartBases[usSI & 0xff], ausUartBases[uartio_index]);
+#else
+ PRINTK_3(TRACE_SMAPI,
+ "smapi::smapi_set_DSP_cfg: IR port base I/O address %x conflicts with mwave uart I/O %x\n", ausUartBases[usSI & 0xff], ausUartBases[uartio_index]);
+#endif
+#ifdef MWAVE_FUTZ_WITH_OTHER_DEVICES
+ PRINTK_1(TRACE_SMAPI,
+ "smapi::smapi_set_DSP_cfg Disabling conflicting IR port\n");
+ bRC = smapi_request(0x1701, 0x0100, 0, 0,
+ &usAX, &usBX, &usCX, &usDX, &usDI, &usSI);
+ if (bRC) goto exit_smapi_request_error;
+ bRC = smapi_request(0x1700, 0, 0, 0,
+ &usAX, &usBX, &usCX, &usDX, &usDI, &usSI);
+ if (bRC) goto exit_smapi_request_error;
+ bRC = smapi_request(0x1705, 0x01ff, 0, usSI,
+ &usAX, &usBX, &usCX, &usDX, &usDI, &usSI);
+ if (bRC) goto exit_smapi_request_error;
+ bRC = smapi_request(0x1704, 0x0000, 0, 0,
+ &usAX, &usBX, &usCX, &usDX, &usDI, &usSI);
+ if (bRC) goto exit_smapi_request_error;
+#else
+ goto exit_conflict;
+#endif
+ }
}
}
}
diff -Nru a/drivers/char/n_tty.c b/drivers/char/n_tty.c
--- a/drivers/char/n_tty.c Thu Jan 16 17:57:52 2003
+++ b/drivers/char/n_tty.c Thu Mar 20 03:11:44 2003
@@ -1029,7 +1029,10 @@
break;
cs = tty->link->ctrl_status;
tty->link->ctrl_status = 0;
- put_user(cs, b++);
+ if (put_user(cs, b++)) {
+ retval = -EFAULT;
+ break;
+ }
nr--;
break;
}
@@ -1068,7 +1071,10 @@
/* Deal with packet mode. */
if (tty->packet && b == buf) {
- put_user(TIOCPKT_DATA, b++);
+ if (put_user(TIOCPKT_DATA, b++)) {
+ retval = -EFAULT;
+ break;
+ }
nr--;
}
@@ -1095,12 +1101,17 @@
spin_unlock_irqrestore(&tty->read_lock, flags);
if (!eol || (c != __DISABLED_CHAR)) {
- put_user(c, b++);
+ if (put_user(c, b++)) {
+ retval = -EFAULT;
+ break;
+ }
nr--;
}
if (eol)
break;
}
+ if (retval)
+ break;
} else {
int uncopied;
uncopied = copy_from_read_buf(tty, &b, &nr);
@@ -1135,7 +1146,7 @@
current->state = TASK_RUNNING;
size = b - buf;
- if (size) {
+ if (!retval && size) {
retval = size;
if (nr)
clear_bit(TTY_PUSH, &tty->flags);
diff -Nru a/drivers/char/raw.c b/drivers/char/raw.c
--- a/drivers/char/raw.c Sat Mar 8 14:50:48 2003
+++ b/drivers/char/raw.c Thu Mar 20 03:11:46 2003
@@ -50,7 +50,7 @@
filp->f_op = &raw_ctl_fops;
return 0;
}
-
+
down(&raw_mutex);
/*
@@ -70,10 +70,10 @@
} else {
err = set_blocksize(bdev, bdev_hardsect_size(bdev));
if (err == 0) {
- raw_devices[minor].inuse++;
- filp->f_dentry->d_inode->i_mapping =
- bdev->bd_inode->i_mapping;
filp->f_flags |= O_DIRECT;
+ if (++raw_devices[minor].inuse == 1)
+ filp->f_dentry->d_inode->i_mapping =
+ bdev->bd_inode->i_mapping;
}
}
}
@@ -83,6 +83,10 @@
return err;
}
+/*
+ * When the final fd which refers to this character-special node is closed, we
+ * make its ->mapping point back at its own i_data.
+ */
static int raw_release(struct inode *inode, struct file *filp)
{
const int minor= minor(inode->i_rdev);
@@ -90,13 +94,13 @@
down(&raw_mutex);
bdev = raw_devices[minor].binding;
- raw_devices[minor].inuse--;
+ if (--raw_devices[minor].inuse == 0) {
+ /* Here inode->i_mapping == bdev->bd_inode->i_mapping */
+ inode->i_mapping = &inode->i_data;
+ inode->i_mapping->backing_dev_info = &default_backing_dev_info;
+ }
up(&raw_mutex);
- /* Here inode->i_mapping == bdev->bd_inode->i_mapping */
- inode->i_mapping = &inode->i_data;
- inode->i_mapping->backing_dev_info = &default_backing_dev_info;
-
bd_release(bdev);
blkdev_put(bdev, BDEV_RAW);
return 0;
@@ -118,27 +122,28 @@
* Deal with ioctls against the raw-device control interface, to bind
* and unbind other raw devices.
*/
-static int
-raw_ctl_ioctl(struct inode *inode, struct file *filp,
- unsigned int command, unsigned long arg)
+static int raw_ctl_ioctl(struct inode *inode, struct file *filp,
+ unsigned int command, unsigned long arg)
{
struct raw_config_request rq;
struct raw_device_data *rawdev;
- int err;
-
+ int err = 0;
+
switch (command) {
case RAW_SETBIND:
case RAW_GETBIND:
/* First, find out which raw minor we want */
- err = -EFAULT;
- if (copy_from_user(&rq, (void *) arg, sizeof(rq)))
+ if (copy_from_user(&rq, (void *) arg, sizeof(rq))) {
+ err = -EFAULT;
goto out;
-
- err = -EINVAL;
- if (rq.raw_minor < 0 || rq.raw_minor >= MAX_RAW_MINORS)
+ }
+
+ if (rq.raw_minor < 0 || rq.raw_minor >= MAX_RAW_MINORS) {
+ err = -EINVAL;
goto out;
+ }
rawdev = &raw_devices[rq.raw_minor];
if (command == RAW_SETBIND) {
@@ -148,9 +153,10 @@
* This is like making block devices, so demand the
* same capability
*/
- err = -EPERM;
- if (!capable(CAP_SYS_ADMIN))
+ if (!capable(CAP_SYS_ADMIN)) {
+ err = -EPERM;
goto out;
+ }
/*
* For now, we don't need to check that the underlying
@@ -159,17 +165,18 @@
* major/minor numbers make sense.
*/
- err = -EINVAL;
dev = MKDEV(rq.block_major, rq.block_minor);
if ((rq.block_major == 0 && rq.block_minor != 0) ||
- MAJOR(dev) != rq.block_major ||
- MINOR(dev) != rq.block_minor)
+ MAJOR(dev) != rq.block_major ||
+ MINOR(dev) != rq.block_minor) {
+ err = -EINVAL;
goto out;
-
+ }
+
down(&raw_mutex);
- err = -EBUSY;
if (rawdev->inuse) {
up(&raw_mutex);
+ err = -EBUSY;
goto out;
}
if (rawdev->binding) {
@@ -181,7 +188,10 @@
rawdev->binding = NULL;
} else {
rawdev->binding = bdget(dev);
- MOD_INC_USE_COUNT;
+ if (rawdev->binding == NULL)
+ err = -ENOMEM;
+ else
+ try_module_get(THIS_MODULE);
}
up(&raw_mutex);
} else {
@@ -196,13 +206,12 @@
rq.block_major = rq.block_minor = 0;
}
up(&raw_mutex);
- err = -EFAULT;
- if (copy_to_user((void *)arg, &rq, sizeof(rq)))
+ if (copy_to_user((void *)arg, &rq, sizeof(rq))) {
+ err = -EFAULT;
goto out;
+ }
}
- err = 0;
break;
-
default:
err = -EINVAL;
break;
diff -Nru a/drivers/char/rio/rioboot.c b/drivers/char/rio/rioboot.c
--- a/drivers/char/rio/rioboot.c Sun Feb 16 16:15:30 2003
+++ b/drivers/char/rio/rioboot.c Tue Mar 18 08:58:11 2003
@@ -34,7 +34,6 @@
static char *_rioboot_c_sccs_ = "@(#)rioboot.c 1.3";
#endif
-#define __NO_VERSION__
#include
#include
#include
diff -Nru a/drivers/char/rio/riocmd.c b/drivers/char/rio/riocmd.c
--- a/drivers/char/rio/riocmd.c Sun Feb 16 16:15:30 2003
+++ b/drivers/char/rio/riocmd.c Tue Mar 18 08:58:11 2003
@@ -34,7 +34,6 @@
static char *_riocmd_c_sccs_ = "@(#)riocmd.c 1.2";
#endif
-#define __NO_VERSION__
#include
#include
#include
diff -Nru a/drivers/char/rio/rioctrl.c b/drivers/char/rio/rioctrl.c
--- a/drivers/char/rio/rioctrl.c Sun Feb 16 16:15:30 2003
+++ b/drivers/char/rio/rioctrl.c Tue Mar 18 08:58:11 2003
@@ -34,7 +34,6 @@
#endif
-#define __NO_VERSION__
#include
#include
#include
diff -Nru a/drivers/char/rio/rioinit.c b/drivers/char/rio/rioinit.c
--- a/drivers/char/rio/rioinit.c Thu Mar 6 09:17:26 2003
+++ b/drivers/char/rio/rioinit.c Tue Mar 18 08:58:11 2003
@@ -33,7 +33,6 @@
static char *_rioinit_c_sccs_ = "@(#)rioinit.c 1.3";
#endif
-#define __NO_VERSION__
#include
#include
#include
diff -Nru a/drivers/char/rio/riointr.c b/drivers/char/rio/riointr.c
--- a/drivers/char/rio/riointr.c Sun Feb 16 16:15:30 2003
+++ b/drivers/char/rio/riointr.c Tue Mar 18 08:58:11 2003
@@ -34,7 +34,6 @@
#endif
-#define __NO_VERSION__
#include
#include
#include
diff -Nru a/drivers/char/rio/rioparam.c b/drivers/char/rio/rioparam.c
--- a/drivers/char/rio/rioparam.c Thu Mar 6 09:17:26 2003
+++ b/drivers/char/rio/rioparam.c Tue Mar 18 08:58:24 2003
@@ -34,7 +34,6 @@
static char *_rioparam_c_sccs_ = "@(#)rioparam.c 1.3";
#endif
-#define __NO_VERSION__
#include
#include
#include
diff -Nru a/drivers/char/rio/rioroute.c b/drivers/char/rio/rioroute.c
--- a/drivers/char/rio/rioroute.c Thu Mar 6 09:17:26 2003
+++ b/drivers/char/rio/rioroute.c Tue Mar 18 08:58:24 2003
@@ -33,7 +33,6 @@
static char *_rioroute_c_sccs_ = "@(#)rioroute.c 1.3";
#endif
-#define __NO_VERSION__
#include
#include
#include
diff -Nru a/drivers/char/rio/riotable.c b/drivers/char/rio/riotable.c
--- a/drivers/char/rio/riotable.c Thu Mar 6 09:17:26 2003
+++ b/drivers/char/rio/riotable.c Tue Mar 18 08:58:24 2003
@@ -33,7 +33,6 @@
static char *_riotable_c_sccs_ = "@(#)riotable.c 1.2";
#endif
-#define __NO_VERSION__
#include
#include
#include
diff -Nru a/drivers/char/rio/riotty.c b/drivers/char/rio/riotty.c
--- a/drivers/char/rio/riotty.c Thu Mar 6 09:17:26 2003
+++ b/drivers/char/rio/riotty.c Tue Mar 18 08:58:24 2003
@@ -36,7 +36,6 @@
#define __EXPLICIT_DEF_H__
-#define __NO_VERSION__
#include
#include
#include
diff -Nru a/drivers/char/rtc.c b/drivers/char/rtc.c
--- a/drivers/char/rtc.c Thu Mar 6 08:17:53 2003
+++ b/drivers/char/rtc.c Tue Mar 18 08:58:24 2003
@@ -47,7 +47,7 @@
#define RTC_VERSION "1.11"
-#define RTC_IO_EXTENT 0x10 /* Only really two ports, but... */
+#define RTC_IO_EXTENT 0x8
/*
* Note that *all* calls to CMOS_READ and CMOS_WRITE are done with
diff -Nru a/drivers/char/serial167.c b/drivers/char/serial167.c
--- a/drivers/char/serial167.c Fri Feb 14 15:16:47 2003
+++ b/drivers/char/serial167.c Tue Mar 18 07:43:19 2003
@@ -2836,7 +2836,7 @@
};
-static void __init serial167_console_init(void)
+static int __init serial167_console_init(void)
{
if (vme_brdtype == VME_TYPE_MVME166 ||
vme_brdtype == VME_TYPE_MVME167 ||
@@ -2844,6 +2844,7 @@
mvme167_serial_console_setup(0);
register_console(&sercons);
}
+ return 0;
}
console_initcall(serial167_console_init);
diff -Nru a/drivers/char/serial_tx3912.c b/drivers/char/serial_tx3912.c
--- a/drivers/char/serial_tx3912.c Fri Feb 14 15:16:47 2003
+++ b/drivers/char/serial_tx3912.c Tue Mar 18 07:43:35 2003
@@ -1054,9 +1054,10 @@
.index = -1
};
-static void __init tx3912_console_init(void)
+static int __init tx3912_console_init(void)
{
register_console(&sercons);
+ return 0;
}
console_initcall(tx3912_console_init);
diff -Nru a/drivers/char/sh-sci.c b/drivers/char/sh-sci.c
--- a/drivers/char/sh-sci.c Fri Feb 14 15:16:47 2003
+++ b/drivers/char/sh-sci.c Tue Mar 18 07:43:51 2003
@@ -1275,7 +1275,7 @@
extern void sh_console_unregister (void);
#endif
-static void __init sci_console_init(void)
+static int __init sci_console_init(void)
{
register_console(&sercons);
#ifdef CONFIG_SH_EARLY_PRINTK
@@ -1284,6 +1284,7 @@
*/
sh_console_unregister();
#endif
+ return 0;
}
console_initcall(sci_console_init);
diff -Nru a/drivers/char/tty_io.c b/drivers/char/tty_io.c
--- a/drivers/char/tty_io.c Sat Mar 15 02:33:56 2003
+++ b/drivers/char/tty_io.c Mon Mar 17 21:32:06 2003
@@ -1034,7 +1034,9 @@
}
o_tty->magic = 0;
(*o_tty->driver.refcount)--;
+ file_list_lock();
list_del(&o_tty->tty_files);
+ file_list_unlock();
free_tty_struct(o_tty);
}
@@ -1046,7 +1048,9 @@
}
tty->magic = 0;
(*tty->driver.refcount)--;
+ file_list_lock();
list_del(&tty->tty_files);
+ file_list_unlock();
module_put(tty->driver.owner);
free_tty_struct(tty);
}
diff -Nru a/drivers/char/upd4990a.c b/drivers/char/upd4990a.c
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/drivers/char/upd4990a.c Thu Mar 13 17:23:19 2003
@@ -0,0 +1,423 @@
+/*
+ * NEC PC-9800 Real Time Clock interface for Linux
+ *
+ * Copyright (C) 1997-2001 Linux/98 project,
+ * Kyoto University Microcomputer Club.
+ *
+ * Based on:
+ * drivers/char/rtc.c by Paul Gortmaker
+ *
+ * Changes:
+ * 2001-02-09 Call check_region on rtc_init and do not request I/O 0033h.
+ * Call del_timer and release_region on rtc_exit. -- tak
+ * 2001-07-14 Rewrite and split to
+ * and .
+ * Introduce a lot of spin_lock/unlock (&rtc_lock).
+ */
+
+#define RTC98_VERSION "1.2"
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+
+/*
+ * 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 struct fasync_struct *rtc_async_queue;
+
+static DECLARE_WAIT_QUEUE_HEAD(rtc_wait);
+
+static struct timer_list rtc_uie_timer;
+static u8 old_refclk;
+
+static int rtc_ioctl(struct inode *inode, struct file *file,
+ unsigned int cmd, unsigned long arg);
+
+static int rtc_read_proc(char *page, char **start, off_t off,
+ int count, int *eof, void *data);
+
+/*
+ * Bits in rtc_status. (5 bits of room for future expansion)
+ */
+
+#define RTC_IS_OPEN 0x01 /* means /dev/rtc is in use */
+#define RTC_TIMER_ON 0x02 /* not used */
+#define RTC_UIE_TIMER_ON 0x04 /* UIE emulation timer is active */
+
+/*
+ * rtc_status is never changed by rtc_interrupt, and ioctl/open/close is
+ * protected by the big kernel lock. However, ioctl can still disable the timer
+ * in rtc_status and then with del_timer after the interrupt has read
+ * rtc_status but before mod_timer is called, which would then reenable the
+ * timer (but you would need to have an awful timing before you'd trip on it)
+ */
+static unsigned char rtc_status; /* bitmapped status byte. */
+static unsigned long rtc_irq_data; /* our output to the world */
+
+static const unsigned char days_in_mo[] =
+{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
+
+extern spinlock_t rtc_lock; /* defined in arch/i386/kernel/time.c */
+
+static void rtc_uie_intr(unsigned long data)
+{
+ u8 refclk, tmp;
+
+ /* Kernel timer does del_timer internally before calling
+ each timer entry, so this is unnecessary.
+ del_timer(&rtc_uie_timer); */
+ spin_lock(&rtc_lock);
+
+ /* Detect rising edge of 1Hz reference clock. */
+ refclk = UPD4990A_READ_DATA();
+ tmp = old_refclk & refclk;
+ old_refclk = ~refclk;
+ if (!(tmp & 1))
+ rtc_irq_data += 0x100;
+
+ spin_unlock(&rtc_lock);
+
+ if (!(tmp & 1)) {
+ /* Now do the rest of the actions */
+ wake_up_interruptible(&rtc_wait);
+ kill_fasync(&rtc_async_queue, SIGIO, POLL_IN);
+ }
+
+ rtc_uie_timer.expires = jiffies + 1;
+ add_timer(&rtc_uie_timer);
+}
+
+/*
+ * Now all the various file operations that we export.
+ */
+
+static ssize_t rtc_read(struct file *file, char *buf,
+ size_t count, loff_t *ppos)
+{
+ DECLARE_WAITQUEUE(wait, current);
+ unsigned long data;
+ ssize_t retval = 0;
+
+ if (count < sizeof(unsigned long))
+ return -EINVAL;
+
+ add_wait_queue(&rtc_wait, &wait);
+
+ set_current_state(TASK_INTERRUPTIBLE);
+
+ do {
+ /* First make it right. Then make it fast. Putting this whole
+ * block within the parentheses of a while would be too
+ * confusing. And no, xchg() is not the answer. */
+ spin_lock_irq(&rtc_lock);
+ data = rtc_irq_data;
+ rtc_irq_data = 0;
+ spin_unlock_irq(&rtc_lock);
+
+ if (data != 0)
+ break;
+ if (file->f_flags & O_NONBLOCK) {
+ retval = -EAGAIN;
+ goto out;
+ }
+ if (signal_pending(current)) {
+ retval = -ERESTARTSYS;
+ goto out;
+ }
+ schedule();
+ } while (1);
+
+ retval = put_user(data, (unsigned long *)buf);
+ if (!retval)
+ retval = sizeof(unsigned long);
+ out:
+ set_current_state(TASK_RUNNING);
+ remove_wait_queue(&rtc_wait, &wait);
+
+ return retval;
+}
+
+static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
+ unsigned long arg)
+{
+ struct rtc_time wtime;
+ struct upd4990a_raw_data raw;
+
+ switch (cmd) {
+ case RTC_UIE_OFF: /* Mask ints from RTC updates. */
+ spin_lock_irq(&rtc_lock);
+ if (rtc_status & RTC_UIE_TIMER_ON) {
+ rtc_status &= ~RTC_UIE_TIMER_ON;
+ del_timer(&rtc_uie_timer);
+ }
+ spin_unlock_irq(&rtc_lock);
+ return 0;
+
+ case RTC_UIE_ON: /* Allow ints for RTC updates. */
+ spin_lock_irq(&rtc_lock);
+ rtc_irq_data = 0;
+ if (!(rtc_status & RTC_UIE_TIMER_ON)) {
+ rtc_status |= RTC_UIE_TIMER_ON;
+ rtc_uie_timer.expires = jiffies + 1;
+ add_timer(&rtc_uie_timer);
+ }
+ /* Just in case... */
+ upd4990a_serial_command(UPD4990A_REGISTER_HOLD);
+ old_refclk = ~UPD4990A_READ_DATA();
+ spin_unlock_irq(&rtc_lock);
+ return 0;
+
+ case RTC_RD_TIME: /* Read the time/date from RTC */
+ spin_lock_irq(&rtc_lock);
+ upd4990a_get_time(&raw, 0);
+ spin_unlock_irq(&rtc_lock);
+
+ wtime.tm_sec = BCD2BIN(raw.sec);
+ wtime.tm_min = BCD2BIN(raw.min);
+ wtime.tm_hour = BCD2BIN(raw.hour);
+ wtime.tm_mday = BCD2BIN(raw.mday);
+ wtime.tm_mon = raw.mon - 1; /* convert to 0-base */
+ wtime.tm_wday = raw.wday;
+
+ /*
+ * Account for differences between how the RTC uses the values
+ * and how they are defined in a struct rtc_time;
+ */
+ if ((wtime.tm_year = BCD2BIN(raw.year)) < 95)
+ wtime.tm_year += 100;
+
+ wtime.tm_isdst = 0;
+ break;
+
+ case RTC_SET_TIME: /* Set the RTC */
+ {
+ int leap_yr;
+
+ if (!capable(CAP_SYS_TIME))
+ return -EACCES;
+
+ if (copy_from_user(&wtime, (struct rtc_time *) arg,
+ sizeof (struct rtc_time)))
+ return -EFAULT;
+
+ /* Valid year is 1995 - 2094, inclusive. */
+ if (wtime.tm_year < 95 || wtime.tm_year > 194)
+ return -EINVAL;
+
+ if (wtime.tm_mon > 11 || wtime.tm_mday == 0)
+ return -EINVAL;
+
+ /* For acceptable year domain (1995 - 2094),
+ this IS sufficient. */
+ leap_yr = !(wtime.tm_year % 4);
+
+ if (wtime.tm_mday > (days_in_mo[wtime.tm_mon]
+ + (wtime.tm_mon == 2 && leap_yr)))
+ return -EINVAL;
+
+ if (wtime.tm_hour >= 24
+ || wtime.tm_min >= 60 || wtime.tm_sec >= 60)
+ return -EINVAL;
+
+ if (wtime.tm_wday > 6)
+ return -EINVAL;
+
+ raw.sec = BIN2BCD(wtime.tm_sec);
+ raw.min = BIN2BCD(wtime.tm_min);
+ raw.hour = BIN2BCD(wtime.tm_hour);
+ raw.mday = BIN2BCD(wtime.tm_mday);
+ raw.mon = wtime.tm_mon + 1;
+ raw.wday = wtime.tm_wday;
+ raw.year = BIN2BCD(wtime.tm_year % 100);
+
+ spin_lock_irq(&rtc_lock);
+ upd4990a_set_time(&raw, 0);
+ spin_unlock_irq(&rtc_lock);
+
+ return 0;
+ }
+ default:
+ return -EINVAL;
+ }
+ return copy_to_user((void *)arg, &wtime, sizeof wtime) ? -EFAULT : 0;
+}
+
+/*
+ * We enforce only one user at a time here with the open/close.
+ * Also clear the previous interrupt data on an open, and clean
+ * up things on a close.
+ */
+
+static int rtc_open(struct inode *inode, struct file *file)
+{
+ spin_lock_irq(&rtc_lock);
+
+ if(rtc_status & RTC_IS_OPEN)
+ goto out_busy;
+
+ rtc_status |= RTC_IS_OPEN;
+
+ rtc_irq_data = 0;
+ spin_unlock_irq(&rtc_lock);
+ return 0;
+
+ out_busy:
+ spin_unlock_irq(&rtc_lock);
+ return -EBUSY;
+}
+
+static int rtc_fasync(int fd, struct file *filp, int on)
+{
+ return fasync_helper(fd, filp, on, &rtc_async_queue);
+}
+
+static int rtc_release(struct inode *inode, struct file *file)
+{
+ del_timer(&rtc_uie_timer);
+
+ if (file->f_flags & FASYNC)
+ rtc_fasync(-1, file, 0);
+
+ rtc_irq_data = 0;
+
+ /* No need for locking -- nobody else can do anything until this rmw is
+ * committed, and no timer is running. */
+ rtc_status &= ~(RTC_IS_OPEN | RTC_UIE_TIMER_ON);
+ return 0;
+}
+
+static unsigned int rtc_poll(struct file *file, poll_table *wait)
+{
+ unsigned long l;
+
+ poll_wait(file, &rtc_wait, wait);
+
+ spin_lock_irq(&rtc_lock);
+ l = rtc_irq_data;
+ spin_unlock_irq(&rtc_lock);
+
+ if (l != 0)
+ return POLLIN | POLLRDNORM;
+ return 0;
+}
+
+/*
+ * The various file operations we support.
+ */
+
+static struct file_operations rtc_fops = {
+ .owner = THIS_MODULE,
+ .read = rtc_read,
+ .poll = rtc_poll,
+ .ioctl = rtc_ioctl,
+ .open = rtc_open,
+ .release = rtc_release,
+ .fasync = rtc_fasync,
+};
+
+static struct miscdevice rtc_dev=
+{
+ .minor = RTC_MINOR,
+ .name = "rtc",
+ .fops = &rtc_fops,
+};
+
+static int __init rtc_init(void)
+{
+ if (!request_region(UPD4990A_IO, 1, "rtc")) {
+ printk(KERN_ERR "upd4990a: could not acquire I/O port %#x\n",
+ UPD4990A_IO);
+ return -EBUSY;
+ }
+
+#if 0
+ printk(KERN_INFO "\xB6\xDA\xDD\xC0\xDE \xC4\xDE\xB9\xB2 Driver\n"); /* Calender Clock Driver */
+#else
+ printk(KERN_INFO
+ "Real Time Clock driver for NEC PC-9800 v" RTC98_VERSION "\n");
+#endif
+ misc_register(&rtc_dev);
+ create_proc_read_entry("driver/rtc", 0, NULL, rtc_read_proc, NULL);
+
+ init_timer(&rtc_uie_timer);
+ rtc_uie_timer.function = rtc_uie_intr;
+
+ return 0;
+}
+
+module_init (rtc_init);
+
+static void __exit rtc_exit(void)
+{
+ del_timer(&rtc_uie_timer);
+ release_region(UPD4990A_IO, 1);
+ remove_proc_entry("driver/rtc", NULL);
+ misc_deregister(&rtc_dev);
+}
+
+module_exit (rtc_exit);
+
+/*
+ * Info exported via "/proc/driver/rtc".
+ */
+
+static inline int rtc_get_status(char *buf)
+{
+ char *p;
+ unsigned int year;
+ struct upd4990a_raw_data data;
+
+ p = buf;
+
+ upd4990a_get_time(&data, 0);
+
+ /*
+ * There is no way to tell if the luser has the RTC set for local
+ * time or for Universal Standard Time (GMT). Probably local though.
+ */
+ if ((year = BCD2BIN(data.year) + 1900) < 1995)
+ year += 100;
+ p += sprintf(p,
+ "rtc_time\t: %02d:%02d:%02d\n"
+ "rtc_date\t: %04d-%02d-%02d\n",
+ BCD2BIN(data.hour), BCD2BIN(data.min),
+ BCD2BIN(data.sec),
+ year, data.mon, BCD2BIN(data.mday));
+
+ return p - buf;
+}
+
+static int rtc_read_proc(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{
+ int len = rtc_get_status(page);
+
+ if (len <= off + count)
+ *eof = 1;
+ *start = page + off;
+ len -= off;
+ if (len > count)
+ len = count;
+ if (len < 0)
+ len = 0;
+ return len;
+}
diff -Nru a/drivers/char/vme_scc.c b/drivers/char/vme_scc.c
--- a/drivers/char/vme_scc.c Fri Feb 14 15:18:33 2003
+++ b/drivers/char/vme_scc.c Tue Mar 18 07:44:08 2003
@@ -1091,7 +1091,7 @@
};
-static void __init vme_scc_console_init(void)
+static int __init vme_scc_console_init(void)
{
if (vme_brdtype == VME_TYPE_MVME147 ||
vme_brdtype == VME_TYPE_MVME162 ||
@@ -1099,5 +1099,6 @@
vme_brdtype == VME_TYPE_BVME4000 ||
vme_brdtype == VME_TYPE_BVME6000)
register_console(&sercons);
+ return 0;
}
console_initcall(vme_scc_console_init);
diff -Nru a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c
--- a/drivers/char/vt_ioctl.c Thu Oct 31 12:05:41 2002
+++ b/drivers/char/vt_ioctl.c Mon Mar 17 21:32:09 2003
@@ -191,38 +191,56 @@
static inline int
do_kdgkb_ioctl(int cmd, struct kbsentry *user_kdgkb, int perm)
{
- struct kbsentry tmp;
+ struct kbsentry *kbs;
char *p;
u_char *q;
int sz;
int delta;
char *first_free, *fj, *fnw;
int i, j, k;
+ int ret;
+
+ kbs = kmalloc(sizeof(*kbs), GFP_KERNEL);
+ if (!kbs) {
+ ret = -ENOMEM;
+ goto reterr;
+ }
/* we mostly copy too much here (512bytes), but who cares ;) */
- if (copy_from_user(&tmp, user_kdgkb, sizeof(struct kbsentry)))
- return -EFAULT;
- tmp.kb_string[sizeof(tmp.kb_string)-1] = '\0';
- if (tmp.kb_func >= MAX_NR_FUNC)
- return -EINVAL;
- i = tmp.kb_func;
+ if (copy_from_user(kbs, user_kdgkb, sizeof(struct kbsentry))) {
+ ret = -EFAULT;
+ goto reterr;
+ }
+ kbs->kb_string[sizeof(kbs->kb_string)-1] = '\0';
+ if (kbs->kb_func >= MAX_NR_FUNC) {
+ ret = -EINVAL;
+ goto reterr;
+ }
+ i = kbs->kb_func;
switch (cmd) {
case KDGKBSENT:
- sz = sizeof(tmp.kb_string) - 1; /* sz should have been
+ sz = sizeof(kbs->kb_string) - 1; /* sz should have been
a struct member */
q = user_kdgkb->kb_string;
p = func_table[i];
if(p)
for ( ; *p && sz; p++, sz--)
- if (put_user(*p, q++))
- return -EFAULT;
- if (put_user('\0', q))
- return -EFAULT;
+ if (put_user(*p, q++)) {
+ ret = -EFAULT;
+ goto reterr;
+ }
+ if (put_user('\0', q)) {
+ ret = -EFAULT;
+ goto reterr;
+ }
+ kfree(kbs);
return ((p && *p) ? -EOVERFLOW : 0);
case KDSKBSENT:
- if (!perm)
- return -EPERM;
+ if (!perm) {
+ ret = -EPERM;
+ goto reterr;
+ }
q = func_table[i];
first_free = funcbufptr + (funcbufsize - funcbufleft);
@@ -233,7 +251,7 @@
else
fj = first_free;
- delta = (q ? -strlen(q) : 1) + strlen(tmp.kb_string);
+ delta = (q ? -strlen(q) : 1) + strlen(kbs->kb_string);
if (delta <= funcbufleft) { /* it fits in current buf */
if (j < MAX_NR_FUNC) {
memmove(fj + delta, fj, first_free - fj);
@@ -249,8 +267,10 @@
while (sz < funcbufsize - funcbufleft + delta)
sz <<= 1;
fnw = (char *) kmalloc(sz, GFP_KERNEL);
- if(!fnw)
- return -ENOMEM;
+ if(!fnw) {
+ ret = -ENOMEM;
+ goto reterr;
+ }
if (!q)
func_table[i] = fj;
@@ -272,17 +292,19 @@
funcbufleft = funcbufleft - delta + sz - funcbufsize;
funcbufsize = sz;
}
- strcpy(func_table[i], tmp.kb_string);
+ strcpy(func_table[i], kbs->kb_string);
break;
}
- return 0;
+ ret = 0;
+reterr:
+ kfree(kbs);
+ return ret;
}
static inline int
-do_fontx_ioctl(int cmd, struct consolefontdesc *user_cfd, int perm)
+do_fontx_ioctl(int cmd, struct consolefontdesc *user_cfd, int perm, struct console_font_op *op)
{
struct consolefontdesc cfdarg;
- struct console_font_op op;
int i;
if (copy_from_user(&cfdarg, user_cfd, sizeof(struct consolefontdesc)))
@@ -292,25 +314,25 @@
case PIO_FONTX:
if (!perm)
return -EPERM;
- op.op = KD_FONT_OP_SET;
- op.flags = KD_FONT_FLAG_OLD;
- op.width = 8;
- op.height = cfdarg.charheight;
- op.charcount = cfdarg.charcount;
- op.data = cfdarg.chardata;
- return con_font_op(fg_console, &op);
+ op->op = KD_FONT_OP_SET;
+ op->flags = KD_FONT_FLAG_OLD;
+ op->width = 8;
+ op->height = cfdarg.charheight;
+ op->charcount = cfdarg.charcount;
+ op->data = cfdarg.chardata;
+ return con_font_op(fg_console, op);
case GIO_FONTX: {
- op.op = KD_FONT_OP_GET;
- op.flags = KD_FONT_FLAG_OLD;
- op.width = 8;
- op.height = cfdarg.charheight;
- op.charcount = cfdarg.charcount;
- op.data = cfdarg.chardata;
- i = con_font_op(fg_console, &op);
+ op->op = KD_FONT_OP_GET;
+ op->flags = KD_FONT_FLAG_OLD;
+ op->width = 8;
+ op->height = cfdarg.charheight;
+ op->charcount = cfdarg.charcount;
+ op->data = cfdarg.chardata;
+ i = con_font_op(fg_console, op);
if (i)
return i;
- cfdarg.charheight = op.height;
- cfdarg.charcount = op.charcount;
+ cfdarg.charheight = op->height;
+ cfdarg.charcount = op->charcount;
if (copy_to_user(user_cfd, &cfdarg, sizeof(struct consolefontdesc)))
return -EFAULT;
return 0;
@@ -355,6 +377,7 @@
unsigned char ucval;
struct kbd_struct * kbd;
struct vt_struct *vt = (struct vt_struct *)tty->driver_data;
+ struct console_font_op op; /* used in multiple places here */
console = vt->vc_num;
@@ -860,7 +883,6 @@
}
case PIO_FONT: {
- struct console_font_op op;
if (!perm)
return -EPERM;
op.op = KD_FONT_OP_SET;
@@ -873,7 +895,6 @@
}
case GIO_FONT: {
- struct console_font_op op;
op.op = KD_FONT_OP_GET;
op.flags = KD_FONT_FLAG_OLD;
op.width = 8;
@@ -893,7 +914,7 @@
case PIO_FONTX:
case GIO_FONTX:
- return do_fontx_ioctl(cmd, (struct consolefontdesc *)arg, perm);
+ return do_fontx_ioctl(cmd, (struct consolefontdesc *)arg, perm, &op);
case PIO_FONTRESET:
{
@@ -906,7 +927,6 @@
return -ENOSYS;
#else
{
- struct console_font_op op;
op.op = KD_FONT_OP_SET_DEFAULT;
op.data = NULL;
i = con_font_op(fg_console, &op);
@@ -918,7 +938,6 @@
}
case KDFONTOP: {
- struct console_font_op op;
if (copy_from_user(&op, (void *) arg, sizeof(op)))
return -EFAULT;
if (!perm && op.op != KD_FONT_OP_GET)
diff -Nru a/drivers/char/watchdog/acquirewdt.c b/drivers/char/watchdog/acquirewdt.c
--- a/drivers/char/watchdog/acquirewdt.c Thu Feb 27 17:28:13 2003
+++ b/drivers/char/watchdog/acquirewdt.c Fri Feb 14 10:07:43 2003
@@ -141,6 +141,8 @@
spin_unlock(&acq_lock);
return -EBUSY;
}
+ if (nowayout)
+ MOD_INC_USE_COUNT;
/* Activate */
acq_is_open=1;
diff -Nru a/drivers/char/watchdog/ib700wdt.c b/drivers/char/watchdog/ib700wdt.c
--- a/drivers/char/watchdog/ib700wdt.c Thu Feb 27 17:13:12 2003
+++ b/drivers/char/watchdog/ib700wdt.c Thu Mar 6 09:19:52 2003
@@ -228,6 +228,8 @@
spin_unlock(&ibwdt_lock);
return -EBUSY;
}
+ if (nowayout)
+ MOD_INC_USE_COUNT;
/* Activate */
ibwdt_is_open = 1;
diff -Nru a/drivers/char/watchdog/indydog.c b/drivers/char/watchdog/indydog.c
--- a/drivers/char/watchdog/indydog.c Thu Feb 27 17:28:13 2003
+++ b/drivers/char/watchdog/indydog.c Fri Feb 14 10:03:27 2003
@@ -53,6 +53,9 @@
if( test_and_set_bit(0,&indydog_alive) )
return -EBUSY;
+ if (nowayout)
+ MOD_INC_USE_COUNT;
+
/*
* Activate timer
*/
diff -Nru a/drivers/char/watchdog/machzwd.c b/drivers/char/watchdog/machzwd.c
--- a/drivers/char/watchdog/machzwd.c Thu Feb 27 17:28:13 2003
+++ b/drivers/char/watchdog/machzwd.c Fri Feb 14 10:07:43 2003
@@ -390,6 +390,9 @@
return -EBUSY;
}
+ if (nowayout)
+ MOD_INC_USE_COUNT;
+
zf_is_open = 1;
spin_unlock(&zf_lock);
diff -Nru a/drivers/char/watchdog/mixcomwd.c b/drivers/char/watchdog/mixcomwd.c
--- a/drivers/char/watchdog/mixcomwd.c Thu Feb 27 17:28:13 2003
+++ b/drivers/char/watchdog/mixcomwd.c Fri Feb 14 10:03:27 2003
@@ -93,7 +93,9 @@
}
mixcomwd_ping();
- if (!nowayout) {
+ if (nowayout) {
+ MOD_INC_USE_COUNT;
+ } else {
if(mixcomwd_timer_alive) {
del_timer(&mixcomwd_timer);
mixcomwd_timer_alive=0;
diff -Nru a/drivers/char/watchdog/pcwd.c b/drivers/char/watchdog/pcwd.c
--- a/drivers/char/watchdog/pcwd.c Thu Feb 27 17:28:13 2003
+++ b/drivers/char/watchdog/pcwd.c Fri Feb 14 10:07:43 2003
@@ -430,7 +430,7 @@
atomic_inc( &open_allowed );
return -EBUSY;
}
-
+ MOD_INC_USE_COUNT;
/* Enable the port */
if (revision == PCWD_REVISION_C) {
spin_lock(&io_lock);
diff -Nru a/drivers/char/watchdog/sbc60xxwdt.c b/drivers/char/watchdog/sbc60xxwdt.c
--- a/drivers/char/watchdog/sbc60xxwdt.c Thu Feb 27 17:28:13 2003
+++ b/drivers/char/watchdog/sbc60xxwdt.c Thu Mar 6 09:20:38 2003
@@ -206,7 +206,9 @@
/* Just in case we're already talking to someone... */
if(wdt_is_open)
return -EBUSY;
-
+ if (nowayout) {
+ MOD_INC_USE_COUNT;
+ }
/* Good, fire up the show */
wdt_is_open = 1;
wdt_startup();
diff -Nru a/drivers/char/watchdog/sc520_wdt.c b/drivers/char/watchdog/sc520_wdt.c
--- a/drivers/char/watchdog/sc520_wdt.c Thu Feb 27 17:28:13 2003
+++ b/drivers/char/watchdog/sc520_wdt.c Thu Mar 6 09:21:14 2003
@@ -229,6 +229,8 @@
return -EBUSY;
/* Good, fire up the show */
wdt_startup();
+ if (nowayout)
+ MOD_INC_USE_COUNT;
return 0;
default:
diff -Nru a/drivers/char/watchdog/shwdt.c b/drivers/char/watchdog/shwdt.c
--- a/drivers/char/watchdog/shwdt.c Thu Feb 27 17:28:13 2003
+++ b/drivers/char/watchdog/shwdt.c Thu Mar 6 09:21:14 2003
@@ -189,6 +189,10 @@
if (test_and_set_bit(0, &sh_is_open))
return -EBUSY;
+ if (nowayout) {
+ MOD_INC_USE_COUNT;
+ }
+
sh_wdt_start();
break;
diff -Nru a/drivers/char/watchdog/softdog.c b/drivers/char/watchdog/softdog.c
--- a/drivers/char/watchdog/softdog.c Thu Feb 27 17:28:13 2003
+++ b/drivers/char/watchdog/softdog.c Fri Feb 14 10:03:27 2003
@@ -103,7 +103,9 @@
{
if(test_and_set_bit(0, &timer_alive))
return -EBUSY;
-
+ if (nowayout) {
+ MOD_INC_USE_COUNT;
+ }
/*
* Activate timer
*/
diff -Nru a/drivers/char/watchdog/wdt977.c b/drivers/char/watchdog/wdt977.c
--- a/drivers/char/watchdog/wdt977.c Thu Feb 27 17:28:13 2003
+++ b/drivers/char/watchdog/wdt977.c Wed Feb 19 07:26:28 2003
@@ -99,6 +99,8 @@
if (nowayout)
{
+ MOD_INC_USE_COUNT;
+
/* do not permit disabling the watchdog by writing 0 to reg. 0xF2 */
if (!timeoutM) timeoutM = DEFAULT_TIMEOUT;
}
diff -Nru a/drivers/char/watchdog/wdt_pci.c b/drivers/char/watchdog/wdt_pci.c
--- a/drivers/char/watchdog/wdt_pci.c Thu Feb 27 17:28:13 2003
+++ b/drivers/char/watchdog/wdt_pci.c Thu Mar 6 09:21:14 2003
@@ -365,6 +365,9 @@
if (down_trylock(&open_sem))
return -EBUSY;
+ if (nowayout) {
+ MOD_INC_USE_COUNT;
+ }
/*
* Activate
*/
diff -Nru a/drivers/fc4/fc_syms.c b/drivers/fc4/fc_syms.c
--- a/drivers/fc4/fc_syms.c Tue Oct 29 00:10:52 2002
+++ b/drivers/fc4/fc_syms.c Thu Mar 13 16:52:15 2003
@@ -2,7 +2,6 @@
* We should not even be trying to compile this if we are not doing
* a module.
*/
-#define __NO_VERSION__
#include
#include
diff -Nru a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
--- a/drivers/i2c/busses/Kconfig Thu Mar 13 11:52:16 2003
+++ b/drivers/i2c/busses/Kconfig Thu Mar 20 11:47:34 2003
@@ -76,6 +76,24 @@
in the lm_sensors package, which you can download at
http://www.lm-sensors.nu
+config I2C_ISA
+ tristate " ISA Bus support"
+ depends on I2C && I2C_PROC && ISA && EXPERIMENTAL
+ help
+ If you say yes to this option, support will be included for i2c
+ interfaces that are on the ISA bus.
+
+ This can also be built as a module which can be inserted and removed
+ while the kernel is running. If you want to compile it as a module,
+ say M here and read